From: Andrea Amorese Date: Wed, 22 Sep 2021 14:45:23 +0000 (+0200) Subject: Built motion from commit 008d0846.|2.5.35 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;/%22card-image.png//%27?a=commitdiff_plain;h=120f342b34bc71f0575aa6f49e1da428d0f7ad3e;p=motion2.git Built motion from commit 008d0846.|2.5.35 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index daba2d3..3989244 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-09-22T14:12:21.701Z", + "time": "2021-09-22T14:32:34.968Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 19dfd20..e62a065 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-09-22T14:12:21.701Z", + "time": "2021-09-22T14:32:34.968Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index b506c89..450c3b6 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 _0x5410=['exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','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)]','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]','TEXT','urlForward[body]'];(function(_0x42bb6d,_0x412255){var _0x1db89b=function(_0x5da43a){while(--_0x5da43a){_0x42bb6d['push'](_0x42bb6d['shift']());}};_0x1db89b(++_0x412255);}(_0x5410,0xa0));var _0x0541=function(_0x55c234,_0x7a8f12){_0x55c234=_0x55c234-0x0;var _0x18728a=_0x5410[_0x55c234];return _0x18728a;};'use strict';var Sequelize=require('sequelize');module[_0x0541('0x0')]={'name':{'type':Sequelize[_0x0541('0x1')],'get':function(_0x8c456b){return this[_0x0541('0x2')](_0x0541('0x3'));}},'action':{'type':Sequelize[_0x0541('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x0541('0x5'),_0x0541('0x6'),_0x0541('0x7'),_0x0541('0x8'),'urlForward',_0x0541('0x9'),_0x0541('0xa'),_0x0541('0xb')]],'msg':_0x0541('0xc')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x0541('0x4')](0x1000),'comment':_0x0541('0xd')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x0541('0x4')](0x1000),'comment':_0x0541('0xe')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x0541('0xf')},'data5':{'type':Sequelize[_0x0541('0x4')](0x1000),'comments':_0x0541('0x10')},'data6':{'type':Sequelize[_0x0541('0x4')],'comments':_0x0541('0x11')},'data7':{'type':Sequelize[_0x0541('0x12')],'comments':_0x0541('0x13')}}; \ No newline at end of file +var _0xc69b=['jscripty','urlForward','browser','bot','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]','TEXT','urlForward[body]','sequelize','exports','getDataValue','action','STRING','contactManager','integration','motionbar'];(function(_0x392a29,_0x4ea6c1){var _0xe66a49=function(_0x49b321){while(--_0x49b321){_0x392a29['push'](_0x392a29['shift']());}};_0xe66a49(++_0x4ea6c1);}(_0xc69b,0x1d3));var _0xbc69=function(_0x50e40b,_0x338d17){_0x50e40b=_0x50e40b-0x0;var _0x2608b7=_0xc69b[_0x50e40b];return _0x2608b7;};'use strict';var Sequelize=require(_0xbc69('0x0'));module[_0xbc69('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3f1ece){return this[_0xbc69('0x2')](_0xbc69('0x3'));}},'action':{'type':Sequelize[_0xbc69('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xbc69('0x5'),_0xbc69('0x6'),_0xbc69('0x7'),_0xbc69('0x8'),_0xbc69('0x9'),_0xbc69('0xa'),_0xbc69('0xb'),'script']],'msg':_0xbc69('0xc')}},'comment':_0xbc69('0xc')},'data1':{'type':Sequelize[_0xbc69('0x4')](0x1000),'comment':_0xbc69('0xd')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xbc69('0xe')},'data3':{'type':Sequelize[_0xbc69('0x4')](0x1000),'comment':_0xbc69('0xf')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0xbc69('0x10')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0xbc69('0x4')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0xbc69('0x11')],'comments':_0xbc69('0x12')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 8929fce..457efd0 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 _0x597e=['sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','then','destroy','stack','name','send','body','Action','find','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','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','../../config/logger','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x3bdc30,_0x119486){var _0x1a4986=function(_0x4a2ed0){while(--_0x4a2ed0){_0x3bdc30['push'](_0x3bdc30['shift']());}};_0x1a4986(++_0x119486);}(_0x597e,0x6e));var _0xe597=function(_0x178aed,_0x4dd59b){_0x178aed=_0x178aed-0x0;var _0x35d896=_0x597e[_0x178aed];return _0x35d896;};'use strict';var emlformat=require(_0xe597('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe597('0x1'));var jsonpatch=require(_0xe597('0x2'));var rp=require(_0xe597('0x3'));var moment=require(_0xe597('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe597('0x5'));var path=require(_0xe597('0x6'));var sox=require(_0xe597('0x7'));var csv=require('to-csv');var ejs=require(_0xe597('0x8'));var fs=require('fs');var fs_extra=require(_0xe597('0x9'));var _=require(_0xe597('0xa'));var squel=require(_0xe597('0xb'));var crypto=require('crypto');var jsforce=require(_0xe597('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe597('0xd'));var querystring=require(_0xe597('0xe'));var Papa=require(_0xe597('0xf'));var Redis=require(_0xe597('0x10'));var authService=require(_0xe597('0x11'));var qs=require(_0xe597('0x12'));var as=require(_0xe597('0x13'));var hardwareService=require(_0xe597('0x14'));var logger=require(_0xe597('0x15'))('api');var utils=require(_0xe597('0x16'));var config=require(_0xe597('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe597('0x18'))['db'];function respondWithStatusCode(_0x3792db,_0x52e824){_0x52e824=_0x52e824||0xcc;return function(_0x3156b3){if(_0x3156b3){return _0x3792db[_0xe597('0x19')](_0x52e824);}return _0x3792db[_0xe597('0x1a')](_0x52e824)[_0xe597('0x1b')]();};}function respondWithResult(_0x7ff3eb,_0x391565){_0x391565=_0x391565||0xc8;return function(_0x36071d){if(_0x36071d){return _0x7ff3eb['status'](_0x391565)[_0xe597('0x1c')](_0x36071d);}};}function respondWithFilteredResult(_0xdd026f,_0x4265fe){return function(_0x453c84){if(_0x453c84){var _0x43b3d8=typeof _0x4265fe[_0xe597('0x1d')]===_0xe597('0x1e')&&typeof _0x4265fe[_0xe597('0x1f')]===_0xe597('0x1e');var _0x5bca11=_0x453c84[_0xe597('0x20')];var _0x45b265=_0x43b3d8?0x0:_0x4265fe['offset'];var _0x573666=_0x43b3d8?_0x453c84['count']:_0x4265fe[_0xe597('0x1d')]+_0x4265fe['limit'];var _0x5e55c6;if(_0x573666>=_0x5bca11){_0x573666=_0x5bca11;_0x5e55c6=0xc8;}else{_0x5e55c6=0xce;}_0xdd026f[_0xe597('0x1a')](_0x5e55c6);return _0xdd026f['set']('Content-Range',_0x45b265+'-'+_0x573666+'/'+_0x5bca11)[_0xe597('0x1c')](_0x453c84);}return null;};}function patchUpdates(_0x712e2d){return function(_0x5edcd8){try{jsonpatch['apply'](_0x5edcd8,_0x712e2d,!![]);}catch(_0x4c2485){return BPromise[_0xe597('0x21')](_0x4c2485);}return _0x5edcd8[_0xe597('0x22')]();};}function saveUpdates(_0x795126,_0x14e007){return function(_0x4b3d96){if(_0x4b3d96){return _0x4b3d96[_0xe597('0x23')](_0x795126)[_0xe597('0x24')](function(_0x341b80){return _0x341b80;});}return null;};}function removeEntity(_0x53af4a,_0x318e4e){return function(_0x3b4e93){if(_0x3b4e93){return _0x3b4e93[_0xe597('0x25')]()['then'](function(){_0x53af4a[_0xe597('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1eb2c5,_0x1cb205){return function(_0x555dfd){if(!_0x555dfd){_0x1eb2c5[_0xe597('0x19')](0x194);}return _0x555dfd;};}function handleError(_0x187053,_0x3de7ce){_0x3de7ce=_0x3de7ce||0x1f4;return function(_0x1db1c0){logger['error'](_0x1db1c0[_0xe597('0x26')]);if(_0x1db1c0[_0xe597('0x27')]){delete _0x1db1c0[_0xe597('0x27')];}_0x187053[_0xe597('0x1a')](_0x3de7ce)[_0xe597('0x28')](_0x1db1c0);};}exports[_0xe597('0x23')]=function(_0xba9b7f,_0xe8cbba){if(_0xba9b7f[_0xe597('0x29')]['id']){delete _0xba9b7f[_0xe597('0x29')]['id'];}return db[_0xe597('0x2a')][_0xe597('0x2b')]({'where':{'id':_0xba9b7f['params']['id']}})[_0xe597('0x24')](handleEntityNotFound(_0xe8cbba,null))['then'](saveUpdates(_0xba9b7f[_0xe597('0x29')],null))[_0xe597('0x24')](respondWithResult(_0xe8cbba,null))[_0xe597('0x2c')](handleError(_0xe8cbba,null));};exports[_0xe597('0x25')]=function(_0xce44d8,_0x27fb35){return db['Action'][_0xe597('0x2b')]({'where':{'id':_0xce44d8['params']['id']}})['then'](handleEntityNotFound(_0x27fb35,null))[_0xe597('0x24')](removeEntity(_0x27fb35,null))[_0xe597('0x2c')](handleError(_0x27fb35,null));}; \ No newline at end of file +var _0xf9c3=['../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','body','find','params','catch','Action','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4c6abc,_0x5dfb0b){var _0x146d22=function(_0x371bf2){while(--_0x371bf2){_0x4c6abc['push'](_0x4c6abc['shift']());}};_0x146d22(++_0x5dfb0b);}(_0xf9c3,0xd5));var _0x3f9c=function(_0x5dea35,_0x4403ce){_0x5dea35=_0x5dea35-0x0;var _0x420537=_0xf9c3[_0x5dea35];return _0x420537;};'use strict';var emlformat=require(_0x3f9c('0x0'));var rimraf=require(_0x3f9c('0x1'));var zipdir=require(_0x3f9c('0x2'));var jsonpatch=require(_0x3f9c('0x3'));var rp=require('request-promise');var moment=require(_0x3f9c('0x4'));var BPromise=require(_0x3f9c('0x5'));var Mustache=require(_0x3f9c('0x6'));var util=require(_0x3f9c('0x7'));var path=require('path');var sox=require(_0x3f9c('0x8'));var csv=require(_0x3f9c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3f9c('0xa'));var squel=require(_0x3f9c('0xb'));var crypto=require(_0x3f9c('0xc'));var jsforce=require(_0x3f9c('0xd'));var deskjs=require(_0x3f9c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3f9c('0xf'));var Papa=require(_0x3f9c('0x10'));var Redis=require(_0x3f9c('0x11'));var authService=require(_0x3f9c('0x12'));var qs=require(_0x3f9c('0x13'));var as=require(_0x3f9c('0x14'));var hardwareService=require(_0x3f9c('0x15'));var logger=require(_0x3f9c('0x16'))('api');var utils=require(_0x3f9c('0x17'));var config=require(_0x3f9c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f9c('0x19'))['db'];function respondWithStatusCode(_0x5d42b5,_0x2c460c){_0x2c460c=_0x2c460c||0xcc;return function(_0x3196b9){if(_0x3196b9){return _0x5d42b5['sendStatus'](_0x2c460c);}return _0x5d42b5[_0x3f9c('0x1a')](_0x2c460c)[_0x3f9c('0x1b')]();};}function respondWithResult(_0x53478a,_0x1bbf39){_0x1bbf39=_0x1bbf39||0xc8;return function(_0x3cf94e){if(_0x3cf94e){return _0x53478a['status'](_0x1bbf39)[_0x3f9c('0x1c')](_0x3cf94e);}};}function respondWithFilteredResult(_0x3ebc42,_0x3ea7a8){return function(_0x1b654d){if(_0x1b654d){var _0x5c189f=typeof _0x3ea7a8[_0x3f9c('0x1d')]===_0x3f9c('0x1e')&&typeof _0x3ea7a8['limit']==='undefined';var _0xb797cd=_0x1b654d['count'];var _0x5d8363=_0x5c189f?0x0:_0x3ea7a8[_0x3f9c('0x1d')];var _0x42037c=_0x5c189f?_0x1b654d[_0x3f9c('0x1f')]:_0x3ea7a8['offset']+_0x3ea7a8['limit'];var _0x53605c;if(_0x42037c>=_0xb797cd){_0x42037c=_0xb797cd;_0x53605c=0xc8;}else{_0x53605c=0xce;}_0x3ebc42[_0x3f9c('0x1a')](_0x53605c);return _0x3ebc42[_0x3f9c('0x20')](_0x3f9c('0x21'),_0x5d8363+'-'+_0x42037c+'/'+_0xb797cd)['json'](_0x1b654d);}return null;};}function patchUpdates(_0x49d438){return function(_0xff853c){try{jsonpatch[_0x3f9c('0x22')](_0xff853c,_0x49d438,!![]);}catch(_0x10c5de){return BPromise[_0x3f9c('0x23')](_0x10c5de);}return _0xff853c['save']();};}function saveUpdates(_0x45411f,_0x2d51d1){return function(_0x32b1be){if(_0x32b1be){return _0x32b1be[_0x3f9c('0x24')](_0x45411f)[_0x3f9c('0x25')](function(_0x15f0b3){return _0x15f0b3;});}return null;};}function removeEntity(_0x1d091f,_0xdd4960){return function(_0xcf697){if(_0xcf697){return _0xcf697[_0x3f9c('0x26')]()[_0x3f9c('0x25')](function(){_0x1d091f[_0x3f9c('0x1a')](0xcc)[_0x3f9c('0x1b')]();});}};}function handleEntityNotFound(_0x17c554,_0x240dde){return function(_0x36168c){if(!_0x36168c){_0x17c554['sendStatus'](0x194);}return _0x36168c;};}function handleError(_0xb2a148,_0x2a8b73){_0x2a8b73=_0x2a8b73||0x1f4;return function(_0x469a7f){logger[_0x3f9c('0x27')](_0x469a7f[_0x3f9c('0x28')]);if(_0x469a7f['name']){delete _0x469a7f[_0x3f9c('0x29')];}_0xb2a148[_0x3f9c('0x1a')](_0x2a8b73)['send'](_0x469a7f);};}exports[_0x3f9c('0x24')]=function(_0x2ca57d,_0x1f9612){if(_0x2ca57d[_0x3f9c('0x2a')]['id']){delete _0x2ca57d[_0x3f9c('0x2a')]['id'];}return db['Action'][_0x3f9c('0x2b')]({'where':{'id':_0x2ca57d[_0x3f9c('0x2c')]['id']}})[_0x3f9c('0x25')](handleEntityNotFound(_0x1f9612,null))[_0x3f9c('0x25')](saveUpdates(_0x2ca57d[_0x3f9c('0x2a')],null))[_0x3f9c('0x25')](respondWithResult(_0x1f9612,null))[_0x3f9c('0x2d')](handleError(_0x1f9612,null));};exports[_0x3f9c('0x26')]=function(_0x4eadae,_0x52fbc5){return db[_0x3f9c('0x2e')][_0x3f9c('0x2b')]({'where':{'id':_0x4eadae['params']['id']}})[_0x3f9c('0x25')](handleEntityNotFound(_0x52fbc5,null))[_0x3f9c('0x25')](removeEntity(_0x52fbc5,null))['catch'](handleError(_0x52fbc5,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 9975d81..9f07a60 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 _0x5305=['moment','path','rimraf','define','Action','tools_actions','util','../../config/logger'];(function(_0x2aceeb,_0x262b37){var _0xd0c95e=function(_0x535a59){while(--_0x535a59){_0x2aceeb['push'](_0x2aceeb['shift']());}};_0xd0c95e(++_0x262b37);}(_0x5305,0x9e));var _0x5530=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5305[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0x5530('0x0'));var logger=require(_0x5530('0x1'))('api');var moment=require(_0x5530('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5530('0x3'));var rimraf=require(_0x5530('0x4'));var config=require('../../config/environment');var attributes=require('./action.attributes');module['exports']=function(_0x9fa2a2,_0x4cf450){return _0x9fa2a2[_0x5530('0x5')](_0x5530('0x6'),attributes,{'tableName':_0x5530('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeff4=['api','moment','bluebird','request-promise','rimraf','Action','tools_actions','lodash','util','../../config/logger'];(function(_0x5bc372,_0x446052){var _0x4749ba=function(_0x9a972c){while(--_0x9a972c){_0x5bc372['push'](_0x5bc372['shift']());}};_0x4749ba(++_0x446052);}(_0xeff4,0x16f));var _0x4eff=function(_0x126f47,_0x2199e9){_0x126f47=_0x126f47-0x0;var _0x49508a=_0xeff4[_0x126f47];return _0x49508a;};'use strict';var _=require(_0x4eff('0x0'));var util=require(_0x4eff('0x1'));var logger=require(_0x4eff('0x2'))(_0x4eff('0x3'));var moment=require(_0x4eff('0x4'));var BPromise=require(_0x4eff('0x5'));var rp=require(_0x4eff('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4eff('0x7'));var config=require('../../config/environment');var attributes=require('./action.attributes');module['exports']=function(_0x3fd53c,_0x413ee2){return _0x3fd53c['define'](_0x4eff('0x8'),attributes,{'tableName':_0x4eff('0x9'),'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 ae8a7c0..df3c3ff 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 _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4d7f3f,_0x4d2803){var _0x5d67cc=function(_0x2c37f4){while(--_0x2c37f4){_0x4d7f3f['push'](_0x4d7f3f['shift']());}};_0x5d67cc(++_0x4d2803);}(_0xf494,0x1c6));var _0x4f49=function(_0x34042c,_0x3ccb92){_0x34042c=_0x34042c-0x0;var _0x53f279=_0xf494[_0x34042c];return _0x53f279;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file +var _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1bd323,_0x1c16ab){var _0x13097b=function(_0x4cc5de){while(--_0x4cc5de){_0x1bd323['push'](_0x1bd323['shift']());}};_0x13097b(++_0x1c16ab);}(_0xf494,0x1c6));var _0x4f49=function(_0x17cce8,_0x2ad6d5){_0x17cce8=_0x17cce8-0x0;var _0x41d0d8=_0xf494[_0x17cce8];return _0x41d0d8;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index dd66430..274b527 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 _0xb825=['fs-extra','../../components/auth/service','../../config/environment','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','express','Router'];(function(_0x3439ea,_0x3c68ba){var _0x3900a3=function(_0x38f9a5){while(--_0x38f9a5){_0x3439ea['push'](_0x3439ea['shift']());}};_0x3900a3(++_0x3c68ba);}(_0xb825,0x130));var _0x5b82=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb825[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x5b82('0x0'));var util=require(_0x5b82('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5b82('0x2'));var router=express[_0x5b82('0x3')]();var fs_extra=require(_0x5b82('0x4'));var auth=require(_0x5b82('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5b82('0x6'));var controller=require('./action.controller');router[_0x5b82('0x7')](_0x5b82('0x8'),auth[_0x5b82('0x9')](),controller[_0x5b82('0xa')]);router[_0x5b82('0xb')](_0x5b82('0x8'),auth[_0x5b82('0x9')](),controller[_0x5b82('0xc')]);module[_0x5b82('0xd')]=router; \ No newline at end of file +var _0xd80f=['delete','isAuthenticated','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','put','/:id','update'];(function(_0xe39824,_0xbdf61f){var _0x4bc31e=function(_0x594760){while(--_0x594760){_0xe39824['push'](_0xe39824['shift']());}};_0x4bc31e(++_0xbdf61f);}(_0xd80f,0xc7));var _0xfd80=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd80f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfd80('0x0'));var util=require(_0xfd80('0x1'));var path=require('path');var timeout=require(_0xfd80('0x2'));var express=require(_0xfd80('0x3'));var router=express[_0xfd80('0x4')]();var fs_extra=require(_0xfd80('0x5'));var auth=require(_0xfd80('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfd80('0x7'));var controller=require('./action.controller');router[_0xfd80('0x8')](_0xfd80('0x9'),auth['isAuthenticated'](),controller[_0xfd80('0xa')]);router[_0xfd80('0xb')](_0xfd80('0x9'),auth[_0xfd80('0xc')](),controller[_0xfd80('0xd')]);module[_0xfd80('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 7bc8758..d49f9b8 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 _0x1cb9=['TEXT','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4701d9,_0x4bd3e4){_0x4701d9=_0x4701d9-0x0;var _0x8f8620=_0x1cb9[_0x4701d9];return _0x8f8620;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'name':{'type':Sequelize[_0x91cb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x91cb('0x1')]},'parent':{'type':Sequelize[_0x91cb('0x1')]},'table':{'type':Sequelize[_0x91cb('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x91cb('0x2')]}}; \ No newline at end of file +var _0xae24=['sequelize','STRING'];(function(_0x2dc272,_0x28b70d){var _0x109da9=function(_0x46f63e){while(--_0x46f63e){_0x2dc272['push'](_0x2dc272['shift']());}};_0x109da9(++_0x28b70d);}(_0xae24,0x182));var _0x4ae2=function(_0x206fd0,_0x4e33a4){_0x206fd0=_0x206fd0-0x0;var _0x2457be=_0xae24[_0x206fd0];return _0x2457be;};'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/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 3f31035..5095b51 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 _0x26c8=['operator','value','Sequelize','ValidationErrorItem','keyBy','select','metric','groupBy','clone','web','fullPath','%s-%s.%s','randomstring','generate','output','csv','custom','AnalyticExtractedReport','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','join','../../components/export/','countTable','COUNT(*)','SELECT','run','runReport','UNIX_TIMESTAMP(%s)','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','undefined','limit','offset','count','set','reject','save','update','then','get','CustomReports','UserProfileResource','destroy','error','name','send','index','AnalyticCustomReport','rawAttributes','fieldName','map','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','type','VIRTUAL','merge','includeAll','include','rows','catch','show','params','length','find','create','body','user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20EMPTY','rules','group','condition','options','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','from','table','MetricId','field','function','replace','format','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','MAX(%s)','DATE(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY'];(function(_0x3c6a91,_0x2cf7ee){var _0x170a38=function(_0x41df54){while(--_0x41df54){_0x3c6a91['push'](_0x3c6a91['shift']());}};_0x170a38(++_0x2cf7ee);}(_0x26c8,0xc9));var _0x826c=function(_0x72b94c,_0x22de6a){_0x72b94c=_0x72b94c-0x0;var _0x5893fd=_0x26c8[_0x72b94c];return _0x5893fd;};'use strict';var emlformat=require(_0x826c('0x0'));var rimraf=require(_0x826c('0x1'));var zipdir=require(_0x826c('0x2'));var jsonpatch=require(_0x826c('0x3'));var rp=require(_0x826c('0x4'));var moment=require(_0x826c('0x5'));var BPromise=require(_0x826c('0x6'));var Mustache=require(_0x826c('0x7'));var util=require(_0x826c('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x826c('0x9'));var ejs=require(_0x826c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x826c('0xb'));var crypto=require(_0x826c('0xc'));var jsforce=require(_0x826c('0xd'));var deskjs=require(_0x826c('0xe'));var toCsv=require(_0x826c('0x9'));var querystring=require(_0x826c('0xf'));var Papa=require(_0x826c('0x10'));var Redis=require(_0x826c('0x11'));var authService=require(_0x826c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x826c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x826c('0x14'))(_0x826c('0x15'));var utils=require(_0x826c('0x16'));var config=require(_0x826c('0x17'));var licenseUtil=require(_0x826c('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0x826c('0x19'))[_0x826c('0x1a')];function respondWithStatusCode(_0x4d922f,_0x509241){_0x509241=_0x509241||0xcc;return function(_0x5bce7b){if(_0x5bce7b){return _0x4d922f[_0x826c('0x1b')](_0x509241);}return _0x4d922f[_0x826c('0x1c')](_0x509241)[_0x826c('0x1d')]();};}function respondWithResult(_0x317a85,_0x4e1a04){_0x4e1a04=_0x4e1a04||0xc8;return function(_0x4d9afa){if(_0x4d9afa){return _0x317a85['status'](_0x4e1a04)[_0x826c('0x1e')](_0x4d9afa);}};}function respondWithFilteredResult(_0x1e82e5,_0x13fc9){return function(_0x2c49df){if(_0x2c49df){var _0x318cef=typeof _0x13fc9['offset']===_0x826c('0x1f')&&typeof _0x13fc9[_0x826c('0x20')]==='undefined';var _0x4e3899=_0x2c49df['count'];var _0x5867e5=_0x318cef?0x0:_0x13fc9[_0x826c('0x21')];var _0x8a2f88=_0x318cef?_0x2c49df[_0x826c('0x22')]:_0x13fc9[_0x826c('0x21')]+_0x13fc9[_0x826c('0x20')];var _0x12be20;if(_0x8a2f88>=_0x4e3899){_0x8a2f88=_0x4e3899;_0x12be20=0xc8;}else{_0x12be20=0xce;}_0x1e82e5[_0x826c('0x1c')](_0x12be20);return _0x1e82e5[_0x826c('0x23')]('Content-Range',_0x5867e5+'-'+_0x8a2f88+'/'+_0x4e3899)['json'](_0x2c49df);}return null;};}function patchUpdates(_0x55780d){return function(_0x4f02fa){try{jsonpatch['apply'](_0x4f02fa,_0x55780d,!![]);}catch(_0x4c154c){return BPromise[_0x826c('0x24')](_0x4c154c);}return _0x4f02fa[_0x826c('0x25')]();};}function saveUpdates(_0x3c0c46,_0x4dfeb8){return function(_0x5397b1){if(_0x5397b1){return _0x5397b1[_0x826c('0x26')](_0x3c0c46)['then'](function(_0x4d438f){return _0x4d438f;});}return null;};}function removeEntity(_0x50f755,_0x31dcd6){return function(_0x38adea){if(_0x38adea){return _0x38adea['destroy']()[_0x826c('0x27')](function(){var _0x3a3901=_0x38adea[_0x826c('0x28')]({'plain':!![]});var _0x2968e6=_0x826c('0x29');return db[_0x826c('0x2a')][_0x826c('0x2b')]({'where':{'type':_0x2968e6,'resourceId':_0x3a3901['id']}})['then'](function(){return _0x38adea;});})['then'](function(){_0x50f755['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x40c9d3,_0x324ebf){return function(_0x43e6e5){if(!_0x43e6e5){_0x40c9d3[_0x826c('0x1b')](0x194);}return _0x43e6e5;};}function handleError(_0x354f73,_0x3c9718){_0x3c9718=_0x3c9718||0x1f4;return function(_0x3928c2){logger[_0x826c('0x2c')](_0x3928c2['stack']);if(_0x3928c2[_0x826c('0x2d')]){delete _0x3928c2[_0x826c('0x2d')];}_0x354f73[_0x826c('0x1c')](_0x3c9718)[_0x826c('0x2e')](_0x3928c2);};}exports[_0x826c('0x2f')]=function(_0x45d74f,_0x39da9b){var _0x34ce56={},_0x341f6e={},_0x11ee9e={'count':0x0,'rows':[]};var _0x337584=_['map'](db[_0x826c('0x30')][_0x826c('0x31')],function(_0x5b7246){return{'name':_0x5b7246[_0x826c('0x32')],'type':_0x5b7246['type']['key']};});_0x341f6e['model']=_[_0x826c('0x33')](_0x337584,_0x826c('0x2d'));_0x341f6e['query']=_[_0x826c('0x34')](_0x45d74f[_0x826c('0x35')]);_0x341f6e[_0x826c('0x36')]=_[_0x826c('0x37')](_0x341f6e[_0x826c('0x38')],_0x341f6e['query']);_0x34ce56[_0x826c('0x39')]=_[_0x826c('0x37')](_0x341f6e['model'],qs[_0x826c('0x3a')](_0x45d74f['query'][_0x826c('0x3a')]));_0x34ce56['attributes']=_0x34ce56[_0x826c('0x39')]['length']?_0x34ce56[_0x826c('0x39')]:_0x341f6e[_0x826c('0x38')];if(!_0x45d74f[_0x826c('0x35')][_0x826c('0x3b')]('nolimit')){_0x34ce56[_0x826c('0x20')]=qs[_0x826c('0x20')](_0x45d74f['query'][_0x826c('0x20')]);_0x34ce56[_0x826c('0x21')]=qs[_0x826c('0x21')](_0x45d74f[_0x826c('0x35')][_0x826c('0x21')]);}_0x34ce56[_0x826c('0x3c')]=qs[_0x826c('0x3d')](_0x45d74f[_0x826c('0x35')]['sort']);_0x34ce56['where']=qs['filters'](_[_0x826c('0x3e')](_0x45d74f[_0x826c('0x35')],_0x341f6e[_0x826c('0x36')]),_0x337584);if(_0x45d74f[_0x826c('0x35')][_0x826c('0x3f')]){_0x34ce56[_0x826c('0x40')]=_['merge'](_0x34ce56['where'],{'$or':_[_0x826c('0x33')](_0x337584,function(_0x3ad961){if(_0x3ad961[_0x826c('0x41')]!==_0x826c('0x42')){var _0x4d4833={};_0x4d4833[_0x3ad961['name']]={'$like':'%'+_0x45d74f[_0x826c('0x35')][_0x826c('0x3f')]+'%'};return _0x4d4833;}})});}_0x34ce56=_[_0x826c('0x43')]({},_0x34ce56,_0x45d74f['options']);var _0x42151b={'where':_0x34ce56['where']};return db[_0x826c('0x30')][_0x826c('0x22')](_0x42151b)[_0x826c('0x27')](function(_0x2dc6ee){_0x11ee9e['count']=_0x2dc6ee;if(_0x45d74f[_0x826c('0x35')][_0x826c('0x44')]){_0x34ce56[_0x826c('0x45')]=[{'all':!![]}];}return db[_0x826c('0x30')]['findAll'](_0x34ce56);})[_0x826c('0x27')](function(_0x4b4066){_0x11ee9e[_0x826c('0x46')]=_0x4b4066;return _0x11ee9e;})[_0x826c('0x27')](respondWithFilteredResult(_0x39da9b,_0x34ce56))[_0x826c('0x47')](handleError(_0x39da9b,null));};exports[_0x826c('0x48')]=function(_0x32364c,_0x13df2f){var _0x16a8fa={'raw':![],'where':{'id':_0x32364c[_0x826c('0x49')]['id']}},_0x1fc492={};_0x1fc492[_0x826c('0x38')]=_[_0x826c('0x34')](db[_0x826c('0x30')][_0x826c('0x31')]);_0x1fc492[_0x826c('0x35')]=_[_0x826c('0x34')](_0x32364c[_0x826c('0x35')]);_0x1fc492[_0x826c('0x36')]=_[_0x826c('0x37')](_0x1fc492[_0x826c('0x38')],_0x1fc492[_0x826c('0x35')]);_0x16a8fa[_0x826c('0x39')]=_[_0x826c('0x37')](_0x1fc492[_0x826c('0x38')],qs[_0x826c('0x3a')](_0x32364c['query'][_0x826c('0x3a')]));_0x16a8fa[_0x826c('0x39')]=_0x16a8fa[_0x826c('0x39')][_0x826c('0x4a')]?_0x16a8fa[_0x826c('0x39')]:_0x1fc492[_0x826c('0x38')];if(_0x32364c['query'][_0x826c('0x44')]){_0x16a8fa['include']=[{'all':!![]}];}_0x16a8fa=_[_0x826c('0x43')]({},_0x16a8fa,_0x32364c['options']);return db[_0x826c('0x30')][_0x826c('0x4b')](_0x16a8fa)[_0x826c('0x27')](handleEntityNotFound(_0x13df2f,null))['then'](respondWithResult(_0x13df2f,null))[_0x826c('0x47')](handleError(_0x13df2f,null));};exports[_0x826c('0x4c')]=function(_0x595447,_0x1a1f82){return db[_0x826c('0x30')][_0x826c('0x4c')](_0x595447[_0x826c('0x4d')],{})[_0x826c('0x27')](function(_0x84bb69){var _0x1b7837=_0x595447[_0x826c('0x4e')]['get']({'plain':!![]});if(!_0x1b7837)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b7837[_0x826c('0x4f')]==='user'){var _0x11003e=_0x84bb69[_0x826c('0x28')]({'plain':!![]});var _0x212679=_0x826c('0x50');return db[_0x826c('0x51')][_0x826c('0x4b')]({'where':{'name':_0x212679,'userProfileId':_0x1b7837[_0x826c('0x52')]},'raw':!![]})[_0x826c('0x27')](function(_0x4e94f1){if(_0x4e94f1&&_0x4e94f1[_0x826c('0x53')]===0x0){return db[_0x826c('0x2a')][_0x826c('0x4c')]({'name':_0x11003e[_0x826c('0x2d')],'resourceId':_0x11003e['id'],'type':'CustomReports','sectionId':_0x4e94f1['id']},{})[_0x826c('0x27')](function(){return _0x84bb69;});}else{return _0x84bb69;}})[_0x826c('0x47')](function(_0x1e4a71){logger[_0x826c('0x2c')](_0x826c('0x54'),_0x1e4a71);throw _0x1e4a71;});}return _0x84bb69;})['then'](respondWithResult(_0x1a1f82,0xc9))['catch'](handleError(_0x1a1f82,null));};exports[_0x826c('0x26')]=function(_0x4d4a26,_0x4bf407){if(_0x4d4a26['body']['id']){delete _0x4d4a26[_0x826c('0x4d')]['id'];}return db[_0x826c('0x30')][_0x826c('0x4b')]({'where':{'id':_0x4d4a26[_0x826c('0x49')]['id']}})[_0x826c('0x27')](handleEntityNotFound(_0x4bf407,null))[_0x826c('0x27')](saveUpdates(_0x4d4a26[_0x826c('0x4d')],null))[_0x826c('0x27')](respondWithResult(_0x4bf407,null))[_0x826c('0x47')](handleError(_0x4bf407,null));};exports[_0x826c('0x2b')]=function(_0x1b0998,_0x17fc18){return db[_0x826c('0x30')][_0x826c('0x4b')]({'where':{'id':_0x1b0998[_0x826c('0x49')]['id']}})['then'](handleEntityNotFound(_0x17fc18,null))[_0x826c('0x27')](removeEntity(_0x17fc18,null))['catch'](handleError(_0x17fc18,null));};exports[_0x826c('0x55')]=function(_0x14da02,_0x37efda){var _0xfef486=0xa;var _0x2bf9ad=['join',_0x826c('0x56'),'right_join',_0x826c('0x57')];var _0xb90cb5={'SUM':_0x826c('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x826c('0x59'),'MAX':'MAX(%s)','MIN':_0x826c('0x5a'),'AVG':_0x826c('0x5b'),'GROUP_CONCAT':_0x826c('0x5c'),'GROUP_CONCAT ASC':_0x826c('0x5d'),'GROUP_CONCAT DESC':_0x826c('0x5e')};var _0x138f4a={'SEC_TO_TIME':_0x826c('0x5f'),'DATE':'DATE(%s)','HOUR':_0x826c('0x60'),'ROUND':_0x826c('0x61'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x22cd0d=function(_0x8d39f4){return!_[_0x826c('0x62')]([_0x826c('0x63'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x826c('0x64')],_0x8d39f4);};var _0x16e36d=function(_0x3cff87){if(!_0x3cff87||!_0x3cff87[_0x826c('0x65')]['length']){return'';}for(var _0x49766c='(',_0x1a7585=0x0;_0x1a7585<_0x3cff87[_0x826c('0x65')]['length'];_0x1a7585+=0x1){_0x1a7585>0x0&&(_0x49766c+='\x20'+_0x3cff87['operator']+'\x20');_0x49766c+=_0x3cff87[_0x826c('0x65')][_0x1a7585]['group']?_0x16e36d(_0x3cff87['rules'][_0x1a7585][_0x826c('0x66')]):_0x3cff87[_0x826c('0x65')][_0x1a7585]['field']+'\x20'+_0x3cff87['rules'][_0x1a7585][_0x826c('0x67')]+(_0x22cd0d(_0x3cff87[_0x826c('0x65')][_0x1a7585]['condition'])?'\x20'+_0x3cff87[_0x826c('0x65')][_0x1a7585]['value']:'');}return _0x49766c+')';};var _0x47ee39={'where':{'id':_0x14da02[_0x826c('0x49')]['id']}},_0x5e9aff,_0x59f844,_0x393f53,_0x4dab08,_0x3f941a;_0x47ee39=_['merge']({},_0x47ee39,_0x14da02[_0x826c('0x68')]);return db[_0x826c('0x30')][_0x826c('0x4b')](_0x47ee39)['then'](function(_0x1911c8){if(_0x1911c8){_0x5e9aff=_0x1911c8;return _0x1911c8[_0x826c('0x69')]();}return null;})[_0x826c('0x27')](function(_0x105cdc){if(_0x105cdc){if(!_0x105cdc[_0x826c('0x4a')]){throw new db['Sequelize']['ValidationErrorItem'](_0x826c('0x6a'),0x193);}_0x59f844=_0x105cdc;return db[_0x826c('0x6b')][_0x826c('0x6c')]({'raw':!![]});}return null;})[_0x826c('0x27')](function(_0x42c8b0){if(_0x42c8b0){_0x393f53=_['keyBy'](_0x42c8b0,'id');var _0x19fbbe;var _0x3f07b6=squel['select']();_0x3f07b6[_0x826c('0x6d')](_0x5e9aff[_0x826c('0x6e')]);for(var _0x5e0424=0x0;_0x5e0424<_0x59f844[_0x826c('0x4a')];_0x5e0424+=0x1){_0x19fbbe=_0x59f844[_0x5e0424]['MetricId']?_0x393f53[_0x59f844[_0x5e0424][_0x826c('0x6f')]]['metric']:_0x59f844[_0x5e0424][_0x826c('0x70')];_0x19fbbe=_0x59f844[_0x5e0424][_0x826c('0x71')]?_[_0x826c('0x72')](_0xb90cb5[_0x59f844[_0x5e0424][_0x826c('0x71')]],'%s',_0x19fbbe):_0x19fbbe;_0x19fbbe=_0x59f844[_0x5e0424][_0x826c('0x73')]?_[_0x826c('0x72')](_0x138f4a[_0x59f844[_0x5e0424]['format']],'%s',_0x19fbbe):_0x19fbbe;if(_0x59f844[_0x5e0424]['groupBy']){_0x3f07b6[_0x826c('0x66')](_0x19fbbe);}_0x59f844[_0x5e0424][_0x826c('0x74')]&&_0x3f07b6[_0x826c('0x3c')](_0x19fbbe,_0x59f844[_0x5e0424][_0x826c('0x74')]===_0x826c('0x75')?![]:!![]);_0x3f07b6[_0x826c('0x70')](_0x19fbbe,_0x59f844[_0x5e0424][_0x826c('0x76')]||_0x19fbbe);}if(_0x5e9aff[_0x826c('0x77')]){_0x5e9aff[_0x826c('0x77')]=JSON[_0x826c('0x78')](_0x5e9aff['joins']);for(var _0x17cd9b=0x0;_0x17cd9b<_0x5e9aff[_0x826c('0x77')][_0x826c('0x4a')];_0x17cd9b+=0x1){if(_0x5e9aff[_0x826c('0x77')][_0x17cd9b][_0x826c('0x41')]&&_['includes'](_0x2bf9ad,_0x5e9aff[_0x826c('0x77')][_0x17cd9b][_0x826c('0x41')])&&_0x5e9aff[_0x826c('0x77')][_0x17cd9b][_0x826c('0x79')]&&_0x5e9aff[_0x826c('0x77')][_0x17cd9b][_0x826c('0x7a')]&&_0x5e9aff['joins'][_0x17cd9b][_0x826c('0x7b')]){_0x3f07b6[_0x5e9aff[_0x826c('0x77')][_0x17cd9b][_0x826c('0x41')]](_0x5e9aff[_0x826c('0x77')][_0x17cd9b][_0x826c('0x7a')],null,util[_0x826c('0x73')](_0x826c('0x7c'),_0x5e9aff['table'],_0x5e9aff[_0x826c('0x77')][_0x17cd9b][_0x826c('0x79')],_0x5e9aff[_0x826c('0x77')][_0x17cd9b][_0x826c('0x7a')],_0x5e9aff[_0x826c('0x77')][_0x17cd9b][_0x826c('0x7b')]));}}}if(_0x5e9aff[_0x826c('0x7d')]){_0x5e9aff[_0x826c('0x7d')]=JSON[_0x826c('0x78')](_0x5e9aff[_0x826c('0x7d')]);_0x3f07b6['where'](_0x16e36d(_0x5e9aff['conditions'][_0x826c('0x66')]));}_0x3f941a=_0x3f07b6['clone']();_0x3f07b6[_0x826c('0x20')](_0xfef486);_0x3f07b6['offset'](0x0);logger[_0x826c('0x7e')](_0x826c('0x7f'),_0x3f07b6[_0x826c('0x80')]());return dbH[_0x826c('0x81')][_0x826c('0x35')](_0x3f07b6[_0x826c('0x80')](),{'type':dbH[_0x826c('0x81')][_0x826c('0x82')]['SELECT']});}})['then'](respondWithResult(_0x37efda,null))[_0x826c('0x47')](handleError(_0x37efda,null));};function runReport(_0x4e7018,_0x56bd0d,_0x10c2b8){var _0x43f2af=_0x56bd0d[_0x826c('0x2d')];var _0x26d496=0xa;var _0xe32ede=['join','left_join','right_join',_0x826c('0x57')];var _0x3b0364={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x826c('0x59'),'MAX':_0x826c('0x83'),'MIN':_0x826c('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x826c('0x5c'),'GROUP_CONCAT ASC':_0x826c('0x5d'),'GROUP_CONCAT DESC':_0x826c('0x5e')};var _0x315044={'SEC_TO_TIME':_0x826c('0x5f'),'DATE':_0x826c('0x84'),'HOUR':_0x826c('0x60'),'ROUND':_0x826c('0x61'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x44b0f3=function(_0x5ccc63){return!_[_0x826c('0x62')]([_0x826c('0x63'),_0x826c('0x85'),_0x826c('0x86'),_0x826c('0x64')],_0x5ccc63);};var _0x33a654=function(_0x34ac3e){if(!_0x34ac3e||!_0x34ac3e[_0x826c('0x65')][_0x826c('0x4a')]){return'';}for(var _0x11210f='(',_0x2cdad5=0x0;_0x2cdad5<_0x34ac3e[_0x826c('0x65')][_0x826c('0x4a')];_0x2cdad5+=0x1){_0x2cdad5>0x0&&(_0x11210f+='\x20'+_0x34ac3e[_0x826c('0x87')]+'\x20');_0x11210f+=_0x34ac3e[_0x826c('0x65')][_0x2cdad5][_0x826c('0x66')]?_0x33a654(_0x34ac3e[_0x826c('0x65')][_0x2cdad5][_0x826c('0x66')]):_0x34ac3e['rules'][_0x2cdad5]['field']+'\x20'+_0x34ac3e[_0x826c('0x65')][_0x2cdad5][_0x826c('0x67')]+(_0x44b0f3(_0x34ac3e[_0x826c('0x65')][_0x2cdad5][_0x826c('0x67')])?'\x20'+_0x34ac3e[_0x826c('0x65')][_0x2cdad5][_0x826c('0x88')]:'');}return _0x11210f+')';};var _0x38bdf2={'where':{'id':_0x4e7018['id']}},_0xed4289,_0x1454e0,_0x4238db,_0x1fd976,_0xef41be;_0x38bdf2=_[_0x826c('0x43')]({},_0x38bdf2,_0x10c2b8);return db[_0x826c('0x30')][_0x826c('0x4b')](_0x38bdf2)['then'](function(_0x4330c3){if(_0x4330c3){_0xed4289=_0x4330c3;return _0x4330c3[_0x826c('0x69')]();}return null;})['then'](function(_0x4085c3){if(_0x4085c3){if(!_0x4085c3['length']){throw new db[(_0x826c('0x89'))][(_0x826c('0x8a'))](_0x826c('0x6a'),0x193);}_0x1454e0=_0x4085c3;return db['AnalyticMetric'][_0x826c('0x6c')]({'raw':!![]});}return null;})[_0x826c('0x27')](function(_0x324d7d){if(_0x324d7d){_0x4238db=_[_0x826c('0x8b')](_0x324d7d,'id');var _0x4f6679;var _0x2b0d7a=squel[_0x826c('0x8c')]();_0x2b0d7a['from'](_0xed4289[_0x826c('0x6e')]);for(var _0x4b83b1=0x0;_0x4b83b1<_0x1454e0[_0x826c('0x4a')];_0x4b83b1+=0x1){_0x4f6679=_0x1454e0[_0x4b83b1]['MetricId']?_0x4238db[_0x1454e0[_0x4b83b1]['MetricId']][_0x826c('0x8d')]:_0x1454e0[_0x4b83b1]['field'];_0x4f6679=_0x1454e0[_0x4b83b1]['function']?_[_0x826c('0x72')](_0x3b0364[_0x1454e0[_0x4b83b1][_0x826c('0x71')]],'%s',_0x4f6679):_0x4f6679;_0x4f6679=_0x1454e0[_0x4b83b1][_0x826c('0x73')]?_[_0x826c('0x72')](_0x315044[_0x1454e0[_0x4b83b1][_0x826c('0x73')]],'%s',_0x4f6679):_0x4f6679;if(_0x1454e0[_0x4b83b1][_0x826c('0x8e')]){_0x2b0d7a['group'](_0x4f6679);}_0x1454e0[_0x4b83b1][_0x826c('0x74')]&&_0x2b0d7a[_0x826c('0x3c')](_0x4f6679,_0x1454e0[_0x4b83b1]['orderBy']===_0x826c('0x75')?![]:!![]);_0x2b0d7a[_0x826c('0x70')](_0x4f6679,_0x1454e0[_0x4b83b1][_0x826c('0x76')]||_0x4f6679);}if(_0xed4289[_0x826c('0x77')]){_0xed4289[_0x826c('0x77')]=JSON['parse'](_0xed4289['joins']);for(var _0x1ab561=0x0;_0x1ab561<_0xed4289[_0x826c('0x77')][_0x826c('0x4a')];_0x1ab561+=0x1){if(_0xed4289[_0x826c('0x77')][_0x1ab561]['type']&&_['includes'](_0xe32ede,_0xed4289[_0x826c('0x77')][_0x1ab561]['type'])&&_0xed4289[_0x826c('0x77')][_0x1ab561][_0x826c('0x79')]&&_0xed4289[_0x826c('0x77')][_0x1ab561][_0x826c('0x7a')]&&_0xed4289[_0x826c('0x77')][_0x1ab561][_0x826c('0x7b')]){_0x2b0d7a[_0xed4289[_0x826c('0x77')][_0x1ab561][_0x826c('0x41')]](_0xed4289[_0x826c('0x77')][_0x1ab561][_0x826c('0x7a')],null,util[_0x826c('0x73')]('%s.%s\x20=\x20%s.%s',_0xed4289['table'],_0xed4289[_0x826c('0x77')][_0x1ab561][_0x826c('0x79')],_0xed4289[_0x826c('0x77')][_0x1ab561][_0x826c('0x7a')],_0xed4289['joins'][_0x1ab561][_0x826c('0x7b')]));}}}if(_0xed4289[_0x826c('0x7d')]){_0xed4289[_0x826c('0x7d')]=JSON[_0x826c('0x78')](_0xed4289[_0x826c('0x7d')]);_0x2b0d7a[_0x826c('0x40')](_0x33a654(_0xed4289[_0x826c('0x7d')][_0x826c('0x66')]));}_0xef41be=_0x2b0d7a[_0x826c('0x8f')]();_0x2b0d7a[_0x826c('0x20')](_0x26d496);_0x2b0d7a['offset'](0x0);return;}})[_0x826c('0x27')](function(){if(_0x56bd0d['output']===_0x826c('0x90')){return null;}var _0x3733f5=_['merge'](_0x56bd0d,{'name':_0x56bd0d[_0x826c('0x91')]||_0x56bd0d[_0x826c('0x2d')]||_0xed4289[_0x826c('0x2d')],'basename':_0x43f2af,'savename':util[_0x826c('0x73')](_0x826c('0x92'),_0x56bd0d[_0x826c('0x2d')]||_0xed4289[_0x826c('0x2d')],require(_0x826c('0x93'))[_0x826c('0x94')](0x4),_0x56bd0d[_0x826c('0x95')]||_0x826c('0x96')),'reportId':_0xed4289['id'],'reportType':_0x826c('0x97')});return db[_0x826c('0x98')][_0x826c('0x4c')](_0x3733f5,{'raw':!![]});})['then'](function(_0x107014){if(_0xed4289[_0x826c('0x6e')]===_0x826c('0x99')){_0xef41be[_0x826c('0x40')](_0xed4289[_0x826c('0x6e')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x56bd0d['startDate'],_0x56bd0d[_0x826c('0x9a')]);}else{_0xef41be['where'](_0xed4289['table']+_0x826c('0x9b'),_0x56bd0d[_0x826c('0x9c')],_0x56bd0d[_0x826c('0x9a')]);}if(_0x107014){logger[_0x826c('0x9d')](_0x826c('0x9e'),_0xef41be[_0x826c('0x80')]());require(_0x826c('0x9f'))['fork'](path[_0x826c('0xa0')](__dirname,_0x826c('0xa1'),_0x107014[_0x826c('0x95')]),[_0x107014['id'],_0xef41be['toString'](),path[_0x826c('0xa0')](__dirname,'../../files/reports',_0x107014['savename']),_0x43f2af]);return _0x107014;}else{var _0x4ade44=squel[_0x826c('0x8c')]();_0x4ade44['from']('('+_0xef41be['toString']()+')',_0x826c('0xa2'));_0x4ade44[_0x826c('0x70')](_0x826c('0xa3'),_0x826c('0x22'));_0xef41be[_0x826c('0x20')](_0x56bd0d[_0x826c('0x20')]||_0x26d496);_0xef41be['offset'](_0x56bd0d[_0x826c('0x21')]||0x0);return dbH['sequelize'][_0x826c('0x35')](_0x4ade44['toString'](),{'type':dbH[_0x826c('0x81')][_0x826c('0x82')][_0x826c('0xa4')]})[_0x826c('0x27')](function(_0xef0dec){if(!_0xef0dec[_0x826c('0x4a')]){_0x1fd976=0x0;}else{_0x1fd976=_0xef0dec[0x0][_0x826c('0x22')]||0x0;}return dbH[_0x826c('0x81')][_0x826c('0x35')](_0xef41be['toString'](),{'type':dbH[_0x826c('0x81')][_0x826c('0x82')][_0x826c('0xa4')]});})[_0x826c('0x27')](function(_0x242123){return{'rows':_0x242123||[],'count':_0x1fd976};});}});}exports[_0x826c('0xa5')]=function(_0x17ab6f,_0x4d733f){return runReport(_0x17ab6f[_0x826c('0x49')],_0x17ab6f[_0x826c('0x35')],_0x17ab6f[_0x826c('0x68')])[_0x826c('0x27')](respondWithResult(_0x4d733f,null))[_0x826c('0x47')](handleError(_0x4d733f,null));};exports[_0x826c('0xa6')]=runReport;exports[_0x826c('0x35')]=function(_0x1c1036,_0x36a876){var _0x43a0e6=0xa;var _0x3131f1=[_0x826c('0xa0'),_0x826c('0x56'),'right_join',_0x826c('0x57')];var _0x2b381d={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x826c('0x59'),'MAX':_0x826c('0x83'),'MIN':'MIN(%s)','AVG':_0x826c('0x5b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x826c('0x5d'),'GROUP_CONCAT DESC':_0x826c('0x5e')};var _0x78484f={'SEC_TO_TIME':_0x826c('0x5f'),'DATE':'DATE(%s)','HOUR':_0x826c('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x826c('0xa7')};var _0x4c5b0a=function(_0x1a3c40){return!_['includes'](['IS\x20NULL',_0x826c('0x85'),_0x826c('0x86'),_0x826c('0x64')],_0x1a3c40);};var _0x30e752=function(_0xea9af5){if(!_0xea9af5||!_0xea9af5[_0x826c('0x65')]['length']){return'';}for(var _0x4fffb9='(',_0xfc98fb=0x0;_0xfc98fb<_0xea9af5[_0x826c('0x65')]['length'];_0xfc98fb+=0x1){_0xfc98fb>0x0&&(_0x4fffb9+='\x20'+_0xea9af5[_0x826c('0x87')]+'\x20');_0x4fffb9+=_0xea9af5[_0x826c('0x65')][_0xfc98fb][_0x826c('0x66')]?_0x30e752(_0xea9af5[_0x826c('0x65')][_0xfc98fb]['group']):_0xea9af5['rules'][_0xfc98fb][_0x826c('0x70')]+'\x20'+_0xea9af5[_0x826c('0x65')][_0xfc98fb][_0x826c('0x67')]+(_0x4c5b0a(_0xea9af5[_0x826c('0x65')][_0xfc98fb][_0x826c('0x67')])?'\x20'+_0xea9af5[_0x826c('0x65')][_0xfc98fb][_0x826c('0x88')]:'');}return _0x4fffb9+')';};var _0x35332b={'where':{'id':_0x1c1036[_0x826c('0x49')]['id']}},_0xe66e85,_0x1a667a,_0x43a7cb,_0x4f23ff,_0x249bad;_0x35332b=_[_0x826c('0x43')]({},_0x35332b,_0x1c1036[_0x826c('0x68')]);return db[_0x826c('0x30')][_0x826c('0x4b')](_0x35332b)['then'](function(_0x45cd64){if(_0x45cd64){_0xe66e85=_0x45cd64;return _0x45cd64[_0x826c('0x69')]();}return null;})['then'](function(_0x537b6b){if(_0x537b6b){if(!_0x537b6b[_0x826c('0x4a')]){throw new db[(_0x826c('0x89'))]['ValidationErrorItem'](_0x826c('0x6a'),0x193);}_0x1a667a=_0x537b6b;return db[_0x826c('0x6b')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x117b12){if(_0x117b12){_0x43a7cb=_[_0x826c('0x8b')](_0x117b12,'id');var _0x2d1804;var _0x365967=squel[_0x826c('0x8c')]();_0x365967[_0x826c('0x6d')](_0xe66e85[_0x826c('0x6e')]);for(var _0x81b254=0x0;_0x81b254<_0x1a667a[_0x826c('0x4a')];_0x81b254+=0x1){_0x2d1804=_0x1a667a[_0x81b254][_0x826c('0x6f')]?_0x43a7cb[_0x1a667a[_0x81b254][_0x826c('0x6f')]][_0x826c('0x8d')]:_0x1a667a[_0x81b254][_0x826c('0x70')];_0x2d1804=_0x1a667a[_0x81b254]['function']?_[_0x826c('0x72')](_0x2b381d[_0x1a667a[_0x81b254][_0x826c('0x71')]],'%s',_0x2d1804):_0x2d1804;_0x2d1804=_0x1a667a[_0x81b254][_0x826c('0x73')]?_[_0x826c('0x72')](_0x78484f[_0x1a667a[_0x81b254][_0x826c('0x73')]],'%s',_0x2d1804):_0x2d1804;if(_0x1a667a[_0x81b254][_0x826c('0x8e')]){_0x365967['group'](_0x2d1804);}_0x1a667a[_0x81b254]['orderBy']&&_0x365967[_0x826c('0x3c')](_0x2d1804,_0x1a667a[_0x81b254][_0x826c('0x74')]===_0x826c('0x75')?![]:!![]);_0x365967[_0x826c('0x70')](_0x2d1804,_0x1a667a[_0x81b254][_0x826c('0x76')]||_0x2d1804);}if(_0xe66e85[_0x826c('0x77')]){_0xe66e85[_0x826c('0x77')]=JSON['parse'](_0xe66e85['joins']);for(var _0x2c4887=0x0;_0x2c4887<_0xe66e85[_0x826c('0x77')]['length'];_0x2c4887+=0x1){if(_0xe66e85[_0x826c('0x77')][_0x2c4887]['type']&&_['includes'](_0x3131f1,_0xe66e85[_0x826c('0x77')][_0x2c4887][_0x826c('0x41')])&&_0xe66e85[_0x826c('0x77')][_0x2c4887]['parentKey']&&_0xe66e85[_0x826c('0x77')][_0x2c4887][_0x826c('0x7a')]&&_0xe66e85[_0x826c('0x77')][_0x2c4887][_0x826c('0x7b')]){_0x365967[_0xe66e85[_0x826c('0x77')][_0x2c4887]['type']](_0xe66e85['joins'][_0x2c4887][_0x826c('0x7a')],null,util[_0x826c('0x73')](_0x826c('0x7c'),_0xe66e85[_0x826c('0x6e')],_0xe66e85[_0x826c('0x77')][_0x2c4887][_0x826c('0x79')],_0xe66e85[_0x826c('0x77')][_0x2c4887]['foreignTable'],_0xe66e85['joins'][_0x2c4887][_0x826c('0x7b')]));}}}if(_0xe66e85['conditions']){_0xe66e85['conditions']=JSON[_0x826c('0x78')](_0xe66e85['conditions']);_0x365967[_0x826c('0x40')](_0x30e752(_0xe66e85[_0x826c('0x7d')][_0x826c('0x66')]));}_0x249bad=_0x365967[_0x826c('0x8f')]();_0x365967['limit'](_0x43a0e6);_0x365967['offset'](0x0);logger['debug'](_0x826c('0x7f'),_0x365967[_0x826c('0x80')]());return dbH[_0x826c('0x81')][_0x826c('0x35')](_0x365967[_0x826c('0x80')](),{'type':dbH[_0x826c('0x81')][_0x826c('0x82')][_0x826c('0xa4')]});}})[_0x826c('0x27')](function(){return{'sql':_0x249bad[_0x826c('0x80')]()};})[_0x826c('0x27')](respondWithResult(_0x36a876,null))['catch'](handleError(_0x36a876,null));}; \ No newline at end of file +var _0x07a6=['COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NULL','IS\x20NOT\x20EMPTY','operator','from','replace','output','web','fullPath','%s-%s.%s','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','savename','run','runReport','metric','debug','Limited\x20Query:','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get','CustomReports','UserProfileResource','end','error','stack','name','status','send','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','nolimit','order','sort','filter','where','merge','VIRTUAL','options','AnalyticCustomReport','includeAll','findAll','rows','catch','show','params','keys','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','field','function','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','toString','sequelize','QueryTypes','SELECT'];(function(_0x70588,_0x2e21dd){var _0x1981d8=function(_0x5bbfb6){while(--_0x5bbfb6){_0x70588['push'](_0x70588['shift']());}};_0x1981d8(++_0x2e21dd);}(_0x07a6,0xbf));var _0x607a=function(_0x166744,_0x1ae2e6){_0x166744=_0x166744-0x0;var _0x4068b5=_0x07a6[_0x166744];return _0x4068b5;};'use strict';var emlformat=require(_0x607a('0x0'));var rimraf=require(_0x607a('0x1'));var zipdir=require(_0x607a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x607a('0x3'));var BPromise=require(_0x607a('0x4'));var Mustache=require(_0x607a('0x5'));var util=require('util');var path=require(_0x607a('0x6'));var sox=require('sox');var csv=require(_0x607a('0x7'));var ejs=require(_0x607a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x607a('0x9'));var squel=require('squel');var crypto=require(_0x607a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x607a('0xb'));var toCsv=require(_0x607a('0x7'));var querystring=require('querystring');var Papa=require(_0x607a('0xc'));var Redis=require(_0x607a('0xd'));var authService=require(_0x607a('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x607a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x607a('0x10'))(_0x607a('0x11'));var utils=require(_0x607a('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x607a('0x13'));var db=require('../../mysqldb')['db'];var dbH=require(_0x607a('0x14'))[_0x607a('0x15')];function respondWithStatusCode(_0xe8daee,_0x409d7e){_0x409d7e=_0x409d7e||0xcc;return function(_0x3ae30b){if(_0x3ae30b){return _0xe8daee['sendStatus'](_0x409d7e);}return _0xe8daee['status'](_0x409d7e)['end']();};}function respondWithResult(_0x3088c1,_0x191a7d){_0x191a7d=_0x191a7d||0xc8;return function(_0x406d33){if(_0x406d33){return _0x3088c1['status'](_0x191a7d)['json'](_0x406d33);}};}function respondWithFilteredResult(_0x31978b,_0x26568){return function(_0x3aa202){if(_0x3aa202){var _0x385fe6=typeof _0x26568[_0x607a('0x16')]===_0x607a('0x17')&&typeof _0x26568[_0x607a('0x18')]===_0x607a('0x17');var _0x5bf009=_0x3aa202[_0x607a('0x19')];var _0x53f3c6=_0x385fe6?0x0:_0x26568['offset'];var _0x57bca7=_0x385fe6?_0x3aa202[_0x607a('0x19')]:_0x26568[_0x607a('0x16')]+_0x26568[_0x607a('0x18')];var _0x3ce7a9;if(_0x57bca7>=_0x5bf009){_0x57bca7=_0x5bf009;_0x3ce7a9=0xc8;}else{_0x3ce7a9=0xce;}_0x31978b['status'](_0x3ce7a9);return _0x31978b['set'](_0x607a('0x1a'),_0x53f3c6+'-'+_0x57bca7+'/'+_0x5bf009)['json'](_0x3aa202);}return null;};}function patchUpdates(_0x54f4cb){return function(_0xe98d92){try{jsonpatch[_0x607a('0x1b')](_0xe98d92,_0x54f4cb,!![]);}catch(_0x24cf19){return BPromise[_0x607a('0x1c')](_0x24cf19);}return _0xe98d92['save']();};}function saveUpdates(_0x235d71,_0x49f0e2){return function(_0x599098){if(_0x599098){return _0x599098[_0x607a('0x1d')](_0x235d71)[_0x607a('0x1e')](function(_0x14c615){return _0x14c615;});}return null;};}function removeEntity(_0x2f6740,_0xb451f7){return function(_0x13c836){if(_0x13c836){return _0x13c836[_0x607a('0x1f')]()['then'](function(){var _0x1ae8be=_0x13c836[_0x607a('0x20')]({'plain':!![]});var _0xd7e01a=_0x607a('0x21');return db[_0x607a('0x22')][_0x607a('0x1f')]({'where':{'type':_0xd7e01a,'resourceId':_0x1ae8be['id']}})[_0x607a('0x1e')](function(){return _0x13c836;});})['then'](function(){_0x2f6740['status'](0xcc)[_0x607a('0x23')]();});}};}function handleEntityNotFound(_0x6f89db,_0x4db730){return function(_0x28e4ae){if(!_0x28e4ae){_0x6f89db['sendStatus'](0x194);}return _0x28e4ae;};}function handleError(_0x31ae92,_0x460dd0){_0x460dd0=_0x460dd0||0x1f4;return function(_0x323a09){logger[_0x607a('0x24')](_0x323a09[_0x607a('0x25')]);if(_0x323a09[_0x607a('0x26')]){delete _0x323a09[_0x607a('0x26')];}_0x31ae92[_0x607a('0x27')](_0x460dd0)[_0x607a('0x28')](_0x323a09);};}exports['index']=function(_0x3205ec,_0x79df0a){var _0x5b44e0={},_0x5443df={},_0x294b59={'count':0x0,'rows':[]};var _0x5b1be6=_['map'](db['AnalyticCustomReport'][_0x607a('0x29')],function(_0x2d451b){return{'name':_0x2d451b[_0x607a('0x2a')],'type':_0x2d451b[_0x607a('0x2b')][_0x607a('0x2c')]};});_0x5443df[_0x607a('0x2d')]=_[_0x607a('0x2e')](_0x5b1be6,'name');_0x5443df['query']=_['keys'](_0x3205ec[_0x607a('0x2f')]);_0x5443df[_0x607a('0x30')]=_['intersection'](_0x5443df[_0x607a('0x2d')],_0x5443df[_0x607a('0x2f')]);_0x5b44e0[_0x607a('0x31')]=_[_0x607a('0x32')](_0x5443df[_0x607a('0x2d')],qs['fields'](_0x3205ec[_0x607a('0x2f')][_0x607a('0x33')]));_0x5b44e0[_0x607a('0x31')]=_0x5b44e0[_0x607a('0x31')]['length']?_0x5b44e0[_0x607a('0x31')]:_0x5443df[_0x607a('0x2d')];if(!_0x3205ec[_0x607a('0x2f')]['hasOwnProperty'](_0x607a('0x34'))){_0x5b44e0['limit']=qs['limit'](_0x3205ec[_0x607a('0x2f')][_0x607a('0x18')]);_0x5b44e0[_0x607a('0x16')]=qs[_0x607a('0x16')](_0x3205ec[_0x607a('0x2f')][_0x607a('0x16')]);}_0x5b44e0[_0x607a('0x35')]=qs[_0x607a('0x36')](_0x3205ec[_0x607a('0x2f')][_0x607a('0x36')]);_0x5b44e0['where']=qs[_0x607a('0x30')](_['pick'](_0x3205ec[_0x607a('0x2f')],_0x5443df['filters']),_0x5b1be6);if(_0x3205ec[_0x607a('0x2f')][_0x607a('0x37')]){_0x5b44e0[_0x607a('0x38')]=_[_0x607a('0x39')](_0x5b44e0['where'],{'$or':_[_0x607a('0x2e')](_0x5b1be6,function(_0x3913ad){if(_0x3913ad[_0x607a('0x2b')]!==_0x607a('0x3a')){var _0x5ee105={};_0x5ee105[_0x3913ad[_0x607a('0x26')]]={'$like':'%'+_0x3205ec[_0x607a('0x2f')]['filter']+'%'};return _0x5ee105;}})});}_0x5b44e0=_[_0x607a('0x39')]({},_0x5b44e0,_0x3205ec[_0x607a('0x3b')]);var _0x476a39={'where':_0x5b44e0[_0x607a('0x38')]};return db[_0x607a('0x3c')][_0x607a('0x19')](_0x476a39)[_0x607a('0x1e')](function(_0x32a142){_0x294b59[_0x607a('0x19')]=_0x32a142;if(_0x3205ec[_0x607a('0x2f')][_0x607a('0x3d')]){_0x5b44e0['include']=[{'all':!![]}];}return db[_0x607a('0x3c')][_0x607a('0x3e')](_0x5b44e0);})[_0x607a('0x1e')](function(_0x5bfe64){_0x294b59[_0x607a('0x3f')]=_0x5bfe64;return _0x294b59;})[_0x607a('0x1e')](respondWithFilteredResult(_0x79df0a,_0x5b44e0))[_0x607a('0x40')](handleError(_0x79df0a,null));};exports[_0x607a('0x41')]=function(_0xd16f71,_0x335c39){var _0x59372b={'raw':![],'where':{'id':_0xd16f71[_0x607a('0x42')]['id']}},_0x768414={};_0x768414[_0x607a('0x2d')]=_[_0x607a('0x43')](db[_0x607a('0x3c')][_0x607a('0x29')]);_0x768414[_0x607a('0x2f')]=_[_0x607a('0x43')](_0xd16f71['query']);_0x768414[_0x607a('0x30')]=_[_0x607a('0x32')](_0x768414['model'],_0x768414[_0x607a('0x2f')]);_0x59372b[_0x607a('0x31')]=_[_0x607a('0x32')](_0x768414[_0x607a('0x2d')],qs[_0x607a('0x33')](_0xd16f71['query'][_0x607a('0x33')]));_0x59372b[_0x607a('0x31')]=_0x59372b[_0x607a('0x31')][_0x607a('0x44')]?_0x59372b[_0x607a('0x31')]:_0x768414[_0x607a('0x2d')];if(_0xd16f71[_0x607a('0x2f')][_0x607a('0x3d')]){_0x59372b['include']=[{'all':!![]}];}_0x59372b=_[_0x607a('0x39')]({},_0x59372b,_0xd16f71[_0x607a('0x3b')]);return db[_0x607a('0x3c')]['find'](_0x59372b)[_0x607a('0x1e')](handleEntityNotFound(_0x335c39,null))[_0x607a('0x1e')](respondWithResult(_0x335c39,null))[_0x607a('0x40')](handleError(_0x335c39,null));};exports[_0x607a('0x45')]=function(_0x52fe50,_0x31c738){return db[_0x607a('0x3c')][_0x607a('0x45')](_0x52fe50['body'],{})[_0x607a('0x1e')](function(_0x2aa296){var _0x4c323c=_0x52fe50[_0x607a('0x46')]['get']({'plain':!![]});if(!_0x4c323c)throw new Error(_0x607a('0x47'));if(_0x4c323c[_0x607a('0x48')]===_0x607a('0x46')){var _0x67b110=_0x2aa296['get']({'plain':!![]});var _0x33d632=_0x607a('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x33d632,'userProfileId':_0x4c323c['userProfileId']},'raw':!![]})[_0x607a('0x1e')](function(_0x4a2a45){if(_0x4a2a45&&_0x4a2a45[_0x607a('0x4a')]===0x0){return db[_0x607a('0x22')][_0x607a('0x45')]({'name':_0x67b110[_0x607a('0x26')],'resourceId':_0x67b110['id'],'type':_0x607a('0x21'),'sectionId':_0x4a2a45['id']},{})['then'](function(){return _0x2aa296;});}else{return _0x2aa296;}})[_0x607a('0x40')](function(_0x29c9ff){logger[_0x607a('0x24')](_0x607a('0x4b'),_0x29c9ff);throw _0x29c9ff;});}return _0x2aa296;})[_0x607a('0x1e')](respondWithResult(_0x31c738,0xc9))[_0x607a('0x40')](handleError(_0x31c738,null));};exports[_0x607a('0x1d')]=function(_0x522b00,_0x53fce8){if(_0x522b00[_0x607a('0x4c')]['id']){delete _0x522b00[_0x607a('0x4c')]['id'];}return db[_0x607a('0x3c')][_0x607a('0x4d')]({'where':{'id':_0x522b00[_0x607a('0x42')]['id']}})['then'](handleEntityNotFound(_0x53fce8,null))[_0x607a('0x1e')](saveUpdates(_0x522b00[_0x607a('0x4c')],null))['then'](respondWithResult(_0x53fce8,null))[_0x607a('0x40')](handleError(_0x53fce8,null));};exports[_0x607a('0x1f')]=function(_0x203b60,_0x592e67){return db['AnalyticCustomReport'][_0x607a('0x4d')]({'where':{'id':_0x203b60[_0x607a('0x42')]['id']}})[_0x607a('0x1e')](handleEntityNotFound(_0x592e67,null))[_0x607a('0x1e')](removeEntity(_0x592e67,null))[_0x607a('0x40')](handleError(_0x592e67,null));};exports['preview']=function(_0x1b89d4,_0x39aeca){var _0x230129=0xa;var _0x5ed167=[_0x607a('0x4e'),_0x607a('0x4f'),_0x607a('0x50'),_0x607a('0x51')];var _0x1dfb1a={'SUM':_0x607a('0x52'),'COUNT':_0x607a('0x53'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x607a('0x54'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x607a('0x55'),'GROUP_CONCAT ASC':_0x607a('0x56'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x58af56={'SEC_TO_TIME':_0x607a('0x57'),'DATE':_0x607a('0x58'),'HOUR':_0x607a('0x59'),'ROUND':_0x607a('0x5a'),'UNIX_TIMESTAMP':_0x607a('0x5b')};var _0x3f5abd=function(_0x1a0175){return!_[_0x607a('0x5c')](['IS\x20NULL',_0x607a('0x5d'),_0x607a('0x5e'),'IS\x20NOT\x20EMPTY'],_0x1a0175);};var _0x2c3059=function(_0x196bf4){if(!_0x196bf4||!_0x196bf4[_0x607a('0x5f')][_0x607a('0x44')]){return'';}for(var _0x166a6e='(',_0xc3ee9e=0x0;_0xc3ee9e<_0x196bf4[_0x607a('0x5f')]['length'];_0xc3ee9e+=0x1){_0xc3ee9e>0x0&&(_0x166a6e+='\x20'+_0x196bf4['operator']+'\x20');_0x166a6e+=_0x196bf4[_0x607a('0x5f')][_0xc3ee9e][_0x607a('0x60')]?_0x2c3059(_0x196bf4[_0x607a('0x5f')][_0xc3ee9e]['group']):_0x196bf4['rules'][_0xc3ee9e]['field']+'\x20'+_0x196bf4[_0x607a('0x5f')][_0xc3ee9e][_0x607a('0x61')]+(_0x3f5abd(_0x196bf4[_0x607a('0x5f')][_0xc3ee9e]['condition'])?'\x20'+_0x196bf4[_0x607a('0x5f')][_0xc3ee9e][_0x607a('0x62')]:'');}return _0x166a6e+')';};var _0x1ec950={'where':{'id':_0x1b89d4[_0x607a('0x42')]['id']}},_0x2f7eef,_0x2cc1cc,_0x477976,_0x19c37b,_0x57ff76;_0x1ec950=_['merge']({},_0x1ec950,_0x1b89d4['options']);return db['AnalyticCustomReport'][_0x607a('0x4d')](_0x1ec950)[_0x607a('0x1e')](function(_0x3ed285){if(_0x3ed285){_0x2f7eef=_0x3ed285;return _0x3ed285[_0x607a('0x63')]();}return null;})[_0x607a('0x1e')](function(_0x372a18){if(_0x372a18){if(!_0x372a18[_0x607a('0x44')]){throw new db[(_0x607a('0x64'))][(_0x607a('0x65'))](_0x607a('0x66'),0x193);}_0x2cc1cc=_0x372a18;return db[_0x607a('0x67')][_0x607a('0x3e')]({'raw':!![]});}return null;})[_0x607a('0x1e')](function(_0x29b770){if(_0x29b770){_0x477976=_[_0x607a('0x68')](_0x29b770,'id');var _0x186622;var _0x236b95=squel[_0x607a('0x69')]();_0x236b95['from'](_0x2f7eef[_0x607a('0x6a')]);for(var _0x42867f=0x0;_0x42867f<_0x2cc1cc[_0x607a('0x44')];_0x42867f+=0x1){_0x186622=_0x2cc1cc[_0x42867f]['MetricId']?_0x477976[_0x2cc1cc[_0x42867f][_0x607a('0x6b')]]['metric']:_0x2cc1cc[_0x42867f][_0x607a('0x6c')];_0x186622=_0x2cc1cc[_0x42867f][_0x607a('0x6d')]?_['replace'](_0x1dfb1a[_0x2cc1cc[_0x42867f][_0x607a('0x6d')]],'%s',_0x186622):_0x186622;_0x186622=_0x2cc1cc[_0x42867f][_0x607a('0x6e')]?_['replace'](_0x58af56[_0x2cc1cc[_0x42867f][_0x607a('0x6e')]],'%s',_0x186622):_0x186622;if(_0x2cc1cc[_0x42867f][_0x607a('0x6f')]){_0x236b95['group'](_0x186622);}_0x2cc1cc[_0x42867f][_0x607a('0x70')]&&_0x236b95[_0x607a('0x35')](_0x186622,_0x2cc1cc[_0x42867f][_0x607a('0x70')]===_0x607a('0x71')?![]:!![]);_0x236b95[_0x607a('0x6c')](_0x186622,_0x2cc1cc[_0x42867f][_0x607a('0x72')]||_0x186622);}if(_0x2f7eef[_0x607a('0x73')]){_0x2f7eef[_0x607a('0x73')]=JSON[_0x607a('0x74')](_0x2f7eef[_0x607a('0x73')]);for(var _0x38d8e7=0x0;_0x38d8e7<_0x2f7eef[_0x607a('0x73')][_0x607a('0x44')];_0x38d8e7+=0x1){if(_0x2f7eef[_0x607a('0x73')][_0x38d8e7][_0x607a('0x2b')]&&_['includes'](_0x5ed167,_0x2f7eef[_0x607a('0x73')][_0x38d8e7][_0x607a('0x2b')])&&_0x2f7eef[_0x607a('0x73')][_0x38d8e7][_0x607a('0x75')]&&_0x2f7eef['joins'][_0x38d8e7][_0x607a('0x76')]&&_0x2f7eef[_0x607a('0x73')][_0x38d8e7]['foreignKey']){_0x236b95[_0x2f7eef[_0x607a('0x73')][_0x38d8e7][_0x607a('0x2b')]](_0x2f7eef[_0x607a('0x73')][_0x38d8e7][_0x607a('0x76')],null,util[_0x607a('0x6e')](_0x607a('0x77'),_0x2f7eef[_0x607a('0x6a')],_0x2f7eef['joins'][_0x38d8e7][_0x607a('0x75')],_0x2f7eef[_0x607a('0x73')][_0x38d8e7][_0x607a('0x76')],_0x2f7eef['joins'][_0x38d8e7][_0x607a('0x78')]));}}}if(_0x2f7eef[_0x607a('0x79')]){_0x2f7eef['conditions']=JSON[_0x607a('0x74')](_0x2f7eef[_0x607a('0x79')]);_0x236b95[_0x607a('0x38')](_0x2c3059(_0x2f7eef['conditions'][_0x607a('0x60')]));}_0x57ff76=_0x236b95[_0x607a('0x7a')]();_0x236b95[_0x607a('0x18')](_0x230129);_0x236b95[_0x607a('0x16')](0x0);logger['debug']('Limited\x20Query:',_0x236b95[_0x607a('0x7b')]());return dbH[_0x607a('0x7c')][_0x607a('0x2f')](_0x236b95[_0x607a('0x7b')](),{'type':dbH[_0x607a('0x7c')][_0x607a('0x7d')][_0x607a('0x7e')]});}})['then'](respondWithResult(_0x39aeca,null))['catch'](handleError(_0x39aeca,null));};function runReport(_0x29eec4,_0x4330be,_0x212a82){var _0x521c67=_0x4330be[_0x607a('0x26')];var _0x453ecd=0xa;var _0x42311b=[_0x607a('0x4e'),_0x607a('0x4f'),_0x607a('0x50'),'cross_join'];var _0x3b42c1={'SUM':_0x607a('0x52'),'COUNT':_0x607a('0x53'),'COUNT DISTINCT':_0x607a('0x7f'),'MAX':_0x607a('0x54'),'MIN':_0x607a('0x80'),'AVG':_0x607a('0x81'),'GROUP_CONCAT':_0x607a('0x55'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x607a('0x82')};var _0x1ba53b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x607a('0x58'),'HOUR':_0x607a('0x59'),'ROUND':_0x607a('0x5a'),'UNIX_TIMESTAMP':_0x607a('0x5b')};var _0x74df18=function(_0x2fb8ec){return!_['includes']([_0x607a('0x83'),_0x607a('0x5d'),'IS\x20EMPTY',_0x607a('0x84')],_0x2fb8ec);};var _0xea3934=function(_0x4e1d8b){if(!_0x4e1d8b||!_0x4e1d8b[_0x607a('0x5f')][_0x607a('0x44')]){return'';}for(var _0x30db35='(',_0x13c2c2=0x0;_0x13c2c2<_0x4e1d8b[_0x607a('0x5f')][_0x607a('0x44')];_0x13c2c2+=0x1){_0x13c2c2>0x0&&(_0x30db35+='\x20'+_0x4e1d8b[_0x607a('0x85')]+'\x20');_0x30db35+=_0x4e1d8b[_0x607a('0x5f')][_0x13c2c2]['group']?_0xea3934(_0x4e1d8b[_0x607a('0x5f')][_0x13c2c2][_0x607a('0x60')]):_0x4e1d8b[_0x607a('0x5f')][_0x13c2c2]['field']+'\x20'+_0x4e1d8b[_0x607a('0x5f')][_0x13c2c2][_0x607a('0x61')]+(_0x74df18(_0x4e1d8b[_0x607a('0x5f')][_0x13c2c2][_0x607a('0x61')])?'\x20'+_0x4e1d8b[_0x607a('0x5f')][_0x13c2c2][_0x607a('0x62')]:'');}return _0x30db35+')';};var _0x3230af={'where':{'id':_0x29eec4['id']}},_0x3b3f10,_0x44a33b,_0x48f643,_0x4cc3d8,_0x415f27;_0x3230af=_['merge']({},_0x3230af,_0x212a82);return db[_0x607a('0x3c')]['find'](_0x3230af)[_0x607a('0x1e')](function(_0x466e40){if(_0x466e40){_0x3b3f10=_0x466e40;return _0x466e40['getFields']();}return null;})[_0x607a('0x1e')](function(_0x57cf98){if(_0x57cf98){if(!_0x57cf98[_0x607a('0x44')]){throw new db[(_0x607a('0x64'))][(_0x607a('0x65'))](_0x607a('0x66'),0x193);}_0x44a33b=_0x57cf98;return db[_0x607a('0x67')][_0x607a('0x3e')]({'raw':!![]});}return null;})['then'](function(_0x14b589){if(_0x14b589){_0x48f643=_[_0x607a('0x68')](_0x14b589,'id');var _0x22d410;var _0x1f9b66=squel['select']();_0x1f9b66[_0x607a('0x86')](_0x3b3f10['table']);for(var _0x3a0250=0x0;_0x3a0250<_0x44a33b[_0x607a('0x44')];_0x3a0250+=0x1){_0x22d410=_0x44a33b[_0x3a0250][_0x607a('0x6b')]?_0x48f643[_0x44a33b[_0x3a0250][_0x607a('0x6b')]]['metric']:_0x44a33b[_0x3a0250][_0x607a('0x6c')];_0x22d410=_0x44a33b[_0x3a0250][_0x607a('0x6d')]?_['replace'](_0x3b42c1[_0x44a33b[_0x3a0250]['function']],'%s',_0x22d410):_0x22d410;_0x22d410=_0x44a33b[_0x3a0250][_0x607a('0x6e')]?_[_0x607a('0x87')](_0x1ba53b[_0x44a33b[_0x3a0250]['format']],'%s',_0x22d410):_0x22d410;if(_0x44a33b[_0x3a0250][_0x607a('0x6f')]){_0x1f9b66['group'](_0x22d410);}_0x44a33b[_0x3a0250][_0x607a('0x70')]&&_0x1f9b66[_0x607a('0x35')](_0x22d410,_0x44a33b[_0x3a0250][_0x607a('0x70')]===_0x607a('0x71')?![]:!![]);_0x1f9b66['field'](_0x22d410,_0x44a33b[_0x3a0250][_0x607a('0x72')]||_0x22d410);}if(_0x3b3f10[_0x607a('0x73')]){_0x3b3f10[_0x607a('0x73')]=JSON['parse'](_0x3b3f10[_0x607a('0x73')]);for(var _0x2aa28c=0x0;_0x2aa28c<_0x3b3f10[_0x607a('0x73')][_0x607a('0x44')];_0x2aa28c+=0x1){if(_0x3b3f10[_0x607a('0x73')][_0x2aa28c]['type']&&_[_0x607a('0x5c')](_0x42311b,_0x3b3f10[_0x607a('0x73')][_0x2aa28c][_0x607a('0x2b')])&&_0x3b3f10[_0x607a('0x73')][_0x2aa28c][_0x607a('0x75')]&&_0x3b3f10['joins'][_0x2aa28c]['foreignTable']&&_0x3b3f10[_0x607a('0x73')][_0x2aa28c][_0x607a('0x78')]){_0x1f9b66[_0x3b3f10[_0x607a('0x73')][_0x2aa28c]['type']](_0x3b3f10['joins'][_0x2aa28c][_0x607a('0x76')],null,util[_0x607a('0x6e')](_0x607a('0x77'),_0x3b3f10[_0x607a('0x6a')],_0x3b3f10[_0x607a('0x73')][_0x2aa28c][_0x607a('0x75')],_0x3b3f10[_0x607a('0x73')][_0x2aa28c][_0x607a('0x76')],_0x3b3f10['joins'][_0x2aa28c][_0x607a('0x78')]));}}}if(_0x3b3f10[_0x607a('0x79')]){_0x3b3f10[_0x607a('0x79')]=JSON[_0x607a('0x74')](_0x3b3f10[_0x607a('0x79')]);_0x1f9b66[_0x607a('0x38')](_0xea3934(_0x3b3f10[_0x607a('0x79')][_0x607a('0x60')]));}_0x415f27=_0x1f9b66[_0x607a('0x7a')]();_0x1f9b66[_0x607a('0x18')](_0x453ecd);_0x1f9b66[_0x607a('0x16')](0x0);return;}})['then'](function(){if(_0x4330be[_0x607a('0x88')]===_0x607a('0x89')){return null;}var _0x41219a=_[_0x607a('0x39')](_0x4330be,{'name':_0x4330be[_0x607a('0x8a')]||_0x4330be[_0x607a('0x26')]||_0x3b3f10[_0x607a('0x26')],'basename':_0x521c67,'savename':util[_0x607a('0x6e')](_0x607a('0x8b'),_0x4330be[_0x607a('0x26')]||_0x3b3f10[_0x607a('0x26')],require('randomstring')[_0x607a('0x8c')](0x4),_0x4330be['output']||_0x607a('0x8d')),'reportId':_0x3b3f10['id'],'reportType':_0x607a('0x8e')});return db[_0x607a('0x8f')][_0x607a('0x45')](_0x41219a,{'raw':!![]});})['then'](function(_0x44500a){if(_0x3b3f10[_0x607a('0x6a')]===_0x607a('0x90')){_0x415f27[_0x607a('0x38')](_0x3b3f10[_0x607a('0x6a')]+_0x607a('0x91'),_0x4330be['startDate'],_0x4330be['endDate']);}else{_0x415f27['where'](_0x3b3f10[_0x607a('0x6a')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4330be[_0x607a('0x92')],_0x4330be[_0x607a('0x93')]);}if(_0x44500a){logger[_0x607a('0x94')](_0x607a('0x95'),_0x415f27[_0x607a('0x7b')]());require(_0x607a('0x96'))[_0x607a('0x97')](path[_0x607a('0x4e')](__dirname,_0x607a('0x98'),_0x44500a[_0x607a('0x88')]),[_0x44500a['id'],_0x415f27[_0x607a('0x7b')](),path['join'](__dirname,'../../files/reports',_0x44500a[_0x607a('0x99')]),_0x521c67]);return _0x44500a;}else{var _0x261b01=squel[_0x607a('0x69')]();_0x261b01[_0x607a('0x86')]('('+_0x415f27[_0x607a('0x7b')]()+')','countTable');_0x261b01['field']('COUNT(*)',_0x607a('0x19'));_0x415f27[_0x607a('0x18')](_0x4330be[_0x607a('0x18')]||_0x453ecd);_0x415f27[_0x607a('0x16')](_0x4330be[_0x607a('0x16')]||0x0);return dbH['sequelize'][_0x607a('0x2f')](_0x261b01['toString'](),{'type':dbH[_0x607a('0x7c')][_0x607a('0x7d')][_0x607a('0x7e')]})['then'](function(_0x2aa024){if(!_0x2aa024[_0x607a('0x44')]){_0x4cc3d8=0x0;}else{_0x4cc3d8=_0x2aa024[0x0][_0x607a('0x19')]||0x0;}return dbH['sequelize'][_0x607a('0x2f')](_0x415f27[_0x607a('0x7b')](),{'type':dbH['sequelize']['QueryTypes'][_0x607a('0x7e')]});})[_0x607a('0x1e')](function(_0x58f779){return{'rows':_0x58f779||[],'count':_0x4cc3d8};});}});}exports[_0x607a('0x9a')]=function(_0x40a92c,_0x2e4cc5){return runReport(_0x40a92c[_0x607a('0x42')],_0x40a92c[_0x607a('0x2f')],_0x40a92c[_0x607a('0x3b')])[_0x607a('0x1e')](respondWithResult(_0x2e4cc5,null))[_0x607a('0x40')](handleError(_0x2e4cc5,null));};exports[_0x607a('0x9b')]=runReport;exports[_0x607a('0x2f')]=function(_0x39e9ca,_0x547f9e){var _0x572b2c=0xa;var _0x2d1e13=[_0x607a('0x4e'),_0x607a('0x4f'),_0x607a('0x50'),_0x607a('0x51')];var _0x47f64e={'SUM':_0x607a('0x52'),'COUNT':_0x607a('0x53'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x607a('0x54'),'MIN':_0x607a('0x80'),'AVG':_0x607a('0x81'),'GROUP_CONCAT':_0x607a('0x55'),'GROUP_CONCAT ASC':_0x607a('0x56'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1779af={'SEC_TO_TIME':_0x607a('0x57'),'DATE':_0x607a('0x58'),'HOUR':'HOUR(%s)','ROUND':_0x607a('0x5a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x58c2d3=function(_0x3e6037){return!_[_0x607a('0x5c')]([_0x607a('0x83'),_0x607a('0x5d'),_0x607a('0x5e'),_0x607a('0x84')],_0x3e6037);};var _0x422d45=function(_0x4ba40b){if(!_0x4ba40b||!_0x4ba40b[_0x607a('0x5f')][_0x607a('0x44')]){return'';}for(var _0x2fe19f='(',_0x4fd4fc=0x0;_0x4fd4fc<_0x4ba40b[_0x607a('0x5f')]['length'];_0x4fd4fc+=0x1){_0x4fd4fc>0x0&&(_0x2fe19f+='\x20'+_0x4ba40b[_0x607a('0x85')]+'\x20');_0x2fe19f+=_0x4ba40b['rules'][_0x4fd4fc]['group']?_0x422d45(_0x4ba40b[_0x607a('0x5f')][_0x4fd4fc]['group']):_0x4ba40b['rules'][_0x4fd4fc][_0x607a('0x6c')]+'\x20'+_0x4ba40b['rules'][_0x4fd4fc][_0x607a('0x61')]+(_0x58c2d3(_0x4ba40b[_0x607a('0x5f')][_0x4fd4fc][_0x607a('0x61')])?'\x20'+_0x4ba40b[_0x607a('0x5f')][_0x4fd4fc][_0x607a('0x62')]:'');}return _0x2fe19f+')';};var _0x47a8e2={'where':{'id':_0x39e9ca[_0x607a('0x42')]['id']}},_0x1c6ac9,_0x3047a1,_0x5a802b,_0x25284d,_0x2a4d3c;_0x47a8e2=_[_0x607a('0x39')]({},_0x47a8e2,_0x39e9ca[_0x607a('0x3b')]);return db[_0x607a('0x3c')][_0x607a('0x4d')](_0x47a8e2)['then'](function(_0x3b9de7){if(_0x3b9de7){_0x1c6ac9=_0x3b9de7;return _0x3b9de7[_0x607a('0x63')]();}return null;})[_0x607a('0x1e')](function(_0x439382){if(_0x439382){if(!_0x439382[_0x607a('0x44')]){throw new db['Sequelize'][(_0x607a('0x65'))](_0x607a('0x66'),0x193);}_0x3047a1=_0x439382;return db[_0x607a('0x67')][_0x607a('0x3e')]({'raw':!![]});}return null;})[_0x607a('0x1e')](function(_0x449f12){if(_0x449f12){_0x5a802b=_['keyBy'](_0x449f12,'id');var _0x15ff5c;var _0x14609b=squel[_0x607a('0x69')]();_0x14609b[_0x607a('0x86')](_0x1c6ac9[_0x607a('0x6a')]);for(var _0x522920=0x0;_0x522920<_0x3047a1[_0x607a('0x44')];_0x522920+=0x1){_0x15ff5c=_0x3047a1[_0x522920]['MetricId']?_0x5a802b[_0x3047a1[_0x522920][_0x607a('0x6b')]][_0x607a('0x9c')]:_0x3047a1[_0x522920][_0x607a('0x6c')];_0x15ff5c=_0x3047a1[_0x522920]['function']?_[_0x607a('0x87')](_0x47f64e[_0x3047a1[_0x522920]['function']],'%s',_0x15ff5c):_0x15ff5c;_0x15ff5c=_0x3047a1[_0x522920][_0x607a('0x6e')]?_[_0x607a('0x87')](_0x1779af[_0x3047a1[_0x522920][_0x607a('0x6e')]],'%s',_0x15ff5c):_0x15ff5c;if(_0x3047a1[_0x522920][_0x607a('0x6f')]){_0x14609b[_0x607a('0x60')](_0x15ff5c);}_0x3047a1[_0x522920]['orderBy']&&_0x14609b['order'](_0x15ff5c,_0x3047a1[_0x522920][_0x607a('0x70')]===_0x607a('0x71')?![]:!![]);_0x14609b[_0x607a('0x6c')](_0x15ff5c,_0x3047a1[_0x522920][_0x607a('0x72')]||_0x15ff5c);}if(_0x1c6ac9[_0x607a('0x73')]){_0x1c6ac9[_0x607a('0x73')]=JSON['parse'](_0x1c6ac9[_0x607a('0x73')]);for(var _0x1e51e4=0x0;_0x1e51e4<_0x1c6ac9[_0x607a('0x73')][_0x607a('0x44')];_0x1e51e4+=0x1){if(_0x1c6ac9[_0x607a('0x73')][_0x1e51e4]['type']&&_[_0x607a('0x5c')](_0x2d1e13,_0x1c6ac9['joins'][_0x1e51e4][_0x607a('0x2b')])&&_0x1c6ac9[_0x607a('0x73')][_0x1e51e4][_0x607a('0x75')]&&_0x1c6ac9['joins'][_0x1e51e4][_0x607a('0x76')]&&_0x1c6ac9[_0x607a('0x73')][_0x1e51e4][_0x607a('0x78')]){_0x14609b[_0x1c6ac9['joins'][_0x1e51e4]['type']](_0x1c6ac9[_0x607a('0x73')][_0x1e51e4][_0x607a('0x76')],null,util[_0x607a('0x6e')]('%s.%s\x20=\x20%s.%s',_0x1c6ac9[_0x607a('0x6a')],_0x1c6ac9['joins'][_0x1e51e4][_0x607a('0x75')],_0x1c6ac9[_0x607a('0x73')][_0x1e51e4][_0x607a('0x76')],_0x1c6ac9[_0x607a('0x73')][_0x1e51e4]['foreignKey']));}}}if(_0x1c6ac9[_0x607a('0x79')]){_0x1c6ac9[_0x607a('0x79')]=JSON['parse'](_0x1c6ac9[_0x607a('0x79')]);_0x14609b[_0x607a('0x38')](_0x422d45(_0x1c6ac9['conditions']['group']));}_0x2a4d3c=_0x14609b['clone']();_0x14609b['limit'](_0x572b2c);_0x14609b[_0x607a('0x16')](0x0);logger[_0x607a('0x9d')](_0x607a('0x9e'),_0x14609b['toString']());return dbH[_0x607a('0x7c')][_0x607a('0x2f')](_0x14609b[_0x607a('0x7b')](),{'type':dbH[_0x607a('0x7c')][_0x607a('0x7d')][_0x607a('0x7e')]});}})[_0x607a('0x1e')](function(){return{'sql':_0x2a4d3c[_0x607a('0x7b')]()};})[_0x607a('0x1e')](respondWithResult(_0x547f9e,null))[_0x607a('0x40')](handleError(_0x547f9e,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 0aa7258..1bd4bff 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 _0x0e74=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x4cc1c3,_0x425835){var _0x45943c=function(_0x523ee6){while(--_0x523ee6){_0x4cc1c3['push'](_0x4cc1c3['shift']());}};_0x45943c(++_0x425835);}(_0x0e74,0x8c));var _0x40e7=function(_0x282155,_0x1b1b0a){_0x282155=_0x282155-0x0;var _0x2e8147=_0x0e74[_0x282155];return _0x2e8147;};'use strict';var _=require(_0x40e7('0x0'));var util=require(_0x40e7('0x1'));var logger=require(_0x40e7('0x2'))(_0x40e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x40e7('0x4'));var fs=require('fs');var path=require(_0x40e7('0x5'));var rimraf=require(_0x40e7('0x6'));var config=require(_0x40e7('0x7'));var attributes=require('./analyticCustomReport.attributes');module[_0x40e7('0x8')]=function(_0xe35ac5,_0x1d7b95){return _0xe35ac5[_0x40e7('0x9')]('AnalyticCustomReport',attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2d9=['./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x22ac93,_0x508cb0){var _0x3454e2=function(_0x5acf55){while(--_0x5acf55){_0x22ac93['push'](_0x22ac93['shift']());}};_0x3454e2(++_0x508cb0);}(_0xc2d9,0xc9));var _0x9c2d=function(_0x390dd5,_0x3289fd){_0x390dd5=_0x390dd5-0x0;var _0x1d6241=_0xc2d9[_0x390dd5];return _0x1d6241;};'use strict';var _=require(_0x9c2d('0x0'));var util=require('util');var logger=require(_0x9c2d('0x1'))(_0x9c2d('0x2'));var moment=require(_0x9c2d('0x3'));var BPromise=require(_0x9c2d('0x4'));var rp=require(_0x9c2d('0x5'));var fs=require('fs');var path=require(_0x9c2d('0x6'));var rimraf=require(_0x9c2d('0x7'));var config=require(_0x9c2d('0x8'));var attributes=require(_0x9c2d('0x9'));module[_0x9c2d('0xa')]=function(_0x645f59,_0x324b5e){return _0x645f59[_0x9c2d('0xb')](_0x9c2d('0xc'),attributes,{'tableName':_0x9c2d('0xd'),'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 36b2a9f..4444c97 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 _0x3db0=['code','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','info','request\x20sent','stringify','error'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x3db0,0x77));var _0x03db=function(_0xa4c85,_0x2b52a7){_0xa4c85=_0xa4c85-0x0;var _0x172c1f=_0x3db0[_0xa4c85];return _0x172c1f;};'use strict';var _=require('lodash');var util=require(_0x03db('0x0'));var moment=require(_0x03db('0x1'));var BPromise=require(_0x03db('0x2'));var rs=require(_0x03db('0x3'));var fs=require('fs');var Redis=require(_0x03db('0x4'));var db=require(_0x03db('0x5'))['db'];var utils=require(_0x03db('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x03db('0x7'));var jayson=require(_0x03db('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4aeab0,_0x4efb56,_0x484301){return new BPromise(function(_0x3409e3,_0x16281a){return client[_0x03db('0x9')](_0x4aeab0,_0x484301)['then'](function(_0x355b0f){logger[_0x03db('0xa')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4efb56,_0x03db('0xb'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x4efb56,_0x03db('0xb'),JSON[_0x03db('0xc')](_0x355b0f));if(_0x355b0f['error']){if(_0x355b0f[_0x03db('0xd')][_0x03db('0xe')]===0x1f4){logger[_0x03db('0xd')](_0x03db('0xf'),_0x4efb56,_0x355b0f[_0x03db('0xd')]['message']);return _0x16281a(_0x355b0f[_0x03db('0xd')][_0x03db('0x10')]);}logger[_0x03db('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4efb56,_0x355b0f['error'][_0x03db('0x10')]);return _0x3409e3(_0x355b0f['error'][_0x03db('0x10')]);}else{logger['info'](_0x03db('0xf'),_0x4efb56,'request\x20sent');_0x3409e3(_0x355b0f[_0x03db('0x11')]['message']);}})[_0x03db('0x12')](function(_0x5982d8){logger['error'](_0x03db('0xf'),_0x4efb56,_0x5982d8);_0x16281a(_0x5982d8);});});} \ No newline at end of file +var _0xd33b=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x54650c,_0xf51041){var _0x3cf7a3=function(_0x1fa00b){while(--_0x1fa00b){_0x54650c['push'](_0x54650c['shift']());}};_0x3cf7a3(++_0xf51041);}(_0xd33b,0x74));var _0xbd33=function(_0x3a99a4,_0x2c70d){_0x3a99a4=_0x3a99a4-0x0;var _0x1b3c84=_0xd33b[_0x3a99a4];return _0x1b3c84;};'use strict';var _=require(_0xbd33('0x0'));var util=require(_0xbd33('0x1'));var moment=require('moment');var BPromise=require(_0xbd33('0x2'));var rs=require(_0xbd33('0x3'));var fs=require('fs');var Redis=require(_0xbd33('0x4'));var db=require(_0xbd33('0x5'))['db'];var utils=require(_0xbd33('0x6'));var logger=require(_0xbd33('0x7'))(_0xbd33('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xbd33('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x118217,_0x3eb162,_0x373731){return new BPromise(function(_0x183ef0,_0x594d5b){return client[_0xbd33('0xa')](_0x118217,_0x373731)[_0xbd33('0xb')](function(_0x16e65f){logger[_0xbd33('0xc')](_0xbd33('0xd'),_0x3eb162,'request\x20sent');logger[_0xbd33('0xe')](_0xbd33('0xf'),_0x3eb162,_0xbd33('0x10'),JSON[_0xbd33('0x11')](_0x16e65f));if(_0x16e65f[_0xbd33('0x12')]){if(_0x16e65f[_0xbd33('0x12')][_0xbd33('0x13')]===0x1f4){logger[_0xbd33('0x12')](_0xbd33('0xd'),_0x3eb162,_0x16e65f[_0xbd33('0x12')][_0xbd33('0x14')]);return _0x594d5b(_0x16e65f[_0xbd33('0x12')][_0xbd33('0x14')]);}logger[_0xbd33('0x12')](_0xbd33('0xd'),_0x3eb162,_0x16e65f[_0xbd33('0x12')]['message']);return _0x183ef0(_0x16e65f[_0xbd33('0x12')][_0xbd33('0x14')]);}else{logger['info'](_0xbd33('0xd'),_0x3eb162,'request\x20sent');_0x183ef0(_0x16e65f[_0xbd33('0x15')][_0xbd33('0x14')]);}})[_0xbd33('0x16')](function(_0x2b026b){logger[_0xbd33('0x12')](_0xbd33('0xd'),_0x3eb162,_0x2b026b);_0x594d5b(_0x2b026b);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 3db3104..57ed0cb 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 _0x1ca5=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','run','/:id/query'];(function(_0x13ff53,_0x5e1424){var _0x290228=function(_0x3e3133){while(--_0x3e3133){_0x13ff53['push'](_0x13ff53['shift']());}};_0x290228(++_0x5e1424);}(_0x1ca5,0xec));var _0x51ca=function(_0x213721,_0xc41653){_0x213721=_0x213721-0x0;var _0x6435ee=_0x1ca5[_0x213721];return _0x6435ee;};'use strict';var multer=require(_0x51ca('0x0'));var util=require(_0x51ca('0x1'));var path=require(_0x51ca('0x2'));var timeout=require(_0x51ca('0x3'));var express=require('express');var router=express[_0x51ca('0x4')]();var fs_extra=require(_0x51ca('0x5'));var auth=require(_0x51ca('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x51ca('0x7'));router[_0x51ca('0x8')]('/',auth[_0x51ca('0x9')](),controller[_0x51ca('0xa')]);router[_0x51ca('0x8')](_0x51ca('0xb'),auth['isAuthenticated'](),controller[_0x51ca('0xc')]);router[_0x51ca('0x8')](_0x51ca('0xd'),auth['isAuthenticated'](),controller[_0x51ca('0xe')]);router['get']('/:id/run',auth[_0x51ca('0x9')](),controller[_0x51ca('0xf')]);router[_0x51ca('0x8')](_0x51ca('0x10'),auth['isAuthenticated'](),controller['query']);router['post']('/',auth['isAuthenticated'](),controller[_0x51ca('0x11')]);router[_0x51ca('0x12')](_0x51ca('0xb'),auth[_0x51ca('0x9')](),controller[_0x51ca('0x13')]);router[_0x51ca('0x14')](_0x51ca('0xb'),auth['isAuthenticated'](),controller[_0x51ca('0x15')]);module[_0x51ca('0x16')]=router; \ No newline at end of file +var _0x926b=['put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','preview','/:id/run','run','/:id/query','query','post'];(function(_0x1e71b1,_0x59d4d3){var _0x49d61f=function(_0x37db02){while(--_0x37db02){_0x1e71b1['push'](_0x1e71b1['shift']());}};_0x49d61f(++_0x59d4d3);}(_0x926b,0x18b));var _0xb926=function(_0x5d8bf1,_0x1ce7ea){_0x5d8bf1=_0x5d8bf1-0x0;var _0x378510=_0x926b[_0x5d8bf1];return _0x378510;};'use strict';var multer=require(_0xb926('0x0'));var util=require(_0xb926('0x1'));var path=require(_0xb926('0x2'));var timeout=require(_0xb926('0x3'));var express=require(_0xb926('0x4'));var router=express[_0xb926('0x5')]();var fs_extra=require(_0xb926('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb926('0x7'));var controller=require('./analyticCustomReport.controller');router[_0xb926('0x8')]('/',auth[_0xb926('0x9')](),controller[_0xb926('0xa')]);router[_0xb926('0x8')](_0xb926('0xb'),auth['isAuthenticated'](),controller[_0xb926('0xc')]);router[_0xb926('0x8')]('/:id/preview',auth[_0xb926('0x9')](),controller[_0xb926('0xd')]);router[_0xb926('0x8')](_0xb926('0xe'),auth[_0xb926('0x9')](),controller[_0xb926('0xf')]);router[_0xb926('0x8')](_0xb926('0x10'),auth[_0xb926('0x9')](),controller[_0xb926('0x11')]);router[_0xb926('0x12')]('/',auth[_0xb926('0x9')](),controller['create']);router[_0xb926('0x13')](_0xb926('0xb'),auth[_0xb926('0x9')](),controller[_0xb926('0x14')]);router[_0xb926('0x15')](_0xb926('0xb'),auth[_0xb926('0x9')](),controller[_0xb926('0x16')]);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 ae0923c..8d02cc0 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 _0x814b=['STRING','TEXT','sequelize','exports'];(function(_0x307967,_0x5c0f8f){var _0x20acf1=function(_0x2a1f91){while(--_0x2a1f91){_0x307967['push'](_0x307967['shift']());}};_0x20acf1(++_0x5c0f8f);}(_0x814b,0x1a2));var _0xb814=function(_0x546c68,_0x5c0116){_0x546c68=_0x546c68-0x0;var _0x4a2389=_0x814b[_0x546c68];return _0x4a2389;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'name':{'type':Sequelize[_0xb814('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb814('0x2')]},'parent':{'type':Sequelize[_0xb814('0x2')]},'table':{'type':Sequelize[_0xb814('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xb814('0x3')]}}; \ No newline at end of file +var _0x7c09=['exports','STRING','TEXT'];(function(_0x10ed7b,_0x18bc05){var _0x2e928e=function(_0x3b89c2){while(--_0x3b89c2){_0x10ed7b['push'](_0x10ed7b['shift']());}};_0x2e928e(++_0x18bc05);}(_0x7c09,0x102));var _0x97c0=function(_0x2d1258,_0x19cfd1){_0x2d1258=_0x2d1258-0x0;var _0x2174dd=_0x7c09[_0x2d1258];return _0x2174dd;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'name':{'type':Sequelize[_0x97c0('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x97c0('0x1')]},'table':{'type':Sequelize[_0x97c0('0x1')]},'conditions':{'type':Sequelize[_0x97c0('0x2')]},'joins':{'type':Sequelize[_0x97c0('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index e1b57b0..97217e7 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 _0x1967=['conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','table','web','%s-%s.%s','randomstring','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','select','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','get','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','DefaultReports','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey'];(function(_0x5d6994,_0x3bd35a){var _0x347a53=function(_0x4fb4fa){while(--_0x4fb4fa){_0x5d6994['push'](_0x5d6994['shift']());}};_0x347a53(++_0x3bd35a);}(_0x1967,0x173));var _0x7196=function(_0x3a813b,_0xa62f8e){_0x3a813b=_0x3a813b-0x0;var _0x20b24c=_0x1967[_0x3a813b];return _0x20b24c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];var dbH=require(_0x7196('0x1b'))[_0x7196('0x1c')];function respondWithStatusCode(_0xba707b,_0x154101){_0x154101=_0x154101||0xcc;return function(_0x4e8c4c){if(_0x4e8c4c){return _0xba707b[_0x7196('0x1d')](_0x154101);}return _0xba707b[_0x7196('0x1e')](_0x154101)[_0x7196('0x1f')]();};}function respondWithResult(_0xf098c1,_0x511aa1){_0x511aa1=_0x511aa1||0xc8;return function(_0x31c778){if(_0x31c778){return _0xf098c1['status'](_0x511aa1)[_0x7196('0x20')](_0x31c778);}};}function respondWithFilteredResult(_0x2590a6,_0xf7e97){return function(_0x3ed1ad){if(_0x3ed1ad){var _0x12dce7=typeof _0xf7e97[_0x7196('0x21')]===_0x7196('0x22')&&typeof _0xf7e97[_0x7196('0x23')]===_0x7196('0x22');var _0x32fe2b=_0x3ed1ad[_0x7196('0x24')];var _0x5b716a=_0x12dce7?0x0:_0xf7e97['offset'];var _0x448f13=_0x12dce7?_0x3ed1ad[_0x7196('0x24')]:_0xf7e97[_0x7196('0x21')]+_0xf7e97['limit'];var _0x39b944;if(_0x448f13>=_0x32fe2b){_0x448f13=_0x32fe2b;_0x39b944=0xc8;}else{_0x39b944=0xce;}_0x2590a6['status'](_0x39b944);return _0x2590a6['set'](_0x7196('0x25'),_0x5b716a+'-'+_0x448f13+'/'+_0x32fe2b)[_0x7196('0x20')](_0x3ed1ad);}return null;};}function patchUpdates(_0x8dee9d){return function(_0x4ddf78){try{jsonpatch['apply'](_0x4ddf78,_0x8dee9d,!![]);}catch(_0x38d291){return BPromise[_0x7196('0x26')](_0x38d291);}return _0x4ddf78['save']();};}function saveUpdates(_0x18649b,_0x27ff84){return function(_0x6e22e5){if(_0x6e22e5){return _0x6e22e5[_0x7196('0x27')](_0x18649b)[_0x7196('0x28')](function(_0x549f34){return _0x549f34;});}return null;};}function removeEntity(_0x3f8178,_0x520d01){return function(_0x3ce9a0){if(_0x3ce9a0){return _0x3ce9a0[_0x7196('0x29')]()[_0x7196('0x28')](function(){var _0xa69810=_0x3ce9a0[_0x7196('0x2a')]({'plain':!![]});var _0x43f6a2='DefaultReports';return db['UserProfileResource'][_0x7196('0x29')]({'where':{'type':_0x43f6a2,'resourceId':_0xa69810['id']}})[_0x7196('0x28')](function(){return _0x3ce9a0;});})[_0x7196('0x28')](function(){_0x3f8178['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41cfd2,_0x162cfc){return function(_0x675e64){if(!_0x675e64){_0x41cfd2['sendStatus'](0x194);}return _0x675e64;};}function handleError(_0x35eef9,_0x4ecea1){_0x4ecea1=_0x4ecea1||0x1f4;return function(_0x4fd339){logger['error'](_0x4fd339[_0x7196('0x2b')]);if(_0x4fd339[_0x7196('0x2c')]){delete _0x4fd339[_0x7196('0x2c')];}_0x35eef9['status'](_0x4ecea1)[_0x7196('0x2d')](_0x4fd339);};}exports[_0x7196('0x2e')]=function(_0x2f9583,_0xf999e9){var _0x50c386={},_0x39710d={},_0x429160={'count':0x0,'rows':[]};var _0xd07f22=_[_0x7196('0x2f')](db[_0x7196('0x30')][_0x7196('0x31')],function(_0x15c5f0){return{'name':_0x15c5f0[_0x7196('0x32')],'type':_0x15c5f0[_0x7196('0x33')][_0x7196('0x34')]};});_0x39710d[_0x7196('0x35')]=_['map'](_0xd07f22,_0x7196('0x2c'));_0x39710d['query']=_[_0x7196('0x36')](_0x2f9583['query']);_0x39710d[_0x7196('0x37')]=_[_0x7196('0x38')](_0x39710d['model'],_0x39710d[_0x7196('0x39')]);_0x50c386[_0x7196('0x3a')]=_[_0x7196('0x38')](_0x39710d[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x2f9583['query'][_0x7196('0x3b')]));_0x50c386[_0x7196('0x3a')]=_0x50c386[_0x7196('0x3a')][_0x7196('0x3c')]?_0x50c386[_0x7196('0x3a')]:_0x39710d[_0x7196('0x35')];if(!_0x2f9583['query'][_0x7196('0x3d')](_0x7196('0x3e'))){_0x50c386[_0x7196('0x23')]=qs['limit'](_0x2f9583[_0x7196('0x39')][_0x7196('0x23')]);_0x50c386[_0x7196('0x21')]=qs[_0x7196('0x21')](_0x2f9583[_0x7196('0x39')][_0x7196('0x21')]);}_0x50c386[_0x7196('0x3f')]=qs[_0x7196('0x40')](_0x2f9583[_0x7196('0x39')][_0x7196('0x40')]);_0x50c386['where']=qs[_0x7196('0x37')](_[_0x7196('0x41')](_0x2f9583['query'],_0x39710d[_0x7196('0x37')]),_0xd07f22);if(_0x2f9583['query']['filter']){_0x50c386[_0x7196('0x42')]=_[_0x7196('0x43')](_0x50c386['where'],{'$or':_['map'](_0xd07f22,function(_0x1bad95){if(_0x1bad95[_0x7196('0x33')]!==_0x7196('0x44')){var _0x4c2341={};_0x4c2341[_0x1bad95[_0x7196('0x2c')]]={'$like':'%'+_0x2f9583[_0x7196('0x39')][_0x7196('0x45')]+'%'};return _0x4c2341;}})});}_0x50c386=_[_0x7196('0x43')]({},_0x50c386,_0x2f9583[_0x7196('0x46')]);var _0x428d76={'where':_0x50c386[_0x7196('0x42')]};return db[_0x7196('0x30')]['count'](_0x428d76)[_0x7196('0x28')](function(_0xa852e1){_0x429160['count']=_0xa852e1;if(_0x2f9583[_0x7196('0x39')][_0x7196('0x47')]){_0x50c386['include']=[{'all':!![]}];}return db[_0x7196('0x30')][_0x7196('0x48')](_0x50c386);})[_0x7196('0x28')](function(_0x5749e2){_0x429160[_0x7196('0x49')]=_0x5749e2;return _0x429160;})[_0x7196('0x28')](respondWithFilteredResult(_0xf999e9,_0x50c386))['catch'](handleError(_0xf999e9,null));};exports[_0x7196('0x4a')]=function(_0x1a7052,_0x4f0c6c){var _0x335e6f={'raw':!![],'where':{'id':_0x1a7052['params']['id']}},_0x53a5e6={};_0x53a5e6['model']=_['keys'](db['AnalyticDefaultReport'][_0x7196('0x31')]);_0x53a5e6['query']=_[_0x7196('0x36')](_0x1a7052[_0x7196('0x39')]);_0x53a5e6[_0x7196('0x37')]=_[_0x7196('0x38')](_0x53a5e6['model'],_0x53a5e6[_0x7196('0x39')]);_0x335e6f['attributes']=_[_0x7196('0x38')](_0x53a5e6[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x1a7052['query'][_0x7196('0x3b')]));_0x335e6f[_0x7196('0x3a')]=_0x335e6f[_0x7196('0x3a')]['length']?_0x335e6f['attributes']:_0x53a5e6[_0x7196('0x35')];if(_0x1a7052['query'][_0x7196('0x47')]){_0x335e6f['include']=[{'all':!![]}];}_0x335e6f=_['merge']({},_0x335e6f,_0x1a7052[_0x7196('0x46')]);return db['AnalyticDefaultReport']['find'](_0x335e6f)['then'](handleEntityNotFound(_0x4f0c6c,null))[_0x7196('0x28')](respondWithResult(_0x4f0c6c,null))['catch'](handleError(_0x4f0c6c,null));};exports['create']=function(_0x28591e,_0x182c8b){return db[_0x7196('0x30')][_0x7196('0x4b')](_0x28591e['body'],{})[_0x7196('0x28')](function(_0x564688){var _0x36844f=_0x28591e[_0x7196('0x4c')]['get']({'plain':!![]});if(!_0x36844f)throw new Error(_0x7196('0x4d'));if(_0x36844f[_0x7196('0x4e')]===_0x7196('0x4c')){var _0x4fa18f=_0x564688[_0x7196('0x2a')]({'plain':!![]});var _0x5d51aa=_0x7196('0x4f');return db[_0x7196('0x50')][_0x7196('0x51')]({'where':{'name':_0x5d51aa,'userProfileId':_0x36844f[_0x7196('0x52')]},'raw':!![]})[_0x7196('0x28')](function(_0x19733a){if(_0x19733a&&_0x19733a[_0x7196('0x53')]===0x0){return db[_0x7196('0x54')]['create']({'name':_0x4fa18f['name'],'resourceId':_0x4fa18f['id'],'type':_0x7196('0x55'),'sectionId':_0x19733a['id']},{})[_0x7196('0x28')](function(){return _0x564688;});}else{return _0x564688;}})[_0x7196('0x56')](function(_0xe4b032){logger['error'](_0x7196('0x57'),_0xe4b032);throw _0xe4b032;});}return _0x564688;})[_0x7196('0x28')](respondWithResult(_0x182c8b,0xc9))[_0x7196('0x56')](handleError(_0x182c8b,null));};exports[_0x7196('0x27')]=function(_0x9fcfd4,_0x3177c2){if(_0x9fcfd4[_0x7196('0x58')]['id']){delete _0x9fcfd4[_0x7196('0x58')]['id'];}return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x9fcfd4[_0x7196('0x59')]['id']}})['then'](handleEntityNotFound(_0x3177c2,null))[_0x7196('0x28')](saveUpdates(_0x9fcfd4[_0x7196('0x58')],null))[_0x7196('0x28')](respondWithResult(_0x3177c2,null))['catch'](handleError(_0x3177c2,null));};exports[_0x7196('0x29')]=function(_0x5ca1ca,_0x34407d){return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x5ca1ca[_0x7196('0x59')]['id']}})[_0x7196('0x28')](handleEntityNotFound(_0x34407d,null))['then'](removeEntity(_0x34407d,null))[_0x7196('0x56')](handleError(_0x34407d,null));};exports['preview']=function(_0x4be36d,_0x5b9824){var _0x1bc358=0xa;var _0x3be180=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x2d8b3d={'SUM':'SUM(%s)','COUNT':_0x7196('0x5e'),'COUNT DISTINCT':_0x7196('0x5f'),'MAX':_0x7196('0x60'),'MIN':_0x7196('0x61'),'AVG':_0x7196('0x62'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7196('0x63')};var _0x1c7eb2={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x43ee13=function(_0x13e9d0){return!_[_0x7196('0x69')]([_0x7196('0x6a'),'IS\x20NOT\x20NULL',_0x7196('0x6b'),_0x7196('0x6c')],_0x13e9d0);};var _0x27d5d7=function(_0x33f43b){if(!_0x33f43b||!_0x33f43b['rules'][_0x7196('0x3c')]){return'';}for(var _0x204c3a='(',_0x1f3acc=0x0;_0x1f3acc<_0x33f43b[_0x7196('0x6d')][_0x7196('0x3c')];_0x1f3acc+=0x1){_0x1f3acc>0x0&&(_0x204c3a+='\x20'+_0x33f43b[_0x7196('0x6e')]+'\x20');_0x204c3a+=_0x33f43b[_0x7196('0x6d')][_0x1f3acc]['group']?_0x27d5d7(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x6f')]):_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x70')]+'\x20'+_0x33f43b['rules'][_0x1f3acc][_0x7196('0x71')]+(_0x43ee13(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x71')])?'\x20'+_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x72')]:'');}return _0x204c3a+')';};var _0x37c6be={'where':{'id':_0x4be36d['params']['id']}},_0x57065,_0x517dfb,_0x56b2eb,_0x56955e,_0x72f6f1;_0x37c6be=_[_0x7196('0x43')]({},_0x37c6be,_0x4be36d[_0x7196('0x46')]);return db[_0x7196('0x30')][_0x7196('0x51')](_0x37c6be)[_0x7196('0x28')](function(_0x30d44f){if(_0x30d44f){_0x57065=_0x30d44f;return _0x30d44f[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x3881a5){if(_0x3881a5){if(!_0x3881a5['length']){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x517dfb=_0x3881a5;return db[_0x7196('0x76')][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x45e21f){if(_0x45e21f){_0x56b2eb=_[_0x7196('0x77')](_0x45e21f,'id');var _0x2f36f8;var _0x4cc5e3=squel['select']();_0x4cc5e3[_0x7196('0x78')](_0x57065['table']);for(var _0x30d114=0x0;_0x30d114<_0x517dfb['length'];_0x30d114+=0x1){_0x2f36f8=_0x517dfb[_0x30d114][_0x7196('0x79')]?_0x56b2eb[_0x517dfb[_0x30d114][_0x7196('0x79')]][_0x7196('0x7a')]:_0x517dfb[_0x30d114][_0x7196('0x70')];_0x2f36f8=_0x517dfb[_0x30d114]['function']?_['replace'](_0x2d8b3d[_0x517dfb[_0x30d114][_0x7196('0x7b')]],'%s',_0x2f36f8):_0x2f36f8;_0x2f36f8=_0x517dfb[_0x30d114]['format']?_[_0x7196('0x7c')](_0x1c7eb2[_0x517dfb[_0x30d114][_0x7196('0x7d')]],'%s',_0x2f36f8):_0x2f36f8;if(_0x517dfb[_0x30d114][_0x7196('0x7e')]){_0x4cc5e3[_0x7196('0x6f')](_0x2f36f8);}_0x517dfb[_0x30d114][_0x7196('0x7f')]&&_0x4cc5e3[_0x7196('0x3f')](_0x2f36f8,_0x517dfb[_0x30d114]['orderBy']===_0x7196('0x80')?![]:!![]);_0x4cc5e3[_0x7196('0x70')](_0x2f36f8,_0x517dfb[_0x30d114][_0x7196('0x81')]||_0x2f36f8);}if(_0x57065[_0x7196('0x82')]){_0x57065[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x82')]);for(var _0x473c0e=0x0;_0x473c0e<_0x57065[_0x7196('0x82')][_0x7196('0x3c')];_0x473c0e+=0x1){if(_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')]&&_['includes'](_0x3be180,_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')])&&_0x57065['joins'][_0x473c0e]['parentKey']&&_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')]&&_0x57065[_0x7196('0x82')][_0x473c0e]['foreignKey']){_0x4cc5e3[_0x57065[_0x7196('0x82')][_0x473c0e]['type']](_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],null,util['format'](_0x7196('0x85'),_0x57065['table'],_0x57065['joins'][_0x473c0e][_0x7196('0x86')],_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],_0x57065['joins'][_0x473c0e][_0x7196('0x87')]));}}}if(_0x57065['conditions']){_0x57065[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x88')]);_0x4cc5e3[_0x7196('0x42')](_0x27d5d7(_0x57065[_0x7196('0x88')]['group']));}_0x72f6f1=_0x4cc5e3[_0x7196('0x89')]();_0x4cc5e3[_0x7196('0x23')](_0x1bc358);_0x4cc5e3[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x4cc5e3[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x4cc5e3['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});}})[_0x7196('0x28')](respondWithResult(_0x5b9824,null))['catch'](handleError(_0x5b9824,null));};function runReport(_0x1364f5,_0x2cb53c,_0x4fe2cb){var _0x2e4807=_0x2cb53c['name'];var _0xd6d8cf=0xa;var _0x5318c1=[_0x7196('0x5a'),_0x7196('0x5b'),'right_join',_0x7196('0x5d')];var _0x2b52c0={'SUM':_0x7196('0x90'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7196('0x60'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0x509c4a={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x26048c=function(_0x1a4d17){return!_[_0x7196('0x69')]([_0x7196('0x6a'),_0x7196('0x93'),_0x7196('0x6b'),'IS\x20NOT\x20EMPTY'],_0x1a4d17);};var _0x5acff1=function(_0x32ab6c){if(!_0x32ab6c||!_0x32ab6c['rules']['length']){return'';}for(var _0x2bfdc4='(',_0x1604fa=0x0;_0x1604fa<_0x32ab6c[_0x7196('0x6d')][_0x7196('0x3c')];_0x1604fa+=0x1){_0x1604fa>0x0&&(_0x2bfdc4+='\x20'+_0x32ab6c['operator']+'\x20');_0x2bfdc4+=_0x32ab6c['rules'][_0x1604fa][_0x7196('0x6f')]?_0x5acff1(_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x6f')]):_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['field']+'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['condition']+(_0x26048c(_0x32ab6c['rules'][_0x1604fa][_0x7196('0x71')])?'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x72')]:'');}return _0x2bfdc4+')';};var _0x494418={'where':{'id':_0x1364f5['id']}},_0x400aa5,_0x40d4c3,_0x1824e2,_0x30c54b,_0x10712f;_0x494418=_[_0x7196('0x43')]({},_0x494418,_0x4fe2cb);return db[_0x7196('0x30')][_0x7196('0x51')](_0x494418)['then'](function(_0x9bd2ea){if(_0x9bd2ea){_0x400aa5=_0x9bd2ea;return _0x9bd2ea[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x408760){if(_0x408760){if(!_0x408760[_0x7196('0x3c')]){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x40d4c3=_0x408760;return db[_0x7196('0x76')]['findAll']({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x4b98de){if(_0x4b98de){_0x1824e2=_['keyBy'](_0x4b98de,'id');var _0x1dcf93;var _0x25d323=squel['select']();_0x25d323[_0x7196('0x78')](_0x400aa5[_0x7196('0x94')]);for(var _0x48ceda=0x0;_0x48ceda<_0x40d4c3[_0x7196('0x3c')];_0x48ceda+=0x1){_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x79')]?_0x1824e2[_0x40d4c3[_0x48ceda][_0x7196('0x79')]][_0x7196('0x7a')]:_0x40d4c3[_0x48ceda][_0x7196('0x70')];_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7b')]?_['replace'](_0x2b52c0[_0x40d4c3[_0x48ceda][_0x7196('0x7b')]],'%s',_0x1dcf93):_0x1dcf93;_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0x509c4a[_0x40d4c3[_0x48ceda]['format']],'%s',_0x1dcf93):_0x1dcf93;if(_0x40d4c3[_0x48ceda]['groupBy']){_0x25d323['group'](_0x1dcf93);}_0x40d4c3[_0x48ceda][_0x7196('0x7f')]&&_0x25d323[_0x7196('0x3f')](_0x1dcf93,_0x40d4c3[_0x48ceda][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x25d323[_0x7196('0x70')](_0x1dcf93,_0x40d4c3[_0x48ceda]['alias']||_0x1dcf93);}if(_0x400aa5[_0x7196('0x82')]){_0x400aa5['joins']=JSON[_0x7196('0x83')](_0x400aa5[_0x7196('0x82')]);for(var _0x33d5bf=0x0;_0x33d5bf<_0x400aa5[_0x7196('0x82')][_0x7196('0x3c')];_0x33d5bf+=0x1){if(_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x33')]&&_['includes'](_0x5318c1,_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type'])&&_0x400aa5['joins'][_0x33d5bf]['parentKey']&&_0x400aa5['joins'][_0x33d5bf]['foreignTable']&&_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]){_0x25d323[_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type']](_0x400aa5[_0x7196('0x82')][_0x33d5bf]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x400aa5[_0x7196('0x94')],_0x400aa5['joins'][_0x33d5bf][_0x7196('0x86')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x84')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]));}}}if(_0x400aa5[_0x7196('0x88')]){_0x400aa5[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x400aa5['conditions']);_0x25d323[_0x7196('0x42')](_0x5acff1(_0x400aa5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x10712f=_0x25d323['clone']();_0x25d323[_0x7196('0x23')](_0xd6d8cf);_0x25d323[_0x7196('0x21')](0x0);return;}})[_0x7196('0x28')](function(){if(_0x2cb53c['output']===_0x7196('0x95')){return null;}var _0x46a563=_[_0x7196('0x43')](_0x2cb53c,{'name':_0x2cb53c['fullPath']||_0x2cb53c[_0x7196('0x2c')]||_0x400aa5[_0x7196('0x2c')],'basename':_0x2e4807,'savename':util['format'](_0x7196('0x96'),_0x2cb53c['name']||_0x400aa5[_0x7196('0x2c')],require(_0x7196('0x97'))['generate'](0x4),_0x2cb53c[_0x7196('0x98')]||'csv'),'reportId':_0x400aa5['id'],'reportType':_0x7196('0x99')});return db[_0x7196('0x9a')][_0x7196('0x4b')](_0x46a563,{'raw':!![]});})['then'](function(_0xd9619d){if(_0x400aa5[_0x7196('0x94')]===_0x7196('0x9b')){_0x10712f[_0x7196('0x42')](_0x400aa5['table']+_0x7196('0x9c'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}else{_0x10712f['where'](_0x400aa5['table']+_0x7196('0x9f'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}if(_0xd9619d){logger[_0x7196('0xa0')]('Run\x20Query:',_0x10712f[_0x7196('0x8c')]());require('child_process')[_0x7196('0xa1')](path['join'](__dirname,_0x7196('0xa2'),_0xd9619d[_0x7196('0x98')]),[_0xd9619d['id'],_0x10712f[_0x7196('0x8c')](),path[_0x7196('0x5a')](__dirname,_0x7196('0xa3'),_0xd9619d[_0x7196('0xa4')]),_0x2e4807]);return _0xd9619d;}else{var _0x342fb1=squel['select']();_0x342fb1[_0x7196('0x78')]('('+_0x10712f[_0x7196('0x8c')]()+')',_0x7196('0xa5'));_0x342fb1[_0x7196('0x70')](_0x7196('0xa6'),_0x7196('0x24'));_0x10712f[_0x7196('0x23')](_0x2cb53c[_0x7196('0x23')]||_0xd6d8cf);_0x10712f['offset'](_0x2cb53c[_0x7196('0x21')]||0x0);return dbH[_0x7196('0x8d')]['query'](_0x342fb1[_0x7196('0x8c')](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]})[_0x7196('0x28')](function(_0xdf1ede){if(!_0xdf1ede[_0x7196('0x3c')]){_0x30c54b=0x0;}else{_0x30c54b=_0xdf1ede[0x0]['count']||0x0;}return dbH['sequelize'][_0x7196('0x39')](_0x10712f['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});})[_0x7196('0x28')](function(_0x2df80a){return{'rows':_0x2df80a||[],'count':_0x30c54b};});}});}exports['run']=function(_0x392e74,_0x17ba6d){return runReport(_0x392e74[_0x7196('0x59')],_0x392e74[_0x7196('0x39')],_0x392e74[_0x7196('0x46')])[_0x7196('0x28')](respondWithResult(_0x17ba6d,null))[_0x7196('0x56')](handleError(_0x17ba6d,null));};exports[_0x7196('0xa7')]=runReport;exports[_0x7196('0x39')]=function(_0x5a3c87,_0x58fb86){var _0x51da79=0xa;var _0x144613=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x9055af={'SUM':_0x7196('0x90'),'COUNT':_0x7196('0x5e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0xab9595={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':'HOUR(%s)','ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5236a0=function(_0x520fe8){return!_['includes'](['IS\x20NULL',_0x7196('0x93'),'IS\x20EMPTY',_0x7196('0x6c')],_0x520fe8);};var _0x425a57=function(_0x302728){if(!_0x302728||!_0x302728[_0x7196('0x6d')][_0x7196('0x3c')]){return'';}for(var _0x14492e='(',_0x58df43=0x0;_0x58df43<_0x302728[_0x7196('0x6d')][_0x7196('0x3c')];_0x58df43+=0x1){_0x58df43>0x0&&(_0x14492e+='\x20'+_0x302728[_0x7196('0x6e')]+'\x20');_0x14492e+=_0x302728['rules'][_0x58df43][_0x7196('0x6f')]?_0x425a57(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x6f')]):_0x302728['rules'][_0x58df43]['field']+'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')]+(_0x5236a0(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')])?'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x72')]:'');}return _0x14492e+')';};var _0x1a8a5a={'where':{'id':_0x5a3c87[_0x7196('0x59')]['id']}},_0x2944e5,_0x3f9385,_0xbd94ef,_0x5d2a56,_0x2fb552;_0x1a8a5a=_['merge']({},_0x1a8a5a,_0x5a3c87[_0x7196('0x46')]);return db[_0x7196('0x30')]['find'](_0x1a8a5a)[_0x7196('0x28')](function(_0x386259){if(_0x386259){_0x2944e5=_0x386259;return _0x386259[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x1e7a64){if(_0x1e7a64){if(!_0x1e7a64[_0x7196('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0x7196('0x75'),0x193);}_0x3f9385=_0x1e7a64;return db['AnalyticMetric'][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x30db09){if(_0x30db09){_0xbd94ef=_['keyBy'](_0x30db09,'id');var _0x4729e1;var _0x66e1e6=squel[_0x7196('0xa8')]();_0x66e1e6[_0x7196('0x78')](_0x2944e5[_0x7196('0x94')]);for(var _0x1e2105=0x0;_0x1e2105<_0x3f9385[_0x7196('0x3c')];_0x1e2105+=0x1){_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x79')]?_0xbd94ef[_0x3f9385[_0x1e2105][_0x7196('0x79')]]['metric']:_0x3f9385[_0x1e2105][_0x7196('0x70')];_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7b')]?_[_0x7196('0x7c')](_0x9055af[_0x3f9385[_0x1e2105][_0x7196('0x7b')]],'%s',_0x4729e1):_0x4729e1;_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0xab9595[_0x3f9385[_0x1e2105]['format']],'%s',_0x4729e1):_0x4729e1;if(_0x3f9385[_0x1e2105][_0x7196('0x7e')]){_0x66e1e6['group'](_0x4729e1);}_0x3f9385[_0x1e2105][_0x7196('0x7f')]&&_0x66e1e6[_0x7196('0x3f')](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x66e1e6['field'](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x81')]||_0x4729e1);}if(_0x2944e5[_0x7196('0x82')]){_0x2944e5[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x2944e5[_0x7196('0x82')]);for(var _0x220315=0x0;_0x220315<_0x2944e5[_0x7196('0x82')][_0x7196('0x3c')];_0x220315+=0x1){if(_0x2944e5['joins'][_0x220315][_0x7196('0x33')]&&_[_0x7196('0x69')](_0x144613,_0x2944e5['joins'][_0x220315][_0x7196('0x33')])&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')]&&_0x2944e5['joins'][_0x220315][_0x7196('0x84')]&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]){_0x66e1e6[_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x33')]](_0x2944e5['joins'][_0x220315]['foreignTable'],null,util[_0x7196('0x7d')](_0x7196('0x85'),_0x2944e5[_0x7196('0x94')],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')],_0x2944e5[_0x7196('0x82')][_0x220315]['foreignTable'],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]));}}}if(_0x2944e5[_0x7196('0x88')]){_0x2944e5[_0x7196('0x88')]=JSON['parse'](_0x2944e5[_0x7196('0x88')]);_0x66e1e6[_0x7196('0x42')](_0x425a57(_0x2944e5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x2fb552=_0x66e1e6[_0x7196('0x89')]();_0x66e1e6[_0x7196('0x23')](_0x51da79);_0x66e1e6[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x66e1e6[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x66e1e6['toString'](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]});}})['then'](function(){return{'sql':_0x2fb552[_0x7196('0x8c')]()};})['then'](respondWithResult(_0x58fb86,null))[_0x7196('0x56')](handleError(_0x58fb86,null));}; \ No newline at end of file +var _0x2ef3=['Sequelize','from','foreignKey','output','web','fullPath','generate','csv','cdr','startDate','endDate','info','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','runReport','IS\x20NULL','IS\x20NOT\x20EMPTY','metric','Limited\x20Query:','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','get','DefaultReports','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','AnalyticDefaultReport','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','autoAssociation','update','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20EMPTY','operator','rules','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','MetricId','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','conditions','parse','clone','debug','toString','sequelize','QueryTypes','SELECT','join','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x2ef3,0xba));var _0x32ef=function(_0x4c5fa5,_0x4d6cd9){_0x4c5fa5=_0x4c5fa5-0x0;var _0x1e340a=_0x2ef3[_0x4c5fa5];return _0x1e340a;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];var dbH=require(_0x32ef('0x18'))['dbH'];function respondWithStatusCode(_0x3e98df,_0x1ef1ae){_0x1ef1ae=_0x1ef1ae||0xcc;return function(_0x5c3eb9){if(_0x5c3eb9){return _0x3e98df['sendStatus'](_0x1ef1ae);}return _0x3e98df[_0x32ef('0x19')](_0x1ef1ae)['end']();};}function respondWithResult(_0x326fce,_0x40a6e6){_0x40a6e6=_0x40a6e6||0xc8;return function(_0x93d492){if(_0x93d492){return _0x326fce[_0x32ef('0x19')](_0x40a6e6)['json'](_0x93d492);}};}function respondWithFilteredResult(_0x55bf0b,_0x531e30){return function(_0x13db1a){if(_0x13db1a){var _0x3950e6=typeof _0x531e30[_0x32ef('0x1a')]==='undefined'&&typeof _0x531e30['limit']===_0x32ef('0x1b');var _0x1a9476=_0x13db1a[_0x32ef('0x1c')];var _0x57863c=_0x3950e6?0x0:_0x531e30[_0x32ef('0x1a')];var _0x33e230=_0x3950e6?_0x13db1a['count']:_0x531e30[_0x32ef('0x1a')]+_0x531e30[_0x32ef('0x1d')];var _0x26aff3;if(_0x33e230>=_0x1a9476){_0x33e230=_0x1a9476;_0x26aff3=0xc8;}else{_0x26aff3=0xce;}_0x55bf0b[_0x32ef('0x19')](_0x26aff3);return _0x55bf0b[_0x32ef('0x1e')](_0x32ef('0x1f'),_0x57863c+'-'+_0x33e230+'/'+_0x1a9476)['json'](_0x13db1a);}return null;};}function patchUpdates(_0x3c5b78){return function(_0x5cc3ef){try{jsonpatch[_0x32ef('0x20')](_0x5cc3ef,_0x3c5b78,!![]);}catch(_0x3a20ca){return BPromise['reject'](_0x3a20ca);}return _0x5cc3ef[_0x32ef('0x21')]();};}function saveUpdates(_0x97780,_0x5e8898){return function(_0x55f7f2){if(_0x55f7f2){return _0x55f7f2['update'](_0x97780)[_0x32ef('0x22')](function(_0xb30fab){return _0xb30fab;});}return null;};}function removeEntity(_0x225feb,_0x478bef){return function(_0x59585f){if(_0x59585f){return _0x59585f[_0x32ef('0x23')]()['then'](function(){var _0x51a412=_0x59585f[_0x32ef('0x24')]({'plain':!![]});var _0x14d4b3=_0x32ef('0x25');return db[_0x32ef('0x26')][_0x32ef('0x23')]({'where':{'type':_0x14d4b3,'resourceId':_0x51a412['id']}})[_0x32ef('0x22')](function(){return _0x59585f;});})[_0x32ef('0x22')](function(){_0x225feb[_0x32ef('0x19')](0xcc)[_0x32ef('0x27')]();});}};}function handleEntityNotFound(_0x2f52d7,_0x1335e2){return function(_0xba4b3f){if(!_0xba4b3f){_0x2f52d7['sendStatus'](0x194);}return _0xba4b3f;};}function handleError(_0xd65fde,_0x2f5d06){_0x2f5d06=_0x2f5d06||0x1f4;return function(_0x5a04cd){logger[_0x32ef('0x28')](_0x5a04cd[_0x32ef('0x29')]);if(_0x5a04cd[_0x32ef('0x2a')]){delete _0x5a04cd[_0x32ef('0x2a')];}_0xd65fde['status'](_0x2f5d06)[_0x32ef('0x2b')](_0x5a04cd);};}exports[_0x32ef('0x2c')]=function(_0x31dbc3,_0x2ac686){var _0x1b668a={},_0x1a6ed2={},_0x1a122d={'count':0x0,'rows':[]};var _0x575f3e=_[_0x32ef('0x2d')](db['AnalyticDefaultReport'][_0x32ef('0x2e')],function(_0x2b6c6a){return{'name':_0x2b6c6a['fieldName'],'type':_0x2b6c6a[_0x32ef('0x2f')][_0x32ef('0x30')]};});_0x1a6ed2[_0x32ef('0x31')]=_[_0x32ef('0x2d')](_0x575f3e,_0x32ef('0x2a'));_0x1a6ed2['query']=_['keys'](_0x31dbc3[_0x32ef('0x32')]);_0x1a6ed2['filters']=_[_0x32ef('0x33')](_0x1a6ed2[_0x32ef('0x31')],_0x1a6ed2[_0x32ef('0x32')]);_0x1b668a[_0x32ef('0x34')]=_[_0x32ef('0x33')](_0x1a6ed2[_0x32ef('0x31')],qs['fields'](_0x31dbc3['query']['fields']));_0x1b668a[_0x32ef('0x34')]=_0x1b668a[_0x32ef('0x34')][_0x32ef('0x35')]?_0x1b668a['attributes']:_0x1a6ed2['model'];if(!_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x36')](_0x32ef('0x37'))){_0x1b668a['limit']=qs['limit'](_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x1d')]);_0x1b668a[_0x32ef('0x1a')]=qs[_0x32ef('0x1a')](_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x1a')]);}_0x1b668a[_0x32ef('0x38')]=qs[_0x32ef('0x39')](_0x31dbc3[_0x32ef('0x32')]['sort']);_0x1b668a[_0x32ef('0x3a')]=qs[_0x32ef('0x3b')](_[_0x32ef('0x3c')](_0x31dbc3['query'],_0x1a6ed2[_0x32ef('0x3b')]),_0x575f3e);if(_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x3d')]){_0x1b668a[_0x32ef('0x3a')]=_[_0x32ef('0x3e')](_0x1b668a[_0x32ef('0x3a')],{'$or':_[_0x32ef('0x2d')](_0x575f3e,function(_0x1cebed){if(_0x1cebed[_0x32ef('0x2f')]!==_0x32ef('0x3f')){var _0xb4db74={};_0xb4db74[_0x1cebed[_0x32ef('0x2a')]]={'$like':'%'+_0x31dbc3['query'][_0x32ef('0x3d')]+'%'};return _0xb4db74;}})});}_0x1b668a=_[_0x32ef('0x3e')]({},_0x1b668a,_0x31dbc3[_0x32ef('0x40')]);var _0x1733e3={'where':_0x1b668a[_0x32ef('0x3a')]};return db[_0x32ef('0x41')][_0x32ef('0x1c')](_0x1733e3)['then'](function(_0x538758){_0x1a122d[_0x32ef('0x1c')]=_0x538758;if(_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x42')]){_0x1b668a[_0x32ef('0x43')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x32ef('0x44')](_0x1b668a);})[_0x32ef('0x22')](function(_0x5d2f06){_0x1a122d[_0x32ef('0x45')]=_0x5d2f06;return _0x1a122d;})['then'](respondWithFilteredResult(_0x2ac686,_0x1b668a))[_0x32ef('0x46')](handleError(_0x2ac686,null));};exports[_0x32ef('0x47')]=function(_0x37a497,_0x3be46d){var _0x2c2b62={'raw':!![],'where':{'id':_0x37a497[_0x32ef('0x48')]['id']}},_0x2310ae={};_0x2310ae[_0x32ef('0x31')]=_[_0x32ef('0x49')](db[_0x32ef('0x41')]['rawAttributes']);_0x2310ae[_0x32ef('0x32')]=_['keys'](_0x37a497[_0x32ef('0x32')]);_0x2310ae[_0x32ef('0x3b')]=_[_0x32ef('0x33')](_0x2310ae['model'],_0x2310ae[_0x32ef('0x32')]);_0x2c2b62[_0x32ef('0x34')]=_[_0x32ef('0x33')](_0x2310ae[_0x32ef('0x31')],qs[_0x32ef('0x4a')](_0x37a497[_0x32ef('0x32')][_0x32ef('0x4a')]));_0x2c2b62['attributes']=_0x2c2b62['attributes'][_0x32ef('0x35')]?_0x2c2b62[_0x32ef('0x34')]:_0x2310ae[_0x32ef('0x31')];if(_0x37a497[_0x32ef('0x32')][_0x32ef('0x42')]){_0x2c2b62[_0x32ef('0x43')]=[{'all':!![]}];}_0x2c2b62=_[_0x32ef('0x3e')]({},_0x2c2b62,_0x37a497[_0x32ef('0x40')]);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x2c2b62)[_0x32ef('0x22')](handleEntityNotFound(_0x3be46d,null))[_0x32ef('0x22')](respondWithResult(_0x3be46d,null))[_0x32ef('0x46')](handleError(_0x3be46d,null));};exports['create']=function(_0x420f00,_0x12fbd7){return db[_0x32ef('0x41')][_0x32ef('0x4c')](_0x420f00[_0x32ef('0x4d')],{})[_0x32ef('0x22')](function(_0x278696){var _0x1acded=_0x420f00[_0x32ef('0x4e')][_0x32ef('0x24')]({'plain':!![]});if(!_0x1acded)throw new Error(_0x32ef('0x4f'));if(_0x1acded[_0x32ef('0x50')]===_0x32ef('0x4e')){var _0x326445=_0x278696[_0x32ef('0x24')]({'plain':!![]});var _0x3fb4d8=_0x32ef('0x51');return db[_0x32ef('0x52')]['find']({'where':{'name':_0x3fb4d8,'userProfileId':_0x1acded['userProfileId']},'raw':!![]})[_0x32ef('0x22')](function(_0x259c32){if(_0x259c32&&_0x259c32[_0x32ef('0x53')]===0x0){return db[_0x32ef('0x26')][_0x32ef('0x4c')]({'name':_0x326445[_0x32ef('0x2a')],'resourceId':_0x326445['id'],'type':_0x32ef('0x25'),'sectionId':_0x259c32['id']},{})[_0x32ef('0x22')](function(){return _0x278696;});}else{return _0x278696;}})[_0x32ef('0x46')](function(_0x368bf1){logger[_0x32ef('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x368bf1);throw _0x368bf1;});}return _0x278696;})[_0x32ef('0x22')](respondWithResult(_0x12fbd7,0xc9))[_0x32ef('0x46')](handleError(_0x12fbd7,null));};exports[_0x32ef('0x54')]=function(_0x3fe01f,_0x38314a){if(_0x3fe01f[_0x32ef('0x4d')]['id']){delete _0x3fe01f['body']['id'];}return db[_0x32ef('0x41')][_0x32ef('0x4b')]({'where':{'id':_0x3fe01f[_0x32ef('0x48')]['id']}})['then'](handleEntityNotFound(_0x38314a,null))[_0x32ef('0x22')](saveUpdates(_0x3fe01f['body'],null))[_0x32ef('0x22')](respondWithResult(_0x38314a,null))[_0x32ef('0x46')](handleError(_0x38314a,null));};exports['destroy']=function(_0x206ad5,_0x59e5f9){return db[_0x32ef('0x41')][_0x32ef('0x4b')]({'where':{'id':_0x206ad5[_0x32ef('0x48')]['id']}})[_0x32ef('0x22')](handleEntityNotFound(_0x59e5f9,null))[_0x32ef('0x22')](removeEntity(_0x59e5f9,null))[_0x32ef('0x46')](handleError(_0x59e5f9,null));};exports[_0x32ef('0x55')]=function(_0x56260f,_0x56cc75){var _0xdfa103=0xa;var _0x52232a=['join',_0x32ef('0x56'),_0x32ef('0x57'),_0x32ef('0x58')];var _0x6aae59={'SUM':_0x32ef('0x59'),'COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':_0x32ef('0x5d'),'AVG':_0x32ef('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x32ef('0x5f')};var _0xbd059e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2ac877=function(_0x3c31d0){return!_[_0x32ef('0x63')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x32ef('0x64'),'IS\x20NOT\x20EMPTY'],_0x3c31d0);};var _0x17f447=function(_0x5bb114){if(!_0x5bb114||!_0x5bb114['rules'][_0x32ef('0x35')]){return'';}for(var _0x208989='(',_0x10cb37=0x0;_0x10cb37<_0x5bb114['rules'][_0x32ef('0x35')];_0x10cb37+=0x1){_0x10cb37>0x0&&(_0x208989+='\x20'+_0x5bb114[_0x32ef('0x65')]+'\x20');_0x208989+=_0x5bb114[_0x32ef('0x66')][_0x10cb37]['group']?_0x17f447(_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x67')]):_0x5bb114['rules'][_0x10cb37]['field']+'\x20'+_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x68')]+(_0x2ac877(_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x68')])?'\x20'+_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x69')]:'');}return _0x208989+')';};var _0x4c89e8={'where':{'id':_0x56260f[_0x32ef('0x48')]['id']}},_0x285330,_0x63b65,_0x25b6d6,_0x36ed97,_0x21e930;_0x4c89e8=_[_0x32ef('0x3e')]({},_0x4c89e8,_0x56260f[_0x32ef('0x40')]);return db[_0x32ef('0x41')]['find'](_0x4c89e8)[_0x32ef('0x22')](function(_0x29ff58){if(_0x29ff58){_0x285330=_0x29ff58;return _0x29ff58[_0x32ef('0x6a')]();}return null;})[_0x32ef('0x22')](function(_0x79ae28){if(_0x79ae28){if(!_0x79ae28['length']){throw new db['Sequelize'][(_0x32ef('0x6b'))](_0x32ef('0x6c'),0x193);}_0x63b65=_0x79ae28;return db[_0x32ef('0x6d')][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x526fb1){if(_0x526fb1){_0x25b6d6=_[_0x32ef('0x6e')](_0x526fb1,'id');var _0x544045;var _0x216e2f=squel[_0x32ef('0x6f')]();_0x216e2f['from'](_0x285330['table']);for(var _0x2c9f7a=0x0;_0x2c9f7a<_0x63b65[_0x32ef('0x35')];_0x2c9f7a+=0x1){_0x544045=_0x63b65[_0x2c9f7a][_0x32ef('0x70')]?_0x25b6d6[_0x63b65[_0x2c9f7a]['MetricId']]['metric']:_0x63b65[_0x2c9f7a][_0x32ef('0x71')];_0x544045=_0x63b65[_0x2c9f7a][_0x32ef('0x72')]?_[_0x32ef('0x73')](_0x6aae59[_0x63b65[_0x2c9f7a][_0x32ef('0x72')]],'%s',_0x544045):_0x544045;_0x544045=_0x63b65[_0x2c9f7a]['format']?_[_0x32ef('0x73')](_0xbd059e[_0x63b65[_0x2c9f7a][_0x32ef('0x74')]],'%s',_0x544045):_0x544045;if(_0x63b65[_0x2c9f7a][_0x32ef('0x75')]){_0x216e2f[_0x32ef('0x67')](_0x544045);}_0x63b65[_0x2c9f7a][_0x32ef('0x76')]&&_0x216e2f[_0x32ef('0x38')](_0x544045,_0x63b65[_0x2c9f7a][_0x32ef('0x76')]===_0x32ef('0x77')?![]:!![]);_0x216e2f[_0x32ef('0x71')](_0x544045,_0x63b65[_0x2c9f7a][_0x32ef('0x78')]||_0x544045);}if(_0x285330[_0x32ef('0x79')]){_0x285330[_0x32ef('0x79')]=JSON['parse'](_0x285330['joins']);for(var _0x3a9c97=0x0;_0x3a9c97<_0x285330[_0x32ef('0x79')]['length'];_0x3a9c97+=0x1){if(_0x285330[_0x32ef('0x79')][_0x3a9c97]['type']&&_[_0x32ef('0x63')](_0x52232a,_0x285330[_0x32ef('0x79')][_0x3a9c97][_0x32ef('0x2f')])&&_0x285330['joins'][_0x3a9c97][_0x32ef('0x7a')]&&_0x285330['joins'][_0x3a9c97][_0x32ef('0x7b')]&&_0x285330[_0x32ef('0x79')][_0x3a9c97]['foreignKey']){_0x216e2f[_0x285330['joins'][_0x3a9c97][_0x32ef('0x2f')]](_0x285330['joins'][_0x3a9c97][_0x32ef('0x7b')],null,util['format'](_0x32ef('0x7c'),_0x285330[_0x32ef('0x7d')],_0x285330[_0x32ef('0x79')][_0x3a9c97]['parentKey'],_0x285330['joins'][_0x3a9c97]['foreignTable'],_0x285330[_0x32ef('0x79')][_0x3a9c97]['foreignKey']));}}}if(_0x285330[_0x32ef('0x7e')]){_0x285330[_0x32ef('0x7e')]=JSON[_0x32ef('0x7f')](_0x285330[_0x32ef('0x7e')]);_0x216e2f[_0x32ef('0x3a')](_0x17f447(_0x285330[_0x32ef('0x7e')]['group']));}_0x21e930=_0x216e2f[_0x32ef('0x80')]();_0x216e2f['limit'](_0xdfa103);_0x216e2f['offset'](0x0);logger[_0x32ef('0x81')]('Limited\x20Query:',_0x216e2f[_0x32ef('0x82')]());return dbH[_0x32ef('0x83')]['query'](_0x216e2f[_0x32ef('0x82')](),{'type':dbH[_0x32ef('0x83')][_0x32ef('0x84')][_0x32ef('0x85')]});}})[_0x32ef('0x22')](respondWithResult(_0x56cc75,null))[_0x32ef('0x46')](handleError(_0x56cc75,null));};function runReport(_0x4b5506,_0x51736f,_0x35b10d){var _0x5e0b55=_0x51736f[_0x32ef('0x2a')];var _0x266688=0xa;var _0x114d8e=[_0x32ef('0x86'),_0x32ef('0x56'),_0x32ef('0x57'),'cross_join'];var _0x3232ca={'SUM':_0x32ef('0x59'),'COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x32ef('0x87'),'GROUP_CONCAT ASC':_0x32ef('0x88'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x211fb1={'SEC_TO_TIME':_0x32ef('0x89'),'DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':_0x32ef('0x8a')};var _0xfb4845=function(_0x21067e){return!_[_0x32ef('0x63')](['IS\x20NULL',_0x32ef('0x8b'),_0x32ef('0x64'),'IS\x20NOT\x20EMPTY'],_0x21067e);};var _0x35653b=function(_0x5ea727){if(!_0x5ea727||!_0x5ea727[_0x32ef('0x66')]['length']){return'';}for(var _0x43f36e='(',_0x39300f=0x0;_0x39300f<_0x5ea727[_0x32ef('0x66')][_0x32ef('0x35')];_0x39300f+=0x1){_0x39300f>0x0&&(_0x43f36e+='\x20'+_0x5ea727['operator']+'\x20');_0x43f36e+=_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x67')]?_0x35653b(_0x5ea727[_0x32ef('0x66')][_0x39300f]['group']):_0x5ea727['rules'][_0x39300f]['field']+'\x20'+_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x68')]+(_0xfb4845(_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x68')])?'\x20'+_0x5ea727[_0x32ef('0x66')][_0x39300f]['value']:'');}return _0x43f36e+')';};var _0x2678e3={'where':{'id':_0x4b5506['id']}},_0x5b3deb,_0x471de6,_0x7b0ea5,_0xc43e1,_0x4baa7a;_0x2678e3=_[_0x32ef('0x3e')]({},_0x2678e3,_0x35b10d);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x2678e3)[_0x32ef('0x22')](function(_0x28bebb){if(_0x28bebb){_0x5b3deb=_0x28bebb;return _0x28bebb['getFields']();}return null;})[_0x32ef('0x22')](function(_0x484df0){if(_0x484df0){if(!_0x484df0[_0x32ef('0x35')]){throw new db[(_0x32ef('0x8c'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x471de6=_0x484df0;return db[_0x32ef('0x6d')][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x3b9896){if(_0x3b9896){_0x7b0ea5=_['keyBy'](_0x3b9896,'id');var _0x356fd4;var _0x51ca6e=squel['select']();_0x51ca6e[_0x32ef('0x8d')](_0x5b3deb['table']);for(var _0x2237cf=0x0;_0x2237cf<_0x471de6[_0x32ef('0x35')];_0x2237cf+=0x1){_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x70')]?_0x7b0ea5[_0x471de6[_0x2237cf]['MetricId']]['metric']:_0x471de6[_0x2237cf][_0x32ef('0x71')];_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x72')]?_[_0x32ef('0x73')](_0x3232ca[_0x471de6[_0x2237cf][_0x32ef('0x72')]],'%s',_0x356fd4):_0x356fd4;_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x74')]?_[_0x32ef('0x73')](_0x211fb1[_0x471de6[_0x2237cf][_0x32ef('0x74')]],'%s',_0x356fd4):_0x356fd4;if(_0x471de6[_0x2237cf]['groupBy']){_0x51ca6e[_0x32ef('0x67')](_0x356fd4);}_0x471de6[_0x2237cf][_0x32ef('0x76')]&&_0x51ca6e[_0x32ef('0x38')](_0x356fd4,_0x471de6[_0x2237cf][_0x32ef('0x76')]==='DESC'?![]:!![]);_0x51ca6e['field'](_0x356fd4,_0x471de6[_0x2237cf][_0x32ef('0x78')]||_0x356fd4);}if(_0x5b3deb['joins']){_0x5b3deb[_0x32ef('0x79')]=JSON[_0x32ef('0x7f')](_0x5b3deb['joins']);for(var _0x5c7594=0x0;_0x5c7594<_0x5b3deb['joins'][_0x32ef('0x35')];_0x5c7594+=0x1){if(_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x2f')]&&_[_0x32ef('0x63')](_0x114d8e,_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x2f')])&&_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7a')]&&_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x7b')]&&_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x8e')]){_0x51ca6e[_0x5b3deb[_0x32ef('0x79')][_0x5c7594]['type']](_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x7b')],null,util[_0x32ef('0x74')](_0x32ef('0x7c'),_0x5b3deb[_0x32ef('0x7d')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7a')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7b')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594]['foreignKey']));}}}if(_0x5b3deb[_0x32ef('0x7e')]){_0x5b3deb['conditions']=JSON[_0x32ef('0x7f')](_0x5b3deb[_0x32ef('0x7e')]);_0x51ca6e[_0x32ef('0x3a')](_0x35653b(_0x5b3deb[_0x32ef('0x7e')][_0x32ef('0x67')]));}_0x4baa7a=_0x51ca6e['clone']();_0x51ca6e[_0x32ef('0x1d')](_0x266688);_0x51ca6e[_0x32ef('0x1a')](0x0);return;}})[_0x32ef('0x22')](function(){if(_0x51736f[_0x32ef('0x8f')]===_0x32ef('0x90')){return null;}var _0x1cfdd8=_[_0x32ef('0x3e')](_0x51736f,{'name':_0x51736f[_0x32ef('0x91')]||_0x51736f[_0x32ef('0x2a')]||_0x5b3deb['name'],'basename':_0x5e0b55,'savename':util['format']('%s-%s.%s',_0x51736f[_0x32ef('0x2a')]||_0x5b3deb[_0x32ef('0x2a')],require('randomstring')[_0x32ef('0x92')](0x4),_0x51736f['output']||_0x32ef('0x93')),'reportId':_0x5b3deb['id'],'reportType':'default'});return db['AnalyticExtractedReport'][_0x32ef('0x4c')](_0x1cfdd8,{'raw':!![]});})[_0x32ef('0x22')](function(_0x118d2e){if(_0x5b3deb[_0x32ef('0x7d')]===_0x32ef('0x94')){_0x4baa7a['where'](_0x5b3deb[_0x32ef('0x7d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x51736f[_0x32ef('0x95')],_0x51736f['endDate']);}else{_0x4baa7a['where'](_0x5b3deb['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x51736f['startDate'],_0x51736f[_0x32ef('0x96')]);}if(_0x118d2e){logger[_0x32ef('0x97')]('Run\x20Query:',_0x4baa7a[_0x32ef('0x82')]());require(_0x32ef('0x98'))[_0x32ef('0x99')](path[_0x32ef('0x86')](__dirname,_0x32ef('0x9a'),_0x118d2e[_0x32ef('0x8f')]),[_0x118d2e['id'],_0x4baa7a['toString'](),path[_0x32ef('0x86')](__dirname,'../../files/reports',_0x118d2e[_0x32ef('0x9b')]),_0x5e0b55]);return _0x118d2e;}else{var _0x1be713=squel['select']();_0x1be713[_0x32ef('0x8d')]('('+_0x4baa7a['toString']()+')',_0x32ef('0x9c'));_0x1be713[_0x32ef('0x71')](_0x32ef('0x9d'),_0x32ef('0x1c'));_0x4baa7a['limit'](_0x51736f[_0x32ef('0x1d')]||_0x266688);_0x4baa7a[_0x32ef('0x1a')](_0x51736f[_0x32ef('0x1a')]||0x0);return dbH[_0x32ef('0x83')]['query'](_0x1be713[_0x32ef('0x82')](),{'type':dbH['sequelize'][_0x32ef('0x84')][_0x32ef('0x85')]})[_0x32ef('0x22')](function(_0x28ef17){if(!_0x28ef17[_0x32ef('0x35')]){_0xc43e1=0x0;}else{_0xc43e1=_0x28ef17[0x0][_0x32ef('0x1c')]||0x0;}return dbH['sequelize'][_0x32ef('0x32')](_0x4baa7a['toString'](),{'type':dbH['sequelize'][_0x32ef('0x84')][_0x32ef('0x85')]});})[_0x32ef('0x22')](function(_0x3956e7){return{'rows':_0x3956e7||[],'count':_0xc43e1};});}});}exports['run']=function(_0x8d3b24,_0x642716){return runReport(_0x8d3b24[_0x32ef('0x48')],_0x8d3b24[_0x32ef('0x32')],_0x8d3b24['options'])['then'](respondWithResult(_0x642716,null))['catch'](handleError(_0x642716,null));};exports[_0x32ef('0x9e')]=runReport;exports[_0x32ef('0x32')]=function(_0x4454f3,_0xc92dcc){var _0x3d18b9=0xa;var _0x9233cb=[_0x32ef('0x86'),_0x32ef('0x56'),_0x32ef('0x57'),_0x32ef('0x58')];var _0xa76912={'SUM':'SUM(%s)','COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':_0x32ef('0x5d'),'AVG':_0x32ef('0x5e'),'GROUP_CONCAT':_0x32ef('0x87'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x32ef('0x5f')};var _0x1526a1={'SEC_TO_TIME':_0x32ef('0x89'),'DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':_0x32ef('0x8a')};var _0x2d4d2f=function(_0x292488){return!_[_0x32ef('0x63')]([_0x32ef('0x9f'),_0x32ef('0x8b'),_0x32ef('0x64'),_0x32ef('0xa0')],_0x292488);};var _0x50b674=function(_0x379d40){if(!_0x379d40||!_0x379d40[_0x32ef('0x66')][_0x32ef('0x35')]){return'';}for(var _0x4b7a4d='(',_0x16525b=0x0;_0x16525b<_0x379d40['rules'][_0x32ef('0x35')];_0x16525b+=0x1){_0x16525b>0x0&&(_0x4b7a4d+='\x20'+_0x379d40[_0x32ef('0x65')]+'\x20');_0x4b7a4d+=_0x379d40[_0x32ef('0x66')][_0x16525b]['group']?_0x50b674(_0x379d40[_0x32ef('0x66')][_0x16525b]['group']):_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x71')]+'\x20'+_0x379d40['rules'][_0x16525b][_0x32ef('0x68')]+(_0x2d4d2f(_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x68')])?'\x20'+_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x69')]:'');}return _0x4b7a4d+')';};var _0x264075={'where':{'id':_0x4454f3[_0x32ef('0x48')]['id']}},_0x3798d1,_0x4befa9,_0x493ae9,_0x143d39,_0x497948;_0x264075=_[_0x32ef('0x3e')]({},_0x264075,_0x4454f3['options']);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x264075)['then'](function(_0x1200c9){if(_0x1200c9){_0x3798d1=_0x1200c9;return _0x1200c9[_0x32ef('0x6a')]();}return null;})[_0x32ef('0x22')](function(_0xa5f787){if(_0xa5f787){if(!_0xa5f787[_0x32ef('0x35')]){throw new db['Sequelize'][(_0x32ef('0x6b'))](_0x32ef('0x6c'),0x193);}_0x4befa9=_0xa5f787;return db['AnalyticMetric'][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x55ad11){if(_0x55ad11){_0x493ae9=_[_0x32ef('0x6e')](_0x55ad11,'id');var _0x2971a8;var _0x522c22=squel[_0x32ef('0x6f')]();_0x522c22[_0x32ef('0x8d')](_0x3798d1['table']);for(var _0xb41a01=0x0;_0xb41a01<_0x4befa9[_0x32ef('0x35')];_0xb41a01+=0x1){_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x70')]?_0x493ae9[_0x4befa9[_0xb41a01][_0x32ef('0x70')]][_0x32ef('0xa1')]:_0x4befa9[_0xb41a01][_0x32ef('0x71')];_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x72')]?_['replace'](_0xa76912[_0x4befa9[_0xb41a01]['function']],'%s',_0x2971a8):_0x2971a8;_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x74')]?_[_0x32ef('0x73')](_0x1526a1[_0x4befa9[_0xb41a01][_0x32ef('0x74')]],'%s',_0x2971a8):_0x2971a8;if(_0x4befa9[_0xb41a01]['groupBy']){_0x522c22[_0x32ef('0x67')](_0x2971a8);}_0x4befa9[_0xb41a01][_0x32ef('0x76')]&&_0x522c22['order'](_0x2971a8,_0x4befa9[_0xb41a01][_0x32ef('0x76')]===_0x32ef('0x77')?![]:!![]);_0x522c22['field'](_0x2971a8,_0x4befa9[_0xb41a01]['alias']||_0x2971a8);}if(_0x3798d1[_0x32ef('0x79')]){_0x3798d1[_0x32ef('0x79')]=JSON[_0x32ef('0x7f')](_0x3798d1['joins']);for(var _0x5f4eab=0x0;_0x5f4eab<_0x3798d1['joins'][_0x32ef('0x35')];_0x5f4eab+=0x1){if(_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x2f')]&&_['includes'](_0x9233cb,_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x2f')])&&_0x3798d1[_0x32ef('0x79')][_0x5f4eab]['parentKey']&&_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')]&&_0x3798d1['joins'][_0x5f4eab]['foreignKey']){_0x522c22[_0x3798d1[_0x32ef('0x79')][_0x5f4eab]['type']](_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3798d1[_0x32ef('0x7d')],_0x3798d1['joins'][_0x5f4eab][_0x32ef('0x7a')],_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')],_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x8e')]));}}}if(_0x3798d1[_0x32ef('0x7e')]){_0x3798d1[_0x32ef('0x7e')]=JSON[_0x32ef('0x7f')](_0x3798d1[_0x32ef('0x7e')]);_0x522c22[_0x32ef('0x3a')](_0x50b674(_0x3798d1['conditions']['group']));}_0x497948=_0x522c22[_0x32ef('0x80')]();_0x522c22[_0x32ef('0x1d')](_0x3d18b9);_0x522c22[_0x32ef('0x1a')](0x0);logger[_0x32ef('0x81')](_0x32ef('0xa2'),_0x522c22[_0x32ef('0x82')]());return dbH[_0x32ef('0x83')][_0x32ef('0x32')](_0x522c22[_0x32ef('0x82')](),{'type':dbH[_0x32ef('0x83')]['QueryTypes'][_0x32ef('0x85')]});}})[_0x32ef('0x22')](function(){return{'sql':_0x497948[_0x32ef('0x82')]()};})[_0x32ef('0x22')](respondWithResult(_0xc92dcc,null))[_0x32ef('0x46')](handleError(_0xc92dcc,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 74b0012..e2025d4 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 _0xb222=['analytics_default_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport'];(function(_0x522141,_0x535eb0){var _0x214b97=function(_0x212006){while(--_0x212006){_0x522141['push'](_0x522141['shift']());}};_0x214b97(++_0x535eb0);}(_0xb222,0x11f));var _0x2b22=function(_0x4dc268,_0x3ea099){_0x4dc268=_0x4dc268-0x0;var _0x24799b=_0xb222[_0x4dc268];return _0x24799b;};'use strict';var _=require(_0x2b22('0x0'));var util=require(_0x2b22('0x1'));var logger=require(_0x2b22('0x2'))('api');var moment=require(_0x2b22('0x3'));var BPromise=require(_0x2b22('0x4'));var rp=require(_0x2b22('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2b22('0x6'));var config=require(_0x2b22('0x7'));var attributes=require(_0x2b22('0x8'));module[_0x2b22('0x9')]=function(_0x5d5f26,_0x5a8c8d){return _0x5d5f26[_0x2b22('0xa')](_0x2b22('0xb'),attributes,{'tableName':_0x2b22('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd783=['bluebird','request-promise','path','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','api','moment'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xd783,0xb2));var _0x3d78=function(_0x3c5aa6,_0x4c4f86){_0x3c5aa6=_0x3c5aa6-0x0;var _0x49e397=_0xd783[_0x3c5aa6];return _0x49e397;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3d78('0x0'));var moment=require(_0x3d78('0x1'));var BPromise=require(_0x3d78('0x2'));var rp=require(_0x3d78('0x3'));var fs=require('fs');var path=require(_0x3d78('0x4'));var rimraf=require('rimraf');var config=require(_0x3d78('0x5'));var attributes=require(_0x3d78('0x6'));module[_0x3d78('0x7')]=function(_0x2794f5,_0x15f189){return _0x2794f5['define'](_0x3d78('0x8'),attributes,{'tableName':'analytics_default_reports','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 988665f..ce47d39 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 _0xdcd4=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','AnalyticDefaultReport,\x20%s,\x20%s','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x236ed6,_0x562e24){var _0x2507e4=function(_0x1fdd4b){while(--_0x1fdd4b){_0x236ed6['push'](_0x236ed6['shift']());}};_0x2507e4(++_0x562e24);}(_0xdcd4,0xd7));var _0x4dcd=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xdcd4[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x4dcd('0x0'));var util=require(_0x4dcd('0x1'));var moment=require(_0x4dcd('0x2'));var BPromise=require(_0x4dcd('0x3'));var rs=require(_0x4dcd('0x4'));var fs=require('fs');var Redis=require(_0x4dcd('0x5'));var db=require(_0x4dcd('0x6'))['db'];var utils=require(_0x4dcd('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x4dcd('0x8'));var jayson=require(_0x4dcd('0x9'));var client=jayson[_0x4dcd('0xa')][_0x4dcd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a90ea,_0x33c0bf,_0x4262b3){return new BPromise(function(_0xe31b79,_0x1a9a13){return client[_0x4dcd('0xc')](_0x1a90ea,_0x4262b3)['then'](function(_0x470be1){logger['info'](_0x4dcd('0xd'),_0x33c0bf,'request\x20sent');logger['debug'](_0x4dcd('0xe'),_0x33c0bf,_0x4dcd('0xf'),JSON[_0x4dcd('0x10')](_0x470be1));if(_0x470be1[_0x4dcd('0x11')]){if(_0x470be1[_0x4dcd('0x11')][_0x4dcd('0x12')]===0x1f4){logger['error'](_0x4dcd('0xd'),_0x33c0bf,_0x470be1[_0x4dcd('0x11')][_0x4dcd('0x13')]);return _0x1a9a13(_0x470be1[_0x4dcd('0x11')][_0x4dcd('0x13')]);}logger['error'](_0x4dcd('0xd'),_0x33c0bf,_0x470be1[_0x4dcd('0x11')][_0x4dcd('0x13')]);return _0xe31b79(_0x470be1[_0x4dcd('0x11')][_0x4dcd('0x13')]);}else{logger[_0x4dcd('0x14')](_0x4dcd('0xd'),_0x33c0bf,_0x4dcd('0xf'));_0xe31b79(_0x470be1['result'][_0x4dcd('0x13')]);}})[_0x4dcd('0x15')](function(_0x4b7ce8){logger[_0x4dcd('0x11')](_0x4dcd('0xd'),_0x33c0bf,_0x4b7ce8);_0x1a9a13(_0x4b7ce8);});});} \ No newline at end of file +var _0xd21c=['then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','http','request'];(function(_0x4f14cb,_0x26d0b5){var _0x399057=function(_0x4672a9){while(--_0x4672a9){_0x4f14cb['push'](_0x4f14cb['shift']());}};_0x399057(++_0x26d0b5);}(_0xd21c,0x101));var _0xcd21=function(_0x45bc6a,_0x301e14){_0x45bc6a=_0x45bc6a-0x0;var _0x171a81=_0xd21c[_0x45bc6a];return _0x171a81;};'use strict';var _=require(_0xcd21('0x0'));var util=require(_0xcd21('0x1'));var moment=require(_0xcd21('0x2'));var BPromise=require(_0xcd21('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcd21('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcd21('0x5'))('rpc');var config=require(_0xcd21('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcd21('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x391944,_0x2ecae8,_0x17ed77){return new BPromise(function(_0x335ca3,_0x1b5fef){return client[_0xcd21('0x8')](_0x391944,_0x17ed77)[_0xcd21('0x9')](function(_0x49b918){logger[_0xcd21('0xa')](_0xcd21('0xb'),_0x2ecae8,_0xcd21('0xc'));logger['debug']('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x2ecae8,'request\x20sent',JSON[_0xcd21('0xd')](_0x49b918));if(_0x49b918[_0xcd21('0xe')]){if(_0x49b918[_0xcd21('0xe')][_0xcd21('0xf')]===0x1f4){logger[_0xcd21('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2ecae8,_0x49b918[_0xcd21('0xe')][_0xcd21('0x10')]);return _0x1b5fef(_0x49b918[_0xcd21('0xe')][_0xcd21('0x10')]);}logger[_0xcd21('0xe')](_0xcd21('0xb'),_0x2ecae8,_0x49b918[_0xcd21('0xe')][_0xcd21('0x10')]);return _0x335ca3(_0x49b918[_0xcd21('0xe')][_0xcd21('0x10')]);}else{logger[_0xcd21('0xa')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2ecae8,_0xcd21('0xc'));_0x335ca3(_0x49b918[_0xcd21('0x11')][_0xcd21('0x10')]);}})[_0xcd21('0x12')](function(_0x326662){logger[_0xcd21('0xe')](_0xcd21('0xb'),_0x2ecae8,_0x326662);_0x1b5fef(_0x326662);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 8bcc299..0b7b8f2 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 _0x644f=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/preview','/:id/run','run','create','put','update','delete','/:id','util','path','connect-timeout'];(function(_0x2e04ef,_0x31a596){var _0x5722b0=function(_0x386fbd){while(--_0x386fbd){_0x2e04ef['push'](_0x2e04ef['shift']());}};_0x5722b0(++_0x31a596);}(_0x644f,0x177));var _0xf644=function(_0x20cc29,_0x30a46d){_0x20cc29=_0x20cc29-0x0;var _0x28d513=_0x644f[_0x20cc29];return _0x28d513;};'use strict';var multer=require('multer');var util=require(_0xf644('0x0'));var path=require(_0xf644('0x1'));var timeout=require(_0xf644('0x2'));var express=require(_0xf644('0x3'));var router=express[_0xf644('0x4')]();var fs_extra=require(_0xf644('0x5'));var auth=require(_0xf644('0x6'));var interaction=require(_0xf644('0x7'));var config=require(_0xf644('0x8'));var controller=require('./analyticDefaultReport.controller');router['get']('/',auth[_0xf644('0x9')](),controller[_0xf644('0xa')]);router[_0xf644('0xb')]('/:id',auth[_0xf644('0x9')](),controller[_0xf644('0xc')]);router[_0xf644('0xb')](_0xf644('0xd'),auth[_0xf644('0x9')](),controller['preview']);router[_0xf644('0xb')](_0xf644('0xe'),auth[_0xf644('0x9')](),controller[_0xf644('0xf')]);router['get']('/:id/query',auth[_0xf644('0x9')](),controller['query']);router['post']('/',auth[_0xf644('0x9')](),controller[_0xf644('0x10')]);router[_0xf644('0x11')]('/:id',auth[_0xf644('0x9')](),controller[_0xf644('0x12')]);router[_0xf644('0x13')](_0xf644('0x14'),auth[_0xf644('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa337=['/:id/run','run','/:id/query','post','/:id','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','show','/:id/preview'];(function(_0x28eab5,_0x3f6403){var _0x1be3c0=function(_0x347bea){while(--_0x347bea){_0x28eab5['push'](_0x28eab5['shift']());}};_0x1be3c0(++_0x3f6403);}(_0xa337,0x7f));var _0x7a33=function(_0x245164,_0x1a9842){_0x245164=_0x245164-0x0;var _0x2de85c=_0xa337[_0x245164];return _0x2de85c;};'use strict';var multer=require(_0x7a33('0x0'));var util=require('util');var path=require(_0x7a33('0x1'));var timeout=require('connect-timeout');var express=require(_0x7a33('0x2'));var router=express['Router']();var fs_extra=require(_0x7a33('0x3'));var auth=require(_0x7a33('0x4'));var interaction=require(_0x7a33('0x5'));var config=require(_0x7a33('0x6'));var controller=require(_0x7a33('0x7'));router[_0x7a33('0x8')]('/',auth[_0x7a33('0x9')](),controller[_0x7a33('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x7a33('0xb')]);router['get'](_0x7a33('0xc'),auth[_0x7a33('0x9')](),controller['preview']);router[_0x7a33('0x8')](_0x7a33('0xd'),auth['isAuthenticated'](),controller[_0x7a33('0xe')]);router[_0x7a33('0x8')](_0x7a33('0xf'),auth[_0x7a33('0x9')](),controller['query']);router[_0x7a33('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x7a33('0x11'),auth[_0x7a33('0x9')](),controller['update']);router['delete'](_0x7a33('0x11'),auth[_0x7a33('0x9')](),controller[_0x7a33('0x12')]);module[_0x7a33('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index ea865c5..ad2031e 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 _0xd6f0=['STRING','ENUM','csv','pdf','DATE','manual','scheduled','INTEGER','sequelize'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xd6f0,0xd7));var _0x0d6f=function(_0x2e8a70,_0x43d2b0){_0x2e8a70=_0x2e8a70-0x0;var _0x1ffcdf=_0xd6f0[_0x2e8a70];return _0x1ffcdf;};'use strict';var Sequelize=require(_0x0d6f('0x0'));var moment=require('moment');module['exports']={'name':{'type':Sequelize[_0x0d6f('0x1')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x0d6f('0x2')](_0x0d6f('0x3'),_0x0d6f('0x4'),'xlsx'),'allowNull':![],'defaultValue':_0x0d6f('0x3')},'savename':{'type':Sequelize[_0x0d6f('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x0d6f('0x5')]},'endDate':{'type':Sequelize[_0x0d6f('0x5')]},'status':{'type':Sequelize[_0x0d6f('0x1')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x0d6f('0x2')](_0x0d6f('0x6'),_0x0d6f('0x7')),'allowNull':![],'defaultValue':_0x0d6f('0x6')},'reportId':{'type':Sequelize[_0x0d6f('0x8')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcebe=['csv','xlsx','DATE','Loading','manual','scheduled','UNSIGNED','sequelize','moment','exports','STRING','ENUM'];(function(_0x456a4b,_0x51df8){var _0x42957c=function(_0x431de8){while(--_0x431de8){_0x456a4b['push'](_0x456a4b['shift']());}};_0x42957c(++_0x51df8);}(_0xcebe,0xc7));var _0xeceb=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xcebe[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0xeceb('0x0'));var moment=require(_0xeceb('0x1'));module[_0xeceb('0x2')]={'name':{'type':Sequelize[_0xeceb('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xeceb('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xeceb('0x4')](_0xeceb('0x5'),'pdf',_0xeceb('0x6')),'allowNull':![],'defaultValue':_0xeceb('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xeceb('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0xeceb('0x8')},'type':{'type':Sequelize[_0xeceb('0x4')](_0xeceb('0x9'),_0xeceb('0xa')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xeceb('0xb')]},'reportType':{'type':Sequelize[_0xeceb('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 532a611..6fe78f9 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 _0x34d4=['catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','download','basename','savename','output','existsSync','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join','format','%s.%s','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','get','ExtractedReports','error','stack','name','send','index','map','AnalyticExtractedReport','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','params','keys','rawAttributes','find'];(function(_0x308374,_0x550e85){var _0x1f71e0=function(_0x18377d){while(--_0x18377d){_0x308374['push'](_0x308374['shift']());}};_0x1f71e0(++_0x550e85);}(_0x34d4,0x199));var _0x434d=function(_0x49577e,_0x444992){_0x49577e=_0x49577e-0x0;var _0x57aec6=_0x34d4[_0x49577e];return _0x57aec6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x434d('0x0'));var zipdir=require(_0x434d('0x1'));var jsonpatch=require(_0x434d('0x2'));var rp=require('request-promise');var moment=require(_0x434d('0x3'));var BPromise=require(_0x434d('0x4'));var Mustache=require(_0x434d('0x5'));var util=require(_0x434d('0x6'));var path=require('path');var sox=require(_0x434d('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x434d('0x8'));var _=require(_0x434d('0x9'));var squel=require(_0x434d('0xa'));var crypto=require(_0x434d('0xb'));var jsforce=require(_0x434d('0xc'));var deskjs=require(_0x434d('0xd'));var toCsv=require(_0x434d('0xe'));var querystring=require(_0x434d('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x434d('0x10'));var as=require(_0x434d('0x11'));var hardwareService=require(_0x434d('0x12'));var logger=require(_0x434d('0x13'))(_0x434d('0x14'));var utils=require(_0x434d('0x15'));var config=require(_0x434d('0x16'));var licenseUtil=require(_0x434d('0x17'));var db=require(_0x434d('0x18'))['db'];function respondWithStatusCode(_0x3f66c4,_0x435179){_0x435179=_0x435179||0xcc;return function(_0x170623){if(_0x170623){return _0x3f66c4[_0x434d('0x19')](_0x435179);}return _0x3f66c4['status'](_0x435179)[_0x434d('0x1a')]();};}function respondWithResult(_0x2f8f1f,_0x1cb623){_0x1cb623=_0x1cb623||0xc8;return function(_0x52cd71){if(_0x52cd71){return _0x2f8f1f[_0x434d('0x1b')](_0x1cb623)['json'](_0x52cd71);}};}function respondWithFilteredResult(_0x1c45fc,_0x1eda70){return function(_0x272cb3){if(_0x272cb3){var _0x301bea=typeof _0x1eda70[_0x434d('0x1c')]===_0x434d('0x1d')&&typeof _0x1eda70['limit']===_0x434d('0x1d');var _0x220ad6=_0x272cb3[_0x434d('0x1e')];var _0x270771=_0x301bea?0x0:_0x1eda70[_0x434d('0x1c')];var _0xb738c5=_0x301bea?_0x272cb3[_0x434d('0x1e')]:_0x1eda70[_0x434d('0x1c')]+_0x1eda70[_0x434d('0x1f')];var _0x436592;if(_0xb738c5>=_0x220ad6){_0xb738c5=_0x220ad6;_0x436592=0xc8;}else{_0x436592=0xce;}_0x1c45fc[_0x434d('0x1b')](_0x436592);return _0x1c45fc[_0x434d('0x20')](_0x434d('0x21'),_0x270771+'-'+_0xb738c5+'/'+_0x220ad6)['json'](_0x272cb3);}return null;};}function patchUpdates(_0x39822c){return function(_0x329bd3){try{jsonpatch[_0x434d('0x22')](_0x329bd3,_0x39822c,!![]);}catch(_0x505a88){return BPromise[_0x434d('0x23')](_0x505a88);}return _0x329bd3['save']();};}function saveUpdates(_0x21d30f,_0x47e98a){return function(_0x974b18){if(_0x974b18){return _0x974b18['update'](_0x21d30f)[_0x434d('0x24')](function(_0x59be8e){return _0x59be8e;});}return null;};}function removeEntity(_0x548c19,_0x3a07ee){return function(_0x34c782){if(_0x34c782){return _0x34c782[_0x434d('0x25')]()[_0x434d('0x24')](function(){var _0x24aa25=_0x34c782[_0x434d('0x26')]({'plain':!![]});var _0x291f94=_0x434d('0x27');return db['UserProfileResource'][_0x434d('0x25')]({'where':{'type':_0x291f94,'resourceId':_0x24aa25['id']}})[_0x434d('0x24')](function(){return _0x34c782;});})[_0x434d('0x24')](function(){_0x548c19[_0x434d('0x1b')](0xcc)[_0x434d('0x1a')]();});}};}function handleEntityNotFound(_0xbe7a33,_0x57dce3){return function(_0x32e6a8){if(!_0x32e6a8){_0xbe7a33['sendStatus'](0x194);}return _0x32e6a8;};}function handleError(_0x2af2bc,_0xd8bfce){_0xd8bfce=_0xd8bfce||0x1f4;return function(_0x5def06){logger[_0x434d('0x28')](_0x5def06[_0x434d('0x29')]);if(_0x5def06['name']){delete _0x5def06[_0x434d('0x2a')];}_0x2af2bc[_0x434d('0x1b')](_0xd8bfce)[_0x434d('0x2b')](_0x5def06);};}exports[_0x434d('0x2c')]=function(_0x325010,_0x449032){var _0x499bb7={},_0x50f373={},_0x8cfcd2={'count':0x0,'rows':[]};var _0x51bf0f=_[_0x434d('0x2d')](db[_0x434d('0x2e')]['rawAttributes'],function(_0x5bd5f5){return{'name':_0x5bd5f5['fieldName'],'type':_0x5bd5f5[_0x434d('0x2f')][_0x434d('0x30')]};});_0x50f373[_0x434d('0x31')]=_['map'](_0x51bf0f,'name');_0x50f373['query']=_['keys'](_0x325010[_0x434d('0x32')]);_0x50f373[_0x434d('0x33')]=_[_0x434d('0x34')](_0x50f373[_0x434d('0x31')],_0x50f373[_0x434d('0x32')]);_0x499bb7[_0x434d('0x35')]=_[_0x434d('0x34')](_0x50f373[_0x434d('0x31')],qs[_0x434d('0x36')](_0x325010[_0x434d('0x32')][_0x434d('0x36')]));_0x499bb7[_0x434d('0x35')]=_0x499bb7['attributes'][_0x434d('0x37')]?_0x499bb7[_0x434d('0x35')]:_0x50f373['model'];if(!_0x325010['query'][_0x434d('0x38')](_0x434d('0x39'))){_0x499bb7[_0x434d('0x1f')]=qs[_0x434d('0x1f')](_0x325010[_0x434d('0x32')][_0x434d('0x1f')]);_0x499bb7[_0x434d('0x1c')]=qs['offset'](_0x325010[_0x434d('0x32')][_0x434d('0x1c')]);}_0x499bb7[_0x434d('0x3a')]=qs[_0x434d('0x3b')](_0x325010['query'][_0x434d('0x3b')]);_0x499bb7[_0x434d('0x3c')]=qs[_0x434d('0x33')](_['pick'](_0x325010[_0x434d('0x32')],_0x50f373['filters']),_0x51bf0f);if(_0x325010['query']['filter']){_0x499bb7[_0x434d('0x3c')]=_[_0x434d('0x3d')](_0x499bb7[_0x434d('0x3c')],{'$or':_[_0x434d('0x2d')](_0x51bf0f,function(_0x4effac){if(_0x4effac[_0x434d('0x2f')]!==_0x434d('0x3e')){var _0x3259ab={};_0x3259ab[_0x4effac[_0x434d('0x2a')]]={'$like':'%'+_0x325010[_0x434d('0x32')][_0x434d('0x3f')]+'%'};return _0x3259ab;}})});}_0x499bb7=_[_0x434d('0x3d')]({},_0x499bb7,_0x325010[_0x434d('0x40')]);var _0x328fe5={'where':_0x499bb7[_0x434d('0x3c')]};return db[_0x434d('0x2e')][_0x434d('0x1e')](_0x328fe5)['then'](function(_0x2ccad3){_0x8cfcd2[_0x434d('0x1e')]=_0x2ccad3;if(_0x325010[_0x434d('0x32')][_0x434d('0x41')]){_0x499bb7[_0x434d('0x42')]=[{'all':!![]}];}return db[_0x434d('0x2e')]['findAll'](_0x499bb7);})[_0x434d('0x24')](function(_0x24029f){_0x8cfcd2['rows']=_0x24029f;return _0x8cfcd2;})[_0x434d('0x24')](respondWithFilteredResult(_0x449032,_0x499bb7))['catch'](handleError(_0x449032,null));};exports['show']=function(_0xf72e37,_0x50207b){var _0x522dfd={'raw':!![],'where':{'id':_0xf72e37[_0x434d('0x43')]['id']}},_0x48f65c={};_0x48f65c['model']=_[_0x434d('0x44')](db[_0x434d('0x2e')][_0x434d('0x45')]);_0x48f65c[_0x434d('0x32')]=_[_0x434d('0x44')](_0xf72e37[_0x434d('0x32')]);_0x48f65c[_0x434d('0x33')]=_[_0x434d('0x34')](_0x48f65c['model'],_0x48f65c[_0x434d('0x32')]);_0x522dfd[_0x434d('0x35')]=_[_0x434d('0x34')](_0x48f65c[_0x434d('0x31')],qs[_0x434d('0x36')](_0xf72e37[_0x434d('0x32')][_0x434d('0x36')]));_0x522dfd[_0x434d('0x35')]=_0x522dfd[_0x434d('0x35')][_0x434d('0x37')]?_0x522dfd[_0x434d('0x35')]:_0x48f65c['model'];if(_0xf72e37[_0x434d('0x32')][_0x434d('0x41')]){_0x522dfd[_0x434d('0x42')]=[{'all':!![]}];}_0x522dfd=_[_0x434d('0x3d')]({},_0x522dfd,_0xf72e37['options']);return db['AnalyticExtractedReport'][_0x434d('0x46')](_0x522dfd)['then'](handleEntityNotFound(_0x50207b,null))[_0x434d('0x24')](respondWithResult(_0x50207b,null))[_0x434d('0x47')](handleError(_0x50207b,null));};exports['create']=function(_0x471ed3,_0x20d98c){return db[_0x434d('0x2e')][_0x434d('0x48')](_0x471ed3[_0x434d('0x49')],{})[_0x434d('0x24')](function(_0x23d0ac){var _0xafd768=_0x471ed3['user']['get']({'plain':!![]});if(!_0xafd768)throw new Error(_0x434d('0x4a'));if(_0xafd768[_0x434d('0x4b')]===_0x434d('0x4c')){var _0x2179af=_0x23d0ac[_0x434d('0x26')]({'plain':!![]});var _0x22746d=_0x434d('0x27');return db[_0x434d('0x4d')][_0x434d('0x46')]({'where':{'name':_0x22746d,'userProfileId':_0xafd768[_0x434d('0x4e')]},'raw':!![]})[_0x434d('0x24')](function(_0x5ef567){if(_0x5ef567&&_0x5ef567['autoAssociation']===0x0){return db[_0x434d('0x4f')][_0x434d('0x48')]({'name':_0x2179af['name'],'resourceId':_0x2179af['id'],'type':_0x5ef567['name'],'sectionId':_0x5ef567['id']},{})[_0x434d('0x24')](function(){return _0x23d0ac;});}else{return _0x23d0ac;}})[_0x434d('0x47')](function(_0x3da46c){logger[_0x434d('0x28')](_0x434d('0x50'),_0x3da46c);throw _0x3da46c;});}return _0x23d0ac;})[_0x434d('0x24')](respondWithResult(_0x20d98c,0xc9))[_0x434d('0x47')](handleError(_0x20d98c,null));};exports[_0x434d('0x51')]=function(_0xea0769,_0x504e51){if(_0xea0769[_0x434d('0x49')]['id']){delete _0xea0769[_0x434d('0x49')]['id'];}return db['AnalyticExtractedReport'][_0x434d('0x46')]({'where':{'id':_0xea0769[_0x434d('0x43')]['id']}})[_0x434d('0x24')](handleEntityNotFound(_0x504e51,null))['then'](saveUpdates(_0xea0769[_0x434d('0x49')],null))[_0x434d('0x24')](respondWithResult(_0x504e51,null))[_0x434d('0x47')](handleError(_0x504e51,null));};exports[_0x434d('0x25')]=function(_0x205473,_0x1d932e){return db[_0x434d('0x2e')][_0x434d('0x46')]({'where':{'id':_0x205473['params']['id']}})[_0x434d('0x24')](handleEntityNotFound(_0x1d932e,null))[_0x434d('0x24')](removeEntity(_0x1d932e,null))['catch'](handleError(_0x1d932e,null));};exports[_0x434d('0x52')]=function(_0x482e12,_0x3a31ed,_0x15d1b9){return db['AnalyticExtractedReport'][_0x434d('0x46')]({'where':{'id':_0x482e12[_0x434d('0x43')]['id']},'attributes':[_0x434d('0x2a'),_0x434d('0x53'),_0x434d('0x54'),_0x434d('0x55')],'raw':!![]})['then'](handleEntityNotFound(_0x3a31ed,null))[_0x434d('0x24')](function(_0x368178){if(_0x368178){if(!fs[_0x434d('0x56')](path['join'](config[_0x434d('0x57')],_0x434d('0x58'),_0x368178['savename']))){throw new db[(_0x434d('0x59'))][(_0x434d('0x5a'))](_0x434d('0x5b'));}if(_0x482e12[_0x434d('0x32')][_0x434d('0x5c')]){return _0x3a31ed[_0x434d('0x19')](0xc8);}return _0x3a31ed[_0x434d('0x52')](path[_0x434d('0x5d')](config['root'],'server/files/reports',_0x368178[_0x434d('0x54')]),util[_0x434d('0x5e')](_0x434d('0x5f'),_0x368178['basename']||_0x368178['name'],_0x368178['output']['toLowerCase']()));}})['catch'](handleError(_0x3a31ed,null));}; \ No newline at end of file +var _0xc4b0=['filter','options','includeAll','findAll','rows','show','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','basename','savename','existsSync','join','root','server/files/reports','Sequelize','ValidationError','exists','format','%s.%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','json','undefined','count','offset','limit','set','update','then','get','ExtractedReports','UserProfileResource','destroy','end','sendStatus','stack','name','send','map','AnalyticExtractedReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge'];(function(_0x597e54,_0x4bd022){var _0x1bfeb2=function(_0x1c4ce8){while(--_0x1c4ce8){_0x597e54['push'](_0x597e54['shift']());}};_0x1bfeb2(++_0x4bd022);}(_0xc4b0,0x125));var _0x0c4b=function(_0x3f23d9,_0x4f118e){_0x3f23d9=_0x3f23d9-0x0;var _0x5f15be=_0xc4b0[_0x3f23d9];return _0x5f15be;};'use strict';var emlformat=require(_0x0c4b('0x0'));var rimraf=require(_0x0c4b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c4b('0x2'));var rp=require(_0x0c4b('0x3'));var moment=require(_0x0c4b('0x4'));var BPromise=require(_0x0c4b('0x5'));var Mustache=require(_0x0c4b('0x6'));var util=require('util');var path=require(_0x0c4b('0x7'));var sox=require(_0x0c4b('0x8'));var csv=require(_0x0c4b('0x9'));var ejs=require(_0x0c4b('0xa'));var fs=require('fs');var fs_extra=require(_0x0c4b('0xb'));var _=require('lodash');var squel=require(_0x0c4b('0xc'));var crypto=require('crypto');var jsforce=require(_0x0c4b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0c4b('0x9'));var querystring=require(_0x0c4b('0xe'));var Papa=require(_0x0c4b('0xf'));var Redis=require(_0x0c4b('0x10'));var authService=require(_0x0c4b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0c4b('0x12'));var hardwareService=require(_0x0c4b('0x13'));var logger=require('../../config/logger')(_0x0c4b('0x14'));var utils=require(_0x0c4b('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0c4b('0x16'))['db'];function respondWithStatusCode(_0x5de9c0,_0x48fbd9){_0x48fbd9=_0x48fbd9||0xcc;return function(_0x27baca){if(_0x27baca){return _0x5de9c0['sendStatus'](_0x48fbd9);}return _0x5de9c0[_0x0c4b('0x17')](_0x48fbd9)['end']();};}function respondWithResult(_0x2197a5,_0x4b002a){_0x4b002a=_0x4b002a||0xc8;return function(_0x431a71){if(_0x431a71){return _0x2197a5[_0x0c4b('0x17')](_0x4b002a)[_0x0c4b('0x18')](_0x431a71);}};}function respondWithFilteredResult(_0x2783ff,_0x507667){return function(_0x193fb8){if(_0x193fb8){var _0x926317=typeof _0x507667['offset']===_0x0c4b('0x19')&&typeof _0x507667['limit']==='undefined';var _0x3b80ef=_0x193fb8[_0x0c4b('0x1a')];var _0x4e8cb0=_0x926317?0x0:_0x507667['offset'];var _0x50eb2a=_0x926317?_0x193fb8[_0x0c4b('0x1a')]:_0x507667[_0x0c4b('0x1b')]+_0x507667[_0x0c4b('0x1c')];var _0x155a6b;if(_0x50eb2a>=_0x3b80ef){_0x50eb2a=_0x3b80ef;_0x155a6b=0xc8;}else{_0x155a6b=0xce;}_0x2783ff[_0x0c4b('0x17')](_0x155a6b);return _0x2783ff[_0x0c4b('0x1d')]('Content-Range',_0x4e8cb0+'-'+_0x50eb2a+'/'+_0x3b80ef)[_0x0c4b('0x18')](_0x193fb8);}return null;};}function patchUpdates(_0x961c21){return function(_0x21ea46){try{jsonpatch['apply'](_0x21ea46,_0x961c21,!![]);}catch(_0x2cd71e){return BPromise['reject'](_0x2cd71e);}return _0x21ea46['save']();};}function saveUpdates(_0x111f54,_0x4e5b54){return function(_0x3c674f){if(_0x3c674f){return _0x3c674f[_0x0c4b('0x1e')](_0x111f54)[_0x0c4b('0x1f')](function(_0xefccf0){return _0xefccf0;});}return null;};}function removeEntity(_0x16bca5,_0x30a8e8){return function(_0x396c2e){if(_0x396c2e){return _0x396c2e['destroy']()['then'](function(){var _0x5a7d42=_0x396c2e[_0x0c4b('0x20')]({'plain':!![]});var _0x1312ed=_0x0c4b('0x21');return db[_0x0c4b('0x22')][_0x0c4b('0x23')]({'where':{'type':_0x1312ed,'resourceId':_0x5a7d42['id']}})['then'](function(){return _0x396c2e;});})[_0x0c4b('0x1f')](function(){_0x16bca5[_0x0c4b('0x17')](0xcc)[_0x0c4b('0x24')]();});}};}function handleEntityNotFound(_0x3e0948,_0x2f40b7){return function(_0x4841a5){if(!_0x4841a5){_0x3e0948[_0x0c4b('0x25')](0x194);}return _0x4841a5;};}function handleError(_0x3d55cd,_0x264eb3){_0x264eb3=_0x264eb3||0x1f4;return function(_0x4dbbea){logger['error'](_0x4dbbea[_0x0c4b('0x26')]);if(_0x4dbbea['name']){delete _0x4dbbea[_0x0c4b('0x27')];}_0x3d55cd[_0x0c4b('0x17')](_0x264eb3)[_0x0c4b('0x28')](_0x4dbbea);};}exports['index']=function(_0x2ea317,_0x1239d0){var _0x495a76={},_0x45d122={},_0xfa1dcf={'count':0x0,'rows':[]};var _0x56d7a1=_[_0x0c4b('0x29')](db[_0x0c4b('0x2a')][_0x0c4b('0x2b')],function(_0xf3172c){return{'name':_0xf3172c['fieldName'],'type':_0xf3172c[_0x0c4b('0x2c')]['key']};});_0x45d122[_0x0c4b('0x2d')]=_[_0x0c4b('0x29')](_0x56d7a1,'name');_0x45d122[_0x0c4b('0x2e')]=_[_0x0c4b('0x2f')](_0x2ea317['query']);_0x45d122[_0x0c4b('0x30')]=_[_0x0c4b('0x31')](_0x45d122['model'],_0x45d122[_0x0c4b('0x2e')]);_0x495a76[_0x0c4b('0x32')]=_[_0x0c4b('0x31')](_0x45d122[_0x0c4b('0x2d')],qs[_0x0c4b('0x33')](_0x2ea317[_0x0c4b('0x2e')][_0x0c4b('0x33')]));_0x495a76['attributes']=_0x495a76[_0x0c4b('0x32')][_0x0c4b('0x34')]?_0x495a76[_0x0c4b('0x32')]:_0x45d122[_0x0c4b('0x2d')];if(!_0x2ea317['query'][_0x0c4b('0x35')](_0x0c4b('0x36'))){_0x495a76['limit']=qs[_0x0c4b('0x1c')](_0x2ea317[_0x0c4b('0x2e')][_0x0c4b('0x1c')]);_0x495a76[_0x0c4b('0x1b')]=qs[_0x0c4b('0x1b')](_0x2ea317[_0x0c4b('0x2e')]['offset']);}_0x495a76[_0x0c4b('0x37')]=qs[_0x0c4b('0x38')](_0x2ea317[_0x0c4b('0x2e')]['sort']);_0x495a76[_0x0c4b('0x39')]=qs[_0x0c4b('0x30')](_['pick'](_0x2ea317[_0x0c4b('0x2e')],_0x45d122[_0x0c4b('0x30')]),_0x56d7a1);if(_0x2ea317[_0x0c4b('0x2e')]['filter']){_0x495a76[_0x0c4b('0x39')]=_[_0x0c4b('0x3a')](_0x495a76[_0x0c4b('0x39')],{'$or':_['map'](_0x56d7a1,function(_0x3f4403){if(_0x3f4403[_0x0c4b('0x2c')]!=='VIRTUAL'){var _0x491e11={};_0x491e11[_0x3f4403['name']]={'$like':'%'+_0x2ea317[_0x0c4b('0x2e')][_0x0c4b('0x3b')]+'%'};return _0x491e11;}})});}_0x495a76=_[_0x0c4b('0x3a')]({},_0x495a76,_0x2ea317[_0x0c4b('0x3c')]);var _0x4bafe7={'where':_0x495a76['where']};return db[_0x0c4b('0x2a')]['count'](_0x4bafe7)[_0x0c4b('0x1f')](function(_0x102d21){_0xfa1dcf['count']=_0x102d21;if(_0x2ea317[_0x0c4b('0x2e')][_0x0c4b('0x3d')]){_0x495a76['include']=[{'all':!![]}];}return db[_0x0c4b('0x2a')][_0x0c4b('0x3e')](_0x495a76);})[_0x0c4b('0x1f')](function(_0x3dcd23){_0xfa1dcf[_0x0c4b('0x3f')]=_0x3dcd23;return _0xfa1dcf;})['then'](respondWithFilteredResult(_0x1239d0,_0x495a76))['catch'](handleError(_0x1239d0,null));};exports[_0x0c4b('0x40')]=function(_0x1b23f8,_0x55b84f){var _0x173b0a={'raw':!![],'where':{'id':_0x1b23f8[_0x0c4b('0x41')]['id']}},_0x464e45={};_0x464e45[_0x0c4b('0x2d')]=_['keys'](db['AnalyticExtractedReport'][_0x0c4b('0x2b')]);_0x464e45[_0x0c4b('0x2e')]=_[_0x0c4b('0x2f')](_0x1b23f8['query']);_0x464e45[_0x0c4b('0x30')]=_['intersection'](_0x464e45[_0x0c4b('0x2d')],_0x464e45[_0x0c4b('0x2e')]);_0x173b0a[_0x0c4b('0x32')]=_[_0x0c4b('0x31')](_0x464e45[_0x0c4b('0x2d')],qs['fields'](_0x1b23f8[_0x0c4b('0x2e')][_0x0c4b('0x33')]));_0x173b0a[_0x0c4b('0x32')]=_0x173b0a[_0x0c4b('0x32')][_0x0c4b('0x34')]?_0x173b0a[_0x0c4b('0x32')]:_0x464e45[_0x0c4b('0x2d')];if(_0x1b23f8['query'][_0x0c4b('0x3d')]){_0x173b0a['include']=[{'all':!![]}];}_0x173b0a=_[_0x0c4b('0x3a')]({},_0x173b0a,_0x1b23f8[_0x0c4b('0x3c')]);return db[_0x0c4b('0x2a')]['find'](_0x173b0a)[_0x0c4b('0x1f')](handleEntityNotFound(_0x55b84f,null))[_0x0c4b('0x1f')](respondWithResult(_0x55b84f,null))[_0x0c4b('0x42')](handleError(_0x55b84f,null));};exports['create']=function(_0x147b9a,_0x36b27e){return db[_0x0c4b('0x2a')][_0x0c4b('0x43')](_0x147b9a[_0x0c4b('0x44')],{})[_0x0c4b('0x1f')](function(_0x1ca0fe){var _0x3ce778=_0x147b9a[_0x0c4b('0x45')][_0x0c4b('0x20')]({'plain':!![]});if(!_0x3ce778)throw new Error(_0x0c4b('0x46'));if(_0x3ce778[_0x0c4b('0x47')]==='user'){var _0x522fe2=_0x1ca0fe['get']({'plain':!![]});var _0x5b496e=_0x0c4b('0x21');return db[_0x0c4b('0x48')][_0x0c4b('0x49')]({'where':{'name':_0x5b496e,'userProfileId':_0x3ce778[_0x0c4b('0x4a')]},'raw':!![]})[_0x0c4b('0x1f')](function(_0x345e2a){if(_0x345e2a&&_0x345e2a[_0x0c4b('0x4b')]===0x0){return db[_0x0c4b('0x22')][_0x0c4b('0x43')]({'name':_0x522fe2[_0x0c4b('0x27')],'resourceId':_0x522fe2['id'],'type':_0x345e2a[_0x0c4b('0x27')],'sectionId':_0x345e2a['id']},{})['then'](function(){return _0x1ca0fe;});}else{return _0x1ca0fe;}})['catch'](function(_0x192f05){logger[_0x0c4b('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x192f05);throw _0x192f05;});}return _0x1ca0fe;})[_0x0c4b('0x1f')](respondWithResult(_0x36b27e,0xc9))['catch'](handleError(_0x36b27e,null));};exports['update']=function(_0x24bbbb,_0x2aaa99){if(_0x24bbbb[_0x0c4b('0x44')]['id']){delete _0x24bbbb['body']['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x24bbbb[_0x0c4b('0x41')]['id']}})[_0x0c4b('0x1f')](handleEntityNotFound(_0x2aaa99,null))['then'](saveUpdates(_0x24bbbb[_0x0c4b('0x44')],null))[_0x0c4b('0x1f')](respondWithResult(_0x2aaa99,null))[_0x0c4b('0x42')](handleError(_0x2aaa99,null));};exports['destroy']=function(_0x361791,_0x302092){return db[_0x0c4b('0x2a')][_0x0c4b('0x49')]({'where':{'id':_0x361791[_0x0c4b('0x41')]['id']}})[_0x0c4b('0x1f')](handleEntityNotFound(_0x302092,null))[_0x0c4b('0x1f')](removeEntity(_0x302092,null))[_0x0c4b('0x42')](handleError(_0x302092,null));};exports['download']=function(_0x44f02d,_0x53882f,_0x5c70fe){return db[_0x0c4b('0x2a')][_0x0c4b('0x49')]({'where':{'id':_0x44f02d[_0x0c4b('0x41')]['id']},'attributes':[_0x0c4b('0x27'),_0x0c4b('0x4d'),_0x0c4b('0x4e'),'output'],'raw':!![]})[_0x0c4b('0x1f')](handleEntityNotFound(_0x53882f,null))['then'](function(_0x54aa63){if(_0x54aa63){if(!fs[_0x0c4b('0x4f')](path[_0x0c4b('0x50')](config[_0x0c4b('0x51')],_0x0c4b('0x52'),_0x54aa63['savename']))){throw new db[(_0x0c4b('0x53'))][(_0x0c4b('0x54'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x44f02d[_0x0c4b('0x2e')][_0x0c4b('0x55')]){return _0x53882f['sendStatus'](0xc8);}return _0x53882f['download'](path[_0x0c4b('0x50')](config[_0x0c4b('0x51')],_0x0c4b('0x52'),_0x54aa63[_0x0c4b('0x4e')]),util[_0x0c4b('0x56')](_0x0c4b('0x57'),_0x54aa63[_0x0c4b('0x4d')]||_0x54aa63[_0x0c4b('0x27')],_0x54aa63['output']['toLowerCase']()));}})[_0x0c4b('0x42')](handleError(_0x53882f,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 3a2c1ba..8bc2901 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 _0x1ca6=['./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','util','api','moment','path','rimraf','../../config/environment'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x1ca6,0x1c6));var _0x61ca=function(_0x20f9a9,_0x1536e6){_0x20f9a9=_0x20f9a9-0x0;var _0x273941=_0x1ca6[_0x20f9a9];return _0x273941;};'use strict';var _=require('lodash');var util=require(_0x61ca('0x0'));var logger=require('../../config/logger')(_0x61ca('0x1'));var moment=require(_0x61ca('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x61ca('0x3'));var rimraf=require(_0x61ca('0x4'));var config=require(_0x61ca('0x5'));var attributes=require(_0x61ca('0x6'));module[_0x61ca('0x7')]=function(_0x773b50,_0x183a30){return _0x773b50[_0x61ca('0x8')]('AnalyticExtractedReport',attributes,{'tableName':_0x61ca('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x398a=['./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1bd0c4,_0x2405e0){var _0x13a3af=function(_0xe18df9){while(--_0xe18df9){_0x1bd0c4['push'](_0x1bd0c4['shift']());}};_0x13a3af(++_0x2405e0);}(_0x398a,0xe9));var _0xa398=function(_0x2bfad3,_0x3e842c){_0x2bfad3=_0x2bfad3-0x0;var _0x5eb73d=_0x398a[_0x2bfad3];return _0x5eb73d;};'use strict';var _=require(_0xa398('0x0'));var util=require(_0xa398('0x1'));var logger=require(_0xa398('0x2'))(_0xa398('0x3'));var moment=require(_0xa398('0x4'));var BPromise=require(_0xa398('0x5'));var rp=require(_0xa398('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa398('0x7'));module[_0xa398('0x8')]=function(_0x4d89e0,_0xe69622){return _0x4d89e0[_0xa398('0x9')](_0xa398('0xa'),attributes,{'tableName':_0xa398('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 5bae6a7..3ce4de5 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 _0x48e7=['http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x5d00e2,_0x4549d2){var _0x4c1b6f=function(_0x12de4d){while(--_0x12de4d){_0x5d00e2['push'](_0x5d00e2['shift']());}};_0x4c1b6f(++_0x4549d2);}(_0x48e7,0x1db));var _0x748e=function(_0x1b175e,_0x59004f){_0x1b175e=_0x1b175e-0x0;var _0x1c09f9=_0x48e7[_0x1b175e];return _0x1c09f9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x748e('0x0'));var BPromise=require(_0x748e('0x1'));var rs=require(_0x748e('0x2'));var fs=require('fs');var Redis=require(_0x748e('0x3'));var db=require(_0x748e('0x4'))['db'];var utils=require(_0x748e('0x5'));var logger=require('../../config/logger')(_0x748e('0x6'));var config=require(_0x748e('0x7'));var jayson=require(_0x748e('0x8'));var client=jayson['client'][_0x748e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25228f,_0x302198,_0x53edb6){return new BPromise(function(_0x313e39,_0x55e34d){return client[_0x748e('0xa')](_0x25228f,_0x53edb6)[_0x748e('0xb')](function(_0x2050e4){logger[_0x748e('0xc')](_0x748e('0xd'),_0x302198,'request\x20sent');logger[_0x748e('0xe')](_0x748e('0xf'),_0x302198,'request\x20sent',JSON[_0x748e('0x10')](_0x2050e4));if(_0x2050e4[_0x748e('0x11')]){if(_0x2050e4[_0x748e('0x11')][_0x748e('0x12')]===0x1f4){logger[_0x748e('0x11')](_0x748e('0xd'),_0x302198,_0x2050e4[_0x748e('0x11')][_0x748e('0x13')]);return _0x55e34d(_0x2050e4[_0x748e('0x11')][_0x748e('0x13')]);}logger[_0x748e('0x11')](_0x748e('0xd'),_0x302198,_0x2050e4['error'][_0x748e('0x13')]);return _0x313e39(_0x2050e4['error'][_0x748e('0x13')]);}else{logger[_0x748e('0xc')](_0x748e('0xd'),_0x302198,_0x748e('0x14'));_0x313e39(_0x2050e4[_0x748e('0x15')][_0x748e('0x13')]);}})['catch'](function(_0x2d29fb){logger[_0x748e('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x302198,_0x2d29fb);_0x55e34d(_0x2d29fb);});});} \ No newline at end of file +var _0x7f5e=['client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x57ebf5,_0x3de518){var _0x2523c6=function(_0x29a242){while(--_0x29a242){_0x57ebf5['push'](_0x57ebf5['shift']());}};_0x2523c6(++_0x3de518);}(_0x7f5e,0x139));var _0xe7f5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7f5e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe7f5('0x0'));var util=require(_0xe7f5('0x1'));var moment=require('moment');var BPromise=require(_0xe7f5('0x2'));var rs=require(_0xe7f5('0x3'));var fs=require('fs');var Redis=require(_0xe7f5('0x4'));var db=require(_0xe7f5('0x5'))['db'];var utils=require(_0xe7f5('0x6'));var logger=require(_0xe7f5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe7f5('0x8'));var client=jayson[_0xe7f5('0x9')][_0xe7f5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d870f,_0x109d1c,_0x6caf0d){return new BPromise(function(_0x2b528b,_0x2b7095){return client[_0xe7f5('0xb')](_0x3d870f,_0x6caf0d)[_0xe7f5('0xc')](function(_0x304323){logger['info'](_0xe7f5('0xd'),_0x109d1c,_0xe7f5('0xe'));logger[_0xe7f5('0xf')](_0xe7f5('0x10'),_0x109d1c,_0xe7f5('0xe'),JSON['stringify'](_0x304323));if(_0x304323[_0xe7f5('0x11')]){if(_0x304323[_0xe7f5('0x11')][_0xe7f5('0x12')]===0x1f4){logger[_0xe7f5('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x109d1c,_0x304323[_0xe7f5('0x11')][_0xe7f5('0x13')]);return _0x2b7095(_0x304323[_0xe7f5('0x11')][_0xe7f5('0x13')]);}logger['error'](_0xe7f5('0xd'),_0x109d1c,_0x304323['error'][_0xe7f5('0x13')]);return _0x2b528b(_0x304323[_0xe7f5('0x11')][_0xe7f5('0x13')]);}else{logger[_0xe7f5('0x14')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x109d1c,_0xe7f5('0xe'));_0x2b528b(_0x304323[_0xe7f5('0x15')][_0xe7f5('0x13')]);}})[_0xe7f5('0x16')](function(_0x5671aa){logger['error'](_0xe7f5('0xd'),_0x109d1c,_0x5671aa);_0x2b7095(_0x5671aa);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index f86b23c..e5bac4a 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 _0xe680=['show','/:id/download','download','post','put','/:id','update','delete','util','path','connect-timeout','Router','../../config/environment','get','isAuthenticated'];(function(_0x19c5f2,_0x44ed13){var _0xb94caf=function(_0x1b3522){while(--_0x1b3522){_0x19c5f2['push'](_0x19c5f2['shift']());}};_0xb94caf(++_0x44ed13);}(_0xe680,0x8f));var _0x0e68=function(_0x2e50a2,_0x27f31e){_0x2e50a2=_0x2e50a2-0x0;var _0x47e5de=_0xe680[_0x2e50a2];return _0x47e5de;};'use strict';var multer=require('multer');var util=require(_0x0e68('0x0'));var path=require(_0x0e68('0x1'));var timeout=require(_0x0e68('0x2'));var express=require('express');var router=express[_0x0e68('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0e68('0x4'));var controller=require('./analyticExtractedReport.controller');router[_0x0e68('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x0e68('0x6')](),controller[_0x0e68('0x7')]);router['get'](_0x0e68('0x8'),auth[_0x0e68('0x6')](),controller[_0x0e68('0x9')]);router[_0x0e68('0xa')]('/',auth[_0x0e68('0x6')](),controller['create']);router[_0x0e68('0xb')](_0x0e68('0xc'),auth[_0x0e68('0x6')](),controller[_0x0e68('0xd')]);router[_0x0e68('0xe')](_0x0e68('0xc'),auth[_0x0e68('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4d97=['../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','create','put','delete','destroy','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x3697d0,_0x707b25){var _0x2e0e5a=function(_0x10934a){while(--_0x10934a){_0x3697d0['push'](_0x3697d0['shift']());}};_0x2e0e5a(++_0x707b25);}(_0x4d97,0x11b));var _0x74d9=function(_0x44597b,_0x23e7be){_0x44597b=_0x44597b-0x0;var _0x3ba4e6=_0x4d97[_0x44597b];return _0x3ba4e6;};'use strict';var multer=require('multer');var util=require(_0x74d9('0x0'));var path=require(_0x74d9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x74d9('0x2')]();var fs_extra=require(_0x74d9('0x3'));var auth=require(_0x74d9('0x4'));var interaction=require(_0x74d9('0x5'));var config=require('../../config/environment');var controller=require(_0x74d9('0x6'));router[_0x74d9('0x7')]('/',auth[_0x74d9('0x8')](),controller[_0x74d9('0x9')]);router[_0x74d9('0x7')](_0x74d9('0xa'),auth['isAuthenticated'](),controller[_0x74d9('0xb')]);router[_0x74d9('0x7')](_0x74d9('0xc'),auth[_0x74d9('0x8')](),controller[_0x74d9('0xd')]);router['post']('/',auth[_0x74d9('0x8')](),controller[_0x74d9('0xe')]);router[_0x74d9('0xf')]('/:id',auth[_0x74d9('0x8')](),controller['update']);router[_0x74d9('0x10')]('/:id',auth[_0x74d9('0x8')](),controller[_0x74d9('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 386d97d..309e838 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 _0xfe01=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xfe01,0xee));var _0x1fe0=function(_0x42b04a,_0x5ad2bd){_0x42b04a=_0x42b04a-0x0;var _0x5ea034=_0xfe01[_0x42b04a];return _0x5ea034;};'use strict';var Sequelize=require(_0x1fe0('0x0'));module[_0x1fe0('0x1')]={'field':{'type':Sequelize[_0x1fe0('0x2')]},'alias':{'type':Sequelize[_0x1fe0('0x3')]},'function':{'type':Sequelize[_0x1fe0('0x3')]},'format':{'type':Sequelize[_0x1fe0('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1fe0('0x3')]},'custom':{'type':Sequelize[_0x1fe0('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xe303=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x4847c8,_0x1bfbd2){var _0x413de8=function(_0x16b0e0){while(--_0x16b0e0){_0x4847c8['push'](_0x4847c8['shift']());}};_0x413de8(++_0x1bfbd2);}(_0xe303,0x1c9));var _0x3e30=function(_0x2313ed,_0x23179c){_0x2313ed=_0x2313ed-0x0;var _0x409e22=_0xe303[_0x2313ed];return _0x409e22;};'use strict';var Sequelize=require(_0x3e30('0x0'));module[_0x3e30('0x1')]={'field':{'type':Sequelize[_0x3e30('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x3e30('0x3')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x3e30('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x3e30('0x3')]},'custom':{'type':Sequelize[_0x3e30('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 6bdd8fd..19d841a 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 _0x799b=['fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','AnalyticFieldReport','includeAll','include','findAll','catch','params','body','bulkCreate','update','find','destroy','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','save','then','error','stack','name','send','index','rawAttributes'];(function(_0x35db2d,_0x584dd0){var _0x2bbd30=function(_0x504fe7){while(--_0x504fe7){_0x35db2d['push'](_0x35db2d['shift']());}};_0x2bbd30(++_0x584dd0);}(_0x799b,0xcb));var _0xb799=function(_0x5a833b,_0x330316){_0x5a833b=_0x5a833b-0x0;var _0x10cae1=_0x799b[_0x5a833b];return _0x10cae1;};'use strict';var emlformat=require(_0xb799('0x0'));var rimraf=require(_0xb799('0x1'));var zipdir=require(_0xb799('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb799('0x3'));var Mustache=require('mustache');var util=require(_0xb799('0x4'));var path=require(_0xb799('0x5'));var sox=require(_0xb799('0x6'));var csv=require(_0xb799('0x7'));var ejs=require(_0xb799('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb799('0x9'));var squel=require(_0xb799('0xa'));var crypto=require(_0xb799('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb799('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb799('0xd'));var Redis=require(_0xb799('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb799('0xf'));var hardwareService=require(_0xb799('0x10'));var logger=require(_0xb799('0x11'))(_0xb799('0x12'));var utils=require('../../config/utils');var config=require(_0xb799('0x13'));var licenseUtil=require(_0xb799('0x14'));var db=require(_0xb799('0x15'))['db'];function respondWithStatusCode(_0x2aa71f,_0x15e577){_0x15e577=_0x15e577||0xcc;return function(_0x2b25de){if(_0x2b25de){return _0x2aa71f[_0xb799('0x16')](_0x15e577);}return _0x2aa71f['status'](_0x15e577)[_0xb799('0x17')]();};}function respondWithResult(_0x1e9510,_0x19041f){_0x19041f=_0x19041f||0xc8;return function(_0x29f7a9){if(_0x29f7a9){return _0x1e9510[_0xb799('0x18')](_0x19041f)[_0xb799('0x19')](_0x29f7a9);}};}function respondWithFilteredResult(_0x258012,_0x28ae7f){return function(_0xfaaa9f){if(_0xfaaa9f){var _0x326a1c=typeof _0x28ae7f[_0xb799('0x1a')]==='undefined'&&typeof _0x28ae7f[_0xb799('0x1b')]===_0xb799('0x1c');var _0x3e2247=_0xfaaa9f[_0xb799('0x1d')];var _0x1620f3=_0x326a1c?0x0:_0x28ae7f['offset'];var _0x4991fb=_0x326a1c?_0xfaaa9f[_0xb799('0x1d')]:_0x28ae7f[_0xb799('0x1a')]+_0x28ae7f[_0xb799('0x1b')];var _0x17e058;if(_0x4991fb>=_0x3e2247){_0x4991fb=_0x3e2247;_0x17e058=0xc8;}else{_0x17e058=0xce;}_0x258012[_0xb799('0x18')](_0x17e058);return _0x258012['set'](_0xb799('0x1e'),_0x1620f3+'-'+_0x4991fb+'/'+_0x3e2247)[_0xb799('0x19')](_0xfaaa9f);}return null;};}function patchUpdates(_0x41d7f5){return function(_0x594a22){try{jsonpatch[_0xb799('0x1f')](_0x594a22,_0x41d7f5,!![]);}catch(_0x27fce0){return BPromise['reject'](_0x27fce0);}return _0x594a22[_0xb799('0x20')]();};}function saveUpdates(_0x195e9b,_0x349a0a){return function(_0x5c4888){if(_0x5c4888){return _0x5c4888['update'](_0x195e9b)[_0xb799('0x21')](function(_0x3625fc){return _0x3625fc;});}return null;};}function removeEntity(_0x3e9912,_0x4dfa76){return function(_0x5588c2){if(_0x5588c2){return _0x5588c2['destroy']()[_0xb799('0x21')](function(){_0x3e9912[_0xb799('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x232506,_0x346229){return function(_0x158d10){if(!_0x158d10){_0x232506['sendStatus'](0x194);}return _0x158d10;};}function handleError(_0x1ec8c6,_0x500bd2){_0x500bd2=_0x500bd2||0x1f4;return function(_0x4dee36){logger[_0xb799('0x22')](_0x4dee36[_0xb799('0x23')]);if(_0x4dee36[_0xb799('0x24')]){delete _0x4dee36['name'];}_0x1ec8c6[_0xb799('0x18')](_0x500bd2)[_0xb799('0x25')](_0x4dee36);};}exports[_0xb799('0x26')]=function(_0xcb06fc,_0x5c40ac){var _0x2d482f={},_0x1da46e={},_0x16009c={'count':0x0,'rows':[]};var _0x2a6228=_['map'](db['AnalyticFieldReport'][_0xb799('0x27')],function(_0x2d208b){return{'name':_0x2d208b[_0xb799('0x28')],'type':_0x2d208b['type'][_0xb799('0x29')]};});_0x1da46e[_0xb799('0x2a')]=_[_0xb799('0x2b')](_0x2a6228,_0xb799('0x24'));_0x1da46e[_0xb799('0x2c')]=_[_0xb799('0x2d')](_0xcb06fc[_0xb799('0x2c')]);_0x1da46e[_0xb799('0x2e')]=_['intersection'](_0x1da46e[_0xb799('0x2a')],_0x1da46e['query']);_0x2d482f['attributes']=_[_0xb799('0x2f')](_0x1da46e[_0xb799('0x2a')],qs[_0xb799('0x30')](_0xcb06fc[_0xb799('0x2c')][_0xb799('0x30')]));_0x2d482f[_0xb799('0x31')]=_0x2d482f[_0xb799('0x31')][_0xb799('0x32')]?_0x2d482f[_0xb799('0x31')]:_0x1da46e[_0xb799('0x2a')];if(!_0xcb06fc[_0xb799('0x2c')][_0xb799('0x33')](_0xb799('0x34'))){_0x2d482f[_0xb799('0x1b')]=qs['limit'](_0xcb06fc[_0xb799('0x2c')][_0xb799('0x1b')]);_0x2d482f[_0xb799('0x1a')]=qs[_0xb799('0x1a')](_0xcb06fc[_0xb799('0x2c')]['offset']);}_0x2d482f[_0xb799('0x35')]=qs['sort'](_0xcb06fc[_0xb799('0x2c')][_0xb799('0x36')]);_0x2d482f['where']=qs[_0xb799('0x2e')](_[_0xb799('0x37')](_0xcb06fc[_0xb799('0x2c')],_0x1da46e[_0xb799('0x2e')]),_0x2a6228);if(_0xcb06fc[_0xb799('0x2c')][_0xb799('0x38')]){_0x2d482f['where']=_[_0xb799('0x39')](_0x2d482f[_0xb799('0x3a')],{'$or':_[_0xb799('0x2b')](_0x2a6228,function(_0xc720e1){if(_0xc720e1[_0xb799('0x3b')]!==_0xb799('0x3c')){var _0x1acb95={};_0x1acb95[_0xc720e1[_0xb799('0x24')]]={'$like':'%'+_0xcb06fc['query']['filter']+'%'};return _0x1acb95;}})});}_0x2d482f=_[_0xb799('0x39')]({},_0x2d482f,_0xcb06fc[_0xb799('0x3d')]);var _0x5d1fbc={'where':_0x2d482f['where']};return db[_0xb799('0x3e')][_0xb799('0x1d')](_0x5d1fbc)[_0xb799('0x21')](function(_0x55ac2d){_0x16009c['count']=_0x55ac2d;if(_0xcb06fc[_0xb799('0x2c')][_0xb799('0x3f')]){_0x2d482f[_0xb799('0x40')]=[{'all':!![]}];}return db[_0xb799('0x3e')][_0xb799('0x41')](_0x2d482f);})[_0xb799('0x21')](function(_0x2833cb){_0x16009c['rows']=_0x2833cb;return _0x16009c;})[_0xb799('0x21')](respondWithFilteredResult(_0x5c40ac,_0x2d482f))[_0xb799('0x42')](handleError(_0x5c40ac,null));};exports['show']=function(_0x5d0994,_0x313f40){var _0xe803bc={'raw':![],'where':{'id':_0x5d0994[_0xb799('0x43')]['id']}},_0x12af32={};_0x12af32[_0xb799('0x2a')]=_[_0xb799('0x2d')](db[_0xb799('0x3e')][_0xb799('0x27')]);_0x12af32['query']=_[_0xb799('0x2d')](_0x5d0994['query']);_0x12af32[_0xb799('0x2e')]=_[_0xb799('0x2f')](_0x12af32[_0xb799('0x2a')],_0x12af32[_0xb799('0x2c')]);_0xe803bc[_0xb799('0x31')]=_[_0xb799('0x2f')](_0x12af32['model'],qs['fields'](_0x5d0994[_0xb799('0x2c')][_0xb799('0x30')]));_0xe803bc['attributes']=_0xe803bc[_0xb799('0x31')]['length']?_0xe803bc[_0xb799('0x31')]:_0x12af32[_0xb799('0x2a')];if(_0x5d0994['query']['includeAll']){_0xe803bc[_0xb799('0x40')]=[{'all':!![]}];}_0xe803bc=_[_0xb799('0x39')]({},_0xe803bc,_0x5d0994[_0xb799('0x3d')]);return db[_0xb799('0x3e')]['find'](_0xe803bc)[_0xb799('0x21')](handleEntityNotFound(_0x313f40,null))[_0xb799('0x21')](respondWithResult(_0x313f40,null))['catch'](handleError(_0x313f40,null));};exports['create']=function(_0x1a343e,_0x28284b){return db['AnalyticFieldReport']['create'](_0x1a343e[_0xb799('0x44')],{})[_0xb799('0x21')](respondWithResult(_0x28284b,0xc9))['catch'](handleError(_0x28284b,null));};exports['bulkCreate']=function(_0xffca4,_0x363bb8){return db[_0xb799('0x3e')][_0xb799('0x45')](_0xffca4[_0xb799('0x44')],{'raw':![],'individualHooks':!![]})[_0xb799('0x21')](respondWithResult(_0x363bb8,0xc9))['catch'](handleError(_0x363bb8,null));};exports[_0xb799('0x46')]=function(_0x17f980,_0x38882c){if(_0x17f980[_0xb799('0x44')]['id']){delete _0x17f980['body']['id'];}return db['AnalyticFieldReport'][_0xb799('0x47')]({'where':{'id':_0x17f980[_0xb799('0x43')]['id']}})[_0xb799('0x21')](handleEntityNotFound(_0x38882c,null))[_0xb799('0x21')](saveUpdates(_0x17f980[_0xb799('0x44')],null))['then'](respondWithResult(_0x38882c,null))['catch'](handleError(_0x38882c,null));};exports[_0xb799('0x48')]=function(_0x3195cf,_0x35af8f){return db[_0xb799('0x3e')][_0xb799('0x47')]({'where':{'id':_0x3195cf[_0xb799('0x43')]['id']}})[_0xb799('0x21')](handleEntityNotFound(_0x35af8f,null))[_0xb799('0x21')](removeEntity(_0x35af8f,null))[_0xb799('0x42')](handleError(_0x35af8f,null));};exports[_0xb799('0x49')]=function(_0x12f557,_0x2a1a64){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x12f557[_0xb799('0x2c')][_0xb799('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0xb799('0x21')](respondWithResult(_0x2a1a64,0xcc))['catch'](handleError(_0x2a1a64,null));};exports[_0xb799('0x4b')]=function(_0x9f0a83,_0x3a0928,_0x5e5306){return db[_0xb799('0x4c')][_0xb799('0x4d')]({'where':{'id':_0x9f0a83[_0xb799('0x43')]['id']}})[_0xb799('0x21')](handleEntityNotFound(_0x3a0928,null))['then'](function(_0x517a85){if(_0x517a85){return db[_0xb799('0x4e')][_0xb799('0x4f')](function(_0x60edea){return db[_0xb799('0x3e')]['destroy']({'where':{'CustomReportId':_0x9f0a83['params']['id']},'transaction':_0x60edea})[_0xb799('0x21')](function(_0x5791b6){var _0x87e5ba=_['map'](_0x9f0a83[_0xb799('0x44')],function(_0x130d54){delete _0x130d54['id'];_0x130d54[_0xb799('0x50')]=_0x9f0a83['params']['id'];return _0x130d54;});return db['AnalyticFieldReport'][_0xb799('0x45')](_0x87e5ba,{'transaction':_0x60edea});});})[_0xb799('0x21')](function(){return db[_0xb799('0x3e')][_0xb799('0x41')]({'where':{'CustomReportId':_0x9f0a83['params']['id']}});});}})['then'](respondWithResult(_0x3a0928,null))[_0xb799('0x42')](handleError(_0x3a0928,null));}; \ No newline at end of file +var _0x91fa=['fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','apply','reject','update','then','destroy','end','stack','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','create','body','bulkCreate','find','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir'];(function(_0x48afe4,_0x43f02b){var _0x3f17b4=function(_0x23a0cf){while(--_0x23a0cf){_0x48afe4['push'](_0x48afe4['shift']());}};_0x3f17b4(++_0x43f02b);}(_0x91fa,0x1ab));var _0xa91f=function(_0x3167b1,_0x5ad266){_0x3167b1=_0x3167b1-0x0;var _0x362152=_0x91fa[_0x3167b1];return _0x362152;};'use strict';var emlformat=require(_0xa91f('0x0'));var rimraf=require(_0xa91f('0x1'));var zipdir=require(_0xa91f('0x2'));var jsonpatch=require(_0xa91f('0x3'));var rp=require(_0xa91f('0x4'));var moment=require('moment');var BPromise=require(_0xa91f('0x5'));var Mustache=require(_0xa91f('0x6'));var util=require('util');var path=require(_0xa91f('0x7'));var sox=require(_0xa91f('0x8'));var csv=require(_0xa91f('0x9'));var ejs=require(_0xa91f('0xa'));var fs=require('fs');var fs_extra=require(_0xa91f('0xb'));var _=require(_0xa91f('0xc'));var squel=require(_0xa91f('0xd'));var crypto=require(_0xa91f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa91f('0xf'));var toCsv=require(_0xa91f('0x9'));var querystring=require(_0xa91f('0x10'));var Papa=require(_0xa91f('0x11'));var Redis=require(_0xa91f('0x12'));var authService=require(_0xa91f('0x13'));var qs=require(_0xa91f('0x14'));var as=require(_0xa91f('0x15'));var hardwareService=require(_0xa91f('0x16'));var logger=require(_0xa91f('0x17'))(_0xa91f('0x18'));var utils=require(_0xa91f('0x19'));var config=require(_0xa91f('0x1a'));var licenseUtil=require(_0xa91f('0x1b'));var db=require(_0xa91f('0x1c'))['db'];function respondWithStatusCode(_0x9df49d,_0x5339f0){_0x5339f0=_0x5339f0||0xcc;return function(_0x167452){if(_0x167452){return _0x9df49d[_0xa91f('0x1d')](_0x5339f0);}return _0x9df49d[_0xa91f('0x1e')](_0x5339f0)['end']();};}function respondWithResult(_0xc89093,_0x576eff){_0x576eff=_0x576eff||0xc8;return function(_0x502f0a){if(_0x502f0a){return _0xc89093['status'](_0x576eff)[_0xa91f('0x1f')](_0x502f0a);}};}function respondWithFilteredResult(_0x2282cd,_0x2ac9b7){return function(_0x45b837){if(_0x45b837){var _0x2d3b32=typeof _0x2ac9b7[_0xa91f('0x20')]===_0xa91f('0x21')&&typeof _0x2ac9b7['limit']===_0xa91f('0x21');var _0x4f2745=_0x45b837['count'];var _0x199bfb=_0x2d3b32?0x0:_0x2ac9b7['offset'];var _0x1cda4c=_0x2d3b32?_0x45b837['count']:_0x2ac9b7[_0xa91f('0x20')]+_0x2ac9b7[_0xa91f('0x22')];var _0x464f02;if(_0x1cda4c>=_0x4f2745){_0x1cda4c=_0x4f2745;_0x464f02=0xc8;}else{_0x464f02=0xce;}_0x2282cd[_0xa91f('0x1e')](_0x464f02);return _0x2282cd[_0xa91f('0x23')]('Content-Range',_0x199bfb+'-'+_0x1cda4c+'/'+_0x4f2745)[_0xa91f('0x1f')](_0x45b837);}return null;};}function patchUpdates(_0xb2bb5b){return function(_0x5c6e2a){try{jsonpatch[_0xa91f('0x24')](_0x5c6e2a,_0xb2bb5b,!![]);}catch(_0x995bc7){return BPromise[_0xa91f('0x25')](_0x995bc7);}return _0x5c6e2a['save']();};}function saveUpdates(_0x3a0f16,_0xbf7498){return function(_0x42294d){if(_0x42294d){return _0x42294d[_0xa91f('0x26')](_0x3a0f16)[_0xa91f('0x27')](function(_0x3f8979){return _0x3f8979;});}return null;};}function removeEntity(_0x2979d2,_0x276ba0){return function(_0x513e47){if(_0x513e47){return _0x513e47[_0xa91f('0x28')]()[_0xa91f('0x27')](function(){_0x2979d2[_0xa91f('0x1e')](0xcc)[_0xa91f('0x29')]();});}};}function handleEntityNotFound(_0x2f6115,_0x105298){return function(_0x4935f7){if(!_0x4935f7){_0x2f6115[_0xa91f('0x1d')](0x194);}return _0x4935f7;};}function handleError(_0x5ae887,_0x317ba8){_0x317ba8=_0x317ba8||0x1f4;return function(_0x5a3879){logger['error'](_0x5a3879[_0xa91f('0x2a')]);if(_0x5a3879['name']){delete _0x5a3879[_0xa91f('0x2b')];}_0x5ae887[_0xa91f('0x1e')](_0x317ba8)[_0xa91f('0x2c')](_0x5a3879);};}exports[_0xa91f('0x2d')]=function(_0x1c1779,_0x56a368){var _0x8f69d9={},_0x439a53={},_0x181386={'count':0x0,'rows':[]};var _0x16bd28=_['map'](db[_0xa91f('0x2e')][_0xa91f('0x2f')],function(_0x4aa8b3){return{'name':_0x4aa8b3[_0xa91f('0x30')],'type':_0x4aa8b3[_0xa91f('0x31')][_0xa91f('0x32')]};});_0x439a53[_0xa91f('0x33')]=_['map'](_0x16bd28,_0xa91f('0x2b'));_0x439a53[_0xa91f('0x34')]=_['keys'](_0x1c1779['query']);_0x439a53[_0xa91f('0x35')]=_[_0xa91f('0x36')](_0x439a53[_0xa91f('0x33')],_0x439a53['query']);_0x8f69d9[_0xa91f('0x37')]=_[_0xa91f('0x36')](_0x439a53[_0xa91f('0x33')],qs[_0xa91f('0x38')](_0x1c1779[_0xa91f('0x34')][_0xa91f('0x38')]));_0x8f69d9[_0xa91f('0x37')]=_0x8f69d9[_0xa91f('0x37')][_0xa91f('0x39')]?_0x8f69d9[_0xa91f('0x37')]:_0x439a53[_0xa91f('0x33')];if(!_0x1c1779[_0xa91f('0x34')]['hasOwnProperty'](_0xa91f('0x3a'))){_0x8f69d9['limit']=qs[_0xa91f('0x22')](_0x1c1779['query'][_0xa91f('0x22')]);_0x8f69d9[_0xa91f('0x20')]=qs[_0xa91f('0x20')](_0x1c1779[_0xa91f('0x34')][_0xa91f('0x20')]);}_0x8f69d9[_0xa91f('0x3b')]=qs[_0xa91f('0x3c')](_0x1c1779[_0xa91f('0x34')][_0xa91f('0x3c')]);_0x8f69d9['where']=qs['filters'](_[_0xa91f('0x3d')](_0x1c1779['query'],_0x439a53[_0xa91f('0x35')]),_0x16bd28);if(_0x1c1779[_0xa91f('0x34')][_0xa91f('0x3e')]){_0x8f69d9[_0xa91f('0x3f')]=_[_0xa91f('0x40')](_0x8f69d9['where'],{'$or':_[_0xa91f('0x41')](_0x16bd28,function(_0x31665d){if(_0x31665d[_0xa91f('0x31')]!==_0xa91f('0x42')){var _0x10cf7a={};_0x10cf7a[_0x31665d[_0xa91f('0x2b')]]={'$like':'%'+_0x1c1779['query'][_0xa91f('0x3e')]+'%'};return _0x10cf7a;}})});}_0x8f69d9=_[_0xa91f('0x40')]({},_0x8f69d9,_0x1c1779[_0xa91f('0x43')]);var _0x1af87f={'where':_0x8f69d9[_0xa91f('0x3f')]};return db[_0xa91f('0x2e')][_0xa91f('0x44')](_0x1af87f)[_0xa91f('0x27')](function(_0x25ade2){_0x181386['count']=_0x25ade2;if(_0x1c1779[_0xa91f('0x34')][_0xa91f('0x45')]){_0x8f69d9[_0xa91f('0x46')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xa91f('0x47')](_0x8f69d9);})[_0xa91f('0x27')](function(_0x3c7222){_0x181386['rows']=_0x3c7222;return _0x181386;})['then'](respondWithFilteredResult(_0x56a368,_0x8f69d9))[_0xa91f('0x48')](handleError(_0x56a368,null));};exports[_0xa91f('0x49')]=function(_0x5a992d,_0x5b9f86){var _0x3dc18e={'raw':![],'where':{'id':_0x5a992d[_0xa91f('0x4a')]['id']}},_0x380f9f={};_0x380f9f[_0xa91f('0x33')]=_['keys'](db[_0xa91f('0x2e')][_0xa91f('0x2f')]);_0x380f9f[_0xa91f('0x34')]=_['keys'](_0x5a992d[_0xa91f('0x34')]);_0x380f9f[_0xa91f('0x35')]=_['intersection'](_0x380f9f[_0xa91f('0x33')],_0x380f9f[_0xa91f('0x34')]);_0x3dc18e[_0xa91f('0x37')]=_[_0xa91f('0x36')](_0x380f9f['model'],qs[_0xa91f('0x38')](_0x5a992d['query'][_0xa91f('0x38')]));_0x3dc18e[_0xa91f('0x37')]=_0x3dc18e[_0xa91f('0x37')][_0xa91f('0x39')]?_0x3dc18e[_0xa91f('0x37')]:_0x380f9f['model'];if(_0x5a992d[_0xa91f('0x34')][_0xa91f('0x45')]){_0x3dc18e[_0xa91f('0x46')]=[{'all':!![]}];}_0x3dc18e=_[_0xa91f('0x40')]({},_0x3dc18e,_0x5a992d[_0xa91f('0x43')]);return db[_0xa91f('0x2e')]['find'](_0x3dc18e)['then'](handleEntityNotFound(_0x5b9f86,null))[_0xa91f('0x27')](respondWithResult(_0x5b9f86,null))[_0xa91f('0x48')](handleError(_0x5b9f86,null));};exports[_0xa91f('0x4b')]=function(_0x30871c,_0x19ec1a){return db[_0xa91f('0x2e')][_0xa91f('0x4b')](_0x30871c[_0xa91f('0x4c')],{})[_0xa91f('0x27')](respondWithResult(_0x19ec1a,0xc9))[_0xa91f('0x48')](handleError(_0x19ec1a,null));};exports[_0xa91f('0x4d')]=function(_0x4b94eb,_0x17f795){return db[_0xa91f('0x2e')][_0xa91f('0x4d')](_0x4b94eb[_0xa91f('0x4c')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x17f795,0xc9))[_0xa91f('0x48')](handleError(_0x17f795,null));};exports[_0xa91f('0x26')]=function(_0x24eaaa,_0x64651d){if(_0x24eaaa[_0xa91f('0x4c')]['id']){delete _0x24eaaa[_0xa91f('0x4c')]['id'];}return db[_0xa91f('0x2e')][_0xa91f('0x4e')]({'where':{'id':_0x24eaaa['params']['id']}})['then'](handleEntityNotFound(_0x64651d,null))[_0xa91f('0x27')](saveUpdates(_0x24eaaa[_0xa91f('0x4c')],null))['then'](respondWithResult(_0x64651d,null))[_0xa91f('0x48')](handleError(_0x64651d,null));};exports['destroy']=function(_0x8c52c2,_0x2f130d){return db[_0xa91f('0x2e')][_0xa91f('0x4e')]({'where':{'id':_0x8c52c2[_0xa91f('0x4a')]['id']}})[_0xa91f('0x27')](handleEntityNotFound(_0x2f130d,null))['then'](removeEntity(_0x2f130d,null))[_0xa91f('0x48')](handleError(_0x2f130d,null));};exports[_0xa91f('0x4f')]=function(_0x25ccee,_0x855825){return db[_0xa91f('0x2e')][_0xa91f('0x28')]({'where':{'id':_0x25ccee[_0xa91f('0x34')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0xa91f('0x27')](respondWithResult(_0x855825,0xcc))[_0xa91f('0x48')](handleError(_0x855825,null));};exports[_0xa91f('0x50')]=function(_0x443fa5,_0x2990a7,_0x5eee01){return db[_0xa91f('0x51')][_0xa91f('0x52')]({'where':{'id':_0x443fa5[_0xa91f('0x4a')]['id']}})[_0xa91f('0x27')](handleEntityNotFound(_0x2990a7,null))[_0xa91f('0x27')](function(_0x1a5219){if(_0x1a5219){return db[_0xa91f('0x53')][_0xa91f('0x54')](function(_0x1c1c9c){return db[_0xa91f('0x2e')][_0xa91f('0x28')]({'where':{'CustomReportId':_0x443fa5[_0xa91f('0x4a')]['id']},'transaction':_0x1c1c9c})[_0xa91f('0x27')](function(_0x1ca880){var _0x37b67a=_['map'](_0x443fa5[_0xa91f('0x4c')],function(_0x589f0b){delete _0x589f0b['id'];_0x589f0b[_0xa91f('0x55')]=_0x443fa5['params']['id'];return _0x589f0b;});return db[_0xa91f('0x2e')][_0xa91f('0x4d')](_0x37b67a,{'transaction':_0x1c1c9c});});})['then'](function(){return db[_0xa91f('0x2e')]['findAll']({'where':{'CustomReportId':_0x443fa5[_0xa91f('0x4a')]['id']}});});}})[_0xa91f('0x27')](respondWithResult(_0x2990a7,null))['catch'](handleError(_0x2990a7,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 6fe3971..0f74f02 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 _0xe759=['define','analytics_report_fields','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3f9979,_0x3ffc24){var _0x1c583f=function(_0x76833c){while(--_0x76833c){_0x3f9979['push'](_0x3f9979['shift']());}};_0x1c583f(++_0x3ffc24);}(_0xe759,0x124));var _0x9e75=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe759[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x9e75('0x0'));var logger=require(_0x9e75('0x1'))('api');var moment=require(_0x9e75('0x2'));var BPromise=require('bluebird');var rp=require(_0x9e75('0x3'));var fs=require('fs');var path=require(_0x9e75('0x4'));var rimraf=require(_0x9e75('0x5'));var config=require(_0x9e75('0x6'));var attributes=require('./analyticFieldReport.attributes');module[_0x9e75('0x7')]=function(_0x5378e2,_0x2fa6de){return _0x5378e2[_0x9e75('0x8')]('AnalyticFieldReport',attributes,{'tableName':_0x9e75('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x40e3=['../../config/environment','exports','define','analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3a05a7,_0x311feb){var _0x5edd08=function(_0x404ea3){while(--_0x404ea3){_0x3a05a7['push'](_0x3a05a7['shift']());}};_0x5edd08(++_0x311feb);}(_0x40e3,0x154));var _0x340e=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0x40e3[_0x2ae2ad];return _0x26dbd7;};'use strict';var _=require(_0x340e('0x0'));var util=require(_0x340e('0x1'));var logger=require(_0x340e('0x2'))(_0x340e('0x3'));var moment=require(_0x340e('0x4'));var BPromise=require(_0x340e('0x5'));var rp=require(_0x340e('0x6'));var fs=require('fs');var path=require(_0x340e('0x7'));var rimraf=require('rimraf');var config=require(_0x340e('0x8'));var attributes=require('./analyticFieldReport.attributes');module[_0x340e('0x9')]=function(_0x3a8f39,_0x2a811e){return _0x3a8f39[_0x340e('0xa')]('AnalyticFieldReport',attributes,{'tableName':_0x340e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 60ab2a1..dd614f9 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 _0x0046=['request\x20sent','error','code','message','AnalyticFieldReport,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','rpc','../../config/environment','client','http','request','then','info'];(function(_0x331564,_0xf2516a){var _0x2ba08f=function(_0x52ac16){while(--_0x52ac16){_0x331564['push'](_0x331564['shift']());}};_0x2ba08f(++_0xf2516a);}(_0x0046,0x139));var _0x6004=function(_0x530dc8,_0x3f034d){_0x530dc8=_0x530dc8-0x0;var _0x3e481b=_0x0046[_0x530dc8];return _0x3e481b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6004('0x0'));var BPromise=require(_0x6004('0x1'));var rs=require(_0x6004('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6004('0x3'));var config=require(_0x6004('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x6004('0x5')][_0x6004('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x15ecad,_0x1ff228,_0x4a34e3){return new BPromise(function(_0x4bd755,_0x28f430){return client[_0x6004('0x7')](_0x15ecad,_0x4a34e3)[_0x6004('0x8')](function(_0x143310){logger[_0x6004('0x9')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1ff228,_0x6004('0xa'));logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x1ff228,_0x6004('0xa'),JSON['stringify'](_0x143310));if(_0x143310[_0x6004('0xb')]){if(_0x143310[_0x6004('0xb')][_0x6004('0xc')]===0x1f4){logger[_0x6004('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1ff228,_0x143310[_0x6004('0xb')][_0x6004('0xd')]);return _0x28f430(_0x143310[_0x6004('0xb')][_0x6004('0xd')]);}logger[_0x6004('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1ff228,_0x143310[_0x6004('0xb')][_0x6004('0xd')]);return _0x4bd755(_0x143310['error'][_0x6004('0xd')]);}else{logger[_0x6004('0x9')](_0x6004('0xe'),_0x1ff228,_0x6004('0xa'));_0x4bd755(_0x143310[_0x6004('0xf')][_0x6004('0xd')]);}})[_0x6004('0x10')](function(_0x242541){logger[_0x6004('0xb')](_0x6004('0xe'),_0x1ff228,_0x242541);_0x28f430(_0x242541);});});} \ No newline at end of file +var _0x7329=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird'];(function(_0x21bfce,_0x4c2c80){var _0x1cd9e0=function(_0x3fb74c){while(--_0x3fb74c){_0x21bfce['push'](_0x21bfce['shift']());}};_0x1cd9e0(++_0x4c2c80);}(_0x7329,0xe3));var _0x9732=function(_0x528575,_0x2e067d){_0x528575=_0x528575-0x0;var _0x3063b7=_0x7329[_0x528575];return _0x3063b7;};'use strict';var _=require(_0x9732('0x0'));var util=require('util');var moment=require(_0x9732('0x1'));var BPromise=require(_0x9732('0x2'));var rs=require(_0x9732('0x3'));var fs=require('fs');var Redis=require(_0x9732('0x4'));var db=require(_0x9732('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9732('0x6'))(_0x9732('0x7'));var config=require(_0x9732('0x8'));var jayson=require(_0x9732('0x9'));var client=jayson[_0x9732('0xa')][_0x9732('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18504a,_0xb7a52f,_0xfed98f){return new BPromise(function(_0x3ddb66,_0x2bca4d){return client[_0x9732('0xc')](_0x18504a,_0xfed98f)[_0x9732('0xd')](function(_0x9d9aa2){logger[_0x9732('0xe')](_0x9732('0xf'),_0xb7a52f,_0x9732('0x10'));logger[_0x9732('0x11')](_0x9732('0x12'),_0xb7a52f,'request\x20sent',JSON['stringify'](_0x9d9aa2));if(_0x9d9aa2[_0x9732('0x13')]){if(_0x9d9aa2['error']['code']===0x1f4){logger[_0x9732('0x13')](_0x9732('0xf'),_0xb7a52f,_0x9d9aa2['error'][_0x9732('0x14')]);return _0x2bca4d(_0x9d9aa2['error']['message']);}logger[_0x9732('0x13')](_0x9732('0xf'),_0xb7a52f,_0x9d9aa2[_0x9732('0x13')]['message']);return _0x3ddb66(_0x9d9aa2[_0x9732('0x13')][_0x9732('0x14')]);}else{logger['info'](_0x9732('0xf'),_0xb7a52f,_0x9732('0x10'));_0x3ddb66(_0x9d9aa2[_0x9732('0x15')][_0x9732('0x14')]);}})[_0x9732('0x16')](function(_0x463ebf){logger[_0x9732('0x13')](_0x9732('0xf'),_0xb7a52f,_0x463ebf);_0x2bca4d(_0x463ebf);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index dbd111d..ae4a6aa 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(_0x3e1f72,_0x303482){var _0x2c5221=function(_0xfc83c1){while(--_0xfc83c1){_0x3e1f72['push'](_0x3e1f72['shift']());}};_0x2c5221(++_0x303482);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x388228,_0x431132){var _0x4246f9=function(_0x2778f7){while(--_0x2778f7){_0x388228['push'](_0x388228['shift']());}};_0x4246f9(++_0x431132);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 34258be..53caab9 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 _0x6a55=['sequelize','STRING','name','TEXT'];(function(_0x223af1,_0x408d59){var _0x1a3d69=function(_0x15fdcf){while(--_0x15fdcf){_0x223af1['push'](_0x223af1['shift']());}};_0x1a3d69(++_0x408d59);}(_0x6a55,0x154));var _0x56a5=function(_0x50e593,_0x3ae998){_0x50e593=_0x50e593-0x0;var _0x3821d0=_0x6a55[_0x50e593];return _0x3821d0;};'use strict';var Sequelize=require(_0x56a5('0x0'));module['exports']={'name':{'type':Sequelize[_0x56a5('0x1')],'allowNull':![],'unique':_0x56a5('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x56a5('0x3')]},'description':{'type':Sequelize[_0x56a5('0x1')]}}; \ No newline at end of file +var _0xc900=['name','STRING'];(function(_0xf5dbed,_0x28884b){var _0x1b102f=function(_0x198396){while(--_0x198396){_0xf5dbed['push'](_0xf5dbed['shift']());}};_0x1b102f(++_0x28884b);}(_0xc900,0xb3));var _0x0c90=function(_0x1c4801,_0x2ad6bf){_0x1c4801=_0x1c4801-0x0;var _0x452caa=_0xc900[_0x1c4801];return _0x452caa;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0c90('0x0')],'allowNull':![],'unique':_0x0c90('0x1')},'table':{'type':Sequelize[_0x0c90('0x0')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x0c90('0x0')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index ef5abf0..4de03d5 100644 --- a/server/api/analyticMetric/analyticMetric.controller.js +++ b/server/api/analyticMetric/analyticMetric.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','merge','create','body'];(function(_0xc19cae,_0x26f14e){var _0x2e7f6f=function(_0x432b1a){while(--_0x432b1a){_0xc19cae['push'](_0xc19cae['shift']());}};_0x2e7f6f(++_0x26f14e);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2c9b79,_0x7cf58b){_0x2c9b79=_0x2c9b79-0x0;var _0x265032=_0x5fc3[_0x2c9b79];return _0x265032;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xcc;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x17')](_0x409357);}return _0x4cbe74[_0x35fc('0x18')](_0x409357)[_0x35fc('0x19')]();};}function respondWithResult(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0xc8;return function(_0x5cfe94){if(_0x5cfe94){return _0x29730f['status'](_0x38d9f2)['json'](_0x5cfe94);}};}function respondWithFilteredResult(_0x558364,_0x398b67){return function(_0x229d56){if(_0x229d56){var _0x53b898=typeof _0x398b67[_0x35fc('0x1a')]===_0x35fc('0x1b')&&typeof _0x398b67[_0x35fc('0x1c')]==='undefined';var _0x26ba54=_0x229d56[_0x35fc('0x1d')];var _0x553677=_0x53b898?0x0:_0x398b67[_0x35fc('0x1a')];var _0x363e47=_0x53b898?_0x229d56[_0x35fc('0x1d')]:_0x398b67['offset']+_0x398b67[_0x35fc('0x1c')];var _0x3c58ea;if(_0x363e47>=_0x26ba54){_0x363e47=_0x26ba54;_0x3c58ea=0xc8;}else{_0x3c58ea=0xce;}_0x558364[_0x35fc('0x18')](_0x3c58ea);return _0x558364['set'](_0x35fc('0x1e'),_0x553677+'-'+_0x363e47+'/'+_0x26ba54)[_0x35fc('0x1f')](_0x229d56);}return null;};}function patchUpdates(_0x3229d1){return function(_0x251a1f){try{jsonpatch[_0x35fc('0x20')](_0x251a1f,_0x3229d1,!![]);}catch(_0x21f1a9){return BPromise[_0x35fc('0x21')](_0x21f1a9);}return _0x251a1f[_0x35fc('0x22')]();};}function saveUpdates(_0x2405e8,_0x427eae){return function(_0x5bd2b8){if(_0x5bd2b8){return _0x5bd2b8[_0x35fc('0x23')](_0x2405e8)[_0x35fc('0x24')](function(_0x257719){return _0x257719;});}return null;};}function removeEntity(_0x2d8183,_0x3b4743){return function(_0x55e9e7){if(_0x55e9e7){return _0x55e9e7[_0x35fc('0x25')]()[_0x35fc('0x24')](function(){var _0x561bf8=_0x55e9e7[_0x35fc('0x26')]({'plain':!![]});var _0x5a93df=_0x35fc('0x27');return db['UserProfileResource'][_0x35fc('0x25')]({'where':{'type':_0x5a93df,'resourceId':_0x561bf8['id']}})['then'](function(){return _0x55e9e7;});})[_0x35fc('0x24')](function(){_0x2d8183[_0x35fc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x519264,_0x47774c){return function(_0x58edb6){if(!_0x58edb6){_0x519264[_0x35fc('0x17')](0x194);}return _0x58edb6;};}function handleError(_0x1a5d92,_0x57001c){_0x57001c=_0x57001c||0x1f4;return function(_0x26b7cb){logger[_0x35fc('0x28')](_0x26b7cb[_0x35fc('0x29')]);if(_0x26b7cb[_0x35fc('0x2a')]){delete _0x26b7cb[_0x35fc('0x2a')];}_0x1a5d92[_0x35fc('0x18')](_0x57001c)[_0x35fc('0x2b')](_0x26b7cb);};}exports[_0x35fc('0x2c')]=function(_0x54aedc,_0x1cd1ae){var _0x220931={},_0x22af18={},_0x52acc5={'count':0x0,'rows':[]};var _0xe79f52=_[_0x35fc('0x2d')](db[_0x35fc('0x2e')][_0x35fc('0x2f')],function(_0xd8a4ca){return{'name':_0xd8a4ca[_0x35fc('0x30')],'type':_0xd8a4ca[_0x35fc('0x31')][_0x35fc('0x32')]};});_0x22af18[_0x35fc('0x33')]=_[_0x35fc('0x2d')](_0xe79f52,'name');_0x22af18['query']=_[_0x35fc('0x34')](_0x54aedc['query']);_0x22af18[_0x35fc('0x35')]=_[_0x35fc('0x36')](_0x22af18[_0x35fc('0x33')],_0x22af18[_0x35fc('0x37')]);_0x220931[_0x35fc('0x38')]=_[_0x35fc('0x36')](_0x22af18['model'],qs[_0x35fc('0x39')](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x39')]));_0x220931[_0x35fc('0x38')]=_0x220931[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x220931['attributes']:_0x22af18[_0x35fc('0x33')];if(!_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3b')]('nolimit')){_0x220931[_0x35fc('0x1c')]=qs['limit'](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x1c')]);_0x220931[_0x35fc('0x1a')]=qs[_0x35fc('0x1a')](_0x54aedc['query']['offset']);}_0x220931['order']=qs[_0x35fc('0x3c')](_0x54aedc['query'][_0x35fc('0x3c')]);_0x220931['where']=qs[_0x35fc('0x35')](_[_0x35fc('0x3d')](_0x54aedc[_0x35fc('0x37')],_0x22af18[_0x35fc('0x35')]),_0xe79f52);if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]){_0x220931[_0x35fc('0x3f')]=_['merge'](_0x220931[_0x35fc('0x3f')],{'$or':_[_0x35fc('0x2d')](_0xe79f52,function(_0x4e0ce3){if(_0x4e0ce3[_0x35fc('0x31')]!==_0x35fc('0x40')){var _0x1aac67={};_0x1aac67[_0x4e0ce3[_0x35fc('0x2a')]]={'$like':'%'+_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]+'%'};return _0x1aac67;}})});}_0x220931=_['merge']({},_0x220931,_0x54aedc[_0x35fc('0x41')]);var _0x267858={'where':_0x220931[_0x35fc('0x3f')]};return db['AnalyticMetric'][_0x35fc('0x1d')](_0x267858)[_0x35fc('0x24')](function(_0x596919){_0x52acc5[_0x35fc('0x1d')]=_0x596919;if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x42')]){_0x220931[_0x35fc('0x43')]=[{'all':!![]}];}return db[_0x35fc('0x2e')][_0x35fc('0x44')](_0x220931);})[_0x35fc('0x24')](function(_0x3ec51f){_0x52acc5['rows']=_0x3ec51f;return _0x52acc5;})['then'](respondWithFilteredResult(_0x1cd1ae,_0x220931))[_0x35fc('0x45')](handleError(_0x1cd1ae,null));};exports[_0x35fc('0x46')]=function(_0x4fdc6d,_0x5c2e5c){var _0x4ff202={'raw':!![],'where':{'id':_0x4fdc6d[_0x35fc('0x47')]['id']}},_0x79677d={};_0x79677d['model']=_[_0x35fc('0x34')](db[_0x35fc('0x2e')][_0x35fc('0x2f')]);_0x79677d[_0x35fc('0x37')]=_['keys'](_0x4fdc6d['query']);_0x79677d['filters']=_['intersection'](_0x79677d['model'],_0x79677d[_0x35fc('0x37')]);_0x4ff202[_0x35fc('0x38')]=_['intersection'](_0x79677d[_0x35fc('0x33')],qs['fields'](_0x4fdc6d[_0x35fc('0x37')][_0x35fc('0x39')]));_0x4ff202[_0x35fc('0x38')]=_0x4ff202[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x4ff202['attributes']:_0x79677d[_0x35fc('0x33')];if(_0x4fdc6d[_0x35fc('0x37')]['includeAll']){_0x4ff202[_0x35fc('0x43')]=[{'all':!![]}];}_0x4ff202=_[_0x35fc('0x48')]({},_0x4ff202,_0x4fdc6d[_0x35fc('0x41')]);return db[_0x35fc('0x2e')]['find'](_0x4ff202)[_0x35fc('0x24')](handleEntityNotFound(_0x5c2e5c,null))['then'](respondWithResult(_0x5c2e5c,null))['catch'](handleError(_0x5c2e5c,null));};exports[_0x35fc('0x49')]=function(_0x9db7e8,_0x18dc78){return db[_0x35fc('0x2e')][_0x35fc('0x49')](_0x9db7e8[_0x35fc('0x4a')],{})[_0x35fc('0x24')](function(_0x16afa6){var _0x4f555f=_0x9db7e8[_0x35fc('0x4b')][_0x35fc('0x26')]({'plain':!![]});if(!_0x4f555f)throw new Error(_0x35fc('0x4c'));if(_0x4f555f[_0x35fc('0x4d')]===_0x35fc('0x4b')){var _0x1e3221=_0x16afa6[_0x35fc('0x26')]({'plain':!![]});var _0x347a4a=_0x35fc('0x27');return db[_0x35fc('0x4e')][_0x35fc('0x4f')]({'where':{'name':_0x347a4a,'userProfileId':_0x4f555f[_0x35fc('0x50')]},'raw':!![]})[_0x35fc('0x24')](function(_0x3146e2){if(_0x3146e2&&_0x3146e2['autoAssociation']===0x0){return db['UserProfileResource'][_0x35fc('0x49')]({'name':_0x1e3221[_0x35fc('0x2a')],'resourceId':_0x1e3221['id'],'type':_0x3146e2[_0x35fc('0x2a')],'sectionId':_0x3146e2['id']},{})[_0x35fc('0x24')](function(){return _0x16afa6;});}else{return _0x16afa6;}})[_0x35fc('0x45')](function(_0x3e6494){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e6494);throw _0x3e6494;});}return _0x16afa6;})[_0x35fc('0x24')](respondWithResult(_0x18dc78,0xc9))[_0x35fc('0x45')](handleError(_0x18dc78,null));};exports[_0x35fc('0x23')]=function(_0x38bc78,_0x5b2595){if(_0x38bc78[_0x35fc('0x4a')]['id']){delete _0x38bc78[_0x35fc('0x4a')]['id'];}return db['AnalyticMetric'][_0x35fc('0x4f')]({'where':{'id':_0x38bc78[_0x35fc('0x47')]['id']}})['then'](handleEntityNotFound(_0x5b2595,null))[_0x35fc('0x24')](saveUpdates(_0x38bc78[_0x35fc('0x4a')],null))[_0x35fc('0x24')](respondWithResult(_0x5b2595,null))[_0x35fc('0x45')](handleError(_0x5b2595,null));};exports['destroy']=function(_0x4de34b,_0x502a15){return db[_0x35fc('0x2e')][_0x35fc('0x4f')]({'where':{'id':_0x4de34b['params']['id']}})[_0x35fc('0x24')](handleEntityNotFound(_0x502a15,null))[_0x35fc('0x24')](removeEntity(_0x502a15,null))[_0x35fc('0x45')](handleError(_0x502a15,null));}; \ No newline at end of file +var _0x7fbe=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','AnalyticMetric','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','rows','show','params','create','body','role','user','Metrics','find','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x1c16a7,_0x5cb6ae){var _0x2a9b65=function(_0x546d2f){while(--_0x546d2f){_0x1c16a7['push'](_0x1c16a7['shift']());}};_0x2a9b65(++_0x5cb6ae);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2cd1fb,_0x291f55){_0x2cd1fb=_0x2cd1fb-0x0;var _0x48fd2b=_0x7fbe[_0x2cd1fb];return _0x48fd2b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7fb('0x0'));var jsonpatch=require(_0xe7fb('0x1'));var rp=require(_0xe7fb('0x2'));var moment=require(_0xe7fb('0x3'));var BPromise=require(_0xe7fb('0x4'));var Mustache=require(_0xe7fb('0x5'));var util=require(_0xe7fb('0x6'));var path=require(_0xe7fb('0x7'));var sox=require(_0xe7fb('0x8'));var csv=require(_0xe7fb('0x9'));var ejs=require(_0xe7fb('0xa'));var fs=require('fs');var fs_extra=require(_0xe7fb('0xb'));var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0x9'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];function respondWithStatusCode(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xcc;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0x1b')](_0x188e1d);}return _0x2437d4[_0xe7fb('0x1c')](_0x188e1d)['end']();};}function respondWithResult(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0xc8;return function(_0x5573ab){if(_0x5573ab){return _0x278b75[_0xe7fb('0x1c')](_0x2225e5)[_0xe7fb('0x1d')](_0x5573ab);}};}function respondWithFilteredResult(_0x482f7d,_0xa76acf){return function(_0x559129){if(_0x559129){var _0x12fff6=typeof _0xa76acf[_0xe7fb('0x1e')]===_0xe7fb('0x1f')&&typeof _0xa76acf[_0xe7fb('0x20')]==='undefined';var _0x892b0f=_0x559129['count'];var _0x293a47=_0x12fff6?0x0:_0xa76acf['offset'];var _0x1e77fd=_0x12fff6?_0x559129[_0xe7fb('0x21')]:_0xa76acf[_0xe7fb('0x1e')]+_0xa76acf[_0xe7fb('0x20')];var _0x5df1a1;if(_0x1e77fd>=_0x892b0f){_0x1e77fd=_0x892b0f;_0x5df1a1=0xc8;}else{_0x5df1a1=0xce;}_0x482f7d[_0xe7fb('0x1c')](_0x5df1a1);return _0x482f7d['set'](_0xe7fb('0x22'),_0x293a47+'-'+_0x1e77fd+'/'+_0x892b0f)['json'](_0x559129);}return null;};}function patchUpdates(_0x15f7a4){return function(_0x4ea664){try{jsonpatch[_0xe7fb('0x23')](_0x4ea664,_0x15f7a4,!![]);}catch(_0x135624){return BPromise['reject'](_0x135624);}return _0x4ea664[_0xe7fb('0x24')]();};}function saveUpdates(_0x4742bd,_0x3ae8f1){return function(_0x4dcb4b){if(_0x4dcb4b){return _0x4dcb4b[_0xe7fb('0x25')](_0x4742bd)[_0xe7fb('0x26')](function(_0x5da3d9){return _0x5da3d9;});}return null;};}function removeEntity(_0x5bea27,_0x52f08b){return function(_0x35e4db){if(_0x35e4db){return _0x35e4db['destroy']()['then'](function(){var _0x4026b1=_0x35e4db[_0xe7fb('0x27')]({'plain':!![]});var _0x2996ae='Metrics';return db[_0xe7fb('0x28')][_0xe7fb('0x29')]({'where':{'type':_0x2996ae,'resourceId':_0x4026b1['id']}})[_0xe7fb('0x26')](function(){return _0x35e4db;});})[_0xe7fb('0x26')](function(){_0x5bea27[_0xe7fb('0x1c')](0xcc)[_0xe7fb('0x2a')]();});}};}function handleEntityNotFound(_0x380130,_0x59e015){return function(_0x5df9f2){if(!_0x5df9f2){_0x380130[_0xe7fb('0x1b')](0x194);}return _0x5df9f2;};}function handleError(_0x3bdee9,_0xead63){_0xead63=_0xead63||0x1f4;return function(_0x4fd290){logger[_0xe7fb('0x2b')](_0x4fd290[_0xe7fb('0x2c')]);if(_0x4fd290[_0xe7fb('0x2d')]){delete _0x4fd290[_0xe7fb('0x2d')];}_0x3bdee9[_0xe7fb('0x1c')](_0xead63)[_0xe7fb('0x2e')](_0x4fd290);};}exports[_0xe7fb('0x2f')]=function(_0x3dd0be,_0x4ce993){var _0x3d1fb5={},_0x1742f3={},_0x29d1ca={'count':0x0,'rows':[]};var _0x547a04=_['map'](db[_0xe7fb('0x30')]['rawAttributes'],function(_0xac56b4){return{'name':_0xac56b4[_0xe7fb('0x31')],'type':_0xac56b4[_0xe7fb('0x32')][_0xe7fb('0x33')]};});_0x1742f3['model']=_[_0xe7fb('0x34')](_0x547a04,_0xe7fb('0x2d'));_0x1742f3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x3dd0be[_0xe7fb('0x35')]);_0x1742f3['filters']=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],_0x1742f3[_0xe7fb('0x35')]);_0x3d1fb5[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],qs[_0xe7fb('0x3a')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3a')]));_0x3d1fb5['attributes']=_0x3d1fb5[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x3d1fb5[_0xe7fb('0x39')]:_0x1742f3['model'];if(!_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3c')](_0xe7fb('0x3d'))){_0x3d1fb5[_0xe7fb('0x20')]=qs[_0xe7fb('0x20')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x20')]);_0x3d1fb5[_0xe7fb('0x1e')]=qs[_0xe7fb('0x1e')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x1e')]);}_0x3d1fb5[_0xe7fb('0x3e')]=qs[_0xe7fb('0x3f')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3f')]);_0x3d1fb5[_0xe7fb('0x40')]=qs[_0xe7fb('0x41')](_[_0xe7fb('0x42')](_0x3dd0be[_0xe7fb('0x35')],_0x1742f3['filters']),_0x547a04);if(_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]){_0x3d1fb5[_0xe7fb('0x40')]=_[_0xe7fb('0x44')](_0x3d1fb5['where'],{'$or':_[_0xe7fb('0x34')](_0x547a04,function(_0x186418){if(_0x186418[_0xe7fb('0x32')]!==_0xe7fb('0x45')){var _0x49fe9d={};_0x49fe9d[_0x186418[_0xe7fb('0x2d')]]={'$like':'%'+_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]+'%'};return _0x49fe9d;}})});}_0x3d1fb5=_[_0xe7fb('0x44')]({},_0x3d1fb5,_0x3dd0be[_0xe7fb('0x46')]);var _0xb729fc={'where':_0x3d1fb5['where']};return db[_0xe7fb('0x30')][_0xe7fb('0x21')](_0xb729fc)[_0xe7fb('0x26')](function(_0x4b263d){_0x29d1ca[_0xe7fb('0x21')]=_0x4b263d;if(_0x3dd0be[_0xe7fb('0x35')]['includeAll']){_0x3d1fb5['include']=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x3d1fb5);})['then'](function(_0x900d67){_0x29d1ca[_0xe7fb('0x47')]=_0x900d67;return _0x29d1ca;})[_0xe7fb('0x26')](respondWithFilteredResult(_0x4ce993,_0x3d1fb5))['catch'](handleError(_0x4ce993,null));};exports[_0xe7fb('0x48')]=function(_0x58d743,_0x19277f){var _0x32cfa4={'raw':!![],'where':{'id':_0x58d743[_0xe7fb('0x49')]['id']}},_0x4d29d3={};_0x4d29d3[_0xe7fb('0x38')]=_[_0xe7fb('0x36')](db[_0xe7fb('0x30')]['rawAttributes']);_0x4d29d3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x58d743[_0xe7fb('0x35')]);_0x4d29d3['filters']=_[_0xe7fb('0x37')](_0x4d29d3[_0xe7fb('0x38')],_0x4d29d3[_0xe7fb('0x35')]);_0x32cfa4[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x4d29d3['model'],qs[_0xe7fb('0x3a')](_0x58d743['query'][_0xe7fb('0x3a')]));_0x32cfa4[_0xe7fb('0x39')]=_0x32cfa4[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x32cfa4[_0xe7fb('0x39')]:_0x4d29d3['model'];if(_0x58d743[_0xe7fb('0x35')]['includeAll']){_0x32cfa4['include']=[{'all':!![]}];}_0x32cfa4=_[_0xe7fb('0x44')]({},_0x32cfa4,_0x58d743[_0xe7fb('0x46')]);return db[_0xe7fb('0x30')]['find'](_0x32cfa4)[_0xe7fb('0x26')](handleEntityNotFound(_0x19277f,null))[_0xe7fb('0x26')](respondWithResult(_0x19277f,null))['catch'](handleError(_0x19277f,null));};exports['create']=function(_0x284bcb,_0x42270b){return db[_0xe7fb('0x30')][_0xe7fb('0x4a')](_0x284bcb[_0xe7fb('0x4b')],{})[_0xe7fb('0x26')](function(_0x18a590){var _0x347177=_0x284bcb['user'][_0xe7fb('0x27')]({'plain':!![]});if(!_0x347177)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x347177[_0xe7fb('0x4c')]===_0xe7fb('0x4d')){var _0x5cedfb=_0x18a590[_0xe7fb('0x27')]({'plain':!![]});var _0x5efd24=_0xe7fb('0x4e');return db['UserProfileSection'][_0xe7fb('0x4f')]({'where':{'name':_0x5efd24,'userProfileId':_0x347177['userProfileId']},'raw':!![]})[_0xe7fb('0x26')](function(_0x59158c){if(_0x59158c&&_0x59158c[_0xe7fb('0x50')]===0x0){return db[_0xe7fb('0x28')][_0xe7fb('0x4a')]({'name':_0x5cedfb[_0xe7fb('0x2d')],'resourceId':_0x5cedfb['id'],'type':_0x59158c[_0xe7fb('0x2d')],'sectionId':_0x59158c['id']},{})[_0xe7fb('0x26')](function(){return _0x18a590;});}else{return _0x18a590;}})[_0xe7fb('0x51')](function(_0x582a4a){logger['error'](_0xe7fb('0x52'),_0x582a4a);throw _0x582a4a;});}return _0x18a590;})['then'](respondWithResult(_0x42270b,0xc9))['catch'](handleError(_0x42270b,null));};exports['update']=function(_0x50b8df,_0x539252){if(_0x50b8df[_0xe7fb('0x4b')]['id']){delete _0x50b8df[_0xe7fb('0x4b')]['id'];}return db[_0xe7fb('0x30')][_0xe7fb('0x4f')]({'where':{'id':_0x50b8df['params']['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x539252,null))[_0xe7fb('0x26')](saveUpdates(_0x50b8df[_0xe7fb('0x4b')],null))['then'](respondWithResult(_0x539252,null))['catch'](handleError(_0x539252,null));};exports[_0xe7fb('0x29')]=function(_0x377e5f,_0x300b8e){return db['AnalyticMetric'][_0xe7fb('0x4f')]({'where':{'id':_0x377e5f[_0xe7fb('0x49')]['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x300b8e,null))[_0xe7fb('0x26')](removeEntity(_0x300b8e,null))['catch'](handleError(_0x300b8e,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 452ed4d..9e8fc12 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 _0x4819=['analytics_metrics','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','AnalyticMetric'];(function(_0x2e640b,_0x5a4e00){var _0x335894=function(_0x457b2b){while(--_0x457b2b){_0x2e640b['push'](_0x2e640b['shift']());}};_0x335894(++_0x5a4e00);}(_0x4819,0xcd));var _0x9481=function(_0xba0c2,_0x54cc50){_0xba0c2=_0xba0c2-0x0;var _0x5a9fa0=_0x4819[_0xba0c2];return _0x5a9fa0;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));module['exports']=function(_0x4d9e3a,_0x5def07){return _0x4d9e3a['define'](_0x9481('0xa'),attributes,{'tableName':_0x9481('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39e6=['exports','define','AnalyticMetric','analytics_metrics','lodash','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./analyticMetric.attributes'];(function(_0x265829,_0x3fe6a0){var _0x4b9dd4=function(_0x168a69){while(--_0x168a69){_0x265829['push'](_0x265829['shift']());}};_0x4b9dd4(++_0x3fe6a0);}(_0x39e6,0x9e));var _0x639e=function(_0x211918,_0x1c062a){_0x211918=_0x211918-0x0;var _0x2bf94f=_0x39e6[_0x211918];return _0x2bf94f;};'use strict';var _=require(_0x639e('0x0'));var util=require('util');var logger=require(_0x639e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x639e('0x2'));var rp=require(_0x639e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x639e('0x4'));var config=require(_0x639e('0x5'));var attributes=require(_0x639e('0x6'));module[_0x639e('0x7')]=function(_0x15e5df,_0x320448){return _0x15e5df[_0x639e('0x8')](_0x639e('0x9'),attributes,{'tableName':_0x639e('0xa'),'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 ee1b8db..a2d73ab 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 _0x34b6=['../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','bluebird','randomstring','../../config/utils','rpc'];(function(_0x2379cf,_0x365a43){var _0x2ae3cf=function(_0x3b8068){while(--_0x3b8068){_0x2379cf['push'](_0x2379cf['shift']());}};_0x2ae3cf(++_0x365a43);}(_0x34b6,0x19f));var _0x634b=function(_0x5062db,_0x1894fb){_0x5062db=_0x5062db-0x0;var _0x389f5=_0x34b6[_0x5062db];return _0x389f5;};'use strict';var _=require('lodash');var util=require(_0x634b('0x0'));var moment=require('moment');var BPromise=require(_0x634b('0x1'));var rs=require(_0x634b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x634b('0x3'));var logger=require('../../config/logger')(_0x634b('0x4'));var config=require(_0x634b('0x5'));var jayson=require(_0x634b('0x6'));var client=jayson[_0x634b('0x7')][_0x634b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d8b33,_0xccbb0c,_0x4e65fa){return new BPromise(function(_0x6ad15f,_0x21a378){return client[_0x634b('0x9')](_0x2d8b33,_0x4e65fa)[_0x634b('0xa')](function(_0x60911d){logger[_0x634b('0xb')](_0x634b('0xc'),_0xccbb0c,'request\x20sent');logger['debug'](_0x634b('0xd'),_0xccbb0c,_0x634b('0xe'),JSON[_0x634b('0xf')](_0x60911d));if(_0x60911d[_0x634b('0x10')]){if(_0x60911d[_0x634b('0x10')][_0x634b('0x11')]===0x1f4){logger['error'](_0x634b('0xc'),_0xccbb0c,_0x60911d['error'][_0x634b('0x12')]);return _0x21a378(_0x60911d[_0x634b('0x10')][_0x634b('0x12')]);}logger[_0x634b('0x10')](_0x634b('0xc'),_0xccbb0c,_0x60911d[_0x634b('0x10')]['message']);return _0x6ad15f(_0x60911d[_0x634b('0x10')][_0x634b('0x12')]);}else{logger[_0x634b('0xb')](_0x634b('0xc'),_0xccbb0c,_0x634b('0xe'));_0x6ad15f(_0x60911d[_0x634b('0x13')][_0x634b('0x12')]);}})[_0x634b('0x14')](function(_0x41a86f){logger[_0x634b('0x10')](_0x634b('0xc'),_0xccbb0c,_0x41a86f);_0x21a378(_0x41a86f);});});} \ No newline at end of file +var _0x8088=['error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8088,0xb5));var _0x8808=function(_0x5e9ad3,_0x548e04){_0x5e9ad3=_0x5e9ad3-0x0;var _0x32c8dd=_0x8088[_0x5e9ad3];return _0x32c8dd;};'use strict';var _=require(_0x8808('0x0'));var util=require(_0x8808('0x1'));var moment=require(_0x8808('0x2'));var BPromise=require(_0x8808('0x3'));var rs=require(_0x8808('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8808('0x5'))['db'];var utils=require(_0x8808('0x6'));var logger=require('../../config/logger')(_0x8808('0x7'));var config=require(_0x8808('0x8'));var jayson=require(_0x8808('0x9'));var client=jayson[_0x8808('0xa')][_0x8808('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13378e,_0x5f018d,_0x7d2af2){return new BPromise(function(_0x1c4563,_0x984db1){return client['request'](_0x13378e,_0x7d2af2)[_0x8808('0xc')](function(_0x158e96){logger[_0x8808('0xd')](_0x8808('0xe'),_0x5f018d,'request\x20sent');logger['debug'](_0x8808('0xf'),_0x5f018d,'request\x20sent',JSON[_0x8808('0x10')](_0x158e96));if(_0x158e96['error']){if(_0x158e96[_0x8808('0x11')]['code']===0x1f4){logger[_0x8808('0x11')](_0x8808('0xe'),_0x5f018d,_0x158e96['error']['message']);return _0x984db1(_0x158e96[_0x8808('0x11')]['message']);}logger[_0x8808('0x11')](_0x8808('0xe'),_0x5f018d,_0x158e96[_0x8808('0x11')][_0x8808('0x12')]);return _0x1c4563(_0x158e96[_0x8808('0x11')]['message']);}else{logger[_0x8808('0xd')](_0x8808('0xe'),_0x5f018d,_0x8808('0x13'));_0x1c4563(_0x158e96[_0x8808('0x14')][_0x8808('0x12')]);}})[_0x8808('0x15')](function(_0x1ec433){logger[_0x8808('0x11')](_0x8808('0xe'),_0x5f018d,_0x1ec433);_0x984db1(_0x1ec433);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 8c76476..e5c2ff2 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 _0x3eea=['get','isAuthenticated','/:id','show','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller'];(function(_0x51853c,_0x3a5d99){var _0x31eb5=function(_0xd2cf74){while(--_0xd2cf74){_0x51853c['push'](_0x51853c['shift']());}};_0x31eb5(++_0x3a5d99);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x5d4c9a,_0x344495){_0x5d4c9a=_0x5d4c9a-0x0;var _0x5e771f=_0x3eea[_0x5d4c9a];return _0x5e771f;};'use strict';var multer=require(_0xa3ee('0x0'));var util=require('util');var path=require(_0xa3ee('0x1'));var timeout=require(_0xa3ee('0x2'));var express=require(_0xa3ee('0x3'));var router=express[_0xa3ee('0x4')]();var fs_extra=require(_0xa3ee('0x5'));var auth=require(_0xa3ee('0x6'));var interaction=require(_0xa3ee('0x7'));var config=require(_0xa3ee('0x8'));var controller=require(_0xa3ee('0x9'));router[_0xa3ee('0xa')]('/',auth[_0xa3ee('0xb')](),controller['index']);router['get'](_0xa3ee('0xc'),auth['isAuthenticated'](),controller[_0xa3ee('0xd')]);router['post']('/',auth[_0xa3ee('0xb')](),controller['create']);router[_0xa3ee('0xe')]('/:id',auth[_0xa3ee('0xb')](),controller[_0xa3ee('0xf')]);router[_0xa3ee('0x10')]('/:id',auth[_0xa3ee('0xb')](),controller[_0xa3ee('0x11')]);module['exports']=router; \ No newline at end of file +var _0x8832=['fs-extra','../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated','show','create','put','/:id','update','multer','util','express','Router'];(function(_0x31f0d5,_0x4b76e3){var _0x55253f=function(_0x19448f){while(--_0x19448f){_0x31f0d5['push'](_0x31f0d5['shift']());}};_0x55253f(++_0x4b76e3);}(_0x8832,0x1f4));var _0x2883=function(_0x39649c,_0x46a41b){_0x39649c=_0x39649c-0x0;var _0x310fc7=_0x8832[_0x39649c];return _0x310fc7;};'use strict';var multer=require(_0x2883('0x0'));var util=require(_0x2883('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2883('0x2'));var router=express[_0x2883('0x3')]();var fs_extra=require(_0x2883('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2883('0x5'));var config=require('../../config/environment');var controller=require(_0x2883('0x6'));router[_0x2883('0x7')]('/',auth[_0x2883('0x8')](),controller['index']);router[_0x2883('0x7')]('/:id',auth[_0x2883('0x8')](),controller[_0x2883('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2883('0xa')]);router[_0x2883('0xb')](_0x2883('0xc'),auth[_0x2883('0x8')](),controller[_0x2883('0xd')]);router['delete']('/:id',auth[_0x2883('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 8cff9a3..1f05683 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 _0x070a=['TEXT','exports'];(function(_0x2c6c57,_0xcbed48){var _0x386cc7=function(_0x473fbc){while(--_0x473fbc){_0x2c6c57['push'](_0x2c6c57['shift']());}};_0x386cc7(++_0xcbed48);}(_0x070a,0xc3));var _0xa070=function(_0x8aaab,_0x22b188){_0x8aaab=_0x8aaab-0x0;var _0x2eef1f=_0x070a[_0x8aaab];return _0x2eef1f;};'use strict';var Sequelize=require('sequelize');module[_0xa070('0x0')]={'tree':{'type':Sequelize[_0xa070('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xa3b7=['TEXT','sequelize','exports'];(function(_0x483102,_0x54e93d){var _0x5cc885=function(_0x54931c){while(--_0x54931c){_0x483102['push'](_0x483102['shift']());}};_0x5cc885(++_0x54e93d);}(_0xa3b7,0xc7));var _0x7a3b=function(_0x453e2b,_0x4f1258){_0x453e2b=_0x453e2b-0x0;var _0x50f306=_0xa3b7[_0x453e2b];return _0x50f306;};'use strict';var Sequelize=require(_0x7a3b('0x0'));module[_0x7a3b('0x1')]={'tree':{'type':Sequelize[_0x7a3b('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 83a638f..c8043e3 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 _0x8fd0=['fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','create','body','find','params','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','index','map','AnalyticTreeReport','rawAttributes'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x8fd0,0x18a));var _0x08fd=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x8fd0[_0x465a0c];return _0x1e202e;};'use strict';var emlformat=require(_0x08fd('0x0'));var rimraf=require(_0x08fd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x08fd('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x08fd('0x3'));var Mustache=require(_0x08fd('0x4'));var util=require(_0x08fd('0x5'));var path=require(_0x08fd('0x6'));var sox=require(_0x08fd('0x7'));var csv=require(_0x08fd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x08fd('0x9'));var _=require(_0x08fd('0xa'));var squel=require(_0x08fd('0xb'));var crypto=require('crypto');var jsforce=require(_0x08fd('0xc'));var deskjs=require(_0x08fd('0xd'));var toCsv=require(_0x08fd('0x8'));var querystring=require(_0x08fd('0xe'));var Papa=require(_0x08fd('0xf'));var Redis=require(_0x08fd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x08fd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x08fd('0x12'));var utils=require(_0x08fd('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x08fd('0x14'));var db=require(_0x08fd('0x15'))['db'];function respondWithStatusCode(_0x4f2450,_0x40b066){_0x40b066=_0x40b066||0xcc;return function(_0x7a5b8e){if(_0x7a5b8e){return _0x4f2450[_0x08fd('0x16')](_0x40b066);}return _0x4f2450[_0x08fd('0x17')](_0x40b066)['end']();};}function respondWithResult(_0x289cfb,_0x9d2a74){_0x9d2a74=_0x9d2a74||0xc8;return function(_0x5d1e14){if(_0x5d1e14){return _0x289cfb['status'](_0x9d2a74)[_0x08fd('0x18')](_0x5d1e14);}};}function respondWithFilteredResult(_0x3ed39e,_0xc5dbde){return function(_0x1843a9){if(_0x1843a9){var _0x1aa078=typeof _0xc5dbde[_0x08fd('0x19')]===_0x08fd('0x1a')&&typeof _0xc5dbde[_0x08fd('0x1b')]===_0x08fd('0x1a');var _0xbb4ae8=_0x1843a9[_0x08fd('0x1c')];var _0x56a62c=_0x1aa078?0x0:_0xc5dbde[_0x08fd('0x19')];var _0x3d0aea=_0x1aa078?_0x1843a9[_0x08fd('0x1c')]:_0xc5dbde['offset']+_0xc5dbde[_0x08fd('0x1b')];var _0x1ca580;if(_0x3d0aea>=_0xbb4ae8){_0x3d0aea=_0xbb4ae8;_0x1ca580=0xc8;}else{_0x1ca580=0xce;}_0x3ed39e[_0x08fd('0x17')](_0x1ca580);return _0x3ed39e[_0x08fd('0x1d')](_0x08fd('0x1e'),_0x56a62c+'-'+_0x3d0aea+'/'+_0xbb4ae8)[_0x08fd('0x18')](_0x1843a9);}return null;};}function patchUpdates(_0x35d011){return function(_0x16a8e7){try{jsonpatch[_0x08fd('0x1f')](_0x16a8e7,_0x35d011,!![]);}catch(_0x230c95){return BPromise['reject'](_0x230c95);}return _0x16a8e7[_0x08fd('0x20')]();};}function saveUpdates(_0x2976ff,_0xda0280){return function(_0x9218f5){if(_0x9218f5){return _0x9218f5[_0x08fd('0x21')](_0x2976ff)[_0x08fd('0x22')](function(_0x4bcb95){return _0x4bcb95;});}return null;};}function removeEntity(_0x2c0f4f,_0x927c7d){return function(_0x494614){if(_0x494614){return _0x494614[_0x08fd('0x23')]()[_0x08fd('0x22')](function(){_0x2c0f4f[_0x08fd('0x17')](0xcc)[_0x08fd('0x24')]();});}};}function handleEntityNotFound(_0x45460a,_0x464761){return function(_0x52a056){if(!_0x52a056){_0x45460a[_0x08fd('0x16')](0x194);}return _0x52a056;};}function handleError(_0x447c1e,_0x1d2e8f){_0x1d2e8f=_0x1d2e8f||0x1f4;return function(_0x501002){logger[_0x08fd('0x25')](_0x501002[_0x08fd('0x26')]);if(_0x501002['name']){delete _0x501002[_0x08fd('0x27')];}_0x447c1e[_0x08fd('0x17')](_0x1d2e8f)['send'](_0x501002);};}exports[_0x08fd('0x28')]=function(_0x57e1fe,_0x1d06a3){var _0x3e2c90={},_0x567a59={},_0x1acfc0={'count':0x0,'rows':[]};var _0x137129=_[_0x08fd('0x29')](db[_0x08fd('0x2a')][_0x08fd('0x2b')],function(_0xfc37a2){return{'name':_0xfc37a2[_0x08fd('0x2c')],'type':_0xfc37a2[_0x08fd('0x2d')][_0x08fd('0x2e')]};});_0x567a59[_0x08fd('0x2f')]=_[_0x08fd('0x29')](_0x137129,_0x08fd('0x27'));_0x567a59['query']=_[_0x08fd('0x30')](_0x57e1fe[_0x08fd('0x31')]);_0x567a59[_0x08fd('0x32')]=_[_0x08fd('0x33')](_0x567a59[_0x08fd('0x2f')],_0x567a59['query']);_0x3e2c90[_0x08fd('0x34')]=_['intersection'](_0x567a59[_0x08fd('0x2f')],qs[_0x08fd('0x35')](_0x57e1fe[_0x08fd('0x31')][_0x08fd('0x35')]));_0x3e2c90['attributes']=_0x3e2c90[_0x08fd('0x34')][_0x08fd('0x36')]?_0x3e2c90['attributes']:_0x567a59[_0x08fd('0x2f')];if(!_0x57e1fe[_0x08fd('0x31')][_0x08fd('0x37')](_0x08fd('0x38'))){_0x3e2c90[_0x08fd('0x1b')]=qs[_0x08fd('0x1b')](_0x57e1fe[_0x08fd('0x31')]['limit']);_0x3e2c90[_0x08fd('0x19')]=qs['offset'](_0x57e1fe['query'][_0x08fd('0x19')]);}_0x3e2c90[_0x08fd('0x39')]=qs[_0x08fd('0x3a')](_0x57e1fe[_0x08fd('0x31')]['sort']);_0x3e2c90[_0x08fd('0x3b')]=qs['filters'](_['pick'](_0x57e1fe['query'],_0x567a59[_0x08fd('0x32')]),_0x137129);if(_0x57e1fe[_0x08fd('0x31')]['filter']){_0x3e2c90[_0x08fd('0x3b')]=_[_0x08fd('0x3c')](_0x3e2c90['where'],{'$or':_[_0x08fd('0x29')](_0x137129,function(_0x3b4764){if(_0x3b4764[_0x08fd('0x2d')]!==_0x08fd('0x3d')){var _0x13ba85={};_0x13ba85[_0x3b4764[_0x08fd('0x27')]]={'$like':'%'+_0x57e1fe[_0x08fd('0x31')][_0x08fd('0x3e')]+'%'};return _0x13ba85;}})});}_0x3e2c90=_[_0x08fd('0x3c')]({},_0x3e2c90,_0x57e1fe[_0x08fd('0x3f')]);var _0x1d9150={'where':_0x3e2c90['where']};return db[_0x08fd('0x2a')][_0x08fd('0x1c')](_0x1d9150)[_0x08fd('0x22')](function(_0x29ccb9){_0x1acfc0['count']=_0x29ccb9;if(_0x57e1fe[_0x08fd('0x31')][_0x08fd('0x40')]){_0x3e2c90[_0x08fd('0x41')]=[{'all':!![]}];}return db[_0x08fd('0x2a')][_0x08fd('0x42')](_0x3e2c90);})[_0x08fd('0x22')](function(_0x2bc380){_0x1acfc0['rows']=_0x2bc380;return _0x1acfc0;})[_0x08fd('0x22')](respondWithFilteredResult(_0x1d06a3,_0x3e2c90))[_0x08fd('0x43')](handleError(_0x1d06a3,null));};exports[_0x08fd('0x44')]=function(_0x140e42,_0x2fbad6){var _0x36fb9b={'raw':!![],'where':{'id':_0x140e42['params']['id']}},_0x5d5ab4={};_0x5d5ab4['model']=_['keys'](db['AnalyticTreeReport']['rawAttributes']);_0x5d5ab4[_0x08fd('0x31')]=_['keys'](_0x140e42[_0x08fd('0x31')]);_0x5d5ab4[_0x08fd('0x32')]=_[_0x08fd('0x33')](_0x5d5ab4[_0x08fd('0x2f')],_0x5d5ab4[_0x08fd('0x31')]);_0x36fb9b[_0x08fd('0x34')]=_[_0x08fd('0x33')](_0x5d5ab4['model'],qs[_0x08fd('0x35')](_0x140e42[_0x08fd('0x31')][_0x08fd('0x35')]));_0x36fb9b[_0x08fd('0x34')]=_0x36fb9b[_0x08fd('0x34')][_0x08fd('0x36')]?_0x36fb9b['attributes']:_0x5d5ab4[_0x08fd('0x2f')];if(_0x140e42['query'][_0x08fd('0x40')]){_0x36fb9b[_0x08fd('0x41')]=[{'all':!![]}];}_0x36fb9b=_[_0x08fd('0x3c')]({},_0x36fb9b,_0x140e42['options']);return db[_0x08fd('0x2a')]['find'](_0x36fb9b)['then'](handleEntityNotFound(_0x2fbad6,null))[_0x08fd('0x22')](respondWithResult(_0x2fbad6,null))[_0x08fd('0x43')](handleError(_0x2fbad6,null));};exports[_0x08fd('0x45')]=function(_0x4a881c,_0x2e0986){return db[_0x08fd('0x2a')][_0x08fd('0x45')](_0x4a881c['body'],{})[_0x08fd('0x22')](respondWithResult(_0x2e0986,0xc9))[_0x08fd('0x43')](handleError(_0x2e0986,null));};exports[_0x08fd('0x21')]=function(_0x6efb06,_0x4e341a){if(_0x6efb06[_0x08fd('0x46')]['id']){delete _0x6efb06[_0x08fd('0x46')]['id'];}return db[_0x08fd('0x2a')][_0x08fd('0x47')]({'where':{'id':_0x6efb06[_0x08fd('0x48')]['id']}})[_0x08fd('0x22')](handleEntityNotFound(_0x4e341a,null))[_0x08fd('0x22')](saveUpdates(_0x6efb06[_0x08fd('0x46')],null))['then'](respondWithResult(_0x4e341a,null))[_0x08fd('0x43')](handleError(_0x4e341a,null));};exports[_0x08fd('0x23')]=function(_0xb00514,_0x146c12){return db['AnalyticTreeReport'][_0x08fd('0x47')]({'where':{'id':_0xb00514[_0x08fd('0x48')]['id']}})[_0x08fd('0x22')](handleEntityNotFound(_0x146c12,null))['then'](removeEntity(_0x146c12,null))[_0x08fd('0x43')](handleError(_0x146c12,null));}; \ No newline at end of file +var _0x37c1=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','then','end','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','query','keys','filters','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','rows','catch','params','intersection','include','find','create','body','update','destroy','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x37c1,0x1ed));var _0x137c=function(_0x46a36b,_0x2285d4){_0x46a36b=_0x46a36b-0x0;var _0x9424f7=_0x37c1[_0x46a36b];return _0x9424f7;};'use strict';var emlformat=require(_0x137c('0x0'));var rimraf=require(_0x137c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x137c('0x2'));var moment=require(_0x137c('0x3'));var BPromise=require(_0x137c('0x4'));var Mustache=require(_0x137c('0x5'));var util=require('util');var path=require(_0x137c('0x6'));var sox=require(_0x137c('0x7'));var csv=require('to-csv');var ejs=require(_0x137c('0x8'));var fs=require('fs');var fs_extra=require(_0x137c('0x9'));var _=require(_0x137c('0xa'));var squel=require('squel');var crypto=require(_0x137c('0xb'));var jsforce=require(_0x137c('0xc'));var deskjs=require(_0x137c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x137c('0xe'));var Papa=require(_0x137c('0xf'));var Redis=require(_0x137c('0x10'));var authService=require(_0x137c('0x11'));var qs=require(_0x137c('0x12'));var as=require(_0x137c('0x13'));var hardwareService=require(_0x137c('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x137c('0x15'));var config=require(_0x137c('0x16'));var licenseUtil=require(_0x137c('0x17'));var db=require(_0x137c('0x18'))['db'];function respondWithStatusCode(_0x21ec0c,_0x5c33a1){_0x5c33a1=_0x5c33a1||0xcc;return function(_0x444b50){if(_0x444b50){return _0x21ec0c['sendStatus'](_0x5c33a1);}return _0x21ec0c[_0x137c('0x19')](_0x5c33a1)['end']();};}function respondWithResult(_0x58d75e,_0x4ac5e3){_0x4ac5e3=_0x4ac5e3||0xc8;return function(_0x390f7c){if(_0x390f7c){return _0x58d75e['status'](_0x4ac5e3)[_0x137c('0x1a')](_0x390f7c);}};}function respondWithFilteredResult(_0x1c2d26,_0x323e9b){return function(_0x563900){if(_0x563900){var _0x1cd2ea=typeof _0x323e9b['offset']==='undefined'&&typeof _0x323e9b[_0x137c('0x1b')]===_0x137c('0x1c');var _0x3a4948=_0x563900[_0x137c('0x1d')];var _0x4f5fe9=_0x1cd2ea?0x0:_0x323e9b[_0x137c('0x1e')];var _0x541b25=_0x1cd2ea?_0x563900[_0x137c('0x1d')]:_0x323e9b[_0x137c('0x1e')]+_0x323e9b[_0x137c('0x1b')];var _0x2c1b37;if(_0x541b25>=_0x3a4948){_0x541b25=_0x3a4948;_0x2c1b37=0xc8;}else{_0x2c1b37=0xce;}_0x1c2d26[_0x137c('0x19')](_0x2c1b37);return _0x1c2d26['set'](_0x137c('0x1f'),_0x4f5fe9+'-'+_0x541b25+'/'+_0x3a4948)[_0x137c('0x1a')](_0x563900);}return null;};}function patchUpdates(_0x5447cb){return function(_0x5b86b6){try{jsonpatch[_0x137c('0x20')](_0x5b86b6,_0x5447cb,!![]);}catch(_0x60c975){return BPromise[_0x137c('0x21')](_0x60c975);}return _0x5b86b6[_0x137c('0x22')]();};}function saveUpdates(_0x229c90,_0x5655c3){return function(_0x2f3cdd){if(_0x2f3cdd){return _0x2f3cdd['update'](_0x229c90)[_0x137c('0x23')](function(_0x41ff12){return _0x41ff12;});}return null;};}function removeEntity(_0x3502cb,_0x114e05){return function(_0x5d3977){if(_0x5d3977){return _0x5d3977['destroy']()[_0x137c('0x23')](function(){_0x3502cb[_0x137c('0x19')](0xcc)[_0x137c('0x24')]();});}};}function handleEntityNotFound(_0x556590,_0x24c16f){return function(_0x420f8e){if(!_0x420f8e){_0x556590['sendStatus'](0x194);}return _0x420f8e;};}function handleError(_0x480ec9,_0x534dfb){_0x534dfb=_0x534dfb||0x1f4;return function(_0x214785){logger['error'](_0x214785['stack']);if(_0x214785[_0x137c('0x25')]){delete _0x214785[_0x137c('0x25')];}_0x480ec9[_0x137c('0x19')](_0x534dfb)['send'](_0x214785);};}exports[_0x137c('0x26')]=function(_0x2676ea,_0x37a65e){var _0x16c5e2={},_0x43ebb9={},_0x2a5cea={'count':0x0,'rows':[]};var _0xc07981=_[_0x137c('0x27')](db[_0x137c('0x28')][_0x137c('0x29')],function(_0x42d4ca){return{'name':_0x42d4ca[_0x137c('0x2a')],'type':_0x42d4ca[_0x137c('0x2b')][_0x137c('0x2c')]};});_0x43ebb9['model']=_['map'](_0xc07981,_0x137c('0x25'));_0x43ebb9[_0x137c('0x2d')]=_[_0x137c('0x2e')](_0x2676ea[_0x137c('0x2d')]);_0x43ebb9[_0x137c('0x2f')]=_['intersection'](_0x43ebb9['model'],_0x43ebb9[_0x137c('0x2d')]);_0x16c5e2[_0x137c('0x30')]=_['intersection'](_0x43ebb9[_0x137c('0x31')],qs[_0x137c('0x32')](_0x2676ea[_0x137c('0x2d')]['fields']));_0x16c5e2[_0x137c('0x30')]=_0x16c5e2[_0x137c('0x30')][_0x137c('0x33')]?_0x16c5e2[_0x137c('0x30')]:_0x43ebb9[_0x137c('0x31')];if(!_0x2676ea[_0x137c('0x2d')][_0x137c('0x34')](_0x137c('0x35'))){_0x16c5e2[_0x137c('0x1b')]=qs['limit'](_0x2676ea[_0x137c('0x2d')][_0x137c('0x1b')]);_0x16c5e2[_0x137c('0x1e')]=qs[_0x137c('0x1e')](_0x2676ea[_0x137c('0x2d')][_0x137c('0x1e')]);}_0x16c5e2[_0x137c('0x36')]=qs['sort'](_0x2676ea[_0x137c('0x2d')][_0x137c('0x37')]);_0x16c5e2[_0x137c('0x38')]=qs[_0x137c('0x2f')](_[_0x137c('0x39')](_0x2676ea['query'],_0x43ebb9['filters']),_0xc07981);if(_0x2676ea[_0x137c('0x2d')][_0x137c('0x3a')]){_0x16c5e2[_0x137c('0x38')]=_['merge'](_0x16c5e2[_0x137c('0x38')],{'$or':_['map'](_0xc07981,function(_0x3fd9ad){if(_0x3fd9ad[_0x137c('0x2b')]!==_0x137c('0x3b')){var _0x423471={};_0x423471[_0x3fd9ad[_0x137c('0x25')]]={'$like':'%'+_0x2676ea[_0x137c('0x2d')][_0x137c('0x3a')]+'%'};return _0x423471;}})});}_0x16c5e2=_[_0x137c('0x3c')]({},_0x16c5e2,_0x2676ea['options']);var _0x5bcb3a={'where':_0x16c5e2[_0x137c('0x38')]};return db[_0x137c('0x28')][_0x137c('0x1d')](_0x5bcb3a)['then'](function(_0x137e21){_0x2a5cea[_0x137c('0x1d')]=_0x137e21;if(_0x2676ea[_0x137c('0x2d')][_0x137c('0x3d')]){_0x16c5e2['include']=[{'all':!![]}];}return db[_0x137c('0x28')]['findAll'](_0x16c5e2);})[_0x137c('0x23')](function(_0x1a9af5){_0x2a5cea[_0x137c('0x3e')]=_0x1a9af5;return _0x2a5cea;})[_0x137c('0x23')](respondWithFilteredResult(_0x37a65e,_0x16c5e2))[_0x137c('0x3f')](handleError(_0x37a65e,null));};exports['show']=function(_0x4dd418,_0x1b14b6){var _0x1dd6f5={'raw':!![],'where':{'id':_0x4dd418[_0x137c('0x40')]['id']}},_0x2f1c3a={};_0x2f1c3a[_0x137c('0x31')]=_[_0x137c('0x2e')](db[_0x137c('0x28')][_0x137c('0x29')]);_0x2f1c3a[_0x137c('0x2d')]=_[_0x137c('0x2e')](_0x4dd418['query']);_0x2f1c3a[_0x137c('0x2f')]=_[_0x137c('0x41')](_0x2f1c3a[_0x137c('0x31')],_0x2f1c3a['query']);_0x1dd6f5[_0x137c('0x30')]=_['intersection'](_0x2f1c3a['model'],qs['fields'](_0x4dd418[_0x137c('0x2d')]['fields']));_0x1dd6f5[_0x137c('0x30')]=_0x1dd6f5[_0x137c('0x30')][_0x137c('0x33')]?_0x1dd6f5[_0x137c('0x30')]:_0x2f1c3a[_0x137c('0x31')];if(_0x4dd418[_0x137c('0x2d')][_0x137c('0x3d')]){_0x1dd6f5[_0x137c('0x42')]=[{'all':!![]}];}_0x1dd6f5=_[_0x137c('0x3c')]({},_0x1dd6f5,_0x4dd418['options']);return db[_0x137c('0x28')][_0x137c('0x43')](_0x1dd6f5)['then'](handleEntityNotFound(_0x1b14b6,null))[_0x137c('0x23')](respondWithResult(_0x1b14b6,null))[_0x137c('0x3f')](handleError(_0x1b14b6,null));};exports['create']=function(_0x4d0fa4,_0x3b785e){return db[_0x137c('0x28')][_0x137c('0x44')](_0x4d0fa4[_0x137c('0x45')],{})[_0x137c('0x23')](respondWithResult(_0x3b785e,0xc9))[_0x137c('0x3f')](handleError(_0x3b785e,null));};exports[_0x137c('0x46')]=function(_0x33e168,_0x8d6f2f){if(_0x33e168[_0x137c('0x45')]['id']){delete _0x33e168[_0x137c('0x45')]['id'];}return db[_0x137c('0x28')][_0x137c('0x43')]({'where':{'id':_0x33e168[_0x137c('0x40')]['id']}})[_0x137c('0x23')](handleEntityNotFound(_0x8d6f2f,null))[_0x137c('0x23')](saveUpdates(_0x33e168['body'],null))[_0x137c('0x23')](respondWithResult(_0x8d6f2f,null))[_0x137c('0x3f')](handleError(_0x8d6f2f,null));};exports[_0x137c('0x47')]=function(_0x137316,_0x2fc681){return db['AnalyticTreeReport'][_0x137c('0x43')]({'where':{'id':_0x137316[_0x137c('0x40')]['id']}})['then'](handleEntityNotFound(_0x2fc681,null))['then'](removeEntity(_0x2fc681,null))[_0x137c('0x3f')](handleError(_0x2fc681,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 93d446e..4b5fa11 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 _0x10cd=['exports','define','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','./analyticTreeReport.attributes'];(function(_0x786267,_0x4ada9e){var _0x1a9c41=function(_0x1fc5ff){while(--_0x1fc5ff){_0x786267['push'](_0x786267['shift']());}};_0x1a9c41(++_0x4ada9e);}(_0x10cd,0x1e8));var _0xd10c=function(_0x2f4685,_0x2fd125){_0x2f4685=_0x2f4685-0x0;var _0x53fa5a=_0x10cd[_0x2f4685];return _0x53fa5a;};'use strict';var _=require(_0xd10c('0x0'));var util=require('util');var logger=require(_0xd10c('0x1'))('api');var moment=require(_0xd10c('0x2'));var BPromise=require(_0xd10c('0x3'));var rp=require(_0xd10c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd10c('0x5'));var config=require('../../config/environment');var attributes=require(_0xd10c('0x6'));module[_0xd10c('0x7')]=function(_0x37c830,_0xbb4249){return _0x37c830[_0xd10c('0x8')](_0xd10c('0x9'),attributes,{'tableName':_0xd10c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x782e=['AnalyticTreeReport','analytics_report_trees','lodash','util','api','bluebird','request-promise','path','../../config/environment','define'];(function(_0x11da92,_0x3387b7){var _0x626bff=function(_0xea1a16){while(--_0xea1a16){_0x11da92['push'](_0x11da92['shift']());}};_0x626bff(++_0x3387b7);}(_0x782e,0x16a));var _0xe782=function(_0x222238,_0x452268){_0x222238=_0x222238-0x0;var _0x3a4606=_0x782e[_0x222238];return _0x3a4606;};'use strict';var _=require(_0xe782('0x0'));var util=require(_0xe782('0x1'));var logger=require('../../config/logger')(_0xe782('0x2'));var moment=require('moment');var BPromise=require(_0xe782('0x3'));var rp=require(_0xe782('0x4'));var fs=require('fs');var path=require(_0xe782('0x5'));var rimraf=require('rimraf');var config=require(_0xe782('0x6'));var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0x627316,_0x5c044a){return _0x627316[_0xe782('0x7')](_0xe782('0x8'),attributes,{'tableName':_0xe782('0x9'),'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 2029427..e905c6f 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x5becec,_0x68fa69){var _0x2cca56=function(_0xa3c7ba){while(--_0xa3c7ba){_0x5becec['push'](_0x5becec['shift']());}};_0x2cca56(++_0x68fa69);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xc4aa[_0x1caf6a];return _0x1bf493;};'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')]('AnalyticTreeReport,\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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x3c4a17,_0x4bb957){var _0x2d0d6e=function(_0x5e66a2){while(--_0x5e66a2){_0x3c4a17['push'](_0x3c4a17['shift']());}};_0x2d0d6e(++_0x4bb957);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xc4aa[_0x21549c];return _0x426cbd;};'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')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 29a9214..3fd19c4 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 _0x3d89=['../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','multer','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x2e9187,_0x3763f6){var _0x1fc3a8=function(_0xb30d96){while(--_0xb30d96){_0x2e9187['push'](_0x2e9187['shift']());}};_0x1fc3a8(++_0x3763f6);}(_0x3d89,0x19a));var _0x93d8=function(_0x5740f5,_0x2e9f5c){_0x5740f5=_0x5740f5-0x0;var _0x33225e=_0x3d89[_0x5740f5];return _0x33225e;};'use strict';var multer=require(_0x93d8('0x0'));var util=require(_0x93d8('0x1'));var path=require(_0x93d8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x93d8('0x3')]();var fs_extra=require(_0x93d8('0x4'));var auth=require(_0x93d8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x93d8('0x6'));var controller=require('./analyticTreeReport.controller');router[_0x93d8('0x7')]('/',auth[_0x93d8('0x8')](),controller[_0x93d8('0x9')]);router['get'](_0x93d8('0xa'),auth[_0x93d8('0x8')](),controller[_0x93d8('0xb')]);router[_0x93d8('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x93d8('0xd')](_0x93d8('0xa'),auth[_0x93d8('0x8')](),controller[_0x93d8('0xe')]);router[_0x93d8('0xf')](_0x93d8('0xa'),auth[_0x93d8('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x61f2=['multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get','index','post','isAuthenticated','create','put','/:id','update','delete','destroy','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x61f2,0xfc));var _0x261f=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x61f2[_0xa6cc5c];return _0x44803d;};'use strict';var multer=require(_0x261f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x261f('0x1'));var express=require('express');var router=express[_0x261f('0x2')]();var fs_extra=require(_0x261f('0x3'));var auth=require(_0x261f('0x4'));var interaction=require(_0x261f('0x5'));var config=require('../../config/environment');var controller=require(_0x261f('0x6'));router[_0x261f('0x7')]('/',auth['isAuthenticated'](),controller[_0x261f('0x8')]);router[_0x261f('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x261f('0x9')]('/',auth[_0x261f('0xa')](),controller[_0x261f('0xb')]);router[_0x261f('0xc')](_0x261f('0xd'),auth[_0x261f('0xa')](),controller[_0x261f('0xe')]);router[_0x261f('0xf')](_0x261f('0xd'),auth['isAuthenticated'](),controller[_0x261f('0x10')]);module[_0x261f('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index c864834..1fa0279 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 _0x6953=['exports','sequelize'];(function(_0x110d6f,_0x20d9f7){var _0x2ca679=function(_0x4df890){while(--_0x4df890){_0x110d6f['push'](_0x110d6f['shift']());}};_0x2ca679(++_0x20d9f7);}(_0x6953,0x91));var _0x3695=function(_0x426c38,_0x56b57a){_0x426c38=_0x426c38-0x0;var _0x2a38cd=_0x6953[_0x426c38];return _0x2a38cd;};'use strict';var Sequelize=require(_0x3695('0x0'));module[_0x3695('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaefc=['exports','STRING','sequelize'];(function(_0x28fca4,_0x11e78b){var _0x42fd01=function(_0x33a97e){while(--_0x33a97e){_0x28fca4['push'](_0x28fca4['shift']());}};_0x42fd01(++_0x11e78b);}(_0xaefc,0xc8));var _0xcaef=function(_0x419b6a,_0x265b43){_0x419b6a=_0x419b6a-0x0;var _0x229232=_0xaefc[_0x419b6a];return _0x229232;};'use strict';var Sequelize=require(_0xcaef('0x0'));module[_0xcaef('0x1')]={'name':{'type':Sequelize[_0xcaef('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xcaef('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 403d6b0..e890fb7 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 _0x5373=['apply','reject','save','update','then','name','send','index','map','Attachment','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','findAll','rows','catch','show','params','keys','includeAll','clone','include','find','get','omit','createdAt','updatedAt','body','destroy','create','file','basename','filename','mimetype','download','findOne','root','server/files/attachments/','join','offline-chat/','eml-format','rimraf','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x5373,0x193));var _0x3537=function(_0x391e08,_0x1c355b){_0x391e08=_0x391e08-0x0;var _0xa7f8df=_0x5373[_0x391e08];return _0xa7f8df;};'use strict';var emlformat=require(_0x3537('0x0'));var rimraf=require(_0x3537('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3537('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3537('0x3'));var util=require(_0x3537('0x4'));var path=require(_0x3537('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3537('0x6'));var fs=require('fs');var fs_extra=require(_0x3537('0x7'));var _=require(_0x3537('0x8'));var squel=require(_0x3537('0x9'));var crypto=require('crypto');var jsforce=require(_0x3537('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3537('0xb'));var Papa=require(_0x3537('0xc'));var Redis=require(_0x3537('0xd'));var authService=require(_0x3537('0xe'));var qs=require(_0x3537('0xf'));var as=require(_0x3537('0x10'));var hardwareService=require(_0x3537('0x11'));var logger=require(_0x3537('0x12'))(_0x3537('0x13'));var utils=require(_0x3537('0x14'));var config=require(_0x3537('0x15'));var licenseUtil=require(_0x3537('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ce3c9,_0xbb94ec){_0xbb94ec=_0xbb94ec||0xcc;return function(_0x45c3a7){if(_0x45c3a7){return _0x5ce3c9[_0x3537('0x17')](_0xbb94ec);}return _0x5ce3c9[_0x3537('0x18')](_0xbb94ec)[_0x3537('0x19')]();};}function respondWithResult(_0xc0ced1,_0x2dbd84){_0x2dbd84=_0x2dbd84||0xc8;return function(_0x5d9b18){if(_0x5d9b18){return _0xc0ced1[_0x3537('0x18')](_0x2dbd84)['json'](_0x5d9b18);}};}function respondWithFilteredResult(_0x4b3ccc,_0x4cb363){return function(_0x2b3438){if(_0x2b3438){var _0x15aa6c=typeof _0x4cb363[_0x3537('0x1a')]===_0x3537('0x1b')&&typeof _0x4cb363[_0x3537('0x1c')]===_0x3537('0x1b');var _0xb1871c=_0x2b3438[_0x3537('0x1d')];var _0x449b3f=_0x15aa6c?0x0:_0x4cb363['offset'];var _0x330fd1=_0x15aa6c?_0x2b3438[_0x3537('0x1d')]:_0x4cb363[_0x3537('0x1a')]+_0x4cb363['limit'];var _0x131545;if(_0x330fd1>=_0xb1871c){_0x330fd1=_0xb1871c;_0x131545=0xc8;}else{_0x131545=0xce;}_0x4b3ccc[_0x3537('0x18')](_0x131545);return _0x4b3ccc['set'](_0x3537('0x1e'),_0x449b3f+'-'+_0x330fd1+'/'+_0xb1871c)[_0x3537('0x1f')](_0x2b3438);}return null;};}function patchUpdates(_0x4a4736){return function(_0x2ac3bc){try{jsonpatch[_0x3537('0x20')](_0x2ac3bc,_0x4a4736,!![]);}catch(_0x4d794d){return BPromise[_0x3537('0x21')](_0x4d794d);}return _0x2ac3bc[_0x3537('0x22')]();};}function saveUpdates(_0x9cb0c3,_0xb1e143){return function(_0x294b1f){if(_0x294b1f){return _0x294b1f[_0x3537('0x23')](_0x9cb0c3)['then'](function(_0xb5563d){return _0xb5563d;});}return null;};}function removeEntity(_0x335e4c,_0x41d4ef){return function(_0x11dd97){if(_0x11dd97){return _0x11dd97['destroy']()[_0x3537('0x24')](function(){_0x335e4c[_0x3537('0x18')](0xcc)[_0x3537('0x19')]();});}};}function handleEntityNotFound(_0x312e82,_0x542edc){return function(_0x5d5caa){if(!_0x5d5caa){_0x312e82[_0x3537('0x17')](0x194);}return _0x5d5caa;};}function handleError(_0x2ae8a0,_0x3489f1){_0x3489f1=_0x3489f1||0x1f4;return function(_0x27323b){logger['error'](_0x27323b['stack']);if(_0x27323b['name']){delete _0x27323b[_0x3537('0x25')];}_0x2ae8a0['status'](_0x3489f1)[_0x3537('0x26')](_0x27323b);};}exports[_0x3537('0x27')]=function(_0x514ec1,_0x422eec){var _0x3a17e7={},_0x217f78={},_0x4368fe={'count':0x0,'rows':[]};var _0x3b3711=_[_0x3537('0x28')](db[_0x3537('0x29')][_0x3537('0x2a')],function(_0x2d3a68){return{'name':_0x2d3a68['fieldName'],'type':_0x2d3a68[_0x3537('0x2b')][_0x3537('0x2c')]};});_0x217f78[_0x3537('0x2d')]=_['map'](_0x3b3711,'name');_0x217f78[_0x3537('0x2e')]=_['keys'](_0x514ec1[_0x3537('0x2e')]);_0x217f78[_0x3537('0x2f')]=_[_0x3537('0x30')](_0x217f78['model'],_0x217f78[_0x3537('0x2e')]);_0x3a17e7[_0x3537('0x31')]=_[_0x3537('0x30')](_0x217f78[_0x3537('0x2d')],qs[_0x3537('0x32')](_0x514ec1['query']['fields']));_0x3a17e7['attributes']=_0x3a17e7[_0x3537('0x31')][_0x3537('0x33')]?_0x3a17e7[_0x3537('0x31')]:_0x217f78[_0x3537('0x2d')];if(!_0x514ec1[_0x3537('0x2e')]['hasOwnProperty'](_0x3537('0x34'))){_0x3a17e7[_0x3537('0x1c')]=qs[_0x3537('0x1c')](_0x514ec1[_0x3537('0x2e')][_0x3537('0x1c')]);_0x3a17e7[_0x3537('0x1a')]=qs[_0x3537('0x1a')](_0x514ec1[_0x3537('0x2e')][_0x3537('0x1a')]);}_0x3a17e7[_0x3537('0x35')]=qs['sort'](_0x514ec1[_0x3537('0x2e')][_0x3537('0x36')]);_0x3a17e7[_0x3537('0x37')]=qs[_0x3537('0x2f')](_[_0x3537('0x38')](_0x514ec1[_0x3537('0x2e')],_0x217f78[_0x3537('0x2f')]),_0x3b3711);if(_0x514ec1['query'][_0x3537('0x39')]){_0x3a17e7['where']=_['merge'](_0x3a17e7['where'],{'$or':_[_0x3537('0x28')](_0x3b3711,function(_0x1b17dd){if(_0x1b17dd[_0x3537('0x2b')]!=='VIRTUAL'){var _0x3ed045={};_0x3ed045[_0x1b17dd[_0x3537('0x25')]]={'$like':'%'+_0x514ec1['query'][_0x3537('0x39')]+'%'};return _0x3ed045;}})});}_0x3a17e7=_[_0x3537('0x3a')]({},_0x3a17e7,_0x514ec1[_0x3537('0x3b')]);var _0x316295={'where':_0x3a17e7[_0x3537('0x37')]};return db[_0x3537('0x29')][_0x3537('0x1d')](_0x316295)[_0x3537('0x24')](function(_0x52c392){_0x4368fe[_0x3537('0x1d')]=_0x52c392;if(_0x514ec1[_0x3537('0x2e')]['includeAll']){_0x3a17e7['include']=[{'all':!![]}];}return db['Attachment'][_0x3537('0x3c')](_0x3a17e7);})[_0x3537('0x24')](function(_0xe679e4){_0x4368fe[_0x3537('0x3d')]=_0xe679e4;return _0x4368fe;})['then'](respondWithFilteredResult(_0x422eec,_0x3a17e7))[_0x3537('0x3e')](handleError(_0x422eec,null));};exports[_0x3537('0x3f')]=function(_0x2ade29,_0x48a62c){var _0x5b98c6={'raw':!![],'where':{'id':_0x2ade29[_0x3537('0x40')]['id']}},_0x39f96c={};_0x39f96c[_0x3537('0x2d')]=_[_0x3537('0x41')](db[_0x3537('0x29')]['rawAttributes']);_0x39f96c[_0x3537('0x2e')]=_[_0x3537('0x41')](_0x2ade29[_0x3537('0x2e')]);_0x39f96c[_0x3537('0x2f')]=_[_0x3537('0x30')](_0x39f96c['model'],_0x39f96c[_0x3537('0x2e')]);_0x5b98c6['attributes']=_[_0x3537('0x30')](_0x39f96c[_0x3537('0x2d')],qs[_0x3537('0x32')](_0x2ade29['query']['fields']));_0x5b98c6[_0x3537('0x31')]=_0x5b98c6[_0x3537('0x31')][_0x3537('0x33')]?_0x5b98c6['attributes']:_0x39f96c[_0x3537('0x2d')];if(_0x2ade29['query'][_0x3537('0x42')]){_0x5b98c6['include']=[{'all':!![]}];}_0x5b98c6=_['merge']({},_0x5b98c6,_0x2ade29[_0x3537('0x3b')]);return db['Attachment']['find'](_0x5b98c6)['then'](handleEntityNotFound(_0x48a62c,null))['then'](respondWithResult(_0x48a62c,null))['catch'](handleError(_0x48a62c,null));};exports[_0x3537('0x43')]=function(_0x968090,_0x16899f){var _0x46317e={'where':{'id':_0x968090[_0x3537('0x40')]['id']}},_0x2626cb={};_0x2626cb['model']=_[_0x3537('0x41')](db[_0x3537('0x29')][_0x3537('0x2a')]);_0x46317e[_0x3537('0x31')]=_[_0x3537('0x30')](_0x2626cb[_0x3537('0x2d')],qs['fields'](_0x968090[_0x3537('0x2e')][_0x3537('0x32')]));_0x46317e['attributes']=_0x46317e[_0x3537('0x31')]['length']?_0x46317e['attributes']:_0x2626cb[_0x3537('0x2d')];if(_0x968090['query'][_0x3537('0x42')]){_0x46317e[_0x3537('0x44')]=[{'all':!![]}];}_0x46317e=_['merge']({},_0x46317e,_0x968090[_0x3537('0x3b')]);return db['Attachment'][_0x3537('0x45')](_0x46317e)[_0x3537('0x24')](handleEntityNotFound(_0x16899f,null))[_0x3537('0x24')](function(_0x66ef22){if(_0x66ef22){var _0x23ab87=_0x66ef22[_0x3537('0x46')]({'plain':!![]});_0x23ab87=qs[_0x3537('0x47')](_0x23ab87,['id',_0x3537('0x48'),_0x3537('0x49')]);_0x968090[_0x3537('0x4a')]=_[_0x3537('0x47')](_0x968090[_0x3537('0x4a')],['id',_0x3537('0x48'),_0x3537('0x49')]);return db[_0x3537('0x29')]['create'](_[_0x3537('0x3a')](_0x23ab87,_0x968090['body']),{'include':_0x968090[_0x3537('0x2e')][_0x3537('0x42')]?[{'all':!![]}]:undefined});}})[_0x3537('0x24')](respondWithResult(_0x16899f,0xc9))['catch'](handleError(_0x16899f,null));};exports[_0x3537('0x23')]=function(_0x2f8732,_0x42f177){if(_0x2f8732[_0x3537('0x4a')]['id']){delete _0x2f8732[_0x3537('0x4a')]['id'];}return db[_0x3537('0x29')][_0x3537('0x45')]({'where':{'id':_0x2f8732[_0x3537('0x40')]['id']}})['then'](handleEntityNotFound(_0x42f177,null))[_0x3537('0x24')](saveUpdates(_0x2f8732[_0x3537('0x4a')],null))[_0x3537('0x24')](respondWithResult(_0x42f177,null))['catch'](handleError(_0x42f177,null));};exports[_0x3537('0x4b')]=function(_0x581cfd,_0x2bb1bf){return db[_0x3537('0x29')]['find']({'where':{'id':_0x581cfd[_0x3537('0x40')]['id']}})[_0x3537('0x24')](handleEntityNotFound(_0x2bb1bf,null))[_0x3537('0x24')](removeEntity(_0x2bb1bf,null))[_0x3537('0x3e')](handleError(_0x2bb1bf,null));};exports[_0x3537('0x4c')]=function(_0x2ea66c,_0x9aac49,_0x161b25){_0x2ea66c[_0x3537('0x4a')][_0x3537('0x25')]=_0x2ea66c[_0x3537('0x4d')]['originalname'];_0x2ea66c['body'][_0x3537('0x4e')]=_0x2ea66c['file'][_0x3537('0x4f')];_0x2ea66c[_0x3537('0x4a')][_0x3537('0x2b')]=_0x2ea66c[_0x3537('0x4d')][_0x3537('0x50')];return db[_0x3537('0x29')][_0x3537('0x4c')](_0x2ea66c[_0x3537('0x4a')])[_0x3537('0x24')](respondWithResult(_0x9aac49,0xc9))[_0x3537('0x3e')](handleError(_0x9aac49,null));};exports[_0x3537('0x51')]=function(_0x8e11bd,_0x5d8668,_0x489b7e){return db[_0x3537('0x29')][_0x3537('0x52')]({'where':{'id':_0x8e11bd['params']['id']},'raw':!![]})[_0x3537('0x24')](handleEntityNotFound(_0x5d8668,null))['then'](function(_0x449fea){if(_0x449fea){var _0x531242=_0x449fea['ChatOfflineMessageId']!==null;var _0xe095f2=path['join'](config[_0x3537('0x53')],_0x3537('0x54'));if(_0x531242){_0xe095f2=path[_0x3537('0x55')](_0xe095f2,_0x3537('0x56'));}var _0x23a6ff=path[_0x3537('0x55')](_0xe095f2,_0x449fea[_0x3537('0x4e')]);return _0x5d8668[_0x3537('0x51')](_0x23a6ff);}})[_0x3537('0x3e')](handleError(_0x5d8668,null));}; \ No newline at end of file +var _0x8b85=['request-promise','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','name','send','index','map','Attachment','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','keys','rawAttributes','include','find','clone','get','updatedAt','body','omit','create','file','originalname','basename','filename','download','ChatOfflineMessageId','join','root','offline-chat/','eml-format','rimraf','fast-json-patch'];(function(_0x42e626,_0x3973d4){var _0x1c324e=function(_0x1e7c0f){while(--_0x1e7c0f){_0x42e626['push'](_0x42e626['shift']());}};_0x1c324e(++_0x3973d4);}(_0x8b85,0xa7));var _0x58b8=function(_0x470f24,_0x2436a9){_0x470f24=_0x470f24-0x0;var _0x2c6fc8=_0x8b85[_0x470f24];return _0x2c6fc8;};'use strict';var emlformat=require(_0x58b8('0x0'));var rimraf=require(_0x58b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x58b8('0x2'));var rp=require(_0x58b8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x58b8('0x4'));var util=require(_0x58b8('0x5'));var path=require(_0x58b8('0x6'));var sox=require(_0x58b8('0x7'));var csv=require('to-csv');var ejs=require(_0x58b8('0x8'));var fs=require('fs');var fs_extra=require(_0x58b8('0x9'));var _=require('lodash');var squel=require(_0x58b8('0xa'));var crypto=require(_0x58b8('0xb'));var jsforce=require(_0x58b8('0xc'));var deskjs=require(_0x58b8('0xd'));var toCsv=require(_0x58b8('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x58b8('0xf'));var authService=require(_0x58b8('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x58b8('0x11'));var logger=require(_0x58b8('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x58b8('0x13'));var licenseUtil=require(_0x58b8('0x14'));var db=require(_0x58b8('0x15'))['db'];function respondWithStatusCode(_0x1b4038,_0x4863c2){_0x4863c2=_0x4863c2||0xcc;return function(_0x3347ac){if(_0x3347ac){return _0x1b4038[_0x58b8('0x16')](_0x4863c2);}return _0x1b4038[_0x58b8('0x17')](_0x4863c2)[_0x58b8('0x18')]();};}function respondWithResult(_0xc8c641,_0xf5fa31){_0xf5fa31=_0xf5fa31||0xc8;return function(_0x42ec6e){if(_0x42ec6e){return _0xc8c641[_0x58b8('0x17')](_0xf5fa31)[_0x58b8('0x19')](_0x42ec6e);}};}function respondWithFilteredResult(_0x21c42d,_0x12abba){return function(_0x3db64e){if(_0x3db64e){var _0x4b7a28=typeof _0x12abba[_0x58b8('0x1a')]===_0x58b8('0x1b')&&typeof _0x12abba[_0x58b8('0x1c')]==='undefined';var _0x123ba4=_0x3db64e[_0x58b8('0x1d')];var _0x58a9e5=_0x4b7a28?0x0:_0x12abba[_0x58b8('0x1a')];var _0x2e17df=_0x4b7a28?_0x3db64e[_0x58b8('0x1d')]:_0x12abba[_0x58b8('0x1a')]+_0x12abba[_0x58b8('0x1c')];var _0x2c3eca;if(_0x2e17df>=_0x123ba4){_0x2e17df=_0x123ba4;_0x2c3eca=0xc8;}else{_0x2c3eca=0xce;}_0x21c42d['status'](_0x2c3eca);return _0x21c42d[_0x58b8('0x1e')](_0x58b8('0x1f'),_0x58a9e5+'-'+_0x2e17df+'/'+_0x123ba4)['json'](_0x3db64e);}return null;};}function patchUpdates(_0x1fcfe6){return function(_0x2fa4f3){try{jsonpatch[_0x58b8('0x20')](_0x2fa4f3,_0x1fcfe6,!![]);}catch(_0x30e247){return BPromise[_0x58b8('0x21')](_0x30e247);}return _0x2fa4f3['save']();};}function saveUpdates(_0x43e674,_0x203a74){return function(_0x48d5b2){if(_0x48d5b2){return _0x48d5b2['update'](_0x43e674)[_0x58b8('0x22')](function(_0x2692aa){return _0x2692aa;});}return null;};}function removeEntity(_0x219559,_0x229f2b){return function(_0x47f252){if(_0x47f252){return _0x47f252[_0x58b8('0x23')]()[_0x58b8('0x22')](function(){_0x219559[_0x58b8('0x17')](0xcc)[_0x58b8('0x18')]();});}};}function handleEntityNotFound(_0x1fc9f8,_0x94570e){return function(_0x3c201f){if(!_0x3c201f){_0x1fc9f8[_0x58b8('0x16')](0x194);}return _0x3c201f;};}function handleError(_0x13b820,_0x21383b){_0x21383b=_0x21383b||0x1f4;return function(_0x5ed2d3){logger[_0x58b8('0x24')](_0x5ed2d3['stack']);if(_0x5ed2d3[_0x58b8('0x25')]){delete _0x5ed2d3[_0x58b8('0x25')];}_0x13b820[_0x58b8('0x17')](_0x21383b)[_0x58b8('0x26')](_0x5ed2d3);};}exports[_0x58b8('0x27')]=function(_0x5c2615,_0x336d9b){var _0x4e67d1={},_0x9ca5da={},_0x1f9312={'count':0x0,'rows':[]};var _0x1fd0d8=_[_0x58b8('0x28')](db[_0x58b8('0x29')]['rawAttributes'],function(_0x3c4213){return{'name':_0x3c4213[_0x58b8('0x2a')],'type':_0x3c4213[_0x58b8('0x2b')][_0x58b8('0x2c')]};});_0x9ca5da['model']=_[_0x58b8('0x28')](_0x1fd0d8,_0x58b8('0x25'));_0x9ca5da['query']=_['keys'](_0x5c2615[_0x58b8('0x2d')]);_0x9ca5da[_0x58b8('0x2e')]=_[_0x58b8('0x2f')](_0x9ca5da[_0x58b8('0x30')],_0x9ca5da[_0x58b8('0x2d')]);_0x4e67d1[_0x58b8('0x31')]=_['intersection'](_0x9ca5da[_0x58b8('0x30')],qs[_0x58b8('0x32')](_0x5c2615[_0x58b8('0x2d')]['fields']));_0x4e67d1[_0x58b8('0x31')]=_0x4e67d1[_0x58b8('0x31')][_0x58b8('0x33')]?_0x4e67d1['attributes']:_0x9ca5da[_0x58b8('0x30')];if(!_0x5c2615[_0x58b8('0x2d')][_0x58b8('0x34')](_0x58b8('0x35'))){_0x4e67d1[_0x58b8('0x1c')]=qs[_0x58b8('0x1c')](_0x5c2615[_0x58b8('0x2d')]['limit']);_0x4e67d1[_0x58b8('0x1a')]=qs[_0x58b8('0x1a')](_0x5c2615[_0x58b8('0x2d')][_0x58b8('0x1a')]);}_0x4e67d1['order']=qs[_0x58b8('0x36')](_0x5c2615[_0x58b8('0x2d')][_0x58b8('0x36')]);_0x4e67d1['where']=qs['filters'](_[_0x58b8('0x37')](_0x5c2615[_0x58b8('0x2d')],_0x9ca5da[_0x58b8('0x2e')]),_0x1fd0d8);if(_0x5c2615[_0x58b8('0x2d')]['filter']){_0x4e67d1[_0x58b8('0x38')]=_[_0x58b8('0x39')](_0x4e67d1['where'],{'$or':_['map'](_0x1fd0d8,function(_0x50bfd4){if(_0x50bfd4['type']!==_0x58b8('0x3a')){var _0x5c4bef={};_0x5c4bef[_0x50bfd4[_0x58b8('0x25')]]={'$like':'%'+_0x5c2615[_0x58b8('0x2d')][_0x58b8('0x3b')]+'%'};return _0x5c4bef;}})});}_0x4e67d1=_['merge']({},_0x4e67d1,_0x5c2615[_0x58b8('0x3c')]);var _0x1484f0={'where':_0x4e67d1['where']};return db['Attachment']['count'](_0x1484f0)[_0x58b8('0x22')](function(_0x1e4f6a){_0x1f9312['count']=_0x1e4f6a;if(_0x5c2615['query'][_0x58b8('0x3d')]){_0x4e67d1['include']=[{'all':!![]}];}return db[_0x58b8('0x29')]['findAll'](_0x4e67d1);})['then'](function(_0x29cc97){_0x1f9312[_0x58b8('0x3e')]=_0x29cc97;return _0x1f9312;})[_0x58b8('0x22')](respondWithFilteredResult(_0x336d9b,_0x4e67d1))[_0x58b8('0x3f')](handleError(_0x336d9b,null));};exports[_0x58b8('0x40')]=function(_0x2c5177,_0x120035){var _0x4a28f1={'raw':!![],'where':{'id':_0x2c5177[_0x58b8('0x41')]['id']}},_0x385eac={};_0x385eac[_0x58b8('0x30')]=_[_0x58b8('0x42')](db[_0x58b8('0x29')][_0x58b8('0x43')]);_0x385eac[_0x58b8('0x2d')]=_[_0x58b8('0x42')](_0x2c5177[_0x58b8('0x2d')]);_0x385eac[_0x58b8('0x2e')]=_[_0x58b8('0x2f')](_0x385eac[_0x58b8('0x30')],_0x385eac[_0x58b8('0x2d')]);_0x4a28f1[_0x58b8('0x31')]=_[_0x58b8('0x2f')](_0x385eac[_0x58b8('0x30')],qs[_0x58b8('0x32')](_0x2c5177['query']['fields']));_0x4a28f1[_0x58b8('0x31')]=_0x4a28f1['attributes'][_0x58b8('0x33')]?_0x4a28f1['attributes']:_0x385eac['model'];if(_0x2c5177['query']['includeAll']){_0x4a28f1[_0x58b8('0x44')]=[{'all':!![]}];}_0x4a28f1=_[_0x58b8('0x39')]({},_0x4a28f1,_0x2c5177[_0x58b8('0x3c')]);return db[_0x58b8('0x29')][_0x58b8('0x45')](_0x4a28f1)[_0x58b8('0x22')](handleEntityNotFound(_0x120035,null))['then'](respondWithResult(_0x120035,null))[_0x58b8('0x3f')](handleError(_0x120035,null));};exports[_0x58b8('0x46')]=function(_0x24d0b3,_0xf89ad){var _0x526e15={'where':{'id':_0x24d0b3['params']['id']}},_0x326930={};_0x326930[_0x58b8('0x30')]=_[_0x58b8('0x42')](db[_0x58b8('0x29')][_0x58b8('0x43')]);_0x526e15[_0x58b8('0x31')]=_[_0x58b8('0x2f')](_0x326930[_0x58b8('0x30')],qs[_0x58b8('0x32')](_0x24d0b3[_0x58b8('0x2d')][_0x58b8('0x32')]));_0x526e15['attributes']=_0x526e15[_0x58b8('0x31')][_0x58b8('0x33')]?_0x526e15[_0x58b8('0x31')]:_0x326930['model'];if(_0x24d0b3[_0x58b8('0x2d')][_0x58b8('0x3d')]){_0x526e15[_0x58b8('0x44')]=[{'all':!![]}];}_0x526e15=_[_0x58b8('0x39')]({},_0x526e15,_0x24d0b3[_0x58b8('0x3c')]);return db['Attachment'][_0x58b8('0x45')](_0x526e15)['then'](handleEntityNotFound(_0xf89ad,null))[_0x58b8('0x22')](function(_0x8ffe7e){if(_0x8ffe7e){var _0x1f36c5=_0x8ffe7e[_0x58b8('0x47')]({'plain':!![]});_0x1f36c5=qs['omit'](_0x1f36c5,['id','createdAt',_0x58b8('0x48')]);_0x24d0b3[_0x58b8('0x49')]=_[_0x58b8('0x4a')](_0x24d0b3[_0x58b8('0x49')],['id','createdAt',_0x58b8('0x48')]);return db[_0x58b8('0x29')]['create'](_[_0x58b8('0x39')](_0x1f36c5,_0x24d0b3['body']),{'include':_0x24d0b3[_0x58b8('0x2d')][_0x58b8('0x3d')]?[{'all':!![]}]:undefined});}})[_0x58b8('0x22')](respondWithResult(_0xf89ad,0xc9))['catch'](handleError(_0xf89ad,null));};exports['update']=function(_0x16451c,_0xce39a3){if(_0x16451c[_0x58b8('0x49')]['id']){delete _0x16451c['body']['id'];}return db[_0x58b8('0x29')][_0x58b8('0x45')]({'where':{'id':_0x16451c[_0x58b8('0x41')]['id']}})[_0x58b8('0x22')](handleEntityNotFound(_0xce39a3,null))[_0x58b8('0x22')](saveUpdates(_0x16451c[_0x58b8('0x49')],null))[_0x58b8('0x22')](respondWithResult(_0xce39a3,null))[_0x58b8('0x3f')](handleError(_0xce39a3,null));};exports[_0x58b8('0x23')]=function(_0x51fb93,_0xd74a6){return db[_0x58b8('0x29')][_0x58b8('0x45')]({'where':{'id':_0x51fb93[_0x58b8('0x41')]['id']}})[_0x58b8('0x22')](handleEntityNotFound(_0xd74a6,null))[_0x58b8('0x22')](removeEntity(_0xd74a6,null))[_0x58b8('0x3f')](handleError(_0xd74a6,null));};exports[_0x58b8('0x4b')]=function(_0x287b13,_0x17971b,_0x484c9f){_0x287b13['body'][_0x58b8('0x25')]=_0x287b13[_0x58b8('0x4c')][_0x58b8('0x4d')];_0x287b13[_0x58b8('0x49')][_0x58b8('0x4e')]=_0x287b13[_0x58b8('0x4c')][_0x58b8('0x4f')];_0x287b13[_0x58b8('0x49')]['type']=_0x287b13[_0x58b8('0x4c')]['mimetype'];return db[_0x58b8('0x29')][_0x58b8('0x4b')](_0x287b13[_0x58b8('0x49')])['then'](respondWithResult(_0x17971b,0xc9))['catch'](handleError(_0x17971b,null));};exports[_0x58b8('0x50')]=function(_0x32c32b,_0x2280e7,_0x4168e9){return db['Attachment']['findOne']({'where':{'id':_0x32c32b[_0x58b8('0x41')]['id']},'raw':!![]})[_0x58b8('0x22')](handleEntityNotFound(_0x2280e7,null))[_0x58b8('0x22')](function(_0x1e382e){if(_0x1e382e){var _0x223a7d=_0x1e382e[_0x58b8('0x51')]!==null;var _0x24a51c=path[_0x58b8('0x52')](config[_0x58b8('0x53')],'server/files/attachments/');if(_0x223a7d){_0x24a51c=path['join'](_0x24a51c,_0x58b8('0x54'));}var _0x205232=path[_0x58b8('0x52')](_0x24a51c,_0x1e382e[_0x58b8('0x4e')]);return _0x2280e7['download'](_0x205232);}})[_0x58b8('0x3f')](handleError(_0x2280e7,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 57b9630..9ec035e 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 _0x9732=['../../config/logger','api','bluebird','request-promise','rimraf','exports','Attachment','attachments','lodash'];(function(_0x7a8365,_0x563ade){var _0x55359f=function(_0x344dc2){while(--_0x344dc2){_0x7a8365['push'](_0x7a8365['shift']());}};_0x55359f(++_0x563ade);}(_0x9732,0x1b8));var _0x2973=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x9732[_0x1f36bb];return _0xaf97fa;};'use strict';var _=require(_0x2973('0x0'));var util=require('util');var logger=require(_0x2973('0x1'))(_0x2973('0x2'));var moment=require('moment');var BPromise=require(_0x2973('0x3'));var rp=require(_0x2973('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2973('0x5'));var config=require('../../config/environment');var attributes=require('./attachment.attributes');module[_0x2973('0x6')]=function(_0x3facff,_0x56897f){return _0x3facff['define'](_0x2973('0x7'),attributes,{'tableName':_0x2973('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafca=['util','api','moment','bluebird','path','rimraf','exports','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xafca,0x167));var _0xaafc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xafca[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xaafc('0x0'));var util=require(_0xaafc('0x1'));var logger=require('../../config/logger')(_0xaafc('0x2'));var moment=require(_0xaafc('0x3'));var BPromise=require(_0xaafc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaafc('0x5'));var rimraf=require(_0xaafc('0x6'));var config=require('../../config/environment');var attributes=require('./attachment.attributes');module[_0xaafc('0x7')]=function(_0x2c679d,_0x466ff9){return _0x2c679d['define']('Attachment',attributes,{'tableName':'attachments','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 262f3f6..2a3b44d 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 _0xe706=['result','catch','CreateAttachment','create','body','options','raw','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x4e7cf6,_0x490184){var _0x13c52c=function(_0x4d58ed){while(--_0x4d58ed){_0x4e7cf6['push'](_0x4e7cf6['shift']());}};_0x13c52c(++_0x490184);}(_0xe706,0xa3));var _0x6e70=function(_0x3faaf8,_0x16d9ae){_0x3faaf8=_0x3faaf8-0x0;var _0x1a3527=_0xe706[_0x3faaf8];return _0x1a3527;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('Attachment,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('Attachment,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});}exports[_0x6e70('0x19')]=function(_0x5ea7a5){var _0x28a21f=this;return new Promise(function(_0x173afe,_0x53acdc){return db['Attachment'][_0x6e70('0x1a')](_0x5ea7a5[_0x6e70('0x1b')],{'raw':_0x5ea7a5[_0x6e70('0x1c')]?_0x5ea7a5[_0x6e70('0x1c')][_0x6e70('0x1d')]===undefined?!![]:![]:!![]})[_0x6e70('0xe')](function(_0x1b2453){logger[_0x6e70('0xf')](_0x6e70('0x19'),_0x5ea7a5);logger[_0x6e70('0x12')]('CreateAttachment',_0x5ea7a5,JSON[_0x6e70('0x1e')](_0x1b2453));_0x173afe(_0x1b2453);})[_0x6e70('0x18')](function(_0x27b294){logger['error'](_0x6e70('0x19'),_0x27b294[_0x6e70('0x16')],_0x5ea7a5);_0x53acdc(_0x28a21f[_0x6e70('0x14')](0x1f4,_0x27b294['message']));});});}; \ No newline at end of file +var _0x2dae=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Attachment','body','options','raw','info','CreateAttachment','lodash'];(function(_0x172298,_0x542449){var _0x44856d=function(_0xa648ba){while(--_0xa648ba){_0x172298['push'](_0x172298['shift']());}};_0x44856d(++_0x542449);}(_0x2dae,0xc3));var _0xe2da=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0x2dae[_0x51fe5f];return _0x4abce9;};'use strict';var _=require(_0xe2da('0x0'));var util=require('util');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('../../config/utils');var logger=require(_0xe2da('0x6'))(_0xe2da('0x7'));var config=require(_0xe2da('0x8'));var jayson=require(_0xe2da('0x9'));var client=jayson['client'][_0xe2da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x89c70b,_0x34cc98,_0x2efbd8){return new BPromise(function(_0x238da3,_0x1c71ea){return client[_0xe2da('0xb')](_0x89c70b,_0x2efbd8)[_0xe2da('0xc')](function(_0x68aa40){logger['info'](_0xe2da('0xd'),_0x34cc98,_0xe2da('0xe'));logger[_0xe2da('0xf')](_0xe2da('0x10'),_0x34cc98,_0xe2da('0xe'),JSON[_0xe2da('0x11')](_0x68aa40));if(_0x68aa40[_0xe2da('0x12')]){if(_0x68aa40[_0xe2da('0x12')]['code']===0x1f4){logger[_0xe2da('0x12')]('Attachment,\x20%s,\x20%s',_0x34cc98,_0x68aa40[_0xe2da('0x12')][_0xe2da('0x13')]);return _0x1c71ea(_0x68aa40[_0xe2da('0x12')][_0xe2da('0x13')]);}logger[_0xe2da('0x12')](_0xe2da('0xd'),_0x34cc98,_0x68aa40[_0xe2da('0x12')]['message']);return _0x238da3(_0x68aa40[_0xe2da('0x12')]['message']);}else{logger['info'](_0xe2da('0xd'),_0x34cc98,_0xe2da('0xe'));_0x238da3(_0x68aa40[_0xe2da('0x14')]['message']);}})[_0xe2da('0x15')](function(_0x2c0353){logger[_0xe2da('0x12')](_0xe2da('0xd'),_0x34cc98,_0x2c0353);_0x1c71ea(_0x2c0353);});});}exports['CreateAttachment']=function(_0x45bb92){var _0x1f7d33=this;return new Promise(function(_0x417363,_0x2e5730){return db[_0xe2da('0x16')]['create'](_0x45bb92[_0xe2da('0x17')],{'raw':_0x45bb92[_0xe2da('0x18')]?_0x45bb92['options'][_0xe2da('0x19')]===undefined?!![]:![]:!![]})[_0xe2da('0xc')](function(_0x332193){logger[_0xe2da('0x1a')](_0xe2da('0x1b'),_0x45bb92);logger[_0xe2da('0xf')]('CreateAttachment',_0x45bb92,JSON[_0xe2da('0x11')](_0x332193));_0x417363(_0x332193);})['catch'](function(_0x30efdc){logger[_0xe2da('0x12')](_0xe2da('0x1b'),_0x30efdc[_0xe2da('0x13')],_0x45bb92);_0x2e5730(_0x1f7d33[_0xe2da('0x12')](0x1f4,_0x30efdc[_0xe2da('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index dd80a28..d22b5d4 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x52cce9,_0x130edf){var _0x2bcf4a=function(_0x2db516){while(--_0x2db516){_0x52cce9['push'](_0x52cce9['shift']());}};_0x2bcf4a(++_0x130edf);}(_0x5f2f,0x73));var _0xf5f2=function(_0x155762,_0x5e466b){_0x155762=_0x155762-0x0;var _0x3e5332=_0x5f2f[_0x155762];return _0x3e5332;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file +var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x227685,_0x586c72){var _0xefd128=function(_0x432d70){while(--_0x432d70){_0x227685['push'](_0x227685['shift']());}};_0xefd128(++_0x586c72);}(_0x5f2f,0x73));var _0xf5f2=function(_0x22da09,_0x29f1b0){_0x22da09=_0x22da09-0x0;var _0x56a486=_0x5f2f[_0x22da09];return _0x56a486;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index b637189..87529ad 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 _0x65ab=['google','/login','profile','email','callback','use','clientID','clientSecret','Setting','then','User','find','emails','value','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','../../config/utils','authenticate'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x65ab,0x18f));var _0xb65a=function(_0x304c76,_0x24b856){_0x304c76=_0x304c76-0x0;var _0x4b1536=_0x65ab[_0x304c76];return _0x4b1536;};'use strict';var _=require(_0xb65a('0x0'));var passport=require('passport');var GoogleStrategy=require(_0xb65a('0x1'))[_0xb65a('0x2')];var moment=require(_0xb65a('0x3'));var db=require(_0xb65a('0x4'))['db'];var config=require(_0xb65a('0x5'));var signToken=require(_0xb65a('0x6'))['signToken'];var utils=require(_0xb65a('0x7'));exports['login']=passport[_0xb65a('0x8')](_0xb65a('0x9'),{'failureRedirect':_0xb65a('0xa'),'scope':[_0xb65a('0xb'),_0xb65a('0xc')],'session':![]});exports[_0xb65a('0xd')]=passport[_0xb65a('0x8')](_0xb65a('0x9'),{'failureRedirect':_0xb65a('0xa'),'session':![]});passport[_0xb65a('0xe')](new GoogleStrategy({'clientID':config[_0xb65a('0x9')]?config[_0xb65a('0x9')][_0xb65a('0xf')]:'id','clientSecret':config[_0xb65a('0x9')]?config['google'][_0xb65a('0x10')]:'secret','callbackURL':config[_0xb65a('0x9')]?config[_0xb65a('0x9')]['callbackURL']:''},function(_0x42c4fe,_0x608834,_0x558f99,_0x405c6e){var _0x10bbf4,_0x4e1f83;return db[_0xb65a('0x11')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0xb65a('0x12')](function(_0x4a3735){_0x10bbf4=_0x4a3735;return db[_0xb65a('0x13')][_0xb65a('0x14')]({'where':{'email':_['map'](_0x558f99[_0xb65a('0x15')],_0xb65a('0x16')),'role':{'$or':['admin','user',_0xb65a('0x17')]}}});})[_0xb65a('0x12')](function(_0x588797){_0x4e1f83=_0x588797;if(_0x4e1f83){if(_0x4e1f83[_0xb65a('0x18')]){return _0x405c6e(_0xb65a('0x19'));}else if(_0x10bbf4[_0xb65a('0x1a')]>0x0){if(_0x4e1f83[_0xb65a('0x1b')]){if(moment(_0x4e1f83[_0xb65a('0x1c')])[_0xb65a('0x1d')](_0x10bbf4['blockDuration'],_0xb65a('0x1e'))>moment()){return _0x405c6e(_0xb65a('0x19'));}else{return utils[_0xb65a('0x1f')](_0x4e1f83,0x0,![],null)[_0xb65a('0x12')](function(){return utils[_0xb65a('0x20')](_0x4e1f83);})[_0xb65a('0x12')](function(){return _0x405c6e(null,_0x4e1f83);});}}else{return utils[_0xb65a('0x20')](_0x4e1f83)[_0xb65a('0x12')](function(){return _0x405c6e(null,_0x4e1f83);});}}else{return utils[_0xb65a('0x20')](_0x4e1f83)[_0xb65a('0x12')](function(){return _0x405c6e(null,_0x4e1f83);});}}return _0x405c6e('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0xb65a('0x21')](function(_0x9d762d){_0x405c6e(_0x9d762d);});})); \ No newline at end of file +var _0x2835=['../../mysqldb','../../config/environment','signToken','login','authenticate','google','/login','profile','email','callback','use','clientID','secret','callbackURL','Setting','blockDuration','then','User','emails','value','admin','agent','disabled','blocked','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','lodash','Strategy'];(function(_0x199261,_0x1a017c){var _0x5a2249=function(_0x28693f){while(--_0x28693f){_0x199261['push'](_0x199261['shift']());}};_0x5a2249(++_0x1a017c);}(_0x2835,0x1be));var _0x5283=function(_0x153cfc,_0x2acad7){_0x153cfc=_0x153cfc-0x0;var _0x4b34b7=_0x2835[_0x153cfc];return _0x4b34b7;};'use strict';var _=require(_0x5283('0x0'));var passport=require('passport');var GoogleStrategy=require('passport-google-oauth20')[_0x5283('0x1')];var moment=require('moment');var db=require(_0x5283('0x2'))['db'];var config=require(_0x5283('0x3'));var signToken=require('../../components/auth/service')[_0x5283('0x4')];var utils=require('../../config/utils');exports[_0x5283('0x5')]=passport[_0x5283('0x6')](_0x5283('0x7'),{'failureRedirect':_0x5283('0x8'),'scope':[_0x5283('0x9'),_0x5283('0xa')],'session':![]});exports[_0x5283('0xb')]=passport[_0x5283('0x6')](_0x5283('0x7'),{'failureRedirect':_0x5283('0x8'),'session':![]});passport[_0x5283('0xc')](new GoogleStrategy({'clientID':config[_0x5283('0x7')]?config[_0x5283('0x7')][_0x5283('0xd')]:'id','clientSecret':config[_0x5283('0x7')]?config[_0x5283('0x7')]['clientSecret']:_0x5283('0xe'),'callbackURL':config[_0x5283('0x7')]?config[_0x5283('0x7')][_0x5283('0xf')]:''},function(_0x5cf919,_0x49ba6a,_0x439f38,_0x1e37b4){var _0x3f0ef5,_0x2aa684;return db[_0x5283('0x10')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x5283('0x11')],'raw':!![]})[_0x5283('0x12')](function(_0x59871b){_0x3f0ef5=_0x59871b;return db[_0x5283('0x13')]['find']({'where':{'email':_['map'](_0x439f38[_0x5283('0x14')],_0x5283('0x15')),'role':{'$or':[_0x5283('0x16'),'user',_0x5283('0x17')]}}});})[_0x5283('0x12')](function(_0xccc9e4){_0x2aa684=_0xccc9e4;if(_0x2aa684){if(_0x2aa684[_0x5283('0x18')]){return _0x1e37b4('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x3f0ef5[_0x5283('0x11')]>0x0){if(_0x2aa684[_0x5283('0x19')]){if(moment(_0x2aa684['blockedAt'])[_0x5283('0x1a')](_0x3f0ef5[_0x5283('0x11')],_0x5283('0x1b'))>moment()){return _0x1e37b4(_0x5283('0x1c'));}else{return utils[_0x5283('0x1d')](_0x2aa684,0x0,![],null)[_0x5283('0x12')](function(){return utils[_0x5283('0x1e')](_0x2aa684);})['then'](function(){return _0x1e37b4(null,_0x2aa684);});}}else{return utils['getLicense'](_0x2aa684)[_0x5283('0x12')](function(){return _0x1e37b4(null,_0x2aa684);});}}else{return utils[_0x5283('0x1e')](_0x2aa684)[_0x5283('0x12')](function(){return _0x1e37b4(null,_0x2aa684);});}}return _0x1e37b4(_0x5283('0x1c'));})[_0x5283('0x1f')](function(_0x6b8345){_0x1e37b4(_0x6b8345);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index bbd8c66..5df24be 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 _0xb00a=['get','/callback','callback','isMiddleware','exports','express','passport','../user/user.controller.js'];(function(_0x39e6cd,_0x44e972){var _0x2a321a=function(_0x5b8b8f){while(--_0x5b8b8f){_0x39e6cd['push'](_0x39e6cd['shift']());}};_0x2a321a(++_0x44e972);}(_0xb00a,0xb5));var _0xab00=function(_0x2ab4a4,_0x11a3c5){_0x2ab4a4=_0x2ab4a4-0x0;var _0x1508ab=_0xb00a[_0x2ab4a4];return _0x1508ab;};'use strict';var express=require(_0xab00('0x0'));var passport=require(_0xab00('0x1'));var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require(_0xab00('0x2'));var authService=require('../../components/auth/service');router[_0xab00('0x3')]('/',controller['login']);router[_0xab00('0x3')](_0xab00('0x4'),controller[_0xab00('0x5')],authService[_0xab00('0x6')],userController['login'],authService['setTokenCookie']);module[_0xab00('0x7')]=router; \ No newline at end of file +var _0x766c=['get','login','isMiddleware','setTokenCookie','exports','express','passport','./authGoogle.controller','../../components/auth/service'];(function(_0x3f5dca,_0x59472b){var _0x5b833a=function(_0x1cb84b){while(--_0x1cb84b){_0x3f5dca['push'](_0x3f5dca['shift']());}};_0x5b833a(++_0x59472b);}(_0x766c,0xa7));var _0xc766=function(_0x3ac29d,_0x470873){_0x3ac29d=_0x3ac29d-0x0;var _0x17bf03=_0x766c[_0x3ac29d];return _0x17bf03;};'use strict';var express=require(_0xc766('0x0'));var passport=require(_0xc766('0x1'));var router=express['Router']();var controller=require(_0xc766('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0xc766('0x3'));router[_0xc766('0x4')]('/',controller[_0xc766('0x5')]);router[_0xc766('0x4')]('/callback',controller['callback'],authService[_0xc766('0x6')],userController[_0xc766('0x5')],authService[_0xc766('0x7')]);module[_0xc766('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 143a53f..e2966f4 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 _0x85ae=['blockedAt','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','disabled','clearBlockUser','add','minutes','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','service','host','port','secure','authentication','auth','user','pass','merge','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','message','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','send','Reset\x20Email\x20sent!','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','passwordHistoryLimit','securePassword','validatePasswordPattern','enforcePasswordHistory','previousPasswords','validatePasswordHistory','Password\x20reset!','util','passport','passport-local','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','role','blocked'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x85ae,0xf7));var _0xe85a=function(_0x283043,_0x36f59b){_0x283043=_0x283043-0x0;var _0x37c686=_0x85ae[_0x283043];return _0x37c686;};'use strict';var util=require(_0xe85a('0x0'));var passport=require(_0xe85a('0x1'));var LocalStrategy=require(_0xe85a('0x2'))[_0xe85a('0x3')];var jayson=require(_0xe85a('0x4'));var _=require(_0xe85a('0x5'));var rs=require('randomstring');var moment=require(_0xe85a('0x6'));var db=require(_0xe85a('0x7'))['db'];var authService=require(_0xe85a('0x8'));var utils=require(_0xe85a('0x9'));var client=jayson['client'][_0xe85a('0xa')]({'port':0x232b});function localAuthenticate(_0x4e855d,_0x2b7138,_0x7ee9e5,_0x104aa6){var _0x9c7611,_0x3f105d;return db[_0xe85a('0xb')][_0xe85a('0xc')]({'where':{'id':0x1},'attributes':[_0xe85a('0xd'),_0xe85a('0xe')],'raw':!![]})[_0xe85a('0xf')](function(_0x1b1c94){_0x9c7611=_0x1b1c94;return _0x4e855d[_0xe85a('0xc')]({'attributes':['id',_0xe85a('0x10'),_0xe85a('0x11'),'salt',_0xe85a('0x12'),'disabled',_0xe85a('0x13'),_0xe85a('0x14'),'loginAttempts'],'where':{'name':_0x2b7138,'role':{'$or':[_0xe85a('0x15'),'user',_0xe85a('0x16')]}}});})[_0xe85a('0xf')](function(_0x39c623){if(!_0x39c623||_0x39c623&&_0x39c623[_0xe85a('0x10')]!==_0x2b7138){throw new Error(_0xe85a('0x17'));}else{_0x3f105d=_0x39c623;return _0x3f105d;}})[_0xe85a('0xf')](function(){_0x3f105d[_0xe85a('0x18')](_0x7ee9e5,function(_0xdb5687,_0x1d92ad){var _0x1da2e3=_0x3f105d[_0xe85a('0x19')]+0x1;if(_0xdb5687){return _0x104aa6(_0xdb5687);}else if(!_0x1d92ad){if(_0x3f105d[_0xe85a('0x1a')]){return _0x104aa6(null,![],{'message':_0xe85a('0x17')});}else if(_0x9c7611[_0xe85a('0xd')]>0x0){if(_0x3f105d[_0xe85a('0x13')]){if(_0x9c7611[_0xe85a('0xe')]>0x0){if(moment(_0x3f105d[_0xe85a('0x14')])['add'](_0x9c7611['blockDuration'],'minutes')>moment()){return _0x104aa6(null,![],{'message':_0xe85a('0x17')});}else{return utils[_0xe85a('0x1b')](_0x3f105d,_0x1da2e3,![],null)[_0xe85a('0xf')](function(){return _0x104aa6(null,![],{'message':_0xe85a('0x17')});});}}else{return _0x104aa6(null,![],{'message':_0xe85a('0x17')});}}else{if(_0x1da2e3>=_0x9c7611[_0xe85a('0xd')]){return utils['clearBlockUser'](_0x3f105d,0x0,!![],moment())[_0xe85a('0xf')](function(){return _0x104aa6(null,![],{'message':_0xe85a('0x17')});});}else{return utils['clearBlockUser'](_0x3f105d,_0x1da2e3,![],null)['then'](function(){return _0x104aa6(null,![],{'message':_0xe85a('0x17')});});}}}else{return _0x104aa6(null,![],{'message':_0xe85a('0x17')});}}else{if(_0x3f105d[_0xe85a('0x1a')]){return _0x104aa6(null,![],{'message':_0xe85a('0x17')});}else if(_0x9c7611[_0xe85a('0xd')]>0x0){if(_0x3f105d[_0xe85a('0x13')]){if(_0x9c7611[_0xe85a('0xe')]>0x0){if(moment(_0x3f105d[_0xe85a('0x14')])[_0xe85a('0x1c')](_0x9c7611[_0xe85a('0xe')],_0xe85a('0x1d'))>moment()){return _0x104aa6(null,![],{'message':_0xe85a('0x17')});}else{return utils['clearBlockUser'](_0x3f105d,0x0,![],null)[_0xe85a('0xf')](function(){return utils['getLicense'](_0x3f105d);})['then'](function(){return _0x104aa6(null,_0x3f105d);});}}else{return _0x104aa6(null,![],{'message':_0xe85a('0x17')});}}else{return utils[_0xe85a('0x1b')](_0x3f105d,0x0,![],null)[_0xe85a('0xf')](function(){return utils[_0xe85a('0x1e')](_0x3f105d);})[_0xe85a('0xf')](function(){return _0x104aa6(null,_0x3f105d);})['catch'](function(_0x1b7807){return _0x104aa6(null,![],_0x1b7807);});}}else{if(_0x3f105d[_0xe85a('0x13')]){return _0x104aa6(null,![],{'message':_0xe85a('0x17')});}else{return utils[_0xe85a('0x1e')](_0x3f105d)[_0xe85a('0xf')](function(){return _0x104aa6(null,_0x3f105d);});}}}});})[_0xe85a('0x1f')](function(_0x3a9522){return _0x104aa6(null,![],_0x3a9522);});}function sendServiceMail(_0x5b8f94){return db[_0xe85a('0x20')][_0xe85a('0x21')]({'where':{'service':!![]},'attributes':['id',_0xe85a('0x10'),_0xe85a('0x22')],'include':[{'model':db[_0xe85a('0x23')],'as':_0xe85a('0x24')}]})[_0xe85a('0xf')](function(_0x437ab2){if(!_0x437ab2){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x2e0630={'tls':{'rejectUnauthorized':![]}};if(_0x437ab2[_0xe85a('0x24')][_0xe85a('0x25')]){_0x2e0630[_0xe85a('0x25')]=_0x437ab2[_0xe85a('0x24')][_0xe85a('0x25')];}else{_0x2e0630[_0xe85a('0x26')]=_0x437ab2[_0xe85a('0x24')][_0xe85a('0x26')];_0x2e0630[_0xe85a('0x27')]=_0x437ab2[_0xe85a('0x24')][_0xe85a('0x27')];_0x2e0630[_0xe85a('0x28')]=_0x437ab2['Smtp'][_0xe85a('0x28')];}if(_0x437ab2[_0xe85a('0x24')][_0xe85a('0x29')]){_0x2e0630[_0xe85a('0x2a')]={'user':_0x437ab2[_0xe85a('0x24')][_0xe85a('0x2b')],'pass':_0x437ab2['Smtp'][_0xe85a('0x2c')]};}var _0x4eb429={'account':_0x2e0630,'message':_[_0xe85a('0x2d')]({'from':util['format'](_0xe85a('0x2e'),_0x437ab2[_0xe85a('0x10')],_0x437ab2[_0xe85a('0x22')]||_0x437ab2[_0xe85a('0x24')][_0xe85a('0x2b')])},_0x5b8f94)};return client[_0xe85a('0x2f')](_0xe85a('0x30'),_0x4eb429);})[_0xe85a('0xf')](function(_0x2456a5){if(_0x2456a5[_0xe85a('0x31')]){throw new Error(util['format'](_0xe85a('0x32'),_0x2456a5['error']['message']||JSON[_0xe85a('0x33')](_0x2456a5[_0xe85a('0x31')])));}return!![];});}function handleError(_0x3e484a,_0x176772,_0x49fcdc){return _0x3e484a['status'](_0x176772||0x1f4)['send']({'message':_0x49fcdc?_0x49fcdc[_0xe85a('0x34')]||_0x49fcdc:''});}exports[_0xe85a('0x35')]=function(_0x509d6b,_0x4eb70f,_0x36765c){passport[_0xe85a('0x18')](_0xe85a('0x36'),function(_0x304119,_0x4d0edd,_0x58bcea){var _0x5a5144=_0x304119||_0x58bcea;if(_0x5a5144){return handleError(_0x4eb70f,0x191,_0x5a5144);}if(!_0x4d0edd){return handleError(_0x4eb70f,0x194,{'message':_0xe85a('0x37')});}else{var _0xdad63c={'payload':{'id':_0x4d0edd['id'],'role':_0x4d0edd[_0xe85a('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0xe85a('0x38')](_0xdad63c)[_0xe85a('0xf')](function(_0x1069fa){_0x4eb70f[_0xe85a('0x39')]({'id':_0x4d0edd['id'],'token':_0x1069fa,'statusCall':'','isAlreadyLogged':_0x4d0edd[_0xe85a('0x3a')]});});}})(_0x509d6b,_0x4eb70f,_0x36765c);};exports[_0xe85a('0x3b')]=function(_0x259f45,_0x5be8fc,_0x2ca060){if(!_0x259f45[_0xe85a('0x3c')][_0xe85a('0x22')]){return handleError(_0x5be8fc,0x1f4,{'message':_0xe85a('0x3d')});}var _0x417a67=rs[_0xe85a('0x3e')]();_0x259f45['body'][_0xe85a('0x22')]=_0x259f45[_0xe85a('0x3c')][_0xe85a('0x22')]['trim']()['toLowerCase']();var _0x34930c;return db['Setting'][_0xe85a('0xc')]({'where':{'id':0x1},'attributes':[_0xe85a('0xd'),_0xe85a('0xe')],'raw':!![]})[_0xe85a('0xf')](function(_0x5ad87f){_0x34930c=_0x5ad87f;return db[_0xe85a('0x3f')][_0xe85a('0x21')]({'where':{'email':_0x259f45['body']['email']}});})['then'](function(_0x3b0ea5){if(!_0x3b0ea5){throw new Error(_0xe85a('0x40'));}if(_0x3b0ea5[_0xe85a('0x1a')]){throw new Error(_0xe85a('0x41'));}if(_0x3b0ea5[_0xe85a('0x13')]){if(moment(_0x3b0ea5[_0xe85a('0x14')])[_0xe85a('0x1c')](_0x34930c['blockDuration'],_0xe85a('0x1d'))>moment()){throw new Error(_0xe85a('0x42'));}else{_0x3b0ea5['blocked']=![];_0x3b0ea5[_0xe85a('0x14')]=null;}}_0x3b0ea5[_0xe85a('0x43')]=_0x417a67;_0x3b0ea5[_0xe85a('0x44')]=Date[_0xe85a('0x45')]()+0x36ee80;return _0x3b0ea5[_0xe85a('0x46')]();})[_0xe85a('0xf')](function(){return sendServiceMail({'to':_0x259f45['body']['email'],'subject':_0xe85a('0x47'),'text':_0xe85a('0x48')+_0xe85a('0x49')+_0xe85a('0x4a')+_0x259f45['headers'][_0xe85a('0x26')]+'/reset/'+_0x417a67+'\x0a\x0a'+_0xe85a('0x4b')});})[_0xe85a('0xf')](function(){_0x5be8fc[_0xe85a('0x4c')](0xc8)[_0xe85a('0x4d')]({'message':_0xe85a('0x4e')});})[_0xe85a('0x1f')](function(_0x19c716){return handleError(_0x5be8fc,0x1f4,_0x19c716);});};exports[_0xe85a('0x4f')]=function(_0x5a0fee,_0x3b5494,_0x44a5cc){return db['User'][_0xe85a('0x21')]({'where':{'resetPasswordToken':_0x5a0fee[_0xe85a('0x50')]['token'],'resetPasswordExpires':{'$gt':Date[_0xe85a('0x45')]()}}})[_0xe85a('0xf')](function(_0x1bd252){if(!_0x1bd252){throw new Error(_0xe85a('0x51'));}return db[_0xe85a('0xb')][_0xe85a('0xc')]({'attributes':['id','securePassword','enforcePasswordHistory',_0xe85a('0x52')]})['then'](function(_0x4e5ea6){if(_0x4e5ea6[_0xe85a('0x53')])authService[_0xe85a('0x54')](_0x5a0fee[_0xe85a('0x3c')]['password']);if(!_0x4e5ea6[_0xe85a('0x55')]||!_0x1bd252[_0xe85a('0x56')])return _0x1bd252;authService[_0xe85a('0x57')](_0x5a0fee[_0xe85a('0x3c')]['password'],_0x1bd252[_0xe85a('0x56')],_0x4e5ea6['passwordHistoryLimit']);return _0x1bd252;})[_0xe85a('0xf')](function(){_0x1bd252[_0xe85a('0x11')]=_0x5a0fee[_0xe85a('0x3c')][_0xe85a('0x11')];_0x1bd252[_0xe85a('0x43')]=null;_0x1bd252[_0xe85a('0x44')]=null;return _0x1bd252['save']();});})[_0xe85a('0xf')](function(){_0x3b5494['status'](0xc8)[_0xe85a('0x4d')]({'message':_0xe85a('0x58')});})[_0xe85a('0x1f')](function(_0x4a6455){return handleError(_0x3b5494,0x1f4,_0x4a6455);});};passport['use'](new LocalStrategy({'usernameField':'name','passwordField':_0xe85a('0x11')},function(_0x5df2b7,_0x27351a,_0x53a17b){return localAuthenticate(db[_0xe85a('0x3f')],_0x5df2b7,_0x27351a,_0x53a17b);})); \ No newline at end of file +var _0xbf1a=['User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','Setting','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','save','Password\x20reset!','util','passport','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','findOne','allowedLoginAttempts','then','password','disabled','blocked','admin','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','loginAttempts','blockDuration','blockedAt','clearBlockUser','add','getLicense','catch','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','user','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','login','authenticate','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','Email\x20parameter\x20is\x20missing','generate','body','trim'];(function(_0x27999e,_0x1cbbd2){var _0x19498d=function(_0x2bd9ab){while(--_0x2bd9ab){_0x27999e['push'](_0x27999e['shift']());}};_0x19498d(++_0x1cbbd2);}(_0xbf1a,0x16d));var _0xabf1=function(_0x342e6d,_0xe4cce2){_0x342e6d=_0x342e6d-0x0;var _0x45ae7f=_0xbf1a[_0x342e6d];return _0x45ae7f;};'use strict';var util=require(_0xabf1('0x0'));var passport=require(_0xabf1('0x1'));var LocalStrategy=require('passport-local')['Strategy'];var jayson=require(_0xabf1('0x2'));var _=require(_0xabf1('0x3'));var rs=require(_0xabf1('0x4'));var moment=require(_0xabf1('0x5'));var db=require(_0xabf1('0x6'))['db'];var authService=require(_0xabf1('0x7'));var utils=require(_0xabf1('0x8'));var client=jayson[_0xabf1('0x9')][_0xabf1('0xa')]({'port':0x232b});function localAuthenticate(_0x2dad0a,_0x2e5203,_0x4be08b,_0x1bf70e){var _0xcfec60,_0x48c89c;return db['Setting'][_0xabf1('0xb')]({'where':{'id':0x1},'attributes':[_0xabf1('0xc'),'blockDuration'],'raw':!![]})[_0xabf1('0xd')](function(_0x496107){_0xcfec60=_0x496107;return _0x2dad0a[_0xabf1('0xb')]({'attributes':['id','name',_0xabf1('0xe'),'salt','role',_0xabf1('0xf'),_0xabf1('0x10'),'blockedAt','loginAttempts'],'where':{'name':_0x2e5203,'role':{'$or':[_0xabf1('0x11'),'user',_0xabf1('0x12')]}}});})[_0xabf1('0xd')](function(_0x22f909){if(!_0x22f909||_0x22f909&&_0x22f909[_0xabf1('0x13')]!==_0x2e5203){throw new Error(_0xabf1('0x14'));}else{_0x48c89c=_0x22f909;return _0x48c89c;}})[_0xabf1('0xd')](function(){_0x48c89c['authenticate'](_0x4be08b,function(_0x5a3aa9,_0x49208c){var _0x2f0444=_0x48c89c[_0xabf1('0x15')]+0x1;if(_0x5a3aa9){return _0x1bf70e(_0x5a3aa9);}else if(!_0x49208c){if(_0x48c89c[_0xabf1('0xf')]){return _0x1bf70e(null,![],{'message':_0xabf1('0x14')});}else if(_0xcfec60[_0xabf1('0xc')]>0x0){if(_0x48c89c['blocked']){if(_0xcfec60[_0xabf1('0x16')]>0x0){if(moment(_0x48c89c[_0xabf1('0x17')])['add'](_0xcfec60['blockDuration'],'minutes')>moment()){return _0x1bf70e(null,![],{'message':_0xabf1('0x14')});}else{return utils[_0xabf1('0x18')](_0x48c89c,_0x2f0444,![],null)[_0xabf1('0xd')](function(){return _0x1bf70e(null,![],{'message':_0xabf1('0x14')});});}}else{return _0x1bf70e(null,![],{'message':_0xabf1('0x14')});}}else{if(_0x2f0444>=_0xcfec60['allowedLoginAttempts']){return utils[_0xabf1('0x18')](_0x48c89c,0x0,!![],moment())[_0xabf1('0xd')](function(){return _0x1bf70e(null,![],{'message':_0xabf1('0x14')});});}else{return utils[_0xabf1('0x18')](_0x48c89c,_0x2f0444,![],null)[_0xabf1('0xd')](function(){return _0x1bf70e(null,![],{'message':_0xabf1('0x14')});});}}}else{return _0x1bf70e(null,![],{'message':_0xabf1('0x14')});}}else{if(_0x48c89c['disabled']){return _0x1bf70e(null,![],{'message':_0xabf1('0x14')});}else if(_0xcfec60[_0xabf1('0xc')]>0x0){if(_0x48c89c[_0xabf1('0x10')]){if(_0xcfec60[_0xabf1('0x16')]>0x0){if(moment(_0x48c89c[_0xabf1('0x17')])[_0xabf1('0x19')](_0xcfec60['blockDuration'],'minutes')>moment()){return _0x1bf70e(null,![],{'message':_0xabf1('0x14')});}else{return utils[_0xabf1('0x18')](_0x48c89c,0x0,![],null)['then'](function(){return utils[_0xabf1('0x1a')](_0x48c89c);})[_0xabf1('0xd')](function(){return _0x1bf70e(null,_0x48c89c);});}}else{return _0x1bf70e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0xabf1('0x18')](_0x48c89c,0x0,![],null)[_0xabf1('0xd')](function(){return utils[_0xabf1('0x1a')](_0x48c89c);})[_0xabf1('0xd')](function(){return _0x1bf70e(null,_0x48c89c);})[_0xabf1('0x1b')](function(_0x246975){return _0x1bf70e(null,![],_0x246975);});}}else{if(_0x48c89c['blocked']){return _0x1bf70e(null,![],{'message':_0xabf1('0x14')});}else{return utils[_0xabf1('0x1a')](_0x48c89c)[_0xabf1('0xd')](function(){return _0x1bf70e(null,_0x48c89c);});}}}});})['catch'](function(_0x5912f8){return _0x1bf70e(null,![],_0x5912f8);});}function sendServiceMail(_0x5f5e07){return db['MailAccount'][_0xabf1('0x1c')]({'where':{'service':!![]},'attributes':['id',_0xabf1('0x13'),_0xabf1('0x1d')],'include':[{'model':db[_0xabf1('0x1e')],'as':_0xabf1('0x1f')}]})[_0xabf1('0xd')](function(_0x3a0b53){if(!_0x3a0b53){throw new Error(_0xabf1('0x20'));}var _0x2a283c={'tls':{'rejectUnauthorized':![]}};if(_0x3a0b53[_0xabf1('0x1f')]['service']){_0x2a283c[_0xabf1('0x21')]=_0x3a0b53[_0xabf1('0x1f')]['service'];}else{_0x2a283c[_0xabf1('0x22')]=_0x3a0b53[_0xabf1('0x1f')][_0xabf1('0x22')];_0x2a283c[_0xabf1('0x23')]=_0x3a0b53[_0xabf1('0x1f')][_0xabf1('0x23')];_0x2a283c[_0xabf1('0x24')]=_0x3a0b53[_0xabf1('0x1f')]['secure'];}if(_0x3a0b53[_0xabf1('0x1f')][_0xabf1('0x25')]){_0x2a283c[_0xabf1('0x26')]={'user':_0x3a0b53[_0xabf1('0x1f')][_0xabf1('0x27')],'pass':_0x3a0b53['Smtp'][_0xabf1('0x28')]};}var _0x1a71c2={'account':_0x2a283c,'message':_[_0xabf1('0x29')]({'from':util[_0xabf1('0x2a')](_0xabf1('0x2b'),_0x3a0b53[_0xabf1('0x13')],_0x3a0b53[_0xabf1('0x1d')]||_0x3a0b53[_0xabf1('0x1f')][_0xabf1('0x27')])},_0x5f5e07)};return client[_0xabf1('0x2c')]('SendMail',_0x1a71c2);})['then'](function(_0x3d4578){if(_0x3d4578['error']){throw new Error(util[_0xabf1('0x2a')](_0xabf1('0x2d'),_0x3d4578['error'][_0xabf1('0x2e')]||JSON['stringify'](_0x3d4578['error'])));}return!![];});}function handleError(_0x53aa50,_0xc55c3b,_0x49707){return _0x53aa50[_0xabf1('0x2f')](_0xc55c3b||0x1f4)['send']({'message':_0x49707?_0x49707[_0xabf1('0x2e')]||_0x49707:''});}exports[_0xabf1('0x30')]=function(_0x160383,_0x49de9a,_0x57dc08){passport[_0xabf1('0x31')](_0xabf1('0x32'),function(_0x156374,_0x17d666,_0x2f9d77){var _0x40bc9a=_0x156374||_0x2f9d77;if(_0x40bc9a){return handleError(_0x49de9a,0x191,_0x40bc9a);}if(!_0x17d666){return handleError(_0x49de9a,0x194,{'message':_0xabf1('0x33')});}else{var _0x31e88d={'payload':{'id':_0x17d666['id'],'role':_0x17d666[_0xabf1('0x34')]},'options':{'expiresIn':0x15180}};return authService[_0xabf1('0x35')](_0x31e88d)[_0xabf1('0xd')](function(_0x197efa){_0x49de9a[_0xabf1('0x36')]({'id':_0x17d666['id'],'token':_0x197efa,'statusCall':'','isAlreadyLogged':_0x17d666[_0xabf1('0x37')]});});}})(_0x160383,_0x49de9a,_0x57dc08);};exports['forgot']=function(_0x4e9265,_0x1964da,_0x23fd56){if(!_0x4e9265['body']['email']){return handleError(_0x1964da,0x1f4,{'message':_0xabf1('0x38')});}var _0x12c9d1=rs[_0xabf1('0x39')]();_0x4e9265[_0xabf1('0x3a')][_0xabf1('0x1d')]=_0x4e9265['body'][_0xabf1('0x1d')][_0xabf1('0x3b')]()['toLowerCase']();var _0x593949;return db['Setting'][_0xabf1('0xb')]({'where':{'id':0x1},'attributes':[_0xabf1('0xc'),_0xabf1('0x16')],'raw':!![]})[_0xabf1('0xd')](function(_0x17a6ff){_0x593949=_0x17a6ff;return db[_0xabf1('0x3c')][_0xabf1('0x1c')]({'where':{'email':_0x4e9265[_0xabf1('0x3a')][_0xabf1('0x1d')]}});})['then'](function(_0x166a22){if(!_0x166a22){throw new Error(_0xabf1('0x3d'));}if(_0x166a22['disabled']){throw new Error(_0xabf1('0x3e'));}if(_0x166a22['blocked']){if(moment(_0x166a22[_0xabf1('0x17')])[_0xabf1('0x19')](_0x593949[_0xabf1('0x16')],'minutes')>moment()){throw new Error(_0xabf1('0x3f'));}else{_0x166a22['blocked']=![];_0x166a22[_0xabf1('0x17')]=null;}}_0x166a22[_0xabf1('0x40')]=_0x12c9d1;_0x166a22[_0xabf1('0x41')]=Date['now']()+0x36ee80;return _0x166a22['save']();})[_0xabf1('0xd')](function(){return sendServiceMail({'to':_0x4e9265[_0xabf1('0x3a')][_0xabf1('0x1d')],'subject':_0xabf1('0x42'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xabf1('0x43')+_0xabf1('0x44')+_0x4e9265[_0xabf1('0x45')]['host']+_0xabf1('0x46')+_0x12c9d1+'\x0a\x0a'+_0xabf1('0x47')});})[_0xabf1('0xd')](function(){_0x1964da[_0xabf1('0x2f')](0xc8)[_0xabf1('0x48')]({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x2b511b){return handleError(_0x1964da,0x1f4,_0x2b511b);});};exports[_0xabf1('0x49')]=function(_0x1e9410,_0x28e661,_0x475f9f){return db[_0xabf1('0x3c')]['find']({'where':{'resetPasswordToken':_0x1e9410[_0xabf1('0x4a')]['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xabf1('0xd')](function(_0x131003){if(!_0x131003){throw new Error(_0xabf1('0x4b'));}return db[_0xabf1('0x4c')][_0xabf1('0xb')]({'attributes':['id',_0xabf1('0x4d'),_0xabf1('0x4e'),_0xabf1('0x4f')]})[_0xabf1('0xd')](function(_0x4a5d83){if(_0x4a5d83[_0xabf1('0x4d')])authService[_0xabf1('0x50')](_0x1e9410[_0xabf1('0x3a')]['password']);if(!_0x4a5d83['enforcePasswordHistory']||!_0x131003[_0xabf1('0x51')])return _0x131003;authService[_0xabf1('0x52')](_0x1e9410[_0xabf1('0x3a')]['password'],_0x131003[_0xabf1('0x51')],_0x4a5d83[_0xabf1('0x4f')]);return _0x131003;})[_0xabf1('0xd')](function(){_0x131003[_0xabf1('0xe')]=_0x1e9410[_0xabf1('0x3a')][_0xabf1('0xe')];_0x131003['resetPasswordToken']=null;_0x131003[_0xabf1('0x41')]=null;return _0x131003[_0xabf1('0x53')]();});})[_0xabf1('0xd')](function(){_0x28e661[_0xabf1('0x2f')](0xc8)['send']({'message':_0xabf1('0x54')});})[_0xabf1('0x1b')](function(_0xa6ae21){return handleError(_0x28e661,0x1f4,_0xa6ae21);});};passport['use'](new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x2fab98,_0x1c0913,_0x4cb354){return localAuthenticate(db[_0xabf1('0x3c')],_0x2fab98,_0x1c0913,_0x4cb354);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 40aa124..d79f13d 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 _0x8518=['/forgot','forgot','/reset/:token','reset','exports','express','./authLocal.controller','post'];(function(_0x2a0080,_0x58e8bc){var _0x55c13e=function(_0xc0f365){while(--_0xc0f365){_0x2a0080['push'](_0x2a0080['shift']());}};_0x55c13e(++_0x58e8bc);}(_0x8518,0xcd));var _0x8851=function(_0x367dd3,_0xd1d1bf){_0x367dd3=_0x367dd3-0x0;var _0x5b7728=_0x8518[_0x367dd3];return _0x5b7728;};'use strict';var express=require(_0x8851('0x0'));var router=express['Router']();var controller=require(_0x8851('0x1'));router[_0x8851('0x2')]('/',controller['login']);router['post'](_0x8851('0x3'),controller[_0x8851('0x4')]);router[_0x8851('0x2')](_0x8851('0x5'),controller[_0x8851('0x6')]);module[_0x8851('0x7')]=router; \ No newline at end of file +var _0xc1b1=['exports','express','Router','./authLocal.controller','post','/forgot','forgot','/reset/:token','reset'];(function(_0x1decb9,_0x5e3ce0){var _0x4772a4=function(_0x1afcdd){while(--_0x1afcdd){_0x1decb9['push'](_0x1decb9['shift']());}};_0x4772a4(++_0x5e3ce0);}(_0xc1b1,0xeb));var _0x1c1b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc1b1[_0x20a584];return _0x4b41a8;};'use strict';var express=require(_0x1c1b('0x0'));var router=express[_0x1c1b('0x1')]();var controller=require(_0x1c1b('0x2'));router[_0x1c1b('0x3')]('/',controller['login']);router['post'](_0x1c1b('0x4'),controller[_0x1c1b('0x5')]);router[_0x1c1b('0x3')](_0x1c1b('0x6'),controller[_0x1c1b('0x7')]);module[_0x1c1b('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index f04c308..a21175b 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 _0xad97=['STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xad97,0x17b));var _0x7ad9=function(_0x505d54,_0x550691){_0x505d54=_0x505d54-0x0;var _0x3c648b=_0xad97[_0x505d54];return _0x3c648b;};'use strict';var Sequelize=require(_0x7ad9('0x0'));module['exports']={'name':{'type':Sequelize[_0x7ad9('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x7ad9('0x1')]},'description':{'type':Sequelize[_0x7ad9('0x1')]},'status':{'type':Sequelize[_0x7ad9('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x7ad9('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x3394=['INTEGER','sequelize','STRING'];(function(_0x4f1da5,_0x4ced17){var _0xe972a8=function(_0x278ba3){while(--_0x278ba3){_0x4f1da5['push'](_0x4f1da5['shift']());}};_0xe972a8(++_0x4ced17);}(_0x3394,0xd9));var _0x4339=function(_0x5544cd,_0x2e881c){_0x5544cd=_0x5544cd-0x0;var _0x27e176=_0x3394[_0x5544cd];return _0x27e176;};'use strict';var Sequelize=require(_0x4339('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x4339('0x1')]},'description':{'type':Sequelize[_0x4339('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x4339('0x2')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 6dce654..bbd1ffe 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 _0x03b4=['addActions','Action','getActions','findOne','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','destroy','error','map','Automation','rawAttributes','fieldName','type','query','keys','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','name','merge','options','then','include','rows','catch','show','params','intersection','length','includeAll','create','body','update','find','addConditions','Condition','ids','omit','getConditions'];(function(_0x2fb900,_0x2a6ba2){var _0x4e99e2=function(_0x57cbbd){while(--_0x57cbbd){_0x2fb900['push'](_0x2fb900['shift']());}};_0x4e99e2(++_0x2a6ba2);}(_0x03b4,0xa4));var _0x403b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x03b4[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x403b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x403b('0x1'));var moment=require('moment');var BPromise=require(_0x403b('0x2'));var Mustache=require(_0x403b('0x3'));var util=require(_0x403b('0x4'));var path=require(_0x403b('0x5'));var sox=require('sox');var csv=require(_0x403b('0x6'));var ejs=require(_0x403b('0x7'));var fs=require('fs');var fs_extra=require(_0x403b('0x8'));var _=require(_0x403b('0x9'));var squel=require(_0x403b('0xa'));var crypto=require('crypto');var jsforce=require(_0x403b('0xb'));var deskjs=require(_0x403b('0xc'));var toCsv=require(_0x403b('0x6'));var querystring=require('querystring');var Papa=require(_0x403b('0xd'));var Redis=require('ioredis');var authService=require(_0x403b('0xe'));var qs=require(_0x403b('0xf'));var as=require(_0x403b('0x10'));var hardwareService=require(_0x403b('0x11'));var logger=require(_0x403b('0x12'))(_0x403b('0x13'));var utils=require(_0x403b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x403b('0x15'));var db=require(_0x403b('0x16'))['db'];function respondWithStatusCode(_0x38ecf9,_0x10c248){_0x10c248=_0x10c248||0xcc;return function(_0x1f8369){if(_0x1f8369){return _0x38ecf9[_0x403b('0x17')](_0x10c248);}return _0x38ecf9['status'](_0x10c248)[_0x403b('0x18')]();};}function respondWithResult(_0x11db23,_0x1dec43){_0x1dec43=_0x1dec43||0xc8;return function(_0x56d577){if(_0x56d577){return _0x11db23[_0x403b('0x19')](_0x1dec43)[_0x403b('0x1a')](_0x56d577);}};}function respondWithFilteredResult(_0x4428c1,_0x4ee7cd){return function(_0x1bc9c7){if(_0x1bc9c7){var _0x3c9288=typeof _0x4ee7cd[_0x403b('0x1b')]==='undefined'&&typeof _0x4ee7cd[_0x403b('0x1c')]===_0x403b('0x1d');var _0x19a061=_0x1bc9c7[_0x403b('0x1e')];var _0xc920d9=_0x3c9288?0x0:_0x4ee7cd['offset'];var _0x52f109=_0x3c9288?_0x1bc9c7[_0x403b('0x1e')]:_0x4ee7cd[_0x403b('0x1b')]+_0x4ee7cd[_0x403b('0x1c')];var _0x34d3ff;if(_0x52f109>=_0x19a061){_0x52f109=_0x19a061;_0x34d3ff=0xc8;}else{_0x34d3ff=0xce;}_0x4428c1['status'](_0x34d3ff);return _0x4428c1[_0x403b('0x1f')](_0x403b('0x20'),_0xc920d9+'-'+_0x52f109+'/'+_0x19a061)[_0x403b('0x1a')](_0x1bc9c7);}return null;};}function patchUpdates(_0x71a5e8){return function(_0x360c0b){try{jsonpatch['apply'](_0x360c0b,_0x71a5e8,!![]);}catch(_0x10fcb6){return BPromise[_0x403b('0x21')](_0x10fcb6);}return _0x360c0b[_0x403b('0x22')]();};}function saveUpdates(_0x14c3f7,_0x463edd){return function(_0x1fb769){if(_0x1fb769){return _0x1fb769['update'](_0x14c3f7)['then'](function(_0x1daa26){return _0x1daa26;});}return null;};}function removeEntity(_0x22b304,_0x8cdb88){return function(_0x45ab98){if(_0x45ab98){return _0x45ab98[_0x403b('0x23')]()['then'](function(){_0x22b304[_0x403b('0x19')](0xcc)[_0x403b('0x18')]();});}};}function handleEntityNotFound(_0x751121,_0x1203bc){return function(_0xfdc92f){if(!_0xfdc92f){_0x751121['sendStatus'](0x194);}return _0xfdc92f;};}function handleError(_0x5b8378,_0x5313af){_0x5313af=_0x5313af||0x1f4;return function(_0xc91a85){logger[_0x403b('0x24')](_0xc91a85['stack']);if(_0xc91a85['name']){delete _0xc91a85['name'];}_0x5b8378[_0x403b('0x19')](_0x5313af)['send'](_0xc91a85);};}exports['index']=function(_0x532b3e,_0x2ff20f){var _0x28fed3={},_0x18d452={},_0x2ec5be={'count':0x0,'rows':[]};var _0x4f6adc=_[_0x403b('0x25')](db[_0x403b('0x26')][_0x403b('0x27')],function(_0x33c1a4){return{'name':_0x33c1a4[_0x403b('0x28')],'type':_0x33c1a4[_0x403b('0x29')]['key']};});_0x18d452['model']=_[_0x403b('0x25')](_0x4f6adc,'name');_0x18d452[_0x403b('0x2a')]=_[_0x403b('0x2b')](_0x532b3e[_0x403b('0x2a')]);_0x18d452['filters']=_['intersection'](_0x18d452['model'],_0x18d452[_0x403b('0x2a')]);_0x28fed3['attributes']=_['intersection'](_0x18d452[_0x403b('0x2c')],qs[_0x403b('0x2d')](_0x532b3e[_0x403b('0x2a')]['fields']));_0x28fed3[_0x403b('0x2e')]=_0x28fed3[_0x403b('0x2e')]['length']?_0x28fed3[_0x403b('0x2e')]:_0x18d452[_0x403b('0x2c')];if(!_0x532b3e[_0x403b('0x2a')][_0x403b('0x2f')](_0x403b('0x30'))){_0x28fed3[_0x403b('0x1c')]=qs['limit'](_0x532b3e['query'][_0x403b('0x1c')]);_0x28fed3['offset']=qs[_0x403b('0x1b')](_0x532b3e[_0x403b('0x2a')][_0x403b('0x1b')]);}_0x28fed3[_0x403b('0x31')]=qs[_0x403b('0x32')](_0x532b3e[_0x403b('0x2a')][_0x403b('0x32')]);_0x28fed3[_0x403b('0x33')]=qs['filters'](_[_0x403b('0x34')](_0x532b3e[_0x403b('0x2a')],_0x18d452[_0x403b('0x35')]),_0x4f6adc);if(_0x532b3e['query'][_0x403b('0x36')]){_0x28fed3['where']=_['merge'](_0x28fed3[_0x403b('0x33')],{'$or':_[_0x403b('0x25')](_0x4f6adc,function(_0xc2eab8){if(_0xc2eab8[_0x403b('0x29')]!=='VIRTUAL'){var _0x3cb60a={};_0x3cb60a[_0xc2eab8[_0x403b('0x37')]]={'$like':'%'+_0x532b3e['query'][_0x403b('0x36')]+'%'};return _0x3cb60a;}})});}_0x28fed3=_[_0x403b('0x38')]({},_0x28fed3,_0x532b3e[_0x403b('0x39')]);var _0xeef2d7={'where':_0x28fed3[_0x403b('0x33')]};return db['Automation'][_0x403b('0x1e')](_0xeef2d7)[_0x403b('0x3a')](function(_0x468f94){_0x2ec5be['count']=_0x468f94;if(_0x532b3e[_0x403b('0x2a')]['includeAll']){_0x28fed3[_0x403b('0x3b')]=[{'all':!![]}];}return db[_0x403b('0x26')]['findAll'](_0x28fed3);})[_0x403b('0x3a')](function(_0x4b802c){_0x2ec5be[_0x403b('0x3c')]=_0x4b802c;return _0x2ec5be;})[_0x403b('0x3a')](respondWithFilteredResult(_0x2ff20f,_0x28fed3))[_0x403b('0x3d')](handleError(_0x2ff20f,null));};exports[_0x403b('0x3e')]=function(_0x5e23ca,_0x22e706){var _0x2093bd={'raw':![],'where':{'id':_0x5e23ca[_0x403b('0x3f')]['id']}},_0x78a048={};_0x78a048[_0x403b('0x2c')]=_[_0x403b('0x2b')](db[_0x403b('0x26')][_0x403b('0x27')]);_0x78a048[_0x403b('0x2a')]=_[_0x403b('0x2b')](_0x5e23ca['query']);_0x78a048[_0x403b('0x35')]=_[_0x403b('0x40')](_0x78a048['model'],_0x78a048[_0x403b('0x2a')]);_0x2093bd[_0x403b('0x2e')]=_[_0x403b('0x40')](_0x78a048[_0x403b('0x2c')],qs['fields'](_0x5e23ca[_0x403b('0x2a')][_0x403b('0x2d')]));_0x2093bd[_0x403b('0x2e')]=_0x2093bd[_0x403b('0x2e')][_0x403b('0x41')]?_0x2093bd[_0x403b('0x2e')]:_0x78a048[_0x403b('0x2c')];if(_0x5e23ca[_0x403b('0x2a')][_0x403b('0x42')]){_0x2093bd[_0x403b('0x3b')]=[{'all':!![]}];}_0x2093bd=_['merge']({},_0x2093bd,_0x5e23ca[_0x403b('0x39')]);return db[_0x403b('0x26')]['find'](_0x2093bd)[_0x403b('0x3a')](handleEntityNotFound(_0x22e706,null))['then'](respondWithResult(_0x22e706,null))[_0x403b('0x3d')](handleError(_0x22e706,null));};exports['create']=function(_0x23af0a,_0x46ee73){return db[_0x403b('0x26')][_0x403b('0x43')](_0x23af0a[_0x403b('0x44')],{})[_0x403b('0x3a')](respondWithResult(_0x46ee73,0xc9))[_0x403b('0x3d')](handleError(_0x46ee73,null));};exports[_0x403b('0x45')]=function(_0x55f720,_0x8cdb28){if(_0x55f720[_0x403b('0x44')]['id']){delete _0x55f720[_0x403b('0x44')]['id'];}return db[_0x403b('0x26')][_0x403b('0x46')]({'where':{'id':_0x55f720[_0x403b('0x3f')]['id']}})[_0x403b('0x3a')](handleEntityNotFound(_0x8cdb28,null))['then'](saveUpdates(_0x55f720[_0x403b('0x44')],null))[_0x403b('0x3a')](respondWithResult(_0x8cdb28,null))['catch'](handleError(_0x8cdb28,null));};exports[_0x403b('0x23')]=function(_0x401488,_0x5a20c2){return db[_0x403b('0x26')]['find']({'where':{'id':_0x401488[_0x403b('0x3f')]['id']}})[_0x403b('0x3a')](handleEntityNotFound(_0x5a20c2,null))[_0x403b('0x3a')](removeEntity(_0x5a20c2,null))['catch'](handleError(_0x5a20c2,null));};exports[_0x403b('0x47')]=function(_0x2b1400,_0x93be85,_0xc6808){return db[_0x403b('0x48')]['find']({'where':{'id':_0x2b1400[_0x403b('0x3f')]['id']}})[_0x403b('0x3a')](handleEntityNotFound(_0x93be85,null))['then'](function(_0x47c9a5){if(_0x47c9a5){return _0x47c9a5['addConditions'](_0x2b1400[_0x403b('0x44')][_0x403b('0x49')],_[_0x403b('0x4a')](_0x2b1400[_0x403b('0x44')],[_0x403b('0x49'),'id'])||{});}})[_0x403b('0x3a')](respondWithResult(_0x93be85,null))[_0x403b('0x3d')](handleError(_0x93be85,null));};exports[_0x403b('0x4b')]=function(_0x52c90a,_0x1d73d1,_0x49cbac){var _0x4803e8={};var _0x31a0f3={};var _0xd5817f;var _0x425b14;return db[_0x403b('0x26')]['findOne']({'where':{'id':_0x52c90a[_0x403b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1d73d1,null))[_0x403b('0x3a')](function(_0x2900cb){if(_0x2900cb){_0xd5817f=_0x2900cb;_0x31a0f3['model']=_[_0x403b('0x2b')](db[_0x403b('0x48')][_0x403b('0x27')]);_0x31a0f3[_0x403b('0x2a')]=_[_0x403b('0x2b')](_0x52c90a[_0x403b('0x2a')]);_0x31a0f3['filters']=_[_0x403b('0x40')](_0x31a0f3[_0x403b('0x2c')],_0x31a0f3[_0x403b('0x2a')]);_0x4803e8[_0x403b('0x2e')]=_[_0x403b('0x40')](_0x31a0f3[_0x403b('0x2c')],qs[_0x403b('0x2d')](_0x52c90a['query'][_0x403b('0x2d')]));_0x4803e8[_0x403b('0x2e')]=_0x4803e8[_0x403b('0x2e')][_0x403b('0x41')]?_0x4803e8['attributes']:_0x31a0f3[_0x403b('0x2c')];_0x4803e8[_0x403b('0x31')]=qs[_0x403b('0x32')](_0x52c90a['query']['sort']);_0x4803e8[_0x403b('0x33')]=qs['filters'](_['pick'](_0x52c90a[_0x403b('0x2a')],_0x31a0f3['filters']));if(_0x52c90a[_0x403b('0x2a')][_0x403b('0x36')]){_0x4803e8[_0x403b('0x33')]=_['merge'](_0x4803e8[_0x403b('0x33')],{'$or':_[_0x403b('0x25')](_0x4803e8['attributes'],function(_0x218e06){var _0x4876bd={};_0x4876bd[_0x218e06]={'$like':'%'+_0x52c90a['query'][_0x403b('0x36')]+'%'};return _0x4876bd;})});}_0x4803e8=_[_0x403b('0x38')]({},_0x4803e8,_0x52c90a['options']);return _0xd5817f['getConditions'](_0x4803e8);}})[_0x403b('0x3a')](function(_0x4f5fd1){if(_0x4f5fd1){_0x425b14=_0x4f5fd1['length'];if(!_0x52c90a['query']['hasOwnProperty'](_0x403b('0x30'))){_0x4803e8[_0x403b('0x1c')]=qs['limit'](_0x52c90a[_0x403b('0x2a')][_0x403b('0x1c')]);_0x4803e8[_0x403b('0x1b')]=qs[_0x403b('0x1b')](_0x52c90a[_0x403b('0x2a')]['offset']);}return _0xd5817f[_0x403b('0x4b')](_0x4803e8);}})[_0x403b('0x3a')](function(_0x44855d){if(_0x44855d){return _0x44855d?{'count':_0x425b14,'rows':_0x44855d}:null;}})[_0x403b('0x3a')](respondWithResult(_0x1d73d1,null))['catch'](handleError(_0x1d73d1,null));};exports[_0x403b('0x4c')]=function(_0x5e399d,_0x1d82a3,_0x359399){return db[_0x403b('0x4d')][_0x403b('0x46')]({'where':{'id':_0x5e399d[_0x403b('0x3f')]['id']}})[_0x403b('0x3a')](handleEntityNotFound(_0x1d82a3,null))[_0x403b('0x3a')](function(_0x2f14f6){if(_0x2f14f6){return _0x2f14f6['addActions'](_0x5e399d[_0x403b('0x44')][_0x403b('0x49')],_[_0x403b('0x4a')](_0x5e399d[_0x403b('0x44')],[_0x403b('0x49'),'id'])||{});}})[_0x403b('0x3a')](respondWithResult(_0x1d82a3,null))[_0x403b('0x3d')](handleError(_0x1d82a3,null));};exports[_0x403b('0x4e')]=function(_0x2d43ab,_0x24aa77,_0x4dec4d){var _0x567b0f={};var _0x4e2d4e={};var _0x229dd4;var _0xc077e4;return db[_0x403b('0x26')][_0x403b('0x4f')]({'where':{'id':_0x2d43ab['params']['id']}})['then'](handleEntityNotFound(_0x24aa77,null))[_0x403b('0x3a')](function(_0x426048){if(_0x426048){_0x229dd4=_0x426048;_0x4e2d4e['model']=_[_0x403b('0x2b')](db[_0x403b('0x4d')][_0x403b('0x27')]);_0x4e2d4e['query']=_['keys'](_0x2d43ab['query']);_0x4e2d4e['filters']=_[_0x403b('0x40')](_0x4e2d4e[_0x403b('0x2c')],_0x4e2d4e[_0x403b('0x2a')]);_0x567b0f[_0x403b('0x2e')]=_[_0x403b('0x40')](_0x4e2d4e[_0x403b('0x2c')],qs['fields'](_0x2d43ab['query']['fields']));_0x567b0f['attributes']=_0x567b0f[_0x403b('0x2e')][_0x403b('0x41')]?_0x567b0f[_0x403b('0x2e')]:_0x4e2d4e[_0x403b('0x2c')];_0x567b0f['order']=qs[_0x403b('0x32')](_0x2d43ab['query']['sort']);_0x567b0f[_0x403b('0x33')]=qs[_0x403b('0x35')](_[_0x403b('0x34')](_0x2d43ab['query'],_0x4e2d4e['filters']));if(_0x2d43ab[_0x403b('0x2a')][_0x403b('0x36')]){_0x567b0f['where']=_['merge'](_0x567b0f[_0x403b('0x33')],{'$or':_[_0x403b('0x25')](_0x567b0f[_0x403b('0x2e')],function(_0x4dbf0c){var _0x3a944d={};_0x3a944d[_0x4dbf0c]={'$like':'%'+_0x2d43ab['query'][_0x403b('0x36')]+'%'};return _0x3a944d;})});}_0x567b0f=_['merge']({},_0x567b0f,_0x2d43ab[_0x403b('0x39')]);return _0x229dd4[_0x403b('0x4e')](_0x567b0f);}})['then'](function(_0x2ebc11){if(_0x2ebc11){_0xc077e4=_0x2ebc11[_0x403b('0x41')];if(!_0x2d43ab[_0x403b('0x2a')][_0x403b('0x2f')](_0x403b('0x30'))){_0x567b0f[_0x403b('0x1c')]=qs['limit'](_0x2d43ab[_0x403b('0x2a')][_0x403b('0x1c')]);_0x567b0f[_0x403b('0x1b')]=qs[_0x403b('0x1b')](_0x2d43ab[_0x403b('0x2a')][_0x403b('0x1b')]);}return _0x229dd4[_0x403b('0x4e')](_0x567b0f);}})[_0x403b('0x3a')](function(_0x1658ee){if(_0x1658ee){return _0x1658ee?{'count':_0xc077e4,'rows':_0x1658ee}:null;}})[_0x403b('0x3a')](respondWithResult(_0x24aa77,null))[_0x403b('0x3d')](handleError(_0x24aa77,null));}; \ No newline at end of file +var _0x3821=['lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','error','stack','name','index','map','rawAttributes','key','query','attributes','fields','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','Automation','then','includeAll','include','rows','catch','show','params','keys','intersection','length','options','find','create','body','Condition','addConditions','ids','omit','getConditions','addActions','Action','getActions','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x7b59f0,_0x43505f){var _0x596190=function(_0x2f322e){while(--_0x2f322e){_0x7b59f0['push'](_0x7b59f0['shift']());}};_0x596190(++_0x43505f);}(_0x3821,0xe5));var _0x1382=function(_0x2360c7,_0x4b71fc){_0x2360c7=_0x2360c7-0x0;var _0x44cf57=_0x3821[_0x2360c7];return _0x44cf57;};'use strict';var emlformat=require(_0x1382('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1382('0x1'));var jsonpatch=require(_0x1382('0x2'));var rp=require(_0x1382('0x3'));var moment=require(_0x1382('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1382('0x5'));var path=require(_0x1382('0x6'));var sox=require(_0x1382('0x7'));var csv=require(_0x1382('0x8'));var ejs=require(_0x1382('0x9'));var fs=require('fs');var fs_extra=require(_0x1382('0xa'));var _=require(_0x1382('0xb'));var squel=require('squel');var crypto=require(_0x1382('0xc'));var jsforce=require(_0x1382('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1382('0x8'));var querystring=require('querystring');var Papa=require(_0x1382('0xe'));var Redis=require(_0x1382('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1382('0x10'));var as=require(_0x1382('0x11'));var hardwareService=require(_0x1382('0x12'));var logger=require(_0x1382('0x13'))(_0x1382('0x14'));var utils=require('../../config/utils');var config=require(_0x1382('0x15'));var licenseUtil=require(_0x1382('0x16'));var db=require(_0x1382('0x17'))['db'];function respondWithStatusCode(_0x24f77a,_0x1d5245){_0x1d5245=_0x1d5245||0xcc;return function(_0x2ff71e){if(_0x2ff71e){return _0x24f77a[_0x1382('0x18')](_0x1d5245);}return _0x24f77a[_0x1382('0x19')](_0x1d5245)[_0x1382('0x1a')]();};}function respondWithResult(_0x5dcc12,_0x47d698){_0x47d698=_0x47d698||0xc8;return function(_0x4b0fbf){if(_0x4b0fbf){return _0x5dcc12['status'](_0x47d698)['json'](_0x4b0fbf);}};}function respondWithFilteredResult(_0x53e6e2,_0x5124d5){return function(_0x21c68b){if(_0x21c68b){var _0x23eb0b=typeof _0x5124d5[_0x1382('0x1b')]===_0x1382('0x1c')&&typeof _0x5124d5[_0x1382('0x1d')]==='undefined';var _0x4bc22d=_0x21c68b['count'];var _0x47fb25=_0x23eb0b?0x0:_0x5124d5[_0x1382('0x1b')];var _0x4a9e20=_0x23eb0b?_0x21c68b[_0x1382('0x1e')]:_0x5124d5[_0x1382('0x1b')]+_0x5124d5['limit'];var _0x11cb7a;if(_0x4a9e20>=_0x4bc22d){_0x4a9e20=_0x4bc22d;_0x11cb7a=0xc8;}else{_0x11cb7a=0xce;}_0x53e6e2[_0x1382('0x19')](_0x11cb7a);return _0x53e6e2['set'](_0x1382('0x1f'),_0x47fb25+'-'+_0x4a9e20+'/'+_0x4bc22d)['json'](_0x21c68b);}return null;};}function patchUpdates(_0x1ab3ef){return function(_0xbab65b){try{jsonpatch[_0x1382('0x20')](_0xbab65b,_0x1ab3ef,!![]);}catch(_0x33b97c){return BPromise[_0x1382('0x21')](_0x33b97c);}return _0xbab65b[_0x1382('0x22')]();};}function saveUpdates(_0x58c650,_0x2274a0){return function(_0x2e7890){if(_0x2e7890){return _0x2e7890['update'](_0x58c650)['then'](function(_0x4e4547){return _0x4e4547;});}return null;};}function removeEntity(_0x501368,_0x4c89ea){return function(_0xf82423){if(_0xf82423){return _0xf82423[_0x1382('0x23')]()['then'](function(){_0x501368[_0x1382('0x19')](0xcc)[_0x1382('0x1a')]();});}};}function handleEntityNotFound(_0x5a22a7,_0x3680b9){return function(_0x2781bd){if(!_0x2781bd){_0x5a22a7[_0x1382('0x18')](0x194);}return _0x2781bd;};}function handleError(_0x3ce8d3,_0x3c4dbe){_0x3c4dbe=_0x3c4dbe||0x1f4;return function(_0x47aceb){logger[_0x1382('0x24')](_0x47aceb[_0x1382('0x25')]);if(_0x47aceb[_0x1382('0x26')]){delete _0x47aceb[_0x1382('0x26')];}_0x3ce8d3[_0x1382('0x19')](_0x3c4dbe)['send'](_0x47aceb);};}exports[_0x1382('0x27')]=function(_0x28d22e,_0x282831){var _0x272fe6={},_0x3d2050={},_0x24e45f={'count':0x0,'rows':[]};var _0x34cf7d=_[_0x1382('0x28')](db['Automation'][_0x1382('0x29')],function(_0x7dd14e){return{'name':_0x7dd14e['fieldName'],'type':_0x7dd14e['type'][_0x1382('0x2a')]};});_0x3d2050['model']=_['map'](_0x34cf7d,_0x1382('0x26'));_0x3d2050['query']=_['keys'](_0x28d22e[_0x1382('0x2b')]);_0x3d2050['filters']=_['intersection'](_0x3d2050['model'],_0x3d2050['query']);_0x272fe6[_0x1382('0x2c')]=_['intersection'](_0x3d2050['model'],qs[_0x1382('0x2d')](_0x28d22e[_0x1382('0x2b')]['fields']));_0x272fe6[_0x1382('0x2c')]=_0x272fe6['attributes']['length']?_0x272fe6[_0x1382('0x2c')]:_0x3d2050[_0x1382('0x2e')];if(!_0x28d22e[_0x1382('0x2b')][_0x1382('0x2f')](_0x1382('0x30'))){_0x272fe6[_0x1382('0x1d')]=qs[_0x1382('0x1d')](_0x28d22e[_0x1382('0x2b')]['limit']);_0x272fe6[_0x1382('0x1b')]=qs[_0x1382('0x1b')](_0x28d22e[_0x1382('0x2b')][_0x1382('0x1b')]);}_0x272fe6[_0x1382('0x31')]=qs[_0x1382('0x32')](_0x28d22e[_0x1382('0x2b')][_0x1382('0x32')]);_0x272fe6[_0x1382('0x33')]=qs[_0x1382('0x34')](_[_0x1382('0x35')](_0x28d22e[_0x1382('0x2b')],_0x3d2050[_0x1382('0x34')]),_0x34cf7d);if(_0x28d22e['query'][_0x1382('0x36')]){_0x272fe6[_0x1382('0x33')]=_[_0x1382('0x37')](_0x272fe6[_0x1382('0x33')],{'$or':_['map'](_0x34cf7d,function(_0x493f1a){if(_0x493f1a['type']!=='VIRTUAL'){var _0x4382e8={};_0x4382e8[_0x493f1a[_0x1382('0x26')]]={'$like':'%'+_0x28d22e[_0x1382('0x2b')][_0x1382('0x36')]+'%'};return _0x4382e8;}})});}_0x272fe6=_['merge']({},_0x272fe6,_0x28d22e['options']);var _0x5011b2={'where':_0x272fe6['where']};return db[_0x1382('0x38')][_0x1382('0x1e')](_0x5011b2)[_0x1382('0x39')](function(_0x2fece5){_0x24e45f[_0x1382('0x1e')]=_0x2fece5;if(_0x28d22e['query'][_0x1382('0x3a')]){_0x272fe6[_0x1382('0x3b')]=[{'all':!![]}];}return db[_0x1382('0x38')]['findAll'](_0x272fe6);})[_0x1382('0x39')](function(_0x23cfe2){_0x24e45f[_0x1382('0x3c')]=_0x23cfe2;return _0x24e45f;})[_0x1382('0x39')](respondWithFilteredResult(_0x282831,_0x272fe6))[_0x1382('0x3d')](handleError(_0x282831,null));};exports[_0x1382('0x3e')]=function(_0x360185,_0x2191eb){var _0x3aa4da={'raw':![],'where':{'id':_0x360185[_0x1382('0x3f')]['id']}},_0x1e0071={};_0x1e0071[_0x1382('0x2e')]=_[_0x1382('0x40')](db[_0x1382('0x38')][_0x1382('0x29')]);_0x1e0071['query']=_[_0x1382('0x40')](_0x360185[_0x1382('0x2b')]);_0x1e0071['filters']=_['intersection'](_0x1e0071['model'],_0x1e0071[_0x1382('0x2b')]);_0x3aa4da['attributes']=_[_0x1382('0x41')](_0x1e0071['model'],qs[_0x1382('0x2d')](_0x360185[_0x1382('0x2b')]['fields']));_0x3aa4da['attributes']=_0x3aa4da['attributes'][_0x1382('0x42')]?_0x3aa4da[_0x1382('0x2c')]:_0x1e0071[_0x1382('0x2e')];if(_0x360185[_0x1382('0x2b')][_0x1382('0x3a')]){_0x3aa4da['include']=[{'all':!![]}];}_0x3aa4da=_['merge']({},_0x3aa4da,_0x360185[_0x1382('0x43')]);return db['Automation'][_0x1382('0x44')](_0x3aa4da)[_0x1382('0x39')](handleEntityNotFound(_0x2191eb,null))[_0x1382('0x39')](respondWithResult(_0x2191eb,null))['catch'](handleError(_0x2191eb,null));};exports[_0x1382('0x45')]=function(_0x5860c2,_0x194556){return db[_0x1382('0x38')][_0x1382('0x45')](_0x5860c2[_0x1382('0x46')],{})[_0x1382('0x39')](respondWithResult(_0x194556,0xc9))[_0x1382('0x3d')](handleError(_0x194556,null));};exports['update']=function(_0xc4a11,_0x1520a9){if(_0xc4a11[_0x1382('0x46')]['id']){delete _0xc4a11[_0x1382('0x46')]['id'];}return db[_0x1382('0x38')][_0x1382('0x44')]({'where':{'id':_0xc4a11[_0x1382('0x3f')]['id']}})[_0x1382('0x39')](handleEntityNotFound(_0x1520a9,null))[_0x1382('0x39')](saveUpdates(_0xc4a11[_0x1382('0x46')],null))[_0x1382('0x39')](respondWithResult(_0x1520a9,null))[_0x1382('0x3d')](handleError(_0x1520a9,null));};exports[_0x1382('0x23')]=function(_0x575ea7,_0x4b88d2){return db['Automation']['find']({'where':{'id':_0x575ea7[_0x1382('0x3f')]['id']}})[_0x1382('0x39')](handleEntityNotFound(_0x4b88d2,null))[_0x1382('0x39')](removeEntity(_0x4b88d2,null))[_0x1382('0x3d')](handleError(_0x4b88d2,null));};exports['addConditions']=function(_0x5d6b1c,_0x4009b2,_0x519166){return db[_0x1382('0x47')][_0x1382('0x44')]({'where':{'id':_0x5d6b1c[_0x1382('0x3f')]['id']}})[_0x1382('0x39')](handleEntityNotFound(_0x4009b2,null))[_0x1382('0x39')](function(_0x11ba49){if(_0x11ba49){return _0x11ba49[_0x1382('0x48')](_0x5d6b1c['body'][_0x1382('0x49')],_[_0x1382('0x4a')](_0x5d6b1c[_0x1382('0x46')],[_0x1382('0x49'),'id'])||{});}})[_0x1382('0x39')](respondWithResult(_0x4009b2,null))['catch'](handleError(_0x4009b2,null));};exports[_0x1382('0x4b')]=function(_0x3e09f3,_0x426b95,_0x8f3f2b){var _0x36e155={};var _0x3c55d3={};var _0x4677ab;var _0x1fa5df;return db[_0x1382('0x38')]['findOne']({'where':{'id':_0x3e09f3[_0x1382('0x3f')]['id']}})[_0x1382('0x39')](handleEntityNotFound(_0x426b95,null))[_0x1382('0x39')](function(_0x242d66){if(_0x242d66){_0x4677ab=_0x242d66;_0x3c55d3[_0x1382('0x2e')]=_[_0x1382('0x40')](db[_0x1382('0x47')][_0x1382('0x29')]);_0x3c55d3[_0x1382('0x2b')]=_[_0x1382('0x40')](_0x3e09f3[_0x1382('0x2b')]);_0x3c55d3[_0x1382('0x34')]=_[_0x1382('0x41')](_0x3c55d3['model'],_0x3c55d3[_0x1382('0x2b')]);_0x36e155[_0x1382('0x2c')]=_[_0x1382('0x41')](_0x3c55d3[_0x1382('0x2e')],qs['fields'](_0x3e09f3[_0x1382('0x2b')]['fields']));_0x36e155['attributes']=_0x36e155[_0x1382('0x2c')][_0x1382('0x42')]?_0x36e155[_0x1382('0x2c')]:_0x3c55d3[_0x1382('0x2e')];_0x36e155[_0x1382('0x31')]=qs[_0x1382('0x32')](_0x3e09f3[_0x1382('0x2b')][_0x1382('0x32')]);_0x36e155[_0x1382('0x33')]=qs[_0x1382('0x34')](_[_0x1382('0x35')](_0x3e09f3['query'],_0x3c55d3[_0x1382('0x34')]));if(_0x3e09f3[_0x1382('0x2b')][_0x1382('0x36')]){_0x36e155[_0x1382('0x33')]=_['merge'](_0x36e155['where'],{'$or':_[_0x1382('0x28')](_0x36e155[_0x1382('0x2c')],function(_0xfae43b){var _0x1f7850={};_0x1f7850[_0xfae43b]={'$like':'%'+_0x3e09f3[_0x1382('0x2b')][_0x1382('0x36')]+'%'};return _0x1f7850;})});}_0x36e155=_[_0x1382('0x37')]({},_0x36e155,_0x3e09f3[_0x1382('0x43')]);return _0x4677ab[_0x1382('0x4b')](_0x36e155);}})[_0x1382('0x39')](function(_0x4029f3){if(_0x4029f3){_0x1fa5df=_0x4029f3[_0x1382('0x42')];if(!_0x3e09f3[_0x1382('0x2b')][_0x1382('0x2f')](_0x1382('0x30'))){_0x36e155[_0x1382('0x1d')]=qs['limit'](_0x3e09f3[_0x1382('0x2b')]['limit']);_0x36e155[_0x1382('0x1b')]=qs[_0x1382('0x1b')](_0x3e09f3[_0x1382('0x2b')]['offset']);}return _0x4677ab['getConditions'](_0x36e155);}})[_0x1382('0x39')](function(_0x351ffd){if(_0x351ffd){return _0x351ffd?{'count':_0x1fa5df,'rows':_0x351ffd}:null;}})['then'](respondWithResult(_0x426b95,null))[_0x1382('0x3d')](handleError(_0x426b95,null));};exports[_0x1382('0x4c')]=function(_0x4c0e94,_0x1d5b14,_0x47f1b6){return db[_0x1382('0x4d')][_0x1382('0x44')]({'where':{'id':_0x4c0e94[_0x1382('0x3f')]['id']}})[_0x1382('0x39')](handleEntityNotFound(_0x1d5b14,null))[_0x1382('0x39')](function(_0x1cfd1d){if(_0x1cfd1d){return _0x1cfd1d[_0x1382('0x4c')](_0x4c0e94['body'][_0x1382('0x49')],_[_0x1382('0x4a')](_0x4c0e94['body'],[_0x1382('0x49'),'id'])||{});}})[_0x1382('0x39')](respondWithResult(_0x1d5b14,null))[_0x1382('0x3d')](handleError(_0x1d5b14,null));};exports[_0x1382('0x4e')]=function(_0x587203,_0x5af2fb,_0x40b8fe){var _0x5867a8={};var _0x4fe2c6={};var _0x159ed9;var _0x4994b1;return db[_0x1382('0x38')][_0x1382('0x4f')]({'where':{'id':_0x587203[_0x1382('0x3f')]['id']}})[_0x1382('0x39')](handleEntityNotFound(_0x5af2fb,null))[_0x1382('0x39')](function(_0x3ec992){if(_0x3ec992){_0x159ed9=_0x3ec992;_0x4fe2c6[_0x1382('0x2e')]=_[_0x1382('0x40')](db[_0x1382('0x4d')][_0x1382('0x29')]);_0x4fe2c6[_0x1382('0x2b')]=_['keys'](_0x587203[_0x1382('0x2b')]);_0x4fe2c6[_0x1382('0x34')]=_[_0x1382('0x41')](_0x4fe2c6[_0x1382('0x2e')],_0x4fe2c6[_0x1382('0x2b')]);_0x5867a8[_0x1382('0x2c')]=_[_0x1382('0x41')](_0x4fe2c6['model'],qs['fields'](_0x587203['query'][_0x1382('0x2d')]));_0x5867a8[_0x1382('0x2c')]=_0x5867a8['attributes'][_0x1382('0x42')]?_0x5867a8[_0x1382('0x2c')]:_0x4fe2c6[_0x1382('0x2e')];_0x5867a8[_0x1382('0x31')]=qs['sort'](_0x587203['query']['sort']);_0x5867a8[_0x1382('0x33')]=qs[_0x1382('0x34')](_[_0x1382('0x35')](_0x587203['query'],_0x4fe2c6[_0x1382('0x34')]));if(_0x587203['query'][_0x1382('0x36')]){_0x5867a8['where']=_['merge'](_0x5867a8['where'],{'$or':_[_0x1382('0x28')](_0x5867a8['attributes'],function(_0x5c9f4a){var _0x379192={};_0x379192[_0x5c9f4a]={'$like':'%'+_0x587203[_0x1382('0x2b')][_0x1382('0x36')]+'%'};return _0x379192;})});}_0x5867a8=_['merge']({},_0x5867a8,_0x587203[_0x1382('0x43')]);return _0x159ed9[_0x1382('0x4e')](_0x5867a8);}})[_0x1382('0x39')](function(_0x579faa){if(_0x579faa){_0x4994b1=_0x579faa[_0x1382('0x42')];if(!_0x587203['query'][_0x1382('0x2f')](_0x1382('0x30'))){_0x5867a8[_0x1382('0x1d')]=qs[_0x1382('0x1d')](_0x587203[_0x1382('0x2b')][_0x1382('0x1d')]);_0x5867a8[_0x1382('0x1b')]=qs[_0x1382('0x1b')](_0x587203[_0x1382('0x2b')]['offset']);}return _0x159ed9[_0x1382('0x4e')](_0x5867a8);}})[_0x1382('0x39')](function(_0x1a60d2){if(_0x1a60d2){return _0x1a60d2?{'count':_0x4994b1,'rows':_0x1a60d2}:null;}})[_0x1382('0x39')](respondWithResult(_0x5af2fb,null))[_0x1382('0x3d')](handleError(_0x5af2fb,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 095a21f..103dd3b 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 _0x3ee2=['tools_automations','lodash','util','api','bluebird','request-promise','path','../../config/environment','./automation.attributes','exports','define','Automation'];(function(_0x48ea4b,_0x31ff53){var _0x13f7d6=function(_0xe198fb){while(--_0xe198fb){_0x48ea4b['push'](_0x48ea4b['shift']());}};_0x13f7d6(++_0x31ff53);}(_0x3ee2,0xb5));var _0x23ee=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x3ee2[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x23ee('0x0'));var util=require(_0x23ee('0x1'));var logger=require('../../config/logger')(_0x23ee('0x2'));var moment=require('moment');var BPromise=require(_0x23ee('0x3'));var rp=require(_0x23ee('0x4'));var fs=require('fs');var path=require(_0x23ee('0x5'));var rimraf=require('rimraf');var config=require(_0x23ee('0x6'));var attributes=require(_0x23ee('0x7'));module[_0x23ee('0x8')]=function(_0x30f44d,_0x385038){return _0x30f44d[_0x23ee('0x9')](_0x23ee('0xa'),attributes,{'tableName':_0x23ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6321=['tools_automations','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./automation.attributes','exports','define'];(function(_0xb68772,_0x5253ac){var _0x4189bb=function(_0x1b0cf3){while(--_0x1b0cf3){_0xb68772['push'](_0xb68772['shift']());}};_0x4189bb(++_0x5253ac);}(_0x6321,0x114));var _0x1632=function(_0x2591b2,_0x29992c){_0x2591b2=_0x2591b2-0x0;var _0x13fe70=_0x6321[_0x2591b2];return _0x13fe70;};'use strict';var _=require('lodash');var util=require(_0x1632('0x0'));var logger=require(_0x1632('0x1'))('api');var moment=require(_0x1632('0x2'));var BPromise=require(_0x1632('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1632('0x4'));var rimraf=require(_0x1632('0x5'));var config=require(_0x1632('0x6'));var attributes=require(_0x1632('0x7'));module[_0x1632('0x8')]=function(_0x3de7c7,_0x38b23d){return _0x3de7c7[_0x1632('0x9')]('Automation',attributes,{'tableName':_0x1632('0xa'),'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 950c999..1172407 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 _0x8b35=['code','Automation,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','stringify','error'];(function(_0xb7c5cc,_0x2af752){var _0x165be5=function(_0x5726e9){while(--_0x5726e9){_0xb7c5cc['push'](_0xb7c5cc['shift']());}};_0x165be5(++_0x2af752);}(_0x8b35,0x17a));var _0x58b3=function(_0x33075d,_0x557cc9){_0x33075d=_0x33075d-0x0;var _0x28a237=_0x8b35[_0x33075d];return _0x28a237;};'use strict';var _=require(_0x58b3('0x0'));var util=require(_0x58b3('0x1'));var moment=require(_0x58b3('0x2'));var BPromise=require(_0x58b3('0x3'));var rs=require(_0x58b3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58b3('0x5'))['db'];var utils=require(_0x58b3('0x6'));var logger=require(_0x58b3('0x7'))(_0x58b3('0x8'));var config=require(_0x58b3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x58b3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35d044,_0x5ec362,_0x503b78){return new BPromise(function(_0x126232,_0x46fda3){return client[_0x58b3('0xb')](_0x35d044,_0x503b78)[_0x58b3('0xc')](function(_0x446e8d){logger[_0x58b3('0xd')]('Automation,\x20%s,\x20%s',_0x5ec362,_0x58b3('0xe'));logger[_0x58b3('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0x5ec362,_0x58b3('0xe'),JSON[_0x58b3('0x10')](_0x446e8d));if(_0x446e8d[_0x58b3('0x11')]){if(_0x446e8d['error'][_0x58b3('0x12')]===0x1f4){logger['error'](_0x58b3('0x13'),_0x5ec362,_0x446e8d[_0x58b3('0x11')][_0x58b3('0x14')]);return _0x46fda3(_0x446e8d[_0x58b3('0x11')][_0x58b3('0x14')]);}logger[_0x58b3('0x11')](_0x58b3('0x13'),_0x5ec362,_0x446e8d['error'][_0x58b3('0x14')]);return _0x126232(_0x446e8d[_0x58b3('0x11')]['message']);}else{logger[_0x58b3('0xd')](_0x58b3('0x13'),_0x5ec362,'request\x20sent');_0x126232(_0x446e8d['result'][_0x58b3('0x14')]);}})[_0x58b3('0x15')](function(_0x38f6a7){logger[_0x58b3('0x11')]('Automation,\x20%s,\x20%s',_0x5ec362,_0x38f6a7);_0x46fda3(_0x38f6a7);});});} \ No newline at end of file +var _0x4af8=['request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','message','Automation,\x20%s,\x20%s','result','catch','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info'];(function(_0x44faf5,_0x1f0f92){var _0x4c0a90=function(_0x46f01e){while(--_0x46f01e){_0x44faf5['push'](_0x44faf5['shift']());}};_0x4c0a90(++_0x1f0f92);}(_0x4af8,0x1ad));var _0x84af=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x4af8[_0x12d033];return _0x3b4e80;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x84af('0x0'));var fs=require('fs');var Redis=require(_0x84af('0x1'));var db=require(_0x84af('0x2'))['db'];var utils=require(_0x84af('0x3'));var logger=require('../../config/logger')(_0x84af('0x4'));var config=require(_0x84af('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x84af('0x6')][_0x84af('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x550ee6,_0x422c5b,_0x294bc8){return new BPromise(function(_0x483ecc,_0x5b5e45){return client[_0x84af('0x8')](_0x550ee6,_0x294bc8)[_0x84af('0x9')](function(_0x479e1b){logger[_0x84af('0xa')]('Automation,\x20%s,\x20%s',_0x422c5b,_0x84af('0xb'));logger[_0x84af('0xc')](_0x84af('0xd'),_0x422c5b,_0x84af('0xb'),JSON['stringify'](_0x479e1b));if(_0x479e1b[_0x84af('0xe')]){if(_0x479e1b['error'][_0x84af('0xf')]===0x1f4){logger[_0x84af('0xe')]('Automation,\x20%s,\x20%s',_0x422c5b,_0x479e1b[_0x84af('0xe')][_0x84af('0x10')]);return _0x5b5e45(_0x479e1b[_0x84af('0xe')][_0x84af('0x10')]);}logger['error'](_0x84af('0x11'),_0x422c5b,_0x479e1b['error'][_0x84af('0x10')]);return _0x483ecc(_0x479e1b[_0x84af('0xe')]['message']);}else{logger[_0x84af('0xa')](_0x84af('0x11'),_0x422c5b,'request\x20sent');_0x483ecc(_0x479e1b[_0x84af('0x12')]['message']);}})[_0x84af('0x13')](function(_0x33baf1){logger['error']('Automation,\x20%s,\x20%s',_0x422c5b,_0x33baf1);_0x5b5e45(_0x33baf1);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 7f08fef..1ccdf6d 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 _0x3c17=['Router','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','get','index','/:id','isAuthenticated','show','getConditions','/:id/actions','getActions','post','/:id/conditions','addConditions','addActions','destroy','multer','path','express'];(function(_0x4b7022,_0x20c8c0){var _0x4d70d2=function(_0x3455e3){while(--_0x3455e3){_0x4b7022['push'](_0x4b7022['shift']());}};_0x4d70d2(++_0x20c8c0);}(_0x3c17,0x1a1));var _0x73c1=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x3c17[_0x4e1d03];return _0x362d4b;};'use strict';var multer=require(_0x73c1('0x0'));var util=require('util');var path=require(_0x73c1('0x1'));var timeout=require('connect-timeout');var express=require(_0x73c1('0x2'));var router=express[_0x73c1('0x3')]();var fs_extra=require(_0x73c1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x73c1('0x5'));var config=require(_0x73c1('0x6'));var controller=require(_0x73c1('0x7'));router[_0x73c1('0x8')]('/',auth['isAuthenticated'](),controller[_0x73c1('0x9')]);router['get'](_0x73c1('0xa'),auth[_0x73c1('0xb')](),controller[_0x73c1('0xc')]);router['get']('/:id/conditions',auth[_0x73c1('0xb')](),controller[_0x73c1('0xd')]);router[_0x73c1('0x8')](_0x73c1('0xe'),auth[_0x73c1('0xb')](),controller[_0x73c1('0xf')]);router[_0x73c1('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x73c1('0x10')](_0x73c1('0x11'),auth[_0x73c1('0xb')](),controller[_0x73c1('0x12')]);router['post'](_0x73c1('0xe'),auth['isAuthenticated'](),controller[_0x73c1('0x13')]);router['put'](_0x73c1('0xa'),auth[_0x73c1('0xb')](),controller['update']);router['delete'](_0x73c1('0xa'),auth['isAuthenticated'](),controller[_0x73c1('0x14')]);module['exports']=router; \ No newline at end of file +var _0xd7ed=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','getActions','post','create','addConditions','addActions','put','update','delete','exports','util'];(function(_0x155665,_0x1bb0e2){var _0x5728b6=function(_0x2acbf0){while(--_0x2acbf0){_0x155665['push'](_0x155665['shift']());}};_0x5728b6(++_0x1bb0e2);}(_0xd7ed,0x1a8));var _0xdd7e=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0xd7ed[_0x56916d];return _0x2b7f1f;};'use strict';var multer=require('multer');var util=require(_0xdd7e('0x0'));var path=require(_0xdd7e('0x1'));var timeout=require(_0xdd7e('0x2'));var express=require(_0xdd7e('0x3'));var router=express[_0xdd7e('0x4')]();var fs_extra=require(_0xdd7e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdd7e('0x6'));var config=require(_0xdd7e('0x7'));var controller=require(_0xdd7e('0x8'));router[_0xdd7e('0x9')]('/',auth[_0xdd7e('0xa')](),controller[_0xdd7e('0xb')]);router['get'](_0xdd7e('0xc'),auth['isAuthenticated'](),controller[_0xdd7e('0xd')]);router[_0xdd7e('0x9')](_0xdd7e('0xe'),auth[_0xdd7e('0xa')](),controller[_0xdd7e('0xf')]);router['get']('/:id/actions',auth[_0xdd7e('0xa')](),controller[_0xdd7e('0x10')]);router[_0xdd7e('0x11')]('/',auth['isAuthenticated'](),controller[_0xdd7e('0x12')]);router[_0xdd7e('0x11')](_0xdd7e('0xe'),auth[_0xdd7e('0xa')](),controller[_0xdd7e('0x13')]);router[_0xdd7e('0x11')]('/:id/actions',auth[_0xdd7e('0xa')](),controller[_0xdd7e('0x14')]);router[_0xdd7e('0x15')](_0xdd7e('0xc'),auth[_0xdd7e('0xa')](),controller[_0xdd7e('0x16')]);router[_0xdd7e('0x17')](_0xdd7e('0xc'),auth[_0xdd7e('0xa')](),controller['destroy']);module[_0xdd7e('0x18')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index db22b90..a14778d 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 _0xb8a0=['Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ivr','INTEGER','UNSIGNED','Max\x20200\x20calls.','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)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','ENUM','always','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','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)'];(function(_0x5aba20,_0x399db1){var _0x42fadb=function(_0xd1da6b){while(--_0xd1da6b){_0x5aba20['push'](_0x5aba20['shift']());}};_0x42fadb(++_0x399db1);}(_0xb8a0,0x111));var _0x0b8a=function(_0x38fb3c,_0x31514a){_0x38fb3c=_0x38fb3c-0x0;var _0x34b0b8=_0xb8a0[_0x38fb3c];return _0x34b0b8;};'use strict';var Sequelize=require('sequelize');module[_0x0b8a('0x0')]={'name':{'type':Sequelize[_0x0b8a('0x1')],'unique':_0x0b8a('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x0b8a('0x3')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x0b8a('0x4')](0x4)[_0x0b8a('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x0b8a('0x6')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0b8a('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x0b8a('0x4')](0x3)[_0x0b8a('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0b8a('0x7')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0b8a('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0b8a('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0b8a('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0b8a('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0x0b8a('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0b8a('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0b8a('0x4')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0b8a('0x4')](0x3)[_0x0b8a('0x5')],'defaultValue':0x3,'comment':_0x0b8a('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0b8a('0x4')](0x5)[_0x0b8a('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0b8a('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0b8a('0x4')](0x3)[_0x0b8a('0x5')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x0b8a('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0b8a('0x1')],'defaultValue':_0x0b8a('0xd')},'dialCheckDuplicateType':{'type':Sequelize[_0x0b8a('0xe')](_0x0b8a('0xf'),_0x0b8a('0x10'),_0x0b8a('0x11')),'defaultValue':_0x0b8a('0xf')},'dialAMDActive':{'type':Sequelize[_0x0b8a('0x12')],'defaultValue':0x0,'comment':_0x0b8a('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x0b8a('0x4')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x0b8a('0x5')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0b8a('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x0b8a('0x5')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0b8a('0x4')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0b8a('0x15')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x0b8a('0x5')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0b8a('0x4')](0x9)[_0x0b8a('0x5')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0b8a('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x0b8a('0x5')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0b8a('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0b8a('0x4')](0x5)[_0x0b8a('0x5')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0b8a('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0b8a('0x4')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0b8a('0x19')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC','ASC'),'defaultValue':_0x0b8a('0x1a')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x0b8a('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x0b8a('0x4')](0x3)[_0x0b8a('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0b8a('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0b8a('0x4')](0x3)[_0x0b8a('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0b8a('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0b8a('0x4')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x0b8a('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0b8a('0x1d')},'dialDropRetryFrequency':{'type':Sequelize[_0x0b8a('0x4')](0x5)[_0x0b8a('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0b8a('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0b8a('0x4')](0x3)[_0x0b8a('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0b8a('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0b8a('0x4')](0x5)[_0x0b8a('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0b8a('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x0b8a('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0b8a('0x4')](0x5)[_0x0b8a('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0b8a('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0b8a('0x4')](0x3)[_0x0b8a('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0b8a('0x4')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x4838=['never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','name','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','#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)','always'];(function(_0x302514,_0x2f2385){var _0x1c13ee=function(_0x127a4a){while(--_0x127a4a){_0x302514['push'](_0x302514['shift']());}};_0x1c13ee(++_0x2f2385);}(_0x4838,0x111));var _0x8483=function(_0x5a078f,_0x5aeb9b){_0x5a078f=_0x5a078f-0x0;var _0x22b22d=_0x4838[_0x5a078f];return _0x22b22d;};'use strict';var Sequelize=require('sequelize');module[_0x8483('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x8483('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x8483('0x2')](_0x8483('0x3')),'allowNull':![],'defaultValue':_0x8483('0x3')},'description':{'type':Sequelize[_0x8483('0x4')]},'active':{'type':Sequelize[_0x8483('0x5')],'defaultValue':0x0,'comment':_0x8483('0x6')},'limitCalls':{'type':Sequelize[_0x8483('0x7')](0x4)[_0x8483('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x8483('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x8483('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8483('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0x8483('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8483('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8483('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8483('0x7')](0x5)[_0x8483('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8483('0xb')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8483('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8483('0xc')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8483('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8483('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8483('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8483('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8483('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x8483('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8483('0x4')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x8483('0x2')](_0x8483('0xe'),_0x8483('0xf'),_0x8483('0x10')),'defaultValue':_0x8483('0xe')},'dialAMDActive':{'type':Sequelize[_0x8483('0x5')],'defaultValue':0x0,'comment':_0x8483('0x11')},'dialAMDInitialSilence':{'type':Sequelize[_0x8483('0x7')](0x9)[_0x8483('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8483('0x12')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x8483('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8483('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8483('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8483('0x14')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x8483('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x8483('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8483('0x7')](0x9)[_0x8483('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8483('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8483('0x7')](0x9)[_0x8483('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8483('0x7')](0x9)[_0x8483('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x8483('0x17'),'ASC'),'defaultValue':_0x8483('0x17')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8483('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8483('0x18')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x8483('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8483('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x8483('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8483('0x19')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8483('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8483('0x1a')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8483('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x8483('0x7')](0x3)[_0x8483('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8483('0x1b')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8483('0x1c')},'dialMachineMaxRetry':{'type':Sequelize[_0x8483('0x7')](0x3)[_0x8483('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8483('0x1d')},'dialMachineRetryFrequency':{'type':Sequelize[_0x8483('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8483('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8483('0x1e')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8483('0x7')](0x5)[_0x8483('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8483('0x1f')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 9d521c2..ddf3318 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 _0x79dc=['CampaignId','CmHopper','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','rows','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','into','fromQuery','scheduledAt','ListId','select','field','phone','NOW()','ContactId','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','insert','cm_hopper','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','IvrCampaigns','error','stack','name','send','index','map','rawAttributes','type','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filters','where','merge','VIRTUAL','filter','options','Campaign','includeAll','include','catch','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','destroy','findOne','nolimit'];(function(_0x33f6be,_0x2864a6){var _0x3de6ac=function(_0x3e5c26){while(--_0x3e5c26){_0x33f6be['push'](_0x33f6be['shift']());}};_0x3de6ac(++_0x2864a6);}(_0x79dc,0x13a));var _0xc79d=function(_0x128152,_0x2944b7){_0x128152=_0x128152-0x0;var _0x87e1ec=_0x79dc[_0x128152];return _0x87e1ec;};'use strict';var emlformat=require(_0xc79d('0x0'));var rimraf=require(_0xc79d('0x1'));var zipdir=require(_0xc79d('0x2'));var jsonpatch=require(_0xc79d('0x3'));var rp=require(_0xc79d('0x4'));var moment=require(_0xc79d('0x5'));var BPromise=require(_0xc79d('0x6'));var Mustache=require(_0xc79d('0x7'));var util=require(_0xc79d('0x8'));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(_0xc79d('0x9'));var _=require(_0xc79d('0xa'));var squel=require(_0xc79d('0xb'));var crypto=require('crypto');var jsforce=require(_0xc79d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc79d('0xd'));var querystring=require(_0xc79d('0xe'));var Papa=require(_0xc79d('0xf'));var Redis=require(_0xc79d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc79d('0x11'));var as=require(_0xc79d('0x12'));var hardwareService=require(_0xc79d('0x13'));var logger=require('../../config/logger')(_0xc79d('0x14'));var utils=require(_0xc79d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc79d('0x16'));var db=require(_0xc79d('0x17'))['db'];function respondWithStatusCode(_0xe71829,_0x20c888){_0x20c888=_0x20c888||0xcc;return function(_0x3862d9){if(_0x3862d9){return _0xe71829[_0xc79d('0x18')](_0x20c888);}return _0xe71829['status'](_0x20c888)[_0xc79d('0x19')]();};}function respondWithResult(_0x31841c,_0x35906c){_0x35906c=_0x35906c||0xc8;return function(_0x30e925){if(_0x30e925){return _0x31841c[_0xc79d('0x1a')](_0x35906c)[_0xc79d('0x1b')](_0x30e925);}};}function respondWithFilteredResult(_0x555db3,_0x34294e){return function(_0x5c46fe){if(_0x5c46fe){var _0x582bed=typeof _0x34294e[_0xc79d('0x1c')]==='undefined'&&typeof _0x34294e[_0xc79d('0x1d')]===_0xc79d('0x1e');var _0xee71c8=_0x5c46fe[_0xc79d('0x1f')];var _0x452e28=_0x582bed?0x0:_0x34294e['offset'];var _0x34f516=_0x582bed?_0x5c46fe[_0xc79d('0x1f')]:_0x34294e[_0xc79d('0x1c')]+_0x34294e[_0xc79d('0x1d')];var _0x2dde1c;if(_0x34f516>=_0xee71c8){_0x34f516=_0xee71c8;_0x2dde1c=0xc8;}else{_0x2dde1c=0xce;}_0x555db3[_0xc79d('0x1a')](_0x2dde1c);return _0x555db3[_0xc79d('0x20')](_0xc79d('0x21'),_0x452e28+'-'+_0x34f516+'/'+_0xee71c8)[_0xc79d('0x1b')](_0x5c46fe);}return null;};}function patchUpdates(_0x42f0cc){return function(_0x268ea1){try{jsonpatch[_0xc79d('0x22')](_0x268ea1,_0x42f0cc,!![]);}catch(_0x3d041e){return BPromise[_0xc79d('0x23')](_0x3d041e);}return _0x268ea1[_0xc79d('0x24')]();};}function saveUpdates(_0x36e990,_0x260d52){return function(_0x19e3a8){if(_0x19e3a8){return _0x19e3a8['update'](_0x36e990)[_0xc79d('0x25')](function(_0x319ef8){return _0x319ef8;});}return null;};}function removeEntity(_0x53ba86,_0x2676df){return function(_0x31bc7a){if(_0x31bc7a){return _0x31bc7a['destroy']()['then'](function(){var _0x11a1b9=_0x31bc7a['get']({'plain':!![]});var _0x49f36e=_0xc79d('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x49f36e,'resourceId':_0x11a1b9['id']}})['then'](function(){return _0x31bc7a;});})[_0xc79d('0x25')](function(){_0x53ba86['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12343c,_0x4e2417){return function(_0x381290){if(!_0x381290){_0x12343c['sendStatus'](0x194);}return _0x381290;};}function handleError(_0x8be74,_0xdfaf41){_0xdfaf41=_0xdfaf41||0x1f4;return function(_0x4b9058){logger[_0xc79d('0x27')](_0x4b9058[_0xc79d('0x28')]);if(_0x4b9058[_0xc79d('0x29')]){delete _0x4b9058[_0xc79d('0x29')];}_0x8be74[_0xc79d('0x1a')](_0xdfaf41)[_0xc79d('0x2a')](_0x4b9058);};}exports[_0xc79d('0x2b')]=function(_0x3870a3,_0x5ed991){var _0x30c89f={},_0x11d2df={},_0x4b7f2b={'count':0x0,'rows':[]};var _0x348c15=_[_0xc79d('0x2c')](db['Campaign'][_0xc79d('0x2d')],function(_0x185c2b){return{'name':_0x185c2b['fieldName'],'type':_0x185c2b[_0xc79d('0x2e')]['key']};});_0x11d2df[_0xc79d('0x2f')]=_['map'](_0x348c15,_0xc79d('0x29'));_0x11d2df[_0xc79d('0x30')]=_['keys'](_0x3870a3[_0xc79d('0x30')]);_0x11d2df['filters']=_[_0xc79d('0x31')](_0x11d2df[_0xc79d('0x2f')],_0x11d2df['query']);_0x30c89f[_0xc79d('0x32')]=_[_0xc79d('0x31')](_0x11d2df[_0xc79d('0x2f')],qs['fields'](_0x3870a3[_0xc79d('0x30')][_0xc79d('0x33')]));_0x30c89f[_0xc79d('0x32')]=_0x30c89f['attributes'][_0xc79d('0x34')]?_0x30c89f[_0xc79d('0x32')]:_0x11d2df[_0xc79d('0x2f')];if(!_0x3870a3[_0xc79d('0x30')][_0xc79d('0x35')]('nolimit')){_0x30c89f[_0xc79d('0x1d')]=qs['limit'](_0x3870a3[_0xc79d('0x30')]['limit']);_0x30c89f[_0xc79d('0x1c')]=qs[_0xc79d('0x1c')](_0x3870a3[_0xc79d('0x30')][_0xc79d('0x1c')]);}_0x30c89f[_0xc79d('0x36')]=qs[_0xc79d('0x37')](_0x3870a3['query']['sort']);_0x30c89f['where']=qs['filters'](_[_0xc79d('0x38')](_0x3870a3[_0xc79d('0x30')],_0x11d2df[_0xc79d('0x39')]),_0x348c15);if(_0x3870a3[_0xc79d('0x30')]['filter']){_0x30c89f[_0xc79d('0x3a')]=_[_0xc79d('0x3b')](_0x30c89f['where'],{'$or':_[_0xc79d('0x2c')](_0x348c15,function(_0x2f5bb6){if(_0x2f5bb6[_0xc79d('0x2e')]!==_0xc79d('0x3c')){var _0x578fd5={};_0x578fd5[_0x2f5bb6[_0xc79d('0x29')]]={'$like':'%'+_0x3870a3[_0xc79d('0x30')][_0xc79d('0x3d')]+'%'};return _0x578fd5;}})});}_0x30c89f=_[_0xc79d('0x3b')]({},_0x30c89f,_0x3870a3[_0xc79d('0x3e')]);var _0x2cc9bc={'where':_0x30c89f[_0xc79d('0x3a')]};return db[_0xc79d('0x3f')]['count'](_0x2cc9bc)['then'](function(_0x17c8ab){_0x4b7f2b[_0xc79d('0x1f')]=_0x17c8ab;if(_0x3870a3[_0xc79d('0x30')][_0xc79d('0x40')]){_0x30c89f[_0xc79d('0x41')]=[{'all':!![]}];}return db[_0xc79d('0x3f')]['findAll'](_0x30c89f);})['then'](function(_0x16fae9){_0x4b7f2b['rows']=_0x16fae9;return _0x4b7f2b;})['then'](respondWithFilteredResult(_0x5ed991,_0x30c89f))[_0xc79d('0x42')](handleError(_0x5ed991,null));};exports['show']=function(_0x3927a3,_0x59fad2){var _0x20a031={'raw':![],'where':{'id':_0x3927a3[_0xc79d('0x43')]['id']}},_0x56f36={};_0x56f36[_0xc79d('0x2f')]=_[_0xc79d('0x44')](db[_0xc79d('0x3f')][_0xc79d('0x2d')]);_0x56f36[_0xc79d('0x30')]=_[_0xc79d('0x44')](_0x3927a3[_0xc79d('0x30')]);_0x56f36[_0xc79d('0x39')]=_['intersection'](_0x56f36[_0xc79d('0x2f')],_0x56f36['query']);_0x20a031[_0xc79d('0x32')]=_[_0xc79d('0x31')](_0x56f36[_0xc79d('0x2f')],qs[_0xc79d('0x33')](_0x3927a3[_0xc79d('0x30')][_0xc79d('0x33')]));_0x20a031[_0xc79d('0x32')]=_0x20a031[_0xc79d('0x32')]['length']?_0x20a031[_0xc79d('0x32')]:_0x56f36['model'];if(_0x3927a3[_0xc79d('0x30')][_0xc79d('0x40')]){_0x20a031[_0xc79d('0x41')]=[{'all':!![]}];}_0x20a031=_[_0xc79d('0x3b')]({},_0x20a031,_0x3927a3[_0xc79d('0x3e')]);return db[_0xc79d('0x3f')][_0xc79d('0x45')](_0x20a031)[_0xc79d('0x25')](handleEntityNotFound(_0x59fad2,null))['then'](respondWithResult(_0x59fad2,null))[_0xc79d('0x42')](handleError(_0x59fad2,null));};exports[_0xc79d('0x46')]=function(_0x34fbe6,_0x195483){return db[_0xc79d('0x3f')][_0xc79d('0x46')](_0x34fbe6[_0xc79d('0x47')],{})[_0xc79d('0x25')](function(_0x4a32ed){var _0x1c3e4=_0x34fbe6[_0xc79d('0x48')][_0xc79d('0x49')]({'plain':!![]});if(!_0x1c3e4)throw new Error(_0xc79d('0x4a'));if(_0x1c3e4[_0xc79d('0x4b')]===_0xc79d('0x48')){var _0x44138a=_0x4a32ed['get']({'plain':!![]});var _0x530931=_0xc79d('0x26');return db[_0xc79d('0x4c')][_0xc79d('0x45')]({'where':{'name':_0x530931,'userProfileId':_0x1c3e4[_0xc79d('0x4d')]},'raw':!![]})[_0xc79d('0x25')](function(_0x131cec){if(_0x131cec&&_0x131cec[_0xc79d('0x4e')]===0x0){return db[_0xc79d('0x4f')]['create']({'name':_0x44138a[_0xc79d('0x29')],'resourceId':_0x44138a['id'],'type':_0x131cec[_0xc79d('0x29')],'sectionId':_0x131cec['id']},{})['then'](function(){return _0x4a32ed;});}else{return _0x4a32ed;}})[_0xc79d('0x42')](function(_0x2829a3){logger[_0xc79d('0x27')](_0xc79d('0x50'),_0x2829a3);throw _0x2829a3;});}return _0x4a32ed;})[_0xc79d('0x25')](respondWithResult(_0x195483,0xc9))[_0xc79d('0x42')](handleError(_0x195483,null));};exports[_0xc79d('0x51')]=function(_0x58fe4d,_0x5b8bf6){var _0x1e76e5={'where':{'id':_0x58fe4d[_0xc79d('0x43')]['id']}},_0x2a828f={};_0x2a828f[_0xc79d('0x2f')]=_[_0xc79d('0x44')](db[_0xc79d('0x3f')]['rawAttributes']);_0x1e76e5['attributes']=_[_0xc79d('0x31')](_0x2a828f[_0xc79d('0x2f')],qs[_0xc79d('0x33')](_0x58fe4d[_0xc79d('0x30')][_0xc79d('0x33')]));_0x1e76e5[_0xc79d('0x32')]=_0x1e76e5[_0xc79d('0x32')][_0xc79d('0x34')]?_0x1e76e5['attributes']:_0x2a828f['model'];if(_0x58fe4d[_0xc79d('0x30')][_0xc79d('0x40')]){_0x1e76e5[_0xc79d('0x41')]=[{'all':!![]}];}_0x1e76e5=_[_0xc79d('0x3b')]({},_0x1e76e5,_0x58fe4d[_0xc79d('0x3e')]);return db['Campaign'][_0xc79d('0x45')](_0x1e76e5)[_0xc79d('0x25')](handleEntityNotFound(_0x5b8bf6,null))['then'](function(_0x512543){if(_0x512543){var _0x437820=_0x512543[_0xc79d('0x49')]({'plain':!![]});_0x437820=qs['omit'](_0x437820,['id',_0xc79d('0x52'),_0xc79d('0x53')]);_0x58fe4d['body']=_[_0xc79d('0x54')](_0x58fe4d['body'],['id',_0xc79d('0x52'),'updatedAt']);return db[_0xc79d('0x3f')][_0xc79d('0x46')](_[_0xc79d('0x3b')](_0x437820,_0x58fe4d['body']),{'include':_0x58fe4d[_0xc79d('0x30')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x310fca){var _0x1eb852=_0x58fe4d[_0xc79d('0x48')][_0xc79d('0x49')]({'plain':!![]});if(!_0x1eb852)throw new Error(_0xc79d('0x4a'));if(_0x1eb852['role']===_0xc79d('0x48')){var _0x450523=_0x310fca[_0xc79d('0x49')]({'plain':!![]});var _0x1539d8=_0xc79d('0x26');return db[_0xc79d('0x4c')][_0xc79d('0x45')]({'where':{'name':_0x1539d8,'userProfileId':_0x1eb852[_0xc79d('0x4d')]},'raw':!![]})[_0xc79d('0x25')](function(_0x4b7b31){if(_0x4b7b31&&_0x4b7b31[_0xc79d('0x4e')]===0x0){return db[_0xc79d('0x4f')]['create']({'name':_0x450523[_0xc79d('0x29')],'resourceId':_0x450523['id'],'type':_0x4b7b31[_0xc79d('0x29')],'sectionId':_0x4b7b31['id']},{})[_0xc79d('0x25')](function(){return _0x310fca;});}else{return _0x310fca;}})[_0xc79d('0x42')](function(_0x39b5c7){logger[_0xc79d('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x39b5c7);throw _0x39b5c7;});}return _0x310fca;});}})[_0xc79d('0x25')](respondWithResult(_0x5b8bf6,0xc9))[_0xc79d('0x42')](handleError(_0x5b8bf6,null));};exports['update']=function(_0x25a379,_0x3bc34e){if(_0x25a379[_0xc79d('0x47')]['id']){delete _0x25a379[_0xc79d('0x47')]['id'];}return db[_0xc79d('0x3f')][_0xc79d('0x45')]({'where':{'id':_0x25a379['params']['id']}})[_0xc79d('0x25')](handleEntityNotFound(_0x3bc34e,null))[_0xc79d('0x25')](saveUpdates(_0x25a379[_0xc79d('0x47')],null))['then'](respondWithResult(_0x3bc34e,null))['catch'](handleError(_0x3bc34e,null));};exports[_0xc79d('0x55')]=function(_0x283d4f,_0x12c1e4){return db[_0xc79d('0x3f')]['find']({'where':{'id':_0x283d4f['params']['id']}})[_0xc79d('0x25')](handleEntityNotFound(_0x12c1e4,null))[_0xc79d('0x25')](removeEntity(_0x12c1e4,null))[_0xc79d('0x42')](handleError(_0x12c1e4,null));};exports['getHoppers']=function(_0x6c1e2b,_0x518137,_0x208bce){var _0x21bcad={'raw':!![],'where':{}};var _0x5ab26b={};var _0x3bb246={'count':0x0,'rows':[]};return db[_0xc79d('0x3f')][_0xc79d('0x56')]({'where':{'id':_0x6c1e2b[_0xc79d('0x43')]['id']}})[_0xc79d('0x25')](handleEntityNotFound(_0x518137,null))[_0xc79d('0x25')](function(_0x488840){if(_0x488840){_0x5ab26b[_0xc79d('0x2f')]=_[_0xc79d('0x44')](db['CmHopper'][_0xc79d('0x2d')]);_0x5ab26b[_0xc79d('0x30')]=_['keys'](_0x6c1e2b[_0xc79d('0x30')]);_0x5ab26b[_0xc79d('0x39')]=_['intersection'](_0x5ab26b['model'],_0x5ab26b[_0xc79d('0x30')]);_0x21bcad[_0xc79d('0x32')]=_[_0xc79d('0x31')](_0x5ab26b[_0xc79d('0x2f')],qs['fields'](_0x6c1e2b[_0xc79d('0x30')][_0xc79d('0x33')]));_0x21bcad[_0xc79d('0x32')]=_0x21bcad[_0xc79d('0x32')][_0xc79d('0x34')]?_0x21bcad[_0xc79d('0x32')]:_0x5ab26b[_0xc79d('0x2f')];if(!_0x6c1e2b[_0xc79d('0x30')][_0xc79d('0x35')](_0xc79d('0x57'))){_0x21bcad[_0xc79d('0x1d')]=qs['limit'](_0x6c1e2b[_0xc79d('0x30')][_0xc79d('0x1d')]);_0x21bcad['offset']=qs[_0xc79d('0x1c')](_0x6c1e2b[_0xc79d('0x30')][_0xc79d('0x1c')]);}_0x21bcad['order']=qs[_0xc79d('0x37')](_0x6c1e2b['query'][_0xc79d('0x37')]);_0x21bcad['where']=qs[_0xc79d('0x39')](_[_0xc79d('0x38')](_0x6c1e2b[_0xc79d('0x30')],_0x5ab26b[_0xc79d('0x39')]));_0x21bcad[_0xc79d('0x3a')][_0xc79d('0x58')]=_0x488840['id'];if(_0x6c1e2b[_0xc79d('0x30')]['filter']){_0x21bcad[_0xc79d('0x3a')]=_[_0xc79d('0x3b')](_0x21bcad[_0xc79d('0x3a')],{'$or':_[_0xc79d('0x2c')](_0x21bcad[_0xc79d('0x32')],function(_0x1d8c56){var _0x584956={};_0x584956[_0x1d8c56]={'$like':'%'+_0x6c1e2b['query'][_0xc79d('0x3d')]+'%'};return _0x584956;})});}_0x21bcad=_[_0xc79d('0x3b')]({},_0x21bcad,_0x6c1e2b['options']);return db[_0xc79d('0x59')][_0xc79d('0x1f')]({'where':_0x21bcad['where']})['then'](function(_0x28597e){_0x3bb246[_0xc79d('0x1f')]=_0x28597e;if(_0x6c1e2b[_0xc79d('0x30')][_0xc79d('0x40')]){_0x21bcad[_0xc79d('0x41')]=[{'all':!![]}];}return db[_0xc79d('0x59')][_0xc79d('0x5a')](_0x21bcad);})['then'](function(_0x362237){_0x3bb246['rows']=_0x362237;return _0x3bb246;});}})[_0xc79d('0x25')](respondWithFilteredResult(_0x518137,_0x21bcad))[_0xc79d('0x42')](handleError(_0x518137,null));};exports[_0xc79d('0x5b')]=function(_0x34dee0,_0x3984fb,_0x21976c){var _0x4e283a={'raw':!![],'where':{}};var _0x537b2d={};var _0x14fd9a={'count':0x0,'rows':[]};return db[_0xc79d('0x3f')]['findOne']({'where':{'id':_0x34dee0[_0xc79d('0x43')]['id']}})[_0xc79d('0x25')](handleEntityNotFound(_0x3984fb,null))[_0xc79d('0x25')](function(_0x3f204d){if(_0x3f204d){_0x537b2d[_0xc79d('0x2f')]=_[_0xc79d('0x44')](db[_0xc79d('0x5c')][_0xc79d('0x2d')]);_0x537b2d[_0xc79d('0x30')]=_[_0xc79d('0x44')](_0x34dee0['query']);_0x537b2d[_0xc79d('0x39')]=_[_0xc79d('0x31')](_0x537b2d['model'],_0x537b2d['query']);_0x4e283a[_0xc79d('0x32')]=_[_0xc79d('0x31')](_0x537b2d[_0xc79d('0x2f')],qs[_0xc79d('0x33')](_0x34dee0[_0xc79d('0x30')]['fields']));_0x4e283a[_0xc79d('0x32')]=_0x4e283a[_0xc79d('0x32')][_0xc79d('0x34')]?_0x4e283a[_0xc79d('0x32')]:_0x537b2d[_0xc79d('0x2f')];if(!_0x34dee0[_0xc79d('0x30')][_0xc79d('0x35')](_0xc79d('0x57'))){_0x4e283a['limit']=qs[_0xc79d('0x1d')](_0x34dee0['query']['limit']);_0x4e283a[_0xc79d('0x1c')]=qs[_0xc79d('0x1c')](_0x34dee0[_0xc79d('0x30')]['offset']);}_0x4e283a[_0xc79d('0x36')]=qs[_0xc79d('0x37')](_0x34dee0[_0xc79d('0x30')]['sort']);_0x4e283a[_0xc79d('0x3a')]=qs[_0xc79d('0x39')](_['pick'](_0x34dee0[_0xc79d('0x30')],_0x537b2d[_0xc79d('0x39')]));_0x4e283a[_0xc79d('0x3a')][_0xc79d('0x58')]=_0x3f204d['id'];if(_0x34dee0[_0xc79d('0x30')][_0xc79d('0x3d')]){_0x4e283a[_0xc79d('0x3a')]=_['merge'](_0x4e283a[_0xc79d('0x3a')],{'$or':_['map'](_0x4e283a[_0xc79d('0x32')],function(_0x240e8b){var _0x4ca919={};_0x4ca919[_0x240e8b]={'$like':'%'+_0x34dee0[_0xc79d('0x30')][_0xc79d('0x3d')]+'%'};return _0x4ca919;})});}_0x4e283a=_[_0xc79d('0x3b')]({},_0x4e283a,_0x34dee0[_0xc79d('0x3e')]);return db['CmHopperHistory'][_0xc79d('0x1f')]({'where':_0x4e283a[_0xc79d('0x3a')]})[_0xc79d('0x25')](function(_0x23fadc){_0x14fd9a[_0xc79d('0x1f')]=_0x23fadc;if(_0x34dee0[_0xc79d('0x30')][_0xc79d('0x40')]){_0x4e283a['include']=[{'all':!![]}];}return db[_0xc79d('0x5c')][_0xc79d('0x5a')](_0x4e283a);})[_0xc79d('0x25')](function(_0x313f7c){_0x14fd9a['rows']=_0x313f7c;return _0x14fd9a;});}})[_0xc79d('0x25')](respondWithFilteredResult(_0x3984fb,_0x4e283a))[_0xc79d('0x42')](handleError(_0x3984fb,null));};exports[_0xc79d('0x5d')]=function(_0x33a0fe,_0x236c35,_0x5800c6){var _0x2b9cd4={'raw':!![],'where':{}};var _0x378983={};var _0x59a736={'count':0x0,'rows':[]};return db[_0xc79d('0x3f')][_0xc79d('0x56')]({'where':{'id':_0x33a0fe['params']['id']}})[_0xc79d('0x25')](handleEntityNotFound(_0x236c35,null))[_0xc79d('0x25')](function(_0x5a0205){if(_0x5a0205){_0x378983[_0xc79d('0x2f')]=_[_0xc79d('0x44')](db[_0xc79d('0x5e')]['rawAttributes']);_0x378983[_0xc79d('0x30')]=_[_0xc79d('0x44')](_0x33a0fe[_0xc79d('0x30')]);_0x378983[_0xc79d('0x39')]=_[_0xc79d('0x31')](_0x378983[_0xc79d('0x2f')],_0x378983['query']);_0x2b9cd4[_0xc79d('0x32')]=_[_0xc79d('0x31')](_0x378983['model'],qs[_0xc79d('0x33')](_0x33a0fe[_0xc79d('0x30')][_0xc79d('0x33')]));_0x2b9cd4['attributes']=_0x2b9cd4[_0xc79d('0x32')][_0xc79d('0x34')]?_0x2b9cd4['attributes']:_0x378983[_0xc79d('0x2f')];if(!_0x33a0fe[_0xc79d('0x30')][_0xc79d('0x35')](_0xc79d('0x57'))){_0x2b9cd4['limit']=qs[_0xc79d('0x1d')](_0x33a0fe[_0xc79d('0x30')][_0xc79d('0x1d')]);_0x2b9cd4['offset']=qs[_0xc79d('0x1c')](_0x33a0fe[_0xc79d('0x30')]['offset']);}_0x2b9cd4[_0xc79d('0x36')]=qs[_0xc79d('0x37')](_0x33a0fe[_0xc79d('0x30')][_0xc79d('0x37')]);_0x2b9cd4[_0xc79d('0x3a')]=qs[_0xc79d('0x39')](_[_0xc79d('0x38')](_0x33a0fe[_0xc79d('0x30')],_0x378983[_0xc79d('0x39')]));_0x2b9cd4[_0xc79d('0x3a')][_0xc79d('0x58')]=_0x5a0205['id'];if(_0x33a0fe[_0xc79d('0x30')][_0xc79d('0x3d')]){_0x2b9cd4[_0xc79d('0x3a')]=_[_0xc79d('0x3b')](_0x2b9cd4[_0xc79d('0x3a')],{'$or':_[_0xc79d('0x2c')](_0x2b9cd4[_0xc79d('0x32')],function(_0x5e7c41){var _0x59b262={};_0x59b262[_0x5e7c41]={'$like':'%'+_0x33a0fe[_0xc79d('0x30')]['filter']+'%'};return _0x59b262;})});}_0x2b9cd4=_[_0xc79d('0x3b')]({},_0x2b9cd4,_0x33a0fe[_0xc79d('0x3e')]);return db[_0xc79d('0x5e')][_0xc79d('0x1f')]({'where':_0x2b9cd4['where']})[_0xc79d('0x25')](function(_0x52ab22){_0x59a736['count']=_0x52ab22;if(_0x33a0fe[_0xc79d('0x30')][_0xc79d('0x40')]){_0x2b9cd4[_0xc79d('0x41')]=[{'all':!![]}];}return db[_0xc79d('0x5e')][_0xc79d('0x5a')](_0x2b9cd4);})[_0xc79d('0x25')](function(_0x9c95a){_0x59a736[_0xc79d('0x5f')]=_0x9c95a;return _0x59a736;});}})[_0xc79d('0x25')](respondWithFilteredResult(_0x236c35,_0x2b9cd4))[_0xc79d('0x42')](handleError(_0x236c35,null));};exports['getHopperBlacks']=function(_0xc85cc0,_0x5d827e,_0x29f105){var _0x447019={'raw':!![],'where':{}};var _0x629f83={};var _0x162575={'count':0x0,'rows':[]};return db[_0xc79d('0x3f')][_0xc79d('0x56')]({'where':{'id':_0xc85cc0[_0xc79d('0x43')]['id']}})[_0xc79d('0x25')](handleEntityNotFound(_0x5d827e,null))['then'](function(_0x443820){if(_0x443820){_0x629f83[_0xc79d('0x2f')]=_[_0xc79d('0x44')](db[_0xc79d('0x60')][_0xc79d('0x2d')]);_0x629f83[_0xc79d('0x30')]=_['keys'](_0xc85cc0['query']);_0x629f83[_0xc79d('0x39')]=_[_0xc79d('0x31')](_0x629f83['model'],_0x629f83[_0xc79d('0x30')]);_0x447019['attributes']=_[_0xc79d('0x31')](_0x629f83['model'],qs['fields'](_0xc85cc0[_0xc79d('0x30')][_0xc79d('0x33')]));_0x447019[_0xc79d('0x32')]=_0x447019['attributes'][_0xc79d('0x34')]?_0x447019['attributes']:_0x629f83[_0xc79d('0x2f')];if(!_0xc85cc0[_0xc79d('0x30')][_0xc79d('0x35')](_0xc79d('0x57'))){_0x447019[_0xc79d('0x1d')]=qs[_0xc79d('0x1d')](_0xc85cc0[_0xc79d('0x30')]['limit']);_0x447019[_0xc79d('0x1c')]=qs[_0xc79d('0x1c')](_0xc85cc0[_0xc79d('0x30')][_0xc79d('0x1c')]);}_0x447019[_0xc79d('0x36')]=qs['sort'](_0xc85cc0[_0xc79d('0x30')][_0xc79d('0x37')]);_0x447019[_0xc79d('0x3a')]=qs[_0xc79d('0x39')](_[_0xc79d('0x38')](_0xc85cc0['query'],_0x629f83['filters']));_0x447019[_0xc79d('0x3a')][_0xc79d('0x58')]=_0x443820['id'];if(_0xc85cc0['query']['filter']){_0x447019[_0xc79d('0x3a')]=_[_0xc79d('0x3b')](_0x447019[_0xc79d('0x3a')],{'$or':_[_0xc79d('0x2c')](_0x447019['attributes'],function(_0x5e5afb){var _0x14399b={};_0x14399b[_0x5e5afb]={'$like':'%'+_0xc85cc0['query'][_0xc79d('0x3d')]+'%'};return _0x14399b;})});}_0x447019=_['merge']({},_0x447019,_0xc85cc0[_0xc79d('0x3e')]);return db[_0xc79d('0x60')][_0xc79d('0x1f')]({'where':_0x447019[_0xc79d('0x3a')]})[_0xc79d('0x25')](function(_0x3d4843){_0x162575['count']=_0x3d4843;if(_0xc85cc0[_0xc79d('0x30')][_0xc79d('0x40')]){_0x447019[_0xc79d('0x41')]=[{'all':!![]}];}return db[_0xc79d('0x60')]['findAll'](_0x447019);})[_0xc79d('0x25')](function(_0x3726d4){_0x162575[_0xc79d('0x5f')]=_0x3726d4;return _0x162575;});}})['then'](respondWithFilteredResult(_0x5d827e,_0x447019))[_0xc79d('0x42')](handleError(_0x5d827e,null));};exports[_0xc79d('0x61')]=function(_0x23ea40,_0x18a349,_0x252f2d){var _0x399c89={};var _0x4b4b16={};var _0x34cb5d;var _0xf04f24;return db['Campaign'][_0xc79d('0x56')]({'where':{'id':_0x23ea40[_0xc79d('0x43')]['id']}})[_0xc79d('0x25')](handleEntityNotFound(_0x18a349,null))[_0xc79d('0x25')](function(_0x337cbd){if(_0x337cbd){_0x34cb5d=_0x337cbd;_0x4b4b16[_0xc79d('0x2f')]=_[_0xc79d('0x44')](db[_0xc79d('0x62')][_0xc79d('0x2d')]);_0x4b4b16[_0xc79d('0x30')]=_[_0xc79d('0x44')](_0x23ea40['query']);_0x4b4b16['filters']=_[_0xc79d('0x31')](_0x4b4b16[_0xc79d('0x2f')],_0x4b4b16[_0xc79d('0x30')]);_0x399c89[_0xc79d('0x32')]=_['intersection'](_0x4b4b16['model'],qs['fields'](_0x23ea40['query'][_0xc79d('0x33')]));_0x399c89[_0xc79d('0x32')]=_0x399c89[_0xc79d('0x32')][_0xc79d('0x34')]?_0x399c89[_0xc79d('0x32')]:_0x4b4b16[_0xc79d('0x2f')];_0x399c89[_0xc79d('0x36')]=qs[_0xc79d('0x37')](_0x23ea40[_0xc79d('0x30')][_0xc79d('0x37')]);_0x399c89[_0xc79d('0x3a')]=qs['filters'](_[_0xc79d('0x38')](_0x23ea40[_0xc79d('0x30')],_0x4b4b16[_0xc79d('0x39')]));if(_0x23ea40[_0xc79d('0x30')]['filter']){_0x399c89['where']=_[_0xc79d('0x3b')](_0x399c89['where'],{'$or':_[_0xc79d('0x2c')](_0x399c89[_0xc79d('0x32')],function(_0x171013){var _0x31062b={};_0x31062b[_0x171013]={'$like':'%'+_0x23ea40[_0xc79d('0x30')][_0xc79d('0x3d')]+'%'};return _0x31062b;})});}_0x399c89=_[_0xc79d('0x3b')]({},_0x399c89,_0x23ea40[_0xc79d('0x3e')]);return _0x34cb5d[_0xc79d('0x61')](_0x399c89);}})[_0xc79d('0x25')](function(_0x6862b4){if(_0x6862b4){_0xf04f24=_0x6862b4[_0xc79d('0x34')];if(!_0x23ea40['query']['hasOwnProperty'](_0xc79d('0x57'))){_0x399c89[_0xc79d('0x1d')]=qs[_0xc79d('0x1d')](_0x23ea40['query'][_0xc79d('0x1d')]);_0x399c89[_0xc79d('0x1c')]=qs['offset'](_0x23ea40[_0xc79d('0x30')][_0xc79d('0x1c')]);}return _0x34cb5d[_0xc79d('0x61')](_0x399c89);}})['then'](function(_0x27c576){if(_0x27c576){return _0x27c576?{'count':_0xf04f24,'rows':_0x27c576}:null;}})[_0xc79d('0x25')](respondWithResult(_0x18a349,null))[_0xc79d('0x42')](handleError(_0x18a349,null));};exports['addLists']=function(_0x31aaae,_0x274009,_0x14ce67){var _0x968627,_0x11a90e;return db[_0xc79d('0x3f')][_0xc79d('0x45')]({'where':{'id':_0x31aaae[_0xc79d('0x43')]['id']}})['then'](handleEntityNotFound(_0x274009,null))[_0xc79d('0x25')](function(_0x273ec4){if(_0x273ec4){_0x11a90e=_0x273ec4;return _0x273ec4[_0xc79d('0x63')](_0x31aaae[_0xc79d('0x47')][_0xc79d('0x64')],_[_0xc79d('0x54')](_0x31aaae[_0xc79d('0x47')],[_0xc79d('0x64'),'id'])||{});}return null;})[_0xc79d('0x65')](function(_0x2a1197){var _0x32d1c6;_0x968627=_0x2a1197||[];var _0xec40c7=[];if(_0x2a1197){for(var _0x1dffd4=0x0;_0x1dffd4<_0x2a1197[_0xc79d('0x34')];_0x1dffd4+=0x1){var _0x35d613=_0x2a1197[_0x1dffd4][_0xc79d('0x49')]({'plain':!![]});_0x11a90e[_0xc79d('0x66')]=_0x31aaae[_0xc79d('0x47')][_0xc79d('0x66')]?_0x31aaae[_0xc79d('0x47')][_0xc79d('0x66')]:_0x11a90e['dialCheckDuplicateType'];switch(_0x11a90e[_0xc79d('0x66')]){case'always':_0x32d1c6=squel['insert']()[_0xc79d('0x67')]('cm_hopper')[_0xc79d('0x68')](['phone',_0xc79d('0x69'),'ContactId',_0xc79d('0x6a'),_0xc79d('0x58'),_0xc79d('0x52'),_0xc79d('0x53')],squel[_0xc79d('0x6b')]()[_0xc79d('0x6c')]('phone',_0xc79d('0x6d'))['field'](_0xc79d('0x6e'),'scheduledAt')[_0xc79d('0x6c')]('id',_0xc79d('0x6f'))['field'](_0x35d613[_0xc79d('0x70')][_0xc79d('0x71')](),'ListId')[_0xc79d('0x6c')](_0x31aaae['params']['id'][_0xc79d('0x71')](),'CampaignId')[_0xc79d('0x6c')](_0xc79d('0x6e'),_0xc79d('0x52'))[_0xc79d('0x6c')](_0xc79d('0x6e'),_0xc79d('0x53'))[_0xc79d('0x72')](_0xc79d('0x73'))[_0xc79d('0x3a')](_0xc79d('0x74'))['where'](_0xc79d('0x75'),_0x35d613[_0xc79d('0x70')][_0xc79d('0x71')]())[_0xc79d('0x3a')](_0xc79d('0x76'))[_0xc79d('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xc79d('0x6c')](_0xc79d('0x77'))[_0xc79d('0x72')](_0xc79d('0x78'))[_0xc79d('0x3a')]('CampaignId\x20=\x20?',_0x31aaae['params']['id'][_0xc79d('0x71')]()))[_0xc79d('0x3a')](_0xc79d('0x79'),squel[_0xc79d('0x6b')]()[_0xc79d('0x6c')](_0xc79d('0x7a'))[_0xc79d('0x72')]('cm_hopper')[_0xc79d('0x3a')](_0xc79d('0x7b'),_0x31aaae[_0xc79d('0x43')]['id'][_0xc79d('0x71')]())))['toString']();break;case'onlyIfOpen':_0x32d1c6=squel[_0xc79d('0x7c')]()[_0xc79d('0x67')](_0xc79d('0x7d'))[_0xc79d('0x68')]([_0xc79d('0x6d'),'scheduledAt',_0xc79d('0x6f'),_0xc79d('0x6a'),_0xc79d('0x58'),_0xc79d('0x52'),_0xc79d('0x53')],squel['select']()['field']('phone',_0xc79d('0x6d'))[_0xc79d('0x6c')](_0xc79d('0x6e'),_0xc79d('0x69'))[_0xc79d('0x6c')]('id',_0xc79d('0x6f'))[_0xc79d('0x6c')](_0x35d613[_0xc79d('0x70')][_0xc79d('0x71')](),_0xc79d('0x6a'))['field'](_0x31aaae[_0xc79d('0x43')]['id'][_0xc79d('0x71')](),'CampaignId')[_0xc79d('0x6c')]('NOW()','createdAt')[_0xc79d('0x6c')](_0xc79d('0x6e'),_0xc79d('0x53'))[_0xc79d('0x72')]('cm_contacts')[_0xc79d('0x3a')](_0xc79d('0x74'))[_0xc79d('0x3a')](_0xc79d('0x75'),_0x35d613[_0xc79d('0x70')][_0xc79d('0x71')]())['where'](_0xc79d('0x76'))['where'](_0xc79d('0x79'),squel['select']()['field']('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0xc79d('0x3a')](_0xc79d('0x7b'),_0x31aaae[_0xc79d('0x43')]['id'][_0xc79d('0x71')]())))[_0xc79d('0x71')]();break;default:_0x32d1c6=squel['insert']()[_0xc79d('0x67')](_0xc79d('0x7d'))[_0xc79d('0x68')]([_0xc79d('0x6d'),'scheduledAt','ContactId',_0xc79d('0x6a'),'CampaignId',_0xc79d('0x52'),_0xc79d('0x53')],squel[_0xc79d('0x6b')]()['field'](_0xc79d('0x6d'),_0xc79d('0x6d'))['field'](_0xc79d('0x6e'),_0xc79d('0x69'))[_0xc79d('0x6c')]('id',_0xc79d('0x6f'))[_0xc79d('0x6c')](_0x35d613[_0xc79d('0x70')][_0xc79d('0x71')](),'ListId')['field'](_0x31aaae[_0xc79d('0x43')]['id'][_0xc79d('0x71')](),_0xc79d('0x58'))['field']('NOW()',_0xc79d('0x52'))[_0xc79d('0x6c')](_0xc79d('0x6e'),_0xc79d('0x53'))[_0xc79d('0x72')](_0xc79d('0x73'))['where'](_0xc79d('0x74'))[_0xc79d('0x3a')]('ListId\x20=\x20?',_0x35d613[_0xc79d('0x70')]['toString']())['where'](_0xc79d('0x76')))['toString']();}_0xec40c7[_0xc79d('0x7e')](db[_0xc79d('0x7f')][_0xc79d('0x30')](_0x32d1c6));}return BPromise[_0xc79d('0x80')](_0xec40c7);}})[_0xc79d('0x25')](function(){return _0x968627;})['then'](respondWithResult(_0x274009,null))['catch'](handleError(_0x274009,null));};exports[_0xc79d('0x81')]=function(_0x30fc44,_0x4650d,_0x13af02){return db['Campaign'][_0xc79d('0x45')]({'where':{'id':_0x30fc44[_0xc79d('0x43')]['id']}})['then'](handleEntityNotFound(_0x4650d,null))['then'](function(_0x587b04){if(_0x587b04){return _0x587b04[_0xc79d('0x81')](_0x30fc44[_0xc79d('0x30')][_0xc79d('0x64')]);}})[_0xc79d('0x25')](function(_0x7cf18c){if(_0x7cf18c){return db[_0xc79d('0x59')][_0xc79d('0x55')]({'where':{'ListId':_0x30fc44[_0xc79d('0x30')][_0xc79d('0x64')],'CampaignId':_0x30fc44[_0xc79d('0x43')]['id']}})[_0xc79d('0x25')](function(){return _0x7cf18c;});}})['then'](respondWithStatusCode(_0x4650d,null))['catch'](handleError(_0x4650d,null));};exports['getBlackLists']=function(_0x103e89,_0x2e33b2,_0x79fc21){var _0x263795={};var _0x247843={};var _0x379b43;var _0x3733fa;return db[_0xc79d('0x3f')][_0xc79d('0x56')]({'where':{'id':_0x103e89[_0xc79d('0x43')]['id']}})[_0xc79d('0x25')](handleEntityNotFound(_0x2e33b2,null))['then'](function(_0x5d3466){if(_0x5d3466){_0x379b43=_0x5d3466;_0x247843['model']=_[_0xc79d('0x44')](db[_0xc79d('0x62')]['rawAttributes']);_0x247843[_0xc79d('0x30')]=_[_0xc79d('0x44')](_0x103e89[_0xc79d('0x30')]);_0x247843['filters']=_[_0xc79d('0x31')](_0x247843[_0xc79d('0x2f')],_0x247843[_0xc79d('0x30')]);_0x263795['attributes']=_[_0xc79d('0x31')](_0x247843[_0xc79d('0x2f')],qs[_0xc79d('0x33')](_0x103e89[_0xc79d('0x30')][_0xc79d('0x33')]));_0x263795[_0xc79d('0x32')]=_0x263795[_0xc79d('0x32')][_0xc79d('0x34')]?_0x263795[_0xc79d('0x32')]:_0x247843['model'];_0x263795['order']=qs['sort'](_0x103e89[_0xc79d('0x30')][_0xc79d('0x37')]);_0x263795[_0xc79d('0x3a')]=qs['filters'](_['pick'](_0x103e89[_0xc79d('0x30')],_0x247843[_0xc79d('0x39')]));if(_0x103e89[_0xc79d('0x30')][_0xc79d('0x3d')]){_0x263795['where']=_[_0xc79d('0x3b')](_0x263795['where'],{'$or':_[_0xc79d('0x2c')](_0x263795[_0xc79d('0x32')],function(_0x1189ac){var _0x54a7c2={};_0x54a7c2[_0x1189ac]={'$like':'%'+_0x103e89[_0xc79d('0x30')]['filter']+'%'};return _0x54a7c2;})});}_0x263795=_[_0xc79d('0x3b')]({},_0x263795,_0x103e89['options']);return _0x379b43[_0xc79d('0x82')](_0x263795);}})['then'](function(_0x39268a){if(_0x39268a){_0x3733fa=_0x39268a['length'];if(!_0x103e89[_0xc79d('0x30')]['hasOwnProperty']('nolimit')){_0x263795[_0xc79d('0x1d')]=qs[_0xc79d('0x1d')](_0x103e89[_0xc79d('0x30')][_0xc79d('0x1d')]);_0x263795[_0xc79d('0x1c')]=qs['offset'](_0x103e89['query']['offset']);}return _0x379b43['getBlackLists'](_0x263795);}})[_0xc79d('0x25')](function(_0x13a0c3){if(_0x13a0c3){return _0x13a0c3?{'count':_0x3733fa,'rows':_0x13a0c3}:null;}})['then'](respondWithResult(_0x2e33b2,null))['catch'](handleError(_0x2e33b2,null));};exports[_0xc79d('0x83')]=function(_0x298266,_0x1d1b0d,_0x1915fd){var _0x5532c3,_0x17acb6;return db[_0xc79d('0x3f')][_0xc79d('0x45')]({'where':{'id':_0x298266['params']['id']}})[_0xc79d('0x25')](handleEntityNotFound(_0x1d1b0d,null))[_0xc79d('0x25')](function(_0x5913cb){if(_0x5913cb){_0x17acb6=_0x5913cb;return _0x5913cb[_0xc79d('0x83')](_0x298266['body'][_0xc79d('0x64')],_[_0xc79d('0x54')](_0x298266[_0xc79d('0x47')],[_0xc79d('0x64'),'id'])||{});}return null;})[_0xc79d('0x65')](function(_0x2b8153){var _0x3f931b;_0x5532c3=_0x2b8153||[];var _0x5c0465=[];if(_0x2b8153){for(var _0x4fec57=0x0;_0x4fec57<_0x2b8153[_0xc79d('0x34')];_0x4fec57+=0x1){var _0x1fad75=_0x2b8153[_0x4fec57][_0xc79d('0x49')]({'plain':!![]});_0x3f931b=squel['insert']()['into'](_0xc79d('0x84'))['fromQuery']([_0xc79d('0x6d'),'ContactId',_0xc79d('0x6a'),_0xc79d('0x58'),_0xc79d('0x52'),_0xc79d('0x53')],squel[_0xc79d('0x6b')]()['field'](_0xc79d('0x6d'),_0xc79d('0x6d'))[_0xc79d('0x6c')]('id',_0xc79d('0x6f'))['field'](_0x1fad75[_0xc79d('0x70')]['toString'](),_0xc79d('0x6a'))['field'](_0x298266[_0xc79d('0x43')]['id'][_0xc79d('0x71')](),_0xc79d('0x58'))[_0xc79d('0x6c')](_0xc79d('0x6e'),'createdAt')[_0xc79d('0x6c')]('NOW()',_0xc79d('0x53'))['from'](_0xc79d('0x73'))[_0xc79d('0x3a')](_0xc79d('0x74'))[_0xc79d('0x3a')]('ListId\x20=\x20?',_0x1fad75[_0xc79d('0x70')]['toString']())[_0xc79d('0x3a')](_0xc79d('0x76')))[_0xc79d('0x71')]();_0x5c0465['push'](db[_0xc79d('0x7f')][_0xc79d('0x30')](_0x3f931b));}return BPromise[_0xc79d('0x80')](_0x5c0465);}})[_0xc79d('0x25')](function(){return _0x5532c3;})[_0xc79d('0x25')](respondWithResult(_0x1d1b0d,null))[_0xc79d('0x42')](handleError(_0x1d1b0d,null));};exports[_0xc79d('0x85')]=function(_0x24dc15,_0x5729b5,_0x30dd05){return db[_0xc79d('0x3f')][_0xc79d('0x45')]({'where':{'id':_0x24dc15[_0xc79d('0x43')]['id']}})['then'](handleEntityNotFound(_0x5729b5,null))[_0xc79d('0x25')](function(_0x1fe8af){if(_0x1fe8af){return _0x1fe8af[_0xc79d('0x85')](_0x24dc15[_0xc79d('0x30')][_0xc79d('0x64')]);}})['then'](function(_0x430902){if(_0x430902){return db[_0xc79d('0x60')]['destroy']({'where':{'ListId':_0x24dc15[_0xc79d('0x30')][_0xc79d('0x64')],'CampaignId':_0x24dc15[_0xc79d('0x43')]['id']}})[_0xc79d('0x25')](function(){return _0x430902;});}})['then'](respondWithStatusCode(_0x5729b5,null))['catch'](handleError(_0x5729b5,null));}; \ No newline at end of file +var _0x264c=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','get','IvrCampaigns','UserProfileResource','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','Campaign','includeAll','findAll','rows','catch','show','params','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','find','userProfileId','autoAssociation','getHoppers','findOne','CmHopper','getHopperHistories','CmHopperHistory','nolimit','CampaignId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','into','deletedAt\x20IS\x20NULL','push','all','removeLists','getBlackLists','CmList','addBlackLists','omit','cm_hopper_black','sequelize','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x4c86a1,_0x4ff656){var _0x81ea80=function(_0x31857b){while(--_0x31857b){_0x4c86a1['push'](_0x4c86a1['shift']());}};_0x81ea80(++_0x4ff656);}(_0x264c,0x81));var _0xc264=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0x264c[_0x35f7f5];return _0x5567a4;};'use strict';var emlformat=require(_0xc264('0x0'));var rimraf=require(_0xc264('0x1'));var zipdir=require(_0xc264('0x2'));var jsonpatch=require(_0xc264('0x3'));var rp=require(_0xc264('0x4'));var moment=require(_0xc264('0x5'));var BPromise=require(_0xc264('0x6'));var Mustache=require(_0xc264('0x7'));var util=require(_0xc264('0x8'));var path=require(_0xc264('0x9'));var sox=require(_0xc264('0xa'));var csv=require(_0xc264('0xb'));var ejs=require(_0xc264('0xc'));var fs=require('fs');var fs_extra=require(_0xc264('0xd'));var _=require(_0xc264('0xe'));var squel=require(_0xc264('0xf'));var crypto=require(_0xc264('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc264('0x11'));var Papa=require(_0xc264('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc264('0x13'));var as=require(_0xc264('0x14'));var hardwareService=require(_0xc264('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc264('0x16'));var licenseUtil=require(_0xc264('0x17'));var db=require(_0xc264('0x18'))['db'];function respondWithStatusCode(_0x100d3b,_0x406fb6){_0x406fb6=_0x406fb6||0xcc;return function(_0x59dd00){if(_0x59dd00){return _0x100d3b[_0xc264('0x19')](_0x406fb6);}return _0x100d3b[_0xc264('0x1a')](_0x406fb6)[_0xc264('0x1b')]();};}function respondWithResult(_0x4d7f84,_0x5393e1){_0x5393e1=_0x5393e1||0xc8;return function(_0x4beb37){if(_0x4beb37){return _0x4d7f84[_0xc264('0x1a')](_0x5393e1)['json'](_0x4beb37);}};}function respondWithFilteredResult(_0x10bffa,_0x19fed0){return function(_0xb2777e){if(_0xb2777e){var _0x338839=typeof _0x19fed0[_0xc264('0x1c')]===_0xc264('0x1d')&&typeof _0x19fed0[_0xc264('0x1e')]===_0xc264('0x1d');var _0x4e0207=_0xb2777e[_0xc264('0x1f')];var _0x162a14=_0x338839?0x0:_0x19fed0['offset'];var _0xd1bd73=_0x338839?_0xb2777e[_0xc264('0x1f')]:_0x19fed0[_0xc264('0x1c')]+_0x19fed0[_0xc264('0x1e')];var _0x1174e8;if(_0xd1bd73>=_0x4e0207){_0xd1bd73=_0x4e0207;_0x1174e8=0xc8;}else{_0x1174e8=0xce;}_0x10bffa[_0xc264('0x1a')](_0x1174e8);return _0x10bffa['set'](_0xc264('0x20'),_0x162a14+'-'+_0xd1bd73+'/'+_0x4e0207)[_0xc264('0x21')](_0xb2777e);}return null;};}function patchUpdates(_0x51689e){return function(_0x7441f5){try{jsonpatch[_0xc264('0x22')](_0x7441f5,_0x51689e,!![]);}catch(_0x2c71fa){return BPromise[_0xc264('0x23')](_0x2c71fa);}return _0x7441f5[_0xc264('0x24')]();};}function saveUpdates(_0x2d4b58,_0x275bc7){return function(_0xbce538){if(_0xbce538){return _0xbce538[_0xc264('0x25')](_0x2d4b58)[_0xc264('0x26')](function(_0x44246c){return _0x44246c;});}return null;};}function removeEntity(_0x4b1149,_0x526bce){return function(_0x5aa29f){if(_0x5aa29f){return _0x5aa29f['destroy']()[_0xc264('0x26')](function(){var _0x5ebb19=_0x5aa29f[_0xc264('0x27')]({'plain':!![]});var _0x240ad2=_0xc264('0x28');return db[_0xc264('0x29')][_0xc264('0x2a')]({'where':{'type':_0x240ad2,'resourceId':_0x5ebb19['id']}})[_0xc264('0x26')](function(){return _0x5aa29f;});})[_0xc264('0x26')](function(){_0x4b1149[_0xc264('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16c598,_0x3ab31b){return function(_0x3be8c9){if(!_0x3be8c9){_0x16c598[_0xc264('0x19')](0x194);}return _0x3be8c9;};}function handleError(_0x543081,_0x55a8c7){_0x55a8c7=_0x55a8c7||0x1f4;return function(_0x19a214){logger[_0xc264('0x2b')](_0x19a214[_0xc264('0x2c')]);if(_0x19a214['name']){delete _0x19a214[_0xc264('0x2d')];}_0x543081[_0xc264('0x1a')](_0x55a8c7)[_0xc264('0x2e')](_0x19a214);};}exports[_0xc264('0x2f')]=function(_0x2360c7,_0x2f8de9){var _0x3c99bd={},_0x4e72ff={},_0x1ef11a={'count':0x0,'rows':[]};var _0x14b8cf=_['map'](db['Campaign'][_0xc264('0x30')],function(_0x421143){return{'name':_0x421143[_0xc264('0x31')],'type':_0x421143[_0xc264('0x32')]['key']};});_0x4e72ff['model']=_[_0xc264('0x33')](_0x14b8cf,_0xc264('0x2d'));_0x4e72ff[_0xc264('0x34')]=_[_0xc264('0x35')](_0x2360c7['query']);_0x4e72ff[_0xc264('0x36')]=_[_0xc264('0x37')](_0x4e72ff['model'],_0x4e72ff[_0xc264('0x34')]);_0x3c99bd[_0xc264('0x38')]=_['intersection'](_0x4e72ff[_0xc264('0x39')],qs[_0xc264('0x3a')](_0x2360c7[_0xc264('0x34')][_0xc264('0x3a')]));_0x3c99bd[_0xc264('0x38')]=_0x3c99bd[_0xc264('0x38')][_0xc264('0x3b')]?_0x3c99bd[_0xc264('0x38')]:_0x4e72ff[_0xc264('0x39')];if(!_0x2360c7['query'][_0xc264('0x3c')]('nolimit')){_0x3c99bd[_0xc264('0x1e')]=qs['limit'](_0x2360c7[_0xc264('0x34')][_0xc264('0x1e')]);_0x3c99bd['offset']=qs[_0xc264('0x1c')](_0x2360c7[_0xc264('0x34')][_0xc264('0x1c')]);}_0x3c99bd[_0xc264('0x3d')]=qs[_0xc264('0x3e')](_0x2360c7[_0xc264('0x34')][_0xc264('0x3e')]);_0x3c99bd[_0xc264('0x3f')]=qs[_0xc264('0x36')](_[_0xc264('0x40')](_0x2360c7['query'],_0x4e72ff['filters']),_0x14b8cf);if(_0x2360c7['query']['filter']){_0x3c99bd[_0xc264('0x3f')]=_[_0xc264('0x41')](_0x3c99bd['where'],{'$or':_[_0xc264('0x33')](_0x14b8cf,function(_0x203cb4){if(_0x203cb4[_0xc264('0x32')]!==_0xc264('0x42')){var _0x3ce790={};_0x3ce790[_0x203cb4[_0xc264('0x2d')]]={'$like':'%'+_0x2360c7[_0xc264('0x34')][_0xc264('0x43')]+'%'};return _0x3ce790;}})});}_0x3c99bd=_[_0xc264('0x41')]({},_0x3c99bd,_0x2360c7[_0xc264('0x44')]);var _0x599ea6={'where':_0x3c99bd[_0xc264('0x3f')]};return db[_0xc264('0x45')][_0xc264('0x1f')](_0x599ea6)[_0xc264('0x26')](function(_0x422a6d){_0x1ef11a['count']=_0x422a6d;if(_0x2360c7[_0xc264('0x34')][_0xc264('0x46')]){_0x3c99bd['include']=[{'all':!![]}];}return db[_0xc264('0x45')][_0xc264('0x47')](_0x3c99bd);})[_0xc264('0x26')](function(_0x1f82cc){_0x1ef11a[_0xc264('0x48')]=_0x1f82cc;return _0x1ef11a;})[_0xc264('0x26')](respondWithFilteredResult(_0x2f8de9,_0x3c99bd))[_0xc264('0x49')](handleError(_0x2f8de9,null));};exports[_0xc264('0x4a')]=function(_0x47bff1,_0x460aa2){var _0x3afc8b={'raw':![],'where':{'id':_0x47bff1[_0xc264('0x4b')]['id']}},_0x21ae2f={};_0x21ae2f[_0xc264('0x39')]=_[_0xc264('0x35')](db[_0xc264('0x45')][_0xc264('0x30')]);_0x21ae2f[_0xc264('0x34')]=_[_0xc264('0x35')](_0x47bff1[_0xc264('0x34')]);_0x21ae2f[_0xc264('0x36')]=_['intersection'](_0x21ae2f[_0xc264('0x39')],_0x21ae2f[_0xc264('0x34')]);_0x3afc8b[_0xc264('0x38')]=_[_0xc264('0x37')](_0x21ae2f['model'],qs[_0xc264('0x3a')](_0x47bff1[_0xc264('0x34')][_0xc264('0x3a')]));_0x3afc8b[_0xc264('0x38')]=_0x3afc8b[_0xc264('0x38')][_0xc264('0x3b')]?_0x3afc8b[_0xc264('0x38')]:_0x21ae2f['model'];if(_0x47bff1[_0xc264('0x34')][_0xc264('0x46')]){_0x3afc8b[_0xc264('0x4c')]=[{'all':!![]}];}_0x3afc8b=_['merge']({},_0x3afc8b,_0x47bff1[_0xc264('0x44')]);return db[_0xc264('0x45')]['find'](_0x3afc8b)[_0xc264('0x26')](handleEntityNotFound(_0x460aa2,null))[_0xc264('0x26')](respondWithResult(_0x460aa2,null))[_0xc264('0x49')](handleError(_0x460aa2,null));};exports[_0xc264('0x4d')]=function(_0x57f7cd,_0x187994){return db[_0xc264('0x45')][_0xc264('0x4d')](_0x57f7cd[_0xc264('0x4e')],{})[_0xc264('0x26')](function(_0x3d3e96){var _0x550166=_0x57f7cd[_0xc264('0x4f')][_0xc264('0x27')]({'plain':!![]});if(!_0x550166)throw new Error(_0xc264('0x50'));if(_0x550166[_0xc264('0x51')]===_0xc264('0x4f')){var _0x398056=_0x3d3e96['get']({'plain':!![]});var _0x355ddb=_0xc264('0x28');return db[_0xc264('0x52')]['find']({'where':{'name':_0x355ddb,'userProfileId':_0x550166['userProfileId']},'raw':!![]})[_0xc264('0x26')](function(_0x3e061a){if(_0x3e061a&&_0x3e061a['autoAssociation']===0x0){return db[_0xc264('0x29')][_0xc264('0x4d')]({'name':_0x398056[_0xc264('0x2d')],'resourceId':_0x398056['id'],'type':_0x3e061a['name'],'sectionId':_0x3e061a['id']},{})[_0xc264('0x26')](function(){return _0x3d3e96;});}else{return _0x3d3e96;}})['catch'](function(_0x5ee2c4){logger[_0xc264('0x2b')](_0xc264('0x53'),_0x5ee2c4);throw _0x5ee2c4;});}return _0x3d3e96;})[_0xc264('0x26')](respondWithResult(_0x187994,0xc9))['catch'](handleError(_0x187994,null));};exports[_0xc264('0x54')]=function(_0x2acd42,_0x756528){var _0x541355={'where':{'id':_0x2acd42['params']['id']}},_0x359d2={};_0x359d2['model']=_[_0xc264('0x35')](db[_0xc264('0x45')][_0xc264('0x30')]);_0x541355[_0xc264('0x38')]=_[_0xc264('0x37')](_0x359d2[_0xc264('0x39')],qs[_0xc264('0x3a')](_0x2acd42[_0xc264('0x34')][_0xc264('0x3a')]));_0x541355[_0xc264('0x38')]=_0x541355[_0xc264('0x38')][_0xc264('0x3b')]?_0x541355[_0xc264('0x38')]:_0x359d2[_0xc264('0x39')];if(_0x2acd42[_0xc264('0x34')]['includeAll']){_0x541355[_0xc264('0x4c')]=[{'all':!![]}];}_0x541355=_[_0xc264('0x41')]({},_0x541355,_0x2acd42[_0xc264('0x44')]);return db['Campaign']['find'](_0x541355)['then'](handleEntityNotFound(_0x756528,null))[_0xc264('0x26')](function(_0x43d2bc){if(_0x43d2bc){var _0x3caeef=_0x43d2bc[_0xc264('0x27')]({'plain':!![]});_0x3caeef=qs['omit'](_0x3caeef,['id',_0xc264('0x55'),_0xc264('0x56')]);_0x2acd42[_0xc264('0x4e')]=_['omit'](_0x2acd42[_0xc264('0x4e')],['id',_0xc264('0x55'),'updatedAt']);return db[_0xc264('0x45')]['create'](_[_0xc264('0x41')](_0x3caeef,_0x2acd42[_0xc264('0x4e')]),{'include':_0x2acd42['query'][_0xc264('0x46')]?[{'all':!![]}]:undefined})['then'](function(_0x218502){var _0x3928cf=_0x2acd42[_0xc264('0x4f')][_0xc264('0x27')]({'plain':!![]});if(!_0x3928cf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3928cf[_0xc264('0x51')]==='user'){var _0x1291e0=_0x218502[_0xc264('0x27')]({'plain':!![]});var _0x3ebb2a='IvrCampaigns';return db[_0xc264('0x52')][_0xc264('0x57')]({'where':{'name':_0x3ebb2a,'userProfileId':_0x3928cf[_0xc264('0x58')]},'raw':!![]})['then'](function(_0x1c815c){if(_0x1c815c&&_0x1c815c[_0xc264('0x59')]===0x0){return db[_0xc264('0x29')]['create']({'name':_0x1291e0[_0xc264('0x2d')],'resourceId':_0x1291e0['id'],'type':_0x1c815c[_0xc264('0x2d')],'sectionId':_0x1c815c['id']},{})[_0xc264('0x26')](function(){return _0x218502;});}else{return _0x218502;}})[_0xc264('0x49')](function(_0x510602){logger[_0xc264('0x2b')](_0xc264('0x53'),_0x510602);throw _0x510602;});}return _0x218502;});}})[_0xc264('0x26')](respondWithResult(_0x756528,0xc9))['catch'](handleError(_0x756528,null));};exports[_0xc264('0x25')]=function(_0x47f49c,_0x42c123){if(_0x47f49c['body']['id']){delete _0x47f49c[_0xc264('0x4e')]['id'];}return db[_0xc264('0x45')][_0xc264('0x57')]({'where':{'id':_0x47f49c['params']['id']}})[_0xc264('0x26')](handleEntityNotFound(_0x42c123,null))[_0xc264('0x26')](saveUpdates(_0x47f49c[_0xc264('0x4e')],null))[_0xc264('0x26')](respondWithResult(_0x42c123,null))['catch'](handleError(_0x42c123,null));};exports[_0xc264('0x2a')]=function(_0x209656,_0x540e19){return db[_0xc264('0x45')][_0xc264('0x57')]({'where':{'id':_0x209656[_0xc264('0x4b')]['id']}})[_0xc264('0x26')](handleEntityNotFound(_0x540e19,null))[_0xc264('0x26')](removeEntity(_0x540e19,null))[_0xc264('0x49')](handleError(_0x540e19,null));};exports[_0xc264('0x5a')]=function(_0x2c251d,_0x5d07ea,_0x3fd31e){var _0x51a9d2={'raw':!![],'where':{}};var _0x30438e={};var _0x2490c3={'count':0x0,'rows':[]};return db[_0xc264('0x45')][_0xc264('0x5b')]({'where':{'id':_0x2c251d['params']['id']}})[_0xc264('0x26')](handleEntityNotFound(_0x5d07ea,null))[_0xc264('0x26')](function(_0x455ffe){if(_0x455ffe){_0x30438e[_0xc264('0x39')]=_['keys'](db[_0xc264('0x5c')]['rawAttributes']);_0x30438e[_0xc264('0x34')]=_[_0xc264('0x35')](_0x2c251d['query']);_0x30438e[_0xc264('0x36')]=_['intersection'](_0x30438e[_0xc264('0x39')],_0x30438e[_0xc264('0x34')]);_0x51a9d2[_0xc264('0x38')]=_['intersection'](_0x30438e[_0xc264('0x39')],qs[_0xc264('0x3a')](_0x2c251d[_0xc264('0x34')][_0xc264('0x3a')]));_0x51a9d2['attributes']=_0x51a9d2[_0xc264('0x38')][_0xc264('0x3b')]?_0x51a9d2[_0xc264('0x38')]:_0x30438e[_0xc264('0x39')];if(!_0x2c251d[_0xc264('0x34')]['hasOwnProperty']('nolimit')){_0x51a9d2[_0xc264('0x1e')]=qs[_0xc264('0x1e')](_0x2c251d[_0xc264('0x34')][_0xc264('0x1e')]);_0x51a9d2[_0xc264('0x1c')]=qs[_0xc264('0x1c')](_0x2c251d[_0xc264('0x34')][_0xc264('0x1c')]);}_0x51a9d2[_0xc264('0x3d')]=qs[_0xc264('0x3e')](_0x2c251d[_0xc264('0x34')][_0xc264('0x3e')]);_0x51a9d2[_0xc264('0x3f')]=qs[_0xc264('0x36')](_['pick'](_0x2c251d['query'],_0x30438e[_0xc264('0x36')]));_0x51a9d2[_0xc264('0x3f')]['CampaignId']=_0x455ffe['id'];if(_0x2c251d[_0xc264('0x34')][_0xc264('0x43')]){_0x51a9d2[_0xc264('0x3f')]=_[_0xc264('0x41')](_0x51a9d2[_0xc264('0x3f')],{'$or':_[_0xc264('0x33')](_0x51a9d2['attributes'],function(_0x40c383){var _0x4481c9={};_0x4481c9[_0x40c383]={'$like':'%'+_0x2c251d[_0xc264('0x34')][_0xc264('0x43')]+'%'};return _0x4481c9;})});}_0x51a9d2=_[_0xc264('0x41')]({},_0x51a9d2,_0x2c251d[_0xc264('0x44')]);return db[_0xc264('0x5c')][_0xc264('0x1f')]({'where':_0x51a9d2[_0xc264('0x3f')]})[_0xc264('0x26')](function(_0x587fcc){_0x2490c3[_0xc264('0x1f')]=_0x587fcc;if(_0x2c251d[_0xc264('0x34')][_0xc264('0x46')]){_0x51a9d2[_0xc264('0x4c')]=[{'all':!![]}];}return db[_0xc264('0x5c')][_0xc264('0x47')](_0x51a9d2);})[_0xc264('0x26')](function(_0x3de8af){_0x2490c3[_0xc264('0x48')]=_0x3de8af;return _0x2490c3;});}})[_0xc264('0x26')](respondWithFilteredResult(_0x5d07ea,_0x51a9d2))[_0xc264('0x49')](handleError(_0x5d07ea,null));};exports[_0xc264('0x5d')]=function(_0x3de360,_0x585abe,_0x26f4d5){var _0x298c49={'raw':!![],'where':{}};var _0x86379e={};var _0x141cb0={'count':0x0,'rows':[]};return db['Campaign'][_0xc264('0x5b')]({'where':{'id':_0x3de360[_0xc264('0x4b')]['id']}})['then'](handleEntityNotFound(_0x585abe,null))[_0xc264('0x26')](function(_0x324302){if(_0x324302){_0x86379e[_0xc264('0x39')]=_[_0xc264('0x35')](db[_0xc264('0x5e')]['rawAttributes']);_0x86379e[_0xc264('0x34')]=_[_0xc264('0x35')](_0x3de360[_0xc264('0x34')]);_0x86379e['filters']=_[_0xc264('0x37')](_0x86379e['model'],_0x86379e[_0xc264('0x34')]);_0x298c49[_0xc264('0x38')]=_[_0xc264('0x37')](_0x86379e[_0xc264('0x39')],qs[_0xc264('0x3a')](_0x3de360[_0xc264('0x34')][_0xc264('0x3a')]));_0x298c49[_0xc264('0x38')]=_0x298c49[_0xc264('0x38')][_0xc264('0x3b')]?_0x298c49['attributes']:_0x86379e[_0xc264('0x39')];if(!_0x3de360[_0xc264('0x34')][_0xc264('0x3c')](_0xc264('0x5f'))){_0x298c49[_0xc264('0x1e')]=qs['limit'](_0x3de360[_0xc264('0x34')][_0xc264('0x1e')]);_0x298c49[_0xc264('0x1c')]=qs[_0xc264('0x1c')](_0x3de360[_0xc264('0x34')][_0xc264('0x1c')]);}_0x298c49['order']=qs[_0xc264('0x3e')](_0x3de360[_0xc264('0x34')]['sort']);_0x298c49['where']=qs[_0xc264('0x36')](_[_0xc264('0x40')](_0x3de360[_0xc264('0x34')],_0x86379e['filters']));_0x298c49[_0xc264('0x3f')][_0xc264('0x60')]=_0x324302['id'];if(_0x3de360['query'][_0xc264('0x43')]){_0x298c49[_0xc264('0x3f')]=_[_0xc264('0x41')](_0x298c49['where'],{'$or':_[_0xc264('0x33')](_0x298c49[_0xc264('0x38')],function(_0x8f490a){var _0x290869={};_0x290869[_0x8f490a]={'$like':'%'+_0x3de360['query'][_0xc264('0x43')]+'%'};return _0x290869;})});}_0x298c49=_[_0xc264('0x41')]({},_0x298c49,_0x3de360[_0xc264('0x44')]);return db['CmHopperHistory'][_0xc264('0x1f')]({'where':_0x298c49[_0xc264('0x3f')]})[_0xc264('0x26')](function(_0x4e9d4a){_0x141cb0[_0xc264('0x1f')]=_0x4e9d4a;if(_0x3de360[_0xc264('0x34')][_0xc264('0x46')]){_0x298c49[_0xc264('0x4c')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xc264('0x47')](_0x298c49);})['then'](function(_0x3d88ff){_0x141cb0[_0xc264('0x48')]=_0x3d88ff;return _0x141cb0;});}})[_0xc264('0x26')](respondWithFilteredResult(_0x585abe,_0x298c49))[_0xc264('0x49')](handleError(_0x585abe,null));};exports[_0xc264('0x61')]=function(_0x2e6b66,_0x375d85,_0x470ebd){var _0x2edf9a={'raw':!![],'where':{}};var _0x319a7f={};var _0x259f6f={'count':0x0,'rows':[]};return db[_0xc264('0x45')]['findOne']({'where':{'id':_0x2e6b66[_0xc264('0x4b')]['id']}})[_0xc264('0x26')](handleEntityNotFound(_0x375d85,null))[_0xc264('0x26')](function(_0x432051){if(_0x432051){_0x319a7f[_0xc264('0x39')]=_[_0xc264('0x35')](db['CmHopperFinal'][_0xc264('0x30')]);_0x319a7f[_0xc264('0x34')]=_[_0xc264('0x35')](_0x2e6b66[_0xc264('0x34')]);_0x319a7f[_0xc264('0x36')]=_[_0xc264('0x37')](_0x319a7f[_0xc264('0x39')],_0x319a7f[_0xc264('0x34')]);_0x2edf9a[_0xc264('0x38')]=_[_0xc264('0x37')](_0x319a7f[_0xc264('0x39')],qs['fields'](_0x2e6b66[_0xc264('0x34')][_0xc264('0x3a')]));_0x2edf9a[_0xc264('0x38')]=_0x2edf9a[_0xc264('0x38')][_0xc264('0x3b')]?_0x2edf9a[_0xc264('0x38')]:_0x319a7f['model'];if(!_0x2e6b66[_0xc264('0x34')]['hasOwnProperty'](_0xc264('0x5f'))){_0x2edf9a['limit']=qs[_0xc264('0x1e')](_0x2e6b66[_0xc264('0x34')][_0xc264('0x1e')]);_0x2edf9a[_0xc264('0x1c')]=qs[_0xc264('0x1c')](_0x2e6b66['query']['offset']);}_0x2edf9a[_0xc264('0x3d')]=qs[_0xc264('0x3e')](_0x2e6b66[_0xc264('0x34')][_0xc264('0x3e')]);_0x2edf9a[_0xc264('0x3f')]=qs[_0xc264('0x36')](_['pick'](_0x2e6b66[_0xc264('0x34')],_0x319a7f[_0xc264('0x36')]));_0x2edf9a['where'][_0xc264('0x60')]=_0x432051['id'];if(_0x2e6b66[_0xc264('0x34')]['filter']){_0x2edf9a[_0xc264('0x3f')]=_['merge'](_0x2edf9a[_0xc264('0x3f')],{'$or':_[_0xc264('0x33')](_0x2edf9a[_0xc264('0x38')],function(_0x1d2f09){var _0x7aba75={};_0x7aba75[_0x1d2f09]={'$like':'%'+_0x2e6b66['query']['filter']+'%'};return _0x7aba75;})});}_0x2edf9a=_[_0xc264('0x41')]({},_0x2edf9a,_0x2e6b66[_0xc264('0x44')]);return db[_0xc264('0x62')][_0xc264('0x1f')]({'where':_0x2edf9a[_0xc264('0x3f')]})[_0xc264('0x26')](function(_0x4e4995){_0x259f6f[_0xc264('0x1f')]=_0x4e4995;if(_0x2e6b66[_0xc264('0x34')][_0xc264('0x46')]){_0x2edf9a[_0xc264('0x4c')]=[{'all':!![]}];}return db[_0xc264('0x62')][_0xc264('0x47')](_0x2edf9a);})[_0xc264('0x26')](function(_0x5d45a0){_0x259f6f[_0xc264('0x48')]=_0x5d45a0;return _0x259f6f;});}})[_0xc264('0x26')](respondWithFilteredResult(_0x375d85,_0x2edf9a))['catch'](handleError(_0x375d85,null));};exports[_0xc264('0x63')]=function(_0x2d030b,_0x3a6d05,_0x34ee0c){var _0x9c8868={'raw':!![],'where':{}};var _0x274383={};var _0xd4eec3={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x2d030b[_0xc264('0x4b')]['id']}})[_0xc264('0x26')](handleEntityNotFound(_0x3a6d05,null))[_0xc264('0x26')](function(_0x295457){if(_0x295457){_0x274383[_0xc264('0x39')]=_[_0xc264('0x35')](db['CmHopperBlack'][_0xc264('0x30')]);_0x274383[_0xc264('0x34')]=_[_0xc264('0x35')](_0x2d030b[_0xc264('0x34')]);_0x274383[_0xc264('0x36')]=_[_0xc264('0x37')](_0x274383[_0xc264('0x39')],_0x274383[_0xc264('0x34')]);_0x9c8868[_0xc264('0x38')]=_['intersection'](_0x274383[_0xc264('0x39')],qs[_0xc264('0x3a')](_0x2d030b[_0xc264('0x34')][_0xc264('0x3a')]));_0x9c8868['attributes']=_0x9c8868['attributes'][_0xc264('0x3b')]?_0x9c8868[_0xc264('0x38')]:_0x274383[_0xc264('0x39')];if(!_0x2d030b[_0xc264('0x34')]['hasOwnProperty'](_0xc264('0x5f'))){_0x9c8868[_0xc264('0x1e')]=qs[_0xc264('0x1e')](_0x2d030b[_0xc264('0x34')]['limit']);_0x9c8868[_0xc264('0x1c')]=qs[_0xc264('0x1c')](_0x2d030b['query'][_0xc264('0x1c')]);}_0x9c8868[_0xc264('0x3d')]=qs[_0xc264('0x3e')](_0x2d030b[_0xc264('0x34')]['sort']);_0x9c8868[_0xc264('0x3f')]=qs[_0xc264('0x36')](_[_0xc264('0x40')](_0x2d030b['query'],_0x274383[_0xc264('0x36')]));_0x9c8868['where'][_0xc264('0x60')]=_0x295457['id'];if(_0x2d030b[_0xc264('0x34')][_0xc264('0x43')]){_0x9c8868[_0xc264('0x3f')]=_[_0xc264('0x41')](_0x9c8868[_0xc264('0x3f')],{'$or':_[_0xc264('0x33')](_0x9c8868[_0xc264('0x38')],function(_0x3f015d){var _0x595a27={};_0x595a27[_0x3f015d]={'$like':'%'+_0x2d030b[_0xc264('0x34')]['filter']+'%'};return _0x595a27;})});}_0x9c8868=_[_0xc264('0x41')]({},_0x9c8868,_0x2d030b[_0xc264('0x44')]);return db[_0xc264('0x64')][_0xc264('0x1f')]({'where':_0x9c8868[_0xc264('0x3f')]})[_0xc264('0x26')](function(_0x354220){_0xd4eec3['count']=_0x354220;if(_0x2d030b['query'][_0xc264('0x46')]){_0x9c8868[_0xc264('0x4c')]=[{'all':!![]}];}return db[_0xc264('0x64')]['findAll'](_0x9c8868);})[_0xc264('0x26')](function(_0xfbe525){_0xd4eec3['rows']=_0xfbe525;return _0xd4eec3;});}})[_0xc264('0x26')](respondWithFilteredResult(_0x3a6d05,_0x9c8868))[_0xc264('0x49')](handleError(_0x3a6d05,null));};exports[_0xc264('0x65')]=function(_0x369513,_0x4d8f9a,_0x4944d0){var _0x30150e={};var _0x14db5b={};var _0x4bb12d;var _0x82ebb2;return db[_0xc264('0x45')]['findOne']({'where':{'id':_0x369513[_0xc264('0x4b')]['id']}})[_0xc264('0x26')](handleEntityNotFound(_0x4d8f9a,null))['then'](function(_0x1c162a){if(_0x1c162a){_0x4bb12d=_0x1c162a;_0x14db5b['model']=_[_0xc264('0x35')](db['CmList'][_0xc264('0x30')]);_0x14db5b[_0xc264('0x34')]=_[_0xc264('0x35')](_0x369513[_0xc264('0x34')]);_0x14db5b[_0xc264('0x36')]=_[_0xc264('0x37')](_0x14db5b[_0xc264('0x39')],_0x14db5b[_0xc264('0x34')]);_0x30150e[_0xc264('0x38')]=_['intersection'](_0x14db5b[_0xc264('0x39')],qs['fields'](_0x369513[_0xc264('0x34')][_0xc264('0x3a')]));_0x30150e[_0xc264('0x38')]=_0x30150e['attributes'][_0xc264('0x3b')]?_0x30150e[_0xc264('0x38')]:_0x14db5b[_0xc264('0x39')];_0x30150e[_0xc264('0x3d')]=qs['sort'](_0x369513[_0xc264('0x34')]['sort']);_0x30150e[_0xc264('0x3f')]=qs[_0xc264('0x36')](_[_0xc264('0x40')](_0x369513['query'],_0x14db5b['filters']));if(_0x369513['query'][_0xc264('0x43')]){_0x30150e[_0xc264('0x3f')]=_[_0xc264('0x41')](_0x30150e[_0xc264('0x3f')],{'$or':_[_0xc264('0x33')](_0x30150e[_0xc264('0x38')],function(_0x5d7292){var _0x59b91e={};_0x59b91e[_0x5d7292]={'$like':'%'+_0x369513[_0xc264('0x34')][_0xc264('0x43')]+'%'};return _0x59b91e;})});}_0x30150e=_[_0xc264('0x41')]({},_0x30150e,_0x369513['options']);return _0x4bb12d[_0xc264('0x65')](_0x30150e);}})[_0xc264('0x26')](function(_0x32f2ba){if(_0x32f2ba){_0x82ebb2=_0x32f2ba[_0xc264('0x3b')];if(!_0x369513[_0xc264('0x34')][_0xc264('0x3c')](_0xc264('0x5f'))){_0x30150e[_0xc264('0x1e')]=qs[_0xc264('0x1e')](_0x369513[_0xc264('0x34')][_0xc264('0x1e')]);_0x30150e[_0xc264('0x1c')]=qs[_0xc264('0x1c')](_0x369513['query'][_0xc264('0x1c')]);}return _0x4bb12d[_0xc264('0x65')](_0x30150e);}})[_0xc264('0x26')](function(_0x3a3abd){if(_0x3a3abd){return _0x3a3abd?{'count':_0x82ebb2,'rows':_0x3a3abd}:null;}})[_0xc264('0x26')](respondWithResult(_0x4d8f9a,null))['catch'](handleError(_0x4d8f9a,null));};exports['addLists']=function(_0x2962ca,_0x4fc58d,_0x4ddebc){var _0x4539cc,_0x37596f;return db['Campaign'][_0xc264('0x57')]({'where':{'id':_0x2962ca[_0xc264('0x4b')]['id']}})[_0xc264('0x26')](handleEntityNotFound(_0x4fc58d,null))[_0xc264('0x26')](function(_0x3b24dc){if(_0x3b24dc){_0x37596f=_0x3b24dc;return _0x3b24dc[_0xc264('0x66')](_0x2962ca['body'][_0xc264('0x67')],_['omit'](_0x2962ca['body'],['ids','id'])||{});}return null;})[_0xc264('0x68')](function(_0x3a70c8){var _0xa5427c;_0x4539cc=_0x3a70c8||[];var _0x3f9f17=[];if(_0x3a70c8){for(var _0x294e6b=0x0;_0x294e6b<_0x3a70c8[_0xc264('0x3b')];_0x294e6b+=0x1){var _0x1c5a83=_0x3a70c8[_0x294e6b][_0xc264('0x27')]({'plain':!![]});_0x37596f[_0xc264('0x69')]=_0x2962ca[_0xc264('0x4e')][_0xc264('0x69')]?_0x2962ca[_0xc264('0x4e')][_0xc264('0x69')]:_0x37596f[_0xc264('0x69')];switch(_0x37596f['dialCheckDuplicateType']){case _0xc264('0x6a'):_0xa5427c=squel[_0xc264('0x6b')]()['into'](_0xc264('0x6c'))[_0xc264('0x6d')]([_0xc264('0x6e'),_0xc264('0x6f'),_0xc264('0x70'),_0xc264('0x71'),_0xc264('0x60'),'createdAt',_0xc264('0x56')],squel[_0xc264('0x72')]()[_0xc264('0x73')](_0xc264('0x6e'),_0xc264('0x6e'))[_0xc264('0x73')](_0xc264('0x74'),_0xc264('0x6f'))[_0xc264('0x73')]('id','ContactId')[_0xc264('0x73')](_0x1c5a83[_0xc264('0x75')][_0xc264('0x76')](),_0xc264('0x71'))[_0xc264('0x73')](_0x2962ca['params']['id'][_0xc264('0x76')](),_0xc264('0x60'))['field'](_0xc264('0x74'),_0xc264('0x55'))[_0xc264('0x73')]('NOW()',_0xc264('0x56'))[_0xc264('0x77')](_0xc264('0x78'))['where']('deletedAt\x20IS\x20NULL')['where'](_0xc264('0x79'),_0x1c5a83[_0xc264('0x75')][_0xc264('0x76')]())[_0xc264('0x3f')](_0xc264('0x7a'))['where'](_0xc264('0x7b'),squel[_0xc264('0x72')]()[_0xc264('0x73')]('COALESCE(calleridnum,\x27\x27)')['from'](_0xc264('0x7c'))[_0xc264('0x3f')](_0xc264('0x7d'),_0x2962ca[_0xc264('0x4b')]['id'][_0xc264('0x76')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xc264('0x73')](_0xc264('0x7e'))[_0xc264('0x77')]('cm_hopper')[_0xc264('0x3f')](_0xc264('0x7d'),_0x2962ca[_0xc264('0x4b')]['id'][_0xc264('0x76')]())))[_0xc264('0x76')]();break;case'onlyIfOpen':_0xa5427c=squel[_0xc264('0x6b')]()[_0xc264('0x7f')](_0xc264('0x6c'))[_0xc264('0x6d')]([_0xc264('0x6e'),_0xc264('0x6f'),_0xc264('0x70'),_0xc264('0x71'),'CampaignId',_0xc264('0x55'),_0xc264('0x56')],squel[_0xc264('0x72')]()['field'](_0xc264('0x6e'),'phone')[_0xc264('0x73')](_0xc264('0x74'),_0xc264('0x6f'))[_0xc264('0x73')]('id',_0xc264('0x70'))[_0xc264('0x73')](_0x1c5a83[_0xc264('0x75')][_0xc264('0x76')](),'ListId')[_0xc264('0x73')](_0x2962ca[_0xc264('0x4b')]['id']['toString'](),'CampaignId')[_0xc264('0x73')](_0xc264('0x74'),'createdAt')['field'](_0xc264('0x74'),_0xc264('0x56'))[_0xc264('0x77')](_0xc264('0x78'))[_0xc264('0x3f')](_0xc264('0x80'))[_0xc264('0x3f')](_0xc264('0x79'),_0x1c5a83[_0xc264('0x75')][_0xc264('0x76')]())[_0xc264('0x3f')](_0xc264('0x7a'))[_0xc264('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc264('0x72')]()['field'](_0xc264('0x7e'))['from']('cm_hopper')[_0xc264('0x3f')](_0xc264('0x7d'),_0x2962ca[_0xc264('0x4b')]['id'][_0xc264('0x76')]())))[_0xc264('0x76')]();break;default:_0xa5427c=squel[_0xc264('0x6b')]()['into'](_0xc264('0x6c'))[_0xc264('0x6d')]([_0xc264('0x6e'),'scheduledAt',_0xc264('0x70'),_0xc264('0x71'),'CampaignId',_0xc264('0x55'),_0xc264('0x56')],squel['select']()['field'](_0xc264('0x6e'),_0xc264('0x6e'))[_0xc264('0x73')](_0xc264('0x74'),_0xc264('0x6f'))[_0xc264('0x73')]('id',_0xc264('0x70'))[_0xc264('0x73')](_0x1c5a83[_0xc264('0x75')][_0xc264('0x76')](),_0xc264('0x71'))[_0xc264('0x73')](_0x2962ca[_0xc264('0x4b')]['id']['toString'](),_0xc264('0x60'))['field'](_0xc264('0x74'),_0xc264('0x55'))[_0xc264('0x73')](_0xc264('0x74'),'updatedAt')['from'](_0xc264('0x78'))[_0xc264('0x3f')](_0xc264('0x80'))[_0xc264('0x3f')](_0xc264('0x79'),_0x1c5a83[_0xc264('0x75')][_0xc264('0x76')]())[_0xc264('0x3f')](_0xc264('0x7a')))[_0xc264('0x76')]();}_0x3f9f17[_0xc264('0x81')](db['sequelize']['query'](_0xa5427c));}return BPromise[_0xc264('0x82')](_0x3f9f17);}})['then'](function(){return _0x4539cc;})[_0xc264('0x26')](respondWithResult(_0x4fc58d,null))[_0xc264('0x49')](handleError(_0x4fc58d,null));};exports[_0xc264('0x83')]=function(_0x59f1bc,_0x47017e,_0x1879a5){return db[_0xc264('0x45')]['find']({'where':{'id':_0x59f1bc[_0xc264('0x4b')]['id']}})[_0xc264('0x26')](handleEntityNotFound(_0x47017e,null))['then'](function(_0x3bee0e){if(_0x3bee0e){return _0x3bee0e[_0xc264('0x83')](_0x59f1bc[_0xc264('0x34')]['ids']);}})[_0xc264('0x26')](function(_0xda292){if(_0xda292){return db[_0xc264('0x5c')][_0xc264('0x2a')]({'where':{'ListId':_0x59f1bc[_0xc264('0x34')]['ids'],'CampaignId':_0x59f1bc[_0xc264('0x4b')]['id']}})['then'](function(){return _0xda292;});}})[_0xc264('0x26')](respondWithStatusCode(_0x47017e,null))[_0xc264('0x49')](handleError(_0x47017e,null));};exports[_0xc264('0x84')]=function(_0x2d7b03,_0x4288a8,_0x480abb){var _0x12bbd9={};var _0x4bea7b={};var _0x115027;var _0x226eeb;return db[_0xc264('0x45')][_0xc264('0x5b')]({'where':{'id':_0x2d7b03[_0xc264('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4288a8,null))[_0xc264('0x26')](function(_0x32818f){if(_0x32818f){_0x115027=_0x32818f;_0x4bea7b[_0xc264('0x39')]=_[_0xc264('0x35')](db[_0xc264('0x85')][_0xc264('0x30')]);_0x4bea7b['query']=_[_0xc264('0x35')](_0x2d7b03[_0xc264('0x34')]);_0x4bea7b['filters']=_[_0xc264('0x37')](_0x4bea7b['model'],_0x4bea7b[_0xc264('0x34')]);_0x12bbd9[_0xc264('0x38')]=_[_0xc264('0x37')](_0x4bea7b['model'],qs[_0xc264('0x3a')](_0x2d7b03[_0xc264('0x34')][_0xc264('0x3a')]));_0x12bbd9[_0xc264('0x38')]=_0x12bbd9['attributes'][_0xc264('0x3b')]?_0x12bbd9[_0xc264('0x38')]:_0x4bea7b['model'];_0x12bbd9[_0xc264('0x3d')]=qs[_0xc264('0x3e')](_0x2d7b03[_0xc264('0x34')]['sort']);_0x12bbd9[_0xc264('0x3f')]=qs[_0xc264('0x36')](_[_0xc264('0x40')](_0x2d7b03[_0xc264('0x34')],_0x4bea7b['filters']));if(_0x2d7b03['query'][_0xc264('0x43')]){_0x12bbd9['where']=_[_0xc264('0x41')](_0x12bbd9[_0xc264('0x3f')],{'$or':_[_0xc264('0x33')](_0x12bbd9[_0xc264('0x38')],function(_0x145960){var _0x402f2d={};_0x402f2d[_0x145960]={'$like':'%'+_0x2d7b03[_0xc264('0x34')][_0xc264('0x43')]+'%'};return _0x402f2d;})});}_0x12bbd9=_[_0xc264('0x41')]({},_0x12bbd9,_0x2d7b03[_0xc264('0x44')]);return _0x115027[_0xc264('0x84')](_0x12bbd9);}})['then'](function(_0x1424f5){if(_0x1424f5){_0x226eeb=_0x1424f5[_0xc264('0x3b')];if(!_0x2d7b03['query'][_0xc264('0x3c')](_0xc264('0x5f'))){_0x12bbd9[_0xc264('0x1e')]=qs[_0xc264('0x1e')](_0x2d7b03[_0xc264('0x34')][_0xc264('0x1e')]);_0x12bbd9[_0xc264('0x1c')]=qs[_0xc264('0x1c')](_0x2d7b03[_0xc264('0x34')][_0xc264('0x1c')]);}return _0x115027[_0xc264('0x84')](_0x12bbd9);}})[_0xc264('0x26')](function(_0xc5838){if(_0xc5838){return _0xc5838?{'count':_0x226eeb,'rows':_0xc5838}:null;}})[_0xc264('0x26')](respondWithResult(_0x4288a8,null))[_0xc264('0x49')](handleError(_0x4288a8,null));};exports[_0xc264('0x86')]=function(_0x5a24fc,_0x1b07f0,_0x9ce058){var _0x5b1732,_0x572a31;return db['Campaign'][_0xc264('0x57')]({'where':{'id':_0x5a24fc[_0xc264('0x4b')]['id']}})[_0xc264('0x26')](handleEntityNotFound(_0x1b07f0,null))[_0xc264('0x26')](function(_0x48dae3){if(_0x48dae3){_0x572a31=_0x48dae3;return _0x48dae3[_0xc264('0x86')](_0x5a24fc['body'][_0xc264('0x67')],_[_0xc264('0x87')](_0x5a24fc[_0xc264('0x4e')],[_0xc264('0x67'),'id'])||{});}return null;})[_0xc264('0x68')](function(_0x32250c){var _0xbaabf2;_0x5b1732=_0x32250c||[];var _0x3943c6=[];if(_0x32250c){for(var _0x24d328=0x0;_0x24d328<_0x32250c['length'];_0x24d328+=0x1){var _0x1a8c26=_0x32250c[_0x24d328][_0xc264('0x27')]({'plain':!![]});_0xbaabf2=squel['insert']()['into'](_0xc264('0x88'))['fromQuery']([_0xc264('0x6e'),_0xc264('0x70'),_0xc264('0x71'),_0xc264('0x60'),_0xc264('0x55'),_0xc264('0x56')],squel['select']()[_0xc264('0x73')]('phone',_0xc264('0x6e'))[_0xc264('0x73')]('id',_0xc264('0x70'))['field'](_0x1a8c26[_0xc264('0x75')][_0xc264('0x76')](),_0xc264('0x71'))['field'](_0x5a24fc['params']['id'][_0xc264('0x76')](),_0xc264('0x60'))[_0xc264('0x73')](_0xc264('0x74'),_0xc264('0x55'))[_0xc264('0x73')]('NOW()',_0xc264('0x56'))[_0xc264('0x77')](_0xc264('0x78'))['where'](_0xc264('0x80'))[_0xc264('0x3f')]('ListId\x20=\x20?',_0x1a8c26['CmListId']['toString']())['where'](_0xc264('0x7a')))[_0xc264('0x76')]();_0x3943c6['push'](db[_0xc264('0x89')]['query'](_0xbaabf2));}return BPromise['all'](_0x3943c6);}})['then'](function(){return _0x5b1732;})[_0xc264('0x26')](respondWithResult(_0x1b07f0,null))['catch'](handleError(_0x1b07f0,null));};exports[_0xc264('0x8a')]=function(_0x5bca5e,_0x5f4173,_0x264bc3){return db[_0xc264('0x45')][_0xc264('0x57')]({'where':{'id':_0x5bca5e['params']['id']}})[_0xc264('0x26')](handleEntityNotFound(_0x5f4173,null))[_0xc264('0x26')](function(_0x404983){if(_0x404983){return _0x404983['removeBlackLists'](_0x5bca5e[_0xc264('0x34')][_0xc264('0x67')]);}})[_0xc264('0x26')](function(_0x48b766){if(_0x48b766){return db[_0xc264('0x64')][_0xc264('0x2a')]({'where':{'ListId':_0x5bca5e[_0xc264('0x34')][_0xc264('0x67')],'CampaignId':_0x5bca5e['params']['id']}})[_0xc264('0x26')](function(){return _0x48b766;});}})[_0xc264('0x26')](respondWithStatusCode(_0x5f4173,null))[_0xc264('0x49')](handleError(_0x5f4173,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 210a28a..43b44a8 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(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x1a423e,_0xb86076){var _0x29de4b=function(_0x3190ac){while(--_0x3190ac){_0x1a423e['push'](_0x1a423e['shift']());}};_0x29de4b(++_0xb86076);}(_0x7a54,0x106));var _0x47a5=function(_0x43d75d,_0x143085){_0x43d75d=_0x43d75d-0x0;var _0x456eb8=_0x7a54[_0x43d75d];return _0x456eb8;};'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 242e5ea..96ea444 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 _0xfa68=['info','request\x20sent','debug','stringify','error','code','message','Campaign,\x20%s,\x20%s','result','findAll','options','raw','limit','include','map','model','attributes','GetCampaign','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4bd6d3,_0x3a7e64){var _0x3e663c=function(_0x23f1d6){while(--_0x23f1d6){_0x4bd6d3['push'](_0x4bd6d3['shift']());}};_0x3e663c(++_0x3a7e64);}(_0xfa68,0x86));var _0x8fa6=function(_0x3bb8b0,_0x15ba06){_0x3bb8b0=_0x3bb8b0-0x0;var _0x44df08=_0xfa68[_0x3bb8b0];return _0x44df08;};'use strict';var _=require(_0x8fa6('0x0'));var util=require(_0x8fa6('0x1'));var moment=require(_0x8fa6('0x2'));var BPromise=require('bluebird');var rs=require(_0x8fa6('0x3'));var fs=require('fs');var Redis=require(_0x8fa6('0x4'));var db=require(_0x8fa6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8fa6('0x6'))(_0x8fa6('0x7'));var config=require(_0x8fa6('0x8'));var jayson=require(_0x8fa6('0x9'));var client=jayson[_0x8fa6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ab645,_0x42b044,_0x523f62){return new BPromise(function(_0x1cdf94,_0x269bda){return client['request'](_0x1ab645,_0x523f62)['then'](function(_0x1f3a90){logger[_0x8fa6('0xb')]('Campaign,\x20%s,\x20%s',_0x42b044,_0x8fa6('0xc'));logger[_0x8fa6('0xd')]('Campaign,\x20%s,\x20%s,\x20%s',_0x42b044,'request\x20sent',JSON[_0x8fa6('0xe')](_0x1f3a90));if(_0x1f3a90[_0x8fa6('0xf')]){if(_0x1f3a90['error'][_0x8fa6('0x10')]===0x1f4){logger[_0x8fa6('0xf')]('Campaign,\x20%s,\x20%s',_0x42b044,_0x1f3a90[_0x8fa6('0xf')][_0x8fa6('0x11')]);return _0x269bda(_0x1f3a90['error'][_0x8fa6('0x11')]);}logger[_0x8fa6('0xf')](_0x8fa6('0x12'),_0x42b044,_0x1f3a90[_0x8fa6('0xf')][_0x8fa6('0x11')]);return _0x1cdf94(_0x1f3a90['error']['message']);}else{logger[_0x8fa6('0xb')]('Campaign,\x20%s,\x20%s',_0x42b044,_0x8fa6('0xc'));_0x1cdf94(_0x1f3a90[_0x8fa6('0x13')][_0x8fa6('0x11')]);}})['catch'](function(_0x210bfe){logger[_0x8fa6('0xf')](_0x8fa6('0x12'),_0x42b044,_0x210bfe);_0x269bda(_0x210bfe);});});}exports['GetCampaign']=function(_0x329f97){var _0x2f7baf=this;return new Promise(function(_0x8de44e,_0x2dffbe){return db['Campaign'][_0x8fa6('0x14')]({'raw':_0x329f97['options']?_0x329f97[_0x8fa6('0x15')][_0x8fa6('0x16')]===undefined?!![]:![]:!![],'where':_0x329f97[_0x8fa6('0x15')]?_0x329f97[_0x8fa6('0x15')]['where']||null:null,'attributes':_0x329f97[_0x8fa6('0x15')]?_0x329f97[_0x8fa6('0x15')]['attributes']||null:null,'limit':_0x329f97[_0x8fa6('0x15')]?_0x329f97[_0x8fa6('0x15')][_0x8fa6('0x17')]||null:null,'include':_0x329f97['options']?_0x329f97[_0x8fa6('0x15')][_0x8fa6('0x18')]?_[_0x8fa6('0x19')](_0x329f97['options']['include'],function(_0x588001){return{'model':db[_0x588001[_0x8fa6('0x1a')]],'as':_0x588001['as'],'attributes':_0x588001[_0x8fa6('0x1b')],'include':_0x588001['include']?_['map'](_0x588001[_0x8fa6('0x18')],function(_0x3f86d8){return{'model':db[_0x3f86d8['model']],'as':_0x3f86d8['as'],'attributes':_0x3f86d8['attributes'],'include':_0x3f86d8[_0x8fa6('0x18')]?_[_0x8fa6('0x19')](_0x3f86d8[_0x8fa6('0x18')],function(_0x4efd81){return{'model':db[_0x4efd81[_0x8fa6('0x1a')]],'as':_0x4efd81['as'],'attributes':_0x4efd81[_0x8fa6('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb59c50){logger[_0x8fa6('0xb')]('GetCampaign',_0x329f97);logger[_0x8fa6('0xd')](_0x8fa6('0x1c'),_0x329f97,JSON['stringify'](_0xb59c50));_0x8de44e(_0xb59c50);})['catch'](function(_0x23fdc9){logger[_0x8fa6('0xf')]('GetCampaign',_0x23fdc9['message'],_0x329f97);_0x2dffbe(_0x2f7baf[_0x8fa6('0xf')](0x1f4,_0x23fdc9[_0x8fa6('0x11')]));});});}; \ No newline at end of file +var _0x2bd6=['where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetCampaign','Campaign','findAll','options','raw'];(function(_0x46841b,_0xd0c2){var _0x38a08c=function(_0x37acb0){while(--_0x37acb0){_0x46841b['push'](_0x46841b['shift']());}};_0x38a08c(++_0xd0c2);}(_0x2bd6,0x1f4));var _0x62bd=function(_0x191154,_0x56f74c){_0x191154=_0x191154-0x0;var _0x3dcd73=_0x2bd6[_0x191154];return _0x3dcd73;};'use strict';var _=require(_0x62bd('0x0'));var util=require(_0x62bd('0x1'));var moment=require(_0x62bd('0x2'));var BPromise=require(_0x62bd('0x3'));var rs=require(_0x62bd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62bd('0x5'))['db'];var utils=require(_0x62bd('0x6'));var logger=require(_0x62bd('0x7'))('rpc');var config=require(_0x62bd('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x62bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39af04,_0x55d811,_0x3d0d8b){return new BPromise(function(_0x11af94,_0x4ff8b8){return client[_0x62bd('0xa')](_0x39af04,_0x3d0d8b)[_0x62bd('0xb')](function(_0x1e2413){logger[_0x62bd('0xc')](_0x62bd('0xd'),_0x55d811,_0x62bd('0xe'));logger[_0x62bd('0xf')](_0x62bd('0x10'),_0x55d811,_0x62bd('0xe'),JSON[_0x62bd('0x11')](_0x1e2413));if(_0x1e2413['error']){if(_0x1e2413['error'][_0x62bd('0x12')]===0x1f4){logger[_0x62bd('0x13')](_0x62bd('0xd'),_0x55d811,_0x1e2413[_0x62bd('0x13')][_0x62bd('0x14')]);return _0x4ff8b8(_0x1e2413[_0x62bd('0x13')]['message']);}logger[_0x62bd('0x13')]('Campaign,\x20%s,\x20%s',_0x55d811,_0x1e2413[_0x62bd('0x13')]['message']);return _0x11af94(_0x1e2413['error'][_0x62bd('0x14')]);}else{logger[_0x62bd('0xc')](_0x62bd('0xd'),_0x55d811,_0x62bd('0xe'));_0x11af94(_0x1e2413[_0x62bd('0x15')][_0x62bd('0x14')]);}})[_0x62bd('0x16')](function(_0x16f723){logger['error'](_0x62bd('0xd'),_0x55d811,_0x16f723);_0x4ff8b8(_0x16f723);});});}exports[_0x62bd('0x17')]=function(_0x1e0b6a){var _0x38eb80=this;return new Promise(function(_0x59a648,_0x3d050b){return db[_0x62bd('0x18')][_0x62bd('0x19')]({'raw':_0x1e0b6a[_0x62bd('0x1a')]?_0x1e0b6a['options'][_0x62bd('0x1b')]===undefined?!![]:![]:!![],'where':_0x1e0b6a[_0x62bd('0x1a')]?_0x1e0b6a[_0x62bd('0x1a')][_0x62bd('0x1c')]||null:null,'attributes':_0x1e0b6a['options']?_0x1e0b6a[_0x62bd('0x1a')][_0x62bd('0x1d')]||null:null,'limit':_0x1e0b6a[_0x62bd('0x1a')]?_0x1e0b6a[_0x62bd('0x1a')]['limit']||null:null,'include':_0x1e0b6a[_0x62bd('0x1a')]?_0x1e0b6a[_0x62bd('0x1a')][_0x62bd('0x1e')]?_[_0x62bd('0x1f')](_0x1e0b6a[_0x62bd('0x1a')][_0x62bd('0x1e')],function(_0x245628){return{'model':db[_0x245628[_0x62bd('0x20')]],'as':_0x245628['as'],'attributes':_0x245628[_0x62bd('0x1d')],'include':_0x245628[_0x62bd('0x1e')]?_[_0x62bd('0x1f')](_0x245628[_0x62bd('0x1e')],function(_0x45e4f2){return{'model':db[_0x45e4f2['model']],'as':_0x45e4f2['as'],'attributes':_0x45e4f2[_0x62bd('0x1d')],'include':_0x45e4f2[_0x62bd('0x1e')]?_['map'](_0x45e4f2[_0x62bd('0x1e')],function(_0x3c6761){return{'model':db[_0x3c6761[_0x62bd('0x20')]],'as':_0x3c6761['as'],'attributes':_0x3c6761['attributes']};}):[]};}):[]};}):[]:[]})[_0x62bd('0xb')](function(_0x205d78){logger[_0x62bd('0xc')](_0x62bd('0x17'),_0x1e0b6a);logger[_0x62bd('0xf')](_0x62bd('0x17'),_0x1e0b6a,JSON[_0x62bd('0x11')](_0x205d78));_0x59a648(_0x205d78);})[_0x62bd('0x16')](function(_0x532515){logger['error'](_0x62bd('0x17'),_0x532515[_0x62bd('0x14')],_0x1e0b6a);_0x3d050b(_0x38eb80[_0x62bd('0x13')](0x1f4,_0x532515[_0x62bd('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 03b3a93..aaacc00 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 _0xf430=['/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','clone','addBlackLists','/:id','update','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated','index','get','show'];(function(_0x149759,_0x7f4feb){var _0xb05afc=function(_0x192149){while(--_0x192149){_0x149759['push'](_0x149759['shift']());}};_0xb05afc(++_0x7f4feb);}(_0xf430,0x1e4));var _0x0f43=function(_0x106214,_0x454b8d){_0x106214=_0x106214-0x0;var _0x5f5cea=_0xf430[_0x106214];return _0x5f5cea;};'use strict';var multer=require(_0x0f43('0x0'));var util=require(_0x0f43('0x1'));var path=require(_0x0f43('0x2'));var timeout=require('connect-timeout');var express=require(_0x0f43('0x3'));var router=express[_0x0f43('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0f43('0x5'));var config=require(_0x0f43('0x6'));var controller=require(_0x0f43('0x7'));router['get']('/',auth[_0x0f43('0x8')](),controller[_0x0f43('0x9')]);router[_0x0f43('0xa')]('/:id',auth[_0x0f43('0x8')](),controller[_0x0f43('0xb')]);router[_0x0f43('0xa')]('/:id/hoppers',auth[_0x0f43('0x8')](),controller['getHoppers']);router[_0x0f43('0xa')](_0x0f43('0xc'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0x0f43('0xa')](_0x0f43('0xd'),auth[_0x0f43('0x8')](),controller[_0x0f43('0xe')]);router[_0x0f43('0xa')]('/:id/hopper_black',auth[_0x0f43('0x8')](),controller[_0x0f43('0xf')]);router[_0x0f43('0xa')](_0x0f43('0x10'),auth[_0x0f43('0x8')](),controller[_0x0f43('0x11')]);router[_0x0f43('0xa')](_0x0f43('0x12'),auth[_0x0f43('0x8')](),controller[_0x0f43('0x13')]);router[_0x0f43('0x14')]('/',auth['isAuthenticated'](),controller[_0x0f43('0x15')]);router[_0x0f43('0x14')]('/:id/clone',auth[_0x0f43('0x8')](),controller[_0x0f43('0x16')]);router[_0x0f43('0x14')]('/:id/lists',auth[_0x0f43('0x8')](),controller['addLists']);router[_0x0f43('0x14')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x0f43('0x17')]);router['put'](_0x0f43('0x18'),auth['isAuthenticated'](),controller[_0x0f43('0x19')]);router[_0x0f43('0x1a')](_0x0f43('0x18'),auth[_0x0f43('0x8')](),controller[_0x0f43('0x1b')]);router[_0x0f43('0x1a')]('/:id/lists',auth[_0x0f43('0x8')](),controller[_0x0f43('0x1c')]);router[_0x0f43('0x1a')](_0x0f43('0x12'),auth[_0x0f43('0x8')](),controller[_0x0f43('0x1d')]);module[_0x0f43('0x1e')]=router; \ No newline at end of file +var _0xf566=['/:id/hopper_finals','getHopperFinals','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','addLists','addBlackLists','put','update','delete','destroy','removeLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories'];(function(_0x549276,_0x3fdac8){var _0xee59d2=function(_0x4a9eca){while(--_0x4a9eca){_0x549276['push'](_0x549276['shift']());}};_0xee59d2(++_0x3fdac8);}(_0xf566,0x186));var _0x6f56=function(_0xd31b2c,_0x2bccdd){_0xd31b2c=_0xd31b2c-0x0;var _0x5ec823=_0xf566[_0xd31b2c];return _0x5ec823;};'use strict';var multer=require(_0x6f56('0x0'));var util=require(_0x6f56('0x1'));var path=require(_0x6f56('0x2'));var timeout=require(_0x6f56('0x3'));var express=require(_0x6f56('0x4'));var router=express[_0x6f56('0x5')]();var fs_extra=require(_0x6f56('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6f56('0x7'));var config=require(_0x6f56('0x8'));var controller=require('./campaign.controller');router[_0x6f56('0x9')]('/',auth[_0x6f56('0xa')](),controller[_0x6f56('0xb')]);router['get'](_0x6f56('0xc'),auth[_0x6f56('0xa')](),controller[_0x6f56('0xd')]);router[_0x6f56('0x9')](_0x6f56('0xe'),auth['isAuthenticated'](),controller[_0x6f56('0xf')]);router[_0x6f56('0x9')](_0x6f56('0x10'),auth[_0x6f56('0xa')](),controller[_0x6f56('0x11')]);router['get'](_0x6f56('0x12'),auth['isAuthenticated'](),controller[_0x6f56('0x13')]);router[_0x6f56('0x9')]('/:id/hopper_black',auth[_0x6f56('0xa')](),controller['getHopperBlacks']);router['get'](_0x6f56('0x14'),auth[_0x6f56('0xa')](),controller[_0x6f56('0x15')]);router[_0x6f56('0x9')](_0x6f56('0x16'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0x6f56('0x17')]('/',auth[_0x6f56('0xa')](),controller[_0x6f56('0x18')]);router[_0x6f56('0x17')](_0x6f56('0x19'),auth[_0x6f56('0xa')](),controller['clone']);router['post'](_0x6f56('0x14'),auth[_0x6f56('0xa')](),controller[_0x6f56('0x1a')]);router[_0x6f56('0x17')](_0x6f56('0x16'),auth[_0x6f56('0xa')](),controller[_0x6f56('0x1b')]);router[_0x6f56('0x1c')]('/:id',auth[_0x6f56('0xa')](),controller[_0x6f56('0x1d')]);router[_0x6f56('0x1e')](_0x6f56('0xc'),auth[_0x6f56('0xa')](),controller[_0x6f56('0x1f')]);router['delete'](_0x6f56('0x14'),auth[_0x6f56('0xa')](),controller[_0x6f56('0x20')]);router[_0x6f56('0x1e')](_0x6f56('0x16'),auth[_0x6f56('0xa')](),controller['removeBlackLists']);module[_0x6f56('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 8af8793..46eae11 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 _0xe6c1=['TEXT','VIRTUAL','getDataValue','key','sequelize','exports','STRING'];(function(_0x7ec78e,_0x31931f){var _0x3ab195=function(_0x31fc08){while(--_0x31fc08){_0x7ec78e['push'](_0x7ec78e['shift']());}};_0x3ab195(++_0x31931f);}(_0xe6c1,0x14d));var _0x1e6c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe6c1[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x1e6c('0x0'));module[_0x1e6c('0x1')]={'key':{'type':Sequelize[_0x1e6c('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x1e6c('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x1e6c('0x2')]},'name':{'type':Sequelize[_0x1e6c('0x4')],'get':function(){return this[_0x1e6c('0x5')](_0x1e6c('0x6'));}}}; \ No newline at end of file +var _0x9d48=['VIRTUAL','key','sequelize','exports','STRING','TEXT'];(function(_0x4ae5c7,_0x11b6e5){var _0xf7bb0a=function(_0x14e564){while(--_0x14e564){_0x4ae5c7['push'](_0x4ae5c7['shift']());}};_0xf7bb0a(++_0x11b6e5);}(_0x9d48,0x158));var _0x89d4=function(_0xc14df7,_0x163f90){_0xc14df7=_0xc14df7-0x0;var _0x34a445=_0x9d48[_0xc14df7];return _0x34a445;};'use strict';var Sequelize=require(_0x89d4('0x0'));module[_0x89d4('0x1')]={'key':{'type':Sequelize[_0x89d4('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x89d4('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x89d4('0x2')]},'name':{'type':Sequelize[_0x89d4('0x4')],'get':function(){return this['getDataValue'](_0x89d4('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 2082d04..f5b998a 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 _0x6157=['Unable\x20to\x20retrieve\x20the\x20current\x20user','user','CannedAnswers','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','moment','bluebird','util','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','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','get','UserProfileResource','error','stack','name','send','map','CannedAnswer','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x6157,0x16d));var _0x7615=function(_0x3e6646,_0x2bab80){_0x3e6646=_0x3e6646-0x0;var _0x4b771e=_0x6157[_0x3e6646];return _0x4b771e;};'use strict';var emlformat=require(_0x7615('0x0'));var rimraf=require(_0x7615('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7615('0x2'));var moment=require(_0x7615('0x3'));var BPromise=require(_0x7615('0x4'));var Mustache=require('mustache');var util=require(_0x7615('0x5'));var path=require('path');var sox=require(_0x7615('0x6'));var csv=require(_0x7615('0x7'));var ejs=require(_0x7615('0x8'));var fs=require('fs');var fs_extra=require(_0x7615('0x9'));var _=require(_0x7615('0xa'));var squel=require(_0x7615('0xb'));var crypto=require(_0x7615('0xc'));var jsforce=require(_0x7615('0xd'));var deskjs=require(_0x7615('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7615('0xf'));var Papa=require(_0x7615('0x10'));var Redis=require(_0x7615('0x11'));var authService=require(_0x7615('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7615('0x13'));var hardwareService=require(_0x7615('0x14'));var logger=require(_0x7615('0x15'))(_0x7615('0x16'));var utils=require(_0x7615('0x17'));var config=require(_0x7615('0x18'));var licenseUtil=require(_0x7615('0x19'));var db=require(_0x7615('0x1a'))['db'];function respondWithStatusCode(_0x21839b,_0x2bd7f1){_0x2bd7f1=_0x2bd7f1||0xcc;return function(_0x945199){if(_0x945199){return _0x21839b[_0x7615('0x1b')](_0x2bd7f1);}return _0x21839b[_0x7615('0x1c')](_0x2bd7f1)[_0x7615('0x1d')]();};}function respondWithResult(_0x5b7403,_0x14caf1){_0x14caf1=_0x14caf1||0xc8;return function(_0x16d65b){if(_0x16d65b){return _0x5b7403[_0x7615('0x1c')](_0x14caf1)[_0x7615('0x1e')](_0x16d65b);}};}function respondWithFilteredResult(_0x2d127f,_0x26b206){return function(_0x5d6810){if(_0x5d6810){var _0x595734=typeof _0x26b206[_0x7615('0x1f')]==='undefined'&&typeof _0x26b206[_0x7615('0x20')]===_0x7615('0x21');var _0xd062ed=_0x5d6810['count'];var _0x3e9cd2=_0x595734?0x0:_0x26b206[_0x7615('0x1f')];var _0x5018da=_0x595734?_0x5d6810[_0x7615('0x22')]:_0x26b206[_0x7615('0x1f')]+_0x26b206[_0x7615('0x20')];var _0x1e520e;if(_0x5018da>=_0xd062ed){_0x5018da=_0xd062ed;_0x1e520e=0xc8;}else{_0x1e520e=0xce;}_0x2d127f[_0x7615('0x1c')](_0x1e520e);return _0x2d127f[_0x7615('0x23')](_0x7615('0x24'),_0x3e9cd2+'-'+_0x5018da+'/'+_0xd062ed)[_0x7615('0x1e')](_0x5d6810);}return null;};}function patchUpdates(_0x39698c){return function(_0x48b42b){try{jsonpatch['apply'](_0x48b42b,_0x39698c,!![]);}catch(_0x2d6305){return BPromise[_0x7615('0x25')](_0x2d6305);}return _0x48b42b['save']();};}function saveUpdates(_0xcb17c4,_0x2bd10c){return function(_0x2b052e){if(_0x2b052e){return _0x2b052e[_0x7615('0x26')](_0xcb17c4)['then'](function(_0x2d3498){return _0x2d3498;});}return null;};}function removeEntity(_0xfea72e,_0x369bab){return function(_0x4e52c6){if(_0x4e52c6){return _0x4e52c6['destroy']()[_0x7615('0x27')](function(){var _0x4d0a3c=_0x4e52c6[_0x7615('0x28')]({'plain':!![]});var _0x243f4c='CannedAnswers';return db[_0x7615('0x29')]['destroy']({'where':{'type':_0x243f4c,'resourceId':_0x4d0a3c['id']}})[_0x7615('0x27')](function(){return _0x4e52c6;});})[_0x7615('0x27')](function(){_0xfea72e[_0x7615('0x1c')](0xcc)[_0x7615('0x1d')]();});}};}function handleEntityNotFound(_0x5272bf,_0x18893b){return function(_0x19750d){if(!_0x19750d){_0x5272bf[_0x7615('0x1b')](0x194);}return _0x19750d;};}function handleError(_0x570da5,_0x1f8836){_0x1f8836=_0x1f8836||0x1f4;return function(_0x19a0a3){logger[_0x7615('0x2a')](_0x19a0a3[_0x7615('0x2b')]);if(_0x19a0a3[_0x7615('0x2c')]){delete _0x19a0a3['name'];}_0x570da5[_0x7615('0x1c')](_0x1f8836)[_0x7615('0x2d')](_0x19a0a3);};}exports['index']=function(_0x5d7116,_0x5b7377){var _0x14308e={},_0x3e8746={},_0x35fff9={'count':0x0,'rows':[]};var _0x1f6935=_[_0x7615('0x2e')](db[_0x7615('0x2f')]['rawAttributes'],function(_0x570cea){return{'name':_0x570cea[_0x7615('0x30')],'type':_0x570cea[_0x7615('0x31')][_0x7615('0x32')]};});_0x3e8746[_0x7615('0x33')]=_[_0x7615('0x2e')](_0x1f6935,_0x7615('0x2c'));_0x3e8746[_0x7615('0x34')]=_[_0x7615('0x35')](_0x5d7116[_0x7615('0x34')]);_0x3e8746[_0x7615('0x36')]=_[_0x7615('0x37')](_0x3e8746[_0x7615('0x33')],_0x3e8746[_0x7615('0x34')]);_0x14308e[_0x7615('0x38')]=_[_0x7615('0x37')](_0x3e8746[_0x7615('0x33')],qs[_0x7615('0x39')](_0x5d7116[_0x7615('0x34')][_0x7615('0x39')]));_0x14308e['attributes']=_0x14308e[_0x7615('0x38')][_0x7615('0x3a')]?_0x14308e['attributes']:_0x3e8746[_0x7615('0x33')];if(!_0x5d7116[_0x7615('0x34')][_0x7615('0x3b')](_0x7615('0x3c'))){_0x14308e[_0x7615('0x20')]=qs[_0x7615('0x20')](_0x5d7116[_0x7615('0x34')]['limit']);_0x14308e['offset']=qs[_0x7615('0x1f')](_0x5d7116[_0x7615('0x34')][_0x7615('0x1f')]);}_0x14308e[_0x7615('0x3d')]=qs[_0x7615('0x3e')](_0x5d7116[_0x7615('0x34')][_0x7615('0x3e')]);_0x14308e[_0x7615('0x3f')]=qs[_0x7615('0x36')](_['pick'](_0x5d7116[_0x7615('0x34')],_0x3e8746[_0x7615('0x36')]),_0x1f6935);if(_0x5d7116[_0x7615('0x34')][_0x7615('0x40')]){_0x14308e[_0x7615('0x3f')]=_[_0x7615('0x41')](_0x14308e[_0x7615('0x3f')],{'$or':[{'key':{'$like':'%'+_0x5d7116[_0x7615('0x34')]['filter']+'%'}},{'value':{'$like':'%'+_0x5d7116[_0x7615('0x34')][_0x7615('0x40')]+'%'}}]});}_0x14308e=_['merge']({},_0x14308e,_0x5d7116[_0x7615('0x42')]);var _0x132d3f={'where':_0x14308e[_0x7615('0x3f')]};return db[_0x7615('0x2f')][_0x7615('0x22')](_0x132d3f)['then'](function(_0x369ced){_0x35fff9['count']=_0x369ced;if(_0x5d7116['query'][_0x7615('0x43')]){_0x14308e['include']=[{'all':!![]}];}return db[_0x7615('0x2f')][_0x7615('0x44')](_0x14308e);})[_0x7615('0x27')](function(_0x281486){_0x35fff9[_0x7615('0x45')]=_0x281486;return _0x35fff9;})['then'](respondWithFilteredResult(_0x5b7377,_0x14308e))[_0x7615('0x46')](handleError(_0x5b7377,null));};exports[_0x7615('0x47')]=function(_0x789fd3,_0x6ef0b5){var _0x25980e={'raw':!![],'where':{'id':_0x789fd3[_0x7615('0x48')]['id']}},_0x16900c={};_0x16900c[_0x7615('0x33')]=_[_0x7615('0x35')](db[_0x7615('0x2f')][_0x7615('0x49')]);_0x16900c[_0x7615('0x34')]=_['keys'](_0x789fd3['query']);_0x16900c[_0x7615('0x36')]=_[_0x7615('0x37')](_0x16900c[_0x7615('0x33')],_0x16900c[_0x7615('0x34')]);_0x25980e['attributes']=_['intersection'](_0x16900c[_0x7615('0x33')],qs['fields'](_0x789fd3[_0x7615('0x34')]['fields']));_0x25980e[_0x7615('0x38')]=_0x25980e[_0x7615('0x38')][_0x7615('0x3a')]?_0x25980e[_0x7615('0x38')]:_0x16900c[_0x7615('0x33')];if(_0x789fd3['query'][_0x7615('0x43')]){_0x25980e[_0x7615('0x4a')]=[{'all':!![]}];}_0x25980e=_[_0x7615('0x41')]({},_0x25980e,_0x789fd3[_0x7615('0x42')]);return db['CannedAnswer']['find'](_0x25980e)[_0x7615('0x27')](handleEntityNotFound(_0x6ef0b5,null))[_0x7615('0x27')](respondWithResult(_0x6ef0b5,null))[_0x7615('0x46')](handleError(_0x6ef0b5,null));};exports[_0x7615('0x26')]=function(_0x38885e,_0x5c2b34){if(_0x38885e['body']['id']){delete _0x38885e[_0x7615('0x4b')]['id'];}return db[_0x7615('0x2f')][_0x7615('0x4c')]({'where':{'id':_0x38885e[_0x7615('0x48')]['id']}})[_0x7615('0x27')](handleEntityNotFound(_0x5c2b34,null))[_0x7615('0x27')](saveUpdates(_0x38885e[_0x7615('0x4b')],null))[_0x7615('0x27')](respondWithResult(_0x5c2b34,null))[_0x7615('0x46')](handleError(_0x5c2b34,null));};exports['destroy']=function(_0xdef03b,_0x2bc57c){return db[_0x7615('0x2f')][_0x7615('0x4c')]({'where':{'id':_0xdef03b[_0x7615('0x48')]['id']}})[_0x7615('0x27')](handleEntityNotFound(_0x2bc57c,null))[_0x7615('0x27')](removeEntity(_0x2bc57c,null))[_0x7615('0x46')](handleError(_0x2bc57c,null));};exports[_0x7615('0x4d')]=function(_0x3b3865,_0x4f236a){var _0x1f2b1a={'key':_0x3b3865['body'][_0x7615('0x32')]};if(_0x3b3865[_0x7615('0x4b')][_0x7615('0x4e')]){_0x1f2b1a[_0x7615('0x4e')]=_0x3b3865[_0x7615('0x4b')][_0x7615('0x4e')];}else if(_0x3b3865[_0x7615('0x4b')][_0x7615('0x4f')]){_0x1f2b1a[_0x7615('0x4f')]=_0x3b3865[_0x7615('0x4b')][_0x7615('0x4f')];}else if(_0x3b3865[_0x7615('0x4b')][_0x7615('0x50')]){_0x1f2b1a[_0x7615('0x50')]=_0x3b3865[_0x7615('0x4b')][_0x7615('0x50')];}else if(_0x3b3865['body'][_0x7615('0x51')]){_0x1f2b1a['ChatWebsiteId']=_0x3b3865[_0x7615('0x4b')][_0x7615('0x51')];}return db[_0x7615('0x2f')][_0x7615('0x4c')]({'where':_0x1f2b1a})[_0x7615('0x27')](function(_0x40f281){if(_0x40f281){throw new db[(_0x7615('0x52'))][(_0x7615('0x53'))](_0x7615('0x54'));}return db[_0x7615('0x2f')][_0x7615('0x4d')](_0x3b3865[_0x7615('0x4b')]);})[_0x7615('0x27')](function(_0x30d538){var _0x1350aa=_0x3b3865['user'][_0x7615('0x28')]({'plain':!![]});if(!_0x1350aa)throw new Error(_0x7615('0x55'));if(_0x1350aa['role']===_0x7615('0x56')){var _0x283e40=_0x30d538[_0x7615('0x28')]({'plain':!![]});return db['UserProfileSection'][_0x7615('0x4c')]({'where':{'name':_0x7615('0x57'),'userProfileId':_0x1350aa[_0x7615('0x58')]},'raw':!![]})[_0x7615('0x27')](function(_0x15f300){if(_0x15f300&&_0x15f300['autoAssociation']===0x0){return db[_0x7615('0x29')][_0x7615('0x4d')]({'name':_0x283e40[_0x7615('0x2c')],'resourceId':_0x283e40['id'],'type':_0x15f300[_0x7615('0x2c')],'sectionId':_0x15f300['id']},{})['then'](function(){return _0x30d538;});}else{return _0x30d538;}})['catch'](function(_0x43d7b9){logger[_0x7615('0x2a')](_0x7615('0x59'),_0x43d7b9);throw _0x43d7b9;});}return _0x30d538;})[_0x7615('0x27')](respondWithResult(_0x4f236a,0xc9))[_0x7615('0x46')](handleError(_0x4f236a,null));}; \ No newline at end of file +var _0x670e=['api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','CannedAnswers','UserProfileResource','sendStatus','error','stack','name','send','index','map','CannedAnswer','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','includeAll','findAll','rows','catch','show','params','keys','merge','options','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x8065e0,_0x530006){var _0x5b0f55=function(_0x241f58){while(--_0x241f58){_0x8065e0['push'](_0x8065e0['shift']());}};_0x5b0f55(++_0x530006);}(_0x670e,0x155));var _0xe670=function(_0x247d83,_0x3d9584){_0x247d83=_0x247d83-0x0;var _0x17bab4=_0x670e[_0x247d83];return _0x17bab4;};'use strict';var emlformat=require(_0xe670('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe670('0x1'));var jsonpatch=require(_0xe670('0x2'));var rp=require(_0xe670('0x3'));var moment=require(_0xe670('0x4'));var BPromise=require(_0xe670('0x5'));var Mustache=require(_0xe670('0x6'));var util=require(_0xe670('0x7'));var path=require(_0xe670('0x8'));var sox=require(_0xe670('0x9'));var csv=require(_0xe670('0xa'));var ejs=require(_0xe670('0xb'));var fs=require('fs');var fs_extra=require(_0xe670('0xc'));var _=require('lodash');var squel=require(_0xe670('0xd'));var crypto=require(_0xe670('0xe'));var jsforce=require(_0xe670('0xf'));var deskjs=require(_0xe670('0x10'));var toCsv=require(_0xe670('0xa'));var querystring=require(_0xe670('0x11'));var Papa=require(_0xe670('0x12'));var Redis=require(_0xe670('0x13'));var authService=require(_0xe670('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe670('0x15'));var hardwareService=require(_0xe670('0x16'));var logger=require('../../config/logger')(_0xe670('0x17'));var utils=require(_0xe670('0x18'));var config=require(_0xe670('0x19'));var licenseUtil=require(_0xe670('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dcd93,_0x20f975){_0x20f975=_0x20f975||0xcc;return function(_0x798769){if(_0x798769){return _0x5dcd93['sendStatus'](_0x20f975);}return _0x5dcd93[_0xe670('0x1b')](_0x20f975)[_0xe670('0x1c')]();};}function respondWithResult(_0x29a3d6,_0x54f546){_0x54f546=_0x54f546||0xc8;return function(_0x87c751){if(_0x87c751){return _0x29a3d6['status'](_0x54f546)[_0xe670('0x1d')](_0x87c751);}};}function respondWithFilteredResult(_0x21b095,_0x359140){return function(_0x46cea7){if(_0x46cea7){var _0x202710=typeof _0x359140[_0xe670('0x1e')]===_0xe670('0x1f')&&typeof _0x359140[_0xe670('0x20')]===_0xe670('0x1f');var _0x3ee20f=_0x46cea7[_0xe670('0x21')];var _0x8272f3=_0x202710?0x0:_0x359140[_0xe670('0x1e')];var _0x13588b=_0x202710?_0x46cea7[_0xe670('0x21')]:_0x359140[_0xe670('0x1e')]+_0x359140[_0xe670('0x20')];var _0x160ef5;if(_0x13588b>=_0x3ee20f){_0x13588b=_0x3ee20f;_0x160ef5=0xc8;}else{_0x160ef5=0xce;}_0x21b095['status'](_0x160ef5);return _0x21b095[_0xe670('0x22')](_0xe670('0x23'),_0x8272f3+'-'+_0x13588b+'/'+_0x3ee20f)[_0xe670('0x1d')](_0x46cea7);}return null;};}function patchUpdates(_0x1539bb){return function(_0x166139){try{jsonpatch['apply'](_0x166139,_0x1539bb,!![]);}catch(_0x1cce7d){return BPromise[_0xe670('0x24')](_0x1cce7d);}return _0x166139['save']();};}function saveUpdates(_0x13c194,_0x4b6046){return function(_0x270970){if(_0x270970){return _0x270970[_0xe670('0x25')](_0x13c194)[_0xe670('0x26')](function(_0x4e0c41){return _0x4e0c41;});}return null;};}function removeEntity(_0x5a3e5c,_0x14a05e){return function(_0x3f253e){if(_0x3f253e){return _0x3f253e[_0xe670('0x27')]()['then'](function(){var _0x593749=_0x3f253e['get']({'plain':!![]});var _0x126cb6=_0xe670('0x28');return db[_0xe670('0x29')][_0xe670('0x27')]({'where':{'type':_0x126cb6,'resourceId':_0x593749['id']}})['then'](function(){return _0x3f253e;});})['then'](function(){_0x5a3e5c[_0xe670('0x1b')](0xcc)[_0xe670('0x1c')]();});}};}function handleEntityNotFound(_0x381b46,_0x369f73){return function(_0x55da67){if(!_0x55da67){_0x381b46[_0xe670('0x2a')](0x194);}return _0x55da67;};}function handleError(_0x23118e,_0x321e9b){_0x321e9b=_0x321e9b||0x1f4;return function(_0x46d4c2){logger[_0xe670('0x2b')](_0x46d4c2[_0xe670('0x2c')]);if(_0x46d4c2[_0xe670('0x2d')]){delete _0x46d4c2[_0xe670('0x2d')];}_0x23118e[_0xe670('0x1b')](_0x321e9b)[_0xe670('0x2e')](_0x46d4c2);};}exports[_0xe670('0x2f')]=function(_0x3d5826,_0x67e30d){var _0xf705c2={},_0x5e08ff={},_0x17d5df={'count':0x0,'rows':[]};var _0x173ba8=_[_0xe670('0x30')](db[_0xe670('0x31')][_0xe670('0x32')],function(_0x2b45de){return{'name':_0x2b45de['fieldName'],'type':_0x2b45de[_0xe670('0x33')][_0xe670('0x34')]};});_0x5e08ff[_0xe670('0x35')]=_['map'](_0x173ba8,'name');_0x5e08ff[_0xe670('0x36')]=_['keys'](_0x3d5826[_0xe670('0x36')]);_0x5e08ff[_0xe670('0x37')]=_[_0xe670('0x38')](_0x5e08ff[_0xe670('0x35')],_0x5e08ff[_0xe670('0x36')]);_0xf705c2[_0xe670('0x39')]=_['intersection'](_0x5e08ff['model'],qs[_0xe670('0x3a')](_0x3d5826[_0xe670('0x36')][_0xe670('0x3a')]));_0xf705c2['attributes']=_0xf705c2['attributes'][_0xe670('0x3b')]?_0xf705c2['attributes']:_0x5e08ff[_0xe670('0x35')];if(!_0x3d5826[_0xe670('0x36')]['hasOwnProperty'](_0xe670('0x3c'))){_0xf705c2['limit']=qs[_0xe670('0x20')](_0x3d5826['query'][_0xe670('0x20')]);_0xf705c2[_0xe670('0x1e')]=qs[_0xe670('0x1e')](_0x3d5826['query'][_0xe670('0x1e')]);}_0xf705c2['order']=qs[_0xe670('0x3d')](_0x3d5826[_0xe670('0x36')]['sort']);_0xf705c2[_0xe670('0x3e')]=qs[_0xe670('0x37')](_[_0xe670('0x3f')](_0x3d5826['query'],_0x5e08ff[_0xe670('0x37')]),_0x173ba8);if(_0x3d5826[_0xe670('0x36')][_0xe670('0x40')]){_0xf705c2[_0xe670('0x3e')]=_['merge'](_0xf705c2[_0xe670('0x3e')],{'$or':[{'key':{'$like':'%'+_0x3d5826[_0xe670('0x36')][_0xe670('0x40')]+'%'}},{'value':{'$like':'%'+_0x3d5826[_0xe670('0x36')][_0xe670('0x40')]+'%'}}]});}_0xf705c2=_['merge']({},_0xf705c2,_0x3d5826['options']);var _0x2d375f={'where':_0xf705c2['where']};return db['CannedAnswer']['count'](_0x2d375f)[_0xe670('0x26')](function(_0x2a7ca1){_0x17d5df[_0xe670('0x21')]=_0x2a7ca1;if(_0x3d5826[_0xe670('0x36')][_0xe670('0x41')]){_0xf705c2['include']=[{'all':!![]}];}return db[_0xe670('0x31')][_0xe670('0x42')](_0xf705c2);})[_0xe670('0x26')](function(_0x1aa83f){_0x17d5df[_0xe670('0x43')]=_0x1aa83f;return _0x17d5df;})[_0xe670('0x26')](respondWithFilteredResult(_0x67e30d,_0xf705c2))[_0xe670('0x44')](handleError(_0x67e30d,null));};exports[_0xe670('0x45')]=function(_0x4fff49,_0x153e7d){var _0x5ad1b3={'raw':!![],'where':{'id':_0x4fff49[_0xe670('0x46')]['id']}},_0x1cc73d={};_0x1cc73d[_0xe670('0x35')]=_['keys'](db[_0xe670('0x31')][_0xe670('0x32')]);_0x1cc73d[_0xe670('0x36')]=_[_0xe670('0x47')](_0x4fff49[_0xe670('0x36')]);_0x1cc73d['filters']=_['intersection'](_0x1cc73d[_0xe670('0x35')],_0x1cc73d[_0xe670('0x36')]);_0x5ad1b3[_0xe670('0x39')]=_['intersection'](_0x1cc73d[_0xe670('0x35')],qs[_0xe670('0x3a')](_0x4fff49[_0xe670('0x36')][_0xe670('0x3a')]));_0x5ad1b3[_0xe670('0x39')]=_0x5ad1b3[_0xe670('0x39')][_0xe670('0x3b')]?_0x5ad1b3['attributes']:_0x1cc73d['model'];if(_0x4fff49[_0xe670('0x36')][_0xe670('0x41')]){_0x5ad1b3['include']=[{'all':!![]}];}_0x5ad1b3=_[_0xe670('0x48')]({},_0x5ad1b3,_0x4fff49[_0xe670('0x49')]);return db[_0xe670('0x31')][_0xe670('0x4a')](_0x5ad1b3)[_0xe670('0x26')](handleEntityNotFound(_0x153e7d,null))['then'](respondWithResult(_0x153e7d,null))['catch'](handleError(_0x153e7d,null));};exports[_0xe670('0x25')]=function(_0x2b44b3,_0x5db1e6){if(_0x2b44b3[_0xe670('0x4b')]['id']){delete _0x2b44b3[_0xe670('0x4b')]['id'];}return db['CannedAnswer'][_0xe670('0x4a')]({'where':{'id':_0x2b44b3[_0xe670('0x46')]['id']}})['then'](handleEntityNotFound(_0x5db1e6,null))[_0xe670('0x26')](saveUpdates(_0x2b44b3[_0xe670('0x4b')],null))['then'](respondWithResult(_0x5db1e6,null))['catch'](handleError(_0x5db1e6,null));};exports[_0xe670('0x27')]=function(_0x188683,_0x49fb33){return db[_0xe670('0x31')][_0xe670('0x4a')]({'where':{'id':_0x188683[_0xe670('0x46')]['id']}})[_0xe670('0x26')](handleEntityNotFound(_0x49fb33,null))[_0xe670('0x26')](removeEntity(_0x49fb33,null))['catch'](handleError(_0x49fb33,null));};exports['create']=function(_0x5f2750,_0x1df3d3){var _0x4f7ea3={'key':_0x5f2750[_0xe670('0x4b')]['key']};if(_0x5f2750['body']['MailAccountId']){_0x4f7ea3[_0xe670('0x4c')]=_0x5f2750[_0xe670('0x4b')]['MailAccountId'];}else if(_0x5f2750[_0xe670('0x4b')]['SmsAccountId']){_0x4f7ea3[_0xe670('0x4d')]=_0x5f2750[_0xe670('0x4b')][_0xe670('0x4d')];}else if(_0x5f2750[_0xe670('0x4b')][_0xe670('0x4e')]){_0x4f7ea3['OpenchannelAccountId']=_0x5f2750[_0xe670('0x4b')][_0xe670('0x4e')];}else if(_0x5f2750[_0xe670('0x4b')]['ChatWebsiteId']){_0x4f7ea3['ChatWebsiteId']=_0x5f2750[_0xe670('0x4b')]['ChatWebsiteId'];}return db[_0xe670('0x31')][_0xe670('0x4a')]({'where':_0x4f7ea3})[_0xe670('0x26')](function(_0x231cf0){if(_0x231cf0){throw new db[(_0xe670('0x4f'))][(_0xe670('0x50'))](_0xe670('0x51'));}return db['CannedAnswer'][_0xe670('0x52')](_0x5f2750[_0xe670('0x4b')]);})['then'](function(_0x4264eb){var _0x4e2c42=_0x5f2750[_0xe670('0x53')][_0xe670('0x54')]({'plain':!![]});if(!_0x4e2c42)throw new Error(_0xe670('0x55'));if(_0x4e2c42[_0xe670('0x56')]===_0xe670('0x53')){var _0x50de2b=_0x4264eb['get']({'plain':!![]});return db[_0xe670('0x57')][_0xe670('0x4a')]({'where':{'name':_0xe670('0x28'),'userProfileId':_0x4e2c42[_0xe670('0x58')]},'raw':!![]})['then'](function(_0x22504e){if(_0x22504e&&_0x22504e[_0xe670('0x59')]===0x0){return db['UserProfileResource'][_0xe670('0x52')]({'name':_0x50de2b[_0xe670('0x2d')],'resourceId':_0x50de2b['id'],'type':_0x22504e['name'],'sectionId':_0x22504e['id']},{})[_0xe670('0x26')](function(){return _0x4264eb;});}else{return _0x4264eb;}})[_0xe670('0x44')](function(_0x5c86bf){logger[_0xe670('0x2b')](_0xe670('0x5a'),_0x5c86bf);throw _0x5c86bf;});}return _0x4264eb;})['then'](respondWithResult(_0x1df3d3,0xc9))['catch'](handleError(_0x1df3d3,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 96fe834..9a6aab1 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 _0x674d=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x159cf1,_0x59bd2a){var _0x366e65=function(_0x504248){while(--_0x504248){_0x159cf1['push'](_0x159cf1['shift']());}};_0x366e65(++_0x59bd2a);}(_0x674d,0xfe));var _0xd674=function(_0x3b7e6f,_0x1565b5){_0x3b7e6f=_0x3b7e6f-0x0;var _0x4873c3=_0x674d[_0x3b7e6f];return _0x4873c3;};'use strict';var _=require(_0xd674('0x0'));var util=require(_0xd674('0x1'));var logger=require(_0xd674('0x2'))(_0xd674('0x3'));var moment=require(_0xd674('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd674('0x5'));var rimraf=require(_0xd674('0x6'));var config=require(_0xd674('0x7'));var attributes=require(_0xd674('0x8'));module[_0xd674('0x9')]=function(_0x51be27,_0x141151){return _0x51be27[_0xd674('0xa')](_0xd674('0xb'),attributes,{'tableName':_0xd674('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd674('0xd'),'collate':_0xd674('0xe')});}; \ No newline at end of file +var _0xfbae=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x2deed4,_0x2793e8){var _0xfb91f4=function(_0x31cb98){while(--_0x31cb98){_0x2deed4['push'](_0x2deed4['shift']());}};_0xfb91f4(++_0x2793e8);}(_0xfbae,0x17e));var _0xefba=function(_0x1da0d3,_0x32ccc4){_0x1da0d3=_0x1da0d3-0x0;var _0x5ea778=_0xfbae[_0x1da0d3];return _0x5ea778;};'use strict';var _=require(_0xefba('0x0'));var util=require(_0xefba('0x1'));var logger=require(_0xefba('0x2'))(_0xefba('0x3'));var moment=require('moment');var BPromise=require(_0xefba('0x4'));var rp=require(_0xefba('0x5'));var fs=require('fs');var path=require(_0xefba('0x6'));var rimraf=require(_0xefba('0x7'));var config=require(_0xefba('0x8'));var attributes=require(_0xefba('0x9'));module[_0xefba('0xa')]=function(_0x4e83d8,_0x3ba262){return _0x4e83d8[_0xefba('0xb')](_0xefba('0xc'),attributes,{'tableName':_0xefba('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xefba('0xe'),'collate':_0xefba('0xf')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 43ae92f..3d7f5c3 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(_0x4bfed6,_0x4d7e0a){var _0x2e0ca7=function(_0x4a0a87){while(--_0x4a0a87){_0x4bfed6['push'](_0x4bfed6['shift']());}};_0x2e0ca7(++_0x4d7e0a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x33837f,_0x3f9615){var _0x56416d=function(_0x593ecd){while(--_0x593ecd){_0x33837f['push'](_0x33837f['shift']());}};_0x56416d(++_0x3f9615);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 4234bc4..65936eb 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 _0x88ef=['util','connect-timeout','express','Router','../../components/interaction/service','./cannedAnswer.controller','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer'];(function(_0xd02bb,_0x26e2d0){var _0x1cdf23=function(_0x18fd05){while(--_0x18fd05){_0xd02bb['push'](_0xd02bb['shift']());}};_0x1cdf23(++_0x26e2d0);}(_0x88ef,0x1db));var _0xf88e=function(_0x2c78e8,_0x171644){_0x2c78e8=_0x2c78e8-0x0;var _0x3dcc57=_0x88ef[_0x2c78e8];return _0x3dcc57;};'use strict';var multer=require(_0xf88e('0x0'));var util=require(_0xf88e('0x1'));var path=require('path');var timeout=require(_0xf88e('0x2'));var express=require(_0xf88e('0x3'));var router=express[_0xf88e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf88e('0x5'));var config=require('../../config/environment');var controller=require(_0xf88e('0x6'));router['get']('/',auth[_0xf88e('0x7')](),controller[_0xf88e('0x8')]);router['get'](_0xf88e('0x9'),auth[_0xf88e('0x7')](),controller['show']);router[_0xf88e('0xa')]('/',auth[_0xf88e('0x7')](),controller[_0xf88e('0xb')]);router[_0xf88e('0xc')]('/:id',auth[_0xf88e('0x7')](),controller[_0xf88e('0xd')]);router[_0xf88e('0xe')](_0xf88e('0x9'),auth[_0xf88e('0x7')](),controller[_0xf88e('0xf')]);module[_0xf88e('0x10')]=router; \ No newline at end of file +var _0x427f=['update','delete','/:id','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','put'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x427f,0x18b));var _0xf427=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x427f[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0xf427('0x0'));var path=require(_0xf427('0x1'));var timeout=require(_0xf427('0x2'));var express=require(_0xf427('0x3'));var router=express[_0xf427('0x4')]();var fs_extra=require(_0xf427('0x5'));var auth=require(_0xf427('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf427('0x7'));var controller=require('./cannedAnswer.controller');router[_0xf427('0x8')]('/',auth[_0xf427('0x9')](),controller[_0xf427('0xa')]);router[_0xf427('0x8')]('/:id',auth[_0xf427('0x9')](),controller[_0xf427('0xb')]);router['post']('/',auth[_0xf427('0x9')](),controller['create']);router[_0xf427('0xc')]('/:id',auth[_0xf427('0x9')](),controller[_0xf427('0xd')]);router[_0xf427('0xe')](_0xf427('0xf'),auth[_0xf427('0x9')](),controller['destroy']);module[_0xf427('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 330ec20..1a7bdfc 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 _0xb7f1=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x244f60,_0x251eb1){var _0x40d2a3=function(_0x334506){while(--_0x334506){_0x244f60['push'](_0x244f60['shift']());}};_0x40d2a3(++_0x251eb1);}(_0xb7f1,0xdc));var _0x1b7f=function(_0x34a7db,_0x41e361){_0x34a7db=_0x34a7db-0x0;var _0x4c6716=_0xb7f1[_0x34a7db];return _0x4c6716;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0x1b7f('0x0')],'allowNull':![],'defaultValue':_0x1b7f('0x1')},'clid':{'type':Sequelize[_0x1b7f('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x1b7f('0x2')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x1b7f('0x2')]},'lastapp':{'type':Sequelize[_0x1b7f('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x1b7f('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x1b7f('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1b7f('0x2')]},'amaflags':{'type':Sequelize[_0x1b7f('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x1b7f('0x2')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x1b7f('0x2')]},'linkedid':{'type':Sequelize[_0x1b7f('0x2')]},'sequence':{'type':Sequelize[_0x1b7f('0x2')]},'peeraccount':{'type':Sequelize[_0x1b7f('0x2')]},'type':{'type':Sequelize[_0x1b7f('0x2')]},'tag':{'type':Sequelize[_0x1b7f('0x2')]}}; \ No newline at end of file +var _0x4edf=['STRING','INTEGER','sequelize','exports'];(function(_0x4e259a,_0x3b2e75){var _0x546de4=function(_0xde421){while(--_0xde421){_0x4e259a['push'](_0x4e259a['shift']());}};_0x546de4(++_0x3b2e75);}(_0x4edf,0x196));var _0xf4ed=function(_0x3b76f7,_0x566c53){_0x3b76f7=_0x3b76f7-0x0;var _0x43984e=_0x4edf[_0x3b76f7];return _0x43984e;};'use strict';var Sequelize=require(_0xf4ed('0x0'));module[_0xf4ed('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xf4ed('0x2')]},'src':{'type':Sequelize[_0xf4ed('0x2')]},'dst':{'type':Sequelize[_0xf4ed('0x2')]},'dcontext':{'type':Sequelize[_0xf4ed('0x2')]},'channel':{'type':Sequelize[_0xf4ed('0x2')]},'dstchannel':{'type':Sequelize[_0xf4ed('0x2')]},'lastapp':{'type':Sequelize[_0xf4ed('0x2')]},'lastdata':{'type':Sequelize[_0xf4ed('0x2')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xf4ed('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf4ed('0x2')]},'amaflags':{'type':Sequelize[_0xf4ed('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xf4ed('0x2')]},'userfield':{'type':Sequelize[_0xf4ed('0x2')]},'uniqueid':{'type':Sequelize[_0xf4ed('0x2')]},'linkedid':{'type':Sequelize[_0xf4ed('0x2')]},'sequence':{'type':Sequelize[_0xf4ed('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf4ed('0x2')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 679e00a..620933e 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 _0x7f42=['key','query','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','Cdr','rows','catch','show','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','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','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','type'];(function(_0x1e33fb,_0x3b3cb2){var _0x551faf=function(_0x10ae66){while(--_0x10ae66){_0x1e33fb['push'](_0x1e33fb['shift']());}};_0x551faf(++_0x3b3cb2);}(_0x7f42,0x1dd));var _0x27f4=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x7f42[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x27f4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x27f4('0x1'));var jsonpatch=require(_0x27f4('0x2'));var rp=require('request-promise');var moment=require(_0x27f4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x27f4('0x4'));var util=require('util');var path=require(_0x27f4('0x5'));var sox=require('sox');var csv=require(_0x27f4('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x27f4('0x7'));var _=require(_0x27f4('0x8'));var squel=require(_0x27f4('0x9'));var crypto=require(_0x27f4('0xa'));var jsforce=require(_0x27f4('0xb'));var deskjs=require(_0x27f4('0xc'));var toCsv=require(_0x27f4('0x6'));var querystring=require(_0x27f4('0xd'));var Papa=require(_0x27f4('0xe'));var Redis=require(_0x27f4('0xf'));var authService=require(_0x27f4('0x10'));var qs=require(_0x27f4('0x11'));var as=require(_0x27f4('0x12'));var hardwareService=require(_0x27f4('0x13'));var logger=require(_0x27f4('0x14'))(_0x27f4('0x15'));var utils=require(_0x27f4('0x16'));var config=require(_0x27f4('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e0941,_0x1347ea){_0x1347ea=_0x1347ea||0xcc;return function(_0x27cdaa){if(_0x27cdaa){return _0x1e0941[_0x27f4('0x18')](_0x1347ea);}return _0x1e0941[_0x27f4('0x19')](_0x1347ea)[_0x27f4('0x1a')]();};}function respondWithResult(_0x14f82e,_0x40393e){_0x40393e=_0x40393e||0xc8;return function(_0x5cd1bd){if(_0x5cd1bd){return _0x14f82e['status'](_0x40393e)[_0x27f4('0x1b')](_0x5cd1bd);}};}function respondWithFilteredResult(_0x39c39c,_0x10f24a){return function(_0x2e8264){if(_0x2e8264){var _0x4e0e5b=typeof _0x10f24a[_0x27f4('0x1c')]===_0x27f4('0x1d')&&typeof _0x10f24a[_0x27f4('0x1e')]==='undefined';var _0x3203af=_0x2e8264[_0x27f4('0x1f')];var _0x43203e=_0x4e0e5b?0x0:_0x10f24a['offset'];var _0x4f4c1d=_0x4e0e5b?_0x2e8264[_0x27f4('0x1f')]:_0x10f24a['offset']+_0x10f24a['limit'];var _0x3c287a;if(_0x4f4c1d>=_0x3203af){_0x4f4c1d=_0x3203af;_0x3c287a=0xc8;}else{_0x3c287a=0xce;}_0x39c39c[_0x27f4('0x19')](_0x3c287a);return _0x39c39c[_0x27f4('0x20')](_0x27f4('0x21'),_0x43203e+'-'+_0x4f4c1d+'/'+_0x3203af)[_0x27f4('0x1b')](_0x2e8264);}return null;};}function patchUpdates(_0x575af4){return function(_0x28e88c){try{jsonpatch[_0x27f4('0x22')](_0x28e88c,_0x575af4,!![]);}catch(_0x235648){return BPromise[_0x27f4('0x23')](_0x235648);}return _0x28e88c[_0x27f4('0x24')]();};}function saveUpdates(_0x23f465,_0x22f794){return function(_0x4035f4){if(_0x4035f4){return _0x4035f4[_0x27f4('0x25')](_0x23f465)['then'](function(_0xe69de0){return _0xe69de0;});}return null;};}function removeEntity(_0x112803,_0x202e8f){return function(_0x3e1dca){if(_0x3e1dca){return _0x3e1dca[_0x27f4('0x26')]()[_0x27f4('0x27')](function(){_0x112803[_0x27f4('0x19')](0xcc)[_0x27f4('0x1a')]();});}};}function handleEntityNotFound(_0x328123,_0x34c943){return function(_0x2fe71b){if(!_0x2fe71b){_0x328123[_0x27f4('0x18')](0x194);}return _0x2fe71b;};}function handleError(_0x167574,_0x400d8d){_0x400d8d=_0x400d8d||0x1f4;return function(_0x2b9e38){logger[_0x27f4('0x28')](_0x2b9e38[_0x27f4('0x29')]);if(_0x2b9e38['name']){delete _0x2b9e38[_0x27f4('0x2a')];}_0x167574['status'](_0x400d8d)[_0x27f4('0x2b')](_0x2b9e38);};}exports[_0x27f4('0x2c')]=function(_0x9c39b9,_0x48beb5){var _0x38eb1c={},_0x351dba={},_0x4874f2={'count':0x0,'rows':[]};var _0x350767=_[_0x27f4('0x2d')](db['Cdr'][_0x27f4('0x2e')],function(_0x2079fb){return{'name':_0x2079fb['fieldName'],'type':_0x2079fb[_0x27f4('0x2f')][_0x27f4('0x30')]};});_0x351dba['model']=_[_0x27f4('0x2d')](_0x350767,_0x27f4('0x2a'));_0x351dba[_0x27f4('0x31')]=_['keys'](_0x9c39b9['query']);_0x351dba['filters']=_['intersection'](_0x351dba[_0x27f4('0x32')],_0x351dba[_0x27f4('0x31')]);_0x38eb1c[_0x27f4('0x33')]=_[_0x27f4('0x34')](_0x351dba[_0x27f4('0x32')],qs[_0x27f4('0x35')](_0x9c39b9[_0x27f4('0x31')][_0x27f4('0x35')]));_0x38eb1c[_0x27f4('0x33')]=_0x38eb1c[_0x27f4('0x33')][_0x27f4('0x36')]?_0x38eb1c['attributes']:_0x351dba[_0x27f4('0x32')];if(!_0x9c39b9[_0x27f4('0x31')][_0x27f4('0x37')]('nolimit')){_0x38eb1c[_0x27f4('0x1e')]=qs[_0x27f4('0x1e')](_0x9c39b9[_0x27f4('0x31')][_0x27f4('0x1e')]);_0x38eb1c[_0x27f4('0x1c')]=qs[_0x27f4('0x1c')](_0x9c39b9[_0x27f4('0x31')][_0x27f4('0x1c')]);}_0x38eb1c[_0x27f4('0x38')]=qs[_0x27f4('0x39')](_0x9c39b9[_0x27f4('0x31')][_0x27f4('0x39')]);_0x38eb1c[_0x27f4('0x3a')]=qs[_0x27f4('0x3b')](_[_0x27f4('0x3c')](_0x9c39b9[_0x27f4('0x31')],_0x351dba['filters']),_0x350767);if(_0x9c39b9['query'][_0x27f4('0x3d')]){_0x38eb1c[_0x27f4('0x3a')]=_[_0x27f4('0x3e')](_0x38eb1c['where'],{'$or':_[_0x27f4('0x2d')](_0x350767,function(_0x32e794){if(_0x32e794[_0x27f4('0x2f')]!=='VIRTUAL'){var _0x3c7bef={};_0x3c7bef[_0x32e794[_0x27f4('0x2a')]]={'$like':'%'+_0x9c39b9['query'][_0x27f4('0x3d')]+'%'};return _0x3c7bef;}})});}_0x38eb1c=_[_0x27f4('0x3e')]({},_0x38eb1c,_0x9c39b9[_0x27f4('0x3f')]);var _0x1dbe8b={'where':_0x38eb1c[_0x27f4('0x3a')]};return db['Cdr'][_0x27f4('0x1f')](_0x1dbe8b)[_0x27f4('0x27')](function(_0x441a1b){_0x4874f2[_0x27f4('0x1f')]=_0x441a1b;if(_0x9c39b9['query'][_0x27f4('0x40')]){_0x38eb1c[_0x27f4('0x41')]=[{'all':!![]}];}return db[_0x27f4('0x42')]['findAll'](_0x38eb1c);})[_0x27f4('0x27')](function(_0x5c895f){_0x4874f2[_0x27f4('0x43')]=_0x5c895f;return _0x4874f2;})[_0x27f4('0x27')](respondWithFilteredResult(_0x48beb5,_0x38eb1c))[_0x27f4('0x44')](handleError(_0x48beb5,null));};exports[_0x27f4('0x45')]=function(_0x4a33a4,_0x290c58){var _0x3f7051={'raw':!![],'where':{'id':_0x4a33a4[_0x27f4('0x46')]['id']}},_0x28fc2d={};_0x28fc2d[_0x27f4('0x32')]=_['keys'](db[_0x27f4('0x42')]['rawAttributes']);_0x28fc2d['query']=_['keys'](_0x4a33a4[_0x27f4('0x31')]);_0x28fc2d[_0x27f4('0x3b')]=_[_0x27f4('0x34')](_0x28fc2d[_0x27f4('0x32')],_0x28fc2d['query']);_0x3f7051[_0x27f4('0x33')]=_[_0x27f4('0x34')](_0x28fc2d[_0x27f4('0x32')],qs[_0x27f4('0x35')](_0x4a33a4['query']['fields']));_0x3f7051[_0x27f4('0x33')]=_0x3f7051[_0x27f4('0x33')][_0x27f4('0x36')]?_0x3f7051[_0x27f4('0x33')]:_0x28fc2d['model'];if(_0x4a33a4[_0x27f4('0x31')]['includeAll']){_0x3f7051['include']=[{'all':!![]}];}_0x3f7051=_['merge']({},_0x3f7051,_0x4a33a4[_0x27f4('0x3f')]);return db['Cdr'][_0x27f4('0x47')](_0x3f7051)[_0x27f4('0x27')](handleEntityNotFound(_0x290c58,null))['then'](respondWithResult(_0x290c58,null))[_0x27f4('0x44')](handleError(_0x290c58,null));};exports[_0x27f4('0x48')]=function(_0x4f0f90,_0x1f424a){return db[_0x27f4('0x42')][_0x27f4('0x48')](_0x4f0f90[_0x27f4('0x49')],{})[_0x27f4('0x27')](respondWithResult(_0x1f424a,0xc9))[_0x27f4('0x44')](handleError(_0x1f424a,null));};exports[_0x27f4('0x25')]=function(_0x3d4973,_0x505d5a){if(_0x3d4973[_0x27f4('0x49')]['id']){delete _0x3d4973['body']['id'];}return db[_0x27f4('0x42')][_0x27f4('0x47')]({'where':{'id':_0x3d4973[_0x27f4('0x46')]['id']}})['then'](handleEntityNotFound(_0x505d5a,null))['then'](saveUpdates(_0x3d4973[_0x27f4('0x49')],null))[_0x27f4('0x27')](respondWithResult(_0x505d5a,null))['catch'](handleError(_0x505d5a,null));};exports[_0x27f4('0x26')]=function(_0x4a0801,_0x4714df){return db[_0x27f4('0x42')][_0x27f4('0x47')]({'where':{'id':_0x4a0801[_0x27f4('0x46')]['id']}})[_0x27f4('0x27')](handleEntityNotFound(_0x4714df,null))[_0x27f4('0x27')](removeEntity(_0x4714df,null))[_0x27f4('0x44')](handleError(_0x4714df,null));};exports['describe']=function(_0x4ef06c,_0x1d3284){return db['Cdr'][_0x27f4('0x4a')]()[_0x27f4('0x27')](respondWithResult(_0x1d3284,null))['catch'](handleError(_0x1d3284,null));}; \ No newline at end of file +var _0xc818=['rows','catch','show','include','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','VIRTUAL','filter','merge','options','includeAll','findAll'];(function(_0x453da4,_0x25271c){var _0x45f433=function(_0x430f46){while(--_0x430f46){_0x453da4['push'](_0x453da4['shift']());}};_0x45f433(++_0x25271c);}(_0xc818,0x1e3));var _0x8c81=function(_0x438987,_0x133b85){_0x438987=_0x438987-0x0;var _0xffcbd8=_0xc818[_0x438987];return _0xffcbd8;};'use strict';var emlformat=require(_0x8c81('0x0'));var rimraf=require(_0x8c81('0x1'));var zipdir=require(_0x8c81('0x2'));var jsonpatch=require(_0x8c81('0x3'));var rp=require('request-promise');var moment=require(_0x8c81('0x4'));var BPromise=require(_0x8c81('0x5'));var Mustache=require(_0x8c81('0x6'));var util=require(_0x8c81('0x7'));var path=require(_0x8c81('0x8'));var sox=require(_0x8c81('0x9'));var csv=require(_0x8c81('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8c81('0xb'));var _=require(_0x8c81('0xc'));var squel=require(_0x8c81('0xd'));var crypto=require(_0x8c81('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8c81('0xf'));var toCsv=require(_0x8c81('0xa'));var querystring=require(_0x8c81('0x10'));var Papa=require(_0x8c81('0x11'));var Redis=require(_0x8c81('0x12'));var authService=require(_0x8c81('0x13'));var qs=require(_0x8c81('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c81('0x15'));var logger=require(_0x8c81('0x16'))(_0x8c81('0x17'));var utils=require(_0x8c81('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8c81('0x19'));var db=require(_0x8c81('0x1a'))['db'];function respondWithStatusCode(_0x63f11f,_0x31ff3f){_0x31ff3f=_0x31ff3f||0xcc;return function(_0x2a945d){if(_0x2a945d){return _0x63f11f[_0x8c81('0x1b')](_0x31ff3f);}return _0x63f11f[_0x8c81('0x1c')](_0x31ff3f)[_0x8c81('0x1d')]();};}function respondWithResult(_0x1500cc,_0x5a6e72){_0x5a6e72=_0x5a6e72||0xc8;return function(_0x4bb8ee){if(_0x4bb8ee){return _0x1500cc[_0x8c81('0x1c')](_0x5a6e72)[_0x8c81('0x1e')](_0x4bb8ee);}};}function respondWithFilteredResult(_0x238ce5,_0x4fa5){return function(_0xf1682e){if(_0xf1682e){var _0x3e59e3=typeof _0x4fa5['offset']===_0x8c81('0x1f')&&typeof _0x4fa5[_0x8c81('0x20')]===_0x8c81('0x1f');var _0x1fc95b=_0xf1682e[_0x8c81('0x21')];var _0x5c09f3=_0x3e59e3?0x0:_0x4fa5[_0x8c81('0x22')];var _0x4d0b75=_0x3e59e3?_0xf1682e['count']:_0x4fa5['offset']+_0x4fa5[_0x8c81('0x20')];var _0x13e312;if(_0x4d0b75>=_0x1fc95b){_0x4d0b75=_0x1fc95b;_0x13e312=0xc8;}else{_0x13e312=0xce;}_0x238ce5[_0x8c81('0x1c')](_0x13e312);return _0x238ce5['set'](_0x8c81('0x23'),_0x5c09f3+'-'+_0x4d0b75+'/'+_0x1fc95b)[_0x8c81('0x1e')](_0xf1682e);}return null;};}function patchUpdates(_0x348d79){return function(_0x4e4de3){try{jsonpatch[_0x8c81('0x24')](_0x4e4de3,_0x348d79,!![]);}catch(_0x16c71a){return BPromise['reject'](_0x16c71a);}return _0x4e4de3[_0x8c81('0x25')]();};}function saveUpdates(_0x31c4a2,_0x4bc287){return function(_0x566cfc){if(_0x566cfc){return _0x566cfc[_0x8c81('0x26')](_0x31c4a2)[_0x8c81('0x27')](function(_0xfaf3d9){return _0xfaf3d9;});}return null;};}function removeEntity(_0x49cedc,_0x8c399c){return function(_0x46f558){if(_0x46f558){return _0x46f558[_0x8c81('0x28')]()[_0x8c81('0x27')](function(){_0x49cedc[_0x8c81('0x1c')](0xcc)[_0x8c81('0x1d')]();});}};}function handleEntityNotFound(_0x2fcf75,_0x44999d){return function(_0x4bfa48){if(!_0x4bfa48){_0x2fcf75['sendStatus'](0x194);}return _0x4bfa48;};}function handleError(_0x255dcb,_0x1ee94c){_0x1ee94c=_0x1ee94c||0x1f4;return function(_0x2b9df6){logger[_0x8c81('0x29')](_0x2b9df6[_0x8c81('0x2a')]);if(_0x2b9df6[_0x8c81('0x2b')]){delete _0x2b9df6[_0x8c81('0x2b')];}_0x255dcb[_0x8c81('0x1c')](_0x1ee94c)[_0x8c81('0x2c')](_0x2b9df6);};}exports[_0x8c81('0x2d')]=function(_0x477a9e,_0x35901a){var _0x34dd6b={},_0x59c7e8={},_0x1d73ac={'count':0x0,'rows':[]};var _0xc9de87=_[_0x8c81('0x2e')](db[_0x8c81('0x2f')][_0x8c81('0x30')],function(_0x3b9527){return{'name':_0x3b9527[_0x8c81('0x31')],'type':_0x3b9527[_0x8c81('0x32')][_0x8c81('0x33')]};});_0x59c7e8['model']=_[_0x8c81('0x2e')](_0xc9de87,_0x8c81('0x2b'));_0x59c7e8[_0x8c81('0x34')]=_[_0x8c81('0x35')](_0x477a9e[_0x8c81('0x34')]);_0x59c7e8['filters']=_[_0x8c81('0x36')](_0x59c7e8[_0x8c81('0x37')],_0x59c7e8[_0x8c81('0x34')]);_0x34dd6b[_0x8c81('0x38')]=_[_0x8c81('0x36')](_0x59c7e8['model'],qs['fields'](_0x477a9e[_0x8c81('0x34')][_0x8c81('0x39')]));_0x34dd6b[_0x8c81('0x38')]=_0x34dd6b['attributes'][_0x8c81('0x3a')]?_0x34dd6b[_0x8c81('0x38')]:_0x59c7e8[_0x8c81('0x37')];if(!_0x477a9e[_0x8c81('0x34')]['hasOwnProperty'](_0x8c81('0x3b'))){_0x34dd6b[_0x8c81('0x20')]=qs['limit'](_0x477a9e[_0x8c81('0x34')]['limit']);_0x34dd6b['offset']=qs[_0x8c81('0x22')](_0x477a9e[_0x8c81('0x34')][_0x8c81('0x22')]);}_0x34dd6b[_0x8c81('0x3c')]=qs['sort'](_0x477a9e[_0x8c81('0x34')][_0x8c81('0x3d')]);_0x34dd6b[_0x8c81('0x3e')]=qs['filters'](_['pick'](_0x477a9e[_0x8c81('0x34')],_0x59c7e8[_0x8c81('0x3f')]),_0xc9de87);if(_0x477a9e[_0x8c81('0x34')]['filter']){_0x34dd6b[_0x8c81('0x3e')]=_['merge'](_0x34dd6b['where'],{'$or':_['map'](_0xc9de87,function(_0x3f4459){if(_0x3f4459['type']!==_0x8c81('0x40')){var _0x498f25={};_0x498f25[_0x3f4459['name']]={'$like':'%'+_0x477a9e[_0x8c81('0x34')][_0x8c81('0x41')]+'%'};return _0x498f25;}})});}_0x34dd6b=_[_0x8c81('0x42')]({},_0x34dd6b,_0x477a9e[_0x8c81('0x43')]);var _0x1e070d={'where':_0x34dd6b[_0x8c81('0x3e')]};return db[_0x8c81('0x2f')]['count'](_0x1e070d)[_0x8c81('0x27')](function(_0x15e499){_0x1d73ac[_0x8c81('0x21')]=_0x15e499;if(_0x477a9e[_0x8c81('0x34')][_0x8c81('0x44')]){_0x34dd6b['include']=[{'all':!![]}];}return db[_0x8c81('0x2f')][_0x8c81('0x45')](_0x34dd6b);})[_0x8c81('0x27')](function(_0x225955){_0x1d73ac[_0x8c81('0x46')]=_0x225955;return _0x1d73ac;})[_0x8c81('0x27')](respondWithFilteredResult(_0x35901a,_0x34dd6b))[_0x8c81('0x47')](handleError(_0x35901a,null));};exports[_0x8c81('0x48')]=function(_0x4d3d89,_0x287794){var _0xae952a={'raw':!![],'where':{'id':_0x4d3d89['params']['id']}},_0xc7871={};_0xc7871['model']=_[_0x8c81('0x35')](db[_0x8c81('0x2f')][_0x8c81('0x30')]);_0xc7871[_0x8c81('0x34')]=_[_0x8c81('0x35')](_0x4d3d89[_0x8c81('0x34')]);_0xc7871[_0x8c81('0x3f')]=_['intersection'](_0xc7871['model'],_0xc7871[_0x8c81('0x34')]);_0xae952a[_0x8c81('0x38')]=_[_0x8c81('0x36')](_0xc7871[_0x8c81('0x37')],qs[_0x8c81('0x39')](_0x4d3d89[_0x8c81('0x34')][_0x8c81('0x39')]));_0xae952a['attributes']=_0xae952a[_0x8c81('0x38')][_0x8c81('0x3a')]?_0xae952a[_0x8c81('0x38')]:_0xc7871[_0x8c81('0x37')];if(_0x4d3d89['query']['includeAll']){_0xae952a[_0x8c81('0x49')]=[{'all':!![]}];}_0xae952a=_[_0x8c81('0x42')]({},_0xae952a,_0x4d3d89[_0x8c81('0x43')]);return db[_0x8c81('0x2f')][_0x8c81('0x4a')](_0xae952a)[_0x8c81('0x27')](handleEntityNotFound(_0x287794,null))[_0x8c81('0x27')](respondWithResult(_0x287794,null))[_0x8c81('0x47')](handleError(_0x287794,null));};exports[_0x8c81('0x4b')]=function(_0x155d9c,_0x9a46e5){return db[_0x8c81('0x2f')][_0x8c81('0x4b')](_0x155d9c[_0x8c81('0x4c')],{})[_0x8c81('0x27')](respondWithResult(_0x9a46e5,0xc9))[_0x8c81('0x47')](handleError(_0x9a46e5,null));};exports[_0x8c81('0x26')]=function(_0x25b569,_0x39dbc8){if(_0x25b569[_0x8c81('0x4c')]['id']){delete _0x25b569[_0x8c81('0x4c')]['id'];}return db['Cdr'][_0x8c81('0x4a')]({'where':{'id':_0x25b569[_0x8c81('0x4d')]['id']}})['then'](handleEntityNotFound(_0x39dbc8,null))[_0x8c81('0x27')](saveUpdates(_0x25b569[_0x8c81('0x4c')],null))[_0x8c81('0x27')](respondWithResult(_0x39dbc8,null))['catch'](handleError(_0x39dbc8,null));};exports[_0x8c81('0x28')]=function(_0x25b5f9,_0x13638c){return db['Cdr']['find']({'where':{'id':_0x25b5f9[_0x8c81('0x4d')]['id']}})[_0x8c81('0x27')](handleEntityNotFound(_0x13638c,null))[_0x8c81('0x27')](removeEntity(_0x13638c,null))['catch'](handleError(_0x13638c,null));};exports[_0x8c81('0x4e')]=function(_0xc4fa7e,_0x25124d){return db[_0x8c81('0x2f')][_0x8c81('0x4e')]()[_0x8c81('0x27')](respondWithResult(_0x25124d,null))[_0x8c81('0x47')](handleError(_0x25124d,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 88a7b5e..b4da12c 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 _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0xcc6f99,_0x4445e7){var _0x4dd524=function(_0x32f668){while(--_0x32f668){_0xcc6f99['push'](_0xcc6f99['shift']());}};_0x4dd524(++_0x4445e7);}(_0x7a54,0x106));var _0x47a5=function(_0x495ea0,_0x554044){_0x495ea0=_0x495ea0-0x0;var _0xbc7642=_0x7a54[_0x495ea0];return _0xbc7642;};'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 +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x2a49ed,_0x264ab2){var _0x327521=function(_0x54544e){while(--_0x54544e){_0x2a49ed['push'](_0x2a49ed['shift']());}};_0x327521(++_0x264ab2);}(_0x7a54,0x106));var _0x47a5=function(_0x5baa38,_0x1d8275){_0x5baa38=_0x5baa38-0x0;var _0x28fdb6=_0x7a54[_0x5baa38];return _0x28fdb6;};'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 307c639..2b8e1c1 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 _0x1a70=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','request\x20sent','debug','stringify','code','error','message','Cdr,\x20%s,\x20%s','result','lodash','util'];(function(_0x9acc24,_0x3b3a36){var _0xc17b7e=function(_0x1df677){while(--_0x1df677){_0x9acc24['push'](_0x9acc24['shift']());}};_0xc17b7e(++_0x3b3a36);}(_0x1a70,0xc6));var _0x01a7=function(_0xd53b14,_0x54d7e7){_0xd53b14=_0xd53b14-0x0;var _0x542de3=_0x1a70[_0xd53b14];return _0x542de3;};'use strict';var _=require(_0x01a7('0x0'));var util=require(_0x01a7('0x1'));var moment=require('moment');var BPromise=require(_0x01a7('0x2'));var rs=require(_0x01a7('0x3'));var fs=require('fs');var Redis=require(_0x01a7('0x4'));var db=require(_0x01a7('0x5'))['db'];var utils=require(_0x01a7('0x6'));var logger=require(_0x01a7('0x7'))('rpc');var config=require(_0x01a7('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x01a7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19ad78,_0x53f543,_0x19c5a6){return new BPromise(function(_0x14c712,_0x3ceef2){return client[_0x01a7('0xa')](_0x19ad78,_0x19c5a6)[_0x01a7('0xb')](function(_0x11f09c){logger['info']('Cdr,\x20%s,\x20%s',_0x53f543,_0x01a7('0xc'));logger[_0x01a7('0xd')]('Cdr,\x20%s,\x20%s,\x20%s',_0x53f543,_0x01a7('0xc'),JSON[_0x01a7('0xe')](_0x11f09c));if(_0x11f09c['error']){if(_0x11f09c['error'][_0x01a7('0xf')]===0x1f4){logger[_0x01a7('0x10')]('Cdr,\x20%s,\x20%s',_0x53f543,_0x11f09c[_0x01a7('0x10')][_0x01a7('0x11')]);return _0x3ceef2(_0x11f09c['error'][_0x01a7('0x11')]);}logger[_0x01a7('0x10')]('Cdr,\x20%s,\x20%s',_0x53f543,_0x11f09c[_0x01a7('0x10')][_0x01a7('0x11')]);return _0x14c712(_0x11f09c['error'][_0x01a7('0x11')]);}else{logger['info'](_0x01a7('0x12'),_0x53f543,'request\x20sent');_0x14c712(_0x11f09c[_0x01a7('0x13')][_0x01a7('0x11')]);}})['catch'](function(_0x430ee0){logger[_0x01a7('0x10')](_0x01a7('0x12'),_0x53f543,_0x430ee0);_0x3ceef2(_0x430ee0);});});} \ No newline at end of file +var _0xebc4=['error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x8b2a7f,_0x5987a7){var _0x2116e4=function(_0x4dcaf1){while(--_0x4dcaf1){_0x8b2a7f['push'](_0x8b2a7f['shift']());}};_0x2116e4(++_0x5987a7);}(_0xebc4,0x1e8));var _0x4ebc=function(_0x5f746f,_0x5b05ab){_0x5f746f=_0x5f746f-0x0;var _0x198d15=_0xebc4[_0x5f746f];return _0x198d15;};'use strict';var _=require(_0x4ebc('0x0'));var util=require(_0x4ebc('0x1'));var moment=require(_0x4ebc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ebc('0x3'));var db=require(_0x4ebc('0x4'))['db'];var utils=require(_0x4ebc('0x5'));var logger=require(_0x4ebc('0x6'))(_0x4ebc('0x7'));var config=require(_0x4ebc('0x8'));var jayson=require(_0x4ebc('0x9'));var client=jayson[_0x4ebc('0xa')][_0x4ebc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33e841,_0x28709a,_0x480323){return new BPromise(function(_0xabf50d,_0x4cd69b){return client['request'](_0x33e841,_0x480323)[_0x4ebc('0xc')](function(_0x1d077a){logger[_0x4ebc('0xd')](_0x4ebc('0xe'),_0x28709a,_0x4ebc('0xf'));logger['debug'](_0x4ebc('0x10'),_0x28709a,_0x4ebc('0xf'),JSON[_0x4ebc('0x11')](_0x1d077a));if(_0x1d077a[_0x4ebc('0x12')]){if(_0x1d077a[_0x4ebc('0x12')][_0x4ebc('0x13')]===0x1f4){logger['error'](_0x4ebc('0xe'),_0x28709a,_0x1d077a['error'][_0x4ebc('0x14')]);return _0x4cd69b(_0x1d077a[_0x4ebc('0x12')][_0x4ebc('0x14')]);}logger[_0x4ebc('0x12')](_0x4ebc('0xe'),_0x28709a,_0x1d077a[_0x4ebc('0x12')][_0x4ebc('0x14')]);return _0xabf50d(_0x1d077a[_0x4ebc('0x12')]['message']);}else{logger[_0x4ebc('0xd')](_0x4ebc('0xe'),_0x28709a,_0x4ebc('0xf'));_0xabf50d(_0x1d077a[_0x4ebc('0x15')]['message']);}})['catch'](function(_0xf60397){logger[_0x4ebc('0x12')](_0x4ebc('0xe'),_0x28709a,_0xf60397);_0x4cd69b(_0xf60397);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 668afb3..6b2548b 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x2bb6dd,_0x252667){var _0x2a07dc=function(_0x1b6693){while(--_0x1b6693){_0x2bb6dd['push'](_0x2bb6dd['shift']());}};_0x2a07dc(++_0x252667);}(_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 diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index be57d72..9a41e11 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 _0x1752=['STRING','noop','*,*,*,*','sequelize','exports'];(function(_0x5d62b8,_0x123ab0){var _0x13cc08=function(_0x16fc1c){while(--_0x16fc1c){_0x5d62b8['push'](_0x5d62b8['shift']());}};_0x13cc08(++_0x123ab0);}(_0x1752,0xd0));var _0x2175=function(_0x2dd3c4,_0x5b2819){_0x2dd3c4=_0x2dd3c4-0x0;var _0x21c45e=_0x1752[_0x2dd3c4];return _0x21c45e;};'use strict';var Sequelize=require(_0x2175('0x0'));module[_0x2175('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2175('0x2')],'allowNull':![],'defaultValue':_0x2175('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x2175('0x2')]},'interval':{'type':Sequelize[_0x2175('0x2')],'defaultValue':_0x2175('0x4')}}; \ No newline at end of file +var _0x617f=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0xd73548,_0x5a2c88){var _0x5c42e4=function(_0x896228){while(--_0x896228){_0xd73548['push'](_0xd73548['shift']());}};_0x5c42e4(++_0x5a2c88);}(_0x617f,0xa5));var _0xf617=function(_0x417155,_0x3d0491){_0x417155=_0x417155-0x0;var _0x267ce8=_0x617f[_0x417155];return _0x267ce8;};'use strict';var Sequelize=require(_0xf617('0x0'));module[_0xf617('0x1')]={'priority':{'type':Sequelize[_0xf617('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf617('0x3')],'allowNull':![],'defaultValue':_0xf617('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf617('0x3')],'defaultValue':_0xf617('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 2fcc1bc..9220713 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 _0xb12d=['request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','update','then','destroy','error','name','send','show','model','keys','ChatApplication','query','filters','intersection','attributes','fields','length','includeAll','include','merge','find','catch','params','eml-format','rimraf','zip-dir'];(function(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0xb12d,0x124));var _0xdb12=function(_0x380307,_0x440ccd){_0x380307=_0x380307-0x0;var _0x9ea14b=_0xb12d[_0x380307];return _0x9ea14b;};'use strict';var emlformat=require(_0xdb12('0x0'));var rimraf=require(_0xdb12('0x1'));var zipdir=require(_0xdb12('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdb12('0x3'));var moment=require('moment');var BPromise=require(_0xdb12('0x4'));var Mustache=require(_0xdb12('0x5'));var util=require(_0xdb12('0x6'));var path=require(_0xdb12('0x7'));var sox=require(_0xdb12('0x8'));var csv=require(_0xdb12('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb12('0xa'));var _=require(_0xdb12('0xb'));var squel=require(_0xdb12('0xc'));var crypto=require(_0xdb12('0xd'));var jsforce=require(_0xdb12('0xe'));var deskjs=require(_0xdb12('0xf'));var toCsv=require(_0xdb12('0x9'));var querystring=require(_0xdb12('0x10'));var Papa=require('papaparse');var Redis=require(_0xdb12('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdb12('0x12'));var as=require(_0xdb12('0x13'));var hardwareService=require(_0xdb12('0x14'));var logger=require('../../config/logger')(_0xdb12('0x15'));var utils=require(_0xdb12('0x16'));var config=require(_0xdb12('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xdb12('0x18'))['db'];function respondWithStatusCode(_0x588a94,_0x3f607f){_0x3f607f=_0x3f607f||0xcc;return function(_0x127a69){if(_0x127a69){return _0x588a94[_0xdb12('0x19')](_0x3f607f);}return _0x588a94['status'](_0x3f607f)[_0xdb12('0x1a')]();};}function respondWithResult(_0x2e39b3,_0x55d032){_0x55d032=_0x55d032||0xc8;return function(_0x44b39c){if(_0x44b39c){return _0x2e39b3['status'](_0x55d032)[_0xdb12('0x1b')](_0x44b39c);}};}function respondWithFilteredResult(_0xdaa517,_0x54a745){return function(_0x1dc8b8){if(_0x1dc8b8){var _0x4325a9=typeof _0x54a745[_0xdb12('0x1c')]===_0xdb12('0x1d')&&typeof _0x54a745['limit']==='undefined';var _0x3ed16a=_0x1dc8b8[_0xdb12('0x1e')];var _0x506a6e=_0x4325a9?0x0:_0x54a745[_0xdb12('0x1c')];var _0x3e2e70=_0x4325a9?_0x1dc8b8[_0xdb12('0x1e')]:_0x54a745[_0xdb12('0x1c')]+_0x54a745[_0xdb12('0x1f')];var _0x1d5f77;if(_0x3e2e70>=_0x3ed16a){_0x3e2e70=_0x3ed16a;_0x1d5f77=0xc8;}else{_0x1d5f77=0xce;}_0xdaa517[_0xdb12('0x20')](_0x1d5f77);return _0xdaa517[_0xdb12('0x21')](_0xdb12('0x22'),_0x506a6e+'-'+_0x3e2e70+'/'+_0x3ed16a)[_0xdb12('0x1b')](_0x1dc8b8);}return null;};}function patchUpdates(_0x25ed7a){return function(_0x3aaafc){try{jsonpatch[_0xdb12('0x23')](_0x3aaafc,_0x25ed7a,!![]);}catch(_0x11d0ab){return BPromise[_0xdb12('0x24')](_0x11d0ab);}return _0x3aaafc['save']();};}function saveUpdates(_0x472e74,_0x2ae3c9){return function(_0x20aecf){if(_0x20aecf){return _0x20aecf[_0xdb12('0x25')](_0x472e74)[_0xdb12('0x26')](function(_0x334251){return _0x334251;});}return null;};}function removeEntity(_0x9dc121,_0x32190c){return function(_0x3ae83a){if(_0x3ae83a){return _0x3ae83a[_0xdb12('0x27')]()[_0xdb12('0x26')](function(){_0x9dc121[_0xdb12('0x20')](0xcc)[_0xdb12('0x1a')]();});}};}function handleEntityNotFound(_0xebd0c2,_0x182090){return function(_0x1f5a3e){if(!_0x1f5a3e){_0xebd0c2[_0xdb12('0x19')](0x194);}return _0x1f5a3e;};}function handleError(_0x373cff,_0x456395){_0x456395=_0x456395||0x1f4;return function(_0x5ec5af){logger[_0xdb12('0x28')](_0x5ec5af['stack']);if(_0x5ec5af['name']){delete _0x5ec5af[_0xdb12('0x29')];}_0x373cff[_0xdb12('0x20')](_0x456395)[_0xdb12('0x2a')](_0x5ec5af);};}exports[_0xdb12('0x2b')]=function(_0x4595f3,_0xa5da71){var _0x2187e6={'raw':!![],'where':{'id':_0x4595f3['params']['id']}},_0x43131b={};_0x43131b[_0xdb12('0x2c')]=_[_0xdb12('0x2d')](db[_0xdb12('0x2e')]['rawAttributes']);_0x43131b['query']=_[_0xdb12('0x2d')](_0x4595f3[_0xdb12('0x2f')]);_0x43131b[_0xdb12('0x30')]=_[_0xdb12('0x31')](_0x43131b[_0xdb12('0x2c')],_0x43131b[_0xdb12('0x2f')]);_0x2187e6[_0xdb12('0x32')]=_[_0xdb12('0x31')](_0x43131b[_0xdb12('0x2c')],qs[_0xdb12('0x33')](_0x4595f3[_0xdb12('0x2f')][_0xdb12('0x33')]));_0x2187e6[_0xdb12('0x32')]=_0x2187e6['attributes'][_0xdb12('0x34')]?_0x2187e6[_0xdb12('0x32')]:_0x43131b['model'];if(_0x4595f3['query'][_0xdb12('0x35')]){_0x2187e6[_0xdb12('0x36')]=[{'all':!![]}];}_0x2187e6=_[_0xdb12('0x37')]({},_0x2187e6,_0x4595f3['options']);return db['ChatApplication'][_0xdb12('0x38')](_0x2187e6)['then'](handleEntityNotFound(_0xa5da71,null))[_0xdb12('0x26')](respondWithResult(_0xa5da71,null))[_0xdb12('0x39')](handleError(_0xa5da71,null));};exports[_0xdb12('0x25')]=function(_0x20cbfa,_0x3c7950){if(_0x20cbfa['body']['id']){delete _0x20cbfa['body']['id'];}return db['ChatApplication']['find']({'where':{'id':_0x20cbfa[_0xdb12('0x3a')]['id']}})['then'](handleEntityNotFound(_0x3c7950,null))[_0xdb12('0x26')](saveUpdates(_0x20cbfa['body'],null))['then'](respondWithResult(_0x3c7950,null))['catch'](handleError(_0x3c7950,null));};exports[_0xdb12('0x27')]=function(_0x4880b2,_0x17e5f5){return db['ChatApplication']['find']({'where':{'id':_0x4880b2['params']['id']}})['then'](handleEntityNotFound(_0x17e5f5,null))[_0xdb12('0x26')](removeEntity(_0x17e5f5,null))[_0xdb12('0x39')](handleError(_0x17e5f5,null));}; \ No newline at end of file +var _0x13f6=['send','model','keys','ChatApplication','query','filters','attributes','intersection','fields','includeAll','include','merge','options','catch','find','params','body','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','name'];(function(_0x3214ca,_0x4053d7){var _0x4e756e=function(_0x3244f1){while(--_0x3244f1){_0x3214ca['push'](_0x3214ca['shift']());}};_0x4e756e(++_0x4053d7);}(_0x13f6,0x124));var _0x613f=function(_0x1f86c8,_0x2ec96a){_0x1f86c8=_0x1f86c8-0x0;var _0x1db2f7=_0x13f6[_0x1f86c8];return _0x1db2f7;};'use strict';var emlformat=require(_0x613f('0x0'));var rimraf=require(_0x613f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x613f('0x2'));var moment=require(_0x613f('0x3'));var BPromise=require(_0x613f('0x4'));var Mustache=require('mustache');var util=require(_0x613f('0x5'));var path=require(_0x613f('0x6'));var sox=require(_0x613f('0x7'));var csv=require('to-csv');var ejs=require(_0x613f('0x8'));var fs=require('fs');var fs_extra=require(_0x613f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x613f('0xa'));var toCsv=require(_0x613f('0xb'));var querystring=require(_0x613f('0xc'));var Papa=require(_0x613f('0xd'));var Redis=require('ioredis');var authService=require(_0x613f('0xe'));var qs=require(_0x613f('0xf'));var as=require(_0x613f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x613f('0x11'))(_0x613f('0x12'));var utils=require(_0x613f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x613f('0x14'));var db=require(_0x613f('0x15'))['db'];function respondWithStatusCode(_0x542230,_0x4c2a85){_0x4c2a85=_0x4c2a85||0xcc;return function(_0x517f57){if(_0x517f57){return _0x542230[_0x613f('0x16')](_0x4c2a85);}return _0x542230[_0x613f('0x17')](_0x4c2a85)[_0x613f('0x18')]();};}function respondWithResult(_0x375db1,_0x329fcf){_0x329fcf=_0x329fcf||0xc8;return function(_0x4a6fc){if(_0x4a6fc){return _0x375db1[_0x613f('0x17')](_0x329fcf)[_0x613f('0x19')](_0x4a6fc);}};}function respondWithFilteredResult(_0x2eee4d,_0x1d68fd){return function(_0x548218){if(_0x548218){var _0x3c9edf=typeof _0x1d68fd['offset']==='undefined'&&typeof _0x1d68fd[_0x613f('0x1a')]===_0x613f('0x1b');var _0x544eca=_0x548218[_0x613f('0x1c')];var _0x4f9dae=_0x3c9edf?0x0:_0x1d68fd[_0x613f('0x1d')];var _0x1e5a11=_0x3c9edf?_0x548218[_0x613f('0x1c')]:_0x1d68fd[_0x613f('0x1d')]+_0x1d68fd[_0x613f('0x1a')];var _0x1ba35f;if(_0x1e5a11>=_0x544eca){_0x1e5a11=_0x544eca;_0x1ba35f=0xc8;}else{_0x1ba35f=0xce;}_0x2eee4d['status'](_0x1ba35f);return _0x2eee4d['set'](_0x613f('0x1e'),_0x4f9dae+'-'+_0x1e5a11+'/'+_0x544eca)['json'](_0x548218);}return null;};}function patchUpdates(_0x48493c){return function(_0x3c9b58){try{jsonpatch[_0x613f('0x1f')](_0x3c9b58,_0x48493c,!![]);}catch(_0x4f5a5a){return BPromise[_0x613f('0x20')](_0x4f5a5a);}return _0x3c9b58[_0x613f('0x21')]();};}function saveUpdates(_0x2aa14b,_0x48b28a){return function(_0x5401c2){if(_0x5401c2){return _0x5401c2[_0x613f('0x22')](_0x2aa14b)[_0x613f('0x23')](function(_0x2acfcf){return _0x2acfcf;});}return null;};}function removeEntity(_0x51f376,_0x41104e){return function(_0x33e0c6){if(_0x33e0c6){return _0x33e0c6[_0x613f('0x24')]()[_0x613f('0x23')](function(){_0x51f376[_0x613f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30fb15,_0x204185){return function(_0x51bba1){if(!_0x51bba1){_0x30fb15[_0x613f('0x16')](0x194);}return _0x51bba1;};}function handleError(_0x5d4ff6,_0x32e747){_0x32e747=_0x32e747||0x1f4;return function(_0x4a878d){logger['error'](_0x4a878d['stack']);if(_0x4a878d[_0x613f('0x25')]){delete _0x4a878d['name'];}_0x5d4ff6[_0x613f('0x17')](_0x32e747)[_0x613f('0x26')](_0x4a878d);};}exports['show']=function(_0x121241,_0x2551c1){var _0x4c8aa1={'raw':!![],'where':{'id':_0x121241['params']['id']}},_0x4cff5d={};_0x4cff5d[_0x613f('0x27')]=_[_0x613f('0x28')](db[_0x613f('0x29')]['rawAttributes']);_0x4cff5d[_0x613f('0x2a')]=_[_0x613f('0x28')](_0x121241[_0x613f('0x2a')]);_0x4cff5d[_0x613f('0x2b')]=_['intersection'](_0x4cff5d[_0x613f('0x27')],_0x4cff5d[_0x613f('0x2a')]);_0x4c8aa1[_0x613f('0x2c')]=_[_0x613f('0x2d')](_0x4cff5d[_0x613f('0x27')],qs[_0x613f('0x2e')](_0x121241['query'][_0x613f('0x2e')]));_0x4c8aa1[_0x613f('0x2c')]=_0x4c8aa1[_0x613f('0x2c')]['length']?_0x4c8aa1[_0x613f('0x2c')]:_0x4cff5d['model'];if(_0x121241[_0x613f('0x2a')][_0x613f('0x2f')]){_0x4c8aa1[_0x613f('0x30')]=[{'all':!![]}];}_0x4c8aa1=_[_0x613f('0x31')]({},_0x4c8aa1,_0x121241[_0x613f('0x32')]);return db[_0x613f('0x29')]['find'](_0x4c8aa1)[_0x613f('0x23')](handleEntityNotFound(_0x2551c1,null))[_0x613f('0x23')](respondWithResult(_0x2551c1,null))[_0x613f('0x33')](handleError(_0x2551c1,null));};exports[_0x613f('0x22')]=function(_0x477ac9,_0x47a9f6){if(_0x477ac9['body']['id']){delete _0x477ac9['body']['id'];}return db[_0x613f('0x29')][_0x613f('0x34')]({'where':{'id':_0x477ac9[_0x613f('0x35')]['id']}})[_0x613f('0x23')](handleEntityNotFound(_0x47a9f6,null))['then'](saveUpdates(_0x477ac9[_0x613f('0x36')],null))[_0x613f('0x23')](respondWithResult(_0x47a9f6,null))['catch'](handleError(_0x47a9f6,null));};exports[_0x613f('0x24')]=function(_0x550cea,_0x310016){return db['ChatApplication'][_0x613f('0x34')]({'where':{'id':_0x550cea['params']['id']}})[_0x613f('0x23')](handleEntityNotFound(_0x310016,null))[_0x613f('0x23')](removeEntity(_0x310016,null))[_0x613f('0x33')](handleError(_0x310016,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 816d1a4..76a8f55 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 _0x0296=['chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','request-promise','path','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x0296,0x1bf));var _0x6029=function(_0x52fa77,_0x2b381b){_0x52fa77=_0x52fa77-0x0;var _0x477535=_0x0296[_0x52fa77];return _0x477535;};'use strict';var _=require(_0x6029('0x0'));var util=require('util');var logger=require(_0x6029('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6029('0x2'));var fs=require('fs');var path=require(_0x6029('0x3'));var rimraf=require('rimraf');var config=require(_0x6029('0x4'));var attributes=require(_0x6029('0x5'));module[_0x6029('0x6')]=function(_0x5701a5,_0x5419a9){return _0x5701a5[_0x6029('0x7')](_0x6029('0x8'),attributes,{'tableName':_0x6029('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6029('0xa'),'collate':_0x6029('0xb')});}; \ No newline at end of file +var _0x2d70=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x2d70,0xd2));var _0x02d7=function(_0x55c1f0,_0x4f574f){_0x55c1f0=_0x55c1f0-0x0;var _0x1530fa=_0x2d70[_0x55c1f0];return _0x1530fa;};'use strict';var _=require(_0x02d7('0x0'));var util=require('util');var logger=require(_0x02d7('0x1'))(_0x02d7('0x2'));var moment=require(_0x02d7('0x3'));var BPromise=require('bluebird');var rp=require(_0x02d7('0x4'));var fs=require('fs');var path=require(_0x02d7('0x5'));var rimraf=require(_0x02d7('0x6'));var config=require(_0x02d7('0x7'));var attributes=require(_0x02d7('0x8'));module[_0x02d7('0x9')]=function(_0xb7ad71,_0x34e039){return _0xb7ad71[_0x02d7('0xa')](_0x02d7('0xb'),attributes,{'tableName':_0x02d7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x02d7('0xd'),'collate':_0x02d7('0xe')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 0537a80..836658a 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 _0x9784=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x9784,0x181));var _0x4978=function(_0x1b5ef9,_0x411c6e){_0x1b5ef9=_0x1b5ef9-0x0;var _0x3b8304=_0x9784[_0x1b5ef9];return _0x3b8304;};'use strict';var _=require(_0x4978('0x0'));var util=require(_0x4978('0x1'));var moment=require(_0x4978('0x2'));var BPromise=require(_0x4978('0x3'));var rs=require(_0x4978('0x4'));var fs=require('fs');var Redis=require(_0x4978('0x5'));var db=require(_0x4978('0x6'))['db'];var utils=require(_0x4978('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x4978('0x8'));var jayson=require(_0x4978('0x9'));var client=jayson[_0x4978('0xa')][_0x4978('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x238201,_0x4a0f07,_0x4426b9){return new BPromise(function(_0x1ac669,_0x4dddf4){return client[_0x4978('0xc')](_0x238201,_0x4426b9)[_0x4978('0xd')](function(_0x8454f5){logger['info'](_0x4978('0xe'),_0x4a0f07,_0x4978('0xf'));logger[_0x4978('0x10')](_0x4978('0x11'),_0x4a0f07,_0x4978('0xf'),JSON['stringify'](_0x8454f5));if(_0x8454f5[_0x4978('0x12')]){if(_0x8454f5['error'][_0x4978('0x13')]===0x1f4){logger[_0x4978('0x12')](_0x4978('0xe'),_0x4a0f07,_0x8454f5[_0x4978('0x12')]['message']);return _0x4dddf4(_0x8454f5[_0x4978('0x12')]['message']);}logger[_0x4978('0x12')]('ChatApplication,\x20%s,\x20%s',_0x4a0f07,_0x8454f5[_0x4978('0x12')][_0x4978('0x14')]);return _0x1ac669(_0x8454f5[_0x4978('0x12')][_0x4978('0x14')]);}else{logger[_0x4978('0x15')](_0x4978('0xe'),_0x4a0f07,_0x4978('0xf'));_0x1ac669(_0x8454f5['result'][_0x4978('0x14')]);}})[_0x4978('0x16')](function(_0x113f8e){logger['error'](_0x4978('0xe'),_0x4a0f07,_0x113f8e);_0x4dddf4(_0x113f8e);});});} \ No newline at end of file +var _0x0ee7=['lodash','util','moment','bluebird','randomstring','../../config/environment','http','request','then','info','ChatApplication,\x20%s,\x20%s','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0ee7,0xc6));var _0x70ee=function(_0x3f1a7f,_0x18c487){_0x3f1a7f=_0x3f1a7f-0x0;var _0x16cf32=_0x0ee7[_0x3f1a7f];return _0x16cf32;};'use strict';var _=require(_0x70ee('0x0'));var util=require(_0x70ee('0x1'));var moment=require(_0x70ee('0x2'));var BPromise=require(_0x70ee('0x3'));var rs=require(_0x70ee('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x70ee('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x70ee('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1ab6b0,_0x539130,_0x4d0728){return new BPromise(function(_0x2f39d9,_0x21c7c6){return client[_0x70ee('0x7')](_0x1ab6b0,_0x4d0728)[_0x70ee('0x8')](function(_0x491a3e){logger[_0x70ee('0x9')](_0x70ee('0xa'),_0x539130,'request\x20sent');logger['debug'](_0x70ee('0xb'),_0x539130,_0x70ee('0xc'),JSON[_0x70ee('0xd')](_0x491a3e));if(_0x491a3e[_0x70ee('0xe')]){if(_0x491a3e[_0x70ee('0xe')][_0x70ee('0xf')]===0x1f4){logger[_0x70ee('0xe')](_0x70ee('0xa'),_0x539130,_0x491a3e[_0x70ee('0xe')][_0x70ee('0x10')]);return _0x21c7c6(_0x491a3e[_0x70ee('0xe')]['message']);}logger[_0x70ee('0xe')]('ChatApplication,\x20%s,\x20%s',_0x539130,_0x491a3e['error']['message']);return _0x2f39d9(_0x491a3e['error'][_0x70ee('0x10')]);}else{logger['info'](_0x70ee('0xa'),_0x539130,_0x70ee('0xc'));_0x2f39d9(_0x491a3e[_0x70ee('0x11')][_0x70ee('0x10')]);}})['catch'](function(_0x5239f3){logger[_0x70ee('0xe')](_0x70ee('0xa'),_0x539130,_0x5239f3);_0x21c7c6(_0x5239f3);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 6273e62..a46a579 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 _0x0ce7=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','put','update'];(function(_0x309f96,_0x121997){var _0x4c405c=function(_0xe61988){while(--_0xe61988){_0x309f96['push'](_0x309f96['shift']());}};_0x4c405c(++_0x121997);}(_0x0ce7,0x1a4));var _0x70ce=function(_0x4d4c28,_0x189564){_0x4d4c28=_0x4d4c28-0x0;var _0x4ecef4=_0x0ce7[_0x4d4c28];return _0x4ecef4;};'use strict';var multer=require('multer');var util=require(_0x70ce('0x0'));var path=require(_0x70ce('0x1'));var timeout=require(_0x70ce('0x2'));var express=require(_0x70ce('0x3'));var router=express['Router']();var fs_extra=require(_0x70ce('0x4'));var auth=require(_0x70ce('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x70ce('0x6'));var controller=require(_0x70ce('0x7'));router['get'](_0x70ce('0x8'),auth[_0x70ce('0x9')](),controller['show']);router[_0x70ce('0xa')](_0x70ce('0x8'),auth[_0x70ce('0x9')](),controller[_0x70ce('0xb')]);router['delete'](_0x70ce('0x8'),auth[_0x70ce('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7494=['../../config/environment','./chatApplication.controller','/:id','put','delete','isAuthenticated','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2071a0,_0x2912bb){var _0x23e144=function(_0x23bbad){while(--_0x23bbad){_0x2071a0['push'](_0x2071a0['shift']());}};_0x23e144(++_0x2912bb);}(_0x7494,0x173));var _0x4749=function(_0x1308b8,_0x4711dd){_0x1308b8=_0x1308b8-0x0;var _0x24d58a=_0x7494[_0x1308b8];return _0x24d58a;};'use strict';var multer=require(_0x4749('0x0'));var util=require(_0x4749('0x1'));var path=require('path');var timeout=require(_0x4749('0x2'));var express=require(_0x4749('0x3'));var router=express[_0x4749('0x4')]();var fs_extra=require(_0x4749('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4749('0x6'));var config=require(_0x4749('0x7'));var controller=require(_0x4749('0x8'));router['get'](_0x4749('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x4749('0xa')](_0x4749('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x4749('0xb')]('/:id',auth[_0x4749('0xc')](),controller['destroy']);module[_0x4749('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 18d24da..8d27ba0 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 _0x63aa=['sequelize','exports','STRING','BOOLEAN'];(function(_0xe5b37c,_0x40071b){var _0x52a6d0=function(_0x5bcabd){while(--_0x5bcabd){_0xe5b37c['push'](_0xe5b37c['shift']());}};_0x52a6d0(++_0x40071b);}(_0x63aa,0x98));var _0xa63a=function(_0x2fa4c2,_0x46cd49){_0x2fa4c2=_0x2fa4c2-0x0;var _0x24e30f=_0x63aa[_0x2fa4c2];return _0x24e30f;};'use strict';var Sequelize=require(_0xa63a('0x0'));module[_0xa63a('0x1')]={'name':{'type':Sequelize[_0xa63a('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xa63a('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xad07=['STRING','sequelize'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xad07,0x1ab));var _0x7ad0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad07[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7ad0('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x7ad0('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 4db22f1..74a41df 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 _0x0f97=['end','status','json','offset','limit','count','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','type','key','keys','query','filters','intersection','attributes','model','fields','sort','where','pick','merge','VIRTUAL','filter','options','include','show','ChatGroup','length','create','catch','body','find','params','describe','getUnread','user','toInteger','addMembers','ids','omit','findOne','User','getMembers','hasOwnProperty','nolimit','removeMembers','ChatGroupId','ChatInternalMessage','getMessages','order','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatGroup.socket','register'];(function(_0xb3cf51,_0x1f9fd6){var _0x24d096=function(_0x56b8b4){while(--_0x56b8b4){_0xb3cf51['push'](_0xb3cf51['shift']());}};_0x24d096(++_0x1f9fd6);}(_0x0f97,0x9a));var _0x70f9=function(_0x17afca,_0x5d6455){_0x17afca=_0x17afca-0x0;var _0x4691c9=_0x0f97[_0x17afca];return _0x4691c9;};'use strict';var emlformat=require(_0x70f9('0x0'));var rimraf=require(_0x70f9('0x1'));var zipdir=require(_0x70f9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x70f9('0x3'));var Mustache=require(_0x70f9('0x4'));var util=require(_0x70f9('0x5'));var path=require(_0x70f9('0x6'));var sox=require('sox');var csv=require(_0x70f9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x70f9('0x8'));var _=require(_0x70f9('0x9'));var squel=require(_0x70f9('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x70f9('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x70f9('0xc'));var authService=require(_0x70f9('0xd'));var qs=require(_0x70f9('0xe'));var as=require(_0x70f9('0xf'));var hardwareService=require(_0x70f9('0x10'));var logger=require(_0x70f9('0x11'))(_0x70f9('0x12'));var utils=require(_0x70f9('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x70f9('0x14'));var db=require(_0x70f9('0x15'))['db'];config[_0x70f9('0x16')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x70f9('0x17'))(new Redis(config['redis']));require(_0x70f9('0x18'))[_0x70f9('0x19')](socket);function respondWithStatusCode(_0x5d11bb,_0x1e1d4f){_0x1e1d4f=_0x1e1d4f||0xcc;return function(_0x56c086){if(_0x56c086){return _0x5d11bb['sendStatus'](_0x1e1d4f);}return _0x5d11bb['status'](_0x1e1d4f)[_0x70f9('0x1a')]();};}function respondWithResult(_0x462be5,_0x2faa64){_0x2faa64=_0x2faa64||0xc8;return function(_0x463039){if(_0x463039){return _0x462be5[_0x70f9('0x1b')](_0x2faa64)[_0x70f9('0x1c')](_0x463039);}};}function respondWithFilteredResult(_0x374aed,_0x5dab31){return function(_0x583d62){if(_0x583d62){var _0x1d7a19=typeof _0x5dab31[_0x70f9('0x1d')]==='undefined'&&typeof _0x5dab31[_0x70f9('0x1e')]==='undefined';var _0x3cb4d4=_0x583d62[_0x70f9('0x1f')];var _0x499eee=_0x1d7a19?0x0:_0x5dab31[_0x70f9('0x1d')];var _0x4cf438=_0x1d7a19?_0x583d62[_0x70f9('0x1f')]:_0x5dab31[_0x70f9('0x1d')]+_0x5dab31['limit'];var _0x1056fb;if(_0x4cf438>=_0x3cb4d4){_0x4cf438=_0x3cb4d4;_0x1056fb=0xc8;}else{_0x1056fb=0xce;}_0x374aed[_0x70f9('0x1b')](_0x1056fb);return _0x374aed['set'](_0x70f9('0x20'),_0x499eee+'-'+_0x4cf438+'/'+_0x3cb4d4)[_0x70f9('0x1c')](_0x583d62);}return null;};}function patchUpdates(_0x2bb8df){return function(_0x355be9){try{jsonpatch[_0x70f9('0x21')](_0x355be9,_0x2bb8df,!![]);}catch(_0x577e5e){return BPromise['reject'](_0x577e5e);}return _0x355be9[_0x70f9('0x22')]();};}function saveUpdates(_0x512dcf,_0x5c244d){return function(_0x3278ad){if(_0x3278ad){return _0x3278ad[_0x70f9('0x23')](_0x512dcf)[_0x70f9('0x24')](function(_0x51fbe5){return _0x51fbe5;});}return null;};}function removeEntity(_0x574767,_0x2c87cf){return function(_0x6238bf){if(_0x6238bf){return _0x6238bf[_0x70f9('0x25')]()[_0x70f9('0x24')](function(){_0x574767[_0x70f9('0x1b')](0xcc)[_0x70f9('0x1a')]();});}};}function handleEntityNotFound(_0x1edf66,_0x30c84e){return function(_0x50dd40){if(!_0x50dd40){_0x1edf66[_0x70f9('0x26')](0x194);}return _0x50dd40;};}function handleError(_0x32f587,_0x8480aa){_0x8480aa=_0x8480aa||0x1f4;return function(_0x17412a){logger['error'](_0x17412a[_0x70f9('0x27')]);if(_0x17412a['name']){delete _0x17412a[_0x70f9('0x28')];}_0x32f587[_0x70f9('0x1b')](_0x8480aa)[_0x70f9('0x29')](_0x17412a);};}exports[_0x70f9('0x2a')]=function(_0x5afecc,_0x1421bf){var _0x1f358f={},_0x44ce1d={},_0x3fe7a3={'count':0x0,'rows':[]};var _0x24a38b=_[_0x70f9('0x2b')](db['ChatGroup'][_0x70f9('0x2c')],function(_0x72a870){return{'name':_0x72a870['fieldName'],'type':_0x72a870[_0x70f9('0x2d')][_0x70f9('0x2e')]};});_0x44ce1d['model']=_[_0x70f9('0x2b')](_0x24a38b,'name');_0x44ce1d['query']=_[_0x70f9('0x2f')](_0x5afecc[_0x70f9('0x30')]);_0x44ce1d[_0x70f9('0x31')]=_[_0x70f9('0x32')](_0x44ce1d['model'],_0x44ce1d['query']);_0x1f358f[_0x70f9('0x33')]=_['intersection'](_0x44ce1d[_0x70f9('0x34')],qs[_0x70f9('0x35')](_0x5afecc[_0x70f9('0x30')][_0x70f9('0x35')]));_0x1f358f[_0x70f9('0x33')]=_0x1f358f['attributes']['length']?_0x1f358f[_0x70f9('0x33')]:_0x44ce1d['model'];if(!_0x5afecc['query']['hasOwnProperty']('nolimit')){_0x1f358f[_0x70f9('0x1e')]=qs[_0x70f9('0x1e')](_0x5afecc[_0x70f9('0x30')][_0x70f9('0x1e')]);_0x1f358f[_0x70f9('0x1d')]=qs[_0x70f9('0x1d')](_0x5afecc['query'][_0x70f9('0x1d')]);}_0x1f358f['order']=qs[_0x70f9('0x36')](_0x5afecc['query'][_0x70f9('0x36')]);_0x1f358f[_0x70f9('0x37')]=qs[_0x70f9('0x31')](_[_0x70f9('0x38')](_0x5afecc[_0x70f9('0x30')],_0x44ce1d[_0x70f9('0x31')]),_0x24a38b);if(_0x5afecc[_0x70f9('0x30')]['filter']){_0x1f358f['where']=_[_0x70f9('0x39')](_0x1f358f['where'],{'$or':_[_0x70f9('0x2b')](_0x24a38b,function(_0x546483){if(_0x546483[_0x70f9('0x2d')]!==_0x70f9('0x3a')){var _0x5f15fb={};_0x5f15fb[_0x546483[_0x70f9('0x28')]]={'$like':'%'+_0x5afecc['query'][_0x70f9('0x3b')]+'%'};return _0x5f15fb;}})});}_0x1f358f=_['merge']({},_0x1f358f,_0x5afecc[_0x70f9('0x3c')]);var _0x4b82e3={'where':_0x1f358f['where']};return db['ChatGroup'][_0x70f9('0x1f')](_0x4b82e3)[_0x70f9('0x24')](function(_0x1169fc){_0x3fe7a3[_0x70f9('0x1f')]=_0x1169fc;if(_0x5afecc[_0x70f9('0x30')]['includeAll']){_0x1f358f[_0x70f9('0x3d')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x1f358f);})[_0x70f9('0x24')](function(_0x5c12fa){_0x3fe7a3['rows']=_0x5c12fa;return _0x3fe7a3;})[_0x70f9('0x24')](respondWithFilteredResult(_0x1421bf,_0x1f358f))['catch'](handleError(_0x1421bf,null));};exports[_0x70f9('0x3e')]=function(_0x4713ad,_0x151e9a){var _0x37c2a7={'raw':!![],'where':{'id':_0x4713ad['params']['id']}},_0x294946={};_0x294946[_0x70f9('0x34')]=_[_0x70f9('0x2f')](db[_0x70f9('0x3f')][_0x70f9('0x2c')]);_0x294946[_0x70f9('0x30')]=_[_0x70f9('0x2f')](_0x4713ad['query']);_0x294946[_0x70f9('0x31')]=_[_0x70f9('0x32')](_0x294946[_0x70f9('0x34')],_0x294946[_0x70f9('0x30')]);_0x37c2a7[_0x70f9('0x33')]=_[_0x70f9('0x32')](_0x294946[_0x70f9('0x34')],qs[_0x70f9('0x35')](_0x4713ad[_0x70f9('0x30')][_0x70f9('0x35')]));_0x37c2a7['attributes']=_0x37c2a7['attributes'][_0x70f9('0x40')]?_0x37c2a7[_0x70f9('0x33')]:_0x294946[_0x70f9('0x34')];if(_0x4713ad[_0x70f9('0x30')]['includeAll']){_0x37c2a7[_0x70f9('0x3d')]=[{'all':!![]}];}_0x37c2a7=_[_0x70f9('0x39')]({},_0x37c2a7,_0x4713ad['options']);return db['ChatGroup']['find'](_0x37c2a7)[_0x70f9('0x24')](handleEntityNotFound(_0x151e9a,null))[_0x70f9('0x24')](respondWithResult(_0x151e9a,null))['catch'](handleError(_0x151e9a,null));};exports[_0x70f9('0x41')]=function(_0x2f91b5,_0x165b9f){return db[_0x70f9('0x3f')][_0x70f9('0x41')](_0x2f91b5['body'],{})[_0x70f9('0x24')](respondWithResult(_0x165b9f,0xc9))[_0x70f9('0x42')](handleError(_0x165b9f,null));};exports['update']=function(_0x5b26d8,_0xe1772c){if(_0x5b26d8[_0x70f9('0x43')]['id']){delete _0x5b26d8[_0x70f9('0x43')]['id'];}return db[_0x70f9('0x3f')][_0x70f9('0x44')]({'where':{'id':_0x5b26d8[_0x70f9('0x45')]['id']}})[_0x70f9('0x24')](handleEntityNotFound(_0xe1772c,null))[_0x70f9('0x24')](saveUpdates(_0x5b26d8[_0x70f9('0x43')],null))['then'](respondWithResult(_0xe1772c,null))[_0x70f9('0x42')](handleError(_0xe1772c,null));};exports[_0x70f9('0x25')]=function(_0x2c31d7,_0x2e4481){return db[_0x70f9('0x3f')][_0x70f9('0x44')]({'where':{'id':_0x2c31d7[_0x70f9('0x45')]['id']}})[_0x70f9('0x24')](handleEntityNotFound(_0x2e4481,null))[_0x70f9('0x24')](removeEntity(_0x2e4481,null))[_0x70f9('0x42')](handleError(_0x2e4481,null));};exports[_0x70f9('0x46')]=function(_0xac6fc6,_0x4981a6){return db[_0x70f9('0x3f')][_0x70f9('0x46')]()[_0x70f9('0x24')](respondWithResult(_0x4981a6,null))[_0x70f9('0x42')](handleError(_0x4981a6,null));};exports[_0x70f9('0x47')]=function(_0x260095,_0x14170b,_0x374b26){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x260095[_0x70f9('0x45')]['id'],'ToId':_0x260095[_0x70f9('0x48')]['id'],'read':![]}})[_0x70f9('0x24')](function(_0x32ab74){return{'id':_[_0x70f9('0x49')](_0x260095[_0x70f9('0x45')]['id']),'count':_0x32ab74};})[_0x70f9('0x24')](respondWithResult(_0x14170b,null))['catch'](handleError(_0x14170b,null));};exports[_0x70f9('0x4a')]=function(_0x26c8b6,_0x4650df,_0x5db2f8){return db['ChatGroup'][_0x70f9('0x44')]({'where':{'id':_0x26c8b6[_0x70f9('0x45')]['id']}})['then'](handleEntityNotFound(_0x4650df,null))[_0x70f9('0x24')](function(_0x1184dd){if(_0x1184dd){return _0x1184dd[_0x70f9('0x4a')](_0x26c8b6[_0x70f9('0x43')][_0x70f9('0x4b')],_[_0x70f9('0x4c')](_0x26c8b6[_0x70f9('0x43')],['ids','id'])||{});}})[_0x70f9('0x24')](respondWithResult(_0x4650df,null))[_0x70f9('0x42')](handleError(_0x4650df,null));};exports['getMembers']=function(_0x4619aa,_0x9f8aff,_0x20b4e7){var _0x4c7693={};var _0x859dc3={};var _0x300fab;var _0xdbf905;return db['ChatGroup'][_0x70f9('0x4d')]({'where':{'id':_0x4619aa[_0x70f9('0x45')]['id']}})[_0x70f9('0x24')](handleEntityNotFound(_0x9f8aff,null))[_0x70f9('0x24')](function(_0x1a7bf3){if(_0x1a7bf3){_0x300fab=_0x1a7bf3;_0x859dc3[_0x70f9('0x34')]=_['keys'](db[_0x70f9('0x4e')]['rawAttributes']);_0x859dc3['query']=_['keys'](_0x4619aa[_0x70f9('0x30')]);_0x859dc3[_0x70f9('0x31')]=_['intersection'](_0x859dc3['model'],_0x859dc3[_0x70f9('0x30')]);_0x4c7693[_0x70f9('0x33')]=_[_0x70f9('0x32')](_0x859dc3[_0x70f9('0x34')],qs[_0x70f9('0x35')](_0x4619aa['query'][_0x70f9('0x35')]));_0x4c7693[_0x70f9('0x33')]=_0x4c7693[_0x70f9('0x33')]['length']?_0x4c7693[_0x70f9('0x33')]:_0x859dc3[_0x70f9('0x34')];_0x4c7693['order']=qs['sort'](_0x4619aa[_0x70f9('0x30')][_0x70f9('0x36')]);_0x4c7693[_0x70f9('0x37')]=qs['filters'](_[_0x70f9('0x38')](_0x4619aa['query'],_0x859dc3[_0x70f9('0x31')]));if(_0x4619aa['query'][_0x70f9('0x3b')]){_0x4c7693[_0x70f9('0x37')]=_[_0x70f9('0x39')](_0x4c7693[_0x70f9('0x37')],{'$or':_[_0x70f9('0x2b')](_0x4c7693[_0x70f9('0x33')],function(_0x9cb97){var _0x17b234={};_0x17b234[_0x9cb97]={'$like':'%'+_0x4619aa[_0x70f9('0x30')][_0x70f9('0x3b')]+'%'};return _0x17b234;})});}_0x4c7693=_[_0x70f9('0x39')]({},_0x4c7693,_0x4619aa[_0x70f9('0x3c')]);return _0x300fab[_0x70f9('0x4f')](_0x4c7693);}})['then'](function(_0x4b791b){if(_0x4b791b){_0xdbf905=_0x4b791b[_0x70f9('0x40')];if(!_0x4619aa['query'][_0x70f9('0x50')](_0x70f9('0x51'))){_0x4c7693[_0x70f9('0x1e')]=qs[_0x70f9('0x1e')](_0x4619aa[_0x70f9('0x30')]['limit']);_0x4c7693[_0x70f9('0x1d')]=qs[_0x70f9('0x1d')](_0x4619aa[_0x70f9('0x30')]['offset']);}return _0x300fab['getMembers'](_0x4c7693);}})['then'](function(_0x279861){if(_0x279861){return _0x279861?{'count':_0xdbf905,'rows':_0x279861}:null;}})[_0x70f9('0x24')](respondWithResult(_0x9f8aff,null))['catch'](handleError(_0x9f8aff,null));};exports['removeMembers']=function(_0x3f5ea3,_0x1d903a,_0x61c1b3){return db[_0x70f9('0x3f')][_0x70f9('0x44')]({'where':{'id':_0x3f5ea3[_0x70f9('0x45')]['id']}})[_0x70f9('0x24')](handleEntityNotFound(_0x1d903a,null))[_0x70f9('0x24')](function(_0x5a192){if(_0x5a192){return _0x5a192[_0x70f9('0x52')](_0x3f5ea3['query']['ids']);}})['then'](respondWithStatusCode(_0x1d903a,null))[_0x70f9('0x42')](handleError(_0x1d903a,null));};exports['addMessage']=function(_0x516600,_0xa06e72,_0x42768e){if(_0x516600['body']['id']){delete _0x516600['body']['id'];}return db[_0x70f9('0x3f')]['find']({'where':{'id':_0x516600[_0x70f9('0x45')]['id']}})['then'](handleEntityNotFound(_0xa06e72,null))[_0x70f9('0x24')](function(_0x7ea33f){if(_0x7ea33f){_0x516600[_0x70f9('0x43')][_0x70f9('0x53')]=_0x7ea33f['id'];return db[_0x70f9('0x54')][_0x70f9('0x41')](_0x516600[_0x70f9('0x43')]);}})[_0x70f9('0x24')](respondWithResult(_0xa06e72,null))[_0x70f9('0x42')](handleError(_0xa06e72,null));};exports[_0x70f9('0x55')]=function(_0x16d271,_0x4b7b53,_0x136043){var _0x2d0dd7={};var _0x333213={};var _0x55c773;var _0x2e3f44;return db[_0x70f9('0x3f')][_0x70f9('0x4d')]({'where':{'id':_0x16d271[_0x70f9('0x45')]['id']}})['then'](handleEntityNotFound(_0x4b7b53,null))[_0x70f9('0x24')](function(_0xd95119){if(_0xd95119){_0x55c773=_0xd95119;_0x333213[_0x70f9('0x34')]=_[_0x70f9('0x2f')](db['ChatInternalMessage'][_0x70f9('0x2c')]);_0x333213[_0x70f9('0x30')]=_[_0x70f9('0x2f')](_0x16d271[_0x70f9('0x30')]);_0x333213[_0x70f9('0x31')]=_[_0x70f9('0x32')](_0x333213['model'],_0x333213[_0x70f9('0x30')]);_0x2d0dd7[_0x70f9('0x33')]=_[_0x70f9('0x32')](_0x333213['model'],qs[_0x70f9('0x35')](_0x16d271[_0x70f9('0x30')][_0x70f9('0x35')]));_0x2d0dd7[_0x70f9('0x33')]=_0x2d0dd7['attributes'][_0x70f9('0x40')]?_0x2d0dd7[_0x70f9('0x33')]:_0x333213[_0x70f9('0x34')];_0x2d0dd7[_0x70f9('0x56')]=qs['sort'](_0x16d271[_0x70f9('0x30')]['sort']);_0x2d0dd7[_0x70f9('0x37')]=qs[_0x70f9('0x31')](_[_0x70f9('0x38')](_0x16d271['query'],_0x333213[_0x70f9('0x31')]));if(_0x16d271[_0x70f9('0x30')][_0x70f9('0x3b')]){_0x2d0dd7[_0x70f9('0x37')]=_[_0x70f9('0x39')](_0x2d0dd7['where'],{'$or':_[_0x70f9('0x2b')](_0x2d0dd7[_0x70f9('0x33')],function(_0x90abbd){var _0x291ad1={};_0x291ad1[_0x90abbd]={'$like':'%'+_0x16d271[_0x70f9('0x30')][_0x70f9('0x3b')]+'%'};return _0x291ad1;})});}if(_0x16d271['query'][_0x70f9('0x57')]){var _0x256d01=_0x16d271['query'][_0x70f9('0x57')]['split'](',');var _0x21ba72={};_0x21ba72[_0x256d01[0x0]]={'$gte':moment(_0x256d01[0x1])[_0x70f9('0x58')](_0x70f9('0x59'))};_0x2d0dd7[_0x70f9('0x37')]=_[_0x70f9('0x39')](_0x2d0dd7[_0x70f9('0x37')],_0x21ba72);}_0x2d0dd7=_['merge']({},_0x2d0dd7,_0x16d271[_0x70f9('0x3c')]);return _0x55c773['getMessages'](_0x2d0dd7);}})[_0x70f9('0x24')](function(_0x4fe786){if(_0x4fe786){_0x2e3f44=_0x4fe786['length'];if(!_0x16d271['query'][_0x70f9('0x50')](_0x70f9('0x51'))){_0x2d0dd7['limit']=qs[_0x70f9('0x1e')](_0x16d271[_0x70f9('0x30')]['limit']);_0x2d0dd7[_0x70f9('0x1d')]=qs[_0x70f9('0x1d')](_0x16d271[_0x70f9('0x30')][_0x70f9('0x1d')]);}return _0x55c773[_0x70f9('0x55')](_0x2d0dd7);}})['then'](function(_0x30032b){if(_0x30032b){return _0x30032b?{'count':_0x2e3f44,'rows':_0x30032b}:null;}})[_0x70f9('0x24')](respondWithResult(_0x4b7b53,null))[_0x70f9('0x42')](handleError(_0x4b7b53,null));}; \ No newline at end of file +var _0xc099=['length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','ids','omit','getMembers','User','removeMembers','ChatGroupId','getMessages','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields'];(function(_0x307c57,_0x2ff9e5){var _0x232faa=function(_0xef7f){while(--_0xef7f){_0x307c57['push'](_0x307c57['shift']());}};_0x232faa(++_0x2ff9e5);}(_0xc099,0xe0));var _0x9c09=function(_0x5dd3ee,_0x1a78fb){_0x5dd3ee=_0x5dd3ee-0x0;var _0x6dbf95=_0xc099[_0x5dd3ee];return _0x6dbf95;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9c09('0x0'));var zipdir=require(_0x9c09('0x1'));var jsonpatch=require(_0x9c09('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9c09('0x3'));var Mustache=require(_0x9c09('0x4'));var util=require(_0x9c09('0x5'));var path=require(_0x9c09('0x6'));var sox=require(_0x9c09('0x7'));var csv=require(_0x9c09('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9c09('0x9'));var crypto=require(_0x9c09('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9c09('0xb'));var toCsv=require(_0x9c09('0x8'));var querystring=require(_0x9c09('0xc'));var Papa=require(_0x9c09('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9c09('0xe'));var as=require(_0x9c09('0xf'));var hardwareService=require(_0x9c09('0x10'));var logger=require(_0x9c09('0x11'))(_0x9c09('0x12'));var utils=require(_0x9c09('0x13'));var config=require(_0x9c09('0x14'));var licenseUtil=require(_0x9c09('0x15'));var db=require('../../mysqldb')['db'];config[_0x9c09('0x16')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9c09('0x17'))(new Redis(config['redis']));require('./chatGroup.socket')['register'](socket);function respondWithStatusCode(_0x423d45,_0x45d6a0){_0x45d6a0=_0x45d6a0||0xcc;return function(_0x38f47e){if(_0x38f47e){return _0x423d45[_0x9c09('0x18')](_0x45d6a0);}return _0x423d45['status'](_0x45d6a0)[_0x9c09('0x19')]();};}function respondWithResult(_0x4e4494,_0x2f83db){_0x2f83db=_0x2f83db||0xc8;return function(_0x592715){if(_0x592715){return _0x4e4494[_0x9c09('0x1a')](_0x2f83db)[_0x9c09('0x1b')](_0x592715);}};}function respondWithFilteredResult(_0x5c27a8,_0x3c7b51){return function(_0x165806){if(_0x165806){var _0x2b8de8=typeof _0x3c7b51[_0x9c09('0x1c')]===_0x9c09('0x1d')&&typeof _0x3c7b51['limit']==='undefined';var _0xc48a76=_0x165806[_0x9c09('0x1e')];var _0x538e5d=_0x2b8de8?0x0:_0x3c7b51[_0x9c09('0x1c')];var _0x5828b6=_0x2b8de8?_0x165806['count']:_0x3c7b51[_0x9c09('0x1c')]+_0x3c7b51['limit'];var _0x569bd9;if(_0x5828b6>=_0xc48a76){_0x5828b6=_0xc48a76;_0x569bd9=0xc8;}else{_0x569bd9=0xce;}_0x5c27a8[_0x9c09('0x1a')](_0x569bd9);return _0x5c27a8[_0x9c09('0x1f')](_0x9c09('0x20'),_0x538e5d+'-'+_0x5828b6+'/'+_0xc48a76)['json'](_0x165806);}return null;};}function patchUpdates(_0x24e802){return function(_0x520420){try{jsonpatch[_0x9c09('0x21')](_0x520420,_0x24e802,!![]);}catch(_0x2b2488){return BPromise[_0x9c09('0x22')](_0x2b2488);}return _0x520420[_0x9c09('0x23')]();};}function saveUpdates(_0x31a7a2,_0x1fbb5c){return function(_0x3bad44){if(_0x3bad44){return _0x3bad44[_0x9c09('0x24')](_0x31a7a2)[_0x9c09('0x25')](function(_0x2df294){return _0x2df294;});}return null;};}function removeEntity(_0x5824b0,_0x9988a1){return function(_0x2ecf1d){if(_0x2ecf1d){return _0x2ecf1d['destroy']()[_0x9c09('0x25')](function(){_0x5824b0['status'](0xcc)[_0x9c09('0x19')]();});}};}function handleEntityNotFound(_0x2a0f30,_0x2d8593){return function(_0x55bf05){if(!_0x55bf05){_0x2a0f30[_0x9c09('0x18')](0x194);}return _0x55bf05;};}function handleError(_0xf5cd28,_0x2b4b89){_0x2b4b89=_0x2b4b89||0x1f4;return function(_0x55b5c0){logger[_0x9c09('0x26')](_0x55b5c0['stack']);if(_0x55b5c0[_0x9c09('0x27')]){delete _0x55b5c0['name'];}_0xf5cd28[_0x9c09('0x1a')](_0x2b4b89)[_0x9c09('0x28')](_0x55b5c0);};}exports[_0x9c09('0x29')]=function(_0x2ae68f,_0x22d60f){var _0x4514c3={},_0x39a675={},_0x5ec4a7={'count':0x0,'rows':[]};var _0x4fe692=_[_0x9c09('0x2a')](db[_0x9c09('0x2b')][_0x9c09('0x2c')],function(_0x5b8f2b){return{'name':_0x5b8f2b[_0x9c09('0x2d')],'type':_0x5b8f2b[_0x9c09('0x2e')][_0x9c09('0x2f')]};});_0x39a675['model']=_[_0x9c09('0x2a')](_0x4fe692,_0x9c09('0x27'));_0x39a675[_0x9c09('0x30')]=_[_0x9c09('0x31')](_0x2ae68f['query']);_0x39a675[_0x9c09('0x32')]=_[_0x9c09('0x33')](_0x39a675['model'],_0x39a675[_0x9c09('0x30')]);_0x4514c3[_0x9c09('0x34')]=_[_0x9c09('0x33')](_0x39a675[_0x9c09('0x35')],qs[_0x9c09('0x36')](_0x2ae68f['query'][_0x9c09('0x36')]));_0x4514c3[_0x9c09('0x34')]=_0x4514c3[_0x9c09('0x34')][_0x9c09('0x37')]?_0x4514c3[_0x9c09('0x34')]:_0x39a675['model'];if(!_0x2ae68f[_0x9c09('0x30')][_0x9c09('0x38')](_0x9c09('0x39'))){_0x4514c3[_0x9c09('0x3a')]=qs['limit'](_0x2ae68f[_0x9c09('0x30')][_0x9c09('0x3a')]);_0x4514c3[_0x9c09('0x1c')]=qs['offset'](_0x2ae68f[_0x9c09('0x30')][_0x9c09('0x1c')]);}_0x4514c3[_0x9c09('0x3b')]=qs[_0x9c09('0x3c')](_0x2ae68f[_0x9c09('0x30')][_0x9c09('0x3c')]);_0x4514c3[_0x9c09('0x3d')]=qs['filters'](_[_0x9c09('0x3e')](_0x2ae68f['query'],_0x39a675[_0x9c09('0x32')]),_0x4fe692);if(_0x2ae68f[_0x9c09('0x30')][_0x9c09('0x3f')]){_0x4514c3[_0x9c09('0x3d')]=_[_0x9c09('0x40')](_0x4514c3[_0x9c09('0x3d')],{'$or':_[_0x9c09('0x2a')](_0x4fe692,function(_0x1126f4){if(_0x1126f4[_0x9c09('0x2e')]!==_0x9c09('0x41')){var _0x4ac18f={};_0x4ac18f[_0x1126f4['name']]={'$like':'%'+_0x2ae68f[_0x9c09('0x30')]['filter']+'%'};return _0x4ac18f;}})});}_0x4514c3=_['merge']({},_0x4514c3,_0x2ae68f['options']);var _0x37ce93={'where':_0x4514c3[_0x9c09('0x3d')]};return db[_0x9c09('0x2b')][_0x9c09('0x1e')](_0x37ce93)[_0x9c09('0x25')](function(_0x15e1e6){_0x5ec4a7['count']=_0x15e1e6;if(_0x2ae68f['query'][_0x9c09('0x42')]){_0x4514c3[_0x9c09('0x43')]=[{'all':!![]}];}return db[_0x9c09('0x2b')]['findAll'](_0x4514c3);})[_0x9c09('0x25')](function(_0x4bb9a1){_0x5ec4a7[_0x9c09('0x44')]=_0x4bb9a1;return _0x5ec4a7;})['then'](respondWithFilteredResult(_0x22d60f,_0x4514c3))[_0x9c09('0x45')](handleError(_0x22d60f,null));};exports[_0x9c09('0x46')]=function(_0x1f5b9e,_0x46bef4){var _0x3b9280={'raw':!![],'where':{'id':_0x1f5b9e[_0x9c09('0x47')]['id']}},_0x2c71e9={};_0x2c71e9[_0x9c09('0x35')]=_['keys'](db['ChatGroup']['rawAttributes']);_0x2c71e9[_0x9c09('0x30')]=_[_0x9c09('0x31')](_0x1f5b9e[_0x9c09('0x30')]);_0x2c71e9['filters']=_[_0x9c09('0x33')](_0x2c71e9['model'],_0x2c71e9['query']);_0x3b9280[_0x9c09('0x34')]=_[_0x9c09('0x33')](_0x2c71e9[_0x9c09('0x35')],qs['fields'](_0x1f5b9e['query'][_0x9c09('0x36')]));_0x3b9280['attributes']=_0x3b9280[_0x9c09('0x34')]['length']?_0x3b9280['attributes']:_0x2c71e9[_0x9c09('0x35')];if(_0x1f5b9e[_0x9c09('0x30')][_0x9c09('0x42')]){_0x3b9280[_0x9c09('0x43')]=[{'all':!![]}];}_0x3b9280=_[_0x9c09('0x40')]({},_0x3b9280,_0x1f5b9e[_0x9c09('0x48')]);return db[_0x9c09('0x2b')][_0x9c09('0x49')](_0x3b9280)[_0x9c09('0x25')](handleEntityNotFound(_0x46bef4,null))['then'](respondWithResult(_0x46bef4,null))[_0x9c09('0x45')](handleError(_0x46bef4,null));};exports[_0x9c09('0x4a')]=function(_0x43d8ca,_0x4c515d){return db[_0x9c09('0x2b')]['create'](_0x43d8ca[_0x9c09('0x4b')],{})[_0x9c09('0x25')](respondWithResult(_0x4c515d,0xc9))[_0x9c09('0x45')](handleError(_0x4c515d,null));};exports[_0x9c09('0x24')]=function(_0x1e8bbf,_0x265958){if(_0x1e8bbf['body']['id']){delete _0x1e8bbf[_0x9c09('0x4b')]['id'];}return db['ChatGroup'][_0x9c09('0x49')]({'where':{'id':_0x1e8bbf['params']['id']}})[_0x9c09('0x25')](handleEntityNotFound(_0x265958,null))[_0x9c09('0x25')](saveUpdates(_0x1e8bbf[_0x9c09('0x4b')],null))[_0x9c09('0x25')](respondWithResult(_0x265958,null))[_0x9c09('0x45')](handleError(_0x265958,null));};exports['destroy']=function(_0x56375f,_0x5e173a){return db[_0x9c09('0x2b')][_0x9c09('0x49')]({'where':{'id':_0x56375f['params']['id']}})['then'](handleEntityNotFound(_0x5e173a,null))[_0x9c09('0x25')](removeEntity(_0x5e173a,null))[_0x9c09('0x45')](handleError(_0x5e173a,null));};exports[_0x9c09('0x4c')]=function(_0x3d96f8,_0x102bfe){return db['ChatGroup'][_0x9c09('0x4c')]()[_0x9c09('0x25')](respondWithResult(_0x102bfe,null))['catch'](handleError(_0x102bfe,null));};exports[_0x9c09('0x4d')]=function(_0x2a0cab,_0x395e9b,_0x43fe6f){return db[_0x9c09('0x4e')][_0x9c09('0x1e')]({'where':{'ChatGroupId':_0x2a0cab[_0x9c09('0x47')]['id'],'ToId':_0x2a0cab[_0x9c09('0x4f')]['id'],'read':![]}})[_0x9c09('0x25')](function(_0x5be2a4){return{'id':_[_0x9c09('0x50')](_0x2a0cab[_0x9c09('0x47')]['id']),'count':_0x5be2a4};})['then'](respondWithResult(_0x395e9b,null))[_0x9c09('0x45')](handleError(_0x395e9b,null));};exports['addMembers']=function(_0x1b4d70,_0x5b58a5,_0x1487c9){return db[_0x9c09('0x2b')]['find']({'where':{'id':_0x1b4d70[_0x9c09('0x47')]['id']}})[_0x9c09('0x25')](handleEntityNotFound(_0x5b58a5,null))[_0x9c09('0x25')](function(_0x5c3c6e){if(_0x5c3c6e){return _0x5c3c6e['addMembers'](_0x1b4d70[_0x9c09('0x4b')][_0x9c09('0x51')],_[_0x9c09('0x52')](_0x1b4d70[_0x9c09('0x4b')],[_0x9c09('0x51'),'id'])||{});}})[_0x9c09('0x25')](respondWithResult(_0x5b58a5,null))[_0x9c09('0x45')](handleError(_0x5b58a5,null));};exports[_0x9c09('0x53')]=function(_0x5ac606,_0x4c41da,_0x26002c){var _0x5e61da={};var _0x178900={};var _0x1f7bbd;var _0x3d57d4;return db[_0x9c09('0x2b')]['findOne']({'where':{'id':_0x5ac606['params']['id']}})[_0x9c09('0x25')](handleEntityNotFound(_0x4c41da,null))[_0x9c09('0x25')](function(_0x531f0e){if(_0x531f0e){_0x1f7bbd=_0x531f0e;_0x178900[_0x9c09('0x35')]=_[_0x9c09('0x31')](db[_0x9c09('0x54')]['rawAttributes']);_0x178900[_0x9c09('0x30')]=_[_0x9c09('0x31')](_0x5ac606[_0x9c09('0x30')]);_0x178900[_0x9c09('0x32')]=_[_0x9c09('0x33')](_0x178900[_0x9c09('0x35')],_0x178900[_0x9c09('0x30')]);_0x5e61da[_0x9c09('0x34')]=_['intersection'](_0x178900[_0x9c09('0x35')],qs[_0x9c09('0x36')](_0x5ac606['query']['fields']));_0x5e61da['attributes']=_0x5e61da[_0x9c09('0x34')][_0x9c09('0x37')]?_0x5e61da[_0x9c09('0x34')]:_0x178900[_0x9c09('0x35')];_0x5e61da[_0x9c09('0x3b')]=qs['sort'](_0x5ac606['query'][_0x9c09('0x3c')]);_0x5e61da[_0x9c09('0x3d')]=qs[_0x9c09('0x32')](_[_0x9c09('0x3e')](_0x5ac606[_0x9c09('0x30')],_0x178900['filters']));if(_0x5ac606['query'][_0x9c09('0x3f')]){_0x5e61da[_0x9c09('0x3d')]=_[_0x9c09('0x40')](_0x5e61da[_0x9c09('0x3d')],{'$or':_[_0x9c09('0x2a')](_0x5e61da['attributes'],function(_0x2db8a1){var _0x3593fa={};_0x3593fa[_0x2db8a1]={'$like':'%'+_0x5ac606[_0x9c09('0x30')]['filter']+'%'};return _0x3593fa;})});}_0x5e61da=_[_0x9c09('0x40')]({},_0x5e61da,_0x5ac606[_0x9c09('0x48')]);return _0x1f7bbd[_0x9c09('0x53')](_0x5e61da);}})[_0x9c09('0x25')](function(_0x4f8779){if(_0x4f8779){_0x3d57d4=_0x4f8779[_0x9c09('0x37')];if(!_0x5ac606[_0x9c09('0x30')]['hasOwnProperty'](_0x9c09('0x39'))){_0x5e61da[_0x9c09('0x3a')]=qs['limit'](_0x5ac606[_0x9c09('0x30')][_0x9c09('0x3a')]);_0x5e61da[_0x9c09('0x1c')]=qs['offset'](_0x5ac606[_0x9c09('0x30')][_0x9c09('0x1c')]);}return _0x1f7bbd[_0x9c09('0x53')](_0x5e61da);}})[_0x9c09('0x25')](function(_0x1fb4fe){if(_0x1fb4fe){return _0x1fb4fe?{'count':_0x3d57d4,'rows':_0x1fb4fe}:null;}})[_0x9c09('0x25')](respondWithResult(_0x4c41da,null))[_0x9c09('0x45')](handleError(_0x4c41da,null));};exports[_0x9c09('0x55')]=function(_0x367ec0,_0x1b6ead,_0x11d5b7){return db[_0x9c09('0x2b')]['find']({'where':{'id':_0x367ec0['params']['id']}})[_0x9c09('0x25')](handleEntityNotFound(_0x1b6ead,null))[_0x9c09('0x25')](function(_0xa5cf2a){if(_0xa5cf2a){return _0xa5cf2a[_0x9c09('0x55')](_0x367ec0[_0x9c09('0x30')][_0x9c09('0x51')]);}})['then'](respondWithStatusCode(_0x1b6ead,null))['catch'](handleError(_0x1b6ead,null));};exports['addMessage']=function(_0x3d5a93,_0x528dbc,_0x28f1ca){if(_0x3d5a93[_0x9c09('0x4b')]['id']){delete _0x3d5a93[_0x9c09('0x4b')]['id'];}return db['ChatGroup'][_0x9c09('0x49')]({'where':{'id':_0x3d5a93['params']['id']}})['then'](handleEntityNotFound(_0x528dbc,null))[_0x9c09('0x25')](function(_0x5e58c2){if(_0x5e58c2){_0x3d5a93[_0x9c09('0x4b')][_0x9c09('0x56')]=_0x5e58c2['id'];return db[_0x9c09('0x4e')][_0x9c09('0x4a')](_0x3d5a93[_0x9c09('0x4b')]);}})[_0x9c09('0x25')](respondWithResult(_0x528dbc,null))[_0x9c09('0x45')](handleError(_0x528dbc,null));};exports[_0x9c09('0x57')]=function(_0x174804,_0x671c8a,_0x955631){var _0x3ea03d={};var _0xe083ab={};var _0x4ffc7f;var _0x1f2bab;return db[_0x9c09('0x2b')][_0x9c09('0x58')]({'where':{'id':_0x174804[_0x9c09('0x47')]['id']}})[_0x9c09('0x25')](handleEntityNotFound(_0x671c8a,null))[_0x9c09('0x25')](function(_0x37c422){if(_0x37c422){_0x4ffc7f=_0x37c422;_0xe083ab[_0x9c09('0x35')]=_['keys'](db[_0x9c09('0x4e')][_0x9c09('0x2c')]);_0xe083ab[_0x9c09('0x30')]=_['keys'](_0x174804[_0x9c09('0x30')]);_0xe083ab[_0x9c09('0x32')]=_[_0x9c09('0x33')](_0xe083ab[_0x9c09('0x35')],_0xe083ab[_0x9c09('0x30')]);_0x3ea03d[_0x9c09('0x34')]=_['intersection'](_0xe083ab[_0x9c09('0x35')],qs[_0x9c09('0x36')](_0x174804[_0x9c09('0x30')][_0x9c09('0x36')]));_0x3ea03d[_0x9c09('0x34')]=_0x3ea03d[_0x9c09('0x34')][_0x9c09('0x37')]?_0x3ea03d[_0x9c09('0x34')]:_0xe083ab[_0x9c09('0x35')];_0x3ea03d['order']=qs[_0x9c09('0x3c')](_0x174804[_0x9c09('0x30')][_0x9c09('0x3c')]);_0x3ea03d[_0x9c09('0x3d')]=qs[_0x9c09('0x32')](_[_0x9c09('0x3e')](_0x174804[_0x9c09('0x30')],_0xe083ab['filters']));if(_0x174804[_0x9c09('0x30')][_0x9c09('0x3f')]){_0x3ea03d[_0x9c09('0x3d')]=_[_0x9c09('0x40')](_0x3ea03d[_0x9c09('0x3d')],{'$or':_['map'](_0x3ea03d[_0x9c09('0x34')],function(_0x4c981a){var _0x473a90={};_0x473a90[_0x4c981a]={'$like':'%'+_0x174804[_0x9c09('0x30')]['filter']+'%'};return _0x473a90;})});}if(_0x174804[_0x9c09('0x30')][_0x9c09('0x59')]){var _0xe08e76=_0x174804[_0x9c09('0x30')][_0x9c09('0x59')][_0x9c09('0x5a')](',');var _0x542fad={};_0x542fad[_0xe08e76[0x0]]={'$gte':moment(_0xe08e76[0x1])[_0x9c09('0x5b')](_0x9c09('0x5c'))};_0x3ea03d[_0x9c09('0x3d')]=_['merge'](_0x3ea03d[_0x9c09('0x3d')],_0x542fad);}_0x3ea03d=_[_0x9c09('0x40')]({},_0x3ea03d,_0x174804[_0x9c09('0x48')]);return _0x4ffc7f['getMessages'](_0x3ea03d);}})[_0x9c09('0x25')](function(_0x4cbc57){if(_0x4cbc57){_0x1f2bab=_0x4cbc57[_0x9c09('0x37')];if(!_0x174804[_0x9c09('0x30')][_0x9c09('0x38')](_0x9c09('0x39'))){_0x3ea03d[_0x9c09('0x3a')]=qs[_0x9c09('0x3a')](_0x174804[_0x9c09('0x30')][_0x9c09('0x3a')]);_0x3ea03d[_0x9c09('0x1c')]=qs[_0x9c09('0x1c')](_0x174804['query'][_0x9c09('0x1c')]);}return _0x4ffc7f[_0x9c09('0x57')](_0x3ea03d);}})[_0x9c09('0x25')](function(_0x186ce0){if(_0x186ce0){return _0x186ce0?{'count':_0x1f2bab,'rows':_0x186ce0}:null;}})[_0x9c09('0x25')](respondWithResult(_0x671c8a,null))[_0x9c09('0x45')](handleError(_0x671c8a,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index e9eec9b..715dbda 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 _0xfa94=['exports','events','ChatGroup','save','update','emit','hasOwnProperty'];(function(_0x53f693,_0x5afcff){var _0x1e617f=function(_0x59db9a){while(--_0x59db9a){_0x53f693['push'](_0x53f693['shift']());}};_0x1e617f(++_0x5afcff);}(_0xfa94,0xef));var _0x4fa9=function(_0x49b984,_0x387c83){_0x49b984=_0x49b984-0x0;var _0x49d1e0=_0xfa94[_0x49b984];return _0x49d1e0;};'use strict';var EventEmitter=require(_0x4fa9('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0x4fa9('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4fa9('0x2'),'afterUpdate':_0x4fa9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x40e2f6){return function(_0xa08385,_0xe1adab,_0x22e87d){ChatGroupEvents[_0x4fa9('0x4')](_0x40e2f6+':'+_0xa08385['id'],_0xa08385);ChatGroupEvents[_0x4fa9('0x4')](_0x40e2f6,_0xa08385);_0x22e87d(null);};}for(var e in events){if(events[_0x4fa9('0x5')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x4fa9('0x6')]=ChatGroupEvents; \ No newline at end of file +var _0xef4b=['emit','events','../../mysqldb','ChatGroup','setMaxListeners','save'];(function(_0x4421a7,_0x11ee9e){var _0x38250a=function(_0x4cd9a7){while(--_0x4cd9a7){_0x4421a7['push'](_0x4421a7['shift']());}};_0x38250a(++_0x11ee9e);}(_0xef4b,0x17b));var _0xbef4=function(_0x335f37,_0x37302b){_0x335f37=_0x335f37-0x0;var _0x1768f4=_0xef4b[_0x335f37];return _0x1768f4;};'use strict';var EventEmitter=require(_0xbef4('0x0'));var ChatGroup=require(_0xbef4('0x1'))['db'][_0xbef4('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xbef4('0x3')](0x0);var events={'afterCreate':_0xbef4('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3533dd){return function(_0x3e66b3,_0x44eb93,_0x1ad210){ChatGroupEvents[_0xbef4('0x5')](_0x3533dd+':'+_0x3e66b3['id'],_0x3e66b3);ChatGroupEvents[_0xbef4('0x5')](_0x3533dd,_0x3e66b3);_0x1ad210(null);};}for(var e in events){if(events['hasOwnProperty'](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 9f0b6ec..6f873a8 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 _0x282a=['request-promise','path','../../config/environment','./chatGroup.attributes','exports','define','chat_groups','../../config/logger','api','moment','bluebird'];(function(_0x457cd6,_0x4d8bba){var _0x366513=function(_0x1ac550){while(--_0x1ac550){_0x457cd6['push'](_0x457cd6['shift']());}};_0x366513(++_0x4d8bba);}(_0x282a,0xd8));var _0xa282=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x282a[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa282('0x0'))(_0xa282('0x1'));var moment=require(_0xa282('0x2'));var BPromise=require(_0xa282('0x3'));var rp=require(_0xa282('0x4'));var fs=require('fs');var path=require(_0xa282('0x5'));var rimraf=require('rimraf');var config=require(_0xa282('0x6'));var attributes=require(_0xa282('0x7'));module[_0xa282('0x8')]=function(_0x5c29f6,_0x28710c){return _0x5c29f6[_0xa282('0x9')]('ChatGroup',attributes,{'tableName':_0xa282('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4e3=['path','./chatGroup.attributes','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1ed5be,_0x34fd21){var _0x4154a7=function(_0x1bffb6){while(--_0x1bffb6){_0x1ed5be['push'](_0x1ed5be['shift']());}};_0x4154a7(++_0x34fd21);}(_0xb4e3,0x180));var _0x3b4e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xb4e3[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0x3b4e('0x0'));var util=require(_0x3b4e('0x1'));var logger=require(_0x3b4e('0x2'))(_0x3b4e('0x3'));var moment=require(_0x3b4e('0x4'));var BPromise=require(_0x3b4e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3b4e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3b4e('0x7'));module['exports']=function(_0x515f0a,_0x52ae03){return _0x515f0a['define'](_0x3b4e('0x8'),attributes,{'tableName':_0x3b4e('0x9'),'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 518d336..e92131d 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 _0x6d6f=['error','ChatGroup,\x20%s,\x20%s','message','result','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','redis','socket.io-emitter','./chatGroup.socket','register','request','then','info','request\x20sent','stringify'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6d6f,0x159));var _0xf6d6=function(_0x462fe4,_0x394d3e){_0x462fe4=_0x462fe4-0x0;var _0x82b23a=_0x6d6f[_0x462fe4];return _0x82b23a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf6d6('0x0'));var rs=require(_0xf6d6('0x1'));var fs=require('fs');var Redis=require(_0xf6d6('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf6d6('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xf6d6('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xf6d6('0x5')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xf6d6('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0xf6d6('0x7'))(new Redis(config[_0xf6d6('0x6')]));require(_0xf6d6('0x8'))[_0xf6d6('0x9')](socket);function respondWithRpcPromise(_0x3f6a6c,_0x104461,_0x411773){return new BPromise(function(_0x4bb47a,_0x4b1f52){return client[_0xf6d6('0xa')](_0x3f6a6c,_0x411773)[_0xf6d6('0xb')](function(_0x37e17c){logger[_0xf6d6('0xc')]('ChatGroup,\x20%s,\x20%s',_0x104461,_0xf6d6('0xd'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x104461,_0xf6d6('0xd'),JSON[_0xf6d6('0xe')](_0x37e17c));if(_0x37e17c[_0xf6d6('0xf')]){if(_0x37e17c[_0xf6d6('0xf')]['code']===0x1f4){logger['error'](_0xf6d6('0x10'),_0x104461,_0x37e17c[_0xf6d6('0xf')][_0xf6d6('0x11')]);return _0x4b1f52(_0x37e17c[_0xf6d6('0xf')]['message']);}logger[_0xf6d6('0xf')](_0xf6d6('0x10'),_0x104461,_0x37e17c['error']['message']);return _0x4bb47a(_0x37e17c['error'][_0xf6d6('0x11')]);}else{logger[_0xf6d6('0xc')](_0xf6d6('0x10'),_0x104461,_0xf6d6('0xd'));_0x4bb47a(_0x37e17c[_0xf6d6('0x12')][_0xf6d6('0x11')]);}})[_0xf6d6('0x13')](function(_0x21d74a){logger[_0xf6d6('0xf')](_0xf6d6('0x10'),_0x104461,_0x21d74a);_0x4b1f52(_0x21d74a);});});} \ No newline at end of file +var _0x9dc3=['info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','register','request','then'];(function(_0x54e333,_0x4ba478){var _0x47279e=function(_0x8e4f0b){while(--_0x8e4f0b){_0x54e333['push'](_0x54e333['shift']());}};_0x47279e(++_0x4ba478);}(_0x9dc3,0xa5));var _0x39dc=function(_0x44bf47,_0x23b58b){_0x44bf47=_0x44bf47-0x0;var _0x43c7e2=_0x9dc3[_0x44bf47];return _0x43c7e2;};'use strict';var _=require(_0x39dc('0x0'));var util=require(_0x39dc('0x1'));var moment=require(_0x39dc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x39dc('0x3'));var db=require(_0x39dc('0x4'))['db'];var utils=require(_0x39dc('0x5'));var logger=require(_0x39dc('0x6'))(_0x39dc('0x7'));var config=require(_0x39dc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x39dc('0x9')][_0x39dc('0xa')]({'port':0x232a});config[_0x39dc('0xb')]=_[_0x39dc('0xc')](config[_0x39dc('0xb')],{'host':_0x39dc('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatGroup.socket')[_0x39dc('0xe')](socket);function respondWithRpcPromise(_0x44f334,_0x16bbbd,_0xffe473){return new BPromise(function(_0x2b4d22,_0x1eebb1){return client[_0x39dc('0xf')](_0x44f334,_0xffe473)[_0x39dc('0x10')](function(_0x54490e){logger[_0x39dc('0x11')](_0x39dc('0x12'),_0x16bbbd,_0x39dc('0x13'));logger[_0x39dc('0x14')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x16bbbd,_0x39dc('0x13'),JSON[_0x39dc('0x15')](_0x54490e));if(_0x54490e[_0x39dc('0x16')]){if(_0x54490e['error'][_0x39dc('0x17')]===0x1f4){logger[_0x39dc('0x16')](_0x39dc('0x12'),_0x16bbbd,_0x54490e[_0x39dc('0x16')][_0x39dc('0x18')]);return _0x1eebb1(_0x54490e['error'][_0x39dc('0x18')]);}logger[_0x39dc('0x16')](_0x39dc('0x12'),_0x16bbbd,_0x54490e[_0x39dc('0x16')][_0x39dc('0x18')]);return _0x2b4d22(_0x54490e[_0x39dc('0x16')][_0x39dc('0x18')]);}else{logger['info'](_0x39dc('0x12'),_0x16bbbd,_0x39dc('0x13'));_0x2b4d22(_0x54490e['result']['message']);}})[_0x39dc('0x19')](function(_0x11fb9b){logger[_0x39dc('0x16')](_0x39dc('0x12'),_0x16bbbd,_0x11fb9b);_0x1eebb1(_0x11fb9b);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 8a6277a..5b00734 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 _0x0801=['removeListener','register','chatGroup:','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0801,0x9f));var _0x1080=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x0801[_0x5d2803];return _0xdcad2c;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=['save','remove','update'];function createListener(_0x5acf44,_0x2d9a11){return function(_0x584267){_0x2d9a11[_0x1080('0x0')](_0x5acf44,_0x584267);};}function removeListener(_0x4a0e44,_0x15a70f){return function(){ChatGroupEvents[_0x1080('0x1')](_0x4a0e44,_0x15a70f);};}exports[_0x1080('0x2')]=function(_0x3d1614){for(var _0xfda756=0x0,_0x4e7822=events['length'];_0xfda756<_0x4e7822;_0xfda756++){var _0x23cc58=events[_0xfda756];var _0x57cdab=createListener(_0x1080('0x3')+_0x23cc58,_0x3d1614);ChatGroupEvents['on'](_0x23cc58,_0x57cdab);}}; \ No newline at end of file +var _0xa107=['emit','register','length','chatGroup:','./chatGroup.events','save','remove','update'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xa107,0xcc));var _0x7a10=function(_0x5d92d5,_0x44806a){_0x5d92d5=_0x5d92d5-0x0;var _0x23d3f8=_0xa107[_0x5d92d5];return _0x23d3f8;};'use strict';var ChatGroupEvents=require(_0x7a10('0x0'));var events=[_0x7a10('0x1'),_0x7a10('0x2'),_0x7a10('0x3')];function createListener(_0x1d1e59,_0x8e0dbf){return function(_0x3fc060){_0x8e0dbf[_0x7a10('0x4')](_0x1d1e59,_0x3fc060);};}function removeListener(_0x31e537,_0x34ed32){return function(){ChatGroupEvents['removeListener'](_0x31e537,_0x34ed32);};}exports[_0x7a10('0x5')]=function(_0x3e1724){for(var _0x58666a=0x0,_0x24b0ca=events[_0x7a10('0x6')];_0x58666a<_0x24b0ca;_0x58666a++){var _0xd25ea7=events[_0x58666a];var _0x319f77=createListener(_0x7a10('0x7')+_0xd25ea7,_0x3e1724);ChatGroupEvents['on'](_0xd25ea7,_0x319f77);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 89ef4cd..599d06a 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 _0x584d=['isAuthenticated','index','/:id','show','/:id/unread','getUnread','/:id/messages','post','create','/:id/members','put','update','delete','destroy','removeMembers','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','./chatGroup.controller','get'];(function(_0x1020f3,_0x54f5ce){var _0x3ad75c=function(_0xc6fe4f){while(--_0xc6fe4f){_0x1020f3['push'](_0x1020f3['shift']());}};_0x3ad75c(++_0x54f5ce);}(_0x584d,0x148));var _0xd584=function(_0x3a5c5c,_0x173174){_0x3a5c5c=_0x3a5c5c-0x0;var _0xf03dcc=_0x584d[_0x3a5c5c];return _0xf03dcc;};'use strict';var multer=require(_0xd584('0x0'));var util=require(_0xd584('0x1'));var path=require('path');var timeout=require(_0xd584('0x2'));var express=require(_0xd584('0x3'));var router=express['Router']();var fs_extra=require(_0xd584('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd584('0x5'));var config=require('../../config/environment');var controller=require(_0xd584('0x6'));router[_0xd584('0x7')]('/',auth[_0xd584('0x8')](),controller[_0xd584('0x9')]);router['get']('/describe',auth[_0xd584('0x8')](),controller['describe']);router[_0xd584('0x7')](_0xd584('0xa'),auth[_0xd584('0x8')](),controller[_0xd584('0xb')]);router['get'](_0xd584('0xc'),auth[_0xd584('0x8')](),controller[_0xd584('0xd')]);router[_0xd584('0x7')]('/:id/members',auth[_0xd584('0x8')](),controller['getMembers']);router[_0xd584('0x7')](_0xd584('0xe'),auth[_0xd584('0x8')](),controller['getMessages']);router[_0xd584('0xf')]('/',auth['isAuthenticated'](),controller[_0xd584('0x10')]);router[_0xd584('0xf')](_0xd584('0x11'),auth[_0xd584('0x8')](),controller['addMembers']);router[_0xd584('0xf')](_0xd584('0xe'),auth['isAuthenticated'](),controller['addMessage']);router[_0xd584('0x12')](_0xd584('0xa'),auth['isAuthenticated'](),controller[_0xd584('0x13')]);router[_0xd584('0x14')](_0xd584('0xa'),auth['isAuthenticated'](),controller[_0xd584('0x15')]);router[_0xd584('0x14')](_0xd584('0x11'),auth['isAuthenticated'](),controller[_0xd584('0x16')]);module[_0xd584('0x17')]=router; \ No newline at end of file +var _0x25e2=['./chatGroup.controller','get','isAuthenticated','describe','/:id','show','/:id/unread','/:id/members','getMembers','/:id/messages','post','addMembers','addMessage','put','delete','removeMembers','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2e94e0,_0x2d2c89){var _0x1fff4c=function(_0x3c0c78){while(--_0x3c0c78){_0x2e94e0['push'](_0x2e94e0['shift']());}};_0x1fff4c(++_0x2d2c89);}(_0x25e2,0x170));var _0x225e=function(_0x15044a,_0x42f0d7){_0x15044a=_0x15044a-0x0;var _0x2b0308=_0x25e2[_0x15044a];return _0x2b0308;};'use strict';var multer=require('multer');var util=require(_0x225e('0x0'));var path=require(_0x225e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x225e('0x2')]();var fs_extra=require(_0x225e('0x3'));var auth=require(_0x225e('0x4'));var interaction=require(_0x225e('0x5'));var config=require('../../config/environment');var controller=require(_0x225e('0x6'));router[_0x225e('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x225e('0x7')]('/describe',auth[_0x225e('0x8')](),controller[_0x225e('0x9')]);router[_0x225e('0x7')](_0x225e('0xa'),auth['isAuthenticated'](),controller[_0x225e('0xb')]);router[_0x225e('0x7')](_0x225e('0xc'),auth[_0x225e('0x8')](),controller['getUnread']);router['get'](_0x225e('0xd'),auth[_0x225e('0x8')](),controller[_0x225e('0xe')]);router[_0x225e('0x7')](_0x225e('0xf'),auth[_0x225e('0x8')](),controller['getMessages']);router[_0x225e('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x225e('0x10')](_0x225e('0xd'),auth['isAuthenticated'](),controller[_0x225e('0x11')]);router[_0x225e('0x10')](_0x225e('0xf'),auth[_0x225e('0x8')](),controller[_0x225e('0x12')]);router[_0x225e('0x13')](_0x225e('0xa'),auth[_0x225e('0x8')](),controller['update']);router['delete'](_0x225e('0xa'),auth['isAuthenticated'](),controller['destroy']);router[_0x225e('0x14')]('/:id/members',auth[_0x225e('0x8')](),controller[_0x225e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index def9858..50a1bea 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 _0x8b29=['sequelize','BOOLEAN','INTEGER','thumb','star','TEXT','DATE','STRING','long','out'];(function(_0x121bbd,_0x558daf){var _0x553c53=function(_0x320a7d){while(--_0x320a7d){_0x121bbd['push'](_0x121bbd['shift']());}};_0x553c53(++_0x558daf);}(_0x8b29,0xbe));var _0x98b2=function(_0x1518db,_0x3dc644){_0x1518db=_0x1518db-0x0;var _0x102ccf=_0x8b29[_0x1518db];return _0x102ccf;};'use strict';var Sequelize=require(_0x98b2('0x0'));module['exports']={'closed':{'type':Sequelize[_0x98b2('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x98b2('0x2')]},'ratingType':{'type':Sequelize['ENUM']('star',_0x98b2('0x3')),'defaultValue':_0x98b2('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x98b2('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x98b2('0x6')]},'disposition':{'type':Sequelize[_0x98b2('0x7')]},'secondDisposition':{'type':Sequelize[_0x98b2('0x7')]},'thirdDisposition':{'type':Sequelize[_0x98b2('0x7')]},'note':{'type':Sequelize[_0x98b2('0x7')]},'browserName':{'type':Sequelize[_0x98b2('0x7')]},'browserVersion':{'type':Sequelize[_0x98b2('0x7')]},'osName':{'type':Sequelize[_0x98b2('0x7')]},'osVersion':{'type':Sequelize[_0x98b2('0x7')]},'deviceModel':{'type':Sequelize[_0x98b2('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x98b2('0x5')]},'customerIp':{'type':Sequelize[_0x98b2('0x7')]},'formData':{'type':Sequelize[_0x98b2('0x5')](_0x98b2('0x8'))},'read1stAt':{'type':Sequelize[_0x98b2('0x6')]},'lastMsgAt':{'type':Sequelize[_0x98b2('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x98b2('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x98b2('0x7')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x98b2('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x98b2('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x0972=['BOOLEAN','exports','INTEGER','star','thumb','TEXT','STRING','DATE','long','ENUM','out'];(function(_0xf96956,_0x201650){var _0x314653=function(_0x4c37e5){while(--_0x4c37e5){_0xf96956['push'](_0xf96956['shift']());}};_0x314653(++_0x201650);}(_0x0972,0x64));var _0x2097=function(_0x54b5d5,_0x4631a5){_0x54b5d5=_0x54b5d5-0x0;var _0x23ecb7=_0x0972[_0x54b5d5];return _0x23ecb7;};'use strict';var Sequelize=require('sequelize');module[_0x2097('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x2097('0x1')]},'ratingType':{'type':Sequelize['ENUM'](_0x2097('0x2'),_0x2097('0x3')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x2097('0x4')]},'pathTranscript':{'type':Sequelize[_0x2097('0x4')]},'mailTranscript':{'type':Sequelize[_0x2097('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x2097('0x6')]},'disposition':{'type':Sequelize[_0x2097('0x5')]},'secondDisposition':{'type':Sequelize[_0x2097('0x5')]},'thirdDisposition':{'type':Sequelize[_0x2097('0x5')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x2097('0x5')]},'browserVersion':{'type':Sequelize[_0x2097('0x5')]},'osName':{'type':Sequelize[_0x2097('0x5')]},'osVersion':{'type':Sequelize[_0x2097('0x5')]},'deviceModel':{'type':Sequelize[_0x2097('0x5')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x2097('0x5')]},'referer':{'type':Sequelize[_0x2097('0x4')]},'customerIp':{'type':Sequelize[_0x2097('0x5')]},'formData':{'type':Sequelize[_0x2097('0x4')](_0x2097('0x7'))},'read1stAt':{'type':Sequelize[_0x2097('0x6')]},'lastMsgAt':{'type':Sequelize[_0x2097('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x2097('0x8')]('in',_0x2097('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x2097('0x5')]},'customerPort':{'type':Sequelize[_0x2097('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x2097('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x2097('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index f71e296..2ed6389 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 _0x0abf=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','select','field','color','from','tools_tags','user_has_chat_interactions','users','chat_interactions','left_join','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','having','`\x20=\x200','`\x20>\x200','Contact','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','parse','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','SELECT','clone','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','ChatInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','ui.ChatInteractionId\x20IN\x20?','groupBy','all','rows','show','includeAll','include','options','params','describe','ChatWebsite','findOne','vidaooApiKey','vidaooTopic','vidaooMetadata','vidaooEscalation','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','create','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','server/files/attachments/','download','mailTranscript','format','transcript-%s.txt','now','User','CmContact','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','pick','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','root','attachments','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','browserName','osName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','firstName','views','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','json','offset','undefined','limit','count','reject','update','destroy','end','stack','name','render','merge','body','contact','agent','account','Users','map','fullname','Tags','TagIds','split','forEach','push','catch','rawAttributes','fieldName','type','key','model'];(function(_0x42c841,_0x5e8840){var _0x213b83=function(_0x543571){while(--_0x543571){_0x42c841['push'](_0x42c841['shift']());}};_0x213b83(++_0x5e8840);}(_0x0abf,0xe8));var _0xf0ab=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x0abf[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0xf0ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0ab('0x1'));var jsonpatch=require(_0xf0ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0ab('0x3'));var Mustache=require('mustache');var util=require(_0xf0ab('0x4'));var path=require(_0xf0ab('0x5'));var sox=require(_0xf0ab('0x6'));var csv=require(_0xf0ab('0x7'));var ejs=require(_0xf0ab('0x8'));var fs=require('fs');var fs_extra=require(_0xf0ab('0x9'));var _=require(_0xf0ab('0xa'));var squel=require('squel');var crypto=require(_0xf0ab('0xb'));var jsforce=require(_0xf0ab('0xc'));var deskjs=require(_0xf0ab('0xd'));var toCsv=require(_0xf0ab('0x7'));var querystring=require('querystring');var Papa=require(_0xf0ab('0xe'));var Redis=require(_0xf0ab('0xf'));var authService=require(_0xf0ab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xf0ab('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0ab('0x12'))(_0xf0ab('0x13'));var utils=require(_0xf0ab('0x14'));var config=require(_0xf0ab('0x15'));var licenseUtil=require(_0xf0ab('0x16'));var db=require(_0xf0ab('0x17'))['db'];config[_0xf0ab('0x18')]=_['defaults'](config[_0xf0ab('0x18')],{'host':_0xf0ab('0x19'),'port':0x18eb});var socket=require(_0xf0ab('0x1a'))(new Redis(config[_0xf0ab('0x18')]));require(_0xf0ab('0x1b'))[_0xf0ab('0x1c')](socket);var jayson=require(_0xf0ab('0x1d'));var client=jayson[_0xf0ab('0x1e')][_0xf0ab('0x1f')]({'port':0x232b});var client9004=jayson[_0xf0ab('0x1e')][_0xf0ab('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x221bac,_0x200cf5,_0x2f4618,_0x230f40){return new BPromise(function(_0x54b0ce,_0x457465){var _0x9e3b47=_0x230f40||client;return _0x9e3b47[_0xf0ab('0x20')](_0x221bac,_0x2f4618)[_0xf0ab('0x21')](function(_0x776619){logger[_0xf0ab('0x22')](_0xf0ab('0x23'),_0x200cf5,_0xf0ab('0x24'));logger[_0xf0ab('0x25')](_0xf0ab('0x26'),_0x200cf5,_0xf0ab('0x24'),JSON[_0xf0ab('0x27')](_0x776619));if(_0x776619[_0xf0ab('0x28')]){if(_0x776619[_0xf0ab('0x28')][_0xf0ab('0x29')]===0x1f4){logger[_0xf0ab('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x200cf5,_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);return _0x457465(_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);}logger[_0xf0ab('0x28')](_0xf0ab('0x23'),_0x200cf5,_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);return _0x54b0ce(_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);}else{logger[_0xf0ab('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x200cf5,'request\x20sent');_0x54b0ce(_0x776619['result'][_0xf0ab('0x2a')]);}})['catch'](function(_0x3eca32){logger[_0xf0ab('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x200cf5,_0x3eca32);_0x457465(_0x3eca32);});});}function respondWithStatusCode(_0x163078,_0x22671e){_0x22671e=_0x22671e||0xcc;return function(_0x10bf5f){if(_0x10bf5f){return _0x163078[_0xf0ab('0x2b')](_0x22671e);}return _0x163078[_0xf0ab('0x2c')](_0x22671e)['end']();};}function respondWithResult(_0x2d0da7,_0x574ce7){_0x574ce7=_0x574ce7||0xc8;return function(_0x55d799){if(_0x55d799){return _0x2d0da7[_0xf0ab('0x2c')](_0x574ce7)[_0xf0ab('0x2d')](_0x55d799);}};}function respondWithFilteredResult(_0x1b223d,_0x445160){return function(_0x43476c){if(_0x43476c){var _0x174052=typeof _0x445160[_0xf0ab('0x2e')]===_0xf0ab('0x2f')&&typeof _0x445160[_0xf0ab('0x30')]===_0xf0ab('0x2f');var _0x21e8ac=_0x43476c[_0xf0ab('0x31')];var _0x58cbe1=_0x174052?0x0:_0x445160[_0xf0ab('0x2e')];var _0x35973a=_0x174052?_0x43476c['count']:_0x445160['offset']+_0x445160[_0xf0ab('0x30')];var _0x1dc84e;if(_0x35973a>=_0x21e8ac){_0x35973a=_0x21e8ac;_0x1dc84e=0xc8;}else{_0x1dc84e=0xce;}_0x1b223d[_0xf0ab('0x2c')](_0x1dc84e);return _0x1b223d['set']('Content-Range',_0x58cbe1+'-'+_0x35973a+'/'+_0x21e8ac)[_0xf0ab('0x2d')](_0x43476c);}return null;};}function patchUpdates(_0x58fa03){return function(_0x1cfd52){try{jsonpatch['apply'](_0x1cfd52,_0x58fa03,!![]);}catch(_0x3f66fa){return BPromise[_0xf0ab('0x32')](_0x3f66fa);}return _0x1cfd52['save']();};}function saveUpdates(_0x56e728,_0x469f42){return function(_0x27c6f9){if(_0x27c6f9){return _0x27c6f9[_0xf0ab('0x33')](_0x56e728)[_0xf0ab('0x21')](function(_0x2519c7){return _0x2519c7;});}return null;};}function removeEntity(_0x36195d,_0x17f3b3){return function(_0xf8f0f4){if(_0xf8f0f4){return _0xf8f0f4[_0xf0ab('0x34')]()[_0xf0ab('0x21')](function(){_0x36195d[_0xf0ab('0x2c')](0xcc)[_0xf0ab('0x35')]();});}};}function handleEntityNotFound(_0x22dcfe,_0x437fdb){return function(_0x5d8443){if(!_0x5d8443){_0x22dcfe[_0xf0ab('0x2b')](0x194);}return _0x5d8443;};}function handleError(_0x45c449,_0xc575ed){_0xc575ed=_0xc575ed||0x1f4;return function(_0x5c9192){logger[_0xf0ab('0x28')](_0x5c9192[_0xf0ab('0x36')]);if(_0x5c9192[_0xf0ab('0x37')]){delete _0x5c9192['name'];}_0x45c449[_0xf0ab('0x2c')](_0xc575ed)['send'](_0x5c9192);};}function getMustacheRender(_0xda3971,_0x492d7c){return Mustache[_0xf0ab('0x38')](_0xda3971,_[_0xf0ab('0x39')](_0x492d7c[_0xf0ab('0x3a')],{'contact':_0x492d7c[_0xf0ab('0x3b')],'message':_0x492d7c[_0xf0ab('0x2a')],'agent':_0x492d7c[_0xf0ab('0x3c')],'interaction':_0x492d7c['interaction'],'account':_0x492d7c[_0xf0ab('0x3d')]}))||'';}function getInteractionUsers(_0x683d08,_0x5a6df5){return new BPromise(function(_0x207fbb,_0xce89bc){try{if(_0x5a6df5[_0x683d08['id']]){_0x683d08[_0xf0ab('0x3e')]=_[_0xf0ab('0x3f')](_0x5a6df5[_0x683d08['id']],function(_0x31fa72){return{'id':_0x31fa72['id'],'fullname':_0x31fa72[_0xf0ab('0x40')]};});}}catch(_0x28c20c){_0xce89bc(_0x28c20c);}_0x207fbb(_0x683d08);});}function getInteractionTags(_0x528d4b,_0x406a1d){return new BPromise(function(_0x4f6e93,_0x7c4629){try{if(_0x528d4b['TagIds']){_0x528d4b[_0xf0ab('0x41')]=[];_0x528d4b[_0xf0ab('0x42')][_0xf0ab('0x43')](',')[_0xf0ab('0x44')](function(_0x2b7ed5){_0x528d4b['Tags'][_0xf0ab('0x45')](_0x406a1d[_0x2b7ed5]);});}delete _0x528d4b[_0xf0ab('0x42')];}catch(_0x28e7a4){_0x7c4629(_0x28e7a4);}_0x4f6e93(_0x528d4b);});}function updateChatInteraction(_0x197955,_0x191caf,_0x17a73){return new BPromise(function(_0x45849c,_0x413f5c){return getInteractionUsers(_0x197955,_0x17a73)[_0xf0ab('0x21')](function(_0x3b214a){return getInteractionTags(_0x3b214a,_0x191caf);})[_0xf0ab('0x21')](function(_0x32ec93){_0x45849c(_0x32ec93);})[_0xf0ab('0x46')](function(_0x5e6b6b){_0x413f5c(_0x5e6b6b);});});}exports['index']=function(_0x2fc677,_0x4e6c41){var _0x1fc766={},_0x2d50c0={},_0x4bbdf6={'count':0x0,'rows':[]};var _0x8c2d2c=_[_0xf0ab('0x3f')](db['ChatInteraction'][_0xf0ab('0x47')],function(_0x29cc6a){return{'name':_0x29cc6a[_0xf0ab('0x48')],'type':_0x29cc6a[_0xf0ab('0x49')][_0xf0ab('0x4a')]};});_0x2d50c0[_0xf0ab('0x4b')]=_[_0xf0ab('0x3f')](_0x8c2d2c,_0xf0ab('0x37'));_0x2d50c0[_0xf0ab('0x4c')]=_[_0xf0ab('0x4d')](_0x2fc677[_0xf0ab('0x4c')]);_0x2d50c0[_0xf0ab('0x4e')]=_[_0xf0ab('0x4f')](_0x2d50c0[_0xf0ab('0x4b')],_0x2d50c0['query']);_0x1fc766['attributes']=_[_0xf0ab('0x4f')](_0x2d50c0['model'],qs['fields'](_0x2fc677['query'][_0xf0ab('0x50')]));_0x1fc766[_0xf0ab('0x51')]=_0x1fc766[_0xf0ab('0x51')][_0xf0ab('0x52')]?_0x1fc766[_0xf0ab('0x51')]:_0x2d50c0[_0xf0ab('0x4b')];if(!_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x53')](_0xf0ab('0x54'))){_0x1fc766[_0xf0ab('0x30')]=qs[_0xf0ab('0x30')](_0x2fc677[_0xf0ab('0x4c')]['limit']);_0x1fc766[_0xf0ab('0x2e')]=qs[_0xf0ab('0x2e')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x2e')]);}_0x1fc766[_0xf0ab('0x55')]=qs[_0xf0ab('0x56')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x56')]);_0x1fc766['where']=qs['filters'](_['pick'](_0x2fc677[_0xf0ab('0x4c')],_0x2d50c0[_0xf0ab('0x4e')]),_0x8c2d2c);var _0x577c85=[];var _0xa1a416=squel[_0xf0ab('0x57')]()['field']('id')[_0xf0ab('0x58')](_0xf0ab('0x37'))[_0xf0ab('0x58')](_0xf0ab('0x59'))[_0xf0ab('0x5a')](_0xf0ab('0x5b'));var _0x26508b=squel['select']()[_0xf0ab('0x58')]('u.id')[_0xf0ab('0x58')]('u.fullname')[_0xf0ab('0x58')]('ui.ChatInteractionId')['from'](_0xf0ab('0x5c'),'ui')['left_join'](_0xf0ab('0x5d'),'u','u.id\x20=\x20ui.UserId');var _0x2eff07=squel['select']()[_0xf0ab('0x5a')](_0xf0ab('0x5e'),'i')[_0xf0ab('0x5f')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xf0ab('0x5d'),'o',_0xf0ab('0x60'))['left_join']('chat_websites','a',_0xf0ab('0x61'))[_0xf0ab('0x5f')](_0xf0ab('0x62'),'me',_0xf0ab('0x63'))[_0xf0ab('0x5f')](_0xf0ab('0x64'),'it',_0xf0ab('0x65'))[_0xf0ab('0x5f')](_0xf0ab('0x5b'),'t',_0xf0ab('0x66'));var _0x1e6a4e=squel['expr']();var _0x41ed17=[];var _0x5b24e3=squel[_0xf0ab('0x67')]();var _0x61d3db;if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x68')]){_0x61d3db=as[_0xf0ab('0x69')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x68')]);var _0x1f11aa=_0x61d3db[_0xf0ab('0x6a')];for(var _0x180ee6=0x0;_0x180ee6<_0x61d3db['conditions'][_0xf0ab('0x52')];_0x180ee6++){var _0x2266f3=_0x61d3db[_0xf0ab('0x6b')][_0x180ee6];var _0x1d4a72='i';var _0x2232eb=_[_0xf0ab('0x6c')](_0x8c2d2c,[_0xf0ab('0x37'),_0x2266f3[_0xf0ab('0x58')]]);if(!_0x2232eb){switch(_0x2266f3[_0xf0ab('0x58')]){case'unreadMessages':if(_0x2266f3['value']==0x1){_0x2eff07[_0xf0ab('0x6d')]('`'+_0x2266f3[_0xf0ab('0x58')]+_0xf0ab('0x6e'));}else{_0x2eff07['having']('`'+_0x2266f3[_0xf0ab('0x58')]+_0xf0ab('0x6f'));}break;case _0xf0ab('0x70'):if(_0x2266f3['operator']===_0xf0ab('0x71')){if(_0x2266f3[_0xf0ab('0x72')][_0xf0ab('0x43')]('\x20')[_0xf0ab('0x52')]>0x1){_0x1e6a4e[_0x1f11aa](_0xf0ab('0x73'),qs['getFullTextValue'](_0x2266f3[_0xf0ab('0x72')]),null);}else{var _0x70b02d='%'+_0x2266f3[_0xf0ab('0x72')]+'%';_0x1e6a4e[_0x1f11aa](_0xf0ab('0x74'),_0x70b02d,_0x70b02d,_0x70b02d);}}else{_0x2232eb=_[_0xf0ab('0x6c')](_0x8c2d2c,[_0xf0ab('0x37'),_0xf0ab('0x75')]);_0x2266f3[_0xf0ab('0x58')]=_0xf0ab('0x75');_0x5154f5=as[_0xf0ab('0x76')](_0x1d4a72,_0x2232eb[_0xf0ab('0x49')],_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5[_0xf0ab('0x77')],_0x5154f5[_0xf0ab('0x72')]['start'],_0x5154f5['value'][_0xf0ab('0x35')]);}break;case _0xf0ab('0x78'):var _0x325ad6=_0x2266f3['value'][_0xf0ab('0x43')](',')['map'](function(_0x1a32dc){return Number(_0x1a32dc);});_0x325ad6[_0xf0ab('0x44')](function(_0x1787e2){_0x5b24e3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1787e2+',%');});_0x41ed17=_[_0xf0ab('0x79')](_0x41ed17,_0x325ad6);break;case'User':if(_0x2266f3['operator']===_0xf0ab('0x71')){_0x1e6a4e[_0x1f11aa](_0xf0ab('0x7a'),'%'+_0x2266f3[_0xf0ab('0x72')]+'%',null);}else{_0x2232eb=_['find'](_0x8c2d2c,[_0xf0ab('0x37'),_0xf0ab('0x7b')]);_0x2266f3[_0xf0ab('0x58')]=_0xf0ab('0x7b');_0x5154f5=as['buildExpression'](_0x1d4a72,_0x2232eb['type'],_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5['text'],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x7c')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x35')]);}break;case _0xf0ab('0x3a'):_0x5154f5=as[_0xf0ab('0x76')]('me',null,_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5[_0xf0ab('0x77')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x7c')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x35')]);break;}}else{var _0x5154f5=as[_0xf0ab('0x76')](_0x1d4a72,_0x2232eb[_0xf0ab('0x49')],_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5[_0xf0ab('0x77')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x7c')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x35')]);}}}else{var _0x42f067=_(_0x2fc677['query'])[_0xf0ab('0x4d')]()[_0xf0ab('0x3f')](function(_0x4c8e95){return _['some'](_0x8c2d2c,['name',_0x4c8e95])?_0x4c8e95:undefined;})[_0xf0ab('0x7d')]()[_0xf0ab('0x72')]();if(!_[_0xf0ab('0x7e')](_0x42f067)){_0x42f067[_0xf0ab('0x44')](function(_0x15aa78){if(_0x15aa78===_0xf0ab('0x7f')){_0x2eff07['where'](_0xf0ab('0x80'),[]['concat'](_0x2fc677[_0xf0ab('0x4c')][_0x15aa78]));}else if(_0x15aa78==='createdAt'){var _0x2978a9=JSON['parse'](_0x2fc677[_0xf0ab('0x4c')][_0x15aa78])['$gte'];var _0x58ca28=JSON[_0xf0ab('0x81')](_0x2fc677[_0xf0ab('0x4c')][_0x15aa78])[_0xf0ab('0x82')];_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x84'),_0x2978a9,_0x58ca28);}else{if(_0x2fc677[_0xf0ab('0x4c')][_0x15aa78]===_0xf0ab('0x85')){_0x2eff07[_0xf0ab('0x83')]('i.'+_0x15aa78+_0xf0ab('0x86'));}else{_0x2eff07[_0xf0ab('0x83')]('i.'+_0x15aa78+_0xf0ab('0x87'),_0x2fc677[_0xf0ab('0x4c')][_0x15aa78]);}}});}if(_0x2fc677[_0xf0ab('0x4c')]['read']){if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x88')]==0x1){_0x2eff07[_0xf0ab('0x6d')](_0xf0ab('0x89'));}else{_0x2eff07[_0xf0ab('0x6d')](_0xf0ab('0x8a'));}}if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8b')]){_0x41ed17=_[_0xf0ab('0x8c')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8b')])?_0x2fc677[_0xf0ab('0x4c')]['tag']:new Array(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8b')]);_0x41ed17[_0xf0ab('0x44')](function(_0x2196a7){_0x5b24e3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2196a7+',%');});}if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8d')]){var _0x4463cc=_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8d')]['replace']('\x5c','\x5c\x5c')[_0xf0ab('0x8e')](/'/g,'\x27\x27');if(qs[_0xf0ab('0x8f')](_0x4463cc)){_0x1e6a4e['or']('i.id\x20LIKE\x20?',_0x4463cc+'%');}else{_0x1e6a4e['or'](_0xf0ab('0x90'),qs['getFullTextValue'](_0x4463cc))['or'](_0xf0ab('0x91'),_0x4463cc+'%');}}}_0x2eff07[_0xf0ab('0x83')](_0x1e6a4e);_0x2eff07['group'](_0xf0ab('0x92'));var _0x148a72={'type':db['Sequelize']['QueryTypes'][_0xf0ab('0x93')],'raw':!![]};var _0x58140c=_0x2eff07[_0xf0ab('0x94')]();_0x58140c[_0xf0ab('0x58')]('i.id');_0x58140c['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf0ab('0x95'));if(_0x1fc766[_0xf0ab('0x55')]){_0x1fc766[_0xf0ab('0x55')][_0xf0ab('0x44')](function(_0x49c89f){var _0x272f9c=_0x49c89f[0x0]===_0xf0ab('0x96')?_0x49c89f[0x0]:'i.'+_0x49c89f[0x0];_0x2eff07[_0xf0ab('0x55')](_0x272f9c,_0x49c89f[0x1]===_0xf0ab('0x97')?![]:!![]);});}if(!_[_0xf0ab('0x7e')](_0x41ed17)){_0x2eff07['having'](_0x5b24e3);_0x58140c['where'](_0xf0ab('0x98'),_0x41ed17);}BPromise[_0xf0ab('0x99')]()['then'](function(){if(!_0x61d3db){if(_0x2fc677['query'][_0xf0ab('0x7f')])return;_0x58140c[_0xf0ab('0x83')](_0xf0ab('0x9a'));_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x9a'));return;}if(_0x2fc677[_0xf0ab('0x9b')][_0xf0ab('0x9c')]!==_0xf0ab('0x3c'))return;return _0x2fc677[_0xf0ab('0x9b')][_0xf0ab('0x9d')]({'attributes':['id'],'raw':!![]})[_0xf0ab('0x21')](function(_0x52eca9){if(_['isEmpty'](_0x52eca9)){_0x58140c[_0xf0ab('0x83')]('i.ChatWebsiteId\x20IS\x20NULL');_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x9e'));}else{_0x58140c[_0xf0ab('0x83')](_0xf0ab('0x80'),_['map'](_0x52eca9,'id'));_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x80'),_[_0xf0ab('0x3f')](_0x52eca9,'id'));}});})[_0xf0ab('0x21')](function(){if(_0x2fc677[_0xf0ab('0x9b')][_0xf0ab('0x9c')]===_0xf0ab('0x3c')&&!_0x61d3db&&!_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x7f')])return[];return db[_0xf0ab('0x9f')][_0xf0ab('0x4c')](_0x58140c[_0xf0ab('0xa0')](),_0x148a72);})[_0xf0ab('0x21')](function(_0x4211a1){_0x4bbdf6['count']=_0x4211a1[_0xf0ab('0x52')];if(_0x4bbdf6[_0xf0ab('0x31')]===0x0)return[];return db[_0xf0ab('0x9f')][_0xf0ab('0x4c')](_0xa1a416[_0xf0ab('0xa0')](),_0x148a72)[_0xf0ab('0x21')](function(_0x611cf7){_0x577c85=_['keyBy'](_0x611cf7,'id');_0x148a72=_['merge'](_0x148a72,{'model':db[_0xf0ab('0xa1')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x50')]){_0x1fc766['attributes'][_0xf0ab('0x44')](function(_0x405b34){_0x2eff07[_0xf0ab('0x58')]('i.'+_0x405b34);});}else{_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa2'),'unreadMessages');_0x2eff07['field'](_0xf0ab('0xa3'),'Account.key');_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa4'),'Account.mandatoryDisposition');_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa5'),_0xf0ab('0x96'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa6'));_0x2eff07['field'](_0xf0ab('0xa7'),_0xf0ab('0xa8'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa9'),_0xf0ab('0xaa'));_0x2eff07['field'](_0xf0ab('0xab'),_0xf0ab('0xac'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xad'),_0xf0ab('0xae'));_0x2eff07['field'](_0xf0ab('0xaf'),_0xf0ab('0xb0'));_0x2eff07[_0xf0ab('0x58')]('c.fax',_0xf0ab('0xb1'));_0x2eff07['field'](_0xf0ab('0xb2'),_0xf0ab('0xb3'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xb4'),'Owner.internal');_0x2eff07[_0xf0ab('0x58')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x1fc766[_0xf0ab('0x30')])_0x2eff07['limit'](_0x1fc766['limit']);if(_0x1fc766[_0xf0ab('0x2e')])_0x2eff07[_0xf0ab('0x2e')](_0x1fc766['offset']);return db['sequelize']['query'](_0x2eff07['toString'](),_0x148a72);})[_0xf0ab('0x21')](function(_0x12d9b6){if(_0x12d9b6[_0xf0ab('0x52')]>0x0)_0x26508b[_0xf0ab('0x83')](_0xf0ab('0xb5'),_['map'](_0x12d9b6,'id'));return db[_0xf0ab('0x9f')][_0xf0ab('0x4c')](_0x26508b[_0xf0ab('0xa0')](),_0x148a72)[_0xf0ab('0x21')](function(_0x84eab9){var _0x27cd98=_[_0xf0ab('0xb6')](_0x84eab9,'ChatInteractionId');var _0x16dca7=[];_0x12d9b6[_0xf0ab('0x44')](function(_0x39633a){_0x16dca7[_0xf0ab('0x45')](updateChatInteraction(_0x39633a,_0x577c85,_0x27cd98));});return BPromise[_0xf0ab('0xb7')](_0x16dca7);});});})[_0xf0ab('0x21')](function(_0x527a4b){_0x4bbdf6[_0xf0ab('0xb8')]=_0x527a4b;return _0x4bbdf6;})[_0xf0ab('0x21')](respondWithFilteredResult(_0x4e6c41,_0x1fc766))[_0xf0ab('0x46')](handleError(_0x4e6c41,null));};exports[_0xf0ab('0xb9')]=function(_0x4ca7a3,_0x426419){var _0x395bf6={'raw':![],'where':{'id':_0x4ca7a3['params']['id']}},_0x5b7744={};_0x5b7744[_0xf0ab('0x4b')]=_[_0xf0ab('0x4d')](db[_0xf0ab('0xa1')][_0xf0ab('0x47')]);_0x5b7744[_0xf0ab('0x4c')]=_[_0xf0ab('0x4d')](_0x4ca7a3[_0xf0ab('0x4c')]);_0x5b7744[_0xf0ab('0x4e')]=_['intersection'](_0x5b7744[_0xf0ab('0x4b')],_0x5b7744['query']);_0x395bf6['attributes']=_[_0xf0ab('0x4f')](_0x5b7744[_0xf0ab('0x4b')],qs[_0xf0ab('0x50')](_0x4ca7a3[_0xf0ab('0x4c')][_0xf0ab('0x50')]));_0x395bf6[_0xf0ab('0x51')]=_0x395bf6[_0xf0ab('0x51')][_0xf0ab('0x52')]?_0x395bf6['attributes']:_0x5b7744[_0xf0ab('0x4b')];if(_0x4ca7a3[_0xf0ab('0x4c')][_0xf0ab('0xba')]){_0x395bf6[_0xf0ab('0xbb')]=[{'all':!![]}];}_0x395bf6=_[_0xf0ab('0x39')]({},_0x395bf6,_0x4ca7a3[_0xf0ab('0xbc')]);return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')](_0x395bf6)[_0xf0ab('0x21')](handleEntityNotFound(_0x426419,null))[_0xf0ab('0x21')](respondWithResult(_0x426419,null))['catch'](handleError(_0x426419,null));};exports['create']=function(_0x58946c,_0x2f339d){return db['ChatInteraction']['create'](_0x58946c[_0xf0ab('0x3a')],{})[_0xf0ab('0x21')](respondWithResult(_0x2f339d,0xc9))[_0xf0ab('0x46')](handleError(_0x2f339d,null));};exports[_0xf0ab('0x33')]=function(_0xdf495,_0x55a296){if(_0xdf495[_0xf0ab('0x3a')]['id']){delete _0xdf495[_0xf0ab('0x3a')]['id'];}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0xdf495[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x55a296,null))[_0xf0ab('0x21')](saveUpdates(_0xdf495[_0xf0ab('0x3a')],null))['then'](respondWithResult(_0x55a296,null))[_0xf0ab('0x46')](handleError(_0x55a296,null));};exports['destroy']=function(_0x3c1a2c,_0x17a3b6){return db['ChatInteraction'][_0xf0ab('0x6c')]({'where':{'id':_0x3c1a2c[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x17a3b6,null))[_0xf0ab('0x21')](removeEntity(_0x17a3b6,null))[_0xf0ab('0x46')](handleError(_0x17a3b6,null));};exports[_0xf0ab('0xbe')]=function(_0x1f2efa,_0x1d12fb){return db[_0xf0ab('0xa1')]['describe']()[_0xf0ab('0x21')](respondWithResult(_0x1d12fb,null))[_0xf0ab('0x46')](handleError(_0x1d12fb,null));};exports['createVidaooSession']=function(_0x35486d,_0x3f5ade){var _0x135a10=_0x35486d[_0xf0ab('0xbd')]['id'];var _0x48fc7e;var _0x5f55d2;var _0x7c7c3b;return db[_0xf0ab('0xa1')]['findOne']({'where':{'id':_0x135a10}})[_0xf0ab('0x21')](function(_0x2beaaa){_0x48fc7e=_0x2beaaa;return db[_0xf0ab('0xbf')][_0xf0ab('0xc0')]({'where':{'id':_0x2beaaa[_0xf0ab('0x7f')]},'attributes':['id',_0xf0ab('0xc1'),'vidaooEscalation',_0xf0ab('0xc2'),'vidaooNote',_0xf0ab('0xc3')],'raw':!![]});})[_0xf0ab('0x21')](function(_0x354e18){if(_0x354e18&&_0x354e18['vidaooApiKey']&&_0x354e18[_0xf0ab('0xc4')]){_0x5f55d2=_0x354e18;var _0x2068d6={'interaction':{'id':_0x135a10},'agent':{'id':_0x35486d[_0xf0ab('0x9b')]['id'],'name':_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0x37')],'fullname':_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0x40')],'email':_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0xc5')]},'contact':_0x35486d['body']['contact'],'account':_0x35486d[_0xf0ab('0x3a')][_0xf0ab('0x3d')]};var _0x35b480={'rejectUnauthorized':![],'method':_0xf0ab('0xc6'),'url':_0xf0ab('0xc7'),'headers':{'X-APIKEY':_0x354e18[_0xf0ab('0xc1')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0xc5')]],'buttons':null,'topic':_0x5f55d2[_0xf0ab('0xc2')],'note':_[_0xf0ab('0xc8')](_0x5f55d2['vidaooNote'])?null:getMustacheRender(_0x5f55d2[_0xf0ab('0xc9')],_0x2068d6),'metadata':null},'redirect':_0xf0ab('0xca'),'json':!![]};try{if(!_[_0xf0ab('0xc8')](_0x5f55d2[_0xf0ab('0xc3')])){var _0x41e2d8=getMustacheRender(_0x5f55d2[_0xf0ab('0xc3')],_0x2068d6);var _0x57f44d=JSON[_0xf0ab('0x81')](_0x41e2d8);_0x35b480[_0xf0ab('0x3a')][_0xf0ab('0xcb')]=_0x57f44d;}}catch(_0x533b37){throw new db[(_0xf0ab('0xcc'))]['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x35b480);}else{throw new db[(_0xf0ab('0xcc'))][(_0xf0ab('0xcd'))](_0xf0ab('0xce'));}})['then'](function(_0x1697ca){_0x7c7c3b=_0x1697ca;if(_0x7c7c3b['id']){var _0x15da8a={'body':_0x7c7c3b[_0xf0ab('0xcf')],'ChatWebsiteId':_0x5f55d2['id'],'ChatInteractionId':_0x48fc7e['id'],'direction':'out','UserId':_0x35486d[_0xf0ab('0x9b')]['id']};return db[_0xf0ab('0xd0')][_0xf0ab('0xd1')](_0x15da8a,{});}else{throw new db['Sequelize'][(_0xf0ab('0xcd'))](_0xf0ab('0xd2'));}})[_0xf0ab('0x21')](function(){return _0x48fc7e[_0xf0ab('0xd3')]({'vidaooSessionId':_0x7c7c3b['id']});})[_0xf0ab('0x21')](respondWithResult(_0x3f5ade,null))[_0xf0ab('0x46')](handleError(_0x3f5ade,null));};exports[_0xf0ab('0xd4')]=function(_0x115e3d,_0x2d0f9c){if(_0x115e3d[_0xf0ab('0x3a')]['id']){delete _0x115e3d[_0xf0ab('0x3a')]['id'];}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0x115e3d[_0xf0ab('0xbd')]['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0xf0ab('0x21')](handleEntityNotFound(_0x2d0f9c,null))[_0xf0ab('0x21')](saveUpdates(_0x115e3d['body'],null))[_0xf0ab('0x21')](respondWithResult(_0x2d0f9c,null))['catch'](handleError(_0x2d0f9c,null));};exports[_0xf0ab('0xd5')]=function(_0x1e9768,_0x4398a3,_0x4195d9){if(_0x1e9768[_0xf0ab('0x3a')]['id']){delete _0x1e9768[_0xf0ab('0x3a')]['id'];}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0x1e9768[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](function(_0x5f10a5){if(!_0x5f10a5){logger[_0xf0ab('0x28')](_0xf0ab('0xd6'),_0xf0ab('0xd5'),0x194,_0xf0ab('0xd7'));_0x4398a3[_0xf0ab('0x2b')](0x194);}else{if(_0x5f10a5[_0xf0ab('0x7b')]){throw new db['Sequelize']['ValidationError'](_0xf0ab('0xd8'));}}return _0x5f10a5;})[_0xf0ab('0x21')](function(_0x564124){if(_0x564124){return _0x564124[_0xf0ab('0x33')]({'closed':_0x1e9768[_0xf0ab('0x3a')][_0xf0ab('0xd9')],'disposition':_0x1e9768['body'][_0xf0ab('0xda')]})[_0xf0ab('0x21')](function(_0x2d9046){return _0x2d9046;});}})[_0xf0ab('0x21')](function(_0x4e5f1e){return respondWithRpcPromise(_0xf0ab('0xdb'),_0xf0ab('0xd5'),_0x1e9768[_0xf0ab('0x3a')],client9004);})['then'](respondWithResult(_0x4398a3,null))['catch'](handleError(_0x4398a3,null));};exports['attachmentUpload']=function(_0x581cb1,_0x22251d,_0x2b5993){_0x581cb1[_0xf0ab('0x3a')]['name']=_0x581cb1[_0xf0ab('0xdc')]['originalname'];_0x581cb1[_0xf0ab('0x3a')][_0xf0ab('0xdd')]=_0x581cb1[_0xf0ab('0xdc')][_0xf0ab('0xde')];_0x581cb1[_0xf0ab('0x3a')][_0xf0ab('0x49')]=_0x581cb1[_0xf0ab('0xdc')][_0xf0ab('0xdf')];return db[_0xf0ab('0xe0')][_0xf0ab('0xd1')](_0x581cb1[_0xf0ab('0x3a')])[_0xf0ab('0x21')](respondWithResult(_0x22251d,0xc9))[_0xf0ab('0x46')](handleError(_0x22251d,null));};exports[_0xf0ab('0xe1')]=function(_0x4d09bf,_0x415b9d,_0x11ed58){return db[_0xf0ab('0xa1')]['findOne']({'where':{'id':_0x4d09bf[_0xf0ab('0xbd')]['id']},'raw':!![]})[_0xf0ab('0x21')](handleEntityNotFound(_0x415b9d,null))[_0xf0ab('0x21')](function(_0x278e32){if(_0x278e32){if(_0x278e32['closed']){return _0x415b9d[_0xf0ab('0x2c')](0x193)[_0xf0ab('0x2d')]({'status':0x193,'message':_0xf0ab('0xe2')});}return db[_0xf0ab('0xe0')][_0xf0ab('0xc0')]({'where':{'id':_0x4d09bf[_0xf0ab('0x4c')][_0xf0ab('0xe3')]},'raw':!![]})[_0xf0ab('0x21')](handleEntityNotFound(_0x415b9d,null));}})['then'](function(_0xadae03){if(_0xadae03){var _0x550b00=_0xadae03[_0xf0ab('0xe4')]!==null;var _0x2bfb6a=path[_0xf0ab('0xe5')](config['root'],_0xf0ab('0xe6'));if(_0x550b00){_0x2bfb6a=path[_0xf0ab('0xe5')](_0x2bfb6a,'offline-chat/');}var _0x5d62e4=path['join'](_0x2bfb6a,_0xadae03['basename']);return _0x415b9d[_0xf0ab('0xe7')](_0x5d62e4);}})['catch'](handleError(_0x415b9d,null));};exports['close']=function(_0x3b8bbe,_0x7e24c4){var _0x2d0ea3=null;var _0x4a18ad=null;var _0x57aaae=null;var _0x2ab0be=null;if(_0x3b8bbe[_0xf0ab('0x3a')]['id']){delete _0x3b8bbe['body']['id'];}if(_0x3b8bbe[_0xf0ab('0x3a')][_0xf0ab('0xe8')]){_0x2ab0be=path['join'](config['root'],'server/files/chat/upload/',util[_0xf0ab('0xe9')](_0xf0ab('0xea'),Date[_0xf0ab('0xeb')]()));_0x3b8bbe[_0xf0ab('0x3a')]['pathTranscript']=_0x2ab0be;}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0x3b8bbe['params']['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0xf0ab('0xec')],'as':'User'}]}]})[_0xf0ab('0x21')](handleEntityNotFound(_0x7e24c4,null))[_0xf0ab('0x21')](saveUpdates(_0x3b8bbe[_0xf0ab('0x3a')],null))[_0xf0ab('0x21')](function(_0x116c84){if(_0x116c84){_0x2d0ea3=_0x116c84;return db[_0xf0ab('0xbf')][_0xf0ab('0x6c')]({'where':{'id':_0x2d0ea3[_0xf0ab('0x7f')]}});}})[_0xf0ab('0x21')](function(_0x1d6e15){if(_0x1d6e15){_0x57aaae=_0x1d6e15;return db[_0xf0ab('0xed')][_0xf0ab('0x6c')]({'where':{'id':_0x2d0ea3['ContactId']}});}})[_0xf0ab('0x21')](function(_0x29427c){if(_0x29427c){_0x4a18ad=_0x29427c;if(_0x2ab0be){var _0x29d4a1=null;for(var _0x50e996=0x1;_0x50e996<_0x2d0ea3['Messages'][_0xf0ab('0x52')];++_0x50e996){_0x29d4a1=_0x2d0ea3[_0xf0ab('0xee')][_0x50e996];var _0x8e04bb=_0x29d4a1[_0xf0ab('0x7b')]?util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0x57aaae[_0xf0ab('0xf0')],_0x29d4a1[_0xf0ab('0x7b')]):_0xf0ab('0xf1');var _0xc1537e=_0x3b8bbe[_0xf0ab('0x3a')][_0xf0ab('0xf2')]||util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0xf0ab('0xf3'),_0x29d4a1[_0xf0ab('0x75')]);switch(_0x57aaae[_0xf0ab('0xf4')]){case _0xf0ab('0xf5'):_0x8e04bb=_0x29d4a1[_0xf0ab('0x7b')]?util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0x57aaae['agentAlias'],_0x29d4a1[_0xf0ab('0x7b')]):'System';break;case _0xf0ab('0xf6'):_0x8e04bb=_0x29d4a1[_0xf0ab('0x7b')]?_0x29d4a1[_0xf0ab('0xec')][_0xf0ab('0xf7')]||_0x29d4a1['User'][_0xf0ab('0x40')]:'System';break;case'agent_fullname':_0x8e04bb=_0x29d4a1['UserId']?_0x29d4a1[_0xf0ab('0xec')][_0xf0ab('0x40')]:_0xf0ab('0xf1');break;default:_0x8e04bb=_0x29d4a1['UserId']?util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0x57aaae[_0xf0ab('0xf0')],_0x29d4a1[_0xf0ab('0x7b')]):_0xf0ab('0xf1');}var _0x2c39f0=util[_0xf0ab('0xe9')](_0xf0ab('0xf8'),moment(_0x29d4a1[_0xf0ab('0xf9')])[_0xf0ab('0xe9')](_0xf0ab('0xfa')),_0x29d4a1[_0xf0ab('0xfb')]==='in'?_0xc1537e:_0x8e04bb,_0x29d4a1['body']);if(!_0x29d4a1[_0xf0ab('0xfc')]){fs[_0xf0ab('0xfd')](_0x2ab0be,_0x2c39f0);}}return db[_0xf0ab('0xfe')][_0xf0ab('0xc0')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xf0ab('0xff'),'raw':!![]}]});}}})['then'](function(_0x21eb2b){if(_0x21eb2b&&_0x21eb2b['Smtp']&&_0x3b8bbe[_0xf0ab('0x3a')]){var _0x262659={'tls':{'rejectUnauthorized':![]}};if(_0x21eb2b['Smtp'][_0xf0ab('0x100')]){_0x262659[_0xf0ab('0x100')]=_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x100')];}else{_0x262659[_0xf0ab('0x101')]=_0x21eb2b['Smtp'][_0xf0ab('0x101')];_0x262659[_0xf0ab('0x102')]=_0x21eb2b[_0xf0ab('0xff')]['port'];_0x262659['secure']=_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x103')];}if(_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x104')]){_0x262659['auth']={'user':_0x21eb2b['Smtp'][_0xf0ab('0x9b')],'pass':_0x21eb2b[_0xf0ab('0xff')]['pass']};}return respondWithRpcPromise('SendMail',_0xf0ab('0x105'),{'account':_0x262659,'message':{'from':util['format'](_0xf0ab('0x106'),_0x21eb2b['name'],_0x21eb2b[_0xf0ab('0xc5')]||_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x9b')]),'to':_0x3b8bbe[_0xf0ab('0x3a')][_0xf0ab('0xe8')],'subject':_0xf0ab('0x107'),'text':util[_0xf0ab('0xe9')](_0xf0ab('0x108'),_0x3b8bbe['body'][_0xf0ab('0xe8')]),'attachments':[{'path':_0x2ab0be}]}})[_0xf0ab('0x21')](function(){return _0x2d0ea3;})[_0xf0ab('0x46')](function(_0x15f041){console[_0xf0ab('0x28')](_0x15f041);});}else{return _0x2d0ea3;}})['then'](respondWithStatusCode(_0x7e24c4,0xc8))[_0xf0ab('0x46')](handleError(_0x7e24c4,null));};exports[_0xf0ab('0x109')]=function(_0x5eda4b,_0x57a8ab,_0x3cee1d){return db[_0xf0ab('0xd0')][_0xf0ab('0x6c')]({'where':{'id':_0x5eda4b[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x57a8ab,null))[_0xf0ab('0x21')](function(_0x4dff6e){if(_0x4dff6e){return _0x4dff6e[_0xf0ab('0x109')](_0x5eda4b[_0xf0ab('0x3a')][_0xf0ab('0x10a')],_[_0xf0ab('0x10b')](_0x5eda4b[_0xf0ab('0x3a')],[_0xf0ab('0x10a'),'id'])||{});}})['then'](respondWithResult(_0x57a8ab,null))[_0xf0ab('0x46')](handleError(_0x57a8ab,null));};exports['getMessages']=function(_0x283bf5,_0x1afcea,_0x22a9f8){var _0x33dbfc={'raw':![],'where':{}};var _0x487318={};var _0x546e13={'count':0x0,'rows':[]};return db[_0xf0ab('0xa1')]['findOne']({'where':{'id':_0x283bf5[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x1afcea,null))[_0xf0ab('0x21')](function(_0xa3b903){if(_0xa3b903){_0x487318['model']=_[_0xf0ab('0x4d')](db[_0xf0ab('0xd0')][_0xf0ab('0x47')]);_0x487318[_0xf0ab('0x4c')]=_['keys'](_0x283bf5[_0xf0ab('0x4c')]);_0x487318[_0xf0ab('0x4e')]=_['intersection'](_0x487318[_0xf0ab('0x4b')],_0x487318[_0xf0ab('0x4c')]);_0x33dbfc[_0xf0ab('0x51')]=_[_0xf0ab('0x4f')](_0x487318[_0xf0ab('0x4b')],qs['fields'](_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0x50')]));_0x33dbfc[_0xf0ab('0x51')]=_0x33dbfc['attributes'][_0xf0ab('0x52')]?_0x33dbfc[_0xf0ab('0x51')]:_0x487318[_0xf0ab('0x4b')];if(!_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0x53')](_0xf0ab('0x54'))){_0x33dbfc[_0xf0ab('0x30')]=qs[_0xf0ab('0x30')](_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0x30')]);_0x33dbfc['offset']=qs['offset'](_0x283bf5[_0xf0ab('0x4c')]['offset']);}_0x33dbfc['order']=qs[_0xf0ab('0x56')](_0x283bf5[_0xf0ab('0x4c')]['sort']);_0x33dbfc[_0xf0ab('0x83')]=qs[_0xf0ab('0x4e')](_[_0xf0ab('0x10c')](_0x283bf5['query'],_0x487318[_0xf0ab('0x4e')]));_0x33dbfc['where'][_0xf0ab('0x10d')]=_0xa3b903['id'];if(_0x283bf5['query'][_0xf0ab('0x8d')]){_0x33dbfc[_0xf0ab('0x83')]=_[_0xf0ab('0x39')](_0x33dbfc['where'],{'$or':_[_0xf0ab('0x3f')](_0x33dbfc[_0xf0ab('0x51')],function(_0x2ddc1d){var _0x3cef14={};_0x3cef14[_0x2ddc1d]={'$like':'%'+_0x283bf5['query'][_0xf0ab('0x8d')]+'%'};return _0x3cef14;})});}if(_0x283bf5[_0xf0ab('0x4c')]['$gte']){var _0x38ea18=_0x283bf5[_0xf0ab('0x4c')]['$gte']['split'](',');var _0x7ee6b3={};_0x7ee6b3[_0x38ea18[0x0]]={'$gte':moment(_0x38ea18[0x1])[_0xf0ab('0xe9')](_0xf0ab('0x10e'))};_0x33dbfc['where']=_[_0xf0ab('0x39')](_0x33dbfc['where'],_0x7ee6b3);}_0x33dbfc=_[_0xf0ab('0x39')]({},_0x33dbfc,_0x283bf5['options']);return db[_0xf0ab('0xd0')]['count']({'where':_0x33dbfc['where']})['then'](function(_0x1d1451){_0x546e13['count']=_0x1d1451;if(_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0xba')]){_0x33dbfc[_0xf0ab('0xbb')]=[{'all':!![]}];}return db[_0xf0ab('0xd0')][_0xf0ab('0x10f')](_0x33dbfc);})['then'](function(_0x16a1d2){_0x546e13[_0xf0ab('0xb8')]=_0x16a1d2;return _0x546e13;});}})[_0xf0ab('0x21')](respondWithFilteredResult(_0x1afcea,_0x33dbfc))[_0xf0ab('0x46')](handleError(_0x1afcea,null));};exports[_0xf0ab('0x110')]=function(_0x4b91de,_0x3a602f,_0x47788a){var _0x3592f1={'where':{}},_0x577f13={},_0x2f99c2={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xf0ab('0xc0')]({'where':{'id':_0x4b91de[_0xf0ab('0xbd')]['id']}})['then'](handleEntityNotFound(_0x3a602f,null))['then'](function(_0x43c6b8){if(_0x43c6b8){_0x577f13['model']=_[_0xf0ab('0x4d')](db[_0xf0ab('0xd0')][_0xf0ab('0x47')]);_0x577f13[_0xf0ab('0x4c')]=_[_0xf0ab('0x4d')](_0x4b91de[_0xf0ab('0x4c')]);_0x577f13['filters']=_[_0xf0ab('0x4f')](_0x577f13[_0xf0ab('0x4b')],_0x577f13[_0xf0ab('0x4c')]);_0x3592f1[_0xf0ab('0x51')]=_[_0xf0ab('0x4f')](_0x577f13[_0xf0ab('0x4b')],qs[_0xf0ab('0x50')](_0x4b91de['query'][_0xf0ab('0x50')]));_0x3592f1[_0xf0ab('0x51')]=_0x3592f1['attributes'][_0xf0ab('0x52')]?_0x3592f1['attributes']:_0x577f13[_0xf0ab('0x4b')];if(!_0x4b91de['query']['hasOwnProperty']('nolimit')){_0x3592f1[_0xf0ab('0x30')]=qs[_0xf0ab('0x30')](_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x30')]);_0x3592f1[_0xf0ab('0x2e')]=qs[_0xf0ab('0x2e')](_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x2e')]);}_0x3592f1[_0xf0ab('0x55')]=qs[_0xf0ab('0x56')](_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x56')]);_0x3592f1[_0xf0ab('0x83')]=qs[_0xf0ab('0x4e')](_[_0xf0ab('0x10c')](_0x4b91de[_0xf0ab('0x4c')],_0x577f13[_0xf0ab('0x4e')]));_0x3592f1['where'][_0xf0ab('0x10d')]=_0x43c6b8['id'];if(_0x4b91de['query'][_0xf0ab('0x8d')]){_0x3592f1['where']=_[_0xf0ab('0x39')](_0x3592f1[_0xf0ab('0x83')],{'$or':_[_0xf0ab('0x3f')](_0x3592f1['attributes'],function(_0x58f64c){var _0x5dc7d4={};_0x5dc7d4[_0x58f64c]={'$like':'%'+_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x8d')]+'%'};return _0x5dc7d4;})});}_0x3592f1['where'][_0xf0ab('0xfc')]=![];if(_0x4b91de[_0xf0ab('0x4c')]['id']){_0x3592f1[_0xf0ab('0x83')]['id']={'$gt':_0x4b91de[_0xf0ab('0x4c')]['id']};}_0x3592f1=_['merge']({},_0x3592f1,_0x4b91de['options']);return db[_0xf0ab('0xd0')][_0xf0ab('0x31')]({'where':_0x3592f1[_0xf0ab('0x83')]})[_0xf0ab('0x21')](function(_0x2ab983){_0x2f99c2['count']=_0x2ab983;_0x3592f1[_0xf0ab('0xbb')]=[];if(_0x4b91de['query'][_0xf0ab('0x111')]){_0x3592f1[_0xf0ab('0xbb')][_0xf0ab('0x45')]({'model':db['User'],'as':_0xf0ab('0xec'),'attributes':['id',_0xf0ab('0x40'),_0xf0ab('0xf7')]});}if(_0x4b91de[_0xf0ab('0x4c')]['includeAll']){_0x3592f1[_0xf0ab('0xbb')]=[{'all':!![]}];}return db[_0xf0ab('0xd0')][_0xf0ab('0x10f')](_0x3592f1);})[_0xf0ab('0x21')](function(_0x3d70c0){_0x2f99c2[_0xf0ab('0xb8')]=_0x3d70c0;return _0x2f99c2;});}})[_0xf0ab('0x21')](respondWithFilteredResult(_0x3a602f,_0x3592f1))[_0xf0ab('0x46')](handleError(_0x3a602f,null));};exports['addTags']=function(_0x4d10af,_0x5cf4bd,_0x368523){return db['ChatInteraction'][_0xf0ab('0x6c')]({'where':{'id':_0x4d10af['params']['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x5cf4bd,null))[_0xf0ab('0x21')](function(_0x46a38a){if(_0x46a38a){return _0x46a38a[_0xf0ab('0x112')](_0x4d10af[_0xf0ab('0x3a')][_0xf0ab('0x10a')],_['omit'](_0x4d10af[_0xf0ab('0x3a')],[_0xf0ab('0x10a'),'id'])||{})[_0xf0ab('0x113')](function(){return db['Tag'][_0xf0ab('0x10f')]({'attributes':['id',_0xf0ab('0x37'),_0xf0ab('0x59')],'where':{'id':_0x4d10af[_0xf0ab('0x3a')][_0xf0ab('0x10a')]}});})[_0xf0ab('0x21')](function(_0x1df97b){socket[_0xf0ab('0x114')](_0xf0ab('0x115'),{'id':Number(_0x4d10af[_0xf0ab('0xbd')]['id']),'tags':_0x1df97b||[]});return{'id':Number(_0x4d10af[_0xf0ab('0xbd')]['id']),'tags':_0x1df97b||[]};});}})[_0xf0ab('0x21')](respondWithResult(_0x5cf4bd,null))['catch'](handleError(_0x5cf4bd,null));};exports[_0xf0ab('0x116')]=function(_0x3ca465,_0x4e379d,_0x122e66){return db['ChatInteraction'][_0xf0ab('0x6c')]({'where':{'id':_0x3ca465[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x4e379d,null))[_0xf0ab('0x21')](function(_0x5c56e0){if(_0x5c56e0){return _0x5c56e0[_0xf0ab('0x116')](_0x3ca465[_0xf0ab('0x4c')][_0xf0ab('0x10a')]);}})['then'](respondWithStatusCode(_0x4e379d,null))[_0xf0ab('0x46')](handleError(_0x4e379d,null));};exports[_0xf0ab('0xe7')]=function(_0x2baa40,_0x4ff52d){var _0x2a2fea=moment()[_0xf0ab('0x117')]()[_0xf0ab('0xa0')]();var _0x4eccbd=path['join'](config['root'],_0xf0ab('0x118'),_0xf0ab('0x119'),_0xf0ab('0x11a'));var _0x5b6475=path[_0xf0ab('0xe5')](config[_0xf0ab('0x11b')],'server',_0xf0ab('0x119'),_0xf0ab('0x11c'));var _0x595bda=path[_0xf0ab('0xe5')](_0x4eccbd,_0x2a2fea);var _0x2bd3e3=util['format']('transcript-%d-%s.zip',_0x2baa40[_0xf0ab('0xbd')]['id'],_0x2a2fea);var _0x25242e=path[_0xf0ab('0xe5')](_0x4eccbd,_0x2bd3e3);var _0x3d8794=[];_0x3d8794[_0xf0ab('0x45')]({'model':db['User'],'as':_0xf0ab('0xec'),'attributes':['id','fullname'],'raw':!![]});_0x3d8794[_0xf0ab('0x45')]({'model':db[_0xf0ab('0xed')],'as':_0xf0ab('0x70'),'attributes':['id','firstName',_0xf0ab('0x11d')],'raw':!![]});if(_0x2baa40[_0xf0ab('0x4c')][_0xf0ab('0x11c')]){_0x3d8794[_0xf0ab('0x45')]({'model':db[_0xf0ab('0xe0')],'as':'Attachment','raw':!![]});}var _0x243763=[{'model':db[_0xf0ab('0xd0')],'as':_0xf0ab('0xee'),'attributes':['id',_0xf0ab('0x3a'),'createdAt',_0xf0ab('0xfb'),_0xf0ab('0xfc'),_0xf0ab('0x88')],'include':_0x3d8794}];_0x243763['push']({'model':db[_0xf0ab('0xbf')],'as':_0xf0ab('0x11e'),'attributes':['id',_0xf0ab('0x37')]});_0x243763['push']({'model':db[_0xf0ab('0xec')],'as':_0xf0ab('0x11f'),'attributes':['id',_0xf0ab('0x40')]});return db[_0xf0ab('0xa1')]['find']({'where':{'id':_0x2baa40[_0xf0ab('0xbd')]['id']},'include':_0x243763})[_0xf0ab('0x21')](handleEntityNotFound(_0x4ff52d,null))[_0xf0ab('0x21')](function(_0x2c2e20){if(_0x2c2e20){var _0x57bd77=_0x2c2e20[_0xf0ab('0x120')]({'plain':!![]});fs[_0xf0ab('0x121')](_0x595bda);var _0x169b02={'channel':_0xf0ab('0x122'),'account':_0x57bd77[_0xf0ab('0x11e')]['name'],'agent':_0x57bd77[_0xf0ab('0x11f')]?_0x57bd77['Owner'][_0xf0ab('0x40')]:_0xf0ab('0x123'),'createdAt':moment(_0x57bd77[_0xf0ab('0xf9')])['format'](_0xf0ab('0x10e'))['toString'](),'closedAt':_0x57bd77['closed']?moment(_0x57bd77['closedAt'])[_0xf0ab('0xe9')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x57bd77[_0xf0ab('0xda')],'chatInfo':{'browser':_0x57bd77[_0xf0ab('0x124')],'os':_0x57bd77[_0xf0ab('0x125')],'referer':_0x57bd77[_0xf0ab('0x126')],'customerIp':_0x57bd77[_0xf0ab('0x127')],'customerPort':_0x57bd77['customerPort']?_0x57bd77[_0xf0ab('0x128')]:_0xf0ab('0x123')},'messages':_(_0x57bd77['Messages'])[_0xf0ab('0x129')]()[_0xf0ab('0x8d')]({'secret':![]})[_0xf0ab('0x3f')](function(_0x2aa512){if(_0x2aa512['Attachment']){var _0x26009e=path[_0xf0ab('0xe5')](_0x5b6475,_0x2aa512['Attachment'][_0xf0ab('0xdd')]);if(fs[_0xf0ab('0x12a')](_0x26009e)){fs['createReadStream'](_0x26009e)[_0xf0ab('0x12b')](fs[_0xf0ab('0x12c')](path['join'](_0x595bda,_0x2aa512[_0xf0ab('0xe0')][_0xf0ab('0xdd')])));}}return{'date':moment(_0x2aa512[_0xf0ab('0xf9')])[_0xf0ab('0xe9')](_0xf0ab('0x10e'))['toString'](),'sender':_0x2aa512[_0xf0ab('0xfb')]==='out'?_0x2aa512[_0xf0ab('0xec')]?_0x2aa512['User'][_0xf0ab('0x40')]:_0xf0ab('0xf1'):_0x2aa512[_0xf0ab('0x70')][_0xf0ab('0x12d')]+(_0x2aa512[_0xf0ab('0x70')][_0xf0ab('0x11d')]?'\x20'+_0x2aa512[_0xf0ab('0x70')]['lastName']:''),'body':_0x2aa512[_0xf0ab('0xe0')]?_0x2aa512[_0xf0ab('0xe0')][_0xf0ab('0xdd')]:_0x2aa512[_0xf0ab('0x3a')],'direction':_0x2aa512[_0xf0ab('0xfb')]==='out'?'A':'C','secret':_0x2aa512[_0xf0ab('0xfc')],'read':_0x2aa512[_0xf0ab('0x88')],'attachment':_0x2aa512[_0xf0ab('0xe0')]};})[_0xf0ab('0x72')]()};return ejs['renderFile'](path[_0xf0ab('0xe5')](config[_0xf0ab('0x11b')],_0xf0ab('0x118'),_0xf0ab('0x12e'),'downloadInteraction.ejs'),{'interaction':_0x169b02})['then'](function(_0x3ad886){var _0x3df4a2=path['join'](_0x595bda,'transcript-'+_0x57bd77['id']+'-'+_0x2a2fea+_0xf0ab('0x12f'));var _0x378d44={'path':_0x3df4a2,'channel':_0xf0ab('0x122'),'interactionId':_0x57bd77['id']};return pdf[_0xf0ab('0x130')](_0x3ad886,_0x378d44);})[_0xf0ab('0x21')](function(){return new BPromise(function(_0x1e4acb,_0x25a1eb){zipdir(_0x595bda,{'saveTo':_0x25242e},function(_0x406090,_0x414d09){if(_0x406090)return _0x25a1eb(_0x406090);return _0x1e4acb(_0x414d09);});})[_0xf0ab('0x21')](function(){return new BPromise(function(_0x235528,_0x581c80){rimraf(_0x595bda,function(_0x14332a){if(_0x14332a)_0x581c80(_0x14332a);return _0x235528();});});})[_0xf0ab('0x21')](function(){return _0x4ff52d[_0xf0ab('0xe7')](_0x25242e,_0x2bd3e3,function(_0x4f9211){if(_0x4f9211){console[_0xf0ab('0x131')](_0xf0ab('0x132'),_0x4f9211);}else{fs[_0xf0ab('0x133')](_0x25242e);}});});});}else{return _0x4ff52d['sendStatus'](0xc8);}})[_0xf0ab('0x46')](handleError(_0x4ff52d,null));}; \ No newline at end of file +var _0x9ffd=['MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','agent','getChatWebsites','isEmpty','i.ChatWebsiteId\x20IS\x20NULL','role','sequelize','keyBy','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.ChatInteractionId\x20IN\x20?','groupBy','params','includeAll','find','destroy','describe','createVidaooSession','findOne','ChatWebsite','vidaooNote','vidaooApiKey','vidaooEscalation','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','vidaooMetadata','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','create','updateAttributes','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','abandon','attachmentUpload','file','originalname','basename','filename','Attachment','attachmentDownload','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','%s%d','agentAlias','System','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','addMessage','ids','omit','getMessages','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','secret','include','includeAgent','push','setTags','spread','Tag','emit','chatInteractionTags:save','removeTags','unix','tmp','server','files','CmContact','firstName','attachments','Account','Owner','get','mkdirSync','Chat','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','lastName','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','stack','name','render','merge','body','contact','account','Users','fullname','Tags','TagIds','split','forEach','index','ChatInteraction','rawAttributes','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','select','field','color','from','left_join','u.id\x20=\x20ui.UserId','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','parseSearch','search','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','map','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','compact','ChatWebsiteId','where','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x56002f,_0x21b9e6){_0x56002f=_0x56002f-0x0;var _0xc59164=_0x9ffd[_0x56002f];return _0xc59164;};'use strict';var emlformat=require(_0xd9ff('0x0'));var rimraf=require(_0xd9ff('0x1'));var zipdir=require(_0xd9ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9ff('0x3'));var moment=require(_0xd9ff('0x4'));var BPromise=require(_0xd9ff('0x5'));var Mustache=require(_0xd9ff('0x6'));var util=require('util');var path=require(_0xd9ff('0x7'));var sox=require(_0xd9ff('0x8'));var csv=require('to-csv');var ejs=require(_0xd9ff('0x9'));var fs=require('fs');var fs_extra=require(_0xd9ff('0xa'));var _=require(_0xd9ff('0xb'));var squel=require(_0xd9ff('0xc'));var crypto=require(_0xd9ff('0xd'));var jsforce=require(_0xd9ff('0xe'));var deskjs=require(_0xd9ff('0xf'));var toCsv=require(_0xd9ff('0x10'));var querystring=require(_0xd9ff('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd9ff('0x12'));var pdf=require(_0xd9ff('0x13'));var hardwareService=require(_0xd9ff('0x14'));var logger=require(_0xd9ff('0x15'))(_0xd9ff('0x16'));var utils=require(_0xd9ff('0x17'));var config=require(_0xd9ff('0x18'));var licenseUtil=require(_0xd9ff('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xd9ff('0x1a')](config[_0xd9ff('0x1b')],{'host':_0xd9ff('0x1c'),'port':0x18eb});var socket=require(_0xd9ff('0x1d'))(new Redis(config[_0xd9ff('0x1b')]));require('./chatInteraction.socket')[_0xd9ff('0x1e')](socket);var jayson=require(_0xd9ff('0x1f'));var client=jayson['client'][_0xd9ff('0x20')]({'port':0x232b});var client9004=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x547e28,_0x4c5718,_0x271287,_0x4f9d6d){return new BPromise(function(_0x35679e,_0xa30fd2){var _0x39c6ce=_0x4f9d6d||client;return _0x39c6ce[_0xd9ff('0x21')](_0x547e28,_0x271287)[_0xd9ff('0x22')](function(_0x2d4df1){logger[_0xd9ff('0x23')](_0xd9ff('0x24'),_0x4c5718,_0xd9ff('0x25'));logger[_0xd9ff('0x26')](_0xd9ff('0x27'),_0x4c5718,_0xd9ff('0x25'),JSON[_0xd9ff('0x28')](_0x2d4df1));if(_0x2d4df1['error']){if(_0x2d4df1['error'][_0xd9ff('0x29')]===0x1f4){logger[_0xd9ff('0x2a')]('ChatInteraction,\x20%s,\x20%s',_0x4c5718,_0x2d4df1['error']['message']);return _0xa30fd2(_0x2d4df1['error'][_0xd9ff('0x2b')]);}logger['error'](_0xd9ff('0x24'),_0x4c5718,_0x2d4df1[_0xd9ff('0x2a')][_0xd9ff('0x2b')]);return _0x35679e(_0x2d4df1[_0xd9ff('0x2a')][_0xd9ff('0x2b')]);}else{logger[_0xd9ff('0x23')]('ChatInteraction,\x20%s,\x20%s',_0x4c5718,'request\x20sent');_0x35679e(_0x2d4df1[_0xd9ff('0x2c')]['message']);}})[_0xd9ff('0x2d')](function(_0x4d86fe){logger[_0xd9ff('0x2a')]('ChatInteraction,\x20%s,\x20%s',_0x4c5718,_0x4d86fe);_0xa30fd2(_0x4d86fe);});});}function respondWithStatusCode(_0x10cbdd,_0x159e56){_0x159e56=_0x159e56||0xcc;return function(_0x2138b4){if(_0x2138b4){return _0x10cbdd[_0xd9ff('0x2e')](_0x159e56);}return _0x10cbdd['status'](_0x159e56)[_0xd9ff('0x2f')]();};}function respondWithResult(_0xe11f88,_0x1c78c4){_0x1c78c4=_0x1c78c4||0xc8;return function(_0x4390f7){if(_0x4390f7){return _0xe11f88['status'](_0x1c78c4)[_0xd9ff('0x30')](_0x4390f7);}};}function respondWithFilteredResult(_0x3792d9,_0x44b5a7){return function(_0x45fb63){if(_0x45fb63){var _0x263d3a=typeof _0x44b5a7[_0xd9ff('0x31')]===_0xd9ff('0x32')&&typeof _0x44b5a7[_0xd9ff('0x33')]===_0xd9ff('0x32');var _0x5706cf=_0x45fb63[_0xd9ff('0x34')];var _0x4ba2be=_0x263d3a?0x0:_0x44b5a7[_0xd9ff('0x31')];var _0x29c532=_0x263d3a?_0x45fb63[_0xd9ff('0x34')]:_0x44b5a7['offset']+_0x44b5a7[_0xd9ff('0x33')];var _0x3b26da;if(_0x29c532>=_0x5706cf){_0x29c532=_0x5706cf;_0x3b26da=0xc8;}else{_0x3b26da=0xce;}_0x3792d9[_0xd9ff('0x35')](_0x3b26da);return _0x3792d9[_0xd9ff('0x36')]('Content-Range',_0x4ba2be+'-'+_0x29c532+'/'+_0x5706cf)[_0xd9ff('0x30')](_0x45fb63);}return null;};}function patchUpdates(_0x5743de){return function(_0x18c28b){try{jsonpatch[_0xd9ff('0x37')](_0x18c28b,_0x5743de,!![]);}catch(_0x323cb5){return BPromise[_0xd9ff('0x38')](_0x323cb5);}return _0x18c28b[_0xd9ff('0x39')]();};}function saveUpdates(_0xdf3947,_0x2cc2ae){return function(_0x281c7b){if(_0x281c7b){return _0x281c7b[_0xd9ff('0x3a')](_0xdf3947)[_0xd9ff('0x22')](function(_0x4813a5){return _0x4813a5;});}return null;};}function removeEntity(_0x34e9a9,_0x4670e4){return function(_0x66f4d){if(_0x66f4d){return _0x66f4d['destroy']()[_0xd9ff('0x22')](function(){_0x34e9a9[_0xd9ff('0x35')](0xcc)[_0xd9ff('0x2f')]();});}};}function handleEntityNotFound(_0x4ab10f,_0x3d449d){return function(_0x5e3ff9){if(!_0x5e3ff9){_0x4ab10f[_0xd9ff('0x2e')](0x194);}return _0x5e3ff9;};}function handleError(_0x4ae56b,_0x20a021){_0x20a021=_0x20a021||0x1f4;return function(_0x5db498){logger[_0xd9ff('0x2a')](_0x5db498[_0xd9ff('0x3b')]);if(_0x5db498[_0xd9ff('0x3c')]){delete _0x5db498['name'];}_0x4ae56b['status'](_0x20a021)['send'](_0x5db498);};}function getMustacheRender(_0x7ac3d1,_0x30fc5b){return Mustache[_0xd9ff('0x3d')](_0x7ac3d1,_[_0xd9ff('0x3e')](_0x30fc5b[_0xd9ff('0x3f')],{'contact':_0x30fc5b[_0xd9ff('0x40')],'message':_0x30fc5b['message'],'agent':_0x30fc5b['agent'],'interaction':_0x30fc5b['interaction'],'account':_0x30fc5b[_0xd9ff('0x41')]}))||'';}function getInteractionUsers(_0x252edc,_0x918c9a){return new BPromise(function(_0x32adae,_0x56b94d){try{if(_0x918c9a[_0x252edc['id']]){_0x252edc[_0xd9ff('0x42')]=_['map'](_0x918c9a[_0x252edc['id']],function(_0x3cff52){return{'id':_0x3cff52['id'],'fullname':_0x3cff52[_0xd9ff('0x43')]};});}}catch(_0x1bedaf){_0x56b94d(_0x1bedaf);}_0x32adae(_0x252edc);});}function getInteractionTags(_0x169dc7,_0x59fc07){return new BPromise(function(_0x1e34da,_0x2d4d97){try{if(_0x169dc7['TagIds']){_0x169dc7[_0xd9ff('0x44')]=[];_0x169dc7[_0xd9ff('0x45')][_0xd9ff('0x46')](',')[_0xd9ff('0x47')](function(_0x1fe44d){_0x169dc7[_0xd9ff('0x44')]['push'](_0x59fc07[_0x1fe44d]);});}delete _0x169dc7[_0xd9ff('0x45')];}catch(_0x116f28){_0x2d4d97(_0x116f28);}_0x1e34da(_0x169dc7);});}function updateChatInteraction(_0x10533a,_0x39fbbb,_0x472724){return new BPromise(function(_0x52aab8,_0x3178cd){return getInteractionUsers(_0x10533a,_0x472724)[_0xd9ff('0x22')](function(_0xe0bc49){return getInteractionTags(_0xe0bc49,_0x39fbbb);})['then'](function(_0x5d06dd){_0x52aab8(_0x5d06dd);})[_0xd9ff('0x2d')](function(_0x7eb1a){_0x3178cd(_0x7eb1a);});});}exports[_0xd9ff('0x48')]=function(_0x2dfb8f,_0x437561){var _0x30c69d={},_0x564ef4={},_0xd64585={'count':0x0,'rows':[]};var _0x2d3013=_['map'](db[_0xd9ff('0x49')][_0xd9ff('0x4a')],function(_0x13a1ec){return{'name':_0x13a1ec[_0xd9ff('0x4b')],'type':_0x13a1ec[_0xd9ff('0x4c')]['key']};});_0x564ef4['model']=_['map'](_0x2d3013,_0xd9ff('0x3c'));_0x564ef4['query']=_[_0xd9ff('0x4d')](_0x2dfb8f[_0xd9ff('0x4e')]);_0x564ef4[_0xd9ff('0x4f')]=_['intersection'](_0x564ef4[_0xd9ff('0x50')],_0x564ef4[_0xd9ff('0x4e')]);_0x30c69d['attributes']=_[_0xd9ff('0x51')](_0x564ef4[_0xd9ff('0x50')],qs[_0xd9ff('0x52')](_0x2dfb8f[_0xd9ff('0x4e')]['fields']));_0x30c69d[_0xd9ff('0x53')]=_0x30c69d['attributes'][_0xd9ff('0x54')]?_0x30c69d['attributes']:_0x564ef4[_0xd9ff('0x50')];if(!_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x55')](_0xd9ff('0x56'))){_0x30c69d[_0xd9ff('0x33')]=qs['limit'](_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x33')]);_0x30c69d[_0xd9ff('0x31')]=qs[_0xd9ff('0x31')](_0x2dfb8f['query']['offset']);}_0x30c69d['order']=qs[_0xd9ff('0x57')](_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x57')]);_0x30c69d['where']=qs[_0xd9ff('0x4f')](_[_0xd9ff('0x58')](_0x2dfb8f[_0xd9ff('0x4e')],_0x564ef4[_0xd9ff('0x4f')]),_0x2d3013);var _0xfede73=[];var _0x40d391=squel[_0xd9ff('0x59')]()[_0xd9ff('0x5a')]('id')[_0xd9ff('0x5a')](_0xd9ff('0x3c'))[_0xd9ff('0x5a')](_0xd9ff('0x5b'))[_0xd9ff('0x5c')]('tools_tags');var _0x3ed112=squel['select']()[_0xd9ff('0x5a')]('u.id')[_0xd9ff('0x5a')]('u.fullname')[_0xd9ff('0x5a')]('ui.ChatInteractionId')[_0xd9ff('0x5c')]('user_has_chat_interactions','ui')[_0xd9ff('0x5d')]('users','u',_0xd9ff('0x5e'));var _0x5da1a8=squel[_0xd9ff('0x59')]()[_0xd9ff('0x5c')](_0xd9ff('0x5f'),'i')[_0xd9ff('0x5d')]('cm_contacts','c',_0xd9ff('0x60'))[_0xd9ff('0x5d')](_0xd9ff('0x61'),'o','o.id\x20=\x20i.UserId')[_0xd9ff('0x5d')](_0xd9ff('0x62'),'a',_0xd9ff('0x63'))[_0xd9ff('0x5d')](_0xd9ff('0x64'),'me','me.ChatInteractionId\x20=\x20i.id')[_0xd9ff('0x5d')](_0xd9ff('0x65'),'it',_0xd9ff('0x66'))[_0xd9ff('0x5d')](_0xd9ff('0x67'),'t',_0xd9ff('0x68'));var _0x458fd4=squel['expr']();var _0x3be850=[];var _0x11251f=squel['expr']();var _0x1c885f;if(_0x2dfb8f[_0xd9ff('0x4e')]['search']){_0x1c885f=as[_0xd9ff('0x69')](_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x6a')]);var _0x54ea27=_0x1c885f['sqlOperator'];for(var _0x39473e=0x0;_0x39473e<_0x1c885f['conditions'][_0xd9ff('0x54')];_0x39473e++){var _0x1e4d0c=_0x1c885f[_0xd9ff('0x6b')][_0x39473e];var _0x102aea='i';var _0x53a230=_['find'](_0x2d3013,['name',_0x1e4d0c[_0xd9ff('0x5a')]]);if(!_0x53a230){switch(_0x1e4d0c[_0xd9ff('0x5a')]){case _0xd9ff('0x6c'):if(_0x1e4d0c[_0xd9ff('0x6d')]==0x1){_0x5da1a8[_0xd9ff('0x6e')]('`'+_0x1e4d0c['field']+_0xd9ff('0x6f'));}else{_0x5da1a8['having']('`'+_0x1e4d0c[_0xd9ff('0x5a')]+_0xd9ff('0x70'));}break;case _0xd9ff('0x71'):if(_0x1e4d0c[_0xd9ff('0x72')]===_0xd9ff('0x73')){if(_0x1e4d0c[_0xd9ff('0x6d')][_0xd9ff('0x46')]('\x20')[_0xd9ff('0x54')]>0x1){_0x458fd4[_0x54ea27]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd9ff('0x74')](_0x1e4d0c[_0xd9ff('0x6d')]),null);}else{var _0x4f5338='%'+_0x1e4d0c['value']+'%';_0x458fd4[_0x54ea27](_0xd9ff('0x75'),_0x4f5338,_0x4f5338,_0x4f5338);}}else{_0x53a230=_['find'](_0x2d3013,[_0xd9ff('0x3c'),_0xd9ff('0x76')]);_0x1e4d0c['field']=_0xd9ff('0x76');_0x58c9c2=as[_0xd9ff('0x77')](_0x102aea,_0x53a230[_0xd9ff('0x4c')],_0x1e4d0c);_0x458fd4[_0x54ea27](_0x58c9c2[_0xd9ff('0x78')],_0x58c9c2[_0xd9ff('0x6d')]['start'],_0x58c9c2[_0xd9ff('0x6d')]['end']);}break;case'Tag':var _0x3dabb1=_0x1e4d0c[_0xd9ff('0x6d')][_0xd9ff('0x46')](',')[_0xd9ff('0x79')](function(_0x56d822){return Number(_0x56d822);});_0x3dabb1[_0xd9ff('0x47')](function(_0x23b816){_0x11251f['or'](_0xd9ff('0x7a'),'%,'+_0x23b816+',%');});_0x3be850=_[_0xd9ff('0x7b')](_0x3be850,_0x3dabb1);break;case _0xd9ff('0x7c'):if(_0x1e4d0c[_0xd9ff('0x72')]===_0xd9ff('0x73')){_0x458fd4[_0x54ea27](_0xd9ff('0x7d'),'%'+_0x1e4d0c['value']+'%',null);}else{_0x53a230=_['find'](_0x2d3013,['name',_0xd9ff('0x7e')]);_0x1e4d0c[_0xd9ff('0x5a')]='UserId';_0x58c9c2=as[_0xd9ff('0x77')](_0x102aea,_0x53a230[_0xd9ff('0x4c')],_0x1e4d0c);_0x458fd4[_0x54ea27](_0x58c9c2[_0xd9ff('0x78')],_0x58c9c2[_0xd9ff('0x6d')][_0xd9ff('0x7f')],_0x58c9c2[_0xd9ff('0x6d')][_0xd9ff('0x2f')]);}break;case _0xd9ff('0x3f'):_0x58c9c2=as['buildExpression']('me',null,_0x1e4d0c);_0x458fd4[_0x54ea27](_0x58c9c2[_0xd9ff('0x78')],_0x58c9c2[_0xd9ff('0x6d')][_0xd9ff('0x7f')],_0x58c9c2['value'][_0xd9ff('0x2f')]);break;}}else{var _0x58c9c2=as[_0xd9ff('0x77')](_0x102aea,_0x53a230[_0xd9ff('0x4c')],_0x1e4d0c);_0x458fd4[_0x54ea27](_0x58c9c2[_0xd9ff('0x78')],_0x58c9c2['value'][_0xd9ff('0x7f')],_0x58c9c2[_0xd9ff('0x6d')][_0xd9ff('0x2f')]);}}}else{var _0x1cd620=_(_0x2dfb8f['query'])[_0xd9ff('0x4d')]()[_0xd9ff('0x79')](function(_0x1de5c9){return _['some'](_0x2d3013,[_0xd9ff('0x3c'),_0x1de5c9])?_0x1de5c9:undefined;})[_0xd9ff('0x80')]()[_0xd9ff('0x6d')]();if(!_['isEmpty'](_0x1cd620)){_0x1cd620[_0xd9ff('0x47')](function(_0x35926f){if(_0x35926f===_0xd9ff('0x81')){_0x5da1a8[_0xd9ff('0x82')](_0xd9ff('0x83'),[]['concat'](_0x2dfb8f[_0xd9ff('0x4e')][_0x35926f]));}else if(_0x35926f===_0xd9ff('0x84')){var _0x59af0a=JSON[_0xd9ff('0x85')](_0x2dfb8f[_0xd9ff('0x4e')][_0x35926f])[_0xd9ff('0x86')];var _0x5d1973=JSON[_0xd9ff('0x85')](_0x2dfb8f['query'][_0x35926f])[_0xd9ff('0x87')];_0x5da1a8['where'](_0xd9ff('0x88'),_0x59af0a,_0x5d1973);}else{if(_0x2dfb8f[_0xd9ff('0x4e')][_0x35926f]===_0xd9ff('0x89')){_0x5da1a8[_0xd9ff('0x82')]('i.'+_0x35926f+_0xd9ff('0x8a'));}else{_0x5da1a8[_0xd9ff('0x82')]('i.'+_0x35926f+_0xd9ff('0x8b'),_0x2dfb8f[_0xd9ff('0x4e')][_0x35926f]);}}});}if(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x8c')]){if(_0x2dfb8f['query'][_0xd9ff('0x8c')]==0x1){_0x5da1a8[_0xd9ff('0x6e')](_0xd9ff('0x8d'));}else{_0x5da1a8[_0xd9ff('0x6e')](_0xd9ff('0x8e'));}}if(_0x2dfb8f[_0xd9ff('0x4e')]['tag']){_0x3be850=_['isArray'](_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x8f')])?_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x8f')]:new Array(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x8f')]);_0x3be850['forEach'](function(_0x1d34a1){_0x11251f['or'](_0xd9ff('0x7a'),'%,'+_0x1d34a1+',%');});}if(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x90')]){var _0x14c89f=_0x2dfb8f[_0xd9ff('0x4e')]['filter'][_0xd9ff('0x91')]('\x5c','\x5c\x5c')[_0xd9ff('0x91')](/'/g,'\x27\x27');if(qs[_0xd9ff('0x92')](_0x14c89f)){_0x458fd4['or'](_0xd9ff('0x93'),_0x14c89f+'%');}else{_0x458fd4['or'](_0xd9ff('0x94'),qs[_0xd9ff('0x74')](_0x14c89f))['or'](_0xd9ff('0x95'),_0x14c89f+'%');}}}_0x5da1a8[_0xd9ff('0x82')](_0x458fd4);_0x5da1a8['group'](_0xd9ff('0x96'));var _0x4c2ad5={'type':db[_0xd9ff('0x97')][_0xd9ff('0x98')][_0xd9ff('0x99')],'raw':!![]};var _0x2d2d1c=_0x5da1a8[_0xd9ff('0x9a')]();_0x2d2d1c[_0xd9ff('0x5a')](_0xd9ff('0x96'));_0x2d2d1c[_0xd9ff('0x5a')](_0xd9ff('0x9b'),_0xd9ff('0x6c'));if(_0x30c69d[_0xd9ff('0x9c')]){_0x30c69d[_0xd9ff('0x9c')][_0xd9ff('0x47')](function(_0x5d29b9){var _0x4413c4=_0x5d29b9[0x0]===_0xd9ff('0x9d')?_0x5d29b9[0x0]:'i.'+_0x5d29b9[0x0];_0x5da1a8[_0xd9ff('0x9c')](_0x4413c4,_0x5d29b9[0x1]===_0xd9ff('0x9e')?![]:!![]);});}if(!_['isEmpty'](_0x3be850)){_0x5da1a8[_0xd9ff('0x6e')](_0x11251f);_0x2d2d1c[_0xd9ff('0x82')]('t.id\x20IN\x20?',_0x3be850);}BPromise[_0xd9ff('0x9f')]()[_0xd9ff('0x22')](function(){if(!_0x1c885f){if(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x81')])return;_0x2d2d1c[_0xd9ff('0x82')](_0xd9ff('0xa0'));_0x5da1a8[_0xd9ff('0x82')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x2dfb8f[_0xd9ff('0xa1')]['role']!==_0xd9ff('0xa2'))return;return _0x2dfb8f[_0xd9ff('0xa1')][_0xd9ff('0xa3')]({'attributes':['id'],'raw':!![]})[_0xd9ff('0x22')](function(_0x320adb){if(_[_0xd9ff('0xa4')](_0x320adb)){_0x2d2d1c[_0xd9ff('0x82')](_0xd9ff('0xa5'));_0x5da1a8[_0xd9ff('0x82')](_0xd9ff('0xa5'));}else{_0x2d2d1c[_0xd9ff('0x82')]('i.ChatWebsiteId\x20IN\x20?',_[_0xd9ff('0x79')](_0x320adb,'id'));_0x5da1a8[_0xd9ff('0x82')]('i.ChatWebsiteId\x20IN\x20?',_[_0xd9ff('0x79')](_0x320adb,'id'));}});})[_0xd9ff('0x22')](function(){if(_0x2dfb8f[_0xd9ff('0xa1')][_0xd9ff('0xa6')]===_0xd9ff('0xa2')&&!_0x1c885f&&!_0x2dfb8f[_0xd9ff('0x4e')]['ChatWebsiteId'])return[];return db['sequelize'][_0xd9ff('0x4e')](_0x2d2d1c['toString'](),_0x4c2ad5);})['then'](function(_0x4a55c1){_0xd64585['count']=_0x4a55c1[_0xd9ff('0x54')];if(_0xd64585[_0xd9ff('0x34')]===0x0)return[];return db[_0xd9ff('0xa7')]['query'](_0x40d391['toString'](),_0x4c2ad5)[_0xd9ff('0x22')](function(_0x5e7f52){_0xfede73=_[_0xd9ff('0xa8')](_0x5e7f52,'id');_0x4c2ad5=_['merge'](_0x4c2ad5,{'model':db[_0xd9ff('0x49')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x52')]){_0x30c69d[_0xd9ff('0x53')][_0xd9ff('0x47')](function(_0x4e6dd2){_0x5da1a8['field']('i.'+_0x4e6dd2);});}else{_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0x9b'),_0xd9ff('0x6c'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xa9'),'Account.key');_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xaa'),_0xd9ff('0xab'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xac'),_0xd9ff('0x9d'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xad'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xae'),_0xd9ff('0xaf'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xb0'),'Contact.lastName');_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xb1'),'Contact.email');_0x5da1a8['field'](_0xd9ff('0xb2'),_0xd9ff('0xb3'));_0x5da1a8['field'](_0xd9ff('0xb4'),_0xd9ff('0xb5'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xb6'),_0xd9ff('0xb7'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xb8'),_0xd9ff('0xb9'));_0x5da1a8['field']('o.internal','Owner.internal');_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xba'),_0xd9ff('0x45'));}if(_0x30c69d['limit'])_0x5da1a8[_0xd9ff('0x33')](_0x30c69d[_0xd9ff('0x33')]);if(_0x30c69d[_0xd9ff('0x31')])_0x5da1a8[_0xd9ff('0x31')](_0x30c69d[_0xd9ff('0x31')]);return db[_0xd9ff('0xa7')]['query'](_0x5da1a8[_0xd9ff('0xbb')](),_0x4c2ad5);})['then'](function(_0x5cb3af){if(_0x5cb3af[_0xd9ff('0x54')]>0x0)_0x3ed112[_0xd9ff('0x82')](_0xd9ff('0xbc'),_['map'](_0x5cb3af,'id'));return db[_0xd9ff('0xa7')][_0xd9ff('0x4e')](_0x3ed112['toString'](),_0x4c2ad5)['then'](function(_0x4aa6d5){var _0x11840a=_[_0xd9ff('0xbd')](_0x4aa6d5,'ChatInteractionId');var _0x2871ec=[];_0x5cb3af[_0xd9ff('0x47')](function(_0x16e130){_0x2871ec['push'](updateChatInteraction(_0x16e130,_0xfede73,_0x11840a));});return BPromise['all'](_0x2871ec);});});})['then'](function(_0xdf2e33){_0xd64585['rows']=_0xdf2e33;return _0xd64585;})[_0xd9ff('0x22')](respondWithFilteredResult(_0x437561,_0x30c69d))[_0xd9ff('0x2d')](handleError(_0x437561,null));};exports['show']=function(_0x1b048b,_0x5eeeaf){var _0x3339e5={'raw':![],'where':{'id':_0x1b048b[_0xd9ff('0xbe')]['id']}},_0x1f7d87={};_0x1f7d87['model']=_[_0xd9ff('0x4d')](db['ChatInteraction']['rawAttributes']);_0x1f7d87['query']=_[_0xd9ff('0x4d')](_0x1b048b[_0xd9ff('0x4e')]);_0x1f7d87[_0xd9ff('0x4f')]=_[_0xd9ff('0x51')](_0x1f7d87['model'],_0x1f7d87['query']);_0x3339e5[_0xd9ff('0x53')]=_[_0xd9ff('0x51')](_0x1f7d87[_0xd9ff('0x50')],qs[_0xd9ff('0x52')](_0x1b048b[_0xd9ff('0x4e')]['fields']));_0x3339e5['attributes']=_0x3339e5[_0xd9ff('0x53')][_0xd9ff('0x54')]?_0x3339e5[_0xd9ff('0x53')]:_0x1f7d87[_0xd9ff('0x50')];if(_0x1b048b[_0xd9ff('0x4e')][_0xd9ff('0xbf')]){_0x3339e5['include']=[{'all':!![]}];}_0x3339e5=_[_0xd9ff('0x3e')]({},_0x3339e5,_0x1b048b['options']);return db['ChatInteraction'][_0xd9ff('0xc0')](_0x3339e5)[_0xd9ff('0x22')](handleEntityNotFound(_0x5eeeaf,null))[_0xd9ff('0x22')](respondWithResult(_0x5eeeaf,null))[_0xd9ff('0x2d')](handleError(_0x5eeeaf,null));};exports['create']=function(_0x4e3fdd,_0x2cf8da){return db['ChatInteraction']['create'](_0x4e3fdd[_0xd9ff('0x3f')],{})['then'](respondWithResult(_0x2cf8da,0xc9))[_0xd9ff('0x2d')](handleError(_0x2cf8da,null));};exports['update']=function(_0x327cd8,_0xd95329){if(_0x327cd8[_0xd9ff('0x3f')]['id']){delete _0x327cd8[_0xd9ff('0x3f')]['id'];}return db[_0xd9ff('0x49')][_0xd9ff('0xc0')]({'where':{'id':_0x327cd8[_0xd9ff('0xbe')]['id']}})['then'](handleEntityNotFound(_0xd95329,null))[_0xd9ff('0x22')](saveUpdates(_0x327cd8['body'],null))['then'](respondWithResult(_0xd95329,null))[_0xd9ff('0x2d')](handleError(_0xd95329,null));};exports[_0xd9ff('0xc1')]=function(_0x499869,_0x3c86ac){return db['ChatInteraction']['find']({'where':{'id':_0x499869[_0xd9ff('0xbe')]['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x3c86ac,null))[_0xd9ff('0x22')](removeEntity(_0x3c86ac,null))[_0xd9ff('0x2d')](handleError(_0x3c86ac,null));};exports[_0xd9ff('0xc2')]=function(_0x11c84f,_0x2d0261){return db[_0xd9ff('0x49')][_0xd9ff('0xc2')]()[_0xd9ff('0x22')](respondWithResult(_0x2d0261,null))[_0xd9ff('0x2d')](handleError(_0x2d0261,null));};exports[_0xd9ff('0xc3')]=function(_0x73cfcf,_0x538f20){var _0x51feff=_0x73cfcf['params']['id'];var _0x30c62c;var _0x50b6b2;var _0x413aef;return db[_0xd9ff('0x49')][_0xd9ff('0xc4')]({'where':{'id':_0x51feff}})[_0xd9ff('0x22')](function(_0x54c390){_0x30c62c=_0x54c390;return db[_0xd9ff('0xc5')]['findOne']({'where':{'id':_0x54c390[_0xd9ff('0x81')]},'attributes':['id','vidaooApiKey','vidaooEscalation','vidaooTopic',_0xd9ff('0xc6'),'vidaooMetadata'],'raw':!![]});})[_0xd9ff('0x22')](function(_0x54524c){if(_0x54524c&&_0x54524c[_0xd9ff('0xc7')]&&_0x54524c[_0xd9ff('0xc8')]){_0x50b6b2=_0x54524c;var _0x696e18={'interaction':{'id':_0x51feff},'agent':{'id':_0x73cfcf[_0xd9ff('0xa1')]['id'],'name':_0x73cfcf[_0xd9ff('0xa1')][_0xd9ff('0x3c')],'fullname':_0x73cfcf['user']['fullname'],'email':_0x73cfcf[_0xd9ff('0xa1')][_0xd9ff('0xc9')]},'contact':_0x73cfcf[_0xd9ff('0x3f')][_0xd9ff('0x40')],'account':_0x73cfcf[_0xd9ff('0x3f')]['account']};var _0x432854={'rejectUnauthorized':![],'method':_0xd9ff('0xca'),'url':_0xd9ff('0xcb'),'headers':{'X-APIKEY':_0x54524c[_0xd9ff('0xc7')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x73cfcf[_0xd9ff('0xa1')][_0xd9ff('0xc9')]],'buttons':null,'topic':_0x50b6b2['vidaooTopic'],'note':_[_0xd9ff('0xcc')](_0x50b6b2[_0xd9ff('0xc6')])?null:getMustacheRender(_0x50b6b2[_0xd9ff('0xc6')],_0x696e18),'metadata':null},'redirect':_0xd9ff('0xcd'),'json':!![]};try{if(!_[_0xd9ff('0xcc')](_0x50b6b2[_0xd9ff('0xce')])){var _0x1c8e55=getMustacheRender(_0x50b6b2[_0xd9ff('0xce')],_0x696e18);var _0x29fdb8=JSON[_0xd9ff('0x85')](_0x1c8e55);_0x432854[_0xd9ff('0x3f')][_0xd9ff('0xcf')]=_0x29fdb8;}}catch(_0xfc755a){throw new db[(_0xd9ff('0x97'))][(_0xd9ff('0xd0'))](_0xd9ff('0xd1'));}return rp(_0x432854);}else{throw new db[(_0xd9ff('0x97'))][(_0xd9ff('0xd0'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xd9ff('0x22')](function(_0x282183){_0x413aef=_0x282183;if(_0x413aef['id']){var _0x3aba00={'body':_0x413aef[_0xd9ff('0xd2')],'ChatWebsiteId':_0x50b6b2['id'],'ChatInteractionId':_0x30c62c['id'],'direction':_0xd9ff('0xd3'),'UserId':_0x73cfcf[_0xd9ff('0xa1')]['id']};return db[_0xd9ff('0xd4')][_0xd9ff('0xd5')](_0x3aba00,{});}else{throw new db['Sequelize'][(_0xd9ff('0xd0'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xd9ff('0x22')](function(){return _0x30c62c[_0xd9ff('0xd6')]({'vidaooSessionId':_0x413aef['id']});})[_0xd9ff('0x22')](respondWithResult(_0x538f20,null))[_0xd9ff('0x2d')](handleError(_0x538f20,null));};exports[_0xd9ff('0xd7')]=function(_0x204127,_0xf98666){if(_0x204127['body']['id']){delete _0x204127[_0xd9ff('0x3f')]['id'];}return db[_0xd9ff('0x49')][_0xd9ff('0xc0')]({'where':{'id':_0x204127[_0xd9ff('0xbe')]['id']},'include':[{'model':db['CmContact'],'as':_0xd9ff('0x71')}]})[_0xd9ff('0x22')](handleEntityNotFound(_0xf98666,null))['then'](saveUpdates(_0x204127[_0xd9ff('0x3f')],null))[_0xd9ff('0x22')](respondWithResult(_0xf98666,null))['catch'](handleError(_0xf98666,null));};exports['abandon']=function(_0x5c4138,_0x560ea2,_0x1e6d5a){if(_0x5c4138[_0xd9ff('0x3f')]['id']){delete _0x5c4138[_0xd9ff('0x3f')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x5c4138[_0xd9ff('0xbe')]['id']}})['then'](function(_0x43a941){if(!_0x43a941){logger[_0xd9ff('0x2a')](_0xd9ff('0xd8'),'abandon',0x194,'entity\x20not\x20found');_0x560ea2['sendStatus'](0x194);}else{if(_0x43a941[_0xd9ff('0x7e')]){throw new db[(_0xd9ff('0x97'))]['ValidationError'](_0xd9ff('0xd9'));}}return _0x43a941;})[_0xd9ff('0x22')](function(_0x7efe12){if(_0x7efe12){return _0x7efe12[_0xd9ff('0x3a')]({'closed':_0x5c4138[_0xd9ff('0x3f')][_0xd9ff('0xda')],'disposition':_0x5c4138[_0xd9ff('0x3f')][_0xd9ff('0xdb')]})[_0xd9ff('0x22')](function(_0x3b7aeb){return _0x3b7aeb;});}})[_0xd9ff('0x22')](function(_0x37eb49){return respondWithRpcPromise(_0xd9ff('0xdc'),_0xd9ff('0xdd'),_0x5c4138[_0xd9ff('0x3f')],client9004);})[_0xd9ff('0x22')](respondWithResult(_0x560ea2,null))[_0xd9ff('0x2d')](handleError(_0x560ea2,null));};exports[_0xd9ff('0xde')]=function(_0x3b05c4,_0x32c04e,_0x1bcf8f){_0x3b05c4[_0xd9ff('0x3f')][_0xd9ff('0x3c')]=_0x3b05c4[_0xd9ff('0xdf')][_0xd9ff('0xe0')];_0x3b05c4[_0xd9ff('0x3f')][_0xd9ff('0xe1')]=_0x3b05c4[_0xd9ff('0xdf')][_0xd9ff('0xe2')];_0x3b05c4['body'][_0xd9ff('0x4c')]=_0x3b05c4[_0xd9ff('0xdf')]['mimetype'];return db[_0xd9ff('0xe3')][_0xd9ff('0xd5')](_0x3b05c4[_0xd9ff('0x3f')])[_0xd9ff('0x22')](respondWithResult(_0x32c04e,0xc9))[_0xd9ff('0x2d')](handleError(_0x32c04e,null));};exports[_0xd9ff('0xe4')]=function(_0x5978ad,_0x4ddfe7,_0x30c520){return db['ChatInteraction']['findOne']({'where':{'id':_0x5978ad[_0xd9ff('0xbe')]['id']},'raw':!![]})[_0xd9ff('0x22')](handleEntityNotFound(_0x4ddfe7,null))['then'](function(_0x327362){if(_0x327362){if(_0x327362[_0xd9ff('0xda')]){return _0x4ddfe7[_0xd9ff('0x35')](0x193)[_0xd9ff('0x30')]({'status':0x193,'message':'Unauthorized'});}return db[_0xd9ff('0xe3')][_0xd9ff('0xc4')]({'where':{'id':_0x5978ad['query'][_0xd9ff('0xe5')]},'raw':!![]})[_0xd9ff('0x22')](handleEntityNotFound(_0x4ddfe7,null));}})['then'](function(_0x62f1f3){if(_0x62f1f3){var _0xd188cf=_0x62f1f3[_0xd9ff('0xe6')]!==null;var _0x5b2e9c=path[_0xd9ff('0xe7')](config[_0xd9ff('0xe8')],_0xd9ff('0xe9'));if(_0xd188cf){_0x5b2e9c=path['join'](_0x5b2e9c,_0xd9ff('0xea'));}var _0x53a25a=path[_0xd9ff('0xe7')](_0x5b2e9c,_0x62f1f3[_0xd9ff('0xe1')]);return _0x4ddfe7[_0xd9ff('0xeb')](_0x53a25a);}})[_0xd9ff('0x2d')](handleError(_0x4ddfe7,null));};exports[_0xd9ff('0xec')]=function(_0x10397d,_0x51039f){var _0x37ea50=null;var _0x3cf2ef=null;var _0x171195=null;var _0x24c066=null;if(_0x10397d[_0xd9ff('0x3f')]['id']){delete _0x10397d['body']['id'];}if(_0x10397d[_0xd9ff('0x3f')][_0xd9ff('0xed')]){_0x24c066=path['join'](config[_0xd9ff('0xe8')],_0xd9ff('0xee'),util[_0xd9ff('0xef')](_0xd9ff('0xf0'),Date[_0xd9ff('0xf1')]()));_0x10397d[_0xd9ff('0x3f')][_0xd9ff('0xf2')]=_0x24c066;}return db[_0xd9ff('0x49')][_0xd9ff('0xc0')]({'where':{'id':_0x10397d[_0xd9ff('0xbe')]['id']},'include':[{'model':db[_0xd9ff('0xd4')],'as':_0xd9ff('0xf3'),'include':[{'model':db[_0xd9ff('0x7c')],'as':_0xd9ff('0x7c')}]}]})[_0xd9ff('0x22')](handleEntityNotFound(_0x51039f,null))[_0xd9ff('0x22')](saveUpdates(_0x10397d['body'],null))['then'](function(_0x497e36){if(_0x497e36){_0x37ea50=_0x497e36;return db[_0xd9ff('0xc5')]['find']({'where':{'id':_0x37ea50[_0xd9ff('0x81')]}});}})['then'](function(_0x4d4cc0){if(_0x4d4cc0){_0x171195=_0x4d4cc0;return db['CmContact'][_0xd9ff('0xc0')]({'where':{'id':_0x37ea50['ContactId']}});}})['then'](function(_0x474b4c){if(_0x474b4c){_0x3cf2ef=_0x474b4c;if(_0x24c066){var _0x144cf7=null;for(var _0x9eac7f=0x1;_0x9eac7f<_0x37ea50[_0xd9ff('0xf3')][_0xd9ff('0x54')];++_0x9eac7f){_0x144cf7=_0x37ea50[_0xd9ff('0xf3')][_0x9eac7f];var _0x2450da=_0x144cf7[_0xd9ff('0x7e')]?util[_0xd9ff('0xef')](_0xd9ff('0xf4'),_0x171195[_0xd9ff('0xf5')],_0x144cf7[_0xd9ff('0x7e')]):_0xd9ff('0xf6');var _0x4531bc=_0x10397d['body']['customer']||util[_0xd9ff('0xef')](_0xd9ff('0xf4'),_0xd9ff('0xf7'),_0x144cf7[_0xd9ff('0x76')]);switch(_0x171195[_0xd9ff('0xf8')]){case _0xd9ff('0xf9'):_0x2450da=_0x144cf7[_0xd9ff('0x7e')]?util[_0xd9ff('0xef')]('%s%d',_0x171195[_0xd9ff('0xf5')],_0x144cf7[_0xd9ff('0x7e')]):_0xd9ff('0xf6');break;case _0xd9ff('0xfa'):_0x2450da=_0x144cf7['UserId']?_0x144cf7['User'][_0xd9ff('0xfb')]||_0x144cf7[_0xd9ff('0x7c')]['fullname']:_0xd9ff('0xf6');break;case _0xd9ff('0xfc'):_0x2450da=_0x144cf7['UserId']?_0x144cf7[_0xd9ff('0x7c')][_0xd9ff('0x43')]:_0xd9ff('0xf6');break;default:_0x2450da=_0x144cf7[_0xd9ff('0x7e')]?util[_0xd9ff('0xef')](_0xd9ff('0xf4'),_0x171195[_0xd9ff('0xf5')],_0x144cf7['UserId']):_0xd9ff('0xf6');}var _0x62b518=util[_0xd9ff('0xef')](_0xd9ff('0xfd'),moment(_0x144cf7[_0xd9ff('0x84')])['format'](_0xd9ff('0xfe')),_0x144cf7[_0xd9ff('0xff')]==='in'?_0x4531bc:_0x2450da,_0x144cf7[_0xd9ff('0x3f')]);if(!_0x144cf7['secret']){fs[_0xd9ff('0x100')](_0x24c066,_0x62b518);}}return db[_0xd9ff('0x101')][_0xd9ff('0xc4')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xd9ff('0x102'),'raw':!![]}]});}}})['then'](function(_0x5e07ae){if(_0x5e07ae&&_0x5e07ae['Smtp']&&_0x10397d['body']){var _0x578f41={'tls':{'rejectUnauthorized':![]}};if(_0x5e07ae[_0xd9ff('0x102')][_0xd9ff('0x103')]){_0x578f41['service']=_0x5e07ae[_0xd9ff('0x102')][_0xd9ff('0x103')];}else{_0x578f41[_0xd9ff('0x104')]=_0x5e07ae['Smtp'][_0xd9ff('0x104')];_0x578f41['port']=_0x5e07ae['Smtp'][_0xd9ff('0x105')];_0x578f41[_0xd9ff('0x106')]=_0x5e07ae[_0xd9ff('0x102')]['secure'];}if(_0x5e07ae['Smtp'][_0xd9ff('0x107')]){_0x578f41[_0xd9ff('0x108')]={'user':_0x5e07ae['Smtp'][_0xd9ff('0xa1')],'pass':_0x5e07ae[_0xd9ff('0x102')][_0xd9ff('0x109')]};}return respondWithRpcPromise(_0xd9ff('0x10a'),_0xd9ff('0x10b'),{'account':_0x578f41,'message':{'from':util[_0xd9ff('0xef')](_0xd9ff('0x10c'),_0x5e07ae['name'],_0x5e07ae[_0xd9ff('0xc9')]||_0x5e07ae[_0xd9ff('0x102')]['user']),'to':_0x10397d[_0xd9ff('0x3f')][_0xd9ff('0xed')],'subject':'Mail\x20Transcript','text':util[_0xd9ff('0xef')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x10397d[_0xd9ff('0x3f')][_0xd9ff('0xed')]),'attachments':[{'path':_0x24c066}]}})['then'](function(){return _0x37ea50;})[_0xd9ff('0x2d')](function(_0x4d6172){console[_0xd9ff('0x2a')](_0x4d6172);});}else{return _0x37ea50;}})[_0xd9ff('0x22')](respondWithStatusCode(_0x51039f,0xc8))[_0xd9ff('0x2d')](handleError(_0x51039f,null));};exports[_0xd9ff('0x10d')]=function(_0x6a2524,_0x356583,_0x5c1165){return db['ChatMessage'][_0xd9ff('0xc0')]({'where':{'id':_0x6a2524['params']['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x356583,null))[_0xd9ff('0x22')](function(_0x599273){if(_0x599273){return _0x599273['addMessage'](_0x6a2524['body'][_0xd9ff('0x10e')],_[_0xd9ff('0x10f')](_0x6a2524[_0xd9ff('0x3f')],['ids','id'])||{});}})[_0xd9ff('0x22')](respondWithResult(_0x356583,null))[_0xd9ff('0x2d')](handleError(_0x356583,null));};exports[_0xd9ff('0x110')]=function(_0x2832b7,_0x618c47,_0x109140){var _0x278670={'raw':![],'where':{}};var _0x5e064d={};var _0x231b46={'count':0x0,'rows':[]};return db[_0xd9ff('0x49')][_0xd9ff('0xc4')]({'where':{'id':_0x2832b7[_0xd9ff('0xbe')]['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x618c47,null))[_0xd9ff('0x22')](function(_0x1802b1){if(_0x1802b1){_0x5e064d[_0xd9ff('0x50')]=_[_0xd9ff('0x4d')](db[_0xd9ff('0xd4')][_0xd9ff('0x4a')]);_0x5e064d['query']=_['keys'](_0x2832b7[_0xd9ff('0x4e')]);_0x5e064d['filters']=_['intersection'](_0x5e064d[_0xd9ff('0x50')],_0x5e064d[_0xd9ff('0x4e')]);_0x278670[_0xd9ff('0x53')]=_[_0xd9ff('0x51')](_0x5e064d[_0xd9ff('0x50')],qs['fields'](_0x2832b7[_0xd9ff('0x4e')]['fields']));_0x278670[_0xd9ff('0x53')]=_0x278670[_0xd9ff('0x53')]['length']?_0x278670[_0xd9ff('0x53')]:_0x5e064d[_0xd9ff('0x50')];if(!_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x55')](_0xd9ff('0x56'))){_0x278670[_0xd9ff('0x33')]=qs[_0xd9ff('0x33')](_0x2832b7['query'][_0xd9ff('0x33')]);_0x278670[_0xd9ff('0x31')]=qs[_0xd9ff('0x31')](_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x31')]);}_0x278670[_0xd9ff('0x9c')]=qs['sort'](_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x57')]);_0x278670[_0xd9ff('0x82')]=qs['filters'](_[_0xd9ff('0x58')](_0x2832b7['query'],_0x5e064d[_0xd9ff('0x4f')]));_0x278670['where'][_0xd9ff('0x111')]=_0x1802b1['id'];if(_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x90')]){_0x278670['where']=_[_0xd9ff('0x3e')](_0x278670['where'],{'$or':_[_0xd9ff('0x79')](_0x278670[_0xd9ff('0x53')],function(_0x2b2a50){var _0x34f3f0={};_0x34f3f0[_0x2b2a50]={'$like':'%'+_0x2832b7[_0xd9ff('0x4e')]['filter']+'%'};return _0x34f3f0;})});}if(_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x86')]){var _0x955328=_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x86')][_0xd9ff('0x46')](',');var _0x5d95b1={};_0x5d95b1[_0x955328[0x0]]={'$gte':moment(_0x955328[0x1])['format'](_0xd9ff('0x112'))};_0x278670[_0xd9ff('0x82')]=_[_0xd9ff('0x3e')](_0x278670[_0xd9ff('0x82')],_0x5d95b1);}_0x278670=_[_0xd9ff('0x3e')]({},_0x278670,_0x2832b7[_0xd9ff('0x113')]);return db[_0xd9ff('0xd4')]['count']({'where':_0x278670[_0xd9ff('0x82')]})[_0xd9ff('0x22')](function(_0x3e90fe){_0x231b46[_0xd9ff('0x34')]=_0x3e90fe;if(_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0xbf')]){_0x278670['include']=[{'all':!![]}];}return db[_0xd9ff('0xd4')][_0xd9ff('0x114')](_0x278670);})[_0xd9ff('0x22')](function(_0x33f933){_0x231b46[_0xd9ff('0x115')]=_0x33f933;return _0x231b46;});}})[_0xd9ff('0x22')](respondWithFilteredResult(_0x618c47,_0x278670))['catch'](handleError(_0x618c47,null));};exports['getMyMessages']=function(_0xf3a93b,_0x473ecf,_0x1213a4){var _0x6f731a={'where':{}},_0x193c57={},_0x4572b2={'count':0x0,'rows':[]};return db[_0xd9ff('0x49')][_0xd9ff('0xc4')]({'where':{'id':_0xf3a93b['params']['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x473ecf,null))[_0xd9ff('0x22')](function(_0x4115a3){if(_0x4115a3){_0x193c57[_0xd9ff('0x50')]=_[_0xd9ff('0x4d')](db[_0xd9ff('0xd4')]['rawAttributes']);_0x193c57[_0xd9ff('0x4e')]=_['keys'](_0xf3a93b['query']);_0x193c57[_0xd9ff('0x4f')]=_[_0xd9ff('0x51')](_0x193c57[_0xd9ff('0x50')],_0x193c57[_0xd9ff('0x4e')]);_0x6f731a[_0xd9ff('0x53')]=_[_0xd9ff('0x51')](_0x193c57[_0xd9ff('0x50')],qs[_0xd9ff('0x52')](_0xf3a93b['query'][_0xd9ff('0x52')]));_0x6f731a['attributes']=_0x6f731a[_0xd9ff('0x53')][_0xd9ff('0x54')]?_0x6f731a[_0xd9ff('0x53')]:_0x193c57[_0xd9ff('0x50')];if(!_0xf3a93b['query'][_0xd9ff('0x55')](_0xd9ff('0x56'))){_0x6f731a[_0xd9ff('0x33')]=qs[_0xd9ff('0x33')](_0xf3a93b[_0xd9ff('0x4e')][_0xd9ff('0x33')]);_0x6f731a[_0xd9ff('0x31')]=qs[_0xd9ff('0x31')](_0xf3a93b[_0xd9ff('0x4e')]['offset']);}_0x6f731a[_0xd9ff('0x9c')]=qs['sort'](_0xf3a93b['query'][_0xd9ff('0x57')]);_0x6f731a[_0xd9ff('0x82')]=qs[_0xd9ff('0x4f')](_[_0xd9ff('0x58')](_0xf3a93b[_0xd9ff('0x4e')],_0x193c57[_0xd9ff('0x4f')]));_0x6f731a[_0xd9ff('0x82')][_0xd9ff('0x111')]=_0x4115a3['id'];if(_0xf3a93b[_0xd9ff('0x4e')][_0xd9ff('0x90')]){_0x6f731a[_0xd9ff('0x82')]=_[_0xd9ff('0x3e')](_0x6f731a['where'],{'$or':_[_0xd9ff('0x79')](_0x6f731a['attributes'],function(_0x1bb980){var _0x3ccf5d={};_0x3ccf5d[_0x1bb980]={'$like':'%'+_0xf3a93b['query']['filter']+'%'};return _0x3ccf5d;})});}_0x6f731a[_0xd9ff('0x82')][_0xd9ff('0x116')]=![];if(_0xf3a93b['query']['id']){_0x6f731a[_0xd9ff('0x82')]['id']={'$gt':_0xf3a93b[_0xd9ff('0x4e')]['id']};}_0x6f731a=_['merge']({},_0x6f731a,_0xf3a93b[_0xd9ff('0x113')]);return db['ChatMessage'][_0xd9ff('0x34')]({'where':_0x6f731a[_0xd9ff('0x82')]})[_0xd9ff('0x22')](function(_0x42d9ff){_0x4572b2[_0xd9ff('0x34')]=_0x42d9ff;_0x6f731a[_0xd9ff('0x117')]=[];if(_0xf3a93b[_0xd9ff('0x4e')][_0xd9ff('0x118')]){_0x6f731a[_0xd9ff('0x117')][_0xd9ff('0x119')]({'model':db[_0xd9ff('0x7c')],'as':_0xd9ff('0x7c'),'attributes':['id',_0xd9ff('0x43'),_0xd9ff('0xfb')]});}if(_0xf3a93b['query'][_0xd9ff('0xbf')]){_0x6f731a[_0xd9ff('0x117')]=[{'all':!![]}];}return db[_0xd9ff('0xd4')][_0xd9ff('0x114')](_0x6f731a);})[_0xd9ff('0x22')](function(_0x314f18){_0x4572b2['rows']=_0x314f18;return _0x4572b2;});}})['then'](respondWithFilteredResult(_0x473ecf,_0x6f731a))['catch'](handleError(_0x473ecf,null));};exports['addTags']=function(_0x4699d3,_0x2e91a8,_0x4956b2){return db[_0xd9ff('0x49')][_0xd9ff('0xc0')]({'where':{'id':_0x4699d3[_0xd9ff('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2e91a8,null))['then'](function(_0x217023){if(_0x217023){return _0x217023[_0xd9ff('0x11a')](_0x4699d3['body']['ids'],_['omit'](_0x4699d3['body'],['ids','id'])||{})[_0xd9ff('0x11b')](function(){return db[_0xd9ff('0x11c')][_0xd9ff('0x114')]({'attributes':['id',_0xd9ff('0x3c'),_0xd9ff('0x5b')],'where':{'id':_0x4699d3[_0xd9ff('0x3f')][_0xd9ff('0x10e')]}});})[_0xd9ff('0x22')](function(_0x317f93){socket[_0xd9ff('0x11d')](_0xd9ff('0x11e'),{'id':Number(_0x4699d3[_0xd9ff('0xbe')]['id']),'tags':_0x317f93||[]});return{'id':Number(_0x4699d3[_0xd9ff('0xbe')]['id']),'tags':_0x317f93||[]};});}})[_0xd9ff('0x22')](respondWithResult(_0x2e91a8,null))[_0xd9ff('0x2d')](handleError(_0x2e91a8,null));};exports[_0xd9ff('0x11f')]=function(_0x404baf,_0x5d73cd,_0xdb719b){return db['ChatInteraction'][_0xd9ff('0xc0')]({'where':{'id':_0x404baf['params']['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x5d73cd,null))[_0xd9ff('0x22')](function(_0x10935d){if(_0x10935d){return _0x10935d['removeTags'](_0x404baf['query']['ids']);}})['then'](respondWithStatusCode(_0x5d73cd,null))['catch'](handleError(_0x5d73cd,null));};exports[_0xd9ff('0xeb')]=function(_0x2031e9,_0x3b50d9){var _0x410fae=moment()[_0xd9ff('0x120')]()[_0xd9ff('0xbb')]();var _0x494da6=path[_0xd9ff('0xe7')](config[_0xd9ff('0xe8')],'server','files',_0xd9ff('0x121'));var _0x49c9cc=path[_0xd9ff('0xe7')](config['root'],_0xd9ff('0x122'),_0xd9ff('0x123'),'attachments');var _0x378746=path[_0xd9ff('0xe7')](_0x494da6,_0x410fae);var _0x2acbe3=util[_0xd9ff('0xef')]('transcript-%d-%s.zip',_0x2031e9['params']['id'],_0x410fae);var _0x46d12c=path[_0xd9ff('0xe7')](_0x494da6,_0x2acbe3);var _0x54f4aa=[];_0x54f4aa[_0xd9ff('0x119')]({'model':db['User'],'as':_0xd9ff('0x7c'),'attributes':['id',_0xd9ff('0x43')],'raw':!![]});_0x54f4aa[_0xd9ff('0x119')]({'model':db[_0xd9ff('0x124')],'as':_0xd9ff('0x71'),'attributes':['id',_0xd9ff('0x125'),'lastName'],'raw':!![]});if(_0x2031e9['query'][_0xd9ff('0x126')]){_0x54f4aa['push']({'model':db[_0xd9ff('0xe3')],'as':'Attachment','raw':!![]});}var _0xd015e9=[{'model':db[_0xd9ff('0xd4')],'as':_0xd9ff('0xf3'),'attributes':['id','body',_0xd9ff('0x84'),_0xd9ff('0xff'),'secret','read'],'include':_0x54f4aa}];_0xd015e9['push']({'model':db[_0xd9ff('0xc5')],'as':_0xd9ff('0x127'),'attributes':['id',_0xd9ff('0x3c')]});_0xd015e9[_0xd9ff('0x119')]({'model':db[_0xd9ff('0x7c')],'as':_0xd9ff('0x128'),'attributes':['id',_0xd9ff('0x43')]});return db[_0xd9ff('0x49')]['find']({'where':{'id':_0x2031e9[_0xd9ff('0xbe')]['id']},'include':_0xd015e9})[_0xd9ff('0x22')](handleEntityNotFound(_0x3b50d9,null))[_0xd9ff('0x22')](function(_0x1b452e){if(_0x1b452e){var _0x3ab927=_0x1b452e[_0xd9ff('0x129')]({'plain':!![]});fs[_0xd9ff('0x12a')](_0x378746);var _0x2b6e15={'channel':_0xd9ff('0x12b'),'account':_0x3ab927['Account']['name'],'agent':_0x3ab927['Owner']?_0x3ab927[_0xd9ff('0x128')][_0xd9ff('0x43')]:'N.A.','createdAt':moment(_0x3ab927[_0xd9ff('0x84')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xd9ff('0xbb')](),'closedAt':_0x3ab927[_0xd9ff('0xda')]?moment(_0x3ab927[_0xd9ff('0x12c')])[_0xd9ff('0xef')](_0xd9ff('0x112'))[_0xd9ff('0xbb')]():'','disposition':_0x3ab927['disposition'],'chatInfo':{'browser':_0x3ab927[_0xd9ff('0x12d')],'os':_0x3ab927[_0xd9ff('0x12e')],'referer':_0x3ab927[_0xd9ff('0x12f')],'customerIp':_0x3ab927[_0xd9ff('0x130')],'customerPort':_0x3ab927[_0xd9ff('0x131')]?_0x3ab927['customerPort']:'N.A.'},'messages':_(_0x3ab927[_0xd9ff('0xf3')])[_0xd9ff('0x132')]()[_0xd9ff('0x90')]({'secret':![]})[_0xd9ff('0x79')](function(_0x319248){if(_0x319248[_0xd9ff('0xe3')]){var _0x1ea603=path[_0xd9ff('0xe7')](_0x49c9cc,_0x319248[_0xd9ff('0xe3')][_0xd9ff('0xe1')]);if(fs[_0xd9ff('0x133')](_0x1ea603)){fs[_0xd9ff('0x134')](_0x1ea603)[_0xd9ff('0x135')](fs['createWriteStream'](path[_0xd9ff('0xe7')](_0x378746,_0x319248[_0xd9ff('0xe3')][_0xd9ff('0xe1')])));}}return{'date':moment(_0x319248[_0xd9ff('0x84')])[_0xd9ff('0xef')](_0xd9ff('0x112'))[_0xd9ff('0xbb')](),'sender':_0x319248[_0xd9ff('0xff')]===_0xd9ff('0xd3')?_0x319248[_0xd9ff('0x7c')]?_0x319248[_0xd9ff('0x7c')][_0xd9ff('0x43')]:_0xd9ff('0xf6'):_0x319248['Contact'][_0xd9ff('0x125')]+(_0x319248[_0xd9ff('0x71')][_0xd9ff('0x136')]?'\x20'+_0x319248[_0xd9ff('0x71')]['lastName']:''),'body':_0x319248[_0xd9ff('0xe3')]?_0x319248['Attachment']['basename']:_0x319248[_0xd9ff('0x3f')],'direction':_0x319248[_0xd9ff('0xff')]===_0xd9ff('0xd3')?'A':'C','secret':_0x319248[_0xd9ff('0x116')],'read':_0x319248[_0xd9ff('0x8c')],'attachment':_0x319248[_0xd9ff('0xe3')]};})[_0xd9ff('0x6d')]()};return ejs['renderFile'](path[_0xd9ff('0xe7')](config[_0xd9ff('0xe8')],'server',_0xd9ff('0x137'),_0xd9ff('0x138')),{'interaction':_0x2b6e15})[_0xd9ff('0x22')](function(_0xb07a14){var _0x1c419f=path[_0xd9ff('0xe7')](_0x378746,_0xd9ff('0x139')+_0x3ab927['id']+'-'+_0x410fae+_0xd9ff('0x13a'));var _0x3156c8={'path':_0x1c419f,'channel':_0xd9ff('0x12b'),'interactionId':_0x3ab927['id']};return pdf[_0xd9ff('0x13b')](_0xb07a14,_0x3156c8);})['then'](function(){return new BPromise(function(_0x567007,_0x1019f9){zipdir(_0x378746,{'saveTo':_0x46d12c},function(_0x2ab78a,_0x4649d9){if(_0x2ab78a)return _0x1019f9(_0x2ab78a);return _0x567007(_0x4649d9);});})[_0xd9ff('0x22')](function(){return new BPromise(function(_0x166033,_0x3c40e4){rimraf(_0x378746,function(_0x346d93){if(_0x346d93)_0x3c40e4(_0x346d93);return _0x166033();});});})[_0xd9ff('0x22')](function(){return _0x3b50d9['download'](_0x46d12c,_0x2acbe3,function(_0x22680e){if(_0x22680e){console['log'](_0xd9ff('0x13c'),_0x22680e);}else{fs[_0xd9ff('0x13d')](_0x46d12c);}});});});}else{return _0x3b50d9['sendStatus'](0xc8);}})[_0xd9ff('0x2d')](handleError(_0x3b50d9,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index e3e4712..e77535e 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 _0xe530=['then','setDataValue','map','findAll','unreadMessages','length','hasOwnProperty','exports','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','remove','getUsers'];(function(_0x361229,_0x89f7fd){var _0x484ed0=function(_0x23bd60){while(--_0x23bd60){_0x361229['push'](_0x361229['shift']());}};_0x484ed0(++_0x89f7fd);}(_0xe530,0x19d));var _0x0e53=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xe530[_0xefd519];return _0x4bb882;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x0e53('0x0'))['db'][_0x0e53('0x1')];var ChatMessage=require(_0x0e53('0x0'))['db'][_0x0e53('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x0e53('0x3')](0x0);var events={'afterCreate':_0x0e53('0x4'),'afterUpdate':'update','afterDestroy':_0x0e53('0x5')};function emitEvent(_0x47625e){return function(_0x1348dd,_0x5c7e70,_0x5e9b9a){_0x1348dd[_0x0e53('0x6')]({'attributes':['id'],'raw':!![]})[_0x0e53('0x7')](function(_0x57f6f8){_0x1348dd[_0x0e53('0x8')]('Users',_0x57f6f8[_0x0e53('0x9')](function(_0x194db7){return{'id':_0x194db7['id']};}));return ChatMessage[_0x0e53('0xa')]({'where':{'ChatInteractionId':_0x1348dd['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0e53('0x7')](function(_0x15d592){_0x1348dd[_0x0e53('0x8')](_0x0e53('0xb'),_0x15d592[_0x0e53('0xc')]);ChatInteractionEvents['emit'](_0x47625e+':'+_0x1348dd['id'],_0x1348dd);ChatInteractionEvents['emit'](_0x47625e,_0x1348dd);_0x5e9b9a(null);})['catch'](_0x5e9b9a(null));};}for(var e in events){if(events[_0x0e53('0xd')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x0e53('0xe')]=ChatInteractionEvents; \ No newline at end of file +var _0x82f0=['update','remove','getUsers','then','map','findAll','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save'];(function(_0x5e7361,_0x31140d){var _0x248a05=function(_0x292e2c){while(--_0x292e2c){_0x5e7361['push'](_0x5e7361['shift']());}};_0x248a05(++_0x31140d);}(_0x82f0,0x1d6));var _0x082f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x82f0[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0x082f('0x0'));var ChatInteraction=require(_0x082f('0x1'))['db'][_0x082f('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x082f('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x082f('0x4')](0x0);var events={'afterCreate':_0x082f('0x5'),'afterUpdate':_0x082f('0x6'),'afterDestroy':_0x082f('0x7')};function emitEvent(_0x9cb553){return function(_0x4ae7ca,_0xa5dcb7,_0x151a3e){_0x4ae7ca[_0x082f('0x8')]({'attributes':['id'],'raw':!![]})[_0x082f('0x9')](function(_0x3c6282){_0x4ae7ca['setDataValue']('Users',_0x3c6282[_0x082f('0xa')](function(_0x2f3576){return{'id':_0x2f3576['id']};}));return ChatMessage[_0x082f('0xb')]({'where':{'ChatInteractionId':_0x4ae7ca['id'],'direction':'in','read':![]},'raw':!![]});})[_0x082f('0x9')](function(_0x4fbe6c){_0x4ae7ca['setDataValue'](_0x082f('0xc'),_0x4fbe6c[_0x082f('0xd')]);ChatInteractionEvents[_0x082f('0xe')](_0x9cb553+':'+_0x4ae7ca['id'],_0x4ae7ca);ChatInteractionEvents['emit'](_0x9cb553,_0x4ae7ca);_0x151a3e(null);})['catch'](_0x151a3e(null));};}for(var e in events){if(events[_0x082f('0xf')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x082f('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index d1669f0..04678a8 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 _0x5538=['util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x5538,0x10d));var _0x8553=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x5538[_0x29d915];return _0x160f86;};'use strict';var _=require(_0x8553('0x0'));var util=require(_0x8553('0x1'));var logger=require(_0x8553('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8553('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8553('0x4'));var rimraf=require(_0x8553('0x5'));var config=require(_0x8553('0x6'));var attributes=require(_0x8553('0x7'));module[_0x8553('0x8')]=function(_0x2aa9ec,_0x333ec7){return _0x2aa9ec[_0x8553('0x9')](_0x8553('0xa'),attributes,{'tableName':_0x8553('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3571b9,_0xe21d1d,_0x83962c){if(_0x3571b9[_0x8553('0xc')](_0x8553('0xd'))){_0x3571b9['closedAt']=moment()[_0x8553('0xe')](_0x8553('0xf'));}_0x83962c(null,_0x3571b9);}},'charset':_0x8553('0x10'),'collate':_0x8553('0x11')});}; \ No newline at end of file +var _0xbb69=['moment','request-promise','path','rimraf','./chatInteraction.attributes','exports','define','chat_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x5e601a,_0x16931f){var _0x5e34c4=function(_0x120dc7){while(--_0x120dc7){_0x5e601a['push'](_0x5e601a['shift']());}};_0x5e34c4(++_0x16931f);}(_0xbb69,0x10d));var _0x9bb6=function(_0x5035d5,_0x4a802e){_0x5035d5=_0x5035d5-0x0;var _0x14ba47=_0xbb69[_0x5035d5];return _0x14ba47;};'use strict';var _=require(_0x9bb6('0x0'));var util=require(_0x9bb6('0x1'));var logger=require('../../config/logger')(_0x9bb6('0x2'));var moment=require(_0x9bb6('0x3'));var BPromise=require('bluebird');var rp=require(_0x9bb6('0x4'));var fs=require('fs');var path=require(_0x9bb6('0x5'));var rimraf=require(_0x9bb6('0x6'));var config=require('../../config/environment');var attributes=require(_0x9bb6('0x7'));module[_0x9bb6('0x8')]=function(_0x151759,_0x40b278){return _0x151759[_0x9bb6('0x9')]('ChatInteraction',attributes,{'tableName':_0x9bb6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4d4936,_0x3bb585,_0x34794b){if(_0x4d4936[_0x9bb6('0xb')]('closed')){_0x4d4936[_0x9bb6('0xc')]=moment()[_0x9bb6('0xd')](_0x9bb6('0xe'));}_0x34794b(null,_0x4d4936);}},'charset':_0x9bb6('0xf'),'collate':_0x9bb6('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 613b66a..6f7bac4 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 _0x5243=['error','code','message','catch','UpdateChatInteraction','options','attributes','limit','AddTagsToChatInteraction','ChatInteraction','find','where','then','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2fee96,_0x2f735d){var _0x2e6ad1=function(_0x2c55ad){while(--_0x2c55ad){_0x2fee96['push'](_0x2fee96['shift']());}};_0x2e6ad1(++_0x2f735d);}(_0x5243,0x8a));var _0x3524=function(_0x5578d3,_0x2f41a8){_0x5578d3=_0x5578d3-0x0;var _0x289fc5=_0x5243[_0x5578d3];return _0x289fc5;};'use strict';var _=require(_0x3524('0x0'));var util=require(_0x3524('0x1'));var moment=require(_0x3524('0x2'));var BPromise=require(_0x3524('0x3'));var rs=require(_0x3524('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3524('0x5'))['db'];var utils=require(_0x3524('0x6'));var logger=require(_0x3524('0x7'))('rpc');var config=require(_0x3524('0x8'));var jayson=require(_0x3524('0x9'));var client=jayson['client'][_0x3524('0xa')]({'port':0x232a});config[_0x3524('0xb')]=_['defaults'](config[_0x3524('0xb')],{'host':_0x3524('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3524('0xb')]));require(_0x3524('0xd'))[_0x3524('0xe')](socket);function respondWithRpcPromise(_0x1a57ee,_0x2d1611,_0x2e5131){return new BPromise(function(_0x5da6f0,_0x322068){return client[_0x3524('0xf')](_0x1a57ee,_0x2e5131)['then'](function(_0x41fcaa){logger[_0x3524('0x10')](_0x3524('0x11'),_0x2d1611,_0x3524('0x12'));logger[_0x3524('0x13')](_0x3524('0x14'),_0x2d1611,_0x3524('0x12'),JSON[_0x3524('0x15')](_0x41fcaa));if(_0x41fcaa[_0x3524('0x16')]){if(_0x41fcaa[_0x3524('0x16')][_0x3524('0x17')]===0x1f4){logger[_0x3524('0x16')](_0x3524('0x11'),_0x2d1611,_0x41fcaa[_0x3524('0x16')]['message']);return _0x322068(_0x41fcaa['error'][_0x3524('0x18')]);}logger['error'](_0x3524('0x11'),_0x2d1611,_0x41fcaa[_0x3524('0x16')][_0x3524('0x18')]);return _0x5da6f0(_0x41fcaa[_0x3524('0x16')]['message']);}else{logger['info'](_0x3524('0x11'),_0x2d1611,_0x3524('0x12'));_0x5da6f0(_0x41fcaa['result'][_0x3524('0x18')]);}})[_0x3524('0x19')](function(_0x4e6e4a){logger[_0x3524('0x16')](_0x3524('0x11'),_0x2d1611,_0x4e6e4a);_0x322068(_0x4e6e4a);});});}exports[_0x3524('0x1a')]=function(_0x1d9d8f){var _0x350eb9=this;return new Promise(function(_0x55f960,_0x2dd58e){return db['ChatInteraction']['update'](_0x1d9d8f['body'],{'raw':_0x1d9d8f['options']?_0x1d9d8f[_0x3524('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d9d8f[_0x3524('0x1b')]?_0x1d9d8f['options']['where']||null:null,'attributes':_0x1d9d8f[_0x3524('0x1b')]?_0x1d9d8f['options'][_0x3524('0x1c')]||null:null,'limit':_0x1d9d8f[_0x3524('0x1b')]?_0x1d9d8f['options'][_0x3524('0x1d')]||null:null})['then'](function(_0xea0d70){logger[_0x3524('0x10')]('UpdateChatInteraction',_0x1d9d8f);logger[_0x3524('0x13')]('UpdateChatInteraction',_0x1d9d8f,JSON['stringify'](_0xea0d70));_0x55f960(_0xea0d70);})[_0x3524('0x19')](function(_0x164fd4){logger[_0x3524('0x16')](_0x3524('0x1a'),_0x164fd4[_0x3524('0x18')],_0x1d9d8f);_0x2dd58e(_0x350eb9[_0x3524('0x16')](0x1f4,_0x164fd4[_0x3524('0x18')]));});});};exports[_0x3524('0x1e')]=function(_0x344ba9){return new Promise(function(_0x13fb9f,_0x4c285a){return db[_0x3524('0x1f')][_0x3524('0x20')]({'where':_0x344ba9[_0x3524('0x1b')]?_0x344ba9['options'][_0x3524('0x21')]||null:null})[_0x3524('0x22')](function(_0x3c9ca8){if(_0x3c9ca8){return _0x3c9ca8['addTags'](_0x344ba9[_0x3524('0x23')][_0x3524('0x24')],_[_0x3524('0x25')](_0x344ba9['body'],[_0x3524('0x24'),'id'])||{});}})[_0x3524('0x26')](function(_0x34167c){logger[_0x3524('0x10')](_0x3524('0x27'),_0x344ba9);logger['debug']('AddTags',_0x344ba9,JSON[_0x3524('0x15')](_0x34167c));_0x13fb9f(_0x34167c);})[_0x3524('0x19')](function(_0x49b175){logger[_0x3524('0x16')](_0x3524('0x27'),_0x49b175['message'],_0x344ba9);_0x4c285a(_this[_0x3524('0x16')](0x1f4,_0x49b175[_0x3524('0x18')]));});});}; \ No newline at end of file +var _0x0ca4=['AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','UpdateChatInteraction','ChatInteraction','body','options','raw','where','attributes','stringify','catch','find','addTags','ids','omit','spread'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x0ca4,0xc4));var _0x40ca=function(_0x49cd07,_0x417853){_0x49cd07=_0x49cd07-0x0;var _0x1f6a3b=_0x0ca4[_0x49cd07];return _0x1f6a3b;};'use strict';var _=require(_0x40ca('0x0'));var util=require('util');var moment=require(_0x40ca('0x1'));var BPromise=require(_0x40ca('0x2'));var rs=require(_0x40ca('0x3'));var fs=require('fs');var Redis=require(_0x40ca('0x4'));var db=require(_0x40ca('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x40ca('0x6'))(_0x40ca('0x7'));var config=require('../../config/environment');var jayson=require(_0x40ca('0x8'));var client=jayson[_0x40ca('0x9')][_0x40ca('0xa')]({'port':0x232a});config[_0x40ca('0xb')]=_['defaults'](config[_0x40ca('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x40ca('0xc'))(new Redis(config['redis']));require(_0x40ca('0xd'))['register'](socket);function respondWithRpcPromise(_0x5499e4,_0xa58426,_0x4a15f7){return new BPromise(function(_0x81d41c,_0x1beb18){return client[_0x40ca('0xe')](_0x5499e4,_0x4a15f7)[_0x40ca('0xf')](function(_0x4fd9d3){logger[_0x40ca('0x10')](_0x40ca('0x11'),_0xa58426,_0x40ca('0x12'));logger[_0x40ca('0x13')](_0x40ca('0x14'),_0xa58426,'request\x20sent',JSON['stringify'](_0x4fd9d3));if(_0x4fd9d3[_0x40ca('0x15')]){if(_0x4fd9d3[_0x40ca('0x15')][_0x40ca('0x16')]===0x1f4){logger[_0x40ca('0x15')]('ChatInteraction,\x20%s,\x20%s',_0xa58426,_0x4fd9d3['error']['message']);return _0x1beb18(_0x4fd9d3[_0x40ca('0x15')][_0x40ca('0x17')]);}logger[_0x40ca('0x15')](_0x40ca('0x11'),_0xa58426,_0x4fd9d3['error'][_0x40ca('0x17')]);return _0x81d41c(_0x4fd9d3['error'][_0x40ca('0x17')]);}else{logger[_0x40ca('0x10')](_0x40ca('0x11'),_0xa58426,_0x40ca('0x12'));_0x81d41c(_0x4fd9d3['result'][_0x40ca('0x17')]);}})['catch'](function(_0x2038de){logger['error'](_0x40ca('0x11'),_0xa58426,_0x2038de);_0x1beb18(_0x2038de);});});}exports[_0x40ca('0x18')]=function(_0x24d8ba){var _0x22f60e=this;return new Promise(function(_0x4ba991,_0x5a7af0){return db[_0x40ca('0x19')]['update'](_0x24d8ba[_0x40ca('0x1a')],{'raw':_0x24d8ba[_0x40ca('0x1b')]?_0x24d8ba[_0x40ca('0x1b')][_0x40ca('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24d8ba[_0x40ca('0x1b')]?_0x24d8ba[_0x40ca('0x1b')][_0x40ca('0x1d')]||null:null,'attributes':_0x24d8ba[_0x40ca('0x1b')]?_0x24d8ba['options'][_0x40ca('0x1e')]||null:null,'limit':_0x24d8ba['options']?_0x24d8ba[_0x40ca('0x1b')]['limit']||null:null})[_0x40ca('0xf')](function(_0x8a9d6e){logger['info'](_0x40ca('0x18'),_0x24d8ba);logger[_0x40ca('0x13')]('UpdateChatInteraction',_0x24d8ba,JSON[_0x40ca('0x1f')](_0x8a9d6e));_0x4ba991(_0x8a9d6e);})[_0x40ca('0x20')](function(_0x415010){logger[_0x40ca('0x15')](_0x40ca('0x18'),_0x415010['message'],_0x24d8ba);_0x5a7af0(_0x22f60e[_0x40ca('0x15')](0x1f4,_0x415010[_0x40ca('0x17')]));});});};exports['AddTagsToChatInteraction']=function(_0x5879cc){return new Promise(function(_0x5f4765,_0x290232){return db[_0x40ca('0x19')][_0x40ca('0x21')]({'where':_0x5879cc[_0x40ca('0x1b')]?_0x5879cc['options'][_0x40ca('0x1d')]||null:null})['then'](function(_0x21d904){if(_0x21d904){return _0x21d904[_0x40ca('0x22')](_0x5879cc['body'][_0x40ca('0x23')],_[_0x40ca('0x24')](_0x5879cc['body'],[_0x40ca('0x23'),'id'])||{});}})[_0x40ca('0x25')](function(_0x588e9d){logger[_0x40ca('0x10')](_0x40ca('0x26'),_0x5879cc);logger[_0x40ca('0x13')]('AddTags',_0x5879cc,JSON[_0x40ca('0x1f')](_0x588e9d));_0x5f4765(_0x588e9d);})['catch'](function(_0x20f93c){logger[_0x40ca('0x15')](_0x40ca('0x26'),_0x20f93c[_0x40ca('0x17')],_0x5879cc);_0x290232(_this[_0x40ca('0x15')](0x1f4,_0x20f93c[_0x40ca('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index a512840..13bbdca 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 _0x7825=['removeListener','register','length','chatInteraction:','./chatInteraction.events','save','remove','emit'];(function(_0x3403d5,_0x3d99fc){var _0xf9df4f=function(_0x33d748){while(--_0x33d748){_0x3403d5['push'](_0x3403d5['shift']());}};_0xf9df4f(++_0x3d99fc);}(_0x7825,0xfc));var _0x5782=function(_0x503ec3,_0x5f851e){_0x503ec3=_0x503ec3-0x0;var _0x4ce7cf=_0x7825[_0x503ec3];return _0x4ce7cf;};'use strict';var ChatInteractionEvents=require(_0x5782('0x0'));var events=[_0x5782('0x1'),_0x5782('0x2'),'update'];function createListener(_0x9a0bd,_0x82a2b5){return function(_0x435009){_0x82a2b5[_0x5782('0x3')](_0x9a0bd,_0x435009);};}function removeListener(_0x4f618b,_0x53335f){return function(){ChatInteractionEvents[_0x5782('0x4')](_0x4f618b,_0x53335f);};}exports[_0x5782('0x5')]=function(_0x3a7cc6){for(var _0x17214b=0x0,_0x334879=events[_0x5782('0x6')];_0x17214b<_0x334879;_0x17214b++){var _0x62007f=events[_0x17214b];var _0x1418c4=createListener(_0x5782('0x7')+_0x62007f,_0x3a7cc6);ChatInteractionEvents['on'](_0x62007f,_0x1418c4);}}; \ No newline at end of file +var _0xa2c5=['emit','register','save','remove','update'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa2c5,0x7a));var _0x5a2c=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0xa2c5[_0x369151];return _0x4292d5;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x5a2c('0x0'),_0x5a2c('0x1'),_0x5a2c('0x2')];function createListener(_0x650de5,_0x56a201){return function(_0x3eb4cc){_0x56a201[_0x5a2c('0x3')](_0x650de5,_0x3eb4cc);};}function removeListener(_0x5b9b16,_0x26cfec){return function(){ChatInteractionEvents['removeListener'](_0x5b9b16,_0x26cfec);};}exports[_0x5a2c('0x4')]=function(_0x42a5c7){for(var _0xf13236=0x0,_0x5e43dc=events['length'];_0xf13236<_0x5e43dc;_0xf13236++){var _0x929717=events[_0xf13236];var _0x82ba11=createListener('chatInteraction:'+_0x929717,_0x42a5c7);ChatInteractionEvents['on'](_0x929717,_0x82ba11);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index bf449db..87253d7 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 _0x534f=['describe','/:id','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','join','root','server/files/attachments/','%s-%s','now','originalname','/:id/attachment_upload','single','file','attachmentUpload','addMessage','tracked','chat','chatinteraction:addtags','addTags','update','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/describe'];(function(_0x3734a2,_0x250e45){var _0x595ca9=function(_0x271b76){while(--_0x271b76){_0x3734a2['push'](_0x3734a2['shift']());}};_0x595ca9(++_0x250e45);}(_0x534f,0x1d8));var _0xf534=function(_0x19ae33,_0xfa776a){_0x19ae33=_0x19ae33-0x0;var _0x3d57f0=_0x534f[_0x19ae33];return _0x3d57f0;};'use strict';var multer=require(_0xf534('0x0'));var util=require(_0xf534('0x1'));var path=require(_0xf534('0x2'));var timeout=require(_0xf534('0x3'));var express=require(_0xf534('0x4'));var router=express[_0xf534('0x5')]();var fs_extra=require(_0xf534('0x6'));var auth=require(_0xf534('0x7'));var interaction=require(_0xf534('0x8'));var config=require(_0xf534('0x9'));var controller=require(_0xf534('0xa'));router[_0xf534('0xb')]('/',auth[_0xf534('0xc')](),controller['index']);router[_0xf534('0xb')](_0xf534('0xd'),auth[_0xf534('0xc')](),controller[_0xf534('0xe')]);router[_0xf534('0xb')](_0xf534('0xf'),auth[_0xf534('0x10')](),controller['show']);router['get']('/:id/attachment_download',auth[_0xf534('0x10')](),controller[_0xf534('0x11')]);router['get'](_0xf534('0x12'),auth[_0xf534('0xc')](),controller['getMessages']);router[_0xf534('0xb')]('/:id/my_messages',auth[_0xf534('0x10')](),controller[_0xf534('0x13')]);router[_0xf534('0xb')](_0xf534('0x14'),auth['isAuthenticated'](),controller[_0xf534('0x15')]);router[_0xf534('0x16')]('/',auth[_0xf534('0xc')](),controller[_0xf534('0x17')]);router[_0xf534('0x16')](_0xf534('0x18'),auth[_0xf534('0xc')](),controller[_0xf534('0x19')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xf59186,_0x2e5f9d,_0x56f48e){_0x56f48e(null,path[_0xf534('0x1a')](config[_0xf534('0x1b')],_0xf534('0x1c')));},'filename':function(_0x4a83d3,_0x2abbc8,_0x55d371){_0x55d371(null,util['format'](_0xf534('0x1d'),Date[_0xf534('0x1e')](),_0x2abbc8[_0xf534('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf534('0x16')](_0xf534('0x20'),upload[_0xf534('0x21')](_0xf534('0x22')),controller[_0xf534('0x23')]);router[_0xf534('0x16')](_0xf534('0x12'),auth[_0xf534('0x10')](),controller[_0xf534('0x24')]);router[_0xf534('0x16')]('/:id/tags',auth[_0xf534('0xc')](),interaction[_0xf534('0x25')](_0xf534('0x26'),_0xf534('0x27')),controller[_0xf534('0x28')]);router['put'](_0xf534('0xf'),auth['isAuthenticated'](),interaction[_0xf534('0x25')]('chat','chatinteraction:update'),controller[_0xf534('0x29')]);router[_0xf534('0x2a')](_0xf534('0x2b'),controller[_0xf534('0x2c')]);router[_0xf534('0x2a')](_0xf534('0x2d'),auth[_0xf534('0x10')](),controller[_0xf534('0x2e')]);router['put'](_0xf534('0x2f'),controller[_0xf534('0x30')]);router[_0xf534('0x31')](_0xf534('0xf'),auth[_0xf534('0xc')](),interaction[_0xf534('0x25')](_0xf534('0x26'),_0xf534('0x32')),controller[_0xf534('0x33')]);router[_0xf534('0x31')](_0xf534('0x34'),auth[_0xf534('0xc')](),controller[_0xf534('0x35')]);module['exports']=router; \ No newline at end of file +var _0x31ad=['isAuthenticated','index','/describe','/:id','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','diskStorage','join','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','tracked','chatinteraction:update','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x167b75,_0x4b6ab7){var _0x3c305f=function(_0x542d7d){while(--_0x542d7d){_0x167b75['push'](_0x167b75['shift']());}};_0x3c305f(++_0x4b6ab7);}(_0x31ad,0xca));var _0xd31a=function(_0x251230,_0x3a5c8f){_0x251230=_0x251230-0x0;var _0x3b3ebd=_0x31ad[_0x251230];return _0x3b3ebd;};'use strict';var multer=require(_0xd31a('0x0'));var util=require('util');var path=require(_0xd31a('0x1'));var timeout=require(_0xd31a('0x2'));var express=require(_0xd31a('0x3'));var router=express[_0xd31a('0x4')]();var fs_extra=require(_0xd31a('0x5'));var auth=require(_0xd31a('0x6'));var interaction=require(_0xd31a('0x7'));var config=require(_0xd31a('0x8'));var controller=require('./chatInteraction.controller');router[_0xd31a('0x9')]('/',auth[_0xd31a('0xa')](),controller[_0xd31a('0xb')]);router[_0xd31a('0x9')](_0xd31a('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xd31a('0x9')](_0xd31a('0xd'),auth[_0xd31a('0xe')](),controller['show']);router['get']('/:id/attachment_download',auth[_0xd31a('0xe')](),controller[_0xd31a('0xf')]);router[_0xd31a('0x9')](_0xd31a('0x10'),auth['isAuthenticated'](),controller[_0xd31a('0x11')]);router['get'](_0xd31a('0x12'),auth[_0xd31a('0xe')](),controller[_0xd31a('0x13')]);router[_0xd31a('0x9')](_0xd31a('0x14'),auth['isAuthenticated'](),controller[_0xd31a('0x15')]);router[_0xd31a('0x16')]('/',auth['isAuthenticated'](),controller[_0xd31a('0x17')]);router[_0xd31a('0x16')](_0xd31a('0x18'),auth[_0xd31a('0xa')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xd31a('0x19')]({'destination':function(_0x51f04d,_0x4198e4,_0x138999){_0x138999(null,path[_0xd31a('0x1a')](config['root'],'server/files/attachments/'));},'filename':function(_0x5e8d2a,_0x9cb0f2,_0x196807){_0x196807(null,util['format'](_0xd31a('0x1b'),Date[_0xd31a('0x1c')](),_0x9cb0f2[_0xd31a('0x1d')][_0xd31a('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xd31a('0x16')](_0xd31a('0x1f'),upload[_0xd31a('0x20')](_0xd31a('0x21')),controller[_0xd31a('0x22')]);router[_0xd31a('0x16')]('/:id/messages',auth[_0xd31a('0xe')](),controller[_0xd31a('0x23')]);router[_0xd31a('0x16')](_0xd31a('0x24'),auth[_0xd31a('0xa')](),interaction['tracked'](_0xd31a('0x25'),_0xd31a('0x26')),controller[_0xd31a('0x27')]);router['put']('/:id',auth[_0xd31a('0xa')](),interaction[_0xd31a('0x28')](_0xd31a('0x25'),_0xd31a('0x29')),controller['update']);router[_0xd31a('0x2a')](_0xd31a('0x2b'),controller[_0xd31a('0x2c')]);router[_0xd31a('0x2a')](_0xd31a('0x2d'),auth[_0xd31a('0xe')](),controller[_0xd31a('0x2e')]);router[_0xd31a('0x2a')]('/:id/close',controller[_0xd31a('0x2f')]);router[_0xd31a('0x30')]('/:id',auth[_0xd31a('0xa')](),interaction[_0xd31a('0x28')](_0xd31a('0x25'),_0xd31a('0x31')),controller[_0xd31a('0x32')]);router[_0xd31a('0x30')](_0xd31a('0x24'),auth['isAuthenticated'](),controller[_0xd31a('0x33')]);module[_0xd31a('0x34')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 78aa166..0177ae1 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 _0x3554=['medium','BOOLEAN','INTEGER','sequelize','exports','TEXT'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x3554,0x111));var _0x4355=function(_0x258bfa,_0x5acb66){_0x258bfa=_0x258bfa-0x0;var _0x3076fd=_0x3554[_0x258bfa];return _0x3076fd;};'use strict';var Sequelize=require(_0x4355('0x0'));module[_0x4355('0x1')]={'body':{'type':Sequelize[_0x4355('0x2')](_0x4355('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4355('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x4355('0x5')]}}; \ No newline at end of file +var _0x9fb9=['BOOLEAN','sequelize','exports','TEXT'];(function(_0x59767d,_0x2ed59f){var _0xf30900=function(_0x24b003){while(--_0x24b003){_0x59767d['push'](_0x59767d['shift']());}};_0xf30900(++_0x2ed59f);}(_0x9fb9,0xa1));var _0x99fb=function(_0x80b524,_0x62f0d6){_0x80b524=_0x80b524-0x0;var _0x167770=_0x9fb9[_0x80b524];return _0x167770;};'use strict';var Sequelize=require(_0x99fb('0x0'));module[_0x99fb('0x1')]={'body':{'type':Sequelize[_0x99fb('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x99fb('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index f1d5e7e..d4c63c5 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 _0x840b=['get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','length','resourceId','push','FromId','ToId','-createdAt','all','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','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','then','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','model','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','destroy','describe'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0x840b,0x104));var _0xb840=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0x840b[_0xc8a931];return _0x28bd27;};'use strict';var emlformat=require(_0xb840('0x0'));var rimraf=require(_0xb840('0x1'));var zipdir=require(_0xb840('0x2'));var jsonpatch=require(_0xb840('0x3'));var rp=require(_0xb840('0x4'));var moment=require(_0xb840('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb840('0x6'));var util=require(_0xb840('0x7'));var path=require(_0xb840('0x8'));var sox=require(_0xb840('0x9'));var csv=require(_0xb840('0xa'));var ejs=require(_0xb840('0xb'));var fs=require('fs');var fs_extra=require(_0xb840('0xc'));var _=require(_0xb840('0xd'));var squel=require(_0xb840('0xe'));var crypto=require(_0xb840('0xf'));var jsforce=require(_0xb840('0x10'));var deskjs=require(_0xb840('0x11'));var toCsv=require(_0xb840('0xa'));var querystring=require('querystring');var Papa=require(_0xb840('0x12'));var Redis=require('ioredis');var authService=require(_0xb840('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb840('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb840('0x15'));var utils=require(_0xb840('0x16'));var config=require(_0xb840('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xb840('0x18')]=_[_0xb840('0x19')](config[_0xb840('0x18')],{'host':_0xb840('0x1a'),'port':0x18eb});var socket=require(_0xb840('0x1b'))(new Redis(config[_0xb840('0x18')]));require('./chatInternalMessage.socket')[_0xb840('0x1c')](socket);function respondWithStatusCode(_0xe605b,_0x516f21){_0x516f21=_0x516f21||0xcc;return function(_0x16d27c){if(_0x16d27c){return _0xe605b[_0xb840('0x1d')](_0x516f21);}return _0xe605b[_0xb840('0x1e')](_0x516f21)[_0xb840('0x1f')]();};}function respondWithResult(_0x84bd1a,_0x269c53){_0x269c53=_0x269c53||0xc8;return function(_0x306dff){if(_0x306dff){return _0x84bd1a[_0xb840('0x1e')](_0x269c53)[_0xb840('0x20')](_0x306dff);}};}function respondWithFilteredResult(_0x5bf2d0,_0x9249a7){return function(_0x5bb8e0){if(_0x5bb8e0){var _0x2686d1=typeof _0x9249a7[_0xb840('0x21')]==='undefined'&&typeof _0x9249a7['limit']===_0xb840('0x22');var _0x5bb96c=_0x5bb8e0[_0xb840('0x23')];var _0xb19a4e=_0x2686d1?0x0:_0x9249a7[_0xb840('0x21')];var _0x4b43bf=_0x2686d1?_0x5bb8e0[_0xb840('0x23')]:_0x9249a7[_0xb840('0x21')]+_0x9249a7[_0xb840('0x24')];var _0xbbc21e;if(_0x4b43bf>=_0x5bb96c){_0x4b43bf=_0x5bb96c;_0xbbc21e=0xc8;}else{_0xbbc21e=0xce;}_0x5bf2d0['status'](_0xbbc21e);return _0x5bf2d0[_0xb840('0x25')](_0xb840('0x26'),_0xb19a4e+'-'+_0x4b43bf+'/'+_0x5bb96c)['json'](_0x5bb8e0);}return null;};}function patchUpdates(_0x55b902){return function(_0xcfc93d){try{jsonpatch[_0xb840('0x27')](_0xcfc93d,_0x55b902,!![]);}catch(_0x1b0f3a){return BPromise['reject'](_0x1b0f3a);}return _0xcfc93d['save']();};}function saveUpdates(_0x34eadb,_0xf52092){return function(_0x484161){if(_0x484161){return _0x484161['update'](_0x34eadb)['then'](function(_0x28820f){return _0x28820f;});}return null;};}function removeEntity(_0x439736,_0x26210d){return function(_0x1b499f){if(_0x1b499f){return _0x1b499f['destroy']()[_0xb840('0x28')](function(){_0x439736[_0xb840('0x1e')](0xcc)[_0xb840('0x1f')]();});}};}function handleEntityNotFound(_0x633a75,_0x34dbda){return function(_0x174649){if(!_0x174649){_0x633a75['sendStatus'](0x194);}return _0x174649;};}function handleError(_0x10d2c3,_0x493285){_0x493285=_0x493285||0x1f4;return function(_0x429d45){logger[_0xb840('0x29')](_0x429d45[_0xb840('0x2a')]);if(_0x429d45[_0xb840('0x2b')]){delete _0x429d45[_0xb840('0x2b')];}_0x10d2c3['status'](_0x493285)[_0xb840('0x2c')](_0x429d45);};}exports[_0xb840('0x2d')]=function(_0x56be87,_0x46c5cb){var _0xae7e98={},_0xc9cf51={},_0x35810e={'count':0x0,'rows':[]};var _0x1092a6=_[_0xb840('0x2e')](db[_0xb840('0x2f')][_0xb840('0x30')],function(_0x5b6f1b){return{'name':_0x5b6f1b[_0xb840('0x31')],'type':_0x5b6f1b[_0xb840('0x32')]['key']};});_0xc9cf51[_0xb840('0x33')]=_[_0xb840('0x2e')](_0x1092a6,'name');_0xc9cf51['query']=_['keys'](_0x56be87['query']);_0xc9cf51['filters']=_[_0xb840('0x34')](_0xc9cf51[_0xb840('0x33')],_0xc9cf51[_0xb840('0x35')]);_0xae7e98[_0xb840('0x36')]=_['intersection'](_0xc9cf51[_0xb840('0x33')],qs[_0xb840('0x37')](_0x56be87[_0xb840('0x35')]['fields']));_0xae7e98[_0xb840('0x36')]=_0xae7e98[_0xb840('0x36')]['length']?_0xae7e98[_0xb840('0x36')]:_0xc9cf51[_0xb840('0x33')];if(!_0x56be87['query'][_0xb840('0x38')](_0xb840('0x39'))){_0xae7e98[_0xb840('0x24')]=qs[_0xb840('0x24')](_0x56be87[_0xb840('0x35')]['limit']);_0xae7e98[_0xb840('0x21')]=qs[_0xb840('0x21')](_0x56be87[_0xb840('0x35')]['offset']);}_0xae7e98['order']=qs[_0xb840('0x3a')](_0x56be87['query'][_0xb840('0x3a')]);_0xae7e98[_0xb840('0x3b')]=qs[_0xb840('0x3c')](_[_0xb840('0x3d')](_0x56be87[_0xb840('0x35')],_0xc9cf51[_0xb840('0x3c')]),_0x1092a6);if(_0x56be87['query'][_0xb840('0x3e')]){_0xae7e98[_0xb840('0x3b')]=_[_0xb840('0x3f')](_0xae7e98[_0xb840('0x3b')],{'$or':_[_0xb840('0x2e')](_0x1092a6,function(_0xeb9c84){if(_0xeb9c84[_0xb840('0x32')]!==_0xb840('0x40')){var _0x196f93={};_0x196f93[_0xeb9c84[_0xb840('0x2b')]]={'$like':'%'+_0x56be87[_0xb840('0x35')][_0xb840('0x3e')]+'%'};return _0x196f93;}})});}_0xae7e98=_[_0xb840('0x3f')]({},_0xae7e98,_0x56be87[_0xb840('0x41')]);var _0x192fcc={'where':_0xae7e98['where']};return db[_0xb840('0x2f')][_0xb840('0x23')](_0x192fcc)[_0xb840('0x28')](function(_0x5bc23e){_0x35810e[_0xb840('0x23')]=_0x5bc23e;if(_0x56be87[_0xb840('0x35')][_0xb840('0x42')]){_0xae7e98[_0xb840('0x43')]=[{'all':!![]}];}return db[_0xb840('0x2f')][_0xb840('0x44')](_0xae7e98);})['then'](function(_0x2ad550){_0x35810e[_0xb840('0x45')]=_0x2ad550;return _0x35810e;})['then'](respondWithFilteredResult(_0x46c5cb,_0xae7e98))[_0xb840('0x46')](handleError(_0x46c5cb,null));};exports[_0xb840('0x47')]=function(_0xa1d119,_0x44f235){var _0xaaec9b={'raw':!![],'where':{'id':_0xa1d119[_0xb840('0x48')]['id']}},_0x2b8716={};_0x2b8716[_0xb840('0x33')]=_[_0xb840('0x49')](db[_0xb840('0x2f')][_0xb840('0x30')]);_0x2b8716[_0xb840('0x35')]=_[_0xb840('0x49')](_0xa1d119['query']);_0x2b8716[_0xb840('0x3c')]=_[_0xb840('0x34')](_0x2b8716[_0xb840('0x33')],_0x2b8716[_0xb840('0x35')]);_0xaaec9b[_0xb840('0x36')]=_[_0xb840('0x34')](_0x2b8716[_0xb840('0x33')],qs[_0xb840('0x37')](_0xa1d119[_0xb840('0x35')][_0xb840('0x37')]));_0xaaec9b[_0xb840('0x36')]=_0xaaec9b[_0xb840('0x36')]['length']?_0xaaec9b[_0xb840('0x36')]:_0x2b8716[_0xb840('0x33')];if(_0xa1d119['query']['includeAll']){_0xaaec9b[_0xb840('0x43')]=[{'all':!![]}];}_0xaaec9b=_[_0xb840('0x3f')]({},_0xaaec9b,_0xa1d119[_0xb840('0x41')]);return db[_0xb840('0x2f')]['find'](_0xaaec9b)['then'](handleEntityNotFound(_0x44f235,null))[_0xb840('0x28')](respondWithResult(_0x44f235,null))['catch'](handleError(_0x44f235,null));};exports[_0xb840('0x4a')]=function(_0x12fb1f,_0x3b0f1c){return db[_0xb840('0x2f')][_0xb840('0x4a')](_0x12fb1f[_0xb840('0x4b')],{})[_0xb840('0x28')](respondWithResult(_0x3b0f1c,0xc9))[_0xb840('0x46')](handleError(_0x3b0f1c,null));};exports['update']=function(_0x57095e,_0x166263){if(_0x57095e[_0xb840('0x4b')]['id']){delete _0x57095e[_0xb840('0x4b')]['id'];}return db[_0xb840('0x2f')][_0xb840('0x4c')]({'where':{'id':_0x57095e[_0xb840('0x48')]['id']}})['then'](handleEntityNotFound(_0x166263,null))['then'](saveUpdates(_0x57095e[_0xb840('0x4b')],null))[_0xb840('0x28')](respondWithResult(_0x166263,null))[_0xb840('0x46')](handleError(_0x166263,null));};exports[_0xb840('0x4d')]=function(_0x2296fc,_0xddf546){return db[_0xb840('0x2f')]['find']({'where':{'id':_0x2296fc[_0xb840('0x48')]['id']}})[_0xb840('0x28')](handleEntityNotFound(_0xddf546,null))[_0xb840('0x28')](removeEntity(_0xddf546,null))[_0xb840('0x46')](handleError(_0xddf546,null));};exports[_0xb840('0x4e')]=function(_0x25e6fa,_0x530653){return db[_0xb840('0x2f')][_0xb840('0x4e')]()[_0xb840('0x28')](respondWithResult(_0x530653,null))[_0xb840('0x46')](handleError(_0x530653,null));};function wrapUser(_0x4abacd){return function(_0x28d68f){var _0x4b8e2b=_0x4abacd[_0xb840('0x4f')]({'plain':!![]});_0x4b8e2b[_0xb840('0x50')]=[];if(_0x28d68f){_0x4b8e2b[_0xb840('0x51')]=_0x28d68f[_0xb840('0x52')];_0x4b8e2b[_0xb840('0x53')]=_0x28d68f;}else{_0x4b8e2b['lastMessageAt']=moment(0x0)[_0xb840('0x54')](_0xb840('0x55'));_0x4b8e2b[_0xb840('0x53')]={};}return _0x4b8e2b;};}exports[_0xb840('0x56')]=function(_0x5006ee,_0x3c470a,_0x14a029){var _0x2b9bd6=[];return db[_0xb840('0x57')][_0xb840('0x44')]({'where':{'role':[_0xb840('0x58'),_0xb840('0x59'),_0xb840('0x5a')]},'attributes':['id',_0xb840('0x5b'),_0xb840('0x2b'),_0xb840('0x5c'),_0xb840('0x5d'),_0xb840('0x5e'),_0xb840('0x5f'),_0xb840('0x60'),_0xb840('0x61'),'showWebBar'],'order':qs['sort'](_0xb840('0x62')),'include':[{'model':db['VoiceQueue'],'as':_0xb840('0x63'),'attributes':['id','name',_0xb840('0x32')],'through':{'attributes':[]}}]})[_0xb840('0x28')](function(_0x1abdf0){if(_0x1abdf0){var _0x2336a6=_0x5006ee[_0xb840('0x5a')][_0xb840('0x4f')]({'plain':!![]});if(!_0x2336a6)throw new Error(_0xb840('0x64'));if(_0x2336a6[_0xb840('0x5c')]==='user'){return db[_0xb840('0x65')]['find']({'where':{'name':_0xb840('0x66'),'userProfileId':_0x2336a6['userProfileId']},'raw':!![]})[_0xb840('0x28')](function(_0x81163a){if(_0x81163a){if(_0x81163a[_0xb840('0x67')]===0x0){return db[_0xb840('0x68')][_0xb840('0x44')]({'where':{'sectionId':_0x81163a['id']},'raw':!![]})[_0xb840('0x28')](function(_0x2a0826){var _0x3c832a=[];if(_[_0xb840('0x69')](_0x2a0826)){_0x3c832a=_['filter'](_0x1abdf0,function(_0x312c14){if(_0x312c14['role']!==_0xb840('0x58')){return _0x312c14;}});return _0x3c832a;}else{for(var _0x54db6c=0x0;_0x54db6c<_0x1abdf0[_0xb840('0x6a')];_0x54db6c++){var _0x5965ca=_0x1abdf0[_0x54db6c];if(_0x5965ca[_0xb840('0x5c')]===_0xb840('0x58')){var _0x371cbc=_[_0xb840('0x4c')](_0x2a0826,function(_0x2decf5){return _0x2decf5[_0xb840('0x6b')]===_0x5965ca['id'];});if(_0x371cbc)_0x3c832a[_0xb840('0x6c')](_0x5965ca);}else{_0x3c832a[_0xb840('0x6c')](_0x5965ca);}}return _0x3c832a;}});}else{return _0x1abdf0;}}else{var _0x374bcc=_['filter'](_0x1abdf0,function(_0x5a9475){if(_0x5a9475[_0xb840('0x5c')]!==_0xb840('0x58')){return _0x5a9475;}});return _0x374bcc;}});}else{return _0x1abdf0;}}})[_0xb840('0x28')](function(_0x40d349){var _0x2d466b=[];if(_0x40d349){_0x2b9bd6=_0x40d349;for(var _0x49c9c3=0x0;_0x49c9c3<_0x40d349[_0xb840('0x6a')];_0x49c9c3+=0x1){_0x2b9bd6[_0x49c9c3][_0xb840('0x50')]=[];_0x2d466b[_0xb840('0x6c')](db['ChatInternalMessage'][_0xb840('0x4c')]({'where':{'FromId':[_0x5006ee[_0xb840('0x5a')]['id'],_0x40d349[_0x49c9c3]['id']],'ToId':[_0x5006ee[_0xb840('0x5a')]['id'],_0x40d349[_0x49c9c3]['id']],'ChatGroupId':null},'attributes':['id',_0xb840('0x52'),_0xb840('0x6d'),_0xb840('0x6e'),'read',_0xb840('0x4b')],'order':qs[_0xb840('0x3a')](_0xb840('0x6f')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xb840('0x28')](wrapUser(_0x40d349[_0x49c9c3])));}return BPromise[_0xb840('0x70')](_0x2d466b);}return[];})[_0xb840('0x28')](function(_0x1dbcb0){return{'rows':_0x1dbcb0,'count':_0x1dbcb0[_0xb840('0x6a')]};})[_0xb840('0x28')](respondWithResult(_0x3c470a,null))[_0xb840('0x46')](handleError(_0x3c470a,null));}; \ No newline at end of file +var _0xf2a3=['../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','params','options','find','create','body','describe','get','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','fullname','role','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueues','user','UserProfileSection','Agents','UserProfileResource','isEmpty','resourceId','push','messages','FromId','ToId','read','all','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x2472b7,_0x234e44){var _0x478dbc=function(_0x2b1d4f){while(--_0x2b1d4f){_0x2472b7['push'](_0x2472b7['shift']());}};_0x478dbc(++_0x234e44);}(_0xf2a3,0x13c));var _0x3f2a=function(_0x33c65a,_0x2fa474){_0x33c65a=_0x33c65a-0x0;var _0x55b76e=_0xf2a3[_0x33c65a];return _0x55b76e;};'use strict';var emlformat=require(_0x3f2a('0x0'));var rimraf=require(_0x3f2a('0x1'));var zipdir=require(_0x3f2a('0x2'));var jsonpatch=require(_0x3f2a('0x3'));var rp=require('request-promise');var moment=require(_0x3f2a('0x4'));var BPromise=require(_0x3f2a('0x5'));var Mustache=require(_0x3f2a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x3f2a('0x7'));var csv=require(_0x3f2a('0x8'));var ejs=require(_0x3f2a('0x9'));var fs=require('fs');var fs_extra=require(_0x3f2a('0xa'));var _=require(_0x3f2a('0xb'));var squel=require(_0x3f2a('0xc'));var crypto=require(_0x3f2a('0xd'));var jsforce=require(_0x3f2a('0xe'));var deskjs=require(_0x3f2a('0xf'));var toCsv=require(_0x3f2a('0x8'));var querystring=require(_0x3f2a('0x10'));var Papa=require(_0x3f2a('0x11'));var Redis=require(_0x3f2a('0x12'));var authService=require(_0x3f2a('0x13'));var qs=require(_0x3f2a('0x14'));var as=require(_0x3f2a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3f2a('0x16'));var utils=require('../../config/utils');var config=require(_0x3f2a('0x17'));var licenseUtil=require(_0x3f2a('0x18'));var db=require('../../mysqldb')['db'];config[_0x3f2a('0x19')]=_['defaults'](config['redis'],{'host':_0x3f2a('0x1a'),'port':0x18eb});var socket=require(_0x3f2a('0x1b'))(new Redis(config['redis']));require(_0x3f2a('0x1c'))[_0x3f2a('0x1d')](socket);function respondWithStatusCode(_0xa7ea76,_0xea14d6){_0xea14d6=_0xea14d6||0xcc;return function(_0x24e13b){if(_0x24e13b){return _0xa7ea76[_0x3f2a('0x1e')](_0xea14d6);}return _0xa7ea76[_0x3f2a('0x1f')](_0xea14d6)['end']();};}function respondWithResult(_0x5cd745,_0x241c94){_0x241c94=_0x241c94||0xc8;return function(_0x3fe36f){if(_0x3fe36f){return _0x5cd745[_0x3f2a('0x1f')](_0x241c94)[_0x3f2a('0x20')](_0x3fe36f);}};}function respondWithFilteredResult(_0x1f0fd6,_0x59a20){return function(_0x227ac2){if(_0x227ac2){var _0x1728fd=typeof _0x59a20[_0x3f2a('0x21')]===_0x3f2a('0x22')&&typeof _0x59a20[_0x3f2a('0x23')]===_0x3f2a('0x22');var _0x192b9e=_0x227ac2[_0x3f2a('0x24')];var _0xa50745=_0x1728fd?0x0:_0x59a20[_0x3f2a('0x21')];var _0x5eb7b7=_0x1728fd?_0x227ac2[_0x3f2a('0x24')]:_0x59a20[_0x3f2a('0x21')]+_0x59a20[_0x3f2a('0x23')];var _0x3a6b6c;if(_0x5eb7b7>=_0x192b9e){_0x5eb7b7=_0x192b9e;_0x3a6b6c=0xc8;}else{_0x3a6b6c=0xce;}_0x1f0fd6[_0x3f2a('0x1f')](_0x3a6b6c);return _0x1f0fd6[_0x3f2a('0x25')](_0x3f2a('0x26'),_0xa50745+'-'+_0x5eb7b7+'/'+_0x192b9e)[_0x3f2a('0x20')](_0x227ac2);}return null;};}function patchUpdates(_0x2ffabd){return function(_0x120d5d){try{jsonpatch[_0x3f2a('0x27')](_0x120d5d,_0x2ffabd,!![]);}catch(_0x218e80){return BPromise[_0x3f2a('0x28')](_0x218e80);}return _0x120d5d[_0x3f2a('0x29')]();};}function saveUpdates(_0x55fa25,_0x44ec1f){return function(_0x5d8a12){if(_0x5d8a12){return _0x5d8a12[_0x3f2a('0x2a')](_0x55fa25)['then'](function(_0x37608b){return _0x37608b;});}return null;};}function removeEntity(_0x569799,_0x7135b4){return function(_0x3b564d){if(_0x3b564d){return _0x3b564d[_0x3f2a('0x2b')]()[_0x3f2a('0x2c')](function(){_0x569799[_0x3f2a('0x1f')](0xcc)[_0x3f2a('0x2d')]();});}};}function handleEntityNotFound(_0x569444,_0x599d22){return function(_0x490ff9){if(!_0x490ff9){_0x569444['sendStatus'](0x194);}return _0x490ff9;};}function handleError(_0x2912ab,_0x5e1af1){_0x5e1af1=_0x5e1af1||0x1f4;return function(_0x46e06d){logger[_0x3f2a('0x2e')](_0x46e06d[_0x3f2a('0x2f')]);if(_0x46e06d[_0x3f2a('0x30')]){delete _0x46e06d[_0x3f2a('0x30')];}_0x2912ab[_0x3f2a('0x1f')](_0x5e1af1)[_0x3f2a('0x31')](_0x46e06d);};}exports[_0x3f2a('0x32')]=function(_0x274cde,_0x508a6b){var _0x318451={},_0x3570d4={},_0x35595f={'count':0x0,'rows':[]};var _0x946f3d=_[_0x3f2a('0x33')](db[_0x3f2a('0x34')][_0x3f2a('0x35')],function(_0x22980d){return{'name':_0x22980d[_0x3f2a('0x36')],'type':_0x22980d['type'][_0x3f2a('0x37')]};});_0x3570d4[_0x3f2a('0x38')]=_[_0x3f2a('0x33')](_0x946f3d,_0x3f2a('0x30'));_0x3570d4['query']=_[_0x3f2a('0x39')](_0x274cde['query']);_0x3570d4[_0x3f2a('0x3a')]=_[_0x3f2a('0x3b')](_0x3570d4['model'],_0x3570d4['query']);_0x318451[_0x3f2a('0x3c')]=_[_0x3f2a('0x3b')](_0x3570d4[_0x3f2a('0x38')],qs[_0x3f2a('0x3d')](_0x274cde[_0x3f2a('0x3e')][_0x3f2a('0x3d')]));_0x318451[_0x3f2a('0x3c')]=_0x318451[_0x3f2a('0x3c')][_0x3f2a('0x3f')]?_0x318451[_0x3f2a('0x3c')]:_0x3570d4[_0x3f2a('0x38')];if(!_0x274cde[_0x3f2a('0x3e')][_0x3f2a('0x40')](_0x3f2a('0x41'))){_0x318451[_0x3f2a('0x23')]=qs['limit'](_0x274cde[_0x3f2a('0x3e')][_0x3f2a('0x23')]);_0x318451['offset']=qs[_0x3f2a('0x21')](_0x274cde[_0x3f2a('0x3e')][_0x3f2a('0x21')]);}_0x318451['order']=qs[_0x3f2a('0x42')](_0x274cde[_0x3f2a('0x3e')][_0x3f2a('0x42')]);_0x318451[_0x3f2a('0x43')]=qs['filters'](_['pick'](_0x274cde[_0x3f2a('0x3e')],_0x3570d4['filters']),_0x946f3d);if(_0x274cde[_0x3f2a('0x3e')][_0x3f2a('0x44')]){_0x318451[_0x3f2a('0x43')]=_[_0x3f2a('0x45')](_0x318451[_0x3f2a('0x43')],{'$or':_[_0x3f2a('0x33')](_0x946f3d,function(_0x22e30e){if(_0x22e30e[_0x3f2a('0x46')]!==_0x3f2a('0x47')){var _0x5916f7={};_0x5916f7[_0x22e30e[_0x3f2a('0x30')]]={'$like':'%'+_0x274cde['query'][_0x3f2a('0x44')]+'%'};return _0x5916f7;}})});}_0x318451=_[_0x3f2a('0x45')]({},_0x318451,_0x274cde['options']);var _0x4fcaee={'where':_0x318451[_0x3f2a('0x43')]};return db['ChatInternalMessage'][_0x3f2a('0x24')](_0x4fcaee)[_0x3f2a('0x2c')](function(_0x4a3b93){_0x35595f[_0x3f2a('0x24')]=_0x4a3b93;if(_0x274cde[_0x3f2a('0x3e')][_0x3f2a('0x48')]){_0x318451['include']=[{'all':!![]}];}return db['ChatInternalMessage'][_0x3f2a('0x49')](_0x318451);})['then'](function(_0x1cc79b){_0x35595f[_0x3f2a('0x4a')]=_0x1cc79b;return _0x35595f;})[_0x3f2a('0x2c')](respondWithFilteredResult(_0x508a6b,_0x318451))[_0x3f2a('0x4b')](handleError(_0x508a6b,null));};exports[_0x3f2a('0x4c')]=function(_0x10b566,_0x373b15){var _0x5a1820={'raw':!![],'where':{'id':_0x10b566[_0x3f2a('0x4d')]['id']}},_0x1c6387={};_0x1c6387[_0x3f2a('0x38')]=_[_0x3f2a('0x39')](db[_0x3f2a('0x34')][_0x3f2a('0x35')]);_0x1c6387['query']=_[_0x3f2a('0x39')](_0x10b566[_0x3f2a('0x3e')]);_0x1c6387[_0x3f2a('0x3a')]=_['intersection'](_0x1c6387[_0x3f2a('0x38')],_0x1c6387[_0x3f2a('0x3e')]);_0x5a1820['attributes']=_['intersection'](_0x1c6387[_0x3f2a('0x38')],qs[_0x3f2a('0x3d')](_0x10b566[_0x3f2a('0x3e')][_0x3f2a('0x3d')]));_0x5a1820[_0x3f2a('0x3c')]=_0x5a1820[_0x3f2a('0x3c')]['length']?_0x5a1820[_0x3f2a('0x3c')]:_0x1c6387[_0x3f2a('0x38')];if(_0x10b566[_0x3f2a('0x3e')]['includeAll']){_0x5a1820['include']=[{'all':!![]}];}_0x5a1820=_['merge']({},_0x5a1820,_0x10b566[_0x3f2a('0x4e')]);return db[_0x3f2a('0x34')][_0x3f2a('0x4f')](_0x5a1820)[_0x3f2a('0x2c')](handleEntityNotFound(_0x373b15,null))[_0x3f2a('0x2c')](respondWithResult(_0x373b15,null))['catch'](handleError(_0x373b15,null));};exports[_0x3f2a('0x50')]=function(_0x1b0732,_0x59e670){return db[_0x3f2a('0x34')][_0x3f2a('0x50')](_0x1b0732[_0x3f2a('0x51')],{})[_0x3f2a('0x2c')](respondWithResult(_0x59e670,0xc9))[_0x3f2a('0x4b')](handleError(_0x59e670,null));};exports[_0x3f2a('0x2a')]=function(_0x383477,_0x1caeb1){if(_0x383477['body']['id']){delete _0x383477[_0x3f2a('0x51')]['id'];}return db[_0x3f2a('0x34')]['find']({'where':{'id':_0x383477[_0x3f2a('0x4d')]['id']}})[_0x3f2a('0x2c')](handleEntityNotFound(_0x1caeb1,null))[_0x3f2a('0x2c')](saveUpdates(_0x383477[_0x3f2a('0x51')],null))[_0x3f2a('0x2c')](respondWithResult(_0x1caeb1,null))[_0x3f2a('0x4b')](handleError(_0x1caeb1,null));};exports[_0x3f2a('0x2b')]=function(_0x307c29,_0x585f43){return db[_0x3f2a('0x34')][_0x3f2a('0x4f')]({'where':{'id':_0x307c29['params']['id']}})[_0x3f2a('0x2c')](handleEntityNotFound(_0x585f43,null))[_0x3f2a('0x2c')](removeEntity(_0x585f43,null))[_0x3f2a('0x4b')](handleError(_0x585f43,null));};exports[_0x3f2a('0x52')]=function(_0x44c6d8,_0x3805cc){return db['ChatInternalMessage'][_0x3f2a('0x52')]()[_0x3f2a('0x2c')](respondWithResult(_0x3805cc,null))[_0x3f2a('0x4b')](handleError(_0x3805cc,null));};function wrapUser(_0x40ea54){return function(_0x1d0def){var _0x4f1109=_0x40ea54[_0x3f2a('0x53')]({'plain':!![]});_0x4f1109['messages']=[];if(_0x1d0def){_0x4f1109[_0x3f2a('0x54')]=_0x1d0def[_0x3f2a('0x55')];_0x4f1109[_0x3f2a('0x56')]=_0x1d0def;}else{_0x4f1109[_0x3f2a('0x54')]=moment(0x0)['format'](_0x3f2a('0x57'));_0x4f1109[_0x3f2a('0x56')]={};}return _0x4f1109;};}exports[_0x3f2a('0x58')]=function(_0x245327,_0xe710dd,_0x10b761){var _0x55fcb7=[];return db[_0x3f2a('0x59')][_0x3f2a('0x49')]({'where':{'role':[_0x3f2a('0x5a'),_0x3f2a('0x5b'),'user']},'attributes':['id',_0x3f2a('0x5c'),_0x3f2a('0x30'),_0x3f2a('0x5d'),'userpic',_0x3f2a('0x5e'),_0x3f2a('0x5f'),_0x3f2a('0x60'),_0x3f2a('0x61'),_0x3f2a('0x62')],'order':qs[_0x3f2a('0x42')]('-online'),'include':[{'model':db['VoiceQueue'],'as':_0x3f2a('0x63'),'attributes':['id',_0x3f2a('0x30'),_0x3f2a('0x46')],'through':{'attributes':[]}}]})[_0x3f2a('0x2c')](function(_0x27bc95){if(_0x27bc95){var _0x358917=_0x245327['user'][_0x3f2a('0x53')]({'plain':!![]});if(!_0x358917)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x358917['role']===_0x3f2a('0x64')){return db[_0x3f2a('0x65')]['find']({'where':{'name':_0x3f2a('0x66'),'userProfileId':_0x358917['userProfileId']},'raw':!![]})[_0x3f2a('0x2c')](function(_0x43eb8d){if(_0x43eb8d){if(_0x43eb8d['autoAssociation']===0x0){return db[_0x3f2a('0x67')][_0x3f2a('0x49')]({'where':{'sectionId':_0x43eb8d['id']},'raw':!![]})['then'](function(_0x4ee55e){var _0x169f45=[];if(_[_0x3f2a('0x68')](_0x4ee55e)){_0x169f45=_[_0x3f2a('0x44')](_0x27bc95,function(_0x43eb3f){if(_0x43eb3f['role']!==_0x3f2a('0x5a')){return _0x43eb3f;}});return _0x169f45;}else{for(var _0x4a66eb=0x0;_0x4a66eb<_0x27bc95[_0x3f2a('0x3f')];_0x4a66eb++){var _0x23ac9e=_0x27bc95[_0x4a66eb];if(_0x23ac9e[_0x3f2a('0x5d')]==='agent'){var _0x2fb32e=_[_0x3f2a('0x4f')](_0x4ee55e,function(_0x6d318e){return _0x6d318e[_0x3f2a('0x69')]===_0x23ac9e['id'];});if(_0x2fb32e)_0x169f45[_0x3f2a('0x6a')](_0x23ac9e);}else{_0x169f45[_0x3f2a('0x6a')](_0x23ac9e);}}return _0x169f45;}});}else{return _0x27bc95;}}else{var _0x182236=_['filter'](_0x27bc95,function(_0x3d3a75){if(_0x3d3a75[_0x3f2a('0x5d')]!==_0x3f2a('0x5a')){return _0x3d3a75;}});return _0x182236;}});}else{return _0x27bc95;}}})['then'](function(_0x27a317){var _0xb9662=[];if(_0x27a317){_0x55fcb7=_0x27a317;for(var _0x3a3eb9=0x0;_0x3a3eb9<_0x27a317[_0x3f2a('0x3f')];_0x3a3eb9+=0x1){_0x55fcb7[_0x3a3eb9][_0x3f2a('0x6b')]=[];_0xb9662['push'](db[_0x3f2a('0x34')][_0x3f2a('0x4f')]({'where':{'FromId':[_0x245327[_0x3f2a('0x64')]['id'],_0x27a317[_0x3a3eb9]['id']],'ToId':[_0x245327[_0x3f2a('0x64')]['id'],_0x27a317[_0x3a3eb9]['id']],'ChatGroupId':null},'attributes':['id',_0x3f2a('0x55'),_0x3f2a('0x6c'),_0x3f2a('0x6d'),_0x3f2a('0x6e'),_0x3f2a('0x51')],'order':qs[_0x3f2a('0x42')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x27a317[_0x3a3eb9])));}return BPromise[_0x3f2a('0x6f')](_0xb9662);}return[];})[_0x3f2a('0x2c')](function(_0x1a9585){return{'rows':_0x1a9585,'count':_0x1a9585[_0x3f2a('0x3f')]};})[_0x3f2a('0x2c')](respondWithResult(_0xe710dd,null))[_0x3f2a('0x4b')](handleError(_0xe710dd,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 76089dc..0968236 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 _0xd497=['ChatInternalMessage','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xd497,0x19b));var _0x7d49=function(_0x194536,_0x55dd43){_0x194536=_0x194536-0x0;var _0x61b223=_0xd497[_0x194536];return _0x61b223;};'use strict';var EventEmitter=require(_0x7d49('0x0'));var ChatInternalMessage=require(_0x7d49('0x1'))['db'][_0x7d49('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7d49('0x3'),'afterDestroy':_0x7d49('0x4')};function emitEvent(_0x544a90){return function(_0xaa9d1c,_0x1ed2fa,_0x3b7ed3){ChatInternalMessageEvents[_0x7d49('0x5')](_0x544a90+':'+_0xaa9d1c['id'],_0xaa9d1c);ChatInternalMessageEvents[_0x7d49('0x5')](_0x544a90,_0xaa9d1c);_0x3b7ed3(null);};}for(var e in events){if(events[_0x7d49('0x6')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0xc93e=['remove','emit','hasOwnProperty','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x4c3780,_0x27ce2b){var _0x3050b9=function(_0xf84436){while(--_0xf84436){_0x4c3780['push'](_0x4c3780['shift']());}};_0x3050b9(++_0x27ce2b);}(_0xc93e,0x143));var _0xec93=function(_0x3b19ea,_0x518b6b){_0x3b19ea=_0x3b19ea-0x0;var _0x40ece9=_0xc93e[_0x3b19ea];return _0x40ece9;};'use strict';var EventEmitter=require(_0xec93('0x0'));var ChatInternalMessage=require(_0xec93('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xec93('0x2')](0x0);var events={'afterCreate':_0xec93('0x3'),'afterUpdate':_0xec93('0x4'),'afterDestroy':_0xec93('0x5')};function emitEvent(_0x2ccbe0){return function(_0x52d4c1,_0x140ada,_0x5ed1dd){ChatInternalMessageEvents[_0xec93('0x6')](_0x2ccbe0+':'+_0x52d4c1['id'],_0x52d4c1);ChatInternalMessageEvents[_0xec93('0x6')](_0x2ccbe0,_0x52d4c1);_0x5ed1dd(null);};}for(var e in events){if(events[_0xec93('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index e691945..ee58451 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 _0xd07e=['request-promise','path','rimraf','./chatInternalMessage.attributes','define','utf8mb4','util','../../config/logger','moment','bluebird'];(function(_0x5b127a,_0x34d1af){var _0x6fcc76=function(_0x2f7e4e){while(--_0x2f7e4e){_0x5b127a['push'](_0x5b127a['shift']());}};_0x6fcc76(++_0x34d1af);}(_0xd07e,0x1f0));var _0xed07=function(_0x567f69,_0x128fbe){_0x567f69=_0x567f69-0x0;var _0x32f2f8=_0xd07e[_0x567f69];return _0x32f2f8;};'use strict';var _=require('lodash');var util=require(_0xed07('0x0'));var logger=require(_0xed07('0x1'))('api');var moment=require(_0xed07('0x2'));var BPromise=require(_0xed07('0x3'));var rp=require(_0xed07('0x4'));var fs=require('fs');var path=require(_0xed07('0x5'));var rimraf=require(_0xed07('0x6'));var config=require('../../config/environment');var attributes=require(_0xed07('0x7'));module['exports']=function(_0x2577b6,_0x1601df){return _0x2577b6[_0xed07('0x8')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xed07('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xcf21=['../../config/environment','exports','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf21,0x131));var _0x1cf2=function(_0x782c74,_0x2d94ca){_0x782c74=_0x782c74-0x0;var _0x229f8e=_0xcf21[_0x782c74];return _0x229f8e;};'use strict';var _=require(_0x1cf2('0x0'));var util=require(_0x1cf2('0x1'));var logger=require(_0x1cf2('0x2'))(_0x1cf2('0x3'));var moment=require(_0x1cf2('0x4'));var BPromise=require(_0x1cf2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1cf2('0x6'));var config=require(_0x1cf2('0x7'));var attributes=require('./chatInternalMessage.attributes');module[_0x1cf2('0x8')]=function(_0x4a0493,_0x197d22){return _0x4a0493['define']('ChatInternalMessage',attributes,{'tableName':_0x1cf2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1cf2('0xa'),'collate':_0x1cf2('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 56272ee..13ab46a 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 _0x1b21=['../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb'];(function(_0x128561,_0x3f5e94){var _0x58efaa=function(_0x135b10){while(--_0x135b10){_0x128561['push'](_0x128561['shift']());}};_0x58efaa(++_0x3f5e94);}(_0x1b21,0x1b6));var _0x11b2=function(_0x3a7835,_0x16de15){_0x3a7835=_0x3a7835-0x0;var _0x1b98d3=_0x1b21[_0x3a7835];return _0x1b98d3;};'use strict';var _=require(_0x11b2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x11b2('0x1'));var fs=require('fs');var Redis=require(_0x11b2('0x2'));var db=require(_0x11b2('0x3'))['db'];var utils=require(_0x11b2('0x4'));var logger=require(_0x11b2('0x5'))('rpc');var config=require(_0x11b2('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x11b2('0x7')]({'port':0x232a});config[_0x11b2('0x8')]=_[_0x11b2('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x11b2('0xa'))(new Redis(config[_0x11b2('0x8')]));require(_0x11b2('0xb'))[_0x11b2('0xc')](socket);function respondWithRpcPromise(_0x58a120,_0xeb1900,_0x2702a7){return new BPromise(function(_0x1073df,_0x8ef9a2){return client[_0x11b2('0xd')](_0x58a120,_0x2702a7)[_0x11b2('0xe')](function(_0x4738cf){logger[_0x11b2('0xf')](_0x11b2('0x10'),_0xeb1900,'request\x20sent');logger[_0x11b2('0x11')](_0x11b2('0x12'),_0xeb1900,_0x11b2('0x13'),JSON[_0x11b2('0x14')](_0x4738cf));if(_0x4738cf[_0x11b2('0x15')]){if(_0x4738cf[_0x11b2('0x15')][_0x11b2('0x16')]===0x1f4){logger[_0x11b2('0x15')](_0x11b2('0x10'),_0xeb1900,_0x4738cf[_0x11b2('0x15')][_0x11b2('0x17')]);return _0x8ef9a2(_0x4738cf[_0x11b2('0x15')][_0x11b2('0x17')]);}logger['error'](_0x11b2('0x10'),_0xeb1900,_0x4738cf['error']['message']);return _0x1073df(_0x4738cf[_0x11b2('0x15')][_0x11b2('0x17')]);}else{logger[_0x11b2('0xf')](_0x11b2('0x10'),_0xeb1900,_0x11b2('0x13'));_0x1073df(_0x4738cf[_0x11b2('0x18')]['message']);}})[_0x11b2('0x19')](function(_0x3f17b1){logger[_0x11b2('0x15')](_0x11b2('0x10'),_0xeb1900,_0x3f17b1);_0x8ef9a2(_0x3f17b1);});});} \ No newline at end of file +var _0x5ad0=['code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./chatInternalMessage.socket','register','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2f4d1b,_0x1f65be){var _0x5da6c2=function(_0x5cd4a2){while(--_0x5cd4a2){_0x2f4d1b['push'](_0x2f4d1b['shift']());}};_0x5da6c2(++_0x1f65be);}(_0x5ad0,0x137));var _0x05ad=function(_0x590766,_0x26a057){_0x590766=_0x590766-0x0;var _0x4e2f10=_0x5ad0[_0x590766];return _0x4e2f10;};'use strict';var _=require(_0x05ad('0x0'));var util=require(_0x05ad('0x1'));var moment=require(_0x05ad('0x2'));var BPromise=require(_0x05ad('0x3'));var rs=require(_0x05ad('0x4'));var fs=require('fs');var Redis=require(_0x05ad('0x5'));var db=require(_0x05ad('0x6'))['db'];var utils=require(_0x05ad('0x7'));var logger=require(_0x05ad('0x8'))(_0x05ad('0x9'));var config=require(_0x05ad('0xa'));var jayson=require(_0x05ad('0xb'));var client=jayson[_0x05ad('0xc')][_0x05ad('0xd')]({'port':0x232a});config[_0x05ad('0xe')]=_['defaults'](config[_0x05ad('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x05ad('0xe')]));require(_0x05ad('0xf'))[_0x05ad('0x10')](socket);function respondWithRpcPromise(_0x2e28dd,_0xb38819,_0x50ed0b){return new BPromise(function(_0x33a953,_0x576763){return client['request'](_0x2e28dd,_0x50ed0b)[_0x05ad('0x11')](function(_0x21dfd6){logger[_0x05ad('0x12')](_0x05ad('0x13'),_0xb38819,_0x05ad('0x14'));logger[_0x05ad('0x15')](_0x05ad('0x16'),_0xb38819,_0x05ad('0x14'),JSON[_0x05ad('0x17')](_0x21dfd6));if(_0x21dfd6[_0x05ad('0x18')]){if(_0x21dfd6[_0x05ad('0x18')][_0x05ad('0x19')]===0x1f4){logger[_0x05ad('0x18')](_0x05ad('0x13'),_0xb38819,_0x21dfd6['error'][_0x05ad('0x1a')]);return _0x576763(_0x21dfd6[_0x05ad('0x18')]['message']);}logger[_0x05ad('0x18')](_0x05ad('0x13'),_0xb38819,_0x21dfd6['error'][_0x05ad('0x1a')]);return _0x33a953(_0x21dfd6[_0x05ad('0x18')]['message']);}else{logger[_0x05ad('0x12')](_0x05ad('0x13'),_0xb38819,_0x05ad('0x14'));_0x33a953(_0x21dfd6[_0x05ad('0x1b')]['message']);}})['catch'](function(_0x11c4ad){logger['error'](_0x05ad('0x13'),_0xb38819,_0x11c4ad);_0x576763(_0x11c4ad);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 4cbba3a..3821d5d 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 _0x4fcb=['update','emit','removeListener','register','length','chatInternalMessage:','save','remove'];(function(_0x2c3bb9,_0x4d333b){var _0x1e944b=function(_0x181e7f){while(--_0x181e7f){_0x2c3bb9['push'](_0x2c3bb9['shift']());}};_0x1e944b(++_0x4d333b);}(_0x4fcb,0xce));var _0xb4fc=function(_0x2c18af,_0x3c9861){_0x2c18af=_0x2c18af-0x0;var _0x5a64ca=_0x4fcb[_0x2c18af];return _0x5a64ca;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xb4fc('0x0'),_0xb4fc('0x1'),_0xb4fc('0x2')];function createListener(_0x3b7ce5,_0x36489d){return function(_0x1466f3){_0x36489d[_0xb4fc('0x3')](_0x3b7ce5,_0x1466f3);};}function removeListener(_0x27e090,_0x5b9846){return function(){ChatInternalMessageEvents[_0xb4fc('0x4')](_0x27e090,_0x5b9846);};}exports[_0xb4fc('0x5')]=function(_0x1cc2c1){for(var _0x22651d=0x0,_0x414898=events[_0xb4fc('0x6')];_0x22651d<_0x414898;_0x22651d++){var _0x233ae4=events[_0x22651d];var _0x48f336=createListener(_0xb4fc('0x7')+_0x233ae4,_0x1cc2c1);ChatInternalMessageEvents['on'](_0x233ae4,_0x48f336);}}; \ No newline at end of file +var _0xd9f2=['register','chatInternalMessage:','./chatInternalMessage.events','save','remove','update'];(function(_0x2e6444,_0xdf751e){var _0x297793=function(_0x2bf64d){while(--_0x2bf64d){_0x2e6444['push'](_0x2e6444['shift']());}};_0x297793(++_0xdf751e);}(_0xd9f2,0xd4));var _0x2d9f=function(_0x226373,_0x30bc8a){_0x226373=_0x226373-0x0;var _0x10dea7=_0xd9f2[_0x226373];return _0x10dea7;};'use strict';var ChatInternalMessageEvents=require(_0x2d9f('0x0'));var events=[_0x2d9f('0x1'),_0x2d9f('0x2'),_0x2d9f('0x3')];function createListener(_0x240c03,_0x34029f){return function(_0x42ad46){_0x34029f['emit'](_0x240c03,_0x42ad46);};}function removeListener(_0x3d9380,_0x5b1445){return function(){ChatInternalMessageEvents['removeListener'](_0x3d9380,_0x5b1445);};}exports[_0x2d9f('0x4')]=function(_0x1985d6){for(var _0x4b61d8=0x0,_0x4709e7=events['length'];_0x4b61d8<_0x4709e7;_0x4b61d8++){var _0x1a374d=events[_0x4b61d8];var _0x1c688b=createListener(_0x2d9f('0x5')+_0x1a374d,_0x1985d6);ChatInternalMessageEvents['on'](_0x1a374d,_0x1c688b);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index dc67063..1a894fe 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 _0x6ddf=['/describe','isAuthenticated','/users','getUsers','show','post','create','put','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','index'];(function(_0x2c34ff,_0x1e8bee){var _0x476508=function(_0x3e50db){while(--_0x3e50db){_0x2c34ff['push'](_0x2c34ff['shift']());}};_0x476508(++_0x1e8bee);}(_0x6ddf,0xbc));var _0xf6dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ddf[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xf6dd('0x0'));var path=require(_0xf6dd('0x1'));var timeout=require(_0xf6dd('0x2'));var express=require(_0xf6dd('0x3'));var router=express[_0xf6dd('0x4')]();var fs_extra=require(_0xf6dd('0x5'));var auth=require(_0xf6dd('0x6'));var interaction=require(_0xf6dd('0x7'));var config=require(_0xf6dd('0x8'));var controller=require(_0xf6dd('0x9'));router[_0xf6dd('0xa')]('/',auth['isAuthenticated'](),controller[_0xf6dd('0xb')]);router[_0xf6dd('0xa')](_0xf6dd('0xc'),auth[_0xf6dd('0xd')](),controller['describe']);router[_0xf6dd('0xa')](_0xf6dd('0xe'),auth[_0xf6dd('0xd')](),controller[_0xf6dd('0xf')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf6dd('0x10')]);router[_0xf6dd('0x11')]('/',auth[_0xf6dd('0xd')](),controller[_0xf6dd('0x12')]);router[_0xf6dd('0x13')]('/:id',controller[_0xf6dd('0x14')]);router[_0xf6dd('0x15')](_0xf6dd('0x16'),auth[_0xf6dd('0xd')](),controller[_0xf6dd('0x17')]);module[_0xf6dd('0x18')]=router; \ No newline at end of file +var _0x7109=['delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated','index','/describe','/users','getUsers','get','/:id','post','put','update'];(function(_0x22c684,_0x753309){var _0x39fcbb=function(_0x38b631){while(--_0x38b631){_0x22c684['push'](_0x22c684['shift']());}};_0x39fcbb(++_0x753309);}(_0x7109,0xd4));var _0x9710=function(_0x13b7fd,_0x4eaf7f){_0x13b7fd=_0x13b7fd-0x0;var _0x32a74a=_0x7109[_0x13b7fd];return _0x32a74a;};'use strict';var multer=require(_0x9710('0x0'));var util=require(_0x9710('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9710('0x2'));var router=express[_0x9710('0x3')]();var fs_extra=require(_0x9710('0x4'));var auth=require(_0x9710('0x5'));var interaction=require(_0x9710('0x6'));var config=require(_0x9710('0x7'));var controller=require(_0x9710('0x8'));router['get']('/',auth[_0x9710('0x9')](),controller[_0x9710('0xa')]);router['get'](_0x9710('0xb'),auth[_0x9710('0x9')](),controller['describe']);router['get'](_0x9710('0xc'),auth[_0x9710('0x9')](),controller[_0x9710('0xd')]);router[_0x9710('0xe')](_0x9710('0xf'),auth[_0x9710('0x9')](),controller['show']);router[_0x9710('0x10')]('/',auth[_0x9710('0x9')](),controller['create']);router[_0x9710('0x11')](_0x9710('0xf'),controller[_0x9710('0x12')]);router[_0x9710('0x13')](_0x9710('0xf'),auth[_0x9710('0x9')](),controller['destroy']);module[_0x9710('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 257c975..978182d 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 _0x081e=['exports','medium','BOOLEAN','ENUM','out','DATE','STRING','TEXT','sequelize'];(function(_0xdbce2e,_0x1ba5ba){var _0x570025=function(_0x45cd9f){while(--_0x45cd9f){_0xdbce2e['push'](_0xdbce2e['shift']());}};_0x570025(++_0x1ba5ba);}(_0x081e,0xc5));var _0xe081=function(_0xd1315c,_0x2ce3a0){_0xd1315c=_0xd1315c-0x0;var _0x40565a=_0x081e[_0xd1315c];return _0x40565a;};'use strict';var Sequelize=require(_0xe081('0x0'));module[_0xe081('0x1')]={'body':{'type':Sequelize['TEXT'](_0xe081('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xe081('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe081('0x4')]('in',_0xe081('0x5')),'defaultValue':_0xe081('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe081('0x6')]},'providerName':{'type':Sequelize[_0xe081('0x7')]},'providerResponse':{'type':Sequelize[_0xe081('0x8')]}}; \ No newline at end of file +var _0x7894=['medium','BOOLEAN','out','STRING','sequelize','exports','TEXT'];(function(_0x9a23c4,_0x410fb0){var _0x27775a=function(_0x175e99){while(--_0x175e99){_0x9a23c4['push'](_0x9a23c4['shift']());}};_0x27775a(++_0x410fb0);}(_0x7894,0x170));var _0x4789=function(_0x1ec3dd,_0x3f108a){_0x1ec3dd=_0x1ec3dd-0x0;var _0x5529be=_0x7894[_0x1ec3dd];return _0x5529be;};'use strict';var Sequelize=require(_0x4789('0x0'));module[_0x4789('0x1')]={'body':{'type':Sequelize[_0x4789('0x2')](_0x4789('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4789('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x4789('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4789('0x5')),'defaultValue':_0x4789('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x4789('0x6')]},'providerResponse':{'type':Sequelize[_0x4789('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 8beaccc..7a6487b 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 _0xae93=['status','json','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','stack','name','send','map','ChatMessage','fieldName','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','rawAttributes','length','find','create','body','describe','chat-interactions','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','ChatInteraction','ChatInteractionId','isNil','read1stAt','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','agent','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','parse','../../config/logger','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','internal','reject','rejectmessage','formData','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','jayson/promise','http','client','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0xae93,0x173));var _0x3ae9=function(_0x19fec1,_0x1cc62f){_0x19fec1=_0x19fec1-0x0;var _0x29cd35=_0xae93[_0x19fec1];return _0x29cd35;};'use strict';var emlformat=require(_0x3ae9('0x0'));var rimraf=require(_0x3ae9('0x1'));var zipdir=require(_0x3ae9('0x2'));var jsonpatch=require(_0x3ae9('0x3'));var rp=require(_0x3ae9('0x4'));var moment=require(_0x3ae9('0x5'));var BPromise=require(_0x3ae9('0x6'));var Mustache=require(_0x3ae9('0x7'));var util=require('util');var path=require(_0x3ae9('0x8'));var sox=require(_0x3ae9('0x9'));var csv=require(_0x3ae9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3ae9('0xb'));var _=require(_0x3ae9('0xc'));var squel=require(_0x3ae9('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3ae9('0xe'));var toCsv=require(_0x3ae9('0xa'));var querystring=require('querystring');var Papa=require(_0x3ae9('0xf'));var Redis=require('ioredis');var authService=require(_0x3ae9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3ae9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3ae9('0x12'));var utils=require(_0x3ae9('0x13'));var config=require(_0x3ae9('0x14'));var licenseUtil=require(_0x3ae9('0x15'));var db=require(_0x3ae9('0x16'))['db'];config[_0x3ae9('0x17')]=_[_0x3ae9('0x18')](config[_0x3ae9('0x17')],{'host':_0x3ae9('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3ae9('0x17')]));require(_0x3ae9('0x1a'))['register'](socket);var jayson=require(_0x3ae9('0x1b'));var client=jayson['client'][_0x3ae9('0x1c')]({'port':0x232c});var client9002=jayson[_0x3ae9('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x191942,_0x3f8003,_0x312599,_0x133664){return new BPromise(function(_0x345ef7,_0x61b4e9){var _0x1620b7=_0x133664||client;return _0x1620b7[_0x3ae9('0x1e')](_0x191942,_0x312599)['then'](function(_0x49a57f){logger[_0x3ae9('0x1f')](_0x3ae9('0x20'),_0x3f8003,_0x3ae9('0x21'));logger[_0x3ae9('0x22')](_0x3ae9('0x23'),_0x3f8003,_0x3ae9('0x21'),JSON[_0x3ae9('0x24')](_0x49a57f));if(_0x49a57f[_0x3ae9('0x25')]){if(_0x49a57f['error'][_0x3ae9('0x26')]===0x1f4){logger[_0x3ae9('0x25')](_0x3ae9('0x20'),_0x3f8003,_0x49a57f[_0x3ae9('0x25')][_0x3ae9('0x27')]);return _0x61b4e9(_0x49a57f[_0x3ae9('0x25')][_0x3ae9('0x27')]);}logger['error'](_0x3ae9('0x20'),_0x3f8003,_0x49a57f['error']['message']);return _0x345ef7(_0x49a57f['error'][_0x3ae9('0x27')]);}else{logger[_0x3ae9('0x1f')]('ChatMessage,\x20%s,\x20%s',_0x3f8003,_0x3ae9('0x21'));_0x345ef7(_0x49a57f[_0x3ae9('0x28')][_0x3ae9('0x27')]);}})[_0x3ae9('0x29')](function(_0x1f4d47){logger[_0x3ae9('0x25')]('ChatMessage,\x20%s,\x20%s',_0x3f8003,_0x1f4d47);_0x61b4e9(_0x1f4d47);});});}function respondWithStatusCode(_0x4040bf,_0x531af2){_0x531af2=_0x531af2||0xcc;return function(_0x3e34c1){if(_0x3e34c1){return _0x4040bf[_0x3ae9('0x2a')](_0x531af2);}return _0x4040bf[_0x3ae9('0x2b')](_0x531af2)['end']();};}function respondWithResult(_0x405c3d,_0x13f8e2){_0x13f8e2=_0x13f8e2||0xc8;return function(_0x2ad544){if(_0x2ad544){return _0x405c3d[_0x3ae9('0x2b')](_0x13f8e2)[_0x3ae9('0x2c')](_0x2ad544);}};}function respondWithFilteredResult(_0x250fe5,_0x40f69c){return function(_0x3911f1){if(_0x3911f1){var _0x2e1f35=typeof _0x40f69c[_0x3ae9('0x2d')]===_0x3ae9('0x2e')&&typeof _0x40f69c['limit']==='undefined';var _0x1d9737=_0x3911f1[_0x3ae9('0x2f')];var _0x31d362=_0x2e1f35?0x0:_0x40f69c[_0x3ae9('0x2d')];var _0x19e83b=_0x2e1f35?_0x3911f1[_0x3ae9('0x2f')]:_0x40f69c[_0x3ae9('0x2d')]+_0x40f69c[_0x3ae9('0x30')];var _0x1a001e;if(_0x19e83b>=_0x1d9737){_0x19e83b=_0x1d9737;_0x1a001e=0xc8;}else{_0x1a001e=0xce;}_0x250fe5[_0x3ae9('0x2b')](_0x1a001e);return _0x250fe5[_0x3ae9('0x31')](_0x3ae9('0x32'),_0x31d362+'-'+_0x19e83b+'/'+_0x1d9737)[_0x3ae9('0x2c')](_0x3911f1);}return null;};}function patchUpdates(_0x24dd2d){return function(_0x110622){try{jsonpatch['apply'](_0x110622,_0x24dd2d,!![]);}catch(_0x4f7b2f){return BPromise['reject'](_0x4f7b2f);}return _0x110622[_0x3ae9('0x33')]();};}function saveUpdates(_0x352c01,_0x4ce01c){return function(_0x233f00){if(_0x233f00){return _0x233f00[_0x3ae9('0x34')](_0x352c01)[_0x3ae9('0x35')](function(_0x5a452c){return _0x5a452c;});}return null;};}function removeEntity(_0x45771a,_0x2c3578){return function(_0xa8bb39){if(_0xa8bb39){return _0xa8bb39[_0x3ae9('0x36')]()[_0x3ae9('0x35')](function(){_0x45771a[_0x3ae9('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x507bf8,_0x585cea){return function(_0x2c5d68){if(!_0x2c5d68){_0x507bf8['sendStatus'](0x194);}return _0x2c5d68;};}function handleError(_0xf5fcca,_0x51eda6){_0x51eda6=_0x51eda6||0x1f4;return function(_0x3ccd6a){logger['error'](_0x3ccd6a[_0x3ae9('0x37')]);if(_0x3ccd6a[_0x3ae9('0x38')]){delete _0x3ccd6a[_0x3ae9('0x38')];}_0xf5fcca[_0x3ae9('0x2b')](_0x51eda6)[_0x3ae9('0x39')](_0x3ccd6a);};}exports['index']=function(_0x32b2b8,_0x100b4c){var _0x33c797={},_0x4d3c76={},_0x20da01={'count':0x0,'rows':[]};var _0x4b587d=_[_0x3ae9('0x3a')](db[_0x3ae9('0x3b')]['rawAttributes'],function(_0x489f73){return{'name':_0x489f73[_0x3ae9('0x3c')],'type':_0x489f73[_0x3ae9('0x3d')][_0x3ae9('0x3e')]};});_0x4d3c76['model']=_[_0x3ae9('0x3a')](_0x4b587d,_0x3ae9('0x38'));_0x4d3c76[_0x3ae9('0x3f')]=_['keys'](_0x32b2b8[_0x3ae9('0x3f')]);_0x4d3c76[_0x3ae9('0x40')]=_[_0x3ae9('0x41')](_0x4d3c76[_0x3ae9('0x42')],_0x4d3c76[_0x3ae9('0x3f')]);_0x33c797['attributes']=_[_0x3ae9('0x41')](_0x4d3c76[_0x3ae9('0x42')],qs[_0x3ae9('0x43')](_0x32b2b8[_0x3ae9('0x3f')][_0x3ae9('0x43')]));_0x33c797['attributes']=_0x33c797['attributes']['length']?_0x33c797[_0x3ae9('0x44')]:_0x4d3c76[_0x3ae9('0x42')];if(!_0x32b2b8[_0x3ae9('0x3f')][_0x3ae9('0x45')](_0x3ae9('0x46'))){_0x33c797['limit']=qs[_0x3ae9('0x30')](_0x32b2b8[_0x3ae9('0x3f')]['limit']);_0x33c797[_0x3ae9('0x2d')]=qs[_0x3ae9('0x2d')](_0x32b2b8[_0x3ae9('0x3f')][_0x3ae9('0x2d')]);}_0x33c797[_0x3ae9('0x47')]=qs[_0x3ae9('0x48')](_0x32b2b8['query'][_0x3ae9('0x48')]);_0x33c797['where']=qs['filters'](_[_0x3ae9('0x49')](_0x32b2b8[_0x3ae9('0x3f')],_0x4d3c76[_0x3ae9('0x40')]),_0x4b587d);if(_0x32b2b8[_0x3ae9('0x3f')][_0x3ae9('0x4a')]){_0x33c797[_0x3ae9('0x4b')]=_[_0x3ae9('0x4c')](_0x33c797[_0x3ae9('0x4b')],{'$or':_[_0x3ae9('0x3a')](_0x4b587d,function(_0x1cc58c){if(_0x1cc58c[_0x3ae9('0x3d')]!==_0x3ae9('0x4d')){var _0x2a2621={};_0x2a2621[_0x1cc58c[_0x3ae9('0x38')]]={'$like':'%'+_0x32b2b8[_0x3ae9('0x3f')][_0x3ae9('0x4a')]+'%'};return _0x2a2621;}})});}_0x33c797=_[_0x3ae9('0x4c')]({},_0x33c797,_0x32b2b8[_0x3ae9('0x4e')]);var _0x1b52fa={'where':_0x33c797[_0x3ae9('0x4b')]};return db[_0x3ae9('0x3b')]['count'](_0x1b52fa)[_0x3ae9('0x35')](function(_0x31371c){_0x20da01[_0x3ae9('0x2f')]=_0x31371c;if(_0x32b2b8['query'][_0x3ae9('0x4f')]){_0x33c797['include']=[{'all':!![]}];}return db[_0x3ae9('0x3b')][_0x3ae9('0x50')](_0x33c797);})[_0x3ae9('0x35')](function(_0x589843){_0x20da01[_0x3ae9('0x51')]=_0x589843;return _0x20da01;})[_0x3ae9('0x35')](respondWithFilteredResult(_0x100b4c,_0x33c797))[_0x3ae9('0x29')](handleError(_0x100b4c,null));};exports[_0x3ae9('0x52')]=function(_0x354fa8,_0x539bb1){var _0x5ca3fa={'raw':!![],'where':{'id':_0x354fa8[_0x3ae9('0x53')]['id']}},_0x215145={};_0x215145[_0x3ae9('0x42')]=_[_0x3ae9('0x54')](db[_0x3ae9('0x3b')][_0x3ae9('0x55')]);_0x215145['query']=_[_0x3ae9('0x54')](_0x354fa8[_0x3ae9('0x3f')]);_0x215145[_0x3ae9('0x40')]=_[_0x3ae9('0x41')](_0x215145[_0x3ae9('0x42')],_0x215145[_0x3ae9('0x3f')]);_0x5ca3fa[_0x3ae9('0x44')]=_[_0x3ae9('0x41')](_0x215145['model'],qs['fields'](_0x354fa8[_0x3ae9('0x3f')][_0x3ae9('0x43')]));_0x5ca3fa[_0x3ae9('0x44')]=_0x5ca3fa[_0x3ae9('0x44')][_0x3ae9('0x56')]?_0x5ca3fa[_0x3ae9('0x44')]:_0x215145['model'];if(_0x354fa8[_0x3ae9('0x3f')]['includeAll']){_0x5ca3fa['include']=[{'all':!![]}];}_0x5ca3fa=_[_0x3ae9('0x4c')]({},_0x5ca3fa,_0x354fa8[_0x3ae9('0x4e')]);return db[_0x3ae9('0x3b')][_0x3ae9('0x57')](_0x5ca3fa)[_0x3ae9('0x35')](handleEntityNotFound(_0x539bb1,null))['then'](respondWithResult(_0x539bb1,null))[_0x3ae9('0x29')](handleError(_0x539bb1,null));};exports[_0x3ae9('0x58')]=function(_0x453ef2,_0x465613){return db[_0x3ae9('0x3b')][_0x3ae9('0x58')](_0x453ef2['body'],{})[_0x3ae9('0x35')](respondWithResult(_0x465613,0xc9))['catch'](handleError(_0x465613,null));};exports[_0x3ae9('0x34')]=function(_0x4d7861,_0x1260e5){if(_0x4d7861['body']['id']){delete _0x4d7861['body']['id'];}return db[_0x3ae9('0x3b')][_0x3ae9('0x57')]({'where':{'id':_0x4d7861[_0x3ae9('0x53')]['id']}})[_0x3ae9('0x35')](handleEntityNotFound(_0x1260e5,null))[_0x3ae9('0x35')](saveUpdates(_0x4d7861[_0x3ae9('0x59')],null))[_0x3ae9('0x35')](respondWithResult(_0x1260e5,null))['catch'](handleError(_0x1260e5,null));};exports[_0x3ae9('0x36')]=function(_0x23a4fe,_0x5f32f8){return db[_0x3ae9('0x3b')][_0x3ae9('0x57')]({'where':{'id':_0x23a4fe['params']['id']}})[_0x3ae9('0x35')](handleEntityNotFound(_0x5f32f8,null))[_0x3ae9('0x35')](removeEntity(_0x5f32f8,null))[_0x3ae9('0x29')](handleError(_0x5f32f8,null));};exports[_0x3ae9('0x5a')]=function(_0x649b06,_0x51e5b6){return db[_0x3ae9('0x3b')][_0x3ae9('0x5a')]()[_0x3ae9('0x35')](respondWithResult(_0x51e5b6,null))['catch'](handleError(_0x51e5b6,null));};var interaction_log=require('../../config/logger')(_0x3ae9('0x5b'));exports['accept']=function(_0xb1beb0,_0x40f233,_0x5b6ee6){var _0x3531a9={'agent':{},'channel':_0x3ae9('0x5c')};if(_0xb1beb0['body']['id']){delete _0xb1beb0[_0x3ae9('0x59')]['id'];}_0xb1beb0[_0x3ae9('0x59')][_0x3ae9('0x5d')]=!![];_0xb1beb0[_0x3ae9('0x59')][_0x3ae9('0x5e')]=moment()[_0x3ae9('0x5f')](_0x3ae9('0x60'));_0xb1beb0[_0x3ae9('0x59')]['UserId']=_0xb1beb0[_0x3ae9('0x59')][_0x3ae9('0x61')]||_0xb1beb0['user']['id'];_0x3531a9['agent']['id']=_0xb1beb0[_0x3ae9('0x59')]['UserId'];return db[_0x3ae9('0x3b')][_0x3ae9('0x57')]({'where':{'id':_0xb1beb0['params']['id'],'UserId':null}})[_0x3ae9('0x35')](handleEntityNotFound(_0x40f233,null))[_0x3ae9('0x35')](saveUpdates(_0xb1beb0[_0x3ae9('0x59')],null))[_0x3ae9('0x35')](function(_0x59bb48){if(_0x59bb48){_0x3531a9[_0x3ae9('0x27')]=_0x59bb48['get']({'plain':!![]});return db[_0x3ae9('0x62')]['find']({'where':{'id':_0x59bb48[_0x3ae9('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x40f233,null))[_0x3ae9('0x35')](function(_0x2ea977){if(_0x2ea977){return _0x2ea977['update']({'UserId':_0xb1beb0['body'][_0x3ae9('0x61')],'read1stAt':_[_0x3ae9('0x64')](_0x2ea977[_0x3ae9('0x65')])?moment()[_0x3ae9('0x5f')](_0x3ae9('0x60')):undefined});}return null;})[_0x3ae9('0x35')](function(_0x325399){if(_0x325399){_0x3531a9['interaction']=_0x325399[_0x3ae9('0x66')]({'plain':!![]});interaction_log[_0x3ae9('0x1f')](_0x3ae9('0x67'),_0xb1beb0['user']['id'],_0xb1beb0[_0x3ae9('0x68')][_0x3ae9('0x38')],_0xb1beb0[_0x3ae9('0x68')][_0x3ae9('0x69')],_0x3531a9[_0x3ae9('0x6a')]['id'],_0xb1beb0['body']?JSON[_0x3ae9('0x24')](_0xb1beb0[_0x3ae9('0x59')]):_0x3ae9('0x6b'));return respondWithRpcPromise(_0x3ae9('0x6c'),_0x3ae9('0x6d'),_0x3531a9);}return null;})[_0x3ae9('0x35')](function(_0x280c98){var _0xcc045e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x280c98[_0x3ae9('0x27')][_0x3ae9('0x6e')];return db[_0x3ae9('0x6f')]['query'](_0xcc045e,{'type':db['Sequelize'][_0x3ae9('0x70')][_0x3ae9('0x71')],'raw':!![]})[_0x3ae9('0x35')](function(_0x4b33f5){return _0x4b33f5;});})[_0x3ae9('0x35')](function(_0x44b85d){if(_0x44b85d){_0x3531a9['message'][_0x3ae9('0x72')]=_0x44b85d[0x0];if(!_0xb1beb0[_0x3ae9('0x59')][_0x3ae9('0x61')])return;return db[_0x3ae9('0x73')]['find']({'where':{'id':_0xb1beb0[_0x3ae9('0x59')][_0x3ae9('0x61')],'role':'agent'},'attributes':['id',_0x3ae9('0x38'),_0x3ae9('0x74'),_0x3ae9('0x75'),'internal'],'raw':!![]});}return null;})['then'](function(_0xbe79a2){if(!_0xbe79a2)return null;_0x3531a9[_0x3ae9('0x27')][_0x3ae9('0x76')]=_0xbe79a2;return _0x3531a9;})[_0x3ae9('0x35')](function(_0x2a7202){if(_0x2a7202){if(_0xb1beb0['body'][_0x3ae9('0x77')]){_0x3531a9[_0x3ae9('0x27')][_0x3ae9('0x78')]=util[_0x3ae9('0x5f')](_0x3ae9('0x79'),_0xb1beb0[_0x3ae9('0x68')][_0x3ae9('0x38')]);_0x3531a9['message']['channel']=_0x3531a9[_0x3ae9('0x7a')];_0x3531a9['message'][_0x3ae9('0x7b')]=_0x3531a9[_0x3ae9('0x7a')];_0x3531a9[_0x3ae9('0x27')][_0x3ae9('0x7c')]=_0x3ae9('0x7d');return respondWithRpcPromise(_0x3ae9('0x7e'),_0x3ae9('0x7e'),{'event':_0x3ae9('0x7f'),'message':_[_0x3ae9('0x4c')](_0x3531a9[_0x3ae9('0x27')],JSON[_0x3ae9('0x80')](_0x3531a9[_0x3ae9('0x6a')]['formData']))},client9002)[_0x3ae9('0x35')](function(){return _0x3531a9;});}return _0x3531a9;}return null;})[_0x3ae9('0x35')](respondWithResult(_0x40f233,null))[_0x3ae9('0x29')](handleError(_0x40f233,null));};var interaction_log=require(_0x3ae9('0x81'))(_0x3ae9('0x5b'));exports['reject']=function(_0x51e885,_0x52f573,_0x24ba2f){var _0x1ee041={'agent':{},'channel':_0x3ae9('0x5c')};if(_0x51e885[_0x3ae9('0x59')]['id']){delete _0x51e885[_0x3ae9('0x59')]['id'];}_0x51e885[_0x3ae9('0x59')][_0x3ae9('0x61')]=_0x51e885[_0x3ae9('0x59')][_0x3ae9('0x61')]||_0x51e885[_0x3ae9('0x68')]['id'];_0x1ee041[_0x3ae9('0x76')]['id']=_0x51e885[_0x3ae9('0x59')]['UserId'];return db[_0x3ae9('0x3b')][_0x3ae9('0x57')]({'where':{'id':_0x51e885[_0x3ae9('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x52f573,null))[_0x3ae9('0x35')](function(_0x1e1e29){if(_0x1e1e29){_0x1ee041['message']=_0x1e1e29[_0x3ae9('0x66')]({'plain':!![]});return db[_0x3ae9('0x62')][_0x3ae9('0x57')]({'where':{'id':_0x1e1e29[_0x3ae9('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x52f573,null))[_0x3ae9('0x35')](function(_0x47ab4c){if(_0x47ab4c){_0x1ee041['interaction']=_0x47ab4c[_0x3ae9('0x66')]({'plain':!![]});interaction_log['info'](_0x3ae9('0x82'),_0x51e885['user']['id'],_0x51e885[_0x3ae9('0x68')]['name'],_0x51e885[_0x3ae9('0x68')][_0x3ae9('0x69')],_0x1ee041[_0x3ae9('0x6a')]['id'],_0x51e885['body']?JSON[_0x3ae9('0x24')](_0x51e885[_0x3ae9('0x59')]):'null');return respondWithRpcPromise(_0x3ae9('0x83'),_0x3ae9('0x84'),_0x1ee041);}return null;})[_0x3ae9('0x35')](function(_0x20fd0b){var _0x1638da='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x20fd0b['message'][_0x3ae9('0x6e')];return db[_0x3ae9('0x6f')][_0x3ae9('0x3f')](_0x1638da,{'type':db[_0x3ae9('0x85')][_0x3ae9('0x70')][_0x3ae9('0x71')],'raw':!![]})[_0x3ae9('0x35')](function(_0x1dceff){return _0x1dceff;});})['then'](function(_0x1fa489){if(_0x1fa489){_0x1ee041['message'][_0x3ae9('0x72')]=_0x1fa489[0x0];if(!_0x51e885[_0x3ae9('0x59')]['UserId'])return;return db['User'][_0x3ae9('0x57')]({'where':{'id':_0x51e885[_0x3ae9('0x59')][_0x3ae9('0x61')],'role':'agent'},'attributes':['id',_0x3ae9('0x38'),_0x3ae9('0x74'),_0x3ae9('0x75'),_0x3ae9('0x86')],'raw':!![]});}return null;})[_0x3ae9('0x35')](function(_0x40bdc8){if(!_0x40bdc8)return null;_0x1ee041['message']['agent']=_0x40bdc8;return _0x1ee041;})[_0x3ae9('0x35')](function(_0x21e19e){if(_0x21e19e){_0x21e19e[_0x3ae9('0x27')][_0x3ae9('0x78')]=util[_0x3ae9('0x5f')](_0x3ae9('0x79'),_0x51e885[_0x3ae9('0x68')][_0x3ae9('0x38')]);_0x21e19e[_0x3ae9('0x27')][_0x3ae9('0x7a')]=_0x1ee041[_0x3ae9('0x7a')];_0x21e19e[_0x3ae9('0x27')][_0x3ae9('0x7b')]=_0x1ee041['channel'];_0x21e19e[_0x3ae9('0x27')][_0x3ae9('0x7c')]=_0x3ae9('0x87');respondWithRpcPromise('EventManager',_0x3ae9('0x7e'),{'event':_0x3ae9('0x88'),'message':_[_0x3ae9('0x4c')](_0x1ee041[_0x3ae9('0x27')],JSON[_0x3ae9('0x80')](_0x1ee041[_0x3ae9('0x6a')][_0x3ae9('0x89')]))},client9002);return _0x1ee041;}return null;})[_0x3ae9('0x35')](respondWithResult(_0x52f573,null))[_0x3ae9('0x29')](handleError(_0x52f573,null));}; \ No newline at end of file +var _0xd97a=['acceptMessage','sequelize','QueryTypes','email','internal','interface','SIP/%s','motionChannel','channel','event','EventManager','formData','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','SELECT','contact','fullname','rejectmessage','parse','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./chatMessage.socket','register','http','client','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','limit','offset','Content-Range','apply','reject','save','update','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','ChatMessage','findAll','rows','show','params','keys','length','options','find','create','body','destroy','describe','chat-interactions','chat','read','readAt','format','UserId','user','agent','get','ChatInteraction','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage'];(function(_0x390bda,_0x4752bb){var _0x3790e6=function(_0x1b7286){while(--_0x1b7286){_0x390bda['push'](_0x390bda['shift']());}};_0x3790e6(++_0x4752bb);}(_0xd97a,0x11a));var _0xad97=function(_0x201587,_0x4bc5f4){_0x201587=_0x201587-0x0;var _0x92e6dc=_0xd97a[_0x201587];return _0x92e6dc;};'use strict';var emlformat=require(_0xad97('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xad97('0x1'));var jsonpatch=require(_0xad97('0x2'));var rp=require(_0xad97('0x3'));var moment=require(_0xad97('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xad97('0x5'));var util=require(_0xad97('0x6'));var path=require(_0xad97('0x7'));var sox=require(_0xad97('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xad97('0x9'));var _=require('lodash');var squel=require(_0xad97('0xa'));var crypto=require(_0xad97('0xb'));var jsforce=require(_0xad97('0xc'));var deskjs=require(_0xad97('0xd'));var toCsv=require(_0xad97('0xe'));var querystring=require('querystring');var Papa=require(_0xad97('0xf'));var Redis=require(_0xad97('0x10'));var authService=require(_0xad97('0x11'));var qs=require(_0xad97('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xad97('0x13'));var logger=require(_0xad97('0x14'))(_0xad97('0x15'));var utils=require('../../config/utils');var config=require(_0xad97('0x16'));var licenseUtil=require(_0xad97('0x17'));var db=require('../../mysqldb')['db'];config[_0xad97('0x18')]=_[_0xad97('0x19')](config[_0xad97('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xad97('0x1a'))(new Redis(config[_0xad97('0x18')]));require(_0xad97('0x1b'))[_0xad97('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xad97('0x1d')]({'port':0x232c});var client9002=jayson[_0xad97('0x1e')][_0xad97('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2c9d71,_0x1d0bae,_0x349685,_0x188778){return new BPromise(function(_0x19b733,_0x5379d8){var _0x149e79=_0x188778||client;return _0x149e79['request'](_0x2c9d71,_0x349685)[_0xad97('0x1f')](function(_0x44511c){logger[_0xad97('0x20')](_0xad97('0x21'),_0x1d0bae,_0xad97('0x22'));logger[_0xad97('0x23')](_0xad97('0x24'),_0x1d0bae,_0xad97('0x22'),JSON[_0xad97('0x25')](_0x44511c));if(_0x44511c[_0xad97('0x26')]){if(_0x44511c[_0xad97('0x26')][_0xad97('0x27')]===0x1f4){logger['error'](_0xad97('0x21'),_0x1d0bae,_0x44511c[_0xad97('0x26')]['message']);return _0x5379d8(_0x44511c[_0xad97('0x26')]['message']);}logger[_0xad97('0x26')](_0xad97('0x21'),_0x1d0bae,_0x44511c['error'][_0xad97('0x28')]);return _0x19b733(_0x44511c[_0xad97('0x26')]['message']);}else{logger[_0xad97('0x20')](_0xad97('0x21'),_0x1d0bae,_0xad97('0x22'));_0x19b733(_0x44511c['result'][_0xad97('0x28')]);}})[_0xad97('0x29')](function(_0x464fd8){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1d0bae,_0x464fd8);_0x5379d8(_0x464fd8);});});}function respondWithStatusCode(_0x4ee96e,_0x23d678){_0x23d678=_0x23d678||0xcc;return function(_0x3a76dc){if(_0x3a76dc){return _0x4ee96e['sendStatus'](_0x23d678);}return _0x4ee96e[_0xad97('0x2a')](_0x23d678)[_0xad97('0x2b')]();};}function respondWithResult(_0x77386b,_0x41efe3){_0x41efe3=_0x41efe3||0xc8;return function(_0xf88c5a){if(_0xf88c5a){return _0x77386b[_0xad97('0x2a')](_0x41efe3)[_0xad97('0x2c')](_0xf88c5a);}};}function respondWithFilteredResult(_0x229761,_0x5a071e){return function(_0x1c7919){if(_0x1c7919){var _0x8c6f36=typeof _0x5a071e['offset']==='undefined'&&typeof _0x5a071e[_0xad97('0x2d')]==='undefined';var _0x383490=_0x1c7919['count'];var _0x55eba5=_0x8c6f36?0x0:_0x5a071e[_0xad97('0x2e')];var _0x25078f=_0x8c6f36?_0x1c7919['count']:_0x5a071e[_0xad97('0x2e')]+_0x5a071e['limit'];var _0x471fbe;if(_0x25078f>=_0x383490){_0x25078f=_0x383490;_0x471fbe=0xc8;}else{_0x471fbe=0xce;}_0x229761[_0xad97('0x2a')](_0x471fbe);return _0x229761['set'](_0xad97('0x2f'),_0x55eba5+'-'+_0x25078f+'/'+_0x383490)[_0xad97('0x2c')](_0x1c7919);}return null;};}function patchUpdates(_0x572690){return function(_0x3db0fc){try{jsonpatch[_0xad97('0x30')](_0x3db0fc,_0x572690,!![]);}catch(_0x1f1792){return BPromise[_0xad97('0x31')](_0x1f1792);}return _0x3db0fc[_0xad97('0x32')]();};}function saveUpdates(_0x396d81,_0x1db97a){return function(_0x306ba8){if(_0x306ba8){return _0x306ba8[_0xad97('0x33')](_0x396d81)['then'](function(_0x18ea45){return _0x18ea45;});}return null;};}function removeEntity(_0x4ad36b,_0x274259){return function(_0x53bd56){if(_0x53bd56){return _0x53bd56['destroy']()[_0xad97('0x1f')](function(){_0x4ad36b['status'](0xcc)[_0xad97('0x2b')]();});}};}function handleEntityNotFound(_0x3469c8,_0x183570){return function(_0x1129df){if(!_0x1129df){_0x3469c8[_0xad97('0x34')](0x194);}return _0x1129df;};}function handleError(_0x2035ab,_0x347afd){_0x347afd=_0x347afd||0x1f4;return function(_0xc12766){logger[_0xad97('0x26')](_0xc12766[_0xad97('0x35')]);if(_0xc12766[_0xad97('0x36')]){delete _0xc12766[_0xad97('0x36')];}_0x2035ab[_0xad97('0x2a')](_0x347afd)[_0xad97('0x37')](_0xc12766);};}exports[_0xad97('0x38')]=function(_0x5ed2aa,_0x1e32ef){var _0x1da322={},_0x28370f={},_0x12410e={'count':0x0,'rows':[]};var _0x2c4a80=_[_0xad97('0x39')](db['ChatMessage'][_0xad97('0x3a')],function(_0xf7245){return{'name':_0xf7245[_0xad97('0x3b')],'type':_0xf7245[_0xad97('0x3c')][_0xad97('0x3d')]};});_0x28370f['model']=_[_0xad97('0x39')](_0x2c4a80,_0xad97('0x36'));_0x28370f['query']=_['keys'](_0x5ed2aa[_0xad97('0x3e')]);_0x28370f[_0xad97('0x3f')]=_[_0xad97('0x40')](_0x28370f[_0xad97('0x41')],_0x28370f['query']);_0x1da322[_0xad97('0x42')]=_[_0xad97('0x40')](_0x28370f[_0xad97('0x41')],qs[_0xad97('0x43')](_0x5ed2aa[_0xad97('0x3e')][_0xad97('0x43')]));_0x1da322[_0xad97('0x42')]=_0x1da322[_0xad97('0x42')]['length']?_0x1da322[_0xad97('0x42')]:_0x28370f[_0xad97('0x41')];if(!_0x5ed2aa[_0xad97('0x3e')]['hasOwnProperty'](_0xad97('0x44'))){_0x1da322[_0xad97('0x2d')]=qs[_0xad97('0x2d')](_0x5ed2aa[_0xad97('0x3e')]['limit']);_0x1da322[_0xad97('0x2e')]=qs[_0xad97('0x2e')](_0x5ed2aa[_0xad97('0x3e')][_0xad97('0x2e')]);}_0x1da322[_0xad97('0x45')]=qs[_0xad97('0x46')](_0x5ed2aa[_0xad97('0x3e')][_0xad97('0x46')]);_0x1da322[_0xad97('0x47')]=qs['filters'](_[_0xad97('0x48')](_0x5ed2aa[_0xad97('0x3e')],_0x28370f[_0xad97('0x3f')]),_0x2c4a80);if(_0x5ed2aa[_0xad97('0x3e')][_0xad97('0x49')]){_0x1da322[_0xad97('0x47')]=_[_0xad97('0x4a')](_0x1da322[_0xad97('0x47')],{'$or':_[_0xad97('0x39')](_0x2c4a80,function(_0x455782){if(_0x455782[_0xad97('0x3c')]!==_0xad97('0x4b')){var _0x157a26={};_0x157a26[_0x455782['name']]={'$like':'%'+_0x5ed2aa[_0xad97('0x3e')][_0xad97('0x49')]+'%'};return _0x157a26;}})});}_0x1da322=_[_0xad97('0x4a')]({},_0x1da322,_0x5ed2aa['options']);var _0x3e20ca={'where':_0x1da322[_0xad97('0x47')]};return db['ChatMessage'][_0xad97('0x4c')](_0x3e20ca)['then'](function(_0x314f94){_0x12410e[_0xad97('0x4c')]=_0x314f94;if(_0x5ed2aa['query'][_0xad97('0x4d')]){_0x1da322[_0xad97('0x4e')]=[{'all':!![]}];}return db[_0xad97('0x4f')][_0xad97('0x50')](_0x1da322);})[_0xad97('0x1f')](function(_0x50fece){_0x12410e[_0xad97('0x51')]=_0x50fece;return _0x12410e;})[_0xad97('0x1f')](respondWithFilteredResult(_0x1e32ef,_0x1da322))[_0xad97('0x29')](handleError(_0x1e32ef,null));};exports[_0xad97('0x52')]=function(_0x34404d,_0x2ab83d){var _0x4d638f={'raw':!![],'where':{'id':_0x34404d[_0xad97('0x53')]['id']}},_0x145c58={};_0x145c58['model']=_[_0xad97('0x54')](db['ChatMessage'][_0xad97('0x3a')]);_0x145c58[_0xad97('0x3e')]=_[_0xad97('0x54')](_0x34404d[_0xad97('0x3e')]);_0x145c58[_0xad97('0x3f')]=_[_0xad97('0x40')](_0x145c58['model'],_0x145c58['query']);_0x4d638f['attributes']=_[_0xad97('0x40')](_0x145c58['model'],qs[_0xad97('0x43')](_0x34404d[_0xad97('0x3e')][_0xad97('0x43')]));_0x4d638f[_0xad97('0x42')]=_0x4d638f['attributes'][_0xad97('0x55')]?_0x4d638f['attributes']:_0x145c58[_0xad97('0x41')];if(_0x34404d['query'][_0xad97('0x4d')]){_0x4d638f['include']=[{'all':!![]}];}_0x4d638f=_[_0xad97('0x4a')]({},_0x4d638f,_0x34404d[_0xad97('0x56')]);return db[_0xad97('0x4f')][_0xad97('0x57')](_0x4d638f)[_0xad97('0x1f')](handleEntityNotFound(_0x2ab83d,null))['then'](respondWithResult(_0x2ab83d,null))['catch'](handleError(_0x2ab83d,null));};exports[_0xad97('0x58')]=function(_0x47808e,_0xf74040){return db[_0xad97('0x4f')][_0xad97('0x58')](_0x47808e[_0xad97('0x59')],{})[_0xad97('0x1f')](respondWithResult(_0xf74040,0xc9))[_0xad97('0x29')](handleError(_0xf74040,null));};exports['update']=function(_0x3d10c2,_0x32ad06){if(_0x3d10c2[_0xad97('0x59')]['id']){delete _0x3d10c2['body']['id'];}return db[_0xad97('0x4f')][_0xad97('0x57')]({'where':{'id':_0x3d10c2['params']['id']}})[_0xad97('0x1f')](handleEntityNotFound(_0x32ad06,null))[_0xad97('0x1f')](saveUpdates(_0x3d10c2['body'],null))[_0xad97('0x1f')](respondWithResult(_0x32ad06,null))[_0xad97('0x29')](handleError(_0x32ad06,null));};exports[_0xad97('0x5a')]=function(_0xedcebe,_0x4f9fe8){return db[_0xad97('0x4f')][_0xad97('0x57')]({'where':{'id':_0xedcebe[_0xad97('0x53')]['id']}})[_0xad97('0x1f')](handleEntityNotFound(_0x4f9fe8,null))[_0xad97('0x1f')](removeEntity(_0x4f9fe8,null))['catch'](handleError(_0x4f9fe8,null));};exports[_0xad97('0x5b')]=function(_0x453a5d,_0x565581){return db[_0xad97('0x4f')][_0xad97('0x5b')]()[_0xad97('0x1f')](respondWithResult(_0x565581,null))['catch'](handleError(_0x565581,null));};var interaction_log=require(_0xad97('0x14'))(_0xad97('0x5c'));exports['accept']=function(_0x217d36,_0x3e8924,_0x34dc73){var _0x1480d8={'agent':{},'channel':_0xad97('0x5d')};if(_0x217d36[_0xad97('0x59')]['id']){delete _0x217d36[_0xad97('0x59')]['id'];}_0x217d36[_0xad97('0x59')][_0xad97('0x5e')]=!![];_0x217d36['body'][_0xad97('0x5f')]=moment()[_0xad97('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x217d36[_0xad97('0x59')][_0xad97('0x61')]=_0x217d36[_0xad97('0x59')][_0xad97('0x61')]||_0x217d36[_0xad97('0x62')]['id'];_0x1480d8[_0xad97('0x63')]['id']=_0x217d36[_0xad97('0x59')][_0xad97('0x61')];return db['ChatMessage'][_0xad97('0x57')]({'where':{'id':_0x217d36[_0xad97('0x53')]['id'],'UserId':null}})[_0xad97('0x1f')](handleEntityNotFound(_0x3e8924,null))[_0xad97('0x1f')](saveUpdates(_0x217d36[_0xad97('0x59')],null))[_0xad97('0x1f')](function(_0x273d6a){if(_0x273d6a){_0x1480d8[_0xad97('0x28')]=_0x273d6a[_0xad97('0x64')]({'plain':!![]});return db[_0xad97('0x65')][_0xad97('0x57')]({'where':{'id':_0x273d6a['ChatInteractionId']}});}return null;})[_0xad97('0x1f')](handleEntityNotFound(_0x3e8924,null))[_0xad97('0x1f')](function(_0xc48dbc){if(_0xc48dbc){return _0xc48dbc[_0xad97('0x33')]({'UserId':_0x217d36[_0xad97('0x59')]['UserId'],'read1stAt':_['isNil'](_0xc48dbc['read1stAt'])?moment()['format'](_0xad97('0x66')):undefined});}return null;})[_0xad97('0x1f')](function(_0x4c1600){if(_0x4c1600){_0x1480d8[_0xad97('0x67')]=_0x4c1600[_0xad97('0x64')]({'plain':!![]});interaction_log['info'](_0xad97('0x68'),_0x217d36[_0xad97('0x62')]['id'],_0x217d36['user'][_0xad97('0x36')],_0x217d36[_0xad97('0x62')][_0xad97('0x69')],_0x1480d8[_0xad97('0x67')]['id'],_0x217d36[_0xad97('0x59')]?JSON[_0xad97('0x25')](_0x217d36[_0xad97('0x59')]):_0xad97('0x6a'));return respondWithRpcPromise(_0xad97('0x6b'),_0xad97('0x6c'),_0x1480d8);}return null;})[_0xad97('0x1f')](function(_0x4fd91d){var _0x180c63='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4fd91d['message']['ContactId'];return db[_0xad97('0x6d')][_0xad97('0x3e')](_0x180c63,{'type':db['Sequelize'][_0xad97('0x6e')]['SELECT'],'raw':!![]})[_0xad97('0x1f')](function(_0x4782a8){return _0x4782a8;});})[_0xad97('0x1f')](function(_0x4bd5a3){if(_0x4bd5a3){_0x1480d8[_0xad97('0x28')]['contact']=_0x4bd5a3[0x0];if(!_0x217d36['body'][_0xad97('0x61')])return;return db['User'][_0xad97('0x57')]({'where':{'id':_0x217d36['body'][_0xad97('0x61')],'role':'agent'},'attributes':['id',_0xad97('0x36'),'fullname',_0xad97('0x6f'),_0xad97('0x70')],'raw':!![]});}return null;})[_0xad97('0x1f')](function(_0x55393f){if(!_0x55393f)return null;_0x1480d8[_0xad97('0x28')][_0xad97('0x63')]=_0x55393f;return _0x1480d8;})[_0xad97('0x1f')](function(_0x39a581){if(_0x39a581){if(_0x217d36[_0xad97('0x59')]['manual']){_0x1480d8['message'][_0xad97('0x71')]=util['format'](_0xad97('0x72'),_0x217d36[_0xad97('0x62')][_0xad97('0x36')]);_0x1480d8['message']['channel']=_0x1480d8['channel'];_0x1480d8['message'][_0xad97('0x73')]=_0x1480d8[_0xad97('0x74')];_0x1480d8[_0xad97('0x28')][_0xad97('0x75')]='accept';return respondWithRpcPromise('EventManager',_0xad97('0x76'),{'event':'acceptmessage','message':_['merge'](_0x1480d8[_0xad97('0x28')],JSON['parse'](_0x1480d8[_0xad97('0x67')][_0xad97('0x77')]))},client9002)['then'](function(){return _0x1480d8;});}return _0x1480d8;}return null;})[_0xad97('0x1f')](respondWithResult(_0x3e8924,null))[_0xad97('0x29')](handleError(_0x3e8924,null));};var interaction_log=require(_0xad97('0x14'))(_0xad97('0x5c'));exports['reject']=function(_0x136242,_0x40a4b4,_0x324a0b){var _0x7aa8d0={'agent':{},'channel':_0xad97('0x5d')};if(_0x136242['body']['id']){delete _0x136242[_0xad97('0x59')]['id'];}_0x136242['body']['UserId']=_0x136242[_0xad97('0x59')][_0xad97('0x61')]||_0x136242[_0xad97('0x62')]['id'];_0x7aa8d0['agent']['id']=_0x136242['body'][_0xad97('0x61')];return db[_0xad97('0x4f')][_0xad97('0x57')]({'where':{'id':_0x136242['params']['id'],'UserId':null}})[_0xad97('0x1f')](handleEntityNotFound(_0x40a4b4,null))['then'](function(_0x4799c5){if(_0x4799c5){_0x7aa8d0[_0xad97('0x28')]=_0x4799c5[_0xad97('0x64')]({'plain':!![]});return db[_0xad97('0x65')][_0xad97('0x57')]({'where':{'id':_0x4799c5[_0xad97('0x78')]}});}return null;})[_0xad97('0x1f')](handleEntityNotFound(_0x40a4b4,null))[_0xad97('0x1f')](function(_0xc0d9e7){if(_0xc0d9e7){_0x7aa8d0[_0xad97('0x67')]=_0xc0d9e7[_0xad97('0x64')]({'plain':!![]});interaction_log['info'](_0xad97('0x79'),_0x136242['user']['id'],_0x136242[_0xad97('0x62')][_0xad97('0x36')],_0x136242[_0xad97('0x62')][_0xad97('0x69')],_0x7aa8d0[_0xad97('0x67')]['id'],_0x136242[_0xad97('0x59')]?JSON['stringify'](_0x136242[_0xad97('0x59')]):'null');return respondWithRpcPromise(_0xad97('0x7a'),'rejectMessage',_0x7aa8d0);}return null;})[_0xad97('0x1f')](function(_0x317fec){var _0x321f0a=_0xad97('0x7b')+_0x317fec['message']['ContactId'];return db['sequelize'][_0xad97('0x3e')](_0x321f0a,{'type':db[_0xad97('0x7c')][_0xad97('0x6e')][_0xad97('0x7d')],'raw':!![]})[_0xad97('0x1f')](function(_0x8f5157){return _0x8f5157;});})[_0xad97('0x1f')](function(_0x2a30d1){if(_0x2a30d1){_0x7aa8d0[_0xad97('0x28')][_0xad97('0x7e')]=_0x2a30d1[0x0];if(!_0x136242['body'][_0xad97('0x61')])return;return db['User'][_0xad97('0x57')]({'where':{'id':_0x136242[_0xad97('0x59')][_0xad97('0x61')],'role':_0xad97('0x63')},'attributes':['id',_0xad97('0x36'),_0xad97('0x7f'),_0xad97('0x6f'),'internal'],'raw':!![]});}return null;})[_0xad97('0x1f')](function(_0x39a815){if(!_0x39a815)return null;_0x7aa8d0[_0xad97('0x28')]['agent']=_0x39a815;return _0x7aa8d0;})[_0xad97('0x1f')](function(_0x8d839a){if(_0x8d839a){_0x8d839a[_0xad97('0x28')]['interface']=util[_0xad97('0x60')](_0xad97('0x72'),_0x136242['user'][_0xad97('0x36')]);_0x8d839a['message']['channel']=_0x7aa8d0[_0xad97('0x74')];_0x8d839a[_0xad97('0x28')][_0xad97('0x73')]=_0x7aa8d0[_0xad97('0x74')];_0x8d839a[_0xad97('0x28')][_0xad97('0x75')]='reject';respondWithRpcPromise(_0xad97('0x76'),_0xad97('0x76'),{'event':_0xad97('0x80'),'message':_[_0xad97('0x4a')](_0x7aa8d0[_0xad97('0x28')],JSON[_0xad97('0x81')](_0x7aa8d0['interaction']['formData']))},client9002);return _0x7aa8d0;}return null;})[_0xad97('0x1f')](respondWithResult(_0x40a4b4,null))[_0xad97('0x29')](handleError(_0x40a4b4,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 10c76f8..0503dbc 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 _0x61d1=['update','emit','hasOwnProperty','hook','exports','ChatMessage','setMaxListeners','save'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x61d1,0xf5));var _0x161d=function(_0x44594e,_0x1a0374){_0x44594e=_0x44594e-0x0;var _0x10af21=_0x61d1[_0x44594e];return _0x10af21;};'use strict';var EventEmitter=require('events');var ChatMessage=require('../../mysqldb')['db'][_0x161d('0x0')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x161d('0x1')](0x0);var events={'afterCreate':_0x161d('0x2'),'afterUpdate':_0x161d('0x3'),'afterDestroy':'remove'};function emitEvent(_0x31bd59){return function(_0x5e626d,_0x388fe2,_0x66ff74){ChatMessageEvents['emit'](_0x31bd59+':'+_0x5e626d['id'],_0x5e626d);ChatMessageEvents[_0x161d('0x4')](_0x31bd59,_0x5e626d);_0x66ff74(null);};}for(var e in events){if(events[_0x161d('0x5')](e)){var event=events[e];ChatMessage[_0x161d('0x6')](e,emitEvent(event));}}module[_0x161d('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x2bb8=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x4d04d6,_0x38ae19){var _0x2e937a=function(_0x4961c8){while(--_0x4961c8){_0x4d04d6['push'](_0x4d04d6['shift']());}};_0x2e937a(++_0x38ae19);}(_0x2bb8,0x13d));var _0x82bb=function(_0x45767b,_0x29551f){_0x45767b=_0x45767b-0x0;var _0x3172d5=_0x2bb8[_0x45767b];return _0x3172d5;};'use strict';var EventEmitter=require(_0x82bb('0x0'));var ChatMessage=require(_0x82bb('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x82bb('0x2')](0x0);var events={'afterCreate':_0x82bb('0x3'),'afterUpdate':_0x82bb('0x4'),'afterDestroy':_0x82bb('0x5')};function emitEvent(_0x781857){return function(_0x460f5b,_0x3fee04,_0x4003f2){ChatMessageEvents[_0x82bb('0x6')](_0x781857+':'+_0x460f5b['id'],_0x460f5b);ChatMessageEvents['emit'](_0x781857,_0x460f5b);_0x4003f2(null);};}for(var e in events){if(events[_0x82bb('0x7')](e)){var event=events[e];ChatMessage[_0x82bb('0x8')](e,emitEvent(event));}}module[_0x82bb('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 15073fa..0d80ac1 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 _0xb328=['ChatInteraction','findOne','ChatInteractionId','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','path','rimraf','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','models','get','direction','toLowerCase','out','secret','isNil'];(function(_0x394c8b,_0x2a4219){var _0x216544=function(_0x1ea695){while(--_0x1ea695){_0x394c8b['push'](_0x394c8b['shift']());}};_0x216544(++_0x2a4219);}(_0xb328,0xcc));var _0x8b32=function(_0x4d22fd,_0x129c95){_0x4d22fd=_0x4d22fd-0x0;var _0x40045b=_0xb328[_0x4d22fd];return _0x40045b;};'use strict';var _=require(_0x8b32('0x0'));var util=require(_0x8b32('0x1'));var logger=require(_0x8b32('0x2'))('api');var moment=require(_0x8b32('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8b32('0x4'));var rimraf=require(_0x8b32('0x5'));var config=require('../../config/environment');var attributes=require(_0x8b32('0x6'));module[_0x8b32('0x7')]=function(_0x12f29a,_0x1e6233){return _0x12f29a[_0x8b32('0x8')](_0x8b32('0x9'),attributes,{'tableName':_0x8b32('0xa'),'paranoid':![],'indexes':[{'name':_0x8b32('0xb'),'fields':[_0x8b32('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x171189,_0x10c4d0,_0xe0b9ac){var _0x4626ea=_0x12f29a[_0x8b32('0xd')];var _0x2e15bc=_0x171189[_0x8b32('0xe')]({'plain':!![]});if(_0x2e15bc[_0x8b32('0xf')][_0x8b32('0x10')]()==='in'||_0x2e15bc[_0x8b32('0xf')][_0x8b32('0x10')]()===_0x8b32('0x11')&&!_0x2e15bc[_0x8b32('0x12')]&&!_[_0x8b32('0x13')](_0x2e15bc['UserId'])){_0x4626ea[_0x8b32('0x14')][_0x8b32('0x15')]({'where':{'id':_0x2e15bc[_0x8b32('0x16')]}})['then'](function(_0x30c7b){if(_0x30c7b){_0x30c7b[_0x8b32('0x17')]({'lastMsgAt':_0x2e15bc[_0x8b32('0x18')],'lastMsgDirection':_0x2e15bc['direction']['toLowerCase']()});}})[_0x8b32('0x19')](function(_0x2cf03b){console['error'](_0x2cf03b);});}_0xe0b9ac();}},'charset':_0x8b32('0x1a'),'collate':_0x8b32('0x1b')});}; \ No newline at end of file +var _0xf3c5=['FULLTEXT','get','toLowerCase','direction','out','secret','isNil','UserId','ChatInteraction','findOne','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatMessage','chat_messages','fti_chat_messages','body'];(function(_0x228dac,_0x456312){var _0x1d3708=function(_0x4d850b){while(--_0x4d850b){_0x228dac['push'](_0x228dac['shift']());}};_0x1d3708(++_0x456312);}(_0xf3c5,0x178));var _0x5f3c=function(_0x1cfba1,_0xceafc){_0x1cfba1=_0x1cfba1-0x0;var _0x4fd6aa=_0xf3c5[_0x1cfba1];return _0x4fd6aa;};'use strict';var _=require(_0x5f3c('0x0'));var util=require(_0x5f3c('0x1'));var logger=require(_0x5f3c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5f3c('0x3'));var rp=require(_0x5f3c('0x4'));var fs=require('fs');var path=require(_0x5f3c('0x5'));var rimraf=require(_0x5f3c('0x6'));var config=require(_0x5f3c('0x7'));var attributes=require('./chatMessage.attributes');module[_0x5f3c('0x8')]=function(_0x44055b,_0x95f1bb){return _0x44055b[_0x5f3c('0x9')](_0x5f3c('0xa'),attributes,{'tableName':_0x5f3c('0xb'),'paranoid':![],'indexes':[{'name':_0x5f3c('0xc'),'fields':[_0x5f3c('0xd')],'type':_0x5f3c('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e6dfb,_0x2c9a95,_0xf79496){var _0x8fd044=_0x44055b['models'];var _0x5ab8c3=_0x2e6dfb[_0x5f3c('0xf')]({'plain':!![]});if(_0x5ab8c3['direction'][_0x5f3c('0x10')]()==='in'||_0x5ab8c3[_0x5f3c('0x11')][_0x5f3c('0x10')]()===_0x5f3c('0x12')&&!_0x5ab8c3[_0x5f3c('0x13')]&&!_[_0x5f3c('0x14')](_0x5ab8c3[_0x5f3c('0x15')])){_0x8fd044[_0x5f3c('0x16')][_0x5f3c('0x17')]({'where':{'id':_0x5ab8c3['ChatInteractionId']}})[_0x5f3c('0x18')](function(_0x546a8a){if(_0x546a8a){_0x546a8a[_0x5f3c('0x19')]({'lastMsgAt':_0x5ab8c3[_0x5f3c('0x1a')],'lastMsgDirection':_0x5ab8c3[_0x5f3c('0x11')][_0x5f3c('0x10')]()});}})[_0x5f3c('0x1b')](function(_0x4f1c94){console['error'](_0x4f1c94);});}_0xf79496();}},'charset':_0x5f3c('0x1c'),'collate':_0x5f3c('0x1d')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index fea55a2..e9dc93e 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 _0x407b=['options','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','register','request','then','info','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','CreateChatMessage','ChatMessage','create'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0x407b,0x1a2));var _0xb407=function(_0x1408ee,_0x175ac9){_0x1408ee=_0x1408ee-0x0;var _0x4e1a95=_0x407b[_0x1408ee];return _0x4e1a95;};'use strict';var _=require(_0xb407('0x0'));var util=require(_0xb407('0x1'));var moment=require('moment');var BPromise=require(_0xb407('0x2'));var rs=require(_0xb407('0x3'));var fs=require('fs');var Redis=require(_0xb407('0x4'));var db=require(_0xb407('0x5'))['db'];var utils=require(_0xb407('0x6'));var logger=require(_0xb407('0x7'))(_0xb407('0x8'));var config=require('../../config/environment');var jayson=require(_0xb407('0x9'));var client=jayson[_0xb407('0xa')][_0xb407('0xb')]({'port':0x232a});config[_0xb407('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb407('0xd'))(new Redis(config[_0xb407('0xc')]));require('./chatMessage.socket')[_0xb407('0xe')](socket);function respondWithRpcPromise(_0x57f177,_0x184c38,_0xd65be7){return new BPromise(function(_0x3d8d8e,_0x35ea8f){return client[_0xb407('0xf')](_0x57f177,_0xd65be7)[_0xb407('0x10')](function(_0x501d35){logger[_0xb407('0x11')]('ChatMessage,\x20%s,\x20%s',_0x184c38,_0xb407('0x12'));logger['debug'](_0xb407('0x13'),_0x184c38,_0xb407('0x12'),JSON[_0xb407('0x14')](_0x501d35));if(_0x501d35[_0xb407('0x15')]){if(_0x501d35[_0xb407('0x15')][_0xb407('0x16')]===0x1f4){logger[_0xb407('0x15')](_0xb407('0x17'),_0x184c38,_0x501d35[_0xb407('0x15')][_0xb407('0x18')]);return _0x35ea8f(_0x501d35[_0xb407('0x15')][_0xb407('0x18')]);}logger['error'](_0xb407('0x17'),_0x184c38,_0x501d35[_0xb407('0x15')][_0xb407('0x18')]);return _0x3d8d8e(_0x501d35[_0xb407('0x15')][_0xb407('0x18')]);}else{logger[_0xb407('0x11')](_0xb407('0x17'),_0x184c38,'request\x20sent');_0x3d8d8e(_0x501d35[_0xb407('0x19')][_0xb407('0x18')]);}})[_0xb407('0x1a')](function(_0x46af14){logger[_0xb407('0x15')](_0xb407('0x17'),_0x184c38,_0x46af14);_0x35ea8f(_0x46af14);});});}exports[_0xb407('0x1b')]=function(_0x445006){var _0x34bf0f=this;return new Promise(function(_0x2101d0,_0x229683){return db[_0xb407('0x1c')][_0xb407('0x1d')](_0x445006['body'],{'raw':_0x445006[_0xb407('0x1e')]?_0x445006[_0xb407('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xb407('0x10')](function(_0x3e71fe){logger[_0xb407('0x11')](_0xb407('0x1b'),_0x445006);logger[_0xb407('0x1f')](_0xb407('0x1b'),_0x445006,JSON[_0xb407('0x14')](_0x3e71fe));_0x2101d0(_0x3e71fe);})['catch'](function(_0x4acef2){logger[_0xb407('0x15')]('CreateChatMessage',_0x4acef2['message'],_0x445006);_0x229683(_0x34bf0f[_0xb407('0x15')](0x1f4,_0x4acef2['message']));});});}; \ No newline at end of file +var _0xc1c6=['defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','catch','CreateChatMessage','ChatMessage','create','body','options','raw','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x21e6a6,_0x2ad980){_0x21e6a6=_0x21e6a6-0x0;var _0x1d2357=_0xc1c6[_0x21e6a6];return _0x1d2357;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var moment=require(_0x6c1c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c1c('0x4'))['db'];var utils=require(_0x6c1c('0x5'));var logger=require(_0x6c1c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c1c('0x7'));var client=jayson['client'][_0x6c1c('0x8')]({'port':0x232a});config['redis']=_[_0x6c1c('0x9')](config[_0x6c1c('0xa')],{'host':_0x6c1c('0xb'),'port':0x18eb});var socket=require(_0x6c1c('0xc'))(new Redis(config['redis']));require(_0x6c1c('0xd'))[_0x6c1c('0xe')](socket);function respondWithRpcPromise(_0x524d21,_0x147c7b,_0x36275f){return new BPromise(function(_0xb3bd12,_0x1137e8){return client['request'](_0x524d21,_0x36275f)[_0x6c1c('0xf')](function(_0x2a4fd4){logger[_0x6c1c('0x10')]('ChatMessage,\x20%s,\x20%s',_0x147c7b,_0x6c1c('0x11'));logger[_0x6c1c('0x12')](_0x6c1c('0x13'),_0x147c7b,'request\x20sent',JSON[_0x6c1c('0x14')](_0x2a4fd4));if(_0x2a4fd4['error']){if(_0x2a4fd4[_0x6c1c('0x15')][_0x6c1c('0x16')]===0x1f4){logger[_0x6c1c('0x15')](_0x6c1c('0x17'),_0x147c7b,_0x2a4fd4[_0x6c1c('0x15')][_0x6c1c('0x18')]);return _0x1137e8(_0x2a4fd4[_0x6c1c('0x15')][_0x6c1c('0x18')]);}logger[_0x6c1c('0x15')]('ChatMessage,\x20%s,\x20%s',_0x147c7b,_0x2a4fd4[_0x6c1c('0x15')][_0x6c1c('0x18')]);return _0xb3bd12(_0x2a4fd4['error'][_0x6c1c('0x18')]);}else{logger[_0x6c1c('0x10')]('ChatMessage,\x20%s,\x20%s',_0x147c7b,_0x6c1c('0x11'));_0xb3bd12(_0x2a4fd4['result'][_0x6c1c('0x18')]);}})[_0x6c1c('0x19')](function(_0x5a3bb7){logger[_0x6c1c('0x15')]('ChatMessage,\x20%s,\x20%s',_0x147c7b,_0x5a3bb7);_0x1137e8(_0x5a3bb7);});});}exports[_0x6c1c('0x1a')]=function(_0x3527bf){var _0x23470e=this;return new Promise(function(_0x211f49,_0x1acf7f){return db[_0x6c1c('0x1b')][_0x6c1c('0x1c')](_0x3527bf[_0x6c1c('0x1d')],{'raw':_0x3527bf[_0x6c1c('0x1e')]?_0x3527bf[_0x6c1c('0x1e')][_0x6c1c('0x1f')]===undefined?!![]:![]:!![]})[_0x6c1c('0xf')](function(_0x2382c0){logger[_0x6c1c('0x10')](_0x6c1c('0x1a'),_0x3527bf);logger[_0x6c1c('0x12')](_0x6c1c('0x1a'),_0x3527bf,JSON[_0x6c1c('0x14')](_0x2382c0));_0x211f49(_0x2382c0);})[_0x6c1c('0x19')](function(_0x1dba08){logger[_0x6c1c('0x15')](_0x6c1c('0x1a'),_0x1dba08[_0x6c1c('0x18')],_0x3527bf);_0x1acf7f(_0x23470e[_0x6c1c('0x15')](0x1f4,_0x1dba08[_0x6c1c('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 2fef56a..8f6a151 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 _0x3c94=['remove','update','emit','removeListener','register','length','chatMessage:','./chatMessage.events','save'];(function(_0x155a9b,_0x196d07){var _0x43deca=function(_0x53a5f1){while(--_0x53a5f1){_0x155a9b['push'](_0x155a9b['shift']());}};_0x43deca(++_0x196d07);}(_0x3c94,0xcd));var _0x43c9=function(_0x1b5aea,_0x1afe6f){_0x1b5aea=_0x1b5aea-0x0;var _0x51cae9=_0x3c94[_0x1b5aea];return _0x51cae9;};'use strict';var ChatMessageEvents=require(_0x43c9('0x0'));var events=[_0x43c9('0x1'),_0x43c9('0x2'),_0x43c9('0x3')];function createListener(_0x188507,_0x2da73f){return function(_0xe05adb){_0x2da73f[_0x43c9('0x4')](_0x188507,_0xe05adb);};}function removeListener(_0x170a0d,_0x44fc3){return function(){ChatMessageEvents[_0x43c9('0x5')](_0x170a0d,_0x44fc3);};}exports[_0x43c9('0x6')]=function(_0x4fdfc2){for(var _0x39c220=0x0,_0xf03007=events[_0x43c9('0x7')];_0x39c220<_0xf03007;_0x39c220++){var _0x37c029=events[_0x39c220];var _0x383adb=createListener(_0x43c9('0x8')+_0x37c029,_0x4fdfc2);ChatMessageEvents['on'](_0x37c029,_0x383adb);}}; \ No newline at end of file +var _0x950a=['chatMessage:','./chatMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x950a,0x111));var _0xa950=function(_0x3f8353,_0x493caa){_0x3f8353=_0x3f8353-0x0;var _0x513881=_0x950a[_0x3f8353];return _0x513881;};'use strict';var ChatMessageEvents=require(_0xa950('0x0'));var events=[_0xa950('0x1'),_0xa950('0x2'),_0xa950('0x3')];function createListener(_0x5569f7,_0x305b26){return function(_0xa583df){_0x305b26[_0xa950('0x4')](_0x5569f7,_0xa583df);};}function removeListener(_0x2c80ed,_0x5cd4aa){return function(){ChatMessageEvents[_0xa950('0x5')](_0x2c80ed,_0x5cd4aa);};}exports[_0xa950('0x6')]=function(_0x512c0e){for(var _0x14b4ac=0x0,_0x3645b6=events['length'];_0x14b4ac<_0x3645b6;_0x14b4ac++){var _0x5675f8=events[_0x14b4ac];var _0x26e05c=createListener(_0xa950('0x7')+_0x5675f8,_0x512c0e);ChatMessageEvents['on'](_0x5675f8,_0x26e05c);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 416fb5c..65146d6 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 _0xa3cd=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','index','isAuthenticated','describe','get','post','tracked','chatmessage:create','create','/:id','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy'];(function(_0x217483,_0x422422){var _0x37f8a4=function(_0x7639ac){while(--_0x7639ac){_0x217483['push'](_0x217483['shift']());}};_0x37f8a4(++_0x422422);}(_0xa3cd,0x6c));var _0xda3c=function(_0xcf88e3,_0x1bdfd2){_0xcf88e3=_0xcf88e3-0x0;var _0x575673=_0xa3cd[_0xcf88e3];return _0x575673;};'use strict';var multer=require(_0xda3c('0x0'));var util=require(_0xda3c('0x1'));var path=require('path');var timeout=require(_0xda3c('0x2'));var express=require(_0xda3c('0x3'));var router=express[_0xda3c('0x4')]();var fs_extra=require(_0xda3c('0x5'));var auth=require(_0xda3c('0x6'));var interaction=require(_0xda3c('0x7'));var config=require(_0xda3c('0x8'));var controller=require(_0xda3c('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xda3c('0xa')]);router['get']('/describe',auth[_0xda3c('0xb')](),controller[_0xda3c('0xc')]);router[_0xda3c('0xd')]('/:id',auth[_0xda3c('0xb')](),controller['show']);router[_0xda3c('0xe')]('/',auth[_0xda3c('0xb')](),interaction[_0xda3c('0xf')]('chat',_0xda3c('0x10')),controller[_0xda3c('0x11')]);router['put'](_0xda3c('0x12'),controller[_0xda3c('0x13')]);router[_0xda3c('0x14')](_0xda3c('0x15'),auth[_0xda3c('0xb')](),controller[_0xda3c('0x16')]);router[_0xda3c('0x14')](_0xda3c('0x17'),auth[_0xda3c('0xb')](),controller[_0xda3c('0x18')]);router[_0xda3c('0x19')]('/:id',auth[_0xda3c('0xb')](),controller[_0xda3c('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xf245=['tracked','chat','chatmessage:create','put','update','/:id/reject','reject','destroy','exports','multer','util','connect-timeout','Router','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x1289a6,_0x4b4b17){var _0x3cd965=function(_0xc721d3){while(--_0xc721d3){_0x1289a6['push'](_0x1289a6['shift']());}};_0x3cd965(++_0x4b4b17);}(_0xf245,0x1ad));var _0x5f24=function(_0x154940,_0x4a448a){_0x154940=_0x154940-0x0;var _0x401409=_0xf245[_0x154940];return _0x401409;};'use strict';var multer=require(_0x5f24('0x0'));var util=require(_0x5f24('0x1'));var path=require('path');var timeout=require(_0x5f24('0x2'));var express=require('express');var router=express[_0x5f24('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5f24('0x4'));var config=require('../../config/environment');var controller=require(_0x5f24('0x5'));router[_0x5f24('0x6')]('/',auth[_0x5f24('0x7')](),controller[_0x5f24('0x8')]);router[_0x5f24('0x6')]('/describe',auth[_0x5f24('0x7')](),controller['describe']);router[_0x5f24('0x6')](_0x5f24('0x9'),auth[_0x5f24('0x7')](),controller[_0x5f24('0xa')]);router[_0x5f24('0xb')]('/',auth['isAuthenticated'](),interaction[_0x5f24('0xc')](_0x5f24('0xd'),_0x5f24('0xe')),controller['create']);router[_0x5f24('0xf')](_0x5f24('0x9'),controller[_0x5f24('0x10')]);router['put']('/:id/accept',auth[_0x5f24('0x7')](),controller['accept']);router[_0x5f24('0xf')](_0x5f24('0x11'),auth[_0x5f24('0x7')](),controller[_0x5f24('0x12')]);router['delete'](_0x5f24('0x9'),auth[_0x5f24('0x7')](),controller[_0x5f24('0x13')]);module[_0x5f24('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 36063f8..3f6dff9 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 _0x3728=['medium','exports'];(function(_0xb1cd92,_0x49dbfa){var _0x1cb782=function(_0x690a5e){while(--_0x690a5e){_0xb1cd92['push'](_0xb1cd92['shift']());}};_0x1cb782(++_0x49dbfa);}(_0x3728,0x16d));var _0x8372=function(_0x9b6377,_0x4d64ac){_0x9b6377=_0x9b6377-0x0;var _0x305473=_0x3728[_0x9b6377];return _0x305473;};'use strict';var Sequelize=require('sequelize');module[_0x8372('0x0')]={'body':{'type':Sequelize['TEXT'](_0x8372('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x967a=['sequelize','exports','TEXT','medium'];(function(_0xaadddb,_0x2e5965){var _0x5c9ba2=function(_0x12802a){while(--_0x12802a){_0xaadddb['push'](_0xaadddb['shift']());}};_0x5c9ba2(++_0x2e5965);}(_0x967a,0x160));var _0xa967=function(_0x3d0efa,_0x10915d){_0x3d0efa=_0x3d0efa-0x0;var _0x4df027=_0x967a[_0x3d0efa];return _0x4df027;};'use strict';var Sequelize=require(_0xa967('0x0'));module[_0xa967('0x1')]={'body':{'type':Sequelize[_0xa967('0x2')](_0xa967('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 7761ac9..e0acb77 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(_0x4cea3a,_0x5f56ef){var _0x24cd85=function(_0x308dc7){while(--_0x308dc7){_0x4cea3a['push'](_0x4cea3a['shift']());}};_0x24cd85(++_0x5f56ef);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x7a54,0x106));var _0x47a5=function(_0x4c2765,_0x39389f){_0x4c2765=_0x4c2765-0x0;var _0x5f1ed3=_0x7a54[_0x4c2765];return _0x5f1ed3;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 6150e33..5ec12e5 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 _0xf1c3=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf1c3,0x12b));var _0x3f1c=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0xf1c3[_0x9dfc10];return _0x4f938a;};'use strict';var _=require('lodash');var util=require(_0x3f1c('0x0'));var logger=require(_0x3f1c('0x1'))(_0x3f1c('0x2'));var moment=require(_0x3f1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x3f1c('0x4'));var fs=require('fs');var path=require(_0x3f1c('0x5'));var rimraf=require(_0x3f1c('0x6'));var config=require(_0x3f1c('0x7'));var attributes=require('./chatOfflineMessage.attributes');module[_0x3f1c('0x8')]=function(_0x1c0bd9,_0x36eaca){return _0x1c0bd9[_0x3f1c('0x9')](_0x3f1c('0xa'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3f1c('0xb'),'collate':_0x3f1c('0xc')});}; \ No newline at end of file +var _0x82f4=['define','chat_offline_messages','utf8mb4','lodash','util','api','request-promise','path','rimraf','./chatOfflineMessage.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x82f4,0x142));var _0x482f=function(_0x673d68,_0x115d89){_0x673d68=_0x673d68-0x0;var _0x51b40b=_0x82f4[_0x673d68];return _0x51b40b;};'use strict';var _=require(_0x482f('0x0'));var util=require(_0x482f('0x1'));var logger=require('../../config/logger')(_0x482f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x482f('0x3'));var fs=require('fs');var path=require(_0x482f('0x4'));var rimraf=require(_0x482f('0x5'));var config=require('../../config/environment');var attributes=require(_0x482f('0x6'));module[_0x482f('0x7')]=function(_0x2afbe6,_0x3023ba){return _0x2afbe6[_0x482f('0x8')]('ChatOfflineMessage',attributes,{'tableName':_0x482f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x482f('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 0e89be1..497a330 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 _0xb926=['../../config/logger','rpc','jayson/promise','client','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x1a8b0b,_0x3c5346){var _0x5d5fdb=function(_0x12b1b6){while(--_0x12b1b6){_0x1a8b0b['push'](_0x1a8b0b['shift']());}};_0x5d5fdb(++_0x3c5346);}(_0xb926,0x83));var _0x6b92=function(_0x214efd,_0x3cd6c9){_0x214efd=_0x214efd-0x0;var _0x524cc6=_0xb926[_0x214efd];return _0x524cc6;};'use strict';var _=require(_0x6b92('0x0'));var util=require(_0x6b92('0x1'));var moment=require(_0x6b92('0x2'));var BPromise=require(_0x6b92('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b92('0x4'));var db=require(_0x6b92('0x5'))['db'];var utils=require(_0x6b92('0x6'));var logger=require(_0x6b92('0x7'))(_0x6b92('0x8'));var config=require('../../config/environment');var jayson=require(_0x6b92('0x9'));var client=jayson[_0x6b92('0xa')][_0x6b92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c93ee,_0x4d69ea,_0x530be8){return new BPromise(function(_0x2e420c,_0x16b0df){return client[_0x6b92('0xc')](_0x3c93ee,_0x530be8)['then'](function(_0xf59d20){logger[_0x6b92('0xd')](_0x6b92('0xe'),_0x4d69ea,_0x6b92('0xf'));logger[_0x6b92('0x10')](_0x6b92('0x11'),_0x4d69ea,_0x6b92('0xf'),JSON[_0x6b92('0x12')](_0xf59d20));if(_0xf59d20[_0x6b92('0x13')]){if(_0xf59d20[_0x6b92('0x13')][_0x6b92('0x14')]===0x1f4){logger[_0x6b92('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x4d69ea,_0xf59d20[_0x6b92('0x13')][_0x6b92('0x15')]);return _0x16b0df(_0xf59d20[_0x6b92('0x13')][_0x6b92('0x15')]);}logger[_0x6b92('0x13')](_0x6b92('0xe'),_0x4d69ea,_0xf59d20['error'][_0x6b92('0x15')]);return _0x2e420c(_0xf59d20[_0x6b92('0x13')][_0x6b92('0x15')]);}else{logger[_0x6b92('0xd')](_0x6b92('0xe'),_0x4d69ea,_0x6b92('0xf'));_0x2e420c(_0xf59d20['result'][_0x6b92('0x15')]);}})[_0x6b92('0x16')](function(_0x1feb5f){logger[_0x6b92('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x4d69ea,_0x1feb5f);_0x16b0df(_0x1feb5f);});});} \ No newline at end of file +var _0x448a=['../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','randomstring','../../config/utils','../../config/logger'];(function(_0x1411a2,_0x1e9aab){var _0x3adb9b=function(_0x1eb6bc){while(--_0x1eb6bc){_0x1411a2['push'](_0x1411a2['shift']());}};_0x3adb9b(++_0x1e9aab);}(_0x448a,0x1ef));var _0xa448=function(_0x3bb2e6,_0x204bff){_0x3bb2e6=_0x3bb2e6-0x0;var _0x25f839=_0x448a[_0x3bb2e6];return _0x25f839;};'use strict';var _=require('lodash');var util=require(_0xa448('0x0'));var moment=require(_0xa448('0x1'));var BPromise=require('bluebird');var rs=require(_0xa448('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa448('0x3'));var logger=require(_0xa448('0x4'))('rpc');var config=require(_0xa448('0x5'));var jayson=require(_0xa448('0x6'));var client=jayson[_0xa448('0x7')][_0xa448('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12b0e2,_0x1f4749,_0x1ec2d8){return new BPromise(function(_0x54bdb0,_0x5df2c1){return client[_0xa448('0x9')](_0x12b0e2,_0x1ec2d8)[_0xa448('0xa')](function(_0x40006c){logger[_0xa448('0xb')](_0xa448('0xc'),_0x1f4749,_0xa448('0xd'));logger[_0xa448('0xe')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x1f4749,'request\x20sent',JSON[_0xa448('0xf')](_0x40006c));if(_0x40006c[_0xa448('0x10')]){if(_0x40006c['error'][_0xa448('0x11')]===0x1f4){logger[_0xa448('0x10')](_0xa448('0xc'),_0x1f4749,_0x40006c[_0xa448('0x10')][_0xa448('0x12')]);return _0x5df2c1(_0x40006c[_0xa448('0x10')][_0xa448('0x12')]);}logger[_0xa448('0x10')](_0xa448('0xc'),_0x1f4749,_0x40006c['error']['message']);return _0x54bdb0(_0x40006c[_0xa448('0x10')][_0xa448('0x12')]);}else{logger[_0xa448('0xb')](_0xa448('0xc'),_0x1f4749,_0xa448('0xd'));_0x54bdb0(_0x40006c[_0xa448('0x13')]['message']);}})['catch'](function(_0x5b8899){logger['error'](_0xa448('0xc'),_0x1f4749,_0x5b8899);_0x5df2c1(_0x5b8899);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 319889f..8433420 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 _0x0256=['exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','/:id','post','create','update','delete','destroy'];(function(_0x1282d5,_0x3f4224){var _0x5590de=function(_0x2e9126){while(--_0x2e9126){_0x1282d5['push'](_0x1282d5['shift']());}};_0x5590de(++_0x3f4224);}(_0x0256,0xf1));var _0x6025=function(_0x1fd0d5,_0x3cb655){_0x1fd0d5=_0x1fd0d5-0x0;var _0x57d242=_0x0256[_0x1fd0d5];return _0x57d242;};'use strict';var multer=require(_0x6025('0x0'));var util=require(_0x6025('0x1'));var path=require(_0x6025('0x2'));var timeout=require('connect-timeout');var express=require(_0x6025('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6025('0x4'));var interaction=require(_0x6025('0x5'));var config=require('../../config/environment');var controller=require(_0x6025('0x6'));router[_0x6025('0x7')]('/',auth[_0x6025('0x8')](),controller['index']);router[_0x6025('0x7')]('/describe',auth[_0x6025('0x8')](),controller['describe']);router[_0x6025('0x7')](_0x6025('0x9'),auth[_0x6025('0x8')](),controller['show']);router[_0x6025('0xa')]('/',auth[_0x6025('0x8')](),controller[_0x6025('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6025('0xc')]);router[_0x6025('0xd')](_0x6025('0x9'),auth[_0x6025('0x8')](),controller[_0x6025('0xe')]);module[_0x6025('0xf')]=router; \ No newline at end of file +var _0x26be=['delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','index','describe','get','/:id','isAuthenticated','show','post','create','put','update'];(function(_0x228c67,_0x561a54){var _0x9f7b85=function(_0x251008){while(--_0x251008){_0x228c67['push'](_0x228c67['shift']());}};_0x9f7b85(++_0x561a54);}(_0x26be,0xd4));var _0xe26b=function(_0x6ee0af,_0x55ca08){_0x6ee0af=_0x6ee0af-0x0;var _0x3047dc=_0x26be[_0x6ee0af];return _0x3047dc;};'use strict';var multer=require(_0xe26b('0x0'));var util=require('util');var path=require(_0xe26b('0x1'));var timeout=require(_0xe26b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe26b('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xe26b('0x4'));var controller=require(_0xe26b('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xe26b('0x6')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xe26b('0x7')]);router[_0xe26b('0x8')](_0xe26b('0x9'),auth[_0xe26b('0xa')](),controller[_0xe26b('0xb')]);router[_0xe26b('0xc')]('/',auth[_0xe26b('0xa')](),controller[_0xe26b('0xd')]);router[_0xe26b('0xe')]('/:id',auth[_0xe26b('0xa')](),controller[_0xe26b('0xf')]);router[_0xe26b('0x10')](_0xe26b('0x9'),auth[_0xe26b('0xa')](),controller[_0xe26b('0x11')]);module[_0xe26b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index b4d9890..f984d52 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 _0x3af9=['INTEGER','sequelize','exports','ENUM','mouseOver','timeout','STRING'];(function(_0x3c198a,_0x3246d4){var _0x1a455c=function(_0x5e74e2){while(--_0x5e74e2){_0x3c198a['push'](_0x3c198a['shift']());}};_0x1a455c(++_0x3246d4);}(_0x3af9,0xa9));var _0x93af=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x3af9[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x93af('0x0'));module[_0x93af('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x93af('0x2')](_0x93af('0x3'),_0x93af('0x4')),'defaultValue':_0x93af('0x3')},'selector':{'type':Sequelize[_0x93af('0x5')]},'timeout':{'type':Sequelize[_0x93af('0x6')]}}; \ No newline at end of file +var _0xfa6a=['mouseOver','timeout','sequelize','exports','STRING'];(function(_0xb9dcf0,_0x3d46bf){var _0x156afb=function(_0x237b64){while(--_0x237b64){_0xb9dcf0['push'](_0xb9dcf0['shift']());}};_0x156afb(++_0x3d46bf);}(_0xfa6a,0x13d));var _0xafa6=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xfa6a[_0x819464];return _0x49dcc0;};'use strict';var Sequelize=require(_0xafa6('0x0'));module[_0xafa6('0x1')]={'name':{'type':Sequelize[_0xafa6('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xafa6('0x3'),_0xafa6('0x4')),'defaultValue':_0xafa6('0x3')},'selector':{'type':Sequelize[_0xafa6('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 5286250..af10b62 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 _0x34aa=['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','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','show','params','keys','ChatProactiveAction','query','intersection','model','attributes','fields','length','includeAll','include','merge','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x1835e1,_0x519a22){var _0x3dbd85=function(_0x2c6f84){while(--_0x2c6f84){_0x1835e1['push'](_0x1835e1['shift']());}};_0x3dbd85(++_0x519a22);}(_0x34aa,0x171));var _0xa34a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x34aa[_0x122ef9];return _0x42fba0;};'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={'raw':!![],'where':{'id':_0x48e428[_0xa34a('0x30')]['id']}},_0x196681={};_0x196681['model']=_[_0xa34a('0x31')](db[_0xa34a('0x32')]['rawAttributes']);_0x196681[_0xa34a('0x33')]=_[_0xa34a('0x31')](_0x48e428['query']);_0x196681['filters']=_[_0xa34a('0x34')](_0x196681[_0xa34a('0x35')],_0x196681[_0xa34a('0x33')]);_0x82350e[_0xa34a('0x36')]=_[_0xa34a('0x34')](_0x196681[_0xa34a('0x35')],qs['fields'](_0x48e428[_0xa34a('0x33')][_0xa34a('0x37')]));_0x82350e['attributes']=_0x82350e[_0xa34a('0x36')][_0xa34a('0x38')]?_0x82350e[_0xa34a('0x36')]:_0x196681[_0xa34a('0x35')];if(_0x48e428['query'][_0xa34a('0x39')]){_0x82350e[_0xa34a('0x3a')]=[{'all':!![]}];}_0x82350e=_[_0xa34a('0x3b')]({},_0x82350e,_0x48e428['options']);return db[_0xa34a('0x32')][_0xa34a('0x3c')](_0x82350e)[_0xa34a('0x29')](handleEntityNotFound(_0x2b03a7,null))[_0xa34a('0x29')](respondWithResult(_0x2b03a7,null))[_0xa34a('0x3d')](handleError(_0x2b03a7,null));};exports[_0xa34a('0x3e')]=function(_0x50fa82,_0x4c7a6e){return db['ChatProactiveAction'][_0xa34a('0x3e')](_0x50fa82[_0xa34a('0x3f')],{})[_0xa34a('0x29')](respondWithResult(_0x4c7a6e,0xc9))[_0xa34a('0x3d')](handleError(_0x4c7a6e,null));};exports[_0xa34a('0x27')]=function(_0xc74618,_0x58b8ba){if(_0xc74618[_0xa34a('0x3f')]['id']){delete _0xc74618[_0xa34a('0x3f')]['id'];}return db[_0xa34a('0x32')][_0xa34a('0x3c')]({'where':{'id':_0xc74618[_0xa34a('0x30')]['id']}})[_0xa34a('0x29')](handleEntityNotFound(_0x58b8ba,null))['then'](saveUpdates(_0xc74618[_0xa34a('0x3f')],null))[_0xa34a('0x29')](respondWithResult(_0x58b8ba,null))['catch'](handleError(_0x58b8ba,null));};exports[_0xa34a('0x28')]=function(_0x53f4a4,_0x41a4d5){return db[_0xa34a('0x32')][_0xa34a('0x3c')]({'where':{'id':_0x53f4a4[_0xa34a('0x30')]['id']}})[_0xa34a('0x29')](handleEntityNotFound(_0x41a4d5,null))[_0xa34a('0x29')](removeEntity(_0x41a4d5,null))[_0xa34a('0x3d')](handleError(_0x41a4d5,null));}; \ No newline at end of file +var _0x36bb=['status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','show','model','ChatProactiveAction','rawAttributes','keys','query','filters','intersection','attributes','fields','length','merge','options','catch','create','body','params','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x45c957,_0x276317){var _0x1bf7f4=function(_0x51688b){while(--_0x51688b){_0x45c957['push'](_0x45c957['shift']());}};_0x1bf7f4(++_0x276317);}(_0x36bb,0xe6));var _0xb36b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36bb[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb36b('0x0'));var rimraf=require(_0xb36b('0x1'));var zipdir=require(_0xb36b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb36b('0x3'));var moment=require(_0xb36b('0x4'));var BPromise=require(_0xb36b('0x5'));var Mustache=require(_0xb36b('0x6'));var util=require(_0xb36b('0x7'));var path=require(_0xb36b('0x8'));var sox=require(_0xb36b('0x9'));var csv=require(_0xb36b('0xa'));var ejs=require(_0xb36b('0xb'));var fs=require('fs');var fs_extra=require(_0xb36b('0xc'));var _=require(_0xb36b('0xd'));var squel=require(_0xb36b('0xe'));var crypto=require(_0xb36b('0xf'));var jsforce=require(_0xb36b('0x10'));var deskjs=require(_0xb36b('0x11'));var toCsv=require(_0xb36b('0xa'));var querystring=require(_0xb36b('0x12'));var Papa=require(_0xb36b('0x13'));var Redis=require(_0xb36b('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xb36b('0x15'));var as=require(_0xb36b('0x16'));var hardwareService=require(_0xb36b('0x17'));var logger=require('../../config/logger')(_0xb36b('0x18'));var utils=require(_0xb36b('0x19'));var config=require(_0xb36b('0x1a'));var licenseUtil=require(_0xb36b('0x1b'));var db=require(_0xb36b('0x1c'))['db'];function respondWithStatusCode(_0x11f775,_0x1ad623){_0x1ad623=_0x1ad623||0xcc;return function(_0x1c266a){if(_0x1c266a){return _0x11f775[_0xb36b('0x1d')](_0x1ad623);}return _0x11f775[_0xb36b('0x1e')](_0x1ad623)[_0xb36b('0x1f')]();};}function respondWithResult(_0x59af21,_0x1aef0b){_0x1aef0b=_0x1aef0b||0xc8;return function(_0x4c2c46){if(_0x4c2c46){return _0x59af21['status'](_0x1aef0b)[_0xb36b('0x20')](_0x4c2c46);}};}function respondWithFilteredResult(_0x329f60,_0x23e960){return function(_0x4b74f1){if(_0x4b74f1){var _0x5c7255=typeof _0x23e960[_0xb36b('0x21')]==='undefined'&&typeof _0x23e960[_0xb36b('0x22')]===_0xb36b('0x23');var _0xfe29fc=_0x4b74f1[_0xb36b('0x24')];var _0x53ec0e=_0x5c7255?0x0:_0x23e960[_0xb36b('0x21')];var _0x211a91=_0x5c7255?_0x4b74f1[_0xb36b('0x24')]:_0x23e960['offset']+_0x23e960[_0xb36b('0x22')];var _0x572d88;if(_0x211a91>=_0xfe29fc){_0x211a91=_0xfe29fc;_0x572d88=0xc8;}else{_0x572d88=0xce;}_0x329f60[_0xb36b('0x1e')](_0x572d88);return _0x329f60[_0xb36b('0x25')](_0xb36b('0x26'),_0x53ec0e+'-'+_0x211a91+'/'+_0xfe29fc)[_0xb36b('0x20')](_0x4b74f1);}return null;};}function patchUpdates(_0x4049fa){return function(_0x5f6648){try{jsonpatch[_0xb36b('0x27')](_0x5f6648,_0x4049fa,!![]);}catch(_0x5c68de){return BPromise[_0xb36b('0x28')](_0x5c68de);}return _0x5f6648['save']();};}function saveUpdates(_0x218995,_0x52b74f){return function(_0x3b8030){if(_0x3b8030){return _0x3b8030[_0xb36b('0x29')](_0x218995)[_0xb36b('0x2a')](function(_0x174795){return _0x174795;});}return null;};}function removeEntity(_0x2fe32e,_0x5f4a25){return function(_0x474083){if(_0x474083){return _0x474083[_0xb36b('0x2b')]()[_0xb36b('0x2a')](function(){_0x2fe32e['status'](0xcc)[_0xb36b('0x1f')]();});}};}function handleEntityNotFound(_0x4a58d4,_0x5dbe3b){return function(_0x50e8e4){if(!_0x50e8e4){_0x4a58d4[_0xb36b('0x1d')](0x194);}return _0x50e8e4;};}function handleError(_0x1d904e,_0x2e8402){_0x2e8402=_0x2e8402||0x1f4;return function(_0x5c4aee){logger[_0xb36b('0x2c')](_0x5c4aee[_0xb36b('0x2d')]);if(_0x5c4aee[_0xb36b('0x2e')]){delete _0x5c4aee[_0xb36b('0x2e')];}_0x1d904e['status'](_0x2e8402)['send'](_0x5c4aee);};}exports[_0xb36b('0x2f')]=function(_0x2724bf,_0x24149b){var _0x138f74={'raw':!![],'where':{'id':_0x2724bf['params']['id']}},_0x4aabf5={};_0x4aabf5[_0xb36b('0x30')]=_['keys'](db[_0xb36b('0x31')][_0xb36b('0x32')]);_0x4aabf5['query']=_[_0xb36b('0x33')](_0x2724bf[_0xb36b('0x34')]);_0x4aabf5[_0xb36b('0x35')]=_[_0xb36b('0x36')](_0x4aabf5[_0xb36b('0x30')],_0x4aabf5[_0xb36b('0x34')]);_0x138f74[_0xb36b('0x37')]=_[_0xb36b('0x36')](_0x4aabf5[_0xb36b('0x30')],qs[_0xb36b('0x38')](_0x2724bf[_0xb36b('0x34')][_0xb36b('0x38')]));_0x138f74['attributes']=_0x138f74['attributes'][_0xb36b('0x39')]?_0x138f74[_0xb36b('0x37')]:_0x4aabf5['model'];if(_0x2724bf[_0xb36b('0x34')]['includeAll']){_0x138f74['include']=[{'all':!![]}];}_0x138f74=_[_0xb36b('0x3a')]({},_0x138f74,_0x2724bf[_0xb36b('0x3b')]);return db[_0xb36b('0x31')]['find'](_0x138f74)['then'](handleEntityNotFound(_0x24149b,null))[_0xb36b('0x2a')](respondWithResult(_0x24149b,null))[_0xb36b('0x3c')](handleError(_0x24149b,null));};exports[_0xb36b('0x3d')]=function(_0x46bde0,_0x39c80e){return db[_0xb36b('0x31')]['create'](_0x46bde0[_0xb36b('0x3e')],{})[_0xb36b('0x2a')](respondWithResult(_0x39c80e,0xc9))[_0xb36b('0x3c')](handleError(_0x39c80e,null));};exports[_0xb36b('0x29')]=function(_0x301e12,_0x185bb2){if(_0x301e12[_0xb36b('0x3e')]['id']){delete _0x301e12[_0xb36b('0x3e')]['id'];}return db[_0xb36b('0x31')]['find']({'where':{'id':_0x301e12[_0xb36b('0x3f')]['id']}})[_0xb36b('0x2a')](handleEntityNotFound(_0x185bb2,null))[_0xb36b('0x2a')](saveUpdates(_0x301e12['body'],null))[_0xb36b('0x2a')](respondWithResult(_0x185bb2,null))[_0xb36b('0x3c')](handleError(_0x185bb2,null));};exports[_0xb36b('0x2b')]=function(_0x26b77f,_0x55b694){return db['ChatProactiveAction'][_0xb36b('0x40')]({'where':{'id':_0x26b77f[_0xb36b('0x3f')]['id']}})[_0xb36b('0x2a')](handleEntityNotFound(_0x55b694,null))[_0xb36b('0x2a')](removeEntity(_0x55b694,null))[_0xb36b('0x3c')](handleError(_0x55b694,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 314348f..87b6d00 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 _0x8fcb=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions'];(function(_0xb32001,_0x506e9f){var _0x495897=function(_0x24f606){while(--_0x24f606){_0xb32001['push'](_0xb32001['shift']());}};_0x495897(++_0x506e9f);}(_0x8fcb,0x1ec));var _0xb8fc=function(_0x1f414c,_0x2ff27c){_0x1f414c=_0x1f414c-0x0;var _0x37b39a=_0x8fcb[_0x1f414c];return _0x37b39a;};'use strict';var _=require(_0xb8fc('0x0'));var util=require(_0xb8fc('0x1'));var logger=require(_0xb8fc('0x2'))(_0xb8fc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb8fc('0x4'));var fs=require('fs');var path=require(_0xb8fc('0x5'));var rimraf=require(_0xb8fc('0x6'));var config=require(_0xb8fc('0x7'));var attributes=require(_0xb8fc('0x8'));module[_0xb8fc('0x9')]=function(_0x4485ba,_0x33f9ed){return _0x4485ba['define'](_0xb8fc('0xa'),attributes,{'tableName':_0xb8fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c5b=['./chatProactiveAction.attributes','exports','define','lodash','util','../../config/logger','api','bluebird','path','../../config/environment'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x2c5b,0xfd));var _0xb2c5=function(_0x471b5c,_0x22e279){_0x471b5c=_0x471b5c-0x0;var _0x1bbcec=_0x2c5b[_0x471b5c];return _0x1bbcec;};'use strict';var _=require(_0xb2c5('0x0'));var util=require(_0xb2c5('0x1'));var logger=require(_0xb2c5('0x2'))(_0xb2c5('0x3'));var moment=require('moment');var BPromise=require(_0xb2c5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb2c5('0x5'));var rimraf=require('rimraf');var config=require(_0xb2c5('0x6'));var attributes=require(_0xb2c5('0x7'));module[_0xb2c5('0x8')]=function(_0x83dd40,_0x47ef10){return _0x83dd40[_0xb2c5('0x9')]('ChatProactiveAction',attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 39ac251..756e960 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 _0xc97e=['../../mysqldb','rpc','../../config/environment','client','http','request','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','info','request\x20sent','result','lodash','util','moment','bluebird'];(function(_0x2df383,_0x3b3e81){var _0x2c7845=function(_0x387f32){while(--_0x387f32){_0x2df383['push'](_0x2df383['shift']());}};_0x2c7845(++_0x3b3e81);}(_0xc97e,0x114));var _0xec97=function(_0x4640c6,_0xc268af){_0x4640c6=_0x4640c6-0x0;var _0x6d91dd=_0xc97e[_0x4640c6];return _0x6d91dd;};'use strict';var _=require(_0xec97('0x0'));var util=require(_0xec97('0x1'));var moment=require(_0xec97('0x2'));var BPromise=require(_0xec97('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xec97('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xec97('0x5'));var config=require(_0xec97('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xec97('0x7')][_0xec97('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b1d75,_0x581990,_0x14032b){return new BPromise(function(_0x3a5ba9,_0x425021){return client[_0xec97('0x9')](_0x1b1d75,_0x14032b)['then'](function(_0x4dab19){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x581990,'request\x20sent');logger[_0xec97('0xa')](_0xec97('0xb'),_0x581990,'request\x20sent',JSON[_0xec97('0xc')](_0x4dab19));if(_0x4dab19[_0xec97('0xd')]){if(_0x4dab19[_0xec97('0xd')][_0xec97('0xe')]===0x1f4){logger['error'](_0xec97('0xf'),_0x581990,_0x4dab19[_0xec97('0xd')][_0xec97('0x10')]);return _0x425021(_0x4dab19['error'][_0xec97('0x10')]);}logger[_0xec97('0xd')](_0xec97('0xf'),_0x581990,_0x4dab19[_0xec97('0xd')]['message']);return _0x3a5ba9(_0x4dab19[_0xec97('0xd')][_0xec97('0x10')]);}else{logger[_0xec97('0x11')](_0xec97('0xf'),_0x581990,_0xec97('0x12'));_0x3a5ba9(_0x4dab19[_0xec97('0x13')][_0xec97('0x10')]);}})['catch'](function(_0x89b3e3){logger[_0xec97('0xd')](_0xec97('0xf'),_0x581990,_0x89b3e3);_0x425021(_0x89b3e3);});});} \ No newline at end of file +var _0xb667=['moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash'];(function(_0x55754e,_0x286388){var _0x2e9948=function(_0x1eaeff){while(--_0x1eaeff){_0x55754e['push'](_0x55754e['shift']());}};_0x2e9948(++_0x286388);}(_0xb667,0x142));var _0x7b66=function(_0x2e12c7,_0x1ef1db){_0x2e12c7=_0x2e12c7-0x0;var _0x397bcf=_0xb667[_0x2e12c7];return _0x397bcf;};'use strict';var _=require(_0x7b66('0x0'));var util=require('util');var moment=require(_0x7b66('0x1'));var BPromise=require(_0x7b66('0x2'));var rs=require(_0x7b66('0x3'));var fs=require('fs');var Redis=require(_0x7b66('0x4'));var db=require(_0x7b66('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7b66('0x6'));var config=require('../../config/environment');var jayson=require(_0x7b66('0x7'));var client=jayson[_0x7b66('0x8')][_0x7b66('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xdca87,_0x39202a,_0x293066){return new BPromise(function(_0x577eea,_0x395f90){return client['request'](_0xdca87,_0x293066)['then'](function(_0x103b64){logger[_0x7b66('0xa')](_0x7b66('0xb'),_0x39202a,_0x7b66('0xc'));logger[_0x7b66('0xd')](_0x7b66('0xe'),_0x39202a,_0x7b66('0xc'),JSON['stringify'](_0x103b64));if(_0x103b64[_0x7b66('0xf')]){if(_0x103b64[_0x7b66('0xf')][_0x7b66('0x10')]===0x1f4){logger[_0x7b66('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x39202a,_0x103b64['error'][_0x7b66('0x11')]);return _0x395f90(_0x103b64['error']['message']);}logger[_0x7b66('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x39202a,_0x103b64['error'][_0x7b66('0x11')]);return _0x577eea(_0x103b64[_0x7b66('0xf')][_0x7b66('0x11')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x39202a,_0x7b66('0xc'));_0x577eea(_0x103b64[_0x7b66('0x12')][_0x7b66('0x11')]);}})['catch'](function(_0x2470bb){logger[_0x7b66('0xf')](_0x7b66('0xb'),_0x39202a,_0x2470bb);_0x395f90(_0x2470bb);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 14feff7..2d3fc36 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 _0xed1f=['../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x513f27,_0x1cbc87){var _0xa316b7=function(_0x3b592d){while(--_0x3b592d){_0x513f27['push'](_0x513f27['shift']());}};_0xa316b7(++_0x1cbc87);}(_0xed1f,0x6a));var _0xfed1=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0xed1f[_0x11c573];return _0x6b72de;};'use strict';var multer=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var path=require(_0xfed1('0x2'));var timeout=require(_0xfed1('0x3'));var express=require(_0xfed1('0x4'));var router=express[_0xfed1('0x5')]();var fs_extra=require(_0xfed1('0x6'));var auth=require(_0xfed1('0x7'));var interaction=require(_0xfed1('0x8'));var config=require(_0xfed1('0x9'));var controller=require(_0xfed1('0xa'));router[_0xfed1('0xb')](_0xfed1('0xc'),auth[_0xfed1('0xd')](),controller[_0xfed1('0xe')]);router[_0xfed1('0xf')]('/',auth[_0xfed1('0xd')](),controller[_0xfed1('0x10')]);router['put'](_0xfed1('0xc'),auth[_0xfed1('0xd')](),controller['update']);router[_0xfed1('0x11')](_0xfed1('0xc'),auth['isAuthenticated'](),controller[_0xfed1('0x12')]);module['exports']=router; \ No newline at end of file +var _0xabce=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','show','isAuthenticated','create','put'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xabce,0x103));var _0xeabc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xabce[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./chatProactiveAction.controller');router['get'](_0xeabc('0x8'),auth['isAuthenticated'](),controller[_0xeabc('0x9')]);router['post']('/',auth[_0xeabc('0xa')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/:id',auth[_0xeabc('0xa')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0x8'),auth[_0xeabc('0xa')](),controller[_0xeabc('0xf')]);module[_0xeabc('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index db3526f..7ac6ab7 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 _0x8656=['rrmemory','beepall','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x44c974,_0x1bcfde){var _0x5214c6=function(_0x10aad5){while(--_0x10aad5){_0x44c974['push'](_0x44c974['shift']());}};_0x5214c6(++_0x1bcfde);}(_0x8656,0x12f));var _0x6865=function(_0x54c191,_0x4a04ef){_0x54c191=_0x54c191-0x0;var _0x40ee4a=_0x8656[_0x54c191];return _0x40ee4a;};'use strict';var Sequelize=require(_0x6865('0x0'));module[_0x6865('0x1')]={'name':{'type':Sequelize[_0x6865('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6865('0x2')]},'timeout':{'type':Sequelize[_0x6865('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6865('0x4')](_0x6865('0x5'),_0x6865('0x6'),'roundrobin')}}; \ No newline at end of file +var _0xf132=['ENUM','beepall','roundrobin','sequelize','exports','name','STRING','INTEGER'];(function(_0x1b9005,_0xc912e1){var _0x244966=function(_0x4c9ea3){while(--_0x4c9ea3){_0x1b9005['push'](_0x1b9005['shift']());}};_0x244966(++_0xc912e1);}(_0xf132,0x15b));var _0x2f13=function(_0x5e2e41,_0x150b32){_0x5e2e41=_0x5e2e41-0x0;var _0x1a3838=_0xf132[_0x5e2e41];return _0x1a3838;};'use strict';var Sequelize=require(_0x2f13('0x0'));module[_0x2f13('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2f13('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2f13('0x3')]},'timeout':{'type':Sequelize[_0x2f13('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2f13('0x5')]('rrmemory',_0x2f13('0x6'),_0x2f13('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index eb79cee..66dc20d 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 _0x258a=['defaults','socket.io-emitter','redis','./chatQueue.socket','register','jayson/promise','client','http','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','reject','save','update','destroy','get','ChatQueues','UserProfileResource','stack','name','send','map','ChatQueue','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','keys','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','length','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','updatedAt','format','SIP','createdAt','getTeams','Team','pick','ids','Agents','online','interface','transaction','addTeams','UserChatQueue','forEach','userChatQueue:save','removeTeams','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','sequelize','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','removeAgents','emit','userChatQueue:remove','omit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x360319,_0x1cd1ee){var _0x4062fb=function(_0x213292){while(--_0x213292){_0x360319['push'](_0x360319['shift']());}};_0x4062fb(++_0x1cd1ee);}(_0x258a,0x112));var _0xa258=function(_0x5a3bae,_0x22d71b){_0x5a3bae=_0x5a3bae-0x0;var _0x17a174=_0x258a[_0x5a3bae];return _0x17a174;};'use strict';var emlformat=require(_0xa258('0x0'));var rimraf=require(_0xa258('0x1'));var zipdir=require(_0xa258('0x2'));var jsonpatch=require(_0xa258('0x3'));var rp=require('request-promise');var moment=require(_0xa258('0x4'));var BPromise=require(_0xa258('0x5'));var Mustache=require('mustache');var util=require(_0xa258('0x6'));var path=require(_0xa258('0x7'));var sox=require(_0xa258('0x8'));var csv=require('to-csv');var ejs=require(_0xa258('0x9'));var fs=require('fs');var fs_extra=require(_0xa258('0xa'));var _=require(_0xa258('0xb'));var squel=require(_0xa258('0xc'));var crypto=require('crypto');var jsforce=require(_0xa258('0xd'));var deskjs=require(_0xa258('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa258('0xf'));var Papa=require(_0xa258('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa258('0x11'));var as=require(_0xa258('0x12'));var hardwareService=require(_0xa258('0x13'));var logger=require(_0xa258('0x14'))(_0xa258('0x15'));var utils=require(_0xa258('0x16'));var config=require(_0xa258('0x17'));var licenseUtil=require(_0xa258('0x18'));var db=require(_0xa258('0x19'))['db'];config['redis']=_[_0xa258('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa258('0x1b'))(new Redis(config[_0xa258('0x1c')]));require(_0xa258('0x1d'))[_0xa258('0x1e')](socket);var jayson=require(_0xa258('0x1f'));var client=jayson[_0xa258('0x20')][_0xa258('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x26548b,_0x53223d,_0x4b216b,_0x536c6b){return new BPromise(function(_0x19cfe3,_0x1894de){var _0x3aff4e=_0x536c6b||client;return _0x3aff4e[_0xa258('0x22')](_0x26548b,_0x4b216b)[_0xa258('0x23')](function(_0x4813d4){logger['info'](_0xa258('0x24'),_0x53223d,_0xa258('0x25'));logger[_0xa258('0x26')](_0xa258('0x27'),_0x53223d,_0xa258('0x25'),JSON[_0xa258('0x28')](_0x4813d4));if(_0x4813d4['error']){if(_0x4813d4['error'][_0xa258('0x29')]===0x1f4){logger[_0xa258('0x2a')](_0xa258('0x24'),_0x53223d,_0x4813d4[_0xa258('0x2a')]['message']);return _0x1894de(_0x4813d4[_0xa258('0x2a')][_0xa258('0x2b')]);}logger[_0xa258('0x2a')](_0xa258('0x24'),_0x53223d,_0x4813d4[_0xa258('0x2a')][_0xa258('0x2b')]);return _0x19cfe3(_0x4813d4['error']['message']);}else{logger['info'](_0xa258('0x24'),_0x53223d,_0xa258('0x25'));_0x19cfe3(_0x4813d4[_0xa258('0x2c')][_0xa258('0x2b')]);}})['catch'](function(_0x147030){logger[_0xa258('0x2a')](_0xa258('0x24'),_0x53223d,_0x147030);_0x1894de(_0x147030);});});}function respondWithStatusCode(_0x567aed,_0x5117ce){_0x5117ce=_0x5117ce||0xcc;return function(_0x472ae2){if(_0x472ae2){return _0x567aed[_0xa258('0x2d')](_0x5117ce);}return _0x567aed[_0xa258('0x2e')](_0x5117ce)['end']();};}function respondWithResult(_0x3e018c,_0x1f1543){_0x1f1543=_0x1f1543||0xc8;return function(_0x2efdfc){if(_0x2efdfc){return _0x3e018c[_0xa258('0x2e')](_0x1f1543)['json'](_0x2efdfc);}};}function respondWithFilteredResult(_0x22dc9a,_0x567336){return function(_0x434997){if(_0x434997){var _0x4e787b=typeof _0x567336['offset']===_0xa258('0x2f')&&typeof _0x567336[_0xa258('0x30')]===_0xa258('0x2f');var _0x2606aa=_0x434997['count'];var _0x56e47c=_0x4e787b?0x0:_0x567336[_0xa258('0x31')];var _0x565d2f=_0x4e787b?_0x434997[_0xa258('0x32')]:_0x567336['offset']+_0x567336[_0xa258('0x30')];var _0x51ce16;if(_0x565d2f>=_0x2606aa){_0x565d2f=_0x2606aa;_0x51ce16=0xc8;}else{_0x51ce16=0xce;}_0x22dc9a[_0xa258('0x2e')](_0x51ce16);return _0x22dc9a[_0xa258('0x33')](_0xa258('0x34'),_0x56e47c+'-'+_0x565d2f+'/'+_0x2606aa)[_0xa258('0x35')](_0x434997);}return null;};}function patchUpdates(_0x17e6f0){return function(_0x1bae91){try{jsonpatch['apply'](_0x1bae91,_0x17e6f0,!![]);}catch(_0x81f6fc){return BPromise[_0xa258('0x36')](_0x81f6fc);}return _0x1bae91[_0xa258('0x37')]();};}function saveUpdates(_0x4f37bb,_0x2462f2){return function(_0x19036d){if(_0x19036d){return _0x19036d[_0xa258('0x38')](_0x4f37bb)[_0xa258('0x23')](function(_0x366a6a){return _0x366a6a;});}return null;};}function removeEntity(_0xfe054c,_0x448777){return function(_0x51e34a){if(_0x51e34a){return _0x51e34a[_0xa258('0x39')]()[_0xa258('0x23')](function(){var _0x2aeee7=_0x51e34a[_0xa258('0x3a')]({'plain':!![]});var _0xb41884=_0xa258('0x3b');return db[_0xa258('0x3c')]['destroy']({'where':{'type':_0xb41884,'resourceId':_0x2aeee7['id']}})[_0xa258('0x23')](function(){return _0x51e34a;});})[_0xa258('0x23')](function(){_0xfe054c[_0xa258('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x589606,_0x18d074){return function(_0x5458fe){if(!_0x5458fe){_0x589606[_0xa258('0x2d')](0x194);}return _0x5458fe;};}function handleError(_0x4f9d98,_0x4d1282){_0x4d1282=_0x4d1282||0x1f4;return function(_0x45a990){logger['error'](_0x45a990[_0xa258('0x3d')]);if(_0x45a990[_0xa258('0x3e')]){delete _0x45a990[_0xa258('0x3e')];}_0x4f9d98[_0xa258('0x2e')](_0x4d1282)[_0xa258('0x3f')](_0x45a990);};}exports['index']=function(_0x52c782,_0x2cd41){var _0x4bad24={},_0x3ee8c9={},_0x3836c2={'count':0x0,'rows':[]};var _0x483e14=_[_0xa258('0x40')](db[_0xa258('0x41')][_0xa258('0x42')],function(_0x37f8e7){return{'name':_0x37f8e7['fieldName'],'type':_0x37f8e7[_0xa258('0x43')][_0xa258('0x44')]};});_0x3ee8c9[_0xa258('0x45')]=_['map'](_0x483e14,_0xa258('0x3e'));_0x3ee8c9[_0xa258('0x46')]=_['keys'](_0x52c782[_0xa258('0x46')]);_0x3ee8c9[_0xa258('0x47')]=_[_0xa258('0x48')](_0x3ee8c9[_0xa258('0x45')],_0x3ee8c9[_0xa258('0x46')]);_0x4bad24[_0xa258('0x49')]=_[_0xa258('0x48')](_0x3ee8c9[_0xa258('0x45')],qs[_0xa258('0x4a')](_0x52c782['query'][_0xa258('0x4a')]));_0x4bad24[_0xa258('0x49')]=_0x4bad24[_0xa258('0x49')]['length']?_0x4bad24[_0xa258('0x49')]:_0x3ee8c9['model'];if(!_0x52c782[_0xa258('0x46')][_0xa258('0x4b')](_0xa258('0x4c'))){_0x4bad24[_0xa258('0x30')]=qs[_0xa258('0x30')](_0x52c782[_0xa258('0x46')][_0xa258('0x30')]);_0x4bad24[_0xa258('0x31')]=qs['offset'](_0x52c782[_0xa258('0x46')][_0xa258('0x31')]);}_0x4bad24[_0xa258('0x4d')]=qs[_0xa258('0x4e')](_0x52c782[_0xa258('0x46')]['sort']);_0x4bad24[_0xa258('0x4f')]=qs['filters'](_['pick'](_0x52c782[_0xa258('0x46')],_0x3ee8c9[_0xa258('0x47')]),_0x483e14);if(_0x52c782[_0xa258('0x46')][_0xa258('0x50')]){_0x4bad24['where']=_[_0xa258('0x51')](_0x4bad24[_0xa258('0x4f')],{'$or':_[_0xa258('0x40')](_0x483e14,function(_0x502782){if(_0x502782[_0xa258('0x43')]!==_0xa258('0x52')){var _0x518aca={};_0x518aca[_0x502782['name']]={'$like':'%'+_0x52c782[_0xa258('0x46')]['filter']+'%'};return _0x518aca;}})});}_0x4bad24=_[_0xa258('0x51')]({},_0x4bad24,_0x52c782[_0xa258('0x53')]);var _0x199611={'where':_0x4bad24['where']};return db[_0xa258('0x41')][_0xa258('0x32')](_0x199611)[_0xa258('0x23')](function(_0x11d742){_0x3836c2['count']=_0x11d742;if(_0x52c782['query']['includeAll']){_0x4bad24['include']=[{'all':!![]}];}return db[_0xa258('0x41')][_0xa258('0x54')](_0x4bad24);})[_0xa258('0x23')](function(_0x125db5){_0x3836c2[_0xa258('0x55')]=_0x125db5;return _0x3836c2;})[_0xa258('0x23')](respondWithFilteredResult(_0x2cd41,_0x4bad24))[_0xa258('0x56')](handleError(_0x2cd41,null));};exports['show']=function(_0x23cc92,_0x3712c3){var _0x3dc276={'raw':!![],'where':{'id':_0x23cc92['params']['id']}},_0xaa3de={};_0xaa3de[_0xa258('0x45')]=_[_0xa258('0x57')](db[_0xa258('0x41')][_0xa258('0x42')]);_0xaa3de['query']=_['keys'](_0x23cc92[_0xa258('0x46')]);_0xaa3de['filters']=_[_0xa258('0x48')](_0xaa3de[_0xa258('0x45')],_0xaa3de['query']);_0x3dc276['attributes']=_['intersection'](_0xaa3de[_0xa258('0x45')],qs[_0xa258('0x4a')](_0x23cc92[_0xa258('0x46')][_0xa258('0x4a')]));_0x3dc276[_0xa258('0x49')]=_0x3dc276[_0xa258('0x49')]['length']?_0x3dc276[_0xa258('0x49')]:_0xaa3de[_0xa258('0x45')];if(_0x23cc92[_0xa258('0x46')][_0xa258('0x58')]){_0x3dc276[_0xa258('0x59')]=[{'all':!![]}];}_0x3dc276=_[_0xa258('0x51')]({},_0x3dc276,_0x23cc92[_0xa258('0x53')]);return db['ChatQueue'][_0xa258('0x5a')](_0x3dc276)['then'](handleEntityNotFound(_0x3712c3,null))['then'](respondWithResult(_0x3712c3,null))[_0xa258('0x56')](handleError(_0x3712c3,null));};exports[_0xa258('0x5b')]=function(_0xc26de3,_0x1f1ae2){return db[_0xa258('0x41')][_0xa258('0x5b')](_0xc26de3[_0xa258('0x5c')],{})[_0xa258('0x23')](function(_0x5666fc){var _0x138151=_0xc26de3[_0xa258('0x5d')][_0xa258('0x3a')]({'plain':!![]});if(!_0x138151)throw new Error(_0xa258('0x5e'));if(_0x138151[_0xa258('0x5f')]===_0xa258('0x5d')){var _0x27c486=_0x5666fc['get']({'plain':!![]});var _0x5e541e=_0xa258('0x3b');return db['UserProfileSection'][_0xa258('0x5a')]({'where':{'name':_0x5e541e,'userProfileId':_0x138151['userProfileId']},'raw':!![]})[_0xa258('0x23')](function(_0x18f7bd){if(_0x18f7bd&&_0x18f7bd[_0xa258('0x60')]===0x0){return db['UserProfileResource'][_0xa258('0x5b')]({'name':_0x27c486[_0xa258('0x3e')],'resourceId':_0x27c486['id'],'type':_0x18f7bd[_0xa258('0x3e')],'sectionId':_0x18f7bd['id']},{})[_0xa258('0x23')](function(){return _0x5666fc;});}else{return _0x5666fc;}})[_0xa258('0x56')](function(_0x159a21){logger['error'](_0xa258('0x61'),_0x159a21);throw _0x159a21;});}return _0x5666fc;})[_0xa258('0x23')](respondWithResult(_0x1f1ae2,0xc9))['catch'](handleError(_0x1f1ae2,null));};exports[_0xa258('0x38')]=function(_0x2de611,_0x3245ee){if(_0x2de611['body']['id']){delete _0x2de611['body']['id'];}return db['ChatQueue'][_0xa258('0x5a')]({'where':{'id':_0x2de611['params']['id']}})[_0xa258('0x23')](handleEntityNotFound(_0x3245ee,null))[_0xa258('0x23')](saveUpdates(_0x2de611['body'],null))[_0xa258('0x23')](respondWithResult(_0x3245ee,null))[_0xa258('0x56')](handleError(_0x3245ee,null));};exports[_0xa258('0x39')]=function(_0x12c665,_0x4e1f4a){return db[_0xa258('0x41')][_0xa258('0x5a')]({'where':{'id':_0x12c665[_0xa258('0x62')]['id']}})[_0xa258('0x23')](handleEntityNotFound(_0x4e1f4a,null))['then'](removeEntity(_0x4e1f4a,null))[_0xa258('0x56')](handleError(_0x4e1f4a,null));};exports[_0xa258('0x63')]=function(_0xb780c0,_0x5d9562){return db[_0xa258('0x41')][_0xa258('0x63')]()[_0xa258('0x23')](respondWithResult(_0x5d9562,null))[_0xa258('0x56')](handleError(_0x5d9562,null));};exports['getMembers']=function(_0x29a4fd,_0x1eee61,_0x54c0c4){var _0x51c335={'raw':!![],'where':{}},_0x5418a8={},_0x325f22;return db['ChatQueue'][_0xa258('0x64')]({'where':{'id':_0x29a4fd[_0xa258('0x62')]['id']}})[_0xa258('0x23')](handleEntityNotFound(_0x1eee61,null))['then'](function(_0x4980fa){if(_0x4980fa){_0x325f22=_0x4980fa[_0xa258('0x3a')]({'plain':!![]});_0x5418a8[_0xa258('0x45')]=_[_0xa258('0x57')](db['UserChatQueue'][_0xa258('0x42')]);_0x5418a8[_0xa258('0x46')]=_[_0xa258('0x57')](_0x29a4fd[_0xa258('0x46')]);_0x5418a8[_0xa258('0x47')]=_['intersection'](_0x5418a8[_0xa258('0x45')],_0x5418a8[_0xa258('0x46')]);_0x51c335['attributes']=_['intersection'](_0x5418a8[_0xa258('0x45')],qs[_0xa258('0x4a')](_0x29a4fd[_0xa258('0x46')]['fields']));_0x51c335[_0xa258('0x49')]=_0x51c335[_0xa258('0x49')][_0xa258('0x65')]?_0x51c335[_0xa258('0x49')]:_0x5418a8[_0xa258('0x45')];if(!_0x29a4fd['query']['hasOwnProperty'](_0xa258('0x4c'))){_0x51c335['limit']=qs['limit'](_0x29a4fd[_0xa258('0x46')][_0xa258('0x30')]);_0x51c335[_0xa258('0x31')]=qs['offset'](_0x29a4fd['query'][_0xa258('0x31')]);}_0x51c335[_0xa258('0x4d')]=qs[_0xa258('0x4e')](_0x29a4fd[_0xa258('0x46')][_0xa258('0x4e')]);_0x51c335['where']=qs[_0xa258('0x47')](_['pick'](_0x29a4fd[_0xa258('0x46')],_0x5418a8[_0xa258('0x47')]));_0x51c335[_0xa258('0x4f')][_0xa258('0x66')]=_0x4980fa['id'];if(_0x29a4fd[_0xa258('0x46')][_0xa258('0x50')]){_0x51c335[_0xa258('0x4f')]=_['merge'](_0x51c335[_0xa258('0x4f')],{'$or':_['map'](_0x51c335[_0xa258('0x49')],function(_0x59e3c7){var _0x2b2c70={};_0x2b2c70[_0x59e3c7]={'$like':'%'+_0x29a4fd[_0xa258('0x46')][_0xa258('0x50')]+'%'};return _0x2b2c70;})});}_0x51c335=_['merge']({},_0x51c335,_0x29a4fd[_0xa258('0x53')]);return db['UserChatQueue'][_0xa258('0x54')](_0x51c335);}})[_0xa258('0x23')](function(_0x39964e){if(_0x39964e){return db[_0xa258('0x67')][_0xa258('0x68')]({'where':{'id':_[_0xa258('0x40')](_0x39964e,_0xa258('0x69')),'role':_0xa258('0x6a')},'attributes':['id',_0xa258('0x3e'),_0xa258('0x6b'),_0xa258('0x6c'),'createdAt']});}})[_0xa258('0x23')](function(_0x17d311){if(_0x17d311){return{'count':_0x17d311[_0xa258('0x32')],'rows':_[_0xa258('0x40')](_0x17d311[_0xa258('0x55')],function(_0x5e9f5e){return{'membername':_0x5e9f5e[_0xa258('0x3e')],'UserId':_0x5e9f5e['id'],'queue_name':_0x325f22[_0xa258('0x3e')],'ChatQueueId':_0x325f22['id'],'interface':util[_0xa258('0x6d')]('%s/%s',_0xa258('0x6e'),_0x5e9f5e[_0xa258('0x3e')]),'penalty':0x0,'paused':_0x5e9f5e[_0xa258('0x6b')],'createdAt':_0x5e9f5e[_0xa258('0x6f')],'updatedAt':_0x5e9f5e[_0xa258('0x6c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1eee61,_0x51c335))[_0xa258('0x56')](handleError(_0x1eee61,null));};exports[_0xa258('0x70')]=function(_0x302db4,_0x1332d7,_0x3bea16){var _0x308c0b={};var _0x31c15e={};var _0x317b78;var _0x83a52f;return db['ChatQueue'][_0xa258('0x64')]({'where':{'id':_0x302db4[_0xa258('0x62')]['id']}})[_0xa258('0x23')](handleEntityNotFound(_0x1332d7,null))['then'](function(_0x19f3a5){if(_0x19f3a5){_0x317b78=_0x19f3a5;_0x31c15e[_0xa258('0x45')]=_[_0xa258('0x57')](db[_0xa258('0x71')][_0xa258('0x42')]);_0x31c15e[_0xa258('0x46')]=_[_0xa258('0x57')](_0x302db4[_0xa258('0x46')]);_0x31c15e[_0xa258('0x47')]=_[_0xa258('0x48')](_0x31c15e[_0xa258('0x45')],_0x31c15e['query']);_0x308c0b['attributes']=_['intersection'](_0x31c15e[_0xa258('0x45')],qs[_0xa258('0x4a')](_0x302db4[_0xa258('0x46')][_0xa258('0x4a')]));_0x308c0b['attributes']=_0x308c0b['attributes'][_0xa258('0x65')]?_0x308c0b[_0xa258('0x49')]:_0x31c15e[_0xa258('0x45')];_0x308c0b['order']=qs[_0xa258('0x4e')](_0x302db4[_0xa258('0x46')][_0xa258('0x4e')]);_0x308c0b[_0xa258('0x4f')]=qs[_0xa258('0x47')](_[_0xa258('0x72')](_0x302db4[_0xa258('0x46')],_0x31c15e[_0xa258('0x47')]));if(_0x302db4['query']['filter']){_0x308c0b[_0xa258('0x4f')]=_[_0xa258('0x51')](_0x308c0b[_0xa258('0x4f')],{'$or':_[_0xa258('0x40')](_0x308c0b[_0xa258('0x49')],function(_0x5c9037){var _0x491af6={};_0x491af6[_0x5c9037]={'$like':'%'+_0x302db4[_0xa258('0x46')][_0xa258('0x50')]+'%'};return _0x491af6;})});}_0x308c0b=_[_0xa258('0x51')]({},_0x308c0b,_0x302db4[_0xa258('0x53')]);return _0x317b78[_0xa258('0x70')](_0x308c0b);}})[_0xa258('0x23')](function(_0x69f281){if(_0x69f281){_0x83a52f=_0x69f281['length'];if(!_0x302db4[_0xa258('0x46')][_0xa258('0x4b')](_0xa258('0x4c'))){_0x308c0b[_0xa258('0x30')]=qs['limit'](_0x302db4[_0xa258('0x46')][_0xa258('0x30')]);_0x308c0b[_0xa258('0x31')]=qs['offset'](_0x302db4[_0xa258('0x46')][_0xa258('0x31')]);}return _0x317b78[_0xa258('0x70')](_0x308c0b);}})[_0xa258('0x23')](function(_0x78fde4){if(_0x78fde4){return _0x78fde4?{'count':_0x83a52f,'rows':_0x78fde4}:null;}})[_0xa258('0x23')](respondWithResult(_0x1332d7,null))[_0xa258('0x56')](handleError(_0x1332d7,null));};exports['addTeams']=function(_0x2d2e82,_0x396ce5,_0x47b321){var _0xf73b0=_0x2d2e82['body'][_0xa258('0x73')];return db[_0xa258('0x71')][_0xa258('0x54')]({'where':{'id':_0xf73b0},'attributes':['id'],'include':[{'model':db[_0xa258('0x67')],'as':_0xa258('0x74'),'attributes':['id',_0xa258('0x3e'),_0xa258('0x75'),'voicePause',_0xa258('0x76')],'raw':!![]}]})['then'](function(_0x4c0e9b){if(_0x4c0e9b){var _0x5de3b7=_['flatMap'](_0x4c0e9b,function(_0xa95252){var _0x379cbc=_0xa95252[_0xa258('0x3a')]({'plain':!![]});return _0x379cbc[_0xa258('0x74')];});return db[_0xa258('0x41')][_0xa258('0x5a')]({'where':{'id':_0x2d2e82[_0xa258('0x62')]['id']}})[_0xa258('0x23')](function(_0x2ae786){return db['sequelize'][_0xa258('0x77')](function(_0x5d1051){return _0x2ae786[_0xa258('0x78')](_0xf73b0,{'transaction':_0x5d1051})['then'](function(){return BPromise['each'](_0x5de3b7,function(_0x9afdad){return db[_0xa258('0x79')]['findOrCreate']({'where':{'UserId':_0x9afdad['id'],'ChatQueueId':_0x2d2e82[_0xa258('0x62')]['id']},'transaction':_0x5d1051});});})['then'](function(){_0x5de3b7[_0xa258('0x7a')](function(_0x52a83f){socket['emit'](_0xa258('0x7b'),{'UserId':_0x52a83f['id'],'ChatQueueId':_0x2ae786['id']});});});});});}})['then'](respondWithStatusCode(_0x396ce5,null))[_0xa258('0x56')](handleError(_0x396ce5,null));};exports[_0xa258('0x7c')]=function(_0x117d0e,_0x140645,_0xad96d0){return db[_0xa258('0x71')][_0xa258('0x54')]({'where':{'id':_0x117d0e[_0xa258('0x46')][_0xa258('0x73')]},'attributes':['id'],'include':[{'model':db[_0xa258('0x67')],'as':_0xa258('0x74'),'attributes':['id'],'raw':!![]}]})[_0xa258('0x23')](handleEntityNotFound(_0x140645,null))[_0xa258('0x23')](function(_0x81da8){var _0x1f4197=_[_0xa258('0x40')](_0x81da8,'id');var _0x50a7ce=[];var _0x477e4d=[];var _0x3068ec=squel['select']();_0x3068ec[_0xa258('0x7d')](_0xa258('0x7e'))[_0xa258('0x7f')](_0xa258('0x80'),'tq')[_0xa258('0x81')](_0xa258('0x82'),'ut',_0xa258('0x83'))[_0xa258('0x4f')](_0xa258('0x84'),_0x117d0e[_0xa258('0x62')]['id']);for(var _0x385b71=0x0;_0x385b71<_0x81da8[_0xa258('0x65')];_0x385b71+=0x1){let _0x4f65e0=_0x81da8[_0x385b71];for(var _0x25ceb9=0x0;_0x25ceb9<_0x4f65e0[_0xa258('0x74')][_0xa258('0x65')];_0x25ceb9+=0x1){let _0x49501c=_0x4f65e0[_0xa258('0x74')][_0x25ceb9];var _0x380f1d=_0x3068ec[_0xa258('0x85')]();_0x380f1d[_0xa258('0x4f')](_0xa258('0x86'),_0x49501c['id']);_0x477e4d['push'](db['sequelize'][_0xa258('0x46')](_0x380f1d[_0xa258('0x87')](),{'type':db[_0xa258('0x88')][_0xa258('0x89')][_0xa258('0x8a')]})['then'](function(_0x33c9d8){if(_0x33c9d8[_0xa258('0x65')]===0x1){return _0x49501c['id'];}else{var _0x487573=_['every'](_['map'](_0x33c9d8,_0xa258('0x8b')),function(_0x56c6c4){return _[_0xa258('0x8c')](_0x1f4197,_0x56c6c4);});if(_0x487573){return _0x49501c['id'];}}}));}}return BPromise[_0xa258('0x8d')](_0x477e4d)['then'](function(_0x32b034){_0x50a7ce=_(_0x50a7ce)[_0xa258('0x8e')](_0x32b034)[_0xa258('0x8f')]()[_0xa258('0x90')]();return db['ChatQueue']['find']({'where':{'id':_0x117d0e[_0xa258('0x62')]['id']}})[_0xa258('0x23')](function(_0x2e0598){return db['sequelize'][_0xa258('0x77')](function(_0xa468a6){return _0x2e0598[_0xa258('0x7c')](_0x117d0e[_0xa258('0x46')][_0xa258('0x73')],{'transaction':_0xa468a6})[_0xa258('0x23')](function(){if(!_['isEmpty'](_0x50a7ce)){return _0x2e0598[_0xa258('0x91')](_0x50a7ce,{'transaction':_0xa468a6});}})[_0xa258('0x23')](function(){_0x50a7ce[_0xa258('0x7a')](function(_0x462d7d){socket[_0xa258('0x92')](_0xa258('0x93'),{'UserId':_0x462d7d,'ChatQueueId':_0x2e0598['id']});});});});});});})[_0xa258('0x23')](respondWithStatusCode(_0x140645,null))['catch'](handleError(_0x140645,null));};exports['addAgents']=function(_0xf52574,_0x43cc6e,_0xcf69bf){return db[_0xa258('0x41')]['find']({'where':{'id':_0xf52574[_0xa258('0x62')]['id']}})[_0xa258('0x23')](handleEntityNotFound(_0x43cc6e,null))['then'](function(_0x2318f6){if(_0x2318f6){return _0x2318f6['addAgents'](_0xf52574[_0xa258('0x5c')][_0xa258('0x73')],_[_0xa258('0x94')](_0xf52574[_0xa258('0x5c')],[_0xa258('0x73'),'id'])||{})['spread'](function(_0x5f69ea){for(var _0x4fb7ac=0x0;_0x4fb7ac<_0xf52574[_0xa258('0x5c')][_0xa258('0x73')][_0xa258('0x65')];_0x4fb7ac+=0x1){socket[_0xa258('0x92')](_0xa258('0x7b'),{'UserId':Number(_0xf52574['body'][_0xa258('0x73')][_0x4fb7ac]),'ChatQueueId':Number(_0xf52574[_0xa258('0x62')]['id'])});}return _0x5f69ea;});}})[_0xa258('0x23')](respondWithResult(_0x43cc6e,null))[_0xa258('0x56')](handleError(_0x43cc6e,null));};exports[_0xa258('0x91')]=function(_0x4e0428,_0x11cdb,_0x4f56d7){return db[_0xa258('0x41')]['find']({'where':{'id':_0x4e0428[_0xa258('0x62')]['id']}})[_0xa258('0x23')](handleEntityNotFound(_0x11cdb,null))['then'](function(_0x4624d0){if(_0x4624d0){return _0x4624d0[_0xa258('0x91')](_0x4e0428[_0xa258('0x46')][_0xa258('0x73')])['then'](function(){if(_['isArray'](_0x4e0428[_0xa258('0x46')][_0xa258('0x73')])){for(var _0x232b8f=0x0;_0x232b8f<_0x4e0428[_0xa258('0x46')]['ids'][_0xa258('0x65')];_0x232b8f+=0x1){socket['emit'](_0xa258('0x93'),{'UserId':Number(_0x4e0428['query'][_0xa258('0x73')][_0x232b8f]),'ChatQueueId':Number(_0x4e0428[_0xa258('0x62')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x4e0428[_0xa258('0x46')][_0xa258('0x73')]),'ChatQueueId':Number(_0x4e0428[_0xa258('0x62')]['id'])});}});}})['then'](respondWithStatusCode(_0x11cdb,null))[_0xa258('0x56')](handleError(_0x11cdb,null));};exports[_0xa258('0x95')]=function(_0x591722,_0x248a39,_0x156a2b){var _0x2e11a3={};var _0x2d6f3e={};var _0x1b50c6;var _0x1b811f;return db[_0xa258('0x41')][_0xa258('0x64')]({'where':{'id':_0x591722['params']['id']}})['then'](handleEntityNotFound(_0x248a39,null))['then'](function(_0x509e25){if(_0x509e25){_0x1b50c6=_0x509e25;_0x2d6f3e[_0xa258('0x45')]=_[_0xa258('0x57')](db['User'][_0xa258('0x42')]);_0x2d6f3e[_0xa258('0x46')]=_[_0xa258('0x57')](_0x591722['query']);_0x2d6f3e[_0xa258('0x47')]=_[_0xa258('0x48')](_0x2d6f3e[_0xa258('0x45')],_0x2d6f3e[_0xa258('0x46')]);_0x2e11a3[_0xa258('0x49')]=_['intersection'](_0x2d6f3e[_0xa258('0x45')],qs['fields'](_0x591722[_0xa258('0x46')]['fields']));_0x2e11a3[_0xa258('0x49')]=_0x2e11a3[_0xa258('0x49')][_0xa258('0x65')]?_0x2e11a3[_0xa258('0x49')]:_0x2d6f3e['model'];_0x2e11a3[_0xa258('0x4d')]=qs[_0xa258('0x4e')](_0x591722[_0xa258('0x46')][_0xa258('0x4e')]);_0x2e11a3[_0xa258('0x4f')]=qs['filters'](_[_0xa258('0x72')](_0x591722[_0xa258('0x46')],_0x2d6f3e['filters']));if(_0x591722[_0xa258('0x46')][_0xa258('0x50')]){_0x2e11a3[_0xa258('0x4f')]=_[_0xa258('0x51')](_0x2e11a3[_0xa258('0x4f')],{'$or':_[_0xa258('0x40')](_0x2e11a3[_0xa258('0x49')],function(_0x41fe2f){var _0x5a19aa={};_0x5a19aa[_0x41fe2f]={'$like':'%'+_0x591722[_0xa258('0x46')][_0xa258('0x50')]+'%'};return _0x5a19aa;})});}_0x2e11a3=_[_0xa258('0x51')]({},_0x2e11a3,_0x591722[_0xa258('0x53')]);return _0x1b50c6[_0xa258('0x95')](_0x2e11a3);}})['then'](function(_0x31037e){if(_0x31037e){_0x1b811f=_0x31037e['length'];if(!_0x591722[_0xa258('0x46')][_0xa258('0x4b')](_0xa258('0x4c'))){_0x2e11a3[_0xa258('0x30')]=qs[_0xa258('0x30')](_0x591722[_0xa258('0x46')][_0xa258('0x30')]);_0x2e11a3['offset']=qs[_0xa258('0x31')](_0x591722[_0xa258('0x46')][_0xa258('0x31')]);}return _0x1b50c6['getAgents'](_0x2e11a3);}})[_0xa258('0x23')](function(_0x5297a0){if(_0x5297a0){return _0x5297a0?{'count':_0x1b811f,'rows':_0x5297a0}:null;}})[_0xa258('0x23')](respondWithResult(_0x248a39,null))[_0xa258('0x56')](handleError(_0x248a39,null));}; \ No newline at end of file +var _0x0e6b=['options','includeAll','include','findAll','rows','show','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','update','describe','order','ChatQueueId','UserChatQueue','User','UserId','agent','chatPause','createdAt','format','SIP','updatedAt','getTeams','findOne','Team','hasOwnProperty','addTeams','ids','Agents','online','interface','transaction','findOrCreate','forEach','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','clone','toString','sequelize','QueryTypes','TeamId','includes','union','compact','value','isEmpty','removeAgents','emit','userChatQueue:remove','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','info','request\x20sent','debug','error','code','ChatQueue,\x20%s,\x20%s','message','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','destroy','get','ChatQueues','UserProfileResource','then','end','stack','name','map','ChatQueue','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge'];(function(_0x2d23a4,_0xc79e87){var _0x3c2660=function(_0x36c817){while(--_0x36c817){_0x2d23a4['push'](_0x2d23a4['shift']());}};_0x3c2660(++_0xc79e87);}(_0x0e6b,0x161));var _0xb0e6=function(_0x5e6bec,_0x1eb54d){_0x5e6bec=_0x5e6bec-0x0;var _0x5dc5cf=_0x0e6b[_0x5e6bec];return _0x5dc5cf;};'use strict';var emlformat=require(_0xb0e6('0x0'));var rimraf=require(_0xb0e6('0x1'));var zipdir=require(_0xb0e6('0x2'));var jsonpatch=require(_0xb0e6('0x3'));var rp=require(_0xb0e6('0x4'));var moment=require(_0xb0e6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb0e6('0x6'));var util=require(_0xb0e6('0x7'));var path=require(_0xb0e6('0x8'));var sox=require(_0xb0e6('0x9'));var csv=require(_0xb0e6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb0e6('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb0e6('0xc'));var deskjs=require(_0xb0e6('0xd'));var toCsv=require(_0xb0e6('0xa'));var querystring=require(_0xb0e6('0xe'));var Papa=require(_0xb0e6('0xf'));var Redis=require(_0xb0e6('0x10'));var authService=require(_0xb0e6('0x11'));var qs=require(_0xb0e6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb0e6('0x13'));var logger=require('../../config/logger')(_0xb0e6('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb0e6('0x15'));var db=require(_0xb0e6('0x16'))['db'];config['redis']=_[_0xb0e6('0x17')](config[_0xb0e6('0x18')],{'host':_0xb0e6('0x19'),'port':0x18eb});var socket=require(_0xb0e6('0x1a'))(new Redis(config[_0xb0e6('0x18')]));require(_0xb0e6('0x1b'))[_0xb0e6('0x1c')](socket);var jayson=require(_0xb0e6('0x1d'));var client=jayson[_0xb0e6('0x1e')][_0xb0e6('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x51fe31,_0x2e46c2,_0x517f44,_0xb2ad96){return new BPromise(function(_0x1a51c6,_0x3844bf){var _0x20975f=_0xb2ad96||client;return _0x20975f['request'](_0x51fe31,_0x517f44)['then'](function(_0x437da5){logger[_0xb0e6('0x20')]('ChatQueue,\x20%s,\x20%s',_0x2e46c2,_0xb0e6('0x21'));logger[_0xb0e6('0x22')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x2e46c2,'request\x20sent',JSON['stringify'](_0x437da5));if(_0x437da5[_0xb0e6('0x23')]){if(_0x437da5[_0xb0e6('0x23')][_0xb0e6('0x24')]===0x1f4){logger[_0xb0e6('0x23')](_0xb0e6('0x25'),_0x2e46c2,_0x437da5[_0xb0e6('0x23')][_0xb0e6('0x26')]);return _0x3844bf(_0x437da5[_0xb0e6('0x23')][_0xb0e6('0x26')]);}logger[_0xb0e6('0x23')](_0xb0e6('0x25'),_0x2e46c2,_0x437da5[_0xb0e6('0x23')][_0xb0e6('0x26')]);return _0x1a51c6(_0x437da5[_0xb0e6('0x23')][_0xb0e6('0x26')]);}else{logger[_0xb0e6('0x20')](_0xb0e6('0x25'),_0x2e46c2,_0xb0e6('0x21'));_0x1a51c6(_0x437da5['result'][_0xb0e6('0x26')]);}})[_0xb0e6('0x27')](function(_0x124fec){logger['error']('ChatQueue,\x20%s,\x20%s',_0x2e46c2,_0x124fec);_0x3844bf(_0x124fec);});});}function respondWithStatusCode(_0x4c4a5c,_0x3ee338){_0x3ee338=_0x3ee338||0xcc;return function(_0x36b051){if(_0x36b051){return _0x4c4a5c[_0xb0e6('0x28')](_0x3ee338);}return _0x4c4a5c[_0xb0e6('0x29')](_0x3ee338)['end']();};}function respondWithResult(_0x3b3359,_0x49ebc6){_0x49ebc6=_0x49ebc6||0xc8;return function(_0x21f4f9){if(_0x21f4f9){return _0x3b3359[_0xb0e6('0x29')](_0x49ebc6)[_0xb0e6('0x2a')](_0x21f4f9);}};}function respondWithFilteredResult(_0x16e59b,_0x48f8ae){return function(_0x28e1e0){if(_0x28e1e0){var _0x2ea417=typeof _0x48f8ae['offset']===_0xb0e6('0x2b')&&typeof _0x48f8ae['limit']==='undefined';var _0x523002=_0x28e1e0[_0xb0e6('0x2c')];var _0x8904b2=_0x2ea417?0x0:_0x48f8ae[_0xb0e6('0x2d')];var _0x2944c2=_0x2ea417?_0x28e1e0[_0xb0e6('0x2c')]:_0x48f8ae['offset']+_0x48f8ae[_0xb0e6('0x2e')];var _0x116942;if(_0x2944c2>=_0x523002){_0x2944c2=_0x523002;_0x116942=0xc8;}else{_0x116942=0xce;}_0x16e59b[_0xb0e6('0x29')](_0x116942);return _0x16e59b[_0xb0e6('0x2f')](_0xb0e6('0x30'),_0x8904b2+'-'+_0x2944c2+'/'+_0x523002)[_0xb0e6('0x2a')](_0x28e1e0);}return null;};}function patchUpdates(_0x3017a9){return function(_0x56509b){try{jsonpatch[_0xb0e6('0x31')](_0x56509b,_0x3017a9,!![]);}catch(_0x5f22db){return BPromise[_0xb0e6('0x32')](_0x5f22db);}return _0x56509b['save']();};}function saveUpdates(_0x2fedc3,_0x58a00d){return function(_0x4dddb5){if(_0x4dddb5){return _0x4dddb5['update'](_0x2fedc3)['then'](function(_0x44367f){return _0x44367f;});}return null;};}function removeEntity(_0x21b40e,_0x3ac299){return function(_0x1a9c7d){if(_0x1a9c7d){return _0x1a9c7d[_0xb0e6('0x33')]()['then'](function(){var _0x55cc97=_0x1a9c7d[_0xb0e6('0x34')]({'plain':!![]});var _0x117dd9=_0xb0e6('0x35');return db[_0xb0e6('0x36')][_0xb0e6('0x33')]({'where':{'type':_0x117dd9,'resourceId':_0x55cc97['id']}})[_0xb0e6('0x37')](function(){return _0x1a9c7d;});})[_0xb0e6('0x37')](function(){_0x21b40e[_0xb0e6('0x29')](0xcc)[_0xb0e6('0x38')]();});}};}function handleEntityNotFound(_0x5f3afc,_0x11406c){return function(_0xcbd101){if(!_0xcbd101){_0x5f3afc[_0xb0e6('0x28')](0x194);}return _0xcbd101;};}function handleError(_0x5d84a2,_0x3d2672){_0x3d2672=_0x3d2672||0x1f4;return function(_0x421676){logger[_0xb0e6('0x23')](_0x421676[_0xb0e6('0x39')]);if(_0x421676['name']){delete _0x421676[_0xb0e6('0x3a')];}_0x5d84a2['status'](_0x3d2672)['send'](_0x421676);};}exports['index']=function(_0x2408aa,_0x1fd1ee){var _0x44417a={},_0x30bd4f={},_0x4e8280={'count':0x0,'rows':[]};var _0x39cd77=_[_0xb0e6('0x3b')](db[_0xb0e6('0x3c')][_0xb0e6('0x3d')],function(_0xc46b9b){return{'name':_0xc46b9b[_0xb0e6('0x3e')],'type':_0xc46b9b[_0xb0e6('0x3f')][_0xb0e6('0x40')]};});_0x30bd4f[_0xb0e6('0x41')]=_['map'](_0x39cd77,'name');_0x30bd4f['query']=_[_0xb0e6('0x42')](_0x2408aa['query']);_0x30bd4f[_0xb0e6('0x43')]=_['intersection'](_0x30bd4f[_0xb0e6('0x41')],_0x30bd4f[_0xb0e6('0x44')]);_0x44417a[_0xb0e6('0x45')]=_['intersection'](_0x30bd4f[_0xb0e6('0x41')],qs[_0xb0e6('0x46')](_0x2408aa[_0xb0e6('0x44')][_0xb0e6('0x46')]));_0x44417a[_0xb0e6('0x45')]=_0x44417a[_0xb0e6('0x45')][_0xb0e6('0x47')]?_0x44417a['attributes']:_0x30bd4f['model'];if(!_0x2408aa[_0xb0e6('0x44')]['hasOwnProperty'](_0xb0e6('0x48'))){_0x44417a[_0xb0e6('0x2e')]=qs[_0xb0e6('0x2e')](_0x2408aa['query'][_0xb0e6('0x2e')]);_0x44417a['offset']=qs[_0xb0e6('0x2d')](_0x2408aa[_0xb0e6('0x44')][_0xb0e6('0x2d')]);}_0x44417a['order']=qs[_0xb0e6('0x49')](_0x2408aa['query'][_0xb0e6('0x49')]);_0x44417a[_0xb0e6('0x4a')]=qs[_0xb0e6('0x43')](_[_0xb0e6('0x4b')](_0x2408aa[_0xb0e6('0x44')],_0x30bd4f['filters']),_0x39cd77);if(_0x2408aa[_0xb0e6('0x44')][_0xb0e6('0x4c')]){_0x44417a[_0xb0e6('0x4a')]=_['merge'](_0x44417a[_0xb0e6('0x4a')],{'$or':_[_0xb0e6('0x3b')](_0x39cd77,function(_0x369662){if(_0x369662[_0xb0e6('0x3f')]!==_0xb0e6('0x4d')){var _0x4cb4ca={};_0x4cb4ca[_0x369662['name']]={'$like':'%'+_0x2408aa[_0xb0e6('0x44')][_0xb0e6('0x4c')]+'%'};return _0x4cb4ca;}})});}_0x44417a=_[_0xb0e6('0x4e')]({},_0x44417a,_0x2408aa[_0xb0e6('0x4f')]);var _0x39ccfd={'where':_0x44417a[_0xb0e6('0x4a')]};return db[_0xb0e6('0x3c')][_0xb0e6('0x2c')](_0x39ccfd)[_0xb0e6('0x37')](function(_0x1d28b3){_0x4e8280[_0xb0e6('0x2c')]=_0x1d28b3;if(_0x2408aa['query'][_0xb0e6('0x50')]){_0x44417a[_0xb0e6('0x51')]=[{'all':!![]}];}return db[_0xb0e6('0x3c')][_0xb0e6('0x52')](_0x44417a);})[_0xb0e6('0x37')](function(_0x39980d){_0x4e8280[_0xb0e6('0x53')]=_0x39980d;return _0x4e8280;})['then'](respondWithFilteredResult(_0x1fd1ee,_0x44417a))[_0xb0e6('0x27')](handleError(_0x1fd1ee,null));};exports[_0xb0e6('0x54')]=function(_0x2a999f,_0x18a42b){var _0xed89ba={'raw':!![],'where':{'id':_0x2a999f[_0xb0e6('0x55')]['id']}},_0x272d65={};_0x272d65[_0xb0e6('0x41')]=_[_0xb0e6('0x42')](db[_0xb0e6('0x3c')]['rawAttributes']);_0x272d65[_0xb0e6('0x44')]=_['keys'](_0x2a999f[_0xb0e6('0x44')]);_0x272d65[_0xb0e6('0x43')]=_[_0xb0e6('0x56')](_0x272d65[_0xb0e6('0x41')],_0x272d65[_0xb0e6('0x44')]);_0xed89ba[_0xb0e6('0x45')]=_[_0xb0e6('0x56')](_0x272d65[_0xb0e6('0x41')],qs[_0xb0e6('0x46')](_0x2a999f[_0xb0e6('0x44')][_0xb0e6('0x46')]));_0xed89ba[_0xb0e6('0x45')]=_0xed89ba[_0xb0e6('0x45')]['length']?_0xed89ba['attributes']:_0x272d65[_0xb0e6('0x41')];if(_0x2a999f[_0xb0e6('0x44')][_0xb0e6('0x50')]){_0xed89ba[_0xb0e6('0x51')]=[{'all':!![]}];}_0xed89ba=_['merge']({},_0xed89ba,_0x2a999f[_0xb0e6('0x4f')]);return db[_0xb0e6('0x3c')][_0xb0e6('0x57')](_0xed89ba)[_0xb0e6('0x37')](handleEntityNotFound(_0x18a42b,null))['then'](respondWithResult(_0x18a42b,null))['catch'](handleError(_0x18a42b,null));};exports[_0xb0e6('0x58')]=function(_0x226021,_0x1397e9){return db[_0xb0e6('0x3c')][_0xb0e6('0x58')](_0x226021[_0xb0e6('0x59')],{})[_0xb0e6('0x37')](function(_0x2d12c1){var _0x2038c7=_0x226021[_0xb0e6('0x5a')]['get']({'plain':!![]});if(!_0x2038c7)throw new Error(_0xb0e6('0x5b'));if(_0x2038c7[_0xb0e6('0x5c')]===_0xb0e6('0x5a')){var _0x8304a2=_0x2d12c1[_0xb0e6('0x34')]({'plain':!![]});var _0x451251=_0xb0e6('0x35');return db[_0xb0e6('0x5d')][_0xb0e6('0x57')]({'where':{'name':_0x451251,'userProfileId':_0x2038c7[_0xb0e6('0x5e')]},'raw':!![]})[_0xb0e6('0x37')](function(_0x331b11){if(_0x331b11&&_0x331b11['autoAssociation']===0x0){return db[_0xb0e6('0x36')]['create']({'name':_0x8304a2[_0xb0e6('0x3a')],'resourceId':_0x8304a2['id'],'type':_0x331b11[_0xb0e6('0x3a')],'sectionId':_0x331b11['id']},{})[_0xb0e6('0x37')](function(){return _0x2d12c1;});}else{return _0x2d12c1;}})[_0xb0e6('0x27')](function(_0x5cafa0){logger[_0xb0e6('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5cafa0);throw _0x5cafa0;});}return _0x2d12c1;})['then'](respondWithResult(_0x1397e9,0xc9))['catch'](handleError(_0x1397e9,null));};exports[_0xb0e6('0x5f')]=function(_0x2292ab,_0x1ff106){if(_0x2292ab['body']['id']){delete _0x2292ab['body']['id'];}return db[_0xb0e6('0x3c')]['find']({'where':{'id':_0x2292ab['params']['id']}})[_0xb0e6('0x37')](handleEntityNotFound(_0x1ff106,null))['then'](saveUpdates(_0x2292ab[_0xb0e6('0x59')],null))[_0xb0e6('0x37')](respondWithResult(_0x1ff106,null))[_0xb0e6('0x27')](handleError(_0x1ff106,null));};exports[_0xb0e6('0x33')]=function(_0x51c7b2,_0x545ddb){return db[_0xb0e6('0x3c')][_0xb0e6('0x57')]({'where':{'id':_0x51c7b2[_0xb0e6('0x55')]['id']}})['then'](handleEntityNotFound(_0x545ddb,null))[_0xb0e6('0x37')](removeEntity(_0x545ddb,null))[_0xb0e6('0x27')](handleError(_0x545ddb,null));};exports[_0xb0e6('0x60')]=function(_0x385411,_0x178499){return db[_0xb0e6('0x3c')]['describe']()['then'](respondWithResult(_0x178499,null))[_0xb0e6('0x27')](handleError(_0x178499,null));};exports['getMembers']=function(_0x41a35c,_0x6d6b04,_0x29ccb0){var _0x4f7ee1={'raw':!![],'where':{}},_0x3b1260={},_0x1168e9;return db['ChatQueue']['findOne']({'where':{'id':_0x41a35c[_0xb0e6('0x55')]['id']}})[_0xb0e6('0x37')](handleEntityNotFound(_0x6d6b04,null))[_0xb0e6('0x37')](function(_0x33462c){if(_0x33462c){_0x1168e9=_0x33462c[_0xb0e6('0x34')]({'plain':!![]});_0x3b1260[_0xb0e6('0x41')]=_[_0xb0e6('0x42')](db['UserChatQueue'][_0xb0e6('0x3d')]);_0x3b1260['query']=_[_0xb0e6('0x42')](_0x41a35c['query']);_0x3b1260[_0xb0e6('0x43')]=_[_0xb0e6('0x56')](_0x3b1260[_0xb0e6('0x41')],_0x3b1260[_0xb0e6('0x44')]);_0x4f7ee1[_0xb0e6('0x45')]=_[_0xb0e6('0x56')](_0x3b1260[_0xb0e6('0x41')],qs['fields'](_0x41a35c[_0xb0e6('0x44')]['fields']));_0x4f7ee1[_0xb0e6('0x45')]=_0x4f7ee1[_0xb0e6('0x45')][_0xb0e6('0x47')]?_0x4f7ee1[_0xb0e6('0x45')]:_0x3b1260['model'];if(!_0x41a35c['query']['hasOwnProperty'](_0xb0e6('0x48'))){_0x4f7ee1[_0xb0e6('0x2e')]=qs[_0xb0e6('0x2e')](_0x41a35c[_0xb0e6('0x44')][_0xb0e6('0x2e')]);_0x4f7ee1[_0xb0e6('0x2d')]=qs['offset'](_0x41a35c[_0xb0e6('0x44')][_0xb0e6('0x2d')]);}_0x4f7ee1[_0xb0e6('0x61')]=qs[_0xb0e6('0x49')](_0x41a35c[_0xb0e6('0x44')]['sort']);_0x4f7ee1[_0xb0e6('0x4a')]=qs['filters'](_['pick'](_0x41a35c['query'],_0x3b1260[_0xb0e6('0x43')]));_0x4f7ee1['where'][_0xb0e6('0x62')]=_0x33462c['id'];if(_0x41a35c[_0xb0e6('0x44')][_0xb0e6('0x4c')]){_0x4f7ee1['where']=_[_0xb0e6('0x4e')](_0x4f7ee1[_0xb0e6('0x4a')],{'$or':_[_0xb0e6('0x3b')](_0x4f7ee1[_0xb0e6('0x45')],function(_0xbbcb23){var _0x51177d={};_0x51177d[_0xbbcb23]={'$like':'%'+_0x41a35c[_0xb0e6('0x44')][_0xb0e6('0x4c')]+'%'};return _0x51177d;})});}_0x4f7ee1=_[_0xb0e6('0x4e')]({},_0x4f7ee1,_0x41a35c['options']);return db[_0xb0e6('0x63')][_0xb0e6('0x52')](_0x4f7ee1);}})[_0xb0e6('0x37')](function(_0x11e5e3){if(_0x11e5e3){return db[_0xb0e6('0x64')]['findAndCountAll']({'where':{'id':_[_0xb0e6('0x3b')](_0x11e5e3,_0xb0e6('0x65')),'role':_0xb0e6('0x66')},'attributes':['id',_0xb0e6('0x3a'),_0xb0e6('0x67'),'updatedAt',_0xb0e6('0x68')]});}})['then'](function(_0x3b010b){if(_0x3b010b){return{'count':_0x3b010b[_0xb0e6('0x2c')],'rows':_[_0xb0e6('0x3b')](_0x3b010b[_0xb0e6('0x53')],function(_0x57ecd8){return{'membername':_0x57ecd8[_0xb0e6('0x3a')],'UserId':_0x57ecd8['id'],'queue_name':_0x1168e9[_0xb0e6('0x3a')],'ChatQueueId':_0x1168e9['id'],'interface':util[_0xb0e6('0x69')]('%s/%s',_0xb0e6('0x6a'),_0x57ecd8['name']),'penalty':0x0,'paused':_0x57ecd8[_0xb0e6('0x67')],'createdAt':_0x57ecd8[_0xb0e6('0x68')],'updatedAt':_0x57ecd8[_0xb0e6('0x6b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb0e6('0x37')](respondWithFilteredResult(_0x6d6b04,_0x4f7ee1))[_0xb0e6('0x27')](handleError(_0x6d6b04,null));};exports[_0xb0e6('0x6c')]=function(_0x58f1ff,_0x2ada44,_0x43bc91){var _0x442a04={};var _0x17ce0d={};var _0xfc3ac4;var _0x149d6c;return db[_0xb0e6('0x3c')][_0xb0e6('0x6d')]({'where':{'id':_0x58f1ff['params']['id']}})[_0xb0e6('0x37')](handleEntityNotFound(_0x2ada44,null))[_0xb0e6('0x37')](function(_0x246acd){if(_0x246acd){_0xfc3ac4=_0x246acd;_0x17ce0d[_0xb0e6('0x41')]=_[_0xb0e6('0x42')](db[_0xb0e6('0x6e')][_0xb0e6('0x3d')]);_0x17ce0d[_0xb0e6('0x44')]=_[_0xb0e6('0x42')](_0x58f1ff['query']);_0x17ce0d[_0xb0e6('0x43')]=_[_0xb0e6('0x56')](_0x17ce0d[_0xb0e6('0x41')],_0x17ce0d[_0xb0e6('0x44')]);_0x442a04['attributes']=_[_0xb0e6('0x56')](_0x17ce0d[_0xb0e6('0x41')],qs[_0xb0e6('0x46')](_0x58f1ff['query'][_0xb0e6('0x46')]));_0x442a04[_0xb0e6('0x45')]=_0x442a04[_0xb0e6('0x45')][_0xb0e6('0x47')]?_0x442a04[_0xb0e6('0x45')]:_0x17ce0d['model'];_0x442a04[_0xb0e6('0x61')]=qs[_0xb0e6('0x49')](_0x58f1ff[_0xb0e6('0x44')][_0xb0e6('0x49')]);_0x442a04[_0xb0e6('0x4a')]=qs[_0xb0e6('0x43')](_[_0xb0e6('0x4b')](_0x58f1ff[_0xb0e6('0x44')],_0x17ce0d[_0xb0e6('0x43')]));if(_0x58f1ff[_0xb0e6('0x44')][_0xb0e6('0x4c')]){_0x442a04[_0xb0e6('0x4a')]=_[_0xb0e6('0x4e')](_0x442a04[_0xb0e6('0x4a')],{'$or':_[_0xb0e6('0x3b')](_0x442a04['attributes'],function(_0x52588a){var _0x44ecc7={};_0x44ecc7[_0x52588a]={'$like':'%'+_0x58f1ff[_0xb0e6('0x44')][_0xb0e6('0x4c')]+'%'};return _0x44ecc7;})});}_0x442a04=_[_0xb0e6('0x4e')]({},_0x442a04,_0x58f1ff['options']);return _0xfc3ac4[_0xb0e6('0x6c')](_0x442a04);}})[_0xb0e6('0x37')](function(_0x530385){if(_0x530385){_0x149d6c=_0x530385['length'];if(!_0x58f1ff['query'][_0xb0e6('0x6f')](_0xb0e6('0x48'))){_0x442a04[_0xb0e6('0x2e')]=qs[_0xb0e6('0x2e')](_0x58f1ff['query'][_0xb0e6('0x2e')]);_0x442a04[_0xb0e6('0x2d')]=qs['offset'](_0x58f1ff[_0xb0e6('0x44')][_0xb0e6('0x2d')]);}return _0xfc3ac4[_0xb0e6('0x6c')](_0x442a04);}})[_0xb0e6('0x37')](function(_0x287658){if(_0x287658){return _0x287658?{'count':_0x149d6c,'rows':_0x287658}:null;}})[_0xb0e6('0x37')](respondWithResult(_0x2ada44,null))[_0xb0e6('0x27')](handleError(_0x2ada44,null));};exports[_0xb0e6('0x70')]=function(_0x4e1d3f,_0x245911,_0x219312){var _0x4f4a80=_0x4e1d3f[_0xb0e6('0x59')][_0xb0e6('0x71')];return db[_0xb0e6('0x6e')]['findAll']({'where':{'id':_0x4f4a80},'attributes':['id'],'include':[{'model':db[_0xb0e6('0x64')],'as':_0xb0e6('0x72'),'attributes':['id','name',_0xb0e6('0x73'),'voicePause',_0xb0e6('0x74')],'raw':!![]}]})[_0xb0e6('0x37')](function(_0x2baf3e){if(_0x2baf3e){var _0x48c943=_['flatMap'](_0x2baf3e,function(_0x2a7130){var _0x2f6281=_0x2a7130['get']({'plain':!![]});return _0x2f6281['Agents'];});return db[_0xb0e6('0x3c')]['find']({'where':{'id':_0x4e1d3f[_0xb0e6('0x55')]['id']}})[_0xb0e6('0x37')](function(_0x36af5d){return db['sequelize'][_0xb0e6('0x75')](function(_0x3c326f){return _0x36af5d[_0xb0e6('0x70')](_0x4f4a80,{'transaction':_0x3c326f})[_0xb0e6('0x37')](function(){return BPromise['each'](_0x48c943,function(_0x40452a){return db[_0xb0e6('0x63')][_0xb0e6('0x76')]({'where':{'UserId':_0x40452a['id'],'ChatQueueId':_0x4e1d3f[_0xb0e6('0x55')]['id']},'transaction':_0x3c326f});});})[_0xb0e6('0x37')](function(){_0x48c943[_0xb0e6('0x77')](function(_0x4f3b63){socket['emit'](_0xb0e6('0x78'),{'UserId':_0x4f3b63['id'],'ChatQueueId':_0x36af5d['id']});});});});});}})[_0xb0e6('0x37')](respondWithStatusCode(_0x245911,null))[_0xb0e6('0x27')](handleError(_0x245911,null));};exports[_0xb0e6('0x79')]=function(_0x56fb7e,_0x8ba401,_0x2e0474){return db[_0xb0e6('0x6e')][_0xb0e6('0x52')]({'where':{'id':_0x56fb7e[_0xb0e6('0x44')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb0e6('0x64')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb0e6('0x37')](handleEntityNotFound(_0x8ba401,null))[_0xb0e6('0x37')](function(_0x3ab808){var _0x59a156=_[_0xb0e6('0x3b')](_0x3ab808,'id');var _0x58ca1a=[];var _0x3f390e=[];var _0xc73c55=squel[_0xb0e6('0x7a')]();_0xc73c55[_0xb0e6('0x7b')](_0xb0e6('0x7c'))[_0xb0e6('0x7d')](_0xb0e6('0x7e'),'tq')[_0xb0e6('0x7f')](_0xb0e6('0x80'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xb0e6('0x4a')]('ChatQueueId\x20=\x20?',_0x56fb7e[_0xb0e6('0x55')]['id']);for(var _0x500622=0x0;_0x500622<_0x3ab808[_0xb0e6('0x47')];_0x500622+=0x1){let _0x215bd0=_0x3ab808[_0x500622];for(var _0x19b842=0x0;_0x19b842<_0x215bd0[_0xb0e6('0x72')][_0xb0e6('0x47')];_0x19b842+=0x1){let _0x5f5c41=_0x215bd0['Agents'][_0x19b842];var _0x4f2bcf=_0xc73c55[_0xb0e6('0x81')]();_0x4f2bcf[_0xb0e6('0x4a')]('ut.UserId\x20=\x20?',_0x5f5c41['id']);_0x3f390e['push'](db['sequelize'][_0xb0e6('0x44')](_0x4f2bcf[_0xb0e6('0x82')](),{'type':db[_0xb0e6('0x83')][_0xb0e6('0x84')]['SELECT']})[_0xb0e6('0x37')](function(_0xa31122){if(_0xa31122[_0xb0e6('0x47')]===0x1){return _0x5f5c41['id'];}else{var _0x2aef33=_['every'](_[_0xb0e6('0x3b')](_0xa31122,_0xb0e6('0x85')),function(_0x20d0b7){return _[_0xb0e6('0x86')](_0x59a156,_0x20d0b7);});if(_0x2aef33){return _0x5f5c41['id'];}}}));}}return BPromise['all'](_0x3f390e)[_0xb0e6('0x37')](function(_0x349ccf){_0x58ca1a=_(_0x58ca1a)[_0xb0e6('0x87')](_0x349ccf)[_0xb0e6('0x88')]()[_0xb0e6('0x89')]();return db[_0xb0e6('0x3c')][_0xb0e6('0x57')]({'where':{'id':_0x56fb7e[_0xb0e6('0x55')]['id']}})[_0xb0e6('0x37')](function(_0x57a761){return db[_0xb0e6('0x83')][_0xb0e6('0x75')](function(_0x5779dd){return _0x57a761['removeTeams'](_0x56fb7e[_0xb0e6('0x44')][_0xb0e6('0x71')],{'transaction':_0x5779dd})[_0xb0e6('0x37')](function(){if(!_[_0xb0e6('0x8a')](_0x58ca1a)){return _0x57a761[_0xb0e6('0x8b')](_0x58ca1a,{'transaction':_0x5779dd});}})[_0xb0e6('0x37')](function(){_0x58ca1a[_0xb0e6('0x77')](function(_0x268151){socket[_0xb0e6('0x8c')](_0xb0e6('0x8d'),{'UserId':_0x268151,'ChatQueueId':_0x57a761['id']});});});});});});})['then'](respondWithStatusCode(_0x8ba401,null))['catch'](handleError(_0x8ba401,null));};exports['addAgents']=function(_0x28859a,_0x3cfafd,_0x15bbed){return db[_0xb0e6('0x3c')][_0xb0e6('0x57')]({'where':{'id':_0x28859a[_0xb0e6('0x55')]['id']}})[_0xb0e6('0x37')](handleEntityNotFound(_0x3cfafd,null))[_0xb0e6('0x37')](function(_0x3f60c2){if(_0x3f60c2){return _0x3f60c2['addAgents'](_0x28859a['body']['ids'],_['omit'](_0x28859a[_0xb0e6('0x59')],[_0xb0e6('0x71'),'id'])||{})['spread'](function(_0x1bfe30){for(var _0x592580=0x0;_0x592580<_0x28859a[_0xb0e6('0x59')][_0xb0e6('0x71')][_0xb0e6('0x47')];_0x592580+=0x1){socket[_0xb0e6('0x8c')](_0xb0e6('0x78'),{'UserId':Number(_0x28859a['body'][_0xb0e6('0x71')][_0x592580]),'ChatQueueId':Number(_0x28859a[_0xb0e6('0x55')]['id'])});}return _0x1bfe30;});}})[_0xb0e6('0x37')](respondWithResult(_0x3cfafd,null))[_0xb0e6('0x27')](handleError(_0x3cfafd,null));};exports[_0xb0e6('0x8b')]=function(_0x9a9cd5,_0x38d852,_0x2ff060){return db[_0xb0e6('0x3c')][_0xb0e6('0x57')]({'where':{'id':_0x9a9cd5[_0xb0e6('0x55')]['id']}})['then'](handleEntityNotFound(_0x38d852,null))[_0xb0e6('0x37')](function(_0x5c683c){if(_0x5c683c){return _0x5c683c[_0xb0e6('0x8b')](_0x9a9cd5[_0xb0e6('0x44')]['ids'])[_0xb0e6('0x37')](function(){if(_[_0xb0e6('0x8e')](_0x9a9cd5['query'][_0xb0e6('0x71')])){for(var _0x5d6df9=0x0;_0x5d6df9<_0x9a9cd5[_0xb0e6('0x44')][_0xb0e6('0x71')]['length'];_0x5d6df9+=0x1){socket[_0xb0e6('0x8c')](_0xb0e6('0x8d'),{'UserId':Number(_0x9a9cd5[_0xb0e6('0x44')][_0xb0e6('0x71')][_0x5d6df9]),'ChatQueueId':Number(_0x9a9cd5['params']['id'])});}}else{socket[_0xb0e6('0x8c')](_0xb0e6('0x8d'),{'UserId':Number(_0x9a9cd5[_0xb0e6('0x44')][_0xb0e6('0x71')]),'ChatQueueId':Number(_0x9a9cd5[_0xb0e6('0x55')]['id'])});}});}})[_0xb0e6('0x37')](respondWithStatusCode(_0x38d852,null))[_0xb0e6('0x27')](handleError(_0x38d852,null));};exports[_0xb0e6('0x8f')]=function(_0xed7078,_0x55c2b5,_0x1c8126){var _0x4e6c19={};var _0x5984ff={};var _0x443ce7;var _0x463185;return db[_0xb0e6('0x3c')][_0xb0e6('0x6d')]({'where':{'id':_0xed7078[_0xb0e6('0x55')]['id']}})[_0xb0e6('0x37')](handleEntityNotFound(_0x55c2b5,null))[_0xb0e6('0x37')](function(_0x1dee9e){if(_0x1dee9e){_0x443ce7=_0x1dee9e;_0x5984ff['model']=_[_0xb0e6('0x42')](db[_0xb0e6('0x64')]['rawAttributes']);_0x5984ff['query']=_['keys'](_0xed7078[_0xb0e6('0x44')]);_0x5984ff[_0xb0e6('0x43')]=_[_0xb0e6('0x56')](_0x5984ff['model'],_0x5984ff[_0xb0e6('0x44')]);_0x4e6c19['attributes']=_[_0xb0e6('0x56')](_0x5984ff['model'],qs[_0xb0e6('0x46')](_0xed7078[_0xb0e6('0x44')]['fields']));_0x4e6c19[_0xb0e6('0x45')]=_0x4e6c19[_0xb0e6('0x45')]['length']?_0x4e6c19[_0xb0e6('0x45')]:_0x5984ff[_0xb0e6('0x41')];_0x4e6c19['order']=qs[_0xb0e6('0x49')](_0xed7078[_0xb0e6('0x44')][_0xb0e6('0x49')]);_0x4e6c19[_0xb0e6('0x4a')]=qs[_0xb0e6('0x43')](_[_0xb0e6('0x4b')](_0xed7078[_0xb0e6('0x44')],_0x5984ff[_0xb0e6('0x43')]));if(_0xed7078[_0xb0e6('0x44')][_0xb0e6('0x4c')]){_0x4e6c19[_0xb0e6('0x4a')]=_[_0xb0e6('0x4e')](_0x4e6c19[_0xb0e6('0x4a')],{'$or':_[_0xb0e6('0x3b')](_0x4e6c19[_0xb0e6('0x45')],function(_0x239e7c){var _0x2fa624={};_0x2fa624[_0x239e7c]={'$like':'%'+_0xed7078[_0xb0e6('0x44')][_0xb0e6('0x4c')]+'%'};return _0x2fa624;})});}_0x4e6c19=_[_0xb0e6('0x4e')]({},_0x4e6c19,_0xed7078[_0xb0e6('0x4f')]);return _0x443ce7['getAgents'](_0x4e6c19);}})[_0xb0e6('0x37')](function(_0x4903d3){if(_0x4903d3){_0x463185=_0x4903d3[_0xb0e6('0x47')];if(!_0xed7078[_0xb0e6('0x44')][_0xb0e6('0x6f')]('nolimit')){_0x4e6c19[_0xb0e6('0x2e')]=qs['limit'](_0xed7078['query'][_0xb0e6('0x2e')]);_0x4e6c19[_0xb0e6('0x2d')]=qs[_0xb0e6('0x2d')](_0xed7078['query'][_0xb0e6('0x2d')]);}return _0x443ce7['getAgents'](_0x4e6c19);}})[_0xb0e6('0x37')](function(_0x1cb55f){if(_0x1cb55f){return _0x1cb55f?{'count':_0x463185,'rows':_0x1cb55f}:null;}})[_0xb0e6('0x37')](respondWithResult(_0x55c2b5,null))['catch'](handleError(_0x55c2b5,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index dae7a21..1a10ae2 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 _0x0531=['save','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3e18c9,_0x395158){var _0x254bb5=function(_0x2dd9ab){while(--_0x2dd9ab){_0x3e18c9['push'](_0x3e18c9['shift']());}};_0x254bb5(++_0x395158);}(_0x0531,0xde));var _0x1053=function(_0x3afe18,_0x26922c){_0x3afe18=_0x3afe18-0x0;var _0x19ed1f=_0x0531[_0x3afe18];return _0x19ed1f;};'use strict';var EventEmitter=require(_0x1053('0x0'));var ChatQueue=require(_0x1053('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1053('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1c256c){return function(_0x117b5a,_0x12d7ea,_0x480ee9){ChatQueueEvents[_0x1053('0x3')](_0x1c256c+':'+_0x117b5a['id'],_0x117b5a);ChatQueueEvents[_0x1053('0x3')](_0x1c256c,_0x117b5a);_0x480ee9(null);};}for(var e in events){if(events[_0x1053('0x4')](e)){var event=events[e];ChatQueue[_0x1053('0x5')](e,emitEvent(event));}}module[_0x1053('0x6')]=ChatQueueEvents; \ No newline at end of file +var _0x203a=['emit','hasOwnProperty','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x1df814,_0x23c5a3){var _0x1c024a=function(_0x33903d){while(--_0x33903d){_0x1df814['push'](_0x1df814['shift']());}};_0x1c024a(++_0x23c5a3);}(_0x203a,0x136));var _0xa203=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x203a[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0xa203('0x0'))['db'][_0xa203('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xa203('0x2')](0x0);var events={'afterCreate':_0xa203('0x3'),'afterUpdate':_0xa203('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5bdf43){return function(_0x4541c8,_0xba923f,_0x2ed294){ChatQueueEvents[_0xa203('0x5')](_0x5bdf43+':'+_0x4541c8['id'],_0x4541c8);ChatQueueEvents[_0xa203('0x5')](_0x5bdf43,_0x4541c8);_0x2ed294(null);};}for(var e in events){if(events[_0xa203('0x6')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index aad0080..00a9124 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 _0xab4b=['chat_queues','util','api','moment','bluebird','rimraf','define','ChatQueue'];(function(_0x404c96,_0x16d4d6){var _0xaf8051=function(_0x4652d7){while(--_0x4652d7){_0x404c96['push'](_0x404c96['shift']());}};_0xaf8051(++_0x16d4d6);}(_0xab4b,0x189));var _0xbab4=function(_0x4c941f,_0x13e01d){_0x4c941f=_0x4c941f-0x0;var _0x59f360=_0xab4b[_0x4c941f];return _0x59f360;};'use strict';var _=require('lodash');var util=require(_0xbab4('0x0'));var logger=require('../../config/logger')(_0xbab4('0x1'));var moment=require(_0xbab4('0x2'));var BPromise=require(_0xbab4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbab4('0x4'));var config=require('../../config/environment');var attributes=require('./chatQueue.attributes');module['exports']=function(_0x130195,_0x41ee7e){return _0x130195[_0xbab4('0x5')](_0xbab4('0x6'),attributes,{'tableName':_0xbab4('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb86=['api','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','lodash','util','../../config/logger'];(function(_0x8b4d03,_0x309b11){var _0x23fb53=function(_0x20fde6){while(--_0x20fde6){_0x8b4d03['push'](_0x8b4d03['shift']());}};_0x23fb53(++_0x309b11);}(_0xfb86,0x1aa));var _0x6fb8=function(_0x16f77c,_0x5256b1){_0x16f77c=_0x16f77c-0x0;var _0x78986e=_0xfb86[_0x16f77c];return _0x78986e;};'use strict';var _=require(_0x6fb8('0x0'));var util=require(_0x6fb8('0x1'));var logger=require(_0x6fb8('0x2'))(_0x6fb8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6fb8('0x4'));var rimraf=require(_0x6fb8('0x5'));var config=require(_0x6fb8('0x6'));var attributes=require(_0x6fb8('0x7'));module[_0x6fb8('0x8')]=function(_0x2bf60e,_0x5605ef){return _0x2bf60e[_0x6fb8('0x9')](_0x6fb8('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 d183f77..9daf840 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 _0x2d07=['http','redis','defaults','socket.io-emitter','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetChatQueue','findAll','options','raw','where','attributes','include','map','model','then','ShowChatQueue','ChatQueue','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x2d07,0x13a));var _0x72d0=function(_0x4d3a2b,_0x32a224){_0x4d3a2b=_0x4d3a2b-0x0;var _0xdd32c8=_0x2d07[_0x4d3a2b];return _0xdd32c8;};'use strict';var _=require(_0x72d0('0x0'));var util=require(_0x72d0('0x1'));var moment=require('moment');var BPromise=require(_0x72d0('0x2'));var rs=require(_0x72d0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d0('0x4'))['db'];var utils=require(_0x72d0('0x5'));var logger=require(_0x72d0('0x6'))(_0x72d0('0x7'));var config=require(_0x72d0('0x8'));var jayson=require(_0x72d0('0x9'));var client=jayson['client'][_0x72d0('0xa')]({'port':0x232a});config[_0x72d0('0xb')]=_[_0x72d0('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x72d0('0xd'))(new Redis(config['redis']));require('./chatQueue.socket')['register'](socket);function respondWithRpcPromise(_0xb6293,_0x4116c1,_0x1d8102){return new BPromise(function(_0x36c904,_0x4b545f){return client['request'](_0xb6293,_0x1d8102)['then'](function(_0x17f795){logger[_0x72d0('0xe')](_0x72d0('0xf'),_0x4116c1,_0x72d0('0x10'));logger[_0x72d0('0x11')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x4116c1,_0x72d0('0x10'),JSON[_0x72d0('0x12')](_0x17f795));if(_0x17f795[_0x72d0('0x13')]){if(_0x17f795['error'][_0x72d0('0x14')]===0x1f4){logger[_0x72d0('0x13')](_0x72d0('0xf'),_0x4116c1,_0x17f795[_0x72d0('0x13')][_0x72d0('0x15')]);return _0x4b545f(_0x17f795[_0x72d0('0x13')]['message']);}logger[_0x72d0('0x13')](_0x72d0('0xf'),_0x4116c1,_0x17f795[_0x72d0('0x13')][_0x72d0('0x15')]);return _0x36c904(_0x17f795[_0x72d0('0x13')][_0x72d0('0x15')]);}else{logger[_0x72d0('0xe')](_0x72d0('0xf'),_0x4116c1,_0x72d0('0x10'));_0x36c904(_0x17f795['result'][_0x72d0('0x15')]);}})[_0x72d0('0x16')](function(_0x2cd4aa){logger[_0x72d0('0x13')](_0x72d0('0xf'),_0x4116c1,_0x2cd4aa);_0x4b545f(_0x2cd4aa);});});}exports[_0x72d0('0x17')]=function(_0x59d3d9){var _0x4d65f3=this;return new Promise(function(_0x5c905a,_0x4cbdf1){return db['ChatQueue'][_0x72d0('0x18')]({'raw':_0x59d3d9[_0x72d0('0x19')]?_0x59d3d9['options'][_0x72d0('0x1a')]===undefined?!![]:![]:!![],'where':_0x59d3d9[_0x72d0('0x19')]?_0x59d3d9['options'][_0x72d0('0x1b')]||null:null,'attributes':_0x59d3d9[_0x72d0('0x19')]?_0x59d3d9['options'][_0x72d0('0x1c')]||null:null,'limit':_0x59d3d9[_0x72d0('0x19')]?_0x59d3d9[_0x72d0('0x19')]['limit']||null:null,'include':_0x59d3d9[_0x72d0('0x19')]?_0x59d3d9[_0x72d0('0x19')][_0x72d0('0x1d')]?_[_0x72d0('0x1e')](_0x59d3d9['options'][_0x72d0('0x1d')],function(_0x136d5e){return{'model':db[_0x136d5e[_0x72d0('0x1f')]],'as':_0x136d5e['as'],'attributes':_0x136d5e[_0x72d0('0x1c')],'include':_0x136d5e[_0x72d0('0x1d')]?_[_0x72d0('0x1e')](_0x136d5e[_0x72d0('0x1d')],function(_0x4e6093){return{'model':db[_0x4e6093[_0x72d0('0x1f')]],'as':_0x4e6093['as'],'attributes':_0x4e6093['attributes'],'include':_0x4e6093[_0x72d0('0x1d')]?_[_0x72d0('0x1e')](_0x4e6093[_0x72d0('0x1d')],function(_0x2191db){return{'model':db[_0x2191db[_0x72d0('0x1f')]],'as':_0x2191db['as'],'attributes':_0x2191db['attributes']};}):[]};}):[]};}):[]:[]})[_0x72d0('0x20')](function(_0x174cd0){logger['info'](_0x72d0('0x17'),_0x59d3d9);logger[_0x72d0('0x11')](_0x72d0('0x17'),_0x59d3d9,JSON['stringify'](_0x174cd0));_0x5c905a(_0x174cd0);})[_0x72d0('0x16')](function(_0x1d16fa){logger['error'](_0x72d0('0x17'),_0x1d16fa['message'],_0x59d3d9);_0x4cbdf1(_0x4d65f3[_0x72d0('0x13')](0x1f4,_0x1d16fa[_0x72d0('0x15')]));});});};exports[_0x72d0('0x21')]=function(_0x1759fa){var _0x2e596f=this;return new Promise(function(_0x293a3e,_0x3b4459){return db[_0x72d0('0x22')][_0x72d0('0x23')]({'raw':_0x1759fa[_0x72d0('0x19')]?_0x1759fa[_0x72d0('0x19')][_0x72d0('0x1a')]===undefined?!![]:![]:!![],'where':_0x1759fa['options']?_0x1759fa[_0x72d0('0x19')][_0x72d0('0x1b')]||null:null,'attributes':_0x1759fa[_0x72d0('0x19')]?_0x1759fa[_0x72d0('0x19')][_0x72d0('0x1c')]||null:null,'include':_0x1759fa[_0x72d0('0x19')]?_0x1759fa[_0x72d0('0x19')][_0x72d0('0x1d')]?_['map'](_0x1759fa[_0x72d0('0x19')][_0x72d0('0x1d')],function(_0x509aab){return{'model':db[_0x509aab['model']],'as':_0x509aab['as'],'attributes':_0x509aab[_0x72d0('0x1c')],'include':_0x509aab[_0x72d0('0x1d')]?_[_0x72d0('0x1e')](_0x509aab[_0x72d0('0x1d')],function(_0x1ffd9a){return{'model':db[_0x1ffd9a[_0x72d0('0x1f')]],'as':_0x1ffd9a['as'],'attributes':_0x1ffd9a[_0x72d0('0x1c')],'include':_0x1ffd9a[_0x72d0('0x1d')]?_[_0x72d0('0x1e')](_0x1ffd9a[_0x72d0('0x1d')],function(_0x14ddf2){return{'model':db[_0x14ddf2[_0x72d0('0x1f')]],'as':_0x14ddf2['as'],'attributes':_0x14ddf2[_0x72d0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x72d0('0x20')](function(_0x4ae4fd){logger['info'](_0x72d0('0x21'),_0x1759fa);logger[_0x72d0('0x11')]('ShowChatQueue',_0x1759fa,JSON[_0x72d0('0x12')](_0x4ae4fd));_0x293a3e(_0x4ae4fd);})[_0x72d0('0x16')](function(_0x519e8a){logger[_0x72d0('0x13')](_0x72d0('0x21'),_0x519e8a[_0x72d0('0x15')],_0x1759fa);_0x3b4459(_0x2e596f['error'](0x1f4,_0x519e8a[_0x72d0('0x15')]));});});}; \ No newline at end of file +var _0x5323=['ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','info','result','ChatQueue','findAll','options','raw','where','attributes','limit','include','model','map','GetChatQueue','catch','ShowChatQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','socket.io-emitter','register','request\x20sent','debug'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x5323,0x88));var _0x3532=function(_0x2bd622,_0x3ced57){_0x2bd622=_0x2bd622-0x0;var _0x4c4cb4=_0x5323[_0x2bd622];return _0x4c4cb4;};'use strict';var _=require(_0x3532('0x0'));var util=require(_0x3532('0x1'));var moment=require(_0x3532('0x2'));var BPromise=require(_0x3532('0x3'));var rs=require(_0x3532('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3532('0x5'))['db'];var utils=require(_0x3532('0x6'));var logger=require(_0x3532('0x7'))('rpc');var config=require(_0x3532('0x8'));var jayson=require(_0x3532('0x9'));var client=jayson[_0x3532('0xa')]['http']({'port':0x232a});config[_0x3532('0xb')]=_['defaults'](config[_0x3532('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3532('0xc'))(new Redis(config[_0x3532('0xb')]));require('./chatQueue.socket')[_0x3532('0xd')](socket);function respondWithRpcPromise(_0x256950,_0x1f2444,_0x3d840a){return new BPromise(function(_0x56bebc,_0x502a7e){return client['request'](_0x256950,_0x3d840a)['then'](function(_0x127a0b){logger['info']('ChatQueue,\x20%s,\x20%s',_0x1f2444,_0x3532('0xe'));logger[_0x3532('0xf')](_0x3532('0x10'),_0x1f2444,'request\x20sent',JSON[_0x3532('0x11')](_0x127a0b));if(_0x127a0b[_0x3532('0x12')]){if(_0x127a0b['error'][_0x3532('0x13')]===0x1f4){logger[_0x3532('0x12')](_0x3532('0x14'),_0x1f2444,_0x127a0b[_0x3532('0x12')]['message']);return _0x502a7e(_0x127a0b[_0x3532('0x12')]['message']);}logger['error'](_0x3532('0x14'),_0x1f2444,_0x127a0b[_0x3532('0x12')]['message']);return _0x56bebc(_0x127a0b[_0x3532('0x12')][_0x3532('0x15')]);}else{logger[_0x3532('0x16')](_0x3532('0x14'),_0x1f2444,_0x3532('0xe'));_0x56bebc(_0x127a0b[_0x3532('0x17')][_0x3532('0x15')]);}})['catch'](function(_0x325a5b){logger[_0x3532('0x12')](_0x3532('0x14'),_0x1f2444,_0x325a5b);_0x502a7e(_0x325a5b);});});}exports['GetChatQueue']=function(_0x11f070){var _0x4139b7=this;return new Promise(function(_0x45bc6d,_0x250590){return db[_0x3532('0x18')][_0x3532('0x19')]({'raw':_0x11f070[_0x3532('0x1a')]?_0x11f070[_0x3532('0x1a')][_0x3532('0x1b')]===undefined?!![]:![]:!![],'where':_0x11f070[_0x3532('0x1a')]?_0x11f070[_0x3532('0x1a')][_0x3532('0x1c')]||null:null,'attributes':_0x11f070['options']?_0x11f070[_0x3532('0x1a')][_0x3532('0x1d')]||null:null,'limit':_0x11f070['options']?_0x11f070[_0x3532('0x1a')][_0x3532('0x1e')]||null:null,'include':_0x11f070[_0x3532('0x1a')]?_0x11f070[_0x3532('0x1a')][_0x3532('0x1f')]?_['map'](_0x11f070[_0x3532('0x1a')][_0x3532('0x1f')],function(_0x1ed50b){return{'model':db[_0x1ed50b[_0x3532('0x20')]],'as':_0x1ed50b['as'],'attributes':_0x1ed50b[_0x3532('0x1d')],'include':_0x1ed50b['include']?_[_0x3532('0x21')](_0x1ed50b[_0x3532('0x1f')],function(_0x486e90){return{'model':db[_0x486e90[_0x3532('0x20')]],'as':_0x486e90['as'],'attributes':_0x486e90[_0x3532('0x1d')],'include':_0x486e90[_0x3532('0x1f')]?_[_0x3532('0x21')](_0x486e90['include'],function(_0x59b39a){return{'model':db[_0x59b39a[_0x3532('0x20')]],'as':_0x59b39a['as'],'attributes':_0x59b39a[_0x3532('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4058b8){logger['info'](_0x3532('0x22'),_0x11f070);logger['debug'](_0x3532('0x22'),_0x11f070,JSON['stringify'](_0x4058b8));_0x45bc6d(_0x4058b8);})[_0x3532('0x23')](function(_0x574b20){logger[_0x3532('0x12')](_0x3532('0x22'),_0x574b20[_0x3532('0x15')],_0x11f070);_0x250590(_0x4139b7[_0x3532('0x12')](0x1f4,_0x574b20['message']));});});};exports[_0x3532('0x24')]=function(_0xaafb12){var _0x5f28d9=this;return new Promise(function(_0x28e145,_0x57baca){return db[_0x3532('0x18')][_0x3532('0x25')]({'raw':_0xaafb12['options']?_0xaafb12[_0x3532('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xaafb12[_0x3532('0x1a')]?_0xaafb12[_0x3532('0x1a')][_0x3532('0x1c')]||null:null,'attributes':_0xaafb12[_0x3532('0x1a')]?_0xaafb12[_0x3532('0x1a')]['attributes']||null:null,'include':_0xaafb12['options']?_0xaafb12[_0x3532('0x1a')][_0x3532('0x1f')]?_[_0x3532('0x21')](_0xaafb12[_0x3532('0x1a')]['include'],function(_0x26d267){return{'model':db[_0x26d267[_0x3532('0x20')]],'as':_0x26d267['as'],'attributes':_0x26d267['attributes'],'include':_0x26d267['include']?_['map'](_0x26d267['include'],function(_0x159b05){return{'model':db[_0x159b05['model']],'as':_0x159b05['as'],'attributes':_0x159b05[_0x3532('0x1d')],'include':_0x159b05['include']?_['map'](_0x159b05[_0x3532('0x1f')],function(_0x99eca0){return{'model':db[_0x99eca0[_0x3532('0x20')]],'as':_0x99eca0['as'],'attributes':_0x99eca0[_0x3532('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27f3cf){logger[_0x3532('0x16')](_0x3532('0x24'),_0xaafb12);logger[_0x3532('0xf')](_0x3532('0x24'),_0xaafb12,JSON[_0x3532('0x11')](_0x27f3cf));_0x28e145(_0x27f3cf);})['catch'](function(_0x4a7e4c){logger[_0x3532('0x12')](_0x3532('0x24'),_0x4a7e4c[_0x3532('0x15')],_0xaafb12);_0x57baca(_0x5f28d9['error'](0x1f4,_0x4a7e4c['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index eebd220..27d3804 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 _0x6aa7=['update','emit','length','chatQueue:','./chatQueue.events','remove'];(function(_0x413727,_0x17adb1){var _0x5f46d7=function(_0xbb668e){while(--_0xbb668e){_0x413727['push'](_0x413727['shift']());}};_0x5f46d7(++_0x17adb1);}(_0x6aa7,0x178));var _0x76aa=function(_0x2ddfbc,_0x3df0d2){_0x2ddfbc=_0x2ddfbc-0x0;var _0x184214=_0x6aa7[_0x2ddfbc];return _0x184214;};'use strict';var ChatQueueEvents=require(_0x76aa('0x0'));var events=['save',_0x76aa('0x1'),_0x76aa('0x2')];function createListener(_0x25c818,_0x2db4fe){return function(_0x4f007e){_0x2db4fe[_0x76aa('0x3')](_0x25c818,_0x4f007e);};}function removeListener(_0xef15ef,_0x1d6e04){return function(){ChatQueueEvents['removeListener'](_0xef15ef,_0x1d6e04);};}exports['register']=function(_0x1aceaa){for(var _0x4d53f6=0x0,_0x32dee5=events[_0x76aa('0x4')];_0x4d53f6<_0x32dee5;_0x4d53f6++){var _0xa9b695=events[_0x4d53f6];var _0x56d6bc=createListener(_0x76aa('0x5')+_0xa9b695,_0x1aceaa);ChatQueueEvents['on'](_0xa9b695,_0x56d6bc);}}; \ No newline at end of file +var _0x4ea3=['removeListener','register','length','chatQueue:','./chatQueue.events','save','remove','update','emit'];(function(_0x54175d,_0x41e8d6){var _0x48d99e=function(_0x2cd915){while(--_0x2cd915){_0x54175d['push'](_0x54175d['shift']());}};_0x48d99e(++_0x41e8d6);}(_0x4ea3,0x70));var _0x34ea=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4ea3[_0x14add3];return _0x4a174f;};'use strict';var ChatQueueEvents=require(_0x34ea('0x0'));var events=[_0x34ea('0x1'),_0x34ea('0x2'),_0x34ea('0x3')];function createListener(_0x588172,_0x374ec1){return function(_0x494b56){_0x374ec1[_0x34ea('0x4')](_0x588172,_0x494b56);};}function removeListener(_0x571f1b,_0x5e5a84){return function(){ChatQueueEvents[_0x34ea('0x5')](_0x571f1b,_0x5e5a84);};}exports[_0x34ea('0x6')]=function(_0x962596){for(var _0x123d48=0x0,_0x40434e=events[_0x34ea('0x7')];_0x123d48<_0x40434e;_0x123d48++){var _0x22b09e=events[_0x123d48];var _0x5bec7c=createListener(_0x34ea('0x8')+_0x22b09e,_0x962596);ChatQueueEvents['on'](_0x22b09e,_0x5bec7c);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index ee05915..9f31c67 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3e74,0x175));var _0x43e7=function(_0x24f8a4,_0x1a7be4){_0x24f8a4=_0x24f8a4-0x0;var _0x22b7a1=_0x3e74[_0x24f8a4];return _0x22b7a1;};'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 _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x2d24b5,_0x4d840a){var _0x2556b5=function(_0x66db30){while(--_0x66db30){_0x2d24b5['push'](_0x2d24b5['shift']());}};_0x2556b5(++_0x4d840a);}(_0x7217,0x19e));var _0x7721=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x7217[_0x220dbb];return _0x2b77de;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index e290dc3..09aa1cd 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 _0x4172=['moment','sequelize','STRING','DATE'];(function(_0x2d32fa,_0x1bb197){var _0x1584f4=function(_0x208364){while(--_0x208364){_0x2d32fa['push'](_0x2d32fa['shift']());}};_0x1584f4(++_0x1bb197);}(_0x4172,0xbc));var _0x2417=function(_0x1b3b38,_0x2ba1bf){_0x1b3b38=_0x1b3b38-0x0;var _0x25fb7c=_0x4172[_0x1b3b38];return _0x25fb7c;};'use strict';var moment=require(_0x2417('0x0'));var Sequelize=require(_0x2417('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x2417('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2417('0x2')]},'joinAt':{'type':Sequelize[_0x2417('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x2417('0x3')]},'reason':{'type':Sequelize[_0x2417('0x2')]}}; \ No newline at end of file +var _0xae3d=['sequelize','exports','STRING','DATE'];(function(_0x13c854,_0x78a8cf){var _0x37ac27=function(_0x260638){while(--_0x260638){_0x13c854['push'](_0x13c854['shift']());}};_0x37ac27(++_0x78a8cf);}(_0xae3d,0x148));var _0xdae3=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0xae3d[_0x11c573];return _0x6b72de;};'use strict';var moment=require('moment');var Sequelize=require(_0xdae3('0x0'));module[_0xdae3('0x1')]={'uniqueid':{'type':Sequelize[_0xdae3('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xdae3('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xdae3('0x3')]},'exitAt':{'type':Sequelize[_0xdae3('0x3')]},'reason':{'type':Sequelize[_0xdae3('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 2a5b66b..cc96b87 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 _0x9e69=['ChatQueueReport','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','keys','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','map'];(function(_0x1c9c24,_0x2a517b){var _0x349c69=function(_0x259ff7){while(--_0x259ff7){_0x1c9c24['push'](_0x1c9c24['shift']());}};_0x349c69(++_0x2a517b);}(_0x9e69,0x150));var _0x99e6=function(_0x5f1c7b,_0x406874){_0x5f1c7b=_0x5f1c7b-0x0;var _0x1f6a0d=_0x9e69[_0x5f1c7b];return _0x1f6a0d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x99e6('0x0'));var zipdir=require(_0x99e6('0x1'));var jsonpatch=require(_0x99e6('0x2'));var rp=require(_0x99e6('0x3'));var moment=require('moment');var BPromise=require(_0x99e6('0x4'));var Mustache=require(_0x99e6('0x5'));var util=require('util');var path=require(_0x99e6('0x6'));var sox=require(_0x99e6('0x7'));var csv=require(_0x99e6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x99e6('0x9'));var _=require(_0x99e6('0xa'));var squel=require(_0x99e6('0xb'));var crypto=require('crypto');var jsforce=require(_0x99e6('0xc'));var deskjs=require(_0x99e6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x99e6('0xe'));var Papa=require(_0x99e6('0xf'));var Redis=require('ioredis');var authService=require(_0x99e6('0x10'));var qs=require(_0x99e6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x99e6('0x12'))(_0x99e6('0x13'));var utils=require(_0x99e6('0x14'));var config=require(_0x99e6('0x15'));var licenseUtil=require(_0x99e6('0x16'));var db=require(_0x99e6('0x17'))['db'];function respondWithStatusCode(_0x51de85,_0x13a62b){_0x13a62b=_0x13a62b||0xcc;return function(_0x4033c5){if(_0x4033c5){return _0x51de85[_0x99e6('0x18')](_0x13a62b);}return _0x51de85['status'](_0x13a62b)[_0x99e6('0x19')]();};}function respondWithResult(_0x4061b2,_0x2cf6a4){_0x2cf6a4=_0x2cf6a4||0xc8;return function(_0x57111c){if(_0x57111c){return _0x4061b2['status'](_0x2cf6a4)['json'](_0x57111c);}};}function respondWithFilteredResult(_0x40fdb8,_0x4741c9){return function(_0x1d910a){if(_0x1d910a){var _0x5d5cd5=typeof _0x4741c9[_0x99e6('0x1a')]===_0x99e6('0x1b')&&typeof _0x4741c9[_0x99e6('0x1c')]===_0x99e6('0x1b');var _0x3a302d=_0x1d910a['count'];var _0x2e9e24=_0x5d5cd5?0x0:_0x4741c9['offset'];var _0x2749bf=_0x5d5cd5?_0x1d910a[_0x99e6('0x1d')]:_0x4741c9['offset']+_0x4741c9[_0x99e6('0x1c')];var _0x3c4cc8;if(_0x2749bf>=_0x3a302d){_0x2749bf=_0x3a302d;_0x3c4cc8=0xc8;}else{_0x3c4cc8=0xce;}_0x40fdb8[_0x99e6('0x1e')](_0x3c4cc8);return _0x40fdb8[_0x99e6('0x1f')](_0x99e6('0x20'),_0x2e9e24+'-'+_0x2749bf+'/'+_0x3a302d)[_0x99e6('0x21')](_0x1d910a);}return null;};}function patchUpdates(_0x41a32b){return function(_0x95a8e5){try{jsonpatch[_0x99e6('0x22')](_0x95a8e5,_0x41a32b,!![]);}catch(_0xef736c){return BPromise['reject'](_0xef736c);}return _0x95a8e5[_0x99e6('0x23')]();};}function saveUpdates(_0xef9c63,_0x16f05d){return function(_0x249872){if(_0x249872){return _0x249872[_0x99e6('0x24')](_0xef9c63)[_0x99e6('0x25')](function(_0x2a308f){return _0x2a308f;});}return null;};}function removeEntity(_0xa0b949,_0x2033af){return function(_0x1b4339){if(_0x1b4339){return _0x1b4339[_0x99e6('0x26')]()[_0x99e6('0x25')](function(){_0xa0b949[_0x99e6('0x1e')](0xcc)[_0x99e6('0x19')]();});}};}function handleEntityNotFound(_0x210b02,_0x19d2f1){return function(_0x17bc07){if(!_0x17bc07){_0x210b02['sendStatus'](0x194);}return _0x17bc07;};}function handleError(_0x43038d,_0x5390b3){_0x5390b3=_0x5390b3||0x1f4;return function(_0x30b956){logger[_0x99e6('0x27')](_0x30b956[_0x99e6('0x28')]);if(_0x30b956['name']){delete _0x30b956[_0x99e6('0x29')];}_0x43038d['status'](_0x5390b3)[_0x99e6('0x2a')](_0x30b956);};}exports['index']=function(_0x39ca5d,_0x46343f){var _0x4b58c7={},_0x4d6b19={},_0x2c9b92={'count':0x0,'rows':[]};var _0x350fa0=_[_0x99e6('0x2b')](db[_0x99e6('0x2c')][_0x99e6('0x2d')],function(_0x4b92af){return{'name':_0x4b92af[_0x99e6('0x2e')],'type':_0x4b92af[_0x99e6('0x2f')][_0x99e6('0x30')]};});_0x4d6b19['model']=_['map'](_0x350fa0,_0x99e6('0x29'));_0x4d6b19['query']=_['keys'](_0x39ca5d[_0x99e6('0x31')]);_0x4d6b19['filters']=_[_0x99e6('0x32')](_0x4d6b19[_0x99e6('0x33')],_0x4d6b19[_0x99e6('0x31')]);_0x4b58c7['attributes']=_[_0x99e6('0x32')](_0x4d6b19[_0x99e6('0x33')],qs[_0x99e6('0x34')](_0x39ca5d[_0x99e6('0x31')]['fields']));_0x4b58c7[_0x99e6('0x35')]=_0x4b58c7[_0x99e6('0x35')][_0x99e6('0x36')]?_0x4b58c7[_0x99e6('0x35')]:_0x4d6b19[_0x99e6('0x33')];if(!_0x39ca5d[_0x99e6('0x31')]['hasOwnProperty'](_0x99e6('0x37'))){_0x4b58c7['limit']=qs['limit'](_0x39ca5d['query'][_0x99e6('0x1c')]);_0x4b58c7[_0x99e6('0x1a')]=qs['offset'](_0x39ca5d[_0x99e6('0x31')][_0x99e6('0x1a')]);}_0x4b58c7[_0x99e6('0x38')]=qs[_0x99e6('0x39')](_0x39ca5d[_0x99e6('0x31')][_0x99e6('0x39')]);_0x4b58c7['where']=qs[_0x99e6('0x3a')](_[_0x99e6('0x3b')](_0x39ca5d[_0x99e6('0x31')],_0x4d6b19[_0x99e6('0x3a')]),_0x350fa0);if(_0x39ca5d['query'][_0x99e6('0x3c')]){_0x4b58c7[_0x99e6('0x3d')]=_[_0x99e6('0x3e')](_0x4b58c7[_0x99e6('0x3d')],{'$or':_[_0x99e6('0x2b')](_0x350fa0,function(_0x2fc6e5){if(_0x2fc6e5[_0x99e6('0x2f')]!=='VIRTUAL'){var _0x4b888c={};_0x4b888c[_0x2fc6e5['name']]={'$like':'%'+_0x39ca5d[_0x99e6('0x31')][_0x99e6('0x3c')]+'%'};return _0x4b888c;}})});}_0x4b58c7=_['merge']({},_0x4b58c7,_0x39ca5d[_0x99e6('0x3f')]);var _0x2975d8={'where':_0x4b58c7[_0x99e6('0x3d')]};return db[_0x99e6('0x2c')][_0x99e6('0x1d')](_0x2975d8)[_0x99e6('0x25')](function(_0x26cade){_0x2c9b92[_0x99e6('0x1d')]=_0x26cade;if(_0x39ca5d[_0x99e6('0x31')][_0x99e6('0x40')]){_0x4b58c7[_0x99e6('0x41')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x99e6('0x42')](_0x4b58c7);})[_0x99e6('0x25')](function(_0x13ee61){_0x2c9b92[_0x99e6('0x43')]=_0x13ee61;return _0x2c9b92;})[_0x99e6('0x25')](respondWithFilteredResult(_0x46343f,_0x4b58c7))[_0x99e6('0x44')](handleError(_0x46343f,null));};exports[_0x99e6('0x45')]=function(_0x34991f,_0x2f5b4f){var _0x534f05={'raw':!![],'where':{'id':_0x34991f['params']['id']}},_0x562921={};_0x562921['model']=_['keys'](db[_0x99e6('0x2c')][_0x99e6('0x2d')]);_0x562921['query']=_[_0x99e6('0x46')](_0x34991f[_0x99e6('0x31')]);_0x562921[_0x99e6('0x3a')]=_[_0x99e6('0x32')](_0x562921[_0x99e6('0x33')],_0x562921[_0x99e6('0x31')]);_0x534f05['attributes']=_[_0x99e6('0x32')](_0x562921[_0x99e6('0x33')],qs[_0x99e6('0x34')](_0x34991f[_0x99e6('0x31')][_0x99e6('0x34')]));_0x534f05[_0x99e6('0x35')]=_0x534f05[_0x99e6('0x35')][_0x99e6('0x36')]?_0x534f05[_0x99e6('0x35')]:_0x562921[_0x99e6('0x33')];if(_0x34991f[_0x99e6('0x31')][_0x99e6('0x40')]){_0x534f05[_0x99e6('0x41')]=[{'all':!![]}];}_0x534f05=_[_0x99e6('0x3e')]({},_0x534f05,_0x34991f['options']);return db['ChatQueueReport']['find'](_0x534f05)['then'](handleEntityNotFound(_0x2f5b4f,null))[_0x99e6('0x25')](respondWithResult(_0x2f5b4f,null))[_0x99e6('0x44')](handleError(_0x2f5b4f,null));};exports[_0x99e6('0x47')]=function(_0x10d693,_0x2c071f){return db['ChatQueueReport']['create'](_0x10d693[_0x99e6('0x48')],{})[_0x99e6('0x25')](respondWithResult(_0x2c071f,0xc9))['catch'](handleError(_0x2c071f,null));};exports['update']=function(_0x10a08e,_0x437bf2){if(_0x10a08e['body']['id']){delete _0x10a08e[_0x99e6('0x48')]['id'];}return db['ChatQueueReport'][_0x99e6('0x49')]({'where':{'id':_0x10a08e[_0x99e6('0x4a')]['id']}})[_0x99e6('0x25')](handleEntityNotFound(_0x437bf2,null))['then'](saveUpdates(_0x10a08e[_0x99e6('0x48')],null))[_0x99e6('0x25')](respondWithResult(_0x437bf2,null))['catch'](handleError(_0x437bf2,null));};exports[_0x99e6('0x26')]=function(_0x202159,_0x35973e){return db['ChatQueueReport']['find']({'where':{'id':_0x202159[_0x99e6('0x4a')]['id']}})[_0x99e6('0x25')](handleEntityNotFound(_0x35973e,null))['then'](removeEntity(_0x35973e,null))[_0x99e6('0x44')](handleError(_0x35973e,null));};exports[_0x99e6('0x4b')]=function(_0x20d286,_0x40de95){return db[_0x99e6('0x2c')][_0x99e6('0x4b')]()[_0x99e6('0x25')](respondWithResult(_0x40de95,null))['catch'](handleError(_0x40de95,null));}; \ No newline at end of file +var _0x297f=['params','keys','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','save','update','then','error','stack','name','ChatQueueReport','rawAttributes','fieldName','type','key','map','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch'];(function(_0x581705,_0x383fee){var _0x112198=function(_0xc74131){while(--_0xc74131){_0x581705['push'](_0x581705['shift']());}};_0x112198(++_0x383fee);}(_0x297f,0x1f0));var _0xf297=function(_0x15e5c8,_0xb433a0){_0x15e5c8=_0x15e5c8-0x0;var _0x204b3e=_0x297f[_0x15e5c8];return _0x204b3e;};'use strict';var emlformat=require(_0xf297('0x0'));var rimraf=require(_0xf297('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf297('0x2'));var moment=require(_0xf297('0x3'));var BPromise=require(_0xf297('0x4'));var Mustache=require(_0xf297('0x5'));var util=require('util');var path=require(_0xf297('0x6'));var sox=require('sox');var csv=require(_0xf297('0x7'));var ejs=require(_0xf297('0x8'));var fs=require('fs');var fs_extra=require(_0xf297('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf297('0xa'));var jsforce=require(_0xf297('0xb'));var deskjs=require(_0xf297('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf297('0xd'));var Papa=require(_0xf297('0xe'));var Redis=require('ioredis');var authService=require(_0xf297('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf297('0x10'));var hardwareService=require(_0xf297('0x11'));var logger=require(_0xf297('0x12'))('api');var utils=require(_0xf297('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf297('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5534f1,_0x395101){_0x395101=_0x395101||0xcc;return function(_0x3554b1){if(_0x3554b1){return _0x5534f1[_0xf297('0x15')](_0x395101);}return _0x5534f1[_0xf297('0x16')](_0x395101)[_0xf297('0x17')]();};}function respondWithResult(_0x3b7941,_0x5c5e7c){_0x5c5e7c=_0x5c5e7c||0xc8;return function(_0xb7647b){if(_0xb7647b){return _0x3b7941[_0xf297('0x16')](_0x5c5e7c)['json'](_0xb7647b);}};}function respondWithFilteredResult(_0x42fd50,_0x5eed15){return function(_0x2dd842){if(_0x2dd842){var _0x12c499=typeof _0x5eed15[_0xf297('0x18')]==='undefined'&&typeof _0x5eed15['limit']===_0xf297('0x19');var _0x1e2a77=_0x2dd842['count'];var _0x47d584=_0x12c499?0x0:_0x5eed15[_0xf297('0x18')];var _0x1932df=_0x12c499?_0x2dd842['count']:_0x5eed15[_0xf297('0x18')]+_0x5eed15[_0xf297('0x1a')];var _0x3ccb7;if(_0x1932df>=_0x1e2a77){_0x1932df=_0x1e2a77;_0x3ccb7=0xc8;}else{_0x3ccb7=0xce;}_0x42fd50['status'](_0x3ccb7);return _0x42fd50[_0xf297('0x1b')](_0xf297('0x1c'),_0x47d584+'-'+_0x1932df+'/'+_0x1e2a77)[_0xf297('0x1d')](_0x2dd842);}return null;};}function patchUpdates(_0x556c15){return function(_0x5f96ba){try{jsonpatch[_0xf297('0x1e')](_0x5f96ba,_0x556c15,!![]);}catch(_0x13ec1d){return BPromise['reject'](_0x13ec1d);}return _0x5f96ba[_0xf297('0x1f')]();};}function saveUpdates(_0x10830f,_0x4023a3){return function(_0x4cf7f7){if(_0x4cf7f7){return _0x4cf7f7[_0xf297('0x20')](_0x10830f)[_0xf297('0x21')](function(_0x6721c2){return _0x6721c2;});}return null;};}function removeEntity(_0x18d62b,_0x5335ca){return function(_0x27265c){if(_0x27265c){return _0x27265c['destroy']()[_0xf297('0x21')](function(){_0x18d62b[_0xf297('0x16')](0xcc)[_0xf297('0x17')]();});}};}function handleEntityNotFound(_0x3064dc,_0x2bd9a3){return function(_0x5a6335){if(!_0x5a6335){_0x3064dc['sendStatus'](0x194);}return _0x5a6335;};}function handleError(_0x8fb0dc,_0x3b4d86){_0x3b4d86=_0x3b4d86||0x1f4;return function(_0x73cabe){logger[_0xf297('0x22')](_0x73cabe[_0xf297('0x23')]);if(_0x73cabe[_0xf297('0x24')]){delete _0x73cabe['name'];}_0x8fb0dc[_0xf297('0x16')](_0x3b4d86)['send'](_0x73cabe);};}exports['index']=function(_0x58f5f3,_0x44d18e){var _0xca3c5e={},_0xa91424={},_0x901699={'count':0x0,'rows':[]};var _0x2cdfc6=_['map'](db[_0xf297('0x25')][_0xf297('0x26')],function(_0x566743){return{'name':_0x566743[_0xf297('0x27')],'type':_0x566743[_0xf297('0x28')][_0xf297('0x29')]};});_0xa91424['model']=_[_0xf297('0x2a')](_0x2cdfc6,_0xf297('0x24'));_0xa91424[_0xf297('0x2b')]=_['keys'](_0x58f5f3[_0xf297('0x2b')]);_0xa91424[_0xf297('0x2c')]=_['intersection'](_0xa91424[_0xf297('0x2d')],_0xa91424[_0xf297('0x2b')]);_0xca3c5e[_0xf297('0x2e')]=_[_0xf297('0x2f')](_0xa91424[_0xf297('0x2d')],qs[_0xf297('0x30')](_0x58f5f3['query'][_0xf297('0x30')]));_0xca3c5e[_0xf297('0x2e')]=_0xca3c5e['attributes'][_0xf297('0x31')]?_0xca3c5e[_0xf297('0x2e')]:_0xa91424[_0xf297('0x2d')];if(!_0x58f5f3[_0xf297('0x2b')]['hasOwnProperty'](_0xf297('0x32'))){_0xca3c5e[_0xf297('0x1a')]=qs[_0xf297('0x1a')](_0x58f5f3['query'][_0xf297('0x1a')]);_0xca3c5e[_0xf297('0x18')]=qs[_0xf297('0x18')](_0x58f5f3[_0xf297('0x2b')][_0xf297('0x18')]);}_0xca3c5e[_0xf297('0x33')]=qs[_0xf297('0x34')](_0x58f5f3[_0xf297('0x2b')]['sort']);_0xca3c5e[_0xf297('0x35')]=qs[_0xf297('0x2c')](_[_0xf297('0x36')](_0x58f5f3[_0xf297('0x2b')],_0xa91424[_0xf297('0x2c')]),_0x2cdfc6);if(_0x58f5f3[_0xf297('0x2b')][_0xf297('0x37')]){_0xca3c5e[_0xf297('0x35')]=_[_0xf297('0x38')](_0xca3c5e[_0xf297('0x35')],{'$or':_[_0xf297('0x2a')](_0x2cdfc6,function(_0x3f2b0a){if(_0x3f2b0a[_0xf297('0x28')]!==_0xf297('0x39')){var _0x317d03={};_0x317d03[_0x3f2b0a['name']]={'$like':'%'+_0x58f5f3[_0xf297('0x2b')][_0xf297('0x37')]+'%'};return _0x317d03;}})});}_0xca3c5e=_['merge']({},_0xca3c5e,_0x58f5f3[_0xf297('0x3a')]);var _0x463b21={'where':_0xca3c5e[_0xf297('0x35')]};return db[_0xf297('0x25')][_0xf297('0x3b')](_0x463b21)[_0xf297('0x21')](function(_0x575a67){_0x901699['count']=_0x575a67;if(_0x58f5f3[_0xf297('0x2b')][_0xf297('0x3c')]){_0xca3c5e[_0xf297('0x3d')]=[{'all':!![]}];}return db[_0xf297('0x25')][_0xf297('0x3e')](_0xca3c5e);})['then'](function(_0x53be11){_0x901699['rows']=_0x53be11;return _0x901699;})[_0xf297('0x21')](respondWithFilteredResult(_0x44d18e,_0xca3c5e))[_0xf297('0x3f')](handleError(_0x44d18e,null));};exports['show']=function(_0x625d81,_0x4e6483){var _0x2cbfe8={'raw':!![],'where':{'id':_0x625d81[_0xf297('0x40')]['id']}},_0x1503cd={};_0x1503cd['model']=_[_0xf297('0x41')](db[_0xf297('0x25')][_0xf297('0x26')]);_0x1503cd[_0xf297('0x2b')]=_[_0xf297('0x41')](_0x625d81[_0xf297('0x2b')]);_0x1503cd['filters']=_[_0xf297('0x2f')](_0x1503cd[_0xf297('0x2d')],_0x1503cd[_0xf297('0x2b')]);_0x2cbfe8['attributes']=_['intersection'](_0x1503cd[_0xf297('0x2d')],qs['fields'](_0x625d81[_0xf297('0x2b')][_0xf297('0x30')]));_0x2cbfe8[_0xf297('0x2e')]=_0x2cbfe8['attributes']['length']?_0x2cbfe8['attributes']:_0x1503cd[_0xf297('0x2d')];if(_0x625d81[_0xf297('0x2b')]['includeAll']){_0x2cbfe8[_0xf297('0x3d')]=[{'all':!![]}];}_0x2cbfe8=_['merge']({},_0x2cbfe8,_0x625d81[_0xf297('0x3a')]);return db['ChatQueueReport'][_0xf297('0x42')](_0x2cbfe8)['then'](handleEntityNotFound(_0x4e6483,null))[_0xf297('0x21')](respondWithResult(_0x4e6483,null))['catch'](handleError(_0x4e6483,null));};exports[_0xf297('0x43')]=function(_0x1213f8,_0x564ae3){return db['ChatQueueReport']['create'](_0x1213f8[_0xf297('0x44')],{})[_0xf297('0x21')](respondWithResult(_0x564ae3,0xc9))[_0xf297('0x3f')](handleError(_0x564ae3,null));};exports[_0xf297('0x20')]=function(_0x528887,_0x4d1215){if(_0x528887[_0xf297('0x44')]['id']){delete _0x528887[_0xf297('0x44')]['id'];}return db[_0xf297('0x25')][_0xf297('0x42')]({'where':{'id':_0x528887[_0xf297('0x40')]['id']}})['then'](handleEntityNotFound(_0x4d1215,null))[_0xf297('0x21')](saveUpdates(_0x528887[_0xf297('0x44')],null))[_0xf297('0x21')](respondWithResult(_0x4d1215,null))[_0xf297('0x3f')](handleError(_0x4d1215,null));};exports['destroy']=function(_0x23efc6,_0xf82b07){return db[_0xf297('0x25')]['find']({'where':{'id':_0x23efc6[_0xf297('0x40')]['id']}})[_0xf297('0x21')](handleEntityNotFound(_0xf82b07,null))[_0xf297('0x21')](removeEntity(_0xf82b07,null))[_0xf297('0x3f')](handleError(_0xf82b07,null));};exports[_0xf297('0x45')]=function(_0xf7c9ba,_0x1d2e33){return db[_0xf297('0x25')][_0xf297('0x45')]()['then'](respondWithResult(_0x1d2e33,null))['catch'](handleError(_0x1d2e33,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 7a2e16d..0c8ad5c 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x11f5ff,_0xa0ef18){var _0x46eefb=function(_0x51872a){while(--_0x51872a){_0x11f5ff['push'](_0x11f5ff['shift']());}};_0x46eefb(++_0xa0ef18);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x1713bc,_0x337d8c){var _0x59fe87=function(_0x5ec0c0){while(--_0x5ec0c0){_0x1713bc['push'](_0x1713bc['shift']());}};_0x59fe87(++_0x337d8c);}(_0xe706,0xa3));var _0x6e70=function(_0x5cceb8,_0xa8e57a){_0x5cceb8=_0x5cceb8-0x0;var _0xeaf4be=_0xe706[_0x5cceb8];return _0xeaf4be;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 921daa6..42ae5e1 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 _0x88cc=['limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','request','then','info','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','UpdateChatQueueReport','update','raw','attributes'];(function(_0x14b5b7,_0x182edf){var _0xaaa57f=function(_0x218a92){while(--_0x218a92){_0x14b5b7['push'](_0x14b5b7['shift']());}};_0xaaa57f(++_0x182edf);}(_0x88cc,0xc1));var _0xc88c=function(_0x21d7a2,_0x5aecda){_0x21d7a2=_0x21d7a2-0x0;var _0x1da981=_0x88cc[_0x21d7a2];return _0x1da981;};'use strict';var _=require(_0xc88c('0x0'));var util=require(_0xc88c('0x1'));var moment=require(_0xc88c('0x2'));var BPromise=require(_0xc88c('0x3'));var rs=require(_0xc88c('0x4'));var fs=require('fs');var Redis=require(_0xc88c('0x5'));var db=require(_0xc88c('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc88c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc88c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b0109,_0x24cf50,_0x19a19d){return new BPromise(function(_0x46e209,_0x2d2cb2){return client[_0xc88c('0x9')](_0x5b0109,_0x19a19d)[_0xc88c('0xa')](function(_0x565806){logger[_0xc88c('0xb')]('ChatQueueReport,\x20%s,\x20%s',_0x24cf50,'request\x20sent');logger[_0xc88c('0xc')](_0xc88c('0xd'),_0x24cf50,_0xc88c('0xe'),JSON[_0xc88c('0xf')](_0x565806));if(_0x565806[_0xc88c('0x10')]){if(_0x565806[_0xc88c('0x10')][_0xc88c('0x11')]===0x1f4){logger['error'](_0xc88c('0x12'),_0x24cf50,_0x565806[_0xc88c('0x10')][_0xc88c('0x13')]);return _0x2d2cb2(_0x565806[_0xc88c('0x10')][_0xc88c('0x13')]);}logger[_0xc88c('0x10')](_0xc88c('0x12'),_0x24cf50,_0x565806['error'][_0xc88c('0x13')]);return _0x46e209(_0x565806[_0xc88c('0x10')][_0xc88c('0x13')]);}else{logger['info'](_0xc88c('0x12'),_0x24cf50,_0xc88c('0xe'));_0x46e209(_0x565806[_0xc88c('0x14')][_0xc88c('0x13')]);}})[_0xc88c('0x15')](function(_0x5e694e){logger[_0xc88c('0x10')](_0xc88c('0x12'),_0x24cf50,_0x5e694e);_0x2d2cb2(_0x5e694e);});});}exports[_0xc88c('0x16')]=function(_0x9f0deb){var _0x3c5525=this;return new Promise(function(_0x572e3f,_0xaf1da1){return db[_0xc88c('0x17')][_0xc88c('0x18')](_0x9f0deb[_0xc88c('0x19')],{'raw':_0x9f0deb[_0xc88c('0x1a')]?_0x9f0deb[_0xc88c('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5daedf){logger[_0xc88c('0xb')](_0xc88c('0x16'),_0x9f0deb);logger['debug']('CreateChatQueueReport',_0x9f0deb,JSON[_0xc88c('0xf')](_0x5daedf));_0x572e3f(_0x5daedf);})[_0xc88c('0x15')](function(_0x92e8b0){logger[_0xc88c('0x10')](_0xc88c('0x16'),_0x92e8b0[_0xc88c('0x13')],_0x9f0deb);_0xaf1da1(_0x3c5525[_0xc88c('0x10')](0x1f4,_0x92e8b0['message']));});});};exports[_0xc88c('0x1b')]=function(_0x3ff4cf){var _0x5119ca=this;return new Promise(function(_0x3c1749,_0x432756){return db[_0xc88c('0x17')][_0xc88c('0x1c')](_0x3ff4cf['body'],{'raw':_0x3ff4cf[_0xc88c('0x1a')]?_0x3ff4cf[_0xc88c('0x1a')][_0xc88c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ff4cf[_0xc88c('0x1a')]?_0x3ff4cf[_0xc88c('0x1a')]['where']||null:null,'attributes':_0x3ff4cf[_0xc88c('0x1a')]?_0x3ff4cf['options'][_0xc88c('0x1e')]||null:null,'limit':_0x3ff4cf[_0xc88c('0x1a')]?_0x3ff4cf[_0xc88c('0x1a')][_0xc88c('0x1f')]||null:null})['then'](function(_0x439f79){logger[_0xc88c('0xb')]('UpdateChatQueueReport',_0x3ff4cf);logger[_0xc88c('0xc')](_0xc88c('0x1b'),_0x3ff4cf,JSON['stringify'](_0x439f79));_0x3c1749(_0x439f79);})[_0xc88c('0x15')](function(_0x4edecd){logger[_0xc88c('0x10')](_0xc88c('0x1b'),_0x4edecd[_0xc88c('0x13')],_0x3ff4cf);_0x432756(_0x5119ca[_0xc88c('0x10')](0x1f4,_0x4edecd[_0xc88c('0x13')]));});});}; \ No newline at end of file +var _0xc932=['body','options','raw','UpdateChatQueueReport','update','where','attributes','limit','then','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create'];(function(_0x5db2ac,_0x5b7037){var _0x5486ac=function(_0x346afd){while(--_0x346afd){_0x5db2ac['push'](_0x5db2ac['shift']());}};_0x5486ac(++_0x5b7037);}(_0xc932,0x18f));var _0x2c93=function(_0x47878f,_0x48d3bf){_0x47878f=_0x47878f-0x0;var _0x4b05b8=_0xc932[_0x47878f];return _0x4b05b8;};'use strict';var _=require(_0x2c93('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2c93('0x1'));var rs=require(_0x2c93('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2c93('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2c93('0x4'))(_0x2c93('0x5'));var config=require(_0x2c93('0x6'));var jayson=require(_0x2c93('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x55a5c1,_0x5803f3,_0xe205e3){return new BPromise(function(_0x10a55b,_0x210631){return client[_0x2c93('0x8')](_0x55a5c1,_0xe205e3)['then'](function(_0x115a35){logger[_0x2c93('0x9')](_0x2c93('0xa'),_0x5803f3,'request\x20sent');logger[_0x2c93('0xb')](_0x2c93('0xc'),_0x5803f3,_0x2c93('0xd'),JSON['stringify'](_0x115a35));if(_0x115a35['error']){if(_0x115a35[_0x2c93('0xe')]['code']===0x1f4){logger['error'](_0x2c93('0xa'),_0x5803f3,_0x115a35[_0x2c93('0xe')][_0x2c93('0xf')]);return _0x210631(_0x115a35[_0x2c93('0xe')]['message']);}logger[_0x2c93('0xe')](_0x2c93('0xa'),_0x5803f3,_0x115a35[_0x2c93('0xe')][_0x2c93('0xf')]);return _0x10a55b(_0x115a35[_0x2c93('0xe')]['message']);}else{logger[_0x2c93('0x9')](_0x2c93('0xa'),_0x5803f3,_0x2c93('0xd'));_0x10a55b(_0x115a35[_0x2c93('0x10')][_0x2c93('0xf')]);}})[_0x2c93('0x11')](function(_0x527207){logger[_0x2c93('0xe')](_0x2c93('0xa'),_0x5803f3,_0x527207);_0x210631(_0x527207);});});}exports[_0x2c93('0x12')]=function(_0x477a1f){var _0x32fcdf=this;return new Promise(function(_0x20fcea,_0x6ff1ee){return db[_0x2c93('0x13')][_0x2c93('0x14')](_0x477a1f[_0x2c93('0x15')],{'raw':_0x477a1f['options']?_0x477a1f[_0x2c93('0x16')][_0x2c93('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x1d4fdb){logger[_0x2c93('0x9')](_0x2c93('0x12'),_0x477a1f);logger['debug'](_0x2c93('0x12'),_0x477a1f,JSON['stringify'](_0x1d4fdb));_0x20fcea(_0x1d4fdb);})[_0x2c93('0x11')](function(_0x17338){logger[_0x2c93('0xe')](_0x2c93('0x12'),_0x17338[_0x2c93('0xf')],_0x477a1f);_0x6ff1ee(_0x32fcdf[_0x2c93('0xe')](0x1f4,_0x17338[_0x2c93('0xf')]));});});};exports[_0x2c93('0x18')]=function(_0xb6e62d){var _0x2dd127=this;return new Promise(function(_0x298518,_0x3ac3ab){return db[_0x2c93('0x13')][_0x2c93('0x19')](_0xb6e62d['body'],{'raw':_0xb6e62d['options']?_0xb6e62d[_0x2c93('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb6e62d[_0x2c93('0x16')]?_0xb6e62d[_0x2c93('0x16')][_0x2c93('0x1a')]||null:null,'attributes':_0xb6e62d[_0x2c93('0x16')]?_0xb6e62d[_0x2c93('0x16')][_0x2c93('0x1b')]||null:null,'limit':_0xb6e62d[_0x2c93('0x16')]?_0xb6e62d[_0x2c93('0x16')][_0x2c93('0x1c')]||null:null})[_0x2c93('0x1d')](function(_0x1177e9){logger[_0x2c93('0x9')](_0x2c93('0x18'),_0xb6e62d);logger[_0x2c93('0xb')](_0x2c93('0x18'),_0xb6e62d,JSON['stringify'](_0x1177e9));_0x298518(_0x1177e9);})['catch'](function(_0x1399af){logger[_0x2c93('0xe')](_0x2c93('0x18'),_0x1399af[_0x2c93('0xf')],_0xb6e62d);_0x3ac3ab(_0x2dd127[_0x2c93('0xe')](0x1f4,_0x1399af[_0x2c93('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index a5af45e..a3ab693 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 _0x7eb9=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','index','get','isAuthenticated','show','/:id','update','delete','exports'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0x7eb9,0xbb));var _0x97eb=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7eb9[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x97eb('0x0'));var util=require(_0x97eb('0x1'));var path=require('path');var timeout=require(_0x97eb('0x2'));var express=require(_0x97eb('0x3'));var router=express[_0x97eb('0x4')]();var fs_extra=require(_0x97eb('0x5'));var auth=require(_0x97eb('0x6'));var interaction=require(_0x97eb('0x7'));var config=require('../../config/environment');var controller=require(_0x97eb('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x97eb('0x9')]);router[_0x97eb('0xa')]('/describe',auth[_0x97eb('0xb')](),controller['describe']);router[_0x97eb('0xa')]('/:id',auth[_0x97eb('0xb')](),controller[_0x97eb('0xc')]);router['post']('/',auth[_0x97eb('0xb')](),controller['create']);router['put'](_0x97eb('0xd'),auth['isAuthenticated'](),controller[_0x97eb('0xe')]);router[_0x97eb('0xf')]('/:id',auth[_0x97eb('0xb')](),controller['destroy']);module[_0x97eb('0x10')]=router; \ No newline at end of file +var _0x021e=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','describe','/:id','create','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x021e,0x1b4));var _0xe021=function(_0x3eb050,_0x56ccfc){_0x3eb050=_0x3eb050-0x0;var _0x456c0f=_0x021e[_0x3eb050];return _0x456c0f;};'use strict';var multer=require(_0xe021('0x0'));var util=require(_0xe021('0x1'));var path=require(_0xe021('0x2'));var timeout=require(_0xe021('0x3'));var express=require(_0xe021('0x4'));var router=express[_0xe021('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe021('0x6'));var interaction=require(_0xe021('0x7'));var config=require(_0xe021('0x8'));var controller=require(_0xe021('0x9'));router[_0xe021('0xa')]('/',auth[_0xe021('0xb')](),controller[_0xe021('0xc')]);router[_0xe021('0xa')]('/describe',auth[_0xe021('0xb')](),controller[_0xe021('0xd')]);router[_0xe021('0xa')](_0xe021('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xe021('0xb')](),controller[_0xe021('0xf')]);router[_0xe021('0x10')](_0xe021('0xe'),auth[_0xe021('0xb')](),controller[_0xe021('0x11')]);router[_0xe021('0x12')](_0xe021('0xe'),auth[_0xe021('0xb')](),controller[_0xe021('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index a6be9fd..b1ebd13 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x307fd8,_0x25d8ac){var _0xd3f818=function(_0x2eba75){while(--_0x2eba75){_0x307fd8['push'](_0x307fd8['shift']());}};_0xd3f818(++_0x25d8ac);}(_0x34e8,0x12c));var _0x834e=function(_0x56f5ea,_0x3a8fc1){_0x56f5ea=_0x56f5ea-0x0;var _0x16b3ff=_0x34e8[_0x56f5ea];return _0x16b3ff;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x4cfc07,_0x3409a2){var _0x355841=function(_0x427b15){while(--_0x427b15){_0x4cfc07['push'](_0x4cfc07['shift']());}};_0x355841(++_0x3409a2);}(_0xf4eb,0xec));var _0xbf4e=function(_0x30e5ed,_0x1017ac){_0x30e5ed=_0x30e5ed-0x0;var _0x21576f=_0xf4eb[_0x30e5ed];return _0x21576f;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 8ddaa26..8f10357 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 _0x6ef9=['../../config/utils','../../mysqldb','sendStatus','end','status','limit','undefined','count','offset','set','apply','reject','update','then','error','stack','name','index','ChatTransferReport','rawAttributes','fieldName','type','model','map','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','show','keys','merge','create','body','catch','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api'];(function(_0x2098d0,_0x3eadb9){var _0x2c4e88=function(_0x3f3610){while(--_0x3f3610){_0x2098d0['push'](_0x2098d0['shift']());}};_0x2c4e88(++_0x3eadb9);}(_0x6ef9,0x7d));var _0x96ef=function(_0x71cd05,_0x36ac11){_0x71cd05=_0x71cd05-0x0;var _0x59c9e7=_0x6ef9[_0x71cd05];return _0x59c9e7;};'use strict';var emlformat=require(_0x96ef('0x0'));var rimraf=require(_0x96ef('0x1'));var zipdir=require(_0x96ef('0x2'));var jsonpatch=require(_0x96ef('0x3'));var rp=require(_0x96ef('0x4'));var moment=require(_0x96ef('0x5'));var BPromise=require(_0x96ef('0x6'));var Mustache=require(_0x96ef('0x7'));var util=require('util');var path=require(_0x96ef('0x8'));var sox=require(_0x96ef('0x9'));var csv=require(_0x96ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x96ef('0xb'));var _=require(_0x96ef('0xc'));var squel=require(_0x96ef('0xd'));var crypto=require(_0x96ef('0xe'));var jsforce=require(_0x96ef('0xf'));var deskjs=require(_0x96ef('0x10'));var toCsv=require(_0x96ef('0xa'));var querystring=require(_0x96ef('0x11'));var Papa=require(_0x96ef('0x12'));var Redis=require(_0x96ef('0x13'));var authService=require(_0x96ef('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x96ef('0x15'));var logger=require('../../config/logger')(_0x96ef('0x16'));var utils=require(_0x96ef('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x96ef('0x18'))['db'];function respondWithStatusCode(_0x3454c7,_0x2cdef0){_0x2cdef0=_0x2cdef0||0xcc;return function(_0x15b8ad){if(_0x15b8ad){return _0x3454c7[_0x96ef('0x19')](_0x2cdef0);}return _0x3454c7['status'](_0x2cdef0)[_0x96ef('0x1a')]();};}function respondWithResult(_0x2ab7f1,_0x38e930){_0x38e930=_0x38e930||0xc8;return function(_0x4da88b){if(_0x4da88b){return _0x2ab7f1[_0x96ef('0x1b')](_0x38e930)['json'](_0x4da88b);}};}function respondWithFilteredResult(_0x5bdc55,_0x4a5ec3){return function(_0x163a8e){if(_0x163a8e){var _0x2b7eef=typeof _0x4a5ec3['offset']==='undefined'&&typeof _0x4a5ec3[_0x96ef('0x1c')]===_0x96ef('0x1d');var _0xab3483=_0x163a8e[_0x96ef('0x1e')];var _0x1c9799=_0x2b7eef?0x0:_0x4a5ec3['offset'];var _0x3f5d19=_0x2b7eef?_0x163a8e[_0x96ef('0x1e')]:_0x4a5ec3[_0x96ef('0x1f')]+_0x4a5ec3[_0x96ef('0x1c')];var _0x1e0bc9;if(_0x3f5d19>=_0xab3483){_0x3f5d19=_0xab3483;_0x1e0bc9=0xc8;}else{_0x1e0bc9=0xce;}_0x5bdc55['status'](_0x1e0bc9);return _0x5bdc55[_0x96ef('0x20')]('Content-Range',_0x1c9799+'-'+_0x3f5d19+'/'+_0xab3483)['json'](_0x163a8e);}return null;};}function patchUpdates(_0x20ddaa){return function(_0x3f43ae){try{jsonpatch[_0x96ef('0x21')](_0x3f43ae,_0x20ddaa,!![]);}catch(_0x47daae){return BPromise[_0x96ef('0x22')](_0x47daae);}return _0x3f43ae['save']();};}function saveUpdates(_0x592635,_0x172333){return function(_0x5642d5){if(_0x5642d5){return _0x5642d5[_0x96ef('0x23')](_0x592635)[_0x96ef('0x24')](function(_0x20a8d6){return _0x20a8d6;});}return null;};}function removeEntity(_0x144f30,_0x53e421){return function(_0x1ca921){if(_0x1ca921){return _0x1ca921['destroy']()[_0x96ef('0x24')](function(){_0x144f30[_0x96ef('0x1b')](0xcc)[_0x96ef('0x1a')]();});}};}function handleEntityNotFound(_0x382994,_0xf40135){return function(_0x143eb5){if(!_0x143eb5){_0x382994[_0x96ef('0x19')](0x194);}return _0x143eb5;};}function handleError(_0x59d7f5,_0x2fb493){_0x2fb493=_0x2fb493||0x1f4;return function(_0x1eca4b){logger[_0x96ef('0x25')](_0x1eca4b[_0x96ef('0x26')]);if(_0x1eca4b[_0x96ef('0x27')]){delete _0x1eca4b[_0x96ef('0x27')];}_0x59d7f5['status'](_0x2fb493)['send'](_0x1eca4b);};}exports[_0x96ef('0x28')]=function(_0x49bb4a,_0x246dce){var _0x57ed15={},_0x1cfb15={},_0x13778d={'count':0x0,'rows':[]};var _0x176a90=_['map'](db[_0x96ef('0x29')][_0x96ef('0x2a')],function(_0x4f0bf3){return{'name':_0x4f0bf3[_0x96ef('0x2b')],'type':_0x4f0bf3[_0x96ef('0x2c')]['key']};});_0x1cfb15[_0x96ef('0x2d')]=_[_0x96ef('0x2e')](_0x176a90,_0x96ef('0x27'));_0x1cfb15['query']=_['keys'](_0x49bb4a['query']);_0x1cfb15[_0x96ef('0x2f')]=_[_0x96ef('0x30')](_0x1cfb15[_0x96ef('0x2d')],_0x1cfb15[_0x96ef('0x31')]);_0x57ed15[_0x96ef('0x32')]=_[_0x96ef('0x30')](_0x1cfb15['model'],qs[_0x96ef('0x33')](_0x49bb4a[_0x96ef('0x31')][_0x96ef('0x33')]));_0x57ed15[_0x96ef('0x32')]=_0x57ed15[_0x96ef('0x32')][_0x96ef('0x34')]?_0x57ed15[_0x96ef('0x32')]:_0x1cfb15[_0x96ef('0x2d')];if(!_0x49bb4a['query'][_0x96ef('0x35')](_0x96ef('0x36'))){_0x57ed15[_0x96ef('0x1c')]=qs['limit'](_0x49bb4a[_0x96ef('0x31')][_0x96ef('0x1c')]);_0x57ed15[_0x96ef('0x1f')]=qs[_0x96ef('0x1f')](_0x49bb4a[_0x96ef('0x31')][_0x96ef('0x1f')]);}_0x57ed15[_0x96ef('0x37')]=qs[_0x96ef('0x38')](_0x49bb4a[_0x96ef('0x31')][_0x96ef('0x38')]);_0x57ed15[_0x96ef('0x39')]=qs[_0x96ef('0x2f')](_[_0x96ef('0x3a')](_0x49bb4a[_0x96ef('0x31')],_0x1cfb15[_0x96ef('0x2f')]),_0x176a90);if(_0x49bb4a[_0x96ef('0x31')][_0x96ef('0x3b')]){_0x57ed15[_0x96ef('0x39')]=_['merge'](_0x57ed15[_0x96ef('0x39')],{'$or':_[_0x96ef('0x2e')](_0x176a90,function(_0x2d3290){if(_0x2d3290[_0x96ef('0x2c')]!==_0x96ef('0x3c')){var _0x3b753d={};_0x3b753d[_0x2d3290[_0x96ef('0x27')]]={'$like':'%'+_0x49bb4a[_0x96ef('0x31')][_0x96ef('0x3b')]+'%'};return _0x3b753d;}})});}_0x57ed15=_['merge']({},_0x57ed15,_0x49bb4a[_0x96ef('0x3d')]);var _0x5e3fa4={'where':_0x57ed15[_0x96ef('0x39')]};return db[_0x96ef('0x29')][_0x96ef('0x1e')](_0x5e3fa4)[_0x96ef('0x24')](function(_0x3d561c){_0x13778d[_0x96ef('0x1e')]=_0x3d561c;if(_0x49bb4a[_0x96ef('0x31')][_0x96ef('0x3e')]){_0x57ed15[_0x96ef('0x3f')]=[{'all':!![]}];}return db[_0x96ef('0x29')][_0x96ef('0x40')](_0x57ed15);})[_0x96ef('0x24')](function(_0x80c65b){_0x13778d['rows']=_0x80c65b;return _0x13778d;})['then'](respondWithFilteredResult(_0x246dce,_0x57ed15))['catch'](handleError(_0x246dce,null));};exports[_0x96ef('0x41')]=function(_0x9621d2,_0x460d00){var _0x13b7bb={'raw':!![],'where':{'id':_0x9621d2['params']['id']}},_0x5e39cc={};_0x5e39cc[_0x96ef('0x2d')]=_[_0x96ef('0x42')](db[_0x96ef('0x29')]['rawAttributes']);_0x5e39cc[_0x96ef('0x31')]=_['keys'](_0x9621d2[_0x96ef('0x31')]);_0x5e39cc[_0x96ef('0x2f')]=_[_0x96ef('0x30')](_0x5e39cc[_0x96ef('0x2d')],_0x5e39cc[_0x96ef('0x31')]);_0x13b7bb[_0x96ef('0x32')]=_['intersection'](_0x5e39cc[_0x96ef('0x2d')],qs['fields'](_0x9621d2['query'][_0x96ef('0x33')]));_0x13b7bb[_0x96ef('0x32')]=_0x13b7bb[_0x96ef('0x32')]['length']?_0x13b7bb[_0x96ef('0x32')]:_0x5e39cc[_0x96ef('0x2d')];if(_0x9621d2['query']['includeAll']){_0x13b7bb[_0x96ef('0x3f')]=[{'all':!![]}];}_0x13b7bb=_[_0x96ef('0x43')]({},_0x13b7bb,_0x9621d2[_0x96ef('0x3d')]);return db[_0x96ef('0x29')]['find'](_0x13b7bb)[_0x96ef('0x24')](handleEntityNotFound(_0x460d00,null))[_0x96ef('0x24')](respondWithResult(_0x460d00,null))['catch'](handleError(_0x460d00,null));};exports[_0x96ef('0x44')]=function(_0x41a627,_0x43d5ad){return db['ChatTransferReport'][_0x96ef('0x44')](_0x41a627[_0x96ef('0x45')],{})[_0x96ef('0x24')](respondWithResult(_0x43d5ad,0xc9))[_0x96ef('0x46')](handleError(_0x43d5ad,null));};exports[_0x96ef('0x23')]=function(_0x1a913b,_0x3194cb){if(_0x1a913b['body']['id']){delete _0x1a913b['body']['id'];}return db[_0x96ef('0x29')][_0x96ef('0x47')]({'where':{'id':_0x1a913b['params']['id']}})[_0x96ef('0x24')](handleEntityNotFound(_0x3194cb,null))[_0x96ef('0x24')](saveUpdates(_0x1a913b[_0x96ef('0x45')],null))[_0x96ef('0x24')](respondWithResult(_0x3194cb,null))['catch'](handleError(_0x3194cb,null));};exports[_0x96ef('0x48')]=function(_0x33892d,_0x2f4ee6){return db[_0x96ef('0x29')][_0x96ef('0x47')]({'where':{'id':_0x33892d['params']['id']}})[_0x96ef('0x24')](handleEntityNotFound(_0x2f4ee6,null))[_0x96ef('0x24')](removeEntity(_0x2f4ee6,null))[_0x96ef('0x46')](handleError(_0x2f4ee6,null));};exports[_0x96ef('0x49')]=function(_0x467566,_0xa20d81){return db[_0x96ef('0x29')]['describe']()[_0x96ef('0x24')](respondWithResult(_0xa20d81,null))[_0x96ef('0x46')](handleError(_0xa20d81,null));}; \ No newline at end of file +var _0xd94b=['model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','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','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','ChatTransferReport','fieldName','type','key'];(function(_0x7c0646,_0x45d16b){var _0x32416d=function(_0x22abdd){while(--_0x22abdd){_0x7c0646['push'](_0x7c0646['shift']());}};_0x32416d(++_0x45d16b);}(_0xd94b,0xbf));var _0xbd94=function(_0x1b4695,_0x3a90e3){_0x1b4695=_0x1b4695-0x0;var _0x376a90=_0xd94b[_0x1b4695];return _0x376a90;};'use strict';var emlformat=require(_0xbd94('0x0'));var rimraf=require(_0xbd94('0x1'));var zipdir=require(_0xbd94('0x2'));var jsonpatch=require(_0xbd94('0x3'));var rp=require('request-promise');var moment=require(_0xbd94('0x4'));var BPromise=require(_0xbd94('0x5'));var Mustache=require(_0xbd94('0x6'));var util=require(_0xbd94('0x7'));var path=require('path');var sox=require(_0xbd94('0x8'));var csv=require(_0xbd94('0x9'));var ejs=require(_0xbd94('0xa'));var fs=require('fs');var fs_extra=require(_0xbd94('0xb'));var _=require(_0xbd94('0xc'));var squel=require(_0xbd94('0xd'));var crypto=require(_0xbd94('0xe'));var jsforce=require(_0xbd94('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbd94('0x9'));var querystring=require(_0xbd94('0x10'));var Papa=require(_0xbd94('0x11'));var Redis=require(_0xbd94('0x12'));var authService=require(_0xbd94('0x13'));var qs=require(_0xbd94('0x14'));var as=require(_0xbd94('0x15'));var hardwareService=require(_0xbd94('0x16'));var logger=require('../../config/logger')(_0xbd94('0x17'));var utils=require(_0xbd94('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xbd94('0x19'));var db=require(_0xbd94('0x1a'))['db'];function respondWithStatusCode(_0x108a2b,_0x64aa0c){_0x64aa0c=_0x64aa0c||0xcc;return function(_0x3fe88c){if(_0x3fe88c){return _0x108a2b[_0xbd94('0x1b')](_0x64aa0c);}return _0x108a2b[_0xbd94('0x1c')](_0x64aa0c)[_0xbd94('0x1d')]();};}function respondWithResult(_0x20d4fc,_0x26c385){_0x26c385=_0x26c385||0xc8;return function(_0x3c159a){if(_0x3c159a){return _0x20d4fc[_0xbd94('0x1c')](_0x26c385)[_0xbd94('0x1e')](_0x3c159a);}};}function respondWithFilteredResult(_0x5ecd44,_0x1c2ce7){return function(_0x365b0b){if(_0x365b0b){var _0x26b981=typeof _0x1c2ce7[_0xbd94('0x1f')]==='undefined'&&typeof _0x1c2ce7[_0xbd94('0x20')]===_0xbd94('0x21');var _0x210725=_0x365b0b[_0xbd94('0x22')];var _0x1a6d43=_0x26b981?0x0:_0x1c2ce7[_0xbd94('0x1f')];var _0x5c1c1a=_0x26b981?_0x365b0b[_0xbd94('0x22')]:_0x1c2ce7[_0xbd94('0x1f')]+_0x1c2ce7[_0xbd94('0x20')];var _0x200bfd;if(_0x5c1c1a>=_0x210725){_0x5c1c1a=_0x210725;_0x200bfd=0xc8;}else{_0x200bfd=0xce;}_0x5ecd44[_0xbd94('0x1c')](_0x200bfd);return _0x5ecd44['set'](_0xbd94('0x23'),_0x1a6d43+'-'+_0x5c1c1a+'/'+_0x210725)['json'](_0x365b0b);}return null;};}function patchUpdates(_0x218c11){return function(_0x1f425e){try{jsonpatch[_0xbd94('0x24')](_0x1f425e,_0x218c11,!![]);}catch(_0x5641a4){return BPromise[_0xbd94('0x25')](_0x5641a4);}return _0x1f425e[_0xbd94('0x26')]();};}function saveUpdates(_0x51a07a,_0xece059){return function(_0x469489){if(_0x469489){return _0x469489[_0xbd94('0x27')](_0x51a07a)['then'](function(_0x4dde6e){return _0x4dde6e;});}return null;};}function removeEntity(_0x18c548,_0x45447c){return function(_0x3b316d){if(_0x3b316d){return _0x3b316d[_0xbd94('0x28')]()[_0xbd94('0x29')](function(){_0x18c548['status'](0xcc)[_0xbd94('0x1d')]();});}};}function handleEntityNotFound(_0x1388e9,_0x3c46e6){return function(_0x31ac23){if(!_0x31ac23){_0x1388e9[_0xbd94('0x1b')](0x194);}return _0x31ac23;};}function handleError(_0x19506c,_0x1ed057){_0x1ed057=_0x1ed057||0x1f4;return function(_0x4ec5eb){logger[_0xbd94('0x2a')](_0x4ec5eb[_0xbd94('0x2b')]);if(_0x4ec5eb[_0xbd94('0x2c')]){delete _0x4ec5eb[_0xbd94('0x2c')];}_0x19506c[_0xbd94('0x1c')](_0x1ed057)[_0xbd94('0x2d')](_0x4ec5eb);};}exports[_0xbd94('0x2e')]=function(_0x36335b,_0x259c20){var _0x27bf3d={},_0x29a4ef={},_0x37d798={'count':0x0,'rows':[]};var _0x298bd0=_[_0xbd94('0x2f')](db[_0xbd94('0x30')]['rawAttributes'],function(_0x6d601d){return{'name':_0x6d601d[_0xbd94('0x31')],'type':_0x6d601d[_0xbd94('0x32')][_0xbd94('0x33')]};});_0x29a4ef[_0xbd94('0x34')]=_[_0xbd94('0x2f')](_0x298bd0,_0xbd94('0x2c'));_0x29a4ef[_0xbd94('0x35')]=_['keys'](_0x36335b[_0xbd94('0x35')]);_0x29a4ef['filters']=_[_0xbd94('0x36')](_0x29a4ef['model'],_0x29a4ef[_0xbd94('0x35')]);_0x27bf3d[_0xbd94('0x37')]=_[_0xbd94('0x36')](_0x29a4ef[_0xbd94('0x34')],qs[_0xbd94('0x38')](_0x36335b[_0xbd94('0x35')]['fields']));_0x27bf3d[_0xbd94('0x37')]=_0x27bf3d[_0xbd94('0x37')][_0xbd94('0x39')]?_0x27bf3d[_0xbd94('0x37')]:_0x29a4ef[_0xbd94('0x34')];if(!_0x36335b[_0xbd94('0x35')][_0xbd94('0x3a')](_0xbd94('0x3b'))){_0x27bf3d[_0xbd94('0x20')]=qs[_0xbd94('0x20')](_0x36335b[_0xbd94('0x35')][_0xbd94('0x20')]);_0x27bf3d[_0xbd94('0x1f')]=qs[_0xbd94('0x1f')](_0x36335b[_0xbd94('0x35')][_0xbd94('0x1f')]);}_0x27bf3d[_0xbd94('0x3c')]=qs[_0xbd94('0x3d')](_0x36335b[_0xbd94('0x35')][_0xbd94('0x3d')]);_0x27bf3d[_0xbd94('0x3e')]=qs[_0xbd94('0x3f')](_[_0xbd94('0x40')](_0x36335b['query'],_0x29a4ef[_0xbd94('0x3f')]),_0x298bd0);if(_0x36335b[_0xbd94('0x35')]['filter']){_0x27bf3d['where']=_[_0xbd94('0x41')](_0x27bf3d[_0xbd94('0x3e')],{'$or':_[_0xbd94('0x2f')](_0x298bd0,function(_0x17e0d0){if(_0x17e0d0[_0xbd94('0x32')]!==_0xbd94('0x42')){var _0xc0557e={};_0xc0557e[_0x17e0d0['name']]={'$like':'%'+_0x36335b[_0xbd94('0x35')][_0xbd94('0x43')]+'%'};return _0xc0557e;}})});}_0x27bf3d=_['merge']({},_0x27bf3d,_0x36335b['options']);var _0x2b00bb={'where':_0x27bf3d['where']};return db[_0xbd94('0x30')][_0xbd94('0x22')](_0x2b00bb)[_0xbd94('0x29')](function(_0x26c6c9){_0x37d798[_0xbd94('0x22')]=_0x26c6c9;if(_0x36335b[_0xbd94('0x35')]['includeAll']){_0x27bf3d['include']=[{'all':!![]}];}return db[_0xbd94('0x30')][_0xbd94('0x44')](_0x27bf3d);})[_0xbd94('0x29')](function(_0x19df4a){_0x37d798[_0xbd94('0x45')]=_0x19df4a;return _0x37d798;})[_0xbd94('0x29')](respondWithFilteredResult(_0x259c20,_0x27bf3d))[_0xbd94('0x46')](handleError(_0x259c20,null));};exports[_0xbd94('0x47')]=function(_0x4a7799,_0x5eadc0){var _0x414e6b={'raw':!![],'where':{'id':_0x4a7799[_0xbd94('0x48')]['id']}},_0x445889={};_0x445889[_0xbd94('0x34')]=_[_0xbd94('0x49')](db['ChatTransferReport'][_0xbd94('0x4a')]);_0x445889['query']=_[_0xbd94('0x49')](_0x4a7799[_0xbd94('0x35')]);_0x445889[_0xbd94('0x3f')]=_['intersection'](_0x445889['model'],_0x445889['query']);_0x414e6b[_0xbd94('0x37')]=_[_0xbd94('0x36')](_0x445889[_0xbd94('0x34')],qs[_0xbd94('0x38')](_0x4a7799[_0xbd94('0x35')][_0xbd94('0x38')]));_0x414e6b[_0xbd94('0x37')]=_0x414e6b['attributes'][_0xbd94('0x39')]?_0x414e6b['attributes']:_0x445889[_0xbd94('0x34')];if(_0x4a7799[_0xbd94('0x35')][_0xbd94('0x4b')]){_0x414e6b['include']=[{'all':!![]}];}_0x414e6b=_[_0xbd94('0x41')]({},_0x414e6b,_0x4a7799[_0xbd94('0x4c')]);return db[_0xbd94('0x30')][_0xbd94('0x4d')](_0x414e6b)[_0xbd94('0x29')](handleEntityNotFound(_0x5eadc0,null))[_0xbd94('0x29')](respondWithResult(_0x5eadc0,null))[_0xbd94('0x46')](handleError(_0x5eadc0,null));};exports['create']=function(_0x137d5a,_0x5b86bf){return db[_0xbd94('0x30')][_0xbd94('0x4e')](_0x137d5a[_0xbd94('0x4f')],{})[_0xbd94('0x29')](respondWithResult(_0x5b86bf,0xc9))[_0xbd94('0x46')](handleError(_0x5b86bf,null));};exports[_0xbd94('0x27')]=function(_0x3f2743,_0x20fe9c){if(_0x3f2743['body']['id']){delete _0x3f2743[_0xbd94('0x4f')]['id'];}return db[_0xbd94('0x30')][_0xbd94('0x4d')]({'where':{'id':_0x3f2743[_0xbd94('0x48')]['id']}})[_0xbd94('0x29')](handleEntityNotFound(_0x20fe9c,null))[_0xbd94('0x29')](saveUpdates(_0x3f2743['body'],null))[_0xbd94('0x29')](respondWithResult(_0x20fe9c,null))[_0xbd94('0x46')](handleError(_0x20fe9c,null));};exports[_0xbd94('0x28')]=function(_0x3ce9f9,_0x3a5575){return db[_0xbd94('0x30')][_0xbd94('0x4d')]({'where':{'id':_0x3ce9f9[_0xbd94('0x48')]['id']}})[_0xbd94('0x29')](handleEntityNotFound(_0x3a5575,null))[_0xbd94('0x29')](removeEntity(_0x3a5575,null))[_0xbd94('0x46')](handleError(_0x3a5575,null));};exports[_0xbd94('0x50')]=function(_0x5f185e,_0x586838){return db[_0xbd94('0x30')][_0xbd94('0x50')]()[_0xbd94('0x29')](respondWithResult(_0x586838,null))['catch'](handleError(_0x586838,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 57dde03..b907680 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 _0x1246=['path','rimraf','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','api','moment','bluebird'];(function(_0x484945,_0x44c47d){var _0x5de501=function(_0xc3ac8e){while(--_0xc3ac8e){_0x484945['push'](_0x484945['shift']());}};_0x5de501(++_0x44c47d);}(_0x1246,0x164));var _0x6124=function(_0x33ab77,_0x3011a2){_0x33ab77=_0x33ab77-0x0;var _0x531e25=_0x1246[_0x33ab77];return _0x531e25;};'use strict';var _=require(_0x6124('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6124('0x1'));var moment=require(_0x6124('0x2'));var BPromise=require(_0x6124('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6124('0x4'));var rimraf=require(_0x6124('0x5'));var config=require(_0x6124('0x6'));var attributes=require(_0x6124('0x7'));module['exports']=function(_0x368f9f,_0x3f7134){return _0x368f9f[_0x6124('0x8')](_0x6124('0x9'),attributes,{'tableName':_0x6124('0xa'),'paranoid':![],'indexes':[{'name':_0x6124('0xb'),'fields':[_0x6124('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0b2c=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport','uniqueid','lodash','util'];(function(_0x5d6913,_0x254795){var _0x101110=function(_0x8c8c65){while(--_0x8c8c65){_0x5d6913['push'](_0x5d6913['shift']());}};_0x101110(++_0x254795);}(_0x0b2c,0x177));var _0xc0b2=function(_0x4c1176,_0x7b83b0){_0x4c1176=_0x4c1176-0x0;var _0x1faf91=_0x0b2c[_0x4c1176];return _0x1faf91;};'use strict';var _=require(_0xc0b2('0x0'));var util=require(_0xc0b2('0x1'));var logger=require(_0xc0b2('0x2'))(_0xc0b2('0x3'));var moment=require(_0xc0b2('0x4'));var BPromise=require(_0xc0b2('0x5'));var rp=require(_0xc0b2('0x6'));var fs=require('fs');var path=require(_0xc0b2('0x7'));var rimraf=require('rimraf');var config=require(_0xc0b2('0x8'));var attributes=require(_0xc0b2('0x9'));module['exports']=function(_0x192e51,_0x1f3014){return _0x192e51[_0xc0b2('0xa')](_0xc0b2('0xb'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xc0b2('0xc'),'fields':[_0xc0b2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index cb363e5..785fa05 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 _0x60a1=['rpc','../../config/environment','jayson/promise','client','http','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x67d2b,_0xc3be07){var _0x23e7c1=function(_0x290c5e){while(--_0x290c5e){_0x67d2b['push'](_0x67d2b['shift']());}};_0x23e7c1(++_0xc3be07);}(_0x60a1,0x16d));var _0x160a=function(_0x3ef7d,_0x950b28){_0x3ef7d=_0x3ef7d-0x0;var _0x16f27=_0x60a1[_0x3ef7d];return _0x16f27;};'use strict';var _=require(_0x160a('0x0'));var util=require(_0x160a('0x1'));var moment=require(_0x160a('0x2'));var BPromise=require(_0x160a('0x3'));var rs=require(_0x160a('0x4'));var fs=require('fs');var Redis=require(_0x160a('0x5'));var db=require(_0x160a('0x6'))['db'];var utils=require(_0x160a('0x7'));var logger=require(_0x160a('0x8'))(_0x160a('0x9'));var config=require(_0x160a('0xa'));var jayson=require(_0x160a('0xb'));var client=jayson[_0x160a('0xc')][_0x160a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1768a6,_0x277f09,_0x212860){return new BPromise(function(_0x304b3d,_0x4efee3){return client['request'](_0x1768a6,_0x212860)[_0x160a('0xe')](function(_0x414fbe){logger['info'](_0x160a('0xf'),_0x277f09,_0x160a('0x10'));logger[_0x160a('0x11')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x277f09,_0x160a('0x10'),JSON[_0x160a('0x12')](_0x414fbe));if(_0x414fbe['error']){if(_0x414fbe[_0x160a('0x13')]['code']===0x1f4){logger['error'](_0x160a('0xf'),_0x277f09,_0x414fbe['error']['message']);return _0x4efee3(_0x414fbe[_0x160a('0x13')]['message']);}logger[_0x160a('0x13')](_0x160a('0xf'),_0x277f09,_0x414fbe[_0x160a('0x13')][_0x160a('0x14')]);return _0x304b3d(_0x414fbe[_0x160a('0x13')][_0x160a('0x14')]);}else{logger['info'](_0x160a('0xf'),_0x277f09,_0x160a('0x10'));_0x304b3d(_0x414fbe[_0x160a('0x15')][_0x160a('0x14')]);}})['catch'](function(_0x4fe30e){logger[_0x160a('0x13')](_0x160a('0xf'),_0x277f09,_0x4fe30e);_0x4efee3(_0x4fe30e);});});} \ No newline at end of file +var _0x167b=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x167b,0x74));var _0xb167=function(_0x34319b,_0x2f3dff){_0x34319b=_0x34319b-0x0;var _0x16821e=_0x167b[_0x34319b];return _0x16821e;};'use strict';var _=require(_0xb167('0x0'));var util=require(_0xb167('0x1'));var moment=require(_0xb167('0x2'));var BPromise=require(_0xb167('0x3'));var rs=require(_0xb167('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb167('0x5'))['db'];var utils=require(_0xb167('0x6'));var logger=require(_0xb167('0x7'))('rpc');var config=require(_0xb167('0x8'));var jayson=require(_0xb167('0x9'));var client=jayson[_0xb167('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ec2bd,_0x31154a,_0x4875b0){return new BPromise(function(_0x2e8ef7,_0xf3a3b6){return client[_0xb167('0xb')](_0x4ec2bd,_0x4875b0)[_0xb167('0xc')](function(_0x2ef1b2){logger[_0xb167('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x31154a,_0xb167('0xe'));logger[_0xb167('0xf')](_0xb167('0x10'),_0x31154a,_0xb167('0xe'),JSON[_0xb167('0x11')](_0x2ef1b2));if(_0x2ef1b2['error']){if(_0x2ef1b2[_0xb167('0x12')][_0xb167('0x13')]===0x1f4){logger[_0xb167('0x12')](_0xb167('0x14'),_0x31154a,_0x2ef1b2[_0xb167('0x12')][_0xb167('0x15')]);return _0xf3a3b6(_0x2ef1b2[_0xb167('0x12')][_0xb167('0x15')]);}logger['error'](_0xb167('0x14'),_0x31154a,_0x2ef1b2['error'][_0xb167('0x15')]);return _0x2e8ef7(_0x2ef1b2['error']['message']);}else{logger[_0xb167('0xd')](_0xb167('0x14'),_0x31154a,_0xb167('0xe'));_0x2e8ef7(_0x2ef1b2[_0xb167('0x16')]['message']);}})[_0xb167('0x17')](function(_0x427ba3){logger[_0xb167('0x12')](_0xb167('0x14'),_0x31154a,_0x427ba3);_0xf3a3b6(_0x427ba3);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 9fb7029..e7a14cc 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 _0x066b=['../../config/environment','get','index','/describe','isAuthenticated','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x3ccc44,_0x207b0c){var _0x5d74bb=function(_0x59989a){while(--_0x59989a){_0x3ccc44['push'](_0x3ccc44['shift']());}};_0x5d74bb(++_0x207b0c);}(_0x066b,0xa4));var _0xb066=function(_0x587391,_0x1c2e51){_0x587391=_0x587391-0x0;var _0x549f32=_0x066b[_0x587391];return _0x549f32;};'use strict';var multer=require(_0xb066('0x0'));var util=require(_0xb066('0x1'));var path=require(_0xb066('0x2'));var timeout=require(_0xb066('0x3'));var express=require(_0xb066('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb066('0x5'));var interaction=require(_0xb066('0x6'));var config=require(_0xb066('0x7'));var controller=require('./chatTransferReport.controller');router[_0xb066('0x8')]('/',auth['isAuthenticated'](),controller[_0xb066('0x9')]);router['get'](_0xb066('0xa'),auth[_0xb066('0xb')](),controller['describe']);router[_0xb066('0x8')](_0xb066('0xc'),auth['isAuthenticated'](),controller[_0xb066('0xd')]);router[_0xb066('0xe')]('/',auth[_0xb066('0xb')](),controller[_0xb066('0xf')]);router[_0xb066('0x10')](_0xb066('0xc'),auth[_0xb066('0xb')](),controller['update']);router[_0xb066('0x11')]('/:id',auth[_0xb066('0xb')](),controller[_0xb066('0x12')]);module['exports']=router; \ No newline at end of file +var _0x458e=['./chatTransferReport.controller','get','isAuthenticated','/describe','show','post','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5a46a6,_0x397243){var _0x3a6af4=function(_0xea0f48){while(--_0xea0f48){_0x5a46a6['push'](_0x5a46a6['shift']());}};_0x3a6af4(++_0x397243);}(_0x458e,0xf5));var _0xe458=function(_0x2fbe43,_0x24e8cd){_0x2fbe43=_0x2fbe43-0x0;var _0x11567a=_0x458e[_0x2fbe43];return _0x11567a;};'use strict';var multer=require(_0xe458('0x0'));var util=require(_0xe458('0x1'));var path=require('path');var timeout=require(_0xe458('0x2'));var express=require(_0xe458('0x3'));var router=express[_0xe458('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe458('0x5'));var interaction=require(_0xe458('0x6'));var config=require('../../config/environment');var controller=require(_0xe458('0x7'));router[_0xe458('0x8')]('/',auth[_0xe458('0x9')](),controller['index']);router[_0xe458('0x8')](_0xe458('0xa'),auth[_0xe458('0x9')](),controller['describe']);router[_0xe458('0x8')]('/:id',auth[_0xe458('0x9')](),controller[_0xe458('0xb')]);router[_0xe458('0xc')]('/',auth[_0xe458('0x9')](),controller['create']);router[_0xe458('0xd')](_0xe458('0xe'),auth[_0xe458('0x9')](),controller[_0xe458('0xf')]);router[_0xe458('0x10')](_0xe458('0xe'),auth['isAuthenticated'](),controller[_0xe458('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 5aabfd5..38d2c01 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 _0xcbed=['Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Skip','Feedback','star','thumb','stringify','input','text','name','getDataValue','setDataValue','onlineForm','textarea','Comments','Leave\x20your\x20comments','offlineForm','parse','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xcbed,0x164));var _0xdcbe=function(_0x429b9c,_0x4171e9){_0x429b9c=_0x429b9c-0x0;var _0x2ebf77=_0xcbed[_0x429b9c];return _0x2ebf77;};'use strict';var Sequelize=require(_0xdcbe('0x0'));var rs=require(_0xdcbe('0x1'));module[_0xdcbe('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xdcbe('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xdcbe('0x4')},'key':{'type':Sequelize[_0xdcbe('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xdcbe('0x3')],'defaultValue':_0xdcbe('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdcbe('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xdcbe('0x3')],'allowNull':![],'defaultValue':_0xdcbe('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xdcbe('0x3')],'allowNull':![],'defaultValue':_0xdcbe('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xdcbe('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xdcbe('0x3')]},'animation':{'type':Sequelize[_0xdcbe('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xdcbe('0xa')](_0xdcbe('0xb'),_0xdcbe('0xc')),'defaultValue':_0xdcbe('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xdcbe('0xd')},'start_chat_button':{'type':Sequelize[_0xdcbe('0x3')],'defaultValue':_0xdcbe('0xe')},'offline_chat_button':{'type':Sequelize[_0xdcbe('0x3')],'defaultValue':_0xdcbe('0xf')},'header_offline':{'type':Sequelize[_0xdcbe('0x3')],'defaultValue':_0xdcbe('0x10')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xdcbe('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xdcbe('0x3')],'defaultValue':_0xdcbe('0x11')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xdcbe('0x12')]},'closingQuestion':{'type':Sequelize[_0xdcbe('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xdcbe('0x3')],'defaultValue':_0xdcbe('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0xdcbe('0x3')],'defaultValue':_0xdcbe('0x14')},'noteTitle':{'type':Sequelize[_0xdcbe('0x3')],'defaultValue':_0xdcbe('0x15')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xdcbe('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xdcbe('0x3')],'defaultValue':_0xdcbe('0xf')},'skipMessageButton':{'type':Sequelize[_0xdcbe('0x3')],'defaultValue':_0xdcbe('0x16')},'conditionAgreement':{'type':Sequelize[_0xdcbe('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xdcbe('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xdcbe('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xdcbe('0x3')],'defaultValue':_0xdcbe('0x17')},'ratingType':{'type':Sequelize[_0xdcbe('0xa')](_0xdcbe('0x18'),_0xdcbe('0x19')),'defaultValue':_0xdcbe('0x18')},'ratingStarsNumber':{'type':Sequelize[_0xdcbe('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xdcbe('0x12')],'defaultValue':function(){return JSON[_0xdcbe('0x1a')]({'items':[{'type':_0xdcbe('0x1b'),'variable':null,'config':{'placeholder':'name','type':_0xdcbe('0x1c'),'required':!![]},'props':{'title':_0xdcbe('0x1d'),'helpText':''}},{'type':_0xdcbe('0x1b'),'props':{'title':_0xdcbe('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xdcbe('0x4'),'type':_0xdcbe('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xdcbe('0x1e')]('onlineForm')?JSON['parse'](this[_0xdcbe('0x1e')]('onlineForm')):{};},'set':function(_0x7e3157){return this[_0xdcbe('0x1f')](_0xdcbe('0x20'),JSON[_0xdcbe('0x1a')](_0x7e3157));}},'offlineForm':{'type':Sequelize[_0xdcbe('0x12')],'defaultValue':function(){return JSON[_0xdcbe('0x1a')]({'items':[{'type':_0xdcbe('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xdcbe('0x4'),'type':_0xdcbe('0x4')},'variable':null},{'type':_0xdcbe('0x21'),'config':{'placeholder':_0xdcbe('0x22')},'props':{'title':_0xdcbe('0x22'),'helpText':_0xdcbe('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0xdcbe('0x1e')](_0xdcbe('0x24'))?JSON[_0xdcbe('0x25')](this[_0xdcbe('0x1e')](_0xdcbe('0x24'))):{};},'set':function(_0x137c16){return this['setDataValue'](_0xdcbe('0x24'),JSON[_0xdcbe('0x1a')](_0x137c16));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xdcbe('0x26')]();}},'autoclose':{'type':Sequelize[_0xdcbe('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xdcbe('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xdcbe('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xdcbe('0x3')]},'forwardOffline':{'type':Sequelize[_0xdcbe('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xdcbe('0x3')]},'waitingTitle':{'type':Sequelize[_0xdcbe('0x3')],'defaultValue':_0xdcbe('0x27')},'waitingMessage':{'type':Sequelize[_0xdcbe('0x3')],'defaultValue':_0xdcbe('0x28')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0xdcbe('0x29')},'offlineMessageBody':{'type':Sequelize[_0xdcbe('0x3')],'defaultValue':_0xdcbe('0x2a')},'enableUnmanagedNote':{'type':Sequelize[_0xdcbe('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xdcbe('0x3')],'defaultValue':_0xdcbe('0x2b')},'skipUnmanaged':{'type':Sequelize[_0xdcbe('0x3')],'defaultValue':_0xdcbe('0x16')},'sendUnmanaged':{'type':Sequelize[_0xdcbe('0x3')],'defaultValue':_0xdcbe('0xf')},'enableCustomerAttachment':{'type':Sequelize[_0xdcbe('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xdcbe('0x12')]},'showAgentAvatar':{'type':Sequelize[_0xdcbe('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xdcbe('0x3')]},'notificationTemplate':{'type':Sequelize[_0xdcbe('0x12')],'defaultValue':function(){return _0xdcbe('0x2c');}},'notificationSound':{'type':Sequelize[_0xdcbe('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdcbe('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xdcbe('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xdcbe('0x3')],'defaultValue':_0xdcbe('0x2d')},'waitForTheAssignedAgent':{'type':Sequelize[_0xdcbe('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xdcbe('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0xdcbe('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xdcbe('0x3')],'defaultValue':_0xdcbe('0x2e')},'defaultTitle':{'type':Sequelize[_0xdcbe('0x3')]},'customerAvatar':{'type':Sequelize[_0xdcbe('0x12')]},'showCustomerAvatar':{'type':Sequelize[_0xdcbe('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xdcbe('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xdcbe('0x3')],'allowNull':![],'defaultValue':_0xdcbe('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xdcbe('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdcbe('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdcbe('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xdcbe('0x3')],'defaultValue':_0xdcbe('0x30')},'systemAvatar':{'type':Sequelize[_0xdcbe('0x12')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdcbe('0x8')],'comment':_0xdcbe('0x31')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x267e50){if(!_0x267e50)this['setDataValue'](_0xdcbe('0x32'),null);this['setDataValue']('mandatoryDisposition',_0x267e50);}},'vidaooEscalation':{'type':Sequelize[_0xdcbe('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xdcbe('0x3')]},'vidaooTopic':{'type':Sequelize[_0xdcbe('0x3')],'allowNull':![],'defaultValue':_0xdcbe('0x33')},'vidaooNote':{'type':Sequelize[_0xdcbe('0x3')],'defaultValue':function(){return _0xdcbe('0x34');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xdcbe('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xdcbe('0x12')]}}; \ No newline at end of file +var _0xfd24=['#011F6A','#ffffff','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Send','INTEGER','Powered\x20by\x20xCALLY','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','thumb','star','TEXT','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','email','Agent'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0xfd24,0xff));var _0x4fd2=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xfd24[_0x1deb03];return _0x189fe7;};'use strict';var Sequelize=require(_0x4fd2('0x0'));var rs=require(_0x4fd2('0x1'));module['exports']={'name':{'type':Sequelize[_0x4fd2('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x4fd2('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x4fd2('0x2')]},'mapKey':{'type':Sequelize[_0x4fd2('0x2')],'defaultValue':_0x4fd2('0x3')},'mapKeyOffline':{'type':Sequelize[_0x4fd2('0x2')],'defaultValue':_0x4fd2('0x3')},'key':{'type':Sequelize[_0x4fd2('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x4fd2('0x2')],'defaultValue':_0x4fd2('0x4')},'customerAlias':{'type':Sequelize[_0x4fd2('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x4fd2('0x2')],'allowNull':![],'defaultValue':_0x4fd2('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x4fd2('0x2')],'allowNull':![],'defaultValue':_0x4fd2('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x4fd2('0x2')],'allowNull':![],'defaultValue':_0x4fd2('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x4fd2('0x2')]},'animation':{'type':Sequelize[_0x4fd2('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x4fd2('0x8')](_0x4fd2('0x9'),_0x4fd2('0xa')),'defaultValue':_0x4fd2('0x9')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x4fd2('0xb')},'start_chat_button':{'type':Sequelize[_0x4fd2('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x4fd2('0x2')],'defaultValue':_0x4fd2('0xc')},'header_offline':{'type':Sequelize[_0x4fd2('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x4fd2('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x4fd2('0xd')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x4fd2('0x2')],'defaultValue':_0x4fd2('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x4fd2('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x4fd2('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4fd2('0xf')},'formSubmitFailureMessage':{'type':Sequelize[_0x4fd2('0x2')],'defaultValue':_0x4fd2('0x10')},'noteTitle':{'type':Sequelize[_0x4fd2('0x2')],'defaultValue':_0x4fd2('0x11')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4fd2('0x12')},'closingMessage':{'type':Sequelize[_0x4fd2('0x2')],'defaultValue':_0x4fd2('0x13')},'closingMessageButton':{'type':Sequelize[_0x4fd2('0x2')],'defaultValue':_0x4fd2('0xc')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x4fd2('0x14')},'conditionAgreement':{'type':Sequelize[_0x4fd2('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x4fd2('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x4fd2('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x4fd2('0x15')},'ratingType':{'type':Sequelize[_0x4fd2('0x8')]('star',_0x4fd2('0x16')),'defaultValue':_0x4fd2('0x17')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x4fd2('0x18')],'defaultValue':function(){return JSON[_0x4fd2('0x19')]({'items':[{'type':_0x4fd2('0x1a'),'variable':null,'config':{'placeholder':_0x4fd2('0x1b'),'type':_0x4fd2('0x1c'),'required':!![]},'props':{'title':_0x4fd2('0x1b'),'helpText':''}},{'type':_0x4fd2('0x1a'),'props':{'title':_0x4fd2('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x4fd2('0x3'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x4fd2('0x1d')](_0x4fd2('0x1e'))?JSON[_0x4fd2('0x1f')](this['getDataValue']('onlineForm')):{};},'set':function(_0x465aa8){return this[_0x4fd2('0x20')](_0x4fd2('0x1e'),JSON[_0x4fd2('0x19')](_0x465aa8));}},'offlineForm':{'type':Sequelize[_0x4fd2('0x18')],'defaultValue':function(){return JSON[_0x4fd2('0x19')]({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x4fd2('0x3')},'variable':null},{'type':_0x4fd2('0x21'),'config':{'placeholder':_0x4fd2('0x22')},'props':{'title':_0x4fd2('0x22'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x4fd2('0x1d')](_0x4fd2('0x23'))?JSON[_0x4fd2('0x1f')](this[_0x4fd2('0x1d')](_0x4fd2('0x23'))):{};},'set':function(_0x30d919){return this['setDataValue']('offlineForm',JSON[_0x4fd2('0x19')](_0x30d919));}},'token':{'type':Sequelize[_0x4fd2('0x2')],'defaultValue':function(){return rs[_0x4fd2('0x24')]();}},'autoclose':{'type':Sequelize[_0x4fd2('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x4fd2('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x4fd2('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x4fd2('0x2')]},'forwardOffline':{'type':Sequelize[_0x4fd2('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x4fd2('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x4fd2('0x2')],'defaultValue':_0x4fd2('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x4fd2('0x2')],'defaultValue':_0x4fd2('0x26')},'offlineMessageBody':{'type':Sequelize[_0x4fd2('0x2')],'defaultValue':_0x4fd2('0x27')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x4fd2('0x2')],'defaultValue':_0x4fd2('0x14')},'sendUnmanaged':{'type':Sequelize[_0x4fd2('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x4fd2('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x4fd2('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x4fd2('0x18')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x4fd2('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x4fd2('0x28');}},'notificationSound':{'type':Sequelize[_0x4fd2('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x4fd2('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x4fd2('0x2')],'defaultValue':_0x4fd2('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x4fd2('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x4fd2('0x2')],'defaultValue':_0x4fd2('0x2a')},'verticalAlignment':{'type':Sequelize[_0x4fd2('0xd')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x4fd2('0x2b')},'defaultTitle':{'type':Sequelize[_0x4fd2('0x2')]},'customerAvatar':{'type':Sequelize[_0x4fd2('0x18')]},'showCustomerAvatar':{'type':Sequelize[_0x4fd2('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x4fd2('0xd')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x4fd2('0x2')],'allowNull':![],'defaultValue':_0x4fd2('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x4fd2('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4fd2('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4fd2('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4fd2('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x4fd2('0x2')],'defaultValue':_0x4fd2('0x2d')},'systemAvatar':{'type':Sequelize[_0x4fd2('0x18')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4fd2('0xd')],'comment':_0x4fd2('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x4fd2('0x7')],'defaultValue':![],'comment':_0x4fd2('0x2f'),'set':function(_0x2e5200){if(!_0x2e5200)this[_0x4fd2('0x20')](_0x4fd2('0x30'),null);this['setDataValue'](_0x4fd2('0x31'),_0x2e5200);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x4fd2('0x2')],'allowNull':![],'defaultValue':_0x4fd2('0x32')},'vidaooNote':{'type':Sequelize[_0x4fd2('0x2')],'defaultValue':function(){return _0x4fd2('0x33');}},'vidaooMetadata':{'type':Sequelize[_0x4fd2('0x18')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x4fd2('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 08a31a3..320d44b 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 _0x8840=['emit','isArray','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','ChatWebsites','UserProfileResource','destroy','name','index','Pause','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','ChatWebsite','rows','catch','show','params','mandatoryDispositionPause','includeAll','find','create','body','user','role','get','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','findOne','Disposition','ChatWebsiteId','findAll','removeDispositions','ids','addAnswer','CannedAnswer','hasOwnProperty','sitepic','filename','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','setUA','headers','user-agent','getResult','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','account','applications','Applications','asc','defaults','customerIp','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','threadId','externalUrl','ChatInteraction','ContactId','interaction','messageId','created','autoclose','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','Start','startRouting','EventManager','send','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','mimetype','files','attachments','offline-chat','basename','openNewInteraction','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','auth','pass','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','originalname','subjectOffline','toPairsIn','mapValues','email','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','Command','timezone','iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','getSnippet','Interval','Intervals','virtual','License','increment','chatLicenseExceeded','some','server/files/chat/iframe.ejs','remote','stringify','x-real-ip','connection','remoteAddress','replace','render','alignment','textColor','color_button','addApplications','sequelize','ChatApplication','bulkCreate','priority','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachment','Attachments','addAgents'];(function(_0x2bf466,_0x4929a5){var _0x856885=function(_0x102ef1){while(--_0x102ef1){_0x2bf466['push'](_0x2bf466['shift']());}};_0x856885(++_0x4929a5);}(_0x8840,0x12f));var _0x0884=function(_0x330723,_0x8de382){_0x330723=_0x330723-0x0;var _0x60c546=_0x8840[_0x330723];return _0x60c546;};'use strict';var emlformat=require(_0x0884('0x0'));var rimraf=require(_0x0884('0x1'));var zipdir=require(_0x0884('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0884('0x3'));var moment=require(_0x0884('0x4'));var BPromise=require(_0x0884('0x5'));var Mustache=require(_0x0884('0x6'));var util=require(_0x0884('0x7'));var path=require(_0x0884('0x8'));var sox=require(_0x0884('0x9'));var csv=require(_0x0884('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0884('0xb'));var crypto=require(_0x0884('0xc'));var jsforce=require(_0x0884('0xd'));var deskjs=require(_0x0884('0xe'));var toCsv=require(_0x0884('0xa'));var querystring=require(_0x0884('0xf'));var Papa=require('papaparse');var Redis=require(_0x0884('0x10'));var authService=require(_0x0884('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0884('0x12'));var hardwareService=require(_0x0884('0x13'));var logger=require(_0x0884('0x14'))(_0x0884('0x15'));var utils=require(_0x0884('0x16'));var config=require(_0x0884('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0884('0x18'))['db'];config['redis']=_['defaults'](config[_0x0884('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x0884('0x1a'))(new Redis(config[_0x0884('0x19')]));require(_0x0884('0x1b'))[_0x0884('0x1c')](socket);var jayson=require(_0x0884('0x1d'));var client=jayson[_0x0884('0x1e')][_0x0884('0x1f')]({'port':0x232c});var client9002=jayson[_0x0884('0x1e')]['http']({'port':0x232a});var client9003=jayson[_0x0884('0x1e')][_0x0884('0x1f')]({'port':0x232b});var client9001=jayson['client'][_0x0884('0x1f')]({'port':0x2329});function respondWithRpcPromise(_0x25c63f,_0x23f99e,_0x4a1b68,_0x460119){return new BPromise(function(_0x12fbab,_0x1add15){var _0x4bee6f=_0x460119||client;return _0x4bee6f['request'](_0x25c63f,_0x4a1b68)[_0x0884('0x20')](function(_0xd8d59e){logger[_0x0884('0x21')](_0x0884('0x22'),_0x23f99e,_0x0884('0x23'));logger[_0x0884('0x24')](_0x0884('0x25'),_0x23f99e,_0x0884('0x23'),JSON['stringify'](_0xd8d59e));if(_0xd8d59e[_0x0884('0x26')]){if(_0xd8d59e['error']['code']===0x1f4){logger[_0x0884('0x26')](_0x0884('0x22'),_0x23f99e,_0xd8d59e[_0x0884('0x26')][_0x0884('0x27')]);return _0x1add15(_0xd8d59e[_0x0884('0x26')]['message']);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x23f99e,_0xd8d59e[_0x0884('0x26')][_0x0884('0x27')]);return _0x12fbab(_0xd8d59e[_0x0884('0x26')][_0x0884('0x27')]);}else{logger[_0x0884('0x21')](_0x0884('0x22'),_0x23f99e,'request\x20sent');_0x12fbab(_0xd8d59e[_0x0884('0x28')][_0x0884('0x27')]);}})['catch'](function(_0x2e9c50){logger[_0x0884('0x26')](_0x0884('0x22'),_0x23f99e,_0x2e9c50);_0x1add15(_0x2e9c50);});});}function respondWithStatusCode(_0x28cf9a,_0xc2e2b){_0xc2e2b=_0xc2e2b||0xcc;return function(_0x18ee43){if(_0x18ee43){return _0x28cf9a[_0x0884('0x29')](_0xc2e2b);}return _0x28cf9a[_0x0884('0x2a')](_0xc2e2b)[_0x0884('0x2b')]();};}function respondWithResult(_0x5fce70,_0x2f6f92){_0x2f6f92=_0x2f6f92||0xc8;return function(_0x184600){if(_0x184600){return _0x5fce70[_0x0884('0x2a')](_0x2f6f92)[_0x0884('0x2c')](_0x184600);}};}function respondWithFilteredResult(_0x4324b4,_0x4149f8){return function(_0x1ec4af){if(_0x1ec4af){var _0x2bd364=typeof _0x4149f8[_0x0884('0x2d')]===_0x0884('0x2e')&&typeof _0x4149f8[_0x0884('0x2f')]===_0x0884('0x2e');var _0x1e9a6b=_0x1ec4af[_0x0884('0x30')];var _0x1c863f=_0x2bd364?0x0:_0x4149f8[_0x0884('0x2d')];var _0x4bc86c=_0x2bd364?_0x1ec4af[_0x0884('0x30')]:_0x4149f8['offset']+_0x4149f8[_0x0884('0x2f')];var _0x17eec2;if(_0x4bc86c>=_0x1e9a6b){_0x4bc86c=_0x1e9a6b;_0x17eec2=0xc8;}else{_0x17eec2=0xce;}_0x4324b4[_0x0884('0x2a')](_0x17eec2);return _0x4324b4[_0x0884('0x31')](_0x0884('0x32'),_0x1c863f+'-'+_0x4bc86c+'/'+_0x1e9a6b)[_0x0884('0x2c')](_0x1ec4af);}return null;};}function patchUpdates(_0x521d01){return function(_0xfc56c8){try{jsonpatch[_0x0884('0x33')](_0xfc56c8,_0x521d01,!![]);}catch(_0x4e008e){return BPromise['reject'](_0x4e008e);}return _0xfc56c8[_0x0884('0x34')]();};}function saveUpdates(_0x185baa,_0x2551c5){return function(_0x5caf34){if(_0x5caf34){return _0x5caf34[_0x0884('0x35')](_0x185baa)[_0x0884('0x20')](function(_0x105384){return _0x105384;});}return null;};}function removeEntity(_0x48c264,_0x3ac2c2){return function(_0x355c59){if(_0x355c59){return _0x355c59['destroy']()[_0x0884('0x20')](function(){var _0x392a29=_0x355c59['get']({'plain':!![]});var _0x1f00c9=_0x0884('0x36');return db[_0x0884('0x37')][_0x0884('0x38')]({'where':{'type':_0x1f00c9,'resourceId':_0x392a29['id']}})[_0x0884('0x20')](function(){return _0x355c59;});})['then'](function(){_0x48c264['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x42bc45,_0x26111a){return function(_0x487ece){if(!_0x487ece){_0x42bc45[_0x0884('0x29')](0x194);}return _0x487ece;};}function handleError(_0x51f504,_0x6b0aba){_0x6b0aba=_0x6b0aba||0x1f4;return function(_0x35bddb){logger[_0x0884('0x26')](_0x35bddb['stack']);if(_0x35bddb['name']){delete _0x35bddb[_0x0884('0x39')];}_0x51f504[_0x0884('0x2a')](_0x6b0aba)['send'](_0x35bddb);};}exports[_0x0884('0x3a')]=function(_0x316584,_0x3193dc){var _0xf9c600={'include':[{'model':db[_0x0884('0x3b')],'as':'mandatoryDispositionPause'}]},_0x169436={},_0xe3a57a={'count':0x0,'rows':[]};var _0x1ab6f5=_[_0x0884('0x3c')](db['ChatWebsite'][_0x0884('0x3d')],function(_0x5b7771){return{'name':_0x5b7771[_0x0884('0x3e')],'type':_0x5b7771[_0x0884('0x3f')][_0x0884('0x40')]};});_0x169436['model']=_[_0x0884('0x3c')](_0x1ab6f5,'name');_0x169436[_0x0884('0x41')]=_[_0x0884('0x42')](_0x316584[_0x0884('0x41')]);_0x169436[_0x0884('0x43')]=_[_0x0884('0x44')](_0x169436[_0x0884('0x45')],_0x169436['query']);_0xf9c600[_0x0884('0x46')]=_[_0x0884('0x44')](_0x169436[_0x0884('0x45')],qs[_0x0884('0x47')](_0x316584[_0x0884('0x41')][_0x0884('0x47')]));_0xf9c600['attributes']=_0xf9c600[_0x0884('0x46')][_0x0884('0x48')]?_0xf9c600[_0x0884('0x46')]:_0x169436[_0x0884('0x45')];if(!_0x316584['query']['hasOwnProperty'](_0x0884('0x49'))){_0xf9c600[_0x0884('0x2f')]=qs['limit'](_0x316584[_0x0884('0x41')]['limit']);_0xf9c600[_0x0884('0x2d')]=qs['offset'](_0x316584[_0x0884('0x41')][_0x0884('0x2d')]);}_0xf9c600[_0x0884('0x4a')]=qs[_0x0884('0x4b')](_0x316584[_0x0884('0x41')][_0x0884('0x4b')]);_0xf9c600[_0x0884('0x4c')]=qs['filters'](_[_0x0884('0x4d')](_0x316584['query'],_0x169436[_0x0884('0x43')]),_0x1ab6f5);if(_0x316584['query'][_0x0884('0x4e')]){_0xf9c600[_0x0884('0x4c')]=_[_0x0884('0x4f')](_0xf9c600[_0x0884('0x4c')],{'$or':_['map'](_0x1ab6f5,function(_0x10892f){if(_0x10892f[_0x0884('0x3f')]!==_0x0884('0x50')){var _0x15c07c={};_0x15c07c[_0x10892f['name']]={'$like':'%'+_0x316584[_0x0884('0x41')][_0x0884('0x4e')]+'%'};return _0x15c07c;}})});}_0xf9c600=_['merge']({},_0xf9c600,_0x316584[_0x0884('0x51')]);var _0x2e4485={'where':_0xf9c600['where']};return db['ChatWebsite'][_0x0884('0x30')](_0x2e4485)[_0x0884('0x20')](function(_0x23f9ec){_0xe3a57a['count']=_0x23f9ec;if(_0x316584[_0x0884('0x41')]['includeAll']){_0xf9c600[_0x0884('0x52')]=[{'all':!![]}];}return db[_0x0884('0x53')]['findAll'](_0xf9c600);})[_0x0884('0x20')](function(_0x3a3b76){_0xe3a57a[_0x0884('0x54')]=_0x3a3b76;return _0xe3a57a;})['then'](respondWithFilteredResult(_0x3193dc,_0xf9c600))[_0x0884('0x55')](handleError(_0x3193dc,null));};exports[_0x0884('0x56')]=function(_0x3fb7ba,_0x518e41){var _0x2a19d0={'raw':![],'where':{'id':_0x3fb7ba[_0x0884('0x57')]['id']},'include':[{'model':db[_0x0884('0x3b')],'as':_0x0884('0x58')}]},_0x546926={};_0x546926[_0x0884('0x45')]=_[_0x0884('0x42')](db[_0x0884('0x53')][_0x0884('0x3d')]);_0x546926[_0x0884('0x41')]=_[_0x0884('0x42')](_0x3fb7ba[_0x0884('0x41')]);_0x546926[_0x0884('0x43')]=_['intersection'](_0x546926[_0x0884('0x45')],_0x546926['query']);_0x2a19d0['attributes']=_['intersection'](_0x546926[_0x0884('0x45')],qs[_0x0884('0x47')](_0x3fb7ba[_0x0884('0x41')][_0x0884('0x47')]));_0x2a19d0[_0x0884('0x46')]=_0x2a19d0[_0x0884('0x46')][_0x0884('0x48')]?_0x2a19d0[_0x0884('0x46')]:_0x546926['model'];if(_0x3fb7ba[_0x0884('0x41')][_0x0884('0x59')]){_0x2a19d0[_0x0884('0x52')]=[{'all':!![]}];}_0x2a19d0=_[_0x0884('0x4f')]({},_0x2a19d0,_0x3fb7ba[_0x0884('0x51')]);return db[_0x0884('0x53')][_0x0884('0x5a')](_0x2a19d0)[_0x0884('0x20')](handleEntityNotFound(_0x518e41,null))[_0x0884('0x20')](respondWithResult(_0x518e41,null))[_0x0884('0x55')](handleError(_0x518e41,null));};exports['create']=function(_0x5c5dfe,_0x5c9bd6){return db[_0x0884('0x53')][_0x0884('0x5b')](_0x5c5dfe[_0x0884('0x5c')],{})['then'](function(_0xd56876){var _0x2844d2=_0x5c5dfe[_0x0884('0x5d')]['get']({'plain':!![]});if(!_0x2844d2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2844d2[_0x0884('0x5e')]==='user'){var _0x481abb=_0xd56876[_0x0884('0x5f')]({'plain':!![]});var _0x51dad4='ChatWebsites';return db[_0x0884('0x60')][_0x0884('0x5a')]({'where':{'name':_0x51dad4,'userProfileId':_0x2844d2['userProfileId']},'raw':!![]})[_0x0884('0x20')](function(_0x4f9623){if(_0x4f9623&&_0x4f9623['autoAssociation']===0x0){return db[_0x0884('0x37')][_0x0884('0x5b')]({'name':_0x481abb[_0x0884('0x39')],'resourceId':_0x481abb['id'],'type':_0x4f9623[_0x0884('0x39')],'sectionId':_0x4f9623['id']},{})[_0x0884('0x20')](function(){return _0xd56876;});}else{return _0xd56876;}})[_0x0884('0x55')](function(_0x58d4df){logger['error'](_0x0884('0x61'),_0x58d4df);throw _0x58d4df;});}return _0xd56876;})[_0x0884('0x20')](respondWithResult(_0x5c9bd6,0xc9))[_0x0884('0x55')](handleError(_0x5c9bd6,null));};exports[_0x0884('0x35')]=function(_0x575a82,_0x3a19a6){if(_0x575a82[_0x0884('0x5c')]['id']){delete _0x575a82['body']['id'];}return db[_0x0884('0x53')][_0x0884('0x5a')]({'where':{'id':_0x575a82[_0x0884('0x57')]['id']},'include':[{'model':db[_0x0884('0x3b')],'as':_0x0884('0x58')}]})[_0x0884('0x20')](handleEntityNotFound(_0x3a19a6,null))[_0x0884('0x20')](saveUpdates(_0x575a82['body'],null))['then'](respondWithResult(_0x3a19a6,null))[_0x0884('0x55')](handleError(_0x3a19a6,null));};exports['destroy']=function(_0x124f55,_0x4287a7){return db['ChatWebsite'][_0x0884('0x5a')]({'where':{'id':_0x124f55[_0x0884('0x57')]['id']}})[_0x0884('0x20')](handleEntityNotFound(_0x4287a7,null))[_0x0884('0x20')](removeEntity(_0x4287a7,null))[_0x0884('0x55')](handleError(_0x4287a7,null));};exports[_0x0884('0x62')]=function(_0x4e08c0,_0x1d6c10){return db['ChatWebsite'][_0x0884('0x62')]()[_0x0884('0x20')](respondWithResult(_0x1d6c10,null))['catch'](handleError(_0x1d6c10,null));};exports[_0x0884('0x63')]=function(_0x101ec0,_0xd38533,_0x31ff81){if(_0x101ec0[_0x0884('0x5c')]['id']){delete _0x101ec0[_0x0884('0x5c')]['id'];}return db['ChatWebsite'][_0x0884('0x5a')]({'where':{'id':_0x101ec0[_0x0884('0x57')]['id']}})['then'](handleEntityNotFound(_0xd38533,null))[_0x0884('0x20')](function(_0x5d6485){if(_0x5d6485){_0x101ec0[_0x0884('0x5c')]['ChatWebsiteId']=_0x5d6485['id'];return db['Disposition'][_0x0884('0x5b')](_0x101ec0[_0x0884('0x5c')]);}})['then'](respondWithResult(_0xd38533,null))[_0x0884('0x55')](handleError(_0xd38533,null));};exports['getDispositions']=function(_0x3e9313,_0x33777a,_0x19f644){var _0x14c0fb={'raw':![],'where':{}};var _0x2675ce={};var _0x347039={'count':0x0,'rows':[]};return db[_0x0884('0x53')][_0x0884('0x64')]({'where':{'id':_0x3e9313[_0x0884('0x57')]['id']}})[_0x0884('0x20')](handleEntityNotFound(_0x33777a,null))[_0x0884('0x20')](function(_0x41d9f8){if(_0x41d9f8){_0x2675ce['model']=_[_0x0884('0x42')](db[_0x0884('0x65')]['rawAttributes']);_0x2675ce[_0x0884('0x41')]=_[_0x0884('0x42')](_0x3e9313[_0x0884('0x41')]);_0x2675ce[_0x0884('0x43')]=_[_0x0884('0x44')](_0x2675ce['model'],_0x2675ce[_0x0884('0x41')]);_0x14c0fb['attributes']=_[_0x0884('0x44')](_0x2675ce['model'],qs['fields'](_0x3e9313[_0x0884('0x41')][_0x0884('0x47')]));_0x14c0fb[_0x0884('0x46')]=_0x14c0fb[_0x0884('0x46')][_0x0884('0x48')]?_0x14c0fb[_0x0884('0x46')]:_0x2675ce[_0x0884('0x45')];if(!_0x3e9313[_0x0884('0x41')]['hasOwnProperty'](_0x0884('0x49'))){_0x14c0fb[_0x0884('0x2f')]=qs['limit'](_0x3e9313[_0x0884('0x41')][_0x0884('0x2f')]);_0x14c0fb[_0x0884('0x2d')]=qs[_0x0884('0x2d')](_0x3e9313[_0x0884('0x41')][_0x0884('0x2d')]);}_0x14c0fb['order']=qs['sort'](_0x3e9313['query'][_0x0884('0x4b')]);_0x14c0fb[_0x0884('0x4c')]=qs[_0x0884('0x43')](_['pick'](_0x3e9313[_0x0884('0x41')],_0x2675ce[_0x0884('0x43')]));_0x14c0fb[_0x0884('0x4c')][_0x0884('0x66')]=_0x41d9f8['id'];if(_0x3e9313[_0x0884('0x41')][_0x0884('0x4e')]){_0x14c0fb[_0x0884('0x4c')]=_[_0x0884('0x4f')](_0x14c0fb['where'],{'$or':_[_0x0884('0x3c')](_0x14c0fb['attributes'],function(_0x5b4efa){var _0x2e2cde={};_0x2e2cde[_0x5b4efa]={'$like':'%'+_0x3e9313['query']['filter']+'%'};return _0x2e2cde;})});}_0x14c0fb=_[_0x0884('0x4f')]({},_0x14c0fb,_0x3e9313[_0x0884('0x51')]);return db['Disposition'][_0x0884('0x30')]({'where':_0x14c0fb['where']})[_0x0884('0x20')](function(_0x4a8bd0){_0x347039[_0x0884('0x30')]=_0x4a8bd0;if(_0x3e9313[_0x0884('0x41')][_0x0884('0x59')]){_0x14c0fb[_0x0884('0x52')]=[{'all':!![]}];}return db['Disposition'][_0x0884('0x67')](_0x14c0fb);})[_0x0884('0x20')](function(_0x1f4e6c){_0x347039[_0x0884('0x54')]=_0x1f4e6c;return _0x347039;});}})[_0x0884('0x20')](respondWithFilteredResult(_0x33777a,_0x14c0fb))[_0x0884('0x55')](handleError(_0x33777a,null));};exports[_0x0884('0x68')]=function(_0x1400b8,_0x401a19,_0x42fb68){return db[_0x0884('0x53')][_0x0884('0x5a')]({'where':{'id':_0x1400b8['params']['id']}})[_0x0884('0x20')](handleEntityNotFound(_0x401a19,null))[_0x0884('0x20')](function(_0x3be698){if(_0x3be698){return _0x3be698['removeDispositions'](_0x1400b8['query'][_0x0884('0x69')]);}})[_0x0884('0x20')](respondWithStatusCode(_0x401a19,null))[_0x0884('0x55')](handleError(_0x401a19,null));};exports[_0x0884('0x6a')]=function(_0x59be11,_0x45e037,_0x2882f6){if(_0x59be11['body']['id']){delete _0x59be11[_0x0884('0x5c')]['id'];}return db[_0x0884('0x53')]['find']({'where':{'id':_0x59be11[_0x0884('0x57')]['id']}})[_0x0884('0x20')](handleEntityNotFound(_0x45e037,null))['then'](function(_0xf89aad){if(_0xf89aad){_0x59be11[_0x0884('0x5c')][_0x0884('0x66')]=_0xf89aad['id'];return db['CannedAnswer'][_0x0884('0x5b')](_0x59be11[_0x0884('0x5c')]);}})[_0x0884('0x20')](respondWithResult(_0x45e037,null))[_0x0884('0x55')](handleError(_0x45e037,null));};exports['getAnswers']=function(_0x5b6906,_0x104bdb,_0x20eed3){var _0x3d245d={'raw':![],'where':{}};var _0x172de3={};var _0x4bf7f6={'count':0x0,'rows':[]};return db[_0x0884('0x53')][_0x0884('0x64')]({'where':{'id':_0x5b6906[_0x0884('0x57')]['id']}})[_0x0884('0x20')](handleEntityNotFound(_0x104bdb,null))[_0x0884('0x20')](function(_0x1cd6d2){if(_0x1cd6d2){_0x172de3[_0x0884('0x45')]=_[_0x0884('0x42')](db[_0x0884('0x6b')][_0x0884('0x3d')]);_0x172de3[_0x0884('0x41')]=_['keys'](_0x5b6906[_0x0884('0x41')]);_0x172de3[_0x0884('0x43')]=_[_0x0884('0x44')](_0x172de3[_0x0884('0x45')],_0x172de3[_0x0884('0x41')]);_0x3d245d[_0x0884('0x46')]=_[_0x0884('0x44')](_0x172de3[_0x0884('0x45')],qs[_0x0884('0x47')](_0x5b6906['query']['fields']));_0x3d245d[_0x0884('0x46')]=_0x3d245d['attributes'][_0x0884('0x48')]?_0x3d245d[_0x0884('0x46')]:_0x172de3['model'];if(!_0x5b6906[_0x0884('0x41')][_0x0884('0x6c')](_0x0884('0x49'))){_0x3d245d[_0x0884('0x2f')]=qs[_0x0884('0x2f')](_0x5b6906['query'][_0x0884('0x2f')]);_0x3d245d[_0x0884('0x2d')]=qs['offset'](_0x5b6906[_0x0884('0x41')][_0x0884('0x2d')]);}_0x3d245d[_0x0884('0x4a')]=qs[_0x0884('0x4b')](_0x5b6906[_0x0884('0x41')][_0x0884('0x4b')]);_0x3d245d[_0x0884('0x4c')]=qs[_0x0884('0x43')](_[_0x0884('0x4d')](_0x5b6906[_0x0884('0x41')],_0x172de3['filters']));_0x3d245d['where'][_0x0884('0x66')]=_0x1cd6d2['id'];if(_0x5b6906[_0x0884('0x41')][_0x0884('0x4e')]){_0x3d245d[_0x0884('0x4c')]=_[_0x0884('0x4f')](_0x3d245d['where'],{'$or':_[_0x0884('0x3c')](_0x3d245d[_0x0884('0x46')],function(_0x4a01ba){var _0x42f78f={};_0x42f78f[_0x4a01ba]={'$like':'%'+_0x5b6906['query'][_0x0884('0x4e')]+'%'};return _0x42f78f;})});}_0x3d245d=_[_0x0884('0x4f')]({},_0x3d245d,_0x5b6906[_0x0884('0x51')]);return db[_0x0884('0x6b')][_0x0884('0x30')]({'where':_0x3d245d[_0x0884('0x4c')]})[_0x0884('0x20')](function(_0x21ba35){_0x4bf7f6[_0x0884('0x30')]=_0x21ba35;if(_0x5b6906['query'][_0x0884('0x59')]){_0x3d245d[_0x0884('0x52')]=[{'all':!![]}];}return db[_0x0884('0x6b')][_0x0884('0x67')](_0x3d245d);})[_0x0884('0x20')](function(_0x24a58a){_0x4bf7f6['rows']=_0x24a58a;return _0x4bf7f6;});}})[_0x0884('0x20')](respondWithFilteredResult(_0x104bdb,_0x3d245d))[_0x0884('0x55')](handleError(_0x104bdb,null));};exports['removeAnswers']=function(_0x292603,_0x1a18ad,_0x4ec290){return db[_0x0884('0x53')]['find']({'where':{'id':_0x292603[_0x0884('0x57')]['id']}})[_0x0884('0x20')](handleEntityNotFound(_0x1a18ad,null))[_0x0884('0x20')](function(_0xf976e8){if(_0xf976e8){return _0xf976e8['removeAnswers'](_0x292603[_0x0884('0x41')][_0x0884('0x69')]);}})[_0x0884('0x20')](respondWithStatusCode(_0x1a18ad,null))[_0x0884('0x55')](handleError(_0x1a18ad,null));};exports['addLogo']=function(_0x490dcf,_0x3b0169,_0x2038e2){_0x490dcf[_0x0884('0x5c')][_0x0884('0x6d')]=_0x490dcf['file'][_0x0884('0x6e')];return db[_0x0884('0x53')]['find']({'where':{'id':_0x490dcf['params']['id']}})[_0x0884('0x20')](handleEntityNotFound(_0x3b0169,null))[_0x0884('0x20')](saveUpdates(_0x490dcf[_0x0884('0x5c')],null))[_0x0884('0x20')](respondWithResult(_0x3b0169,null))['catch'](handleError(_0x3b0169,null));};exports[_0x0884('0x6f')]=function(_0x27b4f4,_0x4d1e3b,_0x24dfb0){_0x27b4f4[_0x0884('0x5c')][_0x0884('0x70')]=_0x27b4f4[_0x0884('0x71')][_0x0884('0x6e')];return db[_0x0884('0x53')][_0x0884('0x5a')]({'where':{'id':_0x27b4f4[_0x0884('0x57')]['id']}})[_0x0884('0x20')](handleEntityNotFound(_0x4d1e3b,null))['then'](saveUpdates(_0x27b4f4[_0x0884('0x5c')],null))[_0x0884('0x20')](respondWithResult(_0x4d1e3b,null))[_0x0884('0x55')](handleError(_0x4d1e3b,null));};exports[_0x0884('0x72')]=function(_0x221e53,_0xa1df1d,_0x5e220a){_0x221e53['body'][_0x0884('0x73')]=_0x221e53[_0x0884('0x71')]['filename'];return db[_0x0884('0x53')][_0x0884('0x5a')]({'where':{'id':_0x221e53['params']['id']}})[_0x0884('0x20')](handleEntityNotFound(_0xa1df1d,null))['then'](saveUpdates(_0x221e53[_0x0884('0x5c')],null))[_0x0884('0x20')](respondWithResult(_0xa1df1d,null))[_0x0884('0x55')](handleError(_0xa1df1d,null));};exports[_0x0884('0x74')]=function(_0x489d04,_0xfa6706,_0xb44ca3){_0x489d04[_0x0884('0x5c')]['systemAvatar']=_0x489d04[_0x0884('0x71')][_0x0884('0x6e')];return db[_0x0884('0x53')][_0x0884('0x5a')]({'where':{'id':_0x489d04[_0x0884('0x57')]['id']}})[_0x0884('0x20')](handleEntityNotFound(_0xfa6706,null))['then'](saveUpdates(_0x489d04[_0x0884('0x5c')],null))[_0x0884('0x20')](respondWithResult(_0xfa6706,null))[_0x0884('0x55')](handleError(_0xfa6706,null));};exports['getLogo']=function(_0x2353c8,_0x9f0ed9,_0x3c0479){var _0x4cbdf1=path[_0x0884('0x75')](config[_0x0884('0x76')],_0x0884('0x77'));var _0x401475={'where':{'id':_0x2353c8[_0x0884('0x57')]['id']},'attributes':['id',_0x0884('0x6d')],'raw':!![]};var _0x3e1a4f=![];return require(_0x0884('0x78'))[_0x0884('0x79')]()[_0x0884('0x20')](function(_0x14ffa8){if(_0x14ffa8){_0x3e1a4f=_0x14ffa8[_0x0884('0x7a')];}})[_0x0884('0x20')](function(){return db[_0x0884('0x53')]['find'](_0x401475);})[_0x0884('0x20')](handleEntityNotFound(_0x9f0ed9,null))[_0x0884('0x20')](function(_0x324bc0){if(_0x324bc0){if(!_[_0x0884('0x7b')](_0x324bc0[_0x0884('0x6d')])){if(fs[_0x0884('0x7c')](path['join'](config[_0x0884('0x76')],'server/files/images/logos/',_0x324bc0[_0x0884('0x6d')]))&&_0x3e1a4f){_0x4cbdf1=path['join'](config['root'],_0x0884('0x7d'),_0x324bc0['sitepic']);}}return _0x9f0ed9[_0x0884('0x7e')](_0x4cbdf1);}})[_0x0884('0x55')](handleError(_0x9f0ed9,null));};exports[_0x0884('0x7f')]=function(_0x2b2ef5,_0x461e23,_0x50a5bc){var _0x113c0b=path[_0x0884('0x75')](config[_0x0884('0x76')],_0x0884('0x80'));var _0x42e8e0={'where':{'id':_0x2b2ef5[_0x0884('0x57')]['id']},'attributes':['id',_0x0884('0x70')],'raw':!![]};return db['ChatWebsite']['find'](_0x42e8e0)[_0x0884('0x20')](handleEntityNotFound(_0x461e23,null))[_0x0884('0x20')](function(_0x26d379){if(_0x26d379){if(!_['isNil'](_0x26d379[_0x0884('0x70')])){if(fs[_0x0884('0x7c')](path['join'](config['root'],_0x0884('0x81'),_0x26d379[_0x0884('0x70')]))){_0x113c0b=path['join'](config['root'],'server/files/images/avatars/',_0x26d379[_0x0884('0x70')]);}}return _0x461e23[_0x0884('0x7e')](_0x113c0b);}})[_0x0884('0x55')](handleError(_0x461e23,null));};exports[_0x0884('0x82')]=function(_0x587063,_0x10a62c,_0x2bc62f){var _0xcdd979=path['join'](config[_0x0884('0x76')],_0x0884('0x83'));var _0x80e4f3={'where':{'id':_0x587063[_0x0884('0x57')]['id']},'attributes':['id',_0x0884('0x73'),_0x0884('0x84')],'raw':!![]};return db['ChatWebsite'][_0x0884('0x5a')](_0x80e4f3)[_0x0884('0x20')](handleEntityNotFound(_0x10a62c,null))[_0x0884('0x20')](function(_0x23c520){if(_0x23c520){if(!_[_0x0884('0x7b')](_0x23c520[_0x0884('0x73')])){if(fs['existsSync'](path[_0x0884('0x75')](config[_0x0884('0x76')],_0x0884('0x81'),_0x23c520[_0x0884('0x73')]))&&_0x23c520[_0x0884('0x84')]){_0xcdd979=path['join'](config['root'],'server/files/images/avatars/',_0x23c520[_0x0884('0x73')]);}}return _0x10a62c[_0x0884('0x7e')](_0xcdd979);}})[_0x0884('0x55')](handleError(_0x10a62c,null));};exports['getSystemAvatar']=function(_0x4b5499,_0xf9a581,_0x33c7b1){var _0x204050=path[_0x0884('0x75')](config['root'],_0x0884('0x85'));var _0x519358={'where':{'id':_0x4b5499['params']['id']},'attributes':['id',_0x0884('0x86')],'raw':!![]};return db[_0x0884('0x53')][_0x0884('0x5a')](_0x519358)[_0x0884('0x20')](handleEntityNotFound(_0xf9a581,null))[_0x0884('0x20')](function(_0x15b31d){if(_0x15b31d){if(!_['isNil'](_0x15b31d[_0x0884('0x86')])){if(fs[_0x0884('0x7c')](path[_0x0884('0x75')](config['root'],_0x0884('0x81'),_0x15b31d[_0x0884('0x86')]))){_0x204050=path['join'](config[_0x0884('0x76')],'server/files/images/avatars/',_0x15b31d[_0x0884('0x86')]);}}return _0xf9a581[_0x0884('0x7e')](_0x204050);}})[_0x0884('0x55')](handleError(_0xf9a581,null));};exports[_0x0884('0x87')]=function(_0x4b15b6,_0x7f7df5,_0x170082){var _0x55776f=require('user-agent-parser');var _0x3ce8d8=new _0x55776f();var _0x5cfaa9=_0x3ce8d8[_0x0884('0x88')](_0x4b15b6[_0x0884('0x89')][_0x0884('0x8a')])[_0x0884('0x8b')]();var _0x5a6b34={'body':_0x4b15b6[_0x0884('0x5c')],'channel':'chat'};var _0x45e7f3=[];var _0x1b1584=[];var _0x22a5f4={};var _0x4265d3=![];return db[_0x0884('0x8c')][_0x0884('0x62')]()[_0x0884('0x20')](function(_0x4ce748){if(!_0x4ce748){throw new db[(_0x0884('0x8d'))][(_0x0884('0x8e'))](_0x0884('0x8f'));}_0x45e7f3=_[_0x0884('0x90')](_[_0x0884('0x42')](_0x4ce748),[_0x0884('0x91'),'updatedAt']);_0x1b1584=_[_0x0884('0x90')](_[_0x0884('0x42')](_0x4ce748),[_0x0884('0x91'),_0x0884('0x92'),_0x0884('0x93'),_0x0884('0x94')]);if(_0x4b15b6[_0x0884('0x5c')]['id']){delete _0x4b15b6['body']['id'];}if(_['isNil'](_0x4b15b6[_0x0884('0x5c')][_0x0884('0x95')])){throw new db['Sequelize'][(_0x0884('0x8e'))](_0x0884('0x96'));}if(_[_0x0884('0x7b')](_0x4b15b6[_0x0884('0x5c')][_0x0884('0x5c')])||_0x4b15b6[_0x0884('0x5c')][_0x0884('0x5c')]===''){throw new db[(_0x0884('0x8d'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0884('0x7b')](_0x4b15b6['body'][_0x0884('0x97')])){throw new db[(_0x0884('0x8d'))][(_0x0884('0x8e'))](_0x0884('0x98')+_0x1b1584);}if(!_[_0x0884('0x99')](_0x1b1584,_0x4b15b6[_0x0884('0x5c')][_0x0884('0x97')])){throw new db[(_0x0884('0x8d'))][(_0x0884('0x8e'))](_0x0884('0x9a')+_0x1b1584);}_0x22a5f4[_0x4b15b6['body'][_0x0884('0x97')]]=_0x4b15b6['body'][_0x0884('0x95')];})[_0x0884('0x20')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x4b15b6[_0x0884('0x57')]['id']},'include':[{'model':db[_0x0884('0x9b')],'as':_0x0884('0x9c'),'include':[{'model':db[_0x0884('0x8c')],'as':_0x0884('0x9d'),'where':_0x22a5f4,'limit':0x1,'order':[[_0x0884('0x92'),_0x0884('0x9e')]]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})[_0x0884('0x20')](handleEntityNotFound(_0x7f7df5,null))[_0x0884('0x20')](function(_0x560bfb){if(_0x560bfb&&_0x560bfb[_0x0884('0x9c')]){_0x5a6b34[_0x0884('0x9f')]=_0x560bfb;_0x5a6b34[_0x0884('0xa0')]=_0x560bfb[_0x0884('0xa1')];_0x5a6b34['list']=_0x560bfb['List'];_0x5a6b34['applications']=_['orderBy'](_0x5a6b34[_0x0884('0xa0')],['priority'],[_0x0884('0xa2')]);if(_0x5a6b34[_0x0884('0x9f')][_0x0884('0xa1')]){delete _0x5a6b34[_0x0884('0x9f')][_0x0884('0xa1')];}if(_0x5a6b34[_0x0884('0x9f')][_0x0884('0x9c')]&&_0x5a6b34[_0x0884('0x9f')][_0x0884('0x9c')][_0x0884('0x9d')]['length']){return _0x5a6b34[_0x0884('0x9f')][_0x0884('0x9c')][_0x0884('0x9d')][0x0];}var _0x4340a0=_[_0x0884('0xa3')](_0x4b15b6['body'],{'firstName':_0x4b15b6['body'][_0x0884('0x95')],'ListId':_0x560bfb[_0x0884('0x94')]});_0x4340a0[_0x4b15b6['body'][_0x0884('0x97')]]=_0x4b15b6['body'][_0x0884('0x95')];return db[_0x0884('0x8c')][_0x0884('0x5b')](_0x4340a0,{'fields':_0x45e7f3,'raw':!![]});}})[_0x0884('0x20')](handleEntityNotFound(_0x7f7df5,null))[_0x0884('0x20')](function(_0x393e48){_0x5a6b34['contact']=_0x393e48;var _0x2039cd=_0x4b15b6[_0x0884('0x5c')][_0x0884('0xa4')];if(_0x4b15b6[_0x0884('0x89')]['cf-connecting-ip']){_0x2039cd=_0x4b15b6[_0x0884('0x89')][_0x0884('0xa5')];}else if(_0x4b15b6['headers'][_0x0884('0xa6')]){_0x2039cd=_[_0x0884('0xa7')](_0x4b15b6[_0x0884('0x89')][_0x0884('0xa6')]['split'](','));}if(_0x393e48){var _0x121ac6={'ContactId':_0x393e48['id'],'ChatWebsiteId':_0x4b15b6[_0x0884('0x57')]['id'],'from':(_0x393e48[_0x0884('0xa8')]||'')+'\x20'+(_0x393e48[_0x0884('0xa9')]||''),'customerIp':_0x2039cd,'customerPort':_0x4b15b6[_0x0884('0x89')][_0x0884('0xaa')]?_0x4b15b6[_0x0884('0x89')]['x-real-port']:null,'referer':_0x4b15b6['body'][_0x0884('0xab')],'browserName':_0x5cfaa9[_0x0884('0xac')]['name']&&_0x5cfaa9[_0x0884('0xac')][_0x0884('0xad')]?util[_0x0884('0xae')](_0x0884('0xaf'),_0x5cfaa9[_0x0884('0xac')][_0x0884('0x39')],_0x5cfaa9['browser'][_0x0884('0xad')]):'unknown','browserVersion':_0x5cfaa9[_0x0884('0xac')][_0x0884('0xad')]||_0x0884('0xb0'),'osName':util['format'](_0x0884('0xaf'),_0x5cfaa9['os']['name'],_0x5cfaa9['os'][_0x0884('0xad')]),'osVersion':_0x5cfaa9['os'][_0x0884('0xad')],'deviceModel':_0x5cfaa9[_0x0884('0xb1')]['model']&&_0x5cfaa9['device'][_0x0884('0xb2')]?util[_0x0884('0xae')]('%s\x20%s\x20%s',_0x5cfaa9[_0x0884('0xb1')][_0x0884('0x45')],_0x5cfaa9['device'][_0x0884('0xb2')],_0x5cfaa9[_0x0884('0xb1')][_0x0884('0x3f')]):null,'deviceVendor':_0x5cfaa9[_0x0884('0xb1')][_0x0884('0xb2')],'deviceType':_0x5cfaa9[_0x0884('0xb1')][_0x0884('0x3f')],'formData':JSON['stringify'](_0x4b15b6['body'])};var _0x30050e={'ChatWebsiteId':_0x4b15b6[_0x0884('0x57')]['id'],'closed':![]};if(_0x4b15b6[_0x0884('0x5c')][_0x0884('0xb3')]){_0x30050e[_0x0884('0xb3')]=_0x4b15b6[_0x0884('0x5c')][_0x0884('0xb3')];return db['ChatInteraction'][_0x0884('0x5a')]({'where':_0x30050e})[_0x0884('0x20')](function(_0x2314a2){if(_0x2314a2){return[_0x2314a2,![]];}_0x121ac6[_0x0884('0xb3')]=_0x4b15b6[_0x0884('0x5c')]['threadId'];_0x121ac6[_0x0884('0xb4')]=_0x4b15b6[_0x0884('0x5c')][_0x0884('0xb4')];return db[_0x0884('0xb5')][_0x0884('0x5b')](_0x121ac6)[_0x0884('0x20')](function(_0x3512b0){return[_0x3512b0,!![]];});});}_0x30050e[_0x0884('0xb6')]=_0x393e48['id'];if(_0x4b15b6['body'][_0x0884('0xb7')]&&_0x4b15b6[_0x0884('0x5c')][_0x0884('0xb7')]['id']){_0x30050e['id']=_0x4b15b6[_0x0884('0x5c')][_0x0884('0xb7')]['id'];return db[_0x0884('0xb5')][_0x0884('0x5a')]({'where':_0x30050e})['then'](function(_0x1df355){if(_0x1df355){return[_0x1df355,![]];}return db[_0x0884('0xb5')]['create'](_0x121ac6)[_0x0884('0x20')](function(_0x3e3a05){return[_0x3e3a05,!![]];});});}return db[_0x0884('0xb5')]['create'](_0x121ac6)['then'](function(_0xb41e0e){return[_0xb41e0e,!![]];});}})['spread'](function(_0x1718a7,_0x58cac4){if(_0x1718a7){_0x4265d3=_0x58cac4;if(!_0x58cac4){var _0x539104={'from':(_0x5a6b34['contact']['firstName']||'')+'\x20'+(_0x5a6b34['contact'][_0x0884('0xa9')]||'')};if(_0x4b15b6[_0x0884('0x5c')][_0x0884('0xb3')]&&_0x4b15b6['body'][_0x0884('0xb8')]&&_0x4b15b6['body']['threadId']!=_0x4b15b6[_0x0884('0x5c')][_0x0884('0xb8')]){_0x539104[_0x0884('0xb3')]=_0x4b15b6[_0x0884('0x5c')][_0x0884('0xb8')];}return _0x1718a7['update'](_0x539104);}else{return _0x1718a7;}}})[_0x0884('0x20')](function(_0x43f9a7){_0x5a6b34[_0x0884('0xb7')]=_0x43f9a7[_0x0884('0x5f')]({'plain':!![]});_0x5a6b34['interaction']['created']=_0x4265d3;if(_0x5a6b34[_0x0884('0xb7')][_0x0884('0xb9')]){if(_0x5a6b34['account'][_0x0884('0xba')]){_0x5a6b34[_0x0884('0xa0')]['push']({'id':0x0,'priority':_0x5a6b34[_0x0884('0xa0')][_0x0884('0x48')]+0x1,'app':'close','appdata':_0x0884('0xbb'),'interval':_0x0884('0xbc')});}}return db[_0x0884('0xbd')][_0x0884('0x5b')]({'body':_0x4b15b6['body'][_0x0884('0x5c')],'ChatWebsiteId':_0x4b15b6['params']['id'],'ChatInteractionId':_0x43f9a7['id'],'direction':'in','ContactId':_0x5a6b34['contact']['id'],'AttachmentId':_0x4b15b6['body'][_0x0884('0xbe')]});})[_0x0884('0x20')](function(_0xd97070){_0x5a6b34[_0x0884('0x27')]=_0xd97070;if(_0x5a6b34[_0x0884('0xb7')][_0x0884('0xbf')]){return db['User'][_0x0884('0x5a')]({'attributes':['id',_0x0884('0x39')],'where':{'id':_0x5a6b34[_0x0884('0xb7')][_0x0884('0xbf')]}})[_0x0884('0x20')](function(_0x11b438){if(_0x11b438){_0x5a6b34['applications'][_0x0884('0xc0')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x11b438['name']+','+(_0x5a6b34[_0x0884('0x9f')]['waitForTheAssignedAgent']||0xa),'interval':_0x0884('0xbc')});_0x5a6b34['forcedOwnership']=!![];}return respondWithRpcPromise(_0x0884('0xc1'),_0x0884('0xc2'),_0x5a6b34);});}return respondWithRpcPromise('Start','startRouting',_0x5a6b34);})[_0x0884('0x20')](function(_0x3b5ec7){respondWithRpcPromise('EventManager',_0x0884('0xc3'),{'event':_0x0884('0x87'),'message':_0x3b5ec7},client9002);return _0x3b5ec7;})[_0x0884('0x20')](respondWithResult(_0x7f7df5,null))[_0x0884('0x55')](handleError(_0x7f7df5,null));};exports['offline']=function(_0x3082d2,_0x14bdec,_0x1d465f){var _0x31ee05,_0x26119f,_0x4774ea;var _0x2b198b=[];var _0x1a4113=[];var _0x3719f3={};var _0x5d43a9=_0x3082d2['files']||[];var _0x4390b5=[];var _0x3ae8a0;return db[_0x0884('0x8c')]['describe']()['then'](function(_0x413b19){if(!_0x413b19){throw new db['Sequelize']['ValidationError'](_0x0884('0x8f'));}_0x1a4113=_[_0x0884('0x90')](_[_0x0884('0x42')](_0x413b19),['createdAt','updatedAt']);_0x2b198b=_['difference'](_[_0x0884('0x42')](_0x413b19),[_0x0884('0x91'),_0x0884('0x92'),_0x0884('0x93'),_0x0884('0x94')]);if(_0x3082d2[_0x0884('0x5c')]['id']){delete _0x3082d2[_0x0884('0x5c')]['id'];}if(_[_0x0884('0x7b')](_0x3082d2[_0x0884('0x5c')][_0x0884('0x95')])){throw _0x14bdec['status'](0x1f4)[_0x0884('0xc4')](new db[(_0x0884('0x8d'))]['ValidationError'](_0x0884('0x96')));}if(_[_0x0884('0x7b')](_0x3082d2[_0x0884('0x5c')][_0x0884('0x5c')])||_0x3082d2[_0x0884('0x5c')]['body']===''){throw _0x14bdec[_0x0884('0x2a')](0x1f4)[_0x0884('0xc4')](new db[(_0x0884('0x8d'))][(_0x0884('0x8e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x3082d2[_0x0884('0x5c')]['mapKeyOffline'])){throw _0x14bdec['status'](0x1f4)[_0x0884('0xc4')](new db[(_0x0884('0x8d'))][(_0x0884('0x8e'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2b198b));}if(!_['includes'](_0x2b198b,_0x3082d2[_0x0884('0x5c')][_0x0884('0xc5')])){throw _0x14bdec[_0x0884('0x2a')](0x1f4)[_0x0884('0xc4')](new db[(_0x0884('0x8d'))][(_0x0884('0x8e'))](_0x0884('0xc6')+_0x2b198b));}_0x3719f3[_0x3082d2[_0x0884('0x5c')]['mapKeyOffline']]=_0x3082d2[_0x0884('0x5c')][_0x0884('0x95')];})[_0x0884('0x20')](function(){return db[_0x0884('0x53')][_0x0884('0x5a')]({'where':{'id':_0x3082d2[_0x0884('0x57')]['id']},'include':[{'model':db[_0x0884('0x9b')],'as':_0x0884('0x9c')},{'model':db[_0x0884('0xc7')],'as':_0x0884('0xc7')}]});})[_0x0884('0x20')](handleEntityNotFound(_0x14bdec,null))[_0x0884('0x20')](function(_0x53d461){if(_0x53d461&&_0x53d461[_0x0884('0x9c')]){_0x26119f=_0x53d461;var _0x50c81d=_[_0x0884('0xa3')](_0x3082d2[_0x0884('0x5c')],{'firstName':_0x3082d2[_0x0884('0x5c')][_0x0884('0x95')],'phone':_0x3082d2[_0x0884('0x5c')][_0x0884('0x95')],'ListId':_0x53d461['ListId']});_0x50c81d[_0x3082d2[_0x0884('0x5c')][_0x0884('0xc5')]]=_0x3082d2[_0x0884('0x5c')]['from'];return db[_0x0884('0x8c')][_0x0884('0xc8')]({'where':_0x3719f3,'defaults':_0x50c81d});}})[_0x0884('0xc9')](function(_0xb7e1d){if(_0xb7e1d){_0x4774ea=_0xb7e1d;var _0x5c6c34=fs[_0x0884('0xca')](path[_0x0884('0x75')](config[_0x0884('0x76')],_0x0884('0xcb')),_0x0884('0xcc'));var _0x5d48d7=ejs['render'](_0x5c6c34,{'body':_[_0x0884('0xcd')](_0x3082d2[_0x0884('0x5c')][_0x0884('0x5c')]),'bodyTitle':_0x26119f[_0x0884('0xce')]});return db['ChatOfflineMessage'][_0x0884('0x5b')]({'body':_0x5d48d7,'ContactId':_0xb7e1d['id'],'ChatWebsiteId':_0x26119f['id']});}})[_0x0884('0x20')](function(_0x4195ad){_0x3ae8a0=_0x4195ad;if(_0x5d43a9['length']){var _0x4153c7=_0x5d43a9['map'](function(_0x1de6df){return{'name':_0x1de6df['originalname'],'basename':_0x1de6df[_0x0884('0x6e')],'type':_0x1de6df[_0x0884('0xcf')],'ChatOfflineMessageId':_0x4195ad['id']};});_0x4390b5=_0x4153c7[_0x0884('0x3c')](_0x36d043=>{var _0x2a2f7f={'filename':_0x36d043[_0x0884('0x39')],'path':path[_0x0884('0x75')](config[_0x0884('0x76')],'server',_0x0884('0xd0'),_0x0884('0xd1'),_0x0884('0xd2'),_0x36d043[_0x0884('0xd3')])};return _0x2a2f7f;});if(!_0x26119f[_0x0884('0xd4')]){return db['sequelize']['transaction'](function(_0x49d4f5){return db['Attachment']['bulkCreate'](_0x4153c7,{'transaction':_0x49d4f5});});}}})[_0x0884('0x20')](function(){if(_0x3ae8a0){_0x31ee05=_0x3ae8a0;return db[_0x0884('0xc7')][_0x0884('0x64')]({'where':{'active':!![]},'include':[{'model':db['MailServerOut'],'as':_0x0884('0xd5'),'raw':!![]}]});}})[_0x0884('0x20')](function(_0x343aa3){if(_0x343aa3&&_0x343aa3[_0x0884('0xd5')]&&_0x26119f[_0x0884('0xd6')]&&_0x26119f[_0x0884('0xd7')]){var _0x55fc98={'tls':{'rejectUnauthorized':![]}};if(_0x343aa3[_0x0884('0xd5')][_0x0884('0xd8')]){_0x55fc98[_0x0884('0xd8')]=_0x343aa3['Smtp'][_0x0884('0xd8')];}else{_0x55fc98[_0x0884('0xd9')]=_0x343aa3[_0x0884('0xd5')][_0x0884('0xd9')];_0x55fc98[_0x0884('0xda')]=_0x343aa3['Smtp'][_0x0884('0xda')];_0x55fc98[_0x0884('0xdb')]=_0x343aa3[_0x0884('0xd5')][_0x0884('0xdb')];}if(_0x343aa3[_0x0884('0xd5')]['authentication']){_0x55fc98[_0x0884('0xdc')]={'user':_0x343aa3[_0x0884('0xd5')][_0x0884('0x5d')],'pass':_0x343aa3[_0x0884('0xd5')][_0x0884('0xdd')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x55fc98,'message':{'from':util[_0x0884('0xae')](_0x0884('0xde'),_0x343aa3[_0x0884('0x39')],_0x343aa3['email']||_0x343aa3['Smtp'][_0x0884('0x5d')]),'to':_0x26119f[_0x0884('0xd7')],'subject':_0x26119f[_0x0884('0xdf')],'html':_0x31ee05[_0x0884('0x5c')],'attachments':_0x4390b5}},client9003)[_0x0884('0x20')](function(){return _0x31ee05;})[_0x0884('0x55')](function(_0x29885e){console[_0x0884('0x26')](_0x29885e);});}})[_0x0884('0x20')](function(){if(_0x26119f&&_0x26119f[_0x0884('0xd4')]&&_0x26119f[_0x0884('0xe0')]){var _0x4fba74=[];if(_0x5d43a9['length']){_0x4fba74=_0x5d43a9[_0x0884('0x3c')](function(_0x3dd7d0){return{'name':_0x3dd7d0[_0x0884('0xe1')],'basename':_0x3dd7d0[_0x0884('0x6e')],'type':_0x3dd7d0[_0x0884('0xcf')],'ChatOfflineMessageId':_0x3ae8a0['id']};});}var _0x33876f;if(!_[_0x0884('0x7b')](_0x26119f[_0x0884('0xe2')])){var _0x74d25c=_['map'](_0x3082d2[_0x0884('0x5c')],function(_0x4c229a){return _0x4c229a;});var _0x3a5e50=_[_0x0884('0xe3')](_0x74d25c)[0x0];var _0x3cc0f0=_[_0x0884('0xe4')](_0x3a5e50,function(_0x2d5dcf){return _0x2d5dcf;});_0x33876f=_0x3cc0f0[0x1][_0x26119f[_0x0884('0xe2')]];}var _0x591c16={'from':_0x4774ea[_0x0884('0xe5')],'firstName':_0x4774ea[_0x0884('0xa8')],'lastName':_0x4774ea['lastName'],'mapKey':_0x0884('0xe5'),'message':{'from':_0x4774ea[_0x0884('0xe5')],'to':_0x26119f['MailAccount']['email'],'cc':'','subject':_[_0x0884('0x7b')](_0x33876f)?_0x26119f[_0x0884('0xdf')]:_0x33876f,'messageId':'','sentAt':new Date(),'attach':_0x4fba74[_0x0884('0x48')],'attachments':_0x4fba74,'originChannel':'Chat','ChatWebsiteId':_0x26119f['id'],'ChatOfflineMessageId':_0x31ee05['id'],'originTo':_0x26119f[_0x0884('0xc7')][_0x0884('0xe5')]},'body':_0x31ee05[_0x0884('0x5c')]};var _0x258f86={'account':{'id':_0x26119f[_0x0884('0xe0')]},'body':_0x591c16,'log':_0x0884('0xe6')};return respondWithRpcPromise(_0x0884('0xe6'),_0x0884('0xe7'),_0x258f86,client9001)[_0x0884('0x20')](function(){return _0x31ee05;})[_0x0884('0x55')](function(_0x53e9ac){console[_0x0884('0x26')](_0x53e9ac);});}return;})[_0x0884('0x20')](function(){if(_0x31ee05){return _0x31ee05;}})['then'](respondWithResult(_0x14bdec,null))[_0x0884('0x55')](function(_0x4ee52a){console['error'](_0x0884('0x55'),_0x4ee52a);for(var _0x335ba5 of _0x5d43a9){var _0xb2529=path['join'](config['root'],'server',_0x0884('0xd0'),_0x0884('0xd1'),_0x0884('0xd2'),_0x335ba5[_0x0884('0x6e')]);fs_extra[_0x0884('0xe8')](_0xb2529)[_0x0884('0x55')](function(_0x2a0c84){console[_0x0884('0x26')](_0x0884('0xe9'),_0xb2529,_0x2a0c84);});}});};exports[_0x0884('0xea')]=function(_0x5de09a,_0x3dc598,_0x552c13){return db['ChatInteraction'][_0x0884('0x5a')]({'where':{'id':_0x5de09a[_0x0884('0x57')]['id']}})['then'](handleEntityNotFound(_0x3dc598,null))[_0x0884('0x20')](function(_0x55230e){if(_0x55230e){return _0x55230e[_0x0884('0xea')](_0x5de09a[_0x0884('0x5c')]['ids'],_[_0x0884('0xeb')](_0x5de09a[_0x0884('0x5c')],[_0x0884('0x69'),'id'])||{});}})[_0x0884('0x20')](respondWithResult(_0x3dc598,null))[_0x0884('0x55')](handleError(_0x3dc598,null));};exports[_0x0884('0xec')]=function(_0x1e6e58,_0x440702,_0x296239){var _0x510a9f={'raw':![],'where':{}};var _0x3aa5ea={};var _0x54abff={'count':0x0,'rows':[]};return db[_0x0884('0x53')]['findOne']({'where':{'id':_0x1e6e58['params']['id']}})[_0x0884('0x20')](handleEntityNotFound(_0x440702,null))['then'](function(_0x217238){if(_0x217238){_0x3aa5ea[_0x0884('0x45')]=_[_0x0884('0x42')](db[_0x0884('0xb5')][_0x0884('0x3d')]);_0x3aa5ea[_0x0884('0x41')]=_[_0x0884('0x42')](_0x1e6e58[_0x0884('0x41')]);_0x3aa5ea[_0x0884('0x43')]=_[_0x0884('0x44')](_0x3aa5ea[_0x0884('0x45')],_0x3aa5ea[_0x0884('0x41')]);_0x510a9f[_0x0884('0x46')]=_[_0x0884('0x44')](_0x3aa5ea[_0x0884('0x45')],qs[_0x0884('0x47')](_0x1e6e58[_0x0884('0x41')][_0x0884('0x47')]));_0x510a9f[_0x0884('0x46')]=_0x510a9f['attributes']['length']?_0x510a9f[_0x0884('0x46')]:_0x3aa5ea[_0x0884('0x45')];if(!_0x1e6e58[_0x0884('0x41')][_0x0884('0x6c')](_0x0884('0x49'))){_0x510a9f[_0x0884('0x2f')]=qs[_0x0884('0x2f')](_0x1e6e58[_0x0884('0x41')]['limit']);_0x510a9f[_0x0884('0x2d')]=qs[_0x0884('0x2d')](_0x1e6e58[_0x0884('0x41')]['offset']);}_0x510a9f[_0x0884('0x4a')]=qs[_0x0884('0x4b')](_0x1e6e58[_0x0884('0x41')][_0x0884('0x4b')]);_0x510a9f['where']=qs['filters'](_[_0x0884('0x4d')](_0x1e6e58[_0x0884('0x41')],_0x3aa5ea[_0x0884('0x43')]));_0x510a9f[_0x0884('0x4c')][_0x0884('0x66')]=_0x217238['id'];if(_0x1e6e58[_0x0884('0x41')]['filter']){_0x510a9f[_0x0884('0x4c')]=_[_0x0884('0x4f')](_0x510a9f[_0x0884('0x4c')],{'$or':_['map'](_0x510a9f[_0x0884('0x46')],function(_0x48b0c7){var _0xbb1dbc={};_0xbb1dbc[_0x48b0c7]={'$like':'%'+_0x1e6e58['query']['filter']+'%'};return _0xbb1dbc;})});}_0x510a9f=_[_0x0884('0x4f')]({},_0x510a9f,_0x1e6e58[_0x0884('0x51')]);return db[_0x0884('0xb5')][_0x0884('0x30')]({'where':_0x510a9f[_0x0884('0x4c')]})[_0x0884('0x20')](function(_0x7c9425){_0x54abff[_0x0884('0x30')]=_0x7c9425;if(_0x1e6e58['query'][_0x0884('0x59')]){_0x510a9f['include']=[{'model':db['CmContact'],'as':_0x0884('0xed'),'required':![]},{'model':db['User'],'as':_0x0884('0xee'),'attributes':[_0x0884('0x39'),_0x0884('0xef'),'internal'],'required':![]},{'model':db[_0x0884('0xf0')],'as':_0x0884('0xf1'),'attributes':['id',_0x0884('0x39'),_0x0884('0xf2')],'where':_0x1e6e58[_0x0884('0x41')][_0x0884('0xf3')]?{'id':_0x1e6e58[_0x0884('0x41')]['tag']}:undefined,'required':_0x1e6e58[_0x0884('0x41')][_0x0884('0xf3')]?!![]:![]}];}return db['ChatInteraction'][_0x0884('0x67')](_0x510a9f);})['then'](function(_0x151fc9){_0x54abff[_0x0884('0x54')]=_0x151fc9;return _0x54abff;});}})['then'](respondWithFilteredResult(_0x440702,_0x510a9f))['catch'](handleError(_0x440702,null));};function iftimePromise(_0x461a26,_0x2e4145){return respondWithRpcPromise(_0x0884('0xf4'),'getSnippet',{'command':_0x2e4145[_0x0884('0xf5')]?util[_0x0884('0xae')](_0x0884('0xf6'),_0x461a26[_0x0884('0xf7')],_0x2e4145['timezone']):util[_0x0884('0xae')]('iftime\x20%s',_0x461a26[_0x0884('0xf7')])},client9002)['then'](function(_0x3ab80b){var _0x2a9452=_0x3ab80b&&_0x3ab80b[_0x0884('0xf8')](_0x0884('0xf9'))>=0x0?!![]:![];logger['info'](_0x0884('0xfa'),_0x2e4145['id'],_0x461a26['id'],_0x461a26[_0x0884('0xf7')],_0x2a9452?_0x0884('0xfb'):_0x0884('0xfc'),_0x2e4145[_0x0884('0xf5')]?_0x2e4145[_0x0884('0xf5')]:_0x0884('0xfd'));return _0x2a9452;})[_0x0884('0x55')](function(_0x14c9da){logger[_0x0884('0x26')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x2e4145['id'],_0x461a26['id'],_0x461a26[_0x0884('0xf7')],util[_0x0884('0xfe')](_0x14c9da,{'showHidden':![],'depth':null}),_0x2e4145['timezone']?_0x2e4145[_0x0884('0xf5')]:_0x0884('0xfd'));return![];});}exports[_0x0884('0xff')]=function(_0x22326b,_0x22b200,_0x14cd24){var _0x26a319=0x0;var _0x89d88=0x0;var _0x5d313c=![];var _0x1c45ff;var _0x2c9af1;return db['ChatWebsite']['find']({'where':{'id':_0x22326b[_0x0884('0x57')]['id']},'include':[{'model':db[_0x0884('0x100')],'as':_0x0884('0x100'),'include':[{'model':db[_0x0884('0x100')],'as':_0x0884('0x101'),'attributes':['id',_0x0884('0xf7')],'raw':!![]}]}]})[_0x0884('0x20')](handleEntityNotFound(_0x22b200,null))[_0x0884('0x20')](function(_0x5db9aa){if(_0x5db9aa){_0x1c45ff=_0x5db9aa;return _0x5db9aa['getProactiveActions']({'raw':!![]});}})[_0x0884('0x20')](function(_0x44c025){if(_0x1c45ff){if(_0x44c025){_0x2c9af1=_0x44c025;}}return require('../../config/license/util')[_0x0884('0x79')]();})['then'](function(_0x2b690b){if(_0x2b690b){_0x89d88=_0x2b690b[_0x0884('0x102')];_0x5d313c=_0x2b690b[_0x0884('0x7a')];}})[_0x0884('0x20')](function(){return db[_0x0884('0xb5')][_0x0884('0x30')]({'where':{'closed':![]}});})[_0x0884('0x20')](function(_0x577388){_0x26a319=_0x577388;if(_0x89d88&&_0x577388>_0x89d88){return db[_0x0884('0x103')][_0x0884('0x64')]({'where':{'id':0x1}})[_0x0884('0x20')](function(_0x279985){if(_0x279985){_0x279985[_0x0884('0x104')](_0x0884('0x105'));}});}})['then'](function(){if(_0x1c45ff[_0x0884('0x100')]&&_0x1c45ff['Interval']['Intervals']){var _0x1e0492=[];for(var _0x3a9425=0x0;_0x3a9425<_0x1c45ff[_0x0884('0x100')][_0x0884('0x101')][_0x0884('0x48')];_0x3a9425++){var _0x3037f4=_0x1c45ff[_0x0884('0x100')][_0x0884('0x101')][_0x3a9425]['get']({'plain':!![]});_0x1e0492['push'](iftimePromise(_0x3037f4,_0x1c45ff));}return BPromise['all'](_0x1e0492)[_0x0884('0x20')](function(_0xb10769){return _[_0x0884('0x106')](_0xb10769);});}else{return!![];}})[_0x0884('0x20')](function(_0xf9141e){var _0x5f013f=fs[_0x0884('0xca')](path[_0x0884('0x75')](config[_0x0884('0x76')],_0x0884('0x107')),'utf8');var _0x26bac3={'remote':_0x1c45ff[_0x0884('0x108')],'query':querystring[_0x0884('0x109')](_['merge'](_0x1c45ff[_0x0884('0x5f')]({'plain':!![]}),{'customerIp':_0x22326b[_0x0884('0x89')][_0x0884('0xa6')]||_0x22326b['headers'][_0x0884('0x10a')]||_0x22326b[_0x0884('0x10b')][_0x0884('0x10c')]||_0x22326b['ip'],'referer':_0x22326b[_0x0884('0x89')]['referer'],'openedInteractions':_0x26a319,'maxInteractions':_0x89d88,'virtual':_0x5d313c[_0x0884('0x102')],'online':_0xf9141e,'custom':_0x5d313c}))[_0x0884('0x10d')](/'/g,'\x5c\x27')};_0x22b200[_0x0884('0xc4')](ejs['render'](Mustache[_0x0884('0x10e')](_0x5f013f,_0x26bac3),{'proactiveActions':_0x2c9af1,'alignment':_0x1c45ff[_0x0884('0x10f')],'verticalAlignment':_0x1c45ff['verticalAlignment'],'div_color':_0x1c45ff[_0x0884('0xf2')],'text_color':_0x1c45ff[_0x0884('0x110')],'button_color':_0x1c45ff[_0x0884('0x111')],'background_color':_0x1c45ff['backgroundColor']}));})[_0x0884('0x55')](handleError(_0x22b200,null));};exports[_0x0884('0x112')]=function(_0x36ca86,_0x1a651b,_0x5bfad5){return db[_0x0884('0x53')][_0x0884('0x64')]({'where':{'id':_0x36ca86[_0x0884('0x57')]['id']}})[_0x0884('0x20')](handleEntityNotFound(_0x1a651b,null))['then'](function(_0x22e791){if(_0x22e791){return db[_0x0884('0x113')]['transaction'](function(_0x2b9855){return db[_0x0884('0x114')][_0x0884('0x38')]({'where':{'ChatWebsiteId':_0x36ca86[_0x0884('0x57')]['id']},'transaction':_0x2b9855})[_0x0884('0x20')](function(_0x805ca6){var _0x328b8e=_[_0x0884('0x3c')](_0x36ca86['body'],function(_0x5b6e35){_0x5b6e35[_0x0884('0x66')]=_0x36ca86['params']['id'];return _0x5b6e35;});return db[_0x0884('0x114')][_0x0884('0x115')](_0x328b8e,{'transaction':_0x2b9855});});})['then'](function(){return db[_0x0884('0x114')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x36ca86[_0x0884('0x57')]['id']},'order':_0x0884('0x116')});});}})[_0x0884('0x20')](respondWithResult(_0x1a651b,null))[_0x0884('0x55')](handleError(_0x1a651b,null));};exports['getApplications']=function(_0x53f796,_0x1ccb09,_0x2aa02e){var _0x1dce07={};var _0x36051d={};var _0x32f1f6;var _0x53214c;return db[_0x0884('0x53')]['findOne']({'where':{'id':_0x53f796[_0x0884('0x57')]['id']}})['then'](handleEntityNotFound(_0x1ccb09,null))[_0x0884('0x20')](function(_0x256b01){if(_0x256b01){_0x32f1f6=_0x256b01;_0x36051d[_0x0884('0x45')]=_[_0x0884('0x42')](db[_0x0884('0x114')]['rawAttributes']);_0x36051d[_0x0884('0x41')]=_[_0x0884('0x42')](_0x53f796['query']);_0x36051d[_0x0884('0x43')]=_['intersection'](_0x36051d[_0x0884('0x45')],_0x36051d[_0x0884('0x41')]);_0x1dce07[_0x0884('0x46')]=_['intersection'](_0x36051d[_0x0884('0x45')],qs[_0x0884('0x47')](_0x53f796[_0x0884('0x41')][_0x0884('0x47')]));_0x1dce07[_0x0884('0x46')]=_0x1dce07[_0x0884('0x46')][_0x0884('0x48')]?_0x1dce07[_0x0884('0x46')]:_0x36051d['model'];_0x1dce07['order']=qs['sort'](_0x53f796[_0x0884('0x41')][_0x0884('0x4b')]);_0x1dce07[_0x0884('0x4c')]=qs['filters'](_[_0x0884('0x4d')](_0x53f796[_0x0884('0x41')],_0x36051d[_0x0884('0x43')]));if(_0x53f796[_0x0884('0x41')][_0x0884('0x4e')]){_0x1dce07[_0x0884('0x4c')]=_[_0x0884('0x4f')](_0x1dce07['where'],{'$or':_[_0x0884('0x3c')](_0x1dce07['attributes'],function(_0x17b812){var _0x521ecb={};_0x521ecb[_0x17b812]={'$like':'%'+_0x53f796[_0x0884('0x41')]['filter']+'%'};return _0x521ecb;})});}_0x1dce07=_[_0x0884('0x4f')]({},_0x1dce07,_0x53f796[_0x0884('0x51')]);return _0x32f1f6[_0x0884('0x117')](_0x1dce07);}})['then'](function(_0x6dff7c){if(_0x6dff7c){_0x53214c=_0x6dff7c[_0x0884('0x48')];if(!_0x53f796['query'][_0x0884('0x6c')](_0x0884('0x49'))){_0x1dce07[_0x0884('0x2f')]=qs['limit'](_0x53f796['query'][_0x0884('0x2f')]);_0x1dce07[_0x0884('0x2d')]=qs[_0x0884('0x2d')](_0x53f796[_0x0884('0x41')][_0x0884('0x2d')]);}return _0x32f1f6['getApplications'](_0x1dce07);}})[_0x0884('0x20')](function(_0xb9920b){if(_0xb9920b){return _0xb9920b?{'count':_0x53214c,'rows':_0xb9920b}:null;}})[_0x0884('0x20')](respondWithResult(_0x1ccb09,null))[_0x0884('0x55')](handleError(_0x1ccb09,null));};exports[_0x0884('0x118')]=function(_0x32e9a8,_0xf2ad19,_0x48d17e){return db[_0x0884('0x119')][_0x0884('0x5a')]({'where':{'id':_0x32e9a8['params']['id']}})['then'](handleEntityNotFound(_0xf2ad19,null))[_0x0884('0x20')](function(_0x4dd18b){if(_0x4dd18b){return _0x4dd18b['addProactiveActions'](_0x32e9a8['body'][_0x0884('0x69')],_[_0x0884('0xeb')](_0x32e9a8[_0x0884('0x5c')],[_0x0884('0x69'),'id'])||{});}})[_0x0884('0x20')](respondWithResult(_0xf2ad19,null))[_0x0884('0x55')](handleError(_0xf2ad19,null));};exports[_0x0884('0x11a')]=function(_0x44a494,_0x3f14ff,_0xaff4e3){var _0x4e252b={};var _0x5cdb3d={};var _0x5eb535;var _0x3f2b8b;return db['ChatWebsite'][_0x0884('0x64')]({'where':{'id':_0x44a494[_0x0884('0x57')]['id']}})[_0x0884('0x20')](handleEntityNotFound(_0x3f14ff,null))[_0x0884('0x20')](function(_0x4ccf85){if(_0x4ccf85){_0x5eb535=_0x4ccf85;_0x5cdb3d['model']=_[_0x0884('0x42')](db[_0x0884('0x11b')]['rawAttributes']);_0x5cdb3d[_0x0884('0x41')]=_[_0x0884('0x42')](_0x44a494[_0x0884('0x41')]);_0x5cdb3d['filters']=_[_0x0884('0x44')](_0x5cdb3d[_0x0884('0x45')],_0x5cdb3d['query']);_0x4e252b[_0x0884('0x46')]=_[_0x0884('0x44')](_0x5cdb3d['model'],qs[_0x0884('0x47')](_0x44a494[_0x0884('0x41')]['fields']));_0x4e252b[_0x0884('0x46')]=_0x4e252b[_0x0884('0x46')][_0x0884('0x48')]?_0x4e252b['attributes']:_0x5cdb3d[_0x0884('0x45')];_0x4e252b[_0x0884('0x4a')]=qs[_0x0884('0x4b')](_0x44a494[_0x0884('0x41')][_0x0884('0x4b')]);_0x4e252b[_0x0884('0x4c')]=qs[_0x0884('0x43')](_[_0x0884('0x4d')](_0x44a494[_0x0884('0x41')],_0x5cdb3d[_0x0884('0x43')]));if(_0x44a494[_0x0884('0x41')][_0x0884('0x4e')]){_0x4e252b['where']=_['merge'](_0x4e252b[_0x0884('0x4c')],{'$or':_[_0x0884('0x3c')](_0x4e252b[_0x0884('0x46')],function(_0x3f50da){var _0x44dd4b={};_0x44dd4b[_0x3f50da]={'$like':'%'+_0x44a494[_0x0884('0x41')][_0x0884('0x4e')]+'%'};return _0x44dd4b;})});}_0x4e252b=_[_0x0884('0x4f')]({},_0x4e252b,_0x44a494['options']);return _0x5eb535['getProactiveActions'](_0x4e252b);}})[_0x0884('0x20')](function(_0x4eaea6){if(_0x4eaea6){_0x3f2b8b=_0x4eaea6[_0x0884('0x48')];if(!_0x44a494['query']['hasOwnProperty'](_0x0884('0x49'))){_0x4e252b['limit']=qs['limit'](_0x44a494['query'][_0x0884('0x2f')]);_0x4e252b[_0x0884('0x2d')]=qs[_0x0884('0x2d')](_0x44a494[_0x0884('0x41')]['offset']);}return _0x5eb535[_0x0884('0x11a')](_0x4e252b);}})['then'](function(_0x2c044a){if(_0x2c044a){return _0x2c044a?{'count':_0x3f2b8b,'rows':_0x2c044a}:null;}})[_0x0884('0x20')](respondWithResult(_0x3f14ff,null))[_0x0884('0x55')](handleError(_0x3f14ff,null));};exports[_0x0884('0x11c')]=function(_0x216c50,_0x153614,_0x2de6c3){var _0xc2c501=_0x216c50['query'][_0x0884('0x11d')]==='false'?_0x0884('0x11e'):_0x0884('0x11f');return db[_0x0884('0x53')]['find']({'attributes':['id',_0xc2c501],'where':{'id':_0x216c50['params']['id']}})[_0x0884('0x20')](handleEntityNotFound(_0x153614,null))['then'](function(_0x17d5b2){if(_0x17d5b2){var _0x44d714=_0x17d5b2[_0xc2c501];var _0xa7f683=_0x44d714&&_0x44d714['items']?_0x44d714[_0x0884('0x120')]:[];_0x153614[_0x0884('0xc4')]({'fromKey':_['isNil'](_0x44d714[_0x0884('0x121')])?undefined:_0x44d714[_0x0884('0x121')],'count':_0xa7f683[_0x0884('0x48')],'rows':_0xa7f683});}})['catch'](handleError(_0x153614,null));};exports[_0x0884('0x122')]=function(_0x1fc1c2,_0x3cdfc7,_0x176fc9){var _0x36e426={'raw':![],'where':{}};var _0x80b33b={};var _0x3e69f3={'count':0x0,'rows':[]};return db[_0x0884('0x53')]['findOne']({'where':{'id':_0x1fc1c2[_0x0884('0x57')]['id']}})[_0x0884('0x20')](handleEntityNotFound(_0x3cdfc7,null))[_0x0884('0x20')](function(_0x542034){if(_0x542034){_0x80b33b[_0x0884('0x45')]=_[_0x0884('0x42')](db['ChatOfflineMessage'][_0x0884('0x3d')]);_0x80b33b['query']=_[_0x0884('0x42')](_0x1fc1c2[_0x0884('0x41')]);_0x80b33b[_0x0884('0x43')]=_[_0x0884('0x44')](_0x80b33b[_0x0884('0x45')],_0x80b33b['query']);_0x36e426[_0x0884('0x46')]=_['intersection'](_0x80b33b[_0x0884('0x45')],qs['fields'](_0x1fc1c2[_0x0884('0x41')]['fields']));_0x36e426[_0x0884('0x46')]=_0x36e426[_0x0884('0x46')][_0x0884('0x48')]?_0x36e426['attributes']:_0x80b33b[_0x0884('0x45')];if(!_0x1fc1c2[_0x0884('0x41')][_0x0884('0x6c')]('nolimit')){_0x36e426[_0x0884('0x2f')]=qs[_0x0884('0x2f')](_0x1fc1c2['query']['limit']);_0x36e426[_0x0884('0x2d')]=qs[_0x0884('0x2d')](_0x1fc1c2['query'][_0x0884('0x2d')]);}_0x36e426[_0x0884('0x4a')]=qs[_0x0884('0x4b')](_0x1fc1c2[_0x0884('0x41')][_0x0884('0x4b')]);_0x36e426[_0x0884('0x4c')]=qs['filters'](_['pick'](_0x1fc1c2[_0x0884('0x41')],_0x80b33b[_0x0884('0x43')]));_0x36e426[_0x0884('0x4c')][_0x0884('0x66')]=_0x542034['id'];if(_0x1fc1c2[_0x0884('0x41')][_0x0884('0x4e')]){_0x36e426[_0x0884('0x4c')]=_[_0x0884('0x4f')](_0x36e426['where'],{'$or':_[_0x0884('0x3c')](_0x36e426['attributes'],function(_0x521bcc){var _0x2aae06={};_0x2aae06[_0x521bcc]={'$like':'%'+_0x1fc1c2[_0x0884('0x41')][_0x0884('0x4e')]+'%'};return _0x2aae06;})});}_0x36e426=_['merge']({},_0x36e426,_0x1fc1c2[_0x0884('0x51')]);return db[_0x0884('0x123')][_0x0884('0x30')]({'where':_0x36e426[_0x0884('0x4c')]})['then'](function(_0x5d2923){_0x3e69f3[_0x0884('0x30')]=_0x5d2923;if(_0x1fc1c2['query'][_0x0884('0x59')]){_0x36e426[_0x0884('0x52')]=[{'all':!![]}];}else{_0x36e426[_0x0884('0x52')]=[{'model':db[_0x0884('0x8c')],'as':'Contact','required':![]},{'model':db[_0x0884('0x124')],'as':_0x0884('0x125'),'required':![]}];}return db['ChatOfflineMessage'][_0x0884('0x67')](_0x36e426);})[_0x0884('0x20')](function(_0x3e5989){_0x3e69f3[_0x0884('0x54')]=_0x3e5989;return _0x3e69f3;});}})['then'](respondWithFilteredResult(_0x3cdfc7,_0x36e426))[_0x0884('0x55')](handleError(_0x3cdfc7,null));};exports[_0x0884('0x126')]=function(_0x877d3c,_0x38477b,_0x20b176){return db[_0x0884('0x53')][_0x0884('0x5a')]({'where':{'id':_0x877d3c[_0x0884('0x57')]['id']}})[_0x0884('0x20')](handleEntityNotFound(_0x38477b,null))['then'](function(_0x1bf650){if(_0x1bf650){return _0x1bf650['addAgents'](_0x877d3c[_0x0884('0x5c')][_0x0884('0x69')],_['omit'](_0x877d3c[_0x0884('0x5c')],[_0x0884('0x69'),'id'])||{})[_0x0884('0xc9')](function(_0x1265a3){for(var _0x20717e=0x0;_0x20717e<_0x877d3c[_0x0884('0x5c')][_0x0884('0x69')][_0x0884('0x48')];_0x20717e+=0x1){socket[_0x0884('0x127')]('userChatWebsite:save',{'UserId':Number(_0x877d3c[_0x0884('0x5c')][_0x0884('0x69')][_0x20717e]),'ChatWebsiteId':Number(_0x877d3c[_0x0884('0x57')]['id'])});}return _0x1265a3;});}})[_0x0884('0x20')](respondWithResult(_0x38477b,null))[_0x0884('0x55')](handleError(_0x38477b,null));};exports['removeAgents']=function(_0x1d43b4,_0x2105b2,_0x1f9f95){return db[_0x0884('0x53')][_0x0884('0x5a')]({'where':{'id':_0x1d43b4['params']['id']}})[_0x0884('0x20')](handleEntityNotFound(_0x2105b2,null))[_0x0884('0x20')](function(_0x506433){if(_0x506433){return _0x506433['removeAgents'](_0x1d43b4[_0x0884('0x41')][_0x0884('0x69')])['then'](function(){if(_[_0x0884('0x128')](_0x1d43b4[_0x0884('0x41')][_0x0884('0x69')])){for(var _0x2f8a25=0x0;_0x2f8a25<_0x1d43b4[_0x0884('0x41')][_0x0884('0x69')][_0x0884('0x48')];_0x2f8a25+=0x1){socket[_0x0884('0x127')]('userChatWebsite:remove',{'UserId':Number(_0x1d43b4[_0x0884('0x41')][_0x0884('0x69')][_0x2f8a25]),'ChatWebsiteId':Number(_0x1d43b4[_0x0884('0x57')]['id'])});}}else{socket[_0x0884('0x127')](_0x0884('0x129'),{'UserId':Number(_0x1d43b4['query'][_0x0884('0x69')]),'ChatWebsiteId':Number(_0x1d43b4[_0x0884('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x2105b2,null))[_0x0884('0x55')](handleError(_0x2105b2,null));};exports[_0x0884('0x12a')]=function(_0x15025a,_0x5ef7a5,_0x455a71){var _0x106b12={};var _0x34415e={};var _0x43c927;var _0x6e8b6e;return db[_0x0884('0x53')][_0x0884('0x64')]({'where':{'id':_0x15025a[_0x0884('0x57')]['id']}})[_0x0884('0x20')](handleEntityNotFound(_0x5ef7a5,null))[_0x0884('0x20')](function(_0x29f360){if(_0x29f360){_0x43c927=_0x29f360;_0x34415e[_0x0884('0x45')]=_[_0x0884('0x42')](db['User'][_0x0884('0x3d')]);_0x34415e[_0x0884('0x41')]=_[_0x0884('0x42')](_0x15025a['query']);_0x34415e[_0x0884('0x43')]=_['intersection'](_0x34415e[_0x0884('0x45')],_0x34415e[_0x0884('0x41')]);_0x106b12[_0x0884('0x46')]=_[_0x0884('0x44')](_0x34415e[_0x0884('0x45')],qs[_0x0884('0x47')](_0x15025a[_0x0884('0x41')][_0x0884('0x47')]));_0x106b12[_0x0884('0x46')]=_0x106b12[_0x0884('0x46')][_0x0884('0x48')]?_0x106b12[_0x0884('0x46')]:_0x34415e['model'];_0x106b12['order']=qs[_0x0884('0x4b')](_0x15025a['query'][_0x0884('0x4b')]);_0x106b12[_0x0884('0x4c')]=qs[_0x0884('0x43')](_[_0x0884('0x4d')](_0x15025a[_0x0884('0x41')],_0x34415e[_0x0884('0x43')]));if(_0x15025a['query'][_0x0884('0x4e')]){_0x106b12[_0x0884('0x4c')]=_[_0x0884('0x4f')](_0x106b12[_0x0884('0x4c')],{'$or':_[_0x0884('0x3c')](_0x106b12[_0x0884('0x46')],function(_0x5346a3){var _0x6617bf={};_0x6617bf[_0x5346a3]={'$like':'%'+_0x15025a['query'][_0x0884('0x4e')]+'%'};return _0x6617bf;})});}_0x106b12=_[_0x0884('0x4f')]({},_0x106b12,_0x15025a[_0x0884('0x51')]);return _0x43c927['getAgents'](_0x106b12);}})[_0x0884('0x20')](function(_0xbb0474){if(_0xbb0474){_0x6e8b6e=_0xbb0474[_0x0884('0x48')];if(!_0x15025a['query'][_0x0884('0x6c')](_0x0884('0x49'))){_0x106b12[_0x0884('0x2f')]=qs[_0x0884('0x2f')](_0x15025a[_0x0884('0x41')]['limit']);_0x106b12[_0x0884('0x2d')]=qs[_0x0884('0x2d')](_0x15025a['query'][_0x0884('0x2d')]);}return _0x43c927['getAgents'](_0x106b12);}})[_0x0884('0x20')](function(_0x559834){if(_0x559834){return _0x559834?{'count':_0x6e8b6e,'rows':_0x559834}:null;}})[_0x0884('0x20')](respondWithResult(_0x5ef7a5,null))[_0x0884('0x55')](handleError(_0x5ef7a5,null));}; \ No newline at end of file +var _0x807c=['Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','License','chatLicenseExceeded','all','some','remote','connection','virtual','replace','alignment','textColor','color_button','backgroundColor','transaction','bulkCreate','findAndCountAll','getApplications','addProactiveActions','ChatProactiveAction','online','offlineForm','items','fromKey','getOfflineMessages','Contact','Attachments','addAgents','emit','userChatWebsite:save','isArray','userChatWebsite:remove','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','http','client','info','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','then','get','stack','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','filter','options','ChatWebsite','includeAll','include','findAll','rows','catch','params','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','describe','addDisposition','ChatWebsiteId','getDispositions','findOne','Disposition','length','nolimit','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','account','list','applications','priority','asc','defaults','customerIp','cf-connecting-ip','x-forwarded-for','first','firstName','x-real-port','referer','browser','format','%s\x20%s','version','unknown','device','vendor','%s\x20%s\x20%s','type','threadId','ChatInteraction','ContactId','interaction','spread','contact','lastName','messageId','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','startRouting','Start','EventManager','offline','files','CompanyId','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','mimetype','attachments','basename','openNewInteraction','sequelize','Attachment','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','server','remove','Could\x20not\x20remove\x20attachment\x20file','omit','Owner','fullname','internal'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x807c,0x15d));var _0xc807=function(_0xfa4373,_0x4f26cc){_0xfa4373=_0xfa4373-0x0;var _0x40d370=_0x807c[_0xfa4373];return _0x40d370;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc807('0x0'));var jsonpatch=require(_0xc807('0x1'));var rp=require(_0xc807('0x2'));var moment=require(_0xc807('0x3'));var BPromise=require(_0xc807('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc807('0x5'));var ejs=require(_0xc807('0x6'));var fs=require('fs');var fs_extra=require(_0xc807('0x7'));var _=require(_0xc807('0x8'));var squel=require(_0xc807('0x9'));var crypto=require('crypto');var jsforce=require(_0xc807('0xa'));var deskjs=require(_0xc807('0xb'));var toCsv=require(_0xc807('0x5'));var querystring=require(_0xc807('0xc'));var Papa=require('papaparse');var Redis=require(_0xc807('0xd'));var authService=require(_0xc807('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc807('0xf'));var logger=require(_0xc807('0x10'))('api');var utils=require(_0xc807('0x11'));var config=require(_0xc807('0x12'));var licenseUtil=require(_0xc807('0x13'));var db=require(_0xc807('0x14'))['db'];config[_0xc807('0x15')]=_['defaults'](config[_0xc807('0x15')],{'host':_0xc807('0x16'),'port':0x18eb});var socket=require(_0xc807('0x17'))(new Redis(config[_0xc807('0x15')]));require(_0xc807('0x18'))[_0xc807('0x19')](socket);var jayson=require(_0xc807('0x1a'));var client=jayson['client'][_0xc807('0x1b')]({'port':0x232c});var client9002=jayson[_0xc807('0x1c')]['http']({'port':0x232a});var client9003=jayson[_0xc807('0x1c')][_0xc807('0x1b')]({'port':0x232b});var client9001=jayson['client']['http']({'port':0x2329});function respondWithRpcPromise(_0x507a4e,_0x216a02,_0x2da1f9,_0x33d1fa){return new BPromise(function(_0x103fb9,_0x24ea49){var _0xa9f72a=_0x33d1fa||client;return _0xa9f72a['request'](_0x507a4e,_0x2da1f9)['then'](function(_0x14ac06){logger[_0xc807('0x1d')]('ChatWebsite,\x20%s,\x20%s',_0x216a02,_0xc807('0x1e'));logger['debug'](_0xc807('0x1f'),_0x216a02,'request\x20sent',JSON[_0xc807('0x20')](_0x14ac06));if(_0x14ac06[_0xc807('0x21')]){if(_0x14ac06[_0xc807('0x21')][_0xc807('0x22')]===0x1f4){logger['error'](_0xc807('0x23'),_0x216a02,_0x14ac06[_0xc807('0x21')]['message']);return _0x24ea49(_0x14ac06[_0xc807('0x21')][_0xc807('0x24')]);}logger[_0xc807('0x21')](_0xc807('0x23'),_0x216a02,_0x14ac06[_0xc807('0x21')][_0xc807('0x24')]);return _0x103fb9(_0x14ac06[_0xc807('0x21')][_0xc807('0x24')]);}else{logger[_0xc807('0x1d')](_0xc807('0x23'),_0x216a02,_0xc807('0x1e'));_0x103fb9(_0x14ac06['result'][_0xc807('0x24')]);}})['catch'](function(_0x341609){logger[_0xc807('0x21')]('ChatWebsite,\x20%s,\x20%s',_0x216a02,_0x341609);_0x24ea49(_0x341609);});});}function respondWithStatusCode(_0x5b2a33,_0x1b790e){_0x1b790e=_0x1b790e||0xcc;return function(_0x5762f9){if(_0x5762f9){return _0x5b2a33[_0xc807('0x25')](_0x1b790e);}return _0x5b2a33[_0xc807('0x26')](_0x1b790e)[_0xc807('0x27')]();};}function respondWithResult(_0x1573cc,_0x1f915c){_0x1f915c=_0x1f915c||0xc8;return function(_0x5ce8af){if(_0x5ce8af){return _0x1573cc[_0xc807('0x26')](_0x1f915c)[_0xc807('0x28')](_0x5ce8af);}};}function respondWithFilteredResult(_0x446956,_0x5aa11c){return function(_0x4a64a9){if(_0x4a64a9){var _0x5c1f8d=typeof _0x5aa11c[_0xc807('0x29')]===_0xc807('0x2a')&&typeof _0x5aa11c['limit']===_0xc807('0x2a');var _0x247632=_0x4a64a9[_0xc807('0x2b')];var _0x233cc3=_0x5c1f8d?0x0:_0x5aa11c['offset'];var _0x4f7edb=_0x5c1f8d?_0x4a64a9[_0xc807('0x2b')]:_0x5aa11c['offset']+_0x5aa11c[_0xc807('0x2c')];var _0x389475;if(_0x4f7edb>=_0x247632){_0x4f7edb=_0x247632;_0x389475=0xc8;}else{_0x389475=0xce;}_0x446956[_0xc807('0x26')](_0x389475);return _0x446956[_0xc807('0x2d')](_0xc807('0x2e'),_0x233cc3+'-'+_0x4f7edb+'/'+_0x247632)[_0xc807('0x28')](_0x4a64a9);}return null;};}function patchUpdates(_0x3f0c6d){return function(_0x180b76){try{jsonpatch['apply'](_0x180b76,_0x3f0c6d,!![]);}catch(_0x3f193e){return BPromise['reject'](_0x3f193e);}return _0x180b76['save']();};}function saveUpdates(_0x3eec05,_0x410edf){return function(_0x3485b7){if(_0x3485b7){return _0x3485b7[_0xc807('0x2f')](_0x3eec05)['then'](function(_0x213ab1){return _0x213ab1;});}return null;};}function removeEntity(_0x142428,_0x485255){return function(_0x1fd595){if(_0x1fd595){return _0x1fd595[_0xc807('0x30')]()[_0xc807('0x31')](function(){var _0x4fee98=_0x1fd595[_0xc807('0x32')]({'plain':!![]});var _0x4afd99='ChatWebsites';return db['UserProfileResource']['destroy']({'where':{'type':_0x4afd99,'resourceId':_0x4fee98['id']}})['then'](function(){return _0x1fd595;});})[_0xc807('0x31')](function(){_0x142428[_0xc807('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b7e6a,_0x46f4fb){return function(_0x3993f6){if(!_0x3993f6){_0x4b7e6a['sendStatus'](0x194);}return _0x3993f6;};}function handleError(_0x102b2e,_0x1f3120){_0x1f3120=_0x1f3120||0x1f4;return function(_0x4cdf8a){logger[_0xc807('0x21')](_0x4cdf8a[_0xc807('0x33')]);if(_0x4cdf8a[_0xc807('0x34')]){delete _0x4cdf8a['name'];}_0x102b2e[_0xc807('0x26')](_0x1f3120)[_0xc807('0x35')](_0x4cdf8a);};}exports['index']=function(_0x37daac,_0x1621ff){var _0x17aeb2={'include':[{'model':db[_0xc807('0x36')],'as':_0xc807('0x37')}]},_0x292571={},_0x4c7480={'count':0x0,'rows':[]};var _0x14c250=_[_0xc807('0x38')](db['ChatWebsite'][_0xc807('0x39')],function(_0x58bf5a){return{'name':_0x58bf5a[_0xc807('0x3a')],'type':_0x58bf5a['type'][_0xc807('0x3b')]};});_0x292571['model']=_[_0xc807('0x38')](_0x14c250,'name');_0x292571[_0xc807('0x3c')]=_[_0xc807('0x3d')](_0x37daac['query']);_0x292571[_0xc807('0x3e')]=_[_0xc807('0x3f')](_0x292571[_0xc807('0x40')],_0x292571['query']);_0x17aeb2['attributes']=_[_0xc807('0x3f')](_0x292571['model'],qs[_0xc807('0x41')](_0x37daac[_0xc807('0x3c')][_0xc807('0x41')]));_0x17aeb2[_0xc807('0x42')]=_0x17aeb2[_0xc807('0x42')]['length']?_0x17aeb2[_0xc807('0x42')]:_0x292571[_0xc807('0x40')];if(!_0x37daac[_0xc807('0x3c')][_0xc807('0x43')]('nolimit')){_0x17aeb2[_0xc807('0x2c')]=qs[_0xc807('0x2c')](_0x37daac['query'][_0xc807('0x2c')]);_0x17aeb2[_0xc807('0x29')]=qs['offset'](_0x37daac[_0xc807('0x3c')][_0xc807('0x29')]);}_0x17aeb2[_0xc807('0x44')]=qs['sort'](_0x37daac[_0xc807('0x3c')][_0xc807('0x45')]);_0x17aeb2[_0xc807('0x46')]=qs[_0xc807('0x3e')](_[_0xc807('0x47')](_0x37daac['query'],_0x292571['filters']),_0x14c250);if(_0x37daac[_0xc807('0x3c')]['filter']){_0x17aeb2[_0xc807('0x46')]=_[_0xc807('0x48')](_0x17aeb2[_0xc807('0x46')],{'$or':_['map'](_0x14c250,function(_0x171065){if(_0x171065['type']!=='VIRTUAL'){var _0x28dc76={};_0x28dc76[_0x171065[_0xc807('0x34')]]={'$like':'%'+_0x37daac[_0xc807('0x3c')][_0xc807('0x49')]+'%'};return _0x28dc76;}})});}_0x17aeb2=_['merge']({},_0x17aeb2,_0x37daac[_0xc807('0x4a')]);var _0x1b1a3d={'where':_0x17aeb2[_0xc807('0x46')]};return db[_0xc807('0x4b')]['count'](_0x1b1a3d)[_0xc807('0x31')](function(_0x588d5f){_0x4c7480[_0xc807('0x2b')]=_0x588d5f;if(_0x37daac[_0xc807('0x3c')][_0xc807('0x4c')]){_0x17aeb2[_0xc807('0x4d')]=[{'all':!![]}];}return db['ChatWebsite'][_0xc807('0x4e')](_0x17aeb2);})[_0xc807('0x31')](function(_0x2ff7f7){_0x4c7480[_0xc807('0x4f')]=_0x2ff7f7;return _0x4c7480;})['then'](respondWithFilteredResult(_0x1621ff,_0x17aeb2))[_0xc807('0x50')](handleError(_0x1621ff,null));};exports['show']=function(_0x2f4b07,_0x5cdd60){var _0x31f325={'raw':![],'where':{'id':_0x2f4b07[_0xc807('0x51')]['id']},'include':[{'model':db['Pause'],'as':_0xc807('0x37')}]},_0x37243d={};_0x37243d[_0xc807('0x40')]=_[_0xc807('0x3d')](db[_0xc807('0x4b')][_0xc807('0x39')]);_0x37243d['query']=_['keys'](_0x2f4b07[_0xc807('0x3c')]);_0x37243d[_0xc807('0x3e')]=_['intersection'](_0x37243d['model'],_0x37243d[_0xc807('0x3c')]);_0x31f325[_0xc807('0x42')]=_['intersection'](_0x37243d[_0xc807('0x40')],qs[_0xc807('0x41')](_0x2f4b07['query'][_0xc807('0x41')]));_0x31f325[_0xc807('0x42')]=_0x31f325[_0xc807('0x42')]['length']?_0x31f325['attributes']:_0x37243d[_0xc807('0x40')];if(_0x2f4b07[_0xc807('0x3c')][_0xc807('0x4c')]){_0x31f325[_0xc807('0x4d')]=[{'all':!![]}];}_0x31f325=_['merge']({},_0x31f325,_0x2f4b07[_0xc807('0x4a')]);return db['ChatWebsite']['find'](_0x31f325)[_0xc807('0x31')](handleEntityNotFound(_0x5cdd60,null))[_0xc807('0x31')](respondWithResult(_0x5cdd60,null))[_0xc807('0x50')](handleError(_0x5cdd60,null));};exports[_0xc807('0x52')]=function(_0x5d6ed5,_0x10e160){return db['ChatWebsite'][_0xc807('0x52')](_0x5d6ed5[_0xc807('0x53')],{})['then'](function(_0x57090e){var _0x551083=_0x5d6ed5[_0xc807('0x54')][_0xc807('0x32')]({'plain':!![]});if(!_0x551083)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x551083['role']===_0xc807('0x54')){var _0x21d7de=_0x57090e[_0xc807('0x32')]({'plain':!![]});var _0x46e59c='ChatWebsites';return db[_0xc807('0x55')][_0xc807('0x56')]({'where':{'name':_0x46e59c,'userProfileId':_0x551083[_0xc807('0x57')]},'raw':!![]})[_0xc807('0x31')](function(_0x25ae99){if(_0x25ae99&&_0x25ae99[_0xc807('0x58')]===0x0){return db[_0xc807('0x59')][_0xc807('0x52')]({'name':_0x21d7de['name'],'resourceId':_0x21d7de['id'],'type':_0x25ae99[_0xc807('0x34')],'sectionId':_0x25ae99['id']},{})[_0xc807('0x31')](function(){return _0x57090e;});}else{return _0x57090e;}})[_0xc807('0x50')](function(_0x2bdfc6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2bdfc6);throw _0x2bdfc6;});}return _0x57090e;})[_0xc807('0x31')](respondWithResult(_0x10e160,0xc9))[_0xc807('0x50')](handleError(_0x10e160,null));};exports[_0xc807('0x2f')]=function(_0x4a1e9a,_0x313c39){if(_0x4a1e9a[_0xc807('0x53')]['id']){delete _0x4a1e9a[_0xc807('0x53')]['id'];}return db[_0xc807('0x4b')][_0xc807('0x56')]({'where':{'id':_0x4a1e9a['params']['id']},'include':[{'model':db['Pause'],'as':_0xc807('0x37')}]})['then'](handleEntityNotFound(_0x313c39,null))[_0xc807('0x31')](saveUpdates(_0x4a1e9a[_0xc807('0x53')],null))[_0xc807('0x31')](respondWithResult(_0x313c39,null))[_0xc807('0x50')](handleError(_0x313c39,null));};exports[_0xc807('0x30')]=function(_0x3d24ae,_0x1c44c9){return db[_0xc807('0x4b')][_0xc807('0x56')]({'where':{'id':_0x3d24ae['params']['id']}})[_0xc807('0x31')](handleEntityNotFound(_0x1c44c9,null))[_0xc807('0x31')](removeEntity(_0x1c44c9,null))['catch'](handleError(_0x1c44c9,null));};exports[_0xc807('0x5a')]=function(_0x2192a6,_0x6fa434){return db[_0xc807('0x4b')][_0xc807('0x5a')]()[_0xc807('0x31')](respondWithResult(_0x6fa434,null))[_0xc807('0x50')](handleError(_0x6fa434,null));};exports[_0xc807('0x5b')]=function(_0x335b62,_0x5e195b,_0x2018ff){if(_0x335b62[_0xc807('0x53')]['id']){delete _0x335b62[_0xc807('0x53')]['id'];}return db[_0xc807('0x4b')][_0xc807('0x56')]({'where':{'id':_0x335b62[_0xc807('0x51')]['id']}})[_0xc807('0x31')](handleEntityNotFound(_0x5e195b,null))['then'](function(_0x55a401){if(_0x55a401){_0x335b62['body'][_0xc807('0x5c')]=_0x55a401['id'];return db['Disposition'][_0xc807('0x52')](_0x335b62[_0xc807('0x53')]);}})[_0xc807('0x31')](respondWithResult(_0x5e195b,null))['catch'](handleError(_0x5e195b,null));};exports[_0xc807('0x5d')]=function(_0x30f4bd,_0x49355f,_0x3a7486){var _0x22c47c={'raw':![],'where':{}};var _0x1f0a6f={};var _0x3f4e7d={'count':0x0,'rows':[]};return db[_0xc807('0x4b')][_0xc807('0x5e')]({'where':{'id':_0x30f4bd[_0xc807('0x51')]['id']}})[_0xc807('0x31')](handleEntityNotFound(_0x49355f,null))[_0xc807('0x31')](function(_0x553ce7){if(_0x553ce7){_0x1f0a6f[_0xc807('0x40')]=_[_0xc807('0x3d')](db[_0xc807('0x5f')]['rawAttributes']);_0x1f0a6f[_0xc807('0x3c')]=_['keys'](_0x30f4bd[_0xc807('0x3c')]);_0x1f0a6f['filters']=_[_0xc807('0x3f')](_0x1f0a6f[_0xc807('0x40')],_0x1f0a6f[_0xc807('0x3c')]);_0x22c47c[_0xc807('0x42')]=_['intersection'](_0x1f0a6f['model'],qs['fields'](_0x30f4bd['query'][_0xc807('0x41')]));_0x22c47c[_0xc807('0x42')]=_0x22c47c[_0xc807('0x42')][_0xc807('0x60')]?_0x22c47c['attributes']:_0x1f0a6f[_0xc807('0x40')];if(!_0x30f4bd[_0xc807('0x3c')][_0xc807('0x43')](_0xc807('0x61'))){_0x22c47c[_0xc807('0x2c')]=qs[_0xc807('0x2c')](_0x30f4bd[_0xc807('0x3c')]['limit']);_0x22c47c['offset']=qs[_0xc807('0x29')](_0x30f4bd[_0xc807('0x3c')][_0xc807('0x29')]);}_0x22c47c[_0xc807('0x44')]=qs[_0xc807('0x45')](_0x30f4bd[_0xc807('0x3c')][_0xc807('0x45')]);_0x22c47c['where']=qs[_0xc807('0x3e')](_[_0xc807('0x47')](_0x30f4bd[_0xc807('0x3c')],_0x1f0a6f[_0xc807('0x3e')]));_0x22c47c[_0xc807('0x46')]['ChatWebsiteId']=_0x553ce7['id'];if(_0x30f4bd[_0xc807('0x3c')][_0xc807('0x49')]){_0x22c47c['where']=_[_0xc807('0x48')](_0x22c47c[_0xc807('0x46')],{'$or':_[_0xc807('0x38')](_0x22c47c[_0xc807('0x42')],function(_0x750fe4){var _0x367730={};_0x367730[_0x750fe4]={'$like':'%'+_0x30f4bd[_0xc807('0x3c')]['filter']+'%'};return _0x367730;})});}_0x22c47c=_[_0xc807('0x48')]({},_0x22c47c,_0x30f4bd['options']);return db[_0xc807('0x5f')]['count']({'where':_0x22c47c[_0xc807('0x46')]})[_0xc807('0x31')](function(_0x323994){_0x3f4e7d['count']=_0x323994;if(_0x30f4bd[_0xc807('0x3c')][_0xc807('0x4c')]){_0x22c47c['include']=[{'all':!![]}];}return db['Disposition'][_0xc807('0x4e')](_0x22c47c);})[_0xc807('0x31')](function(_0x1b6387){_0x3f4e7d[_0xc807('0x4f')]=_0x1b6387;return _0x3f4e7d;});}})[_0xc807('0x31')](respondWithFilteredResult(_0x49355f,_0x22c47c))[_0xc807('0x50')](handleError(_0x49355f,null));};exports[_0xc807('0x62')]=function(_0x57df88,_0x238506,_0x1cd4cc){return db[_0xc807('0x4b')][_0xc807('0x56')]({'where':{'id':_0x57df88[_0xc807('0x51')]['id']}})[_0xc807('0x31')](handleEntityNotFound(_0x238506,null))[_0xc807('0x31')](function(_0x176985){if(_0x176985){return _0x176985[_0xc807('0x62')](_0x57df88['query'][_0xc807('0x63')]);}})[_0xc807('0x31')](respondWithStatusCode(_0x238506,null))[_0xc807('0x50')](handleError(_0x238506,null));};exports['addAnswer']=function(_0x57f6dc,_0x3b1b41,_0x34a2f3){if(_0x57f6dc[_0xc807('0x53')]['id']){delete _0x57f6dc[_0xc807('0x53')]['id'];}return db[_0xc807('0x4b')][_0xc807('0x56')]({'where':{'id':_0x57f6dc[_0xc807('0x51')]['id']}})['then'](handleEntityNotFound(_0x3b1b41,null))['then'](function(_0x149511){if(_0x149511){_0x57f6dc[_0xc807('0x53')]['ChatWebsiteId']=_0x149511['id'];return db['CannedAnswer'][_0xc807('0x52')](_0x57f6dc[_0xc807('0x53')]);}})[_0xc807('0x31')](respondWithResult(_0x3b1b41,null))[_0xc807('0x50')](handleError(_0x3b1b41,null));};exports[_0xc807('0x64')]=function(_0x5bce47,_0x16d1a8,_0x4a2388){var _0x1ae17f={'raw':![],'where':{}};var _0x1b4bf1={};var _0x48dab3={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xc807('0x5e')]({'where':{'id':_0x5bce47[_0xc807('0x51')]['id']}})[_0xc807('0x31')](handleEntityNotFound(_0x16d1a8,null))[_0xc807('0x31')](function(_0x1d173d){if(_0x1d173d){_0x1b4bf1[_0xc807('0x40')]=_[_0xc807('0x3d')](db['CannedAnswer'][_0xc807('0x39')]);_0x1b4bf1['query']=_[_0xc807('0x3d')](_0x5bce47[_0xc807('0x3c')]);_0x1b4bf1[_0xc807('0x3e')]=_['intersection'](_0x1b4bf1[_0xc807('0x40')],_0x1b4bf1[_0xc807('0x3c')]);_0x1ae17f[_0xc807('0x42')]=_['intersection'](_0x1b4bf1['model'],qs['fields'](_0x5bce47[_0xc807('0x3c')][_0xc807('0x41')]));_0x1ae17f[_0xc807('0x42')]=_0x1ae17f[_0xc807('0x42')][_0xc807('0x60')]?_0x1ae17f[_0xc807('0x42')]:_0x1b4bf1[_0xc807('0x40')];if(!_0x5bce47[_0xc807('0x3c')][_0xc807('0x43')](_0xc807('0x61'))){_0x1ae17f['limit']=qs[_0xc807('0x2c')](_0x5bce47['query'][_0xc807('0x2c')]);_0x1ae17f[_0xc807('0x29')]=qs[_0xc807('0x29')](_0x5bce47['query']['offset']);}_0x1ae17f[_0xc807('0x44')]=qs[_0xc807('0x45')](_0x5bce47[_0xc807('0x3c')]['sort']);_0x1ae17f[_0xc807('0x46')]=qs[_0xc807('0x3e')](_[_0xc807('0x47')](_0x5bce47[_0xc807('0x3c')],_0x1b4bf1['filters']));_0x1ae17f[_0xc807('0x46')][_0xc807('0x5c')]=_0x1d173d['id'];if(_0x5bce47['query'][_0xc807('0x49')]){_0x1ae17f[_0xc807('0x46')]=_['merge'](_0x1ae17f['where'],{'$or':_[_0xc807('0x38')](_0x1ae17f['attributes'],function(_0x4c209f){var _0x49204f={};_0x49204f[_0x4c209f]={'$like':'%'+_0x5bce47[_0xc807('0x3c')][_0xc807('0x49')]+'%'};return _0x49204f;})});}_0x1ae17f=_['merge']({},_0x1ae17f,_0x5bce47[_0xc807('0x4a')]);return db[_0xc807('0x65')][_0xc807('0x2b')]({'where':_0x1ae17f[_0xc807('0x46')]})[_0xc807('0x31')](function(_0x1ec9cc){_0x48dab3['count']=_0x1ec9cc;if(_0x5bce47['query'][_0xc807('0x4c')]){_0x1ae17f[_0xc807('0x4d')]=[{'all':!![]}];}return db[_0xc807('0x65')][_0xc807('0x4e')](_0x1ae17f);})[_0xc807('0x31')](function(_0x9939a9){_0x48dab3[_0xc807('0x4f')]=_0x9939a9;return _0x48dab3;});}})[_0xc807('0x31')](respondWithFilteredResult(_0x16d1a8,_0x1ae17f))[_0xc807('0x50')](handleError(_0x16d1a8,null));};exports['removeAnswers']=function(_0x3d6f9f,_0x4bee29,_0x5a9b11){return db[_0xc807('0x4b')]['find']({'where':{'id':_0x3d6f9f[_0xc807('0x51')]['id']}})[_0xc807('0x31')](handleEntityNotFound(_0x4bee29,null))[_0xc807('0x31')](function(_0x40c79b){if(_0x40c79b){return _0x40c79b[_0xc807('0x66')](_0x3d6f9f['query'][_0xc807('0x63')]);}})[_0xc807('0x31')](respondWithStatusCode(_0x4bee29,null))[_0xc807('0x50')](handleError(_0x4bee29,null));};exports[_0xc807('0x67')]=function(_0x55fa2b,_0x3e60cf,_0x4cdba4){_0x55fa2b[_0xc807('0x53')][_0xc807('0x68')]=_0x55fa2b[_0xc807('0x69')][_0xc807('0x6a')];return db[_0xc807('0x4b')]['find']({'where':{'id':_0x55fa2b['params']['id']}})[_0xc807('0x31')](handleEntityNotFound(_0x3e60cf,null))['then'](saveUpdates(_0x55fa2b[_0xc807('0x53')],null))['then'](respondWithResult(_0x3e60cf,null))[_0xc807('0x50')](handleError(_0x3e60cf,null));};exports['addAvatar']=function(_0x33808c,_0x5a3fdc,_0x2a9543){_0x33808c[_0xc807('0x53')]['agentAvatar']=_0x33808c[_0xc807('0x69')]['filename'];return db[_0xc807('0x4b')][_0xc807('0x56')]({'where':{'id':_0x33808c[_0xc807('0x51')]['id']}})[_0xc807('0x31')](handleEntityNotFound(_0x5a3fdc,null))[_0xc807('0x31')](saveUpdates(_0x33808c['body'],null))['then'](respondWithResult(_0x5a3fdc,null))[_0xc807('0x50')](handleError(_0x5a3fdc,null));};exports['addCustomerAvatar']=function(_0x54d821,_0x1d4bb6,_0x8f989e){_0x54d821[_0xc807('0x53')][_0xc807('0x6b')]=_0x54d821[_0xc807('0x69')][_0xc807('0x6a')];return db[_0xc807('0x4b')][_0xc807('0x56')]({'where':{'id':_0x54d821[_0xc807('0x51')]['id']}})[_0xc807('0x31')](handleEntityNotFound(_0x1d4bb6,null))[_0xc807('0x31')](saveUpdates(_0x54d821[_0xc807('0x53')],null))[_0xc807('0x31')](respondWithResult(_0x1d4bb6,null))[_0xc807('0x50')](handleError(_0x1d4bb6,null));};exports[_0xc807('0x6c')]=function(_0x241619,_0x31d8fa,_0x230b13){_0x241619[_0xc807('0x53')][_0xc807('0x6d')]=_0x241619[_0xc807('0x69')][_0xc807('0x6a')];return db[_0xc807('0x4b')][_0xc807('0x56')]({'where':{'id':_0x241619['params']['id']}})[_0xc807('0x31')](handleEntityNotFound(_0x31d8fa,null))['then'](saveUpdates(_0x241619['body'],null))[_0xc807('0x31')](respondWithResult(_0x31d8fa,null))[_0xc807('0x50')](handleError(_0x31d8fa,null));};exports[_0xc807('0x6e')]=function(_0x175dcb,_0x4e1232,_0xf49709){var _0x464247=path[_0xc807('0x6f')](config[_0xc807('0x70')],_0xc807('0x71'));var _0x20320c={'where':{'id':_0x175dcb[_0xc807('0x51')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x330503=![];return require('../../config/license/util')[_0xc807('0x72')]()[_0xc807('0x31')](function(_0x1646f6){if(_0x1646f6){_0x330503=_0x1646f6[_0xc807('0x73')];}})['then'](function(){return db[_0xc807('0x4b')][_0xc807('0x56')](_0x20320c);})[_0xc807('0x31')](handleEntityNotFound(_0x4e1232,null))[_0xc807('0x31')](function(_0x13974e){if(_0x13974e){if(!_[_0xc807('0x74')](_0x13974e['sitepic'])){if(fs[_0xc807('0x75')](path[_0xc807('0x6f')](config[_0xc807('0x70')],_0xc807('0x76'),_0x13974e[_0xc807('0x68')]))&&_0x330503){_0x464247=path[_0xc807('0x6f')](config['root'],_0xc807('0x76'),_0x13974e[_0xc807('0x68')]);}}return _0x4e1232[_0xc807('0x77')](_0x464247);}})['catch'](handleError(_0x4e1232,null));};exports['getAvatar']=function(_0x5024dd,_0x271597,_0x3529f4){var _0x13ba46=path[_0xc807('0x6f')](config[_0xc807('0x70')],_0xc807('0x78'));var _0x32a511={'where':{'id':_0x5024dd['params']['id']},'attributes':['id',_0xc807('0x79')],'raw':!![]};return db['ChatWebsite'][_0xc807('0x56')](_0x32a511)['then'](handleEntityNotFound(_0x271597,null))['then'](function(_0x4eb245){if(_0x4eb245){if(!_[_0xc807('0x74')](_0x4eb245[_0xc807('0x79')])){if(fs[_0xc807('0x75')](path['join'](config['root'],_0xc807('0x7a'),_0x4eb245[_0xc807('0x79')]))){_0x13ba46=path[_0xc807('0x6f')](config[_0xc807('0x70')],_0xc807('0x7a'),_0x4eb245[_0xc807('0x79')]);}}return _0x271597['download'](_0x13ba46);}})['catch'](handleError(_0x271597,null));};exports[_0xc807('0x7b')]=function(_0x4c2ce0,_0x4bce7e,_0x494646){var _0x16349d=path['join'](config[_0xc807('0x70')],_0xc807('0x7c'));var _0x171074={'where':{'id':_0x4c2ce0[_0xc807('0x51')]['id']},'attributes':['id',_0xc807('0x6b'),_0xc807('0x7d')],'raw':!![]};return db[_0xc807('0x4b')][_0xc807('0x56')](_0x171074)['then'](handleEntityNotFound(_0x4bce7e,null))['then'](function(_0x59ea9f){if(_0x59ea9f){if(!_['isNil'](_0x59ea9f[_0xc807('0x6b')])){if(fs[_0xc807('0x75')](path[_0xc807('0x6f')](config[_0xc807('0x70')],_0xc807('0x7a'),_0x59ea9f[_0xc807('0x6b')]))&&_0x59ea9f['showCustomerAvatar']){_0x16349d=path['join'](config[_0xc807('0x70')],_0xc807('0x7a'),_0x59ea9f['customerAvatar']);}}return _0x4bce7e[_0xc807('0x77')](_0x16349d);}})[_0xc807('0x50')](handleError(_0x4bce7e,null));};exports[_0xc807('0x7e')]=function(_0x1114a6,_0x33670b,_0x17bbbd){var _0x25aca6=path['join'](config[_0xc807('0x70')],_0xc807('0x7f'));var _0x52f513={'where':{'id':_0x1114a6[_0xc807('0x51')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xc807('0x4b')][_0xc807('0x56')](_0x52f513)[_0xc807('0x31')](handleEntityNotFound(_0x33670b,null))[_0xc807('0x31')](function(_0x2a16f1){if(_0x2a16f1){if(!_[_0xc807('0x74')](_0x2a16f1[_0xc807('0x6d')])){if(fs[_0xc807('0x75')](path['join'](config[_0xc807('0x70')],_0xc807('0x7a'),_0x2a16f1[_0xc807('0x6d')]))){_0x25aca6=path[_0xc807('0x6f')](config[_0xc807('0x70')],_0xc807('0x7a'),_0x2a16f1[_0xc807('0x6d')]);}}return _0x33670b[_0xc807('0x77')](_0x25aca6);}})[_0xc807('0x50')](handleError(_0x33670b,null));};exports[_0xc807('0x80')]=function(_0x1ce5b1,_0x2fc8cb,_0x1945cb){var _0x48cd7b=require(_0xc807('0x81'));var _0x4c48e2=new _0x48cd7b();var _0x1f7e54=_0x4c48e2[_0xc807('0x82')](_0x1ce5b1[_0xc807('0x83')][_0xc807('0x84')])['getResult']();var _0x31ead4={'body':_0x1ce5b1['body'],'channel':_0xc807('0x85')};var _0x4e3f55=[];var _0x3fd74a=[];var _0x16a2d6={};var _0x495b1e=![];return db[_0xc807('0x86')][_0xc807('0x5a')]()[_0xc807('0x31')](function(_0xf16356){if(!_0xf16356){throw new db[(_0xc807('0x87'))][(_0xc807('0x88'))](_0xc807('0x89'));}_0x4e3f55=_[_0xc807('0x8a')](_[_0xc807('0x3d')](_0xf16356),[_0xc807('0x8b'),_0xc807('0x8c')]);_0x3fd74a=_[_0xc807('0x8a')](_['keys'](_0xf16356),['createdAt',_0xc807('0x8c'),'CompanyId',_0xc807('0x8d')]);if(_0x1ce5b1[_0xc807('0x53')]['id']){delete _0x1ce5b1['body']['id'];}if(_['isNil'](_0x1ce5b1['body'][_0xc807('0x8e')])){throw new db[(_0xc807('0x87'))]['ValidationError'](_0xc807('0x8f'));}if(_['isNil'](_0x1ce5b1[_0xc807('0x53')]['body'])||_0x1ce5b1['body'][_0xc807('0x53')]===''){throw new db[(_0xc807('0x87'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc807('0x74')](_0x1ce5b1['body'][_0xc807('0x90')])){throw new db[(_0xc807('0x87'))][(_0xc807('0x88'))](_0xc807('0x91')+_0x3fd74a);}if(!_[_0xc807('0x92')](_0x3fd74a,_0x1ce5b1[_0xc807('0x53')][_0xc807('0x90')])){throw new db['Sequelize'][(_0xc807('0x88'))](_0xc807('0x93')+_0x3fd74a);}_0x16a2d6[_0x1ce5b1[_0xc807('0x53')][_0xc807('0x90')]]=_0x1ce5b1['body'][_0xc807('0x8e')];})[_0xc807('0x31')](function(){return db[_0xc807('0x4b')][_0xc807('0x56')]({'where':{'id':_0x1ce5b1['params']['id']},'include':[{'model':db[_0xc807('0x94')],'as':_0xc807('0x95'),'include':[{'model':db['CmContact'],'as':_0xc807('0x96'),'where':_0x16a2d6,'limit':0x1,'order':[[_0xc807('0x8c'),_0xc807('0x97')]]}]},{'model':db[_0xc807('0x98')],'as':_0xc807('0x99')}]});})['then'](handleEntityNotFound(_0x2fc8cb,null))[_0xc807('0x31')](function(_0x556830){if(_0x556830&&_0x556830[_0xc807('0x95')]){_0x31ead4[_0xc807('0x9a')]=_0x556830;_0x31ead4['applications']=_0x556830[_0xc807('0x99')];_0x31ead4[_0xc807('0x9b')]=_0x556830['List'];_0x31ead4['applications']=_['orderBy'](_0x31ead4[_0xc807('0x9c')],[_0xc807('0x9d')],[_0xc807('0x9e')]);if(_0x31ead4[_0xc807('0x9a')][_0xc807('0x99')]){delete _0x31ead4[_0xc807('0x9a')][_0xc807('0x99')];}if(_0x31ead4[_0xc807('0x9a')][_0xc807('0x95')]&&_0x31ead4[_0xc807('0x9a')]['List'][_0xc807('0x96')][_0xc807('0x60')]){return _0x31ead4[_0xc807('0x9a')]['List'][_0xc807('0x96')][0x0];}var _0x4ca71a=_[_0xc807('0x9f')](_0x1ce5b1['body'],{'firstName':_0x1ce5b1[_0xc807('0x53')][_0xc807('0x8e')],'ListId':_0x556830[_0xc807('0x8d')]});_0x4ca71a[_0x1ce5b1[_0xc807('0x53')][_0xc807('0x90')]]=_0x1ce5b1['body'][_0xc807('0x8e')];return db['CmContact'][_0xc807('0x52')](_0x4ca71a,{'fields':_0x4e3f55,'raw':!![]});}})[_0xc807('0x31')](handleEntityNotFound(_0x2fc8cb,null))['then'](function(_0x1a8929){_0x31ead4['contact']=_0x1a8929;var _0x3c3007=_0x1ce5b1[_0xc807('0x53')][_0xc807('0xa0')];if(_0x1ce5b1[_0xc807('0x83')][_0xc807('0xa1')]){_0x3c3007=_0x1ce5b1['headers'][_0xc807('0xa1')];}else if(_0x1ce5b1['headers'][_0xc807('0xa2')]){_0x3c3007=_[_0xc807('0xa3')](_0x1ce5b1['headers'][_0xc807('0xa2')]['split'](','));}if(_0x1a8929){var _0x3fe00d={'ContactId':_0x1a8929['id'],'ChatWebsiteId':_0x1ce5b1[_0xc807('0x51')]['id'],'from':(_0x1a8929[_0xc807('0xa4')]||'')+'\x20'+(_0x1a8929['lastName']||''),'customerIp':_0x3c3007,'customerPort':_0x1ce5b1[_0xc807('0x83')][_0xc807('0xa5')]?_0x1ce5b1[_0xc807('0x83')][_0xc807('0xa5')]:null,'referer':_0x1ce5b1[_0xc807('0x53')][_0xc807('0xa6')],'browserName':_0x1f7e54['browser'][_0xc807('0x34')]&&_0x1f7e54[_0xc807('0xa7')]['version']?util[_0xc807('0xa8')](_0xc807('0xa9'),_0x1f7e54['browser']['name'],_0x1f7e54['browser'][_0xc807('0xaa')]):_0xc807('0xab'),'browserVersion':_0x1f7e54['browser'][_0xc807('0xaa')]||_0xc807('0xab'),'osName':util[_0xc807('0xa8')](_0xc807('0xa9'),_0x1f7e54['os'][_0xc807('0x34')],_0x1f7e54['os'][_0xc807('0xaa')]),'osVersion':_0x1f7e54['os'][_0xc807('0xaa')],'deviceModel':_0x1f7e54[_0xc807('0xac')][_0xc807('0x40')]&&_0x1f7e54[_0xc807('0xac')][_0xc807('0xad')]?util[_0xc807('0xa8')](_0xc807('0xae'),_0x1f7e54['device'][_0xc807('0x40')],_0x1f7e54['device'][_0xc807('0xad')],_0x1f7e54[_0xc807('0xac')][_0xc807('0xaf')]):null,'deviceVendor':_0x1f7e54[_0xc807('0xac')][_0xc807('0xad')],'deviceType':_0x1f7e54[_0xc807('0xac')][_0xc807('0xaf')],'formData':JSON[_0xc807('0x20')](_0x1ce5b1[_0xc807('0x53')])};var _0x3a8998={'ChatWebsiteId':_0x1ce5b1['params']['id'],'closed':![]};if(_0x1ce5b1['body'][_0xc807('0xb0')]){_0x3a8998[_0xc807('0xb0')]=_0x1ce5b1[_0xc807('0x53')][_0xc807('0xb0')];return db[_0xc807('0xb1')][_0xc807('0x56')]({'where':_0x3a8998})['then'](function(_0x400f02){if(_0x400f02){return[_0x400f02,![]];}_0x3fe00d[_0xc807('0xb0')]=_0x1ce5b1[_0xc807('0x53')][_0xc807('0xb0')];_0x3fe00d['externalUrl']=_0x1ce5b1[_0xc807('0x53')]['externalUrl'];return db['ChatInteraction']['create'](_0x3fe00d)[_0xc807('0x31')](function(_0x18781e){return[_0x18781e,!![]];});});}_0x3a8998[_0xc807('0xb2')]=_0x1a8929['id'];if(_0x1ce5b1[_0xc807('0x53')][_0xc807('0xb3')]&&_0x1ce5b1[_0xc807('0x53')]['interaction']['id']){_0x3a8998['id']=_0x1ce5b1['body'][_0xc807('0xb3')]['id'];return db['ChatInteraction'][_0xc807('0x56')]({'where':_0x3a8998})['then'](function(_0x2cdaa0){if(_0x2cdaa0){return[_0x2cdaa0,![]];}return db[_0xc807('0xb1')][_0xc807('0x52')](_0x3fe00d)[_0xc807('0x31')](function(_0x58440b){return[_0x58440b,!![]];});});}return db[_0xc807('0xb1')][_0xc807('0x52')](_0x3fe00d)[_0xc807('0x31')](function(_0xc32761){return[_0xc32761,!![]];});}})[_0xc807('0xb4')](function(_0x2a38fd,_0x566517){if(_0x2a38fd){_0x495b1e=_0x566517;if(!_0x566517){var _0x1c8d18={'from':(_0x31ead4[_0xc807('0xb5')][_0xc807('0xa4')]||'')+'\x20'+(_0x31ead4['contact'][_0xc807('0xb6')]||'')};if(_0x1ce5b1[_0xc807('0x53')][_0xc807('0xb0')]&&_0x1ce5b1['body'][_0xc807('0xb7')]&&_0x1ce5b1[_0xc807('0x53')][_0xc807('0xb0')]!=_0x1ce5b1[_0xc807('0x53')]['messageId']){_0x1c8d18[_0xc807('0xb0')]=_0x1ce5b1[_0xc807('0x53')][_0xc807('0xb7')];}return _0x2a38fd[_0xc807('0x2f')](_0x1c8d18);}else{return _0x2a38fd;}}})[_0xc807('0x31')](function(_0x35e5a9){_0x31ead4['interaction']=_0x35e5a9[_0xc807('0x32')]({'plain':!![]});_0x31ead4[_0xc807('0xb3')]['created']=_0x495b1e;if(_0x31ead4[_0xc807('0xb3')][_0xc807('0xb8')]){if(_0x31ead4[_0xc807('0x9a')][_0xc807('0xb9')]){_0x31ead4[_0xc807('0x9c')][_0xc807('0xba')]({'id':0x0,'priority':_0x31ead4['applications'][_0xc807('0x60')]+0x1,'app':'close','appdata':_0xc807('0xbb'),'interval':_0xc807('0xbc')});}}return db[_0xc807('0xbd')][_0xc807('0x52')]({'body':_0x1ce5b1[_0xc807('0x53')]['body'],'ChatWebsiteId':_0x1ce5b1[_0xc807('0x51')]['id'],'ChatInteractionId':_0x35e5a9['id'],'direction':'in','ContactId':_0x31ead4[_0xc807('0xb5')]['id'],'AttachmentId':_0x1ce5b1[_0xc807('0x53')][_0xc807('0xbe')]});})[_0xc807('0x31')](function(_0x44b0c3){_0x31ead4[_0xc807('0x24')]=_0x44b0c3;if(_0x31ead4[_0xc807('0xb3')][_0xc807('0xbf')]){return db[_0xc807('0xc0')]['find']({'attributes':['id','name'],'where':{'id':_0x31ead4[_0xc807('0xb3')][_0xc807('0xbf')]}})['then'](function(_0x2f0c31){if(_0x2f0c31){_0x31ead4[_0xc807('0x9c')][_0xc807('0xc1')]({'id':0x0,'priority':0x0,'app':_0xc807('0xc2'),'appdata':_0x2f0c31[_0xc807('0x34')]+','+(_0x31ead4['account']['waitForTheAssignedAgent']||0xa),'interval':_0xc807('0xbc')});_0x31ead4[_0xc807('0xc3')]=!![];}return respondWithRpcPromise('Start',_0xc807('0xc4'),_0x31ead4);});}return respondWithRpcPromise(_0xc807('0xc5'),_0xc807('0xc4'),_0x31ead4);})['then'](function(_0x183100){respondWithRpcPromise('EventManager',_0xc807('0xc6'),{'event':_0xc807('0x80'),'message':_0x183100},client9002);return _0x183100;})['then'](respondWithResult(_0x2fc8cb,null))[_0xc807('0x50')](handleError(_0x2fc8cb,null));};exports[_0xc807('0xc7')]=function(_0x348abc,_0x2736c6,_0xb59b7e){var _0x510694,_0x22182a,_0x5f3cf1;var _0x4aeab8=[];var _0x867e33=[];var _0xdc1fb9={};var _0x5baf95=_0x348abc[_0xc807('0xc8')]||[];var _0xd975d1=[];var _0x3137db;return db[_0xc807('0x86')][_0xc807('0x5a')]()['then'](function(_0x4dcd4f){if(!_0x4dcd4f){throw new db[(_0xc807('0x87'))][(_0xc807('0x88'))](_0xc807('0x89'));}_0x867e33=_[_0xc807('0x8a')](_[_0xc807('0x3d')](_0x4dcd4f),[_0xc807('0x8b'),_0xc807('0x8c')]);_0x4aeab8=_[_0xc807('0x8a')](_[_0xc807('0x3d')](_0x4dcd4f),['createdAt',_0xc807('0x8c'),_0xc807('0xc9'),'ListId']);if(_0x348abc['body']['id']){delete _0x348abc['body']['id'];}if(_[_0xc807('0x74')](_0x348abc[_0xc807('0x53')][_0xc807('0x8e')])){throw _0x2736c6['status'](0x1f4)[_0xc807('0x35')](new db['Sequelize']['ValidationError'](_0xc807('0x8f')));}if(_['isNil'](_0x348abc[_0xc807('0x53')][_0xc807('0x53')])||_0x348abc[_0xc807('0x53')][_0xc807('0x53')]===''){throw _0x2736c6[_0xc807('0x26')](0x1f4)[_0xc807('0x35')](new db[(_0xc807('0x87'))][(_0xc807('0x88'))](_0xc807('0xca')));}if(_[_0xc807('0x74')](_0x348abc[_0xc807('0x53')][_0xc807('0xcb')])){throw _0x2736c6[_0xc807('0x26')](0x1f4)[_0xc807('0x35')](new db['Sequelize'][(_0xc807('0x88'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4aeab8));}if(!_[_0xc807('0x92')](_0x4aeab8,_0x348abc[_0xc807('0x53')]['mapKeyOffline'])){throw _0x2736c6[_0xc807('0x26')](0x1f4)[_0xc807('0x35')](new db[(_0xc807('0x87'))][(_0xc807('0x88'))](_0xc807('0xcc')+_0x4aeab8));}_0xdc1fb9[_0x348abc[_0xc807('0x53')][_0xc807('0xcb')]]=_0x348abc[_0xc807('0x53')]['from'];})['then'](function(){return db[_0xc807('0x4b')]['find']({'where':{'id':_0x348abc[_0xc807('0x51')]['id']},'include':[{'model':db[_0xc807('0x94')],'as':_0xc807('0x95')},{'model':db[_0xc807('0xcd')],'as':'MailAccount'}]});})[_0xc807('0x31')](handleEntityNotFound(_0x2736c6,null))[_0xc807('0x31')](function(_0x3a53c5){if(_0x3a53c5&&_0x3a53c5[_0xc807('0x95')]){_0x22182a=_0x3a53c5;var _0x5a7ec6=_[_0xc807('0x9f')](_0x348abc[_0xc807('0x53')],{'firstName':_0x348abc[_0xc807('0x53')][_0xc807('0x8e')],'phone':_0x348abc['body']['from'],'ListId':_0x3a53c5[_0xc807('0x8d')]});_0x5a7ec6[_0x348abc[_0xc807('0x53')][_0xc807('0xcb')]]=_0x348abc['body'][_0xc807('0x8e')];return db[_0xc807('0x86')][_0xc807('0xce')]({'where':_0xdc1fb9,'defaults':_0x5a7ec6});}})['spread'](function(_0x48ad54){if(_0x48ad54){_0x5f3cf1=_0x48ad54;var _0x47829f=fs[_0xc807('0xcf')](path[_0xc807('0x6f')](config[_0xc807('0x70')],_0xc807('0xd0')),_0xc807('0xd1'));var _0x224b6d=ejs[_0xc807('0xd2')](_0x47829f,{'body':_[_0xc807('0xd3')](_0x348abc[_0xc807('0x53')]['body']),'bodyTitle':_0x22182a['offlineMessageBody']});return db[_0xc807('0xd4')]['create']({'body':_0x224b6d,'ContactId':_0x48ad54['id'],'ChatWebsiteId':_0x22182a['id']});}})[_0xc807('0x31')](function(_0x396cd2){_0x3137db=_0x396cd2;if(_0x5baf95[_0xc807('0x60')]){var _0x3c6db4=_0x5baf95[_0xc807('0x38')](function(_0x505e33){return{'name':_0x505e33['originalname'],'basename':_0x505e33[_0xc807('0x6a')],'type':_0x505e33[_0xc807('0xd5')],'ChatOfflineMessageId':_0x396cd2['id']};});_0xd975d1=_0x3c6db4['map'](_0x4f866a=>{var _0x10a284={'filename':_0x4f866a[_0xc807('0x34')],'path':path[_0xc807('0x6f')](config[_0xc807('0x70')],'server',_0xc807('0xc8'),_0xc807('0xd6'),'offline-chat',_0x4f866a[_0xc807('0xd7')])};return _0x10a284;});if(!_0x22182a[_0xc807('0xd8')]){return db[_0xc807('0xd9')]['transaction'](function(_0x28ce42){return db[_0xc807('0xda')]['bulkCreate'](_0x3c6db4,{'transaction':_0x28ce42});});}}})['then'](function(){if(_0x3137db){_0x510694=_0x3137db;return db[_0xc807('0xcd')][_0xc807('0x5e')]({'where':{'active':!![]},'include':[{'model':db['MailServerOut'],'as':_0xc807('0xdb'),'raw':!![]}]});}})[_0xc807('0x31')](function(_0x3e8cf8){if(_0x3e8cf8&&_0x3e8cf8[_0xc807('0xdb')]&&_0x22182a[_0xc807('0xdc')]&&_0x22182a[_0xc807('0xdd')]){var _0x49b9ad={'tls':{'rejectUnauthorized':![]}};if(_0x3e8cf8[_0xc807('0xdb')][_0xc807('0xde')]){_0x49b9ad[_0xc807('0xde')]=_0x3e8cf8['Smtp'][_0xc807('0xde')];}else{_0x49b9ad[_0xc807('0xdf')]=_0x3e8cf8[_0xc807('0xdb')][_0xc807('0xdf')];_0x49b9ad[_0xc807('0xe0')]=_0x3e8cf8['Smtp'][_0xc807('0xe0')];_0x49b9ad[_0xc807('0xe1')]=_0x3e8cf8[_0xc807('0xdb')][_0xc807('0xe1')];}if(_0x3e8cf8[_0xc807('0xdb')][_0xc807('0xe2')]){_0x49b9ad[_0xc807('0xe3')]={'user':_0x3e8cf8[_0xc807('0xdb')][_0xc807('0x54')],'pass':_0x3e8cf8[_0xc807('0xdb')][_0xc807('0xe4')]};}return respondWithRpcPromise('SendMail',_0xc807('0xe5'),{'account':_0x49b9ad,'message':{'from':util['format'](_0xc807('0xe6'),_0x3e8cf8[_0xc807('0x34')],_0x3e8cf8[_0xc807('0xe7')]||_0x3e8cf8[_0xc807('0xdb')][_0xc807('0x54')]),'to':_0x22182a[_0xc807('0xdd')],'subject':_0x22182a[_0xc807('0xe8')],'html':_0x510694['body'],'attachments':_0xd975d1}},client9003)[_0xc807('0x31')](function(){return _0x510694;})[_0xc807('0x50')](function(_0x5c9a5c){console[_0xc807('0x21')](_0x5c9a5c);});}})[_0xc807('0x31')](function(){if(_0x22182a&&_0x22182a['openNewInteraction']&&_0x22182a[_0xc807('0xe9')]){var _0x4dcf2d=[];if(_0x5baf95[_0xc807('0x60')]){_0x4dcf2d=_0x5baf95[_0xc807('0x38')](function(_0x5eb947){return{'name':_0x5eb947['originalname'],'basename':_0x5eb947[_0xc807('0x6a')],'type':_0x5eb947[_0xc807('0xd5')],'ChatOfflineMessageId':_0x3137db['id']};});}var _0x43cea1;if(!_[_0xc807('0x74')](_0x22182a[_0xc807('0xea')])){var _0x3ae499=_[_0xc807('0x38')](_0x348abc['body'],function(_0x434230){return _0x434230;});var _0x1f4e4a=_[_0xc807('0xeb')](_0x3ae499)[0x0];var _0xb59f12=_[_0xc807('0xec')](_0x1f4e4a,function(_0x439130){return _0x439130;});_0x43cea1=_0xb59f12[0x1][_0x22182a[_0xc807('0xea')]];}var _0x166030={'from':_0x5f3cf1['email'],'firstName':_0x5f3cf1[_0xc807('0xa4')],'lastName':_0x5f3cf1[_0xc807('0xb6')],'mapKey':'email','message':{'from':_0x5f3cf1[_0xc807('0xe7')],'to':_0x22182a[_0xc807('0xcd')]['email'],'cc':'','subject':_[_0xc807('0x74')](_0x43cea1)?_0x22182a['offlineMessageSubject']:_0x43cea1,'messageId':'','sentAt':new Date(),'attach':_0x4dcf2d[_0xc807('0x60')],'attachments':_0x4dcf2d,'originChannel':_0xc807('0xed'),'ChatWebsiteId':_0x22182a['id'],'ChatOfflineMessageId':_0x510694['id'],'originTo':_0x22182a[_0xc807('0xcd')][_0xc807('0xe7')]},'body':_0x510694['body']};var _0x4c53a4={'account':{'id':_0x22182a[_0xc807('0xe9')]},'body':_0x166030,'log':_0xc807('0xee')};return respondWithRpcPromise(_0xc807('0xee'),_0xc807('0xef'),_0x4c53a4,client9001)[_0xc807('0x31')](function(){return _0x510694;})['catch'](function(_0x4ae371){console[_0xc807('0x21')](_0x4ae371);});}return;})[_0xc807('0x31')](function(){if(_0x510694){return _0x510694;}})[_0xc807('0x31')](respondWithResult(_0x2736c6,null))[_0xc807('0x50')](function(_0x355052){console[_0xc807('0x21')]('catch',_0x355052);for(var _0x4f217f of _0x5baf95){var _0xe6ebd9=path['join'](config[_0xc807('0x70')],_0xc807('0xf0'),_0xc807('0xc8'),'attachments','offline-chat',_0x4f217f[_0xc807('0x6a')]);fs_extra[_0xc807('0xf1')](_0xe6ebd9)[_0xc807('0x50')](function(_0x49483d){console[_0xc807('0x21')](_0xc807('0xf2'),_0xe6ebd9,_0x49483d);});}});};exports['addInteraction']=function(_0x5d34cd,_0x1c2464,_0x2432c1){return db[_0xc807('0xb1')][_0xc807('0x56')]({'where':{'id':_0x5d34cd['params']['id']}})[_0xc807('0x31')](handleEntityNotFound(_0x1c2464,null))[_0xc807('0x31')](function(_0x31fc42){if(_0x31fc42){return _0x31fc42['addInteraction'](_0x5d34cd['body'][_0xc807('0x63')],_[_0xc807('0xf3')](_0x5d34cd[_0xc807('0x53')],[_0xc807('0x63'),'id'])||{});}})[_0xc807('0x31')](respondWithResult(_0x1c2464,null))[_0xc807('0x50')](handleError(_0x1c2464,null));};exports['getInteractions']=function(_0x1666bb,_0x2d9062,_0x14aa10){var _0x57ec8a={'raw':![],'where':{}};var _0x421556={};var _0x3dcdc9={'count':0x0,'rows':[]};return db[_0xc807('0x4b')][_0xc807('0x5e')]({'where':{'id':_0x1666bb['params']['id']}})[_0xc807('0x31')](handleEntityNotFound(_0x2d9062,null))['then'](function(_0x255ef2){if(_0x255ef2){_0x421556[_0xc807('0x40')]=_[_0xc807('0x3d')](db[_0xc807('0xb1')][_0xc807('0x39')]);_0x421556['query']=_['keys'](_0x1666bb[_0xc807('0x3c')]);_0x421556[_0xc807('0x3e')]=_[_0xc807('0x3f')](_0x421556[_0xc807('0x40')],_0x421556['query']);_0x57ec8a[_0xc807('0x42')]=_[_0xc807('0x3f')](_0x421556[_0xc807('0x40')],qs[_0xc807('0x41')](_0x1666bb['query'][_0xc807('0x41')]));_0x57ec8a[_0xc807('0x42')]=_0x57ec8a[_0xc807('0x42')][_0xc807('0x60')]?_0x57ec8a[_0xc807('0x42')]:_0x421556[_0xc807('0x40')];if(!_0x1666bb['query']['hasOwnProperty']('nolimit')){_0x57ec8a[_0xc807('0x2c')]=qs[_0xc807('0x2c')](_0x1666bb[_0xc807('0x3c')]['limit']);_0x57ec8a[_0xc807('0x29')]=qs[_0xc807('0x29')](_0x1666bb['query'][_0xc807('0x29')]);}_0x57ec8a['order']=qs[_0xc807('0x45')](_0x1666bb['query'][_0xc807('0x45')]);_0x57ec8a[_0xc807('0x46')]=qs[_0xc807('0x3e')](_['pick'](_0x1666bb[_0xc807('0x3c')],_0x421556[_0xc807('0x3e')]));_0x57ec8a['where'][_0xc807('0x5c')]=_0x255ef2['id'];if(_0x1666bb[_0xc807('0x3c')][_0xc807('0x49')]){_0x57ec8a['where']=_[_0xc807('0x48')](_0x57ec8a[_0xc807('0x46')],{'$or':_[_0xc807('0x38')](_0x57ec8a['attributes'],function(_0x4fd9f1){var _0x4e9307={};_0x4e9307[_0x4fd9f1]={'$like':'%'+_0x1666bb[_0xc807('0x3c')][_0xc807('0x49')]+'%'};return _0x4e9307;})});}_0x57ec8a=_[_0xc807('0x48')]({},_0x57ec8a,_0x1666bb[_0xc807('0x4a')]);return db[_0xc807('0xb1')][_0xc807('0x2b')]({'where':_0x57ec8a['where']})[_0xc807('0x31')](function(_0x2cb8bf){_0x3dcdc9[_0xc807('0x2b')]=_0x2cb8bf;if(_0x1666bb[_0xc807('0x3c')]['includeAll']){_0x57ec8a[_0xc807('0x4d')]=[{'model':db[_0xc807('0x86')],'as':'Contact','required':![]},{'model':db[_0xc807('0xc0')],'as':_0xc807('0xf4'),'attributes':[_0xc807('0x34'),_0xc807('0xf5'),_0xc807('0xf6')],'required':![]},{'model':db[_0xc807('0xf7')],'as':_0xc807('0xf8'),'attributes':['id',_0xc807('0x34'),_0xc807('0xf9')],'where':_0x1666bb['query']['tag']?{'id':_0x1666bb['query'][_0xc807('0xfa')]}:undefined,'required':_0x1666bb[_0xc807('0x3c')]['tag']?!![]:![]}];}return db[_0xc807('0xb1')][_0xc807('0x4e')](_0x57ec8a);})['then'](function(_0x5d9455){_0x3dcdc9[_0xc807('0x4f')]=_0x5d9455;return _0x3dcdc9;});}})[_0xc807('0x31')](respondWithFilteredResult(_0x2d9062,_0x57ec8a))[_0xc807('0x50')](handleError(_0x2d9062,null));};function iftimePromise(_0x464f7b,_0x314485){return respondWithRpcPromise(_0xc807('0xfb'),_0xc807('0xfc'),{'command':_0x314485[_0xc807('0xfd')]?util[_0xc807('0xa8')](_0xc807('0xfe'),_0x464f7b[_0xc807('0xff')],_0x314485[_0xc807('0xfd')]):util[_0xc807('0xa8')](_0xc807('0x100'),_0x464f7b[_0xc807('0xff')])},client9002)[_0xc807('0x31')](function(_0x90cb36){var _0x400a74=_0x90cb36&&_0x90cb36[_0xc807('0x101')](_0xc807('0x102'))>=0x0?!![]:![];logger[_0xc807('0x1d')](_0xc807('0x103'),_0x314485['id'],_0x464f7b['id'],_0x464f7b[_0xc807('0xff')],_0x400a74?_0xc807('0x104'):_0xc807('0x105'),_0x314485['timezone']?_0x314485[_0xc807('0xfd')]:_0xc807('0x106'));return _0x400a74;})['catch'](function(_0x2dbae2){logger[_0xc807('0x21')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x314485['id'],_0x464f7b['id'],_0x464f7b[_0xc807('0xff')],util[_0xc807('0x107')](_0x2dbae2,{'showHidden':![],'depth':null}),_0x314485[_0xc807('0xfd')]?_0x314485['timezone']:_0xc807('0x106'));return![];});}exports[_0xc807('0xfc')]=function(_0x5db4d7,_0x23e225,_0x364fc6){var _0x4a4777=0x0;var _0x12b772=0x0;var _0x705fde=![];var _0x288fe1;var _0x5445d2;return db[_0xc807('0x4b')][_0xc807('0x56')]({'where':{'id':_0x5db4d7[_0xc807('0x51')]['id']},'include':[{'model':db[_0xc807('0x108')],'as':_0xc807('0x108'),'include':[{'model':db[_0xc807('0x108')],'as':_0xc807('0x109'),'attributes':['id',_0xc807('0xff')],'raw':!![]}]}]})[_0xc807('0x31')](handleEntityNotFound(_0x23e225,null))[_0xc807('0x31')](function(_0x2cbf93){if(_0x2cbf93){_0x288fe1=_0x2cbf93;return _0x2cbf93[_0xc807('0x10a')]({'raw':!![]});}})[_0xc807('0x31')](function(_0x32b98d){if(_0x288fe1){if(_0x32b98d){_0x5445d2=_0x32b98d;}}return require('../../config/license/util')['getLicense']();})['then'](function(_0x421ed0){if(_0x421ed0){_0x12b772=_0x421ed0['virtual'];_0x705fde=_0x421ed0[_0xc807('0x73')];}})[_0xc807('0x31')](function(){return db[_0xc807('0xb1')][_0xc807('0x2b')]({'where':{'closed':![]}});})['then'](function(_0xe96375){_0x4a4777=_0xe96375;if(_0x12b772&&_0xe96375>_0x12b772){return db[_0xc807('0x10b')][_0xc807('0x5e')]({'where':{'id':0x1}})[_0xc807('0x31')](function(_0x189d1e){if(_0x189d1e){_0x189d1e['increment'](_0xc807('0x10c'));}});}})[_0xc807('0x31')](function(){if(_0x288fe1[_0xc807('0x108')]&&_0x288fe1[_0xc807('0x108')]['Intervals']){var _0x561581=[];for(var _0x2685b6=0x0;_0x2685b6<_0x288fe1['Interval'][_0xc807('0x109')][_0xc807('0x60')];_0x2685b6++){var _0x47e9c9=_0x288fe1['Interval'][_0xc807('0x109')][_0x2685b6][_0xc807('0x32')]({'plain':!![]});_0x561581[_0xc807('0xba')](iftimePromise(_0x47e9c9,_0x288fe1));}return BPromise[_0xc807('0x10d')](_0x561581)[_0xc807('0x31')](function(_0x8fb041){return _[_0xc807('0x10e')](_0x8fb041);});}else{return!![];}})[_0xc807('0x31')](function(_0x2b6483){var _0xa6ae91=fs[_0xc807('0xcf')](path[_0xc807('0x6f')](config[_0xc807('0x70')],'server/files/chat/iframe.ejs'),_0xc807('0xd1'));var _0x1722dc={'remote':_0x288fe1[_0xc807('0x10f')],'query':querystring[_0xc807('0x20')](_[_0xc807('0x48')](_0x288fe1[_0xc807('0x32')]({'plain':!![]}),{'customerIp':_0x5db4d7[_0xc807('0x83')][_0xc807('0xa2')]||_0x5db4d7[_0xc807('0x83')]['x-real-ip']||_0x5db4d7[_0xc807('0x110')]['remoteAddress']||_0x5db4d7['ip'],'referer':_0x5db4d7[_0xc807('0x83')][_0xc807('0xa6')],'openedInteractions':_0x4a4777,'maxInteractions':_0x12b772,'virtual':_0x705fde[_0xc807('0x111')],'online':_0x2b6483,'custom':_0x705fde}))[_0xc807('0x112')](/'/g,'\x5c\x27')};_0x23e225[_0xc807('0x35')](ejs[_0xc807('0xd2')](Mustache[_0xc807('0xd2')](_0xa6ae91,_0x1722dc),{'proactiveActions':_0x5445d2,'alignment':_0x288fe1[_0xc807('0x113')],'verticalAlignment':_0x288fe1['verticalAlignment'],'div_color':_0x288fe1[_0xc807('0xf9')],'text_color':_0x288fe1[_0xc807('0x114')],'button_color':_0x288fe1[_0xc807('0x115')],'background_color':_0x288fe1[_0xc807('0x116')]}));})[_0xc807('0x50')](handleError(_0x23e225,null));};exports['addApplications']=function(_0x3b836b,_0x47e0e3,_0x16fa06){return db[_0xc807('0x4b')][_0xc807('0x5e')]({'where':{'id':_0x3b836b[_0xc807('0x51')]['id']}})[_0xc807('0x31')](handleEntityNotFound(_0x47e0e3,null))['then'](function(_0x395af9){if(_0x395af9){return db[_0xc807('0xd9')][_0xc807('0x117')](function(_0x83ab91){return db['ChatApplication'][_0xc807('0x30')]({'where':{'ChatWebsiteId':_0x3b836b[_0xc807('0x51')]['id']},'transaction':_0x83ab91})[_0xc807('0x31')](function(_0x1b6398){var _0xfb563c=_[_0xc807('0x38')](_0x3b836b[_0xc807('0x53')],function(_0x180c77){_0x180c77[_0xc807('0x5c')]=_0x3b836b[_0xc807('0x51')]['id'];return _0x180c77;});return db['ChatApplication'][_0xc807('0x118')](_0xfb563c,{'transaction':_0x83ab91});});})[_0xc807('0x31')](function(){return db['ChatApplication'][_0xc807('0x119')]({'where':{'ChatWebsiteId':_0x3b836b[_0xc807('0x51')]['id']},'order':_0xc807('0x9d')});});}})[_0xc807('0x31')](respondWithResult(_0x47e0e3,null))['catch'](handleError(_0x47e0e3,null));};exports[_0xc807('0x11a')]=function(_0x1cc2d1,_0x299c62,_0x2e782b){var _0x38d36d={};var _0xdf1c68={};var _0xb16d59;var _0x59f978;return db[_0xc807('0x4b')][_0xc807('0x5e')]({'where':{'id':_0x1cc2d1['params']['id']}})[_0xc807('0x31')](handleEntityNotFound(_0x299c62,null))[_0xc807('0x31')](function(_0x40165a){if(_0x40165a){_0xb16d59=_0x40165a;_0xdf1c68[_0xc807('0x40')]=_[_0xc807('0x3d')](db[_0xc807('0x98')]['rawAttributes']);_0xdf1c68[_0xc807('0x3c')]=_[_0xc807('0x3d')](_0x1cc2d1['query']);_0xdf1c68[_0xc807('0x3e')]=_['intersection'](_0xdf1c68['model'],_0xdf1c68[_0xc807('0x3c')]);_0x38d36d[_0xc807('0x42')]=_['intersection'](_0xdf1c68['model'],qs[_0xc807('0x41')](_0x1cc2d1[_0xc807('0x3c')][_0xc807('0x41')]));_0x38d36d[_0xc807('0x42')]=_0x38d36d['attributes']['length']?_0x38d36d[_0xc807('0x42')]:_0xdf1c68[_0xc807('0x40')];_0x38d36d[_0xc807('0x44')]=qs[_0xc807('0x45')](_0x1cc2d1['query'][_0xc807('0x45')]);_0x38d36d[_0xc807('0x46')]=qs[_0xc807('0x3e')](_[_0xc807('0x47')](_0x1cc2d1[_0xc807('0x3c')],_0xdf1c68[_0xc807('0x3e')]));if(_0x1cc2d1[_0xc807('0x3c')][_0xc807('0x49')]){_0x38d36d['where']=_[_0xc807('0x48')](_0x38d36d[_0xc807('0x46')],{'$or':_[_0xc807('0x38')](_0x38d36d['attributes'],function(_0x109cbc){var _0x148e73={};_0x148e73[_0x109cbc]={'$like':'%'+_0x1cc2d1['query']['filter']+'%'};return _0x148e73;})});}_0x38d36d=_[_0xc807('0x48')]({},_0x38d36d,_0x1cc2d1['options']);return _0xb16d59[_0xc807('0x11a')](_0x38d36d);}})[_0xc807('0x31')](function(_0x2d9a4c){if(_0x2d9a4c){_0x59f978=_0x2d9a4c[_0xc807('0x60')];if(!_0x1cc2d1[_0xc807('0x3c')][_0xc807('0x43')]('nolimit')){_0x38d36d[_0xc807('0x2c')]=qs['limit'](_0x1cc2d1[_0xc807('0x3c')][_0xc807('0x2c')]);_0x38d36d[_0xc807('0x29')]=qs['offset'](_0x1cc2d1['query'][_0xc807('0x29')]);}return _0xb16d59['getApplications'](_0x38d36d);}})['then'](function(_0x51cf43){if(_0x51cf43){return _0x51cf43?{'count':_0x59f978,'rows':_0x51cf43}:null;}})[_0xc807('0x31')](respondWithResult(_0x299c62,null))[_0xc807('0x50')](handleError(_0x299c62,null));};exports[_0xc807('0x11b')]=function(_0x5bc179,_0x43f1bc,_0x570cca){return db['chatProactiveAction'][_0xc807('0x56')]({'where':{'id':_0x5bc179['params']['id']}})[_0xc807('0x31')](handleEntityNotFound(_0x43f1bc,null))[_0xc807('0x31')](function(_0x5c32b2){if(_0x5c32b2){return _0x5c32b2[_0xc807('0x11b')](_0x5bc179['body']['ids'],_['omit'](_0x5bc179[_0xc807('0x53')],[_0xc807('0x63'),'id'])||{});}})[_0xc807('0x31')](respondWithResult(_0x43f1bc,null))['catch'](handleError(_0x43f1bc,null));};exports[_0xc807('0x10a')]=function(_0x2d8713,_0x2dba73,_0x5513ac){var _0x1c4c83={};var _0x4c3d07={};var _0x2d9dab;var _0x2d05c2;return db[_0xc807('0x4b')][_0xc807('0x5e')]({'where':{'id':_0x2d8713[_0xc807('0x51')]['id']}})[_0xc807('0x31')](handleEntityNotFound(_0x2dba73,null))[_0xc807('0x31')](function(_0xa29c88){if(_0xa29c88){_0x2d9dab=_0xa29c88;_0x4c3d07['model']=_['keys'](db[_0xc807('0x11c')]['rawAttributes']);_0x4c3d07[_0xc807('0x3c')]=_[_0xc807('0x3d')](_0x2d8713[_0xc807('0x3c')]);_0x4c3d07[_0xc807('0x3e')]=_['intersection'](_0x4c3d07['model'],_0x4c3d07[_0xc807('0x3c')]);_0x1c4c83['attributes']=_[_0xc807('0x3f')](_0x4c3d07[_0xc807('0x40')],qs[_0xc807('0x41')](_0x2d8713[_0xc807('0x3c')][_0xc807('0x41')]));_0x1c4c83[_0xc807('0x42')]=_0x1c4c83[_0xc807('0x42')][_0xc807('0x60')]?_0x1c4c83['attributes']:_0x4c3d07['model'];_0x1c4c83[_0xc807('0x44')]=qs[_0xc807('0x45')](_0x2d8713[_0xc807('0x3c')][_0xc807('0x45')]);_0x1c4c83['where']=qs['filters'](_[_0xc807('0x47')](_0x2d8713[_0xc807('0x3c')],_0x4c3d07['filters']));if(_0x2d8713[_0xc807('0x3c')]['filter']){_0x1c4c83[_0xc807('0x46')]=_['merge'](_0x1c4c83['where'],{'$or':_[_0xc807('0x38')](_0x1c4c83['attributes'],function(_0x5484ac){var _0x578faa={};_0x578faa[_0x5484ac]={'$like':'%'+_0x2d8713[_0xc807('0x3c')][_0xc807('0x49')]+'%'};return _0x578faa;})});}_0x1c4c83=_['merge']({},_0x1c4c83,_0x2d8713[_0xc807('0x4a')]);return _0x2d9dab[_0xc807('0x10a')](_0x1c4c83);}})[_0xc807('0x31')](function(_0x58cda5){if(_0x58cda5){_0x2d05c2=_0x58cda5[_0xc807('0x60')];if(!_0x2d8713[_0xc807('0x3c')][_0xc807('0x43')](_0xc807('0x61'))){_0x1c4c83[_0xc807('0x2c')]=qs['limit'](_0x2d8713[_0xc807('0x3c')][_0xc807('0x2c')]);_0x1c4c83[_0xc807('0x29')]=qs['offset'](_0x2d8713[_0xc807('0x3c')][_0xc807('0x29')]);}return _0x2d9dab[_0xc807('0x10a')](_0x1c4c83);}})[_0xc807('0x31')](function(_0x25a06c){if(_0x25a06c){return _0x25a06c?{'count':_0x2d05c2,'rows':_0x25a06c}:null;}})[_0xc807('0x31')](respondWithResult(_0x2dba73,null))[_0xc807('0x50')](handleError(_0x2dba73,null));};exports['getFields']=function(_0x33e58e,_0x3dbdcd,_0x4ad328){var _0x13ee3d=_0x33e58e[_0xc807('0x3c')][_0xc807('0x11d')]==='false'?_0xc807('0x11e'):'onlineForm';return db[_0xc807('0x4b')][_0xc807('0x56')]({'attributes':['id',_0x13ee3d],'where':{'id':_0x33e58e[_0xc807('0x51')]['id']}})['then'](handleEntityNotFound(_0x3dbdcd,null))[_0xc807('0x31')](function(_0x42a037){if(_0x42a037){var _0x236999=_0x42a037[_0x13ee3d];var _0x441764=_0x236999&&_0x236999[_0xc807('0x11f')]?_0x236999[_0xc807('0x11f')]:[];_0x3dbdcd[_0xc807('0x35')]({'fromKey':_[_0xc807('0x74')](_0x236999['fromKey'])?undefined:_0x236999[_0xc807('0x120')],'count':_0x441764['length'],'rows':_0x441764});}})[_0xc807('0x50')](handleError(_0x3dbdcd,null));};exports[_0xc807('0x121')]=function(_0x44ac35,_0x355df2,_0x444a8d){var _0xc06fc={'raw':![],'where':{}};var _0x83b9e6={};var _0x5cbdc6={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xc807('0x5e')]({'where':{'id':_0x44ac35['params']['id']}})['then'](handleEntityNotFound(_0x355df2,null))['then'](function(_0xcc77c9){if(_0xcc77c9){_0x83b9e6['model']=_[_0xc807('0x3d')](db['ChatOfflineMessage'][_0xc807('0x39')]);_0x83b9e6['query']=_[_0xc807('0x3d')](_0x44ac35['query']);_0x83b9e6[_0xc807('0x3e')]=_['intersection'](_0x83b9e6['model'],_0x83b9e6[_0xc807('0x3c')]);_0xc06fc[_0xc807('0x42')]=_[_0xc807('0x3f')](_0x83b9e6[_0xc807('0x40')],qs[_0xc807('0x41')](_0x44ac35['query'][_0xc807('0x41')]));_0xc06fc[_0xc807('0x42')]=_0xc06fc[_0xc807('0x42')][_0xc807('0x60')]?_0xc06fc[_0xc807('0x42')]:_0x83b9e6[_0xc807('0x40')];if(!_0x44ac35[_0xc807('0x3c')]['hasOwnProperty'](_0xc807('0x61'))){_0xc06fc[_0xc807('0x2c')]=qs['limit'](_0x44ac35['query']['limit']);_0xc06fc[_0xc807('0x29')]=qs[_0xc807('0x29')](_0x44ac35['query']['offset']);}_0xc06fc[_0xc807('0x44')]=qs[_0xc807('0x45')](_0x44ac35[_0xc807('0x3c')][_0xc807('0x45')]);_0xc06fc[_0xc807('0x46')]=qs['filters'](_[_0xc807('0x47')](_0x44ac35['query'],_0x83b9e6['filters']));_0xc06fc[_0xc807('0x46')][_0xc807('0x5c')]=_0xcc77c9['id'];if(_0x44ac35[_0xc807('0x3c')][_0xc807('0x49')]){_0xc06fc[_0xc807('0x46')]=_[_0xc807('0x48')](_0xc06fc[_0xc807('0x46')],{'$or':_[_0xc807('0x38')](_0xc06fc['attributes'],function(_0x19e559){var _0x54dcc3={};_0x54dcc3[_0x19e559]={'$like':'%'+_0x44ac35[_0xc807('0x3c')][_0xc807('0x49')]+'%'};return _0x54dcc3;})});}_0xc06fc=_['merge']({},_0xc06fc,_0x44ac35[_0xc807('0x4a')]);return db[_0xc807('0xd4')]['count']({'where':_0xc06fc['where']})[_0xc807('0x31')](function(_0xd524c5){_0x5cbdc6[_0xc807('0x2b')]=_0xd524c5;if(_0x44ac35[_0xc807('0x3c')]['includeAll']){_0xc06fc[_0xc807('0x4d')]=[{'all':!![]}];}else{_0xc06fc[_0xc807('0x4d')]=[{'model':db[_0xc807('0x86')],'as':_0xc807('0x122'),'required':![]},{'model':db['Attachment'],'as':_0xc807('0x123'),'required':![]}];}return db['ChatOfflineMessage'][_0xc807('0x4e')](_0xc06fc);})['then'](function(_0x18f02c){_0x5cbdc6[_0xc807('0x4f')]=_0x18f02c;return _0x5cbdc6;});}})[_0xc807('0x31')](respondWithFilteredResult(_0x355df2,_0xc06fc))[_0xc807('0x50')](handleError(_0x355df2,null));};exports['addAgents']=function(_0x2a95c9,_0x2cc27d,_0x3b7ec0){return db[_0xc807('0x4b')][_0xc807('0x56')]({'where':{'id':_0x2a95c9[_0xc807('0x51')]['id']}})[_0xc807('0x31')](handleEntityNotFound(_0x2cc27d,null))['then'](function(_0x4b0363){if(_0x4b0363){return _0x4b0363[_0xc807('0x124')](_0x2a95c9[_0xc807('0x53')][_0xc807('0x63')],_[_0xc807('0xf3')](_0x2a95c9[_0xc807('0x53')],[_0xc807('0x63'),'id'])||{})[_0xc807('0xb4')](function(_0x355cdf){for(var _0x458d94=0x0;_0x458d94<_0x2a95c9[_0xc807('0x53')]['ids'][_0xc807('0x60')];_0x458d94+=0x1){socket[_0xc807('0x125')](_0xc807('0x126'),{'UserId':Number(_0x2a95c9[_0xc807('0x53')][_0xc807('0x63')][_0x458d94]),'ChatWebsiteId':Number(_0x2a95c9['params']['id'])});}return _0x355cdf;});}})[_0xc807('0x31')](respondWithResult(_0x2cc27d,null))[_0xc807('0x50')](handleError(_0x2cc27d,null));};exports['removeAgents']=function(_0x7cd4e0,_0x3482ef,_0x54b715){return db[_0xc807('0x4b')][_0xc807('0x56')]({'where':{'id':_0x7cd4e0[_0xc807('0x51')]['id']}})[_0xc807('0x31')](handleEntityNotFound(_0x3482ef,null))[_0xc807('0x31')](function(_0xa0050b){if(_0xa0050b){return _0xa0050b['removeAgents'](_0x7cd4e0[_0xc807('0x3c')]['ids'])[_0xc807('0x31')](function(){if(_[_0xc807('0x127')](_0x7cd4e0[_0xc807('0x3c')][_0xc807('0x63')])){for(var _0x4f305c=0x0;_0x4f305c<_0x7cd4e0[_0xc807('0x3c')][_0xc807('0x63')]['length'];_0x4f305c+=0x1){socket[_0xc807('0x125')](_0xc807('0x128'),{'UserId':Number(_0x7cd4e0['query'][_0xc807('0x63')][_0x4f305c]),'ChatWebsiteId':Number(_0x7cd4e0[_0xc807('0x51')]['id'])});}}else{socket[_0xc807('0x125')](_0xc807('0x128'),{'UserId':Number(_0x7cd4e0[_0xc807('0x3c')][_0xc807('0x63')]),'ChatWebsiteId':Number(_0x7cd4e0['params']['id'])});}});}})[_0xc807('0x31')](respondWithStatusCode(_0x3482ef,null))['catch'](handleError(_0x3482ef,null));};exports[_0xc807('0x129')]=function(_0x5368e8,_0x4e17f0,_0x1cf71d){var _0x300913={};var _0x32c1dd={};var _0x3315bf;var _0x474964;return db['ChatWebsite'][_0xc807('0x5e')]({'where':{'id':_0x5368e8[_0xc807('0x51')]['id']}})[_0xc807('0x31')](handleEntityNotFound(_0x4e17f0,null))['then'](function(_0x5dad01){if(_0x5dad01){_0x3315bf=_0x5dad01;_0x32c1dd['model']=_['keys'](db[_0xc807('0xc0')][_0xc807('0x39')]);_0x32c1dd['query']=_['keys'](_0x5368e8['query']);_0x32c1dd[_0xc807('0x3e')]=_[_0xc807('0x3f')](_0x32c1dd[_0xc807('0x40')],_0x32c1dd['query']);_0x300913['attributes']=_[_0xc807('0x3f')](_0x32c1dd[_0xc807('0x40')],qs[_0xc807('0x41')](_0x5368e8[_0xc807('0x3c')]['fields']));_0x300913['attributes']=_0x300913[_0xc807('0x42')]['length']?_0x300913[_0xc807('0x42')]:_0x32c1dd[_0xc807('0x40')];_0x300913['order']=qs[_0xc807('0x45')](_0x5368e8[_0xc807('0x3c')][_0xc807('0x45')]);_0x300913[_0xc807('0x46')]=qs[_0xc807('0x3e')](_[_0xc807('0x47')](_0x5368e8[_0xc807('0x3c')],_0x32c1dd[_0xc807('0x3e')]));if(_0x5368e8['query']['filter']){_0x300913[_0xc807('0x46')]=_[_0xc807('0x48')](_0x300913['where'],{'$or':_[_0xc807('0x38')](_0x300913[_0xc807('0x42')],function(_0x462887){var _0x1837ef={};_0x1837ef[_0x462887]={'$like':'%'+_0x5368e8[_0xc807('0x3c')][_0xc807('0x49')]+'%'};return _0x1837ef;})});}_0x300913=_[_0xc807('0x48')]({},_0x300913,_0x5368e8[_0xc807('0x4a')]);return _0x3315bf[_0xc807('0x129')](_0x300913);}})[_0xc807('0x31')](function(_0x3cc969){if(_0x3cc969){_0x474964=_0x3cc969[_0xc807('0x60')];if(!_0x5368e8[_0xc807('0x3c')][_0xc807('0x43')](_0xc807('0x61'))){_0x300913[_0xc807('0x2c')]=qs[_0xc807('0x2c')](_0x5368e8[_0xc807('0x3c')][_0xc807('0x2c')]);_0x300913['offset']=qs[_0xc807('0x29')](_0x5368e8['query'][_0xc807('0x29')]);}return _0x3315bf[_0xc807('0x129')](_0x300913);}})[_0xc807('0x31')](function(_0xecb5f1){if(_0xecb5f1){return _0xecb5f1?{'count':_0x474964,'rows':_0xecb5f1}:null;}})[_0xc807('0x31')](respondWithResult(_0x4e17f0,null))[_0xc807('0x50')](handleError(_0x4e17f0,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 5e7b1fd..1d6b2f9 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 _0x8b04=['events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x8b04,0x130));var _0x48b0=function(_0xac30ba,_0x4a7fda){_0xac30ba=_0xac30ba-0x0;var _0x1ba237=_0x8b04[_0xac30ba];return _0x1ba237;};'use strict';var EventEmitter=require(_0x48b0('0x0'));var ChatWebsite=require(_0x48b0('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x48b0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x48b0('0x3'),'afterDestroy':_0x48b0('0x4')};function emitEvent(_0xc0b19b){return function(_0x468c90,_0x423a40,_0x1f1bb2){ChatWebsiteEvents[_0x48b0('0x5')](_0xc0b19b+':'+_0x468c90['id'],_0x468c90);ChatWebsiteEvents[_0x48b0('0x5')](_0xc0b19b,_0x468c90);_0x1f1bb2(null);};}for(var e in events){if(events[_0x48b0('0x6')](e)){var event=events[e];ChatWebsite[_0x48b0('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xfc76=['save','update','emit','hasOwnProperty','hook','../../mysqldb','ChatWebsite','setMaxListeners'];(function(_0x2a21e9,_0x1b41e9){var _0x496fca=function(_0x2262fe){while(--_0x2262fe){_0x2a21e9['push'](_0x2a21e9['shift']());}};_0x496fca(++_0x1b41e9);}(_0xfc76,0xb5));var _0x6fc7=function(_0x3cff65,_0x4223ca){_0x3cff65=_0x3cff65-0x0;var _0x52b86a=_0xfc76[_0x3cff65];return _0x52b86a;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x6fc7('0x0'))['db'][_0x6fc7('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x6fc7('0x2')](0x0);var events={'afterCreate':_0x6fc7('0x3'),'afterUpdate':_0x6fc7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x316cc4){return function(_0x40d212,_0x51280c,_0x13f682){ChatWebsiteEvents['emit'](_0x316cc4+':'+_0x40d212['id'],_0x40d212);ChatWebsiteEvents[_0x6fc7('0x5')](_0x316cc4,_0x40d212);_0x13f682(null);};}for(var e in events){if(events[_0x6fc7('0x6')](e)){var event=events[e];ChatWebsite[_0x6fc7('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index d9d2d74..dba9beb 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 _0x7d21=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','chat_websites','lodash','../../config/logger','api'];(function(_0x188b1d,_0x2248ed){var _0x116e65=function(_0x5bb02f){while(--_0x5bb02f){_0x188b1d['push'](_0x188b1d['shift']());}};_0x116e65(++_0x2248ed);}(_0x7d21,0xa2));var _0x17d2=function(_0x44cf0d,_0x1f023c){_0x44cf0d=_0x44cf0d-0x0;var _0x2657bd=_0x7d21[_0x44cf0d];return _0x2657bd;};'use strict';var _=require(_0x17d2('0x0'));var util=require('util');var logger=require(_0x17d2('0x1'))(_0x17d2('0x2'));var moment=require(_0x17d2('0x3'));var BPromise=require(_0x17d2('0x4'));var rp=require(_0x17d2('0x5'));var fs=require('fs');var path=require(_0x17d2('0x6'));var rimraf=require(_0x17d2('0x7'));var config=require(_0x17d2('0x8'));var attributes=require(_0x17d2('0x9'));module['exports']=function(_0x1d2db0,_0x147e1e){return _0x1d2db0['define']('ChatWebsite',attributes,{'tableName':_0x17d2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15c6=['request-promise','path','./chatWebsite.attributes','exports','ChatWebsite','chat_websites','lodash','api','moment','bluebird'];(function(_0xe140a,_0x537b5b){var _0x15debc=function(_0x4cfd78){while(--_0x4cfd78){_0xe140a['push'](_0xe140a['shift']());}};_0x15debc(++_0x537b5b);}(_0x15c6,0x1f0));var _0x615c=function(_0x435dde,_0x2a2fa3){_0x435dde=_0x435dde-0x0;var _0x4aca2d=_0x15c6[_0x435dde];return _0x4aca2d;};'use strict';var _=require(_0x615c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x615c('0x1'));var moment=require(_0x615c('0x2'));var BPromise=require(_0x615c('0x3'));var rp=require(_0x615c('0x4'));var fs=require('fs');var path=require(_0x615c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x615c('0x6'));module[_0x615c('0x7')]=function(_0x1d8efc,_0x33f698){return _0x1d8efc['define'](_0x615c('0x8'),attributes,{'tableName':_0x615c('0x9'),'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 cae412b..c4d7751 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 _0xaea6=['socket.io-emitter','./chatWebsite.socket','request','then','info','request\x20sent','debug','stringify','code','error','ChatWebsite,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost'];(function(_0x256a6f,_0x1d9bec){var _0x5437c7=function(_0x3fa4d9){while(--_0x3fa4d9){_0x256a6f['push'](_0x256a6f['shift']());}};_0x5437c7(++_0x1d9bec);}(_0xaea6,0xf6));var _0x6aea=function(_0x4c6494,_0x3f802c){_0x4c6494=_0x4c6494-0x0;var _0x24f2e3=_0xaea6[_0x4c6494];return _0x24f2e3;};'use strict';var _=require(_0x6aea('0x0'));var util=require(_0x6aea('0x1'));var moment=require(_0x6aea('0x2'));var BPromise=require(_0x6aea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6aea('0x4'));var db=require(_0x6aea('0x5'))['db'];var utils=require(_0x6aea('0x6'));var logger=require(_0x6aea('0x7'))(_0x6aea('0x8'));var config=require(_0x6aea('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6aea('0xa')][_0x6aea('0xb')]({'port':0x232a});config['redis']=_[_0x6aea('0xc')](config[_0x6aea('0xd')],{'host':_0x6aea('0xe'),'port':0x18eb});var socket=require(_0x6aea('0xf'))(new Redis(config['redis']));require(_0x6aea('0x10'))['register'](socket);function respondWithRpcPromise(_0x5d941c,_0xb6a946,_0x12c1ae){return new BPromise(function(_0x66add0,_0x2cc8a9){return client[_0x6aea('0x11')](_0x5d941c,_0x12c1ae)[_0x6aea('0x12')](function(_0x1a6cd0){logger[_0x6aea('0x13')]('ChatWebsite,\x20%s,\x20%s',_0xb6a946,_0x6aea('0x14'));logger[_0x6aea('0x15')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0xb6a946,_0x6aea('0x14'),JSON[_0x6aea('0x16')](_0x1a6cd0));if(_0x1a6cd0['error']){if(_0x1a6cd0['error'][_0x6aea('0x17')]===0x1f4){logger[_0x6aea('0x18')](_0x6aea('0x19'),_0xb6a946,_0x1a6cd0[_0x6aea('0x18')][_0x6aea('0x1a')]);return _0x2cc8a9(_0x1a6cd0['error'][_0x6aea('0x1a')]);}logger[_0x6aea('0x18')](_0x6aea('0x19'),_0xb6a946,_0x1a6cd0[_0x6aea('0x18')][_0x6aea('0x1a')]);return _0x66add0(_0x1a6cd0[_0x6aea('0x18')][_0x6aea('0x1a')]);}else{logger[_0x6aea('0x13')](_0x6aea('0x19'),_0xb6a946,_0x6aea('0x14'));_0x66add0(_0x1a6cd0[_0x6aea('0x1b')][_0x6aea('0x1a')]);}})[_0x6aea('0x1c')](function(_0x2958c7){logger['error'](_0x6aea('0x19'),_0xb6a946,_0x2958c7);_0x2cc8a9(_0x2958c7);});});} \ No newline at end of file +var _0x86cf=['debug','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','ChatWebsite,\x20%s,\x20%s','request\x20sent'];(function(_0x4e7b9c,_0x5a15d7){var _0x36ca02=function(_0x1e9f3b){while(--_0x1e9f3b){_0x4e7b9c['push'](_0x4e7b9c['shift']());}};_0x36ca02(++_0x5a15d7);}(_0x86cf,0x129));var _0xf86c=function(_0x139795,_0x14f5c8){_0x139795=_0x139795-0x0;var _0x3fdd92=_0x86cf[_0x139795];return _0x3fdd92;};'use strict';var _=require(_0xf86c('0x0'));var util=require(_0xf86c('0x1'));var moment=require(_0xf86c('0x2'));var BPromise=require(_0xf86c('0x3'));var rs=require(_0xf86c('0x4'));var fs=require('fs');var Redis=require(_0xf86c('0x5'));var db=require(_0xf86c('0x6'))['db'];var utils=require(_0xf86c('0x7'));var logger=require(_0xf86c('0x8'))(_0xf86c('0x9'));var config=require(_0xf86c('0xa'));var jayson=require(_0xf86c('0xb'));var client=jayson[_0xf86c('0xc')][_0xf86c('0xd')]({'port':0x232a});config['redis']=_['defaults'](config[_0xf86c('0xe')],{'host':_0xf86c('0xf'),'port':0x18eb});var socket=require(_0xf86c('0x10'))(new Redis(config[_0xf86c('0xe')]));require(_0xf86c('0x11'))[_0xf86c('0x12')](socket);function respondWithRpcPromise(_0x1107ac,_0x4ce54f,_0x13b0bf){return new BPromise(function(_0x24187b,_0x3391d2){return client[_0xf86c('0x13')](_0x1107ac,_0x13b0bf)['then'](function(_0xdea2b7){logger['info'](_0xf86c('0x14'),_0x4ce54f,_0xf86c('0x15'));logger[_0xf86c('0x16')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4ce54f,_0xf86c('0x15'),JSON[_0xf86c('0x17')](_0xdea2b7));if(_0xdea2b7['error']){if(_0xdea2b7[_0xf86c('0x18')][_0xf86c('0x19')]===0x1f4){logger[_0xf86c('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x4ce54f,_0xdea2b7[_0xf86c('0x18')][_0xf86c('0x1a')]);return _0x3391d2(_0xdea2b7[_0xf86c('0x18')]['message']);}logger[_0xf86c('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x4ce54f,_0xdea2b7[_0xf86c('0x18')][_0xf86c('0x1a')]);return _0x24187b(_0xdea2b7[_0xf86c('0x18')][_0xf86c('0x1a')]);}else{logger[_0xf86c('0x1b')]('ChatWebsite,\x20%s,\x20%s',_0x4ce54f,'request\x20sent');_0x24187b(_0xdea2b7['result'][_0xf86c('0x1a')]);}})[_0xf86c('0x1c')](function(_0x67678){logger[_0xf86c('0x18')](_0xf86c('0x14'),_0x4ce54f,_0x67678);_0x3391d2(_0x67678);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 1952afa..2789064 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 _0xfe5c=['register','length','./chatWebsite.events','save','update','emit','removeListener'];(function(_0xeef8cc,_0x38e97e){var _0x392211=function(_0x476eb6){while(--_0x476eb6){_0xeef8cc['push'](_0xeef8cc['shift']());}};_0x392211(++_0x38e97e);}(_0xfe5c,0x87));var _0xcfe5=function(_0x5da631,_0x2c2cbe){_0x5da631=_0x5da631-0x0;var _0x3229b5=_0xfe5c[_0x5da631];return _0x3229b5;};'use strict';var ChatWebsiteEvents=require(_0xcfe5('0x0'));var events=[_0xcfe5('0x1'),'remove',_0xcfe5('0x2')];function createListener(_0x4b77c4,_0x4c26e3){return function(_0x2c7d52){_0x4c26e3[_0xcfe5('0x3')](_0x4b77c4,_0x2c7d52);};}function removeListener(_0x15ac9d,_0x1129a2){return function(){ChatWebsiteEvents[_0xcfe5('0x4')](_0x15ac9d,_0x1129a2);};}exports[_0xcfe5('0x5')]=function(_0x32efc7){for(var _0x1139dd=0x0,_0x2cd7c7=events[_0xcfe5('0x6')];_0x1139dd<_0x2cd7c7;_0x1139dd++){var _0x5b9fc3=events[_0x1139dd];var _0x4f26df=createListener('chatWebsite:'+_0x5b9fc3,_0x32efc7);ChatWebsiteEvents['on'](_0x5b9fc3,_0x4f26df);}}; \ No newline at end of file +var _0x0f4a=['register','length','chatWebsite:','./chatWebsite.events','save','update','emit','removeListener'];(function(_0x3e1a1b,_0x1be7e0){var _0x408c2f=function(_0x7a9ec0){while(--_0x7a9ec0){_0x3e1a1b['push'](_0x3e1a1b['shift']());}};_0x408c2f(++_0x1be7e0);}(_0x0f4a,0xd3));var _0xa0f4=function(_0x3fb9bd,_0x1c498c){_0x3fb9bd=_0x3fb9bd-0x0;var _0x1a5d30=_0x0f4a[_0x3fb9bd];return _0x1a5d30;};'use strict';var ChatWebsiteEvents=require(_0xa0f4('0x0'));var events=[_0xa0f4('0x1'),'remove',_0xa0f4('0x2')];function createListener(_0x2c02f6,_0x3f80b7){return function(_0x5d4c54){_0x3f80b7[_0xa0f4('0x3')](_0x2c02f6,_0x5d4c54);};}function removeListener(_0x189768,_0x232b65){return function(){ChatWebsiteEvents[_0xa0f4('0x4')](_0x189768,_0x232b65);};}exports[_0xa0f4('0x5')]=function(_0x1b2fb5){for(var _0x35c65f=0x0,_0x75c3f2=events[_0xa0f4('0x6')];_0x35c65f<_0x75c3f2;_0x35c65f++){var _0x488570=events[_0x35c65f];var _0x57a4e3=createListener(_0xa0f4('0x7')+_0x488570,_0x1b2fb5);ChatWebsiteEvents['on'](_0x488570,_0x57a4e3);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 711f99a..b53bfcf 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 _0x98dd=['format','%s-%s','originalname','single','file','root','server/files/images/avatars/','diskStorage','addCustomerAvatar','now','addSystemAvatar','/:id/notify','notify','server/files','offline-chat','ensureDir','replace','extname','offline','/:id/interactions','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','index','get','/describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','join','server/files/images/logos/'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x98dd,0x1c8));var _0xd98d=function(_0x58baf9,_0x446c3e){_0x58baf9=_0x58baf9-0x0;var _0x9b8f74=_0x98dd[_0x58baf9];return _0x9b8f74;};'use strict';var multer=require(_0xd98d('0x0'));var util=require(_0xd98d('0x1'));var path=require('path');var timeout=require(_0xd98d('0x2'));var express=require('express');var router=express[_0xd98d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd98d('0x4'));var interaction=require(_0xd98d('0x5'));var config=require(_0xd98d('0x6'));var controller=require(_0xd98d('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xd98d('0x8')]);router[_0xd98d('0x9')](_0xd98d('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xd98d('0xb'),auth[_0xd98d('0xc')](),controller[_0xd98d('0xd')]);router[_0xd98d('0x9')](_0xd98d('0xe'),auth[_0xd98d('0xc')](),controller[_0xd98d('0xf')]);router[_0xd98d('0x9')]('/:id/canned_answers',auth[_0xd98d('0xc')](),controller['getAnswers']);router[_0xd98d('0x9')](_0xd98d('0x10'),controller[_0xd98d('0x11')]);router[_0xd98d('0x9')](_0xd98d('0x12'),controller[_0xd98d('0x13')]);router[_0xd98d('0x9')](_0xd98d('0x14'),controller[_0xd98d('0x15')]);router['get'](_0xd98d('0x16'),controller['getSystemAvatar']);router[_0xd98d('0x9')]('/:id/interactions',auth['isAuthenticated'](),controller['getInteractions']);router[_0xd98d('0x9')](_0xd98d('0x17'),controller[_0xd98d('0x18')]);router[_0xd98d('0x9')](_0xd98d('0x19'),auth[_0xd98d('0xc')](),controller['getApplications']);router[_0xd98d('0x9')](_0xd98d('0x1a'),auth[_0xd98d('0xc')](),controller[_0xd98d('0x1b')]);router['get'](_0xd98d('0x1c'),controller[_0xd98d('0x1d')]);router['get'](_0xd98d('0x1e'),auth['isAuthenticated'](),controller[_0xd98d('0x1f')]);router[_0xd98d('0x9')](_0xd98d('0x20'),auth[_0xd98d('0xc')](),controller[_0xd98d('0x21')]);router[_0xd98d('0x22')]('/',auth[_0xd98d('0xc')](),controller[_0xd98d('0x23')]);router[_0xd98d('0x22')](_0xd98d('0xe'),auth[_0xd98d('0xc')](),controller[_0xd98d('0x24')]);router[_0xd98d('0x22')](_0xd98d('0x25'),auth['isAuthenticated'](),controller[_0xd98d('0x26')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4ce1ab,_0x8f5c3c,_0xf22b38){_0xf22b38(null,path[_0xd98d('0x27')](config['root'],_0xd98d('0x28')));},'filename':function(_0x1db3ff,_0x5d205b,_0x27ca16){_0x27ca16(null,util[_0xd98d('0x29')](_0xd98d('0x2a'),Date['now'](),_0x5d205b[_0xd98d('0x2b')]));}})});router[_0xd98d('0x22')]('/:id/logo',upload[_0xd98d('0x2c')](_0xd98d('0x2d')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xa69146,_0x14caf5,_0x4104e1){_0x4104e1(null,path[_0xd98d('0x27')](config[_0xd98d('0x2e')],_0xd98d('0x2f')));},'filename':function(_0xc58700,_0x310df5,_0x4267ad){_0x4267ad(null,util[_0xd98d('0x29')](_0xd98d('0x2a'),Date['now'](),_0x310df5[_0xd98d('0x2b')]));}})});router[_0xd98d('0x22')](_0xd98d('0x12'),upload['single'](_0xd98d('0x2d')),controller['addAvatar']);var upload=multer({'storage':multer[_0xd98d('0x30')]({'destination':function(_0x288fd6,_0x1d841c,_0x4a31a8){_0x4a31a8(null,path[_0xd98d('0x27')](config[_0xd98d('0x2e')],_0xd98d('0x2f')));},'filename':function(_0x20ca14,_0x4cb43a,_0x352d81){_0x352d81(null,util['format']('%s-%s',Date['now'](),_0x4cb43a[_0xd98d('0x2b')]));}})});router[_0xd98d('0x22')](_0xd98d('0x14'),upload[_0xd98d('0x2c')](_0xd98d('0x2d')),controller[_0xd98d('0x31')]);var upload=multer({'storage':multer[_0xd98d('0x30')]({'destination':function(_0x4d260d,_0x482c86,_0x2a8c39){_0x2a8c39(null,path[_0xd98d('0x27')](config['root'],_0xd98d('0x2f')));},'filename':function(_0x24b2b2,_0x4d4129,_0x1b5d67){_0x1b5d67(null,util[_0xd98d('0x29')]('%s-%s',Date[_0xd98d('0x32')](),_0x4d4129[_0xd98d('0x2b')]));}})});router[_0xd98d('0x22')](_0xd98d('0x16'),upload['single'](_0xd98d('0x2d')),controller[_0xd98d('0x33')]);router['post'](_0xd98d('0x34'),controller[_0xd98d('0x35')]);const offlineUploadMulter=multer({'storage':multer[_0xd98d('0x30')]({'destination':function(_0x28eccb,_0x23481d,_0x5ef372){const _0xa1b6b3=path[_0xd98d('0x27')](config[_0xd98d('0x2e')],_0xd98d('0x36'),'attachments',_0xd98d('0x37'));fs_extra[_0xd98d('0x38')](_0xa1b6b3,function(){_0x5ef372(null,_0xa1b6b3);});},'filename':function(_0x44718d,_0x577efa,_0xa077){const _0x26351b=_0x577efa['originalname'][_0xd98d('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0xb92cdc=path[_0xd98d('0x3a')](_0x26351b);const _0x2b74f4=Date['now']()+'-'+_0x26351b['replace'](_0xb92cdc,'')+_0xb92cdc;_0xa077(null,_0x2b74f4);}})});router[_0xd98d('0x22')]('/:id/offline',offlineUploadMulter['any'](),controller[_0xd98d('0x3b')]);router[_0xd98d('0x22')](_0xd98d('0x3c'),auth[_0xd98d('0xc')](),controller['addInteraction']);router[_0xd98d('0x22')](_0xd98d('0x19'),auth['isAuthenticated'](),controller[_0xd98d('0x3d')]);router['post'](_0xd98d('0x1a'),auth[_0xd98d('0xc')](),controller[_0xd98d('0x3e')]);router[_0xd98d('0x22')](_0xd98d('0x20'),auth[_0xd98d('0xc')](),controller[_0xd98d('0x3f')]);router[_0xd98d('0x40')](_0xd98d('0xb'),auth[_0xd98d('0xc')](),controller[_0xd98d('0x41')]);router[_0xd98d('0x42')](_0xd98d('0xb'),auth['isAuthenticated'](),controller[_0xd98d('0x43')]);router['delete'](_0xd98d('0xe'),auth['isAuthenticated'](),controller[_0xd98d('0x44')]);router['delete'](_0xd98d('0x25'),auth[_0xd98d('0xc')](),controller[_0xd98d('0x45')]);router[_0xd98d('0x42')](_0xd98d('0x20'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xd98d('0x46')]=router; \ No newline at end of file +var _0xa777=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','server/files/images/logos/','format','now','originalname','single','file','addLogo','root','%s-%s','addAvatar','server/files/images/avatars/','/:id/customer_avatar','/:id/system_avatar','addSystemAvatar','/:id/notify','server/files','attachments','offline-chat','replace','extname','/:id/offline','any','addInteraction','addApplications','addProactiveActions','addAgents','destroy','delete','/:id/canned_answers','removeAnswers','exports','multer','util','path'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa777,0x16f));var _0x7a77=function(_0x2f5a1d,_0x295d1d){_0x2f5a1d=_0x2f5a1d-0x0;var _0x1bc425=_0xa777[_0x2f5a1d];return _0x1bc425;};'use strict';var multer=require(_0x7a77('0x0'));var util=require(_0x7a77('0x1'));var path=require(_0x7a77('0x2'));var timeout=require(_0x7a77('0x3'));var express=require(_0x7a77('0x4'));var router=express[_0x7a77('0x5')]();var fs_extra=require(_0x7a77('0x6'));var auth=require(_0x7a77('0x7'));var interaction=require(_0x7a77('0x8'));var config=require(_0x7a77('0x9'));var controller=require('./chatWebsite.controller');router[_0x7a77('0xa')]('/',auth[_0x7a77('0xb')](),controller[_0x7a77('0xc')]);router[_0x7a77('0xa')](_0x7a77('0xd'),auth[_0x7a77('0xb')](),controller[_0x7a77('0xe')]);router['get'](_0x7a77('0xf'),auth[_0x7a77('0xb')](),controller['show']);router[_0x7a77('0xa')](_0x7a77('0x10'),auth[_0x7a77('0xb')](),controller[_0x7a77('0x11')]);router[_0x7a77('0xa')]('/:id/canned_answers',auth[_0x7a77('0xb')](),controller[_0x7a77('0x12')]);router[_0x7a77('0xa')](_0x7a77('0x13'),controller[_0x7a77('0x14')]);router[_0x7a77('0xa')](_0x7a77('0x15'),controller[_0x7a77('0x16')]);router['get']('/:id/customer_avatar',controller['getCustomerAvatar']);router[_0x7a77('0xa')]('/:id/system_avatar',controller[_0x7a77('0x17')]);router[_0x7a77('0xa')](_0x7a77('0x18'),auth[_0x7a77('0xb')](),controller[_0x7a77('0x19')]);router[_0x7a77('0xa')](_0x7a77('0x1a'),controller['getSnippet']);router[_0x7a77('0xa')](_0x7a77('0x1b'),auth[_0x7a77('0xb')](),controller[_0x7a77('0x1c')]);router[_0x7a77('0xa')](_0x7a77('0x1d'),auth[_0x7a77('0xb')](),controller[_0x7a77('0x1e')]);router['get'](_0x7a77('0x1f'),controller[_0x7a77('0x20')]);router[_0x7a77('0xa')](_0x7a77('0x21'),auth[_0x7a77('0xb')](),controller[_0x7a77('0x22')]);router[_0x7a77('0xa')](_0x7a77('0x23'),auth[_0x7a77('0xb')](),controller[_0x7a77('0x24')]);router[_0x7a77('0x25')]('/',auth[_0x7a77('0xb')](),controller[_0x7a77('0x26')]);router['post'](_0x7a77('0x10'),auth[_0x7a77('0xb')](),controller[_0x7a77('0x27')]);router[_0x7a77('0x25')]('/:id/canned_answers',auth[_0x7a77('0xb')](),controller[_0x7a77('0x28')]);var upload=multer({'storage':multer[_0x7a77('0x29')]({'destination':function(_0x5282cd,_0x1fba00,_0x4181f1){_0x4181f1(null,path[_0x7a77('0x2a')](config['root'],_0x7a77('0x2b')));},'filename':function(_0x1009cd,_0x2ea3d1,_0x5edad0){_0x5edad0(null,util[_0x7a77('0x2c')]('%s-%s',Date[_0x7a77('0x2d')](),_0x2ea3d1[_0x7a77('0x2e')]));}})});router['post'](_0x7a77('0x13'),upload[_0x7a77('0x2f')](_0x7a77('0x30')),controller[_0x7a77('0x31')]);var upload=multer({'storage':multer[_0x7a77('0x29')]({'destination':function(_0x5ab94b,_0x569c28,_0x1177d1){_0x1177d1(null,path[_0x7a77('0x2a')](config[_0x7a77('0x32')],'server/files/images/avatars/'));},'filename':function(_0x1eeb19,_0x5b7764,_0x3629fe){_0x3629fe(null,util[_0x7a77('0x2c')](_0x7a77('0x33'),Date[_0x7a77('0x2d')](),_0x5b7764['originalname']));}})});router[_0x7a77('0x25')](_0x7a77('0x15'),upload['single'](_0x7a77('0x30')),controller[_0x7a77('0x34')]);var upload=multer({'storage':multer[_0x7a77('0x29')]({'destination':function(_0x287132,_0x298997,_0x45e530){_0x45e530(null,path[_0x7a77('0x2a')](config[_0x7a77('0x32')],_0x7a77('0x35')));},'filename':function(_0x5bb6,_0x4b0e12,_0x336743){_0x336743(null,util['format'](_0x7a77('0x33'),Date['now'](),_0x4b0e12[_0x7a77('0x2e')]));}})});router['post'](_0x7a77('0x36'),upload[_0x7a77('0x2f')](_0x7a77('0x30')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x7a77('0x29')]({'destination':function(_0x477e7,_0x186b38,_0x3efe96){_0x3efe96(null,path[_0x7a77('0x2a')](config[_0x7a77('0x32')],_0x7a77('0x35')));},'filename':function(_0x4ee76d,_0x21545c,_0x23b6de){_0x23b6de(null,util['format'](_0x7a77('0x33'),Date[_0x7a77('0x2d')](),_0x21545c[_0x7a77('0x2e')]));}})});router[_0x7a77('0x25')](_0x7a77('0x37'),upload[_0x7a77('0x2f')](_0x7a77('0x30')),controller[_0x7a77('0x38')]);router['post'](_0x7a77('0x39'),controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x861ac5,_0x1c8515,_0x1de1d5){const _0x3e26fe=path[_0x7a77('0x2a')](config[_0x7a77('0x32')],_0x7a77('0x3a'),_0x7a77('0x3b'),_0x7a77('0x3c'));fs_extra['ensureDir'](_0x3e26fe,function(){_0x1de1d5(null,_0x3e26fe);});},'filename':function(_0x1e7656,_0x3790a6,_0x5620e8){const _0x3a7387=_0x3790a6[_0x7a77('0x2e')][_0x7a77('0x3d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1bc53d=path[_0x7a77('0x3e')](_0x3a7387);const _0x5dacf7=Date[_0x7a77('0x2d')]()+'-'+_0x3a7387[_0x7a77('0x3d')](_0x1bc53d,'')+_0x1bc53d;_0x5620e8(null,_0x5dacf7);}})});router[_0x7a77('0x25')](_0x7a77('0x3f'),offlineUploadMulter[_0x7a77('0x40')](),controller['offline']);router['post'](_0x7a77('0x18'),auth[_0x7a77('0xb')](),controller[_0x7a77('0x41')]);router[_0x7a77('0x25')](_0x7a77('0x1b'),auth[_0x7a77('0xb')](),controller[_0x7a77('0x42')]);router[_0x7a77('0x25')](_0x7a77('0x1d'),auth[_0x7a77('0xb')](),controller[_0x7a77('0x43')]);router[_0x7a77('0x25')]('/:id/users',auth[_0x7a77('0xb')](),controller[_0x7a77('0x44')]);router['put'](_0x7a77('0xf'),auth[_0x7a77('0xb')](),controller['update']);router['delete']('/:id',auth[_0x7a77('0xb')](),controller[_0x7a77('0x45')]);router[_0x7a77('0x46')](_0x7a77('0x10'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x7a77('0x46')](_0x7a77('0x47'),auth['isAuthenticated'](),controller[_0x7a77('0x48')]);router[_0x7a77('0x46')]('/:id/users',auth[_0x7a77('0xb')](),controller['removeAgents']);module[_0x7a77('0x49')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 6a00175..67e3dfc 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 _0x6f44=['ENUM','AmazonAWS','Google','STRING','sequelize','exports'];(function(_0x5c5c52,_0x36d085){var _0x4229ff=function(_0x3806df){while(--_0x3806df){_0x5c5c52['push'](_0x5c5c52['shift']());}};_0x4229ff(++_0x36d085);}(_0x6f44,0x1ea));var _0x46f4=function(_0x44e8b8,_0x7e2295){_0x44e8b8=_0x44e8b8-0x0;var _0x4acf3b=_0x6f44[_0x44e8b8];return _0x4acf3b;};'use strict';var Sequelize=require(_0x46f4('0x0'));module[_0x46f4('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x46f4('0x2')](_0x46f4('0x3'),_0x46f4('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x46f4('0x5')]},'data2':{'type':Sequelize[_0x46f4('0x5')]}}; \ No newline at end of file +var _0xb39f=['STRING','ENUM','sequelize','exports'];(function(_0x392dbc,_0x4d31cf){var _0x119302=function(_0x250580){while(--_0x250580){_0x392dbc['push'](_0x392dbc['shift']());}};_0x119302(++_0x4d31cf);}(_0xb39f,0x1e6));var _0xfb39=function(_0x3443de,_0x6e4cd3){_0x3443de=_0x3443de-0x0;var _0x3cf23b=_0xb39f[_0x3443de];return _0x3cf23b;};'use strict';var Sequelize=require(_0xfb39('0x0'));module[_0xfb39('0x1')]={'name':{'type':Sequelize[_0xfb39('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xfb39('0x3')]('AmazonAWS','Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xfb39('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index e2b6ebd..56d094c 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 _0x5f2f=['end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','CloudProvider','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','keys','find','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x574797,_0x15f63b){_0x574797=_0x574797-0x0;var _0x1bed4f=_0x5f2f[_0x574797];return _0x1bed4f;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0x22c826);})[_0xf5f2('0x24')](function(_0x574f24){_0x11c771[_0xf5f2('0x3f')]=_0x574f24;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x40')](handleError(_0x53cb96,null));};exports['show']=function(_0x509dbc,_0x59eb00){var _0x76d21b={'raw':!![],'where':{'id':_0x509dbc['params']['id']}},_0x2ad13c={};_0x2ad13c[_0xf5f2('0x31')]=_[_0xf5f2('0x41')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x2ad13c[_0xf5f2('0x2e')]=_[_0xf5f2('0x41')](_0x509dbc[_0xf5f2('0x2e')]);_0x2ad13c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],_0x2ad13c[_0xf5f2('0x2e')]);_0x76d21b[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],qs['fields'](_0x509dbc[_0xf5f2('0x2e')]['fields']));_0x76d21b[_0xf5f2('0x32')]=_0x76d21b[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x76d21b[_0xf5f2('0x32')]:_0x2ad13c[_0xf5f2('0x31')];if(_0x509dbc[_0xf5f2('0x2e')]['includeAll']){_0x76d21b[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x76d21b=_[_0xf5f2('0x39')]({},_0x76d21b,_0x509dbc[_0xf5f2('0x3b')]);return db[_0xf5f2('0x29')][_0xf5f2('0x42')](_0x76d21b)[_0xf5f2('0x24')](handleEntityNotFound(_0x59eb00,null))[_0xf5f2('0x24')](respondWithResult(_0x59eb00,null))[_0xf5f2('0x40')](handleError(_0x59eb00,null));};exports['create']=function(_0x35dece,_0x33ec29){return db[_0xf5f2('0x29')]['create'](_0x35dece[_0xf5f2('0x43')],{})[_0xf5f2('0x24')](respondWithResult(_0x33ec29,0xc9))[_0xf5f2('0x40')](handleError(_0x33ec29,null));};exports['update']=function(_0x57a7cb,_0x7bb942){if(_0x57a7cb[_0xf5f2('0x43')]['id']){delete _0x57a7cb['body']['id'];}return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x24')](saveUpdates(_0x57a7cb['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x7bb942,null))[_0xf5f2('0x40')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x11a083,_0x4fa738){return db[_0xf5f2('0x29')][_0xf5f2('0x42')]({'where':{'id':_0x11a083['params']['id']}})['then'](handleEntityNotFound(_0x4fa738,null))[_0xf5f2('0x24')](removeEntity(_0x4fa738,null))[_0xf5f2('0x40')](handleError(_0x4fa738,null));}; \ No newline at end of file +var _0xdb28=['error','stack','name','send','index','CloudProvider','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus'];(function(_0x38b06c,_0x423b3e){var _0x5d8ed2=function(_0x5132f9){while(--_0x5132f9){_0x38b06c['push'](_0x38b06c['shift']());}};_0x5d8ed2(++_0x423b3e);}(_0xdb28,0x106));var _0x8db2=function(_0x52d969,_0x352fd5){_0x52d969=_0x52d969-0x0;var _0x4da6e0=_0xdb28[_0x52d969];return _0x4da6e0;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x40')](_0x21bae5);})['then'](function(_0x49a7ae){_0x3124d5[_0x8db2('0x41')]=_0x49a7ae;return _0x3124d5;})['then'](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x42')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x43')]=function(_0x313130,_0x307783){var _0xb4fe2c={'raw':!![],'where':{'id':_0x313130[_0x8db2('0x44')]['id']}},_0x30d606={};_0x30d606['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x45')]);_0x30d606[_0x8db2('0x30')]=_['keys'](_0x313130[_0x8db2('0x30')]);_0x30d606[_0x8db2('0x39')]=_[_0x8db2('0x46')](_0x30d606[_0x8db2('0x32')],_0x30d606['query']);_0xb4fe2c[_0x8db2('0x34')]=_['intersection'](_0x30d606[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x313130[_0x8db2('0x30')]['fields']));_0xb4fe2c['attributes']=_0xb4fe2c[_0x8db2('0x34')]['length']?_0xb4fe2c[_0x8db2('0x34')]:_0x30d606[_0x8db2('0x32')];if(_0x313130[_0x8db2('0x30')][_0x8db2('0x3f')]){_0xb4fe2c[_0x8db2('0x47')]=[{'all':!![]}];}_0xb4fe2c=_[_0x8db2('0x3d')]({},_0xb4fe2c,_0x313130[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xb4fe2c)[_0x8db2('0x24')](handleEntityNotFound(_0x307783,null))[_0x8db2('0x24')](respondWithResult(_0x307783,null))[_0x8db2('0x42')](handleError(_0x307783,null));};exports['create']=function(_0x449109,_0x2ada52){return db[_0x8db2('0x2b')][_0x8db2('0x49')](_0x449109['body'],{})['then'](respondWithResult(_0x2ada52,0xc9))[_0x8db2('0x42')](handleError(_0x2ada52,null));};exports[_0x8db2('0x23')]=function(_0x164020,_0x4c66e5){if(_0x164020['body']['id']){delete _0x164020['body']['id'];}return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x164020[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x4c66e5,null))[_0x8db2('0x24')](saveUpdates(_0x164020[_0x8db2('0x4a')],null))[_0x8db2('0x24')](respondWithResult(_0x4c66e5,null))['catch'](handleError(_0x4c66e5,null));};exports['destroy']=function(_0x3d29bc,_0x18c6ef){return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x3d29bc[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x18c6ef,null))[_0x8db2('0x24')](removeEntity(_0x18c6ef,null))[_0x8db2('0x42')](handleError(_0x18c6ef,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index f724b10..f12d35b 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 _0xef33=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cloudProvider.attributes','exports','CloudProvider','cloud_providers','lodash'];(function(_0x5a07a1,_0x5a3fb2){var _0x5c7c75=function(_0x28ce71){while(--_0x28ce71){_0x5a07a1['push'](_0x5a07a1['shift']());}};_0x5c7c75(++_0x5a3fb2);}(_0xef33,0x12b));var _0x3ef3=function(_0xd4d04f,_0x50ef03){_0xd4d04f=_0xd4d04f-0x0;var _0x2e21d6=_0xef33[_0xd4d04f];return _0x2e21d6;};'use strict';var _=require(_0x3ef3('0x0'));var util=require('util');var logger=require(_0x3ef3('0x1'))(_0x3ef3('0x2'));var moment=require(_0x3ef3('0x3'));var BPromise=require(_0x3ef3('0x4'));var rp=require(_0x3ef3('0x5'));var fs=require('fs');var path=require(_0x3ef3('0x6'));var rimraf=require(_0x3ef3('0x7'));var config=require('../../config/environment');var attributes=require(_0x3ef3('0x8'));module[_0x3ef3('0x9')]=function(_0x48f4e1,_0x1e92ae){return _0x48f4e1['define'](_0x3ef3('0xa'),attributes,{'tableName':_0x3ef3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb94e=['CloudProvider','cloud_providers','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./cloudProvider.attributes','define'];(function(_0x9b5afc,_0x4360fd){var _0x15295e=function(_0x959ec2){while(--_0x959ec2){_0x9b5afc['push'](_0x9b5afc['shift']());}};_0x15295e(++_0x4360fd);}(_0xb94e,0x7b));var _0xeb94=function(_0xc302ab,_0x5b12ee){_0xc302ab=_0xc302ab-0x0;var _0x6b8209=_0xb94e[_0xc302ab];return _0x6b8209;};'use strict';var _=require(_0xeb94('0x0'));var util=require(_0xeb94('0x1'));var logger=require(_0xeb94('0x2'))('api');var moment=require('moment');var BPromise=require(_0xeb94('0x3'));var rp=require(_0xeb94('0x4'));var fs=require('fs');var path=require(_0xeb94('0x5'));var rimraf=require('rimraf');var config=require(_0xeb94('0x6'));var attributes=require(_0xeb94('0x7'));module['exports']=function(_0xbed1da,_0x1e18e3){return _0xbed1da[_0xeb94('0x8')](_0xeb94('0x9'),attributes,{'tableName':_0xeb94('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index acba678..608ac5b 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 _0xd10f=['../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xd10f,0x198));var _0xfd10=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd10f[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xfd10('0x0'));var util=require(_0xfd10('0x1'));var moment=require(_0xfd10('0x2'));var BPromise=require(_0xfd10('0x3'));var rs=require(_0xfd10('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd10('0x5'))['db'];var utils=require(_0xfd10('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xfd10('0x7'));var jayson=require(_0xfd10('0x8'));var client=jayson[_0xfd10('0x9')][_0xfd10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21610f,_0x10db32,_0xef584f){return new BPromise(function(_0x3ed592,_0x509cd6){return client[_0xfd10('0xb')](_0x21610f,_0xef584f)[_0xfd10('0xc')](function(_0x507ae0){logger[_0xfd10('0xd')](_0xfd10('0xe'),_0x10db32,_0xfd10('0xf'));logger[_0xfd10('0x10')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x10db32,'request\x20sent',JSON[_0xfd10('0x11')](_0x507ae0));if(_0x507ae0[_0xfd10('0x12')]){if(_0x507ae0['error'][_0xfd10('0x13')]===0x1f4){logger[_0xfd10('0x12')](_0xfd10('0xe'),_0x10db32,_0x507ae0[_0xfd10('0x12')][_0xfd10('0x14')]);return _0x509cd6(_0x507ae0[_0xfd10('0x12')][_0xfd10('0x14')]);}logger[_0xfd10('0x12')](_0xfd10('0xe'),_0x10db32,_0x507ae0[_0xfd10('0x12')][_0xfd10('0x14')]);return _0x3ed592(_0x507ae0[_0xfd10('0x12')][_0xfd10('0x14')]);}else{logger[_0xfd10('0xd')](_0xfd10('0xe'),_0x10db32,_0xfd10('0xf'));_0x3ed592(_0x507ae0[_0xfd10('0x15')][_0xfd10('0x14')]);}})[_0xfd10('0x16')](function(_0x1d0f8f){logger[_0xfd10('0x12')](_0xfd10('0xe'),_0x10db32,_0x1d0f8f);_0x509cd6(_0x1d0f8f);});});} \ No newline at end of file +var _0x6302=['moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','then','CloudProvider,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','util'];(function(_0x5649c2,_0x5c8d04){var _0x28b072=function(_0x17c1a0){while(--_0x17c1a0){_0x5649c2['push'](_0x5649c2['shift']());}};_0x28b072(++_0x5c8d04);}(_0x6302,0x109));var _0x2630=function(_0x199497,_0x33dc54){_0x199497=_0x199497-0x0;var _0x15b282=_0x6302[_0x199497];return _0x15b282;};'use strict';var _=require('lodash');var util=require(_0x2630('0x0'));var moment=require(_0x2630('0x1'));var BPromise=require(_0x2630('0x2'));var rs=require(_0x2630('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2630('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x2630('0x5'));var jayson=require(_0x2630('0x6'));var client=jayson[_0x2630('0x7')][_0x2630('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2867f8,_0x19231a,_0x2e1867){return new BPromise(function(_0x353f73,_0x581f4d){return client['request'](_0x2867f8,_0x2e1867)[_0x2630('0x9')](function(_0x10ffdf){logger['info'](_0x2630('0xa'),_0x19231a,'request\x20sent');logger[_0x2630('0xb')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x19231a,_0x2630('0xc'),JSON[_0x2630('0xd')](_0x10ffdf));if(_0x10ffdf[_0x2630('0xe')]){if(_0x10ffdf[_0x2630('0xe')][_0x2630('0xf')]===0x1f4){logger[_0x2630('0xe')]('CloudProvider,\x20%s,\x20%s',_0x19231a,_0x10ffdf[_0x2630('0xe')][_0x2630('0x10')]);return _0x581f4d(_0x10ffdf[_0x2630('0xe')][_0x2630('0x10')]);}logger['error'](_0x2630('0xa'),_0x19231a,_0x10ffdf[_0x2630('0xe')][_0x2630('0x10')]);return _0x353f73(_0x10ffdf['error'][_0x2630('0x10')]);}else{logger['info'](_0x2630('0xa'),_0x19231a,_0x2630('0xc'));_0x353f73(_0x10ffdf[_0x2630('0x11')][_0x2630('0x10')]);}})[_0x2630('0x12')](function(_0x18b2b0){logger[_0x2630('0xe')](_0x2630('0xa'),_0x19231a,_0x18b2b0);_0x581f4d(_0x18b2b0);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index a133a2b..71c6f16 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 _0x3f96=['/:id','show','post','create','put','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','isAuthenticated','index','get'];(function(_0x49beea,_0x47add1){var _0x27693a=function(_0x192ed8){while(--_0x192ed8){_0x49beea['push'](_0x49beea['shift']());}};_0x27693a(++_0x47add1);}(_0x3f96,0x1d3));var _0x63f9=function(_0x124a01,_0x280aa9){_0x124a01=_0x124a01-0x0;var _0x5e97d9=_0x3f96[_0x124a01];return _0x5e97d9;};'use strict';var multer=require(_0x63f9('0x0'));var util=require(_0x63f9('0x1'));var path=require(_0x63f9('0x2'));var timeout=require(_0x63f9('0x3'));var express=require(_0x63f9('0x4'));var router=express['Router']();var fs_extra=require(_0x63f9('0x5'));var auth=require(_0x63f9('0x6'));var interaction=require(_0x63f9('0x7'));var config=require(_0x63f9('0x8'));var controller=require(_0x63f9('0x9'));router['get']('/',auth[_0x63f9('0xa')](),controller[_0x63f9('0xb')]);router[_0x63f9('0xc')](_0x63f9('0xd'),auth['isAuthenticated'](),controller[_0x63f9('0xe')]);router[_0x63f9('0xf')]('/',auth[_0x63f9('0xa')](),controller[_0x63f9('0x10')]);router[_0x63f9('0x11')](_0x63f9('0xd'),auth[_0x63f9('0xa')](),controller[_0x63f9('0x12')]);router['delete'](_0x63f9('0xd'),auth[_0x63f9('0xa')](),controller['destroy']);module[_0x63f9('0x13')]=router; \ No newline at end of file +var _0xfbb5=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x4fc676,_0x8e397d){var _0x2a991f=function(_0x10a7ce){while(--_0x10a7ce){_0x4fc676['push'](_0x4fc676['shift']());}};_0x2a991f(++_0x8e397d);}(_0xfbb5,0xc6));var _0x5fbb=function(_0x1f4c31,_0x5d6735){_0x1f4c31=_0x1f4c31-0x0;var _0x1d95d5=_0xfbb5[_0x1f4c31];return _0x1d95d5;};'use strict';var multer=require(_0x5fbb('0x0'));var util=require(_0x5fbb('0x1'));var path=require(_0x5fbb('0x2'));var timeout=require(_0x5fbb('0x3'));var express=require(_0x5fbb('0x4'));var router=express[_0x5fbb('0x5')]();var fs_extra=require(_0x5fbb('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5fbb('0x7'));var config=require(_0x5fbb('0x8'));var controller=require('./cloudProvider.controller');router['get']('/',auth[_0x5fbb('0x9')](),controller[_0x5fbb('0xa')]);router[_0x5fbb('0xb')](_0x5fbb('0xc'),auth[_0x5fbb('0x9')](),controller[_0x5fbb('0xd')]);router[_0x5fbb('0xe')]('/',auth[_0x5fbb('0x9')](),controller[_0x5fbb('0xf')]);router[_0x5fbb('0x10')](_0x5fbb('0xc'),auth[_0x5fbb('0x9')](),controller[_0x5fbb('0x11')]);router[_0x5fbb('0x12')]('/:id',auth[_0x5fbb('0x9')](),controller[_0x5fbb('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index da8e570..2f2cc41 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 _0x644f=['sequelize','exports','STRING','name'];(function(_0x46add2,_0x4346d4){var _0x226d64=function(_0x11ae18){while(--_0x11ae18){_0x46add2['push'](_0x46add2['shift']());}};_0x226d64(++_0x4346d4);}(_0x644f,0x190));var _0xf644=function(_0x2265da,_0xfbbd2e){_0x2265da=_0x2265da-0x0;var _0x430c2b=_0x644f[_0x2265da];return _0x430c2b;};'use strict';var Sequelize=require(_0xf644('0x0'));module[_0xf644('0x1')]={'name':{'type':Sequelize[_0xf644('0x2')],'unique':_0xf644('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xf644('0x2')]},'companyId':{'type':Sequelize[_0xf644('0x2')]},'website':{'type':Sequelize[_0xf644('0x2')]},'phone':{'type':Sequelize[_0xf644('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf644('0x2')]},'street':{'type':Sequelize[_0xf644('0x2')]},'postalCode':{'type':Sequelize[_0xf644('0x2')]},'city':{'type':Sequelize[_0xf644('0x2')]},'country':{'type':Sequelize[_0xf644('0x2')]},'email':{'type':Sequelize[_0xf644('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xf644('0x2')]},'sStreet':{'type':Sequelize[_0xf644('0x2')]},'sPostalCode':{'type':Sequelize[_0xf644('0x2')]},'sCity':{'type':Sequelize[_0xf644('0x2')]},'sCountry':{'type':Sequelize[_0xf644('0x2')]},'description':{'type':Sequelize[_0xf644('0x2')]}}; \ No newline at end of file +var _0xec15=['exports','STRING','sequelize'];(function(_0x582bef,_0x407e89){var _0x218ecd=function(_0x30c5a4){while(--_0x30c5a4){_0x582bef['push'](_0x582bef['shift']());}};_0x218ecd(++_0x407e89);}(_0xec15,0x1bb));var _0x5ec1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xec15[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x5ec1('0x0'));module[_0x5ec1('0x1')]={'name':{'type':Sequelize[_0x5ec1('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x5ec1('0x2')]},'website':{'type':Sequelize[_0x5ec1('0x2')]},'phone':{'type':Sequelize[_0x5ec1('0x2')]},'fax':{'type':Sequelize[_0x5ec1('0x2')]},'type':{'type':Sequelize[_0x5ec1('0x2')]},'street':{'type':Sequelize[_0x5ec1('0x2')]},'postalCode':{'type':Sequelize[_0x5ec1('0x2')]},'city':{'type':Sequelize[_0x5ec1('0x2')]},'country':{'type':Sequelize[_0x5ec1('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x5ec1('0x2')]},'sPostalCode':{'type':Sequelize[_0x5ec1('0x2')]},'sCity':{'type':Sequelize[_0x5ec1('0x2')]},'sCountry':{'type':Sequelize[_0x5ec1('0x2')]},'description':{'type':Sequelize[_0x5ec1('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index d68ba36..3bcf44f 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 _0xbe5a=['merge','filter','options','CmCompany','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addContacts','ids','getContacts','findOne','CmContact','map','hasOwnProperty','nolimit','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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','sendStatus','status','end','offset','undefined','limit','count','json','reject','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','describe','model','keys','query','filters','intersection','attributes','fields','length','order','sort','pick','where'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xbe5a,0x75));var _0xabe5=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0xbe5a[_0x28aea5];return _0x6a55f9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xabe5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xabe5('0x1'));var rp=require(_0xabe5('0x2'));var moment=require(_0xabe5('0x3'));var BPromise=require(_0xabe5('0x4'));var Mustache=require(_0xabe5('0x5'));var util=require(_0xabe5('0x6'));var path=require(_0xabe5('0x7'));var sox=require(_0xabe5('0x8'));var csv=require(_0xabe5('0x9'));var ejs=require(_0xabe5('0xa'));var fs=require('fs');var fs_extra=require(_0xabe5('0xb'));var _=require(_0xabe5('0xc'));var squel=require(_0xabe5('0xd'));var crypto=require(_0xabe5('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xabe5('0x9'));var querystring=require(_0xabe5('0xf'));var Papa=require(_0xabe5('0x10'));var Redis=require(_0xabe5('0x11'));var authService=require(_0xabe5('0x12'));var qs=require(_0xabe5('0x13'));var as=require(_0xabe5('0x14'));var hardwareService=require(_0xabe5('0x15'));var logger=require(_0xabe5('0x16'))(_0xabe5('0x17'));var utils=require(_0xabe5('0x18'));var config=require(_0xabe5('0x19'));var licenseUtil=require(_0xabe5('0x1a'));var db=require(_0xabe5('0x1b'))['db'];function respondWithStatusCode(_0x1231e2,_0x5cca47){_0x5cca47=_0x5cca47||0xcc;return function(_0x1f3685){if(_0x1f3685){return _0x1231e2[_0xabe5('0x1c')](_0x5cca47);}return _0x1231e2[_0xabe5('0x1d')](_0x5cca47)[_0xabe5('0x1e')]();};}function respondWithResult(_0x16d5ce,_0x1f2282){_0x1f2282=_0x1f2282||0xc8;return function(_0xb42547){if(_0xb42547){return _0x16d5ce['status'](_0x1f2282)['json'](_0xb42547);}};}function respondWithFilteredResult(_0xe1825c,_0x510985){return function(_0x33ff92){if(_0x33ff92){var _0x4ce082=typeof _0x510985[_0xabe5('0x1f')]===_0xabe5('0x20')&&typeof _0x510985[_0xabe5('0x21')]===_0xabe5('0x20');var _0xe51f5=_0x33ff92['count'];var _0x4f74ed=_0x4ce082?0x0:_0x510985[_0xabe5('0x1f')];var _0x1f1e54=_0x4ce082?_0x33ff92[_0xabe5('0x22')]:_0x510985[_0xabe5('0x1f')]+_0x510985[_0xabe5('0x21')];var _0x163b02;if(_0x1f1e54>=_0xe51f5){_0x1f1e54=_0xe51f5;_0x163b02=0xc8;}else{_0x163b02=0xce;}_0xe1825c[_0xabe5('0x1d')](_0x163b02);return _0xe1825c['set']('Content-Range',_0x4f74ed+'-'+_0x1f1e54+'/'+_0xe51f5)[_0xabe5('0x23')](_0x33ff92);}return null;};}function patchUpdates(_0x56612e){return function(_0x52eaec){try{jsonpatch['apply'](_0x52eaec,_0x56612e,!![]);}catch(_0x366478){return BPromise[_0xabe5('0x24')](_0x366478);}return _0x52eaec[_0xabe5('0x25')]();};}function saveUpdates(_0x4b0e2d,_0x50ea87){return function(_0x298f85){if(_0x298f85){return _0x298f85[_0xabe5('0x26')](_0x4b0e2d)[_0xabe5('0x27')](function(_0x27194f){return _0x27194f;});}return null;};}function removeEntity(_0xaaeb92,_0x1a40e1){return function(_0x5b040d){if(_0x5b040d){return _0x5b040d[_0xabe5('0x28')]()[_0xabe5('0x27')](function(){var _0x13fb5e=_0x5b040d[_0xabe5('0x29')]({'plain':!![]});var _0x227315=_0xabe5('0x2a');return db[_0xabe5('0x2b')][_0xabe5('0x28')]({'where':{'type':_0x227315,'resourceId':_0x13fb5e['id']}})[_0xabe5('0x27')](function(){return _0x5b040d;});})['then'](function(){_0xaaeb92[_0xabe5('0x1d')](0xcc)[_0xabe5('0x1e')]();});}};}function handleEntityNotFound(_0xfdf0e8,_0x41f525){return function(_0x111bcf){if(!_0x111bcf){_0xfdf0e8[_0xabe5('0x1c')](0x194);}return _0x111bcf;};}function handleError(_0x5b0c32,_0x293811){_0x293811=_0x293811||0x1f4;return function(_0x2e65f1){logger[_0xabe5('0x2c')](_0x2e65f1[_0xabe5('0x2d')]);if(_0x2e65f1[_0xabe5('0x2e')]){delete _0x2e65f1[_0xabe5('0x2e')];}_0x5b0c32[_0xabe5('0x1d')](_0x293811)[_0xabe5('0x2f')](_0x2e65f1);};}exports['index']=function(_0x330007,_0x4a9417){var _0x2a436e={},_0x4126c7={},_0xd4bc9a={'count':0x0,'rows':[]};return db['CmCompany'][_0xabe5('0x30')]()[_0xabe5('0x27')](function(_0x36d3c2){_0x4126c7[_0xabe5('0x31')]=_[_0xabe5('0x32')](_0x36d3c2);_0x4126c7[_0xabe5('0x33')]=_[_0xabe5('0x32')](_0x330007[_0xabe5('0x33')]);_0x4126c7[_0xabe5('0x34')]=_[_0xabe5('0x35')](_0x4126c7[_0xabe5('0x31')],_0x4126c7[_0xabe5('0x33')]);_0x2a436e[_0xabe5('0x36')]=_[_0xabe5('0x35')](_0x4126c7[_0xabe5('0x31')],qs[_0xabe5('0x37')](_0x330007[_0xabe5('0x33')][_0xabe5('0x37')]));_0x2a436e[_0xabe5('0x36')]=_0x2a436e[_0xabe5('0x36')][_0xabe5('0x38')]?_0x2a436e['attributes']:_0x4126c7[_0xabe5('0x31')];if(!_0x330007['query']['hasOwnProperty']('nolimit')){_0x2a436e[_0xabe5('0x21')]=qs['limit'](_0x330007[_0xabe5('0x33')]['limit']);_0x2a436e[_0xabe5('0x1f')]=qs['offset'](_0x330007[_0xabe5('0x33')][_0xabe5('0x1f')]);}_0x2a436e[_0xabe5('0x39')]=qs[_0xabe5('0x3a')](_0x330007[_0xabe5('0x33')]['sort']);_0x2a436e['where']=qs[_0xabe5('0x34')](_[_0xabe5('0x3b')](_0x330007[_0xabe5('0x33')],_0x4126c7[_0xabe5('0x34')]),_0x36d3c2);if(_0x330007['query']['filter']){_0x2a436e[_0xabe5('0x3c')]=_[_0xabe5('0x3d')](_0x2a436e[_0xabe5('0x3c')],{'$or':_['map'](_0x2a436e[_0xabe5('0x36')],function(_0x18e3b8){var _0x482ef4={};_0x482ef4[_0x18e3b8]={'$like':'%'+_0x330007[_0xabe5('0x33')][_0xabe5('0x3e')]+'%'};return _0x482ef4;})});}_0x2a436e=_[_0xabe5('0x3d')]({},_0x2a436e,_0x330007[_0xabe5('0x3f')]);var _0x207c48={'where':_0x2a436e[_0xabe5('0x3c')]};return db[_0xabe5('0x40')][_0xabe5('0x22')](_0x207c48)[_0xabe5('0x27')](function(_0x454bd7){_0xd4bc9a[_0xabe5('0x22')]=_0x454bd7;if(_0x330007[_0xabe5('0x33')][_0xabe5('0x41')]){_0x2a436e[_0xabe5('0x42')]=[{'all':!![]}];}return db[_0xabe5('0x40')][_0xabe5('0x43')](_0x2a436e);})[_0xabe5('0x27')](function(_0x320cbe){_0xd4bc9a[_0xabe5('0x44')]=_0x320cbe;return _0xd4bc9a;})[_0xabe5('0x27')](respondWithFilteredResult(_0x4a9417,_0x2a436e))[_0xabe5('0x45')](handleError(_0x4a9417,null));})[_0xabe5('0x45')](handleError(_0x4a9417,null));};exports[_0xabe5('0x46')]=function(_0x4ab9fe,_0x4ae0c9){var _0x2c08e2={'raw':![],'where':{'id':_0x4ab9fe[_0xabe5('0x47')]['id']}},_0x1bf859={};_0x1bf859[_0xabe5('0x31')]=_[_0xabe5('0x32')](db['CmCompany']['rawAttributes']);_0x1bf859[_0xabe5('0x33')]=_[_0xabe5('0x32')](_0x4ab9fe[_0xabe5('0x33')]);_0x1bf859[_0xabe5('0x34')]=_[_0xabe5('0x35')](_0x1bf859[_0xabe5('0x31')],_0x1bf859[_0xabe5('0x33')]);_0x2c08e2[_0xabe5('0x36')]=_[_0xabe5('0x35')](_0x1bf859['model'],qs[_0xabe5('0x37')](_0x4ab9fe[_0xabe5('0x33')][_0xabe5('0x37')]));_0x2c08e2[_0xabe5('0x36')]=_0x2c08e2[_0xabe5('0x36')][_0xabe5('0x38')]?_0x2c08e2[_0xabe5('0x36')]:_0x1bf859[_0xabe5('0x31')];if(_0x4ab9fe[_0xabe5('0x33')][_0xabe5('0x41')]){_0x2c08e2[_0xabe5('0x42')]=[{'all':!![]}];}_0x2c08e2=_[_0xabe5('0x3d')]({},_0x2c08e2,_0x4ab9fe[_0xabe5('0x3f')]);return db[_0xabe5('0x40')]['find'](_0x2c08e2)[_0xabe5('0x27')](handleEntityNotFound(_0x4ae0c9,null))['then'](respondWithResult(_0x4ae0c9,null))[_0xabe5('0x45')](handleError(_0x4ae0c9,null));};exports[_0xabe5('0x48')]=function(_0x19ac37,_0x530bca){return db[_0xabe5('0x40')][_0xabe5('0x48')](_0x19ac37[_0xabe5('0x49')],{})['then'](function(_0x184898){var _0x2d662a=_0x19ac37[_0xabe5('0x4a')]['get']({'plain':!![]});if(!_0x2d662a)throw new Error(_0xabe5('0x4b'));if(_0x2d662a[_0xabe5('0x4c')]===_0xabe5('0x4a')){var _0x58be35=_0x184898[_0xabe5('0x29')]({'plain':!![]});var _0x141490=_0xabe5('0x2a');return db[_0xabe5('0x4d')]['find']({'where':{'name':_0x141490,'userProfileId':_0x2d662a['userProfileId']},'raw':!![]})[_0xabe5('0x27')](function(_0x305f25){if(_0x305f25&&_0x305f25[_0xabe5('0x4e')]===0x0){return db[_0xabe5('0x2b')]['create']({'name':_0x58be35[_0xabe5('0x2e')],'resourceId':_0x58be35['id'],'type':_0x305f25[_0xabe5('0x2e')],'sectionId':_0x305f25['id']},{})[_0xabe5('0x27')](function(){return _0x184898;});}else{return _0x184898;}})[_0xabe5('0x45')](function(_0x2290d2){logger[_0xabe5('0x2c')](_0xabe5('0x4f'),_0x2290d2);throw _0x2290d2;});}return _0x184898;})['then'](respondWithResult(_0x530bca,0xc9))[_0xabe5('0x45')](handleError(_0x530bca,null));};exports['update']=function(_0x17ac3d,_0x1953ac){if(_0x17ac3d[_0xabe5('0x49')]['id']){delete _0x17ac3d[_0xabe5('0x49')]['id'];}return db[_0xabe5('0x40')][_0xabe5('0x50')]({'where':{'id':_0x17ac3d[_0xabe5('0x47')]['id']}})[_0xabe5('0x27')](handleEntityNotFound(_0x1953ac,null))[_0xabe5('0x27')](saveUpdates(_0x17ac3d['body'],null))[_0xabe5('0x27')](respondWithResult(_0x1953ac,null))['catch'](handleError(_0x1953ac,null));};exports[_0xabe5('0x28')]=function(_0x230dae,_0x5bb534){return db[_0xabe5('0x40')]['find']({'where':{'id':_0x230dae['params']['id']}})['then'](handleEntityNotFound(_0x5bb534,null))['then'](removeEntity(_0x5bb534,null))['catch'](handleError(_0x5bb534,null));};exports[_0xabe5('0x30')]=function(_0xf597cd,_0xdeb798){return db[_0xabe5('0x40')][_0xabe5('0x30')]()[_0xabe5('0x27')](respondWithResult(_0xdeb798,null))[_0xabe5('0x45')](handleError(_0xdeb798,null));};exports[_0xabe5('0x51')]=function(_0x55660a,_0x2d7eec,_0x16f0d2){return db['CmContact'][_0xabe5('0x50')]({'where':{'id':_0x55660a[_0xabe5('0x47')]['id']}})[_0xabe5('0x27')](handleEntityNotFound(_0x2d7eec,null))[_0xabe5('0x27')](function(_0x5b0abb){if(_0x5b0abb){return _0x5b0abb['addContacts'](_0x55660a['body'][_0xabe5('0x52')],_['omit'](_0x55660a['body'],[_0xabe5('0x52'),'id'])||{});}})[_0xabe5('0x27')](respondWithResult(_0x2d7eec,null))[_0xabe5('0x45')](handleError(_0x2d7eec,null));};exports[_0xabe5('0x53')]=function(_0x34ea57,_0x8008ac,_0x421516){var _0xc8db38={};var _0x2af756={};var _0x41ec9e;var _0x165056;return db[_0xabe5('0x40')][_0xabe5('0x54')]({'where':{'id':_0x34ea57['params']['id']}})['then'](handleEntityNotFound(_0x8008ac,null))[_0xabe5('0x27')](function(_0x88995e){if(_0x88995e){_0x41ec9e=_0x88995e;_0x2af756['model']=_[_0xabe5('0x32')](db[_0xabe5('0x55')]['rawAttributes']);_0x2af756['query']=_[_0xabe5('0x32')](_0x34ea57[_0xabe5('0x33')]);_0x2af756[_0xabe5('0x34')]=_['intersection'](_0x2af756[_0xabe5('0x31')],_0x2af756[_0xabe5('0x33')]);_0xc8db38[_0xabe5('0x36')]=_['intersection'](_0x2af756[_0xabe5('0x31')],qs[_0xabe5('0x37')](_0x34ea57[_0xabe5('0x33')]['fields']));_0xc8db38['attributes']=_0xc8db38[_0xabe5('0x36')][_0xabe5('0x38')]?_0xc8db38[_0xabe5('0x36')]:_0x2af756[_0xabe5('0x31')];_0xc8db38['order']=qs['sort'](_0x34ea57[_0xabe5('0x33')][_0xabe5('0x3a')]);_0xc8db38[_0xabe5('0x3c')]=qs[_0xabe5('0x34')](_[_0xabe5('0x3b')](_0x34ea57[_0xabe5('0x33')],_0x2af756[_0xabe5('0x34')]));if(_0x34ea57[_0xabe5('0x33')][_0xabe5('0x3e')]){_0xc8db38[_0xabe5('0x3c')]=_['merge'](_0xc8db38[_0xabe5('0x3c')],{'$or':_[_0xabe5('0x56')](_0xc8db38[_0xabe5('0x36')],function(_0x2d26de){var _0x2a9242={};_0x2a9242[_0x2d26de]={'$like':'%'+_0x34ea57['query'][_0xabe5('0x3e')]+'%'};return _0x2a9242;})});}_0xc8db38=_[_0xabe5('0x3d')]({},_0xc8db38,_0x34ea57[_0xabe5('0x3f')]);return _0x41ec9e[_0xabe5('0x53')](_0xc8db38);}})[_0xabe5('0x27')](function(_0x4c01c4){if(_0x4c01c4){_0x165056=_0x4c01c4[_0xabe5('0x38')];if(!_0x34ea57[_0xabe5('0x33')][_0xabe5('0x57')](_0xabe5('0x58'))){_0xc8db38[_0xabe5('0x21')]=qs[_0xabe5('0x21')](_0x34ea57[_0xabe5('0x33')]['limit']);_0xc8db38['offset']=qs[_0xabe5('0x1f')](_0x34ea57[_0xabe5('0x33')]['offset']);}return _0x41ec9e[_0xabe5('0x53')](_0xc8db38);}})['then'](function(_0x10d126){if(_0x10d126){return _0x10d126?{'count':_0x165056,'rows':_0x10d126}:null;}})[_0xabe5('0x27')](respondWithResult(_0x8008ac,null))[_0xabe5('0x45')](handleError(_0x8008ac,null));}; \ No newline at end of file +var _0x78f0=['nolimit','limit','order','sort','pick','where','merge','map','filter','options','includeAll','include','findAll','rows','catch','show','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','params','addContacts','ids','omit','hasOwnProperty','getContacts','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','json','offset','undefined','count','set','Content-Range','apply','update','then','destroy','get','Companies','UserProfileResource','sendStatus','error','stack','name','send','index','CmCompany','describe','keys','query','filters','intersection','attributes','model','fields','length'];(function(_0x644e69,_0x54160e){var _0xa12727=function(_0xdd6d39){while(--_0xdd6d39){_0x644e69['push'](_0x644e69['shift']());}};_0xa12727(++_0x54160e);}(_0x78f0,0x181));var _0x078f=function(_0x4c92fa,_0x21e2da){_0x4c92fa=_0x4c92fa-0x0;var _0xbc129f=_0x78f0[_0x4c92fa];return _0xbc129f;};'use strict';var emlformat=require(_0x078f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x078f('0x1'));var rp=require(_0x078f('0x2'));var moment=require('moment');var BPromise=require(_0x078f('0x3'));var Mustache=require(_0x078f('0x4'));var util=require('util');var path=require(_0x078f('0x5'));var sox=require(_0x078f('0x6'));var csv=require(_0x078f('0x7'));var ejs=require(_0x078f('0x8'));var fs=require('fs');var fs_extra=require(_0x078f('0x9'));var _=require(_0x078f('0xa'));var squel=require(_0x078f('0xb'));var crypto=require('crypto');var jsforce=require(_0x078f('0xc'));var deskjs=require(_0x078f('0xd'));var toCsv=require(_0x078f('0x7'));var querystring=require(_0x078f('0xe'));var Papa=require(_0x078f('0xf'));var Redis=require(_0x078f('0x10'));var authService=require(_0x078f('0x11'));var qs=require(_0x078f('0x12'));var as=require(_0x078f('0x13'));var hardwareService=require(_0x078f('0x14'));var logger=require(_0x078f('0x15'))(_0x078f('0x16'));var utils=require(_0x078f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x078f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59b52f,_0x4c982d){_0x4c982d=_0x4c982d||0xcc;return function(_0x2a8c71){if(_0x2a8c71){return _0x59b52f['sendStatus'](_0x4c982d);}return _0x59b52f[_0x078f('0x19')](_0x4c982d)['end']();};}function respondWithResult(_0x1d568f,_0x526048){_0x526048=_0x526048||0xc8;return function(_0x2d51cf){if(_0x2d51cf){return _0x1d568f[_0x078f('0x19')](_0x526048)[_0x078f('0x1a')](_0x2d51cf);}};}function respondWithFilteredResult(_0x39fc0d,_0x59d289){return function(_0x2b1951){if(_0x2b1951){var _0x3e3c27=typeof _0x59d289[_0x078f('0x1b')]===_0x078f('0x1c')&&typeof _0x59d289['limit']===_0x078f('0x1c');var _0x4f1c5a=_0x2b1951[_0x078f('0x1d')];var _0x2f7aaf=_0x3e3c27?0x0:_0x59d289[_0x078f('0x1b')];var _0x1414c8=_0x3e3c27?_0x2b1951['count']:_0x59d289[_0x078f('0x1b')]+_0x59d289['limit'];var _0x26ee95;if(_0x1414c8>=_0x4f1c5a){_0x1414c8=_0x4f1c5a;_0x26ee95=0xc8;}else{_0x26ee95=0xce;}_0x39fc0d['status'](_0x26ee95);return _0x39fc0d[_0x078f('0x1e')](_0x078f('0x1f'),_0x2f7aaf+'-'+_0x1414c8+'/'+_0x4f1c5a)[_0x078f('0x1a')](_0x2b1951);}return null;};}function patchUpdates(_0x190886){return function(_0x32eeff){try{jsonpatch[_0x078f('0x20')](_0x32eeff,_0x190886,!![]);}catch(_0xf67f8e){return BPromise['reject'](_0xf67f8e);}return _0x32eeff['save']();};}function saveUpdates(_0x285f1b,_0x319bb5){return function(_0x341573){if(_0x341573){return _0x341573[_0x078f('0x21')](_0x285f1b)[_0x078f('0x22')](function(_0x28c4a0){return _0x28c4a0;});}return null;};}function removeEntity(_0x4184cb,_0x38c041){return function(_0x44dcb3){if(_0x44dcb3){return _0x44dcb3[_0x078f('0x23')]()[_0x078f('0x22')](function(){var _0x2c1c1f=_0x44dcb3[_0x078f('0x24')]({'plain':!![]});var _0xa590be=_0x078f('0x25');return db[_0x078f('0x26')]['destroy']({'where':{'type':_0xa590be,'resourceId':_0x2c1c1f['id']}})['then'](function(){return _0x44dcb3;});})['then'](function(){_0x4184cb[_0x078f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bb487,_0x183aa1){return function(_0x4387ce){if(!_0x4387ce){_0x4bb487[_0x078f('0x27')](0x194);}return _0x4387ce;};}function handleError(_0x2e7528,_0x169ea0){_0x169ea0=_0x169ea0||0x1f4;return function(_0x3b7d1c){logger[_0x078f('0x28')](_0x3b7d1c[_0x078f('0x29')]);if(_0x3b7d1c[_0x078f('0x2a')]){delete _0x3b7d1c['name'];}_0x2e7528[_0x078f('0x19')](_0x169ea0)[_0x078f('0x2b')](_0x3b7d1c);};}exports[_0x078f('0x2c')]=function(_0x5502e4,_0x375367){var _0x5a05e8={},_0x4b0f06={},_0x1f88a0={'count':0x0,'rows':[]};return db[_0x078f('0x2d')][_0x078f('0x2e')]()['then'](function(_0x136700){_0x4b0f06['model']=_[_0x078f('0x2f')](_0x136700);_0x4b0f06[_0x078f('0x30')]=_[_0x078f('0x2f')](_0x5502e4[_0x078f('0x30')]);_0x4b0f06[_0x078f('0x31')]=_[_0x078f('0x32')](_0x4b0f06['model'],_0x4b0f06['query']);_0x5a05e8[_0x078f('0x33')]=_['intersection'](_0x4b0f06[_0x078f('0x34')],qs[_0x078f('0x35')](_0x5502e4['query']['fields']));_0x5a05e8[_0x078f('0x33')]=_0x5a05e8[_0x078f('0x33')][_0x078f('0x36')]?_0x5a05e8[_0x078f('0x33')]:_0x4b0f06[_0x078f('0x34')];if(!_0x5502e4[_0x078f('0x30')]['hasOwnProperty'](_0x078f('0x37'))){_0x5a05e8[_0x078f('0x38')]=qs[_0x078f('0x38')](_0x5502e4[_0x078f('0x30')]['limit']);_0x5a05e8['offset']=qs[_0x078f('0x1b')](_0x5502e4[_0x078f('0x30')][_0x078f('0x1b')]);}_0x5a05e8[_0x078f('0x39')]=qs[_0x078f('0x3a')](_0x5502e4[_0x078f('0x30')]['sort']);_0x5a05e8['where']=qs[_0x078f('0x31')](_[_0x078f('0x3b')](_0x5502e4['query'],_0x4b0f06[_0x078f('0x31')]),_0x136700);if(_0x5502e4['query']['filter']){_0x5a05e8[_0x078f('0x3c')]=_[_0x078f('0x3d')](_0x5a05e8[_0x078f('0x3c')],{'$or':_[_0x078f('0x3e')](_0x5a05e8['attributes'],function(_0xe7ab75){var _0x3c2316={};_0x3c2316[_0xe7ab75]={'$like':'%'+_0x5502e4['query'][_0x078f('0x3f')]+'%'};return _0x3c2316;})});}_0x5a05e8=_[_0x078f('0x3d')]({},_0x5a05e8,_0x5502e4[_0x078f('0x40')]);var _0x1c5ccf={'where':_0x5a05e8[_0x078f('0x3c')]};return db[_0x078f('0x2d')][_0x078f('0x1d')](_0x1c5ccf)[_0x078f('0x22')](function(_0x5b67ee){_0x1f88a0[_0x078f('0x1d')]=_0x5b67ee;if(_0x5502e4[_0x078f('0x30')][_0x078f('0x41')]){_0x5a05e8[_0x078f('0x42')]=[{'all':!![]}];}return db['CmCompany'][_0x078f('0x43')](_0x5a05e8);})['then'](function(_0x5733bc){_0x1f88a0[_0x078f('0x44')]=_0x5733bc;return _0x1f88a0;})['then'](respondWithFilteredResult(_0x375367,_0x5a05e8))['catch'](handleError(_0x375367,null));})[_0x078f('0x45')](handleError(_0x375367,null));};exports[_0x078f('0x46')]=function(_0x3b78a8,_0x5e9e88){var _0x9cae30={'raw':![],'where':{'id':_0x3b78a8['params']['id']}},_0x40bf81={};_0x40bf81[_0x078f('0x34')]=_[_0x078f('0x2f')](db[_0x078f('0x2d')][_0x078f('0x47')]);_0x40bf81[_0x078f('0x30')]=_[_0x078f('0x2f')](_0x3b78a8['query']);_0x40bf81[_0x078f('0x31')]=_[_0x078f('0x32')](_0x40bf81['model'],_0x40bf81[_0x078f('0x30')]);_0x9cae30[_0x078f('0x33')]=_[_0x078f('0x32')](_0x40bf81[_0x078f('0x34')],qs[_0x078f('0x35')](_0x3b78a8[_0x078f('0x30')][_0x078f('0x35')]));_0x9cae30['attributes']=_0x9cae30[_0x078f('0x33')][_0x078f('0x36')]?_0x9cae30[_0x078f('0x33')]:_0x40bf81[_0x078f('0x34')];if(_0x3b78a8[_0x078f('0x30')][_0x078f('0x41')]){_0x9cae30['include']=[{'all':!![]}];}_0x9cae30=_['merge']({},_0x9cae30,_0x3b78a8[_0x078f('0x40')]);return db[_0x078f('0x2d')][_0x078f('0x48')](_0x9cae30)[_0x078f('0x22')](handleEntityNotFound(_0x5e9e88,null))['then'](respondWithResult(_0x5e9e88,null))[_0x078f('0x45')](handleError(_0x5e9e88,null));};exports[_0x078f('0x49')]=function(_0x317576,_0x434d00){return db['CmCompany'][_0x078f('0x49')](_0x317576[_0x078f('0x4a')],{})[_0x078f('0x22')](function(_0x4ba184){var _0x19e68b=_0x317576[_0x078f('0x4b')][_0x078f('0x24')]({'plain':!![]});if(!_0x19e68b)throw new Error(_0x078f('0x4c'));if(_0x19e68b[_0x078f('0x4d')]===_0x078f('0x4b')){var _0x591946=_0x4ba184[_0x078f('0x24')]({'plain':!![]});var _0x398e5f=_0x078f('0x25');return db[_0x078f('0x4e')]['find']({'where':{'name':_0x398e5f,'userProfileId':_0x19e68b[_0x078f('0x4f')]},'raw':!![]})['then'](function(_0x72a76f){if(_0x72a76f&&_0x72a76f[_0x078f('0x50')]===0x0){return db['UserProfileResource'][_0x078f('0x49')]({'name':_0x591946[_0x078f('0x2a')],'resourceId':_0x591946['id'],'type':_0x72a76f[_0x078f('0x2a')],'sectionId':_0x72a76f['id']},{})[_0x078f('0x22')](function(){return _0x4ba184;});}else{return _0x4ba184;}})[_0x078f('0x45')](function(_0x36538a){logger[_0x078f('0x28')](_0x078f('0x51'),_0x36538a);throw _0x36538a;});}return _0x4ba184;})[_0x078f('0x22')](respondWithResult(_0x434d00,0xc9))[_0x078f('0x45')](handleError(_0x434d00,null));};exports['update']=function(_0x191733,_0x390f2){if(_0x191733[_0x078f('0x4a')]['id']){delete _0x191733[_0x078f('0x4a')]['id'];}return db[_0x078f('0x2d')]['find']({'where':{'id':_0x191733[_0x078f('0x52')]['id']}})[_0x078f('0x22')](handleEntityNotFound(_0x390f2,null))['then'](saveUpdates(_0x191733[_0x078f('0x4a')],null))[_0x078f('0x22')](respondWithResult(_0x390f2,null))['catch'](handleError(_0x390f2,null));};exports[_0x078f('0x23')]=function(_0x44dc71,_0x4696e8){return db[_0x078f('0x2d')][_0x078f('0x48')]({'where':{'id':_0x44dc71[_0x078f('0x52')]['id']}})['then'](handleEntityNotFound(_0x4696e8,null))['then'](removeEntity(_0x4696e8,null))['catch'](handleError(_0x4696e8,null));};exports[_0x078f('0x2e')]=function(_0x372ab6,_0x4f9488){return db[_0x078f('0x2d')][_0x078f('0x2e')]()['then'](respondWithResult(_0x4f9488,null))['catch'](handleError(_0x4f9488,null));};exports[_0x078f('0x53')]=function(_0x560222,_0x595b20,_0x3a42af){return db['CmContact']['find']({'where':{'id':_0x560222[_0x078f('0x52')]['id']}})[_0x078f('0x22')](handleEntityNotFound(_0x595b20,null))[_0x078f('0x22')](function(_0x35127f){if(_0x35127f){return _0x35127f['addContacts'](_0x560222[_0x078f('0x4a')][_0x078f('0x54')],_[_0x078f('0x55')](_0x560222[_0x078f('0x4a')],[_0x078f('0x54'),'id'])||{});}})[_0x078f('0x22')](respondWithResult(_0x595b20,null))[_0x078f('0x45')](handleError(_0x595b20,null));};exports['getContacts']=function(_0x19ac25,_0x44144c,_0x5f2677){var _0x47e002={};var _0x483e8={};var _0x40f21d;var _0xb05314;return db[_0x078f('0x2d')]['findOne']({'where':{'id':_0x19ac25[_0x078f('0x52')]['id']}})[_0x078f('0x22')](handleEntityNotFound(_0x44144c,null))['then'](function(_0x38ee71){if(_0x38ee71){_0x40f21d=_0x38ee71;_0x483e8[_0x078f('0x34')]=_[_0x078f('0x2f')](db['CmContact'][_0x078f('0x47')]);_0x483e8['query']=_[_0x078f('0x2f')](_0x19ac25[_0x078f('0x30')]);_0x483e8[_0x078f('0x31')]=_['intersection'](_0x483e8[_0x078f('0x34')],_0x483e8[_0x078f('0x30')]);_0x47e002[_0x078f('0x33')]=_[_0x078f('0x32')](_0x483e8['model'],qs[_0x078f('0x35')](_0x19ac25[_0x078f('0x30')][_0x078f('0x35')]));_0x47e002[_0x078f('0x33')]=_0x47e002[_0x078f('0x33')][_0x078f('0x36')]?_0x47e002[_0x078f('0x33')]:_0x483e8[_0x078f('0x34')];_0x47e002[_0x078f('0x39')]=qs[_0x078f('0x3a')](_0x19ac25[_0x078f('0x30')][_0x078f('0x3a')]);_0x47e002[_0x078f('0x3c')]=qs[_0x078f('0x31')](_[_0x078f('0x3b')](_0x19ac25[_0x078f('0x30')],_0x483e8['filters']));if(_0x19ac25[_0x078f('0x30')][_0x078f('0x3f')]){_0x47e002[_0x078f('0x3c')]=_[_0x078f('0x3d')](_0x47e002['where'],{'$or':_[_0x078f('0x3e')](_0x47e002[_0x078f('0x33')],function(_0x4c68c1){var _0x541d55={};_0x541d55[_0x4c68c1]={'$like':'%'+_0x19ac25['query'][_0x078f('0x3f')]+'%'};return _0x541d55;})});}_0x47e002=_[_0x078f('0x3d')]({},_0x47e002,_0x19ac25['options']);return _0x40f21d['getContacts'](_0x47e002);}})['then'](function(_0x179513){if(_0x179513){_0xb05314=_0x179513[_0x078f('0x36')];if(!_0x19ac25['query'][_0x078f('0x56')](_0x078f('0x37'))){_0x47e002[_0x078f('0x38')]=qs[_0x078f('0x38')](_0x19ac25[_0x078f('0x30')][_0x078f('0x38')]);_0x47e002['offset']=qs[_0x078f('0x1b')](_0x19ac25[_0x078f('0x30')]['offset']);}return _0x40f21d[_0x078f('0x57')](_0x47e002);}})['then'](function(_0x367a73){if(_0x367a73){return _0x367a73?{'count':_0xb05314,'rows':_0x367a73}:null;}})['then'](respondWithResult(_0x44144c,null))[_0x078f('0x45')](handleError(_0x44144c,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 6a67a00..fdf57dd 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 _0xd32a=['request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','CmCompany','util','../../config/logger','api','moment','bluebird'];(function(_0xabb9fa,_0xb8acea){var _0x18c7e6=function(_0x324056){while(--_0x324056){_0xabb9fa['push'](_0xabb9fa['shift']());}};_0x18c7e6(++_0xb8acea);}(_0xd32a,0xd3));var _0xad32=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0xd32a[_0x576170];return _0x397c70;};'use strict';var _=require('lodash');var util=require(_0xad32('0x0'));var logger=require(_0xad32('0x1'))(_0xad32('0x2'));var moment=require(_0xad32('0x3'));var BPromise=require(_0xad32('0x4'));var rp=require(_0xad32('0x5'));var fs=require('fs');var path=require(_0xad32('0x6'));var rimraf=require(_0xad32('0x7'));var config=require(_0xad32('0x8'));var attributes=require(_0xad32('0x9'));module[_0xad32('0xa')]=function(_0x306432,_0x329d56){return _0x306432['define'](_0xad32('0xb'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x94c2=['request-promise','path','../../config/environment','./cmCompany.attributes','exports','CmCompany','cm_companies','lodash','util','api','bluebird'];(function(_0x30cbd2,_0x450576){var _0x13674f=function(_0x554ab6){while(--_0x554ab6){_0x30cbd2['push'](_0x30cbd2['shift']());}};_0x13674f(++_0x450576);}(_0x94c2,0xac));var _0x294c=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x94c2[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0x294c('0x0'));var util=require(_0x294c('0x1'));var logger=require('../../config/logger')(_0x294c('0x2'));var moment=require('moment');var BPromise=require(_0x294c('0x3'));var rp=require(_0x294c('0x4'));var fs=require('fs');var path=require(_0x294c('0x5'));var rimraf=require('rimraf');var config=require(_0x294c('0x6'));var attributes=require(_0x294c('0x7'));module[_0x294c('0x8')]=function(_0x1f2f15,_0x100ee1){return _0x1f2f15['define'](_0x294c('0x9'),attributes,{'tableName':_0x294c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 990a684..c5f35ef 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 _0x0ae9=['result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request\x20sent','debug','error','code','CmCompany,\x20%s,\x20%s','message','info'];(function(_0x2016bb,_0x1ea54d){var _0x78113b=function(_0x70ae0b){while(--_0x70ae0b){_0x2016bb['push'](_0x2016bb['shift']());}};_0x78113b(++_0x1ea54d);}(_0x0ae9,0xac));var _0x90ae=function(_0x428f57,_0x2d44e0){_0x428f57=_0x428f57-0x0;var _0x259d87=_0x0ae9[_0x428f57];return _0x259d87;};'use strict';var _=require(_0x90ae('0x0'));var util=require(_0x90ae('0x1'));var moment=require('moment');var BPromise=require(_0x90ae('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x90ae('0x3'))['db'];var utils=require(_0x90ae('0x4'));var logger=require(_0x90ae('0x5'))(_0x90ae('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x90ae('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x401a33,_0xb1ade8,_0x90cb08){return new BPromise(function(_0x5821d7,_0x5baf3f){return client['request'](_0x401a33,_0x90cb08)['then'](function(_0x127d22){logger['info']('CmCompany,\x20%s,\x20%s',_0xb1ade8,_0x90ae('0x8'));logger[_0x90ae('0x9')]('CmCompany,\x20%s,\x20%s,\x20%s',_0xb1ade8,'request\x20sent',JSON['stringify'](_0x127d22));if(_0x127d22[_0x90ae('0xa')]){if(_0x127d22[_0x90ae('0xa')][_0x90ae('0xb')]===0x1f4){logger[_0x90ae('0xa')](_0x90ae('0xc'),_0xb1ade8,_0x127d22[_0x90ae('0xa')]['message']);return _0x5baf3f(_0x127d22[_0x90ae('0xa')][_0x90ae('0xd')]);}logger[_0x90ae('0xa')]('CmCompany,\x20%s,\x20%s',_0xb1ade8,_0x127d22['error'][_0x90ae('0xd')]);return _0x5821d7(_0x127d22[_0x90ae('0xa')][_0x90ae('0xd')]);}else{logger[_0x90ae('0xe')](_0x90ae('0xc'),_0xb1ade8,'request\x20sent');_0x5821d7(_0x127d22[_0x90ae('0xf')][_0x90ae('0xd')]);}})[_0x90ae('0x10')](function(_0x2f0408){logger[_0x90ae('0xa')](_0x90ae('0xc'),_0xb1ade8,_0x2f0408);_0x5baf3f(_0x2f0408);});});} \ No newline at end of file +var _0x57f1=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','CmCompany,\x20%s,\x20%s','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x49c622,_0x56ef86){var _0xb14076=function(_0x2fba33){while(--_0x2fba33){_0x49c622['push'](_0x49c622['shift']());}};_0xb14076(++_0x56ef86);}(_0x57f1,0x19d));var _0x157f=function(_0x1852f4,_0x342dbd){_0x1852f4=_0x1852f4-0x0;var _0x56aa2a=_0x57f1[_0x1852f4];return _0x56aa2a;};'use strict';var _=require(_0x157f('0x0'));var util=require(_0x157f('0x1'));var moment=require(_0x157f('0x2'));var BPromise=require(_0x157f('0x3'));var rs=require(_0x157f('0x4'));var fs=require('fs');var Redis=require(_0x157f('0x5'));var db=require(_0x157f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x157f('0x7'))(_0x157f('0x8'));var config=require(_0x157f('0x9'));var jayson=require(_0x157f('0xa'));var client=jayson['client'][_0x157f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a7e35,_0x5c9a21,_0x2a8f8){return new BPromise(function(_0x5d0f5f,_0x100eef){return client[_0x157f('0xc')](_0x4a7e35,_0x2a8f8)['then'](function(_0x12758a){logger[_0x157f('0xd')](_0x157f('0xe'),_0x5c9a21,'request\x20sent');logger['debug'](_0x157f('0xf'),_0x5c9a21,'request\x20sent',JSON[_0x157f('0x10')](_0x12758a));if(_0x12758a[_0x157f('0x11')]){if(_0x12758a[_0x157f('0x11')][_0x157f('0x12')]===0x1f4){logger['error'](_0x157f('0xe'),_0x5c9a21,_0x12758a[_0x157f('0x11')][_0x157f('0x13')]);return _0x100eef(_0x12758a[_0x157f('0x11')][_0x157f('0x13')]);}logger[_0x157f('0x11')]('CmCompany,\x20%s,\x20%s',_0x5c9a21,_0x12758a['error'][_0x157f('0x13')]);return _0x5d0f5f(_0x12758a[_0x157f('0x11')][_0x157f('0x13')]);}else{logger[_0x157f('0xd')](_0x157f('0xe'),_0x5c9a21,_0x157f('0x14'));_0x5d0f5f(_0x12758a['result'][_0x157f('0x13')]);}})[_0x157f('0x15')](function(_0x57f9aa){logger[_0x157f('0x11')](_0x157f('0xe'),_0x5c9a21,_0x57f9aa);_0x100eef(_0x57f9aa);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 542ed81..5336528 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 _0xf7f6=['destroy','exports','path','express','Router','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/:id','show','/:id/contacts','getContacts','post','put','update','delete'];(function(_0x5f2e17,_0x2de9f2){var _0x388526=function(_0x35b5be){while(--_0x35b5be){_0x5f2e17['push'](_0x5f2e17['shift']());}};_0x388526(++_0x2de9f2);}(_0xf7f6,0x1b7));var _0x6f7f=function(_0x172f21,_0xd55ee4){_0x172f21=_0x172f21-0x0;var _0x589ea2=_0xf7f6[_0x172f21];return _0x589ea2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6f7f('0x0'));var timeout=require('connect-timeout');var express=require(_0x6f7f('0x1'));var router=express[_0x6f7f('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6f7f('0x3'));var config=require(_0x6f7f('0x4'));var controller=require(_0x6f7f('0x5'));router[_0x6f7f('0x6')]('/',auth[_0x6f7f('0x7')](),controller[_0x6f7f('0x8')]);router[_0x6f7f('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x6f7f('0x6')](_0x6f7f('0x9'),auth[_0x6f7f('0x7')](),controller[_0x6f7f('0xa')]);router[_0x6f7f('0x6')](_0x6f7f('0xb'),auth[_0x6f7f('0x7')](),controller[_0x6f7f('0xc')]);router[_0x6f7f('0xd')]('/',auth[_0x6f7f('0x7')](),controller['create']);router['post'](_0x6f7f('0xb'),auth['isAuthenticated'](),controller['addContacts']);router[_0x6f7f('0xe')]('/:id',auth[_0x6f7f('0x7')](),controller[_0x6f7f('0xf')]);router[_0x6f7f('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6f7f('0x11')]);module[_0x6f7f('0x12')]=router; \ No newline at end of file +var _0x5c66=['isAuthenticated','index','get','/describe','/:id','/:id/contacts','getContacts','post','addContacts','put','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x5c66,0x148));var _0x65c6=function(_0x1af47f,_0x1eea3f){_0x1af47f=_0x1af47f-0x0;var _0x34012a=_0x5c66[_0x1af47f];return _0x34012a;};'use strict';var multer=require(_0x65c6('0x0'));var util=require('util');var path=require(_0x65c6('0x1'));var timeout=require(_0x65c6('0x2'));var express=require(_0x65c6('0x3'));var router=express['Router']();var fs_extra=require(_0x65c6('0x4'));var auth=require(_0x65c6('0x5'));var interaction=require(_0x65c6('0x6'));var config=require(_0x65c6('0x7'));var controller=require('./cmCompany.controller');router['get']('/',auth[_0x65c6('0x8')](),controller[_0x65c6('0x9')]);router[_0x65c6('0xa')](_0x65c6('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x65c6('0xc'),auth[_0x65c6('0x8')](),controller['show']);router[_0x65c6('0xa')](_0x65c6('0xd'),auth[_0x65c6('0x8')](),controller[_0x65c6('0xe')]);router['post']('/',auth[_0x65c6('0x8')](),controller['create']);router[_0x65c6('0xf')]('/:id/contacts',auth[_0x65c6('0x8')](),controller[_0x65c6('0x10')]);router[_0x65c6('0x11')](_0x65c6('0xc'),auth[_0x65c6('0x8')](),controller[_0x65c6('0x12')]);router['delete']('/:id',auth[_0x65c6('0x8')](),controller[_0x65c6('0x13')]);module[_0x65c6('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 060b08a..b9d1849 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 _0xa6ce=['STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash','exports'];(function(_0x5f2323,_0x10ee49){var _0x56a43e=function(_0x4ca081){while(--_0x4ca081){_0x5f2323['push'](_0x5f2323['shift']());}};_0x56a43e(++_0x10ee49);}(_0xa6ce,0xfe));var _0xea6c=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xa6ce[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0xea6c('0x0'));var Sequelize=require('sequelize');module[_0xea6c('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xea6c('0x2')]},'street':{'type':Sequelize[_0xea6c('0x2')]},'postalCode':{'type':Sequelize[_0xea6c('0x2')]},'city':{'type':Sequelize[_0xea6c('0x2')]},'country':{'type':Sequelize[_0xea6c('0x2')]},'dateOfBirth':{'type':Sequelize[_0xea6c('0x2')]},'description':{'type':Sequelize[_0xea6c('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xea6c('0x2')]},'fax':{'type':Sequelize[_0xea6c('0x2')]},'email':{'type':Sequelize[_0xea6c('0x2')]},'url':{'type':Sequelize[_0xea6c('0x2')]},'facebook':{'type':Sequelize[_0xea6c('0x2')]},'fb_data':{'type':Sequelize[_0xea6c('0x2')]},'twitter':{'type':Sequelize[_0xea6c('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xea6c('0x2')]},'viber':{'type':Sequelize[_0xea6c('0x2')]},'line':{'type':Sequelize[_0xea6c('0x2')]},'wechat':{'type':Sequelize[_0xea6c('0x2')]},'telegram':{'type':Sequelize[_0xea6c('0x2')]},'UserId':{'type':Sequelize[_0xea6c('0x4')]},'priority':{'type':Sequelize[_0xea6c('0x4')](0x2)[_0xea6c('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xea6c('0x6')],'defaultValue':Sequelize[_0xea6c('0x7')]}}; \ No newline at end of file +var _0x87b4=['INTEGER','UNSIGNED','NOW','exports','STRING','TEXT'];(function(_0x3f59b1,_0x25cdbe){var _0x11d2e8=function(_0x37b3fc){while(--_0x37b3fc){_0x3f59b1['push'](_0x3f59b1['shift']());}};_0x11d2e8(++_0x25cdbe);}(_0x87b4,0x159));var _0x487b=function(_0x49098d,_0x23ea75){_0x49098d=_0x49098d-0x0;var _0x1b092c=_0x87b4[_0x49098d];return _0x1b092c;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0x487b('0x0')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x487b('0x1')]},'street':{'type':Sequelize[_0x487b('0x1')]},'postalCode':{'type':Sequelize[_0x487b('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x487b('0x1')]},'dateOfBirth':{'type':Sequelize[_0x487b('0x1')]},'description':{'type':Sequelize[_0x487b('0x2')]},'phone':{'type':Sequelize[_0x487b('0x1')]},'mobile':{'type':Sequelize[_0x487b('0x1')]},'fax':{'type':Sequelize[_0x487b('0x1')]},'email':{'type':Sequelize[_0x487b('0x1')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x487b('0x1')]},'fb_data':{'type':Sequelize[_0x487b('0x1')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x487b('0x1')]},'teams':{'type':Sequelize[_0x487b('0x1')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x487b('0x1')]},'wechat':{'type':Sequelize[_0x487b('0x1')]},'telegram':{'type':Sequelize[_0x487b('0x1')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0x487b('0x3')](0x2)[_0x487b('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x487b('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index b46572f..71dd850 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 _0x9ebf=['c.fax','c.email','c.ListId','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','params','catch','tags','startsWith','displayName','CmCustomField','findAll','columnName','alias','body','get','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperHistory','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','bulkCreate','duplicates','$or','findOrCreate','spread','$and','omit','format','cf_%d','pickBy','id\x20=\x20?','toParam','values','phone','getTags','rawAttributes','pick','options','ids','ContactId','includeAll','getHopperHistories','CmHopperFinal','getJscriptySessions','include','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','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','filename','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','upload','parse','meta','import','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','getJourney','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','channel','includes','Invalid\x20channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','starttime','endtime','duration','note','createdAt','userDisposition','UserId','fullname','DESC','findAndCountAll','startCase','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','Owner','customerIp','customerPort','deviceModel','osName','ratingValue','referer','mail','subject','substatus','externalUrl','threadId','flatten','sortBy','reverse','slice','moment','bluebird','path','papaparse','ioredis','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./cmContact.socket','register','json','limit','undefined','count','status','Content-Range','update','destroy','then','end','sendStatus','stack','name','send','index','CmContact','describe','keys','length','cf_','push','findOne','all','fieldType','type','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','filters','select','field','color','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','conditions','find','Tag','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','DATE','buildExpression','text','value','start','filter','isNil','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','concat','\x20=\x20?','tag','isArray','replace','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.id','Sequelize','SELECT','clone','having','t.id\x20IN\x20?','resolve','role','agent','some','User','getLists','c.ListId\x20IS\x20NULL','user','sequelize','toString','keyBy','merge','c.firstName','c.lastName','c.phone'];(function(_0x218fdc,_0x3b552b){var _0x54f74e=function(_0x515557){while(--_0x515557){_0x218fdc['push'](_0x218fdc['shift']());}};_0x54f74e(++_0x3b552b);}(_0x9ebf,0x9b));var _0xf9eb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9ebf[_0x2641f9];return _0x585741;};'use strict';var moment=require(_0xf9eb('0x0'));var BPromise=require(_0xf9eb('0x1'));var util=require('util');var path=require(_0xf9eb('0x2'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var Papa=require(_0xf9eb('0x3'));var Redis=require(_0xf9eb('0x4'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var logger=require(_0xf9eb('0x5'))(_0xf9eb('0x6'));var config=require('../../config/environment');var db=require(_0xf9eb('0x7'))['db'];config[_0xf9eb('0x8')]=_[_0xf9eb('0x9')](config[_0xf9eb('0x8')],{'host':_0xf9eb('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf9eb('0x8')]));require(_0xf9eb('0xb'))[_0xf9eb('0xc')](socket);function respondWithResult(_0x35e6c2,_0x1c7db1){_0x1c7db1=_0x1c7db1||0xc8;return function(_0x1f2f88){if(_0x1f2f88){return _0x35e6c2['status'](_0x1c7db1)[_0xf9eb('0xd')](_0x1f2f88);}};}function respondWithFilteredResult(_0x2f8595,_0x306880){return function(_0x443ef7){if(_0x443ef7){var _0x88c415=typeof _0x306880['offset']==='undefined'&&typeof _0x306880[_0xf9eb('0xe')]===_0xf9eb('0xf');var _0x53293b=_0x443ef7['count'];var _0x33b888=_0x88c415?0x0:_0x306880['offset'];var _0x57f6fa=_0x88c415?_0x443ef7[_0xf9eb('0x10')]:_0x306880['offset']+_0x306880[_0xf9eb('0xe')];var _0x3332ff;if(_0x57f6fa>=_0x53293b){_0x57f6fa=_0x53293b;_0x3332ff=0xc8;}else{_0x3332ff=0xce;}_0x2f8595[_0xf9eb('0x11')](_0x3332ff);return _0x2f8595['set'](_0xf9eb('0x12'),_0x33b888+'-'+_0x57f6fa+'/'+_0x53293b)[_0xf9eb('0xd')](_0x443ef7);}return null;};}function saveUpdates(_0x52bc27){return function(_0x2c80c7){if(_0x2c80c7){return _0x2c80c7[_0xf9eb('0x13')](_0x52bc27)['then'](function(_0x1e142c){return _0x1e142c;});}return null;};}function removeEntity(_0x1d0184){return function(_0x21f7b4){if(_0x21f7b4){return _0x21f7b4[_0xf9eb('0x14')]()[_0xf9eb('0x15')](function(){_0x1d0184[_0xf9eb('0x11')](0xcc)[_0xf9eb('0x16')]();});}};}function handleEntityNotFound(_0x2730fb){return function(_0x2a301c){if(!_0x2a301c){_0x2730fb[_0xf9eb('0x17')](0x194);}return _0x2a301c;};}function handleError(_0x47dfc8,_0xd8fb0d){_0xd8fb0d=_0xd8fb0d||0x1f4;return function(_0x524cb2){logger['error'](_0x524cb2[_0xf9eb('0x18')]);if(_0x524cb2[_0xf9eb('0x19')]){delete _0x524cb2[_0xf9eb('0x19')];}_0x47dfc8[_0xf9eb('0x11')](_0xd8fb0d)[_0xf9eb('0x1a')](_0x524cb2);};}exports[_0xf9eb('0x1b')]=function(_0x159641,_0x55853c){var _0x301cf9={},_0xc54753={},_0x15e758={'count':0x0,'rows':[]};return db[_0xf9eb('0x1c')][_0xf9eb('0x1d')]()[_0xf9eb('0x15')](function(_0x4942f5){var _0x13ccee=[];for(var _0x28a1d9=0x0;_0x28a1d90x1){_0x217482['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xf9eb('0x5e')](_0x328851),null);}else{if(qs[_0xf9eb('0x5f')](_0x328851)){_0x217482['or'](_0xf9eb('0x60'),_0x328851+'%');_0x217482['or'](_0xf9eb('0x61'),_0x328851+'%');_0x217482['or'](_0xf9eb('0x62'),_0x328851+'%');_0x217482['or']('c.fax\x20LIKE\x20?',_0x328851+'%');}else if(qs[_0xf9eb('0x63')](_0x328851)){_0x217482['or'](_0xf9eb('0x64'),_0x328851+'%');}else{_0x217482['or'](_0xf9eb('0x65'),'%'+_0x328851+'%');_0x217482['or'](_0xf9eb('0x66'),'%'+_0x328851+'%');_0x217482['or'](_0xf9eb('0x64'),'%'+_0x328851+'%');}}}}_0xa3c2b4[_0xf9eb('0x30')](_0x217482);_0xa3c2b4['group'](_0xf9eb('0x67'));var _0x2c9881={'type':db[_0xf9eb('0x68')]['QueryTypes'][_0xf9eb('0x69')],'raw':!![]};var _0x32521e=_0xa3c2b4[_0xf9eb('0x6a')]()['field'](_0xf9eb('0x67'));if(_0x301cf9['order']){_0x301cf9[_0xf9eb('0x2e')][_0xf9eb('0x47')](function(_0x37e1f8){_0xa3c2b4[_0xf9eb('0x2e')]('c.'+_0x37e1f8[0x0],_0x37e1f8[0x1]==='DESC'?![]:!![]);});}if(!_[_0xf9eb('0x56')](_0x5e594b)){_0xa3c2b4[_0xf9eb('0x6b')](_0x3264c8);_0x32521e['where'](_0xf9eb('0x6c'),_0x5e594b);}BPromise[_0xf9eb('0x6d')]()[_0xf9eb('0x15')](function(){if(!_0x3d401b)return;if(_0x159641['user'][_0xf9eb('0x6e')]!==_0xf9eb('0x6f'))return;if(!_[_0xf9eb('0x70')](_0x3d401b[_0xf9eb('0x42')],['field',_0xf9eb('0x71')])){return _0x159641['user'][_0xf9eb('0x72')]({'attributes':['id'],'raw':!![]})[_0xf9eb('0x15')](function(_0x59b657){if(_[_0xf9eb('0x56')](_0x59b657)){_0x32521e['where'](_0xf9eb('0x73'));_0xa3c2b4[_0xf9eb('0x30')](_0xf9eb('0x73'));}else{_0x32521e[_0xf9eb('0x30')](_0xf9eb('0x58'),_[_0xf9eb('0x46')](_0x59b657,'id'));_0xa3c2b4[_0xf9eb('0x30')](_0xf9eb('0x58'),_['map'](_0x59b657,'id'));}});}})[_0xf9eb('0x15')](function(){if(_0x159641[_0xf9eb('0x74')][_0xf9eb('0x6e')]===_0xf9eb('0x6f')&&!_0x3d401b&&!_0x159641[_0xf9eb('0x27')][_0xf9eb('0x57')])return[];return db[_0xf9eb('0x75')][_0xf9eb('0x27')](_0x32521e[_0xf9eb('0x76')](),_0x2c9881);})[_0xf9eb('0x15')](function(_0x19bea2){_0x15e758[_0xf9eb('0x10')]=_0x19bea2[_0xf9eb('0x1f')];if(_0x15e758[_0xf9eb('0x10')]===0x0)return[];return db['sequelize'][_0xf9eb('0x27')](_0x2e5010[_0xf9eb('0x76')](),_0x2c9881)[_0xf9eb('0x15')](function(_0x530fe0){_0x49c648=_[_0xf9eb('0x77')](_0x530fe0,'id');_0x2c9881=_[_0xf9eb('0x78')](_0x2c9881,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x159641[_0xf9eb('0x27')]['fields']){_0x301cf9[_0xf9eb('0x2a')][_0xf9eb('0x47')](function(_0x4be698){_0xa3c2b4['field']('c.'+_0x4be698);});}else{_0xa3c2b4[_0xf9eb('0x33')](_0xf9eb('0x67'));_0xa3c2b4['field'](_0xf9eb('0x79'));_0xa3c2b4[_0xf9eb('0x33')](_0xf9eb('0x7a'));_0xa3c2b4[_0xf9eb('0x33')](_0xf9eb('0x7b'));_0xa3c2b4[_0xf9eb('0x33')]('c.mobile');_0xa3c2b4[_0xf9eb('0x33')](_0xf9eb('0x7c'));_0xa3c2b4[_0xf9eb('0x33')](_0xf9eb('0x7d'));_0xa3c2b4[_0xf9eb('0x33')](_0xf9eb('0x7e'));_0xa3c2b4[_0xf9eb('0x33')]('c.createdAt');_0xa3c2b4[_0xf9eb('0x33')](_0xf9eb('0x7f'));_0xa3c2b4[_0xf9eb('0x33')]('c.CompanyId');_0xa3c2b4[_0xf9eb('0x33')](_0xf9eb('0x80'),_0xf9eb('0x81'));}if(_0x301cf9[_0xf9eb('0xe')])_0xa3c2b4['limit'](_0x301cf9[_0xf9eb('0xe')]);if(_0x301cf9[_0xf9eb('0x2d')])_0xa3c2b4[_0xf9eb('0x2d')](_0x301cf9[_0xf9eb('0x2d')]);return db[_0xf9eb('0x75')][_0xf9eb('0x27')](_0xa3c2b4[_0xf9eb('0x76')](),_0x2c9881);});})[_0xf9eb('0x15')](function(_0x599ecb){_0x599ecb[_0xf9eb('0x47')](function(_0x46a222){if(_0x46a222[_0xf9eb('0x81')]){_0x46a222[_0xf9eb('0x82')]=[];_0x46a222[_0xf9eb('0x81')][_0xf9eb('0x45')](',')['forEach'](function(_0x13985a){_0x46a222[_0xf9eb('0x82')][_0xf9eb('0x21')](_0x49c648[_0x13985a]);});}delete _0x46a222[_0xf9eb('0x81')];});_0x15e758[_0xf9eb('0x83')]=_0x599ecb;return _0x15e758;})['then'](respondWithFilteredResult(_0x55853c,_0x301cf9));})['catch'](handleError(_0x55853c,null));};exports[_0xf9eb('0x14')]=function(_0x35067d,_0x5db5db){return db[_0xf9eb('0x1c')]['find']({'where':{'id':_0x35067d[_0xf9eb('0x84')]['id']}})[_0xf9eb('0x15')](handleEntityNotFound(_0x5db5db,null))[_0xf9eb('0x15')](removeEntity(_0x5db5db,null))[_0xf9eb('0x85')](handleError(_0x5db5db,null));};exports[_0xf9eb('0x1d')]=function(_0x83be6f,_0xd01290){return db[_0xf9eb('0x1c')][_0xf9eb('0x1d')]()[_0xf9eb('0x15')](function(_0xfa2ff1){delete _0xfa2ff1[_0xf9eb('0x86')];for(var _0x11ec51=0x0;_0x11ec51=_0x11b41d){_0x24ea0f=_0x11b41d;_0x538128=0xc8;}else{_0x538128=0xce;}_0x24354f['status'](_0x538128);return _0x24354f[_0x7c05('0x11')](_0x7c05('0x12'),_0x392b65+'-'+_0x24ea0f+'/'+_0x11b41d)[_0x7c05('0x13')](_0x38b5b6);}return null;};}function saveUpdates(_0x3009c2){return function(_0x1e5479){if(_0x1e5479){return _0x1e5479['update'](_0x3009c2)[_0x7c05('0x14')](function(_0x333e86){return _0x333e86;});}return null;};}function removeEntity(_0x4ea1dd){return function(_0x4df33c){if(_0x4df33c){return _0x4df33c['destroy']()['then'](function(){_0x4ea1dd[_0x7c05('0x15')](0xcc)[_0x7c05('0x16')]();});}};}function handleEntityNotFound(_0x3c1e75){return function(_0x346528){if(!_0x346528){_0x3c1e75[_0x7c05('0x17')](0x194);}return _0x346528;};}function handleError(_0xfbddf4,_0x1af599){_0x1af599=_0x1af599||0x1f4;return function(_0xab8fc7){logger['error'](_0xab8fc7[_0x7c05('0x18')]);if(_0xab8fc7[_0x7c05('0x19')]){delete _0xab8fc7[_0x7c05('0x19')];}_0xfbddf4['status'](_0x1af599)[_0x7c05('0x1a')](_0xab8fc7);};}exports[_0x7c05('0x1b')]=function(_0x34f16a,_0x46773a){var _0x4dcd42={},_0x11da56={},_0x3245c6={'count':0x0,'rows':[]};return db[_0x7c05('0x1c')]['describe']()['then'](function(_0x4c4188){var _0x11ca11=[];for(var _0x4e725a=0x0;_0x4e725a0x1){_0x3163d7['or'](_0x7c05('0x5b'),qs['getFullTextValue'](_0x5f452e),null);}else{if(qs[_0x7c05('0x5c')](_0x5f452e)){_0x3163d7['or']('c.id\x20LIKE\x20?',_0x5f452e+'%');_0x3163d7['or']('c.phone\x20LIKE\x20?',_0x5f452e+'%');_0x3163d7['or']('c.mobile\x20LIKE\x20?',_0x5f452e+'%');_0x3163d7['or'](_0x7c05('0x5d'),_0x5f452e+'%');}else if(qs[_0x7c05('0x5e')](_0x5f452e)){_0x3163d7['or'](_0x7c05('0x5f'),_0x5f452e+'%');}else{_0x3163d7['or']('c.firstName\x20LIKE\x20?','%'+_0x5f452e+'%');_0x3163d7['or'](_0x7c05('0x60'),'%'+_0x5f452e+'%');_0x3163d7['or'](_0x7c05('0x5f'),'%'+_0x5f452e+'%');}}}}_0x2e8e0a['where'](_0x3163d7);_0x2e8e0a[_0x7c05('0x61')](_0x7c05('0x62'));var _0xac76e5={'type':db[_0x7c05('0x63')][_0x7c05('0x64')]['SELECT'],'raw':!![]};var _0x5d72c1=_0x2e8e0a[_0x7c05('0x65')]()[_0x7c05('0x33')](_0x7c05('0x62'));if(_0x4dcd42[_0x7c05('0x2d')]){_0x4dcd42[_0x7c05('0x2d')][_0x7c05('0x55')](function(_0x55a872){_0x2e8e0a[_0x7c05('0x2d')]('c.'+_0x55a872[0x0],_0x55a872[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x408714)){_0x2e8e0a[_0x7c05('0x66')](_0x187081);_0x5d72c1[_0x7c05('0x2f')](_0x7c05('0x67'),_0x408714);}BPromise[_0x7c05('0x68')]()[_0x7c05('0x14')](function(){if(!_0xa32219)return;if(_0x34f16a[_0x7c05('0x69')][_0x7c05('0x6a')]!==_0x7c05('0x6b'))return;if(!_[_0x7c05('0x6c')](_0xa32219[_0x7c05('0x41')],[_0x7c05('0x33'),'User'])){return _0x34f16a[_0x7c05('0x69')][_0x7c05('0x6d')]({'attributes':['id'],'raw':!![]})[_0x7c05('0x14')](function(_0x403eb5){if(_[_0x7c05('0x54')](_0x403eb5)){_0x5d72c1[_0x7c05('0x2f')](_0x7c05('0x6e'));_0x2e8e0a[_0x7c05('0x2f')](_0x7c05('0x6e'));}else{_0x5d72c1[_0x7c05('0x2f')](_0x7c05('0x6f'),_[_0x7c05('0x50')](_0x403eb5,'id'));_0x2e8e0a['where']('c.ListId\x20IN\x20?',_[_0x7c05('0x50')](_0x403eb5,'id'));}});}})[_0x7c05('0x14')](function(){if(_0x34f16a['user']['role']===_0x7c05('0x6b')&&!_0xa32219&&!_0x34f16a['query'][_0x7c05('0x56')])return[];return db[_0x7c05('0x70')][_0x7c05('0x26')](_0x5d72c1[_0x7c05('0x71')](),_0xac76e5);})[_0x7c05('0x14')](function(_0x3a2586){_0x3245c6[_0x7c05('0x10')]=_0x3a2586['length'];if(_0x3245c6[_0x7c05('0x10')]===0x0)return[];return db[_0x7c05('0x70')][_0x7c05('0x26')](_0x476731['toString'](),_0xac76e5)[_0x7c05('0x14')](function(_0x58b536){_0x531e7d=_['keyBy'](_0x58b536,'id');_0xac76e5=_['merge'](_0xac76e5,{'model':db[_0x7c05('0x1c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x34f16a['query'][_0x7c05('0x2a')]){_0x4dcd42['attributes'][_0x7c05('0x55')](function(_0x51eaf2){_0x2e8e0a[_0x7c05('0x33')]('c.'+_0x51eaf2);});}else{_0x2e8e0a[_0x7c05('0x33')]('c.id');_0x2e8e0a['field'](_0x7c05('0x72'));_0x2e8e0a[_0x7c05('0x33')](_0x7c05('0x73'));_0x2e8e0a['field'](_0x7c05('0x74'));_0x2e8e0a[_0x7c05('0x33')](_0x7c05('0x75'));_0x2e8e0a['field']('c.fax');_0x2e8e0a['field'](_0x7c05('0x76'));_0x2e8e0a[_0x7c05('0x33')]('c.ListId');_0x2e8e0a[_0x7c05('0x33')](_0x7c05('0x77'));_0x2e8e0a[_0x7c05('0x33')]('c.deletedAt');_0x2e8e0a[_0x7c05('0x33')](_0x7c05('0x78'));_0x2e8e0a[_0x7c05('0x33')](_0x7c05('0x79'),_0x7c05('0x7a'));}if(_0x4dcd42[_0x7c05('0xf')])_0x2e8e0a[_0x7c05('0xf')](_0x4dcd42[_0x7c05('0xf')]);if(_0x4dcd42[_0x7c05('0xd')])_0x2e8e0a[_0x7c05('0xd')](_0x4dcd42['offset']);return db[_0x7c05('0x70')][_0x7c05('0x26')](_0x2e8e0a['toString'](),_0xac76e5);});})[_0x7c05('0x14')](function(_0x5ae966){_0x5ae966[_0x7c05('0x55')](function(_0x233001){if(_0x233001[_0x7c05('0x7a')]){_0x233001[_0x7c05('0x7b')]=[];_0x233001[_0x7c05('0x7a')]['split'](',')[_0x7c05('0x55')](function(_0x590ef5){_0x233001[_0x7c05('0x7b')][_0x7c05('0x20')](_0x531e7d[_0x590ef5]);});}delete _0x233001[_0x7c05('0x7a')];});_0x3245c6[_0x7c05('0x7c')]=_0x5ae966;return _0x3245c6;})[_0x7c05('0x14')](respondWithFilteredResult(_0x46773a,_0x4dcd42));})[_0x7c05('0x7d')](handleError(_0x46773a,null));};exports[_0x7c05('0x7e')]=function(_0x51f6c9,_0x329d97){return db[_0x7c05('0x1c')][_0x7c05('0x42')]({'where':{'id':_0x51f6c9[_0x7c05('0x7f')]['id']}})[_0x7c05('0x14')](handleEntityNotFound(_0x329d97,null))[_0x7c05('0x14')](removeEntity(_0x329d97,null))[_0x7c05('0x7d')](handleError(_0x329d97,null));};exports['describe']=function(_0x41ff7c,_0x391d93){return db[_0x7c05('0x1c')]['describe']()['then'](function(_0x4e9894){delete _0x4e9894[_0x7c05('0x80')];for(var _0x42691b=0x0;_0x42691b{}\s\\|]/g,'-');_0x1ed952(null,util[_0x0125('0x24')](_0x0125('0x25'),path[_0x0125('0x26')](_0x4faedc[_0x0125('0x22')],path[_0x0125('0x27')](_0x4faedc[_0x0125('0x22')])),Date[_0x0125('0x28')](),path['extname'](_0x4faedc[_0x0125('0x22')])));}})});router[_0x0125('0x19')](_0x0125('0x29'),upload[_0x0125('0x2a')](_0x0125('0x2b')),controller[_0x0125('0x2c')]);var upload=multer({'storage':multer[_0x0125('0x1f')]({'destination':function(_0x19c1c6,_0x533c4f,_0x5a92d6){_0x5a92d6(null,path[_0x0125('0x20')](config['root'],'server/files/tmp'));},'filename':function(_0x1b0471,_0x1c4021,_0x5c10dc){_0x1c4021[_0x0125('0x22')]=_0x1c4021[_0x0125('0x22')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5c10dc(null,util[_0x0125('0x24')](_0x0125('0x25'),path['basename'](_0x1c4021[_0x0125('0x22')],path[_0x0125('0x27')](_0x1c4021[_0x0125('0x22')])),Date[_0x0125('0x28')](),path[_0x0125('0x27')](_0x1c4021[_0x0125('0x22')])));}})});router['post']('/upload',upload[_0x0125('0x2a')]('file'),controller[_0x0125('0x2d')]);router[_0x0125('0x19')](_0x0125('0x2e'),auth[_0x0125('0x10')](),controller['import']);router[_0x0125('0x2f')]('/:id',auth[_0x0125('0x10')](),controller[_0x0125('0x30')]);router['delete'](_0x0125('0xd'),auth[_0x0125('0x10')](),controller[_0x0125('0x31')]);module[_0x0125('0x32')]=router; \ No newline at end of file +var _0xdb41=['merge','create','/create_many','bulkCreate','/:id/tags','diskStorage','root','originalname','replace','%s-%s%s','basename','extname','now','/csv','single','file','uploadCsv','join','server/files/tmp','format','/upload','upload','/upload/:id','import','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmContact.controller','isAuthenticated','index','/describe','get','/:id','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','post'];(function(_0x51c38a,_0x4166df){var _0x5b5815=function(_0x598ffc){while(--_0x598ffc){_0x51c38a['push'](_0x51c38a['shift']());}};_0x5b5815(++_0x4166df);}(_0xdb41,0x10b));var _0x1db4=function(_0x273f77,_0xe5b0cb){_0x273f77=_0x273f77-0x0;var _0x71e147=_0xdb41[_0x273f77];return _0x71e147;};'use strict';var multer=require(_0x1db4('0x0'));var util=require('util');var path=require(_0x1db4('0x1'));var timeout=require('connect-timeout');var express=require(_0x1db4('0x2'));var router=express[_0x1db4('0x3')]();var fs_extra=require(_0x1db4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1db4('0x5'));var config=require(_0x1db4('0x6'));var controller=require(_0x1db4('0x7'));router['get']('/',auth[_0x1db4('0x8')](),controller[_0x1db4('0x9')]);router['get'](_0x1db4('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x1db4('0xb')](_0x1db4('0xc'),auth[_0x1db4('0x8')](),controller['show']);router['get']('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0x1db4('0xb')](_0x1db4('0xd'),auth[_0x1db4('0x8')](),controller['getHoppers']);router[_0x1db4('0xb')](_0x1db4('0xe'),auth[_0x1db4('0x8')](),controller[_0x1db4('0xf')]);router[_0x1db4('0xb')](_0x1db4('0x10'),auth[_0x1db4('0x8')](),controller[_0x1db4('0x11')]);router[_0x1db4('0xb')](_0x1db4('0x12'),auth['isAuthenticated'](),controller[_0x1db4('0x13')]);router['get']('/:id/journey',auth[_0x1db4('0x8')](),controller['getJourney']);router[_0x1db4('0x14')]('/merge',auth[_0x1db4('0x8')](),controller[_0x1db4('0x15')]);router[_0x1db4('0x14')]('/',auth[_0x1db4('0x8')](),controller[_0x1db4('0x16')]);router['post'](_0x1db4('0x17'),auth[_0x1db4('0x8')](),controller[_0x1db4('0x18')]);router['post'](_0x1db4('0x19'),auth[_0x1db4('0x8')](),controller['setTags']);var upload=multer({'storage':multer[_0x1db4('0x1a')]({'destination':function(_0xf5c590,_0x11807a,_0x25d5ef){_0x25d5ef(null,path['join'](config[_0x1db4('0x1b')],'server/files/tmp'));},'filename':function(_0x3bdd7e,_0x8270d,_0x3b44ad){_0x8270d[_0x1db4('0x1c')]=_0x8270d[_0x1db4('0x1c')][_0x1db4('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3b44ad(null,util['format'](_0x1db4('0x1e'),path[_0x1db4('0x1f')](_0x8270d['originalname'],path[_0x1db4('0x20')](_0x8270d['originalname'])),Date[_0x1db4('0x21')](),path[_0x1db4('0x20')](_0x8270d[_0x1db4('0x1c')])));}})});router[_0x1db4('0x14')](_0x1db4('0x22'),upload[_0x1db4('0x23')](_0x1db4('0x24')),controller[_0x1db4('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x656818,_0x71a467,_0x247689){_0x247689(null,path[_0x1db4('0x26')](config[_0x1db4('0x1b')],_0x1db4('0x27')));},'filename':function(_0x2932d0,_0x289c90,_0x2675e){_0x289c90[_0x1db4('0x1c')]=_0x289c90[_0x1db4('0x1c')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2675e(null,util[_0x1db4('0x28')](_0x1db4('0x1e'),path[_0x1db4('0x1f')](_0x289c90[_0x1db4('0x1c')],path['extname'](_0x289c90[_0x1db4('0x1c')])),Date[_0x1db4('0x21')](),path[_0x1db4('0x20')](_0x289c90[_0x1db4('0x1c')])));}})});router[_0x1db4('0x14')](_0x1db4('0x29'),upload[_0x1db4('0x23')](_0x1db4('0x24')),controller[_0x1db4('0x2a')]);router[_0x1db4('0x14')](_0x1db4('0x2b'),auth['isAuthenticated'](),controller[_0x1db4('0x2c')]);router['put'](_0x1db4('0xc'),auth[_0x1db4('0x8')](),controller['update']);router[_0x1db4('0x2d')](_0x1db4('0xc'),auth[_0x1db4('0x8')](),controller[_0x1db4('0x2e')]);module[_0x1db4('0x2f')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 3365556..b1d9a54 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 _0x957c=['setDataValue','getDataValue','name','STRING','TEXT','long','type','select','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','lodash','exports','VIRTUAL','alias'];(function(_0x48934a,_0x361a8f){var _0x3ac2ba=function(_0x715b21){while(--_0x715b21){_0x48934a['push'](_0x48934a['shift']());}};_0x3ac2ba(++_0x361a8f);}(_0x957c,0x13f));var _0xc957=function(_0x3bceef,_0x331e22){_0x3bceef=_0x3bceef-0x0;var _0xc1c385=_0x957c[_0x3bceef];return _0xc1c385;};'use strict';var Sequelize=require('sequelize');var _=require(_0xc957('0x0'));module[_0xc957('0x1')]={'name':{'type':Sequelize[_0xc957('0x2')],'get':function(_0x28d67b){return this['getDataValue'](_0xc957('0x3'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0xc9ac4a){this[_0xc957('0x4')](_0xc957('0x3'),_0xc9ac4a?_0xc9ac4a:this[_0xc957('0x5')](_0xc957('0x6')));}},'type':{'type':Sequelize[_0xc957('0x7')],'allowNull':![]},'values':{'type':Sequelize[_0xc957('0x8')](_0xc957('0x9')),'get':function(){if(this[_0xc957('0x5')](_0xc957('0xa'))===_0xc957('0xb')){return JSON[_0xc957('0xc')](this[_0xc957('0x5')](_0xc957('0xd')));}else{return this['getDataValue']('values');}},'set':function(_0x41ea48){if(Array[_0xc957('0xe')](_0x41ea48)){this[_0xc957('0x4')]('values',JSON[_0xc957('0xf')](_0x41ea48));}else{this['setDataValue']('values',_0x41ea48);}}},'required':{'type':Sequelize[_0xc957('0x10')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xc957('0x10')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xc957('0x11')](_0xc957('0x12'))}}; \ No newline at end of file +var _0xa261=['isArray','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','STRING','setDataValue','alias','getDataValue','name','TEXT','type','values'];(function(_0x1b0c8c,_0x486222){var _0x2e67c9=function(_0x4f27c6){while(--_0x4f27c6){_0x1b0c8c['push'](_0x1b0c8c['shift']());}};_0x2e67c9(++_0x486222);}(_0xa261,0x1b4));var _0x1a26=function(_0x307d3e,_0x27ecdc){_0x307d3e=_0x307d3e-0x0;var _0x139c27=_0xa261[_0x307d3e];return _0x139c27;};'use strict';var Sequelize=require(_0x1a26('0x0'));var _=require(_0x1a26('0x1'));module[_0x1a26('0x2')]={'name':{'type':Sequelize[_0x1a26('0x3')],'get':function(_0x3255c7){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0x1a26('0x4')],'allowNull':![],'set':function(_0x18511a){this[_0x1a26('0x5')](_0x1a26('0x6'),_0x18511a?_0x18511a:this[_0x1a26('0x7')](_0x1a26('0x8')));}},'type':{'type':Sequelize[_0x1a26('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x1a26('0x9')]('long'),'get':function(){if(this[_0x1a26('0x7')](_0x1a26('0xa'))==='select'){return JSON['parse'](this['getDataValue'](_0x1a26('0xb')));}else{return this[_0x1a26('0x7')](_0x1a26('0xb'));}},'set':function(_0x502af2){if(Array[_0x1a26('0xc')](_0x502af2)){this['setDataValue'](_0x1a26('0xb'),JSON['stringify'](_0x502af2));}else{this['setDataValue'](_0x1a26('0xb'),_0x502af2);}}},'required':{'type':Sequelize[_0x1a26('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x1a26('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x1a26('0xe')](_0x1a26('0xf'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 27a1c2e..fd9d5f7 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 _0xe695=['where','VIRTUAL','merge','options','includeAll','include','findAll','rows','find','body','params','catch','create','sequelize','transaction','text','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','cm_contacts','format','eml-format','zip-dir','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','apply','reject','save','update','then','destroy','name','index','map','CmCustomField','rawAttributes','fieldName','type','model','differenceBy','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter'];(function(_0x4954fa,_0x270d17){var _0x486f57=function(_0x369350){while(--_0x369350){_0x4954fa['push'](_0x4954fa['shift']());}};_0x486f57(++_0x270d17);}(_0xe695,0x159));var _0x5e69=function(_0x4d0a44,_0x1672b3){_0x4d0a44=_0x4d0a44-0x0;var _0x5eb746=_0xe695[_0x4d0a44];return _0x5eb746;};'use strict';var emlformat=require(_0x5e69('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5e69('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5e69('0x2'));var Mustache=require('mustache');var util=require(_0x5e69('0x3'));var path=require(_0x5e69('0x4'));var sox=require('sox');var csv=require(_0x5e69('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5e69('0x6'));var _=require(_0x5e69('0x7'));var squel=require(_0x5e69('0x8'));var crypto=require(_0x5e69('0x9'));var jsforce=require(_0x5e69('0xa'));var deskjs=require(_0x5e69('0xb'));var toCsv=require(_0x5e69('0x5'));var querystring=require(_0x5e69('0xc'));var Papa=require('papaparse');var Redis=require(_0x5e69('0xd'));var authService=require(_0x5e69('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e69('0xf'));var logger=require(_0x5e69('0x10'))(_0x5e69('0x11'));var utils=require('../../config/utils');var config=require(_0x5e69('0x12'));var licenseUtil=require(_0x5e69('0x13'));var db=require(_0x5e69('0x14'))['db'];function respondWithStatusCode(_0x5c4179,_0x373960){_0x373960=_0x373960||0xcc;return function(_0x41d110){if(_0x41d110){return _0x5c4179[_0x5e69('0x15')](_0x373960);}return _0x5c4179[_0x5e69('0x16')](_0x373960)[_0x5e69('0x17')]();};}function respondWithResult(_0x5130c1,_0x46525c){_0x46525c=_0x46525c||0xc8;return function(_0x63465a){if(_0x63465a){return _0x5130c1[_0x5e69('0x16')](_0x46525c)['json'](_0x63465a);}};}function respondWithFilteredResult(_0x471234,_0x424638){return function(_0x249e6d){if(_0x249e6d){var _0x45eee5=typeof _0x424638[_0x5e69('0x18')]==='undefined'&&typeof _0x424638[_0x5e69('0x19')]===_0x5e69('0x1a');var _0x590d4e=_0x249e6d[_0x5e69('0x1b')];var _0x1b0c59=_0x45eee5?0x0:_0x424638[_0x5e69('0x18')];var _0x1cff31=_0x45eee5?_0x249e6d[_0x5e69('0x1b')]:_0x424638['offset']+_0x424638[_0x5e69('0x19')];var _0x380e47;if(_0x1cff31>=_0x590d4e){_0x1cff31=_0x590d4e;_0x380e47=0xc8;}else{_0x380e47=0xce;}_0x471234[_0x5e69('0x16')](_0x380e47);return _0x471234['set']('Content-Range',_0x1b0c59+'-'+_0x1cff31+'/'+_0x590d4e)['json'](_0x249e6d);}return null;};}function patchUpdates(_0x1dd231){return function(_0x175b89){try{jsonpatch[_0x5e69('0x1c')](_0x175b89,_0x1dd231,!![]);}catch(_0x448b43){return BPromise[_0x5e69('0x1d')](_0x448b43);}return _0x175b89[_0x5e69('0x1e')]();};}function saveUpdates(_0x5812d9,_0x2da1eb){return function(_0x2d008c){if(_0x2d008c){return _0x2d008c[_0x5e69('0x1f')](_0x5812d9)[_0x5e69('0x20')](function(_0x32c006){return _0x32c006;});}return null;};}function removeEntity(_0x4416e7,_0x14b3e9){return function(_0x3fbcc7){if(_0x3fbcc7){return _0x3fbcc7[_0x5e69('0x21')]()[_0x5e69('0x20')](function(){_0x4416e7[_0x5e69('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x106179,_0xdeb95a){return function(_0x96e4c){if(!_0x96e4c){_0x106179[_0x5e69('0x15')](0x194);}return _0x96e4c;};}function handleError(_0x34c789,_0x556a2b){_0x556a2b=_0x556a2b||0x1f4;return function(_0x19d70a){logger['error'](_0x19d70a['stack']);if(_0x19d70a[_0x5e69('0x22')]){delete _0x19d70a[_0x5e69('0x22')];}_0x34c789[_0x5e69('0x16')](_0x556a2b)['send'](_0x19d70a);};}exports[_0x5e69('0x23')]=function(_0x39cc8e,_0x194c10){var _0x2ca88b={},_0x28248f={},_0x41f5cc={'count':0x0,'rows':[]};var _0x3fc788=_[_0x5e69('0x24')](db[_0x5e69('0x25')][_0x5e69('0x26')],function(_0x5de2f7){return{'name':_0x5de2f7[_0x5e69('0x27')],'type':_0x5de2f7[_0x5e69('0x28')]['key']};});_0x28248f[_0x5e69('0x29')]=_[_0x5e69('0x2a')](_[_0x5e69('0x24')](_0x3fc788,'name'),[_0x5e69('0x22')]);_0x28248f['query']=_[_0x5e69('0x2b')](_0x39cc8e[_0x5e69('0x2c')]);_0x28248f[_0x5e69('0x2d')]=_['intersection'](_0x28248f[_0x5e69('0x29')],_0x28248f[_0x5e69('0x2c')]);_0x2ca88b[_0x5e69('0x2e')]=_[_0x5e69('0x2f')](_0x28248f[_0x5e69('0x29')],qs[_0x5e69('0x30')](_0x39cc8e['query'][_0x5e69('0x30')]));_0x2ca88b[_0x5e69('0x2e')]=_0x2ca88b[_0x5e69('0x2e')][_0x5e69('0x31')]?_0x2ca88b[_0x5e69('0x2e')]:_0x28248f[_0x5e69('0x29')];if(!_0x39cc8e['query'][_0x5e69('0x32')](_0x5e69('0x33'))){_0x2ca88b[_0x5e69('0x19')]=qs[_0x5e69('0x19')](_0x39cc8e['query'][_0x5e69('0x19')]);_0x2ca88b[_0x5e69('0x18')]=qs[_0x5e69('0x18')](_0x39cc8e[_0x5e69('0x2c')][_0x5e69('0x18')]);}_0x2ca88b[_0x5e69('0x34')]=qs[_0x5e69('0x35')](_0x39cc8e[_0x5e69('0x2c')][_0x5e69('0x35')]);_0x2ca88b['where']=qs[_0x5e69('0x2d')](_['pick'](_0x39cc8e[_0x5e69('0x2c')],_0x28248f['filters']),_0x3fc788);if(_0x39cc8e[_0x5e69('0x2c')][_0x5e69('0x36')]){_0x2ca88b[_0x5e69('0x37')]=_['merge'](_0x2ca88b[_0x5e69('0x37')],{'$or':_[_0x5e69('0x24')](_0x3fc788,function(_0x59df84){if(_0x59df84[_0x5e69('0x28')]!==_0x5e69('0x38')){var _0x3418c0={};_0x3418c0[_0x59df84[_0x5e69('0x22')]]={'$like':'%'+_0x39cc8e['query'][_0x5e69('0x36')]+'%'};return _0x3418c0;}})});}_0x2ca88b=_[_0x5e69('0x39')]({},_0x2ca88b,_0x39cc8e[_0x5e69('0x3a')]);var _0x361840={'where':_0x2ca88b[_0x5e69('0x37')]};return db['CmCustomField']['count'](_0x361840)['then'](function(_0x48ce56){_0x41f5cc['count']=_0x48ce56;if(_0x39cc8e[_0x5e69('0x2c')][_0x5e69('0x3b')]){_0x2ca88b[_0x5e69('0x3c')]=[{'all':!![]}];}return db['CmCustomField'][_0x5e69('0x3d')](_0x2ca88b);})[_0x5e69('0x20')](function(_0x245da9){_0x41f5cc[_0x5e69('0x3e')]=_0x245da9;return _0x41f5cc;})[_0x5e69('0x20')](respondWithFilteredResult(_0x194c10,_0x2ca88b))['catch'](handleError(_0x194c10,null));};exports['show']=function(_0x28c76b,_0x318b50){var _0x4cc0be={'raw':!![],'where':{'id':_0x28c76b['params']['id']}},_0x63f5dd={};_0x63f5dd[_0x5e69('0x29')]=_[_0x5e69('0x2b')](db['CmCustomField']['rawAttributes']);_0x63f5dd[_0x5e69('0x2c')]=_['keys'](_0x28c76b[_0x5e69('0x2c')]);_0x63f5dd['filters']=_[_0x5e69('0x2f')](_0x63f5dd[_0x5e69('0x29')],_0x63f5dd[_0x5e69('0x2c')]);_0x4cc0be[_0x5e69('0x2e')]=_[_0x5e69('0x2f')](_0x63f5dd[_0x5e69('0x29')],qs[_0x5e69('0x30')](_0x28c76b['query']['fields']));_0x4cc0be[_0x5e69('0x2e')]=_0x4cc0be[_0x5e69('0x2e')][_0x5e69('0x31')]?_0x4cc0be[_0x5e69('0x2e')]:_0x63f5dd['model'];if(_0x28c76b[_0x5e69('0x2c')][_0x5e69('0x3b')]){_0x4cc0be['include']=[{'all':!![]}];}_0x4cc0be=_[_0x5e69('0x39')]({},_0x4cc0be,_0x28c76b[_0x5e69('0x3a')]);return db[_0x5e69('0x25')][_0x5e69('0x3f')](_0x4cc0be)['then'](handleEntityNotFound(_0x318b50,null))[_0x5e69('0x20')](respondWithResult(_0x318b50,null))['catch'](handleError(_0x318b50,null));};exports[_0x5e69('0x1f')]=function(_0x580803,_0x294fa4){if(_0x580803[_0x5e69('0x40')]['id']){delete _0x580803[_0x5e69('0x40')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0x580803[_0x5e69('0x41')]['id']}})[_0x5e69('0x20')](handleEntityNotFound(_0x294fa4,null))[_0x5e69('0x20')](saveUpdates(_0x580803[_0x5e69('0x40')],null))[_0x5e69('0x20')](respondWithResult(_0x294fa4,null))[_0x5e69('0x42')](handleError(_0x294fa4,null));};exports['destroy']=function(_0x40aa2e,_0x527ae3){return db[_0x5e69('0x25')][_0x5e69('0x3f')]({'where':{'id':_0x40aa2e[_0x5e69('0x41')]['id']}})[_0x5e69('0x20')](handleEntityNotFound(_0x527ae3,null))[_0x5e69('0x20')](removeEntity(_0x527ae3,null))[_0x5e69('0x42')](handleError(_0x527ae3,null));};exports[_0x5e69('0x43')]=function(_0x270452,_0x3e6c1e){var _0x264e5d;return db[_0x5e69('0x44')][_0x5e69('0x45')](function(_0x3d1082){return db[_0x5e69('0x25')][_0x5e69('0x43')](_0x270452['body'],{'transaction':_0x3d1082})[_0x5e69('0x20')](function(_0x299010){_0x264e5d=_0x299010;var _0x3b231e={'type':db['Sequelize']['TEXT'],'transaction':_0x3d1082};switch(_0x270452[_0x5e69('0x40')][_0x5e69('0x28')]){case _0x5e69('0x46'):_0x3b231e[_0x5e69('0x28')]=db[_0x5e69('0x47')][_0x5e69('0x48')];break;case _0x5e69('0x49'):_0x3b231e[_0x5e69('0x28')]=db[_0x5e69('0x47')][_0x5e69('0x4a')];break;case _0x5e69('0x4b'):_0x3b231e[_0x5e69('0x28')]=db[_0x5e69('0x47')][_0x5e69('0x4c')];_0x3b231e[_0x5e69('0x4d')]=![];break;default:}return db[_0x5e69('0x44')]['queryInterface']['addColumn'](_0x5e69('0x4e'),util[_0x5e69('0x4f')]('cf_%d',_0x264e5d['id']),_0x3b231e);})[_0x5e69('0x20')](function(){return _0x264e5d;});})[_0x5e69('0x20')](respondWithResult(_0x3e6c1e,0xc9))[_0x5e69('0x42')](handleError(_0x3e6c1e,null));}; \ No newline at end of file +var _0x14b0=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','update','body','find','create','transaction','Sequelize','TEXT','text','number','switch','BOOLEAN','defaultValue','sequelize','queryInterface','cm_contacts','cf_%d','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','error','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','name','filters','intersection','query','fields','attributes','length'];(function(_0x144172,_0x3f3d5c){var _0x3f6d19=function(_0x268bcb){while(--_0x268bcb){_0x144172['push'](_0x144172['shift']());}};_0x3f6d19(++_0x3f3d5c);}(_0x14b0,0x75));var _0x014b=function(_0x1d14cb,_0x54006a){_0x1d14cb=_0x1d14cb-0x0;var _0x18bebc=_0x14b0[_0x1d14cb];return _0x18bebc;};'use strict';var emlformat=require(_0x014b('0x0'));var rimraf=require(_0x014b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x014b('0x2'));var rp=require(_0x014b('0x3'));var moment=require('moment');var BPromise=require(_0x014b('0x4'));var Mustache=require(_0x014b('0x5'));var util=require(_0x014b('0x6'));var path=require('path');var sox=require(_0x014b('0x7'));var csv=require(_0x014b('0x8'));var ejs=require(_0x014b('0x9'));var fs=require('fs');var fs_extra=require(_0x014b('0xa'));var _=require('lodash');var squel=require(_0x014b('0xb'));var crypto=require(_0x014b('0xc'));var jsforce=require(_0x014b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x014b('0x8'));var querystring=require('querystring');var Papa=require(_0x014b('0xe'));var Redis=require(_0x014b('0xf'));var authService=require(_0x014b('0x10'));var qs=require(_0x014b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x014b('0x12'));var logger=require(_0x014b('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x014b('0x14'));var licenseUtil=require(_0x014b('0x15'));var db=require(_0x014b('0x16'))['db'];function respondWithStatusCode(_0xced4db,_0x209fbe){_0x209fbe=_0x209fbe||0xcc;return function(_0x439b87){if(_0x439b87){return _0xced4db[_0x014b('0x17')](_0x209fbe);}return _0xced4db[_0x014b('0x18')](_0x209fbe)[_0x014b('0x19')]();};}function respondWithResult(_0x3eb41a,_0x2cf6fd){_0x2cf6fd=_0x2cf6fd||0xc8;return function(_0x2cfa38){if(_0x2cfa38){return _0x3eb41a[_0x014b('0x18')](_0x2cf6fd)['json'](_0x2cfa38);}};}function respondWithFilteredResult(_0x2f60d9,_0x21bd16){return function(_0x19fd17){if(_0x19fd17){var _0x3409a4=typeof _0x21bd16[_0x014b('0x1a')]===_0x014b('0x1b')&&typeof _0x21bd16[_0x014b('0x1c')]===_0x014b('0x1b');var _0x34b655=_0x19fd17[_0x014b('0x1d')];var _0x23a538=_0x3409a4?0x0:_0x21bd16[_0x014b('0x1a')];var _0x1a93e4=_0x3409a4?_0x19fd17[_0x014b('0x1d')]:_0x21bd16[_0x014b('0x1a')]+_0x21bd16['limit'];var _0xf92506;if(_0x1a93e4>=_0x34b655){_0x1a93e4=_0x34b655;_0xf92506=0xc8;}else{_0xf92506=0xce;}_0x2f60d9[_0x014b('0x18')](_0xf92506);return _0x2f60d9['set'](_0x014b('0x1e'),_0x23a538+'-'+_0x1a93e4+'/'+_0x34b655)['json'](_0x19fd17);}return null;};}function patchUpdates(_0x4f5674){return function(_0x147504){try{jsonpatch['apply'](_0x147504,_0x4f5674,!![]);}catch(_0x436683){return BPromise[_0x014b('0x1f')](_0x436683);}return _0x147504[_0x014b('0x20')]();};}function saveUpdates(_0x3977f6,_0x458bb3){return function(_0x57e8d5){if(_0x57e8d5){return _0x57e8d5['update'](_0x3977f6)[_0x014b('0x21')](function(_0x50ef2a){return _0x50ef2a;});}return null;};}function removeEntity(_0x2263ca,_0x287ad2){return function(_0x9e9ed6){if(_0x9e9ed6){return _0x9e9ed6[_0x014b('0x22')]()[_0x014b('0x21')](function(){_0x2263ca[_0x014b('0x18')](0xcc)[_0x014b('0x19')]();});}};}function handleEntityNotFound(_0xad9662,_0x224107){return function(_0x501b68){if(!_0x501b68){_0xad9662[_0x014b('0x17')](0x194);}return _0x501b68;};}function handleError(_0x3112ea,_0x14e43e){_0x14e43e=_0x14e43e||0x1f4;return function(_0x4caa19){logger[_0x014b('0x23')](_0x4caa19['stack']);if(_0x4caa19['name']){delete _0x4caa19['name'];}_0x3112ea[_0x014b('0x18')](_0x14e43e)[_0x014b('0x24')](_0x4caa19);};}exports[_0x014b('0x25')]=function(_0x3eda75,_0x3353be){var _0x8b6ff5={},_0x8d7277={},_0x1d03c1={'count':0x0,'rows':[]};var _0x1479b9=_[_0x014b('0x26')](db[_0x014b('0x27')][_0x014b('0x28')],function(_0x36bf8c){return{'name':_0x36bf8c[_0x014b('0x29')],'type':_0x36bf8c[_0x014b('0x2a')][_0x014b('0x2b')]};});_0x8d7277[_0x014b('0x2c')]=_[_0x014b('0x2d')](_[_0x014b('0x26')](_0x1479b9,_0x014b('0x2e')),[_0x014b('0x2e')]);_0x8d7277['query']=_['keys'](_0x3eda75['query']);_0x8d7277[_0x014b('0x2f')]=_[_0x014b('0x30')](_0x8d7277[_0x014b('0x2c')],_0x8d7277[_0x014b('0x31')]);_0x8b6ff5['attributes']=_[_0x014b('0x30')](_0x8d7277[_0x014b('0x2c')],qs[_0x014b('0x32')](_0x3eda75['query'][_0x014b('0x32')]));_0x8b6ff5[_0x014b('0x33')]=_0x8b6ff5[_0x014b('0x33')][_0x014b('0x34')]?_0x8b6ff5[_0x014b('0x33')]:_0x8d7277[_0x014b('0x2c')];if(!_0x3eda75['query']['hasOwnProperty'](_0x014b('0x35'))){_0x8b6ff5[_0x014b('0x1c')]=qs[_0x014b('0x1c')](_0x3eda75[_0x014b('0x31')][_0x014b('0x1c')]);_0x8b6ff5['offset']=qs[_0x014b('0x1a')](_0x3eda75[_0x014b('0x31')][_0x014b('0x1a')]);}_0x8b6ff5[_0x014b('0x36')]=qs[_0x014b('0x37')](_0x3eda75[_0x014b('0x31')]['sort']);_0x8b6ff5[_0x014b('0x38')]=qs[_0x014b('0x2f')](_[_0x014b('0x39')](_0x3eda75['query'],_0x8d7277['filters']),_0x1479b9);if(_0x3eda75[_0x014b('0x31')][_0x014b('0x3a')]){_0x8b6ff5[_0x014b('0x38')]=_[_0x014b('0x3b')](_0x8b6ff5[_0x014b('0x38')],{'$or':_[_0x014b('0x26')](_0x1479b9,function(_0x58c2d0){if(_0x58c2d0[_0x014b('0x2a')]!==_0x014b('0x3c')){var _0x241b30={};_0x241b30[_0x58c2d0[_0x014b('0x2e')]]={'$like':'%'+_0x3eda75[_0x014b('0x31')][_0x014b('0x3a')]+'%'};return _0x241b30;}})});}_0x8b6ff5=_[_0x014b('0x3b')]({},_0x8b6ff5,_0x3eda75[_0x014b('0x3d')]);var _0x180c5c={'where':_0x8b6ff5[_0x014b('0x38')]};return db['CmCustomField'][_0x014b('0x1d')](_0x180c5c)['then'](function(_0x428002){_0x1d03c1['count']=_0x428002;if(_0x3eda75[_0x014b('0x31')][_0x014b('0x3e')]){_0x8b6ff5[_0x014b('0x3f')]=[{'all':!![]}];}return db[_0x014b('0x27')][_0x014b('0x40')](_0x8b6ff5);})[_0x014b('0x21')](function(_0x19c087){_0x1d03c1[_0x014b('0x41')]=_0x19c087;return _0x1d03c1;})[_0x014b('0x21')](respondWithFilteredResult(_0x3353be,_0x8b6ff5))[_0x014b('0x42')](handleError(_0x3353be,null));};exports['show']=function(_0x3275e0,_0x3efebf){var _0x23378c={'raw':!![],'where':{'id':_0x3275e0[_0x014b('0x43')]['id']}},_0x201974={};_0x201974[_0x014b('0x2c')]=_['keys'](db[_0x014b('0x27')][_0x014b('0x28')]);_0x201974[_0x014b('0x31')]=_[_0x014b('0x44')](_0x3275e0['query']);_0x201974['filters']=_[_0x014b('0x30')](_0x201974['model'],_0x201974['query']);_0x23378c[_0x014b('0x33')]=_['intersection'](_0x201974[_0x014b('0x2c')],qs['fields'](_0x3275e0[_0x014b('0x31')]['fields']));_0x23378c['attributes']=_0x23378c['attributes'][_0x014b('0x34')]?_0x23378c[_0x014b('0x33')]:_0x201974[_0x014b('0x2c')];if(_0x3275e0[_0x014b('0x31')][_0x014b('0x3e')]){_0x23378c[_0x014b('0x3f')]=[{'all':!![]}];}_0x23378c=_[_0x014b('0x3b')]({},_0x23378c,_0x3275e0[_0x014b('0x3d')]);return db[_0x014b('0x27')]['find'](_0x23378c)[_0x014b('0x21')](handleEntityNotFound(_0x3efebf,null))[_0x014b('0x21')](respondWithResult(_0x3efebf,null))['catch'](handleError(_0x3efebf,null));};exports[_0x014b('0x45')]=function(_0x1908e1,_0xaebcef){if(_0x1908e1[_0x014b('0x46')]['id']){delete _0x1908e1[_0x014b('0x46')]['id'];}return db[_0x014b('0x27')][_0x014b('0x47')]({'where':{'id':_0x1908e1[_0x014b('0x43')]['id']}})['then'](handleEntityNotFound(_0xaebcef,null))[_0x014b('0x21')](saveUpdates(_0x1908e1['body'],null))['then'](respondWithResult(_0xaebcef,null))[_0x014b('0x42')](handleError(_0xaebcef,null));};exports[_0x014b('0x22')]=function(_0x19adc4,_0xc1e6d9){return db[_0x014b('0x27')][_0x014b('0x47')]({'where':{'id':_0x19adc4[_0x014b('0x43')]['id']}})['then'](handleEntityNotFound(_0xc1e6d9,null))[_0x014b('0x21')](removeEntity(_0xc1e6d9,null))[_0x014b('0x42')](handleError(_0xc1e6d9,null));};exports[_0x014b('0x48')]=function(_0x4ab9e5,_0x392262){var _0x24aed2;return db['sequelize'][_0x014b('0x49')](function(_0x3d271b){return db[_0x014b('0x27')][_0x014b('0x48')](_0x4ab9e5[_0x014b('0x46')],{'transaction':_0x3d271b})[_0x014b('0x21')](function(_0x54b830){_0x24aed2=_0x54b830;var _0x20a55f={'type':db[_0x014b('0x4a')][_0x014b('0x4b')],'transaction':_0x3d271b};switch(_0x4ab9e5[_0x014b('0x46')][_0x014b('0x2a')]){case _0x014b('0x4c'):_0x20a55f[_0x014b('0x2a')]=db['Sequelize'][_0x014b('0x4b')];break;case _0x014b('0x4d'):_0x20a55f[_0x014b('0x2a')]=db[_0x014b('0x4a')]['INTEGER'];break;case _0x014b('0x4e'):_0x20a55f[_0x014b('0x2a')]=db[_0x014b('0x4a')][_0x014b('0x4f')];_0x20a55f[_0x014b('0x50')]=![];break;default:}return db[_0x014b('0x51')][_0x014b('0x52')]['addColumn'](_0x014b('0x53'),util['format'](_0x014b('0x54'),_0x24aed2['id']),_0x20a55f);})[_0x014b('0x21')](function(){return _0x24aed2;});})[_0x014b('0x21')](respondWithResult(_0x392262,0xc9))[_0x014b('0x42')](handleError(_0x392262,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index f236865..51d63e0 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 _0x68f0=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','CmCustomField','cm_custom_fields','lodash','util'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x68f0,0x15d));var _0x068f=function(_0x3763da,_0x58158b){_0x3763da=_0x3763da-0x0;var _0x5d192f=_0x68f0[_0x3763da];return _0x5d192f;};'use strict';var _=require(_0x068f('0x0'));var util=require(_0x068f('0x1'));var logger=require(_0x068f('0x2'))(_0x068f('0x3'));var moment=require(_0x068f('0x4'));var BPromise=require(_0x068f('0x5'));var rp=require(_0x068f('0x6'));var fs=require('fs');var path=require(_0x068f('0x7'));var rimraf=require('rimraf');var config=require(_0x068f('0x8'));var attributes=require('./cmCustomField.attributes');module[_0x068f('0x9')]=function(_0x2562b5,_0x1a989a){return _0x2562b5[_0x068f('0xa')](_0x068f('0xb'),attributes,{'tableName':_0x068f('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf252=['../../config/environment','./cmCustomField.attributes','define','CmCustomField','cm_custom_fields','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0xf252,0x101));var _0x2f25=function(_0x35abac,_0x5d3b0f){_0x35abac=_0x35abac-0x0;var _0x3bc1a5=_0xf252[_0x35abac];return _0x3bc1a5;};'use strict';var _=require('lodash');var util=require(_0x2f25('0x0'));var logger=require(_0x2f25('0x1'))(_0x2f25('0x2'));var moment=require(_0x2f25('0x3'));var BPromise=require(_0x2f25('0x4'));var rp=require(_0x2f25('0x5'));var fs=require('fs');var path=require(_0x2f25('0x6'));var rimraf=require('rimraf');var config=require(_0x2f25('0x7'));var attributes=require(_0x2f25('0x8'));module['exports']=function(_0x134ef7,_0x1319a4){return _0x134ef7[_0x2f25('0x9')](_0x2f25('0xa'),attributes,{'tableName':_0x2f25('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 6e3febb..097b8d5 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 _0x5860=['request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5860,0x113));var _0x0586=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x5860[_0xd1d19a];return _0x52a79d;};'use strict';var _=require(_0x0586('0x0'));var util=require(_0x0586('0x1'));var moment=require(_0x0586('0x2'));var BPromise=require(_0x0586('0x3'));var rs=require(_0x0586('0x4'));var fs=require('fs');var Redis=require(_0x0586('0x5'));var db=require(_0x0586('0x6'))['db'];var utils=require(_0x0586('0x7'));var logger=require(_0x0586('0x8'))(_0x0586('0x9'));var config=require(_0x0586('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x0586('0xb')][_0x0586('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x308133,_0x1221eb,_0x487ee8){return new BPromise(function(_0x1460c4,_0x58c207){return client[_0x0586('0xd')](_0x308133,_0x487ee8)[_0x0586('0xe')](function(_0x12fec0){logger[_0x0586('0xf')](_0x0586('0x10'),_0x1221eb,_0x0586('0x11'));logger[_0x0586('0x12')](_0x0586('0x13'),_0x1221eb,_0x0586('0x11'),JSON[_0x0586('0x14')](_0x12fec0));if(_0x12fec0[_0x0586('0x15')]){if(_0x12fec0[_0x0586('0x15')]['code']===0x1f4){logger[_0x0586('0x15')](_0x0586('0x10'),_0x1221eb,_0x12fec0[_0x0586('0x15')][_0x0586('0x16')]);return _0x58c207(_0x12fec0[_0x0586('0x15')]['message']);}logger[_0x0586('0x15')](_0x0586('0x10'),_0x1221eb,_0x12fec0[_0x0586('0x15')][_0x0586('0x16')]);return _0x1460c4(_0x12fec0[_0x0586('0x15')][_0x0586('0x16')]);}else{logger[_0x0586('0xf')](_0x0586('0x10'),_0x1221eb,_0x0586('0x11'));_0x1460c4(_0x12fec0['result'][_0x0586('0x16')]);}})[_0x0586('0x17')](function(_0x2bf0cc){logger[_0x0586('0x15')](_0x0586('0x10'),_0x1221eb,_0x2bf0cc);_0x58c207(_0x2bf0cc);});});} \ No newline at end of file +var _0xdd04=['../../config/logger','rpc','../../config/environment','http','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd04,0x187));var _0x4dd0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd04[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4dd0('0x0'));var util=require(_0x4dd0('0x1'));var moment=require(_0x4dd0('0x2'));var BPromise=require(_0x4dd0('0x3'));var rs=require(_0x4dd0('0x4'));var fs=require('fs');var Redis=require(_0x4dd0('0x5'));var db=require(_0x4dd0('0x6'))['db'];var utils=require(_0x4dd0('0x7'));var logger=require(_0x4dd0('0x8'))(_0x4dd0('0x9'));var config=require(_0x4dd0('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4dd0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x409290,_0x4ec509,_0x5bea8b){return new BPromise(function(_0x491ecc,_0x2f40ea){return client['request'](_0x409290,_0x5bea8b)['then'](function(_0x4d7a48){logger[_0x4dd0('0xc')](_0x4dd0('0xd'),_0x4ec509,_0x4dd0('0xe'));logger[_0x4dd0('0xf')](_0x4dd0('0x10'),_0x4ec509,'request\x20sent',JSON[_0x4dd0('0x11')](_0x4d7a48));if(_0x4d7a48['error']){if(_0x4d7a48[_0x4dd0('0x12')][_0x4dd0('0x13')]===0x1f4){logger[_0x4dd0('0x12')]('CmCustomField,\x20%s,\x20%s',_0x4ec509,_0x4d7a48['error'][_0x4dd0('0x14')]);return _0x2f40ea(_0x4d7a48[_0x4dd0('0x12')]['message']);}logger[_0x4dd0('0x12')](_0x4dd0('0xd'),_0x4ec509,_0x4d7a48[_0x4dd0('0x12')]['message']);return _0x491ecc(_0x4d7a48['error'][_0x4dd0('0x14')]);}else{logger[_0x4dd0('0xc')](_0x4dd0('0xd'),_0x4ec509,_0x4dd0('0xe'));_0x491ecc(_0x4d7a48['result'][_0x4dd0('0x14')]);}})['catch'](function(_0x785b4f){logger[_0x4dd0('0x12')](_0x4dd0('0xd'),_0x4ec509,_0x785b4f);_0x2f40ea(_0x785b4f);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 1ee22a0..8c40945 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 _0x80c3=['isAuthenticated','post','put','update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','get','/:id'];(function(_0x4afba2,_0x3244f3){var _0x3eb413=function(_0x1a1a5b){while(--_0x1a1a5b){_0x4afba2['push'](_0x4afba2['shift']());}};_0x3eb413(++_0x3244f3);}(_0x80c3,0x18f));var _0x380c=function(_0x5466ab,_0x227b13){_0x5466ab=_0x5466ab-0x0;var _0x40751a=_0x80c3[_0x5466ab];return _0x40751a;};'use strict';var multer=require(_0x380c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x380c('0x1'));var express=require('express');var router=express[_0x380c('0x2')]();var fs_extra=require(_0x380c('0x3'));var auth=require(_0x380c('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmCustomField.controller');router[_0x380c('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x380c('0x5')](_0x380c('0x6'),auth[_0x380c('0x7')](),controller['show']);router[_0x380c('0x8')]('/',auth[_0x380c('0x7')](),controller['create']);router[_0x380c('0x9')](_0x380c('0x6'),auth['isAuthenticated'](),controller[_0x380c('0xa')]);router[_0x380c('0xb')](_0x380c('0x6'),auth['isAuthenticated'](),controller[_0x380c('0xc')]);module[_0x380c('0xd')]=router; \ No newline at end of file +var _0x3561=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','show','post','put','/:id','update','exports','multer','path','connect-timeout','express'];(function(_0x22ee0f,_0x22e6d2){var _0x204696=function(_0x4cab38){while(--_0x4cab38){_0x22ee0f['push'](_0x22ee0f['shift']());}};_0x204696(++_0x22e6d2);}(_0x3561,0x94));var _0x1356=function(_0x3e614e,_0x257644){_0x3e614e=_0x3e614e-0x0;var _0x59d5dc=_0x3561[_0x3e614e];return _0x59d5dc;};'use strict';var multer=require(_0x1356('0x0'));var util=require('util');var path=require(_0x1356('0x1'));var timeout=require(_0x1356('0x2'));var express=require(_0x1356('0x3'));var router=express[_0x1356('0x4')]();var fs_extra=require(_0x1356('0x5'));var auth=require(_0x1356('0x6'));var interaction=require(_0x1356('0x7'));var config=require(_0x1356('0x8'));var controller=require(_0x1356('0x9'));router[_0x1356('0xa')]('/',auth[_0x1356('0xb')](),controller[_0x1356('0xc')]);router[_0x1356('0xa')]('/:id',auth[_0x1356('0xb')](),controller[_0x1356('0xd')]);router[_0x1356('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1356('0xf')](_0x1356('0x10'),auth['isAuthenticated'](),controller[_0x1356('0x11')]);router['delete'](_0x1356('0x10'),auth[_0x1356('0xb')](),controller['destroy']);module[_0x1356('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 5999f6f..9602fa7 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 _0xaea4=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','contactListQueue','moment','sequelize','exports'];(function(_0x24b679,_0x4b74e2){var _0x1f2769=function(_0x4c836c){while(--_0x4c836c){_0x24b679['push'](_0x24b679['shift']());}};_0x1f2769(++_0x4b74e2);}(_0xaea4,0x147));var _0x4aea=function(_0x206cd5,_0x585408){_0x206cd5=_0x206cd5-0x0;var _0x26e772=_0xaea4[_0x206cd5];return _0x26e772;};'use strict';var moment=require(_0x4aea('0x0'));var Sequelize=require(_0x4aea('0x1'));module[_0x4aea('0x2')]={'phone':{'type':Sequelize[_0x4aea('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x4aea('0x4')],'defaultValue':moment()[_0x4aea('0x5')](_0x4aea('0x6'))},'countbusyretry':{'type':Sequelize[_0x4aea('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4aea('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x4aea('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4aea('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4aea('0x4')]},'priority':{'type':Sequelize[_0x4aea('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x4aea('0x8')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x4aea('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x4aea('0x7')],'unique':_0x4aea('0x9')},'UserId':{'type':Sequelize[_0x4aea('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x4aea('0x7')],'unique':_0x4aea('0x9')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x4aea('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4aea('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4aea('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x399f=['contactListQueue','moment','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','BOOLEAN'];(function(_0x3e2101,_0x2d8609){var _0x484582=function(_0x3210ed){while(--_0x3210ed){_0x3e2101['push'](_0x3e2101['shift']());}};_0x484582(++_0x2d8609);}(_0x399f,0x1e7));var _0xf399=function(_0xc6344a,_0x5a1ec7){_0xc6344a=_0xc6344a-0x0;var _0x2bddc7=_0x399f[_0xc6344a];return _0x2bddc7;};'use strict';var moment=require(_0xf399('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0xf399('0x1')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xf399('0x2')],'defaultValue':moment()[_0xf399('0x3')](_0xf399('0x4'))},'countbusyretry':{'type':Sequelize[_0xf399('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf399('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf399('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xf399('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xf399('0x7')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xf399('0x5')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xf399('0x5')],'unique':_0xf399('0x8')},'UserId':{'type':Sequelize[_0xf399('0x5')]},'VoiceQueueId':{'type':Sequelize[_0xf399('0x5')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xf399('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf399('0x5')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index a3792a5..7dfb39e 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 _0x3ae8=['to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','name','send','index','map','fieldName','type','query','keys','filters','intersection','$and','$gte','$lt','$lte','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$contained','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','CmHopper','includeAll','include','findAll','rows','catch','show','rawAttributes','length','create','body','find','params','describe','destroy','VoiceQueueId','VoiceQueue','CampaignId','omit','dataValues','updatedAt','statedesc','deleted','campaign','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','isNil','lastName','calleridname','CmHopperFinal','end','getVoiceQueues','outbound','preview','sequelize','transaction','direction','prev','hopperIds','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','dialOrderByScheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','Contact','CmCompany','Company','dialActive','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x114fc9,_0x3cf8b7){var _0xcc622a=function(_0x246003){while(--_0x246003){_0x114fc9['push'](_0x114fc9['shift']());}};_0xcc622a(++_0x3cf8b7);}(_0x3ae8,0x85));var _0x83ae=function(_0x5dce17,_0x130171){_0x5dce17=_0x5dce17-0x0;var _0x14b173=_0x3ae8[_0x5dce17];return _0x14b173;};'use strict';var emlformat=require(_0x83ae('0x0'));var rimraf=require(_0x83ae('0x1'));var zipdir=require(_0x83ae('0x2'));var jsonpatch=require(_0x83ae('0x3'));var rp=require(_0x83ae('0x4'));var moment=require(_0x83ae('0x5'));var BPromise=require(_0x83ae('0x6'));var Mustache=require('mustache');var util=require(_0x83ae('0x7'));var path=require(_0x83ae('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x83ae('0x9'));var fs=require('fs');var fs_extra=require(_0x83ae('0xa'));var _=require(_0x83ae('0xb'));var squel=require(_0x83ae('0xc'));var crypto=require(_0x83ae('0xd'));var jsforce=require(_0x83ae('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x83ae('0xf'));var querystring=require(_0x83ae('0x10'));var Papa=require(_0x83ae('0x11'));var Redis=require(_0x83ae('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x83ae('0x13'));var as=require(_0x83ae('0x14'));var hardwareService=require(_0x83ae('0x15'));var logger=require(_0x83ae('0x16'))(_0x83ae('0x17'));var utils=require(_0x83ae('0x18'));var config=require(_0x83ae('0x19'));var licenseUtil=require(_0x83ae('0x1a'));var db=require(_0x83ae('0x1b'))['db'];function respondWithStatusCode(_0x54610a,_0x28aeb6){_0x28aeb6=_0x28aeb6||0xcc;return function(_0x4690c2){if(_0x4690c2){return _0x54610a[_0x83ae('0x1c')](_0x28aeb6);}return _0x54610a[_0x83ae('0x1d')](_0x28aeb6)['end']();};}function respondWithResult(_0x1046ea,_0xd5342f){_0xd5342f=_0xd5342f||0xc8;return function(_0x2cc706){if(_0x2cc706){return _0x1046ea[_0x83ae('0x1d')](_0xd5342f)['json'](_0x2cc706);}};}function respondWithFilteredResult(_0x5b752b,_0x3a1f3e){return function(_0x3b4db1){if(_0x3b4db1){var _0x39250f=typeof _0x3a1f3e[_0x83ae('0x1e')]===_0x83ae('0x1f')&&typeof _0x3a1f3e[_0x83ae('0x20')]==='undefined';var _0x4587a0=_0x3b4db1['count'];var _0x13ae77=_0x39250f?0x0:_0x3a1f3e['offset'];var _0x233b9b=_0x39250f?_0x3b4db1[_0x83ae('0x21')]:_0x3a1f3e['offset']+_0x3a1f3e[_0x83ae('0x20')];var _0x298b77;if(_0x233b9b>=_0x4587a0){_0x233b9b=_0x4587a0;_0x298b77=0xc8;}else{_0x298b77=0xce;}_0x5b752b[_0x83ae('0x1d')](_0x298b77);return _0x5b752b[_0x83ae('0x22')](_0x83ae('0x23'),_0x13ae77+'-'+_0x233b9b+'/'+_0x4587a0)[_0x83ae('0x24')](_0x3b4db1);}return null;};}function patchUpdates(_0x1b52ff){return function(_0x575fd4){try{jsonpatch['apply'](_0x575fd4,_0x1b52ff,!![]);}catch(_0x4e1763){return BPromise[_0x83ae('0x25')](_0x4e1763);}return _0x575fd4[_0x83ae('0x26')]();};}function saveUpdates(_0x4afb64,_0x1649cf){return function(_0x2f5f06){if(_0x2f5f06){return _0x2f5f06[_0x83ae('0x27')](_0x4afb64)[_0x83ae('0x28')](function(_0x4a291e){return _0x4a291e;});}return null;};}function removeEntity(_0x5f50b1,_0x197d2d){return function(_0x3a9968){if(_0x3a9968){return _0x3a9968['destroy']()['then'](function(){_0x5f50b1[_0x83ae('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cbc65,_0x36e7b3){return function(_0x46da4a){if(!_0x46da4a){_0x3cbc65[_0x83ae('0x1c')](0x194);}return _0x46da4a;};}function handleError(_0x258692,_0x2f9c23){_0x2f9c23=_0x2f9c23||0x1f4;return function(_0x8927f3){logger['error'](_0x8927f3['stack']);if(_0x8927f3[_0x83ae('0x29')]){delete _0x8927f3[_0x83ae('0x29')];}_0x258692[_0x83ae('0x1d')](_0x2f9c23)[_0x83ae('0x2a')](_0x8927f3);};}exports[_0x83ae('0x2b')]=function(_0x3ddad5,_0xb60864){var _0x4e0986={},_0x155cb1={},_0x3e00cd={'count':0x0,'rows':[]};var _0x346a8f=_[_0x83ae('0x2c')](db['CmHopper']['rawAttributes'],function(_0xe65746){return{'name':_0xe65746[_0x83ae('0x2d')],'type':_0xe65746[_0x83ae('0x2e')]['key']};});_0x155cb1['model']=_[_0x83ae('0x2c')](_0x346a8f,_0x83ae('0x29'));_0x155cb1[_0x83ae('0x2f')]=_[_0x83ae('0x30')](_0x3ddad5[_0x83ae('0x2f')]);_0x155cb1[_0x83ae('0x31')]=_[_0x83ae('0x32')](_0x155cb1['model'],_0x155cb1['query']);_0x155cb1[_0x83ae('0x31')]=_['concat'](_0x155cb1[_0x83ae('0x31')],[_0x83ae('0x33'),'$or','$gt',_0x83ae('0x34'),_0x83ae('0x35'),_0x83ae('0x36'),'$ne',_0x83ae('0x37'),_0x83ae('0x38'),_0x83ae('0x39'),_0x83ae('0x3a'),_0x83ae('0x3b'),_0x83ae('0x3c'),_0x83ae('0x3d'),_0x83ae('0x3e'),_0x83ae('0x3f'),'$notILike',_0x83ae('0x3d'),'$overlap','$contains',_0x83ae('0x40'),'$any']);_0x4e0986[_0x83ae('0x41')]=_['intersection'](_0x155cb1[_0x83ae('0x42')],qs[_0x83ae('0x43')](_0x3ddad5[_0x83ae('0x2f')][_0x83ae('0x43')]));_0x4e0986[_0x83ae('0x41')]=_0x4e0986[_0x83ae('0x41')]['length']?_0x4e0986['attributes']:_0x155cb1[_0x83ae('0x42')];if(!_0x3ddad5[_0x83ae('0x2f')][_0x83ae('0x44')](_0x83ae('0x45'))){_0x4e0986[_0x83ae('0x20')]=qs['limit'](_0x3ddad5[_0x83ae('0x2f')]['limit']);_0x4e0986[_0x83ae('0x1e')]=qs[_0x83ae('0x1e')](_0x3ddad5[_0x83ae('0x2f')][_0x83ae('0x1e')]);}_0x4e0986[_0x83ae('0x46')]=qs[_0x83ae('0x47')](_0x3ddad5['query'][_0x83ae('0x47')]);_0x4e0986[_0x83ae('0x48')]=qs['filters'](_[_0x83ae('0x49')](_0x3ddad5[_0x83ae('0x2f')],_0x155cb1['filters']),_0x346a8f);if(_0x3ddad5[_0x83ae('0x2f')]['filter']){_0x4e0986[_0x83ae('0x48')]=_[_0x83ae('0x4a')](_0x4e0986[_0x83ae('0x48')],{'$or':_[_0x83ae('0x2c')](_0x346a8f,function(_0x29f7b4){if(_0x29f7b4['type']!==_0x83ae('0x4b')){var _0x5ed7d0={};_0x5ed7d0[_0x29f7b4[_0x83ae('0x29')]]={'$like':'%'+_0x3ddad5[_0x83ae('0x2f')][_0x83ae('0x4c')]+'%'};return _0x5ed7d0;}})});}_0x4e0986=_[_0x83ae('0x4a')]({},_0x4e0986,_0x3ddad5[_0x83ae('0x4d')]);var _0x49d2fb={'where':_0x4e0986[_0x83ae('0x48')]};return db[_0x83ae('0x4e')]['count'](_0x49d2fb)[_0x83ae('0x28')](function(_0x58b5ef){_0x3e00cd[_0x83ae('0x21')]=_0x58b5ef;if(_0x3ddad5[_0x83ae('0x2f')][_0x83ae('0x4f')]){_0x4e0986[_0x83ae('0x50')]=[{'all':!![]}];}return db[_0x83ae('0x4e')][_0x83ae('0x51')](_0x4e0986);})[_0x83ae('0x28')](function(_0x4d7183){_0x3e00cd[_0x83ae('0x52')]=_0x4d7183;return _0x3e00cd;})['then'](respondWithFilteredResult(_0xb60864,_0x4e0986))[_0x83ae('0x53')](handleError(_0xb60864,null));};exports[_0x83ae('0x54')]=function(_0x2daf4d,_0x117f59){var _0x1a6100={'raw':!![],'where':{'id':_0x2daf4d['params']['id']}},_0x5d09a4={};_0x5d09a4[_0x83ae('0x42')]=_[_0x83ae('0x30')](db[_0x83ae('0x4e')][_0x83ae('0x55')]);_0x5d09a4[_0x83ae('0x2f')]=_[_0x83ae('0x30')](_0x2daf4d[_0x83ae('0x2f')]);_0x5d09a4['filters']=_[_0x83ae('0x32')](_0x5d09a4[_0x83ae('0x42')],_0x5d09a4['query']);_0x1a6100[_0x83ae('0x41')]=_[_0x83ae('0x32')](_0x5d09a4[_0x83ae('0x42')],qs['fields'](_0x2daf4d[_0x83ae('0x2f')]['fields']));_0x1a6100[_0x83ae('0x41')]=_0x1a6100[_0x83ae('0x41')][_0x83ae('0x56')]?_0x1a6100[_0x83ae('0x41')]:_0x5d09a4[_0x83ae('0x42')];if(_0x2daf4d[_0x83ae('0x2f')]['includeAll']){_0x1a6100[_0x83ae('0x50')]=[{'all':!![]}];}_0x1a6100=_['merge']({},_0x1a6100,_0x2daf4d[_0x83ae('0x4d')]);return db[_0x83ae('0x4e')]['find'](_0x1a6100)[_0x83ae('0x28')](handleEntityNotFound(_0x117f59,null))[_0x83ae('0x28')](respondWithResult(_0x117f59,null))[_0x83ae('0x53')](handleError(_0x117f59,null));};exports[_0x83ae('0x57')]=function(_0x1ca92d,_0x32b44b){return db[_0x83ae('0x4e')][_0x83ae('0x57')](_0x1ca92d['body'],{})['then'](respondWithResult(_0x32b44b,0xc9))[_0x83ae('0x53')](handleError(_0x32b44b,null));};exports[_0x83ae('0x27')]=function(_0x35a6f5,_0x117701){if(_0x35a6f5[_0x83ae('0x58')]['id']){delete _0x35a6f5[_0x83ae('0x58')]['id'];}return db[_0x83ae('0x4e')][_0x83ae('0x59')]({'where':{'id':_0x35a6f5[_0x83ae('0x5a')]['id']}})[_0x83ae('0x28')](handleEntityNotFound(_0x117701,null))[_0x83ae('0x28')](saveUpdates(_0x35a6f5['body'],null))[_0x83ae('0x28')](respondWithResult(_0x117701,null))[_0x83ae('0x53')](handleError(_0x117701,null));};exports['describe']=function(_0x16496b,_0x1d5305){return db[_0x83ae('0x4e')][_0x83ae('0x5b')]()[_0x83ae('0x28')](respondWithResult(_0x1d5305,null))['catch'](handleError(_0x1d5305,null));};exports[_0x83ae('0x5c')]=function(_0x1ae244,_0x3e75cf){var _0x29f7ea;return db[_0x83ae('0x4e')][_0x83ae('0x59')]({'where':{'id':_0x1ae244[_0x83ae('0x5a')]['id']}})[_0x83ae('0x28')](handleEntityNotFound(_0x3e75cf,null))[_0x83ae('0x28')](function(_0x274112){if(_0x274112){return _0x274112['destroy']()[_0x83ae('0x28')](function(_0x2ece68){return _0x2ece68;});}})[_0x83ae('0x28')](function(_0x17588b){_0x29f7ea=_0x17588b;if(_0x17588b){if(_0x17588b[_0x83ae('0x5d')]||_0x17588b['CampaignId']){return db[_0x17588b['VoiceQueueId']?_0x83ae('0x5e'):'Campaign'][_0x83ae('0x59')]({'where':{'id':_0x17588b['VoiceQueueId']?_0x17588b['VoiceQueueId']:_0x17588b[_0x83ae('0x5f')]},'attributes':['id',_0x83ae('0x29')],'raw':!![]});}}})[_0x83ae('0x28')](function(_0x316cc4){var _0x41bc0e={};if(_0x316cc4){_[_0x83ae('0x4a')](_0x41bc0e,_[_0x83ae('0x60')](_0x29f7ea[_0x83ae('0x61')],['createdAt',_0x83ae('0x62'),'id']));_0x41bc0e['state']=0x15;_0x41bc0e[_0x83ae('0x63')]=_0x83ae('0x64');_0x41bc0e[_0x83ae('0x65')]=_0x316cc4['name'];_0x41bc0e[_0x83ae('0x66')]=_0x1ae244[_0x83ae('0x67')][_0x83ae('0x29')];_0x41bc0e['UserId']=_0x1ae244['user']['id'];_0x41bc0e[_0x83ae('0x64')]=!![];_0x41bc0e[_0x83ae('0x68')]=moment()[_0x83ae('0x69')](_0x83ae('0x6a'));_0x41bc0e[_0x83ae('0x6b')]=_0x29f7ea[_0x83ae('0x6c')];_0x41bc0e[_0x83ae('0x6d')]=_0x29f7ea[_0x83ae('0x5d')]?_0x83ae('0x6e'):_0x83ae('0x6f');return db[_0x83ae('0x70')]['find']({'where':{'id':_0x41bc0e[_0x83ae('0x71')]},'attributes':[_0x83ae('0x72'),'lastName']})[_0x83ae('0x28')](function(_0x25dae2){if(!_[_0x83ae('0x73')](_0x3e75cf)&&!_[_0x83ae('0x73')](_0x25dae2[_0x83ae('0x72')])){_0x41bc0e['calleridname']=_0x25dae2[_0x83ae('0x72')];if(!_['isNil'](_0x25dae2[_0x83ae('0x74')])){_0x41bc0e[_0x83ae('0x75')]+='\x20'+_0x25dae2[_0x83ae('0x74')];}}})['finally'](function(){return db[_0x83ae('0x76')][_0x83ae('0x57')](_0x41bc0e);});}})[_0x83ae('0x28')](function(){return _0x3e75cf[_0x83ae('0x1d')](0xcc)[_0x83ae('0x77')]();})[_0x83ae('0x53')](handleError(_0x3e75cf,null));};exports['getPreview']=function(_0x47e73e,_0x4792b6,_0x2a3b72){var _0x4c47f1=[];return db['CmContact'][_0x83ae('0x5b')]()[_0x83ae('0x28')](function(_0x119c3b){_0x4c47f1=_[_0x83ae('0x30')](_0x119c3b);return _0x47e73e[_0x83ae('0x67')][_0x83ae('0x78')]({'where':{'type':_0x83ae('0x79'),'dialActive':!![],'dialMethod':_0x83ae('0x7a')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0x83ae('0x28')](function(_0x498acd){if(_0x498acd&&_0x498acd[_0x83ae('0x56')]){return db[_0x83ae('0x7b')][_0x83ae('0x7c')](function(_0x45331e){var _0x3d8a5e={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x83ae('0x6a'))},'VoiceQueueId':{'$in':_['map'](_0x498acd,'id')},'$or':[{'UserId':null},{'UserId':_0x47e73e['user']['id']}]};var _0x1f0cbd=[];if(_0x47e73e['body'][_0x83ae('0x7d')]&&_0x47e73e['body']['direction']===_0x83ae('0x7e')){if(!_['isEmpty'](_0x47e73e[_0x83ae('0x58')][_0x83ae('0x7f')])){_0x3d8a5e['id']={'$in':_0x47e73e[_0x83ae('0x58')][_0x83ae('0x7f')]};}_0x1f0cbd=[['priority',_0x83ae('0x80')],[_0x83ae('0x81'),_0x498acd[0x0]['dialOrderByScheduledAt']==='ASC'?_0x83ae('0x82'):_0x83ae('0x80')],db['sequelize'][_0x83ae('0x83')](_0x83ae('0x84')),['id',_0x83ae('0x82')]];}else{if(!_[_0x83ae('0x85')](_0x47e73e[_0x83ae('0x58')]['hopperIds'])){_0x3d8a5e['id']={'$notIn':_0x47e73e[_0x83ae('0x58')][_0x83ae('0x7f')]};}_0x1f0cbd=[['priority',_0x83ae('0x82')],[_0x83ae('0x81'),_0x498acd[0x0][_0x83ae('0x86')]],db[_0x83ae('0x7b')][_0x83ae('0x83')](_0x83ae('0x87')),['id',_0x83ae('0x80')]];}return db[_0x83ae('0x4e')][_0x83ae('0x88')]({'attributes':['id',_0x83ae('0x89')],'where':_0x3d8a5e,'order':_0x1f0cbd,'transaction':_0x45331e,'lock':_0x45331e[_0x83ae('0x8a')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0x83ae('0x8b'),'attributes':_0x4c47f1,'include':[{'model':db[_0x83ae('0x8c')],'as':_0x83ae('0x8d'),'attributes':['id','name']}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x83ae('0x29')]},{'model':db[_0x83ae('0x5e')],'as':'Queue','attributes':['id',_0x83ae('0x29'),_0x83ae('0x8e')]}]})['then'](function(_0x11df06){if(_0x11df06){return _0x11df06[_0x83ae('0x27')]({'UserId':_0x47e73e[_0x83ae('0x67')]['id']},{'transaction':_0x45331e});}});});}})[_0x83ae('0x28')](handleEntityNotFound(_0x4792b6,null))[_0x83ae('0x28')](respondWithResult(_0x4792b6,null))[_0x83ae('0x53')](handleError(_0x4792b6,null));};exports['getOpenContacts']=function(_0x9d227b,_0x311704,_0x35ebea){return _0x9d227b[_0x83ae('0x67')]['getVoiceQueues']({'where':{'type':_0x83ae('0x79'),'dialActive':!![],'dialMethod':_0x83ae('0x7a')},'attributes':['id'],'raw':!![]})['then'](function(_0x460b30){if(_0x460b30&&_0x460b30[_0x83ae('0x56')]){return db[_0x83ae('0x4e')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x83ae('0x6a'))},'VoiceQueueId':{'$in':_[_0x83ae('0x2c')](_0x460b30,'id')},'$or':[{'UserId':null},{'UserId':_0x9d227b['user']['id']}]}});}return 0x0;})[_0x83ae('0x28')](function(_0x15d86c){if(!_[_0x83ae('0x73')](_0x15d86c)&&_[_0x83ae('0x8f')](_0x15d86c)){return _0x311704[_0x83ae('0x1d')](0xc8)[_0x83ae('0x24')]({'contacts':_0x15d86c});}else{logger[_0x83ae('0x90')](_0x83ae('0x91'),_0x83ae('0x92'),0x194,_0x83ae('0x93'));_0x311704[_0x83ae('0x1c')](0x194);}})['catch'](handleError(_0x311704,null));}; \ No newline at end of file +var _0xb4f0=['queue','ivr','ContactId','firstName','isNil','calleridname','lastName','finally','getPreview','CmContact','outbound','preview','dialOrderByScheduledAt','sequelize','direction','prev','isEmpty','hopperIds','ASC','DESC','priority','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getOpenContacts','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','then','destroy','name','send','index','map','CmHopper','rawAttributes','fieldName','model','query','filters','intersection','$and','$or','$gt','$gte','$lt','$lte','$ne','$not','$between','$in','$notIn','$like','$iLike','$notILike','$contains','$contained','$any','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','options','include','findAll','rows','catch','params','keys','length','includeAll','merge','find','create','update','body','describe','VoiceQueueId','CampaignId','VoiceQueue','omit','createdAt','updatedAt','state','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone'];(function(_0x5148fa,_0x3ecb11){var _0x36e40e=function(_0x24698f){while(--_0x24698f){_0x5148fa['push'](_0x5148fa['shift']());}};_0x36e40e(++_0x3ecb11);}(_0xb4f0,0x152));var _0x0b4f=function(_0x3e6729,_0x16d4af){_0x3e6729=_0x3e6729-0x0;var _0x535bcd=_0xb4f0[_0x3e6729];return _0x535bcd;};'use strict';var emlformat=require(_0x0b4f('0x0'));var rimraf=require(_0x0b4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0b4f('0x2'));var rp=require('request-promise');var moment=require(_0x0b4f('0x3'));var BPromise=require(_0x0b4f('0x4'));var Mustache=require(_0x0b4f('0x5'));var util=require(_0x0b4f('0x6'));var path=require(_0x0b4f('0x7'));var sox=require(_0x0b4f('0x8'));var csv=require(_0x0b4f('0x9'));var ejs=require(_0x0b4f('0xa'));var fs=require('fs');var fs_extra=require(_0x0b4f('0xb'));var _=require(_0x0b4f('0xc'));var squel=require(_0x0b4f('0xd'));var crypto=require(_0x0b4f('0xe'));var jsforce=require(_0x0b4f('0xf'));var deskjs=require(_0x0b4f('0x10'));var toCsv=require(_0x0b4f('0x9'));var querystring=require(_0x0b4f('0x11'));var Papa=require(_0x0b4f('0x12'));var Redis=require(_0x0b4f('0x13'));var authService=require(_0x0b4f('0x14'));var qs=require(_0x0b4f('0x15'));var as=require(_0x0b4f('0x16'));var hardwareService=require(_0x0b4f('0x17'));var logger=require(_0x0b4f('0x18'))(_0x0b4f('0x19'));var utils=require('../../config/utils');var config=require(_0x0b4f('0x1a'));var licenseUtil=require(_0x0b4f('0x1b'));var db=require(_0x0b4f('0x1c'))['db'];function respondWithStatusCode(_0x5bfc4b,_0x280a86){_0x280a86=_0x280a86||0xcc;return function(_0xdeda51){if(_0xdeda51){return _0x5bfc4b[_0x0b4f('0x1d')](_0x280a86);}return _0x5bfc4b[_0x0b4f('0x1e')](_0x280a86)[_0x0b4f('0x1f')]();};}function respondWithResult(_0x509a37,_0x2fb23c){_0x2fb23c=_0x2fb23c||0xc8;return function(_0x44a3d7){if(_0x44a3d7){return _0x509a37['status'](_0x2fb23c)[_0x0b4f('0x20')](_0x44a3d7);}};}function respondWithFilteredResult(_0x386936,_0xb0c9d7){return function(_0x316ab9){if(_0x316ab9){var _0x7da4=typeof _0xb0c9d7['offset']==='undefined'&&typeof _0xb0c9d7[_0x0b4f('0x21')]===_0x0b4f('0x22');var _0x58976f=_0x316ab9[_0x0b4f('0x23')];var _0x28dbdb=_0x7da4?0x0:_0xb0c9d7['offset'];var _0x459ac9=_0x7da4?_0x316ab9[_0x0b4f('0x23')]:_0xb0c9d7[_0x0b4f('0x24')]+_0xb0c9d7['limit'];var _0x2ee961;if(_0x459ac9>=_0x58976f){_0x459ac9=_0x58976f;_0x2ee961=0xc8;}else{_0x2ee961=0xce;}_0x386936['status'](_0x2ee961);return _0x386936[_0x0b4f('0x25')]('Content-Range',_0x28dbdb+'-'+_0x459ac9+'/'+_0x58976f)[_0x0b4f('0x20')](_0x316ab9);}return null;};}function patchUpdates(_0x4a6cb8){return function(_0x18202e){try{jsonpatch[_0x0b4f('0x26')](_0x18202e,_0x4a6cb8,!![]);}catch(_0x2bf82e){return BPromise[_0x0b4f('0x27')](_0x2bf82e);}return _0x18202e['save']();};}function saveUpdates(_0x7a57d2,_0x13ead3){return function(_0x4d6aab){if(_0x4d6aab){return _0x4d6aab['update'](_0x7a57d2)[_0x0b4f('0x28')](function(_0x196847){return _0x196847;});}return null;};}function removeEntity(_0x464792,_0x44a23d){return function(_0x353e8b){if(_0x353e8b){return _0x353e8b[_0x0b4f('0x29')]()[_0x0b4f('0x28')](function(){_0x464792['status'](0xcc)[_0x0b4f('0x1f')]();});}};}function handleEntityNotFound(_0x2d1797,_0x14def4){return function(_0x117180){if(!_0x117180){_0x2d1797[_0x0b4f('0x1d')](0x194);}return _0x117180;};}function handleError(_0x4da3da,_0x21c076){_0x21c076=_0x21c076||0x1f4;return function(_0xba9ec1){logger['error'](_0xba9ec1['stack']);if(_0xba9ec1[_0x0b4f('0x2a')]){delete _0xba9ec1['name'];}_0x4da3da[_0x0b4f('0x1e')](_0x21c076)[_0x0b4f('0x2b')](_0xba9ec1);};}exports[_0x0b4f('0x2c')]=function(_0x50dc7c,_0xb03c6f){var _0x480b4f={},_0x3d721f={},_0x6e83b5={'count':0x0,'rows':[]};var _0x187838=_[_0x0b4f('0x2d')](db[_0x0b4f('0x2e')][_0x0b4f('0x2f')],function(_0x20f69b){return{'name':_0x20f69b[_0x0b4f('0x30')],'type':_0x20f69b['type']['key']};});_0x3d721f[_0x0b4f('0x31')]=_[_0x0b4f('0x2d')](_0x187838,_0x0b4f('0x2a'));_0x3d721f[_0x0b4f('0x32')]=_['keys'](_0x50dc7c[_0x0b4f('0x32')]);_0x3d721f[_0x0b4f('0x33')]=_[_0x0b4f('0x34')](_0x3d721f[_0x0b4f('0x31')],_0x3d721f['query']);_0x3d721f[_0x0b4f('0x33')]=_['concat'](_0x3d721f[_0x0b4f('0x33')],[_0x0b4f('0x35'),_0x0b4f('0x36'),_0x0b4f('0x37'),_0x0b4f('0x38'),_0x0b4f('0x39'),_0x0b4f('0x3a'),_0x0b4f('0x3b'),'$eq',_0x0b4f('0x3c'),_0x0b4f('0x3d'),'$notBetween',_0x0b4f('0x3e'),_0x0b4f('0x3f'),_0x0b4f('0x40'),'$notLike',_0x0b4f('0x41'),_0x0b4f('0x42'),_0x0b4f('0x40'),'$overlap',_0x0b4f('0x43'),_0x0b4f('0x44'),_0x0b4f('0x45')]);_0x480b4f['attributes']=_[_0x0b4f('0x34')](_0x3d721f[_0x0b4f('0x31')],qs[_0x0b4f('0x46')](_0x50dc7c[_0x0b4f('0x32')][_0x0b4f('0x46')]));_0x480b4f['attributes']=_0x480b4f[_0x0b4f('0x47')]['length']?_0x480b4f[_0x0b4f('0x47')]:_0x3d721f['model'];if(!_0x50dc7c[_0x0b4f('0x32')][_0x0b4f('0x48')](_0x0b4f('0x49'))){_0x480b4f[_0x0b4f('0x21')]=qs[_0x0b4f('0x21')](_0x50dc7c[_0x0b4f('0x32')]['limit']);_0x480b4f[_0x0b4f('0x24')]=qs['offset'](_0x50dc7c['query'][_0x0b4f('0x24')]);}_0x480b4f['order']=qs[_0x0b4f('0x4a')](_0x50dc7c[_0x0b4f('0x32')][_0x0b4f('0x4a')]);_0x480b4f[_0x0b4f('0x4b')]=qs['filters'](_[_0x0b4f('0x4c')](_0x50dc7c[_0x0b4f('0x32')],_0x3d721f[_0x0b4f('0x33')]),_0x187838);if(_0x50dc7c['query'][_0x0b4f('0x4d')]){_0x480b4f[_0x0b4f('0x4b')]=_['merge'](_0x480b4f[_0x0b4f('0x4b')],{'$or':_['map'](_0x187838,function(_0x2c8d2c){if(_0x2c8d2c[_0x0b4f('0x4e')]!==_0x0b4f('0x4f')){var _0x4253b5={};_0x4253b5[_0x2c8d2c[_0x0b4f('0x2a')]]={'$like':'%'+_0x50dc7c[_0x0b4f('0x32')]['filter']+'%'};return _0x4253b5;}})});}_0x480b4f=_['merge']({},_0x480b4f,_0x50dc7c[_0x0b4f('0x50')]);var _0x392f0f={'where':_0x480b4f['where']};return db[_0x0b4f('0x2e')][_0x0b4f('0x23')](_0x392f0f)['then'](function(_0x3ae0e7){_0x6e83b5[_0x0b4f('0x23')]=_0x3ae0e7;if(_0x50dc7c[_0x0b4f('0x32')]['includeAll']){_0x480b4f[_0x0b4f('0x51')]=[{'all':!![]}];}return db[_0x0b4f('0x2e')][_0x0b4f('0x52')](_0x480b4f);})[_0x0b4f('0x28')](function(_0x832b18){_0x6e83b5[_0x0b4f('0x53')]=_0x832b18;return _0x6e83b5;})[_0x0b4f('0x28')](respondWithFilteredResult(_0xb03c6f,_0x480b4f))[_0x0b4f('0x54')](handleError(_0xb03c6f,null));};exports['show']=function(_0x547196,_0x529d1e){var _0x3abc71={'raw':!![],'where':{'id':_0x547196[_0x0b4f('0x55')]['id']}},_0x29c73e={};_0x29c73e['model']=_[_0x0b4f('0x56')](db['CmHopper'][_0x0b4f('0x2f')]);_0x29c73e[_0x0b4f('0x32')]=_['keys'](_0x547196[_0x0b4f('0x32')]);_0x29c73e[_0x0b4f('0x33')]=_[_0x0b4f('0x34')](_0x29c73e[_0x0b4f('0x31')],_0x29c73e[_0x0b4f('0x32')]);_0x3abc71[_0x0b4f('0x47')]=_['intersection'](_0x29c73e[_0x0b4f('0x31')],qs[_0x0b4f('0x46')](_0x547196['query'][_0x0b4f('0x46')]));_0x3abc71['attributes']=_0x3abc71[_0x0b4f('0x47')][_0x0b4f('0x57')]?_0x3abc71[_0x0b4f('0x47')]:_0x29c73e[_0x0b4f('0x31')];if(_0x547196[_0x0b4f('0x32')][_0x0b4f('0x58')]){_0x3abc71['include']=[{'all':!![]}];}_0x3abc71=_[_0x0b4f('0x59')]({},_0x3abc71,_0x547196['options']);return db[_0x0b4f('0x2e')][_0x0b4f('0x5a')](_0x3abc71)['then'](handleEntityNotFound(_0x529d1e,null))[_0x0b4f('0x28')](respondWithResult(_0x529d1e,null))['catch'](handleError(_0x529d1e,null));};exports[_0x0b4f('0x5b')]=function(_0x2e1008,_0x40388c){return db['CmHopper'][_0x0b4f('0x5b')](_0x2e1008['body'],{})[_0x0b4f('0x28')](respondWithResult(_0x40388c,0xc9))[_0x0b4f('0x54')](handleError(_0x40388c,null));};exports[_0x0b4f('0x5c')]=function(_0x3f19c7,_0x2cd12a){if(_0x3f19c7[_0x0b4f('0x5d')]['id']){delete _0x3f19c7[_0x0b4f('0x5d')]['id'];}return db[_0x0b4f('0x2e')]['find']({'where':{'id':_0x3f19c7[_0x0b4f('0x55')]['id']}})[_0x0b4f('0x28')](handleEntityNotFound(_0x2cd12a,null))[_0x0b4f('0x28')](saveUpdates(_0x3f19c7[_0x0b4f('0x5d')],null))['then'](respondWithResult(_0x2cd12a,null))[_0x0b4f('0x54')](handleError(_0x2cd12a,null));};exports[_0x0b4f('0x5e')]=function(_0x2e006c,_0x581a2e){return db[_0x0b4f('0x2e')][_0x0b4f('0x5e')]()[_0x0b4f('0x28')](respondWithResult(_0x581a2e,null))[_0x0b4f('0x54')](handleError(_0x581a2e,null));};exports['destroy']=function(_0x30d700,_0x457ef5){var _0x20f933;return db[_0x0b4f('0x2e')][_0x0b4f('0x5a')]({'where':{'id':_0x30d700['params']['id']}})[_0x0b4f('0x28')](handleEntityNotFound(_0x457ef5,null))[_0x0b4f('0x28')](function(_0x58533a){if(_0x58533a){return _0x58533a['destroy']()[_0x0b4f('0x28')](function(_0x50a696){return _0x50a696;});}})['then'](function(_0x40acea){_0x20f933=_0x40acea;if(_0x40acea){if(_0x40acea[_0x0b4f('0x5f')]||_0x40acea[_0x0b4f('0x60')]){return db[_0x40acea[_0x0b4f('0x5f')]?_0x0b4f('0x61'):'Campaign'][_0x0b4f('0x5a')]({'where':{'id':_0x40acea[_0x0b4f('0x5f')]?_0x40acea[_0x0b4f('0x5f')]:_0x40acea[_0x0b4f('0x60')]},'attributes':['id',_0x0b4f('0x2a')],'raw':!![]});}}})[_0x0b4f('0x28')](function(_0x38eefa){var _0x1c5d3c={};if(_0x38eefa){_['merge'](_0x1c5d3c,_[_0x0b4f('0x62')](_0x20f933['dataValues'],[_0x0b4f('0x63'),_0x0b4f('0x64'),'id']));_0x1c5d3c[_0x0b4f('0x65')]=0x15;_0x1c5d3c['statedesc']=_0x0b4f('0x66');_0x1c5d3c[_0x0b4f('0x67')]=_0x38eefa[_0x0b4f('0x2a')];_0x1c5d3c[_0x0b4f('0x68')]=_0x30d700[_0x0b4f('0x69')]['name'];_0x1c5d3c[_0x0b4f('0x6a')]=_0x30d700[_0x0b4f('0x69')]['id'];_0x1c5d3c['deleted']=!![];_0x1c5d3c[_0x0b4f('0x6b')]=moment()[_0x0b4f('0x6c')](_0x0b4f('0x6d'));_0x1c5d3c[_0x0b4f('0x6e')]=_0x20f933[_0x0b4f('0x6f')];_0x1c5d3c['campaigntype']=_0x20f933[_0x0b4f('0x5f')]?_0x0b4f('0x70'):_0x0b4f('0x71');return db['CmContact'][_0x0b4f('0x5a')]({'where':{'id':_0x1c5d3c[_0x0b4f('0x72')]},'attributes':[_0x0b4f('0x73'),'lastName']})[_0x0b4f('0x28')](function(_0x4d3a58){if(!_[_0x0b4f('0x74')](_0x457ef5)&&!_[_0x0b4f('0x74')](_0x4d3a58[_0x0b4f('0x73')])){_0x1c5d3c[_0x0b4f('0x75')]=_0x4d3a58[_0x0b4f('0x73')];if(!_[_0x0b4f('0x74')](_0x4d3a58[_0x0b4f('0x76')])){_0x1c5d3c['calleridname']+='\x20'+_0x4d3a58[_0x0b4f('0x76')];}}})[_0x0b4f('0x77')](function(){return db['CmHopperFinal'][_0x0b4f('0x5b')](_0x1c5d3c);});}})[_0x0b4f('0x28')](function(){return _0x457ef5[_0x0b4f('0x1e')](0xcc)[_0x0b4f('0x1f')]();})[_0x0b4f('0x54')](handleError(_0x457ef5,null));};exports[_0x0b4f('0x78')]=function(_0x24220a,_0x5abd61,_0x167f47){var _0x4a6b50=[];return db[_0x0b4f('0x79')]['describe']()[_0x0b4f('0x28')](function(_0x14b8e7){_0x4a6b50=_[_0x0b4f('0x56')](_0x14b8e7);return _0x24220a[_0x0b4f('0x69')]['getVoiceQueues']({'where':{'type':_0x0b4f('0x7a'),'dialActive':!![],'dialMethod':_0x0b4f('0x7b')},'attributes':['id',_0x0b4f('0x7c')],'raw':!![]});})[_0x0b4f('0x28')](function(_0x37bf66){if(_0x37bf66&&_0x37bf66['length']){return db[_0x0b4f('0x7d')]['transaction'](function(_0xdaab2b){var _0x16abef={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x0b4f('0x6c')](_0x0b4f('0x6d'))},'VoiceQueueId':{'$in':_[_0x0b4f('0x2d')](_0x37bf66,'id')},'$or':[{'UserId':null},{'UserId':_0x24220a['user']['id']}]};var _0x3d8d1e=[];if(_0x24220a[_0x0b4f('0x5d')][_0x0b4f('0x7e')]&&_0x24220a[_0x0b4f('0x5d')][_0x0b4f('0x7e')]===_0x0b4f('0x7f')){if(!_[_0x0b4f('0x80')](_0x24220a[_0x0b4f('0x5d')]['hopperIds'])){_0x16abef['id']={'$in':_0x24220a[_0x0b4f('0x5d')][_0x0b4f('0x81')]};}_0x3d8d1e=[['priority',_0x0b4f('0x82')],['scheduledAt',_0x37bf66[0x0]['dialOrderByScheduledAt']==='ASC'?'DESC':_0x0b4f('0x82')],db['sequelize']['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x0b4f('0x83')]];}else{if(!_[_0x0b4f('0x80')](_0x24220a[_0x0b4f('0x5d')][_0x0b4f('0x81')])){_0x16abef['id']={'$notIn':_0x24220a[_0x0b4f('0x5d')][_0x0b4f('0x81')]};}_0x3d8d1e=[[_0x0b4f('0x84'),'DESC'],[_0x0b4f('0x85'),_0x37bf66[0x0][_0x0b4f('0x7c')]],db[_0x0b4f('0x7d')][_0x0b4f('0x86')](_0x0b4f('0x87')),['id',_0x0b4f('0x82')]];}return db[_0x0b4f('0x2e')]['findOne']({'attributes':['id','scheduledat'],'where':_0x16abef,'order':_0x3d8d1e,'transaction':_0xdaab2b,'lock':_0xdaab2b[_0x0b4f('0x88')][_0x0b4f('0x89')],'include':[{'model':db[_0x0b4f('0x79')],'as':_0x0b4f('0x8a'),'attributes':_0x4a6b50,'include':[{'model':db[_0x0b4f('0x8b')],'as':_0x0b4f('0x8c'),'attributes':['id',_0x0b4f('0x2a')]}]},{'model':db[_0x0b4f('0x8d')],'as':_0x0b4f('0x8e'),'attributes':['id','name']},{'model':db[_0x0b4f('0x61')],'as':_0x0b4f('0x8f'),'attributes':['id',_0x0b4f('0x2a'),_0x0b4f('0x90')]}]})[_0x0b4f('0x28')](function(_0x349541){if(_0x349541){return _0x349541['update']({'UserId':_0x24220a[_0x0b4f('0x69')]['id']},{'transaction':_0xdaab2b});}});});}})[_0x0b4f('0x28')](handleEntityNotFound(_0x5abd61,null))[_0x0b4f('0x28')](respondWithResult(_0x5abd61,null))[_0x0b4f('0x54')](handleError(_0x5abd61,null));};exports[_0x0b4f('0x91')]=function(_0x200cdc,_0x4f8ffd,_0x2fc7f1){return _0x200cdc[_0x0b4f('0x69')][_0x0b4f('0x92')]({'where':{'type':_0x0b4f('0x7a'),'dialActive':!![],'dialMethod':_0x0b4f('0x7b')},'attributes':['id'],'raw':!![]})['then'](function(_0x2f817b){if(_0x2f817b&&_0x2f817b[_0x0b4f('0x57')]){return db['CmHopper'][_0x0b4f('0x23')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x0b4f('0x6c')](_0x0b4f('0x6d'))},'VoiceQueueId':{'$in':_[_0x0b4f('0x2d')](_0x2f817b,'id')},'$or':[{'UserId':null},{'UserId':_0x200cdc[_0x0b4f('0x69')]['id']}]}});}return 0x0;})[_0x0b4f('0x28')](function(_0x1eb540){if(!_[_0x0b4f('0x74')](_0x1eb540)&&_[_0x0b4f('0x93')](_0x1eb540)){return _0x4f8ffd[_0x0b4f('0x1e')](0xc8)[_0x0b4f('0x20')]({'contacts':_0x1eb540});}else{logger['error'](_0x0b4f('0x94'),_0x0b4f('0x91'),0x194,_0x0b4f('0x95'));_0x4f8ffd[_0x0b4f('0x1d')](0x194);}})[_0x0b4f('0x54')](handleError(_0x4f8ffd,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 3c68669..73517f3 100644 --- a/server/api/cmHopper/cmHopper.model.js +++ b/server/api/cmHopper/cmHopper.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba34=['priority','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./cmHopper.attributes','exports','define','cm_hopper','scheduledat','phone'];(function(_0x1f78cb,_0x58e9f3){var _0x2cf6b8=function(_0x5c753c){while(--_0x5c753c){_0x1f78cb['push'](_0x1f78cb['shift']());}};_0x2cf6b8(++_0x58e9f3);}(_0xba34,0x119));var _0x4ba3=function(_0x185f1c,_0x28a000){_0x185f1c=_0x185f1c-0x0;var _0x4e5782=_0xba34[_0x185f1c];return _0x4e5782;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));module[_0x4ba3('0x8')]=function(_0x3590a1,_0xb88621){return _0x3590a1[_0x4ba3('0x9')]('CmHopper',attributes,{'tableName':_0x4ba3('0xa'),'paranoid':![],'indexes':[{'name':_0x4ba3('0xb'),'fields':[_0x4ba3('0xb')]},{'name':_0x4ba3('0xc'),'fields':[_0x4ba3('0xc')]},{'name':_0x4ba3('0xd'),'fields':[_0x4ba3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5d17=['define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x4973a0,_0x2c2ab2){var _0x36c658=function(_0x4cc43d){while(--_0x4cc43d){_0x4973a0['push'](_0x4973a0['shift']());}};_0x36c658(++_0x2c2ab2);}(_0x5d17,0x114));var _0x75d1=function(_0x525864,_0x1bb3ea){_0x525864=_0x525864-0x0;var _0x4f9964=_0x5d17[_0x525864];return _0x4f9964;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x75d1('0x2'));var BPromise=require(_0x75d1('0x3'));var rp=require(_0x75d1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var attributes=require(_0x75d1('0x7'));module[_0x75d1('0x8')]=function(_0x56ac0a,_0x458681){return _0x56ac0a[_0x75d1('0x9')](_0x75d1('0xa'),attributes,{'tableName':_0x75d1('0xb'),'paranoid':![],'indexes':[{'name':_0x75d1('0xc'),'fields':[_0x75d1('0xc')]},{'name':_0x75d1('0xd'),'fields':['phone']},{'name':'priority','fields':[_0x75d1('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 64e6d90..c48e3d4 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 _0xe454=['contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','message','catch','CmHopper','findAll','options','raw','attributes','limit','include','model','map','GetCmHopper','stringify','ShowCmHopper','find','where','create','body','CreateCmHopper','UpdateCmHopper','update','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','name','length','push','includes','all','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null'];(function(_0x379063,_0x297197){var _0x4207e4=function(_0x290dae){while(--_0x290dae){_0x379063['push'](_0x379063['shift']());}};_0x4207e4(++_0x297197);}(_0xe454,0x89));var _0x4e45=function(_0x2b7f35,_0x8f0c9a){_0x2b7f35=_0x2b7f35-0x0;var _0x17f51b=_0xe454[_0x2b7f35];return _0x17f51b;};'use strict';var _=require(_0x4e45('0x0'));var util=require(_0x4e45('0x1'));var moment=require(_0x4e45('0x2'));var BPromise=require(_0x4e45('0x3'));var rs=require(_0x4e45('0x4'));var fs=require('fs');var Redis=require(_0x4e45('0x5'));var db=require(_0x4e45('0x6'))['db'];var utils=require(_0x4e45('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4e45('0x8')][_0x4e45('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ceb15,_0x383386,_0xf796e3){return new BPromise(function(_0x4c2556,_0x6c6a36){return client[_0x4e45('0xa')](_0x1ceb15,_0xf796e3)[_0x4e45('0xb')](function(_0x4cf0d1){logger[_0x4e45('0xc')](_0x4e45('0xd'),_0x383386,_0x4e45('0xe'));logger[_0x4e45('0xf')](_0x4e45('0x10'),_0x383386,_0x4e45('0xe'),JSON['stringify'](_0x4cf0d1));if(_0x4cf0d1['error']){if(_0x4cf0d1[_0x4e45('0x11')]['code']===0x1f4){logger[_0x4e45('0x11')](_0x4e45('0xd'),_0x383386,_0x4cf0d1[_0x4e45('0x11')][_0x4e45('0x12')]);return _0x6c6a36(_0x4cf0d1[_0x4e45('0x11')][_0x4e45('0x12')]);}logger[_0x4e45('0x11')]('CmHopper,\x20%s,\x20%s',_0x383386,_0x4cf0d1[_0x4e45('0x11')][_0x4e45('0x12')]);return _0x4c2556(_0x4cf0d1[_0x4e45('0x11')][_0x4e45('0x12')]);}else{logger['info'](_0x4e45('0xd'),_0x383386,'request\x20sent');_0x4c2556(_0x4cf0d1['result']['message']);}})[_0x4e45('0x13')](function(_0x1299ee){logger[_0x4e45('0x11')](_0x4e45('0xd'),_0x383386,_0x1299ee);_0x6c6a36(_0x1299ee);});});}exports['GetCmHopper']=function(_0x345b99){var _0x344dc6=this;return new Promise(function(_0x502e06,_0x2921ce){return db[_0x4e45('0x14')][_0x4e45('0x15')]({'raw':_0x345b99[_0x4e45('0x16')]?_0x345b99[_0x4e45('0x16')][_0x4e45('0x17')]===undefined?!![]:![]:!![],'where':_0x345b99['options']?_0x345b99['options']['where']||null:null,'attributes':_0x345b99['options']?_0x345b99[_0x4e45('0x16')][_0x4e45('0x18')]||null:null,'limit':_0x345b99[_0x4e45('0x16')]?_0x345b99['options'][_0x4e45('0x19')]||null:null,'include':_0x345b99[_0x4e45('0x16')]?_0x345b99['options'][_0x4e45('0x1a')]?_['map'](_0x345b99[_0x4e45('0x16')][_0x4e45('0x1a')],function(_0x3cdc83){return{'model':db[_0x3cdc83[_0x4e45('0x1b')]],'as':_0x3cdc83['as'],'attributes':_0x3cdc83[_0x4e45('0x18')],'include':_0x3cdc83[_0x4e45('0x1a')]?_[_0x4e45('0x1c')](_0x3cdc83[_0x4e45('0x1a')],function(_0x5738e6){return{'model':db[_0x5738e6['model']],'as':_0x5738e6['as'],'attributes':_0x5738e6[_0x4e45('0x18')],'include':_0x5738e6[_0x4e45('0x1a')]?_[_0x4e45('0x1c')](_0x5738e6[_0x4e45('0x1a')],function(_0x196539){return{'model':db[_0x196539[_0x4e45('0x1b')]],'as':_0x196539['as'],'attributes':_0x196539[_0x4e45('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4e45('0xb')](function(_0x5f3b39){logger['info'](_0x4e45('0x1d'),_0x345b99);logger[_0x4e45('0xf')](_0x4e45('0x1d'),_0x345b99,JSON[_0x4e45('0x1e')](_0x5f3b39));_0x502e06(_0x5f3b39);})[_0x4e45('0x13')](function(_0x9442b3){logger[_0x4e45('0x11')](_0x4e45('0x1d'),_0x9442b3[_0x4e45('0x12')],_0x345b99);_0x2921ce(_0x344dc6[_0x4e45('0x11')](0x1f4,_0x9442b3[_0x4e45('0x12')]));});});};exports[_0x4e45('0x1f')]=function(_0x3cbe80){var _0x3fdbaa=this;return new Promise(function(_0x25608d,_0x386af0){return db[_0x4e45('0x14')][_0x4e45('0x20')]({'raw':_0x3cbe80[_0x4e45('0x16')]?_0x3cbe80[_0x4e45('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3cbe80[_0x4e45('0x16')]?_0x3cbe80[_0x4e45('0x16')][_0x4e45('0x21')]||null:null,'attributes':_0x3cbe80['options']?_0x3cbe80[_0x4e45('0x16')][_0x4e45('0x18')]||null:null,'include':_0x3cbe80[_0x4e45('0x16')]?_0x3cbe80[_0x4e45('0x16')]['include']?_[_0x4e45('0x1c')](_0x3cbe80['options'][_0x4e45('0x1a')],function(_0x1119f1){return{'model':db[_0x1119f1[_0x4e45('0x1b')]],'as':_0x1119f1['as'],'attributes':_0x1119f1[_0x4e45('0x18')],'include':_0x1119f1[_0x4e45('0x1a')]?_['map'](_0x1119f1['include'],function(_0x2b0962){return{'model':db[_0x2b0962[_0x4e45('0x1b')]],'as':_0x2b0962['as'],'attributes':_0x2b0962[_0x4e45('0x18')],'include':_0x2b0962['include']?_[_0x4e45('0x1c')](_0x2b0962[_0x4e45('0x1a')],function(_0x3ac1b9){return{'model':db[_0x3ac1b9[_0x4e45('0x1b')]],'as':_0x3ac1b9['as'],'attributes':_0x3ac1b9[_0x4e45('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4e45('0xb')](function(_0xc72cdb){logger[_0x4e45('0xc')]('ShowCmHopper',_0x3cbe80);logger[_0x4e45('0xf')]('ShowCmHopper',_0x3cbe80,JSON['stringify'](_0xc72cdb));_0x25608d(_0xc72cdb);})[_0x4e45('0x13')](function(_0x36be1c){logger[_0x4e45('0x11')]('ShowCmHopper',_0x36be1c[_0x4e45('0x12')],_0x3cbe80);_0x386af0(_0x3fdbaa[_0x4e45('0x11')](0x1f4,_0x36be1c[_0x4e45('0x12')]));});});};exports['CreateCmHopper']=function(_0x183c25){var _0x3746ec=this;return new Promise(function(_0x4baf88,_0x185327){return db['CmHopper'][_0x4e45('0x22')](_0x183c25[_0x4e45('0x23')],{'raw':_0x183c25[_0x4e45('0x16')]?_0x183c25[_0x4e45('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x4e45('0xb')](function(_0x3cdca2){logger['info'](_0x4e45('0x24'),_0x183c25);logger[_0x4e45('0xf')]('CreateCmHopper',_0x183c25,JSON[_0x4e45('0x1e')](_0x3cdca2));_0x4baf88(_0x3cdca2);})[_0x4e45('0x13')](function(_0x198173){logger[_0x4e45('0x11')](_0x4e45('0x24'),_0x198173[_0x4e45('0x12')],_0x183c25);_0x185327(_0x3746ec[_0x4e45('0x11')](0x1f4,_0x198173[_0x4e45('0x12')]));});});};exports[_0x4e45('0x25')]=function(_0x4215b4){var _0x3e060d=this;return new Promise(function(_0xc8b429,_0x420ab6){return db[_0x4e45('0x14')][_0x4e45('0x26')](_0x4215b4[_0x4e45('0x23')],{'raw':_0x4215b4[_0x4e45('0x16')]?_0x4215b4[_0x4e45('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4215b4[_0x4e45('0x16')]?_0x4215b4[_0x4e45('0x16')]['where']||null:null,'attributes':_0x4215b4[_0x4e45('0x16')]?_0x4215b4[_0x4e45('0x16')][_0x4e45('0x18')]||null:null,'limit':_0x4215b4[_0x4e45('0x16')]?_0x4215b4[_0x4e45('0x16')][_0x4e45('0x19')]||null:null})[_0x4e45('0xb')](function(_0x3d99e6){logger[_0x4e45('0xc')](_0x4e45('0x25'),_0x4215b4);logger[_0x4e45('0xf')](_0x4e45('0x25'),_0x4215b4,JSON[_0x4e45('0x1e')](_0x3d99e6));_0xc8b429(_0x3d99e6);})[_0x4e45('0x13')](function(_0x819201){logger['error'](_0x4e45('0x25'),_0x819201[_0x4e45('0x12')],_0x4215b4);_0x420ab6(_0x3e060d[_0x4e45('0x11')](0x1f4,_0x819201[_0x4e45('0x12')]));});});};exports['DestroyCmHopper']=function(_0x3c1d99){var _0x24e797=this;return new Promise(function(_0x310210,_0x1ad112){return db[_0x4e45('0x14')][_0x4e45('0x27')]({'where':_0x3c1d99[_0x4e45('0x16')]?_0x3c1d99[_0x4e45('0x16')]['where']||null:null})[_0x4e45('0xb')](function(_0x541217){logger[_0x4e45('0xc')](_0x4e45('0x28'),_0x3c1d99);logger[_0x4e45('0xf')]('DestroyCmHopper',_0x3c1d99,JSON[_0x4e45('0x1e')](_0x541217));_0x310210(_0x541217);})['catch'](function(_0x3c84b8){logger[_0x4e45('0x11')]('DestroyCmHopper',_0x3c84b8[_0x4e45('0x12')],_0x3c1d99);_0x1ad112(_0x24e797[_0x4e45('0x11')](0x1f4,_0x3c84b8[_0x4e45('0x12')]));});});};exports[_0x4e45('0x29')]=function(_0x25464f){var _0x5eeff1=this;return new Promise(function(_0x2b0550,_0x425be7){return db[_0x4e45('0x2a')][_0x4e45('0x2b')]()[_0x4e45('0xb')](function(_0x2ecdfb){return db[_0x4e45('0x2c')][_0x4e45('0x2d')](function(_0x59fa49){return db[_0x4e45('0x14')]['findAll']({'where':_0x25464f['options']?_0x25464f[_0x4e45('0x16')][_0x4e45('0x21')]||null:null,'attributes':_0x25464f['options']?_0x25464f[_0x4e45('0x16')][_0x4e45('0x18')]||null:null,'limit':_0x25464f[_0x4e45('0x16')]?_0x25464f[_0x4e45('0x16')]['limit']||null:null,'order':_0x25464f['options']?_0x25464f[_0x4e45('0x16')][_0x4e45('0x2e')]||null:null,'transaction':_0x59fa49,'lock':_0x59fa49[_0x4e45('0x2f')][_0x4e45('0x30')],'include':[{'model':db[_0x4e45('0x2a')],'as':_0x4e45('0x31'),'attributes':_[_0x4e45('0x32')](_0x2ecdfb)},{'model':db['User'],'as':'Agent','attributes':['id',_0x4e45('0x33'),'voicePause']}]})[_0x4e45('0xb')](function(_0x889ec6){var _0x4cb614=[];var _0x1744ea=[];for(var _0x3f4947=0x0;_0x3f4947<_0x889ec6[_0x4e45('0x34')];_0x3f4947+=0x1){var _0x2c2471=_0x889ec6[_0x3f4947]['UserId'];if(_0x2c2471===null){_0x4cb614[_0x4e45('0x35')](_0x889ec6[_0x3f4947][_0x4e45('0x26')](_0x25464f[_0x4e45('0x23')],{'transaction':_0x59fa49}));}else if(!_0x1744ea[_0x4e45('0x36')](_0x2c2471)){_0x1744ea[_0x4e45('0x35')](_0x2c2471);_0x4cb614[_0x4e45('0x35')](_0x889ec6[_0x3f4947]['update'](_0x25464f[_0x4e45('0x23')],{'transaction':_0x59fa49}));}}return BPromise[_0x4e45('0x37')](_0x4cb614);});})[_0x4e45('0xb')](function(_0x51b1e5){logger['info'](_0x4e45('0x29'),_0x25464f);logger[_0x4e45('0xf')](_0x4e45('0x29'),_0x25464f,JSON[_0x4e45('0x1e')](_0x51b1e5));_0x2b0550(_0x51b1e5);})[_0x4e45('0x13')](function(_0x16df25){logger[_0x4e45('0x11')]('GetContactDialer',_0x16df25[_0x4e45('0x12')],_0x25464f);_0x425be7(_0x5eeff1[_0x4e45('0x11')](0x1f4,_0x16df25['message']));});});});};exports[_0x4e45('0x38')]=function(_0x540604){var _0xda9158=this;return new Promise(function(_0x411d51,_0x311b67){return db[_0x4e45('0x2c')][_0x4e45('0x2d')](function(_0x296f30){return db[_0x4e45('0x39')]['create'](_0x540604[_0x4e45('0x23')],{'raw':_0x540604[_0x4e45('0x16')]?_0x540604['options'][_0x4e45('0x17')]===undefined?!![]:![]:!![],'transaction':_0x296f30})[_0x4e45('0xb')](function(){return db['CmHopper'][_0x4e45('0x27')]({'where':_0x540604[_0x4e45('0x16')]?_0x540604['options'][_0x4e45('0x21')]||null:null,'transaction':_0x296f30});});})['then'](function(_0x10982e){logger['info'](_0x4e45('0x38'),_0x540604);logger[_0x4e45('0xf')]('MoveContactManagedDialer',_0x540604,JSON[_0x4e45('0x1e')](_0x10982e));_0x411d51(_0x10982e);})[_0x4e45('0x13')](function(_0x460fb9){logger[_0x4e45('0x11')](_0x4e45('0x38'),_0x460fb9[_0x4e45('0x12')],_0x540604);_0x311b67(_0xda9158['error'](0x1f4,_0x460fb9[_0x4e45('0x12')]));});});};exports[_0x4e45('0x3a')]=function(_0x52c73e){var _0x534f62=this;return new Promise(function(_0xa6e9b,_0x2859dd){return db['CmHopper'][_0x4e45('0x15')]({'raw':_0x52c73e[_0x4e45('0x16')]?_0x52c73e[_0x4e45('0x16')][_0x4e45('0x17')]===undefined?!![]:![]:!![],'where':_0x52c73e['options']?_0x52c73e[_0x4e45('0x16')][_0x4e45('0x21')]||null:null,'attributes':[[db[_0x4e45('0x2c')]['fn'](_0x4e45('0x3b'),db[_0x4e45('0x2c')]['fn']('IF',db[_0x4e45('0x2c')]['literal'](_0x4e45('0x3c')+util[_0x4e45('0x3d')](_0x4e45('0x3e'),moment()[_0x4e45('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x4e45('0x3f')))),_0x4e45('0x40')]]})[_0x4e45('0xb')](function(_0x1cbfa4){logger[_0x4e45('0xc')](_0x4e45('0x3a'),_0x52c73e);logger[_0x4e45('0xf')](_0x4e45('0x3a'),_0x52c73e,JSON[_0x4e45('0x1e')](_0x1cbfa4));_0xa6e9b(_0x1cbfa4);})[_0x4e45('0x13')](function(_0x12fb6f){logger[_0x4e45('0x11')]('CountReScheduled',_0x12fb6f['message'],_0x52c73e);_0x2859dd(_0x534f62[_0x4e45('0x11')](0x1f4,_0x12fb6f['message']));});});};exports[_0x4e45('0x41')]=function(_0x530afa){var _0x47c40a=this;return new Promise(function(_0x4765a4,_0x1305b3){return db[_0x4e45('0x2a')][_0x4e45('0x2b')]()[_0x4e45('0xb')](function(_0x56aa9e){return db[_0x4e45('0x2c')][_0x4e45('0x2d')](function(_0xde495d){return db[_0x4e45('0x14')][_0x4e45('0x15')]({'where':_0x530afa[_0x4e45('0x16')]?_0x530afa[_0x4e45('0x16')][_0x4e45('0x21')]||null:null,'attributes':_0x530afa[_0x4e45('0x16')]?_0x530afa['options'][_0x4e45('0x18')]||null:null,'limit':0x1,'order':_0x530afa[_0x4e45('0x16')]?_0x530afa['options']['order']||null:null,'group':db[_0x4e45('0x14')]['UserId'],'transaction':_0xde495d,'lock':_0xde495d[_0x4e45('0x2f')][_0x4e45('0x30')],'include':_0x530afa['options']?_0x530afa[_0x4e45('0x16')][_0x4e45('0x1a')]?_[_0x4e45('0x1c')](_0x530afa[_0x4e45('0x16')][_0x4e45('0x1a')],function(_0x2095d5){return{'model':db[_0x2095d5[_0x4e45('0x1b')]],'as':_0x2095d5['as'],'attributes':_0x2095d5['attributes'],'include':_0x2095d5[_0x4e45('0x1a')]?_[_0x4e45('0x1c')](_0x2095d5[_0x4e45('0x1a')],function(_0xc07929){return{'model':db[_0xc07929[_0x4e45('0x1b')]],'as':_0xc07929['as'],'attributes':_0xc07929[_0x4e45('0x18')],'include':_0xc07929['include']?_[_0x4e45('0x1c')](_0xc07929['include'],function(_0x560157){return{'model':db[_0x560157[_0x4e45('0x1b')]],'as':_0x560157['as'],'attributes':_0x560157['attributes']};}):[]};}):[]};}):[]:[]})[_0x4e45('0xb')](function(_0xe67a93){var _0x5e46d8=[];for(var _0xff2a97=0x0;_0xff2a97<_0xe67a93[_0x4e45('0x34')];_0xff2a97+=0x1){_0x5e46d8['push'](_0xe67a93[_0xff2a97][_0x4e45('0x26')](_0x530afa['body'],{'transaction':_0xde495d}));}return BPromise[_0x4e45('0x37')](_0x5e46d8);});})[_0x4e45('0xb')](function(_0x1d2dc0){logger['info'](_0x4e45('0x41'),_0x530afa);logger['debug'](_0x4e45('0x41'),_0x530afa,JSON[_0x4e45('0x1e')](_0x1d2dc0));_0x4765a4(_0x1d2dc0);})[_0x4e45('0x13')](function(_0x21cff6){logger[_0x4e45('0x11')]('GetContactRecallMe',_0x21cff6['message'],_0x530afa);_0x1305b3(_0x47c40a[_0x4e45('0x11')](0x1f4,_0x21cff6[_0x4e45('0x12')]));});});});};exports[_0x4e45('0x42')]=function(_0x4b2219){var _0x2b1923=this;return new Promise(function(_0x316456,_0x3cded8){db['CmContact'][_0x4e45('0x2b')]()[_0x4e45('0xb')](function(_0x1ecc10){return db[_0x4e45('0x14')][_0x4e45('0x15')]({'raw':_0x4b2219[_0x4e45('0x16')]?_0x4b2219[_0x4e45('0x16')][_0x4e45('0x17')]===undefined?!![]:![]:!![],'where':_0x4b2219['options']?_0x4b2219[_0x4e45('0x16')][_0x4e45('0x21')]||null:null,'attributes':_0x4b2219[_0x4e45('0x16')]?_0x4b2219[_0x4e45('0x16')][_0x4e45('0x18')]||null:null,'limit':_0x4b2219[_0x4e45('0x16')]?_0x4b2219['options'][_0x4e45('0x19')]||null:null,'include':_0x4b2219['options']?_0x4b2219['options'][_0x4e45('0x1a')]?_['map'](_0x4b2219[_0x4e45('0x16')][_0x4e45('0x1a')],function(_0xd109b0){return{'model':db[_0xd109b0[_0x4e45('0x1b')]],'as':_0xd109b0['as'],'attributes':_0xd109b0['as']===_0x4e45('0x31')?_[_0x4e45('0x32')](_0x1ecc10):_0xd109b0['attributes'],'include':_0xd109b0[_0x4e45('0x1a')]?_[_0x4e45('0x1c')](_0xd109b0[_0x4e45('0x1a')],function(_0x5e3af3){return{'model':db[_0x5e3af3[_0x4e45('0x1b')]],'as':_0x5e3af3['as'],'attributes':_0x5e3af3[_0x4e45('0x18')],'include':_0x5e3af3['include']?_[_0x4e45('0x1c')](_0x5e3af3['include'],function(_0x49cba6){return{'model':db[_0x49cba6[_0x4e45('0x1b')]],'as':_0x49cba6['as'],'attributes':_0x49cba6[_0x4e45('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4e45('0xb')](function(_0x46c94b){logger[_0x4e45('0xc')]('GetCmHopper',_0x4b2219);logger[_0x4e45('0xf')](_0x4e45('0x1d'),_0x4b2219,JSON[_0x4e45('0x1e')](_0x46c94b));_0x316456(_0x46c94b);})[_0x4e45('0x13')](function(_0x24f902){logger[_0x4e45('0x11')](_0x4e45('0x1d'),_0x24f902[_0x4e45('0x12')],_0x4b2219);_0x3cded8(_0x2b1923['error'](0x1f4,_0x24f902[_0x4e45('0x12')]));});});});}; \ No newline at end of file +var _0x86c5=['literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','GetCmHopperPreview','util','moment','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopper,\x20%s,\x20%s','debug','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetCmHopper','CmHopper','options','raw','where','attributes','limit','include','map','model','find','ShowCmHopper','create','body','CreateCmHopper','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','findAll','order','LOCK','UPDATE','Contact','keys','User','name','voicePause','length','UserId','push','update','includes','all','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT'];(function(_0x31a6d9,_0xdaf10b){var _0x47d744=function(_0xe8fbad){while(--_0xe8fbad){_0x31a6d9['push'](_0x31a6d9['shift']());}};_0x47d744(++_0xdaf10b);}(_0x86c5,0x1f2));var _0x586c=function(_0x3a0bcf,_0xe7c01b){_0x3a0bcf=_0x3a0bcf-0x0;var _0x1fe18c=_0x86c5[_0x3a0bcf];return _0x1fe18c;};'use strict';var _=require('lodash');var util=require(_0x586c('0x0'));var moment=require(_0x586c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x586c('0x2'))(_0x586c('0x3'));var config=require(_0x586c('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x586c('0x5')][_0x586c('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x6de6f6,_0x559375,_0xfd404b){return new BPromise(function(_0x600376,_0x53ff87){return client[_0x586c('0x7')](_0x6de6f6,_0xfd404b)[_0x586c('0x8')](function(_0x2675cd){logger[_0x586c('0x9')](_0x586c('0xa'),_0x559375,'request\x20sent');logger[_0x586c('0xb')](_0x586c('0xc'),_0x559375,_0x586c('0xd'),JSON[_0x586c('0xe')](_0x2675cd));if(_0x2675cd[_0x586c('0xf')]){if(_0x2675cd[_0x586c('0xf')][_0x586c('0x10')]===0x1f4){logger[_0x586c('0xf')](_0x586c('0xa'),_0x559375,_0x2675cd[_0x586c('0xf')][_0x586c('0x11')]);return _0x53ff87(_0x2675cd['error'][_0x586c('0x11')]);}logger[_0x586c('0xf')](_0x586c('0xa'),_0x559375,_0x2675cd['error'][_0x586c('0x11')]);return _0x600376(_0x2675cd[_0x586c('0xf')][_0x586c('0x11')]);}else{logger['info'](_0x586c('0xa'),_0x559375,'request\x20sent');_0x600376(_0x2675cd[_0x586c('0x12')][_0x586c('0x11')]);}})[_0x586c('0x13')](function(_0x4ba2fb){logger[_0x586c('0xf')]('CmHopper,\x20%s,\x20%s',_0x559375,_0x4ba2fb);_0x53ff87(_0x4ba2fb);});});}exports[_0x586c('0x14')]=function(_0x49f8bc){var _0x1af80a=this;return new Promise(function(_0x2b552c,_0x5130b4){return db[_0x586c('0x15')]['findAll']({'raw':_0x49f8bc[_0x586c('0x16')]?_0x49f8bc['options'][_0x586c('0x17')]===undefined?!![]:![]:!![],'where':_0x49f8bc[_0x586c('0x16')]?_0x49f8bc['options'][_0x586c('0x18')]||null:null,'attributes':_0x49f8bc[_0x586c('0x16')]?_0x49f8bc['options'][_0x586c('0x19')]||null:null,'limit':_0x49f8bc[_0x586c('0x16')]?_0x49f8bc['options'][_0x586c('0x1a')]||null:null,'include':_0x49f8bc[_0x586c('0x16')]?_0x49f8bc[_0x586c('0x16')][_0x586c('0x1b')]?_[_0x586c('0x1c')](_0x49f8bc[_0x586c('0x16')]['include'],function(_0x9802b9){return{'model':db[_0x9802b9[_0x586c('0x1d')]],'as':_0x9802b9['as'],'attributes':_0x9802b9[_0x586c('0x19')],'include':_0x9802b9[_0x586c('0x1b')]?_[_0x586c('0x1c')](_0x9802b9[_0x586c('0x1b')],function(_0x51210e){return{'model':db[_0x51210e[_0x586c('0x1d')]],'as':_0x51210e['as'],'attributes':_0x51210e[_0x586c('0x19')],'include':_0x51210e[_0x586c('0x1b')]?_[_0x586c('0x1c')](_0x51210e['include'],function(_0x27aba4){return{'model':db[_0x27aba4[_0x586c('0x1d')]],'as':_0x27aba4['as'],'attributes':_0x27aba4['attributes']};}):[]};}):[]};}):[]:[]})[_0x586c('0x8')](function(_0xef207c){logger[_0x586c('0x9')](_0x586c('0x14'),_0x49f8bc);logger[_0x586c('0xb')]('GetCmHopper',_0x49f8bc,JSON[_0x586c('0xe')](_0xef207c));_0x2b552c(_0xef207c);})[_0x586c('0x13')](function(_0x452780){logger[_0x586c('0xf')](_0x586c('0x14'),_0x452780[_0x586c('0x11')],_0x49f8bc);_0x5130b4(_0x1af80a[_0x586c('0xf')](0x1f4,_0x452780[_0x586c('0x11')]));});});};exports['ShowCmHopper']=function(_0x2df770){var _0x422727=this;return new Promise(function(_0x36ccad,_0x5a55d0){return db[_0x586c('0x15')][_0x586c('0x1e')]({'raw':_0x2df770[_0x586c('0x16')]?_0x2df770['options']['raw']===undefined?!![]:![]:!![],'where':_0x2df770[_0x586c('0x16')]?_0x2df770[_0x586c('0x16')]['where']||null:null,'attributes':_0x2df770[_0x586c('0x16')]?_0x2df770[_0x586c('0x16')]['attributes']||null:null,'include':_0x2df770[_0x586c('0x16')]?_0x2df770[_0x586c('0x16')]['include']?_[_0x586c('0x1c')](_0x2df770['options'][_0x586c('0x1b')],function(_0x340646){return{'model':db[_0x340646[_0x586c('0x1d')]],'as':_0x340646['as'],'attributes':_0x340646[_0x586c('0x19')],'include':_0x340646[_0x586c('0x1b')]?_[_0x586c('0x1c')](_0x340646['include'],function(_0x861700){return{'model':db[_0x861700['model']],'as':_0x861700['as'],'attributes':_0x861700['attributes'],'include':_0x861700[_0x586c('0x1b')]?_['map'](_0x861700['include'],function(_0x9df25c){return{'model':db[_0x9df25c[_0x586c('0x1d')]],'as':_0x9df25c['as'],'attributes':_0x9df25c['attributes']};}):[]};}):[]};}):[]:[]})[_0x586c('0x8')](function(_0x34724b){logger['info'](_0x586c('0x1f'),_0x2df770);logger[_0x586c('0xb')]('ShowCmHopper',_0x2df770,JSON[_0x586c('0xe')](_0x34724b));_0x36ccad(_0x34724b);})['catch'](function(_0x4de07d){logger[_0x586c('0xf')](_0x586c('0x1f'),_0x4de07d[_0x586c('0x11')],_0x2df770);_0x5a55d0(_0x422727[_0x586c('0xf')](0x1f4,_0x4de07d['message']));});});};exports['CreateCmHopper']=function(_0x4966f1){var _0x54c708=this;return new Promise(function(_0x2cb11b,_0xce8c79){return db[_0x586c('0x15')][_0x586c('0x20')](_0x4966f1[_0x586c('0x21')],{'raw':_0x4966f1[_0x586c('0x16')]?_0x4966f1['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1ba477){logger[_0x586c('0x9')](_0x586c('0x22'),_0x4966f1);logger[_0x586c('0xb')](_0x586c('0x22'),_0x4966f1,JSON[_0x586c('0xe')](_0x1ba477));_0x2cb11b(_0x1ba477);})['catch'](function(_0x3acc8c){logger['error']('CreateCmHopper',_0x3acc8c[_0x586c('0x11')],_0x4966f1);_0xce8c79(_0x54c708[_0x586c('0xf')](0x1f4,_0x3acc8c[_0x586c('0x11')]));});});};exports[_0x586c('0x23')]=function(_0xd02644){var _0x3d3b5e=this;return new Promise(function(_0x1cbe39,_0x414422){return db[_0x586c('0x15')]['update'](_0xd02644[_0x586c('0x21')],{'raw':_0xd02644[_0x586c('0x16')]?_0xd02644[_0x586c('0x16')][_0x586c('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd02644['options']?_0xd02644[_0x586c('0x16')][_0x586c('0x18')]||null:null,'attributes':_0xd02644['options']?_0xd02644[_0x586c('0x16')][_0x586c('0x19')]||null:null,'limit':_0xd02644[_0x586c('0x16')]?_0xd02644[_0x586c('0x16')]['limit']||null:null})['then'](function(_0x28ebe4){logger[_0x586c('0x9')](_0x586c('0x23'),_0xd02644);logger[_0x586c('0xb')]('UpdateCmHopper',_0xd02644,JSON[_0x586c('0xe')](_0x28ebe4));_0x1cbe39(_0x28ebe4);})[_0x586c('0x13')](function(_0x297804){logger[_0x586c('0xf')](_0x586c('0x23'),_0x297804[_0x586c('0x11')],_0xd02644);_0x414422(_0x3d3b5e['error'](0x1f4,_0x297804[_0x586c('0x11')]));});});};exports[_0x586c('0x24')]=function(_0x58325b){var _0x5c972c=this;return new Promise(function(_0x2ba68e,_0x148876){return db[_0x586c('0x15')][_0x586c('0x25')]({'where':_0x58325b[_0x586c('0x16')]?_0x58325b['options'][_0x586c('0x18')]||null:null})[_0x586c('0x8')](function(_0x14b52e){logger[_0x586c('0x9')](_0x586c('0x24'),_0x58325b);logger[_0x586c('0xb')](_0x586c('0x24'),_0x58325b,JSON['stringify'](_0x14b52e));_0x2ba68e(_0x14b52e);})[_0x586c('0x13')](function(_0x25f25f){logger[_0x586c('0xf')](_0x586c('0x24'),_0x25f25f[_0x586c('0x11')],_0x58325b);_0x148876(_0x5c972c[_0x586c('0xf')](0x1f4,_0x25f25f[_0x586c('0x11')]));});});};exports[_0x586c('0x26')]=function(_0xfc5642){var _0x289272=this;return new Promise(function(_0xf020c3,_0x171caa){return db[_0x586c('0x27')][_0x586c('0x28')]()[_0x586c('0x8')](function(_0x3c6459){return db[_0x586c('0x29')][_0x586c('0x2a')](function(_0x30948a){return db['CmHopper'][_0x586c('0x2b')]({'where':_0xfc5642['options']?_0xfc5642['options'][_0x586c('0x18')]||null:null,'attributes':_0xfc5642[_0x586c('0x16')]?_0xfc5642[_0x586c('0x16')][_0x586c('0x19')]||null:null,'limit':_0xfc5642[_0x586c('0x16')]?_0xfc5642[_0x586c('0x16')][_0x586c('0x1a')]||null:null,'order':_0xfc5642['options']?_0xfc5642[_0x586c('0x16')][_0x586c('0x2c')]||null:null,'transaction':_0x30948a,'lock':_0x30948a[_0x586c('0x2d')][_0x586c('0x2e')],'include':[{'model':db['CmContact'],'as':_0x586c('0x2f'),'attributes':_[_0x586c('0x30')](_0x3c6459)},{'model':db[_0x586c('0x31')],'as':'Agent','attributes':['id',_0x586c('0x32'),_0x586c('0x33')]}]})[_0x586c('0x8')](function(_0x37dc54){var _0x19a9c8=[];var _0x321c8c=[];for(var _0x322464=0x0;_0x322464<_0x37dc54[_0x586c('0x34')];_0x322464+=0x1){var _0x1a19bb=_0x37dc54[_0x322464][_0x586c('0x35')];if(_0x1a19bb===null){_0x19a9c8[_0x586c('0x36')](_0x37dc54[_0x322464][_0x586c('0x37')](_0xfc5642[_0x586c('0x21')],{'transaction':_0x30948a}));}else if(!_0x321c8c[_0x586c('0x38')](_0x1a19bb)){_0x321c8c[_0x586c('0x36')](_0x1a19bb);_0x19a9c8[_0x586c('0x36')](_0x37dc54[_0x322464][_0x586c('0x37')](_0xfc5642['body'],{'transaction':_0x30948a}));}}return BPromise[_0x586c('0x39')](_0x19a9c8);});})[_0x586c('0x8')](function(_0x566a7f){logger[_0x586c('0x9')](_0x586c('0x26'),_0xfc5642);logger[_0x586c('0xb')]('GetContactDialer',_0xfc5642,JSON[_0x586c('0xe')](_0x566a7f));_0xf020c3(_0x566a7f);})['catch'](function(_0x270aeb){logger[_0x586c('0xf')](_0x586c('0x26'),_0x270aeb[_0x586c('0x11')],_0xfc5642);_0x171caa(_0x289272[_0x586c('0xf')](0x1f4,_0x270aeb[_0x586c('0x11')]));});});});};exports[_0x586c('0x3a')]=function(_0x2dbe28){var _0x172423=this;return new Promise(function(_0x45e354,_0x49ef15){return db['sequelize'][_0x586c('0x2a')](function(_0x4aee06){return db[_0x586c('0x3b')][_0x586c('0x20')](_0x2dbe28['body'],{'raw':_0x2dbe28['options']?_0x2dbe28[_0x586c('0x16')][_0x586c('0x17')]===undefined?!![]:![]:!![],'transaction':_0x4aee06})[_0x586c('0x8')](function(){return db[_0x586c('0x15')][_0x586c('0x25')]({'where':_0x2dbe28[_0x586c('0x16')]?_0x2dbe28[_0x586c('0x16')][_0x586c('0x18')]||null:null,'transaction':_0x4aee06});});})['then'](function(_0x129271){logger['info'](_0x586c('0x3a'),_0x2dbe28);logger[_0x586c('0xb')](_0x586c('0x3a'),_0x2dbe28,JSON[_0x586c('0xe')](_0x129271));_0x45e354(_0x129271);})['catch'](function(_0x3b7ccb){logger[_0x586c('0xf')](_0x586c('0x3a'),_0x3b7ccb['message'],_0x2dbe28);_0x49ef15(_0x172423['error'](0x1f4,_0x3b7ccb['message']));});});};exports[_0x586c('0x3c')]=function(_0x8f613b){var _0x23ab1e=this;return new Promise(function(_0x5e3808,_0x3e27bb){return db['CmHopper'][_0x586c('0x2b')]({'raw':_0x8f613b[_0x586c('0x16')]?_0x8f613b['options'][_0x586c('0x17')]===undefined?!![]:![]:!![],'where':_0x8f613b[_0x586c('0x16')]?_0x8f613b[_0x586c('0x16')][_0x586c('0x18')]||null:null,'attributes':[[db[_0x586c('0x29')]['fn'](_0x586c('0x3d'),db[_0x586c('0x29')]['fn']('IF',db[_0x586c('0x29')][_0x586c('0x3e')](_0x586c('0x3f')+util['format'](_0x586c('0x40'),moment()[_0x586c('0x41')](_0x586c('0x42')))+_0x586c('0x43')))),'contactsRescheduled']]})[_0x586c('0x8')](function(_0x56525d){logger[_0x586c('0x9')](_0x586c('0x3c'),_0x8f613b);logger[_0x586c('0xb')](_0x586c('0x3c'),_0x8f613b,JSON[_0x586c('0xe')](_0x56525d));_0x5e3808(_0x56525d);})[_0x586c('0x13')](function(_0x5c066e){logger[_0x586c('0xf')](_0x586c('0x3c'),_0x5c066e[_0x586c('0x11')],_0x8f613b);_0x3e27bb(_0x23ab1e['error'](0x1f4,_0x5c066e[_0x586c('0x11')]));});});};exports[_0x586c('0x44')]=function(_0x1834c4){var _0x48305f=this;return new Promise(function(_0x212da0,_0xe9e167){return db[_0x586c('0x27')][_0x586c('0x28')]()['then'](function(_0x18bdb4){return db['sequelize']['transaction'](function(_0x56abee){return db[_0x586c('0x15')][_0x586c('0x2b')]({'where':_0x1834c4[_0x586c('0x16')]?_0x1834c4[_0x586c('0x16')]['where']||null:null,'attributes':_0x1834c4[_0x586c('0x16')]?_0x1834c4[_0x586c('0x16')][_0x586c('0x19')]||null:null,'limit':0x1,'order':_0x1834c4[_0x586c('0x16')]?_0x1834c4['options'][_0x586c('0x2c')]||null:null,'group':db[_0x586c('0x15')][_0x586c('0x35')],'transaction':_0x56abee,'lock':_0x56abee[_0x586c('0x2d')][_0x586c('0x2e')],'include':_0x1834c4[_0x586c('0x16')]?_0x1834c4[_0x586c('0x16')][_0x586c('0x1b')]?_['map'](_0x1834c4[_0x586c('0x16')]['include'],function(_0x5162ce){return{'model':db[_0x5162ce[_0x586c('0x1d')]],'as':_0x5162ce['as'],'attributes':_0x5162ce[_0x586c('0x19')],'include':_0x5162ce[_0x586c('0x1b')]?_['map'](_0x5162ce[_0x586c('0x1b')],function(_0x3f54ba){return{'model':db[_0x3f54ba['model']],'as':_0x3f54ba['as'],'attributes':_0x3f54ba['attributes'],'include':_0x3f54ba['include']?_[_0x586c('0x1c')](_0x3f54ba[_0x586c('0x1b')],function(_0x3cf932){return{'model':db[_0x3cf932[_0x586c('0x1d')]],'as':_0x3cf932['as'],'attributes':_0x3cf932[_0x586c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x31ed7a){var _0x1fa548=[];for(var _0x83e883=0x0;_0x83e883<_0x31ed7a[_0x586c('0x34')];_0x83e883+=0x1){_0x1fa548['push'](_0x31ed7a[_0x83e883]['update'](_0x1834c4['body'],{'transaction':_0x56abee}));}return BPromise['all'](_0x1fa548);});})[_0x586c('0x8')](function(_0x19da68){logger[_0x586c('0x9')]('GetContactRecallMe',_0x1834c4);logger['debug']('GetContactRecallMe',_0x1834c4,JSON[_0x586c('0xe')](_0x19da68));_0x212da0(_0x19da68);})[_0x586c('0x13')](function(_0x5c5673){logger[_0x586c('0xf')](_0x586c('0x44'),_0x5c5673['message'],_0x1834c4);_0xe9e167(_0x48305f['error'](0x1f4,_0x5c5673[_0x586c('0x11')]));});});});};exports[_0x586c('0x45')]=function(_0x22d393){var _0x3008bf=this;return new Promise(function(_0x1112ba,_0x22bdca){db[_0x586c('0x27')][_0x586c('0x28')]()[_0x586c('0x8')](function(_0x12f233){return db['CmHopper'][_0x586c('0x2b')]({'raw':_0x22d393[_0x586c('0x16')]?_0x22d393[_0x586c('0x16')][_0x586c('0x17')]===undefined?!![]:![]:!![],'where':_0x22d393[_0x586c('0x16')]?_0x22d393[_0x586c('0x16')][_0x586c('0x18')]||null:null,'attributes':_0x22d393['options']?_0x22d393['options'][_0x586c('0x19')]||null:null,'limit':_0x22d393['options']?_0x22d393[_0x586c('0x16')][_0x586c('0x1a')]||null:null,'include':_0x22d393['options']?_0x22d393[_0x586c('0x16')]['include']?_[_0x586c('0x1c')](_0x22d393[_0x586c('0x16')][_0x586c('0x1b')],function(_0x44855c){return{'model':db[_0x44855c[_0x586c('0x1d')]],'as':_0x44855c['as'],'attributes':_0x44855c['as']==='Contact'?_['keys'](_0x12f233):_0x44855c[_0x586c('0x19')],'include':_0x44855c['include']?_['map'](_0x44855c[_0x586c('0x1b')],function(_0x1a0f78){return{'model':db[_0x1a0f78[_0x586c('0x1d')]],'as':_0x1a0f78['as'],'attributes':_0x1a0f78[_0x586c('0x19')],'include':_0x1a0f78['include']?_[_0x586c('0x1c')](_0x1a0f78[_0x586c('0x1b')],function(_0x390bc9){return{'model':db[_0x390bc9[_0x586c('0x1d')]],'as':_0x390bc9['as'],'attributes':_0x390bc9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a1b36){logger[_0x586c('0x9')](_0x586c('0x14'),_0x22d393);logger['debug'](_0x586c('0x14'),_0x22d393,JSON[_0x586c('0xe')](_0x3a1b36));_0x1112ba(_0x3a1b36);})[_0x586c('0x13')](function(_0x3cfef5){logger['error'](_0x586c('0x14'),_0x3cfef5[_0x586c('0x11')],_0x22d393);_0x22bdca(_0x3008bf['error'](0x1f4,_0x3cfef5[_0x586c('0x11')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 9a1aa2d..71440e6 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 _0xc610=['getOpenContacts','/:id','show','post','create','/preview','getPreview','put','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x51cbc6,_0x56410c){var _0x2dc19c=function(_0x52b71a){while(--_0x52b71a){_0x51cbc6['push'](_0x51cbc6['shift']());}};_0x2dc19c(++_0x56410c);}(_0xc610,0x1c2));var _0x0c61=function(_0x47888a,_0x7d2f3a){_0x47888a=_0x47888a-0x0;var _0x2b15a4=_0xc610[_0x47888a];return _0x2b15a4;};'use strict';var multer=require(_0x0c61('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0c61('0x1')]();var fs_extra=require(_0x0c61('0x2'));var auth=require(_0x0c61('0x3'));var interaction=require(_0x0c61('0x4'));var config=require(_0x0c61('0x5'));var controller=require(_0x0c61('0x6'));router[_0x0c61('0x7')]('/',auth['isAuthenticated'](),controller[_0x0c61('0x8')]);router[_0x0c61('0x7')](_0x0c61('0x9'),auth[_0x0c61('0xa')](),controller[_0x0c61('0xb')]);router['get']('/opencontacts',auth[_0x0c61('0xa')](),controller[_0x0c61('0xc')]);router[_0x0c61('0x7')](_0x0c61('0xd'),auth[_0x0c61('0xa')](),controller[_0x0c61('0xe')]);router[_0x0c61('0xf')]('/',auth[_0x0c61('0xa')](),controller[_0x0c61('0x10')]);router['post'](_0x0c61('0x11'),auth['isAuthenticated'](),controller[_0x0c61('0x12')]);router[_0x0c61('0x13')]('/:id',auth[_0x0c61('0xa')](),controller['update']);router['delete'](_0x0c61('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x0c61('0x14')]=router; \ No newline at end of file +var _0x3115=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/opencontacts','getOpenContacts','/:id','show','post','create','getPreview','put','update','delete','destroy','exports','multer','util'];(function(_0x53168e,_0x22152b){var _0x5959b6=function(_0x5818df){while(--_0x5818df){_0x53168e['push'](_0x53168e['shift']());}};_0x5959b6(++_0x22152b);}(_0x3115,0x140));var _0x5311=function(_0x494e1a,_0x1d92af){_0x494e1a=_0x494e1a-0x0;var _0x153cfd=_0x3115[_0x494e1a];return _0x153cfd;};'use strict';var multer=require(_0x5311('0x0'));var util=require(_0x5311('0x1'));var path=require('path');var timeout=require(_0x5311('0x2'));var express=require('express');var router=express[_0x5311('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5311('0x4'));var interaction=require(_0x5311('0x5'));var config=require(_0x5311('0x6'));var controller=require('./cmHopper.controller');router[_0x5311('0x7')]('/',auth[_0x5311('0x8')](),controller[_0x5311('0x9')]);router[_0x5311('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x5311('0xa')]);router[_0x5311('0x7')](_0x5311('0xb'),auth[_0x5311('0x8')](),controller[_0x5311('0xc')]);router[_0x5311('0x7')](_0x5311('0xd'),auth[_0x5311('0x8')](),controller[_0x5311('0xe')]);router[_0x5311('0xf')]('/',auth[_0x5311('0x8')](),controller[_0x5311('0x10')]);router['post']('/preview',auth[_0x5311('0x8')](),controller[_0x5311('0x11')]);router[_0x5311('0x12')]('/:id',auth[_0x5311('0x8')](),controller[_0x5311('0x13')]);router[_0x5311('0x14')](_0x5311('0xd'),auth[_0x5311('0x8')](),controller[_0x5311('0x15')]);module[_0x5311('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index fefb614..d7562f9 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 _0xc4a6=['exports','STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x10dc64,_0x11bb29){var _0x9cf98d=function(_0x558d71){while(--_0x558d71){_0x10dc64['push'](_0x10dc64['shift']());}};_0x9cf98d(++_0x11bb29);}(_0xc4a6,0x106));var _0x6c4a=function(_0x4242a3,_0x1c7510){_0x4242a3=_0x4242a3-0x0;var _0x5766bb=_0xc4a6[_0x4242a3];return _0x5766bb;};'use strict';var moment=require(_0x6c4a('0x0'));var Sequelize=require(_0x6c4a('0x1'));module[_0x6c4a('0x2')]={'phone':{'type':Sequelize[_0x6c4a('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x6c4a('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x6c4a('0x4')],'unique':_0x6c4a('0x5')},'VoiceQueueId':{'type':Sequelize[_0x6c4a('0x4')],'unique':_0x6c4a('0x5')}}; \ No newline at end of file +var _0xfcf8=['sequelize','exports','STRING','INTEGER','contactListQueue','moment'];(function(_0xc5b1aa,_0x436c79){var _0x4cfe8d=function(_0xac03f5){while(--_0xac03f5){_0xc5b1aa['push'](_0xc5b1aa['shift']());}};_0x4cfe8d(++_0x436c79);}(_0xfcf8,0x8f));var _0x8fcf=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xfcf8[_0x4709c0];return _0x13348b;};'use strict';var moment=require(_0x8fcf('0x0'));var Sequelize=require(_0x8fcf('0x1'));module[_0x8fcf('0x2')]={'phone':{'type':Sequelize[_0x8fcf('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x8fcf('0x4')],'unique':_0x8fcf('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x8fcf('0x5')},'VoiceQueueId':{'type':Sequelize[_0x8fcf('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index c8fc7f4..0ee110e 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 _0xb349=['sort','where','pick','merge','options','includeAll','findAll','rows','catch','params','keys','length','include','find','body','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0xedea6a,_0x23fa84){var _0x3bc2f8=function(_0x2f5644){while(--_0x2f5644){_0xedea6a['push'](_0xedea6a['shift']());}};_0x3bc2f8(++_0x23fa84);}(_0xb349,0x98));var _0x9b34=function(_0x56474a,_0x58bae2){_0x56474a=_0x56474a-0x0;var _0x1edf0c=_0xb349[_0x56474a];return _0x1edf0c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9b34('0x0'));var jsonpatch=require(_0x9b34('0x1'));var rp=require(_0x9b34('0x2'));var moment=require('moment');var BPromise=require(_0x9b34('0x3'));var Mustache=require(_0x9b34('0x4'));var util=require(_0x9b34('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x9b34('0x6'));var ejs=require(_0x9b34('0x7'));var fs=require('fs');var fs_extra=require(_0x9b34('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9b34('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x9b34('0xa'));var toCsv=require(_0x9b34('0x6'));var querystring=require(_0x9b34('0xb'));var Papa=require('papaparse');var Redis=require(_0x9b34('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x9b34('0xd'));var as=require(_0x9b34('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9b34('0xf'))(_0x9b34('0x10'));var utils=require(_0x9b34('0x11'));var config=require(_0x9b34('0x12'));var licenseUtil=require(_0x9b34('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd793b6,_0x3bb819){_0x3bb819=_0x3bb819||0xcc;return function(_0x248fe1){if(_0x248fe1){return _0xd793b6[_0x9b34('0x14')](_0x3bb819);}return _0xd793b6[_0x9b34('0x15')](_0x3bb819)[_0x9b34('0x16')]();};}function respondWithResult(_0x31a0df,_0x104492){_0x104492=_0x104492||0xc8;return function(_0x32cd0c){if(_0x32cd0c){return _0x31a0df['status'](_0x104492)[_0x9b34('0x17')](_0x32cd0c);}};}function respondWithFilteredResult(_0x4e0043,_0x10d56d){return function(_0x5d4a43){if(_0x5d4a43){var _0x1a0cd0=typeof _0x10d56d[_0x9b34('0x18')]==='undefined'&&typeof _0x10d56d[_0x9b34('0x19')]===_0x9b34('0x1a');var _0x2c82eb=_0x5d4a43[_0x9b34('0x1b')];var _0x484b7e=_0x1a0cd0?0x0:_0x10d56d[_0x9b34('0x18')];var _0x5f5cff=_0x1a0cd0?_0x5d4a43['count']:_0x10d56d['offset']+_0x10d56d['limit'];var _0x2597f9;if(_0x5f5cff>=_0x2c82eb){_0x5f5cff=_0x2c82eb;_0x2597f9=0xc8;}else{_0x2597f9=0xce;}_0x4e0043[_0x9b34('0x15')](_0x2597f9);return _0x4e0043[_0x9b34('0x1c')](_0x9b34('0x1d'),_0x484b7e+'-'+_0x5f5cff+'/'+_0x2c82eb)[_0x9b34('0x17')](_0x5d4a43);}return null;};}function patchUpdates(_0x11a3f2){return function(_0x516d23){try{jsonpatch['apply'](_0x516d23,_0x11a3f2,!![]);}catch(_0xd11734){return BPromise[_0x9b34('0x1e')](_0xd11734);}return _0x516d23[_0x9b34('0x1f')]();};}function saveUpdates(_0x53c9f8,_0x38c508){return function(_0x379994){if(_0x379994){return _0x379994[_0x9b34('0x20')](_0x53c9f8)[_0x9b34('0x21')](function(_0x5dc85c){return _0x5dc85c;});}return null;};}function removeEntity(_0x3c50c1,_0x50bc2d){return function(_0xec5e0c){if(_0xec5e0c){return _0xec5e0c[_0x9b34('0x22')]()[_0x9b34('0x21')](function(){_0x3c50c1['status'](0xcc)[_0x9b34('0x16')]();});}};}function handleEntityNotFound(_0x366f55,_0x46c201){return function(_0x3cc0cc){if(!_0x3cc0cc){_0x366f55[_0x9b34('0x14')](0x194);}return _0x3cc0cc;};}function handleError(_0x38ba01,_0x262c03){_0x262c03=_0x262c03||0x1f4;return function(_0x1d5aef){logger[_0x9b34('0x23')](_0x1d5aef[_0x9b34('0x24')]);if(_0x1d5aef[_0x9b34('0x25')]){delete _0x1d5aef[_0x9b34('0x25')];}_0x38ba01[_0x9b34('0x15')](_0x262c03)['send'](_0x1d5aef);};}exports['index']=function(_0x33be9a,_0x5b861c){var _0x4e9826={},_0x2dfa50={},_0x579cc6={'count':0x0,'rows':[]};var _0x1840ee=_[_0x9b34('0x26')](db[_0x9b34('0x27')][_0x9b34('0x28')],function(_0x5ee2ed){return{'name':_0x5ee2ed[_0x9b34('0x29')],'type':_0x5ee2ed[_0x9b34('0x2a')][_0x9b34('0x2b')]};});_0x2dfa50[_0x9b34('0x2c')]=_['map'](_0x1840ee,'name');_0x2dfa50['query']=_['keys'](_0x33be9a[_0x9b34('0x2d')]);_0x2dfa50[_0x9b34('0x2e')]=_[_0x9b34('0x2f')](_0x2dfa50[_0x9b34('0x2c')],_0x2dfa50[_0x9b34('0x2d')]);_0x4e9826[_0x9b34('0x30')]=_[_0x9b34('0x2f')](_0x2dfa50[_0x9b34('0x2c')],qs[_0x9b34('0x31')](_0x33be9a[_0x9b34('0x2d')][_0x9b34('0x31')]));_0x4e9826[_0x9b34('0x30')]=_0x4e9826[_0x9b34('0x30')]['length']?_0x4e9826[_0x9b34('0x30')]:_0x2dfa50[_0x9b34('0x2c')];if(!_0x33be9a[_0x9b34('0x2d')][_0x9b34('0x32')](_0x9b34('0x33'))){_0x4e9826[_0x9b34('0x19')]=qs[_0x9b34('0x19')](_0x33be9a[_0x9b34('0x2d')][_0x9b34('0x19')]);_0x4e9826[_0x9b34('0x18')]=qs[_0x9b34('0x18')](_0x33be9a[_0x9b34('0x2d')][_0x9b34('0x18')]);}_0x4e9826['order']=qs[_0x9b34('0x34')](_0x33be9a['query'][_0x9b34('0x34')]);_0x4e9826[_0x9b34('0x35')]=qs[_0x9b34('0x2e')](_[_0x9b34('0x36')](_0x33be9a[_0x9b34('0x2d')],_0x2dfa50[_0x9b34('0x2e')]),_0x1840ee);if(_0x33be9a[_0x9b34('0x2d')]['filter']){_0x4e9826[_0x9b34('0x35')]=_[_0x9b34('0x37')](_0x4e9826[_0x9b34('0x35')],{'$or':_[_0x9b34('0x26')](_0x1840ee,function(_0x5b4649){if(_0x5b4649['type']!=='VIRTUAL'){var _0x235415={};_0x235415[_0x5b4649[_0x9b34('0x25')]]={'$like':'%'+_0x33be9a['query']['filter']+'%'};return _0x235415;}})});}_0x4e9826=_[_0x9b34('0x37')]({},_0x4e9826,_0x33be9a[_0x9b34('0x38')]);var _0x3cb634={'where':_0x4e9826[_0x9b34('0x35')]};return db['CmHopperBlack'][_0x9b34('0x1b')](_0x3cb634)[_0x9b34('0x21')](function(_0x277977){_0x579cc6[_0x9b34('0x1b')]=_0x277977;if(_0x33be9a[_0x9b34('0x2d')][_0x9b34('0x39')]){_0x4e9826['include']=[{'all':!![]}];}return db[_0x9b34('0x27')][_0x9b34('0x3a')](_0x4e9826);})['then'](function(_0x474cc1){_0x579cc6[_0x9b34('0x3b')]=_0x474cc1;return _0x579cc6;})['then'](respondWithFilteredResult(_0x5b861c,_0x4e9826))[_0x9b34('0x3c')](handleError(_0x5b861c,null));};exports['show']=function(_0xb9410c,_0xbfd57d){var _0x14ddf0={'raw':!![],'where':{'id':_0xb9410c[_0x9b34('0x3d')]['id']}},_0x22fb61={};_0x22fb61[_0x9b34('0x2c')]=_[_0x9b34('0x3e')](db[_0x9b34('0x27')][_0x9b34('0x28')]);_0x22fb61[_0x9b34('0x2d')]=_[_0x9b34('0x3e')](_0xb9410c[_0x9b34('0x2d')]);_0x22fb61[_0x9b34('0x2e')]=_['intersection'](_0x22fb61[_0x9b34('0x2c')],_0x22fb61['query']);_0x14ddf0[_0x9b34('0x30')]=_[_0x9b34('0x2f')](_0x22fb61[_0x9b34('0x2c')],qs[_0x9b34('0x31')](_0xb9410c[_0x9b34('0x2d')][_0x9b34('0x31')]));_0x14ddf0['attributes']=_0x14ddf0['attributes'][_0x9b34('0x3f')]?_0x14ddf0[_0x9b34('0x30')]:_0x22fb61[_0x9b34('0x2c')];if(_0xb9410c[_0x9b34('0x2d')][_0x9b34('0x39')]){_0x14ddf0[_0x9b34('0x40')]=[{'all':!![]}];}_0x14ddf0=_[_0x9b34('0x37')]({},_0x14ddf0,_0xb9410c[_0x9b34('0x38')]);return db[_0x9b34('0x27')][_0x9b34('0x41')](_0x14ddf0)['then'](handleEntityNotFound(_0xbfd57d,null))[_0x9b34('0x21')](respondWithResult(_0xbfd57d,null))[_0x9b34('0x3c')](handleError(_0xbfd57d,null));};exports['update']=function(_0x3fc68b,_0x448862){if(_0x3fc68b[_0x9b34('0x42')]['id']){delete _0x3fc68b[_0x9b34('0x42')]['id'];}return db[_0x9b34('0x27')]['find']({'where':{'id':_0x3fc68b[_0x9b34('0x3d')]['id']}})['then'](handleEntityNotFound(_0x448862,null))['then'](saveUpdates(_0x3fc68b[_0x9b34('0x42')],null))[_0x9b34('0x21')](respondWithResult(_0x448862,null))[_0x9b34('0x3c')](handleError(_0x448862,null));};exports[_0x9b34('0x22')]=function(_0xcab62c,_0x2a7408){return db[_0x9b34('0x27')][_0x9b34('0x41')]({'where':{'id':_0xcab62c[_0x9b34('0x3d')]['id']}})[_0x9b34('0x21')](handleEntityNotFound(_0x2a7408,null))[_0x9b34('0x21')](removeEntity(_0x2a7408,null))[_0x9b34('0x3c')](handleError(_0x2a7408,null));};exports[_0x9b34('0x43')]=function(_0x2d3e85,_0x48bc53){return db[_0x9b34('0x27')]['describe']()[_0x9b34('0x21')](respondWithResult(_0x48bc53,null))[_0x9b34('0x3c')](handleError(_0x48bc53,null));}; \ No newline at end of file +var _0xf76d=['sendStatus','error','stack','name','send','map','CmHopperBlack','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','keys','length','include','options','update','body','find','describe','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then'];(function(_0x6dfbaa,_0x31eede){var _0xfbe02=function(_0x4adcaf){while(--_0x4adcaf){_0x6dfbaa['push'](_0x6dfbaa['shift']());}};_0xfbe02(++_0x31eede);}(_0xf76d,0xc1));var _0xdf76=function(_0x1e175d,_0x41ff45){_0x1e175d=_0x1e175d-0x0;var _0x3a3ce5=_0xf76d[_0x1e175d];return _0x3a3ce5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdf76('0x0'));var zipdir=require(_0xdf76('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdf76('0x2'));var moment=require(_0xdf76('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdf76('0x4'));var util=require(_0xdf76('0x5'));var path=require(_0xdf76('0x6'));var sox=require(_0xdf76('0x7'));var csv=require(_0xdf76('0x8'));var ejs=require(_0xdf76('0x9'));var fs=require('fs');var fs_extra=require(_0xdf76('0xa'));var _=require(_0xdf76('0xb'));var squel=require(_0xdf76('0xc'));var crypto=require(_0xdf76('0xd'));var jsforce=require(_0xdf76('0xe'));var deskjs=require(_0xdf76('0xf'));var toCsv=require(_0xdf76('0x8'));var querystring=require('querystring');var Papa=require(_0xdf76('0x10'));var Redis=require('ioredis');var authService=require(_0xdf76('0x11'));var qs=require(_0xdf76('0x12'));var as=require(_0xdf76('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdf76('0x14'))('api');var utils=require(_0xdf76('0x15'));var config=require(_0xdf76('0x16'));var licenseUtil=require(_0xdf76('0x17'));var db=require(_0xdf76('0x18'))['db'];function respondWithStatusCode(_0x1e89b1,_0x37287c){_0x37287c=_0x37287c||0xcc;return function(_0x15cf3d){if(_0x15cf3d){return _0x1e89b1['sendStatus'](_0x37287c);}return _0x1e89b1[_0xdf76('0x19')](_0x37287c)[_0xdf76('0x1a')]();};}function respondWithResult(_0x3c0fa2,_0x50e242){_0x50e242=_0x50e242||0xc8;return function(_0x5d2445){if(_0x5d2445){return _0x3c0fa2[_0xdf76('0x19')](_0x50e242)[_0xdf76('0x1b')](_0x5d2445);}};}function respondWithFilteredResult(_0x5b94d2,_0x3abe7f){return function(_0x1c7475){if(_0x1c7475){var _0x1fbafd=typeof _0x3abe7f[_0xdf76('0x1c')]===_0xdf76('0x1d')&&typeof _0x3abe7f['limit']===_0xdf76('0x1d');var _0x5d7a93=_0x1c7475[_0xdf76('0x1e')];var _0x5b30cb=_0x1fbafd?0x0:_0x3abe7f['offset'];var _0x4337f0=_0x1fbafd?_0x1c7475['count']:_0x3abe7f[_0xdf76('0x1c')]+_0x3abe7f[_0xdf76('0x1f')];var _0x114248;if(_0x4337f0>=_0x5d7a93){_0x4337f0=_0x5d7a93;_0x114248=0xc8;}else{_0x114248=0xce;}_0x5b94d2[_0xdf76('0x19')](_0x114248);return _0x5b94d2[_0xdf76('0x20')](_0xdf76('0x21'),_0x5b30cb+'-'+_0x4337f0+'/'+_0x5d7a93)[_0xdf76('0x1b')](_0x1c7475);}return null;};}function patchUpdates(_0x5bf9c6){return function(_0x22fdff){try{jsonpatch[_0xdf76('0x22')](_0x22fdff,_0x5bf9c6,!![]);}catch(_0x2b44e3){return BPromise[_0xdf76('0x23')](_0x2b44e3);}return _0x22fdff[_0xdf76('0x24')]();};}function saveUpdates(_0x299598,_0x42f73b){return function(_0x23339a){if(_0x23339a){return _0x23339a['update'](_0x299598)[_0xdf76('0x25')](function(_0x28c492){return _0x28c492;});}return null;};}function removeEntity(_0x341c42,_0x53749b){return function(_0x15ed6e){if(_0x15ed6e){return _0x15ed6e['destroy']()[_0xdf76('0x25')](function(){_0x341c42[_0xdf76('0x19')](0xcc)[_0xdf76('0x1a')]();});}};}function handleEntityNotFound(_0x19f253,_0x243b49){return function(_0x321816){if(!_0x321816){_0x19f253[_0xdf76('0x26')](0x194);}return _0x321816;};}function handleError(_0x358f00,_0x26681a){_0x26681a=_0x26681a||0x1f4;return function(_0x21190a){logger[_0xdf76('0x27')](_0x21190a[_0xdf76('0x28')]);if(_0x21190a[_0xdf76('0x29')]){delete _0x21190a[_0xdf76('0x29')];}_0x358f00[_0xdf76('0x19')](_0x26681a)[_0xdf76('0x2a')](_0x21190a);};}exports['index']=function(_0x51a3ff,_0x4eee01){var _0x3395f4={},_0x1819df={},_0x3b30cf={'count':0x0,'rows':[]};var _0x57c1d3=_[_0xdf76('0x2b')](db[_0xdf76('0x2c')][_0xdf76('0x2d')],function(_0x5be312){return{'name':_0x5be312[_0xdf76('0x2e')],'type':_0x5be312[_0xdf76('0x2f')]['key']};});_0x1819df[_0xdf76('0x30')]=_[_0xdf76('0x2b')](_0x57c1d3,_0xdf76('0x29'));_0x1819df[_0xdf76('0x31')]=_['keys'](_0x51a3ff[_0xdf76('0x31')]);_0x1819df[_0xdf76('0x32')]=_[_0xdf76('0x33')](_0x1819df['model'],_0x1819df[_0xdf76('0x31')]);_0x3395f4[_0xdf76('0x34')]=_[_0xdf76('0x33')](_0x1819df['model'],qs[_0xdf76('0x35')](_0x51a3ff[_0xdf76('0x31')][_0xdf76('0x35')]));_0x3395f4['attributes']=_0x3395f4[_0xdf76('0x34')]['length']?_0x3395f4['attributes']:_0x1819df[_0xdf76('0x30')];if(!_0x51a3ff['query'][_0xdf76('0x36')](_0xdf76('0x37'))){_0x3395f4['limit']=qs[_0xdf76('0x1f')](_0x51a3ff[_0xdf76('0x31')][_0xdf76('0x1f')]);_0x3395f4[_0xdf76('0x1c')]=qs[_0xdf76('0x1c')](_0x51a3ff[_0xdf76('0x31')]['offset']);}_0x3395f4[_0xdf76('0x38')]=qs[_0xdf76('0x39')](_0x51a3ff[_0xdf76('0x31')][_0xdf76('0x39')]);_0x3395f4[_0xdf76('0x3a')]=qs['filters'](_[_0xdf76('0x3b')](_0x51a3ff[_0xdf76('0x31')],_0x1819df[_0xdf76('0x32')]),_0x57c1d3);if(_0x51a3ff[_0xdf76('0x31')][_0xdf76('0x3c')]){_0x3395f4[_0xdf76('0x3a')]=_[_0xdf76('0x3d')](_0x3395f4[_0xdf76('0x3a')],{'$or':_[_0xdf76('0x2b')](_0x57c1d3,function(_0xfb6f3f){if(_0xfb6f3f[_0xdf76('0x2f')]!==_0xdf76('0x3e')){var _0x4d946b={};_0x4d946b[_0xfb6f3f[_0xdf76('0x29')]]={'$like':'%'+_0x51a3ff[_0xdf76('0x31')][_0xdf76('0x3c')]+'%'};return _0x4d946b;}})});}_0x3395f4=_[_0xdf76('0x3d')]({},_0x3395f4,_0x51a3ff['options']);var _0x5a5a64={'where':_0x3395f4[_0xdf76('0x3a')]};return db['CmHopperBlack'][_0xdf76('0x1e')](_0x5a5a64)[_0xdf76('0x25')](function(_0xc9ce6e){_0x3b30cf[_0xdf76('0x1e')]=_0xc9ce6e;if(_0x51a3ff[_0xdf76('0x31')][_0xdf76('0x3f')]){_0x3395f4['include']=[{'all':!![]}];}return db[_0xdf76('0x2c')][_0xdf76('0x40')](_0x3395f4);})[_0xdf76('0x25')](function(_0x412845){_0x3b30cf[_0xdf76('0x41')]=_0x412845;return _0x3b30cf;})[_0xdf76('0x25')](respondWithFilteredResult(_0x4eee01,_0x3395f4))[_0xdf76('0x42')](handleError(_0x4eee01,null));};exports[_0xdf76('0x43')]=function(_0x12c566,_0x2f6eab){var _0x550314={'raw':!![],'where':{'id':_0x12c566[_0xdf76('0x44')]['id']}},_0x4c2f22={};_0x4c2f22['model']=_[_0xdf76('0x45')](db[_0xdf76('0x2c')][_0xdf76('0x2d')]);_0x4c2f22[_0xdf76('0x31')]=_['keys'](_0x12c566[_0xdf76('0x31')]);_0x4c2f22[_0xdf76('0x32')]=_[_0xdf76('0x33')](_0x4c2f22[_0xdf76('0x30')],_0x4c2f22[_0xdf76('0x31')]);_0x550314[_0xdf76('0x34')]=_['intersection'](_0x4c2f22[_0xdf76('0x30')],qs[_0xdf76('0x35')](_0x12c566[_0xdf76('0x31')][_0xdf76('0x35')]));_0x550314[_0xdf76('0x34')]=_0x550314[_0xdf76('0x34')][_0xdf76('0x46')]?_0x550314['attributes']:_0x4c2f22[_0xdf76('0x30')];if(_0x12c566[_0xdf76('0x31')]['includeAll']){_0x550314[_0xdf76('0x47')]=[{'all':!![]}];}_0x550314=_[_0xdf76('0x3d')]({},_0x550314,_0x12c566[_0xdf76('0x48')]);return db[_0xdf76('0x2c')]['find'](_0x550314)[_0xdf76('0x25')](handleEntityNotFound(_0x2f6eab,null))[_0xdf76('0x25')](respondWithResult(_0x2f6eab,null))['catch'](handleError(_0x2f6eab,null));};exports[_0xdf76('0x49')]=function(_0x346dbb,_0x220756){if(_0x346dbb[_0xdf76('0x4a')]['id']){delete _0x346dbb[_0xdf76('0x4a')]['id'];}return db[_0xdf76('0x2c')][_0xdf76('0x4b')]({'where':{'id':_0x346dbb[_0xdf76('0x44')]['id']}})[_0xdf76('0x25')](handleEntityNotFound(_0x220756,null))['then'](saveUpdates(_0x346dbb[_0xdf76('0x4a')],null))[_0xdf76('0x25')](respondWithResult(_0x220756,null))[_0xdf76('0x42')](handleError(_0x220756,null));};exports['destroy']=function(_0x2ab193,_0x1f3458){return db[_0xdf76('0x2c')]['find']({'where':{'id':_0x2ab193[_0xdf76('0x44')]['id']}})[_0xdf76('0x25')](handleEntityNotFound(_0x1f3458,null))[_0xdf76('0x25')](removeEntity(_0x1f3458,null))[_0xdf76('0x42')](handleError(_0x1f3458,null));};exports[_0xdf76('0x4c')]=function(_0x36c684,_0x3272f8){return db[_0xdf76('0x2c')][_0xdf76('0x4c')]()[_0xdf76('0x25')](respondWithResult(_0x3272f8,null))[_0xdf76('0x42')](handleError(_0x3272f8,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index d361df8..b91e1f2 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 _0x06ea=['request-promise','path','rimraf','./cmHopperBlack.attributes','exports','define','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x40be99,_0xea324a){var _0x304464=function(_0x3140fa){while(--_0x3140fa){_0x40be99['push'](_0x40be99['shift']());}};_0x304464(++_0xea324a);}(_0x06ea,0xca));var _0xa06e=function(_0x1a45d4,_0x23c3d6){_0x1a45d4=_0x1a45d4-0x0;var _0x4f864d=_0x06ea[_0x1a45d4];return _0x4f864d;};'use strict';var _=require(_0xa06e('0x0'));var util=require(_0xa06e('0x1'));var logger=require(_0xa06e('0x2'))(_0xa06e('0x3'));var moment=require(_0xa06e('0x4'));var BPromise=require(_0xa06e('0x5'));var rp=require(_0xa06e('0x6'));var fs=require('fs');var path=require(_0xa06e('0x7'));var rimraf=require(_0xa06e('0x8'));var config=require('../../config/environment');var attributes=require(_0xa06e('0x9'));module[_0xa06e('0xa')]=function(_0x26e0a9,_0x3f88b5){return _0x26e0a9[_0xa06e('0xb')]('CmHopperBlack',attributes,{'tableName':_0xa06e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x674e=['moment','bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api'];(function(_0x39d859,_0x51c687){var _0x432ded=function(_0x1ab07f){while(--_0x1ab07f){_0x39d859['push'](_0x39d859['shift']());}};_0x432ded(++_0x51c687);}(_0x674e,0x1a0));var _0xe674=function(_0x5cd37a,_0x57fb09){_0x5cd37a=_0x5cd37a-0x0;var _0x4c54ae=_0x674e[_0x5cd37a];return _0x4c54ae;};'use strict';var _=require(_0xe674('0x0'));var util=require(_0xe674('0x1'));var logger=require(_0xe674('0x2'))(_0xe674('0x3'));var moment=require(_0xe674('0x4'));var BPromise=require(_0xe674('0x5'));var rp=require(_0xe674('0x6'));var fs=require('fs');var path=require(_0xe674('0x7'));var rimraf=require(_0xe674('0x8'));var config=require('../../config/environment');var attributes=require(_0xe674('0x9'));module[_0xe674('0xa')]=function(_0x56a9ca,_0x520a41){return _0x56a9ca[_0xe674('0xb')](_0xe674('0xc'),attributes,{'tableName':_0xe674('0xd'),'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 abefd4c..cd400a8 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 _0xde90=['code','message','result','catch','CmHopperBlack','findAll','options','where','attributes','limit','include','map','model','GetCmHopperBlack','UpdateCmHopperBlack','update','body','raw','DestroyCmHopperBlack','destroy','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1663fd,_0x1d934e){var _0x284dbb=function(_0x7c63ca){while(--_0x7c63ca){_0x1663fd['push'](_0x1663fd['shift']());}};_0x284dbb(++_0x1d934e);}(_0xde90,0x15c));var _0x0de9=function(_0x462582,_0x279982){_0x462582=_0x462582-0x0;var _0x176aac=_0xde90[_0x462582];return _0x176aac;};'use strict';var _=require(_0x0de9('0x0'));var util=require(_0x0de9('0x1'));var moment=require(_0x0de9('0x2'));var BPromise=require('bluebird');var rs=require(_0x0de9('0x3'));var fs=require('fs');var Redis=require(_0x0de9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0de9('0x5'));var logger=require(_0x0de9('0x6'))(_0x0de9('0x7'));var config=require(_0x0de9('0x8'));var jayson=require(_0x0de9('0x9'));var client=jayson[_0x0de9('0xa')][_0x0de9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f95ac,_0x2c0563,_0x8dc2d2){return new BPromise(function(_0x504ad3,_0x56eb23){return client[_0x0de9('0xc')](_0x5f95ac,_0x8dc2d2)[_0x0de9('0xd')](function(_0xdaf6e7){logger[_0x0de9('0xe')](_0x0de9('0xf'),_0x2c0563,_0x0de9('0x10'));logger[_0x0de9('0x11')](_0x0de9('0x12'),_0x2c0563,_0x0de9('0x10'),JSON[_0x0de9('0x13')](_0xdaf6e7));if(_0xdaf6e7[_0x0de9('0x14')]){if(_0xdaf6e7[_0x0de9('0x14')][_0x0de9('0x15')]===0x1f4){logger[_0x0de9('0x14')](_0x0de9('0xf'),_0x2c0563,_0xdaf6e7[_0x0de9('0x14')][_0x0de9('0x16')]);return _0x56eb23(_0xdaf6e7[_0x0de9('0x14')][_0x0de9('0x16')]);}logger[_0x0de9('0x14')](_0x0de9('0xf'),_0x2c0563,_0xdaf6e7[_0x0de9('0x14')]['message']);return _0x504ad3(_0xdaf6e7[_0x0de9('0x14')]['message']);}else{logger['info'](_0x0de9('0xf'),_0x2c0563,_0x0de9('0x10'));_0x504ad3(_0xdaf6e7[_0x0de9('0x17')][_0x0de9('0x16')]);}})[_0x0de9('0x18')](function(_0x33092d){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x2c0563,_0x33092d);_0x56eb23(_0x33092d);});});}exports['GetCmHopperBlack']=function(_0x37ac08){var _0xa3d778=this;return new Promise(function(_0x447dcc,_0x472083){return db[_0x0de9('0x19')][_0x0de9('0x1a')]({'raw':_0x37ac08['options']?_0x37ac08[_0x0de9('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x37ac08[_0x0de9('0x1b')]?_0x37ac08[_0x0de9('0x1b')][_0x0de9('0x1c')]||null:null,'attributes':_0x37ac08[_0x0de9('0x1b')]?_0x37ac08['options'][_0x0de9('0x1d')]||null:null,'limit':_0x37ac08['options']?_0x37ac08[_0x0de9('0x1b')][_0x0de9('0x1e')]||null:null,'include':_0x37ac08['options']?_0x37ac08[_0x0de9('0x1b')][_0x0de9('0x1f')]?_[_0x0de9('0x20')](_0x37ac08[_0x0de9('0x1b')][_0x0de9('0x1f')],function(_0x2ea543){return{'model':db[_0x2ea543['model']],'as':_0x2ea543['as'],'attributes':_0x2ea543[_0x0de9('0x1d')],'include':_0x2ea543['include']?_[_0x0de9('0x20')](_0x2ea543['include'],function(_0x4f6811){return{'model':db[_0x4f6811[_0x0de9('0x21')]],'as':_0x4f6811['as'],'attributes':_0x4f6811[_0x0de9('0x1d')],'include':_0x4f6811[_0x0de9('0x1f')]?_[_0x0de9('0x20')](_0x4f6811[_0x0de9('0x1f')],function(_0x2f95c4){return{'model':db[_0x2f95c4[_0x0de9('0x21')]],'as':_0x2f95c4['as'],'attributes':_0x2f95c4[_0x0de9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0de9('0xd')](function(_0x279f32){logger[_0x0de9('0xe')]('GetCmHopperBlack',_0x37ac08);logger[_0x0de9('0x11')]('GetCmHopperBlack',_0x37ac08,JSON[_0x0de9('0x13')](_0x279f32));_0x447dcc(_0x279f32);})['catch'](function(_0xbe79fb){logger[_0x0de9('0x14')](_0x0de9('0x22'),_0xbe79fb[_0x0de9('0x16')],_0x37ac08);_0x472083(_0xa3d778[_0x0de9('0x14')](0x1f4,_0xbe79fb['message']));});});};exports[_0x0de9('0x23')]=function(_0x2ecd0d){var _0x3a537b=this;return new Promise(function(_0x46eb1b,_0x39a87a){return db['CmHopperBlack'][_0x0de9('0x24')](_0x2ecd0d[_0x0de9('0x25')],{'raw':_0x2ecd0d[_0x0de9('0x1b')]?_0x2ecd0d['options'][_0x0de9('0x26')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ecd0d['options']?_0x2ecd0d['options'][_0x0de9('0x1c')]||null:null,'attributes':_0x2ecd0d[_0x0de9('0x1b')]?_0x2ecd0d[_0x0de9('0x1b')]['attributes']||null:null,'limit':_0x2ecd0d[_0x0de9('0x1b')]?_0x2ecd0d[_0x0de9('0x1b')][_0x0de9('0x1e')]||null:null})['then'](function(_0x29cc0c){logger['info'](_0x0de9('0x23'),_0x2ecd0d);logger['debug'](_0x0de9('0x23'),_0x2ecd0d,JSON[_0x0de9('0x13')](_0x29cc0c));_0x46eb1b(_0x29cc0c);})[_0x0de9('0x18')](function(_0x33aea4){logger['error']('UpdateCmHopperBlack',_0x33aea4[_0x0de9('0x16')],_0x2ecd0d);_0x39a87a(_0x3a537b[_0x0de9('0x14')](0x1f4,_0x33aea4[_0x0de9('0x16')]));});});};exports[_0x0de9('0x27')]=function(_0x53fa2a){var _0x26c88f=this;return new Promise(function(_0x4601d9,_0x5e2eec){return db['CmHopperBlack'][_0x0de9('0x28')]({'where':_0x53fa2a[_0x0de9('0x1b')]?_0x53fa2a[_0x0de9('0x1b')][_0x0de9('0x1c')]||null:null})[_0x0de9('0xd')](function(_0x5198ed){logger[_0x0de9('0xe')](_0x0de9('0x27'),_0x53fa2a);logger[_0x0de9('0x11')](_0x0de9('0x27'),_0x53fa2a,JSON[_0x0de9('0x13')](_0x5198ed));_0x4601d9(_0x5198ed);})[_0x0de9('0x18')](function(_0x94113b){logger[_0x0de9('0x14')](_0x0de9('0x27'),_0x94113b['message'],_0x53fa2a);_0x5e2eec(_0x26c88f[_0x0de9('0x14')](0x1f4,_0x94113b['message']));});});}; \ No newline at end of file +var _0x5596=['http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','GetCmHopperBlack','stringify','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0xe03f7d,_0x500242){var _0x505886=function(_0x5ca2ff){while(--_0x5ca2ff){_0xe03f7d['push'](_0xe03f7d['shift']());}};_0x505886(++_0x500242);}(_0x5596,0x1ca));var _0x6559=function(_0x3b9cab,_0x4e356a){_0x3b9cab=_0x3b9cab-0x0;var _0x2a6a6e=_0x5596[_0x3b9cab];return _0x2a6a6e;};'use strict';var _=require(_0x6559('0x0'));var util=require(_0x6559('0x1'));var moment=require(_0x6559('0x2'));var BPromise=require(_0x6559('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6559('0x4'))['db'];var utils=require(_0x6559('0x5'));var logger=require(_0x6559('0x6'))(_0x6559('0x7'));var config=require(_0x6559('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6559('0x9')][_0x6559('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2210bf,_0x1ca493,_0x24006f){return new BPromise(function(_0x246257,_0x466027){return client[_0x6559('0xb')](_0x2210bf,_0x24006f)[_0x6559('0xc')](function(_0x4369ab){logger[_0x6559('0xd')](_0x6559('0xe'),_0x1ca493,_0x6559('0xf'));logger[_0x6559('0x10')](_0x6559('0x11'),_0x1ca493,_0x6559('0xf'),JSON['stringify'](_0x4369ab));if(_0x4369ab[_0x6559('0x12')]){if(_0x4369ab[_0x6559('0x12')][_0x6559('0x13')]===0x1f4){logger[_0x6559('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x1ca493,_0x4369ab[_0x6559('0x12')][_0x6559('0x14')]);return _0x466027(_0x4369ab['error']['message']);}logger[_0x6559('0x12')](_0x6559('0xe'),_0x1ca493,_0x4369ab['error'][_0x6559('0x14')]);return _0x246257(_0x4369ab[_0x6559('0x12')]['message']);}else{logger[_0x6559('0xd')](_0x6559('0xe'),_0x1ca493,_0x6559('0xf'));_0x246257(_0x4369ab[_0x6559('0x15')]['message']);}})[_0x6559('0x16')](function(_0x4c9c46){logger[_0x6559('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x1ca493,_0x4c9c46);_0x466027(_0x4c9c46);});});}exports['GetCmHopperBlack']=function(_0xe8bc39){var _0x12b9f3=this;return new Promise(function(_0x4cbcbe,_0x33c3fc){return db[_0x6559('0x17')][_0x6559('0x18')]({'raw':_0xe8bc39['options']?_0xe8bc39[_0x6559('0x19')][_0x6559('0x1a')]===undefined?!![]:![]:!![],'where':_0xe8bc39[_0x6559('0x19')]?_0xe8bc39['options'][_0x6559('0x1b')]||null:null,'attributes':_0xe8bc39[_0x6559('0x19')]?_0xe8bc39[_0x6559('0x19')][_0x6559('0x1c')]||null:null,'limit':_0xe8bc39['options']?_0xe8bc39['options'][_0x6559('0x1d')]||null:null,'include':_0xe8bc39['options']?_0xe8bc39[_0x6559('0x19')][_0x6559('0x1e')]?_['map'](_0xe8bc39['options'][_0x6559('0x1e')],function(_0x208506){return{'model':db[_0x208506['model']],'as':_0x208506['as'],'attributes':_0x208506['attributes'],'include':_0x208506['include']?_[_0x6559('0x1f')](_0x208506[_0x6559('0x1e')],function(_0xe357b3){return{'model':db[_0xe357b3[_0x6559('0x20')]],'as':_0xe357b3['as'],'attributes':_0xe357b3[_0x6559('0x1c')],'include':_0xe357b3[_0x6559('0x1e')]?_[_0x6559('0x1f')](_0xe357b3[_0x6559('0x1e')],function(_0x5d18c8){return{'model':db[_0x5d18c8[_0x6559('0x20')]],'as':_0x5d18c8['as'],'attributes':_0x5d18c8[_0x6559('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6559('0xc')](function(_0x2898d5){logger[_0x6559('0xd')](_0x6559('0x21'),_0xe8bc39);logger[_0x6559('0x10')]('GetCmHopperBlack',_0xe8bc39,JSON[_0x6559('0x22')](_0x2898d5));_0x4cbcbe(_0x2898d5);})[_0x6559('0x16')](function(_0x173f7a){logger[_0x6559('0x12')]('GetCmHopperBlack',_0x173f7a[_0x6559('0x14')],_0xe8bc39);_0x33c3fc(_0x12b9f3['error'](0x1f4,_0x173f7a[_0x6559('0x14')]));});});};exports[_0x6559('0x23')]=function(_0x5df6e9){var _0x1b5075=this;return new Promise(function(_0x2fbf59,_0x2c0a5d){return db['CmHopperBlack'][_0x6559('0x24')](_0x5df6e9[_0x6559('0x25')],{'raw':_0x5df6e9[_0x6559('0x19')]?_0x5df6e9[_0x6559('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5df6e9[_0x6559('0x19')]?_0x5df6e9[_0x6559('0x19')][_0x6559('0x1b')]||null:null,'attributes':_0x5df6e9[_0x6559('0x19')]?_0x5df6e9[_0x6559('0x19')][_0x6559('0x1c')]||null:null,'limit':_0x5df6e9[_0x6559('0x19')]?_0x5df6e9[_0x6559('0x19')][_0x6559('0x1d')]||null:null})[_0x6559('0xc')](function(_0x4dde18){logger[_0x6559('0xd')](_0x6559('0x23'),_0x5df6e9);logger[_0x6559('0x10')](_0x6559('0x23'),_0x5df6e9,JSON[_0x6559('0x22')](_0x4dde18));_0x2fbf59(_0x4dde18);})[_0x6559('0x16')](function(_0x8b7623){logger[_0x6559('0x12')](_0x6559('0x23'),_0x8b7623[_0x6559('0x14')],_0x5df6e9);_0x2c0a5d(_0x1b5075[_0x6559('0x12')](0x1f4,_0x8b7623[_0x6559('0x14')]));});});};exports[_0x6559('0x26')]=function(_0x1e82be){var _0x26fbf2=this;return new Promise(function(_0x54c292,_0x40f3cb){return db[_0x6559('0x17')]['destroy']({'where':_0x1e82be[_0x6559('0x19')]?_0x1e82be[_0x6559('0x19')][_0x6559('0x1b')]||null:null})['then'](function(_0xe956b5){logger[_0x6559('0xd')](_0x6559('0x26'),_0x1e82be);logger[_0x6559('0x10')](_0x6559('0x26'),_0x1e82be,JSON[_0x6559('0x22')](_0xe956b5));_0x54c292(_0xe956b5);})[_0x6559('0x16')](function(_0x19910a){logger[_0x6559('0x12')](_0x6559('0x26'),_0x19910a[_0x6559('0x14')],_0x1e82be);_0x40f3cb(_0x26fbf2[_0x6559('0x12')](0x1f4,_0x19910a['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index dbe92bd..ea5ea69 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 _0xcaf2=['./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','/:id','show','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x4c990b,_0x25c239){var _0x3b7f9a=function(_0x5d65aa){while(--_0x5d65aa){_0x4c990b['push'](_0x4c990b['shift']());}};_0x3b7f9a(++_0x25c239);}(_0xcaf2,0x8a));var _0x2caf=function(_0x2543d6,_0x3a5e78){_0x2543d6=_0x2543d6-0x0;var _0x55213c=_0xcaf2[_0x2543d6];return _0x55213c;};'use strict';var multer=require(_0x2caf('0x0'));var util=require('util');var path=require(_0x2caf('0x1'));var timeout=require(_0x2caf('0x2'));var express=require('express');var router=express[_0x2caf('0x3')]();var fs_extra=require(_0x2caf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2caf('0x5'));var config=require('../../config/environment');var controller=require(_0x2caf('0x6'));router[_0x2caf('0x7')]('/',auth[_0x2caf('0x8')](),controller['index']);router[_0x2caf('0x7')](_0x2caf('0x9'),auth[_0x2caf('0x8')](),controller[_0x2caf('0xa')]);router['get'](_0x2caf('0xb'),auth[_0x2caf('0x8')](),controller[_0x2caf('0xc')]);router[_0x2caf('0xd')](_0x2caf('0xb'),auth[_0x2caf('0x8')](),controller[_0x2caf('0xe')]);router[_0x2caf('0xf')](_0x2caf('0xb'),auth['isAuthenticated'](),controller[_0x2caf('0x10')]);module[_0x2caf('0x11')]=router; \ No newline at end of file +var _0x7278=['../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2b85d5,_0x3115b7){var _0xe8c96f=function(_0x4bc25b){while(--_0x4bc25b){_0x2b85d5['push'](_0x2b85d5['shift']());}};_0xe8c96f(++_0x3115b7);}(_0x7278,0x161));var _0x8727=function(_0x430eed,_0x25b4c8){_0x430eed=_0x430eed-0x0;var _0x3984b5=_0x7278[_0x430eed];return _0x3984b5;};'use strict';var multer=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var path=require(_0x8727('0x2'));var timeout=require(_0x8727('0x3'));var express=require(_0x8727('0x4'));var router=express['Router']();var fs_extra=require(_0x8727('0x5'));var auth=require(_0x8727('0x6'));var interaction=require(_0x8727('0x7'));var config=require(_0x8727('0x8'));var controller=require(_0x8727('0x9'));router[_0x8727('0xa')]('/',auth[_0x8727('0xb')](),controller['index']);router[_0x8727('0xa')](_0x8727('0xc'),auth[_0x8727('0xb')](),controller[_0x8727('0xd')]);router[_0x8727('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8727('0xe')](_0x8727('0xf'),auth[_0x8727('0xb')](),controller[_0x8727('0x10')]);router[_0x8727('0x11')](_0x8727('0xf'),auth[_0x8727('0xb')](),controller[_0x8727('0x12')]);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 767910c..964220c 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 _0x0f7a=['DATE','INTEGER','endtime','setDataValue','diff','seconds','dispositionat','BOOLEAN','sequelize','moment','STRING'];(function(_0x328a3b,_0x23105a){var _0x28c7ff=function(_0x1c6119){while(--_0x1c6119){_0x328a3b['push'](_0x328a3b['shift']());}};_0x28c7ff(++_0x23105a);}(_0x0f7a,0x17e));var _0xa0f7=function(_0x5641e3,_0x1437ae){_0x5641e3=_0x5641e3-0x0;var _0x4065e8=_0x0f7a[_0x5641e3];return _0x4065e8;};'use strict';var Sequelize=require(_0xa0f7('0x0'));var moment=require(_0xa0f7('0x1'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xa0f7('0x2')]},'scheduledat':{'type':Sequelize[_0xa0f7('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa0f7('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa0f7('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xa0f7('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xa0f7('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xa0f7('0x2')]},'originatecalleridname':{'type':Sequelize[_0xa0f7('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xa0f7('0x3')]},'responsetime':{'type':Sequelize[_0xa0f7('0x3')]},'answertime':{'type':Sequelize[_0xa0f7('0x3')]},'droptime':{'type':Sequelize[_0xa0f7('0x3')]},'endtime':{'type':Sequelize[_0xa0f7('0x3')]},'ringtime':{'type':Sequelize[_0xa0f7('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xa0f7('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xa0f7('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xa0f7('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xa0f7('0x2')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xa0f7('0x2')]},'secondDisposition':{'type':Sequelize[_0xa0f7('0x2')]},'thirdDisposition':{'type':Sequelize[_0xa0f7('0x2')]},'dispositionat':{'type':Sequelize[_0xa0f7('0x3')],'set':function(_0x567fbb){var _0xbdb82=this['getDataValue'](_0xa0f7('0x5'));if(_0xbdb82&&_0x567fbb){this[_0xa0f7('0x6')]('followuptime',moment(_0x567fbb)[_0xa0f7('0x7')](moment(_0xbdb82),_0xa0f7('0x8')));}return this['setDataValue'](_0xa0f7('0x9'),_0x567fbb);}},'amd':{'type':Sequelize[_0xa0f7('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0xa0f7('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xa0f7('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xa0f7('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xa0f7('0x3')]},'callback':{'type':Sequelize[_0xa0f7('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa0f7('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xa0f7('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xa0f7('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xa0f7('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0xa0f7('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa0f7('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa0f7('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa0f7('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0313=['DATE','getDataValue','endtime','setDataValue','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING'];(function(_0x24b025,_0x43ff03){var _0x5966d0=function(_0x3b15ee){while(--_0x3b15ee){_0x24b025['push'](_0x24b025['shift']());}};_0x5966d0(++_0x43ff03);}(_0x0313,0x1df));var _0x3031=function(_0x25e744,_0x406414){_0x25e744=_0x25e744-0x0;var _0xb726b9=_0x0313[_0x25e744];return _0xb726b9;};'use strict';var Sequelize=require(_0x3031('0x0'));var moment=require(_0x3031('0x1'));module[_0x3031('0x2')]={'state':{'type':Sequelize[_0x3031('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x3031('0x4')]},'scheduledat':{'type':Sequelize[_0x3031('0x5')]},'countbusyretry':{'type':Sequelize[_0x3031('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3031('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x3031('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x3031('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x3031('0x4')]},'originatecalleridname':{'type':Sequelize[_0x3031('0x4')]},'calleridnum':{'type':Sequelize[_0x3031('0x4')]},'calleridname':{'type':Sequelize[_0x3031('0x4')]},'starttime':{'type':Sequelize[_0x3031('0x5')]},'responsetime':{'type':Sequelize[_0x3031('0x5')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x3031('0x5')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3031('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x3031('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x3031('0x4')]},'campaigntype':{'type':Sequelize[_0x3031('0x4')]},'membername':{'type':Sequelize[_0x3031('0x4')]},'reason':{'type':Sequelize[_0x3031('0x4')]},'disposition':{'type':Sequelize[_0x3031('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x4e175b){var _0x3e07cc=this[_0x3031('0x6')](_0x3031('0x7'));if(_0x3e07cc&&_0x4e175b){this[_0x3031('0x8')]('followuptime',moment(_0x4e175b)['diff'](moment(_0x3e07cc),_0x3031('0x9')));}return this[_0x3031('0x8')]('dispositionat',_0x4e175b);}},'amd':{'type':Sequelize[_0x3031('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x3031('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x3031('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x3031('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3031('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3031('0x5')]},'deleted':{'type':Sequelize[_0x3031('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x3031('0x5')]},'recallme':{'type':Sequelize[_0x3031('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x3031('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x3031('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3031('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3031('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3031('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 72a6b5d..88fb03a 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 _0x9536=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','error','stack','name','index','map','CmHopperFinal','fieldName','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','then','includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','length','options','find','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ListId','NOW()','from','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','select','ANY_VALUE(ListId)','CampaignId\x20=\x20?','cm_hopper_final','group','checkContactHopper','CmHopper','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring'];(function(_0x548ad5,_0x1e0e86){var _0x156217=function(_0x43bef0){while(--_0x43bef0){_0x548ad5['push'](_0x548ad5['shift']());}};_0x156217(++_0x1e0e86);}(_0x9536,0x179));var _0x6953=function(_0x593d89,_0x45145f){_0x593d89=_0x593d89-0x0;var _0x4aa403=_0x9536[_0x593d89];return _0x4aa403;};'use strict';var emlformat=require(_0x6953('0x0'));var rimraf=require(_0x6953('0x1'));var zipdir=require(_0x6953('0x2'));var jsonpatch=require(_0x6953('0x3'));var rp=require('request-promise');var moment=require(_0x6953('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6953('0x5'));var util=require(_0x6953('0x6'));var path=require(_0x6953('0x7'));var sox=require(_0x6953('0x8'));var csv=require(_0x6953('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6953('0xa'));var _=require(_0x6953('0xb'));var squel=require(_0x6953('0xc'));var crypto=require(_0x6953('0xd'));var jsforce=require(_0x6953('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6953('0x9'));var querystring=require(_0x6953('0xf'));var Papa=require(_0x6953('0x10'));var Redis=require('ioredis');var authService=require(_0x6953('0x11'));var qs=require(_0x6953('0x12'));var as=require(_0x6953('0x13'));var hardwareService=require(_0x6953('0x14'));var logger=require(_0x6953('0x15'))(_0x6953('0x16'));var utils=require(_0x6953('0x17'));var config=require(_0x6953('0x18'));var licenseUtil=require(_0x6953('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x358388,_0x513dd0){_0x513dd0=_0x513dd0||0xcc;return function(_0x8de91e){if(_0x8de91e){return _0x358388[_0x6953('0x1a')](_0x513dd0);}return _0x358388[_0x6953('0x1b')](_0x513dd0)[_0x6953('0x1c')]();};}function respondWithResult(_0x1b5221,_0x244713){_0x244713=_0x244713||0xc8;return function(_0x175fa9){if(_0x175fa9){return _0x1b5221[_0x6953('0x1b')](_0x244713)[_0x6953('0x1d')](_0x175fa9);}};}function respondWithFilteredResult(_0x31d182,_0xae5515){return function(_0x548473){if(_0x548473){var _0x5f49db=typeof _0xae5515[_0x6953('0x1e')]===_0x6953('0x1f')&&typeof _0xae5515[_0x6953('0x20')]===_0x6953('0x1f');var _0x510d46=_0x548473[_0x6953('0x21')];var _0x2da771=_0x5f49db?0x0:_0xae5515['offset'];var _0x10858a=_0x5f49db?_0x548473[_0x6953('0x21')]:_0xae5515[_0x6953('0x1e')]+_0xae5515[_0x6953('0x20')];var _0xc714d3;if(_0x10858a>=_0x510d46){_0x10858a=_0x510d46;_0xc714d3=0xc8;}else{_0xc714d3=0xce;}_0x31d182['status'](_0xc714d3);return _0x31d182[_0x6953('0x22')](_0x6953('0x23'),_0x2da771+'-'+_0x10858a+'/'+_0x510d46)[_0x6953('0x1d')](_0x548473);}return null;};}function patchUpdates(_0x2ba433){return function(_0x41f021){try{jsonpatch['apply'](_0x41f021,_0x2ba433,!![]);}catch(_0xf96d07){return BPromise[_0x6953('0x24')](_0xf96d07);}return _0x41f021['save']();};}function saveUpdates(_0x317979,_0x40c9d1){return function(_0xb92529){if(_0xb92529){return _0xb92529[_0x6953('0x25')](_0x317979)['then'](function(_0x37f339){return _0x37f339;});}return null;};}function removeEntity(_0x231cb2,_0x2a7f6a){return function(_0x508ea7){if(_0x508ea7){return _0x508ea7['destroy']()['then'](function(){_0x231cb2[_0x6953('0x1b')](0xcc)[_0x6953('0x1c')]();});}};}function handleEntityNotFound(_0x550be4,_0x1a32f4){return function(_0x587df0){if(!_0x587df0){_0x550be4[_0x6953('0x1a')](0x194);}return _0x587df0;};}function handleError(_0x2bf39b,_0xcdbce8){_0xcdbce8=_0xcdbce8||0x1f4;return function(_0x2cc01e){logger[_0x6953('0x26')](_0x2cc01e[_0x6953('0x27')]);if(_0x2cc01e['name']){delete _0x2cc01e[_0x6953('0x28')];}_0x2bf39b[_0x6953('0x1b')](_0xcdbce8)['send'](_0x2cc01e);};}exports[_0x6953('0x29')]=function(_0x4af39d,_0x173b3c){var _0x3b1175={},_0x426c7c={},_0x4b0325={'count':0x0,'rows':[]};var _0x131992=_[_0x6953('0x2a')](db[_0x6953('0x2b')]['rawAttributes'],function(_0x4c49fc){return{'name':_0x4c49fc[_0x6953('0x2c')],'type':_0x4c49fc['type']['key']};});_0x426c7c[_0x6953('0x2d')]=_[_0x6953('0x2a')](_0x131992,_0x6953('0x28'));_0x426c7c[_0x6953('0x2e')]=_[_0x6953('0x2f')](_0x4af39d['query']);_0x426c7c[_0x6953('0x30')]=_['intersection'](_0x426c7c[_0x6953('0x2d')],_0x426c7c[_0x6953('0x2e')]);_0x3b1175['attributes']=_['intersection'](_0x426c7c[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x4af39d[_0x6953('0x2e')]['fields']));_0x3b1175[_0x6953('0x32')]=_0x3b1175['attributes']['length']?_0x3b1175['attributes']:_0x426c7c['model'];if(!_0x4af39d[_0x6953('0x2e')][_0x6953('0x33')](_0x6953('0x34'))){_0x3b1175[_0x6953('0x20')]=qs[_0x6953('0x20')](_0x4af39d[_0x6953('0x2e')]['limit']);_0x3b1175[_0x6953('0x1e')]=qs['offset'](_0x4af39d[_0x6953('0x2e')]['offset']);}_0x3b1175[_0x6953('0x35')]=qs[_0x6953('0x36')](_0x4af39d[_0x6953('0x2e')][_0x6953('0x36')]);_0x3b1175['where']=qs[_0x6953('0x30')](_[_0x6953('0x37')](_0x4af39d[_0x6953('0x2e')],_0x426c7c[_0x6953('0x30')]),_0x131992);if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x38')]){_0x3b1175[_0x6953('0x39')]=_[_0x6953('0x3a')](_0x3b1175[_0x6953('0x39')],{'$or':_[_0x6953('0x2a')](_0x131992,function(_0x2d9d81){if(_0x2d9d81['type']!==_0x6953('0x3b')){var _0x3c03ab={};_0x3c03ab[_0x2d9d81[_0x6953('0x28')]]={'$like':'%'+_0x4af39d['query']['filter']+'%'};return _0x3c03ab;}})});}_0x3b1175=_[_0x6953('0x3a')]({},_0x3b1175,_0x4af39d['options']);var _0x5abaf2={'where':_0x3b1175[_0x6953('0x39')]};return db[_0x6953('0x2b')]['count'](_0x5abaf2)[_0x6953('0x3c')](function(_0x263728){_0x4b0325[_0x6953('0x21')]=_0x263728;if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x3d')]){_0x3b1175[_0x6953('0x3e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x6953('0x3f')](_0x3b1175);})[_0x6953('0x3c')](function(_0x30a27a){_0x4b0325[_0x6953('0x40')]=_0x30a27a;return _0x4b0325;})[_0x6953('0x3c')](respondWithFilteredResult(_0x173b3c,_0x3b1175))[_0x6953('0x41')](handleError(_0x173b3c,null));};exports['show']=function(_0x5a40de,_0xeef91a){var _0x54d7c2={'raw':!![],'where':{'id':_0x5a40de[_0x6953('0x42')]['id']}},_0x588ff8={};_0x588ff8[_0x6953('0x2d')]=_[_0x6953('0x2f')](db[_0x6953('0x2b')][_0x6953('0x43')]);_0x588ff8['query']=_['keys'](_0x5a40de[_0x6953('0x2e')]);_0x588ff8[_0x6953('0x30')]=_['intersection'](_0x588ff8[_0x6953('0x2d')],_0x588ff8['query']);_0x54d7c2[_0x6953('0x32')]=_[_0x6953('0x44')](_0x588ff8[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x5a40de['query'][_0x6953('0x31')]));_0x54d7c2[_0x6953('0x32')]=_0x54d7c2['attributes'][_0x6953('0x45')]?_0x54d7c2[_0x6953('0x32')]:_0x588ff8[_0x6953('0x2d')];if(_0x5a40de[_0x6953('0x2e')][_0x6953('0x3d')]){_0x54d7c2[_0x6953('0x3e')]=[{'all':!![]}];}_0x54d7c2=_[_0x6953('0x3a')]({},_0x54d7c2,_0x5a40de[_0x6953('0x46')]);return db[_0x6953('0x2b')][_0x6953('0x47')](_0x54d7c2)[_0x6953('0x3c')](handleEntityNotFound(_0xeef91a,null))['then'](respondWithResult(_0xeef91a,null))[_0x6953('0x41')](handleError(_0xeef91a,null));};exports['describe']=function(_0x15c142,_0x1d5979){return db[_0x6953('0x2b')]['describe']()[_0x6953('0x3c')](respondWithResult(_0x1d5979,null))[_0x6953('0x41')](handleError(_0x1d5979,null));};exports['update']=function(_0x525145,_0xbf5b61){if(_0x525145[_0x6953('0x48')][_0x6953('0x49')]){delete _0x525145[_0x6953('0x48')][_0x6953('0x49')];}return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'uniqueid':_0x525145[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0xbf5b61,null))[_0x6953('0x3c')](saveUpdates(_0x525145[_0x6953('0x48')],null))['then'](respondWithResult(_0xbf5b61,null))['catch'](handleError(_0xbf5b61,null));};exports[_0x6953('0x4a')]=function(_0x38e3e8,_0x68ab5d,_0x7bcd92){return db[_0x6953('0x2b')][_0x6953('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x38e3e8[_0x6953('0x42')]['id']},'attributes':[[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x6953('0x4d')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x6953('0x4e')](_0x6953('0x4f')))),_0x6953('0x50')],[db['sequelize']['fn']('COUNT',db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x6953('0x51')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal'](_0x6953('0x52')))),_0x6953('0x53')],[db['sequelize']['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x54')))),_0x6953('0x55')],[db['sequelize']['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x6953('0x56')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x6953('0x4e')](_0x6953('0x57')))),'reCallContacts'],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x58')))),_0x6953('0x59')]]})[_0x6953('0x3c')](handleEntityNotFound(_0x68ab5d,null))['then'](respondWithResult(_0x68ab5d,null))[_0x6953('0x41')](handleError(_0x68ab5d,null));};exports[_0x6953('0x5a')]=function(_0x35ac0e,_0x57ffab,_0x479ab4){return db[_0x6953('0x2b')][_0x6953('0x3f')]({'raw':![],'where':{'CampaignId':_0x35ac0e[_0x6953('0x42')]['id']},'attributes':[[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x5b')))),_0x6953('0x4d')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x4f')))),_0x6953('0x50')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x5c')))),_0x6953('0x51')],[db[_0x6953('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6953('0x4b')]['literal'](_0x6953('0x52')))),_0x6953('0x53')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x54')))),_0x6953('0x55')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x5d')))),_0x6953('0x56')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal'](_0x6953('0x57')))),_0x6953('0x5e')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x6953('0x59')]]})[_0x6953('0x3c')](handleEntityNotFound(_0x57ffab,null))['then'](respondWithResult(_0x57ffab,null))[_0x6953('0x41')](handleError(_0x57ffab,null));};exports[_0x6953('0x5f')]=function(_0x41d74d,_0x5063ac,_0x4cb8a4){return db[_0x6953('0x60')][_0x6953('0x47')]({'where':{'id':_0x41d74d[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x5063ac,null))[_0x6953('0x3c')](function(_0x43a39f){var _0x3cf1c0;if(_0x43a39f){_0x3cf1c0=squel[_0x6953('0x61')]()[_0x6953('0x62')]('cm_hopper')[_0x6953('0x63')]([_0x6953('0x64'),_0x6953('0x65'),_0x6953('0x66'),'ListId',_0x6953('0x67'),_0x6953('0x68'),_0x6953('0x69')],squel['select']()[_0x6953('0x6a')](_0x6953('0x6b'),_0x6953('0x64'))[_0x6953('0x6a')]('NOW()',_0x6953('0x65'))[_0x6953('0x6a')](_0x6953('0x6c'),_0x6953('0x66'))['field']('ANY_VALUE(ListId)',_0x6953('0x6d'))[_0x6953('0x6a')]('ANY_VALUE(VoiceQueueId)','VoiceQueueId')[_0x6953('0x6a')](_0x6953('0x6e'),_0x6953('0x68'))[_0x6953('0x6a')]('NOW()',_0x6953('0x69'))[_0x6953('0x6f')]('cm_hopper_final')[_0x6953('0x39')](_0x6953('0x70'),_0x41d74d['params']['id']['toString']())['where'](_0x6953('0x71'),_0x41d74d[_0x6953('0x48')][_0x6953('0x72')][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x74'))[_0x6953('0x39')](_0x6953('0x75'),squel['select']()[_0x6953('0x6a')](_0x6953('0x64'))[_0x6953('0x6f')](_0x6953('0x76'))[_0x6953('0x39')](_0x6953('0x70'),_0x41d74d['params']['id'][_0x6953('0x73')]()))['where'](_0x6953('0x75'),squel['select']()[_0x6953('0x6a')](_0x6953('0x77'))[_0x6953('0x6f')]('cm_hopper_final')[_0x6953('0x39')](_0x6953('0x70'),_0x41d74d[_0x6953('0x42')]['id'][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x78')))['group'](_0x6953('0x66')))[_0x6953('0x73')]();return db[_0x6953('0x4b')][_0x6953('0x2e')](_0x3cf1c0);}return[];})[_0x6953('0x3c')](respondWithResult(_0x5063ac,null))[_0x6953('0x41')](handleError(_0x5063ac,null));};exports[_0x6953('0x79')]=function(_0xa26241,_0xefb593,_0x216b92){return db[_0x6953('0x7a')]['find']({'where':{'id':_0xa26241[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0xefb593,null))[_0x6953('0x3c')](function(_0x396a9f){var _0x92c0bc;if(_0x396a9f){_0x92c0bc=squel[_0x6953('0x61')]()[_0x6953('0x62')](_0x6953('0x76'))[_0x6953('0x63')]([_0x6953('0x64'),_0x6953('0x65'),'ContactId',_0x6953('0x6d'),_0x6953('0x7b'),_0x6953('0x68'),'updatedAt'],squel[_0x6953('0x7c')]()['field']('ANY_VALUE(calleridnum)',_0x6953('0x64'))[_0x6953('0x6a')](_0x6953('0x6e'),_0x6953('0x65'))[_0x6953('0x6a')](_0x6953('0x6c'),_0x6953('0x66'))['field'](_0x6953('0x7d'),_0x6953('0x6d'))[_0x6953('0x6a')]('ANY_VALUE(CampaignId)',_0x6953('0x7b'))[_0x6953('0x6a')]('NOW()',_0x6953('0x68'))['field']('NOW()',_0x6953('0x69'))['from']('cm_hopper_final')[_0x6953('0x39')](_0x6953('0x7e'),_0xa26241[_0x6953('0x42')]['id']['toString']())[_0x6953('0x39')](_0x6953('0x71'),_0xa26241['body'][_0x6953('0x72')][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x74'))[_0x6953('0x39')](_0x6953('0x75'),squel[_0x6953('0x7c')]()[_0x6953('0x6a')](_0x6953('0x64'))['from'](_0x6953('0x76'))[_0x6953('0x39')]('CampaignId\x20=\x20?',_0xa26241[_0x6953('0x42')]['id'][_0x6953('0x73')]()))[_0x6953('0x39')](_0x6953('0x75'),squel[_0x6953('0x7c')]()[_0x6953('0x6a')](_0x6953('0x77'))['from'](_0x6953('0x7f'))[_0x6953('0x39')](_0x6953('0x7e'),_0xa26241[_0x6953('0x42')]['id'][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x78')))[_0x6953('0x80')](_0x6953('0x66')))['toString']();return db[_0x6953('0x4b')]['query'](_0x92c0bc);}return[];})[_0x6953('0x3c')](respondWithResult(_0xefb593,null))['catch'](handleError(_0xefb593,null));};exports[_0x6953('0x81')]=function(_0x7215ed,_0x3cb96a,_0x46bcec){return db[_0x6953('0x82')]['findOne']({'where':{'VoiceQueueId':_0x7215ed[_0x6953('0x48')]['VoiceQueueId'],'CampaignId':_0x7215ed[_0x6953('0x48')][_0x6953('0x7b')],'ContactId':_0x7215ed[_0x6953('0x48')][_0x6953('0x66')]}})['then'](handleEntityNotFound(_0x3cb96a,null))[_0x6953('0x3c')](function(_0x50f019){if(_0x50f019){return _0x50f019;}return null;})[_0x6953('0x3c')](respondWithResult(_0x3cb96a,null))[_0x6953('0x41')](handleError(_0x3cb96a,null));}; \ No newline at end of file +var _0xc6ac=['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','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','VoiceQueueId','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','into','CampaignId','CampaignId\x20=\x20?','checkContactHopper','findOne','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','CmHopperFinal','rawAttributes','fieldName','type'];(function(_0x470842,_0x51ecdf){var _0x41bbcb=function(_0x57f856){while(--_0x57f856){_0x470842['push'](_0x470842['shift']());}};_0x41bbcb(++_0x51ecdf);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x32e87c,_0x476aa9){_0x32e87c=_0x32e87c-0x0;var _0x35d7ab=_0xc6ac[_0x32e87c];return _0x35d7ab;};'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['CmHopperFinal'][_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['describe']=function(_0x4e1a0b,_0x47c999){return db[_0xcc6a('0x2d')][_0xcc6a('0x4c')]()[_0xcc6a('0x27')](respondWithResult(_0x47c999,null))[_0xcc6a('0x4b')](handleError(_0x47c999,null));};exports['update']=function(_0x1c3bb8,_0x5e7bab){if(_0x1c3bb8[_0xcc6a('0x4d')][_0xcc6a('0x4e')]){delete _0x1c3bb8[_0xcc6a('0x4d')][_0xcc6a('0x4e')];}return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'uniqueid':_0x1c3bb8['params']['id']}})[_0xcc6a('0x27')](handleEntityNotFound(_0x5e7bab,null))[_0xcc6a('0x27')](saveUpdates(_0x1c3bb8[_0xcc6a('0x4d')],null))[_0xcc6a('0x27')](respondWithResult(_0x5e7bab,null))[_0xcc6a('0x4b')](handleError(_0x5e7bab,null));};exports[_0xcc6a('0x4f')]=function(_0x431684,_0x392805,_0x31987f){return db[_0xcc6a('0x2d')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x431684[_0xcc6a('0x47')]['id']},'attributes':[[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0xcc6a('0x50')]['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x53')))),_0xcc6a('0x54')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x55')))),'busyContacts'],[db[_0xcc6a('0x50')]['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')]('`state`\x20=\x208,\x201,\x20null'))),_0xcc6a('0x56')],[db['sequelize']['fn'](_0xcc6a('0x51'),db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x57')))),_0xcc6a('0x58')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')]['literal'](_0xcc6a('0x59')))),'abandonedContacts'],[db[_0xcc6a('0x50')]['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')]('`state`\x20=\x2022,\x201,\x20null'))),_0xcc6a('0x5a')],[db['sequelize']['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x5b')))),_0xcc6a('0x5c')]]})[_0xcc6a('0x27')](handleEntityNotFound(_0x392805,null))[_0xcc6a('0x27')](respondWithResult(_0x392805,null))[_0xcc6a('0x4b')](handleError(_0x392805,null));};exports[_0xcc6a('0x5d')]=function(_0x3e76d7,_0x42bbc7,_0x2ad9a6){return db[_0xcc6a('0x2d')]['findAll']({'raw':![],'where':{'CampaignId':_0x3e76d7[_0xcc6a('0x47')]['id']},'attributes':[[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db['sequelize'][_0xcc6a('0x52')](_0xcc6a('0x5e')))),_0xcc6a('0x5f')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x53')))),_0xcc6a('0x54')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x55')))),'busyContacts'],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xcc6a('0x56')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db['sequelize'][_0xcc6a('0x52')](_0xcc6a('0x57')))),_0xcc6a('0x58')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db['sequelize']['fn']('IF',db['sequelize'][_0xcc6a('0x52')](_0xcc6a('0x59')))),_0xcc6a('0x60')],[db[_0xcc6a('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x61')))),_0xcc6a('0x5a')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x5b')))),_0xcc6a('0x5c')]]})['then'](handleEntityNotFound(_0x42bbc7,null))[_0xcc6a('0x27')](respondWithResult(_0x42bbc7,null))[_0xcc6a('0x4b')](handleError(_0x42bbc7,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x72e53a,_0x5b61df,_0x3b4ce0){return db['VoiceQueue'][_0xcc6a('0x4a')]({'where':{'id':_0x72e53a[_0xcc6a('0x47')]['id']}})[_0xcc6a('0x27')](handleEntityNotFound(_0x5b61df,null))['then'](function(_0x3ce1eb){var _0x51390a;if(_0x3ce1eb){_0x51390a=squel[_0xcc6a('0x62')]()['into'](_0xcc6a('0x63'))[_0xcc6a('0x64')]([_0xcc6a('0x65'),_0xcc6a('0x66'),_0xcc6a('0x67'),_0xcc6a('0x68'),'VoiceQueueId',_0xcc6a('0x69'),_0xcc6a('0x6a')],squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')](_0xcc6a('0x6d'),'phone')[_0xcc6a('0x6c')](_0xcc6a('0x6e'),'scheduledAt')['field'](_0xcc6a('0x6f'),_0xcc6a('0x67'))[_0xcc6a('0x6c')](_0xcc6a('0x70'),_0xcc6a('0x68'))[_0xcc6a('0x6c')]('ANY_VALUE(VoiceQueueId)',_0xcc6a('0x71'))[_0xcc6a('0x6c')](_0xcc6a('0x6e'),_0xcc6a('0x69'))[_0xcc6a('0x6c')](_0xcc6a('0x6e'),'updatedAt')['from'](_0xcc6a('0x72'))[_0xcc6a('0x3e')](_0xcc6a('0x73'),_0x72e53a[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x75'),_0x72e53a['body'][_0xcc6a('0x76')][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x77'))[_0xcc6a('0x3e')](_0xcc6a('0x78'),squel['select']()[_0xcc6a('0x6c')](_0xcc6a('0x65'))[_0xcc6a('0x79')]('cm_hopper')[_0xcc6a('0x3e')](_0xcc6a('0x73'),_0x72e53a[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]()))[_0xcc6a('0x3e')](_0xcc6a('0x78'),squel['select']()[_0xcc6a('0x6c')](_0xcc6a('0x7a'))['from'](_0xcc6a('0x72'))[_0xcc6a('0x3e')](_0xcc6a('0x73'),_0x72e53a[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]())['where'](_0xcc6a('0x7b')))[_0xcc6a('0x7c')](_0xcc6a('0x67')))[_0xcc6a('0x74')]();return db[_0xcc6a('0x50')][_0xcc6a('0x33')](_0x51390a);}return[];})['then'](respondWithResult(_0x5b61df,null))['catch'](handleError(_0x5b61df,null));};exports[_0xcc6a('0x7d')]=function(_0x5be65b,_0xb42e9,_0x35a798){return db[_0xcc6a('0x7e')][_0xcc6a('0x4a')]({'where':{'id':_0x5be65b[_0xcc6a('0x47')]['id']}})[_0xcc6a('0x27')](handleEntityNotFound(_0xb42e9,null))[_0xcc6a('0x27')](function(_0x1746d8){var _0xc0d194;if(_0x1746d8){_0xc0d194=squel[_0xcc6a('0x62')]()[_0xcc6a('0x7f')](_0xcc6a('0x63'))['fromQuery']([_0xcc6a('0x65'),_0xcc6a('0x66'),_0xcc6a('0x67'),_0xcc6a('0x68'),'CampaignId',_0xcc6a('0x69'),'updatedAt'],squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')](_0xcc6a('0x6d'),_0xcc6a('0x65'))[_0xcc6a('0x6c')](_0xcc6a('0x6e'),_0xcc6a('0x66'))['field'](_0xcc6a('0x6f'),_0xcc6a('0x67'))[_0xcc6a('0x6c')](_0xcc6a('0x70'),_0xcc6a('0x68'))[_0xcc6a('0x6c')]('ANY_VALUE(CampaignId)',_0xcc6a('0x80'))[_0xcc6a('0x6c')]('NOW()','createdAt')[_0xcc6a('0x6c')](_0xcc6a('0x6e'),_0xcc6a('0x6a'))[_0xcc6a('0x79')](_0xcc6a('0x72'))['where'](_0xcc6a('0x81'),_0x5be65b['params']['id'][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x75'),_0x5be65b[_0xcc6a('0x4d')][_0xcc6a('0x76')][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x77'))['where'](_0xcc6a('0x78'),squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')]('phone')[_0xcc6a('0x79')](_0xcc6a('0x63'))[_0xcc6a('0x3e')](_0xcc6a('0x81'),_0x5be65b[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]()))[_0xcc6a('0x3e')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')](_0xcc6a('0x7a'))[_0xcc6a('0x79')](_0xcc6a('0x72'))[_0xcc6a('0x3e')](_0xcc6a('0x81'),_0x5be65b[_0xcc6a('0x47')]['id']['toString']())['where'](_0xcc6a('0x7b')))['group'](_0xcc6a('0x67')))[_0xcc6a('0x74')]();return db[_0xcc6a('0x50')][_0xcc6a('0x33')](_0xc0d194);}return[];})[_0xcc6a('0x27')](respondWithResult(_0xb42e9,null))[_0xcc6a('0x4b')](handleError(_0xb42e9,null));};exports[_0xcc6a('0x82')]=function(_0x48b6e3,_0x10d731,_0x537e2b){return db['CmHopper'][_0xcc6a('0x83')]({'where':{'VoiceQueueId':_0x48b6e3['body'][_0xcc6a('0x71')],'CampaignId':_0x48b6e3[_0xcc6a('0x4d')]['CampaignId'],'ContactId':_0x48b6e3['body'][_0xcc6a('0x67')]}})['then'](handleEntityNotFound(_0x10d731,null))[_0xcc6a('0x27')](function(_0x3df510){if(_0x3df510){return _0x3df510;}return null;})[_0xcc6a('0x27')](respondWithResult(_0x10d731,null))[_0xcc6a('0x4b')](handleError(_0x10d731,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 1b3c7ca..26496aa 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 _0x1944=['util','api','moment','bluebird','request-promise','path','rimraf','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x1944,0xc3));var _0x4194=function(_0x2476b2,_0x33d56a){_0x2476b2=_0x2476b2-0x0;var _0x5a71a4=_0x1944[_0x2476b2];return _0x5a71a4;};'use strict';var _=require('lodash');var util=require(_0x4194('0x0'));var logger=require('../../config/logger')(_0x4194('0x1'));var moment=require(_0x4194('0x2'));var BPromise=require(_0x4194('0x3'));var rp=require(_0x4194('0x4'));var fs=require('fs');var path=require(_0x4194('0x5'));var rimraf=require(_0x4194('0x6'));var config=require('../../config/environment');var attributes=require(_0x4194('0x7'));module[_0x4194('0x8')]=function(_0x3c342f,_0x5cc8cd){return _0x3c342f[_0x4194('0x9')]('CmHopperFinal',attributes,{'tableName':_0x4194('0xa'),'paranoid':![],'indexes':[{'name':_0x4194('0xb'),'fields':['calleridnum']},{'name':_0x4194('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1ac9=['CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1ac9,0x1d2));var _0x91ac=function(_0x12c43b,_0x2197f6){_0x12c43b=_0x12c43b-0x0;var _0x1ffd81=_0x1ac9[_0x12c43b];return _0x1ffd81;};'use strict';var _=require(_0x91ac('0x0'));var util=require(_0x91ac('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x91ac('0x2'));var rp=require(_0x91ac('0x3'));var fs=require('fs');var path=require(_0x91ac('0x4'));var rimraf=require(_0x91ac('0x5'));var config=require(_0x91ac('0x6'));var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x12629e,_0x27d97b){return _0x12629e['define'](_0x91ac('0x7'),attributes,{'tableName':_0x91ac('0x8'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x91ac('0x9')]},{'name':_0x91ac('0xa'),'fields':[_0x91ac('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 8d3ab91..f1f9cf8 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(_0x419a16,_0x184d3c){var _0x1c01e8=function(_0x522e93){while(--_0x522e93){_0x419a16['push'](_0x419a16['shift']());}};_0x1c01e8(++_0x184d3c);}(_0xb10b,0x12a));var _0xbb10=function(_0x4648ff,_0x582172){_0x4648ff=_0x4648ff-0x0;var _0x26070b=_0xb10b[_0x4648ff];return _0x26070b;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x105f76,_0xae52f){var _0x5d0a35=function(_0x4eb7cb){while(--_0x4eb7cb){_0x105f76['push'](_0x105f76['shift']());}};_0x5d0a35(++_0xae52f);}(_0x7a54,0x106));var _0x47a5=function(_0xa921d3,_0xe694cd){_0xa921d3=_0xa921d3-0x0;var _0x22a8aa=_0x7a54[_0xa921d3];return _0x22a8aa;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index c088d63..a32f259 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 _0x6b6b=['moveContactsIvrCampaignHopperFinal','checkContactHopper','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x6b6b,0x16b));var _0xb6b6=function(_0x194808,_0x596785){_0x194808=_0x194808-0x0;var _0x2c1b61=_0x6b6b[_0x194808];return _0x2c1b61;};'use strict';var multer=require(_0xb6b6('0x0'));var util=require(_0xb6b6('0x1'));var path=require(_0xb6b6('0x2'));var timeout=require(_0xb6b6('0x3'));var express=require(_0xb6b6('0x4'));var router=express[_0xb6b6('0x5')]();var fs_extra=require(_0xb6b6('0x6'));var auth=require(_0xb6b6('0x7'));var interaction=require(_0xb6b6('0x8'));var config=require(_0xb6b6('0x9'));var controller=require(_0xb6b6('0xa'));router[_0xb6b6('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb6b6('0xb')]('/describe',auth[_0xb6b6('0xc')](),controller[_0xb6b6('0xd')]);router['get'](_0xb6b6('0xe'),auth[_0xb6b6('0xc')](),controller['show']);router['get'](_0xb6b6('0xf'),auth[_0xb6b6('0xc')](),controller[_0xb6b6('0x10')]);router[_0xb6b6('0xb')](_0xb6b6('0x11'),auth[_0xb6b6('0xc')](),controller['countContactsIvrCampaignHopperFinal']);router['post']('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller[_0xb6b6('0x12')]);router[_0xb6b6('0x13')](_0xb6b6('0x14'),auth[_0xb6b6('0xc')](),controller[_0xb6b6('0x15')]);router[_0xb6b6('0x13')]('/checkContactHopper',auth[_0xb6b6('0xc')](),controller[_0xb6b6('0x16')]);router['put'](_0xb6b6('0xe'),auth[_0xb6b6('0xc')](),controller['update']);module[_0xb6b6('0x17')]=router; \ No newline at end of file +var _0x687a=['get','isAuthenticated','index','/describe','describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x37e244,_0x405f20){var _0x5ba3cc=function(_0x3807e2){while(--_0x3807e2){_0x37e244['push'](_0x37e244['shift']());}};_0x5ba3cc(++_0x405f20);}(_0x687a,0xe8));var _0xa687=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x687a[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0xa687('0x0'));var util=require(_0xa687('0x1'));var path=require(_0xa687('0x2'));var timeout=require('connect-timeout');var express=require(_0xa687('0x3'));var router=express[_0xa687('0x4')]();var fs_extra=require(_0xa687('0x5'));var auth=require(_0xa687('0x6'));var interaction=require(_0xa687('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0xa687('0x8')]('/',auth[_0xa687('0x9')](),controller[_0xa687('0xa')]);router[_0xa687('0x8')](_0xa687('0xb'),auth[_0xa687('0x9')](),controller[_0xa687('0xc')]);router[_0xa687('0x8')](_0xa687('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xa687('0x8')](_0xa687('0xe'),auth['isAuthenticated'](),controller[_0xa687('0xf')]);router['get'](_0xa687('0x10'),auth[_0xa687('0x9')](),controller[_0xa687('0x11')]);router[_0xa687('0x12')]('/voice/queue/moveContacts/:id',auth[_0xa687('0x9')](),controller[_0xa687('0x13')]);router['post']('/voice/campaign/moveContacts/:id',auth[_0xa687('0x9')](),controller[_0xa687('0x14')]);router[_0xa687('0x12')]('/checkContactHopper',auth[_0xa687('0x9')](),controller[_0xa687('0x15')]);router[_0xa687('0x16')](_0xa687('0xd'),auth['isAuthenticated'](),controller['update']);module[_0xa687('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 5a58a8f..97ba7e5 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 _0xeaae=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x404b9a,_0xca0480){var _0x30ba61=function(_0x1cdde1){while(--_0x1cdde1){_0x404b9a['push'](_0x404b9a['shift']());}};_0x30ba61(++_0xca0480);}(_0xeaae,0x126));var _0xeeaa=function(_0x182379,_0x20ca9c){_0x182379=_0x182379-0x0;var _0x597765=_0xeaae[_0x182379];return _0x597765;};'use strict';var Sequelize=require(_0xeeaa('0x0'));module[_0xeeaa('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xeeaa('0x2')]},'scheduledat':{'type':Sequelize[_0xeeaa('0x3')]},'countbusyretry':{'type':Sequelize[_0xeeaa('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xeeaa('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xeeaa('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xeeaa('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xeeaa('0x2')]},'originatecalleridname':{'type':Sequelize[_0xeeaa('0x2')]},'calleridnum':{'type':Sequelize[_0xeeaa('0x2')]},'calleridname':{'type':Sequelize[_0xeeaa('0x2')]},'starttime':{'type':Sequelize[_0xeeaa('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xeeaa('0x3')]},'endtime':{'type':Sequelize[_0xeeaa('0x3')]},'ringtime':{'type':Sequelize[_0xeeaa('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xeeaa('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xeeaa('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xeeaa('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xeeaa('0x2')]},'campaign':{'type':Sequelize[_0xeeaa('0x2')]},'campaigntype':{'type':Sequelize[_0xeeaa('0x2')]},'membername':{'type':Sequelize[_0xeeaa('0x2')]},'reason':{'type':Sequelize[_0xeeaa('0x2')]},'amd':{'type':Sequelize[_0xeeaa('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xeeaa('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xeeaa('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xeeaa('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xeeaa('0x3')]},'recallme':{'type':Sequelize[_0xeeaa('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xeeaa('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xeeaa('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xeeaa('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xeeaa('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xeeaa('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8d1e=['sequelize','exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x8d1e,0x78));var _0xe8d1=function(_0x30cc1a,_0x162bbc){_0x30cc1a=_0x30cc1a-0x0;var _0xb3f18f=_0x8d1e[_0x30cc1a];return _0xb3f18f;};'use strict';var Sequelize=require(_0xe8d1('0x0'));module[_0xe8d1('0x1')]={'state':{'type':Sequelize[_0xe8d1('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xe8d1('0x3')]},'scheduledat':{'type':Sequelize[_0xe8d1('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe8d1('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe8d1('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe8d1('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xe8d1('0x3')]},'calleridnum':{'type':Sequelize[_0xe8d1('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xe8d1('0x4')]},'endtime':{'type':Sequelize[_0xe8d1('0x4')]},'ringtime':{'type':Sequelize[_0xe8d1('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe8d1('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe8d1('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe8d1('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe8d1('0x3')]},'campaign':{'type':Sequelize[_0xe8d1('0x3')]},'campaigntype':{'type':Sequelize[_0xe8d1('0x3')]},'membername':{'type':Sequelize[_0xe8d1('0x3')]},'reason':{'type':Sequelize[_0xe8d1('0x3')]},'amd':{'type':Sequelize[_0xe8d1('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe8d1('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xe8d1('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe8d1('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe8d1('0x4')]},'recallme':{'type':Sequelize[_0xe8d1('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xe8d1('0x4')]},'edited':{'type':Sequelize[_0xe8d1('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe8d1('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe8d1('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 025e830..24efd9e 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 _0xec79=['model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','length','catch','create','body','uniqueid','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','CmHopperHistory','fieldName','key'];(function(_0x41e8bc,_0x34e34a){var _0x4a9333=function(_0x175846){while(--_0x175846){_0x41e8bc['push'](_0x41e8bc['shift']());}};_0x4a9333(++_0x34e34a);}(_0xec79,0xbb));var _0x9ec7=function(_0x54b892,_0x2a3009){_0x54b892=_0x54b892-0x0;var _0x1256e1=_0xec79[_0x54b892];return _0x1256e1;};'use strict';var emlformat=require(_0x9ec7('0x0'));var rimraf=require(_0x9ec7('0x1'));var zipdir=require(_0x9ec7('0x2'));var jsonpatch=require(_0x9ec7('0x3'));var rp=require('request-promise');var moment=require(_0x9ec7('0x4'));var BPromise=require(_0x9ec7('0x5'));var Mustache=require('mustache');var util=require(_0x9ec7('0x6'));var path=require(_0x9ec7('0x7'));var sox=require(_0x9ec7('0x8'));var csv=require(_0x9ec7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ec7('0xa'));var _=require(_0x9ec7('0xb'));var squel=require(_0x9ec7('0xc'));var crypto=require(_0x9ec7('0xd'));var jsforce=require(_0x9ec7('0xe'));var deskjs=require(_0x9ec7('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9ec7('0x10'));var Papa=require(_0x9ec7('0x11'));var Redis=require('ioredis');var authService=require(_0x9ec7('0x12'));var qs=require(_0x9ec7('0x13'));var as=require(_0x9ec7('0x14'));var hardwareService=require(_0x9ec7('0x15'));var logger=require('../../config/logger')(_0x9ec7('0x16'));var utils=require('../../config/utils');var config=require(_0x9ec7('0x17'));var licenseUtil=require(_0x9ec7('0x18'));var db=require(_0x9ec7('0x19'))['db'];function respondWithStatusCode(_0x1c30d0,_0x227e02){_0x227e02=_0x227e02||0xcc;return function(_0x4f6654){if(_0x4f6654){return _0x1c30d0[_0x9ec7('0x1a')](_0x227e02);}return _0x1c30d0[_0x9ec7('0x1b')](_0x227e02)[_0x9ec7('0x1c')]();};}function respondWithResult(_0x572c1f,_0xf1540){_0xf1540=_0xf1540||0xc8;return function(_0x109264){if(_0x109264){return _0x572c1f[_0x9ec7('0x1b')](_0xf1540)[_0x9ec7('0x1d')](_0x109264);}};}function respondWithFilteredResult(_0x725a06,_0x3b655e){return function(_0x4491f3){if(_0x4491f3){var _0x224cb6=typeof _0x3b655e[_0x9ec7('0x1e')]===_0x9ec7('0x1f')&&typeof _0x3b655e[_0x9ec7('0x20')]===_0x9ec7('0x1f');var _0x39c2dc=_0x4491f3['count'];var _0x7f1620=_0x224cb6?0x0:_0x3b655e[_0x9ec7('0x1e')];var _0x26fccc=_0x224cb6?_0x4491f3[_0x9ec7('0x21')]:_0x3b655e[_0x9ec7('0x1e')]+_0x3b655e[_0x9ec7('0x20')];var _0x15f03a;if(_0x26fccc>=_0x39c2dc){_0x26fccc=_0x39c2dc;_0x15f03a=0xc8;}else{_0x15f03a=0xce;}_0x725a06['status'](_0x15f03a);return _0x725a06[_0x9ec7('0x22')](_0x9ec7('0x23'),_0x7f1620+'-'+_0x26fccc+'/'+_0x39c2dc)['json'](_0x4491f3);}return null;};}function patchUpdates(_0x305be5){return function(_0x4c7284){try{jsonpatch[_0x9ec7('0x24')](_0x4c7284,_0x305be5,!![]);}catch(_0x5c993a){return BPromise[_0x9ec7('0x25')](_0x5c993a);}return _0x4c7284[_0x9ec7('0x26')]();};}function saveUpdates(_0x123a38,_0x91810e){return function(_0x8985b0){if(_0x8985b0){return _0x8985b0[_0x9ec7('0x27')](_0x123a38)[_0x9ec7('0x28')](function(_0xa179a3){return _0xa179a3;});}return null;};}function removeEntity(_0x9664af,_0x1d171f){return function(_0x5d7dbf){if(_0x5d7dbf){return _0x5d7dbf[_0x9ec7('0x29')]()[_0x9ec7('0x28')](function(){_0x9664af[_0x9ec7('0x1b')](0xcc)[_0x9ec7('0x1c')]();});}};}function handleEntityNotFound(_0x1dd286,_0x284521){return function(_0x1e3595){if(!_0x1e3595){_0x1dd286[_0x9ec7('0x1a')](0x194);}return _0x1e3595;};}function handleError(_0x51d2be,_0x552ada){_0x552ada=_0x552ada||0x1f4;return function(_0x39f22){logger['error'](_0x39f22[_0x9ec7('0x2a')]);if(_0x39f22[_0x9ec7('0x2b')]){delete _0x39f22[_0x9ec7('0x2b')];}_0x51d2be['status'](_0x552ada)[_0x9ec7('0x2c')](_0x39f22);};}exports[_0x9ec7('0x2d')]=function(_0x629e31,_0x1f4ad0){var _0x51f39b={},_0x12d61f={},_0x265b56={'count':0x0,'rows':[]};var _0x1168e2=_[_0x9ec7('0x2e')](db[_0x9ec7('0x2f')]['rawAttributes'],function(_0x3e08c8){return{'name':_0x3e08c8[_0x9ec7('0x30')],'type':_0x3e08c8['type'][_0x9ec7('0x31')]};});_0x12d61f[_0x9ec7('0x32')]=_[_0x9ec7('0x2e')](_0x1168e2,_0x9ec7('0x2b'));_0x12d61f[_0x9ec7('0x33')]=_[_0x9ec7('0x34')](_0x629e31['query']);_0x12d61f[_0x9ec7('0x35')]=_['intersection'](_0x12d61f['model'],_0x12d61f[_0x9ec7('0x33')]);_0x51f39b[_0x9ec7('0x36')]=_[_0x9ec7('0x37')](_0x12d61f['model'],qs[_0x9ec7('0x38')](_0x629e31['query']['fields']));_0x51f39b[_0x9ec7('0x36')]=_0x51f39b['attributes']['length']?_0x51f39b[_0x9ec7('0x36')]:_0x12d61f['model'];if(!_0x629e31[_0x9ec7('0x33')][_0x9ec7('0x39')](_0x9ec7('0x3a'))){_0x51f39b['limit']=qs[_0x9ec7('0x20')](_0x629e31[_0x9ec7('0x33')][_0x9ec7('0x20')]);_0x51f39b['offset']=qs[_0x9ec7('0x1e')](_0x629e31[_0x9ec7('0x33')]['offset']);}_0x51f39b['order']=qs[_0x9ec7('0x3b')](_0x629e31[_0x9ec7('0x33')][_0x9ec7('0x3b')]);_0x51f39b[_0x9ec7('0x3c')]=qs['filters'](_[_0x9ec7('0x3d')](_0x629e31[_0x9ec7('0x33')],_0x12d61f['filters']),_0x1168e2);if(_0x629e31[_0x9ec7('0x33')][_0x9ec7('0x3e')]){_0x51f39b[_0x9ec7('0x3c')]=_[_0x9ec7('0x3f')](_0x51f39b[_0x9ec7('0x3c')],{'$or':_[_0x9ec7('0x2e')](_0x1168e2,function(_0x21df0a){if(_0x21df0a[_0x9ec7('0x40')]!==_0x9ec7('0x41')){var _0x96409e={};_0x96409e[_0x21df0a[_0x9ec7('0x2b')]]={'$like':'%'+_0x629e31[_0x9ec7('0x33')][_0x9ec7('0x3e')]+'%'};return _0x96409e;}})});}_0x51f39b=_['merge']({},_0x51f39b,_0x629e31['options']);var _0x4a7def={'where':_0x51f39b[_0x9ec7('0x3c')]};return db['CmHopperHistory']['count'](_0x4a7def)[_0x9ec7('0x28')](function(_0x46e215){_0x265b56['count']=_0x46e215;if(_0x629e31['query'][_0x9ec7('0x42')]){_0x51f39b[_0x9ec7('0x43')]=[{'all':!![]}];}return db[_0x9ec7('0x2f')][_0x9ec7('0x44')](_0x51f39b);})['then'](function(_0x25c9ab){_0x265b56[_0x9ec7('0x45')]=_0x25c9ab;return _0x265b56;})[_0x9ec7('0x28')](respondWithFilteredResult(_0x1f4ad0,_0x51f39b))['catch'](handleError(_0x1f4ad0,null));};exports[_0x9ec7('0x46')]=function(_0x1c90a3,_0x594c1a){var _0x4460cc={'raw':!![],'where':{'id':_0x1c90a3[_0x9ec7('0x47')]['id']}},_0x22b7b4={};_0x22b7b4[_0x9ec7('0x32')]=_[_0x9ec7('0x34')](db[_0x9ec7('0x2f')][_0x9ec7('0x48')]);_0x22b7b4[_0x9ec7('0x33')]=_[_0x9ec7('0x34')](_0x1c90a3['query']);_0x22b7b4[_0x9ec7('0x35')]=_['intersection'](_0x22b7b4[_0x9ec7('0x32')],_0x22b7b4[_0x9ec7('0x33')]);_0x4460cc['attributes']=_[_0x9ec7('0x37')](_0x22b7b4['model'],qs[_0x9ec7('0x38')](_0x1c90a3[_0x9ec7('0x33')][_0x9ec7('0x38')]));_0x4460cc[_0x9ec7('0x36')]=_0x4460cc[_0x9ec7('0x36')][_0x9ec7('0x49')]?_0x4460cc[_0x9ec7('0x36')]:_0x22b7b4[_0x9ec7('0x32')];if(_0x1c90a3[_0x9ec7('0x33')]['includeAll']){_0x4460cc[_0x9ec7('0x43')]=[{'all':!![]}];}_0x4460cc=_[_0x9ec7('0x3f')]({},_0x4460cc,_0x1c90a3['options']);return db['CmHopperHistory']['find'](_0x4460cc)['then'](handleEntityNotFound(_0x594c1a,null))[_0x9ec7('0x28')](respondWithResult(_0x594c1a,null))[_0x9ec7('0x4a')](handleError(_0x594c1a,null));};exports[_0x9ec7('0x4b')]=function(_0x406580,_0x1d5bc3){return db['CmHopperHistory']['create'](_0x406580[_0x9ec7('0x4c')],{})[_0x9ec7('0x28')](respondWithResult(_0x1d5bc3,0xc9))[_0x9ec7('0x4a')](handleError(_0x1d5bc3,null));};exports['describe']=function(_0x5e4291,_0x785895){return db['CmHopperHistory']['describe']()['then'](respondWithResult(_0x785895,null))[_0x9ec7('0x4a')](handleError(_0x785895,null));};exports[_0x9ec7('0x27')]=function(_0xd3732f,_0x4a1af3){if(_0xd3732f[_0x9ec7('0x4c')][_0x9ec7('0x4d')]){delete _0xd3732f[_0x9ec7('0x4c')][_0x9ec7('0x4d')];}return db['CmHopperHistory'][_0x9ec7('0x4e')]({'where':{'uniqueid':_0xd3732f[_0x9ec7('0x47')]['id']}})[_0x9ec7('0x28')](handleEntityNotFound(_0x4a1af3,null))[_0x9ec7('0x28')](saveUpdates(_0xd3732f[_0x9ec7('0x4c')],null))[_0x9ec7('0x28')](respondWithResult(_0x4a1af3,null))[_0x9ec7('0x4a')](handleError(_0x4a1af3,null));}; \ No newline at end of file +var _0x4798=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../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','error','stack','name','send','CmHopperHistory','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','describe','uniqueid','eml-format','fast-json-patch','bluebird','path','sox','ejs'];(function(_0x5ef286,_0x579a89){var _0x342516=function(_0x5e9db0){while(--_0x5e9db0){_0x5ef286['push'](_0x5ef286['shift']());}};_0x342516(++_0x579a89);}(_0x4798,0x17b));var _0x8479=function(_0x1a21ff,_0x4a7550){_0x1a21ff=_0x1a21ff-0x0;var _0x25afc1=_0x4798[_0x1a21ff];return _0x25afc1;};'use strict';var emlformat=require(_0x8479('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8479('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8479('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8479('0x3'));var sox=require(_0x8479('0x4'));var csv=require('to-csv');var ejs=require(_0x8479('0x5'));var fs=require('fs');var fs_extra=require(_0x8479('0x6'));var _=require(_0x8479('0x7'));var squel=require(_0x8479('0x8'));var crypto=require(_0x8479('0x9'));var jsforce=require(_0x8479('0xa'));var deskjs=require(_0x8479('0xb'));var toCsv=require('to-csv');var querystring=require(_0x8479('0xc'));var Papa=require(_0x8479('0xd'));var Redis=require(_0x8479('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8479('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8479('0x10'));var logger=require(_0x8479('0x11'))(_0x8479('0x12'));var utils=require(_0x8479('0x13'));var config=require(_0x8479('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8479('0x15'))['db'];function respondWithStatusCode(_0x121be3,_0x788fb5){_0x788fb5=_0x788fb5||0xcc;return function(_0x352bff){if(_0x352bff){return _0x121be3[_0x8479('0x16')](_0x788fb5);}return _0x121be3[_0x8479('0x17')](_0x788fb5)[_0x8479('0x18')]();};}function respondWithResult(_0x375519,_0x37c14a){_0x37c14a=_0x37c14a||0xc8;return function(_0x544ba0){if(_0x544ba0){return _0x375519[_0x8479('0x17')](_0x37c14a)[_0x8479('0x19')](_0x544ba0);}};}function respondWithFilteredResult(_0x1a3979,_0xd08a8b){return function(_0x1f83e2){if(_0x1f83e2){var _0x3eb743=typeof _0xd08a8b[_0x8479('0x1a')]===_0x8479('0x1b')&&typeof _0xd08a8b[_0x8479('0x1c')]===_0x8479('0x1b');var _0x5ad2d5=_0x1f83e2[_0x8479('0x1d')];var _0x40f3af=_0x3eb743?0x0:_0xd08a8b[_0x8479('0x1a')];var _0x5d2b4b=_0x3eb743?_0x1f83e2[_0x8479('0x1d')]:_0xd08a8b[_0x8479('0x1a')]+_0xd08a8b[_0x8479('0x1c')];var _0x56c65a;if(_0x5d2b4b>=_0x5ad2d5){_0x5d2b4b=_0x5ad2d5;_0x56c65a=0xc8;}else{_0x56c65a=0xce;}_0x1a3979['status'](_0x56c65a);return _0x1a3979[_0x8479('0x1e')](_0x8479('0x1f'),_0x40f3af+'-'+_0x5d2b4b+'/'+_0x5ad2d5)[_0x8479('0x19')](_0x1f83e2);}return null;};}function patchUpdates(_0x42de05){return function(_0x3d2ab4){try{jsonpatch[_0x8479('0x20')](_0x3d2ab4,_0x42de05,!![]);}catch(_0x2c3cea){return BPromise[_0x8479('0x21')](_0x2c3cea);}return _0x3d2ab4[_0x8479('0x22')]();};}function saveUpdates(_0x13424b,_0x272ab0){return function(_0x259413){if(_0x259413){return _0x259413[_0x8479('0x23')](_0x13424b)[_0x8479('0x24')](function(_0x2a3bad){return _0x2a3bad;});}return null;};}function removeEntity(_0x25f72b,_0x4fa863){return function(_0x46cbf9){if(_0x46cbf9){return _0x46cbf9['destroy']()[_0x8479('0x24')](function(){_0x25f72b[_0x8479('0x17')](0xcc)[_0x8479('0x18')]();});}};}function handleEntityNotFound(_0x3e3b8c,_0x11440b){return function(_0xd80008){if(!_0xd80008){_0x3e3b8c[_0x8479('0x16')](0x194);}return _0xd80008;};}function handleError(_0xbae01b,_0x18d15a){_0x18d15a=_0x18d15a||0x1f4;return function(_0x17f8d4){logger[_0x8479('0x25')](_0x17f8d4[_0x8479('0x26')]);if(_0x17f8d4[_0x8479('0x27')]){delete _0x17f8d4[_0x8479('0x27')];}_0xbae01b[_0x8479('0x17')](_0x18d15a)[_0x8479('0x28')](_0x17f8d4);};}exports['index']=function(_0x2dd9b4,_0x2ddb0a){var _0x36b879={},_0x5e4ff6={},_0x5ad7ba={'count':0x0,'rows':[]};var _0x5afcd2=_['map'](db[_0x8479('0x29')][_0x8479('0x2a')],function(_0xd7ccbd){return{'name':_0xd7ccbd[_0x8479('0x2b')],'type':_0xd7ccbd[_0x8479('0x2c')][_0x8479('0x2d')]};});_0x5e4ff6[_0x8479('0x2e')]=_[_0x8479('0x2f')](_0x5afcd2,'name');_0x5e4ff6[_0x8479('0x30')]=_[_0x8479('0x31')](_0x2dd9b4['query']);_0x5e4ff6[_0x8479('0x32')]=_[_0x8479('0x33')](_0x5e4ff6[_0x8479('0x2e')],_0x5e4ff6[_0x8479('0x30')]);_0x36b879[_0x8479('0x34')]=_[_0x8479('0x33')](_0x5e4ff6[_0x8479('0x2e')],qs[_0x8479('0x35')](_0x2dd9b4[_0x8479('0x30')][_0x8479('0x35')]));_0x36b879['attributes']=_0x36b879[_0x8479('0x34')]['length']?_0x36b879['attributes']:_0x5e4ff6[_0x8479('0x2e')];if(!_0x2dd9b4[_0x8479('0x30')][_0x8479('0x36')](_0x8479('0x37'))){_0x36b879[_0x8479('0x1c')]=qs[_0x8479('0x1c')](_0x2dd9b4['query'][_0x8479('0x1c')]);_0x36b879[_0x8479('0x1a')]=qs[_0x8479('0x1a')](_0x2dd9b4[_0x8479('0x30')][_0x8479('0x1a')]);}_0x36b879[_0x8479('0x38')]=qs[_0x8479('0x39')](_0x2dd9b4[_0x8479('0x30')][_0x8479('0x39')]);_0x36b879[_0x8479('0x3a')]=qs[_0x8479('0x32')](_[_0x8479('0x3b')](_0x2dd9b4[_0x8479('0x30')],_0x5e4ff6[_0x8479('0x32')]),_0x5afcd2);if(_0x2dd9b4[_0x8479('0x30')][_0x8479('0x3c')]){_0x36b879[_0x8479('0x3a')]=_[_0x8479('0x3d')](_0x36b879[_0x8479('0x3a')],{'$or':_[_0x8479('0x2f')](_0x5afcd2,function(_0x3f766){if(_0x3f766['type']!==_0x8479('0x3e')){var _0xd49cc4={};_0xd49cc4[_0x3f766[_0x8479('0x27')]]={'$like':'%'+_0x2dd9b4[_0x8479('0x30')]['filter']+'%'};return _0xd49cc4;}})});}_0x36b879=_[_0x8479('0x3d')]({},_0x36b879,_0x2dd9b4[_0x8479('0x3f')]);var _0xe33d06={'where':_0x36b879['where']};return db[_0x8479('0x29')][_0x8479('0x1d')](_0xe33d06)[_0x8479('0x24')](function(_0x254a6f){_0x5ad7ba[_0x8479('0x1d')]=_0x254a6f;if(_0x2dd9b4[_0x8479('0x30')][_0x8479('0x40')]){_0x36b879['include']=[{'all':!![]}];}return db[_0x8479('0x29')][_0x8479('0x41')](_0x36b879);})[_0x8479('0x24')](function(_0x2c5256){_0x5ad7ba[_0x8479('0x42')]=_0x2c5256;return _0x5ad7ba;})[_0x8479('0x24')](respondWithFilteredResult(_0x2ddb0a,_0x36b879))[_0x8479('0x43')](handleError(_0x2ddb0a,null));};exports[_0x8479('0x44')]=function(_0x304655,_0x4a7c28){var _0x3b3729={'raw':!![],'where':{'id':_0x304655[_0x8479('0x45')]['id']}},_0x4688d8={};_0x4688d8[_0x8479('0x2e')]=_['keys'](db[_0x8479('0x29')][_0x8479('0x2a')]);_0x4688d8['query']=_[_0x8479('0x31')](_0x304655['query']);_0x4688d8[_0x8479('0x32')]=_[_0x8479('0x33')](_0x4688d8[_0x8479('0x2e')],_0x4688d8[_0x8479('0x30')]);_0x3b3729[_0x8479('0x34')]=_[_0x8479('0x33')](_0x4688d8['model'],qs['fields'](_0x304655[_0x8479('0x30')]['fields']));_0x3b3729['attributes']=_0x3b3729[_0x8479('0x34')][_0x8479('0x46')]?_0x3b3729['attributes']:_0x4688d8[_0x8479('0x2e')];if(_0x304655[_0x8479('0x30')][_0x8479('0x40')]){_0x3b3729[_0x8479('0x47')]=[{'all':!![]}];}_0x3b3729=_[_0x8479('0x3d')]({},_0x3b3729,_0x304655[_0x8479('0x3f')]);return db[_0x8479('0x29')][_0x8479('0x48')](_0x3b3729)['then'](handleEntityNotFound(_0x4a7c28,null))[_0x8479('0x24')](respondWithResult(_0x4a7c28,null))[_0x8479('0x43')](handleError(_0x4a7c28,null));};exports[_0x8479('0x49')]=function(_0x4cbdfa,_0x309c3f){return db[_0x8479('0x29')]['create'](_0x4cbdfa[_0x8479('0x4a')],{})[_0x8479('0x24')](respondWithResult(_0x309c3f,0xc9))[_0x8479('0x43')](handleError(_0x309c3f,null));};exports[_0x8479('0x4b')]=function(_0x5a1136,_0x4772d4){return db[_0x8479('0x29')]['describe']()[_0x8479('0x24')](respondWithResult(_0x4772d4,null))[_0x8479('0x43')](handleError(_0x4772d4,null));};exports[_0x8479('0x23')]=function(_0x203443,_0x37ea81){if(_0x203443[_0x8479('0x4a')][_0x8479('0x4c')]){delete _0x203443[_0x8479('0x4a')][_0x8479('0x4c')];}return db[_0x8479('0x29')][_0x8479('0x48')]({'where':{'uniqueid':_0x203443[_0x8479('0x45')]['id']}})['then'](handleEntityNotFound(_0x37ea81,null))[_0x8479('0x24')](saveUpdates(_0x203443[_0x8479('0x4a')],null))[_0x8479('0x24')](respondWithResult(_0x37ea81,null))[_0x8479('0x43')](handleError(_0x37ea81,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 0f9e2d6..3f4a889 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 _0x0eeb=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime'];(function(_0x21205e,_0x7eb8e7){var _0x136ebb=function(_0x54aac2){while(--_0x54aac2){_0x21205e['push'](_0x21205e['shift']());}};_0x136ebb(++_0x7eb8e7);}(_0x0eeb,0xc5));var _0xb0ee=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0eeb[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb0ee('0x0'));var util=require(_0xb0ee('0x1'));var logger=require(_0xb0ee('0x2'))(_0xb0ee('0x3'));var moment=require(_0xb0ee('0x4'));var BPromise=require(_0xb0ee('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb0ee('0x6'));var config=require(_0xb0ee('0x7'));var attributes=require(_0xb0ee('0x8'));module[_0xb0ee('0x9')]=function(_0x209dda,_0x453fa4){return _0x209dda[_0xb0ee('0xa')]('CmHopperHistory',attributes,{'tableName':_0xb0ee('0xb'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xb0ee('0xc')]},{'name':_0xb0ee('0xd'),'fields':[_0xb0ee('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf0f1=['rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','util','../../config/logger','api','request-promise'];(function(_0x163b9d,_0x3480ac){var _0x328863=function(_0x2eb922){while(--_0x2eb922){_0x163b9d['push'](_0x163b9d['shift']());}};_0x328863(++_0x3480ac);}(_0xf0f1,0x110));var _0x1f0f=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0xf0f1[_0x40a825];return _0x273a54;};'use strict';var _=require('lodash');var util=require(_0x1f0f('0x0'));var logger=require(_0x1f0f('0x1'))(_0x1f0f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1f0f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f0f('0x4'));var config=require('../../config/environment');var attributes=require(_0x1f0f('0x5'));module[_0x1f0f('0x6')]=function(_0x1a88d7,_0x5934b9){return _0x1a88d7[_0x1f0f('0x7')](_0x1f0f('0x8'),attributes,{'tableName':_0x1f0f('0x9'),'paranoid':![],'indexes':[{'name':_0x1f0f('0xa'),'fields':[_0x1f0f('0xa')]},{'name':_0x1f0f('0xb'),'fields':[_0x1f0f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 2fe163d..6ff9a9d 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 _0xad95=['catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','findAll','sequelize','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','col','ivrAnswerCallsDay','lodash','util','moment','ioredis','../../mysqldb','rpc','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0x62cfe,_0x894025){var _0x3ecfda=function(_0x3169d0){while(--_0x3169d0){_0x62cfe['push'](_0x62cfe['shift']());}};_0x3ecfda(++_0x894025);}(_0xad95,0x70));var _0x5ad9=function(_0x2af827,_0x7cfc4){_0x2af827=_0x2af827-0x0;var _0x3a2b2a=_0xad95[_0x2af827];return _0x3a2b2a;};'use strict';var _=require(_0x5ad9('0x0'));var util=require(_0x5ad9('0x1'));var moment=require(_0x5ad9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ad9('0x3'));var db=require(_0x5ad9('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5ad9('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2bef4e,_0x117fde,_0x2a0915){return new BPromise(function(_0x3d937a,_0x404b33){return client['request'](_0x2bef4e,_0x2a0915)[_0x5ad9('0x6')](function(_0x4fdb7b){logger['info'](_0x5ad9('0x7'),_0x117fde,_0x5ad9('0x8'));logger[_0x5ad9('0x9')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x117fde,_0x5ad9('0x8'),JSON[_0x5ad9('0xa')](_0x4fdb7b));if(_0x4fdb7b['error']){if(_0x4fdb7b[_0x5ad9('0xb')][_0x5ad9('0xc')]===0x1f4){logger[_0x5ad9('0xb')](_0x5ad9('0x7'),_0x117fde,_0x4fdb7b[_0x5ad9('0xb')][_0x5ad9('0xd')]);return _0x404b33(_0x4fdb7b['error']['message']);}logger['error'](_0x5ad9('0x7'),_0x117fde,_0x4fdb7b[_0x5ad9('0xb')]['message']);return _0x3d937a(_0x4fdb7b[_0x5ad9('0xb')][_0x5ad9('0xd')]);}else{logger[_0x5ad9('0xe')](_0x5ad9('0x7'),_0x117fde,_0x5ad9('0x8'));_0x3d937a(_0x4fdb7b[_0x5ad9('0xf')][_0x5ad9('0xd')]);}})[_0x5ad9('0x10')](function(_0x36e61f){logger[_0x5ad9('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x117fde,_0x36e61f);_0x404b33(_0x36e61f);});});}exports[_0x5ad9('0x11')]=function(_0x54f392){var _0x3d1c8f=this;return new Promise(function(_0x28682f,_0xe4171b){return db[_0x5ad9('0x12')][_0x5ad9('0x13')](_0x54f392[_0x5ad9('0x14')],{'raw':_0x54f392[_0x5ad9('0x15')]?_0x54f392['options'][_0x5ad9('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x49363b){logger[_0x5ad9('0xe')]('CreateCmHopperHistory',_0x54f392);logger[_0x5ad9('0x9')](_0x5ad9('0x11'),_0x54f392,JSON[_0x5ad9('0xa')](_0x49363b));_0x28682f(_0x49363b);})[_0x5ad9('0x10')](function(_0x1274f7){logger['error'](_0x5ad9('0x11'),_0x1274f7['message'],_0x54f392);_0xe4171b(_0x3d1c8f[_0x5ad9('0xb')](0x1f4,_0x1274f7['message']));});});};exports['AvgHandleTime']=function(_0x524249){var _0x1502d6=this;return new Promise(function(_0x3701d8,_0x39a124){return db[_0x5ad9('0x12')][_0x5ad9('0x17')]({'raw':_0x524249[_0x5ad9('0x15')]?_0x524249[_0x5ad9('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x524249['options']?_0x524249[_0x5ad9('0x15')]['where']||null:null,'attributes':[[db[_0x5ad9('0x18')]['fn']('COUNT',db[_0x5ad9('0x18')]['col']('id')),'predictiveIntervalTotalCalls'],[db[_0x5ad9('0x18')]['fn'](_0x5ad9('0x19'),db['sequelize']['fn']('IF',db['sequelize'][_0x5ad9('0x1a')](_0x5ad9('0x1b')))),_0x5ad9('0x1c')],[db[_0x5ad9('0x18')]['fn'](_0x5ad9('0x19'),db[_0x5ad9('0x18')]['fn']('IF',db['sequelize'][_0x5ad9('0x1a')](_0x5ad9('0x1d')))),_0x5ad9('0x1e')],[db[_0x5ad9('0x18')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5ad9('0x18')][_0x5ad9('0x1a')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db['sequelize']['fn'](_0x5ad9('0x1f'),db[_0x5ad9('0x18')]['fn']('IF',db['sequelize'][_0x5ad9('0x1a')](_0x5ad9('0x20')))),_0x5ad9('0x21')],[db[_0x5ad9('0x18')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0x5ad9('0x18')][_0x5ad9('0x1a')](_0x5ad9('0x22')))),_0x5ad9('0x23')]]})[_0x5ad9('0x6')](function(_0x5b84b6){logger[_0x5ad9('0xe')](_0x5ad9('0x24'),_0x524249);logger[_0x5ad9('0x9')](_0x5ad9('0x24'),_0x524249,JSON[_0x5ad9('0xa')](_0x5b84b6));_0x3701d8(_0x5b84b6);})[_0x5ad9('0x10')](function(_0x524673){logger[_0x5ad9('0xb')](_0x5ad9('0x24'),_0x524673['message'],_0x524249);_0x39a124(_0x1502d6[_0x5ad9('0xb')](0x1f4,_0x524673[_0x5ad9('0xd')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x3de569){var _0x319b95=this;return new Promise(function(_0x12b264,_0x5b2274){return db[_0x5ad9('0x12')][_0x5ad9('0x17')]({'raw':_0x3de569[_0x5ad9('0x15')]?_0x3de569[_0x5ad9('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x3de569[_0x5ad9('0x15')]?_0x3de569[_0x5ad9('0x15')][_0x5ad9('0x25')]||null:null,'attributes':[[_0x5ad9('0x26'),_0x5ad9('0x27')],[db[_0x5ad9('0x18')]['fn'](_0x5ad9('0x19'),db[_0x5ad9('0x18')]['fn']('IF',db[_0x5ad9('0x18')]['literal'](_0x5ad9('0x28')))),_0x5ad9('0x29')],[db[_0x5ad9('0x18')]['fn'](_0x5ad9('0x19'),db[_0x5ad9('0x18')]['fn']('IF',db['sequelize'][_0x5ad9('0x1a')](_0x5ad9('0x2a')))),_0x5ad9('0x2b')],[db['sequelize']['fn'](_0x5ad9('0x19'),db[_0x5ad9('0x18')]['fn']('IF',db[_0x5ad9('0x18')]['literal'](_0x5ad9('0x1b')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0x5ad9('0x19'),db[_0x5ad9('0x18')]['fn']('IF',db[_0x5ad9('0x18')][_0x5ad9('0x1a')]('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db[_0x5ad9('0x18')]['fn']('COUNT',db[_0x5ad9('0x18')]['fn']('IF',db['sequelize'][_0x5ad9('0x1a')]('`state`\x20=\x208,\x201,\x20null'))),_0x5ad9('0x2c')],[db[_0x5ad9('0x18')]['fn'](_0x5ad9('0x19'),db[_0x5ad9('0x18')]['fn']('IF',db[_0x5ad9('0x18')][_0x5ad9('0x1a')](_0x5ad9('0x2d')))),_0x5ad9('0x2e')],[db[_0x5ad9('0x18')]['fn']('COUNT',db[_0x5ad9('0x18')]['fn']('IF',db[_0x5ad9('0x18')][_0x5ad9('0x1a')](_0x5ad9('0x2f')))),_0x5ad9('0x30')],[db['sequelize']['fn'](_0x5ad9('0x19'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x5ad9('0x31')))),_0x5ad9('0x32')],[db[_0x5ad9('0x18')]['fn']('COUNT',db[_0x5ad9('0x18')]['fn']('IF',db[_0x5ad9('0x18')][_0x5ad9('0x1a')](_0x5ad9('0x33')))),'outboundBlacklistCallsDay'],[db[_0x5ad9('0x18')]['fn'](_0x5ad9('0x19'),db[_0x5ad9('0x18')]['fn']('IF',db[_0x5ad9('0x18')]['literal'](_0x5ad9('0x34')))),_0x5ad9('0x35')],[db[_0x5ad9('0x18')]['fn'](_0x5ad9('0x19'),db[_0x5ad9('0x18')]['fn']('IF',db[_0x5ad9('0x18')][_0x5ad9('0x1a')]('`state`\x20=\x2018,\x201,\x20null'))),_0x5ad9('0x36')],[db['sequelize']['fn'](_0x5ad9('0x19'),db[_0x5ad9('0x18')]['fn']('IF',db[_0x5ad9('0x18')][_0x5ad9('0x1a')](_0x5ad9('0x37')))),_0x5ad9('0x38')],[db[_0x5ad9('0x18')]['fn'](_0x5ad9('0x19'),db[_0x5ad9('0x18')]['fn']('IF',db[_0x5ad9('0x18')][_0x5ad9('0x1a')](_0x5ad9('0x39')))),_0x5ad9('0x36')],[db[_0x5ad9('0x18')]['fn'](_0x5ad9('0x19'),db['sequelize']['fn']('IF',db[_0x5ad9('0x18')][_0x5ad9('0x1a')](_0x5ad9('0x3a')))),_0x5ad9('0x3b')]],'group':[_0x5ad9('0x26')]})[_0x5ad9('0x6')](function(_0xb5222e){logger[_0x5ad9('0xe')]('GetVoiceQueueHopperHistory',_0x3de569);logger[_0x5ad9('0x9')]('GetVoiceQueueHopperHistory',_0x3de569,JSON[_0x5ad9('0xa')](_0xb5222e));_0x12b264(_0xb5222e);})[_0x5ad9('0x10')](function(_0x469b19){logger['error'](_0x5ad9('0x3c'),_0x469b19[_0x5ad9('0xd')],_0x3de569);_0x5b2274(_0x319b95[_0x5ad9('0xb')](0x1f4,_0x469b19['message']));});});};exports[_0x5ad9('0x3d')]=function(_0x5530e1){var _0x4e2bbb=this;return new Promise(function(_0x4071aa,_0x4312b7){return db['CmHopperHistory']['findAll']({'raw':_0x5530e1[_0x5ad9('0x15')]?_0x5530e1[_0x5ad9('0x15')][_0x5ad9('0x16')]===undefined?!![]:![]:!![],'where':_0x5530e1[_0x5ad9('0x15')]?_0x5530e1[_0x5ad9('0x15')][_0x5ad9('0x25')]||null:null,'attributes':[[_0x5ad9('0x26'),_0x5ad9('0x27')],[db[_0x5ad9('0x18')]['fn']('COUNT',db[_0x5ad9('0x18')][_0x5ad9('0x3e')]('id')),'ivrTotalCallsDays'],[db[_0x5ad9('0x18')]['fn'](_0x5ad9('0x19'),db[_0x5ad9('0x18')]['fn']('IF',db['sequelize'][_0x5ad9('0x1a')](_0x5ad9('0x1b')))),_0x5ad9('0x3f')]],'group':[_0x5ad9('0x26')]})[_0x5ad9('0x6')](function(_0x2ea39d){logger[_0x5ad9('0xe')](_0x5ad9('0x3d'),_0x5530e1);logger['debug'](_0x5ad9('0x3d'),_0x5530e1,JSON[_0x5ad9('0xa')](_0x2ea39d));_0x4071aa(_0x2ea39d);})[_0x5ad9('0x10')](function(_0x2cf9d6){logger[_0x5ad9('0xb')](_0x5ad9('0x3d'),_0x2cf9d6[_0x5ad9('0xd')],_0x5530e1);_0x4312b7(_0x4e2bbb[_0x5ad9('0xb')](0x1f4,_0x2cf9d6[_0x5ad9('0xd')]));});});}; \ No newline at end of file +var _0x88f5=['sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','stringify','GetCampaignHopperHistory','where','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','then','AvgHandleTime','findAll','raw'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x88f5,0x79));var _0x588f=function(_0x487ad8,_0x52793e){_0x487ad8=_0x487ad8-0x0;var _0x221172=_0x88f5[_0x487ad8];return _0x221172;};'use strict';var _=require(_0x588f('0x0'));var util=require(_0x588f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x588f('0x2'));var fs=require('fs');var Redis=require(_0x588f('0x3'));var db=require(_0x588f('0x4'))['db'];var utils=require(_0x588f('0x5'));var logger=require('../../config/logger')(_0x588f('0x6'));var config=require(_0x588f('0x7'));var jayson=require(_0x588f('0x8'));var client=jayson[_0x588f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3dcc66,_0x1eb086,_0x34d057){return new BPromise(function(_0x2e63ca,_0x15b45a){return client[_0x588f('0xa')](_0x3dcc66,_0x34d057)['then'](function(_0x389128){logger[_0x588f('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x1eb086,'request\x20sent');logger[_0x588f('0xc')](_0x588f('0xd'),_0x1eb086,_0x588f('0xe'),JSON['stringify'](_0x389128));if(_0x389128[_0x588f('0xf')]){if(_0x389128['error'][_0x588f('0x10')]===0x1f4){logger[_0x588f('0xf')](_0x588f('0x11'),_0x1eb086,_0x389128[_0x588f('0xf')][_0x588f('0x12')]);return _0x15b45a(_0x389128['error'][_0x588f('0x12')]);}logger[_0x588f('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x1eb086,_0x389128[_0x588f('0xf')][_0x588f('0x12')]);return _0x2e63ca(_0x389128[_0x588f('0xf')]['message']);}else{logger[_0x588f('0xb')](_0x588f('0x11'),_0x1eb086,'request\x20sent');_0x2e63ca(_0x389128[_0x588f('0x13')][_0x588f('0x12')]);}})[_0x588f('0x14')](function(_0x2fe759){logger[_0x588f('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x1eb086,_0x2fe759);_0x15b45a(_0x2fe759);});});}exports[_0x588f('0x15')]=function(_0x1a1fac){var _0x3aa544=this;return new Promise(function(_0x140814,_0x5589ce){return db[_0x588f('0x16')]['create'](_0x1a1fac[_0x588f('0x17')],{'raw':_0x1a1fac[_0x588f('0x18')]?_0x1a1fac['options']['raw']===undefined?!![]:![]:!![]})[_0x588f('0x19')](function(_0x433ab3){logger[_0x588f('0xb')](_0x588f('0x15'),_0x1a1fac);logger[_0x588f('0xc')](_0x588f('0x15'),_0x1a1fac,JSON['stringify'](_0x433ab3));_0x140814(_0x433ab3);})[_0x588f('0x14')](function(_0x360475){logger['error'](_0x588f('0x15'),_0x360475['message'],_0x1a1fac);_0x5589ce(_0x3aa544[_0x588f('0xf')](0x1f4,_0x360475[_0x588f('0x12')]));});});};exports[_0x588f('0x1a')]=function(_0xe96914){var _0x534aa8=this;return new Promise(function(_0x153213,_0x16c6a9){return db[_0x588f('0x16')][_0x588f('0x1b')]({'raw':_0xe96914['options']?_0xe96914['options'][_0x588f('0x1c')]===undefined?!![]:![]:!![],'where':_0xe96914[_0x588f('0x18')]?_0xe96914[_0x588f('0x18')]['where']||null:null,'attributes':[[db[_0x588f('0x1d')]['fn']('COUNT',db[_0x588f('0x1d')][_0x588f('0x1e')]('id')),_0x588f('0x1f')],[db['sequelize']['fn'](_0x588f('0x20'),db[_0x588f('0x1d')]['fn']('IF',db[_0x588f('0x1d')][_0x588f('0x21')](_0x588f('0x22')))),_0x588f('0x23')],[db[_0x588f('0x1d')]['fn'](_0x588f('0x20'),db[_0x588f('0x1d')]['fn']('IF',db[_0x588f('0x1d')][_0x588f('0x21')](_0x588f('0x24')))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn'](_0x588f('0x20'),db['sequelize']['fn']('IF',db[_0x588f('0x1d')][_0x588f('0x21')](_0x588f('0x25')))),_0x588f('0x26')],[db[_0x588f('0x1d')]['fn'](_0x588f('0x27'),db[_0x588f('0x1d')]['fn']('IF',db[_0x588f('0x1d')][_0x588f('0x21')](_0x588f('0x28')))),_0x588f('0x29')],[db[_0x588f('0x1d')]['fn']('AVG',db[_0x588f('0x1d')]['fn']('IF',db[_0x588f('0x1d')][_0x588f('0x21')](_0x588f('0x2a')))),_0x588f('0x2b')]]})[_0x588f('0x19')](function(_0x399395){logger['info'](_0x588f('0x1a'),_0xe96914);logger[_0x588f('0xc')](_0x588f('0x1a'),_0xe96914,JSON['stringify'](_0x399395));_0x153213(_0x399395);})[_0x588f('0x14')](function(_0x3b6f77){logger['error']('AvgHandleTime',_0x3b6f77[_0x588f('0x12')],_0xe96914);_0x16c6a9(_0x534aa8[_0x588f('0xf')](0x1f4,_0x3b6f77[_0x588f('0x12')]));});});};exports[_0x588f('0x2c')]=function(_0x5bc965){var _0x1e5279=this;return new Promise(function(_0x287bda,_0x3eff69){return db[_0x588f('0x16')][_0x588f('0x1b')]({'raw':_0x5bc965[_0x588f('0x18')]?_0x5bc965[_0x588f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5bc965[_0x588f('0x18')]?_0x5bc965[_0x588f('0x18')]['where']||null:null,'attributes':[[_0x588f('0x2d'),_0x588f('0x2e')],[db['sequelize']['fn'](_0x588f('0x20'),db[_0x588f('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x588f('0x2f')))),_0x588f('0x30')],[db[_0x588f('0x1d')]['fn'](_0x588f('0x20'),db[_0x588f('0x1d')]['fn']('IF',db[_0x588f('0x1d')][_0x588f('0x21')](_0x588f('0x31')))),'outboundNoAnswerCallsDay'],[db[_0x588f('0x1d')]['fn'](_0x588f('0x20'),db[_0x588f('0x1d')]['fn']('IF',db[_0x588f('0x1d')][_0x588f('0x21')](_0x588f('0x22')))),_0x588f('0x32')],[db[_0x588f('0x1d')]['fn'](_0x588f('0x20'),db[_0x588f('0x1d')]['fn']('IF',db[_0x588f('0x1d')][_0x588f('0x21')](_0x588f('0x33')))),_0x588f('0x34')],[db[_0x588f('0x1d')]['fn'](_0x588f('0x20'),db[_0x588f('0x1d')]['fn']('IF',db[_0x588f('0x1d')][_0x588f('0x21')](_0x588f('0x35')))),_0x588f('0x36')],[db[_0x588f('0x1d')]['fn'](_0x588f('0x20'),db['sequelize']['fn']('IF',db[_0x588f('0x1d')][_0x588f('0x21')](_0x588f('0x37')))),_0x588f('0x38')],[db[_0x588f('0x1d')]['fn'](_0x588f('0x20'),db[_0x588f('0x1d')]['fn']('IF',db[_0x588f('0x1d')][_0x588f('0x21')](_0x588f('0x39')))),_0x588f('0x3a')],[db[_0x588f('0x1d')]['fn'](_0x588f('0x20'),db[_0x588f('0x1d')]['fn']('IF',db[_0x588f('0x1d')][_0x588f('0x21')](_0x588f('0x3b')))),_0x588f('0x3c')],[db['sequelize']['fn'](_0x588f('0x20'),db[_0x588f('0x1d')]['fn']('IF',db[_0x588f('0x1d')]['literal'](_0x588f('0x3d')))),_0x588f('0x3e')],[db[_0x588f('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x588f('0x1d')][_0x588f('0x21')](_0x588f('0x3f')))),'outboundOriginateFailureCallsDay'],[db[_0x588f('0x1d')]['fn']('COUNT',db[_0x588f('0x1d')]['fn']('IF',db[_0x588f('0x1d')]['literal'](_0x588f('0x40')))),_0x588f('0x41')],[db[_0x588f('0x1d')]['fn'](_0x588f('0x20'),db[_0x588f('0x1d')]['fn']('IF',db['sequelize'][_0x588f('0x21')]('`state`\x20=\x2016,\x201,\x20null'))),_0x588f('0x42')],[db[_0x588f('0x1d')]['fn'](_0x588f('0x20'),db[_0x588f('0x1d')]['fn']('IF',db['sequelize'][_0x588f('0x21')](_0x588f('0x43')))),_0x588f('0x41')],[db[_0x588f('0x1d')]['fn'](_0x588f('0x20'),db[_0x588f('0x1d')]['fn']('IF',db[_0x588f('0x1d')]['literal'](_0x588f('0x44')))),_0x588f('0x45')]],'group':['campaign']})['then'](function(_0x196f75){logger[_0x588f('0xb')](_0x588f('0x2c'),_0x5bc965);logger[_0x588f('0xc')](_0x588f('0x2c'),_0x5bc965,JSON[_0x588f('0x46')](_0x196f75));_0x287bda(_0x196f75);})['catch'](function(_0x102586){logger[_0x588f('0xf')](_0x588f('0x2c'),_0x102586['message'],_0x5bc965);_0x3eff69(_0x1e5279[_0x588f('0xf')](0x1f4,_0x102586['message']));});});};exports[_0x588f('0x47')]=function(_0x4eb373){var _0x327bd9=this;return new Promise(function(_0x5997a6,_0x30f902){return db['CmHopperHistory'][_0x588f('0x1b')]({'raw':_0x4eb373[_0x588f('0x18')]?_0x4eb373[_0x588f('0x18')][_0x588f('0x1c')]===undefined?!![]:![]:!![],'where':_0x4eb373[_0x588f('0x18')]?_0x4eb373['options'][_0x588f('0x48')]||null:null,'attributes':[[_0x588f('0x2d'),_0x588f('0x2e')],[db[_0x588f('0x1d')]['fn'](_0x588f('0x20'),db[_0x588f('0x1d')][_0x588f('0x1e')]('id')),_0x588f('0x49')],[db['sequelize']['fn'](_0x588f('0x20'),db[_0x588f('0x1d')]['fn']('IF',db[_0x588f('0x1d')][_0x588f('0x21')](_0x588f('0x22')))),_0x588f('0x4a')]],'group':[_0x588f('0x2d')]})[_0x588f('0x19')](function(_0x5a31da){logger[_0x588f('0xb')]('GetCampaignHopperHistory',_0x4eb373);logger['debug'](_0x588f('0x47'),_0x4eb373,JSON[_0x588f('0x46')](_0x5a31da));_0x5997a6(_0x5a31da);})['catch'](function(_0x5616c6){logger[_0x588f('0xf')]('GetCampaignHopperHistory',_0x5616c6['message'],_0x4eb373);_0x30f902(_0x327bd9[_0x588f('0xf')](0x1f4,_0x5616c6[_0x588f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index cb1b7ea..afd1189 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 _0x6ead=['./cmHopperHistory.controller','get','index','/describe','describe','/:id','isAuthenticated','create','put','update','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3c0b6d,_0x17d35c){var _0x5346e0=function(_0x2af299){while(--_0x2af299){_0x3c0b6d['push'](_0x3c0b6d['shift']());}};_0x5346e0(++_0x17d35c);}(_0x6ead,0x1b4));var _0xd6ea=function(_0x11a0ed,_0x137726){_0x11a0ed=_0x11a0ed-0x0;var _0x1db38c=_0x6ead[_0x11a0ed];return _0x1db38c;};'use strict';var multer=require(_0xd6ea('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd6ea('0x1'));var express=require(_0xd6ea('0x2'));var router=express[_0xd6ea('0x3')]();var fs_extra=require(_0xd6ea('0x4'));var auth=require(_0xd6ea('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd6ea('0x6'));router[_0xd6ea('0x7')]('/',auth['isAuthenticated'](),controller[_0xd6ea('0x8')]);router['get'](_0xd6ea('0x9'),auth['isAuthenticated'](),controller[_0xd6ea('0xa')]);router[_0xd6ea('0x7')](_0xd6ea('0xb'),auth[_0xd6ea('0xc')](),controller['show']);router['post']('/',auth[_0xd6ea('0xc')](),controller[_0xd6ea('0xd')]);router[_0xd6ea('0xe')](_0xd6ea('0xb'),auth[_0xd6ea('0xc')](),controller[_0xd6ea('0xf')]);module[_0xd6ea('0x10')]=router; \ No newline at end of file +var _0x803f=['exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','index','/describe','describe','/:id','isAuthenticated','post','create'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x803f,0x171));var _0xf803=function(_0x485ec3,_0x5bddfa){_0x485ec3=_0x485ec3-0x0;var _0xa3cfe=_0x803f[_0x485ec3];return _0xa3cfe;};'use strict';var multer=require(_0xf803('0x0'));var util=require(_0xf803('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf803('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf803('0x3'));var interaction=require(_0xf803('0x4'));var config=require(_0xf803('0x5'));var controller=require(_0xf803('0x6'));router[_0xf803('0x7')]('/',auth['isAuthenticated'](),controller[_0xf803('0x8')]);router[_0xf803('0x7')](_0xf803('0x9'),auth['isAuthenticated'](),controller[_0xf803('0xa')]);router[_0xf803('0x7')](_0xf803('0xb'),auth[_0xf803('0xc')](),controller['show']);router[_0xf803('0xd')]('/',auth['isAuthenticated'](),controller[_0xf803('0xe')]);router['put'](_0xf803('0xb'),auth[_0xf803('0xc')](),controller['update']);module[_0xf803('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index da8648c..5452209 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 _0x4016=['STRING','exports'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x4016,0x131));var _0x6401=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x4016[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x6401('0x0')]={'name':{'type':Sequelize[_0x6401('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x34aa=['sequelize','STRING','name'];(function(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0x34aa,0x171));var _0xa34a=function(_0x52ea08,_0x15d935){_0x52ea08=_0x52ea08-0x0;var _0x28d546=_0x34aa[_0x52ea08];return _0x28d546;};'use strict';var Sequelize=require(_0xa34a('0x0'));module['exports']={'name':{'type':Sequelize[_0xa34a('0x1')],'unique':_0xa34a('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa34a('0x1')]},'dialPrefix':{'type':Sequelize[_0xa34a('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index f458f4f..b12ad32 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 _0x7777=['cf_%s','getCustomFields','findAndCountAll','addAgents','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','destroy','Lists','UserProfileResource','stack','name','index','CmList','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','includeAll','findAll','rows','catch','params','keys','include','options','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','Disposition','getDispositions','findOne','ListId','merge','ids','addContacts','CmContact','tags','isArray','join','length','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','CustomFields','concat','format','cf_%d','raw','getContacts','getContactsCsv','CmCustomField','nolimit','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','queryInterface','cm_contacts'];(function(_0x147f41,_0x40fa1a){var _0x7ab7ec=function(_0x5d2828){while(--_0x5d2828){_0x147f41['push'](_0x147f41['shift']());}};_0x7ab7ec(++_0x40fa1a);}(_0x7777,0x9c));var _0x7777=function(_0x3513e2,_0x26f645){_0x3513e2=_0x3513e2-0x0;var _0x186e8f=_0x7777[_0x3513e2];return _0x186e8f;};'use strict';var emlformat=require(_0x7777('0x0'));var rimraf=require(_0x7777('0x1'));var zipdir=require(_0x7777('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7777('0x3'));var moment=require(_0x7777('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7777('0x5'));var util=require(_0x7777('0x6'));var path=require(_0x7777('0x7'));var sox=require(_0x7777('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7777('0x9'));var _=require(_0x7777('0xa'));var squel=require(_0x7777('0xb'));var crypto=require(_0x7777('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7777('0xd'));var toCsv=require(_0x7777('0xe'));var querystring=require(_0x7777('0xf'));var Papa=require(_0x7777('0x10'));var Redis=require(_0x7777('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7777('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7777('0x13'))('api');var utils=require(_0x7777('0x14'));var config=require(_0x7777('0x15'));var licenseUtil=require(_0x7777('0x16'));var db=require(_0x7777('0x17'))['db'];config['redis']=_[_0x7777('0x18')](config[_0x7777('0x19')],{'host':_0x7777('0x1a'),'port':0x18eb});var socket=require(_0x7777('0x1b'))(new Redis(config[_0x7777('0x19')]));require(_0x7777('0x1c'))[_0x7777('0x1d')](socket);function respondWithStatusCode(_0x453899,_0x2040cf){_0x2040cf=_0x2040cf||0xcc;return function(_0x5ed418){if(_0x5ed418){return _0x453899[_0x7777('0x1e')](_0x2040cf);}return _0x453899[_0x7777('0x1f')](_0x2040cf)[_0x7777('0x20')]();};}function respondWithResult(_0x298230,_0x59ba67){_0x59ba67=_0x59ba67||0xc8;return function(_0x4c88f0){if(_0x4c88f0){return _0x298230[_0x7777('0x1f')](_0x59ba67)['json'](_0x4c88f0);}};}function respondWithFilteredResult(_0x27ae17,_0x3405d0){return function(_0x48a689){if(_0x48a689){var _0x20b80d=typeof _0x3405d0[_0x7777('0x21')]===_0x7777('0x22')&&typeof _0x3405d0[_0x7777('0x23')]===_0x7777('0x22');var _0x1cdb89=_0x48a689[_0x7777('0x24')];var _0x42a4a7=_0x20b80d?0x0:_0x3405d0['offset'];var _0xb57b22=_0x20b80d?_0x48a689[_0x7777('0x24')]:_0x3405d0[_0x7777('0x21')]+_0x3405d0[_0x7777('0x23')];var _0x538ed7;if(_0xb57b22>=_0x1cdb89){_0xb57b22=_0x1cdb89;_0x538ed7=0xc8;}else{_0x538ed7=0xce;}_0x27ae17[_0x7777('0x1f')](_0x538ed7);return _0x27ae17[_0x7777('0x25')](_0x7777('0x26'),_0x42a4a7+'-'+_0xb57b22+'/'+_0x1cdb89)[_0x7777('0x27')](_0x48a689);}return null;};}function patchUpdates(_0x2a037f){return function(_0x4d49c7){try{jsonpatch[_0x7777('0x28')](_0x4d49c7,_0x2a037f,!![]);}catch(_0x75e8ba){return BPromise['reject'](_0x75e8ba);}return _0x4d49c7['save']();};}function saveUpdates(_0x1af4f9,_0x710c22){return function(_0x109c2d){if(_0x109c2d){return _0x109c2d[_0x7777('0x29')](_0x1af4f9)[_0x7777('0x2a')](function(_0x3fdc2f){return _0x3fdc2f;});}return null;};}function removeEntity(_0xeeefb9,_0x42d7a1){return function(_0x379245){if(_0x379245){return _0x379245[_0x7777('0x2b')]()[_0x7777('0x2a')](function(){var _0x4058c0=_0x379245['get']({'plain':!![]});var _0x4f7a64=_0x7777('0x2c');return db[_0x7777('0x2d')][_0x7777('0x2b')]({'where':{'type':_0x4f7a64,'resourceId':_0x4058c0['id']}})['then'](function(){return _0x379245;});})[_0x7777('0x2a')](function(){_0xeeefb9['status'](0xcc)[_0x7777('0x20')]();});}};}function handleEntityNotFound(_0xe5bae6,_0x24a20e){return function(_0x42e530){if(!_0x42e530){_0xe5bae6['sendStatus'](0x194);}return _0x42e530;};}function handleError(_0x15c671,_0x3e3b9b){_0x3e3b9b=_0x3e3b9b||0x1f4;return function(_0x47e9ed){logger['error'](_0x47e9ed[_0x7777('0x2e')]);if(_0x47e9ed[_0x7777('0x2f')]){delete _0x47e9ed[_0x7777('0x2f')];}_0x15c671[_0x7777('0x1f')](_0x3e3b9b)['send'](_0x47e9ed);};}exports[_0x7777('0x30')]=function(_0x172379,_0x194630){var _0x2bce4a={},_0x396a62={},_0x205bc5={'count':0x0,'rows':[]};var _0x5dbf5b=_['map'](db[_0x7777('0x31')][_0x7777('0x32')],function(_0x4173af){return{'name':_0x4173af[_0x7777('0x33')],'type':_0x4173af[_0x7777('0x34')][_0x7777('0x35')]};});_0x396a62[_0x7777('0x36')]=_[_0x7777('0x37')](_0x5dbf5b,_0x7777('0x2f'));_0x396a62[_0x7777('0x38')]=_['keys'](_0x172379[_0x7777('0x38')]);_0x396a62[_0x7777('0x39')]=_[_0x7777('0x3a')](_0x396a62[_0x7777('0x36')],_0x396a62[_0x7777('0x38')]);_0x2bce4a[_0x7777('0x3b')]=_[_0x7777('0x3a')](_0x396a62[_0x7777('0x36')],qs[_0x7777('0x3c')](_0x172379[_0x7777('0x38')][_0x7777('0x3c')]));_0x2bce4a['attributes']=_0x2bce4a[_0x7777('0x3b')]['length']?_0x2bce4a[_0x7777('0x3b')]:_0x396a62[_0x7777('0x36')];if(!_0x172379['query'][_0x7777('0x3d')]('nolimit')){_0x2bce4a['limit']=qs['limit'](_0x172379['query'][_0x7777('0x23')]);_0x2bce4a[_0x7777('0x21')]=qs[_0x7777('0x21')](_0x172379[_0x7777('0x38')]['offset']);}_0x2bce4a[_0x7777('0x3e')]=qs[_0x7777('0x3f')](_0x172379[_0x7777('0x38')][_0x7777('0x3f')]);_0x2bce4a[_0x7777('0x40')]=qs[_0x7777('0x39')](_[_0x7777('0x41')](_0x172379[_0x7777('0x38')],_0x396a62[_0x7777('0x39')]),_0x5dbf5b);if(_0x172379[_0x7777('0x38')][_0x7777('0x42')]){_0x2bce4a[_0x7777('0x40')]=_['merge'](_0x2bce4a['where'],{'$or':_['map'](_0x5dbf5b,function(_0x3fba5c){if(_0x3fba5c[_0x7777('0x34')]!=='VIRTUAL'){var _0x3cea54={};_0x3cea54[_0x3fba5c[_0x7777('0x2f')]]={'$like':'%'+_0x172379[_0x7777('0x38')][_0x7777('0x42')]+'%'};return _0x3cea54;}})});}_0x2bce4a=_['merge']({},_0x2bce4a,_0x172379['options']);var _0x281c51={'where':_0x2bce4a[_0x7777('0x40')]};return db[_0x7777('0x31')][_0x7777('0x24')](_0x281c51)[_0x7777('0x2a')](function(_0x418ac1){_0x205bc5['count']=_0x418ac1;if(_0x172379[_0x7777('0x38')][_0x7777('0x43')]){_0x2bce4a['include']=[{'all':!![]}];}return db['CmList'][_0x7777('0x44')](_0x2bce4a);})[_0x7777('0x2a')](function(_0x344c19){_0x205bc5[_0x7777('0x45')]=_0x344c19;return _0x205bc5;})[_0x7777('0x2a')](respondWithFilteredResult(_0x194630,_0x2bce4a))[_0x7777('0x46')](handleError(_0x194630,null));};exports['show']=function(_0x1ab689,_0x2dfe2a){var _0x3f9198={'raw':![],'where':{'id':_0x1ab689[_0x7777('0x47')]['id']}},_0x2dbae0={};_0x2dbae0[_0x7777('0x36')]=_[_0x7777('0x48')](db[_0x7777('0x31')][_0x7777('0x32')]);_0x2dbae0[_0x7777('0x38')]=_[_0x7777('0x48')](_0x1ab689[_0x7777('0x38')]);_0x2dbae0['filters']=_[_0x7777('0x3a')](_0x2dbae0[_0x7777('0x36')],_0x2dbae0[_0x7777('0x38')]);_0x3f9198[_0x7777('0x3b')]=_[_0x7777('0x3a')](_0x2dbae0[_0x7777('0x36')],qs[_0x7777('0x3c')](_0x1ab689['query']['fields']));_0x3f9198[_0x7777('0x3b')]=_0x3f9198[_0x7777('0x3b')]['length']?_0x3f9198[_0x7777('0x3b')]:_0x2dbae0[_0x7777('0x36')];if(_0x1ab689['query'][_0x7777('0x43')]){_0x3f9198[_0x7777('0x49')]=[{'all':!![]}];}_0x3f9198=_['merge']({},_0x3f9198,_0x1ab689[_0x7777('0x4a')]);return db[_0x7777('0x31')][_0x7777('0x4b')](_0x3f9198)[_0x7777('0x2a')](handleEntityNotFound(_0x2dfe2a,null))[_0x7777('0x2a')](respondWithResult(_0x2dfe2a,null))[_0x7777('0x46')](handleError(_0x2dfe2a,null));};exports[_0x7777('0x4c')]=function(_0x180268,_0x4bf0bd){return db[_0x7777('0x31')][_0x7777('0x4c')](_0x180268['body'],{})[_0x7777('0x2a')](function(_0x478925){var _0x50f0f6=_0x180268['user'][_0x7777('0x4d')]({'plain':!![]});if(!_0x50f0f6)throw new Error(_0x7777('0x4e'));if(_0x50f0f6[_0x7777('0x4f')]==='user'){var _0x12eb62=_0x478925[_0x7777('0x4d')]({'plain':!![]});var _0x182f05=_0x7777('0x2c');return db[_0x7777('0x50')]['find']({'where':{'name':_0x182f05,'userProfileId':_0x50f0f6[_0x7777('0x51')]},'raw':!![]})['then'](function(_0x1c7c5b){if(_0x1c7c5b&&_0x1c7c5b[_0x7777('0x52')]===0x0){return db[_0x7777('0x2d')][_0x7777('0x4c')]({'name':_0x12eb62[_0x7777('0x2f')],'resourceId':_0x12eb62['id'],'type':_0x1c7c5b[_0x7777('0x2f')],'sectionId':_0x1c7c5b['id']},{})['then'](function(){return _0x478925;});}else{return _0x478925;}})['catch'](function(_0x5bea00){logger['error'](_0x7777('0x53'),_0x5bea00);throw _0x5bea00;});}return _0x478925;})[_0x7777('0x2a')](respondWithResult(_0x4bf0bd,0xc9))[_0x7777('0x46')](handleError(_0x4bf0bd,null));};exports[_0x7777('0x29')]=function(_0x2f26a7,_0x29c5b2){if(_0x2f26a7['body']['id']){delete _0x2f26a7[_0x7777('0x54')]['id'];}return db[_0x7777('0x31')]['find']({'where':{'id':_0x2f26a7[_0x7777('0x47')]['id']}})[_0x7777('0x2a')](handleEntityNotFound(_0x29c5b2,null))[_0x7777('0x2a')](saveUpdates(_0x2f26a7[_0x7777('0x54')],null))[_0x7777('0x2a')](respondWithResult(_0x29c5b2,null))['catch'](handleError(_0x29c5b2,null));};exports[_0x7777('0x2b')]=function(_0x3ba02e,_0x581977){return db['CmList']['find']({'where':{'id':_0x3ba02e[_0x7777('0x47')]['id']}})['then'](handleEntityNotFound(_0x581977,null))[_0x7777('0x2a')](removeEntity(_0x581977,null))['catch'](handleError(_0x581977,null));};exports[_0x7777('0x55')]=function(_0x507a93,_0x382458){return db[_0x7777('0x31')][_0x7777('0x55')]()[_0x7777('0x2a')](respondWithResult(_0x382458,null))['catch'](handleError(_0x382458,null));};exports['addDisposition']=function(_0x9ba2b9,_0x1472a7,_0x52334b){if(_0x9ba2b9[_0x7777('0x54')]['id']){delete _0x9ba2b9[_0x7777('0x54')]['id'];}return db[_0x7777('0x31')][_0x7777('0x4b')]({'where':{'id':_0x9ba2b9[_0x7777('0x47')]['id']}})[_0x7777('0x2a')](handleEntityNotFound(_0x1472a7,null))[_0x7777('0x2a')](function(_0x39b511){if(_0x39b511){_0x9ba2b9['body']['ListId']=_0x39b511['id'];return db[_0x7777('0x56')][_0x7777('0x4c')](_0x9ba2b9[_0x7777('0x54')]);}})['then'](respondWithResult(_0x1472a7,null))[_0x7777('0x46')](handleError(_0x1472a7,null));};exports[_0x7777('0x57')]=function(_0x55c80e,_0x47e872,_0x321b28){var _0x555d26={'raw':![],'where':{}};var _0x4d52ea={};var _0x4fb0f6={'count':0x0,'rows':[]};return db[_0x7777('0x31')][_0x7777('0x58')]({'where':{'id':_0x55c80e[_0x7777('0x47')]['id']}})[_0x7777('0x2a')](handleEntityNotFound(_0x47e872,null))['then'](function(_0x5696b4){if(_0x5696b4){_0x4d52ea[_0x7777('0x36')]=_[_0x7777('0x48')](db[_0x7777('0x56')]['rawAttributes']);_0x4d52ea[_0x7777('0x38')]=_[_0x7777('0x48')](_0x55c80e[_0x7777('0x38')]);_0x4d52ea[_0x7777('0x39')]=_[_0x7777('0x3a')](_0x4d52ea[_0x7777('0x36')],_0x4d52ea[_0x7777('0x38')]);_0x555d26[_0x7777('0x3b')]=_[_0x7777('0x3a')](_0x4d52ea['model'],qs[_0x7777('0x3c')](_0x55c80e['query'][_0x7777('0x3c')]));_0x555d26[_0x7777('0x3b')]=_0x555d26[_0x7777('0x3b')]['length']?_0x555d26['attributes']:_0x4d52ea[_0x7777('0x36')];if(!_0x55c80e[_0x7777('0x38')]['hasOwnProperty']('nolimit')){_0x555d26['limit']=qs[_0x7777('0x23')](_0x55c80e[_0x7777('0x38')][_0x7777('0x23')]);_0x555d26[_0x7777('0x21')]=qs[_0x7777('0x21')](_0x55c80e[_0x7777('0x38')][_0x7777('0x21')]);}_0x555d26[_0x7777('0x3e')]=qs[_0x7777('0x3f')](_0x55c80e[_0x7777('0x38')]['sort']);_0x555d26['where']=qs[_0x7777('0x39')](_['pick'](_0x55c80e[_0x7777('0x38')],_0x4d52ea[_0x7777('0x39')]));_0x555d26[_0x7777('0x40')][_0x7777('0x59')]=_0x5696b4['id'];if(_0x55c80e[_0x7777('0x38')][_0x7777('0x42')]){_0x555d26[_0x7777('0x40')]=_[_0x7777('0x5a')](_0x555d26[_0x7777('0x40')],{'$or':_['map'](_0x555d26['attributes'],function(_0x5b953d){var _0x1710a6={};_0x1710a6[_0x5b953d]={'$like':'%'+_0x55c80e[_0x7777('0x38')]['filter']+'%'};return _0x1710a6;})});}_0x555d26=_[_0x7777('0x5a')]({},_0x555d26,_0x55c80e[_0x7777('0x4a')]);return db[_0x7777('0x56')][_0x7777('0x24')]({'where':_0x555d26[_0x7777('0x40')]})[_0x7777('0x2a')](function(_0x11c0e7){_0x4fb0f6['count']=_0x11c0e7;if(_0x55c80e[_0x7777('0x38')][_0x7777('0x43')]){_0x555d26[_0x7777('0x49')]=[{'all':!![]}];}return db['Disposition'][_0x7777('0x44')](_0x555d26);})[_0x7777('0x2a')](function(_0xd978f){_0x4fb0f6[_0x7777('0x45')]=_0xd978f;return _0x4fb0f6;});}})[_0x7777('0x2a')](respondWithFilteredResult(_0x47e872,_0x555d26))[_0x7777('0x46')](handleError(_0x47e872,null));};exports['removeDispositions']=function(_0x3dd929,_0xb838cd,_0x28cfea){return db[_0x7777('0x31')]['find']({'where':{'id':_0x3dd929[_0x7777('0x47')]['id']}})[_0x7777('0x2a')](handleEntityNotFound(_0xb838cd,null))['then'](function(_0x42f6e6){if(_0x42f6e6){return _0x42f6e6['removeDispositions'](_0x3dd929[_0x7777('0x38')][_0x7777('0x5b')]);}})['then'](respondWithStatusCode(_0xb838cd,null))['catch'](handleError(_0xb838cd,null));};exports[_0x7777('0x5c')]=function(_0x14213b,_0x2f5328,_0x4234c5){return db[_0x7777('0x31')]['find']({'where':{'id':_0x14213b[_0x7777('0x47')]['id']}})['then'](handleEntityNotFound(_0x2f5328,null))[_0x7777('0x2a')](function(_0x3f2011){if(_0x3f2011){var _0x1bdc1e=[];var _0x52a6b9={'success':[],'errors':[]};return db[_0x7777('0x5d')]['describe']()[_0x7777('0x2a')](function(_0x5bfc38){if(_0x14213b[_0x7777('0x54')][_0x7777('0x5e')]&&_[_0x7777('0x5f')](_0x14213b['body']['tags'])){if(_0x14213b[_0x7777('0x54')][_0x7777('0x5e')]['length']){_0x14213b[_0x7777('0x54')][_0x7777('0x5e')]=_0x14213b[_0x7777('0x54')][_0x7777('0x5e')][_0x7777('0x60')](';')+';';}else{_0x14213b[_0x7777('0x54')][_0x7777('0x5e')]=null;}}else{_0x14213b[_0x7777('0x54')][_0x7777('0x5e')]=null;}if(_0x14213b[_0x7777('0x54')]&&_[_0x7777('0x5f')](_0x14213b[_0x7777('0x54')])){for(var _0x9d9a3c=0x0;_0x9d9a3c<_0x14213b[_0x7777('0x54')][_0x7777('0x61')];_0x9d9a3c+=0x1){_0x14213b[_0x7777('0x54')][_0x9d9a3c][_0x7777('0x59')]=_0x14213b[_0x7777('0x47')]['id'];_0x1bdc1e[_0x7777('0x62')](_0x14213b[_0x7777('0x54')][_0x9d9a3c]);}return BPromise[_0x7777('0x63')](_0x1bdc1e,function(_0x4294b3){return db['CmContact'][_0x7777('0x4c')](_[_0x7777('0x64')](_0x4294b3,[_0x7777('0x5b'),'id'])||{},{'fields':_['keys'](_0x5bfc38),'raw':!![]})['then'](function(_0x5ea8a3){_0x52a6b9[_0x7777('0x65')]['push'](_0x5ea8a3[_0x7777('0x66')]);})[_0x7777('0x46')](function(_0x55a736){_0x52a6b9[_0x7777('0x67')][_0x7777('0x62')]({'data':_0x4294b3,'error':_0x55a736[_0x7777('0x68')]});});})[_0x7777('0x2a')](function(_0x55764b){return _0x52a6b9;})['catch'](function(_0x42be16){return _0x42be16;});}else{_0x2f5328['status'](0x190)[_0x7777('0x27')]({'message':_0x7777('0x69')});}});}})[_0x7777('0x2a')](respondWithResult(_0x2f5328,null))['catch'](handleError(_0x2f5328,null));};exports['getContacts']=function(_0x8b5b64,_0x56f47d,_0x236f5b){var _0x3c95d9;return db[_0x7777('0x31')][_0x7777('0x4b')]({'where':{'id':_0x8b5b64['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x7777('0x6a')}]})[_0x7777('0x2a')](handleEntityNotFound(_0x56f47d,null))['then'](function(_0x24578d){if(_0x24578d){_0x3c95d9=_0x24578d;return db[_0x7777('0x5d')][_0x7777('0x32')];}})[_0x7777('0x2a')](function(_0x2d7673){if(_0x2d7673){var _0x53b438={};var _0xf8dabb={};_0xf8dabb[_0x7777('0x36')]=_[_0x7777('0x6b')](_[_0x7777('0x48')](_0x2d7673),_[_0x7777('0x37')](_0x3c95d9[_0x7777('0x6a')],function(_0x138142){return util[_0x7777('0x6c')](_0x7777('0x6d'),_0x138142['id']);}));_0xf8dabb[_0x7777('0x38')]=_['keys'](_0x8b5b64[_0x7777('0x38')]);_0xf8dabb[_0x7777('0x39')]=_[_0x7777('0x3a')](_0xf8dabb[_0x7777('0x36')],_0xf8dabb[_0x7777('0x38')]);_0x53b438[_0x7777('0x3b')]=_[_0x7777('0x3a')](_0xf8dabb[_0x7777('0x36')],qs[_0x7777('0x3c')](_0x8b5b64['query'][_0x7777('0x3c')]));_0x53b438[_0x7777('0x3b')]=_0x53b438[_0x7777('0x3b')][_0x7777('0x61')]?_0x53b438[_0x7777('0x3b')]:_0xf8dabb[_0x7777('0x36')];if(!_0x8b5b64[_0x7777('0x38')][_0x7777('0x3d')]('nolimit')){_0x53b438[_0x7777('0x23')]=qs[_0x7777('0x23')](_0x8b5b64[_0x7777('0x38')][_0x7777('0x23')]);_0x53b438[_0x7777('0x21')]=qs[_0x7777('0x21')](_0x8b5b64[_0x7777('0x38')][_0x7777('0x21')]);}_0x53b438['order']=qs[_0x7777('0x3f')](_0x8b5b64['query'][_0x7777('0x3f')]);_0x53b438['where']=qs[_0x7777('0x39')](_[_0x7777('0x41')](_0x8b5b64[_0x7777('0x38')],_0xf8dabb['filters']));_0x53b438[_0x7777('0x6e')]=!![];if(_0x8b5b64['query']['filter']){_0x53b438[_0x7777('0x40')]=_[_0x7777('0x5a')](_0x53b438[_0x7777('0x40')],{'$or':_[_0x7777('0x37')](_0x53b438[_0x7777('0x3b')],function(_0x4f9418){var _0x187e7c={};_0x187e7c[_0x4f9418]={'$like':'%'+_0x8b5b64[_0x7777('0x38')][_0x7777('0x42')]+'%'};return _0x187e7c;})});}_0x53b438=_['merge']({},_0x53b438,_0x8b5b64['options']);return _0x3c95d9[_0x7777('0x6f')](_0x53b438);}})[_0x7777('0x2a')](respondWithResult(_0x56f47d,null))[_0x7777('0x46')](handleError(_0x56f47d,null));};exports[_0x7777('0x70')]=function(_0x447121,_0x22cce,_0x2c2a0d){var _0x3ee85d;return db[_0x7777('0x31')][_0x7777('0x4b')]({'where':{'id':_0x447121[_0x7777('0x47')]['id']},'include':[{'model':db[_0x7777('0x71')],'as':_0x7777('0x6a')}]})[_0x7777('0x2a')](handleEntityNotFound(_0x22cce,null))['then'](function(_0x371ee9){if(_0x371ee9){_0x3ee85d=_0x371ee9;return db[_0x7777('0x5d')][_0x7777('0x32')];}})[_0x7777('0x2a')](function(_0x165da9){if(_0x165da9){var _0x2ecb18={};var _0x2bc0cb={};_0x2bc0cb[_0x7777('0x36')]=_[_0x7777('0x6b')](_['keys'](_0x165da9),_[_0x7777('0x37')](_0x3ee85d[_0x7777('0x6a')],function(_0x111c63){return util[_0x7777('0x6c')](_0x7777('0x6d'),_0x111c63['id']);}));_0x2bc0cb['query']=_[_0x7777('0x48')](_0x447121[_0x7777('0x38')]);_0x2bc0cb[_0x7777('0x39')]=_[_0x7777('0x3a')](_0x2bc0cb[_0x7777('0x36')],_0x2bc0cb[_0x7777('0x38')]);_0x2ecb18[_0x7777('0x3b')]=_[_0x7777('0x3a')](_0x2bc0cb['model'],qs['fields'](_0x447121[_0x7777('0x38')][_0x7777('0x3c')]));_0x2ecb18[_0x7777('0x3b')]=_0x2ecb18['attributes'][_0x7777('0x61')]?_0x2ecb18[_0x7777('0x3b')]:_0x2bc0cb['model'];if(!_0x447121['query']['hasOwnProperty'](_0x7777('0x72'))){_0x2ecb18[_0x7777('0x23')]=qs[_0x7777('0x23')](_0x447121[_0x7777('0x38')][_0x7777('0x23')]);_0x2ecb18[_0x7777('0x21')]=qs[_0x7777('0x21')](_0x447121['query'][_0x7777('0x21')]);}_0x2ecb18[_0x7777('0x3e')]=qs[_0x7777('0x3f')](_0x447121[_0x7777('0x38')]['sort']);_0x2ecb18[_0x7777('0x40')]=qs['filters'](_['pick'](_0x447121[_0x7777('0x38')],_0x2bc0cb['filters']));_0x2ecb18[_0x7777('0x6e')]=!![];if(_0x447121['query']['filter']){_0x2ecb18['where']=_[_0x7777('0x5a')](_0x2ecb18[_0x7777('0x40')],{'$or':_['map'](_0x2ecb18[_0x7777('0x3b')],function(_0x8408d1){var _0x4132e1={};_0x4132e1[_0x8408d1]={'$like':'%'+_0x447121[_0x7777('0x38')]['filter']+'%'};return _0x4132e1;})});}_0x2ecb18=_['merge']({},_0x2ecb18,_0x447121[_0x7777('0x4a')]);return _0x3ee85d[_0x7777('0x6f')](_0x2ecb18);}})[_0x7777('0x2a')](function(_0x1b5091){if(!_['isEmpty'](_0x1b5091)){var _0x4ee829=toCsv(_0x1b5091);var _0x1ddb84=Date[_0x7777('0x73')]();fs[_0x7777('0x74')](util[_0x7777('0x6c')]('/tmp/list_%d_%s.csv',_0x3ee85d['id'],_0x1ddb84),_0x4ee829);_0x22cce[_0x7777('0x75')](_0x7777('0x76'),_0x7777('0x77')+util[_0x7777('0x6c')](_0x7777('0x78'),_0x3ee85d['id'],_0x1ddb84));_0x22cce[_0x7777('0x75')](_0x7777('0x79'),_0x7777('0x7a'));return _0x22cce[_0x7777('0x7b')](util['format'](_0x7777('0x7c'),_0x3ee85d['id'],_0x1ddb84));}else{return _0x22cce[_0x7777('0x1e')](0xcc);}})['catch'](handleError(_0x22cce,null));};exports[_0x7777('0x7d')]=function(_0x41ffd4,_0xf9ed5a,_0x18482e){var _0x4c5f5b;delete _0x41ffd4[_0x7777('0x54')]['id'];return db[_0x7777('0x31')][_0x7777('0x58')]({'where':{'id':_0x41ffd4['params']['id']}})[_0x7777('0x2a')](handleEntityNotFound(_0xf9ed5a,null))[_0x7777('0x2a')](function(_0xc8955b){if(_0xc8955b){return db[_0x7777('0x7e')][_0x7777('0x7f')](function(_0x4a49d5){return db[_0x7777('0x71')][_0x7777('0x4c')](_0x41ffd4[_0x7777('0x54')],{'transaction':_0x4a49d5})[_0x7777('0x2a')](function(_0x2d6c62){_0x4c5f5b=_0x2d6c62;return _0xc8955b[_0x7777('0x80')](_0x2d6c62,{'transaction':_0x4a49d5});})[_0x7777('0x2a')](function(){var _0x27bcaf={'type':db[_0x7777('0x81')][_0x7777('0x82')],'transaction':_0x4a49d5};switch(_0x41ffd4[_0x7777('0x54')][_0x7777('0x34')]){case _0x7777('0x83'):_0x27bcaf[_0x7777('0x34')]=db[_0x7777('0x81')]['TEXT'];break;case _0x7777('0x84'):_0x27bcaf[_0x7777('0x34')]=db['Sequelize'][_0x7777('0x85')];break;case _0x7777('0x86'):_0x27bcaf[_0x7777('0x34')]=db['Sequelize'][_0x7777('0x87')];_0x27bcaf['defaultValue']=![];break;default:}return db[_0x7777('0x7e')][_0x7777('0x88')]['addColumn'](_0x7777('0x89'),util[_0x7777('0x6c')](_0x7777('0x8a'),_0x4c5f5b['id']),_0x27bcaf);})[_0x7777('0x2a')](function(){return _0x4c5f5b;});});}})[_0x7777('0x2a')](respondWithResult(_0xf9ed5a,null))[_0x7777('0x46')](handleError(_0xf9ed5a,null));};exports[_0x7777('0x8b')]=function(_0x456d71,_0x1b3391,_0x5e9baf){var _0x47e8b6={};var _0x255916={};var _0x552e65;var _0x56aff6;return db[_0x7777('0x31')][_0x7777('0x58')]({'where':{'id':_0x456d71[_0x7777('0x47')]['id']}})['then'](handleEntityNotFound(_0x1b3391,null))[_0x7777('0x2a')](function(_0x3eb5dc){if(_0x3eb5dc){_0x552e65=_0x3eb5dc;_0x255916[_0x7777('0x36')]=_[_0x7777('0x48')](db[_0x7777('0x71')][_0x7777('0x32')]);_0x255916[_0x7777('0x38')]=_[_0x7777('0x48')](_0x456d71[_0x7777('0x38')]);_0x255916[_0x7777('0x39')]=_['intersection'](_0x255916[_0x7777('0x36')],_0x255916[_0x7777('0x38')]);_0x47e8b6['attributes']=_['intersection'](_0x255916['model'],qs[_0x7777('0x3c')](_0x456d71[_0x7777('0x38')][_0x7777('0x3c')]));_0x47e8b6[_0x7777('0x3b')]=_0x47e8b6['attributes'][_0x7777('0x61')]?_0x47e8b6[_0x7777('0x3b')]:_0x255916[_0x7777('0x36')];_0x47e8b6[_0x7777('0x3e')]=qs['sort'](_0x456d71[_0x7777('0x38')]['sort']);_0x47e8b6[_0x7777('0x40')]=qs[_0x7777('0x39')](_[_0x7777('0x41')](_0x456d71['query'],_0x255916[_0x7777('0x39')]));_0x47e8b6['where']=_[_0x7777('0x5a')](_0x47e8b6['where'],{'$or':[{'ListId':_0x3eb5dc['id']},{'ListId':null}]});if(_0x456d71[_0x7777('0x38')]['filter']){_0x47e8b6[_0x7777('0x40')]=_[_0x7777('0x5a')](_0x47e8b6[_0x7777('0x40')],{'$or':_[_0x7777('0x37')](_0x47e8b6[_0x7777('0x3b')],function(_0x584792){var _0x3c13fd={};_0x3c13fd[_0x584792]={'$like':'%'+_0x456d71['query'][_0x7777('0x42')]+'%'};return _0x3c13fd;})});}_0x47e8b6=_['merge']({},_0x47e8b6,_0x456d71['options']);return db[_0x7777('0x71')][_0x7777('0x8c')](_0x47e8b6);}})[_0x7777('0x2a')](respondWithResult(_0x1b3391,null))['catch'](handleError(_0x1b3391,null));};exports[_0x7777('0x8d')]=function(_0x4748fd,_0x4daa8d,_0x28ac43){return db[_0x7777('0x31')]['find']({'where':{'id':_0x4748fd[_0x7777('0x47')]['id']}})[_0x7777('0x2a')](handleEntityNotFound(_0x4daa8d,null))[_0x7777('0x2a')](function(_0x5065f6){if(_0x5065f6){return _0x5065f6[_0x7777('0x8d')](_0x4748fd[_0x7777('0x54')][_0x7777('0x5b')],_[_0x7777('0x64')](_0x4748fd['body'],['ids','id'])||{})['spread'](function(_0x449faf){for(var _0x54c4f4=0x0;_0x54c4f4<_0x4748fd['body'][_0x7777('0x5b')][_0x7777('0x61')];_0x54c4f4+=0x1){socket['emit'](_0x7777('0x8e'),{'UserId':Number(_0x4748fd[_0x7777('0x54')][_0x7777('0x5b')][_0x54c4f4]),'CmListId':Number(_0x4748fd[_0x7777('0x47')]['id'])});}return _0x449faf;});}})[_0x7777('0x2a')](respondWithResult(_0x4daa8d,null))['catch'](handleError(_0x4daa8d,null));};exports[_0x7777('0x8f')]=function(_0x14f33c,_0x3b4636,_0x169c9f){return db[_0x7777('0x31')]['find']({'where':{'id':_0x14f33c[_0x7777('0x47')]['id']}})[_0x7777('0x2a')](handleEntityNotFound(_0x3b4636,null))['then'](function(_0x3721cb){if(_0x3721cb){return _0x3721cb[_0x7777('0x8f')](_0x14f33c[_0x7777('0x38')]['ids'])[_0x7777('0x2a')](function(){if(_[_0x7777('0x5f')](_0x14f33c[_0x7777('0x38')]['ids'])){for(var _0x34cc2a=0x0;_0x34cc2a<_0x14f33c[_0x7777('0x38')][_0x7777('0x5b')][_0x7777('0x61')];_0x34cc2a+=0x1){socket[_0x7777('0x90')](_0x7777('0x91'),{'UserId':Number(_0x14f33c[_0x7777('0x38')]['ids'][_0x34cc2a]),'CmListId':Number(_0x14f33c[_0x7777('0x47')]['id'])});}}else{socket['emit'](_0x7777('0x91'),{'UserId':Number(_0x14f33c[_0x7777('0x38')][_0x7777('0x5b')]),'CmListId':Number(_0x14f33c['params']['id'])});}});}})[_0x7777('0x2a')](respondWithStatusCode(_0x3b4636,null))[_0x7777('0x46')](handleError(_0x3b4636,null));};exports[_0x7777('0x92')]=function(_0x3119e6,_0x1e7a5e,_0x10312d){var _0x27d2bc={};var _0xf53089={};var _0x1c80a9;var _0x3d6282;return db['CmList'][_0x7777('0x58')]({'where':{'id':_0x3119e6[_0x7777('0x47')]['id']}})['then'](handleEntityNotFound(_0x1e7a5e,null))[_0x7777('0x2a')](function(_0x399a1a){if(_0x399a1a){_0x1c80a9=_0x399a1a;_0xf53089[_0x7777('0x36')]=_[_0x7777('0x48')](db['User']['rawAttributes']);_0xf53089[_0x7777('0x38')]=_[_0x7777('0x48')](_0x3119e6[_0x7777('0x38')]);_0xf53089[_0x7777('0x39')]=_[_0x7777('0x3a')](_0xf53089[_0x7777('0x36')],_0xf53089[_0x7777('0x38')]);_0x27d2bc[_0x7777('0x3b')]=_[_0x7777('0x3a')](_0xf53089[_0x7777('0x36')],qs[_0x7777('0x3c')](_0x3119e6[_0x7777('0x38')][_0x7777('0x3c')]));_0x27d2bc[_0x7777('0x3b')]=_0x27d2bc['attributes'][_0x7777('0x61')]?_0x27d2bc['attributes']:_0xf53089[_0x7777('0x36')];_0x27d2bc[_0x7777('0x3e')]=qs['sort'](_0x3119e6[_0x7777('0x38')][_0x7777('0x3f')]);_0x27d2bc[_0x7777('0x40')]=qs['filters'](_[_0x7777('0x41')](_0x3119e6[_0x7777('0x38')],_0xf53089[_0x7777('0x39')]));if(_0x3119e6[_0x7777('0x38')][_0x7777('0x42')]){_0x27d2bc[_0x7777('0x40')]=_[_0x7777('0x5a')](_0x27d2bc[_0x7777('0x40')],{'$or':_[_0x7777('0x37')](_0x27d2bc[_0x7777('0x3b')],function(_0x31e5ae){var _0x2d59da={};_0x2d59da[_0x31e5ae]={'$like':'%'+_0x3119e6['query'][_0x7777('0x42')]+'%'};return _0x2d59da;})});}_0x27d2bc=_[_0x7777('0x5a')]({},_0x27d2bc,_0x3119e6[_0x7777('0x4a')]);return _0x1c80a9[_0x7777('0x92')](_0x27d2bc);}})[_0x7777('0x2a')](function(_0x46fbd7){if(_0x46fbd7){_0x3d6282=_0x46fbd7[_0x7777('0x61')];if(!_0x3119e6['query'][_0x7777('0x3d')](_0x7777('0x72'))){_0x27d2bc[_0x7777('0x23')]=qs[_0x7777('0x23')](_0x3119e6[_0x7777('0x38')][_0x7777('0x23')]);_0x27d2bc[_0x7777('0x21')]=qs[_0x7777('0x21')](_0x3119e6[_0x7777('0x38')][_0x7777('0x21')]);}return _0x1c80a9[_0x7777('0x92')](_0x27d2bc);}})[_0x7777('0x2a')](function(_0x4bb0ad){if(_0x4bb0ad){return _0x4bb0ad?{'count':_0x3d6282,'rows':_0x4bb0ad}:null;}})[_0x7777('0x2a')](respondWithResult(_0x1e7a5e,null))[_0x7777('0x46')](handleError(_0x1e7a5e,null));}; \ No newline at end of file +var _0x4c5c=['describe','ListId','Disposition','getDispositions','findOne','nolimit','order','sort','removeDispositions','addContacts','CmContact','tags','isArray','join','push','each','ids','CmCustomField','CustomFields','cf_%d','raw','getContacts','getContactsCsv','format','writeFileSync','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','addAgents','omit','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','sendStatus','status','offset','undefined','count','limit','set','json','apply','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','body','user','role','Lists','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x392dae,_0x1b37e1){var _0x3b4d5d=function(_0x1581fb){while(--_0x1581fb){_0x392dae['push'](_0x392dae['shift']());}};_0x3b4d5d(++_0x1b37e1);}(_0x4c5c,0xc6));var _0xc4c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4c5c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc4c5('0x0'));var zipdir=require(_0xc4c5('0x1'));var jsonpatch=require(_0xc4c5('0x2'));var rp=require(_0xc4c5('0x3'));var moment=require(_0xc4c5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc4c5('0x5'));var util=require(_0xc4c5('0x6'));var path=require('path');var sox=require(_0xc4c5('0x7'));var csv=require('to-csv');var ejs=require(_0xc4c5('0x8'));var fs=require('fs');var fs_extra=require(_0xc4c5('0x9'));var _=require(_0xc4c5('0xa'));var squel=require(_0xc4c5('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc4c5('0xc'));var querystring=require(_0xc4c5('0xd'));var Papa=require(_0xc4c5('0xe'));var Redis=require(_0xc4c5('0xf'));var authService=require(_0xc4c5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc4c5('0x11'));var hardwareService=require(_0xc4c5('0x12'));var logger=require(_0xc4c5('0x13'))(_0xc4c5('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc4c5('0x15'));var db=require(_0xc4c5('0x16'))['db'];config[_0xc4c5('0x17')]=_[_0xc4c5('0x18')](config[_0xc4c5('0x17')],{'host':_0xc4c5('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc4c5('0x1a'))[_0xc4c5('0x1b')](socket);function respondWithStatusCode(_0x4632d4,_0x4fccf8){_0x4fccf8=_0x4fccf8||0xcc;return function(_0x3829a0){if(_0x3829a0){return _0x4632d4[_0xc4c5('0x1c')](_0x4fccf8);}return _0x4632d4[_0xc4c5('0x1d')](_0x4fccf8)['end']();};}function respondWithResult(_0x58e469,_0x8ec697){_0x8ec697=_0x8ec697||0xc8;return function(_0x2093e8){if(_0x2093e8){return _0x58e469[_0xc4c5('0x1d')](_0x8ec697)['json'](_0x2093e8);}};}function respondWithFilteredResult(_0x46e5c5,_0x4d6524){return function(_0x3d3664){if(_0x3d3664){var _0x52dd25=typeof _0x4d6524[_0xc4c5('0x1e')]===_0xc4c5('0x1f')&&typeof _0x4d6524['limit']===_0xc4c5('0x1f');var _0x1471c5=_0x3d3664[_0xc4c5('0x20')];var _0x561ed6=_0x52dd25?0x0:_0x4d6524['offset'];var _0x407640=_0x52dd25?_0x3d3664[_0xc4c5('0x20')]:_0x4d6524[_0xc4c5('0x1e')]+_0x4d6524[_0xc4c5('0x21')];var _0x55d9e0;if(_0x407640>=_0x1471c5){_0x407640=_0x1471c5;_0x55d9e0=0xc8;}else{_0x55d9e0=0xce;}_0x46e5c5[_0xc4c5('0x1d')](_0x55d9e0);return _0x46e5c5[_0xc4c5('0x22')]('Content-Range',_0x561ed6+'-'+_0x407640+'/'+_0x1471c5)[_0xc4c5('0x23')](_0x3d3664);}return null;};}function patchUpdates(_0x5b1d64){return function(_0x160f0c){try{jsonpatch[_0xc4c5('0x24')](_0x160f0c,_0x5b1d64,!![]);}catch(_0x175e5f){return BPromise['reject'](_0x175e5f);}return _0x160f0c['save']();};}function saveUpdates(_0x28d241,_0x5b4e1d){return function(_0x3fbbf9){if(_0x3fbbf9){return _0x3fbbf9[_0xc4c5('0x25')](_0x28d241)['then'](function(_0x8934e7){return _0x8934e7;});}return null;};}function removeEntity(_0x5ea130,_0x5625c0){return function(_0x5cd6c1){if(_0x5cd6c1){return _0x5cd6c1['destroy']()[_0xc4c5('0x26')](function(){var _0x1fd3fa=_0x5cd6c1[_0xc4c5('0x27')]({'plain':!![]});var _0xed1e13='Lists';return db[_0xc4c5('0x28')][_0xc4c5('0x29')]({'where':{'type':_0xed1e13,'resourceId':_0x1fd3fa['id']}})[_0xc4c5('0x26')](function(){return _0x5cd6c1;});})[_0xc4c5('0x26')](function(){_0x5ea130[_0xc4c5('0x1d')](0xcc)[_0xc4c5('0x2a')]();});}};}function handleEntityNotFound(_0xb83e53,_0x466a6a){return function(_0x5a2f72){if(!_0x5a2f72){_0xb83e53['sendStatus'](0x194);}return _0x5a2f72;};}function handleError(_0x3e5e1b,_0x58436b){_0x58436b=_0x58436b||0x1f4;return function(_0x24b243){logger[_0xc4c5('0x2b')](_0x24b243[_0xc4c5('0x2c')]);if(_0x24b243[_0xc4c5('0x2d')]){delete _0x24b243['name'];}_0x3e5e1b['status'](_0x58436b)[_0xc4c5('0x2e')](_0x24b243);};}exports[_0xc4c5('0x2f')]=function(_0x56cca3,_0x33c53f){var _0x15286b={},_0x202d08={},_0x45d64b={'count':0x0,'rows':[]};var _0x3d7c03=_[_0xc4c5('0x30')](db[_0xc4c5('0x31')][_0xc4c5('0x32')],function(_0x14fdcf){return{'name':_0x14fdcf[_0xc4c5('0x33')],'type':_0x14fdcf[_0xc4c5('0x34')][_0xc4c5('0x35')]};});_0x202d08[_0xc4c5('0x36')]=_['map'](_0x3d7c03,_0xc4c5('0x2d'));_0x202d08[_0xc4c5('0x37')]=_[_0xc4c5('0x38')](_0x56cca3[_0xc4c5('0x37')]);_0x202d08['filters']=_['intersection'](_0x202d08[_0xc4c5('0x36')],_0x202d08[_0xc4c5('0x37')]);_0x15286b['attributes']=_[_0xc4c5('0x39')](_0x202d08['model'],qs[_0xc4c5('0x3a')](_0x56cca3[_0xc4c5('0x37')][_0xc4c5('0x3a')]));_0x15286b[_0xc4c5('0x3b')]=_0x15286b[_0xc4c5('0x3b')][_0xc4c5('0x3c')]?_0x15286b[_0xc4c5('0x3b')]:_0x202d08[_0xc4c5('0x36')];if(!_0x56cca3['query'][_0xc4c5('0x3d')]('nolimit')){_0x15286b[_0xc4c5('0x21')]=qs[_0xc4c5('0x21')](_0x56cca3['query'][_0xc4c5('0x21')]);_0x15286b[_0xc4c5('0x1e')]=qs['offset'](_0x56cca3['query']['offset']);}_0x15286b['order']=qs['sort'](_0x56cca3[_0xc4c5('0x37')]['sort']);_0x15286b[_0xc4c5('0x3e')]=qs[_0xc4c5('0x3f')](_[_0xc4c5('0x40')](_0x56cca3[_0xc4c5('0x37')],_0x202d08[_0xc4c5('0x3f')]),_0x3d7c03);if(_0x56cca3[_0xc4c5('0x37')][_0xc4c5('0x41')]){_0x15286b[_0xc4c5('0x3e')]=_[_0xc4c5('0x42')](_0x15286b[_0xc4c5('0x3e')],{'$or':_[_0xc4c5('0x30')](_0x3d7c03,function(_0x42ed78){if(_0x42ed78[_0xc4c5('0x34')]!==_0xc4c5('0x43')){var _0x174970={};_0x174970[_0x42ed78[_0xc4c5('0x2d')]]={'$like':'%'+_0x56cca3[_0xc4c5('0x37')][_0xc4c5('0x41')]+'%'};return _0x174970;}})});}_0x15286b=_[_0xc4c5('0x42')]({},_0x15286b,_0x56cca3['options']);var _0xd3f046={'where':_0x15286b[_0xc4c5('0x3e')]};return db['CmList'][_0xc4c5('0x20')](_0xd3f046)[_0xc4c5('0x26')](function(_0x3b3272){_0x45d64b[_0xc4c5('0x20')]=_0x3b3272;if(_0x56cca3[_0xc4c5('0x37')][_0xc4c5('0x44')]){_0x15286b[_0xc4c5('0x45')]=[{'all':!![]}];}return db[_0xc4c5('0x31')][_0xc4c5('0x46')](_0x15286b);})[_0xc4c5('0x26')](function(_0x2c6472){_0x45d64b[_0xc4c5('0x47')]=_0x2c6472;return _0x45d64b;})['then'](respondWithFilteredResult(_0x33c53f,_0x15286b))[_0xc4c5('0x48')](handleError(_0x33c53f,null));};exports[_0xc4c5('0x49')]=function(_0x4c5d65,_0x1180b8){var _0xc99a8d={'raw':![],'where':{'id':_0x4c5d65[_0xc4c5('0x4a')]['id']}},_0x9829c9={};_0x9829c9[_0xc4c5('0x36')]=_[_0xc4c5('0x38')](db[_0xc4c5('0x31')][_0xc4c5('0x32')]);_0x9829c9['query']=_[_0xc4c5('0x38')](_0x4c5d65[_0xc4c5('0x37')]);_0x9829c9[_0xc4c5('0x3f')]=_[_0xc4c5('0x39')](_0x9829c9[_0xc4c5('0x36')],_0x9829c9[_0xc4c5('0x37')]);_0xc99a8d[_0xc4c5('0x3b')]=_[_0xc4c5('0x39')](_0x9829c9['model'],qs[_0xc4c5('0x3a')](_0x4c5d65[_0xc4c5('0x37')]['fields']));_0xc99a8d[_0xc4c5('0x3b')]=_0xc99a8d[_0xc4c5('0x3b')][_0xc4c5('0x3c')]?_0xc99a8d[_0xc4c5('0x3b')]:_0x9829c9[_0xc4c5('0x36')];if(_0x4c5d65[_0xc4c5('0x37')][_0xc4c5('0x44')]){_0xc99a8d[_0xc4c5('0x45')]=[{'all':!![]}];}_0xc99a8d=_[_0xc4c5('0x42')]({},_0xc99a8d,_0x4c5d65[_0xc4c5('0x4b')]);return db[_0xc4c5('0x31')]['find'](_0xc99a8d)[_0xc4c5('0x26')](handleEntityNotFound(_0x1180b8,null))[_0xc4c5('0x26')](respondWithResult(_0x1180b8,null))[_0xc4c5('0x48')](handleError(_0x1180b8,null));};exports[_0xc4c5('0x4c')]=function(_0x818128,_0x30ca6c){return db['CmList'][_0xc4c5('0x4c')](_0x818128[_0xc4c5('0x4d')],{})[_0xc4c5('0x26')](function(_0xf3d709){var _0x199e2a=_0x818128[_0xc4c5('0x4e')]['get']({'plain':!![]});if(!_0x199e2a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x199e2a[_0xc4c5('0x4f')]===_0xc4c5('0x4e')){var _0x18b884=_0xf3d709['get']({'plain':!![]});var _0x3e48ba=_0xc4c5('0x50');return db['UserProfileSection'][_0xc4c5('0x51')]({'where':{'name':_0x3e48ba,'userProfileId':_0x199e2a['userProfileId']},'raw':!![]})['then'](function(_0x32255b){if(_0x32255b&&_0x32255b[_0xc4c5('0x52')]===0x0){return db[_0xc4c5('0x28')][_0xc4c5('0x4c')]({'name':_0x18b884['name'],'resourceId':_0x18b884['id'],'type':_0x32255b[_0xc4c5('0x2d')],'sectionId':_0x32255b['id']},{})[_0xc4c5('0x26')](function(){return _0xf3d709;});}else{return _0xf3d709;}})[_0xc4c5('0x48')](function(_0x1fdbe6){logger['error'](_0xc4c5('0x53'),_0x1fdbe6);throw _0x1fdbe6;});}return _0xf3d709;})[_0xc4c5('0x26')](respondWithResult(_0x30ca6c,0xc9))[_0xc4c5('0x48')](handleError(_0x30ca6c,null));};exports['update']=function(_0x3f4c27,_0x51de86){if(_0x3f4c27[_0xc4c5('0x4d')]['id']){delete _0x3f4c27['body']['id'];}return db[_0xc4c5('0x31')][_0xc4c5('0x51')]({'where':{'id':_0x3f4c27['params']['id']}})['then'](handleEntityNotFound(_0x51de86,null))[_0xc4c5('0x26')](saveUpdates(_0x3f4c27['body'],null))[_0xc4c5('0x26')](respondWithResult(_0x51de86,null))[_0xc4c5('0x48')](handleError(_0x51de86,null));};exports[_0xc4c5('0x29')]=function(_0x1e1b3e,_0x56661a){return db['CmList'][_0xc4c5('0x51')]({'where':{'id':_0x1e1b3e[_0xc4c5('0x4a')]['id']}})[_0xc4c5('0x26')](handleEntityNotFound(_0x56661a,null))['then'](removeEntity(_0x56661a,null))[_0xc4c5('0x48')](handleError(_0x56661a,null));};exports['describe']=function(_0x436c6b,_0x131b98){return db['CmList'][_0xc4c5('0x54')]()[_0xc4c5('0x26')](respondWithResult(_0x131b98,null))[_0xc4c5('0x48')](handleError(_0x131b98,null));};exports['addDisposition']=function(_0x1391f6,_0x5523c1,_0x23b08b){if(_0x1391f6[_0xc4c5('0x4d')]['id']){delete _0x1391f6[_0xc4c5('0x4d')]['id'];}return db[_0xc4c5('0x31')][_0xc4c5('0x51')]({'where':{'id':_0x1391f6[_0xc4c5('0x4a')]['id']}})[_0xc4c5('0x26')](handleEntityNotFound(_0x5523c1,null))[_0xc4c5('0x26')](function(_0x1ee2d7){if(_0x1ee2d7){_0x1391f6[_0xc4c5('0x4d')][_0xc4c5('0x55')]=_0x1ee2d7['id'];return db[_0xc4c5('0x56')][_0xc4c5('0x4c')](_0x1391f6[_0xc4c5('0x4d')]);}})[_0xc4c5('0x26')](respondWithResult(_0x5523c1,null))[_0xc4c5('0x48')](handleError(_0x5523c1,null));};exports[_0xc4c5('0x57')]=function(_0x48cf45,_0x9894b1,_0x1e7812){var _0x3110e5={'raw':![],'where':{}};var _0x4ebe69={};var _0x2fe7da={'count':0x0,'rows':[]};return db[_0xc4c5('0x31')][_0xc4c5('0x58')]({'where':{'id':_0x48cf45[_0xc4c5('0x4a')]['id']}})[_0xc4c5('0x26')](handleEntityNotFound(_0x9894b1,null))[_0xc4c5('0x26')](function(_0x3aa1d1){if(_0x3aa1d1){_0x4ebe69['model']=_[_0xc4c5('0x38')](db[_0xc4c5('0x56')][_0xc4c5('0x32')]);_0x4ebe69['query']=_[_0xc4c5('0x38')](_0x48cf45[_0xc4c5('0x37')]);_0x4ebe69[_0xc4c5('0x3f')]=_[_0xc4c5('0x39')](_0x4ebe69[_0xc4c5('0x36')],_0x4ebe69[_0xc4c5('0x37')]);_0x3110e5[_0xc4c5('0x3b')]=_[_0xc4c5('0x39')](_0x4ebe69['model'],qs[_0xc4c5('0x3a')](_0x48cf45[_0xc4c5('0x37')][_0xc4c5('0x3a')]));_0x3110e5[_0xc4c5('0x3b')]=_0x3110e5[_0xc4c5('0x3b')][_0xc4c5('0x3c')]?_0x3110e5[_0xc4c5('0x3b')]:_0x4ebe69[_0xc4c5('0x36')];if(!_0x48cf45[_0xc4c5('0x37')][_0xc4c5('0x3d')](_0xc4c5('0x59'))){_0x3110e5[_0xc4c5('0x21')]=qs[_0xc4c5('0x21')](_0x48cf45['query'][_0xc4c5('0x21')]);_0x3110e5[_0xc4c5('0x1e')]=qs[_0xc4c5('0x1e')](_0x48cf45[_0xc4c5('0x37')][_0xc4c5('0x1e')]);}_0x3110e5[_0xc4c5('0x5a')]=qs[_0xc4c5('0x5b')](_0x48cf45[_0xc4c5('0x37')][_0xc4c5('0x5b')]);_0x3110e5['where']=qs[_0xc4c5('0x3f')](_[_0xc4c5('0x40')](_0x48cf45[_0xc4c5('0x37')],_0x4ebe69['filters']));_0x3110e5['where']['ListId']=_0x3aa1d1['id'];if(_0x48cf45['query'][_0xc4c5('0x41')]){_0x3110e5['where']=_[_0xc4c5('0x42')](_0x3110e5[_0xc4c5('0x3e')],{'$or':_[_0xc4c5('0x30')](_0x3110e5[_0xc4c5('0x3b')],function(_0x3f87ae){var _0x1d3990={};_0x1d3990[_0x3f87ae]={'$like':'%'+_0x48cf45[_0xc4c5('0x37')][_0xc4c5('0x41')]+'%'};return _0x1d3990;})});}_0x3110e5=_['merge']({},_0x3110e5,_0x48cf45['options']);return db['Disposition']['count']({'where':_0x3110e5[_0xc4c5('0x3e')]})['then'](function(_0x56d2bb){_0x2fe7da[_0xc4c5('0x20')]=_0x56d2bb;if(_0x48cf45[_0xc4c5('0x37')][_0xc4c5('0x44')]){_0x3110e5[_0xc4c5('0x45')]=[{'all':!![]}];}return db[_0xc4c5('0x56')]['findAll'](_0x3110e5);})[_0xc4c5('0x26')](function(_0x40270e){_0x2fe7da[_0xc4c5('0x47')]=_0x40270e;return _0x2fe7da;});}})[_0xc4c5('0x26')](respondWithFilteredResult(_0x9894b1,_0x3110e5))[_0xc4c5('0x48')](handleError(_0x9894b1,null));};exports[_0xc4c5('0x5c')]=function(_0x275b9f,_0x3e619d,_0x476131){return db['CmList'][_0xc4c5('0x51')]({'where':{'id':_0x275b9f[_0xc4c5('0x4a')]['id']}})[_0xc4c5('0x26')](handleEntityNotFound(_0x3e619d,null))[_0xc4c5('0x26')](function(_0x5c50ba){if(_0x5c50ba){return _0x5c50ba[_0xc4c5('0x5c')](_0x275b9f['query']['ids']);}})['then'](respondWithStatusCode(_0x3e619d,null))[_0xc4c5('0x48')](handleError(_0x3e619d,null));};exports[_0xc4c5('0x5d')]=function(_0x22ce64,_0x5296db,_0x308dab){return db[_0xc4c5('0x31')]['find']({'where':{'id':_0x22ce64['params']['id']}})['then'](handleEntityNotFound(_0x5296db,null))[_0xc4c5('0x26')](function(_0x48bc72){if(_0x48bc72){var _0x58aaa5=[];var _0x55b6c8={'success':[],'errors':[]};return db[_0xc4c5('0x5e')][_0xc4c5('0x54')]()['then'](function(_0x3e6123){if(_0x22ce64[_0xc4c5('0x4d')][_0xc4c5('0x5f')]&&_[_0xc4c5('0x60')](_0x22ce64['body'][_0xc4c5('0x5f')])){if(_0x22ce64[_0xc4c5('0x4d')][_0xc4c5('0x5f')][_0xc4c5('0x3c')]){_0x22ce64['body'][_0xc4c5('0x5f')]=_0x22ce64[_0xc4c5('0x4d')][_0xc4c5('0x5f')][_0xc4c5('0x61')](';')+';';}else{_0x22ce64[_0xc4c5('0x4d')]['tags']=null;}}else{_0x22ce64['body'][_0xc4c5('0x5f')]=null;}if(_0x22ce64['body']&&_['isArray'](_0x22ce64[_0xc4c5('0x4d')])){for(var _0xf1b4bb=0x0;_0xf1b4bb<_0x22ce64[_0xc4c5('0x4d')][_0xc4c5('0x3c')];_0xf1b4bb+=0x1){_0x22ce64[_0xc4c5('0x4d')][_0xf1b4bb][_0xc4c5('0x55')]=_0x22ce64['params']['id'];_0x58aaa5[_0xc4c5('0x62')](_0x22ce64[_0xc4c5('0x4d')][_0xf1b4bb]);}return BPromise[_0xc4c5('0x63')](_0x58aaa5,function(_0x24af55){return db[_0xc4c5('0x5e')]['create'](_['omit'](_0x24af55,[_0xc4c5('0x64'),'id'])||{},{'fields':_[_0xc4c5('0x38')](_0x3e6123),'raw':!![]})[_0xc4c5('0x26')](function(_0x422638){_0x55b6c8['success'][_0xc4c5('0x62')](_0x422638['dataValues']);})[_0xc4c5('0x48')](function(_0x2072f0){_0x55b6c8['errors']['push']({'data':_0x24af55,'error':_0x2072f0['message']});});})[_0xc4c5('0x26')](function(_0x39a435){return _0x55b6c8;})[_0xc4c5('0x48')](function(_0x236afa){return _0x236afa;});}else{_0x5296db[_0xc4c5('0x1d')](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})[_0xc4c5('0x26')](respondWithResult(_0x5296db,null))[_0xc4c5('0x48')](handleError(_0x5296db,null));};exports['getContacts']=function(_0x3cba86,_0xca2dea,_0x1a5110){var _0x39206e;return db[_0xc4c5('0x31')][_0xc4c5('0x51')]({'where':{'id':_0x3cba86[_0xc4c5('0x4a')]['id']},'include':[{'model':db[_0xc4c5('0x65')],'as':_0xc4c5('0x66')}]})['then'](handleEntityNotFound(_0xca2dea,null))['then'](function(_0x1b30a2){if(_0x1b30a2){_0x39206e=_0x1b30a2;return db['CmContact']['rawAttributes'];}})[_0xc4c5('0x26')](function(_0x4f43b6){if(_0x4f43b6){var _0x1bbca3={};var _0x204d15={};_0x204d15[_0xc4c5('0x36')]=_['concat'](_['keys'](_0x4f43b6),_[_0xc4c5('0x30')](_0x39206e['CustomFields'],function(_0x52a16e){return util['format'](_0xc4c5('0x67'),_0x52a16e['id']);}));_0x204d15[_0xc4c5('0x37')]=_[_0xc4c5('0x38')](_0x3cba86[_0xc4c5('0x37')]);_0x204d15[_0xc4c5('0x3f')]=_[_0xc4c5('0x39')](_0x204d15[_0xc4c5('0x36')],_0x204d15['query']);_0x1bbca3['attributes']=_['intersection'](_0x204d15[_0xc4c5('0x36')],qs[_0xc4c5('0x3a')](_0x3cba86[_0xc4c5('0x37')][_0xc4c5('0x3a')]));_0x1bbca3[_0xc4c5('0x3b')]=_0x1bbca3[_0xc4c5('0x3b')]['length']?_0x1bbca3['attributes']:_0x204d15[_0xc4c5('0x36')];if(!_0x3cba86[_0xc4c5('0x37')][_0xc4c5('0x3d')](_0xc4c5('0x59'))){_0x1bbca3[_0xc4c5('0x21')]=qs['limit'](_0x3cba86[_0xc4c5('0x37')][_0xc4c5('0x21')]);_0x1bbca3[_0xc4c5('0x1e')]=qs[_0xc4c5('0x1e')](_0x3cba86[_0xc4c5('0x37')][_0xc4c5('0x1e')]);}_0x1bbca3[_0xc4c5('0x5a')]=qs['sort'](_0x3cba86['query']['sort']);_0x1bbca3[_0xc4c5('0x3e')]=qs['filters'](_[_0xc4c5('0x40')](_0x3cba86[_0xc4c5('0x37')],_0x204d15[_0xc4c5('0x3f')]));_0x1bbca3[_0xc4c5('0x68')]=!![];if(_0x3cba86[_0xc4c5('0x37')][_0xc4c5('0x41')]){_0x1bbca3[_0xc4c5('0x3e')]=_[_0xc4c5('0x42')](_0x1bbca3[_0xc4c5('0x3e')],{'$or':_[_0xc4c5('0x30')](_0x1bbca3['attributes'],function(_0x3a65c3){var _0x58ec99={};_0x58ec99[_0x3a65c3]={'$like':'%'+_0x3cba86[_0xc4c5('0x37')]['filter']+'%'};return _0x58ec99;})});}_0x1bbca3=_[_0xc4c5('0x42')]({},_0x1bbca3,_0x3cba86['options']);return _0x39206e[_0xc4c5('0x69')](_0x1bbca3);}})[_0xc4c5('0x26')](respondWithResult(_0xca2dea,null))[_0xc4c5('0x48')](handleError(_0xca2dea,null));};exports[_0xc4c5('0x6a')]=function(_0x3f275c,_0x51769f,_0x2446d7){var _0x92d196;return db[_0xc4c5('0x31')][_0xc4c5('0x51')]({'where':{'id':_0x3f275c[_0xc4c5('0x4a')]['id']},'include':[{'model':db[_0xc4c5('0x65')],'as':'CustomFields'}]})[_0xc4c5('0x26')](handleEntityNotFound(_0x51769f,null))[_0xc4c5('0x26')](function(_0x5c987d){if(_0x5c987d){_0x92d196=_0x5c987d;return db[_0xc4c5('0x5e')][_0xc4c5('0x32')];}})[_0xc4c5('0x26')](function(_0x3576ce){if(_0x3576ce){var _0x435e70={};var _0x329f38={};_0x329f38[_0xc4c5('0x36')]=_['concat'](_['keys'](_0x3576ce),_[_0xc4c5('0x30')](_0x92d196['CustomFields'],function(_0x1d170a){return util[_0xc4c5('0x6b')](_0xc4c5('0x67'),_0x1d170a['id']);}));_0x329f38[_0xc4c5('0x37')]=_[_0xc4c5('0x38')](_0x3f275c[_0xc4c5('0x37')]);_0x329f38[_0xc4c5('0x3f')]=_['intersection'](_0x329f38[_0xc4c5('0x36')],_0x329f38[_0xc4c5('0x37')]);_0x435e70['attributes']=_[_0xc4c5('0x39')](_0x329f38[_0xc4c5('0x36')],qs[_0xc4c5('0x3a')](_0x3f275c[_0xc4c5('0x37')][_0xc4c5('0x3a')]));_0x435e70[_0xc4c5('0x3b')]=_0x435e70[_0xc4c5('0x3b')][_0xc4c5('0x3c')]?_0x435e70['attributes']:_0x329f38[_0xc4c5('0x36')];if(!_0x3f275c[_0xc4c5('0x37')][_0xc4c5('0x3d')](_0xc4c5('0x59'))){_0x435e70[_0xc4c5('0x21')]=qs[_0xc4c5('0x21')](_0x3f275c['query'][_0xc4c5('0x21')]);_0x435e70['offset']=qs[_0xc4c5('0x1e')](_0x3f275c[_0xc4c5('0x37')][_0xc4c5('0x1e')]);}_0x435e70[_0xc4c5('0x5a')]=qs['sort'](_0x3f275c[_0xc4c5('0x37')][_0xc4c5('0x5b')]);_0x435e70[_0xc4c5('0x3e')]=qs['filters'](_[_0xc4c5('0x40')](_0x3f275c[_0xc4c5('0x37')],_0x329f38[_0xc4c5('0x3f')]));_0x435e70[_0xc4c5('0x68')]=!![];if(_0x3f275c[_0xc4c5('0x37')]['filter']){_0x435e70['where']=_[_0xc4c5('0x42')](_0x435e70[_0xc4c5('0x3e')],{'$or':_[_0xc4c5('0x30')](_0x435e70[_0xc4c5('0x3b')],function(_0x26e3e1){var _0x690b45={};_0x690b45[_0x26e3e1]={'$like':'%'+_0x3f275c[_0xc4c5('0x37')][_0xc4c5('0x41')]+'%'};return _0x690b45;})});}_0x435e70=_['merge']({},_0x435e70,_0x3f275c[_0xc4c5('0x4b')]);return _0x92d196[_0xc4c5('0x69')](_0x435e70);}})[_0xc4c5('0x26')](function(_0x953952){if(!_['isEmpty'](_0x953952)){var _0x5ad225=toCsv(_0x953952);var _0x2f53f1=Date['now']();fs[_0xc4c5('0x6c')](util[_0xc4c5('0x6b')](_0xc4c5('0x6d'),_0x92d196['id'],_0x2f53f1),_0x5ad225);_0x51769f[_0xc4c5('0x6e')]('Content-disposition',_0xc4c5('0x6f')+util[_0xc4c5('0x6b')](_0xc4c5('0x70'),_0x92d196['id'],_0x2f53f1));_0x51769f['setHeader'](_0xc4c5('0x71'),_0xc4c5('0x72'));return _0x51769f[_0xc4c5('0x73')](util['format'](_0xc4c5('0x6d'),_0x92d196['id'],_0x2f53f1));}else{return _0x51769f[_0xc4c5('0x1c')](0xcc);}})[_0xc4c5('0x48')](handleError(_0x51769f,null));};exports[_0xc4c5('0x74')]=function(_0x15cddb,_0x4fe81f,_0x1d75f9){var _0x13cfe8;delete _0x15cddb[_0xc4c5('0x4d')]['id'];return db[_0xc4c5('0x31')][_0xc4c5('0x58')]({'where':{'id':_0x15cddb[_0xc4c5('0x4a')]['id']}})[_0xc4c5('0x26')](handleEntityNotFound(_0x4fe81f,null))['then'](function(_0x4fe8ab){if(_0x4fe8ab){return db[_0xc4c5('0x75')][_0xc4c5('0x76')](function(_0x12adb1){return db[_0xc4c5('0x65')][_0xc4c5('0x4c')](_0x15cddb[_0xc4c5('0x4d')],{'transaction':_0x12adb1})[_0xc4c5('0x26')](function(_0x46dbc0){_0x13cfe8=_0x46dbc0;return _0x4fe8ab[_0xc4c5('0x77')](_0x46dbc0,{'transaction':_0x12adb1});})[_0xc4c5('0x26')](function(){var _0x2270f7={'type':db[_0xc4c5('0x78')][_0xc4c5('0x79')],'transaction':_0x12adb1};switch(_0x15cddb[_0xc4c5('0x4d')][_0xc4c5('0x34')]){case _0xc4c5('0x7a'):_0x2270f7[_0xc4c5('0x34')]=db['Sequelize'][_0xc4c5('0x79')];break;case _0xc4c5('0x7b'):_0x2270f7['type']=db[_0xc4c5('0x78')][_0xc4c5('0x7c')];break;case _0xc4c5('0x7d'):_0x2270f7[_0xc4c5('0x34')]=db[_0xc4c5('0x78')][_0xc4c5('0x7e')];_0x2270f7['defaultValue']=![];break;default:}return db[_0xc4c5('0x75')][_0xc4c5('0x7f')][_0xc4c5('0x80')]('cm_contacts',util[_0xc4c5('0x6b')](_0xc4c5('0x81'),_0x13cfe8['id']),_0x2270f7);})['then'](function(){return _0x13cfe8;});});}})[_0xc4c5('0x26')](respondWithResult(_0x4fe81f,null))['catch'](handleError(_0x4fe81f,null));};exports[_0xc4c5('0x82')]=function(_0x1a30f7,_0x3bf2b4,_0x594e57){var _0x568dca={};var _0x52d590={};var _0x4c06b8;var _0x47f980;return db[_0xc4c5('0x31')][_0xc4c5('0x58')]({'where':{'id':_0x1a30f7[_0xc4c5('0x4a')]['id']}})[_0xc4c5('0x26')](handleEntityNotFound(_0x3bf2b4,null))[_0xc4c5('0x26')](function(_0x5d8c9c){if(_0x5d8c9c){_0x4c06b8=_0x5d8c9c;_0x52d590[_0xc4c5('0x36')]=_[_0xc4c5('0x38')](db[_0xc4c5('0x65')]['rawAttributes']);_0x52d590['query']=_['keys'](_0x1a30f7[_0xc4c5('0x37')]);_0x52d590[_0xc4c5('0x3f')]=_[_0xc4c5('0x39')](_0x52d590[_0xc4c5('0x36')],_0x52d590[_0xc4c5('0x37')]);_0x568dca[_0xc4c5('0x3b')]=_[_0xc4c5('0x39')](_0x52d590[_0xc4c5('0x36')],qs[_0xc4c5('0x3a')](_0x1a30f7[_0xc4c5('0x37')]['fields']));_0x568dca['attributes']=_0x568dca[_0xc4c5('0x3b')][_0xc4c5('0x3c')]?_0x568dca[_0xc4c5('0x3b')]:_0x52d590[_0xc4c5('0x36')];_0x568dca[_0xc4c5('0x5a')]=qs['sort'](_0x1a30f7[_0xc4c5('0x37')]['sort']);_0x568dca[_0xc4c5('0x3e')]=qs[_0xc4c5('0x3f')](_['pick'](_0x1a30f7[_0xc4c5('0x37')],_0x52d590['filters']));_0x568dca[_0xc4c5('0x3e')]=_[_0xc4c5('0x42')](_0x568dca[_0xc4c5('0x3e')],{'$or':[{'ListId':_0x5d8c9c['id']},{'ListId':null}]});if(_0x1a30f7[_0xc4c5('0x37')][_0xc4c5('0x41')]){_0x568dca[_0xc4c5('0x3e')]=_[_0xc4c5('0x42')](_0x568dca[_0xc4c5('0x3e')],{'$or':_['map'](_0x568dca[_0xc4c5('0x3b')],function(_0x418687){var _0x45f5ac={};_0x45f5ac[_0x418687]={'$like':'%'+_0x1a30f7[_0xc4c5('0x37')][_0xc4c5('0x41')]+'%'};return _0x45f5ac;})});}_0x568dca=_[_0xc4c5('0x42')]({},_0x568dca,_0x1a30f7['options']);return db[_0xc4c5('0x65')][_0xc4c5('0x83')](_0x568dca);}})[_0xc4c5('0x26')](respondWithResult(_0x3bf2b4,null))[_0xc4c5('0x48')](handleError(_0x3bf2b4,null));};exports[_0xc4c5('0x84')]=function(_0x5cf211,_0x210072,_0x231bda){return db['CmList'][_0xc4c5('0x51')]({'where':{'id':_0x5cf211[_0xc4c5('0x4a')]['id']}})[_0xc4c5('0x26')](handleEntityNotFound(_0x210072,null))[_0xc4c5('0x26')](function(_0x4ab339){if(_0x4ab339){return _0x4ab339[_0xc4c5('0x84')](_0x5cf211[_0xc4c5('0x4d')][_0xc4c5('0x64')],_[_0xc4c5('0x85')](_0x5cf211[_0xc4c5('0x4d')],[_0xc4c5('0x64'),'id'])||{})[_0xc4c5('0x86')](function(_0x49eb9c){for(var _0x2d5d52=0x0;_0x2d5d52<_0x5cf211[_0xc4c5('0x4d')]['ids'][_0xc4c5('0x3c')];_0x2d5d52+=0x1){socket['emit'](_0xc4c5('0x87'),{'UserId':Number(_0x5cf211['body'][_0xc4c5('0x64')][_0x2d5d52]),'CmListId':Number(_0x5cf211[_0xc4c5('0x4a')]['id'])});}return _0x49eb9c;});}})['then'](respondWithResult(_0x210072,null))[_0xc4c5('0x48')](handleError(_0x210072,null));};exports[_0xc4c5('0x88')]=function(_0x41a10f,_0x3a75b3,_0x2a39d9){return db[_0xc4c5('0x31')]['find']({'where':{'id':_0x41a10f['params']['id']}})[_0xc4c5('0x26')](handleEntityNotFound(_0x3a75b3,null))[_0xc4c5('0x26')](function(_0x514e65){if(_0x514e65){return _0x514e65[_0xc4c5('0x88')](_0x41a10f[_0xc4c5('0x37')][_0xc4c5('0x64')])[_0xc4c5('0x26')](function(){if(_[_0xc4c5('0x60')](_0x41a10f[_0xc4c5('0x37')][_0xc4c5('0x64')])){for(var _0xecce21=0x0;_0xecce21<_0x41a10f[_0xc4c5('0x37')][_0xc4c5('0x64')][_0xc4c5('0x3c')];_0xecce21+=0x1){socket[_0xc4c5('0x89')](_0xc4c5('0x8a'),{'UserId':Number(_0x41a10f['query'][_0xc4c5('0x64')][_0xecce21]),'CmListId':Number(_0x41a10f['params']['id'])});}}else{socket[_0xc4c5('0x89')](_0xc4c5('0x8a'),{'UserId':Number(_0x41a10f[_0xc4c5('0x37')][_0xc4c5('0x64')]),'CmListId':Number(_0x41a10f[_0xc4c5('0x4a')]['id'])});}});}})[_0xc4c5('0x26')](respondWithStatusCode(_0x3a75b3,null))[_0xc4c5('0x48')](handleError(_0x3a75b3,null));};exports[_0xc4c5('0x8b')]=function(_0x1031bc,_0x233225,_0x58ddd9){var _0x501368={};var _0x2a9b73={};var _0x16c440;var _0x1fa219;return db[_0xc4c5('0x31')][_0xc4c5('0x58')]({'where':{'id':_0x1031bc[_0xc4c5('0x4a')]['id']}})[_0xc4c5('0x26')](handleEntityNotFound(_0x233225,null))[_0xc4c5('0x26')](function(_0x28c7c0){if(_0x28c7c0){_0x16c440=_0x28c7c0;_0x2a9b73[_0xc4c5('0x36')]=_[_0xc4c5('0x38')](db[_0xc4c5('0x8c')][_0xc4c5('0x32')]);_0x2a9b73[_0xc4c5('0x37')]=_['keys'](_0x1031bc[_0xc4c5('0x37')]);_0x2a9b73[_0xc4c5('0x3f')]=_['intersection'](_0x2a9b73['model'],_0x2a9b73[_0xc4c5('0x37')]);_0x501368[_0xc4c5('0x3b')]=_[_0xc4c5('0x39')](_0x2a9b73[_0xc4c5('0x36')],qs[_0xc4c5('0x3a')](_0x1031bc[_0xc4c5('0x37')][_0xc4c5('0x3a')]));_0x501368['attributes']=_0x501368[_0xc4c5('0x3b')][_0xc4c5('0x3c')]?_0x501368[_0xc4c5('0x3b')]:_0x2a9b73[_0xc4c5('0x36')];_0x501368['order']=qs[_0xc4c5('0x5b')](_0x1031bc[_0xc4c5('0x37')][_0xc4c5('0x5b')]);_0x501368[_0xc4c5('0x3e')]=qs[_0xc4c5('0x3f')](_[_0xc4c5('0x40')](_0x1031bc[_0xc4c5('0x37')],_0x2a9b73[_0xc4c5('0x3f')]));if(_0x1031bc[_0xc4c5('0x37')]['filter']){_0x501368[_0xc4c5('0x3e')]=_['merge'](_0x501368['where'],{'$or':_['map'](_0x501368[_0xc4c5('0x3b')],function(_0x2d2272){var _0x1281c1={};_0x1281c1[_0x2d2272]={'$like':'%'+_0x1031bc[_0xc4c5('0x37')][_0xc4c5('0x41')]+'%'};return _0x1281c1;})});}_0x501368=_[_0xc4c5('0x42')]({},_0x501368,_0x1031bc['options']);return _0x16c440[_0xc4c5('0x8b')](_0x501368);}})['then'](function(_0x447486){if(_0x447486){_0x1fa219=_0x447486[_0xc4c5('0x3c')];if(!_0x1031bc[_0xc4c5('0x37')][_0xc4c5('0x3d')]('nolimit')){_0x501368[_0xc4c5('0x21')]=qs[_0xc4c5('0x21')](_0x1031bc[_0xc4c5('0x37')][_0xc4c5('0x21')]);_0x501368['offset']=qs['offset'](_0x1031bc['query'][_0xc4c5('0x1e')]);}return _0x16c440[_0xc4c5('0x8b')](_0x501368);}})[_0xc4c5('0x26')](function(_0xaf55f8){if(_0xaf55f8){return _0xaf55f8?{'count':_0x1fa219,'rows':_0xaf55f8}:null;}})[_0xc4c5('0x26')](respondWithResult(_0x233225,null))[_0xc4c5('0x48')](handleError(_0x233225,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index ee2bc8c..814fe74 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 _0x326f=['exports','events','setMaxListeners','save','update','remove','emit','hook'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x326f,0xd1));var _0xf326=function(_0x3cb1f9,_0x1b6c83){_0x3cb1f9=_0x3cb1f9-0x0;var _0x370ed3=_0x326f[_0x3cb1f9];return _0x370ed3;};'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 +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0xb02766,_0xa37d90){var _0x560e6c=function(_0x1ea675){while(--_0x1ea675){_0xb02766['push'](_0xb02766['shift']());}};_0x560e6c(++_0xa37d90);}(_0x814b,0x1a2));var _0xb814=function(_0x564615,_0x51000c){_0x564615=_0x564615-0x0;var _0x3e5c3c=_0x814b[_0x564615];return _0x3e5c3c;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 03e8504..c671685 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 _0x4522=['path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','../../config/logger','api','moment','request-promise'];(function(_0x1f7c09,_0xe3dc0d){var _0x5a3eee=function(_0x1c2309){while(--_0x1c2309){_0x1f7c09['push'](_0x1f7c09['shift']());}};_0x5a3eee(++_0xe3dc0d);}(_0x4522,0x1a0));var _0x2452=function(_0x5b6414,_0x214cc5){_0x5b6414=_0x5b6414-0x0;var _0x1179e3=_0x4522[_0x5b6414];return _0x1179e3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2452('0x0'))(_0x2452('0x1'));var moment=require(_0x2452('0x2'));var BPromise=require('bluebird');var rp=require(_0x2452('0x3'));var fs=require('fs');var path=require(_0x2452('0x4'));var rimraf=require(_0x2452('0x5'));var config=require(_0x2452('0x6'));var attributes=require(_0x2452('0x7'));module[_0x2452('0x8')]=function(_0x15fc69,_0x226578){return _0x15fc69[_0x2452('0x9')](_0x2452('0xa'),attributes,{'tableName':_0x2452('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac4a=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cmList.attributes','define','cm_lists'];(function(_0x1f2134,_0x4a613e){var _0x1f3240=function(_0x239b65){while(--_0x239b65){_0x1f2134['push'](_0x1f2134['shift']());}};_0x1f3240(++_0x4a613e);}(_0xac4a,0x13f));var _0xaac4=function(_0x4132a1,_0x2a8789){_0x4132a1=_0x4132a1-0x0;var _0x5db17a=_0xac4a[_0x4132a1];return _0x5db17a;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var moment=require(_0xaac4('0x4'));var BPromise=require(_0xaac4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var attributes=require(_0xaac4('0x8'));module['exports']=function(_0x1283a5,_0x53d03a){return _0x1283a5[_0xaac4('0x9')]('CmList',attributes,{'tableName':_0xaac4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index f0fb44b..0339552 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 _0x869f=['redis','defaults','localhost','socket.io-emitter','./cmList.socket','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x505273,_0x505366){var _0x1f7854=function(_0x57a7fe){while(--_0x57a7fe){_0x505273['push'](_0x505273['shift']());}};_0x1f7854(++_0x505366);}(_0x869f,0x17d));var _0xf869=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x869f[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xf869('0x0'));var util=require(_0xf869('0x1'));var moment=require(_0xf869('0x2'));var BPromise=require(_0xf869('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf869('0x4'))['db'];var utils=require(_0xf869('0x5'));var logger=require(_0xf869('0x6'))(_0xf869('0x7'));var config=require(_0xf869('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf869('0x9')][_0xf869('0xa')]({'port':0x232a});config[_0xf869('0xb')]=_[_0xf869('0xc')](config['redis'],{'host':_0xf869('0xd'),'port':0x18eb});var socket=require(_0xf869('0xe'))(new Redis(config['redis']));require(_0xf869('0xf'))['register'](socket);function respondWithRpcPromise(_0x589d7e,_0x3f3e3a,_0x2b08b5){return new BPromise(function(_0x3812bd,_0x5696a0){return client[_0xf869('0x10')](_0x589d7e,_0x2b08b5)[_0xf869('0x11')](function(_0x2ca9a6){logger[_0xf869('0x12')](_0xf869('0x13'),_0x3f3e3a,_0xf869('0x14'));logger[_0xf869('0x15')](_0xf869('0x16'),_0x3f3e3a,'request\x20sent',JSON['stringify'](_0x2ca9a6));if(_0x2ca9a6[_0xf869('0x17')]){if(_0x2ca9a6[_0xf869('0x17')][_0xf869('0x18')]===0x1f4){logger[_0xf869('0x17')](_0xf869('0x13'),_0x3f3e3a,_0x2ca9a6[_0xf869('0x17')][_0xf869('0x19')]);return _0x5696a0(_0x2ca9a6[_0xf869('0x17')][_0xf869('0x19')]);}logger[_0xf869('0x17')]('CmList,\x20%s,\x20%s',_0x3f3e3a,_0x2ca9a6['error'][_0xf869('0x19')]);return _0x3812bd(_0x2ca9a6['error']['message']);}else{logger['info'](_0xf869('0x13'),_0x3f3e3a,_0xf869('0x14'));_0x3812bd(_0x2ca9a6[_0xf869('0x1a')][_0xf869('0x19')]);}})[_0xf869('0x1b')](function(_0xc90f4d){logger[_0xf869('0x17')](_0xf869('0x13'),_0x3f3e3a,_0xc90f4d);_0x5696a0(_0xc90f4d);});});} \ No newline at end of file +var _0x08b5=['code','message','info','request\x20sent','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','debug','stringify','error'];(function(_0x547e20,_0x284545){var _0x359171=function(_0x590250){while(--_0x590250){_0x547e20['push'](_0x547e20['shift']());}};_0x359171(++_0x284545);}(_0x08b5,0x14a));var _0x508b=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x08b5[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0x508b('0x0'));var util=require(_0x508b('0x1'));var moment=require(_0x508b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x508b('0x3'));var db=require(_0x508b('0x4'))['db'];var utils=require(_0x508b('0x5'));var logger=require(_0x508b('0x6'))(_0x508b('0x7'));var config=require(_0x508b('0x8'));var jayson=require(_0x508b('0x9'));var client=jayson[_0x508b('0xa')]['http']({'port':0x232a});config[_0x508b('0xb')]=_['defaults'](config[_0x508b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x508b('0xc'))(new Redis(config[_0x508b('0xb')]));require(_0x508b('0xd'))[_0x508b('0xe')](socket);function respondWithRpcPromise(_0x1adb27,_0x3f5818,_0x44f509){return new BPromise(function(_0x13e410,_0x3b9ec3){return client[_0x508b('0xf')](_0x1adb27,_0x44f509)[_0x508b('0x10')](function(_0x49c246){logger['info'](_0x508b('0x11'),_0x3f5818,'request\x20sent');logger[_0x508b('0x12')]('CmList,\x20%s,\x20%s,\x20%s',_0x3f5818,'request\x20sent',JSON[_0x508b('0x13')](_0x49c246));if(_0x49c246[_0x508b('0x14')]){if(_0x49c246[_0x508b('0x14')][_0x508b('0x15')]===0x1f4){logger[_0x508b('0x14')](_0x508b('0x11'),_0x3f5818,_0x49c246[_0x508b('0x14')]['message']);return _0x3b9ec3(_0x49c246[_0x508b('0x14')][_0x508b('0x16')]);}logger[_0x508b('0x14')](_0x508b('0x11'),_0x3f5818,_0x49c246[_0x508b('0x14')]['message']);return _0x13e410(_0x49c246['error'][_0x508b('0x16')]);}else{logger[_0x508b('0x17')](_0x508b('0x11'),_0x3f5818,_0x508b('0x18'));_0x13e410(_0x49c246[_0x508b('0x19')]['message']);}})[_0x508b('0x1a')](function(_0x149fee){logger[_0x508b('0x14')](_0x508b('0x11'),_0x3f5818,_0x149fee);_0x3b9ec3(_0x149fee);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 049ff57..aff4098 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 _0x36d4=['cmList:','./cmList.events','save','removeListener','register','length'];(function(_0x227d8c,_0x1dbd11){var _0xcf0207=function(_0x52d099){while(--_0x52d099){_0x227d8c['push'](_0x227d8c['shift']());}};_0xcf0207(++_0x1dbd11);}(_0x36d4,0x6d));var _0x436d=function(_0x51292d,_0x259f8c){_0x51292d=_0x51292d-0x0;var _0x2a62a8=_0x36d4[_0x51292d];return _0x2a62a8;};'use strict';var CmListEvents=require(_0x436d('0x0'));var events=[_0x436d('0x1'),'remove','update'];function createListener(_0x2694f0,_0x53ae6f){return function(_0x2e1b12){_0x53ae6f['emit'](_0x2694f0,_0x2e1b12);};}function removeListener(_0x2f72e0,_0x4ddeec){return function(){CmListEvents[_0x436d('0x2')](_0x2f72e0,_0x4ddeec);};}exports[_0x436d('0x3')]=function(_0x127753){for(var _0x5e854e=0x0,_0x37fb53=events[_0x436d('0x4')];_0x5e854e<_0x37fb53;_0x5e854e++){var _0x2bb902=events[_0x5e854e];var _0x263c4a=createListener(_0x436d('0x5')+_0x2bb902,_0x127753);CmListEvents['on'](_0x2bb902,_0x263c4a);}}; \ No newline at end of file +var _0xfbde=['register','length','cmList:','./cmList.events','save','remove','update','emit','removeListener'];(function(_0x3b3c01,_0x17e39e){var _0x19379b=function(_0x21d9ab){while(--_0x21d9ab){_0x3b3c01['push'](_0x3b3c01['shift']());}};_0x19379b(++_0x17e39e);}(_0xfbde,0x147));var _0xefbd=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0xfbde[_0x710815];return _0x5b3b89;};'use strict';var CmListEvents=require(_0xefbd('0x0'));var events=[_0xefbd('0x1'),_0xefbd('0x2'),_0xefbd('0x3')];function createListener(_0x28dc65,_0x56e05b){return function(_0x295a80){_0x56e05b[_0xefbd('0x4')](_0x28dc65,_0x295a80);};}function removeListener(_0x5c67e8,_0x3c85fd){return function(){CmListEvents[_0xefbd('0x5')](_0x5c67e8,_0x3c85fd);};}exports[_0xefbd('0x6')]=function(_0x3fae76){for(var _0x5e9161=0x0,_0x16ae25=events[_0xefbd('0x7')];_0x5e9161<_0x16ae25;_0x5e9161++){var _0x44f847=events[_0x5e9161];var _0x16eee9=createListener(_0xefbd('0x8')+_0x44f847,_0x3fae76);CmListEvents['on'](_0x44f847,_0x16eee9);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 9feb440..86bb29c 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 _0x8310=['get','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index'];(function(_0x3a871e,_0x4a6705){var _0x2ddb00=function(_0x15af90){while(--_0x15af90){_0x3a871e['push'](_0x3a871e['shift']());}};_0x2ddb00(++_0x4a6705);}(_0x8310,0x1f4));var _0x0831=function(_0x1e175d,_0x41ff45){_0x1e175d=_0x1e175d-0x0;var _0x3a3ce5=_0x8310[_0x1e175d];return _0x3a3ce5;};'use strict';var multer=require(_0x0831('0x0'));var util=require(_0x0831('0x1'));var path=require('path');var timeout=require(_0x0831('0x2'));var express=require('express');var router=express[_0x0831('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0831('0x4'));var interaction=require(_0x0831('0x5'));var config=require(_0x0831('0x6'));var controller=require(_0x0831('0x7'));router['get']('/',auth[_0x0831('0x8')](),controller[_0x0831('0x9')]);router[_0x0831('0xa')](_0x0831('0xb'),auth[_0x0831('0x8')](),controller[_0x0831('0xc')]);router[_0x0831('0xa')](_0x0831('0xd'),auth[_0x0831('0x8')](),controller['show']);router[_0x0831('0xa')](_0x0831('0xe'),auth[_0x0831('0x8')](),controller[_0x0831('0xf')]);router[_0x0831('0xa')](_0x0831('0x10'),auth[_0x0831('0x8')](),controller['getContacts']);router['get'](_0x0831('0x11'),auth['isAuthenticated'](),controller['getContactsCsv']);router['get'](_0x0831('0x12'),auth[_0x0831('0x8')](),controller[_0x0831('0x13')]);router[_0x0831('0xa')](_0x0831('0x14'),auth[_0x0831('0x8')](),controller[_0x0831('0x15')]);router[_0x0831('0x16')]('/',auth[_0x0831('0x8')](),controller[_0x0831('0x17')]);router['post'](_0x0831('0xe'),auth[_0x0831('0x8')](),controller[_0x0831('0x18')]);router[_0x0831('0x16')](_0x0831('0x10'),auth[_0x0831('0x8')](),controller[_0x0831('0x19')]);router[_0x0831('0x16')]('/:id/fields',auth[_0x0831('0x8')](),controller[_0x0831('0x1a')]);router['post']('/:id/users',auth[_0x0831('0x8')](),controller[_0x0831('0x1b')]);router[_0x0831('0x1c')](_0x0831('0xd'),auth[_0x0831('0x8')](),controller[_0x0831('0x1d')]);router[_0x0831('0x1e')](_0x0831('0xd'),auth[_0x0831('0x8')](),controller[_0x0831('0x1f')]);router['delete'](_0x0831('0xe'),auth[_0x0831('0x8')](),controller[_0x0831('0x20')]);router[_0x0831('0x1e')](_0x0831('0x14'),auth[_0x0831('0x8')](),controller['removeAgents']);module[_0x0831('0x21')]=router; \ No newline at end of file +var _0xb41d=['getContactsCsv','/:id/fields','/:id/users','post','create','addContacts','addCustomField','addAgents','put','delete','destroy','removeDispositions','removeAgents','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv'];(function(_0x9ba57c,_0x5ecc0d){var _0x627a6e=function(_0x3c702d){while(--_0x3c702d){_0x9ba57c['push'](_0x9ba57c['shift']());}};_0x627a6e(++_0x5ecc0d);}(_0xb41d,0x6a));var _0xdb41=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xb41d[_0x3b0731];return _0x4204d7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdb41('0x0'));var timeout=require(_0xdb41('0x1'));var express=require(_0xdb41('0x2'));var router=express[_0xdb41('0x3')]();var fs_extra=require(_0xdb41('0x4'));var auth=require(_0xdb41('0x5'));var interaction=require(_0xdb41('0x6'));var config=require(_0xdb41('0x7'));var controller=require(_0xdb41('0x8'));router[_0xdb41('0x9')]('/',auth[_0xdb41('0xa')](),controller[_0xdb41('0xb')]);router[_0xdb41('0x9')]('/describe',auth[_0xdb41('0xa')](),controller['describe']);router[_0xdb41('0x9')](_0xdb41('0xc'),auth[_0xdb41('0xa')](),controller[_0xdb41('0xd')]);router[_0xdb41('0x9')](_0xdb41('0xe'),auth['isAuthenticated'](),controller[_0xdb41('0xf')]);router[_0xdb41('0x9')](_0xdb41('0x10'),auth[_0xdb41('0xa')](),controller['getContacts']);router['get'](_0xdb41('0x11'),auth[_0xdb41('0xa')](),controller[_0xdb41('0x12')]);router[_0xdb41('0x9')](_0xdb41('0x13'),auth[_0xdb41('0xa')](),controller['getCustomFields']);router[_0xdb41('0x9')](_0xdb41('0x14'),auth['isAuthenticated'](),controller['getAgents']);router[_0xdb41('0x15')]('/',auth[_0xdb41('0xa')](),controller[_0xdb41('0x16')]);router[_0xdb41('0x15')](_0xdb41('0xe'),auth[_0xdb41('0xa')](),controller['addDisposition']);router[_0xdb41('0x15')](_0xdb41('0x10'),auth[_0xdb41('0xa')](),controller[_0xdb41('0x17')]);router[_0xdb41('0x15')](_0xdb41('0x13'),auth[_0xdb41('0xa')](),controller[_0xdb41('0x18')]);router[_0xdb41('0x15')](_0xdb41('0x14'),auth['isAuthenticated'](),controller[_0xdb41('0x19')]);router[_0xdb41('0x1a')]('/:id',auth[_0xdb41('0xa')](),controller['update']);router[_0xdb41('0x1b')](_0xdb41('0xc'),auth[_0xdb41('0xa')](),controller[_0xdb41('0x1c')]);router[_0xdb41('0x1b')](_0xdb41('0xe'),auth[_0xdb41('0xa')](),controller[_0xdb41('0x1d')]);router['delete'](_0xdb41('0x14'),auth[_0xdb41('0xa')](),controller[_0xdb41('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 e0f6d9f..3966bf3 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 _0x18eb=['sequelize','exports','VIRTUAL','field','STRING'];(function(_0x2b59cf,_0x55aced){var _0x4ff54d=function(_0x11c8e1){while(--_0x11c8e1){_0x2b59cf['push'](_0x2b59cf['shift']());}};_0x4ff54d(++_0x55aced);}(_0x18eb,0x91));var _0xb18e=function(_0x4f4bc7,_0x51f839){_0x4f4bc7=_0x4f4bc7-0x0;var _0x16f8f6=_0x18eb[_0x4f4bc7];return _0x16f8f6;};'use strict';var Sequelize=require(_0xb18e('0x0'));module[_0xb18e('0x1')]={'name':{'type':Sequelize[_0xb18e('0x2')],'get':function(_0xab94c4){return this['getDataValue'](_0xb18e('0x3'));}},'field':{'type':Sequelize[_0xb18e('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xb18e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xb18e('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xe9a7=['VIRTUAL','getDataValue','field','STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe9a7,0x1cc));var _0x7e9a=function(_0x5d61b4,_0x4f7b91){_0x5d61b4=_0x5d61b4-0x0;var _0x183fc5=_0xe9a7[_0x5d61b4];return _0x183fc5;};'use strict';var Sequelize=require(_0x7e9a('0x0'));module[_0x7e9a('0x1')]={'name':{'type':Sequelize[_0x7e9a('0x2')],'get':function(_0x18b962){return this[_0x7e9a('0x3')](_0x7e9a('0x4'));}},'field':{'type':Sequelize[_0x7e9a('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x7e9a('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x7e9a('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 1331e9a..833f2d1 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x13b037,_0x52201b){var _0x3eaec5=function(_0x3c4211){while(--_0x3c4211){_0x13b037['push'](_0x13b037['shift']());}};_0x3eaec5(++_0x52201b);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x297932,_0x5186b3){var _0x2a54ac=function(_0x12c64f){while(--_0x12c64f){_0x297932['push'](_0x297932['shift']());}};_0x2a54ac(++_0x5186b3);}(_0x7a54,0x106));var _0x47a5=function(_0x1c4800,_0x1c0a7d){_0x1c4800=_0x1c4800-0x0;var _0x2d352d=_0x7a54[_0x1c4800];return _0x2d352d;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index b3896b5..337da5d 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 _0xdad8=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','define','Condition'];(function(_0x5535f4,_0x29d970){var _0x1cca13=function(_0x2ebab5){while(--_0x2ebab5){_0x5535f4['push'](_0x5535f4['shift']());}};_0x1cca13(++_0x29d970);}(_0xdad8,0xc6));var _0x8dad=function(_0x3d0599,_0x265599){_0x3d0599=_0x3d0599-0x0;var _0x3b3137=_0xdad8[_0x3d0599];return _0x3b3137;};'use strict';var _=require(_0x8dad('0x0'));var util=require(_0x8dad('0x1'));var logger=require(_0x8dad('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8dad('0x3'));var rp=require(_0x8dad('0x4'));var fs=require('fs');var path=require(_0x8dad('0x5'));var rimraf=require(_0x8dad('0x6'));var config=require(_0x8dad('0x7'));var attributes=require(_0x8dad('0x8'));module['exports']=function(_0x3af85d,_0x363996){return _0x3af85d[_0x8dad('0x9')](_0x8dad('0xa'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b22=['bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','util','../../config/logger','api','moment'];(function(_0x5774f1,_0x48c635){var _0x1288d9=function(_0x539267){while(--_0x539267){_0x5774f1['push'](_0x5774f1['shift']());}};_0x1288d9(++_0x48c635);}(_0x4b22,0xa4));var _0x24b2=function(_0x305cfa,_0x2d929c){_0x305cfa=_0x305cfa-0x0;var _0x15d28d=_0x4b22[_0x305cfa];return _0x15d28d;};'use strict';var _=require('lodash');var util=require(_0x24b2('0x0'));var logger=require(_0x24b2('0x1'))(_0x24b2('0x2'));var moment=require(_0x24b2('0x3'));var BPromise=require(_0x24b2('0x4'));var rp=require(_0x24b2('0x5'));var fs=require('fs');var path=require(_0x24b2('0x6'));var rimraf=require(_0x24b2('0x7'));var config=require(_0x24b2('0x8'));var attributes=require(_0x24b2('0x9'));module[_0x24b2('0xa')]=function(_0x3593b0,_0xaa4eed){return _0x3593b0[_0x24b2('0xb')](_0x24b2('0xc'),attributes,{'tableName':_0x24b2('0xd'),'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 4cc06c7..f3a1a2f 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 _0x334d=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x417d5a,_0x2b77bf){var _0x48b24c=function(_0xa0a15e){while(--_0xa0a15e){_0x417d5a['push'](_0x417d5a['shift']());}};_0x48b24c(++_0x2b77bf);}(_0x334d,0xab));var _0xd334=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x334d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd334('0x0'));var util=require(_0xd334('0x1'));var moment=require(_0xd334('0x2'));var BPromise=require(_0xd334('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd334('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd334('0x5'));var logger=require(_0xd334('0x6'))('rpc');var config=require(_0xd334('0x7'));var jayson=require(_0xd334('0x8'));var client=jayson[_0xd334('0x9')][_0xd334('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55a610,_0x5065cd,_0x39f858){return new BPromise(function(_0x2a54eb,_0x203884){return client[_0xd334('0xb')](_0x55a610,_0x39f858)[_0xd334('0xc')](function(_0x54c6c2){logger[_0xd334('0xd')](_0xd334('0xe'),_0x5065cd,_0xd334('0xf'));logger['debug'](_0xd334('0x10'),_0x5065cd,_0xd334('0xf'),JSON[_0xd334('0x11')](_0x54c6c2));if(_0x54c6c2[_0xd334('0x12')]){if(_0x54c6c2[_0xd334('0x12')]['code']===0x1f4){logger[_0xd334('0x12')](_0xd334('0xe'),_0x5065cd,_0x54c6c2[_0xd334('0x12')][_0xd334('0x13')]);return _0x203884(_0x54c6c2[_0xd334('0x12')][_0xd334('0x13')]);}logger[_0xd334('0x12')](_0xd334('0xe'),_0x5065cd,_0x54c6c2['error'][_0xd334('0x13')]);return _0x2a54eb(_0x54c6c2[_0xd334('0x12')][_0xd334('0x13')]);}else{logger[_0xd334('0xd')](_0xd334('0xe'),_0x5065cd,_0xd334('0xf'));_0x2a54eb(_0x54c6c2[_0xd334('0x14')]['message']);}})[_0xd334('0x15')](function(_0x954592){logger[_0xd334('0x12')](_0xd334('0xe'),_0x5065cd,_0x954592);_0x203884(_0x954592);});});} \ No newline at end of file +var _0xdd80=['then','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x2d42c8,_0xbb85b5){var _0x50d620=function(_0x51cb35){while(--_0x51cb35){_0x2d42c8['push'](_0x2d42c8['shift']());}};_0x50d620(++_0xbb85b5);}(_0xdd80,0x1ac));var _0x0dd8=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdd80[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x0dd8('0x0'));var util=require(_0x0dd8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0dd8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0dd8('0x3'));var logger=require(_0x0dd8('0x4'))(_0x0dd8('0x5'));var config=require('../../config/environment');var jayson=require(_0x0dd8('0x6'));var client=jayson[_0x0dd8('0x7')][_0x0dd8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x54b0c9,_0x567796,_0x554fb5){return new BPromise(function(_0x518ef5,_0x58545a){return client['request'](_0x54b0c9,_0x554fb5)[_0x0dd8('0x9')](function(_0x70ac4a){logger['info']('Condition,\x20%s,\x20%s',_0x567796,_0x0dd8('0xa'));logger[_0x0dd8('0xb')](_0x0dd8('0xc'),_0x567796,_0x0dd8('0xa'),JSON[_0x0dd8('0xd')](_0x70ac4a));if(_0x70ac4a[_0x0dd8('0xe')]){if(_0x70ac4a[_0x0dd8('0xe')][_0x0dd8('0xf')]===0x1f4){logger[_0x0dd8('0xe')](_0x0dd8('0x10'),_0x567796,_0x70ac4a[_0x0dd8('0xe')][_0x0dd8('0x11')]);return _0x58545a(_0x70ac4a['error'][_0x0dd8('0x11')]);}logger[_0x0dd8('0xe')](_0x0dd8('0x10'),_0x567796,_0x70ac4a[_0x0dd8('0xe')][_0x0dd8('0x11')]);return _0x518ef5(_0x70ac4a[_0x0dd8('0xe')][_0x0dd8('0x11')]);}else{logger['info'](_0x0dd8('0x10'),_0x567796,_0x0dd8('0xa'));_0x518ef5(_0x70ac4a['result'][_0x0dd8('0x11')]);}})[_0x0dd8('0x12')](function(_0x53450a){logger[_0x0dd8('0xe')](_0x0dd8('0x10'),_0x567796,_0x53450a);_0x58545a(_0x53450a);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index f8b1dff..3a1514f 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 _0x4876=['put','/:id','delete','isAuthenticated','exports','multer','util','connect-timeout','express','fs-extra','../../config/environment'];(function(_0x4cbebe,_0x213397){var _0x429c99=function(_0x5e3278){while(--_0x5e3278){_0x4cbebe['push'](_0x4cbebe['shift']());}};_0x429c99(++_0x213397);}(_0x4876,0x1c8));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6487('0x0'));var util=require(_0x6487('0x1'));var path=require('path');var timeout=require(_0x6487('0x2'));var express=require(_0x6487('0x3'));var router=express['Router']();var fs_extra=require(_0x6487('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6487('0x5'));var controller=require('./condition.controller');router[_0x6487('0x6')](_0x6487('0x7'),auth['isAuthenticated'](),controller['update']);router[_0x6487('0x8')](_0x6487('0x7'),auth[_0x6487('0x9')](),controller['destroy']);module[_0x6487('0xa')]=router; \ No newline at end of file +var _0xcbae=['exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','destroy'];(function(_0x523adf,_0x3e1620){var _0x283870=function(_0xa0e816){while(--_0xa0e816){_0x523adf['push'](_0x523adf['shift']());}};_0x283870(++_0x3e1620);}(_0xcbae,0xfd));var _0xecba=function(_0x2abfc3,_0xbffcf7){_0x2abfc3=_0x2abfc3-0x0;var _0x35d152=_0xcbae[_0x2abfc3];return _0x35d152;};'use strict';var multer=require(_0xecba('0x0'));var util=require('util');var path=require(_0xecba('0x1'));var timeout=require(_0xecba('0x2'));var express=require(_0xecba('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xecba('0x4'));var interaction=require(_0xecba('0x5'));var config=require(_0xecba('0x6'));var controller=require(_0xecba('0x7'));router[_0xecba('0x8')](_0xecba('0x9'),auth[_0xecba('0xa')](),controller[_0xecba('0xb')]);router['delete'](_0xecba('0x9'),auth[_0xecba('0xa')](),controller[_0xecba('0xc')]);module[_0xecba('0xd')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 1940228..76f2f2d 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['STRING','name'];(function(_0x52f821,_0x1657c5){var _0x783db3=function(_0x11a634){while(--_0x11a634){_0x52f821['push'](_0x52f821['shift']());}};_0x783db3(++_0x1657c5);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x1ac621,_0x14083a){var _0x109dff=function(_0xcf1a7){while(--_0xcf1a7){_0x1ac621['push'](_0x1ac621['shift']());}};_0x109dff(++_0x14083a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'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 db60e8b..a915430 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 _0xd48a=['getItems','findOne','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','moment','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','CustomDashboards','UserProfileResource','destroy','then','end','error','name','send','index','Dashboard','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','order','sort','pick','filters','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','autoAssociation','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem'];(function(_0x1e3f14,_0x18c586){var _0x60e5b5=function(_0x302d1b){while(--_0x302d1b){_0x1e3f14['push'](_0x1e3f14['shift']());}};_0x60e5b5(++_0x18c586);}(_0xd48a,0x1f4));var _0xad48=function(_0x3e7d87,_0x809e47){_0x3e7d87=_0x3e7d87-0x0;var _0xc612a4=_0xd48a[_0x3e7d87];return _0xc612a4;};'use strict';var emlformat=require(_0xad48('0x0'));var rimraf=require(_0xad48('0x1'));var zipdir=require(_0xad48('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xad48('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xad48('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xad48('0x5'));var ejs=require(_0xad48('0x6'));var fs=require('fs');var fs_extra=require(_0xad48('0x7'));var _=require(_0xad48('0x8'));var squel=require(_0xad48('0x9'));var crypto=require('crypto');var jsforce=require(_0xad48('0xa'));var deskjs=require(_0xad48('0xb'));var toCsv=require(_0xad48('0x5'));var querystring=require('querystring');var Papa=require(_0xad48('0xc'));var Redis=require('ioredis');var authService=require(_0xad48('0xd'));var qs=require(_0xad48('0xe'));var as=require(_0xad48('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xad48('0x10'))('api');var utils=require(_0xad48('0x11'));var config=require(_0xad48('0x12'));var licenseUtil=require(_0xad48('0x13'));var db=require(_0xad48('0x14'))['db'];config[_0xad48('0x15')]=_[_0xad48('0x16')](config[_0xad48('0x15')],{'host':_0xad48('0x17'),'port':0x18eb});var socket=require(_0xad48('0x18'))(new Redis(config[_0xad48('0x15')]));require(_0xad48('0x19'))['register'](socket);function respondWithStatusCode(_0x9066e9,_0xc0e1e){_0xc0e1e=_0xc0e1e||0xcc;return function(_0x50a42a){if(_0x50a42a){return _0x9066e9[_0xad48('0x1a')](_0xc0e1e);}return _0x9066e9['status'](_0xc0e1e)['end']();};}function respondWithResult(_0x43d274,_0xb7fa85){_0xb7fa85=_0xb7fa85||0xc8;return function(_0xdb529a){if(_0xdb529a){return _0x43d274[_0xad48('0x1b')](_0xb7fa85)[_0xad48('0x1c')](_0xdb529a);}};}function respondWithFilteredResult(_0x713235,_0x461648){return function(_0x5405d0){if(_0x5405d0){var _0x2710ee=typeof _0x461648[_0xad48('0x1d')]===_0xad48('0x1e')&&typeof _0x461648[_0xad48('0x1f')]===_0xad48('0x1e');var _0x233726=_0x5405d0[_0xad48('0x20')];var _0x75f04a=_0x2710ee?0x0:_0x461648[_0xad48('0x1d')];var _0x4fc891=_0x2710ee?_0x5405d0['count']:_0x461648['offset']+_0x461648[_0xad48('0x1f')];var _0x5111c4;if(_0x4fc891>=_0x233726){_0x4fc891=_0x233726;_0x5111c4=0xc8;}else{_0x5111c4=0xce;}_0x713235[_0xad48('0x1b')](_0x5111c4);return _0x713235[_0xad48('0x21')](_0xad48('0x22'),_0x75f04a+'-'+_0x4fc891+'/'+_0x233726)[_0xad48('0x1c')](_0x5405d0);}return null;};}function patchUpdates(_0x4119ad){return function(_0x5a4a61){try{jsonpatch[_0xad48('0x23')](_0x5a4a61,_0x4119ad,!![]);}catch(_0x165f64){return BPromise[_0xad48('0x24')](_0x165f64);}return _0x5a4a61[_0xad48('0x25')]();};}function saveUpdates(_0x4d75b3,_0x41d987){return function(_0x1fe720){if(_0x1fe720){return _0x1fe720[_0xad48('0x26')](_0x4d75b3)['then'](function(_0x3d8fa1){return _0x3d8fa1;});}return null;};}function removeEntity(_0x49429e,_0x5449a1){return function(_0x4c6e91){if(_0x4c6e91){return _0x4c6e91['destroy']()['then'](function(){var _0x59e766=_0x4c6e91[_0xad48('0x27')]({'plain':!![]});var _0x1b3d19=_0xad48('0x28');return db[_0xad48('0x29')][_0xad48('0x2a')]({'where':{'type':_0x1b3d19,'resourceId':_0x59e766['id']}})['then'](function(){return _0x4c6e91;});})[_0xad48('0x2b')](function(){_0x49429e['status'](0xcc)[_0xad48('0x2c')]();});}};}function handleEntityNotFound(_0x4bb140,_0x26f925){return function(_0x5d4d2c){if(!_0x5d4d2c){_0x4bb140[_0xad48('0x1a')](0x194);}return _0x5d4d2c;};}function handleError(_0x58d8aa,_0xc92fdf){_0xc92fdf=_0xc92fdf||0x1f4;return function(_0x5521a0){logger[_0xad48('0x2d')](_0x5521a0['stack']);if(_0x5521a0[_0xad48('0x2e')]){delete _0x5521a0[_0xad48('0x2e')];}_0x58d8aa[_0xad48('0x1b')](_0xc92fdf)[_0xad48('0x2f')](_0x5521a0);};}exports[_0xad48('0x30')]=function(_0x1ccefd,_0x251c69){var _0xc22a61={},_0x3bcfd6={},_0x25b47e={'count':0x0,'rows':[]};var _0x37bf33=_['map'](db[_0xad48('0x31')][_0xad48('0x32')],function(_0x2ba977){return{'name':_0x2ba977[_0xad48('0x33')],'type':_0x2ba977[_0xad48('0x34')][_0xad48('0x35')]};});_0x3bcfd6[_0xad48('0x36')]=_['map'](_0x37bf33,_0xad48('0x2e'));_0x3bcfd6['query']=_['keys'](_0x1ccefd[_0xad48('0x37')]);_0x3bcfd6['filters']=_[_0xad48('0x38')](_0x3bcfd6[_0xad48('0x36')],_0x3bcfd6[_0xad48('0x37')]);_0xc22a61[_0xad48('0x39')]=_[_0xad48('0x38')](_0x3bcfd6[_0xad48('0x36')],qs[_0xad48('0x3a')](_0x1ccefd['query'][_0xad48('0x3a')]));_0xc22a61[_0xad48('0x39')]=_0xc22a61['attributes'][_0xad48('0x3b')]?_0xc22a61[_0xad48('0x39')]:_0x3bcfd6['model'];if(!_0x1ccefd[_0xad48('0x37')]['hasOwnProperty']('nolimit')){_0xc22a61[_0xad48('0x1f')]=qs['limit'](_0x1ccefd[_0xad48('0x37')][_0xad48('0x1f')]);_0xc22a61[_0xad48('0x1d')]=qs[_0xad48('0x1d')](_0x1ccefd[_0xad48('0x37')][_0xad48('0x1d')]);}_0xc22a61[_0xad48('0x3c')]=qs['sort'](_0x1ccefd[_0xad48('0x37')][_0xad48('0x3d')]);_0xc22a61['where']=qs['filters'](_[_0xad48('0x3e')](_0x1ccefd[_0xad48('0x37')],_0x3bcfd6[_0xad48('0x3f')]),_0x37bf33);if(_0x1ccefd[_0xad48('0x37')][_0xad48('0x40')]){_0xc22a61[_0xad48('0x41')]=_[_0xad48('0x42')](_0xc22a61[_0xad48('0x41')],{'$or':_[_0xad48('0x43')](_0x37bf33,function(_0x1e6130){if(_0x1e6130['type']!==_0xad48('0x44')){var _0x2b58da={};_0x2b58da[_0x1e6130[_0xad48('0x2e')]]={'$like':'%'+_0x1ccefd[_0xad48('0x37')]['filter']+'%'};return _0x2b58da;}})});}_0xc22a61=_[_0xad48('0x42')]({},_0xc22a61,_0x1ccefd[_0xad48('0x45')]);var _0x140322={'where':_0xc22a61[_0xad48('0x41')]};return db['Dashboard'][_0xad48('0x20')](_0x140322)[_0xad48('0x2b')](function(_0xaa4dc){_0x25b47e['count']=_0xaa4dc;if(_0x1ccefd[_0xad48('0x37')][_0xad48('0x46')]){_0xc22a61[_0xad48('0x47')]=[{'all':!![]}];}return db[_0xad48('0x31')][_0xad48('0x48')](_0xc22a61);})[_0xad48('0x2b')](function(_0x53ade0){_0x25b47e[_0xad48('0x49')]=_0x53ade0;return _0x25b47e;})['then'](respondWithFilteredResult(_0x251c69,_0xc22a61))[_0xad48('0x4a')](handleError(_0x251c69,null));};exports[_0xad48('0x4b')]=function(_0x35e87b,_0x1ca7c6){var _0x3239a5={'raw':![],'where':{'id':_0x35e87b[_0xad48('0x4c')]['id']}},_0x4a3638={};_0x4a3638['model']=_['keys'](db[_0xad48('0x31')][_0xad48('0x32')]);_0x4a3638[_0xad48('0x37')]=_[_0xad48('0x4d')](_0x35e87b[_0xad48('0x37')]);_0x4a3638[_0xad48('0x3f')]=_[_0xad48('0x38')](_0x4a3638[_0xad48('0x36')],_0x4a3638['query']);_0x3239a5['attributes']=_['intersection'](_0x4a3638['model'],qs[_0xad48('0x3a')](_0x35e87b[_0xad48('0x37')]['fields']));_0x3239a5[_0xad48('0x39')]=_0x3239a5[_0xad48('0x39')][_0xad48('0x3b')]?_0x3239a5[_0xad48('0x39')]:_0x4a3638[_0xad48('0x36')];if(_0x35e87b[_0xad48('0x37')][_0xad48('0x46')]){_0x3239a5['include']=[{'all':!![]}];}_0x3239a5=_[_0xad48('0x42')]({},_0x3239a5,_0x35e87b[_0xad48('0x45')]);return db[_0xad48('0x31')][_0xad48('0x4e')](_0x3239a5)[_0xad48('0x2b')](handleEntityNotFound(_0x1ca7c6,null))[_0xad48('0x2b')](respondWithResult(_0x1ca7c6,null))[_0xad48('0x4a')](handleError(_0x1ca7c6,null));};exports['create']=function(_0xd3e185,_0x1e8745){return db[_0xad48('0x31')][_0xad48('0x4f')](_0xd3e185['body'],{})[_0xad48('0x2b')](function(_0x1f6611){var _0x5c1711=_0xd3e185[_0xad48('0x50')]['get']({'plain':!![]});if(!_0x5c1711)throw new Error(_0xad48('0x51'));if(_0x5c1711[_0xad48('0x52')]===_0xad48('0x50')){var _0x45cf1d=_0x1f6611[_0xad48('0x27')]({'plain':!![]});var _0x5369b3='CustomDashboards';return db[_0xad48('0x53')]['find']({'where':{'name':_0x5369b3,'userProfileId':_0x5c1711[_0xad48('0x54')]},'raw':!![]})[_0xad48('0x2b')](function(_0x29d261){if(_0x29d261&&_0x29d261['autoAssociation']===0x0){return db[_0xad48('0x29')]['create']({'name':_0x45cf1d['name'],'resourceId':_0x45cf1d['id'],'type':_0x29d261[_0xad48('0x2e')],'sectionId':_0x29d261['id']},{})[_0xad48('0x2b')](function(){return _0x1f6611;});}else{return _0x1f6611;}})['catch'](function(_0x22f229){logger[_0xad48('0x2d')](_0xad48('0x55'),_0x22f229);throw _0x22f229;});}return _0x1f6611;})[_0xad48('0x2b')](respondWithResult(_0x1e8745,0xc9))['catch'](handleError(_0x1e8745,null));};exports[_0xad48('0x56')]=function(_0xd8d95c,_0x1dabc3){var _0x3fbb70={'where':{'id':_0xd8d95c[_0xad48('0x4c')]['id']}},_0x328f87={};_0x328f87[_0xad48('0x36')]=_['keys'](db['Dashboard'][_0xad48('0x32')]);_0x3fbb70[_0xad48('0x39')]=_[_0xad48('0x38')](_0x328f87[_0xad48('0x36')],qs['fields'](_0xd8d95c[_0xad48('0x37')][_0xad48('0x3a')]));_0x3fbb70[_0xad48('0x39')]=_0x3fbb70[_0xad48('0x39')]['length']?_0x3fbb70[_0xad48('0x39')]:_0x328f87['model'];if(_0xd8d95c[_0xad48('0x37')]['includeAll']){_0x3fbb70[_0xad48('0x47')]=[{'all':!![]}];}_0x3fbb70=_[_0xad48('0x42')]({},_0x3fbb70,_0xd8d95c[_0xad48('0x45')]);return db[_0xad48('0x31')][_0xad48('0x4e')](_0x3fbb70)[_0xad48('0x2b')](handleEntityNotFound(_0x1dabc3,null))[_0xad48('0x2b')](function(_0x21bf7e){if(_0x21bf7e){var _0x195639=_0x21bf7e['get']({'plain':!![]});_0x195639=qs[_0xad48('0x57')](_0x195639,['id',_0xad48('0x58'),_0xad48('0x59')]);_0xd8d95c['body']=_[_0xad48('0x57')](_0xd8d95c[_0xad48('0x5a')],['id','createdAt',_0xad48('0x59')]);return db[_0xad48('0x31')]['create'](_[_0xad48('0x42')](_0x195639,_0xd8d95c[_0xad48('0x5a')]),{'include':_0xd8d95c[_0xad48('0x37')][_0xad48('0x46')]?[{'all':!![]}]:undefined})[_0xad48('0x2b')](function(_0x499daf){var _0x2c63e3=_0xd8d95c[_0xad48('0x50')][_0xad48('0x27')]({'plain':!![]});if(!_0x2c63e3)throw new Error(_0xad48('0x51'));if(_0x2c63e3[_0xad48('0x52')]===_0xad48('0x50')){var _0xd6be85=_0x499daf[_0xad48('0x27')]({'plain':!![]});var _0x300aa3=_0xad48('0x28');return db[_0xad48('0x53')]['find']({'where':{'name':_0x300aa3,'userProfileId':_0x2c63e3[_0xad48('0x54')]},'raw':!![]})[_0xad48('0x2b')](function(_0x37eb4c){if(_0x37eb4c&&_0x37eb4c[_0xad48('0x5b')]===0x0){return db[_0xad48('0x29')][_0xad48('0x4f')]({'name':_0xd6be85[_0xad48('0x2e')],'resourceId':_0xd6be85['id'],'type':_0x37eb4c['name'],'sectionId':_0x37eb4c['id']},{})[_0xad48('0x2b')](function(){return _0x499daf;});}else{return _0x499daf;}})[_0xad48('0x4a')](function(_0x439427){logger[_0xad48('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x439427);throw _0x439427;});}return _0x499daf;});}})['then'](respondWithResult(_0x1dabc3,0xc9))[_0xad48('0x4a')](handleError(_0x1dabc3,null));};exports[_0xad48('0x26')]=function(_0x52e637,_0x4ba402){if(_0x52e637['body']['id']){delete _0x52e637[_0xad48('0x5a')]['id'];}return db[_0xad48('0x31')][_0xad48('0x4e')]({'where':{'id':_0x52e637['params']['id']}})['then'](handleEntityNotFound(_0x4ba402,null))['then'](saveUpdates(_0x52e637[_0xad48('0x5a')],null))['then'](respondWithResult(_0x4ba402,null))[_0xad48('0x4a')](handleError(_0x4ba402,null));};exports[_0xad48('0x2a')]=function(_0x487290,_0x459a73){return db['Dashboard'][_0xad48('0x4e')]({'where':{'id':_0x487290['params']['id']}})[_0xad48('0x2b')](handleEntityNotFound(_0x459a73,null))[_0xad48('0x2b')](removeEntity(_0x459a73,null))[_0xad48('0x4a')](handleError(_0x459a73,null));};function widgetAttributes(_0x3bc2e0){try{switch(_0x3bc2e0[_0xad48('0x34')]){case _0xad48('0x5c'):return[{'name':'attrUrl','value':_0x3bc2e0[_0xad48('0x5d')]||(_0x3bc2e0[_0xad48('0x5e')]&&_0x3bc2e0[_0xad48('0x5e')][0x0]?_0x3bc2e0[_0xad48('0x5e')][0x0][_0xad48('0x5f')]:undefined)||_0xad48('0x60')}];case _0xad48('0x61'):return[{'name':_0xad48('0x62'),'value':_0x3bc2e0[_0xad48('0x62')]||(_0x3bc2e0['attrs']&&_0x3bc2e0[_0xad48('0x5e')][0x0]?_0x3bc2e0[_0xad48('0x5e')][0x0][_0xad48('0x5f')]:undefined)||''}];case _0xad48('0x63'):return[{'name':_0xad48('0x64'),'value':_0x3bc2e0[_0xad48('0x64')]||(_0x3bc2e0[_0xad48('0x5e')]&&_0x3bc2e0[_0xad48('0x5e')][0x0]?_0x3bc2e0[_0xad48('0x5e')][0x0][_0xad48('0x5f')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x3bc2e0['attrTimezone']||(_0x3bc2e0[_0xad48('0x5e')]&&_0x3bc2e0[_0xad48('0x5e')][0x1]?_0x3bc2e0[_0xad48('0x5e')][0x1][_0xad48('0x5f')]:undefined)||_0xad48('0x65')},{'name':_0xad48('0x66'),'value':_0x3bc2e0[_0xad48('0x66')]||(_0x3bc2e0['attrs']&&_0x3bc2e0[_0xad48('0x5e')][0x2]?_0x3bc2e0[_0xad48('0x5e')][0x2]['value']:undefined)||0xc}];case _0xad48('0x67'):return[{'name':'attrMetric','value':_0x3bc2e0[_0xad48('0x68')]||(_0x3bc2e0['attrs']&&_0x3bc2e0['attrs'][0x0]?_0x3bc2e0[_0xad48('0x5e')][0x0][_0xad48('0x5f')]:undefined)||'total'},{'name':_0xad48('0x69'),'value':_0x3bc2e0[_0xad48('0x69')]||(_0x3bc2e0['attrs']&&_0x3bc2e0[_0xad48('0x5e')][0x1]?_0x3bc2e0[_0xad48('0x5e')][0x1][_0xad48('0x5f')]:undefined)||[]},{'name':'attrFontSize','value':_0x3bc2e0[_0xad48('0x66')]||(_0x3bc2e0[_0xad48('0x5e')]&&_0x3bc2e0[_0xad48('0x5e')][0x2]?_0x3bc2e0[_0xad48('0x5e')][0x2]['value']:undefined)||0x14}];case _0xad48('0x6a'):case _0xad48('0x6b'):return[{'name':_0xad48('0x6c'),'value':_0x3bc2e0[_0xad48('0x6c')]||(_0x3bc2e0['attrs']&&_0x3bc2e0[_0xad48('0x5e')][0x0]?_0x3bc2e0['attrs'][0x0][_0xad48('0x5f')]:undefined)||_0xad48('0x6d')},{'name':_0xad48('0x6e'),'value':_0x3bc2e0[_0xad48('0x6e')]||(_0x3bc2e0[_0xad48('0x5e')]&&_0x3bc2e0['attrs'][0x1]?_0x3bc2e0[_0xad48('0x5e')][0x1][_0xad48('0x5f')]:undefined)||null},{'name':_0xad48('0x6f'),'value':_0x3bc2e0[_0xad48('0x6f')]||(_0x3bc2e0[_0xad48('0x5e')]&&_0x3bc2e0['attrs'][0x2]?_0x3bc2e0[_0xad48('0x5e')][0x2][_0xad48('0x5f')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x3bc2e0[_0xad48('0x69')]||(_0x3bc2e0[_0xad48('0x5e')]&&_0x3bc2e0[_0xad48('0x5e')][0x3]?_0x3bc2e0['attrs'][0x3][_0xad48('0x5f')]:undefined)||[]}];case _0xad48('0x70'):return[{'name':_0xad48('0x71'),'type':_0x3bc2e0['reportType']||(_0x3bc2e0[_0xad48('0x5e')]&&_0x3bc2e0[_0xad48('0x5e')][0x0]?_0x3bc2e0[_0xad48('0x5e')][0x0][_0xad48('0x34')]:undefined)||null,'value':_0x3bc2e0[_0xad48('0x71')]||(_0x3bc2e0[_0xad48('0x5e')]&&_0x3bc2e0[_0xad48('0x5e')][0x0]?_0x3bc2e0[_0xad48('0x5e')][0x0][_0xad48('0x5f')]:undefined)||null},{'name':_0xad48('0x72'),'value':_0x3bc2e0[_0xad48('0x72')]||(_0x3bc2e0[_0xad48('0x5e')]&&_0x3bc2e0[_0xad48('0x5e')][0x1]?_0x3bc2e0[_0xad48('0x5e')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x491a05){logger[_0xad48('0x2d')](_0xad48('0x73'),JSON[_0xad48('0x74')](_0x491a05));return[];}}exports[_0xad48('0x75')]=function(_0x3aa1f4,_0x577b8e,_0x26cb13){if(_0x3aa1f4[_0xad48('0x5a')]['id']){delete _0x3aa1f4[_0xad48('0x5a')]['id'];}return db[_0xad48('0x31')][_0xad48('0x4e')]({'where':{'id':_0x3aa1f4[_0xad48('0x4c')]['id']}})[_0xad48('0x2b')](handleEntityNotFound(_0x577b8e,null))[_0xad48('0x2b')](function(_0x5f476a){if(_0x5f476a){_0x3aa1f4[_0xad48('0x5a')][_0xad48('0x76')]=_0x5f476a['id'];_0x3aa1f4[_0xad48('0x5a')][_0xad48('0x5e')]=widgetAttributes(_0x3aa1f4[_0xad48('0x5a')]);return db[_0xad48('0x77')][_0xad48('0x4f')](_0x3aa1f4[_0xad48('0x5a')]);}})[_0xad48('0x2b')](respondWithResult(_0x577b8e,null))['catch'](handleError(_0x577b8e,null));};exports[_0xad48('0x78')]=function(_0x163fdc,_0x73543d,_0x2c0378){var _0x44d96e={};var _0x3f9290={};var _0x295ab9;var _0x395c6c;return db[_0xad48('0x31')][_0xad48('0x79')]({'where':{'id':_0x163fdc[_0xad48('0x4c')]['id']}})[_0xad48('0x2b')](handleEntityNotFound(_0x73543d,null))['then'](function(_0x5b9733){if(_0x5b9733){_0x295ab9=_0x5b9733;_0x3f9290[_0xad48('0x36')]=_[_0xad48('0x4d')](db[_0xad48('0x77')][_0xad48('0x32')]);_0x3f9290[_0xad48('0x37')]=_['keys'](_0x163fdc[_0xad48('0x37')]);_0x3f9290[_0xad48('0x3f')]=_[_0xad48('0x38')](_0x3f9290[_0xad48('0x36')],_0x3f9290[_0xad48('0x37')]);_0x44d96e['attributes']=_[_0xad48('0x38')](_0x3f9290['model'],qs[_0xad48('0x3a')](_0x163fdc[_0xad48('0x37')][_0xad48('0x3a')]));_0x44d96e['attributes']=_0x44d96e[_0xad48('0x39')][_0xad48('0x3b')]?_0x44d96e[_0xad48('0x39')]:_0x3f9290[_0xad48('0x36')];_0x44d96e[_0xad48('0x3c')]=qs[_0xad48('0x3d')](_0x163fdc[_0xad48('0x37')]['sort']);_0x44d96e[_0xad48('0x41')]=qs[_0xad48('0x3f')](_['pick'](_0x163fdc[_0xad48('0x37')],_0x3f9290['filters']));if(_0x163fdc['query'][_0xad48('0x40')]){_0x44d96e[_0xad48('0x41')]=_[_0xad48('0x42')](_0x44d96e[_0xad48('0x41')],{'$or':_['map'](_0x44d96e[_0xad48('0x39')],function(_0x958792){var _0x47d808={};_0x47d808[_0x958792]={'$like':'%'+_0x163fdc[_0xad48('0x37')][_0xad48('0x40')]+'%'};return _0x47d808;})});}_0x44d96e=_[_0xad48('0x42')]({},_0x44d96e,_0x163fdc[_0xad48('0x45')]);return _0x295ab9[_0xad48('0x78')](_0x44d96e);}})['then'](function(_0x2ab85c){if(_0x2ab85c){_0x395c6c=_0x2ab85c[_0xad48('0x3b')];if(!_0x163fdc[_0xad48('0x37')][_0xad48('0x7a')](_0xad48('0x7b'))){_0x44d96e[_0xad48('0x1f')]=qs['limit'](_0x163fdc[_0xad48('0x37')][_0xad48('0x1f')]);_0x44d96e[_0xad48('0x1d')]=qs['offset'](_0x163fdc[_0xad48('0x37')]['offset']);}return _0x295ab9[_0xad48('0x78')](_0x44d96e);}})[_0xad48('0x2b')](function(_0x223bb3){if(_0x223bb3){return _0x223bb3?{'count':_0x395c6c,'rows':_0x223bb3}:null;}})['then'](respondWithResult(_0x73543d,null))[_0xad48('0x4a')](handleError(_0x73543d,null));}; \ No newline at end of file +var _0x25a0=['include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','clone','omit','updatedAt','userProfileId','iframe','attrUrl','attrs','value','https://','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','order','hasOwnProperty','nolimit','eml-format','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','index','map','Dashboard','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','params','includeAll'];(function(_0x114e95,_0x5ef65c){var _0x45d249=function(_0x269afd){while(--_0x269afd){_0x114e95['push'](_0x114e95['shift']());}};_0x45d249(++_0x5ef65c);}(_0x25a0,0xa5));var _0x025a=function(_0x179fb4,_0x5e1178){_0x179fb4=_0x179fb4-0x0;var _0x2064f1=_0x25a0[_0x179fb4];return _0x2064f1;};'use strict';var emlformat=require(_0x025a('0x0'));var rimraf=require(_0x025a('0x1'));var zipdir=require(_0x025a('0x2'));var jsonpatch=require(_0x025a('0x3'));var rp=require('request-promise');var moment=require(_0x025a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x025a('0x5'));var util=require(_0x025a('0x6'));var path=require(_0x025a('0x7'));var sox=require(_0x025a('0x8'));var csv=require(_0x025a('0x9'));var ejs=require(_0x025a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x025a('0xb'));var squel=require(_0x025a('0xc'));var crypto=require(_0x025a('0xd'));var jsforce=require(_0x025a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x025a('0x9'));var querystring=require(_0x025a('0xf'));var Papa=require(_0x025a('0x10'));var Redis=require(_0x025a('0x11'));var authService=require(_0x025a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x025a('0x13'));var hardwareService=require(_0x025a('0x14'));var logger=require(_0x025a('0x15'))(_0x025a('0x16'));var utils=require(_0x025a('0x17'));var config=require(_0x025a('0x18'));var licenseUtil=require(_0x025a('0x19'));var db=require(_0x025a('0x1a'))['db'];config[_0x025a('0x1b')]=_[_0x025a('0x1c')](config[_0x025a('0x1b')],{'host':_0x025a('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./dashboard.socket')[_0x025a('0x1e')](socket);function respondWithStatusCode(_0x2c2106,_0x34c0ad){_0x34c0ad=_0x34c0ad||0xcc;return function(_0x2ce501){if(_0x2ce501){return _0x2c2106[_0x025a('0x1f')](_0x34c0ad);}return _0x2c2106[_0x025a('0x20')](_0x34c0ad)[_0x025a('0x21')]();};}function respondWithResult(_0xeb77c1,_0x532e64){_0x532e64=_0x532e64||0xc8;return function(_0x2b320e){if(_0x2b320e){return _0xeb77c1[_0x025a('0x20')](_0x532e64)[_0x025a('0x22')](_0x2b320e);}};}function respondWithFilteredResult(_0x46ed50,_0xf95821){return function(_0x1e3a19){if(_0x1e3a19){var _0x4746e8=typeof _0xf95821['offset']===_0x025a('0x23')&&typeof _0xf95821['limit']===_0x025a('0x23');var _0x582574=_0x1e3a19[_0x025a('0x24')];var _0x333272=_0x4746e8?0x0:_0xf95821[_0x025a('0x25')];var _0x54c770=_0x4746e8?_0x1e3a19[_0x025a('0x24')]:_0xf95821[_0x025a('0x25')]+_0xf95821[_0x025a('0x26')];var _0x41689c;if(_0x54c770>=_0x582574){_0x54c770=_0x582574;_0x41689c=0xc8;}else{_0x41689c=0xce;}_0x46ed50[_0x025a('0x20')](_0x41689c);return _0x46ed50['set'](_0x025a('0x27'),_0x333272+'-'+_0x54c770+'/'+_0x582574)[_0x025a('0x22')](_0x1e3a19);}return null;};}function patchUpdates(_0xbbdc42){return function(_0x2f5534){try{jsonpatch[_0x025a('0x28')](_0x2f5534,_0xbbdc42,!![]);}catch(_0x20acfa){return BPromise[_0x025a('0x29')](_0x20acfa);}return _0x2f5534[_0x025a('0x2a')]();};}function saveUpdates(_0x2d6457,_0x364866){return function(_0x4b49eb){if(_0x4b49eb){return _0x4b49eb[_0x025a('0x2b')](_0x2d6457)[_0x025a('0x2c')](function(_0x67e67b){return _0x67e67b;});}return null;};}function removeEntity(_0x1f9ccd,_0x5dfe38){return function(_0x5ab864){if(_0x5ab864){return _0x5ab864[_0x025a('0x2d')]()['then'](function(){var _0x1bf41d=_0x5ab864[_0x025a('0x2e')]({'plain':!![]});var _0x54e052=_0x025a('0x2f');return db[_0x025a('0x30')][_0x025a('0x2d')]({'where':{'type':_0x54e052,'resourceId':_0x1bf41d['id']}})['then'](function(){return _0x5ab864;});})[_0x025a('0x2c')](function(){_0x1f9ccd[_0x025a('0x20')](0xcc)[_0x025a('0x21')]();});}};}function handleEntityNotFound(_0x42c538,_0xa041f0){return function(_0x33ff00){if(!_0x33ff00){_0x42c538[_0x025a('0x1f')](0x194);}return _0x33ff00;};}function handleError(_0x4f1c85,_0x2619f0){_0x2619f0=_0x2619f0||0x1f4;return function(_0x23734f){logger[_0x025a('0x31')](_0x23734f[_0x025a('0x32')]);if(_0x23734f[_0x025a('0x33')]){delete _0x23734f[_0x025a('0x33')];}_0x4f1c85[_0x025a('0x20')](_0x2619f0)['send'](_0x23734f);};}exports[_0x025a('0x34')]=function(_0x26b3c3,_0x1f18e3){var _0x4b2e23={},_0x7c0e6f={},_0xa49852={'count':0x0,'rows':[]};var _0xebcf28=_[_0x025a('0x35')](db[_0x025a('0x36')][_0x025a('0x37')],function(_0x36bf82){return{'name':_0x36bf82['fieldName'],'type':_0x36bf82[_0x025a('0x38')]['key']};});_0x7c0e6f[_0x025a('0x39')]=_[_0x025a('0x35')](_0xebcf28,'name');_0x7c0e6f[_0x025a('0x3a')]=_[_0x025a('0x3b')](_0x26b3c3['query']);_0x7c0e6f[_0x025a('0x3c')]=_[_0x025a('0x3d')](_0x7c0e6f[_0x025a('0x39')],_0x7c0e6f[_0x025a('0x3a')]);_0x4b2e23['attributes']=_[_0x025a('0x3d')](_0x7c0e6f[_0x025a('0x39')],qs[_0x025a('0x3e')](_0x26b3c3[_0x025a('0x3a')][_0x025a('0x3e')]));_0x4b2e23[_0x025a('0x3f')]=_0x4b2e23[_0x025a('0x3f')][_0x025a('0x40')]?_0x4b2e23[_0x025a('0x3f')]:_0x7c0e6f[_0x025a('0x39')];if(!_0x26b3c3[_0x025a('0x3a')]['hasOwnProperty']('nolimit')){_0x4b2e23[_0x025a('0x26')]=qs['limit'](_0x26b3c3[_0x025a('0x3a')][_0x025a('0x26')]);_0x4b2e23[_0x025a('0x25')]=qs['offset'](_0x26b3c3[_0x025a('0x3a')][_0x025a('0x25')]);}_0x4b2e23['order']=qs[_0x025a('0x41')](_0x26b3c3[_0x025a('0x3a')][_0x025a('0x41')]);_0x4b2e23['where']=qs[_0x025a('0x3c')](_[_0x025a('0x42')](_0x26b3c3[_0x025a('0x3a')],_0x7c0e6f[_0x025a('0x3c')]),_0xebcf28);if(_0x26b3c3[_0x025a('0x3a')][_0x025a('0x43')]){_0x4b2e23[_0x025a('0x44')]=_[_0x025a('0x45')](_0x4b2e23[_0x025a('0x44')],{'$or':_[_0x025a('0x35')](_0xebcf28,function(_0x3c155b){if(_0x3c155b[_0x025a('0x38')]!==_0x025a('0x46')){var _0x23aaea={};_0x23aaea[_0x3c155b['name']]={'$like':'%'+_0x26b3c3[_0x025a('0x3a')][_0x025a('0x43')]+'%'};return _0x23aaea;}})});}_0x4b2e23=_[_0x025a('0x45')]({},_0x4b2e23,_0x26b3c3[_0x025a('0x47')]);var _0x3ed00d={'where':_0x4b2e23[_0x025a('0x44')]};return db[_0x025a('0x36')]['count'](_0x3ed00d)[_0x025a('0x2c')](function(_0x3f84bb){_0xa49852['count']=_0x3f84bb;if(_0x26b3c3[_0x025a('0x3a')]['includeAll']){_0x4b2e23['include']=[{'all':!![]}];}return db[_0x025a('0x36')][_0x025a('0x48')](_0x4b2e23);})[_0x025a('0x2c')](function(_0x138529){_0xa49852[_0x025a('0x49')]=_0x138529;return _0xa49852;})[_0x025a('0x2c')](respondWithFilteredResult(_0x1f18e3,_0x4b2e23))[_0x025a('0x4a')](handleError(_0x1f18e3,null));};exports['show']=function(_0x2ae197,_0x437301){var _0xf1e050={'raw':![],'where':{'id':_0x2ae197[_0x025a('0x4b')]['id']}},_0x316ff4={};_0x316ff4[_0x025a('0x39')]=_[_0x025a('0x3b')](db[_0x025a('0x36')][_0x025a('0x37')]);_0x316ff4[_0x025a('0x3a')]=_['keys'](_0x2ae197['query']);_0x316ff4[_0x025a('0x3c')]=_[_0x025a('0x3d')](_0x316ff4[_0x025a('0x39')],_0x316ff4[_0x025a('0x3a')]);_0xf1e050[_0x025a('0x3f')]=_[_0x025a('0x3d')](_0x316ff4[_0x025a('0x39')],qs['fields'](_0x2ae197['query']['fields']));_0xf1e050['attributes']=_0xf1e050['attributes'][_0x025a('0x40')]?_0xf1e050[_0x025a('0x3f')]:_0x316ff4['model'];if(_0x2ae197['query'][_0x025a('0x4c')]){_0xf1e050[_0x025a('0x4d')]=[{'all':!![]}];}_0xf1e050=_[_0x025a('0x45')]({},_0xf1e050,_0x2ae197['options']);return db['Dashboard'][_0x025a('0x4e')](_0xf1e050)[_0x025a('0x2c')](handleEntityNotFound(_0x437301,null))[_0x025a('0x2c')](respondWithResult(_0x437301,null))[_0x025a('0x4a')](handleError(_0x437301,null));};exports[_0x025a('0x4f')]=function(_0x3d4040,_0x30aba4){return db[_0x025a('0x36')][_0x025a('0x4f')](_0x3d4040[_0x025a('0x50')],{})[_0x025a('0x2c')](function(_0x55466b){var _0x6ccfed=_0x3d4040['user'][_0x025a('0x2e')]({'plain':!![]});if(!_0x6ccfed)throw new Error(_0x025a('0x51'));if(_0x6ccfed[_0x025a('0x52')]===_0x025a('0x53')){var _0x59d41a=_0x55466b[_0x025a('0x2e')]({'plain':!![]});var _0x37de42=_0x025a('0x2f');return db[_0x025a('0x54')][_0x025a('0x4e')]({'where':{'name':_0x37de42,'userProfileId':_0x6ccfed['userProfileId']},'raw':!![]})[_0x025a('0x2c')](function(_0x4e3f29){if(_0x4e3f29&&_0x4e3f29[_0x025a('0x55')]===0x0){return db['UserProfileResource'][_0x025a('0x4f')]({'name':_0x59d41a['name'],'resourceId':_0x59d41a['id'],'type':_0x4e3f29[_0x025a('0x33')],'sectionId':_0x4e3f29['id']},{})[_0x025a('0x2c')](function(){return _0x55466b;});}else{return _0x55466b;}})['catch'](function(_0x59720a){logger[_0x025a('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59720a);throw _0x59720a;});}return _0x55466b;})[_0x025a('0x2c')](respondWithResult(_0x30aba4,0xc9))['catch'](handleError(_0x30aba4,null));};exports[_0x025a('0x56')]=function(_0xe76b8c,_0x571b59){var _0x48dc19={'where':{'id':_0xe76b8c['params']['id']}},_0x36c54f={};_0x36c54f[_0x025a('0x39')]=_['keys'](db['Dashboard'][_0x025a('0x37')]);_0x48dc19[_0x025a('0x3f')]=_['intersection'](_0x36c54f[_0x025a('0x39')],qs[_0x025a('0x3e')](_0xe76b8c[_0x025a('0x3a')][_0x025a('0x3e')]));_0x48dc19['attributes']=_0x48dc19[_0x025a('0x3f')][_0x025a('0x40')]?_0x48dc19[_0x025a('0x3f')]:_0x36c54f['model'];if(_0xe76b8c['query']['includeAll']){_0x48dc19[_0x025a('0x4d')]=[{'all':!![]}];}_0x48dc19=_[_0x025a('0x45')]({},_0x48dc19,_0xe76b8c[_0x025a('0x47')]);return db['Dashboard'][_0x025a('0x4e')](_0x48dc19)[_0x025a('0x2c')](handleEntityNotFound(_0x571b59,null))[_0x025a('0x2c')](function(_0x4917ee){if(_0x4917ee){var _0x45f4a4=_0x4917ee[_0x025a('0x2e')]({'plain':!![]});_0x45f4a4=qs[_0x025a('0x57')](_0x45f4a4,['id','createdAt',_0x025a('0x58')]);_0xe76b8c[_0x025a('0x50')]=_[_0x025a('0x57')](_0xe76b8c[_0x025a('0x50')],['id','createdAt',_0x025a('0x58')]);return db[_0x025a('0x36')][_0x025a('0x4f')](_[_0x025a('0x45')](_0x45f4a4,_0xe76b8c['body']),{'include':_0xe76b8c[_0x025a('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0x025a('0x2c')](function(_0x5e37d){var _0x3ac9bc=_0xe76b8c[_0x025a('0x53')][_0x025a('0x2e')]({'plain':!![]});if(!_0x3ac9bc)throw new Error(_0x025a('0x51'));if(_0x3ac9bc[_0x025a('0x52')]===_0x025a('0x53')){var _0xc4ff3e=_0x5e37d[_0x025a('0x2e')]({'plain':!![]});var _0x47c00f=_0x025a('0x2f');return db[_0x025a('0x54')]['find']({'where':{'name':_0x47c00f,'userProfileId':_0x3ac9bc[_0x025a('0x59')]},'raw':!![]})[_0x025a('0x2c')](function(_0x127fd5){if(_0x127fd5&&_0x127fd5[_0x025a('0x55')]===0x0){return db[_0x025a('0x30')]['create']({'name':_0xc4ff3e[_0x025a('0x33')],'resourceId':_0xc4ff3e['id'],'type':_0x127fd5[_0x025a('0x33')],'sectionId':_0x127fd5['id']},{})[_0x025a('0x2c')](function(){return _0x5e37d;});}else{return _0x5e37d;}})[_0x025a('0x4a')](function(_0x10209c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x10209c);throw _0x10209c;});}return _0x5e37d;});}})[_0x025a('0x2c')](respondWithResult(_0x571b59,0xc9))['catch'](handleError(_0x571b59,null));};exports[_0x025a('0x2b')]=function(_0x1f0fcc,_0x4540a7){if(_0x1f0fcc[_0x025a('0x50')]['id']){delete _0x1f0fcc[_0x025a('0x50')]['id'];}return db[_0x025a('0x36')][_0x025a('0x4e')]({'where':{'id':_0x1f0fcc[_0x025a('0x4b')]['id']}})[_0x025a('0x2c')](handleEntityNotFound(_0x4540a7,null))[_0x025a('0x2c')](saveUpdates(_0x1f0fcc[_0x025a('0x50')],null))[_0x025a('0x2c')](respondWithResult(_0x4540a7,null))[_0x025a('0x4a')](handleError(_0x4540a7,null));};exports[_0x025a('0x2d')]=function(_0x338ecf,_0x395298){return db[_0x025a('0x36')][_0x025a('0x4e')]({'where':{'id':_0x338ecf['params']['id']}})[_0x025a('0x2c')](handleEntityNotFound(_0x395298,null))['then'](removeEntity(_0x395298,null))['catch'](handleError(_0x395298,null));};function widgetAttributes(_0x5b14be){try{switch(_0x5b14be[_0x025a('0x38')]){case _0x025a('0x5a'):return[{'name':_0x025a('0x5b'),'value':_0x5b14be['attrUrl']||(_0x5b14be[_0x025a('0x5c')]&&_0x5b14be[_0x025a('0x5c')][0x0]?_0x5b14be['attrs'][0x0][_0x025a('0x5d')]:undefined)||_0x025a('0x5e')}];case'custom':return[{'name':'attrPath','value':_0x5b14be['attrPath']||(_0x5b14be['attrs']&&_0x5b14be[_0x025a('0x5c')][0x0]?_0x5b14be['attrs'][0x0][_0x025a('0x5d')]:undefined)||''}];case'clock':return[{'name':_0x025a('0x5f'),'value':_0x5b14be[_0x025a('0x5f')]||(_0x5b14be[_0x025a('0x5c')]&&_0x5b14be[_0x025a('0x5c')][0x0]?_0x5b14be['attrs'][0x0]['value']:undefined)||_0x025a('0x60')},{'name':'attrTimezone','value':_0x5b14be[_0x025a('0x61')]||(_0x5b14be[_0x025a('0x5c')]&&_0x5b14be[_0x025a('0x5c')][0x1]?_0x5b14be[_0x025a('0x5c')][0x1]['value']:undefined)||'0.00'},{'name':'attrFontSize','value':_0x5b14be[_0x025a('0x62')]||(_0x5b14be[_0x025a('0x5c')]&&_0x5b14be[_0x025a('0x5c')][0x2]?_0x5b14be[_0x025a('0x5c')][0x2]['value']:undefined)||0xc}];case _0x025a('0x63'):return[{'name':_0x025a('0x64'),'value':_0x5b14be[_0x025a('0x64')]||(_0x5b14be[_0x025a('0x5c')]&&_0x5b14be[_0x025a('0x5c')][0x0]?_0x5b14be[_0x025a('0x5c')][0x0][_0x025a('0x5d')]:undefined)||_0x025a('0x65')},{'name':'attrVoiceQueues','value':_0x5b14be[_0x025a('0x66')]||(_0x5b14be[_0x025a('0x5c')]&&_0x5b14be[_0x025a('0x5c')][0x1]?_0x5b14be['attrs'][0x1][_0x025a('0x5d')]:undefined)||[]},{'name':_0x025a('0x62'),'value':_0x5b14be[_0x025a('0x62')]||(_0x5b14be['attrs']&&_0x5b14be[_0x025a('0x5c')][0x2]?_0x5b14be[_0x025a('0x5c')][0x2]['value']:undefined)||0x14}];case _0x025a('0x67'):case'pie-chart':return[{'name':_0x025a('0x68'),'value':_0x5b14be[_0x025a('0x68')]||(_0x5b14be['attrs']&&_0x5b14be['attrs'][0x0]?_0x5b14be['attrs'][0x0][_0x025a('0x5d')]:undefined)||_0x025a('0x65')},{'name':_0x025a('0x69'),'value':_0x5b14be[_0x025a('0x69')]||(_0x5b14be[_0x025a('0x5c')]&&_0x5b14be[_0x025a('0x5c')][0x1]?_0x5b14be['attrs'][0x1][_0x025a('0x5d')]:undefined)||null},{'name':_0x025a('0x6a'),'value':_0x5b14be['attrSerie3']||(_0x5b14be[_0x025a('0x5c')]&&_0x5b14be['attrs'][0x2]?_0x5b14be[_0x025a('0x5c')][0x2][_0x025a('0x5d')]:undefined)||null},{'name':_0x025a('0x66'),'value':_0x5b14be[_0x025a('0x66')]||(_0x5b14be[_0x025a('0x5c')]&&_0x5b14be[_0x025a('0x5c')][0x3]?_0x5b14be[_0x025a('0x5c')][0x3][_0x025a('0x5d')]:undefined)||[]}];case _0x025a('0x6b'):return[{'name':_0x025a('0x6c'),'type':_0x5b14be[_0x025a('0x6d')]||(_0x5b14be[_0x025a('0x5c')]&&_0x5b14be[_0x025a('0x5c')][0x0]?_0x5b14be[_0x025a('0x5c')][0x0][_0x025a('0x38')]:undefined)||null,'value':_0x5b14be[_0x025a('0x6c')]||(_0x5b14be['attrs']&&_0x5b14be[_0x025a('0x5c')][0x0]?_0x5b14be['attrs'][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x5b14be[_0x025a('0x6e')]||(_0x5b14be[_0x025a('0x5c')]&&_0x5b14be[_0x025a('0x5c')][0x1]?_0x5b14be[_0x025a('0x5c')][0x1][_0x025a('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x49747a){logger[_0x025a('0x31')](_0x025a('0x6f'),JSON[_0x025a('0x70')](_0x49747a));return[];}}exports[_0x025a('0x71')]=function(_0x47db49,_0x3419de,_0x24c2ba){if(_0x47db49['body']['id']){delete _0x47db49[_0x025a('0x50')]['id'];}return db['Dashboard'][_0x025a('0x4e')]({'where':{'id':_0x47db49[_0x025a('0x4b')]['id']}})[_0x025a('0x2c')](handleEntityNotFound(_0x3419de,null))[_0x025a('0x2c')](function(_0x49db4c){if(_0x49db4c){_0x47db49[_0x025a('0x50')][_0x025a('0x72')]=_0x49db4c['id'];_0x47db49['body'][_0x025a('0x5c')]=widgetAttributes(_0x47db49[_0x025a('0x50')]);return db[_0x025a('0x73')][_0x025a('0x4f')](_0x47db49[_0x025a('0x50')]);}})[_0x025a('0x2c')](respondWithResult(_0x3419de,null))['catch'](handleError(_0x3419de,null));};exports[_0x025a('0x74')]=function(_0x2f5538,_0x46533b,_0x4a9516){var _0x536e70={};var _0xd89def={};var _0x1ba3ff;var _0x52367d;return db[_0x025a('0x36')][_0x025a('0x75')]({'where':{'id':_0x2f5538[_0x025a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x46533b,null))[_0x025a('0x2c')](function(_0x111db2){if(_0x111db2){_0x1ba3ff=_0x111db2;_0xd89def[_0x025a('0x39')]=_[_0x025a('0x3b')](db[_0x025a('0x73')][_0x025a('0x37')]);_0xd89def[_0x025a('0x3a')]=_[_0x025a('0x3b')](_0x2f5538[_0x025a('0x3a')]);_0xd89def['filters']=_[_0x025a('0x3d')](_0xd89def[_0x025a('0x39')],_0xd89def[_0x025a('0x3a')]);_0x536e70['attributes']=_['intersection'](_0xd89def[_0x025a('0x39')],qs[_0x025a('0x3e')](_0x2f5538[_0x025a('0x3a')][_0x025a('0x3e')]));_0x536e70[_0x025a('0x3f')]=_0x536e70[_0x025a('0x3f')][_0x025a('0x40')]?_0x536e70[_0x025a('0x3f')]:_0xd89def[_0x025a('0x39')];_0x536e70[_0x025a('0x76')]=qs[_0x025a('0x41')](_0x2f5538[_0x025a('0x3a')][_0x025a('0x41')]);_0x536e70[_0x025a('0x44')]=qs[_0x025a('0x3c')](_['pick'](_0x2f5538[_0x025a('0x3a')],_0xd89def['filters']));if(_0x2f5538[_0x025a('0x3a')]['filter']){_0x536e70['where']=_[_0x025a('0x45')](_0x536e70[_0x025a('0x44')],{'$or':_[_0x025a('0x35')](_0x536e70[_0x025a('0x3f')],function(_0x43332b){var _0x3ca11a={};_0x3ca11a[_0x43332b]={'$like':'%'+_0x2f5538[_0x025a('0x3a')]['filter']+'%'};return _0x3ca11a;})});}_0x536e70=_[_0x025a('0x45')]({},_0x536e70,_0x2f5538[_0x025a('0x47')]);return _0x1ba3ff[_0x025a('0x74')](_0x536e70);}})[_0x025a('0x2c')](function(_0x14ecf5){if(_0x14ecf5){_0x52367d=_0x14ecf5['length'];if(!_0x2f5538[_0x025a('0x3a')][_0x025a('0x77')](_0x025a('0x78'))){_0x536e70[_0x025a('0x26')]=qs[_0x025a('0x26')](_0x2f5538[_0x025a('0x3a')][_0x025a('0x26')]);_0x536e70[_0x025a('0x25')]=qs[_0x025a('0x25')](_0x2f5538[_0x025a('0x3a')][_0x025a('0x25')]);}return _0x1ba3ff['getItems'](_0x536e70);}})[_0x025a('0x2c')](function(_0x141f73){if(_0x141f73){return _0x141f73?{'count':_0x52367d,'rows':_0x141f73}:null;}})[_0x025a('0x2c')](respondWithResult(_0x46533b,null))[_0x025a('0x4a')](handleError(_0x46533b,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index b454ebd..dd32551 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 _0x4627=['Dashboard','setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x5301ae,_0xd41b49){var _0x1d930f=function(_0x15c159){while(--_0x15c159){_0x5301ae['push'](_0x5301ae['shift']());}};_0x1d930f(++_0xd41b49);}(_0x4627,0xa0));var _0x7462=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x4627[_0x4ae625];return _0x31accf;};'use strict';var EventEmitter=require(_0x7462('0x0'));var Dashboard=require(_0x7462('0x1'))['db'][_0x7462('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x7462('0x3')](0x0);var events={'afterCreate':_0x7462('0x4'),'afterUpdate':_0x7462('0x5'),'afterDestroy':_0x7462('0x6')};function emitEvent(_0xa34626){return function(_0x2feb8b,_0x2d3f36,_0x506714){DashboardEvents[_0x7462('0x7')](_0xa34626+':'+_0x2feb8b['id'],_0x2feb8b);DashboardEvents[_0x7462('0x7')](_0xa34626,_0x2feb8b);_0x506714(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x7462('0x8')]=DashboardEvents; \ No newline at end of file +var _0xb6dc=['emit','exports','../../mysqldb','Dashboard','setMaxListeners','save','update'];(function(_0xa97b0b,_0xfe5a73){var _0x5225c0=function(_0x8aea50){while(--_0x8aea50){_0xa97b0b['push'](_0xa97b0b['shift']());}};_0x5225c0(++_0xfe5a73);}(_0xb6dc,0xaa));var _0xcb6d=function(_0x335f5e,_0x301b6c){_0x335f5e=_0x335f5e-0x0;var _0x133fae=_0xb6dc[_0x335f5e];return _0x133fae;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xcb6d('0x0'))['db'][_0xcb6d('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xcb6d('0x2')](0x0);var events={'afterCreate':_0xcb6d('0x3'),'afterUpdate':_0xcb6d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2b4104){return function(_0x68d556,_0x244ba5,_0x5c2ad4){DashboardEvents[_0xcb6d('0x5')](_0x2b4104+':'+_0x68d556['id'],_0x68d556);DashboardEvents[_0xcb6d('0x5')](_0x2b4104,_0x68d556);_0x5c2ad4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xcb6d('0x6')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 4d9e6a2..514e0d6 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 _0xf443=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','Dashboard','dashboards'];(function(_0x13a365,_0x1d4c33){var _0x414fb4=function(_0x132415){while(--_0x132415){_0x13a365['push'](_0x13a365['shift']());}};_0x414fb4(++_0x1d4c33);}(_0xf443,0x1c8));var _0x3f44=function(_0x362e1d,_0x30741e){_0x362e1d=_0x362e1d-0x0;var _0xa0a861=_0xf443[_0x362e1d];return _0xa0a861;};'use strict';var _=require(_0x3f44('0x0'));var util=require('util');var logger=require(_0x3f44('0x1'))(_0x3f44('0x2'));var moment=require('moment');var BPromise=require(_0x3f44('0x3'));var rp=require(_0x3f44('0x4'));var fs=require('fs');var path=require(_0x3f44('0x5'));var rimraf=require(_0x3f44('0x6'));var config=require(_0x3f44('0x7'));var attributes=require(_0x3f44('0x8'));module[_0x3f44('0x9')]=function(_0xbb2707,_0x22d56a){return _0xbb2707['define'](_0x3f44('0xa'),attributes,{'tableName':_0x3f44('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c76=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define'];(function(_0x43dbd9,_0x528cf0){var _0x27bd9f=function(_0x2550c1){while(--_0x2550c1){_0x43dbd9['push'](_0x43dbd9['shift']());}};_0x27bd9f(++_0x528cf0);}(_0x1c76,0x1d9));var _0x61c7=function(_0x104975,_0x1f9fe2){_0x104975=_0x104975-0x0;var _0x11cbff=_0x1c76[_0x104975];return _0x11cbff;};'use strict';var _=require(_0x61c7('0x0'));var util=require(_0x61c7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x61c7('0x2'));var BPromise=require(_0x61c7('0x3'));var rp=require(_0x61c7('0x4'));var fs=require('fs');var path=require(_0x61c7('0x5'));var rimraf=require(_0x61c7('0x6'));var config=require(_0x61c7('0x7'));var attributes=require(_0x61c7('0x8'));module[_0x61c7('0x9')]=function(_0x44444a,_0x3b92b0){return _0x44444a[_0x61c7('0xa')]('Dashboard',attributes,{'tableName':'dashboards','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 fd69c52..87607e2 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 _0xfbc2=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x2d4093,_0x32e7d2){var _0x336afe=function(_0x4297c7){while(--_0x4297c7){_0x2d4093['push'](_0x2d4093['shift']());}};_0x336afe(++_0x32e7d2);}(_0xfbc2,0x1bb));var _0x2fbc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfbc2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2fbc('0x0'));var util=require('util');var moment=require(_0x2fbc('0x1'));var BPromise=require(_0x2fbc('0x2'));var rs=require(_0x2fbc('0x3'));var fs=require('fs');var Redis=require(_0x2fbc('0x4'));var db=require(_0x2fbc('0x5'))['db'];var utils=require(_0x2fbc('0x6'));var logger=require(_0x2fbc('0x7'))(_0x2fbc('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2fbc('0x9')][_0x2fbc('0xa')]({'port':0x232a});config[_0x2fbc('0xb')]=_[_0x2fbc('0xc')](config['redis'],{'host':_0x2fbc('0xd'),'port':0x18eb});var socket=require(_0x2fbc('0xe'))(new Redis(config[_0x2fbc('0xb')]));require(_0x2fbc('0xf'))['register'](socket);function respondWithRpcPromise(_0x1cc192,_0x39a744,_0x107e0e){return new BPromise(function(_0x1ecdb5,_0x322f3d){return client[_0x2fbc('0x10')](_0x1cc192,_0x107e0e)[_0x2fbc('0x11')](function(_0x1330d9){logger['info'](_0x2fbc('0x12'),_0x39a744,_0x2fbc('0x13'));logger[_0x2fbc('0x14')](_0x2fbc('0x15'),_0x39a744,_0x2fbc('0x13'),JSON['stringify'](_0x1330d9));if(_0x1330d9['error']){if(_0x1330d9['error'][_0x2fbc('0x16')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x39a744,_0x1330d9[_0x2fbc('0x17')][_0x2fbc('0x18')]);return _0x322f3d(_0x1330d9['error']['message']);}logger['error'](_0x2fbc('0x12'),_0x39a744,_0x1330d9[_0x2fbc('0x17')]['message']);return _0x1ecdb5(_0x1330d9['error'][_0x2fbc('0x18')]);}else{logger[_0x2fbc('0x19')]('Dashboard,\x20%s,\x20%s',_0x39a744,'request\x20sent');_0x1ecdb5(_0x1330d9[_0x2fbc('0x1a')][_0x2fbc('0x18')]);}})[_0x2fbc('0x1b')](function(_0x5b1581){logger[_0x2fbc('0x17')]('Dashboard,\x20%s,\x20%s',_0x39a744,_0x5b1581);_0x322f3d(_0x5b1581);});});} \ No newline at end of file +var _0xcbd4=['Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./dashboard.socket','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x6eb833,_0x2bb5e5){var _0xdfc38c=function(_0x13c4a4){while(--_0x13c4a4){_0x6eb833['push'](_0x6eb833['shift']());}};_0xdfc38c(++_0x2bb5e5);}(_0xcbd4,0x6b));var _0x4cbd=function(_0xc49dfe,_0x198a51){_0xc49dfe=_0xc49dfe-0x0;var _0x18b756=_0xcbd4[_0xc49dfe];return _0x18b756;};'use strict';var _=require(_0x4cbd('0x0'));var util=require(_0x4cbd('0x1'));var moment=require(_0x4cbd('0x2'));var BPromise=require(_0x4cbd('0x3'));var rs=require(_0x4cbd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4cbd('0x5'));var logger=require(_0x4cbd('0x6'))(_0x4cbd('0x7'));var config=require(_0x4cbd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4cbd('0x9')][_0x4cbd('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x4cbd('0xb')],{'host':_0x4cbd('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4cbd('0xb')]));require(_0x4cbd('0xd'))['register'](socket);function respondWithRpcPromise(_0x2db8c8,_0x8796c9,_0x399ed8){return new BPromise(function(_0x26c717,_0x1b327a){return client['request'](_0x2db8c8,_0x399ed8)[_0x4cbd('0xe')](function(_0x58743e){logger['info'](_0x4cbd('0xf'),_0x8796c9,_0x4cbd('0x10'));logger[_0x4cbd('0x11')](_0x4cbd('0x12'),_0x8796c9,_0x4cbd('0x10'),JSON[_0x4cbd('0x13')](_0x58743e));if(_0x58743e[_0x4cbd('0x14')]){if(_0x58743e[_0x4cbd('0x14')][_0x4cbd('0x15')]===0x1f4){logger[_0x4cbd('0x14')]('Dashboard,\x20%s,\x20%s',_0x8796c9,_0x58743e[_0x4cbd('0x14')][_0x4cbd('0x16')]);return _0x1b327a(_0x58743e[_0x4cbd('0x14')]['message']);}logger['error']('Dashboard,\x20%s,\x20%s',_0x8796c9,_0x58743e['error'][_0x4cbd('0x16')]);return _0x26c717(_0x58743e[_0x4cbd('0x14')][_0x4cbd('0x16')]);}else{logger['info'](_0x4cbd('0xf'),_0x8796c9,_0x4cbd('0x10'));_0x26c717(_0x58743e[_0x4cbd('0x17')]['message']);}})[_0x4cbd('0x18')](function(_0x52fe99){logger['error'](_0x4cbd('0xf'),_0x8796c9,_0x52fe99);_0x1b327a(_0x52fe99);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 841a311..84e1ca0 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 _0xf03e=['removeListener','register','length','dashboard:','update','emit'];(function(_0xbcbda0,_0x29bad1){var _0x424ef6=function(_0x4fb449){while(--_0x4fb449){_0xbcbda0['push'](_0xbcbda0['shift']());}};_0x424ef6(++_0x29bad1);}(_0xf03e,0x106));var _0xef03=function(_0x4da5b2,_0x56665c){_0x4da5b2=_0x4da5b2-0x0;var _0x1a1de6=_0xf03e[_0x4da5b2];return _0x1a1de6;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save','remove',_0xef03('0x0')];function createListener(_0x2aa561,_0x5768c8){return function(_0x122932){_0x5768c8[_0xef03('0x1')](_0x2aa561,_0x122932);};}function removeListener(_0x329a43,_0x1ff621){return function(){DashboardEvents[_0xef03('0x2')](_0x329a43,_0x1ff621);};}exports[_0xef03('0x3')]=function(_0x6e0a9a){for(var _0x4270e3=0x0,_0x525ecd=events[_0xef03('0x4')];_0x4270e3<_0x525ecd;_0x4270e3++){var _0x38c9b1=events[_0x4270e3];var _0x1daf86=createListener(_0xef03('0x5')+_0x38c9b1,_0x6e0a9a);DashboardEvents['on'](_0x38c9b1,_0x1daf86);}}; \ No newline at end of file +var _0x38ac=['dashboard:','save','update','emit','removeListener','register','length'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x38ac,0x1ac));var _0xc38a=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x38ac[_0x8c43de];return _0xa6591b;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xc38a('0x0'),'remove',_0xc38a('0x1')];function createListener(_0x2a34dc,_0x1a97f0){return function(_0xbad9e7){_0x1a97f0[_0xc38a('0x2')](_0x2a34dc,_0xbad9e7);};}function removeListener(_0x4afb40,_0xfc4459){return function(){DashboardEvents[_0xc38a('0x3')](_0x4afb40,_0xfc4459);};}exports[_0xc38a('0x4')]=function(_0x466fae){for(var _0x3e0ee8=0x0,_0x2cc7ef=events[_0xc38a('0x5')];_0x3e0ee8<_0x2cc7ef;_0x3e0ee8++){var _0x3594eb=events[_0x3e0ee8];var _0x2e49a4=createListener(_0xc38a('0x6')+_0x3594eb,_0x466fae);DashboardEvents['on'](_0x3594eb,_0x2e49a4);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index d1d412c..12770f5 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 _0x139b=['post','create','clone','addItem','put','update','destroy','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','/:id','show','/:id/items','isAuthenticated','getItems'];(function(_0x9f5862,_0x40dd2d){var _0x2a4b87=function(_0x22f273){while(--_0x22f273){_0x9f5862['push'](_0x9f5862['shift']());}};_0x2a4b87(++_0x40dd2d);}(_0x139b,0x170));var _0xb139=function(_0xc9d03c,_0x1ef3f0){_0xc9d03c=_0xc9d03c-0x0;var _0x14878d=_0x139b[_0xc9d03c];return _0x14878d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb139('0x0'));var express=require('express');var router=express[_0xb139('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xb139('0x2'));var interaction=require(_0xb139('0x3'));var config=require(_0xb139('0x4'));var controller=require(_0xb139('0x5'));router[_0xb139('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb139('0x6')](_0xb139('0x7'),auth['isAuthenticated'](),controller[_0xb139('0x8')]);router[_0xb139('0x6')](_0xb139('0x9'),auth[_0xb139('0xa')](),controller[_0xb139('0xb')]);router[_0xb139('0xc')]('/',auth[_0xb139('0xa')](),controller[_0xb139('0xd')]);router[_0xb139('0xc')]('/:id/clone',auth[_0xb139('0xa')](),controller[_0xb139('0xe')]);router['post'](_0xb139('0x9'),auth['isAuthenticated'](),controller[_0xb139('0xf')]);router[_0xb139('0x10')](_0xb139('0x7'),auth[_0xb139('0xa')](),controller[_0xb139('0x11')]);router['delete'](_0xb139('0x7'),auth[_0xb139('0xa')](),controller[_0xb139('0x12')]);module[_0xb139('0x13')]=router; \ No newline at end of file +var _0xe8a4=['index','/:id','/:id/items','getItems','/:id/clone','post','addItem','put','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated'];(function(_0xd49477,_0xccf0a6){var _0xe8354=function(_0x425302){while(--_0x425302){_0xd49477['push'](_0xd49477['shift']());}};_0xe8354(++_0xccf0a6);}(_0xe8a4,0x14c));var _0x4e8a=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xe8a4[_0x1ddedd];return _0xa3e1ac;};'use strict';var multer=require(_0x4e8a('0x0'));var util=require('util');var path=require(_0x4e8a('0x1'));var timeout=require('connect-timeout');var express=require(_0x4e8a('0x2'));var router=express['Router']();var fs_extra=require(_0x4e8a('0x3'));var auth=require(_0x4e8a('0x4'));var interaction=require(_0x4e8a('0x5'));var config=require(_0x4e8a('0x6'));var controller=require(_0x4e8a('0x7'));router[_0x4e8a('0x8')]('/',auth[_0x4e8a('0x9')](),controller[_0x4e8a('0xa')]);router[_0x4e8a('0x8')](_0x4e8a('0xb'),auth[_0x4e8a('0x9')](),controller['show']);router['get'](_0x4e8a('0xc'),auth['isAuthenticated'](),controller[_0x4e8a('0xd')]);router['post']('/',auth[_0x4e8a('0x9')](),controller['create']);router['post'](_0x4e8a('0xe'),auth['isAuthenticated'](),controller['clone']);router[_0x4e8a('0xf')](_0x4e8a('0xc'),auth[_0x4e8a('0x9')](),controller[_0x4e8a('0x10')]);router[_0x4e8a('0x11')](_0x4e8a('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x4e8a('0xb'),auth[_0x4e8a('0x9')](),controller['destroy']);module[_0x4e8a('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 2f7bb6e..f47617f 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 _0x5fc3=['squel','exports','STRING','TEXT','long','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize'];(function(_0x3a0863,_0x4cd5ef){var _0x85c557=function(_0x3011cb){while(--_0x3011cb){_0x3a0863['push'](_0x3a0863['shift']());}};_0x85c557(++_0x4cd5ef);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x5fc3[_0x2df507];return _0x1f7167;};'use strict';var Sequelize=require(_0x35fc('0x0'));var squel=require(_0x35fc('0x1'));var _=require('lodash');module[_0x35fc('0x2')]={'title':{'type':Sequelize[_0x35fc('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x35fc('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x35fc('0x4')](_0x35fc('0x5')),'get':function(){try{return JSON['parse'](this[_0x35fc('0x6')](_0x35fc('0x7')));}catch(_0x186a06){return[];}},'set':function(_0x5b85ad){try{this['setDataValue'](_0x35fc('0x7'),JSON['stringify'](_0x5b85ad));}catch(_0x16e153){this[_0x35fc('0x8')](_0x35fc('0x7'),JSON[_0x35fc('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x35fc('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x35fc('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x35fc('0xa')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x35fc('0x3')],'allowNull':![],'defaultValue':_0x35fc('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x35fc('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x35fc('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x6d38=['INTEGER','STRING','#2196f3','squel','lodash','exports','TEXT','parse','getDataValue','attrs','setDataValue','stringify'];(function(_0xe36804,_0xccb47c){var _0x2e9563=function(_0xd0da92){while(--_0xd0da92){_0xe36804['push'](_0xe36804['shift']());}};_0x2e9563(++_0xccb47c);}(_0x6d38,0x1ef));var _0x86d3=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x6d38[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x86d3('0x0'));var _=require(_0x86d3('0x1'));module[_0x86d3('0x2')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x86d3('0x3')]('long'),'get':function(){try{return JSON[_0x86d3('0x4')](this[_0x86d3('0x5')](_0x86d3('0x6')));}catch(_0x4ef557){return[];}},'set':function(_0x2d8272){try{this[_0x86d3('0x7')](_0x86d3('0x6'),JSON[_0x86d3('0x8')](_0x2d8272));}catch(_0x47e654){this['setDataValue'](_0x86d3('0x6'),JSON[_0x86d3('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x86d3('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x86d3('0x9')]},'background':{'type':Sequelize[_0x86d3('0xa')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x86d3('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x86d3('0xa')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 1ced4f3..a9d93b6 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 _0x5ca8=['path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','status','undefined','limit','offset','count','set','json','apply','save','update','then','end','sendStatus','stack','name','send','keys','rawAttributes','query','filters','intersection','model','attributes','length','includeAll','include','options','DashboardItem','find','catch','destroy','params','type','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','error','stringify','body','eml-format','rimraf','fast-json-patch','request-promise','mustache'];(function(_0x2f2233,_0x34f607){var _0x12a235=function(_0x20d7e6){while(--_0x20d7e6){_0x2f2233['push'](_0x2f2233['shift']());}};_0x12a235(++_0x34f607);}(_0x5ca8,0x1f3));var _0x85ca=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5ca8[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x85ca('0x0'));var rimraf=require(_0x85ca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x85ca('0x2'));var rp=require(_0x85ca('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x85ca('0x4'));var util=require('util');var path=require(_0x85ca('0x5'));var sox=require(_0x85ca('0x6'));var csv=require('to-csv');var ejs=require(_0x85ca('0x7'));var fs=require('fs');var fs_extra=require(_0x85ca('0x8'));var _=require(_0x85ca('0x9'));var squel=require(_0x85ca('0xa'));var crypto=require(_0x85ca('0xb'));var jsforce=require(_0x85ca('0xc'));var deskjs=require(_0x85ca('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x85ca('0xe'));var Redis=require(_0x85ca('0xf'));var authService=require(_0x85ca('0x10'));var qs=require(_0x85ca('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x85ca('0x12'));var logger=require('../../config/logger')(_0x85ca('0x13'));var utils=require('../../config/utils');var config=require(_0x85ca('0x14'));var licenseUtil=require(_0x85ca('0x15'));var db=require(_0x85ca('0x16'))['db'];config['redis']=_[_0x85ca('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x85ca('0x18'))(new Redis(config[_0x85ca('0x19')]));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0x3c8dd9,_0xfcba92){_0xfcba92=_0xfcba92||0xcc;return function(_0x43810e){if(_0x43810e){return _0x3c8dd9['sendStatus'](_0xfcba92);}return _0x3c8dd9[_0x85ca('0x1a')](_0xfcba92)['end']();};}function respondWithResult(_0x7c5221,_0x4cefa2){_0x4cefa2=_0x4cefa2||0xc8;return function(_0x3e7e35){if(_0x3e7e35){return _0x7c5221[_0x85ca('0x1a')](_0x4cefa2)['json'](_0x3e7e35);}};}function respondWithFilteredResult(_0x290244,_0x18d447){return function(_0x7bc433){if(_0x7bc433){var _0x47e81d=typeof _0x18d447['offset']===_0x85ca('0x1b')&&typeof _0x18d447[_0x85ca('0x1c')]===_0x85ca('0x1b');var _0x274ac9=_0x7bc433['count'];var _0x37adca=_0x47e81d?0x0:_0x18d447[_0x85ca('0x1d')];var _0x18722a=_0x47e81d?_0x7bc433[_0x85ca('0x1e')]:_0x18d447[_0x85ca('0x1d')]+_0x18d447[_0x85ca('0x1c')];var _0xc31b68;if(_0x18722a>=_0x274ac9){_0x18722a=_0x274ac9;_0xc31b68=0xc8;}else{_0xc31b68=0xce;}_0x290244[_0x85ca('0x1a')](_0xc31b68);return _0x290244[_0x85ca('0x1f')]('Content-Range',_0x37adca+'-'+_0x18722a+'/'+_0x274ac9)[_0x85ca('0x20')](_0x7bc433);}return null;};}function patchUpdates(_0x4508ff){return function(_0x12bb10){try{jsonpatch[_0x85ca('0x21')](_0x12bb10,_0x4508ff,!![]);}catch(_0x4fa05f){return BPromise['reject'](_0x4fa05f);}return _0x12bb10[_0x85ca('0x22')]();};}function saveUpdates(_0x2c04f3,_0x2ab039){return function(_0x3b2ae2){if(_0x3b2ae2){return _0x3b2ae2[_0x85ca('0x23')](_0x2c04f3)[_0x85ca('0x24')](function(_0x40c6b5){return _0x40c6b5;});}return null;};}function removeEntity(_0x1d592e,_0x9c92b1){return function(_0x4b4834){if(_0x4b4834){return _0x4b4834['destroy']()[_0x85ca('0x24')](function(){_0x1d592e['status'](0xcc)[_0x85ca('0x25')]();});}};}function handleEntityNotFound(_0x44e67b,_0x16c7ea){return function(_0x5b7efe){if(!_0x5b7efe){_0x44e67b[_0x85ca('0x26')](0x194);}return _0x5b7efe;};}function handleError(_0x2db352,_0x478cb4){_0x478cb4=_0x478cb4||0x1f4;return function(_0x453163){logger['error'](_0x453163[_0x85ca('0x27')]);if(_0x453163[_0x85ca('0x28')]){delete _0x453163[_0x85ca('0x28')];}_0x2db352[_0x85ca('0x1a')](_0x478cb4)[_0x85ca('0x29')](_0x453163);};}exports['show']=function(_0x53f516,_0x2b2994){var _0x19f077={'raw':![],'where':{'id':_0x53f516['params']['id']}},_0x3c97de={};_0x3c97de['model']=_[_0x85ca('0x2a')](db['DashboardItem'][_0x85ca('0x2b')]);_0x3c97de[_0x85ca('0x2c')]=_[_0x85ca('0x2a')](_0x53f516['query']);_0x3c97de[_0x85ca('0x2d')]=_[_0x85ca('0x2e')](_0x3c97de[_0x85ca('0x2f')],_0x3c97de[_0x85ca('0x2c')]);_0x19f077[_0x85ca('0x30')]=_[_0x85ca('0x2e')](_0x3c97de[_0x85ca('0x2f')],qs['fields'](_0x53f516[_0x85ca('0x2c')]['fields']));_0x19f077[_0x85ca('0x30')]=_0x19f077['attributes'][_0x85ca('0x31')]?_0x19f077[_0x85ca('0x30')]:_0x3c97de[_0x85ca('0x2f')];if(_0x53f516['query'][_0x85ca('0x32')]){_0x19f077[_0x85ca('0x33')]=[{'all':!![]}];}_0x19f077=_['merge']({},_0x19f077,_0x53f516[_0x85ca('0x34')]);return db[_0x85ca('0x35')][_0x85ca('0x36')](_0x19f077)['then'](handleEntityNotFound(_0x2b2994,null))[_0x85ca('0x24')](respondWithResult(_0x2b2994,null))[_0x85ca('0x37')](handleError(_0x2b2994,null));};exports[_0x85ca('0x38')]=function(_0x583a4e,_0x1d7e04){return db['DashboardItem'][_0x85ca('0x36')]({'where':{'id':_0x583a4e[_0x85ca('0x39')]['id']}})[_0x85ca('0x24')](handleEntityNotFound(_0x1d7e04,null))['then'](removeEntity(_0x1d7e04,null))[_0x85ca('0x37')](handleError(_0x1d7e04,null));};function widgetAttributes(_0xec6958){try{switch(_0xec6958[_0x85ca('0x3a')]){case _0x85ca('0x3b'):return[{'name':_0x85ca('0x3c'),'value':_0xec6958[_0x85ca('0x3c')]||(_0xec6958[_0x85ca('0x3d')]&&_0xec6958['attrs'][0x0]?_0xec6958[_0x85ca('0x3d')][0x0][_0x85ca('0x3e')]:undefined)||_0x85ca('0x3f')}];case'custom':return[{'name':_0x85ca('0x40'),'value':_0xec6958['attrPath']||(_0xec6958[_0x85ca('0x3d')]&&_0xec6958[_0x85ca('0x3d')][0x0]?_0xec6958[_0x85ca('0x3d')][0x0][_0x85ca('0x3e')]:undefined)||''}];case _0x85ca('0x41'):return[{'name':_0x85ca('0x42'),'value':_0xec6958[_0x85ca('0x42')]||(_0xec6958[_0x85ca('0x3d')]&&_0xec6958['attrs'][0x0]?_0xec6958[_0x85ca('0x3d')][0x0]['value']:undefined)||_0x85ca('0x43')},{'name':_0x85ca('0x44'),'value':_0xec6958[_0x85ca('0x44')]||(_0xec6958[_0x85ca('0x3d')]&&_0xec6958[_0x85ca('0x3d')][0x1]?_0xec6958['attrs'][0x1]['value']:undefined)||_0x85ca('0x45')},{'name':'attrFontSize','value':_0xec6958[_0x85ca('0x46')]||(_0xec6958[_0x85ca('0x3d')]&&_0xec6958[_0x85ca('0x3d')][0x2]?_0xec6958[_0x85ca('0x3d')][0x2][_0x85ca('0x3e')]:undefined)||0xc}];case _0x85ca('0x47'):return[{'name':_0x85ca('0x48'),'value':_0xec6958[_0x85ca('0x48')]||(_0xec6958['attrs']&&_0xec6958[_0x85ca('0x3d')][0x0]?_0xec6958[_0x85ca('0x3d')][0x0][_0x85ca('0x3e')]:undefined)||_0x85ca('0x49')},{'name':_0x85ca('0x4a'),'value':_0xec6958[_0x85ca('0x4a')]||(_0xec6958[_0x85ca('0x3d')]&&_0xec6958['attrs'][0x1]?_0xec6958[_0x85ca('0x3d')][0x1][_0x85ca('0x3e')]:undefined)||[]},{'name':_0x85ca('0x46'),'value':_0xec6958[_0x85ca('0x46')]||(_0xec6958[_0x85ca('0x3d')]&&_0xec6958[_0x85ca('0x3d')][0x2]?_0xec6958[_0x85ca('0x3d')][0x2]['value']:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':_0x85ca('0x4b'),'value':_0xec6958[_0x85ca('0x4b')]||(_0xec6958['attrs']&&_0xec6958[_0x85ca('0x3d')][0x0]?_0xec6958['attrs'][0x0][_0x85ca('0x3e')]:undefined)||_0x85ca('0x49')},{'name':_0x85ca('0x4c'),'value':_0xec6958[_0x85ca('0x4c')]||(_0xec6958[_0x85ca('0x3d')]&&_0xec6958[_0x85ca('0x3d')][0x1]?_0xec6958[_0x85ca('0x3d')][0x1][_0x85ca('0x3e')]:undefined)||null},{'name':_0x85ca('0x4d'),'value':_0xec6958[_0x85ca('0x4d')]||(_0xec6958['attrs']&&_0xec6958[_0x85ca('0x3d')][0x2]?_0xec6958[_0x85ca('0x3d')][0x2]['value']:undefined)||null},{'name':_0x85ca('0x4a'),'value':_0xec6958[_0x85ca('0x4a')]||(_0xec6958[_0x85ca('0x3d')]&&_0xec6958['attrs'][0x3]?_0xec6958['attrs'][0x3][_0x85ca('0x3e')]:undefined)||[]}];case _0x85ca('0x4e'):return[{'name':_0x85ca('0x4f'),'type':_0xec6958['reportType']||(_0xec6958[_0x85ca('0x3d')]&&_0xec6958[_0x85ca('0x3d')][0x0]?_0xec6958[_0x85ca('0x3d')][0x0][_0x85ca('0x3a')]:undefined)||null,'value':_0xec6958[_0x85ca('0x4f')]||(_0xec6958[_0x85ca('0x3d')]&&_0xec6958['attrs'][0x0]?_0xec6958['attrs'][0x0][_0x85ca('0x3e')]:undefined)||null},{'name':_0x85ca('0x50'),'value':_0xec6958['attrRefresh']||(_0xec6958[_0x85ca('0x3d')]&&_0xec6958['attrs'][0x1]?_0xec6958[_0x85ca('0x3d')][0x1][_0x85ca('0x3e')]:undefined)||0x0}];default:return[];}}catch(_0x4ee9b7){logger[_0x85ca('0x51')]('widgetAttributes:\x20%s',JSON[_0x85ca('0x52')](_0x4ee9b7));return[];}}exports['create']=function(_0x15c0fc,_0x5727f6){if(_0x15c0fc[_0x85ca('0x53')]){_0x15c0fc[_0x85ca('0x53')]['attrs']=widgetAttributes(_0x15c0fc[_0x85ca('0x53')]);}return db['DashboardItem']['create'](_0x15c0fc['body'],{})[_0x85ca('0x24')](respondWithResult(_0x5727f6,0xc9))['catch'](handleError(_0x5727f6,null));};exports[_0x85ca('0x23')]=function(_0x1cb4f6,_0x21cd18){if(_0x1cb4f6[_0x85ca('0x53')]['id']){delete _0x1cb4f6[_0x85ca('0x53')]['id'];}_0x1cb4f6[_0x85ca('0x53')][_0x85ca('0x3d')]=widgetAttributes(_0x1cb4f6['body']);return db[_0x85ca('0x35')]['find']({'where':{'id':_0x1cb4f6[_0x85ca('0x39')]['id']}})['then'](handleEntityNotFound(_0x21cd18,null))['then'](saveUpdates(_0x1cb4f6[_0x85ca('0x53')],null))['then'](respondWithResult(_0x21cd18,null))[_0x85ca('0x37')](handleError(_0x21cd18,null));}; \ No newline at end of file +var _0xdee8=['create','body','update','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','then','destroy','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','DashboardItem','catch','find','type','iframe','attrUrl','attrs','value','https://','custom','attrHourFormat','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie3','web-report','attrReport','attrRefresh','error','widgetAttributes:\x20%s'];(function(_0x19159a,_0x1cb5c3){var _0xa677f4=function(_0x24bb85){while(--_0x24bb85){_0x19159a['push'](_0x19159a['shift']());}};_0xa677f4(++_0x1cb5c3);}(_0xdee8,0x157));var _0x8dee=function(_0x52f037,_0x19495e){_0x52f037=_0x52f037-0x0;var _0x28ee27=_0xdee8[_0x52f037];return _0x28ee27;};'use strict';var emlformat=require(_0x8dee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8dee('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8dee('0x2'));var moment=require(_0x8dee('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8dee('0x4'));var util=require(_0x8dee('0x5'));var path=require(_0x8dee('0x6'));var sox=require(_0x8dee('0x7'));var csv=require(_0x8dee('0x8'));var ejs=require(_0x8dee('0x9'));var fs=require('fs');var fs_extra=require(_0x8dee('0xa'));var _=require('lodash');var squel=require(_0x8dee('0xb'));var crypto=require(_0x8dee('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8dee('0xd'));var toCsv=require(_0x8dee('0x8'));var querystring=require('querystring');var Papa=require(_0x8dee('0xe'));var Redis=require(_0x8dee('0xf'));var authService=require(_0x8dee('0x10'));var qs=require(_0x8dee('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8dee('0x12'));var logger=require('../../config/logger')(_0x8dee('0x13'));var utils=require(_0x8dee('0x14'));var config=require(_0x8dee('0x15'));var licenseUtil=require(_0x8dee('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8dee('0x17')](config[_0x8dee('0x18')],{'host':_0x8dee('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8dee('0x18')]));require('./dashboardItem.socket')[_0x8dee('0x1a')](socket);function respondWithStatusCode(_0x594685,_0x45e62f){_0x45e62f=_0x45e62f||0xcc;return function(_0x34310d){if(_0x34310d){return _0x594685[_0x8dee('0x1b')](_0x45e62f);}return _0x594685[_0x8dee('0x1c')](_0x45e62f)[_0x8dee('0x1d')]();};}function respondWithResult(_0x2c547f,_0x594f24){_0x594f24=_0x594f24||0xc8;return function(_0x3f6741){if(_0x3f6741){return _0x2c547f[_0x8dee('0x1c')](_0x594f24)[_0x8dee('0x1e')](_0x3f6741);}};}function respondWithFilteredResult(_0x5a7227,_0x24be27){return function(_0x11c00b){if(_0x11c00b){var _0x501ab8=typeof _0x24be27[_0x8dee('0x1f')]===_0x8dee('0x20')&&typeof _0x24be27[_0x8dee('0x21')]===_0x8dee('0x20');var _0x26d438=_0x11c00b[_0x8dee('0x22')];var _0x223305=_0x501ab8?0x0:_0x24be27['offset'];var _0x27aeda=_0x501ab8?_0x11c00b[_0x8dee('0x22')]:_0x24be27[_0x8dee('0x1f')]+_0x24be27[_0x8dee('0x21')];var _0x3aa18f;if(_0x27aeda>=_0x26d438){_0x27aeda=_0x26d438;_0x3aa18f=0xc8;}else{_0x3aa18f=0xce;}_0x5a7227[_0x8dee('0x1c')](_0x3aa18f);return _0x5a7227['set'](_0x8dee('0x23'),_0x223305+'-'+_0x27aeda+'/'+_0x26d438)[_0x8dee('0x1e')](_0x11c00b);}return null;};}function patchUpdates(_0x40e33d){return function(_0x23b592){try{jsonpatch['apply'](_0x23b592,_0x40e33d,!![]);}catch(_0x2505e1){return BPromise['reject'](_0x2505e1);}return _0x23b592[_0x8dee('0x24')]();};}function saveUpdates(_0x3b54fb,_0x40522c){return function(_0x4eea18){if(_0x4eea18){return _0x4eea18['update'](_0x3b54fb)[_0x8dee('0x25')](function(_0x11bcc5){return _0x11bcc5;});}return null;};}function removeEntity(_0x19576f,_0x4fbc70){return function(_0xf58771){if(_0xf58771){return _0xf58771[_0x8dee('0x26')]()[_0x8dee('0x25')](function(){_0x19576f[_0x8dee('0x1c')](0xcc)[_0x8dee('0x1d')]();});}};}function handleEntityNotFound(_0x3b9d48,_0x5493fb){return function(_0x230da0){if(!_0x230da0){_0x3b9d48['sendStatus'](0x194);}return _0x230da0;};}function handleError(_0x1f123b,_0x208600){_0x208600=_0x208600||0x1f4;return function(_0xb58833){logger['error'](_0xb58833[_0x8dee('0x27')]);if(_0xb58833[_0x8dee('0x28')]){delete _0xb58833[_0x8dee('0x28')];}_0x1f123b[_0x8dee('0x1c')](_0x208600)[_0x8dee('0x29')](_0xb58833);};}exports[_0x8dee('0x2a')]=function(_0x203f51,_0xbd73a8){var _0x511b48={'raw':![],'where':{'id':_0x203f51[_0x8dee('0x2b')]['id']}},_0x55c844={};_0x55c844[_0x8dee('0x2c')]=_[_0x8dee('0x2d')](db['DashboardItem'][_0x8dee('0x2e')]);_0x55c844[_0x8dee('0x2f')]=_[_0x8dee('0x2d')](_0x203f51[_0x8dee('0x2f')]);_0x55c844[_0x8dee('0x30')]=_['intersection'](_0x55c844[_0x8dee('0x2c')],_0x55c844[_0x8dee('0x2f')]);_0x511b48['attributes']=_[_0x8dee('0x31')](_0x55c844[_0x8dee('0x2c')],qs[_0x8dee('0x32')](_0x203f51[_0x8dee('0x2f')][_0x8dee('0x32')]));_0x511b48[_0x8dee('0x33')]=_0x511b48['attributes'][_0x8dee('0x34')]?_0x511b48[_0x8dee('0x33')]:_0x55c844[_0x8dee('0x2c')];if(_0x203f51[_0x8dee('0x2f')][_0x8dee('0x35')]){_0x511b48[_0x8dee('0x36')]=[{'all':!![]}];}_0x511b48=_[_0x8dee('0x37')]({},_0x511b48,_0x203f51[_0x8dee('0x38')]);return db[_0x8dee('0x39')]['find'](_0x511b48)[_0x8dee('0x25')](handleEntityNotFound(_0xbd73a8,null))[_0x8dee('0x25')](respondWithResult(_0xbd73a8,null))[_0x8dee('0x3a')](handleError(_0xbd73a8,null));};exports[_0x8dee('0x26')]=function(_0x1c553a,_0x236581){return db[_0x8dee('0x39')][_0x8dee('0x3b')]({'where':{'id':_0x1c553a[_0x8dee('0x2b')]['id']}})[_0x8dee('0x25')](handleEntityNotFound(_0x236581,null))[_0x8dee('0x25')](removeEntity(_0x236581,null))['catch'](handleError(_0x236581,null));};function widgetAttributes(_0x184a27){try{switch(_0x184a27[_0x8dee('0x3c')]){case _0x8dee('0x3d'):return[{'name':_0x8dee('0x3e'),'value':_0x184a27['attrUrl']||(_0x184a27[_0x8dee('0x3f')]&&_0x184a27['attrs'][0x0]?_0x184a27[_0x8dee('0x3f')][0x0][_0x8dee('0x40')]:undefined)||_0x8dee('0x41')}];case _0x8dee('0x42'):return[{'name':'attrPath','value':_0x184a27['attrPath']||(_0x184a27[_0x8dee('0x3f')]&&_0x184a27['attrs'][0x0]?_0x184a27[_0x8dee('0x3f')][0x0][_0x8dee('0x40')]:undefined)||''}];case'clock':return[{'name':_0x8dee('0x43'),'value':_0x184a27[_0x8dee('0x43')]||(_0x184a27[_0x8dee('0x3f')]&&_0x184a27[_0x8dee('0x3f')][0x0]?_0x184a27['attrs'][0x0][_0x8dee('0x40')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x184a27['attrTimezone']||(_0x184a27[_0x8dee('0x3f')]&&_0x184a27['attrs'][0x1]?_0x184a27[_0x8dee('0x3f')][0x1][_0x8dee('0x40')]:undefined)||_0x8dee('0x44')},{'name':_0x8dee('0x45'),'value':_0x184a27[_0x8dee('0x45')]||(_0x184a27[_0x8dee('0x3f')]&&_0x184a27[_0x8dee('0x3f')][0x2]?_0x184a27[_0x8dee('0x3f')][0x2][_0x8dee('0x40')]:undefined)||0xc}];case _0x8dee('0x46'):return[{'name':_0x8dee('0x47'),'value':_0x184a27['attrMetric']||(_0x184a27[_0x8dee('0x3f')]&&_0x184a27['attrs'][0x0]?_0x184a27[_0x8dee('0x3f')][0x0]['value']:undefined)||_0x8dee('0x48')},{'name':_0x8dee('0x49'),'value':_0x184a27[_0x8dee('0x49')]||(_0x184a27[_0x8dee('0x3f')]&&_0x184a27[_0x8dee('0x3f')][0x1]?_0x184a27[_0x8dee('0x3f')][0x1][_0x8dee('0x40')]:undefined)||[]},{'name':'attrFontSize','value':_0x184a27[_0x8dee('0x45')]||(_0x184a27[_0x8dee('0x3f')]&&_0x184a27[_0x8dee('0x3f')][0x2]?_0x184a27['attrs'][0x2][_0x8dee('0x40')]:undefined)||0x14}];case'multibar-chart':case _0x8dee('0x4a'):return[{'name':_0x8dee('0x4b'),'value':_0x184a27[_0x8dee('0x4b')]||(_0x184a27[_0x8dee('0x3f')]&&_0x184a27['attrs'][0x0]?_0x184a27[_0x8dee('0x3f')][0x0][_0x8dee('0x40')]:undefined)||'total'},{'name':'attrSerie2','value':_0x184a27['attrSerie2']||(_0x184a27[_0x8dee('0x3f')]&&_0x184a27[_0x8dee('0x3f')][0x1]?_0x184a27[_0x8dee('0x3f')][0x1][_0x8dee('0x40')]:undefined)||null},{'name':_0x8dee('0x4c'),'value':_0x184a27[_0x8dee('0x4c')]||(_0x184a27[_0x8dee('0x3f')]&&_0x184a27['attrs'][0x2]?_0x184a27[_0x8dee('0x3f')][0x2][_0x8dee('0x40')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x184a27['attrVoiceQueues']||(_0x184a27[_0x8dee('0x3f')]&&_0x184a27[_0x8dee('0x3f')][0x3]?_0x184a27[_0x8dee('0x3f')][0x3][_0x8dee('0x40')]:undefined)||[]}];case _0x8dee('0x4d'):return[{'name':_0x8dee('0x4e'),'type':_0x184a27['reportType']||(_0x184a27[_0x8dee('0x3f')]&&_0x184a27[_0x8dee('0x3f')][0x0]?_0x184a27[_0x8dee('0x3f')][0x0][_0x8dee('0x3c')]:undefined)||null,'value':_0x184a27[_0x8dee('0x4e')]||(_0x184a27[_0x8dee('0x3f')]&&_0x184a27[_0x8dee('0x3f')][0x0]?_0x184a27['attrs'][0x0][_0x8dee('0x40')]:undefined)||null},{'name':_0x8dee('0x4f'),'value':_0x184a27[_0x8dee('0x4f')]||(_0x184a27['attrs']&&_0x184a27['attrs'][0x1]?_0x184a27[_0x8dee('0x3f')][0x1][_0x8dee('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x53b3c2){logger[_0x8dee('0x50')](_0x8dee('0x51'),JSON['stringify'](_0x53b3c2));return[];}}exports[_0x8dee('0x52')]=function(_0x18e783,_0x265c6b){if(_0x18e783[_0x8dee('0x53')]){_0x18e783[_0x8dee('0x53')][_0x8dee('0x3f')]=widgetAttributes(_0x18e783[_0x8dee('0x53')]);}return db['DashboardItem'][_0x8dee('0x52')](_0x18e783[_0x8dee('0x53')],{})['then'](respondWithResult(_0x265c6b,0xc9))['catch'](handleError(_0x265c6b,null));};exports[_0x8dee('0x54')]=function(_0x3f1282,_0x1fc627){if(_0x3f1282[_0x8dee('0x53')]['id']){delete _0x3f1282[_0x8dee('0x53')]['id'];}_0x3f1282['body']['attrs']=widgetAttributes(_0x3f1282[_0x8dee('0x53')]);return db[_0x8dee('0x39')][_0x8dee('0x3b')]({'where':{'id':_0x3f1282[_0x8dee('0x2b')]['id']}})[_0x8dee('0x25')](handleEntityNotFound(_0x1fc627,null))[_0x8dee('0x25')](saveUpdates(_0x3f1282[_0x8dee('0x53')],null))[_0x8dee('0x25')](respondWithResult(_0x1fc627,null))[_0x8dee('0x3a')](handleError(_0x1fc627,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 0e22c18..e7167e4 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 _0xacb5=['DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x2d2701,_0x43accb){var _0x25f77f=function(_0x55b2db){while(--_0x55b2db){_0x2d2701['push'](_0x2d2701['shift']());}};_0x25f77f(++_0x43accb);}(_0xacb5,0xe0));var _0x5acb=function(_0x3944b3,_0xf05375){_0x3944b3=_0x3944b3-0x0;var _0xbf7a53=_0xacb5[_0x3944b3];return _0xbf7a53;};'use strict';var EventEmitter=require(_0x5acb('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x5acb('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x5acb('0x2')](0x0);var events={'afterCreate':_0x5acb('0x3'),'afterUpdate':_0x5acb('0x4'),'afterDestroy':_0x5acb('0x5')};function emitEvent(_0x21709a){return function(_0x4d5516,_0xba412e,_0x44abb7){DashboardItemEvents[_0x5acb('0x6')](_0x21709a+':'+_0x4d5516['id'],_0x4d5516);DashboardItemEvents[_0x5acb('0x6')](_0x21709a,_0x4d5516);_0x44abb7(null);};}for(var e in events){if(events[_0x5acb('0x7')](e)){var event=events[e];DashboardItem[_0x5acb('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x7417=['hook','exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x250ae4,_0x9fea3){var _0x2dfb94=function(_0x108d8c){while(--_0x108d8c){_0x250ae4['push'](_0x250ae4['shift']());}};_0x2dfb94(++_0x9fea3);}(_0x7417,0xec));var _0x7741=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7417[_0x3947c9];return _0x2e7871;};'use strict';var EventEmitter=require(_0x7741('0x0'));var DashboardItem=require(_0x7741('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7741('0x2'),'afterUpdate':_0x7741('0x3'),'afterDestroy':_0x7741('0x4')};function emitEvent(_0x17dba9){return function(_0x4a9d98,_0x2ac9ad,_0x3c79b1){DashboardItemEvents[_0x7741('0x5')](_0x17dba9+':'+_0x4a9d98['id'],_0x4a9d98);DashboardItemEvents[_0x7741('0x5')](_0x17dba9,_0x4a9d98);_0x3c79b1(null);};}for(var e in events){if(events[_0x7741('0x6')](e)){var event=events[e];DashboardItem[_0x7741('0x7')](e,emitEvent(event));}}module[_0x7741('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index cd474d9..a5a6b77 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 _0xc2a5=['path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','../../config/logger','api'];(function(_0x2e58c7,_0x23d092){var _0x26eb00=function(_0x343124){while(--_0x343124){_0x2e58c7['push'](_0x2e58c7['shift']());}};_0x26eb00(++_0x23d092);}(_0xc2a5,0x1d6));var _0x5c2a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xc2a5[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x5c2a('0x0'));var util=require('util');var logger=require(_0x5c2a('0x1'))(_0x5c2a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c2a('0x3'));var rimraf=require(_0x5c2a('0x4'));var config=require(_0x5c2a('0x5'));var attributes=require(_0x5c2a('0x6'));module[_0x5c2a('0x7')]=function(_0x26833d,_0x50be02){return _0x26833d[_0x5c2a('0x8')](_0x5c2a('0x9'),attributes,{'tableName':_0x5c2a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2642=['exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes'];(function(_0x382d26,_0x2fd1e2){var _0x1b0636=function(_0xa96554){while(--_0xa96554){_0x382d26['push'](_0x382d26['shift']());}};_0x1b0636(++_0x2fd1e2);}(_0x2642,0x11c));var _0x2264=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x2642[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x2264('0x0'));var util=require(_0x2264('0x1'));var logger=require(_0x2264('0x2'))(_0x2264('0x3'));var moment=require('moment');var BPromise=require(_0x2264('0x4'));var rp=require(_0x2264('0x5'));var fs=require('fs');var path=require(_0x2264('0x6'));var rimraf=require(_0x2264('0x7'));var config=require(_0x2264('0x8'));var attributes=require(_0x2264('0x9'));module[_0x2264('0xa')]=function(_0x56a2dd,_0x3e0282){return _0x56a2dd[_0x2264('0xb')](_0x2264('0xc'),attributes,{'tableName':_0x2264('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 c900a3a..797d551 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 _0x6b14=['info','DashboardItem,\x20%s,\x20%s','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request'];(function(_0x4e7c0e,_0x47f1e6){var _0x1893fa=function(_0x41b13e){while(--_0x41b13e){_0x4e7c0e['push'](_0x4e7c0e['shift']());}};_0x1893fa(++_0x47f1e6);}(_0x6b14,0x1cb));var _0x46b1=function(_0x2cf227,_0x497338){_0x2cf227=_0x2cf227-0x0;var _0x5a6517=_0x6b14[_0x2cf227];return _0x5a6517;};'use strict';var _=require(_0x46b1('0x0'));var util=require(_0x46b1('0x1'));var moment=require(_0x46b1('0x2'));var BPromise=require(_0x46b1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x46b1('0x4'));var db=require(_0x46b1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x46b1('0x6'))('rpc');var config=require(_0x46b1('0x7'));var jayson=require(_0x46b1('0x8'));var client=jayson[_0x46b1('0x9')][_0x46b1('0xa')]({'port':0x232a});config[_0x46b1('0xb')]=_['defaults'](config[_0x46b1('0xb')],{'host':_0x46b1('0xc'),'port':0x18eb});var socket=require(_0x46b1('0xd'))(new Redis(config[_0x46b1('0xb')]));require('./dashboardItem.socket')[_0x46b1('0xe')](socket);function respondWithRpcPromise(_0x2f8de7,_0x5e6f97,_0x34a16a){return new BPromise(function(_0x3b2099,_0x3466cb){return client[_0x46b1('0xf')](_0x2f8de7,_0x34a16a)['then'](function(_0x525aa5){logger[_0x46b1('0x10')](_0x46b1('0x11'),_0x5e6f97,'request\x20sent');logger['debug'](_0x46b1('0x12'),_0x5e6f97,'request\x20sent',JSON[_0x46b1('0x13')](_0x525aa5));if(_0x525aa5[_0x46b1('0x14')]){if(_0x525aa5[_0x46b1('0x14')][_0x46b1('0x15')]===0x1f4){logger[_0x46b1('0x14')](_0x46b1('0x11'),_0x5e6f97,_0x525aa5[_0x46b1('0x14')][_0x46b1('0x16')]);return _0x3466cb(_0x525aa5['error'][_0x46b1('0x16')]);}logger[_0x46b1('0x14')](_0x46b1('0x11'),_0x5e6f97,_0x525aa5[_0x46b1('0x14')][_0x46b1('0x16')]);return _0x3b2099(_0x525aa5[_0x46b1('0x14')]['message']);}else{logger[_0x46b1('0x10')](_0x46b1('0x11'),_0x5e6f97,'request\x20sent');_0x3b2099(_0x525aa5[_0x46b1('0x17')][_0x46b1('0x16')]);}})[_0x46b1('0x18')](function(_0x5d98a5){logger[_0x46b1('0x14')](_0x46b1('0x11'),_0x5e6f97,_0x5d98a5);_0x3466cb(_0x5d98a5);});});} \ No newline at end of file +var _0x68c2=['DashboardItem,\x20%s,\x20%s','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./dashboardItem.socket','register','request','then','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x110abe,_0x48c247){var _0x23a664=function(_0x1fd254){while(--_0x1fd254){_0x110abe['push'](_0x110abe['shift']());}};_0x23a664(++_0x48c247);}(_0x68c2,0x199));var _0x268c=function(_0x15da77,_0x10872e){_0x15da77=_0x15da77-0x0;var _0x49642c=_0x68c2[_0x15da77];return _0x49642c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x268c('0x0'));var BPromise=require(_0x268c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x268c('0x2'));var db=require(_0x268c('0x3'))['db'];var utils=require(_0x268c('0x4'));var logger=require(_0x268c('0x5'))(_0x268c('0x6'));var config=require(_0x268c('0x7'));var jayson=require(_0x268c('0x8'));var client=jayson[_0x268c('0x9')][_0x268c('0xa')]({'port':0x232a});config[_0x268c('0xb')]=_[_0x268c('0xc')](config[_0x268c('0xb')],{'host':_0x268c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x268c('0xb')]));require(_0x268c('0xe'))[_0x268c('0xf')](socket);function respondWithRpcPromise(_0x43e3b8,_0x56a36b,_0x2c4254){return new BPromise(function(_0xba37a,_0x1a64c5){return client[_0x268c('0x10')](_0x43e3b8,_0x2c4254)[_0x268c('0x11')](function(_0x4b1cf5){logger['info']('DashboardItem,\x20%s,\x20%s',_0x56a36b,_0x268c('0x12'));logger[_0x268c('0x13')](_0x268c('0x14'),_0x56a36b,'request\x20sent',JSON[_0x268c('0x15')](_0x4b1cf5));if(_0x4b1cf5[_0x268c('0x16')]){if(_0x4b1cf5[_0x268c('0x16')]['code']===0x1f4){logger['error'](_0x268c('0x17'),_0x56a36b,_0x4b1cf5[_0x268c('0x16')]['message']);return _0x1a64c5(_0x4b1cf5[_0x268c('0x16')]['message']);}logger['error'](_0x268c('0x17'),_0x56a36b,_0x4b1cf5['error'][_0x268c('0x18')]);return _0xba37a(_0x4b1cf5[_0x268c('0x16')][_0x268c('0x18')]);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0x56a36b,_0x268c('0x12'));_0xba37a(_0x4b1cf5[_0x268c('0x19')][_0x268c('0x18')]);}})[_0x268c('0x1a')](function(_0x48418c){logger[_0x268c('0x16')](_0x268c('0x17'),_0x56a36b,_0x48418c);_0x1a64c5(_0x48418c);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 55c32f3..299b180 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 _0x9bbe=['save','update','register','length','dashboardItem:','./dashboardItem.events'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x9bbe,0x1f1));var _0xe9bb=function(_0x45c235,_0x5cb5c7){_0x45c235=_0x45c235-0x0;var _0x2549e2=_0x9bbe[_0x45c235];return _0x2549e2;};'use strict';var DashboardItemEvents=require(_0xe9bb('0x0'));var events=[_0xe9bb('0x1'),'remove',_0xe9bb('0x2')];function createListener(_0x42ae88,_0x3c7df6){return function(_0x1a232a){_0x3c7df6['emit'](_0x42ae88,_0x1a232a);};}function removeListener(_0x5d9ffb,_0x22d1d8){return function(){DashboardItemEvents['removeListener'](_0x5d9ffb,_0x22d1d8);};}exports[_0xe9bb('0x3')]=function(_0x1f0f82){for(var _0x54389c=0x0,_0x13e1aa=events[_0xe9bb('0x4')];_0x54389c<_0x13e1aa;_0x54389c++){var _0x1c7d9c=events[_0x54389c];var _0x4b1c08=createListener(_0xe9bb('0x5')+_0x1c7d9c,_0x1f0f82);DashboardItemEvents['on'](_0x1c7d9c,_0x4b1c08);}}; \ No newline at end of file +var _0x1ebf=['emit','removeListener','length','./dashboardItem.events','save','remove','update'];(function(_0x553c78,_0x4656c2){var _0x2f68c5=function(_0x4b9fac){while(--_0x4b9fac){_0x553c78['push'](_0x553c78['shift']());}};_0x2f68c5(++_0x4656c2);}(_0x1ebf,0x9d));var _0xf1eb=function(_0x19abd2,_0x2df9e8){_0x19abd2=_0x19abd2-0x0;var _0xb2ff8e=_0x1ebf[_0x19abd2];return _0xb2ff8e;};'use strict';var DashboardItemEvents=require(_0xf1eb('0x0'));var events=[_0xf1eb('0x1'),_0xf1eb('0x2'),_0xf1eb('0x3')];function createListener(_0x25d3e8,_0x515646){return function(_0x233e39){_0x515646[_0xf1eb('0x4')](_0x25d3e8,_0x233e39);};}function removeListener(_0x3982d1,_0x36facb){return function(){DashboardItemEvents[_0xf1eb('0x5')](_0x3982d1,_0x36facb);};}exports['register']=function(_0x3cddd0){for(var _0x1acf94=0x0,_0x3cc274=events[_0xf1eb('0x6')];_0x1acf94<_0x3cc274;_0x1acf94++){var _0x5b3ef5=events[_0x1acf94];var _0x15b706=createListener('dashboardItem:'+_0x5b3ef5,_0x3cddd0);DashboardItemEvents['on'](_0x5b3ef5,_0x15b706);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 239ffac..cb3c325 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 _0x42e0=['get','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller'];(function(_0x1af5b2,_0x1b82fe){var _0xf1aa2d=function(_0x2ceae2){while(--_0x2ceae2){_0x1af5b2['push'](_0x1af5b2['shift']());}};_0xf1aa2d(++_0x1b82fe);}(_0x42e0,0xdb));var _0x042e=function(_0x3e8168,_0x2b4723){_0x3e8168=_0x3e8168-0x0;var _0x1a4ee7=_0x42e0[_0x3e8168];return _0x1a4ee7;};'use strict';var multer=require(_0x042e('0x0'));var util=require(_0x042e('0x1'));var path=require('path');var timeout=require(_0x042e('0x2'));var express=require(_0x042e('0x3'));var router=express['Router']();var fs_extra=require(_0x042e('0x4'));var auth=require(_0x042e('0x5'));var interaction=require(_0x042e('0x6'));var config=require(_0x042e('0x7'));var controller=require(_0x042e('0x8'));router[_0x042e('0x9')](_0x042e('0xa'),auth[_0x042e('0xb')](),controller[_0x042e('0xc')]);router[_0x042e('0xd')]('/',auth[_0x042e('0xb')](),controller[_0x042e('0xe')]);router[_0x042e('0xf')](_0x042e('0xa'),auth[_0x042e('0xb')](),controller[_0x042e('0x10')]);router['delete'](_0x042e('0xa'),auth[_0x042e('0xb')](),controller[_0x042e('0x11')]);module[_0x042e('0x12')]=router; \ No newline at end of file +var _0x9a28=['multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','show','post','isAuthenticated','create','delete','destroy','exports'];(function(_0x542feb,_0x339f5a){var _0x5a1ff9=function(_0xf67ed7){while(--_0xf67ed7){_0x542feb['push'](_0x542feb['shift']());}};_0x5a1ff9(++_0x339f5a);}(_0x9a28,0x120));var _0x89a2=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x9a28[_0xc4001c];return _0x49f7bc;};'use strict';var multer=require(_0x89a2('0x0'));var util=require(_0x89a2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x89a2('0x2'));var router=express[_0x89a2('0x3')]();var fs_extra=require(_0x89a2('0x4'));var auth=require(_0x89a2('0x5'));var interaction=require(_0x89a2('0x6'));var config=require(_0x89a2('0x7'));var controller=require(_0x89a2('0x8'));router[_0x89a2('0x9')](_0x89a2('0xa'),auth['isAuthenticated'](),controller[_0x89a2('0xb')]);router[_0x89a2('0xc')]('/',auth[_0x89a2('0xd')](),controller[_0x89a2('0xe')]);router['put']('/:id',auth[_0x89a2('0xd')](),controller['update']);router[_0x89a2('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x89a2('0x10')]);module[_0x89a2('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 9fd2f34..f42fb3a 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 _0x3021=['first','third','sequelize','exports','STRING','ENUM'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x3021,0x18e));var _0x1302=function(_0x59a0fc,_0x12c915){_0x59a0fc=_0x59a0fc-0x0;var _0x31c27c=_0x3021[_0x59a0fc];return _0x31c27c;};'use strict';var Sequelize=require(_0x1302('0x0'));module[_0x1302('0x1')]={'name':{'type':Sequelize[_0x1302('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x1302('0x3')](_0x1302('0x4'),'second',_0x1302('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xac88=['first','sequelize','exports','STRING','second'];(function(_0x4c9316,_0x5c7f6f){var _0x146aad=function(_0x4fa179){while(--_0x4fa179){_0x4c9316['push'](_0x4c9316['shift']());}};_0x146aad(++_0x5c7f6f);}(_0xac88,0x19b));var _0x8ac8=function(_0xbbc524,_0xe694cc){_0xbbc524=_0xbbc524-0x0;var _0x55c231=_0xac88[_0xbbc524];return _0x55c231;};'use strict';var Sequelize=require(_0x8ac8('0x0'));module[_0x8ac8('0x1')]={'name':{'type':Sequelize[_0x8ac8('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM']('first',_0x8ac8('0x3'),'third'),'allowNull':![],'defaultValue':_0x8ac8('0x4')},'description':{'type':Sequelize[_0x8ac8('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 37209d5..a510502 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 _0x1261=['role','userProfileId','create','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','Dispositions','UserProfileResource','destroy','error','name','index','map','Disposition','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','findAll','rows','catch','keys','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x2c508c,_0x2a365b){var _0x5af45a=function(_0x2ac397){while(--_0x2ac397){_0x2c508c['push'](_0x2c508c['shift']());}};_0x5af45a(++_0x2a365b);}(_0x1261,0x144));var _0x1126=function(_0x2d1971,_0x20b764){_0x2d1971=_0x2d1971-0x0;var _0x4d7759=_0x1261[_0x2d1971];return _0x4d7759;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){var _0x15bcc3=_0x529dd9[_0x1126('0x26')]({'plain':!![]});var _0x34bcf1=_0x1126('0x27');return db[_0x1126('0x28')][_0x1126('0x29')]({'where':{'type':_0x34bcf1,'resourceId':_0x15bcc3['id']}})[_0x1126('0x25')](function(){return _0x529dd9;});})['then'](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0xa293f4,_0x5ddf63){return function(_0x541bc9){if(!_0x541bc9){_0xa293f4[_0x1126('0x18')](0x194);}return _0x541bc9;};}function handleError(_0x39bf0e,_0x55e195){_0x55e195=_0x55e195||0x1f4;return function(_0x2fb797){logger[_0x1126('0x2a')](_0x2fb797['stack']);if(_0x2fb797[_0x1126('0x2b')]){delete _0x2fb797['name'];}_0x39bf0e[_0x1126('0x19')](_0x55e195)['send'](_0x2fb797);};}exports[_0x1126('0x2c')]=function(_0x583ce6,_0x378f4d){var _0x5f2611={},_0x5252e0={},_0x4a53ab={'count':0x0,'rows':[]};var _0x17646e=_[_0x1126('0x2d')](db[_0x1126('0x2e')]['rawAttributes'],function(_0x2a3055){return{'name':_0x2a3055[_0x1126('0x2f')],'type':_0x2a3055['type'][_0x1126('0x30')]};});_0x5252e0[_0x1126('0x31')]=_[_0x1126('0x2d')](_0x17646e,_0x1126('0x2b'));_0x5252e0['query']=_['keys'](_0x583ce6[_0x1126('0x32')]);_0x5252e0[_0x1126('0x33')]=_[_0x1126('0x34')](_0x5252e0[_0x1126('0x31')],_0x5252e0['query']);_0x5f2611[_0x1126('0x35')]=_[_0x1126('0x34')](_0x5252e0[_0x1126('0x31')],qs[_0x1126('0x36')](_0x583ce6[_0x1126('0x32')]['fields']));_0x5f2611[_0x1126('0x35')]=_0x5f2611[_0x1126('0x35')][_0x1126('0x37')]?_0x5f2611[_0x1126('0x35')]:_0x5252e0['model'];if(!_0x583ce6['query'][_0x1126('0x38')](_0x1126('0x39'))){_0x5f2611['limit']=qs[_0x1126('0x1e')](_0x583ce6[_0x1126('0x32')][_0x1126('0x1e')]);_0x5f2611['offset']=qs['offset'](_0x583ce6[_0x1126('0x32')][_0x1126('0x1c')]);}_0x5f2611[_0x1126('0x3a')]=qs[_0x1126('0x3b')](_0x583ce6['query'][_0x1126('0x3b')]);_0x5f2611['where']=qs[_0x1126('0x33')](_[_0x1126('0x3c')](_0x583ce6[_0x1126('0x32')],_0x5252e0[_0x1126('0x33')]),_0x17646e);if(_0x583ce6[_0x1126('0x32')]['filter']){_0x5f2611[_0x1126('0x3d')]=_[_0x1126('0x3e')](_0x5f2611[_0x1126('0x3d')],{'$or':_[_0x1126('0x2d')](_0x17646e,function(_0x3469a2){if(_0x3469a2[_0x1126('0x3f')]!==_0x1126('0x40')){var _0x4faaa3={};_0x4faaa3[_0x3469a2[_0x1126('0x2b')]]={'$like':'%'+_0x583ce6[_0x1126('0x32')][_0x1126('0x41')]+'%'};return _0x4faaa3;}})});}_0x5f2611=_[_0x1126('0x3e')]({},_0x5f2611,_0x583ce6[_0x1126('0x42')]);var _0x518de1={'where':_0x5f2611['where']};return db[_0x1126('0x2e')][_0x1126('0x1f')](_0x518de1)[_0x1126('0x25')](function(_0x21c38e){_0x4a53ab[_0x1126('0x1f')]=_0x21c38e;if(_0x583ce6[_0x1126('0x32')]['includeAll']){_0x5f2611['include']=[{'all':!![]}];}return db['Disposition'][_0x1126('0x43')](_0x5f2611);})['then'](function(_0xf84005){_0x4a53ab[_0x1126('0x44')]=_0xf84005;return _0x4a53ab;})[_0x1126('0x25')](respondWithFilteredResult(_0x378f4d,_0x5f2611))[_0x1126('0x45')](handleError(_0x378f4d,null));};exports['show']=function(_0x4c94bb,_0x353042){var _0xa93167={'raw':!![],'where':{'id':_0x4c94bb['params']['id']}},_0x1d63b9={};_0x1d63b9[_0x1126('0x31')]=_['keys'](db[_0x1126('0x2e')]['rawAttributes']);_0x1d63b9[_0x1126('0x32')]=_[_0x1126('0x46')](_0x4c94bb[_0x1126('0x32')]);_0x1d63b9['filters']=_[_0x1126('0x34')](_0x1d63b9[_0x1126('0x31')],_0x1d63b9[_0x1126('0x32')]);_0xa93167['attributes']=_['intersection'](_0x1d63b9['model'],qs[_0x1126('0x36')](_0x4c94bb['query'][_0x1126('0x36')]));_0xa93167['attributes']=_0xa93167[_0x1126('0x35')][_0x1126('0x37')]?_0xa93167[_0x1126('0x35')]:_0x1d63b9[_0x1126('0x31')];if(_0x4c94bb[_0x1126('0x32')]['includeAll']){_0xa93167[_0x1126('0x47')]=[{'all':!![]}];}_0xa93167=_[_0x1126('0x3e')]({},_0xa93167,_0x4c94bb['options']);return db[_0x1126('0x2e')][_0x1126('0x48')](_0xa93167)['then'](handleEntityNotFound(_0x353042,null))[_0x1126('0x25')](respondWithResult(_0x353042,null))[_0x1126('0x45')](handleError(_0x353042,null));};exports['create']=function(_0x3e4eeb,_0xbdde58){return db[_0x1126('0x2e')]['create'](_0x3e4eeb[_0x1126('0x49')],{})[_0x1126('0x25')](function(_0x411c89){var _0x5878bb=_0x3e4eeb[_0x1126('0x4a')][_0x1126('0x26')]({'plain':!![]});if(!_0x5878bb)throw new Error(_0x1126('0x4b'));if(_0x5878bb[_0x1126('0x4c')]==='user'){var _0x1b8b83=_0x411c89['get']({'plain':!![]});var _0x40168e=_0x1126('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x40168e,'userProfileId':_0x5878bb[_0x1126('0x4d')]},'raw':!![]})[_0x1126('0x25')](function(_0x387fe1){if(_0x387fe1&&_0x387fe1['autoAssociation']===0x0){return db[_0x1126('0x28')][_0x1126('0x4e')]({'name':_0x1b8b83[_0x1126('0x2b')],'resourceId':_0x1b8b83['id'],'type':_0x387fe1[_0x1126('0x2b')],'sectionId':_0x387fe1['id']},{})['then'](function(){return _0x411c89;});}else{return _0x411c89;}})[_0x1126('0x45')](function(_0x46551f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x46551f);throw _0x46551f;});}return _0x411c89;})['then'](respondWithResult(_0xbdde58,0xc9))['catch'](handleError(_0xbdde58,null));};exports[_0x1126('0x24')]=function(_0x3bf090,_0x4dc8cd){if(_0x3bf090[_0x1126('0x49')]['id']){delete _0x3bf090[_0x1126('0x49')]['id'];}return db[_0x1126('0x2e')][_0x1126('0x48')]({'where':{'id':_0x3bf090[_0x1126('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4dc8cd,null))[_0x1126('0x25')](saveUpdates(_0x3bf090[_0x1126('0x49')],null))['then'](respondWithResult(_0x4dc8cd,null))[_0x1126('0x45')](handleError(_0x4dc8cd,null));};exports[_0x1126('0x29')]=function(_0xcc9499,_0x36b61){return db[_0x1126('0x2e')]['find']({'where':{'id':_0xcc9499[_0x1126('0x4f')]['id']}})['then'](handleEntityNotFound(_0x36b61,null))[_0x1126('0x25')](removeEntity(_0x36b61,null))[_0x1126('0x45')](handleError(_0x36b61,null));}; \ No newline at end of file +var _0x7df3=['fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','then','destroy','get','Dispositions','UserProfileResource','end','error','name','send','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL','filter','options','findAll','rows','catch','show','params','includeAll','include','Disposition','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','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x474b71,_0x49f4f7){var _0x2c3944=function(_0xa8b89){while(--_0xa8b89){_0x474b71['push'](_0x474b71['shift']());}};_0x2c3944(++_0x49f4f7);}(_0x7df3,0x19e));var _0x37df=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x7df3[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x37df('0x0'));var rimraf=require(_0x37df('0x1'));var zipdir=require(_0x37df('0x2'));var jsonpatch=require(_0x37df('0x3'));var rp=require(_0x37df('0x4'));var moment=require(_0x37df('0x5'));var BPromise=require(_0x37df('0x6'));var Mustache=require(_0x37df('0x7'));var util=require(_0x37df('0x8'));var path=require(_0x37df('0x9'));var sox=require(_0x37df('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x37df('0xb'));var _=require('lodash');var squel=require(_0x37df('0xc'));var crypto=require(_0x37df('0xd'));var jsforce=require(_0x37df('0xe'));var deskjs=require(_0x37df('0xf'));var toCsv=require('to-csv');var querystring=require(_0x37df('0x10'));var Papa=require('papaparse');var Redis=require(_0x37df('0x11'));var authService=require(_0x37df('0x12'));var qs=require(_0x37df('0x13'));var as=require(_0x37df('0x14'));var hardwareService=require(_0x37df('0x15'));var logger=require(_0x37df('0x16'))('api');var utils=require(_0x37df('0x17'));var config=require(_0x37df('0x18'));var licenseUtil=require(_0x37df('0x19'));var db=require(_0x37df('0x1a'))['db'];function respondWithStatusCode(_0x2ef9bb,_0x3de0cd){_0x3de0cd=_0x3de0cd||0xcc;return function(_0x3af1f5){if(_0x3af1f5){return _0x2ef9bb[_0x37df('0x1b')](_0x3de0cd);}return _0x2ef9bb['status'](_0x3de0cd)['end']();};}function respondWithResult(_0x4e5a7f,_0x4ed2c2){_0x4ed2c2=_0x4ed2c2||0xc8;return function(_0x3d7d93){if(_0x3d7d93){return _0x4e5a7f[_0x37df('0x1c')](_0x4ed2c2)['json'](_0x3d7d93);}};}function respondWithFilteredResult(_0x30f380,_0x5028cc){return function(_0x320031){if(_0x320031){var _0x87c28e=typeof _0x5028cc['offset']===_0x37df('0x1d')&&typeof _0x5028cc[_0x37df('0x1e')]===_0x37df('0x1d');var _0x437393=_0x320031[_0x37df('0x1f')];var _0x4aebd6=_0x87c28e?0x0:_0x5028cc[_0x37df('0x20')];var _0x277c08=_0x87c28e?_0x320031[_0x37df('0x1f')]:_0x5028cc[_0x37df('0x20')]+_0x5028cc[_0x37df('0x1e')];var _0x356e10;if(_0x277c08>=_0x437393){_0x277c08=_0x437393;_0x356e10=0xc8;}else{_0x356e10=0xce;}_0x30f380['status'](_0x356e10);return _0x30f380[_0x37df('0x21')](_0x37df('0x22'),_0x4aebd6+'-'+_0x277c08+'/'+_0x437393)[_0x37df('0x23')](_0x320031);}return null;};}function patchUpdates(_0xd1a394){return function(_0xd7683b){try{jsonpatch[_0x37df('0x24')](_0xd7683b,_0xd1a394,!![]);}catch(_0x5802b9){return BPromise['reject'](_0x5802b9);}return _0xd7683b[_0x37df('0x25')]();};}function saveUpdates(_0x9bffc,_0x17f6fa){return function(_0x27b938){if(_0x27b938){return _0x27b938['update'](_0x9bffc)[_0x37df('0x26')](function(_0x3282ef){return _0x3282ef;});}return null;};}function removeEntity(_0x1e8e55,_0x2c4f3d){return function(_0x163945){if(_0x163945){return _0x163945[_0x37df('0x27')]()[_0x37df('0x26')](function(){var _0x4f36b9=_0x163945[_0x37df('0x28')]({'plain':!![]});var _0x3f6c12=_0x37df('0x29');return db[_0x37df('0x2a')]['destroy']({'where':{'type':_0x3f6c12,'resourceId':_0x4f36b9['id']}})[_0x37df('0x26')](function(){return _0x163945;});})[_0x37df('0x26')](function(){_0x1e8e55[_0x37df('0x1c')](0xcc)[_0x37df('0x2b')]();});}};}function handleEntityNotFound(_0x232587,_0x552cc0){return function(_0x19642c){if(!_0x19642c){_0x232587[_0x37df('0x1b')](0x194);}return _0x19642c;};}function handleError(_0x45e884,_0x5ea2c3){_0x5ea2c3=_0x5ea2c3||0x1f4;return function(_0x37f2b3){logger[_0x37df('0x2c')](_0x37f2b3['stack']);if(_0x37f2b3[_0x37df('0x2d')]){delete _0x37f2b3[_0x37df('0x2d')];}_0x45e884['status'](_0x5ea2c3)[_0x37df('0x2e')](_0x37f2b3);};}exports['index']=function(_0xd194ba,_0x52df56){var _0x1bff5e={},_0x54112c={},_0xbdcca5={'count':0x0,'rows':[]};var _0x1f1749=_[_0x37df('0x2f')](db['Disposition']['rawAttributes'],function(_0x5c81b0){return{'name':_0x5c81b0[_0x37df('0x30')],'type':_0x5c81b0[_0x37df('0x31')]['key']};});_0x54112c[_0x37df('0x32')]=_['map'](_0x1f1749,'name');_0x54112c[_0x37df('0x33')]=_[_0x37df('0x34')](_0xd194ba['query']);_0x54112c[_0x37df('0x35')]=_[_0x37df('0x36')](_0x54112c[_0x37df('0x32')],_0x54112c[_0x37df('0x33')]);_0x1bff5e[_0x37df('0x37')]=_[_0x37df('0x36')](_0x54112c[_0x37df('0x32')],qs[_0x37df('0x38')](_0xd194ba[_0x37df('0x33')]['fields']));_0x1bff5e[_0x37df('0x37')]=_0x1bff5e[_0x37df('0x37')][_0x37df('0x39')]?_0x1bff5e[_0x37df('0x37')]:_0x54112c[_0x37df('0x32')];if(!_0xd194ba[_0x37df('0x33')][_0x37df('0x3a')](_0x37df('0x3b'))){_0x1bff5e['limit']=qs[_0x37df('0x1e')](_0xd194ba['query']['limit']);_0x1bff5e[_0x37df('0x20')]=qs[_0x37df('0x20')](_0xd194ba[_0x37df('0x33')][_0x37df('0x20')]);}_0x1bff5e['order']=qs[_0x37df('0x3c')](_0xd194ba['query'][_0x37df('0x3c')]);_0x1bff5e['where']=qs[_0x37df('0x35')](_[_0x37df('0x3d')](_0xd194ba[_0x37df('0x33')],_0x54112c[_0x37df('0x35')]),_0x1f1749);if(_0xd194ba[_0x37df('0x33')]['filter']){_0x1bff5e['where']=_[_0x37df('0x3e')](_0x1bff5e[_0x37df('0x3f')],{'$or':_[_0x37df('0x2f')](_0x1f1749,function(_0x58985b){if(_0x58985b['type']!==_0x37df('0x40')){var _0x5c95f7={};_0x5c95f7[_0x58985b[_0x37df('0x2d')]]={'$like':'%'+_0xd194ba[_0x37df('0x33')][_0x37df('0x41')]+'%'};return _0x5c95f7;}})});}_0x1bff5e=_[_0x37df('0x3e')]({},_0x1bff5e,_0xd194ba[_0x37df('0x42')]);var _0x9e4797={'where':_0x1bff5e[_0x37df('0x3f')]};return db['Disposition'][_0x37df('0x1f')](_0x9e4797)[_0x37df('0x26')](function(_0x3b2343){_0xbdcca5[_0x37df('0x1f')]=_0x3b2343;if(_0xd194ba[_0x37df('0x33')]['includeAll']){_0x1bff5e['include']=[{'all':!![]}];}return db['Disposition'][_0x37df('0x43')](_0x1bff5e);})[_0x37df('0x26')](function(_0x2787b1){_0xbdcca5[_0x37df('0x44')]=_0x2787b1;return _0xbdcca5;})[_0x37df('0x26')](respondWithFilteredResult(_0x52df56,_0x1bff5e))[_0x37df('0x45')](handleError(_0x52df56,null));};exports[_0x37df('0x46')]=function(_0x2277ac,_0x28f2cd){var _0x2d96cb={'raw':!![],'where':{'id':_0x2277ac[_0x37df('0x47')]['id']}},_0x303487={};_0x303487[_0x37df('0x32')]=_[_0x37df('0x34')](db['Disposition']['rawAttributes']);_0x303487[_0x37df('0x33')]=_['keys'](_0x2277ac[_0x37df('0x33')]);_0x303487[_0x37df('0x35')]=_[_0x37df('0x36')](_0x303487['model'],_0x303487[_0x37df('0x33')]);_0x2d96cb[_0x37df('0x37')]=_[_0x37df('0x36')](_0x303487[_0x37df('0x32')],qs[_0x37df('0x38')](_0x2277ac[_0x37df('0x33')][_0x37df('0x38')]));_0x2d96cb[_0x37df('0x37')]=_0x2d96cb[_0x37df('0x37')]['length']?_0x2d96cb['attributes']:_0x303487[_0x37df('0x32')];if(_0x2277ac[_0x37df('0x33')][_0x37df('0x48')]){_0x2d96cb[_0x37df('0x49')]=[{'all':!![]}];}_0x2d96cb=_[_0x37df('0x3e')]({},_0x2d96cb,_0x2277ac[_0x37df('0x42')]);return db[_0x37df('0x4a')][_0x37df('0x4b')](_0x2d96cb)[_0x37df('0x26')](handleEntityNotFound(_0x28f2cd,null))['then'](respondWithResult(_0x28f2cd,null))[_0x37df('0x45')](handleError(_0x28f2cd,null));};exports[_0x37df('0x4c')]=function(_0x507e17,_0xfa4179){return db[_0x37df('0x4a')]['create'](_0x507e17[_0x37df('0x4d')],{})[_0x37df('0x26')](function(_0x2df84f){var _0x56ff9b=_0x507e17[_0x37df('0x4e')][_0x37df('0x28')]({'plain':!![]});if(!_0x56ff9b)throw new Error(_0x37df('0x4f'));if(_0x56ff9b[_0x37df('0x50')]===_0x37df('0x4e')){var _0x3e328f=_0x2df84f[_0x37df('0x28')]({'plain':!![]});var _0x5278f6='Dispositions';return db[_0x37df('0x51')]['find']({'where':{'name':_0x5278f6,'userProfileId':_0x56ff9b['userProfileId']},'raw':!![]})['then'](function(_0x12d45b){if(_0x12d45b&&_0x12d45b[_0x37df('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x3e328f['name'],'resourceId':_0x3e328f['id'],'type':_0x12d45b[_0x37df('0x2d')],'sectionId':_0x12d45b['id']},{})['then'](function(){return _0x2df84f;});}else{return _0x2df84f;}})[_0x37df('0x45')](function(_0x5536e3){logger[_0x37df('0x2c')](_0x37df('0x53'),_0x5536e3);throw _0x5536e3;});}return _0x2df84f;})[_0x37df('0x26')](respondWithResult(_0xfa4179,0xc9))['catch'](handleError(_0xfa4179,null));};exports[_0x37df('0x54')]=function(_0x2beb9d,_0x24cfb9){if(_0x2beb9d['body']['id']){delete _0x2beb9d[_0x37df('0x4d')]['id'];}return db[_0x37df('0x4a')]['find']({'where':{'id':_0x2beb9d[_0x37df('0x47')]['id']}})[_0x37df('0x26')](handleEntityNotFound(_0x24cfb9,null))['then'](saveUpdates(_0x2beb9d['body'],null))[_0x37df('0x26')](respondWithResult(_0x24cfb9,null))[_0x37df('0x45')](handleError(_0x24cfb9,null));};exports['destroy']=function(_0x13de8a,_0x194218){return db[_0x37df('0x4a')][_0x37df('0x4b')]({'where':{'id':_0x13de8a['params']['id']}})[_0x37df('0x26')](handleEntityNotFound(_0x194218,null))[_0x37df('0x26')](removeEntity(_0x194218,null))[_0x37df('0x45')](handleError(_0x194218,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 70c2968..5924897 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 _0xcba8=['lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','tools_dispositions','name_voice','ListId','name_chat','name','ChatWebsiteId','name_mail','MailAccountId','name_sms','FaxAccountId','OpenchannelAccountId','WhatsappAccountId'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xcba8,0x14a));var _0x8cba=function(_0x1c3407,_0x537574){_0x1c3407=_0x1c3407-0x0;var _0x158fa9=_0xcba8[_0x1c3407];return _0x158fa9;};'use strict';var _=require(_0x8cba('0x0'));var util=require(_0x8cba('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8cba('0x2'));var rp=require(_0x8cba('0x3'));var fs=require('fs');var path=require(_0x8cba('0x4'));var rimraf=require(_0x8cba('0x5'));var config=require(_0x8cba('0x6'));var attributes=require(_0x8cba('0x7'));module[_0x8cba('0x8')]=function(_0xa2bc6d,_0x1615c1){return _0xa2bc6d[_0x8cba('0x9')]('Disposition',attributes,{'tableName':_0x8cba('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x8cba('0xb'),'fields':['name',_0x8cba('0xc')]},{'unique':!![],'name':_0x8cba('0xd'),'fields':[_0x8cba('0xe'),_0x8cba('0xf')]},{'unique':!![],'name':_0x8cba('0x10'),'fields':[_0x8cba('0xe'),_0x8cba('0x11')]},{'unique':!![],'name':_0x8cba('0x12'),'fields':[_0x8cba('0xe'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':[_0x8cba('0xe'),_0x8cba('0x13')]},{'unique':!![],'name':'name_openchannel','fields':[_0x8cba('0xe'),_0x8cba('0x14')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x8cba('0xe'),_0x8cba('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x64e4=['name_whatsapp','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./disposition.attributes','define','Disposition','tools_dispositions','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_fax','OpenchannelAccountId'];(function(_0x91384,_0x545eef){var _0x44daa0=function(_0x5a0cc5){while(--_0x5a0cc5){_0x91384['push'](_0x91384['shift']());}};_0x44daa0(++_0x545eef);}(_0x64e4,0x166));var _0x464e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x64e4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x464e('0x0'));var util=require('util');var logger=require(_0x464e('0x1'))(_0x464e('0x2'));var moment=require(_0x464e('0x3'));var BPromise=require(_0x464e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x464e('0x5'));var rimraf=require(_0x464e('0x6'));var config=require(_0x464e('0x7'));var attributes=require(_0x464e('0x8'));module['exports']=function(_0x2e7595,_0x4c0e90){return _0x2e7595[_0x464e('0x9')](_0x464e('0xa'),attributes,{'tableName':_0x464e('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x464e('0xc'),_0x464e('0xd')]},{'unique':!![],'name':_0x464e('0xe'),'fields':['name',_0x464e('0xf')]},{'unique':!![],'name':_0x464e('0x10'),'fields':[_0x464e('0xc'),_0x464e('0x11')]},{'unique':!![],'name':'name_sms','fields':[_0x464e('0xc'),'SmsAccountId']},{'unique':!![],'name':_0x464e('0x12'),'fields':[_0x464e('0xc'),'FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':[_0x464e('0xc'),_0x464e('0x13')]},{'unique':!![],'name':_0x464e('0x14'),'fields':[_0x464e('0xc'),'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 cd8d214..656672c 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(_0x576a76,_0x4fe96a){var _0x5367b3=function(_0x2d1bb9){while(--_0x2d1bb9){_0x576a76['push'](_0x576a76['shift']());}};_0x5367b3(++_0x4fe96a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0x2a1462,_0x928a16){var _0x5064fb=function(_0x54c30e){while(--_0x54c30e){_0x2a1462['push'](_0x2a1462['shift']());}};_0x5064fb(++_0x928a16);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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 ac96fe6..678b52b 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 _0xaaa4=['../../config/environment','./disposition.controller','get','isAuthenticated','/:id','post','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x305c31,_0x466b17){var _0x17f39f=function(_0x53ae03){while(--_0x53ae03){_0x305c31['push'](_0x305c31['shift']());}};_0x17f39f(++_0x466b17);}(_0xaaa4,0xc5));var _0x4aaa=function(_0x1392d5,_0x19c9ab){_0x1392d5=_0x1392d5-0x0;var _0x3c0eb6=_0xaaa4[_0x1392d5];return _0x3c0eb6;};'use strict';var multer=require('multer');var util=require(_0x4aaa('0x0'));var path=require(_0x4aaa('0x1'));var timeout=require(_0x4aaa('0x2'));var express=require(_0x4aaa('0x3'));var router=express[_0x4aaa('0x4')]();var fs_extra=require(_0x4aaa('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4aaa('0x6'));var config=require(_0x4aaa('0x7'));var controller=require(_0x4aaa('0x8'));router[_0x4aaa('0x9')]('/',auth[_0x4aaa('0xa')](),controller['index']);router['get'](_0x4aaa('0xb'),auth[_0x4aaa('0xa')](),controller['show']);router[_0x4aaa('0xc')]('/',auth[_0x4aaa('0xa')](),controller['create']);router[_0x4aaa('0xd')](_0x4aaa('0xb'),auth['isAuthenticated'](),controller[_0x4aaa('0xe')]);router[_0x4aaa('0xf')]('/:id',auth[_0x4aaa('0xa')](),controller[_0x4aaa('0x10')]);module['exports']=router; \ No newline at end of file +var _0x9f59=['Router','../../components/auth/service','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','exports','path','connect-timeout','express'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9f59,0xcd));var _0x99f5=function(_0x2da9ff,_0x4e2994){_0x2da9ff=_0x2da9ff-0x0;var _0x2fa276=_0x9f59[_0x2da9ff];return _0x2fa276;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x99f5('0x0'));var timeout=require(_0x99f5('0x1'));var express=require(_0x99f5('0x2'));var router=express[_0x99f5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x99f5('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x99f5('0x5'));router[_0x99f5('0x6')]('/',auth[_0x99f5('0x7')](),controller[_0x99f5('0x8')]);router[_0x99f5('0x6')](_0x99f5('0x9'),auth[_0x99f5('0x7')](),controller[_0x99f5('0xa')]);router[_0x99f5('0xb')]('/',auth['isAuthenticated'](),controller[_0x99f5('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x99f5('0xd')]);router[_0x99f5('0xe')](_0x99f5('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x99f5('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 6ec1fb2..2d72833 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 _0xd75b=['2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','ENUM','yes','STRING','xCALLY\x20Motion\x20Fax','localstationid'];(function(_0x4145ec,_0x5379e8){var _0x4a369f=function(_0x515c55){while(--_0x515c55){_0x4145ec['push'](_0x4145ec['shift']());}};_0x4a369f(++_0x5379e8);}(_0xd75b,0x95));var _0xbd75=function(_0x4a3bf1,_0xec8369){_0x4a3bf1=_0x4a3bf1-0x0;var _0xf5e0f1=_0xd75b[_0x4a3bf1];return _0xf5e0f1;};'use strict';var Sequelize=require(_0xbd75('0x0'));module[_0xbd75('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xbd75('0x2')](_0xbd75('0x3'),'no'),'defaultValue':_0xbd75('0x3')},'headerinfo':{'type':Sequelize[_0xbd75('0x4')],'defaultValue':_0xbd75('0x5')},'localstationid':{'type':Sequelize[_0xbd75('0x4')],'unique':_0xbd75('0x6')},'minrate':{'type':Sequelize[_0xbd75('0x2')](_0xbd75('0x7'),_0xbd75('0x8'),_0xbd75('0x9'),_0xbd75('0xa'),_0xbd75('0xb'),_0xbd75('0xc')),'defaultValue':_0xbd75('0x8')},'maxrate':{'type':Sequelize[_0xbd75('0x2')]('2400',_0xbd75('0x8'),'7200',_0xbd75('0xa'),'12000','14400'),'defaultValue':_0xbd75('0xc')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xbd75('0xd')},'gateway':{'type':Sequelize[_0xbd75('0x4')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xbd75('0x4')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xbd75('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xbd75('0x2')](_0xbd75('0xf'),_0xbd75('0x10'),_0xbd75('0x11'),_0xbd75('0x12')),'defaultValue':_0xbd75('0xf')},'key':{'type':Sequelize[_0xbd75('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xbd75('0x13')],'defaultValue':function(){return _0xbd75('0x14');}},'notificationSound':{'type':Sequelize[_0xbd75('0x15')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbd75('0x15')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbd75('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbd75('0x15')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbd75('0x15')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbd75('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbd75('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0xbd75('0x16')},'mandatoryDisposition':{'type':Sequelize[_0xbd75('0x15')],'defaultValue':![],'comment':_0xbd75('0x17'),'set':function(_0x40b93d){if(!_0x40b93d)this[_0xbd75('0x18')](_0xbd75('0x19'),null);this[_0xbd75('0x18')]('mandatoryDisposition',_0x40b93d);}}}; \ No newline at end of file +var _0xe154=['STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','12000','14400','9600','v17,v27,v29','INTEGER','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports'];(function(_0x402723,_0xe826c1){var _0x1137b2=function(_0x382e5e){while(--_0x382e5e){_0x402723['push'](_0x402723['shift']());}};_0x1137b2(++_0xe826c1);}(_0xe154,0xee));var _0x4e15=function(_0x462999,_0x24d200){_0x462999=_0x462999-0x0;var _0x4b1366=_0xe154[_0x462999];return _0x4b1366;};'use strict';var Sequelize=require(_0x4e15('0x0'));module[_0x4e15('0x1')]={'name':{'type':Sequelize[_0x4e15('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4e15('0x2')]},'ecm':{'type':Sequelize[_0x4e15('0x3')](_0x4e15('0x4'),'no'),'defaultValue':_0x4e15('0x4')},'headerinfo':{'type':Sequelize[_0x4e15('0x2')],'defaultValue':_0x4e15('0x5')},'localstationid':{'type':Sequelize[_0x4e15('0x2')],'unique':_0x4e15('0x6')},'minrate':{'type':Sequelize[_0x4e15('0x3')](_0x4e15('0x7'),_0x4e15('0x8'),'7200','9600',_0x4e15('0x9'),_0x4e15('0xa')),'defaultValue':_0x4e15('0x8')},'maxrate':{'type':Sequelize[_0x4e15('0x3')]('2400','4800','7200',_0x4e15('0xb'),'12000','14400'),'defaultValue':_0x4e15('0xa')},'modem':{'type':Sequelize[_0x4e15('0x2')],'defaultValue':_0x4e15('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x4e15('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x4e15('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x4e15('0x3')](_0x4e15('0xe'),_0x4e15('0xf'),_0x4e15('0x10'),'KHOMP'),'defaultValue':_0x4e15('0xe')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4e15('0x11')],'defaultValue':function(){return _0x4e15('0x12');}},'notificationSound':{'type':Sequelize[_0x4e15('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4e15('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4e15('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4e15('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4e15('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4e15('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4e15('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x4e15('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x4e15('0x13')],'defaultValue':![],'comment':_0x4e15('0x15'),'set':function(_0xf6bc25){if(!_0xf6bc25)this[_0x4e15('0x16')](_0x4e15('0x17'),null);this[_0x4e15('0x16')]('mandatoryDisposition',_0xf6bc25);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 204ecf0..4b1a1c1 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 _0xba67=['FaxAccount','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','Pause','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','getInteractions','CmContact','Contact','User','Owner','internal','Tag','Tags','color','tag','sequelize','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','description','Fax\x20Extension','appdata','CDR(type)=inbound-fax','gateway','headerinfo','modem','FAXOPT(','Set','Wait','push','addAccountApplications','VoiceExtension','updateAccountApplications','transaction','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','root','CheckAfterSend','isNil','path','from','format','\x22%s\x22\x20<%s>','List\x20not\x20found','out','Messages','Contact\x20not\x20found','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','omit','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','http','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','FaxAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','get','FaxAccounts','UserProfileResource','name','send','index','mandatoryDispositionPause'];(function(_0x4697d6,_0x520a33){var _0x371c60=function(_0x222821){while(--_0x222821){_0x4697d6['push'](_0x4697d6['shift']());}};_0x371c60(++_0x520a33);}(_0xba67,0x144));var _0x7ba6=function(_0x3f69c3,_0x40d419){_0x3f69c3=_0x3f69c3-0x0;var _0xb443de=_0xba67[_0x3f69c3];return _0xb443de;};'use strict';var emlformat=require(_0x7ba6('0x0'));var rimraf=require(_0x7ba6('0x1'));var zipdir=require(_0x7ba6('0x2'));var jsonpatch=require(_0x7ba6('0x3'));var rp=require(_0x7ba6('0x4'));var moment=require('moment');var BPromise=require(_0x7ba6('0x5'));var Mustache=require(_0x7ba6('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x7ba6('0x7'));var ejs=require(_0x7ba6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7ba6('0x9'));var crypto=require(_0x7ba6('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7ba6('0xb'));var toCsv=require('to-csv');var querystring=require(_0x7ba6('0xc'));var Papa=require(_0x7ba6('0xd'));var Redis=require(_0x7ba6('0xe'));var authService=require(_0x7ba6('0xf'));var qs=require(_0x7ba6('0x10'));var as=require(_0x7ba6('0x11'));var hardwareService=require(_0x7ba6('0x12'));var logger=require('../../config/logger')(_0x7ba6('0x13'));var utils=require(_0x7ba6('0x14'));var config=require(_0x7ba6('0x15'));var licenseUtil=require(_0x7ba6('0x16'));var db=require(_0x7ba6('0x17'))['db'];config[_0x7ba6('0x18')]=_[_0x7ba6('0x19')](config[_0x7ba6('0x18')],{'host':_0x7ba6('0x1a'),'port':0x18eb});var socket=require(_0x7ba6('0x1b'))(new Redis(config['redis']));require(_0x7ba6('0x1c'))[_0x7ba6('0x1d')](socket);var jayson=require(_0x7ba6('0x1e'));var client=jayson['client'][_0x7ba6('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x7ba6('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x12404a,_0x364002,_0x369f08,_0x55fa58){return new BPromise(function(_0x5e8021,_0x5869be){var _0x1a9167=_0x55fa58||client;return _0x1a9167[_0x7ba6('0x20')](_0x12404a,_0x369f08)[_0x7ba6('0x21')](function(_0x1d2a7c){logger[_0x7ba6('0x22')]('FaxAccount,\x20%s,\x20%s',_0x364002,_0x7ba6('0x23'));logger[_0x7ba6('0x24')](_0x7ba6('0x25'),_0x364002,_0x7ba6('0x23'),JSON[_0x7ba6('0x26')](_0x1d2a7c));if(_0x1d2a7c[_0x7ba6('0x27')]){if(_0x1d2a7c['error']['code']===0x1f4){logger[_0x7ba6('0x27')](_0x7ba6('0x28'),_0x364002,_0x1d2a7c[_0x7ba6('0x27')][_0x7ba6('0x29')]);return _0x5869be(_0x1d2a7c['error']['message']);}logger[_0x7ba6('0x27')](_0x7ba6('0x28'),_0x364002,_0x1d2a7c[_0x7ba6('0x27')][_0x7ba6('0x29')]);return _0x5e8021(_0x1d2a7c[_0x7ba6('0x27')]['message']);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x364002,_0x7ba6('0x23'));_0x5e8021(_0x1d2a7c[_0x7ba6('0x2a')]['message']);}})['catch'](function(_0x324810){logger[_0x7ba6('0x27')](_0x7ba6('0x28'),_0x364002,_0x324810);_0x5869be(_0x324810);});});}function respondWithStatusCode(_0x485bb4,_0x39fb34){_0x39fb34=_0x39fb34||0xcc;return function(_0x4316fd){if(_0x4316fd){return _0x485bb4[_0x7ba6('0x2b')](_0x39fb34);}return _0x485bb4[_0x7ba6('0x2c')](_0x39fb34)[_0x7ba6('0x2d')]();};}function respondWithResult(_0x34863b,_0x35ff93){_0x35ff93=_0x35ff93||0xc8;return function(_0x530569){if(_0x530569){return _0x34863b[_0x7ba6('0x2c')](_0x35ff93)[_0x7ba6('0x2e')](_0x530569);}};}function respondWithFilteredResult(_0x1326d0,_0x39541d){return function(_0x443fbe){if(_0x443fbe){var _0xff6bb5=typeof _0x39541d[_0x7ba6('0x2f')]==='undefined'&&typeof _0x39541d[_0x7ba6('0x30')]===_0x7ba6('0x31');var _0x3c2b16=_0x443fbe[_0x7ba6('0x32')];var _0x3e643f=_0xff6bb5?0x0:_0x39541d[_0x7ba6('0x2f')];var _0x3292d7=_0xff6bb5?_0x443fbe['count']:_0x39541d['offset']+_0x39541d[_0x7ba6('0x30')];var _0x2817c4;if(_0x3292d7>=_0x3c2b16){_0x3292d7=_0x3c2b16;_0x2817c4=0xc8;}else{_0x2817c4=0xce;}_0x1326d0['status'](_0x2817c4);return _0x1326d0[_0x7ba6('0x33')](_0x7ba6('0x34'),_0x3e643f+'-'+_0x3292d7+'/'+_0x3c2b16)[_0x7ba6('0x2e')](_0x443fbe);}return null;};}function patchUpdates(_0x10a012){return function(_0x355123){try{jsonpatch[_0x7ba6('0x35')](_0x355123,_0x10a012,!![]);}catch(_0x1580dd){return BPromise[_0x7ba6('0x36')](_0x1580dd);}return _0x355123[_0x7ba6('0x37')]();};}function saveUpdates(_0x3d397c,_0x404c3c){return function(_0x11d72b){if(_0x11d72b){return _0x11d72b['update'](_0x3d397c)[_0x7ba6('0x21')](function(_0x516c3b){return _0x516c3b;});}return null;};}function removeEntity(_0x4e6f13,_0x4c8823){return function(_0x1eca29){if(_0x1eca29){return _0x1eca29[_0x7ba6('0x38')]()[_0x7ba6('0x21')](function(){var _0x159713=_0x1eca29[_0x7ba6('0x39')]({'plain':!![]});var _0x1d7d72=_0x7ba6('0x3a');return db[_0x7ba6('0x3b')]['destroy']({'where':{'type':_0x1d7d72,'resourceId':_0x159713['id']}})[_0x7ba6('0x21')](function(){return _0x1eca29;});})['then'](function(){_0x4e6f13[_0x7ba6('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x267b44,_0x3ee19f){return function(_0x49b76d){if(!_0x49b76d){_0x267b44[_0x7ba6('0x2b')](0x194);}return _0x49b76d;};}function handleError(_0x5df080,_0x5d9caf){_0x5d9caf=_0x5d9caf||0x1f4;return function(_0x38eabe){logger[_0x7ba6('0x27')](_0x38eabe['stack']);if(_0x38eabe['name']){delete _0x38eabe[_0x7ba6('0x3c')];}_0x5df080[_0x7ba6('0x2c')](_0x5d9caf)[_0x7ba6('0x3d')](_0x38eabe);};}exports[_0x7ba6('0x3e')]=function(_0x4f6a71,_0xa7230e){var _0x17b6f1={'include':[{'model':db['Pause'],'as':_0x7ba6('0x3f')}]},_0x175aff={},_0x14b3cb={'count':0x0,'rows':[]};var _0x316a8c=_['map'](db[_0x7ba6('0x40')][_0x7ba6('0x41')],function(_0x22e35f){return{'name':_0x22e35f[_0x7ba6('0x42')],'type':_0x22e35f[_0x7ba6('0x43')][_0x7ba6('0x44')]};});_0x175aff[_0x7ba6('0x45')]=_[_0x7ba6('0x46')](_0x316a8c,_0x7ba6('0x3c'));_0x175aff['query']=_['keys'](_0x4f6a71[_0x7ba6('0x47')]);_0x175aff[_0x7ba6('0x48')]=_['intersection'](_0x175aff['model'],_0x175aff[_0x7ba6('0x47')]);_0x17b6f1[_0x7ba6('0x49')]=_[_0x7ba6('0x4a')](_0x175aff[_0x7ba6('0x45')],qs['fields'](_0x4f6a71[_0x7ba6('0x47')][_0x7ba6('0x4b')]));_0x17b6f1['attributes']=_0x17b6f1['attributes'][_0x7ba6('0x4c')]?_0x17b6f1[_0x7ba6('0x49')]:_0x175aff[_0x7ba6('0x45')];if(!_0x4f6a71[_0x7ba6('0x47')][_0x7ba6('0x4d')](_0x7ba6('0x4e'))){_0x17b6f1['limit']=qs[_0x7ba6('0x30')](_0x4f6a71[_0x7ba6('0x47')][_0x7ba6('0x30')]);_0x17b6f1[_0x7ba6('0x2f')]=qs[_0x7ba6('0x2f')](_0x4f6a71[_0x7ba6('0x47')][_0x7ba6('0x2f')]);}_0x17b6f1[_0x7ba6('0x4f')]=qs[_0x7ba6('0x50')](_0x4f6a71['query'][_0x7ba6('0x50')]);_0x17b6f1['where']=qs['filters'](_[_0x7ba6('0x51')](_0x4f6a71[_0x7ba6('0x47')],_0x175aff['filters']),_0x316a8c);if(_0x4f6a71['query'][_0x7ba6('0x52')]){_0x17b6f1[_0x7ba6('0x53')]=_[_0x7ba6('0x54')](_0x17b6f1[_0x7ba6('0x53')],{'$or':_[_0x7ba6('0x46')](_0x316a8c,function(_0xc221f6){if(_0xc221f6['type']!==_0x7ba6('0x55')){var _0x36ec22={};_0x36ec22[_0xc221f6[_0x7ba6('0x3c')]]={'$like':'%'+_0x4f6a71['query'][_0x7ba6('0x52')]+'%'};return _0x36ec22;}})});}_0x17b6f1=_[_0x7ba6('0x54')]({},_0x17b6f1,_0x4f6a71[_0x7ba6('0x56')]);var _0x4f3643={'where':_0x17b6f1[_0x7ba6('0x53')]};return db[_0x7ba6('0x40')][_0x7ba6('0x32')](_0x4f3643)[_0x7ba6('0x21')](function(_0x14e072){_0x14b3cb['count']=_0x14e072;if(_0x4f6a71[_0x7ba6('0x47')]['includeAll']){_0x17b6f1[_0x7ba6('0x57')]=[{'all':!![]}];}return db[_0x7ba6('0x40')][_0x7ba6('0x58')](_0x17b6f1);})[_0x7ba6('0x21')](function(_0x5adb83){_0x14b3cb[_0x7ba6('0x59')]=_0x5adb83;return _0x14b3cb;})['then'](respondWithFilteredResult(_0xa7230e,_0x17b6f1))[_0x7ba6('0x5a')](handleError(_0xa7230e,null));};exports[_0x7ba6('0x5b')]=function(_0x14eeab,_0x1adbac){var _0x4c879c={'raw':![],'where':{'id':_0x14eeab[_0x7ba6('0x5c')]['id']},'include':[{'model':db[_0x7ba6('0x5d')],'as':_0x7ba6('0x3f')}]},_0x40f1bc={};_0x40f1bc[_0x7ba6('0x45')]=_[_0x7ba6('0x5e')](db[_0x7ba6('0x40')][_0x7ba6('0x41')]);_0x40f1bc[_0x7ba6('0x47')]=_[_0x7ba6('0x5e')](_0x14eeab[_0x7ba6('0x47')]);_0x40f1bc[_0x7ba6('0x48')]=_[_0x7ba6('0x4a')](_0x40f1bc[_0x7ba6('0x45')],_0x40f1bc['query']);_0x4c879c[_0x7ba6('0x49')]=_[_0x7ba6('0x4a')](_0x40f1bc[_0x7ba6('0x45')],qs[_0x7ba6('0x4b')](_0x14eeab[_0x7ba6('0x47')][_0x7ba6('0x4b')]));_0x4c879c['attributes']=_0x4c879c[_0x7ba6('0x49')]['length']?_0x4c879c[_0x7ba6('0x49')]:_0x40f1bc[_0x7ba6('0x45')];if(_0x14eeab['query'][_0x7ba6('0x5f')]){_0x4c879c[_0x7ba6('0x57')]=[{'all':!![]}];}_0x4c879c=_[_0x7ba6('0x54')]({},_0x4c879c,_0x14eeab[_0x7ba6('0x56')]);return db[_0x7ba6('0x40')][_0x7ba6('0x60')](_0x4c879c)[_0x7ba6('0x21')](handleEntityNotFound(_0x1adbac,null))[_0x7ba6('0x21')](respondWithResult(_0x1adbac,null))['catch'](handleError(_0x1adbac,null));};exports[_0x7ba6('0x61')]=function(_0x1cbf17,_0x3878ea){return db[_0x7ba6('0x40')][_0x7ba6('0x61')](_0x1cbf17[_0x7ba6('0x62')],{})[_0x7ba6('0x21')](function(_0x47de86){var _0x2b72c7=_0x1cbf17[_0x7ba6('0x63')][_0x7ba6('0x39')]({'plain':!![]});if(!_0x2b72c7)throw new Error(_0x7ba6('0x64'));if(_0x2b72c7[_0x7ba6('0x65')]===_0x7ba6('0x63')){var _0x20414a=_0x47de86['get']({'plain':!![]});var _0x133ddf=_0x7ba6('0x3a');return db[_0x7ba6('0x66')][_0x7ba6('0x60')]({'where':{'name':_0x133ddf,'userProfileId':_0x2b72c7[_0x7ba6('0x67')]},'raw':!![]})['then'](function(_0x441c29){if(_0x441c29&&_0x441c29[_0x7ba6('0x68')]===0x0){return db[_0x7ba6('0x3b')]['create']({'name':_0x20414a[_0x7ba6('0x3c')],'resourceId':_0x20414a['id'],'type':_0x441c29[_0x7ba6('0x3c')],'sectionId':_0x441c29['id']},{})[_0x7ba6('0x21')](function(){return _0x47de86;});}else{return _0x47de86;}})['catch'](function(_0x18c66b){logger[_0x7ba6('0x27')](_0x7ba6('0x69'),_0x18c66b);throw _0x18c66b;});}return _0x47de86;})[_0x7ba6('0x21')](respondWithResult(_0x3878ea,0xc9))[_0x7ba6('0x5a')](handleError(_0x3878ea,null));};exports[_0x7ba6('0x6a')]=function(_0x6d952e,_0xe71676){if(_0x6d952e[_0x7ba6('0x62')]['id']){delete _0x6d952e[_0x7ba6('0x62')]['id'];}return db['FaxAccount'][_0x7ba6('0x60')]({'where':{'id':_0x6d952e['params']['id']},'include':[{'model':db['Pause'],'as':_0x7ba6('0x3f')}]})[_0x7ba6('0x21')](handleEntityNotFound(_0xe71676,null))['then'](saveUpdates(_0x6d952e[_0x7ba6('0x62')],null))[_0x7ba6('0x21')](respondWithResult(_0xe71676,null))[_0x7ba6('0x5a')](handleError(_0xe71676,null));};exports[_0x7ba6('0x38')]=function(_0x1894ed,_0x305a4a){return db[_0x7ba6('0x40')]['find']({'where':{'id':_0x1894ed[_0x7ba6('0x5c')]['id']}})[_0x7ba6('0x21')](handleEntityNotFound(_0x305a4a,null))[_0x7ba6('0x21')](removeEntity(_0x305a4a,null))['catch'](handleError(_0x305a4a,null));};exports[_0x7ba6('0x6b')]=function(_0x35f43e,_0x3b7ea6){return db[_0x7ba6('0x40')][_0x7ba6('0x6b')]()[_0x7ba6('0x21')](respondWithResult(_0x3b7ea6,null))[_0x7ba6('0x5a')](handleError(_0x3b7ea6,null));};exports[_0x7ba6('0x6c')]=function(_0x3ef0a2,_0x1783a3,_0x29212d){if(_0x3ef0a2['body']['id']){delete _0x3ef0a2['body']['id'];}return db[_0x7ba6('0x40')][_0x7ba6('0x60')]({'where':{'id':_0x3ef0a2[_0x7ba6('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1783a3,null))[_0x7ba6('0x21')](function(_0x24d953){if(_0x24d953){_0x3ef0a2[_0x7ba6('0x62')][_0x7ba6('0x6d')]=_0x24d953['id'];return db[_0x7ba6('0x6e')][_0x7ba6('0x61')](_0x3ef0a2['body']);}})['then'](respondWithResult(_0x1783a3,null))[_0x7ba6('0x5a')](handleError(_0x1783a3,null));};exports[_0x7ba6('0x6f')]=function(_0x42a8c5,_0x10e385,_0x421879){var _0x31e4ec={'raw':![],'where':{}};var _0x280695={};var _0x10ee8f={'count':0x0,'rows':[]};return db[_0x7ba6('0x40')][_0x7ba6('0x70')]({'where':{'id':_0x42a8c5[_0x7ba6('0x5c')]['id']}})['then'](handleEntityNotFound(_0x10e385,null))[_0x7ba6('0x21')](function(_0x5261db){if(_0x5261db){_0x280695[_0x7ba6('0x45')]=_['keys'](db[_0x7ba6('0x6e')][_0x7ba6('0x41')]);_0x280695[_0x7ba6('0x47')]=_[_0x7ba6('0x5e')](_0x42a8c5['query']);_0x280695[_0x7ba6('0x48')]=_[_0x7ba6('0x4a')](_0x280695[_0x7ba6('0x45')],_0x280695['query']);_0x31e4ec['attributes']=_[_0x7ba6('0x4a')](_0x280695['model'],qs[_0x7ba6('0x4b')](_0x42a8c5['query'][_0x7ba6('0x4b')]));_0x31e4ec[_0x7ba6('0x49')]=_0x31e4ec[_0x7ba6('0x49')]['length']?_0x31e4ec[_0x7ba6('0x49')]:_0x280695[_0x7ba6('0x45')];if(!_0x42a8c5['query'][_0x7ba6('0x4d')](_0x7ba6('0x4e'))){_0x31e4ec[_0x7ba6('0x30')]=qs[_0x7ba6('0x30')](_0x42a8c5['query']['limit']);_0x31e4ec['offset']=qs[_0x7ba6('0x2f')](_0x42a8c5[_0x7ba6('0x47')][_0x7ba6('0x2f')]);}_0x31e4ec[_0x7ba6('0x4f')]=qs[_0x7ba6('0x50')](_0x42a8c5[_0x7ba6('0x47')]['sort']);_0x31e4ec[_0x7ba6('0x53')]=qs['filters'](_[_0x7ba6('0x51')](_0x42a8c5[_0x7ba6('0x47')],_0x280695[_0x7ba6('0x48')]));_0x31e4ec[_0x7ba6('0x53')][_0x7ba6('0x6d')]=_0x5261db['id'];if(_0x42a8c5[_0x7ba6('0x47')]['filter']){_0x31e4ec['where']=_[_0x7ba6('0x54')](_0x31e4ec[_0x7ba6('0x53')],{'$or':_[_0x7ba6('0x46')](_0x31e4ec[_0x7ba6('0x49')],function(_0x1b3c84){var _0x43d2e9={};_0x43d2e9[_0x1b3c84]={'$like':'%'+_0x42a8c5['query']['filter']+'%'};return _0x43d2e9;})});}_0x31e4ec=_[_0x7ba6('0x54')]({},_0x31e4ec,_0x42a8c5[_0x7ba6('0x56')]);return db[_0x7ba6('0x6e')][_0x7ba6('0x32')]({'where':_0x31e4ec[_0x7ba6('0x53')]})[_0x7ba6('0x21')](function(_0x202b85){_0x10ee8f[_0x7ba6('0x32')]=_0x202b85;if(_0x42a8c5[_0x7ba6('0x47')]['includeAll']){_0x31e4ec[_0x7ba6('0x57')]=[{'all':!![]}];}return db[_0x7ba6('0x6e')]['findAll'](_0x31e4ec);})[_0x7ba6('0x21')](function(_0x583e12){_0x10ee8f[_0x7ba6('0x59')]=_0x583e12;return _0x10ee8f;});}})['then'](respondWithFilteredResult(_0x10e385,_0x31e4ec))[_0x7ba6('0x5a')](handleError(_0x10e385,null));};exports[_0x7ba6('0x71')]=function(_0x3601ff,_0x44ffc5,_0x570838){return db[_0x7ba6('0x40')]['find']({'where':{'id':_0x3601ff['params']['id']}})[_0x7ba6('0x21')](handleEntityNotFound(_0x44ffc5,null))[_0x7ba6('0x21')](function(_0x3058fa){if(_0x3058fa){return _0x3058fa[_0x7ba6('0x71')](_0x3601ff['query'][_0x7ba6('0x72')]);}})[_0x7ba6('0x21')](respondWithStatusCode(_0x44ffc5,null))[_0x7ba6('0x5a')](handleError(_0x44ffc5,null));};exports['addAnswer']=function(_0x45001c,_0x3bb8fe,_0x52abdd){if(_0x45001c[_0x7ba6('0x62')]['id']){delete _0x45001c[_0x7ba6('0x62')]['id'];}return db[_0x7ba6('0x40')][_0x7ba6('0x60')]({'where':{'id':_0x45001c[_0x7ba6('0x5c')]['id']}})[_0x7ba6('0x21')](handleEntityNotFound(_0x3bb8fe,null))[_0x7ba6('0x21')](function(_0x4f062d){if(_0x4f062d){_0x45001c[_0x7ba6('0x62')][_0x7ba6('0x6d')]=_0x4f062d['id'];return db[_0x7ba6('0x73')]['create'](_0x45001c[_0x7ba6('0x62')]);}})[_0x7ba6('0x21')](respondWithResult(_0x3bb8fe,null))[_0x7ba6('0x5a')](handleError(_0x3bb8fe,null));};exports['getAnswers']=function(_0x183aa5,_0x3c81f8,_0x132a80){var _0x111efe={'raw':![],'where':{}};var _0x2d840f={};var _0x307f9b={'count':0x0,'rows':[]};return db[_0x7ba6('0x40')][_0x7ba6('0x70')]({'where':{'id':_0x183aa5[_0x7ba6('0x5c')]['id']}})[_0x7ba6('0x21')](handleEntityNotFound(_0x3c81f8,null))[_0x7ba6('0x21')](function(_0x4760cc){if(_0x4760cc){_0x2d840f['model']=_['keys'](db[_0x7ba6('0x73')]['rawAttributes']);_0x2d840f[_0x7ba6('0x47')]=_[_0x7ba6('0x5e')](_0x183aa5[_0x7ba6('0x47')]);_0x2d840f[_0x7ba6('0x48')]=_['intersection'](_0x2d840f['model'],_0x2d840f[_0x7ba6('0x47')]);_0x111efe[_0x7ba6('0x49')]=_[_0x7ba6('0x4a')](_0x2d840f[_0x7ba6('0x45')],qs[_0x7ba6('0x4b')](_0x183aa5[_0x7ba6('0x47')][_0x7ba6('0x4b')]));_0x111efe['attributes']=_0x111efe['attributes'][_0x7ba6('0x4c')]?_0x111efe['attributes']:_0x2d840f[_0x7ba6('0x45')];if(!_0x183aa5[_0x7ba6('0x47')][_0x7ba6('0x4d')](_0x7ba6('0x4e'))){_0x111efe[_0x7ba6('0x30')]=qs[_0x7ba6('0x30')](_0x183aa5[_0x7ba6('0x47')]['limit']);_0x111efe['offset']=qs[_0x7ba6('0x2f')](_0x183aa5['query'][_0x7ba6('0x2f')]);}_0x111efe[_0x7ba6('0x4f')]=qs['sort'](_0x183aa5[_0x7ba6('0x47')][_0x7ba6('0x50')]);_0x111efe[_0x7ba6('0x53')]=qs['filters'](_[_0x7ba6('0x51')](_0x183aa5[_0x7ba6('0x47')],_0x2d840f['filters']));_0x111efe[_0x7ba6('0x53')][_0x7ba6('0x6d')]=_0x4760cc['id'];if(_0x183aa5['query'][_0x7ba6('0x52')]){_0x111efe[_0x7ba6('0x53')]=_[_0x7ba6('0x54')](_0x111efe[_0x7ba6('0x53')],{'$or':_[_0x7ba6('0x46')](_0x111efe[_0x7ba6('0x49')],function(_0x720039){var _0x188ea4={};_0x188ea4[_0x720039]={'$like':'%'+_0x183aa5[_0x7ba6('0x47')][_0x7ba6('0x52')]+'%'};return _0x188ea4;})});}_0x111efe=_[_0x7ba6('0x54')]({},_0x111efe,_0x183aa5['options']);return db[_0x7ba6('0x73')][_0x7ba6('0x32')]({'where':_0x111efe['where']})['then'](function(_0x219134){_0x307f9b[_0x7ba6('0x32')]=_0x219134;if(_0x183aa5['query'][_0x7ba6('0x5f')]){_0x111efe['include']=[{'all':!![]}];}return db[_0x7ba6('0x73')]['findAll'](_0x111efe);})[_0x7ba6('0x21')](function(_0x48d9b7){_0x307f9b[_0x7ba6('0x59')]=_0x48d9b7;return _0x307f9b;});}})[_0x7ba6('0x21')](respondWithFilteredResult(_0x3c81f8,_0x111efe))[_0x7ba6('0x5a')](handleError(_0x3c81f8,null));};exports[_0x7ba6('0x74')]=function(_0xea8c7b,_0x4d624b,_0x19873c){return db['FaxAccount'][_0x7ba6('0x60')]({'where':{'id':_0xea8c7b[_0x7ba6('0x5c')]['id']}})[_0x7ba6('0x21')](handleEntityNotFound(_0x4d624b,null))[_0x7ba6('0x21')](function(_0xb5eadb){if(_0xb5eadb){return _0xb5eadb[_0x7ba6('0x74')](_0xea8c7b[_0x7ba6('0x47')][_0x7ba6('0x72')]);}})[_0x7ba6('0x21')](respondWithStatusCode(_0x4d624b,null))['catch'](handleError(_0x4d624b,null));};exports[_0x7ba6('0x75')]=function(_0x54de79,_0x13dab8,_0x201e24){return db[_0x7ba6('0x76')][_0x7ba6('0x60')]({'where':{'id':_0x54de79['params']['id']}})['then'](handleEntityNotFound(_0x13dab8,null))['then'](function(_0xb514c1){if(_0xb514c1){return _0xb514c1[_0x7ba6('0x75')](_0x54de79[_0x7ba6('0x62')][_0x7ba6('0x72')],_['omit'](_0x54de79[_0x7ba6('0x62')],[_0x7ba6('0x72'),'id'])||{});}})[_0x7ba6('0x21')](respondWithResult(_0x13dab8,null))[_0x7ba6('0x5a')](handleError(_0x13dab8,null));};exports[_0x7ba6('0x77')]=function(_0x5bb232,_0xba44db,_0x101f0b){var _0x23397a={'raw':![],'where':{}};var _0xe5f9ec={};var _0x438ce7={'count':0x0,'rows':[]};return db[_0x7ba6('0x40')]['findOne']({'where':{'id':_0x5bb232['params']['id']}})[_0x7ba6('0x21')](handleEntityNotFound(_0xba44db,null))[_0x7ba6('0x21')](function(_0x25f631){if(_0x25f631){_0xe5f9ec[_0x7ba6('0x45')]=_[_0x7ba6('0x5e')](db[_0x7ba6('0x76')][_0x7ba6('0x41')]);_0xe5f9ec[_0x7ba6('0x47')]=_[_0x7ba6('0x5e')](_0x5bb232[_0x7ba6('0x47')]);_0xe5f9ec['filters']=_[_0x7ba6('0x4a')](_0xe5f9ec[_0x7ba6('0x45')],_0xe5f9ec[_0x7ba6('0x47')]);_0x23397a[_0x7ba6('0x49')]=_['intersection'](_0xe5f9ec[_0x7ba6('0x45')],qs[_0x7ba6('0x4b')](_0x5bb232[_0x7ba6('0x47')]['fields']));_0x23397a['attributes']=_0x23397a[_0x7ba6('0x49')][_0x7ba6('0x4c')]?_0x23397a[_0x7ba6('0x49')]:_0xe5f9ec[_0x7ba6('0x45')];if(!_0x5bb232[_0x7ba6('0x47')][_0x7ba6('0x4d')](_0x7ba6('0x4e'))){_0x23397a[_0x7ba6('0x30')]=qs['limit'](_0x5bb232[_0x7ba6('0x47')][_0x7ba6('0x30')]);_0x23397a[_0x7ba6('0x2f')]=qs[_0x7ba6('0x2f')](_0x5bb232['query']['offset']);}_0x23397a[_0x7ba6('0x4f')]=qs['sort'](_0x5bb232[_0x7ba6('0x47')][_0x7ba6('0x50')]);_0x23397a[_0x7ba6('0x53')]=qs[_0x7ba6('0x48')](_[_0x7ba6('0x51')](_0x5bb232['query'],_0xe5f9ec[_0x7ba6('0x48')]));_0x23397a[_0x7ba6('0x53')]['FaxAccountId']=_0x25f631['id'];if(_0x5bb232[_0x7ba6('0x47')]['filter']){_0x23397a['where']=_['merge'](_0x23397a['where'],{'$or':_['map'](_0x23397a[_0x7ba6('0x49')],function(_0x459e04){var _0x1fde55={};_0x1fde55[_0x459e04]={'$like':'%'+_0x5bb232[_0x7ba6('0x47')]['filter']+'%'};return _0x1fde55;})});}_0x23397a=_['merge']({},_0x23397a,_0x5bb232[_0x7ba6('0x56')]);return db[_0x7ba6('0x76')][_0x7ba6('0x32')]({'where':_0x23397a[_0x7ba6('0x53')]})['then'](function(_0x36bb9a){_0x438ce7['count']=_0x36bb9a;if(_0x5bb232['query']['includeAll']){_0x23397a[_0x7ba6('0x57')]=[{'model':db[_0x7ba6('0x78')],'as':_0x7ba6('0x79'),'required':![]},{'model':db[_0x7ba6('0x7a')],'as':_0x7ba6('0x7b'),'attributes':[_0x7ba6('0x3c'),'fullname',_0x7ba6('0x7c')],'required':![]},{'model':db[_0x7ba6('0x7d')],'as':_0x7ba6('0x7e'),'attributes':['id','name',_0x7ba6('0x7f')],'where':_0x5bb232[_0x7ba6('0x47')]['tag']?{'id':_0x5bb232['query'][_0x7ba6('0x80')]}:undefined,'required':_0x5bb232['query'][_0x7ba6('0x80')]?!![]:![]}];}return db[_0x7ba6('0x76')]['findAll'](_0x23397a);})[_0x7ba6('0x21')](function(_0x25517f){_0x438ce7['rows']=_0x25517f;return _0x438ce7;});}})['then'](respondWithFilteredResult(_0xba44db,_0x23397a))[_0x7ba6('0x5a')](handleError(_0xba44db,null));};exports['addApplications']=function(_0x31c543,_0x6b5bc5,_0x57595e){return db[_0x7ba6('0x40')][_0x7ba6('0x70')]({'where':{'id':_0x31c543[_0x7ba6('0x5c')]['id']}})[_0x7ba6('0x21')](handleEntityNotFound(_0x6b5bc5,null))[_0x7ba6('0x21')](function(_0xd932aa){if(_0xd932aa){return db[_0x7ba6('0x81')]['transaction'](function(_0x130870){return db['FaxApplication'][_0x7ba6('0x38')]({'where':{'FaxAccountId':_0x31c543[_0x7ba6('0x5c')]['id']},'transaction':_0x130870})[_0x7ba6('0x21')](function(_0xb60640){var _0x109e2b=_['map'](_0x31c543[_0x7ba6('0x62')],function(_0x29fc3b){_0x29fc3b[_0x7ba6('0x6d')]=_0x31c543[_0x7ba6('0x5c')]['id'];return _0x29fc3b;});return db[_0x7ba6('0x82')][_0x7ba6('0x83')](_0x109e2b,{'transaction':_0x130870});});})[_0x7ba6('0x21')](function(){return db[_0x7ba6('0x82')][_0x7ba6('0x84')]({'where':{'FaxAccountId':_0x31c543[_0x7ba6('0x5c')]['id']},'order':_0x7ba6('0x85')});});}})[_0x7ba6('0x21')](respondWithResult(_0x6b5bc5,null))[_0x7ba6('0x5a')](handleError(_0x6b5bc5,null));};exports[_0x7ba6('0x86')]=function(_0x5ccffd,_0x3684d5,_0x2a40c0){var _0x2953c2={};var _0x80ee96={};var _0x12901f;var _0x4e2318;return db[_0x7ba6('0x40')][_0x7ba6('0x70')]({'where':{'id':_0x5ccffd[_0x7ba6('0x5c')]['id']}})[_0x7ba6('0x21')](handleEntityNotFound(_0x3684d5,null))['then'](function(_0x521577){if(_0x521577){_0x12901f=_0x521577;_0x80ee96[_0x7ba6('0x45')]=_[_0x7ba6('0x5e')](db['FaxApplication'][_0x7ba6('0x41')]);_0x80ee96[_0x7ba6('0x47')]=_['keys'](_0x5ccffd['query']);_0x80ee96[_0x7ba6('0x48')]=_['intersection'](_0x80ee96['model'],_0x80ee96[_0x7ba6('0x47')]);_0x2953c2[_0x7ba6('0x49')]=_['intersection'](_0x80ee96[_0x7ba6('0x45')],qs['fields'](_0x5ccffd['query'][_0x7ba6('0x4b')]));_0x2953c2[_0x7ba6('0x49')]=_0x2953c2[_0x7ba6('0x49')][_0x7ba6('0x4c')]?_0x2953c2[_0x7ba6('0x49')]:_0x80ee96[_0x7ba6('0x45')];_0x2953c2[_0x7ba6('0x4f')]=qs[_0x7ba6('0x50')](_0x5ccffd[_0x7ba6('0x47')][_0x7ba6('0x50')]);_0x2953c2[_0x7ba6('0x53')]=qs[_0x7ba6('0x48')](_[_0x7ba6('0x51')](_0x5ccffd[_0x7ba6('0x47')],_0x80ee96['filters']));if(_0x5ccffd[_0x7ba6('0x47')]['filter']){_0x2953c2[_0x7ba6('0x53')]=_[_0x7ba6('0x54')](_0x2953c2[_0x7ba6('0x53')],{'$or':_['map'](_0x2953c2[_0x7ba6('0x49')],function(_0x103395){var _0x10303f={};_0x10303f[_0x103395]={'$like':'%'+_0x5ccffd[_0x7ba6('0x47')][_0x7ba6('0x52')]+'%'};return _0x10303f;})});}_0x2953c2=_[_0x7ba6('0x54')]({},_0x2953c2,_0x5ccffd[_0x7ba6('0x56')]);return _0x12901f[_0x7ba6('0x86')](_0x2953c2);}})['then'](function(_0x192491){if(_0x192491){_0x4e2318=_0x192491[_0x7ba6('0x4c')];if(!_0x5ccffd[_0x7ba6('0x47')][_0x7ba6('0x4d')](_0x7ba6('0x4e'))){_0x2953c2[_0x7ba6('0x30')]=qs['limit'](_0x5ccffd[_0x7ba6('0x47')][_0x7ba6('0x30')]);_0x2953c2[_0x7ba6('0x2f')]=qs[_0x7ba6('0x2f')](_0x5ccffd[_0x7ba6('0x47')][_0x7ba6('0x2f')]);}return _0x12901f['getApplications'](_0x2953c2);}})[_0x7ba6('0x21')](function(_0x4a36e9){if(_0x4a36e9){return _0x4a36e9?{'count':_0x4e2318,'rows':_0x4a36e9}:null;}})[_0x7ba6('0x21')](respondWithResult(_0x3684d5,null))['catch'](handleError(_0x3684d5,null));};function Extension(_0x5aa978,_0x556e11,_0x15e49f,_0x546811){this[_0x7ba6('0x87')]=_0x7ba6('0x88');this[_0x7ba6('0x89')]=_0x5aa978[_0x7ba6('0x8a')];this['app']=_0x546811;this[_0x7ba6('0x43')]='system';this[_0x7ba6('0x8b')]=_0x7ba6('0x8c');this[_0x7ba6('0x6d')]=_0x5aa978['id'];this[_0x7ba6('0x85')]=_0x556e11;this[_0x7ba6('0x8d')]=_0x15e49f;}function createExtensionsReciveFax(_0xd5463d){var _0x5713b0=0x1;var _0xfc3355=[];_0xfc3355['push'](new Extension(_0xd5463d,_0x5713b0,'','Answer'));_0x5713b0+=0x1;_0xfc3355['push'](new Extension(_0xd5463d,_0x5713b0,_0x7ba6('0x8e'),'Set'));_0x5713b0+=0x1;for(var _0x3b431f in _0xd5463d){if(_0xd5463d[_0x7ba6('0x4d')](_0x3b431f)&&(_0x3b431f==='ecm'||_0x3b431f===_0x7ba6('0x8a')||_0x3b431f===_0x7ba6('0x8f')||_0x3b431f==='faxdetect'||_0x3b431f===_0x7ba6('0x90')||_0x3b431f==='maxrate'||_0x3b431f==='minrate'||_0x3b431f===_0x7ba6('0x91')||_0x3b431f==='t38timeout')){_0xfc3355['push'](new Extension(_0xd5463d,_0x5713b0,_0x7ba6('0x92')+_0x3b431f+')='+_0xd5463d[_0x3b431f],_0x7ba6('0x93')));_0x5713b0+=0x1;}}_0xfc3355['push'](new Extension(_0xd5463d,_0x5713b0,'6',_0x7ba6('0x94')));_0x5713b0+=0x1;_0xfc3355[_0x7ba6('0x95')](new Extension(_0xd5463d,_0x5713b0,'/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax'));_0x5713b0=0x0;return _0xfc3355;}exports[_0x7ba6('0x96')]=function(_0x28f34d,_0x373b93,_0x171016){var _0x18d55d;return db['sequelize']['transaction'](function(_0xed1e53){return db['FaxAccount'][_0x7ba6('0x61')](_0x28f34d[_0x7ba6('0x62')],{'transaction':_0xed1e53})['then'](function(_0x1cd2e6){_0x18d55d=_0x1cd2e6['get']({'plain':!![]});return db[_0x7ba6('0x97')]['bulkCreate'](createExtensionsReciveFax(_0x18d55d),{'transaction':_0xed1e53});});})[_0x7ba6('0x21')](function(){return _0x18d55d;})[_0x7ba6('0x21')](respondWithResult(_0x373b93,null))[_0x7ba6('0x5a')](handleError(_0x373b93,null));};exports[_0x7ba6('0x98')]=function(_0x189d95,_0x35ffd0,_0x36a73a){var _0x481fdf;return db[_0x7ba6('0x81')][_0x7ba6('0x99')](function(_0xe5a550){return db[_0x7ba6('0x40')][_0x7ba6('0x6a')](_0x189d95[_0x7ba6('0x62')],{'where':{'id':_0x189d95['body']['id']},'transaction':_0xe5a550})[_0x7ba6('0x21')](function(_0x19176c){return db[_0x7ba6('0x97')]['destroy']({'where':{'FaxAccountId':_0x189d95['body']['id']},'transaction':_0xe5a550})[_0x7ba6('0x21')](function(_0x33f968){return db[_0x7ba6('0x97')]['bulkCreate'](createExtensionsReciveFax(_['omit'](_0x189d95[_0x7ba6('0x62')],['tech',_0x7ba6('0x44'),'createdAt',_0x7ba6('0x9a'),_0x7ba6('0x9b'),_0x7ba6('0x9c')])),{'transaction':_0xe5a550});});});})[_0x7ba6('0x21')](function(){return db['FaxAccount'][_0x7ba6('0x9d')](_0x189d95[_0x7ba6('0x62')]['id']);})[_0x7ba6('0x21')](respondWithResult(_0x35ffd0,null))[_0x7ba6('0x5a')](handleError(_0x35ffd0,null));};exports[_0x7ba6('0x9e')]=function(_0x2178e3,_0x22ea7f,_0x12b2f6){var _0x46119a={'raw':!![],'where':{}};var _0x2d046d={};var _0xc0d33b={'count':0x0,'rows':[]};return db[_0x7ba6('0x40')][_0x7ba6('0x70')]({'where':{'id':_0x2178e3[_0x7ba6('0x5c')]['id']}})[_0x7ba6('0x21')](handleEntityNotFound(_0x22ea7f,null))['then'](function(_0x24e894){if(_0x24e894){_0x2d046d[_0x7ba6('0x45')]=_[_0x7ba6('0x5e')](db[_0x7ba6('0x9f')][_0x7ba6('0x41')]);_0x2d046d[_0x7ba6('0x47')]=_[_0x7ba6('0x5e')](_0x2178e3['query']);_0x2d046d[_0x7ba6('0x48')]=_['intersection'](_0x2d046d[_0x7ba6('0x45')],_0x2d046d['query']);_0x46119a[_0x7ba6('0x49')]=_[_0x7ba6('0x4a')](_0x2d046d[_0x7ba6('0x45')],qs[_0x7ba6('0x4b')](_0x2178e3[_0x7ba6('0x47')][_0x7ba6('0x4b')]));_0x46119a[_0x7ba6('0x49')]=_0x46119a['attributes'][_0x7ba6('0x4c')]?_0x46119a[_0x7ba6('0x49')]:_0x2d046d[_0x7ba6('0x45')];if(!_0x2178e3[_0x7ba6('0x47')][_0x7ba6('0x4d')](_0x7ba6('0x4e'))){_0x46119a[_0x7ba6('0x30')]=qs[_0x7ba6('0x30')](_0x2178e3[_0x7ba6('0x47')][_0x7ba6('0x30')]);_0x46119a['offset']=qs[_0x7ba6('0x2f')](_0x2178e3[_0x7ba6('0x47')][_0x7ba6('0x2f')]);}_0x46119a['order']=qs['sort'](_0x2178e3[_0x7ba6('0x47')][_0x7ba6('0x50')]);_0x46119a['where']=qs['filters'](_[_0x7ba6('0x51')](_0x2178e3['query'],_0x2d046d[_0x7ba6('0x48')]));_0x46119a[_0x7ba6('0x53')][_0x7ba6('0x6d')]=_0x24e894['id'];if(_0x2178e3[_0x7ba6('0x47')][_0x7ba6('0x52')]){_0x46119a[_0x7ba6('0x53')]=_['merge'](_0x46119a['where'],{'$or':_['map'](_0x46119a[_0x7ba6('0x49')],function(_0x24839b){var _0x1dabfc={};_0x1dabfc[_0x24839b]={'$like':'%'+_0x2178e3[_0x7ba6('0x47')][_0x7ba6('0x52')]+'%'};return _0x1dabfc;})});}if(_0x2178e3[_0x7ba6('0x47')][_0x7ba6('0xa0')]){var _0x44d3d3=_0x2178e3[_0x7ba6('0x47')]['$gte'][_0x7ba6('0xa1')](',');var _0xc3dcd1={};_0xc3dcd1[_0x44d3d3[0x0]]={'$gte':moment(_0x44d3d3[0x1])['format'](_0x7ba6('0xa2'))};_0x46119a[_0x7ba6('0x53')]=_['merge'](_0x46119a['where'],_0xc3dcd1);}_0x46119a=_[_0x7ba6('0x54')]({},_0x46119a,_0x2178e3[_0x7ba6('0x56')]);return db[_0x7ba6('0x9f')][_0x7ba6('0x32')]({'where':_0x46119a['where']})[_0x7ba6('0x21')](function(_0x215d3b){_0xc0d33b[_0x7ba6('0x32')]=_0x215d3b;if(_0x2178e3[_0x7ba6('0x47')][_0x7ba6('0x5f')]){_0x46119a[_0x7ba6('0x57')]=[{'all':!![]}];}return db[_0x7ba6('0x9f')]['findAll'](_0x46119a);})['then'](function(_0x1d4738){_0xc0d33b[_0x7ba6('0x59')]=_0x1d4738;return _0xc0d33b;});}})[_0x7ba6('0x21')](respondWithFilteredResult(_0x22ea7f,_0x46119a))[_0x7ba6('0x5a')](handleError(_0x22ea7f,null));};exports[_0x7ba6('0x3d')]=function(_0x42a340,_0x2f2924,_0x23b737){var _0x4291a7,_0x333fd0={},_0x3ca417;if(_0x42a340['body']['to']){_0x3ca417=_0x42a340[_0x7ba6('0x62')]['to'][0x0];}return db[_0x7ba6('0x40')][_0x7ba6('0x60')]({'where':{'id':_0x42a340[_0x7ba6('0x5c')]['id']},'include':[{'model':db[_0x7ba6('0xa3')],'as':_0x7ba6('0xa4'),'include':[{'model':db[_0x7ba6('0x78')],'as':_0x7ba6('0xa5'),'where':{'fax':_0x3ca417},'limit':0x1,'order':[[_0x7ba6('0x9a'),_0x7ba6('0xa6')]]}]}]})[_0x7ba6('0x21')](handleEntityNotFound(_0x2f2924,null))[_0x7ba6('0x21')](function(_0x633487){_0x4291a7=_0x633487;if(_0x42a340[_0x7ba6('0x62')]['attachments']&&_0x42a340[_0x7ba6('0x62')][_0x7ba6('0xa7')][_0x7ba6('0x4c')]){for(var _0x340e2f=0x0;_0x340e2f<_0x42a340[_0x7ba6('0x62')][_0x7ba6('0xa7')]['length'];_0x340e2f+=0x1){_0x42a340['body'][_0x7ba6('0xa7')][_0x340e2f]={'filename':_0x42a340[_0x7ba6('0x62')][_0x7ba6('0xa7')][_0x340e2f][_0x7ba6('0x3c')],'id':_0x42a340['body'][_0x7ba6('0xa7')][_0x340e2f]['id'],'path':path[_0x7ba6('0xa8')](config[_0x7ba6('0xa9')],'server/files/attachments',_0x42a340['body']['attachments'][_0x340e2f]['basename'])};}}return respondWithRpcPromise('CheckAfterSend',_0x7ba6('0xaa'),{'FaxAccountId':_[_0x7ba6('0xab')](_0x42a340[_0x7ba6('0x5c')]['id'])?undefined:_0x42a340[_0x7ba6('0x5c')]['id'],'path':_[_0x7ba6('0xab')](_0x42a340[_0x7ba6('0x62')]['attachments'][0x0][_0x7ba6('0xac')])?undefined:_0x42a340[_0x7ba6('0x62')][_0x7ba6('0xa7')][0x0][_0x7ba6('0xac')],'fax':_['isNil'](_0x42a340[_0x7ba6('0x62')]['to'][0x0])?undefined:_0x42a340[_0x7ba6('0x62')]['to'][0x0]},client9002);})[_0x7ba6('0x21')](function(){if(_0x4291a7){if(_[_0x7ba6('0xab')](_0x42a340['body'][_0x7ba6('0xad')])){_0x42a340[_0x7ba6('0x62')][_0x7ba6('0xad')]=util[_0x7ba6('0xae')](_0x7ba6('0xaf'),_0x4291a7[_0x7ba6('0x3c')],_0x4291a7['fax']);}if(_0x4291a7[_0x7ba6('0xa4')]){if(_0x4291a7['List']['Contacts']['length']){return _0x4291a7[_0x7ba6('0xa4')][_0x7ba6('0xa5')][0x0];}else{return db[_0x7ba6('0x78')][_0x7ba6('0x61')](_['defaults'](_0x42a340[_0x7ba6('0x62')],{'firstName':_0x42a340[_0x7ba6('0x62')]['to'][0x0],'phone':_0x42a340[_0x7ba6('0x62')]['to'][0x0],'fax':_0x42a340[_0x7ba6('0x62')]['to'][0x0],'ListId':_0x4291a7[_0x7ba6('0x9c')]}));}}else{throw new Error(_0x7ba6('0xb0'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x7ba6('0x21')](function(_0x4d9c02){if(_0x4d9c02){return db['FaxInteraction'][_0x7ba6('0x60')]({'where':{'ContactId':_0x4d9c02['id'],'closed':![],'FaxAccountId':_0x4291a7['id']}})[_0x7ba6('0x21')](function(_0x406a23){if(_0x406a23){return[_0x406a23,![]];}return db[_0x7ba6('0x76')]['create']({'UserId':_0x42a340[_0x7ba6('0x63')]['id'],'ContactId':_0x4d9c02['id'],'FaxAccountId':_0x4291a7['id'],'fax':_0x42a340[_0x7ba6('0x62')]['to'][0x0],'firstMsgDirection':_0x7ba6('0xb1'),'Messages':[_[_0x7ba6('0x54')](_0x42a340[_0x7ba6('0x62')],{'read':![],'body':_0x42a340['body'][_0x7ba6('0xa7')][0x0]['filename'],'FaxAccountId':_0x4291a7['id'],'UserId':_0x42a340[_0x7ba6('0x63')]['id'],'ContactId':_0x4d9c02['id'],'AttachmentId':_0x42a340[_0x7ba6('0x62')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x7ba6('0x9f')],'as':_0x7ba6('0xb2')}]})[_0x7ba6('0x21')](function(_0x11b713){return[_0x11b713,!![]];});});}else{throw new Error(_0x7ba6('0xb3'));}})[_0x7ba6('0xb4')](function(_0x79b58d,_0x560785){if(_0x560785){return _0x79b58d;}return db['FaxMessage'][_0x7ba6('0x61')]({'direction':_0x7ba6('0xb1'),'read':![],'body':_0x42a340[_0x7ba6('0x62')][_0x7ba6('0xa7')][0x0][_0x7ba6('0xb5')],'FaxAccountId':_0x4291a7['id'],'FaxInteractionId':_0x79b58d['id'],'UserId':_0x42a340[_0x7ba6('0x63')]['id'],'ContactId':_0x79b58d[_0x7ba6('0xb6')],'AttachmentId':_0x42a340[_0x7ba6('0x62')][_0x7ba6('0xa7')][0x0]['id']})['then'](function(_0xe0a7ca){_0x79b58d['dataValues']['Messages']=[];_0x79b58d['dataValues'][_0x7ba6('0xb2')]['push'](_0xe0a7ca[_0x7ba6('0xb7')]);return _0x79b58d;});})['then'](function(_0x631947){respondWithRpcPromise(_0x7ba6('0xb8'),_0x7ba6('0xb8'),{'FaxAccountId':_[_0x7ba6('0xab')](_0x42a340[_0x7ba6('0x5c')]['id'])?undefined:_0x42a340[_0x7ba6('0x5c')]['id'],'path':_[_0x7ba6('0xab')](_0x42a340[_0x7ba6('0x62')][_0x7ba6('0xa7')][0x0]['path'])?undefined:_0x42a340[_0x7ba6('0x62')][_0x7ba6('0xa7')][0x0]['path'],'fax':_[_0x7ba6('0xab')](_0x42a340[_0x7ba6('0x62')]['to'][0x0])?undefined:_0x42a340[_0x7ba6('0x62')]['to'][0x0],'AttachmentId':_0x42a340[_0x7ba6('0x62')][_0x7ba6('0xa7')][0x0]['id']},client9002)[_0x7ba6('0x21')](function(_0x297203){logger[_0x7ba6('0x22')](_0x7ba6('0xb9'),_0x297203);})[_0x7ba6('0x5a')](function(_0xf36988){logger[_0x7ba6('0x22')](_0x7ba6('0xb9'),_0xf36988);});return _0x631947;})['then'](respondWithResult(_0x2f2924,null))[_0x7ba6('0x5a')](handleError(_0x2f2924,null));};exports[_0x7ba6('0xba')]=function(_0x1c28f7,_0x12fd6b,_0x502e39){return db[_0x7ba6('0x40')][_0x7ba6('0x60')]({'where':{'id':_0x1c28f7['params']['id']}})[_0x7ba6('0x21')](handleEntityNotFound(_0x12fd6b,null))[_0x7ba6('0x21')](function(_0x31b6f2){if(_0x31b6f2){return _0x31b6f2['addAgents'](_0x1c28f7[_0x7ba6('0x62')]['ids'],_[_0x7ba6('0xbb')](_0x1c28f7[_0x7ba6('0x62')],[_0x7ba6('0x72'),'id'])||{})[_0x7ba6('0xb4')](function(_0xc07325){for(var _0x206396=0x0;_0x206396<_0x1c28f7['body'][_0x7ba6('0x72')][_0x7ba6('0x4c')];_0x206396+=0x1){socket[_0x7ba6('0xbc')](_0x7ba6('0xbd'),{'UserId':Number(_0x1c28f7[_0x7ba6('0x62')]['ids'][_0x206396]),'FaxAccountId':Number(_0x1c28f7['params']['id'])});}return _0xc07325;});}})['then'](respondWithResult(_0x12fd6b,null))[_0x7ba6('0x5a')](handleError(_0x12fd6b,null));};exports[_0x7ba6('0xbe')]=function(_0xa89f5a,_0x444f00,_0x15c490){return db[_0x7ba6('0x40')][_0x7ba6('0x60')]({'where':{'id':_0xa89f5a[_0x7ba6('0x5c')]['id']}})['then'](handleEntityNotFound(_0x444f00,null))[_0x7ba6('0x21')](function(_0x1c66d1){if(_0x1c66d1){return _0x1c66d1[_0x7ba6('0xbe')](_0xa89f5a[_0x7ba6('0x47')][_0x7ba6('0x72')])['then'](function(){if(_[_0x7ba6('0xbf')](_0xa89f5a['query'][_0x7ba6('0x72')])){for(var _0x466818=0x0;_0x466818<_0xa89f5a[_0x7ba6('0x47')][_0x7ba6('0x72')][_0x7ba6('0x4c')];_0x466818+=0x1){socket[_0x7ba6('0xbc')](_0x7ba6('0xc0'),{'UserId':Number(_0xa89f5a[_0x7ba6('0x47')][_0x7ba6('0x72')][_0x466818]),'FaxAccountId':Number(_0xa89f5a[_0x7ba6('0x5c')]['id'])});}}else{socket[_0x7ba6('0xbc')]('userFaxAccount:remove',{'UserId':Number(_0xa89f5a[_0x7ba6('0x47')][_0x7ba6('0x72')]),'FaxAccountId':Number(_0xa89f5a[_0x7ba6('0x5c')]['id'])});}});}})[_0x7ba6('0x21')](respondWithStatusCode(_0x444f00,null))[_0x7ba6('0x5a')](handleError(_0x444f00,null));};exports['getAgents']=function(_0x522d0b,_0x21cff6,_0x47dbed){var _0x132ce3={};var _0x54d998={};var _0x1c6cc1;var _0x18876d;return db[_0x7ba6('0x40')]['findOne']({'where':{'id':_0x522d0b[_0x7ba6('0x5c')]['id']}})['then'](handleEntityNotFound(_0x21cff6,null))[_0x7ba6('0x21')](function(_0x99f7cb){if(_0x99f7cb){_0x1c6cc1=_0x99f7cb;_0x54d998[_0x7ba6('0x45')]=_[_0x7ba6('0x5e')](db[_0x7ba6('0x7a')][_0x7ba6('0x41')]);_0x54d998['query']=_[_0x7ba6('0x5e')](_0x522d0b[_0x7ba6('0x47')]);_0x54d998[_0x7ba6('0x48')]=_[_0x7ba6('0x4a')](_0x54d998[_0x7ba6('0x45')],_0x54d998[_0x7ba6('0x47')]);_0x132ce3[_0x7ba6('0x49')]=_[_0x7ba6('0x4a')](_0x54d998['model'],qs[_0x7ba6('0x4b')](_0x522d0b[_0x7ba6('0x47')][_0x7ba6('0x4b')]));_0x132ce3['attributes']=_0x132ce3[_0x7ba6('0x49')][_0x7ba6('0x4c')]?_0x132ce3[_0x7ba6('0x49')]:_0x54d998[_0x7ba6('0x45')];_0x132ce3['order']=qs['sort'](_0x522d0b[_0x7ba6('0x47')][_0x7ba6('0x50')]);_0x132ce3['where']=qs[_0x7ba6('0x48')](_[_0x7ba6('0x51')](_0x522d0b[_0x7ba6('0x47')],_0x54d998['filters']));if(_0x522d0b[_0x7ba6('0x47')]['filter']){_0x132ce3[_0x7ba6('0x53')]=_[_0x7ba6('0x54')](_0x132ce3['where'],{'$or':_['map'](_0x132ce3['attributes'],function(_0x5ac20b){var _0x12caac={};_0x12caac[_0x5ac20b]={'$like':'%'+_0x522d0b[_0x7ba6('0x47')][_0x7ba6('0x52')]+'%'};return _0x12caac;})});}_0x132ce3=_[_0x7ba6('0x54')]({},_0x132ce3,_0x522d0b[_0x7ba6('0x56')]);return _0x1c6cc1['getAgents'](_0x132ce3);}})[_0x7ba6('0x21')](function(_0x22b380){if(_0x22b380){_0x18876d=_0x22b380[_0x7ba6('0x4c')];if(!_0x522d0b[_0x7ba6('0x47')][_0x7ba6('0x4d')](_0x7ba6('0x4e'))){_0x132ce3[_0x7ba6('0x30')]=qs['limit'](_0x522d0b[_0x7ba6('0x47')][_0x7ba6('0x30')]);_0x132ce3[_0x7ba6('0x2f')]=qs[_0x7ba6('0x2f')](_0x522d0b[_0x7ba6('0x47')][_0x7ba6('0x2f')]);}return _0x1c6cc1[_0x7ba6('0xc1')](_0x132ce3);}})[_0x7ba6('0x21')](function(_0x46221b){if(_0x46221b){return _0x46221b?{'count':_0x18876d,'rows':_0x46221b}:null;}})[_0x7ba6('0x21')](respondWithResult(_0x21cff6,null))[_0x7ba6('0x5a')](handleError(_0x21cff6,null));}; \ No newline at end of file +var _0x9cf1=['addInteraction','FaxInteraction','omit','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','exten','localstationid','app','system','description','Fax\x20Extension','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','push','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','transaction','VoiceExtension','updateAccountApplications','tech','createdAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','updatedAt','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','removeAgents','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','UserProfileResource','stack','name','send','index','map','FaxAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','params','Pause','mandatoryDispositionPause','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','FaxAccountId','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9cf1,0x1e8));var _0x19cf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9cf1[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x19cf('0x0'));var rimraf=require(_0x19cf('0x1'));var zipdir=require(_0x19cf('0x2'));var jsonpatch=require(_0x19cf('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x19cf('0x4'));var Mustache=require('mustache');var util=require(_0x19cf('0x5'));var path=require('path');var sox=require(_0x19cf('0x6'));var csv=require(_0x19cf('0x7'));var ejs=require(_0x19cf('0x8'));var fs=require('fs');var fs_extra=require(_0x19cf('0x9'));var _=require(_0x19cf('0xa'));var squel=require(_0x19cf('0xb'));var crypto=require('crypto');var jsforce=require(_0x19cf('0xc'));var deskjs=require(_0x19cf('0xd'));var toCsv=require(_0x19cf('0x7'));var querystring=require(_0x19cf('0xe'));var Papa=require(_0x19cf('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x19cf('0x10'));var hardwareService=require(_0x19cf('0x11'));var logger=require('../../config/logger')(_0x19cf('0x12'));var utils=require(_0x19cf('0x13'));var config=require(_0x19cf('0x14'));var licenseUtil=require(_0x19cf('0x15'));var db=require(_0x19cf('0x16'))['db'];config['redis']=_[_0x19cf('0x17')](config['redis'],{'host':_0x19cf('0x18'),'port':0x18eb});var socket=require(_0x19cf('0x19'))(new Redis(config[_0x19cf('0x1a')]));require('./faxAccount.socket')[_0x19cf('0x1b')](socket);var jayson=require(_0x19cf('0x1c'));var client=jayson[_0x19cf('0x1d')][_0x19cf('0x1e')]({'port':0x232c});var client9002=jayson[_0x19cf('0x1d')][_0x19cf('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x305902,_0x322a9b,_0x29444b,_0x2ecca2){return new BPromise(function(_0x216192,_0x3b1432){var _0x42234c=_0x2ecca2||client;return _0x42234c[_0x19cf('0x1f')](_0x305902,_0x29444b)[_0x19cf('0x20')](function(_0x9859fc){logger[_0x19cf('0x21')](_0x19cf('0x22'),_0x322a9b,'request\x20sent');logger[_0x19cf('0x23')](_0x19cf('0x24'),_0x322a9b,_0x19cf('0x25'),JSON[_0x19cf('0x26')](_0x9859fc));if(_0x9859fc['error']){if(_0x9859fc[_0x19cf('0x27')]['code']===0x1f4){logger[_0x19cf('0x27')](_0x19cf('0x22'),_0x322a9b,_0x9859fc[_0x19cf('0x27')][_0x19cf('0x28')]);return _0x3b1432(_0x9859fc['error'][_0x19cf('0x28')]);}logger['error'](_0x19cf('0x22'),_0x322a9b,_0x9859fc[_0x19cf('0x27')][_0x19cf('0x28')]);return _0x216192(_0x9859fc[_0x19cf('0x27')]['message']);}else{logger['info'](_0x19cf('0x22'),_0x322a9b,_0x19cf('0x25'));_0x216192(_0x9859fc['result'][_0x19cf('0x28')]);}})[_0x19cf('0x29')](function(_0x1fa250){logger[_0x19cf('0x27')](_0x19cf('0x22'),_0x322a9b,_0x1fa250);_0x3b1432(_0x1fa250);});});}function respondWithStatusCode(_0x429b9d,_0xdea47a){_0xdea47a=_0xdea47a||0xcc;return function(_0x160b26){if(_0x160b26){return _0x429b9d[_0x19cf('0x2a')](_0xdea47a);}return _0x429b9d[_0x19cf('0x2b')](_0xdea47a)[_0x19cf('0x2c')]();};}function respondWithResult(_0x28601c,_0x559ce9){_0x559ce9=_0x559ce9||0xc8;return function(_0x4c3c25){if(_0x4c3c25){return _0x28601c[_0x19cf('0x2b')](_0x559ce9)[_0x19cf('0x2d')](_0x4c3c25);}};}function respondWithFilteredResult(_0xf45ed0,_0x1fab24){return function(_0x130b19){if(_0x130b19){var _0x532dad=typeof _0x1fab24[_0x19cf('0x2e')]===_0x19cf('0x2f')&&typeof _0x1fab24[_0x19cf('0x30')]===_0x19cf('0x2f');var _0x39649b=_0x130b19[_0x19cf('0x31')];var _0xbf2d1=_0x532dad?0x0:_0x1fab24[_0x19cf('0x2e')];var _0xb4d94e=_0x532dad?_0x130b19['count']:_0x1fab24[_0x19cf('0x2e')]+_0x1fab24[_0x19cf('0x30')];var _0x2e73f3;if(_0xb4d94e>=_0x39649b){_0xb4d94e=_0x39649b;_0x2e73f3=0xc8;}else{_0x2e73f3=0xce;}_0xf45ed0[_0x19cf('0x2b')](_0x2e73f3);return _0xf45ed0[_0x19cf('0x32')](_0x19cf('0x33'),_0xbf2d1+'-'+_0xb4d94e+'/'+_0x39649b)[_0x19cf('0x2d')](_0x130b19);}return null;};}function patchUpdates(_0xb6cc8f){return function(_0xba10){try{jsonpatch[_0x19cf('0x34')](_0xba10,_0xb6cc8f,!![]);}catch(_0x567d0c){return BPromise[_0x19cf('0x35')](_0x567d0c);}return _0xba10['save']();};}function saveUpdates(_0x29a75d,_0x5d9511){return function(_0x32aca2){if(_0x32aca2){return _0x32aca2[_0x19cf('0x36')](_0x29a75d)[_0x19cf('0x20')](function(_0x15ffb7){return _0x15ffb7;});}return null;};}function removeEntity(_0x1b8808,_0x5515cd){return function(_0x13b7de){if(_0x13b7de){return _0x13b7de[_0x19cf('0x37')]()[_0x19cf('0x20')](function(){var _0x1e3ec0=_0x13b7de['get']({'plain':!![]});var _0x3b20a4='FaxAccounts';return db[_0x19cf('0x38')][_0x19cf('0x37')]({'where':{'type':_0x3b20a4,'resourceId':_0x1e3ec0['id']}})[_0x19cf('0x20')](function(){return _0x13b7de;});})[_0x19cf('0x20')](function(){_0x1b8808['status'](0xcc)[_0x19cf('0x2c')]();});}};}function handleEntityNotFound(_0x221689,_0x4aca73){return function(_0x34c7c7){if(!_0x34c7c7){_0x221689[_0x19cf('0x2a')](0x194);}return _0x34c7c7;};}function handleError(_0x4387f0,_0x9cb64c){_0x9cb64c=_0x9cb64c||0x1f4;return function(_0x2e27cf){logger[_0x19cf('0x27')](_0x2e27cf[_0x19cf('0x39')]);if(_0x2e27cf[_0x19cf('0x3a')]){delete _0x2e27cf['name'];}_0x4387f0['status'](_0x9cb64c)[_0x19cf('0x3b')](_0x2e27cf);};}exports[_0x19cf('0x3c')]=function(_0x13f817,_0x265ff7){var _0x4bf48={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x44d531={},_0x3311e8={'count':0x0,'rows':[]};var _0x3c98d6=_[_0x19cf('0x3d')](db[_0x19cf('0x3e')][_0x19cf('0x3f')],function(_0x26deb7){return{'name':_0x26deb7[_0x19cf('0x40')],'type':_0x26deb7['type'][_0x19cf('0x41')]};});_0x44d531[_0x19cf('0x42')]=_[_0x19cf('0x3d')](_0x3c98d6,_0x19cf('0x3a'));_0x44d531[_0x19cf('0x43')]=_[_0x19cf('0x44')](_0x13f817['query']);_0x44d531[_0x19cf('0x45')]=_[_0x19cf('0x46')](_0x44d531['model'],_0x44d531['query']);_0x4bf48['attributes']=_[_0x19cf('0x46')](_0x44d531[_0x19cf('0x42')],qs[_0x19cf('0x47')](_0x13f817[_0x19cf('0x43')][_0x19cf('0x47')]));_0x4bf48[_0x19cf('0x48')]=_0x4bf48['attributes'][_0x19cf('0x49')]?_0x4bf48[_0x19cf('0x48')]:_0x44d531['model'];if(!_0x13f817[_0x19cf('0x43')][_0x19cf('0x4a')](_0x19cf('0x4b'))){_0x4bf48[_0x19cf('0x30')]=qs['limit'](_0x13f817[_0x19cf('0x43')]['limit']);_0x4bf48['offset']=qs[_0x19cf('0x2e')](_0x13f817['query'][_0x19cf('0x2e')]);}_0x4bf48[_0x19cf('0x4c')]=qs[_0x19cf('0x4d')](_0x13f817[_0x19cf('0x43')][_0x19cf('0x4d')]);_0x4bf48[_0x19cf('0x4e')]=qs['filters'](_[_0x19cf('0x4f')](_0x13f817[_0x19cf('0x43')],_0x44d531[_0x19cf('0x45')]),_0x3c98d6);if(_0x13f817[_0x19cf('0x43')][_0x19cf('0x50')]){_0x4bf48[_0x19cf('0x4e')]=_[_0x19cf('0x51')](_0x4bf48[_0x19cf('0x4e')],{'$or':_[_0x19cf('0x3d')](_0x3c98d6,function(_0x531cab){if(_0x531cab[_0x19cf('0x52')]!==_0x19cf('0x53')){var _0x319aeb={};_0x319aeb[_0x531cab['name']]={'$like':'%'+_0x13f817[_0x19cf('0x43')][_0x19cf('0x50')]+'%'};return _0x319aeb;}})});}_0x4bf48=_[_0x19cf('0x51')]({},_0x4bf48,_0x13f817[_0x19cf('0x54')]);var _0x4018fb={'where':_0x4bf48[_0x19cf('0x4e')]};return db[_0x19cf('0x3e')][_0x19cf('0x31')](_0x4018fb)[_0x19cf('0x20')](function(_0x2ec00c){_0x3311e8['count']=_0x2ec00c;if(_0x13f817[_0x19cf('0x43')][_0x19cf('0x55')]){_0x4bf48['include']=[{'all':!![]}];}return db[_0x19cf('0x3e')][_0x19cf('0x56')](_0x4bf48);})[_0x19cf('0x20')](function(_0x51cf43){_0x3311e8[_0x19cf('0x57')]=_0x51cf43;return _0x3311e8;})[_0x19cf('0x20')](respondWithFilteredResult(_0x265ff7,_0x4bf48))['catch'](handleError(_0x265ff7,null));};exports['show']=function(_0x7f5a9e,_0x2d7bda){var _0x1682c8={'raw':![],'where':{'id':_0x7f5a9e[_0x19cf('0x58')]['id']},'include':[{'model':db[_0x19cf('0x59')],'as':_0x19cf('0x5a')}]},_0x103761={};_0x103761['model']=_[_0x19cf('0x44')](db[_0x19cf('0x3e')][_0x19cf('0x3f')]);_0x103761[_0x19cf('0x43')]=_['keys'](_0x7f5a9e[_0x19cf('0x43')]);_0x103761['filters']=_[_0x19cf('0x46')](_0x103761[_0x19cf('0x42')],_0x103761['query']);_0x1682c8[_0x19cf('0x48')]=_['intersection'](_0x103761[_0x19cf('0x42')],qs[_0x19cf('0x47')](_0x7f5a9e[_0x19cf('0x43')][_0x19cf('0x47')]));_0x1682c8['attributes']=_0x1682c8[_0x19cf('0x48')][_0x19cf('0x49')]?_0x1682c8[_0x19cf('0x48')]:_0x103761[_0x19cf('0x42')];if(_0x7f5a9e['query'][_0x19cf('0x55')]){_0x1682c8[_0x19cf('0x5b')]=[{'all':!![]}];}_0x1682c8=_[_0x19cf('0x51')]({},_0x1682c8,_0x7f5a9e['options']);return db[_0x19cf('0x3e')]['find'](_0x1682c8)[_0x19cf('0x20')](handleEntityNotFound(_0x2d7bda,null))['then'](respondWithResult(_0x2d7bda,null))[_0x19cf('0x29')](handleError(_0x2d7bda,null));};exports['create']=function(_0x387973,_0x308b3c){return db[_0x19cf('0x3e')][_0x19cf('0x5c')](_0x387973[_0x19cf('0x5d')],{})[_0x19cf('0x20')](function(_0x1a6b60){var _0x11491d=_0x387973[_0x19cf('0x5e')][_0x19cf('0x5f')]({'plain':!![]});if(!_0x11491d)throw new Error(_0x19cf('0x60'));if(_0x11491d[_0x19cf('0x61')]===_0x19cf('0x5e')){var _0x126b85=_0x1a6b60['get']({'plain':!![]});var _0x14baef=_0x19cf('0x62');return db[_0x19cf('0x63')][_0x19cf('0x64')]({'where':{'name':_0x14baef,'userProfileId':_0x11491d[_0x19cf('0x65')]},'raw':!![]})[_0x19cf('0x20')](function(_0x307b75){if(_0x307b75&&_0x307b75[_0x19cf('0x66')]===0x0){return db[_0x19cf('0x38')][_0x19cf('0x5c')]({'name':_0x126b85[_0x19cf('0x3a')],'resourceId':_0x126b85['id'],'type':_0x307b75['name'],'sectionId':_0x307b75['id']},{})[_0x19cf('0x20')](function(){return _0x1a6b60;});}else{return _0x1a6b60;}})[_0x19cf('0x29')](function(_0x24cdd0){logger[_0x19cf('0x27')](_0x19cf('0x67'),_0x24cdd0);throw _0x24cdd0;});}return _0x1a6b60;})['then'](respondWithResult(_0x308b3c,0xc9))[_0x19cf('0x29')](handleError(_0x308b3c,null));};exports[_0x19cf('0x36')]=function(_0x2da5f7,_0xe35c27){if(_0x2da5f7[_0x19cf('0x5d')]['id']){delete _0x2da5f7['body']['id'];}return db['FaxAccount'][_0x19cf('0x64')]({'where':{'id':_0x2da5f7[_0x19cf('0x58')]['id']},'include':[{'model':db[_0x19cf('0x59')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0xe35c27,null))[_0x19cf('0x20')](saveUpdates(_0x2da5f7['body'],null))[_0x19cf('0x20')](respondWithResult(_0xe35c27,null))['catch'](handleError(_0xe35c27,null));};exports[_0x19cf('0x37')]=function(_0x2df4fc,_0x270c91){return db[_0x19cf('0x3e')][_0x19cf('0x64')]({'where':{'id':_0x2df4fc[_0x19cf('0x58')]['id']}})[_0x19cf('0x20')](handleEntityNotFound(_0x270c91,null))[_0x19cf('0x20')](removeEntity(_0x270c91,null))['catch'](handleError(_0x270c91,null));};exports[_0x19cf('0x68')]=function(_0x489fab,_0x5cce0b){return db[_0x19cf('0x3e')]['describe']()[_0x19cf('0x20')](respondWithResult(_0x5cce0b,null))['catch'](handleError(_0x5cce0b,null));};exports[_0x19cf('0x69')]=function(_0x753f8f,_0x41293e,_0x26f1f8){if(_0x753f8f[_0x19cf('0x5d')]['id']){delete _0x753f8f[_0x19cf('0x5d')]['id'];}return db[_0x19cf('0x3e')][_0x19cf('0x64')]({'where':{'id':_0x753f8f['params']['id']}})[_0x19cf('0x20')](handleEntityNotFound(_0x41293e,null))[_0x19cf('0x20')](function(_0x2ef7f4){if(_0x2ef7f4){_0x753f8f[_0x19cf('0x5d')]['FaxAccountId']=_0x2ef7f4['id'];return db[_0x19cf('0x6a')][_0x19cf('0x5c')](_0x753f8f[_0x19cf('0x5d')]);}})[_0x19cf('0x20')](respondWithResult(_0x41293e,null))['catch'](handleError(_0x41293e,null));};exports[_0x19cf('0x6b')]=function(_0x316919,_0x280510,_0x3bbd5e){var _0x3c1808={'raw':![],'where':{}};var _0x30bf24={};var _0x4f374e={'count':0x0,'rows':[]};return db[_0x19cf('0x3e')][_0x19cf('0x6c')]({'where':{'id':_0x316919[_0x19cf('0x58')]['id']}})[_0x19cf('0x20')](handleEntityNotFound(_0x280510,null))['then'](function(_0x361151){if(_0x361151){_0x30bf24[_0x19cf('0x42')]=_[_0x19cf('0x44')](db[_0x19cf('0x6a')][_0x19cf('0x3f')]);_0x30bf24[_0x19cf('0x43')]=_[_0x19cf('0x44')](_0x316919[_0x19cf('0x43')]);_0x30bf24[_0x19cf('0x45')]=_[_0x19cf('0x46')](_0x30bf24[_0x19cf('0x42')],_0x30bf24[_0x19cf('0x43')]);_0x3c1808[_0x19cf('0x48')]=_[_0x19cf('0x46')](_0x30bf24[_0x19cf('0x42')],qs[_0x19cf('0x47')](_0x316919[_0x19cf('0x43')][_0x19cf('0x47')]));_0x3c1808[_0x19cf('0x48')]=_0x3c1808[_0x19cf('0x48')][_0x19cf('0x49')]?_0x3c1808[_0x19cf('0x48')]:_0x30bf24[_0x19cf('0x42')];if(!_0x316919[_0x19cf('0x43')]['hasOwnProperty'](_0x19cf('0x4b'))){_0x3c1808['limit']=qs['limit'](_0x316919['query'][_0x19cf('0x30')]);_0x3c1808['offset']=qs[_0x19cf('0x2e')](_0x316919[_0x19cf('0x43')][_0x19cf('0x2e')]);}_0x3c1808['order']=qs['sort'](_0x316919[_0x19cf('0x43')][_0x19cf('0x4d')]);_0x3c1808['where']=qs[_0x19cf('0x45')](_[_0x19cf('0x4f')](_0x316919[_0x19cf('0x43')],_0x30bf24[_0x19cf('0x45')]));_0x3c1808['where'][_0x19cf('0x6d')]=_0x361151['id'];if(_0x316919['query'][_0x19cf('0x50')]){_0x3c1808[_0x19cf('0x4e')]=_['merge'](_0x3c1808[_0x19cf('0x4e')],{'$or':_['map'](_0x3c1808[_0x19cf('0x48')],function(_0x2ba324){var _0x2dce94={};_0x2dce94[_0x2ba324]={'$like':'%'+_0x316919[_0x19cf('0x43')][_0x19cf('0x50')]+'%'};return _0x2dce94;})});}_0x3c1808=_[_0x19cf('0x51')]({},_0x3c1808,_0x316919[_0x19cf('0x54')]);return db['Disposition'][_0x19cf('0x31')]({'where':_0x3c1808[_0x19cf('0x4e')]})['then'](function(_0x13dc6d){_0x4f374e[_0x19cf('0x31')]=_0x13dc6d;if(_0x316919[_0x19cf('0x43')]['includeAll']){_0x3c1808[_0x19cf('0x5b')]=[{'all':!![]}];}return db[_0x19cf('0x6a')][_0x19cf('0x56')](_0x3c1808);})[_0x19cf('0x20')](function(_0x32c8da){_0x4f374e[_0x19cf('0x57')]=_0x32c8da;return _0x4f374e;});}})[_0x19cf('0x20')](respondWithFilteredResult(_0x280510,_0x3c1808))[_0x19cf('0x29')](handleError(_0x280510,null));};exports[_0x19cf('0x6e')]=function(_0x29d348,_0x465383,_0x5961f2){return db[_0x19cf('0x3e')][_0x19cf('0x64')]({'where':{'id':_0x29d348[_0x19cf('0x58')]['id']}})[_0x19cf('0x20')](handleEntityNotFound(_0x465383,null))[_0x19cf('0x20')](function(_0x774569){if(_0x774569){return _0x774569['removeDispositions'](_0x29d348[_0x19cf('0x43')][_0x19cf('0x6f')]);}})[_0x19cf('0x20')](respondWithStatusCode(_0x465383,null))[_0x19cf('0x29')](handleError(_0x465383,null));};exports[_0x19cf('0x70')]=function(_0x29e615,_0x28223a,_0x169552){if(_0x29e615[_0x19cf('0x5d')]['id']){delete _0x29e615[_0x19cf('0x5d')]['id'];}return db[_0x19cf('0x3e')]['find']({'where':{'id':_0x29e615[_0x19cf('0x58')]['id']}})['then'](handleEntityNotFound(_0x28223a,null))[_0x19cf('0x20')](function(_0x3e9bdd){if(_0x3e9bdd){_0x29e615['body'][_0x19cf('0x6d')]=_0x3e9bdd['id'];return db['CannedAnswer'][_0x19cf('0x5c')](_0x29e615[_0x19cf('0x5d')]);}})[_0x19cf('0x20')](respondWithResult(_0x28223a,null))[_0x19cf('0x29')](handleError(_0x28223a,null));};exports['getAnswers']=function(_0x49b039,_0x1e8156,_0x4ee43e){var _0x18290c={'raw':![],'where':{}};var _0x1efc75={};var _0x37023d={'count':0x0,'rows':[]};return db[_0x19cf('0x3e')][_0x19cf('0x6c')]({'where':{'id':_0x49b039[_0x19cf('0x58')]['id']}})['then'](handleEntityNotFound(_0x1e8156,null))[_0x19cf('0x20')](function(_0x4f1725){if(_0x4f1725){_0x1efc75[_0x19cf('0x42')]=_['keys'](db[_0x19cf('0x71')][_0x19cf('0x3f')]);_0x1efc75['query']=_[_0x19cf('0x44')](_0x49b039[_0x19cf('0x43')]);_0x1efc75[_0x19cf('0x45')]=_['intersection'](_0x1efc75[_0x19cf('0x42')],_0x1efc75[_0x19cf('0x43')]);_0x18290c[_0x19cf('0x48')]=_[_0x19cf('0x46')](_0x1efc75[_0x19cf('0x42')],qs['fields'](_0x49b039[_0x19cf('0x43')][_0x19cf('0x47')]));_0x18290c['attributes']=_0x18290c[_0x19cf('0x48')]['length']?_0x18290c[_0x19cf('0x48')]:_0x1efc75['model'];if(!_0x49b039[_0x19cf('0x43')]['hasOwnProperty']('nolimit')){_0x18290c[_0x19cf('0x30')]=qs[_0x19cf('0x30')](_0x49b039[_0x19cf('0x43')]['limit']);_0x18290c[_0x19cf('0x2e')]=qs[_0x19cf('0x2e')](_0x49b039[_0x19cf('0x43')][_0x19cf('0x2e')]);}_0x18290c['order']=qs[_0x19cf('0x4d')](_0x49b039[_0x19cf('0x43')][_0x19cf('0x4d')]);_0x18290c['where']=qs[_0x19cf('0x45')](_[_0x19cf('0x4f')](_0x49b039[_0x19cf('0x43')],_0x1efc75[_0x19cf('0x45')]));_0x18290c[_0x19cf('0x4e')][_0x19cf('0x6d')]=_0x4f1725['id'];if(_0x49b039[_0x19cf('0x43')][_0x19cf('0x50')]){_0x18290c['where']=_['merge'](_0x18290c[_0x19cf('0x4e')],{'$or':_[_0x19cf('0x3d')](_0x18290c[_0x19cf('0x48')],function(_0x47a8ae){var _0x54fa5e={};_0x54fa5e[_0x47a8ae]={'$like':'%'+_0x49b039[_0x19cf('0x43')][_0x19cf('0x50')]+'%'};return _0x54fa5e;})});}_0x18290c=_[_0x19cf('0x51')]({},_0x18290c,_0x49b039['options']);return db['CannedAnswer'][_0x19cf('0x31')]({'where':_0x18290c[_0x19cf('0x4e')]})[_0x19cf('0x20')](function(_0x4c7885){_0x37023d['count']=_0x4c7885;if(_0x49b039['query']['includeAll']){_0x18290c[_0x19cf('0x5b')]=[{'all':!![]}];}return db[_0x19cf('0x71')][_0x19cf('0x56')](_0x18290c);})['then'](function(_0x4e7185){_0x37023d[_0x19cf('0x57')]=_0x4e7185;return _0x37023d;});}})[_0x19cf('0x20')](respondWithFilteredResult(_0x1e8156,_0x18290c))['catch'](handleError(_0x1e8156,null));};exports[_0x19cf('0x72')]=function(_0x1bf9dd,_0x59fed9,_0x1b56be){return db[_0x19cf('0x3e')][_0x19cf('0x64')]({'where':{'id':_0x1bf9dd[_0x19cf('0x58')]['id']}})['then'](handleEntityNotFound(_0x59fed9,null))[_0x19cf('0x20')](function(_0x1f3bdb){if(_0x1f3bdb){return _0x1f3bdb['removeAnswers'](_0x1bf9dd[_0x19cf('0x43')][_0x19cf('0x6f')]);}})[_0x19cf('0x20')](respondWithStatusCode(_0x59fed9,null))[_0x19cf('0x29')](handleError(_0x59fed9,null));};exports[_0x19cf('0x73')]=function(_0x1f61a8,_0x2e1cc2,_0x469054){return db[_0x19cf('0x74')][_0x19cf('0x64')]({'where':{'id':_0x1f61a8['params']['id']}})['then'](handleEntityNotFound(_0x2e1cc2,null))[_0x19cf('0x20')](function(_0xbf8812){if(_0xbf8812){return _0xbf8812[_0x19cf('0x73')](_0x1f61a8[_0x19cf('0x5d')][_0x19cf('0x6f')],_[_0x19cf('0x75')](_0x1f61a8[_0x19cf('0x5d')],[_0x19cf('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x2e1cc2,null))[_0x19cf('0x29')](handleError(_0x2e1cc2,null));};exports['getInteractions']=function(_0x34dcff,_0x2466d2,_0xca1514){var _0x298480={'raw':![],'where':{}};var _0x1e92f0={};var _0x46a085={'count':0x0,'rows':[]};return db[_0x19cf('0x3e')][_0x19cf('0x6c')]({'where':{'id':_0x34dcff[_0x19cf('0x58')]['id']}})[_0x19cf('0x20')](handleEntityNotFound(_0x2466d2,null))[_0x19cf('0x20')](function(_0x15a07e){if(_0x15a07e){_0x1e92f0[_0x19cf('0x42')]=_[_0x19cf('0x44')](db[_0x19cf('0x74')][_0x19cf('0x3f')]);_0x1e92f0[_0x19cf('0x43')]=_['keys'](_0x34dcff[_0x19cf('0x43')]);_0x1e92f0[_0x19cf('0x45')]=_[_0x19cf('0x46')](_0x1e92f0['model'],_0x1e92f0['query']);_0x298480['attributes']=_['intersection'](_0x1e92f0[_0x19cf('0x42')],qs[_0x19cf('0x47')](_0x34dcff[_0x19cf('0x43')][_0x19cf('0x47')]));_0x298480[_0x19cf('0x48')]=_0x298480[_0x19cf('0x48')][_0x19cf('0x49')]?_0x298480[_0x19cf('0x48')]:_0x1e92f0['model'];if(!_0x34dcff[_0x19cf('0x43')][_0x19cf('0x4a')](_0x19cf('0x4b'))){_0x298480[_0x19cf('0x30')]=qs[_0x19cf('0x30')](_0x34dcff[_0x19cf('0x43')][_0x19cf('0x30')]);_0x298480[_0x19cf('0x2e')]=qs['offset'](_0x34dcff[_0x19cf('0x43')][_0x19cf('0x2e')]);}_0x298480[_0x19cf('0x4c')]=qs['sort'](_0x34dcff['query'][_0x19cf('0x4d')]);_0x298480[_0x19cf('0x4e')]=qs[_0x19cf('0x45')](_[_0x19cf('0x4f')](_0x34dcff[_0x19cf('0x43')],_0x1e92f0['filters']));_0x298480[_0x19cf('0x4e')][_0x19cf('0x6d')]=_0x15a07e['id'];if(_0x34dcff[_0x19cf('0x43')][_0x19cf('0x50')]){_0x298480[_0x19cf('0x4e')]=_[_0x19cf('0x51')](_0x298480[_0x19cf('0x4e')],{'$or':_['map'](_0x298480['attributes'],function(_0x3a8ea5){var _0x41c0f7={};_0x41c0f7[_0x3a8ea5]={'$like':'%'+_0x34dcff['query'][_0x19cf('0x50')]+'%'};return _0x41c0f7;})});}_0x298480=_[_0x19cf('0x51')]({},_0x298480,_0x34dcff[_0x19cf('0x54')]);return db[_0x19cf('0x74')][_0x19cf('0x31')]({'where':_0x298480[_0x19cf('0x4e')]})[_0x19cf('0x20')](function(_0x58ade8){_0x46a085['count']=_0x58ade8;if(_0x34dcff[_0x19cf('0x43')][_0x19cf('0x55')]){_0x298480[_0x19cf('0x5b')]=[{'model':db[_0x19cf('0x76')],'as':_0x19cf('0x77'),'required':![]},{'model':db[_0x19cf('0x78')],'as':_0x19cf('0x79'),'attributes':[_0x19cf('0x3a'),_0x19cf('0x7a'),'internal'],'required':![]},{'model':db[_0x19cf('0x7b')],'as':_0x19cf('0x7c'),'attributes':['id','name',_0x19cf('0x7d')],'where':_0x34dcff[_0x19cf('0x43')][_0x19cf('0x7e')]?{'id':_0x34dcff[_0x19cf('0x43')]['tag']}:undefined,'required':_0x34dcff['query'][_0x19cf('0x7e')]?!![]:![]}];}return db[_0x19cf('0x74')][_0x19cf('0x56')](_0x298480);})[_0x19cf('0x20')](function(_0x475438){_0x46a085[_0x19cf('0x57')]=_0x475438;return _0x46a085;});}})['then'](respondWithFilteredResult(_0x2466d2,_0x298480))[_0x19cf('0x29')](handleError(_0x2466d2,null));};exports[_0x19cf('0x7f')]=function(_0x2e7d4f,_0x1db537,_0x3e12ec){return db[_0x19cf('0x3e')]['findOne']({'where':{'id':_0x2e7d4f['params']['id']}})[_0x19cf('0x20')](handleEntityNotFound(_0x1db537,null))[_0x19cf('0x20')](function(_0x251e56){if(_0x251e56){return db[_0x19cf('0x80')]['transaction'](function(_0x96baa9){return db[_0x19cf('0x81')][_0x19cf('0x37')]({'where':{'FaxAccountId':_0x2e7d4f[_0x19cf('0x58')]['id']},'transaction':_0x96baa9})['then'](function(_0x5444a4){var _0x185340=_[_0x19cf('0x3d')](_0x2e7d4f[_0x19cf('0x5d')],function(_0x1734fb){_0x1734fb[_0x19cf('0x6d')]=_0x2e7d4f[_0x19cf('0x58')]['id'];return _0x1734fb;});return db[_0x19cf('0x81')][_0x19cf('0x82')](_0x185340,{'transaction':_0x96baa9});});})[_0x19cf('0x20')](function(){return db['FaxApplication'][_0x19cf('0x83')]({'where':{'FaxAccountId':_0x2e7d4f['params']['id']},'order':_0x19cf('0x84')});});}})[_0x19cf('0x20')](respondWithResult(_0x1db537,null))[_0x19cf('0x29')](handleError(_0x1db537,null));};exports['getApplications']=function(_0x19dbc8,_0x4946f3,_0x4e5176){var _0x19853b={};var _0x5b9843={};var _0x1d35ec;var _0x8184d2;return db[_0x19cf('0x3e')][_0x19cf('0x6c')]({'where':{'id':_0x19dbc8['params']['id']}})['then'](handleEntityNotFound(_0x4946f3,null))['then'](function(_0x4a406a){if(_0x4a406a){_0x1d35ec=_0x4a406a;_0x5b9843[_0x19cf('0x42')]=_[_0x19cf('0x44')](db[_0x19cf('0x81')][_0x19cf('0x3f')]);_0x5b9843[_0x19cf('0x43')]=_[_0x19cf('0x44')](_0x19dbc8[_0x19cf('0x43')]);_0x5b9843[_0x19cf('0x45')]=_[_0x19cf('0x46')](_0x5b9843[_0x19cf('0x42')],_0x5b9843['query']);_0x19853b[_0x19cf('0x48')]=_[_0x19cf('0x46')](_0x5b9843[_0x19cf('0x42')],qs[_0x19cf('0x47')](_0x19dbc8[_0x19cf('0x43')][_0x19cf('0x47')]));_0x19853b['attributes']=_0x19853b[_0x19cf('0x48')][_0x19cf('0x49')]?_0x19853b['attributes']:_0x5b9843[_0x19cf('0x42')];_0x19853b[_0x19cf('0x4c')]=qs[_0x19cf('0x4d')](_0x19dbc8[_0x19cf('0x43')]['sort']);_0x19853b[_0x19cf('0x4e')]=qs['filters'](_[_0x19cf('0x4f')](_0x19dbc8[_0x19cf('0x43')],_0x5b9843[_0x19cf('0x45')]));if(_0x19dbc8['query'][_0x19cf('0x50')]){_0x19853b['where']=_['merge'](_0x19853b[_0x19cf('0x4e')],{'$or':_[_0x19cf('0x3d')](_0x19853b[_0x19cf('0x48')],function(_0xf0bfc1){var _0x1ac10b={};_0x1ac10b[_0xf0bfc1]={'$like':'%'+_0x19dbc8['query']['filter']+'%'};return _0x1ac10b;})});}_0x19853b=_['merge']({},_0x19853b,_0x19dbc8[_0x19cf('0x54')]);return _0x1d35ec[_0x19cf('0x85')](_0x19853b);}})[_0x19cf('0x20')](function(_0xff7b7e){if(_0xff7b7e){_0x8184d2=_0xff7b7e['length'];if(!_0x19dbc8[_0x19cf('0x43')][_0x19cf('0x4a')](_0x19cf('0x4b'))){_0x19853b[_0x19cf('0x30')]=qs[_0x19cf('0x30')](_0x19dbc8[_0x19cf('0x43')][_0x19cf('0x30')]);_0x19853b[_0x19cf('0x2e')]=qs[_0x19cf('0x2e')](_0x19dbc8[_0x19cf('0x43')][_0x19cf('0x2e')]);}return _0x1d35ec[_0x19cf('0x85')](_0x19853b);}})[_0x19cf('0x20')](function(_0x21fe41){if(_0x21fe41){return _0x21fe41?{'count':_0x8184d2,'rows':_0x21fe41}:null;}})['then'](respondWithResult(_0x4946f3,null))[_0x19cf('0x29')](handleError(_0x4946f3,null));};function Extension(_0x441bf2,_0x40b5ab,_0x563a9d,_0x3f8d40){this['context']='from-voip-provider';this[_0x19cf('0x86')]=_0x441bf2[_0x19cf('0x87')];this[_0x19cf('0x88')]=_0x3f8d40;this[_0x19cf('0x52')]=_0x19cf('0x89');this[_0x19cf('0x8a')]=_0x19cf('0x8b');this['FaxAccountId']=_0x441bf2['id'];this['priority']=_0x40b5ab;this['appdata']=_0x563a9d;}function createExtensionsReciveFax(_0x3af05c){var _0x4b6c2e=0x1;var _0x54dfff=[];_0x54dfff['push'](new Extension(_0x3af05c,_0x4b6c2e,'',_0x19cf('0x8c')));_0x4b6c2e+=0x1;_0x54dfff['push'](new Extension(_0x3af05c,_0x4b6c2e,_0x19cf('0x8d'),_0x19cf('0x8e')));_0x4b6c2e+=0x1;for(var _0x260ca8 in _0x3af05c){if(_0x3af05c[_0x19cf('0x4a')](_0x260ca8)&&(_0x260ca8===_0x19cf('0x8f')||_0x260ca8===_0x19cf('0x87')||_0x260ca8===_0x19cf('0x90')||_0x260ca8===_0x19cf('0x91')||_0x260ca8===_0x19cf('0x92')||_0x260ca8===_0x19cf('0x93')||_0x260ca8===_0x19cf('0x94')||_0x260ca8===_0x19cf('0x95')||_0x260ca8===_0x19cf('0x96'))){_0x54dfff[_0x19cf('0x97')](new Extension(_0x3af05c,_0x4b6c2e,_0x19cf('0x98')+_0x260ca8+')='+_0x3af05c[_0x260ca8],_0x19cf('0x8e')));_0x4b6c2e+=0x1;}}_0x54dfff[_0x19cf('0x97')](new Extension(_0x3af05c,_0x4b6c2e,'6',_0x19cf('0x99')));_0x4b6c2e+=0x1;_0x54dfff[_0x19cf('0x97')](new Extension(_0x3af05c,_0x4b6c2e,_0x19cf('0x9a'),_0x19cf('0x9b')));_0x4b6c2e=0x0;return _0x54dfff;}exports[_0x19cf('0x9c')]=function(_0x5346f7,_0x5b29f3,_0x3a5bac){var _0x71978a;return db['sequelize'][_0x19cf('0x9d')](function(_0xb45fb7){return db['FaxAccount'][_0x19cf('0x5c')](_0x5346f7[_0x19cf('0x5d')],{'transaction':_0xb45fb7})[_0x19cf('0x20')](function(_0x307866){_0x71978a=_0x307866[_0x19cf('0x5f')]({'plain':!![]});return db[_0x19cf('0x9e')][_0x19cf('0x82')](createExtensionsReciveFax(_0x71978a),{'transaction':_0xb45fb7});});})[_0x19cf('0x20')](function(){return _0x71978a;})[_0x19cf('0x20')](respondWithResult(_0x5b29f3,null))[_0x19cf('0x29')](handleError(_0x5b29f3,null));};exports[_0x19cf('0x9f')]=function(_0x2f6c9a,_0x15e8fa,_0xdaf347){var _0x5771e4;return db[_0x19cf('0x80')][_0x19cf('0x9d')](function(_0x28a49a){return db[_0x19cf('0x3e')][_0x19cf('0x36')](_0x2f6c9a['body'],{'where':{'id':_0x2f6c9a[_0x19cf('0x5d')]['id']},'transaction':_0x28a49a})[_0x19cf('0x20')](function(_0x1d25e0){return db[_0x19cf('0x9e')][_0x19cf('0x37')]({'where':{'FaxAccountId':_0x2f6c9a[_0x19cf('0x5d')]['id']},'transaction':_0x28a49a})[_0x19cf('0x20')](function(_0x3abc90){return db['VoiceExtension'][_0x19cf('0x82')](createExtensionsReciveFax(_[_0x19cf('0x75')](_0x2f6c9a[_0x19cf('0x5d')],[_0x19cf('0xa0'),_0x19cf('0x41'),_0x19cf('0xa1'),'updatedAt',_0x19cf('0xa2'),_0x19cf('0xa3')])),{'transaction':_0x28a49a});});});})[_0x19cf('0x20')](function(){return db[_0x19cf('0x3e')][_0x19cf('0xa4')](_0x2f6c9a[_0x19cf('0x5d')]['id']);})[_0x19cf('0x20')](respondWithResult(_0x15e8fa,null))[_0x19cf('0x29')](handleError(_0x15e8fa,null));};exports[_0x19cf('0xa5')]=function(_0x70dc0a,_0x772504,_0x40cbe6){var _0x3558f5={'raw':!![],'where':{}};var _0x423a70={};var _0x240a5a={'count':0x0,'rows':[]};return db[_0x19cf('0x3e')]['findOne']({'where':{'id':_0x70dc0a[_0x19cf('0x58')]['id']}})['then'](handleEntityNotFound(_0x772504,null))['then'](function(_0x545b24){if(_0x545b24){_0x423a70[_0x19cf('0x42')]=_['keys'](db[_0x19cf('0xa6')]['rawAttributes']);_0x423a70[_0x19cf('0x43')]=_[_0x19cf('0x44')](_0x70dc0a['query']);_0x423a70[_0x19cf('0x45')]=_[_0x19cf('0x46')](_0x423a70['model'],_0x423a70[_0x19cf('0x43')]);_0x3558f5[_0x19cf('0x48')]=_['intersection'](_0x423a70[_0x19cf('0x42')],qs[_0x19cf('0x47')](_0x70dc0a['query']['fields']));_0x3558f5[_0x19cf('0x48')]=_0x3558f5[_0x19cf('0x48')]['length']?_0x3558f5[_0x19cf('0x48')]:_0x423a70['model'];if(!_0x70dc0a['query'][_0x19cf('0x4a')]('nolimit')){_0x3558f5['limit']=qs[_0x19cf('0x30')](_0x70dc0a['query'][_0x19cf('0x30')]);_0x3558f5[_0x19cf('0x2e')]=qs[_0x19cf('0x2e')](_0x70dc0a[_0x19cf('0x43')][_0x19cf('0x2e')]);}_0x3558f5[_0x19cf('0x4c')]=qs[_0x19cf('0x4d')](_0x70dc0a[_0x19cf('0x43')]['sort']);_0x3558f5['where']=qs[_0x19cf('0x45')](_[_0x19cf('0x4f')](_0x70dc0a['query'],_0x423a70['filters']));_0x3558f5['where']['FaxAccountId']=_0x545b24['id'];if(_0x70dc0a[_0x19cf('0x43')][_0x19cf('0x50')]){_0x3558f5[_0x19cf('0x4e')]=_[_0x19cf('0x51')](_0x3558f5[_0x19cf('0x4e')],{'$or':_[_0x19cf('0x3d')](_0x3558f5[_0x19cf('0x48')],function(_0x10285b){var _0x32dce9={};_0x32dce9[_0x10285b]={'$like':'%'+_0x70dc0a['query']['filter']+'%'};return _0x32dce9;})});}if(_0x70dc0a[_0x19cf('0x43')][_0x19cf('0xa7')]){var _0x381d4f=_0x70dc0a[_0x19cf('0x43')]['$gte'][_0x19cf('0xa8')](',');var _0x55d2ad={};_0x55d2ad[_0x381d4f[0x0]]={'$gte':moment(_0x381d4f[0x1])[_0x19cf('0xa9')](_0x19cf('0xaa'))};_0x3558f5[_0x19cf('0x4e')]=_[_0x19cf('0x51')](_0x3558f5[_0x19cf('0x4e')],_0x55d2ad);}_0x3558f5=_[_0x19cf('0x51')]({},_0x3558f5,_0x70dc0a[_0x19cf('0x54')]);return db['FaxMessage'][_0x19cf('0x31')]({'where':_0x3558f5[_0x19cf('0x4e')]})[_0x19cf('0x20')](function(_0x4f25cf){_0x240a5a['count']=_0x4f25cf;if(_0x70dc0a[_0x19cf('0x43')][_0x19cf('0x55')]){_0x3558f5['include']=[{'all':!![]}];}return db[_0x19cf('0xa6')]['findAll'](_0x3558f5);})[_0x19cf('0x20')](function(_0x183946){_0x240a5a[_0x19cf('0x57')]=_0x183946;return _0x240a5a;});}})[_0x19cf('0x20')](respondWithFilteredResult(_0x772504,_0x3558f5))[_0x19cf('0x29')](handleError(_0x772504,null));};exports[_0x19cf('0x3b')]=function(_0xa100ef,_0x1020b9,_0x4e0b3f){var _0x49da80,_0x55288e={},_0x1a6db7;if(_0xa100ef[_0x19cf('0x5d')]['to']){_0x1a6db7=_0xa100ef[_0x19cf('0x5d')]['to'][0x0];}return db[_0x19cf('0x3e')][_0x19cf('0x64')]({'where':{'id':_0xa100ef[_0x19cf('0x58')]['id']},'include':[{'model':db[_0x19cf('0xab')],'as':'List','include':[{'model':db[_0x19cf('0x76')],'as':_0x19cf('0xac'),'where':{'fax':_0x1a6db7},'limit':0x1,'order':[[_0x19cf('0xad'),_0x19cf('0xae')]]}]}]})['then'](handleEntityNotFound(_0x1020b9,null))[_0x19cf('0x20')](function(_0x3b5702){_0x49da80=_0x3b5702;if(_0xa100ef['body'][_0x19cf('0xaf')]&&_0xa100ef[_0x19cf('0x5d')][_0x19cf('0xaf')]['length']){for(var _0x499e86=0x0;_0x499e86<_0xa100ef[_0x19cf('0x5d')][_0x19cf('0xaf')][_0x19cf('0x49')];_0x499e86+=0x1){_0xa100ef['body'][_0x19cf('0xaf')][_0x499e86]={'filename':_0xa100ef[_0x19cf('0x5d')][_0x19cf('0xaf')][_0x499e86][_0x19cf('0x3a')],'id':_0xa100ef[_0x19cf('0x5d')][_0x19cf('0xaf')][_0x499e86]['id'],'path':path['join'](config[_0x19cf('0xb0')],_0x19cf('0xb1'),_0xa100ef[_0x19cf('0x5d')][_0x19cf('0xaf')][_0x499e86][_0x19cf('0xb2')])};}}return respondWithRpcPromise(_0x19cf('0xb3'),_0x19cf('0xb3'),{'FaxAccountId':_[_0x19cf('0xb4')](_0xa100ef[_0x19cf('0x58')]['id'])?undefined:_0xa100ef[_0x19cf('0x58')]['id'],'path':_[_0x19cf('0xb4')](_0xa100ef[_0x19cf('0x5d')][_0x19cf('0xaf')][0x0][_0x19cf('0xb5')])?undefined:_0xa100ef[_0x19cf('0x5d')][_0x19cf('0xaf')][0x0][_0x19cf('0xb5')],'fax':_[_0x19cf('0xb4')](_0xa100ef[_0x19cf('0x5d')]['to'][0x0])?undefined:_0xa100ef['body']['to'][0x0]},client9002);})[_0x19cf('0x20')](function(){if(_0x49da80){if(_[_0x19cf('0xb4')](_0xa100ef[_0x19cf('0x5d')][_0x19cf('0xb6')])){_0xa100ef[_0x19cf('0x5d')]['from']=util[_0x19cf('0xa9')](_0x19cf('0xb7'),_0x49da80[_0x19cf('0x3a')],_0x49da80[_0x19cf('0xb8')]);}if(_0x49da80['List']){if(_0x49da80[_0x19cf('0xb9')]['Contacts'][_0x19cf('0x49')]){return _0x49da80[_0x19cf('0xb9')][_0x19cf('0xac')][0x0];}else{return db[_0x19cf('0x76')]['create'](_[_0x19cf('0x17')](_0xa100ef[_0x19cf('0x5d')],{'firstName':_0xa100ef[_0x19cf('0x5d')]['to'][0x0],'phone':_0xa100ef[_0x19cf('0x5d')]['to'][0x0],'fax':_0xa100ef[_0x19cf('0x5d')]['to'][0x0],'ListId':_0x49da80['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x19cf('0xba'));}})[_0x19cf('0x20')](function(_0x325d35){if(_0x325d35){return db[_0x19cf('0x74')][_0x19cf('0x64')]({'where':{'ContactId':_0x325d35['id'],'closed':![],'FaxAccountId':_0x49da80['id']}})[_0x19cf('0x20')](function(_0x862f21){if(_0x862f21){return[_0x862f21,![]];}return db[_0x19cf('0x74')][_0x19cf('0x5c')]({'UserId':_0xa100ef['user']['id'],'ContactId':_0x325d35['id'],'FaxAccountId':_0x49da80['id'],'fax':_0xa100ef[_0x19cf('0x5d')]['to'][0x0],'firstMsgDirection':_0x19cf('0xbb'),'Messages':[_[_0x19cf('0x51')](_0xa100ef[_0x19cf('0x5d')],{'read':![],'body':_0xa100ef[_0x19cf('0x5d')][_0x19cf('0xaf')][0x0][_0x19cf('0xbc')],'FaxAccountId':_0x49da80['id'],'UserId':_0xa100ef['user']['id'],'ContactId':_0x325d35['id'],'AttachmentId':_0xa100ef['body']['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x19cf('0xa6')],'as':'Messages'}]})[_0x19cf('0x20')](function(_0x28d132){return[_0x28d132,!![]];});});}else{throw new Error(_0x19cf('0xbd'));}})['spread'](function(_0x4f5e1e,_0x2fae4e){if(_0x2fae4e){return _0x4f5e1e;}return db[_0x19cf('0xa6')][_0x19cf('0x5c')]({'direction':_0x19cf('0xbb'),'read':![],'body':_0xa100ef[_0x19cf('0x5d')][_0x19cf('0xaf')][0x0][_0x19cf('0xbc')],'FaxAccountId':_0x49da80['id'],'FaxInteractionId':_0x4f5e1e['id'],'UserId':_0xa100ef[_0x19cf('0x5e')]['id'],'ContactId':_0x4f5e1e[_0x19cf('0xbe')],'AttachmentId':_0xa100ef[_0x19cf('0x5d')]['attachments'][0x0]['id']})[_0x19cf('0x20')](function(_0x599026){_0x4f5e1e[_0x19cf('0xbf')][_0x19cf('0xc0')]=[];_0x4f5e1e[_0x19cf('0xbf')]['Messages'][_0x19cf('0x97')](_0x599026[_0x19cf('0xbf')]);return _0x4f5e1e;});})[_0x19cf('0x20')](function(_0x1d2893){respondWithRpcPromise('SendFax',_0x19cf('0xc1'),{'FaxAccountId':_[_0x19cf('0xb4')](_0xa100ef[_0x19cf('0x58')]['id'])?undefined:_0xa100ef[_0x19cf('0x58')]['id'],'path':_[_0x19cf('0xb4')](_0xa100ef[_0x19cf('0x5d')][_0x19cf('0xaf')][0x0][_0x19cf('0xb5')])?undefined:_0xa100ef[_0x19cf('0x5d')][_0x19cf('0xaf')][0x0][_0x19cf('0xb5')],'fax':_['isNil'](_0xa100ef[_0x19cf('0x5d')]['to'][0x0])?undefined:_0xa100ef[_0x19cf('0x5d')]['to'][0x0],'AttachmentId':_0xa100ef['body'][_0x19cf('0xaf')][0x0]['id']},client9002)[_0x19cf('0x20')](function(_0x28fe2f){logger['info'](_0x19cf('0xc2'),_0x28fe2f);})['catch'](function(_0x4e0651){logger[_0x19cf('0x21')](_0x19cf('0xc2'),_0x4e0651);});return _0x1d2893;})[_0x19cf('0x20')](respondWithResult(_0x1020b9,null))[_0x19cf('0x29')](handleError(_0x1020b9,null));};exports[_0x19cf('0xc3')]=function(_0x238261,_0x4c283e,_0x51e015){return db[_0x19cf('0x3e')][_0x19cf('0x64')]({'where':{'id':_0x238261[_0x19cf('0x58')]['id']}})[_0x19cf('0x20')](handleEntityNotFound(_0x4c283e,null))[_0x19cf('0x20')](function(_0x4b1be6){if(_0x4b1be6){return _0x4b1be6['addAgents'](_0x238261[_0x19cf('0x5d')][_0x19cf('0x6f')],_[_0x19cf('0x75')](_0x238261['body'],[_0x19cf('0x6f'),'id'])||{})[_0x19cf('0xc4')](function(_0x51b986){for(var _0x9e659f=0x0;_0x9e659f<_0x238261[_0x19cf('0x5d')]['ids'][_0x19cf('0x49')];_0x9e659f+=0x1){socket[_0x19cf('0xc5')]('userFaxAccount:save',{'UserId':Number(_0x238261[_0x19cf('0x5d')][_0x19cf('0x6f')][_0x9e659f]),'FaxAccountId':Number(_0x238261['params']['id'])});}return _0x51b986;});}})[_0x19cf('0x20')](respondWithResult(_0x4c283e,null))[_0x19cf('0x29')](handleError(_0x4c283e,null));};exports[_0x19cf('0xc6')]=function(_0x5526df,_0x62cb1a,_0x4cebe2){return db['FaxAccount']['find']({'where':{'id':_0x5526df['params']['id']}})[_0x19cf('0x20')](handleEntityNotFound(_0x62cb1a,null))[_0x19cf('0x20')](function(_0x1c8583){if(_0x1c8583){return _0x1c8583['removeAgents'](_0x5526df[_0x19cf('0x43')][_0x19cf('0x6f')])['then'](function(){if(_['isArray'](_0x5526df['query'][_0x19cf('0x6f')])){for(var _0xdfaae9=0x0;_0xdfaae9<_0x5526df[_0x19cf('0x43')][_0x19cf('0x6f')][_0x19cf('0x49')];_0xdfaae9+=0x1){socket[_0x19cf('0xc5')](_0x19cf('0xc7'),{'UserId':Number(_0x5526df[_0x19cf('0x43')][_0x19cf('0x6f')][_0xdfaae9]),'FaxAccountId':Number(_0x5526df[_0x19cf('0x58')]['id'])});}}else{socket[_0x19cf('0xc5')](_0x19cf('0xc7'),{'UserId':Number(_0x5526df[_0x19cf('0x43')]['ids']),'FaxAccountId':Number(_0x5526df[_0x19cf('0x58')]['id'])});}});}})[_0x19cf('0x20')](respondWithStatusCode(_0x62cb1a,null))[_0x19cf('0x29')](handleError(_0x62cb1a,null));};exports[_0x19cf('0xc8')]=function(_0x43f44e,_0x5185fe,_0x2ebec4){var _0x4efbdb={};var _0x42027a={};var _0x330058;var _0x471b70;return db[_0x19cf('0x3e')][_0x19cf('0x6c')]({'where':{'id':_0x43f44e[_0x19cf('0x58')]['id']}})[_0x19cf('0x20')](handleEntityNotFound(_0x5185fe,null))[_0x19cf('0x20')](function(_0x52e0dc){if(_0x52e0dc){_0x330058=_0x52e0dc;_0x42027a[_0x19cf('0x42')]=_[_0x19cf('0x44')](db[_0x19cf('0x78')][_0x19cf('0x3f')]);_0x42027a[_0x19cf('0x43')]=_[_0x19cf('0x44')](_0x43f44e[_0x19cf('0x43')]);_0x42027a[_0x19cf('0x45')]=_['intersection'](_0x42027a[_0x19cf('0x42')],_0x42027a[_0x19cf('0x43')]);_0x4efbdb[_0x19cf('0x48')]=_['intersection'](_0x42027a[_0x19cf('0x42')],qs['fields'](_0x43f44e[_0x19cf('0x43')][_0x19cf('0x47')]));_0x4efbdb[_0x19cf('0x48')]=_0x4efbdb[_0x19cf('0x48')][_0x19cf('0x49')]?_0x4efbdb[_0x19cf('0x48')]:_0x42027a['model'];_0x4efbdb[_0x19cf('0x4c')]=qs[_0x19cf('0x4d')](_0x43f44e[_0x19cf('0x43')]['sort']);_0x4efbdb[_0x19cf('0x4e')]=qs[_0x19cf('0x45')](_[_0x19cf('0x4f')](_0x43f44e['query'],_0x42027a[_0x19cf('0x45')]));if(_0x43f44e[_0x19cf('0x43')][_0x19cf('0x50')]){_0x4efbdb['where']=_[_0x19cf('0x51')](_0x4efbdb[_0x19cf('0x4e')],{'$or':_[_0x19cf('0x3d')](_0x4efbdb['attributes'],function(_0x1c87ff){var _0x2b4ef0={};_0x2b4ef0[_0x1c87ff]={'$like':'%'+_0x43f44e['query'][_0x19cf('0x50')]+'%'};return _0x2b4ef0;})});}_0x4efbdb=_['merge']({},_0x4efbdb,_0x43f44e[_0x19cf('0x54')]);return _0x330058[_0x19cf('0xc8')](_0x4efbdb);}})[_0x19cf('0x20')](function(_0x930194){if(_0x930194){_0x471b70=_0x930194['length'];if(!_0x43f44e['query'][_0x19cf('0x4a')]('nolimit')){_0x4efbdb[_0x19cf('0x30')]=qs[_0x19cf('0x30')](_0x43f44e[_0x19cf('0x43')][_0x19cf('0x30')]);_0x4efbdb['offset']=qs['offset'](_0x43f44e[_0x19cf('0x43')][_0x19cf('0x2e')]);}return _0x330058[_0x19cf('0xc8')](_0x4efbdb);}})[_0x19cf('0x20')](function(_0x15b02d){if(_0x15b02d){return _0x15b02d?{'count':_0x471b70,'rows':_0x15b02d}:null;}})[_0x19cf('0x20')](respondWithResult(_0x5185fe,null))[_0x19cf('0x29')](handleError(_0x5185fe,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 0283675..c15a09a 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 _0xec3f=['emit','hasOwnProperty','hook','events','../../mysqldb','FaxAccount','setMaxListeners','save','update'];(function(_0x58db4e,_0x439d8d){var _0x40139a=function(_0x34cae4){while(--_0x34cae4){_0x58db4e['push'](_0x58db4e['shift']());}};_0x40139a(++_0x439d8d);}(_0xec3f,0xdb));var _0xfec3=function(_0x49b7bb,_0x194bfb){_0x49b7bb=_0x49b7bb-0x0;var _0xec28ef=_0xec3f[_0x49b7bb];return _0xec28ef;};'use strict';var EventEmitter=require(_0xfec3('0x0'));var FaxAccount=require(_0xfec3('0x1'))['db'][_0xfec3('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xfec3('0x3')](0x0);var events={'afterCreate':_0xfec3('0x4'),'afterUpdate':_0xfec3('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1dbf35){return function(_0x4dc112,_0xbc63b,_0x3d48e3){FaxAccountEvents[_0xfec3('0x6')](_0x1dbf35+':'+_0x4dc112['id'],_0x4dc112);FaxAccountEvents[_0xfec3('0x6')](_0x1dbf35,_0x4dc112);_0x3d48e3(null);};}for(var e in events){if(events[_0xfec3('0x7')](e)){var event=events[e];FaxAccount[_0xfec3('0x8')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0xc23d=['../../mysqldb','FaxAccount','setMaxListeners','save','update','emit','hook','events'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xc23d,0x7f));var _0xdc23=function(_0x23f0e1,_0x11d94b){_0x23f0e1=_0x23f0e1-0x0;var _0x257f0d=_0xc23d[_0x23f0e1];return _0x257f0d;};'use strict';var EventEmitter=require(_0xdc23('0x0'));var FaxAccount=require(_0xdc23('0x1'))['db'][_0xdc23('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xdc23('0x3')](0x0);var events={'afterCreate':_0xdc23('0x4'),'afterUpdate':_0xdc23('0x5'),'afterDestroy':'remove'};function emitEvent(_0x22f577){return function(_0x202655,_0x38fc3c,_0xa69924){FaxAccountEvents[_0xdc23('0x6')](_0x22f577+':'+_0x202655['id'],_0x202655);FaxAccountEvents['emit'](_0x22f577,_0x202655);_0xa69924(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xdc23('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 0d6902c..121b516 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 _0x12f8=['./faxAccount.attributes','exports','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x5a2118,_0x4c473a){var _0x39dd25=function(_0x1b047a){while(--_0x1b047a){_0x5a2118['push'](_0x5a2118['shift']());}};_0x39dd25(++_0x4c473a);}(_0x12f8,0x1e7));var _0x812f=function(_0x35d6a6,_0x11befb){_0x35d6a6=_0x35d6a6-0x0;var _0xf34bf7=_0x12f8[_0x35d6a6];return _0xf34bf7;};'use strict';var _=require(_0x812f('0x0'));var util=require(_0x812f('0x1'));var logger=require(_0x812f('0x2'))(_0x812f('0x3'));var moment=require(_0x812f('0x4'));var BPromise=require(_0x812f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x812f('0x6'));var config=require(_0x812f('0x7'));var attributes=require(_0x812f('0x8'));module[_0x812f('0x9')]=function(_0x2f08d6,_0x107877){return _0x2f08d6['define']('FaxAccount',attributes,{'tableName':_0x812f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f3f=['rimraf','../../config/environment','./faxAccount.attributes','exports','FaxAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xc0f247,_0x19fa22){var _0x31b82c=function(_0x3d63ac){while(--_0x3d63ac){_0xc0f247['push'](_0xc0f247['shift']());}};_0x31b82c(++_0x19fa22);}(_0x2f3f,0x65));var _0xf2f3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2f3f[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xf2f3('0x0'));var util=require(_0xf2f3('0x1'));var logger=require(_0xf2f3('0x2'))(_0xf2f3('0x3'));var moment=require(_0xf2f3('0x4'));var BPromise=require(_0xf2f3('0x5'));var rp=require(_0xf2f3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf2f3('0x7'));var config=require(_0xf2f3('0x8'));var attributes=require(_0xf2f3('0x9'));module[_0xf2f3('0xa')]=function(_0x15b66a,_0x91c5d){return _0x15b66a['define'](_0xf2f3('0xb'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 4caf29c..3689e83 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 _0xf38f=['options','raw','attributes','include','map','model','catch','NotifyFaxAccount','body','fax','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','DESC','get','applications','Applications','orderBy','priority','length','from','ListId','create','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','User','unshift','name','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./faxAccount.socket','register','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetFaxAccount','FaxAccount','findAll'];(function(_0x36fc79,_0x4dd2a7){var _0x249f38=function(_0x5796ed){while(--_0x5796ed){_0x36fc79['push'](_0x36fc79['shift']());}};_0x249f38(++_0x4dd2a7);}(_0xf38f,0x18b));var _0xff38=function(_0x5363a3,_0x3c6310){_0x5363a3=_0x5363a3-0x0;var _0x4cd0c6=_0xf38f[_0x5363a3];return _0x4cd0c6;};'use strict';var _=require(_0xff38('0x0'));var util=require(_0xff38('0x1'));var moment=require(_0xff38('0x2'));var BPromise=require(_0xff38('0x3'));var rs=require(_0xff38('0x4'));var fs=require('fs');var Redis=require(_0xff38('0x5'));var db=require(_0xff38('0x6'))['db'];var utils=require(_0xff38('0x7'));var logger=require(_0xff38('0x8'))('rpc');var config=require(_0xff38('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xff38('0xa')][_0xff38('0xb')]({'port':0x232c});config[_0xff38('0xc')]=_[_0xff38('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xff38('0xe'))(new Redis(config[_0xff38('0xc')]));require(_0xff38('0xf'))[_0xff38('0x10')](socket);function respondWithRpcPromise(_0x10a7d3,_0x3b2208,_0x2aa858){return new BPromise(function(_0x29bca3,_0x163d6c){return client['request'](_0x10a7d3,_0x2aa858)[_0xff38('0x11')](function(_0xa52cb3){logger[_0xff38('0x12')](_0xff38('0x13'),_0x3b2208,_0xff38('0x14'));logger[_0xff38('0x15')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x3b2208,_0xff38('0x14'),JSON[_0xff38('0x16')](_0xa52cb3));if(_0xa52cb3[_0xff38('0x17')]){if(_0xa52cb3[_0xff38('0x17')][_0xff38('0x18')]===0x1f4){logger[_0xff38('0x17')]('FaxAccount,\x20%s,\x20%s',_0x3b2208,_0xa52cb3[_0xff38('0x17')][_0xff38('0x19')]);return _0x163d6c(_0xa52cb3[_0xff38('0x17')][_0xff38('0x19')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x3b2208,_0xa52cb3[_0xff38('0x17')]['message']);return _0x29bca3(_0xa52cb3[_0xff38('0x17')][_0xff38('0x19')]);}else{logger[_0xff38('0x12')](_0xff38('0x13'),_0x3b2208,_0xff38('0x14'));_0x29bca3(_0xa52cb3[_0xff38('0x1a')][_0xff38('0x19')]);}})['catch'](function(_0x479699){logger[_0xff38('0x17')](_0xff38('0x13'),_0x3b2208,_0x479699);_0x163d6c(_0x479699);});});}exports[_0xff38('0x1b')]=function(_0x3de8cd){var _0x1ed2df=this;return new Promise(function(_0x23b93c,_0x3deea7){return db[_0xff38('0x1c')][_0xff38('0x1d')]({'raw':_0x3de8cd[_0xff38('0x1e')]?_0x3de8cd[_0xff38('0x1e')][_0xff38('0x1f')]===undefined?!![]:![]:!![],'where':_0x3de8cd[_0xff38('0x1e')]?_0x3de8cd['options']['where']||null:null,'attributes':_0x3de8cd[_0xff38('0x1e')]?_0x3de8cd['options'][_0xff38('0x20')]||null:null,'limit':_0x3de8cd[_0xff38('0x1e')]?_0x3de8cd['options']['limit']||null:null,'include':_0x3de8cd[_0xff38('0x1e')]?_0x3de8cd[_0xff38('0x1e')][_0xff38('0x21')]?_[_0xff38('0x22')](_0x3de8cd['options'][_0xff38('0x21')],function(_0x748fc9){return{'model':db[_0x748fc9[_0xff38('0x23')]],'as':_0x748fc9['as'],'attributes':_0x748fc9[_0xff38('0x20')],'include':_0x748fc9['include']?_[_0xff38('0x22')](_0x748fc9['include'],function(_0x391559){return{'model':db[_0x391559['model']],'as':_0x391559['as'],'attributes':_0x391559['attributes'],'include':_0x391559[_0xff38('0x21')]?_[_0xff38('0x22')](_0x391559[_0xff38('0x21')],function(_0x5b1953){return{'model':db[_0x5b1953['model']],'as':_0x5b1953['as'],'attributes':_0x5b1953['attributes']};}):[]};}):[]};}):[]:[]})[_0xff38('0x11')](function(_0x4e241d){logger[_0xff38('0x12')]('GetFaxAccount',_0x3de8cd);logger[_0xff38('0x15')](_0xff38('0x1b'),_0x3de8cd,JSON[_0xff38('0x16')](_0x4e241d));_0x23b93c(_0x4e241d);})[_0xff38('0x24')](function(_0x16bdeb){logger[_0xff38('0x17')]('GetFaxAccount',_0x16bdeb[_0xff38('0x19')],_0x3de8cd);_0x3deea7(_0x1ed2df[_0xff38('0x17')](0x1f4,_0x16bdeb['message']));});});};exports[_0xff38('0x25')]=function(_0x56d732,_0x4e1923,_0x290799){var _0x5c5a65=this;return new Promise(function(_0x34c420,_0x51df3f){var _0x336094={'body':_0x56d732[_0xff38('0x26')],'channel':_0xff38('0x27')};var _0x4747b0=[];var _0x11da76=[];var _0x7c30dc={};return db['CmContact'][_0xff38('0x28')]()['then'](function(_0x19fd9d){if(!_0x19fd9d){throw new db[(_0xff38('0x29'))][(_0xff38('0x2a'))](_0xff38('0x2b'));}_0x4747b0=_[_0xff38('0x2c')](_[_0xff38('0x2d')](_0x19fd9d),[_0xff38('0x2e'),_0xff38('0x2f')]);_0x11da76=_['difference'](_[_0xff38('0x2d')](_0x19fd9d),[_0xff38('0x2e'),'updatedAt','CompanyId','ListId']);if(_0x56d732[_0xff38('0x26')]['id']){delete _0x56d732['body']['id'];}if(_[_0xff38('0x30')](_0x56d732[_0xff38('0x26')]['from'])){throw new db[(_0xff38('0x29'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xff38('0x30')](_0x56d732[_0xff38('0x26')]['body'])||_0x56d732['body']['body']===''){throw new db[(_0xff38('0x29'))][(_0xff38('0x2a'))](_0xff38('0x31'));}if(_['isNil'](_0x56d732[_0xff38('0x26')][_0xff38('0x32')])){throw new db[(_0xff38('0x29'))]['ValidationError'](_0xff38('0x33')+_0x11da76);}if(!_[_0xff38('0x34')](_0x11da76,_0x56d732[_0xff38('0x26')][_0xff38('0x32')])){throw new db[(_0xff38('0x29'))][(_0xff38('0x2a'))](_0xff38('0x35')+_0x11da76);}_0x7c30dc[_0x56d732[_0xff38('0x26')][_0xff38('0x32')]]=_0x56d732[_0xff38('0x26')]['from'];})[_0xff38('0x11')](function(){return db[_0xff38('0x1c')][_0xff38('0x36')]({'where':{'id':_0x56d732[_0xff38('0x37')]['id']},'include':[{'model':db[_0xff38('0x38')],'as':_0xff38('0x39'),'include':[{'model':db['CmContact'],'as':_0xff38('0x3a'),'where':_0x7c30dc,'limit':0x1,'order':[[_0xff38('0x2f'),_0xff38('0x3b')]]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})['then'](function(_0x396db6){if(_0x396db6&&_0x396db6[_0xff38('0x39')]){var _0x20769f=_0x396db6[_0xff38('0x3c')]({'plain':!![]});_0x336094[_0xff38('0x37')]=_0x20769f;_0x336094[_0xff38('0x3d')]=_0x20769f[_0xff38('0x3e')];_0x336094['list']=_0x20769f['List'];_0x336094[_0xff38('0x3d')]=_[_0xff38('0x3f')](_0x336094[_0xff38('0x3d')],[_0xff38('0x40')],['asc']);if(_0x336094[_0xff38('0x37')]['Applications']){delete _0x336094[_0xff38('0x37')]['Applications'];}if(_0x336094[_0xff38('0x37')][_0xff38('0x39')]&&_0x336094[_0xff38('0x37')][_0xff38('0x39')]['Contacts'][_0xff38('0x41')]){return _0x336094[_0xff38('0x37')]['List'][_0xff38('0x3a')][0x0];}var _0x5eccbf=_[_0xff38('0xd')](_0x56d732[_0xff38('0x26')],{'firstName':_0x56d732[_0xff38('0x26')][_0xff38('0x42')],'ListId':_0x20769f[_0xff38('0x43')]});_0x5eccbf[_0x56d732['body']['mapKey']]=_0x56d732[_0xff38('0x26')]['from'];return db['CmContact'][_0xff38('0x44')](_0x5eccbf,{'fields':_0x4747b0,'raw':!![]});}})[_0xff38('0x11')](function(_0x46493c){_0x336094['contact']=_0x46493c;if(_0x46493c){var _0x7aa341={'ContactId':_0x46493c['id'],'FaxAccountId':_0x56d732[_0xff38('0x37')]['id'],'fax':_0x46493c[_0xff38('0x27')]};return db[_0xff38('0x45')][_0xff38('0x36')]({'where':{'ContactId':_0x46493c['id'],'closed':![],'FaxAccountId':_0x56d732[_0xff38('0x37')]['id']}})[_0xff38('0x11')](function(_0x5c0833){if(_0x5c0833){return[_0x5c0833,![]];}return db[_0xff38('0x45')][_0xff38('0x44')](_0x7aa341)[_0xff38('0x11')](function(_0x8db4ae){return[_0x8db4ae,!![]];});});}else{throw new Error(_0xff38('0x46'));}})[_0xff38('0x47')](function(_0x3ac084,_0x6be8bf){var _0x56d7ce=_0x3ac084[_0xff38('0x3c')]({'plain':!![]});if(_0x6be8bf){if(_0x336094[_0xff38('0x37')][_0xff38('0x48')]){_0x336094['applications'][_0xff38('0x49')]({'id':0x0,'priority':_0x336094[_0xff38('0x3d')][_0xff38('0x41')]+0x1,'app':'close','appdata':_0xff38('0x4a'),'interval':_0xff38('0x4b')});}_0x56d7ce[_0xff38('0x4c')]=!![];}else{_0x56d7ce[_0xff38('0x4c')]=![];}_0x336094[_0xff38('0x4d')]=_0x56d7ce;return db[_0xff38('0x4e')]['create']({'body':_0x56d732[_0xff38('0x26')][_0xff38('0x26')],'FaxAccountId':_0x56d732['account']['id'],'FaxInteractionId':_0x3ac084['id'],'direction':'in','ContactId':_0x3ac084[_0xff38('0x4f')],'AttachmentId':_0x56d732[_0xff38('0x26')]['AttachmentId']});})['then'](function(_0x914e3d){_0x336094[_0xff38('0x19')]=_0x914e3d;if(_0x336094[_0xff38('0x4d')]['UserId']){return db[_0xff38('0x50')][_0xff38('0x36')]({'attributes':['id','name'],'where':{'id':_0x336094[_0xff38('0x4d')]['UserId']}})[_0xff38('0x11')](function(_0x51dc34){if(_0x51dc34){_0x336094[_0xff38('0x3d')][_0xff38('0x51')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x51dc34[_0xff38('0x52')]+','+(_0x336094[_0xff38('0x37')]['waitForTheAssignedAgent']||0xa),'interval':_0xff38('0x4b')});}return respondWithRpcPromise(_0xff38('0x53'),'startRouting',_0x336094);});}return respondWithRpcPromise(_0xff38('0x53'),_0xff38('0x54'),_0x336094);})['then'](function(_0x5695cf){_0x34c420(_0x5695cf);})[_0xff38('0x24')](function(_0x15af19){_0x51df3f(_0x5c5a65[_0xff38('0x17')](0x1f4,_0x15af19[_0xff38('0x19')]));});});}; \ No newline at end of file +var _0x3e33=['updatedAt','DESC','Applications','applications','orderBy','priority','create','fax','FaxInteraction','Contact\x20not\x20found','spread','get','autoclose','push','length','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','User','name','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetFaxAccount','FaxAccount','options','raw','where','attributes','include','map','model','then','debug','catch','NotifyFaxAccount','body','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','CmContact','Contacts'];(function(_0x34c063,_0x11d3d7){var _0x2c63a3=function(_0x5983d0){while(--_0x5983d0){_0x34c063['push'](_0x34c063['shift']());}};_0x2c63a3(++_0x11d3d7);}(_0x3e33,0x128));var _0x33e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e33[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x33e3('0x0'));var moment=require(_0x33e3('0x1'));var BPromise=require(_0x33e3('0x2'));var rs=require(_0x33e3('0x3'));var fs=require('fs');var Redis=require(_0x33e3('0x4'));var db=require(_0x33e3('0x5'))['db'];var utils=require(_0x33e3('0x6'));var logger=require('../../config/logger')(_0x33e3('0x7'));var config=require(_0x33e3('0x8'));var jayson=require(_0x33e3('0x9'));var client=jayson[_0x33e3('0xa')][_0x33e3('0xb')]({'port':0x232c});config[_0x33e3('0xc')]=_[_0x33e3('0xd')](config[_0x33e3('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x33e3('0xc')]));require(_0x33e3('0xe'))[_0x33e3('0xf')](socket);function respondWithRpcPromise(_0xd14156,_0x1258c6,_0x38b6be){return new BPromise(function(_0x544612,_0x45aaa3){return client[_0x33e3('0x10')](_0xd14156,_0x38b6be)['then'](function(_0x540737){logger[_0x33e3('0x11')](_0x33e3('0x12'),_0x1258c6,_0x33e3('0x13'));logger['debug'](_0x33e3('0x14'),_0x1258c6,'request\x20sent',JSON[_0x33e3('0x15')](_0x540737));if(_0x540737[_0x33e3('0x16')]){if(_0x540737[_0x33e3('0x16')]['code']===0x1f4){logger[_0x33e3('0x16')](_0x33e3('0x12'),_0x1258c6,_0x540737[_0x33e3('0x16')]['message']);return _0x45aaa3(_0x540737[_0x33e3('0x16')]['message']);}logger[_0x33e3('0x16')](_0x33e3('0x12'),_0x1258c6,_0x540737[_0x33e3('0x16')][_0x33e3('0x17')]);return _0x544612(_0x540737[_0x33e3('0x16')][_0x33e3('0x17')]);}else{logger[_0x33e3('0x11')]('FaxAccount,\x20%s,\x20%s',_0x1258c6,_0x33e3('0x13'));_0x544612(_0x540737[_0x33e3('0x18')][_0x33e3('0x17')]);}})['catch'](function(_0x5ad9bb){logger[_0x33e3('0x16')](_0x33e3('0x12'),_0x1258c6,_0x5ad9bb);_0x45aaa3(_0x5ad9bb);});});}exports[_0x33e3('0x19')]=function(_0x54e3d7){var _0x36eb84=this;return new Promise(function(_0x12eef8,_0x8adc25){return db[_0x33e3('0x1a')]['findAll']({'raw':_0x54e3d7['options']?_0x54e3d7[_0x33e3('0x1b')][_0x33e3('0x1c')]===undefined?!![]:![]:!![],'where':_0x54e3d7[_0x33e3('0x1b')]?_0x54e3d7[_0x33e3('0x1b')][_0x33e3('0x1d')]||null:null,'attributes':_0x54e3d7['options']?_0x54e3d7[_0x33e3('0x1b')][_0x33e3('0x1e')]||null:null,'limit':_0x54e3d7[_0x33e3('0x1b')]?_0x54e3d7['options']['limit']||null:null,'include':_0x54e3d7[_0x33e3('0x1b')]?_0x54e3d7[_0x33e3('0x1b')][_0x33e3('0x1f')]?_[_0x33e3('0x20')](_0x54e3d7[_0x33e3('0x1b')][_0x33e3('0x1f')],function(_0x45b8a3){return{'model':db[_0x45b8a3[_0x33e3('0x21')]],'as':_0x45b8a3['as'],'attributes':_0x45b8a3['attributes'],'include':_0x45b8a3['include']?_[_0x33e3('0x20')](_0x45b8a3[_0x33e3('0x1f')],function(_0x2ba77e){return{'model':db[_0x2ba77e[_0x33e3('0x21')]],'as':_0x2ba77e['as'],'attributes':_0x2ba77e['attributes'],'include':_0x2ba77e['include']?_[_0x33e3('0x20')](_0x2ba77e['include'],function(_0x1d7bb5){return{'model':db[_0x1d7bb5['model']],'as':_0x1d7bb5['as'],'attributes':_0x1d7bb5['attributes']};}):[]};}):[]};}):[]:[]})[_0x33e3('0x22')](function(_0x14d24d){logger[_0x33e3('0x11')](_0x33e3('0x19'),_0x54e3d7);logger[_0x33e3('0x23')]('GetFaxAccount',_0x54e3d7,JSON['stringify'](_0x14d24d));_0x12eef8(_0x14d24d);})[_0x33e3('0x24')](function(_0x51c33a){logger[_0x33e3('0x16')](_0x33e3('0x19'),_0x51c33a['message'],_0x54e3d7);_0x8adc25(_0x36eb84[_0x33e3('0x16')](0x1f4,_0x51c33a[_0x33e3('0x17')]));});});};exports[_0x33e3('0x25')]=function(_0x4199b3,_0x3d47a6,_0x189b11){var _0x3efe94=this;return new Promise(function(_0x41a445,_0x83399c){var _0x265435={'body':_0x4199b3[_0x33e3('0x26')],'channel':'fax'};var _0x53dddc=[];var _0x1d695c=[];var _0x308325={};return db['CmContact'][_0x33e3('0x27')]()[_0x33e3('0x22')](function(_0x27b321){if(!_0x27b321){throw new db[(_0x33e3('0x28'))][(_0x33e3('0x29'))](_0x33e3('0x2a'));}_0x53dddc=_[_0x33e3('0x2b')](_[_0x33e3('0x2c')](_0x27b321),[_0x33e3('0x2d'),'updatedAt']);_0x1d695c=_[_0x33e3('0x2b')](_[_0x33e3('0x2c')](_0x27b321),[_0x33e3('0x2d'),'updatedAt',_0x33e3('0x2e'),_0x33e3('0x2f')]);if(_0x4199b3['body']['id']){delete _0x4199b3[_0x33e3('0x26')]['id'];}if(_[_0x33e3('0x30')](_0x4199b3[_0x33e3('0x26')][_0x33e3('0x31')])){throw new db[(_0x33e3('0x28'))][(_0x33e3('0x29'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x4199b3[_0x33e3('0x26')][_0x33e3('0x26')])||_0x4199b3[_0x33e3('0x26')][_0x33e3('0x26')]===''){throw new db[(_0x33e3('0x28'))][(_0x33e3('0x29'))](_0x33e3('0x32'));}if(_[_0x33e3('0x30')](_0x4199b3[_0x33e3('0x26')][_0x33e3('0x33')])){throw new db[(_0x33e3('0x28'))]['ValidationError'](_0x33e3('0x34')+_0x1d695c);}if(!_['includes'](_0x1d695c,_0x4199b3['body']['mapKey'])){throw new db[(_0x33e3('0x28'))]['ValidationError'](_0x33e3('0x35')+_0x1d695c);}_0x308325[_0x4199b3[_0x33e3('0x26')][_0x33e3('0x33')]]=_0x4199b3[_0x33e3('0x26')][_0x33e3('0x31')];})['then'](function(){return db[_0x33e3('0x1a')][_0x33e3('0x36')]({'where':{'id':_0x4199b3[_0x33e3('0x37')]['id']},'include':[{'model':db[_0x33e3('0x38')],'as':_0x33e3('0x39'),'include':[{'model':db[_0x33e3('0x3a')],'as':_0x33e3('0x3b'),'where':_0x308325,'limit':0x1,'order':[[_0x33e3('0x3c'),_0x33e3('0x3d')]]}]},{'model':db['FaxApplication'],'as':_0x33e3('0x3e')}]});})[_0x33e3('0x22')](function(_0x42fa8a){if(_0x42fa8a&&_0x42fa8a['List']){var _0xf032f9=_0x42fa8a['get']({'plain':!![]});_0x265435[_0x33e3('0x37')]=_0xf032f9;_0x265435[_0x33e3('0x3f')]=_0xf032f9[_0x33e3('0x3e')];_0x265435['list']=_0xf032f9[_0x33e3('0x39')];_0x265435['applications']=_[_0x33e3('0x40')](_0x265435[_0x33e3('0x3f')],[_0x33e3('0x41')],['asc']);if(_0x265435[_0x33e3('0x37')]['Applications']){delete _0x265435[_0x33e3('0x37')]['Applications'];}if(_0x265435[_0x33e3('0x37')][_0x33e3('0x39')]&&_0x265435['account'][_0x33e3('0x39')][_0x33e3('0x3b')]['length']){return _0x265435[_0x33e3('0x37')][_0x33e3('0x39')][_0x33e3('0x3b')][0x0];}var _0x281fe4=_[_0x33e3('0xd')](_0x4199b3[_0x33e3('0x26')],{'firstName':_0x4199b3[_0x33e3('0x26')][_0x33e3('0x31')],'ListId':_0xf032f9[_0x33e3('0x2f')]});_0x281fe4[_0x4199b3[_0x33e3('0x26')]['mapKey']]=_0x4199b3[_0x33e3('0x26')]['from'];return db[_0x33e3('0x3a')][_0x33e3('0x42')](_0x281fe4,{'fields':_0x53dddc,'raw':!![]});}})[_0x33e3('0x22')](function(_0x462f75){_0x265435['contact']=_0x462f75;if(_0x462f75){var _0x499964={'ContactId':_0x462f75['id'],'FaxAccountId':_0x4199b3['account']['id'],'fax':_0x462f75[_0x33e3('0x43')]};return db[_0x33e3('0x44')][_0x33e3('0x36')]({'where':{'ContactId':_0x462f75['id'],'closed':![],'FaxAccountId':_0x4199b3[_0x33e3('0x37')]['id']}})[_0x33e3('0x22')](function(_0x270d7f){if(_0x270d7f){return[_0x270d7f,![]];}return db[_0x33e3('0x44')][_0x33e3('0x42')](_0x499964)[_0x33e3('0x22')](function(_0x3f3139){return[_0x3f3139,!![]];});});}else{throw new Error(_0x33e3('0x45'));}})[_0x33e3('0x46')](function(_0x5e8b62,_0x28a208){var _0x5710ae=_0x5e8b62[_0x33e3('0x47')]({'plain':!![]});if(_0x28a208){if(_0x265435[_0x33e3('0x37')][_0x33e3('0x48')]){_0x265435[_0x33e3('0x3f')][_0x33e3('0x49')]({'id':0x0,'priority':_0x265435[_0x33e3('0x3f')][_0x33e3('0x4a')]+0x1,'app':'close','appdata':_0x33e3('0x4b'),'interval':_0x33e3('0x4c')});}_0x5710ae[_0x33e3('0x4d')]=!![];}else{_0x5710ae[_0x33e3('0x4d')]=![];}_0x265435[_0x33e3('0x4e')]=_0x5710ae;return db[_0x33e3('0x4f')]['create']({'body':_0x4199b3[_0x33e3('0x26')]['body'],'FaxAccountId':_0x4199b3['account']['id'],'FaxInteractionId':_0x5e8b62['id'],'direction':'in','ContactId':_0x5e8b62['ContactId'],'AttachmentId':_0x4199b3[_0x33e3('0x26')][_0x33e3('0x50')]});})['then'](function(_0x1cbee7){_0x265435[_0x33e3('0x17')]=_0x1cbee7;if(_0x265435[_0x33e3('0x4e')]['UserId']){return db[_0x33e3('0x51')][_0x33e3('0x36')]({'attributes':['id',_0x33e3('0x52')],'where':{'id':_0x265435['interaction'][_0x33e3('0x53')]}})['then'](function(_0x3b9fad){if(_0x3b9fad){_0x265435[_0x33e3('0x3f')][_0x33e3('0x54')]({'id':0x0,'priority':0x0,'app':_0x33e3('0x55'),'appdata':_0x3b9fad['name']+','+(_0x265435[_0x33e3('0x37')][_0x33e3('0x56')]||0xa),'interval':_0x33e3('0x4c')});}return respondWithRpcPromise(_0x33e3('0x57'),'startRouting',_0x265435);});}return respondWithRpcPromise(_0x33e3('0x57'),_0x33e3('0x58'),_0x265435);})[_0x33e3('0x22')](function(_0x4f559c){_0x41a445(_0x4f559c);})[_0x33e3('0x24')](function(_0xadfaf4){_0x83399c(_0x3efe94[_0x33e3('0x16')](0x1f4,_0xadfaf4[_0x33e3('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 0b5def6..2feb783 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 _0xf47e=['emit','removeListener','register','length','./faxAccount.events','save','update'];(function(_0xef50c7,_0x427114){var _0x273da8=function(_0x2a764e){while(--_0x2a764e){_0xef50c7['push'](_0xef50c7['shift']());}};_0x273da8(++_0x427114);}(_0xf47e,0xb3));var _0xef47=function(_0x35d325,_0x53e5ea){_0x35d325=_0x35d325-0x0;var _0x2b1eda=_0xf47e[_0x35d325];return _0x2b1eda;};'use strict';var FaxAccountEvents=require(_0xef47('0x0'));var events=[_0xef47('0x1'),'remove',_0xef47('0x2')];function createListener(_0x4b8dd2,_0x583478){return function(_0x2805e7){_0x583478[_0xef47('0x3')](_0x4b8dd2,_0x2805e7);};}function removeListener(_0x2178e8,_0x71a47c){return function(){FaxAccountEvents[_0xef47('0x4')](_0x2178e8,_0x71a47c);};}exports[_0xef47('0x5')]=function(_0x5ce77e){for(var _0x176da1=0x0,_0x5a9950=events[_0xef47('0x6')];_0x176da1<_0x5a9950;_0x176da1++){var _0xb99bbc=events[_0x176da1];var _0x291a7e=createListener('faxAccount:'+_0xb99bbc,_0x5ce77e);FaxAccountEvents['on'](_0xb99bbc,_0x291a7e);}}; \ No newline at end of file +var _0xf095=['save','remove','removeListener','register','length','faxAccount:','./faxAccount.events'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf095,0x8b));var _0x5f09=function(_0x3256c6,_0x3166f8){_0x3256c6=_0x3256c6-0x0;var _0x19ae14=_0xf095[_0x3256c6];return _0x19ae14;};'use strict';var FaxAccountEvents=require(_0x5f09('0x0'));var events=[_0x5f09('0x1'),_0x5f09('0x2'),'update'];function createListener(_0x409c91,_0x28d28a){return function(_0x4f4d74){_0x28d28a['emit'](_0x409c91,_0x4f4d74);};}function removeListener(_0x7b22bf,_0x2365e4){return function(){FaxAccountEvents[_0x5f09('0x3')](_0x7b22bf,_0x2365e4);};}exports[_0x5f09('0x4')]=function(_0x22d3f3){for(var _0x59bb98=0x0,_0xef257b=events[_0x5f09('0x5')];_0x59bb98<_0xef257b;_0x59bb98++){var _0x2d9752=events[_0x59bb98];var _0x310712=createListener(_0x5f09('0x6')+_0x2d9752,_0x22d3f3);FaxAccountEvents['on'](_0x2d9752,_0x310712);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 93fa2a9..8e4267a 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(_0x19c75a,_0x5fde73){var _0xe51d07=function(_0x49b7e1){while(--_0x49b7e1){_0x19c75a['push'](_0x19c75a['shift']());}};_0xe51d07(++_0x5fde73);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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(_0x10037e,_0x28b6bd){var _0x371d49=function(_0x3b73dd){while(--_0x3b73dd){_0x10037e['push'](_0x10037e['shift']());}};_0x371d49(++_0x28b6bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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 a3abbb7..8f58075 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 _0x3e76=['*,*,*,*','exports','INTEGER','TEXT','STRING'];(function(_0x5e3b8b,_0x4e6187){var _0xb97e7e=function(_0x5e60c3){while(--_0x5e60c3){_0x5e3b8b['push'](_0x5e3b8b['shift']());}};_0xb97e7e(++_0x4e6187);}(_0x3e76,0x137));var _0x63e7=function(_0x460150,_0x232949){_0x460150=_0x460150-0x0;var _0x340677=_0x3e76[_0x460150];return _0x340677;};'use strict';var Sequelize=require('sequelize');module[_0x63e7('0x0')]={'priority':{'type':Sequelize[_0x63e7('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x63e7('0x2')]()},'description':{'type':Sequelize[_0x63e7('0x3')]},'interval':{'type':Sequelize[_0x63e7('0x3')],'defaultValue':_0x63e7('0x4')}}; \ No newline at end of file +var _0x8863=['STRING','noop','exports','INTEGER'];(function(_0x104359,_0x1fdb82){var _0x8a2a98=function(_0x27842d){while(--_0x27842d){_0x104359['push'](_0x104359['shift']());}};_0x8a2a98(++_0x1fdb82);}(_0x8863,0x1b6));var _0x3886=function(_0xa7c05d,_0x312374){_0xa7c05d=_0xa7c05d-0x0;var _0x47b002=_0x8863[_0xa7c05d];return _0x47b002;};'use strict';var Sequelize=require('sequelize');module[_0x3886('0x0')]={'priority':{'type':Sequelize[_0x3886('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x3886('0x2')],'allowNull':![],'defaultValue':_0x3886('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index b544dac..84a1b01 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 _0xd313=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','apply','reject','update','then','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','FaxApplication','includeAll','include','findAll','show','params','length','find','catch','create','body','destroy','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x5ce268,_0x1835b6){var _0x28c96a=function(_0x18c1d6){while(--_0x18c1d6){_0x5ce268['push'](_0x5ce268['shift']());}};_0x28c96a(++_0x1835b6);}(_0xd313,0x19c));var _0x3d31=function(_0x571e32,_0x5a76be){_0x571e32=_0x571e32-0x0;var _0x1a4df3=_0xd313[_0x571e32];return _0x1a4df3;};'use strict';var emlformat=require(_0x3d31('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3d31('0x1'));var rp=require(_0x3d31('0x2'));var moment=require('moment');var BPromise=require(_0x3d31('0x3'));var Mustache=require('mustache');var util=require(_0x3d31('0x4'));var path=require(_0x3d31('0x5'));var sox=require(_0x3d31('0x6'));var csv=require('to-csv');var ejs=require(_0x3d31('0x7'));var fs=require('fs');var fs_extra=require(_0x3d31('0x8'));var _=require('lodash');var squel=require(_0x3d31('0x9'));var crypto=require(_0x3d31('0xa'));var jsforce=require(_0x3d31('0xb'));var deskjs=require(_0x3d31('0xc'));var toCsv=require(_0x3d31('0xd'));var querystring=require('querystring');var Papa=require(_0x3d31('0xe'));var Redis=require(_0x3d31('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3d31('0x10'));var as=require(_0x3d31('0x11'));var hardwareService=require(_0x3d31('0x12'));var logger=require(_0x3d31('0x13'))(_0x3d31('0x14'));var utils=require(_0x3d31('0x15'));var config=require(_0x3d31('0x16'));var licenseUtil=require(_0x3d31('0x17'));var db=require(_0x3d31('0x18'))['db'];function respondWithStatusCode(_0x32c963,_0x357b34){_0x357b34=_0x357b34||0xcc;return function(_0x2c086f){if(_0x2c086f){return _0x32c963[_0x3d31('0x19')](_0x357b34);}return _0x32c963['status'](_0x357b34)[_0x3d31('0x1a')]();};}function respondWithResult(_0x5aae5e,_0x5cf671){_0x5cf671=_0x5cf671||0xc8;return function(_0x14bf0d){if(_0x14bf0d){return _0x5aae5e[_0x3d31('0x1b')](_0x5cf671)['json'](_0x14bf0d);}};}function respondWithFilteredResult(_0x166135,_0xb1d661){return function(_0x1c7632){if(_0x1c7632){var _0x197c94=typeof _0xb1d661[_0x3d31('0x1c')]===_0x3d31('0x1d')&&typeof _0xb1d661[_0x3d31('0x1e')]===_0x3d31('0x1d');var _0x57ab71=_0x1c7632[_0x3d31('0x1f')];var _0x39f9b6=_0x197c94?0x0:_0xb1d661['offset'];var _0xf44b2c=_0x197c94?_0x1c7632['count']:_0xb1d661[_0x3d31('0x1c')]+_0xb1d661[_0x3d31('0x1e')];var _0x4f06bd;if(_0xf44b2c>=_0x57ab71){_0xf44b2c=_0x57ab71;_0x4f06bd=0xc8;}else{_0x4f06bd=0xce;}_0x166135[_0x3d31('0x1b')](_0x4f06bd);return _0x166135[_0x3d31('0x20')]('Content-Range',_0x39f9b6+'-'+_0xf44b2c+'/'+_0x57ab71)['json'](_0x1c7632);}return null;};}function patchUpdates(_0x51b53a){return function(_0x49081e){try{jsonpatch[_0x3d31('0x21')](_0x49081e,_0x51b53a,!![]);}catch(_0x209baf){return BPromise[_0x3d31('0x22')](_0x209baf);}return _0x49081e['save']();};}function saveUpdates(_0x2728f5,_0x1334e3){return function(_0xaad7fd){if(_0xaad7fd){return _0xaad7fd[_0x3d31('0x23')](_0x2728f5)[_0x3d31('0x24')](function(_0x1c2431){return _0x1c2431;});}return null;};}function removeEntity(_0x26fd6f,_0x2a359a){return function(_0x49aba5){if(_0x49aba5){return _0x49aba5['destroy']()[_0x3d31('0x24')](function(){_0x26fd6f[_0x3d31('0x1b')](0xcc)[_0x3d31('0x1a')]();});}};}function handleEntityNotFound(_0x4d1931,_0x362380){return function(_0x5930cf){if(!_0x5930cf){_0x4d1931[_0x3d31('0x19')](0x194);}return _0x5930cf;};}function handleError(_0x19b5ce,_0x18576f){_0x18576f=_0x18576f||0x1f4;return function(_0x3f014f){logger['error'](_0x3f014f[_0x3d31('0x25')]);if(_0x3f014f['name']){delete _0x3f014f[_0x3d31('0x26')];}_0x19b5ce[_0x3d31('0x1b')](_0x18576f)[_0x3d31('0x27')](_0x3f014f);};}exports['index']=function(_0x272394,_0x2d2ae6){var _0x363615={},_0x19bdf4={},_0x3ca6e2={'count':0x0,'rows':[]};var _0x392f5e=_['map'](db['FaxApplication'][_0x3d31('0x28')],function(_0x657310){return{'name':_0x657310[_0x3d31('0x29')],'type':_0x657310[_0x3d31('0x2a')][_0x3d31('0x2b')]};});_0x19bdf4[_0x3d31('0x2c')]=_[_0x3d31('0x2d')](_0x392f5e,_0x3d31('0x26'));_0x19bdf4[_0x3d31('0x2e')]=_[_0x3d31('0x2f')](_0x272394[_0x3d31('0x2e')]);_0x19bdf4[_0x3d31('0x30')]=_[_0x3d31('0x31')](_0x19bdf4[_0x3d31('0x2c')],_0x19bdf4['query']);_0x363615[_0x3d31('0x32')]=_[_0x3d31('0x31')](_0x19bdf4[_0x3d31('0x2c')],qs['fields'](_0x272394['query'][_0x3d31('0x33')]));_0x363615[_0x3d31('0x32')]=_0x363615[_0x3d31('0x32')]['length']?_0x363615[_0x3d31('0x32')]:_0x19bdf4[_0x3d31('0x2c')];if(!_0x272394[_0x3d31('0x2e')][_0x3d31('0x34')](_0x3d31('0x35'))){_0x363615['limit']=qs[_0x3d31('0x1e')](_0x272394[_0x3d31('0x2e')]['limit']);_0x363615['offset']=qs[_0x3d31('0x1c')](_0x272394['query']['offset']);}_0x363615['order']=qs[_0x3d31('0x36')](_0x272394[_0x3d31('0x2e')][_0x3d31('0x36')]);_0x363615[_0x3d31('0x37')]=qs[_0x3d31('0x30')](_[_0x3d31('0x38')](_0x272394[_0x3d31('0x2e')],_0x19bdf4['filters']),_0x392f5e);if(_0x272394[_0x3d31('0x2e')]['filter']){_0x363615['where']=_[_0x3d31('0x39')](_0x363615[_0x3d31('0x37')],{'$or':_['map'](_0x392f5e,function(_0x2fbd0c){if(_0x2fbd0c[_0x3d31('0x2a')]!==_0x3d31('0x3a')){var _0x2b42e8={};_0x2b42e8[_0x2fbd0c[_0x3d31('0x26')]]={'$like':'%'+_0x272394['query']['filter']+'%'};return _0x2b42e8;}})});}_0x363615=_['merge']({},_0x363615,_0x272394[_0x3d31('0x3b')]);var _0x3c98f5={'where':_0x363615[_0x3d31('0x37')]};return db[_0x3d31('0x3c')][_0x3d31('0x1f')](_0x3c98f5)[_0x3d31('0x24')](function(_0x80ec33){_0x3ca6e2[_0x3d31('0x1f')]=_0x80ec33;if(_0x272394[_0x3d31('0x2e')][_0x3d31('0x3d')]){_0x363615[_0x3d31('0x3e')]=[{'all':!![]}];}return db[_0x3d31('0x3c')][_0x3d31('0x3f')](_0x363615);})['then'](function(_0x55e761){_0x3ca6e2['rows']=_0x55e761;return _0x3ca6e2;})[_0x3d31('0x24')](respondWithFilteredResult(_0x2d2ae6,_0x363615))['catch'](handleError(_0x2d2ae6,null));};exports[_0x3d31('0x40')]=function(_0x2193ef,_0x5e942d){var _0x3eb7c0={'raw':!![],'where':{'id':_0x2193ef[_0x3d31('0x41')]['id']}},_0x11d430={};_0x11d430['model']=_[_0x3d31('0x2f')](db[_0x3d31('0x3c')][_0x3d31('0x28')]);_0x11d430[_0x3d31('0x2e')]=_[_0x3d31('0x2f')](_0x2193ef[_0x3d31('0x2e')]);_0x11d430['filters']=_[_0x3d31('0x31')](_0x11d430[_0x3d31('0x2c')],_0x11d430[_0x3d31('0x2e')]);_0x3eb7c0[_0x3d31('0x32')]=_[_0x3d31('0x31')](_0x11d430['model'],qs[_0x3d31('0x33')](_0x2193ef[_0x3d31('0x2e')]['fields']));_0x3eb7c0[_0x3d31('0x32')]=_0x3eb7c0[_0x3d31('0x32')][_0x3d31('0x42')]?_0x3eb7c0[_0x3d31('0x32')]:_0x11d430['model'];if(_0x2193ef[_0x3d31('0x2e')][_0x3d31('0x3d')]){_0x3eb7c0[_0x3d31('0x3e')]=[{'all':!![]}];}_0x3eb7c0=_[_0x3d31('0x39')]({},_0x3eb7c0,_0x2193ef[_0x3d31('0x3b')]);return db['FaxApplication'][_0x3d31('0x43')](_0x3eb7c0)[_0x3d31('0x24')](handleEntityNotFound(_0x5e942d,null))[_0x3d31('0x24')](respondWithResult(_0x5e942d,null))[_0x3d31('0x44')](handleError(_0x5e942d,null));};exports[_0x3d31('0x45')]=function(_0x2cc80b,_0x4e7458){return db['FaxApplication'][_0x3d31('0x45')](_0x2cc80b[_0x3d31('0x46')],{})[_0x3d31('0x24')](respondWithResult(_0x4e7458,0xc9))[_0x3d31('0x44')](handleError(_0x4e7458,null));};exports[_0x3d31('0x23')]=function(_0x5d681d,_0x376c7e){if(_0x5d681d[_0x3d31('0x46')]['id']){delete _0x5d681d[_0x3d31('0x46')]['id'];}return db['FaxApplication'][_0x3d31('0x43')]({'where':{'id':_0x5d681d[_0x3d31('0x41')]['id']}})[_0x3d31('0x24')](handleEntityNotFound(_0x376c7e,null))[_0x3d31('0x24')](saveUpdates(_0x5d681d[_0x3d31('0x46')],null))['then'](respondWithResult(_0x376c7e,null))[_0x3d31('0x44')](handleError(_0x376c7e,null));};exports[_0x3d31('0x47')]=function(_0x156871,_0x211340){return db[_0x3d31('0x3c')][_0x3d31('0x43')]({'where':{'id':_0x156871[_0x3d31('0x41')]['id']}})[_0x3d31('0x24')](handleEntityNotFound(_0x211340,null))[_0x3d31('0x24')](removeEntity(_0x211340,null))['catch'](handleError(_0x211340,null));}; \ No newline at end of file +var _0x2e2a=['includeAll','findAll','catch','params','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','status','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options'];(function(_0x905f99,_0x2bf5ca){var _0x104f6a=function(_0x5991a5){while(--_0x5991a5){_0x905f99['push'](_0x905f99['shift']());}};_0x104f6a(++_0x2bf5ca);}(_0x2e2a,0x9e));var _0xa2e2=function(_0x5b46be,_0x1b24f1){_0x5b46be=_0x5b46be-0x0;var _0xb01664=_0x2e2a[_0x5b46be];return _0xb01664;};'use strict';var emlformat=require(_0xa2e2('0x0'));var rimraf=require(_0xa2e2('0x1'));var zipdir=require(_0xa2e2('0x2'));var jsonpatch=require(_0xa2e2('0x3'));var rp=require(_0xa2e2('0x4'));var moment=require(_0xa2e2('0x5'));var BPromise=require(_0xa2e2('0x6'));var Mustache=require(_0xa2e2('0x7'));var util=require(_0xa2e2('0x8'));var path=require('path');var sox=require(_0xa2e2('0x9'));var csv=require('to-csv');var ejs=require(_0xa2e2('0xa'));var fs=require('fs');var fs_extra=require(_0xa2e2('0xb'));var _=require(_0xa2e2('0xc'));var squel=require('squel');var crypto=require(_0xa2e2('0xd'));var jsforce=require(_0xa2e2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa2e2('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa2e2('0x10'));var authService=require(_0xa2e2('0x11'));var qs=require(_0xa2e2('0x12'));var as=require(_0xa2e2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa2e2('0x14'));var utils=require('../../config/utils');var config=require(_0xa2e2('0x15'));var licenseUtil=require(_0xa2e2('0x16'));var db=require(_0xa2e2('0x17'))['db'];function respondWithStatusCode(_0x4f3f03,_0x524322){_0x524322=_0x524322||0xcc;return function(_0x3342b0){if(_0x3342b0){return _0x4f3f03[_0xa2e2('0x18')](_0x524322);}return _0x4f3f03['status'](_0x524322)[_0xa2e2('0x19')]();};}function respondWithResult(_0x2e08e3,_0x14b3e3){_0x14b3e3=_0x14b3e3||0xc8;return function(_0xe13d32){if(_0xe13d32){return _0x2e08e3['status'](_0x14b3e3)[_0xa2e2('0x1a')](_0xe13d32);}};}function respondWithFilteredResult(_0x2ca460,_0x33e5c5){return function(_0x435162){if(_0x435162){var _0x3cc381=typeof _0x33e5c5['offset']===_0xa2e2('0x1b')&&typeof _0x33e5c5[_0xa2e2('0x1c')]===_0xa2e2('0x1b');var _0x166cd=_0x435162[_0xa2e2('0x1d')];var _0x38f015=_0x3cc381?0x0:_0x33e5c5[_0xa2e2('0x1e')];var _0x2b184a=_0x3cc381?_0x435162[_0xa2e2('0x1d')]:_0x33e5c5[_0xa2e2('0x1e')]+_0x33e5c5[_0xa2e2('0x1c')];var _0xed1d54;if(_0x2b184a>=_0x166cd){_0x2b184a=_0x166cd;_0xed1d54=0xc8;}else{_0xed1d54=0xce;}_0x2ca460['status'](_0xed1d54);return _0x2ca460[_0xa2e2('0x1f')](_0xa2e2('0x20'),_0x38f015+'-'+_0x2b184a+'/'+_0x166cd)[_0xa2e2('0x1a')](_0x435162);}return null;};}function patchUpdates(_0x41a642){return function(_0x3f85ec){try{jsonpatch[_0xa2e2('0x21')](_0x3f85ec,_0x41a642,!![]);}catch(_0x46c73a){return BPromise['reject'](_0x46c73a);}return _0x3f85ec[_0xa2e2('0x22')]();};}function saveUpdates(_0x1b5761,_0x27cc36){return function(_0x21edb4){if(_0x21edb4){return _0x21edb4[_0xa2e2('0x23')](_0x1b5761)[_0xa2e2('0x24')](function(_0x5c59d3){return _0x5c59d3;});}return null;};}function removeEntity(_0x139d8e,_0x40b6e1){return function(_0x111390){if(_0x111390){return _0x111390[_0xa2e2('0x25')]()[_0xa2e2('0x24')](function(){_0x139d8e[_0xa2e2('0x26')](0xcc)[_0xa2e2('0x19')]();});}};}function handleEntityNotFound(_0x1e5c4c,_0xd00475){return function(_0x22b70d){if(!_0x22b70d){_0x1e5c4c['sendStatus'](0x194);}return _0x22b70d;};}function handleError(_0x1db4e0,_0x389a87){_0x389a87=_0x389a87||0x1f4;return function(_0x52d01e){logger[_0xa2e2('0x27')](_0x52d01e[_0xa2e2('0x28')]);if(_0x52d01e[_0xa2e2('0x29')]){delete _0x52d01e[_0xa2e2('0x29')];}_0x1db4e0[_0xa2e2('0x26')](_0x389a87)[_0xa2e2('0x2a')](_0x52d01e);};}exports[_0xa2e2('0x2b')]=function(_0x11736e,_0x359eb2){var _0xb7ba57={},_0x3165e9={},_0x99bfa7={'count':0x0,'rows':[]};var _0x1eb73c=_[_0xa2e2('0x2c')](db[_0xa2e2('0x2d')][_0xa2e2('0x2e')],function(_0x23d2cc){return{'name':_0x23d2cc[_0xa2e2('0x2f')],'type':_0x23d2cc[_0xa2e2('0x30')]['key']};});_0x3165e9['model']=_[_0xa2e2('0x2c')](_0x1eb73c,_0xa2e2('0x29'));_0x3165e9[_0xa2e2('0x31')]=_[_0xa2e2('0x32')](_0x11736e['query']);_0x3165e9[_0xa2e2('0x33')]=_['intersection'](_0x3165e9[_0xa2e2('0x34')],_0x3165e9[_0xa2e2('0x31')]);_0xb7ba57['attributes']=_[_0xa2e2('0x35')](_0x3165e9[_0xa2e2('0x34')],qs['fields'](_0x11736e[_0xa2e2('0x31')][_0xa2e2('0x36')]));_0xb7ba57[_0xa2e2('0x37')]=_0xb7ba57[_0xa2e2('0x37')][_0xa2e2('0x38')]?_0xb7ba57[_0xa2e2('0x37')]:_0x3165e9[_0xa2e2('0x34')];if(!_0x11736e['query'][_0xa2e2('0x39')](_0xa2e2('0x3a'))){_0xb7ba57[_0xa2e2('0x1c')]=qs[_0xa2e2('0x1c')](_0x11736e[_0xa2e2('0x31')]['limit']);_0xb7ba57['offset']=qs[_0xa2e2('0x1e')](_0x11736e['query']['offset']);}_0xb7ba57[_0xa2e2('0x3b')]=qs[_0xa2e2('0x3c')](_0x11736e[_0xa2e2('0x31')][_0xa2e2('0x3c')]);_0xb7ba57[_0xa2e2('0x3d')]=qs['filters'](_[_0xa2e2('0x3e')](_0x11736e[_0xa2e2('0x31')],_0x3165e9['filters']),_0x1eb73c);if(_0x11736e[_0xa2e2('0x31')]['filter']){_0xb7ba57[_0xa2e2('0x3d')]=_['merge'](_0xb7ba57[_0xa2e2('0x3d')],{'$or':_['map'](_0x1eb73c,function(_0x1ff39d){if(_0x1ff39d['type']!==_0xa2e2('0x3f')){var _0x7c50c0={};_0x7c50c0[_0x1ff39d[_0xa2e2('0x29')]]={'$like':'%'+_0x11736e[_0xa2e2('0x31')][_0xa2e2('0x40')]+'%'};return _0x7c50c0;}})});}_0xb7ba57=_[_0xa2e2('0x41')]({},_0xb7ba57,_0x11736e[_0xa2e2('0x42')]);var _0x1c5208={'where':_0xb7ba57['where']};return db[_0xa2e2('0x2d')]['count'](_0x1c5208)[_0xa2e2('0x24')](function(_0x400d1e){_0x99bfa7[_0xa2e2('0x1d')]=_0x400d1e;if(_0x11736e[_0xa2e2('0x31')][_0xa2e2('0x43')]){_0xb7ba57['include']=[{'all':!![]}];}return db[_0xa2e2('0x2d')][_0xa2e2('0x44')](_0xb7ba57);})['then'](function(_0x180e4e){_0x99bfa7['rows']=_0x180e4e;return _0x99bfa7;})[_0xa2e2('0x24')](respondWithFilteredResult(_0x359eb2,_0xb7ba57))[_0xa2e2('0x45')](handleError(_0x359eb2,null));};exports['show']=function(_0x35875,_0x5156fa){var _0x1ab36e={'raw':!![],'where':{'id':_0x35875[_0xa2e2('0x46')]['id']}},_0x266ba3={};_0x266ba3['model']=_['keys'](db[_0xa2e2('0x2d')][_0xa2e2('0x2e')]);_0x266ba3[_0xa2e2('0x31')]=_[_0xa2e2('0x32')](_0x35875[_0xa2e2('0x31')]);_0x266ba3[_0xa2e2('0x33')]=_[_0xa2e2('0x35')](_0x266ba3[_0xa2e2('0x34')],_0x266ba3[_0xa2e2('0x31')]);_0x1ab36e[_0xa2e2('0x37')]=_['intersection'](_0x266ba3[_0xa2e2('0x34')],qs[_0xa2e2('0x36')](_0x35875[_0xa2e2('0x31')][_0xa2e2('0x36')]));_0x1ab36e[_0xa2e2('0x37')]=_0x1ab36e['attributes'][_0xa2e2('0x38')]?_0x1ab36e[_0xa2e2('0x37')]:_0x266ba3[_0xa2e2('0x34')];if(_0x35875[_0xa2e2('0x31')][_0xa2e2('0x43')]){_0x1ab36e[_0xa2e2('0x47')]=[{'all':!![]}];}_0x1ab36e=_[_0xa2e2('0x41')]({},_0x1ab36e,_0x35875['options']);return db['FaxApplication'][_0xa2e2('0x48')](_0x1ab36e)['then'](handleEntityNotFound(_0x5156fa,null))['then'](respondWithResult(_0x5156fa,null))[_0xa2e2('0x45')](handleError(_0x5156fa,null));};exports[_0xa2e2('0x49')]=function(_0x190a0b,_0x36efd3){return db['FaxApplication'][_0xa2e2('0x49')](_0x190a0b['body'],{})[_0xa2e2('0x24')](respondWithResult(_0x36efd3,0xc9))['catch'](handleError(_0x36efd3,null));};exports[_0xa2e2('0x23')]=function(_0x13a435,_0x13625f){if(_0x13a435[_0xa2e2('0x4a')]['id']){delete _0x13a435[_0xa2e2('0x4a')]['id'];}return db[_0xa2e2('0x2d')][_0xa2e2('0x48')]({'where':{'id':_0x13a435['params']['id']}})[_0xa2e2('0x24')](handleEntityNotFound(_0x13625f,null))[_0xa2e2('0x24')](saveUpdates(_0x13a435['body'],null))[_0xa2e2('0x24')](respondWithResult(_0x13625f,null))[_0xa2e2('0x45')](handleError(_0x13625f,null));};exports[_0xa2e2('0x25')]=function(_0x23e513,_0x52fb66){return db['FaxApplication'][_0xa2e2('0x48')]({'where':{'id':_0x23e513[_0xa2e2('0x46')]['id']}})[_0xa2e2('0x24')](handleEntityNotFound(_0x52fb66,null))[_0xa2e2('0x24')](removeEntity(_0x52fb66,null))[_0xa2e2('0x45')](handleError(_0x52fb66,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index c5095c6..61d696f 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 _0xe7cd=['define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','request-promise','path','../../config/environment','./faxApplication.attributes'];(function(_0xa046e9,_0x34a89e){var _0x4947b8=function(_0x11fbb7){while(--_0x11fbb7){_0xa046e9['push'](_0xa046e9['shift']());}};_0x4947b8(++_0x34a89e);}(_0xe7cd,0x1f3));var _0xde7c=function(_0x40086f,_0x14c27f){_0x40086f=_0x40086f-0x0;var _0x52b273=_0xe7cd[_0x40086f];return _0x52b273;};'use strict';var _=require(_0xde7c('0x0'));var util=require(_0xde7c('0x1'));var logger=require('../../config/logger')(_0xde7c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xde7c('0x3'));var fs=require('fs');var path=require(_0xde7c('0x4'));var rimraf=require('rimraf');var config=require(_0xde7c('0x5'));var attributes=require(_0xde7c('0x6'));module['exports']=function(_0x1e9c11,_0x532c89){return _0x1e9c11[_0xde7c('0x7')]('FaxApplication',attributes,{'tableName':_0xde7c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xde7c('0x9'),'collate':_0xde7c('0xa')});}; \ No newline at end of file +var _0x266c=['define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxApplication.attributes','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x266c,0x170));var _0xc266=function(_0x5c1828,_0x266944){_0x5c1828=_0x5c1828-0x0;var _0x56f0ff=_0x266c[_0x5c1828];return _0x56f0ff;};'use strict';var _=require(_0xc266('0x0'));var util=require(_0xc266('0x1'));var logger=require(_0xc266('0x2'))(_0xc266('0x3'));var moment=require('moment');var BPromise=require(_0xc266('0x4'));var rp=require(_0xc266('0x5'));var fs=require('fs');var path=require(_0xc266('0x6'));var rimraf=require('rimraf');var config=require(_0xc266('0x7'));var attributes=require(_0xc266('0x8'));module[_0xc266('0x9')]=function(_0x188552,_0x2d2fb4){return _0x188552[_0xc266('0xa')]('FaxApplication',attributes,{'tableName':_0xc266('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc266('0xc'),'collate':_0xc266('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 5881d0a..c2cc4fd 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 _0xc83f=['update','body','options','raw','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','UpdateFaxApplication','FaxApplication'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xc83f,0xf6));var _0xfc83=function(_0x4a367f,_0x4e05f2){_0x4a367f=_0x4a367f-0x0;var _0x2bedd5=_0xc83f[_0x4a367f];return _0x2bedd5;};'use strict';var _=require(_0xfc83('0x0'));var util=require(_0xfc83('0x1'));var moment=require('moment');var BPromise=require(_0xfc83('0x2'));var rs=require(_0xfc83('0x3'));var fs=require('fs');var Redis=require(_0xfc83('0x4'));var db=require(_0xfc83('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfc83('0x6'))(_0xfc83('0x7'));var config=require(_0xfc83('0x8'));var jayson=require(_0xfc83('0x9'));var client=jayson[_0xfc83('0xa')][_0xfc83('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29f022,_0x518046,_0xd9862f){return new BPromise(function(_0x2af3d2,_0x4e192a){return client['request'](_0x29f022,_0xd9862f)[_0xfc83('0xc')](function(_0x2322a5){logger['info'](_0xfc83('0xd'),_0x518046,_0xfc83('0xe'));logger[_0xfc83('0xf')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x518046,_0xfc83('0xe'),JSON[_0xfc83('0x10')](_0x2322a5));if(_0x2322a5[_0xfc83('0x11')]){if(_0x2322a5[_0xfc83('0x11')][_0xfc83('0x12')]===0x1f4){logger['error'](_0xfc83('0xd'),_0x518046,_0x2322a5['error'][_0xfc83('0x13')]);return _0x4e192a(_0x2322a5[_0xfc83('0x11')]['message']);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x518046,_0x2322a5[_0xfc83('0x11')][_0xfc83('0x13')]);return _0x2af3d2(_0x2322a5[_0xfc83('0x11')][_0xfc83('0x13')]);}else{logger[_0xfc83('0x14')]('FaxApplication,\x20%s,\x20%s',_0x518046,_0xfc83('0xe'));_0x2af3d2(_0x2322a5['result']['message']);}})[_0xfc83('0x15')](function(_0x335ed1){logger[_0xfc83('0x11')]('FaxApplication,\x20%s,\x20%s',_0x518046,_0x335ed1);_0x4e192a(_0x335ed1);});});}exports[_0xfc83('0x16')]=function(_0x1f7eca){var _0x29f0c7=this;return new Promise(function(_0x1aec02,_0x245424){return db[_0xfc83('0x17')][_0xfc83('0x18')](_0x1f7eca[_0xfc83('0x19')],{'raw':_0x1f7eca['options']?_0x1f7eca[_0xfc83('0x1a')][_0xfc83('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f7eca[_0xfc83('0x1a')]?_0x1f7eca['options']['where']||null:null,'attributes':_0x1f7eca['options']?_0x1f7eca[_0xfc83('0x1a')][_0xfc83('0x1c')]||null:null,'limit':_0x1f7eca['options']?_0x1f7eca[_0xfc83('0x1a')][_0xfc83('0x1d')]||null:null})[_0xfc83('0xc')](function(_0x42a348){logger[_0xfc83('0x14')](_0xfc83('0x16'),_0x1f7eca);logger[_0xfc83('0xf')](_0xfc83('0x16'),_0x1f7eca,JSON['stringify'](_0x42a348));_0x1aec02(_0x42a348);})[_0xfc83('0x15')](function(_0x3af461){logger[_0xfc83('0x11')](_0xfc83('0x16'),_0x3af461[_0xfc83('0x13')],_0x1f7eca);_0x245424(_0x29f0c7[_0xfc83('0x11')](0x1f4,_0x3af461['message']));});});}; \ No newline at end of file +var _0xa7a7=['../../config/environment','jayson/promise','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','UpdateFaxApplication','FaxApplication','body','options','raw','where','attributes','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x4497ef,_0x34bb52){var _0x1587c3=function(_0x44e67e){while(--_0x44e67e){_0x4497ef['push'](_0x4497ef['shift']());}};_0x1587c3(++_0x34bb52);}(_0xa7a7,0xad));var _0x7a7a=function(_0x2e2948,_0x1837df){_0x2e2948=_0x2e2948-0x0;var _0x335f9e=_0xa7a7[_0x2e2948];return _0x335f9e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7a7a('0x0'));var BPromise=require(_0x7a7a('0x1'));var rs=require(_0x7a7a('0x2'));var fs=require('fs');var Redis=require(_0x7a7a('0x3'));var db=require(_0x7a7a('0x4'))['db'];var utils=require(_0x7a7a('0x5'));var logger=require('../../config/logger')(_0x7a7a('0x6'));var config=require(_0x7a7a('0x7'));var jayson=require(_0x7a7a('0x8'));var client=jayson['client'][_0x7a7a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e1ae9,_0x55d109,_0x4ebe8f){return new BPromise(function(_0x46ec42,_0x2cd0bb){return client[_0x7a7a('0xa')](_0x4e1ae9,_0x4ebe8f)[_0x7a7a('0xb')](function(_0x4b515b){logger['info'](_0x7a7a('0xc'),_0x55d109,_0x7a7a('0xd'));logger[_0x7a7a('0xe')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x55d109,_0x7a7a('0xd'),JSON[_0x7a7a('0xf')](_0x4b515b));if(_0x4b515b[_0x7a7a('0x10')]){if(_0x4b515b[_0x7a7a('0x10')][_0x7a7a('0x11')]===0x1f4){logger[_0x7a7a('0x10')](_0x7a7a('0xc'),_0x55d109,_0x4b515b[_0x7a7a('0x10')]['message']);return _0x2cd0bb(_0x4b515b[_0x7a7a('0x10')][_0x7a7a('0x12')]);}logger['error'](_0x7a7a('0xc'),_0x55d109,_0x4b515b[_0x7a7a('0x10')][_0x7a7a('0x12')]);return _0x46ec42(_0x4b515b[_0x7a7a('0x10')][_0x7a7a('0x12')]);}else{logger[_0x7a7a('0x13')](_0x7a7a('0xc'),_0x55d109,'request\x20sent');_0x46ec42(_0x4b515b[_0x7a7a('0x14')][_0x7a7a('0x12')]);}})[_0x7a7a('0x15')](function(_0x2b9518){logger[_0x7a7a('0x10')]('FaxApplication,\x20%s,\x20%s',_0x55d109,_0x2b9518);_0x2cd0bb(_0x2b9518);});});}exports[_0x7a7a('0x16')]=function(_0x587ca8){var _0x3d87e1=this;return new Promise(function(_0x2c5060,_0x2ff99b){return db[_0x7a7a('0x17')]['update'](_0x587ca8[_0x7a7a('0x18')],{'raw':_0x587ca8[_0x7a7a('0x19')]?_0x587ca8[_0x7a7a('0x19')][_0x7a7a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x587ca8[_0x7a7a('0x19')]?_0x587ca8[_0x7a7a('0x19')][_0x7a7a('0x1b')]||null:null,'attributes':_0x587ca8['options']?_0x587ca8[_0x7a7a('0x19')][_0x7a7a('0x1c')]||null:null,'limit':_0x587ca8[_0x7a7a('0x19')]?_0x587ca8[_0x7a7a('0x19')][_0x7a7a('0x1d')]||null:null})[_0x7a7a('0xb')](function(_0x5acd45){logger[_0x7a7a('0x13')](_0x7a7a('0x16'),_0x587ca8);logger[_0x7a7a('0xe')](_0x7a7a('0x16'),_0x587ca8,JSON[_0x7a7a('0xf')](_0x5acd45));_0x2c5060(_0x5acd45);})[_0x7a7a('0x15')](function(_0x345214){logger['error'](_0x7a7a('0x16'),_0x345214['message'],_0x587ca8);_0x2ff99b(_0x3d87e1[_0x7a7a('0x10')](0x1f4,_0x345214['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index e9d588d..c45b58b 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 _0xa571=['index','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0x11574a,_0x46d39e){var _0x18f23a=function(_0x49b0e2){while(--_0x49b0e2){_0x11574a['push'](_0x11574a['shift']());}};_0x18f23a(++_0x46d39e);}(_0xa571,0x107));var _0x1a57=function(_0x3b7998,_0x30087c){_0x3b7998=_0x3b7998-0x0;var _0x46f5f3=_0xa571[_0x3b7998];return _0x46f5f3;};'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 +var _0x7708=['multer','util','connect-timeout','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','put','delete','destroy'];(function(_0x1b4983,_0x575725){var _0x6da6e4=function(_0x59ecd1){while(--_0x59ecd1){_0x1b4983['push'](_0x1b4983['shift']());}};_0x6da6e4(++_0x575725);}(_0x7708,0x188));var _0x8770=function(_0x1c9c24,_0x2a517b){_0x1c9c24=_0x1c9c24-0x0;var _0x349c69=_0x7708[_0x1c9c24];return _0x349c69;};'use strict';var multer=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var path=require('path');var timeout=require(_0x8770('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var controller=require('./faxApplication.controller');router[_0x8770('0x5')]('/',auth['isAuthenticated'](),controller[_0x8770('0x6')]);router[_0x8770('0x5')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller[_0x8770('0x9')]);router[_0x8770('0xa')]('/',auth[_0x8770('0x8')](),controller['create']);router[_0x8770('0xb')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller['update']);router[_0x8770('0xc')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller[_0x8770('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index f4ea6cc..c803c48 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 _0x3295=['exports','BOOLEAN','DATE','STRING','out','ENUM','sequelize'];(function(_0x922899,_0x1b3444){var _0x4576ad=function(_0x1730ea){while(--_0x1730ea){_0x922899['push'](_0x922899['shift']());}};_0x4576ad(++_0x1b3444);}(_0x3295,0x1b1));var _0x5329=function(_0x8b8564,_0x162976){_0x8b8564=_0x8b8564-0x0;var _0x360c61=_0x3295[_0x8b8564];return _0x360c61;};'use strict';var Sequelize=require(_0x5329('0x0'));module[_0x5329('0x1')]={'closed':{'type':Sequelize[_0x5329('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5329('0x3')]},'disposition':{'type':Sequelize[_0x5329('0x4')]},'secondDisposition':{'type':Sequelize[_0x5329('0x4')]},'thirdDisposition':{'type':Sequelize[_0x5329('0x4')]},'note':{'type':Sequelize[_0x5329('0x4')]},'read1stAt':{'type':Sequelize[_0x5329('0x3')]},'fax':{'type':Sequelize[_0x5329('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x5329('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5329('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x5329('0x6')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xad8e=['BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xad8e,0x77));var _0xead8=function(_0x265bd2,_0x35ca25){_0x265bd2=_0x265bd2-0x0;var _0x53b580=_0xad8e[_0x265bd2];return _0x53b580;};'use strict';var Sequelize=require(_0xead8('0x0'));module['exports']={'closed':{'type':Sequelize[_0xead8('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xead8('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xead8('0x3')]},'note':{'type':Sequelize[_0xead8('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xead8('0x4')]('in',_0xead8('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xead8('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xead8('0x4')]('in',_0xead8('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 4b05c30..b3b00d7 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 _0xdb39=['createWriteStream','log','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','Users','fullname','TagIds','forEach','Tags','push','catch','index','map','FaxInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','select','field','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','length','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','$substring','value','split','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','end','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','where','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','resolve','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','params','includeAll','include','options','create','describe','addMessage','FaxMessage','omit','ids','findOne','pick','format','findAll','addTags','setTags','spread','Tag','color','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe'];(function(_0x3e03ce,_0x559e0d){var _0x13efe0=function(_0x20d34b){while(--_0x20d34b){_0x3e03ce['push'](_0x3e03ce['shift']());}};_0x13efe0(++_0x559e0d);}(_0xdb39,0xe6));var _0x9db3=function(_0x42c341,_0x31d467){_0x42c341=_0x42c341-0x0;var _0x43621b=_0xdb39[_0x42c341];return _0x43621b;};'use strict';var emlformat=require(_0x9db3('0x0'));var rimraf=require(_0x9db3('0x1'));var zipdir=require(_0x9db3('0x2'));var jsonpatch=require(_0x9db3('0x3'));var rp=require('request-promise');var moment=require(_0x9db3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9db3('0x5'));var util=require(_0x9db3('0x6'));var path=require(_0x9db3('0x7'));var sox=require(_0x9db3('0x8'));var csv=require(_0x9db3('0x9'));var ejs=require(_0x9db3('0xa'));var fs=require('fs');var fs_extra=require(_0x9db3('0xb'));var _=require('lodash');var squel=require(_0x9db3('0xc'));var crypto=require(_0x9db3('0xd'));var jsforce=require(_0x9db3('0xe'));var deskjs=require(_0x9db3('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9db3('0x10'));var Redis=require(_0x9db3('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9db3('0x12'));var hardwareService=require(_0x9db3('0x13'));var logger=require(_0x9db3('0x14'))(_0x9db3('0x15'));var utils=require(_0x9db3('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9db3('0x17'));var db=require(_0x9db3('0x18'))['db'];config['redis']=_[_0x9db3('0x19')](config[_0x9db3('0x1a')],{'host':_0x9db3('0x1b'),'port':0x18eb});var socket=require(_0x9db3('0x1c'))(new Redis(config[_0x9db3('0x1a')]));require(_0x9db3('0x1d'))[_0x9db3('0x1e')](socket);function respondWithStatusCode(_0x59b521,_0x1da07c){_0x1da07c=_0x1da07c||0xcc;return function(_0x372dd1){if(_0x372dd1){return _0x59b521[_0x9db3('0x1f')](_0x1da07c);}return _0x59b521[_0x9db3('0x20')](_0x1da07c)['end']();};}function respondWithResult(_0x5f5709,_0x3dec8d){_0x3dec8d=_0x3dec8d||0xc8;return function(_0x414e80){if(_0x414e80){return _0x5f5709[_0x9db3('0x20')](_0x3dec8d)[_0x9db3('0x21')](_0x414e80);}};}function respondWithFilteredResult(_0x2a2a30,_0x520cca){return function(_0x1359c0){if(_0x1359c0){var _0x5b62f1=typeof _0x520cca[_0x9db3('0x22')]===_0x9db3('0x23')&&typeof _0x520cca[_0x9db3('0x24')]===_0x9db3('0x23');var _0x53578f=_0x1359c0[_0x9db3('0x25')];var _0x5dd594=_0x5b62f1?0x0:_0x520cca[_0x9db3('0x22')];var _0x5492d0=_0x5b62f1?_0x1359c0['count']:_0x520cca[_0x9db3('0x22')]+_0x520cca['limit'];var _0x37d29e;if(_0x5492d0>=_0x53578f){_0x5492d0=_0x53578f;_0x37d29e=0xc8;}else{_0x37d29e=0xce;}_0x2a2a30[_0x9db3('0x20')](_0x37d29e);return _0x2a2a30[_0x9db3('0x26')](_0x9db3('0x27'),_0x5dd594+'-'+_0x5492d0+'/'+_0x53578f)[_0x9db3('0x21')](_0x1359c0);}return null;};}function patchUpdates(_0x4ff259){return function(_0x58de60){try{jsonpatch[_0x9db3('0x28')](_0x58de60,_0x4ff259,!![]);}catch(_0x49066f){return BPromise[_0x9db3('0x29')](_0x49066f);}return _0x58de60[_0x9db3('0x2a')]();};}function saveUpdates(_0x179941,_0x128902){return function(_0x15822c){if(_0x15822c){return _0x15822c[_0x9db3('0x2b')](_0x179941)[_0x9db3('0x2c')](function(_0x1e7365){return _0x1e7365;});}return null;};}function removeEntity(_0x37d017,_0x4b2ccf){return function(_0x4e4f6a){if(_0x4e4f6a){return _0x4e4f6a[_0x9db3('0x2d')]()[_0x9db3('0x2c')](function(){_0x37d017[_0x9db3('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b2a4c,_0x478da0){return function(_0x30d5a2){if(!_0x30d5a2){_0x5b2a4c[_0x9db3('0x1f')](0x194);}return _0x30d5a2;};}function handleError(_0x398566,_0x430c6d){_0x430c6d=_0x430c6d||0x1f4;return function(_0xb1578a){logger[_0x9db3('0x2e')](_0xb1578a['stack']);if(_0xb1578a[_0x9db3('0x2f')]){delete _0xb1578a['name'];}_0x398566[_0x9db3('0x20')](_0x430c6d)[_0x9db3('0x30')](_0xb1578a);};}function getInteractionUsers(_0x252c9f,_0xa200d2){return new BPromise(function(_0x3d0f73,_0xc16ccf){try{if(_0xa200d2[_0x252c9f['id']]){_0x252c9f[_0x9db3('0x31')]=_['map'](_0xa200d2[_0x252c9f['id']],function(_0x7800d3){return{'id':_0x7800d3['id'],'fullname':_0x7800d3[_0x9db3('0x32')]};});}}catch(_0x3ec4f3){_0xc16ccf(_0x3ec4f3);}_0x3d0f73(_0x252c9f);});}function getInteractionTags(_0x3da082,_0x3b31c0){return new BPromise(function(_0x2756c9,_0x3b39a4){try{if(_0x3da082[_0x9db3('0x33')]){_0x3da082['Tags']=[];_0x3da082[_0x9db3('0x33')]['split'](',')[_0x9db3('0x34')](function(_0x5305f6){_0x3da082[_0x9db3('0x35')][_0x9db3('0x36')](_0x3b31c0[_0x5305f6]);});}delete _0x3da082['TagIds'];}catch(_0x4de1d6){_0x3b39a4(_0x4de1d6);}_0x2756c9(_0x3da082);});}function updateFaxInteraction(_0x160041,_0x4d3be4,_0x5a153d){return new BPromise(function(_0x398faa,_0x1306ce){return getInteractionUsers(_0x160041,_0x5a153d)['then'](function(_0x3a9da3){return getInteractionTags(_0x3a9da3,_0x4d3be4);})[_0x9db3('0x2c')](function(_0xa5d375){_0x398faa(_0xa5d375);})[_0x9db3('0x37')](function(_0x3ef6b6){_0x1306ce(_0x3ef6b6);});});}exports[_0x9db3('0x38')]=function(_0x6de2ca,_0x255984){var _0x48d146={},_0x26e93a={},_0x3472b8={'count':0x0,'rows':[]};var _0x3274cf=_[_0x9db3('0x39')](db[_0x9db3('0x3a')][_0x9db3('0x3b')],function(_0x7a6522){return{'name':_0x7a6522[_0x9db3('0x3c')],'type':_0x7a6522[_0x9db3('0x3d')][_0x9db3('0x3e')]};});_0x26e93a[_0x9db3('0x3f')]=_['map'](_0x3274cf,'name');_0x26e93a['query']=_[_0x9db3('0x40')](_0x6de2ca[_0x9db3('0x41')]);_0x26e93a[_0x9db3('0x42')]=_[_0x9db3('0x43')](_0x26e93a['model'],_0x26e93a[_0x9db3('0x41')]);_0x48d146['attributes']=_['intersection'](_0x26e93a['model'],qs[_0x9db3('0x44')](_0x6de2ca[_0x9db3('0x41')]['fields']));_0x48d146[_0x9db3('0x45')]=_0x48d146[_0x9db3('0x45')]['length']?_0x48d146[_0x9db3('0x45')]:_0x26e93a[_0x9db3('0x3f')];if(!_0x6de2ca[_0x9db3('0x41')][_0x9db3('0x46')](_0x9db3('0x47'))){_0x48d146[_0x9db3('0x24')]=qs['limit'](_0x6de2ca[_0x9db3('0x41')][_0x9db3('0x24')]);_0x48d146[_0x9db3('0x22')]=qs[_0x9db3('0x22')](_0x6de2ca['query']['offset']);}_0x48d146['order']=qs['sort'](_0x6de2ca['query'][_0x9db3('0x48')]);_0x48d146['where']=qs[_0x9db3('0x42')](_['pick'](_0x6de2ca[_0x9db3('0x41')],_0x26e93a[_0x9db3('0x42')]),_0x3274cf);var _0x4ea7e3=[];var _0x3af724=squel[_0x9db3('0x49')]()['field']('id')[_0x9db3('0x4a')](_0x9db3('0x2f'))[_0x9db3('0x4a')]('color')[_0x9db3('0x4b')](_0x9db3('0x4c'));var _0x3a1a81=squel[_0x9db3('0x49')]()[_0x9db3('0x4a')](_0x9db3('0x4d'))[_0x9db3('0x4a')](_0x9db3('0x4e'))['field'](_0x9db3('0x4f'))[_0x9db3('0x4b')](_0x9db3('0x50'),'ui')[_0x9db3('0x51')](_0x9db3('0x52'),'u',_0x9db3('0x53'));var _0x1f0601=squel[_0x9db3('0x49')]()[_0x9db3('0x4b')](_0x9db3('0x54'),'i')[_0x9db3('0x51')](_0x9db3('0x55'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x9db3('0x51')]('users','o',_0x9db3('0x56'))[_0x9db3('0x51')](_0x9db3('0x57'),'a','a.id\x20=\x20i.FaxAccountId')[_0x9db3('0x51')](_0x9db3('0x58'),'me',_0x9db3('0x59'))['left_join']('fax_interaction_has_tags','it',_0x9db3('0x5a'))[_0x9db3('0x51')](_0x9db3('0x4c'),'t',_0x9db3('0x5b'));var _0x1670ab=squel[_0x9db3('0x5c')]();var _0xcc52=[];var _0x30ee24=squel[_0x9db3('0x5c')]();var _0x8ce5ee;if(_0x6de2ca[_0x9db3('0x41')][_0x9db3('0x5d')]){_0x8ce5ee=as[_0x9db3('0x5e')](_0x6de2ca[_0x9db3('0x41')][_0x9db3('0x5d')]);var _0x307561=_0x8ce5ee['sqlOperator'];for(var _0x28fd48=0x0;_0x28fd48<_0x8ce5ee[_0x9db3('0x5f')][_0x9db3('0x60')];_0x28fd48++){var _0x54293e=_0x8ce5ee['conditions'][_0x28fd48];var _0x2943f8='i';var _0x1ba277=_[_0x9db3('0x61')](_0x3274cf,['name',_0x54293e[_0x9db3('0x4a')]]);if(!_0x1ba277){switch(_0x54293e['field']){case _0x9db3('0x62'):if(_0x54293e['value']==0x1){_0x1f0601[_0x9db3('0x63')]('`'+_0x54293e[_0x9db3('0x4a')]+_0x9db3('0x64'));}else{_0x1f0601[_0x9db3('0x63')]('`'+_0x54293e['field']+_0x9db3('0x65'));}break;case _0x9db3('0x66'):if(_0x54293e['operator']===_0x9db3('0x67')){if(_0x54293e[_0x9db3('0x68')][_0x9db3('0x69')]('\x20')['length']>0x1){_0x1670ab[_0x307561]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x9db3('0x6a')](_0x54293e[_0x9db3('0x68')]),null);}else{var _0x189825='%'+_0x54293e['value']+'%';_0x1670ab[_0x307561](_0x9db3('0x6b'),_0x189825,_0x189825,_0x189825);}}else{_0x1ba277=_[_0x9db3('0x61')](_0x3274cf,['name',_0x9db3('0x6c')]);_0x54293e[_0x9db3('0x4a')]='ContactId';_0x1618bc=as[_0x9db3('0x6d')](_0x2943f8,_0x1ba277['type'],_0x54293e);_0x1670ab[_0x307561](_0x1618bc[_0x9db3('0x6e')],_0x1618bc['value'][_0x9db3('0x6f')],_0x1618bc[_0x9db3('0x68')][_0x9db3('0x70')]);}break;case'Tag':var _0x3c60b5=_0x54293e[_0x9db3('0x68')][_0x9db3('0x69')](',')[_0x9db3('0x39')](function(_0x1e43d2){return Number(_0x1e43d2);});_0x3c60b5[_0x9db3('0x34')](function(_0x5d460a){_0x30ee24['or'](_0x9db3('0x71'),'%,'+_0x5d460a+',%');});_0xcc52=_[_0x9db3('0x72')](_0xcc52,_0x3c60b5);break;case _0x9db3('0x73'):if(_0x54293e[_0x9db3('0x74')]===_0x9db3('0x67')){_0x1670ab[_0x307561](_0x9db3('0x75'),'%'+_0x54293e[_0x9db3('0x68')]+'%',null);}else{_0x1ba277=_[_0x9db3('0x61')](_0x3274cf,[_0x9db3('0x2f'),'UserId']);_0x54293e[_0x9db3('0x4a')]=_0x9db3('0x76');_0x1618bc=as[_0x9db3('0x6d')](_0x2943f8,_0x1ba277[_0x9db3('0x3d')],_0x54293e);_0x1670ab[_0x307561](_0x1618bc[_0x9db3('0x6e')],_0x1618bc[_0x9db3('0x68')][_0x9db3('0x6f')],_0x1618bc[_0x9db3('0x68')][_0x9db3('0x70')]);}break;case _0x9db3('0x77'):_0x1618bc=as[_0x9db3('0x6d')]('me',null,_0x54293e);_0x1670ab[_0x307561](_0x1618bc['text'],_0x1618bc['value'][_0x9db3('0x6f')],_0x1618bc[_0x9db3('0x68')]['end']);break;}}else{var _0x1618bc=as[_0x9db3('0x6d')](_0x2943f8,_0x1ba277[_0x9db3('0x3d')],_0x54293e);_0x1670ab[_0x307561](_0x1618bc[_0x9db3('0x6e')],_0x1618bc[_0x9db3('0x68')][_0x9db3('0x6f')],_0x1618bc['value'][_0x9db3('0x70')]);}}}else{var _0x5f38f0=_(_0x6de2ca[_0x9db3('0x41')])[_0x9db3('0x40')]()[_0x9db3('0x39')](function(_0xcbc1e9){return _[_0x9db3('0x78')](_0x3274cf,[_0x9db3('0x2f'),_0xcbc1e9])?_0xcbc1e9:undefined;})[_0x9db3('0x79')]()['value']();if(!_[_0x9db3('0x7a')](_0x5f38f0)){_0x5f38f0['forEach'](function(_0x18245d){if(_0x18245d==='FaxAccountId'){_0x1f0601[_0x9db3('0x7b')](_0x9db3('0x7c'),[][_0x9db3('0x7d')](_0x6de2ca['query'][_0x18245d]));}else if(_0x18245d===_0x9db3('0x7e')){var _0x39f978=JSON[_0x9db3('0x7f')](_0x6de2ca[_0x9db3('0x41')][_0x18245d])[_0x9db3('0x80')];var _0x2257eb=JSON[_0x9db3('0x7f')](_0x6de2ca['query'][_0x18245d])[_0x9db3('0x81')];_0x1f0601[_0x9db3('0x7b')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x39f978,_0x2257eb);}else{if(_0x6de2ca['query'][_0x18245d]===_0x9db3('0x82')){_0x1f0601['where']('i.'+_0x18245d+_0x9db3('0x83'));}else{_0x1f0601[_0x9db3('0x7b')]('i.'+_0x18245d+_0x9db3('0x84'),_0x6de2ca[_0x9db3('0x41')][_0x18245d]);}}});}if(_0x6de2ca[_0x9db3('0x41')][_0x9db3('0x85')]){if(_0x6de2ca['query'][_0x9db3('0x85')]==0x1){_0x1f0601['having'](_0x9db3('0x86'));}else{_0x1f0601[_0x9db3('0x63')](_0x9db3('0x87'));}}if(_0x6de2ca['query'][_0x9db3('0x88')]){_0xcc52=_[_0x9db3('0x89')](_0x6de2ca[_0x9db3('0x41')]['tag'])?_0x6de2ca['query'][_0x9db3('0x88')]:new Array(_0x6de2ca[_0x9db3('0x41')][_0x9db3('0x88')]);_0xcc52['forEach'](function(_0xf582ec){_0x30ee24['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xf582ec+',%');});}if(_0x6de2ca[_0x9db3('0x41')][_0x9db3('0x8a')]){var _0x579f1e=_0x6de2ca['query'][_0x9db3('0x8a')][_0x9db3('0x8b')]('\x5c','\x5c\x5c')[_0x9db3('0x8b')](/'/g,'\x27\x27');if(qs[_0x9db3('0x8c')](_0x579f1e)){_0x1670ab['or'](_0x9db3('0x8d'),_0x579f1e+'%')['or']('i.fax\x20LIKE\x20?',_0x579f1e+'%');}_0x1670ab['or'](_0x9db3('0x8e'),_0x579f1e+'%');}}_0x1f0601[_0x9db3('0x7b')](_0x1670ab);_0x1f0601[_0x9db3('0x8f')](_0x9db3('0x90'));var _0x4636a3={'type':db[_0x9db3('0x91')]['QueryTypes']['SELECT'],'raw':!![]};var _0x52ebd3=_0x1f0601[_0x9db3('0x92')]();_0x52ebd3[_0x9db3('0x4a')](_0x9db3('0x90'));_0x52ebd3[_0x9db3('0x4a')](_0x9db3('0x93'),'unreadMessages');if(_0x48d146[_0x9db3('0x94')]){_0x48d146[_0x9db3('0x94')]['forEach'](function(_0x31e672){var _0x43f515=_0x31e672[0x0]==='contactName'?_0x31e672[0x0]:'i.'+_0x31e672[0x0];_0x1f0601[_0x9db3('0x94')](_0x43f515,_0x31e672[0x1]===_0x9db3('0x95')?![]:!![]);});}if(!_[_0x9db3('0x7a')](_0xcc52)){_0x1f0601['having'](_0x30ee24);_0x52ebd3[_0x9db3('0x7b')](_0x9db3('0x96'),_0xcc52);}BPromise[_0x9db3('0x97')]()['then'](function(){if(!_0x8ce5ee){if(_0x6de2ca['query'][_0x9db3('0x98')])return;_0x52ebd3['where'](_0x9db3('0x99'));_0x1f0601[_0x9db3('0x7b')](_0x9db3('0x99'));return;}if(_0x6de2ca['user'][_0x9db3('0x9a')]!==_0x9db3('0x9b'))return;return _0x6de2ca['user'][_0x9db3('0x9c')]({'attributes':['id'],'raw':!![]})[_0x9db3('0x2c')](function(_0x184049){if(_['isEmpty'](_0x184049)){_0x52ebd3[_0x9db3('0x7b')](_0x9db3('0x9d'));_0x1f0601[_0x9db3('0x7b')](_0x9db3('0x9d'));}else{_0x52ebd3[_0x9db3('0x7b')]('i.FaxAccountId\x20IN\x20?',_[_0x9db3('0x39')](_0x184049,'id'));_0x1f0601[_0x9db3('0x7b')](_0x9db3('0x7c'),_[_0x9db3('0x39')](_0x184049,'id'));}});})[_0x9db3('0x2c')](function(){if(_0x6de2ca['user'][_0x9db3('0x9a')]===_0x9db3('0x9b')&&!_0x8ce5ee&&!_0x6de2ca[_0x9db3('0x41')]['FaxAccountId'])return[];return db[_0x9db3('0x9e')][_0x9db3('0x41')](_0x52ebd3[_0x9db3('0x9f')](),_0x4636a3);})[_0x9db3('0x2c')](function(_0xfe7563){_0x3472b8[_0x9db3('0x25')]=_0xfe7563[_0x9db3('0x60')];if(_0x3472b8[_0x9db3('0x25')]===0x0)return[];return db[_0x9db3('0x9e')][_0x9db3('0x41')](_0x3af724['toString'](),_0x4636a3)['then'](function(_0xde7643){_0x4ea7e3=_[_0x9db3('0xa0')](_0xde7643,'id');_0x4636a3=_[_0x9db3('0xa1')](_0x4636a3,{'model':db[_0x9db3('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x6de2ca[_0x9db3('0x41')][_0x9db3('0x44')]){_0x48d146[_0x9db3('0x45')][_0x9db3('0x34')](function(_0x10379d){_0x1f0601[_0x9db3('0x4a')]('i.'+_0x10379d);});}else{_0x1f0601[_0x9db3('0x4a')](_0x9db3('0x93'),_0x9db3('0x62'));_0x1f0601[_0x9db3('0x4a')](_0x9db3('0xa2'),_0x9db3('0xa3'));_0x1f0601[_0x9db3('0x4a')](_0x9db3('0xa4'),_0x9db3('0xa5'));_0x1f0601[_0x9db3('0x4a')](_0x9db3('0xa6'),_0x9db3('0xa7'));_0x1f0601[_0x9db3('0x4a')](_0x9db3('0xa8'));_0x1f0601['field'](_0x9db3('0xa9'),_0x9db3('0xaa'));_0x1f0601[_0x9db3('0x4a')]('c.lastName','Contact.lastName');_0x1f0601[_0x9db3('0x4a')](_0x9db3('0xab'),_0x9db3('0xac'));_0x1f0601[_0x9db3('0x4a')](_0x9db3('0xad'),'Contact.phone');_0x1f0601[_0x9db3('0x4a')](_0x9db3('0xae'),_0x9db3('0xaf'));_0x1f0601['field'](_0x9db3('0xb0'),'Contact.fax');_0x1f0601['field'](_0x9db3('0xb1'),_0x9db3('0xb2'));_0x1f0601[_0x9db3('0x4a')](_0x9db3('0xb3'),_0x9db3('0xb4'));_0x1f0601[_0x9db3('0x4a')](_0x9db3('0xb5'),_0x9db3('0x33'));}if(_0x48d146['limit'])_0x1f0601[_0x9db3('0x24')](_0x48d146[_0x9db3('0x24')]);if(_0x48d146[_0x9db3('0x22')])_0x1f0601[_0x9db3('0x22')](_0x48d146[_0x9db3('0x22')]);return db['sequelize'][_0x9db3('0x41')](_0x1f0601[_0x9db3('0x9f')](),_0x4636a3);})['then'](function(_0x28a014){if(_0x28a014[_0x9db3('0x60')]>0x0)_0x3a1a81[_0x9db3('0x7b')](_0x9db3('0xb6'),_[_0x9db3('0x39')](_0x28a014,'id'));return db['sequelize']['query'](_0x3a1a81[_0x9db3('0x9f')](),_0x4636a3)[_0x9db3('0x2c')](function(_0x34c396){var _0x46199e=_[_0x9db3('0xb7')](_0x34c396,_0x9db3('0xb8'));var _0x4e70cd=[];_0x28a014['forEach'](function(_0x3b3a49){_0x4e70cd[_0x9db3('0x36')](updateFaxInteraction(_0x3b3a49,_0x4ea7e3,_0x46199e));});return BPromise[_0x9db3('0xb9')](_0x4e70cd);});});})['then'](function(_0x5c3bac){_0x3472b8[_0x9db3('0xba')]=_0x5c3bac;return _0x3472b8;})[_0x9db3('0x2c')](respondWithFilteredResult(_0x255984,_0x48d146))[_0x9db3('0x37')](handleError(_0x255984,null));};exports[_0x9db3('0xbb')]=function(_0x35400c,_0x5b38de){var _0x341a6b={'raw':![],'where':{'id':_0x35400c[_0x9db3('0xbc')]['id']}},_0x52371e={};_0x52371e['model']=_[_0x9db3('0x40')](db['FaxInteraction'][_0x9db3('0x3b')]);_0x52371e[_0x9db3('0x41')]=_[_0x9db3('0x40')](_0x35400c[_0x9db3('0x41')]);_0x52371e[_0x9db3('0x42')]=_[_0x9db3('0x43')](_0x52371e[_0x9db3('0x3f')],_0x52371e[_0x9db3('0x41')]);_0x341a6b[_0x9db3('0x45')]=_[_0x9db3('0x43')](_0x52371e[_0x9db3('0x3f')],qs[_0x9db3('0x44')](_0x35400c[_0x9db3('0x41')]['fields']));_0x341a6b['attributes']=_0x341a6b[_0x9db3('0x45')][_0x9db3('0x60')]?_0x341a6b[_0x9db3('0x45')]:_0x52371e[_0x9db3('0x3f')];if(_0x35400c[_0x9db3('0x41')][_0x9db3('0xbd')]){_0x341a6b[_0x9db3('0xbe')]=[{'all':!![]}];}_0x341a6b=_[_0x9db3('0xa1')]({},_0x341a6b,_0x35400c[_0x9db3('0xbf')]);return db[_0x9db3('0x3a')][_0x9db3('0x61')](_0x341a6b)[_0x9db3('0x2c')](handleEntityNotFound(_0x5b38de,null))['then'](respondWithResult(_0x5b38de,null))[_0x9db3('0x37')](handleError(_0x5b38de,null));};exports[_0x9db3('0xc0')]=function(_0x18bf4d,_0x5b2432){return db[_0x9db3('0x3a')][_0x9db3('0xc0')](_0x18bf4d['body'],{})['then'](respondWithResult(_0x5b2432,0xc9))[_0x9db3('0x37')](handleError(_0x5b2432,null));};exports[_0x9db3('0x2b')]=function(_0x1b8f3b,_0x3debe0){if(_0x1b8f3b[_0x9db3('0x77')]['id']){delete _0x1b8f3b[_0x9db3('0x77')]['id'];}return db[_0x9db3('0x3a')]['find']({'where':{'id':_0x1b8f3b['params']['id']}})['then'](handleEntityNotFound(_0x3debe0,null))['then'](saveUpdates(_0x1b8f3b[_0x9db3('0x77')],null))[_0x9db3('0x2c')](respondWithResult(_0x3debe0,null))[_0x9db3('0x37')](handleError(_0x3debe0,null));};exports[_0x9db3('0x2d')]=function(_0x1633d6,_0x5be419){return db[_0x9db3('0x3a')]['find']({'where':{'id':_0x1633d6[_0x9db3('0xbc')]['id']}})[_0x9db3('0x2c')](handleEntityNotFound(_0x5be419,null))[_0x9db3('0x2c')](removeEntity(_0x5be419,null))[_0x9db3('0x37')](handleError(_0x5be419,null));};exports[_0x9db3('0xc1')]=function(_0x3e8ba9,_0x1af4a0){return db[_0x9db3('0x3a')]['describe']()[_0x9db3('0x2c')](respondWithResult(_0x1af4a0,null))[_0x9db3('0x37')](handleError(_0x1af4a0,null));};exports[_0x9db3('0xc2')]=function(_0x46bb25,_0xca0219,_0x2c73ae){return db[_0x9db3('0xc3')][_0x9db3('0x61')]({'where':{'id':_0x46bb25[_0x9db3('0xbc')]['id']}})['then'](handleEntityNotFound(_0xca0219,null))[_0x9db3('0x2c')](function(_0x26ebaa){if(_0x26ebaa){return _0x26ebaa[_0x9db3('0xc2')](_0x46bb25[_0x9db3('0x77')]['ids'],_[_0x9db3('0xc4')](_0x46bb25[_0x9db3('0x77')],[_0x9db3('0xc5'),'id'])||{});}})['then'](respondWithResult(_0xca0219,null))[_0x9db3('0x37')](handleError(_0xca0219,null));};exports['getMessages']=function(_0x576776,_0x23867f,_0x1c4f31){var _0x30301c={'raw':![],'where':{}};var _0x57d486={};var _0xb1a103={'count':0x0,'rows':[]};return db[_0x9db3('0x3a')][_0x9db3('0xc6')]({'where':{'id':_0x576776[_0x9db3('0xbc')]['id']}})[_0x9db3('0x2c')](handleEntityNotFound(_0x23867f,null))[_0x9db3('0x2c')](function(_0x5048d2){if(_0x5048d2){_0x57d486[_0x9db3('0x3f')]=_[_0x9db3('0x40')](db[_0x9db3('0xc3')][_0x9db3('0x3b')]);_0x57d486[_0x9db3('0x41')]=_['keys'](_0x576776[_0x9db3('0x41')]);_0x57d486[_0x9db3('0x42')]=_['intersection'](_0x57d486[_0x9db3('0x3f')],_0x57d486[_0x9db3('0x41')]);_0x30301c[_0x9db3('0x45')]=_[_0x9db3('0x43')](_0x57d486['model'],qs[_0x9db3('0x44')](_0x576776['query']['fields']));_0x30301c[_0x9db3('0x45')]=_0x30301c[_0x9db3('0x45')][_0x9db3('0x60')]?_0x30301c['attributes']:_0x57d486[_0x9db3('0x3f')];if(!_0x576776[_0x9db3('0x41')][_0x9db3('0x46')](_0x9db3('0x47'))){_0x30301c[_0x9db3('0x24')]=qs[_0x9db3('0x24')](_0x576776[_0x9db3('0x41')][_0x9db3('0x24')]);_0x30301c['offset']=qs[_0x9db3('0x22')](_0x576776[_0x9db3('0x41')][_0x9db3('0x22')]);}_0x30301c['order']=qs['sort'](_0x576776[_0x9db3('0x41')][_0x9db3('0x48')]);_0x30301c[_0x9db3('0x7b')]=qs[_0x9db3('0x42')](_[_0x9db3('0xc7')](_0x576776[_0x9db3('0x41')],_0x57d486[_0x9db3('0x42')]));_0x30301c[_0x9db3('0x7b')][_0x9db3('0xb8')]=_0x5048d2['id'];if(_0x576776['query']['filter']){_0x30301c['where']=_[_0x9db3('0xa1')](_0x30301c[_0x9db3('0x7b')],{'$or':_[_0x9db3('0x39')](_0x30301c[_0x9db3('0x45')],function(_0x4a628e){var _0x1d9f4a={};_0x1d9f4a[_0x4a628e]={'$like':'%'+_0x576776[_0x9db3('0x41')][_0x9db3('0x8a')]+'%'};return _0x1d9f4a;})});}if(_0x576776['query'][_0x9db3('0x80')]){var _0xf27829=_0x576776['query']['$gte'][_0x9db3('0x69')](',');var _0x5702a1={};_0x5702a1[_0xf27829[0x0]]={'$gte':moment(_0xf27829[0x1])[_0x9db3('0xc8')]('YYYY-MM-DD\x20HH:mm:ss')};_0x30301c[_0x9db3('0x7b')]=_[_0x9db3('0xa1')](_0x30301c[_0x9db3('0x7b')],_0x5702a1);}_0x30301c=_[_0x9db3('0xa1')]({},_0x30301c,_0x576776[_0x9db3('0xbf')]);return db[_0x9db3('0xc3')]['count']({'where':_0x30301c[_0x9db3('0x7b')]})['then'](function(_0x22d216){_0xb1a103[_0x9db3('0x25')]=_0x22d216;if(_0x576776[_0x9db3('0x41')][_0x9db3('0xbd')]){_0x30301c[_0x9db3('0xbe')]=[{'all':!![]}];}return db['FaxMessage'][_0x9db3('0xc9')](_0x30301c);})[_0x9db3('0x2c')](function(_0x238f27){_0xb1a103[_0x9db3('0xba')]=_0x238f27;return _0xb1a103;});}})[_0x9db3('0x2c')](respondWithFilteredResult(_0x23867f,_0x30301c))[_0x9db3('0x37')](handleError(_0x23867f,null));};exports[_0x9db3('0xca')]=function(_0x573241,_0x26ad77,_0x5c88c4){return db[_0x9db3('0x3a')][_0x9db3('0x61')]({'where':{'id':_0x573241[_0x9db3('0xbc')]['id']}})['then'](handleEntityNotFound(_0x26ad77,null))[_0x9db3('0x2c')](function(_0x402cc2){if(_0x402cc2){return _0x402cc2[_0x9db3('0xcb')](_0x573241['body'][_0x9db3('0xc5')],_['omit'](_0x573241['body'],[_0x9db3('0xc5'),'id'])||{})[_0x9db3('0xcc')](function(){return db[_0x9db3('0xcd')][_0x9db3('0xc9')]({'attributes':['id',_0x9db3('0x2f'),_0x9db3('0xce')],'where':{'id':_0x573241[_0x9db3('0x77')][_0x9db3('0xc5')]}});})[_0x9db3('0x2c')](function(_0x26aa46){socket['emit'](_0x9db3('0xcf'),{'id':Number(_0x573241[_0x9db3('0xbc')]['id']),'tags':_0x26aa46||[]});return{'id':Number(_0x573241[_0x9db3('0xbc')]['id']),'tags':_0x26aa46||[]};});}})[_0x9db3('0x2c')](respondWithResult(_0x26ad77,null))['catch'](handleError(_0x26ad77,null));};exports[_0x9db3('0xd0')]=function(_0x535b26,_0x521e78,_0x4d8ed0){return db[_0x9db3('0x3a')]['find']({'where':{'id':_0x535b26[_0x9db3('0xbc')]['id']}})[_0x9db3('0x2c')](handleEntityNotFound(_0x521e78,null))['then'](function(_0xeffd1d){if(_0xeffd1d){return _0xeffd1d[_0x9db3('0xd0')](_0x535b26[_0x9db3('0x41')][_0x9db3('0xc5')]);}})[_0x9db3('0x2c')](respondWithStatusCode(_0x521e78,null))[_0x9db3('0x37')](handleError(_0x521e78,null));};exports[_0x9db3('0xd1')]=function(_0x35aa64,_0x43f4de){var _0x52190e=moment()[_0x9db3('0xd2')]()[_0x9db3('0x9f')]();var _0x5983c8=path[_0x9db3('0xd3')](config[_0x9db3('0xd4')],_0x9db3('0xd5'),_0x9db3('0xd6'),_0x9db3('0xd7'));var _0xc3ae06=path[_0x9db3('0xd3')](config[_0x9db3('0xd4')],_0x9db3('0xd5'),_0x9db3('0xd6'),_0x9db3('0xd8'));var _0x4400b3=path['join'](_0x5983c8,_0x52190e);var _0x1991a7=util[_0x9db3('0xc8')](_0x9db3('0xd9'),_0x35aa64[_0x9db3('0xbc')]['id'],_0x52190e);var _0x15dd40=path[_0x9db3('0xd3')](_0x5983c8,_0x1991a7);var _0x6ed4e8=[];_0x6ed4e8['push']({'model':db[_0x9db3('0xda')],'as':_0x9db3('0xda'),'raw':!![]});var _0x36ab92=[{'model':db['FaxMessage'],'as':_0x9db3('0xdb'),'attributes':['id',_0x9db3('0x77'),'createdAt'],'include':_0x6ed4e8}];return db[_0x9db3('0x3a')][_0x9db3('0x61')]({'where':{'id':_0x35aa64[_0x9db3('0xbc')]['id']},'include':_0x36ab92})[_0x9db3('0x2c')](handleEntityNotFound(_0x43f4de,null))[_0x9db3('0x2c')](function(_0x284869){if(_0x284869&&_0x284869[_0x9db3('0xdb')]){var _0x412b71=_0x284869[_0x9db3('0xdc')]({'plain':!![]});fs[_0x9db3('0xdd')](_0x4400b3);for(var _0x39d521=0x0;_0x39d521<_0x412b71[_0x9db3('0xdb')][_0x9db3('0x60')];_0x39d521++){var _0x138a4f=_0x412b71[_0x9db3('0xdb')][_0x39d521]['Attachment'];if(_0x138a4f){var _0x298be4=path[_0x9db3('0xd3')](_0xc3ae06,_0x138a4f[_0x9db3('0xde')]);if(fs[_0x9db3('0xdf')](_0x298be4)){fs[_0x9db3('0xe0')](_0x298be4)[_0x9db3('0xe1')](fs[_0x9db3('0xe2')](path['join'](_0x4400b3,_0x138a4f['basename'])));}}}return BPromise[_0x9db3('0x97')]()['then'](function(){return new BPromise(function(_0x1769c1,_0x18a7b4){zipdir(_0x4400b3,{'saveTo':_0x15dd40},function(_0x1a6159,_0x9fbdf7){if(_0x1a6159)return _0x18a7b4(_0x1a6159);return _0x1769c1(_0x9fbdf7);});})[_0x9db3('0x2c')](function(){return new BPromise(function(_0x5e8aea,_0x4aa53a){rimraf(_0x4400b3,function(_0x24fa5a){if(_0x24fa5a)_0x4aa53a(_0x24fa5a);return _0x5e8aea();});});})[_0x9db3('0x2c')](function(){return _0x43f4de[_0x9db3('0xd1')](_0x15dd40,_0x1991a7,function(_0x2863f2){if(_0x2863f2){console[_0x9db3('0xe3')]('err',_0x2863f2);}else{fs['unlinkSync'](_0x15dd40);}});});});}else{return _0x43f4de[_0x9db3('0x1f')](0xc8);}})[_0x9db3('0x37')](handleError(_0x43f4de,null));}; \ No newline at end of file +var _0x220b=['$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','body','some','compact','isEmpty','i.FaxAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','unreadMessages','contactName','DESC','t.id\x20IN\x20?','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','agent','FaxAccountId','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','all','rows','show','keys','rawAttributes','includeAll','include','create','params','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','nolimit','FaxInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','spread','color','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','createReadStream','pipe','resolve','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','moment','bluebird','util','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','stack','name','Users','TagIds','Tags','split','forEach','push','catch','map','FaxInteraction','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','select','field','from','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','fax_interactions','cm_contacts','o.id\x20=\x20i.UserId','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','having','Contact','operator'];(function(_0x117276,_0x2c725e){var _0x51b05f=function(_0x3c933c){while(--_0x3c933c){_0x117276['push'](_0x117276['shift']());}};_0x51b05f(++_0x2c725e);}(_0x220b,0x79));var _0xb220=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0x220b[_0x511bd1];return _0x4c48ec;};'use strict';var emlformat=require(_0xb220('0x0'));var rimraf=require(_0xb220('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb220('0x2'));var rp=require('request-promise');var moment=require(_0xb220('0x3'));var BPromise=require(_0xb220('0x4'));var Mustache=require('mustache');var util=require(_0xb220('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb220('0x6'));var fs=require('fs');var fs_extra=require(_0xb220('0x7'));var _=require(_0xb220('0x8'));var squel=require(_0xb220('0x9'));var crypto=require(_0xb220('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb220('0xb'));var Papa=require(_0xb220('0xc'));var Redis=require(_0xb220('0xd'));var authService=require(_0xb220('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xb220('0xf'));var hardwareService=require(_0xb220('0x10'));var logger=require('../../config/logger')(_0xb220('0x11'));var utils=require(_0xb220('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xb220('0x13'));var db=require(_0xb220('0x14'))['db'];config[_0xb220('0x15')]=_[_0xb220('0x16')](config['redis'],{'host':_0xb220('0x17'),'port':0x18eb});var socket=require(_0xb220('0x18'))(new Redis(config['redis']));require(_0xb220('0x19'))['register'](socket);function respondWithStatusCode(_0x3c9a02,_0x11f52b){_0x11f52b=_0x11f52b||0xcc;return function(_0x28cc18){if(_0x28cc18){return _0x3c9a02[_0xb220('0x1a')](_0x11f52b);}return _0x3c9a02[_0xb220('0x1b')](_0x11f52b)[_0xb220('0x1c')]();};}function respondWithResult(_0x3d174d,_0x4dc1f4){_0x4dc1f4=_0x4dc1f4||0xc8;return function(_0x288fc3){if(_0x288fc3){return _0x3d174d[_0xb220('0x1b')](_0x4dc1f4)['json'](_0x288fc3);}};}function respondWithFilteredResult(_0x3538a9,_0x4d3f84){return function(_0x3f39f1){if(_0x3f39f1){var _0xbcf640=typeof _0x4d3f84['offset']===_0xb220('0x1d')&&typeof _0x4d3f84[_0xb220('0x1e')]===_0xb220('0x1d');var _0x1fa6cf=_0x3f39f1[_0xb220('0x1f')];var _0x4d5627=_0xbcf640?0x0:_0x4d3f84[_0xb220('0x20')];var _0x58d8c9=_0xbcf640?_0x3f39f1['count']:_0x4d3f84['offset']+_0x4d3f84[_0xb220('0x1e')];var _0x58d5c0;if(_0x58d8c9>=_0x1fa6cf){_0x58d8c9=_0x1fa6cf;_0x58d5c0=0xc8;}else{_0x58d5c0=0xce;}_0x3538a9[_0xb220('0x1b')](_0x58d5c0);return _0x3538a9[_0xb220('0x21')](_0xb220('0x22'),_0x4d5627+'-'+_0x58d8c9+'/'+_0x1fa6cf)['json'](_0x3f39f1);}return null;};}function patchUpdates(_0x3aa0df){return function(_0x1bfafb){try{jsonpatch['apply'](_0x1bfafb,_0x3aa0df,!![]);}catch(_0x54e398){return BPromise[_0xb220('0x23')](_0x54e398);}return _0x1bfafb[_0xb220('0x24')]();};}function saveUpdates(_0xbdd1bd,_0x460f35){return function(_0x5c6fcc){if(_0x5c6fcc){return _0x5c6fcc[_0xb220('0x25')](_0xbdd1bd)['then'](function(_0xb8f8b0){return _0xb8f8b0;});}return null;};}function removeEntity(_0x5e428a,_0x2586ee){return function(_0x17bf3a){if(_0x17bf3a){return _0x17bf3a[_0xb220('0x26')]()[_0xb220('0x27')](function(){_0x5e428a[_0xb220('0x1b')](0xcc)[_0xb220('0x1c')]();});}};}function handleEntityNotFound(_0x37f69c,_0x21fde6){return function(_0x4862dc){if(!_0x4862dc){_0x37f69c['sendStatus'](0x194);}return _0x4862dc;};}function handleError(_0x461779,_0x2358a1){_0x2358a1=_0x2358a1||0x1f4;return function(_0x51e0cb){logger['error'](_0x51e0cb[_0xb220('0x28')]);if(_0x51e0cb[_0xb220('0x29')]){delete _0x51e0cb[_0xb220('0x29')];}_0x461779['status'](_0x2358a1)['send'](_0x51e0cb);};}function getInteractionUsers(_0x4c9cde,_0x5c1530){return new BPromise(function(_0x55c8cb,_0x22063d){try{if(_0x5c1530[_0x4c9cde['id']]){_0x4c9cde[_0xb220('0x2a')]=_['map'](_0x5c1530[_0x4c9cde['id']],function(_0x8a7a21){return{'id':_0x8a7a21['id'],'fullname':_0x8a7a21['fullname']};});}}catch(_0x4fa10e){_0x22063d(_0x4fa10e);}_0x55c8cb(_0x4c9cde);});}function getInteractionTags(_0x209a56,_0x707ffe){return new BPromise(function(_0x418d7e,_0x2d0eaa){try{if(_0x209a56[_0xb220('0x2b')]){_0x209a56[_0xb220('0x2c')]=[];_0x209a56['TagIds'][_0xb220('0x2d')](',')[_0xb220('0x2e')](function(_0xb5ec94){_0x209a56[_0xb220('0x2c')][_0xb220('0x2f')](_0x707ffe[_0xb5ec94]);});}delete _0x209a56[_0xb220('0x2b')];}catch(_0x1bea8d){_0x2d0eaa(_0x1bea8d);}_0x418d7e(_0x209a56);});}function updateFaxInteraction(_0x25e808,_0x3c72c6,_0x31ba54){return new BPromise(function(_0x327f35,_0x1ad1bb){return getInteractionUsers(_0x25e808,_0x31ba54)[_0xb220('0x27')](function(_0xf9bfa6){return getInteractionTags(_0xf9bfa6,_0x3c72c6);})['then'](function(_0x353fac){_0x327f35(_0x353fac);})[_0xb220('0x30')](function(_0x55e263){_0x1ad1bb(_0x55e263);});});}exports['index']=function(_0x55e492,_0x5decff){var _0x25e73e={},_0x275952={},_0x1e455a={'count':0x0,'rows':[]};var _0x200d4a=_[_0xb220('0x31')](db[_0xb220('0x32')]['rawAttributes'],function(_0x230199){return{'name':_0x230199[_0xb220('0x33')],'type':_0x230199[_0xb220('0x34')][_0xb220('0x35')]};});_0x275952[_0xb220('0x36')]=_[_0xb220('0x31')](_0x200d4a,_0xb220('0x29'));_0x275952[_0xb220('0x37')]=_['keys'](_0x55e492[_0xb220('0x37')]);_0x275952[_0xb220('0x38')]=_['intersection'](_0x275952[_0xb220('0x36')],_0x275952['query']);_0x25e73e[_0xb220('0x39')]=_[_0xb220('0x3a')](_0x275952[_0xb220('0x36')],qs[_0xb220('0x3b')](_0x55e492['query']['fields']));_0x25e73e[_0xb220('0x39')]=_0x25e73e[_0xb220('0x39')][_0xb220('0x3c')]?_0x25e73e[_0xb220('0x39')]:_0x275952[_0xb220('0x36')];if(!_0x55e492[_0xb220('0x37')][_0xb220('0x3d')]('nolimit')){_0x25e73e[_0xb220('0x1e')]=qs[_0xb220('0x1e')](_0x55e492['query'][_0xb220('0x1e')]);_0x25e73e[_0xb220('0x20')]=qs['offset'](_0x55e492[_0xb220('0x37')][_0xb220('0x20')]);}_0x25e73e[_0xb220('0x3e')]=qs['sort'](_0x55e492['query'][_0xb220('0x3f')]);_0x25e73e[_0xb220('0x40')]=qs[_0xb220('0x38')](_[_0xb220('0x41')](_0x55e492['query'],_0x275952[_0xb220('0x38')]),_0x200d4a);var _0x1d510c=[];var _0x5ee814=squel[_0xb220('0x42')]()['field']('id')[_0xb220('0x43')](_0xb220('0x29'))['field']('color')[_0xb220('0x44')]('tools_tags');var _0x1041fa=squel['select']()[_0xb220('0x43')](_0xb220('0x45'))[_0xb220('0x43')](_0xb220('0x46'))[_0xb220('0x43')](_0xb220('0x47'))[_0xb220('0x44')](_0xb220('0x48'),'ui')[_0xb220('0x49')](_0xb220('0x4a'),'u','u.id\x20=\x20ui.UserId');var _0x50073e=squel[_0xb220('0x42')]()['from'](_0xb220('0x4b'),'i')[_0xb220('0x49')](_0xb220('0x4c'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xb220('0x4a'),'o',_0xb220('0x4d'))[_0xb220('0x49')]('fax_accounts','a','a.id\x20=\x20i.FaxAccountId')[_0xb220('0x49')](_0xb220('0x4e'),'me','me.FaxInteractionId\x20=\x20i.id')[_0xb220('0x49')](_0xb220('0x4f'),'it',_0xb220('0x50'))['left_join'](_0xb220('0x51'),'t',_0xb220('0x52'));var _0x240e67=squel[_0xb220('0x53')]();var _0x5d9aeb=[];var _0x435772=squel[_0xb220('0x53')]();var _0x21ea31;if(_0x55e492[_0xb220('0x37')][_0xb220('0x54')]){_0x21ea31=as[_0xb220('0x55')](_0x55e492[_0xb220('0x37')][_0xb220('0x54')]);var _0x308a90=_0x21ea31[_0xb220('0x56')];for(var _0x1b05f9=0x0;_0x1b05f9<_0x21ea31['conditions']['length'];_0x1b05f9++){var _0x25b46e=_0x21ea31[_0xb220('0x57')][_0x1b05f9];var _0x52eef8='i';var _0x4d30d4=_[_0xb220('0x58')](_0x200d4a,['name',_0x25b46e[_0xb220('0x43')]]);if(!_0x4d30d4){switch(_0x25b46e[_0xb220('0x43')]){case'unreadMessages':if(_0x25b46e[_0xb220('0x59')]==0x1){_0x50073e[_0xb220('0x5a')]('`'+_0x25b46e[_0xb220('0x43')]+'`\x20=\x200');}else{_0x50073e['having']('`'+_0x25b46e[_0xb220('0x43')]+'`\x20>\x200');}break;case _0xb220('0x5b'):if(_0x25b46e[_0xb220('0x5c')]===_0xb220('0x5d')){if(_0x25b46e[_0xb220('0x59')][_0xb220('0x2d')]('\x20')['length']>0x1){_0x240e67[_0x308a90](_0xb220('0x5e'),qs[_0xb220('0x5f')](_0x25b46e['value']),null);}else{var _0x139513='%'+_0x25b46e[_0xb220('0x59')]+'%';_0x240e67[_0x308a90]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x139513,_0x139513,_0x139513);}}else{_0x4d30d4=_[_0xb220('0x58')](_0x200d4a,[_0xb220('0x29'),'ContactId']);_0x25b46e[_0xb220('0x43')]='ContactId';_0x5c7346=as[_0xb220('0x60')](_0x52eef8,_0x4d30d4['type'],_0x25b46e);_0x240e67[_0x308a90](_0x5c7346[_0xb220('0x61')],_0x5c7346[_0xb220('0x59')][_0xb220('0x62')],_0x5c7346[_0xb220('0x59')]['end']);}break;case'Tag':var _0x484fe6=_0x25b46e[_0xb220('0x59')][_0xb220('0x2d')](',')[_0xb220('0x31')](function(_0x23ea84){return Number(_0x23ea84);});_0x484fe6['forEach'](function(_0x26747f){_0x435772['or'](_0xb220('0x63'),'%,'+_0x26747f+',%');});_0x5d9aeb=_[_0xb220('0x64')](_0x5d9aeb,_0x484fe6);break;case _0xb220('0x65'):if(_0x25b46e[_0xb220('0x5c')]===_0xb220('0x5d')){_0x240e67[_0x308a90]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x25b46e['value']+'%',null);}else{_0x4d30d4=_[_0xb220('0x58')](_0x200d4a,[_0xb220('0x29'),'UserId']);_0x25b46e[_0xb220('0x43')]=_0xb220('0x66');_0x5c7346=as[_0xb220('0x60')](_0x52eef8,_0x4d30d4['type'],_0x25b46e);_0x240e67[_0x308a90](_0x5c7346[_0xb220('0x61')],_0x5c7346[_0xb220('0x59')][_0xb220('0x62')],_0x5c7346[_0xb220('0x59')][_0xb220('0x1c')]);}break;case _0xb220('0x67'):_0x5c7346=as[_0xb220('0x60')]('me',null,_0x25b46e);_0x240e67[_0x308a90](_0x5c7346[_0xb220('0x61')],_0x5c7346[_0xb220('0x59')][_0xb220('0x62')],_0x5c7346[_0xb220('0x59')][_0xb220('0x1c')]);break;}}else{var _0x5c7346=as[_0xb220('0x60')](_0x52eef8,_0x4d30d4[_0xb220('0x34')],_0x25b46e);_0x240e67[_0x308a90](_0x5c7346[_0xb220('0x61')],_0x5c7346[_0xb220('0x59')][_0xb220('0x62')],_0x5c7346[_0xb220('0x59')][_0xb220('0x1c')]);}}}else{var _0x469c16=_(_0x55e492['query'])['keys']()['map'](function(_0x3c6159){return _[_0xb220('0x68')](_0x200d4a,[_0xb220('0x29'),_0x3c6159])?_0x3c6159:undefined;})[_0xb220('0x69')]()['value']();if(!_[_0xb220('0x6a')](_0x469c16)){_0x469c16['forEach'](function(_0xa87c4f){if(_0xa87c4f==='FaxAccountId'){_0x50073e[_0xb220('0x40')](_0xb220('0x6b'),[][_0xb220('0x6c')](_0x55e492[_0xb220('0x37')][_0xa87c4f]));}else if(_0xa87c4f===_0xb220('0x6d')){var _0x1879c5=JSON['parse'](_0x55e492['query'][_0xa87c4f])[_0xb220('0x6e')];var _0x248e54=JSON[_0xb220('0x6f')](_0x55e492[_0xb220('0x37')][_0xa87c4f])[_0xb220('0x70')];_0x50073e[_0xb220('0x40')](_0xb220('0x71'),_0x1879c5,_0x248e54);}else{if(_0x55e492[_0xb220('0x37')][_0xa87c4f]===_0xb220('0x72')){_0x50073e[_0xb220('0x40')]('i.'+_0xa87c4f+_0xb220('0x73'));}else{_0x50073e[_0xb220('0x40')]('i.'+_0xa87c4f+'\x20=\x20?',_0x55e492[_0xb220('0x37')][_0xa87c4f]);}}});}if(_0x55e492[_0xb220('0x37')][_0xb220('0x74')]){if(_0x55e492[_0xb220('0x37')]['read']==0x1){_0x50073e['having'](_0xb220('0x75'));}else{_0x50073e[_0xb220('0x5a')]('`unreadMessages`\x20>\x200');}}if(_0x55e492['query'][_0xb220('0x76')]){_0x5d9aeb=_[_0xb220('0x77')](_0x55e492[_0xb220('0x37')][_0xb220('0x76')])?_0x55e492[_0xb220('0x37')][_0xb220('0x76')]:new Array(_0x55e492[_0xb220('0x37')][_0xb220('0x76')]);_0x5d9aeb[_0xb220('0x2e')](function(_0x1e827c){_0x435772['or'](_0xb220('0x63'),'%,'+_0x1e827c+',%');});}if(_0x55e492[_0xb220('0x37')][_0xb220('0x78')]){var _0x1663b7=_0x55e492[_0xb220('0x37')]['filter'][_0xb220('0x79')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xb220('0x7a')](_0x1663b7)){_0x240e67['or']('i.id\x20LIKE\x20?',_0x1663b7+'%')['or'](_0xb220('0x7b'),_0x1663b7+'%');}_0x240e67['or'](_0xb220('0x7c'),_0x1663b7+'%');}}_0x50073e[_0xb220('0x40')](_0x240e67);_0x50073e[_0xb220('0x7d')]('i.id');var _0x1acdaa={'type':db[_0xb220('0x7e')][_0xb220('0x7f')][_0xb220('0x80')],'raw':!![]};var _0x228765=_0x50073e[_0xb220('0x81')]();_0x228765[_0xb220('0x43')](_0xb220('0x82'));_0x228765[_0xb220('0x43')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xb220('0x83'));if(_0x25e73e[_0xb220('0x3e')]){_0x25e73e[_0xb220('0x3e')][_0xb220('0x2e')](function(_0x312662){var _0x3676f1=_0x312662[0x0]===_0xb220('0x84')?_0x312662[0x0]:'i.'+_0x312662[0x0];_0x50073e['order'](_0x3676f1,_0x312662[0x1]===_0xb220('0x85')?![]:!![]);});}if(!_[_0xb220('0x6a')](_0x5d9aeb)){_0x50073e[_0xb220('0x5a')](_0x435772);_0x228765['where'](_0xb220('0x86'),_0x5d9aeb);}BPromise['resolve']()['then'](function(){if(!_0x21ea31){if(_0x55e492[_0xb220('0x37')]['FaxAccountId'])return;_0x228765['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x50073e[_0xb220('0x40')](_0xb220('0x87'));return;}if(_0x55e492['user'][_0xb220('0x88')]!=='agent')return;return _0x55e492['user'][_0xb220('0x89')]({'attributes':['id'],'raw':!![]})[_0xb220('0x27')](function(_0x4a67fd){if(_[_0xb220('0x6a')](_0x4a67fd)){_0x228765[_0xb220('0x40')](_0xb220('0x8a'));_0x50073e[_0xb220('0x40')](_0xb220('0x8a'));}else{_0x228765['where'](_0xb220('0x6b'),_[_0xb220('0x31')](_0x4a67fd,'id'));_0x50073e[_0xb220('0x40')]('i.FaxAccountId\x20IN\x20?',_['map'](_0x4a67fd,'id'));}});})['then'](function(){if(_0x55e492['user']['role']===_0xb220('0x8b')&&!_0x21ea31&&!_0x55e492['query'][_0xb220('0x8c')])return[];return db[_0xb220('0x8d')]['query'](_0x228765[_0xb220('0x8e')](),_0x1acdaa);})['then'](function(_0x617ff2){_0x1e455a['count']=_0x617ff2[_0xb220('0x3c')];if(_0x1e455a[_0xb220('0x1f')]===0x0)return[];return db[_0xb220('0x8d')][_0xb220('0x37')](_0x5ee814['toString'](),_0x1acdaa)['then'](function(_0x4d3602){_0x1d510c=_[_0xb220('0x8f')](_0x4d3602,'id');_0x1acdaa=_[_0xb220('0x90')](_0x1acdaa,{'model':db[_0xb220('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x55e492['query'][_0xb220('0x3b')]){_0x25e73e[_0xb220('0x39')][_0xb220('0x2e')](function(_0xf0e649){_0x50073e[_0xb220('0x43')]('i.'+_0xf0e649);});}else{_0x50073e[_0xb220('0x43')](_0xb220('0x91'),'unreadMessages');_0x50073e[_0xb220('0x43')](_0xb220('0x92'),_0xb220('0x93'));_0x50073e['field'](_0xb220('0x94'),_0xb220('0x95'));_0x50073e[_0xb220('0x43')](_0xb220('0x96'),_0xb220('0x84'));_0x50073e['field'](_0xb220('0x97'));_0x50073e[_0xb220('0x43')](_0xb220('0x98'),_0xb220('0x99'));_0x50073e['field'](_0xb220('0x9a'),_0xb220('0x9b'));_0x50073e[_0xb220('0x43')]('c.email',_0xb220('0x9c'));_0x50073e['field'](_0xb220('0x9d'),_0xb220('0x9e'));_0x50073e[_0xb220('0x43')]('c.mobile',_0xb220('0x9f'));_0x50073e[_0xb220('0x43')](_0xb220('0xa0'),_0xb220('0xa1'));_0x50073e[_0xb220('0x43')](_0xb220('0xa2'),'Owner.fullname');_0x50073e[_0xb220('0x43')](_0xb220('0xa3'),'Owner.internal');_0x50073e[_0xb220('0x43')](_0xb220('0xa4'),_0xb220('0x2b'));}if(_0x25e73e[_0xb220('0x1e')])_0x50073e['limit'](_0x25e73e[_0xb220('0x1e')]);if(_0x25e73e[_0xb220('0x20')])_0x50073e[_0xb220('0x20')](_0x25e73e[_0xb220('0x20')]);return db[_0xb220('0x8d')]['query'](_0x50073e[_0xb220('0x8e')](),_0x1acdaa);})[_0xb220('0x27')](function(_0x47e47e){if(_0x47e47e[_0xb220('0x3c')]>0x0)_0x1041fa[_0xb220('0x40')](_0xb220('0xa5'),_['map'](_0x47e47e,'id'));return db[_0xb220('0x8d')]['query'](_0x1041fa[_0xb220('0x8e')](),_0x1acdaa)['then'](function(_0x2f7527){var _0x53f818=_[_0xb220('0xa6')](_0x2f7527,'FaxInteractionId');var _0x4e332d=[];_0x47e47e[_0xb220('0x2e')](function(_0x55a090){_0x4e332d[_0xb220('0x2f')](updateFaxInteraction(_0x55a090,_0x1d510c,_0x53f818));});return BPromise[_0xb220('0xa7')](_0x4e332d);});});})[_0xb220('0x27')](function(_0x14454b){_0x1e455a[_0xb220('0xa8')]=_0x14454b;return _0x1e455a;})[_0xb220('0x27')](respondWithFilteredResult(_0x5decff,_0x25e73e))[_0xb220('0x30')](handleError(_0x5decff,null));};exports[_0xb220('0xa9')]=function(_0x2671cc,_0x1bde25){var _0x41373b={'raw':![],'where':{'id':_0x2671cc['params']['id']}},_0x2a676a={};_0x2a676a[_0xb220('0x36')]=_[_0xb220('0xaa')](db[_0xb220('0x32')][_0xb220('0xab')]);_0x2a676a['query']=_[_0xb220('0xaa')](_0x2671cc[_0xb220('0x37')]);_0x2a676a[_0xb220('0x38')]=_[_0xb220('0x3a')](_0x2a676a['model'],_0x2a676a[_0xb220('0x37')]);_0x41373b[_0xb220('0x39')]=_[_0xb220('0x3a')](_0x2a676a[_0xb220('0x36')],qs[_0xb220('0x3b')](_0x2671cc[_0xb220('0x37')][_0xb220('0x3b')]));_0x41373b[_0xb220('0x39')]=_0x41373b['attributes'][_0xb220('0x3c')]?_0x41373b['attributes']:_0x2a676a[_0xb220('0x36')];if(_0x2671cc[_0xb220('0x37')][_0xb220('0xac')]){_0x41373b[_0xb220('0xad')]=[{'all':!![]}];}_0x41373b=_[_0xb220('0x90')]({},_0x41373b,_0x2671cc['options']);return db[_0xb220('0x32')][_0xb220('0x58')](_0x41373b)[_0xb220('0x27')](handleEntityNotFound(_0x1bde25,null))[_0xb220('0x27')](respondWithResult(_0x1bde25,null))[_0xb220('0x30')](handleError(_0x1bde25,null));};exports[_0xb220('0xae')]=function(_0x4cd208,_0x1ea648){return db[_0xb220('0x32')][_0xb220('0xae')](_0x4cd208['body'],{})[_0xb220('0x27')](respondWithResult(_0x1ea648,0xc9))[_0xb220('0x30')](handleError(_0x1ea648,null));};exports['update']=function(_0x1e1f59,_0x3b331d){if(_0x1e1f59[_0xb220('0x67')]['id']){delete _0x1e1f59[_0xb220('0x67')]['id'];}return db[_0xb220('0x32')]['find']({'where':{'id':_0x1e1f59[_0xb220('0xaf')]['id']}})[_0xb220('0x27')](handleEntityNotFound(_0x3b331d,null))[_0xb220('0x27')](saveUpdates(_0x1e1f59[_0xb220('0x67')],null))[_0xb220('0x27')](respondWithResult(_0x3b331d,null))['catch'](handleError(_0x3b331d,null));};exports[_0xb220('0x26')]=function(_0x14d77c,_0x2f44a8){return db[_0xb220('0x32')][_0xb220('0x58')]({'where':{'id':_0x14d77c['params']['id']}})[_0xb220('0x27')](handleEntityNotFound(_0x2f44a8,null))[_0xb220('0x27')](removeEntity(_0x2f44a8,null))['catch'](handleError(_0x2f44a8,null));};exports['describe']=function(_0x4e2774,_0x148390){return db['FaxInteraction'][_0xb220('0xb0')]()[_0xb220('0x27')](respondWithResult(_0x148390,null))[_0xb220('0x30')](handleError(_0x148390,null));};exports[_0xb220('0xb1')]=function(_0x589a60,_0xaf27de,_0x5a2140){return db[_0xb220('0xb2')]['find']({'where':{'id':_0x589a60[_0xb220('0xaf')]['id']}})[_0xb220('0x27')](handleEntityNotFound(_0xaf27de,null))['then'](function(_0x3071da){if(_0x3071da){return _0x3071da[_0xb220('0xb1')](_0x589a60[_0xb220('0x67')][_0xb220('0xb3')],_[_0xb220('0xb4')](_0x589a60[_0xb220('0x67')],[_0xb220('0xb3'),'id'])||{});}})['then'](respondWithResult(_0xaf27de,null))[_0xb220('0x30')](handleError(_0xaf27de,null));};exports[_0xb220('0xb5')]=function(_0x3b0462,_0x3a01c1,_0x3be443){var _0x5150c8={'raw':![],'where':{}};var _0x198ea8={};var _0xe66bc={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xb220('0xb6')]({'where':{'id':_0x3b0462['params']['id']}})[_0xb220('0x27')](handleEntityNotFound(_0x3a01c1,null))[_0xb220('0x27')](function(_0x405c63){if(_0x405c63){_0x198ea8['model']=_[_0xb220('0xaa')](db['FaxMessage'][_0xb220('0xab')]);_0x198ea8[_0xb220('0x37')]=_[_0xb220('0xaa')](_0x3b0462[_0xb220('0x37')]);_0x198ea8['filters']=_[_0xb220('0x3a')](_0x198ea8[_0xb220('0x36')],_0x198ea8['query']);_0x5150c8[_0xb220('0x39')]=_['intersection'](_0x198ea8[_0xb220('0x36')],qs[_0xb220('0x3b')](_0x3b0462['query']['fields']));_0x5150c8['attributes']=_0x5150c8['attributes'][_0xb220('0x3c')]?_0x5150c8[_0xb220('0x39')]:_0x198ea8[_0xb220('0x36')];if(!_0x3b0462[_0xb220('0x37')][_0xb220('0x3d')](_0xb220('0xb7'))){_0x5150c8[_0xb220('0x1e')]=qs[_0xb220('0x1e')](_0x3b0462[_0xb220('0x37')][_0xb220('0x1e')]);_0x5150c8[_0xb220('0x20')]=qs[_0xb220('0x20')](_0x3b0462['query'][_0xb220('0x20')]);}_0x5150c8[_0xb220('0x3e')]=qs[_0xb220('0x3f')](_0x3b0462[_0xb220('0x37')]['sort']);_0x5150c8[_0xb220('0x40')]=qs[_0xb220('0x38')](_[_0xb220('0x41')](_0x3b0462[_0xb220('0x37')],_0x198ea8[_0xb220('0x38')]));_0x5150c8[_0xb220('0x40')][_0xb220('0xb8')]=_0x405c63['id'];if(_0x3b0462[_0xb220('0x37')][_0xb220('0x78')]){_0x5150c8['where']=_['merge'](_0x5150c8['where'],{'$or':_[_0xb220('0x31')](_0x5150c8[_0xb220('0x39')],function(_0x416d89){var _0x1e80fc={};_0x1e80fc[_0x416d89]={'$like':'%'+_0x3b0462['query'][_0xb220('0x78')]+'%'};return _0x1e80fc;})});}if(_0x3b0462[_0xb220('0x37')][_0xb220('0x6e')]){var _0x210272=_0x3b0462[_0xb220('0x37')][_0xb220('0x6e')][_0xb220('0x2d')](',');var _0x4bf93d={};_0x4bf93d[_0x210272[0x0]]={'$gte':moment(_0x210272[0x1])[_0xb220('0xb9')](_0xb220('0xba'))};_0x5150c8[_0xb220('0x40')]=_[_0xb220('0x90')](_0x5150c8[_0xb220('0x40')],_0x4bf93d);}_0x5150c8=_[_0xb220('0x90')]({},_0x5150c8,_0x3b0462[_0xb220('0xbb')]);return db[_0xb220('0xb2')][_0xb220('0x1f')]({'where':_0x5150c8[_0xb220('0x40')]})[_0xb220('0x27')](function(_0x892daa){_0xe66bc[_0xb220('0x1f')]=_0x892daa;if(_0x3b0462[_0xb220('0x37')][_0xb220('0xac')]){_0x5150c8[_0xb220('0xad')]=[{'all':!![]}];}return db[_0xb220('0xb2')][_0xb220('0xbc')](_0x5150c8);})[_0xb220('0x27')](function(_0x217326){_0xe66bc[_0xb220('0xa8')]=_0x217326;return _0xe66bc;});}})[_0xb220('0x27')](respondWithFilteredResult(_0x3a01c1,_0x5150c8))[_0xb220('0x30')](handleError(_0x3a01c1,null));};exports[_0xb220('0xbd')]=function(_0x2195a1,_0x15103a,_0x2c3b25){return db[_0xb220('0x32')][_0xb220('0x58')]({'where':{'id':_0x2195a1['params']['id']}})[_0xb220('0x27')](handleEntityNotFound(_0x15103a,null))[_0xb220('0x27')](function(_0x45abd7){if(_0x45abd7){return _0x45abd7[_0xb220('0xbe')](_0x2195a1['body'][_0xb220('0xb3')],_[_0xb220('0xb4')](_0x2195a1[_0xb220('0x67')],[_0xb220('0xb3'),'id'])||{})[_0xb220('0xbf')](function(){return db['Tag']['findAll']({'attributes':['id','name',_0xb220('0xc0')],'where':{'id':_0x2195a1['body'][_0xb220('0xb3')]}});})['then'](function(_0x12ac9c){socket['emit'](_0xb220('0xc1'),{'id':Number(_0x2195a1[_0xb220('0xaf')]['id']),'tags':_0x12ac9c||[]});return{'id':Number(_0x2195a1[_0xb220('0xaf')]['id']),'tags':_0x12ac9c||[]};});}})[_0xb220('0x27')](respondWithResult(_0x15103a,null))[_0xb220('0x30')](handleError(_0x15103a,null));};exports[_0xb220('0xc2')]=function(_0x274421,_0x169563,_0x39148b){return db[_0xb220('0x32')][_0xb220('0x58')]({'where':{'id':_0x274421[_0xb220('0xaf')]['id']}})['then'](handleEntityNotFound(_0x169563,null))[_0xb220('0x27')](function(_0x5706a1){if(_0x5706a1){return _0x5706a1['removeTags'](_0x274421[_0xb220('0x37')][_0xb220('0xb3')]);}})[_0xb220('0x27')](respondWithStatusCode(_0x169563,null))[_0xb220('0x30')](handleError(_0x169563,null));};exports[_0xb220('0xc3')]=function(_0xf24e5a,_0x3b957b){var _0x4981fe=moment()[_0xb220('0xc4')]()[_0xb220('0x8e')]();var _0x5d82b4=path[_0xb220('0xc5')](config[_0xb220('0xc6')],_0xb220('0xc7'),_0xb220('0xc8'),_0xb220('0xc9'));var _0x361d19=path[_0xb220('0xc5')](config[_0xb220('0xc6')],_0xb220('0xc7'),'files','attachments');var _0x14090c=path[_0xb220('0xc5')](_0x5d82b4,_0x4981fe);var _0x3d9c64=util[_0xb220('0xb9')](_0xb220('0xca'),_0xf24e5a[_0xb220('0xaf')]['id'],_0x4981fe);var _0x5b5277=path[_0xb220('0xc5')](_0x5d82b4,_0x3d9c64);var _0x50ffea=[];_0x50ffea[_0xb220('0x2f')]({'model':db[_0xb220('0xcb')],'as':_0xb220('0xcb'),'raw':!![]});var _0x35670f=[{'model':db[_0xb220('0xb2')],'as':_0xb220('0xcc'),'attributes':['id',_0xb220('0x67'),_0xb220('0x6d')],'include':_0x50ffea}];return db['FaxInteraction'][_0xb220('0x58')]({'where':{'id':_0xf24e5a[_0xb220('0xaf')]['id']},'include':_0x35670f})[_0xb220('0x27')](handleEntityNotFound(_0x3b957b,null))[_0xb220('0x27')](function(_0xebc36e){if(_0xebc36e&&_0xebc36e[_0xb220('0xcc')]){var _0x23cb4c=_0xebc36e[_0xb220('0xcd')]({'plain':!![]});fs[_0xb220('0xce')](_0x14090c);for(var _0x4cfa3d=0x0;_0x4cfa3d<_0x23cb4c['Messages'][_0xb220('0x3c')];_0x4cfa3d++){var _0x5a0f6b=_0x23cb4c[_0xb220('0xcc')][_0x4cfa3d]['Attachment'];if(_0x5a0f6b){var _0xf8e493=path[_0xb220('0xc5')](_0x361d19,_0x5a0f6b[_0xb220('0xcf')]);if(fs['existsSync'](_0xf8e493)){fs[_0xb220('0xd0')](_0xf8e493)[_0xb220('0xd1')](fs['createWriteStream'](path['join'](_0x14090c,_0x5a0f6b['basename'])));}}}return BPromise[_0xb220('0xd2')]()[_0xb220('0x27')](function(){return new BPromise(function(_0x426d39,_0x152827){zipdir(_0x14090c,{'saveTo':_0x5b5277},function(_0x148de3,_0x1e4dd9){if(_0x148de3)return _0x152827(_0x148de3);return _0x426d39(_0x1e4dd9);});})['then'](function(){return new BPromise(function(_0x5138ed,_0x21a55b){rimraf(_0x14090c,function(_0x2119d7){if(_0x2119d7)_0x21a55b(_0x2119d7);return _0x5138ed();});});})[_0xb220('0x27')](function(){return _0x3b957b['download'](_0x5b5277,_0x3d9c64,function(_0x57a5de){if(_0x57a5de){console[_0xb220('0xd3')](_0xb220('0xd4'),_0x57a5de);}else{fs[_0xb220('0xd5')](_0x5b5277);}});});});}else{return _0x3b957b['sendStatus'](0xc8);}})['catch'](handleError(_0x3b957b,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index d940157..bec38ce 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 _0xa8eb=['remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','exports','events','FaxInteraction','../../mysqldb','FaxMessage','update'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0xa8eb,0x8b));var _0xba8e=function(_0x243fda,_0x4047fb){_0x243fda=_0x243fda-0x0;var _0x2f1c94=_0xa8eb[_0x243fda];return _0x2f1c94;};'use strict';var EventEmitter=require(_0xba8e('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0xba8e('0x1')];var FaxMessage=require(_0xba8e('0x2'))['db'][_0xba8e('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xba8e('0x4'),'afterDestroy':_0xba8e('0x5')};function emitEvent(_0x2f888f){return function(_0x53e8c3,_0x2d61cb,_0x4f0d59){_0x53e8c3['getUsers']({'attributes':['id'],'raw':!![]})[_0xba8e('0x6')](function(_0x4f51b4){_0x53e8c3[_0xba8e('0x7')](_0xba8e('0x8'),_0x4f51b4[_0xba8e('0x9')](function(_0x20d427){return{'id':_0x20d427['id']};}));return FaxMessage[_0xba8e('0xa')]({'where':{'FaxInteractionId':_0x53e8c3['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3bdccc){_0x53e8c3[_0xba8e('0x7')](_0xba8e('0xb'),_0x3bdccc[_0xba8e('0xc')]);FaxInteractionEvents[_0xba8e('0xd')](_0x2f888f+':'+_0x53e8c3['id'],_0x53e8c3);FaxInteractionEvents[_0xba8e('0xd')](_0x2f888f,_0x53e8c3);_0x4f0d59(null);})[_0xba8e('0xe')](_0x4f0d59(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xba8e('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0xd1d4=['then','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','setDataValue','map','findAll'];(function(_0x2bf409,_0x1ae11b){var _0x234033=function(_0xbfef1e){while(--_0xbfef1e){_0x2bf409['push'](_0x2bf409['shift']());}};_0x234033(++_0x1ae11b);}(_0xd1d4,0x1c9));var _0x4d1d=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xd1d4[_0x27af45];return _0x18df21;};'use strict';var EventEmitter=require(_0x4d1d('0x0'));var FaxInteraction=require(_0x4d1d('0x1'))['db'][_0x4d1d('0x2')];var FaxMessage=require(_0x4d1d('0x1'))['db'][_0x4d1d('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x4d1d('0x4')](0x0);var events={'afterCreate':_0x4d1d('0x5'),'afterUpdate':_0x4d1d('0x6'),'afterDestroy':_0x4d1d('0x7')};function emitEvent(_0x45b84a){return function(_0x5e7c32,_0x30c974,_0x4b5078){_0x5e7c32['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x155125){_0x5e7c32[_0x4d1d('0x8')]('Users',_0x155125[_0x4d1d('0x9')](function(_0x1899c8){return{'id':_0x1899c8['id']};}));return FaxMessage[_0x4d1d('0xa')]({'where':{'FaxInteractionId':_0x5e7c32['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4d1d('0xb')](function(_0x1bec7f){_0x5e7c32[_0x4d1d('0x8')](_0x4d1d('0xc'),_0x1bec7f[_0x4d1d('0xd')]);FaxInteractionEvents[_0x4d1d('0xe')](_0x45b84a+':'+_0x5e7c32['id'],_0x5e7c32);FaxInteractionEvents[_0x4d1d('0xe')](_0x45b84a,_0x5e7c32);_0x4b5078(null);})[_0x4d1d('0xf')](_0x4b5078(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x4d1d('0x10')](e,emitEvent(event));}}module[_0x4d1d('0x11')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 799dda2..9a1be62 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 _0xc5fe=['rimraf','./faxInteraction.attributes','exports','FaxInteraction','changed','closed','closedAt','format','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2f1517,_0x113b9d){var _0x1c2e41=function(_0x542755){while(--_0x542755){_0x2f1517['push'](_0x2f1517['shift']());}};_0x1c2e41(++_0x113b9d);}(_0xc5fe,0x152));var _0xec5f=function(_0x483e77,_0x433e9b){_0x483e77=_0x483e77-0x0;var _0x359df0=_0xc5fe[_0x483e77];return _0x359df0;};'use strict';var _=require(_0xec5f('0x0'));var util=require('util');var logger=require(_0xec5f('0x1'))(_0xec5f('0x2'));var moment=require(_0xec5f('0x3'));var BPromise=require(_0xec5f('0x4'));var rp=require(_0xec5f('0x5'));var fs=require('fs');var path=require(_0xec5f('0x6'));var rimraf=require(_0xec5f('0x7'));var config=require('../../config/environment');var attributes=require(_0xec5f('0x8'));module[_0xec5f('0x9')]=function(_0x35b59a,_0x3632c1){return _0x35b59a['define'](_0xec5f('0xa'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2a9d51,_0x1e15bf,_0x414c28){if(_0x2a9d51[_0xec5f('0xb')](_0xec5f('0xc'))){_0x2a9d51[_0xec5f('0xd')]=moment()[_0xec5f('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x414c28(null,_0x2a9d51);}}});}; \ No newline at end of file +var _0x3338=['rimraf','../../config/environment','./faxInteraction.attributes','exports','define','closed','closedAt','format','lodash','util','moment','bluebird','request-promise','path'];(function(_0x1f0643,_0x2e210f){var _0x403899=function(_0x5d7627){while(--_0x5d7627){_0x1f0643['push'](_0x1f0643['shift']());}};_0x403899(++_0x2e210f);}(_0x3338,0xb0));var _0x8333=function(_0x268b51,_0x24e494){_0x268b51=_0x268b51-0x0;var _0x3306c0=_0x3338[_0x268b51];return _0x3306c0;};'use strict';var _=require(_0x8333('0x0'));var util=require(_0x8333('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8333('0x2'));var BPromise=require(_0x8333('0x3'));var rp=require(_0x8333('0x4'));var fs=require('fs');var path=require(_0x8333('0x5'));var rimraf=require(_0x8333('0x6'));var config=require(_0x8333('0x7'));var attributes=require(_0x8333('0x8'));module[_0x8333('0x9')]=function(_0xde1a75,_0x14211c){return _0xde1a75[_0x8333('0xa')]('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x504e64,_0x2b1d7c,_0x2996e3){if(_0x504e64['changed'](_0x8333('0xb'))){_0x504e64[_0x8333('0xc')]=moment()[_0x8333('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2996e3(null,_0x504e64);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index c74b3f4..f394eb3 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 _0x0929=['AddTagsToFaxInteraction','find','addTags','omit','ids','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateFaxInteraction','FaxInteraction','update','body','options','where','attributes','limit','stringify','catch'];(function(_0x480a92,_0x1ca3bf){var _0x2a0078=function(_0x1cea8b){while(--_0x1cea8b){_0x480a92['push'](_0x480a92['shift']());}};_0x2a0078(++_0x1ca3bf);}(_0x0929,0x18a));var _0x9092=function(_0x4d77d5,_0xf3c18){_0x4d77d5=_0x4d77d5-0x0;var _0x4d590d=_0x0929[_0x4d77d5];return _0x4d590d;};'use strict';var _=require(_0x9092('0x0'));var util=require('util');var moment=require(_0x9092('0x1'));var BPromise=require('bluebird');var rs=require(_0x9092('0x2'));var fs=require('fs');var Redis=require(_0x9092('0x3'));var db=require(_0x9092('0x4'))['db'];var utils=require(_0x9092('0x5'));var logger=require(_0x9092('0x6'))(_0x9092('0x7'));var config=require(_0x9092('0x8'));var jayson=require(_0x9092('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x9092('0xa')]=_[_0x9092('0xb')](config[_0x9092('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x9092('0xc'))(new Redis(config[_0x9092('0xa')]));require(_0x9092('0xd'))[_0x9092('0xe')](socket);function respondWithRpcPromise(_0x46a682,_0x5ddc35,_0x4461fe){return new BPromise(function(_0x326a3d,_0x3c0736){return client[_0x9092('0xf')](_0x46a682,_0x4461fe)[_0x9092('0x10')](function(_0x45f67e){logger[_0x9092('0x11')](_0x9092('0x12'),_0x5ddc35,_0x9092('0x13'));logger[_0x9092('0x14')](_0x9092('0x15'),_0x5ddc35,'request\x20sent',JSON['stringify'](_0x45f67e));if(_0x45f67e[_0x9092('0x16')]){if(_0x45f67e[_0x9092('0x16')][_0x9092('0x17')]===0x1f4){logger[_0x9092('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x5ddc35,_0x45f67e[_0x9092('0x16')][_0x9092('0x18')]);return _0x3c0736(_0x45f67e[_0x9092('0x16')][_0x9092('0x18')]);}logger[_0x9092('0x16')](_0x9092('0x12'),_0x5ddc35,_0x45f67e[_0x9092('0x16')][_0x9092('0x18')]);return _0x326a3d(_0x45f67e['error'][_0x9092('0x18')]);}else{logger['info'](_0x9092('0x12'),_0x5ddc35,'request\x20sent');_0x326a3d(_0x45f67e[_0x9092('0x19')]['message']);}})['catch'](function(_0x50aea7){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x5ddc35,_0x50aea7);_0x3c0736(_0x50aea7);});});}exports[_0x9092('0x1a')]=function(_0x588ef8){var _0x74f825=this;return new Promise(function(_0x58446b,_0xe9a2b3){return db[_0x9092('0x1b')][_0x9092('0x1c')](_0x588ef8[_0x9092('0x1d')],{'raw':_0x588ef8[_0x9092('0x1e')]?_0x588ef8[_0x9092('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x588ef8['options']?_0x588ef8['options'][_0x9092('0x1f')]||null:null,'attributes':_0x588ef8[_0x9092('0x1e')]?_0x588ef8[_0x9092('0x1e')][_0x9092('0x20')]||null:null,'limit':_0x588ef8['options']?_0x588ef8['options'][_0x9092('0x21')]||null:null})['then'](function(_0x2c17b){logger['info']('UpdateFaxInteraction',_0x588ef8);logger[_0x9092('0x14')](_0x9092('0x1a'),_0x588ef8,JSON[_0x9092('0x22')](_0x2c17b));_0x58446b(_0x2c17b);})[_0x9092('0x23')](function(_0xa1f7e4){logger[_0x9092('0x16')](_0x9092('0x1a'),_0xa1f7e4['message'],_0x588ef8);_0xe9a2b3(_0x74f825[_0x9092('0x16')](0x1f4,_0xa1f7e4[_0x9092('0x18')]));});});};exports[_0x9092('0x24')]=function(_0x4d92f3){return new Promise(function(_0x408c00,_0x5b7eb0){return db[_0x9092('0x1b')][_0x9092('0x25')]({'where':_0x4d92f3[_0x9092('0x1e')]?_0x4d92f3[_0x9092('0x1e')][_0x9092('0x1f')]||null:null})['then'](function(_0x1da09d){if(_0x1da09d){return _0x1da09d[_0x9092('0x26')](_0x4d92f3['body']['ids'],_[_0x9092('0x27')](_0x4d92f3[_0x9092('0x1d')],[_0x9092('0x28'),'id'])||{});}})[_0x9092('0x29')](function(_0x57701f){logger[_0x9092('0x11')](_0x9092('0x2a'),_0x4d92f3);logger[_0x9092('0x14')](_0x9092('0x2a'),_0x4d92f3,JSON['stringify'](_0x57701f));_0x408c00(_0x57701f);})[_0x9092('0x23')](function(_0x6799ef){logger[_0x9092('0x16')](_0x9092('0x2a'),_0x6799ef[_0x9092('0x18')],_0x4d92f3);_0x5b7eb0(_this['error'](0x1f4,_0x6799ef[_0x9092('0x18')]));});});}; \ No newline at end of file +var _0xddab=['ids','AddTags','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','stringify','catch','AddTagsToFaxInteraction','addTags'];(function(_0x2723a5,_0x37418e){var _0xe9b5c0=function(_0x3830ab){while(--_0x3830ab){_0x2723a5['push'](_0x2723a5['shift']());}};_0xe9b5c0(++_0x37418e);}(_0xddab,0x19c));var _0xbdda=function(_0x2a912b,_0x1f4b9b){_0x2a912b=_0x2a912b-0x0;var _0x1d631c=_0xddab[_0x2a912b];return _0x1d631c;};'use strict';var _=require('lodash');var util=require(_0xbdda('0x0'));var moment=require(_0xbdda('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbdda('0x2'));var db=require(_0xbdda('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbdda('0x4'))(_0xbdda('0x5'));var config=require(_0xbdda('0x6'));var jayson=require(_0xbdda('0x7'));var client=jayson[_0xbdda('0x8')][_0xbdda('0x9')]({'port':0x232a});config['redis']=_[_0xbdda('0xa')](config[_0xbdda('0xb')],{'host':_0xbdda('0xc'),'port':0x18eb});var socket=require(_0xbdda('0xd'))(new Redis(config[_0xbdda('0xb')]));require(_0xbdda('0xe'))[_0xbdda('0xf')](socket);function respondWithRpcPromise(_0x25a8b9,_0x518ddc,_0x470a24){return new BPromise(function(_0x47f1ba,_0x164e86){return client[_0xbdda('0x10')](_0x25a8b9,_0x470a24)[_0xbdda('0x11')](function(_0x18103f){logger[_0xbdda('0x12')](_0xbdda('0x13'),_0x518ddc,_0xbdda('0x14'));logger[_0xbdda('0x15')](_0xbdda('0x16'),_0x518ddc,'request\x20sent',JSON['stringify'](_0x18103f));if(_0x18103f[_0xbdda('0x17')]){if(_0x18103f['error'][_0xbdda('0x18')]===0x1f4){logger[_0xbdda('0x17')](_0xbdda('0x13'),_0x518ddc,_0x18103f[_0xbdda('0x17')]['message']);return _0x164e86(_0x18103f[_0xbdda('0x17')][_0xbdda('0x19')]);}logger[_0xbdda('0x17')](_0xbdda('0x13'),_0x518ddc,_0x18103f[_0xbdda('0x17')][_0xbdda('0x19')]);return _0x47f1ba(_0x18103f['error'][_0xbdda('0x19')]);}else{logger[_0xbdda('0x12')](_0xbdda('0x13'),_0x518ddc,_0xbdda('0x14'));_0x47f1ba(_0x18103f[_0xbdda('0x1a')][_0xbdda('0x19')]);}})['catch'](function(_0x289bf1){logger[_0xbdda('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x518ddc,_0x289bf1);_0x164e86(_0x289bf1);});});}exports[_0xbdda('0x1b')]=function(_0x34e7f6){var _0x39774a=this;return new Promise(function(_0x5c69dd,_0x356c44){return db[_0xbdda('0x1c')][_0xbdda('0x1d')](_0x34e7f6[_0xbdda('0x1e')],{'raw':_0x34e7f6[_0xbdda('0x1f')]?_0x34e7f6['options'][_0xbdda('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34e7f6[_0xbdda('0x1f')]?_0x34e7f6[_0xbdda('0x1f')][_0xbdda('0x21')]||null:null,'attributes':_0x34e7f6[_0xbdda('0x1f')]?_0x34e7f6['options'][_0xbdda('0x22')]||null:null,'limit':_0x34e7f6[_0xbdda('0x1f')]?_0x34e7f6[_0xbdda('0x1f')]['limit']||null:null})['then'](function(_0x3ba4b6){logger[_0xbdda('0x12')](_0xbdda('0x1b'),_0x34e7f6);logger[_0xbdda('0x15')](_0xbdda('0x1b'),_0x34e7f6,JSON[_0xbdda('0x23')](_0x3ba4b6));_0x5c69dd(_0x3ba4b6);})[_0xbdda('0x24')](function(_0x54212e){logger['error'](_0xbdda('0x1b'),_0x54212e[_0xbdda('0x19')],_0x34e7f6);_0x356c44(_0x39774a[_0xbdda('0x17')](0x1f4,_0x54212e[_0xbdda('0x19')]));});});};exports[_0xbdda('0x25')]=function(_0x5da34f){return new Promise(function(_0xc2e117,_0x124020){return db['FaxInteraction']['find']({'where':_0x5da34f[_0xbdda('0x1f')]?_0x5da34f['options']['where']||null:null})['then'](function(_0xdde2e3){if(_0xdde2e3){return _0xdde2e3[_0xbdda('0x26')](_0x5da34f['body'][_0xbdda('0x27')],_['omit'](_0x5da34f[_0xbdda('0x1e')],[_0xbdda('0x27'),'id'])||{});}})['spread'](function(_0x36838e){logger['info'](_0xbdda('0x28'),_0x5da34f);logger[_0xbdda('0x15')](_0xbdda('0x28'),_0x5da34f,JSON[_0xbdda('0x23')](_0x36838e));_0xc2e117(_0x36838e);})['catch'](function(_0x1118eb){logger['error']('AddTags',_0x1118eb[_0xbdda('0x19')],_0x5da34f);_0x124020(_this[_0xbdda('0x17')](0x1f4,_0x1118eb[_0xbdda('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index e8f09c9..accd160 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 _0x8ff5=['./faxInteraction.events','save','remove','update','removeListener','register','length','faxInteraction:'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x8ff5,0x118));var _0x58ff=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8ff5[_0x122ef9];return _0x42fba0;};'use strict';var FaxInteractionEvents=require(_0x58ff('0x0'));var events=[_0x58ff('0x1'),_0x58ff('0x2'),_0x58ff('0x3')];function createListener(_0x1ff8e5,_0x4132e3){return function(_0x5aff41){_0x4132e3['emit'](_0x1ff8e5,_0x5aff41);};}function removeListener(_0x103266,_0x328157){return function(){FaxInteractionEvents[_0x58ff('0x4')](_0x103266,_0x328157);};}exports[_0x58ff('0x5')]=function(_0x15c0d7){for(var _0x113604=0x0,_0x34ee1a=events[_0x58ff('0x6')];_0x113604<_0x34ee1a;_0x113604++){var _0x4390fd=events[_0x113604];var _0xf4f5d1=createListener(_0x58ff('0x7')+_0x4390fd,_0x15c0d7);FaxInteractionEvents['on'](_0x4390fd,_0xf4f5d1);}}; \ No newline at end of file +var _0x7d49=['./faxInteraction.events','save','remove','update','emit','removeListener','length','faxInteraction:'];(function(_0x5c814d,_0x4d81c7){var _0x89b71=function(_0x1068a4){while(--_0x1068a4){_0x5c814d['push'](_0x5c814d['shift']());}};_0x89b71(++_0x4d81c7);}(_0x7d49,0x98));var _0x97d4=function(_0x3b4c4a,_0x39a1de){_0x3b4c4a=_0x3b4c4a-0x0;var _0x43929c=_0x7d49[_0x3b4c4a];return _0x43929c;};'use strict';var FaxInteractionEvents=require(_0x97d4('0x0'));var events=[_0x97d4('0x1'),_0x97d4('0x2'),_0x97d4('0x3')];function createListener(_0x19894b,_0x17f1ff){return function(_0x497afc){_0x17f1ff[_0x97d4('0x4')](_0x19894b,_0x497afc);};}function removeListener(_0x3bd50c,_0x482e80){return function(){FaxInteractionEvents[_0x97d4('0x5')](_0x3bd50c,_0x482e80);};}exports['register']=function(_0x1c099a){for(var _0x13f38f=0x0,_0x242a9f=events[_0x97d4('0x6')];_0x13f38f<_0x242a9f;_0x13f38f++){var _0x117646=events[_0x13f38f];var _0x2049b7=createListener(_0x97d4('0x7')+_0x117646,_0x1c099a);FaxInteractionEvents['on'](_0x117646,_0x2049b7);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 2e0cf53..ab08aec 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 _0x69e5=['Router','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','put','faxinteraction:update','delete','faxinteraction:destroy','destroy','multer','util','path','connect-timeout'];(function(_0x5903d8,_0x46fae7){var _0x2b0a5d=function(_0x47a036){while(--_0x47a036){_0x5903d8['push'](_0x5903d8['shift']());}};_0x2b0a5d(++_0x46fae7);}(_0x69e5,0x1cc));var _0x569e=function(_0x3fad5a,_0x2d3b02){_0x3fad5a=_0x3fad5a-0x0;var _0x4ca713=_0x69e5[_0x3fad5a];return _0x4ca713;};'use strict';var multer=require(_0x569e('0x0'));var util=require(_0x569e('0x1'));var path=require(_0x569e('0x2'));var timeout=require(_0x569e('0x3'));var express=require('express');var router=express[_0x569e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x569e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x569e('0x6'));var controller=require(_0x569e('0x7'));router[_0x569e('0x8')]('/',auth[_0x569e('0x9')](),controller[_0x569e('0xa')]);router[_0x569e('0x8')]('/describe',auth[_0x569e('0x9')](),controller[_0x569e('0xb')]);router[_0x569e('0x8')](_0x569e('0xc'),auth[_0x569e('0x9')](),controller[_0x569e('0xd')]);router[_0x569e('0x8')](_0x569e('0xe'),auth['isAuthenticated'](),controller[_0x569e('0xf')]);router[_0x569e('0x8')](_0x569e('0x10'),auth[_0x569e('0x9')](),controller[_0x569e('0x11')]);router[_0x569e('0x12')]('/',auth[_0x569e('0x9')](),controller['create']);router[_0x569e('0x12')](_0x569e('0xe'),auth[_0x569e('0x9')](),controller[_0x569e('0x13')]);router['post'](_0x569e('0x14'),auth['isAuthenticated'](),interaction[_0x569e('0x15')](_0x569e('0x16'),_0x569e('0x17')),controller['addTags']);router[_0x569e('0x18')](_0x569e('0xc'),auth[_0x569e('0x9')](),interaction['tracked'](_0x569e('0x16'),_0x569e('0x19')),controller['update']);router[_0x569e('0x1a')](_0x569e('0xc'),auth[_0x569e('0x9')](),interaction[_0x569e('0x15')]('fax',_0x569e('0x1b')),controller[_0x569e('0x1c')]);router[_0x569e('0x1a')](_0x569e('0x14'),auth[_0x569e('0x9')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x0d17=['describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','fax','faxinteraction:addtags','addTags','tracked','faxinteraction:update','update','delete','faxinteraction:destroy','removeTags','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe'];(function(_0x51c35a,_0x2554dc){var _0x37cf2f=function(_0x870c6a){while(--_0x870c6a){_0x51c35a['push'](_0x51c35a['shift']());}};_0x37cf2f(++_0x2554dc);}(_0x0d17,0x1a5));var _0x70d1=function(_0x549416,_0x47c50e){_0x549416=_0x549416-0x0;var _0x53b3a6=_0x0d17[_0x549416];return _0x53b3a6;};'use strict';var multer=require(_0x70d1('0x0'));var util=require('util');var path=require(_0x70d1('0x1'));var timeout=require('connect-timeout');var express=require(_0x70d1('0x2'));var router=express[_0x70d1('0x3')]();var fs_extra=require(_0x70d1('0x4'));var auth=require(_0x70d1('0x5'));var interaction=require(_0x70d1('0x6'));var config=require(_0x70d1('0x7'));var controller=require(_0x70d1('0x8'));router[_0x70d1('0x9')]('/',auth[_0x70d1('0xa')](),controller[_0x70d1('0xb')]);router[_0x70d1('0x9')](_0x70d1('0xc'),auth[_0x70d1('0xa')](),controller[_0x70d1('0xd')]);router['get'](_0x70d1('0xe'),auth[_0x70d1('0xa')](),controller['show']);router[_0x70d1('0x9')](_0x70d1('0xf'),auth[_0x70d1('0xa')](),controller[_0x70d1('0x10')]);router[_0x70d1('0x9')](_0x70d1('0x11'),auth['isAuthenticated'](),controller[_0x70d1('0x12')]);router[_0x70d1('0x13')]('/',auth[_0x70d1('0xa')](),controller[_0x70d1('0x14')]);router['post'](_0x70d1('0xf'),auth['isAuthenticated'](),controller['addMessage']);router[_0x70d1('0x13')](_0x70d1('0x15'),auth[_0x70d1('0xa')](),interaction['tracked'](_0x70d1('0x16'),_0x70d1('0x17')),controller[_0x70d1('0x18')]);router['put'](_0x70d1('0xe'),auth[_0x70d1('0xa')](),interaction[_0x70d1('0x19')](_0x70d1('0x16'),_0x70d1('0x1a')),controller[_0x70d1('0x1b')]);router[_0x70d1('0x1c')](_0x70d1('0xe'),auth[_0x70d1('0xa')](),interaction['tracked']('fax',_0x70d1('0x1d')),controller['destroy']);router[_0x70d1('0x1c')]('/:id/tags',auth[_0x70d1('0xa')](),controller[_0x70d1('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 42a68f6..e85402e 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 _0xe13e=['TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x475cab,_0x550892){var _0x241911=function(_0x56bb5a){while(--_0x56bb5a){_0x475cab['push'](_0x475cab['shift']());}};_0x241911(++_0x550892);}(_0xe13e,0xde));var _0xee13=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe13e[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xee13('0x0')](_0xee13('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xee13('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xee13('0x3')]('in',_0xee13('0x4')),'defaultValue':_0xee13('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xee13('0x0')],'defaultValue':null},'readAt':{'type':Sequelize[_0xee13('0x5')]}}; \ No newline at end of file +var _0x81d5=['out','sequelize','exports','medium','BOOLEAN','ENUM'];(function(_0x34c027,_0x123688){var _0x47bff0=function(_0x19c4a9){while(--_0x19c4a9){_0x34c027['push'](_0x34c027['shift']());}};_0x47bff0(++_0x123688);}(_0x81d5,0x1ab));var _0x581d=function(_0x23ab52,_0x45996c){_0x23ab52=_0x23ab52-0x0;var _0x26fa6f=_0x81d5[_0x23ab52];return _0x26fa6f;};'use strict';var Sequelize=require(_0x581d('0x0'));module[_0x581d('0x1')]={'body':{'type':Sequelize['TEXT'](_0x581d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x581d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x581d('0x4')]('in',_0x581d('0x5')),'defaultValue':_0x581d('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 8a58971..d24a70b 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 _0x4b97=['zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','register','jayson/promise','http','client','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','status','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','params','fields','length','includeAll','options','find','body','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','FaxInteraction','FaxInteractionId','read1stAt','interaction','get','[FAXMESSAGE: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','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','fax-interactions','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','sequelize','SELECT','event','create','CmContact','findOne','isNil','Attachment','AttachmentId','SendFax','basename','download','root','server','files','attachments','rimraf'];(function(_0x5a6538,_0x4e965f){var _0x1a47e0=function(_0x572dc0){while(--_0x572dc0){_0x5a6538['push'](_0x5a6538['shift']());}};_0x1a47e0(++_0x4e965f);}(_0x4b97,0x1b8));var _0x74b9=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x4b97[_0x138adb];return _0x1b27f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x74b9('0x0'));var zipdir=require(_0x74b9('0x1'));var jsonpatch=require(_0x74b9('0x2'));var rp=require(_0x74b9('0x3'));var moment=require(_0x74b9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x74b9('0x5'));var util=require(_0x74b9('0x6'));var path=require(_0x74b9('0x7'));var sox=require(_0x74b9('0x8'));var csv=require(_0x74b9('0x9'));var ejs=require(_0x74b9('0xa'));var fs=require('fs');var fs_extra=require(_0x74b9('0xb'));var _=require(_0x74b9('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x74b9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x74b9('0x9'));var querystring=require(_0x74b9('0xe'));var Papa=require(_0x74b9('0xf'));var Redis=require('ioredis');var authService=require(_0x74b9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x74b9('0x11'));var hardwareService=require(_0x74b9('0x12'));var logger=require(_0x74b9('0x13'))(_0x74b9('0x14'));var utils=require('../../config/utils');var config=require(_0x74b9('0x15'));var licenseUtil=require(_0x74b9('0x16'));var db=require(_0x74b9('0x17'))['db'];config['redis']=_[_0x74b9('0x18')](config['redis'],{'host':_0x74b9('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x74b9('0x1a')]));require('./faxMessage.socket')[_0x74b9('0x1b')](socket);var jayson=require(_0x74b9('0x1c'));var client=jayson['client'][_0x74b9('0x1d')]({'port':0x232c});var client9002=jayson[_0x74b9('0x1e')][_0x74b9('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4b5501,_0x43774d,_0x229820,_0x135f7d){return new BPromise(function(_0x4edff6,_0xf56431){var _0x2c0689=_0x135f7d||client;return _0x2c0689[_0x74b9('0x1f')](_0x4b5501,_0x229820)[_0x74b9('0x20')](function(_0x3c950e){logger[_0x74b9('0x21')](_0x74b9('0x22'),_0x43774d,_0x74b9('0x23'));logger[_0x74b9('0x24')](_0x74b9('0x25'),_0x43774d,_0x74b9('0x23'),JSON[_0x74b9('0x26')](_0x3c950e));if(_0x3c950e['error']){if(_0x3c950e[_0x74b9('0x27')][_0x74b9('0x28')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x43774d,_0x3c950e[_0x74b9('0x27')]['message']);return _0xf56431(_0x3c950e[_0x74b9('0x27')][_0x74b9('0x29')]);}logger[_0x74b9('0x27')]('FaxMessage,\x20%s,\x20%s',_0x43774d,_0x3c950e['error'][_0x74b9('0x29')]);return _0x4edff6(_0x3c950e[_0x74b9('0x27')][_0x74b9('0x29')]);}else{logger[_0x74b9('0x21')](_0x74b9('0x22'),_0x43774d,_0x74b9('0x23'));_0x4edff6(_0x3c950e[_0x74b9('0x2a')]['message']);}})[_0x74b9('0x2b')](function(_0x2d3fb5){logger[_0x74b9('0x27')](_0x74b9('0x22'),_0x43774d,_0x2d3fb5);_0xf56431(_0x2d3fb5);});});}function respondWithStatusCode(_0x2b3d36,_0x5cc80e){_0x5cc80e=_0x5cc80e||0xcc;return function(_0x4b024d){if(_0x4b024d){return _0x2b3d36[_0x74b9('0x2c')](_0x5cc80e);}return _0x2b3d36['status'](_0x5cc80e)[_0x74b9('0x2d')]();};}function respondWithResult(_0x573e36,_0x7d58){_0x7d58=_0x7d58||0xc8;return function(_0x3bf117){if(_0x3bf117){return _0x573e36['status'](_0x7d58)[_0x74b9('0x2e')](_0x3bf117);}};}function respondWithFilteredResult(_0x8c688f,_0x252c5){return function(_0x229b85){if(_0x229b85){var _0x29b6c2=typeof _0x252c5[_0x74b9('0x2f')]===_0x74b9('0x30')&&typeof _0x252c5[_0x74b9('0x31')]===_0x74b9('0x30');var _0x32705b=_0x229b85[_0x74b9('0x32')];var _0x1df922=_0x29b6c2?0x0:_0x252c5[_0x74b9('0x2f')];var _0x1d7d0c=_0x29b6c2?_0x229b85[_0x74b9('0x32')]:_0x252c5[_0x74b9('0x2f')]+_0x252c5['limit'];var _0x5cf4ab;if(_0x1d7d0c>=_0x32705b){_0x1d7d0c=_0x32705b;_0x5cf4ab=0xc8;}else{_0x5cf4ab=0xce;}_0x8c688f['status'](_0x5cf4ab);return _0x8c688f[_0x74b9('0x33')](_0x74b9('0x34'),_0x1df922+'-'+_0x1d7d0c+'/'+_0x32705b)[_0x74b9('0x2e')](_0x229b85);}return null;};}function patchUpdates(_0x2f1308){return function(_0x261d0a){try{jsonpatch[_0x74b9('0x35')](_0x261d0a,_0x2f1308,!![]);}catch(_0x320283){return BPromise[_0x74b9('0x36')](_0x320283);}return _0x261d0a['save']();};}function saveUpdates(_0x27683e,_0x28551d){return function(_0xfc74f7){if(_0xfc74f7){return _0xfc74f7[_0x74b9('0x37')](_0x27683e)[_0x74b9('0x20')](function(_0x10ee2d){return _0x10ee2d;});}return null;};}function removeEntity(_0x3acbc7,_0x43a83a){return function(_0x5aab73){if(_0x5aab73){return _0x5aab73[_0x74b9('0x38')]()['then'](function(){_0x3acbc7[_0x74b9('0x39')](0xcc)[_0x74b9('0x2d')]();});}};}function handleEntityNotFound(_0x1e632f,_0x43e34a){return function(_0x4ef6c8){if(!_0x4ef6c8){_0x1e632f[_0x74b9('0x2c')](0x194);}return _0x4ef6c8;};}function handleError(_0x4e4a54,_0x5f43bf){_0x5f43bf=_0x5f43bf||0x1f4;return function(_0xa546f9){logger[_0x74b9('0x27')](_0xa546f9[_0x74b9('0x3a')]);if(_0xa546f9[_0x74b9('0x3b')]){delete _0xa546f9[_0x74b9('0x3b')];}_0x4e4a54[_0x74b9('0x39')](_0x5f43bf)[_0x74b9('0x3c')](_0xa546f9);};}exports[_0x74b9('0x3d')]=function(_0x259e07,_0x313f8f){var _0x2d9c5e={},_0x557459={},_0x4aae4a={'count':0x0,'rows':[]};var _0x4282fa=_[_0x74b9('0x3e')](db[_0x74b9('0x3f')][_0x74b9('0x40')],function(_0x6c1c10){return{'name':_0x6c1c10[_0x74b9('0x41')],'type':_0x6c1c10[_0x74b9('0x42')][_0x74b9('0x43')]};});_0x557459[_0x74b9('0x44')]=_['map'](_0x4282fa,_0x74b9('0x3b'));_0x557459[_0x74b9('0x45')]=_[_0x74b9('0x46')](_0x259e07[_0x74b9('0x45')]);_0x557459[_0x74b9('0x47')]=_[_0x74b9('0x48')](_0x557459[_0x74b9('0x44')],_0x557459[_0x74b9('0x45')]);_0x2d9c5e[_0x74b9('0x49')]=_['intersection'](_0x557459[_0x74b9('0x44')],qs['fields'](_0x259e07[_0x74b9('0x45')]['fields']));_0x2d9c5e['attributes']=_0x2d9c5e[_0x74b9('0x49')]['length']?_0x2d9c5e['attributes']:_0x557459[_0x74b9('0x44')];if(!_0x259e07[_0x74b9('0x45')][_0x74b9('0x4a')](_0x74b9('0x4b'))){_0x2d9c5e[_0x74b9('0x31')]=qs[_0x74b9('0x31')](_0x259e07['query']['limit']);_0x2d9c5e['offset']=qs[_0x74b9('0x2f')](_0x259e07[_0x74b9('0x45')][_0x74b9('0x2f')]);}_0x2d9c5e[_0x74b9('0x4c')]=qs['sort'](_0x259e07[_0x74b9('0x45')][_0x74b9('0x4d')]);_0x2d9c5e[_0x74b9('0x4e')]=qs[_0x74b9('0x47')](_[_0x74b9('0x4f')](_0x259e07[_0x74b9('0x45')],_0x557459[_0x74b9('0x47')]),_0x4282fa);if(_0x259e07[_0x74b9('0x45')][_0x74b9('0x50')]){_0x2d9c5e[_0x74b9('0x4e')]=_[_0x74b9('0x51')](_0x2d9c5e[_0x74b9('0x4e')],{'$or':_['map'](_0x4282fa,function(_0x25f82c){if(_0x25f82c[_0x74b9('0x42')]!==_0x74b9('0x52')){var _0x4a08dc={};_0x4a08dc[_0x25f82c[_0x74b9('0x3b')]]={'$like':'%'+_0x259e07[_0x74b9('0x45')][_0x74b9('0x50')]+'%'};return _0x4a08dc;}})});}_0x2d9c5e=_['merge']({},_0x2d9c5e,_0x259e07['options']);var _0x1cc547={'where':_0x2d9c5e[_0x74b9('0x4e')]};return db[_0x74b9('0x3f')][_0x74b9('0x32')](_0x1cc547)[_0x74b9('0x20')](function(_0x1a39b4){_0x4aae4a[_0x74b9('0x32')]=_0x1a39b4;if(_0x259e07[_0x74b9('0x45')]['includeAll']){_0x2d9c5e[_0x74b9('0x53')]=[{'all':!![]}];}return db[_0x74b9('0x3f')][_0x74b9('0x54')](_0x2d9c5e);})[_0x74b9('0x20')](function(_0x33daaa){_0x4aae4a[_0x74b9('0x55')]=_0x33daaa;return _0x4aae4a;})[_0x74b9('0x20')](respondWithFilteredResult(_0x313f8f,_0x2d9c5e))['catch'](handleError(_0x313f8f,null));};exports['show']=function(_0x5256d2,_0x16b38a){var _0x1913e9={'raw':!![],'where':{'id':_0x5256d2[_0x74b9('0x56')]['id']}},_0x28770f={};_0x28770f['model']=_[_0x74b9('0x46')](db['FaxMessage'][_0x74b9('0x40')]);_0x28770f[_0x74b9('0x45')]=_[_0x74b9('0x46')](_0x5256d2[_0x74b9('0x45')]);_0x28770f[_0x74b9('0x47')]=_[_0x74b9('0x48')](_0x28770f[_0x74b9('0x44')],_0x28770f[_0x74b9('0x45')]);_0x1913e9[_0x74b9('0x49')]=_['intersection'](_0x28770f['model'],qs[_0x74b9('0x57')](_0x5256d2[_0x74b9('0x45')][_0x74b9('0x57')]));_0x1913e9[_0x74b9('0x49')]=_0x1913e9[_0x74b9('0x49')][_0x74b9('0x58')]?_0x1913e9['attributes']:_0x28770f[_0x74b9('0x44')];if(_0x5256d2[_0x74b9('0x45')][_0x74b9('0x59')]){_0x1913e9[_0x74b9('0x53')]=[{'all':!![]}];}_0x1913e9=_['merge']({},_0x1913e9,_0x5256d2[_0x74b9('0x5a')]);return db[_0x74b9('0x3f')][_0x74b9('0x5b')](_0x1913e9)[_0x74b9('0x20')](handleEntityNotFound(_0x16b38a,null))[_0x74b9('0x20')](respondWithResult(_0x16b38a,null))['catch'](handleError(_0x16b38a,null));};exports[_0x74b9('0x37')]=function(_0x4674f4,_0x52a854){if(_0x4674f4[_0x74b9('0x5c')]['id']){delete _0x4674f4[_0x74b9('0x5c')]['id'];}return db[_0x74b9('0x3f')][_0x74b9('0x5b')]({'where':{'id':_0x4674f4[_0x74b9('0x56')]['id']}})[_0x74b9('0x20')](handleEntityNotFound(_0x52a854,null))[_0x74b9('0x20')](saveUpdates(_0x4674f4[_0x74b9('0x5c')],null))[_0x74b9('0x20')](respondWithResult(_0x52a854,null))['catch'](handleError(_0x52a854,null));};exports['destroy']=function(_0x228d77,_0x95e8d2){return db[_0x74b9('0x3f')][_0x74b9('0x5b')]({'where':{'id':_0x228d77[_0x74b9('0x56')]['id']}})['then'](handleEntityNotFound(_0x95e8d2,null))[_0x74b9('0x20')](removeEntity(_0x95e8d2,null))[_0x74b9('0x2b')](handleError(_0x95e8d2,null));};exports['describe']=function(_0x3db581,_0x182248){return db[_0x74b9('0x3f')]['describe']()[_0x74b9('0x20')](respondWithResult(_0x182248,null))[_0x74b9('0x2b')](handleError(_0x182248,null));};var interaction_log=require(_0x74b9('0x13'))('fax-interactions');exports[_0x74b9('0x5d')]=function(_0x431d5a,_0x1904d6,_0x9f13f){var _0x323a13={'agent':{},'channel':_0x74b9('0x5e')};if(_0x431d5a[_0x74b9('0x5c')]['id']){delete _0x431d5a[_0x74b9('0x5c')]['id'];}_0x431d5a[_0x74b9('0x5c')][_0x74b9('0x5f')]=!![];_0x431d5a[_0x74b9('0x5c')][_0x74b9('0x60')]=moment()[_0x74b9('0x61')](_0x74b9('0x62'));_0x431d5a['body'][_0x74b9('0x63')]=_0x431d5a['body'][_0x74b9('0x63')]||_0x431d5a[_0x74b9('0x64')]['id'];_0x323a13[_0x74b9('0x65')]['id']=_0x431d5a['body']['UserId'];return db[_0x74b9('0x3f')][_0x74b9('0x5b')]({'where':{'id':_0x431d5a[_0x74b9('0x56')]['id'],'UserId':null}})[_0x74b9('0x20')](handleEntityNotFound(_0x1904d6,null))[_0x74b9('0x20')](saveUpdates(_0x431d5a[_0x74b9('0x5c')],null))[_0x74b9('0x20')](function(_0x33b51b){if(_0x33b51b){_0x323a13['message']=_0x33b51b['get']({'plain':!![]});return db[_0x74b9('0x66')][_0x74b9('0x5b')]({'where':{'id':_0x33b51b[_0x74b9('0x67')]}});}return null;})[_0x74b9('0x20')](handleEntityNotFound(_0x1904d6,null))[_0x74b9('0x20')](function(_0x446425){if(_0x446425){return _0x446425[_0x74b9('0x37')]({'UserId':_0x431d5a[_0x74b9('0x5c')][_0x74b9('0x63')],'read1stAt':_['isNil'](_0x446425[_0x74b9('0x68')])?moment()[_0x74b9('0x61')](_0x74b9('0x62')):undefined});}return null;})['then'](function(_0x45b260){if(_0x45b260){_0x323a13[_0x74b9('0x69')]=_0x45b260[_0x74b9('0x6a')]({'plain':!![]});interaction_log[_0x74b9('0x21')](_0x74b9('0x6b'),_0x431d5a['user']['id'],_0x431d5a[_0x74b9('0x64')]['name'],_0x431d5a[_0x74b9('0x64')][_0x74b9('0x6c')],_0x323a13['interaction']['id'],_0x431d5a[_0x74b9('0x5c')]?JSON[_0x74b9('0x26')](_0x431d5a[_0x74b9('0x5c')]):'null');return respondWithRpcPromise(_0x74b9('0x6d'),_0x74b9('0x6e'),_0x323a13);}return null;})[_0x74b9('0x20')](function(_0x2af4ef){var _0x3791f6=_0x74b9('0x6f')+_0x2af4ef['message'][_0x74b9('0x70')];return db['sequelize'][_0x74b9('0x45')](_0x3791f6,{'type':db[_0x74b9('0x71')][_0x74b9('0x72')]['SELECT'],'raw':!![]})[_0x74b9('0x20')](function(_0x160565){return _0x160565;});})[_0x74b9('0x20')](function(_0x27992e){if(_0x27992e){_0x323a13[_0x74b9('0x29')][_0x74b9('0x73')]=_0x27992e[0x0];if(!_0x431d5a[_0x74b9('0x5c')][_0x74b9('0x63')])return;return db[_0x74b9('0x74')][_0x74b9('0x5b')]({'where':{'id':_0x431d5a[_0x74b9('0x5c')][_0x74b9('0x63')],'role':_0x74b9('0x65')},'attributes':['id',_0x74b9('0x3b'),_0x74b9('0x75'),_0x74b9('0x76'),'internal'],'raw':!![]});}return null;})[_0x74b9('0x20')](function(_0x45316b){if(!_0x45316b)return null;_0x323a13['message'][_0x74b9('0x65')]=_0x45316b;return _0x323a13;})[_0x74b9('0x20')](function(_0x572628){if(_0x572628){if(_0x431d5a[_0x74b9('0x5c')][_0x74b9('0x77')]){_0x323a13['message'][_0x74b9('0x78')]=util[_0x74b9('0x61')](_0x74b9('0x79'),_0x431d5a[_0x74b9('0x64')][_0x74b9('0x3b')]);_0x323a13[_0x74b9('0x29')][_0x74b9('0x7a')]=_0x323a13['channel'];_0x323a13[_0x74b9('0x29')][_0x74b9('0x7b')]=_0x323a13[_0x74b9('0x7a')];_0x323a13[_0x74b9('0x29')]['event']=_0x74b9('0x5d');return respondWithRpcPromise(_0x74b9('0x7c'),_0x74b9('0x7c'),{'event':_0x74b9('0x7d'),'message':_0x323a13[_0x74b9('0x29')]},client9002)[_0x74b9('0x20')](function(){return _0x323a13;});}return _0x323a13;}return null;})['then'](respondWithResult(_0x1904d6,null))[_0x74b9('0x2b')](handleError(_0x1904d6,null));};var interaction_log=require(_0x74b9('0x13'))(_0x74b9('0x7e'));exports['reject']=function(_0x5a1272,_0x42c752,_0x3b1d16){var _0x4fe2ba={'agent':{},'channel':_0x74b9('0x5e')};if(_0x5a1272[_0x74b9('0x5c')]['id']){delete _0x5a1272[_0x74b9('0x5c')]['id'];}_0x5a1272[_0x74b9('0x5c')]['UserId']=_0x5a1272[_0x74b9('0x5c')][_0x74b9('0x63')]||_0x5a1272[_0x74b9('0x64')]['id'];_0x4fe2ba[_0x74b9('0x65')]['id']=_0x5a1272[_0x74b9('0x5c')]['UserId'];return db['FaxMessage']['find']({'where':{'id':_0x5a1272[_0x74b9('0x56')]['id'],'UserId':null}})[_0x74b9('0x20')](handleEntityNotFound(_0x42c752,null))[_0x74b9('0x20')](function(_0x4f8202){if(_0x4f8202){_0x4fe2ba['message']=_0x4f8202[_0x74b9('0x6a')]({'plain':!![]});return db[_0x74b9('0x66')]['find']({'where':{'id':_0x4f8202[_0x74b9('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x42c752,null))[_0x74b9('0x20')](function(_0x5bcbf7){if(_0x5bcbf7){_0x4fe2ba[_0x74b9('0x69')]=_0x5bcbf7['get']({'plain':!![]});interaction_log[_0x74b9('0x21')](_0x74b9('0x7f'),_0x5a1272[_0x74b9('0x64')]['id'],_0x5a1272['user'][_0x74b9('0x3b')],_0x5a1272[_0x74b9('0x64')][_0x74b9('0x6c')],_0x4fe2ba[_0x74b9('0x69')]['id'],_0x5a1272[_0x74b9('0x5c')]?JSON[_0x74b9('0x26')](_0x5a1272[_0x74b9('0x5c')]):_0x74b9('0x80'));return respondWithRpcPromise(_0x74b9('0x81'),_0x74b9('0x82'),_0x4fe2ba);}return null;})[_0x74b9('0x20')](function(_0x181cf5){var _0x1b91b4='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x181cf5['message'][_0x74b9('0x70')];return db[_0x74b9('0x83')][_0x74b9('0x45')](_0x1b91b4,{'type':db['Sequelize'][_0x74b9('0x72')][_0x74b9('0x84')],'raw':!![]})['then'](function(_0x45b6a3){return _0x45b6a3;});})[_0x74b9('0x20')](function(_0x89ba36){if(_0x89ba36){_0x4fe2ba[_0x74b9('0x29')][_0x74b9('0x73')]=_0x89ba36[0x0];if(!_0x5a1272[_0x74b9('0x5c')][_0x74b9('0x63')])return;return db[_0x74b9('0x74')][_0x74b9('0x5b')]({'where':{'id':_0x5a1272[_0x74b9('0x5c')][_0x74b9('0x63')],'role':_0x74b9('0x65')},'attributes':['id',_0x74b9('0x3b'),'fullname',_0x74b9('0x76'),'internal'],'raw':!![]});}return null;})[_0x74b9('0x20')](function(_0x47281f){if(!_0x47281f)return null;_0x4fe2ba['message'][_0x74b9('0x65')]=_0x47281f;return _0x4fe2ba;})[_0x74b9('0x20')](function(_0x190e16){if(_0x190e16){_0x190e16['message'][_0x74b9('0x78')]=util[_0x74b9('0x61')](_0x74b9('0x79'),_0x5a1272[_0x74b9('0x64')][_0x74b9('0x3b')]);_0x190e16[_0x74b9('0x29')][_0x74b9('0x7a')]=_0x4fe2ba['channel'];_0x190e16['message']['motionChannel']=_0x4fe2ba[_0x74b9('0x7a')];_0x190e16['message'][_0x74b9('0x85')]=_0x74b9('0x36');respondWithRpcPromise(_0x74b9('0x7c'),_0x74b9('0x7c'),{'event':'rejectmessage','message':_0x190e16[_0x74b9('0x29')]},client9002);return _0x4fe2ba;}return null;})['then'](respondWithResult(_0x42c752,null))[_0x74b9('0x2b')](handleError(_0x42c752,null));};exports[_0x74b9('0x86')]=function(_0x369e1b,_0x5da7c2){var _0x4e19b3;return db[_0x74b9('0x3f')][_0x74b9('0x86')](_0x369e1b[_0x74b9('0x5c')],{})[_0x74b9('0x20')](function(_0x260d15){_0x4e19b3=_0x260d15;return db[_0x74b9('0x87')][_0x74b9('0x88')]({'where':{'id':_0x4e19b3[_0x74b9('0x70')]}});})['then'](function(_0x34a17c){if(_[_0x74b9('0x89')](_0x34a17c)){return;}else{_0x4e19b3['fax']=_0x34a17c[_0x74b9('0x5e')];return db[_0x74b9('0x8a')][_0x74b9('0x88')]({'where':{'id':_0x4e19b3[_0x74b9('0x8b')]}});}})[_0x74b9('0x20')](function(_0x36b2df){return respondWithRpcPromise(_0x74b9('0x8c'),'SendFax',{'FaxAccountId':_['isNil'](_0x369e1b[_0x74b9('0x5c')])?undefined:_0x369e1b[_0x74b9('0x5c')]['FaxAccountId'],'path':_[_0x74b9('0x89')](_0x36b2df)?undefined:util['format']('/var/opt/motion2/server/files/attachments/%s',_0x36b2df[_0x74b9('0x8d')]),'fax':_[_0x74b9('0x89')](_0x4e19b3[_0x74b9('0x5e')])?undefined:_0x4e19b3[_0x74b9('0x5e')],'AttachmentId':_0x4e19b3[_0x74b9('0x8b')]},client9002);})[_0x74b9('0x20')](respondWithResult(_0x5da7c2,0xc9))[_0x74b9('0x2b')](handleError(_0x5da7c2,null));};exports[_0x74b9('0x8e')]=function(_0x2a631b,_0x322305){var _0x499725=path['join'](config[_0x74b9('0x8f')],_0x74b9('0x90'),_0x74b9('0x91'),_0x74b9('0x92'));return db[_0x74b9('0x3f')][_0x74b9('0x5b')]({'where':{'id':_0x2a631b[_0x74b9('0x56')]['id']},'include':[{'model':db[_0x74b9('0x8a')],'as':_0x74b9('0x8a')}]})['then'](handleEntityNotFound(_0x322305,null))['then'](function(_0x4c8a62){if(_0x4c8a62){return _0x322305[_0x74b9('0x8e')](path['join'](_0x499725,_0x4c8a62[_0x74b9('0x8a')][_0x74b9('0x8d')]));}})['catch'](handleError(_0x322305,null));}; \ No newline at end of file +var _0x66c0=['find','body','describe','fax-interactions','accept','fax','read','readAt','format','UserId','user','agent','get','FaxInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','../../config/logger','FaxInteraction','rejectMessage','motionChannel','create','findOne','ContactId','Attachment','AttachmentId','SendFax','basename','download','join','attachments','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','rawAttributes','type','key','model','keys','intersection','query','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','map','VIRTUAL','FaxMessage','count','include','findAll','rows','params','includeAll','options'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x66c0,0xbf));var _0x066c=function(_0x4fe9ee,_0x47da2b){_0x4fe9ee=_0x4fe9ee-0x0;var _0x541c1a=_0x66c0[_0x4fe9ee];return _0x541c1a;};'use strict';var emlformat=require(_0x066c('0x0'));var rimraf=require(_0x066c('0x1'));var zipdir=require(_0x066c('0x2'));var jsonpatch=require(_0x066c('0x3'));var rp=require('request-promise');var moment=require(_0x066c('0x4'));var BPromise=require(_0x066c('0x5'));var Mustache=require(_0x066c('0x6'));var util=require('util');var path=require(_0x066c('0x7'));var sox=require(_0x066c('0x8'));var csv=require(_0x066c('0x9'));var ejs=require(_0x066c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x066c('0xb'));var squel=require(_0x066c('0xc'));var crypto=require(_0x066c('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x066c('0xe'));var Papa=require('papaparse');var Redis=require(_0x066c('0xf'));var authService=require(_0x066c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x066c('0x11'));var hardwareService=require(_0x066c('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x066c('0x13'));var config=require(_0x066c('0x14'));var licenseUtil=require(_0x066c('0x15'));var db=require('../../mysqldb')['db'];config[_0x066c('0x16')]=_[_0x066c('0x17')](config[_0x066c('0x16')],{'host':_0x066c('0x18'),'port':0x18eb});var socket=require(_0x066c('0x19'))(new Redis(config[_0x066c('0x16')]));require(_0x066c('0x1a'))[_0x066c('0x1b')](socket);var jayson=require(_0x066c('0x1c'));var client=jayson[_0x066c('0x1d')][_0x066c('0x1e')]({'port':0x232c});var client9002=jayson[_0x066c('0x1d')][_0x066c('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x283b11,_0x2de6ba,_0x109564,_0x1fe0cb){return new BPromise(function(_0x19aa6e,_0x59b6a4){var _0xbea1d8=_0x1fe0cb||client;return _0xbea1d8[_0x066c('0x1f')](_0x283b11,_0x109564)[_0x066c('0x20')](function(_0x5917e2){logger[_0x066c('0x21')](_0x066c('0x22'),_0x2de6ba,'request\x20sent');logger[_0x066c('0x23')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x2de6ba,_0x066c('0x24'),JSON['stringify'](_0x5917e2));if(_0x5917e2[_0x066c('0x25')]){if(_0x5917e2['error'][_0x066c('0x26')]===0x1f4){logger[_0x066c('0x25')](_0x066c('0x22'),_0x2de6ba,_0x5917e2[_0x066c('0x25')]['message']);return _0x59b6a4(_0x5917e2[_0x066c('0x25')][_0x066c('0x27')]);}logger[_0x066c('0x25')](_0x066c('0x22'),_0x2de6ba,_0x5917e2[_0x066c('0x25')][_0x066c('0x27')]);return _0x19aa6e(_0x5917e2[_0x066c('0x25')][_0x066c('0x27')]);}else{logger[_0x066c('0x21')](_0x066c('0x22'),_0x2de6ba,_0x066c('0x24'));_0x19aa6e(_0x5917e2['result'][_0x066c('0x27')]);}})[_0x066c('0x28')](function(_0x1cf4c9){logger[_0x066c('0x25')](_0x066c('0x22'),_0x2de6ba,_0x1cf4c9);_0x59b6a4(_0x1cf4c9);});});}function respondWithStatusCode(_0x38555d,_0x3f79d8){_0x3f79d8=_0x3f79d8||0xcc;return function(_0x518def){if(_0x518def){return _0x38555d[_0x066c('0x29')](_0x3f79d8);}return _0x38555d[_0x066c('0x2a')](_0x3f79d8)[_0x066c('0x2b')]();};}function respondWithResult(_0x415a83,_0x1cbf7a){_0x1cbf7a=_0x1cbf7a||0xc8;return function(_0x176744){if(_0x176744){return _0x415a83['status'](_0x1cbf7a)[_0x066c('0x2c')](_0x176744);}};}function respondWithFilteredResult(_0x54c124,_0x2627a1){return function(_0x2468d6){if(_0x2468d6){var _0x3fe110=typeof _0x2627a1[_0x066c('0x2d')]==='undefined'&&typeof _0x2627a1['limit']==='undefined';var _0x42aa33=_0x2468d6['count'];var _0x3fc4bd=_0x3fe110?0x0:_0x2627a1['offset'];var _0x1edde4=_0x3fe110?_0x2468d6['count']:_0x2627a1[_0x066c('0x2d')]+_0x2627a1[_0x066c('0x2e')];var _0x52610f;if(_0x1edde4>=_0x42aa33){_0x1edde4=_0x42aa33;_0x52610f=0xc8;}else{_0x52610f=0xce;}_0x54c124['status'](_0x52610f);return _0x54c124[_0x066c('0x2f')](_0x066c('0x30'),_0x3fc4bd+'-'+_0x1edde4+'/'+_0x42aa33)[_0x066c('0x2c')](_0x2468d6);}return null;};}function patchUpdates(_0x884a58){return function(_0x13c6dc){try{jsonpatch[_0x066c('0x31')](_0x13c6dc,_0x884a58,!![]);}catch(_0x2166e0){return BPromise[_0x066c('0x32')](_0x2166e0);}return _0x13c6dc[_0x066c('0x33')]();};}function saveUpdates(_0x3a3217,_0x3fe55d){return function(_0x48abc6){if(_0x48abc6){return _0x48abc6[_0x066c('0x34')](_0x3a3217)[_0x066c('0x20')](function(_0xdbb90b){return _0xdbb90b;});}return null;};}function removeEntity(_0x124d2f,_0x203f08){return function(_0x2e6ff2){if(_0x2e6ff2){return _0x2e6ff2[_0x066c('0x35')]()['then'](function(){_0x124d2f[_0x066c('0x2a')](0xcc)[_0x066c('0x2b')]();});}};}function handleEntityNotFound(_0x4b8215,_0x2c0b02){return function(_0x25b0f0){if(!_0x25b0f0){_0x4b8215[_0x066c('0x29')](0x194);}return _0x25b0f0;};}function handleError(_0x4002d1,_0x96bfff){_0x96bfff=_0x96bfff||0x1f4;return function(_0x239ea4){logger[_0x066c('0x25')](_0x239ea4[_0x066c('0x36')]);if(_0x239ea4[_0x066c('0x37')]){delete _0x239ea4['name'];}_0x4002d1[_0x066c('0x2a')](_0x96bfff)[_0x066c('0x38')](_0x239ea4);};}exports[_0x066c('0x39')]=function(_0x1543c7,_0x150451){var _0x25e0b1={},_0x3f8e3a={},_0x5b2e45={'count':0x0,'rows':[]};var _0x19518f=_['map'](db['FaxMessage'][_0x066c('0x3a')],function(_0x2385c9){return{'name':_0x2385c9['fieldName'],'type':_0x2385c9[_0x066c('0x3b')][_0x066c('0x3c')]};});_0x3f8e3a[_0x066c('0x3d')]=_['map'](_0x19518f,'name');_0x3f8e3a['query']=_[_0x066c('0x3e')](_0x1543c7['query']);_0x3f8e3a['filters']=_[_0x066c('0x3f')](_0x3f8e3a[_0x066c('0x3d')],_0x3f8e3a[_0x066c('0x40')]);_0x25e0b1[_0x066c('0x41')]=_[_0x066c('0x3f')](_0x3f8e3a[_0x066c('0x3d')],qs[_0x066c('0x42')](_0x1543c7[_0x066c('0x40')][_0x066c('0x42')]));_0x25e0b1[_0x066c('0x41')]=_0x25e0b1[_0x066c('0x41')][_0x066c('0x43')]?_0x25e0b1['attributes']:_0x3f8e3a[_0x066c('0x3d')];if(!_0x1543c7[_0x066c('0x40')]['hasOwnProperty'](_0x066c('0x44'))){_0x25e0b1[_0x066c('0x2e')]=qs[_0x066c('0x2e')](_0x1543c7[_0x066c('0x40')][_0x066c('0x2e')]);_0x25e0b1[_0x066c('0x2d')]=qs[_0x066c('0x2d')](_0x1543c7['query'][_0x066c('0x2d')]);}_0x25e0b1[_0x066c('0x45')]=qs[_0x066c('0x46')](_0x1543c7[_0x066c('0x40')][_0x066c('0x46')]);_0x25e0b1[_0x066c('0x47')]=qs[_0x066c('0x48')](_[_0x066c('0x49')](_0x1543c7[_0x066c('0x40')],_0x3f8e3a[_0x066c('0x48')]),_0x19518f);if(_0x1543c7[_0x066c('0x40')][_0x066c('0x4a')]){_0x25e0b1[_0x066c('0x47')]=_['merge'](_0x25e0b1['where'],{'$or':_[_0x066c('0x4b')](_0x19518f,function(_0x2615e7){if(_0x2615e7[_0x066c('0x3b')]!==_0x066c('0x4c')){var _0x454227={};_0x454227[_0x2615e7[_0x066c('0x37')]]={'$like':'%'+_0x1543c7[_0x066c('0x40')]['filter']+'%'};return _0x454227;}})});}_0x25e0b1=_['merge']({},_0x25e0b1,_0x1543c7['options']);var _0x3e7817={'where':_0x25e0b1[_0x066c('0x47')]};return db[_0x066c('0x4d')][_0x066c('0x4e')](_0x3e7817)[_0x066c('0x20')](function(_0x5ad504){_0x5b2e45[_0x066c('0x4e')]=_0x5ad504;if(_0x1543c7[_0x066c('0x40')]['includeAll']){_0x25e0b1[_0x066c('0x4f')]=[{'all':!![]}];}return db[_0x066c('0x4d')][_0x066c('0x50')](_0x25e0b1);})['then'](function(_0x116a84){_0x5b2e45[_0x066c('0x51')]=_0x116a84;return _0x5b2e45;})['then'](respondWithFilteredResult(_0x150451,_0x25e0b1))['catch'](handleError(_0x150451,null));};exports['show']=function(_0x337bd9,_0x2f4e07){var _0x31b77b={'raw':!![],'where':{'id':_0x337bd9[_0x066c('0x52')]['id']}},_0x34dc65={};_0x34dc65[_0x066c('0x3d')]=_[_0x066c('0x3e')](db[_0x066c('0x4d')][_0x066c('0x3a')]);_0x34dc65[_0x066c('0x40')]=_['keys'](_0x337bd9[_0x066c('0x40')]);_0x34dc65['filters']=_[_0x066c('0x3f')](_0x34dc65[_0x066c('0x3d')],_0x34dc65[_0x066c('0x40')]);_0x31b77b[_0x066c('0x41')]=_['intersection'](_0x34dc65[_0x066c('0x3d')],qs['fields'](_0x337bd9[_0x066c('0x40')]['fields']));_0x31b77b[_0x066c('0x41')]=_0x31b77b['attributes']['length']?_0x31b77b[_0x066c('0x41')]:_0x34dc65[_0x066c('0x3d')];if(_0x337bd9[_0x066c('0x40')][_0x066c('0x53')]){_0x31b77b[_0x066c('0x4f')]=[{'all':!![]}];}_0x31b77b=_['merge']({},_0x31b77b,_0x337bd9[_0x066c('0x54')]);return db[_0x066c('0x4d')][_0x066c('0x55')](_0x31b77b)[_0x066c('0x20')](handleEntityNotFound(_0x2f4e07,null))[_0x066c('0x20')](respondWithResult(_0x2f4e07,null))['catch'](handleError(_0x2f4e07,null));};exports[_0x066c('0x34')]=function(_0x376848,_0x5ecde8){if(_0x376848[_0x066c('0x56')]['id']){delete _0x376848['body']['id'];}return db[_0x066c('0x4d')][_0x066c('0x55')]({'where':{'id':_0x376848[_0x066c('0x52')]['id']}})['then'](handleEntityNotFound(_0x5ecde8,null))['then'](saveUpdates(_0x376848[_0x066c('0x56')],null))[_0x066c('0x20')](respondWithResult(_0x5ecde8,null))[_0x066c('0x28')](handleError(_0x5ecde8,null));};exports['destroy']=function(_0x1e6a5f,_0x2468b4){return db['FaxMessage'][_0x066c('0x55')]({'where':{'id':_0x1e6a5f[_0x066c('0x52')]['id']}})['then'](handleEntityNotFound(_0x2468b4,null))[_0x066c('0x20')](removeEntity(_0x2468b4,null))['catch'](handleError(_0x2468b4,null));};exports['describe']=function(_0x3c8879,_0x397fe2){return db['FaxMessage'][_0x066c('0x57')]()[_0x066c('0x20')](respondWithResult(_0x397fe2,null))[_0x066c('0x28')](handleError(_0x397fe2,null));};var interaction_log=require('../../config/logger')(_0x066c('0x58'));exports[_0x066c('0x59')]=function(_0x2455ec,_0x1ffe4e,_0x370d15){var _0x58d865={'agent':{},'channel':_0x066c('0x5a')};if(_0x2455ec[_0x066c('0x56')]['id']){delete _0x2455ec[_0x066c('0x56')]['id'];}_0x2455ec[_0x066c('0x56')][_0x066c('0x5b')]=!![];_0x2455ec[_0x066c('0x56')][_0x066c('0x5c')]=moment()[_0x066c('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x2455ec['body'][_0x066c('0x5e')]=_0x2455ec[_0x066c('0x56')][_0x066c('0x5e')]||_0x2455ec[_0x066c('0x5f')]['id'];_0x58d865[_0x066c('0x60')]['id']=_0x2455ec[_0x066c('0x56')]['UserId'];return db[_0x066c('0x4d')][_0x066c('0x55')]({'where':{'id':_0x2455ec[_0x066c('0x52')]['id'],'UserId':null}})[_0x066c('0x20')](handleEntityNotFound(_0x1ffe4e,null))[_0x066c('0x20')](saveUpdates(_0x2455ec[_0x066c('0x56')],null))[_0x066c('0x20')](function(_0x2c4abf){if(_0x2c4abf){_0x58d865[_0x066c('0x27')]=_0x2c4abf[_0x066c('0x61')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x2c4abf[_0x066c('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x1ffe4e,null))[_0x066c('0x20')](function(_0x189a4d){if(_0x189a4d){return _0x189a4d[_0x066c('0x34')]({'UserId':_0x2455ec[_0x066c('0x56')][_0x066c('0x5e')],'read1stAt':_[_0x066c('0x63')](_0x189a4d['read1stAt'])?moment()[_0x066c('0x5d')](_0x066c('0x64')):undefined});}return null;})['then'](function(_0xe43d6f){if(_0xe43d6f){_0x58d865[_0x066c('0x65')]=_0xe43d6f['get']({'plain':!![]});interaction_log[_0x066c('0x21')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2455ec['user']['id'],_0x2455ec['user']['name'],_0x2455ec[_0x066c('0x5f')][_0x066c('0x66')],_0x58d865[_0x066c('0x65')]['id'],_0x2455ec[_0x066c('0x56')]?JSON[_0x066c('0x67')](_0x2455ec[_0x066c('0x56')]):_0x066c('0x68'));return respondWithRpcPromise(_0x066c('0x69'),_0x066c('0x6a'),_0x58d865);}return null;})[_0x066c('0x20')](function(_0x36592b){var _0x26e1a3=_0x066c('0x6b')+_0x36592b['message']['ContactId'];return db[_0x066c('0x6c')][_0x066c('0x40')](_0x26e1a3,{'type':db[_0x066c('0x6d')][_0x066c('0x6e')][_0x066c('0x6f')],'raw':!![]})[_0x066c('0x20')](function(_0x10f672){return _0x10f672;});})[_0x066c('0x20')](function(_0x1d7879){if(_0x1d7879){_0x58d865[_0x066c('0x27')][_0x066c('0x70')]=_0x1d7879[0x0];if(!_0x2455ec[_0x066c('0x56')]['UserId'])return;return db[_0x066c('0x71')][_0x066c('0x55')]({'where':{'id':_0x2455ec[_0x066c('0x56')][_0x066c('0x5e')],'role':_0x066c('0x60')},'attributes':['id',_0x066c('0x37'),_0x066c('0x72'),_0x066c('0x73'),_0x066c('0x74')],'raw':!![]});}return null;})['then'](function(_0xb57677){if(!_0xb57677)return null;_0x58d865[_0x066c('0x27')][_0x066c('0x60')]=_0xb57677;return _0x58d865;})[_0x066c('0x20')](function(_0x3caeb8){if(_0x3caeb8){if(_0x2455ec[_0x066c('0x56')][_0x066c('0x75')]){_0x58d865[_0x066c('0x27')][_0x066c('0x76')]=util[_0x066c('0x5d')](_0x066c('0x77'),_0x2455ec[_0x066c('0x5f')][_0x066c('0x37')]);_0x58d865['message'][_0x066c('0x78')]=_0x58d865['channel'];_0x58d865[_0x066c('0x27')]['motionChannel']=_0x58d865[_0x066c('0x78')];_0x58d865[_0x066c('0x27')][_0x066c('0x79')]='accept';return respondWithRpcPromise(_0x066c('0x7a'),_0x066c('0x7a'),{'event':_0x066c('0x7b'),'message':_0x58d865[_0x066c('0x27')]},client9002)['then'](function(){return _0x58d865;});}return _0x58d865;}return null;})['then'](respondWithResult(_0x1ffe4e,null))['catch'](handleError(_0x1ffe4e,null));};var interaction_log=require(_0x066c('0x7c'))(_0x066c('0x58'));exports['reject']=function(_0x53fedb,_0x38443e,_0x59dfc8){var _0x39a7eb={'agent':{},'channel':_0x066c('0x5a')};if(_0x53fedb[_0x066c('0x56')]['id']){delete _0x53fedb[_0x066c('0x56')]['id'];}_0x53fedb[_0x066c('0x56')][_0x066c('0x5e')]=_0x53fedb['body'][_0x066c('0x5e')]||_0x53fedb[_0x066c('0x5f')]['id'];_0x39a7eb[_0x066c('0x60')]['id']=_0x53fedb[_0x066c('0x56')][_0x066c('0x5e')];return db['FaxMessage'][_0x066c('0x55')]({'where':{'id':_0x53fedb[_0x066c('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x38443e,null))[_0x066c('0x20')](function(_0x1ea6f1){if(_0x1ea6f1){_0x39a7eb[_0x066c('0x27')]=_0x1ea6f1['get']({'plain':!![]});return db[_0x066c('0x7d')][_0x066c('0x55')]({'where':{'id':_0x1ea6f1[_0x066c('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x38443e,null))[_0x066c('0x20')](function(_0x19d6bf){if(_0x19d6bf){_0x39a7eb['interaction']=_0x19d6bf[_0x066c('0x61')]({'plain':!![]});interaction_log[_0x066c('0x21')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x53fedb[_0x066c('0x5f')]['id'],_0x53fedb['user'][_0x066c('0x37')],_0x53fedb['user']['role'],_0x39a7eb[_0x066c('0x65')]['id'],_0x53fedb[_0x066c('0x56')]?JSON[_0x066c('0x67')](_0x53fedb[_0x066c('0x56')]):_0x066c('0x68'));return respondWithRpcPromise('RejectMessage',_0x066c('0x7e'),_0x39a7eb);}return null;})[_0x066c('0x20')](function(_0x19e5e4){var _0x1fbdd9=_0x066c('0x6b')+_0x19e5e4[_0x066c('0x27')]['ContactId'];return db[_0x066c('0x6c')]['query'](_0x1fbdd9,{'type':db[_0x066c('0x6d')][_0x066c('0x6e')]['SELECT'],'raw':!![]})[_0x066c('0x20')](function(_0x4a8adc){return _0x4a8adc;});})[_0x066c('0x20')](function(_0x5e271e){if(_0x5e271e){_0x39a7eb[_0x066c('0x27')][_0x066c('0x70')]=_0x5e271e[0x0];if(!_0x53fedb[_0x066c('0x56')]['UserId'])return;return db['User'][_0x066c('0x55')]({'where':{'id':_0x53fedb[_0x066c('0x56')][_0x066c('0x5e')],'role':_0x066c('0x60')},'attributes':['id',_0x066c('0x37'),'fullname','email',_0x066c('0x74')],'raw':!![]});}return null;})[_0x066c('0x20')](function(_0xc961a){if(!_0xc961a)return null;_0x39a7eb[_0x066c('0x27')][_0x066c('0x60')]=_0xc961a;return _0x39a7eb;})[_0x066c('0x20')](function(_0x6a7535){if(_0x6a7535){_0x6a7535[_0x066c('0x27')][_0x066c('0x76')]=util['format'](_0x066c('0x77'),_0x53fedb['user'][_0x066c('0x37')]);_0x6a7535['message'][_0x066c('0x78')]=_0x39a7eb[_0x066c('0x78')];_0x6a7535[_0x066c('0x27')][_0x066c('0x7f')]=_0x39a7eb[_0x066c('0x78')];_0x6a7535[_0x066c('0x27')][_0x066c('0x79')]=_0x066c('0x32');respondWithRpcPromise('EventManager',_0x066c('0x7a'),{'event':'rejectmessage','message':_0x6a7535[_0x066c('0x27')]},client9002);return _0x39a7eb;}return null;})[_0x066c('0x20')](respondWithResult(_0x38443e,null))[_0x066c('0x28')](handleError(_0x38443e,null));};exports['create']=function(_0x53f082,_0xeac498){var _0x3fa89a;return db['FaxMessage'][_0x066c('0x80')](_0x53f082[_0x066c('0x56')],{})[_0x066c('0x20')](function(_0x28a160){_0x3fa89a=_0x28a160;return db['CmContact'][_0x066c('0x81')]({'where':{'id':_0x3fa89a[_0x066c('0x82')]}});})['then'](function(_0x570d6b){if(_[_0x066c('0x63')](_0x570d6b)){return;}else{_0x3fa89a[_0x066c('0x5a')]=_0x570d6b[_0x066c('0x5a')];return db[_0x066c('0x83')][_0x066c('0x81')]({'where':{'id':_0x3fa89a[_0x066c('0x84')]}});}})[_0x066c('0x20')](function(_0x2294fc){return respondWithRpcPromise(_0x066c('0x85'),_0x066c('0x85'),{'FaxAccountId':_[_0x066c('0x63')](_0x53f082[_0x066c('0x56')])?undefined:_0x53f082['body']['FaxAccountId'],'path':_[_0x066c('0x63')](_0x2294fc)?undefined:util[_0x066c('0x5d')]('/var/opt/motion2/server/files/attachments/%s',_0x2294fc[_0x066c('0x86')]),'fax':_[_0x066c('0x63')](_0x3fa89a[_0x066c('0x5a')])?undefined:_0x3fa89a['fax'],'AttachmentId':_0x3fa89a[_0x066c('0x84')]},client9002);})[_0x066c('0x20')](respondWithResult(_0xeac498,0xc9))[_0x066c('0x28')](handleError(_0xeac498,null));};exports[_0x066c('0x87')]=function(_0x5d3179,_0x271dd2){var _0x2d4314=path[_0x066c('0x88')](config['root'],'server','files',_0x066c('0x89'));return db[_0x066c('0x4d')]['find']({'where':{'id':_0x5d3179['params']['id']},'include':[{'model':db[_0x066c('0x83')],'as':_0x066c('0x83')}]})[_0x066c('0x20')](handleEntityNotFound(_0x271dd2,null))['then'](function(_0x5af46d){if(_0x5af46d){return _0x271dd2[_0x066c('0x87')](path[_0x066c('0x88')](_0x2d4314,_0x5af46d[_0x066c('0x83')]['basename']));}})[_0x066c('0x28')](handleError(_0x271dd2,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 87084f5..63d12bf 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 _0xf96b=['update','remove','emit','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save'];(function(_0x16c467,_0x53d6fa){var _0x22db4f=function(_0x498d3f){while(--_0x498d3f){_0x16c467['push'](_0x16c467['shift']());}};_0x22db4f(++_0x53d6fa);}(_0xf96b,0x109));var _0xbf96=function(_0x1f385b,_0x1f30be){_0x1f385b=_0x1f385b-0x0;var _0x42c05f=_0xf96b[_0x1f385b];return _0x42c05f;};'use strict';var EventEmitter=require(_0xbf96('0x0'));var FaxMessage=require(_0xbf96('0x1'))['db'][_0xbf96('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xbf96('0x3')](0x0);var events={'afterCreate':_0xbf96('0x4'),'afterUpdate':_0xbf96('0x5'),'afterDestroy':_0xbf96('0x6')};function emitEvent(_0x25c3d7){return function(_0x42be7e,_0x38565,_0xab8e7){FaxMessageEvents[_0xbf96('0x7')](_0x25c3d7+':'+_0x42be7e['id'],_0x42be7e);FaxMessageEvents[_0xbf96('0x7')](_0x25c3d7,_0x42be7e);_0xab8e7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0xbf96('0x8')](e,emitEvent(event));}}module[_0xbf96('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x363e=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x363e,0x179));var _0xe363=function(_0x483fc0,_0xb9ca71){_0x483fc0=_0x483fc0-0x0;var _0x3d96f7=_0x363e[_0x483fc0];return _0x3d96f7;};'use strict';var EventEmitter=require(_0xe363('0x0'));var FaxMessage=require(_0xe363('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xe363('0x2')](0x0);var events={'afterCreate':_0xe363('0x3'),'afterUpdate':_0xe363('0x4'),'afterDestroy':_0xe363('0x5')};function emitEvent(_0x179157){return function(_0x3809ea,_0x6e174a,_0x11775e){FaxMessageEvents[_0xe363('0x6')](_0x179157+':'+_0x3809ea['id'],_0x3809ea);FaxMessageEvents[_0xe363('0x6')](_0x179157,_0x3809ea);_0x11775e(null);};}for(var e in events){if(events[_0xe363('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xe363('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index c20e5a3..c419d3a 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 _0x049a=['utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','models','direction','toLowerCase','secret','isNil','FaxInteraction','then','update','createdAt','catch','error'];(function(_0x546151,_0x5d2ee8){var _0x44dbee=function(_0x3daf69){while(--_0x3daf69){_0x546151['push'](_0x546151['shift']());}};_0x44dbee(++_0x5d2ee8);}(_0x049a,0x144));var _0xa049=function(_0x451d04,_0x999e7d){_0x451d04=_0x451d04-0x0;var _0x32c6fe=_0x049a[_0x451d04];return _0x32c6fe;};'use strict';var _=require(_0xa049('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa049('0x1'));var moment=require(_0xa049('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa049('0x3'));var config=require(_0xa049('0x4'));var attributes=require(_0xa049('0x5'));module[_0xa049('0x6')]=function(_0x59c4ca,_0x4aa6db){return _0x59c4ca['define'](_0xa049('0x7'),attributes,{'tableName':_0xa049('0x8'),'paranoid':![],'indexes':[{'name':_0xa049('0x9'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x31cab9,_0x3b48d2,_0x56276a){var _0x2a20ed=_0x59c4ca[_0xa049('0xa')];var _0x44cf3a=_0x31cab9['get']({'plain':!![]});if(_0x44cf3a['direction']['toLowerCase']()==='in'||_0x44cf3a[_0xa049('0xb')][_0xa049('0xc')]()==='out'&&!_0x44cf3a[_0xa049('0xd')]&&!_[_0xa049('0xe')](_0x44cf3a['UserId'])){_0x2a20ed[_0xa049('0xf')]['findOne']({'where':{'id':_0x44cf3a['FaxInteractionId']}})[_0xa049('0x10')](function(_0x57ccf1){if(_0x57ccf1){_0x57ccf1[_0xa049('0x11')]({'lastMsgAt':_0x44cf3a[_0xa049('0x12')],'lastMsgDirection':_0x44cf3a['direction']['toLowerCase']()});}})[_0xa049('0x13')](function(_0x52cba0){console[_0xa049('0x14')](_0x52cba0);});}_0x56276a();}},'charset':_0xa049('0x15'),'collate':_0xa049('0x16')});}; \ No newline at end of file +var _0xa876=['FaxMessage','fax_messages','body','FULLTEXT','models','direction','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','createdAt','error','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x1e5e4a,_0xa1c088){var _0x3b3586=function(_0x468340){while(--_0x468340){_0x1e5e4a['push'](_0x1e5e4a['shift']());}};_0x3b3586(++_0xa1c088);}(_0xa876,0x1a6));var _0x6a87=function(_0x19f683,_0x89fd1a){_0x19f683=_0x19f683-0x0;var _0x4d20d6=_0xa876[_0x19f683];return _0x4d20d6;};'use strict';var _=require(_0x6a87('0x0'));var util=require(_0x6a87('0x1'));var logger=require(_0x6a87('0x2'))('api');var moment=require(_0x6a87('0x3'));var BPromise=require(_0x6a87('0x4'));var rp=require(_0x6a87('0x5'));var fs=require('fs');var path=require(_0x6a87('0x6'));var rimraf=require('rimraf');var config=require(_0x6a87('0x7'));var attributes=require('./faxMessage.attributes');module[_0x6a87('0x8')]=function(_0x344af4,_0x3b5508){return _0x344af4[_0x6a87('0x9')](_0x6a87('0xa'),attributes,{'tableName':_0x6a87('0xb'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x6a87('0xc')],'type':_0x6a87('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x46fc7a,_0x178cfd,_0x101e5b){var _0x4e5c7a=_0x344af4[_0x6a87('0xe')];var _0x5ec175=_0x46fc7a['get']({'plain':!![]});if(_0x5ec175[_0x6a87('0xf')]['toLowerCase']()==='in'||_0x5ec175[_0x6a87('0xf')]['toLowerCase']()===_0x6a87('0x10')&&!_0x5ec175[_0x6a87('0x11')]&&!_[_0x6a87('0x12')](_0x5ec175[_0x6a87('0x13')])){_0x4e5c7a[_0x6a87('0x14')][_0x6a87('0x15')]({'where':{'id':_0x5ec175[_0x6a87('0x16')]}})[_0x6a87('0x17')](function(_0x4116cb){if(_0x4116cb){_0x4116cb['update']({'lastMsgAt':_0x5ec175[_0x6a87('0x18')],'lastMsgDirection':_0x5ec175[_0x6a87('0xf')]['toLowerCase']()});}})['catch'](function(_0x53a147){console[_0x6a87('0x19')](_0x53a147);});}_0x101e5b();}},'charset':_0x6a87('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 86b1b6a..31c79c3 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 _0x207c=['result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','UpdateFaxMessage','attributes','limit','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','redis','defaults','localhost','socket.io-emitter','register','info','request\x20sent','debug','stringify','error','code','FaxMessage,\x20%s,\x20%s','message'];(function(_0x120f0a,_0x336ca6){var _0x42919c=function(_0x22be44){while(--_0x22be44){_0x120f0a['push'](_0x120f0a['shift']());}};_0x42919c(++_0x336ca6);}(_0x207c,0x1e8));var _0xc207=function(_0x1575cf,_0x1190d4){_0x1575cf=_0x1575cf-0x0;var _0x2b7a4e=_0x207c[_0x1575cf];return _0x2b7a4e;};'use strict';var _=require('lodash');var util=require(_0xc207('0x0'));var moment=require(_0xc207('0x1'));var BPromise=require(_0xc207('0x2'));var rs=require(_0xc207('0x3'));var fs=require('fs');var Redis=require(_0xc207('0x4'));var db=require(_0xc207('0x5'))['db'];var utils=require(_0xc207('0x6'));var logger=require('../../config/logger')(_0xc207('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc207('0x8')]({'port':0x232a});config[_0xc207('0x9')]=_[_0xc207('0xa')](config['redis'],{'host':_0xc207('0xb'),'port':0x18eb});var socket=require(_0xc207('0xc'))(new Redis(config[_0xc207('0x9')]));require('./faxMessage.socket')[_0xc207('0xd')](socket);function respondWithRpcPromise(_0x817576,_0x216e14,_0x13ec41){return new BPromise(function(_0x201162,_0x347549){return client['request'](_0x817576,_0x13ec41)['then'](function(_0x5b556f){logger[_0xc207('0xe')]('FaxMessage,\x20%s,\x20%s',_0x216e14,_0xc207('0xf'));logger[_0xc207('0x10')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x216e14,_0xc207('0xf'),JSON[_0xc207('0x11')](_0x5b556f));if(_0x5b556f[_0xc207('0x12')]){if(_0x5b556f[_0xc207('0x12')][_0xc207('0x13')]===0x1f4){logger['error'](_0xc207('0x14'),_0x216e14,_0x5b556f[_0xc207('0x12')][_0xc207('0x15')]);return _0x347549(_0x5b556f[_0xc207('0x12')]['message']);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x216e14,_0x5b556f[_0xc207('0x12')][_0xc207('0x15')]);return _0x201162(_0x5b556f[_0xc207('0x12')][_0xc207('0x15')]);}else{logger['info'](_0xc207('0x14'),_0x216e14,_0xc207('0xf'));_0x201162(_0x5b556f[_0xc207('0x16')]['message']);}})[_0xc207('0x17')](function(_0x488cc0){logger[_0xc207('0x12')](_0xc207('0x14'),_0x216e14,_0x488cc0);_0x347549(_0x488cc0);});});}exports[_0xc207('0x18')]=function(_0x461f6a){var _0xce0770=this;return new Promise(function(_0x2caec5,_0x35c0b0){return db[_0xc207('0x19')][_0xc207('0x1a')](_0x461f6a[_0xc207('0x1b')],{'raw':_0x461f6a[_0xc207('0x1c')]?_0x461f6a[_0xc207('0x1c')][_0xc207('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x163b36){logger['info'](_0xc207('0x18'),_0x461f6a);logger[_0xc207('0x10')](_0xc207('0x18'),_0x461f6a,JSON[_0xc207('0x11')](_0x163b36));_0x2caec5(_0x163b36);})[_0xc207('0x17')](function(_0xd209ac){logger[_0xc207('0x12')](_0xc207('0x18'),_0xd209ac[_0xc207('0x15')],_0x461f6a);_0x35c0b0(_0xce0770[_0xc207('0x12')](0x1f4,_0xd209ac[_0xc207('0x15')]));});});};exports[_0xc207('0x1e')]=function(_0x3f738e){var _0x138970=this;return new Promise(function(_0x1445d3,_0x56a066){return db[_0xc207('0x19')]['update'](_0x3f738e['body'],{'raw':_0x3f738e[_0xc207('0x1c')]?_0x3f738e[_0xc207('0x1c')][_0xc207('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f738e[_0xc207('0x1c')]?_0x3f738e[_0xc207('0x1c')]['where']||null:null,'attributes':_0x3f738e[_0xc207('0x1c')]?_0x3f738e[_0xc207('0x1c')][_0xc207('0x1f')]||null:null,'limit':_0x3f738e[_0xc207('0x1c')]?_0x3f738e[_0xc207('0x1c')][_0xc207('0x20')]||null:null})[_0xc207('0x21')](function(_0x27bc72){logger[_0xc207('0xe')](_0xc207('0x1e'),_0x3f738e);logger[_0xc207('0x10')](_0xc207('0x1e'),_0x3f738e,JSON[_0xc207('0x11')](_0x27bc72));_0x1445d3(_0x27bc72);})['catch'](function(_0x1cc799){logger[_0xc207('0x12')](_0xc207('0x1e'),_0x1cc799[_0xc207('0x15')],_0x3f738e);_0x56a066(_0x138970[_0xc207('0x12')](0x1f4,_0x1cc799[_0xc207('0x15')]));});});}; \ No newline at end of file +var _0xa41a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./faxMessage.socket','register','request','info','debug','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','CreateFaxMessage','body','options','raw','then','FaxMessage','update','where','attributes','UpdateFaxMessage','lodash','util','bluebird','randomstring'];(function(_0x4b99a6,_0x4ca53b){var _0x4f5479=function(_0x3102ee){while(--_0x3102ee){_0x4b99a6['push'](_0x4b99a6['shift']());}};_0x4f5479(++_0x4ca53b);}(_0xa41a,0x6b));var _0xaa41=function(_0x343418,_0x1b8f1a){_0x343418=_0x343418-0x0;var _0x17f657=_0xa41a[_0x343418];return _0x17f657;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xaa41('0xc')],{'host':_0xaa41('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa41('0xc')]));require(_0xaa41('0xe'))[_0xaa41('0xf')](socket);function respondWithRpcPromise(_0x1cc344,_0x4263d6,_0x38d930){return new BPromise(function(_0x806f08,_0x423a19){return client[_0xaa41('0x10')](_0x1cc344,_0x38d930)['then'](function(_0x1d3aac){logger[_0xaa41('0x11')]('FaxMessage,\x20%s,\x20%s',_0x4263d6,'request\x20sent');logger[_0xaa41('0x12')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x4263d6,_0xaa41('0x13'),JSON[_0xaa41('0x14')](_0x1d3aac));if(_0x1d3aac[_0xaa41('0x15')]){if(_0x1d3aac[_0xaa41('0x15')][_0xaa41('0x16')]===0x1f4){logger['error'](_0xaa41('0x17'),_0x4263d6,_0x1d3aac[_0xaa41('0x15')][_0xaa41('0x18')]);return _0x423a19(_0x1d3aac[_0xaa41('0x15')][_0xaa41('0x18')]);}logger[_0xaa41('0x15')](_0xaa41('0x17'),_0x4263d6,_0x1d3aac['error'][_0xaa41('0x18')]);return _0x806f08(_0x1d3aac[_0xaa41('0x15')][_0xaa41('0x18')]);}else{logger[_0xaa41('0x11')](_0xaa41('0x17'),_0x4263d6,_0xaa41('0x13'));_0x806f08(_0x1d3aac[_0xaa41('0x19')][_0xaa41('0x18')]);}})[_0xaa41('0x1a')](function(_0x4fe1a4){logger['error'](_0xaa41('0x17'),_0x4263d6,_0x4fe1a4);_0x423a19(_0x4fe1a4);});});}exports[_0xaa41('0x1b')]=function(_0x35c753){var _0x54c488=this;return new Promise(function(_0x2bf794,_0x1f692b){return db['FaxMessage']['create'](_0x35c753[_0xaa41('0x1c')],{'raw':_0x35c753['options']?_0x35c753[_0xaa41('0x1d')][_0xaa41('0x1e')]===undefined?!![]:![]:!![]})[_0xaa41('0x1f')](function(_0x1f27f3){logger[_0xaa41('0x11')]('CreateFaxMessage',_0x35c753);logger[_0xaa41('0x12')](_0xaa41('0x1b'),_0x35c753,JSON[_0xaa41('0x14')](_0x1f27f3));_0x2bf794(_0x1f27f3);})[_0xaa41('0x1a')](function(_0x274630){logger[_0xaa41('0x15')]('CreateFaxMessage',_0x274630['message'],_0x35c753);_0x1f692b(_0x54c488[_0xaa41('0x15')](0x1f4,_0x274630['message']));});});};exports['UpdateFaxMessage']=function(_0x12e362){var _0x59707f=this;return new Promise(function(_0x536bed,_0x2d0ac0){return db[_0xaa41('0x20')][_0xaa41('0x21')](_0x12e362[_0xaa41('0x1c')],{'raw':_0x12e362[_0xaa41('0x1d')]?_0x12e362[_0xaa41('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12e362[_0xaa41('0x1d')]?_0x12e362[_0xaa41('0x1d')][_0xaa41('0x22')]||null:null,'attributes':_0x12e362[_0xaa41('0x1d')]?_0x12e362[_0xaa41('0x1d')][_0xaa41('0x23')]||null:null,'limit':_0x12e362[_0xaa41('0x1d')]?_0x12e362[_0xaa41('0x1d')]['limit']||null:null})[_0xaa41('0x1f')](function(_0x48b48b){logger['info'](_0xaa41('0x24'),_0x12e362);logger[_0xaa41('0x12')]('UpdateFaxMessage',_0x12e362,JSON[_0xaa41('0x14')](_0x48b48b));_0x536bed(_0x48b48b);})[_0xaa41('0x1a')](function(_0x4e3b44){logger['error']('UpdateFaxMessage',_0x4e3b44[_0xaa41('0x18')],_0x12e362);_0x2d0ac0(_0x59707f[_0xaa41('0x15')](0x1f4,_0x4e3b44[_0xaa41('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index b405c35..87e4b8f 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 _0x04cc=['./faxMessage.events','save','remove','update','emit','register','length','faxMessage:'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x04cc,0x1e0));var _0xc04c=function(_0x4cdd5a,_0x57e480){_0x4cdd5a=_0x4cdd5a-0x0;var _0x4133d9=_0x04cc[_0x4cdd5a];return _0x4133d9;};'use strict';var FaxMessageEvents=require(_0xc04c('0x0'));var events=[_0xc04c('0x1'),_0xc04c('0x2'),_0xc04c('0x3')];function createListener(_0x26bacd,_0x4e98e0){return function(_0xe7c774){_0x4e98e0[_0xc04c('0x4')](_0x26bacd,_0xe7c774);};}function removeListener(_0x108c6d,_0x126fd0){return function(){FaxMessageEvents['removeListener'](_0x108c6d,_0x126fd0);};}exports[_0xc04c('0x5')]=function(_0x50ebd0){for(var _0x174af8=0x0,_0x12bbfc=events[_0xc04c('0x6')];_0x174af8<_0x12bbfc;_0x174af8++){var _0x1b595f=events[_0x174af8];var _0x2a3ec9=createListener(_0xc04c('0x7')+_0x1b595f,_0x50ebd0);FaxMessageEvents['on'](_0x1b595f,_0x2a3ec9);}}; \ No newline at end of file +var _0x9ce1=['remove','update','emit','removeListener','register','faxMessage:','./faxMessage.events'];(function(_0x3133c8,_0x1ecaa8){var _0x1d4f12=function(_0x5af4af){while(--_0x5af4af){_0x3133c8['push'](_0x3133c8['shift']());}};_0x1d4f12(++_0x1ecaa8);}(_0x9ce1,0xae));var _0x19ce=function(_0x1e5341,_0x1ccc34){_0x1e5341=_0x1e5341-0x0;var _0x2822b9=_0x9ce1[_0x1e5341];return _0x2822b9;};'use strict';var FaxMessageEvents=require(_0x19ce('0x0'));var events=['save',_0x19ce('0x1'),_0x19ce('0x2')];function createListener(_0x283acf,_0x5970fa){return function(_0x39d116){_0x5970fa[_0x19ce('0x3')](_0x283acf,_0x39d116);};}function removeListener(_0x11194d,_0x5ed0ad){return function(){FaxMessageEvents[_0x19ce('0x4')](_0x11194d,_0x5ed0ad);};}exports[_0x19ce('0x5')]=function(_0x1c3a2f){for(var _0x4aa4b7=0x0,_0x5b3bef=events['length'];_0x4aa4b7<_0x5b3bef;_0x4aa4b7++){var _0x464501=events[_0x4aa4b7];var _0x390e41=createListener(_0x19ce('0x6')+_0x464501,_0x1c3a2f);FaxMessageEvents['on'](_0x464501,_0x390e41);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 10c1b19..9b37b42 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 _0xf45e=['get','isAuthenticated','index','/describe','describe','/:id','show','download','post','tracked','fax','create','put','update','/:id/reject','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller'];(function(_0x5b8f9e,_0x543a03){var _0x4d6a87=function(_0x5db030){while(--_0x5db030){_0x5b8f9e['push'](_0x5b8f9e['shift']());}};_0x4d6a87(++_0x543a03);}(_0xf45e,0x115));var _0xef45=function(_0x4201ab,_0x32dbca){_0x4201ab=_0x4201ab-0x0;var _0x577807=_0xf45e[_0x4201ab];return _0x577807;};'use strict';var multer=require(_0xef45('0x0'));var util=require('util');var path=require(_0xef45('0x1'));var timeout=require('connect-timeout');var express=require(_0xef45('0x2'));var router=express[_0xef45('0x3')]();var fs_extra=require(_0xef45('0x4'));var auth=require(_0xef45('0x5'));var interaction=require(_0xef45('0x6'));var config=require(_0xef45('0x7'));var controller=require(_0xef45('0x8'));router[_0xef45('0x9')]('/',auth[_0xef45('0xa')](),controller[_0xef45('0xb')]);router[_0xef45('0x9')](_0xef45('0xc'),auth[_0xef45('0xa')](),controller[_0xef45('0xd')]);router[_0xef45('0x9')](_0xef45('0xe'),auth[_0xef45('0xa')](),controller[_0xef45('0xf')]);router[_0xef45('0x9')]('/:id/download',auth[_0xef45('0xa')](),controller[_0xef45('0x10')]);router[_0xef45('0x11')]('/',auth[_0xef45('0xa')](),interaction[_0xef45('0x12')](_0xef45('0x13'),'faxmessage:create'),controller[_0xef45('0x14')]);router[_0xef45('0x15')](_0xef45('0xe'),auth[_0xef45('0xa')](),controller[_0xef45('0x16')]);router['put']('/:id/accept',auth[_0xef45('0xa')](),controller['accept']);router[_0xef45('0x15')](_0xef45('0x17'),auth[_0xef45('0xa')](),controller['reject']);router['delete'](_0xef45('0xe'),auth['isAuthenticated'](),controller[_0xef45('0x18')]);module[_0xef45('0x19')]=router; \ No newline at end of file +var _0xb4e6=['/:id/download','download','post','tracked','fax','create','put','/:id','update','/:id/accept','accept','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','describe','show'];(function(_0x587a3f,_0x52755c){var _0x5ad0d9=function(_0x1de891){while(--_0x1de891){_0x587a3f['push'](_0x587a3f['shift']());}};_0x5ad0d9(++_0x52755c);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x492af5,_0xd51471){_0x492af5=_0x492af5-0x0;var _0x59f529=_0xb4e6[_0x492af5];return _0x59f529;};'use strict';var multer=require(_0x6b4e('0x0'));var util=require('util');var path=require(_0x6b4e('0x1'));var timeout=require(_0x6b4e('0x2'));var express=require(_0x6b4e('0x3'));var router=express[_0x6b4e('0x4')]();var fs_extra=require(_0x6b4e('0x5'));var auth=require(_0x6b4e('0x6'));var interaction=require(_0x6b4e('0x7'));var config=require('../../config/environment');var controller=require(_0x6b4e('0x8'));router[_0x6b4e('0x9')]('/',auth[_0x6b4e('0xa')](),controller['index']);router[_0x6b4e('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x6b4e('0xb')]);router['get']('/:id',auth[_0x6b4e('0xa')](),controller[_0x6b4e('0xc')]);router[_0x6b4e('0x9')](_0x6b4e('0xd'),auth[_0x6b4e('0xa')](),controller[_0x6b4e('0xe')]);router[_0x6b4e('0xf')]('/',auth['isAuthenticated'](),interaction[_0x6b4e('0x10')](_0x6b4e('0x11'),'faxmessage:create'),controller[_0x6b4e('0x12')]);router[_0x6b4e('0x13')](_0x6b4e('0x14'),auth[_0x6b4e('0xa')](),controller[_0x6b4e('0x15')]);router[_0x6b4e('0x13')](_0x6b4e('0x16'),auth['isAuthenticated'](),controller[_0x6b4e('0x17')]);router[_0x6b4e('0x13')]('/:id/reject',auth[_0x6b4e('0xa')](),controller['reject']);router[_0x6b4e('0x18')](_0x6b4e('0x14'),auth[_0x6b4e('0xa')](),controller[_0x6b4e('0x19')]);module[_0x6b4e('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 8166d71..fad83ce 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 _0xd6d1=['beepall','roundrobin','sequelize','exports','STRING','INTEGER','ENUM','rrmemory'];(function(_0x77f8f6,_0x52658d){var _0x3fea8f=function(_0x2523ed){while(--_0x2523ed){_0x77f8f6['push'](_0x77f8f6['shift']());}};_0x3fea8f(++_0x52658d);}(_0xd6d1,0x14a));var _0x1d6d=function(_0x39dd46,_0x2fbdbc){_0x39dd46=_0x39dd46-0x0;var _0xea3c6=_0xd6d1[_0x39dd46];return _0xea3c6;};'use strict';var Sequelize=require(_0x1d6d('0x0'));module[_0x1d6d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1d6d('0x2')]},'timeout':{'type':Sequelize[_0x1d6d('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1d6d('0x4')](_0x1d6d('0x5'),_0x1d6d('0x6'),_0x1d6d('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x1d6d('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe96f=['sequelize','exports','STRING','name','INTEGER','rrmemory','beepall','roundrobin'];(function(_0x4afac5,_0x1ab4ed){var _0x2404b3=function(_0x5c700b){while(--_0x5c700b){_0x4afac5['push'](_0x4afac5['shift']());}};_0x2404b3(++_0x1ab4ed);}(_0xe96f,0x158));var _0xfe96=function(_0x1320fb,_0x1e510f){_0x1320fb=_0x1320fb-0x0;var _0x57ab52=_0xe96f[_0x1320fb];return _0x57ab52;};'use strict';var Sequelize=require(_0xfe96('0x0'));module[_0xfe96('0x1')]={'name':{'type':Sequelize[_0xfe96('0x2')],'unique':_0xfe96('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfe96('0x2')]},'timeout':{'type':Sequelize[_0xfe96('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xfe96('0x5'),_0xfe96('0x6'),_0xfe96('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xfe96('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index b23a264..11eff0c 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 _0xd591=['forEach','emit','removeTeams','select','tq.TeamId','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','isEmpty','userFaxQueue:remove','addAgents','spread','userFaxQueue:save','isArray','getAgents','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','offset','limit','undefined','count','set','apply','reject','save','then','destroy','get','UserProfileResource','end','error','stack','name','send','FaxQueue','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','params','options','find','create','body','role','user','FaxQueues','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','length','nolimit','FaxQueueId','UserFaxQueue','findAll','User','findAndCountAll','agent','faxPause','createdAt','format','%s/%s','updatedAt','getTeams','findOne','addTeams','ids','Team','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate'];(function(_0x301173,_0x262755){var _0x236afa=function(_0x5f491f){while(--_0x5f491f){_0x301173['push'](_0x301173['shift']());}};_0x236afa(++_0x262755);}(_0xd591,0xa2));var _0x1d59=function(_0x20dbc2,_0x18f579){_0x20dbc2=_0x20dbc2-0x0;var _0x4f1dc9=_0xd591[_0x20dbc2];return _0x4f1dc9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1d59('0x0'));var rp=require(_0x1d59('0x1'));var moment=require(_0x1d59('0x2'));var BPromise=require(_0x1d59('0x3'));var Mustache=require(_0x1d59('0x4'));var util=require('util');var path=require('path');var sox=require(_0x1d59('0x5'));var csv=require('to-csv');var ejs=require(_0x1d59('0x6'));var fs=require('fs');var fs_extra=require(_0x1d59('0x7'));var _=require(_0x1d59('0x8'));var squel=require(_0x1d59('0x9'));var crypto=require(_0x1d59('0xa'));var jsforce=require(_0x1d59('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1d59('0xc'));var querystring=require(_0x1d59('0xd'));var Papa=require(_0x1d59('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1d59('0xf'));var as=require(_0x1d59('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1d59('0x11'))(_0x1d59('0x12'));var utils=require(_0x1d59('0x13'));var config=require(_0x1d59('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x1d59('0x15')]=_[_0x1d59('0x16')](config['redis'],{'host':_0x1d59('0x17'),'port':0x18eb});var socket=require(_0x1d59('0x18'))(new Redis(config[_0x1d59('0x15')]));require(_0x1d59('0x19'))[_0x1d59('0x1a')](socket);function respondWithStatusCode(_0x357d1e,_0x524002){_0x524002=_0x524002||0xcc;return function(_0x361d0a){if(_0x361d0a){return _0x357d1e[_0x1d59('0x1b')](_0x524002);}return _0x357d1e['status'](_0x524002)['end']();};}function respondWithResult(_0x18b598,_0x40527b){_0x40527b=_0x40527b||0xc8;return function(_0x3f32da){if(_0x3f32da){return _0x18b598[_0x1d59('0x1c')](_0x40527b)['json'](_0x3f32da);}};}function respondWithFilteredResult(_0x3c7090,_0xf7a1b7){return function(_0x4343f0){if(_0x4343f0){var _0x3646f9=typeof _0xf7a1b7[_0x1d59('0x1d')]==='undefined'&&typeof _0xf7a1b7[_0x1d59('0x1e')]===_0x1d59('0x1f');var _0x23e78a=_0x4343f0[_0x1d59('0x20')];var _0x19b059=_0x3646f9?0x0:_0xf7a1b7[_0x1d59('0x1d')];var _0x2947ee=_0x3646f9?_0x4343f0[_0x1d59('0x20')]:_0xf7a1b7[_0x1d59('0x1d')]+_0xf7a1b7[_0x1d59('0x1e')];var _0x4bef6f;if(_0x2947ee>=_0x23e78a){_0x2947ee=_0x23e78a;_0x4bef6f=0xc8;}else{_0x4bef6f=0xce;}_0x3c7090[_0x1d59('0x1c')](_0x4bef6f);return _0x3c7090[_0x1d59('0x21')]('Content-Range',_0x19b059+'-'+_0x2947ee+'/'+_0x23e78a)['json'](_0x4343f0);}return null;};}function patchUpdates(_0x138355){return function(_0x59631a){try{jsonpatch[_0x1d59('0x22')](_0x59631a,_0x138355,!![]);}catch(_0x19e7c5){return BPromise[_0x1d59('0x23')](_0x19e7c5);}return _0x59631a[_0x1d59('0x24')]();};}function saveUpdates(_0x1cbbea,_0x32b896){return function(_0x30b469){if(_0x30b469){return _0x30b469['update'](_0x1cbbea)[_0x1d59('0x25')](function(_0x3e72ab){return _0x3e72ab;});}return null;};}function removeEntity(_0x90d3b5,_0x1ce2a5){return function(_0x33dff9){if(_0x33dff9){return _0x33dff9[_0x1d59('0x26')]()[_0x1d59('0x25')](function(){var _0x50805d=_0x33dff9[_0x1d59('0x27')]({'plain':!![]});var _0x231efb='FaxQueues';return db[_0x1d59('0x28')][_0x1d59('0x26')]({'where':{'type':_0x231efb,'resourceId':_0x50805d['id']}})[_0x1d59('0x25')](function(){return _0x33dff9;});})[_0x1d59('0x25')](function(){_0x90d3b5['status'](0xcc)[_0x1d59('0x29')]();});}};}function handleEntityNotFound(_0x1a0990,_0x4d728d){return function(_0x165372){if(!_0x165372){_0x1a0990[_0x1d59('0x1b')](0x194);}return _0x165372;};}function handleError(_0x2bd9ea,_0x190a33){_0x190a33=_0x190a33||0x1f4;return function(_0x4ea932){logger[_0x1d59('0x2a')](_0x4ea932[_0x1d59('0x2b')]);if(_0x4ea932[_0x1d59('0x2c')]){delete _0x4ea932[_0x1d59('0x2c')];}_0x2bd9ea['status'](_0x190a33)[_0x1d59('0x2d')](_0x4ea932);};}exports['index']=function(_0x137b2a,_0x2ce3b2){var _0x6b86af={},_0x552610={},_0x4cc95f={'count':0x0,'rows':[]};var _0x509daf=_['map'](db[_0x1d59('0x2e')][_0x1d59('0x2f')],function(_0x4bd03d){return{'name':_0x4bd03d[_0x1d59('0x30')],'type':_0x4bd03d['type'][_0x1d59('0x31')]};});_0x552610[_0x1d59('0x32')]=_[_0x1d59('0x33')](_0x509daf,'name');_0x552610[_0x1d59('0x34')]=_[_0x1d59('0x35')](_0x137b2a[_0x1d59('0x34')]);_0x552610[_0x1d59('0x36')]=_['intersection'](_0x552610[_0x1d59('0x32')],_0x552610[_0x1d59('0x34')]);_0x6b86af[_0x1d59('0x37')]=_[_0x1d59('0x38')](_0x552610['model'],qs[_0x1d59('0x39')](_0x137b2a[_0x1d59('0x34')]['fields']));_0x6b86af[_0x1d59('0x37')]=_0x6b86af[_0x1d59('0x37')]['length']?_0x6b86af[_0x1d59('0x37')]:_0x552610[_0x1d59('0x32')];if(!_0x137b2a['query'][_0x1d59('0x3a')]('nolimit')){_0x6b86af[_0x1d59('0x1e')]=qs[_0x1d59('0x1e')](_0x137b2a['query'][_0x1d59('0x1e')]);_0x6b86af[_0x1d59('0x1d')]=qs[_0x1d59('0x1d')](_0x137b2a['query'][_0x1d59('0x1d')]);}_0x6b86af[_0x1d59('0x3b')]=qs['sort'](_0x137b2a[_0x1d59('0x34')][_0x1d59('0x3c')]);_0x6b86af[_0x1d59('0x3d')]=qs['filters'](_[_0x1d59('0x3e')](_0x137b2a[_0x1d59('0x34')],_0x552610[_0x1d59('0x36')]),_0x509daf);if(_0x137b2a[_0x1d59('0x34')][_0x1d59('0x3f')]){_0x6b86af[_0x1d59('0x3d')]=_[_0x1d59('0x40')](_0x6b86af[_0x1d59('0x3d')],{'$or':_['map'](_0x509daf,function(_0x3ec37d){if(_0x3ec37d['type']!==_0x1d59('0x41')){var _0x5d66e3={};_0x5d66e3[_0x3ec37d[_0x1d59('0x2c')]]={'$like':'%'+_0x137b2a[_0x1d59('0x34')]['filter']+'%'};return _0x5d66e3;}})});}_0x6b86af=_[_0x1d59('0x40')]({},_0x6b86af,_0x137b2a['options']);var _0xc47f15={'where':_0x6b86af['where']};return db['FaxQueue'][_0x1d59('0x20')](_0xc47f15)[_0x1d59('0x25')](function(_0x304428){_0x4cc95f[_0x1d59('0x20')]=_0x304428;if(_0x137b2a[_0x1d59('0x34')][_0x1d59('0x42')]){_0x6b86af[_0x1d59('0x43')]=[{'all':!![]}];}return db['FaxQueue']['findAll'](_0x6b86af);})[_0x1d59('0x25')](function(_0x1a2283){_0x4cc95f[_0x1d59('0x44')]=_0x1a2283;return _0x4cc95f;})[_0x1d59('0x25')](respondWithFilteredResult(_0x2ce3b2,_0x6b86af))['catch'](handleError(_0x2ce3b2,null));};exports['show']=function(_0x521649,_0x22ebc0){var _0x3c4e15={'raw':!![],'where':{'id':_0x521649[_0x1d59('0x45')]['id']}},_0x4da2cb={};_0x4da2cb[_0x1d59('0x32')]=_[_0x1d59('0x35')](db[_0x1d59('0x2e')][_0x1d59('0x2f')]);_0x4da2cb[_0x1d59('0x34')]=_[_0x1d59('0x35')](_0x521649[_0x1d59('0x34')]);_0x4da2cb['filters']=_[_0x1d59('0x38')](_0x4da2cb[_0x1d59('0x32')],_0x4da2cb['query']);_0x3c4e15[_0x1d59('0x37')]=_[_0x1d59('0x38')](_0x4da2cb[_0x1d59('0x32')],qs[_0x1d59('0x39')](_0x521649['query'][_0x1d59('0x39')]));_0x3c4e15[_0x1d59('0x37')]=_0x3c4e15[_0x1d59('0x37')]['length']?_0x3c4e15[_0x1d59('0x37')]:_0x4da2cb[_0x1d59('0x32')];if(_0x521649['query'][_0x1d59('0x42')]){_0x3c4e15[_0x1d59('0x43')]=[{'all':!![]}];}_0x3c4e15=_[_0x1d59('0x40')]({},_0x3c4e15,_0x521649[_0x1d59('0x46')]);return db[_0x1d59('0x2e')][_0x1d59('0x47')](_0x3c4e15)[_0x1d59('0x25')](handleEntityNotFound(_0x22ebc0,null))[_0x1d59('0x25')](respondWithResult(_0x22ebc0,null))['catch'](handleError(_0x22ebc0,null));};exports[_0x1d59('0x48')]=function(_0x44482c,_0x500cd5){return db[_0x1d59('0x2e')][_0x1d59('0x48')](_0x44482c[_0x1d59('0x49')],{})[_0x1d59('0x25')](function(_0x468ef0){var _0x580189=_0x44482c['user'][_0x1d59('0x27')]({'plain':!![]});if(!_0x580189)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x580189[_0x1d59('0x4a')]===_0x1d59('0x4b')){var _0x32e082=_0x468ef0[_0x1d59('0x27')]({'plain':!![]});var _0xbe0a8f=_0x1d59('0x4c');return db[_0x1d59('0x4d')][_0x1d59('0x47')]({'where':{'name':_0xbe0a8f,'userProfileId':_0x580189[_0x1d59('0x4e')]},'raw':!![]})['then'](function(_0x4b147c){if(_0x4b147c&&_0x4b147c[_0x1d59('0x4f')]===0x0){return db[_0x1d59('0x28')][_0x1d59('0x48')]({'name':_0x32e082[_0x1d59('0x2c')],'resourceId':_0x32e082['id'],'type':_0x4b147c['name'],'sectionId':_0x4b147c['id']},{})[_0x1d59('0x25')](function(){return _0x468ef0;});}else{return _0x468ef0;}})[_0x1d59('0x50')](function(_0x429400){logger[_0x1d59('0x2a')](_0x1d59('0x51'),_0x429400);throw _0x429400;});}return _0x468ef0;})['then'](respondWithResult(_0x500cd5,0xc9))[_0x1d59('0x50')](handleError(_0x500cd5,null));};exports[_0x1d59('0x52')]=function(_0x541a3c,_0x2a5253){if(_0x541a3c[_0x1d59('0x49')]['id']){delete _0x541a3c['body']['id'];}return db[_0x1d59('0x2e')][_0x1d59('0x47')]({'where':{'id':_0x541a3c['params']['id']}})[_0x1d59('0x25')](handleEntityNotFound(_0x2a5253,null))[_0x1d59('0x25')](saveUpdates(_0x541a3c['body'],null))['then'](respondWithResult(_0x2a5253,null))[_0x1d59('0x50')](handleError(_0x2a5253,null));};exports[_0x1d59('0x26')]=function(_0x53ef83,_0x5befcf){return db[_0x1d59('0x2e')][_0x1d59('0x47')]({'where':{'id':_0x53ef83['params']['id']}})[_0x1d59('0x25')](handleEntityNotFound(_0x5befcf,null))[_0x1d59('0x25')](removeEntity(_0x5befcf,null))[_0x1d59('0x50')](handleError(_0x5befcf,null));};exports[_0x1d59('0x53')]=function(_0x29fc7e,_0x1cf81c){return db[_0x1d59('0x2e')][_0x1d59('0x53')]()[_0x1d59('0x25')](respondWithResult(_0x1cf81c,null))[_0x1d59('0x50')](handleError(_0x1cf81c,null));};exports['getMembers']=function(_0x456087,_0x46c03a,_0x9821a1){var _0x70dd1={'raw':!![],'where':{}},_0x57d1e2={},_0x5c9488;return db[_0x1d59('0x2e')]['findOne']({'where':{'id':_0x456087['params']['id']}})['then'](handleEntityNotFound(_0x46c03a,null))['then'](function(_0x1a8c63){if(_0x1a8c63){_0x5c9488=_0x1a8c63[_0x1d59('0x27')]({'plain':!![]});_0x57d1e2['model']=_['keys'](db['UserFaxQueue'][_0x1d59('0x2f')]);_0x57d1e2[_0x1d59('0x34')]=_['keys'](_0x456087[_0x1d59('0x34')]);_0x57d1e2[_0x1d59('0x36')]=_[_0x1d59('0x38')](_0x57d1e2[_0x1d59('0x32')],_0x57d1e2[_0x1d59('0x34')]);_0x70dd1[_0x1d59('0x37')]=_['intersection'](_0x57d1e2[_0x1d59('0x32')],qs[_0x1d59('0x39')](_0x456087[_0x1d59('0x34')][_0x1d59('0x39')]));_0x70dd1[_0x1d59('0x37')]=_0x70dd1[_0x1d59('0x37')][_0x1d59('0x54')]?_0x70dd1['attributes']:_0x57d1e2[_0x1d59('0x32')];if(!_0x456087[_0x1d59('0x34')][_0x1d59('0x3a')](_0x1d59('0x55'))){_0x70dd1[_0x1d59('0x1e')]=qs[_0x1d59('0x1e')](_0x456087[_0x1d59('0x34')][_0x1d59('0x1e')]);_0x70dd1[_0x1d59('0x1d')]=qs['offset'](_0x456087[_0x1d59('0x34')][_0x1d59('0x1d')]);}_0x70dd1['order']=qs[_0x1d59('0x3c')](_0x456087[_0x1d59('0x34')]['sort']);_0x70dd1[_0x1d59('0x3d')]=qs['filters'](_[_0x1d59('0x3e')](_0x456087[_0x1d59('0x34')],_0x57d1e2[_0x1d59('0x36')]));_0x70dd1[_0x1d59('0x3d')][_0x1d59('0x56')]=_0x1a8c63['id'];if(_0x456087['query'][_0x1d59('0x3f')]){_0x70dd1[_0x1d59('0x3d')]=_[_0x1d59('0x40')](_0x70dd1['where'],{'$or':_[_0x1d59('0x33')](_0x70dd1['attributes'],function(_0x17d7dd){var _0x553771={};_0x553771[_0x17d7dd]={'$like':'%'+_0x456087['query'][_0x1d59('0x3f')]+'%'};return _0x553771;})});}_0x70dd1=_[_0x1d59('0x40')]({},_0x70dd1,_0x456087[_0x1d59('0x46')]);return db[_0x1d59('0x57')][_0x1d59('0x58')](_0x70dd1);}})[_0x1d59('0x25')](function(_0x291f7f){if(_0x291f7f){return db[_0x1d59('0x59')][_0x1d59('0x5a')]({'where':{'id':_['map'](_0x291f7f,'UserId'),'role':_0x1d59('0x5b')},'attributes':['id','name',_0x1d59('0x5c'),'updatedAt',_0x1d59('0x5d')]});}})[_0x1d59('0x25')](function(_0xdd9b4d){if(_0xdd9b4d){return{'count':_0xdd9b4d['count'],'rows':_[_0x1d59('0x33')](_0xdd9b4d[_0x1d59('0x44')],function(_0x2dc061){return{'membername':_0x2dc061[_0x1d59('0x2c')],'UserId':_0x2dc061['id'],'queue_name':_0x5c9488[_0x1d59('0x2c')],'FaxQueueId':_0x5c9488['id'],'interface':util[_0x1d59('0x5e')](_0x1d59('0x5f'),'SIP',_0x2dc061['name']),'penalty':0x0,'paused':_0x2dc061[_0x1d59('0x5c')],'createdAt':_0x2dc061['createdAt'],'updatedAt':_0x2dc061[_0x1d59('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1d59('0x25')](respondWithFilteredResult(_0x46c03a,_0x70dd1))[_0x1d59('0x50')](handleError(_0x46c03a,null));};exports[_0x1d59('0x61')]=function(_0x273304,_0x4a4e39,_0x3656e7){var _0x27259e={};var _0x3fd0b0={};var _0x470187;var _0x8f13bd;return db[_0x1d59('0x2e')][_0x1d59('0x62')]({'where':{'id':_0x273304[_0x1d59('0x45')]['id']}})['then'](handleEntityNotFound(_0x4a4e39,null))[_0x1d59('0x25')](function(_0x56ade7){if(_0x56ade7){_0x470187=_0x56ade7;_0x3fd0b0[_0x1d59('0x32')]=_[_0x1d59('0x35')](db['Team']['rawAttributes']);_0x3fd0b0[_0x1d59('0x34')]=_[_0x1d59('0x35')](_0x273304['query']);_0x3fd0b0['filters']=_[_0x1d59('0x38')](_0x3fd0b0[_0x1d59('0x32')],_0x3fd0b0[_0x1d59('0x34')]);_0x27259e[_0x1d59('0x37')]=_[_0x1d59('0x38')](_0x3fd0b0['model'],qs[_0x1d59('0x39')](_0x273304[_0x1d59('0x34')][_0x1d59('0x39')]));_0x27259e[_0x1d59('0x37')]=_0x27259e[_0x1d59('0x37')]['length']?_0x27259e[_0x1d59('0x37')]:_0x3fd0b0[_0x1d59('0x32')];_0x27259e[_0x1d59('0x3b')]=qs[_0x1d59('0x3c')](_0x273304[_0x1d59('0x34')]['sort']);_0x27259e['where']=qs[_0x1d59('0x36')](_[_0x1d59('0x3e')](_0x273304[_0x1d59('0x34')],_0x3fd0b0['filters']));if(_0x273304[_0x1d59('0x34')]['filter']){_0x27259e['where']=_[_0x1d59('0x40')](_0x27259e[_0x1d59('0x3d')],{'$or':_[_0x1d59('0x33')](_0x27259e[_0x1d59('0x37')],function(_0x3b2434){var _0x1587f8={};_0x1587f8[_0x3b2434]={'$like':'%'+_0x273304[_0x1d59('0x34')][_0x1d59('0x3f')]+'%'};return _0x1587f8;})});}_0x27259e=_[_0x1d59('0x40')]({},_0x27259e,_0x273304[_0x1d59('0x46')]);return _0x470187[_0x1d59('0x61')](_0x27259e);}})[_0x1d59('0x25')](function(_0x43aa2d){if(_0x43aa2d){_0x8f13bd=_0x43aa2d[_0x1d59('0x54')];if(!_0x273304[_0x1d59('0x34')]['hasOwnProperty'](_0x1d59('0x55'))){_0x27259e['limit']=qs[_0x1d59('0x1e')](_0x273304['query'][_0x1d59('0x1e')]);_0x27259e[_0x1d59('0x1d')]=qs[_0x1d59('0x1d')](_0x273304[_0x1d59('0x34')][_0x1d59('0x1d')]);}return _0x470187[_0x1d59('0x61')](_0x27259e);}})[_0x1d59('0x25')](function(_0x1d7658){if(_0x1d7658){return _0x1d7658?{'count':_0x8f13bd,'rows':_0x1d7658}:null;}})[_0x1d59('0x25')](respondWithResult(_0x4a4e39,null))['catch'](handleError(_0x4a4e39,null));};exports[_0x1d59('0x63')]=function(_0x2a608c,_0x269591,_0x57a155){var _0x4a63ac=_0x2a608c['body'][_0x1d59('0x64')];return db[_0x1d59('0x65')][_0x1d59('0x58')]({'where':{'id':_0x4a63ac},'attributes':['id'],'include':[{'model':db[_0x1d59('0x59')],'as':_0x1d59('0x66'),'attributes':['id',_0x1d59('0x2c'),_0x1d59('0x67'),_0x1d59('0x68'),_0x1d59('0x69')],'raw':!![]}]})[_0x1d59('0x25')](function(_0x5a8e23){if(_0x5a8e23){var _0x251edf=_['flatMap'](_0x5a8e23,function(_0x302b5a){var _0x2f8a5d=_0x302b5a[_0x1d59('0x27')]({'plain':!![]});return _0x2f8a5d[_0x1d59('0x66')];});return db[_0x1d59('0x2e')][_0x1d59('0x47')]({'where':{'id':_0x2a608c[_0x1d59('0x45')]['id']}})[_0x1d59('0x25')](function(_0x145841){return db[_0x1d59('0x6a')][_0x1d59('0x6b')](function(_0x220365){return _0x145841[_0x1d59('0x63')](_0x4a63ac,{'transaction':_0x220365})[_0x1d59('0x25')](function(){return BPromise[_0x1d59('0x6c')](_0x251edf,function(_0x4627ab){return db['UserFaxQueue'][_0x1d59('0x6d')]({'where':{'UserId':_0x4627ab['id'],'FaxQueueId':_0x2a608c[_0x1d59('0x45')]['id']},'transaction':_0x220365});});})['then'](function(){_0x251edf[_0x1d59('0x6e')](function(_0x4b6e31){socket[_0x1d59('0x6f')]('userFaxQueue:save',{'UserId':_0x4b6e31['id'],'FaxQueueId':_0x145841['id']});});});});});}})[_0x1d59('0x25')](respondWithStatusCode(_0x269591,null))[_0x1d59('0x50')](handleError(_0x269591,null));};exports[_0x1d59('0x70')]=function(_0x29f6fc,_0x4dbf35,_0x42297c){return db[_0x1d59('0x65')][_0x1d59('0x58')]({'where':{'id':_0x29f6fc[_0x1d59('0x34')][_0x1d59('0x64')]},'attributes':['id'],'include':[{'model':db[_0x1d59('0x59')],'as':_0x1d59('0x66'),'attributes':['id'],'raw':!![]}]})[_0x1d59('0x25')](handleEntityNotFound(_0x4dbf35,null))[_0x1d59('0x25')](function(_0x384232){var _0x4ca70f=_[_0x1d59('0x33')](_0x384232,'id');var _0xa3c1d0=[];var _0x1715f1=[];var _0x483510=squel[_0x1d59('0x71')]();_0x483510['field'](_0x1d59('0x72'))['from'](_0x1d59('0x73'),'tq')['join'](_0x1d59('0x74'),'ut',_0x1d59('0x75'))[_0x1d59('0x3d')](_0x1d59('0x76'),_0x29f6fc[_0x1d59('0x45')]['id']);for(var _0x379a1b=0x0;_0x379a1b<_0x384232[_0x1d59('0x54')];_0x379a1b+=0x1){let _0x3b5fe2=_0x384232[_0x379a1b];for(var _0x1044ab=0x0;_0x1044ab<_0x3b5fe2[_0x1d59('0x66')][_0x1d59('0x54')];_0x1044ab+=0x1){let _0x42e57d=_0x3b5fe2[_0x1d59('0x66')][_0x1044ab];var _0x5b068d=_0x483510['clone']();_0x5b068d[_0x1d59('0x3d')](_0x1d59('0x77'),_0x42e57d['id']);_0x1715f1[_0x1d59('0x78')](db[_0x1d59('0x6a')][_0x1d59('0x34')](_0x5b068d[_0x1d59('0x79')](),{'type':db['sequelize'][_0x1d59('0x7a')][_0x1d59('0x7b')]})['then'](function(_0x14cb0c){if(_0x14cb0c[_0x1d59('0x54')]===0x1){return _0x42e57d['id'];}else{var _0x245713=_[_0x1d59('0x7c')](_['map'](_0x14cb0c,_0x1d59('0x7d')),function(_0x15da6a){return _[_0x1d59('0x7e')](_0x4ca70f,_0x15da6a);});if(_0x245713){return _0x42e57d['id'];}}}));}}return BPromise[_0x1d59('0x7f')](_0x1715f1)[_0x1d59('0x25')](function(_0x65717e){_0xa3c1d0=_(_0xa3c1d0)[_0x1d59('0x80')](_0x65717e)['compact']()['value']();return db[_0x1d59('0x2e')][_0x1d59('0x47')]({'where':{'id':_0x29f6fc[_0x1d59('0x45')]['id']}})[_0x1d59('0x25')](function(_0x62b18c){return db['sequelize'][_0x1d59('0x6b')](function(_0x26b2c7){return _0x62b18c['removeTeams'](_0x29f6fc[_0x1d59('0x34')]['ids'],{'transaction':_0x26b2c7})['then'](function(){if(!_[_0x1d59('0x81')](_0xa3c1d0)){return _0x62b18c['removeAgents'](_0xa3c1d0,{'transaction':_0x26b2c7});}})[_0x1d59('0x25')](function(){_0xa3c1d0[_0x1d59('0x6e')](function(_0x22da6a){socket[_0x1d59('0x6f')](_0x1d59('0x82'),{'UserId':_0x22da6a,'FaxQueueId':_0x62b18c['id']});});});});});});})[_0x1d59('0x25')](respondWithStatusCode(_0x4dbf35,null))[_0x1d59('0x50')](handleError(_0x4dbf35,null));};exports['addAgents']=function(_0x45bb61,_0x2a943a,_0x4e47b5){return db['FaxQueue'][_0x1d59('0x47')]({'where':{'id':_0x45bb61[_0x1d59('0x45')]['id']}})['then'](handleEntityNotFound(_0x2a943a,null))['then'](function(_0x513d72){if(_0x513d72){return _0x513d72[_0x1d59('0x83')](_0x45bb61[_0x1d59('0x49')][_0x1d59('0x64')],_['omit'](_0x45bb61[_0x1d59('0x49')],[_0x1d59('0x64'),'id'])||{})[_0x1d59('0x84')](function(_0x394745){for(var _0x4ad65b=0x0;_0x4ad65b<_0x45bb61['body'][_0x1d59('0x64')][_0x1d59('0x54')];_0x4ad65b+=0x1){socket[_0x1d59('0x6f')](_0x1d59('0x85'),{'UserId':Number(_0x45bb61['body'][_0x1d59('0x64')][_0x4ad65b]),'FaxQueueId':Number(_0x45bb61[_0x1d59('0x45')]['id'])});}return _0x394745;});}})[_0x1d59('0x25')](respondWithResult(_0x2a943a,null))['catch'](handleError(_0x2a943a,null));};exports['removeAgents']=function(_0x8b39a2,_0x18283a,_0xf51369){return db['FaxQueue'][_0x1d59('0x47')]({'where':{'id':_0x8b39a2[_0x1d59('0x45')]['id']}})[_0x1d59('0x25')](handleEntityNotFound(_0x18283a,null))[_0x1d59('0x25')](function(_0x30e627){if(_0x30e627){return _0x30e627['removeAgents'](_0x8b39a2[_0x1d59('0x34')][_0x1d59('0x64')])[_0x1d59('0x25')](function(){if(_[_0x1d59('0x86')](_0x8b39a2[_0x1d59('0x34')][_0x1d59('0x64')])){for(var _0x32abf3=0x0;_0x32abf3<_0x8b39a2[_0x1d59('0x34')][_0x1d59('0x64')]['length'];_0x32abf3+=0x1){socket['emit'](_0x1d59('0x82'),{'UserId':Number(_0x8b39a2['query'][_0x1d59('0x64')][_0x32abf3]),'FaxQueueId':Number(_0x8b39a2['params']['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x8b39a2[_0x1d59('0x34')][_0x1d59('0x64')]),'FaxQueueId':Number(_0x8b39a2['params']['id'])});}});}})['then'](respondWithStatusCode(_0x18283a,null))['catch'](handleError(_0x18283a,null));};exports[_0x1d59('0x87')]=function(_0x380639,_0x465d71,_0x4adefc){var _0x2c3909={};var _0x292283={};var _0x24e5ce;var _0x435f84;return db[_0x1d59('0x2e')][_0x1d59('0x62')]({'where':{'id':_0x380639[_0x1d59('0x45')]['id']}})[_0x1d59('0x25')](handleEntityNotFound(_0x465d71,null))[_0x1d59('0x25')](function(_0x4f94ed){if(_0x4f94ed){_0x24e5ce=_0x4f94ed;_0x292283[_0x1d59('0x32')]=_[_0x1d59('0x35')](db[_0x1d59('0x59')]['rawAttributes']);_0x292283[_0x1d59('0x34')]=_[_0x1d59('0x35')](_0x380639[_0x1d59('0x34')]);_0x292283[_0x1d59('0x36')]=_[_0x1d59('0x38')](_0x292283['model'],_0x292283['query']);_0x2c3909['attributes']=_[_0x1d59('0x38')](_0x292283[_0x1d59('0x32')],qs['fields'](_0x380639['query']['fields']));_0x2c3909[_0x1d59('0x37')]=_0x2c3909[_0x1d59('0x37')][_0x1d59('0x54')]?_0x2c3909['attributes']:_0x292283[_0x1d59('0x32')];_0x2c3909[_0x1d59('0x3b')]=qs[_0x1d59('0x3c')](_0x380639[_0x1d59('0x34')][_0x1d59('0x3c')]);_0x2c3909['where']=qs['filters'](_[_0x1d59('0x3e')](_0x380639[_0x1d59('0x34')],_0x292283[_0x1d59('0x36')]));if(_0x380639[_0x1d59('0x34')][_0x1d59('0x3f')]){_0x2c3909[_0x1d59('0x3d')]=_['merge'](_0x2c3909[_0x1d59('0x3d')],{'$or':_[_0x1d59('0x33')](_0x2c3909[_0x1d59('0x37')],function(_0x552226){var _0x2d8fee={};_0x2d8fee[_0x552226]={'$like':'%'+_0x380639[_0x1d59('0x34')]['filter']+'%'};return _0x2d8fee;})});}_0x2c3909=_[_0x1d59('0x40')]({},_0x2c3909,_0x380639[_0x1d59('0x46')]);return _0x24e5ce[_0x1d59('0x87')](_0x2c3909);}})[_0x1d59('0x25')](function(_0x531a64){if(_0x531a64){_0x435f84=_0x531a64[_0x1d59('0x54')];if(!_0x380639['query'][_0x1d59('0x3a')](_0x1d59('0x55'))){_0x2c3909[_0x1d59('0x1e')]=qs[_0x1d59('0x1e')](_0x380639[_0x1d59('0x34')][_0x1d59('0x1e')]);_0x2c3909[_0x1d59('0x1d')]=qs['offset'](_0x380639[_0x1d59('0x34')]['offset']);}return _0x24e5ce[_0x1d59('0x87')](_0x2c3909);}})[_0x1d59('0x25')](function(_0x1e6e2d){if(_0x1e6e2d){return _0x1e6e2d?{'count':_0x435f84,'rows':_0x1e6e2d}:null;}})[_0x1d59('0x25')](respondWithResult(_0x465d71,null))[_0x1d59('0x50')](handleError(_0x465d71,null));}; \ No newline at end of file +var _0x464c=['emit','userFaxQueue:save','removeTeams','ids','select','field','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','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','redis','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','end','undefined','limit','count','offset','status','set','json','apply','save','then','destroy','get','FaxQueues','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','sort','where','pick','filter','merge','includeAll','include','FaxQueue','rows','show','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserFaxQueue','nolimit','FaxQueueId','options','findAll','User','findAndCountAll','faxPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','order','hasOwnProperty','addTeams','Agents','online','voicePause','interface','flatMap','transaction','findOrCreate','forEach'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x464c,0x137));var _0xc464=function(_0x1b4242,_0x39fb27){_0x1b4242=_0x1b4242-0x0;var _0x260288=_0x464c[_0x1b4242];return _0x260288;};'use strict';var emlformat=require(_0xc464('0x0'));var rimraf=require(_0xc464('0x1'));var zipdir=require(_0xc464('0x2'));var jsonpatch=require(_0xc464('0x3'));var rp=require(_0xc464('0x4'));var moment=require(_0xc464('0x5'));var BPromise=require(_0xc464('0x6'));var Mustache=require(_0xc464('0x7'));var util=require('util');var path=require(_0xc464('0x8'));var sox=require(_0xc464('0x9'));var csv=require(_0xc464('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc464('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc464('0xc'));var jsforce=require(_0xc464('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc464('0xa'));var querystring=require(_0xc464('0xe'));var Papa=require(_0xc464('0xf'));var Redis=require(_0xc464('0x10'));var authService=require(_0xc464('0x11'));var qs=require(_0xc464('0x12'));var as=require(_0xc464('0x13'));var hardwareService=require(_0xc464('0x14'));var logger=require('../../config/logger')(_0xc464('0x15'));var utils=require(_0xc464('0x16'));var config=require(_0xc464('0x17'));var licenseUtil=require(_0xc464('0x18'));var db=require(_0xc464('0x19'))['db'];config[_0xc464('0x1a')]=_['defaults'](config[_0xc464('0x1a')],{'host':_0xc464('0x1b'),'port':0x18eb});var socket=require(_0xc464('0x1c'))(new Redis(config[_0xc464('0x1a')]));require(_0xc464('0x1d'))['register'](socket);function respondWithStatusCode(_0x535120,_0x587d01){_0x587d01=_0x587d01||0xcc;return function(_0xcdeaf){if(_0xcdeaf){return _0x535120[_0xc464('0x1e')](_0x587d01);}return _0x535120['status'](_0x587d01)[_0xc464('0x1f')]();};}function respondWithResult(_0xbdddff,_0xcc2257){_0xcc2257=_0xcc2257||0xc8;return function(_0x5afe67){if(_0x5afe67){return _0xbdddff['status'](_0xcc2257)['json'](_0x5afe67);}};}function respondWithFilteredResult(_0x141c80,_0x22155b){return function(_0xc0de8a){if(_0xc0de8a){var _0xbff963=typeof _0x22155b['offset']===_0xc464('0x20')&&typeof _0x22155b[_0xc464('0x21')]===_0xc464('0x20');var _0x5734b9=_0xc0de8a[_0xc464('0x22')];var _0x1cd2af=_0xbff963?0x0:_0x22155b[_0xc464('0x23')];var _0x3ebd3d=_0xbff963?_0xc0de8a[_0xc464('0x22')]:_0x22155b[_0xc464('0x23')]+_0x22155b[_0xc464('0x21')];var _0x4fd362;if(_0x3ebd3d>=_0x5734b9){_0x3ebd3d=_0x5734b9;_0x4fd362=0xc8;}else{_0x4fd362=0xce;}_0x141c80[_0xc464('0x24')](_0x4fd362);return _0x141c80[_0xc464('0x25')]('Content-Range',_0x1cd2af+'-'+_0x3ebd3d+'/'+_0x5734b9)[_0xc464('0x26')](_0xc0de8a);}return null;};}function patchUpdates(_0x62cd7a){return function(_0x535cb9){try{jsonpatch[_0xc464('0x27')](_0x535cb9,_0x62cd7a,!![]);}catch(_0x493329){return BPromise['reject'](_0x493329);}return _0x535cb9[_0xc464('0x28')]();};}function saveUpdates(_0x5b3c16,_0x495dba){return function(_0x1e3dce){if(_0x1e3dce){return _0x1e3dce['update'](_0x5b3c16)[_0xc464('0x29')](function(_0x211617){return _0x211617;});}return null;};}function removeEntity(_0x5073b9,_0x3bbde9){return function(_0x443846){if(_0x443846){return _0x443846[_0xc464('0x2a')]()['then'](function(){var _0x2f8a7a=_0x443846[_0xc464('0x2b')]({'plain':!![]});var _0x2ecd9e=_0xc464('0x2c');return db['UserProfileResource'][_0xc464('0x2a')]({'where':{'type':_0x2ecd9e,'resourceId':_0x2f8a7a['id']}})[_0xc464('0x29')](function(){return _0x443846;});})[_0xc464('0x29')](function(){_0x5073b9[_0xc464('0x24')](0xcc)[_0xc464('0x1f')]();});}};}function handleEntityNotFound(_0x4f762a,_0x23860d){return function(_0x437bd3){if(!_0x437bd3){_0x4f762a[_0xc464('0x1e')](0x194);}return _0x437bd3;};}function handleError(_0x523db0,_0x5de81d){_0x5de81d=_0x5de81d||0x1f4;return function(_0x40933b){logger['error'](_0x40933b[_0xc464('0x2d')]);if(_0x40933b[_0xc464('0x2e')]){delete _0x40933b[_0xc464('0x2e')];}_0x523db0['status'](_0x5de81d)[_0xc464('0x2f')](_0x40933b);};}exports[_0xc464('0x30')]=function(_0x18661a,_0x31b0d8){var _0x4adf48={},_0xe06b4c={},_0x488536={'count':0x0,'rows':[]};var _0x3ee4a2=_[_0xc464('0x31')](db['FaxQueue']['rawAttributes'],function(_0x265239){return{'name':_0x265239[_0xc464('0x32')],'type':_0x265239[_0xc464('0x33')][_0xc464('0x34')]};});_0xe06b4c[_0xc464('0x35')]=_['map'](_0x3ee4a2,'name');_0xe06b4c[_0xc464('0x36')]=_[_0xc464('0x37')](_0x18661a[_0xc464('0x36')]);_0xe06b4c[_0xc464('0x38')]=_['intersection'](_0xe06b4c['model'],_0xe06b4c[_0xc464('0x36')]);_0x4adf48[_0xc464('0x39')]=_[_0xc464('0x3a')](_0xe06b4c['model'],qs[_0xc464('0x3b')](_0x18661a[_0xc464('0x36')][_0xc464('0x3b')]));_0x4adf48[_0xc464('0x39')]=_0x4adf48[_0xc464('0x39')][_0xc464('0x3c')]?_0x4adf48['attributes']:_0xe06b4c[_0xc464('0x35')];if(!_0x18661a[_0xc464('0x36')]['hasOwnProperty']('nolimit')){_0x4adf48[_0xc464('0x21')]=qs['limit'](_0x18661a['query']['limit']);_0x4adf48[_0xc464('0x23')]=qs[_0xc464('0x23')](_0x18661a[_0xc464('0x36')]['offset']);}_0x4adf48['order']=qs[_0xc464('0x3d')](_0x18661a[_0xc464('0x36')][_0xc464('0x3d')]);_0x4adf48[_0xc464('0x3e')]=qs[_0xc464('0x38')](_[_0xc464('0x3f')](_0x18661a[_0xc464('0x36')],_0xe06b4c[_0xc464('0x38')]),_0x3ee4a2);if(_0x18661a[_0xc464('0x36')][_0xc464('0x40')]){_0x4adf48[_0xc464('0x3e')]=_['merge'](_0x4adf48[_0xc464('0x3e')],{'$or':_[_0xc464('0x31')](_0x3ee4a2,function(_0x58a343){if(_0x58a343[_0xc464('0x33')]!=='VIRTUAL'){var _0x201f88={};_0x201f88[_0x58a343['name']]={'$like':'%'+_0x18661a[_0xc464('0x36')]['filter']+'%'};return _0x201f88;}})});}_0x4adf48=_[_0xc464('0x41')]({},_0x4adf48,_0x18661a['options']);var _0x5c3394={'where':_0x4adf48['where']};return db['FaxQueue'][_0xc464('0x22')](_0x5c3394)[_0xc464('0x29')](function(_0x3359e6){_0x488536[_0xc464('0x22')]=_0x3359e6;if(_0x18661a[_0xc464('0x36')][_0xc464('0x42')]){_0x4adf48[_0xc464('0x43')]=[{'all':!![]}];}return db[_0xc464('0x44')]['findAll'](_0x4adf48);})[_0xc464('0x29')](function(_0x18719a){_0x488536[_0xc464('0x45')]=_0x18719a;return _0x488536;})[_0xc464('0x29')](respondWithFilteredResult(_0x31b0d8,_0x4adf48))['catch'](handleError(_0x31b0d8,null));};exports[_0xc464('0x46')]=function(_0x174f70,_0x8ec0c1){var _0x1a97b7={'raw':!![],'where':{'id':_0x174f70[_0xc464('0x47')]['id']}},_0x4ab86c={};_0x4ab86c[_0xc464('0x35')]=_['keys'](db[_0xc464('0x44')][_0xc464('0x48')]);_0x4ab86c[_0xc464('0x36')]=_[_0xc464('0x37')](_0x174f70[_0xc464('0x36')]);_0x4ab86c['filters']=_['intersection'](_0x4ab86c[_0xc464('0x35')],_0x4ab86c[_0xc464('0x36')]);_0x1a97b7[_0xc464('0x39')]=_['intersection'](_0x4ab86c[_0xc464('0x35')],qs['fields'](_0x174f70['query'][_0xc464('0x3b')]));_0x1a97b7[_0xc464('0x39')]=_0x1a97b7['attributes'][_0xc464('0x3c')]?_0x1a97b7['attributes']:_0x4ab86c[_0xc464('0x35')];if(_0x174f70[_0xc464('0x36')][_0xc464('0x42')]){_0x1a97b7[_0xc464('0x43')]=[{'all':!![]}];}_0x1a97b7=_[_0xc464('0x41')]({},_0x1a97b7,_0x174f70['options']);return db[_0xc464('0x44')][_0xc464('0x49')](_0x1a97b7)[_0xc464('0x29')](handleEntityNotFound(_0x8ec0c1,null))[_0xc464('0x29')](respondWithResult(_0x8ec0c1,null))['catch'](handleError(_0x8ec0c1,null));};exports[_0xc464('0x4a')]=function(_0x309d03,_0x43335b){return db['FaxQueue'][_0xc464('0x4a')](_0x309d03[_0xc464('0x4b')],{})[_0xc464('0x29')](function(_0x36bc64){var _0x1db4bd=_0x309d03['user'][_0xc464('0x2b')]({'plain':!![]});if(!_0x1db4bd)throw new Error(_0xc464('0x4c'));if(_0x1db4bd[_0xc464('0x4d')]==='user'){var _0x2fbf15=_0x36bc64['get']({'plain':!![]});var _0x5cafad=_0xc464('0x2c');return db[_0xc464('0x4e')][_0xc464('0x49')]({'where':{'name':_0x5cafad,'userProfileId':_0x1db4bd[_0xc464('0x4f')]},'raw':!![]})[_0xc464('0x29')](function(_0x400241){if(_0x400241&&_0x400241['autoAssociation']===0x0){return db['UserProfileResource'][_0xc464('0x4a')]({'name':_0x2fbf15[_0xc464('0x2e')],'resourceId':_0x2fbf15['id'],'type':_0x400241[_0xc464('0x2e')],'sectionId':_0x400241['id']},{})['then'](function(){return _0x36bc64;});}else{return _0x36bc64;}})[_0xc464('0x50')](function(_0x29084f){logger['error'](_0xc464('0x51'),_0x29084f);throw _0x29084f;});}return _0x36bc64;})[_0xc464('0x29')](respondWithResult(_0x43335b,0xc9))[_0xc464('0x50')](handleError(_0x43335b,null));};exports[_0xc464('0x52')]=function(_0x2ed4c3,_0x5d26d0){if(_0x2ed4c3[_0xc464('0x4b')]['id']){delete _0x2ed4c3['body']['id'];}return db['FaxQueue'][_0xc464('0x49')]({'where':{'id':_0x2ed4c3[_0xc464('0x47')]['id']}})['then'](handleEntityNotFound(_0x5d26d0,null))[_0xc464('0x29')](saveUpdates(_0x2ed4c3[_0xc464('0x4b')],null))[_0xc464('0x29')](respondWithResult(_0x5d26d0,null))['catch'](handleError(_0x5d26d0,null));};exports[_0xc464('0x2a')]=function(_0x4165ef,_0x4b5e19){return db[_0xc464('0x44')]['find']({'where':{'id':_0x4165ef[_0xc464('0x47')]['id']}})[_0xc464('0x29')](handleEntityNotFound(_0x4b5e19,null))[_0xc464('0x29')](removeEntity(_0x4b5e19,null))[_0xc464('0x50')](handleError(_0x4b5e19,null));};exports[_0xc464('0x53')]=function(_0x542d59,_0x171419){return db[_0xc464('0x44')][_0xc464('0x53')]()[_0xc464('0x29')](respondWithResult(_0x171419,null))[_0xc464('0x50')](handleError(_0x171419,null));};exports[_0xc464('0x54')]=function(_0x3444fa,_0x3f6841,_0x27dc69){var _0x1eff8a={'raw':!![],'where':{}},_0x565ede={},_0x578df9;return db[_0xc464('0x44')][_0xc464('0x55')]({'where':{'id':_0x3444fa[_0xc464('0x47')]['id']}})['then'](handleEntityNotFound(_0x3f6841,null))[_0xc464('0x29')](function(_0x552493){if(_0x552493){_0x578df9=_0x552493[_0xc464('0x2b')]({'plain':!![]});_0x565ede['model']=_['keys'](db[_0xc464('0x56')][_0xc464('0x48')]);_0x565ede[_0xc464('0x36')]=_[_0xc464('0x37')](_0x3444fa[_0xc464('0x36')]);_0x565ede[_0xc464('0x38')]=_[_0xc464('0x3a')](_0x565ede[_0xc464('0x35')],_0x565ede[_0xc464('0x36')]);_0x1eff8a['attributes']=_[_0xc464('0x3a')](_0x565ede[_0xc464('0x35')],qs[_0xc464('0x3b')](_0x3444fa['query'][_0xc464('0x3b')]));_0x1eff8a['attributes']=_0x1eff8a[_0xc464('0x39')][_0xc464('0x3c')]?_0x1eff8a[_0xc464('0x39')]:_0x565ede[_0xc464('0x35')];if(!_0x3444fa['query']['hasOwnProperty'](_0xc464('0x57'))){_0x1eff8a[_0xc464('0x21')]=qs[_0xc464('0x21')](_0x3444fa[_0xc464('0x36')][_0xc464('0x21')]);_0x1eff8a[_0xc464('0x23')]=qs[_0xc464('0x23')](_0x3444fa['query'][_0xc464('0x23')]);}_0x1eff8a['order']=qs[_0xc464('0x3d')](_0x3444fa['query'][_0xc464('0x3d')]);_0x1eff8a[_0xc464('0x3e')]=qs[_0xc464('0x38')](_[_0xc464('0x3f')](_0x3444fa[_0xc464('0x36')],_0x565ede[_0xc464('0x38')]));_0x1eff8a[_0xc464('0x3e')][_0xc464('0x58')]=_0x552493['id'];if(_0x3444fa[_0xc464('0x36')][_0xc464('0x40')]){_0x1eff8a['where']=_[_0xc464('0x41')](_0x1eff8a['where'],{'$or':_[_0xc464('0x31')](_0x1eff8a[_0xc464('0x39')],function(_0x458640){var _0x35e79d={};_0x35e79d[_0x458640]={'$like':'%'+_0x3444fa[_0xc464('0x36')][_0xc464('0x40')]+'%'};return _0x35e79d;})});}_0x1eff8a=_[_0xc464('0x41')]({},_0x1eff8a,_0x3444fa[_0xc464('0x59')]);return db[_0xc464('0x56')][_0xc464('0x5a')](_0x1eff8a);}})[_0xc464('0x29')](function(_0x3cfed0){if(_0x3cfed0){return db[_0xc464('0x5b')][_0xc464('0x5c')]({'where':{'id':_[_0xc464('0x31')](_0x3cfed0,'UserId'),'role':'agent'},'attributes':['id','name',_0xc464('0x5d'),'updatedAt',_0xc464('0x5e')]});}})[_0xc464('0x29')](function(_0x3ab5f8){if(_0x3ab5f8){return{'count':_0x3ab5f8['count'],'rows':_[_0xc464('0x31')](_0x3ab5f8[_0xc464('0x45')],function(_0x3e1cfb){return{'membername':_0x3e1cfb[_0xc464('0x2e')],'UserId':_0x3e1cfb['id'],'queue_name':_0x578df9[_0xc464('0x2e')],'FaxQueueId':_0x578df9['id'],'interface':util[_0xc464('0x5f')](_0xc464('0x60'),_0xc464('0x61'),_0x3e1cfb[_0xc464('0x2e')]),'penalty':0x0,'paused':_0x3e1cfb[_0xc464('0x5d')],'createdAt':_0x3e1cfb[_0xc464('0x5e')],'updatedAt':_0x3e1cfb[_0xc464('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc464('0x29')](respondWithFilteredResult(_0x3f6841,_0x1eff8a))['catch'](handleError(_0x3f6841,null));};exports[_0xc464('0x63')]=function(_0x1cf004,_0x4f512a,_0x486219){var _0x1bf1af={};var _0x37fdfb={};var _0x556b0e;var _0x47921f;return db[_0xc464('0x44')][_0xc464('0x55')]({'where':{'id':_0x1cf004[_0xc464('0x47')]['id']}})[_0xc464('0x29')](handleEntityNotFound(_0x4f512a,null))['then'](function(_0x126121){if(_0x126121){_0x556b0e=_0x126121;_0x37fdfb[_0xc464('0x35')]=_['keys'](db[_0xc464('0x64')]['rawAttributes']);_0x37fdfb[_0xc464('0x36')]=_[_0xc464('0x37')](_0x1cf004[_0xc464('0x36')]);_0x37fdfb[_0xc464('0x38')]=_['intersection'](_0x37fdfb[_0xc464('0x35')],_0x37fdfb[_0xc464('0x36')]);_0x1bf1af[_0xc464('0x39')]=_[_0xc464('0x3a')](_0x37fdfb[_0xc464('0x35')],qs[_0xc464('0x3b')](_0x1cf004[_0xc464('0x36')][_0xc464('0x3b')]));_0x1bf1af['attributes']=_0x1bf1af[_0xc464('0x39')][_0xc464('0x3c')]?_0x1bf1af[_0xc464('0x39')]:_0x37fdfb[_0xc464('0x35')];_0x1bf1af[_0xc464('0x65')]=qs[_0xc464('0x3d')](_0x1cf004[_0xc464('0x36')]['sort']);_0x1bf1af['where']=qs[_0xc464('0x38')](_[_0xc464('0x3f')](_0x1cf004['query'],_0x37fdfb[_0xc464('0x38')]));if(_0x1cf004['query'][_0xc464('0x40')]){_0x1bf1af[_0xc464('0x3e')]=_['merge'](_0x1bf1af[_0xc464('0x3e')],{'$or':_['map'](_0x1bf1af[_0xc464('0x39')],function(_0x5cd922){var _0x1f0d8e={};_0x1f0d8e[_0x5cd922]={'$like':'%'+_0x1cf004['query'][_0xc464('0x40')]+'%'};return _0x1f0d8e;})});}_0x1bf1af=_['merge']({},_0x1bf1af,_0x1cf004[_0xc464('0x59')]);return _0x556b0e['getTeams'](_0x1bf1af);}})[_0xc464('0x29')](function(_0xd69653){if(_0xd69653){_0x47921f=_0xd69653[_0xc464('0x3c')];if(!_0x1cf004[_0xc464('0x36')][_0xc464('0x66')](_0xc464('0x57'))){_0x1bf1af[_0xc464('0x21')]=qs[_0xc464('0x21')](_0x1cf004[_0xc464('0x36')][_0xc464('0x21')]);_0x1bf1af[_0xc464('0x23')]=qs[_0xc464('0x23')](_0x1cf004[_0xc464('0x36')][_0xc464('0x23')]);}return _0x556b0e[_0xc464('0x63')](_0x1bf1af);}})['then'](function(_0x48e9f1){if(_0x48e9f1){return _0x48e9f1?{'count':_0x47921f,'rows':_0x48e9f1}:null;}})[_0xc464('0x29')](respondWithResult(_0x4f512a,null))['catch'](handleError(_0x4f512a,null));};exports[_0xc464('0x67')]=function(_0x1aa1ec,_0xfdc54b,_0x4a8c82){var _0x1a4bed=_0x1aa1ec[_0xc464('0x4b')]['ids'];return db[_0xc464('0x64')][_0xc464('0x5a')]({'where':{'id':_0x1a4bed},'attributes':['id'],'include':[{'model':db[_0xc464('0x5b')],'as':_0xc464('0x68'),'attributes':['id',_0xc464('0x2e'),_0xc464('0x69'),_0xc464('0x6a'),_0xc464('0x6b')],'raw':!![]}]})[_0xc464('0x29')](function(_0x5c006e){if(_0x5c006e){var _0x13da72=_[_0xc464('0x6c')](_0x5c006e,function(_0x47d05b){var _0x5cbee4=_0x47d05b['get']({'plain':!![]});return _0x5cbee4[_0xc464('0x68')];});return db[_0xc464('0x44')]['find']({'where':{'id':_0x1aa1ec[_0xc464('0x47')]['id']}})['then'](function(_0x286990){return db['sequelize'][_0xc464('0x6d')](function(_0x1b27d8){return _0x286990[_0xc464('0x67')](_0x1a4bed,{'transaction':_0x1b27d8})[_0xc464('0x29')](function(){return BPromise['each'](_0x13da72,function(_0x3822cd){return db[_0xc464('0x56')][_0xc464('0x6e')]({'where':{'UserId':_0x3822cd['id'],'FaxQueueId':_0x1aa1ec[_0xc464('0x47')]['id']},'transaction':_0x1b27d8});});})['then'](function(){_0x13da72[_0xc464('0x6f')](function(_0x28c600){socket[_0xc464('0x70')](_0xc464('0x71'),{'UserId':_0x28c600['id'],'FaxQueueId':_0x286990['id']});});});});});}})[_0xc464('0x29')](respondWithStatusCode(_0xfdc54b,null))[_0xc464('0x50')](handleError(_0xfdc54b,null));};exports[_0xc464('0x72')]=function(_0x14a86d,_0x48cd12,_0x4223ea){return db[_0xc464('0x64')][_0xc464('0x5a')]({'where':{'id':_0x14a86d['query'][_0xc464('0x73')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc464('0x68'),'attributes':['id'],'raw':!![]}]})[_0xc464('0x29')](handleEntityNotFound(_0x48cd12,null))[_0xc464('0x29')](function(_0x3df70b){var _0x5d0eeb=_[_0xc464('0x31')](_0x3df70b,'id');var _0x458abc=[];var _0x34b471=[];var _0x5bf331=squel[_0xc464('0x74')]();_0x5bf331[_0xc464('0x75')]('tq.TeamId')[_0xc464('0x76')](_0xc464('0x77'),'tq')['join'](_0xc464('0x78'),'ut',_0xc464('0x79'))[_0xc464('0x3e')](_0xc464('0x7a'),_0x14a86d[_0xc464('0x47')]['id']);for(var _0x3840d4=0x0;_0x3840d4<_0x3df70b[_0xc464('0x3c')];_0x3840d4+=0x1){let _0xf8fb1b=_0x3df70b[_0x3840d4];for(var _0xa8679=0x0;_0xa8679<_0xf8fb1b[_0xc464('0x68')][_0xc464('0x3c')];_0xa8679+=0x1){let _0x557877=_0xf8fb1b['Agents'][_0xa8679];var _0x128c31=_0x5bf331[_0xc464('0x7b')]();_0x128c31['where'](_0xc464('0x7c'),_0x557877['id']);_0x34b471['push'](db[_0xc464('0x7d')][_0xc464('0x36')](_0x128c31[_0xc464('0x7e')](),{'type':db[_0xc464('0x7d')][_0xc464('0x7f')][_0xc464('0x80')]})['then'](function(_0x5c6807){if(_0x5c6807[_0xc464('0x3c')]===0x1){return _0x557877['id'];}else{var _0x24158b=_[_0xc464('0x81')](_['map'](_0x5c6807,_0xc464('0x82')),function(_0x58bb8f){return _[_0xc464('0x83')](_0x5d0eeb,_0x58bb8f);});if(_0x24158b){return _0x557877['id'];}}}));}}return BPromise[_0xc464('0x84')](_0x34b471)[_0xc464('0x29')](function(_0x27e2a7){_0x458abc=_(_0x458abc)[_0xc464('0x85')](_0x27e2a7)['compact']()[_0xc464('0x86')]();return db['FaxQueue'][_0xc464('0x49')]({'where':{'id':_0x14a86d[_0xc464('0x47')]['id']}})[_0xc464('0x29')](function(_0x191aa8){return db[_0xc464('0x7d')][_0xc464('0x6d')](function(_0x38b008){return _0x191aa8['removeTeams'](_0x14a86d[_0xc464('0x36')]['ids'],{'transaction':_0x38b008})['then'](function(){if(!_[_0xc464('0x87')](_0x458abc)){return _0x191aa8[_0xc464('0x88')](_0x458abc,{'transaction':_0x38b008});}})[_0xc464('0x29')](function(){_0x458abc[_0xc464('0x6f')](function(_0x29e380){socket[_0xc464('0x70')]('userFaxQueue:remove',{'UserId':_0x29e380,'FaxQueueId':_0x191aa8['id']});});});});});});})[_0xc464('0x29')](respondWithStatusCode(_0x48cd12,null))[_0xc464('0x50')](handleError(_0x48cd12,null));};exports[_0xc464('0x89')]=function(_0x18b411,_0x4df0b8,_0x4e9923){return db[_0xc464('0x44')]['find']({'where':{'id':_0x18b411[_0xc464('0x47')]['id']}})[_0xc464('0x29')](handleEntityNotFound(_0x4df0b8,null))[_0xc464('0x29')](function(_0x1201f1){if(_0x1201f1){return _0x1201f1[_0xc464('0x89')](_0x18b411[_0xc464('0x4b')][_0xc464('0x73')],_[_0xc464('0x8a')](_0x18b411['body'],[_0xc464('0x73'),'id'])||{})[_0xc464('0x8b')](function(_0x4e54a8){for(var _0x4badc8=0x0;_0x4badc8<_0x18b411['body'][_0xc464('0x73')][_0xc464('0x3c')];_0x4badc8+=0x1){socket[_0xc464('0x70')](_0xc464('0x71'),{'UserId':Number(_0x18b411['body']['ids'][_0x4badc8]),'FaxQueueId':Number(_0x18b411[_0xc464('0x47')]['id'])});}return _0x4e54a8;});}})['then'](respondWithResult(_0x4df0b8,null))['catch'](handleError(_0x4df0b8,null));};exports[_0xc464('0x88')]=function(_0x53587e,_0x54fa2e,_0x398b39){return db[_0xc464('0x44')][_0xc464('0x49')]({'where':{'id':_0x53587e['params']['id']}})['then'](handleEntityNotFound(_0x54fa2e,null))['then'](function(_0x67165a){if(_0x67165a){return _0x67165a['removeAgents'](_0x53587e[_0xc464('0x36')]['ids'])[_0xc464('0x29')](function(){if(_['isArray'](_0x53587e[_0xc464('0x36')][_0xc464('0x73')])){for(var _0x206c0f=0x0;_0x206c0f<_0x53587e[_0xc464('0x36')]['ids'][_0xc464('0x3c')];_0x206c0f+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x53587e[_0xc464('0x36')][_0xc464('0x73')][_0x206c0f]),'FaxQueueId':Number(_0x53587e[_0xc464('0x47')]['id'])});}}else{socket[_0xc464('0x70')]('userFaxQueue:remove',{'UserId':Number(_0x53587e[_0xc464('0x36')]['ids']),'FaxQueueId':Number(_0x53587e[_0xc464('0x47')]['id'])});}});}})[_0xc464('0x29')](respondWithStatusCode(_0x54fa2e,null))[_0xc464('0x50')](handleError(_0x54fa2e,null));};exports[_0xc464('0x8c')]=function(_0x4f120f,_0x53b7f7,_0x53a7d7){var _0x588c54={};var _0x4d325e={};var _0x377a8c;var _0x263c9e;return db[_0xc464('0x44')]['findOne']({'where':{'id':_0x4f120f[_0xc464('0x47')]['id']}})[_0xc464('0x29')](handleEntityNotFound(_0x53b7f7,null))[_0xc464('0x29')](function(_0x53eb63){if(_0x53eb63){_0x377a8c=_0x53eb63;_0x4d325e['model']=_[_0xc464('0x37')](db[_0xc464('0x5b')][_0xc464('0x48')]);_0x4d325e[_0xc464('0x36')]=_[_0xc464('0x37')](_0x4f120f[_0xc464('0x36')]);_0x4d325e[_0xc464('0x38')]=_[_0xc464('0x3a')](_0x4d325e['model'],_0x4d325e[_0xc464('0x36')]);_0x588c54[_0xc464('0x39')]=_[_0xc464('0x3a')](_0x4d325e[_0xc464('0x35')],qs[_0xc464('0x3b')](_0x4f120f[_0xc464('0x36')]['fields']));_0x588c54['attributes']=_0x588c54[_0xc464('0x39')]['length']?_0x588c54['attributes']:_0x4d325e[_0xc464('0x35')];_0x588c54[_0xc464('0x65')]=qs[_0xc464('0x3d')](_0x4f120f[_0xc464('0x36')]['sort']);_0x588c54[_0xc464('0x3e')]=qs[_0xc464('0x38')](_[_0xc464('0x3f')](_0x4f120f[_0xc464('0x36')],_0x4d325e[_0xc464('0x38')]));if(_0x4f120f['query']['filter']){_0x588c54[_0xc464('0x3e')]=_[_0xc464('0x41')](_0x588c54[_0xc464('0x3e')],{'$or':_[_0xc464('0x31')](_0x588c54[_0xc464('0x39')],function(_0x1e5b0c){var _0x13cd86={};_0x13cd86[_0x1e5b0c]={'$like':'%'+_0x4f120f[_0xc464('0x36')][_0xc464('0x40')]+'%'};return _0x13cd86;})});}_0x588c54=_[_0xc464('0x41')]({},_0x588c54,_0x4f120f[_0xc464('0x59')]);return _0x377a8c[_0xc464('0x8c')](_0x588c54);}})['then'](function(_0x118bc2){if(_0x118bc2){_0x263c9e=_0x118bc2[_0xc464('0x3c')];if(!_0x4f120f[_0xc464('0x36')][_0xc464('0x66')](_0xc464('0x57'))){_0x588c54[_0xc464('0x21')]=qs['limit'](_0x4f120f[_0xc464('0x36')][_0xc464('0x21')]);_0x588c54[_0xc464('0x23')]=qs[_0xc464('0x23')](_0x4f120f[_0xc464('0x36')][_0xc464('0x23')]);}return _0x377a8c['getAgents'](_0x588c54);}})[_0xc464('0x29')](function(_0x177a9e){if(_0x177a9e){return _0x177a9e?{'count':_0x263c9e,'rows':_0x177a9e}:null;}})[_0xc464('0x29')](respondWithResult(_0x53b7f7,null))[_0xc464('0x50')](handleError(_0x53b7f7,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 97ca629..e6b66ce 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 _0xd938=['events','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','exports'];(function(_0x10dbf6,_0x3ff964){var _0x452147=function(_0x7476e0){while(--_0x7476e0){_0x10dbf6['push'](_0x10dbf6['shift']());}};_0x452147(++_0x3ff964);}(_0xd938,0x117));var _0x8d93=function(_0x1101ab,_0x302999){_0x1101ab=_0x1101ab-0x0;var _0x5ef242=_0xd938[_0x1101ab];return _0x5ef242;};'use strict';var EventEmitter=require(_0x8d93('0x0'));var FaxQueue=require(_0x8d93('0x1'))['db'][_0x8d93('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x8d93('0x3')](0x0);var events={'afterCreate':_0x8d93('0x4'),'afterUpdate':_0x8d93('0x5'),'afterDestroy':_0x8d93('0x6')};function emitEvent(_0x2c1075){return function(_0x550682,_0x2fc394,_0xdaec17){FaxQueueEvents[_0x8d93('0x7')](_0x2c1075+':'+_0x550682['id'],_0x550682);FaxQueueEvents[_0x8d93('0x7')](_0x2c1075,_0x550682);_0xdaec17(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x8d93('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0xb8e8=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xb8e8,0x1aa));var _0x8b8e=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xb8e8[_0x432682];return _0x463d05;};'use strict';var EventEmitter=require(_0x8b8e('0x0'));var FaxQueue=require(_0x8b8e('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x8b8e('0x2')](0x0);var events={'afterCreate':_0x8b8e('0x3'),'afterUpdate':_0x8b8e('0x4'),'afterDestroy':_0x8b8e('0x5')};function emitEvent(_0x19d570){return function(_0x317232,_0x453512,_0x559e3a){FaxQueueEvents['emit'](_0x19d570+':'+_0x317232['id'],_0x317232);FaxQueueEvents['emit'](_0x19d570,_0x317232);_0x559e3a(null);};}for(var e in events){if(events[_0x8b8e('0x6')](e)){var event=events[e];FaxQueue[_0x8b8e('0x7')](e,emitEvent(event));}}module[_0x8b8e('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 5510b86..a024b20 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 _0x3591=['fax_queues','util','api','moment','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','define','FaxQueue'];(function(_0x457b64,_0x49a219){var _0x437111=function(_0x3dad3d){while(--_0x3dad3d){_0x457b64['push'](_0x457b64['shift']());}};_0x437111(++_0x49a219);}(_0x3591,0x7a));var _0x1359=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x3591[_0x55abd9];return _0x3e5669;};'use strict';var _=require('lodash');var util=require(_0x1359('0x0'));var logger=require('../../config/logger')(_0x1359('0x1'));var moment=require(_0x1359('0x2'));var BPromise=require('bluebird');var rp=require(_0x1359('0x3'));var fs=require('fs');var path=require(_0x1359('0x4'));var rimraf=require(_0x1359('0x5'));var config=require(_0x1359('0x6'));var attributes=require(_0x1359('0x7'));module['exports']=function(_0x198a45,_0xb325b7){return _0x198a45[_0x1359('0x8')](_0x1359('0x9'),attributes,{'tableName':_0x1359('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11b6=['FaxQueue','lodash','util','api','moment','request-promise','path','../../config/environment','./faxQueue.attributes','exports','define'];(function(_0x214c07,_0x30b467){var _0x1109bd=function(_0x39d7ad){while(--_0x39d7ad){_0x214c07['push'](_0x214c07['shift']());}};_0x1109bd(++_0x30b467);}(_0x11b6,0x1c4));var _0x611b=function(_0x17869b,_0x290603){_0x17869b=_0x17869b-0x0;var _0x4db341=_0x11b6[_0x17869b];return _0x4db341;};'use strict';var _=require(_0x611b('0x0'));var util=require(_0x611b('0x1'));var logger=require('../../config/logger')(_0x611b('0x2'));var moment=require(_0x611b('0x3'));var BPromise=require('bluebird');var rp=require(_0x611b('0x4'));var fs=require('fs');var path=require(_0x611b('0x5'));var rimraf=require('rimraf');var config=require(_0x611b('0x6'));var attributes=require(_0x611b('0x7'));module[_0x611b('0x8')]=function(_0x364025,_0x12efd9){return _0x364025[_0x611b('0x9')](_0x611b('0xa'),attributes,{'tableName':'fax_queues','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 0269cd1..6e2961c 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 _0x498d=['find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','limit','include','map','model','debug','ShowFaxQueue'];(function(_0x10d618,_0x1f1c82){var _0x57d044=function(_0x52c55b){while(--_0x52c55b){_0x10d618['push'](_0x10d618['shift']());}};_0x57d044(++_0x1f1c82);}(_0x498d,0x1cf));var _0xd498=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x498d[_0x166742];return _0xb7814a;};'use strict';var _=require('lodash');var util=require(_0xd498('0x0'));var moment=require('moment');var BPromise=require(_0xd498('0x1'));var rs=require(_0xd498('0x2'));var fs=require('fs');var Redis=require(_0xd498('0x3'));var db=require(_0xd498('0x4'))['db'];var utils=require(_0xd498('0x5'));var logger=require(_0xd498('0x6'))(_0xd498('0x7'));var config=require(_0xd498('0x8'));var jayson=require(_0xd498('0x9'));var client=jayson[_0xd498('0xa')][_0xd498('0xb')]({'port':0x232a});config[_0xd498('0xc')]=_[_0xd498('0xd')](config[_0xd498('0xc')],{'host':_0xd498('0xe'),'port':0x18eb});var socket=require(_0xd498('0xf'))(new Redis(config[_0xd498('0xc')]));require(_0xd498('0x10'))[_0xd498('0x11')](socket);function respondWithRpcPromise(_0x2baede,_0x23dbdf,_0x42118f){return new BPromise(function(_0x2ec471,_0x1dd2b2){return client[_0xd498('0x12')](_0x2baede,_0x42118f)[_0xd498('0x13')](function(_0x37f67c){logger[_0xd498('0x14')](_0xd498('0x15'),_0x23dbdf,'request\x20sent');logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x23dbdf,'request\x20sent',JSON[_0xd498('0x16')](_0x37f67c));if(_0x37f67c['error']){if(_0x37f67c[_0xd498('0x17')][_0xd498('0x18')]===0x1f4){logger[_0xd498('0x17')](_0xd498('0x15'),_0x23dbdf,_0x37f67c[_0xd498('0x17')][_0xd498('0x19')]);return _0x1dd2b2(_0x37f67c[_0xd498('0x17')][_0xd498('0x19')]);}logger[_0xd498('0x17')]('FaxQueue,\x20%s,\x20%s',_0x23dbdf,_0x37f67c[_0xd498('0x17')][_0xd498('0x19')]);return _0x2ec471(_0x37f67c['error']['message']);}else{logger[_0xd498('0x14')]('FaxQueue,\x20%s,\x20%s',_0x23dbdf,_0xd498('0x1a'));_0x2ec471(_0x37f67c[_0xd498('0x1b')][_0xd498('0x19')]);}})[_0xd498('0x1c')](function(_0x31e816){logger[_0xd498('0x17')](_0xd498('0x15'),_0x23dbdf,_0x31e816);_0x1dd2b2(_0x31e816);});});}exports[_0xd498('0x1d')]=function(_0x2a67f2){var _0x81ca6c=this;return new Promise(function(_0x378656,_0xdd6e96){return db[_0xd498('0x1e')]['findAll']({'raw':_0x2a67f2[_0xd498('0x1f')]?_0x2a67f2[_0xd498('0x1f')][_0xd498('0x20')]===undefined?!![]:![]:!![],'where':_0x2a67f2[_0xd498('0x1f')]?_0x2a67f2[_0xd498('0x1f')][_0xd498('0x21')]||null:null,'attributes':_0x2a67f2[_0xd498('0x1f')]?_0x2a67f2[_0xd498('0x1f')][_0xd498('0x22')]||null:null,'limit':_0x2a67f2['options']?_0x2a67f2['options'][_0xd498('0x23')]||null:null,'include':_0x2a67f2['options']?_0x2a67f2['options'][_0xd498('0x24')]?_[_0xd498('0x25')](_0x2a67f2[_0xd498('0x1f')][_0xd498('0x24')],function(_0x68fc9a){return{'model':db[_0x68fc9a[_0xd498('0x26')]],'as':_0x68fc9a['as'],'attributes':_0x68fc9a['attributes'],'include':_0x68fc9a[_0xd498('0x24')]?_['map'](_0x68fc9a[_0xd498('0x24')],function(_0x17df81){return{'model':db[_0x17df81[_0xd498('0x26')]],'as':_0x17df81['as'],'attributes':_0x17df81['attributes'],'include':_0x17df81['include']?_[_0xd498('0x25')](_0x17df81['include'],function(_0x43c00f){return{'model':db[_0x43c00f[_0xd498('0x26')]],'as':_0x43c00f['as'],'attributes':_0x43c00f[_0xd498('0x22')]};}):[]};}):[]};}):[]:[]})[_0xd498('0x13')](function(_0x4ff8fe){logger[_0xd498('0x14')](_0xd498('0x1d'),_0x2a67f2);logger[_0xd498('0x27')]('GetFaxQueue',_0x2a67f2,JSON['stringify'](_0x4ff8fe));_0x378656(_0x4ff8fe);})[_0xd498('0x1c')](function(_0x5256a5){logger['error'](_0xd498('0x1d'),_0x5256a5['message'],_0x2a67f2);_0xdd6e96(_0x81ca6c[_0xd498('0x17')](0x1f4,_0x5256a5['message']));});});};exports[_0xd498('0x28')]=function(_0xe1a46f){var _0x26ed27=this;return new Promise(function(_0x54d889,_0x37eab1){return db[_0xd498('0x1e')][_0xd498('0x29')]({'raw':_0xe1a46f[_0xd498('0x1f')]?_0xe1a46f['options'][_0xd498('0x20')]===undefined?!![]:![]:!![],'where':_0xe1a46f[_0xd498('0x1f')]?_0xe1a46f[_0xd498('0x1f')]['where']||null:null,'attributes':_0xe1a46f[_0xd498('0x1f')]?_0xe1a46f[_0xd498('0x1f')][_0xd498('0x22')]||null:null,'include':_0xe1a46f['options']?_0xe1a46f['options']['include']?_['map'](_0xe1a46f[_0xd498('0x1f')]['include'],function(_0xd0557b){return{'model':db[_0xd0557b[_0xd498('0x26')]],'as':_0xd0557b['as'],'attributes':_0xd0557b[_0xd498('0x22')],'include':_0xd0557b[_0xd498('0x24')]?_[_0xd498('0x25')](_0xd0557b['include'],function(_0x5dfa37){return{'model':db[_0x5dfa37[_0xd498('0x26')]],'as':_0x5dfa37['as'],'attributes':_0x5dfa37[_0xd498('0x22')],'include':_0x5dfa37[_0xd498('0x24')]?_['map'](_0x5dfa37[_0xd498('0x24')],function(_0x4dbb1d){return{'model':db[_0x4dbb1d['model']],'as':_0x4dbb1d['as'],'attributes':_0x4dbb1d['attributes']};}):[]};}):[]};}):[]:[]})[_0xd498('0x13')](function(_0x265571){logger[_0xd498('0x14')](_0xd498('0x28'),_0xe1a46f);logger[_0xd498('0x27')](_0xd498('0x28'),_0xe1a46f,JSON[_0xd498('0x16')](_0x265571));_0x54d889(_0x265571);})[_0xd498('0x1c')](function(_0x4c70ff){logger[_0xd498('0x17')](_0xd498('0x28'),_0x4c70ff[_0xd498('0x19')],_0xe1a46f);_0x37eab1(_0x26ed27['error'](0x1f4,_0x4c70ff[_0xd498('0x19')]));});});}; \ No newline at end of file +var _0x3e45=['defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetFaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowFaxQueue','FaxQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x3fd50c,_0x1b41ed){var _0x4cebb2=function(_0x56a546){while(--_0x56a546){_0x3fd50c['push'](_0x3fd50c['shift']());}};_0x4cebb2(++_0x1b41ed);}(_0x3e45,0x73));var _0x53e4=function(_0x278756,_0x3ed74f){_0x278756=_0x278756-0x0;var _0x393eaf=_0x3e45[_0x278756];return _0x393eaf;};'use strict';var _=require(_0x53e4('0x0'));var util=require(_0x53e4('0x1'));var moment=require(_0x53e4('0x2'));var BPromise=require('bluebird');var rs=require(_0x53e4('0x3'));var fs=require('fs');var Redis=require(_0x53e4('0x4'));var db=require(_0x53e4('0x5'))['db'];var utils=require(_0x53e4('0x6'));var logger=require(_0x53e4('0x7'))('rpc');var config=require(_0x53e4('0x8'));var jayson=require(_0x53e4('0x9'));var client=jayson[_0x53e4('0xa')]['http']({'port':0x232a});config['redis']=_[_0x53e4('0xb')](config[_0x53e4('0xc')],{'host':_0x53e4('0xd'),'port':0x18eb});var socket=require(_0x53e4('0xe'))(new Redis(config['redis']));require(_0x53e4('0xf'))[_0x53e4('0x10')](socket);function respondWithRpcPromise(_0x580b1b,_0x429dac,_0xfb4a98){return new BPromise(function(_0x1e146a,_0x4dbe98){return client[_0x53e4('0x11')](_0x580b1b,_0xfb4a98)[_0x53e4('0x12')](function(_0x30fa02){logger[_0x53e4('0x13')](_0x53e4('0x14'),_0x429dac,'request\x20sent');logger[_0x53e4('0x15')](_0x53e4('0x16'),_0x429dac,'request\x20sent',JSON[_0x53e4('0x17')](_0x30fa02));if(_0x30fa02[_0x53e4('0x18')]){if(_0x30fa02[_0x53e4('0x18')]['code']===0x1f4){logger[_0x53e4('0x18')]('FaxQueue,\x20%s,\x20%s',_0x429dac,_0x30fa02[_0x53e4('0x18')][_0x53e4('0x19')]);return _0x4dbe98(_0x30fa02['error'][_0x53e4('0x19')]);}logger[_0x53e4('0x18')]('FaxQueue,\x20%s,\x20%s',_0x429dac,_0x30fa02[_0x53e4('0x18')]['message']);return _0x1e146a(_0x30fa02[_0x53e4('0x18')][_0x53e4('0x19')]);}else{logger[_0x53e4('0x13')](_0x53e4('0x14'),_0x429dac,_0x53e4('0x1a'));_0x1e146a(_0x30fa02[_0x53e4('0x1b')][_0x53e4('0x19')]);}})[_0x53e4('0x1c')](function(_0x3d5c96){logger['error']('FaxQueue,\x20%s,\x20%s',_0x429dac,_0x3d5c96);_0x4dbe98(_0x3d5c96);});});}exports[_0x53e4('0x1d')]=function(_0x34a157){var _0xb82445=this;return new Promise(function(_0x2b0078,_0x62285f){return db['FaxQueue'][_0x53e4('0x1e')]({'raw':_0x34a157['options']?_0x34a157[_0x53e4('0x1f')][_0x53e4('0x20')]===undefined?!![]:![]:!![],'where':_0x34a157['options']?_0x34a157[_0x53e4('0x1f')][_0x53e4('0x21')]||null:null,'attributes':_0x34a157['options']?_0x34a157[_0x53e4('0x1f')][_0x53e4('0x22')]||null:null,'limit':_0x34a157['options']?_0x34a157[_0x53e4('0x1f')][_0x53e4('0x23')]||null:null,'include':_0x34a157[_0x53e4('0x1f')]?_0x34a157[_0x53e4('0x1f')][_0x53e4('0x24')]?_[_0x53e4('0x25')](_0x34a157[_0x53e4('0x1f')]['include'],function(_0x152dc9){return{'model':db[_0x152dc9['model']],'as':_0x152dc9['as'],'attributes':_0x152dc9[_0x53e4('0x22')],'include':_0x152dc9['include']?_[_0x53e4('0x25')](_0x152dc9[_0x53e4('0x24')],function(_0x46942c){return{'model':db[_0x46942c['model']],'as':_0x46942c['as'],'attributes':_0x46942c[_0x53e4('0x22')],'include':_0x46942c[_0x53e4('0x24')]?_[_0x53e4('0x25')](_0x46942c[_0x53e4('0x24')],function(_0x44947b){return{'model':db[_0x44947b[_0x53e4('0x26')]],'as':_0x44947b['as'],'attributes':_0x44947b[_0x53e4('0x22')]};}):[]};}):[]};}):[]:[]})[_0x53e4('0x12')](function(_0x596771){logger[_0x53e4('0x13')](_0x53e4('0x1d'),_0x34a157);logger[_0x53e4('0x15')](_0x53e4('0x1d'),_0x34a157,JSON['stringify'](_0x596771));_0x2b0078(_0x596771);})[_0x53e4('0x1c')](function(_0x19ba41){logger[_0x53e4('0x18')](_0x53e4('0x1d'),_0x19ba41[_0x53e4('0x19')],_0x34a157);_0x62285f(_0xb82445[_0x53e4('0x18')](0x1f4,_0x19ba41['message']));});});};exports[_0x53e4('0x27')]=function(_0x55921d){var _0x3d6604=this;return new Promise(function(_0x37b317,_0x271b5d){return db[_0x53e4('0x28')][_0x53e4('0x29')]({'raw':_0x55921d['options']?_0x55921d[_0x53e4('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x55921d[_0x53e4('0x1f')]?_0x55921d[_0x53e4('0x1f')]['where']||null:null,'attributes':_0x55921d[_0x53e4('0x1f')]?_0x55921d[_0x53e4('0x1f')][_0x53e4('0x22')]||null:null,'include':_0x55921d[_0x53e4('0x1f')]?_0x55921d[_0x53e4('0x1f')][_0x53e4('0x24')]?_[_0x53e4('0x25')](_0x55921d['options'][_0x53e4('0x24')],function(_0x5299aa){return{'model':db[_0x5299aa['model']],'as':_0x5299aa['as'],'attributes':_0x5299aa[_0x53e4('0x22')],'include':_0x5299aa[_0x53e4('0x24')]?_[_0x53e4('0x25')](_0x5299aa[_0x53e4('0x24')],function(_0x48cea7){return{'model':db[_0x48cea7['model']],'as':_0x48cea7['as'],'attributes':_0x48cea7[_0x53e4('0x22')],'include':_0x48cea7[_0x53e4('0x24')]?_[_0x53e4('0x25')](_0x48cea7[_0x53e4('0x24')],function(_0x1883e0){return{'model':db[_0x1883e0[_0x53e4('0x26')]],'as':_0x1883e0['as'],'attributes':_0x1883e0[_0x53e4('0x22')]};}):[]};}):[]};}):[]:[]})[_0x53e4('0x12')](function(_0xcc580c){logger[_0x53e4('0x13')]('ShowFaxQueue',_0x55921d);logger[_0x53e4('0x15')](_0x53e4('0x27'),_0x55921d,JSON['stringify'](_0xcc580c));_0x37b317(_0xcc580c);})['catch'](function(_0x14e710){logger[_0x53e4('0x18')](_0x53e4('0x27'),_0x14e710[_0x53e4('0x19')],_0x55921d);_0x271b5d(_0x3d6604['error'](0x1f4,_0x14e710[_0x53e4('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index b2d151b..45dd9e3 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 _0x2e8c=['removeListener','save','update','emit'];(function(_0x106b95,_0x4dd91d){var _0x5eb7e4=function(_0x3c63aa){while(--_0x3c63aa){_0x106b95['push'](_0x106b95['shift']());}};_0x5eb7e4(++_0x4dd91d);}(_0x2e8c,0x119));var _0xc2e8=function(_0x180a90,_0x37cf33){_0x180a90=_0x180a90-0x0;var _0x33edba=_0x2e8c[_0x180a90];return _0x33edba;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xc2e8('0x0'),'remove',_0xc2e8('0x1')];function createListener(_0x38d172,_0x438add){return function(_0x337ae8){_0x438add[_0xc2e8('0x2')](_0x38d172,_0x337ae8);};}function removeListener(_0x22d639,_0x2468ea){return function(){FaxQueueEvents[_0xc2e8('0x3')](_0x22d639,_0x2468ea);};}exports['register']=function(_0x304145){for(var _0x35d8cb=0x0,_0x5de547=events['length'];_0x35d8cb<_0x5de547;_0x35d8cb++){var _0x12566a=events[_0x35d8cb];var _0x305005=createListener('faxQueue:'+_0x12566a,_0x304145);FaxQueueEvents['on'](_0x12566a,_0x305005);}}; \ No newline at end of file +var _0xee00=['update','emit','removeListener','register','length','faxQueue:','./faxQueue.events','save','remove'];(function(_0x357947,_0x15fa7d){var _0xd2181=function(_0x45968b){while(--_0x45968b){_0x357947['push'](_0x357947['shift']());}};_0xd2181(++_0x15fa7d);}(_0xee00,0xd5));var _0x0ee0=function(_0x3b1deb,_0x570eba){_0x3b1deb=_0x3b1deb-0x0;var _0x4a2fe0=_0xee00[_0x3b1deb];return _0x4a2fe0;};'use strict';var FaxQueueEvents=require(_0x0ee0('0x0'));var events=[_0x0ee0('0x1'),_0x0ee0('0x2'),_0x0ee0('0x3')];function createListener(_0x440479,_0x111855){return function(_0x3d9f4e){_0x111855[_0x0ee0('0x4')](_0x440479,_0x3d9f4e);};}function removeListener(_0xf9d030,_0x56386e){return function(){FaxQueueEvents[_0x0ee0('0x5')](_0xf9d030,_0x56386e);};}exports[_0x0ee0('0x6')]=function(_0x1b0658){for(var _0x2fc457=0x0,_0x2319b6=events[_0x0ee0('0x7')];_0x2fc457<_0x2319b6;_0x2fc457++){var _0x544ccc=events[_0x2fc457];var _0x3c99e6=createListener(_0x0ee0('0x8')+_0x544ccc,_0x1b0658);FaxQueueEvents['on'](_0x544ccc,_0x3c99e6);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 308b643..9f07553 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 _0xdb28=['../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xdb28,0x106));var _0x8db2=function(_0x4316d6,_0x643007){_0x4316d6=_0x4316d6-0x0;var _0x259042=_0xdb28[_0x4316d6];return _0x259042;};'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('./faxQueue.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['getTeams']);router[_0x8db2('0x9')](_0x8db2('0x12'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8db2('0x14')](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x15')]);router[_0x8db2('0x14')](_0x8db2('0x12'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);router[_0x8db2('0x17')](_0x8db2('0xd'),auth['isAuthenticated'](),controller[_0x8db2('0x18')]);router[_0x8db2('0x19')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1a')]);router[_0x8db2('0x19')](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x1b')]);router['delete']('/:id/users',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1c')]);module[_0x8db2('0x1d')]=router; \ No newline at end of file +var _0x2c8f=['isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','post','create','/:id/users','addAgents','put','delete','destroy','removeTeams','exports','util','Router','fs-extra','../../components/auth/service','./faxQueue.controller','get'];(function(_0xc82e59,_0xd04f24){var _0x47ca88=function(_0xb7df48){while(--_0xb7df48){_0xc82e59['push'](_0xc82e59['shift']());}};_0x47ca88(++_0xd04f24);}(_0x2c8f,0x192));var _0xf2c8=function(_0x1d1bb3,_0x419a63){_0x1d1bb3=_0x1d1bb3-0x0;var _0x19ea0a=_0x2c8f[_0x1d1bb3];return _0x19ea0a;};'use strict';var multer=require('multer');var util=require(_0xf2c8('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf2c8('0x1')]();var fs_extra=require(_0xf2c8('0x2'));var auth=require(_0xf2c8('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf2c8('0x4'));router[_0xf2c8('0x5')]('/',auth[_0xf2c8('0x6')](),controller[_0xf2c8('0x7')]);router[_0xf2c8('0x5')]('/describe',auth[_0xf2c8('0x6')](),controller[_0xf2c8('0x8')]);router[_0xf2c8('0x5')](_0xf2c8('0x9'),auth[_0xf2c8('0x6')](),controller[_0xf2c8('0xa')]);router['get'](_0xf2c8('0xb'),auth[_0xf2c8('0x6')](),controller[_0xf2c8('0xc')]);router[_0xf2c8('0x5')](_0xf2c8('0xd'),auth[_0xf2c8('0x6')](),controller[_0xf2c8('0xe')]);router[_0xf2c8('0x5')]('/:id/users',auth[_0xf2c8('0x6')](),controller['getAgents']);router[_0xf2c8('0xf')]('/',auth[_0xf2c8('0x6')](),controller[_0xf2c8('0x10')]);router[_0xf2c8('0xf')](_0xf2c8('0xd'),auth[_0xf2c8('0x6')](),controller['addTeams']);router[_0xf2c8('0xf')](_0xf2c8('0x11'),auth[_0xf2c8('0x6')](),controller[_0xf2c8('0x12')]);router[_0xf2c8('0x13')](_0xf2c8('0x9'),auth[_0xf2c8('0x6')](),controller['update']);router[_0xf2c8('0x14')](_0xf2c8('0x9'),auth[_0xf2c8('0x6')](),controller[_0xf2c8('0x15')]);router[_0xf2c8('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0xf2c8('0x16')]);router[_0xf2c8('0x14')](_0xf2c8('0x11'),auth[_0xf2c8('0x6')](),controller['removeAgents']);module[_0xf2c8('0x17')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 720cbef..554900e 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 _0xc414=['DATE','sequelize','exports','STRING'];(function(_0x4ac424,_0x554b5d){var _0xe1b890=function(_0x5e85c4){while(--_0x5e85c4){_0x4ac424['push'](_0x4ac424['shift']());}};_0xe1b890(++_0x554b5d);}(_0xc414,0x111));var _0x4c41=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc414[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require(_0x4c41('0x0'));module[_0x4c41('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x4c41('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x4c41('0x3')]},'acceptAt':{'type':Sequelize[_0x4c41('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf442=['exports','STRING','DATE','moment','sequelize'];(function(_0x4a1957,_0x57b0ec){var _0x3962f9=function(_0x5836a1){while(--_0x5836a1){_0x4a1957['push'](_0x4a1957['shift']());}};_0x3962f9(++_0x57b0ec);}(_0xf442,0xbc));var _0x2f44=function(_0x4109bb,_0x41f89e){_0x4109bb=_0x4109bb-0x0;var _0x36f37e=_0xf442[_0x4109bb];return _0x36f37e;};'use strict';var moment=require(_0x2f44('0x0'));var Sequelize=require(_0x2f44('0x1'));module[_0x2f44('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x2f44('0x3')]},'joinAt':{'type':Sequelize[_0x2f44('0x4')]},'leaveAt':{'type':Sequelize[_0x2f44('0x4')]},'acceptAt':{'type':Sequelize[_0x2f44('0x4')]},'exitAt':{'type':Sequelize[_0x2f44('0x4')]},'reason':{'type':Sequelize[_0x2f44('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 2e192e0..215ab5b 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 _0x8b2b=['path','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','FaxQueueReport','findAll','catch','show','params','keys','length','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0xf4dda2,_0x513743){var _0x2ca246=function(_0x2e9980){while(--_0x2e9980){_0xf4dda2['push'](_0xf4dda2['shift']());}};_0x2ca246(++_0x513743);}(_0x8b2b,0x1c0));var _0xb8b2=function(_0x18cfc8,_0x1a085f){_0x18cfc8=_0x18cfc8-0x0;var _0x44d12b=_0x8b2b[_0x18cfc8];return _0x44d12b;};'use strict';var emlformat=require(_0xb8b2('0x0'));var rimraf=require(_0xb8b2('0x1'));var zipdir=require(_0xb8b2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb8b2('0x3'));var moment=require(_0xb8b2('0x4'));var BPromise=require(_0xb8b2('0x5'));var Mustache=require(_0xb8b2('0x6'));var util=require(_0xb8b2('0x7'));var path=require(_0xb8b2('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb8b2('0x9'));var fs=require('fs');var fs_extra=require(_0xb8b2('0xa'));var _=require(_0xb8b2('0xb'));var squel=require(_0xb8b2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb8b2('0xd'));var toCsv=require(_0xb8b2('0xe'));var querystring=require(_0xb8b2('0xf'));var Papa=require(_0xb8b2('0x10'));var Redis=require(_0xb8b2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb8b2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8b2('0x13'))(_0xb8b2('0x14'));var utils=require(_0xb8b2('0x15'));var config=require(_0xb8b2('0x16'));var licenseUtil=require(_0xb8b2('0x17'));var db=require(_0xb8b2('0x18'))['db'];function respondWithStatusCode(_0x584d41,_0x3440bf){_0x3440bf=_0x3440bf||0xcc;return function(_0x5bd724){if(_0x5bd724){return _0x584d41['sendStatus'](_0x3440bf);}return _0x584d41['status'](_0x3440bf)[_0xb8b2('0x19')]();};}function respondWithResult(_0xdc1d1d,_0x48b9df){_0x48b9df=_0x48b9df||0xc8;return function(_0x175885){if(_0x175885){return _0xdc1d1d[_0xb8b2('0x1a')](_0x48b9df)[_0xb8b2('0x1b')](_0x175885);}};}function respondWithFilteredResult(_0x142fb0,_0x46a592){return function(_0x5b614d){if(_0x5b614d){var _0x4b5a28=typeof _0x46a592[_0xb8b2('0x1c')]===_0xb8b2('0x1d')&&typeof _0x46a592[_0xb8b2('0x1e')]===_0xb8b2('0x1d');var _0xf04672=_0x5b614d['count'];var _0x47b94f=_0x4b5a28?0x0:_0x46a592[_0xb8b2('0x1c')];var _0x153b69=_0x4b5a28?_0x5b614d[_0xb8b2('0x1f')]:_0x46a592[_0xb8b2('0x1c')]+_0x46a592['limit'];var _0x23af66;if(_0x153b69>=_0xf04672){_0x153b69=_0xf04672;_0x23af66=0xc8;}else{_0x23af66=0xce;}_0x142fb0[_0xb8b2('0x1a')](_0x23af66);return _0x142fb0[_0xb8b2('0x20')](_0xb8b2('0x21'),_0x47b94f+'-'+_0x153b69+'/'+_0xf04672)[_0xb8b2('0x1b')](_0x5b614d);}return null;};}function patchUpdates(_0x1cbc65){return function(_0x34ca46){try{jsonpatch['apply'](_0x34ca46,_0x1cbc65,!![]);}catch(_0x382bbf){return BPromise[_0xb8b2('0x22')](_0x382bbf);}return _0x34ca46[_0xb8b2('0x23')]();};}function saveUpdates(_0x162d41,_0x316d3c){return function(_0x5a0a43){if(_0x5a0a43){return _0x5a0a43[_0xb8b2('0x24')](_0x162d41)['then'](function(_0xe3b28){return _0xe3b28;});}return null;};}function removeEntity(_0x8239a7,_0x2b40f8){return function(_0x20082f){if(_0x20082f){return _0x20082f['destroy']()[_0xb8b2('0x25')](function(){_0x8239a7[_0xb8b2('0x1a')](0xcc)[_0xb8b2('0x19')]();});}};}function handleEntityNotFound(_0x5a2afe,_0x49c5b1){return function(_0x517c2a){if(!_0x517c2a){_0x5a2afe['sendStatus'](0x194);}return _0x517c2a;};}function handleError(_0x36ae2d,_0x10d8f3){_0x10d8f3=_0x10d8f3||0x1f4;return function(_0x3bdb27){logger[_0xb8b2('0x26')](_0x3bdb27[_0xb8b2('0x27')]);if(_0x3bdb27[_0xb8b2('0x28')]){delete _0x3bdb27[_0xb8b2('0x28')];}_0x36ae2d[_0xb8b2('0x1a')](_0x10d8f3)[_0xb8b2('0x29')](_0x3bdb27);};}exports[_0xb8b2('0x2a')]=function(_0x2a236d,_0x6ae308){var _0x140b18={},_0xeb28c8={},_0x396fb3={'count':0x0,'rows':[]};var _0x234a63=_[_0xb8b2('0x2b')](db['FaxQueueReport'][_0xb8b2('0x2c')],function(_0x1899d9){return{'name':_0x1899d9[_0xb8b2('0x2d')],'type':_0x1899d9[_0xb8b2('0x2e')][_0xb8b2('0x2f')]};});_0xeb28c8['model']=_[_0xb8b2('0x2b')](_0x234a63,_0xb8b2('0x28'));_0xeb28c8[_0xb8b2('0x30')]=_['keys'](_0x2a236d[_0xb8b2('0x30')]);_0xeb28c8[_0xb8b2('0x31')]=_['intersection'](_0xeb28c8[_0xb8b2('0x32')],_0xeb28c8[_0xb8b2('0x30')]);_0x140b18[_0xb8b2('0x33')]=_[_0xb8b2('0x34')](_0xeb28c8[_0xb8b2('0x32')],qs[_0xb8b2('0x35')](_0x2a236d[_0xb8b2('0x30')][_0xb8b2('0x35')]));_0x140b18[_0xb8b2('0x33')]=_0x140b18[_0xb8b2('0x33')]['length']?_0x140b18[_0xb8b2('0x33')]:_0xeb28c8[_0xb8b2('0x32')];if(!_0x2a236d['query'][_0xb8b2('0x36')](_0xb8b2('0x37'))){_0x140b18[_0xb8b2('0x1e')]=qs[_0xb8b2('0x1e')](_0x2a236d[_0xb8b2('0x30')][_0xb8b2('0x1e')]);_0x140b18[_0xb8b2('0x1c')]=qs[_0xb8b2('0x1c')](_0x2a236d[_0xb8b2('0x30')][_0xb8b2('0x1c')]);}_0x140b18[_0xb8b2('0x38')]=qs[_0xb8b2('0x39')](_0x2a236d[_0xb8b2('0x30')][_0xb8b2('0x39')]);_0x140b18[_0xb8b2('0x3a')]=qs[_0xb8b2('0x31')](_[_0xb8b2('0x3b')](_0x2a236d[_0xb8b2('0x30')],_0xeb28c8[_0xb8b2('0x31')]),_0x234a63);if(_0x2a236d[_0xb8b2('0x30')][_0xb8b2('0x3c')]){_0x140b18[_0xb8b2('0x3a')]=_[_0xb8b2('0x3d')](_0x140b18[_0xb8b2('0x3a')],{'$or':_[_0xb8b2('0x2b')](_0x234a63,function(_0x3de2e0){if(_0x3de2e0[_0xb8b2('0x2e')]!=='VIRTUAL'){var _0x482d64={};_0x482d64[_0x3de2e0[_0xb8b2('0x28')]]={'$like':'%'+_0x2a236d['query'][_0xb8b2('0x3c')]+'%'};return _0x482d64;}})});}_0x140b18=_[_0xb8b2('0x3d')]({},_0x140b18,_0x2a236d[_0xb8b2('0x3e')]);var _0x3cd89e={'where':_0x140b18['where']};return db['FaxQueueReport'][_0xb8b2('0x1f')](_0x3cd89e)[_0xb8b2('0x25')](function(_0x1c72e9){_0x396fb3[_0xb8b2('0x1f')]=_0x1c72e9;if(_0x2a236d[_0xb8b2('0x30')]['includeAll']){_0x140b18[_0xb8b2('0x3f')]=[{'all':!![]}];}return db[_0xb8b2('0x40')][_0xb8b2('0x41')](_0x140b18);})[_0xb8b2('0x25')](function(_0x283eb5){_0x396fb3['rows']=_0x283eb5;return _0x396fb3;})[_0xb8b2('0x25')](respondWithFilteredResult(_0x6ae308,_0x140b18))[_0xb8b2('0x42')](handleError(_0x6ae308,null));};exports[_0xb8b2('0x43')]=function(_0x13d356,_0x1890fc){var _0x1f0ed2={'raw':!![],'where':{'id':_0x13d356[_0xb8b2('0x44')]['id']}},_0x37370a={};_0x37370a[_0xb8b2('0x32')]=_[_0xb8b2('0x45')](db['FaxQueueReport']['rawAttributes']);_0x37370a[_0xb8b2('0x30')]=_['keys'](_0x13d356[_0xb8b2('0x30')]);_0x37370a[_0xb8b2('0x31')]=_[_0xb8b2('0x34')](_0x37370a[_0xb8b2('0x32')],_0x37370a[_0xb8b2('0x30')]);_0x1f0ed2['attributes']=_[_0xb8b2('0x34')](_0x37370a[_0xb8b2('0x32')],qs[_0xb8b2('0x35')](_0x13d356[_0xb8b2('0x30')][_0xb8b2('0x35')]));_0x1f0ed2[_0xb8b2('0x33')]=_0x1f0ed2[_0xb8b2('0x33')][_0xb8b2('0x46')]?_0x1f0ed2[_0xb8b2('0x33')]:_0x37370a[_0xb8b2('0x32')];if(_0x13d356[_0xb8b2('0x30')]['includeAll']){_0x1f0ed2[_0xb8b2('0x3f')]=[{'all':!![]}];}_0x1f0ed2=_[_0xb8b2('0x3d')]({},_0x1f0ed2,_0x13d356[_0xb8b2('0x3e')]);return db[_0xb8b2('0x40')][_0xb8b2('0x47')](_0x1f0ed2)[_0xb8b2('0x25')](handleEntityNotFound(_0x1890fc,null))[_0xb8b2('0x25')](respondWithResult(_0x1890fc,null))[_0xb8b2('0x42')](handleError(_0x1890fc,null));};exports[_0xb8b2('0x48')]=function(_0xe88b4f,_0x2f6795){return db[_0xb8b2('0x40')][_0xb8b2('0x48')](_0xe88b4f['body'],{})[_0xb8b2('0x25')](respondWithResult(_0x2f6795,0xc9))[_0xb8b2('0x42')](handleError(_0x2f6795,null));};exports['update']=function(_0x35b691,_0x2b9c9a){if(_0x35b691[_0xb8b2('0x49')]['id']){delete _0x35b691['body']['id'];}return db[_0xb8b2('0x40')][_0xb8b2('0x47')]({'where':{'id':_0x35b691[_0xb8b2('0x44')]['id']}})[_0xb8b2('0x25')](handleEntityNotFound(_0x2b9c9a,null))[_0xb8b2('0x25')](saveUpdates(_0x35b691[_0xb8b2('0x49')],null))[_0xb8b2('0x25')](respondWithResult(_0x2b9c9a,null))[_0xb8b2('0x42')](handleError(_0x2b9c9a,null));};exports[_0xb8b2('0x4a')]=function(_0x3397b0,_0x79ae95){return db[_0xb8b2('0x40')][_0xb8b2('0x47')]({'where':{'id':_0x3397b0[_0xb8b2('0x44')]['id']}})[_0xb8b2('0x25')](handleEntityNotFound(_0x79ae95,null))['then'](removeEntity(_0x79ae95,null))['catch'](handleError(_0x79ae95,null));};exports[_0xb8b2('0x4b')]=function(_0x10bb91,_0x5d8cbd){return db[_0xb8b2('0x40')][_0xb8b2('0x4b')]()[_0xb8b2('0x25')](respondWithResult(_0x5d8cbd,null))['catch'](handleError(_0x5d8cbd,null));}; \ No newline at end of file +var _0xa62c=['error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','FaxQueueReport','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','end'];(function(_0x50a2e0,_0x3963cc){var _0x197598=function(_0x466861){while(--_0x466861){_0x50a2e0['push'](_0x50a2e0['shift']());}};_0x197598(++_0x3963cc);}(_0xa62c,0x70));var _0xca62=function(_0x1e91eb,_0x5829a3){_0x1e91eb=_0x1e91eb-0x0;var _0x2af75a=_0xa62c[_0x1e91eb];return _0x2af75a;};'use strict';var emlformat=require(_0xca62('0x0'));var rimraf=require(_0xca62('0x1'));var zipdir=require(_0xca62('0x2'));var jsonpatch=require(_0xca62('0x3'));var rp=require(_0xca62('0x4'));var moment=require(_0xca62('0x5'));var BPromise=require(_0xca62('0x6'));var Mustache=require('mustache');var util=require(_0xca62('0x7'));var path=require(_0xca62('0x8'));var sox=require(_0xca62('0x9'));var csv=require(_0xca62('0xa'));var ejs=require(_0xca62('0xb'));var fs=require('fs');var fs_extra=require(_0xca62('0xc'));var _=require(_0xca62('0xd'));var squel=require(_0xca62('0xe'));var crypto=require('crypto');var jsforce=require(_0xca62('0xf'));var deskjs=require(_0xca62('0x10'));var toCsv=require(_0xca62('0xa'));var querystring=require('querystring');var Papa=require(_0xca62('0x11'));var Redis=require(_0xca62('0x12'));var authService=require(_0xca62('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xca62('0x14'));var hardwareService=require(_0xca62('0x15'));var logger=require(_0xca62('0x16'))(_0xca62('0x17'));var utils=require(_0xca62('0x18'));var config=require(_0xca62('0x19'));var licenseUtil=require(_0xca62('0x1a'));var db=require(_0xca62('0x1b'))['db'];function respondWithStatusCode(_0x2ba621,_0x59cfd8){_0x59cfd8=_0x59cfd8||0xcc;return function(_0x23a20b){if(_0x23a20b){return _0x2ba621[_0xca62('0x1c')](_0x59cfd8);}return _0x2ba621[_0xca62('0x1d')](_0x59cfd8)['end']();};}function respondWithResult(_0x4a0835,_0x5446a3){_0x5446a3=_0x5446a3||0xc8;return function(_0x307a30){if(_0x307a30){return _0x4a0835['status'](_0x5446a3)[_0xca62('0x1e')](_0x307a30);}};}function respondWithFilteredResult(_0x1634b2,_0x539a04){return function(_0x4f93fc){if(_0x4f93fc){var _0x21eae8=typeof _0x539a04[_0xca62('0x1f')]===_0xca62('0x20')&&typeof _0x539a04['limit']===_0xca62('0x20');var _0x98db4c=_0x4f93fc[_0xca62('0x21')];var _0x58d6f6=_0x21eae8?0x0:_0x539a04[_0xca62('0x1f')];var _0x34a370=_0x21eae8?_0x4f93fc[_0xca62('0x21')]:_0x539a04[_0xca62('0x1f')]+_0x539a04[_0xca62('0x22')];var _0x1b62bb;if(_0x34a370>=_0x98db4c){_0x34a370=_0x98db4c;_0x1b62bb=0xc8;}else{_0x1b62bb=0xce;}_0x1634b2[_0xca62('0x1d')](_0x1b62bb);return _0x1634b2[_0xca62('0x23')](_0xca62('0x24'),_0x58d6f6+'-'+_0x34a370+'/'+_0x98db4c)[_0xca62('0x1e')](_0x4f93fc);}return null;};}function patchUpdates(_0x133132){return function(_0x1dff07){try{jsonpatch['apply'](_0x1dff07,_0x133132,!![]);}catch(_0x4c05c2){return BPromise['reject'](_0x4c05c2);}return _0x1dff07[_0xca62('0x25')]();};}function saveUpdates(_0x138177,_0x3f2a52){return function(_0x3d4730){if(_0x3d4730){return _0x3d4730[_0xca62('0x26')](_0x138177)[_0xca62('0x27')](function(_0x364c8d){return _0x364c8d;});}return null;};}function removeEntity(_0x3eb516,_0x4b1c5a){return function(_0x486763){if(_0x486763){return _0x486763[_0xca62('0x28')]()['then'](function(){_0x3eb516[_0xca62('0x1d')](0xcc)[_0xca62('0x29')]();});}};}function handleEntityNotFound(_0x32933c,_0x3e90eb){return function(_0x20e970){if(!_0x20e970){_0x32933c[_0xca62('0x1c')](0x194);}return _0x20e970;};}function handleError(_0x4e05d4,_0x483aae){_0x483aae=_0x483aae||0x1f4;return function(_0xd03a0b){logger[_0xca62('0x2a')](_0xd03a0b['stack']);if(_0xd03a0b['name']){delete _0xd03a0b[_0xca62('0x2b')];}_0x4e05d4['status'](_0x483aae)[_0xca62('0x2c')](_0xd03a0b);};}exports[_0xca62('0x2d')]=function(_0x1ed588,_0x107187){var _0x37dd79={},_0x4e4c0c={},_0x4958d7={'count':0x0,'rows':[]};var _0x403208=_[_0xca62('0x2e')](db['FaxQueueReport'][_0xca62('0x2f')],function(_0x2b8aee){return{'name':_0x2b8aee[_0xca62('0x30')],'type':_0x2b8aee[_0xca62('0x31')][_0xca62('0x32')]};});_0x4e4c0c[_0xca62('0x33')]=_[_0xca62('0x2e')](_0x403208,_0xca62('0x2b'));_0x4e4c0c[_0xca62('0x34')]=_[_0xca62('0x35')](_0x1ed588[_0xca62('0x34')]);_0x4e4c0c[_0xca62('0x36')]=_[_0xca62('0x37')](_0x4e4c0c[_0xca62('0x33')],_0x4e4c0c[_0xca62('0x34')]);_0x37dd79[_0xca62('0x38')]=_[_0xca62('0x37')](_0x4e4c0c[_0xca62('0x33')],qs[_0xca62('0x39')](_0x1ed588[_0xca62('0x34')]['fields']));_0x37dd79['attributes']=_0x37dd79[_0xca62('0x38')][_0xca62('0x3a')]?_0x37dd79['attributes']:_0x4e4c0c['model'];if(!_0x1ed588[_0xca62('0x34')][_0xca62('0x3b')](_0xca62('0x3c'))){_0x37dd79[_0xca62('0x22')]=qs['limit'](_0x1ed588[_0xca62('0x34')][_0xca62('0x22')]);_0x37dd79['offset']=qs['offset'](_0x1ed588['query'][_0xca62('0x1f')]);}_0x37dd79['order']=qs[_0xca62('0x3d')](_0x1ed588[_0xca62('0x34')][_0xca62('0x3d')]);_0x37dd79[_0xca62('0x3e')]=qs[_0xca62('0x36')](_[_0xca62('0x3f')](_0x1ed588[_0xca62('0x34')],_0x4e4c0c['filters']),_0x403208);if(_0x1ed588[_0xca62('0x34')][_0xca62('0x40')]){_0x37dd79[_0xca62('0x3e')]=_[_0xca62('0x41')](_0x37dd79[_0xca62('0x3e')],{'$or':_[_0xca62('0x2e')](_0x403208,function(_0x45cc1a){if(_0x45cc1a[_0xca62('0x31')]!=='VIRTUAL'){var _0xa66fa4={};_0xa66fa4[_0x45cc1a[_0xca62('0x2b')]]={'$like':'%'+_0x1ed588['query']['filter']+'%'};return _0xa66fa4;}})});}_0x37dd79=_[_0xca62('0x41')]({},_0x37dd79,_0x1ed588[_0xca62('0x42')]);var _0x14645c={'where':_0x37dd79[_0xca62('0x3e')]};return db['FaxQueueReport'][_0xca62('0x21')](_0x14645c)[_0xca62('0x27')](function(_0x117035){_0x4958d7['count']=_0x117035;if(_0x1ed588[_0xca62('0x34')][_0xca62('0x43')]){_0x37dd79[_0xca62('0x44')]=[{'all':!![]}];}return db[_0xca62('0x45')]['findAll'](_0x37dd79);})[_0xca62('0x27')](function(_0x3fe8e4){_0x4958d7['rows']=_0x3fe8e4;return _0x4958d7;})['then'](respondWithFilteredResult(_0x107187,_0x37dd79))[_0xca62('0x46')](handleError(_0x107187,null));};exports[_0xca62('0x47')]=function(_0x19e605,_0xd80dd3){var _0x2c1132={'raw':!![],'where':{'id':_0x19e605[_0xca62('0x48')]['id']}},_0x51f7f8={};_0x51f7f8['model']=_[_0xca62('0x35')](db[_0xca62('0x45')][_0xca62('0x2f')]);_0x51f7f8[_0xca62('0x34')]=_[_0xca62('0x35')](_0x19e605[_0xca62('0x34')]);_0x51f7f8['filters']=_['intersection'](_0x51f7f8['model'],_0x51f7f8[_0xca62('0x34')]);_0x2c1132[_0xca62('0x38')]=_['intersection'](_0x51f7f8[_0xca62('0x33')],qs['fields'](_0x19e605[_0xca62('0x34')][_0xca62('0x39')]));_0x2c1132[_0xca62('0x38')]=_0x2c1132['attributes']['length']?_0x2c1132[_0xca62('0x38')]:_0x51f7f8[_0xca62('0x33')];if(_0x19e605[_0xca62('0x34')]['includeAll']){_0x2c1132[_0xca62('0x44')]=[{'all':!![]}];}_0x2c1132=_['merge']({},_0x2c1132,_0x19e605[_0xca62('0x42')]);return db[_0xca62('0x45')][_0xca62('0x49')](_0x2c1132)[_0xca62('0x27')](handleEntityNotFound(_0xd80dd3,null))[_0xca62('0x27')](respondWithResult(_0xd80dd3,null))[_0xca62('0x46')](handleError(_0xd80dd3,null));};exports[_0xca62('0x4a')]=function(_0x31e256,_0x1c14aa){return db[_0xca62('0x45')][_0xca62('0x4a')](_0x31e256[_0xca62('0x4b')],{})[_0xca62('0x27')](respondWithResult(_0x1c14aa,0xc9))[_0xca62('0x46')](handleError(_0x1c14aa,null));};exports[_0xca62('0x26')]=function(_0x510330,_0x39d3bf){if(_0x510330[_0xca62('0x4b')]['id']){delete _0x510330[_0xca62('0x4b')]['id'];}return db[_0xca62('0x45')]['find']({'where':{'id':_0x510330['params']['id']}})['then'](handleEntityNotFound(_0x39d3bf,null))[_0xca62('0x27')](saveUpdates(_0x510330[_0xca62('0x4b')],null))[_0xca62('0x27')](respondWithResult(_0x39d3bf,null))[_0xca62('0x46')](handleError(_0x39d3bf,null));};exports['destroy']=function(_0xe610f2,_0x363203){return db[_0xca62('0x45')][_0xca62('0x49')]({'where':{'id':_0xe610f2[_0xca62('0x48')]['id']}})[_0xca62('0x27')](handleEntityNotFound(_0x363203,null))[_0xca62('0x27')](removeEntity(_0x363203,null))[_0xca62('0x46')](handleError(_0x363203,null));};exports[_0xca62('0x4c')]=function(_0x3f4d4b,_0x3dd4df){return db[_0xca62('0x45')][_0xca62('0x4c')]()[_0xca62('0x27')](respondWithResult(_0x3dd4df,null))['catch'](handleError(_0x3dd4df,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index a436092..2ffe76a 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 _0x1cb9=['api','moment','bluebird','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x597484,_0x199340){var _0x218e64=function(_0x390d55){while(--_0x390d55){_0x597484['push'](_0x597484['shift']());}};_0x218e64(++_0x199340);}(_0x1cb9,0x14e));var _0x91cb=function(_0x910b2a,_0x553ca7){_0x910b2a=_0x910b2a-0x0;var _0x3bafbf=_0x1cb9[_0x910b2a];return _0x3bafbf;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x91cb('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2a6017,_0x441140){var _0x2615ad=function(_0x56034b){while(--_0x56034b){_0x2a6017['push'](_0x2a6017['shift']());}};_0x2615ad(++_0x441140);}(_0x4975,0x86));var _0x5497=function(_0x2d8626,_0x278a46){_0x2d8626=_0x2d8626-0x0;var _0x480325=_0x4975[_0x2d8626];return _0x480325;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['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 42f3049..59ae6e4 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 _0x98f8=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','FaxQueueReport,\x20%s,\x20%s','info','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','debug','stringify','UpdateFaxQueueReport','update','where','attributes','limit','lodash','util','moment','randomstring'];(function(_0x3eae20,_0x3078d9){var _0x58921b=function(_0x28c5cf){while(--_0x28c5cf){_0x3eae20['push'](_0x3eae20['shift']());}};_0x58921b(++_0x3078d9);}(_0x98f8,0x188));var _0x898f=function(_0x320377,_0x32efc7){_0x320377=_0x320377-0x0;var _0xc9bf4a=_0x98f8[_0x320377];return _0xc9bf4a;};'use strict';var _=require(_0x898f('0x0'));var util=require(_0x898f('0x1'));var moment=require(_0x898f('0x2'));var BPromise=require('bluebird');var rs=require(_0x898f('0x3'));var fs=require('fs');var Redis=require(_0x898f('0x4'));var db=require(_0x898f('0x5'))['db'];var utils=require(_0x898f('0x6'));var logger=require('../../config/logger')(_0x898f('0x7'));var config=require(_0x898f('0x8'));var jayson=require(_0x898f('0x9'));var client=jayson[_0x898f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a1b40,_0x40fe40,_0x21e861){return new BPromise(function(_0xaee514,_0x55f122){return client[_0x898f('0xb')](_0x4a1b40,_0x21e861)[_0x898f('0xc')](function(_0x14fdd3){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x40fe40,_0x898f('0xd'));logger['debug'](_0x898f('0xe'),_0x40fe40,_0x898f('0xd'),JSON['stringify'](_0x14fdd3));if(_0x14fdd3[_0x898f('0xf')]){if(_0x14fdd3[_0x898f('0xf')][_0x898f('0x10')]===0x1f4){logger[_0x898f('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x40fe40,_0x14fdd3[_0x898f('0xf')][_0x898f('0x11')]);return _0x55f122(_0x14fdd3[_0x898f('0xf')]['message']);}logger['error'](_0x898f('0x12'),_0x40fe40,_0x14fdd3[_0x898f('0xf')][_0x898f('0x11')]);return _0xaee514(_0x14fdd3['error']['message']);}else{logger[_0x898f('0x13')](_0x898f('0x12'),_0x40fe40,_0x898f('0xd'));_0xaee514(_0x14fdd3['result'][_0x898f('0x11')]);}})[_0x898f('0x14')](function(_0x5d52fa){logger[_0x898f('0xf')](_0x898f('0x12'),_0x40fe40,_0x5d52fa);_0x55f122(_0x5d52fa);});});}exports[_0x898f('0x15')]=function(_0x5882a9){var _0x3b2d71=this;return new Promise(function(_0x51c697,_0x13c001){return db[_0x898f('0x16')][_0x898f('0x17')](_0x5882a9['body'],{'raw':_0x5882a9[_0x898f('0x18')]?_0x5882a9[_0x898f('0x18')][_0x898f('0x19')]===undefined?!![]:![]:!![]})[_0x898f('0xc')](function(_0x5a4bbd){logger[_0x898f('0x13')](_0x898f('0x15'),_0x5882a9);logger[_0x898f('0x1a')](_0x898f('0x15'),_0x5882a9,JSON[_0x898f('0x1b')](_0x5a4bbd));_0x51c697(_0x5a4bbd);})[_0x898f('0x14')](function(_0x20270b){logger[_0x898f('0xf')](_0x898f('0x15'),_0x20270b[_0x898f('0x11')],_0x5882a9);_0x13c001(_0x3b2d71[_0x898f('0xf')](0x1f4,_0x20270b[_0x898f('0x11')]));});});};exports[_0x898f('0x1c')]=function(_0x1ec0b9){var _0x126e04=this;return new Promise(function(_0x5df484,_0x1df033){return db[_0x898f('0x16')][_0x898f('0x1d')](_0x1ec0b9['body'],{'raw':_0x1ec0b9[_0x898f('0x18')]?_0x1ec0b9[_0x898f('0x18')][_0x898f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ec0b9[_0x898f('0x18')]?_0x1ec0b9[_0x898f('0x18')][_0x898f('0x1e')]||null:null,'attributes':_0x1ec0b9[_0x898f('0x18')]?_0x1ec0b9[_0x898f('0x18')][_0x898f('0x1f')]||null:null,'limit':_0x1ec0b9[_0x898f('0x18')]?_0x1ec0b9[_0x898f('0x18')][_0x898f('0x20')]||null:null})['then'](function(_0x2f2679){logger[_0x898f('0x13')](_0x898f('0x1c'),_0x1ec0b9);logger[_0x898f('0x1a')](_0x898f('0x1c'),_0x1ec0b9,JSON[_0x898f('0x1b')](_0x2f2679));_0x5df484(_0x2f2679);})[_0x898f('0x14')](function(_0x923c1c){logger['error'](_0x898f('0x1c'),_0x923c1c[_0x898f('0x11')],_0x1ec0b9);_0x1df033(_0x126e04[_0x898f('0xf')](0x1f4,_0x923c1c['message']));});});}; \ No newline at end of file +var _0x3c92=['http','request','then','FaxQueueReport,\x20%s,\x20%s','debug','error','code','message','info','result','catch','create','body','options','raw','CreateFaxQueueReport','stringify','UpdateFaxQueueReport','FaxQueueReport','update','attributes','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0xf7e4ff,_0x1288e2){var _0x4c35cc=function(_0x11b623){while(--_0x11b623){_0xf7e4ff['push'](_0xf7e4ff['shift']());}};_0x4c35cc(++_0x1288e2);}(_0x3c92,0x105));var _0x23c9=function(_0x21faba,_0x3a159c){_0x21faba=_0x21faba-0x0;var _0x446060=_0x3c92[_0x21faba];return _0x446060;};'use strict';var _=require(_0x23c9('0x0'));var util=require('util');var moment=require(_0x23c9('0x1'));var BPromise=require(_0x23c9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x23c9('0x3'))['db'];var utils=require(_0x23c9('0x4'));var logger=require('../../config/logger')(_0x23c9('0x5'));var config=require(_0x23c9('0x6'));var jayson=require(_0x23c9('0x7'));var client=jayson[_0x23c9('0x8')][_0x23c9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x537fe6,_0x44e472,_0x12efa4){return new BPromise(function(_0x38bbcd,_0x58ff9c){return client[_0x23c9('0xa')](_0x537fe6,_0x12efa4)[_0x23c9('0xb')](function(_0x158b22){logger['info'](_0x23c9('0xc'),_0x44e472,'request\x20sent');logger[_0x23c9('0xd')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x44e472,'request\x20sent',JSON['stringify'](_0x158b22));if(_0x158b22[_0x23c9('0xe')]){if(_0x158b22['error'][_0x23c9('0xf')]===0x1f4){logger[_0x23c9('0xe')](_0x23c9('0xc'),_0x44e472,_0x158b22[_0x23c9('0xe')][_0x23c9('0x10')]);return _0x58ff9c(_0x158b22[_0x23c9('0xe')]['message']);}logger[_0x23c9('0xe')](_0x23c9('0xc'),_0x44e472,_0x158b22['error'][_0x23c9('0x10')]);return _0x38bbcd(_0x158b22[_0x23c9('0xe')][_0x23c9('0x10')]);}else{logger[_0x23c9('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x44e472,'request\x20sent');_0x38bbcd(_0x158b22[_0x23c9('0x12')]['message']);}})[_0x23c9('0x13')](function(_0x4a5fad){logger[_0x23c9('0xe')](_0x23c9('0xc'),_0x44e472,_0x4a5fad);_0x58ff9c(_0x4a5fad);});});}exports['CreateFaxQueueReport']=function(_0x1c3c88){var _0x2cad6a=this;return new Promise(function(_0x11f5af,_0x272f6b){return db['FaxQueueReport'][_0x23c9('0x14')](_0x1c3c88[_0x23c9('0x15')],{'raw':_0x1c3c88['options']?_0x1c3c88[_0x23c9('0x16')][_0x23c9('0x17')]===undefined?!![]:![]:!![]})[_0x23c9('0xb')](function(_0x2119e9){logger['info'](_0x23c9('0x18'),_0x1c3c88);logger[_0x23c9('0xd')]('CreateFaxQueueReport',_0x1c3c88,JSON[_0x23c9('0x19')](_0x2119e9));_0x11f5af(_0x2119e9);})['catch'](function(_0x42516c){logger['error']('CreateFaxQueueReport',_0x42516c[_0x23c9('0x10')],_0x1c3c88);_0x272f6b(_0x2cad6a['error'](0x1f4,_0x42516c['message']));});});};exports[_0x23c9('0x1a')]=function(_0x334006){var _0xa0daa2=this;return new Promise(function(_0x3616b3,_0x549ca6){return db[_0x23c9('0x1b')][_0x23c9('0x1c')](_0x334006[_0x23c9('0x15')],{'raw':_0x334006[_0x23c9('0x16')]?_0x334006[_0x23c9('0x16')][_0x23c9('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x334006[_0x23c9('0x16')]?_0x334006[_0x23c9('0x16')]['where']||null:null,'attributes':_0x334006[_0x23c9('0x16')]?_0x334006[_0x23c9('0x16')][_0x23c9('0x1d')]||null:null,'limit':_0x334006[_0x23c9('0x16')]?_0x334006[_0x23c9('0x16')]['limit']||null:null})[_0x23c9('0xb')](function(_0x4a5074){logger[_0x23c9('0x11')](_0x23c9('0x1a'),_0x334006);logger[_0x23c9('0xd')](_0x23c9('0x1a'),_0x334006,JSON[_0x23c9('0x19')](_0x4a5074));_0x3616b3(_0x4a5074);})[_0x23c9('0x13')](function(_0xcacdca){logger['error'](_0x23c9('0x1a'),_0xcacdca[_0x23c9('0x10')],_0x334006);_0x549ca6(_0xa0daa2[_0x23c9('0xe')](0x1f4,_0xcacdca[_0x23c9('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 70b54ed..b6d6747 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 _0x39ef=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x44b3bd,_0x44c97d){var _0x1efc4a=function(_0x5d0205){while(--_0x5d0205){_0x44b3bd['push'](_0x44b3bd['shift']());}};_0x1efc4a(++_0x44c97d);}(_0x39ef,0x173));var _0xf39e=function(_0x15bb22,_0x382cf5){_0x15bb22=_0x15bb22-0x0;var _0x6751c7=_0x39ef[_0x15bb22];return _0x6751c7;};'use strict';var multer=require(_0xf39e('0x0'));var util=require(_0xf39e('0x1'));var path=require(_0xf39e('0x2'));var timeout=require('connect-timeout');var express=require(_0xf39e('0x3'));var router=express[_0xf39e('0x4')]();var fs_extra=require(_0xf39e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf39e('0x6'));var config=require(_0xf39e('0x7'));var controller=require(_0xf39e('0x8'));router['get']('/',auth[_0xf39e('0x9')](),controller[_0xf39e('0xa')]);router[_0xf39e('0xb')](_0xf39e('0xc'),auth[_0xf39e('0x9')](),controller[_0xf39e('0xd')]);router[_0xf39e('0xb')](_0xf39e('0xe'),auth['isAuthenticated'](),controller[_0xf39e('0xf')]);router[_0xf39e('0x10')]('/',auth[_0xf39e('0x9')](),controller[_0xf39e('0x11')]);router[_0xf39e('0x12')](_0xf39e('0xe'),auth[_0xf39e('0x9')](),controller[_0xf39e('0x13')]);router['delete'](_0xf39e('0xe'),auth['isAuthenticated'](),controller[_0xf39e('0x14')]);module[_0xf39e('0x15')]=router; \ No newline at end of file +var _0x2371=['put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','isAuthenticated','index','describe','/:id','show','post','create'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x2371,0x1bd));var _0x1237=function(_0xf26d40,_0x2f4f46){_0xf26d40=_0xf26d40-0x0;var _0x50b68c=_0x2371[_0xf26d40];return _0x50b68c;};'use strict';var multer=require(_0x1237('0x0'));var util=require(_0x1237('0x1'));var path=require(_0x1237('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1237('0x3')]();var fs_extra=require(_0x1237('0x4'));var auth=require(_0x1237('0x5'));var interaction=require(_0x1237('0x6'));var config=require('../../config/environment');var controller=require(_0x1237('0x7'));router['get']('/',auth[_0x1237('0x8')](),controller[_0x1237('0x9')]);router['get']('/describe',auth[_0x1237('0x8')](),controller[_0x1237('0xa')]);router['get'](_0x1237('0xb'),auth['isAuthenticated'](),controller[_0x1237('0xc')]);router[_0x1237('0xd')]('/',auth[_0x1237('0x8')](),controller[_0x1237('0xe')]);router[_0x1237('0xf')](_0x1237('0xb'),auth[_0x1237('0x8')](),controller[_0x1237('0x10')]);router[_0x1237('0x11')]('/:id',auth[_0x1237('0x8')](),controller[_0x1237('0x12')]);module[_0x1237('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index efbfcd4..88e566b 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x5533b1,_0x7f4a9a){var _0x1009f3=function(_0x41d1ad){while(--_0x41d1ad){_0x5533b1['push'](_0x5533b1['shift']());}};_0x1009f3(++_0x7f4a9a);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x34bd34,_0x1444f7){var _0x4e36d6=function(_0x20ed8e){while(--_0x20ed8e){_0x34bd34['push'](_0x34bd34['shift']());}};_0x4e36d6(++_0x1444f7);}(_0x9bde,0xe1));var _0xe9bd=function(_0x34e233,_0x17b032){_0x34e233=_0x34e233-0x0;var _0x213531=_0x9bde[_0x34e233];return _0x213531;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 7dc3ab1..58f6eb1 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 _0x4006=['to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','update','error','stack','name','index','map','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','filter','merge','options','FaxTransferReport','then','includeAll','include','findAll','rows','show','params','catch','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0x1993b4,_0xdcfb92){var _0x390350=function(_0x22ee72){while(--_0x22ee72){_0x1993b4['push'](_0x1993b4['shift']());}};_0x390350(++_0xdcfb92);}(_0x4006,0x8a));var _0x6400=function(_0x921d2e,_0x20b8f8){_0x921d2e=_0x921d2e-0x0;var _0x27cc2c=_0x4006[_0x921d2e];return _0x27cc2c;};'use strict';var emlformat=require(_0x6400('0x0'));var rimraf=require(_0x6400('0x1'));var zipdir=require(_0x6400('0x2'));var jsonpatch=require(_0x6400('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6400('0x4'));var Mustache=require(_0x6400('0x5'));var util=require(_0x6400('0x6'));var path=require('path');var sox=require(_0x6400('0x7'));var csv=require('to-csv');var ejs=require(_0x6400('0x8'));var fs=require('fs');var fs_extra=require(_0x6400('0x9'));var _=require('lodash');var squel=require(_0x6400('0xa'));var crypto=require(_0x6400('0xb'));var jsforce=require(_0x6400('0xc'));var deskjs=require(_0x6400('0xd'));var toCsv=require(_0x6400('0xe'));var querystring=require('querystring');var Papa=require(_0x6400('0xf'));var Redis=require('ioredis');var authService=require(_0x6400('0x10'));var qs=require(_0x6400('0x11'));var as=require(_0x6400('0x12'));var hardwareService=require(_0x6400('0x13'));var logger=require(_0x6400('0x14'))(_0x6400('0x15'));var utils=require(_0x6400('0x16'));var config=require(_0x6400('0x17'));var licenseUtil=require(_0x6400('0x18'));var db=require(_0x6400('0x19'))['db'];function respondWithStatusCode(_0x34e9b7,_0x152d46){_0x152d46=_0x152d46||0xcc;return function(_0x343bb9){if(_0x343bb9){return _0x34e9b7[_0x6400('0x1a')](_0x152d46);}return _0x34e9b7[_0x6400('0x1b')](_0x152d46)[_0x6400('0x1c')]();};}function respondWithResult(_0x321f22,_0x3d0fff){_0x3d0fff=_0x3d0fff||0xc8;return function(_0x4f5d6c){if(_0x4f5d6c){return _0x321f22[_0x6400('0x1b')](_0x3d0fff)['json'](_0x4f5d6c);}};}function respondWithFilteredResult(_0x379a29,_0x1ad26f){return function(_0x852697){if(_0x852697){var _0x3c7a05=typeof _0x1ad26f['offset']===_0x6400('0x1d')&&typeof _0x1ad26f[_0x6400('0x1e')]===_0x6400('0x1d');var _0xb578d6=_0x852697[_0x6400('0x1f')];var _0xac7b15=_0x3c7a05?0x0:_0x1ad26f[_0x6400('0x20')];var _0x2e5a1e=_0x3c7a05?_0x852697['count']:_0x1ad26f['offset']+_0x1ad26f[_0x6400('0x1e')];var _0x3c43ff;if(_0x2e5a1e>=_0xb578d6){_0x2e5a1e=_0xb578d6;_0x3c43ff=0xc8;}else{_0x3c43ff=0xce;}_0x379a29[_0x6400('0x1b')](_0x3c43ff);return _0x379a29[_0x6400('0x21')](_0x6400('0x22'),_0xac7b15+'-'+_0x2e5a1e+'/'+_0xb578d6)['json'](_0x852697);}return null;};}function patchUpdates(_0x1ffc22){return function(_0x3aed8e){try{jsonpatch[_0x6400('0x23')](_0x3aed8e,_0x1ffc22,!![]);}catch(_0x218ccb){return BPromise['reject'](_0x218ccb);}return _0x3aed8e['save']();};}function saveUpdates(_0x31e813,_0x216789){return function(_0x23b3a4){if(_0x23b3a4){return _0x23b3a4[_0x6400('0x24')](_0x31e813)['then'](function(_0x2a1523){return _0x2a1523;});}return null;};}function removeEntity(_0x282f2a,_0x1e6bbf){return function(_0x15a175){if(_0x15a175){return _0x15a175['destroy']()['then'](function(){_0x282f2a[_0x6400('0x1b')](0xcc)[_0x6400('0x1c')]();});}};}function handleEntityNotFound(_0x42d83d,_0x40e7d8){return function(_0x1c64b1){if(!_0x1c64b1){_0x42d83d[_0x6400('0x1a')](0x194);}return _0x1c64b1;};}function handleError(_0x45f612,_0x37adb3){_0x37adb3=_0x37adb3||0x1f4;return function(_0x234991){logger[_0x6400('0x25')](_0x234991[_0x6400('0x26')]);if(_0x234991[_0x6400('0x27')]){delete _0x234991[_0x6400('0x27')];}_0x45f612[_0x6400('0x1b')](_0x37adb3)['send'](_0x234991);};}exports[_0x6400('0x28')]=function(_0x28d0f1,_0xb9ad10){var _0x588a6f={},_0x3f9927={},_0x27c9a5={'count':0x0,'rows':[]};var _0x45f2c1=_[_0x6400('0x29')](db['FaxTransferReport'][_0x6400('0x2a')],function(_0x3653ff){return{'name':_0x3653ff[_0x6400('0x2b')],'type':_0x3653ff['type']['key']};});_0x3f9927[_0x6400('0x2c')]=_[_0x6400('0x29')](_0x45f2c1,'name');_0x3f9927['query']=_[_0x6400('0x2d')](_0x28d0f1[_0x6400('0x2e')]);_0x3f9927[_0x6400('0x2f')]=_[_0x6400('0x30')](_0x3f9927[_0x6400('0x2c')],_0x3f9927[_0x6400('0x2e')]);_0x588a6f[_0x6400('0x31')]=_[_0x6400('0x30')](_0x3f9927[_0x6400('0x2c')],qs[_0x6400('0x32')](_0x28d0f1['query'][_0x6400('0x32')]));_0x588a6f[_0x6400('0x31')]=_0x588a6f[_0x6400('0x31')][_0x6400('0x33')]?_0x588a6f[_0x6400('0x31')]:_0x3f9927['model'];if(!_0x28d0f1[_0x6400('0x2e')][_0x6400('0x34')]('nolimit')){_0x588a6f['limit']=qs[_0x6400('0x1e')](_0x28d0f1[_0x6400('0x2e')][_0x6400('0x1e')]);_0x588a6f[_0x6400('0x20')]=qs[_0x6400('0x20')](_0x28d0f1[_0x6400('0x2e')]['offset']);}_0x588a6f[_0x6400('0x35')]=qs[_0x6400('0x36')](_0x28d0f1[_0x6400('0x2e')][_0x6400('0x36')]);_0x588a6f[_0x6400('0x37')]=qs[_0x6400('0x2f')](_[_0x6400('0x38')](_0x28d0f1[_0x6400('0x2e')],_0x3f9927['filters']),_0x45f2c1);if(_0x28d0f1[_0x6400('0x2e')]['filter']){_0x588a6f[_0x6400('0x37')]=_['merge'](_0x588a6f['where'],{'$or':_[_0x6400('0x29')](_0x45f2c1,function(_0x2e29bf){if(_0x2e29bf[_0x6400('0x39')]!==_0x6400('0x3a')){var _0x56309e={};_0x56309e[_0x2e29bf['name']]={'$like':'%'+_0x28d0f1[_0x6400('0x2e')][_0x6400('0x3b')]+'%'};return _0x56309e;}})});}_0x588a6f=_[_0x6400('0x3c')]({},_0x588a6f,_0x28d0f1[_0x6400('0x3d')]);var _0x144140={'where':_0x588a6f['where']};return db[_0x6400('0x3e')][_0x6400('0x1f')](_0x144140)[_0x6400('0x3f')](function(_0x5e119b){_0x27c9a5['count']=_0x5e119b;if(_0x28d0f1[_0x6400('0x2e')][_0x6400('0x40')]){_0x588a6f[_0x6400('0x41')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x6400('0x42')](_0x588a6f);})['then'](function(_0x4b4801){_0x27c9a5[_0x6400('0x43')]=_0x4b4801;return _0x27c9a5;})['then'](respondWithFilteredResult(_0xb9ad10,_0x588a6f))['catch'](handleError(_0xb9ad10,null));};exports[_0x6400('0x44')]=function(_0x22e052,_0x4effe8){var _0x50681d={'raw':!![],'where':{'id':_0x22e052[_0x6400('0x45')]['id']}},_0x353722={};_0x353722[_0x6400('0x2c')]=_[_0x6400('0x2d')](db[_0x6400('0x3e')]['rawAttributes']);_0x353722['query']=_['keys'](_0x22e052[_0x6400('0x2e')]);_0x353722[_0x6400('0x2f')]=_[_0x6400('0x30')](_0x353722[_0x6400('0x2c')],_0x353722[_0x6400('0x2e')]);_0x50681d[_0x6400('0x31')]=_[_0x6400('0x30')](_0x353722[_0x6400('0x2c')],qs[_0x6400('0x32')](_0x22e052['query'][_0x6400('0x32')]));_0x50681d[_0x6400('0x31')]=_0x50681d[_0x6400('0x31')][_0x6400('0x33')]?_0x50681d[_0x6400('0x31')]:_0x353722[_0x6400('0x2c')];if(_0x22e052[_0x6400('0x2e')][_0x6400('0x40')]){_0x50681d[_0x6400('0x41')]=[{'all':!![]}];}_0x50681d=_['merge']({},_0x50681d,_0x22e052[_0x6400('0x3d')]);return db[_0x6400('0x3e')]['find'](_0x50681d)[_0x6400('0x3f')](handleEntityNotFound(_0x4effe8,null))[_0x6400('0x3f')](respondWithResult(_0x4effe8,null))[_0x6400('0x46')](handleError(_0x4effe8,null));};exports[_0x6400('0x47')]=function(_0x44bc32,_0xad5836){return db[_0x6400('0x3e')][_0x6400('0x47')](_0x44bc32['body'],{})['then'](respondWithResult(_0xad5836,0xc9))[_0x6400('0x46')](handleError(_0xad5836,null));};exports[_0x6400('0x24')]=function(_0x1ea132,_0x4cda5a){if(_0x1ea132[_0x6400('0x48')]['id']){delete _0x1ea132[_0x6400('0x48')]['id'];}return db[_0x6400('0x3e')][_0x6400('0x49')]({'where':{'id':_0x1ea132[_0x6400('0x45')]['id']}})[_0x6400('0x3f')](handleEntityNotFound(_0x4cda5a,null))[_0x6400('0x3f')](saveUpdates(_0x1ea132[_0x6400('0x48')],null))['then'](respondWithResult(_0x4cda5a,null))['catch'](handleError(_0x4cda5a,null));};exports[_0x6400('0x4a')]=function(_0x231252,_0x559f30){return db[_0x6400('0x3e')][_0x6400('0x49')]({'where':{'id':_0x231252[_0x6400('0x45')]['id']}})[_0x6400('0x3f')](handleEntityNotFound(_0x559f30,null))[_0x6400('0x3f')](removeEntity(_0x559f30,null))[_0x6400('0x46')](handleError(_0x559f30,null));};exports[_0x6400('0x4b')]=function(_0x226246,_0x2818d7){return db[_0x6400('0x3e')][_0x6400('0x4b')]()[_0x6400('0x3f')](respondWithResult(_0x2818d7,null))[_0x6400('0x46')](handleError(_0x2818d7,null));}; \ No newline at end of file +var _0x479b=['send','map','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','type','VIRTUAL','name','options','FaxTransferReport','include','findAll','catch','show','keys','includeAll','find','create','body','params','describe','eml-format','zip-dir','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error'];(function(_0x38fb4d,_0x46c900){var _0x471a13=function(_0x1c395b){while(--_0x1c395b){_0x38fb4d['push'](_0x38fb4d['shift']());}};_0x471a13(++_0x46c900);}(_0x479b,0x13d));var _0xb479=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0x479b[_0x1b4b23];return _0x2a325b;};'use strict';var emlformat=require(_0xb479('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb479('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb479('0x2'));var moment=require(_0xb479('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb479('0x4'));var util=require(_0xb479('0x5'));var path=require('path');var sox=require(_0xb479('0x6'));var csv=require('to-csv');var ejs=require(_0xb479('0x7'));var fs=require('fs');var fs_extra=require(_0xb479('0x8'));var _=require(_0xb479('0x9'));var squel=require(_0xb479('0xa'));var crypto=require(_0xb479('0xb'));var jsforce=require(_0xb479('0xc'));var deskjs=require(_0xb479('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb479('0xe'));var Papa=require('papaparse');var Redis=require(_0xb479('0xf'));var authService=require(_0xb479('0x10'));var qs=require(_0xb479('0x11'));var as=require(_0xb479('0x12'));var hardwareService=require(_0xb479('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xb479('0x14'));var config=require(_0xb479('0x15'));var licenseUtil=require(_0xb479('0x16'));var db=require(_0xb479('0x17'))['db'];function respondWithStatusCode(_0x12ba3f,_0x1cf9fb){_0x1cf9fb=_0x1cf9fb||0xcc;return function(_0x26adfd){if(_0x26adfd){return _0x12ba3f['sendStatus'](_0x1cf9fb);}return _0x12ba3f[_0xb479('0x18')](_0x1cf9fb)[_0xb479('0x19')]();};}function respondWithResult(_0xfc1762,_0x5385f2){_0x5385f2=_0x5385f2||0xc8;return function(_0x8e2be6){if(_0x8e2be6){return _0xfc1762[_0xb479('0x18')](_0x5385f2)[_0xb479('0x1a')](_0x8e2be6);}};}function respondWithFilteredResult(_0x9cc282,_0x3ac703){return function(_0x46e375){if(_0x46e375){var _0x27b235=typeof _0x3ac703[_0xb479('0x1b')]===_0xb479('0x1c')&&typeof _0x3ac703[_0xb479('0x1d')]===_0xb479('0x1c');var _0x54d255=_0x46e375[_0xb479('0x1e')];var _0x57f033=_0x27b235?0x0:_0x3ac703[_0xb479('0x1b')];var _0x449ca0=_0x27b235?_0x46e375[_0xb479('0x1e')]:_0x3ac703[_0xb479('0x1b')]+_0x3ac703['limit'];var _0x13daf7;if(_0x449ca0>=_0x54d255){_0x449ca0=_0x54d255;_0x13daf7=0xc8;}else{_0x13daf7=0xce;}_0x9cc282['status'](_0x13daf7);return _0x9cc282[_0xb479('0x1f')](_0xb479('0x20'),_0x57f033+'-'+_0x449ca0+'/'+_0x54d255)[_0xb479('0x1a')](_0x46e375);}return null;};}function patchUpdates(_0x37a760){return function(_0x1d272f){try{jsonpatch['apply'](_0x1d272f,_0x37a760,!![]);}catch(_0x5160f1){return BPromise[_0xb479('0x21')](_0x5160f1);}return _0x1d272f['save']();};}function saveUpdates(_0x3dea6f,_0x14a377){return function(_0x5de8b2){if(_0x5de8b2){return _0x5de8b2[_0xb479('0x22')](_0x3dea6f)[_0xb479('0x23')](function(_0x21bbb1){return _0x21bbb1;});}return null;};}function removeEntity(_0x365515,_0x33c4e2){return function(_0x1c0ca8){if(_0x1c0ca8){return _0x1c0ca8[_0xb479('0x24')]()[_0xb479('0x23')](function(){_0x365515[_0xb479('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x218e09,_0x45f90){return function(_0x1a3513){if(!_0x1a3513){_0x218e09['sendStatus'](0x194);}return _0x1a3513;};}function handleError(_0x1dd25a,_0x4f8de5){_0x4f8de5=_0x4f8de5||0x1f4;return function(_0x2f1716){logger[_0xb479('0x25')](_0x2f1716['stack']);if(_0x2f1716['name']){delete _0x2f1716['name'];}_0x1dd25a[_0xb479('0x18')](_0x4f8de5)[_0xb479('0x26')](_0x2f1716);};}exports['index']=function(_0x29f184,_0x4b7f82){var _0x43cdb0={},_0x27e7ca={},_0xaa96cf={'count':0x0,'rows':[]};var _0x159ffe=_[_0xb479('0x27')](db['FaxTransferReport'][_0xb479('0x28')],function(_0x3fb97b){return{'name':_0x3fb97b['fieldName'],'type':_0x3fb97b['type'][_0xb479('0x29')]};});_0x27e7ca[_0xb479('0x2a')]=_[_0xb479('0x27')](_0x159ffe,'name');_0x27e7ca[_0xb479('0x2b')]=_['keys'](_0x29f184[_0xb479('0x2b')]);_0x27e7ca['filters']=_[_0xb479('0x2c')](_0x27e7ca[_0xb479('0x2a')],_0x27e7ca[_0xb479('0x2b')]);_0x43cdb0[_0xb479('0x2d')]=_[_0xb479('0x2c')](_0x27e7ca[_0xb479('0x2a')],qs[_0xb479('0x2e')](_0x29f184[_0xb479('0x2b')][_0xb479('0x2e')]));_0x43cdb0[_0xb479('0x2d')]=_0x43cdb0[_0xb479('0x2d')][_0xb479('0x2f')]?_0x43cdb0[_0xb479('0x2d')]:_0x27e7ca['model'];if(!_0x29f184[_0xb479('0x2b')][_0xb479('0x30')]('nolimit')){_0x43cdb0[_0xb479('0x1d')]=qs[_0xb479('0x1d')](_0x29f184[_0xb479('0x2b')][_0xb479('0x1d')]);_0x43cdb0[_0xb479('0x1b')]=qs[_0xb479('0x1b')](_0x29f184[_0xb479('0x2b')][_0xb479('0x1b')]);}_0x43cdb0['order']=qs[_0xb479('0x31')](_0x29f184[_0xb479('0x2b')]['sort']);_0x43cdb0[_0xb479('0x32')]=qs[_0xb479('0x33')](_[_0xb479('0x34')](_0x29f184[_0xb479('0x2b')],_0x27e7ca[_0xb479('0x33')]),_0x159ffe);if(_0x29f184['query'][_0xb479('0x35')]){_0x43cdb0[_0xb479('0x32')]=_[_0xb479('0x36')](_0x43cdb0['where'],{'$or':_[_0xb479('0x27')](_0x159ffe,function(_0x3f88ff){if(_0x3f88ff[_0xb479('0x37')]!==_0xb479('0x38')){var _0x517b1d={};_0x517b1d[_0x3f88ff[_0xb479('0x39')]]={'$like':'%'+_0x29f184['query'][_0xb479('0x35')]+'%'};return _0x517b1d;}})});}_0x43cdb0=_[_0xb479('0x36')]({},_0x43cdb0,_0x29f184[_0xb479('0x3a')]);var _0x4c9e22={'where':_0x43cdb0[_0xb479('0x32')]};return db[_0xb479('0x3b')][_0xb479('0x1e')](_0x4c9e22)[_0xb479('0x23')](function(_0x2707a7){_0xaa96cf['count']=_0x2707a7;if(_0x29f184[_0xb479('0x2b')]['includeAll']){_0x43cdb0[_0xb479('0x3c')]=[{'all':!![]}];}return db[_0xb479('0x3b')][_0xb479('0x3d')](_0x43cdb0);})[_0xb479('0x23')](function(_0x580381){_0xaa96cf['rows']=_0x580381;return _0xaa96cf;})[_0xb479('0x23')](respondWithFilteredResult(_0x4b7f82,_0x43cdb0))[_0xb479('0x3e')](handleError(_0x4b7f82,null));};exports[_0xb479('0x3f')]=function(_0x4fc7f1,_0x288e3e){var _0x25f538={'raw':!![],'where':{'id':_0x4fc7f1['params']['id']}},_0x2bd89f={};_0x2bd89f[_0xb479('0x2a')]=_[_0xb479('0x40')](db[_0xb479('0x3b')][_0xb479('0x28')]);_0x2bd89f[_0xb479('0x2b')]=_['keys'](_0x4fc7f1[_0xb479('0x2b')]);_0x2bd89f[_0xb479('0x33')]=_[_0xb479('0x2c')](_0x2bd89f['model'],_0x2bd89f[_0xb479('0x2b')]);_0x25f538[_0xb479('0x2d')]=_['intersection'](_0x2bd89f[_0xb479('0x2a')],qs[_0xb479('0x2e')](_0x4fc7f1[_0xb479('0x2b')][_0xb479('0x2e')]));_0x25f538['attributes']=_0x25f538['attributes']['length']?_0x25f538[_0xb479('0x2d')]:_0x2bd89f[_0xb479('0x2a')];if(_0x4fc7f1[_0xb479('0x2b')][_0xb479('0x41')]){_0x25f538[_0xb479('0x3c')]=[{'all':!![]}];}_0x25f538=_[_0xb479('0x36')]({},_0x25f538,_0x4fc7f1[_0xb479('0x3a')]);return db['FaxTransferReport'][_0xb479('0x42')](_0x25f538)[_0xb479('0x23')](handleEntityNotFound(_0x288e3e,null))[_0xb479('0x23')](respondWithResult(_0x288e3e,null))[_0xb479('0x3e')](handleError(_0x288e3e,null));};exports[_0xb479('0x43')]=function(_0x527dec,_0x7bbc46){return db[_0xb479('0x3b')][_0xb479('0x43')](_0x527dec[_0xb479('0x44')],{})['then'](respondWithResult(_0x7bbc46,0xc9))['catch'](handleError(_0x7bbc46,null));};exports[_0xb479('0x22')]=function(_0x49c32f,_0x1ffba5){if(_0x49c32f[_0xb479('0x44')]['id']){delete _0x49c32f[_0xb479('0x44')]['id'];}return db['FaxTransferReport'][_0xb479('0x42')]({'where':{'id':_0x49c32f[_0xb479('0x45')]['id']}})['then'](handleEntityNotFound(_0x1ffba5,null))[_0xb479('0x23')](saveUpdates(_0x49c32f[_0xb479('0x44')],null))[_0xb479('0x23')](respondWithResult(_0x1ffba5,null))[_0xb479('0x3e')](handleError(_0x1ffba5,null));};exports['destroy']=function(_0x566f5d,_0x1b7ce2){return db[_0xb479('0x3b')][_0xb479('0x42')]({'where':{'id':_0x566f5d[_0xb479('0x45')]['id']}})[_0xb479('0x23')](handleEntityNotFound(_0x1b7ce2,null))[_0xb479('0x23')](removeEntity(_0x1b7ce2,null))[_0xb479('0x3e')](handleError(_0x1b7ce2,null));};exports[_0xb479('0x46')]=function(_0x3b65cb,_0x5b4d50){return db[_0xb479('0x3b')][_0xb479('0x46')]()[_0xb479('0x23')](respondWithResult(_0x5b4d50,null))[_0xb479('0x3e')](handleError(_0x5b4d50,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 6637082..a052dfe 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 _0x9d77=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','../../config/logger'];(function(_0x48c8a9,_0x4306d2){var _0x3e0339=function(_0x14bdf7){while(--_0x14bdf7){_0x48c8a9['push'](_0x48c8a9['shift']());}};_0x3e0339(++_0x4306d2);}(_0x9d77,0x144));var _0x79d7=function(_0x2eddb1,_0x40a503){_0x2eddb1=_0x2eddb1-0x0;var _0x36681d=_0x9d77[_0x2eddb1];return _0x36681d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x79d7('0x0'))(_0x79d7('0x1'));var moment=require(_0x79d7('0x2'));var BPromise=require(_0x79d7('0x3'));var rp=require(_0x79d7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x79d7('0x5'));var config=require(_0x79d7('0x6'));var attributes=require(_0x79d7('0x7'));module[_0x79d7('0x8')]=function(_0x19f61e,_0x4f646e){return _0x19f61e[_0x79d7('0x9')](_0x79d7('0xa'),attributes,{'tableName':_0x79d7('0xb'),'paranoid':![],'indexes':[{'name':_0x79d7('0xc'),'fields':[_0x79d7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xccf3=['moment','bluebird','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','api'];(function(_0x4b4714,_0x345ed4){var _0x2140ec=function(_0x2de9da){while(--_0x2de9da){_0x4b4714['push'](_0x4b4714['shift']());}};_0x2140ec(++_0x345ed4);}(_0xccf3,0x1d3));var _0x3ccf=function(_0x2df6b5,_0x5337e5){_0x2df6b5=_0x2df6b5-0x0;var _0x49d098=_0xccf3[_0x2df6b5];return _0x49d098;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3ccf('0x0'));var moment=require(_0x3ccf('0x1'));var BPromise=require(_0x3ccf('0x2'));var rp=require(_0x3ccf('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3ccf('0x4'));var config=require(_0x3ccf('0x5'));var attributes=require(_0x3ccf('0x6'));module[_0x3ccf('0x7')]=function(_0x45a684,_0x596cca){return _0x45a684[_0x3ccf('0x8')](_0x3ccf('0x9'),attributes,{'tableName':_0x3ccf('0xa'),'paranoid':![],'indexes':[{'name':_0x3ccf('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index c63b896..b78fc01 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 _0xa2f2=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x13a60c,_0xb8b08e){var _0x3a2a5f=function(_0x15e410){while(--_0x15e410){_0x13a60c['push'](_0x13a60c['shift']());}};_0x3a2a5f(++_0xb8b08e);}(_0xa2f2,0xe1));var _0x2a2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa2f2[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x2a2f('0x0'));var util=require(_0x2a2f('0x1'));var moment=require(_0x2a2f('0x2'));var BPromise=require(_0x2a2f('0x3'));var rs=require(_0x2a2f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a2f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2a2f('0x6'))(_0x2a2f('0x7'));var config=require(_0x2a2f('0x8'));var jayson=require(_0x2a2f('0x9'));var client=jayson['client'][_0x2a2f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf23c61,_0x94531,_0x423b37){return new BPromise(function(_0x4800fd,_0x4d3500){return client['request'](_0xf23c61,_0x423b37)[_0x2a2f('0xb')](function(_0x508d09){logger[_0x2a2f('0xc')](_0x2a2f('0xd'),_0x94531,_0x2a2f('0xe'));logger[_0x2a2f('0xf')](_0x2a2f('0x10'),_0x94531,_0x2a2f('0xe'),JSON[_0x2a2f('0x11')](_0x508d09));if(_0x508d09[_0x2a2f('0x12')]){if(_0x508d09[_0x2a2f('0x12')][_0x2a2f('0x13')]===0x1f4){logger[_0x2a2f('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x94531,_0x508d09['error']['message']);return _0x4d3500(_0x508d09[_0x2a2f('0x12')]['message']);}logger[_0x2a2f('0x12')](_0x2a2f('0xd'),_0x94531,_0x508d09[_0x2a2f('0x12')][_0x2a2f('0x14')]);return _0x4800fd(_0x508d09[_0x2a2f('0x12')][_0x2a2f('0x14')]);}else{logger['info'](_0x2a2f('0xd'),_0x94531,_0x2a2f('0xe'));_0x4800fd(_0x508d09['result'][_0x2a2f('0x14')]);}})[_0x2a2f('0x15')](function(_0x4c0642){logger[_0x2a2f('0x12')](_0x2a2f('0xd'),_0x94531,_0x4c0642);_0x4d3500(_0x4c0642);});});} \ No newline at end of file +var _0x5246=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x189061,_0x21d774){var _0x257e15=function(_0x1e4a36){while(--_0x1e4a36){_0x189061['push'](_0x189061['shift']());}};_0x257e15(++_0x21d774);}(_0x5246,0x17a));var _0x6524=function(_0x10ba89,_0x5391fe){_0x10ba89=_0x10ba89-0x0;var _0x4d78e3=_0x5246[_0x10ba89];return _0x4d78e3;};'use strict';var _=require(_0x6524('0x0'));var util=require(_0x6524('0x1'));var moment=require(_0x6524('0x2'));var BPromise=require(_0x6524('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6524('0x4'));var db=require(_0x6524('0x5'))['db'];var utils=require(_0x6524('0x6'));var logger=require(_0x6524('0x7'))(_0x6524('0x8'));var config=require(_0x6524('0x9'));var jayson=require(_0x6524('0xa'));var client=jayson[_0x6524('0xb')][_0x6524('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2685be,_0x35e10d,_0x33f38b){return new BPromise(function(_0xf8acb2,_0xcce8f8){return client[_0x6524('0xd')](_0x2685be,_0x33f38b)[_0x6524('0xe')](function(_0x186b01){logger[_0x6524('0xf')](_0x6524('0x10'),_0x35e10d,_0x6524('0x11'));logger['debug'](_0x6524('0x12'),_0x35e10d,_0x6524('0x11'),JSON[_0x6524('0x13')](_0x186b01));if(_0x186b01['error']){if(_0x186b01['error'][_0x6524('0x14')]===0x1f4){logger[_0x6524('0x15')](_0x6524('0x10'),_0x35e10d,_0x186b01[_0x6524('0x15')][_0x6524('0x16')]);return _0xcce8f8(_0x186b01[_0x6524('0x15')][_0x6524('0x16')]);}logger[_0x6524('0x15')]('FaxTransferReport,\x20%s,\x20%s',_0x35e10d,_0x186b01[_0x6524('0x15')][_0x6524('0x16')]);return _0xf8acb2(_0x186b01[_0x6524('0x15')]['message']);}else{logger[_0x6524('0xf')](_0x6524('0x10'),_0x35e10d,_0x6524('0x11'));_0xf8acb2(_0x186b01[_0x6524('0x17')][_0x6524('0x16')]);}})[_0x6524('0x18')](function(_0x2437c4){logger[_0x6524('0x15')](_0x6524('0x10'),_0x35e10d,_0x2437c4);_0xcce8f8(_0x2437c4);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 55374f4..2ad54aa 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 _0x46ed=['destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update'];(function(_0x4154ae,_0x3b63b5){var _0x4c83f7=function(_0x516ece){while(--_0x516ece){_0x4154ae['push'](_0x4154ae['shift']());}};_0x4c83f7(++_0x3b63b5);}(_0x46ed,0x158));var _0xd46e=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x46ed[_0x1928c9];return _0x51b5fb;};'use strict';var multer=require('multer');var util=require(_0xd46e('0x0'));var path=require(_0xd46e('0x1'));var timeout=require(_0xd46e('0x2'));var express=require(_0xd46e('0x3'));var router=express[_0xd46e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd46e('0x5'));var config=require(_0xd46e('0x6'));var controller=require(_0xd46e('0x7'));router[_0xd46e('0x8')]('/',auth[_0xd46e('0x9')](),controller[_0xd46e('0xa')]);router['get'](_0xd46e('0xb'),auth[_0xd46e('0x9')](),controller[_0xd46e('0xc')]);router[_0xd46e('0x8')](_0xd46e('0xd'),auth[_0xd46e('0x9')](),controller[_0xd46e('0xe')]);router['post']('/',auth[_0xd46e('0x9')](),controller[_0xd46e('0xf')]);router['put'](_0xd46e('0xd'),auth[_0xd46e('0x9')](),controller[_0xd46e('0x10')]);router['delete']('/:id',auth[_0xd46e('0x9')](),controller[_0xd46e('0x11')]);module[_0xd46e('0x12')]=router; \ No newline at end of file +var _0xf374=['/describe','describe','show','post','create','put','update','delete','/:id','exports','multer','Router','../../config/environment','get','isAuthenticated','index'];(function(_0x1de242,_0x2577dc){var _0x128086=function(_0x5d39ef){while(--_0x5d39ef){_0x1de242['push'](_0x1de242['shift']());}};_0x128086(++_0x2577dc);}(_0xf374,0x16a));var _0x4f37=function(_0x73235,_0x121798){_0x73235=_0x73235-0x0;var _0x5ed233=_0xf374[_0x73235];return _0x5ed233;};'use strict';var multer=require(_0x4f37('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4f37('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4f37('0x2'));var controller=require('./faxTransferReport.controller');router[_0x4f37('0x3')]('/',auth[_0x4f37('0x4')](),controller[_0x4f37('0x5')]);router[_0x4f37('0x3')](_0x4f37('0x6'),auth['isAuthenticated'](),controller[_0x4f37('0x7')]);router[_0x4f37('0x3')]('/:id',auth[_0x4f37('0x4')](),controller[_0x4f37('0x8')]);router[_0x4f37('0x9')]('/',auth['isAuthenticated'](),controller[_0x4f37('0xa')]);router[_0x4f37('0xb')]('/:id',auth[_0x4f37('0x4')](),controller[_0x4f37('0xc')]);router[_0x4f37('0xd')](_0x4f37('0xe'),auth[_0x4f37('0x4')](),controller['destroy']);module[_0x4f37('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 638dd7d..d2ab2d0 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 _0x7cd4=['create','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post'];(function(_0xf46ca0,_0x3349f7){var _0x5e1b57=function(_0x5f3c99){while(--_0x5f3c99){_0xf46ca0['push'](_0xf46ca0['shift']());}};_0x5e1b57(++_0x3349f7);}(_0x7cd4,0x186));var _0x47cd=function(_0x4289b0,_0x2277a0){_0x4289b0=_0x4289b0-0x0;var _0x3f46c5=_0x7cd4[_0x4289b0];return _0x3f46c5;};'use strict';var multer=require(_0x47cd('0x0'));var util=require(_0x47cd('0x1'));var path=require(_0x47cd('0x2'));var timeout=require(_0x47cd('0x3'));var express=require(_0x47cd('0x4'));var router=express[_0x47cd('0x5')]();var fs_extra=require(_0x47cd('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x47cd('0x7'));var config=require(_0x47cd('0x8'));var controller=require(_0x47cd('0x9'));router[_0x47cd('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x47cd('0xa')](_0x47cd('0xb'),auth[_0x47cd('0xc')](),controller[_0x47cd('0xd')]);router[_0x47cd('0xa')](_0x47cd('0xe'),auth[_0x47cd('0xc')](),controller[_0x47cd('0xf')]);router['get']('/:id/fields',auth[_0x47cd('0xc')](),controller[_0x47cd('0x10')]);router[_0x47cd('0x11')]('/',auth[_0x47cd('0xc')](),controller[_0x47cd('0x12')]);router[_0x47cd('0x11')](_0x47cd('0xe'),auth[_0x47cd('0xc')](),controller[_0x47cd('0x13')]);router[_0x47cd('0x14')](_0x47cd('0xb'),auth['isAuthenticated'](),controller[_0x47cd('0x15')]);router[_0x47cd('0x16')]('/:id',auth[_0x47cd('0xc')](),controller[_0x47cd('0x17')]);module['exports']=router; \ No newline at end of file +var _0x0819=['get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller'];(function(_0x126fb9,_0x122c59){var _0xc8a3b1=function(_0x355744){while(--_0x355744){_0x126fb9['push'](_0x126fb9['shift']());}};_0xc8a3b1(++_0x122c59);}(_0x0819,0xea));var _0x9081=function(_0x55a406,_0xf60a58){_0x55a406=_0x55a406-0x0;var _0x27469b=_0x0819[_0x55a406];return _0x27469b;};'use strict';var multer=require('multer');var util=require(_0x9081('0x0'));var path=require(_0x9081('0x1'));var timeout=require(_0x9081('0x2'));var express=require(_0x9081('0x3'));var router=express['Router']();var fs_extra=require(_0x9081('0x4'));var auth=require(_0x9081('0x5'));var interaction=require(_0x9081('0x6'));var config=require('../../config/environment');var controller=require(_0x9081('0x7'));router[_0x9081('0x8')]('/',auth['isAuthenticated'](),controller[_0x9081('0x9')]);router[_0x9081('0x8')](_0x9081('0xa'),auth[_0x9081('0xb')](),controller[_0x9081('0xc')]);router[_0x9081('0x8')](_0x9081('0xd'),auth['isAuthenticated'](),controller[_0x9081('0xe')]);router['get']('/:id/fields',auth[_0x9081('0xb')](),controller[_0x9081('0xf')]);router[_0x9081('0x10')]('/',auth[_0x9081('0xb')](),controller[_0x9081('0x11')]);router['post'](_0x9081('0xd'),auth[_0x9081('0xb')](),controller[_0x9081('0x12')]);router[_0x9081('0x13')](_0x9081('0xa'),auth[_0x9081('0xb')](),controller[_0x9081('0x14')]);router['delete'](_0x9081('0xa'),auth[_0x9081('0xb')](),controller[_0x9081('0x15')]);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 c8cae3b..fd84ce3 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 _0xd49b=['basic','newTab','integrationTab','sequelize','exports','STRING','ENUM'];(function(_0x356935,_0x8bba70){var _0x304791=function(_0x99d281){while(--_0x99d281){_0x356935['push'](_0x356935['shift']());}};_0x304791(++_0x8bba70);}(_0xd49b,0x1ed));var _0xbd49=function(_0xc69fda,_0x367f93){_0xc69fda=_0xc69fda-0x0;var _0x721842=_0xd49b[_0xc69fda];return _0x721842;};'use strict';var Sequelize=require(_0xbd49('0x0'));module[_0xbd49('0x1')]={'name':{'type':Sequelize[_0xbd49('0x2')]},'description':{'type':Sequelize[_0xbd49('0x2')]},'username':{'type':Sequelize[_0xbd49('0x2')]},'remoteUri':{'type':Sequelize[_0xbd49('0x2')]},'authType':{'type':Sequelize[_0xbd49('0x3')](_0xbd49('0x4')),'defaultValue':_0xbd49('0x4')},'password':{'type':Sequelize[_0xbd49('0x2')]},'consumerKey':{'type':Sequelize[_0xbd49('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xbd49('0x2')]},'tokenSecret':{'type':Sequelize[_0xbd49('0x2')]},'serverUrl':{'type':Sequelize[_0xbd49('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbd49('0x3')]('integrationTab',_0xbd49('0x5')),'defaultValue':_0xbd49('0x6')}}; \ No newline at end of file +var _0x6093=['sequelize','exports','STRING','basic','ENUM','integrationTab','newTab'];(function(_0x42b902,_0x3c49fd){var _0x2d9d68=function(_0x2175bf){while(--_0x2175bf){_0x42b902['push'](_0x42b902['shift']());}};_0x2d9d68(++_0x3c49fd);}(_0x6093,0xf5));var _0x3609=function(_0x28f5db,_0x1c4346){_0x28f5db=_0x28f5db-0x0;var _0x3c0308=_0x6093[_0x28f5db];return _0x3c0308;};'use strict';var Sequelize=require(_0x3609('0x0'));module[_0x3609('0x1')]={'name':{'type':Sequelize[_0x3609('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x3609('0x2')]},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':_0x3609('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x3609('0x2')]},'consumerSecret':{'type':Sequelize[_0x3609('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x3609('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3609('0x4')](_0x3609('0x5'),_0x3609('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 2f2d647..97a4acb 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 _0x1048=['bluebird','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','status','end','json','undefined','limit','offset','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','index','rawAttributes','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','options','count','includeAll','include','DeskAccount','findAll','catch','filters','find','create','body','params','getConfigurations','findOne','DeskConfiguration','merge','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','Authorization','toString','base64','concat','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x1dd696,_0xb7397f){var _0x464809=function(_0xf0d82b){while(--_0xf0d82b){_0x1dd696['push'](_0x1dd696['shift']());}};_0x464809(++_0xb7397f);}(_0x1048,0x69));var _0x8104=function(_0x22aff5,_0x3f3602){_0x22aff5=_0x22aff5-0x0;var _0x29eb99=_0x1048[_0x22aff5];return _0x29eb99;};'use strict';var emlformat=require(_0x8104('0x0'));var rimraf=require(_0x8104('0x1'));var zipdir=require(_0x8104('0x2'));var jsonpatch=require(_0x8104('0x3'));var rp=require(_0x8104('0x4'));var moment=require(_0x8104('0x5'));var BPromise=require(_0x8104('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8104('0x7'));var sox=require(_0x8104('0x8'));var csv=require('to-csv');var ejs=require(_0x8104('0x9'));var fs=require('fs');var fs_extra=require(_0x8104('0xa'));var _=require(_0x8104('0xb'));var squel=require(_0x8104('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8104('0xd'));var toCsv=require(_0x8104('0xe'));var querystring=require('querystring');var Papa=require(_0x8104('0xf'));var Redis=require(_0x8104('0x10'));var authService=require(_0x8104('0x11'));var qs=require(_0x8104('0x12'));var as=require(_0x8104('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8104('0x14'))(_0x8104('0x15'));var utils=require(_0x8104('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8104('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8104('0x18'));function respondWithStatusCode(_0x3e290f,_0x562521){_0x562521=_0x562521||0xcc;return function(_0x4bdfcd){if(_0x4bdfcd){return _0x3e290f['sendStatus'](_0x562521);}return _0x3e290f[_0x8104('0x19')](_0x562521)[_0x8104('0x1a')]();};}function respondWithResult(_0x214c78,_0x2b5192){_0x2b5192=_0x2b5192||0xc8;return function(_0x2ec159){if(_0x2ec159){return _0x214c78[_0x8104('0x19')](_0x2b5192)[_0x8104('0x1b')](_0x2ec159);}};}function respondWithFilteredResult(_0x556505,_0x5ad3ac){return function(_0x143b60){if(_0x143b60){var _0xae0c10=typeof _0x5ad3ac['offset']===_0x8104('0x1c')&&typeof _0x5ad3ac[_0x8104('0x1d')]===_0x8104('0x1c');var _0x3d485f=_0x143b60['count'];var _0x247b0f=_0xae0c10?0x0:_0x5ad3ac[_0x8104('0x1e')];var _0x521165=_0xae0c10?_0x143b60['count']:_0x5ad3ac[_0x8104('0x1e')]+_0x5ad3ac[_0x8104('0x1d')];var _0x158b18;if(_0x521165>=_0x3d485f){_0x521165=_0x3d485f;_0x158b18=0xc8;}else{_0x158b18=0xce;}_0x556505[_0x8104('0x19')](_0x158b18);return _0x556505['set'](_0x8104('0x1f'),_0x247b0f+'-'+_0x521165+'/'+_0x3d485f)[_0x8104('0x1b')](_0x143b60);}return null;};}function patchUpdates(_0x1383a3){return function(_0x3e9842){try{jsonpatch['apply'](_0x3e9842,_0x1383a3,!![]);}catch(_0x3ad1ef){return BPromise[_0x8104('0x20')](_0x3ad1ef);}return _0x3e9842[_0x8104('0x21')]();};}function saveUpdates(_0x5e802b,_0xfdc3f){return function(_0x27aad7){if(_0x27aad7){return _0x27aad7[_0x8104('0x22')](_0x5e802b)['then'](function(_0x4de627){return _0x4de627;});}return null;};}function removeEntity(_0x13b57f,_0x32868f){return function(_0x4f74d1){if(_0x4f74d1){return _0x4f74d1[_0x8104('0x23')]()[_0x8104('0x24')](function(){_0x13b57f[_0x8104('0x19')](0xcc)[_0x8104('0x1a')]();});}};}function handleEntityNotFound(_0x5cbb4f,_0x3aede0){return function(_0x49feb5){if(!_0x49feb5){_0x5cbb4f[_0x8104('0x25')](0x194);}return _0x49feb5;};}function handleError(_0x2aeac7,_0x4ca0b8){_0x4ca0b8=_0x4ca0b8||0x1f4;return function(_0xf5c704){logger[_0x8104('0x26')](_0xf5c704[_0x8104('0x27')]);if(_0xf5c704[_0x8104('0x28')]){delete _0xf5c704[_0x8104('0x28')];}_0x2aeac7[_0x8104('0x19')](_0x4ca0b8)['send'](_0xf5c704);};}exports[_0x8104('0x29')]=function(_0x460af1,_0x27c591){var _0x401831={},_0x383610={},_0x169b24={'count':0x0,'rows':[]};var _0x4bdc72=_['map'](db['DeskAccount'][_0x8104('0x2a')],function(_0x5c7f3b){return{'name':_0x5c7f3b['fieldName'],'type':_0x5c7f3b[_0x8104('0x2b')][_0x8104('0x2c')]};});_0x383610[_0x8104('0x2d')]=_[_0x8104('0x2e')](_0x4bdc72,_0x8104('0x28'));_0x383610[_0x8104('0x2f')]=_[_0x8104('0x30')](_0x460af1[_0x8104('0x2f')]);_0x383610['filters']=_[_0x8104('0x31')](_0x383610[_0x8104('0x2d')],_0x383610['query']);_0x401831['attributes']=_[_0x8104('0x31')](_0x383610[_0x8104('0x2d')],qs['fields'](_0x460af1[_0x8104('0x2f')][_0x8104('0x32')]));_0x401831['attributes']=_0x401831[_0x8104('0x33')][_0x8104('0x34')]?_0x401831['attributes']:_0x383610[_0x8104('0x2d')];if(!_0x460af1[_0x8104('0x2f')][_0x8104('0x35')]('nolimit')){_0x401831[_0x8104('0x1d')]=qs[_0x8104('0x1d')](_0x460af1[_0x8104('0x2f')]['limit']);_0x401831['offset']=qs['offset'](_0x460af1[_0x8104('0x2f')][_0x8104('0x1e')]);}_0x401831[_0x8104('0x36')]=qs[_0x8104('0x37')](_0x460af1[_0x8104('0x2f')][_0x8104('0x37')]);_0x401831[_0x8104('0x38')]=qs['filters'](_[_0x8104('0x39')](_0x460af1[_0x8104('0x2f')],_0x383610['filters']),_0x4bdc72);if(_0x460af1[_0x8104('0x2f')][_0x8104('0x3a')]){_0x401831[_0x8104('0x38')]=_['merge'](_0x401831[_0x8104('0x38')],{'$or':_['map'](_0x4bdc72,function(_0x126abd){if(_0x126abd[_0x8104('0x2b')]!=='VIRTUAL'){var _0x123e73={};_0x123e73[_0x126abd[_0x8104('0x28')]]={'$like':'%'+_0x460af1[_0x8104('0x2f')][_0x8104('0x3a')]+'%'};return _0x123e73;}})});}_0x401831=_['merge']({},_0x401831,_0x460af1[_0x8104('0x3b')]);var _0x46c082={'where':_0x401831[_0x8104('0x38')]};return db['DeskAccount'][_0x8104('0x3c')](_0x46c082)[_0x8104('0x24')](function(_0x589f31){_0x169b24['count']=_0x589f31;if(_0x460af1[_0x8104('0x2f')][_0x8104('0x3d')]){_0x401831[_0x8104('0x3e')]=[{'all':!![]}];}return db[_0x8104('0x3f')][_0x8104('0x40')](_0x401831);})[_0x8104('0x24')](function(_0x5a5ac1){_0x169b24['rows']=_0x5a5ac1;return _0x169b24;})[_0x8104('0x24')](respondWithFilteredResult(_0x27c591,_0x401831))[_0x8104('0x41')](handleError(_0x27c591,null));};exports['show']=function(_0x13035d,_0x2dd119){var _0x1cafc3={'raw':![],'where':{'id':_0x13035d['params']['id']}},_0x3abe38={};_0x3abe38[_0x8104('0x2d')]=_['keys'](db[_0x8104('0x3f')][_0x8104('0x2a')]);_0x3abe38[_0x8104('0x2f')]=_[_0x8104('0x30')](_0x13035d[_0x8104('0x2f')]);_0x3abe38[_0x8104('0x42')]=_[_0x8104('0x31')](_0x3abe38[_0x8104('0x2d')],_0x3abe38[_0x8104('0x2f')]);_0x1cafc3[_0x8104('0x33')]=_[_0x8104('0x31')](_0x3abe38[_0x8104('0x2d')],qs[_0x8104('0x32')](_0x13035d[_0x8104('0x2f')][_0x8104('0x32')]));_0x1cafc3['attributes']=_0x1cafc3[_0x8104('0x33')]['length']?_0x1cafc3[_0x8104('0x33')]:_0x3abe38[_0x8104('0x2d')];if(_0x13035d['query'][_0x8104('0x3d')]){_0x1cafc3[_0x8104('0x3e')]=[{'all':!![]}];}_0x1cafc3=_['merge']({},_0x1cafc3,_0x13035d['options']);return db[_0x8104('0x3f')][_0x8104('0x43')](_0x1cafc3)['then'](handleEntityNotFound(_0x2dd119,null))['then'](respondWithResult(_0x2dd119,null))['catch'](handleError(_0x2dd119,null));};exports[_0x8104('0x44')]=function(_0x4762aa,_0xcc5ce8){return db[_0x8104('0x3f')][_0x8104('0x44')](_0x4762aa[_0x8104('0x45')],{})[_0x8104('0x24')](respondWithResult(_0xcc5ce8,0xc9))[_0x8104('0x41')](handleError(_0xcc5ce8,null));};exports[_0x8104('0x22')]=function(_0x1ff8b3,_0xe5672a){if(_0x1ff8b3[_0x8104('0x45')]['id']){delete _0x1ff8b3['body']['id'];}return db['DeskAccount'][_0x8104('0x43')]({'where':{'id':_0x1ff8b3['params']['id']}})[_0x8104('0x24')](handleEntityNotFound(_0xe5672a,null))['then'](saveUpdates(_0x1ff8b3[_0x8104('0x45')],null))['then'](respondWithResult(_0xe5672a,null))['catch'](handleError(_0xe5672a,null));};exports[_0x8104('0x23')]=function(_0x28c5cd,_0x8f14f9){return db['DeskAccount']['find']({'where':{'id':_0x28c5cd[_0x8104('0x46')]['id']}})[_0x8104('0x24')](handleEntityNotFound(_0x8f14f9,null))[_0x8104('0x24')](removeEntity(_0x8f14f9,null))[_0x8104('0x41')](handleError(_0x8f14f9,null));};exports[_0x8104('0x47')]=function(_0x45f8bf,_0x5e47ee,_0x6eb9d1){var _0x4a4561={};var _0x473db8={};var _0x32b9e7;var _0x28c72c;return db[_0x8104('0x3f')][_0x8104('0x48')]({'where':{'id':_0x45f8bf['params']['id']}})['then'](handleEntityNotFound(_0x5e47ee,null))[_0x8104('0x24')](function(_0x2c0826){if(_0x2c0826){_0x32b9e7=_0x2c0826;_0x473db8[_0x8104('0x2d')]=_[_0x8104('0x30')](db[_0x8104('0x49')][_0x8104('0x2a')]);_0x473db8['query']=_[_0x8104('0x30')](_0x45f8bf[_0x8104('0x2f')]);_0x473db8['filters']=_[_0x8104('0x31')](_0x473db8[_0x8104('0x2d')],_0x473db8[_0x8104('0x2f')]);_0x4a4561['attributes']=_[_0x8104('0x31')](_0x473db8[_0x8104('0x2d')],qs[_0x8104('0x32')](_0x45f8bf['query']['fields']));_0x4a4561[_0x8104('0x33')]=_0x4a4561[_0x8104('0x33')]['length']?_0x4a4561['attributes']:_0x473db8[_0x8104('0x2d')];_0x4a4561['order']=qs[_0x8104('0x37')](_0x45f8bf[_0x8104('0x2f')]['sort']);_0x4a4561['where']=qs[_0x8104('0x42')](_[_0x8104('0x39')](_0x45f8bf[_0x8104('0x2f')],_0x473db8[_0x8104('0x42')]));if(_0x45f8bf[_0x8104('0x2f')][_0x8104('0x3a')]){_0x4a4561[_0x8104('0x38')]=_[_0x8104('0x4a')](_0x4a4561['where'],{'$or':_[_0x8104('0x2e')](_0x4a4561['attributes'],function(_0xe42719){var _0x1758c1={};_0x1758c1[_0xe42719]={'$like':'%'+_0x45f8bf[_0x8104('0x2f')]['filter']+'%'};return _0x1758c1;})});}_0x4a4561=_['merge']({},_0x4a4561,_0x45f8bf[_0x8104('0x3b')]);return _0x32b9e7[_0x8104('0x47')](_0x4a4561);}})[_0x8104('0x24')](function(_0x4ff170){if(_0x4ff170){_0x28c72c=_0x4ff170[_0x8104('0x34')];if(!_0x45f8bf[_0x8104('0x2f')]['hasOwnProperty'](_0x8104('0x4b'))){_0x4a4561['limit']=qs['limit'](_0x45f8bf[_0x8104('0x2f')][_0x8104('0x1d')]);_0x4a4561['offset']=qs[_0x8104('0x1e')](_0x45f8bf[_0x8104('0x2f')]['offset']);}return _0x32b9e7[_0x8104('0x47')](_0x4a4561);}})[_0x8104('0x24')](function(_0x145884){if(_0x145884){return _0x145884?{'count':_0x28c72c,'rows':_0x145884}:null;}})['then'](respondWithResult(_0x5e47ee,null))['catch'](handleError(_0x5e47ee,null));};exports[_0x8104('0x4c')]=function(_0x3240da,_0x1e81f2,_0x499985){if(_0x3240da[_0x8104('0x45')]['id']){delete _0x3240da[_0x8104('0x45')]['id'];}return db['DeskAccount'][_0x8104('0x48')]({'where':{'id':_0x3240da[_0x8104('0x46')]['id']}})[_0x8104('0x24')](handleEntityNotFound(_0x1e81f2,null))[_0x8104('0x24')](function(_0x319175){if(_0x319175){_0x3240da[_0x8104('0x45')]['AccountId']=_0x319175['id'];_0x3240da['body'][_0x8104('0x4d')]=integrations[_0x8104('0x4e')](_0x3240da['body'][_0x8104('0x4f')],_0x3240da['body'][_0x8104('0x2b')]);_0x3240da['body'][_0x8104('0x50')]=integrations[_0x8104('0x51')](_0x3240da['body']['channel'],_0x3240da['body']['type']);return db['DeskConfiguration'][_0x8104('0x44')](_0x3240da['body'],{'include':[{'model':db[_0x8104('0x52')],'as':_0x8104('0x4d')},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})[_0x8104('0x24')](respondWithResult(_0x1e81f2,null))['catch'](handleError(_0x1e81f2,null));};exports[_0x8104('0x53')]=function(_0xeda2f0,_0x324d5c,_0x11f379){var _0x4451cf=[{'name':_0x8104('0x54'),'label':_0x8104('0x54'),'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 _0xac6d22='';return db['DeskAccount'][_0x8104('0x48')]({'where':{'id':_0xeda2f0[_0x8104('0x46')]['id']},'attributes':['id',_0x8104('0x55'),_0x8104('0x56'),_0x8104('0x57'),_0x8104('0x58'),_0x8104('0x59'),_0x8104('0x5a'),'token','tokenSecret']})[_0x8104('0x24')](handleEntityNotFound(_0x324d5c,null))['then'](function(_0x5332f8){if(_0x5332f8){_0xac6d22=_0x5332f8['remoteUri'];var _0x31cfe4=_0xac6d22['slice'](-0x1);if(_0x31cfe4==='/'){_0xac6d22=_0xac6d22[_0x8104('0x5b')](0x0,_0xac6d22[_0x8104('0x5c')](_0x31cfe4));}var _0x1ded18={'method':_0x8104('0x5d'),'uri':util[_0x8104('0x5e')](_0x8104('0x5f'),_0xac6d22),'headers':{'Content-Type':_0x8104('0x60'),'Accept':_0x8104('0x60')},'json':!![]};if(_0x5332f8[_0x8104('0x56')]==='basic'){_0x1ded18['headers'][_0x8104('0x61')]=util[_0x8104('0x5e')]('Basic\x20%s',new Buffer(util[_0x8104('0x5e')]('%s:%s',_0x5332f8[_0x8104('0x57')],_0x5332f8[_0x8104('0x58')]))[_0x8104('0x62')](_0x8104('0x63')));}return rp(_0x1ded18)[_0x8104('0x24')](function(_0x3e86e0){return _0x4451cf[_0x8104('0x64')](_[_0x8104('0x2e')](_0x3e86e0[_0x8104('0x65')][_0x8104('0x66')],function(_0x3fcb54){return{'id':_0x3fcb54[_0x8104('0x28')],'name':_0x3fcb54[_0x8104('0x28')],'type':_0x3fcb54[_0x8104('0x2b')],'active':_0x3fcb54[_0x8104('0x67')],'label':_0x3fcb54[_0x8104('0x68')],'custom':!![]};}));});}})[_0x8104('0x24')](function(_0x2db83e){return{'count':_0x2db83e[_0x8104('0x34')],'rows':_0x2db83e};})[_0x8104('0x24')](respondWithResult(_0x324d5c,null))[_0x8104('0x41')](function(_0x242d82){var _0x465f05=_0xeda2f0[_0x8104('0x2f')][_0x8104('0x69')]?0x1f4:_0x242d82[_0x8104('0x6a')]||0x1f4;logger[_0x8104('0x26')](_0x8104('0x6b'),'getFields',_0x465f05,JSON[_0x8104('0x6c')](_0x242d82));delete _0x242d82[_0x8104('0x28')];if(_0x465f05===0x191){_0x465f05=0x190;}_0x324d5c[_0x8104('0x19')](_0x465f05)[_0x8104('0x6d')](_0xeda2f0[_0x8104('0x2f')]['test']?{'message':_0x8104('0x6e'),'statusCode':_0x242d82[_0x8104('0x6a')]}:_0x242d82);});}; \ No newline at end of file +var _0x4cc5=['test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','json','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','name','index','map','DeskAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','catch','include','find','create','body','update','params','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','remoteUri','authType','username','consumerKey','consumerSecret','tokenSecret','slice','substring','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','password','base64','concat','_embedded','entries','active','label'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x4cc5,0x1ca));var _0x54cc=function(_0x2ad8ad,_0x175bee){_0x2ad8ad=_0x2ad8ad-0x0;var _0x464090=_0x4cc5[_0x2ad8ad];return _0x464090;};'use strict';var emlformat=require(_0x54cc('0x0'));var rimraf=require(_0x54cc('0x1'));var zipdir=require(_0x54cc('0x2'));var jsonpatch=require(_0x54cc('0x3'));var rp=require(_0x54cc('0x4'));var moment=require(_0x54cc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x54cc('0x6'));var util=require(_0x54cc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x54cc('0x8'));var ejs=require(_0x54cc('0x9'));var fs=require('fs');var fs_extra=require(_0x54cc('0xa'));var _=require(_0x54cc('0xb'));var squel=require('squel');var crypto=require(_0x54cc('0xc'));var jsforce=require(_0x54cc('0xd'));var deskjs=require(_0x54cc('0xe'));var toCsv=require(_0x54cc('0x8'));var querystring=require('querystring');var Papa=require(_0x54cc('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x54cc('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x54cc('0x11'))('api');var utils=require(_0x54cc('0x12'));var config=require(_0x54cc('0x13'));var licenseUtil=require(_0x54cc('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x54cc('0x15'));function respondWithStatusCode(_0x3f3c15,_0x16c8ab){_0x16c8ab=_0x16c8ab||0xcc;return function(_0x4cdd01){if(_0x4cdd01){return _0x3f3c15['sendStatus'](_0x16c8ab);}return _0x3f3c15['status'](_0x16c8ab)['end']();};}function respondWithResult(_0x202c7d,_0x4b7d60){_0x4b7d60=_0x4b7d60||0xc8;return function(_0x41143d){if(_0x41143d){return _0x202c7d[_0x54cc('0x16')](_0x4b7d60)[_0x54cc('0x17')](_0x41143d);}};}function respondWithFilteredResult(_0x469fc7,_0x1354ec){return function(_0x349477){if(_0x349477){var _0x348e41=typeof _0x1354ec['offset']===_0x54cc('0x18')&&typeof _0x1354ec['limit']===_0x54cc('0x18');var _0x7cfa87=_0x349477[_0x54cc('0x19')];var _0x25105f=_0x348e41?0x0:_0x1354ec[_0x54cc('0x1a')];var _0x38c879=_0x348e41?_0x349477['count']:_0x1354ec[_0x54cc('0x1a')]+_0x1354ec['limit'];var _0x463631;if(_0x38c879>=_0x7cfa87){_0x38c879=_0x7cfa87;_0x463631=0xc8;}else{_0x463631=0xce;}_0x469fc7[_0x54cc('0x16')](_0x463631);return _0x469fc7[_0x54cc('0x1b')](_0x54cc('0x1c'),_0x25105f+'-'+_0x38c879+'/'+_0x7cfa87)['json'](_0x349477);}return null;};}function patchUpdates(_0x28b7ec){return function(_0x1d430f){try{jsonpatch[_0x54cc('0x1d')](_0x1d430f,_0x28b7ec,!![]);}catch(_0x3c5d59){return BPromise[_0x54cc('0x1e')](_0x3c5d59);}return _0x1d430f[_0x54cc('0x1f')]();};}function saveUpdates(_0x1d5ffb,_0x39535f){return function(_0x1cf3f1){if(_0x1cf3f1){return _0x1cf3f1['update'](_0x1d5ffb)[_0x54cc('0x20')](function(_0x585cb2){return _0x585cb2;});}return null;};}function removeEntity(_0x3e2268,_0x492ed5){return function(_0x4b1ace){if(_0x4b1ace){return _0x4b1ace[_0x54cc('0x21')]()[_0x54cc('0x20')](function(){_0x3e2268[_0x54cc('0x16')](0xcc)[_0x54cc('0x22')]();});}};}function handleEntityNotFound(_0x219b7b,_0x1c7fdb){return function(_0x10891d){if(!_0x10891d){_0x219b7b[_0x54cc('0x23')](0x194);}return _0x10891d;};}function handleError(_0x2fdda8,_0x3016df){_0x3016df=_0x3016df||0x1f4;return function(_0x53a97a){logger[_0x54cc('0x24')](_0x53a97a['stack']);if(_0x53a97a[_0x54cc('0x25')]){delete _0x53a97a[_0x54cc('0x25')];}_0x2fdda8[_0x54cc('0x16')](_0x3016df)['send'](_0x53a97a);};}exports[_0x54cc('0x26')]=function(_0x5c2be7,_0x11d3a3){var _0x4fd808={},_0x4a28bf={},_0x2fdd47={'count':0x0,'rows':[]};var _0x21cc87=_[_0x54cc('0x27')](db[_0x54cc('0x28')][_0x54cc('0x29')],function(_0x41f3de){return{'name':_0x41f3de[_0x54cc('0x2a')],'type':_0x41f3de['type'][_0x54cc('0x2b')]};});_0x4a28bf[_0x54cc('0x2c')]=_[_0x54cc('0x27')](_0x21cc87,_0x54cc('0x25'));_0x4a28bf[_0x54cc('0x2d')]=_[_0x54cc('0x2e')](_0x5c2be7['query']);_0x4a28bf[_0x54cc('0x2f')]=_[_0x54cc('0x30')](_0x4a28bf[_0x54cc('0x2c')],_0x4a28bf[_0x54cc('0x2d')]);_0x4fd808[_0x54cc('0x31')]=_[_0x54cc('0x30')](_0x4a28bf[_0x54cc('0x2c')],qs['fields'](_0x5c2be7[_0x54cc('0x2d')][_0x54cc('0x32')]));_0x4fd808[_0x54cc('0x31')]=_0x4fd808[_0x54cc('0x31')][_0x54cc('0x33')]?_0x4fd808[_0x54cc('0x31')]:_0x4a28bf[_0x54cc('0x2c')];if(!_0x5c2be7[_0x54cc('0x2d')][_0x54cc('0x34')](_0x54cc('0x35'))){_0x4fd808[_0x54cc('0x36')]=qs[_0x54cc('0x36')](_0x5c2be7['query'][_0x54cc('0x36')]);_0x4fd808['offset']=qs[_0x54cc('0x1a')](_0x5c2be7[_0x54cc('0x2d')][_0x54cc('0x1a')]);}_0x4fd808['order']=qs[_0x54cc('0x37')](_0x5c2be7[_0x54cc('0x2d')][_0x54cc('0x37')]);_0x4fd808[_0x54cc('0x38')]=qs[_0x54cc('0x2f')](_[_0x54cc('0x39')](_0x5c2be7[_0x54cc('0x2d')],_0x4a28bf[_0x54cc('0x2f')]),_0x21cc87);if(_0x5c2be7['query'][_0x54cc('0x3a')]){_0x4fd808[_0x54cc('0x38')]=_[_0x54cc('0x3b')](_0x4fd808[_0x54cc('0x38')],{'$or':_[_0x54cc('0x27')](_0x21cc87,function(_0x4f5648){if(_0x4f5648[_0x54cc('0x3c')]!=='VIRTUAL'){var _0x2f02bb={};_0x2f02bb[_0x4f5648['name']]={'$like':'%'+_0x5c2be7[_0x54cc('0x2d')]['filter']+'%'};return _0x2f02bb;}})});}_0x4fd808=_['merge']({},_0x4fd808,_0x5c2be7[_0x54cc('0x3d')]);var _0xf0ff63={'where':_0x4fd808[_0x54cc('0x38')]};return db[_0x54cc('0x28')][_0x54cc('0x19')](_0xf0ff63)[_0x54cc('0x20')](function(_0x53e210){_0x2fdd47['count']=_0x53e210;if(_0x5c2be7['query'][_0x54cc('0x3e')]){_0x4fd808['include']=[{'all':!![]}];}return db['DeskAccount'][_0x54cc('0x3f')](_0x4fd808);})[_0x54cc('0x20')](function(_0x158fdd){_0x2fdd47[_0x54cc('0x40')]=_0x158fdd;return _0x2fdd47;})['then'](respondWithFilteredResult(_0x11d3a3,_0x4fd808))[_0x54cc('0x41')](handleError(_0x11d3a3,null));};exports['show']=function(_0x8f0b26,_0x545214){var _0x206f28={'raw':![],'where':{'id':_0x8f0b26['params']['id']}},_0x2a3cb2={};_0x2a3cb2[_0x54cc('0x2c')]=_[_0x54cc('0x2e')](db[_0x54cc('0x28')][_0x54cc('0x29')]);_0x2a3cb2[_0x54cc('0x2d')]=_['keys'](_0x8f0b26[_0x54cc('0x2d')]);_0x2a3cb2[_0x54cc('0x2f')]=_[_0x54cc('0x30')](_0x2a3cb2[_0x54cc('0x2c')],_0x2a3cb2[_0x54cc('0x2d')]);_0x206f28['attributes']=_[_0x54cc('0x30')](_0x2a3cb2[_0x54cc('0x2c')],qs[_0x54cc('0x32')](_0x8f0b26[_0x54cc('0x2d')][_0x54cc('0x32')]));_0x206f28[_0x54cc('0x31')]=_0x206f28[_0x54cc('0x31')][_0x54cc('0x33')]?_0x206f28['attributes']:_0x2a3cb2[_0x54cc('0x2c')];if(_0x8f0b26['query']['includeAll']){_0x206f28[_0x54cc('0x42')]=[{'all':!![]}];}_0x206f28=_[_0x54cc('0x3b')]({},_0x206f28,_0x8f0b26[_0x54cc('0x3d')]);return db[_0x54cc('0x28')][_0x54cc('0x43')](_0x206f28)[_0x54cc('0x20')](handleEntityNotFound(_0x545214,null))['then'](respondWithResult(_0x545214,null))[_0x54cc('0x41')](handleError(_0x545214,null));};exports[_0x54cc('0x44')]=function(_0xcade6c,_0x32209a){return db[_0x54cc('0x28')][_0x54cc('0x44')](_0xcade6c[_0x54cc('0x45')],{})[_0x54cc('0x20')](respondWithResult(_0x32209a,0xc9))['catch'](handleError(_0x32209a,null));};exports[_0x54cc('0x46')]=function(_0x217c16,_0x303069){if(_0x217c16[_0x54cc('0x45')]['id']){delete _0x217c16[_0x54cc('0x45')]['id'];}return db['DeskAccount'][_0x54cc('0x43')]({'where':{'id':_0x217c16['params']['id']}})[_0x54cc('0x20')](handleEntityNotFound(_0x303069,null))[_0x54cc('0x20')](saveUpdates(_0x217c16['body'],null))['then'](respondWithResult(_0x303069,null))[_0x54cc('0x41')](handleError(_0x303069,null));};exports[_0x54cc('0x21')]=function(_0x1f3849,_0x5511bb){return db[_0x54cc('0x28')][_0x54cc('0x43')]({'where':{'id':_0x1f3849[_0x54cc('0x47')]['id']}})[_0x54cc('0x20')](handleEntityNotFound(_0x5511bb,null))['then'](removeEntity(_0x5511bb,null))[_0x54cc('0x41')](handleError(_0x5511bb,null));};exports[_0x54cc('0x48')]=function(_0x3ec48d,_0x2f0c02,_0x43d6f4){var _0x4ee31a={};var _0x33f375={};var _0x303779;var _0x5f4896;return db[_0x54cc('0x28')][_0x54cc('0x49')]({'where':{'id':_0x3ec48d['params']['id']}})[_0x54cc('0x20')](handleEntityNotFound(_0x2f0c02,null))['then'](function(_0xc19be9){if(_0xc19be9){_0x303779=_0xc19be9;_0x33f375[_0x54cc('0x2c')]=_[_0x54cc('0x2e')](db[_0x54cc('0x4a')][_0x54cc('0x29')]);_0x33f375['query']=_['keys'](_0x3ec48d[_0x54cc('0x2d')]);_0x33f375[_0x54cc('0x2f')]=_['intersection'](_0x33f375[_0x54cc('0x2c')],_0x33f375[_0x54cc('0x2d')]);_0x4ee31a[_0x54cc('0x31')]=_[_0x54cc('0x30')](_0x33f375['model'],qs[_0x54cc('0x32')](_0x3ec48d[_0x54cc('0x2d')][_0x54cc('0x32')]));_0x4ee31a[_0x54cc('0x31')]=_0x4ee31a[_0x54cc('0x31')][_0x54cc('0x33')]?_0x4ee31a[_0x54cc('0x31')]:_0x33f375[_0x54cc('0x2c')];_0x4ee31a['order']=qs[_0x54cc('0x37')](_0x3ec48d[_0x54cc('0x2d')][_0x54cc('0x37')]);_0x4ee31a[_0x54cc('0x38')]=qs['filters'](_[_0x54cc('0x39')](_0x3ec48d[_0x54cc('0x2d')],_0x33f375['filters']));if(_0x3ec48d[_0x54cc('0x2d')][_0x54cc('0x3a')]){_0x4ee31a[_0x54cc('0x38')]=_[_0x54cc('0x3b')](_0x4ee31a['where'],{'$or':_[_0x54cc('0x27')](_0x4ee31a[_0x54cc('0x31')],function(_0xe15a42){var _0x126b16={};_0x126b16[_0xe15a42]={'$like':'%'+_0x3ec48d[_0x54cc('0x2d')][_0x54cc('0x3a')]+'%'};return _0x126b16;})});}_0x4ee31a=_[_0x54cc('0x3b')]({},_0x4ee31a,_0x3ec48d['options']);return _0x303779[_0x54cc('0x48')](_0x4ee31a);}})[_0x54cc('0x20')](function(_0x4ea685){if(_0x4ea685){_0x5f4896=_0x4ea685[_0x54cc('0x33')];if(!_0x3ec48d[_0x54cc('0x2d')][_0x54cc('0x34')](_0x54cc('0x35'))){_0x4ee31a[_0x54cc('0x36')]=qs[_0x54cc('0x36')](_0x3ec48d['query']['limit']);_0x4ee31a['offset']=qs[_0x54cc('0x1a')](_0x3ec48d[_0x54cc('0x2d')][_0x54cc('0x1a')]);}return _0x303779[_0x54cc('0x48')](_0x4ee31a);}})[_0x54cc('0x20')](function(_0x54ed1d){if(_0x54ed1d){return _0x54ed1d?{'count':_0x5f4896,'rows':_0x54ed1d}:null;}})[_0x54cc('0x20')](respondWithResult(_0x2f0c02,null))[_0x54cc('0x41')](handleError(_0x2f0c02,null));};exports[_0x54cc('0x4b')]=function(_0x1ccf88,_0x33894b,_0x28f92f){if(_0x1ccf88['body']['id']){delete _0x1ccf88['body']['id'];}return db[_0x54cc('0x28')][_0x54cc('0x49')]({'where':{'id':_0x1ccf88[_0x54cc('0x47')]['id']}})['then'](handleEntityNotFound(_0x33894b,null))[_0x54cc('0x20')](function(_0x43644f){if(_0x43644f){_0x1ccf88['body'][_0x54cc('0x4c')]=_0x43644f['id'];_0x1ccf88[_0x54cc('0x45')][_0x54cc('0x4d')]=integrations[_0x54cc('0x4e')](_0x1ccf88['body'][_0x54cc('0x4f')],_0x1ccf88[_0x54cc('0x45')][_0x54cc('0x3c')]);_0x1ccf88[_0x54cc('0x45')][_0x54cc('0x50')]=integrations[_0x54cc('0x51')](_0x1ccf88[_0x54cc('0x45')]['channel'],_0x1ccf88[_0x54cc('0x45')][_0x54cc('0x3c')]);return db['DeskConfiguration']['create'](_0x1ccf88[_0x54cc('0x45')],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db[_0x54cc('0x52')],'as':_0x54cc('0x50')}]});}return null;})[_0x54cc('0x20')](respondWithResult(_0x33894b,null))[_0x54cc('0x41')](handleError(_0x33894b,null));};exports['getFields']=function(_0x349a5a,_0xfce89,_0x223141){var _0x449cb6=[{'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 _0x405db4='';return db[_0x54cc('0x28')]['findOne']({'where':{'id':_0x349a5a[_0x54cc('0x47')]['id']},'attributes':['id',_0x54cc('0x53'),_0x54cc('0x54'),_0x54cc('0x55'),'password',_0x54cc('0x56'),_0x54cc('0x57'),'token',_0x54cc('0x58')]})[_0x54cc('0x20')](handleEntityNotFound(_0xfce89,null))[_0x54cc('0x20')](function(_0x413cc7){if(_0x413cc7){_0x405db4=_0x413cc7[_0x54cc('0x53')];var _0x5ebb8c=_0x405db4[_0x54cc('0x59')](-0x1);if(_0x5ebb8c==='/'){_0x405db4=_0x405db4[_0x54cc('0x5a')](0x0,_0x405db4['lastIndexOf'](_0x5ebb8c));}var _0x3c9ea8={'method':_0x54cc('0x5b'),'uri':util[_0x54cc('0x5c')](_0x54cc('0x5d'),_0x405db4),'headers':{'Content-Type':_0x54cc('0x5e'),'Accept':_0x54cc('0x5e')},'json':!![]};if(_0x413cc7[_0x54cc('0x54')]===_0x54cc('0x5f')){_0x3c9ea8[_0x54cc('0x60')][_0x54cc('0x61')]=util[_0x54cc('0x5c')](_0x54cc('0x62'),new Buffer(util['format'](_0x54cc('0x63'),_0x413cc7[_0x54cc('0x55')],_0x413cc7[_0x54cc('0x64')]))['toString'](_0x54cc('0x65')));}return rp(_0x3c9ea8)[_0x54cc('0x20')](function(_0x318c4d){return _0x449cb6[_0x54cc('0x66')](_[_0x54cc('0x27')](_0x318c4d[_0x54cc('0x67')][_0x54cc('0x68')],function(_0x111c25){return{'id':_0x111c25[_0x54cc('0x25')],'name':_0x111c25[_0x54cc('0x25')],'type':_0x111c25[_0x54cc('0x3c')],'active':_0x111c25[_0x54cc('0x69')],'label':_0x111c25[_0x54cc('0x6a')],'custom':!![]};}));});}})[_0x54cc('0x20')](function(_0x72ef40){return{'count':_0x72ef40['length'],'rows':_0x72ef40};})[_0x54cc('0x20')](respondWithResult(_0xfce89,null))[_0x54cc('0x41')](function(_0x4d2c83){var _0x210001=_0x349a5a[_0x54cc('0x2d')][_0x54cc('0x6b')]?0x1f4:_0x4d2c83[_0x54cc('0x6c')]||0x1f4;logger['error'](_0x54cc('0x6d'),_0x54cc('0x6e'),_0x210001,JSON['stringify'](_0x4d2c83));delete _0x4d2c83['name'];if(_0x210001===0x191){_0x210001=0x190;}_0xfce89[_0x54cc('0x16')](_0x210001)[_0x54cc('0x6f')](_0x349a5a['query'][_0x54cc('0x6b')]?{'message':_0x54cc('0x70'),'statusCode':_0x4d2c83[_0x54cc('0x6c')]}:_0x4d2c83);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 6fe05f7..fbd20ae 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 _0xd05d=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash'];(function(_0x46cf8d,_0x58c40e){var _0x12aa21=function(_0x335e13){while(--_0x335e13){_0x46cf8d['push'](_0x46cf8d['shift']());}};_0x12aa21(++_0x58c40e);}(_0xd05d,0xb3));var _0xdd05=function(_0x3bcf8c,_0x505647){_0x3bcf8c=_0x3bcf8c-0x0;var _0x2461f7=_0xd05d[_0x3bcf8c];return _0x2461f7;};'use strict';var _=require(_0xdd05('0x0'));var util=require(_0xdd05('0x1'));var logger=require(_0xdd05('0x2'))(_0xdd05('0x3'));var moment=require(_0xdd05('0x4'));var BPromise=require(_0xdd05('0x5'));var rp=require(_0xdd05('0x6'));var fs=require('fs');var path=require(_0xdd05('0x7'));var rimraf=require(_0xdd05('0x8'));var config=require(_0xdd05('0x9'));var attributes=require(_0xdd05('0xa'));var integrations=require(_0xdd05('0xb'));module['exports']=function(_0x5c48ab,_0x2b8ac1){return _0x5c48ab[_0xdd05('0xc')](_0xdd05('0xd'),attributes,{'tableName':_0xdd05('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8573=['rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x25bd34,_0x48cbf6){var _0x3c9277=function(_0x1c8167){while(--_0x1c8167){_0x25bd34['push'](_0x25bd34['shift']());}};_0x3c9277(++_0x48cbf6);}(_0x8573,0x1f1));var _0x3857=function(_0x1ef563,_0x486bec){_0x1ef563=_0x1ef563-0x0;var _0x1dbd62=_0x8573[_0x1ef563];return _0x1dbd62;};'use strict';var _=require(_0x3857('0x0'));var util=require(_0x3857('0x1'));var logger=require('../../config/logger')(_0x3857('0x2'));var moment=require(_0x3857('0x3'));var BPromise=require(_0x3857('0x4'));var rp=require(_0x3857('0x5'));var fs=require('fs');var path=require(_0x3857('0x6'));var rimraf=require(_0x3857('0x7'));var config=require('../../config/environment');var attributes=require(_0x3857('0x8'));var integrations=require(_0x3857('0x9'));module[_0x3857('0xa')]=function(_0x89dbb,_0xba201){return _0x89dbb[_0x3857('0xb')]('DeskAccount',attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 538a2dc..7338a2c 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 _0x9b2f=['model','stringify','ShowDeskAccount','find','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','attributes','limit','include','map'];(function(_0x502045,_0x18c5b2){var _0x3d510a=function(_0x21128c){while(--_0x21128c){_0x502045['push'](_0x502045['shift']());}};_0x3d510a(++_0x18c5b2);}(_0x9b2f,0x1f3));var _0xf9b2=function(_0x3c08ea,_0x419b25){_0x3c08ea=_0x3c08ea-0x0;var _0x4b6e51=_0x9b2f[_0x3c08ea];return _0x4b6e51;};'use strict';var _=require(_0xf9b2('0x0'));var util=require(_0xf9b2('0x1'));var moment=require(_0xf9b2('0x2'));var BPromise=require('bluebird');var rs=require(_0xf9b2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf9b2('0x4'))['db'];var utils=require(_0xf9b2('0x5'));var logger=require(_0xf9b2('0x6'))(_0xf9b2('0x7'));var config=require('../../config/environment');var jayson=require(_0xf9b2('0x8'));var client=jayson['client'][_0xf9b2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5bdd5f,_0x335a79,_0x4252a3){return new BPromise(function(_0x370446,_0x15bf0e){return client['request'](_0x5bdd5f,_0x4252a3)[_0xf9b2('0xa')](function(_0x1b755d){logger[_0xf9b2('0xb')](_0xf9b2('0xc'),_0x335a79,_0xf9b2('0xd'));logger[_0xf9b2('0xe')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x335a79,_0xf9b2('0xd'),JSON['stringify'](_0x1b755d));if(_0x1b755d[_0xf9b2('0xf')]){if(_0x1b755d[_0xf9b2('0xf')][_0xf9b2('0x10')]===0x1f4){logger[_0xf9b2('0xf')](_0xf9b2('0xc'),_0x335a79,_0x1b755d['error']['message']);return _0x15bf0e(_0x1b755d[_0xf9b2('0xf')]['message']);}logger[_0xf9b2('0xf')](_0xf9b2('0xc'),_0x335a79,_0x1b755d['error'][_0xf9b2('0x11')]);return _0x370446(_0x1b755d[_0xf9b2('0xf')][_0xf9b2('0x11')]);}else{logger[_0xf9b2('0xb')]('DeskAccount,\x20%s,\x20%s',_0x335a79,'request\x20sent');_0x370446(_0x1b755d[_0xf9b2('0x12')][_0xf9b2('0x11')]);}})[_0xf9b2('0x13')](function(_0x56e755){logger[_0xf9b2('0xf')](_0xf9b2('0xc'),_0x335a79,_0x56e755);_0x15bf0e(_0x56e755);});});}exports[_0xf9b2('0x14')]=function(_0x46d0b0){var _0x8d8b31=this;return new Promise(function(_0x428358,_0x1ff05a){return db[_0xf9b2('0x15')][_0xf9b2('0x16')]({'raw':_0x46d0b0[_0xf9b2('0x17')]?_0x46d0b0[_0xf9b2('0x17')][_0xf9b2('0x18')]===undefined?!![]:![]:!![],'where':_0x46d0b0['options']?_0x46d0b0[_0xf9b2('0x17')]['where']||null:null,'attributes':_0x46d0b0[_0xf9b2('0x17')]?_0x46d0b0[_0xf9b2('0x17')][_0xf9b2('0x19')]||null:null,'limit':_0x46d0b0[_0xf9b2('0x17')]?_0x46d0b0['options'][_0xf9b2('0x1a')]||null:null,'include':_0x46d0b0[_0xf9b2('0x17')]?_0x46d0b0[_0xf9b2('0x17')][_0xf9b2('0x1b')]?_[_0xf9b2('0x1c')](_0x46d0b0['options'][_0xf9b2('0x1b')],function(_0x5718a5){return{'model':db[_0x5718a5[_0xf9b2('0x1d')]],'as':_0x5718a5['as'],'attributes':_0x5718a5['attributes'],'include':_0x5718a5[_0xf9b2('0x1b')]?_['map'](_0x5718a5[_0xf9b2('0x1b')],function(_0x34b121){return{'model':db[_0x34b121['model']],'as':_0x34b121['as'],'attributes':_0x34b121[_0xf9b2('0x19')],'include':_0x34b121[_0xf9b2('0x1b')]?_[_0xf9b2('0x1c')](_0x34b121['include'],function(_0x12c5fc){return{'model':db[_0x12c5fc[_0xf9b2('0x1d')]],'as':_0x12c5fc['as'],'attributes':_0x12c5fc[_0xf9b2('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf9b2('0xa')](function(_0x501c59){logger[_0xf9b2('0xb')](_0xf9b2('0x14'),_0x46d0b0);logger[_0xf9b2('0xe')](_0xf9b2('0x14'),_0x46d0b0,JSON[_0xf9b2('0x1e')](_0x501c59));_0x428358(_0x501c59);})['catch'](function(_0x3e0376){logger[_0xf9b2('0xf')](_0xf9b2('0x14'),_0x3e0376['message'],_0x46d0b0);_0x1ff05a(_0x8d8b31[_0xf9b2('0xf')](0x1f4,_0x3e0376[_0xf9b2('0x11')]));});});};exports[_0xf9b2('0x1f')]=function(_0x108679){var _0x24f1af=this;return new Promise(function(_0x331443,_0x31bd3d){return db[_0xf9b2('0x15')][_0xf9b2('0x20')]({'raw':_0x108679[_0xf9b2('0x17')]?_0x108679[_0xf9b2('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x108679[_0xf9b2('0x17')]?_0x108679['options']['where']||null:null,'attributes':_0x108679[_0xf9b2('0x17')]?_0x108679[_0xf9b2('0x17')][_0xf9b2('0x19')]||null:null,'include':_0x108679[_0xf9b2('0x17')]?_0x108679[_0xf9b2('0x17')][_0xf9b2('0x1b')]?_[_0xf9b2('0x1c')](_0x108679[_0xf9b2('0x17')][_0xf9b2('0x1b')],function(_0x216166){return{'model':db[_0x216166[_0xf9b2('0x1d')]],'as':_0x216166['as'],'attributes':_0x216166[_0xf9b2('0x19')],'include':_0x216166[_0xf9b2('0x1b')]?_[_0xf9b2('0x1c')](_0x216166[_0xf9b2('0x1b')],function(_0x45690f){return{'model':db[_0x45690f[_0xf9b2('0x1d')]],'as':_0x45690f['as'],'attributes':_0x45690f[_0xf9b2('0x19')],'include':_0x45690f[_0xf9b2('0x1b')]?_[_0xf9b2('0x1c')](_0x45690f[_0xf9b2('0x1b')],function(_0x326ab8){return{'model':db[_0x326ab8[_0xf9b2('0x1d')]],'as':_0x326ab8['as'],'attributes':_0x326ab8[_0xf9b2('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2bee0e){logger[_0xf9b2('0xb')](_0xf9b2('0x1f'),_0x108679);logger[_0xf9b2('0xe')](_0xf9b2('0x1f'),_0x108679,JSON[_0xf9b2('0x1e')](_0x2bee0e));_0x331443(_0x2bee0e);})[_0xf9b2('0x13')](function(_0x2f90a8){logger['error'](_0xf9b2('0x1f'),_0x2f90a8[_0xf9b2('0x11')],_0x108679);_0x31bd3d(_0x24f1af[_0xf9b2('0xf')](0x1f4,_0x2f90a8['message']));});});}; \ No newline at end of file +var _0x20dd=['request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','GetDeskAccount','DeskAccount','options','where','attributes','limit','map','include','model','then','debug','ShowDeskAccount','find','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','info'];(function(_0x22ad95,_0x5c77d4){var _0x309e3d=function(_0x45adbe){while(--_0x45adbe){_0x22ad95['push'](_0x22ad95['shift']());}};_0x309e3d(++_0x5c77d4);}(_0x20dd,0x10c));var _0xd20d=function(_0x568653,_0x5636fe){_0x568653=_0x568653-0x0;var _0x5eb0ab=_0x20dd[_0x568653];return _0x5eb0ab;};'use strict';var _=require('lodash');var util=require(_0xd20d('0x0'));var moment=require(_0xd20d('0x1'));var BPromise=require(_0xd20d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd20d('0x3'));var db=require(_0xd20d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd20d('0x5'))(_0xd20d('0x6'));var config=require(_0xd20d('0x7'));var jayson=require(_0xd20d('0x8'));var client=jayson[_0xd20d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32d978,_0x1ddb84,_0x365bbf){return new BPromise(function(_0xce2168,_0x6d4731){return client['request'](_0x32d978,_0x365bbf)['then'](function(_0x176bb7){logger[_0xd20d('0xa')]('DeskAccount,\x20%s,\x20%s',_0x1ddb84,_0xd20d('0xb'));logger['debug'](_0xd20d('0xc'),_0x1ddb84,_0xd20d('0xb'),JSON[_0xd20d('0xd')](_0x176bb7));if(_0x176bb7[_0xd20d('0xe')]){if(_0x176bb7[_0xd20d('0xe')][_0xd20d('0xf')]===0x1f4){logger['error'](_0xd20d('0x10'),_0x1ddb84,_0x176bb7['error'][_0xd20d('0x11')]);return _0x6d4731(_0x176bb7['error'][_0xd20d('0x11')]);}logger[_0xd20d('0xe')](_0xd20d('0x10'),_0x1ddb84,_0x176bb7[_0xd20d('0xe')]['message']);return _0xce2168(_0x176bb7[_0xd20d('0xe')][_0xd20d('0x11')]);}else{logger['info'](_0xd20d('0x10'),_0x1ddb84,_0xd20d('0xb'));_0xce2168(_0x176bb7['result'][_0xd20d('0x11')]);}})['catch'](function(_0x4b670e){logger['error'](_0xd20d('0x10'),_0x1ddb84,_0x4b670e);_0x6d4731(_0x4b670e);});});}exports[_0xd20d('0x12')]=function(_0x2aa457){var _0xea8e82=this;return new Promise(function(_0x4e6d3f,_0x399781){return db[_0xd20d('0x13')]['findAll']({'raw':_0x2aa457['options']?_0x2aa457[_0xd20d('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x2aa457[_0xd20d('0x14')]?_0x2aa457['options'][_0xd20d('0x15')]||null:null,'attributes':_0x2aa457[_0xd20d('0x14')]?_0x2aa457['options'][_0xd20d('0x16')]||null:null,'limit':_0x2aa457[_0xd20d('0x14')]?_0x2aa457['options'][_0xd20d('0x17')]||null:null,'include':_0x2aa457['options']?_0x2aa457[_0xd20d('0x14')]['include']?_[_0xd20d('0x18')](_0x2aa457[_0xd20d('0x14')][_0xd20d('0x19')],function(_0x4cd44c){return{'model':db[_0x4cd44c[_0xd20d('0x1a')]],'as':_0x4cd44c['as'],'attributes':_0x4cd44c[_0xd20d('0x16')],'include':_0x4cd44c[_0xd20d('0x19')]?_[_0xd20d('0x18')](_0x4cd44c[_0xd20d('0x19')],function(_0x4a0a58){return{'model':db[_0x4a0a58['model']],'as':_0x4a0a58['as'],'attributes':_0x4a0a58[_0xd20d('0x16')],'include':_0x4a0a58[_0xd20d('0x19')]?_['map'](_0x4a0a58['include'],function(_0x455076){return{'model':db[_0x455076[_0xd20d('0x1a')]],'as':_0x455076['as'],'attributes':_0x455076['attributes']};}):[]};}):[]};}):[]:[]})[_0xd20d('0x1b')](function(_0x3591aa){logger['info']('GetDeskAccount',_0x2aa457);logger[_0xd20d('0x1c')](_0xd20d('0x12'),_0x2aa457,JSON[_0xd20d('0xd')](_0x3591aa));_0x4e6d3f(_0x3591aa);})['catch'](function(_0x4fa797){logger[_0xd20d('0xe')](_0xd20d('0x12'),_0x4fa797[_0xd20d('0x11')],_0x2aa457);_0x399781(_0xea8e82[_0xd20d('0xe')](0x1f4,_0x4fa797[_0xd20d('0x11')]));});});};exports[_0xd20d('0x1d')]=function(_0x9b1831){var _0x57b6a8=this;return new Promise(function(_0x54ae0e,_0x44b8a1){return db[_0xd20d('0x13')][_0xd20d('0x1e')]({'raw':_0x9b1831[_0xd20d('0x14')]?_0x9b1831[_0xd20d('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x9b1831[_0xd20d('0x14')]?_0x9b1831['options'][_0xd20d('0x15')]||null:null,'attributes':_0x9b1831['options']?_0x9b1831[_0xd20d('0x14')][_0xd20d('0x16')]||null:null,'include':_0x9b1831['options']?_0x9b1831[_0xd20d('0x14')][_0xd20d('0x19')]?_[_0xd20d('0x18')](_0x9b1831[_0xd20d('0x14')][_0xd20d('0x19')],function(_0x207991){return{'model':db[_0x207991[_0xd20d('0x1a')]],'as':_0x207991['as'],'attributes':_0x207991[_0xd20d('0x16')],'include':_0x207991[_0xd20d('0x19')]?_['map'](_0x207991[_0xd20d('0x19')],function(_0x4dccb2){return{'model':db[_0x4dccb2[_0xd20d('0x1a')]],'as':_0x4dccb2['as'],'attributes':_0x4dccb2[_0xd20d('0x16')],'include':_0x4dccb2['include']?_[_0xd20d('0x18')](_0x4dccb2[_0xd20d('0x19')],function(_0x21fd84){return{'model':db[_0x21fd84[_0xd20d('0x1a')]],'as':_0x21fd84['as'],'attributes':_0x21fd84[_0xd20d('0x16')]};}):[]};}):[]};}):[]:[]})[_0xd20d('0x1b')](function(_0x5b8ba2){logger[_0xd20d('0xa')](_0xd20d('0x1d'),_0x9b1831);logger[_0xd20d('0x1c')]('ShowDeskAccount',_0x9b1831,JSON[_0xd20d('0xd')](_0x5b8ba2));_0x54ae0e(_0x5b8ba2);})['catch'](function(_0x42a0ac){logger[_0xd20d('0xe')]('ShowDeskAccount',_0x42a0ac[_0xd20d('0x11')],_0x9b1831);_0x44b8a1(_0x57b6a8[_0xd20d('0xe')](0x1f4,_0x42a0ac[_0xd20d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index bb2ef52..8947d6b 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 _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(_0x1f8448,_0x2e4eca){var _0x258124=function(_0x2e1e44){while(--_0x2e1e44){_0x1f8448['push'](_0x1f8448['shift']());}};_0x258124(++_0x2e4eca);}(_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 +var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x4a9fb7,_0x4cbfd7){var _0x40b90e=function(_0x59664c){while(--_0x59664c){_0x4a9fb7['push'](_0x4a9fb7['shift']());}};_0x40b90e(++_0x4cbfd7);}(_0x55ca,0x126));var _0xa55c=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x55ca[_0x341e0f];return _0x59555a;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index d3e7dd0..0b3f1c2 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 _0x2453=['STRING','sequelize'];(function(_0x2cd056,_0x39f632){var _0x24c2be=function(_0x5b6429){while(--_0x5b6429){_0x2cd056['push'](_0x2cd056['shift']());}};_0x24c2be(++_0x39f632);}(_0x2453,0x85));var _0x3245=function(_0x344a9a,_0x1b6141){_0x344a9a=_0x344a9a-0x0;var _0x1b7792=_0x2453[_0x344a9a];return _0x1b7792;};'use strict';var Sequelize=require(_0x3245('0x0'));module['exports']={'name':{'type':Sequelize[_0x3245('0x1')]},'description':{'type':Sequelize[_0x3245('0x1')]}}; \ No newline at end of file +var _0x03c4=['sequelize','exports','STRING'];(function(_0x4ca333,_0x1218a3){var _0x13b2e1=function(_0x1eaf45){while(--_0x1eaf45){_0x4ca333['push'](_0x4ca333['shift']());}};_0x13b2e1(++_0x1218a3);}(_0x03c4,0x177));var _0x403c=function(_0x173a31,_0x22caa3){_0x173a31=_0x173a31-0x0;var _0xc68438=_0x03c4[_0x173a31];return _0xc68438;};'use strict';var Sequelize=require(_0x403c('0x0'));module[_0x403c('0x1')]={'name':{'type':Sequelize[_0x403c('0x2')]},'description':{'type':Sequelize[_0x403c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 13835a2..ed4ee1a 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 _0x10d4=['ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','find','create','body','DeskField','options','getFields','getSubjects','findOne','getDescriptions','getTags','Tag','setTags'];(function(_0x3df46e,_0x329d78){var _0x45d47a=function(_0x363bb1){while(--_0x363bb1){_0x3df46e['push'](_0x3df46e['shift']());}};_0x45d47a(++_0x329d78);}(_0x10d4,0xa9));var _0x410d=function(_0x4d0810,_0x13e15f){_0x4d0810=_0x4d0810-0x0;var _0x3e47e0=_0x10d4[_0x4d0810];return _0x3e47e0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x410d('0x0'));var zipdir=require(_0x410d('0x1'));var jsonpatch=require(_0x410d('0x2'));var rp=require(_0x410d('0x3'));var moment=require(_0x410d('0x4'));var BPromise=require(_0x410d('0x5'));var Mustache=require(_0x410d('0x6'));var util=require(_0x410d('0x7'));var path=require('path');var sox=require(_0x410d('0x8'));var csv=require(_0x410d('0x9'));var ejs=require(_0x410d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x410d('0xb'));var deskjs=require(_0x410d('0xc'));var toCsv=require(_0x410d('0x9'));var querystring=require(_0x410d('0xd'));var Papa=require(_0x410d('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x410d('0xf'));var as=require(_0x410d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x410d('0x11'));var utils=require(_0x410d('0x12'));var config=require(_0x410d('0x13'));var licenseUtil=require(_0x410d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c88c7,_0x19c8f8){_0x19c8f8=_0x19c8f8||0xcc;return function(_0x3ff12b){if(_0x3ff12b){return _0x3c88c7[_0x410d('0x15')](_0x19c8f8);}return _0x3c88c7[_0x410d('0x16')](_0x19c8f8)['end']();};}function respondWithResult(_0x3b228b,_0x378210){_0x378210=_0x378210||0xc8;return function(_0xa63787){if(_0xa63787){return _0x3b228b['status'](_0x378210)[_0x410d('0x17')](_0xa63787);}};}function respondWithFilteredResult(_0x44d723,_0x341384){return function(_0x1a1b2c){if(_0x1a1b2c){var _0x15efdf=typeof _0x341384[_0x410d('0x18')]==='undefined'&&typeof _0x341384[_0x410d('0x19')]===_0x410d('0x1a');var _0x42eed7=_0x1a1b2c[_0x410d('0x1b')];var _0x2d6a65=_0x15efdf?0x0:_0x341384[_0x410d('0x18')];var _0x25d29f=_0x15efdf?_0x1a1b2c[_0x410d('0x1b')]:_0x341384['offset']+_0x341384[_0x410d('0x19')];var _0x3248e4;if(_0x25d29f>=_0x42eed7){_0x25d29f=_0x42eed7;_0x3248e4=0xc8;}else{_0x3248e4=0xce;}_0x44d723[_0x410d('0x16')](_0x3248e4);return _0x44d723[_0x410d('0x1c')](_0x410d('0x1d'),_0x2d6a65+'-'+_0x25d29f+'/'+_0x42eed7)[_0x410d('0x17')](_0x1a1b2c);}return null;};}function patchUpdates(_0x1e8832){return function(_0x58b6ff){try{jsonpatch[_0x410d('0x1e')](_0x58b6ff,_0x1e8832,!![]);}catch(_0x5d9cda){return BPromise[_0x410d('0x1f')](_0x5d9cda);}return _0x58b6ff[_0x410d('0x20')]();};}function saveUpdates(_0x73cd30,_0x3f506d){return function(_0x25cca0){if(_0x25cca0){return _0x25cca0[_0x410d('0x21')](_0x73cd30)[_0x410d('0x22')](function(_0x2f5e8e){return _0x2f5e8e;});}return null;};}function removeEntity(_0x310bb1,_0x101585){return function(_0x5c9431){if(_0x5c9431){return _0x5c9431[_0x410d('0x23')]()[_0x410d('0x22')](function(){_0x310bb1[_0x410d('0x16')](0xcc)[_0x410d('0x24')]();});}};}function handleEntityNotFound(_0x131810,_0x4b64a0){return function(_0x1235f3){if(!_0x1235f3){_0x131810['sendStatus'](0x194);}return _0x1235f3;};}function handleError(_0x50d401,_0x54d3cd){_0x54d3cd=_0x54d3cd||0x1f4;return function(_0xba9f41){logger[_0x410d('0x25')](_0xba9f41[_0x410d('0x26')]);if(_0xba9f41[_0x410d('0x27')]){delete _0xba9f41[_0x410d('0x27')];}_0x50d401[_0x410d('0x16')](_0x54d3cd)[_0x410d('0x28')](_0xba9f41);};}exports[_0x410d('0x29')]=function(_0x2c74ea,_0x108879){var _0x4377a0={},_0x51b9ed={},_0x39a577={'count':0x0,'rows':[]};var _0x1e8146=_[_0x410d('0x2a')](db[_0x410d('0x2b')][_0x410d('0x2c')],function(_0x38309f){return{'name':_0x38309f['fieldName'],'type':_0x38309f[_0x410d('0x2d')][_0x410d('0x2e')]};});_0x51b9ed[_0x410d('0x2f')]=_[_0x410d('0x2a')](_0x1e8146,'name');_0x51b9ed['query']=_[_0x410d('0x30')](_0x2c74ea['query']);_0x51b9ed['filters']=_['intersection'](_0x51b9ed[_0x410d('0x2f')],_0x51b9ed[_0x410d('0x31')]);_0x4377a0[_0x410d('0x32')]=_[_0x410d('0x33')](_0x51b9ed[_0x410d('0x2f')],qs[_0x410d('0x34')](_0x2c74ea[_0x410d('0x31')][_0x410d('0x34')]));_0x4377a0['attributes']=_0x4377a0[_0x410d('0x32')][_0x410d('0x35')]?_0x4377a0[_0x410d('0x32')]:_0x51b9ed[_0x410d('0x2f')];if(!_0x2c74ea[_0x410d('0x31')][_0x410d('0x36')](_0x410d('0x37'))){_0x4377a0['limit']=qs[_0x410d('0x19')](_0x2c74ea[_0x410d('0x31')][_0x410d('0x19')]);_0x4377a0[_0x410d('0x18')]=qs[_0x410d('0x18')](_0x2c74ea[_0x410d('0x31')]['offset']);}_0x4377a0[_0x410d('0x38')]=qs[_0x410d('0x39')](_0x2c74ea['query']['sort']);_0x4377a0[_0x410d('0x3a')]=qs[_0x410d('0x3b')](_[_0x410d('0x3c')](_0x2c74ea[_0x410d('0x31')],_0x51b9ed[_0x410d('0x3b')]),_0x1e8146);if(_0x2c74ea[_0x410d('0x31')]['filter']){_0x4377a0[_0x410d('0x3a')]=_[_0x410d('0x3d')](_0x4377a0[_0x410d('0x3a')],{'$or':_['map'](_0x1e8146,function(_0x10d420){if(_0x10d420[_0x410d('0x2d')]!==_0x410d('0x3e')){var _0x34a326={};_0x34a326[_0x10d420[_0x410d('0x27')]]={'$like':'%'+_0x2c74ea[_0x410d('0x31')][_0x410d('0x3f')]+'%'};return _0x34a326;}})});}_0x4377a0=_[_0x410d('0x3d')]({},_0x4377a0,_0x2c74ea['options']);var _0x28c924={'where':_0x4377a0['where']};return db['DeskConfiguration'][_0x410d('0x1b')](_0x28c924)[_0x410d('0x22')](function(_0x32a4f8){_0x39a577[_0x410d('0x1b')]=_0x32a4f8;if(_0x2c74ea[_0x410d('0x31')][_0x410d('0x40')]){_0x4377a0[_0x410d('0x41')]=[{'all':!![]}];}return db[_0x410d('0x2b')][_0x410d('0x42')](_0x4377a0);})[_0x410d('0x22')](function(_0x56e674){_0x39a577[_0x410d('0x43')]=_0x56e674;return _0x39a577;})[_0x410d('0x22')](respondWithFilteredResult(_0x108879,_0x4377a0))[_0x410d('0x44')](handleError(_0x108879,null));};exports[_0x410d('0x45')]=function(_0x4fd8ac,_0x5806da){var _0x2ea050={'raw':![],'where':{'id':_0x4fd8ac[_0x410d('0x46')]['id']}},_0x33911b={};_0x33911b['model']=_[_0x410d('0x30')](db[_0x410d('0x2b')][_0x410d('0x2c')]);_0x33911b[_0x410d('0x31')]=_[_0x410d('0x30')](_0x4fd8ac[_0x410d('0x31')]);_0x33911b['filters']=_[_0x410d('0x33')](_0x33911b[_0x410d('0x2f')],_0x33911b[_0x410d('0x31')]);_0x2ea050[_0x410d('0x32')]=_[_0x410d('0x33')](_0x33911b[_0x410d('0x2f')],qs[_0x410d('0x34')](_0x4fd8ac['query'][_0x410d('0x34')]));_0x2ea050[_0x410d('0x32')]=_0x2ea050[_0x410d('0x32')][_0x410d('0x35')]?_0x2ea050[_0x410d('0x32')]:_0x33911b[_0x410d('0x2f')];if(_0x4fd8ac[_0x410d('0x31')][_0x410d('0x40')]){_0x2ea050['include']=[{'all':!![]}];}_0x2ea050=_[_0x410d('0x3d')]({},_0x2ea050,_0x4fd8ac['options']);return db[_0x410d('0x2b')][_0x410d('0x47')](_0x2ea050)[_0x410d('0x22')](handleEntityNotFound(_0x5806da,null))[_0x410d('0x22')](respondWithResult(_0x5806da,null))['catch'](handleError(_0x5806da,null));};exports[_0x410d('0x48')]=function(_0x523180,_0x4d6f87){return db[_0x410d('0x2b')]['create'](_0x523180['body'],{})[_0x410d('0x22')](respondWithResult(_0x4d6f87,0xc9))[_0x410d('0x44')](handleError(_0x4d6f87,null));};exports[_0x410d('0x21')]=function(_0x14eb99,_0xde54f8){if(_0x14eb99['body']['id']){delete _0x14eb99[_0x410d('0x49')]['id'];}return db[_0x410d('0x2b')]['find']({'where':{'id':_0x14eb99['params']['id']}})[_0x410d('0x22')](handleEntityNotFound(_0xde54f8,null))[_0x410d('0x22')](saveUpdates(_0x14eb99[_0x410d('0x49')],null))[_0x410d('0x22')](respondWithResult(_0xde54f8,null))['catch'](handleError(_0xde54f8,null));};exports[_0x410d('0x23')]=function(_0x49cfe2,_0x2e7ad0){return db[_0x410d('0x2b')][_0x410d('0x47')]({'where':{'id':_0x49cfe2['params']['id']}})[_0x410d('0x22')](handleEntityNotFound(_0x2e7ad0,null))[_0x410d('0x22')](removeEntity(_0x2e7ad0,null))[_0x410d('0x44')](handleError(_0x2e7ad0,null));};exports['getFields']=function(_0x100d1d,_0x3fca71,_0x2aa7ce){var _0x36d4ce={};var _0x5be2fd={};var _0x3fa8db;var _0x2919b1;return db[_0x410d('0x2b')]['findOne']({'where':{'id':_0x100d1d[_0x410d('0x46')]['id']}})[_0x410d('0x22')](handleEntityNotFound(_0x3fca71,null))[_0x410d('0x22')](function(_0x29c8bc){if(_0x29c8bc){_0x3fa8db=_0x29c8bc;_0x5be2fd['model']=_[_0x410d('0x30')](db[_0x410d('0x4a')]['rawAttributes']);_0x5be2fd[_0x410d('0x31')]=_['keys'](_0x100d1d[_0x410d('0x31')]);_0x5be2fd[_0x410d('0x3b')]=_['intersection'](_0x5be2fd[_0x410d('0x2f')],_0x5be2fd[_0x410d('0x31')]);_0x36d4ce[_0x410d('0x32')]=_[_0x410d('0x33')](_0x5be2fd[_0x410d('0x2f')],qs['fields'](_0x100d1d[_0x410d('0x31')][_0x410d('0x34')]));_0x36d4ce[_0x410d('0x32')]=_0x36d4ce[_0x410d('0x32')][_0x410d('0x35')]?_0x36d4ce[_0x410d('0x32')]:_0x5be2fd[_0x410d('0x2f')];_0x36d4ce[_0x410d('0x38')]=qs['sort'](_0x100d1d[_0x410d('0x31')][_0x410d('0x39')]);_0x36d4ce['where']=qs[_0x410d('0x3b')](_[_0x410d('0x3c')](_0x100d1d['query'],_0x5be2fd[_0x410d('0x3b')]));if(_0x100d1d['query'][_0x410d('0x3f')]){_0x36d4ce[_0x410d('0x3a')]=_[_0x410d('0x3d')](_0x36d4ce['where'],{'$or':_[_0x410d('0x2a')](_0x36d4ce[_0x410d('0x32')],function(_0x349d72){var _0x25903f={};_0x25903f[_0x349d72]={'$like':'%'+_0x100d1d[_0x410d('0x31')]['filter']+'%'};return _0x25903f;})});}_0x36d4ce=_[_0x410d('0x3d')]({},_0x36d4ce,_0x100d1d[_0x410d('0x4b')]);return _0x3fa8db[_0x410d('0x4c')](_0x36d4ce);}})[_0x410d('0x22')](function(_0x5ac890){if(_0x5ac890){_0x2919b1=_0x5ac890['length'];if(!_0x100d1d[_0x410d('0x31')][_0x410d('0x36')]('nolimit')){_0x36d4ce[_0x410d('0x19')]=qs[_0x410d('0x19')](_0x100d1d[_0x410d('0x31')][_0x410d('0x19')]);_0x36d4ce[_0x410d('0x18')]=qs[_0x410d('0x18')](_0x100d1d[_0x410d('0x31')][_0x410d('0x18')]);}return _0x3fa8db['getFields'](_0x36d4ce);}})[_0x410d('0x22')](function(_0x3d77fd){if(_0x3d77fd){return _0x3d77fd?{'count':_0x2919b1,'rows':_0x3d77fd}:null;}})['then'](respondWithResult(_0x3fca71,null))[_0x410d('0x44')](handleError(_0x3fca71,null));};exports[_0x410d('0x4d')]=function(_0x175ea3,_0x24349d,_0x461959){var _0x2f1254={};var _0xe649bc={};var _0xf645f2;var _0x2ae10f;return db['DeskConfiguration'][_0x410d('0x4e')]({'where':{'id':_0x175ea3[_0x410d('0x46')]['id']}})[_0x410d('0x22')](handleEntityNotFound(_0x24349d,null))[_0x410d('0x22')](function(_0x177c2d){if(_0x177c2d){_0xf645f2=_0x177c2d;_0xe649bc[_0x410d('0x2f')]=_[_0x410d('0x30')](db[_0x410d('0x4a')][_0x410d('0x2c')]);_0xe649bc[_0x410d('0x31')]=_['keys'](_0x175ea3[_0x410d('0x31')]);_0xe649bc[_0x410d('0x3b')]=_[_0x410d('0x33')](_0xe649bc[_0x410d('0x2f')],_0xe649bc[_0x410d('0x31')]);_0x2f1254[_0x410d('0x32')]=_[_0x410d('0x33')](_0xe649bc[_0x410d('0x2f')],qs[_0x410d('0x34')](_0x175ea3[_0x410d('0x31')][_0x410d('0x34')]));_0x2f1254['attributes']=_0x2f1254[_0x410d('0x32')][_0x410d('0x35')]?_0x2f1254[_0x410d('0x32')]:_0xe649bc[_0x410d('0x2f')];_0x2f1254[_0x410d('0x38')]=qs[_0x410d('0x39')](_0x175ea3['query'][_0x410d('0x39')]);_0x2f1254[_0x410d('0x3a')]=qs[_0x410d('0x3b')](_[_0x410d('0x3c')](_0x175ea3[_0x410d('0x31')],_0xe649bc[_0x410d('0x3b')]));if(_0x175ea3[_0x410d('0x31')][_0x410d('0x3f')]){_0x2f1254[_0x410d('0x3a')]=_['merge'](_0x2f1254[_0x410d('0x3a')],{'$or':_['map'](_0x2f1254[_0x410d('0x32')],function(_0x5788dc){var _0x54b262={};_0x54b262[_0x5788dc]={'$like':'%'+_0x175ea3['query']['filter']+'%'};return _0x54b262;})});}_0x2f1254=_[_0x410d('0x3d')]({},_0x2f1254,_0x175ea3['options']);return _0xf645f2['getSubjects'](_0x2f1254);}})[_0x410d('0x22')](function(_0xf0fcba){if(_0xf0fcba){_0x2ae10f=_0xf0fcba[_0x410d('0x35')];if(!_0x175ea3['query'][_0x410d('0x36')](_0x410d('0x37'))){_0x2f1254[_0x410d('0x19')]=qs['limit'](_0x175ea3[_0x410d('0x31')][_0x410d('0x19')]);_0x2f1254[_0x410d('0x18')]=qs[_0x410d('0x18')](_0x175ea3[_0x410d('0x31')][_0x410d('0x18')]);}return _0xf645f2[_0x410d('0x4d')](_0x2f1254);}})[_0x410d('0x22')](function(_0x387bc1){if(_0x387bc1){return _0x387bc1?{'count':_0x2ae10f,'rows':_0x387bc1}:null;}})[_0x410d('0x22')](respondWithResult(_0x24349d,null))[_0x410d('0x44')](handleError(_0x24349d,null));};exports[_0x410d('0x4f')]=function(_0x59805f,_0x437541,_0x1217d7){var _0x19cc35={};var _0x527204={};var _0x22702c;var _0x44d8d9;return db['DeskConfiguration']['findOne']({'where':{'id':_0x59805f[_0x410d('0x46')]['id']}})[_0x410d('0x22')](handleEntityNotFound(_0x437541,null))[_0x410d('0x22')](function(_0x36b9a6){if(_0x36b9a6){_0x22702c=_0x36b9a6;_0x527204[_0x410d('0x2f')]=_[_0x410d('0x30')](db[_0x410d('0x4a')]['rawAttributes']);_0x527204['query']=_['keys'](_0x59805f[_0x410d('0x31')]);_0x527204[_0x410d('0x3b')]=_['intersection'](_0x527204[_0x410d('0x2f')],_0x527204['query']);_0x19cc35[_0x410d('0x32')]=_[_0x410d('0x33')](_0x527204[_0x410d('0x2f')],qs[_0x410d('0x34')](_0x59805f[_0x410d('0x31')][_0x410d('0x34')]));_0x19cc35[_0x410d('0x32')]=_0x19cc35['attributes'][_0x410d('0x35')]?_0x19cc35[_0x410d('0x32')]:_0x527204[_0x410d('0x2f')];_0x19cc35[_0x410d('0x38')]=qs['sort'](_0x59805f[_0x410d('0x31')][_0x410d('0x39')]);_0x19cc35[_0x410d('0x3a')]=qs[_0x410d('0x3b')](_[_0x410d('0x3c')](_0x59805f['query'],_0x527204[_0x410d('0x3b')]));if(_0x59805f['query'][_0x410d('0x3f')]){_0x19cc35[_0x410d('0x3a')]=_[_0x410d('0x3d')](_0x19cc35[_0x410d('0x3a')],{'$or':_[_0x410d('0x2a')](_0x19cc35[_0x410d('0x32')],function(_0x2ef990){var _0x3aff60={};_0x3aff60[_0x2ef990]={'$like':'%'+_0x59805f[_0x410d('0x31')][_0x410d('0x3f')]+'%'};return _0x3aff60;})});}_0x19cc35=_['merge']({},_0x19cc35,_0x59805f[_0x410d('0x4b')]);return _0x22702c[_0x410d('0x4f')](_0x19cc35);}})['then'](function(_0x4a16e3){if(_0x4a16e3){_0x44d8d9=_0x4a16e3[_0x410d('0x35')];if(!_0x59805f[_0x410d('0x31')][_0x410d('0x36')](_0x410d('0x37'))){_0x19cc35[_0x410d('0x19')]=qs['limit'](_0x59805f[_0x410d('0x31')]['limit']);_0x19cc35['offset']=qs[_0x410d('0x18')](_0x59805f[_0x410d('0x31')][_0x410d('0x18')]);}return _0x22702c[_0x410d('0x4f')](_0x19cc35);}})[_0x410d('0x22')](function(_0x5cdf44){if(_0x5cdf44){return _0x5cdf44?{'count':_0x44d8d9,'rows':_0x5cdf44}:null;}})['then'](respondWithResult(_0x437541,null))['catch'](handleError(_0x437541,null));};exports[_0x410d('0x50')]=function(_0x30ffc1,_0x587df0,_0xb8e1fe){var _0x5ac324={};var _0x5b75b2={};var _0x12f5e1;var _0x1e2a79;return db[_0x410d('0x2b')]['findOne']({'where':{'id':_0x30ffc1[_0x410d('0x46')]['id']}})[_0x410d('0x22')](handleEntityNotFound(_0x587df0,null))[_0x410d('0x22')](function(_0x233d90){if(_0x233d90){_0x12f5e1=_0x233d90;_0x5b75b2[_0x410d('0x2f')]=_[_0x410d('0x30')](db[_0x410d('0x51')][_0x410d('0x2c')]);_0x5b75b2['query']=_[_0x410d('0x30')](_0x30ffc1[_0x410d('0x31')]);_0x5b75b2['filters']=_['intersection'](_0x5b75b2[_0x410d('0x2f')],_0x5b75b2[_0x410d('0x31')]);_0x5ac324[_0x410d('0x32')]=_[_0x410d('0x33')](_0x5b75b2[_0x410d('0x2f')],qs[_0x410d('0x34')](_0x30ffc1['query']['fields']));_0x5ac324['attributes']=_0x5ac324[_0x410d('0x32')][_0x410d('0x35')]?_0x5ac324['attributes']:_0x5b75b2[_0x410d('0x2f')];_0x5ac324[_0x410d('0x38')]=qs['sort'](_0x30ffc1[_0x410d('0x31')]['sort']);_0x5ac324[_0x410d('0x3a')]=qs['filters'](_[_0x410d('0x3c')](_0x30ffc1['query'],_0x5b75b2[_0x410d('0x3b')]));if(_0x30ffc1['query'][_0x410d('0x3f')]){_0x5ac324['where']=_['merge'](_0x5ac324['where'],{'$or':_[_0x410d('0x2a')](_0x5ac324[_0x410d('0x32')],function(_0x916e35){var _0x2fd618={};_0x2fd618[_0x916e35]={'$like':'%'+_0x30ffc1[_0x410d('0x31')]['filter']+'%'};return _0x2fd618;})});}_0x5ac324=_[_0x410d('0x3d')]({},_0x5ac324,_0x30ffc1[_0x410d('0x4b')]);return _0x12f5e1[_0x410d('0x50')](_0x5ac324);}})['then'](function(_0x259bb8){if(_0x259bb8){_0x1e2a79=_0x259bb8[_0x410d('0x35')];if(!_0x30ffc1[_0x410d('0x31')][_0x410d('0x36')]('nolimit')){_0x5ac324[_0x410d('0x19')]=qs[_0x410d('0x19')](_0x30ffc1[_0x410d('0x31')][_0x410d('0x19')]);_0x5ac324[_0x410d('0x18')]=qs[_0x410d('0x18')](_0x30ffc1[_0x410d('0x31')][_0x410d('0x18')]);}return _0x12f5e1[_0x410d('0x50')](_0x5ac324);}})['then'](function(_0x2d8a09){if(_0x2d8a09){return _0x2d8a09?{'count':_0x1e2a79,'rows':_0x2d8a09}:null;}})[_0x410d('0x22')](respondWithResult(_0x587df0,null))['catch'](handleError(_0x587df0,null));};exports[_0x410d('0x52')]=function(_0x4eab56,_0x1123d3,_0x1bf541){if(_0x4eab56['body']['id']){delete _0x4eab56['body']['id'];}return db[_0x410d('0x2b')]['findOne']({'where':{'id':_0x4eab56[_0x410d('0x46')]['id']}})[_0x410d('0x22')](handleEntityNotFound(_0x1123d3,null))['then'](function(_0x69d9cf){if(_0x69d9cf){return _0x69d9cf[_0x410d('0x52')](_0x4eab56['body'][_0x410d('0x53')]||[]);}return null;})[_0x410d('0x22')](respondWithResult(_0x1123d3,null))['catch'](handleError(_0x1123d3,null));}; \ No newline at end of file +var _0x8669=['update','then','destroy','error','name','send','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','DeskConfiguration','catch','show','fields','includeAll','find','create','body','params','getFields','findOne','DeskField','order','getSubjects','getDescriptions','getTags','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','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','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save'];(function(_0x5bf2b3,_0xfcd364){var _0x5e8a9b=function(_0x43546b){while(--_0x43546b){_0x5bf2b3['push'](_0x5bf2b3['shift']());}};_0x5e8a9b(++_0xfcd364);}(_0x8669,0x7a));var _0x9866=function(_0x23d6e3,_0x276568){_0x23d6e3=_0x23d6e3-0x0;var _0x3bf875=_0x8669[_0x23d6e3];return _0x3bf875;};'use strict';var emlformat=require(_0x9866('0x0'));var rimraf=require(_0x9866('0x1'));var zipdir=require(_0x9866('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9866('0x3'));var BPromise=require(_0x9866('0x4'));var Mustache=require(_0x9866('0x5'));var util=require(_0x9866('0x6'));var path=require('path');var sox=require(_0x9866('0x7'));var csv=require(_0x9866('0x8'));var ejs=require(_0x9866('0x9'));var fs=require('fs');var fs_extra=require(_0x9866('0xa'));var _=require(_0x9866('0xb'));var squel=require(_0x9866('0xc'));var crypto=require(_0x9866('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9866('0xe'));var toCsv=require(_0x9866('0x8'));var querystring=require(_0x9866('0xf'));var Papa=require('papaparse');var Redis=require(_0x9866('0x10'));var authService=require(_0x9866('0x11'));var qs=require(_0x9866('0x12'));var as=require(_0x9866('0x13'));var hardwareService=require(_0x9866('0x14'));var logger=require(_0x9866('0x15'))(_0x9866('0x16'));var utils=require(_0x9866('0x17'));var config=require(_0x9866('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cd6d7,_0x6d1e35){_0x6d1e35=_0x6d1e35||0xcc;return function(_0x1f34f2){if(_0x1f34f2){return _0x3cd6d7['sendStatus'](_0x6d1e35);}return _0x3cd6d7[_0x9866('0x19')](_0x6d1e35)[_0x9866('0x1a')]();};}function respondWithResult(_0x58086f,_0x3a014d){_0x3a014d=_0x3a014d||0xc8;return function(_0x4c0789){if(_0x4c0789){return _0x58086f[_0x9866('0x19')](_0x3a014d)[_0x9866('0x1b')](_0x4c0789);}};}function respondWithFilteredResult(_0x226944,_0xa8cc1f){return function(_0x1868d4){if(_0x1868d4){var _0x3558e9=typeof _0xa8cc1f[_0x9866('0x1c')]===_0x9866('0x1d')&&typeof _0xa8cc1f['limit']===_0x9866('0x1d');var _0x2d0c26=_0x1868d4[_0x9866('0x1e')];var _0x4bc763=_0x3558e9?0x0:_0xa8cc1f[_0x9866('0x1c')];var _0x26020a=_0x3558e9?_0x1868d4[_0x9866('0x1e')]:_0xa8cc1f[_0x9866('0x1c')]+_0xa8cc1f[_0x9866('0x1f')];var _0x37ccf5;if(_0x26020a>=_0x2d0c26){_0x26020a=_0x2d0c26;_0x37ccf5=0xc8;}else{_0x37ccf5=0xce;}_0x226944[_0x9866('0x19')](_0x37ccf5);return _0x226944[_0x9866('0x20')](_0x9866('0x21'),_0x4bc763+'-'+_0x26020a+'/'+_0x2d0c26)[_0x9866('0x1b')](_0x1868d4);}return null;};}function patchUpdates(_0x59e685){return function(_0x4c8a31){try{jsonpatch['apply'](_0x4c8a31,_0x59e685,!![]);}catch(_0x4bbd74){return BPromise[_0x9866('0x22')](_0x4bbd74);}return _0x4c8a31[_0x9866('0x23')]();};}function saveUpdates(_0x361749,_0x33c716){return function(_0x24cb9e){if(_0x24cb9e){return _0x24cb9e[_0x9866('0x24')](_0x361749)[_0x9866('0x25')](function(_0xdd3499){return _0xdd3499;});}return null;};}function removeEntity(_0x217dc3,_0x14f2bf){return function(_0x396838){if(_0x396838){return _0x396838[_0x9866('0x26')]()['then'](function(){_0x217dc3['status'](0xcc)[_0x9866('0x1a')]();});}};}function handleEntityNotFound(_0x2d6f55,_0x403410){return function(_0xd3cd47){if(!_0xd3cd47){_0x2d6f55['sendStatus'](0x194);}return _0xd3cd47;};}function handleError(_0x5cc86e,_0x3d0ccf){_0x3d0ccf=_0x3d0ccf||0x1f4;return function(_0x276f37){logger[_0x9866('0x27')](_0x276f37['stack']);if(_0x276f37['name']){delete _0x276f37[_0x9866('0x28')];}_0x5cc86e[_0x9866('0x19')](_0x3d0ccf)[_0x9866('0x29')](_0x276f37);};}exports['index']=function(_0x2cda81,_0x480cc1){var _0x4fb6b7={},_0x3003c8={},_0x2d3ca7={'count':0x0,'rows':[]};var _0x4baac4=_[_0x9866('0x2a')](db['DeskConfiguration'][_0x9866('0x2b')],function(_0x74cd51){return{'name':_0x74cd51['fieldName'],'type':_0x74cd51[_0x9866('0x2c')][_0x9866('0x2d')]};});_0x3003c8['model']=_[_0x9866('0x2a')](_0x4baac4,_0x9866('0x28'));_0x3003c8[_0x9866('0x2e')]=_[_0x9866('0x2f')](_0x2cda81[_0x9866('0x2e')]);_0x3003c8[_0x9866('0x30')]=_[_0x9866('0x31')](_0x3003c8[_0x9866('0x32')],_0x3003c8[_0x9866('0x2e')]);_0x4fb6b7[_0x9866('0x33')]=_[_0x9866('0x31')](_0x3003c8['model'],qs['fields'](_0x2cda81['query']['fields']));_0x4fb6b7['attributes']=_0x4fb6b7[_0x9866('0x33')][_0x9866('0x34')]?_0x4fb6b7[_0x9866('0x33')]:_0x3003c8[_0x9866('0x32')];if(!_0x2cda81[_0x9866('0x2e')][_0x9866('0x35')](_0x9866('0x36'))){_0x4fb6b7[_0x9866('0x1f')]=qs[_0x9866('0x1f')](_0x2cda81['query'][_0x9866('0x1f')]);_0x4fb6b7[_0x9866('0x1c')]=qs['offset'](_0x2cda81[_0x9866('0x2e')][_0x9866('0x1c')]);}_0x4fb6b7['order']=qs[_0x9866('0x37')](_0x2cda81[_0x9866('0x2e')][_0x9866('0x37')]);_0x4fb6b7[_0x9866('0x38')]=qs[_0x9866('0x30')](_[_0x9866('0x39')](_0x2cda81[_0x9866('0x2e')],_0x3003c8[_0x9866('0x30')]),_0x4baac4);if(_0x2cda81[_0x9866('0x2e')]['filter']){_0x4fb6b7[_0x9866('0x38')]=_[_0x9866('0x3a')](_0x4fb6b7['where'],{'$or':_[_0x9866('0x2a')](_0x4baac4,function(_0x2793c2){if(_0x2793c2[_0x9866('0x2c')]!==_0x9866('0x3b')){var _0x2222ca={};_0x2222ca[_0x2793c2['name']]={'$like':'%'+_0x2cda81[_0x9866('0x2e')][_0x9866('0x3c')]+'%'};return _0x2222ca;}})});}_0x4fb6b7=_[_0x9866('0x3a')]({},_0x4fb6b7,_0x2cda81[_0x9866('0x3d')]);var _0x4ef5bf={'where':_0x4fb6b7[_0x9866('0x38')]};return db['DeskConfiguration'][_0x9866('0x1e')](_0x4ef5bf)[_0x9866('0x25')](function(_0x49923d){_0x2d3ca7[_0x9866('0x1e')]=_0x49923d;if(_0x2cda81[_0x9866('0x2e')]['includeAll']){_0x4fb6b7[_0x9866('0x3e')]=[{'all':!![]}];}return db[_0x9866('0x3f')]['findAll'](_0x4fb6b7);})[_0x9866('0x25')](function(_0x2ee4e1){_0x2d3ca7['rows']=_0x2ee4e1;return _0x2d3ca7;})[_0x9866('0x25')](respondWithFilteredResult(_0x480cc1,_0x4fb6b7))[_0x9866('0x40')](handleError(_0x480cc1,null));};exports[_0x9866('0x41')]=function(_0x468a49,_0x1d0dc0){var _0x2df1ff={'raw':![],'where':{'id':_0x468a49['params']['id']}},_0x52fc4d={};_0x52fc4d[_0x9866('0x32')]=_['keys'](db['DeskConfiguration'][_0x9866('0x2b')]);_0x52fc4d['query']=_[_0x9866('0x2f')](_0x468a49[_0x9866('0x2e')]);_0x52fc4d[_0x9866('0x30')]=_[_0x9866('0x31')](_0x52fc4d[_0x9866('0x32')],_0x52fc4d[_0x9866('0x2e')]);_0x2df1ff['attributes']=_[_0x9866('0x31')](_0x52fc4d[_0x9866('0x32')],qs[_0x9866('0x42')](_0x468a49[_0x9866('0x2e')][_0x9866('0x42')]));_0x2df1ff[_0x9866('0x33')]=_0x2df1ff[_0x9866('0x33')][_0x9866('0x34')]?_0x2df1ff[_0x9866('0x33')]:_0x52fc4d['model'];if(_0x468a49['query'][_0x9866('0x43')]){_0x2df1ff[_0x9866('0x3e')]=[{'all':!![]}];}_0x2df1ff=_[_0x9866('0x3a')]({},_0x2df1ff,_0x468a49[_0x9866('0x3d')]);return db[_0x9866('0x3f')][_0x9866('0x44')](_0x2df1ff)[_0x9866('0x25')](handleEntityNotFound(_0x1d0dc0,null))[_0x9866('0x25')](respondWithResult(_0x1d0dc0,null))[_0x9866('0x40')](handleError(_0x1d0dc0,null));};exports[_0x9866('0x45')]=function(_0x22c92c,_0x57b90c){return db[_0x9866('0x3f')]['create'](_0x22c92c[_0x9866('0x46')],{})[_0x9866('0x25')](respondWithResult(_0x57b90c,0xc9))[_0x9866('0x40')](handleError(_0x57b90c,null));};exports['update']=function(_0x1445f7,_0x3e6f94){if(_0x1445f7[_0x9866('0x46')]['id']){delete _0x1445f7[_0x9866('0x46')]['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x1445f7[_0x9866('0x47')]['id']}})[_0x9866('0x25')](handleEntityNotFound(_0x3e6f94,null))['then'](saveUpdates(_0x1445f7[_0x9866('0x46')],null))['then'](respondWithResult(_0x3e6f94,null))[_0x9866('0x40')](handleError(_0x3e6f94,null));};exports[_0x9866('0x26')]=function(_0x81e54b,_0x4cf96b){return db[_0x9866('0x3f')][_0x9866('0x44')]({'where':{'id':_0x81e54b[_0x9866('0x47')]['id']}})['then'](handleEntityNotFound(_0x4cf96b,null))['then'](removeEntity(_0x4cf96b,null))['catch'](handleError(_0x4cf96b,null));};exports[_0x9866('0x48')]=function(_0x103979,_0x540c14,_0x4080a5){var _0x2045d2={};var _0x3e5236={};var _0x1bba3a;var _0x4cdd11;return db['DeskConfiguration'][_0x9866('0x49')]({'where':{'id':_0x103979['params']['id']}})['then'](handleEntityNotFound(_0x540c14,null))[_0x9866('0x25')](function(_0x7b6a45){if(_0x7b6a45){_0x1bba3a=_0x7b6a45;_0x3e5236['model']=_[_0x9866('0x2f')](db[_0x9866('0x4a')][_0x9866('0x2b')]);_0x3e5236[_0x9866('0x2e')]=_[_0x9866('0x2f')](_0x103979[_0x9866('0x2e')]);_0x3e5236[_0x9866('0x30')]=_[_0x9866('0x31')](_0x3e5236[_0x9866('0x32')],_0x3e5236[_0x9866('0x2e')]);_0x2045d2[_0x9866('0x33')]=_[_0x9866('0x31')](_0x3e5236[_0x9866('0x32')],qs['fields'](_0x103979[_0x9866('0x2e')][_0x9866('0x42')]));_0x2045d2['attributes']=_0x2045d2[_0x9866('0x33')][_0x9866('0x34')]?_0x2045d2['attributes']:_0x3e5236[_0x9866('0x32')];_0x2045d2[_0x9866('0x4b')]=qs[_0x9866('0x37')](_0x103979[_0x9866('0x2e')][_0x9866('0x37')]);_0x2045d2[_0x9866('0x38')]=qs[_0x9866('0x30')](_[_0x9866('0x39')](_0x103979[_0x9866('0x2e')],_0x3e5236[_0x9866('0x30')]));if(_0x103979['query']['filter']){_0x2045d2[_0x9866('0x38')]=_['merge'](_0x2045d2[_0x9866('0x38')],{'$or':_[_0x9866('0x2a')](_0x2045d2[_0x9866('0x33')],function(_0x3bcc2e){var _0x4b61e4={};_0x4b61e4[_0x3bcc2e]={'$like':'%'+_0x103979[_0x9866('0x2e')][_0x9866('0x3c')]+'%'};return _0x4b61e4;})});}_0x2045d2=_[_0x9866('0x3a')]({},_0x2045d2,_0x103979[_0x9866('0x3d')]);return _0x1bba3a[_0x9866('0x48')](_0x2045d2);}})[_0x9866('0x25')](function(_0xf21c99){if(_0xf21c99){_0x4cdd11=_0xf21c99['length'];if(!_0x103979[_0x9866('0x2e')][_0x9866('0x35')](_0x9866('0x36'))){_0x2045d2['limit']=qs['limit'](_0x103979[_0x9866('0x2e')][_0x9866('0x1f')]);_0x2045d2[_0x9866('0x1c')]=qs[_0x9866('0x1c')](_0x103979[_0x9866('0x2e')][_0x9866('0x1c')]);}return _0x1bba3a['getFields'](_0x2045d2);}})[_0x9866('0x25')](function(_0x3aeb5b){if(_0x3aeb5b){return _0x3aeb5b?{'count':_0x4cdd11,'rows':_0x3aeb5b}:null;}})[_0x9866('0x25')](respondWithResult(_0x540c14,null))[_0x9866('0x40')](handleError(_0x540c14,null));};exports[_0x9866('0x4c')]=function(_0x4e3244,_0x80728e,_0x3f48a5){var _0x504507={};var _0x4bdf91={};var _0x36a600;var _0x1e8858;return db[_0x9866('0x3f')]['findOne']({'where':{'id':_0x4e3244[_0x9866('0x47')]['id']}})[_0x9866('0x25')](handleEntityNotFound(_0x80728e,null))['then'](function(_0x3267ec){if(_0x3267ec){_0x36a600=_0x3267ec;_0x4bdf91['model']=_['keys'](db[_0x9866('0x4a')][_0x9866('0x2b')]);_0x4bdf91['query']=_[_0x9866('0x2f')](_0x4e3244['query']);_0x4bdf91['filters']=_[_0x9866('0x31')](_0x4bdf91[_0x9866('0x32')],_0x4bdf91[_0x9866('0x2e')]);_0x504507['attributes']=_[_0x9866('0x31')](_0x4bdf91[_0x9866('0x32')],qs[_0x9866('0x42')](_0x4e3244[_0x9866('0x2e')][_0x9866('0x42')]));_0x504507[_0x9866('0x33')]=_0x504507[_0x9866('0x33')][_0x9866('0x34')]?_0x504507[_0x9866('0x33')]:_0x4bdf91[_0x9866('0x32')];_0x504507['order']=qs[_0x9866('0x37')](_0x4e3244[_0x9866('0x2e')][_0x9866('0x37')]);_0x504507[_0x9866('0x38')]=qs['filters'](_[_0x9866('0x39')](_0x4e3244[_0x9866('0x2e')],_0x4bdf91[_0x9866('0x30')]));if(_0x4e3244[_0x9866('0x2e')][_0x9866('0x3c')]){_0x504507[_0x9866('0x38')]=_[_0x9866('0x3a')](_0x504507['where'],{'$or':_[_0x9866('0x2a')](_0x504507[_0x9866('0x33')],function(_0x5b510a){var _0x1ee67d={};_0x1ee67d[_0x5b510a]={'$like':'%'+_0x4e3244[_0x9866('0x2e')][_0x9866('0x3c')]+'%'};return _0x1ee67d;})});}_0x504507=_[_0x9866('0x3a')]({},_0x504507,_0x4e3244[_0x9866('0x3d')]);return _0x36a600[_0x9866('0x4c')](_0x504507);}})['then'](function(_0x181491){if(_0x181491){_0x1e8858=_0x181491['length'];if(!_0x4e3244[_0x9866('0x2e')][_0x9866('0x35')](_0x9866('0x36'))){_0x504507[_0x9866('0x1f')]=qs['limit'](_0x4e3244[_0x9866('0x2e')][_0x9866('0x1f')]);_0x504507[_0x9866('0x1c')]=qs['offset'](_0x4e3244[_0x9866('0x2e')][_0x9866('0x1c')]);}return _0x36a600['getSubjects'](_0x504507);}})[_0x9866('0x25')](function(_0x5102e7){if(_0x5102e7){return _0x5102e7?{'count':_0x1e8858,'rows':_0x5102e7}:null;}})[_0x9866('0x25')](respondWithResult(_0x80728e,null))['catch'](handleError(_0x80728e,null));};exports[_0x9866('0x4d')]=function(_0x115641,_0x3df5fb,_0x2b524a){var _0x22c19c={};var _0x417441={};var _0x38fa45;var _0x4b65be;return db[_0x9866('0x3f')]['findOne']({'where':{'id':_0x115641[_0x9866('0x47')]['id']}})[_0x9866('0x25')](handleEntityNotFound(_0x3df5fb,null))[_0x9866('0x25')](function(_0x138cb7){if(_0x138cb7){_0x38fa45=_0x138cb7;_0x417441['model']=_[_0x9866('0x2f')](db[_0x9866('0x4a')][_0x9866('0x2b')]);_0x417441[_0x9866('0x2e')]=_[_0x9866('0x2f')](_0x115641[_0x9866('0x2e')]);_0x417441['filters']=_[_0x9866('0x31')](_0x417441[_0x9866('0x32')],_0x417441[_0x9866('0x2e')]);_0x22c19c[_0x9866('0x33')]=_['intersection'](_0x417441[_0x9866('0x32')],qs['fields'](_0x115641[_0x9866('0x2e')][_0x9866('0x42')]));_0x22c19c['attributes']=_0x22c19c[_0x9866('0x33')][_0x9866('0x34')]?_0x22c19c[_0x9866('0x33')]:_0x417441[_0x9866('0x32')];_0x22c19c[_0x9866('0x4b')]=qs[_0x9866('0x37')](_0x115641[_0x9866('0x2e')]['sort']);_0x22c19c['where']=qs[_0x9866('0x30')](_[_0x9866('0x39')](_0x115641[_0x9866('0x2e')],_0x417441['filters']));if(_0x115641[_0x9866('0x2e')][_0x9866('0x3c')]){_0x22c19c[_0x9866('0x38')]=_[_0x9866('0x3a')](_0x22c19c[_0x9866('0x38')],{'$or':_['map'](_0x22c19c[_0x9866('0x33')],function(_0x1781a4){var _0x15e4c4={};_0x15e4c4[_0x1781a4]={'$like':'%'+_0x115641[_0x9866('0x2e')][_0x9866('0x3c')]+'%'};return _0x15e4c4;})});}_0x22c19c=_[_0x9866('0x3a')]({},_0x22c19c,_0x115641['options']);return _0x38fa45[_0x9866('0x4d')](_0x22c19c);}})[_0x9866('0x25')](function(_0x466255){if(_0x466255){_0x4b65be=_0x466255[_0x9866('0x34')];if(!_0x115641[_0x9866('0x2e')]['hasOwnProperty']('nolimit')){_0x22c19c[_0x9866('0x1f')]=qs[_0x9866('0x1f')](_0x115641['query'][_0x9866('0x1f')]);_0x22c19c[_0x9866('0x1c')]=qs[_0x9866('0x1c')](_0x115641[_0x9866('0x2e')][_0x9866('0x1c')]);}return _0x38fa45[_0x9866('0x4d')](_0x22c19c);}})[_0x9866('0x25')](function(_0x13f218){if(_0x13f218){return _0x13f218?{'count':_0x4b65be,'rows':_0x13f218}:null;}})['then'](respondWithResult(_0x3df5fb,null))['catch'](handleError(_0x3df5fb,null));};exports[_0x9866('0x4e')]=function(_0x21c592,_0xa45f47,_0xa1b5d0){var _0x30bc93={};var _0x51e19b={};var _0x4a73a0;var _0x52247b;return db['DeskConfiguration'][_0x9866('0x49')]({'where':{'id':_0x21c592['params']['id']}})[_0x9866('0x25')](handleEntityNotFound(_0xa45f47,null))['then'](function(_0x481c84){if(_0x481c84){_0x4a73a0=_0x481c84;_0x51e19b[_0x9866('0x32')]=_[_0x9866('0x2f')](db['Tag'][_0x9866('0x2b')]);_0x51e19b['query']=_['keys'](_0x21c592[_0x9866('0x2e')]);_0x51e19b['filters']=_[_0x9866('0x31')](_0x51e19b[_0x9866('0x32')],_0x51e19b[_0x9866('0x2e')]);_0x30bc93['attributes']=_[_0x9866('0x31')](_0x51e19b[_0x9866('0x32')],qs['fields'](_0x21c592[_0x9866('0x2e')][_0x9866('0x42')]));_0x30bc93[_0x9866('0x33')]=_0x30bc93[_0x9866('0x33')][_0x9866('0x34')]?_0x30bc93[_0x9866('0x33')]:_0x51e19b['model'];_0x30bc93[_0x9866('0x4b')]=qs[_0x9866('0x37')](_0x21c592[_0x9866('0x2e')][_0x9866('0x37')]);_0x30bc93[_0x9866('0x38')]=qs['filters'](_[_0x9866('0x39')](_0x21c592['query'],_0x51e19b[_0x9866('0x30')]));if(_0x21c592[_0x9866('0x2e')]['filter']){_0x30bc93[_0x9866('0x38')]=_[_0x9866('0x3a')](_0x30bc93[_0x9866('0x38')],{'$or':_[_0x9866('0x2a')](_0x30bc93['attributes'],function(_0x5b9756){var _0x5c2e94={};_0x5c2e94[_0x5b9756]={'$like':'%'+_0x21c592['query']['filter']+'%'};return _0x5c2e94;})});}_0x30bc93=_['merge']({},_0x30bc93,_0x21c592[_0x9866('0x3d')]);return _0x4a73a0[_0x9866('0x4e')](_0x30bc93);}})[_0x9866('0x25')](function(_0x4ed9e7){if(_0x4ed9e7){_0x52247b=_0x4ed9e7[_0x9866('0x34')];if(!_0x21c592[_0x9866('0x2e')][_0x9866('0x35')](_0x9866('0x36'))){_0x30bc93[_0x9866('0x1f')]=qs[_0x9866('0x1f')](_0x21c592['query'][_0x9866('0x1f')]);_0x30bc93[_0x9866('0x1c')]=qs['offset'](_0x21c592[_0x9866('0x2e')][_0x9866('0x1c')]);}return _0x4a73a0[_0x9866('0x4e')](_0x30bc93);}})['then'](function(_0x274dbd){if(_0x274dbd){return _0x274dbd?{'count':_0x52247b,'rows':_0x274dbd}:null;}})[_0x9866('0x25')](respondWithResult(_0xa45f47,null))[_0x9866('0x40')](handleError(_0xa45f47,null));};exports['setTags']=function(_0x23f7f5,_0xc875e2,_0x12c66c){if(_0x23f7f5[_0x9866('0x46')]['id']){delete _0x23f7f5[_0x9866('0x46')]['id'];}return db['DeskConfiguration'][_0x9866('0x49')]({'where':{'id':_0x23f7f5[_0x9866('0x47')]['id']}})[_0x9866('0x25')](handleEntityNotFound(_0xc875e2,null))['then'](function(_0x2f010d){if(_0x2f010d){return _0x2f010d['setTags'](_0x23f7f5['body']['ids']||[]);}return null;})[_0x9866('0x25')](respondWithResult(_0xc875e2,null))[_0x9866('0x40')](handleError(_0xc875e2,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index f885d9f..fa8b016 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 _0x7d91=['request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','define','DeskConfiguration','int_desk_configurations','util','api','moment','bluebird'];(function(_0x12995,_0x3297fc){var _0x4e5266=function(_0x392e79){while(--_0x392e79){_0x12995['push'](_0x12995['shift']());}};_0x4e5266(++_0x3297fc);}(_0x7d91,0x10f));var _0x17d9=function(_0x44cec3,_0x511021){_0x44cec3=_0x44cec3-0x0;var _0x41de6e=_0x7d91[_0x44cec3];return _0x41de6e;};'use strict';var _=require('lodash');var util=require(_0x17d9('0x0'));var logger=require('../../config/logger')(_0x17d9('0x1'));var moment=require(_0x17d9('0x2'));var BPromise=require(_0x17d9('0x3'));var rp=require(_0x17d9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17d9('0x5'));var config=require(_0x17d9('0x6'));var attributes=require(_0x17d9('0x7'));module['exports']=function(_0x5c7089,_0x4ffb6d){return _0x5c7089[_0x17d9('0x8')](_0x17d9('0x9'),attributes,{'tableName':_0x17d9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07f4=['int_desk_configurations','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','define','DeskConfiguration'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x07f4,0xe7));var _0x407f=function(_0x1196d8,_0x2da3f6){_0x1196d8=_0x1196d8-0x0;var _0x27d2b0=_0x07f4[_0x1196d8];return _0x27d2b0;};'use strict';var _=require(_0x407f('0x0'));var util=require('util');var logger=require(_0x407f('0x1'))('api');var moment=require(_0x407f('0x2'));var BPromise=require('bluebird');var rp=require(_0x407f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x407f('0x4'));var config=require(_0x407f('0x5'));var attributes=require(_0x407f('0x6'));module['exports']=function(_0x2e26cf,_0x22006e){return _0x2e26cf[_0x407f('0x7')](_0x407f('0x8'),attributes,{'tableName':_0x407f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 7d878ee..bbbde98 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 _0x27f3=['debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x175ece,_0x3fa50e){var _0x448b5b=function(_0x5c3723){while(--_0x5c3723){_0x175ece['push'](_0x175ece['shift']());}};_0x448b5b(++_0x3fa50e);}(_0x27f3,0x1e9));var _0x327f=function(_0x55a89e,_0x1a05ab){_0x55a89e=_0x55a89e-0x0;var _0x3aa2bd=_0x27f3[_0x55a89e];return _0x3aa2bd;};'use strict';var _=require(_0x327f('0x0'));var util=require(_0x327f('0x1'));var moment=require('moment');var BPromise=require(_0x327f('0x2'));var rs=require(_0x327f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x327f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x327f('0x5'))(_0x327f('0x6'));var config=require(_0x327f('0x7'));var jayson=require(_0x327f('0x8'));var client=jayson[_0x327f('0x9')][_0x327f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x181949,_0x19b8cc,_0x551a98){return new BPromise(function(_0x12b0f7,_0x3b4593){return client[_0x327f('0xb')](_0x181949,_0x551a98)[_0x327f('0xc')](function(_0x89473b){logger[_0x327f('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x19b8cc,_0x327f('0xe'));logger[_0x327f('0xf')](_0x327f('0x10'),_0x19b8cc,_0x327f('0xe'),JSON[_0x327f('0x11')](_0x89473b));if(_0x89473b[_0x327f('0x12')]){if(_0x89473b[_0x327f('0x12')][_0x327f('0x13')]===0x1f4){logger['error'](_0x327f('0x14'),_0x19b8cc,_0x89473b[_0x327f('0x12')][_0x327f('0x15')]);return _0x3b4593(_0x89473b[_0x327f('0x12')][_0x327f('0x15')]);}logger[_0x327f('0x12')](_0x327f('0x14'),_0x19b8cc,_0x89473b[_0x327f('0x12')]['message']);return _0x12b0f7(_0x89473b['error'][_0x327f('0x15')]);}else{logger[_0x327f('0xd')](_0x327f('0x14'),_0x19b8cc,_0x327f('0xe'));_0x12b0f7(_0x89473b[_0x327f('0x16')][_0x327f('0x15')]);}})[_0x327f('0x17')](function(_0x6de69e){logger[_0x327f('0x12')](_0x327f('0x14'),_0x19b8cc,_0x6de69e);_0x3b4593(_0x6de69e);});});} \ No newline at end of file +var _0xfc6d=['message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x608480,_0x11451f){var _0x28d63c=function(_0x505c26){while(--_0x505c26){_0x608480['push'](_0x608480['shift']());}};_0x28d63c(++_0x11451f);}(_0xfc6d,0x1e6));var _0xdfc6=function(_0x33cbd8,_0x55677f){_0x33cbd8=_0x33cbd8-0x0;var _0x4b765f=_0xfc6d[_0x33cbd8];return _0x4b765f;};'use strict';var _=require(_0xdfc6('0x0'));var util=require(_0xdfc6('0x1'));var moment=require(_0xdfc6('0x2'));var BPromise=require(_0xdfc6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdfc6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdfc6('0x5'))(_0xdfc6('0x6'));var config=require('../../config/environment');var jayson=require(_0xdfc6('0x7'));var client=jayson['client'][_0xdfc6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2fc9e6,_0x2c45d6,_0x3e29c7){return new BPromise(function(_0x7b90c6,_0x2a680d){return client[_0xdfc6('0x9')](_0x2fc9e6,_0x3e29c7)[_0xdfc6('0xa')](function(_0x46c3bf){logger[_0xdfc6('0xb')](_0xdfc6('0xc'),_0x2c45d6,_0xdfc6('0xd'));logger[_0xdfc6('0xe')](_0xdfc6('0xf'),_0x2c45d6,_0xdfc6('0xd'),JSON['stringify'](_0x46c3bf));if(_0x46c3bf[_0xdfc6('0x10')]){if(_0x46c3bf[_0xdfc6('0x10')][_0xdfc6('0x11')]===0x1f4){logger[_0xdfc6('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x2c45d6,_0x46c3bf[_0xdfc6('0x10')][_0xdfc6('0x12')]);return _0x2a680d(_0x46c3bf[_0xdfc6('0x10')][_0xdfc6('0x12')]);}logger[_0xdfc6('0x10')](_0xdfc6('0xc'),_0x2c45d6,_0x46c3bf[_0xdfc6('0x10')][_0xdfc6('0x12')]);return _0x7b90c6(_0x46c3bf[_0xdfc6('0x10')][_0xdfc6('0x12')]);}else{logger[_0xdfc6('0xb')](_0xdfc6('0xc'),_0x2c45d6,'request\x20sent');_0x7b90c6(_0x46c3bf[_0xdfc6('0x13')][_0xdfc6('0x12')]);}})[_0xdfc6('0x14')](function(_0x7f2477){logger[_0xdfc6('0x10')](_0xdfc6('0xc'),_0x2c45d6,_0x7f2477);_0x2a680d(_0x7f2477);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 31c9651..d99e279 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 _0x8bf8=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','isAuthenticated','/:id','show'];(function(_0x4ceb7c,_0x4dbb30){var _0x21cca2=function(_0x5d8162){while(--_0x5d8162){_0x4ceb7c['push'](_0x4ceb7c['shift']());}};_0x21cca2(++_0x4dbb30);}(_0x8bf8,0x84));var _0x88bf=function(_0x355ad3,_0x36d054){_0x355ad3=_0x355ad3-0x0;var _0x9b9c8=_0x8bf8[_0x355ad3];return _0x9b9c8;};'use strict';var multer=require(_0x88bf('0x0'));var util=require(_0x88bf('0x1'));var path=require(_0x88bf('0x2'));var timeout=require(_0x88bf('0x3'));var express=require(_0x88bf('0x4'));var router=express[_0x88bf('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x88bf('0x6'));var interaction=require(_0x88bf('0x7'));var config=require('../../config/environment');var controller=require(_0x88bf('0x8'));router['get']('/',auth[_0x88bf('0x9')](),controller['index']);router['get'](_0x88bf('0xa'),auth[_0x88bf('0x9')](),controller[_0x88bf('0xb')]);router['post']('/',auth[_0x88bf('0x9')](),controller[_0x88bf('0xc')]);router[_0x88bf('0xd')](_0x88bf('0xa'),auth[_0x88bf('0x9')](),controller[_0x88bf('0xe')]);router[_0x88bf('0xf')]('/:id',auth[_0x88bf('0x9')](),controller[_0x88bf('0x10')]);module[_0x88bf('0x11')]=router; \ No newline at end of file +var _0x0735=['create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','index','/:id','show','post'];(function(_0x1de747,_0x4c7aca){var _0x21eda8=function(_0x27483c){while(--_0x27483c){_0x1de747['push'](_0x1de747['shift']());}};_0x21eda8(++_0x4c7aca);}(_0x0735,0x7d));var _0x5073=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x0735[_0x4709c0];return _0x13348b;};'use strict';var multer=require(_0x5073('0x0'));var util=require(_0x5073('0x1'));var path=require(_0x5073('0x2'));var timeout=require(_0x5073('0x3'));var express=require('express');var router=express[_0x5073('0x4')]();var fs_extra=require(_0x5073('0x5'));var auth=require(_0x5073('0x6'));var interaction=require(_0x5073('0x7'));var config=require(_0x5073('0x8'));var controller=require(_0x5073('0x9'));router['get']('/',auth[_0x5073('0xa')](),controller[_0x5073('0xb')]);router['get'](_0x5073('0xc'),auth[_0x5073('0xa')](),controller[_0x5073('0xd')]);router[_0x5073('0xe')]('/',auth[_0x5073('0xa')](),controller[_0x5073('0xf')]);router[_0x5073('0x10')](_0x5073('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x5073('0x11')](_0x5073('0xc'),auth[_0x5073('0xa')](),controller[_0x5073('0x12')]);module[_0x5073('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 a7118f6..661cb96 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 _0x62dd=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x62dd,0x14d));var _0xd62d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x62dd[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module[_0xd62d('0x0')]={'type':{'type':Sequelize[_0xd62d('0x1')](_0xd62d('0x2'),_0xd62d('0x3'),_0xd62d('0x4'),_0xd62d('0x5'),_0xd62d('0x6')),'defaultValue':_0xd62d('0x2')},'content':{'type':Sequelize[_0xd62d('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd62d('0x1')]('string','variable',_0xd62d('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd62d('0x7')]},'customField':{'type':Sequelize[_0xd62d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd62d('0x7')]}}; \ No newline at end of file +var _0x30db=['ENUM','string','variable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x43026b,_0x928d8c){var _0x4a96cd=function(_0x362cbd){while(--_0x362cbd){_0x43026b['push'](_0x43026b['shift']());}};_0x4a96cd(++_0x928d8c);}(_0x30db,0xf7));var _0xb30d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x30db[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xb30d('0x0'));module['exports']={'type':{'type':Sequelize[_0xb30d('0x1')](_0xb30d('0x2'),_0xb30d('0x3'),'customVariable',_0xb30d('0x4'),_0xb30d('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb30d('0x6')]},'key':{'type':Sequelize[_0xb30d('0x6')]},'keyType':{'type':Sequelize[_0xb30d('0x1')](_0xb30d('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xb30d('0x6')]},'idField':{'type':Sequelize[_0xb30d('0x6')]},'nameField':{'type':Sequelize[_0xb30d('0x6')]},'customField':{'type':Sequelize[_0xb30d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 5a9f31b..0c0d665 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 _0x9d2f=['fieldName','key','model','query','filters','intersection','attributes','fields','length','sort','pick','filter','where','type','VIRTUAL','merge','includeAll','include','catch','show','keys','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','undefined','count','offset','limit','status','reject','save','update','then','destroy','error','stack','name','send','index','map','DeskField','rawAttributes'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x9d2f,0x14a));var _0xf9d2=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9d2f[_0x36c5b0];return _0xf19333;};'use strict';var emlformat=require(_0xf9d2('0x0'));var rimraf=require(_0xf9d2('0x1'));var zipdir=require(_0xf9d2('0x2'));var jsonpatch=require(_0xf9d2('0x3'));var rp=require('request-promise');var moment=require(_0xf9d2('0x4'));var BPromise=require(_0xf9d2('0x5'));var Mustache=require(_0xf9d2('0x6'));var util=require(_0xf9d2('0x7'));var path=require(_0xf9d2('0x8'));var sox=require(_0xf9d2('0x9'));var csv=require('to-csv');var ejs=require(_0xf9d2('0xa'));var fs=require('fs');var fs_extra=require(_0xf9d2('0xb'));var _=require(_0xf9d2('0xc'));var squel=require(_0xf9d2('0xd'));var crypto=require(_0xf9d2('0xe'));var jsforce=require(_0xf9d2('0xf'));var deskjs=require(_0xf9d2('0x10'));var toCsv=require(_0xf9d2('0x11'));var querystring=require(_0xf9d2('0x12'));var Papa=require(_0xf9d2('0x13'));var Redis=require(_0xf9d2('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xf9d2('0x15'));var as=require(_0xf9d2('0x16'));var hardwareService=require(_0xf9d2('0x17'));var logger=require(_0xf9d2('0x18'))(_0xf9d2('0x19'));var utils=require(_0xf9d2('0x1a'));var config=require(_0xf9d2('0x1b'));var licenseUtil=require(_0xf9d2('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x177bec,_0x58eac7){_0x58eac7=_0x58eac7||0xcc;return function(_0x2a68b5){if(_0x2a68b5){return _0x177bec[_0xf9d2('0x1d')](_0x58eac7);}return _0x177bec['status'](_0x58eac7)[_0xf9d2('0x1e')]();};}function respondWithResult(_0x1c18c2,_0x29d6e0){_0x29d6e0=_0x29d6e0||0xc8;return function(_0x4b796b){if(_0x4b796b){return _0x1c18c2['status'](_0x29d6e0)[_0xf9d2('0x1f')](_0x4b796b);}};}function respondWithFilteredResult(_0x4c3e9e,_0x3d98a6){return function(_0x3471ba){if(_0x3471ba){var _0x59087c=typeof _0x3d98a6['offset']===_0xf9d2('0x20')&&typeof _0x3d98a6['limit']===_0xf9d2('0x20');var _0x48da86=_0x3471ba[_0xf9d2('0x21')];var _0x34482a=_0x59087c?0x0:_0x3d98a6['offset'];var _0x28b8e7=_0x59087c?_0x3471ba[_0xf9d2('0x21')]:_0x3d98a6[_0xf9d2('0x22')]+_0x3d98a6[_0xf9d2('0x23')];var _0x22e849;if(_0x28b8e7>=_0x48da86){_0x28b8e7=_0x48da86;_0x22e849=0xc8;}else{_0x22e849=0xce;}_0x4c3e9e[_0xf9d2('0x24')](_0x22e849);return _0x4c3e9e['set']('Content-Range',_0x34482a+'-'+_0x28b8e7+'/'+_0x48da86)[_0xf9d2('0x1f')](_0x3471ba);}return null;};}function patchUpdates(_0x4516b6){return function(_0x3f56c7){try{jsonpatch['apply'](_0x3f56c7,_0x4516b6,!![]);}catch(_0x700399){return BPromise[_0xf9d2('0x25')](_0x700399);}return _0x3f56c7[_0xf9d2('0x26')]();};}function saveUpdates(_0x3ec2d0,_0x52ca40){return function(_0x40300e){if(_0x40300e){return _0x40300e[_0xf9d2('0x27')](_0x3ec2d0)[_0xf9d2('0x28')](function(_0x9b7cd2){return _0x9b7cd2;});}return null;};}function removeEntity(_0x4825fd,_0x36f539){return function(_0x34f3ff){if(_0x34f3ff){return _0x34f3ff[_0xf9d2('0x29')]()[_0xf9d2('0x28')](function(){_0x4825fd['status'](0xcc)[_0xf9d2('0x1e')]();});}};}function handleEntityNotFound(_0xacccb3,_0x16d4b6){return function(_0x1338b1){if(!_0x1338b1){_0xacccb3[_0xf9d2('0x1d')](0x194);}return _0x1338b1;};}function handleError(_0x571b9f,_0x54ce6d){_0x54ce6d=_0x54ce6d||0x1f4;return function(_0x46aa5c){logger[_0xf9d2('0x2a')](_0x46aa5c[_0xf9d2('0x2b')]);if(_0x46aa5c[_0xf9d2('0x2c')]){delete _0x46aa5c[_0xf9d2('0x2c')];}_0x571b9f[_0xf9d2('0x24')](_0x54ce6d)[_0xf9d2('0x2d')](_0x46aa5c);};}exports[_0xf9d2('0x2e')]=function(_0x5a28a4,_0x56fc31){var _0x3cbde4={},_0x321bbe={},_0x5184dc={'count':0x0,'rows':[]};var _0x1f170c=_[_0xf9d2('0x2f')](db[_0xf9d2('0x30')][_0xf9d2('0x31')],function(_0x2238b2){return{'name':_0x2238b2[_0xf9d2('0x32')],'type':_0x2238b2['type'][_0xf9d2('0x33')]};});_0x321bbe[_0xf9d2('0x34')]=_[_0xf9d2('0x2f')](_0x1f170c,_0xf9d2('0x2c'));_0x321bbe[_0xf9d2('0x35')]=_['keys'](_0x5a28a4[_0xf9d2('0x35')]);_0x321bbe[_0xf9d2('0x36')]=_[_0xf9d2('0x37')](_0x321bbe['model'],_0x321bbe['query']);_0x3cbde4[_0xf9d2('0x38')]=_['intersection'](_0x321bbe['model'],qs[_0xf9d2('0x39')](_0x5a28a4['query'][_0xf9d2('0x39')]));_0x3cbde4[_0xf9d2('0x38')]=_0x3cbde4[_0xf9d2('0x38')][_0xf9d2('0x3a')]?_0x3cbde4[_0xf9d2('0x38')]:_0x321bbe[_0xf9d2('0x34')];if(!_0x5a28a4[_0xf9d2('0x35')]['hasOwnProperty']('nolimit')){_0x3cbde4['limit']=qs[_0xf9d2('0x23')](_0x5a28a4[_0xf9d2('0x35')][_0xf9d2('0x23')]);_0x3cbde4[_0xf9d2('0x22')]=qs['offset'](_0x5a28a4[_0xf9d2('0x35')][_0xf9d2('0x22')]);}_0x3cbde4['order']=qs['sort'](_0x5a28a4[_0xf9d2('0x35')][_0xf9d2('0x3b')]);_0x3cbde4['where']=qs[_0xf9d2('0x36')](_[_0xf9d2('0x3c')](_0x5a28a4[_0xf9d2('0x35')],_0x321bbe['filters']),_0x1f170c);if(_0x5a28a4['query'][_0xf9d2('0x3d')]){_0x3cbde4[_0xf9d2('0x3e')]=_['merge'](_0x3cbde4['where'],{'$or':_['map'](_0x1f170c,function(_0x16023d){if(_0x16023d[_0xf9d2('0x3f')]!==_0xf9d2('0x40')){var _0x23b61d={};_0x23b61d[_0x16023d['name']]={'$like':'%'+_0x5a28a4[_0xf9d2('0x35')]['filter']+'%'};return _0x23b61d;}})});}_0x3cbde4=_[_0xf9d2('0x41')]({},_0x3cbde4,_0x5a28a4['options']);var _0x276cab={'where':_0x3cbde4[_0xf9d2('0x3e')]};return db['DeskField'][_0xf9d2('0x21')](_0x276cab)['then'](function(_0x1adc5f){_0x5184dc[_0xf9d2('0x21')]=_0x1adc5f;if(_0x5a28a4[_0xf9d2('0x35')][_0xf9d2('0x42')]){_0x3cbde4[_0xf9d2('0x43')]=[{'all':!![]}];}return db[_0xf9d2('0x30')]['findAll'](_0x3cbde4);})[_0xf9d2('0x28')](function(_0x424eeb){_0x5184dc['rows']=_0x424eeb;return _0x5184dc;})[_0xf9d2('0x28')](respondWithFilteredResult(_0x56fc31,_0x3cbde4))[_0xf9d2('0x44')](handleError(_0x56fc31,null));};exports[_0xf9d2('0x45')]=function(_0x57e84a,_0x49d588){var _0x59021e={'raw':!![],'where':{'id':_0x57e84a['params']['id']}},_0x44b33d={};_0x44b33d[_0xf9d2('0x34')]=_[_0xf9d2('0x46')](db['DeskField'][_0xf9d2('0x31')]);_0x44b33d[_0xf9d2('0x35')]=_[_0xf9d2('0x46')](_0x57e84a['query']);_0x44b33d[_0xf9d2('0x36')]=_[_0xf9d2('0x37')](_0x44b33d['model'],_0x44b33d[_0xf9d2('0x35')]);_0x59021e[_0xf9d2('0x38')]=_[_0xf9d2('0x37')](_0x44b33d[_0xf9d2('0x34')],qs['fields'](_0x57e84a[_0xf9d2('0x35')][_0xf9d2('0x39')]));_0x59021e[_0xf9d2('0x38')]=_0x59021e[_0xf9d2('0x38')][_0xf9d2('0x3a')]?_0x59021e[_0xf9d2('0x38')]:_0x44b33d[_0xf9d2('0x34')];if(_0x57e84a[_0xf9d2('0x35')][_0xf9d2('0x42')]){_0x59021e['include']=[{'all':!![]}];}_0x59021e=_[_0xf9d2('0x41')]({},_0x59021e,_0x57e84a[_0xf9d2('0x47')]);return db[_0xf9d2('0x30')][_0xf9d2('0x48')](_0x59021e)[_0xf9d2('0x28')](handleEntityNotFound(_0x49d588,null))[_0xf9d2('0x28')](respondWithResult(_0x49d588,null))[_0xf9d2('0x44')](handleError(_0x49d588,null));};exports[_0xf9d2('0x49')]=function(_0x497880,_0x306b87){return db[_0xf9d2('0x30')][_0xf9d2('0x49')](_0x497880[_0xf9d2('0x4a')],{})[_0xf9d2('0x28')](respondWithResult(_0x306b87,0xc9))[_0xf9d2('0x44')](handleError(_0x306b87,null));};exports[_0xf9d2('0x27')]=function(_0x425a7a,_0x14f097){if(_0x425a7a[_0xf9d2('0x4a')]['id']){delete _0x425a7a['body']['id'];}return db[_0xf9d2('0x30')][_0xf9d2('0x48')]({'where':{'id':_0x425a7a[_0xf9d2('0x4b')]['id']}})['then'](handleEntityNotFound(_0x14f097,null))[_0xf9d2('0x28')](saveUpdates(_0x425a7a[_0xf9d2('0x4a')],null))[_0xf9d2('0x28')](respondWithResult(_0x14f097,null))['catch'](handleError(_0x14f097,null));};exports[_0xf9d2('0x29')]=function(_0xce33d1,_0x5f0723){return db[_0xf9d2('0x30')][_0xf9d2('0x48')]({'where':{'id':_0xce33d1['params']['id']}})[_0xf9d2('0x28')](handleEntityNotFound(_0x5f0723,null))[_0xf9d2('0x28')](removeEntity(_0x5f0723,null))[_0xf9d2('0x44')](handleError(_0x5f0723,null));}; \ No newline at end of file +var _0xb955=['../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','DeskField','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb955,0x123));var _0x5b95=function(_0x58b925,_0x40381f){_0x58b925=_0x58b925-0x0;var _0x5c4782=_0xb955[_0x58b925];return _0x5c4782;};'use strict';var emlformat=require(_0x5b95('0x0'));var rimraf=require(_0x5b95('0x1'));var zipdir=require(_0x5b95('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5b95('0x3'));var BPromise=require(_0x5b95('0x4'));var Mustache=require(_0x5b95('0x5'));var util=require(_0x5b95('0x6'));var path=require(_0x5b95('0x7'));var sox=require(_0x5b95('0x8'));var csv=require(_0x5b95('0x9'));var ejs=require(_0x5b95('0xa'));var fs=require('fs');var fs_extra=require(_0x5b95('0xb'));var _=require(_0x5b95('0xc'));var squel=require('squel');var crypto=require(_0x5b95('0xd'));var jsforce=require(_0x5b95('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5b95('0xf'));var Papa=require(_0x5b95('0x10'));var Redis=require(_0x5b95('0x11'));var authService=require(_0x5b95('0x12'));var qs=require(_0x5b95('0x13'));var as=require(_0x5b95('0x14'));var hardwareService=require(_0x5b95('0x15'));var logger=require('../../config/logger')(_0x5b95('0x16'));var utils=require('../../config/utils');var config=require(_0x5b95('0x17'));var licenseUtil=require(_0x5b95('0x18'));var db=require(_0x5b95('0x19'))['db'];function respondWithStatusCode(_0x5d443b,_0x24b9dd){_0x24b9dd=_0x24b9dd||0xcc;return function(_0x3b5dc9){if(_0x3b5dc9){return _0x5d443b[_0x5b95('0x1a')](_0x24b9dd);}return _0x5d443b['status'](_0x24b9dd)[_0x5b95('0x1b')]();};}function respondWithResult(_0xdb23b,_0x28558c){_0x28558c=_0x28558c||0xc8;return function(_0x51b465){if(_0x51b465){return _0xdb23b[_0x5b95('0x1c')](_0x28558c)[_0x5b95('0x1d')](_0x51b465);}};}function respondWithFilteredResult(_0x52cc9d,_0x4b9a0c){return function(_0x2bbc72){if(_0x2bbc72){var _0x4f614b=typeof _0x4b9a0c[_0x5b95('0x1e')]===_0x5b95('0x1f')&&typeof _0x4b9a0c[_0x5b95('0x20')]===_0x5b95('0x1f');var _0x461859=_0x2bbc72['count'];var _0x47e7f8=_0x4f614b?0x0:_0x4b9a0c[_0x5b95('0x1e')];var _0x9a8733=_0x4f614b?_0x2bbc72[_0x5b95('0x21')]:_0x4b9a0c[_0x5b95('0x1e')]+_0x4b9a0c['limit'];var _0x33424b;if(_0x9a8733>=_0x461859){_0x9a8733=_0x461859;_0x33424b=0xc8;}else{_0x33424b=0xce;}_0x52cc9d['status'](_0x33424b);return _0x52cc9d[_0x5b95('0x22')](_0x5b95('0x23'),_0x47e7f8+'-'+_0x9a8733+'/'+_0x461859)['json'](_0x2bbc72);}return null;};}function patchUpdates(_0x636a90){return function(_0x2d24ab){try{jsonpatch[_0x5b95('0x24')](_0x2d24ab,_0x636a90,!![]);}catch(_0x2c5814){return BPromise['reject'](_0x2c5814);}return _0x2d24ab[_0x5b95('0x25')]();};}function saveUpdates(_0x242e66,_0x4acfe4){return function(_0x5d4a8e){if(_0x5d4a8e){return _0x5d4a8e[_0x5b95('0x26')](_0x242e66)[_0x5b95('0x27')](function(_0x11b9d1){return _0x11b9d1;});}return null;};}function removeEntity(_0x1720f9,_0x257e2a){return function(_0x358bcf){if(_0x358bcf){return _0x358bcf[_0x5b95('0x28')]()[_0x5b95('0x27')](function(){_0x1720f9[_0x5b95('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x533aa4,_0x1e083a){return function(_0x2b060){if(!_0x2b060){_0x533aa4[_0x5b95('0x1a')](0x194);}return _0x2b060;};}function handleError(_0x1ee5ed,_0x1ba1eb){_0x1ba1eb=_0x1ba1eb||0x1f4;return function(_0xdc0326){logger[_0x5b95('0x29')](_0xdc0326[_0x5b95('0x2a')]);if(_0xdc0326['name']){delete _0xdc0326[_0x5b95('0x2b')];}_0x1ee5ed['status'](_0x1ba1eb)[_0x5b95('0x2c')](_0xdc0326);};}exports[_0x5b95('0x2d')]=function(_0x533d70,_0x1ec3f6){var _0x1aa6f0={},_0x5329bf={},_0x5149d6={'count':0x0,'rows':[]};var _0x3b9247=_[_0x5b95('0x2e')](db[_0x5b95('0x2f')]['rawAttributes'],function(_0x3c5264){return{'name':_0x3c5264[_0x5b95('0x30')],'type':_0x3c5264[_0x5b95('0x31')][_0x5b95('0x32')]};});_0x5329bf[_0x5b95('0x33')]=_[_0x5b95('0x2e')](_0x3b9247,'name');_0x5329bf[_0x5b95('0x34')]=_[_0x5b95('0x35')](_0x533d70[_0x5b95('0x34')]);_0x5329bf[_0x5b95('0x36')]=_[_0x5b95('0x37')](_0x5329bf[_0x5b95('0x33')],_0x5329bf[_0x5b95('0x34')]);_0x1aa6f0['attributes']=_[_0x5b95('0x37')](_0x5329bf['model'],qs[_0x5b95('0x38')](_0x533d70['query'][_0x5b95('0x38')]));_0x1aa6f0[_0x5b95('0x39')]=_0x1aa6f0[_0x5b95('0x39')][_0x5b95('0x3a')]?_0x1aa6f0[_0x5b95('0x39')]:_0x5329bf[_0x5b95('0x33')];if(!_0x533d70[_0x5b95('0x34')][_0x5b95('0x3b')](_0x5b95('0x3c'))){_0x1aa6f0[_0x5b95('0x20')]=qs[_0x5b95('0x20')](_0x533d70['query'][_0x5b95('0x20')]);_0x1aa6f0[_0x5b95('0x1e')]=qs['offset'](_0x533d70[_0x5b95('0x34')][_0x5b95('0x1e')]);}_0x1aa6f0[_0x5b95('0x3d')]=qs[_0x5b95('0x3e')](_0x533d70['query']['sort']);_0x1aa6f0['where']=qs[_0x5b95('0x36')](_['pick'](_0x533d70[_0x5b95('0x34')],_0x5329bf[_0x5b95('0x36')]),_0x3b9247);if(_0x533d70[_0x5b95('0x34')][_0x5b95('0x3f')]){_0x1aa6f0[_0x5b95('0x40')]=_['merge'](_0x1aa6f0['where'],{'$or':_[_0x5b95('0x2e')](_0x3b9247,function(_0xf3c97b){if(_0xf3c97b[_0x5b95('0x31')]!==_0x5b95('0x41')){var _0x300f89={};_0x300f89[_0xf3c97b[_0x5b95('0x2b')]]={'$like':'%'+_0x533d70[_0x5b95('0x34')][_0x5b95('0x3f')]+'%'};return _0x300f89;}})});}_0x1aa6f0=_[_0x5b95('0x42')]({},_0x1aa6f0,_0x533d70[_0x5b95('0x43')]);var _0x3ad3bf={'where':_0x1aa6f0[_0x5b95('0x40')]};return db['DeskField'][_0x5b95('0x21')](_0x3ad3bf)[_0x5b95('0x27')](function(_0x3f5bee){_0x5149d6[_0x5b95('0x21')]=_0x3f5bee;if(_0x533d70[_0x5b95('0x34')][_0x5b95('0x44')]){_0x1aa6f0[_0x5b95('0x45')]=[{'all':!![]}];}return db['DeskField'][_0x5b95('0x46')](_0x1aa6f0);})['then'](function(_0x44b5ff){_0x5149d6[_0x5b95('0x47')]=_0x44b5ff;return _0x5149d6;})[_0x5b95('0x27')](respondWithFilteredResult(_0x1ec3f6,_0x1aa6f0))[_0x5b95('0x48')](handleError(_0x1ec3f6,null));};exports[_0x5b95('0x49')]=function(_0xc88da1,_0x5debfd){var _0x51edce={'raw':!![],'where':{'id':_0xc88da1[_0x5b95('0x4a')]['id']}},_0x1d4306={};_0x1d4306[_0x5b95('0x33')]=_[_0x5b95('0x35')](db[_0x5b95('0x2f')][_0x5b95('0x4b')]);_0x1d4306['query']=_[_0x5b95('0x35')](_0xc88da1[_0x5b95('0x34')]);_0x1d4306['filters']=_[_0x5b95('0x37')](_0x1d4306[_0x5b95('0x33')],_0x1d4306[_0x5b95('0x34')]);_0x51edce[_0x5b95('0x39')]=_[_0x5b95('0x37')](_0x1d4306[_0x5b95('0x33')],qs['fields'](_0xc88da1[_0x5b95('0x34')][_0x5b95('0x38')]));_0x51edce[_0x5b95('0x39')]=_0x51edce[_0x5b95('0x39')][_0x5b95('0x3a')]?_0x51edce[_0x5b95('0x39')]:_0x1d4306[_0x5b95('0x33')];if(_0xc88da1[_0x5b95('0x34')][_0x5b95('0x44')]){_0x51edce[_0x5b95('0x45')]=[{'all':!![]}];}_0x51edce=_[_0x5b95('0x42')]({},_0x51edce,_0xc88da1[_0x5b95('0x43')]);return db['DeskField']['find'](_0x51edce)[_0x5b95('0x27')](handleEntityNotFound(_0x5debfd,null))[_0x5b95('0x27')](respondWithResult(_0x5debfd,null))[_0x5b95('0x48')](handleError(_0x5debfd,null));};exports[_0x5b95('0x4c')]=function(_0x69468c,_0x434eb4){return db[_0x5b95('0x2f')]['create'](_0x69468c['body'],{})[_0x5b95('0x27')](respondWithResult(_0x434eb4,0xc9))[_0x5b95('0x48')](handleError(_0x434eb4,null));};exports[_0x5b95('0x26')]=function(_0xf30e46,_0x2bf2db){if(_0xf30e46[_0x5b95('0x4d')]['id']){delete _0xf30e46['body']['id'];}return db[_0x5b95('0x2f')][_0x5b95('0x4e')]({'where':{'id':_0xf30e46['params']['id']}})[_0x5b95('0x27')](handleEntityNotFound(_0x2bf2db,null))[_0x5b95('0x27')](saveUpdates(_0xf30e46[_0x5b95('0x4d')],null))[_0x5b95('0x27')](respondWithResult(_0x2bf2db,null))[_0x5b95('0x48')](handleError(_0x2bf2db,null));};exports[_0x5b95('0x28')]=function(_0x258fad,_0x55bdab){return db[_0x5b95('0x2f')][_0x5b95('0x4e')]({'where':{'id':_0x258fad['params']['id']}})[_0x5b95('0x27')](handleEntityNotFound(_0x55bdab,null))[_0x5b95('0x27')](removeEntity(_0x55bdab,null))[_0x5b95('0x48')](handleError(_0x55bdab,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index f490475..7a88c9c 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 _0x6448=['lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./intDeskField.attributes','exports','define','DeskField','idField','FieldId'];(function(_0x41a6c8,_0x190624){var _0x136aa8=function(_0x433866){while(--_0x433866){_0x41a6c8['push'](_0x41a6c8['shift']());}};_0x136aa8(++_0x190624);}(_0x6448,0x1ba));var _0x8644=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6448[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8644('0x0'));var util=require(_0x8644('0x1'));var logger=require(_0x8644('0x2'))('api');var moment=require(_0x8644('0x3'));var BPromise=require('bluebird');var rp=require(_0x8644('0x4'));var fs=require('fs');var path=require(_0x8644('0x5'));var rimraf=require('rimraf');var config=require(_0x8644('0x6'));var attributes=require(_0x8644('0x7'));module[_0x8644('0x8')]=function(_0x1bbbbc,_0x409598){return _0x1bbbbc[_0x8644('0x9')](_0x8644('0xa'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x8644('0xb'),_0x8644('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1a99=['rimraf','../../config/environment','./intDeskField.attributes','exports','DeskField','int_desk_fields','idField','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x1c63f1,_0x369664){var _0x4d0bad=function(_0x137612){while(--_0x137612){_0x1c63f1['push'](_0x1c63f1['shift']());}};_0x4d0bad(++_0x369664);}(_0x1a99,0xf5));var _0x91a9=function(_0x2238ba,_0xfeb953){_0x2238ba=_0x2238ba-0x0;var _0x33032f=_0x1a99[_0x2238ba];return _0x33032f;};'use strict';var _=require(_0x91a9('0x0'));var util=require(_0x91a9('0x1'));var logger=require('../../config/logger')(_0x91a9('0x2'));var moment=require(_0x91a9('0x3'));var BPromise=require(_0x91a9('0x4'));var rp=require(_0x91a9('0x5'));var fs=require('fs');var path=require(_0x91a9('0x6'));var rimraf=require(_0x91a9('0x7'));var config=require(_0x91a9('0x8'));var attributes=require(_0x91a9('0x9'));module[_0x91a9('0xa')]=function(_0x477752,_0xf5d6f4){return _0x477752['define'](_0x91a9('0xb'),attributes,{'tableName':_0x91a9('0xc'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x91a9('0xd'),'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 43ab924..6d97402 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 _0x4e85=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0x4e85,0xf7));var _0x54e8=function(_0x558107,_0x58d83f){_0x558107=_0x558107-0x0;var _0x5c291b=_0x4e85[_0x558107];return _0x5c291b;};'use strict';var _=require(_0x54e8('0x0'));var util=require(_0x54e8('0x1'));var moment=require(_0x54e8('0x2'));var BPromise=require(_0x54e8('0x3'));var rs=require(_0x54e8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x54e8('0x5'))['db'];var utils=require(_0x54e8('0x6'));var logger=require(_0x54e8('0x7'))(_0x54e8('0x8'));var config=require(_0x54e8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x54e8('0xa')][_0x54e8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x241834,_0x41eb82,_0x231836){return new BPromise(function(_0x533006,_0x16d669){return client[_0x54e8('0xc')](_0x241834,_0x231836)['then'](function(_0x47d3c3){logger[_0x54e8('0xd')](_0x54e8('0xe'),_0x41eb82,_0x54e8('0xf'));logger[_0x54e8('0x10')]('DeskField,\x20%s,\x20%s,\x20%s',_0x41eb82,_0x54e8('0xf'),JSON[_0x54e8('0x11')](_0x47d3c3));if(_0x47d3c3['error']){if(_0x47d3c3[_0x54e8('0x12')][_0x54e8('0x13')]===0x1f4){logger[_0x54e8('0x12')](_0x54e8('0xe'),_0x41eb82,_0x47d3c3[_0x54e8('0x12')]['message']);return _0x16d669(_0x47d3c3[_0x54e8('0x12')][_0x54e8('0x14')]);}logger[_0x54e8('0x12')]('DeskField,\x20%s,\x20%s',_0x41eb82,_0x47d3c3[_0x54e8('0x12')][_0x54e8('0x14')]);return _0x533006(_0x47d3c3[_0x54e8('0x12')]['message']);}else{logger[_0x54e8('0xd')](_0x54e8('0xe'),_0x41eb82,_0x54e8('0xf'));_0x533006(_0x47d3c3['result']['message']);}})[_0x54e8('0x15')](function(_0x312073){logger[_0x54e8('0x12')](_0x54e8('0xe'),_0x41eb82,_0x312073);_0x16d669(_0x312073);});});} \ No newline at end of file +var _0x3813=['result','catch','moment','../../mysqldb','rpc','../../config/environment','jayson/promise','request','info','DeskField,\x20%s,\x20%s,\x20%s','error','code','DeskField,\x20%s,\x20%s','message','request\x20sent'];(function(_0x4d337e,_0x2f7eed){var _0x247963=function(_0x3d6564){while(--_0x3d6564){_0x4d337e['push'](_0x4d337e['shift']());}};_0x247963(++_0x2f7eed);}(_0x3813,0xb6));var _0x3381=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3813[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3381('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3381('0x1'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3381('0x2'));var config=require(_0x3381('0x3'));var jayson=require(_0x3381('0x4'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x12e063,_0x22ee54,_0x55f293){return new BPromise(function(_0x1633f7,_0x1bdc6f){return client[_0x3381('0x5')](_0x12e063,_0x55f293)['then'](function(_0x4f35bd){logger[_0x3381('0x6')]('DeskField,\x20%s,\x20%s',_0x22ee54,'request\x20sent');logger['debug'](_0x3381('0x7'),_0x22ee54,'request\x20sent',JSON['stringify'](_0x4f35bd));if(_0x4f35bd[_0x3381('0x8')]){if(_0x4f35bd[_0x3381('0x8')][_0x3381('0x9')]===0x1f4){logger[_0x3381('0x8')](_0x3381('0xa'),_0x22ee54,_0x4f35bd['error'][_0x3381('0xb')]);return _0x1bdc6f(_0x4f35bd[_0x3381('0x8')][_0x3381('0xb')]);}logger[_0x3381('0x8')](_0x3381('0xa'),_0x22ee54,_0x4f35bd[_0x3381('0x8')][_0x3381('0xb')]);return _0x1633f7(_0x4f35bd[_0x3381('0x8')][_0x3381('0xb')]);}else{logger[_0x3381('0x6')]('DeskField,\x20%s,\x20%s',_0x22ee54,_0x3381('0xc'));_0x1633f7(_0x4f35bd[_0x3381('0xd')][_0x3381('0xb')]);}})[_0x3381('0xe')](function(_0x212da3){logger[_0x3381('0x8')]('DeskField,\x20%s,\x20%s',_0x22ee54,_0x212da3);_0x1bdc6f(_0x212da3);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index c2c281d..43b3574 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 _0xe108=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','post','put','update','delete','util'];(function(_0x23cb58,_0x1b49e6){var _0x5ac723=function(_0x317340){while(--_0x317340){_0x23cb58['push'](_0x23cb58['shift']());}};_0x5ac723(++_0x1b49e6);}(_0xe108,0x12f));var _0x8e10=function(_0x5f50eb,_0x3e7d18){_0x5f50eb=_0x5f50eb-0x0;var _0xb912b6=_0xe108[_0x5f50eb];return _0xb912b6;};'use strict';var multer=require('multer');var util=require(_0x8e10('0x0'));var path=require(_0x8e10('0x1'));var timeout=require(_0x8e10('0x2'));var express=require(_0x8e10('0x3'));var router=express[_0x8e10('0x4')]();var fs_extra=require(_0x8e10('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8e10('0x6'));var config=require(_0x8e10('0x7'));var controller=require(_0x8e10('0x8'));router[_0x8e10('0x9')]('/',auth[_0x8e10('0xa')](),controller['index']);router[_0x8e10('0x9')](_0x8e10('0xb'),auth[_0x8e10('0xa')](),controller[_0x8e10('0xc')]);router[_0x8e10('0x9')](_0x8e10('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x8e10('0x9')](_0x8e10('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0x8e10('0xf')]('/',auth[_0x8e10('0xa')](),controller['create']);router[_0x8e10('0xf')]('/:id/configurations',auth[_0x8e10('0xa')](),controller['addConfiguration']);router[_0x8e10('0x10')](_0x8e10('0xb'),auth[_0x8e10('0xa')](),controller[_0x8e10('0x11')]);router[_0x8e10('0x12')](_0x8e10('0xb'),auth[_0x8e10('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7820=['show','get','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','/:id'];(function(_0x34f701,_0x37e407){var _0x3e2429=function(_0x20c0c3){while(--_0x20c0c3){_0x34f701['push'](_0x34f701['shift']());}};_0x3e2429(++_0x37e407);}(_0x7820,0x130));var _0x0782=function(_0x590275,_0x9451d){_0x590275=_0x590275-0x0;var _0x4fc880=_0x7820[_0x590275];return _0x4fc880;};'use strict';var multer=require(_0x0782('0x0'));var util=require(_0x0782('0x1'));var path=require('path');var timeout=require(_0x0782('0x2'));var express=require(_0x0782('0x3'));var router=express[_0x0782('0x4')]();var fs_extra=require(_0x0782('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0782('0x6'));var config=require(_0x0782('0x7'));var controller=require(_0x0782('0x8'));router['get']('/',auth[_0x0782('0x9')](),controller['index']);router['get'](_0x0782('0xa'),auth[_0x0782('0x9')](),controller[_0x0782('0xb')]);router[_0x0782('0xc')]('/:id/configurations',auth[_0x0782('0x9')](),controller['getConfigurations']);router[_0x0782('0xc')](_0x0782('0xd'),auth[_0x0782('0x9')](),controller[_0x0782('0xe')]);router[_0x0782('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x0782('0x10'),auth[_0x0782('0x9')](),controller[_0x0782('0x11')]);router[_0x0782('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x0782('0x13')]);router[_0x0782('0x14')](_0x0782('0xa'),auth[_0x0782('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index f3f2f81..9da33b1 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 _0x2542=['STRING','sequelize','exports'];(function(_0x277348,_0x411a51){var _0x47aac5=function(_0x128152){while(--_0x128152){_0x277348['push'](_0x277348['shift']());}};_0x47aac5(++_0x411a51);}(_0x2542,0x169));var _0x2254=function(_0x2a84dc,_0x1366a8){_0x2a84dc=_0x2a84dc-0x0;var _0x140bdd=_0x2542[_0x2a84dc];return _0x140bdd;};'use strict';var Sequelize=require(_0x2254('0x0'));module[_0x2254('0x1')]={'name':{'type':Sequelize[_0x2254('0x2')]},'username':{'type':Sequelize[_0x2254('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2254('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x2254('0x2')]},'clientSecret':{'type':Sequelize[_0x2254('0x2')]},'serverUrl':{'type':Sequelize[_0x2254('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x2254('0x2')]}}; \ No newline at end of file +var _0xf570=['exports','STRING','sequelize'];(function(_0x4b8f96,_0x5f3e44){var _0x220137=function(_0x3a0907){while(--_0x3a0907){_0x4b8f96['push'](_0x4b8f96['shift']());}};_0x220137(++_0x5f3e44);}(_0xf570,0x7a));var _0x0f57=function(_0x2167e2,_0x1b695d){_0x2167e2=_0x2167e2-0x0;var _0x193d40=_0xf570[_0x2167e2];return _0x193d40;};'use strict';var Sequelize=require(_0x0f57('0x0'));module[_0x0f57('0x1')]={'name':{'type':Sequelize[_0x0f57('0x2')]},'username':{'type':Sequelize[_0x0f57('0x2')]},'password':{'type':Sequelize[_0x0f57('0x2')]},'remoteUri':{'type':Sequelize[_0x0f57('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x0f57('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x0f57('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 198005d..8e3fe5c 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 _0x6fb8=['socialprofileidname','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','concat','username','password','tenantId','clientId','clientSecret','remoteUri','substring','lastIndexOf','format','%s/api/data/v9.0/','https://login.microsoftonline.com/','/oauth2/token','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','value','GET','EntityDefinitions(','Bearer\x20','4.0','Attributes','remove','LogicalName','forEach','@odata.type','push','MetadataId','all','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','FalseOption','false',')/Microsoft.Dynamics.CRM.','eml-format','zip-dir','fast-json-patch','moment','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','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','Dynamics365Account','fieldName','type','model','query','keys','intersection','attributes','fields','length','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','then','catch','show','params','rawAttributes','find','create','body','getConfigurations','findOne','Dynamics365Configuration','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','Incident','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','directioncode','accountidname','accountidyominame','billedserviceunits','contactidyominame','contractdetailidname','createdbyexternalpartyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x6fb8,0x104));var _0x86fb=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x6fb8[_0x46d0c9];return _0x174506;};'use strict';var emlformat=require(_0x86fb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x86fb('0x1'));var jsonpatch=require(_0x86fb('0x2'));var rp=require('request-promise');var moment=require(_0x86fb('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x86fb('0x4'));var path=require(_0x86fb('0x5'));var sox=require(_0x86fb('0x6'));var csv=require(_0x86fb('0x7'));var ejs=require(_0x86fb('0x8'));var fs=require('fs');var fs_extra=require(_0x86fb('0x9'));var _=require(_0x86fb('0xa'));var squel=require(_0x86fb('0xb'));var crypto=require(_0x86fb('0xc'));var jsforce=require(_0x86fb('0xd'));var deskjs=require(_0x86fb('0xe'));var toCsv=require(_0x86fb('0x7'));var querystring=require(_0x86fb('0xf'));var Papa=require('papaparse');var Redis=require(_0x86fb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x86fb('0x11'));var as=require(_0x86fb('0x12'));var hardwareService=require(_0x86fb('0x13'));var logger=require('../../config/logger')(_0x86fb('0x14'));var utils=require('../../config/utils');var config=require(_0x86fb('0x15'));var licenseUtil=require(_0x86fb('0x16'));var db=require(_0x86fb('0x17'))['db'];var integrations=require(_0x86fb('0x18'));function respondWithStatusCode(_0xc646cc,_0xd3bcaf){_0xd3bcaf=_0xd3bcaf||0xcc;return function(_0x3c8b7d){if(_0x3c8b7d){return _0xc646cc[_0x86fb('0x19')](_0xd3bcaf);}return _0xc646cc[_0x86fb('0x1a')](_0xd3bcaf)[_0x86fb('0x1b')]();};}function respondWithResult(_0x580824,_0x314b5f){_0x314b5f=_0x314b5f||0xc8;return function(_0x58a92c){if(_0x58a92c){return _0x580824[_0x86fb('0x1a')](_0x314b5f)[_0x86fb('0x1c')](_0x58a92c);}};}function respondWithFilteredResult(_0x5ecc0b,_0x20fe52){return function(_0xa930b5){if(_0xa930b5){var _0x1f60ca=typeof _0x20fe52[_0x86fb('0x1d')]===_0x86fb('0x1e')&&typeof _0x20fe52['limit']===_0x86fb('0x1e');var _0x239258=_0xa930b5[_0x86fb('0x1f')];var _0x1fb6af=_0x1f60ca?0x0:_0x20fe52[_0x86fb('0x1d')];var _0x41919c=_0x1f60ca?_0xa930b5[_0x86fb('0x1f')]:_0x20fe52['offset']+_0x20fe52[_0x86fb('0x20')];var _0x191312;if(_0x41919c>=_0x239258){_0x41919c=_0x239258;_0x191312=0xc8;}else{_0x191312=0xce;}_0x5ecc0b[_0x86fb('0x1a')](_0x191312);return _0x5ecc0b[_0x86fb('0x21')](_0x86fb('0x22'),_0x1fb6af+'-'+_0x41919c+'/'+_0x239258)[_0x86fb('0x1c')](_0xa930b5);}return null;};}function patchUpdates(_0x5734d5){return function(_0x4fb326){try{jsonpatch[_0x86fb('0x23')](_0x4fb326,_0x5734d5,!![]);}catch(_0xf43e6a){return BPromise[_0x86fb('0x24')](_0xf43e6a);}return _0x4fb326[_0x86fb('0x25')]();};}function saveUpdates(_0x2b479e,_0x81b923){return function(_0x42809d){if(_0x42809d){return _0x42809d[_0x86fb('0x26')](_0x2b479e)['then'](function(_0x49eedd){return _0x49eedd;});}return null;};}function removeEntity(_0x447407,_0x1fb70b){return function(_0xdb1dde){if(_0xdb1dde){return _0xdb1dde[_0x86fb('0x27')]()['then'](function(){_0x447407[_0x86fb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59e639,_0x243e9c){return function(_0x193b87){if(!_0x193b87){_0x59e639[_0x86fb('0x19')](0x194);}return _0x193b87;};}function handleError(_0x4762d3,_0x54ca60){_0x54ca60=_0x54ca60||0x1f4;return function(_0x1b3f0d){logger['error'](_0x1b3f0d[_0x86fb('0x28')]);if(_0x1b3f0d[_0x86fb('0x29')]){delete _0x1b3f0d[_0x86fb('0x29')];}_0x4762d3[_0x86fb('0x1a')](_0x54ca60)[_0x86fb('0x2a')](_0x1b3f0d);};}exports['index']=function(_0x4137a6,_0x2e9d36){var _0x43ca07={},_0x4c6570={},_0x370000={'count':0x0,'rows':[]};var _0x196fd8=_[_0x86fb('0x2b')](db[_0x86fb('0x2c')]['rawAttributes'],function(_0x424f5a){return{'name':_0x424f5a[_0x86fb('0x2d')],'type':_0x424f5a[_0x86fb('0x2e')]['key']};});_0x4c6570[_0x86fb('0x2f')]=_[_0x86fb('0x2b')](_0x196fd8,_0x86fb('0x29'));_0x4c6570[_0x86fb('0x30')]=_[_0x86fb('0x31')](_0x4137a6[_0x86fb('0x30')]);_0x4c6570['filters']=_[_0x86fb('0x32')](_0x4c6570['model'],_0x4c6570[_0x86fb('0x30')]);_0x43ca07[_0x86fb('0x33')]=_[_0x86fb('0x32')](_0x4c6570[_0x86fb('0x2f')],qs[_0x86fb('0x34')](_0x4137a6[_0x86fb('0x30')]['fields']));_0x43ca07[_0x86fb('0x33')]=_0x43ca07['attributes'][_0x86fb('0x35')]?_0x43ca07[_0x86fb('0x33')]:_0x4c6570[_0x86fb('0x2f')];if(!_0x4137a6[_0x86fb('0x30')]['hasOwnProperty']('nolimit')){_0x43ca07[_0x86fb('0x20')]=qs[_0x86fb('0x20')](_0x4137a6[_0x86fb('0x30')]['limit']);_0x43ca07[_0x86fb('0x1d')]=qs[_0x86fb('0x1d')](_0x4137a6[_0x86fb('0x30')][_0x86fb('0x1d')]);}_0x43ca07[_0x86fb('0x36')]=qs[_0x86fb('0x37')](_0x4137a6[_0x86fb('0x30')][_0x86fb('0x37')]);_0x43ca07['where']=qs[_0x86fb('0x38')](_[_0x86fb('0x39')](_0x4137a6['query'],_0x4c6570[_0x86fb('0x38')]),_0x196fd8);if(_0x4137a6['query']['filter']){_0x43ca07[_0x86fb('0x3a')]=_[_0x86fb('0x3b')](_0x43ca07[_0x86fb('0x3a')],{'$or':_[_0x86fb('0x2b')](_0x196fd8,function(_0x57e241){if(_0x57e241[_0x86fb('0x2e')]!==_0x86fb('0x3c')){var _0x44baca={};_0x44baca[_0x57e241[_0x86fb('0x29')]]={'$like':'%'+_0x4137a6[_0x86fb('0x30')][_0x86fb('0x3d')]+'%'};return _0x44baca;}})});}_0x43ca07=_[_0x86fb('0x3b')]({},_0x43ca07,_0x4137a6[_0x86fb('0x3e')]);var _0x53f203={'where':_0x43ca07[_0x86fb('0x3a')]};return db[_0x86fb('0x2c')][_0x86fb('0x1f')](_0x53f203)['then'](function(_0x7fd183){_0x370000[_0x86fb('0x1f')]=_0x7fd183;if(_0x4137a6['query'][_0x86fb('0x3f')]){_0x43ca07[_0x86fb('0x40')]=[{'all':!![]}];}return db[_0x86fb('0x2c')][_0x86fb('0x41')](_0x43ca07);})['then'](function(_0x270dd5){_0x370000[_0x86fb('0x42')]=_0x270dd5;return _0x370000;})[_0x86fb('0x43')](respondWithFilteredResult(_0x2e9d36,_0x43ca07))[_0x86fb('0x44')](handleError(_0x2e9d36,null));};exports[_0x86fb('0x45')]=function(_0x55db7c,_0x2ddfaa){var _0x2942cf={'raw':![],'where':{'id':_0x55db7c[_0x86fb('0x46')]['id']}},_0x57e579={};_0x57e579[_0x86fb('0x2f')]=_['keys'](db[_0x86fb('0x2c')][_0x86fb('0x47')]);_0x57e579[_0x86fb('0x30')]=_['keys'](_0x55db7c[_0x86fb('0x30')]);_0x57e579[_0x86fb('0x38')]=_[_0x86fb('0x32')](_0x57e579[_0x86fb('0x2f')],_0x57e579[_0x86fb('0x30')]);_0x2942cf['attributes']=_['intersection'](_0x57e579[_0x86fb('0x2f')],qs['fields'](_0x55db7c[_0x86fb('0x30')][_0x86fb('0x34')]));_0x2942cf[_0x86fb('0x33')]=_0x2942cf[_0x86fb('0x33')][_0x86fb('0x35')]?_0x2942cf[_0x86fb('0x33')]:_0x57e579[_0x86fb('0x2f')];if(_0x55db7c[_0x86fb('0x30')][_0x86fb('0x3f')]){_0x2942cf['include']=[{'all':!![]}];}_0x2942cf=_[_0x86fb('0x3b')]({},_0x2942cf,_0x55db7c[_0x86fb('0x3e')]);return db[_0x86fb('0x2c')][_0x86fb('0x48')](_0x2942cf)['then'](handleEntityNotFound(_0x2ddfaa,null))[_0x86fb('0x43')](respondWithResult(_0x2ddfaa,null))[_0x86fb('0x44')](handleError(_0x2ddfaa,null));};exports[_0x86fb('0x49')]=function(_0x3d4656,_0x48a5e5){return db[_0x86fb('0x2c')][_0x86fb('0x49')](_0x3d4656[_0x86fb('0x4a')],{})[_0x86fb('0x43')](respondWithResult(_0x48a5e5,0xc9))[_0x86fb('0x44')](handleError(_0x48a5e5,null));};exports[_0x86fb('0x26')]=function(_0x3e8ae7,_0x574a41){if(_0x3e8ae7[_0x86fb('0x4a')]['id']){delete _0x3e8ae7[_0x86fb('0x4a')]['id'];}return db[_0x86fb('0x2c')]['find']({'where':{'id':_0x3e8ae7[_0x86fb('0x46')]['id']}})[_0x86fb('0x43')](handleEntityNotFound(_0x574a41,null))[_0x86fb('0x43')](saveUpdates(_0x3e8ae7[_0x86fb('0x4a')],null))[_0x86fb('0x43')](respondWithResult(_0x574a41,null))[_0x86fb('0x44')](handleError(_0x574a41,null));};exports[_0x86fb('0x27')]=function(_0x4f5439,_0x1076ac){return db['Dynamics365Account'][_0x86fb('0x48')]({'where':{'id':_0x4f5439['params']['id']}})[_0x86fb('0x43')](handleEntityNotFound(_0x1076ac,null))['then'](removeEntity(_0x1076ac,null))['catch'](handleError(_0x1076ac,null));};exports[_0x86fb('0x4b')]=function(_0x1a3e54,_0x198c73,_0x326822){var _0x4bd6cb={};var _0x1244cd={};var _0x23330c;var _0x3d68a1;return db[_0x86fb('0x2c')][_0x86fb('0x4c')]({'where':{'id':_0x1a3e54[_0x86fb('0x46')]['id']}})['then'](handleEntityNotFound(_0x198c73,null))[_0x86fb('0x43')](function(_0x138ff3){if(_0x138ff3){_0x23330c=_0x138ff3;_0x1244cd[_0x86fb('0x2f')]=_[_0x86fb('0x31')](db[_0x86fb('0x4d')][_0x86fb('0x47')]);_0x1244cd[_0x86fb('0x30')]=_[_0x86fb('0x31')](_0x1a3e54[_0x86fb('0x30')]);_0x1244cd[_0x86fb('0x38')]=_[_0x86fb('0x32')](_0x1244cd[_0x86fb('0x2f')],_0x1244cd[_0x86fb('0x30')]);_0x4bd6cb[_0x86fb('0x33')]=_[_0x86fb('0x32')](_0x1244cd[_0x86fb('0x2f')],qs[_0x86fb('0x34')](_0x1a3e54[_0x86fb('0x30')][_0x86fb('0x34')]));_0x4bd6cb[_0x86fb('0x33')]=_0x4bd6cb['attributes']['length']?_0x4bd6cb[_0x86fb('0x33')]:_0x1244cd[_0x86fb('0x2f')];_0x4bd6cb['order']=qs[_0x86fb('0x37')](_0x1a3e54[_0x86fb('0x30')][_0x86fb('0x37')]);_0x4bd6cb['where']=qs['filters'](_[_0x86fb('0x39')](_0x1a3e54['query'],_0x1244cd['filters']));if(_0x1a3e54[_0x86fb('0x30')][_0x86fb('0x3d')]){_0x4bd6cb['where']=_[_0x86fb('0x3b')](_0x4bd6cb[_0x86fb('0x3a')],{'$or':_[_0x86fb('0x2b')](_0x4bd6cb['attributes'],function(_0x17e5c4){var _0x364866={};_0x364866[_0x17e5c4]={'$like':'%'+_0x1a3e54[_0x86fb('0x30')][_0x86fb('0x3d')]+'%'};return _0x364866;})});}_0x4bd6cb=_[_0x86fb('0x3b')]({},_0x4bd6cb,_0x1a3e54['options']);return _0x23330c[_0x86fb('0x4b')](_0x4bd6cb);}})['then'](function(_0x8ac051){if(_0x8ac051){_0x3d68a1=_0x8ac051['length'];if(!_0x1a3e54['query'][_0x86fb('0x4e')](_0x86fb('0x4f'))){_0x4bd6cb[_0x86fb('0x20')]=qs[_0x86fb('0x20')](_0x1a3e54['query'][_0x86fb('0x20')]);_0x4bd6cb['offset']=qs[_0x86fb('0x1d')](_0x1a3e54[_0x86fb('0x30')][_0x86fb('0x1d')]);}return _0x23330c[_0x86fb('0x4b')](_0x4bd6cb);}})['then'](function(_0x410206){if(_0x410206){return _0x410206?{'count':_0x3d68a1,'rows':_0x410206}:null;}})[_0x86fb('0x43')](respondWithResult(_0x198c73,null))[_0x86fb('0x44')](handleError(_0x198c73,null));};exports[_0x86fb('0x50')]=function(_0x16d23a,_0x121c93,_0xb6c707){if(_0x16d23a[_0x86fb('0x4a')]['id']){delete _0x16d23a[_0x86fb('0x4a')]['id'];}return db[_0x86fb('0x2c')]['findOne']({'where':{'id':_0x16d23a['params']['id']}})[_0x86fb('0x43')](handleEntityNotFound(_0x121c93,null))[_0x86fb('0x43')](function(_0x549f47){if(_0x549f47){_0x16d23a[_0x86fb('0x4a')][_0x86fb('0x51')]=_0x549f47['id'];_0x16d23a['body'][_0x86fb('0x52')]=integrations['getSubjects'](_0x16d23a[_0x86fb('0x4a')]['channel'],_0x16d23a[_0x86fb('0x4a')][_0x86fb('0x2e')]);_0x16d23a[_0x86fb('0x4a')][_0x86fb('0x53')]=integrations[_0x86fb('0x54')](_0x16d23a[_0x86fb('0x4a')]['channel'],_0x16d23a[_0x86fb('0x4a')]['type']);return db[_0x86fb('0x4d')][_0x86fb('0x49')](_0x16d23a['body'],{'include':[{'model':db[_0x86fb('0x55')],'as':_0x86fb('0x52')},{'model':db[_0x86fb('0x55')],'as':'Descriptions'}]});}return null;})[_0x86fb('0x43')](respondWithResult(_0x121c93,null))[_0x86fb('0x44')](handleError(_0x121c93,null));};exports[_0x86fb('0x56')]=function(_0xd86811,_0x1c9432,_0x294c08){var _0x47b94a=_0xd86811[_0x86fb('0x30')][_0x86fb('0x57')];var _0x305c2c=_0x47b94a===_0x86fb('0x58')?_0x86fb('0x59'):'PhoneCall';var _0x3f381b='';var _0x416ff6='';var _0x478f8d='';var _0x327fd3='';var _0x5bdbde='';var _0x492aa9='';var _0x375589='';var _0x154dac='';var _0x1e0312=[_0x86fb('0x5a'),_0x86fb('0x5b'),_0x86fb('0x5c'),_0x86fb('0x5d'),_0x86fb('0x5e'),_0x86fb('0x5f'),_0x86fb('0x60'),'regardingobjectid',_0x86fb('0x61'),'phonecall_activity_parties'];var _0x310256=[_0x86fb('0x62'),_0x86fb('0x63'),'actualserviceunits',_0x86fb('0x64'),'contactidname',_0x86fb('0x65'),_0x86fb('0x66'),'contractidname','createdbyexternalpartyname',_0x86fb('0x67'),'createdbyname','createdbyyominame',_0x86fb('0x68'),_0x86fb('0x69'),_0x86fb('0x6a'),'customeridname',_0x86fb('0x6b'),_0x86fb('0x6c'),_0x86fb('0x6d'),_0x86fb('0x6e'),_0x86fb('0x6f'),'entityimage_url',_0x86fb('0x70'),'exchangerate',_0x86fb('0x71'),_0x86fb('0x72'),_0x86fb('0x73'),_0x86fb('0x74'),_0x86fb('0x75'),_0x86fb('0x76'),_0x86fb('0x77'),_0x86fb('0x78'),_0x86fb('0x79'),'modifiedbyname',_0x86fb('0x7a'),_0x86fb('0x7b'),_0x86fb('0x7c'),_0x86fb('0x7d'),_0x86fb('0x7e'),_0x86fb('0x7f'),_0x86fb('0x80'),_0x86fb('0x81'),_0x86fb('0x82'),'owneridname',_0x86fb('0x83'),_0x86fb('0x84'),_0x86fb('0x85'),_0x86fb('0x86'),_0x86fb('0x87'),_0x86fb('0x88'),_0x86fb('0x89'),_0x86fb('0x8a'),_0x86fb('0x8b'),_0x86fb('0x8c'),_0x86fb('0x8d'),'responsiblecontactidname',_0x86fb('0x8e'),_0x86fb('0x8f'),'slainvokedidname','slaname',_0x86fb('0x90'),'statecode',_0x86fb('0x91'),_0x86fb('0x92'),'ticketnumber',_0x86fb('0x93'),_0x86fb('0x94'),'traversedpath','utcconversiontimezonecode','versionnumber'];var _0x4bd1ed=_0x1e0312[_0x86fb('0x95')](_0x310256);return db[_0x86fb('0x2c')][_0x86fb('0x4c')]({'where':{'id':_0xd86811['params']['id']},'attributes':['id',_0x86fb('0x96'),_0x86fb('0x97'),'remoteUri',_0x86fb('0x98'),_0x86fb('0x99'),_0x86fb('0x9a')]})[_0x86fb('0x43')](handleEntityNotFound(_0x1c9432,null))['then'](function(_0x23617b){if(_0x23617b){_0x154dac=_0x23617b[_0x86fb('0x9b')];var _0x343dae=_0x154dac['slice'](-0x1);if(_0x343dae==='/'){_0x154dac=_0x154dac[_0x86fb('0x9c')](0x0,_0x154dac[_0x86fb('0x9d')](_0x343dae));}_0x375589=util[_0x86fb('0x9e')](_0x86fb('0x9f'),_0x154dac);var _0x1c9f64={'method':'POST','uri':_0x86fb('0xa0')+_0x23617b[_0x86fb('0x98')]+_0x86fb('0xa1'),'form':{'client_id':_0x23617b[_0x86fb('0x99')],'resource':_0x154dac,'username':_0x23617b['username'],'password':_0x23617b['password'],'grant_type':_0x86fb('0x97'),'client_secret':_0x23617b[_0x86fb('0x9a')]},'json':!![]};return rp(_0x1c9f64);}})['then'](function(_0x3d4c18){_0x492aa9=_0x3d4c18[_0x86fb('0xa2')];var _0x4ad6b2={'method':'GET','uri':encodeURI(_0x375589+_0x86fb('0xa3')+_0x305c2c+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x492aa9,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4ad6b2);})[_0x86fb('0x43')](function(_0x29fd8b){var _0x5c67ef=_0x29fd8b[_0x86fb('0xa4')][0x0];var _0x14a66a=_0x5c67ef['MetadataId'];var _0x2b8fba={'method':_0x86fb('0xa5'),'uri':_0x375589+_0x86fb('0xa6')+_0x14a66a+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x86fb('0xa7')+_0x492aa9,'If-None-Match':null,'OData-Version':_0x86fb('0xa8')},'json':!![]};return rp(_0x2b8fba);})[_0x86fb('0x43')](function(_0x274c37){_0x3f381b=_0x274c37;_0x416ff6=_0x3f381b[_0x86fb('0xa9')];_0x416ff6=_[_0x86fb('0xaa')](_0x416ff6,function(_0x11231e){return!_0x4bd1ed['includes'](_0x11231e[_0x86fb('0xab')]);});var _0x4a29ea=[];var _0x473e1e=[];_0x416ff6[_0x86fb('0xac')](function(_0x174aa9){if(_0x174aa9['@odata.type']){var _0x133d94=_0x174aa9[_0x86fb('0xad')][_0x86fb('0x9c')](_0x174aa9[_0x86fb('0xad')][_0x86fb('0x9d')]('.')+0x1);if(_0x133d94==='PicklistAttributeMetadata'){_0x4a29ea[_0x86fb('0xae')](getSelectList(_0x375589,_0x47b94a,_0x473e1e,_0x3f381b[_0x86fb('0xaf')],_0x174aa9[_0x86fb('0xaf')],_0x492aa9));}}});return Promise[_0x86fb('0xb0')](_0x4a29ea);})[_0x86fb('0x43')](function(_0x71cf1){_0x478f8d=_0x71cf1[0x0];var _0x349e3f=[];var _0x14f32b=[];_0x416ff6[_0x86fb('0xac')](function(_0x5dc7e8){if(!_['isNil'](_0x5dc7e8[_0x86fb('0xad')])){var _0x1d0a96=_0x5dc7e8[_0x86fb('0xad')][_0x86fb('0x9c')](_0x5dc7e8[_0x86fb('0xad')][_0x86fb('0x9d')]('.')+0x1);if(_0x1d0a96===_0x86fb('0xb1')){_0x349e3f[_0x86fb('0xae')](getBooleanList(_0x375589,_0x47b94a,_0x14f32b,_0x3f381b[_0x86fb('0xaf')],_0x5dc7e8[_0x86fb('0xaf')],_0x492aa9));}}});return Promise['all'](_0x349e3f);})[_0x86fb('0x43')](function(_0x298826){_0x327fd3=_0x298826[0x0];var _0x123f75=[];var _0x320d67=[];_0x416ff6['forEach'](function(_0x9b0404){if(_0x9b0404['@odata.type']){var _0x56e213=_0x9b0404[_0x86fb('0xad')][_0x86fb('0x9c')](_0x9b0404[_0x86fb('0xad')][_0x86fb('0x9d')]('.')+0x1);if(_0x56e213===_0x86fb('0xb2')||_0x56e213===_0x86fb('0xb3')||_0x56e213===_0x86fb('0xb4')||_0x56e213===_0x86fb('0xb5')||_0x56e213===_0x86fb('0xb6')||_0x56e213===_0x86fb('0xb7')||_0x56e213===_0x86fb('0xb8')||_0x56e213===_0x86fb('0xb9')||_0x56e213===_0x86fb('0xba')||_0x56e213==='DecimalAttributeMetadata'){_0x123f75[_0x86fb('0xae')](getInputList(_0x375589,_0x47b94a,_0x56e213,_0x320d67,_0x3f381b[_0x86fb('0xaf')],_0x9b0404[_0x86fb('0xaf')],_0x492aa9));}}});return Promise['all'](_0x123f75);})[_0x86fb('0x43')](function(_0x142d9b){_0x5bdbde=_0x142d9b[0x0];var _0x39b013=_0x478f8d['concat'](_0x327fd3)['concat'](_0x5bdbde);var _0x22ad5b={'count':_0x39b013['length'],'rows':_0x39b013};return _0x22ad5b;})[_0x86fb('0x43')](respondWithResult(_0x1c9432,null))['catch'](function(_0x1ed917){var _0x29ac5e=_0xd86811[_0x86fb('0x30')][_0x86fb('0xbb')]?0x1f4:_0x1ed917[_0x86fb('0xbc')]||0x1f4;logger['error'](_0x1ed917[_0x86fb('0x28')]);delete _0x1ed917[_0x86fb('0x29')];if(_0x29ac5e===0x191){_0x29ac5e=0x190;}_0x1c9432[_0x86fb('0x1a')](_0x29ac5e)['send'](_0xd86811[_0x86fb('0x30')][_0x86fb('0xbb')]?{'message':_0x86fb('0xbd'),'statusCode':_0x1ed917[_0x86fb('0xbc')]}:_0x1ed917);});};function getSelectList(_0x396397,_0x3b0eb0,_0x149649,_0x17157a,_0xb64f1d,_0x8f50ae){var _0x1a4ffa={'method':_0x86fb('0xa5'),'uri':_0x396397+_0x86fb('0xa6')+_0x17157a+')/Attributes('+_0xb64f1d+_0x86fb('0xbe')+_0x86fb('0xbf'),'headers':{'Authorization':_0x86fb('0xa7')+_0x8f50ae,'If-None-Match':null,'OData-Version':_0x86fb('0xa8')},'json':!![]};return rp(_0x1a4ffa)[_0x86fb('0x43')](function(_0x387785){var _0x108621=[];var _0x183b70=_0x387785[_0x86fb('0xc0')][_0x86fb('0xc1')];_0x183b70['forEach'](function(_0x39a197){_0x108621[_0x86fb('0xae')]({'name':_0x39a197[_0x86fb('0xc2')][_0x86fb('0xc3')][_0x86fb('0xc2')],'value':String(_0x39a197[_0x86fb('0xc4')])});});var _0x5cc09c={'id':_0x3b0eb0+'_'+_0x387785[_0x86fb('0xab')],'name':_0x387785[_0x86fb('0xc5')][_0x86fb('0xc3')][_0x86fb('0xc2')],'custom':![],'options':_0x108621};_0x149649['push'](_0x5cc09c);return _0x149649;});}function getBooleanList(_0x5d833d,_0x3fc1f2,_0x26678a,_0x3c04b1,_0xb01c69,_0x8e4f77){var _0xce83fe={'method':_0x86fb('0xa5'),'uri':_0x5d833d+'EntityDefinitions('+_0x3c04b1+')/Attributes('+_0xb01c69+_0x86fb('0xc6'),'headers':{'Authorization':_0x86fb('0xa7')+_0x8e4f77,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xce83fe)[_0x86fb('0x43')](function(_0x41cc49){var _0x49cb08=[];_0x49cb08[_0x86fb('0xae')]({'name':_0x41cc49[_0x86fb('0xc0')]['TrueOption'][_0x86fb('0xc2')]['UserLocalizedLabel'][_0x86fb('0xc2')],'value':'true'},{'name':_0x41cc49[_0x86fb('0xc0')][_0x86fb('0xc7')][_0x86fb('0xc2')]['UserLocalizedLabel'][_0x86fb('0xc2')],'value':_0x86fb('0xc8')});var _0x2ce769={'id':_0x3fc1f2+'_'+_0x41cc49[_0x86fb('0xab')],'name':_0x41cc49[_0x86fb('0xc5')][_0x86fb('0xc3')][_0x86fb('0xc2')],'custom':![],'options':_0x49cb08};_0x26678a['push'](_0x2ce769);return _0x26678a;});}function getInputList(_0x440d80,_0x3c3959,_0x590047,_0x55784c,_0x3e323e,_0x35de73,_0x417c74){var _0x4a08ba={'method':_0x86fb('0xa5'),'uri':_0x440d80+_0x86fb('0xa6')+_0x3e323e+')/Attributes('+_0x35de73+_0x86fb('0xc9')+_0x590047+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x417c74,'If-None-Match':null,'OData-Version':_0x86fb('0xa8')},'json':!![]};return rp(_0x4a08ba)['then'](function(_0x4eaec0){var _0x248129={'id':_0x3c3959+'_'+_0x4eaec0[_0x86fb('0xab')],'name':_0x4eaec0[_0x86fb('0xc5')][_0x86fb('0xc3')]?_0x4eaec0['DisplayName']['UserLocalizedLabel']['Label']:_0x4eaec0[_0x86fb('0xab')],'custom':![],'options':[]};_0x55784c[_0x86fb('0xae')](_0x248129);return _0x55784c;});} \ No newline at end of file +var _0x9d92=['isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','all','statusCode','test','Wrong\x20credentials','EntityDefinitions(',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','Value','DisplayName','TrueOption','UserLocalizedLabel','true','false',')/Microsoft.Dynamics.CRM.','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','keys','query','filters','fields','attributes','length','nolimit','order','sort','pick','filter','merge','options','where','Dynamics365Account','findAll','rows','show','params','intersection','includeAll','find','create','body','catch','findOne','Dynamics365Configuration','map','getConfigurations','hasOwnProperty','AccountId','Subjects','Descriptions','channel','getFields','ticketType','incident','Incident','PhoneCall','title','ownerid','caseorigincode','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','password','remoteUri','clientSecret','slice','lastIndexOf','format','POST','https://login.microsoftonline.com/','username','access_token','Bearer\x20','4.0','value','MetadataId','GET',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','push'];(function(_0x282a1f,_0x49a6ef){var _0x296ea7=function(_0x4bac68){while(--_0x4bac68){_0x282a1f['push'](_0x282a1f['shift']());}};_0x296ea7(++_0x49a6ef);}(_0x9d92,0xdf));var _0x29d9=function(_0x3b632f,_0x453380){_0x3b632f=_0x3b632f-0x0;var _0x10e788=_0x9d92[_0x3b632f];return _0x10e788;};'use strict';var emlformat=require(_0x29d9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x29d9('0x1'));var rp=require(_0x29d9('0x2'));var moment=require('moment');var BPromise=require(_0x29d9('0x3'));var Mustache=require(_0x29d9('0x4'));var util=require(_0x29d9('0x5'));var path=require(_0x29d9('0x6'));var sox=require(_0x29d9('0x7'));var csv=require(_0x29d9('0x8'));var ejs=require(_0x29d9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x29d9('0xa'));var squel=require(_0x29d9('0xb'));var crypto=require(_0x29d9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x29d9('0xd'));var toCsv=require(_0x29d9('0x8'));var querystring=require(_0x29d9('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x29d9('0xf'));var hardwareService=require(_0x29d9('0x10'));var logger=require(_0x29d9('0x11'))('api');var utils=require(_0x29d9('0x12'));var config=require(_0x29d9('0x13'));var licenseUtil=require(_0x29d9('0x14'));var db=require(_0x29d9('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2259cb,_0x47c4ad){_0x47c4ad=_0x47c4ad||0xcc;return function(_0x5a888b){if(_0x5a888b){return _0x2259cb['sendStatus'](_0x47c4ad);}return _0x2259cb[_0x29d9('0x16')](_0x47c4ad)[_0x29d9('0x17')]();};}function respondWithResult(_0x112b59,_0x32c7c9){_0x32c7c9=_0x32c7c9||0xc8;return function(_0x47b33c){if(_0x47b33c){return _0x112b59[_0x29d9('0x16')](_0x32c7c9)[_0x29d9('0x18')](_0x47b33c);}};}function respondWithFilteredResult(_0xa5b923,_0x446a80){return function(_0x2e6290){if(_0x2e6290){var _0x36f1f7=typeof _0x446a80[_0x29d9('0x19')]===_0x29d9('0x1a')&&typeof _0x446a80[_0x29d9('0x1b')]===_0x29d9('0x1a');var _0x2b4f42=_0x2e6290['count'];var _0x32e56f=_0x36f1f7?0x0:_0x446a80['offset'];var _0x57396a=_0x36f1f7?_0x2e6290[_0x29d9('0x1c')]:_0x446a80[_0x29d9('0x19')]+_0x446a80['limit'];var _0x2c6e94;if(_0x57396a>=_0x2b4f42){_0x57396a=_0x2b4f42;_0x2c6e94=0xc8;}else{_0x2c6e94=0xce;}_0xa5b923[_0x29d9('0x16')](_0x2c6e94);return _0xa5b923[_0x29d9('0x1d')](_0x29d9('0x1e'),_0x32e56f+'-'+_0x57396a+'/'+_0x2b4f42)[_0x29d9('0x18')](_0x2e6290);}return null;};}function patchUpdates(_0x268485){return function(_0x25e758){try{jsonpatch['apply'](_0x25e758,_0x268485,!![]);}catch(_0x3d03d0){return BPromise[_0x29d9('0x1f')](_0x3d03d0);}return _0x25e758[_0x29d9('0x20')]();};}function saveUpdates(_0x198520,_0x4aecaa){return function(_0x52f99d){if(_0x52f99d){return _0x52f99d[_0x29d9('0x21')](_0x198520)[_0x29d9('0x22')](function(_0x47a7f3){return _0x47a7f3;});}return null;};}function removeEntity(_0x590476,_0x512e5c){return function(_0x460d3){if(_0x460d3){return _0x460d3[_0x29d9('0x23')]()[_0x29d9('0x22')](function(){_0x590476['status'](0xcc)[_0x29d9('0x17')]();});}};}function handleEntityNotFound(_0x10b1e8,_0xb564c2){return function(_0x1d8903){if(!_0x1d8903){_0x10b1e8['sendStatus'](0x194);}return _0x1d8903;};}function handleError(_0xea5b4b,_0x596b69){_0x596b69=_0x596b69||0x1f4;return function(_0x5e664f){logger[_0x29d9('0x24')](_0x5e664f[_0x29d9('0x25')]);if(_0x5e664f['name']){delete _0x5e664f[_0x29d9('0x26')];}_0xea5b4b['status'](_0x596b69)[_0x29d9('0x27')](_0x5e664f);};}exports[_0x29d9('0x28')]=function(_0x3c10da,_0x30d4e7){var _0x30212d={},_0x286b72={},_0x356d39={'count':0x0,'rows':[]};var _0x509a8f=_['map'](db['Dynamics365Account'][_0x29d9('0x29')],function(_0x1959a8){return{'name':_0x1959a8[_0x29d9('0x2a')],'type':_0x1959a8[_0x29d9('0x2b')][_0x29d9('0x2c')]};});_0x286b72[_0x29d9('0x2d')]=_['map'](_0x509a8f,_0x29d9('0x26'));_0x286b72['query']=_[_0x29d9('0x2e')](_0x3c10da[_0x29d9('0x2f')]);_0x286b72[_0x29d9('0x30')]=_['intersection'](_0x286b72['model'],_0x286b72['query']);_0x30212d['attributes']=_['intersection'](_0x286b72[_0x29d9('0x2d')],qs[_0x29d9('0x31')](_0x3c10da[_0x29d9('0x2f')]['fields']));_0x30212d[_0x29d9('0x32')]=_0x30212d[_0x29d9('0x32')][_0x29d9('0x33')]?_0x30212d[_0x29d9('0x32')]:_0x286b72[_0x29d9('0x2d')];if(!_0x3c10da[_0x29d9('0x2f')]['hasOwnProperty'](_0x29d9('0x34'))){_0x30212d[_0x29d9('0x1b')]=qs[_0x29d9('0x1b')](_0x3c10da[_0x29d9('0x2f')][_0x29d9('0x1b')]);_0x30212d['offset']=qs[_0x29d9('0x19')](_0x3c10da[_0x29d9('0x2f')][_0x29d9('0x19')]);}_0x30212d[_0x29d9('0x35')]=qs[_0x29d9('0x36')](_0x3c10da[_0x29d9('0x2f')][_0x29d9('0x36')]);_0x30212d['where']=qs[_0x29d9('0x30')](_[_0x29d9('0x37')](_0x3c10da[_0x29d9('0x2f')],_0x286b72[_0x29d9('0x30')]),_0x509a8f);if(_0x3c10da[_0x29d9('0x2f')][_0x29d9('0x38')]){_0x30212d['where']=_[_0x29d9('0x39')](_0x30212d['where'],{'$or':_['map'](_0x509a8f,function(_0x4c2157){if(_0x4c2157[_0x29d9('0x2b')]!=='VIRTUAL'){var _0x3817ea={};_0x3817ea[_0x4c2157[_0x29d9('0x26')]]={'$like':'%'+_0x3c10da[_0x29d9('0x2f')][_0x29d9('0x38')]+'%'};return _0x3817ea;}})});}_0x30212d=_[_0x29d9('0x39')]({},_0x30212d,_0x3c10da[_0x29d9('0x3a')]);var _0x42409b={'where':_0x30212d[_0x29d9('0x3b')]};return db[_0x29d9('0x3c')][_0x29d9('0x1c')](_0x42409b)[_0x29d9('0x22')](function(_0x4eadde){_0x356d39[_0x29d9('0x1c')]=_0x4eadde;if(_0x3c10da[_0x29d9('0x2f')]['includeAll']){_0x30212d['include']=[{'all':!![]}];}return db['Dynamics365Account'][_0x29d9('0x3d')](_0x30212d);})[_0x29d9('0x22')](function(_0x1b5fad){_0x356d39[_0x29d9('0x3e')]=_0x1b5fad;return _0x356d39;})[_0x29d9('0x22')](respondWithFilteredResult(_0x30d4e7,_0x30212d))['catch'](handleError(_0x30d4e7,null));};exports[_0x29d9('0x3f')]=function(_0x21705a,_0x348294){var _0x5281bc={'raw':![],'where':{'id':_0x21705a[_0x29d9('0x40')]['id']}},_0x17e99f={};_0x17e99f[_0x29d9('0x2d')]=_[_0x29d9('0x2e')](db['Dynamics365Account'][_0x29d9('0x29')]);_0x17e99f[_0x29d9('0x2f')]=_[_0x29d9('0x2e')](_0x21705a[_0x29d9('0x2f')]);_0x17e99f['filters']=_[_0x29d9('0x41')](_0x17e99f['model'],_0x17e99f['query']);_0x5281bc[_0x29d9('0x32')]=_[_0x29d9('0x41')](_0x17e99f[_0x29d9('0x2d')],qs[_0x29d9('0x31')](_0x21705a[_0x29d9('0x2f')][_0x29d9('0x31')]));_0x5281bc[_0x29d9('0x32')]=_0x5281bc[_0x29d9('0x32')]['length']?_0x5281bc[_0x29d9('0x32')]:_0x17e99f['model'];if(_0x21705a['query'][_0x29d9('0x42')]){_0x5281bc['include']=[{'all':!![]}];}_0x5281bc=_[_0x29d9('0x39')]({},_0x5281bc,_0x21705a[_0x29d9('0x3a')]);return db[_0x29d9('0x3c')][_0x29d9('0x43')](_0x5281bc)[_0x29d9('0x22')](handleEntityNotFound(_0x348294,null))['then'](respondWithResult(_0x348294,null))['catch'](handleError(_0x348294,null));};exports[_0x29d9('0x44')]=function(_0x31b647,_0x2777bc){return db[_0x29d9('0x3c')][_0x29d9('0x44')](_0x31b647[_0x29d9('0x45')],{})[_0x29d9('0x22')](respondWithResult(_0x2777bc,0xc9))[_0x29d9('0x46')](handleError(_0x2777bc,null));};exports[_0x29d9('0x21')]=function(_0x3b13f3,_0x3c3549){if(_0x3b13f3['body']['id']){delete _0x3b13f3[_0x29d9('0x45')]['id'];}return db[_0x29d9('0x3c')][_0x29d9('0x43')]({'where':{'id':_0x3b13f3[_0x29d9('0x40')]['id']}})[_0x29d9('0x22')](handleEntityNotFound(_0x3c3549,null))[_0x29d9('0x22')](saveUpdates(_0x3b13f3['body'],null))[_0x29d9('0x22')](respondWithResult(_0x3c3549,null))['catch'](handleError(_0x3c3549,null));};exports[_0x29d9('0x23')]=function(_0x409319,_0x590632){return db[_0x29d9('0x3c')]['find']({'where':{'id':_0x409319[_0x29d9('0x40')]['id']}})[_0x29d9('0x22')](handleEntityNotFound(_0x590632,null))[_0x29d9('0x22')](removeEntity(_0x590632,null))[_0x29d9('0x46')](handleError(_0x590632,null));};exports['getConfigurations']=function(_0x34e40a,_0x4a7fb6,_0x4a759a){var _0x2d38f5={};var _0x1f9bfa={};var _0xe8e440;var _0xe60a8c;return db[_0x29d9('0x3c')][_0x29d9('0x47')]({'where':{'id':_0x34e40a[_0x29d9('0x40')]['id']}})[_0x29d9('0x22')](handleEntityNotFound(_0x4a7fb6,null))[_0x29d9('0x22')](function(_0xd2e7d2){if(_0xd2e7d2){_0xe8e440=_0xd2e7d2;_0x1f9bfa['model']=_[_0x29d9('0x2e')](db[_0x29d9('0x48')][_0x29d9('0x29')]);_0x1f9bfa[_0x29d9('0x2f')]=_['keys'](_0x34e40a[_0x29d9('0x2f')]);_0x1f9bfa['filters']=_['intersection'](_0x1f9bfa['model'],_0x1f9bfa['query']);_0x2d38f5[_0x29d9('0x32')]=_[_0x29d9('0x41')](_0x1f9bfa[_0x29d9('0x2d')],qs[_0x29d9('0x31')](_0x34e40a[_0x29d9('0x2f')][_0x29d9('0x31')]));_0x2d38f5[_0x29d9('0x32')]=_0x2d38f5['attributes'][_0x29d9('0x33')]?_0x2d38f5[_0x29d9('0x32')]:_0x1f9bfa[_0x29d9('0x2d')];_0x2d38f5[_0x29d9('0x35')]=qs[_0x29d9('0x36')](_0x34e40a[_0x29d9('0x2f')][_0x29d9('0x36')]);_0x2d38f5['where']=qs[_0x29d9('0x30')](_[_0x29d9('0x37')](_0x34e40a[_0x29d9('0x2f')],_0x1f9bfa[_0x29d9('0x30')]));if(_0x34e40a[_0x29d9('0x2f')][_0x29d9('0x38')]){_0x2d38f5[_0x29d9('0x3b')]=_[_0x29d9('0x39')](_0x2d38f5[_0x29d9('0x3b')],{'$or':_[_0x29d9('0x49')](_0x2d38f5[_0x29d9('0x32')],function(_0x5c6e42){var _0x19f4c3={};_0x19f4c3[_0x5c6e42]={'$like':'%'+_0x34e40a[_0x29d9('0x2f')]['filter']+'%'};return _0x19f4c3;})});}_0x2d38f5=_[_0x29d9('0x39')]({},_0x2d38f5,_0x34e40a[_0x29d9('0x3a')]);return _0xe8e440[_0x29d9('0x4a')](_0x2d38f5);}})[_0x29d9('0x22')](function(_0x461e73){if(_0x461e73){_0xe60a8c=_0x461e73[_0x29d9('0x33')];if(!_0x34e40a['query'][_0x29d9('0x4b')]('nolimit')){_0x2d38f5[_0x29d9('0x1b')]=qs[_0x29d9('0x1b')](_0x34e40a[_0x29d9('0x2f')][_0x29d9('0x1b')]);_0x2d38f5[_0x29d9('0x19')]=qs[_0x29d9('0x19')](_0x34e40a[_0x29d9('0x2f')]['offset']);}return _0xe8e440[_0x29d9('0x4a')](_0x2d38f5);}})[_0x29d9('0x22')](function(_0x250275){if(_0x250275){return _0x250275?{'count':_0xe60a8c,'rows':_0x250275}:null;}})[_0x29d9('0x22')](respondWithResult(_0x4a7fb6,null))['catch'](handleError(_0x4a7fb6,null));};exports['addConfiguration']=function(_0x30e49b,_0xef0b45,_0x1c6cf8){if(_0x30e49b[_0x29d9('0x45')]['id']){delete _0x30e49b[_0x29d9('0x45')]['id'];}return db[_0x29d9('0x3c')][_0x29d9('0x47')]({'where':{'id':_0x30e49b[_0x29d9('0x40')]['id']}})['then'](handleEntityNotFound(_0xef0b45,null))[_0x29d9('0x22')](function(_0x1e51fe){if(_0x1e51fe){_0x30e49b[_0x29d9('0x45')][_0x29d9('0x4c')]=_0x1e51fe['id'];_0x30e49b['body'][_0x29d9('0x4d')]=integrations['getSubjects'](_0x30e49b[_0x29d9('0x45')]['channel'],_0x30e49b[_0x29d9('0x45')][_0x29d9('0x2b')]);_0x30e49b[_0x29d9('0x45')][_0x29d9('0x4e')]=integrations['getDescriptions'](_0x30e49b['body'][_0x29d9('0x4f')],_0x30e49b[_0x29d9('0x45')][_0x29d9('0x2b')]);return db[_0x29d9('0x48')]['create'](_0x30e49b[_0x29d9('0x45')],{'include':[{'model':db['Dynamics365Field'],'as':_0x29d9('0x4d')},{'model':db['Dynamics365Field'],'as':_0x29d9('0x4e')}]});}return null;})['then'](respondWithResult(_0xef0b45,null))[_0x29d9('0x46')](handleError(_0xef0b45,null));};exports[_0x29d9('0x50')]=function(_0x1bc82c,_0x3165d2,_0x264e61){var _0x5cafd4=_0x1bc82c[_0x29d9('0x2f')][_0x29d9('0x51')];var _0xb90297=_0x5cafd4===_0x29d9('0x52')?_0x29d9('0x53'):_0x29d9('0x54');var _0x976a66='';var _0x20957b='';var _0x18fadc='';var _0x420739='';var _0x504368='';var _0x5147b3='';var _0x497925='';var _0x221f32='';var _0x2db783=[_0x29d9('0x55'),'description','customerid',_0x29d9('0x56'),_0x29d9('0x57'),'subject','phonenumber','regardingobjectid',_0x29d9('0x58'),_0x29d9('0x59')];var _0x48effa=[_0x29d9('0x5a'),_0x29d9('0x5b'),_0x29d9('0x5c'),'billedserviceunits',_0x29d9('0x5d'),_0x29d9('0x5e'),_0x29d9('0x5f'),_0x29d9('0x60'),_0x29d9('0x61'),_0x29d9('0x62'),_0x29d9('0x63'),_0x29d9('0x64'),'createdon',_0x29d9('0x65'),_0x29d9('0x66'),_0x29d9('0x67'),_0x29d9('0x68'),_0x29d9('0x69'),_0x29d9('0x6a'),_0x29d9('0x6b'),'entityimage_timestamp','entityimage_url',_0x29d9('0x6c'),_0x29d9('0x6d'),_0x29d9('0x6e'),_0x29d9('0x6f'),_0x29d9('0x70'),_0x29d9('0x71'),'kbarticleidname','lastonholdtime',_0x29d9('0x72'),'modifiedbyexternalpartyname',_0x29d9('0x73'),_0x29d9('0x74'),_0x29d9('0x75'),_0x29d9('0x76'),'modifiedonbehalfbyname',_0x29d9('0x77'),_0x29d9('0x78'),'msdyn_iotalertname',_0x29d9('0x79'),_0x29d9('0x7a'),_0x29d9('0x7b'),'owneridname',_0x29d9('0x7c'),_0x29d9('0x7d'),_0x29d9('0x7e'),_0x29d9('0x7f'),_0x29d9('0x80'),_0x29d9('0x81'),_0x29d9('0x82'),_0x29d9('0x83'),_0x29d9('0x84'),_0x29d9('0x85'),'responseby',_0x29d9('0x86'),_0x29d9('0x87'),_0x29d9('0x88'),'slainvokedidname',_0x29d9('0x89'),_0x29d9('0x8a'),'statecode','statuscode',_0x29d9('0x8b'),_0x29d9('0x8c'),_0x29d9('0x8d'),'transactioncurrencyidname',_0x29d9('0x8e'),_0x29d9('0x8f'),_0x29d9('0x90')];var _0x3a3110=_0x2db783[_0x29d9('0x91')](_0x48effa);return db[_0x29d9('0x3c')][_0x29d9('0x47')]({'where':{'id':_0x1bc82c['params']['id']},'attributes':['id','username',_0x29d9('0x92'),_0x29d9('0x93'),'tenantId','clientId',_0x29d9('0x94')]})[_0x29d9('0x22')](handleEntityNotFound(_0x3165d2,null))[_0x29d9('0x22')](function(_0x396dc2){if(_0x396dc2){_0x221f32=_0x396dc2[_0x29d9('0x93')];var _0x6375b7=_0x221f32[_0x29d9('0x95')](-0x1);if(_0x6375b7==='/'){_0x221f32=_0x221f32['substring'](0x0,_0x221f32[_0x29d9('0x96')](_0x6375b7));}_0x497925=util[_0x29d9('0x97')]('%s/api/data/v9.0/',_0x221f32);var _0x56dca1={'method':_0x29d9('0x98'),'uri':_0x29d9('0x99')+_0x396dc2['tenantId']+'/oauth2/token','form':{'client_id':_0x396dc2['clientId'],'resource':_0x221f32,'username':_0x396dc2[_0x29d9('0x9a')],'password':_0x396dc2['password'],'grant_type':'password','client_secret':_0x396dc2[_0x29d9('0x94')]},'json':!![]};return rp(_0x56dca1);}})[_0x29d9('0x22')](function(_0xed4741){_0x5147b3=_0xed4741[_0x29d9('0x9b')];var _0x5c882e={'method':'GET','uri':encodeURI(_0x497925+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0xb90297+'\x27'),'headers':{'Authorization':_0x29d9('0x9c')+_0x5147b3,'If-None-Match':null,'OData-Version':_0x29d9('0x9d')},'json':!![]};return rp(_0x5c882e);})['then'](function(_0x5d5b12){var _0x32481e=_0x5d5b12[_0x29d9('0x9e')][0x0];var _0x568546=_0x32481e[_0x29d9('0x9f')];var _0x247538={'method':_0x29d9('0xa0'),'uri':_0x497925+'EntityDefinitions('+_0x568546+_0x29d9('0xa1'),'headers':{'Authorization':_0x29d9('0x9c')+_0x5147b3,'If-None-Match':null,'OData-Version':_0x29d9('0x9d')},'json':!![]};return rp(_0x247538);})[_0x29d9('0x22')](function(_0xa7ee24){_0x976a66=_0xa7ee24;_0x20957b=_0x976a66[_0x29d9('0xa2')];_0x20957b=_['remove'](_0x20957b,function(_0x4d6ef4){return!_0x3a3110['includes'](_0x4d6ef4[_0x29d9('0xa3')]);});var _0x104a25=[];var _0x547d02=[];_0x20957b[_0x29d9('0xa4')](function(_0x22b995){if(_0x22b995[_0x29d9('0xa5')]){var _0x14ca95=_0x22b995[_0x29d9('0xa5')][_0x29d9('0xa6')](_0x22b995['@odata.type'][_0x29d9('0x96')]('.')+0x1);if(_0x14ca95===_0x29d9('0xa7')){_0x104a25[_0x29d9('0xa8')](getSelectList(_0x497925,_0x5cafd4,_0x547d02,_0x976a66['MetadataId'],_0x22b995[_0x29d9('0x9f')],_0x5147b3));}}});return Promise['all'](_0x104a25);})[_0x29d9('0x22')](function(_0x574454){_0x18fadc=_0x574454[0x0];var _0xa290ed=[];var _0x4e4e7=[];_0x20957b['forEach'](function(_0x45ec40){if(!_[_0x29d9('0xa9')](_0x45ec40[_0x29d9('0xa5')])){var _0x5c8a68=_0x45ec40[_0x29d9('0xa5')][_0x29d9('0xa6')](_0x45ec40['@odata.type'][_0x29d9('0x96')]('.')+0x1);if(_0x5c8a68===_0x29d9('0xaa')){_0xa290ed[_0x29d9('0xa8')](getBooleanList(_0x497925,_0x5cafd4,_0x4e4e7,_0x976a66[_0x29d9('0x9f')],_0x45ec40[_0x29d9('0x9f')],_0x5147b3));}}});return Promise['all'](_0xa290ed);})[_0x29d9('0x22')](function(_0x45ff8c){_0x420739=_0x45ff8c[0x0];var _0x13a2db=[];var _0x432f80=[];_0x20957b[_0x29d9('0xa4')](function(_0x5c6a1e){if(_0x5c6a1e['@odata.type']){var _0x415414=_0x5c6a1e[_0x29d9('0xa5')][_0x29d9('0xa6')](_0x5c6a1e[_0x29d9('0xa5')]['lastIndexOf']('.')+0x1);if(_0x415414===_0x29d9('0xab')||_0x415414===_0x29d9('0xac')||_0x415414===_0x29d9('0xad')||_0x415414===_0x29d9('0xae')||_0x415414===_0x29d9('0xaf')||_0x415414===_0x29d9('0xb0')||_0x415414===_0x29d9('0xb1')||_0x415414==='EntityNameAttributeMetadata'||_0x415414===_0x29d9('0xb2')||_0x415414===_0x29d9('0xb3')){_0x13a2db[_0x29d9('0xa8')](getInputList(_0x497925,_0x5cafd4,_0x415414,_0x432f80,_0x976a66[_0x29d9('0x9f')],_0x5c6a1e[_0x29d9('0x9f')],_0x5147b3));}}});return Promise[_0x29d9('0xb4')](_0x13a2db);})['then'](function(_0x22c062){_0x504368=_0x22c062[0x0];var _0x5deb84=_0x18fadc[_0x29d9('0x91')](_0x420739)[_0x29d9('0x91')](_0x504368);var _0xbe8101={'count':_0x5deb84[_0x29d9('0x33')],'rows':_0x5deb84};return _0xbe8101;})[_0x29d9('0x22')](respondWithResult(_0x3165d2,null))['catch'](function(_0x34c75f){var _0x477d74=_0x1bc82c['query']['test']?0x1f4:_0x34c75f[_0x29d9('0xb5')]||0x1f4;logger[_0x29d9('0x24')](_0x34c75f['stack']);delete _0x34c75f[_0x29d9('0x26')];if(_0x477d74===0x191){_0x477d74=0x190;}_0x3165d2[_0x29d9('0x16')](_0x477d74)[_0x29d9('0x27')](_0x1bc82c[_0x29d9('0x2f')][_0x29d9('0xb6')]?{'message':_0x29d9('0xb7'),'statusCode':_0x34c75f['statusCode']}:_0x34c75f);});};function getSelectList(_0x429ad9,_0x35537c,_0x2054b1,_0x4bc91e,_0x207a2c,_0x583f18){var _0x506a28={'method':_0x29d9('0xa0'),'uri':_0x429ad9+_0x29d9('0xb8')+_0x4bc91e+_0x29d9('0xb9')+_0x207a2c+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x29d9('0xba'),'headers':{'Authorization':_0x29d9('0x9c')+_0x583f18,'If-None-Match':null,'OData-Version':_0x29d9('0x9d')},'json':!![]};return rp(_0x506a28)[_0x29d9('0x22')](function(_0x4a7454){var _0x21f545=[];var _0x20d658=_0x4a7454[_0x29d9('0xbb')]['Options'];_0x20d658[_0x29d9('0xa4')](function(_0x2dca52){_0x21f545['push']({'name':_0x2dca52[_0x29d9('0xbc')]['UserLocalizedLabel'][_0x29d9('0xbc')],'value':String(_0x2dca52[_0x29d9('0xbd')])});});var _0x3a30dd={'id':_0x35537c+'_'+_0x4a7454[_0x29d9('0xa3')],'name':_0x4a7454[_0x29d9('0xbe')]['UserLocalizedLabel'][_0x29d9('0xbc')],'custom':![],'options':_0x21f545};_0x2054b1[_0x29d9('0xa8')](_0x3a30dd);return _0x2054b1;});}function getBooleanList(_0x5e8fff,_0x24c15a,_0x45079c,_0xf7b363,_0x38f83e,_0x1eb600){var _0x1816fb={'method':'GET','uri':_0x5e8fff+_0x29d9('0xb8')+_0xf7b363+_0x29d9('0xb9')+_0x38f83e+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x1eb600,'If-None-Match':null,'OData-Version':_0x29d9('0x9d')},'json':!![]};return rp(_0x1816fb)[_0x29d9('0x22')](function(_0x4fd63f){var _0x536fc0=[];_0x536fc0[_0x29d9('0xa8')]({'name':_0x4fd63f[_0x29d9('0xbb')][_0x29d9('0xbf')][_0x29d9('0xbc')][_0x29d9('0xc0')]['Label'],'value':_0x29d9('0xc1')},{'name':_0x4fd63f[_0x29d9('0xbb')]['FalseOption']['Label'][_0x29d9('0xc0')][_0x29d9('0xbc')],'value':_0x29d9('0xc2')});var _0x5e39d7={'id':_0x24c15a+'_'+_0x4fd63f[_0x29d9('0xa3')],'name':_0x4fd63f['DisplayName'][_0x29d9('0xc0')][_0x29d9('0xbc')],'custom':![],'options':_0x536fc0};_0x45079c[_0x29d9('0xa8')](_0x5e39d7);return _0x45079c;});}function getInputList(_0x348462,_0x4d200a,_0x304d59,_0x4d3cff,_0x47c4f6,_0x5b3ed8,_0x2feb1e){var _0x1efe4b={'method':'GET','uri':_0x348462+_0x29d9('0xb8')+_0x47c4f6+_0x29d9('0xb9')+_0x5b3ed8+_0x29d9('0xc3')+_0x304d59+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x29d9('0x9c')+_0x2feb1e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1efe4b)[_0x29d9('0x22')](function(_0x1cb1b6){var _0x8be461={'id':_0x4d200a+'_'+_0x1cb1b6['LogicalName'],'name':_0x1cb1b6[_0x29d9('0xbe')][_0x29d9('0xc0')]?_0x1cb1b6['DisplayName'][_0x29d9('0xc0')][_0x29d9('0xbc')]:_0x1cb1b6['LogicalName'],'custom':![],'options':[]};_0x4d3cff[_0x29d9('0xa8')](_0x8be461);return _0x4d3cff;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index b122c04..dc7d51a 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 _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x52bb1a,_0x233cb2){var _0x208c56=function(_0x564c1f){while(--_0x564c1f){_0x52bb1a['push'](_0x52bb1a['shift']());}};_0x208c56(++_0x233cb2);}(_0x757a,0xde));var _0xa757=function(_0x24e931,_0x3e5fe3){_0x24e931=_0x24e931-0x0;var _0x5d1795=_0x757a[_0x24e931];return _0x5d1795;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x5396de,_0x204ed5){var _0x27b80a=function(_0x2e4d24){while(--_0x2e4d24){_0x5396de['push'](_0x5396de['shift']());}};_0x27b80a(++_0x204ed5);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index a73ea96..77acea1 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 _0x6d00=['options','raw','attributes','limit','include','map','model','then','ShowDynamics365Account','find','where','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetDynamics365Account','Dynamics365Account'];(function(_0x21162a,_0x140d8b){var _0x104a73=function(_0x1a1229){while(--_0x1a1229){_0x21162a['push'](_0x21162a['shift']());}};_0x104a73(++_0x140d8b);}(_0x6d00,0x77));var _0x06d0=function(_0x4e9182,_0x3b49b1){_0x4e9182=_0x4e9182-0x0;var _0x17aef7=_0x6d00[_0x4e9182];return _0x17aef7;};'use strict';var _=require(_0x06d0('0x0'));var util=require(_0x06d0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x06d0('0x2'));var fs=require('fs');var Redis=require(_0x06d0('0x3'));var db=require(_0x06d0('0x4'))['db'];var utils=require(_0x06d0('0x5'));var logger=require(_0x06d0('0x6'))(_0x06d0('0x7'));var config=require(_0x06d0('0x8'));var jayson=require(_0x06d0('0x9'));var client=jayson[_0x06d0('0xa')][_0x06d0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44a97c,_0x171b6a,_0x508f14){return new BPromise(function(_0x5a6460,_0x46e3a0){return client[_0x06d0('0xc')](_0x44a97c,_0x508f14)['then'](function(_0x31015d){logger['info'](_0x06d0('0xd'),_0x171b6a,_0x06d0('0xe'));logger[_0x06d0('0xf')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x171b6a,_0x06d0('0xe'),JSON[_0x06d0('0x10')](_0x31015d));if(_0x31015d[_0x06d0('0x11')]){if(_0x31015d['error'][_0x06d0('0x12')]===0x1f4){logger[_0x06d0('0x11')](_0x06d0('0xd'),_0x171b6a,_0x31015d['error'][_0x06d0('0x13')]);return _0x46e3a0(_0x31015d[_0x06d0('0x11')][_0x06d0('0x13')]);}logger[_0x06d0('0x11')](_0x06d0('0xd'),_0x171b6a,_0x31015d[_0x06d0('0x11')]['message']);return _0x5a6460(_0x31015d[_0x06d0('0x11')][_0x06d0('0x13')]);}else{logger[_0x06d0('0x14')]('Dynamics365Account,\x20%s,\x20%s',_0x171b6a,_0x06d0('0xe'));_0x5a6460(_0x31015d[_0x06d0('0x15')][_0x06d0('0x13')]);}})[_0x06d0('0x16')](function(_0x4bdf44){logger[_0x06d0('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x171b6a,_0x4bdf44);_0x46e3a0(_0x4bdf44);});});}exports[_0x06d0('0x17')]=function(_0x6fcdb7){var _0x17ae56=this;return new Promise(function(_0x2bd89f,_0x5b1c0b){return db[_0x06d0('0x18')]['findAll']({'raw':_0x6fcdb7[_0x06d0('0x19')]?_0x6fcdb7[_0x06d0('0x19')][_0x06d0('0x1a')]===undefined?!![]:![]:!![],'where':_0x6fcdb7[_0x06d0('0x19')]?_0x6fcdb7[_0x06d0('0x19')]['where']||null:null,'attributes':_0x6fcdb7[_0x06d0('0x19')]?_0x6fcdb7['options'][_0x06d0('0x1b')]||null:null,'limit':_0x6fcdb7['options']?_0x6fcdb7['options'][_0x06d0('0x1c')]||null:null,'include':_0x6fcdb7['options']?_0x6fcdb7[_0x06d0('0x19')][_0x06d0('0x1d')]?_[_0x06d0('0x1e')](_0x6fcdb7[_0x06d0('0x19')][_0x06d0('0x1d')],function(_0x47af80){return{'model':db[_0x47af80[_0x06d0('0x1f')]],'as':_0x47af80['as'],'attributes':_0x47af80[_0x06d0('0x1b')],'include':_0x47af80[_0x06d0('0x1d')]?_[_0x06d0('0x1e')](_0x47af80['include'],function(_0x3e3043){return{'model':db[_0x3e3043[_0x06d0('0x1f')]],'as':_0x3e3043['as'],'attributes':_0x3e3043[_0x06d0('0x1b')],'include':_0x3e3043[_0x06d0('0x1d')]?_[_0x06d0('0x1e')](_0x3e3043['include'],function(_0x2e8b9e){return{'model':db[_0x2e8b9e['model']],'as':_0x2e8b9e['as'],'attributes':_0x2e8b9e[_0x06d0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x06d0('0x20')](function(_0x3fb4a4){logger['info'](_0x06d0('0x17'),_0x6fcdb7);logger[_0x06d0('0xf')](_0x06d0('0x17'),_0x6fcdb7,JSON[_0x06d0('0x10')](_0x3fb4a4));_0x2bd89f(_0x3fb4a4);})[_0x06d0('0x16')](function(_0x30f6fe){logger[_0x06d0('0x11')](_0x06d0('0x17'),_0x30f6fe['message'],_0x6fcdb7);_0x5b1c0b(_0x17ae56[_0x06d0('0x11')](0x1f4,_0x30f6fe[_0x06d0('0x13')]));});});};exports[_0x06d0('0x21')]=function(_0x20295c){var _0x4041a5=this;return new Promise(function(_0x26d2a7,_0x4189ca){return db[_0x06d0('0x18')][_0x06d0('0x22')]({'raw':_0x20295c[_0x06d0('0x19')]?_0x20295c[_0x06d0('0x19')][_0x06d0('0x1a')]===undefined?!![]:![]:!![],'where':_0x20295c[_0x06d0('0x19')]?_0x20295c[_0x06d0('0x19')][_0x06d0('0x23')]||null:null,'attributes':_0x20295c[_0x06d0('0x19')]?_0x20295c[_0x06d0('0x19')][_0x06d0('0x1b')]||null:null,'include':_0x20295c[_0x06d0('0x19')]?_0x20295c['options'][_0x06d0('0x1d')]?_['map'](_0x20295c[_0x06d0('0x19')][_0x06d0('0x1d')],function(_0x217f1c){return{'model':db[_0x217f1c['model']],'as':_0x217f1c['as'],'attributes':_0x217f1c['attributes'],'include':_0x217f1c[_0x06d0('0x1d')]?_[_0x06d0('0x1e')](_0x217f1c[_0x06d0('0x1d')],function(_0x184a9c){return{'model':db[_0x184a9c[_0x06d0('0x1f')]],'as':_0x184a9c['as'],'attributes':_0x184a9c[_0x06d0('0x1b')],'include':_0x184a9c[_0x06d0('0x1d')]?_[_0x06d0('0x1e')](_0x184a9c[_0x06d0('0x1d')],function(_0x1977ab){return{'model':db[_0x1977ab[_0x06d0('0x1f')]],'as':_0x1977ab['as'],'attributes':_0x1977ab[_0x06d0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x06d0('0x20')](function(_0x372122){logger[_0x06d0('0x14')](_0x06d0('0x21'),_0x20295c);logger[_0x06d0('0xf')]('ShowDynamics365Account',_0x20295c,JSON[_0x06d0('0x10')](_0x372122));_0x26d2a7(_0x372122);})[_0x06d0('0x16')](function(_0x1759d9){logger['error'](_0x06d0('0x21'),_0x1759d9[_0x06d0('0x13')],_0x20295c);_0x4189ca(_0x4041a5[_0x06d0('0x11')](0x1f4,_0x1759d9['message']));});});}; \ No newline at end of file +var _0x6b37=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','include','map','model','attributes','find','where','ShowDynamics365Account','lodash'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0x6b37,0xd1));var _0x76b3=function(_0x37a1df,_0x177dde){_0x37a1df=_0x37a1df-0x0;var _0x15ffe0=_0x6b37[_0x37a1df];return _0x15ffe0;};'use strict';var _=require(_0x76b3('0x0'));var util=require(_0x76b3('0x1'));var moment=require(_0x76b3('0x2'));var BPromise=require(_0x76b3('0x3'));var rs=require(_0x76b3('0x4'));var fs=require('fs');var Redis=require(_0x76b3('0x5'));var db=require(_0x76b3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x76b3('0x7'))(_0x76b3('0x8'));var config=require(_0x76b3('0x9'));var jayson=require(_0x76b3('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36c221,_0x42a16b,_0x27e08){return new BPromise(function(_0x1c387c,_0x405ac7){return client['request'](_0x36c221,_0x27e08)[_0x76b3('0xb')](function(_0x17a961){logger['info'](_0x76b3('0xc'),_0x42a16b,_0x76b3('0xd'));logger[_0x76b3('0xe')](_0x76b3('0xf'),_0x42a16b,'request\x20sent',JSON[_0x76b3('0x10')](_0x17a961));if(_0x17a961[_0x76b3('0x11')]){if(_0x17a961[_0x76b3('0x11')][_0x76b3('0x12')]===0x1f4){logger[_0x76b3('0x11')](_0x76b3('0xc'),_0x42a16b,_0x17a961['error'][_0x76b3('0x13')]);return _0x405ac7(_0x17a961[_0x76b3('0x11')]['message']);}logger[_0x76b3('0x11')](_0x76b3('0xc'),_0x42a16b,_0x17a961[_0x76b3('0x11')][_0x76b3('0x13')]);return _0x1c387c(_0x17a961[_0x76b3('0x11')][_0x76b3('0x13')]);}else{logger[_0x76b3('0x14')](_0x76b3('0xc'),_0x42a16b,_0x76b3('0xd'));_0x1c387c(_0x17a961[_0x76b3('0x15')][_0x76b3('0x13')]);}})[_0x76b3('0x16')](function(_0x4286f1){logger['error'](_0x76b3('0xc'),_0x42a16b,_0x4286f1);_0x405ac7(_0x4286f1);});});}exports[_0x76b3('0x17')]=function(_0x5f437e){var _0x45c661=this;return new Promise(function(_0x96993a,_0x4cc86c){return db[_0x76b3('0x18')][_0x76b3('0x19')]({'raw':_0x5f437e[_0x76b3('0x1a')]?_0x5f437e[_0x76b3('0x1a')][_0x76b3('0x1b')]===undefined?!![]:![]:!![],'where':_0x5f437e['options']?_0x5f437e[_0x76b3('0x1a')]['where']||null:null,'attributes':_0x5f437e['options']?_0x5f437e['options']['attributes']||null:null,'limit':_0x5f437e['options']?_0x5f437e[_0x76b3('0x1a')]['limit']||null:null,'include':_0x5f437e[_0x76b3('0x1a')]?_0x5f437e[_0x76b3('0x1a')][_0x76b3('0x1c')]?_[_0x76b3('0x1d')](_0x5f437e[_0x76b3('0x1a')]['include'],function(_0x39b1e8){return{'model':db[_0x39b1e8[_0x76b3('0x1e')]],'as':_0x39b1e8['as'],'attributes':_0x39b1e8[_0x76b3('0x1f')],'include':_0x39b1e8[_0x76b3('0x1c')]?_[_0x76b3('0x1d')](_0x39b1e8[_0x76b3('0x1c')],function(_0x4fc0a3){return{'model':db[_0x4fc0a3[_0x76b3('0x1e')]],'as':_0x4fc0a3['as'],'attributes':_0x4fc0a3['attributes'],'include':_0x4fc0a3['include']?_[_0x76b3('0x1d')](_0x4fc0a3[_0x76b3('0x1c')],function(_0x3de51f){return{'model':db[_0x3de51f[_0x76b3('0x1e')]],'as':_0x3de51f['as'],'attributes':_0x3de51f[_0x76b3('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x76b3('0xb')](function(_0x36655f){logger[_0x76b3('0x14')]('GetDynamics365Account',_0x5f437e);logger[_0x76b3('0xe')]('GetDynamics365Account',_0x5f437e,JSON['stringify'](_0x36655f));_0x96993a(_0x36655f);})[_0x76b3('0x16')](function(_0x308ee5){logger['error'](_0x76b3('0x17'),_0x308ee5[_0x76b3('0x13')],_0x5f437e);_0x4cc86c(_0x45c661['error'](0x1f4,_0x308ee5['message']));});});};exports['ShowDynamics365Account']=function(_0x40c5f8){var _0x1b7ac0=this;return new Promise(function(_0x3ef7f1,_0x2f5593){return db[_0x76b3('0x18')][_0x76b3('0x20')]({'raw':_0x40c5f8[_0x76b3('0x1a')]?_0x40c5f8[_0x76b3('0x1a')][_0x76b3('0x1b')]===undefined?!![]:![]:!![],'where':_0x40c5f8[_0x76b3('0x1a')]?_0x40c5f8[_0x76b3('0x1a')][_0x76b3('0x21')]||null:null,'attributes':_0x40c5f8[_0x76b3('0x1a')]?_0x40c5f8[_0x76b3('0x1a')]['attributes']||null:null,'include':_0x40c5f8[_0x76b3('0x1a')]?_0x40c5f8[_0x76b3('0x1a')][_0x76b3('0x1c')]?_['map'](_0x40c5f8[_0x76b3('0x1a')][_0x76b3('0x1c')],function(_0x53bcb4){return{'model':db[_0x53bcb4[_0x76b3('0x1e')]],'as':_0x53bcb4['as'],'attributes':_0x53bcb4[_0x76b3('0x1f')],'include':_0x53bcb4[_0x76b3('0x1c')]?_[_0x76b3('0x1d')](_0x53bcb4[_0x76b3('0x1c')],function(_0x53b23d){return{'model':db[_0x53b23d['model']],'as':_0x53b23d['as'],'attributes':_0x53b23d[_0x76b3('0x1f')],'include':_0x53b23d[_0x76b3('0x1c')]?_[_0x76b3('0x1d')](_0x53b23d['include'],function(_0x54cd44){return{'model':db[_0x54cd44[_0x76b3('0x1e')]],'as':_0x54cd44['as'],'attributes':_0x54cd44[_0x76b3('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x42d286){logger['info']('ShowDynamics365Account',_0x40c5f8);logger[_0x76b3('0xe')](_0x76b3('0x22'),_0x40c5f8,JSON['stringify'](_0x42d286));_0x3ef7f1(_0x42d286);})[_0x76b3('0x16')](function(_0xe21a8b){logger[_0x76b3('0x11')](_0x76b3('0x22'),_0xe21a8b['message'],_0x40c5f8);_0x2f5593(_0x1b7ac0[_0x76b3('0x11')](0x1f4,_0xe21a8b[_0x76b3('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 9cf7088..93202d2 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 _0xc664=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x42160b,_0x54a892){var _0x28cb88=function(_0x21fd06){while(--_0x21fd06){_0x42160b['push'](_0x42160b['shift']());}};_0x28cb88(++_0x54a892);}(_0xc664,0x127));var _0x4c66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc664[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4c66('0x0'));var util=require(_0x4c66('0x1'));var path=require('path');var timeout=require(_0x4c66('0x2'));var express=require('express');var router=express[_0x4c66('0x3')]();var fs_extra=require(_0x4c66('0x4'));var auth=require(_0x4c66('0x5'));var interaction=require(_0x4c66('0x6'));var config=require(_0x4c66('0x7'));var controller=require(_0x4c66('0x8'));router[_0x4c66('0x9')]('/',auth[_0x4c66('0xa')](),controller['index']);router[_0x4c66('0x9')](_0x4c66('0xb'),auth[_0x4c66('0xa')](),controller[_0x4c66('0xc')]);router[_0x4c66('0x9')](_0x4c66('0xd'),auth[_0x4c66('0xa')](),controller[_0x4c66('0xe')]);router[_0x4c66('0x9')](_0x4c66('0xf'),auth['isAuthenticated'](),controller[_0x4c66('0x10')]);router[_0x4c66('0x9')](_0x4c66('0x11'),auth[_0x4c66('0xa')](),controller[_0x4c66('0x12')]);router[_0x4c66('0x13')]('/',auth[_0x4c66('0xa')](),controller[_0x4c66('0x14')]);router['put']('/:id',auth[_0x4c66('0xa')](),controller[_0x4c66('0x15')]);router[_0x4c66('0x16')](_0x4c66('0xb'),auth[_0x4c66('0xa')](),controller[_0x4c66('0x17')]);module[_0x4c66('0x18')]=router; \ No newline at end of file +var _0x9977=['connect-timeout','Router','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','/:id','update','delete','destroy','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9977,0x9e));var _0x7997=function(_0x2f037f,_0x2958c5){_0x2f037f=_0x2f037f-0x0;var _0x2d1573=_0x9977[_0x2f037f];return _0x2d1573;};'use strict';var multer=require('multer');var util=require(_0x7997('0x0'));var path=require(_0x7997('0x1'));var timeout=require(_0x7997('0x2'));var express=require('express');var router=express[_0x7997('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7997('0x4'));var controller=require(_0x7997('0x5'));router[_0x7997('0x6')]('/',auth[_0x7997('0x7')](),controller['index']);router[_0x7997('0x6')]('/:id',auth[_0x7997('0x7')](),controller['show']);router[_0x7997('0x6')](_0x7997('0x8'),auth['isAuthenticated'](),controller[_0x7997('0x9')]);router['get'](_0x7997('0xa'),auth[_0x7997('0x7')](),controller[_0x7997('0xb')]);router['get'](_0x7997('0xc'),auth['isAuthenticated'](),controller[_0x7997('0xd')]);router['post']('/',auth[_0x7997('0x7')](),controller[_0x7997('0xe')]);router[_0x7997('0xf')](_0x7997('0x10'),auth['isAuthenticated'](),controller[_0x7997('0x11')]);router[_0x7997('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x7997('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 53b7f22..621f232 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 _0x8145=['sequelize','STRING','phonecall','incident'];(function(_0x26d5de,_0x368822){var _0x1d1236=function(_0x1f709b){while(--_0x1f709b){_0x26d5de['push'](_0x26d5de['shift']());}};_0x1d1236(++_0x368822);}(_0x8145,0x74));var _0x5814=function(_0x3bb46a,_0x4d3a51){_0x3bb46a=_0x3bb46a-0x0;var _0xf30f8f=_0x8145[_0x3bb46a];return _0xf30f8f;};'use strict';var Sequelize=require(_0x5814('0x0'));module['exports']={'name':{'type':Sequelize[_0x5814('0x1')]},'description':{'type':Sequelize[_0x5814('0x1')]},'ticketType':{'type':Sequelize['ENUM']('incident',_0x5814('0x2')),'defaultValue':_0x5814('0x3')}}; \ No newline at end of file +var _0xb961=['ENUM','phonecall','incident','STRING'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0xb961,0x17b));var _0x1b96=function(_0x7efeb9,_0x76fb60){_0x7efeb9=_0x7efeb9-0x0;var _0xea8f41=_0xb961[_0x7efeb9];return _0xea8f41;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1b96('0x0')]},'description':{'type':Sequelize[_0x1b96('0x0')]},'ticketType':{'type':Sequelize[_0x1b96('0x1')]('incident',_0x1b96('0x2')),'defaultValue':_0x1b96('0x3')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 3c12b84..e7fd9a1 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 _0xe040=['filter','options','includeAll','findAll','rows','catch','params','keys','length','find','create','body','getFields','findOne','Dynamics365Field','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge'];(function(_0x512285,_0x304176){var _0x32d7d6=function(_0xe0a2b){while(--_0xe0a2b){_0x512285['push'](_0x512285['shift']());}};_0x32d7d6(++_0x304176);}(_0xe040,0x1b1));var _0x0e04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe040[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x0e04('0x0'));var rimraf=require(_0x0e04('0x1'));var zipdir=require(_0x0e04('0x2'));var jsonpatch=require(_0x0e04('0x3'));var rp=require(_0x0e04('0x4'));var moment=require(_0x0e04('0x5'));var BPromise=require(_0x0e04('0x6'));var Mustache=require(_0x0e04('0x7'));var util=require(_0x0e04('0x8'));var path=require(_0x0e04('0x9'));var sox=require(_0x0e04('0xa'));var csv=require(_0x0e04('0xb'));var ejs=require(_0x0e04('0xc'));var fs=require('fs');var fs_extra=require(_0x0e04('0xd'));var _=require('lodash');var squel=require(_0x0e04('0xe'));var crypto=require(_0x0e04('0xf'));var jsforce=require(_0x0e04('0x10'));var deskjs=require(_0x0e04('0x11'));var toCsv=require(_0x0e04('0xb'));var querystring=require(_0x0e04('0x12'));var Papa=require(_0x0e04('0x13'));var Redis=require(_0x0e04('0x14'));var authService=require(_0x0e04('0x15'));var qs=require(_0x0e04('0x16'));var as=require(_0x0e04('0x17'));var hardwareService=require(_0x0e04('0x18'));var logger=require('../../config/logger')('api');var utils=require(_0x0e04('0x19'));var config=require(_0x0e04('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e0003,_0x5986c3){_0x5986c3=_0x5986c3||0xcc;return function(_0x37561){if(_0x37561){return _0x1e0003[_0x0e04('0x1b')](_0x5986c3);}return _0x1e0003[_0x0e04('0x1c')](_0x5986c3)[_0x0e04('0x1d')]();};}function respondWithResult(_0x4833aa,_0x360686){_0x360686=_0x360686||0xc8;return function(_0x1bd36c){if(_0x1bd36c){return _0x4833aa['status'](_0x360686)[_0x0e04('0x1e')](_0x1bd36c);}};}function respondWithFilteredResult(_0x2d9ea1,_0x3a01aa){return function(_0x4f71e0){if(_0x4f71e0){var _0x4379ec=typeof _0x3a01aa['offset']===_0x0e04('0x1f')&&typeof _0x3a01aa[_0x0e04('0x20')]==='undefined';var _0xff7c7f=_0x4f71e0[_0x0e04('0x21')];var _0x5611f4=_0x4379ec?0x0:_0x3a01aa[_0x0e04('0x22')];var _0x2fe690=_0x4379ec?_0x4f71e0[_0x0e04('0x21')]:_0x3a01aa['offset']+_0x3a01aa[_0x0e04('0x20')];var _0x6a4f1c;if(_0x2fe690>=_0xff7c7f){_0x2fe690=_0xff7c7f;_0x6a4f1c=0xc8;}else{_0x6a4f1c=0xce;}_0x2d9ea1[_0x0e04('0x1c')](_0x6a4f1c);return _0x2d9ea1[_0x0e04('0x23')](_0x0e04('0x24'),_0x5611f4+'-'+_0x2fe690+'/'+_0xff7c7f)[_0x0e04('0x1e')](_0x4f71e0);}return null;};}function patchUpdates(_0x4a7d99){return function(_0x12d7ea){try{jsonpatch[_0x0e04('0x25')](_0x12d7ea,_0x4a7d99,!![]);}catch(_0x20f914){return BPromise[_0x0e04('0x26')](_0x20f914);}return _0x12d7ea['save']();};}function saveUpdates(_0x3a4d35,_0x2f2ce4){return function(_0x21a9de){if(_0x21a9de){return _0x21a9de[_0x0e04('0x27')](_0x3a4d35)[_0x0e04('0x28')](function(_0x42e09d){return _0x42e09d;});}return null;};}function removeEntity(_0x1cc8b1,_0x4a7dd2){return function(_0xc06747){if(_0xc06747){return _0xc06747[_0x0e04('0x29')]()[_0x0e04('0x28')](function(){_0x1cc8b1[_0x0e04('0x1c')](0xcc)[_0x0e04('0x1d')]();});}};}function handleEntityNotFound(_0x3c78e3,_0xf33add){return function(_0x1bc37d){if(!_0x1bc37d){_0x3c78e3['sendStatus'](0x194);}return _0x1bc37d;};}function handleError(_0x4d4eac,_0x1e19c2){_0x1e19c2=_0x1e19c2||0x1f4;return function(_0xc84db7){logger[_0x0e04('0x2a')](_0xc84db7[_0x0e04('0x2b')]);if(_0xc84db7[_0x0e04('0x2c')]){delete _0xc84db7['name'];}_0x4d4eac[_0x0e04('0x1c')](_0x1e19c2)[_0x0e04('0x2d')](_0xc84db7);};}exports[_0x0e04('0x2e')]=function(_0x23c2e0,_0x146dd0){var _0x2d38e5={},_0x3d8f21={},_0x47f9f6={'count':0x0,'rows':[]};var _0x45582c=_[_0x0e04('0x2f')](db[_0x0e04('0x30')][_0x0e04('0x31')],function(_0x17f2b9){return{'name':_0x17f2b9[_0x0e04('0x32')],'type':_0x17f2b9[_0x0e04('0x33')][_0x0e04('0x34')]};});_0x3d8f21[_0x0e04('0x35')]=_[_0x0e04('0x2f')](_0x45582c,_0x0e04('0x2c'));_0x3d8f21[_0x0e04('0x36')]=_['keys'](_0x23c2e0[_0x0e04('0x36')]);_0x3d8f21[_0x0e04('0x37')]=_[_0x0e04('0x38')](_0x3d8f21['model'],_0x3d8f21[_0x0e04('0x36')]);_0x2d38e5[_0x0e04('0x39')]=_[_0x0e04('0x38')](_0x3d8f21[_0x0e04('0x35')],qs[_0x0e04('0x3a')](_0x23c2e0['query'][_0x0e04('0x3a')]));_0x2d38e5['attributes']=_0x2d38e5['attributes']['length']?_0x2d38e5[_0x0e04('0x39')]:_0x3d8f21[_0x0e04('0x35')];if(!_0x23c2e0[_0x0e04('0x36')][_0x0e04('0x3b')](_0x0e04('0x3c'))){_0x2d38e5[_0x0e04('0x20')]=qs[_0x0e04('0x20')](_0x23c2e0[_0x0e04('0x36')][_0x0e04('0x20')]);_0x2d38e5[_0x0e04('0x22')]=qs[_0x0e04('0x22')](_0x23c2e0[_0x0e04('0x36')]['offset']);}_0x2d38e5['order']=qs[_0x0e04('0x3d')](_0x23c2e0[_0x0e04('0x36')][_0x0e04('0x3d')]);_0x2d38e5[_0x0e04('0x3e')]=qs[_0x0e04('0x37')](_[_0x0e04('0x3f')](_0x23c2e0[_0x0e04('0x36')],_0x3d8f21[_0x0e04('0x37')]),_0x45582c);if(_0x23c2e0[_0x0e04('0x36')]['filter']){_0x2d38e5['where']=_[_0x0e04('0x40')](_0x2d38e5[_0x0e04('0x3e')],{'$or':_[_0x0e04('0x2f')](_0x45582c,function(_0x1db8b9){if(_0x1db8b9['type']!=='VIRTUAL'){var _0x5264d8={};_0x5264d8[_0x1db8b9[_0x0e04('0x2c')]]={'$like':'%'+_0x23c2e0[_0x0e04('0x36')][_0x0e04('0x41')]+'%'};return _0x5264d8;}})});}_0x2d38e5=_['merge']({},_0x2d38e5,_0x23c2e0[_0x0e04('0x42')]);var _0x27d6c7={'where':_0x2d38e5[_0x0e04('0x3e')]};return db[_0x0e04('0x30')][_0x0e04('0x21')](_0x27d6c7)[_0x0e04('0x28')](function(_0x4bae73){_0x47f9f6[_0x0e04('0x21')]=_0x4bae73;if(_0x23c2e0[_0x0e04('0x36')][_0x0e04('0x43')]){_0x2d38e5['include']=[{'all':!![]}];}return db[_0x0e04('0x30')][_0x0e04('0x44')](_0x2d38e5);})[_0x0e04('0x28')](function(_0xb10048){_0x47f9f6[_0x0e04('0x45')]=_0xb10048;return _0x47f9f6;})[_0x0e04('0x28')](respondWithFilteredResult(_0x146dd0,_0x2d38e5))[_0x0e04('0x46')](handleError(_0x146dd0,null));};exports['show']=function(_0x40482f,_0x113074){var _0x1431d4={'raw':![],'where':{'id':_0x40482f[_0x0e04('0x47')]['id']}},_0x1ecb09={};_0x1ecb09[_0x0e04('0x35')]=_[_0x0e04('0x48')](db['Dynamics365Configuration'][_0x0e04('0x31')]);_0x1ecb09[_0x0e04('0x36')]=_[_0x0e04('0x48')](_0x40482f[_0x0e04('0x36')]);_0x1ecb09[_0x0e04('0x37')]=_['intersection'](_0x1ecb09[_0x0e04('0x35')],_0x1ecb09[_0x0e04('0x36')]);_0x1431d4[_0x0e04('0x39')]=_[_0x0e04('0x38')](_0x1ecb09[_0x0e04('0x35')],qs[_0x0e04('0x3a')](_0x40482f[_0x0e04('0x36')][_0x0e04('0x3a')]));_0x1431d4['attributes']=_0x1431d4[_0x0e04('0x39')][_0x0e04('0x49')]?_0x1431d4['attributes']:_0x1ecb09[_0x0e04('0x35')];if(_0x40482f['query'][_0x0e04('0x43')]){_0x1431d4['include']=[{'all':!![]}];}_0x1431d4=_[_0x0e04('0x40')]({},_0x1431d4,_0x40482f[_0x0e04('0x42')]);return db['Dynamics365Configuration'][_0x0e04('0x4a')](_0x1431d4)[_0x0e04('0x28')](handleEntityNotFound(_0x113074,null))['then'](respondWithResult(_0x113074,null))[_0x0e04('0x46')](handleError(_0x113074,null));};exports[_0x0e04('0x4b')]=function(_0x207ba5,_0x128929){return db['Dynamics365Configuration'][_0x0e04('0x4b')](_0x207ba5[_0x0e04('0x4c')],{})[_0x0e04('0x28')](respondWithResult(_0x128929,0xc9))[_0x0e04('0x46')](handleError(_0x128929,null));};exports[_0x0e04('0x27')]=function(_0x176da7,_0x570b05){if(_0x176da7[_0x0e04('0x4c')]['id']){delete _0x176da7[_0x0e04('0x4c')]['id'];}return db[_0x0e04('0x30')]['find']({'where':{'id':_0x176da7[_0x0e04('0x47')]['id']}})[_0x0e04('0x28')](handleEntityNotFound(_0x570b05,null))['then'](saveUpdates(_0x176da7[_0x0e04('0x4c')],null))[_0x0e04('0x28')](respondWithResult(_0x570b05,null))['catch'](handleError(_0x570b05,null));};exports[_0x0e04('0x29')]=function(_0x30669b,_0x4a3202){return db['Dynamics365Configuration'][_0x0e04('0x4a')]({'where':{'id':_0x30669b[_0x0e04('0x47')]['id']}})['then'](handleEntityNotFound(_0x4a3202,null))[_0x0e04('0x28')](removeEntity(_0x4a3202,null))['catch'](handleError(_0x4a3202,null));};exports[_0x0e04('0x4d')]=function(_0x14e42f,_0x1b6ca4,_0x5e3e51){var _0x57792c={};var _0xf2b7d9={};var _0x140adb;var _0x4a34dd;return db[_0x0e04('0x30')][_0x0e04('0x4e')]({'where':{'id':_0x14e42f[_0x0e04('0x47')]['id']}})[_0x0e04('0x28')](handleEntityNotFound(_0x1b6ca4,null))[_0x0e04('0x28')](function(_0xc90505){if(_0xc90505){_0x140adb=_0xc90505;_0xf2b7d9[_0x0e04('0x35')]=_[_0x0e04('0x48')](db[_0x0e04('0x4f')][_0x0e04('0x31')]);_0xf2b7d9[_0x0e04('0x36')]=_[_0x0e04('0x48')](_0x14e42f['query']);_0xf2b7d9['filters']=_['intersection'](_0xf2b7d9[_0x0e04('0x35')],_0xf2b7d9[_0x0e04('0x36')]);_0x57792c[_0x0e04('0x39')]=_[_0x0e04('0x38')](_0xf2b7d9[_0x0e04('0x35')],qs[_0x0e04('0x3a')](_0x14e42f['query'][_0x0e04('0x3a')]));_0x57792c['attributes']=_0x57792c[_0x0e04('0x39')][_0x0e04('0x49')]?_0x57792c[_0x0e04('0x39')]:_0xf2b7d9[_0x0e04('0x35')];_0x57792c[_0x0e04('0x50')]=qs[_0x0e04('0x3d')](_0x14e42f[_0x0e04('0x36')][_0x0e04('0x3d')]);_0x57792c[_0x0e04('0x3e')]=qs[_0x0e04('0x37')](_[_0x0e04('0x3f')](_0x14e42f[_0x0e04('0x36')],_0xf2b7d9[_0x0e04('0x37')]));if(_0x14e42f[_0x0e04('0x36')][_0x0e04('0x41')]){_0x57792c[_0x0e04('0x3e')]=_[_0x0e04('0x40')](_0x57792c[_0x0e04('0x3e')],{'$or':_[_0x0e04('0x2f')](_0x57792c[_0x0e04('0x39')],function(_0x1d9179){var _0x2f843e={};_0x2f843e[_0x1d9179]={'$like':'%'+_0x14e42f[_0x0e04('0x36')][_0x0e04('0x41')]+'%'};return _0x2f843e;})});}_0x57792c=_[_0x0e04('0x40')]({},_0x57792c,_0x14e42f[_0x0e04('0x42')]);return _0x140adb[_0x0e04('0x4d')](_0x57792c);}})[_0x0e04('0x28')](function(_0x5d141c){if(_0x5d141c){_0x4a34dd=_0x5d141c[_0x0e04('0x49')];if(!_0x14e42f['query'][_0x0e04('0x3b')](_0x0e04('0x3c'))){_0x57792c[_0x0e04('0x20')]=qs[_0x0e04('0x20')](_0x14e42f[_0x0e04('0x36')][_0x0e04('0x20')]);_0x57792c[_0x0e04('0x22')]=qs[_0x0e04('0x22')](_0x14e42f[_0x0e04('0x36')][_0x0e04('0x22')]);}return _0x140adb['getFields'](_0x57792c);}})[_0x0e04('0x28')](function(_0x483e43){if(_0x483e43){return _0x483e43?{'count':_0x4a34dd,'rows':_0x483e43}:null;}})['then'](respondWithResult(_0x1b6ca4,null))[_0x0e04('0x46')](handleError(_0x1b6ca4,null));};exports['getSubjects']=function(_0x584108,_0x8ddc43,_0x4a0350){var _0x333a8c={};var _0x148c4={};var _0x4a69f1;var _0x1d8292;return db[_0x0e04('0x30')][_0x0e04('0x4e')]({'where':{'id':_0x584108[_0x0e04('0x47')]['id']}})['then'](handleEntityNotFound(_0x8ddc43,null))[_0x0e04('0x28')](function(_0x107922){if(_0x107922){_0x4a69f1=_0x107922;_0x148c4[_0x0e04('0x35')]=_[_0x0e04('0x48')](db[_0x0e04('0x4f')]['rawAttributes']);_0x148c4[_0x0e04('0x36')]=_[_0x0e04('0x48')](_0x584108[_0x0e04('0x36')]);_0x148c4[_0x0e04('0x37')]=_[_0x0e04('0x38')](_0x148c4[_0x0e04('0x35')],_0x148c4[_0x0e04('0x36')]);_0x333a8c[_0x0e04('0x39')]=_[_0x0e04('0x38')](_0x148c4[_0x0e04('0x35')],qs['fields'](_0x584108['query'][_0x0e04('0x3a')]));_0x333a8c[_0x0e04('0x39')]=_0x333a8c['attributes'][_0x0e04('0x49')]?_0x333a8c[_0x0e04('0x39')]:_0x148c4[_0x0e04('0x35')];_0x333a8c[_0x0e04('0x50')]=qs[_0x0e04('0x3d')](_0x584108['query'][_0x0e04('0x3d')]);_0x333a8c[_0x0e04('0x3e')]=qs['filters'](_['pick'](_0x584108[_0x0e04('0x36')],_0x148c4[_0x0e04('0x37')]));if(_0x584108[_0x0e04('0x36')]['filter']){_0x333a8c[_0x0e04('0x3e')]=_[_0x0e04('0x40')](_0x333a8c[_0x0e04('0x3e')],{'$or':_[_0x0e04('0x2f')](_0x333a8c['attributes'],function(_0x591fa1){var _0x33e69a={};_0x33e69a[_0x591fa1]={'$like':'%'+_0x584108[_0x0e04('0x36')][_0x0e04('0x41')]+'%'};return _0x33e69a;})});}_0x333a8c=_[_0x0e04('0x40')]({},_0x333a8c,_0x584108[_0x0e04('0x42')]);return _0x4a69f1[_0x0e04('0x51')](_0x333a8c);}})[_0x0e04('0x28')](function(_0x25a5b3){if(_0x25a5b3){_0x1d8292=_0x25a5b3['length'];if(!_0x584108[_0x0e04('0x36')][_0x0e04('0x3b')](_0x0e04('0x3c'))){_0x333a8c[_0x0e04('0x20')]=qs['limit'](_0x584108[_0x0e04('0x36')][_0x0e04('0x20')]);_0x333a8c[_0x0e04('0x22')]=qs[_0x0e04('0x22')](_0x584108[_0x0e04('0x36')][_0x0e04('0x22')]);}return _0x4a69f1[_0x0e04('0x51')](_0x333a8c);}})[_0x0e04('0x28')](function(_0xb782d7){if(_0xb782d7){return _0xb782d7?{'count':_0x1d8292,'rows':_0xb782d7}:null;}})[_0x0e04('0x28')](respondWithResult(_0x8ddc43,null))[_0x0e04('0x46')](handleError(_0x8ddc43,null));};exports['getDescriptions']=function(_0x1266a9,_0x1923c4,_0x4519a9){var _0x50ba97={};var _0x4ffcd4={};var _0x3c94d4;var _0xfbf390;return db[_0x0e04('0x30')][_0x0e04('0x4e')]({'where':{'id':_0x1266a9['params']['id']}})[_0x0e04('0x28')](handleEntityNotFound(_0x1923c4,null))['then'](function(_0x113fa9){if(_0x113fa9){_0x3c94d4=_0x113fa9;_0x4ffcd4[_0x0e04('0x35')]=_[_0x0e04('0x48')](db[_0x0e04('0x4f')][_0x0e04('0x31')]);_0x4ffcd4[_0x0e04('0x36')]=_[_0x0e04('0x48')](_0x1266a9[_0x0e04('0x36')]);_0x4ffcd4[_0x0e04('0x37')]=_[_0x0e04('0x38')](_0x4ffcd4[_0x0e04('0x35')],_0x4ffcd4[_0x0e04('0x36')]);_0x50ba97[_0x0e04('0x39')]=_[_0x0e04('0x38')](_0x4ffcd4[_0x0e04('0x35')],qs[_0x0e04('0x3a')](_0x1266a9[_0x0e04('0x36')][_0x0e04('0x3a')]));_0x50ba97[_0x0e04('0x39')]=_0x50ba97[_0x0e04('0x39')][_0x0e04('0x49')]?_0x50ba97[_0x0e04('0x39')]:_0x4ffcd4[_0x0e04('0x35')];_0x50ba97[_0x0e04('0x50')]=qs[_0x0e04('0x3d')](_0x1266a9[_0x0e04('0x36')][_0x0e04('0x3d')]);_0x50ba97['where']=qs[_0x0e04('0x37')](_[_0x0e04('0x3f')](_0x1266a9[_0x0e04('0x36')],_0x4ffcd4['filters']));if(_0x1266a9[_0x0e04('0x36')][_0x0e04('0x41')]){_0x50ba97[_0x0e04('0x3e')]=_['merge'](_0x50ba97['where'],{'$or':_[_0x0e04('0x2f')](_0x50ba97[_0x0e04('0x39')],function(_0x4e387d){var _0x35afa3={};_0x35afa3[_0x4e387d]={'$like':'%'+_0x1266a9[_0x0e04('0x36')][_0x0e04('0x41')]+'%'};return _0x35afa3;})});}_0x50ba97=_[_0x0e04('0x40')]({},_0x50ba97,_0x1266a9['options']);return _0x3c94d4['getDescriptions'](_0x50ba97);}})[_0x0e04('0x28')](function(_0x3661fe){if(_0x3661fe){_0xfbf390=_0x3661fe[_0x0e04('0x49')];if(!_0x1266a9[_0x0e04('0x36')][_0x0e04('0x3b')]('nolimit')){_0x50ba97[_0x0e04('0x20')]=qs[_0x0e04('0x20')](_0x1266a9[_0x0e04('0x36')]['limit']);_0x50ba97[_0x0e04('0x22')]=qs[_0x0e04('0x22')](_0x1266a9['query'][_0x0e04('0x22')]);}return _0x3c94d4[_0x0e04('0x52')](_0x50ba97);}})[_0x0e04('0x28')](function(_0x57848f){if(_0x57848f){return _0x57848f?{'count':_0xfbf390,'rows':_0x57848f}:null;}})[_0x0e04('0x28')](respondWithResult(_0x1923c4,null))['catch'](handleError(_0x1923c4,null));}; \ No newline at end of file +var _0x50ba=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','error','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','catch','create','body','find','getFields','Dynamics365Field','filter','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0x232456,_0x1ff422){var _0x5c0763=function(_0x92bdd1){while(--_0x92bdd1){_0x232456['push'](_0x232456['shift']());}};_0x5c0763(++_0x1ff422);}(_0x50ba,0x8f));var _0xa50b=function(_0x56e0e5,_0x2e3937){_0x56e0e5=_0x56e0e5-0x0;var _0x27bb15=_0x50ba[_0x56e0e5];return _0x27bb15;};'use strict';var emlformat=require(_0xa50b('0x0'));var rimraf=require(_0xa50b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa50b('0x2'));var rp=require(_0xa50b('0x3'));var moment=require(_0xa50b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa50b('0x5'));var util=require(_0xa50b('0x6'));var path=require('path');var sox=require(_0xa50b('0x7'));var csv=require(_0xa50b('0x8'));var ejs=require(_0xa50b('0x9'));var fs=require('fs');var fs_extra=require(_0xa50b('0xa'));var _=require(_0xa50b('0xb'));var squel=require(_0xa50b('0xc'));var crypto=require(_0xa50b('0xd'));var jsforce=require(_0xa50b('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa50b('0xf'));var Papa=require(_0xa50b('0x10'));var Redis=require(_0xa50b('0x11'));var authService=require(_0xa50b('0x12'));var qs=require(_0xa50b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa50b('0x14'))('api');var utils=require(_0xa50b('0x15'));var config=require(_0xa50b('0x16'));var licenseUtil=require(_0xa50b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33e51a,_0x49f05c){_0x49f05c=_0x49f05c||0xcc;return function(_0x51122a){if(_0x51122a){return _0x33e51a[_0xa50b('0x18')](_0x49f05c);}return _0x33e51a['status'](_0x49f05c)[_0xa50b('0x19')]();};}function respondWithResult(_0x30b0bd,_0xea0234){_0xea0234=_0xea0234||0xc8;return function(_0xb2cea5){if(_0xb2cea5){return _0x30b0bd[_0xa50b('0x1a')](_0xea0234)[_0xa50b('0x1b')](_0xb2cea5);}};}function respondWithFilteredResult(_0x255cc6,_0x160b37){return function(_0x1cb6dd){if(_0x1cb6dd){var _0xc04b8d=typeof _0x160b37['offset']===_0xa50b('0x1c')&&typeof _0x160b37[_0xa50b('0x1d')]===_0xa50b('0x1c');var _0x2c01f8=_0x1cb6dd['count'];var _0xadde49=_0xc04b8d?0x0:_0x160b37[_0xa50b('0x1e')];var _0x2e8b6e=_0xc04b8d?_0x1cb6dd[_0xa50b('0x1f')]:_0x160b37['offset']+_0x160b37[_0xa50b('0x1d')];var _0x1a8908;if(_0x2e8b6e>=_0x2c01f8){_0x2e8b6e=_0x2c01f8;_0x1a8908=0xc8;}else{_0x1a8908=0xce;}_0x255cc6['status'](_0x1a8908);return _0x255cc6[_0xa50b('0x20')](_0xa50b('0x21'),_0xadde49+'-'+_0x2e8b6e+'/'+_0x2c01f8)['json'](_0x1cb6dd);}return null;};}function patchUpdates(_0x3bbbea){return function(_0x21b0a7){try{jsonpatch['apply'](_0x21b0a7,_0x3bbbea,!![]);}catch(_0x4aaf54){return BPromise[_0xa50b('0x22')](_0x4aaf54);}return _0x21b0a7[_0xa50b('0x23')]();};}function saveUpdates(_0xa656d9,_0x180152){return function(_0x5199b6){if(_0x5199b6){return _0x5199b6[_0xa50b('0x24')](_0xa656d9)[_0xa50b('0x25')](function(_0x1822f4){return _0x1822f4;});}return null;};}function removeEntity(_0x32fada,_0x56979a){return function(_0x1d702d){if(_0x1d702d){return _0x1d702d['destroy']()[_0xa50b('0x25')](function(){_0x32fada[_0xa50b('0x1a')](0xcc)[_0xa50b('0x19')]();});}};}function handleEntityNotFound(_0x51c7fc,_0x33302f){return function(_0x56c3be){if(!_0x56c3be){_0x51c7fc[_0xa50b('0x18')](0x194);}return _0x56c3be;};}function handleError(_0x349dd4,_0x45ec20){_0x45ec20=_0x45ec20||0x1f4;return function(_0x5a45a9){logger[_0xa50b('0x26')](_0x5a45a9['stack']);if(_0x5a45a9[_0xa50b('0x27')]){delete _0x5a45a9[_0xa50b('0x27')];}_0x349dd4[_0xa50b('0x1a')](_0x45ec20)[_0xa50b('0x28')](_0x5a45a9);};}exports[_0xa50b('0x29')]=function(_0x222aff,_0x1b9757){var _0x547733={},_0x3f8dc7={},_0x161619={'count':0x0,'rows':[]};var _0x1c38e5=_[_0xa50b('0x2a')](db[_0xa50b('0x2b')][_0xa50b('0x2c')],function(_0x1ad19c){return{'name':_0x1ad19c[_0xa50b('0x2d')],'type':_0x1ad19c[_0xa50b('0x2e')]['key']};});_0x3f8dc7[_0xa50b('0x2f')]=_[_0xa50b('0x2a')](_0x1c38e5,_0xa50b('0x27'));_0x3f8dc7[_0xa50b('0x30')]=_[_0xa50b('0x31')](_0x222aff[_0xa50b('0x30')]);_0x3f8dc7['filters']=_[_0xa50b('0x32')](_0x3f8dc7['model'],_0x3f8dc7[_0xa50b('0x30')]);_0x547733[_0xa50b('0x33')]=_[_0xa50b('0x32')](_0x3f8dc7[_0xa50b('0x2f')],qs[_0xa50b('0x34')](_0x222aff['query'][_0xa50b('0x34')]));_0x547733[_0xa50b('0x33')]=_0x547733['attributes'][_0xa50b('0x35')]?_0x547733[_0xa50b('0x33')]:_0x3f8dc7[_0xa50b('0x2f')];if(!_0x222aff[_0xa50b('0x30')][_0xa50b('0x36')](_0xa50b('0x37'))){_0x547733[_0xa50b('0x1d')]=qs[_0xa50b('0x1d')](_0x222aff[_0xa50b('0x30')][_0xa50b('0x1d')]);_0x547733[_0xa50b('0x1e')]=qs['offset'](_0x222aff[_0xa50b('0x30')]['offset']);}_0x547733[_0xa50b('0x38')]=qs[_0xa50b('0x39')](_0x222aff['query']['sort']);_0x547733[_0xa50b('0x3a')]=qs[_0xa50b('0x3b')](_[_0xa50b('0x3c')](_0x222aff[_0xa50b('0x30')],_0x3f8dc7[_0xa50b('0x3b')]),_0x1c38e5);if(_0x222aff[_0xa50b('0x30')]['filter']){_0x547733['where']=_[_0xa50b('0x3d')](_0x547733[_0xa50b('0x3a')],{'$or':_['map'](_0x1c38e5,function(_0x3a5fe3){if(_0x3a5fe3[_0xa50b('0x2e')]!==_0xa50b('0x3e')){var _0x211f3e={};_0x211f3e[_0x3a5fe3[_0xa50b('0x27')]]={'$like':'%'+_0x222aff[_0xa50b('0x30')]['filter']+'%'};return _0x211f3e;}})});}_0x547733=_[_0xa50b('0x3d')]({},_0x547733,_0x222aff[_0xa50b('0x3f')]);var _0x16a887={'where':_0x547733['where']};return db[_0xa50b('0x2b')][_0xa50b('0x1f')](_0x16a887)[_0xa50b('0x25')](function(_0x4f4c03){_0x161619['count']=_0x4f4c03;if(_0x222aff[_0xa50b('0x30')][_0xa50b('0x40')]){_0x547733['include']=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xa50b('0x41')](_0x547733);})[_0xa50b('0x25')](function(_0x540fd2){_0x161619[_0xa50b('0x42')]=_0x540fd2;return _0x161619;})[_0xa50b('0x25')](respondWithFilteredResult(_0x1b9757,_0x547733))['catch'](handleError(_0x1b9757,null));};exports[_0xa50b('0x43')]=function(_0x2151b4,_0xc58207){var _0x280895={'raw':![],'where':{'id':_0x2151b4[_0xa50b('0x44')]['id']}},_0x2f2eeb={};_0x2f2eeb[_0xa50b('0x2f')]=_[_0xa50b('0x31')](db[_0xa50b('0x2b')][_0xa50b('0x2c')]);_0x2f2eeb[_0xa50b('0x30')]=_[_0xa50b('0x31')](_0x2151b4[_0xa50b('0x30')]);_0x2f2eeb[_0xa50b('0x3b')]=_[_0xa50b('0x32')](_0x2f2eeb[_0xa50b('0x2f')],_0x2f2eeb[_0xa50b('0x30')]);_0x280895['attributes']=_[_0xa50b('0x32')](_0x2f2eeb['model'],qs[_0xa50b('0x34')](_0x2151b4[_0xa50b('0x30')]['fields']));_0x280895[_0xa50b('0x33')]=_0x280895[_0xa50b('0x33')][_0xa50b('0x35')]?_0x280895[_0xa50b('0x33')]:_0x2f2eeb[_0xa50b('0x2f')];if(_0x2151b4[_0xa50b('0x30')][_0xa50b('0x40')]){_0x280895[_0xa50b('0x45')]=[{'all':!![]}];}_0x280895=_[_0xa50b('0x3d')]({},_0x280895,_0x2151b4[_0xa50b('0x3f')]);return db['Dynamics365Configuration']['find'](_0x280895)['then'](handleEntityNotFound(_0xc58207,null))[_0xa50b('0x25')](respondWithResult(_0xc58207,null))[_0xa50b('0x46')](handleError(_0xc58207,null));};exports[_0xa50b('0x47')]=function(_0x3c87e1,_0x308603){return db[_0xa50b('0x2b')]['create'](_0x3c87e1[_0xa50b('0x48')],{})[_0xa50b('0x25')](respondWithResult(_0x308603,0xc9))[_0xa50b('0x46')](handleError(_0x308603,null));};exports[_0xa50b('0x24')]=function(_0x1ab856,_0x491b46){if(_0x1ab856['body']['id']){delete _0x1ab856[_0xa50b('0x48')]['id'];}return db[_0xa50b('0x2b')][_0xa50b('0x49')]({'where':{'id':_0x1ab856[_0xa50b('0x44')]['id']}})[_0xa50b('0x25')](handleEntityNotFound(_0x491b46,null))[_0xa50b('0x25')](saveUpdates(_0x1ab856['body'],null))[_0xa50b('0x25')](respondWithResult(_0x491b46,null))['catch'](handleError(_0x491b46,null));};exports['destroy']=function(_0x2e8448,_0xa4f2a1){return db[_0xa50b('0x2b')]['find']({'where':{'id':_0x2e8448['params']['id']}})[_0xa50b('0x25')](handleEntityNotFound(_0xa4f2a1,null))[_0xa50b('0x25')](removeEntity(_0xa4f2a1,null))[_0xa50b('0x46')](handleError(_0xa4f2a1,null));};exports[_0xa50b('0x4a')]=function(_0x3d709a,_0x2e8bce,_0x500f07){var _0x1e30ed={};var _0x1ff2f1={};var _0x3e321d;var _0x498b09;return db[_0xa50b('0x2b')]['findOne']({'where':{'id':_0x3d709a['params']['id']}})[_0xa50b('0x25')](handleEntityNotFound(_0x2e8bce,null))[_0xa50b('0x25')](function(_0x2b6a17){if(_0x2b6a17){_0x3e321d=_0x2b6a17;_0x1ff2f1[_0xa50b('0x2f')]=_[_0xa50b('0x31')](db[_0xa50b('0x4b')][_0xa50b('0x2c')]);_0x1ff2f1[_0xa50b('0x30')]=_[_0xa50b('0x31')](_0x3d709a['query']);_0x1ff2f1[_0xa50b('0x3b')]=_[_0xa50b('0x32')](_0x1ff2f1[_0xa50b('0x2f')],_0x1ff2f1[_0xa50b('0x30')]);_0x1e30ed[_0xa50b('0x33')]=_['intersection'](_0x1ff2f1[_0xa50b('0x2f')],qs['fields'](_0x3d709a[_0xa50b('0x30')]['fields']));_0x1e30ed[_0xa50b('0x33')]=_0x1e30ed[_0xa50b('0x33')]['length']?_0x1e30ed[_0xa50b('0x33')]:_0x1ff2f1[_0xa50b('0x2f')];_0x1e30ed[_0xa50b('0x38')]=qs[_0xa50b('0x39')](_0x3d709a['query']['sort']);_0x1e30ed['where']=qs['filters'](_[_0xa50b('0x3c')](_0x3d709a[_0xa50b('0x30')],_0x1ff2f1[_0xa50b('0x3b')]));if(_0x3d709a[_0xa50b('0x30')][_0xa50b('0x4c')]){_0x1e30ed[_0xa50b('0x3a')]=_[_0xa50b('0x3d')](_0x1e30ed[_0xa50b('0x3a')],{'$or':_[_0xa50b('0x2a')](_0x1e30ed[_0xa50b('0x33')],function(_0x48f33d){var _0x2f6024={};_0x2f6024[_0x48f33d]={'$like':'%'+_0x3d709a[_0xa50b('0x30')][_0xa50b('0x4c')]+'%'};return _0x2f6024;})});}_0x1e30ed=_[_0xa50b('0x3d')]({},_0x1e30ed,_0x3d709a[_0xa50b('0x3f')]);return _0x3e321d[_0xa50b('0x4a')](_0x1e30ed);}})['then'](function(_0x3c03f1){if(_0x3c03f1){_0x498b09=_0x3c03f1[_0xa50b('0x35')];if(!_0x3d709a['query'][_0xa50b('0x36')](_0xa50b('0x37'))){_0x1e30ed[_0xa50b('0x1d')]=qs['limit'](_0x3d709a[_0xa50b('0x30')][_0xa50b('0x1d')]);_0x1e30ed['offset']=qs[_0xa50b('0x1e')](_0x3d709a[_0xa50b('0x30')][_0xa50b('0x1e')]);}return _0x3e321d['getFields'](_0x1e30ed);}})[_0xa50b('0x25')](function(_0x506763){if(_0x506763){return _0x506763?{'count':_0x498b09,'rows':_0x506763}:null;}})[_0xa50b('0x25')](respondWithResult(_0x2e8bce,null))[_0xa50b('0x46')](handleError(_0x2e8bce,null));};exports[_0xa50b('0x4d')]=function(_0x134785,_0x1e40f4,_0x452dca){var _0x197d47={};var _0x1a2840={};var _0x428738;var _0x491519;return db[_0xa50b('0x2b')][_0xa50b('0x4e')]({'where':{'id':_0x134785[_0xa50b('0x44')]['id']}})[_0xa50b('0x25')](handleEntityNotFound(_0x1e40f4,null))[_0xa50b('0x25')](function(_0x852128){if(_0x852128){_0x428738=_0x852128;_0x1a2840[_0xa50b('0x2f')]=_[_0xa50b('0x31')](db[_0xa50b('0x4b')][_0xa50b('0x2c')]);_0x1a2840[_0xa50b('0x30')]=_['keys'](_0x134785[_0xa50b('0x30')]);_0x1a2840[_0xa50b('0x3b')]=_[_0xa50b('0x32')](_0x1a2840[_0xa50b('0x2f')],_0x1a2840[_0xa50b('0x30')]);_0x197d47[_0xa50b('0x33')]=_[_0xa50b('0x32')](_0x1a2840[_0xa50b('0x2f')],qs['fields'](_0x134785['query'][_0xa50b('0x34')]));_0x197d47[_0xa50b('0x33')]=_0x197d47[_0xa50b('0x33')][_0xa50b('0x35')]?_0x197d47[_0xa50b('0x33')]:_0x1a2840[_0xa50b('0x2f')];_0x197d47[_0xa50b('0x38')]=qs['sort'](_0x134785[_0xa50b('0x30')][_0xa50b('0x39')]);_0x197d47[_0xa50b('0x3a')]=qs['filters'](_['pick'](_0x134785[_0xa50b('0x30')],_0x1a2840[_0xa50b('0x3b')]));if(_0x134785[_0xa50b('0x30')][_0xa50b('0x4c')]){_0x197d47[_0xa50b('0x3a')]=_[_0xa50b('0x3d')](_0x197d47[_0xa50b('0x3a')],{'$or':_[_0xa50b('0x2a')](_0x197d47[_0xa50b('0x33')],function(_0x14c02a){var _0x3ca80d={};_0x3ca80d[_0x14c02a]={'$like':'%'+_0x134785[_0xa50b('0x30')]['filter']+'%'};return _0x3ca80d;})});}_0x197d47=_[_0xa50b('0x3d')]({},_0x197d47,_0x134785[_0xa50b('0x3f')]);return _0x428738[_0xa50b('0x4d')](_0x197d47);}})[_0xa50b('0x25')](function(_0x26498f){if(_0x26498f){_0x491519=_0x26498f[_0xa50b('0x35')];if(!_0x134785[_0xa50b('0x30')][_0xa50b('0x36')]('nolimit')){_0x197d47[_0xa50b('0x1d')]=qs[_0xa50b('0x1d')](_0x134785['query'][_0xa50b('0x1d')]);_0x197d47[_0xa50b('0x1e')]=qs[_0xa50b('0x1e')](_0x134785[_0xa50b('0x30')][_0xa50b('0x1e')]);}return _0x428738['getSubjects'](_0x197d47);}})[_0xa50b('0x25')](function(_0x2227bb){if(_0x2227bb){return _0x2227bb?{'count':_0x491519,'rows':_0x2227bb}:null;}})[_0xa50b('0x25')](respondWithResult(_0x1e40f4,null))[_0xa50b('0x46')](handleError(_0x1e40f4,null));};exports['getDescriptions']=function(_0x575f8e,_0x1609fd,_0x498257){var _0x559051={};var _0x530de9={};var _0x47f971;var _0x4c69c5;return db[_0xa50b('0x2b')][_0xa50b('0x4e')]({'where':{'id':_0x575f8e[_0xa50b('0x44')]['id']}})[_0xa50b('0x25')](handleEntityNotFound(_0x1609fd,null))[_0xa50b('0x25')](function(_0x501dff){if(_0x501dff){_0x47f971=_0x501dff;_0x530de9[_0xa50b('0x2f')]=_[_0xa50b('0x31')](db[_0xa50b('0x4b')][_0xa50b('0x2c')]);_0x530de9['query']=_[_0xa50b('0x31')](_0x575f8e[_0xa50b('0x30')]);_0x530de9[_0xa50b('0x3b')]=_[_0xa50b('0x32')](_0x530de9['model'],_0x530de9['query']);_0x559051[_0xa50b('0x33')]=_[_0xa50b('0x32')](_0x530de9['model'],qs[_0xa50b('0x34')](_0x575f8e[_0xa50b('0x30')][_0xa50b('0x34')]));_0x559051[_0xa50b('0x33')]=_0x559051[_0xa50b('0x33')][_0xa50b('0x35')]?_0x559051[_0xa50b('0x33')]:_0x530de9[_0xa50b('0x2f')];_0x559051['order']=qs[_0xa50b('0x39')](_0x575f8e[_0xa50b('0x30')][_0xa50b('0x39')]);_0x559051[_0xa50b('0x3a')]=qs[_0xa50b('0x3b')](_[_0xa50b('0x3c')](_0x575f8e['query'],_0x530de9['filters']));if(_0x575f8e[_0xa50b('0x30')][_0xa50b('0x4c')]){_0x559051[_0xa50b('0x3a')]=_['merge'](_0x559051['where'],{'$or':_[_0xa50b('0x2a')](_0x559051[_0xa50b('0x33')],function(_0x39511b){var _0x128cc2={};_0x128cc2[_0x39511b]={'$like':'%'+_0x575f8e['query']['filter']+'%'};return _0x128cc2;})});}_0x559051=_[_0xa50b('0x3d')]({},_0x559051,_0x575f8e[_0xa50b('0x3f')]);return _0x47f971[_0xa50b('0x4f')](_0x559051);}})[_0xa50b('0x25')](function(_0x35a559){if(_0x35a559){_0x4c69c5=_0x35a559[_0xa50b('0x35')];if(!_0x575f8e['query'][_0xa50b('0x36')](_0xa50b('0x37'))){_0x559051[_0xa50b('0x1d')]=qs['limit'](_0x575f8e[_0xa50b('0x30')][_0xa50b('0x1d')]);_0x559051[_0xa50b('0x1e')]=qs[_0xa50b('0x1e')](_0x575f8e['query'][_0xa50b('0x1e')]);}return _0x47f971[_0xa50b('0x4f')](_0x559051);}})['then'](function(_0x1695a5){if(_0x1695a5){return _0x1695a5?{'count':_0x4c69c5,'rows':_0x1695a5}:null;}})[_0xa50b('0x25')](respondWithResult(_0x1609fd,null))[_0xa50b('0x46')](handleError(_0x1609fd,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 0eb99e6..d1c6e47 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ef=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','lodash','util'];(function(_0x1c67c5,_0x27cbdb){var _0xe83b63=function(_0x4ce34e){while(--_0x4ce34e){_0x1c67c5['push'](_0x1c67c5['shift']());}};_0xe83b63(++_0x27cbdb);}(_0x54ef,0x112));var _0xf54e=function(_0x258681,_0x14b05f){_0x258681=_0x258681-0x0;var _0x1e88f9=_0x54ef[_0x258681];return _0x1e88f9;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var fs=require('fs');var path=require(_0xf54e('0x6'));var rimraf=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var attributes=require(_0xf54e('0x9'));module['exports']=function(_0x55e611,_0x18e84e){return _0x55e611[_0xf54e('0xa')](_0xf54e('0xb'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','util'];(function(_0x177d1e,_0x271158){var _0x5ecd8b=function(_0x489a77){while(--_0x489a77){_0x177d1e['push'](_0x177d1e['shift']());}};_0x5ecd8b(++_0x271158);}(_0xedd9,0xfc));var _0x9edd=function(_0x3000c8,_0x217e95){_0x3000c8=_0x3000c8-0x0;var _0xca35e0=_0xedd9[_0x3000c8];return _0xca35e0;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'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 a9d87ad..9db16e1 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 _0x5fca=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','error','code','message','Dynamics365Configuration,\x20%s,\x20%s','result','catch','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x5fca,0x177));var _0xa5fc=function(_0x11f0e3,_0x5170bc){_0x11f0e3=_0x11f0e3-0x0;var _0x2892e8=_0x5fca[_0x11f0e3];return _0x2892e8;};'use strict';var _=require('lodash');var util=require(_0xa5fc('0x0'));var moment=require(_0xa5fc('0x1'));var BPromise=require('bluebird');var rs=require(_0xa5fc('0x2'));var fs=require('fs');var Redis=require(_0xa5fc('0x3'));var db=require(_0xa5fc('0x4'))['db'];var utils=require(_0xa5fc('0x5'));var logger=require(_0xa5fc('0x6'))(_0xa5fc('0x7'));var config=require(_0xa5fc('0x8'));var jayson=require(_0xa5fc('0x9'));var client=jayson[_0xa5fc('0xa')][_0xa5fc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5747a0,_0x3c05a0,_0x13750a){return new BPromise(function(_0x565c97,_0x41d1db){return client['request'](_0x5747a0,_0x13750a)['then'](function(_0x4096ea){logger[_0xa5fc('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3c05a0,_0xa5fc('0xd'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x3c05a0,'request\x20sent',JSON['stringify'](_0x4096ea));if(_0x4096ea[_0xa5fc('0xe')]){if(_0x4096ea[_0xa5fc('0xe')][_0xa5fc('0xf')]===0x1f4){logger[_0xa5fc('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3c05a0,_0x4096ea['error'][_0xa5fc('0x10')]);return _0x41d1db(_0x4096ea[_0xa5fc('0xe')]['message']);}logger[_0xa5fc('0xe')](_0xa5fc('0x11'),_0x3c05a0,_0x4096ea[_0xa5fc('0xe')][_0xa5fc('0x10')]);return _0x565c97(_0x4096ea['error'][_0xa5fc('0x10')]);}else{logger['info'](_0xa5fc('0x11'),_0x3c05a0,_0xa5fc('0xd'));_0x565c97(_0x4096ea[_0xa5fc('0x12')][_0xa5fc('0x10')]);}})[_0xa5fc('0x13')](function(_0x374271){logger[_0xa5fc('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3c05a0,_0x374271);_0x41d1db(_0x374271);});});} \ No newline at end of file +var _0x4805=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','info','Dynamics365Configuration,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','lodash','util'];(function(_0x20c445,_0x45fb29){var _0x202693=function(_0x4beba2){while(--_0x4beba2){_0x20c445['push'](_0x20c445['shift']());}};_0x202693(++_0x45fb29);}(_0x4805,0xf5));var _0x5480=function(_0x62f254,_0xe911ba){_0x62f254=_0x62f254-0x0;var _0x1a3e9e=_0x4805[_0x62f254];return _0x1a3e9e;};'use strict';var _=require(_0x5480('0x0'));var util=require(_0x5480('0x1'));var moment=require(_0x5480('0x2'));var BPromise=require('bluebird');var rs=require(_0x5480('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5480('0x4'))['db'];var utils=require(_0x5480('0x5'));var logger=require(_0x5480('0x6'))(_0x5480('0x7'));var config=require('../../config/environment');var jayson=require(_0x5480('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x566032,_0x592dee,_0x3acdc3){return new BPromise(function(_0x59558c,_0x32b57f){return client[_0x5480('0x9')](_0x566032,_0x3acdc3)['then'](function(_0x5dc3cd){logger[_0x5480('0xa')](_0x5480('0xb'),_0x592dee,'request\x20sent');logger[_0x5480('0xc')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x592dee,'request\x20sent',JSON[_0x5480('0xd')](_0x5dc3cd));if(_0x5dc3cd[_0x5480('0xe')]){if(_0x5dc3cd[_0x5480('0xe')]['code']===0x1f4){logger[_0x5480('0xe')](_0x5480('0xb'),_0x592dee,_0x5dc3cd[_0x5480('0xe')]['message']);return _0x32b57f(_0x5dc3cd['error'][_0x5480('0xf')]);}logger[_0x5480('0xe')](_0x5480('0xb'),_0x592dee,_0x5dc3cd[_0x5480('0xe')][_0x5480('0xf')]);return _0x59558c(_0x5dc3cd[_0x5480('0xe')]['message']);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x592dee,_0x5480('0x10'));_0x59558c(_0x5dc3cd[_0x5480('0x11')]['message']);}})[_0x5480('0x12')](function(_0x17e0f1){logger[_0x5480('0xe')](_0x5480('0xb'),_0x592dee,_0x17e0f1);_0x32b57f(_0x17e0f1);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 66a6882..9982167 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 _0xdcce=['post','create','put','update','delete','destroy','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id'];(function(_0x13e38f,_0x4fd752){var _0x25b237=function(_0x5a1917){while(--_0x5a1917){_0x13e38f['push'](_0x13e38f['shift']());}};_0x25b237(++_0x4fd752);}(_0xdcce,0xa8));var _0xedcc=function(_0x140853,_0xe6ec3e){_0x140853=_0x140853-0x0;var _0x265bd3=_0xdcce[_0x140853];return _0x265bd3;};'use strict';var multer=require(_0xedcc('0x0'));var util=require(_0xedcc('0x1'));var path=require(_0xedcc('0x2'));var timeout=require('connect-timeout');var express=require(_0xedcc('0x3'));var router=express['Router']();var fs_extra=require(_0xedcc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xedcc('0x5'));var config=require(_0xedcc('0x6'));var controller=require(_0xedcc('0x7'));router[_0xedcc('0x8')]('/',auth[_0xedcc('0x9')](),controller[_0xedcc('0xa')]);router['get'](_0xedcc('0xb'),auth[_0xedcc('0x9')](),controller['show']);router[_0xedcc('0xc')]('/',auth[_0xedcc('0x9')](),controller[_0xedcc('0xd')]);router[_0xedcc('0xe')](_0xedcc('0xb'),auth[_0xedcc('0x9')](),controller[_0xedcc('0xf')]);router[_0xedcc('0x10')](_0xedcc('0xb'),auth['isAuthenticated'](),controller[_0xedcc('0x11')]);module['exports']=router; \ No newline at end of file +var _0x62c0=['put','update','delete','isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','index','/:id','show','create'];(function(_0x5645ad,_0x580ea3){var _0x17d292=function(_0xe66902){while(--_0xe66902){_0x5645ad['push'](_0x5645ad['shift']());}};_0x17d292(++_0x580ea3);}(_0x62c0,0x141));var _0x062c=function(_0x58efa6,_0x2c00bd){_0x58efa6=_0x58efa6-0x0;var _0x5d643c=_0x62c0[_0x58efa6];return _0x5d643c;};'use strict';var multer=require(_0x062c('0x0'));var util=require(_0x062c('0x1'));var path=require(_0x062c('0x2'));var timeout=require(_0x062c('0x3'));var express=require(_0x062c('0x4'));var router=express[_0x062c('0x5')]();var fs_extra=require(_0x062c('0x6'));var auth=require(_0x062c('0x7'));var interaction=require(_0x062c('0x8'));var config=require('../../config/environment');var controller=require(_0x062c('0x9'));router[_0x062c('0xa')]('/',auth['isAuthenticated'](),controller[_0x062c('0xb')]);router[_0x062c('0xa')](_0x062c('0xc'),auth['isAuthenticated'](),controller[_0x062c('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x062c('0xe')]);router[_0x062c('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x062c('0x10')]);router[_0x062c('0x11')](_0x062c('0xc'),auth[_0x062c('0x12')](),controller[_0x062c('0x13')]);module[_0x062c('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index a6e7176..15e97c5 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 _0xe316=['picklist','STRING','BOOLEAN','ENUM','string','variable','customVariable','keyValue'];(function(_0x93cfe2,_0x342ed7){var _0x110112=function(_0x15babf){while(--_0x15babf){_0x93cfe2['push'](_0x93cfe2['shift']());}};_0x110112(++_0x342ed7);}(_0xe316,0x193));var _0x6e31=function(_0x2226af,_0x5822cf){_0x2226af=_0x2226af-0x0;var _0x3e34f6=_0xe316[_0x2226af];return _0x3e34f6;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x6e31('0x0')](_0x6e31('0x1'),_0x6e31('0x2'),_0x6e31('0x3'),_0x6e31('0x4'),_0x6e31('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6e31('0x6')]},'keyType':{'type':Sequelize[_0x6e31('0x0')](_0x6e31('0x1'),_0x6e31('0x2'),_0x6e31('0x3'))},'keyContent':{'type':Sequelize[_0x6e31('0x6')]},'idField':{'type':Sequelize[_0x6e31('0x6')]},'nameField':{'type':Sequelize[_0x6e31('0x6')]},'customField':{'type':Sequelize[_0x6e31('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7e6b=['sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x7e6b,0x168));var _0xb7e6=function(_0x186927,_0x1a86d5){_0x186927=_0x186927-0x0;var _0x50a838=_0x7e6b[_0x186927];return _0x50a838;};'use strict';var Sequelize=require(_0xb7e6('0x0'));module[_0xb7e6('0x1')]={'type':{'type':Sequelize[_0xb7e6('0x2')]('string',_0xb7e6('0x3'),_0xb7e6('0x4'),_0xb7e6('0x5'),_0xb7e6('0x6')),'defaultValue':_0xb7e6('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb7e6('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xb7e6('0x7'),_0xb7e6('0x3'),_0xb7e6('0x4'))},'keyContent':{'type':Sequelize[_0xb7e6('0x8')]},'idField':{'type':Sequelize[_0xb7e6('0x8')]},'nameField':{'type':Sequelize[_0xb7e6('0x8')]},'customField':{'type':Sequelize[_0xb7e6('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index e82a246..71fa467 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 _0x951e=['to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','name','map','Dynamics365Field','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','fields','includeAll','find','body','eml-format','zip-dir','request-promise','bluebird','util','path','sox'];(function(_0x1c9351,_0x1e31a2){var _0x211324=function(_0x1f1f88){while(--_0x1f1f88){_0x1c9351['push'](_0x1c9351['shift']());}};_0x211324(++_0x1e31a2);}(_0x951e,0x19d));var _0xe951=function(_0x14c283,_0x41512c){_0x14c283=_0x14c283-0x0;var _0x536ea2=_0x951e[_0x14c283];return _0x536ea2;};'use strict';var emlformat=require(_0xe951('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe951('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe951('0x2'));var moment=require('moment');var BPromise=require(_0xe951('0x3'));var Mustache=require('mustache');var util=require(_0xe951('0x4'));var path=require(_0xe951('0x5'));var sox=require(_0xe951('0x6'));var csv=require(_0xe951('0x7'));var ejs=require(_0xe951('0x8'));var fs=require('fs');var fs_extra=require(_0xe951('0x9'));var _=require(_0xe951('0xa'));var squel=require(_0xe951('0xb'));var crypto=require(_0xe951('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe951('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe951('0xe'));var Papa=require(_0xe951('0xf'));var Redis=require(_0xe951('0x10'));var authService=require(_0xe951('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe951('0x12'));var hardwareService=require(_0xe951('0x13'));var logger=require(_0xe951('0x14'))(_0xe951('0x15'));var utils=require(_0xe951('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe951('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x530757,_0x55ee90){_0x55ee90=_0x55ee90||0xcc;return function(_0x572723){if(_0x572723){return _0x530757[_0xe951('0x18')](_0x55ee90);}return _0x530757[_0xe951('0x19')](_0x55ee90)[_0xe951('0x1a')]();};}function respondWithResult(_0x1ff535,_0x2af1b6){_0x2af1b6=_0x2af1b6||0xc8;return function(_0x57d72f){if(_0x57d72f){return _0x1ff535[_0xe951('0x19')](_0x2af1b6)['json'](_0x57d72f);}};}function respondWithFilteredResult(_0x2b9b23,_0x56b9c0){return function(_0x51236a){if(_0x51236a){var _0x52adca=typeof _0x56b9c0[_0xe951('0x1b')]===_0xe951('0x1c')&&typeof _0x56b9c0[_0xe951('0x1d')]===_0xe951('0x1c');var _0x7eae2c=_0x51236a['count'];var _0x5e1a47=_0x52adca?0x0:_0x56b9c0[_0xe951('0x1b')];var _0x15c0b0=_0x52adca?_0x51236a[_0xe951('0x1e')]:_0x56b9c0['offset']+_0x56b9c0['limit'];var _0x4bdb88;if(_0x15c0b0>=_0x7eae2c){_0x15c0b0=_0x7eae2c;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x2b9b23[_0xe951('0x19')](_0x4bdb88);return _0x2b9b23[_0xe951('0x1f')](_0xe951('0x20'),_0x5e1a47+'-'+_0x15c0b0+'/'+_0x7eae2c)['json'](_0x51236a);}return null;};}function patchUpdates(_0xe7bae8){return function(_0x27e10d){try{jsonpatch[_0xe951('0x21')](_0x27e10d,_0xe7bae8,!![]);}catch(_0x1d697a){return BPromise['reject'](_0x1d697a);}return _0x27e10d[_0xe951('0x22')]();};}function saveUpdates(_0x33b020,_0x47c19e){return function(_0x202291){if(_0x202291){return _0x202291[_0xe951('0x23')](_0x33b020)[_0xe951('0x24')](function(_0x2dcd49){return _0x2dcd49;});}return null;};}function removeEntity(_0x4c2d60,_0x138b7c){return function(_0x4d4bb2){if(_0x4d4bb2){return _0x4d4bb2[_0xe951('0x25')]()['then'](function(){_0x4c2d60[_0xe951('0x19')](0xcc)[_0xe951('0x1a')]();});}};}function handleEntityNotFound(_0x4efb01,_0x1cb413){return function(_0x400a48){if(!_0x400a48){_0x4efb01[_0xe951('0x18')](0x194);}return _0x400a48;};}function handleError(_0xdda3b2,_0x357b62){_0x357b62=_0x357b62||0x1f4;return function(_0x529cb8){logger['error'](_0x529cb8['stack']);if(_0x529cb8[_0xe951('0x26')]){delete _0x529cb8['name'];}_0xdda3b2[_0xe951('0x19')](_0x357b62)['send'](_0x529cb8);};}exports['index']=function(_0x4733db,_0x12e65a){var _0x3eb7aa={},_0xac4a6a={},_0x5b2217={'count':0x0,'rows':[]};var _0x4e6f25=_[_0xe951('0x27')](db[_0xe951('0x28')][_0xe951('0x29')],function(_0x366c59){return{'name':_0x366c59['fieldName'],'type':_0x366c59[_0xe951('0x2a')][_0xe951('0x2b')]};});_0xac4a6a[_0xe951('0x2c')]=_[_0xe951('0x27')](_0x4e6f25,_0xe951('0x26'));_0xac4a6a['query']=_[_0xe951('0x2d')](_0x4733db[_0xe951('0x2e')]);_0xac4a6a[_0xe951('0x2f')]=_[_0xe951('0x30')](_0xac4a6a[_0xe951('0x2c')],_0xac4a6a['query']);_0x3eb7aa[_0xe951('0x31')]=_[_0xe951('0x30')](_0xac4a6a[_0xe951('0x2c')],qs['fields'](_0x4733db[_0xe951('0x2e')]['fields']));_0x3eb7aa['attributes']=_0x3eb7aa[_0xe951('0x31')][_0xe951('0x32')]?_0x3eb7aa[_0xe951('0x31')]:_0xac4a6a[_0xe951('0x2c')];if(!_0x4733db[_0xe951('0x2e')][_0xe951('0x33')](_0xe951('0x34'))){_0x3eb7aa['limit']=qs['limit'](_0x4733db[_0xe951('0x2e')][_0xe951('0x1d')]);_0x3eb7aa[_0xe951('0x1b')]=qs[_0xe951('0x1b')](_0x4733db[_0xe951('0x2e')][_0xe951('0x1b')]);}_0x3eb7aa[_0xe951('0x35')]=qs[_0xe951('0x36')](_0x4733db[_0xe951('0x2e')]['sort']);_0x3eb7aa[_0xe951('0x37')]=qs[_0xe951('0x2f')](_['pick'](_0x4733db[_0xe951('0x2e')],_0xac4a6a['filters']),_0x4e6f25);if(_0x4733db[_0xe951('0x2e')]['filter']){_0x3eb7aa[_0xe951('0x37')]=_['merge'](_0x3eb7aa[_0xe951('0x37')],{'$or':_[_0xe951('0x27')](_0x4e6f25,function(_0x2a79ff){if(_0x2a79ff[_0xe951('0x2a')]!==_0xe951('0x38')){var _0x4732fa={};_0x4732fa[_0x2a79ff[_0xe951('0x26')]]={'$like':'%'+_0x4733db[_0xe951('0x2e')][_0xe951('0x39')]+'%'};return _0x4732fa;}})});}_0x3eb7aa=_[_0xe951('0x3a')]({},_0x3eb7aa,_0x4733db[_0xe951('0x3b')]);var _0x25e82b={'where':_0x3eb7aa[_0xe951('0x37')]};return db[_0xe951('0x28')][_0xe951('0x1e')](_0x25e82b)['then'](function(_0x1df043){_0x5b2217[_0xe951('0x1e')]=_0x1df043;if(_0x4733db[_0xe951('0x2e')]['includeAll']){_0x3eb7aa[_0xe951('0x3c')]=[{'all':!![]}];}return db[_0xe951('0x28')][_0xe951('0x3d')](_0x3eb7aa);})['then'](function(_0x47577c){_0x5b2217[_0xe951('0x3e')]=_0x47577c;return _0x5b2217;})[_0xe951('0x24')](respondWithFilteredResult(_0x12e65a,_0x3eb7aa))[_0xe951('0x3f')](handleError(_0x12e65a,null));};exports[_0xe951('0x40')]=function(_0x34c52b,_0x5c9501){var _0x39d582={'raw':!![],'where':{'id':_0x34c52b[_0xe951('0x41')]['id']}},_0xa05c17={};_0xa05c17[_0xe951('0x2c')]=_[_0xe951('0x2d')](db['Dynamics365Field'][_0xe951('0x29')]);_0xa05c17['query']=_['keys'](_0x34c52b[_0xe951('0x2e')]);_0xa05c17['filters']=_['intersection'](_0xa05c17[_0xe951('0x2c')],_0xa05c17[_0xe951('0x2e')]);_0x39d582[_0xe951('0x31')]=_[_0xe951('0x30')](_0xa05c17['model'],qs['fields'](_0x34c52b[_0xe951('0x2e')][_0xe951('0x42')]));_0x39d582[_0xe951('0x31')]=_0x39d582['attributes']['length']?_0x39d582[_0xe951('0x31')]:_0xa05c17[_0xe951('0x2c')];if(_0x34c52b[_0xe951('0x2e')][_0xe951('0x43')]){_0x39d582[_0xe951('0x3c')]=[{'all':!![]}];}_0x39d582=_['merge']({},_0x39d582,_0x34c52b['options']);return db[_0xe951('0x28')][_0xe951('0x44')](_0x39d582)[_0xe951('0x24')](handleEntityNotFound(_0x5c9501,null))[_0xe951('0x24')](respondWithResult(_0x5c9501,null))[_0xe951('0x3f')](handleError(_0x5c9501,null));};exports['create']=function(_0x41f1c2,_0x50d8cb){return db[_0xe951('0x28')]['create'](_0x41f1c2[_0xe951('0x45')],{})[_0xe951('0x24')](respondWithResult(_0x50d8cb,0xc9))[_0xe951('0x3f')](handleError(_0x50d8cb,null));};exports[_0xe951('0x23')]=function(_0xddebac,_0x1eac1b){if(_0xddebac[_0xe951('0x45')]['id']){delete _0xddebac[_0xe951('0x45')]['id'];}return db[_0xe951('0x28')][_0xe951('0x44')]({'where':{'id':_0xddebac[_0xe951('0x41')]['id']}})['then'](handleEntityNotFound(_0x1eac1b,null))[_0xe951('0x24')](saveUpdates(_0xddebac[_0xe951('0x45')],null))[_0xe951('0x24')](respondWithResult(_0x1eac1b,null))[_0xe951('0x3f')](handleError(_0x1eac1b,null));};exports['destroy']=function(_0x1ab7d2,_0x296b1f){return db[_0xe951('0x28')][_0xe951('0x44')]({'where':{'id':_0x1ab7d2['params']['id']}})['then'](handleEntityNotFound(_0x296b1f,null))['then'](removeEntity(_0x296b1f,null))['catch'](handleError(_0x296b1f,null));}; \ No newline at end of file +var _0x095e=['model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','catch','show','rawAttributes','find','create','body','update','params','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','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','end','status','json','offset','limit','undefined','set','apply','reject','save','then','destroy','sendStatus','error','stack','name','map','Dynamics365Field','fieldName','type','key'];(function(_0xa10e9e,_0x2b1b98){var _0x34bbad=function(_0x5905e8){while(--_0x5905e8){_0xa10e9e['push'](_0xa10e9e['shift']());}};_0x34bbad(++_0x2b1b98);}(_0x095e,0x18d));var _0xe095=function(_0x56c7f4,_0x54c0e4){_0x56c7f4=_0x56c7f4-0x0;var _0x9673cf=_0x095e[_0x56c7f4];return _0x9673cf;};'use strict';var emlformat=require(_0xe095('0x0'));var rimraf=require(_0xe095('0x1'));var zipdir=require(_0xe095('0x2'));var jsonpatch=require(_0xe095('0x3'));var rp=require(_0xe095('0x4'));var moment=require(_0xe095('0x5'));var BPromise=require(_0xe095('0x6'));var Mustache=require(_0xe095('0x7'));var util=require(_0xe095('0x8'));var path=require(_0xe095('0x9'));var sox=require(_0xe095('0xa'));var csv=require(_0xe095('0xb'));var ejs=require(_0xe095('0xc'));var fs=require('fs');var fs_extra=require(_0xe095('0xd'));var _=require('lodash');var squel=require(_0xe095('0xe'));var crypto=require(_0xe095('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xe095('0x10'));var toCsv=require(_0xe095('0xb'));var querystring=require(_0xe095('0x11'));var Papa=require(_0xe095('0x12'));var Redis=require(_0xe095('0x13'));var authService=require(_0xe095('0x14'));var qs=require(_0xe095('0x15'));var as=require(_0xe095('0x16'));var hardwareService=require(_0xe095('0x17'));var logger=require('../../config/logger')(_0xe095('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe095('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x421709,_0x53f322){_0x53f322=_0x53f322||0xcc;return function(_0x320650){if(_0x320650){return _0x421709['sendStatus'](_0x53f322);}return _0x421709['status'](_0x53f322)[_0xe095('0x1a')]();};}function respondWithResult(_0x50bca9,_0x5c3757){_0x5c3757=_0x5c3757||0xc8;return function(_0x429a76){if(_0x429a76){return _0x50bca9[_0xe095('0x1b')](_0x5c3757)[_0xe095('0x1c')](_0x429a76);}};}function respondWithFilteredResult(_0x2b0087,_0x35f46c){return function(_0x905632){if(_0x905632){var _0x7aa347=typeof _0x35f46c[_0xe095('0x1d')]==='undefined'&&typeof _0x35f46c[_0xe095('0x1e')]===_0xe095('0x1f');var _0x23c086=_0x905632['count'];var _0x13e818=_0x7aa347?0x0:_0x35f46c[_0xe095('0x1d')];var _0x48f106=_0x7aa347?_0x905632['count']:_0x35f46c['offset']+_0x35f46c[_0xe095('0x1e')];var _0x26263f;if(_0x48f106>=_0x23c086){_0x48f106=_0x23c086;_0x26263f=0xc8;}else{_0x26263f=0xce;}_0x2b0087[_0xe095('0x1b')](_0x26263f);return _0x2b0087[_0xe095('0x20')]('Content-Range',_0x13e818+'-'+_0x48f106+'/'+_0x23c086)[_0xe095('0x1c')](_0x905632);}return null;};}function patchUpdates(_0x383edb){return function(_0x4cbf83){try{jsonpatch[_0xe095('0x21')](_0x4cbf83,_0x383edb,!![]);}catch(_0x1a000c){return BPromise[_0xe095('0x22')](_0x1a000c);}return _0x4cbf83[_0xe095('0x23')]();};}function saveUpdates(_0x1caef5,_0x51d25e){return function(_0x30b313){if(_0x30b313){return _0x30b313['update'](_0x1caef5)[_0xe095('0x24')](function(_0x45a0ce){return _0x45a0ce;});}return null;};}function removeEntity(_0x2b217d,_0x5d5ab2){return function(_0x16105a){if(_0x16105a){return _0x16105a[_0xe095('0x25')]()['then'](function(){_0x2b217d[_0xe095('0x1b')](0xcc)[_0xe095('0x1a')]();});}};}function handleEntityNotFound(_0x33c211,_0x6d37a8){return function(_0x1c4acf){if(!_0x1c4acf){_0x33c211[_0xe095('0x26')](0x194);}return _0x1c4acf;};}function handleError(_0x4b8024,_0x351ebd){_0x351ebd=_0x351ebd||0x1f4;return function(_0xd4b34b){logger[_0xe095('0x27')](_0xd4b34b[_0xe095('0x28')]);if(_0xd4b34b['name']){delete _0xd4b34b[_0xe095('0x29')];}_0x4b8024[_0xe095('0x1b')](_0x351ebd)['send'](_0xd4b34b);};}exports['index']=function(_0x1a9dd1,_0x51d83e){var _0x58023={},_0x4dae18={},_0x16a958={'count':0x0,'rows':[]};var _0x430240=_[_0xe095('0x2a')](db[_0xe095('0x2b')]['rawAttributes'],function(_0x1196c8){return{'name':_0x1196c8[_0xe095('0x2c')],'type':_0x1196c8[_0xe095('0x2d')][_0xe095('0x2e')]};});_0x4dae18[_0xe095('0x2f')]=_[_0xe095('0x2a')](_0x430240,_0xe095('0x29'));_0x4dae18[_0xe095('0x30')]=_[_0xe095('0x31')](_0x1a9dd1[_0xe095('0x30')]);_0x4dae18[_0xe095('0x32')]=_['intersection'](_0x4dae18['model'],_0x4dae18['query']);_0x58023['attributes']=_[_0xe095('0x33')](_0x4dae18['model'],qs['fields'](_0x1a9dd1[_0xe095('0x30')][_0xe095('0x34')]));_0x58023['attributes']=_0x58023[_0xe095('0x35')][_0xe095('0x36')]?_0x58023['attributes']:_0x4dae18[_0xe095('0x2f')];if(!_0x1a9dd1[_0xe095('0x30')][_0xe095('0x37')]('nolimit')){_0x58023[_0xe095('0x1e')]=qs['limit'](_0x1a9dd1[_0xe095('0x30')][_0xe095('0x1e')]);_0x58023[_0xe095('0x1d')]=qs['offset'](_0x1a9dd1[_0xe095('0x30')][_0xe095('0x1d')]);}_0x58023[_0xe095('0x38')]=qs[_0xe095('0x39')](_0x1a9dd1[_0xe095('0x30')][_0xe095('0x39')]);_0x58023[_0xe095('0x3a')]=qs[_0xe095('0x32')](_[_0xe095('0x3b')](_0x1a9dd1[_0xe095('0x30')],_0x4dae18[_0xe095('0x32')]),_0x430240);if(_0x1a9dd1['query'][_0xe095('0x3c')]){_0x58023[_0xe095('0x3a')]=_[_0xe095('0x3d')](_0x58023[_0xe095('0x3a')],{'$or':_[_0xe095('0x2a')](_0x430240,function(_0x1d0e1f){if(_0x1d0e1f[_0xe095('0x2d')]!==_0xe095('0x3e')){var _0x324915={};_0x324915[_0x1d0e1f[_0xe095('0x29')]]={'$like':'%'+_0x1a9dd1[_0xe095('0x30')][_0xe095('0x3c')]+'%'};return _0x324915;}})});}_0x58023=_[_0xe095('0x3d')]({},_0x58023,_0x1a9dd1['options']);var _0x24b759={'where':_0x58023[_0xe095('0x3a')]};return db[_0xe095('0x2b')][_0xe095('0x3f')](_0x24b759)[_0xe095('0x24')](function(_0x1d55ce){_0x16a958[_0xe095('0x3f')]=_0x1d55ce;if(_0x1a9dd1[_0xe095('0x30')][_0xe095('0x40')]){_0x58023[_0xe095('0x41')]=[{'all':!![]}];}return db[_0xe095('0x2b')]['findAll'](_0x58023);})[_0xe095('0x24')](function(_0x31ff70){_0x16a958['rows']=_0x31ff70;return _0x16a958;})[_0xe095('0x24')](respondWithFilteredResult(_0x51d83e,_0x58023))[_0xe095('0x42')](handleError(_0x51d83e,null));};exports[_0xe095('0x43')]=function(_0x4f7b64,_0xc6752c){var _0x5a8033={'raw':!![],'where':{'id':_0x4f7b64['params']['id']}},_0x5c7cba={};_0x5c7cba[_0xe095('0x2f')]=_[_0xe095('0x31')](db[_0xe095('0x2b')][_0xe095('0x44')]);_0x5c7cba['query']=_[_0xe095('0x31')](_0x4f7b64[_0xe095('0x30')]);_0x5c7cba[_0xe095('0x32')]=_[_0xe095('0x33')](_0x5c7cba[_0xe095('0x2f')],_0x5c7cba['query']);_0x5a8033['attributes']=_[_0xe095('0x33')](_0x5c7cba['model'],qs[_0xe095('0x34')](_0x4f7b64['query']['fields']));_0x5a8033[_0xe095('0x35')]=_0x5a8033[_0xe095('0x35')][_0xe095('0x36')]?_0x5a8033[_0xe095('0x35')]:_0x5c7cba[_0xe095('0x2f')];if(_0x4f7b64[_0xe095('0x30')][_0xe095('0x40')]){_0x5a8033[_0xe095('0x41')]=[{'all':!![]}];}_0x5a8033=_[_0xe095('0x3d')]({},_0x5a8033,_0x4f7b64['options']);return db[_0xe095('0x2b')][_0xe095('0x45')](_0x5a8033)[_0xe095('0x24')](handleEntityNotFound(_0xc6752c,null))[_0xe095('0x24')](respondWithResult(_0xc6752c,null))[_0xe095('0x42')](handleError(_0xc6752c,null));};exports['create']=function(_0x316be9,_0xc04f33){return db['Dynamics365Field'][_0xe095('0x46')](_0x316be9[_0xe095('0x47')],{})[_0xe095('0x24')](respondWithResult(_0xc04f33,0xc9))[_0xe095('0x42')](handleError(_0xc04f33,null));};exports[_0xe095('0x48')]=function(_0x52637f,_0x4d409c){if(_0x52637f[_0xe095('0x47')]['id']){delete _0x52637f[_0xe095('0x47')]['id'];}return db[_0xe095('0x2b')][_0xe095('0x45')]({'where':{'id':_0x52637f['params']['id']}})[_0xe095('0x24')](handleEntityNotFound(_0x4d409c,null))['then'](saveUpdates(_0x52637f[_0xe095('0x47')],null))[_0xe095('0x24')](respondWithResult(_0x4d409c,null))[_0xe095('0x42')](handleError(_0x4d409c,null));};exports[_0xe095('0x25')]=function(_0x9804f9,_0x3aec77){return db[_0xe095('0x2b')][_0xe095('0x45')]({'where':{'id':_0x9804f9[_0xe095('0x49')]['id']}})[_0xe095('0x24')](handleEntityNotFound(_0x3aec77,null))[_0xe095('0x24')](removeEntity(_0x3aec77,null))[_0xe095('0x42')](handleError(_0x3aec77,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index a994aa8..b6fca24 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 _0xf1f5=['FieldId','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index','idField'];(function(_0x4bd67a,_0x4f9725){var _0x2be5fb=function(_0x33e132){while(--_0x33e132){_0x4bd67a['push'](_0x4bd67a['shift']());}};_0x2be5fb(++_0x4f9725);}(_0xf1f5,0x7f));var _0x5f1f=function(_0x258196,_0x235f4e){_0x258196=_0x258196-0x0;var _0x3df790=_0xf1f5[_0x258196];return _0x3df790;};'use strict';var _=require('lodash');var util=require(_0x5f1f('0x0'));var logger=require(_0x5f1f('0x1'))(_0x5f1f('0x2'));var moment=require(_0x5f1f('0x3'));var BPromise=require(_0x5f1f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5f1f('0x5'));var config=require(_0x5f1f('0x6'));var attributes=require(_0x5f1f('0x7'));module[_0x5f1f('0x8')]=function(_0x552dce,_0x26c10c){return _0x552dce[_0x5f1f('0x9')](_0x5f1f('0xa'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x5f1f('0xb'),'fields':[_0x5f1f('0xc'),_0x5f1f('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb252=['rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x328b1c,_0xec0b4f){var _0x4dbeaa=function(_0x432519){while(--_0x432519){_0x328b1c['push'](_0x328b1c['shift']());}};_0x4dbeaa(++_0xec0b4f);}(_0xb252,0x179));var _0x2b25=function(_0x1a82a0,_0x21b475){_0x1a82a0=_0x1a82a0-0x0;var _0x360a98=_0xb252[_0x1a82a0];return _0x360a98;};'use strict';var _=require(_0x2b25('0x0'));var util=require(_0x2b25('0x1'));var logger=require('../../config/logger')(_0x2b25('0x2'));var moment=require(_0x2b25('0x3'));var BPromise=require(_0x2b25('0x4'));var rp=require(_0x2b25('0x5'));var fs=require('fs');var path=require(_0x2b25('0x6'));var rimraf=require(_0x2b25('0x7'));var config=require(_0x2b25('0x8'));var attributes=require(_0x2b25('0x9'));module[_0x2b25('0xa')]=function(_0x19dfff,_0xf2cbdc){return _0x19dfff[_0x2b25('0xb')](_0x2b25('0xc'),attributes,{'tableName':_0x2b25('0xd'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x2b25('0xe'),_0x2b25('0xf')],'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 2d0561d..d3abb08 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 _0x669d=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x435539,_0x2a362b){var _0xeb2cf5=function(_0x3f1d03){while(--_0x3f1d03){_0x435539['push'](_0x435539['shift']());}};_0xeb2cf5(++_0x2a362b);}(_0x669d,0x95));var _0xd669=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x669d[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0xd669('0x0'));var util=require(_0xd669('0x1'));var moment=require(_0xd669('0x2'));var BPromise=require(_0xd669('0x3'));var rs=require(_0xd669('0x4'));var fs=require('fs');var Redis=require(_0xd669('0x5'));var db=require(_0xd669('0x6'))['db'];var utils=require(_0xd669('0x7'));var logger=require(_0xd669('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd669('0x9'));var client=jayson[_0xd669('0xa')][_0xd669('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x233b05,_0x222286,_0x6005d1){return new BPromise(function(_0x599633,_0x806979){return client[_0xd669('0xc')](_0x233b05,_0x6005d1)[_0xd669('0xd')](function(_0x19e864){logger[_0xd669('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x222286,'request\x20sent');logger[_0xd669('0xf')](_0xd669('0x10'),_0x222286,_0xd669('0x11'),JSON[_0xd669('0x12')](_0x19e864));if(_0x19e864['error']){if(_0x19e864[_0xd669('0x13')][_0xd669('0x14')]===0x1f4){logger[_0xd669('0x13')](_0xd669('0x15'),_0x222286,_0x19e864['error']['message']);return _0x806979(_0x19e864['error']['message']);}logger['error'](_0xd669('0x15'),_0x222286,_0x19e864[_0xd669('0x13')]['message']);return _0x599633(_0x19e864[_0xd669('0x13')][_0xd669('0x16')]);}else{logger[_0xd669('0xe')](_0xd669('0x15'),_0x222286,_0xd669('0x11'));_0x599633(_0x19e864[_0xd669('0x17')]['message']);}})[_0xd669('0x18')](function(_0xd095e6){logger[_0xd669('0x13')](_0xd669('0x15'),_0x222286,_0xd095e6);_0x806979(_0xd095e6);});});} \ No newline at end of file +var _0x2ab9=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s'];(function(_0x138f77,_0x2c68d7){var _0x19b2e2=function(_0x5d11cf){while(--_0x5d11cf){_0x138f77['push'](_0x138f77['shift']());}};_0x19b2e2(++_0x2c68d7);}(_0x2ab9,0x151));var _0x92ab=function(_0x4ae381,_0x13b070){_0x4ae381=_0x4ae381-0x0;var _0x5d8f6f=_0x2ab9[_0x4ae381];return _0x5d8f6f;};'use strict';var _=require(_0x92ab('0x0'));var util=require(_0x92ab('0x1'));var moment=require(_0x92ab('0x2'));var BPromise=require(_0x92ab('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x92ab('0x4'));var db=require(_0x92ab('0x5'))['db'];var utils=require(_0x92ab('0x6'));var logger=require(_0x92ab('0x7'))('rpc');var config=require(_0x92ab('0x8'));var jayson=require(_0x92ab('0x9'));var client=jayson['client'][_0x92ab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x742c1a,_0x2a8385,_0x466281){return new BPromise(function(_0x7a9201,_0x101120){return client['request'](_0x742c1a,_0x466281)[_0x92ab('0xb')](function(_0x4a8278){logger['info'](_0x92ab('0xc'),_0x2a8385,'request\x20sent');logger[_0x92ab('0xd')](_0x92ab('0xe'),_0x2a8385,_0x92ab('0xf'),JSON[_0x92ab('0x10')](_0x4a8278));if(_0x4a8278[_0x92ab('0x11')]){if(_0x4a8278[_0x92ab('0x11')][_0x92ab('0x12')]===0x1f4){logger[_0x92ab('0x11')](_0x92ab('0xc'),_0x2a8385,_0x4a8278[_0x92ab('0x11')][_0x92ab('0x13')]);return _0x101120(_0x4a8278['error'][_0x92ab('0x13')]);}logger[_0x92ab('0x11')](_0x92ab('0xc'),_0x2a8385,_0x4a8278[_0x92ab('0x11')]['message']);return _0x7a9201(_0x4a8278[_0x92ab('0x11')][_0x92ab('0x13')]);}else{logger['info'](_0x92ab('0xc'),_0x2a8385,_0x92ab('0xf'));_0x7a9201(_0x4a8278[_0x92ab('0x14')][_0x92ab('0x13')]);}})[_0x92ab('0x15')](function(_0xac3d01){logger[_0x92ab('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x2a8385,_0xac3d01);_0x101120(_0xac3d01);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 3802093..9858a48 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 _0xe89b=['get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xe89b,0xd3));var _0xbe89=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe89b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbe89('0x0'));var util=require(_0xbe89('0x1'));var path=require(_0xbe89('0x2'));var timeout=require(_0xbe89('0x3'));var express=require(_0xbe89('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbe89('0x5'));var interaction=require(_0xbe89('0x6'));var config=require(_0xbe89('0x7'));var controller=require(_0xbe89('0x8'));router[_0xbe89('0x9')]('/',auth['isAuthenticated'](),controller[_0xbe89('0xa')]);router[_0xbe89('0x9')](_0xbe89('0xb'),auth[_0xbe89('0xc')](),controller[_0xbe89('0xd')]);router[_0xbe89('0x9')](_0xbe89('0xe'),auth['isAuthenticated'](),controller[_0xbe89('0xf')]);router[_0xbe89('0x9')](_0xbe89('0x10'),auth[_0xbe89('0xc')](),controller[_0xbe89('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xbe89('0x12')](_0xbe89('0xe'),auth[_0xbe89('0xc')](),controller['addConfiguration']);router[_0xbe89('0x13')](_0xbe89('0xb'),auth[_0xbe89('0xc')](),controller['update']);router[_0xbe89('0x14')](_0xbe89('0xb'),auth[_0xbe89('0xc')](),controller['destroy']);module[_0xbe89('0x15')]=router; \ No newline at end of file +var _0x95a2=['../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','put','update','delete','destroy','exports','util','path','express','Router'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x95a2,0x176));var _0x295a=function(_0x217c2e,_0x358f06){_0x217c2e=_0x217c2e-0x0;var _0x22b7d8=_0x95a2[_0x217c2e];return _0x22b7d8;};'use strict';var multer=require('multer');var util=require(_0x295a('0x0'));var path=require(_0x295a('0x1'));var timeout=require('connect-timeout');var express=require(_0x295a('0x2'));var router=express[_0x295a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x295a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x295a('0x5'));var controller=require('./intFreshdeskAccount.controller');router[_0x295a('0x6')]('/',auth[_0x295a('0x7')](),controller['index']);router[_0x295a('0x6')](_0x295a('0x8'),auth['isAuthenticated'](),controller[_0x295a('0x9')]);router[_0x295a('0x6')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x295a('0xa')]);router[_0x295a('0x6')](_0x295a('0xb'),auth[_0x295a('0x7')](),controller[_0x295a('0xc')]);router['post']('/',auth[_0x295a('0x7')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x295a('0xd')]('/:id',auth[_0x295a('0x7')](),controller[_0x295a('0xe')]);router[_0x295a('0xf')](_0x295a('0x8'),auth[_0x295a('0x7')](),controller[_0x295a('0x10')]);module[_0x295a('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index e028095..4450ff8 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 _0x8f4c=['sequelize','exports','STRING','username','remoteUri'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8f4c,0x113));var _0xc8f4=function(_0xd73be6,_0x15e94d){_0xd73be6=_0xd73be6-0x0;var _0x155ad0=_0x8f4c[_0xd73be6];return _0x155ad0;};'use strict';var Sequelize=require(_0xc8f4('0x0'));module[_0xc8f4('0x1')]={'name':{'type':Sequelize[_0xc8f4('0x2')]},'description':{'type':Sequelize[_0xc8f4('0x2')]},'username':{'type':Sequelize[_0xc8f4('0x2')],'unique':_0xc8f4('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc8f4('0x2')],'unique':_0xc8f4('0x4')},'serverUrl':{'type':Sequelize[_0xc8f4('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x9536=['username','remoteUri','sequelize','exports','STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9536,0x179));var _0x6953=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x9536[_0x455c6c];return _0x488242;};'use strict';var Sequelize=require(_0x6953('0x0'));module[_0x6953('0x1')]={'name':{'type':Sequelize[_0x6953('0x2')]},'description':{'type':Sequelize[_0x6953('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x6953('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x6953('0x2')],'unique':_0x6953('0x4')},'serverUrl':{'type':Sequelize[_0x6953('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 4b9973d..7e41817 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 _0x4627=['findOne','FreshdeskConfiguration','fields','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','getFields','remoteUri','slice','substring','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','base64','requester','subject','agent','priority','group','source','ticket_type','company','remove','custom_dropdown','label','default','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','status','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','then','show','params','includeAll','include','catch','create','body','getConfigurations'];(function(_0x1bb6cb,_0x4df81d){var _0x2db3a3=function(_0x3be5a4){while(--_0x3be5a4){_0x1bb6cb['push'](_0x1bb6cb['shift']());}};_0x2db3a3(++_0x4df81d);}(_0x4627,0x115));var _0x7462=function(_0x2dbce7,_0x57cb8d){_0x2dbce7=_0x2dbce7-0x0;var _0x3a3ed0=_0x4627[_0x2dbce7];return _0x3a3ed0;};'use strict';var emlformat=require(_0x7462('0x0'));var rimraf=require(_0x7462('0x1'));var zipdir=require(_0x7462('0x2'));var jsonpatch=require(_0x7462('0x3'));var rp=require(_0x7462('0x4'));var moment=require(_0x7462('0x5'));var BPromise=require(_0x7462('0x6'));var Mustache=require(_0x7462('0x7'));var util=require(_0x7462('0x8'));var path=require(_0x7462('0x9'));var sox=require(_0x7462('0xa'));var csv=require(_0x7462('0xb'));var ejs=require(_0x7462('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7462('0xd'));var squel=require(_0x7462('0xe'));var crypto=require(_0x7462('0xf'));var jsforce=require(_0x7462('0x10'));var deskjs=require(_0x7462('0x11'));var toCsv=require(_0x7462('0xb'));var querystring=require(_0x7462('0x12'));var Papa=require(_0x7462('0x13'));var Redis=require(_0x7462('0x14'));var authService=require(_0x7462('0x15'));var qs=require(_0x7462('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7462('0x17'))(_0x7462('0x18'));var utils=require(_0x7462('0x19'));var config=require(_0x7462('0x1a'));var licenseUtil=require(_0x7462('0x1b'));var db=require(_0x7462('0x1c'))['db'];var integrations=require(_0x7462('0x1d'));function respondWithStatusCode(_0x4e313a,_0x5cb363){_0x5cb363=_0x5cb363||0xcc;return function(_0x4e6e42){if(_0x4e6e42){return _0x4e313a[_0x7462('0x1e')](_0x5cb363);}return _0x4e313a['status'](_0x5cb363)[_0x7462('0x1f')]();};}function respondWithResult(_0x461bd2,_0x368f45){_0x368f45=_0x368f45||0xc8;return function(_0x1ac398){if(_0x1ac398){return _0x461bd2['status'](_0x368f45)[_0x7462('0x20')](_0x1ac398);}};}function respondWithFilteredResult(_0x4913ff,_0x36b008){return function(_0x42ed50){if(_0x42ed50){var _0x1ebbe8=typeof _0x36b008[_0x7462('0x21')]==='undefined'&&typeof _0x36b008[_0x7462('0x22')]==='undefined';var _0x2f0201=_0x42ed50[_0x7462('0x23')];var _0xca0bdf=_0x1ebbe8?0x0:_0x36b008[_0x7462('0x21')];var _0x49378e=_0x1ebbe8?_0x42ed50[_0x7462('0x23')]:_0x36b008['offset']+_0x36b008[_0x7462('0x22')];var _0x3e5596;if(_0x49378e>=_0x2f0201){_0x49378e=_0x2f0201;_0x3e5596=0xc8;}else{_0x3e5596=0xce;}_0x4913ff['status'](_0x3e5596);return _0x4913ff[_0x7462('0x24')](_0x7462('0x25'),_0xca0bdf+'-'+_0x49378e+'/'+_0x2f0201)['json'](_0x42ed50);}return null;};}function patchUpdates(_0x25a44a){return function(_0x33c605){try{jsonpatch[_0x7462('0x26')](_0x33c605,_0x25a44a,!![]);}catch(_0xac7eae){return BPromise[_0x7462('0x27')](_0xac7eae);}return _0x33c605[_0x7462('0x28')]();};}function saveUpdates(_0x32da06,_0x3c9616){return function(_0x556c0a){if(_0x556c0a){return _0x556c0a[_0x7462('0x29')](_0x32da06)['then'](function(_0x185934){return _0x185934;});}return null;};}function removeEntity(_0x11caf5,_0x290715){return function(_0x51b9fc){if(_0x51b9fc){return _0x51b9fc[_0x7462('0x2a')]()['then'](function(){_0x11caf5[_0x7462('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5759fa,_0x29992b){return function(_0x3a6cab){if(!_0x3a6cab){_0x5759fa['sendStatus'](0x194);}return _0x3a6cab;};}function handleError(_0x5575fc,_0x554d21){_0x554d21=_0x554d21||0x1f4;return function(_0x488d59){logger['error'](_0x488d59[_0x7462('0x2c')]);if(_0x488d59[_0x7462('0x2d')]){delete _0x488d59['name'];}_0x5575fc[_0x7462('0x2b')](_0x554d21)[_0x7462('0x2e')](_0x488d59);};}exports[_0x7462('0x2f')]=function(_0x10a673,_0x4948c9){var _0x1f279b={},_0x3523c={},_0x30cb61={'count':0x0,'rows':[]};var _0x288736=_[_0x7462('0x30')](db[_0x7462('0x31')][_0x7462('0x32')],function(_0x77cf43){return{'name':_0x77cf43[_0x7462('0x33')],'type':_0x77cf43[_0x7462('0x34')]['key']};});_0x3523c[_0x7462('0x35')]=_['map'](_0x288736,_0x7462('0x2d'));_0x3523c[_0x7462('0x36')]=_[_0x7462('0x37')](_0x10a673[_0x7462('0x36')]);_0x3523c['filters']=_[_0x7462('0x38')](_0x3523c[_0x7462('0x35')],_0x3523c[_0x7462('0x36')]);_0x1f279b[_0x7462('0x39')]=_[_0x7462('0x38')](_0x3523c[_0x7462('0x35')],qs['fields'](_0x10a673[_0x7462('0x36')]['fields']));_0x1f279b[_0x7462('0x39')]=_0x1f279b['attributes'][_0x7462('0x3a')]?_0x1f279b[_0x7462('0x39')]:_0x3523c['model'];if(!_0x10a673[_0x7462('0x36')][_0x7462('0x3b')](_0x7462('0x3c'))){_0x1f279b[_0x7462('0x22')]=qs[_0x7462('0x22')](_0x10a673[_0x7462('0x36')][_0x7462('0x22')]);_0x1f279b[_0x7462('0x21')]=qs[_0x7462('0x21')](_0x10a673[_0x7462('0x36')][_0x7462('0x21')]);}_0x1f279b[_0x7462('0x3d')]=qs[_0x7462('0x3e')](_0x10a673[_0x7462('0x36')]['sort']);_0x1f279b[_0x7462('0x3f')]=qs[_0x7462('0x40')](_[_0x7462('0x41')](_0x10a673[_0x7462('0x36')],_0x3523c['filters']),_0x288736);if(_0x10a673[_0x7462('0x36')][_0x7462('0x42')]){_0x1f279b[_0x7462('0x3f')]=_[_0x7462('0x43')](_0x1f279b[_0x7462('0x3f')],{'$or':_[_0x7462('0x30')](_0x288736,function(_0x5c46c8){if(_0x5c46c8[_0x7462('0x34')]!==_0x7462('0x44')){var _0x2f50c1={};_0x2f50c1[_0x5c46c8[_0x7462('0x2d')]]={'$like':'%'+_0x10a673['query'][_0x7462('0x42')]+'%'};return _0x2f50c1;}})});}_0x1f279b=_[_0x7462('0x43')]({},_0x1f279b,_0x10a673[_0x7462('0x45')]);var _0x4ecd45={'where':_0x1f279b[_0x7462('0x3f')]};return db[_0x7462('0x31')][_0x7462('0x23')](_0x4ecd45)['then'](function(_0x1b4059){_0x30cb61['count']=_0x1b4059;if(_0x10a673[_0x7462('0x36')]['includeAll']){_0x1f279b['include']=[{'all':!![]}];}return db['FreshdeskAccount'][_0x7462('0x46')](_0x1f279b);})[_0x7462('0x47')](function(_0x2317eb){_0x30cb61['rows']=_0x2317eb;return _0x30cb61;})['then'](respondWithFilteredResult(_0x4948c9,_0x1f279b))['catch'](handleError(_0x4948c9,null));};exports[_0x7462('0x48')]=function(_0x8aa7cd,_0x57e0ae){var _0x5e50c7={'raw':![],'where':{'id':_0x8aa7cd[_0x7462('0x49')]['id']}},_0x20c576={};_0x20c576[_0x7462('0x35')]=_[_0x7462('0x37')](db['FreshdeskAccount']['rawAttributes']);_0x20c576[_0x7462('0x36')]=_[_0x7462('0x37')](_0x8aa7cd[_0x7462('0x36')]);_0x20c576[_0x7462('0x40')]=_['intersection'](_0x20c576[_0x7462('0x35')],_0x20c576[_0x7462('0x36')]);_0x5e50c7[_0x7462('0x39')]=_['intersection'](_0x20c576[_0x7462('0x35')],qs['fields'](_0x8aa7cd[_0x7462('0x36')]['fields']));_0x5e50c7['attributes']=_0x5e50c7[_0x7462('0x39')][_0x7462('0x3a')]?_0x5e50c7[_0x7462('0x39')]:_0x20c576[_0x7462('0x35')];if(_0x8aa7cd[_0x7462('0x36')][_0x7462('0x4a')]){_0x5e50c7[_0x7462('0x4b')]=[{'all':!![]}];}_0x5e50c7=_[_0x7462('0x43')]({},_0x5e50c7,_0x8aa7cd[_0x7462('0x45')]);return db['FreshdeskAccount']['find'](_0x5e50c7)[_0x7462('0x47')](handleEntityNotFound(_0x57e0ae,null))['then'](respondWithResult(_0x57e0ae,null))[_0x7462('0x4c')](handleError(_0x57e0ae,null));};exports['create']=function(_0x331459,_0x2cec83){return db[_0x7462('0x31')][_0x7462('0x4d')](_0x331459[_0x7462('0x4e')],{})['then'](respondWithResult(_0x2cec83,0xc9))['catch'](handleError(_0x2cec83,null));};exports[_0x7462('0x29')]=function(_0x37fc97,_0x354e81){if(_0x37fc97[_0x7462('0x4e')]['id']){delete _0x37fc97[_0x7462('0x4e')]['id'];}return db[_0x7462('0x31')]['find']({'where':{'id':_0x37fc97[_0x7462('0x49')]['id']}})[_0x7462('0x47')](handleEntityNotFound(_0x354e81,null))[_0x7462('0x47')](saveUpdates(_0x37fc97[_0x7462('0x4e')],null))['then'](respondWithResult(_0x354e81,null))[_0x7462('0x4c')](handleError(_0x354e81,null));};exports[_0x7462('0x2a')]=function(_0x4429da,_0x4a631e){return db[_0x7462('0x31')]['find']({'where':{'id':_0x4429da[_0x7462('0x49')]['id']}})[_0x7462('0x47')](handleEntityNotFound(_0x4a631e,null))['then'](removeEntity(_0x4a631e,null))['catch'](handleError(_0x4a631e,null));};exports[_0x7462('0x4f')]=function(_0x3c82fa,_0x3da9ce,_0x3aa514){var _0x664d7a={};var _0x5cd5cc={};var _0x45447b;var _0x5862a9;return db[_0x7462('0x31')][_0x7462('0x50')]({'where':{'id':_0x3c82fa[_0x7462('0x49')]['id']}})[_0x7462('0x47')](handleEntityNotFound(_0x3da9ce,null))[_0x7462('0x47')](function(_0x76d533){if(_0x76d533){_0x45447b=_0x76d533;_0x5cd5cc[_0x7462('0x35')]=_[_0x7462('0x37')](db[_0x7462('0x51')][_0x7462('0x32')]);_0x5cd5cc['query']=_[_0x7462('0x37')](_0x3c82fa[_0x7462('0x36')]);_0x5cd5cc[_0x7462('0x40')]=_[_0x7462('0x38')](_0x5cd5cc['model'],_0x5cd5cc[_0x7462('0x36')]);_0x664d7a[_0x7462('0x39')]=_[_0x7462('0x38')](_0x5cd5cc[_0x7462('0x35')],qs['fields'](_0x3c82fa[_0x7462('0x36')][_0x7462('0x52')]));_0x664d7a[_0x7462('0x39')]=_0x664d7a[_0x7462('0x39')][_0x7462('0x3a')]?_0x664d7a[_0x7462('0x39')]:_0x5cd5cc[_0x7462('0x35')];_0x664d7a['order']=qs[_0x7462('0x3e')](_0x3c82fa[_0x7462('0x36')]['sort']);_0x664d7a[_0x7462('0x3f')]=qs[_0x7462('0x40')](_[_0x7462('0x41')](_0x3c82fa[_0x7462('0x36')],_0x5cd5cc['filters']));if(_0x3c82fa['query'][_0x7462('0x42')]){_0x664d7a[_0x7462('0x3f')]=_[_0x7462('0x43')](_0x664d7a['where'],{'$or':_[_0x7462('0x30')](_0x664d7a[_0x7462('0x39')],function(_0x2cca57){var _0x30e5e6={};_0x30e5e6[_0x2cca57]={'$like':'%'+_0x3c82fa['query'][_0x7462('0x42')]+'%'};return _0x30e5e6;})});}_0x664d7a=_[_0x7462('0x43')]({},_0x664d7a,_0x3c82fa[_0x7462('0x45')]);return _0x45447b['getConfigurations'](_0x664d7a);}})[_0x7462('0x47')](function(_0x27240d){if(_0x27240d){_0x5862a9=_0x27240d[_0x7462('0x3a')];if(!_0x3c82fa[_0x7462('0x36')]['hasOwnProperty'](_0x7462('0x3c'))){_0x664d7a['limit']=qs[_0x7462('0x22')](_0x3c82fa[_0x7462('0x36')]['limit']);_0x664d7a[_0x7462('0x21')]=qs['offset'](_0x3c82fa[_0x7462('0x36')][_0x7462('0x21')]);}return _0x45447b['getConfigurations'](_0x664d7a);}})[_0x7462('0x47')](function(_0x97d91a){if(_0x97d91a){return _0x97d91a?{'count':_0x5862a9,'rows':_0x97d91a}:null;}})[_0x7462('0x47')](respondWithResult(_0x3da9ce,null))[_0x7462('0x4c')](handleError(_0x3da9ce,null));};exports[_0x7462('0x53')]=function(_0x4b4215,_0x2828e9,_0x4c30f0){if(_0x4b4215[_0x7462('0x4e')]['id']){delete _0x4b4215[_0x7462('0x4e')]['id'];}return db[_0x7462('0x31')][_0x7462('0x50')]({'where':{'id':_0x4b4215[_0x7462('0x49')]['id']}})[_0x7462('0x47')](handleEntityNotFound(_0x2828e9,null))[_0x7462('0x47')](function(_0xcb38cd){if(_0xcb38cd){_0x4b4215['body'][_0x7462('0x54')]=_0xcb38cd['id'];_0x4b4215['body'][_0x7462('0x55')]=integrations['getSubjects'](_0x4b4215[_0x7462('0x4e')][_0x7462('0x56')],_0x4b4215[_0x7462('0x4e')][_0x7462('0x34')]);_0x4b4215[_0x7462('0x4e')][_0x7462('0x57')]=integrations[_0x7462('0x58')](_0x4b4215['body'][_0x7462('0x56')],_0x4b4215['body'][_0x7462('0x34')]);return db[_0x7462('0x51')][_0x7462('0x4d')](_0x4b4215[_0x7462('0x4e')],{'include':[{'model':db['FreshdeskField'],'as':_0x7462('0x55')},{'model':db['FreshdeskField'],'as':_0x7462('0x57')}]});}return null;})[_0x7462('0x47')](respondWithResult(_0x2828e9,null))['catch'](handleError(_0x2828e9,null));};exports[_0x7462('0x59')]=function(_0x5bd7fa,_0x47c3a8,_0x5ea90d){var _0x576371='';return db[_0x7462('0x31')]['findOne']({'where':{'id':_0x5bd7fa[_0x7462('0x49')]['id']},'attributes':['id',_0x7462('0x5a'),'apiKey']})['then'](handleEntityNotFound(_0x47c3a8,null))[_0x7462('0x47')](function(_0x76819e){if(_0x76819e){_0x576371=_0x76819e[_0x7462('0x5a')];var _0x4dcebf=_0x576371[_0x7462('0x5b')](-0x1);if(_0x4dcebf==='/'){_0x576371=_0x576371[_0x7462('0x5c')](0x0,_0x576371['lastIndexOf'](_0x4dcebf));}return rp({'method':_0x7462('0x5d'),'uri':util[_0x7462('0x5e')](_0x7462('0x5f'),_0x576371,_0x7462('0x60')),'headers':{'Authorization':util[_0x7462('0x5e')](_0x7462('0x61'),new Buffer(util[_0x7462('0x5e')](_0x7462('0x62'),_0x76819e[_0x7462('0x63')]))[_0x7462('0x64')](_0x7462('0x65')))},'json':!![]});}})[_0x7462('0x47')](function(_0x4671fe){if(_0x4671fe){var _0x2dc1d1=[_0x7462('0x66'),_0x7462('0x67'),_0x7462('0x68'),'description','status',_0x7462('0x69'),_0x7462('0x6a'),_0x7462('0x6b'),_0x7462('0x6c'),'group',_0x7462('0x6d')];_[_0x7462('0x6e')](_0x4671fe,function(_0x8b26d0){return _0x2dc1d1['includes'](_0x8b26d0[_0x7462('0x2d')])||!_0x8b26d0['default']&&_0x8b26d0[_0x7462('0x34')]!=='custom_text'&&_0x8b26d0[_0x7462('0x34')]!==_0x7462('0x6f');});return{'count':_0x4671fe[_0x7462('0x3a')],'rows':_[_0x7462('0x30')](_0x4671fe,function(_0x16581c){return{'id':_0x16581c[_0x7462('0x2d')],'name':_0x16581c[_0x7462('0x70')],'custom':!_0x16581c[_0x7462('0x71')],'options':_0x16581c[_0x7462('0x72')]?_['map'](_0x16581c[_0x7462('0x72')],function(_0x7d68e8){return{'name':_['capitalize'](_0x7d68e8),'value':_0x7d68e8};}):[]};})};}})[_0x7462('0x47')](respondWithResult(_0x47c3a8,null))[_0x7462('0x4c')](function(_0x3d2a1a){var _0x310b56=_0x5bd7fa[_0x7462('0x36')][_0x7462('0x73')]?0x1f4:_0x3d2a1a[_0x7462('0x74')]||0x1f4;logger['error'](_0x7462('0x75'),_0x7462('0x59'),_0x310b56,JSON['stringify'](_0x3d2a1a));delete _0x3d2a1a[_0x7462('0x2d')];if(_0x310b56===0x191){_0x310b56=0x190;}_0x47c3a8[_0x7462('0x2b')](_0x310b56)[_0x7462('0x2e')](_0x5bd7fa[_0x7462('0x36')][_0x7462('0x73')]?{'message':_0x7462('0x76'),'statusCode':_0x3d2a1a[_0x7462('0x74')]}:_0x3d2a1a);});}; \ No newline at end of file +var _0xb58b=['merge','includeAll','include','findAll','show','params','options','find','catch','create','update','body','getConfigurations','FreshdeskConfiguration','addConfiguration','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','findOne','remoteUri','slice','substring','lastIndexOf','format','Basic\x20%s','apiKey','toString','base64','agent','description','source','ticket_type','group','company','remove','includes','default','custom_text','label','choices','capitalize','test','statusCode','getFields','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xb58b,0x1f1));var _0xbb58=function(_0xa1b5fe,_0x348277){_0xa1b5fe=_0xa1b5fe-0x0;var _0x3637cb=_0xb58b[_0xa1b5fe];return _0x3637cb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb58('0x0'));var zipdir=require(_0xbb58('0x1'));var jsonpatch=require(_0xbb58('0x2'));var rp=require('request-promise');var moment=require(_0xbb58('0x3'));var BPromise=require(_0xbb58('0x4'));var Mustache=require('mustache');var util=require(_0xbb58('0x5'));var path=require('path');var sox=require(_0xbb58('0x6'));var csv=require(_0xbb58('0x7'));var ejs=require(_0xbb58('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb58('0x9'));var squel=require(_0xbb58('0xa'));var crypto=require(_0xbb58('0xb'));var jsforce=require(_0xbb58('0xc'));var deskjs=require(_0xbb58('0xd'));var toCsv=require(_0xbb58('0x7'));var querystring=require(_0xbb58('0xe'));var Papa=require(_0xbb58('0xf'));var Redis=require(_0xbb58('0x10'));var authService=require(_0xbb58('0x11'));var qs=require(_0xbb58('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb58('0x13'));var logger=require('../../config/logger')(_0xbb58('0x14'));var utils=require(_0xbb58('0x15'));var config=require(_0xbb58('0x16'));var licenseUtil=require(_0xbb58('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xbb58('0x18'));function respondWithStatusCode(_0x18810f,_0x4cda21){_0x4cda21=_0x4cda21||0xcc;return function(_0x132511){if(_0x132511){return _0x18810f[_0xbb58('0x19')](_0x4cda21);}return _0x18810f[_0xbb58('0x1a')](_0x4cda21)[_0xbb58('0x1b')]();};}function respondWithResult(_0x19ceda,_0x58245f){_0x58245f=_0x58245f||0xc8;return function(_0x110944){if(_0x110944){return _0x19ceda[_0xbb58('0x1a')](_0x58245f)['json'](_0x110944);}};}function respondWithFilteredResult(_0x4ba30e,_0x33c20f){return function(_0x445b1f){if(_0x445b1f){var _0x38d69a=typeof _0x33c20f['offset']==='undefined'&&typeof _0x33c20f['limit']==='undefined';var _0x28637b=_0x445b1f[_0xbb58('0x1c')];var _0x48f3e0=_0x38d69a?0x0:_0x33c20f[_0xbb58('0x1d')];var _0x497653=_0x38d69a?_0x445b1f[_0xbb58('0x1c')]:_0x33c20f[_0xbb58('0x1d')]+_0x33c20f[_0xbb58('0x1e')];var _0xb8f982;if(_0x497653>=_0x28637b){_0x497653=_0x28637b;_0xb8f982=0xc8;}else{_0xb8f982=0xce;}_0x4ba30e[_0xbb58('0x1a')](_0xb8f982);return _0x4ba30e[_0xbb58('0x1f')](_0xbb58('0x20'),_0x48f3e0+'-'+_0x497653+'/'+_0x28637b)['json'](_0x445b1f);}return null;};}function patchUpdates(_0x84f34){return function(_0x2d8c0f){try{jsonpatch[_0xbb58('0x21')](_0x2d8c0f,_0x84f34,!![]);}catch(_0x3b4dc6){return BPromise[_0xbb58('0x22')](_0x3b4dc6);}return _0x2d8c0f[_0xbb58('0x23')]();};}function saveUpdates(_0x49453a,_0x350be7){return function(_0x27bbec){if(_0x27bbec){return _0x27bbec['update'](_0x49453a)[_0xbb58('0x24')](function(_0x53b693){return _0x53b693;});}return null;};}function removeEntity(_0x21964d,_0x287822){return function(_0x152f22){if(_0x152f22){return _0x152f22[_0xbb58('0x25')]()[_0xbb58('0x24')](function(){_0x21964d[_0xbb58('0x1a')](0xcc)[_0xbb58('0x1b')]();});}};}function handleEntityNotFound(_0x15e4c5,_0x4e0303){return function(_0x283dff){if(!_0x283dff){_0x15e4c5[_0xbb58('0x19')](0x194);}return _0x283dff;};}function handleError(_0x1be0ae,_0x129094){_0x129094=_0x129094||0x1f4;return function(_0x8e9ed9){logger[_0xbb58('0x26')](_0x8e9ed9[_0xbb58('0x27')]);if(_0x8e9ed9[_0xbb58('0x28')]){delete _0x8e9ed9[_0xbb58('0x28')];}_0x1be0ae[_0xbb58('0x1a')](_0x129094)[_0xbb58('0x29')](_0x8e9ed9);};}exports[_0xbb58('0x2a')]=function(_0x2a0481,_0x4157c4){var _0x3559b6={},_0x573cca={},_0x2b0f73={'count':0x0,'rows':[]};var _0xe46bc1=_[_0xbb58('0x2b')](db[_0xbb58('0x2c')][_0xbb58('0x2d')],function(_0x9d379f){return{'name':_0x9d379f[_0xbb58('0x2e')],'type':_0x9d379f[_0xbb58('0x2f')][_0xbb58('0x30')]};});_0x573cca['model']=_[_0xbb58('0x2b')](_0xe46bc1,_0xbb58('0x28'));_0x573cca[_0xbb58('0x31')]=_[_0xbb58('0x32')](_0x2a0481[_0xbb58('0x31')]);_0x573cca[_0xbb58('0x33')]=_[_0xbb58('0x34')](_0x573cca[_0xbb58('0x35')],_0x573cca[_0xbb58('0x31')]);_0x3559b6[_0xbb58('0x36')]=_[_0xbb58('0x34')](_0x573cca[_0xbb58('0x35')],qs[_0xbb58('0x37')](_0x2a0481['query']['fields']));_0x3559b6['attributes']=_0x3559b6[_0xbb58('0x36')][_0xbb58('0x38')]?_0x3559b6[_0xbb58('0x36')]:_0x573cca[_0xbb58('0x35')];if(!_0x2a0481[_0xbb58('0x31')][_0xbb58('0x39')](_0xbb58('0x3a'))){_0x3559b6[_0xbb58('0x1e')]=qs['limit'](_0x2a0481[_0xbb58('0x31')][_0xbb58('0x1e')]);_0x3559b6['offset']=qs[_0xbb58('0x1d')](_0x2a0481['query'][_0xbb58('0x1d')]);}_0x3559b6['order']=qs[_0xbb58('0x3b')](_0x2a0481[_0xbb58('0x31')]['sort']);_0x3559b6[_0xbb58('0x3c')]=qs[_0xbb58('0x33')](_[_0xbb58('0x3d')](_0x2a0481[_0xbb58('0x31')],_0x573cca[_0xbb58('0x33')]),_0xe46bc1);if(_0x2a0481[_0xbb58('0x31')][_0xbb58('0x3e')]){_0x3559b6[_0xbb58('0x3c')]=_['merge'](_0x3559b6[_0xbb58('0x3c')],{'$or':_[_0xbb58('0x2b')](_0xe46bc1,function(_0x2da5ff){if(_0x2da5ff['type']!=='VIRTUAL'){var _0x133d56={};_0x133d56[_0x2da5ff['name']]={'$like':'%'+_0x2a0481[_0xbb58('0x31')][_0xbb58('0x3e')]+'%'};return _0x133d56;}})});}_0x3559b6=_[_0xbb58('0x3f')]({},_0x3559b6,_0x2a0481['options']);var _0x485830={'where':_0x3559b6[_0xbb58('0x3c')]};return db[_0xbb58('0x2c')][_0xbb58('0x1c')](_0x485830)[_0xbb58('0x24')](function(_0x34a745){_0x2b0f73[_0xbb58('0x1c')]=_0x34a745;if(_0x2a0481['query'][_0xbb58('0x40')]){_0x3559b6[_0xbb58('0x41')]=[{'all':!![]}];}return db[_0xbb58('0x2c')][_0xbb58('0x42')](_0x3559b6);})[_0xbb58('0x24')](function(_0x301e15){_0x2b0f73['rows']=_0x301e15;return _0x2b0f73;})[_0xbb58('0x24')](respondWithFilteredResult(_0x4157c4,_0x3559b6))['catch'](handleError(_0x4157c4,null));};exports[_0xbb58('0x43')]=function(_0x285ad4,_0x29fb1c){var _0x45817f={'raw':![],'where':{'id':_0x285ad4[_0xbb58('0x44')]['id']}},_0x54099f={};_0x54099f[_0xbb58('0x35')]=_[_0xbb58('0x32')](db[_0xbb58('0x2c')]['rawAttributes']);_0x54099f[_0xbb58('0x31')]=_['keys'](_0x285ad4[_0xbb58('0x31')]);_0x54099f[_0xbb58('0x33')]=_[_0xbb58('0x34')](_0x54099f[_0xbb58('0x35')],_0x54099f[_0xbb58('0x31')]);_0x45817f[_0xbb58('0x36')]=_[_0xbb58('0x34')](_0x54099f[_0xbb58('0x35')],qs[_0xbb58('0x37')](_0x285ad4[_0xbb58('0x31')][_0xbb58('0x37')]));_0x45817f[_0xbb58('0x36')]=_0x45817f[_0xbb58('0x36')]['length']?_0x45817f[_0xbb58('0x36')]:_0x54099f['model'];if(_0x285ad4['query'][_0xbb58('0x40')]){_0x45817f[_0xbb58('0x41')]=[{'all':!![]}];}_0x45817f=_[_0xbb58('0x3f')]({},_0x45817f,_0x285ad4[_0xbb58('0x45')]);return db[_0xbb58('0x2c')][_0xbb58('0x46')](_0x45817f)[_0xbb58('0x24')](handleEntityNotFound(_0x29fb1c,null))[_0xbb58('0x24')](respondWithResult(_0x29fb1c,null))[_0xbb58('0x47')](handleError(_0x29fb1c,null));};exports[_0xbb58('0x48')]=function(_0x440fb3,_0x59a8cf){return db[_0xbb58('0x2c')][_0xbb58('0x48')](_0x440fb3['body'],{})[_0xbb58('0x24')](respondWithResult(_0x59a8cf,0xc9))[_0xbb58('0x47')](handleError(_0x59a8cf,null));};exports[_0xbb58('0x49')]=function(_0xdb0ff7,_0x5de68e){if(_0xdb0ff7[_0xbb58('0x4a')]['id']){delete _0xdb0ff7['body']['id'];}return db[_0xbb58('0x2c')][_0xbb58('0x46')]({'where':{'id':_0xdb0ff7[_0xbb58('0x44')]['id']}})['then'](handleEntityNotFound(_0x5de68e,null))[_0xbb58('0x24')](saveUpdates(_0xdb0ff7[_0xbb58('0x4a')],null))['then'](respondWithResult(_0x5de68e,null))[_0xbb58('0x47')](handleError(_0x5de68e,null));};exports['destroy']=function(_0x28301d,_0x2d81e0){return db[_0xbb58('0x2c')][_0xbb58('0x46')]({'where':{'id':_0x28301d[_0xbb58('0x44')]['id']}})[_0xbb58('0x24')](handleEntityNotFound(_0x2d81e0,null))[_0xbb58('0x24')](removeEntity(_0x2d81e0,null))['catch'](handleError(_0x2d81e0,null));};exports[_0xbb58('0x4b')]=function(_0x1fd892,_0x592da8,_0x3efbc6){var _0x98157={};var _0x5c19b7={};var _0x22802c;var _0x44636b;return db[_0xbb58('0x2c')]['findOne']({'where':{'id':_0x1fd892[_0xbb58('0x44')]['id']}})[_0xbb58('0x24')](handleEntityNotFound(_0x592da8,null))[_0xbb58('0x24')](function(_0x592879){if(_0x592879){_0x22802c=_0x592879;_0x5c19b7[_0xbb58('0x35')]=_['keys'](db[_0xbb58('0x4c')][_0xbb58('0x2d')]);_0x5c19b7[_0xbb58('0x31')]=_['keys'](_0x1fd892['query']);_0x5c19b7[_0xbb58('0x33')]=_[_0xbb58('0x34')](_0x5c19b7[_0xbb58('0x35')],_0x5c19b7[_0xbb58('0x31')]);_0x98157[_0xbb58('0x36')]=_['intersection'](_0x5c19b7[_0xbb58('0x35')],qs[_0xbb58('0x37')](_0x1fd892[_0xbb58('0x31')]['fields']));_0x98157[_0xbb58('0x36')]=_0x98157[_0xbb58('0x36')][_0xbb58('0x38')]?_0x98157[_0xbb58('0x36')]:_0x5c19b7[_0xbb58('0x35')];_0x98157['order']=qs[_0xbb58('0x3b')](_0x1fd892[_0xbb58('0x31')][_0xbb58('0x3b')]);_0x98157[_0xbb58('0x3c')]=qs[_0xbb58('0x33')](_[_0xbb58('0x3d')](_0x1fd892[_0xbb58('0x31')],_0x5c19b7[_0xbb58('0x33')]));if(_0x1fd892['query'][_0xbb58('0x3e')]){_0x98157['where']=_[_0xbb58('0x3f')](_0x98157[_0xbb58('0x3c')],{'$or':_[_0xbb58('0x2b')](_0x98157[_0xbb58('0x36')],function(_0x3d6fba){var _0x1dbbd9={};_0x1dbbd9[_0x3d6fba]={'$like':'%'+_0x1fd892[_0xbb58('0x31')][_0xbb58('0x3e')]+'%'};return _0x1dbbd9;})});}_0x98157=_[_0xbb58('0x3f')]({},_0x98157,_0x1fd892[_0xbb58('0x45')]);return _0x22802c[_0xbb58('0x4b')](_0x98157);}})['then'](function(_0x3933f0){if(_0x3933f0){_0x44636b=_0x3933f0[_0xbb58('0x38')];if(!_0x1fd892[_0xbb58('0x31')]['hasOwnProperty'](_0xbb58('0x3a'))){_0x98157['limit']=qs[_0xbb58('0x1e')](_0x1fd892[_0xbb58('0x31')]['limit']);_0x98157[_0xbb58('0x1d')]=qs[_0xbb58('0x1d')](_0x1fd892[_0xbb58('0x31')][_0xbb58('0x1d')]);}return _0x22802c[_0xbb58('0x4b')](_0x98157);}})['then'](function(_0x54bf2e){if(_0x54bf2e){return _0x54bf2e?{'count':_0x44636b,'rows':_0x54bf2e}:null;}})[_0xbb58('0x24')](respondWithResult(_0x592da8,null))[_0xbb58('0x47')](handleError(_0x592da8,null));};exports[_0xbb58('0x4d')]=function(_0x4bbccf,_0x11d41e,_0x419215){if(_0x4bbccf['body']['id']){delete _0x4bbccf[_0xbb58('0x4a')]['id'];}return db[_0xbb58('0x2c')]['findOne']({'where':{'id':_0x4bbccf[_0xbb58('0x44')]['id']}})[_0xbb58('0x24')](handleEntityNotFound(_0x11d41e,null))[_0xbb58('0x24')](function(_0x3c932e){if(_0x3c932e){_0x4bbccf[_0xbb58('0x4a')]['AccountId']=_0x3c932e['id'];_0x4bbccf[_0xbb58('0x4a')][_0xbb58('0x4e')]=integrations[_0xbb58('0x4f')](_0x4bbccf[_0xbb58('0x4a')][_0xbb58('0x50')],_0x4bbccf['body']['type']);_0x4bbccf[_0xbb58('0x4a')]['Descriptions']=integrations[_0xbb58('0x51')](_0x4bbccf[_0xbb58('0x4a')][_0xbb58('0x50')],_0x4bbccf[_0xbb58('0x4a')][_0xbb58('0x2f')]);return db[_0xbb58('0x4c')][_0xbb58('0x48')](_0x4bbccf[_0xbb58('0x4a')],{'include':[{'model':db[_0xbb58('0x52')],'as':_0xbb58('0x4e')},{'model':db['FreshdeskField'],'as':_0xbb58('0x53')}]});}return null;})[_0xbb58('0x24')](respondWithResult(_0x11d41e,null))[_0xbb58('0x47')](handleError(_0x11d41e,null));};exports['getFields']=function(_0x50bf24,_0x4bdc30,_0x5e9319){var _0x1e315e='';return db[_0xbb58('0x2c')][_0xbb58('0x54')]({'where':{'id':_0x50bf24[_0xbb58('0x44')]['id']},'attributes':['id','remoteUri','apiKey']})[_0xbb58('0x24')](handleEntityNotFound(_0x4bdc30,null))[_0xbb58('0x24')](function(_0x4d2091){if(_0x4d2091){_0x1e315e=_0x4d2091[_0xbb58('0x55')];var _0x2ba4a9=_0x1e315e[_0xbb58('0x56')](-0x1);if(_0x2ba4a9==='/'){_0x1e315e=_0x1e315e[_0xbb58('0x57')](0x0,_0x1e315e[_0xbb58('0x58')](_0x2ba4a9));}return rp({'method':'GET','uri':util[_0xbb58('0x59')]('%s/%s',_0x1e315e,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xbb58('0x59')](_0xbb58('0x5a'),new Buffer(util[_0xbb58('0x59')]('%s:X',_0x4d2091[_0xbb58('0x5b')]))[_0xbb58('0x5c')](_0xbb58('0x5d')))},'json':!![]});}})[_0xbb58('0x24')](function(_0x5bdbf1){if(_0x5bdbf1){var _0x18cbb0=['requester','subject',_0xbb58('0x5e'),_0xbb58('0x5f'),_0xbb58('0x1a'),'priority','group',_0xbb58('0x60'),_0xbb58('0x61'),_0xbb58('0x62'),_0xbb58('0x63')];_[_0xbb58('0x64')](_0x5bdbf1,function(_0x39b402){return _0x18cbb0[_0xbb58('0x65')](_0x39b402[_0xbb58('0x28')])||!_0x39b402[_0xbb58('0x66')]&&_0x39b402[_0xbb58('0x2f')]!==_0xbb58('0x67')&&_0x39b402['type']!=='custom_dropdown';});return{'count':_0x5bdbf1[_0xbb58('0x38')],'rows':_[_0xbb58('0x2b')](_0x5bdbf1,function(_0xc6ddb0){return{'id':_0xc6ddb0['name'],'name':_0xc6ddb0[_0xbb58('0x68')],'custom':!_0xc6ddb0[_0xbb58('0x66')],'options':_0xc6ddb0[_0xbb58('0x69')]?_['map'](_0xc6ddb0[_0xbb58('0x69')],function(_0x599926){return{'name':_[_0xbb58('0x6a')](_0x599926),'value':_0x599926};}):[]};})};}})['then'](respondWithResult(_0x4bdc30,null))[_0xbb58('0x47')](function(_0x35dc6e){var _0xaf9d6=_0x50bf24[_0xbb58('0x31')][_0xbb58('0x6b')]?0x1f4:_0x35dc6e[_0xbb58('0x6c')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xbb58('0x6d'),_0xaf9d6,JSON[_0xbb58('0x6e')](_0x35dc6e));delete _0x35dc6e['name'];if(_0xaf9d6===0x191){_0xaf9d6=0x190;}_0x4bdc30[_0xbb58('0x1a')](_0xaf9d6)[_0xbb58('0x29')](_0x50bf24[_0xbb58('0x31')]['test']?{'message':_0xbb58('0x6f'),'statusCode':_0x35dc6e['statusCode']}:_0x35dc6e);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index bacd600..c2ccfc8 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 _0x2646=['define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x48d6a3,_0x37c848){var _0x38bfa0=function(_0x3fba2e){while(--_0x3fba2e){_0x48d6a3['push'](_0x48d6a3['shift']());}};_0x38bfa0(++_0x37c848);}(_0x2646,0xa8));var _0x6264=function(_0x4b6643,_0x9e4308){_0x4b6643=_0x4b6643-0x0;var _0x3dc376=_0x2646[_0x4b6643];return _0x3dc376;};'use strict';var _=require(_0x6264('0x0'));var util=require(_0x6264('0x1'));var logger=require(_0x6264('0x2'))(_0x6264('0x3'));var moment=require(_0x6264('0x4'));var BPromise=require('bluebird');var rp=require(_0x6264('0x5'));var fs=require('fs');var path=require(_0x6264('0x6'));var rimraf=require(_0x6264('0x7'));var config=require(_0x6264('0x8'));var attributes=require(_0x6264('0x9'));var integrations=require(_0x6264('0xa'));module[_0x6264('0xb')]=function(_0x3238dd,_0x1194db){return _0x3238dd[_0x6264('0xc')](_0x6264('0xd'),attributes,{'tableName':_0x6264('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95ab=['FreshdeskAccount','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports'];(function(_0x5b8189,_0x463943){var _0x35e754=function(_0x4c1812){while(--_0x4c1812){_0x5b8189['push'](_0x5b8189['shift']());}};_0x35e754(++_0x463943);}(_0x95ab,0xc7));var _0xb95a=function(_0x442d2f,_0x604159){_0x442d2f=_0x442d2f-0x0;var _0x4e6a34=_0x95ab[_0x442d2f];return _0x4e6a34;};'use strict';var _=require(_0xb95a('0x0'));var util=require(_0xb95a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb95a('0x2'));var BPromise=require(_0xb95a('0x3'));var rp=require(_0xb95a('0x4'));var fs=require('fs');var path=require(_0xb95a('0x5'));var rimraf=require(_0xb95a('0x6'));var config=require(_0xb95a('0x7'));var attributes=require(_0xb95a('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xb95a('0x9')]=function(_0x5ca6bd,_0x4e6320){return _0x5ca6bd['define'](_0xb95a('0xa'),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 a90ed1f..253dca7 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 _0xadd2=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','options','raw','where','attributes','limit','map','include','model','GetFreshdeskAccount','stringify','FreshdeskAccount','find','ShowFreshdeskAccount','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x518444,_0x1a2ddf){var _0x174e8d=function(_0x2af62d){while(--_0x2af62d){_0x518444['push'](_0x518444['shift']());}};_0x174e8d(++_0x1a2ddf);}(_0xadd2,0xa5));var _0x2add=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xadd2[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2add('0x0'));var BPromise=require('bluebird');var rs=require(_0x2add('0x1'));var fs=require('fs');var Redis=require(_0x2add('0x2'));var db=require(_0x2add('0x3'))['db'];var utils=require(_0x2add('0x4'));var logger=require(_0x2add('0x5'))(_0x2add('0x6'));var config=require(_0x2add('0x7'));var jayson=require(_0x2add('0x8'));var client=jayson[_0x2add('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48fb55,_0x447b6d,_0x18489c){return new BPromise(function(_0x5b5047,_0x21f439){return client['request'](_0x48fb55,_0x18489c)[_0x2add('0xa')](function(_0x4363a1){logger[_0x2add('0xb')](_0x2add('0xc'),_0x447b6d,_0x2add('0xd'));logger[_0x2add('0xe')](_0x2add('0xf'),_0x447b6d,_0x2add('0xd'),JSON['stringify'](_0x4363a1));if(_0x4363a1[_0x2add('0x10')]){if(_0x4363a1[_0x2add('0x10')][_0x2add('0x11')]===0x1f4){logger[_0x2add('0x10')](_0x2add('0xc'),_0x447b6d,_0x4363a1[_0x2add('0x10')][_0x2add('0x12')]);return _0x21f439(_0x4363a1[_0x2add('0x10')]['message']);}logger[_0x2add('0x10')](_0x2add('0xc'),_0x447b6d,_0x4363a1[_0x2add('0x10')][_0x2add('0x12')]);return _0x5b5047(_0x4363a1[_0x2add('0x10')][_0x2add('0x12')]);}else{logger[_0x2add('0xb')](_0x2add('0xc'),_0x447b6d,'request\x20sent');_0x5b5047(_0x4363a1[_0x2add('0x13')][_0x2add('0x12')]);}})[_0x2add('0x14')](function(_0x1cd847){logger[_0x2add('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x447b6d,_0x1cd847);_0x21f439(_0x1cd847);});});}exports['GetFreshdeskAccount']=function(_0x3630f0){var _0x524a3f=this;return new Promise(function(_0x525afc,_0x54d277){return db['FreshdeskAccount']['findAll']({'raw':_0x3630f0[_0x2add('0x15')]?_0x3630f0[_0x2add('0x15')][_0x2add('0x16')]===undefined?!![]:![]:!![],'where':_0x3630f0[_0x2add('0x15')]?_0x3630f0[_0x2add('0x15')][_0x2add('0x17')]||null:null,'attributes':_0x3630f0[_0x2add('0x15')]?_0x3630f0[_0x2add('0x15')][_0x2add('0x18')]||null:null,'limit':_0x3630f0[_0x2add('0x15')]?_0x3630f0[_0x2add('0x15')][_0x2add('0x19')]||null:null,'include':_0x3630f0[_0x2add('0x15')]?_0x3630f0['options']['include']?_['map'](_0x3630f0[_0x2add('0x15')]['include'],function(_0x50bd25){return{'model':db[_0x50bd25['model']],'as':_0x50bd25['as'],'attributes':_0x50bd25[_0x2add('0x18')],'include':_0x50bd25['include']?_[_0x2add('0x1a')](_0x50bd25[_0x2add('0x1b')],function(_0x40c4e9){return{'model':db[_0x40c4e9[_0x2add('0x1c')]],'as':_0x40c4e9['as'],'attributes':_0x40c4e9[_0x2add('0x18')],'include':_0x40c4e9[_0x2add('0x1b')]?_[_0x2add('0x1a')](_0x40c4e9['include'],function(_0x199a54){return{'model':db[_0x199a54[_0x2add('0x1c')]],'as':_0x199a54['as'],'attributes':_0x199a54['attributes']};}):[]};}):[]};}):[]:[]})[_0x2add('0xa')](function(_0x12b704){logger[_0x2add('0xb')](_0x2add('0x1d'),_0x3630f0);logger[_0x2add('0xe')](_0x2add('0x1d'),_0x3630f0,JSON[_0x2add('0x1e')](_0x12b704));_0x525afc(_0x12b704);})[_0x2add('0x14')](function(_0x334ff0){logger[_0x2add('0x10')](_0x2add('0x1d'),_0x334ff0[_0x2add('0x12')],_0x3630f0);_0x54d277(_0x524a3f[_0x2add('0x10')](0x1f4,_0x334ff0[_0x2add('0x12')]));});});};exports['ShowFreshdeskAccount']=function(_0x1dac76){var _0x201008=this;return new Promise(function(_0x165e8d,_0x1f780d){return db[_0x2add('0x1f')][_0x2add('0x20')]({'raw':_0x1dac76[_0x2add('0x15')]?_0x1dac76[_0x2add('0x15')][_0x2add('0x16')]===undefined?!![]:![]:!![],'where':_0x1dac76[_0x2add('0x15')]?_0x1dac76[_0x2add('0x15')][_0x2add('0x17')]||null:null,'attributes':_0x1dac76[_0x2add('0x15')]?_0x1dac76[_0x2add('0x15')]['attributes']||null:null,'include':_0x1dac76['options']?_0x1dac76[_0x2add('0x15')]['include']?_[_0x2add('0x1a')](_0x1dac76[_0x2add('0x15')][_0x2add('0x1b')],function(_0x4f43af){return{'model':db[_0x4f43af['model']],'as':_0x4f43af['as'],'attributes':_0x4f43af[_0x2add('0x18')],'include':_0x4f43af['include']?_[_0x2add('0x1a')](_0x4f43af[_0x2add('0x1b')],function(_0x99dadb){return{'model':db[_0x99dadb[_0x2add('0x1c')]],'as':_0x99dadb['as'],'attributes':_0x99dadb[_0x2add('0x18')],'include':_0x99dadb['include']?_[_0x2add('0x1a')](_0x99dadb[_0x2add('0x1b')],function(_0x2ca10b){return{'model':db[_0x2ca10b[_0x2add('0x1c')]],'as':_0x2ca10b['as'],'attributes':_0x2ca10b[_0x2add('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2add('0xa')](function(_0x3d58c7){logger['info']('ShowFreshdeskAccount',_0x1dac76);logger[_0x2add('0xe')]('ShowFreshdeskAccount',_0x1dac76,JSON[_0x2add('0x1e')](_0x3d58c7));_0x165e8d(_0x3d58c7);})[_0x2add('0x14')](function(_0x53ff4a){logger[_0x2add('0x10')](_0x2add('0x21'),_0x53ff4a[_0x2add('0x12')],_0x1dac76);_0x1f780d(_0x201008[_0x2add('0x10')](0x1f4,_0x53ff4a[_0x2add('0x12')]));});});}; \ No newline at end of file +var _0x74eb=['jayson/promise','http','request','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','ShowFreshdeskAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2371cd,_0x18bb8d){var _0x48e5f3=function(_0x3e29bd){while(--_0x3e29bd){_0x2371cd['push'](_0x2371cd['shift']());}};_0x48e5f3(++_0x18bb8d);}(_0x74eb,0x13b));var _0xb74e=function(_0x165292,_0x5189e8){_0x165292=_0x165292-0x0;var _0xe8b67=_0x74eb[_0x165292];return _0xe8b67;};'use strict';var _=require(_0xb74e('0x0'));var util=require(_0xb74e('0x1'));var moment=require(_0xb74e('0x2'));var BPromise=require('bluebird');var rs=require(_0xb74e('0x3'));var fs=require('fs');var Redis=require(_0xb74e('0x4'));var db=require(_0xb74e('0x5'))['db'];var utils=require(_0xb74e('0x6'));var logger=require(_0xb74e('0x7'))(_0xb74e('0x8'));var config=require('../../config/environment');var jayson=require(_0xb74e('0x9'));var client=jayson['client'][_0xb74e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4307f8,_0x562cd1,_0x2d0773){return new BPromise(function(_0x56483b,_0x5673f1){return client[_0xb74e('0xb')](_0x4307f8,_0x2d0773)['then'](function(_0x2e4c3a){logger[_0xb74e('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x562cd1,_0xb74e('0xd'));logger[_0xb74e('0xe')](_0xb74e('0xf'),_0x562cd1,_0xb74e('0xd'),JSON[_0xb74e('0x10')](_0x2e4c3a));if(_0x2e4c3a[_0xb74e('0x11')]){if(_0x2e4c3a[_0xb74e('0x11')]['code']===0x1f4){logger['error'](_0xb74e('0x12'),_0x562cd1,_0x2e4c3a[_0xb74e('0x11')][_0xb74e('0x13')]);return _0x5673f1(_0x2e4c3a[_0xb74e('0x11')][_0xb74e('0x13')]);}logger[_0xb74e('0x11')](_0xb74e('0x12'),_0x562cd1,_0x2e4c3a[_0xb74e('0x11')]['message']);return _0x56483b(_0x2e4c3a[_0xb74e('0x11')][_0xb74e('0x13')]);}else{logger[_0xb74e('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x562cd1,'request\x20sent');_0x56483b(_0x2e4c3a[_0xb74e('0x14')]['message']);}})[_0xb74e('0x15')](function(_0x47e678){logger[_0xb74e('0x11')](_0xb74e('0x12'),_0x562cd1,_0x47e678);_0x5673f1(_0x47e678);});});}exports[_0xb74e('0x16')]=function(_0x391296){var _0x526549=this;return new Promise(function(_0x47b4a4,_0x201b98){return db[_0xb74e('0x17')][_0xb74e('0x18')]({'raw':_0x391296[_0xb74e('0x19')]?_0x391296[_0xb74e('0x19')][_0xb74e('0x1a')]===undefined?!![]:![]:!![],'where':_0x391296[_0xb74e('0x19')]?_0x391296['options'][_0xb74e('0x1b')]||null:null,'attributes':_0x391296['options']?_0x391296[_0xb74e('0x19')][_0xb74e('0x1c')]||null:null,'limit':_0x391296[_0xb74e('0x19')]?_0x391296[_0xb74e('0x19')][_0xb74e('0x1d')]||null:null,'include':_0x391296[_0xb74e('0x19')]?_0x391296['options']['include']?_[_0xb74e('0x1e')](_0x391296[_0xb74e('0x19')][_0xb74e('0x1f')],function(_0x4d526a){return{'model':db[_0x4d526a[_0xb74e('0x20')]],'as':_0x4d526a['as'],'attributes':_0x4d526a[_0xb74e('0x1c')],'include':_0x4d526a[_0xb74e('0x1f')]?_[_0xb74e('0x1e')](_0x4d526a[_0xb74e('0x1f')],function(_0x3e792e){return{'model':db[_0x3e792e['model']],'as':_0x3e792e['as'],'attributes':_0x3e792e[_0xb74e('0x1c')],'include':_0x3e792e[_0xb74e('0x1f')]?_[_0xb74e('0x1e')](_0x3e792e[_0xb74e('0x1f')],function(_0x38360f){return{'model':db[_0x38360f[_0xb74e('0x20')]],'as':_0x38360f['as'],'attributes':_0x38360f[_0xb74e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb74e('0x21')](function(_0x970ab){logger[_0xb74e('0xc')]('GetFreshdeskAccount',_0x391296);logger[_0xb74e('0xe')]('GetFreshdeskAccount',_0x391296,JSON[_0xb74e('0x10')](_0x970ab));_0x47b4a4(_0x970ab);})[_0xb74e('0x15')](function(_0x421620){logger[_0xb74e('0x11')](_0xb74e('0x16'),_0x421620['message'],_0x391296);_0x201b98(_0x526549[_0xb74e('0x11')](0x1f4,_0x421620[_0xb74e('0x13')]));});});};exports[_0xb74e('0x22')]=function(_0x3c0d3f){var _0x22f2b2=this;return new Promise(function(_0x5aa44c,_0x18bbee){return db[_0xb74e('0x17')][_0xb74e('0x23')]({'raw':_0x3c0d3f['options']?_0x3c0d3f['options']['raw']===undefined?!![]:![]:!![],'where':_0x3c0d3f['options']?_0x3c0d3f[_0xb74e('0x19')]['where']||null:null,'attributes':_0x3c0d3f[_0xb74e('0x19')]?_0x3c0d3f['options'][_0xb74e('0x1c')]||null:null,'include':_0x3c0d3f[_0xb74e('0x19')]?_0x3c0d3f[_0xb74e('0x19')][_0xb74e('0x1f')]?_[_0xb74e('0x1e')](_0x3c0d3f[_0xb74e('0x19')][_0xb74e('0x1f')],function(_0x50e46b){return{'model':db[_0x50e46b['model']],'as':_0x50e46b['as'],'attributes':_0x50e46b[_0xb74e('0x1c')],'include':_0x50e46b['include']?_['map'](_0x50e46b[_0xb74e('0x1f')],function(_0x487f46){return{'model':db[_0x487f46[_0xb74e('0x20')]],'as':_0x487f46['as'],'attributes':_0x487f46['attributes'],'include':_0x487f46[_0xb74e('0x1f')]?_[_0xb74e('0x1e')](_0x487f46[_0xb74e('0x1f')],function(_0x29d31a){return{'model':db[_0x29d31a[_0xb74e('0x20')]],'as':_0x29d31a['as'],'attributes':_0x29d31a[_0xb74e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb74e('0x21')](function(_0x194c60){logger[_0xb74e('0xc')](_0xb74e('0x22'),_0x3c0d3f);logger[_0xb74e('0xe')](_0xb74e('0x22'),_0x3c0d3f,JSON[_0xb74e('0x10')](_0x194c60));_0x5aa44c(_0x194c60);})['catch'](function(_0x4e4216){logger['error'](_0xb74e('0x22'),_0x4e4216[_0xb74e('0x13')],_0x3c0d3f);_0x18bbee(_0x22f2b2[_0xb74e('0x11')](0x1f4,_0x4e4216['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 6cc7c74..9160df8 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 _0x43f1=['getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','put','delete','/:id','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects'];(function(_0x5dca72,_0x3cbc2a){var _0x58c9ef=function(_0x55b66e){while(--_0x55b66e){_0x5dca72['push'](_0x5dca72['shift']());}};_0x58c9ef(++_0x3cbc2a);}(_0x43f1,0x74));var _0x143f=function(_0x38ff1e,_0x3b9385){_0x38ff1e=_0x38ff1e-0x0;var _0x3755d4=_0x43f1[_0x38ff1e];return _0x3755d4;};'use strict';var multer=require(_0x143f('0x0'));var util=require(_0x143f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x143f('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x143f('0x3'));var interaction=require(_0x143f('0x4'));var config=require(_0x143f('0x5'));var controller=require(_0x143f('0x6'));router[_0x143f('0x7')]('/',auth[_0x143f('0x8')](),controller[_0x143f('0x9')]);router[_0x143f('0x7')]('/:id',auth[_0x143f('0x8')](),controller[_0x143f('0xa')]);router[_0x143f('0x7')](_0x143f('0xb'),auth[_0x143f('0x8')](),controller[_0x143f('0xc')]);router['get'](_0x143f('0xd'),auth[_0x143f('0x8')](),controller[_0x143f('0xe')]);router[_0x143f('0x7')](_0x143f('0xf'),auth[_0x143f('0x8')](),controller[_0x143f('0x10')]);router[_0x143f('0x7')](_0x143f('0x11'),auth[_0x143f('0x8')](),controller['getTags']);router[_0x143f('0x12')]('/',auth[_0x143f('0x8')](),controller[_0x143f('0x13')]);router[_0x143f('0x12')]('/:id/tags',auth[_0x143f('0x8')](),controller[_0x143f('0x14')]);router[_0x143f('0x15')]('/:id',auth[_0x143f('0x8')](),controller['update']);router[_0x143f('0x16')](_0x143f('0x17'),auth['isAuthenticated'](),controller[_0x143f('0x18')]);module[_0x143f('0x19')]=router; \ No newline at end of file +var _0x5e31=['Router','fs-extra','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','/:id/tags','setTags','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0xc5708,_0x3d620e){var _0x44d6cc=function(_0x3fa2a0){while(--_0x3fa2a0){_0xc5708['push'](_0xc5708['shift']());}};_0x44d6cc(++_0x3d620e);}(_0x5e31,0x18b));var _0x15e3=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0x5e31[_0x5a6644];return _0x3a2a5d;};'use strict';var multer=require(_0x15e3('0x0'));var util=require(_0x15e3('0x1'));var path=require(_0x15e3('0x2'));var timeout=require(_0x15e3('0x3'));var express=require(_0x15e3('0x4'));var router=express[_0x15e3('0x5')]();var fs_extra=require(_0x15e3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x15e3('0x7'));var config=require('../../config/environment');var controller=require(_0x15e3('0x8'));router[_0x15e3('0x9')]('/',auth[_0x15e3('0xa')](),controller['index']);router[_0x15e3('0x9')](_0x15e3('0xb'),auth[_0x15e3('0xa')](),controller[_0x15e3('0xc')]);router[_0x15e3('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x15e3('0xd')]);router[_0x15e3('0x9')](_0x15e3('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x15e3('0xf'),auth[_0x15e3('0xa')](),controller[_0x15e3('0x10')]);router[_0x15e3('0x9')]('/:id/tags',auth[_0x15e3('0xa')](),controller['getTags']);router[_0x15e3('0x11')]('/',auth['isAuthenticated'](),controller[_0x15e3('0x12')]);router['post'](_0x15e3('0x13'),auth[_0x15e3('0xa')](),controller[_0x15e3('0x14')]);router[_0x15e3('0x15')](_0x15e3('0xb'),auth[_0x15e3('0xa')](),controller[_0x15e3('0x16')]);router['delete'](_0x15e3('0xb'),auth[_0x15e3('0xa')](),controller[_0x15e3('0x17')]);module[_0x15e3('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index e479655..20c3625 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 _0xf08a=['STRING','sequelize','exports'];(function(_0x68f005,_0x1c7f4f){var _0x23cc8d=function(_0x231dcd){while(--_0x231dcd){_0x68f005['push'](_0x68f005['shift']());}};_0x23cc8d(++_0x1c7f4f);}(_0xf08a,0x19f));var _0xaf08=function(_0x3a1a40,_0x16de93){_0x3a1a40=_0x3a1a40-0x0;var _0xf642a1=_0xf08a[_0x3a1a40];return _0xf642a1;};'use strict';var Sequelize=require(_0xaf08('0x0'));module[_0xaf08('0x1')]={'name':{'type':Sequelize[_0xaf08('0x2')]},'description':{'type':Sequelize[_0xaf08('0x2')]}}; \ No newline at end of file +var _0x6468=['exports','STRING','sequelize'];(function(_0x5158ed,_0x1ce8c1){var _0x69fc46=function(_0x3d64ed){while(--_0x3d64ed){_0x5158ed['push'](_0x5158ed['shift']());}};_0x69fc46(++_0x1ce8c1);}(_0x6468,0x98));var _0x8646=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x6468[_0x31cb5f];return _0x586042;};'use strict';var Sequelize=require(_0x8646('0x0'));module[_0x8646('0x1')]={'name':{'type':Sequelize[_0x8646('0x2')]},'description':{'type':Sequelize[_0x8646('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 084e827..f96220b 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 _0xf8e8=['filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','merge','find','create','body','getFields','getSubjects','findOne','FreshdeskField','order','getDescriptions','getTags','setTags','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','index','map','FreshdeskConfiguration','rawAttributes','fieldName','key','model','query','keys'];(function(_0x18daa9,_0x47e0cd){var _0x5e5521=function(_0x222a56){while(--_0x222a56){_0x18daa9['push'](_0x18daa9['shift']());}};_0x5e5521(++_0x47e0cd);}(_0xf8e8,0x10d));var _0x8f8e=function(_0x30747a,_0x312d68){_0x30747a=_0x30747a-0x0;var _0x3d81ee=_0xf8e8[_0x30747a];return _0x3d81ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8f8e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8f8e('0x1'));var rp=require(_0x8f8e('0x2'));var moment=require(_0x8f8e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8f8e('0x4'));var sox=require(_0x8f8e('0x5'));var csv=require(_0x8f8e('0x6'));var ejs=require(_0x8f8e('0x7'));var fs=require('fs');var fs_extra=require(_0x8f8e('0x8'));var _=require(_0x8f8e('0x9'));var squel=require(_0x8f8e('0xa'));var crypto=require(_0x8f8e('0xb'));var jsforce=require(_0x8f8e('0xc'));var deskjs=require(_0x8f8e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8f8e('0xe'));var Papa=require(_0x8f8e('0xf'));var Redis=require(_0x8f8e('0x10'));var authService=require(_0x8f8e('0x11'));var qs=require(_0x8f8e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f8e('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x8f8e('0x14'));var config=require(_0x8f8e('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c4d80,_0xe33ee2){_0xe33ee2=_0xe33ee2||0xcc;return function(_0x3d4e49){if(_0x3d4e49){return _0x1c4d80['sendStatus'](_0xe33ee2);}return _0x1c4d80[_0x8f8e('0x16')](_0xe33ee2)[_0x8f8e('0x17')]();};}function respondWithResult(_0x2d5534,_0x313483){_0x313483=_0x313483||0xc8;return function(_0x42d721){if(_0x42d721){return _0x2d5534[_0x8f8e('0x16')](_0x313483)['json'](_0x42d721);}};}function respondWithFilteredResult(_0x2a194d,_0xe45050){return function(_0x26ec22){if(_0x26ec22){var _0x5518a0=typeof _0xe45050[_0x8f8e('0x18')]===_0x8f8e('0x19')&&typeof _0xe45050[_0x8f8e('0x1a')]===_0x8f8e('0x19');var _0x2d7f8a=_0x26ec22['count'];var _0x84a4e4=_0x5518a0?0x0:_0xe45050['offset'];var _0x1d3322=_0x5518a0?_0x26ec22[_0x8f8e('0x1b')]:_0xe45050[_0x8f8e('0x18')]+_0xe45050[_0x8f8e('0x1a')];var _0x1b9a98;if(_0x1d3322>=_0x2d7f8a){_0x1d3322=_0x2d7f8a;_0x1b9a98=0xc8;}else{_0x1b9a98=0xce;}_0x2a194d[_0x8f8e('0x16')](_0x1b9a98);return _0x2a194d[_0x8f8e('0x1c')](_0x8f8e('0x1d'),_0x84a4e4+'-'+_0x1d3322+'/'+_0x2d7f8a)['json'](_0x26ec22);}return null;};}function patchUpdates(_0x22b71e){return function(_0x3f18df){try{jsonpatch[_0x8f8e('0x1e')](_0x3f18df,_0x22b71e,!![]);}catch(_0x195ce7){return BPromise[_0x8f8e('0x1f')](_0x195ce7);}return _0x3f18df[_0x8f8e('0x20')]();};}function saveUpdates(_0x1b4006,_0xa20c09){return function(_0x48e714){if(_0x48e714){return _0x48e714[_0x8f8e('0x21')](_0x1b4006)['then'](function(_0x254881){return _0x254881;});}return null;};}function removeEntity(_0x23d389,_0x5ce41b){return function(_0x4653d6){if(_0x4653d6){return _0x4653d6[_0x8f8e('0x22')]()[_0x8f8e('0x23')](function(){_0x23d389[_0x8f8e('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f1759,_0x3b2b25){return function(_0x4279a1){if(!_0x4279a1){_0x3f1759['sendStatus'](0x194);}return _0x4279a1;};}function handleError(_0x46bb86,_0x540d3b){_0x540d3b=_0x540d3b||0x1f4;return function(_0x4d54fb){logger[_0x8f8e('0x24')](_0x4d54fb['stack']);if(_0x4d54fb[_0x8f8e('0x25')]){delete _0x4d54fb[_0x8f8e('0x25')];}_0x46bb86[_0x8f8e('0x16')](_0x540d3b)['send'](_0x4d54fb);};}exports[_0x8f8e('0x26')]=function(_0x434b0e,_0x38d3b7){var _0xd456b8={},_0x4524a8={},_0x307159={'count':0x0,'rows':[]};var _0x274825=_[_0x8f8e('0x27')](db[_0x8f8e('0x28')][_0x8f8e('0x29')],function(_0x4788c4){return{'name':_0x4788c4[_0x8f8e('0x2a')],'type':_0x4788c4['type'][_0x8f8e('0x2b')]};});_0x4524a8[_0x8f8e('0x2c')]=_[_0x8f8e('0x27')](_0x274825,_0x8f8e('0x25'));_0x4524a8[_0x8f8e('0x2d')]=_[_0x8f8e('0x2e')](_0x434b0e[_0x8f8e('0x2d')]);_0x4524a8[_0x8f8e('0x2f')]=_['intersection'](_0x4524a8['model'],_0x4524a8[_0x8f8e('0x2d')]);_0xd456b8[_0x8f8e('0x30')]=_[_0x8f8e('0x31')](_0x4524a8[_0x8f8e('0x2c')],qs[_0x8f8e('0x32')](_0x434b0e[_0x8f8e('0x2d')]['fields']));_0xd456b8[_0x8f8e('0x30')]=_0xd456b8[_0x8f8e('0x30')][_0x8f8e('0x33')]?_0xd456b8[_0x8f8e('0x30')]:_0x4524a8[_0x8f8e('0x2c')];if(!_0x434b0e[_0x8f8e('0x2d')][_0x8f8e('0x34')](_0x8f8e('0x35'))){_0xd456b8[_0x8f8e('0x1a')]=qs[_0x8f8e('0x1a')](_0x434b0e['query'][_0x8f8e('0x1a')]);_0xd456b8[_0x8f8e('0x18')]=qs[_0x8f8e('0x18')](_0x434b0e[_0x8f8e('0x2d')][_0x8f8e('0x18')]);}_0xd456b8['order']=qs[_0x8f8e('0x36')](_0x434b0e[_0x8f8e('0x2d')][_0x8f8e('0x36')]);_0xd456b8[_0x8f8e('0x37')]=qs['filters'](_[_0x8f8e('0x38')](_0x434b0e['query'],_0x4524a8['filters']),_0x274825);if(_0x434b0e['query'][_0x8f8e('0x39')]){_0xd456b8[_0x8f8e('0x37')]=_['merge'](_0xd456b8[_0x8f8e('0x37')],{'$or':_[_0x8f8e('0x27')](_0x274825,function(_0x6adf51){if(_0x6adf51[_0x8f8e('0x3a')]!==_0x8f8e('0x3b')){var _0x5052ae={};_0x5052ae[_0x6adf51['name']]={'$like':'%'+_0x434b0e[_0x8f8e('0x2d')]['filter']+'%'};return _0x5052ae;}})});}_0xd456b8=_['merge']({},_0xd456b8,_0x434b0e[_0x8f8e('0x3c')]);var _0x52a450={'where':_0xd456b8[_0x8f8e('0x37')]};return db[_0x8f8e('0x28')]['count'](_0x52a450)['then'](function(_0x4dd7fd){_0x307159[_0x8f8e('0x1b')]=_0x4dd7fd;if(_0x434b0e['query']['includeAll']){_0xd456b8[_0x8f8e('0x3d')]=[{'all':!![]}];}return db[_0x8f8e('0x28')][_0x8f8e('0x3e')](_0xd456b8);})[_0x8f8e('0x23')](function(_0x20a352){_0x307159[_0x8f8e('0x3f')]=_0x20a352;return _0x307159;})['then'](respondWithFilteredResult(_0x38d3b7,_0xd456b8))[_0x8f8e('0x40')](handleError(_0x38d3b7,null));};exports['show']=function(_0xc792b9,_0x5efdbd){var _0x2b4b4e={'raw':![],'where':{'id':_0xc792b9[_0x8f8e('0x41')]['id']}},_0x514289={};_0x514289['model']=_[_0x8f8e('0x2e')](db[_0x8f8e('0x28')][_0x8f8e('0x29')]);_0x514289[_0x8f8e('0x2d')]=_[_0x8f8e('0x2e')](_0xc792b9['query']);_0x514289['filters']=_[_0x8f8e('0x31')](_0x514289[_0x8f8e('0x2c')],_0x514289[_0x8f8e('0x2d')]);_0x2b4b4e[_0x8f8e('0x30')]=_[_0x8f8e('0x31')](_0x514289[_0x8f8e('0x2c')],qs[_0x8f8e('0x32')](_0xc792b9[_0x8f8e('0x2d')][_0x8f8e('0x32')]));_0x2b4b4e[_0x8f8e('0x30')]=_0x2b4b4e[_0x8f8e('0x30')]['length']?_0x2b4b4e[_0x8f8e('0x30')]:_0x514289['model'];if(_0xc792b9[_0x8f8e('0x2d')][_0x8f8e('0x42')]){_0x2b4b4e['include']=[{'all':!![]}];}_0x2b4b4e=_[_0x8f8e('0x43')]({},_0x2b4b4e,_0xc792b9[_0x8f8e('0x3c')]);return db[_0x8f8e('0x28')][_0x8f8e('0x44')](_0x2b4b4e)['then'](handleEntityNotFound(_0x5efdbd,null))['then'](respondWithResult(_0x5efdbd,null))[_0x8f8e('0x40')](handleError(_0x5efdbd,null));};exports[_0x8f8e('0x45')]=function(_0x10fa2a,_0x36671f){return db[_0x8f8e('0x28')][_0x8f8e('0x45')](_0x10fa2a[_0x8f8e('0x46')],{})['then'](respondWithResult(_0x36671f,0xc9))[_0x8f8e('0x40')](handleError(_0x36671f,null));};exports[_0x8f8e('0x21')]=function(_0x208ed8,_0x144aa0){if(_0x208ed8['body']['id']){delete _0x208ed8[_0x8f8e('0x46')]['id'];}return db[_0x8f8e('0x28')][_0x8f8e('0x44')]({'where':{'id':_0x208ed8[_0x8f8e('0x41')]['id']}})['then'](handleEntityNotFound(_0x144aa0,null))[_0x8f8e('0x23')](saveUpdates(_0x208ed8['body'],null))[_0x8f8e('0x23')](respondWithResult(_0x144aa0,null))[_0x8f8e('0x40')](handleError(_0x144aa0,null));};exports[_0x8f8e('0x22')]=function(_0x41039a,_0x20ef10){return db[_0x8f8e('0x28')][_0x8f8e('0x44')]({'where':{'id':_0x41039a[_0x8f8e('0x41')]['id']}})[_0x8f8e('0x23')](handleEntityNotFound(_0x20ef10,null))[_0x8f8e('0x23')](removeEntity(_0x20ef10,null))[_0x8f8e('0x40')](handleError(_0x20ef10,null));};exports[_0x8f8e('0x47')]=function(_0x2b35de,_0x2fdd68,_0x21c1e4){var _0xdde2eb={};var _0x152a35={};var _0x2730f7;var _0x226484;return db[_0x8f8e('0x28')]['findOne']({'where':{'id':_0x2b35de['params']['id']}})['then'](handleEntityNotFound(_0x2fdd68,null))['then'](function(_0x4431b3){if(_0x4431b3){_0x2730f7=_0x4431b3;_0x152a35[_0x8f8e('0x2c')]=_[_0x8f8e('0x2e')](db['FreshdeskField'][_0x8f8e('0x29')]);_0x152a35[_0x8f8e('0x2d')]=_[_0x8f8e('0x2e')](_0x2b35de['query']);_0x152a35[_0x8f8e('0x2f')]=_[_0x8f8e('0x31')](_0x152a35[_0x8f8e('0x2c')],_0x152a35['query']);_0xdde2eb[_0x8f8e('0x30')]=_['intersection'](_0x152a35[_0x8f8e('0x2c')],qs[_0x8f8e('0x32')](_0x2b35de['query'][_0x8f8e('0x32')]));_0xdde2eb[_0x8f8e('0x30')]=_0xdde2eb[_0x8f8e('0x30')][_0x8f8e('0x33')]?_0xdde2eb[_0x8f8e('0x30')]:_0x152a35[_0x8f8e('0x2c')];_0xdde2eb['order']=qs[_0x8f8e('0x36')](_0x2b35de[_0x8f8e('0x2d')]['sort']);_0xdde2eb[_0x8f8e('0x37')]=qs[_0x8f8e('0x2f')](_['pick'](_0x2b35de['query'],_0x152a35[_0x8f8e('0x2f')]));if(_0x2b35de[_0x8f8e('0x2d')][_0x8f8e('0x39')]){_0xdde2eb[_0x8f8e('0x37')]=_[_0x8f8e('0x43')](_0xdde2eb[_0x8f8e('0x37')],{'$or':_[_0x8f8e('0x27')](_0xdde2eb[_0x8f8e('0x30')],function(_0x4867c){var _0xbc3c06={};_0xbc3c06[_0x4867c]={'$like':'%'+_0x2b35de[_0x8f8e('0x2d')][_0x8f8e('0x39')]+'%'};return _0xbc3c06;})});}_0xdde2eb=_[_0x8f8e('0x43')]({},_0xdde2eb,_0x2b35de['options']);return _0x2730f7[_0x8f8e('0x47')](_0xdde2eb);}})['then'](function(_0x31e4aa){if(_0x31e4aa){_0x226484=_0x31e4aa['length'];if(!_0x2b35de[_0x8f8e('0x2d')][_0x8f8e('0x34')](_0x8f8e('0x35'))){_0xdde2eb[_0x8f8e('0x1a')]=qs[_0x8f8e('0x1a')](_0x2b35de[_0x8f8e('0x2d')]['limit']);_0xdde2eb[_0x8f8e('0x18')]=qs[_0x8f8e('0x18')](_0x2b35de[_0x8f8e('0x2d')][_0x8f8e('0x18')]);}return _0x2730f7[_0x8f8e('0x47')](_0xdde2eb);}})[_0x8f8e('0x23')](function(_0x1377f3){if(_0x1377f3){return _0x1377f3?{'count':_0x226484,'rows':_0x1377f3}:null;}})[_0x8f8e('0x23')](respondWithResult(_0x2fdd68,null))[_0x8f8e('0x40')](handleError(_0x2fdd68,null));};exports[_0x8f8e('0x48')]=function(_0x1cc720,_0x4bfe27,_0x387dc7){var _0x4f7127={};var _0x1e5e2a={};var _0x33bdae;var _0x3997c3;return db[_0x8f8e('0x28')][_0x8f8e('0x49')]({'where':{'id':_0x1cc720[_0x8f8e('0x41')]['id']}})[_0x8f8e('0x23')](handleEntityNotFound(_0x4bfe27,null))[_0x8f8e('0x23')](function(_0x2c3a2d){if(_0x2c3a2d){_0x33bdae=_0x2c3a2d;_0x1e5e2a['model']=_[_0x8f8e('0x2e')](db[_0x8f8e('0x4a')][_0x8f8e('0x29')]);_0x1e5e2a[_0x8f8e('0x2d')]=_[_0x8f8e('0x2e')](_0x1cc720['query']);_0x1e5e2a[_0x8f8e('0x2f')]=_[_0x8f8e('0x31')](_0x1e5e2a[_0x8f8e('0x2c')],_0x1e5e2a[_0x8f8e('0x2d')]);_0x4f7127['attributes']=_[_0x8f8e('0x31')](_0x1e5e2a[_0x8f8e('0x2c')],qs['fields'](_0x1cc720['query']['fields']));_0x4f7127[_0x8f8e('0x30')]=_0x4f7127[_0x8f8e('0x30')][_0x8f8e('0x33')]?_0x4f7127[_0x8f8e('0x30')]:_0x1e5e2a['model'];_0x4f7127[_0x8f8e('0x4b')]=qs[_0x8f8e('0x36')](_0x1cc720[_0x8f8e('0x2d')][_0x8f8e('0x36')]);_0x4f7127['where']=qs[_0x8f8e('0x2f')](_['pick'](_0x1cc720['query'],_0x1e5e2a[_0x8f8e('0x2f')]));if(_0x1cc720['query'][_0x8f8e('0x39')]){_0x4f7127[_0x8f8e('0x37')]=_[_0x8f8e('0x43')](_0x4f7127[_0x8f8e('0x37')],{'$or':_[_0x8f8e('0x27')](_0x4f7127[_0x8f8e('0x30')],function(_0x4b306c){var _0xdd6eba={};_0xdd6eba[_0x4b306c]={'$like':'%'+_0x1cc720[_0x8f8e('0x2d')][_0x8f8e('0x39')]+'%'};return _0xdd6eba;})});}_0x4f7127=_['merge']({},_0x4f7127,_0x1cc720['options']);return _0x33bdae[_0x8f8e('0x48')](_0x4f7127);}})['then'](function(_0xa5cb28){if(_0xa5cb28){_0x3997c3=_0xa5cb28['length'];if(!_0x1cc720[_0x8f8e('0x2d')][_0x8f8e('0x34')](_0x8f8e('0x35'))){_0x4f7127[_0x8f8e('0x1a')]=qs[_0x8f8e('0x1a')](_0x1cc720[_0x8f8e('0x2d')][_0x8f8e('0x1a')]);_0x4f7127[_0x8f8e('0x18')]=qs['offset'](_0x1cc720['query'][_0x8f8e('0x18')]);}return _0x33bdae['getSubjects'](_0x4f7127);}})['then'](function(_0x445b2a){if(_0x445b2a){return _0x445b2a?{'count':_0x3997c3,'rows':_0x445b2a}:null;}})[_0x8f8e('0x23')](respondWithResult(_0x4bfe27,null))[_0x8f8e('0x40')](handleError(_0x4bfe27,null));};exports[_0x8f8e('0x4c')]=function(_0x5adf2b,_0x31270e,_0xc4f314){var _0x4ac7c2={};var _0x22d0da={};var _0x47bd3b;var _0x5ceee7;return db[_0x8f8e('0x28')][_0x8f8e('0x49')]({'where':{'id':_0x5adf2b['params']['id']}})[_0x8f8e('0x23')](handleEntityNotFound(_0x31270e,null))[_0x8f8e('0x23')](function(_0x39e172){if(_0x39e172){_0x47bd3b=_0x39e172;_0x22d0da['model']=_[_0x8f8e('0x2e')](db[_0x8f8e('0x4a')]['rawAttributes']);_0x22d0da[_0x8f8e('0x2d')]=_[_0x8f8e('0x2e')](_0x5adf2b[_0x8f8e('0x2d')]);_0x22d0da[_0x8f8e('0x2f')]=_[_0x8f8e('0x31')](_0x22d0da[_0x8f8e('0x2c')],_0x22d0da[_0x8f8e('0x2d')]);_0x4ac7c2[_0x8f8e('0x30')]=_['intersection'](_0x22d0da['model'],qs[_0x8f8e('0x32')](_0x5adf2b[_0x8f8e('0x2d')][_0x8f8e('0x32')]));_0x4ac7c2[_0x8f8e('0x30')]=_0x4ac7c2[_0x8f8e('0x30')][_0x8f8e('0x33')]?_0x4ac7c2[_0x8f8e('0x30')]:_0x22d0da['model'];_0x4ac7c2['order']=qs[_0x8f8e('0x36')](_0x5adf2b[_0x8f8e('0x2d')][_0x8f8e('0x36')]);_0x4ac7c2[_0x8f8e('0x37')]=qs['filters'](_[_0x8f8e('0x38')](_0x5adf2b[_0x8f8e('0x2d')],_0x22d0da[_0x8f8e('0x2f')]));if(_0x5adf2b['query']['filter']){_0x4ac7c2[_0x8f8e('0x37')]=_[_0x8f8e('0x43')](_0x4ac7c2['where'],{'$or':_[_0x8f8e('0x27')](_0x4ac7c2['attributes'],function(_0x4c7d49){var _0x27e175={};_0x27e175[_0x4c7d49]={'$like':'%'+_0x5adf2b[_0x8f8e('0x2d')]['filter']+'%'};return _0x27e175;})});}_0x4ac7c2=_[_0x8f8e('0x43')]({},_0x4ac7c2,_0x5adf2b[_0x8f8e('0x3c')]);return _0x47bd3b['getDescriptions'](_0x4ac7c2);}})[_0x8f8e('0x23')](function(_0x2087f2){if(_0x2087f2){_0x5ceee7=_0x2087f2['length'];if(!_0x5adf2b[_0x8f8e('0x2d')]['hasOwnProperty'](_0x8f8e('0x35'))){_0x4ac7c2['limit']=qs['limit'](_0x5adf2b[_0x8f8e('0x2d')][_0x8f8e('0x1a')]);_0x4ac7c2[_0x8f8e('0x18')]=qs['offset'](_0x5adf2b[_0x8f8e('0x2d')][_0x8f8e('0x18')]);}return _0x47bd3b[_0x8f8e('0x4c')](_0x4ac7c2);}})[_0x8f8e('0x23')](function(_0x17694f){if(_0x17694f){return _0x17694f?{'count':_0x5ceee7,'rows':_0x17694f}:null;}})[_0x8f8e('0x23')](respondWithResult(_0x31270e,null))['catch'](handleError(_0x31270e,null));};exports[_0x8f8e('0x4d')]=function(_0xe75f83,_0x4899a7,_0x54314e){var _0x29d825={};var _0x1eabe0={};var _0x47ce74;var _0x52dbf4;return db[_0x8f8e('0x28')][_0x8f8e('0x49')]({'where':{'id':_0xe75f83[_0x8f8e('0x41')]['id']}})[_0x8f8e('0x23')](handleEntityNotFound(_0x4899a7,null))['then'](function(_0x58fbab){if(_0x58fbab){_0x47ce74=_0x58fbab;_0x1eabe0[_0x8f8e('0x2c')]=_[_0x8f8e('0x2e')](db['Tag']['rawAttributes']);_0x1eabe0[_0x8f8e('0x2d')]=_[_0x8f8e('0x2e')](_0xe75f83[_0x8f8e('0x2d')]);_0x1eabe0[_0x8f8e('0x2f')]=_[_0x8f8e('0x31')](_0x1eabe0['model'],_0x1eabe0['query']);_0x29d825[_0x8f8e('0x30')]=_[_0x8f8e('0x31')](_0x1eabe0['model'],qs[_0x8f8e('0x32')](_0xe75f83[_0x8f8e('0x2d')][_0x8f8e('0x32')]));_0x29d825['attributes']=_0x29d825['attributes'][_0x8f8e('0x33')]?_0x29d825[_0x8f8e('0x30')]:_0x1eabe0[_0x8f8e('0x2c')];_0x29d825[_0x8f8e('0x4b')]=qs[_0x8f8e('0x36')](_0xe75f83[_0x8f8e('0x2d')][_0x8f8e('0x36')]);_0x29d825['where']=qs[_0x8f8e('0x2f')](_[_0x8f8e('0x38')](_0xe75f83['query'],_0x1eabe0[_0x8f8e('0x2f')]));if(_0xe75f83[_0x8f8e('0x2d')]['filter']){_0x29d825[_0x8f8e('0x37')]=_[_0x8f8e('0x43')](_0x29d825['where'],{'$or':_['map'](_0x29d825[_0x8f8e('0x30')],function(_0x250d0c){var _0x3431ae={};_0x3431ae[_0x250d0c]={'$like':'%'+_0xe75f83[_0x8f8e('0x2d')][_0x8f8e('0x39')]+'%'};return _0x3431ae;})});}_0x29d825=_['merge']({},_0x29d825,_0xe75f83[_0x8f8e('0x3c')]);return _0x47ce74[_0x8f8e('0x4d')](_0x29d825);}})['then'](function(_0x5e3813){if(_0x5e3813){_0x52dbf4=_0x5e3813[_0x8f8e('0x33')];if(!_0xe75f83[_0x8f8e('0x2d')][_0x8f8e('0x34')]('nolimit')){_0x29d825['limit']=qs['limit'](_0xe75f83[_0x8f8e('0x2d')][_0x8f8e('0x1a')]);_0x29d825[_0x8f8e('0x18')]=qs[_0x8f8e('0x18')](_0xe75f83[_0x8f8e('0x2d')][_0x8f8e('0x18')]);}return _0x47ce74[_0x8f8e('0x4d')](_0x29d825);}})[_0x8f8e('0x23')](function(_0x2e6620){if(_0x2e6620){return _0x2e6620?{'count':_0x52dbf4,'rows':_0x2e6620}:null;}})[_0x8f8e('0x23')](respondWithResult(_0x4899a7,null))[_0x8f8e('0x40')](handleError(_0x4899a7,null));};exports[_0x8f8e('0x4e')]=function(_0x2a78a9,_0x54ca26,_0xf44121){if(_0x2a78a9[_0x8f8e('0x46')]['id']){delete _0x2a78a9[_0x8f8e('0x46')]['id'];}return db[_0x8f8e('0x28')][_0x8f8e('0x49')]({'where':{'id':_0x2a78a9[_0x8f8e('0x41')]['id']}})['then'](handleEntityNotFound(_0x54ca26,null))['then'](function(_0x16b6eb){if(_0x16b6eb){return _0x16b6eb[_0x8f8e('0x4e')](_0x2a78a9[_0x8f8e('0x46')]['ids']||[]);}return null;})[_0x8f8e('0x23')](respondWithResult(_0x54ca26,null))[_0x8f8e('0x40')](handleError(_0x54ca26,null));}; \ No newline at end of file +var _0xe9ea=['index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','include','find','create','body','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send'];(function(_0x515892,_0x1c31ca){var _0x2b24d3=function(_0x52e169){while(--_0x52e169){_0x515892['push'](_0x515892['shift']());}};_0x2b24d3(++_0x1c31ca);}(_0xe9ea,0x179));var _0xae9e=function(_0xfce628,_0x5a6dea){_0xfce628=_0xfce628-0x0;var _0xf99c5b=_0xe9ea[_0xfce628];return _0xf99c5b;};'use strict';var emlformat=require(_0xae9e('0x0'));var rimraf=require(_0xae9e('0x1'));var zipdir=require(_0xae9e('0x2'));var jsonpatch=require(_0xae9e('0x3'));var rp=require(_0xae9e('0x4'));var moment=require(_0xae9e('0x5'));var BPromise=require(_0xae9e('0x6'));var Mustache=require(_0xae9e('0x7'));var util=require(_0xae9e('0x8'));var path=require(_0xae9e('0x9'));var sox=require(_0xae9e('0xa'));var csv=require('to-csv');var ejs=require(_0xae9e('0xb'));var fs=require('fs');var fs_extra=require(_0xae9e('0xc'));var _=require(_0xae9e('0xd'));var squel=require(_0xae9e('0xe'));var crypto=require(_0xae9e('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae9e('0x10'));var Redis=require(_0xae9e('0x11'));var authService=require(_0xae9e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xae9e('0x13'));var hardwareService=require(_0xae9e('0x14'));var logger=require('../../config/logger')(_0xae9e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xae9e('0x16'));var db=require(_0xae9e('0x17'))['db'];function respondWithStatusCode(_0x4e2081,_0x4dbfe1){_0x4dbfe1=_0x4dbfe1||0xcc;return function(_0x17e03a){if(_0x17e03a){return _0x4e2081[_0xae9e('0x18')](_0x4dbfe1);}return _0x4e2081[_0xae9e('0x19')](_0x4dbfe1)[_0xae9e('0x1a')]();};}function respondWithResult(_0x2c8552,_0x558a15){_0x558a15=_0x558a15||0xc8;return function(_0x1df8b6){if(_0x1df8b6){return _0x2c8552['status'](_0x558a15)['json'](_0x1df8b6);}};}function respondWithFilteredResult(_0x218fb5,_0x103758){return function(_0x43b871){if(_0x43b871){var _0x1c060d=typeof _0x103758[_0xae9e('0x1b')]===_0xae9e('0x1c')&&typeof _0x103758[_0xae9e('0x1d')]===_0xae9e('0x1c');var _0x12705f=_0x43b871[_0xae9e('0x1e')];var _0x1a953f=_0x1c060d?0x0:_0x103758[_0xae9e('0x1b')];var _0xa4ce18=_0x1c060d?_0x43b871['count']:_0x103758[_0xae9e('0x1b')]+_0x103758[_0xae9e('0x1d')];var _0x5d555d;if(_0xa4ce18>=_0x12705f){_0xa4ce18=_0x12705f;_0x5d555d=0xc8;}else{_0x5d555d=0xce;}_0x218fb5[_0xae9e('0x19')](_0x5d555d);return _0x218fb5[_0xae9e('0x1f')](_0xae9e('0x20'),_0x1a953f+'-'+_0xa4ce18+'/'+_0x12705f)[_0xae9e('0x21')](_0x43b871);}return null;};}function patchUpdates(_0x2430fd){return function(_0x37a611){try{jsonpatch[_0xae9e('0x22')](_0x37a611,_0x2430fd,!![]);}catch(_0x193aaf){return BPromise['reject'](_0x193aaf);}return _0x37a611[_0xae9e('0x23')]();};}function saveUpdates(_0x31fb73,_0xc969b0){return function(_0x13081c){if(_0x13081c){return _0x13081c[_0xae9e('0x24')](_0x31fb73)[_0xae9e('0x25')](function(_0x1348b3){return _0x1348b3;});}return null;};}function removeEntity(_0xb5a69a,_0x152f6c){return function(_0x1076e6){if(_0x1076e6){return _0x1076e6[_0xae9e('0x26')]()['then'](function(){_0xb5a69a[_0xae9e('0x19')](0xcc)[_0xae9e('0x1a')]();});}};}function handleEntityNotFound(_0x1624c7,_0x156c18){return function(_0x2fa6bb){if(!_0x2fa6bb){_0x1624c7['sendStatus'](0x194);}return _0x2fa6bb;};}function handleError(_0x3c80c9,_0x37cdb4){_0x37cdb4=_0x37cdb4||0x1f4;return function(_0x403f38){logger[_0xae9e('0x27')](_0x403f38[_0xae9e('0x28')]);if(_0x403f38[_0xae9e('0x29')]){delete _0x403f38[_0xae9e('0x29')];}_0x3c80c9[_0xae9e('0x19')](_0x37cdb4)[_0xae9e('0x2a')](_0x403f38);};}exports[_0xae9e('0x2b')]=function(_0x40976f,_0x551fb4){var _0x5234ac={},_0x51d757={},_0x243edb={'count':0x0,'rows':[]};var _0x42a9dd=_['map'](db[_0xae9e('0x2c')][_0xae9e('0x2d')],function(_0x35d8c4){return{'name':_0x35d8c4[_0xae9e('0x2e')],'type':_0x35d8c4[_0xae9e('0x2f')][_0xae9e('0x30')]};});_0x51d757['model']=_[_0xae9e('0x31')](_0x42a9dd,_0xae9e('0x29'));_0x51d757['query']=_[_0xae9e('0x32')](_0x40976f[_0xae9e('0x33')]);_0x51d757[_0xae9e('0x34')]=_[_0xae9e('0x35')](_0x51d757['model'],_0x51d757[_0xae9e('0x33')]);_0x5234ac[_0xae9e('0x36')]=_[_0xae9e('0x35')](_0x51d757[_0xae9e('0x37')],qs[_0xae9e('0x38')](_0x40976f[_0xae9e('0x33')]['fields']));_0x5234ac[_0xae9e('0x36')]=_0x5234ac[_0xae9e('0x36')][_0xae9e('0x39')]?_0x5234ac[_0xae9e('0x36')]:_0x51d757[_0xae9e('0x37')];if(!_0x40976f[_0xae9e('0x33')][_0xae9e('0x3a')](_0xae9e('0x3b'))){_0x5234ac[_0xae9e('0x1d')]=qs['limit'](_0x40976f[_0xae9e('0x33')][_0xae9e('0x1d')]);_0x5234ac[_0xae9e('0x1b')]=qs[_0xae9e('0x1b')](_0x40976f[_0xae9e('0x33')][_0xae9e('0x1b')]);}_0x5234ac[_0xae9e('0x3c')]=qs[_0xae9e('0x3d')](_0x40976f[_0xae9e('0x33')][_0xae9e('0x3d')]);_0x5234ac[_0xae9e('0x3e')]=qs[_0xae9e('0x34')](_[_0xae9e('0x3f')](_0x40976f[_0xae9e('0x33')],_0x51d757[_0xae9e('0x34')]),_0x42a9dd);if(_0x40976f['query'][_0xae9e('0x40')]){_0x5234ac[_0xae9e('0x3e')]=_[_0xae9e('0x41')](_0x5234ac[_0xae9e('0x3e')],{'$or':_[_0xae9e('0x31')](_0x42a9dd,function(_0x26e670){if(_0x26e670[_0xae9e('0x2f')]!==_0xae9e('0x42')){var _0x543c30={};_0x543c30[_0x26e670['name']]={'$like':'%'+_0x40976f[_0xae9e('0x33')][_0xae9e('0x40')]+'%'};return _0x543c30;}})});}_0x5234ac=_[_0xae9e('0x41')]({},_0x5234ac,_0x40976f[_0xae9e('0x43')]);var _0x4945d4={'where':_0x5234ac[_0xae9e('0x3e')]};return db['FreshdeskConfiguration']['count'](_0x4945d4)[_0xae9e('0x25')](function(_0x7e3e78){_0x243edb[_0xae9e('0x1e')]=_0x7e3e78;if(_0x40976f[_0xae9e('0x33')][_0xae9e('0x44')]){_0x5234ac['include']=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x5234ac);})[_0xae9e('0x25')](function(_0x4a77f9){_0x243edb[_0xae9e('0x45')]=_0x4a77f9;return _0x243edb;})['then'](respondWithFilteredResult(_0x551fb4,_0x5234ac))[_0xae9e('0x46')](handleError(_0x551fb4,null));};exports['show']=function(_0x2f2014,_0x3144ff){var _0x3b01fd={'raw':![],'where':{'id':_0x2f2014[_0xae9e('0x47')]['id']}},_0x1e9661={};_0x1e9661['model']=_[_0xae9e('0x32')](db[_0xae9e('0x2c')][_0xae9e('0x2d')]);_0x1e9661[_0xae9e('0x33')]=_['keys'](_0x2f2014[_0xae9e('0x33')]);_0x1e9661[_0xae9e('0x34')]=_['intersection'](_0x1e9661[_0xae9e('0x37')],_0x1e9661[_0xae9e('0x33')]);_0x3b01fd['attributes']=_[_0xae9e('0x35')](_0x1e9661[_0xae9e('0x37')],qs[_0xae9e('0x38')](_0x2f2014['query']['fields']));_0x3b01fd[_0xae9e('0x36')]=_0x3b01fd['attributes'][_0xae9e('0x39')]?_0x3b01fd[_0xae9e('0x36')]:_0x1e9661['model'];if(_0x2f2014[_0xae9e('0x33')][_0xae9e('0x44')]){_0x3b01fd[_0xae9e('0x48')]=[{'all':!![]}];}_0x3b01fd=_[_0xae9e('0x41')]({},_0x3b01fd,_0x2f2014['options']);return db[_0xae9e('0x2c')][_0xae9e('0x49')](_0x3b01fd)[_0xae9e('0x25')](handleEntityNotFound(_0x3144ff,null))[_0xae9e('0x25')](respondWithResult(_0x3144ff,null))[_0xae9e('0x46')](handleError(_0x3144ff,null));};exports[_0xae9e('0x4a')]=function(_0x2896b8,_0xba6762){return db['FreshdeskConfiguration'][_0xae9e('0x4a')](_0x2896b8[_0xae9e('0x4b')],{})[_0xae9e('0x25')](respondWithResult(_0xba6762,0xc9))['catch'](handleError(_0xba6762,null));};exports[_0xae9e('0x24')]=function(_0x15000f,_0x25ae2a){if(_0x15000f[_0xae9e('0x4b')]['id']){delete _0x15000f[_0xae9e('0x4b')]['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x15000f[_0xae9e('0x47')]['id']}})[_0xae9e('0x25')](handleEntityNotFound(_0x25ae2a,null))[_0xae9e('0x25')](saveUpdates(_0x15000f[_0xae9e('0x4b')],null))[_0xae9e('0x25')](respondWithResult(_0x25ae2a,null))['catch'](handleError(_0x25ae2a,null));};exports['destroy']=function(_0x3446e1,_0x1b1b9d){return db[_0xae9e('0x2c')][_0xae9e('0x49')]({'where':{'id':_0x3446e1[_0xae9e('0x47')]['id']}})[_0xae9e('0x25')](handleEntityNotFound(_0x1b1b9d,null))[_0xae9e('0x25')](removeEntity(_0x1b1b9d,null))[_0xae9e('0x46')](handleError(_0x1b1b9d,null));};exports[_0xae9e('0x4c')]=function(_0x534f26,_0x37da44,_0x27bd1b){var _0x13ffac={};var _0x24221a={};var _0x1106ee;var _0x2d14f6;return db[_0xae9e('0x2c')][_0xae9e('0x4d')]({'where':{'id':_0x534f26[_0xae9e('0x47')]['id']}})[_0xae9e('0x25')](handleEntityNotFound(_0x37da44,null))['then'](function(_0x2f84a4){if(_0x2f84a4){_0x1106ee=_0x2f84a4;_0x24221a[_0xae9e('0x37')]=_[_0xae9e('0x32')](db[_0xae9e('0x4e')][_0xae9e('0x2d')]);_0x24221a[_0xae9e('0x33')]=_[_0xae9e('0x32')](_0x534f26[_0xae9e('0x33')]);_0x24221a[_0xae9e('0x34')]=_[_0xae9e('0x35')](_0x24221a[_0xae9e('0x37')],_0x24221a['query']);_0x13ffac[_0xae9e('0x36')]=_['intersection'](_0x24221a[_0xae9e('0x37')],qs['fields'](_0x534f26[_0xae9e('0x33')]['fields']));_0x13ffac[_0xae9e('0x36')]=_0x13ffac[_0xae9e('0x36')][_0xae9e('0x39')]?_0x13ffac[_0xae9e('0x36')]:_0x24221a['model'];_0x13ffac['order']=qs[_0xae9e('0x3d')](_0x534f26['query'][_0xae9e('0x3d')]);_0x13ffac[_0xae9e('0x3e')]=qs[_0xae9e('0x34')](_['pick'](_0x534f26[_0xae9e('0x33')],_0x24221a[_0xae9e('0x34')]));if(_0x534f26[_0xae9e('0x33')]['filter']){_0x13ffac[_0xae9e('0x3e')]=_[_0xae9e('0x41')](_0x13ffac[_0xae9e('0x3e')],{'$or':_[_0xae9e('0x31')](_0x13ffac['attributes'],function(_0x2ebff5){var _0x4126ff={};_0x4126ff[_0x2ebff5]={'$like':'%'+_0x534f26[_0xae9e('0x33')][_0xae9e('0x40')]+'%'};return _0x4126ff;})});}_0x13ffac=_[_0xae9e('0x41')]({},_0x13ffac,_0x534f26[_0xae9e('0x43')]);return _0x1106ee[_0xae9e('0x4c')](_0x13ffac);}})[_0xae9e('0x25')](function(_0x572a96){if(_0x572a96){_0x2d14f6=_0x572a96[_0xae9e('0x39')];if(!_0x534f26['query']['hasOwnProperty'](_0xae9e('0x3b'))){_0x13ffac[_0xae9e('0x1d')]=qs['limit'](_0x534f26[_0xae9e('0x33')][_0xae9e('0x1d')]);_0x13ffac[_0xae9e('0x1b')]=qs[_0xae9e('0x1b')](_0x534f26[_0xae9e('0x33')][_0xae9e('0x1b')]);}return _0x1106ee[_0xae9e('0x4c')](_0x13ffac);}})[_0xae9e('0x25')](function(_0x1280df){if(_0x1280df){return _0x1280df?{'count':_0x2d14f6,'rows':_0x1280df}:null;}})['then'](respondWithResult(_0x37da44,null))[_0xae9e('0x46')](handleError(_0x37da44,null));};exports[_0xae9e('0x4f')]=function(_0x4c554a,_0x262949,_0x1e5a8a){var _0x3159ca={};var _0x51f849={};var _0x5d7e3a;var _0x580f33;return db[_0xae9e('0x2c')]['findOne']({'where':{'id':_0x4c554a[_0xae9e('0x47')]['id']}})[_0xae9e('0x25')](handleEntityNotFound(_0x262949,null))[_0xae9e('0x25')](function(_0x3fd854){if(_0x3fd854){_0x5d7e3a=_0x3fd854;_0x51f849[_0xae9e('0x37')]=_[_0xae9e('0x32')](db[_0xae9e('0x4e')][_0xae9e('0x2d')]);_0x51f849['query']=_['keys'](_0x4c554a[_0xae9e('0x33')]);_0x51f849[_0xae9e('0x34')]=_[_0xae9e('0x35')](_0x51f849[_0xae9e('0x37')],_0x51f849[_0xae9e('0x33')]);_0x3159ca['attributes']=_[_0xae9e('0x35')](_0x51f849[_0xae9e('0x37')],qs[_0xae9e('0x38')](_0x4c554a[_0xae9e('0x33')][_0xae9e('0x38')]));_0x3159ca[_0xae9e('0x36')]=_0x3159ca[_0xae9e('0x36')][_0xae9e('0x39')]?_0x3159ca[_0xae9e('0x36')]:_0x51f849[_0xae9e('0x37')];_0x3159ca[_0xae9e('0x3c')]=qs['sort'](_0x4c554a[_0xae9e('0x33')][_0xae9e('0x3d')]);_0x3159ca[_0xae9e('0x3e')]=qs['filters'](_[_0xae9e('0x3f')](_0x4c554a[_0xae9e('0x33')],_0x51f849[_0xae9e('0x34')]));if(_0x4c554a[_0xae9e('0x33')][_0xae9e('0x40')]){_0x3159ca[_0xae9e('0x3e')]=_[_0xae9e('0x41')](_0x3159ca[_0xae9e('0x3e')],{'$or':_['map'](_0x3159ca[_0xae9e('0x36')],function(_0x24758f){var _0x2b352f={};_0x2b352f[_0x24758f]={'$like':'%'+_0x4c554a[_0xae9e('0x33')][_0xae9e('0x40')]+'%'};return _0x2b352f;})});}_0x3159ca=_[_0xae9e('0x41')]({},_0x3159ca,_0x4c554a[_0xae9e('0x43')]);return _0x5d7e3a[_0xae9e('0x4f')](_0x3159ca);}})['then'](function(_0x234610){if(_0x234610){_0x580f33=_0x234610[_0xae9e('0x39')];if(!_0x4c554a['query'][_0xae9e('0x3a')](_0xae9e('0x3b'))){_0x3159ca['limit']=qs[_0xae9e('0x1d')](_0x4c554a[_0xae9e('0x33')][_0xae9e('0x1d')]);_0x3159ca[_0xae9e('0x1b')]=qs['offset'](_0x4c554a[_0xae9e('0x33')][_0xae9e('0x1b')]);}return _0x5d7e3a[_0xae9e('0x4f')](_0x3159ca);}})[_0xae9e('0x25')](function(_0xc72972){if(_0xc72972){return _0xc72972?{'count':_0x580f33,'rows':_0xc72972}:null;}})['then'](respondWithResult(_0x262949,null))['catch'](handleError(_0x262949,null));};exports[_0xae9e('0x50')]=function(_0x5cc29e,_0x1bc0c2,_0x442a64){var _0xf15ec0={};var _0x3762cd={};var _0x54474b;var _0x5be019;return db[_0xae9e('0x2c')][_0xae9e('0x4d')]({'where':{'id':_0x5cc29e[_0xae9e('0x47')]['id']}})['then'](handleEntityNotFound(_0x1bc0c2,null))[_0xae9e('0x25')](function(_0x401725){if(_0x401725){_0x54474b=_0x401725;_0x3762cd['model']=_[_0xae9e('0x32')](db['FreshdeskField']['rawAttributes']);_0x3762cd[_0xae9e('0x33')]=_[_0xae9e('0x32')](_0x5cc29e[_0xae9e('0x33')]);_0x3762cd['filters']=_[_0xae9e('0x35')](_0x3762cd[_0xae9e('0x37')],_0x3762cd[_0xae9e('0x33')]);_0xf15ec0[_0xae9e('0x36')]=_[_0xae9e('0x35')](_0x3762cd[_0xae9e('0x37')],qs[_0xae9e('0x38')](_0x5cc29e[_0xae9e('0x33')][_0xae9e('0x38')]));_0xf15ec0[_0xae9e('0x36')]=_0xf15ec0[_0xae9e('0x36')][_0xae9e('0x39')]?_0xf15ec0[_0xae9e('0x36')]:_0x3762cd[_0xae9e('0x37')];_0xf15ec0['order']=qs[_0xae9e('0x3d')](_0x5cc29e[_0xae9e('0x33')][_0xae9e('0x3d')]);_0xf15ec0[_0xae9e('0x3e')]=qs['filters'](_[_0xae9e('0x3f')](_0x5cc29e['query'],_0x3762cd['filters']));if(_0x5cc29e[_0xae9e('0x33')]['filter']){_0xf15ec0[_0xae9e('0x3e')]=_[_0xae9e('0x41')](_0xf15ec0[_0xae9e('0x3e')],{'$or':_['map'](_0xf15ec0[_0xae9e('0x36')],function(_0x388390){var _0x2abf61={};_0x2abf61[_0x388390]={'$like':'%'+_0x5cc29e['query'][_0xae9e('0x40')]+'%'};return _0x2abf61;})});}_0xf15ec0=_[_0xae9e('0x41')]({},_0xf15ec0,_0x5cc29e[_0xae9e('0x43')]);return _0x54474b['getDescriptions'](_0xf15ec0);}})[_0xae9e('0x25')](function(_0x6ea713){if(_0x6ea713){_0x5be019=_0x6ea713['length'];if(!_0x5cc29e['query'][_0xae9e('0x3a')](_0xae9e('0x3b'))){_0xf15ec0[_0xae9e('0x1d')]=qs['limit'](_0x5cc29e[_0xae9e('0x33')][_0xae9e('0x1d')]);_0xf15ec0[_0xae9e('0x1b')]=qs['offset'](_0x5cc29e[_0xae9e('0x33')][_0xae9e('0x1b')]);}return _0x54474b['getDescriptions'](_0xf15ec0);}})[_0xae9e('0x25')](function(_0x1a8874){if(_0x1a8874){return _0x1a8874?{'count':_0x5be019,'rows':_0x1a8874}:null;}})[_0xae9e('0x25')](respondWithResult(_0x1bc0c2,null))[_0xae9e('0x46')](handleError(_0x1bc0c2,null));};exports[_0xae9e('0x51')]=function(_0x24e6aa,_0x4ffca8,_0x319618){var _0x1a7c60={};var _0x16bc50={};var _0x4e9ed6;var _0xc58c9e;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x24e6aa[_0xae9e('0x47')]['id']}})[_0xae9e('0x25')](handleEntityNotFound(_0x4ffca8,null))[_0xae9e('0x25')](function(_0x15ed91){if(_0x15ed91){_0x4e9ed6=_0x15ed91;_0x16bc50[_0xae9e('0x37')]=_[_0xae9e('0x32')](db[_0xae9e('0x52')][_0xae9e('0x2d')]);_0x16bc50[_0xae9e('0x33')]=_[_0xae9e('0x32')](_0x24e6aa[_0xae9e('0x33')]);_0x16bc50[_0xae9e('0x34')]=_[_0xae9e('0x35')](_0x16bc50['model'],_0x16bc50[_0xae9e('0x33')]);_0x1a7c60[_0xae9e('0x36')]=_[_0xae9e('0x35')](_0x16bc50[_0xae9e('0x37')],qs['fields'](_0x24e6aa['query']['fields']));_0x1a7c60['attributes']=_0x1a7c60[_0xae9e('0x36')][_0xae9e('0x39')]?_0x1a7c60[_0xae9e('0x36')]:_0x16bc50[_0xae9e('0x37')];_0x1a7c60[_0xae9e('0x3c')]=qs[_0xae9e('0x3d')](_0x24e6aa[_0xae9e('0x33')][_0xae9e('0x3d')]);_0x1a7c60[_0xae9e('0x3e')]=qs[_0xae9e('0x34')](_[_0xae9e('0x3f')](_0x24e6aa['query'],_0x16bc50[_0xae9e('0x34')]));if(_0x24e6aa['query'][_0xae9e('0x40')]){_0x1a7c60[_0xae9e('0x3e')]=_[_0xae9e('0x41')](_0x1a7c60['where'],{'$or':_[_0xae9e('0x31')](_0x1a7c60[_0xae9e('0x36')],function(_0x109a0a){var _0x759869={};_0x759869[_0x109a0a]={'$like':'%'+_0x24e6aa[_0xae9e('0x33')][_0xae9e('0x40')]+'%'};return _0x759869;})});}_0x1a7c60=_[_0xae9e('0x41')]({},_0x1a7c60,_0x24e6aa[_0xae9e('0x43')]);return _0x4e9ed6[_0xae9e('0x51')](_0x1a7c60);}})['then'](function(_0x4e3b7f){if(_0x4e3b7f){_0xc58c9e=_0x4e3b7f['length'];if(!_0x24e6aa[_0xae9e('0x33')][_0xae9e('0x3a')]('nolimit')){_0x1a7c60['limit']=qs[_0xae9e('0x1d')](_0x24e6aa['query'][_0xae9e('0x1d')]);_0x1a7c60[_0xae9e('0x1b')]=qs[_0xae9e('0x1b')](_0x24e6aa[_0xae9e('0x33')][_0xae9e('0x1b')]);}return _0x4e9ed6[_0xae9e('0x51')](_0x1a7c60);}})[_0xae9e('0x25')](function(_0xd649d3){if(_0xd649d3){return _0xd649d3?{'count':_0xc58c9e,'rows':_0xd649d3}:null;}})['then'](respondWithResult(_0x4ffca8,null))[_0xae9e('0x46')](handleError(_0x4ffca8,null));};exports[_0xae9e('0x53')]=function(_0x22ff90,_0x15c6e3,_0x50a4d8){if(_0x22ff90['body']['id']){delete _0x22ff90[_0xae9e('0x4b')]['id'];}return db[_0xae9e('0x2c')][_0xae9e('0x4d')]({'where':{'id':_0x22ff90[_0xae9e('0x47')]['id']}})[_0xae9e('0x25')](handleEntityNotFound(_0x15c6e3,null))[_0xae9e('0x25')](function(_0x4c287c){if(_0x4c287c){return _0x4c287c[_0xae9e('0x53')](_0x22ff90[_0xae9e('0x4b')]['ids']||[]);}return null;})[_0xae9e('0x25')](respondWithResult(_0x15c6e3,null))[_0xae9e('0x46')](handleError(_0x15c6e3,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 9816997..b26f080 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 _0xd843=['rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x46efd7,_0x43f84d){var _0x5637e4=function(_0x54e078){while(--_0x54e078){_0x46efd7['push'](_0x46efd7['shift']());}};_0x5637e4(++_0x43f84d);}(_0xd843,0x6f));var _0x3d84=function(_0x4283c0,_0xc694d5){_0x4283c0=_0x4283c0-0x0;var _0x6b47ab=_0xd843[_0x4283c0];return _0x6b47ab;};'use strict';var _=require('lodash');var util=require(_0x3d84('0x0'));var logger=require(_0x3d84('0x1'))(_0x3d84('0x2'));var moment=require(_0x3d84('0x3'));var BPromise=require(_0x3d84('0x4'));var rp=require(_0x3d84('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3d84('0x6'));var config=require(_0x3d84('0x7'));var attributes=require(_0x3d84('0x8'));module[_0x3d84('0x9')]=function(_0xa19cfb,_0x3c2a5d){return _0xa19cfb[_0x3d84('0xa')](_0x3d84('0xb'),attributes,{'tableName':_0x3d84('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0ad=['FreshdeskConfiguration','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define'];(function(_0x32ab39,_0x3124ee){var _0x361feb=function(_0x5292d1){while(--_0x5292d1){_0x32ab39['push'](_0x32ab39['shift']());}};_0x361feb(++_0x3124ee);}(_0xa0ad,0x181));var _0xda0a=function(_0x2df1f2,_0x58d388){_0x2df1f2=_0x2df1f2-0x0;var _0x38652b=_0xa0ad[_0x2df1f2];return _0x38652b;};'use strict';var _=require(_0xda0a('0x0'));var util=require(_0xda0a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xda0a('0x2'));var BPromise=require(_0xda0a('0x3'));var rp=require(_0xda0a('0x4'));var fs=require('fs');var path=require(_0xda0a('0x5'));var rimraf=require(_0xda0a('0x6'));var config=require(_0xda0a('0x7'));var attributes=require(_0xda0a('0x8'));module[_0xda0a('0x9')]=function(_0x42d6f6,_0x2a4d27){return _0x42d6f6[_0xda0a('0xa')](_0xda0a('0xb'),attributes,{'tableName':'int_freshdesk_configurations','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 c97530b..5085d5f 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 _0x180c=['debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s'];(function(_0x4e8402,_0x292280){var _0x1fefa0=function(_0x330865){while(--_0x330865){_0x4e8402['push'](_0x4e8402['shift']());}};_0x1fefa0(++_0x292280);}(_0x180c,0xa9));var _0xc180=function(_0x341391,_0x5ceb77){_0x341391=_0x341391-0x0;var _0x27f420=_0x180c[_0x341391];return _0x27f420;};'use strict';var _=require(_0xc180('0x0'));var util=require(_0xc180('0x1'));var moment=require('moment');var BPromise=require(_0xc180('0x2'));var rs=require(_0xc180('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc180('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc180('0x5'))(_0xc180('0x6'));var config=require(_0xc180('0x7'));var jayson=require(_0xc180('0x8'));var client=jayson[_0xc180('0x9')][_0xc180('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34aa54,_0x259841,_0x135333){return new BPromise(function(_0x4fecae,_0x21cfc4){return client[_0xc180('0xb')](_0x34aa54,_0x135333)[_0xc180('0xc')](function(_0x294a25){logger[_0xc180('0xd')](_0xc180('0xe'),_0x259841,'request\x20sent');logger[_0xc180('0xf')](_0xc180('0x10'),_0x259841,_0xc180('0x11'),JSON[_0xc180('0x12')](_0x294a25));if(_0x294a25[_0xc180('0x13')]){if(_0x294a25['error'][_0xc180('0x14')]===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x259841,_0x294a25[_0xc180('0x13')][_0xc180('0x15')]);return _0x21cfc4(_0x294a25[_0xc180('0x13')][_0xc180('0x15')]);}logger['error'](_0xc180('0xe'),_0x259841,_0x294a25[_0xc180('0x13')]['message']);return _0x4fecae(_0x294a25['error'][_0xc180('0x15')]);}else{logger[_0xc180('0xd')](_0xc180('0xe'),_0x259841,'request\x20sent');_0x4fecae(_0x294a25['result']['message']);}})[_0xc180('0x16')](function(_0x51ad27){logger[_0xc180('0x13')](_0xc180('0xe'),_0x259841,_0x51ad27);_0x21cfc4(_0x51ad27);});});} \ No newline at end of file +var _0x591a=['FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x323419,_0x2a6172){var _0x4c0be7=function(_0x5ae2df){while(--_0x5ae2df){_0x323419['push'](_0x323419['shift']());}};_0x4c0be7(++_0x2a6172);}(_0x591a,0x16e));var _0xa591=function(_0x3a0863,_0x4cd5ef){_0x3a0863=_0x3a0863-0x0;var _0x85c557=_0x591a[_0x3a0863];return _0x85c557;};'use strict';var _=require('lodash');var util=require(_0xa591('0x0'));var moment=require(_0xa591('0x1'));var BPromise=require(_0xa591('0x2'));var rs=require(_0xa591('0x3'));var fs=require('fs');var Redis=require(_0xa591('0x4'));var db=require(_0xa591('0x5'))['db'];var utils=require(_0xa591('0x6'));var logger=require(_0xa591('0x7'))(_0xa591('0x8'));var config=require('../../config/environment');var jayson=require(_0xa591('0x9'));var client=jayson[_0xa591('0xa')][_0xa591('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19c86f,_0x555a08,_0x5e54e1){return new BPromise(function(_0x3485fb,_0x229613){return client[_0xa591('0xc')](_0x19c86f,_0x5e54e1)[_0xa591('0xd')](function(_0xdf664a){logger[_0xa591('0xe')](_0xa591('0xf'),_0x555a08,_0xa591('0x10'));logger[_0xa591('0x11')](_0xa591('0x12'),_0x555a08,_0xa591('0x10'),JSON['stringify'](_0xdf664a));if(_0xdf664a[_0xa591('0x13')]){if(_0xdf664a[_0xa591('0x13')][_0xa591('0x14')]===0x1f4){logger[_0xa591('0x13')](_0xa591('0xf'),_0x555a08,_0xdf664a[_0xa591('0x13')]['message']);return _0x229613(_0xdf664a[_0xa591('0x13')][_0xa591('0x15')]);}logger[_0xa591('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x555a08,_0xdf664a[_0xa591('0x13')]['message']);return _0x3485fb(_0xdf664a['error'][_0xa591('0x15')]);}else{logger[_0xa591('0xe')](_0xa591('0xf'),_0x555a08,'request\x20sent');_0x3485fb(_0xdf664a[_0xa591('0x16')][_0xa591('0x15')]);}})[_0xa591('0x17')](function(_0x265ea2){logger[_0xa591('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x555a08,_0x265ea2);_0x229613(_0x265ea2);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 9a28a21..71f0d14 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 _0x10d1=['create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','post'];(function(_0x1abb50,_0x3d160a){var _0x3acece=function(_0x4a9c89){while(--_0x4a9c89){_0x1abb50['push'](_0x1abb50['shift']());}};_0x3acece(++_0x3d160a);}(_0x10d1,0x101));var _0x110d=function(_0x54c516,_0x420575){_0x54c516=_0x54c516-0x0;var _0x2583c0=_0x10d1[_0x54c516];return _0x2583c0;};'use strict';var multer=require(_0x110d('0x0'));var util=require(_0x110d('0x1'));var path=require(_0x110d('0x2'));var timeout=require('connect-timeout');var express=require(_0x110d('0x3'));var router=express[_0x110d('0x4')]();var fs_extra=require(_0x110d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x110d('0x6'));var controller=require(_0x110d('0x7'));router[_0x110d('0x8')]('/',auth[_0x110d('0x9')](),controller[_0x110d('0xa')]);router[_0x110d('0x8')](_0x110d('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x110d('0xc')]('/',auth['isAuthenticated'](),controller[_0x110d('0xd')]);router['put'](_0x110d('0xb'),auth[_0x110d('0x9')](),controller[_0x110d('0xe')]);router[_0x110d('0xf')](_0x110d('0xb'),auth[_0x110d('0x9')](),controller[_0x110d('0x10')]);module[_0x110d('0x11')]=router; \ No newline at end of file +var _0xd437=['express','Router','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','create','delete','destroy','multer','util','path','connect-timeout'];(function(_0x3725ee,_0x543bd9){var _0x399c71=function(_0xaf9400){while(--_0xaf9400){_0x3725ee['push'](_0x3725ee['shift']());}};_0x399c71(++_0x543bd9);}(_0xd437,0x12c));var _0x7d43=function(_0x4d3d50,_0x50f156){_0x4d3d50=_0x4d3d50-0x0;var _0x175e6d=_0xd437[_0x4d3d50];return _0x175e6d;};'use strict';var multer=require(_0x7d43('0x0'));var util=require(_0x7d43('0x1'));var path=require(_0x7d43('0x2'));var timeout=require(_0x7d43('0x3'));var express=require(_0x7d43('0x4'));var router=express[_0x7d43('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7d43('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7d43('0x7'));var controller=require('./intFreshdeskField.controller');router[_0x7d43('0x8')]('/',auth['isAuthenticated'](),controller[_0x7d43('0x9')]);router['get'](_0x7d43('0xa'),auth[_0x7d43('0xb')](),controller[_0x7d43('0xc')]);router['post']('/',auth[_0x7d43('0xb')](),controller[_0x7d43('0xd')]);router['put'](_0x7d43('0xa'),auth[_0x7d43('0xb')](),controller['update']);router[_0x7d43('0xe')](_0x7d43('0xa'),auth[_0x7d43('0xb')](),controller[_0x7d43('0xf')]);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 094f101..423ab1a 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 _0x3b40=['picklist','STRING','sequelize','ENUM','string','variable','customVariable'];(function(_0x16478e,_0x544885){var _0x177b0f=function(_0x38a703){while(--_0x38a703){_0x16478e['push'](_0x16478e['shift']());}};_0x177b0f(++_0x544885);}(_0x3b40,0x144));var _0x03b4=function(_0x3643c9,_0xbec7ea){_0x3643c9=_0x3643c9-0x0;var _0x7e778a=_0x3b40[_0x3643c9];return _0x7e778a;};'use strict';var Sequelize=require(_0x03b4('0x0'));module['exports']={'type':{'type':Sequelize[_0x03b4('0x1')](_0x03b4('0x2'),_0x03b4('0x3'),_0x03b4('0x4'),'keyValue',_0x03b4('0x5')),'defaultValue':_0x03b4('0x2')},'content':{'type':Sequelize[_0x03b4('0x6')]},'key':{'type':Sequelize[_0x03b4('0x6')]},'keyType':{'type':Sequelize[_0x03b4('0x1')](_0x03b4('0x2'),_0x03b4('0x3'),_0x03b4('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x03b4('0x6')]},'nameField':{'type':Sequelize[_0x03b4('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa9c5=['string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','ENUM'];(function(_0x2c35d1,_0x254e3b){var _0x202c20=function(_0x33b0cb){while(--_0x33b0cb){_0x2c35d1['push'](_0x2c35d1['shift']());}};_0x202c20(++_0x254e3b);}(_0xa9c5,0x1db));var _0x5a9c=function(_0x334850,_0x20dbce){_0x334850=_0x334850-0x0;var _0x2a78c5=_0xa9c5[_0x334850];return _0x2a78c5;};'use strict';var Sequelize=require(_0x5a9c('0x0'));module['exports']={'type':{'type':Sequelize[_0x5a9c('0x1')](_0x5a9c('0x2'),_0x5a9c('0x3'),'customVariable',_0x5a9c('0x4'),_0x5a9c('0x5')),'defaultValue':_0x5a9c('0x2')},'content':{'type':Sequelize[_0x5a9c('0x6')]},'key':{'type':Sequelize[_0x5a9c('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x5a9c('0x2'),_0x5a9c('0x3'),_0x5a9c('0x7'))},'keyContent':{'type':Sequelize[_0x5a9c('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5a9c('0x6')]},'customField':{'type':Sequelize[_0x5a9c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5a9c('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 54cda9a..09296ff 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 _0xa571=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','save','update','then','destroy','end','error','name','index','map','FreshdeskField','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','show','params','rawAttributes','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0xa571,0x107));var _0x1a57=function(_0x2430e5,_0x45fbd4){_0x2430e5=_0x2430e5-0x0;var _0x4bfbe9=_0xa571[_0x2430e5];return _0x4bfbe9;};'use strict';var emlformat=require(_0x1a57('0x0'));var rimraf=require(_0x1a57('0x1'));var zipdir=require(_0x1a57('0x2'));var jsonpatch=require(_0x1a57('0x3'));var rp=require('request-promise');var moment=require(_0x1a57('0x4'));var BPromise=require(_0x1a57('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1a57('0x6'));var sox=require('sox');var csv=require(_0x1a57('0x7'));var ejs=require(_0x1a57('0x8'));var fs=require('fs');var fs_extra=require(_0x1a57('0x9'));var _=require(_0x1a57('0xa'));var squel=require(_0x1a57('0xb'));var crypto=require(_0x1a57('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1a57('0xd'));var toCsv=require(_0x1a57('0x7'));var querystring=require(_0x1a57('0xe'));var Papa=require('papaparse');var Redis=require(_0x1a57('0xf'));var authService=require(_0x1a57('0x10'));var qs=require(_0x1a57('0x11'));var as=require(_0x1a57('0x12'));var hardwareService=require(_0x1a57('0x13'));var logger=require(_0x1a57('0x14'))(_0x1a57('0x15'));var utils=require(_0x1a57('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a57('0x17'))['db'];function respondWithStatusCode(_0x1911b2,_0x202d9a){_0x202d9a=_0x202d9a||0xcc;return function(_0x5ae643){if(_0x5ae643){return _0x1911b2[_0x1a57('0x18')](_0x202d9a);}return _0x1911b2[_0x1a57('0x19')](_0x202d9a)['end']();};}function respondWithResult(_0x503278,_0x587422){_0x587422=_0x587422||0xc8;return function(_0xd08107){if(_0xd08107){return _0x503278[_0x1a57('0x19')](_0x587422)[_0x1a57('0x1a')](_0xd08107);}};}function respondWithFilteredResult(_0x153d01,_0x5802d6){return function(_0x20f7ad){if(_0x20f7ad){var _0x53c61f=typeof _0x5802d6['offset']===_0x1a57('0x1b')&&typeof _0x5802d6[_0x1a57('0x1c')]===_0x1a57('0x1b');var _0x51b4c2=_0x20f7ad[_0x1a57('0x1d')];var _0x1662a3=_0x53c61f?0x0:_0x5802d6[_0x1a57('0x1e')];var _0x53bb20=_0x53c61f?_0x20f7ad[_0x1a57('0x1d')]:_0x5802d6[_0x1a57('0x1e')]+_0x5802d6[_0x1a57('0x1c')];var _0xcba6b7;if(_0x53bb20>=_0x51b4c2){_0x53bb20=_0x51b4c2;_0xcba6b7=0xc8;}else{_0xcba6b7=0xce;}_0x153d01[_0x1a57('0x19')](_0xcba6b7);return _0x153d01['set']('Content-Range',_0x1662a3+'-'+_0x53bb20+'/'+_0x51b4c2)[_0x1a57('0x1a')](_0x20f7ad);}return null;};}function patchUpdates(_0x21e811){return function(_0x211c63){try{jsonpatch['apply'](_0x211c63,_0x21e811,!![]);}catch(_0x5c200e){return BPromise['reject'](_0x5c200e);}return _0x211c63[_0x1a57('0x1f')]();};}function saveUpdates(_0x113ad4,_0x3f52b9){return function(_0xee133b){if(_0xee133b){return _0xee133b[_0x1a57('0x20')](_0x113ad4)[_0x1a57('0x21')](function(_0x2efa49){return _0x2efa49;});}return null;};}function removeEntity(_0x2f8b00,_0x183ca3){return function(_0x35d5dc){if(_0x35d5dc){return _0x35d5dc[_0x1a57('0x22')]()[_0x1a57('0x21')](function(){_0x2f8b00[_0x1a57('0x19')](0xcc)[_0x1a57('0x23')]();});}};}function handleEntityNotFound(_0x2f9454,_0x182649){return function(_0x25c1e9){if(!_0x25c1e9){_0x2f9454[_0x1a57('0x18')](0x194);}return _0x25c1e9;};}function handleError(_0x27cfe1,_0xf6ffef){_0xf6ffef=_0xf6ffef||0x1f4;return function(_0x26584b){logger[_0x1a57('0x24')](_0x26584b['stack']);if(_0x26584b['name']){delete _0x26584b[_0x1a57('0x25')];}_0x27cfe1[_0x1a57('0x19')](_0xf6ffef)['send'](_0x26584b);};}exports[_0x1a57('0x26')]=function(_0x54f6a5,_0x2d8738){var _0x4a2901={},_0x53bf6e={},_0x8179a4={'count':0x0,'rows':[]};var _0x274fe6=_[_0x1a57('0x27')](db[_0x1a57('0x28')]['rawAttributes'],function(_0x366d5f){return{'name':_0x366d5f[_0x1a57('0x29')],'type':_0x366d5f[_0x1a57('0x2a')][_0x1a57('0x2b')]};});_0x53bf6e['model']=_[_0x1a57('0x27')](_0x274fe6,_0x1a57('0x25'));_0x53bf6e[_0x1a57('0x2c')]=_[_0x1a57('0x2d')](_0x54f6a5[_0x1a57('0x2c')]);_0x53bf6e[_0x1a57('0x2e')]=_[_0x1a57('0x2f')](_0x53bf6e[_0x1a57('0x30')],_0x53bf6e[_0x1a57('0x2c')]);_0x4a2901['attributes']=_[_0x1a57('0x2f')](_0x53bf6e[_0x1a57('0x30')],qs['fields'](_0x54f6a5['query'][_0x1a57('0x31')]));_0x4a2901[_0x1a57('0x32')]=_0x4a2901[_0x1a57('0x32')][_0x1a57('0x33')]?_0x4a2901[_0x1a57('0x32')]:_0x53bf6e[_0x1a57('0x30')];if(!_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x34')](_0x1a57('0x35'))){_0x4a2901[_0x1a57('0x1c')]=qs[_0x1a57('0x1c')](_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x1c')]);_0x4a2901[_0x1a57('0x1e')]=qs[_0x1a57('0x1e')](_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x1e')]);}_0x4a2901[_0x1a57('0x36')]=qs['sort'](_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x37')]);_0x4a2901[_0x1a57('0x38')]=qs[_0x1a57('0x2e')](_[_0x1a57('0x39')](_0x54f6a5[_0x1a57('0x2c')],_0x53bf6e[_0x1a57('0x2e')]),_0x274fe6);if(_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x3a')]){_0x4a2901['where']=_['merge'](_0x4a2901['where'],{'$or':_['map'](_0x274fe6,function(_0x333b32){if(_0x333b32[_0x1a57('0x2a')]!==_0x1a57('0x3b')){var _0x4d6e1e={};_0x4d6e1e[_0x333b32[_0x1a57('0x25')]]={'$like':'%'+_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x3a')]+'%'};return _0x4d6e1e;}})});}_0x4a2901=_[_0x1a57('0x3c')]({},_0x4a2901,_0x54f6a5['options']);var _0x1be254={'where':_0x4a2901['where']};return db[_0x1a57('0x28')][_0x1a57('0x1d')](_0x1be254)[_0x1a57('0x21')](function(_0x534a9a){_0x8179a4[_0x1a57('0x1d')]=_0x534a9a;if(_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x3d')]){_0x4a2901[_0x1a57('0x3e')]=[{'all':!![]}];}return db[_0x1a57('0x28')]['findAll'](_0x4a2901);})[_0x1a57('0x21')](function(_0x47e998){_0x8179a4['rows']=_0x47e998;return _0x8179a4;})[_0x1a57('0x21')](respondWithFilteredResult(_0x2d8738,_0x4a2901))['catch'](handleError(_0x2d8738,null));};exports[_0x1a57('0x3f')]=function(_0x398c59,_0x3fbae1){var _0x59abb1={'raw':!![],'where':{'id':_0x398c59[_0x1a57('0x40')]['id']}},_0x188a50={};_0x188a50[_0x1a57('0x30')]=_[_0x1a57('0x2d')](db['FreshdeskField'][_0x1a57('0x41')]);_0x188a50[_0x1a57('0x2c')]=_['keys'](_0x398c59[_0x1a57('0x2c')]);_0x188a50['filters']=_['intersection'](_0x188a50[_0x1a57('0x30')],_0x188a50[_0x1a57('0x2c')]);_0x59abb1[_0x1a57('0x32')]=_[_0x1a57('0x2f')](_0x188a50['model'],qs[_0x1a57('0x31')](_0x398c59[_0x1a57('0x2c')][_0x1a57('0x31')]));_0x59abb1[_0x1a57('0x32')]=_0x59abb1[_0x1a57('0x32')]['length']?_0x59abb1[_0x1a57('0x32')]:_0x188a50[_0x1a57('0x30')];if(_0x398c59[_0x1a57('0x2c')][_0x1a57('0x3d')]){_0x59abb1['include']=[{'all':!![]}];}_0x59abb1=_[_0x1a57('0x3c')]({},_0x59abb1,_0x398c59['options']);return db[_0x1a57('0x28')][_0x1a57('0x42')](_0x59abb1)[_0x1a57('0x21')](handleEntityNotFound(_0x3fbae1,null))[_0x1a57('0x21')](respondWithResult(_0x3fbae1,null))[_0x1a57('0x43')](handleError(_0x3fbae1,null));};exports[_0x1a57('0x44')]=function(_0x28f629,_0x401285){return db[_0x1a57('0x28')][_0x1a57('0x44')](_0x28f629[_0x1a57('0x45')],{})[_0x1a57('0x21')](respondWithResult(_0x401285,0xc9))[_0x1a57('0x43')](handleError(_0x401285,null));};exports['update']=function(_0xf4d056,_0x480aff){if(_0xf4d056[_0x1a57('0x45')]['id']){delete _0xf4d056[_0x1a57('0x45')]['id'];}return db[_0x1a57('0x28')][_0x1a57('0x42')]({'where':{'id':_0xf4d056[_0x1a57('0x40')]['id']}})[_0x1a57('0x21')](handleEntityNotFound(_0x480aff,null))[_0x1a57('0x21')](saveUpdates(_0xf4d056[_0x1a57('0x45')],null))[_0x1a57('0x21')](respondWithResult(_0x480aff,null))['catch'](handleError(_0x480aff,null));};exports[_0x1a57('0x22')]=function(_0x439a42,_0x51651d){return db[_0x1a57('0x28')][_0x1a57('0x42')]({'where':{'id':_0x439a42['params']['id']}})[_0x1a57('0x21')](handleEntityNotFound(_0x51651d,null))[_0x1a57('0x21')](removeEntity(_0x51651d,null))['catch'](handleError(_0x51651d,null));}; \ No newline at end of file +var _0x705f=['Content-Range','json','apply','save','update','then','destroy','error','stack','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','offset','order','sort','pick','where','merge','filter','count','includeAll','FreshdeskField','findAll','rows','catch','show','rawAttributes','fields','include','options','find','create','body','params','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit'];(function(_0x42a5be,_0x64e90c){var _0x31cb93=function(_0x2e55a4){while(--_0x2e55a4){_0x42a5be['push'](_0x42a5be['shift']());}};_0x31cb93(++_0x64e90c);}(_0x705f,0x75));var _0xf705=function(_0x44a573,_0x1e6efc){_0x44a573=_0x44a573-0x0;var _0x4babc6=_0x705f[_0x44a573];return _0x4babc6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf705('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf705('0x1'));var moment=require(_0xf705('0x2'));var BPromise=require(_0xf705('0x3'));var Mustache=require(_0xf705('0x4'));var util=require(_0xf705('0x5'));var path=require(_0xf705('0x6'));var sox=require(_0xf705('0x7'));var csv=require(_0xf705('0x8'));var ejs=require(_0xf705('0x9'));var fs=require('fs');var fs_extra=require(_0xf705('0xa'));var _=require(_0xf705('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf705('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf705('0x8'));var querystring=require(_0xf705('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf705('0xe'));var qs=require(_0xf705('0xf'));var as=require(_0xf705('0x10'));var hardwareService=require(_0xf705('0x11'));var logger=require(_0xf705('0x12'))(_0xf705('0x13'));var utils=require(_0xf705('0x14'));var config=require(_0xf705('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf705('0x16'))['db'];function respondWithStatusCode(_0x296a62,_0xb50c9f){_0xb50c9f=_0xb50c9f||0xcc;return function(_0xf625da){if(_0xf625da){return _0x296a62[_0xf705('0x17')](_0xb50c9f);}return _0x296a62['status'](_0xb50c9f)['end']();};}function respondWithResult(_0x26cb9a,_0x10763f){_0x10763f=_0x10763f||0xc8;return function(_0x15d2e2){if(_0x15d2e2){return _0x26cb9a[_0xf705('0x18')](_0x10763f)['json'](_0x15d2e2);}};}function respondWithFilteredResult(_0x9c7b75,_0x23a64b){return function(_0x4555a8){if(_0x4555a8){var _0x32f48b=typeof _0x23a64b['offset']===_0xf705('0x19')&&typeof _0x23a64b['limit']===_0xf705('0x19');var _0x1c0778=_0x4555a8['count'];var _0xa9a2ca=_0x32f48b?0x0:_0x23a64b['offset'];var _0x425cd6=_0x32f48b?_0x4555a8['count']:_0x23a64b['offset']+_0x23a64b[_0xf705('0x1a')];var _0xfee2a8;if(_0x425cd6>=_0x1c0778){_0x425cd6=_0x1c0778;_0xfee2a8=0xc8;}else{_0xfee2a8=0xce;}_0x9c7b75[_0xf705('0x18')](_0xfee2a8);return _0x9c7b75['set'](_0xf705('0x1b'),_0xa9a2ca+'-'+_0x425cd6+'/'+_0x1c0778)[_0xf705('0x1c')](_0x4555a8);}return null;};}function patchUpdates(_0x8d5b49){return function(_0x57456a){try{jsonpatch[_0xf705('0x1d')](_0x57456a,_0x8d5b49,!![]);}catch(_0x4d34cd){return BPromise['reject'](_0x4d34cd);}return _0x57456a[_0xf705('0x1e')]();};}function saveUpdates(_0x1052a6,_0x2a2fb7){return function(_0x24622b){if(_0x24622b){return _0x24622b[_0xf705('0x1f')](_0x1052a6)[_0xf705('0x20')](function(_0xcab54f){return _0xcab54f;});}return null;};}function removeEntity(_0x10dfc9,_0x424d4e){return function(_0x39dddb){if(_0x39dddb){return _0x39dddb[_0xf705('0x21')]()['then'](function(){_0x10dfc9[_0xf705('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23bb4a,_0x4ccff8){return function(_0x5eadda){if(!_0x5eadda){_0x23bb4a[_0xf705('0x17')](0x194);}return _0x5eadda;};}function handleError(_0x33da21,_0x593180){_0x593180=_0x593180||0x1f4;return function(_0x4f5435){logger[_0xf705('0x22')](_0x4f5435[_0xf705('0x23')]);if(_0x4f5435[_0xf705('0x24')]){delete _0x4f5435[_0xf705('0x24')];}_0x33da21[_0xf705('0x18')](_0x593180)['send'](_0x4f5435);};}exports[_0xf705('0x25')]=function(_0x2c4a5d,_0x3a6343){var _0x54f905={},_0x4a09ab={},_0x4a0fd3={'count':0x0,'rows':[]};var _0x54ff43=_[_0xf705('0x26')](db['FreshdeskField']['rawAttributes'],function(_0x29ac24){return{'name':_0x29ac24[_0xf705('0x27')],'type':_0x29ac24[_0xf705('0x28')][_0xf705('0x29')]};});_0x4a09ab[_0xf705('0x2a')]=_['map'](_0x54ff43,'name');_0x4a09ab[_0xf705('0x2b')]=_[_0xf705('0x2c')](_0x2c4a5d[_0xf705('0x2b')]);_0x4a09ab[_0xf705('0x2d')]=_[_0xf705('0x2e')](_0x4a09ab[_0xf705('0x2a')],_0x4a09ab[_0xf705('0x2b')]);_0x54f905[_0xf705('0x2f')]=_['intersection'](_0x4a09ab[_0xf705('0x2a')],qs['fields'](_0x2c4a5d[_0xf705('0x2b')]['fields']));_0x54f905[_0xf705('0x2f')]=_0x54f905[_0xf705('0x2f')][_0xf705('0x30')]?_0x54f905[_0xf705('0x2f')]:_0x4a09ab[_0xf705('0x2a')];if(!_0x2c4a5d[_0xf705('0x2b')][_0xf705('0x31')]('nolimit')){_0x54f905[_0xf705('0x1a')]=qs[_0xf705('0x1a')](_0x2c4a5d[_0xf705('0x2b')]['limit']);_0x54f905['offset']=qs[_0xf705('0x32')](_0x2c4a5d['query'][_0xf705('0x32')]);}_0x54f905[_0xf705('0x33')]=qs[_0xf705('0x34')](_0x2c4a5d['query'][_0xf705('0x34')]);_0x54f905['where']=qs[_0xf705('0x2d')](_[_0xf705('0x35')](_0x2c4a5d[_0xf705('0x2b')],_0x4a09ab['filters']),_0x54ff43);if(_0x2c4a5d[_0xf705('0x2b')]['filter']){_0x54f905[_0xf705('0x36')]=_[_0xf705('0x37')](_0x54f905[_0xf705('0x36')],{'$or':_[_0xf705('0x26')](_0x54ff43,function(_0x38f9d5){if(_0x38f9d5[_0xf705('0x28')]!=='VIRTUAL'){var _0x2b9902={};_0x2b9902[_0x38f9d5[_0xf705('0x24')]]={'$like':'%'+_0x2c4a5d[_0xf705('0x2b')][_0xf705('0x38')]+'%'};return _0x2b9902;}})});}_0x54f905=_['merge']({},_0x54f905,_0x2c4a5d['options']);var _0x3b02f7={'where':_0x54f905[_0xf705('0x36')]};return db['FreshdeskField'][_0xf705('0x39')](_0x3b02f7)[_0xf705('0x20')](function(_0x10e28b){_0x4a0fd3['count']=_0x10e28b;if(_0x2c4a5d[_0xf705('0x2b')][_0xf705('0x3a')]){_0x54f905['include']=[{'all':!![]}];}return db[_0xf705('0x3b')][_0xf705('0x3c')](_0x54f905);})[_0xf705('0x20')](function(_0x4382cd){_0x4a0fd3[_0xf705('0x3d')]=_0x4382cd;return _0x4a0fd3;})[_0xf705('0x20')](respondWithFilteredResult(_0x3a6343,_0x54f905))[_0xf705('0x3e')](handleError(_0x3a6343,null));};exports[_0xf705('0x3f')]=function(_0x3355b1,_0x108663){var _0x343f1a={'raw':!![],'where':{'id':_0x3355b1['params']['id']}},_0x50520d={};_0x50520d['model']=_[_0xf705('0x2c')](db[_0xf705('0x3b')][_0xf705('0x40')]);_0x50520d['query']=_[_0xf705('0x2c')](_0x3355b1[_0xf705('0x2b')]);_0x50520d[_0xf705('0x2d')]=_[_0xf705('0x2e')](_0x50520d[_0xf705('0x2a')],_0x50520d[_0xf705('0x2b')]);_0x343f1a['attributes']=_['intersection'](_0x50520d[_0xf705('0x2a')],qs[_0xf705('0x41')](_0x3355b1['query'][_0xf705('0x41')]));_0x343f1a[_0xf705('0x2f')]=_0x343f1a[_0xf705('0x2f')][_0xf705('0x30')]?_0x343f1a['attributes']:_0x50520d[_0xf705('0x2a')];if(_0x3355b1[_0xf705('0x2b')]['includeAll']){_0x343f1a[_0xf705('0x42')]=[{'all':!![]}];}_0x343f1a=_[_0xf705('0x37')]({},_0x343f1a,_0x3355b1[_0xf705('0x43')]);return db[_0xf705('0x3b')][_0xf705('0x44')](_0x343f1a)[_0xf705('0x20')](handleEntityNotFound(_0x108663,null))[_0xf705('0x20')](respondWithResult(_0x108663,null))[_0xf705('0x3e')](handleError(_0x108663,null));};exports[_0xf705('0x45')]=function(_0x4a5a02,_0x5b5463){return db[_0xf705('0x3b')][_0xf705('0x45')](_0x4a5a02['body'],{})[_0xf705('0x20')](respondWithResult(_0x5b5463,0xc9))[_0xf705('0x3e')](handleError(_0x5b5463,null));};exports[_0xf705('0x1f')]=function(_0x2c6861,_0x99c560){if(_0x2c6861[_0xf705('0x46')]['id']){delete _0x2c6861['body']['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x2c6861[_0xf705('0x47')]['id']}})[_0xf705('0x20')](handleEntityNotFound(_0x99c560,null))[_0xf705('0x20')](saveUpdates(_0x2c6861['body'],null))[_0xf705('0x20')](respondWithResult(_0x99c560,null))[_0xf705('0x3e')](handleError(_0x99c560,null));};exports[_0xf705('0x21')]=function(_0x598441,_0x5b8f3f){return db['FreshdeskField'][_0xf705('0x44')]({'where':{'id':_0x598441[_0xf705('0x47')]['id']}})[_0xf705('0x20')](handleEntityNotFound(_0x5b8f3f,null))[_0xf705('0x20')](removeEntity(_0x5b8f3f,null))[_0xf705('0x3e')](handleError(_0x5b8f3f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index a3cb43f..d7660d3 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 _0x5f1e=['int_freshdesk_fields','freshdesk_unique_index','idField','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports'];(function(_0x1664ba,_0x4029b4){var _0x231115=function(_0x228197){while(--_0x228197){_0x1664ba['push'](_0x1664ba['shift']());}};_0x231115(++_0x4029b4);}(_0x5f1e,0x71));var _0xe5f1=function(_0x26a2ac,_0x4ea3eb){_0x26a2ac=_0x26a2ac-0x0;var _0x41fbe4=_0x5f1e[_0x26a2ac];return _0x41fbe4;};'use strict';var _=require('lodash');var util=require(_0xe5f1('0x0'));var logger=require(_0xe5f1('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe5f1('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe5f1('0x3'));var rimraf=require(_0xe5f1('0x4'));var config=require(_0xe5f1('0x5'));var attributes=require(_0xe5f1('0x6'));module[_0xe5f1('0x7')]=function(_0x592508,_0x4f8906){return _0x592508['define']('FreshdeskField',attributes,{'tableName':_0xe5f1('0x8'),'paranoid':![],'indexes':[{'name':_0xe5f1('0x9'),'fields':[_0xe5f1('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4b84=['rimraf','../../config/environment','FreshdeskField','freshdesk_unique_index','lodash','util','moment','path'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3c5e54,_0x2b991b){_0x3c5e54=_0x3c5e54-0x0;var _0x3ae1f3=_0x4b84[_0x3c5e54];return _0x3ae1f3;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x44b8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x44b8('0x3'));var rimraf=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var attributes=require('./intFreshdeskField.attributes');module['exports']=function(_0x55f25d,_0x996a8b){return _0x55f25d['define'](_0x44b8('0x6'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x44b8('0x7'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index cda1d4c..0dda6d3 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 _0xfb26=['request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','FreshdeskField,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb26,0xc5));var _0x6fb2=function(_0x2f2dba,_0x451d2e){_0x2f2dba=_0x2f2dba-0x0;var _0x27e85e=_0xfb26[_0x2f2dba];return _0x27e85e;};'use strict';var _=require(_0x6fb2('0x0'));var util=require(_0x6fb2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6fb2('0x2'));var fs=require('fs');var Redis=require(_0x6fb2('0x3'));var db=require(_0x6fb2('0x4'))['db'];var utils=require(_0x6fb2('0x5'));var logger=require(_0x6fb2('0x6'))(_0x6fb2('0x7'));var config=require('../../config/environment');var jayson=require(_0x6fb2('0x8'));var client=jayson['client'][_0x6fb2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x263419,_0x1ac700,_0x58b6f6){return new BPromise(function(_0x1e261c,_0x17dadd){return client['request'](_0x263419,_0x58b6f6)[_0x6fb2('0xa')](function(_0x10a832){logger[_0x6fb2('0xb')](_0x6fb2('0xc'),_0x1ac700,_0x6fb2('0xd'));logger[_0x6fb2('0xe')](_0x6fb2('0xf'),_0x1ac700,_0x6fb2('0xd'),JSON['stringify'](_0x10a832));if(_0x10a832[_0x6fb2('0x10')]){if(_0x10a832['error'][_0x6fb2('0x11')]===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x1ac700,_0x10a832['error'][_0x6fb2('0x12')]);return _0x17dadd(_0x10a832[_0x6fb2('0x10')][_0x6fb2('0x12')]);}logger['error'](_0x6fb2('0xc'),_0x1ac700,_0x10a832[_0x6fb2('0x10')]['message']);return _0x1e261c(_0x10a832[_0x6fb2('0x10')][_0x6fb2('0x12')]);}else{logger['info'](_0x6fb2('0xc'),_0x1ac700,_0x6fb2('0xd'));_0x1e261c(_0x10a832[_0x6fb2('0x13')][_0x6fb2('0x12')]);}})[_0x6fb2('0x14')](function(_0x54ff70){logger[_0x6fb2('0x10')](_0x6fb2('0xc'),_0x1ac700,_0x54ff70);_0x17dadd(_0x54ff70);});});} \ No newline at end of file +var _0xc9f7=['moment','ioredis','../../mysqldb','jayson/promise','client','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util'];(function(_0x8e95ce,_0x56226c){var _0x420563=function(_0x440710){while(--_0x440710){_0x8e95ce['push'](_0x8e95ce['shift']());}};_0x420563(++_0x56226c);}(_0xc9f7,0x1ae));var _0x7c9f=function(_0x180426,_0xc9e170){_0x180426=_0x180426-0x0;var _0x4a1f91=_0xc9f7[_0x180426];return _0x4a1f91;};'use strict';var _=require(_0x7c9f('0x0'));var util=require(_0x7c9f('0x1'));var moment=require(_0x7c9f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7c9f('0x3'));var db=require(_0x7c9f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7c9f('0x5'));var client=jayson[_0x7c9f('0x6')][_0x7c9f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xf55ad2,_0xb4d7d0,_0x5236c9){return new BPromise(function(_0xfbeb09,_0x23adad){return client[_0x7c9f('0x8')](_0xf55ad2,_0x5236c9)[_0x7c9f('0x9')](function(_0x579f36){logger['info'](_0x7c9f('0xa'),_0xb4d7d0,_0x7c9f('0xb'));logger[_0x7c9f('0xc')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0xb4d7d0,_0x7c9f('0xb'),JSON[_0x7c9f('0xd')](_0x579f36));if(_0x579f36[_0x7c9f('0xe')]){if(_0x579f36[_0x7c9f('0xe')][_0x7c9f('0xf')]===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0xb4d7d0,_0x579f36[_0x7c9f('0xe')][_0x7c9f('0x10')]);return _0x23adad(_0x579f36[_0x7c9f('0xe')][_0x7c9f('0x10')]);}logger[_0x7c9f('0xe')]('FreshdeskField,\x20%s,\x20%s',_0xb4d7d0,_0x579f36['error']['message']);return _0xfbeb09(_0x579f36[_0x7c9f('0xe')][_0x7c9f('0x10')]);}else{logger['info'](_0x7c9f('0xa'),_0xb4d7d0,'request\x20sent');_0xfbeb09(_0x579f36[_0x7c9f('0x11')]['message']);}})['catch'](function(_0x28e046){logger[_0x7c9f('0xe')](_0x7c9f('0xa'),_0xb4d7d0,_0x28e046);_0x23adad(_0x28e046);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index a4bff9f..b8a2782 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 _0xa5fa=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','create','addConfiguration','put','update','destroy','exports','util','path'];(function(_0x16a382,_0x4e7632){var _0x2503c8=function(_0x3a182c){while(--_0x3a182c){_0x16a382['push'](_0x16a382['shift']());}};_0x2503c8(++_0x4e7632);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x17d314,_0x4c6cc8){_0x17d314=_0x17d314-0x0;var _0x58e7d3=_0xa5fa[_0x17d314];return _0x58e7d3;};'use strict';var multer=require('multer');var util=require(_0xaa5f('0x0'));var path=require(_0xaa5f('0x1'));var timeout=require(_0xaa5f('0x2'));var express=require(_0xaa5f('0x3'));var router=express['Router']();var fs_extra=require(_0xaa5f('0x4'));var auth=require(_0xaa5f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaa5f('0x6'));var controller=require(_0xaa5f('0x7'));router[_0xaa5f('0x8')]('/',auth[_0xaa5f('0x9')](),controller[_0xaa5f('0xa')]);router[_0xaa5f('0x8')](_0xaa5f('0xb'),auth[_0xaa5f('0x9')](),controller[_0xaa5f('0xc')]);router[_0xaa5f('0x8')](_0xaa5f('0xd'),auth['isAuthenticated'](),controller[_0xaa5f('0xe')]);router[_0xaa5f('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xaa5f('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaa5f('0x10')]);router['post'](_0xaa5f('0xd'),auth[_0xaa5f('0x9')](),controller[_0xaa5f('0x11')]);router[_0xaa5f('0x12')](_0xaa5f('0xb'),auth['isAuthenticated'](),controller[_0xaa5f('0x13')]);router['delete'](_0xaa5f('0xb'),auth[_0xaa5f('0x9')](),controller[_0xaa5f('0x14')]);module[_0xaa5f('0x15')]=router; \ No newline at end of file +var _0x58a4=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','destroy','exports','multer'];(function(_0x36c1c4,_0x5b7e45){var _0x5c7645=function(_0x376f15){while(--_0x376f15){_0x36c1c4['push'](_0x36c1c4['shift']());}};_0x5c7645(++_0x5b7e45);}(_0x58a4,0xbf));var _0x458a=function(_0x4e8c47,_0x94ee2d){_0x4e8c47=_0x4e8c47-0x0;var _0x6c119=_0x58a4[_0x4e8c47];return _0x6c119;};'use strict';var multer=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var path=require(_0x458a('0x2'));var timeout=require(_0x458a('0x3'));var express=require(_0x458a('0x4'));var router=express[_0x458a('0x5')]();var fs_extra=require(_0x458a('0x6'));var auth=require(_0x458a('0x7'));var interaction=require(_0x458a('0x8'));var config=require(_0x458a('0x9'));var controller=require(_0x458a('0xa'));router[_0x458a('0xb')]('/',auth[_0x458a('0xc')](),controller['index']);router['get'](_0x458a('0xd'),auth[_0x458a('0xc')](),controller[_0x458a('0xe')]);router[_0x458a('0xb')](_0x458a('0xf'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x458a('0xb')](_0x458a('0x10'),auth[_0x458a('0xc')](),controller[_0x458a('0x11')]);router[_0x458a('0x12')]('/',auth['isAuthenticated'](),controller[_0x458a('0x13')]);router[_0x458a('0x12')]('/:id/configurations',auth[_0x458a('0xc')](),controller[_0x458a('0x14')]);router[_0x458a('0x15')](_0x458a('0xd'),auth[_0x458a('0xc')](),controller['update']);router['delete'](_0x458a('0xd'),auth['isAuthenticated'](),controller[_0x458a('0x16')]);module[_0x458a('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 825a056..cc9a643 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 _0x7916=['sequelize','STRING','username','remoteUri'];(function(_0xa20714,_0x291fc5){var _0x31be2b=function(_0x4ed6fb){while(--_0x4ed6fb){_0xa20714['push'](_0xa20714['shift']());}};_0x31be2b(++_0x291fc5);}(_0x7916,0x128));var _0x6791=function(_0x1d457e,_0x22f9a9){_0x1d457e=_0x1d457e-0x0;var _0x332b9d=_0x7916[_0x1d457e];return _0x332b9d;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'name':{'type':Sequelize[_0x6791('0x1')]},'description':{'type':Sequelize[_0x6791('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x6791('0x2')},'apiKey':{'type':Sequelize[_0x6791('0x1')]},'remoteUri':{'type':Sequelize[_0x6791('0x1')],'unique':_0x6791('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x1893=['STRING','username','remoteUri'];(function(_0x1e3671,_0x9ae4fc){var _0x48d5f5=function(_0xfab713){while(--_0xfab713){_0x1e3671['push'](_0x1e3671['shift']());}};_0x48d5f5(++_0x9ae4fc);}(_0x1893,0xa2));var _0x3189=function(_0x40bc4a,_0x2f4fa6){_0x40bc4a=_0x40bc4a-0x0;var _0x497b7a=_0x1893[_0x40bc4a];return _0x497b7a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3189('0x0')]},'description':{'type':Sequelize[_0x3189('0x0')]},'username':{'type':Sequelize[_0x3189('0x0')],'unique':_0x3189('0x1')},'apiKey':{'type':Sequelize[_0x3189('0x0')]},'remoteUri':{'type':Sequelize[_0x3189('0x0')],'unique':_0x3189('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index e9d697c..c949445 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 _0x53b1=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','end','error','name','send','map','FreshsalesAccount','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','include','find','update','getConfigurations','findOne','FreshsalesConfiguration','length','body','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','FreshsalesField','username','apiKey','remoteUri','substring','lastIndexOf','format','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','getFields','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x53b1,0x179));var _0x153b=function(_0x4982a0,_0x209ed5){_0x4982a0=_0x4982a0-0x0;var _0xc092=_0x53b1[_0x4982a0];return _0xc092;};'use strict';var emlformat=require(_0x153b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x153b('0x1'));var jsonpatch=require(_0x153b('0x2'));var rp=require(_0x153b('0x3'));var moment=require(_0x153b('0x4'));var BPromise=require(_0x153b('0x5'));var Mustache=require('mustache');var util=require(_0x153b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x153b('0x7'));var ejs=require(_0x153b('0x8'));var fs=require('fs');var fs_extra=require(_0x153b('0x9'));var _=require(_0x153b('0xa'));var squel=require(_0x153b('0xb'));var crypto=require('crypto');var jsforce=require(_0x153b('0xc'));var deskjs=require(_0x153b('0xd'));var toCsv=require(_0x153b('0x7'));var querystring=require(_0x153b('0xe'));var Papa=require('papaparse');var Redis=require(_0x153b('0xf'));var authService=require(_0x153b('0x10'));var qs=require(_0x153b('0x11'));var as=require(_0x153b('0x12'));var hardwareService=require(_0x153b('0x13'));var logger=require('../../config/logger')(_0x153b('0x14'));var utils=require('../../config/utils');var config=require(_0x153b('0x15'));var licenseUtil=require(_0x153b('0x16'));var db=require(_0x153b('0x17'))['db'];var integrations=require(_0x153b('0x18'));function respondWithStatusCode(_0x3a0733,_0x14b680){_0x14b680=_0x14b680||0xcc;return function(_0x9d4521){if(_0x9d4521){return _0x3a0733[_0x153b('0x19')](_0x14b680);}return _0x3a0733[_0x153b('0x1a')](_0x14b680)['end']();};}function respondWithResult(_0x2e0f4f,_0xfa4f6d){_0xfa4f6d=_0xfa4f6d||0xc8;return function(_0x41fe1d){if(_0x41fe1d){return _0x2e0f4f[_0x153b('0x1a')](_0xfa4f6d)[_0x153b('0x1b')](_0x41fe1d);}};}function respondWithFilteredResult(_0x13352c,_0x46fdbd){return function(_0x3b7a8f){if(_0x3b7a8f){var _0x471a8e=typeof _0x46fdbd[_0x153b('0x1c')]===_0x153b('0x1d')&&typeof _0x46fdbd[_0x153b('0x1e')]===_0x153b('0x1d');var _0x5b19be=_0x3b7a8f[_0x153b('0x1f')];var _0xbb2f66=_0x471a8e?0x0:_0x46fdbd[_0x153b('0x1c')];var _0x12eeeb=_0x471a8e?_0x3b7a8f[_0x153b('0x1f')]:_0x46fdbd[_0x153b('0x1c')]+_0x46fdbd[_0x153b('0x1e')];var _0x4dfdf0;if(_0x12eeeb>=_0x5b19be){_0x12eeeb=_0x5b19be;_0x4dfdf0=0xc8;}else{_0x4dfdf0=0xce;}_0x13352c['status'](_0x4dfdf0);return _0x13352c['set'](_0x153b('0x20'),_0xbb2f66+'-'+_0x12eeeb+'/'+_0x5b19be)['json'](_0x3b7a8f);}return null;};}function patchUpdates(_0x421ead){return function(_0xd3608c){try{jsonpatch[_0x153b('0x21')](_0xd3608c,_0x421ead,!![]);}catch(_0x37fab9){return BPromise[_0x153b('0x22')](_0x37fab9);}return _0xd3608c[_0x153b('0x23')]();};}function saveUpdates(_0x14d91c,_0x34308f){return function(_0x4a8e13){if(_0x4a8e13){return _0x4a8e13['update'](_0x14d91c)[_0x153b('0x24')](function(_0x381e14){return _0x381e14;});}return null;};}function removeEntity(_0x11bc56,_0x12b0cc){return function(_0x5cc5a6){if(_0x5cc5a6){return _0x5cc5a6[_0x153b('0x25')]()[_0x153b('0x24')](function(){_0x11bc56[_0x153b('0x1a')](0xcc)[_0x153b('0x26')]();});}};}function handleEntityNotFound(_0x808718,_0x984df1){return function(_0x4c0681){if(!_0x4c0681){_0x808718[_0x153b('0x19')](0x194);}return _0x4c0681;};}function handleError(_0x3726d7,_0xe1c17b){_0xe1c17b=_0xe1c17b||0x1f4;return function(_0x2914c9){logger[_0x153b('0x27')](_0x2914c9['stack']);if(_0x2914c9['name']){delete _0x2914c9[_0x153b('0x28')];}_0x3726d7['status'](_0xe1c17b)[_0x153b('0x29')](_0x2914c9);};}exports['index']=function(_0x4ad40d,_0x3c1821){var _0x1c7ee6={},_0xddeaad={},_0x3dda65={'count':0x0,'rows':[]};var _0x1b4aa7=_[_0x153b('0x2a')](db[_0x153b('0x2b')][_0x153b('0x2c')],function(_0x181a00){return{'name':_0x181a00[_0x153b('0x2d')],'type':_0x181a00['type'][_0x153b('0x2e')]};});_0xddeaad['model']=_[_0x153b('0x2a')](_0x1b4aa7,_0x153b('0x28'));_0xddeaad[_0x153b('0x2f')]=_['keys'](_0x4ad40d['query']);_0xddeaad[_0x153b('0x30')]=_[_0x153b('0x31')](_0xddeaad[_0x153b('0x32')],_0xddeaad[_0x153b('0x2f')]);_0x1c7ee6[_0x153b('0x33')]=_[_0x153b('0x31')](_0xddeaad[_0x153b('0x32')],qs[_0x153b('0x34')](_0x4ad40d[_0x153b('0x2f')][_0x153b('0x34')]));_0x1c7ee6[_0x153b('0x33')]=_0x1c7ee6[_0x153b('0x33')]['length']?_0x1c7ee6[_0x153b('0x33')]:_0xddeaad['model'];if(!_0x4ad40d[_0x153b('0x2f')][_0x153b('0x35')](_0x153b('0x36'))){_0x1c7ee6[_0x153b('0x1e')]=qs[_0x153b('0x1e')](_0x4ad40d[_0x153b('0x2f')]['limit']);_0x1c7ee6[_0x153b('0x1c')]=qs['offset'](_0x4ad40d[_0x153b('0x2f')][_0x153b('0x1c')]);}_0x1c7ee6[_0x153b('0x37')]=qs[_0x153b('0x38')](_0x4ad40d[_0x153b('0x2f')]['sort']);_0x1c7ee6['where']=qs[_0x153b('0x30')](_[_0x153b('0x39')](_0x4ad40d[_0x153b('0x2f')],_0xddeaad[_0x153b('0x30')]),_0x1b4aa7);if(_0x4ad40d[_0x153b('0x2f')][_0x153b('0x3a')]){_0x1c7ee6[_0x153b('0x3b')]=_[_0x153b('0x3c')](_0x1c7ee6[_0x153b('0x3b')],{'$or':_[_0x153b('0x2a')](_0x1b4aa7,function(_0x5d26ba){if(_0x5d26ba['type']!==_0x153b('0x3d')){var _0x474789={};_0x474789[_0x5d26ba['name']]={'$like':'%'+_0x4ad40d['query'][_0x153b('0x3a')]+'%'};return _0x474789;}})});}_0x1c7ee6=_[_0x153b('0x3c')]({},_0x1c7ee6,_0x4ad40d[_0x153b('0x3e')]);var _0x5498ae={'where':_0x1c7ee6[_0x153b('0x3b')]};return db['FreshsalesAccount'][_0x153b('0x1f')](_0x5498ae)[_0x153b('0x24')](function(_0x4c0fa9){_0x3dda65[_0x153b('0x1f')]=_0x4c0fa9;if(_0x4ad40d[_0x153b('0x2f')][_0x153b('0x3f')]){_0x1c7ee6['include']=[{'all':!![]}];}return db[_0x153b('0x2b')][_0x153b('0x40')](_0x1c7ee6);})['then'](function(_0x270f3b){_0x3dda65[_0x153b('0x41')]=_0x270f3b;return _0x3dda65;})[_0x153b('0x24')](respondWithFilteredResult(_0x3c1821,_0x1c7ee6))[_0x153b('0x42')](handleError(_0x3c1821,null));};exports['show']=function(_0x21bfdf,_0x1e1baa){var _0x12538e={'raw':![],'where':{'id':_0x21bfdf[_0x153b('0x43')]['id']}},_0x5d4b37={};_0x5d4b37[_0x153b('0x32')]=_[_0x153b('0x44')](db[_0x153b('0x2b')][_0x153b('0x2c')]);_0x5d4b37[_0x153b('0x2f')]=_['keys'](_0x21bfdf['query']);_0x5d4b37[_0x153b('0x30')]=_[_0x153b('0x31')](_0x5d4b37[_0x153b('0x32')],_0x5d4b37['query']);_0x12538e['attributes']=_[_0x153b('0x31')](_0x5d4b37[_0x153b('0x32')],qs[_0x153b('0x34')](_0x21bfdf[_0x153b('0x2f')][_0x153b('0x34')]));_0x12538e[_0x153b('0x33')]=_0x12538e[_0x153b('0x33')]['length']?_0x12538e[_0x153b('0x33')]:_0x5d4b37['model'];if(_0x21bfdf[_0x153b('0x2f')][_0x153b('0x3f')]){_0x12538e[_0x153b('0x45')]=[{'all':!![]}];}_0x12538e=_['merge']({},_0x12538e,_0x21bfdf[_0x153b('0x3e')]);return db[_0x153b('0x2b')][_0x153b('0x46')](_0x12538e)[_0x153b('0x24')](handleEntityNotFound(_0x1e1baa,null))[_0x153b('0x24')](respondWithResult(_0x1e1baa,null))[_0x153b('0x42')](handleError(_0x1e1baa,null));};exports['create']=function(_0x5c5620,_0xaeb443){return db[_0x153b('0x2b')]['create'](_0x5c5620['body'],{})['then'](respondWithResult(_0xaeb443,0xc9))[_0x153b('0x42')](handleError(_0xaeb443,null));};exports[_0x153b('0x47')]=function(_0x1f2388,_0x5a31b3){if(_0x1f2388['body']['id']){delete _0x1f2388['body']['id'];}return db['FreshsalesAccount'][_0x153b('0x46')]({'where':{'id':_0x1f2388['params']['id']}})[_0x153b('0x24')](handleEntityNotFound(_0x5a31b3,null))[_0x153b('0x24')](saveUpdates(_0x1f2388['body'],null))[_0x153b('0x24')](respondWithResult(_0x5a31b3,null))[_0x153b('0x42')](handleError(_0x5a31b3,null));};exports[_0x153b('0x25')]=function(_0x33e282,_0x47ccc8){return db[_0x153b('0x2b')]['find']({'where':{'id':_0x33e282['params']['id']}})[_0x153b('0x24')](handleEntityNotFound(_0x47ccc8,null))['then'](removeEntity(_0x47ccc8,null))[_0x153b('0x42')](handleError(_0x47ccc8,null));};exports[_0x153b('0x48')]=function(_0x344677,_0x27db0f,_0x2ebbd4){var _0x4f1e26={};var _0x9098ed={};var _0x393c0d;var _0x280f16;return db['FreshsalesAccount'][_0x153b('0x49')]({'where':{'id':_0x344677['params']['id']}})[_0x153b('0x24')](handleEntityNotFound(_0x27db0f,null))[_0x153b('0x24')](function(_0xffc4fc){if(_0xffc4fc){_0x393c0d=_0xffc4fc;_0x9098ed['model']=_[_0x153b('0x44')](db[_0x153b('0x4a')][_0x153b('0x2c')]);_0x9098ed[_0x153b('0x2f')]=_[_0x153b('0x44')](_0x344677[_0x153b('0x2f')]);_0x9098ed[_0x153b('0x30')]=_[_0x153b('0x31')](_0x9098ed['model'],_0x9098ed[_0x153b('0x2f')]);_0x4f1e26[_0x153b('0x33')]=_['intersection'](_0x9098ed[_0x153b('0x32')],qs['fields'](_0x344677[_0x153b('0x2f')]['fields']));_0x4f1e26[_0x153b('0x33')]=_0x4f1e26[_0x153b('0x33')][_0x153b('0x4b')]?_0x4f1e26[_0x153b('0x33')]:_0x9098ed[_0x153b('0x32')];_0x4f1e26[_0x153b('0x37')]=qs[_0x153b('0x38')](_0x344677[_0x153b('0x2f')][_0x153b('0x38')]);_0x4f1e26['where']=qs[_0x153b('0x30')](_[_0x153b('0x39')](_0x344677[_0x153b('0x2f')],_0x9098ed[_0x153b('0x30')]));if(_0x344677[_0x153b('0x2f')][_0x153b('0x3a')]){_0x4f1e26['where']=_['merge'](_0x4f1e26[_0x153b('0x3b')],{'$or':_[_0x153b('0x2a')](_0x4f1e26[_0x153b('0x33')],function(_0x3ddd90){var _0x36ddfd={};_0x36ddfd[_0x3ddd90]={'$like':'%'+_0x344677[_0x153b('0x2f')]['filter']+'%'};return _0x36ddfd;})});}_0x4f1e26=_[_0x153b('0x3c')]({},_0x4f1e26,_0x344677['options']);return _0x393c0d[_0x153b('0x48')](_0x4f1e26);}})[_0x153b('0x24')](function(_0x52093a){if(_0x52093a){_0x280f16=_0x52093a[_0x153b('0x4b')];if(!_0x344677['query'][_0x153b('0x35')](_0x153b('0x36'))){_0x4f1e26[_0x153b('0x1e')]=qs[_0x153b('0x1e')](_0x344677[_0x153b('0x2f')][_0x153b('0x1e')]);_0x4f1e26[_0x153b('0x1c')]=qs[_0x153b('0x1c')](_0x344677[_0x153b('0x2f')][_0x153b('0x1c')]);}return _0x393c0d[_0x153b('0x48')](_0x4f1e26);}})[_0x153b('0x24')](function(_0xa6c98d){if(_0xa6c98d){return _0xa6c98d?{'count':_0x280f16,'rows':_0xa6c98d}:null;}})[_0x153b('0x24')](respondWithResult(_0x27db0f,null))[_0x153b('0x42')](handleError(_0x27db0f,null));};exports['addConfiguration']=function(_0x14c4fb,_0x197dc1,_0x3ce3c8){if(_0x14c4fb[_0x153b('0x4c')]['id']){delete _0x14c4fb[_0x153b('0x4c')]['id'];}return db['FreshsalesAccount'][_0x153b('0x49')]({'where':{'id':_0x14c4fb[_0x153b('0x43')]['id']}})['then'](handleEntityNotFound(_0x197dc1,null))[_0x153b('0x24')](function(_0x26a0f9){if(_0x26a0f9){_0x14c4fb['body'][_0x153b('0x4d')]=_0x26a0f9['id'];_0x14c4fb[_0x153b('0x4c')][_0x153b('0x4e')]=integrations[_0x153b('0x4f')](_0x14c4fb[_0x153b('0x4c')][_0x153b('0x50')],_0x14c4fb[_0x153b('0x4c')][_0x153b('0x51')]);_0x14c4fb['body'][_0x153b('0x52')]=integrations[_0x153b('0x53')](_0x14c4fb[_0x153b('0x4c')][_0x153b('0x50')],_0x14c4fb[_0x153b('0x4c')]['type']);return db['FreshsalesConfiguration']['create'](_0x14c4fb[_0x153b('0x4c')],{'include':[{'model':db[_0x153b('0x54')],'as':_0x153b('0x4e')},{'model':db[_0x153b('0x54')],'as':_0x153b('0x52')}]});}return null;})[_0x153b('0x24')](respondWithResult(_0x197dc1,null))[_0x153b('0x42')](handleError(_0x197dc1,null));};exports['getFields']=function(_0x5f4167,_0x3bc445,_0x6f4114){var _0x298442='';var _0x558dc6='';return db[_0x153b('0x2b')]['findOne']({'where':{'id':_0x5f4167['params']['id']},'attributes':['id',_0x153b('0x55'),'remoteUri',_0x153b('0x56')]})[_0x153b('0x24')](handleEntityNotFound(_0x3bc445,null))['then'](function(_0xa303a0){if(_0xa303a0){_0x558dc6=_0xa303a0['username'];_0x298442=_0xa303a0[_0x153b('0x57')];var _0x4e23ed=_0xa303a0[_0x153b('0x57')]['slice'](-0x1);if(_0x4e23ed==='/'){_0x298442=_0x298442[_0x153b('0x58')](0x0,_0x298442[_0x153b('0x59')](_0x4e23ed));}return rp({'method':'GET','uri':util[_0x153b('0x5a')]('%s%s',_0x298442,'/api/selector/owners'),'headers':{'Authorization':_0x153b('0x5b')+_0xa303a0['apiKey']},'json':!![]});}})[_0x153b('0x24')](function(_0x2aec1b){if(_0x2aec1b){var _0x529fff=_0x2aec1b[_0x153b('0x5c')];var _0x57b1b5=![];var _0xe379cd=null;for(_0xe379cd=0x0;_0xe379cd<_0x529fff[_0x153b('0x4b')];_0xe379cd++){if(_0x529fff[_0xe379cd]['email']===_0x558dc6){_0x57b1b5=!![];}}if(_0x57b1b5){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x153b('0x5d')});}}})['then'](respondWithResult(_0x3bc445,null))[_0x153b('0x42')](function(_0x5c85f2){var _0x46b693=_0x5f4167[_0x153b('0x2f')][_0x153b('0x5e')]?0x1f4:_0x5c85f2['statusCode']||0x1f4;logger[_0x153b('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x153b('0x5f'),_0x46b693,JSON[_0x153b('0x60')](_0x5c85f2));delete _0x5c85f2[_0x153b('0x28')];if(_0x46b693===0x191){_0x46b693=0x190;}_0x3bc445[_0x153b('0x1a')](_0x46b693)['send'](_0x5f4167[_0x153b('0x2f')][_0x153b('0x5e')]?{'message':_0x153b('0x61'),'statusCode':_0x5c85f2['statusCode']}:_0x5c85f2);});}; \ No newline at end of file +var _0xe20f=['getFields','remoteUri','apiKey','slice','substring','GET','format','%s%s','Token\x20token=','Requested\x20Resource\x20not\x20Found','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','map','FreshsalesAccount','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','options','findAll','rows','catch','params','include','create','body','find','getConfigurations','findOne','FreshsalesConfiguration','order','filter','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField'];(function(_0x393ad5,_0x2a7a68){var _0x31f723=function(_0x4877c){while(--_0x4877c){_0x393ad5['push'](_0x393ad5['shift']());}};_0x31f723(++_0x2a7a68);}(_0xe20f,0x144));var _0xfe20=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe20f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xfe20('0x0'));var rimraf=require(_0xfe20('0x1'));var zipdir=require(_0xfe20('0x2'));var jsonpatch=require(_0xfe20('0x3'));var rp=require(_0xfe20('0x4'));var moment=require(_0xfe20('0x5'));var BPromise=require(_0xfe20('0x6'));var Mustache=require(_0xfe20('0x7'));var util=require(_0xfe20('0x8'));var path=require('path');var sox=require(_0xfe20('0x9'));var csv=require(_0xfe20('0xa'));var ejs=require(_0xfe20('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfe20('0xc'));var squel=require(_0xfe20('0xd'));var crypto=require(_0xfe20('0xe'));var jsforce=require(_0xfe20('0xf'));var deskjs=require(_0xfe20('0x10'));var toCsv=require(_0xfe20('0xa'));var querystring=require(_0xfe20('0x11'));var Papa=require('papaparse');var Redis=require(_0xfe20('0x12'));var authService=require(_0xfe20('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xfe20('0x14'));var hardwareService=require(_0xfe20('0x15'));var logger=require(_0xfe20('0x16'))(_0xfe20('0x17'));var utils=require(_0xfe20('0x18'));var config=require(_0xfe20('0x19'));var licenseUtil=require(_0xfe20('0x1a'));var db=require(_0xfe20('0x1b'))['db'];var integrations=require(_0xfe20('0x1c'));function respondWithStatusCode(_0x209a8c,_0x388625){_0x388625=_0x388625||0xcc;return function(_0x41ef49){if(_0x41ef49){return _0x209a8c[_0xfe20('0x1d')](_0x388625);}return _0x209a8c['status'](_0x388625)['end']();};}function respondWithResult(_0x456168,_0x351bf7){_0x351bf7=_0x351bf7||0xc8;return function(_0x15fa79){if(_0x15fa79){return _0x456168[_0xfe20('0x1e')](_0x351bf7)[_0xfe20('0x1f')](_0x15fa79);}};}function respondWithFilteredResult(_0x11a07d,_0x2802d8){return function(_0x1bafa2){if(_0x1bafa2){var _0x328cbf=typeof _0x2802d8[_0xfe20('0x20')]===_0xfe20('0x21')&&typeof _0x2802d8[_0xfe20('0x22')]==='undefined';var _0x843891=_0x1bafa2[_0xfe20('0x23')];var _0x1c4f74=_0x328cbf?0x0:_0x2802d8['offset'];var _0x279c13=_0x328cbf?_0x1bafa2[_0xfe20('0x23')]:_0x2802d8[_0xfe20('0x20')]+_0x2802d8[_0xfe20('0x22')];var _0x2dcf35;if(_0x279c13>=_0x843891){_0x279c13=_0x843891;_0x2dcf35=0xc8;}else{_0x2dcf35=0xce;}_0x11a07d[_0xfe20('0x1e')](_0x2dcf35);return _0x11a07d[_0xfe20('0x24')](_0xfe20('0x25'),_0x1c4f74+'-'+_0x279c13+'/'+_0x843891)[_0xfe20('0x1f')](_0x1bafa2);}return null;};}function patchUpdates(_0xb5d3e4){return function(_0xfa325c){try{jsonpatch[_0xfe20('0x26')](_0xfa325c,_0xb5d3e4,!![]);}catch(_0x54e1f6){return BPromise[_0xfe20('0x27')](_0x54e1f6);}return _0xfa325c[_0xfe20('0x28')]();};}function saveUpdates(_0x1666d0,_0x193a55){return function(_0x2348b6){if(_0x2348b6){return _0x2348b6[_0xfe20('0x29')](_0x1666d0)[_0xfe20('0x2a')](function(_0x446bee){return _0x446bee;});}return null;};}function removeEntity(_0x57bb5c,_0x4505f9){return function(_0x49480f){if(_0x49480f){return _0x49480f[_0xfe20('0x2b')]()[_0xfe20('0x2a')](function(){_0x57bb5c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x196cdb,_0x123fa5){return function(_0xbd3a24){if(!_0xbd3a24){_0x196cdb[_0xfe20('0x1d')](0x194);}return _0xbd3a24;};}function handleError(_0x38132a,_0x193a1e){_0x193a1e=_0x193a1e||0x1f4;return function(_0xe1d0be){logger['error'](_0xe1d0be['stack']);if(_0xe1d0be[_0xfe20('0x2c')]){delete _0xe1d0be['name'];}_0x38132a[_0xfe20('0x1e')](_0x193a1e)[_0xfe20('0x2d')](_0xe1d0be);};}exports['index']=function(_0x4c4563,_0x2d85af){var _0x5cb73e={},_0x3e814d={},_0x480bad={'count':0x0,'rows':[]};var _0x51c448=_[_0xfe20('0x2e')](db[_0xfe20('0x2f')][_0xfe20('0x30')],function(_0x53a8da){return{'name':_0x53a8da['fieldName'],'type':_0x53a8da[_0xfe20('0x31')][_0xfe20('0x32')]};});_0x3e814d['model']=_['map'](_0x51c448,'name');_0x3e814d[_0xfe20('0x33')]=_[_0xfe20('0x34')](_0x4c4563[_0xfe20('0x33')]);_0x3e814d[_0xfe20('0x35')]=_[_0xfe20('0x36')](_0x3e814d[_0xfe20('0x37')],_0x3e814d[_0xfe20('0x33')]);_0x5cb73e[_0xfe20('0x38')]=_[_0xfe20('0x36')](_0x3e814d[_0xfe20('0x37')],qs[_0xfe20('0x39')](_0x4c4563[_0xfe20('0x33')][_0xfe20('0x39')]));_0x5cb73e[_0xfe20('0x38')]=_0x5cb73e[_0xfe20('0x38')][_0xfe20('0x3a')]?_0x5cb73e[_0xfe20('0x38')]:_0x3e814d[_0xfe20('0x37')];if(!_0x4c4563[_0xfe20('0x33')][_0xfe20('0x3b')]('nolimit')){_0x5cb73e[_0xfe20('0x22')]=qs['limit'](_0x4c4563[_0xfe20('0x33')][_0xfe20('0x22')]);_0x5cb73e['offset']=qs[_0xfe20('0x20')](_0x4c4563[_0xfe20('0x33')][_0xfe20('0x20')]);}_0x5cb73e['order']=qs[_0xfe20('0x3c')](_0x4c4563[_0xfe20('0x33')]['sort']);_0x5cb73e[_0xfe20('0x3d')]=qs['filters'](_[_0xfe20('0x3e')](_0x4c4563[_0xfe20('0x33')],_0x3e814d[_0xfe20('0x35')]),_0x51c448);if(_0x4c4563[_0xfe20('0x33')]['filter']){_0x5cb73e[_0xfe20('0x3d')]=_[_0xfe20('0x3f')](_0x5cb73e[_0xfe20('0x3d')],{'$or':_[_0xfe20('0x2e')](_0x51c448,function(_0x3d458b){if(_0x3d458b[_0xfe20('0x31')]!==_0xfe20('0x40')){var _0x36ec3b={};_0x36ec3b[_0x3d458b[_0xfe20('0x2c')]]={'$like':'%'+_0x4c4563[_0xfe20('0x33')]['filter']+'%'};return _0x36ec3b;}})});}_0x5cb73e=_[_0xfe20('0x3f')]({},_0x5cb73e,_0x4c4563[_0xfe20('0x41')]);var _0x14894d={'where':_0x5cb73e[_0xfe20('0x3d')]};return db['FreshsalesAccount']['count'](_0x14894d)['then'](function(_0x407bc6){_0x480bad[_0xfe20('0x23')]=_0x407bc6;if(_0x4c4563[_0xfe20('0x33')]['includeAll']){_0x5cb73e['include']=[{'all':!![]}];}return db[_0xfe20('0x2f')][_0xfe20('0x42')](_0x5cb73e);})[_0xfe20('0x2a')](function(_0x3e5167){_0x480bad[_0xfe20('0x43')]=_0x3e5167;return _0x480bad;})[_0xfe20('0x2a')](respondWithFilteredResult(_0x2d85af,_0x5cb73e))[_0xfe20('0x44')](handleError(_0x2d85af,null));};exports['show']=function(_0x223db4,_0x2457dc){var _0x2b0c08={'raw':![],'where':{'id':_0x223db4[_0xfe20('0x45')]['id']}},_0x375aec={};_0x375aec['model']=_[_0xfe20('0x34')](db[_0xfe20('0x2f')][_0xfe20('0x30')]);_0x375aec['query']=_[_0xfe20('0x34')](_0x223db4['query']);_0x375aec[_0xfe20('0x35')]=_[_0xfe20('0x36')](_0x375aec[_0xfe20('0x37')],_0x375aec[_0xfe20('0x33')]);_0x2b0c08['attributes']=_['intersection'](_0x375aec['model'],qs[_0xfe20('0x39')](_0x223db4['query'][_0xfe20('0x39')]));_0x2b0c08[_0xfe20('0x38')]=_0x2b0c08[_0xfe20('0x38')][_0xfe20('0x3a')]?_0x2b0c08[_0xfe20('0x38')]:_0x375aec[_0xfe20('0x37')];if(_0x223db4[_0xfe20('0x33')]['includeAll']){_0x2b0c08[_0xfe20('0x46')]=[{'all':!![]}];}_0x2b0c08=_[_0xfe20('0x3f')]({},_0x2b0c08,_0x223db4['options']);return db['FreshsalesAccount']['find'](_0x2b0c08)[_0xfe20('0x2a')](handleEntityNotFound(_0x2457dc,null))[_0xfe20('0x2a')](respondWithResult(_0x2457dc,null))['catch'](handleError(_0x2457dc,null));};exports[_0xfe20('0x47')]=function(_0x190aa2,_0x3837a5){return db['FreshsalesAccount'][_0xfe20('0x47')](_0x190aa2[_0xfe20('0x48')],{})[_0xfe20('0x2a')](respondWithResult(_0x3837a5,0xc9))[_0xfe20('0x44')](handleError(_0x3837a5,null));};exports[_0xfe20('0x29')]=function(_0x5c9ea9,_0x2242c8){if(_0x5c9ea9[_0xfe20('0x48')]['id']){delete _0x5c9ea9[_0xfe20('0x48')]['id'];}return db[_0xfe20('0x2f')][_0xfe20('0x49')]({'where':{'id':_0x5c9ea9[_0xfe20('0x45')]['id']}})['then'](handleEntityNotFound(_0x2242c8,null))[_0xfe20('0x2a')](saveUpdates(_0x5c9ea9[_0xfe20('0x48')],null))[_0xfe20('0x2a')](respondWithResult(_0x2242c8,null))[_0xfe20('0x44')](handleError(_0x2242c8,null));};exports[_0xfe20('0x2b')]=function(_0x215931,_0xc5d07c){return db['FreshsalesAccount'][_0xfe20('0x49')]({'where':{'id':_0x215931[_0xfe20('0x45')]['id']}})[_0xfe20('0x2a')](handleEntityNotFound(_0xc5d07c,null))['then'](removeEntity(_0xc5d07c,null))[_0xfe20('0x44')](handleError(_0xc5d07c,null));};exports[_0xfe20('0x4a')]=function(_0xdac5ce,_0x47126b,_0x5230ea){var _0x1b229e={};var _0x3cc5b6={};var _0x2141a8;var _0x577fc8;return db[_0xfe20('0x2f')][_0xfe20('0x4b')]({'where':{'id':_0xdac5ce[_0xfe20('0x45')]['id']}})[_0xfe20('0x2a')](handleEntityNotFound(_0x47126b,null))['then'](function(_0x3b234b){if(_0x3b234b){_0x2141a8=_0x3b234b;_0x3cc5b6[_0xfe20('0x37')]=_[_0xfe20('0x34')](db[_0xfe20('0x4c')]['rawAttributes']);_0x3cc5b6[_0xfe20('0x33')]=_[_0xfe20('0x34')](_0xdac5ce['query']);_0x3cc5b6[_0xfe20('0x35')]=_['intersection'](_0x3cc5b6[_0xfe20('0x37')],_0x3cc5b6[_0xfe20('0x33')]);_0x1b229e['attributes']=_[_0xfe20('0x36')](_0x3cc5b6[_0xfe20('0x37')],qs[_0xfe20('0x39')](_0xdac5ce['query'][_0xfe20('0x39')]));_0x1b229e[_0xfe20('0x38')]=_0x1b229e[_0xfe20('0x38')]['length']?_0x1b229e[_0xfe20('0x38')]:_0x3cc5b6['model'];_0x1b229e[_0xfe20('0x4d')]=qs[_0xfe20('0x3c')](_0xdac5ce[_0xfe20('0x33')]['sort']);_0x1b229e['where']=qs[_0xfe20('0x35')](_[_0xfe20('0x3e')](_0xdac5ce[_0xfe20('0x33')],_0x3cc5b6[_0xfe20('0x35')]));if(_0xdac5ce[_0xfe20('0x33')][_0xfe20('0x4e')]){_0x1b229e[_0xfe20('0x3d')]=_[_0xfe20('0x3f')](_0x1b229e[_0xfe20('0x3d')],{'$or':_[_0xfe20('0x2e')](_0x1b229e['attributes'],function(_0x361285){var _0x500b4c={};_0x500b4c[_0x361285]={'$like':'%'+_0xdac5ce['query'][_0xfe20('0x4e')]+'%'};return _0x500b4c;})});}_0x1b229e=_[_0xfe20('0x3f')]({},_0x1b229e,_0xdac5ce['options']);return _0x2141a8[_0xfe20('0x4a')](_0x1b229e);}})[_0xfe20('0x2a')](function(_0x2e9cdc){if(_0x2e9cdc){_0x577fc8=_0x2e9cdc[_0xfe20('0x3a')];if(!_0xdac5ce['query']['hasOwnProperty'](_0xfe20('0x4f'))){_0x1b229e[_0xfe20('0x22')]=qs['limit'](_0xdac5ce['query'][_0xfe20('0x22')]);_0x1b229e[_0xfe20('0x20')]=qs[_0xfe20('0x20')](_0xdac5ce[_0xfe20('0x33')][_0xfe20('0x20')]);}return _0x2141a8['getConfigurations'](_0x1b229e);}})['then'](function(_0x2ffc31){if(_0x2ffc31){return _0x2ffc31?{'count':_0x577fc8,'rows':_0x2ffc31}:null;}})['then'](respondWithResult(_0x47126b,null))[_0xfe20('0x44')](handleError(_0x47126b,null));};exports[_0xfe20('0x50')]=function(_0x4ccf24,_0xd1c1b4,_0x3250fe){if(_0x4ccf24[_0xfe20('0x48')]['id']){delete _0x4ccf24['body']['id'];}return db[_0xfe20('0x2f')][_0xfe20('0x4b')]({'where':{'id':_0x4ccf24[_0xfe20('0x45')]['id']}})[_0xfe20('0x2a')](handleEntityNotFound(_0xd1c1b4,null))[_0xfe20('0x2a')](function(_0x1e1bd5){if(_0x1e1bd5){_0x4ccf24[_0xfe20('0x48')][_0xfe20('0x51')]=_0x1e1bd5['id'];_0x4ccf24['body'][_0xfe20('0x52')]=integrations[_0xfe20('0x53')](_0x4ccf24[_0xfe20('0x48')][_0xfe20('0x54')],_0x4ccf24[_0xfe20('0x48')][_0xfe20('0x31')]);_0x4ccf24[_0xfe20('0x48')][_0xfe20('0x55')]=integrations[_0xfe20('0x56')](_0x4ccf24['body'][_0xfe20('0x54')],_0x4ccf24[_0xfe20('0x48')][_0xfe20('0x31')]);return db[_0xfe20('0x4c')]['create'](_0x4ccf24[_0xfe20('0x48')],{'include':[{'model':db[_0xfe20('0x57')],'as':'Subjects'},{'model':db[_0xfe20('0x57')],'as':_0xfe20('0x55')}]});}return null;})[_0xfe20('0x2a')](respondWithResult(_0xd1c1b4,null))['catch'](handleError(_0xd1c1b4,null));};exports[_0xfe20('0x58')]=function(_0x4d9a42,_0x2e8905,_0x24cbae){var _0x5af301='';var _0x4108fe='';return db[_0xfe20('0x2f')][_0xfe20('0x4b')]({'where':{'id':_0x4d9a42['params']['id']},'attributes':['id','username',_0xfe20('0x59'),_0xfe20('0x5a')]})[_0xfe20('0x2a')](handleEntityNotFound(_0x2e8905,null))['then'](function(_0x3c1484){if(_0x3c1484){_0x4108fe=_0x3c1484['username'];_0x5af301=_0x3c1484['remoteUri'];var _0x4c2f3b=_0x3c1484[_0xfe20('0x59')][_0xfe20('0x5b')](-0x1);if(_0x4c2f3b==='/'){_0x5af301=_0x5af301[_0xfe20('0x5c')](0x0,_0x5af301['lastIndexOf'](_0x4c2f3b));}return rp({'method':_0xfe20('0x5d'),'uri':util[_0xfe20('0x5e')](_0xfe20('0x5f'),_0x5af301,'/api/selector/owners'),'headers':{'Authorization':_0xfe20('0x60')+_0x3c1484['apiKey']},'json':!![]});}})[_0xfe20('0x2a')](function(_0x22859e){if(_0x22859e){var _0xaf996f=_0x22859e['users'];var _0x27fc2a=![];var _0x29fea8=null;for(_0x29fea8=0x0;_0x29fea8<_0xaf996f[_0xfe20('0x3a')];_0x29fea8++){if(_0xaf996f[_0x29fea8]['email']===_0x4108fe){_0x27fc2a=!![];}}if(_0x27fc2a){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xfe20('0x61')});}}})['then'](respondWithResult(_0x2e8905,null))[_0xfe20('0x44')](function(_0x1012a3){var _0xee5e8=_0x4d9a42[_0xfe20('0x33')][_0xfe20('0x62')]?0x1f4:_0x1012a3[_0xfe20('0x63')]||0x1f4;logger[_0xfe20('0x64')](_0xfe20('0x65'),_0xfe20('0x58'),_0xee5e8,JSON['stringify'](_0x1012a3));delete _0x1012a3[_0xfe20('0x2c')];if(_0xee5e8===0x191){_0xee5e8=0x190;}_0x2e8905[_0xfe20('0x1e')](_0xee5e8)[_0xfe20('0x2d')](_0x4d9a42[_0xfe20('0x33')][_0xfe20('0x62')]?{'message':_0xfe20('0x66'),'statusCode':_0x1012a3[_0xfe20('0x63')]}:_0x1012a3);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 0c9d701..5d87e52 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 _0x53ec=['path','../../config/environment','./intFreshsalesAccount.attributes','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x53ec,0x192));var _0xc53e=function(_0x12fc6d,_0x1b2dc1){_0x12fc6d=_0x12fc6d-0x0;var _0x2929f0=_0x53ec[_0x12fc6d];return _0x2929f0;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xc53e('0x9')]=function(_0x4f989b,_0x41a9e8){return _0x4f989b[_0xc53e('0xa')]('FreshsalesAccount',attributes,{'tableName':_0xc53e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a6b=['request-promise','path','rimraf','./intFreshsalesAccount.attributes','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','moment'];(function(_0x1e9483,_0x1a4949){var _0x4b7e09=function(_0x3aa731){while(--_0x3aa731){_0x1e9483['push'](_0x1e9483['shift']());}};_0x4b7e09(++_0x1a4949);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x2e20fb,_0x5b5c93){_0x2e20fb=_0x2e20fb-0x0;var _0x5e445a=_0x0a6b[_0x2e20fb];return _0x5e445a;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb0a6('0x1'));var BPromise=require('bluebird');var rp=require(_0xb0a6('0x2'));var fs=require('fs');var path=require(_0xb0a6('0x3'));var rimraf=require(_0xb0a6('0x4'));var config=require('../../config/environment');var attributes=require(_0xb0a6('0x5'));var integrations=require('../../components/integrations/configuration');module[_0xb0a6('0x6')]=function(_0x415e9e,_0x5e2d2d){return _0x415e9e[_0xb0a6('0x7')](_0xb0a6('0x8'),attributes,{'tableName':_0xb0a6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 5e47639..2aed166 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 _0x77e6=['result','catch','FreshsalesAccount','findAll','options','where','attributes','limit','include','model','map','GetFreshsalesAccount','ShowFreshsalesAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message'];(function(_0x439aed,_0x2990e7){var _0x471319=function(_0xc22d59){while(--_0xc22d59){_0x439aed['push'](_0x439aed['shift']());}};_0x471319(++_0x2990e7);}(_0x77e6,0x1a6));var _0x677e=function(_0x46fbb0,_0x56fc16){_0x46fbb0=_0x46fbb0-0x0;var _0x31de61=_0x77e6[_0x46fbb0];return _0x31de61;};'use strict';var _=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var moment=require(_0x677e('0x2'));var BPromise=require(_0x677e('0x3'));var rs=require(_0x677e('0x4'));var fs=require('fs');var Redis=require(_0x677e('0x5'));var db=require(_0x677e('0x6'))['db'];var utils=require(_0x677e('0x7'));var logger=require('../../config/logger')(_0x677e('0x8'));var config=require(_0x677e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x677e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40d314,_0x4d1a57,_0x5a5dd3){return new BPromise(function(_0x2eb40c,_0x4c519f){return client[_0x677e('0xb')](_0x40d314,_0x5a5dd3)[_0x677e('0xc')](function(_0x552931){logger[_0x677e('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x4d1a57,_0x677e('0xe'));logger[_0x677e('0xf')](_0x677e('0x10'),_0x4d1a57,_0x677e('0xe'),JSON[_0x677e('0x11')](_0x552931));if(_0x552931[_0x677e('0x12')]){if(_0x552931[_0x677e('0x12')][_0x677e('0x13')]===0x1f4){logger[_0x677e('0x12')](_0x677e('0x14'),_0x4d1a57,_0x552931[_0x677e('0x12')][_0x677e('0x15')]);return _0x4c519f(_0x552931[_0x677e('0x12')][_0x677e('0x15')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x4d1a57,_0x552931['error'][_0x677e('0x15')]);return _0x2eb40c(_0x552931[_0x677e('0x12')][_0x677e('0x15')]);}else{logger[_0x677e('0xd')](_0x677e('0x14'),_0x4d1a57,_0x677e('0xe'));_0x2eb40c(_0x552931[_0x677e('0x16')][_0x677e('0x15')]);}})[_0x677e('0x17')](function(_0x32d306){logger[_0x677e('0x12')](_0x677e('0x14'),_0x4d1a57,_0x32d306);_0x4c519f(_0x32d306);});});}exports['GetFreshsalesAccount']=function(_0x1c5124){var _0x2ef2bf=this;return new Promise(function(_0x385b06,_0x221b6d){return db[_0x677e('0x18')][_0x677e('0x19')]({'raw':_0x1c5124['options']?_0x1c5124[_0x677e('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1c5124[_0x677e('0x1a')]?_0x1c5124[_0x677e('0x1a')][_0x677e('0x1b')]||null:null,'attributes':_0x1c5124['options']?_0x1c5124[_0x677e('0x1a')][_0x677e('0x1c')]||null:null,'limit':_0x1c5124[_0x677e('0x1a')]?_0x1c5124[_0x677e('0x1a')][_0x677e('0x1d')]||null:null,'include':_0x1c5124[_0x677e('0x1a')]?_0x1c5124[_0x677e('0x1a')]['include']?_['map'](_0x1c5124['options'][_0x677e('0x1e')],function(_0x154fce){return{'model':db[_0x154fce[_0x677e('0x1f')]],'as':_0x154fce['as'],'attributes':_0x154fce[_0x677e('0x1c')],'include':_0x154fce[_0x677e('0x1e')]?_[_0x677e('0x20')](_0x154fce[_0x677e('0x1e')],function(_0x42f2b8){return{'model':db[_0x42f2b8[_0x677e('0x1f')]],'as':_0x42f2b8['as'],'attributes':_0x42f2b8[_0x677e('0x1c')],'include':_0x42f2b8['include']?_['map'](_0x42f2b8[_0x677e('0x1e')],function(_0x184f68){return{'model':db[_0x184f68['model']],'as':_0x184f68['as'],'attributes':_0x184f68[_0x677e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x677e('0xc')](function(_0xf6b3ad){logger[_0x677e('0xd')](_0x677e('0x21'),_0x1c5124);logger[_0x677e('0xf')]('GetFreshsalesAccount',_0x1c5124,JSON[_0x677e('0x11')](_0xf6b3ad));_0x385b06(_0xf6b3ad);})[_0x677e('0x17')](function(_0xeca8e2){logger[_0x677e('0x12')](_0x677e('0x21'),_0xeca8e2[_0x677e('0x15')],_0x1c5124);_0x221b6d(_0x2ef2bf[_0x677e('0x12')](0x1f4,_0xeca8e2[_0x677e('0x15')]));});});};exports[_0x677e('0x22')]=function(_0x4c5113){var _0x22ccfb=this;return new Promise(function(_0x3cac19,_0x2fb815){return db[_0x677e('0x18')][_0x677e('0x23')]({'raw':_0x4c5113[_0x677e('0x1a')]?_0x4c5113[_0x677e('0x1a')][_0x677e('0x24')]===undefined?!![]:![]:!![],'where':_0x4c5113[_0x677e('0x1a')]?_0x4c5113[_0x677e('0x1a')]['where']||null:null,'attributes':_0x4c5113[_0x677e('0x1a')]?_0x4c5113[_0x677e('0x1a')][_0x677e('0x1c')]||null:null,'include':_0x4c5113[_0x677e('0x1a')]?_0x4c5113[_0x677e('0x1a')][_0x677e('0x1e')]?_['map'](_0x4c5113[_0x677e('0x1a')][_0x677e('0x1e')],function(_0x2d0bc0){return{'model':db[_0x2d0bc0['model']],'as':_0x2d0bc0['as'],'attributes':_0x2d0bc0[_0x677e('0x1c')],'include':_0x2d0bc0[_0x677e('0x1e')]?_[_0x677e('0x20')](_0x2d0bc0[_0x677e('0x1e')],function(_0x35c945){return{'model':db[_0x35c945['model']],'as':_0x35c945['as'],'attributes':_0x35c945[_0x677e('0x1c')],'include':_0x35c945[_0x677e('0x1e')]?_[_0x677e('0x20')](_0x35c945[_0x677e('0x1e')],function(_0x548b22){return{'model':db[_0x548b22[_0x677e('0x1f')]],'as':_0x548b22['as'],'attributes':_0x548b22[_0x677e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x677e('0xc')](function(_0x576443){logger['info'](_0x677e('0x22'),_0x4c5113);logger[_0x677e('0xf')]('ShowFreshsalesAccount',_0x4c5113,JSON[_0x677e('0x11')](_0x576443));_0x3cac19(_0x576443);})[_0x677e('0x17')](function(_0x497dca){logger['error'](_0x677e('0x22'),_0x497dca[_0x677e('0x15')],_0x4c5113);_0x2fb815(_0x22ccfb['error'](0x1f4,_0x497dca['message']));});});}; \ No newline at end of file +var _0x5fab=['map','model','info','ShowFreshsalesAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesAccount,\x20%s,\x20%s','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','include','attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5fab,0x177));var _0xb5fa=function(_0x41d6c7,_0xc0db02){_0x41d6c7=_0x41d6c7-0x0;var _0x36ed7d=_0x5fab[_0x41d6c7];return _0x36ed7d;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});}exports[_0xb5fa('0x18')]=function(_0x32e9e5){var _0x46eef0=this;return new Promise(function(_0x324ba5,_0x13e82b){return db[_0xb5fa('0x19')][_0xb5fa('0x1a')]({'raw':_0x32e9e5[_0xb5fa('0x1b')]?_0x32e9e5[_0xb5fa('0x1b')][_0xb5fa('0x1c')]===undefined?!![]:![]:!![],'where':_0x32e9e5[_0xb5fa('0x1b')]?_0x32e9e5['options'][_0xb5fa('0x1d')]||null:null,'attributes':_0x32e9e5['options']?_0x32e9e5[_0xb5fa('0x1b')]['attributes']||null:null,'limit':_0x32e9e5[_0xb5fa('0x1b')]?_0x32e9e5[_0xb5fa('0x1b')]['limit']||null:null,'include':_0x32e9e5[_0xb5fa('0x1b')]?_0x32e9e5[_0xb5fa('0x1b')][_0xb5fa('0x1e')]?_['map'](_0x32e9e5[_0xb5fa('0x1b')][_0xb5fa('0x1e')],function(_0x444237){return{'model':db[_0x444237['model']],'as':_0x444237['as'],'attributes':_0x444237[_0xb5fa('0x1f')],'include':_0x444237['include']?_[_0xb5fa('0x20')](_0x444237[_0xb5fa('0x1e')],function(_0x11053a){return{'model':db[_0x11053a[_0xb5fa('0x21')]],'as':_0x11053a['as'],'attributes':_0x11053a[_0xb5fa('0x1f')],'include':_0x11053a[_0xb5fa('0x1e')]?_[_0xb5fa('0x20')](_0x11053a[_0xb5fa('0x1e')],function(_0x568870){return{'model':db[_0x568870['model']],'as':_0x568870['as'],'attributes':_0x568870['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x28a350){logger[_0xb5fa('0x22')](_0xb5fa('0x18'),_0x32e9e5);logger[_0xb5fa('0xf')](_0xb5fa('0x18'),_0x32e9e5,JSON[_0xb5fa('0x11')](_0x28a350));_0x324ba5(_0x28a350);})[_0xb5fa('0x17')](function(_0x353314){logger[_0xb5fa('0x12')](_0xb5fa('0x18'),_0x353314[_0xb5fa('0x14')],_0x32e9e5);_0x13e82b(_0x46eef0[_0xb5fa('0x12')](0x1f4,_0x353314[_0xb5fa('0x14')]));});});};exports[_0xb5fa('0x23')]=function(_0xed02e){var _0x116773=this;return new Promise(function(_0x5a0152,_0x3fd1fb){return db[_0xb5fa('0x19')][_0xb5fa('0x24')]({'raw':_0xed02e[_0xb5fa('0x1b')]?_0xed02e[_0xb5fa('0x1b')][_0xb5fa('0x1c')]===undefined?!![]:![]:!![],'where':_0xed02e[_0xb5fa('0x1b')]?_0xed02e['options'][_0xb5fa('0x1d')]||null:null,'attributes':_0xed02e['options']?_0xed02e['options']['attributes']||null:null,'include':_0xed02e[_0xb5fa('0x1b')]?_0xed02e['options'][_0xb5fa('0x1e')]?_['map'](_0xed02e['options'][_0xb5fa('0x1e')],function(_0x934b49){return{'model':db[_0x934b49['model']],'as':_0x934b49['as'],'attributes':_0x934b49['attributes'],'include':_0x934b49[_0xb5fa('0x1e')]?_[_0xb5fa('0x20')](_0x934b49[_0xb5fa('0x1e')],function(_0x560b53){return{'model':db[_0x560b53[_0xb5fa('0x21')]],'as':_0x560b53['as'],'attributes':_0x560b53[_0xb5fa('0x1f')],'include':_0x560b53['include']?_[_0xb5fa('0x20')](_0x560b53[_0xb5fa('0x1e')],function(_0x204d6b){return{'model':db[_0x204d6b['model']],'as':_0x204d6b['as'],'attributes':_0x204d6b[_0xb5fa('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb5fa('0xd')](function(_0x24ef11){logger['info'](_0xb5fa('0x23'),_0xed02e);logger[_0xb5fa('0xf')](_0xb5fa('0x23'),_0xed02e,JSON[_0xb5fa('0x11')](_0x24ef11));_0x5a0152(_0x24ef11);})['catch'](function(_0x4bba91){logger['error']('ShowFreshsalesAccount',_0x4bba91['message'],_0xed02e);_0x3fd1fb(_0x116773['error'](0x1f4,_0x4bba91[_0xb5fa('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index cd07751..b993485 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 _0x8cb9=['get','isAuthenticated','show','/:id/subjects','getSubjects','/:id/fields','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8cb9,0xfe));var _0x98cb=function(_0x5bdd57,_0x29236b){_0x5bdd57=_0x5bdd57-0x0;var _0x3385e9=_0x8cb9[_0x5bdd57];return _0x3385e9;};'use strict';var multer=require('multer');var util=require(_0x98cb('0x0'));var path=require(_0x98cb('0x1'));var timeout=require(_0x98cb('0x2'));var express=require(_0x98cb('0x3'));var router=express[_0x98cb('0x4')]();var fs_extra=require(_0x98cb('0x5'));var auth=require(_0x98cb('0x6'));var interaction=require(_0x98cb('0x7'));var config=require(_0x98cb('0x8'));var controller=require(_0x98cb('0x9'));router[_0x98cb('0xa')]('/',auth[_0x98cb('0xb')](),controller['index']);router['get']('/:id',auth[_0x98cb('0xb')](),controller[_0x98cb('0xc')]);router[_0x98cb('0xa')](_0x98cb('0xd'),auth[_0x98cb('0xb')](),controller[_0x98cb('0xe')]);router[_0x98cb('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router['get'](_0x98cb('0xf'),auth[_0x98cb('0xb')](),controller['getFields']);router[_0x98cb('0x10')]('/',auth['isAuthenticated'](),controller[_0x98cb('0x11')]);router[_0x98cb('0x12')](_0x98cb('0x13'),auth[_0x98cb('0xb')](),controller[_0x98cb('0x14')]);router[_0x98cb('0x15')](_0x98cb('0x13'),auth['isAuthenticated'](),controller[_0x98cb('0x16')]);module[_0x98cb('0x17')]=router; \ No newline at end of file +var _0xd312=['connect-timeout','Router','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x77a550,_0x79485e){var _0x1a782c=function(_0x21646a){while(--_0x21646a){_0x77a550['push'](_0x77a550['shift']());}};_0x1a782c(++_0x79485e);}(_0xd312,0x157));var _0x2d31=function(_0x4831f2,_0xcd8a47){_0x4831f2=_0x4831f2-0x0;var _0x5b4a1d=_0xd312[_0x4831f2];return _0x5b4a1d;};'use strict';var multer=require(_0x2d31('0x0'));var util=require(_0x2d31('0x1'));var path=require('path');var timeout=require(_0x2d31('0x2'));var express=require('express');var router=express[_0x2d31('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2d31('0x4'));var controller=require(_0x2d31('0x5'));router['get']('/',auth[_0x2d31('0x6')](),controller[_0x2d31('0x7')]);router[_0x2d31('0x8')](_0x2d31('0x9'),auth[_0x2d31('0x6')](),controller[_0x2d31('0xa')]);router[_0x2d31('0x8')](_0x2d31('0xb'),auth['isAuthenticated'](),controller[_0x2d31('0xc')]);router[_0x2d31('0x8')](_0x2d31('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x2d31('0x8')](_0x2d31('0xe'),auth['isAuthenticated'](),controller[_0x2d31('0xf')]);router[_0x2d31('0x10')]('/',auth[_0x2d31('0x6')](),controller[_0x2d31('0x11')]);router[_0x2d31('0x12')]('/:id',auth[_0x2d31('0x6')](),controller[_0x2d31('0x13')]);router[_0x2d31('0x14')](_0x2d31('0x9'),auth['isAuthenticated'](),controller[_0x2d31('0x15')]);module[_0x2d31('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 5cab484..5fd4680 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 _0x3f89=['sequelize','STRING'];(function(_0x253a30,_0x40ddee){var _0x44a91d=function(_0x8165d8){while(--_0x8165d8){_0x253a30['push'](_0x253a30['shift']());}};_0x44a91d(++_0x40ddee);}(_0x3f89,0x1a8));var _0x93f8=function(_0x54bae2,_0x3e9533){_0x54bae2=_0x54bae2-0x0;var _0x2b0b5c=_0x3f89[_0x54bae2];return _0x2b0b5c;};'use strict';var Sequelize=require(_0x93f8('0x0'));module['exports']={'name':{'type':Sequelize[_0x93f8('0x1')]},'description':{'type':Sequelize[_0x93f8('0x1')]}}; \ No newline at end of file +var _0x8b1b=['exports','STRING','sequelize'];(function(_0x26610d,_0x2505bd){var _0x48b84e=function(_0x208439){while(--_0x208439){_0x26610d['push'](_0x26610d['shift']());}};_0x48b84e(++_0x2505bd);}(_0x8b1b,0x197));var _0xb8b1=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x8b1b[_0x51c819];return _0x15c5d2;};'use strict';var Sequelize=require(_0xb8b1('0x0'));module[_0xb8b1('0x1')]={'name':{'type':Sequelize[_0xb8b1('0x2')]},'description':{'type':Sequelize[_0xb8b1('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 4450267..e2dcb4a 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 _0x81b2=['findOne','FreshsalesField','pick','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','set','Content-Range','reject','save','update','destroy','then','stack','name','FreshsalesConfiguration','fieldName','key','map','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','getSubjects'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x81b2,0xec));var _0x281b=function(_0x23c02b,_0x411b4d){_0x23c02b=_0x23c02b-0x0;var _0x25efc5=_0x81b2[_0x23c02b];return _0x25efc5;};'use strict';var emlformat=require(_0x281b('0x0'));var rimraf=require(_0x281b('0x1'));var zipdir=require(_0x281b('0x2'));var jsonpatch=require(_0x281b('0x3'));var rp=require('request-promise');var moment=require(_0x281b('0x4'));var BPromise=require(_0x281b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x281b('0x6'));var csv=require(_0x281b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x281b('0x8'));var _=require(_0x281b('0x9'));var squel=require(_0x281b('0xa'));var crypto=require(_0x281b('0xb'));var jsforce=require(_0x281b('0xc'));var deskjs=require(_0x281b('0xd'));var toCsv=require(_0x281b('0x7'));var querystring=require(_0x281b('0xe'));var Papa=require(_0x281b('0xf'));var Redis=require(_0x281b('0x10'));var authService=require(_0x281b('0x11'));var qs=require(_0x281b('0x12'));var as=require(_0x281b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x281b('0x14'))('api');var utils=require(_0x281b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x281b('0x16'));var db=require(_0x281b('0x17'))['db'];function respondWithStatusCode(_0x9045ed,_0x507ad8){_0x507ad8=_0x507ad8||0xcc;return function(_0x383fab){if(_0x383fab){return _0x9045ed[_0x281b('0x18')](_0x507ad8);}return _0x9045ed[_0x281b('0x19')](_0x507ad8)[_0x281b('0x1a')]();};}function respondWithResult(_0x14b7e0,_0x8c790c){_0x8c790c=_0x8c790c||0xc8;return function(_0x20355c){if(_0x20355c){return _0x14b7e0[_0x281b('0x19')](_0x8c790c)[_0x281b('0x1b')](_0x20355c);}};}function respondWithFilteredResult(_0x2a23f4,_0x186414){return function(_0x82a87f){if(_0x82a87f){var _0x3b1b8c=typeof _0x186414[_0x281b('0x1c')]==='undefined'&&typeof _0x186414['limit']==='undefined';var _0x1e393d=_0x82a87f['count'];var _0x2fb3e4=_0x3b1b8c?0x0:_0x186414[_0x281b('0x1c')];var _0x11fc94=_0x3b1b8c?_0x82a87f[_0x281b('0x1d')]:_0x186414[_0x281b('0x1c')]+_0x186414['limit'];var _0x217f51;if(_0x11fc94>=_0x1e393d){_0x11fc94=_0x1e393d;_0x217f51=0xc8;}else{_0x217f51=0xce;}_0x2a23f4[_0x281b('0x19')](_0x217f51);return _0x2a23f4[_0x281b('0x1e')](_0x281b('0x1f'),_0x2fb3e4+'-'+_0x11fc94+'/'+_0x1e393d)[_0x281b('0x1b')](_0x82a87f);}return null;};}function patchUpdates(_0x5d955d){return function(_0x570e1f){try{jsonpatch['apply'](_0x570e1f,_0x5d955d,!![]);}catch(_0x5b83e9){return BPromise[_0x281b('0x20')](_0x5b83e9);}return _0x570e1f[_0x281b('0x21')]();};}function saveUpdates(_0x5e4b85,_0x27a0b8){return function(_0x1d440c){if(_0x1d440c){return _0x1d440c[_0x281b('0x22')](_0x5e4b85)['then'](function(_0x44b623){return _0x44b623;});}return null;};}function removeEntity(_0x283de6,_0x18589b){return function(_0x5bf9f3){if(_0x5bf9f3){return _0x5bf9f3[_0x281b('0x23')]()[_0x281b('0x24')](function(){_0x283de6['status'](0xcc)[_0x281b('0x1a')]();});}};}function handleEntityNotFound(_0x3f465f,_0x21bd07){return function(_0x497358){if(!_0x497358){_0x3f465f[_0x281b('0x18')](0x194);}return _0x497358;};}function handleError(_0x2ab648,_0x2589fa){_0x2589fa=_0x2589fa||0x1f4;return function(_0x30d25f){logger['error'](_0x30d25f[_0x281b('0x25')]);if(_0x30d25f[_0x281b('0x26')]){delete _0x30d25f[_0x281b('0x26')];}_0x2ab648[_0x281b('0x19')](_0x2589fa)['send'](_0x30d25f);};}exports['index']=function(_0x4336a6,_0x2fa55e){var _0x140d5d={},_0x1efaca={},_0x4e574d={'count':0x0,'rows':[]};var _0x8b6b2f=_['map'](db[_0x281b('0x27')]['rawAttributes'],function(_0x306de6){return{'name':_0x306de6[_0x281b('0x28')],'type':_0x306de6['type'][_0x281b('0x29')]};});_0x1efaca['model']=_[_0x281b('0x2a')](_0x8b6b2f,_0x281b('0x26'));_0x1efaca['query']=_[_0x281b('0x2b')](_0x4336a6[_0x281b('0x2c')]);_0x1efaca['filters']=_[_0x281b('0x2d')](_0x1efaca[_0x281b('0x2e')],_0x1efaca[_0x281b('0x2c')]);_0x140d5d[_0x281b('0x2f')]=_[_0x281b('0x2d')](_0x1efaca[_0x281b('0x2e')],qs[_0x281b('0x30')](_0x4336a6[_0x281b('0x2c')][_0x281b('0x30')]));_0x140d5d[_0x281b('0x2f')]=_0x140d5d[_0x281b('0x2f')]['length']?_0x140d5d['attributes']:_0x1efaca['model'];if(!_0x4336a6['query'][_0x281b('0x31')](_0x281b('0x32'))){_0x140d5d[_0x281b('0x33')]=qs[_0x281b('0x33')](_0x4336a6[_0x281b('0x2c')][_0x281b('0x33')]);_0x140d5d[_0x281b('0x1c')]=qs['offset'](_0x4336a6[_0x281b('0x2c')][_0x281b('0x1c')]);}_0x140d5d[_0x281b('0x34')]=qs[_0x281b('0x35')](_0x4336a6[_0x281b('0x2c')][_0x281b('0x35')]);_0x140d5d['where']=qs[_0x281b('0x36')](_['pick'](_0x4336a6[_0x281b('0x2c')],_0x1efaca[_0x281b('0x36')]),_0x8b6b2f);if(_0x4336a6['query']['filter']){_0x140d5d[_0x281b('0x37')]=_[_0x281b('0x38')](_0x140d5d[_0x281b('0x37')],{'$or':_[_0x281b('0x2a')](_0x8b6b2f,function(_0x2de4c3){if(_0x2de4c3['type']!==_0x281b('0x39')){var _0x1f9b1e={};_0x1f9b1e[_0x2de4c3[_0x281b('0x26')]]={'$like':'%'+_0x4336a6[_0x281b('0x2c')][_0x281b('0x3a')]+'%'};return _0x1f9b1e;}})});}_0x140d5d=_[_0x281b('0x38')]({},_0x140d5d,_0x4336a6[_0x281b('0x3b')]);var _0x15eb5f={'where':_0x140d5d[_0x281b('0x37')]};return db[_0x281b('0x27')][_0x281b('0x1d')](_0x15eb5f)[_0x281b('0x24')](function(_0x4126a3){_0x4e574d[_0x281b('0x1d')]=_0x4126a3;if(_0x4336a6['query'][_0x281b('0x3c')]){_0x140d5d[_0x281b('0x3d')]=[{'all':!![]}];}return db[_0x281b('0x27')][_0x281b('0x3e')](_0x140d5d);})['then'](function(_0x243ee5){_0x4e574d[_0x281b('0x3f')]=_0x243ee5;return _0x4e574d;})[_0x281b('0x24')](respondWithFilteredResult(_0x2fa55e,_0x140d5d))[_0x281b('0x40')](handleError(_0x2fa55e,null));};exports['show']=function(_0x2ed8db,_0x5f281a){var _0x228333={'raw':![],'where':{'id':_0x2ed8db[_0x281b('0x41')]['id']}},_0x54e50d={};_0x54e50d[_0x281b('0x2e')]=_[_0x281b('0x2b')](db[_0x281b('0x27')][_0x281b('0x42')]);_0x54e50d[_0x281b('0x2c')]=_[_0x281b('0x2b')](_0x2ed8db[_0x281b('0x2c')]);_0x54e50d[_0x281b('0x36')]=_[_0x281b('0x2d')](_0x54e50d[_0x281b('0x2e')],_0x54e50d['query']);_0x228333[_0x281b('0x2f')]=_[_0x281b('0x2d')](_0x54e50d[_0x281b('0x2e')],qs[_0x281b('0x30')](_0x2ed8db[_0x281b('0x2c')][_0x281b('0x30')]));_0x228333[_0x281b('0x2f')]=_0x228333[_0x281b('0x2f')][_0x281b('0x43')]?_0x228333[_0x281b('0x2f')]:_0x54e50d[_0x281b('0x2e')];if(_0x2ed8db[_0x281b('0x2c')][_0x281b('0x3c')]){_0x228333['include']=[{'all':!![]}];}_0x228333=_[_0x281b('0x38')]({},_0x228333,_0x2ed8db['options']);return db[_0x281b('0x27')][_0x281b('0x44')](_0x228333)[_0x281b('0x24')](handleEntityNotFound(_0x5f281a,null))['then'](respondWithResult(_0x5f281a,null))[_0x281b('0x40')](handleError(_0x5f281a,null));};exports[_0x281b('0x45')]=function(_0x27bfe9,_0x404a9c){return db['FreshsalesConfiguration'][_0x281b('0x45')](_0x27bfe9[_0x281b('0x46')],{})[_0x281b('0x24')](respondWithResult(_0x404a9c,0xc9))[_0x281b('0x40')](handleError(_0x404a9c,null));};exports[_0x281b('0x22')]=function(_0x29b946,_0x271bd3){if(_0x29b946['body']['id']){delete _0x29b946[_0x281b('0x46')]['id'];}return db[_0x281b('0x27')][_0x281b('0x44')]({'where':{'id':_0x29b946[_0x281b('0x41')]['id']}})[_0x281b('0x24')](handleEntityNotFound(_0x271bd3,null))['then'](saveUpdates(_0x29b946[_0x281b('0x46')],null))['then'](respondWithResult(_0x271bd3,null))[_0x281b('0x40')](handleError(_0x271bd3,null));};exports[_0x281b('0x23')]=function(_0x403ff8,_0x311ec4){return db[_0x281b('0x27')][_0x281b('0x44')]({'where':{'id':_0x403ff8[_0x281b('0x41')]['id']}})[_0x281b('0x24')](handleEntityNotFound(_0x311ec4,null))[_0x281b('0x24')](removeEntity(_0x311ec4,null))[_0x281b('0x40')](handleError(_0x311ec4,null));};exports[_0x281b('0x47')]=function(_0x2e2372,_0x210cdc,_0x57aef5){var _0x4536a1={};var _0x3d7735={};var _0x126077;var _0x3956b5;return db[_0x281b('0x27')][_0x281b('0x48')]({'where':{'id':_0x2e2372[_0x281b('0x41')]['id']}})[_0x281b('0x24')](handleEntityNotFound(_0x210cdc,null))[_0x281b('0x24')](function(_0x5942f2){if(_0x5942f2){_0x126077=_0x5942f2;_0x3d7735[_0x281b('0x2e')]=_['keys'](db[_0x281b('0x49')][_0x281b('0x42')]);_0x3d7735[_0x281b('0x2c')]=_[_0x281b('0x2b')](_0x2e2372[_0x281b('0x2c')]);_0x3d7735[_0x281b('0x36')]=_['intersection'](_0x3d7735[_0x281b('0x2e')],_0x3d7735[_0x281b('0x2c')]);_0x4536a1[_0x281b('0x2f')]=_[_0x281b('0x2d')](_0x3d7735[_0x281b('0x2e')],qs[_0x281b('0x30')](_0x2e2372[_0x281b('0x2c')]['fields']));_0x4536a1[_0x281b('0x2f')]=_0x4536a1[_0x281b('0x2f')][_0x281b('0x43')]?_0x4536a1['attributes']:_0x3d7735[_0x281b('0x2e')];_0x4536a1[_0x281b('0x34')]=qs[_0x281b('0x35')](_0x2e2372[_0x281b('0x2c')][_0x281b('0x35')]);_0x4536a1[_0x281b('0x37')]=qs[_0x281b('0x36')](_[_0x281b('0x4a')](_0x2e2372[_0x281b('0x2c')],_0x3d7735[_0x281b('0x36')]));if(_0x2e2372[_0x281b('0x2c')][_0x281b('0x3a')]){_0x4536a1[_0x281b('0x37')]=_[_0x281b('0x38')](_0x4536a1[_0x281b('0x37')],{'$or':_[_0x281b('0x2a')](_0x4536a1[_0x281b('0x2f')],function(_0x30241b){var _0x252834={};_0x252834[_0x30241b]={'$like':'%'+_0x2e2372[_0x281b('0x2c')][_0x281b('0x3a')]+'%'};return _0x252834;})});}_0x4536a1=_[_0x281b('0x38')]({},_0x4536a1,_0x2e2372[_0x281b('0x3b')]);return _0x126077[_0x281b('0x47')](_0x4536a1);}})[_0x281b('0x24')](function(_0x45dc16){if(_0x45dc16){_0x3956b5=_0x45dc16['length'];if(!_0x2e2372[_0x281b('0x2c')]['hasOwnProperty'](_0x281b('0x32'))){_0x4536a1[_0x281b('0x33')]=qs['limit'](_0x2e2372[_0x281b('0x2c')]['limit']);_0x4536a1['offset']=qs[_0x281b('0x1c')](_0x2e2372[_0x281b('0x2c')][_0x281b('0x1c')]);}return _0x126077[_0x281b('0x47')](_0x4536a1);}})['then'](function(_0x3d201c){if(_0x3d201c){return _0x3d201c?{'count':_0x3956b5,'rows':_0x3d201c}:null;}})[_0x281b('0x24')](respondWithResult(_0x210cdc,null))['catch'](handleError(_0x210cdc,null));};exports['getDescriptions']=function(_0x4f1022,_0x2b845c,_0x5f42f9){var _0x238a72={};var _0x20b262={};var _0x5d2ee5;var _0x5ddc23;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x4f1022['params']['id']}})[_0x281b('0x24')](handleEntityNotFound(_0x2b845c,null))['then'](function(_0x42dd8f){if(_0x42dd8f){_0x5d2ee5=_0x42dd8f;_0x20b262[_0x281b('0x2e')]=_[_0x281b('0x2b')](db['FreshsalesField'][_0x281b('0x42')]);_0x20b262[_0x281b('0x2c')]=_[_0x281b('0x2b')](_0x4f1022[_0x281b('0x2c')]);_0x20b262[_0x281b('0x36')]=_[_0x281b('0x2d')](_0x20b262['model'],_0x20b262[_0x281b('0x2c')]);_0x238a72[_0x281b('0x2f')]=_[_0x281b('0x2d')](_0x20b262[_0x281b('0x2e')],qs[_0x281b('0x30')](_0x4f1022[_0x281b('0x2c')][_0x281b('0x30')]));_0x238a72[_0x281b('0x2f')]=_0x238a72['attributes'][_0x281b('0x43')]?_0x238a72[_0x281b('0x2f')]:_0x20b262['model'];_0x238a72['order']=qs['sort'](_0x4f1022[_0x281b('0x2c')]['sort']);_0x238a72[_0x281b('0x37')]=qs[_0x281b('0x36')](_[_0x281b('0x4a')](_0x4f1022['query'],_0x20b262[_0x281b('0x36')]));if(_0x4f1022[_0x281b('0x2c')][_0x281b('0x3a')]){_0x238a72[_0x281b('0x37')]=_['merge'](_0x238a72[_0x281b('0x37')],{'$or':_[_0x281b('0x2a')](_0x238a72[_0x281b('0x2f')],function(_0x968630){var _0xa46194={};_0xa46194[_0x968630]={'$like':'%'+_0x4f1022['query']['filter']+'%'};return _0xa46194;})});}_0x238a72=_[_0x281b('0x38')]({},_0x238a72,_0x4f1022['options']);return _0x5d2ee5[_0x281b('0x4b')](_0x238a72);}})[_0x281b('0x24')](function(_0x2b1019){if(_0x2b1019){_0x5ddc23=_0x2b1019[_0x281b('0x43')];if(!_0x4f1022[_0x281b('0x2c')][_0x281b('0x31')](_0x281b('0x32'))){_0x238a72['limit']=qs[_0x281b('0x33')](_0x4f1022['query'][_0x281b('0x33')]);_0x238a72[_0x281b('0x1c')]=qs['offset'](_0x4f1022[_0x281b('0x2c')][_0x281b('0x1c')]);}return _0x5d2ee5[_0x281b('0x4b')](_0x238a72);}})[_0x281b('0x24')](function(_0x36f6cc){if(_0x36f6cc){return _0x36f6cc?{'count':_0x5ddc23,'rows':_0x36f6cc}:null;}})[_0x281b('0x24')](respondWithResult(_0x2b845c,null))[_0x281b('0x40')](handleError(_0x2b845c,null));};exports[_0x281b('0x4c')]=function(_0x51b68b,_0x283e6c,_0x399af3){var _0xd47cc3={};var _0x298ff0={};var _0x31046d;var _0x4e476c;return db['FreshsalesConfiguration'][_0x281b('0x48')]({'where':{'id':_0x51b68b[_0x281b('0x41')]['id']}})[_0x281b('0x24')](handleEntityNotFound(_0x283e6c,null))['then'](function(_0x354b84){if(_0x354b84){_0x31046d=_0x354b84;_0x298ff0[_0x281b('0x2e')]=_[_0x281b('0x2b')](db[_0x281b('0x49')][_0x281b('0x42')]);_0x298ff0[_0x281b('0x2c')]=_['keys'](_0x51b68b[_0x281b('0x2c')]);_0x298ff0[_0x281b('0x36')]=_[_0x281b('0x2d')](_0x298ff0[_0x281b('0x2e')],_0x298ff0['query']);_0xd47cc3[_0x281b('0x2f')]=_[_0x281b('0x2d')](_0x298ff0[_0x281b('0x2e')],qs['fields'](_0x51b68b['query'][_0x281b('0x30')]));_0xd47cc3[_0x281b('0x2f')]=_0xd47cc3[_0x281b('0x2f')]['length']?_0xd47cc3[_0x281b('0x2f')]:_0x298ff0['model'];_0xd47cc3[_0x281b('0x34')]=qs[_0x281b('0x35')](_0x51b68b['query'][_0x281b('0x35')]);_0xd47cc3[_0x281b('0x37')]=qs[_0x281b('0x36')](_['pick'](_0x51b68b[_0x281b('0x2c')],_0x298ff0[_0x281b('0x36')]));if(_0x51b68b['query']['filter']){_0xd47cc3[_0x281b('0x37')]=_['merge'](_0xd47cc3[_0x281b('0x37')],{'$or':_[_0x281b('0x2a')](_0xd47cc3['attributes'],function(_0x2ba6fe){var _0x3d7086={};_0x3d7086[_0x2ba6fe]={'$like':'%'+_0x51b68b[_0x281b('0x2c')]['filter']+'%'};return _0x3d7086;})});}_0xd47cc3=_['merge']({},_0xd47cc3,_0x51b68b['options']);return _0x31046d[_0x281b('0x4c')](_0xd47cc3);}})[_0x281b('0x24')](function(_0xbe057b){if(_0xbe057b){_0x4e476c=_0xbe057b[_0x281b('0x43')];if(!_0x51b68b[_0x281b('0x2c')][_0x281b('0x31')](_0x281b('0x32'))){_0xd47cc3[_0x281b('0x33')]=qs[_0x281b('0x33')](_0x51b68b[_0x281b('0x2c')][_0x281b('0x33')]);_0xd47cc3[_0x281b('0x1c')]=qs[_0x281b('0x1c')](_0x51b68b[_0x281b('0x2c')][_0x281b('0x1c')]);}return _0x31046d['getFields'](_0xd47cc3);}})['then'](function(_0x1d340e){if(_0x1d340e){return _0x1d340e?{'count':_0x4e476c,'rows':_0x1d340e}:null;}})['then'](respondWithResult(_0x283e6c,null))[_0x281b('0x40')](handleError(_0x283e6c,null));}; \ No newline at end of file +var _0xb1a6=['jsforce','desk.js','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','error','stack','name','send','index','FreshsalesConfiguration','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','filter','where','map','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','length','merge','find','create','body','update','params','destroy','getSubjects','findOne','pick','nolimit','getDescriptions','FreshsalesField','getFields','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x1829ec,_0x1491bf){var _0x263744=function(_0x2a808b){while(--_0x2a808b){_0x1829ec['push'](_0x1829ec['shift']());}};_0x263744(++_0x1491bf);}(_0xb1a6,0x137));var _0x6b1a=function(_0x4fc4d1,_0xa5427){_0x4fc4d1=_0x4fc4d1-0x0;var _0x4d0f20=_0xb1a6[_0x4fc4d1];return _0x4d0f20;};'use strict';var emlformat=require(_0x6b1a('0x0'));var rimraf=require(_0x6b1a('0x1'));var zipdir=require(_0x6b1a('0x2'));var jsonpatch=require(_0x6b1a('0x3'));var rp=require('request-promise');var moment=require(_0x6b1a('0x4'));var BPromise=require(_0x6b1a('0x5'));var Mustache=require(_0x6b1a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6b1a('0x7'));var csv=require(_0x6b1a('0x8'));var ejs=require(_0x6b1a('0x9'));var fs=require('fs');var fs_extra=require(_0x6b1a('0xa'));var _=require(_0x6b1a('0xb'));var squel=require('squel');var crypto=require(_0x6b1a('0xc'));var jsforce=require(_0x6b1a('0xd'));var deskjs=require(_0x6b1a('0xe'));var toCsv=require(_0x6b1a('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6b1a('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6b1a('0x10'));var logger=require(_0x6b1a('0x11'))(_0x6b1a('0x12'));var utils=require(_0x6b1a('0x13'));var config=require(_0x6b1a('0x14'));var licenseUtil=require(_0x6b1a('0x15'));var db=require(_0x6b1a('0x16'))['db'];function respondWithStatusCode(_0x5389c0,_0x111a7d){_0x111a7d=_0x111a7d||0xcc;return function(_0xea7ddd){if(_0xea7ddd){return _0x5389c0[_0x6b1a('0x17')](_0x111a7d);}return _0x5389c0[_0x6b1a('0x18')](_0x111a7d)[_0x6b1a('0x19')]();};}function respondWithResult(_0x2ada2e,_0x3d2098){_0x3d2098=_0x3d2098||0xc8;return function(_0x31d5b3){if(_0x31d5b3){return _0x2ada2e['status'](_0x3d2098)[_0x6b1a('0x1a')](_0x31d5b3);}};}function respondWithFilteredResult(_0x3ce871,_0x50fdb5){return function(_0x2655aa){if(_0x2655aa){var _0x456021=typeof _0x50fdb5[_0x6b1a('0x1b')]===_0x6b1a('0x1c')&&typeof _0x50fdb5[_0x6b1a('0x1d')]===_0x6b1a('0x1c');var _0x33d87a=_0x2655aa['count'];var _0x47ac16=_0x456021?0x0:_0x50fdb5[_0x6b1a('0x1b')];var _0x76699b=_0x456021?_0x2655aa[_0x6b1a('0x1e')]:_0x50fdb5['offset']+_0x50fdb5[_0x6b1a('0x1d')];var _0x25d726;if(_0x76699b>=_0x33d87a){_0x76699b=_0x33d87a;_0x25d726=0xc8;}else{_0x25d726=0xce;}_0x3ce871[_0x6b1a('0x18')](_0x25d726);return _0x3ce871[_0x6b1a('0x1f')]('Content-Range',_0x47ac16+'-'+_0x76699b+'/'+_0x33d87a)[_0x6b1a('0x1a')](_0x2655aa);}return null;};}function patchUpdates(_0x560247){return function(_0xb856fa){try{jsonpatch[_0x6b1a('0x20')](_0xb856fa,_0x560247,!![]);}catch(_0x54e350){return BPromise[_0x6b1a('0x21')](_0x54e350);}return _0xb856fa[_0x6b1a('0x22')]();};}function saveUpdates(_0x18ce08,_0x47b1bd){return function(_0x15d05f){if(_0x15d05f){return _0x15d05f['update'](_0x18ce08)[_0x6b1a('0x23')](function(_0x10bd5f){return _0x10bd5f;});}return null;};}function removeEntity(_0x3d64f8,_0x3489a0){return function(_0xd5960){if(_0xd5960){return _0xd5960['destroy']()[_0x6b1a('0x23')](function(){_0x3d64f8[_0x6b1a('0x18')](0xcc)[_0x6b1a('0x19')]();});}};}function handleEntityNotFound(_0x54748f,_0x3f0a6a){return function(_0x396e5c){if(!_0x396e5c){_0x54748f['sendStatus'](0x194);}return _0x396e5c;};}function handleError(_0x1134f5,_0x1cd98d){_0x1cd98d=_0x1cd98d||0x1f4;return function(_0x161db2){logger[_0x6b1a('0x24')](_0x161db2[_0x6b1a('0x25')]);if(_0x161db2[_0x6b1a('0x26')]){delete _0x161db2[_0x6b1a('0x26')];}_0x1134f5[_0x6b1a('0x18')](_0x1cd98d)[_0x6b1a('0x27')](_0x161db2);};}exports[_0x6b1a('0x28')]=function(_0x156610,_0x14df33){var _0x1a01f3={},_0x1e2cb1={},_0x390ca3={'count':0x0,'rows':[]};var _0x5f407b=_['map'](db[_0x6b1a('0x29')][_0x6b1a('0x2a')],function(_0x3fba51){return{'name':_0x3fba51[_0x6b1a('0x2b')],'type':_0x3fba51['type'][_0x6b1a('0x2c')]};});_0x1e2cb1['model']=_['map'](_0x5f407b,_0x6b1a('0x26'));_0x1e2cb1['query']=_[_0x6b1a('0x2d')](_0x156610[_0x6b1a('0x2e')]);_0x1e2cb1[_0x6b1a('0x2f')]=_[_0x6b1a('0x30')](_0x1e2cb1[_0x6b1a('0x31')],_0x1e2cb1['query']);_0x1a01f3[_0x6b1a('0x32')]=_[_0x6b1a('0x30')](_0x1e2cb1[_0x6b1a('0x31')],qs[_0x6b1a('0x33')](_0x156610[_0x6b1a('0x2e')]['fields']));_0x1a01f3[_0x6b1a('0x32')]=_0x1a01f3[_0x6b1a('0x32')]['length']?_0x1a01f3[_0x6b1a('0x32')]:_0x1e2cb1['model'];if(!_0x156610[_0x6b1a('0x2e')][_0x6b1a('0x34')]('nolimit')){_0x1a01f3[_0x6b1a('0x1d')]=qs[_0x6b1a('0x1d')](_0x156610[_0x6b1a('0x2e')]['limit']);_0x1a01f3[_0x6b1a('0x1b')]=qs[_0x6b1a('0x1b')](_0x156610[_0x6b1a('0x2e')][_0x6b1a('0x1b')]);}_0x1a01f3[_0x6b1a('0x35')]=qs[_0x6b1a('0x36')](_0x156610['query'][_0x6b1a('0x36')]);_0x1a01f3['where']=qs[_0x6b1a('0x2f')](_['pick'](_0x156610['query'],_0x1e2cb1[_0x6b1a('0x2f')]),_0x5f407b);if(_0x156610['query'][_0x6b1a('0x37')]){_0x1a01f3['where']=_['merge'](_0x1a01f3[_0x6b1a('0x38')],{'$or':_[_0x6b1a('0x39')](_0x5f407b,function(_0x49701f){if(_0x49701f[_0x6b1a('0x3a')]!==_0x6b1a('0x3b')){var _0xf7d4c9={};_0xf7d4c9[_0x49701f['name']]={'$like':'%'+_0x156610[_0x6b1a('0x2e')][_0x6b1a('0x37')]+'%'};return _0xf7d4c9;}})});}_0x1a01f3=_['merge']({},_0x1a01f3,_0x156610[_0x6b1a('0x3c')]);var _0x69dfd2={'where':_0x1a01f3[_0x6b1a('0x38')]};return db[_0x6b1a('0x29')][_0x6b1a('0x1e')](_0x69dfd2)['then'](function(_0x3ae1c9){_0x390ca3[_0x6b1a('0x1e')]=_0x3ae1c9;if(_0x156610['query'][_0x6b1a('0x3d')]){_0x1a01f3['include']=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x6b1a('0x3e')](_0x1a01f3);})['then'](function(_0x43dbe2){_0x390ca3[_0x6b1a('0x3f')]=_0x43dbe2;return _0x390ca3;})[_0x6b1a('0x23')](respondWithFilteredResult(_0x14df33,_0x1a01f3))[_0x6b1a('0x40')](handleError(_0x14df33,null));};exports[_0x6b1a('0x41')]=function(_0x21c486,_0x2de806){var _0x1c6570={'raw':![],'where':{'id':_0x21c486['params']['id']}},_0x5a480d={};_0x5a480d[_0x6b1a('0x31')]=_['keys'](db[_0x6b1a('0x29')][_0x6b1a('0x2a')]);_0x5a480d['query']=_[_0x6b1a('0x2d')](_0x21c486[_0x6b1a('0x2e')]);_0x5a480d[_0x6b1a('0x2f')]=_[_0x6b1a('0x30')](_0x5a480d[_0x6b1a('0x31')],_0x5a480d[_0x6b1a('0x2e')]);_0x1c6570['attributes']=_[_0x6b1a('0x30')](_0x5a480d[_0x6b1a('0x31')],qs[_0x6b1a('0x33')](_0x21c486['query']['fields']));_0x1c6570[_0x6b1a('0x32')]=_0x1c6570[_0x6b1a('0x32')][_0x6b1a('0x42')]?_0x1c6570['attributes']:_0x5a480d[_0x6b1a('0x31')];if(_0x21c486[_0x6b1a('0x2e')][_0x6b1a('0x3d')]){_0x1c6570['include']=[{'all':!![]}];}_0x1c6570=_[_0x6b1a('0x43')]({},_0x1c6570,_0x21c486[_0x6b1a('0x3c')]);return db[_0x6b1a('0x29')][_0x6b1a('0x44')](_0x1c6570)[_0x6b1a('0x23')](handleEntityNotFound(_0x2de806,null))[_0x6b1a('0x23')](respondWithResult(_0x2de806,null))[_0x6b1a('0x40')](handleError(_0x2de806,null));};exports['create']=function(_0x773471,_0x4a5bc0){return db[_0x6b1a('0x29')][_0x6b1a('0x45')](_0x773471[_0x6b1a('0x46')],{})['then'](respondWithResult(_0x4a5bc0,0xc9))[_0x6b1a('0x40')](handleError(_0x4a5bc0,null));};exports[_0x6b1a('0x47')]=function(_0x32dbb9,_0x2b7204){if(_0x32dbb9[_0x6b1a('0x46')]['id']){delete _0x32dbb9[_0x6b1a('0x46')]['id'];}return db[_0x6b1a('0x29')]['find']({'where':{'id':_0x32dbb9[_0x6b1a('0x48')]['id']}})[_0x6b1a('0x23')](handleEntityNotFound(_0x2b7204,null))[_0x6b1a('0x23')](saveUpdates(_0x32dbb9[_0x6b1a('0x46')],null))[_0x6b1a('0x23')](respondWithResult(_0x2b7204,null))[_0x6b1a('0x40')](handleError(_0x2b7204,null));};exports[_0x6b1a('0x49')]=function(_0x5b5a34,_0x56dfc3){return db[_0x6b1a('0x29')][_0x6b1a('0x44')]({'where':{'id':_0x5b5a34['params']['id']}})[_0x6b1a('0x23')](handleEntityNotFound(_0x56dfc3,null))['then'](removeEntity(_0x56dfc3,null))[_0x6b1a('0x40')](handleError(_0x56dfc3,null));};exports[_0x6b1a('0x4a')]=function(_0x169e7f,_0x573ada,_0x1ee217){var _0x4c7c64={};var _0x1dd6a4={};var _0x309e26;var _0x307bfd;return db[_0x6b1a('0x29')][_0x6b1a('0x4b')]({'where':{'id':_0x169e7f['params']['id']}})['then'](handleEntityNotFound(_0x573ada,null))[_0x6b1a('0x23')](function(_0x327edb){if(_0x327edb){_0x309e26=_0x327edb;_0x1dd6a4['model']=_[_0x6b1a('0x2d')](db['FreshsalesField'][_0x6b1a('0x2a')]);_0x1dd6a4[_0x6b1a('0x2e')]=_[_0x6b1a('0x2d')](_0x169e7f[_0x6b1a('0x2e')]);_0x1dd6a4['filters']=_['intersection'](_0x1dd6a4[_0x6b1a('0x31')],_0x1dd6a4[_0x6b1a('0x2e')]);_0x4c7c64[_0x6b1a('0x32')]=_[_0x6b1a('0x30')](_0x1dd6a4['model'],qs[_0x6b1a('0x33')](_0x169e7f[_0x6b1a('0x2e')][_0x6b1a('0x33')]));_0x4c7c64[_0x6b1a('0x32')]=_0x4c7c64['attributes'][_0x6b1a('0x42')]?_0x4c7c64[_0x6b1a('0x32')]:_0x1dd6a4[_0x6b1a('0x31')];_0x4c7c64[_0x6b1a('0x35')]=qs[_0x6b1a('0x36')](_0x169e7f[_0x6b1a('0x2e')][_0x6b1a('0x36')]);_0x4c7c64[_0x6b1a('0x38')]=qs[_0x6b1a('0x2f')](_[_0x6b1a('0x4c')](_0x169e7f[_0x6b1a('0x2e')],_0x1dd6a4[_0x6b1a('0x2f')]));if(_0x169e7f[_0x6b1a('0x2e')]['filter']){_0x4c7c64[_0x6b1a('0x38')]=_['merge'](_0x4c7c64[_0x6b1a('0x38')],{'$or':_[_0x6b1a('0x39')](_0x4c7c64[_0x6b1a('0x32')],function(_0x3c4137){var _0xd8f97c={};_0xd8f97c[_0x3c4137]={'$like':'%'+_0x169e7f[_0x6b1a('0x2e')][_0x6b1a('0x37')]+'%'};return _0xd8f97c;})});}_0x4c7c64=_[_0x6b1a('0x43')]({},_0x4c7c64,_0x169e7f[_0x6b1a('0x3c')]);return _0x309e26['getSubjects'](_0x4c7c64);}})[_0x6b1a('0x23')](function(_0x38d234){if(_0x38d234){_0x307bfd=_0x38d234[_0x6b1a('0x42')];if(!_0x169e7f[_0x6b1a('0x2e')][_0x6b1a('0x34')](_0x6b1a('0x4d'))){_0x4c7c64[_0x6b1a('0x1d')]=qs[_0x6b1a('0x1d')](_0x169e7f[_0x6b1a('0x2e')][_0x6b1a('0x1d')]);_0x4c7c64['offset']=qs[_0x6b1a('0x1b')](_0x169e7f[_0x6b1a('0x2e')][_0x6b1a('0x1b')]);}return _0x309e26[_0x6b1a('0x4a')](_0x4c7c64);}})[_0x6b1a('0x23')](function(_0x192851){if(_0x192851){return _0x192851?{'count':_0x307bfd,'rows':_0x192851}:null;}})['then'](respondWithResult(_0x573ada,null))[_0x6b1a('0x40')](handleError(_0x573ada,null));};exports[_0x6b1a('0x4e')]=function(_0x437525,_0x24e495,_0x19d2e9){var _0x3354a0={};var _0x496954={};var _0x4a63d1;var _0x235249;return db['FreshsalesConfiguration'][_0x6b1a('0x4b')]({'where':{'id':_0x437525[_0x6b1a('0x48')]['id']}})[_0x6b1a('0x23')](handleEntityNotFound(_0x24e495,null))['then'](function(_0x51ca74){if(_0x51ca74){_0x4a63d1=_0x51ca74;_0x496954[_0x6b1a('0x31')]=_['keys'](db[_0x6b1a('0x4f')][_0x6b1a('0x2a')]);_0x496954['query']=_[_0x6b1a('0x2d')](_0x437525[_0x6b1a('0x2e')]);_0x496954['filters']=_[_0x6b1a('0x30')](_0x496954[_0x6b1a('0x31')],_0x496954[_0x6b1a('0x2e')]);_0x3354a0['attributes']=_['intersection'](_0x496954[_0x6b1a('0x31')],qs['fields'](_0x437525['query'][_0x6b1a('0x33')]));_0x3354a0['attributes']=_0x3354a0[_0x6b1a('0x32')][_0x6b1a('0x42')]?_0x3354a0[_0x6b1a('0x32')]:_0x496954['model'];_0x3354a0[_0x6b1a('0x35')]=qs[_0x6b1a('0x36')](_0x437525[_0x6b1a('0x2e')][_0x6b1a('0x36')]);_0x3354a0[_0x6b1a('0x38')]=qs[_0x6b1a('0x2f')](_[_0x6b1a('0x4c')](_0x437525[_0x6b1a('0x2e')],_0x496954[_0x6b1a('0x2f')]));if(_0x437525['query']['filter']){_0x3354a0['where']=_[_0x6b1a('0x43')](_0x3354a0[_0x6b1a('0x38')],{'$or':_['map'](_0x3354a0['attributes'],function(_0x2f383b){var _0xb6dd03={};_0xb6dd03[_0x2f383b]={'$like':'%'+_0x437525['query']['filter']+'%'};return _0xb6dd03;})});}_0x3354a0=_[_0x6b1a('0x43')]({},_0x3354a0,_0x437525['options']);return _0x4a63d1['getDescriptions'](_0x3354a0);}})['then'](function(_0x1d4ee8){if(_0x1d4ee8){_0x235249=_0x1d4ee8[_0x6b1a('0x42')];if(!_0x437525[_0x6b1a('0x2e')]['hasOwnProperty'](_0x6b1a('0x4d'))){_0x3354a0[_0x6b1a('0x1d')]=qs[_0x6b1a('0x1d')](_0x437525[_0x6b1a('0x2e')]['limit']);_0x3354a0[_0x6b1a('0x1b')]=qs[_0x6b1a('0x1b')](_0x437525[_0x6b1a('0x2e')][_0x6b1a('0x1b')]);}return _0x4a63d1['getDescriptions'](_0x3354a0);}})[_0x6b1a('0x23')](function(_0x4a6397){if(_0x4a6397){return _0x4a6397?{'count':_0x235249,'rows':_0x4a6397}:null;}})['then'](respondWithResult(_0x24e495,null))[_0x6b1a('0x40')](handleError(_0x24e495,null));};exports[_0x6b1a('0x50')]=function(_0x576093,_0x338b86,_0x1531d4){var _0x2a731c={};var _0x24f08c={};var _0x162251;var _0x556c3e;return db['FreshsalesConfiguration'][_0x6b1a('0x4b')]({'where':{'id':_0x576093[_0x6b1a('0x48')]['id']}})[_0x6b1a('0x23')](handleEntityNotFound(_0x338b86,null))[_0x6b1a('0x23')](function(_0x44a6be){if(_0x44a6be){_0x162251=_0x44a6be;_0x24f08c[_0x6b1a('0x31')]=_['keys'](db['FreshsalesField'][_0x6b1a('0x2a')]);_0x24f08c[_0x6b1a('0x2e')]=_['keys'](_0x576093['query']);_0x24f08c[_0x6b1a('0x2f')]=_[_0x6b1a('0x30')](_0x24f08c[_0x6b1a('0x31')],_0x24f08c['query']);_0x2a731c[_0x6b1a('0x32')]=_[_0x6b1a('0x30')](_0x24f08c[_0x6b1a('0x31')],qs['fields'](_0x576093['query'][_0x6b1a('0x33')]));_0x2a731c[_0x6b1a('0x32')]=_0x2a731c['attributes'][_0x6b1a('0x42')]?_0x2a731c[_0x6b1a('0x32')]:_0x24f08c[_0x6b1a('0x31')];_0x2a731c[_0x6b1a('0x35')]=qs[_0x6b1a('0x36')](_0x576093[_0x6b1a('0x2e')][_0x6b1a('0x36')]);_0x2a731c[_0x6b1a('0x38')]=qs[_0x6b1a('0x2f')](_[_0x6b1a('0x4c')](_0x576093['query'],_0x24f08c[_0x6b1a('0x2f')]));if(_0x576093[_0x6b1a('0x2e')][_0x6b1a('0x37')]){_0x2a731c[_0x6b1a('0x38')]=_[_0x6b1a('0x43')](_0x2a731c['where'],{'$or':_[_0x6b1a('0x39')](_0x2a731c[_0x6b1a('0x32')],function(_0x54450a){var _0x15c471={};_0x15c471[_0x54450a]={'$like':'%'+_0x576093[_0x6b1a('0x2e')][_0x6b1a('0x37')]+'%'};return _0x15c471;})});}_0x2a731c=_['merge']({},_0x2a731c,_0x576093[_0x6b1a('0x3c')]);return _0x162251[_0x6b1a('0x50')](_0x2a731c);}})[_0x6b1a('0x23')](function(_0x1a2d38){if(_0x1a2d38){_0x556c3e=_0x1a2d38[_0x6b1a('0x42')];if(!_0x576093[_0x6b1a('0x2e')][_0x6b1a('0x34')](_0x6b1a('0x4d'))){_0x2a731c[_0x6b1a('0x1d')]=qs[_0x6b1a('0x1d')](_0x576093[_0x6b1a('0x2e')]['limit']);_0x2a731c[_0x6b1a('0x1b')]=qs[_0x6b1a('0x1b')](_0x576093[_0x6b1a('0x2e')][_0x6b1a('0x1b')]);}return _0x162251[_0x6b1a('0x50')](_0x2a731c);}})[_0x6b1a('0x23')](function(_0x55d8cc){if(_0x55d8cc){return _0x55d8cc?{'count':_0x556c3e,'rows':_0x55d8cc}:null;}})[_0x6b1a('0x23')](respondWithResult(_0x338b86,null))[_0x6b1a('0x40')](handleError(_0x338b86,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 0eba8cb..090bafc 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 _0x6c3c=['./intFreshsalesConfiguration.attributes','exports','define','lodash','../../config/logger','api','request-promise','path','rimraf'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x6c3c,0x135));var _0xc6c3=function(_0x55ce85,_0x52aa11){_0x55ce85=_0x55ce85-0x0;var _0x3b6753=_0x6c3c[_0x55ce85];return _0x3b6753;};'use strict';var _=require(_0xc6c3('0x0'));var util=require('util');var logger=require(_0xc6c3('0x1'))(_0xc6c3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc6c3('0x3'));var fs=require('fs');var path=require(_0xc6c3('0x4'));var rimraf=require(_0xc6c3('0x5'));var config=require('../../config/environment');var attributes=require(_0xc6c3('0x6'));module[_0xc6c3('0x7')]=function(_0x36556d,_0x4c1774){return _0x36556d[_0xc6c3('0x8')]('FreshsalesConfiguration',attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41b0=['util','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x41b0,0x1a3));var _0x041b=function(_0x5400b,_0x55943a){_0x5400b=_0x5400b-0x0;var _0x36a39b=_0x41b0[_0x5400b];return _0x36a39b;};'use strict';var _=require(_0x041b('0x0'));var util=require(_0x041b('0x1'));var logger=require('../../config/logger')(_0x041b('0x2'));var moment=require(_0x041b('0x3'));var BPromise=require(_0x041b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x041b('0x5'));var rimraf=require(_0x041b('0x6'));var config=require(_0x041b('0x7'));var attributes=require(_0x041b('0x8'));module[_0x041b('0x9')]=function(_0x2d560d,_0x403a59){return _0x2d560d['define'](_0x041b('0xa'),attributes,{'tableName':_0x041b('0xb'),'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 a1704ee..95c0dc6 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 _0x6f69=['jayson/promise','client','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc'];(function(_0x2456f7,_0x33072b){var _0x196522=function(_0x37c716){while(--_0x37c716){_0x2456f7['push'](_0x2456f7['shift']());}};_0x196522(++_0x33072b);}(_0x6f69,0x89));var _0x96f6=function(_0x99cf93,_0x1a7790){_0x99cf93=_0x99cf93-0x0;var _0x6628d1=_0x6f69[_0x99cf93];return _0x6628d1;};'use strict';var _=require(_0x96f6('0x0'));var util=require(_0x96f6('0x1'));var moment=require(_0x96f6('0x2'));var BPromise=require(_0x96f6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x96f6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x96f6('0x5'))(_0x96f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x96f6('0x7'));var client=jayson[_0x96f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29574d,_0x53b02a,_0x2c1241){return new BPromise(function(_0x29fadc,_0x23e5de){return client[_0x96f6('0x9')](_0x29574d,_0x2c1241)[_0x96f6('0xa')](function(_0x10d163){logger['info'](_0x96f6('0xb'),_0x53b02a,_0x96f6('0xc'));logger['debug'](_0x96f6('0xd'),_0x53b02a,_0x96f6('0xc'),JSON['stringify'](_0x10d163));if(_0x10d163['error']){if(_0x10d163[_0x96f6('0xe')][_0x96f6('0xf')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x53b02a,_0x10d163[_0x96f6('0xe')]['message']);return _0x23e5de(_0x10d163[_0x96f6('0xe')]['message']);}logger[_0x96f6('0xe')](_0x96f6('0xb'),_0x53b02a,_0x10d163[_0x96f6('0xe')][_0x96f6('0x10')]);return _0x29fadc(_0x10d163[_0x96f6('0xe')][_0x96f6('0x10')]);}else{logger[_0x96f6('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x53b02a,_0x96f6('0xc'));_0x29fadc(_0x10d163['result'][_0x96f6('0x10')]);}})['catch'](function(_0x16ff22){logger['error'](_0x96f6('0xb'),_0x53b02a,_0x16ff22);_0x23e5de(_0x16ff22);});});} \ No newline at end of file +var _0x0082=['request\x20sent','stringify','code','message','error','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','info','FreshsalesConfiguration,\x20%s,\x20%s','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x28e157,_0x35ce5f){var _0x1abb00=function(_0x8ace4c){while(--_0x8ace4c){_0x28e157['push'](_0x28e157['shift']());}};_0x1abb00(++_0x35ce5f);}(_0x0082,0x73));var _0x2008=function(_0x4e2022,_0x3477a9){_0x4e2022=_0x4e2022-0x0;var _0x44c976=_0x0082[_0x4e2022];return _0x44c976;};'use strict';var _=require(_0x2008('0x0'));var util=require('util');var moment=require(_0x2008('0x1'));var BPromise=require('bluebird');var rs=require(_0x2008('0x2'));var fs=require('fs');var Redis=require(_0x2008('0x3'));var db=require(_0x2008('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2008('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2008('0x6')][_0x2008('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3977d2,_0x5a214a,_0x2eba59){return new BPromise(function(_0x43f914,_0x15b155){return client['request'](_0x3977d2,_0x2eba59)['then'](function(_0x1a4d99){logger[_0x2008('0x8')](_0x2008('0x9'),_0x5a214a,'request\x20sent');logger['debug'](_0x2008('0xa'),_0x5a214a,_0x2008('0xb'),JSON[_0x2008('0xc')](_0x1a4d99));if(_0x1a4d99['error']){if(_0x1a4d99['error'][_0x2008('0xd')]===0x1f4){logger['error'](_0x2008('0x9'),_0x5a214a,_0x1a4d99['error'][_0x2008('0xe')]);return _0x15b155(_0x1a4d99[_0x2008('0xf')][_0x2008('0xe')]);}logger[_0x2008('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5a214a,_0x1a4d99[_0x2008('0xf')][_0x2008('0xe')]);return _0x43f914(_0x1a4d99[_0x2008('0xf')]['message']);}else{logger['info'](_0x2008('0x9'),_0x5a214a,'request\x20sent');_0x43f914(_0x1a4d99[_0x2008('0x10')]['message']);}})[_0x2008('0x11')](function(_0x5b242b){logger[_0x2008('0xf')](_0x2008('0x9'),_0x5a214a,_0x5b242b);_0x15b155(_0x5b242b);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index c18842e..d71abc9 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 _0x292b=['post','put','isAuthenticated','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','show'];(function(_0x5b79d5,_0x580f3b){var _0x2dbcee=function(_0x1d108c){while(--_0x1d108c){_0x5b79d5['push'](_0x5b79d5['shift']());}};_0x2dbcee(++_0x580f3b);}(_0x292b,0x64));var _0xb292=function(_0x5e968c,_0x3d9d44){_0x5e968c=_0x5e968c-0x0;var _0x5a9fb3=_0x292b[_0x5e968c];return _0x5a9fb3;};'use strict';var multer=require(_0xb292('0x0'));var util=require(_0xb292('0x1'));var path=require(_0xb292('0x2'));var timeout=require(_0xb292('0x3'));var express=require(_0xb292('0x4'));var router=express[_0xb292('0x5')]();var fs_extra=require(_0xb292('0x6'));var auth=require(_0xb292('0x7'));var interaction=require(_0xb292('0x8'));var config=require(_0xb292('0x9'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb292('0xa')]);router[_0xb292('0xb')](_0xb292('0xc'),auth['isAuthenticated'](),controller[_0xb292('0xd')]);router[_0xb292('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb292('0xf')](_0xb292('0xc'),auth[_0xb292('0x10')](),controller['update']);router[_0xb292('0x11')](_0xb292('0xc'),auth[_0xb292('0x10')](),controller[_0xb292('0x12')]);module['exports']=router; \ No newline at end of file +var _0xaf93=['../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service'];(function(_0x2a558d,_0x2df0ff){var _0xa7bc9c=function(_0x12a30e){while(--_0x12a30e){_0x2a558d['push'](_0x2a558d['shift']());}};_0xa7bc9c(++_0x2df0ff);}(_0xaf93,0x151));var _0x3af9=function(_0x5e60e4,_0x310505){_0x5e60e4=_0x5e60e4-0x0;var _0xab6d4d=_0xaf93[_0x5e60e4];return _0xab6d4d;};'use strict';var multer=require(_0x3af9('0x0'));var util=require(_0x3af9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3af9('0x2'));var router=express[_0x3af9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3af9('0x4'));var interaction=require(_0x3af9('0x5'));var config=require(_0x3af9('0x6'));var controller=require(_0x3af9('0x7'));router[_0x3af9('0x8')]('/',auth[_0x3af9('0x9')](),controller[_0x3af9('0xa')]);router['get'](_0x3af9('0xb'),auth['isAuthenticated'](),controller[_0x3af9('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3af9('0xd')]);router['put']('/:id',auth[_0x3af9('0x9')](),controller[_0x3af9('0xe')]);router[_0x3af9('0xf')](_0x3af9('0xb'),auth['isAuthenticated'](),controller[_0x3af9('0x10')]);module[_0x3af9('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index c09a2ed..cbeef07 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 _0x06e4=['STRING','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist'];(function(_0x2f0366,_0x10885f){var _0x5e1c27=function(_0x3495c0){while(--_0x3495c0){_0x2f0366['push'](_0x2f0366['shift']());}};_0x5e1c27(++_0x10885f);}(_0x06e4,0x1cd));var _0x406e=function(_0x39b9b3,_0x3e9a66){_0x39b9b3=_0x39b9b3-0x0;var _0x4977c8=_0x06e4[_0x39b9b3];return _0x4977c8;};'use strict';var Sequelize=require(_0x406e('0x0'));module[_0x406e('0x1')]={'type':{'type':Sequelize['ENUM'](_0x406e('0x2'),_0x406e('0x3'),_0x406e('0x4'),_0x406e('0x5'),_0x406e('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x406e('0x7')]},'key':{'type':Sequelize[_0x406e('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x406e('0x2'),_0x406e('0x3'),_0x406e('0x4'))},'keyContent':{'type':Sequelize[_0x406e('0x7')]},'idField':{'type':Sequelize[_0x406e('0x7')]},'nameField':{'type':Sequelize[_0x406e('0x7')]},'customField':{'type':Sequelize[_0x406e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x406e('0x7')]}}; \ No newline at end of file +var _0x680b=['STRING','customVariable','BOOLEAN','exports','ENUM','string','variable','keyValue'];(function(_0x12d917,_0x59ddd4){var _0x576d1a=function(_0x360f23){while(--_0x360f23){_0x12d917['push'](_0x12d917['shift']());}};_0x576d1a(++_0x59ddd4);}(_0x680b,0x8b));var _0xb680=function(_0x45696c,_0x206842){_0x45696c=_0x45696c-0x0;var _0x5236b8=_0x680b[_0x45696c];return _0x5236b8;};'use strict';var Sequelize=require('sequelize');module[_0xb680('0x0')]={'type':{'type':Sequelize[_0xb680('0x1')](_0xb680('0x2'),_0xb680('0x3'),'customVariable',_0xb680('0x4'),'picklist'),'defaultValue':_0xb680('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb680('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xb680('0x2'),_0xb680('0x3'),_0xb680('0x6'))},'keyContent':{'type':Sequelize[_0xb680('0x5')]},'idField':{'type':Sequelize[_0xb680('0x5')]},'nameField':{'type':Sequelize[_0xb680('0x5')]},'customField':{'type':Sequelize[_0xb680('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb680('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 44a40b9..614719c 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 _0x6f51=['nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','name','index','FreshsalesField','rawAttributes','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x557f18,_0x9cedec){var _0x9e433c=function(_0x44dfcf){while(--_0x44dfcf){_0x557f18['push'](_0x557f18['shift']());}};_0x9e433c(++_0x9cedec);}(_0x6f51,0xf0));var _0x16f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f51[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x16f5('0x0'));var rimraf=require(_0x16f5('0x1'));var zipdir=require(_0x16f5('0x2'));var jsonpatch=require(_0x16f5('0x3'));var rp=require(_0x16f5('0x4'));var moment=require(_0x16f5('0x5'));var BPromise=require(_0x16f5('0x6'));var Mustache=require(_0x16f5('0x7'));var util=require('util');var path=require(_0x16f5('0x8'));var sox=require(_0x16f5('0x9'));var csv=require('to-csv');var ejs=require(_0x16f5('0xa'));var fs=require('fs');var fs_extra=require(_0x16f5('0xb'));var _=require(_0x16f5('0xc'));var squel=require(_0x16f5('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x16f5('0xe'));var querystring=require(_0x16f5('0xf'));var Papa=require(_0x16f5('0x10'));var Redis=require(_0x16f5('0x11'));var authService=require(_0x16f5('0x12'));var qs=require(_0x16f5('0x13'));var as=require(_0x16f5('0x14'));var hardwareService=require(_0x16f5('0x15'));var logger=require(_0x16f5('0x16'))(_0x16f5('0x17'));var utils=require(_0x16f5('0x18'));var config=require(_0x16f5('0x19'));var licenseUtil=require(_0x16f5('0x1a'));var db=require(_0x16f5('0x1b'))['db'];function respondWithStatusCode(_0x4fc82e,_0x24497a){_0x24497a=_0x24497a||0xcc;return function(_0x2ef6da){if(_0x2ef6da){return _0x4fc82e[_0x16f5('0x1c')](_0x24497a);}return _0x4fc82e[_0x16f5('0x1d')](_0x24497a)[_0x16f5('0x1e')]();};}function respondWithResult(_0x265cc6,_0x764440){_0x764440=_0x764440||0xc8;return function(_0x4c144c){if(_0x4c144c){return _0x265cc6['status'](_0x764440)[_0x16f5('0x1f')](_0x4c144c);}};}function respondWithFilteredResult(_0xa027cd,_0x5d4c76){return function(_0x51e98b){if(_0x51e98b){var _0x37a7aa=typeof _0x5d4c76[_0x16f5('0x20')]===_0x16f5('0x21')&&typeof _0x5d4c76[_0x16f5('0x22')]===_0x16f5('0x21');var _0x40b800=_0x51e98b[_0x16f5('0x23')];var _0x182cef=_0x37a7aa?0x0:_0x5d4c76['offset'];var _0x245a8c=_0x37a7aa?_0x51e98b[_0x16f5('0x23')]:_0x5d4c76[_0x16f5('0x20')]+_0x5d4c76[_0x16f5('0x22')];var _0x3bd2f5;if(_0x245a8c>=_0x40b800){_0x245a8c=_0x40b800;_0x3bd2f5=0xc8;}else{_0x3bd2f5=0xce;}_0xa027cd[_0x16f5('0x1d')](_0x3bd2f5);return _0xa027cd[_0x16f5('0x24')]('Content-Range',_0x182cef+'-'+_0x245a8c+'/'+_0x40b800)[_0x16f5('0x1f')](_0x51e98b);}return null;};}function patchUpdates(_0x15b20d){return function(_0x5225ce){try{jsonpatch['apply'](_0x5225ce,_0x15b20d,!![]);}catch(_0x31163c){return BPromise[_0x16f5('0x25')](_0x31163c);}return _0x5225ce[_0x16f5('0x26')]();};}function saveUpdates(_0x1ab6f7,_0x59086a){return function(_0x3f386f){if(_0x3f386f){return _0x3f386f[_0x16f5('0x27')](_0x1ab6f7)[_0x16f5('0x28')](function(_0x31249f){return _0x31249f;});}return null;};}function removeEntity(_0x4253b0,_0x2b1b66){return function(_0x55b0f9){if(_0x55b0f9){return _0x55b0f9[_0x16f5('0x29')]()[_0x16f5('0x28')](function(){_0x4253b0[_0x16f5('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf13373,_0x149b18){return function(_0x145105){if(!_0x145105){_0xf13373[_0x16f5('0x1c')](0x194);}return _0x145105;};}function handleError(_0x208a5d,_0x4aadc6){_0x4aadc6=_0x4aadc6||0x1f4;return function(_0x366239){logger[_0x16f5('0x2a')](_0x366239['stack']);if(_0x366239[_0x16f5('0x2b')]){delete _0x366239['name'];}_0x208a5d[_0x16f5('0x1d')](_0x4aadc6)['send'](_0x366239);};}exports[_0x16f5('0x2c')]=function(_0x184722,_0x19942b){var _0x511981={},_0x5011cf={},_0x125609={'count':0x0,'rows':[]};var _0x34cd14=_['map'](db[_0x16f5('0x2d')][_0x16f5('0x2e')],function(_0x4139b2){return{'name':_0x4139b2['fieldName'],'type':_0x4139b2['type']['key']};});_0x5011cf[_0x16f5('0x2f')]=_[_0x16f5('0x30')](_0x34cd14,_0x16f5('0x2b'));_0x5011cf[_0x16f5('0x31')]=_[_0x16f5('0x32')](_0x184722['query']);_0x5011cf[_0x16f5('0x33')]=_[_0x16f5('0x34')](_0x5011cf[_0x16f5('0x2f')],_0x5011cf[_0x16f5('0x31')]);_0x511981[_0x16f5('0x35')]=_[_0x16f5('0x34')](_0x5011cf[_0x16f5('0x2f')],qs['fields'](_0x184722[_0x16f5('0x31')][_0x16f5('0x36')]));_0x511981[_0x16f5('0x35')]=_0x511981[_0x16f5('0x35')]['length']?_0x511981[_0x16f5('0x35')]:_0x5011cf[_0x16f5('0x2f')];if(!_0x184722[_0x16f5('0x31')][_0x16f5('0x37')](_0x16f5('0x38'))){_0x511981[_0x16f5('0x22')]=qs['limit'](_0x184722[_0x16f5('0x31')][_0x16f5('0x22')]);_0x511981[_0x16f5('0x20')]=qs[_0x16f5('0x20')](_0x184722[_0x16f5('0x31')][_0x16f5('0x20')]);}_0x511981[_0x16f5('0x39')]=qs[_0x16f5('0x3a')](_0x184722[_0x16f5('0x31')][_0x16f5('0x3a')]);_0x511981['where']=qs[_0x16f5('0x33')](_['pick'](_0x184722[_0x16f5('0x31')],_0x5011cf[_0x16f5('0x33')]),_0x34cd14);if(_0x184722[_0x16f5('0x31')][_0x16f5('0x3b')]){_0x511981['where']=_[_0x16f5('0x3c')](_0x511981[_0x16f5('0x3d')],{'$or':_[_0x16f5('0x30')](_0x34cd14,function(_0x5c8a01){if(_0x5c8a01['type']!==_0x16f5('0x3e')){var _0x36136f={};_0x36136f[_0x5c8a01[_0x16f5('0x2b')]]={'$like':'%'+_0x184722[_0x16f5('0x31')]['filter']+'%'};return _0x36136f;}})});}_0x511981=_[_0x16f5('0x3c')]({},_0x511981,_0x184722[_0x16f5('0x3f')]);var _0x66e3e5={'where':_0x511981[_0x16f5('0x3d')]};return db[_0x16f5('0x2d')][_0x16f5('0x23')](_0x66e3e5)[_0x16f5('0x28')](function(_0x3fd5c9){_0x125609[_0x16f5('0x23')]=_0x3fd5c9;if(_0x184722[_0x16f5('0x31')][_0x16f5('0x40')]){_0x511981['include']=[{'all':!![]}];}return db[_0x16f5('0x2d')][_0x16f5('0x41')](_0x511981);})[_0x16f5('0x28')](function(_0x9468e4){_0x125609[_0x16f5('0x42')]=_0x9468e4;return _0x125609;})[_0x16f5('0x28')](respondWithFilteredResult(_0x19942b,_0x511981))[_0x16f5('0x43')](handleError(_0x19942b,null));};exports[_0x16f5('0x44')]=function(_0x2093e2,_0x1fce47){var _0x2f43b9={'raw':!![],'where':{'id':_0x2093e2[_0x16f5('0x45')]['id']}},_0x267c8f={};_0x267c8f[_0x16f5('0x2f')]=_[_0x16f5('0x32')](db[_0x16f5('0x2d')]['rawAttributes']);_0x267c8f[_0x16f5('0x31')]=_[_0x16f5('0x32')](_0x2093e2[_0x16f5('0x31')]);_0x267c8f[_0x16f5('0x33')]=_[_0x16f5('0x34')](_0x267c8f['model'],_0x267c8f[_0x16f5('0x31')]);_0x2f43b9[_0x16f5('0x35')]=_[_0x16f5('0x34')](_0x267c8f[_0x16f5('0x2f')],qs[_0x16f5('0x36')](_0x2093e2['query'][_0x16f5('0x36')]));_0x2f43b9[_0x16f5('0x35')]=_0x2f43b9['attributes']['length']?_0x2f43b9[_0x16f5('0x35')]:_0x267c8f[_0x16f5('0x2f')];if(_0x2093e2[_0x16f5('0x31')][_0x16f5('0x40')]){_0x2f43b9[_0x16f5('0x46')]=[{'all':!![]}];}_0x2f43b9=_[_0x16f5('0x3c')]({},_0x2f43b9,_0x2093e2[_0x16f5('0x3f')]);return db[_0x16f5('0x2d')][_0x16f5('0x47')](_0x2f43b9)[_0x16f5('0x28')](handleEntityNotFound(_0x1fce47,null))['then'](respondWithResult(_0x1fce47,null))[_0x16f5('0x43')](handleError(_0x1fce47,null));};exports['create']=function(_0x503469,_0x611ed3){return db[_0x16f5('0x2d')][_0x16f5('0x48')](_0x503469['body'],{})[_0x16f5('0x28')](respondWithResult(_0x611ed3,0xc9))[_0x16f5('0x43')](handleError(_0x611ed3,null));};exports[_0x16f5('0x27')]=function(_0x4a7718,_0x48a167){if(_0x4a7718[_0x16f5('0x49')]['id']){delete _0x4a7718['body']['id'];}return db[_0x16f5('0x2d')][_0x16f5('0x47')]({'where':{'id':_0x4a7718['params']['id']}})[_0x16f5('0x28')](handleEntityNotFound(_0x48a167,null))[_0x16f5('0x28')](saveUpdates(_0x4a7718[_0x16f5('0x49')],null))[_0x16f5('0x28')](respondWithResult(_0x48a167,null))[_0x16f5('0x43')](handleError(_0x48a167,null));};exports[_0x16f5('0x29')]=function(_0x3d9a5a,_0x5e7ac3){return db[_0x16f5('0x2d')][_0x16f5('0x47')]({'where':{'id':_0x3d9a5a[_0x16f5('0x45')]['id']}})['then'](handleEntityNotFound(_0x5e7ac3,null))[_0x16f5('0x28')](removeEntity(_0x5e7ac3,null))['catch'](handleError(_0x5e7ac3,null));}; \ No newline at end of file +var _0x74e2=['path','sox','to-csv','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','options','findAll','catch','params','include','FreshsalesField','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x74e2,0x169));var _0x274e=function(_0x9fe4c0,_0xe3bd7f){_0x9fe4c0=_0x9fe4c0-0x0;var _0x566bf7=_0x74e2[_0x9fe4c0];return _0x566bf7;};'use strict';var emlformat=require(_0x274e('0x0'));var rimraf=require(_0x274e('0x1'));var zipdir=require(_0x274e('0x2'));var jsonpatch=require(_0x274e('0x3'));var rp=require(_0x274e('0x4'));var moment=require(_0x274e('0x5'));var BPromise=require(_0x274e('0x6'));var Mustache=require(_0x274e('0x7'));var util=require(_0x274e('0x8'));var path=require(_0x274e('0x9'));var sox=require(_0x274e('0xa'));var csv=require(_0x274e('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x274e('0xc'));var _=require(_0x274e('0xd'));var squel=require('squel');var crypto=require(_0x274e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x274e('0xf'));var toCsv=require(_0x274e('0xb'));var querystring=require('querystring');var Papa=require(_0x274e('0x10'));var Redis=require(_0x274e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x274e('0x12'));var hardwareService=require(_0x274e('0x13'));var logger=require(_0x274e('0x14'))('api');var utils=require(_0x274e('0x15'));var config=require(_0x274e('0x16'));var licenseUtil=require(_0x274e('0x17'));var db=require(_0x274e('0x18'))['db'];function respondWithStatusCode(_0x19fd9a,_0x354984){_0x354984=_0x354984||0xcc;return function(_0x500274){if(_0x500274){return _0x19fd9a[_0x274e('0x19')](_0x354984);}return _0x19fd9a['status'](_0x354984)[_0x274e('0x1a')]();};}function respondWithResult(_0x10a51b,_0x4bc4de){_0x4bc4de=_0x4bc4de||0xc8;return function(_0xf06ced){if(_0xf06ced){return _0x10a51b[_0x274e('0x1b')](_0x4bc4de)[_0x274e('0x1c')](_0xf06ced);}};}function respondWithFilteredResult(_0x387aa0,_0xabc2){return function(_0x5e0e18){if(_0x5e0e18){var _0x171cf7=typeof _0xabc2[_0x274e('0x1d')]===_0x274e('0x1e')&&typeof _0xabc2[_0x274e('0x1f')]===_0x274e('0x1e');var _0x5f0a24=_0x5e0e18[_0x274e('0x20')];var _0x282043=_0x171cf7?0x0:_0xabc2[_0x274e('0x1d')];var _0x201152=_0x171cf7?_0x5e0e18[_0x274e('0x20')]:_0xabc2['offset']+_0xabc2['limit'];var _0x228146;if(_0x201152>=_0x5f0a24){_0x201152=_0x5f0a24;_0x228146=0xc8;}else{_0x228146=0xce;}_0x387aa0[_0x274e('0x1b')](_0x228146);return _0x387aa0[_0x274e('0x21')](_0x274e('0x22'),_0x282043+'-'+_0x201152+'/'+_0x5f0a24)[_0x274e('0x1c')](_0x5e0e18);}return null;};}function patchUpdates(_0x89091c){return function(_0x13f84b){try{jsonpatch[_0x274e('0x23')](_0x13f84b,_0x89091c,!![]);}catch(_0xfe317b){return BPromise[_0x274e('0x24')](_0xfe317b);}return _0x13f84b[_0x274e('0x25')]();};}function saveUpdates(_0x30d9a4,_0x544de7){return function(_0x3e53d3){if(_0x3e53d3){return _0x3e53d3[_0x274e('0x26')](_0x30d9a4)[_0x274e('0x27')](function(_0x2a465e){return _0x2a465e;});}return null;};}function removeEntity(_0x2d2546,_0x1c400f){return function(_0x14ad9d){if(_0x14ad9d){return _0x14ad9d['destroy']()[_0x274e('0x27')](function(){_0x2d2546['status'](0xcc)[_0x274e('0x1a')]();});}};}function handleEntityNotFound(_0x1697eb,_0x5eac1c){return function(_0x428d7a){if(!_0x428d7a){_0x1697eb[_0x274e('0x19')](0x194);}return _0x428d7a;};}function handleError(_0x4a481f,_0x188a8b){_0x188a8b=_0x188a8b||0x1f4;return function(_0x5d38f0){logger[_0x274e('0x28')](_0x5d38f0['stack']);if(_0x5d38f0[_0x274e('0x29')]){delete _0x5d38f0[_0x274e('0x29')];}_0x4a481f['status'](_0x188a8b)[_0x274e('0x2a')](_0x5d38f0);};}exports[_0x274e('0x2b')]=function(_0x5121f3,_0x381512){var _0x4ede76={},_0x427b9c={},_0x52e3ec={'count':0x0,'rows':[]};var _0x10d7fa=_[_0x274e('0x2c')](db['FreshsalesField'][_0x274e('0x2d')],function(_0x564616){return{'name':_0x564616[_0x274e('0x2e')],'type':_0x564616[_0x274e('0x2f')][_0x274e('0x30')]};});_0x427b9c[_0x274e('0x31')]=_[_0x274e('0x2c')](_0x10d7fa,_0x274e('0x29'));_0x427b9c[_0x274e('0x32')]=_[_0x274e('0x33')](_0x5121f3[_0x274e('0x32')]);_0x427b9c['filters']=_[_0x274e('0x34')](_0x427b9c['model'],_0x427b9c[_0x274e('0x32')]);_0x4ede76['attributes']=_[_0x274e('0x34')](_0x427b9c[_0x274e('0x31')],qs[_0x274e('0x35')](_0x5121f3['query'][_0x274e('0x35')]));_0x4ede76[_0x274e('0x36')]=_0x4ede76[_0x274e('0x36')][_0x274e('0x37')]?_0x4ede76[_0x274e('0x36')]:_0x427b9c['model'];if(!_0x5121f3[_0x274e('0x32')][_0x274e('0x38')](_0x274e('0x39'))){_0x4ede76[_0x274e('0x1f')]=qs['limit'](_0x5121f3[_0x274e('0x32')]['limit']);_0x4ede76[_0x274e('0x1d')]=qs['offset'](_0x5121f3[_0x274e('0x32')]['offset']);}_0x4ede76[_0x274e('0x3a')]=qs[_0x274e('0x3b')](_0x5121f3['query'][_0x274e('0x3b')]);_0x4ede76[_0x274e('0x3c')]=qs[_0x274e('0x3d')](_[_0x274e('0x3e')](_0x5121f3[_0x274e('0x32')],_0x427b9c[_0x274e('0x3d')]),_0x10d7fa);if(_0x5121f3[_0x274e('0x32')]['filter']){_0x4ede76[_0x274e('0x3c')]=_['merge'](_0x4ede76[_0x274e('0x3c')],{'$or':_[_0x274e('0x2c')](_0x10d7fa,function(_0x382155){if(_0x382155[_0x274e('0x2f')]!==_0x274e('0x3f')){var _0x1ec755={};_0x1ec755[_0x382155['name']]={'$like':'%'+_0x5121f3[_0x274e('0x32')]['filter']+'%'};return _0x1ec755;}})});}_0x4ede76=_[_0x274e('0x40')]({},_0x4ede76,_0x5121f3[_0x274e('0x41')]);var _0x5a589c={'where':_0x4ede76[_0x274e('0x3c')]};return db['FreshsalesField'][_0x274e('0x20')](_0x5a589c)[_0x274e('0x27')](function(_0x46f49b){_0x52e3ec[_0x274e('0x20')]=_0x46f49b;if(_0x5121f3['query']['includeAll']){_0x4ede76['include']=[{'all':!![]}];}return db['FreshsalesField'][_0x274e('0x42')](_0x4ede76);})[_0x274e('0x27')](function(_0x51cfce){_0x52e3ec['rows']=_0x51cfce;return _0x52e3ec;})[_0x274e('0x27')](respondWithFilteredResult(_0x381512,_0x4ede76))[_0x274e('0x43')](handleError(_0x381512,null));};exports['show']=function(_0x502993,_0x38f9d7){var _0x5c4d82={'raw':!![],'where':{'id':_0x502993[_0x274e('0x44')]['id']}},_0x136493={};_0x136493[_0x274e('0x31')]=_[_0x274e('0x33')](db['FreshsalesField'][_0x274e('0x2d')]);_0x136493[_0x274e('0x32')]=_[_0x274e('0x33')](_0x502993[_0x274e('0x32')]);_0x136493[_0x274e('0x3d')]=_['intersection'](_0x136493[_0x274e('0x31')],_0x136493[_0x274e('0x32')]);_0x5c4d82['attributes']=_['intersection'](_0x136493[_0x274e('0x31')],qs[_0x274e('0x35')](_0x502993['query'][_0x274e('0x35')]));_0x5c4d82['attributes']=_0x5c4d82['attributes'][_0x274e('0x37')]?_0x5c4d82['attributes']:_0x136493[_0x274e('0x31')];if(_0x502993[_0x274e('0x32')]['includeAll']){_0x5c4d82[_0x274e('0x45')]=[{'all':!![]}];}_0x5c4d82=_[_0x274e('0x40')]({},_0x5c4d82,_0x502993['options']);return db[_0x274e('0x46')][_0x274e('0x47')](_0x5c4d82)[_0x274e('0x27')](handleEntityNotFound(_0x38f9d7,null))[_0x274e('0x27')](respondWithResult(_0x38f9d7,null))['catch'](handleError(_0x38f9d7,null));};exports['create']=function(_0x5b051b,_0x414d8b){return db[_0x274e('0x46')][_0x274e('0x48')](_0x5b051b[_0x274e('0x49')],{})[_0x274e('0x27')](respondWithResult(_0x414d8b,0xc9))[_0x274e('0x43')](handleError(_0x414d8b,null));};exports[_0x274e('0x26')]=function(_0x33b976,_0x2a2bbf){if(_0x33b976[_0x274e('0x49')]['id']){delete _0x33b976[_0x274e('0x49')]['id'];}return db[_0x274e('0x46')][_0x274e('0x47')]({'where':{'id':_0x33b976[_0x274e('0x44')]['id']}})[_0x274e('0x27')](handleEntityNotFound(_0x2a2bbf,null))[_0x274e('0x27')](saveUpdates(_0x33b976[_0x274e('0x49')],null))[_0x274e('0x27')](respondWithResult(_0x2a2bbf,null))[_0x274e('0x43')](handleError(_0x2a2bbf,null));};exports['destroy']=function(_0x39a01f,_0xd384b2){return db['FreshsalesField'][_0x274e('0x47')]({'where':{'id':_0x39a01f['params']['id']}})[_0x274e('0x27')](handleEntityNotFound(_0xd384b2,null))['then'](removeEntity(_0xd384b2,null))[_0x274e('0x43')](handleError(_0xd384b2,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index b0a5029..35e7738 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 _0x505d=['FreshsalesField','int_freshsales_fields','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesField.attributes','exports'];(function(_0x4f6f84,_0x31e197){var _0x20d989=function(_0x34db70){while(--_0x34db70){_0x4f6f84['push'](_0x4f6f84['shift']());}};_0x20d989(++_0x31e197);}(_0x505d,0x93));var _0xd505=function(_0x513047,_0x2199c5){_0x513047=_0x513047-0x0;var _0x15b779=_0x505d[_0x513047];return _0x15b779;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd505('0x0'))(_0xd505('0x1'));var moment=require(_0xd505('0x2'));var BPromise=require(_0xd505('0x3'));var rp=require(_0xd505('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd505('0x5'));var config=require(_0xd505('0x6'));var attributes=require(_0xd505('0x7'));module[_0xd505('0x8')]=function(_0x4ab634,_0x3a2863){return _0x4ab634['define'](_0xd505('0x9'),attributes,{'tableName':_0xd505('0xa'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xd505('0xb'),_0xd505('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x762e=['lodash','api','request-promise','path','rimraf','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId'];(function(_0x45d25f,_0x414062){var _0x5eedff=function(_0x3bd135){while(--_0x3bd135){_0x45d25f['push'](_0x45d25f['shift']());}};_0x5eedff(++_0x414062);}(_0x762e,0xea));var _0xe762=function(_0x48b6ac,_0x53297e){_0x48b6ac=_0x48b6ac-0x0;var _0x546a72=_0x762e[_0x48b6ac];return _0x546a72;};'use strict';var _=require(_0xe762('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe762('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe762('0x2'));var fs=require('fs');var path=require(_0xe762('0x3'));var rimraf=require(_0xe762('0x4'));var config=require('../../config/environment');var attributes=require(_0xe762('0x5'));module[_0xe762('0x6')]=function(_0x48995a,_0x4abeb6){return _0x48995a[_0xe762('0x7')](_0xe762('0x8'),attributes,{'tableName':_0xe762('0x9'),'paranoid':![],'indexes':[{'name':_0xe762('0xa'),'fields':[_0xe762('0xb'),_0xe762('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 97c4cf6..edd3857 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 _0x4819=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment'];(function(_0x1a213e,_0x2dfa35){var _0x244859=function(_0x193dde){while(--_0x193dde){_0x1a213e['push'](_0x1a213e['shift']());}};_0x244859(++_0x2dfa35);}(_0x4819,0xcd));var _0x9481=function(_0x5b7f48,_0x4d8a1d){_0x5b7f48=_0x5b7f48-0x0;var _0x2424b0=_0x4819[_0x5b7f48];return _0x2424b0;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var moment=require(_0x9481('0x1'));var BPromise=require(_0x9481('0x2'));var rs=require(_0x9481('0x3'));var fs=require('fs');var Redis=require(_0x9481('0x4'));var db=require(_0x9481('0x5'))['db'];var utils=require(_0x9481('0x6'));var logger=require(_0x9481('0x7'))(_0x9481('0x8'));var config=require(_0x9481('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9481('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54cc78,_0x14e05a,_0x6c6a08){return new BPromise(function(_0x27c033,_0x3278ff){return client[_0x9481('0xb')](_0x54cc78,_0x6c6a08)['then'](function(_0x1818cf){logger['info'](_0x9481('0xc'),_0x14e05a,'request\x20sent');logger[_0x9481('0xd')](_0x9481('0xe'),_0x14e05a,_0x9481('0xf'),JSON[_0x9481('0x10')](_0x1818cf));if(_0x1818cf[_0x9481('0x11')]){if(_0x1818cf[_0x9481('0x11')][_0x9481('0x12')]===0x1f4){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf['error']['message']);return _0x3278ff(_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);}logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);return _0x27c033(_0x1818cf[_0x9481('0x11')]['message']);}else{logger[_0x9481('0x14')](_0x9481('0xc'),_0x14e05a,'request\x20sent');_0x27c033(_0x1818cf[_0x9481('0x15')]['message']);}})[_0x9481('0x16')](function(_0x7a2ac8){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x7a2ac8);_0x3278ff(_0x7a2ac8);});});} \ No newline at end of file +var _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x53ec,0x192));var _0xc53e=function(_0x57e00e,_0x36e79a){_0x57e00e=_0x57e00e-0x0;var _0x415e60=_0x53ec[_0x57e00e];return _0x415e60;};'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')]('FreshsalesField,\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 diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index f748201..39c92ff 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1eab7d,_0x53bc62){var _0x5acf22=function(_0x1235e6){while(--_0x1235e6){_0x1eab7d['push'](_0x1eab7d['shift']());}};_0x5acf22(++_0x53bc62);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +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(_0x2c32ae,_0x5c1998){var _0x47ab92=function(_0x16c1d3){while(--_0x16c1d3){_0x2c32ae['push'](_0x2c32ae['shift']());}};_0x47ab92(++_0x5c1998);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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 f897571..a03f8fb 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 _0x15e8=['STRING','username','ENUM','integrationTab','newTab','exports'];(function(_0x51c6ec,_0x4790cf){var _0x3fca4f=function(_0x3b53f1){while(--_0x3b53f1){_0x51c6ec['push'](_0x51c6ec['shift']());}};_0x3fca4f(++_0x4790cf);}(_0x15e8,0x13d));var _0x815e=function(_0x219e67,_0x154c9a){_0x219e67=_0x219e67-0x0;var _0x2d51a3=_0x15e8[_0x219e67];return _0x2d51a3;};'use strict';var Sequelize=require('sequelize');module[_0x815e('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x815e('0x1')]},'username':{'type':Sequelize[_0x815e('0x1')],'unique':_0x815e('0x2')},'remoteUri':{'type':Sequelize[_0x815e('0x1')]},'password':{'type':Sequelize[_0x815e('0x1')]},'clientId':{'type':Sequelize[_0x815e('0x1')]},'clientSecret':{'type':Sequelize[_0x815e('0x1')]},'securityToken':{'type':Sequelize[_0x815e('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x815e('0x3')](_0x815e('0x4'),_0x815e('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xd70e=['newTab','sequelize','STRING','username','ENUM','integrationTab'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xd70e,0x157));var _0xed70=function(_0x2ea354,_0x5bc59d){_0x2ea354=_0x2ea354-0x0;var _0x9a2b5=_0xd70e[_0x2ea354];return _0x9a2b5;};'use strict';var Sequelize=require(_0xed70('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xed70('0x1')]},'username':{'type':Sequelize[_0xed70('0x1')],'unique':_0xed70('0x2')},'remoteUri':{'type':Sequelize[_0xed70('0x1')]},'password':{'type':Sequelize[_0xed70('0x1')]},'clientId':{'type':Sequelize[_0xed70('0x1')]},'clientSecret':{'type':Sequelize[_0xed70('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xed70('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xed70('0x3')](_0xed70('0x4'),_0xed70('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 5a49d2d..826c607 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 _0x3270=['filter','merge','options','includeAll','include','findAll','show','params','find','catch','create','body','findOne','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceConfiguration','SalesforceField','getFields','Task','clientId','password','remoteUri','slice','substring','Connection','login','username','securityToken','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Description','string','int','boolean','textarea','phone','includes','custom','picklistValues','label','value','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','status','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','pick'];(function(_0x34fe78,_0xfcb5e0){var _0x584e2d=function(_0x327940){while(--_0x327940){_0x34fe78['push'](_0x34fe78['shift']());}};_0x584e2d(++_0xfcb5e0);}(_0x3270,0xb1));var _0x0327=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0x3270[_0x57d13b];return _0x467696;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0327('0x0'));var zipdir=require(_0x0327('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0327('0x2'));var moment=require('moment');var BPromise=require(_0x0327('0x3'));var Mustache=require(_0x0327('0x4'));var util=require('util');var path=require(_0x0327('0x5'));var sox=require(_0x0327('0x6'));var csv=require('to-csv');var ejs=require(_0x0327('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0327('0x8'));var squel=require(_0x0327('0x9'));var crypto=require(_0x0327('0xa'));var jsforce=require(_0x0327('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0327('0xc'));var querystring=require('querystring');var Papa=require(_0x0327('0xd'));var Redis=require(_0x0327('0xe'));var authService=require(_0x0327('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0327('0x10'));var hardwareService=require(_0x0327('0x11'));var logger=require(_0x0327('0x12'))(_0x0327('0x13'));var utils=require(_0x0327('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0327('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x0327('0x16'));function respondWithStatusCode(_0x11dcdf,_0x181a73){_0x181a73=_0x181a73||0xcc;return function(_0x56b8ef){if(_0x56b8ef){return _0x11dcdf['sendStatus'](_0x181a73);}return _0x11dcdf[_0x0327('0x17')](_0x181a73)['end']();};}function respondWithResult(_0xb0ae7,_0x3a1aad){_0x3a1aad=_0x3a1aad||0xc8;return function(_0x37c2c6){if(_0x37c2c6){return _0xb0ae7[_0x0327('0x17')](_0x3a1aad)['json'](_0x37c2c6);}};}function respondWithFilteredResult(_0x492b92,_0x1a26ca){return function(_0x5a637e){if(_0x5a637e){var _0x41280e=typeof _0x1a26ca[_0x0327('0x18')]===_0x0327('0x19')&&typeof _0x1a26ca['limit']===_0x0327('0x19');var _0x5796ff=_0x5a637e[_0x0327('0x1a')];var _0x159664=_0x41280e?0x0:_0x1a26ca[_0x0327('0x18')];var _0x23736a=_0x41280e?_0x5a637e[_0x0327('0x1a')]:_0x1a26ca[_0x0327('0x18')]+_0x1a26ca['limit'];var _0x237480;if(_0x23736a>=_0x5796ff){_0x23736a=_0x5796ff;_0x237480=0xc8;}else{_0x237480=0xce;}_0x492b92['status'](_0x237480);return _0x492b92[_0x0327('0x1b')](_0x0327('0x1c'),_0x159664+'-'+_0x23736a+'/'+_0x5796ff)['json'](_0x5a637e);}return null;};}function patchUpdates(_0x128aed){return function(_0xdbd344){try{jsonpatch[_0x0327('0x1d')](_0xdbd344,_0x128aed,!![]);}catch(_0x20237e){return BPromise[_0x0327('0x1e')](_0x20237e);}return _0xdbd344[_0x0327('0x1f')]();};}function saveUpdates(_0x120147,_0x1da8ab){return function(_0x3a2eb9){if(_0x3a2eb9){return _0x3a2eb9[_0x0327('0x20')](_0x120147)[_0x0327('0x21')](function(_0x1b61c6){return _0x1b61c6;});}return null;};}function removeEntity(_0xbc9bba,_0x1ed421){return function(_0x240d3d){if(_0x240d3d){return _0x240d3d[_0x0327('0x22')]()[_0x0327('0x21')](function(){_0xbc9bba['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x93df93,_0x490ca1){return function(_0x10354d){if(!_0x10354d){_0x93df93[_0x0327('0x23')](0x194);}return _0x10354d;};}function handleError(_0x4a7dfc,_0x40724f){_0x40724f=_0x40724f||0x1f4;return function(_0x566cc2){logger[_0x0327('0x24')](_0x566cc2[_0x0327('0x25')]);if(_0x566cc2[_0x0327('0x26')]){delete _0x566cc2[_0x0327('0x26')];}_0x4a7dfc[_0x0327('0x17')](_0x40724f)[_0x0327('0x27')](_0x566cc2);};}exports[_0x0327('0x28')]=function(_0x1b103f,_0x4be3c){var _0x187363={},_0x29156f={},_0x53008c={'count':0x0,'rows':[]};var _0x45d48e=_[_0x0327('0x29')](db[_0x0327('0x2a')][_0x0327('0x2b')],function(_0x523641){return{'name':_0x523641['fieldName'],'type':_0x523641[_0x0327('0x2c')][_0x0327('0x2d')]};});_0x29156f[_0x0327('0x2e')]=_[_0x0327('0x29')](_0x45d48e,_0x0327('0x26'));_0x29156f[_0x0327('0x2f')]=_[_0x0327('0x30')](_0x1b103f[_0x0327('0x2f')]);_0x29156f[_0x0327('0x31')]=_[_0x0327('0x32')](_0x29156f[_0x0327('0x2e')],_0x29156f[_0x0327('0x2f')]);_0x187363[_0x0327('0x33')]=_[_0x0327('0x32')](_0x29156f[_0x0327('0x2e')],qs[_0x0327('0x34')](_0x1b103f[_0x0327('0x2f')][_0x0327('0x34')]));_0x187363['attributes']=_0x187363['attributes'][_0x0327('0x35')]?_0x187363[_0x0327('0x33')]:_0x29156f[_0x0327('0x2e')];if(!_0x1b103f[_0x0327('0x2f')]['hasOwnProperty']('nolimit')){_0x187363[_0x0327('0x36')]=qs['limit'](_0x1b103f[_0x0327('0x2f')][_0x0327('0x36')]);_0x187363[_0x0327('0x18')]=qs[_0x0327('0x18')](_0x1b103f[_0x0327('0x2f')]['offset']);}_0x187363[_0x0327('0x37')]=qs['sort'](_0x1b103f[_0x0327('0x2f')][_0x0327('0x38')]);_0x187363[_0x0327('0x39')]=qs[_0x0327('0x31')](_[_0x0327('0x3a')](_0x1b103f[_0x0327('0x2f')],_0x29156f[_0x0327('0x31')]),_0x45d48e);if(_0x1b103f[_0x0327('0x2f')][_0x0327('0x3b')]){_0x187363[_0x0327('0x39')]=_[_0x0327('0x3c')](_0x187363[_0x0327('0x39')],{'$or':_[_0x0327('0x29')](_0x45d48e,function(_0x3cc728){if(_0x3cc728[_0x0327('0x2c')]!=='VIRTUAL'){var _0x4a6743={};_0x4a6743[_0x3cc728[_0x0327('0x26')]]={'$like':'%'+_0x1b103f[_0x0327('0x2f')][_0x0327('0x3b')]+'%'};return _0x4a6743;}})});}_0x187363=_['merge']({},_0x187363,_0x1b103f[_0x0327('0x3d')]);var _0x143c13={'where':_0x187363[_0x0327('0x39')]};return db[_0x0327('0x2a')][_0x0327('0x1a')](_0x143c13)[_0x0327('0x21')](function(_0x1aec99){_0x53008c[_0x0327('0x1a')]=_0x1aec99;if(_0x1b103f[_0x0327('0x2f')][_0x0327('0x3e')]){_0x187363[_0x0327('0x3f')]=[{'all':!![]}];}return db[_0x0327('0x2a')][_0x0327('0x40')](_0x187363);})[_0x0327('0x21')](function(_0x1299a4){_0x53008c['rows']=_0x1299a4;return _0x53008c;})[_0x0327('0x21')](respondWithFilteredResult(_0x4be3c,_0x187363))['catch'](handleError(_0x4be3c,null));};exports[_0x0327('0x41')]=function(_0xd1cec3,_0x518336){var _0x1ccd2e={'raw':![],'where':{'id':_0xd1cec3[_0x0327('0x42')]['id']}},_0x1de70e={};_0x1de70e[_0x0327('0x2e')]=_['keys'](db[_0x0327('0x2a')][_0x0327('0x2b')]);_0x1de70e[_0x0327('0x2f')]=_['keys'](_0xd1cec3[_0x0327('0x2f')]);_0x1de70e[_0x0327('0x31')]=_[_0x0327('0x32')](_0x1de70e[_0x0327('0x2e')],_0x1de70e['query']);_0x1ccd2e[_0x0327('0x33')]=_['intersection'](_0x1de70e['model'],qs[_0x0327('0x34')](_0xd1cec3[_0x0327('0x2f')][_0x0327('0x34')]));_0x1ccd2e[_0x0327('0x33')]=_0x1ccd2e['attributes'][_0x0327('0x35')]?_0x1ccd2e[_0x0327('0x33')]:_0x1de70e[_0x0327('0x2e')];if(_0xd1cec3[_0x0327('0x2f')]['includeAll']){_0x1ccd2e['include']=[{'all':!![]}];}_0x1ccd2e=_[_0x0327('0x3c')]({},_0x1ccd2e,_0xd1cec3[_0x0327('0x3d')]);return db['SalesforceAccount'][_0x0327('0x43')](_0x1ccd2e)[_0x0327('0x21')](handleEntityNotFound(_0x518336,null))[_0x0327('0x21')](respondWithResult(_0x518336,null))[_0x0327('0x44')](handleError(_0x518336,null));};exports['create']=function(_0x2a0dbe,_0x2a5e96){return db[_0x0327('0x2a')][_0x0327('0x45')](_0x2a0dbe[_0x0327('0x46')],{})[_0x0327('0x21')](respondWithResult(_0x2a5e96,0xc9))[_0x0327('0x44')](handleError(_0x2a5e96,null));};exports[_0x0327('0x20')]=function(_0x113c83,_0x3a8cb3){if(_0x113c83[_0x0327('0x46')]['id']){delete _0x113c83['body']['id'];}return db[_0x0327('0x2a')][_0x0327('0x43')]({'where':{'id':_0x113c83[_0x0327('0x42')]['id']}})[_0x0327('0x21')](handleEntityNotFound(_0x3a8cb3,null))[_0x0327('0x21')](saveUpdates(_0x113c83[_0x0327('0x46')],null))['then'](respondWithResult(_0x3a8cb3,null))[_0x0327('0x44')](handleError(_0x3a8cb3,null));};exports[_0x0327('0x22')]=function(_0x5fcf81,_0x3bc57b){return db['SalesforceAccount'][_0x0327('0x43')]({'where':{'id':_0x5fcf81[_0x0327('0x42')]['id']}})[_0x0327('0x21')](handleEntityNotFound(_0x3bc57b,null))[_0x0327('0x21')](removeEntity(_0x3bc57b,null))[_0x0327('0x44')](handleError(_0x3bc57b,null));};exports['getConfigurations']=function(_0x511745,_0x4f4110,_0x2bfbcf){var _0x4f8ec7={};var _0x46da4a={};var _0x4a9ff7;var _0x203c44;return db[_0x0327('0x2a')][_0x0327('0x47')]({'where':{'id':_0x511745[_0x0327('0x42')]['id']}})['then'](handleEntityNotFound(_0x4f4110,null))[_0x0327('0x21')](function(_0x3c4e38){if(_0x3c4e38){_0x4a9ff7=_0x3c4e38;_0x46da4a[_0x0327('0x2e')]=_[_0x0327('0x30')](db['SalesforceConfiguration'][_0x0327('0x2b')]);_0x46da4a[_0x0327('0x2f')]=_[_0x0327('0x30')](_0x511745[_0x0327('0x2f')]);_0x46da4a['filters']=_[_0x0327('0x32')](_0x46da4a['model'],_0x46da4a['query']);_0x4f8ec7[_0x0327('0x33')]=_['intersection'](_0x46da4a[_0x0327('0x2e')],qs[_0x0327('0x34')](_0x511745[_0x0327('0x2f')][_0x0327('0x34')]));_0x4f8ec7['attributes']=_0x4f8ec7[_0x0327('0x33')][_0x0327('0x35')]?_0x4f8ec7[_0x0327('0x33')]:_0x46da4a[_0x0327('0x2e')];_0x4f8ec7['order']=qs[_0x0327('0x38')](_0x511745[_0x0327('0x2f')][_0x0327('0x38')]);_0x4f8ec7[_0x0327('0x39')]=qs['filters'](_[_0x0327('0x3a')](_0x511745[_0x0327('0x2f')],_0x46da4a[_0x0327('0x31')]));if(_0x511745[_0x0327('0x2f')][_0x0327('0x3b')]){_0x4f8ec7[_0x0327('0x39')]=_[_0x0327('0x3c')](_0x4f8ec7[_0x0327('0x39')],{'$or':_[_0x0327('0x29')](_0x4f8ec7['attributes'],function(_0x3ed91e){var _0xbebc03={};_0xbebc03[_0x3ed91e]={'$like':'%'+_0x511745[_0x0327('0x2f')]['filter']+'%'};return _0xbebc03;})});}_0x4f8ec7=_[_0x0327('0x3c')]({},_0x4f8ec7,_0x511745['options']);return _0x4a9ff7[_0x0327('0x48')](_0x4f8ec7);}})['then'](function(_0x1a280b){if(_0x1a280b){_0x203c44=_0x1a280b[_0x0327('0x35')];if(!_0x511745[_0x0327('0x2f')]['hasOwnProperty'](_0x0327('0x49'))){_0x4f8ec7[_0x0327('0x36')]=qs[_0x0327('0x36')](_0x511745[_0x0327('0x2f')][_0x0327('0x36')]);_0x4f8ec7['offset']=qs[_0x0327('0x18')](_0x511745['query'][_0x0327('0x18')]);}return _0x4a9ff7['getConfigurations'](_0x4f8ec7);}})['then'](function(_0x3c0f85){if(_0x3c0f85){return _0x3c0f85?{'count':_0x203c44,'rows':_0x3c0f85}:null;}})[_0x0327('0x21')](respondWithResult(_0x4f4110,null))[_0x0327('0x44')](handleError(_0x4f4110,null));};exports[_0x0327('0x4a')]=function(_0x8a33ec,_0x57662e,_0x188e52){if(_0x8a33ec[_0x0327('0x46')]['id']){delete _0x8a33ec[_0x0327('0x46')]['id'];}return db[_0x0327('0x2a')][_0x0327('0x47')]({'where':{'id':_0x8a33ec[_0x0327('0x42')]['id']}})['then'](handleEntityNotFound(_0x57662e,null))[_0x0327('0x21')](function(_0x4c4284){if(_0x4c4284){_0x8a33ec[_0x0327('0x46')][_0x0327('0x4b')]=_0x4c4284['id'];_0x8a33ec['body'][_0x0327('0x4c')]=integrations[_0x0327('0x4d')](_0x8a33ec[_0x0327('0x46')][_0x0327('0x4e')],_0x8a33ec[_0x0327('0x46')]['type']);_0x8a33ec[_0x0327('0x46')][_0x0327('0x4f')]=integrations['getDescriptions'](_0x8a33ec['body'][_0x0327('0x4e')],_0x8a33ec[_0x0327('0x46')][_0x0327('0x2c')]);return db[_0x0327('0x50')][_0x0327('0x45')](_0x8a33ec[_0x0327('0x46')],{'include':[{'model':db[_0x0327('0x51')],'as':_0x0327('0x4c')},{'model':db['SalesforceField'],'as':_0x0327('0x4f')}]});}return null;})[_0x0327('0x21')](respondWithResult(_0x57662e,null))['catch'](handleError(_0x57662e,null));};exports[_0x0327('0x52')]=function(_0x1c1c8e,_0x547644,_0x4a4c43){var _0x38568e;var _0x43a719='';var _0x17585c=_0x0327('0x53');return db[_0x0327('0x2a')][_0x0327('0x47')]({'where':{'id':_0x1c1c8e['params']['id']},'attributes':['id','remoteUri',_0x0327('0x54'),'clientSecret','username',_0x0327('0x55'),'securityToken']})[_0x0327('0x21')](handleEntityNotFound(_0x547644,null))[_0x0327('0x21')](function(_0x6db0f1){if(_0x6db0f1){_0x43a719=_0x6db0f1[_0x0327('0x56')];var _0x585ab6=_0x43a719[_0x0327('0x57')](-0x1);if(_0x585ab6==='/'){_0x43a719=_0x43a719[_0x0327('0x58')](0x0,_0x43a719['lastIndexOf'](_0x585ab6));}_0x38568e=new jsforce[(_0x0327('0x59'))]({'oauth2':{'loginUrl':_0x43a719,'clientId':_0x6db0f1['clientId'],'clientSecret':_0x6db0f1['clientSecret']}});return _0x38568e[_0x0327('0x5a')](_0x6db0f1[_0x0327('0x5b')],_0x6db0f1[_0x0327('0x55')]['concat'](_0x6db0f1[_0x0327('0x5c')]));}})[_0x0327('0x21')](function(_0x2e1ebc){if(_0x2e1ebc){if(!_[_0x0327('0x5d')](_0x1c1c8e[_0x0327('0x2f')][_0x0327('0x5e')])){_0x17585c=_0x1c1c8e['query'][_0x0327('0x5e')];}return _0x38568e[_0x0327('0x5f')](_0x17585c)[_0x0327('0x60')]();}})[_0x0327('0x21')](function(_0x38d693){var _0x3208e1=[_0x0327('0x61'),_0x0327('0x62'),_0x0327('0x63'),_0x0327('0x64'),'Subject',_0x0327('0x65')];var _0x442306=[_0x0327('0x66'),_0x0327('0x67'),'picklist',_0x0327('0x68'),'email',_0x0327('0x69'),_0x0327('0x6a')];if(_0x38d693){_['remove'](_0x38d693['fields'],function(_0x466238){return _0x3208e1[_0x0327('0x6b')](_0x466238[_0x0327('0x26')])||!_0x442306[_0x0327('0x6b')](_0x466238['type']);});return{'count':_0x38d693['fields'][_0x0327('0x35')],'rows':_[_0x0327('0x29')](_0x38d693[_0x0327('0x34')],function(_0x5ba13e){return{'id':_0x5ba13e[_0x0327('0x26')],'name':_0x5ba13e['label'],'custom':_0x5ba13e[_0x0327('0x6c')],'options':_0x5ba13e[_0x0327('0x6d')][_0x0327('0x35')]>0x0?_[_0x0327('0x29')](_0x5ba13e[_0x0327('0x6d')],function(_0x2a6e8b){return{'name':_0x2a6e8b[_0x0327('0x6e')],'value':_0x2a6e8b[_0x0327('0x6f')]};}):_0x5ba13e['type']==_0x0327('0x68')?[{'name':_0x0327('0x70'),'value':_0x0327('0x71')},{'name':_0x0327('0x72'),'value':_0x0327('0x73')}]:[]};})};}})['then'](respondWithResult(_0x547644,null))[_0x0327('0x44')](function(_0x1bfd0d){var _0x4d852f=_0x1c1c8e[_0x0327('0x2f')]['test']?0x1f4:_0x1bfd0d[_0x0327('0x74')]||0x1f4;logger[_0x0327('0x24')](_0x0327('0x75'),_0x0327('0x52'),_0x4d852f,JSON['stringify'](_0x1bfd0d));delete _0x1bfd0d['name'];if(_0x4d852f===0x191){_0x4d852f=0x190;}_0x547644[_0x0327('0x17')](_0x4d852f)['send'](_0x1c1c8e[_0x0327('0x2f')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x1bfd0d[_0x0327('0x74')]}:_0x1bfd0d);});}; \ No newline at end of file +var _0xcbba=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','undefined','limit','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','count','includeAll','include','rows','catch','params','options','find','create','body','getConfigurations','findOne','SalesforceConfiguration','filter','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceField','getFields','clientSecret','username','password','remoteUri','slice','substring','lastIndexOf','Connection','clientId','login','concat','securityToken','isNil','ticketType','describe','OwnerId','IsReminderSet','IsRecurrence','Subject','Description','picklist','boolean','email','textarea','remove','includes','picklistValues','label','True','true','false','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x777641,_0x19607d){var _0x54a378=function(_0x501b92){while(--_0x501b92){_0x777641['push'](_0x777641['shift']());}};_0x54a378(++_0x19607d);}(_0xcbba,0x16a));var _0xacbb=function(_0x10854e,_0x1c729b){_0x10854e=_0x10854e-0x0;var _0x2825dd=_0xcbba[_0x10854e];return _0x2825dd;};'use strict';var emlformat=require(_0xacbb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xacbb('0x1'));var jsonpatch=require(_0xacbb('0x2'));var rp=require(_0xacbb('0x3'));var moment=require(_0xacbb('0x4'));var BPromise=require(_0xacbb('0x5'));var Mustache=require(_0xacbb('0x6'));var util=require('util');var path=require(_0xacbb('0x7'));var sox=require(_0xacbb('0x8'));var csv=require(_0xacbb('0x9'));var ejs=require(_0xacbb('0xa'));var fs=require('fs');var fs_extra=require(_0xacbb('0xb'));var _=require(_0xacbb('0xc'));var squel=require(_0xacbb('0xd'));var crypto=require(_0xacbb('0xe'));var jsforce=require(_0xacbb('0xf'));var deskjs=require(_0xacbb('0x10'));var toCsv=require(_0xacbb('0x9'));var querystring=require(_0xacbb('0x11'));var Papa=require(_0xacbb('0x12'));var Redis=require(_0xacbb('0x13'));var authService=require(_0xacbb('0x14'));var qs=require(_0xacbb('0x15'));var as=require(_0xacbb('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xacbb('0x17'))(_0xacbb('0x18'));var utils=require(_0xacbb('0x19'));var config=require(_0xacbb('0x1a'));var licenseUtil=require(_0xacbb('0x1b'));var db=require(_0xacbb('0x1c'))['db'];var integrations=require(_0xacbb('0x1d'));function respondWithStatusCode(_0xeadcd8,_0x254017){_0x254017=_0x254017||0xcc;return function(_0x191479){if(_0x191479){return _0xeadcd8[_0xacbb('0x1e')](_0x254017);}return _0xeadcd8[_0xacbb('0x1f')](_0x254017)['end']();};}function respondWithResult(_0x34b2ba,_0x22ef55){_0x22ef55=_0x22ef55||0xc8;return function(_0x23f8f4){if(_0x23f8f4){return _0x34b2ba[_0xacbb('0x1f')](_0x22ef55)['json'](_0x23f8f4);}};}function respondWithFilteredResult(_0x2d9dd2,_0x1b18da){return function(_0x121095){if(_0x121095){var _0x43d51f=typeof _0x1b18da['offset']===_0xacbb('0x20')&&typeof _0x1b18da[_0xacbb('0x21')]==='undefined';var _0x47a309=_0x121095['count'];var _0x3037b2=_0x43d51f?0x0:_0x1b18da[_0xacbb('0x22')];var _0x45bf82=_0x43d51f?_0x121095['count']:_0x1b18da['offset']+_0x1b18da[_0xacbb('0x21')];var _0x5d62ac;if(_0x45bf82>=_0x47a309){_0x45bf82=_0x47a309;_0x5d62ac=0xc8;}else{_0x5d62ac=0xce;}_0x2d9dd2[_0xacbb('0x1f')](_0x5d62ac);return _0x2d9dd2[_0xacbb('0x23')](_0xacbb('0x24'),_0x3037b2+'-'+_0x45bf82+'/'+_0x47a309)[_0xacbb('0x25')](_0x121095);}return null;};}function patchUpdates(_0x131e7a){return function(_0x2ea81d){try{jsonpatch[_0xacbb('0x26')](_0x2ea81d,_0x131e7a,!![]);}catch(_0x2fc6ed){return BPromise[_0xacbb('0x27')](_0x2fc6ed);}return _0x2ea81d[_0xacbb('0x28')]();};}function saveUpdates(_0x28cba4,_0x4c4050){return function(_0x21550b){if(_0x21550b){return _0x21550b[_0xacbb('0x29')](_0x28cba4)[_0xacbb('0x2a')](function(_0x28f664){return _0x28f664;});}return null;};}function removeEntity(_0xa8b587,_0x2485e2){return function(_0x51192f){if(_0x51192f){return _0x51192f[_0xacbb('0x2b')]()[_0xacbb('0x2a')](function(){_0xa8b587[_0xacbb('0x1f')](0xcc)[_0xacbb('0x2c')]();});}};}function handleEntityNotFound(_0x3d5af4,_0x26d971){return function(_0x17c9fd){if(!_0x17c9fd){_0x3d5af4[_0xacbb('0x1e')](0x194);}return _0x17c9fd;};}function handleError(_0x3a833c,_0x17b91f){_0x17b91f=_0x17b91f||0x1f4;return function(_0x903f51){logger[_0xacbb('0x2d')](_0x903f51[_0xacbb('0x2e')]);if(_0x903f51[_0xacbb('0x2f')]){delete _0x903f51[_0xacbb('0x2f')];}_0x3a833c[_0xacbb('0x1f')](_0x17b91f)[_0xacbb('0x30')](_0x903f51);};}exports[_0xacbb('0x31')]=function(_0x578143,_0x1fe214){var _0x321110={},_0x351502={},_0x2c7de9={'count':0x0,'rows':[]};var _0x1214b0=_[_0xacbb('0x32')](db[_0xacbb('0x33')][_0xacbb('0x34')],function(_0x372dda){return{'name':_0x372dda[_0xacbb('0x35')],'type':_0x372dda[_0xacbb('0x36')][_0xacbb('0x37')]};});_0x351502[_0xacbb('0x38')]=_[_0xacbb('0x32')](_0x1214b0,_0xacbb('0x2f'));_0x351502[_0xacbb('0x39')]=_[_0xacbb('0x3a')](_0x578143[_0xacbb('0x39')]);_0x351502[_0xacbb('0x3b')]=_[_0xacbb('0x3c')](_0x351502[_0xacbb('0x38')],_0x351502[_0xacbb('0x39')]);_0x321110['attributes']=_[_0xacbb('0x3c')](_0x351502[_0xacbb('0x38')],qs[_0xacbb('0x3d')](_0x578143[_0xacbb('0x39')]['fields']));_0x321110[_0xacbb('0x3e')]=_0x321110[_0xacbb('0x3e')][_0xacbb('0x3f')]?_0x321110['attributes']:_0x351502[_0xacbb('0x38')];if(!_0x578143[_0xacbb('0x39')][_0xacbb('0x40')](_0xacbb('0x41'))){_0x321110[_0xacbb('0x21')]=qs[_0xacbb('0x21')](_0x578143['query'][_0xacbb('0x21')]);_0x321110[_0xacbb('0x22')]=qs[_0xacbb('0x22')](_0x578143[_0xacbb('0x39')]['offset']);}_0x321110[_0xacbb('0x42')]=qs[_0xacbb('0x43')](_0x578143[_0xacbb('0x39')]['sort']);_0x321110[_0xacbb('0x44')]=qs['filters'](_[_0xacbb('0x45')](_0x578143[_0xacbb('0x39')],_0x351502[_0xacbb('0x3b')]),_0x1214b0);if(_0x578143[_0xacbb('0x39')]['filter']){_0x321110[_0xacbb('0x44')]=_[_0xacbb('0x46')](_0x321110[_0xacbb('0x44')],{'$or':_[_0xacbb('0x32')](_0x1214b0,function(_0xf4744c){if(_0xf4744c['type']!==_0xacbb('0x47')){var _0x302eed={};_0x302eed[_0xf4744c[_0xacbb('0x2f')]]={'$like':'%'+_0x578143['query']['filter']+'%'};return _0x302eed;}})});}_0x321110=_[_0xacbb('0x46')]({},_0x321110,_0x578143['options']);var _0x2c377b={'where':_0x321110[_0xacbb('0x44')]};return db[_0xacbb('0x33')][_0xacbb('0x48')](_0x2c377b)[_0xacbb('0x2a')](function(_0x597928){_0x2c7de9['count']=_0x597928;if(_0x578143[_0xacbb('0x39')][_0xacbb('0x49')]){_0x321110[_0xacbb('0x4a')]=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x321110);})[_0xacbb('0x2a')](function(_0x36435c){_0x2c7de9[_0xacbb('0x4b')]=_0x36435c;return _0x2c7de9;})['then'](respondWithFilteredResult(_0x1fe214,_0x321110))[_0xacbb('0x4c')](handleError(_0x1fe214,null));};exports['show']=function(_0x5cb38f,_0x38df9e){var _0x45ce70={'raw':![],'where':{'id':_0x5cb38f[_0xacbb('0x4d')]['id']}},_0x54aa76={};_0x54aa76['model']=_[_0xacbb('0x3a')](db[_0xacbb('0x33')][_0xacbb('0x34')]);_0x54aa76[_0xacbb('0x39')]=_['keys'](_0x5cb38f[_0xacbb('0x39')]);_0x54aa76[_0xacbb('0x3b')]=_[_0xacbb('0x3c')](_0x54aa76[_0xacbb('0x38')],_0x54aa76[_0xacbb('0x39')]);_0x45ce70[_0xacbb('0x3e')]=_[_0xacbb('0x3c')](_0x54aa76[_0xacbb('0x38')],qs[_0xacbb('0x3d')](_0x5cb38f[_0xacbb('0x39')][_0xacbb('0x3d')]));_0x45ce70[_0xacbb('0x3e')]=_0x45ce70['attributes'][_0xacbb('0x3f')]?_0x45ce70[_0xacbb('0x3e')]:_0x54aa76[_0xacbb('0x38')];if(_0x5cb38f['query'][_0xacbb('0x49')]){_0x45ce70['include']=[{'all':!![]}];}_0x45ce70=_['merge']({},_0x45ce70,_0x5cb38f[_0xacbb('0x4e')]);return db[_0xacbb('0x33')][_0xacbb('0x4f')](_0x45ce70)['then'](handleEntityNotFound(_0x38df9e,null))['then'](respondWithResult(_0x38df9e,null))[_0xacbb('0x4c')](handleError(_0x38df9e,null));};exports[_0xacbb('0x50')]=function(_0x5ac7ad,_0x112856){return db[_0xacbb('0x33')][_0xacbb('0x50')](_0x5ac7ad['body'],{})[_0xacbb('0x2a')](respondWithResult(_0x112856,0xc9))[_0xacbb('0x4c')](handleError(_0x112856,null));};exports[_0xacbb('0x29')]=function(_0x3e7409,_0x42bea2){if(_0x3e7409[_0xacbb('0x51')]['id']){delete _0x3e7409[_0xacbb('0x51')]['id'];}return db[_0xacbb('0x33')][_0xacbb('0x4f')]({'where':{'id':_0x3e7409['params']['id']}})[_0xacbb('0x2a')](handleEntityNotFound(_0x42bea2,null))['then'](saveUpdates(_0x3e7409['body'],null))[_0xacbb('0x2a')](respondWithResult(_0x42bea2,null))[_0xacbb('0x4c')](handleError(_0x42bea2,null));};exports[_0xacbb('0x2b')]=function(_0x45fd8f,_0x565f58){return db[_0xacbb('0x33')][_0xacbb('0x4f')]({'where':{'id':_0x45fd8f[_0xacbb('0x4d')]['id']}})[_0xacbb('0x2a')](handleEntityNotFound(_0x565f58,null))[_0xacbb('0x2a')](removeEntity(_0x565f58,null))[_0xacbb('0x4c')](handleError(_0x565f58,null));};exports[_0xacbb('0x52')]=function(_0xb6e701,_0x157f9f,_0x592881){var _0x5200da={};var _0x201597={};var _0xaf0014;var _0x16d2ae;return db[_0xacbb('0x33')][_0xacbb('0x53')]({'where':{'id':_0xb6e701['params']['id']}})[_0xacbb('0x2a')](handleEntityNotFound(_0x157f9f,null))[_0xacbb('0x2a')](function(_0x2becdd){if(_0x2becdd){_0xaf0014=_0x2becdd;_0x201597['model']=_[_0xacbb('0x3a')](db[_0xacbb('0x54')][_0xacbb('0x34')]);_0x201597['query']=_['keys'](_0xb6e701[_0xacbb('0x39')]);_0x201597[_0xacbb('0x3b')]=_[_0xacbb('0x3c')](_0x201597['model'],_0x201597[_0xacbb('0x39')]);_0x5200da['attributes']=_[_0xacbb('0x3c')](_0x201597['model'],qs[_0xacbb('0x3d')](_0xb6e701[_0xacbb('0x39')][_0xacbb('0x3d')]));_0x5200da['attributes']=_0x5200da['attributes'][_0xacbb('0x3f')]?_0x5200da[_0xacbb('0x3e')]:_0x201597[_0xacbb('0x38')];_0x5200da[_0xacbb('0x42')]=qs[_0xacbb('0x43')](_0xb6e701[_0xacbb('0x39')]['sort']);_0x5200da[_0xacbb('0x44')]=qs[_0xacbb('0x3b')](_[_0xacbb('0x45')](_0xb6e701[_0xacbb('0x39')],_0x201597[_0xacbb('0x3b')]));if(_0xb6e701[_0xacbb('0x39')][_0xacbb('0x55')]){_0x5200da[_0xacbb('0x44')]=_[_0xacbb('0x46')](_0x5200da[_0xacbb('0x44')],{'$or':_[_0xacbb('0x32')](_0x5200da[_0xacbb('0x3e')],function(_0x3aff2d){var _0x2f0f29={};_0x2f0f29[_0x3aff2d]={'$like':'%'+_0xb6e701['query'][_0xacbb('0x55')]+'%'};return _0x2f0f29;})});}_0x5200da=_['merge']({},_0x5200da,_0xb6e701[_0xacbb('0x4e')]);return _0xaf0014[_0xacbb('0x52')](_0x5200da);}})[_0xacbb('0x2a')](function(_0x2961d2){if(_0x2961d2){_0x16d2ae=_0x2961d2['length'];if(!_0xb6e701['query'][_0xacbb('0x40')](_0xacbb('0x41'))){_0x5200da['limit']=qs[_0xacbb('0x21')](_0xb6e701[_0xacbb('0x39')][_0xacbb('0x21')]);_0x5200da[_0xacbb('0x22')]=qs[_0xacbb('0x22')](_0xb6e701[_0xacbb('0x39')]['offset']);}return _0xaf0014['getConfigurations'](_0x5200da);}})[_0xacbb('0x2a')](function(_0x2bfb0a){if(_0x2bfb0a){return _0x2bfb0a?{'count':_0x16d2ae,'rows':_0x2bfb0a}:null;}})[_0xacbb('0x2a')](respondWithResult(_0x157f9f,null))[_0xacbb('0x4c')](handleError(_0x157f9f,null));};exports[_0xacbb('0x56')]=function(_0x59ee44,_0x52e6f6,_0x48b6c6){if(_0x59ee44[_0xacbb('0x51')]['id']){delete _0x59ee44['body']['id'];}return db[_0xacbb('0x33')][_0xacbb('0x53')]({'where':{'id':_0x59ee44['params']['id']}})['then'](handleEntityNotFound(_0x52e6f6,null))['then'](function(_0x4c6407){if(_0x4c6407){_0x59ee44[_0xacbb('0x51')][_0xacbb('0x57')]=_0x4c6407['id'];_0x59ee44[_0xacbb('0x51')][_0xacbb('0x58')]=integrations[_0xacbb('0x59')](_0x59ee44['body'][_0xacbb('0x5a')],_0x59ee44['body']['type']);_0x59ee44[_0xacbb('0x51')][_0xacbb('0x5b')]=integrations['getDescriptions'](_0x59ee44['body']['channel'],_0x59ee44[_0xacbb('0x51')][_0xacbb('0x36')]);return db[_0xacbb('0x54')]['create'](_0x59ee44[_0xacbb('0x51')],{'include':[{'model':db[_0xacbb('0x5c')],'as':'Subjects'},{'model':db[_0xacbb('0x5c')],'as':'Descriptions'}]});}return null;})[_0xacbb('0x2a')](respondWithResult(_0x52e6f6,null))[_0xacbb('0x4c')](handleError(_0x52e6f6,null));};exports[_0xacbb('0x5d')]=function(_0x418714,_0x4e2926,_0x20a82a){var _0x18b1f7;var _0x8c063c='';var _0x1eb6c4='Task';return db[_0xacbb('0x33')][_0xacbb('0x53')]({'where':{'id':_0x418714[_0xacbb('0x4d')]['id']},'attributes':['id','remoteUri','clientId',_0xacbb('0x5e'),_0xacbb('0x5f'),_0xacbb('0x60'),'securityToken']})[_0xacbb('0x2a')](handleEntityNotFound(_0x4e2926,null))[_0xacbb('0x2a')](function(_0x46ff23){if(_0x46ff23){_0x8c063c=_0x46ff23[_0xacbb('0x61')];var _0x44da63=_0x8c063c[_0xacbb('0x62')](-0x1);if(_0x44da63==='/'){_0x8c063c=_0x8c063c[_0xacbb('0x63')](0x0,_0x8c063c[_0xacbb('0x64')](_0x44da63));}_0x18b1f7=new jsforce[(_0xacbb('0x65'))]({'oauth2':{'loginUrl':_0x8c063c,'clientId':_0x46ff23[_0xacbb('0x66')],'clientSecret':_0x46ff23[_0xacbb('0x5e')]}});return _0x18b1f7[_0xacbb('0x67')](_0x46ff23[_0xacbb('0x5f')],_0x46ff23[_0xacbb('0x60')][_0xacbb('0x68')](_0x46ff23[_0xacbb('0x69')]));}})['then'](function(_0x5cbab7){if(_0x5cbab7){if(!_[_0xacbb('0x6a')](_0x418714[_0xacbb('0x39')][_0xacbb('0x6b')])){_0x1eb6c4=_0x418714[_0xacbb('0x39')][_0xacbb('0x6b')];}return _0x18b1f7['sobject'](_0x1eb6c4)[_0xacbb('0x6c')]();}})['then'](function(_0x5ccba3){var _0x21d238=[_0xacbb('0x6d'),'ActivityDate',_0xacbb('0x6e'),_0xacbb('0x6f'),_0xacbb('0x70'),_0xacbb('0x71')];var _0xf70421=['string','int',_0xacbb('0x72'),_0xacbb('0x73'),_0xacbb('0x74'),_0xacbb('0x75'),'phone'];if(_0x5ccba3){_[_0xacbb('0x76')](_0x5ccba3[_0xacbb('0x3d')],function(_0x4ed16f){return _0x21d238[_0xacbb('0x77')](_0x4ed16f[_0xacbb('0x2f')])||!_0xf70421[_0xacbb('0x77')](_0x4ed16f[_0xacbb('0x36')]);});return{'count':_0x5ccba3['fields']['length'],'rows':_[_0xacbb('0x32')](_0x5ccba3[_0xacbb('0x3d')],function(_0xc44894){return{'id':_0xc44894[_0xacbb('0x2f')],'name':_0xc44894['label'],'custom':_0xc44894['custom'],'options':_0xc44894[_0xacbb('0x78')][_0xacbb('0x3f')]>0x0?_[_0xacbb('0x32')](_0xc44894['picklistValues'],function(_0x348292){return{'name':_0x348292[_0xacbb('0x79')],'value':_0x348292['value']};}):_0xc44894['type']=='boolean'?[{'name':_0xacbb('0x7a'),'value':_0xacbb('0x7b')},{'name':'False','value':_0xacbb('0x7c')}]:[]};})};}})[_0xacbb('0x2a')](respondWithResult(_0x4e2926,null))[_0xacbb('0x4c')](function(_0x3db7aa){var _0x520367=_0x418714[_0xacbb('0x39')][_0xacbb('0x7d')]?0x1f4:_0x3db7aa['statusCode']||0x1f4;logger[_0xacbb('0x2d')](_0xacbb('0x7e'),_0xacbb('0x5d'),_0x520367,JSON['stringify'](_0x3db7aa));delete _0x3db7aa[_0xacbb('0x2f')];if(_0x520367===0x191){_0x520367=0x190;}_0x4e2926[_0xacbb('0x1f')](_0x520367)[_0xacbb('0x30')](_0x418714[_0xacbb('0x39')][_0xacbb('0x7d')]?{'message':_0xacbb('0x7f'),'statusCode':_0x3db7aa[_0xacbb('0x80')]}:_0x3db7aa);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 636b1a0..435edae 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 _0x2137=['SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment'];(function(_0x375524,_0x51b2d8){var _0x4272b2=function(_0x549473){while(--_0x549473){_0x375524['push'](_0x375524['shift']());}};_0x4272b2(++_0x51b2d8);}(_0x2137,0x134));var _0x7213=function(_0x816b95,_0x3aac55){_0x816b95=_0x816b95-0x0;var _0x3d9e41=_0x2137[_0x816b95];return _0x3d9e41;};'use strict';var _=require(_0x7213('0x0'));var util=require(_0x7213('0x1'));var logger=require(_0x7213('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7213('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7213('0x4'));var rimraf=require(_0x7213('0x5'));var config=require(_0x7213('0x6'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x2cf2d6,_0x3aa8a3){return _0x2cf2d6['define'](_0x7213('0x7'),attributes,{'tableName':_0x7213('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x852a=['int_salesforce_accounts','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','SalesforceAccount'];(function(_0x403c81,_0x414786){var _0xe70db9=function(_0x21d476){while(--_0x21d476){_0x403c81['push'](_0x403c81['shift']());}};_0xe70db9(++_0x414786);}(_0x852a,0x1d5));var _0xa852=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x852a[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require('lodash');var util=require(_0xa852('0x0'));var logger=require(_0xa852('0x1'))(_0xa852('0x2'));var moment=require('moment');var BPromise=require(_0xa852('0x3'));var rp=require(_0xa852('0x4'));var fs=require('fs');var path=require(_0xa852('0x5'));var rimraf=require(_0xa852('0x6'));var config=require(_0xa852('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xa852('0x8'));module[_0xa852('0x9')]=function(_0x42d457,_0x465554){return _0x42d457['define'](_0xa852('0xa'),attributes,{'tableName':_0xa852('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index dd54e59..756854b 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 _0x6828=['../../config/logger','jayson/promise','client','request','then','info','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SalesforceAccount,\x20%s,\x20%s','message','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','limit','include','map','model','attributes','stringify','find','ShowSalesforceAccount','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x27a89a,_0x3b174e){var _0x5a4662=function(_0x1c556d){while(--_0x1c556d){_0x27a89a['push'](_0x27a89a['shift']());}};_0x5a4662(++_0x3b174e);}(_0x6828,0xe2));var _0x8682=function(_0x459240,_0x5d950b){_0x459240=_0x459240-0x0;var _0x17b304=_0x6828[_0x459240];return _0x17b304;};'use strict';var _=require(_0x8682('0x0'));var util=require(_0x8682('0x1'));var moment=require(_0x8682('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8682('0x3'));var db=require(_0x8682('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8682('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8682('0x6'));var client=jayson[_0x8682('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x295da4,_0xfbcb4,_0x124548){return new BPromise(function(_0x32f417,_0xc0e91e){return client[_0x8682('0x8')](_0x295da4,_0x124548)[_0x8682('0x9')](function(_0x5b99a5){logger[_0x8682('0xa')]('SalesforceAccount,\x20%s,\x20%s',_0xfbcb4,'request\x20sent');logger[_0x8682('0xb')](_0x8682('0xc'),_0xfbcb4,_0x8682('0xd'),JSON['stringify'](_0x5b99a5));if(_0x5b99a5[_0x8682('0xe')]){if(_0x5b99a5[_0x8682('0xe')][_0x8682('0xf')]===0x1f4){logger[_0x8682('0xe')](_0x8682('0x10'),_0xfbcb4,_0x5b99a5[_0x8682('0xe')][_0x8682('0x11')]);return _0xc0e91e(_0x5b99a5[_0x8682('0xe')][_0x8682('0x11')]);}logger['error'](_0x8682('0x10'),_0xfbcb4,_0x5b99a5['error'][_0x8682('0x11')]);return _0x32f417(_0x5b99a5[_0x8682('0xe')][_0x8682('0x11')]);}else{logger[_0x8682('0xa')](_0x8682('0x10'),_0xfbcb4,_0x8682('0xd'));_0x32f417(_0x5b99a5['result'][_0x8682('0x11')]);}})[_0x8682('0x12')](function(_0x6377d3){logger[_0x8682('0xe')](_0x8682('0x10'),_0xfbcb4,_0x6377d3);_0xc0e91e(_0x6377d3);});});}exports[_0x8682('0x13')]=function(_0x1ecbd9){var _0x107d7b=this;return new Promise(function(_0x2ec319,_0x4a5c73){return db[_0x8682('0x14')][_0x8682('0x15')]({'raw':_0x1ecbd9['options']?_0x1ecbd9[_0x8682('0x16')][_0x8682('0x17')]===undefined?!![]:![]:!![],'where':_0x1ecbd9[_0x8682('0x16')]?_0x1ecbd9['options'][_0x8682('0x18')]||null:null,'attributes':_0x1ecbd9['options']?_0x1ecbd9[_0x8682('0x16')]['attributes']||null:null,'limit':_0x1ecbd9[_0x8682('0x16')]?_0x1ecbd9[_0x8682('0x16')][_0x8682('0x19')]||null:null,'include':_0x1ecbd9[_0x8682('0x16')]?_0x1ecbd9['options'][_0x8682('0x1a')]?_[_0x8682('0x1b')](_0x1ecbd9[_0x8682('0x16')][_0x8682('0x1a')],function(_0x146c86){return{'model':db[_0x146c86[_0x8682('0x1c')]],'as':_0x146c86['as'],'attributes':_0x146c86[_0x8682('0x1d')],'include':_0x146c86[_0x8682('0x1a')]?_[_0x8682('0x1b')](_0x146c86[_0x8682('0x1a')],function(_0x3d93ea){return{'model':db[_0x3d93ea[_0x8682('0x1c')]],'as':_0x3d93ea['as'],'attributes':_0x3d93ea[_0x8682('0x1d')],'include':_0x3d93ea[_0x8682('0x1a')]?_['map'](_0x3d93ea[_0x8682('0x1a')],function(_0x1fa394){return{'model':db[_0x1fa394['model']],'as':_0x1fa394['as'],'attributes':_0x1fa394[_0x8682('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8682('0x9')](function(_0x13d94a){logger[_0x8682('0xa')]('GetSalesforceAccount',_0x1ecbd9);logger['debug'](_0x8682('0x13'),_0x1ecbd9,JSON[_0x8682('0x1e')](_0x13d94a));_0x2ec319(_0x13d94a);})[_0x8682('0x12')](function(_0x481465){logger[_0x8682('0xe')]('GetSalesforceAccount',_0x481465[_0x8682('0x11')],_0x1ecbd9);_0x4a5c73(_0x107d7b['error'](0x1f4,_0x481465[_0x8682('0x11')]));});});};exports['ShowSalesforceAccount']=function(_0x2c0baa){var _0x1acbdc=this;return new Promise(function(_0x220e0e,_0x23fdb1){return db['SalesforceAccount'][_0x8682('0x1f')]({'raw':_0x2c0baa[_0x8682('0x16')]?_0x2c0baa[_0x8682('0x16')][_0x8682('0x17')]===undefined?!![]:![]:!![],'where':_0x2c0baa[_0x8682('0x16')]?_0x2c0baa[_0x8682('0x16')][_0x8682('0x18')]||null:null,'attributes':_0x2c0baa[_0x8682('0x16')]?_0x2c0baa[_0x8682('0x16')]['attributes']||null:null,'include':_0x2c0baa['options']?_0x2c0baa[_0x8682('0x16')][_0x8682('0x1a')]?_[_0x8682('0x1b')](_0x2c0baa['options'][_0x8682('0x1a')],function(_0x54da5){return{'model':db[_0x54da5['model']],'as':_0x54da5['as'],'attributes':_0x54da5['attributes'],'include':_0x54da5[_0x8682('0x1a')]?_[_0x8682('0x1b')](_0x54da5['include'],function(_0x2bff4a){return{'model':db[_0x2bff4a[_0x8682('0x1c')]],'as':_0x2bff4a['as'],'attributes':_0x2bff4a[_0x8682('0x1d')],'include':_0x2bff4a['include']?_[_0x8682('0x1b')](_0x2bff4a[_0x8682('0x1a')],function(_0x1ce867){return{'model':db[_0x1ce867['model']],'as':_0x1ce867['as'],'attributes':_0x1ce867[_0x8682('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8682('0x9')](function(_0x4fece3){logger['info'](_0x8682('0x20'),_0x2c0baa);logger[_0x8682('0xb')](_0x8682('0x20'),_0x2c0baa,JSON[_0x8682('0x1e')](_0x4fece3));_0x220e0e(_0x4fece3);})[_0x8682('0x12')](function(_0x12e94d){logger[_0x8682('0xe')](_0x8682('0x20'),_0x12e94d[_0x8682('0x11')],_0x2c0baa);_0x23fdb1(_0x1acbdc[_0x8682('0xe')](0x1f4,_0x12e94d['message']));});});}; \ No newline at end of file +var _0x246e=['SalesforceAccount','findAll','options','raw','where','limit','include','map','attributes','model','then','catch','ShowSalesforceAccount','find','lodash','util','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSalesforceAccount'];(function(_0x13ab2f,_0x408db2){var _0x699d7f=function(_0x6d882b){while(--_0x6d882b){_0x13ab2f['push'](_0x13ab2f['shift']());}};_0x699d7f(++_0x408db2);}(_0x246e,0x9e));var _0xe246=function(_0x295dc9,_0x1f6580){_0x295dc9=_0x295dc9-0x0;var _0x4a98a1=_0x246e[_0x295dc9];return _0x4a98a1;};'use strict';var _=require(_0xe246('0x0'));var util=require(_0xe246('0x1'));var moment=require(_0xe246('0x2'));var BPromise=require('bluebird');var rs=require(_0xe246('0x3'));var fs=require('fs');var Redis=require(_0xe246('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe246('0x5'))('rpc');var config=require(_0xe246('0x6'));var jayson=require(_0xe246('0x7'));var client=jayson[_0xe246('0x8')][_0xe246('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4cc6cf,_0x18a6bb,_0x5eba5d){return new BPromise(function(_0x5605f2,_0x5a911f){return client[_0xe246('0xa')](_0x4cc6cf,_0x5eba5d)['then'](function(_0xb6301c){logger[_0xe246('0xb')](_0xe246('0xc'),_0x18a6bb,_0xe246('0xd'));logger[_0xe246('0xe')](_0xe246('0xf'),_0x18a6bb,_0xe246('0xd'),JSON[_0xe246('0x10')](_0xb6301c));if(_0xb6301c['error']){if(_0xb6301c[_0xe246('0x11')][_0xe246('0x12')]===0x1f4){logger[_0xe246('0x11')](_0xe246('0xc'),_0x18a6bb,_0xb6301c[_0xe246('0x11')][_0xe246('0x13')]);return _0x5a911f(_0xb6301c[_0xe246('0x11')][_0xe246('0x13')]);}logger[_0xe246('0x11')](_0xe246('0xc'),_0x18a6bb,_0xb6301c['error'][_0xe246('0x13')]);return _0x5605f2(_0xb6301c[_0xe246('0x11')]['message']);}else{logger[_0xe246('0xb')]('SalesforceAccount,\x20%s,\x20%s',_0x18a6bb,_0xe246('0xd'));_0x5605f2(_0xb6301c[_0xe246('0x14')]['message']);}})['catch'](function(_0x15ad8d){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x18a6bb,_0x15ad8d);_0x5a911f(_0x15ad8d);});});}exports[_0xe246('0x15')]=function(_0x159f64){var _0x3e1b1b=this;return new Promise(function(_0x586c3f,_0x45608f){return db[_0xe246('0x16')][_0xe246('0x17')]({'raw':_0x159f64[_0xe246('0x18')]?_0x159f64[_0xe246('0x18')][_0xe246('0x19')]===undefined?!![]:![]:!![],'where':_0x159f64[_0xe246('0x18')]?_0x159f64[_0xe246('0x18')][_0xe246('0x1a')]||null:null,'attributes':_0x159f64['options']?_0x159f64[_0xe246('0x18')]['attributes']||null:null,'limit':_0x159f64[_0xe246('0x18')]?_0x159f64[_0xe246('0x18')][_0xe246('0x1b')]||null:null,'include':_0x159f64['options']?_0x159f64['options'][_0xe246('0x1c')]?_[_0xe246('0x1d')](_0x159f64[_0xe246('0x18')][_0xe246('0x1c')],function(_0x32c834){return{'model':db[_0x32c834['model']],'as':_0x32c834['as'],'attributes':_0x32c834[_0xe246('0x1e')],'include':_0x32c834[_0xe246('0x1c')]?_['map'](_0x32c834['include'],function(_0x4e6243){return{'model':db[_0x4e6243[_0xe246('0x1f')]],'as':_0x4e6243['as'],'attributes':_0x4e6243[_0xe246('0x1e')],'include':_0x4e6243[_0xe246('0x1c')]?_['map'](_0x4e6243[_0xe246('0x1c')],function(_0x469264){return{'model':db[_0x469264[_0xe246('0x1f')]],'as':_0x469264['as'],'attributes':_0x469264['attributes']};}):[]};}):[]};}):[]:[]})[_0xe246('0x20')](function(_0x4dbe0d){logger['info']('GetSalesforceAccount',_0x159f64);logger['debug']('GetSalesforceAccount',_0x159f64,JSON[_0xe246('0x10')](_0x4dbe0d));_0x586c3f(_0x4dbe0d);})[_0xe246('0x21')](function(_0x487fa5){logger[_0xe246('0x11')](_0xe246('0x15'),_0x487fa5[_0xe246('0x13')],_0x159f64);_0x45608f(_0x3e1b1b['error'](0x1f4,_0x487fa5[_0xe246('0x13')]));});});};exports[_0xe246('0x22')]=function(_0x1fcc2c){var _0xbeed98=this;return new Promise(function(_0xf1231c,_0x4aa67b){return db[_0xe246('0x16')][_0xe246('0x23')]({'raw':_0x1fcc2c['options']?_0x1fcc2c[_0xe246('0x18')][_0xe246('0x19')]===undefined?!![]:![]:!![],'where':_0x1fcc2c[_0xe246('0x18')]?_0x1fcc2c[_0xe246('0x18')][_0xe246('0x1a')]||null:null,'attributes':_0x1fcc2c[_0xe246('0x18')]?_0x1fcc2c['options'][_0xe246('0x1e')]||null:null,'include':_0x1fcc2c[_0xe246('0x18')]?_0x1fcc2c[_0xe246('0x18')]['include']?_[_0xe246('0x1d')](_0x1fcc2c[_0xe246('0x18')][_0xe246('0x1c')],function(_0x4438f0){return{'model':db[_0x4438f0[_0xe246('0x1f')]],'as':_0x4438f0['as'],'attributes':_0x4438f0[_0xe246('0x1e')],'include':_0x4438f0[_0xe246('0x1c')]?_['map'](_0x4438f0[_0xe246('0x1c')],function(_0x4f9af9){return{'model':db[_0x4f9af9['model']],'as':_0x4f9af9['as'],'attributes':_0x4f9af9[_0xe246('0x1e')],'include':_0x4f9af9[_0xe246('0x1c')]?_[_0xe246('0x1d')](_0x4f9af9[_0xe246('0x1c')],function(_0x2ddb3c){return{'model':db[_0x2ddb3c[_0xe246('0x1f')]],'as':_0x2ddb3c['as'],'attributes':_0x2ddb3c[_0xe246('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe246('0x20')](function(_0x10d43e){logger[_0xe246('0xb')](_0xe246('0x22'),_0x1fcc2c);logger['debug'](_0xe246('0x22'),_0x1fcc2c,JSON[_0xe246('0x10')](_0x10d43e));_0xf1231c(_0x10d43e);})[_0xe246('0x21')](function(_0x477f8b){logger['error']('ShowSalesforceAccount',_0x477f8b[_0xe246('0x13')],_0x1fcc2c);_0x4aa67b(_0xbeed98[_0xe246('0x11')](0x1f4,_0x477f8b[_0xe246('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 81fd138..e68b937 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 _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x8578c0,_0x1694a5){var _0x1ab241=function(_0x1c1260){while(--_0x1c1260){_0x8578c0['push'](_0x8578c0['shift']());}};_0x1ab241(++_0x1694a5);}(_0x2ef3,0xba));var _0x32ef=function(_0x5dcd6a,_0x40cb17){_0x5dcd6a=_0x5dcd6a-0x0;var _0x1eeb01=_0x2ef3[_0x5dcd6a];return _0x1eeb01;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file +var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x4ab13d,_0x4ec8e2){var _0x5fc459=function(_0x4c1ee8){while(--_0x4c1ee8){_0x4ab13d['push'](_0x4ab13d['shift']());}};_0x5fc459(++_0x4ec8e2);}(_0x2ef3,0xba));var _0x32ef=function(_0x5a72e,_0x2ebcef){_0x5a72e=_0x5a72e-0x0;var _0x1a8418=_0x2ef3[_0x5a72e];return _0x1a8418;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index afb3991..edf71fd 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 _0x0b63=['account','sequelize','STRING','ENUM','Task','Case','contact_lead','contact','lead','account_contact_lead'];(function(_0x5a2358,_0x16bfff){var _0x2be9f1=function(_0x953797){while(--_0x953797){_0x5a2358['push'](_0x5a2358['shift']());}};_0x2be9f1(++_0x16bfff);}(_0x0b63,0xe7));var _0x30b6=function(_0x3db32f,_0x387630){_0x3db32f=_0x3db32f-0x0;var _0x2c7291=_0x0b63[_0x3db32f];return _0x2c7291;};'use strict';var Sequelize=require(_0x30b6('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x30b6('0x1')]},'ticketType':{'type':Sequelize[_0x30b6('0x2')](_0x30b6('0x3'),_0x30b6('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x30b6('0x2')](_0x30b6('0x5'),_0x30b6('0x6'),_0x30b6('0x7'),_0x30b6('0x8'),_0x30b6('0x9')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x30b6('0x2')]('nothing',_0x30b6('0x6'),'lead',_0x30b6('0x9')),'defaultValue':_0x30b6('0x7')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x30b6('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x30b6('0x1')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0cee=['lead','account_contact_lead','account','sequelize','exports','STRING','ENUM','Task','contact_lead','contact'];(function(_0x128a91,_0x1a0667){var _0x21acfa=function(_0x50deff){while(--_0x50deff){_0x128a91['push'](_0x128a91['shift']());}};_0x21acfa(++_0x1a0667);}(_0x0cee,0x12f));var _0xe0ce=function(_0x25fda4,_0x3a1bbb){_0x25fda4=_0x25fda4-0x0;var _0x4c62d9=_0x0cee[_0x25fda4];return _0x4c62d9;};'use strict';var Sequelize=require(_0xe0ce('0x0'));module[_0xe0ce('0x1')]={'name':{'type':Sequelize[_0xe0ce('0x2')]},'description':{'type':Sequelize[_0xe0ce('0x2')]},'ticketType':{'type':Sequelize[_0xe0ce('0x3')](_0xe0ce('0x4'),'Case'),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xe0ce('0x3')](_0xe0ce('0x5'),_0xe0ce('0x6'),_0xe0ce('0x7'),_0xe0ce('0x8'),_0xe0ce('0x9')),'defaultValue':_0xe0ce('0x5')},'moduleCreate':{'type':Sequelize[_0xe0ce('0x3')]('nothing',_0xe0ce('0x6'),_0xe0ce('0x7'),'account'),'defaultValue':_0xe0ce('0x7')},'leadId':{'type':Sequelize[_0xe0ce('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xe0ce('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xe0ce('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 0b66231..4ba4db6 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 _0x2297=['show','params','keys','includeAll','include','options','find','create','body','destroy','findOne','SalesforceField','getFields','pick','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count','set','Content-Range','apply','reject','update','then','name','send','map','rawAttributes','fieldName','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','merge','where','type','VIRTUAL','filter','SalesforceConfiguration','findAll','rows','catch'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x2297,0x100));var _0x7229=function(_0x9d4533,_0x4aeb7c){_0x9d4533=_0x9d4533-0x0;var _0x1a90bb=_0x2297[_0x9d4533];return _0x1a90bb;};'use strict';var emlformat=require(_0x7229('0x0'));var rimraf=require(_0x7229('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7229('0x2'));var rp=require(_0x7229('0x3'));var moment=require('moment');var BPromise=require(_0x7229('0x4'));var Mustache=require(_0x7229('0x5'));var util=require(_0x7229('0x6'));var path=require(_0x7229('0x7'));var sox=require(_0x7229('0x8'));var csv=require(_0x7229('0x9'));var ejs=require(_0x7229('0xa'));var fs=require('fs');var fs_extra=require(_0x7229('0xb'));var _=require(_0x7229('0xc'));var squel=require(_0x7229('0xd'));var crypto=require(_0x7229('0xe'));var jsforce=require(_0x7229('0xf'));var deskjs=require(_0x7229('0x10'));var toCsv=require(_0x7229('0x9'));var querystring=require(_0x7229('0x11'));var Papa=require('papaparse');var Redis=require(_0x7229('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7229('0x13'));var as=require(_0x7229('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7229('0x15'))(_0x7229('0x16'));var utils=require(_0x7229('0x17'));var config=require(_0x7229('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40f59a,_0x46f116){_0x46f116=_0x46f116||0xcc;return function(_0x141ecd){if(_0x141ecd){return _0x40f59a[_0x7229('0x19')](_0x46f116);}return _0x40f59a[_0x7229('0x1a')](_0x46f116)[_0x7229('0x1b')]();};}function respondWithResult(_0x52c463,_0x2ac9b2){_0x2ac9b2=_0x2ac9b2||0xc8;return function(_0x1553ed){if(_0x1553ed){return _0x52c463[_0x7229('0x1a')](_0x2ac9b2)['json'](_0x1553ed);}};}function respondWithFilteredResult(_0x323d12,_0x340bdb){return function(_0xa84e3a){if(_0xa84e3a){var _0x53744b=typeof _0x340bdb[_0x7229('0x1c')]===_0x7229('0x1d')&&typeof _0x340bdb['limit']===_0x7229('0x1d');var _0x503a2b=_0xa84e3a['count'];var _0x289bf2=_0x53744b?0x0:_0x340bdb[_0x7229('0x1c')];var _0x3d6c54=_0x53744b?_0xa84e3a[_0x7229('0x1e')]:_0x340bdb[_0x7229('0x1c')]+_0x340bdb['limit'];var _0x1ea1c1;if(_0x3d6c54>=_0x503a2b){_0x3d6c54=_0x503a2b;_0x1ea1c1=0xc8;}else{_0x1ea1c1=0xce;}_0x323d12[_0x7229('0x1a')](_0x1ea1c1);return _0x323d12[_0x7229('0x1f')](_0x7229('0x20'),_0x289bf2+'-'+_0x3d6c54+'/'+_0x503a2b)['json'](_0xa84e3a);}return null;};}function patchUpdates(_0x35d09c){return function(_0x4f0629){try{jsonpatch[_0x7229('0x21')](_0x4f0629,_0x35d09c,!![]);}catch(_0x75e468){return BPromise[_0x7229('0x22')](_0x75e468);}return _0x4f0629['save']();};}function saveUpdates(_0x36de35,_0x108c08){return function(_0x1a4c57){if(_0x1a4c57){return _0x1a4c57[_0x7229('0x23')](_0x36de35)[_0x7229('0x24')](function(_0x3b09f1){return _0x3b09f1;});}return null;};}function removeEntity(_0x27fd51,_0x3158de){return function(_0x295f1c){if(_0x295f1c){return _0x295f1c['destroy']()[_0x7229('0x24')](function(){_0x27fd51[_0x7229('0x1a')](0xcc)[_0x7229('0x1b')]();});}};}function handleEntityNotFound(_0x22c86a,_0x2498ad){return function(_0x1d6b4c){if(!_0x1d6b4c){_0x22c86a[_0x7229('0x19')](0x194);}return _0x1d6b4c;};}function handleError(_0x5e72f4,_0x3c87c4){_0x3c87c4=_0x3c87c4||0x1f4;return function(_0x5a2741){logger['error'](_0x5a2741['stack']);if(_0x5a2741[_0x7229('0x25')]){delete _0x5a2741['name'];}_0x5e72f4[_0x7229('0x1a')](_0x3c87c4)[_0x7229('0x26')](_0x5a2741);};}exports['index']=function(_0x4e43a2,_0x118b22){var _0x572d7b={},_0x4f8b8a={},_0x203233={'count':0x0,'rows':[]};var _0x22c1c6=_[_0x7229('0x27')](db['SalesforceConfiguration'][_0x7229('0x28')],function(_0x4063c3){return{'name':_0x4063c3[_0x7229('0x29')],'type':_0x4063c3['type'][_0x7229('0x2a')]};});_0x4f8b8a[_0x7229('0x2b')]=_[_0x7229('0x27')](_0x22c1c6,'name');_0x4f8b8a[_0x7229('0x2c')]=_['keys'](_0x4e43a2[_0x7229('0x2c')]);_0x4f8b8a['filters']=_['intersection'](_0x4f8b8a[_0x7229('0x2b')],_0x4f8b8a[_0x7229('0x2c')]);_0x572d7b[_0x7229('0x2d')]=_[_0x7229('0x2e')](_0x4f8b8a[_0x7229('0x2b')],qs[_0x7229('0x2f')](_0x4e43a2[_0x7229('0x2c')]['fields']));_0x572d7b[_0x7229('0x2d')]=_0x572d7b[_0x7229('0x2d')][_0x7229('0x30')]?_0x572d7b[_0x7229('0x2d')]:_0x4f8b8a[_0x7229('0x2b')];if(!_0x4e43a2[_0x7229('0x2c')][_0x7229('0x31')](_0x7229('0x32'))){_0x572d7b[_0x7229('0x33')]=qs['limit'](_0x4e43a2[_0x7229('0x2c')]['limit']);_0x572d7b[_0x7229('0x1c')]=qs['offset'](_0x4e43a2[_0x7229('0x2c')][_0x7229('0x1c')]);}_0x572d7b[_0x7229('0x34')]=qs[_0x7229('0x35')](_0x4e43a2['query'][_0x7229('0x35')]);_0x572d7b['where']=qs[_0x7229('0x36')](_['pick'](_0x4e43a2['query'],_0x4f8b8a['filters']),_0x22c1c6);if(_0x4e43a2[_0x7229('0x2c')]['filter']){_0x572d7b['where']=_[_0x7229('0x37')](_0x572d7b[_0x7229('0x38')],{'$or':_[_0x7229('0x27')](_0x22c1c6,function(_0x26a934){if(_0x26a934[_0x7229('0x39')]!==_0x7229('0x3a')){var _0x32fcdd={};_0x32fcdd[_0x26a934[_0x7229('0x25')]]={'$like':'%'+_0x4e43a2[_0x7229('0x2c')][_0x7229('0x3b')]+'%'};return _0x32fcdd;}})});}_0x572d7b=_[_0x7229('0x37')]({},_0x572d7b,_0x4e43a2['options']);var _0x16f036={'where':_0x572d7b['where']};return db[_0x7229('0x3c')][_0x7229('0x1e')](_0x16f036)[_0x7229('0x24')](function(_0x158cae){_0x203233[_0x7229('0x1e')]=_0x158cae;if(_0x4e43a2[_0x7229('0x2c')]['includeAll']){_0x572d7b['include']=[{'all':!![]}];}return db[_0x7229('0x3c')][_0x7229('0x3d')](_0x572d7b);})[_0x7229('0x24')](function(_0x4d3ab0){_0x203233[_0x7229('0x3e')]=_0x4d3ab0;return _0x203233;})[_0x7229('0x24')](respondWithFilteredResult(_0x118b22,_0x572d7b))[_0x7229('0x3f')](handleError(_0x118b22,null));};exports[_0x7229('0x40')]=function(_0x1d9b92,_0x5bdbf7){var _0x3ac014={'raw':![],'where':{'id':_0x1d9b92[_0x7229('0x41')]['id']}},_0x1aaea5={};_0x1aaea5[_0x7229('0x2b')]=_[_0x7229('0x42')](db[_0x7229('0x3c')]['rawAttributes']);_0x1aaea5[_0x7229('0x2c')]=_[_0x7229('0x42')](_0x1d9b92[_0x7229('0x2c')]);_0x1aaea5[_0x7229('0x36')]=_[_0x7229('0x2e')](_0x1aaea5[_0x7229('0x2b')],_0x1aaea5[_0x7229('0x2c')]);_0x3ac014[_0x7229('0x2d')]=_['intersection'](_0x1aaea5[_0x7229('0x2b')],qs[_0x7229('0x2f')](_0x1d9b92[_0x7229('0x2c')]['fields']));_0x3ac014['attributes']=_0x3ac014[_0x7229('0x2d')][_0x7229('0x30')]?_0x3ac014[_0x7229('0x2d')]:_0x1aaea5['model'];if(_0x1d9b92[_0x7229('0x2c')][_0x7229('0x43')]){_0x3ac014[_0x7229('0x44')]=[{'all':!![]}];}_0x3ac014=_[_0x7229('0x37')]({},_0x3ac014,_0x1d9b92[_0x7229('0x45')]);return db['SalesforceConfiguration'][_0x7229('0x46')](_0x3ac014)['then'](handleEntityNotFound(_0x5bdbf7,null))[_0x7229('0x24')](respondWithResult(_0x5bdbf7,null))[_0x7229('0x3f')](handleError(_0x5bdbf7,null));};exports[_0x7229('0x47')]=function(_0x34be48,_0x20d642){return db[_0x7229('0x3c')]['create'](_0x34be48[_0x7229('0x48')],{})['then'](respondWithResult(_0x20d642,0xc9))[_0x7229('0x3f')](handleError(_0x20d642,null));};exports[_0x7229('0x23')]=function(_0x6ec44c,_0x3cf35f){if(_0x6ec44c['body']['id']){delete _0x6ec44c[_0x7229('0x48')]['id'];}return db[_0x7229('0x3c')][_0x7229('0x46')]({'where':{'id':_0x6ec44c[_0x7229('0x41')]['id']}})[_0x7229('0x24')](handleEntityNotFound(_0x3cf35f,null))[_0x7229('0x24')](saveUpdates(_0x6ec44c[_0x7229('0x48')],null))[_0x7229('0x24')](respondWithResult(_0x3cf35f,null))[_0x7229('0x3f')](handleError(_0x3cf35f,null));};exports[_0x7229('0x49')]=function(_0x20e9ad,_0x241ab3){return db[_0x7229('0x3c')]['find']({'where':{'id':_0x20e9ad[_0x7229('0x41')]['id']}})[_0x7229('0x24')](handleEntityNotFound(_0x241ab3,null))[_0x7229('0x24')](removeEntity(_0x241ab3,null))[_0x7229('0x3f')](handleError(_0x241ab3,null));};exports['getFields']=function(_0x5eaefc,_0x342367,_0x13257b){var _0x1ba13c={};var _0x47f199={};var _0x1a9687;var _0x492ad5;return db['SalesforceConfiguration'][_0x7229('0x4a')]({'where':{'id':_0x5eaefc['params']['id']}})['then'](handleEntityNotFound(_0x342367,null))['then'](function(_0x3dc9d3){if(_0x3dc9d3){_0x1a9687=_0x3dc9d3;_0x47f199['model']=_[_0x7229('0x42')](db[_0x7229('0x4b')][_0x7229('0x28')]);_0x47f199['query']=_[_0x7229('0x42')](_0x5eaefc[_0x7229('0x2c')]);_0x47f199['filters']=_[_0x7229('0x2e')](_0x47f199[_0x7229('0x2b')],_0x47f199[_0x7229('0x2c')]);_0x1ba13c[_0x7229('0x2d')]=_['intersection'](_0x47f199[_0x7229('0x2b')],qs[_0x7229('0x2f')](_0x5eaefc['query'][_0x7229('0x2f')]));_0x1ba13c[_0x7229('0x2d')]=_0x1ba13c['attributes'][_0x7229('0x30')]?_0x1ba13c[_0x7229('0x2d')]:_0x47f199[_0x7229('0x2b')];_0x1ba13c[_0x7229('0x34')]=qs['sort'](_0x5eaefc[_0x7229('0x2c')][_0x7229('0x35')]);_0x1ba13c[_0x7229('0x38')]=qs['filters'](_['pick'](_0x5eaefc[_0x7229('0x2c')],_0x47f199['filters']));if(_0x5eaefc['query']['filter']){_0x1ba13c[_0x7229('0x38')]=_['merge'](_0x1ba13c[_0x7229('0x38')],{'$or':_[_0x7229('0x27')](_0x1ba13c[_0x7229('0x2d')],function(_0x509493){var _0x1f3005={};_0x1f3005[_0x509493]={'$like':'%'+_0x5eaefc['query'][_0x7229('0x3b')]+'%'};return _0x1f3005;})});}_0x1ba13c=_[_0x7229('0x37')]({},_0x1ba13c,_0x5eaefc[_0x7229('0x45')]);return _0x1a9687[_0x7229('0x4c')](_0x1ba13c);}})[_0x7229('0x24')](function(_0x33ff9e){if(_0x33ff9e){_0x492ad5=_0x33ff9e[_0x7229('0x30')];if(!_0x5eaefc[_0x7229('0x2c')][_0x7229('0x31')](_0x7229('0x32'))){_0x1ba13c[_0x7229('0x33')]=qs[_0x7229('0x33')](_0x5eaefc[_0x7229('0x2c')]['limit']);_0x1ba13c[_0x7229('0x1c')]=qs['offset'](_0x5eaefc[_0x7229('0x2c')]['offset']);}return _0x1a9687[_0x7229('0x4c')](_0x1ba13c);}})[_0x7229('0x24')](function(_0xeb04e){if(_0xeb04e){return _0xeb04e?{'count':_0x492ad5,'rows':_0xeb04e}:null;}})[_0x7229('0x24')](respondWithResult(_0x342367,null))[_0x7229('0x3f')](handleError(_0x342367,null));};exports['getSubjects']=function(_0x5c74ce,_0x13ee15,_0x1ee159){var _0x42bac1={};var _0x3ac939={};var _0xb1a45;var _0x178e0d;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x5c74ce['params']['id']}})[_0x7229('0x24')](handleEntityNotFound(_0x13ee15,null))[_0x7229('0x24')](function(_0x82d11f){if(_0x82d11f){_0xb1a45=_0x82d11f;_0x3ac939[_0x7229('0x2b')]=_[_0x7229('0x42')](db['SalesforceField'][_0x7229('0x28')]);_0x3ac939['query']=_[_0x7229('0x42')](_0x5c74ce[_0x7229('0x2c')]);_0x3ac939[_0x7229('0x36')]=_['intersection'](_0x3ac939[_0x7229('0x2b')],_0x3ac939[_0x7229('0x2c')]);_0x42bac1[_0x7229('0x2d')]=_[_0x7229('0x2e')](_0x3ac939[_0x7229('0x2b')],qs['fields'](_0x5c74ce[_0x7229('0x2c')][_0x7229('0x2f')]));_0x42bac1[_0x7229('0x2d')]=_0x42bac1[_0x7229('0x2d')][_0x7229('0x30')]?_0x42bac1[_0x7229('0x2d')]:_0x3ac939[_0x7229('0x2b')];_0x42bac1['order']=qs[_0x7229('0x35')](_0x5c74ce['query'][_0x7229('0x35')]);_0x42bac1[_0x7229('0x38')]=qs['filters'](_[_0x7229('0x4d')](_0x5c74ce['query'],_0x3ac939[_0x7229('0x36')]));if(_0x5c74ce[_0x7229('0x2c')][_0x7229('0x3b')]){_0x42bac1[_0x7229('0x38')]=_[_0x7229('0x37')](_0x42bac1[_0x7229('0x38')],{'$or':_[_0x7229('0x27')](_0x42bac1[_0x7229('0x2d')],function(_0x454f29){var _0x1b7f66={};_0x1b7f66[_0x454f29]={'$like':'%'+_0x5c74ce[_0x7229('0x2c')][_0x7229('0x3b')]+'%'};return _0x1b7f66;})});}_0x42bac1=_[_0x7229('0x37')]({},_0x42bac1,_0x5c74ce[_0x7229('0x45')]);return _0xb1a45[_0x7229('0x4e')](_0x42bac1);}})['then'](function(_0x2c9dca){if(_0x2c9dca){_0x178e0d=_0x2c9dca[_0x7229('0x30')];if(!_0x5c74ce[_0x7229('0x2c')][_0x7229('0x31')](_0x7229('0x32'))){_0x42bac1[_0x7229('0x33')]=qs[_0x7229('0x33')](_0x5c74ce['query'][_0x7229('0x33')]);_0x42bac1['offset']=qs[_0x7229('0x1c')](_0x5c74ce[_0x7229('0x2c')][_0x7229('0x1c')]);}return _0xb1a45[_0x7229('0x4e')](_0x42bac1);}})[_0x7229('0x24')](function(_0x3aff4e){if(_0x3aff4e){return _0x3aff4e?{'count':_0x178e0d,'rows':_0x3aff4e}:null;}})[_0x7229('0x24')](respondWithResult(_0x13ee15,null))[_0x7229('0x3f')](handleError(_0x13ee15,null));};exports[_0x7229('0x4f')]=function(_0x592f6d,_0x3e548d,_0x5ad958){var _0x1410bf={};var _0x22ae57={};var _0x45cec1;var _0x402b11;return db[_0x7229('0x3c')][_0x7229('0x4a')]({'where':{'id':_0x592f6d[_0x7229('0x41')]['id']}})[_0x7229('0x24')](handleEntityNotFound(_0x3e548d,null))[_0x7229('0x24')](function(_0x523ffe){if(_0x523ffe){_0x45cec1=_0x523ffe;_0x22ae57[_0x7229('0x2b')]=_[_0x7229('0x42')](db[_0x7229('0x4b')][_0x7229('0x28')]);_0x22ae57[_0x7229('0x2c')]=_['keys'](_0x592f6d[_0x7229('0x2c')]);_0x22ae57['filters']=_[_0x7229('0x2e')](_0x22ae57['model'],_0x22ae57['query']);_0x1410bf[_0x7229('0x2d')]=_[_0x7229('0x2e')](_0x22ae57['model'],qs['fields'](_0x592f6d[_0x7229('0x2c')][_0x7229('0x2f')]));_0x1410bf[_0x7229('0x2d')]=_0x1410bf['attributes'][_0x7229('0x30')]?_0x1410bf[_0x7229('0x2d')]:_0x22ae57[_0x7229('0x2b')];_0x1410bf[_0x7229('0x34')]=qs[_0x7229('0x35')](_0x592f6d[_0x7229('0x2c')][_0x7229('0x35')]);_0x1410bf[_0x7229('0x38')]=qs[_0x7229('0x36')](_[_0x7229('0x4d')](_0x592f6d[_0x7229('0x2c')],_0x22ae57[_0x7229('0x36')]));if(_0x592f6d[_0x7229('0x2c')][_0x7229('0x3b')]){_0x1410bf[_0x7229('0x38')]=_[_0x7229('0x37')](_0x1410bf['where'],{'$or':_['map'](_0x1410bf[_0x7229('0x2d')],function(_0x2e999a){var _0x32d2bc={};_0x32d2bc[_0x2e999a]={'$like':'%'+_0x592f6d['query']['filter']+'%'};return _0x32d2bc;})});}_0x1410bf=_[_0x7229('0x37')]({},_0x1410bf,_0x592f6d['options']);return _0x45cec1[_0x7229('0x4f')](_0x1410bf);}})[_0x7229('0x24')](function(_0x2efe1c){if(_0x2efe1c){_0x402b11=_0x2efe1c['length'];if(!_0x592f6d[_0x7229('0x2c')][_0x7229('0x31')](_0x7229('0x32'))){_0x1410bf[_0x7229('0x33')]=qs[_0x7229('0x33')](_0x592f6d[_0x7229('0x2c')]['limit']);_0x1410bf[_0x7229('0x1c')]=qs['offset'](_0x592f6d['query'][_0x7229('0x1c')]);}return _0x45cec1[_0x7229('0x4f')](_0x1410bf);}})[_0x7229('0x24')](function(_0x5357b9){if(_0x5357b9){return _0x5357b9?{'count':_0x402b11,'rows':_0x5357b9}:null;}})[_0x7229('0x24')](respondWithResult(_0x3e548d,null))[_0x7229('0x3f')](handleError(_0x3e548d,null));}; \ No newline at end of file +var _0x9f5a=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','catch','params','include','create','body','destroy','find','findOne','SalesforceField','getFields','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','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','end','json','offset','undefined','count','limit','status','set','apply','reject','save','update','then','stack','name','send','index','map','SalesforceConfiguration','rawAttributes'];(function(_0x484e53,_0x18b6c5){var _0x5363a8=function(_0x18f249){while(--_0x18f249){_0x484e53['push'](_0x484e53['shift']());}};_0x5363a8(++_0x18b6c5);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x8dec00,_0x59b1bd){_0x8dec00=_0x8dec00-0x0;var _0x34cde7=_0x9f5a[_0x8dec00];return _0x34cde7;};'use strict';var emlformat=require(_0xa9f5('0x0'));var rimraf=require(_0xa9f5('0x1'));var zipdir=require(_0xa9f5('0x2'));var jsonpatch=require(_0xa9f5('0x3'));var rp=require('request-promise');var moment=require(_0xa9f5('0x4'));var BPromise=require(_0xa9f5('0x5'));var Mustache=require(_0xa9f5('0x6'));var util=require('util');var path=require(_0xa9f5('0x7'));var sox=require('sox');var csv=require(_0xa9f5('0x8'));var ejs=require(_0xa9f5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa9f5('0xa'));var squel=require(_0xa9f5('0xb'));var crypto=require(_0xa9f5('0xc'));var jsforce=require(_0xa9f5('0xd'));var deskjs=require(_0xa9f5('0xe'));var toCsv=require(_0xa9f5('0x8'));var querystring=require(_0xa9f5('0xf'));var Papa=require('papaparse');var Redis=require(_0xa9f5('0x10'));var authService=require(_0xa9f5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa9f5('0x12'));var hardwareService=require(_0xa9f5('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xa9f5('0x14'));var config=require(_0xa9f5('0x15'));var licenseUtil=require(_0xa9f5('0x16'));var db=require(_0xa9f5('0x17'))['db'];function respondWithStatusCode(_0x4c26a8,_0x788dec){_0x788dec=_0x788dec||0xcc;return function(_0x24ce85){if(_0x24ce85){return _0x4c26a8[_0xa9f5('0x18')](_0x788dec);}return _0x4c26a8['status'](_0x788dec)[_0xa9f5('0x19')]();};}function respondWithResult(_0x899513,_0x5a5653){_0x5a5653=_0x5a5653||0xc8;return function(_0x58609c){if(_0x58609c){return _0x899513['status'](_0x5a5653)[_0xa9f5('0x1a')](_0x58609c);}};}function respondWithFilteredResult(_0x48bfdc,_0x5f2b6a){return function(_0x870466){if(_0x870466){var _0x131ed6=typeof _0x5f2b6a[_0xa9f5('0x1b')]===_0xa9f5('0x1c')&&typeof _0x5f2b6a['limit']===_0xa9f5('0x1c');var _0x401ae7=_0x870466[_0xa9f5('0x1d')];var _0x45af85=_0x131ed6?0x0:_0x5f2b6a[_0xa9f5('0x1b')];var _0x1ee027=_0x131ed6?_0x870466[_0xa9f5('0x1d')]:_0x5f2b6a[_0xa9f5('0x1b')]+_0x5f2b6a[_0xa9f5('0x1e')];var _0x38bd22;if(_0x1ee027>=_0x401ae7){_0x1ee027=_0x401ae7;_0x38bd22=0xc8;}else{_0x38bd22=0xce;}_0x48bfdc[_0xa9f5('0x1f')](_0x38bd22);return _0x48bfdc[_0xa9f5('0x20')]('Content-Range',_0x45af85+'-'+_0x1ee027+'/'+_0x401ae7)[_0xa9f5('0x1a')](_0x870466);}return null;};}function patchUpdates(_0x131f21){return function(_0x28779c){try{jsonpatch[_0xa9f5('0x21')](_0x28779c,_0x131f21,!![]);}catch(_0x322430){return BPromise[_0xa9f5('0x22')](_0x322430);}return _0x28779c[_0xa9f5('0x23')]();};}function saveUpdates(_0x48b473,_0x1bf2c7){return function(_0x2ea752){if(_0x2ea752){return _0x2ea752[_0xa9f5('0x24')](_0x48b473)[_0xa9f5('0x25')](function(_0xf15d71){return _0xf15d71;});}return null;};}function removeEntity(_0x2626ca,_0x1a204e){return function(_0x41e9aa){if(_0x41e9aa){return _0x41e9aa['destroy']()[_0xa9f5('0x25')](function(){_0x2626ca[_0xa9f5('0x1f')](0xcc)[_0xa9f5('0x19')]();});}};}function handleEntityNotFound(_0x24c8eb,_0x2c2e9f){return function(_0x31b517){if(!_0x31b517){_0x24c8eb['sendStatus'](0x194);}return _0x31b517;};}function handleError(_0x3911c8,_0x49e850){_0x49e850=_0x49e850||0x1f4;return function(_0x53caa4){logger['error'](_0x53caa4[_0xa9f5('0x26')]);if(_0x53caa4[_0xa9f5('0x27')]){delete _0x53caa4[_0xa9f5('0x27')];}_0x3911c8[_0xa9f5('0x1f')](_0x49e850)[_0xa9f5('0x28')](_0x53caa4);};}exports[_0xa9f5('0x29')]=function(_0x51741f,_0x2fbe8c){var _0x43ba93={},_0x41f2f4={},_0x5faf64={'count':0x0,'rows':[]};var _0x23dee2=_[_0xa9f5('0x2a')](db[_0xa9f5('0x2b')][_0xa9f5('0x2c')],function(_0x5a422b){return{'name':_0x5a422b['fieldName'],'type':_0x5a422b['type'][_0xa9f5('0x2d')]};});_0x41f2f4[_0xa9f5('0x2e')]=_[_0xa9f5('0x2a')](_0x23dee2,_0xa9f5('0x27'));_0x41f2f4[_0xa9f5('0x2f')]=_[_0xa9f5('0x30')](_0x51741f[_0xa9f5('0x2f')]);_0x41f2f4[_0xa9f5('0x31')]=_[_0xa9f5('0x32')](_0x41f2f4[_0xa9f5('0x2e')],_0x41f2f4[_0xa9f5('0x2f')]);_0x43ba93[_0xa9f5('0x33')]=_[_0xa9f5('0x32')](_0x41f2f4['model'],qs[_0xa9f5('0x34')](_0x51741f[_0xa9f5('0x2f')][_0xa9f5('0x34')]));_0x43ba93[_0xa9f5('0x33')]=_0x43ba93[_0xa9f5('0x33')][_0xa9f5('0x35')]?_0x43ba93[_0xa9f5('0x33')]:_0x41f2f4[_0xa9f5('0x2e')];if(!_0x51741f['query'][_0xa9f5('0x36')]('nolimit')){_0x43ba93[_0xa9f5('0x1e')]=qs[_0xa9f5('0x1e')](_0x51741f['query'][_0xa9f5('0x1e')]);_0x43ba93[_0xa9f5('0x1b')]=qs[_0xa9f5('0x1b')](_0x51741f[_0xa9f5('0x2f')]['offset']);}_0x43ba93[_0xa9f5('0x37')]=qs[_0xa9f5('0x38')](_0x51741f['query'][_0xa9f5('0x38')]);_0x43ba93[_0xa9f5('0x39')]=qs[_0xa9f5('0x31')](_[_0xa9f5('0x3a')](_0x51741f[_0xa9f5('0x2f')],_0x41f2f4[_0xa9f5('0x31')]),_0x23dee2);if(_0x51741f[_0xa9f5('0x2f')][_0xa9f5('0x3b')]){_0x43ba93[_0xa9f5('0x39')]=_['merge'](_0x43ba93['where'],{'$or':_[_0xa9f5('0x2a')](_0x23dee2,function(_0x2930eb){if(_0x2930eb['type']!==_0xa9f5('0x3c')){var _0x256212={};_0x256212[_0x2930eb[_0xa9f5('0x27')]]={'$like':'%'+_0x51741f[_0xa9f5('0x2f')]['filter']+'%'};return _0x256212;}})});}_0x43ba93=_[_0xa9f5('0x3d')]({},_0x43ba93,_0x51741f[_0xa9f5('0x3e')]);var _0x5a4715={'where':_0x43ba93[_0xa9f5('0x39')]};return db[_0xa9f5('0x2b')]['count'](_0x5a4715)[_0xa9f5('0x25')](function(_0x40b5fb){_0x5faf64['count']=_0x40b5fb;if(_0x51741f[_0xa9f5('0x2f')][_0xa9f5('0x3f')]){_0x43ba93['include']=[{'all':!![]}];}return db[_0xa9f5('0x2b')][_0xa9f5('0x40')](_0x43ba93);})['then'](function(_0x465f95){_0x5faf64['rows']=_0x465f95;return _0x5faf64;})[_0xa9f5('0x25')](respondWithFilteredResult(_0x2fbe8c,_0x43ba93))[_0xa9f5('0x41')](handleError(_0x2fbe8c,null));};exports['show']=function(_0xde7ab7,_0x488380){var _0x5de828={'raw':![],'where':{'id':_0xde7ab7[_0xa9f5('0x42')]['id']}},_0x2732b2={};_0x2732b2[_0xa9f5('0x2e')]=_[_0xa9f5('0x30')](db[_0xa9f5('0x2b')][_0xa9f5('0x2c')]);_0x2732b2[_0xa9f5('0x2f')]=_[_0xa9f5('0x30')](_0xde7ab7[_0xa9f5('0x2f')]);_0x2732b2['filters']=_[_0xa9f5('0x32')](_0x2732b2[_0xa9f5('0x2e')],_0x2732b2[_0xa9f5('0x2f')]);_0x5de828[_0xa9f5('0x33')]=_[_0xa9f5('0x32')](_0x2732b2[_0xa9f5('0x2e')],qs[_0xa9f5('0x34')](_0xde7ab7[_0xa9f5('0x2f')][_0xa9f5('0x34')]));_0x5de828[_0xa9f5('0x33')]=_0x5de828[_0xa9f5('0x33')][_0xa9f5('0x35')]?_0x5de828[_0xa9f5('0x33')]:_0x2732b2[_0xa9f5('0x2e')];if(_0xde7ab7[_0xa9f5('0x2f')][_0xa9f5('0x3f')]){_0x5de828[_0xa9f5('0x43')]=[{'all':!![]}];}_0x5de828=_[_0xa9f5('0x3d')]({},_0x5de828,_0xde7ab7[_0xa9f5('0x3e')]);return db['SalesforceConfiguration']['find'](_0x5de828)[_0xa9f5('0x25')](handleEntityNotFound(_0x488380,null))[_0xa9f5('0x25')](respondWithResult(_0x488380,null))['catch'](handleError(_0x488380,null));};exports[_0xa9f5('0x44')]=function(_0x30ae0f,_0x44ee96){return db['SalesforceConfiguration'][_0xa9f5('0x44')](_0x30ae0f['body'],{})[_0xa9f5('0x25')](respondWithResult(_0x44ee96,0xc9))[_0xa9f5('0x41')](handleError(_0x44ee96,null));};exports[_0xa9f5('0x24')]=function(_0x836a8d,_0x102ed8){if(_0x836a8d[_0xa9f5('0x45')]['id']){delete _0x836a8d['body']['id'];}return db[_0xa9f5('0x2b')]['find']({'where':{'id':_0x836a8d['params']['id']}})[_0xa9f5('0x25')](handleEntityNotFound(_0x102ed8,null))['then'](saveUpdates(_0x836a8d[_0xa9f5('0x45')],null))['then'](respondWithResult(_0x102ed8,null))[_0xa9f5('0x41')](handleError(_0x102ed8,null));};exports[_0xa9f5('0x46')]=function(_0xafeecc,_0x4c3587){return db[_0xa9f5('0x2b')][_0xa9f5('0x47')]({'where':{'id':_0xafeecc[_0xa9f5('0x42')]['id']}})['then'](handleEntityNotFound(_0x4c3587,null))[_0xa9f5('0x25')](removeEntity(_0x4c3587,null))['catch'](handleError(_0x4c3587,null));};exports['getFields']=function(_0x455918,_0x1f6bd3,_0x344254){var _0x593d70={};var _0x54e65a={};var _0x31cf70;var _0x58b278;return db[_0xa9f5('0x2b')][_0xa9f5('0x48')]({'where':{'id':_0x455918[_0xa9f5('0x42')]['id']}})['then'](handleEntityNotFound(_0x1f6bd3,null))['then'](function(_0xa6d5a8){if(_0xa6d5a8){_0x31cf70=_0xa6d5a8;_0x54e65a[_0xa9f5('0x2e')]=_['keys'](db[_0xa9f5('0x49')][_0xa9f5('0x2c')]);_0x54e65a[_0xa9f5('0x2f')]=_[_0xa9f5('0x30')](_0x455918[_0xa9f5('0x2f')]);_0x54e65a[_0xa9f5('0x31')]=_[_0xa9f5('0x32')](_0x54e65a[_0xa9f5('0x2e')],_0x54e65a['query']);_0x593d70['attributes']=_['intersection'](_0x54e65a[_0xa9f5('0x2e')],qs['fields'](_0x455918[_0xa9f5('0x2f')][_0xa9f5('0x34')]));_0x593d70[_0xa9f5('0x33')]=_0x593d70[_0xa9f5('0x33')][_0xa9f5('0x35')]?_0x593d70[_0xa9f5('0x33')]:_0x54e65a['model'];_0x593d70[_0xa9f5('0x37')]=qs[_0xa9f5('0x38')](_0x455918[_0xa9f5('0x2f')][_0xa9f5('0x38')]);_0x593d70[_0xa9f5('0x39')]=qs['filters'](_[_0xa9f5('0x3a')](_0x455918['query'],_0x54e65a['filters']));if(_0x455918['query'][_0xa9f5('0x3b')]){_0x593d70['where']=_[_0xa9f5('0x3d')](_0x593d70[_0xa9f5('0x39')],{'$or':_[_0xa9f5('0x2a')](_0x593d70['attributes'],function(_0x57a9e6){var _0x2ee9cf={};_0x2ee9cf[_0x57a9e6]={'$like':'%'+_0x455918['query'][_0xa9f5('0x3b')]+'%'};return _0x2ee9cf;})});}_0x593d70=_[_0xa9f5('0x3d')]({},_0x593d70,_0x455918[_0xa9f5('0x3e')]);return _0x31cf70[_0xa9f5('0x4a')](_0x593d70);}})[_0xa9f5('0x25')](function(_0x1bcae1){if(_0x1bcae1){_0x58b278=_0x1bcae1[_0xa9f5('0x35')];if(!_0x455918[_0xa9f5('0x2f')][_0xa9f5('0x36')]('nolimit')){_0x593d70['limit']=qs[_0xa9f5('0x1e')](_0x455918['query'][_0xa9f5('0x1e')]);_0x593d70[_0xa9f5('0x1b')]=qs['offset'](_0x455918[_0xa9f5('0x2f')]['offset']);}return _0x31cf70[_0xa9f5('0x4a')](_0x593d70);}})[_0xa9f5('0x25')](function(_0x13cf27){if(_0x13cf27){return _0x13cf27?{'count':_0x58b278,'rows':_0x13cf27}:null;}})['then'](respondWithResult(_0x1f6bd3,null))[_0xa9f5('0x41')](handleError(_0x1f6bd3,null));};exports[_0xa9f5('0x4b')]=function(_0x14a957,_0x5ab4c0,_0x2eaa8c){var _0x2505c6={};var _0x19b2a3={};var _0x2bf5fb;var _0x417ce5;return db['SalesforceConfiguration'][_0xa9f5('0x48')]({'where':{'id':_0x14a957['params']['id']}})[_0xa9f5('0x25')](handleEntityNotFound(_0x5ab4c0,null))[_0xa9f5('0x25')](function(_0xe58159){if(_0xe58159){_0x2bf5fb=_0xe58159;_0x19b2a3[_0xa9f5('0x2e')]=_[_0xa9f5('0x30')](db[_0xa9f5('0x49')][_0xa9f5('0x2c')]);_0x19b2a3[_0xa9f5('0x2f')]=_[_0xa9f5('0x30')](_0x14a957[_0xa9f5('0x2f')]);_0x19b2a3[_0xa9f5('0x31')]=_[_0xa9f5('0x32')](_0x19b2a3[_0xa9f5('0x2e')],_0x19b2a3[_0xa9f5('0x2f')]);_0x2505c6[_0xa9f5('0x33')]=_['intersection'](_0x19b2a3[_0xa9f5('0x2e')],qs[_0xa9f5('0x34')](_0x14a957[_0xa9f5('0x2f')][_0xa9f5('0x34')]));_0x2505c6['attributes']=_0x2505c6[_0xa9f5('0x33')][_0xa9f5('0x35')]?_0x2505c6[_0xa9f5('0x33')]:_0x19b2a3[_0xa9f5('0x2e')];_0x2505c6['order']=qs[_0xa9f5('0x38')](_0x14a957[_0xa9f5('0x2f')]['sort']);_0x2505c6[_0xa9f5('0x39')]=qs[_0xa9f5('0x31')](_['pick'](_0x14a957['query'],_0x19b2a3[_0xa9f5('0x31')]));if(_0x14a957[_0xa9f5('0x2f')][_0xa9f5('0x3b')]){_0x2505c6[_0xa9f5('0x39')]=_[_0xa9f5('0x3d')](_0x2505c6[_0xa9f5('0x39')],{'$or':_[_0xa9f5('0x2a')](_0x2505c6['attributes'],function(_0x55e0f4){var _0x8c3e5f={};_0x8c3e5f[_0x55e0f4]={'$like':'%'+_0x14a957['query'][_0xa9f5('0x3b')]+'%'};return _0x8c3e5f;})});}_0x2505c6=_['merge']({},_0x2505c6,_0x14a957['options']);return _0x2bf5fb[_0xa9f5('0x4b')](_0x2505c6);}})[_0xa9f5('0x25')](function(_0x3bdbbd){if(_0x3bdbbd){_0x417ce5=_0x3bdbbd[_0xa9f5('0x35')];if(!_0x14a957['query'][_0xa9f5('0x36')](_0xa9f5('0x4c'))){_0x2505c6[_0xa9f5('0x1e')]=qs[_0xa9f5('0x1e')](_0x14a957[_0xa9f5('0x2f')][_0xa9f5('0x1e')]);_0x2505c6[_0xa9f5('0x1b')]=qs[_0xa9f5('0x1b')](_0x14a957[_0xa9f5('0x2f')][_0xa9f5('0x1b')]);}return _0x2bf5fb['getSubjects'](_0x2505c6);}})['then'](function(_0xfc183d){if(_0xfc183d){return _0xfc183d?{'count':_0x417ce5,'rows':_0xfc183d}:null;}})[_0xa9f5('0x25')](respondWithResult(_0x5ab4c0,null))['catch'](handleError(_0x5ab4c0,null));};exports[_0xa9f5('0x4d')]=function(_0x3c754a,_0x18647f,_0x36b1a0){var _0x358809={};var _0x26a27a={};var _0x14b91c;var _0x4fc379;return db[_0xa9f5('0x2b')][_0xa9f5('0x48')]({'where':{'id':_0x3c754a['params']['id']}})['then'](handleEntityNotFound(_0x18647f,null))[_0xa9f5('0x25')](function(_0x204e20){if(_0x204e20){_0x14b91c=_0x204e20;_0x26a27a['model']=_['keys'](db[_0xa9f5('0x49')][_0xa9f5('0x2c')]);_0x26a27a[_0xa9f5('0x2f')]=_['keys'](_0x3c754a[_0xa9f5('0x2f')]);_0x26a27a[_0xa9f5('0x31')]=_[_0xa9f5('0x32')](_0x26a27a['model'],_0x26a27a[_0xa9f5('0x2f')]);_0x358809[_0xa9f5('0x33')]=_['intersection'](_0x26a27a['model'],qs[_0xa9f5('0x34')](_0x3c754a['query'][_0xa9f5('0x34')]));_0x358809[_0xa9f5('0x33')]=_0x358809[_0xa9f5('0x33')]['length']?_0x358809[_0xa9f5('0x33')]:_0x26a27a['model'];_0x358809['order']=qs[_0xa9f5('0x38')](_0x3c754a[_0xa9f5('0x2f')][_0xa9f5('0x38')]);_0x358809[_0xa9f5('0x39')]=qs['filters'](_[_0xa9f5('0x3a')](_0x3c754a[_0xa9f5('0x2f')],_0x26a27a['filters']));if(_0x3c754a[_0xa9f5('0x2f')][_0xa9f5('0x3b')]){_0x358809['where']=_['merge'](_0x358809[_0xa9f5('0x39')],{'$or':_[_0xa9f5('0x2a')](_0x358809['attributes'],function(_0x3c7771){var _0xe1b1ff={};_0xe1b1ff[_0x3c7771]={'$like':'%'+_0x3c754a[_0xa9f5('0x2f')][_0xa9f5('0x3b')]+'%'};return _0xe1b1ff;})});}_0x358809=_[_0xa9f5('0x3d')]({},_0x358809,_0x3c754a[_0xa9f5('0x3e')]);return _0x14b91c[_0xa9f5('0x4d')](_0x358809);}})[_0xa9f5('0x25')](function(_0xd5b400){if(_0xd5b400){_0x4fc379=_0xd5b400[_0xa9f5('0x35')];if(!_0x3c754a[_0xa9f5('0x2f')][_0xa9f5('0x36')](_0xa9f5('0x4c'))){_0x358809[_0xa9f5('0x1e')]=qs[_0xa9f5('0x1e')](_0x3c754a['query'][_0xa9f5('0x1e')]);_0x358809[_0xa9f5('0x1b')]=qs['offset'](_0x3c754a[_0xa9f5('0x2f')][_0xa9f5('0x1b')]);}return _0x14b91c[_0xa9f5('0x4d')](_0x358809);}})[_0xa9f5('0x25')](function(_0x2e5e6c){if(_0x2e5e6c){return _0x2e5e6c?{'count':_0x4fc379,'rows':_0x2e5e6c}:null;}})['then'](respondWithResult(_0x18647f,null))['catch'](handleError(_0x18647f,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index ae2db47..b7f9c32 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 _0x0710=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','lodash','util'];(function(_0x327c67,_0x2e6c3e){var _0x68e813=function(_0x1a5bfb){while(--_0x1a5bfb){_0x327c67['push'](_0x327c67['shift']());}};_0x68e813(++_0x2e6c3e);}(_0x0710,0x73));var _0x0071=function(_0x58bda9,_0x1d7931){_0x58bda9=_0x58bda9-0x0;var _0x9ba053=_0x0710[_0x58bda9];return _0x9ba053;};'use strict';var _=require(_0x0071('0x0'));var util=require(_0x0071('0x1'));var logger=require(_0x0071('0x2'))(_0x0071('0x3'));var moment=require(_0x0071('0x4'));var BPromise=require(_0x0071('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0071('0x6'));var rimraf=require(_0x0071('0x7'));var config=require(_0x0071('0x8'));var attributes=require(_0x0071('0x9'));module[_0x0071('0xa')]=function(_0x567081,_0x55e2e2){return _0x567081[_0x0071('0xb')](_0x0071('0xc'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x794b=['request-promise','path','rimraf','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x794b,0x159));var _0xb794=function(_0x4ce77b,_0x101b41){_0x4ce77b=_0x4ce77b-0x0;var _0x1c9398=_0x794b[_0x4ce77b];return _0x1c9398;};'use strict';var _=require(_0xb794('0x0'));var util=require(_0xb794('0x1'));var logger=require(_0xb794('0x2'))(_0xb794('0x3'));var moment=require(_0xb794('0x4'));var BPromise=require(_0xb794('0x5'));var rp=require(_0xb794('0x6'));var fs=require('fs');var path=require(_0xb794('0x7'));var rimraf=require(_0xb794('0x8'));var config=require('../../config/environment');var attributes=require(_0xb794('0x9'));module[_0xb794('0xa')]=function(_0x391554,_0x4a58a3){return _0x391554['define'](_0xb794('0xb'),attributes,{'tableName':_0xb794('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 7efe7d7..d06d021 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 _0x172c=['debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','util','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x3118eb,_0x386259){var _0x3166f3=function(_0x3e99f3){while(--_0x3e99f3){_0x3118eb['push'](_0x3118eb['shift']());}};_0x3166f3(++_0x386259);}(_0x172c,0x16f));var _0xc172=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x172c[_0x369151];return _0x4292d5;};'use strict';var _=require('lodash');var util=require(_0xc172('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc172('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xc172('0x2'));var logger=require(_0xc172('0x3'))('rpc');var config=require(_0xc172('0x4'));var jayson=require(_0xc172('0x5'));var client=jayson[_0xc172('0x6')][_0xc172('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x10214e,_0x5152e5,_0x49cb76){return new BPromise(function(_0x209d1a,_0xda5462){return client[_0xc172('0x8')](_0x10214e,_0x49cb76)[_0xc172('0x9')](function(_0x1eaf49){logger[_0xc172('0xa')](_0xc172('0xb'),_0x5152e5,_0xc172('0xc'));logger[_0xc172('0xd')](_0xc172('0xe'),_0x5152e5,_0xc172('0xc'),JSON['stringify'](_0x1eaf49));if(_0x1eaf49[_0xc172('0xf')]){if(_0x1eaf49[_0xc172('0xf')][_0xc172('0x10')]===0x1f4){logger[_0xc172('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5152e5,_0x1eaf49['error'][_0xc172('0x11')]);return _0xda5462(_0x1eaf49[_0xc172('0xf')][_0xc172('0x11')]);}logger[_0xc172('0xf')](_0xc172('0xb'),_0x5152e5,_0x1eaf49[_0xc172('0xf')]['message']);return _0x209d1a(_0x1eaf49[_0xc172('0xf')][_0xc172('0x11')]);}else{logger[_0xc172('0xa')](_0xc172('0xb'),_0x5152e5,_0xc172('0xc'));_0x209d1a(_0x1eaf49[_0xc172('0x12')][_0xc172('0x11')]);}})['catch'](function(_0x153c18){logger[_0xc172('0xf')](_0xc172('0xb'),_0x5152e5,_0x153c18);_0xda5462(_0x153c18);});});} \ No newline at end of file +var _0xf9ee=['SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','then','info'];(function(_0x924ac4,_0x546458){var _0x2b7c24=function(_0x1055db){while(--_0x1055db){_0x924ac4['push'](_0x924ac4['shift']());}};_0x2b7c24(++_0x546458);}(_0xf9ee,0xc6));var _0xef9e=function(_0x25b168,_0xf3d928){_0x25b168=_0x25b168-0x0;var _0xe9d00f=_0xf9ee[_0x25b168];return _0xe9d00f;};'use strict';var _=require(_0xef9e('0x0'));var util=require(_0xef9e('0x1'));var moment=require('moment');var BPromise=require(_0xef9e('0x2'));var rs=require(_0xef9e('0x3'));var fs=require('fs');var Redis=require(_0xef9e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xef9e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xef9e('0x6'));var client=jayson[_0xef9e('0x7')][_0xef9e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x558fb6,_0x5c47bc,_0x4d87d9){return new BPromise(function(_0x276461,_0x1f7e9f){return client[_0xef9e('0x9')](_0x558fb6,_0x4d87d9)[_0xef9e('0xa')](function(_0x55e1a1){logger[_0xef9e('0xb')](_0xef9e('0xc'),_0x5c47bc,_0xef9e('0xd'));logger[_0xef9e('0xe')](_0xef9e('0xf'),_0x5c47bc,_0xef9e('0xd'),JSON[_0xef9e('0x10')](_0x55e1a1));if(_0x55e1a1[_0xef9e('0x11')]){if(_0x55e1a1[_0xef9e('0x11')][_0xef9e('0x12')]===0x1f4){logger[_0xef9e('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5c47bc,_0x55e1a1['error']['message']);return _0x1f7e9f(_0x55e1a1[_0xef9e('0x11')][_0xef9e('0x13')]);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x5c47bc,_0x55e1a1[_0xef9e('0x11')][_0xef9e('0x13')]);return _0x276461(_0x55e1a1[_0xef9e('0x11')][_0xef9e('0x13')]);}else{logger[_0xef9e('0xb')](_0xef9e('0xc'),_0x5c47bc,_0xef9e('0xd'));_0x276461(_0x55e1a1[_0xef9e('0x14')][_0xef9e('0x13')]);}})['catch'](function(_0x1020b4){logger[_0xef9e('0x11')](_0xef9e('0xc'),_0x5c47bc,_0x1020b4);_0x1f7e9f(_0x1020b4);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 39000b2..a2cc354 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 _0x8983=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','multer','util'];(function(_0x3d4ef1,_0x5a957c){var _0x409423=function(_0x1ab129){while(--_0x1ab129){_0x3d4ef1['push'](_0x3d4ef1['shift']());}};_0x409423(++_0x5a957c);}(_0x8983,0x166));var _0x3898=function(_0x277e7e,_0x1c1b0f){_0x277e7e=_0x277e7e-0x0;var _0x2b08fa=_0x8983[_0x277e7e];return _0x2b08fa;};'use strict';var multer=require(_0x3898('0x0'));var util=require(_0x3898('0x1'));var path=require(_0x3898('0x2'));var timeout=require('connect-timeout');var express=require(_0x3898('0x3'));var router=express['Router']();var fs_extra=require(_0x3898('0x4'));var auth=require(_0x3898('0x5'));var interaction=require(_0x3898('0x6'));var config=require(_0x3898('0x7'));var controller=require('./intSalesforceField.controller');router[_0x3898('0x8')]('/',auth[_0x3898('0x9')](),controller[_0x3898('0xa')]);router[_0x3898('0x8')](_0x3898('0xb'),auth['isAuthenticated'](),controller[_0x3898('0xc')]);router['post']('/',auth[_0x3898('0x9')](),controller['create']);router[_0x3898('0xd')](_0x3898('0xb'),auth['isAuthenticated'](),controller[_0x3898('0xe')]);router[_0x3898('0xf')](_0x3898('0xb'),auth['isAuthenticated'](),controller[_0x3898('0x10')]);module[_0x3898('0x11')]=router; \ No newline at end of file +var _0x1ca8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','create','put','destroy','exports','multer','path','express','Router'];(function(_0x526ecb,_0x70b7cf){var _0x3a9028=function(_0x5b909b){while(--_0x5b909b){_0x526ecb['push'](_0x526ecb['shift']());}};_0x3a9028(++_0x70b7cf);}(_0x1ca8,0xbc));var _0x81ca=function(_0x50e68f,_0x44c2f6){_0x50e68f=_0x50e68f-0x0;var _0xef3a05=_0x1ca8[_0x50e68f];return _0xef3a05;};'use strict';var multer=require(_0x81ca('0x0'));var util=require('util');var path=require(_0x81ca('0x1'));var timeout=require('connect-timeout');var express=require(_0x81ca('0x2'));var router=express[_0x81ca('0x3')]();var fs_extra=require(_0x81ca('0x4'));var auth=require(_0x81ca('0x5'));var interaction=require(_0x81ca('0x6'));var config=require(_0x81ca('0x7'));var controller=require('./intSalesforceField.controller');router['get']('/',auth[_0x81ca('0x8')](),controller['index']);router[_0x81ca('0x9')](_0x81ca('0xa'),auth[_0x81ca('0x8')](),controller[_0x81ca('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x81ca('0xc')]);router[_0x81ca('0xd')](_0x81ca('0xa'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x81ca('0xe')]);module[_0x81ca('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index e44061c..7802c9d 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 _0x907b=['picklist','STRING','string','exports','ENUM','variable','customVariable','keyValue'];(function(_0x2d00da,_0x5dd411){var _0x379235=function(_0xbb40d1){while(--_0xbb40d1){_0x2d00da['push'](_0x2d00da['shift']());}};_0x379235(++_0x5dd411);}(_0x907b,0x15b));var _0xb907=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x907b[_0x342700];return _0x53406f;};'use strict';var Sequelize=require('sequelize');module[_0xb907('0x0')]={'type':{'type':Sequelize[_0xb907('0x1')]('string',_0xb907('0x2'),_0xb907('0x3'),_0xb907('0x4'),_0xb907('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb907('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb907('0x1')](_0xb907('0x7'),_0xb907('0x2'),_0xb907('0x3'))},'keyContent':{'type':Sequelize[_0xb907('0x6')]},'idField':{'type':Sequelize[_0xb907('0x6')]},'variableName':{'type':Sequelize[_0xb907('0x6')]}}; \ No newline at end of file +var _0x56e5=['variable','customVariable','sequelize','exports','keyValue','picklist','string','STRING','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x56e5,0x1df));var _0x556e=function(_0x1db5de,_0x37c0ef){_0x1db5de=_0x1db5de-0x0;var _0x4b165e=_0x56e5[_0x1db5de];return _0x4b165e;};'use strict';var Sequelize=require(_0x556e('0x0'));module[_0x556e('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable','customVariable',_0x556e('0x2'),_0x556e('0x3')),'defaultValue':_0x556e('0x4')},'content':{'type':Sequelize[_0x556e('0x5')]},'key':{'type':Sequelize[_0x556e('0x5')]},'keyType':{'type':Sequelize[_0x556e('0x6')](_0x556e('0x4'),_0x556e('0x7'),_0x556e('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x556e('0x5')]},'variableName':{'type':Sequelize[_0x556e('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 78228a2..d757cea 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 _0xb81a=['sort','pick','merge','where','options','includeAll','findAll','rows','show','params','length','include','catch','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','apply','save','update','then','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order'];(function(_0x11ce8f,_0x3843af){var _0x458cfa=function(_0x268a53){while(--_0x268a53){_0x11ce8f['push'](_0x11ce8f['shift']());}};_0x458cfa(++_0x3843af);}(_0xb81a,0x16a));var _0xab81=function(_0xa3b2,_0x2f8f65){_0xa3b2=_0xa3b2-0x0;var _0x598346=_0xb81a[_0xa3b2];return _0x598346;};'use strict';var emlformat=require(_0xab81('0x0'));var rimraf=require(_0xab81('0x1'));var zipdir=require(_0xab81('0x2'));var jsonpatch=require(_0xab81('0x3'));var rp=require(_0xab81('0x4'));var moment=require('moment');var BPromise=require(_0xab81('0x5'));var Mustache=require(_0xab81('0x6'));var util=require(_0xab81('0x7'));var path=require(_0xab81('0x8'));var sox=require('sox');var csv=require(_0xab81('0x9'));var ejs=require(_0xab81('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xab81('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xab81('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xab81('0x9'));var querystring=require(_0xab81('0xd'));var Papa=require('papaparse');var Redis=require(_0xab81('0xe'));var authService=require(_0xab81('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab81('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xab81('0x11'));var licenseUtil=require(_0xab81('0x12'));var db=require(_0xab81('0x13'))['db'];function respondWithStatusCode(_0x33cb58,_0x2adce0){_0x2adce0=_0x2adce0||0xcc;return function(_0x64981b){if(_0x64981b){return _0x33cb58[_0xab81('0x14')](_0x2adce0);}return _0x33cb58['status'](_0x2adce0)[_0xab81('0x15')]();};}function respondWithResult(_0x1733b3,_0x5109c8){_0x5109c8=_0x5109c8||0xc8;return function(_0x2324c8){if(_0x2324c8){return _0x1733b3[_0xab81('0x16')](_0x5109c8)[_0xab81('0x17')](_0x2324c8);}};}function respondWithFilteredResult(_0x516543,_0x46f2bb){return function(_0x1c9fce){if(_0x1c9fce){var _0x3e785d=typeof _0x46f2bb[_0xab81('0x18')]===_0xab81('0x19')&&typeof _0x46f2bb['limit']===_0xab81('0x19');var _0x4bee41=_0x1c9fce[_0xab81('0x1a')];var _0x58f3d3=_0x3e785d?0x0:_0x46f2bb[_0xab81('0x18')];var _0x3852bb=_0x3e785d?_0x1c9fce[_0xab81('0x1a')]:_0x46f2bb['offset']+_0x46f2bb['limit'];var _0x24440a;if(_0x3852bb>=_0x4bee41){_0x3852bb=_0x4bee41;_0x24440a=0xc8;}else{_0x24440a=0xce;}_0x516543[_0xab81('0x16')](_0x24440a);return _0x516543['set']('Content-Range',_0x58f3d3+'-'+_0x3852bb+'/'+_0x4bee41)['json'](_0x1c9fce);}return null;};}function patchUpdates(_0x288f4a){return function(_0x5e4ac0){try{jsonpatch[_0xab81('0x1b')](_0x5e4ac0,_0x288f4a,!![]);}catch(_0x237e7d){return BPromise['reject'](_0x237e7d);}return _0x5e4ac0[_0xab81('0x1c')]();};}function saveUpdates(_0xaf6e34,_0x29f512){return function(_0x110c7f){if(_0x110c7f){return _0x110c7f[_0xab81('0x1d')](_0xaf6e34)[_0xab81('0x1e')](function(_0x23b6e5){return _0x23b6e5;});}return null;};}function removeEntity(_0x209942,_0x465f3b){return function(_0x4ac540){if(_0x4ac540){return _0x4ac540['destroy']()[_0xab81('0x1e')](function(){_0x209942[_0xab81('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dbb33,_0x533d8e){return function(_0x5f2060){if(!_0x5f2060){_0x4dbb33[_0xab81('0x14')](0x194);}return _0x5f2060;};}function handleError(_0x49f383,_0x2b86d1){_0x2b86d1=_0x2b86d1||0x1f4;return function(_0x2675e9){logger['error'](_0x2675e9[_0xab81('0x1f')]);if(_0x2675e9[_0xab81('0x20')]){delete _0x2675e9[_0xab81('0x20')];}_0x49f383[_0xab81('0x16')](_0x2b86d1)[_0xab81('0x21')](_0x2675e9);};}exports[_0xab81('0x22')]=function(_0x4ab236,_0x355fe5){var _0x33fac4={},_0x342cb7={},_0x59ef9a={'count':0x0,'rows':[]};var _0x38605b=_[_0xab81('0x23')](db[_0xab81('0x24')][_0xab81('0x25')],function(_0x377f12){return{'name':_0x377f12[_0xab81('0x26')],'type':_0x377f12[_0xab81('0x27')][_0xab81('0x28')]};});_0x342cb7[_0xab81('0x29')]=_[_0xab81('0x23')](_0x38605b,_0xab81('0x20'));_0x342cb7['query']=_[_0xab81('0x2a')](_0x4ab236[_0xab81('0x2b')]);_0x342cb7[_0xab81('0x2c')]=_[_0xab81('0x2d')](_0x342cb7[_0xab81('0x29')],_0x342cb7[_0xab81('0x2b')]);_0x33fac4[_0xab81('0x2e')]=_[_0xab81('0x2d')](_0x342cb7[_0xab81('0x29')],qs[_0xab81('0x2f')](_0x4ab236[_0xab81('0x2b')][_0xab81('0x2f')]));_0x33fac4['attributes']=_0x33fac4[_0xab81('0x2e')]['length']?_0x33fac4[_0xab81('0x2e')]:_0x342cb7[_0xab81('0x29')];if(!_0x4ab236[_0xab81('0x2b')][_0xab81('0x30')](_0xab81('0x31'))){_0x33fac4['limit']=qs['limit'](_0x4ab236[_0xab81('0x2b')][_0xab81('0x32')]);_0x33fac4[_0xab81('0x18')]=qs['offset'](_0x4ab236[_0xab81('0x2b')][_0xab81('0x18')]);}_0x33fac4[_0xab81('0x33')]=qs[_0xab81('0x34')](_0x4ab236[_0xab81('0x2b')][_0xab81('0x34')]);_0x33fac4['where']=qs[_0xab81('0x2c')](_[_0xab81('0x35')](_0x4ab236[_0xab81('0x2b')],_0x342cb7[_0xab81('0x2c')]),_0x38605b);if(_0x4ab236['query']['filter']){_0x33fac4['where']=_[_0xab81('0x36')](_0x33fac4[_0xab81('0x37')],{'$or':_[_0xab81('0x23')](_0x38605b,function(_0x6cc194){if(_0x6cc194['type']!=='VIRTUAL'){var _0x1bb570={};_0x1bb570[_0x6cc194[_0xab81('0x20')]]={'$like':'%'+_0x4ab236['query']['filter']+'%'};return _0x1bb570;}})});}_0x33fac4=_['merge']({},_0x33fac4,_0x4ab236[_0xab81('0x38')]);var _0xd263a1={'where':_0x33fac4[_0xab81('0x37')]};return db['SalesforceField']['count'](_0xd263a1)['then'](function(_0x55d6e4){_0x59ef9a[_0xab81('0x1a')]=_0x55d6e4;if(_0x4ab236[_0xab81('0x2b')][_0xab81('0x39')]){_0x33fac4['include']=[{'all':!![]}];}return db[_0xab81('0x24')][_0xab81('0x3a')](_0x33fac4);})[_0xab81('0x1e')](function(_0x4b6023){_0x59ef9a[_0xab81('0x3b')]=_0x4b6023;return _0x59ef9a;})[_0xab81('0x1e')](respondWithFilteredResult(_0x355fe5,_0x33fac4))['catch'](handleError(_0x355fe5,null));};exports[_0xab81('0x3c')]=function(_0xb86058,_0x18aae1){var _0x17afb2={'raw':!![],'where':{'id':_0xb86058[_0xab81('0x3d')]['id']}},_0x2eada4={};_0x2eada4[_0xab81('0x29')]=_[_0xab81('0x2a')](db[_0xab81('0x24')][_0xab81('0x25')]);_0x2eada4[_0xab81('0x2b')]=_[_0xab81('0x2a')](_0xb86058['query']);_0x2eada4[_0xab81('0x2c')]=_['intersection'](_0x2eada4['model'],_0x2eada4[_0xab81('0x2b')]);_0x17afb2[_0xab81('0x2e')]=_['intersection'](_0x2eada4['model'],qs['fields'](_0xb86058[_0xab81('0x2b')]['fields']));_0x17afb2[_0xab81('0x2e')]=_0x17afb2[_0xab81('0x2e')][_0xab81('0x3e')]?_0x17afb2['attributes']:_0x2eada4[_0xab81('0x29')];if(_0xb86058[_0xab81('0x2b')][_0xab81('0x39')]){_0x17afb2[_0xab81('0x3f')]=[{'all':!![]}];}_0x17afb2=_[_0xab81('0x36')]({},_0x17afb2,_0xb86058[_0xab81('0x38')]);return db['SalesforceField']['find'](_0x17afb2)['then'](handleEntityNotFound(_0x18aae1,null))['then'](respondWithResult(_0x18aae1,null))[_0xab81('0x40')](handleError(_0x18aae1,null));};exports[_0xab81('0x41')]=function(_0xe2ee05,_0x4b7029){return db['SalesforceField'][_0xab81('0x41')](_0xe2ee05[_0xab81('0x42')],{})[_0xab81('0x1e')](respondWithResult(_0x4b7029,0xc9))['catch'](handleError(_0x4b7029,null));};exports['update']=function(_0x1661b6,_0x3f2b28){if(_0x1661b6['body']['id']){delete _0x1661b6[_0xab81('0x42')]['id'];}return db[_0xab81('0x24')][_0xab81('0x43')]({'where':{'id':_0x1661b6[_0xab81('0x3d')]['id']}})[_0xab81('0x1e')](handleEntityNotFound(_0x3f2b28,null))[_0xab81('0x1e')](saveUpdates(_0x1661b6[_0xab81('0x42')],null))[_0xab81('0x1e')](respondWithResult(_0x3f2b28,null))[_0xab81('0x40')](handleError(_0x3f2b28,null));};exports[_0xab81('0x44')]=function(_0x247458,_0x1f72ad){return db['SalesforceField'][_0xab81('0x43')]({'where':{'id':_0x247458[_0xab81('0x3d')]['id']}})[_0xab81('0x1e')](handleEntityNotFound(_0x1f72ad,null))['then'](removeEntity(_0x1f72ad,null))[_0xab81('0x40')](handleError(_0x1f72ad,null));}; \ No newline at end of file +var _0xf30a=['filter','merge','VIRTUAL','options','where','include','findAll','rows','catch','show','keys','length','includeAll','create','body','find','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','nolimit','sort','pick'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf30a,0x1e6));var _0xaf30=function(_0x170e64,_0x22ef6d){_0x170e64=_0x170e64-0x0;var _0x5cfd65=_0xf30a[_0x170e64];return _0x5cfd65;};'use strict';var emlformat=require(_0xaf30('0x0'));var rimraf=require(_0xaf30('0x1'));var zipdir=require(_0xaf30('0x2'));var jsonpatch=require(_0xaf30('0x3'));var rp=require(_0xaf30('0x4'));var moment=require('moment');var BPromise=require(_0xaf30('0x5'));var Mustache=require(_0xaf30('0x6'));var util=require('util');var path=require(_0xaf30('0x7'));var sox=require(_0xaf30('0x8'));var csv=require(_0xaf30('0x9'));var ejs=require(_0xaf30('0xa'));var fs=require('fs');var fs_extra=require(_0xaf30('0xb'));var _=require(_0xaf30('0xc'));var squel=require(_0xaf30('0xd'));var crypto=require(_0xaf30('0xe'));var jsforce=require(_0xaf30('0xf'));var deskjs=require(_0xaf30('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xaf30('0x11'));var Redis=require(_0xaf30('0x12'));var authService=require(_0xaf30('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xaf30('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf30('0x15'))(_0xaf30('0x16'));var utils=require(_0xaf30('0x17'));var config=require(_0xaf30('0x18'));var licenseUtil=require(_0xaf30('0x19'));var db=require(_0xaf30('0x1a'))['db'];function respondWithStatusCode(_0x2d3f45,_0x1aa127){_0x1aa127=_0x1aa127||0xcc;return function(_0x689822){if(_0x689822){return _0x2d3f45[_0xaf30('0x1b')](_0x1aa127);}return _0x2d3f45[_0xaf30('0x1c')](_0x1aa127)[_0xaf30('0x1d')]();};}function respondWithResult(_0x3b6634,_0x3bb649){_0x3bb649=_0x3bb649||0xc8;return function(_0x3c5d2e){if(_0x3c5d2e){return _0x3b6634['status'](_0x3bb649)[_0xaf30('0x1e')](_0x3c5d2e);}};}function respondWithFilteredResult(_0x30cedb,_0x141ce7){return function(_0x1c8ca0){if(_0x1c8ca0){var _0x544f85=typeof _0x141ce7[_0xaf30('0x1f')]===_0xaf30('0x20')&&typeof _0x141ce7[_0xaf30('0x21')]===_0xaf30('0x20');var _0x407f12=_0x1c8ca0[_0xaf30('0x22')];var _0x35d5a1=_0x544f85?0x0:_0x141ce7['offset'];var _0x3bcc4f=_0x544f85?_0x1c8ca0[_0xaf30('0x22')]:_0x141ce7['offset']+_0x141ce7[_0xaf30('0x21')];var _0x3382c5;if(_0x3bcc4f>=_0x407f12){_0x3bcc4f=_0x407f12;_0x3382c5=0xc8;}else{_0x3382c5=0xce;}_0x30cedb[_0xaf30('0x1c')](_0x3382c5);return _0x30cedb[_0xaf30('0x23')]('Content-Range',_0x35d5a1+'-'+_0x3bcc4f+'/'+_0x407f12)['json'](_0x1c8ca0);}return null;};}function patchUpdates(_0xfd6f2e){return function(_0x544983){try{jsonpatch['apply'](_0x544983,_0xfd6f2e,!![]);}catch(_0x4d8570){return BPromise[_0xaf30('0x24')](_0x4d8570);}return _0x544983[_0xaf30('0x25')]();};}function saveUpdates(_0x49027b,_0x436124){return function(_0x2a6236){if(_0x2a6236){return _0x2a6236[_0xaf30('0x26')](_0x49027b)[_0xaf30('0x27')](function(_0x3ebb4a){return _0x3ebb4a;});}return null;};}function removeEntity(_0x344024,_0x10af3d){return function(_0x42e704){if(_0x42e704){return _0x42e704['destroy']()['then'](function(){_0x344024[_0xaf30('0x1c')](0xcc)[_0xaf30('0x1d')]();});}};}function handleEntityNotFound(_0x2fa479,_0x5a4f48){return function(_0x361508){if(!_0x361508){_0x2fa479[_0xaf30('0x1b')](0x194);}return _0x361508;};}function handleError(_0x2a289e,_0x335c77){_0x335c77=_0x335c77||0x1f4;return function(_0x3e3b74){logger[_0xaf30('0x28')](_0x3e3b74[_0xaf30('0x29')]);if(_0x3e3b74[_0xaf30('0x2a')]){delete _0x3e3b74[_0xaf30('0x2a')];}_0x2a289e[_0xaf30('0x1c')](_0x335c77)[_0xaf30('0x2b')](_0x3e3b74);};}exports[_0xaf30('0x2c')]=function(_0x35e7db,_0x285a2c){var _0x40f89e={},_0x12a635={},_0x520b8d={'count':0x0,'rows':[]};var _0xf48516=_[_0xaf30('0x2d')](db[_0xaf30('0x2e')][_0xaf30('0x2f')],function(_0x1f0085){return{'name':_0x1f0085[_0xaf30('0x30')],'type':_0x1f0085[_0xaf30('0x31')][_0xaf30('0x32')]};});_0x12a635['model']=_['map'](_0xf48516,'name');_0x12a635[_0xaf30('0x33')]=_['keys'](_0x35e7db[_0xaf30('0x33')]);_0x12a635[_0xaf30('0x34')]=_[_0xaf30('0x35')](_0x12a635[_0xaf30('0x36')],_0x12a635[_0xaf30('0x33')]);_0x40f89e[_0xaf30('0x37')]=_[_0xaf30('0x35')](_0x12a635['model'],qs['fields'](_0x35e7db[_0xaf30('0x33')][_0xaf30('0x38')]));_0x40f89e[_0xaf30('0x37')]=_0x40f89e[_0xaf30('0x37')]['length']?_0x40f89e[_0xaf30('0x37')]:_0x12a635['model'];if(!_0x35e7db[_0xaf30('0x33')]['hasOwnProperty'](_0xaf30('0x39'))){_0x40f89e[_0xaf30('0x21')]=qs[_0xaf30('0x21')](_0x35e7db['query'][_0xaf30('0x21')]);_0x40f89e['offset']=qs[_0xaf30('0x1f')](_0x35e7db[_0xaf30('0x33')][_0xaf30('0x1f')]);}_0x40f89e['order']=qs[_0xaf30('0x3a')](_0x35e7db[_0xaf30('0x33')]['sort']);_0x40f89e['where']=qs[_0xaf30('0x34')](_[_0xaf30('0x3b')](_0x35e7db[_0xaf30('0x33')],_0x12a635[_0xaf30('0x34')]),_0xf48516);if(_0x35e7db[_0xaf30('0x33')][_0xaf30('0x3c')]){_0x40f89e['where']=_[_0xaf30('0x3d')](_0x40f89e['where'],{'$or':_[_0xaf30('0x2d')](_0xf48516,function(_0x458692){if(_0x458692[_0xaf30('0x31')]!==_0xaf30('0x3e')){var _0x4699a1={};_0x4699a1[_0x458692['name']]={'$like':'%'+_0x35e7db['query'][_0xaf30('0x3c')]+'%'};return _0x4699a1;}})});}_0x40f89e=_[_0xaf30('0x3d')]({},_0x40f89e,_0x35e7db[_0xaf30('0x3f')]);var _0x399710={'where':_0x40f89e[_0xaf30('0x40')]};return db['SalesforceField'][_0xaf30('0x22')](_0x399710)[_0xaf30('0x27')](function(_0x101ae7){_0x520b8d[_0xaf30('0x22')]=_0x101ae7;if(_0x35e7db[_0xaf30('0x33')]['includeAll']){_0x40f89e[_0xaf30('0x41')]=[{'all':!![]}];}return db['SalesforceField'][_0xaf30('0x42')](_0x40f89e);})[_0xaf30('0x27')](function(_0x3547ca){_0x520b8d[_0xaf30('0x43')]=_0x3547ca;return _0x520b8d;})[_0xaf30('0x27')](respondWithFilteredResult(_0x285a2c,_0x40f89e))[_0xaf30('0x44')](handleError(_0x285a2c,null));};exports[_0xaf30('0x45')]=function(_0x3adc18,_0x2b1358){var _0x25fe39={'raw':!![],'where':{'id':_0x3adc18['params']['id']}},_0xf991b8={};_0xf991b8[_0xaf30('0x36')]=_[_0xaf30('0x46')](db['SalesforceField'][_0xaf30('0x2f')]);_0xf991b8[_0xaf30('0x33')]=_[_0xaf30('0x46')](_0x3adc18['query']);_0xf991b8['filters']=_[_0xaf30('0x35')](_0xf991b8[_0xaf30('0x36')],_0xf991b8[_0xaf30('0x33')]);_0x25fe39['attributes']=_[_0xaf30('0x35')](_0xf991b8[_0xaf30('0x36')],qs[_0xaf30('0x38')](_0x3adc18[_0xaf30('0x33')][_0xaf30('0x38')]));_0x25fe39[_0xaf30('0x37')]=_0x25fe39[_0xaf30('0x37')][_0xaf30('0x47')]?_0x25fe39[_0xaf30('0x37')]:_0xf991b8[_0xaf30('0x36')];if(_0x3adc18[_0xaf30('0x33')][_0xaf30('0x48')]){_0x25fe39['include']=[{'all':!![]}];}_0x25fe39=_[_0xaf30('0x3d')]({},_0x25fe39,_0x3adc18['options']);return db['SalesforceField']['find'](_0x25fe39)[_0xaf30('0x27')](handleEntityNotFound(_0x2b1358,null))[_0xaf30('0x27')](respondWithResult(_0x2b1358,null))[_0xaf30('0x44')](handleError(_0x2b1358,null));};exports[_0xaf30('0x49')]=function(_0x5f182a,_0x19c168){return db[_0xaf30('0x2e')][_0xaf30('0x49')](_0x5f182a['body'],{})[_0xaf30('0x27')](respondWithResult(_0x19c168,0xc9))[_0xaf30('0x44')](handleError(_0x19c168,null));};exports['update']=function(_0x315072,_0x5b76cd){if(_0x315072[_0xaf30('0x4a')]['id']){delete _0x315072['body']['id'];}return db['SalesforceField'][_0xaf30('0x4b')]({'where':{'id':_0x315072[_0xaf30('0x4c')]['id']}})[_0xaf30('0x27')](handleEntityNotFound(_0x5b76cd,null))[_0xaf30('0x27')](saveUpdates(_0x315072[_0xaf30('0x4a')],null))['then'](respondWithResult(_0x5b76cd,null))[_0xaf30('0x44')](handleError(_0x5b76cd,null));};exports[_0xaf30('0x4d')]=function(_0x17e76c,_0x2cbe79){return db[_0xaf30('0x2e')][_0xaf30('0x4b')]({'where':{'id':_0x17e76c[_0xaf30('0x4c')]['id']}})[_0xaf30('0x27')](handleEntityNotFound(_0x2cbe79,null))[_0xaf30('0x27')](removeEntity(_0x2cbe79,null))[_0xaf30('0x44')](handleError(_0x2cbe79,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 6d1af48..1ef76da 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 _0xb0cd=['FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField'];(function(_0x26e771,_0x382d34){var _0x25770f=function(_0x3e1844){while(--_0x3e1844){_0x26e771['push'](_0x26e771['shift']());}};_0x25770f(++_0x382d34);}(_0xb0cd,0xb5));var _0xdb0c=function(_0x511a6e,_0x37585c){_0x511a6e=_0x511a6e-0x0;var _0x2e1152=_0xb0cd[_0x511a6e];return _0x2e1152;};'use strict';var _=require(_0xdb0c('0x0'));var util=require('util');var logger=require(_0xdb0c('0x1'))(_0xdb0c('0x2'));var moment=require(_0xdb0c('0x3'));var BPromise=require(_0xdb0c('0x4'));var rp=require(_0xdb0c('0x5'));var fs=require('fs');var path=require(_0xdb0c('0x6'));var rimraf=require(_0xdb0c('0x7'));var config=require(_0xdb0c('0x8'));var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x48e876,_0x227603){return _0x48e876[_0xdb0c('0x9')](_0xdb0c('0xa'),attributes,{'tableName':_0xdb0c('0xb'),'paranoid':![],'indexes':[{'name':_0xdb0c('0xc'),'fields':[_0xdb0c('0xd'),_0xdb0c('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x72b4=['idField','lodash','util','../../config/logger','bluebird','path','rimraf','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x72b4,0x151));var _0x472b=function(_0x39ff5c,_0x3de001){_0x39ff5c=_0x39ff5c-0x0;var _0x1eba54=_0x72b4[_0x39ff5c];return _0x1eba54;};'use strict';var _=require(_0x472b('0x0'));var util=require(_0x472b('0x1'));var logger=require(_0x472b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x472b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x472b('0x4'));var rimraf=require(_0x472b('0x5'));var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0x472b('0x6')]=function(_0x2c5337,_0x445fbd){return _0x2c5337[_0x472b('0x7')](_0x472b('0x8'),attributes,{'tableName':_0x472b('0x9'),'paranoid':![],'indexes':[{'name':_0x472b('0xa'),'fields':[_0x472b('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index eab97ba..23967e3 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 _0xed1c=['jayson/promise','http','request','then','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xed1c,0xbd));var _0xced1=function(_0x129bdd,_0x1dafc9){_0x129bdd=_0x129bdd-0x0;var _0x9535a6=_0xed1c[_0x129bdd];return _0x9535a6;};'use strict';var _=require('lodash');var util=require(_0xced1('0x0'));var moment=require(_0xced1('0x1'));var BPromise=require(_0xced1('0x2'));var rs=require(_0xced1('0x3'));var fs=require('fs');var Redis=require(_0xced1('0x4'));var db=require(_0xced1('0x5'))['db'];var utils=require(_0xced1('0x6'));var logger=require(_0xced1('0x7'))(_0xced1('0x8'));var config=require('../../config/environment');var jayson=require(_0xced1('0x9'));var client=jayson['client'][_0xced1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd9a30a,_0x5c9c80,_0x1b9c29){return new BPromise(function(_0x40ce06,_0x1b2084){return client[_0xced1('0xb')](_0xd9a30a,_0x1b9c29)[_0xced1('0xc')](function(_0x4c3a80){logger['info']('SalesforceField,\x20%s,\x20%s',_0x5c9c80,_0xced1('0xd'));logger[_0xced1('0xe')](_0xced1('0xf'),_0x5c9c80,'request\x20sent',JSON[_0xced1('0x10')](_0x4c3a80));if(_0x4c3a80[_0xced1('0x11')]){if(_0x4c3a80[_0xced1('0x11')][_0xced1('0x12')]===0x1f4){logger['error'](_0xced1('0x13'),_0x5c9c80,_0x4c3a80[_0xced1('0x11')][_0xced1('0x14')]);return _0x1b2084(_0x4c3a80[_0xced1('0x11')][_0xced1('0x14')]);}logger[_0xced1('0x11')]('SalesforceField,\x20%s,\x20%s',_0x5c9c80,_0x4c3a80[_0xced1('0x11')][_0xced1('0x14')]);return _0x40ce06(_0x4c3a80[_0xced1('0x11')][_0xced1('0x14')]);}else{logger['info'](_0xced1('0x13'),_0x5c9c80,_0xced1('0xd'));_0x40ce06(_0x4c3a80['result'][_0xced1('0x14')]);}})[_0xced1('0x15')](function(_0x487a0a){logger[_0xced1('0x11')]('SalesforceField,\x20%s,\x20%s',_0x5c9c80,_0x487a0a);_0x1b2084(_0x487a0a);});});} \ No newline at end of file +var _0xfc4e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','moment'];(function(_0x7538c5,_0xa5d8ac){var _0x8b56be=function(_0x2036c0){while(--_0x2036c0){_0x7538c5['push'](_0x7538c5['shift']());}};_0x8b56be(++_0xa5d8ac);}(_0xfc4e,0xd6));var _0xefc4=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0xfc4e[_0x1b4b23];return _0x2a325b;};'use strict';var _=require(_0xefc4('0x0'));var util=require('util');var moment=require(_0xefc4('0x1'));var BPromise=require(_0xefc4('0x2'));var rs=require(_0xefc4('0x3'));var fs=require('fs');var Redis=require(_0xefc4('0x4'));var db=require(_0xefc4('0x5'))['db'];var utils=require(_0xefc4('0x6'));var logger=require(_0xefc4('0x7'))(_0xefc4('0x8'));var config=require(_0xefc4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xefc4('0xa')][_0xefc4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b285,_0x33953c,_0x2f0661){return new BPromise(function(_0x9f0a25,_0x4017d6){return client[_0xefc4('0xc')](_0x2b285,_0x2f0661)['then'](function(_0x1d0151){logger[_0xefc4('0xd')]('SalesforceField,\x20%s,\x20%s',_0x33953c,_0xefc4('0xe'));logger[_0xefc4('0xf')](_0xefc4('0x10'),_0x33953c,_0xefc4('0xe'),JSON[_0xefc4('0x11')](_0x1d0151));if(_0x1d0151[_0xefc4('0x12')]){if(_0x1d0151[_0xefc4('0x12')][_0xefc4('0x13')]===0x1f4){logger[_0xefc4('0x12')](_0xefc4('0x14'),_0x33953c,_0x1d0151['error'][_0xefc4('0x15')]);return _0x4017d6(_0x1d0151[_0xefc4('0x12')][_0xefc4('0x15')]);}logger[_0xefc4('0x12')]('SalesforceField,\x20%s,\x20%s',_0x33953c,_0x1d0151[_0xefc4('0x12')][_0xefc4('0x15')]);return _0x9f0a25(_0x1d0151[_0xefc4('0x12')][_0xefc4('0x15')]);}else{logger[_0xefc4('0xd')]('SalesforceField,\x20%s,\x20%s',_0x33953c,'request\x20sent');_0x9f0a25(_0x1d0151[_0xefc4('0x16')][_0xefc4('0x15')]);}})[_0xefc4('0x17')](function(_0x5138aa){logger[_0xefc4('0x12')](_0xefc4('0x14'),_0x33953c,_0x5138aa);_0x4017d6(_0x5138aa);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 2a25c8a..7a45144 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 _0x38f5=['show','getConfigurations','getFields','post','/:id/configurations','addConfiguration','/:id','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','./intServicenowAccount.controller','get','isAuthenticated','index'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0x38f5,0x89));var _0x538f=function(_0x35f87a,_0x5cf4a2){_0x35f87a=_0x35f87a-0x0;var _0x5683ce=_0x38f5[_0x35f87a];return _0x5683ce;};'use strict';var multer=require('multer');var util=require(_0x538f('0x0'));var path=require(_0x538f('0x1'));var timeout=require('connect-timeout');var express=require(_0x538f('0x2'));var router=express[_0x538f('0x3')]();var fs_extra=require(_0x538f('0x4'));var auth=require(_0x538f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x538f('0x6'));router[_0x538f('0x7')]('/',auth[_0x538f('0x8')](),controller[_0x538f('0x9')]);router[_0x538f('0x7')]('/:id',auth[_0x538f('0x8')](),controller[_0x538f('0xa')]);router['get']('/:id/configurations',auth[_0x538f('0x8')](),controller[_0x538f('0xb')]);router['get']('/:id/fields',auth[_0x538f('0x8')](),controller[_0x538f('0xc')]);router[_0x538f('0xd')]('/',auth[_0x538f('0x8')](),controller['create']);router[_0x538f('0xd')](_0x538f('0xe'),auth[_0x538f('0x8')](),controller[_0x538f('0xf')]);router['put'](_0x538f('0x10'),auth[_0x538f('0x8')](),controller[_0x538f('0x11')]);router[_0x538f('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x538f('0x13')]);module[_0x538f('0x14')]=router; \ No newline at end of file +var _0x9224=['fs-extra','./intServicenowAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router'];(function(_0x279a7a,_0x2a50ce){var _0x2005d9=function(_0x23f397){while(--_0x23f397){_0x279a7a['push'](_0x279a7a['shift']());}};_0x2005d9(++_0x2a50ce);}(_0x9224,0xa3));var _0x4922=function(_0x479880,_0x10d756){_0x479880=_0x479880-0x0;var _0x3602f0=_0x9224[_0x479880];return _0x3602f0;};'use strict';var multer=require('multer');var util=require(_0x4922('0x0'));var path=require(_0x4922('0x1'));var timeout=require(_0x4922('0x2'));var express=require(_0x4922('0x3'));var router=express[_0x4922('0x4')]();var fs_extra=require(_0x4922('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4922('0x6'));router['get']('/',auth[_0x4922('0x7')](),controller[_0x4922('0x8')]);router[_0x4922('0x9')](_0x4922('0xa'),auth[_0x4922('0x7')](),controller[_0x4922('0xb')]);router['get'](_0x4922('0xc'),auth[_0x4922('0x7')](),controller['getConfigurations']);router[_0x4922('0x9')](_0x4922('0xd'),auth[_0x4922('0x7')](),controller[_0x4922('0xe')]);router[_0x4922('0xf')]('/',auth[_0x4922('0x7')](),controller[_0x4922('0x10')]);router[_0x4922('0xf')]('/:id/configurations',auth[_0x4922('0x7')](),controller['addConfiguration']);router[_0x4922('0x11')](_0x4922('0xa'),auth[_0x4922('0x7')](),controller[_0x4922('0x12')]);router[_0x4922('0x13')]('/:id',auth[_0x4922('0x7')](),controller[_0x4922('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index ac0e162..b6cc2b4 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 _0x8192=['sequelize','STRING','remoteUri'];(function(_0x2aeca6,_0x4333e7){var _0x17e775=function(_0x3fcc27){while(--_0x3fcc27){_0x2aeca6['push'](_0x2aeca6['shift']());}};_0x17e775(++_0x4333e7);}(_0x8192,0x102));var _0x2819=function(_0x5631be,_0x10c624){_0x5631be=_0x5631be-0x0;var _0x5f4155=_0x8192[_0x5631be];return _0x5f4155;};'use strict';var Sequelize=require(_0x2819('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2819('0x1')]},'username':{'type':Sequelize[_0x2819('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x2819('0x1')]},'email':{'type':Sequelize[_0x2819('0x1')]},'remoteUri':{'type':Sequelize[_0x2819('0x1')],'unique':_0x2819('0x2')},'serverUrl':{'type':Sequelize[_0x2819('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x6f93=['STRING','remoteUri','sequelize','exports'];(function(_0x2d1792,_0x63b86c){var _0xa997b1=function(_0xab5bfc){while(--_0xab5bfc){_0x2d1792['push'](_0x2d1792['shift']());}};_0xa997b1(++_0x63b86c);}(_0x6f93,0xfe));var _0x36f9=function(_0x540ecb,_0x20bc63){_0x540ecb=_0x540ecb-0x0;var _0x1f9f06=_0x6f93[_0x540ecb];return _0x1f9f06;};'use strict';var Sequelize=require(_0x36f9('0x0'));module[_0x36f9('0x1')]={'name':{'type':Sequelize[_0x36f9('0x2')]},'description':{'type':Sequelize[_0x36f9('0x2')]},'username':{'type':Sequelize[_0x36f9('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x36f9('0x2')]},'remoteUri':{'type':Sequelize[_0x36f9('0x2')],'unique':_0x36f9('0x3')},'serverUrl':{'type':Sequelize[_0x36f9('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 0f17028..74a23b6 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 _0x0733=['assigned_to','severity','comments','sla_due','approval','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','location','category','username','remoteUri','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','password','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','test','stack','Wrong\x20credentials','statusCode','boolean','False','GET','inactive','false','value','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','index','map','ServicenowAccount','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','Subjects','made_sla','hold_reason','knowledge','close_code','notify','incident_state','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','number','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','active','work_notes_list','priority','sys_domain_path','rfc','time_worked','business_duration','group_list','resolved_at','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task','assignment_group','business_stc','additional_assignee_list','calendar_duration','sys_class_name','follow_up','contact_type','urgency','company','reassignment_count','activity_due'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x0733,0xe6));var _0x3073=function(_0x3be357,_0x669ae7){_0x3be357=_0x3be357-0x0;var _0x2710f4=_0x0733[_0x3be357];return _0x2710f4;};'use strict';var emlformat=require(_0x3073('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3073('0x1'));var jsonpatch=require(_0x3073('0x2'));var rp=require(_0x3073('0x3'));var moment=require('moment');var BPromise=require(_0x3073('0x4'));var Mustache=require(_0x3073('0x5'));var util=require('util');var path=require(_0x3073('0x6'));var sox=require(_0x3073('0x7'));var csv=require('to-csv');var ejs=require(_0x3073('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3073('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3073('0xa'));var toCsv=require(_0x3073('0xb'));var querystring=require(_0x3073('0xc'));var Papa=require(_0x3073('0xd'));var Redis=require(_0x3073('0xe'));var authService=require(_0x3073('0xf'));var qs=require(_0x3073('0x10'));var as=require(_0x3073('0x11'));var hardwareService=require(_0x3073('0x12'));var logger=require('../../config/logger')(_0x3073('0x13'));var utils=require(_0x3073('0x14'));var config=require(_0x3073('0x15'));var licenseUtil=require(_0x3073('0x16'));var db=require(_0x3073('0x17'))['db'];var integrations=require(_0x3073('0x18'));function respondWithStatusCode(_0x2b874f,_0x126159){_0x126159=_0x126159||0xcc;return function(_0x1ce1d4){if(_0x1ce1d4){return _0x2b874f['sendStatus'](_0x126159);}return _0x2b874f[_0x3073('0x19')](_0x126159)[_0x3073('0x1a')]();};}function respondWithResult(_0x759936,_0x1cd7a8){_0x1cd7a8=_0x1cd7a8||0xc8;return function(_0x53e65e){if(_0x53e65e){return _0x759936['status'](_0x1cd7a8)[_0x3073('0x1b')](_0x53e65e);}};}function respondWithFilteredResult(_0x14ee82,_0x2b47d4){return function(_0x179968){if(_0x179968){var _0x4642a3=typeof _0x2b47d4['offset']==='undefined'&&typeof _0x2b47d4[_0x3073('0x1c')]===_0x3073('0x1d');var _0x481502=_0x179968['count'];var _0x4f3b55=_0x4642a3?0x0:_0x2b47d4[_0x3073('0x1e')];var _0x5b3f8d=_0x4642a3?_0x179968[_0x3073('0x1f')]:_0x2b47d4[_0x3073('0x1e')]+_0x2b47d4['limit'];var _0x18b3ca;if(_0x5b3f8d>=_0x481502){_0x5b3f8d=_0x481502;_0x18b3ca=0xc8;}else{_0x18b3ca=0xce;}_0x14ee82[_0x3073('0x19')](_0x18b3ca);return _0x14ee82[_0x3073('0x20')](_0x3073('0x21'),_0x4f3b55+'-'+_0x5b3f8d+'/'+_0x481502)['json'](_0x179968);}return null;};}function patchUpdates(_0x5d6c39){return function(_0x26bc93){try{jsonpatch[_0x3073('0x22')](_0x26bc93,_0x5d6c39,!![]);}catch(_0x513c08){return BPromise[_0x3073('0x23')](_0x513c08);}return _0x26bc93[_0x3073('0x24')]();};}function saveUpdates(_0x267b12,_0xab9093){return function(_0x558eb6){if(_0x558eb6){return _0x558eb6[_0x3073('0x25')](_0x267b12)[_0x3073('0x26')](function(_0x233052){return _0x233052;});}return null;};}function removeEntity(_0x489886,_0x5340fc){return function(_0x386add){if(_0x386add){return _0x386add['destroy']()[_0x3073('0x26')](function(){_0x489886['status'](0xcc)[_0x3073('0x1a')]();});}};}function handleEntityNotFound(_0x5239f2,_0x2c64c0){return function(_0x1af359){if(!_0x1af359){_0x5239f2[_0x3073('0x27')](0x194);}return _0x1af359;};}function handleError(_0x25f21a,_0x1424c1){_0x1424c1=_0x1424c1||0x1f4;return function(_0x7bc53d){logger[_0x3073('0x28')](_0x7bc53d['stack']);if(_0x7bc53d[_0x3073('0x29')]){delete _0x7bc53d['name'];}_0x25f21a[_0x3073('0x19')](_0x1424c1)[_0x3073('0x2a')](_0x7bc53d);};}exports[_0x3073('0x2b')]=function(_0x3dd7ff,_0x20bdc0){var _0x12054c={},_0x553e03={},_0xbf77d={'count':0x0,'rows':[]};var _0x5a1fd1=_[_0x3073('0x2c')](db[_0x3073('0x2d')]['rawAttributes'],function(_0x1bc312){return{'name':_0x1bc312['fieldName'],'type':_0x1bc312[_0x3073('0x2e')][_0x3073('0x2f')]};});_0x553e03[_0x3073('0x30')]=_['map'](_0x5a1fd1,'name');_0x553e03[_0x3073('0x31')]=_[_0x3073('0x32')](_0x3dd7ff[_0x3073('0x31')]);_0x553e03['filters']=_[_0x3073('0x33')](_0x553e03['model'],_0x553e03[_0x3073('0x31')]);_0x12054c['attributes']=_[_0x3073('0x33')](_0x553e03[_0x3073('0x30')],qs[_0x3073('0x34')](_0x3dd7ff[_0x3073('0x31')]['fields']));_0x12054c['attributes']=_0x12054c[_0x3073('0x35')][_0x3073('0x36')]?_0x12054c['attributes']:_0x553e03[_0x3073('0x30')];if(!_0x3dd7ff[_0x3073('0x31')][_0x3073('0x37')](_0x3073('0x38'))){_0x12054c[_0x3073('0x1c')]=qs['limit'](_0x3dd7ff[_0x3073('0x31')][_0x3073('0x1c')]);_0x12054c[_0x3073('0x1e')]=qs[_0x3073('0x1e')](_0x3dd7ff[_0x3073('0x31')][_0x3073('0x1e')]);}_0x12054c[_0x3073('0x39')]=qs[_0x3073('0x3a')](_0x3dd7ff[_0x3073('0x31')][_0x3073('0x3a')]);_0x12054c[_0x3073('0x3b')]=qs[_0x3073('0x3c')](_[_0x3073('0x3d')](_0x3dd7ff[_0x3073('0x31')],_0x553e03[_0x3073('0x3c')]),_0x5a1fd1);if(_0x3dd7ff[_0x3073('0x31')]['filter']){_0x12054c['where']=_[_0x3073('0x3e')](_0x12054c[_0x3073('0x3b')],{'$or':_[_0x3073('0x2c')](_0x5a1fd1,function(_0x150e32){if(_0x150e32[_0x3073('0x2e')]!==_0x3073('0x3f')){var _0x30ebef={};_0x30ebef[_0x150e32[_0x3073('0x29')]]={'$like':'%'+_0x3dd7ff['query'][_0x3073('0x40')]+'%'};return _0x30ebef;}})});}_0x12054c=_[_0x3073('0x3e')]({},_0x12054c,_0x3dd7ff[_0x3073('0x41')]);var _0x38fc07={'where':_0x12054c[_0x3073('0x3b')]};return db[_0x3073('0x2d')]['count'](_0x38fc07)[_0x3073('0x26')](function(_0x43cd2e){_0xbf77d[_0x3073('0x1f')]=_0x43cd2e;if(_0x3dd7ff['query'][_0x3073('0x42')]){_0x12054c[_0x3073('0x43')]=[{'all':!![]}];}return db[_0x3073('0x2d')][_0x3073('0x44')](_0x12054c);})['then'](function(_0x25b38f){_0xbf77d[_0x3073('0x45')]=_0x25b38f;return _0xbf77d;})[_0x3073('0x26')](respondWithFilteredResult(_0x20bdc0,_0x12054c))[_0x3073('0x46')](handleError(_0x20bdc0,null));};exports[_0x3073('0x47')]=function(_0x4025f5,_0x35fe7e){var _0x334db9={'raw':![],'where':{'id':_0x4025f5[_0x3073('0x48')]['id']}},_0x1bba28={};_0x1bba28[_0x3073('0x30')]=_[_0x3073('0x32')](db[_0x3073('0x2d')][_0x3073('0x49')]);_0x1bba28[_0x3073('0x31')]=_[_0x3073('0x32')](_0x4025f5['query']);_0x1bba28[_0x3073('0x3c')]=_['intersection'](_0x1bba28[_0x3073('0x30')],_0x1bba28['query']);_0x334db9['attributes']=_['intersection'](_0x1bba28[_0x3073('0x30')],qs[_0x3073('0x34')](_0x4025f5[_0x3073('0x31')][_0x3073('0x34')]));_0x334db9['attributes']=_0x334db9[_0x3073('0x35')]['length']?_0x334db9[_0x3073('0x35')]:_0x1bba28[_0x3073('0x30')];if(_0x4025f5[_0x3073('0x31')][_0x3073('0x42')]){_0x334db9[_0x3073('0x43')]=[{'all':!![]}];}_0x334db9=_[_0x3073('0x3e')]({},_0x334db9,_0x4025f5[_0x3073('0x41')]);return db[_0x3073('0x2d')][_0x3073('0x4a')](_0x334db9)['then'](handleEntityNotFound(_0x35fe7e,null))[_0x3073('0x26')](respondWithResult(_0x35fe7e,null))[_0x3073('0x46')](handleError(_0x35fe7e,null));};exports[_0x3073('0x4b')]=function(_0x5adc00,_0x2d2190){return db['ServicenowAccount']['create'](_0x5adc00[_0x3073('0x4c')],{})[_0x3073('0x26')](respondWithResult(_0x2d2190,0xc9))[_0x3073('0x46')](handleError(_0x2d2190,null));};exports['update']=function(_0x316a6b,_0x12cfb2){if(_0x316a6b[_0x3073('0x4c')]['id']){delete _0x316a6b[_0x3073('0x4c')]['id'];}return db['ServicenowAccount'][_0x3073('0x4a')]({'where':{'id':_0x316a6b['params']['id']}})[_0x3073('0x26')](handleEntityNotFound(_0x12cfb2,null))['then'](saveUpdates(_0x316a6b['body'],null))[_0x3073('0x26')](respondWithResult(_0x12cfb2,null))[_0x3073('0x46')](handleError(_0x12cfb2,null));};exports[_0x3073('0x4d')]=function(_0x15c368,_0x229c89){return db[_0x3073('0x2d')][_0x3073('0x4a')]({'where':{'id':_0x15c368[_0x3073('0x48')]['id']}})[_0x3073('0x26')](handleEntityNotFound(_0x229c89,null))[_0x3073('0x26')](removeEntity(_0x229c89,null))['catch'](handleError(_0x229c89,null));};exports[_0x3073('0x4e')]=function(_0xca02db,_0x282fec,_0x2d3769){var _0x4cbdb9={};var _0x2fa234={};var _0x1f8ad2;var _0xa85dca;return db[_0x3073('0x2d')][_0x3073('0x4f')]({'where':{'id':_0xca02db['params']['id']}})[_0x3073('0x26')](handleEntityNotFound(_0x282fec,null))['then'](function(_0x14fae9){if(_0x14fae9){_0x1f8ad2=_0x14fae9;_0x2fa234['model']=_[_0x3073('0x32')](db[_0x3073('0x50')]['rawAttributes']);_0x2fa234[_0x3073('0x31')]=_[_0x3073('0x32')](_0xca02db['query']);_0x2fa234[_0x3073('0x3c')]=_['intersection'](_0x2fa234[_0x3073('0x30')],_0x2fa234[_0x3073('0x31')]);_0x4cbdb9[_0x3073('0x35')]=_[_0x3073('0x33')](_0x2fa234[_0x3073('0x30')],qs[_0x3073('0x34')](_0xca02db[_0x3073('0x31')][_0x3073('0x34')]));_0x4cbdb9[_0x3073('0x35')]=_0x4cbdb9[_0x3073('0x35')][_0x3073('0x36')]?_0x4cbdb9[_0x3073('0x35')]:_0x2fa234['model'];_0x4cbdb9[_0x3073('0x39')]=qs[_0x3073('0x3a')](_0xca02db['query'][_0x3073('0x3a')]);_0x4cbdb9[_0x3073('0x3b')]=qs[_0x3073('0x3c')](_[_0x3073('0x3d')](_0xca02db[_0x3073('0x31')],_0x2fa234[_0x3073('0x3c')]));if(_0xca02db[_0x3073('0x31')][_0x3073('0x40')]){_0x4cbdb9[_0x3073('0x3b')]=_[_0x3073('0x3e')](_0x4cbdb9[_0x3073('0x3b')],{'$or':_[_0x3073('0x2c')](_0x4cbdb9['attributes'],function(_0x446c1d){var _0x4865e9={};_0x4865e9[_0x446c1d]={'$like':'%'+_0xca02db[_0x3073('0x31')][_0x3073('0x40')]+'%'};return _0x4865e9;})});}_0x4cbdb9=_[_0x3073('0x3e')]({},_0x4cbdb9,_0xca02db[_0x3073('0x41')]);return _0x1f8ad2[_0x3073('0x4e')](_0x4cbdb9);}})[_0x3073('0x26')](function(_0xb43b7f){if(_0xb43b7f){_0xa85dca=_0xb43b7f['length'];if(!_0xca02db[_0x3073('0x31')][_0x3073('0x37')]('nolimit')){_0x4cbdb9['limit']=qs[_0x3073('0x1c')](_0xca02db[_0x3073('0x31')]['limit']);_0x4cbdb9[_0x3073('0x1e')]=qs[_0x3073('0x1e')](_0xca02db[_0x3073('0x31')]['offset']);}return _0x1f8ad2[_0x3073('0x4e')](_0x4cbdb9);}})[_0x3073('0x26')](function(_0x20940c){if(_0x20940c){return _0x20940c?{'count':_0xa85dca,'rows':_0x20940c}:null;}})['then'](respondWithResult(_0x282fec,null))[_0x3073('0x46')](handleError(_0x282fec,null));};exports[_0x3073('0x51')]=function(_0x111b17,_0x5bb4a9,_0x3a8379){if(_0x111b17[_0x3073('0x4c')]['id']){delete _0x111b17[_0x3073('0x4c')]['id'];}return db[_0x3073('0x2d')][_0x3073('0x4f')]({'where':{'id':_0x111b17['params']['id']}})['then'](handleEntityNotFound(_0x5bb4a9,null))[_0x3073('0x26')](function(_0x142df0){if(_0x142df0){_0x111b17[_0x3073('0x4c')][_0x3073('0x52')]=_0x142df0['id'];_0x111b17[_0x3073('0x4c')]['Subjects']=integrations[_0x3073('0x53')](_0x111b17[_0x3073('0x4c')][_0x3073('0x54')],_0x111b17[_0x3073('0x4c')][_0x3073('0x2e')]);_0x111b17[_0x3073('0x4c')][_0x3073('0x55')]=integrations[_0x3073('0x56')](_0x111b17[_0x3073('0x4c')][_0x3073('0x54')],_0x111b17[_0x3073('0x4c')][_0x3073('0x2e')]);return db[_0x3073('0x50')]['create'](_0x111b17[_0x3073('0x4c')],{'include':[{'model':db[_0x3073('0x57')],'as':_0x3073('0x58')},{'model':db['ServicenowField'],'as':_0x3073('0x55')}]});}return null;})[_0x3073('0x26')](respondWithResult(_0x5bb4a9,null))[_0x3073('0x46')](handleError(_0x5bb4a9,null));};exports['getFields']=function(_0x2d632e,_0x20ccf1,_0x5ec34b){var _0x50b34a=[_0x3073('0x59'),_0x3073('0x5a'),_0x3073('0x5b'),'subcategory',_0x3073('0x5c'),_0x3073('0x5d'),_0x3073('0x5e'),'severity','category'];var _0x1f73db=[_0x3073('0x5f'),_0x3073('0x59'),_0x3073('0x60'),_0x3073('0x61'),_0x3073('0x62'),_0x3073('0x63'),_0x3073('0x64'),_0x3073('0x5a'),'approval_history',_0x3073('0x65'),'resolved_by','sys_updated_by',_0x3073('0x66'),_0x3073('0x67'),_0x3073('0x68'),_0x3073('0x69'),_0x3073('0x6a'),_0x3073('0x6b'),_0x3073('0x5b'),_0x3073('0x39'),_0x3073('0x6c'),_0x3073('0x6d'),'cmdb_ci','delivery_plan','impact',_0x3073('0x6e'),_0x3073('0x6f'),'business_service',_0x3073('0x70'),_0x3073('0x71'),_0x3073('0x72'),_0x3073('0x73'),'expected_start','opened_at',_0x3073('0x74'),_0x3073('0x75'),'work_end','reopened_time',_0x3073('0x76'),'caller_id',_0x3073('0x77'),_0x3073('0x78'),_0x3073('0x79'),_0x3073('0x7a'),_0x3073('0x5c'),_0x3073('0x7b'),_0x3073('0x7c'),'work_start',_0x3073('0x7d'),_0x3073('0x7e'),_0x3073('0x7f'),'description',_0x3073('0x80'),'notify',_0x3073('0x81'),'close_notes','closed_by',_0x3073('0x82'),'parent_incident','sys_id',_0x3073('0x83'),'reopened_by',_0x3073('0x5e'),_0x3073('0x84'),'problem_id',_0x3073('0x85'),_0x3073('0x86'),_0x3073('0x87'),_0x3073('0x88'),_0x3073('0x89'),_0x3073('0x8a'),_0x3073('0x8b'),_0x3073('0x8c'),_0x3073('0x8d'),'due_date',_0x3073('0x8e'),_0x3073('0x8f'),_0x3073('0x90'),_0x3073('0x91'),'upon_approval',_0x3073('0x92'),_0x3073('0x93'),_0x3073('0x94')];var _0x4b428e='';var _0x5b34d0='';var _0x2f5e66=[];var _0x44af19='';var _0x295171='';var _0x40a7f2=[];var _0x426071='';var _0x3db24d='';var _0x11bb30={};var _0x47bc83='';return db[_0x3073('0x2d')]['findOne']({'where':{'id':_0x2d632e[_0x3073('0x48')]['id']},'attributes':['id',_0x3073('0x95'),'password','email','remoteUri','serverUrl']})[_0x3073('0x26')](handleEntityNotFound(_0x20ccf1,null))[_0x3073('0x26')](function(_0x51893f){if(_0x51893f){_0x47bc83=_0x51893f[_0x3073('0x96')];var _0x249647=_0x47bc83[_0x3073('0x97')](-0x1);if(_0x249647==='/'){_0x47bc83=_0x47bc83[_0x3073('0x98')](0x0,_0x47bc83[_0x3073('0x99')](_0x249647));}_0x3db24d=util['format'](_0x3073('0x9a'),_0x47bc83);_0x426071=util[_0x3073('0x9b')](_0x3073('0x9c'),_0x47bc83);_0x11bb30={'user':_0x51893f[_0x3073('0x95')],'pass':_0x51893f[_0x3073('0x9d')]};var _0x55e579={'method':'GET','uri':_0x3db24d+_0x3073('0x9e'),'auth':_0x11bb30,'json':!![]};return rp(_0x55e579);}})[_0x3073('0x26')](function(_0x2b0756){if(_0x2b0756[_0x3073('0x9f')]['length']>0x0){_0x4b428e=_0x2b0756['result'];}console[_0x3073('0xa0')](_0x3073('0xa1'),_0x4b428e);_0x40a7f2=[];_0x5b34d0=Object[_0x3073('0xa2')]([],_0x4b428e);_[_0x3073('0xa3')](_0x5b34d0,function(_0x51cfbf){return!_0x50b34a[_0x3073('0xa4')](_0x51cfbf[_0x3073('0x29')]);});_0x5b34d0[_0x3073('0xa5')](function(_0x2bae49){var _0x1e7c84=createFieldObject(_0x426071,_0x11bb30,_0x2bae49[_0x3073('0xa6')],_0x2bae49['name'],_0x2bae49[_0x3073('0xa7')],![]);_0x40a7f2[_0x3073('0xa8')](_0x1e7c84);});return Promise[_0x3073('0xa9')](_0x40a7f2);})[_0x3073('0x26')](function(_0x243b90){_0x2f5e66=_0x243b90;_0x44af19=Object[_0x3073('0xa2')]([],_0x4b428e);console['log'](_0x3073('0xaa'),_0x4b428e);_[_0x3073('0xa3')](_0x44af19,function(_0x3a29ac){return _0x1f73db[_0x3073('0xa4')](_0x3a29ac['name']);});console['log'](_0x3073('0xab'),_0x44af19);_0x40a7f2=[];_0x44af19[_0x3073('0xa5')](function(_0x55c1a3){var _0x454fa7=createFieldObject(_0x426071,_0x11bb30,_0x55c1a3['internalType'],_0x55c1a3[_0x3073('0x29')],_0x55c1a3['label'],!![]);_0x40a7f2['push'](_0x454fa7);});return Promise[_0x3073('0xa9')](_0x40a7f2);})[_0x3073('0x26')](function(_0x59cd0e){_0x295171=_0x59cd0e;var _0x2c2a71=_0x2f5e66[_0x3073('0xac')](_0x295171);return{'count':_0x2c2a71['length'],'rows':_0x2c2a71};})[_0x3073('0x26')](respondWithResult(_0x20ccf1,null))[_0x3073('0x46')](function(_0x551145){console[_0x3073('0xa0')]('ServiceNow\x20error:\x20'+_0x551145);var _0x5725dd=_0x2d632e[_0x3073('0x31')][_0x3073('0xad')]?0x1f4:_0x551145['statusCode']||0x1f4;logger[_0x3073('0x28')](_0x551145[_0x3073('0xae')]);delete _0x551145[_0x3073('0x29')];if(_0x5725dd===0x191){_0x5725dd=0x190;}_0x20ccf1[_0x3073('0x19')](_0x5725dd)['send'](_0x2d632e[_0x3073('0x31')][_0x3073('0xad')]?{'message':_0x3073('0xaf'),'statusCode':_0x551145[_0x3073('0xb0')]}:_0x551145);});};function createFieldObject(_0x13d482,_0x3d548c,_0x346d94,_0xef2afe,_0x4ebe34,_0x34ca0e){return new Promise(function(_0x125e04,_0x2b2e84){var _0x1d1592={'id':_0xef2afe,'name':_0x4ebe34,'custom':_0x34ca0e};if(_0x346d94===_0x3073('0xb1')){_0x1d1592[_0x3073('0x41')]=[{'name':'True','value':'true'},{'name':_0x3073('0xb2'),'value':'false'}];_0x125e04(_0x1d1592);}else{var _0xc85088={'method':_0x3073('0xb3'),'uri':_0x13d482+'sys_choice?sysparm_query=name=incident^element='+_0xef2afe,'auth':_0x3d548c,'json':!![]};return rp(_0xc85088)[_0x3073('0x26')](function(_0xb07e8){var _0x26c991=[];if(_0xb07e8['result']['length']>0x0){_0xb07e8[_0x3073('0x9f')][_0x3073('0xa5')](function(_0x1f4ef7){if(_0x1f4ef7[_0x3073('0xb4')]===_0x3073('0xb5')){var _0x5c7eac={'name':_0x1f4ef7['label'],'value':_0x1f4ef7[_0x3073('0xb6')]};_0x26c991[_0x3073('0xa8')](_0x5c7eac);}});}_0x1d1592[_0x3073('0x41')]=_0x26c991;if(_0x1d1592[_0x3073('0x41')][_0x3073('0x36')]>0x0){_0x125e04(_0x1d1592);}else{if(_0x34ca0e==![]){_0x125e04();}else{_0x125e04(_0x1d1592);}}});}});} \ No newline at end of file +var _0x2263=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','update','then','destroy','stack','name','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','order','sort','filter','where','VIRTUAL','merge','options','includeAll','rows','catch','show','params','create','body','find','getConfigurations','findOne','ServicenowConfiguration','length','pick','hasOwnProperty','nolimit','addConfiguration','Descriptions','getDescriptions','channel','ServicenowField','Subjects','getFields','made_sla','hold_reason','knowledge','close_code','incident_state','severity','category','parent','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','delivery_plan','active','work_notes_list','business_service','expected_start','opened_at','business_duration','group_list','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','assignment_group','additional_assignee_list','calendar_duration','notify','close_notes','closed_by','sys_id','contact_type','reopened_by','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','label','push','all','TCL:\x20_object','forEach','concat','ServiceNow\x20error:\x20','test','statusCode','error','Wrong\x20credentials','boolean','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive'];(function(_0x4ed4d2,_0x47acf7){var _0x15ae2e=function(_0x3199f0){while(--_0x3199f0){_0x4ed4d2['push'](_0x4ed4d2['shift']());}};_0x15ae2e(++_0x47acf7);}(_0x2263,0xaf));var _0x3226=function(_0x3f6565,_0x12a8bb){_0x3f6565=_0x3f6565-0x0;var _0x4abd23=_0x2263[_0x3f6565];return _0x4abd23;};'use strict';var emlformat=require(_0x3226('0x0'));var rimraf=require(_0x3226('0x1'));var zipdir=require(_0x3226('0x2'));var jsonpatch=require(_0x3226('0x3'));var rp=require(_0x3226('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3226('0x5'));var util=require(_0x3226('0x6'));var path=require('path');var sox=require(_0x3226('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3226('0x8'));var _=require(_0x3226('0x9'));var squel=require('squel');var crypto=require(_0x3226('0xa'));var jsforce=require(_0x3226('0xb'));var deskjs=require(_0x3226('0xc'));var toCsv=require(_0x3226('0xd'));var querystring=require(_0x3226('0xe'));var Papa=require(_0x3226('0xf'));var Redis=require(_0x3226('0x10'));var authService=require(_0x3226('0x11'));var qs=require(_0x3226('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3226('0x13'));var logger=require(_0x3226('0x14'))(_0x3226('0x15'));var utils=require(_0x3226('0x16'));var config=require(_0x3226('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x3226('0x18'));function respondWithStatusCode(_0x1dab8f,_0x25f5a4){_0x25f5a4=_0x25f5a4||0xcc;return function(_0x45805e){if(_0x45805e){return _0x1dab8f[_0x3226('0x19')](_0x25f5a4);}return _0x1dab8f['status'](_0x25f5a4)[_0x3226('0x1a')]();};}function respondWithResult(_0x3426c4,_0x2ea605){_0x2ea605=_0x2ea605||0xc8;return function(_0x1c9c77){if(_0x1c9c77){return _0x3426c4['status'](_0x2ea605)[_0x3226('0x1b')](_0x1c9c77);}};}function respondWithFilteredResult(_0x4c3a2d,_0x131097){return function(_0x22a551){if(_0x22a551){var _0xf6d632=typeof _0x131097[_0x3226('0x1c')]===_0x3226('0x1d')&&typeof _0x131097[_0x3226('0x1e')]===_0x3226('0x1d');var _0x310636=_0x22a551[_0x3226('0x1f')];var _0x4b74e6=_0xf6d632?0x0:_0x131097[_0x3226('0x1c')];var _0x1b6717=_0xf6d632?_0x22a551[_0x3226('0x1f')]:_0x131097[_0x3226('0x1c')]+_0x131097[_0x3226('0x1e')];var _0x42d317;if(_0x1b6717>=_0x310636){_0x1b6717=_0x310636;_0x42d317=0xc8;}else{_0x42d317=0xce;}_0x4c3a2d[_0x3226('0x20')](_0x42d317);return _0x4c3a2d[_0x3226('0x21')](_0x3226('0x22'),_0x4b74e6+'-'+_0x1b6717+'/'+_0x310636)[_0x3226('0x1b')](_0x22a551);}return null;};}function patchUpdates(_0x37019f){return function(_0x5f4b77){try{jsonpatch['apply'](_0x5f4b77,_0x37019f,!![]);}catch(_0x305c77){return BPromise['reject'](_0x305c77);}return _0x5f4b77['save']();};}function saveUpdates(_0x3e49ff,_0x7b4a54){return function(_0x4460ec){if(_0x4460ec){return _0x4460ec[_0x3226('0x23')](_0x3e49ff)[_0x3226('0x24')](function(_0x41dad7){return _0x41dad7;});}return null;};}function removeEntity(_0x20d912,_0xd7f0b1){return function(_0x308d9a){if(_0x308d9a){return _0x308d9a[_0x3226('0x25')]()[_0x3226('0x24')](function(){_0x20d912[_0x3226('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x200559,_0x2a1b84){return function(_0x5c1d3f){if(!_0x5c1d3f){_0x200559[_0x3226('0x19')](0x194);}return _0x5c1d3f;};}function handleError(_0x209f84,_0x50cc01){_0x50cc01=_0x50cc01||0x1f4;return function(_0x3360ff){logger['error'](_0x3360ff[_0x3226('0x26')]);if(_0x3360ff[_0x3226('0x27')]){delete _0x3360ff[_0x3226('0x27')];}_0x209f84[_0x3226('0x20')](_0x50cc01)['send'](_0x3360ff);};}exports['index']=function(_0x3b9c99,_0x39d15b){var _0x4611ab={},_0x427e4a={},_0x506bb2={'count':0x0,'rows':[]};var _0x54c608=_[_0x3226('0x28')](db[_0x3226('0x29')][_0x3226('0x2a')],function(_0xa54719){return{'name':_0xa54719[_0x3226('0x2b')],'type':_0xa54719[_0x3226('0x2c')][_0x3226('0x2d')]};});_0x427e4a[_0x3226('0x2e')]=_[_0x3226('0x28')](_0x54c608,'name');_0x427e4a[_0x3226('0x2f')]=_[_0x3226('0x30')](_0x3b9c99[_0x3226('0x2f')]);_0x427e4a[_0x3226('0x31')]=_[_0x3226('0x32')](_0x427e4a[_0x3226('0x2e')],_0x427e4a[_0x3226('0x2f')]);_0x4611ab['attributes']=_[_0x3226('0x32')](_0x427e4a[_0x3226('0x2e')],qs[_0x3226('0x33')](_0x3b9c99[_0x3226('0x2f')][_0x3226('0x33')]));_0x4611ab[_0x3226('0x34')]=_0x4611ab['attributes']['length']?_0x4611ab['attributes']:_0x427e4a[_0x3226('0x2e')];if(!_0x3b9c99[_0x3226('0x2f')]['hasOwnProperty']('nolimit')){_0x4611ab[_0x3226('0x1e')]=qs[_0x3226('0x1e')](_0x3b9c99[_0x3226('0x2f')][_0x3226('0x1e')]);_0x4611ab[_0x3226('0x1c')]=qs['offset'](_0x3b9c99[_0x3226('0x2f')][_0x3226('0x1c')]);}_0x4611ab[_0x3226('0x35')]=qs[_0x3226('0x36')](_0x3b9c99['query'][_0x3226('0x36')]);_0x4611ab['where']=qs['filters'](_['pick'](_0x3b9c99['query'],_0x427e4a[_0x3226('0x31')]),_0x54c608);if(_0x3b9c99[_0x3226('0x2f')][_0x3226('0x37')]){_0x4611ab[_0x3226('0x38')]=_['merge'](_0x4611ab['where'],{'$or':_['map'](_0x54c608,function(_0x4072fa){if(_0x4072fa['type']!==_0x3226('0x39')){var _0x2a5915={};_0x2a5915[_0x4072fa['name']]={'$like':'%'+_0x3b9c99[_0x3226('0x2f')][_0x3226('0x37')]+'%'};return _0x2a5915;}})});}_0x4611ab=_[_0x3226('0x3a')]({},_0x4611ab,_0x3b9c99[_0x3226('0x3b')]);var _0x1cfd4d={'where':_0x4611ab[_0x3226('0x38')]};return db[_0x3226('0x29')][_0x3226('0x1f')](_0x1cfd4d)[_0x3226('0x24')](function(_0xd26582){_0x506bb2['count']=_0xd26582;if(_0x3b9c99[_0x3226('0x2f')][_0x3226('0x3c')]){_0x4611ab['include']=[{'all':!![]}];}return db[_0x3226('0x29')]['findAll'](_0x4611ab);})[_0x3226('0x24')](function(_0x1c497d){_0x506bb2[_0x3226('0x3d')]=_0x1c497d;return _0x506bb2;})[_0x3226('0x24')](respondWithFilteredResult(_0x39d15b,_0x4611ab))[_0x3226('0x3e')](handleError(_0x39d15b,null));};exports[_0x3226('0x3f')]=function(_0x3599d3,_0xbb7652){var _0x3a1482={'raw':![],'where':{'id':_0x3599d3[_0x3226('0x40')]['id']}},_0x580191={};_0x580191[_0x3226('0x2e')]=_[_0x3226('0x30')](db['ServicenowAccount']['rawAttributes']);_0x580191[_0x3226('0x2f')]=_[_0x3226('0x30')](_0x3599d3[_0x3226('0x2f')]);_0x580191[_0x3226('0x31')]=_[_0x3226('0x32')](_0x580191[_0x3226('0x2e')],_0x580191[_0x3226('0x2f')]);_0x3a1482[_0x3226('0x34')]=_[_0x3226('0x32')](_0x580191['model'],qs[_0x3226('0x33')](_0x3599d3[_0x3226('0x2f')][_0x3226('0x33')]));_0x3a1482[_0x3226('0x34')]=_0x3a1482[_0x3226('0x34')]['length']?_0x3a1482[_0x3226('0x34')]:_0x580191[_0x3226('0x2e')];if(_0x3599d3[_0x3226('0x2f')][_0x3226('0x3c')]){_0x3a1482['include']=[{'all':!![]}];}_0x3a1482=_['merge']({},_0x3a1482,_0x3599d3['options']);return db[_0x3226('0x29')]['find'](_0x3a1482)['then'](handleEntityNotFound(_0xbb7652,null))[_0x3226('0x24')](respondWithResult(_0xbb7652,null))['catch'](handleError(_0xbb7652,null));};exports[_0x3226('0x41')]=function(_0x406894,_0x496671){return db['ServicenowAccount'][_0x3226('0x41')](_0x406894['body'],{})[_0x3226('0x24')](respondWithResult(_0x496671,0xc9))['catch'](handleError(_0x496671,null));};exports[_0x3226('0x23')]=function(_0x36ced3,_0x4fc035){if(_0x36ced3[_0x3226('0x42')]['id']){delete _0x36ced3[_0x3226('0x42')]['id'];}return db[_0x3226('0x29')][_0x3226('0x43')]({'where':{'id':_0x36ced3[_0x3226('0x40')]['id']}})[_0x3226('0x24')](handleEntityNotFound(_0x4fc035,null))[_0x3226('0x24')](saveUpdates(_0x36ced3[_0x3226('0x42')],null))[_0x3226('0x24')](respondWithResult(_0x4fc035,null))[_0x3226('0x3e')](handleError(_0x4fc035,null));};exports[_0x3226('0x25')]=function(_0x4a9cfd,_0xb982d6){return db[_0x3226('0x29')][_0x3226('0x43')]({'where':{'id':_0x4a9cfd['params']['id']}})[_0x3226('0x24')](handleEntityNotFound(_0xb982d6,null))[_0x3226('0x24')](removeEntity(_0xb982d6,null))[_0x3226('0x3e')](handleError(_0xb982d6,null));};exports[_0x3226('0x44')]=function(_0x482fb1,_0xfec19f,_0x2b4a63){var _0x186b13={};var _0x5f55d1={};var _0xf117ea;var _0x391510;return db[_0x3226('0x29')][_0x3226('0x45')]({'where':{'id':_0x482fb1[_0x3226('0x40')]['id']}})['then'](handleEntityNotFound(_0xfec19f,null))[_0x3226('0x24')](function(_0x26384a){if(_0x26384a){_0xf117ea=_0x26384a;_0x5f55d1[_0x3226('0x2e')]=_[_0x3226('0x30')](db[_0x3226('0x46')][_0x3226('0x2a')]);_0x5f55d1['query']=_[_0x3226('0x30')](_0x482fb1[_0x3226('0x2f')]);_0x5f55d1['filters']=_[_0x3226('0x32')](_0x5f55d1[_0x3226('0x2e')],_0x5f55d1[_0x3226('0x2f')]);_0x186b13[_0x3226('0x34')]=_[_0x3226('0x32')](_0x5f55d1[_0x3226('0x2e')],qs[_0x3226('0x33')](_0x482fb1[_0x3226('0x2f')][_0x3226('0x33')]));_0x186b13['attributes']=_0x186b13[_0x3226('0x34')][_0x3226('0x47')]?_0x186b13[_0x3226('0x34')]:_0x5f55d1[_0x3226('0x2e')];_0x186b13[_0x3226('0x35')]=qs[_0x3226('0x36')](_0x482fb1[_0x3226('0x2f')][_0x3226('0x36')]);_0x186b13['where']=qs[_0x3226('0x31')](_[_0x3226('0x48')](_0x482fb1[_0x3226('0x2f')],_0x5f55d1[_0x3226('0x31')]));if(_0x482fb1[_0x3226('0x2f')][_0x3226('0x37')]){_0x186b13[_0x3226('0x38')]=_[_0x3226('0x3a')](_0x186b13[_0x3226('0x38')],{'$or':_['map'](_0x186b13[_0x3226('0x34')],function(_0x41080a){var _0x44046f={};_0x44046f[_0x41080a]={'$like':'%'+_0x482fb1[_0x3226('0x2f')]['filter']+'%'};return _0x44046f;})});}_0x186b13=_['merge']({},_0x186b13,_0x482fb1[_0x3226('0x3b')]);return _0xf117ea[_0x3226('0x44')](_0x186b13);}})[_0x3226('0x24')](function(_0x58eddf){if(_0x58eddf){_0x391510=_0x58eddf['length'];if(!_0x482fb1[_0x3226('0x2f')][_0x3226('0x49')](_0x3226('0x4a'))){_0x186b13['limit']=qs[_0x3226('0x1e')](_0x482fb1[_0x3226('0x2f')]['limit']);_0x186b13[_0x3226('0x1c')]=qs[_0x3226('0x1c')](_0x482fb1[_0x3226('0x2f')][_0x3226('0x1c')]);}return _0xf117ea[_0x3226('0x44')](_0x186b13);}})['then'](function(_0x442fdb){if(_0x442fdb){return _0x442fdb?{'count':_0x391510,'rows':_0x442fdb}:null;}})[_0x3226('0x24')](respondWithResult(_0xfec19f,null))[_0x3226('0x3e')](handleError(_0xfec19f,null));};exports[_0x3226('0x4b')]=function(_0x272460,_0x2de073,_0x4233d1){if(_0x272460[_0x3226('0x42')]['id']){delete _0x272460[_0x3226('0x42')]['id'];}return db[_0x3226('0x29')][_0x3226('0x45')]({'where':{'id':_0x272460[_0x3226('0x40')]['id']}})[_0x3226('0x24')](handleEntityNotFound(_0x2de073,null))['then'](function(_0x109824){if(_0x109824){_0x272460[_0x3226('0x42')]['AccountId']=_0x109824['id'];_0x272460[_0x3226('0x42')]['Subjects']=integrations['getSubjects'](_0x272460[_0x3226('0x42')]['channel'],_0x272460[_0x3226('0x42')][_0x3226('0x2c')]);_0x272460[_0x3226('0x42')][_0x3226('0x4c')]=integrations[_0x3226('0x4d')](_0x272460[_0x3226('0x42')][_0x3226('0x4e')],_0x272460[_0x3226('0x42')][_0x3226('0x2c')]);return db[_0x3226('0x46')][_0x3226('0x41')](_0x272460[_0x3226('0x42')],{'include':[{'model':db[_0x3226('0x4f')],'as':_0x3226('0x50')},{'model':db[_0x3226('0x4f')],'as':_0x3226('0x4c')}]});}return null;})[_0x3226('0x24')](respondWithResult(_0x2de073,null))['catch'](handleError(_0x2de073,null));};exports[_0x3226('0x51')]=function(_0x2558e8,_0x1c7626,_0x227857){var _0x46f0d1=[_0x3226('0x52'),_0x3226('0x53'),_0x3226('0x54'),'subcategory',_0x3226('0x55'),'notify',_0x3226('0x56'),_0x3226('0x57'),_0x3226('0x58')];var _0x59aed1=[_0x3226('0x59'),'made_sla',_0x3226('0x5a'),_0x3226('0x5b'),'upon_reject',_0x3226('0x5c'),_0x3226('0x5d'),_0x3226('0x53'),_0x3226('0x5e'),'number',_0x3226('0x5f'),_0x3226('0x60'),_0x3226('0x61'),_0x3226('0x62'),_0x3226('0x63'),_0x3226('0x64'),_0x3226('0x65'),_0x3226('0x66'),_0x3226('0x54'),_0x3226('0x35'),_0x3226('0x67'),'closed_at','cmdb_ci',_0x3226('0x68'),'impact',_0x3226('0x69'),_0x3226('0x6a'),_0x3226('0x6b'),'priority','sys_domain_path','rfc','time_worked',_0x3226('0x6c'),_0x3226('0x6d'),_0x3226('0x6e'),_0x3226('0x6f'),'work_end','reopened_time',_0x3226('0x70'),_0x3226('0x71'),_0x3226('0x72'),'subcategory',_0x3226('0x73'),_0x3226('0x74'),'close_code',_0x3226('0x75'),_0x3226('0x76'),'work_start',_0x3226('0x77'),'business_stc',_0x3226('0x78'),'description',_0x3226('0x79'),_0x3226('0x7a'),'sys_class_name',_0x3226('0x7b'),_0x3226('0x7c'),'follow_up','parent_incident',_0x3226('0x7d'),_0x3226('0x7e'),_0x3226('0x7f'),_0x3226('0x56'),'urgency',_0x3226('0x80'),_0x3226('0x81'),_0x3226('0x82'),_0x3226('0x83'),_0x3226('0x84'),_0x3226('0x57'),_0x3226('0x85'),_0x3226('0x86'),'approval',_0x3226('0x87'),_0x3226('0x88'),_0x3226('0x89'),_0x3226('0x8a'),_0x3226('0x8b'),'escalation',_0x3226('0x8c'),_0x3226('0x8d'),_0x3226('0x8e'),_0x3226('0x58')];var _0x176126='';var _0x48c5d2='';var _0x1e03e1=[];var _0x5a9bc4='';var _0xea2883='';var _0xe51ce2=[];var _0x43ef95='';var _0x1aad42='';var _0x477c20={};var _0xc5ec8f='';return db[_0x3226('0x29')][_0x3226('0x45')]({'where':{'id':_0x2558e8[_0x3226('0x40')]['id']},'attributes':['id',_0x3226('0x8f'),_0x3226('0x90'),_0x3226('0x91'),_0x3226('0x92'),_0x3226('0x93')]})[_0x3226('0x24')](handleEntityNotFound(_0x1c7626,null))[_0x3226('0x24')](function(_0x176415){if(_0x176415){_0xc5ec8f=_0x176415['remoteUri'];var _0xb3da14=_0xc5ec8f[_0x3226('0x94')](-0x1);if(_0xb3da14==='/'){_0xc5ec8f=_0xc5ec8f['substring'](0x0,_0xc5ec8f['lastIndexOf'](_0xb3da14));}_0x1aad42=util[_0x3226('0x95')](_0x3226('0x96'),_0xc5ec8f);_0x43ef95=util[_0x3226('0x95')]('%s/api/now/table/',_0xc5ec8f);_0x477c20={'user':_0x176415[_0x3226('0x8f')],'pass':_0x176415[_0x3226('0x90')]};var _0x5a653b={'method':_0x3226('0x97'),'uri':_0x1aad42+_0x3226('0x98'),'auth':_0x477c20,'json':!![]};return rp(_0x5a653b);}})[_0x3226('0x24')](function(_0x218c52){if(_0x218c52[_0x3226('0x99')][_0x3226('0x47')]>0x0){_0x176126=_0x218c52[_0x3226('0x99')];}console[_0x3226('0x9a')](_0x3226('0x9b'),_0x176126);_0xe51ce2=[];_0x48c5d2=Object[_0x3226('0x9c')]([],_0x176126);_[_0x3226('0x9d')](_0x48c5d2,function(_0x79a375){return!_0x46f0d1['includes'](_0x79a375[_0x3226('0x27')]);});_0x48c5d2['forEach'](function(_0x47142f){var _0xa35b58=createFieldObject(_0x43ef95,_0x477c20,_0x47142f['internalType'],_0x47142f['name'],_0x47142f[_0x3226('0x9e')],![]);_0xe51ce2[_0x3226('0x9f')](_0xa35b58);});return Promise[_0x3226('0xa0')](_0xe51ce2);})['then'](function(_0x3a33f4){_0x1e03e1=_0x3a33f4;_0x5a9bc4=Object[_0x3226('0x9c')]([],_0x176126);console[_0x3226('0x9a')](_0x3226('0xa1'),_0x176126);_[_0x3226('0x9d')](_0x5a9bc4,function(_0xb9cca4){return _0x59aed1['includes'](_0xb9cca4[_0x3226('0x27')]);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x5a9bc4);_0xe51ce2=[];_0x5a9bc4[_0x3226('0xa2')](function(_0x7c07fa){var _0x4fcced=createFieldObject(_0x43ef95,_0x477c20,_0x7c07fa['internalType'],_0x7c07fa[_0x3226('0x27')],_0x7c07fa[_0x3226('0x9e')],!![]);_0xe51ce2[_0x3226('0x9f')](_0x4fcced);});return Promise[_0x3226('0xa0')](_0xe51ce2);})[_0x3226('0x24')](function(_0x282588){_0xea2883=_0x282588;var _0x96c9c2=_0x1e03e1[_0x3226('0xa3')](_0xea2883);return{'count':_0x96c9c2[_0x3226('0x47')],'rows':_0x96c9c2};})[_0x3226('0x24')](respondWithResult(_0x1c7626,null))['catch'](function(_0x30a056){console[_0x3226('0x9a')](_0x3226('0xa4')+_0x30a056);var _0x17f62f=_0x2558e8[_0x3226('0x2f')][_0x3226('0xa5')]?0x1f4:_0x30a056[_0x3226('0xa6')]||0x1f4;logger[_0x3226('0xa7')](_0x30a056[_0x3226('0x26')]);delete _0x30a056[_0x3226('0x27')];if(_0x17f62f===0x191){_0x17f62f=0x190;}_0x1c7626[_0x3226('0x20')](_0x17f62f)['send'](_0x2558e8[_0x3226('0x2f')][_0x3226('0xa5')]?{'message':_0x3226('0xa8'),'statusCode':_0x30a056[_0x3226('0xa6')]}:_0x30a056);});};function createFieldObject(_0x2ee535,_0x736b98,_0x52b1aa,_0x45858e,_0x35ca46,_0xc659ca){return new Promise(function(_0x59565b,_0x2b996d){var _0x3582cd={'id':_0x45858e,'name':_0x35ca46,'custom':_0xc659ca};if(_0x52b1aa===_0x3226('0xa9')){_0x3582cd['options']=[{'name':_0x3226('0xaa'),'value':'true'},{'name':_0x3226('0xab'),'value':_0x3226('0xac')}];_0x59565b(_0x3582cd);}else{var _0x39964a={'method':_0x3226('0x97'),'uri':_0x2ee535+_0x3226('0xad')+_0x45858e,'auth':_0x736b98,'json':!![]};return rp(_0x39964a)[_0x3226('0x24')](function(_0x310590){var _0xdf378a=[];if(_0x310590['result'][_0x3226('0x47')]>0x0){_0x310590['result'][_0x3226('0xa2')](function(_0xca2da8){if(_0xca2da8[_0x3226('0xae')]===_0x3226('0xac')){var _0x51b220={'name':_0xca2da8[_0x3226('0x9e')],'value':_0xca2da8['value']};_0xdf378a[_0x3226('0x9f')](_0x51b220);}});}_0x3582cd[_0x3226('0x3b')]=_0xdf378a;if(_0x3582cd['options'][_0x3226('0x47')]>0x0){_0x59565b(_0x3582cd);}else{if(_0xc659ca==![]){_0x59565b();}else{_0x59565b(_0x3582cd);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 72e1ec1..a17cb50 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 _0x1261=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','ServicenowAccount','int_servicenow_accounts'];(function(_0x43ca86,_0x14d9b9){var _0x2cb65a=function(_0x3582f2){while(--_0x3582f2){_0x43ca86['push'](_0x43ca86['shift']());}};_0x2cb65a(++_0x14d9b9);}(_0x1261,0x144));var _0x1126=function(_0xe4f7a3,_0x449042){_0xe4f7a3=_0xe4f7a3-0x0;var _0xb1da7c=_0x1261[_0xe4f7a3];return _0xb1da7c;};'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'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x40ba58,_0x907180){return _0x40ba58['define'](_0x1126('0xa'),attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f47=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','define','int_servicenow_accounts','util'];(function(_0x119a07,_0x2289f6){var _0x36025c=function(_0xf28f4){while(--_0xf28f4){_0x119a07['push'](_0x119a07['shift']());}};_0x36025c(++_0x2289f6);}(_0x6f47,0xc7));var _0x76f4=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x6f47[_0x164eca];return _0x2ce562;};'use strict';var _=require('lodash');var util=require(_0x76f4('0x0'));var logger=require(_0x76f4('0x1'))('api');var moment=require(_0x76f4('0x2'));var BPromise=require('bluebird');var rp=require(_0x76f4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x76f4('0x4'));var config=require(_0x76f4('0x5'));var attributes=require(_0x76f4('0x6'));var integrations=require(_0x76f4('0x7'));module['exports']=function(_0x35602f,_0xfc2405){return _0x35602f[_0x76f4('0x8')]('ServicenowAccount',attributes,{'tableName':_0x76f4('0x9'),'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 ca56279..bb34694 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 _0x01cc=['code','message','ServicenowAccount,\x20%s,\x20%s','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','attributes','limit','include','model','map','find','where','ShowServicenowAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x01cc,0xbb));var _0xc01c=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x01cc[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0xc01c('0x0'));var util=require(_0xc01c('0x1'));var moment=require(_0xc01c('0x2'));var BPromise=require(_0xc01c('0x3'));var rs=require(_0xc01c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc01c('0x5'))['db'];var utils=require(_0xc01c('0x6'));var logger=require('../../config/logger')(_0xc01c('0x7'));var config=require(_0xc01c('0x8'));var jayson=require(_0xc01c('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4c5827,_0x2b39f0,_0x5907d2){return new BPromise(function(_0x54f077,_0x2075ef){return client[_0xc01c('0xa')](_0x4c5827,_0x5907d2)[_0xc01c('0xb')](function(_0x49b673){logger[_0xc01c('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x2b39f0,_0xc01c('0xd'));logger[_0xc01c('0xe')](_0xc01c('0xf'),_0x2b39f0,_0xc01c('0xd'),JSON['stringify'](_0x49b673));if(_0x49b673[_0xc01c('0x10')]){if(_0x49b673['error'][_0xc01c('0x11')]===0x1f4){logger[_0xc01c('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x2b39f0,_0x49b673[_0xc01c('0x10')]['message']);return _0x2075ef(_0x49b673['error'][_0xc01c('0x12')]);}logger['error'](_0xc01c('0x13'),_0x2b39f0,_0x49b673[_0xc01c('0x10')]['message']);return _0x54f077(_0x49b673[_0xc01c('0x10')][_0xc01c('0x12')]);}else{logger['info'](_0xc01c('0x13'),_0x2b39f0,_0xc01c('0xd'));_0x54f077(_0x49b673[_0xc01c('0x14')][_0xc01c('0x12')]);}})[_0xc01c('0x15')](function(_0x578f18){logger[_0xc01c('0x10')](_0xc01c('0x13'),_0x2b39f0,_0x578f18);_0x2075ef(_0x578f18);});});}exports[_0xc01c('0x16')]=function(_0x117a7b){var _0x6cbf41=this;return new Promise(function(_0x3574d3,_0x1f76f0){return db[_0xc01c('0x17')]['findAll']({'raw':_0x117a7b[_0xc01c('0x18')]?_0x117a7b['options'][_0xc01c('0x19')]===undefined?!![]:![]:!![],'where':_0x117a7b[_0xc01c('0x18')]?_0x117a7b[_0xc01c('0x18')]['where']||null:null,'attributes':_0x117a7b[_0xc01c('0x18')]?_0x117a7b[_0xc01c('0x18')][_0xc01c('0x1a')]||null:null,'limit':_0x117a7b[_0xc01c('0x18')]?_0x117a7b[_0xc01c('0x18')][_0xc01c('0x1b')]||null:null,'include':_0x117a7b[_0xc01c('0x18')]?_0x117a7b[_0xc01c('0x18')][_0xc01c('0x1c')]?_['map'](_0x117a7b[_0xc01c('0x18')]['include'],function(_0x599478){return{'model':db[_0x599478[_0xc01c('0x1d')]],'as':_0x599478['as'],'attributes':_0x599478[_0xc01c('0x1a')],'include':_0x599478['include']?_[_0xc01c('0x1e')](_0x599478[_0xc01c('0x1c')],function(_0x784ff7){return{'model':db[_0x784ff7['model']],'as':_0x784ff7['as'],'attributes':_0x784ff7[_0xc01c('0x1a')],'include':_0x784ff7[_0xc01c('0x1c')]?_[_0xc01c('0x1e')](_0x784ff7[_0xc01c('0x1c')],function(_0x533e57){return{'model':db[_0x533e57['model']],'as':_0x533e57['as'],'attributes':_0x533e57[_0xc01c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc01c('0xb')](function(_0x3ff99c){logger['info']('GetServicenowAccount',_0x117a7b);logger[_0xc01c('0xe')](_0xc01c('0x16'),_0x117a7b,JSON['stringify'](_0x3ff99c));_0x3574d3(_0x3ff99c);})['catch'](function(_0x43ce4b){logger['error'](_0xc01c('0x16'),_0x43ce4b[_0xc01c('0x12')],_0x117a7b);_0x1f76f0(_0x6cbf41[_0xc01c('0x10')](0x1f4,_0x43ce4b[_0xc01c('0x12')]));});});};exports['ShowServicenowAccount']=function(_0x48f75f){var _0x4bbb0a=this;return new Promise(function(_0x535f3f,_0x2126a5){return db[_0xc01c('0x17')][_0xc01c('0x1f')]({'raw':_0x48f75f[_0xc01c('0x18')]?_0x48f75f[_0xc01c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x48f75f['options']?_0x48f75f[_0xc01c('0x18')][_0xc01c('0x20')]||null:null,'attributes':_0x48f75f[_0xc01c('0x18')]?_0x48f75f['options'][_0xc01c('0x1a')]||null:null,'include':_0x48f75f[_0xc01c('0x18')]?_0x48f75f[_0xc01c('0x18')][_0xc01c('0x1c')]?_['map'](_0x48f75f[_0xc01c('0x18')][_0xc01c('0x1c')],function(_0x30184b){return{'model':db[_0x30184b['model']],'as':_0x30184b['as'],'attributes':_0x30184b['attributes'],'include':_0x30184b[_0xc01c('0x1c')]?_[_0xc01c('0x1e')](_0x30184b[_0xc01c('0x1c')],function(_0x4d560c){return{'model':db[_0x4d560c[_0xc01c('0x1d')]],'as':_0x4d560c['as'],'attributes':_0x4d560c[_0xc01c('0x1a')],'include':_0x4d560c[_0xc01c('0x1c')]?_[_0xc01c('0x1e')](_0x4d560c[_0xc01c('0x1c')],function(_0x11129a){return{'model':db[_0x11129a[_0xc01c('0x1d')]],'as':_0x11129a['as'],'attributes':_0x11129a[_0xc01c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc01c('0xb')](function(_0x1501b8){logger[_0xc01c('0xc')](_0xc01c('0x21'),_0x48f75f);logger[_0xc01c('0xe')](_0xc01c('0x21'),_0x48f75f,JSON['stringify'](_0x1501b8));_0x535f3f(_0x1501b8);})[_0xc01c('0x15')](function(_0x4c7a78){logger['error'](_0xc01c('0x21'),_0x4c7a78[_0xc01c('0x12')],_0x48f75f);_0x2126a5(_0x4bbb0a['error'](0x1f4,_0x4c7a78[_0xc01c('0x12')]));});});}; \ No newline at end of file +var _0xcaf8=['result','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','limit','include','map','model','catch','ShowServicenowAccount','stringify','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x4c9be3,_0x1b5d6f){var _0x4bafd4=function(_0x1505b3){while(--_0x1505b3){_0x4c9be3['push'](_0x4c9be3['shift']());}};_0x4bafd4(++_0x1b5d6f);}(_0xcaf8,0x1ce));var _0x8caf=function(_0x49d8c1,_0x2dae65){_0x49d8c1=_0x49d8c1-0x0;var _0x41c341=_0xcaf8[_0x49d8c1];return _0x41c341;};'use strict';var _=require('lodash');var util=require(_0x8caf('0x0'));var moment=require('moment');var BPromise=require(_0x8caf('0x1'));var rs=require(_0x8caf('0x2'));var fs=require('fs');var Redis=require(_0x8caf('0x3'));var db=require(_0x8caf('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8caf('0x5'));var config=require('../../config/environment');var jayson=require(_0x8caf('0x6'));var client=jayson[_0x8caf('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e8f1f,_0x2d894c,_0x3a9dd9){return new BPromise(function(_0x564c23,_0x187648){return client[_0x8caf('0x8')](_0x4e8f1f,_0x3a9dd9)[_0x8caf('0x9')](function(_0x22122b){logger[_0x8caf('0xa')](_0x8caf('0xb'),_0x2d894c,_0x8caf('0xc'));logger[_0x8caf('0xd')](_0x8caf('0xe'),_0x2d894c,_0x8caf('0xc'),JSON['stringify'](_0x22122b));if(_0x22122b[_0x8caf('0xf')]){if(_0x22122b[_0x8caf('0xf')][_0x8caf('0x10')]===0x1f4){logger[_0x8caf('0xf')](_0x8caf('0xb'),_0x2d894c,_0x22122b['error']['message']);return _0x187648(_0x22122b[_0x8caf('0xf')][_0x8caf('0x11')]);}logger['error'](_0x8caf('0xb'),_0x2d894c,_0x22122b[_0x8caf('0xf')][_0x8caf('0x11')]);return _0x564c23(_0x22122b[_0x8caf('0xf')][_0x8caf('0x11')]);}else{logger[_0x8caf('0xa')](_0x8caf('0xb'),_0x2d894c,_0x8caf('0xc'));_0x564c23(_0x22122b[_0x8caf('0x12')][_0x8caf('0x11')]);}})['catch'](function(_0x38d3f4){logger[_0x8caf('0xf')](_0x8caf('0xb'),_0x2d894c,_0x38d3f4);_0x187648(_0x38d3f4);});});}exports[_0x8caf('0x13')]=function(_0x654944){var _0x562ee5=this;return new Promise(function(_0x7414bd,_0xee551){return db[_0x8caf('0x14')]['findAll']({'raw':_0x654944['options']?_0x654944[_0x8caf('0x15')][_0x8caf('0x16')]===undefined?!![]:![]:!![],'where':_0x654944[_0x8caf('0x15')]?_0x654944['options'][_0x8caf('0x17')]||null:null,'attributes':_0x654944[_0x8caf('0x15')]?_0x654944[_0x8caf('0x15')][_0x8caf('0x18')]||null:null,'limit':_0x654944[_0x8caf('0x15')]?_0x654944[_0x8caf('0x15')][_0x8caf('0x19')]||null:null,'include':_0x654944[_0x8caf('0x15')]?_0x654944['options'][_0x8caf('0x1a')]?_[_0x8caf('0x1b')](_0x654944[_0x8caf('0x15')]['include'],function(_0x10ff9f){return{'model':db[_0x10ff9f[_0x8caf('0x1c')]],'as':_0x10ff9f['as'],'attributes':_0x10ff9f[_0x8caf('0x18')],'include':_0x10ff9f[_0x8caf('0x1a')]?_[_0x8caf('0x1b')](_0x10ff9f[_0x8caf('0x1a')],function(_0x261460){return{'model':db[_0x261460[_0x8caf('0x1c')]],'as':_0x261460['as'],'attributes':_0x261460[_0x8caf('0x18')],'include':_0x261460[_0x8caf('0x1a')]?_[_0x8caf('0x1b')](_0x261460[_0x8caf('0x1a')],function(_0x575c71){return{'model':db[_0x575c71['model']],'as':_0x575c71['as'],'attributes':_0x575c71['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d8e5a){logger[_0x8caf('0xa')](_0x8caf('0x13'),_0x654944);logger[_0x8caf('0xd')](_0x8caf('0x13'),_0x654944,JSON['stringify'](_0x5d8e5a));_0x7414bd(_0x5d8e5a);})[_0x8caf('0x1d')](function(_0x306d9f){logger['error'](_0x8caf('0x13'),_0x306d9f['message'],_0x654944);_0xee551(_0x562ee5['error'](0x1f4,_0x306d9f[_0x8caf('0x11')]));});});};exports[_0x8caf('0x1e')]=function(_0x3cfb88){var _0xeee52a=this;return new Promise(function(_0x5142df,_0x215c36){return db[_0x8caf('0x14')]['find']({'raw':_0x3cfb88[_0x8caf('0x15')]?_0x3cfb88['options']['raw']===undefined?!![]:![]:!![],'where':_0x3cfb88['options']?_0x3cfb88['options'][_0x8caf('0x17')]||null:null,'attributes':_0x3cfb88['options']?_0x3cfb88[_0x8caf('0x15')][_0x8caf('0x18')]||null:null,'include':_0x3cfb88['options']?_0x3cfb88[_0x8caf('0x15')][_0x8caf('0x1a')]?_['map'](_0x3cfb88[_0x8caf('0x15')][_0x8caf('0x1a')],function(_0x20a56f){return{'model':db[_0x20a56f[_0x8caf('0x1c')]],'as':_0x20a56f['as'],'attributes':_0x20a56f[_0x8caf('0x18')],'include':_0x20a56f[_0x8caf('0x1a')]?_['map'](_0x20a56f[_0x8caf('0x1a')],function(_0x31d46e){return{'model':db[_0x31d46e[_0x8caf('0x1c')]],'as':_0x31d46e['as'],'attributes':_0x31d46e['attributes'],'include':_0x31d46e['include']?_['map'](_0x31d46e[_0x8caf('0x1a')],function(_0x3fddc8){return{'model':db[_0x3fddc8[_0x8caf('0x1c')]],'as':_0x3fddc8['as'],'attributes':_0x3fddc8[_0x8caf('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8caf('0x9')](function(_0x3a55a9){logger[_0x8caf('0xa')]('ShowServicenowAccount',_0x3cfb88);logger[_0x8caf('0xd')]('ShowServicenowAccount',_0x3cfb88,JSON[_0x8caf('0x1f')](_0x3a55a9));_0x5142df(_0x3a55a9);})[_0x8caf('0x1d')](function(_0x494b93){logger[_0x8caf('0xf')](_0x8caf('0x1e'),_0x494b93[_0x8caf('0x11')],_0x3cfb88);_0x215c36(_0xeee52a[_0x8caf('0xf')](0x1f4,_0x494b93[_0x8caf('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 7b9fb6d..75178f2 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 _0x8af7=['getFields','/:id/subjects','getSubjects','post','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields'];(function(_0x1fd4d7,_0x2feafd){var _0x7efe8a=function(_0xc54f55){while(--_0xc54f55){_0x1fd4d7['push'](_0x1fd4d7['shift']());}};_0x7efe8a(++_0x2feafd);}(_0x8af7,0x8b));var _0x78af=function(_0x5ab127,_0x1acd8e){_0x5ab127=_0x5ab127-0x0;var _0x5cc61b=_0x8af7[_0x5ab127];return _0x5cc61b;};'use strict';var multer=require(_0x78af('0x0'));var util=require(_0x78af('0x1'));var path=require(_0x78af('0x2'));var timeout=require(_0x78af('0x3'));var express=require(_0x78af('0x4'));var router=express[_0x78af('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x78af('0x6'));var config=require(_0x78af('0x7'));var controller=require(_0x78af('0x8'));router[_0x78af('0x9')]('/',auth['isAuthenticated'](),controller[_0x78af('0xa')]);router[_0x78af('0x9')](_0x78af('0xb'),auth[_0x78af('0xc')](),controller[_0x78af('0xd')]);router['get'](_0x78af('0xe'),auth['isAuthenticated'](),controller[_0x78af('0xf')]);router['get'](_0x78af('0x10'),auth[_0x78af('0xc')](),controller[_0x78af('0x11')]);router[_0x78af('0x9')]('/:id/descriptions',auth[_0x78af('0xc')](),controller['getDescriptions']);router[_0x78af('0x12')]('/',auth[_0x78af('0xc')](),controller['create']);router[_0x78af('0x13')](_0x78af('0xb'),auth[_0x78af('0xc')](),controller['update']);router[_0x78af('0x14')](_0x78af('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x78af('0x15')]=router; \ No newline at end of file +var _0xc61e=['isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','post','put','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','./intServicenowConfiguration.controller','get'];(function(_0x1f1db4,_0x1a8d01){var _0x34cb21=function(_0x573d36){while(--_0x573d36){_0x1f1db4['push'](_0x1f1db4['shift']());}};_0x34cb21(++_0x1a8d01);}(_0xc61e,0x71));var _0xec61=function(_0x1edaa5,_0x4f14bf){_0x1edaa5=_0x1edaa5-0x0;var _0x472f20=_0xc61e[_0x1edaa5];return _0x472f20;};'use strict';var multer=require(_0xec61('0x0'));var util=require('util');var path=require(_0xec61('0x1'));var timeout=require('connect-timeout');var express=require(_0xec61('0x2'));var router=express['Router']();var fs_extra=require(_0xec61('0x3'));var auth=require(_0xec61('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xec61('0x5'));router[_0xec61('0x6')]('/',auth[_0xec61('0x7')](),controller[_0xec61('0x8')]);router[_0xec61('0x6')](_0xec61('0x9'),auth[_0xec61('0x7')](),controller[_0xec61('0xa')]);router[_0xec61('0x6')]('/:id/fields',auth[_0xec61('0x7')](),controller[_0xec61('0xb')]);router[_0xec61('0x6')](_0xec61('0xc'),auth[_0xec61('0x7')](),controller[_0xec61('0xd')]);router[_0xec61('0x6')]('/:id/descriptions',auth[_0xec61('0x7')](),controller['getDescriptions']);router[_0xec61('0xe')]('/',auth[_0xec61('0x7')](),controller['create']);router[_0xec61('0xf')](_0xec61('0x9'),auth[_0xec61('0x7')](),controller[_0xec61('0x10')]);router[_0xec61('0x11')](_0xec61('0x9'),auth['isAuthenticated'](),controller[_0xec61('0x12')]);module[_0xec61('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 0a26fde..5a43310 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 _0xe020=['sequelize','exports','STRING'];(function(_0x4b1bfa,_0x402d4b){var _0x589a32=function(_0x3b248f){while(--_0x3b248f){_0x4b1bfa['push'](_0x4b1bfa['shift']());}};_0x589a32(++_0x402d4b);}(_0xe020,0x96));var _0x0e02=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xe020[_0x2dadb9];return _0x2f0097;};'use strict';var Sequelize=require(_0x0e02('0x0'));module[_0x0e02('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0e02('0x2')]}}; \ No newline at end of file +var _0xf65d=['exports'];(function(_0x26d112,_0x30f630){var _0x513764=function(_0x4be454){while(--_0x4be454){_0x26d112['push'](_0x26d112['shift']());}};_0x513764(++_0x30f630);}(_0xf65d,0xbc));var _0xdf65=function(_0x281684,_0x1eae63){_0x281684=_0x281684-0x0;var _0x513920=_0xf65d[_0x281684];return _0x513920;};'use strict';var Sequelize=require('sequelize');module[_0xdf65('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 5333615..83df137 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 _0xe832=['index','map','ServicenowConfiguration','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','includeAll','include','findAll','params','merge','find','catch','create','body','update','getFields','findOne','ServicenowField','options','getSubjects','getDescriptions','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','stack','name','send'];(function(_0xb913b4,_0x374f57){var _0x23b2bf=function(_0x2fa58e){while(--_0x2fa58e){_0xb913b4['push'](_0xb913b4['shift']());}};_0x23b2bf(++_0x374f57);}(_0xe832,0x11c));var _0x2e83=function(_0x19876c,_0x43b895){_0x19876c=_0x19876c-0x0;var _0x22eb1a=_0xe832[_0x19876c];return _0x22eb1a;};'use strict';var emlformat=require(_0x2e83('0x0'));var rimraf=require(_0x2e83('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2e83('0x2'));var moment=require(_0x2e83('0x3'));var BPromise=require(_0x2e83('0x4'));var Mustache=require(_0x2e83('0x5'));var util=require(_0x2e83('0x6'));var path=require(_0x2e83('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2e83('0x8'));var fs=require('fs');var fs_extra=require(_0x2e83('0x9'));var _=require('lodash');var squel=require(_0x2e83('0xa'));var crypto=require(_0x2e83('0xb'));var jsforce=require(_0x2e83('0xc'));var deskjs=require(_0x2e83('0xd'));var toCsv=require(_0x2e83('0xe'));var querystring=require(_0x2e83('0xf'));var Papa=require(_0x2e83('0x10'));var Redis=require('ioredis');var authService=require(_0x2e83('0x11'));var qs=require(_0x2e83('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2e83('0x13'));var logger=require(_0x2e83('0x14'))(_0x2e83('0x15'));var utils=require(_0x2e83('0x16'));var config=require(_0x2e83('0x17'));var licenseUtil=require(_0x2e83('0x18'));var db=require(_0x2e83('0x19'))['db'];function respondWithStatusCode(_0x1b2827,_0x4fe5c7){_0x4fe5c7=_0x4fe5c7||0xcc;return function(_0x132349){if(_0x132349){return _0x1b2827[_0x2e83('0x1a')](_0x4fe5c7);}return _0x1b2827[_0x2e83('0x1b')](_0x4fe5c7)[_0x2e83('0x1c')]();};}function respondWithResult(_0x4bfce9,_0x4c3cd1){_0x4c3cd1=_0x4c3cd1||0xc8;return function(_0x2a1683){if(_0x2a1683){return _0x4bfce9[_0x2e83('0x1b')](_0x4c3cd1)['json'](_0x2a1683);}};}function respondWithFilteredResult(_0x3a829a,_0x329525){return function(_0x400884){if(_0x400884){var _0x228712=typeof _0x329525[_0x2e83('0x1d')]===_0x2e83('0x1e')&&typeof _0x329525[_0x2e83('0x1f')]===_0x2e83('0x1e');var _0x22731d=_0x400884['count'];var _0x419183=_0x228712?0x0:_0x329525['offset'];var _0x13657f=_0x228712?_0x400884[_0x2e83('0x20')]:_0x329525[_0x2e83('0x1d')]+_0x329525[_0x2e83('0x1f')];var _0x341e45;if(_0x13657f>=_0x22731d){_0x13657f=_0x22731d;_0x341e45=0xc8;}else{_0x341e45=0xce;}_0x3a829a[_0x2e83('0x1b')](_0x341e45);return _0x3a829a[_0x2e83('0x21')](_0x2e83('0x22'),_0x419183+'-'+_0x13657f+'/'+_0x22731d)[_0x2e83('0x23')](_0x400884);}return null;};}function patchUpdates(_0x621775){return function(_0x40f903){try{jsonpatch[_0x2e83('0x24')](_0x40f903,_0x621775,!![]);}catch(_0x5f0416){return BPromise[_0x2e83('0x25')](_0x5f0416);}return _0x40f903[_0x2e83('0x26')]();};}function saveUpdates(_0x3ffca0,_0x4829ab){return function(_0x616bc7){if(_0x616bc7){return _0x616bc7['update'](_0x3ffca0)[_0x2e83('0x27')](function(_0x44dfca){return _0x44dfca;});}return null;};}function removeEntity(_0x44ef54,_0xaefff3){return function(_0x5cea54){if(_0x5cea54){return _0x5cea54[_0x2e83('0x28')]()[_0x2e83('0x27')](function(){_0x44ef54['status'](0xcc)[_0x2e83('0x1c')]();});}};}function handleEntityNotFound(_0x1ae1de,_0x648164){return function(_0x3d8ca9){if(!_0x3d8ca9){_0x1ae1de[_0x2e83('0x1a')](0x194);}return _0x3d8ca9;};}function handleError(_0x5acc61,_0x3672c8){_0x3672c8=_0x3672c8||0x1f4;return function(_0x567d01){logger['error'](_0x567d01[_0x2e83('0x29')]);if(_0x567d01[_0x2e83('0x2a')]){delete _0x567d01[_0x2e83('0x2a')];}_0x5acc61[_0x2e83('0x1b')](_0x3672c8)[_0x2e83('0x2b')](_0x567d01);};}exports[_0x2e83('0x2c')]=function(_0x1092fd,_0x1fbb79){var _0x3c8df1={},_0x26387d={},_0x44a4c5={'count':0x0,'rows':[]};var _0xf0aee=_[_0x2e83('0x2d')](db[_0x2e83('0x2e')][_0x2e83('0x2f')],function(_0x2cfaa4){return{'name':_0x2cfaa4['fieldName'],'type':_0x2cfaa4['type'][_0x2e83('0x30')]};});_0x26387d[_0x2e83('0x31')]=_[_0x2e83('0x2d')](_0xf0aee,'name');_0x26387d[_0x2e83('0x32')]=_[_0x2e83('0x33')](_0x1092fd['query']);_0x26387d['filters']=_[_0x2e83('0x34')](_0x26387d['model'],_0x26387d[_0x2e83('0x32')]);_0x3c8df1['attributes']=_[_0x2e83('0x34')](_0x26387d[_0x2e83('0x31')],qs[_0x2e83('0x35')](_0x1092fd[_0x2e83('0x32')][_0x2e83('0x35')]));_0x3c8df1[_0x2e83('0x36')]=_0x3c8df1['attributes'][_0x2e83('0x37')]?_0x3c8df1['attributes']:_0x26387d[_0x2e83('0x31')];if(!_0x1092fd['query'][_0x2e83('0x38')](_0x2e83('0x39'))){_0x3c8df1[_0x2e83('0x1f')]=qs[_0x2e83('0x1f')](_0x1092fd[_0x2e83('0x32')][_0x2e83('0x1f')]);_0x3c8df1['offset']=qs[_0x2e83('0x1d')](_0x1092fd['query'][_0x2e83('0x1d')]);}_0x3c8df1[_0x2e83('0x3a')]=qs['sort'](_0x1092fd['query'][_0x2e83('0x3b')]);_0x3c8df1[_0x2e83('0x3c')]=qs[_0x2e83('0x3d')](_[_0x2e83('0x3e')](_0x1092fd[_0x2e83('0x32')],_0x26387d[_0x2e83('0x3d')]),_0xf0aee);if(_0x1092fd[_0x2e83('0x32')][_0x2e83('0x3f')]){_0x3c8df1[_0x2e83('0x3c')]=_['merge'](_0x3c8df1[_0x2e83('0x3c')],{'$or':_[_0x2e83('0x2d')](_0xf0aee,function(_0x35f811){if(_0x35f811[_0x2e83('0x40')]!==_0x2e83('0x41')){var _0x15a699={};_0x15a699[_0x35f811['name']]={'$like':'%'+_0x1092fd[_0x2e83('0x32')]['filter']+'%'};return _0x15a699;}})});}_0x3c8df1=_['merge']({},_0x3c8df1,_0x1092fd['options']);var _0x111e0a={'where':_0x3c8df1[_0x2e83('0x3c')]};return db[_0x2e83('0x2e')][_0x2e83('0x20')](_0x111e0a)[_0x2e83('0x27')](function(_0x1cf14f){_0x44a4c5[_0x2e83('0x20')]=_0x1cf14f;if(_0x1092fd[_0x2e83('0x32')][_0x2e83('0x42')]){_0x3c8df1[_0x2e83('0x43')]=[{'all':!![]}];}return db[_0x2e83('0x2e')][_0x2e83('0x44')](_0x3c8df1);})[_0x2e83('0x27')](function(_0x5b0537){_0x44a4c5['rows']=_0x5b0537;return _0x44a4c5;})[_0x2e83('0x27')](respondWithFilteredResult(_0x1fbb79,_0x3c8df1))['catch'](handleError(_0x1fbb79,null));};exports['show']=function(_0x1fc8e1,_0x57c4ca){var _0x3786a3={'raw':![],'where':{'id':_0x1fc8e1[_0x2e83('0x45')]['id']}},_0x2d58ad={};_0x2d58ad[_0x2e83('0x31')]=_[_0x2e83('0x33')](db[_0x2e83('0x2e')][_0x2e83('0x2f')]);_0x2d58ad['query']=_[_0x2e83('0x33')](_0x1fc8e1[_0x2e83('0x32')]);_0x2d58ad[_0x2e83('0x3d')]=_['intersection'](_0x2d58ad[_0x2e83('0x31')],_0x2d58ad[_0x2e83('0x32')]);_0x3786a3[_0x2e83('0x36')]=_['intersection'](_0x2d58ad[_0x2e83('0x31')],qs[_0x2e83('0x35')](_0x1fc8e1['query'][_0x2e83('0x35')]));_0x3786a3['attributes']=_0x3786a3['attributes'][_0x2e83('0x37')]?_0x3786a3[_0x2e83('0x36')]:_0x2d58ad['model'];if(_0x1fc8e1['query'][_0x2e83('0x42')]){_0x3786a3[_0x2e83('0x43')]=[{'all':!![]}];}_0x3786a3=_[_0x2e83('0x46')]({},_0x3786a3,_0x1fc8e1['options']);return db['ServicenowConfiguration'][_0x2e83('0x47')](_0x3786a3)[_0x2e83('0x27')](handleEntityNotFound(_0x57c4ca,null))['then'](respondWithResult(_0x57c4ca,null))[_0x2e83('0x48')](handleError(_0x57c4ca,null));};exports[_0x2e83('0x49')]=function(_0x24ae06,_0x38ec84){return db[_0x2e83('0x2e')][_0x2e83('0x49')](_0x24ae06[_0x2e83('0x4a')],{})[_0x2e83('0x27')](respondWithResult(_0x38ec84,0xc9))[_0x2e83('0x48')](handleError(_0x38ec84,null));};exports[_0x2e83('0x4b')]=function(_0x374c1a,_0x187928){if(_0x374c1a['body']['id']){delete _0x374c1a['body']['id'];}return db['ServicenowConfiguration'][_0x2e83('0x47')]({'where':{'id':_0x374c1a['params']['id']}})[_0x2e83('0x27')](handleEntityNotFound(_0x187928,null))[_0x2e83('0x27')](saveUpdates(_0x374c1a[_0x2e83('0x4a')],null))[_0x2e83('0x27')](respondWithResult(_0x187928,null))[_0x2e83('0x48')](handleError(_0x187928,null));};exports[_0x2e83('0x28')]=function(_0x419970,_0x25fee8){return db[_0x2e83('0x2e')][_0x2e83('0x47')]({'where':{'id':_0x419970[_0x2e83('0x45')]['id']}})[_0x2e83('0x27')](handleEntityNotFound(_0x25fee8,null))[_0x2e83('0x27')](removeEntity(_0x25fee8,null))[_0x2e83('0x48')](handleError(_0x25fee8,null));};exports[_0x2e83('0x4c')]=function(_0x20f60d,_0x5c5c7f,_0x1186df){var _0xa196d5={};var _0x5de61c={};var _0x2b7960;var _0x4f6d76;return db[_0x2e83('0x2e')][_0x2e83('0x4d')]({'where':{'id':_0x20f60d[_0x2e83('0x45')]['id']}})[_0x2e83('0x27')](handleEntityNotFound(_0x5c5c7f,null))[_0x2e83('0x27')](function(_0xf507e6){if(_0xf507e6){_0x2b7960=_0xf507e6;_0x5de61c['model']=_[_0x2e83('0x33')](db[_0x2e83('0x4e')]['rawAttributes']);_0x5de61c[_0x2e83('0x32')]=_[_0x2e83('0x33')](_0x20f60d[_0x2e83('0x32')]);_0x5de61c[_0x2e83('0x3d')]=_[_0x2e83('0x34')](_0x5de61c[_0x2e83('0x31')],_0x5de61c[_0x2e83('0x32')]);_0xa196d5[_0x2e83('0x36')]=_[_0x2e83('0x34')](_0x5de61c[_0x2e83('0x31')],qs['fields'](_0x20f60d[_0x2e83('0x32')]['fields']));_0xa196d5[_0x2e83('0x36')]=_0xa196d5[_0x2e83('0x36')]['length']?_0xa196d5['attributes']:_0x5de61c[_0x2e83('0x31')];_0xa196d5[_0x2e83('0x3a')]=qs[_0x2e83('0x3b')](_0x20f60d[_0x2e83('0x32')][_0x2e83('0x3b')]);_0xa196d5['where']=qs[_0x2e83('0x3d')](_[_0x2e83('0x3e')](_0x20f60d[_0x2e83('0x32')],_0x5de61c['filters']));if(_0x20f60d[_0x2e83('0x32')]['filter']){_0xa196d5[_0x2e83('0x3c')]=_[_0x2e83('0x46')](_0xa196d5[_0x2e83('0x3c')],{'$or':_[_0x2e83('0x2d')](_0xa196d5[_0x2e83('0x36')],function(_0x5dfccf){var _0x5ec86d={};_0x5ec86d[_0x5dfccf]={'$like':'%'+_0x20f60d[_0x2e83('0x32')][_0x2e83('0x3f')]+'%'};return _0x5ec86d;})});}_0xa196d5=_[_0x2e83('0x46')]({},_0xa196d5,_0x20f60d[_0x2e83('0x4f')]);return _0x2b7960[_0x2e83('0x4c')](_0xa196d5);}})['then'](function(_0x1235e7){if(_0x1235e7){_0x4f6d76=_0x1235e7[_0x2e83('0x37')];if(!_0x20f60d['query'][_0x2e83('0x38')](_0x2e83('0x39'))){_0xa196d5[_0x2e83('0x1f')]=qs[_0x2e83('0x1f')](_0x20f60d[_0x2e83('0x32')][_0x2e83('0x1f')]);_0xa196d5[_0x2e83('0x1d')]=qs[_0x2e83('0x1d')](_0x20f60d[_0x2e83('0x32')][_0x2e83('0x1d')]);}return _0x2b7960['getFields'](_0xa196d5);}})[_0x2e83('0x27')](function(_0x1bab3f){if(_0x1bab3f){return _0x1bab3f?{'count':_0x4f6d76,'rows':_0x1bab3f}:null;}})['then'](respondWithResult(_0x5c5c7f,null))[_0x2e83('0x48')](handleError(_0x5c5c7f,null));};exports[_0x2e83('0x50')]=function(_0x1df823,_0x2c167f,_0x3ec9bd){var _0x4d3ad9={};var _0x464796={};var _0x273887;var _0x4d6fb3;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x1df823['params']['id']}})[_0x2e83('0x27')](handleEntityNotFound(_0x2c167f,null))[_0x2e83('0x27')](function(_0x182f3){if(_0x182f3){_0x273887=_0x182f3;_0x464796[_0x2e83('0x31')]=_['keys'](db[_0x2e83('0x4e')][_0x2e83('0x2f')]);_0x464796[_0x2e83('0x32')]=_[_0x2e83('0x33')](_0x1df823['query']);_0x464796[_0x2e83('0x3d')]=_[_0x2e83('0x34')](_0x464796[_0x2e83('0x31')],_0x464796['query']);_0x4d3ad9[_0x2e83('0x36')]=_[_0x2e83('0x34')](_0x464796[_0x2e83('0x31')],qs[_0x2e83('0x35')](_0x1df823['query'][_0x2e83('0x35')]));_0x4d3ad9[_0x2e83('0x36')]=_0x4d3ad9[_0x2e83('0x36')][_0x2e83('0x37')]?_0x4d3ad9[_0x2e83('0x36')]:_0x464796[_0x2e83('0x31')];_0x4d3ad9[_0x2e83('0x3a')]=qs[_0x2e83('0x3b')](_0x1df823[_0x2e83('0x32')][_0x2e83('0x3b')]);_0x4d3ad9[_0x2e83('0x3c')]=qs['filters'](_[_0x2e83('0x3e')](_0x1df823[_0x2e83('0x32')],_0x464796[_0x2e83('0x3d')]));if(_0x1df823[_0x2e83('0x32')]['filter']){_0x4d3ad9[_0x2e83('0x3c')]=_[_0x2e83('0x46')](_0x4d3ad9[_0x2e83('0x3c')],{'$or':_[_0x2e83('0x2d')](_0x4d3ad9[_0x2e83('0x36')],function(_0x103c69){var _0xe0c289={};_0xe0c289[_0x103c69]={'$like':'%'+_0x1df823[_0x2e83('0x32')][_0x2e83('0x3f')]+'%'};return _0xe0c289;})});}_0x4d3ad9=_['merge']({},_0x4d3ad9,_0x1df823['options']);return _0x273887[_0x2e83('0x50')](_0x4d3ad9);}})['then'](function(_0x2c30bf){if(_0x2c30bf){_0x4d6fb3=_0x2c30bf['length'];if(!_0x1df823[_0x2e83('0x32')][_0x2e83('0x38')](_0x2e83('0x39'))){_0x4d3ad9[_0x2e83('0x1f')]=qs['limit'](_0x1df823[_0x2e83('0x32')][_0x2e83('0x1f')]);_0x4d3ad9[_0x2e83('0x1d')]=qs['offset'](_0x1df823[_0x2e83('0x32')][_0x2e83('0x1d')]);}return _0x273887[_0x2e83('0x50')](_0x4d3ad9);}})[_0x2e83('0x27')](function(_0xa85441){if(_0xa85441){return _0xa85441?{'count':_0x4d6fb3,'rows':_0xa85441}:null;}})[_0x2e83('0x27')](respondWithResult(_0x2c167f,null))[_0x2e83('0x48')](handleError(_0x2c167f,null));};exports[_0x2e83('0x51')]=function(_0x3b1dbc,_0x405520,_0x43e43f){var _0x14b6fa={};var _0xa9106a={};var _0x1ee4df;var _0xfd4645;return db[_0x2e83('0x2e')][_0x2e83('0x4d')]({'where':{'id':_0x3b1dbc[_0x2e83('0x45')]['id']}})[_0x2e83('0x27')](handleEntityNotFound(_0x405520,null))[_0x2e83('0x27')](function(_0x400e5b){if(_0x400e5b){_0x1ee4df=_0x400e5b;_0xa9106a['model']=_[_0x2e83('0x33')](db[_0x2e83('0x4e')][_0x2e83('0x2f')]);_0xa9106a[_0x2e83('0x32')]=_[_0x2e83('0x33')](_0x3b1dbc[_0x2e83('0x32')]);_0xa9106a[_0x2e83('0x3d')]=_['intersection'](_0xa9106a[_0x2e83('0x31')],_0xa9106a[_0x2e83('0x32')]);_0x14b6fa[_0x2e83('0x36')]=_[_0x2e83('0x34')](_0xa9106a[_0x2e83('0x31')],qs[_0x2e83('0x35')](_0x3b1dbc[_0x2e83('0x32')][_0x2e83('0x35')]));_0x14b6fa['attributes']=_0x14b6fa['attributes'][_0x2e83('0x37')]?_0x14b6fa['attributes']:_0xa9106a[_0x2e83('0x31')];_0x14b6fa[_0x2e83('0x3a')]=qs[_0x2e83('0x3b')](_0x3b1dbc[_0x2e83('0x32')][_0x2e83('0x3b')]);_0x14b6fa['where']=qs['filters'](_[_0x2e83('0x3e')](_0x3b1dbc[_0x2e83('0x32')],_0xa9106a['filters']));if(_0x3b1dbc[_0x2e83('0x32')][_0x2e83('0x3f')]){_0x14b6fa[_0x2e83('0x3c')]=_[_0x2e83('0x46')](_0x14b6fa[_0x2e83('0x3c')],{'$or':_['map'](_0x14b6fa[_0x2e83('0x36')],function(_0x54c272){var _0x1720d8={};_0x1720d8[_0x54c272]={'$like':'%'+_0x3b1dbc[_0x2e83('0x32')][_0x2e83('0x3f')]+'%'};return _0x1720d8;})});}_0x14b6fa=_[_0x2e83('0x46')]({},_0x14b6fa,_0x3b1dbc[_0x2e83('0x4f')]);return _0x1ee4df['getDescriptions'](_0x14b6fa);}})[_0x2e83('0x27')](function(_0x49dc52){if(_0x49dc52){_0xfd4645=_0x49dc52[_0x2e83('0x37')];if(!_0x3b1dbc[_0x2e83('0x32')][_0x2e83('0x38')](_0x2e83('0x39'))){_0x14b6fa[_0x2e83('0x1f')]=qs[_0x2e83('0x1f')](_0x3b1dbc[_0x2e83('0x32')][_0x2e83('0x1f')]);_0x14b6fa[_0x2e83('0x1d')]=qs[_0x2e83('0x1d')](_0x3b1dbc[_0x2e83('0x32')]['offset']);}return _0x1ee4df[_0x2e83('0x51')](_0x14b6fa);}})[_0x2e83('0x27')](function(_0x23200b){if(_0x23200b){return _0x23200b?{'count':_0xfd4645,'rows':_0x23200b}:null;}})[_0x2e83('0x27')](respondWithResult(_0x405520,null))[_0x2e83('0x48')](handleError(_0x405520,null));}; \ No newline at end of file +var _0x2208=['intersection','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','ServicenowConfiguration','includeAll','include','findAll','rows','show','catch','create','body','find','params','getFields','findOne','ServicenowField','order','pick','options','hasOwnProperty','getSubjects','getDescriptions','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters'];(function(_0x3a8ba8,_0x5a0683){var _0x2a3894=function(_0x34c550){while(--_0x34c550){_0x3a8ba8['push'](_0x3a8ba8['shift']());}};_0x2a3894(++_0x5a0683);}(_0x2208,0xc0));var _0x8220=function(_0x10c246,_0x5c2c32){_0x10c246=_0x10c246-0x0;var _0x56c74c=_0x2208[_0x10c246];return _0x56c74c;};'use strict';var emlformat=require(_0x8220('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8220('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8220('0x2'));var moment=require(_0x8220('0x3'));var BPromise=require(_0x8220('0x4'));var Mustache=require(_0x8220('0x5'));var util=require(_0x8220('0x6'));var path=require(_0x8220('0x7'));var sox=require(_0x8220('0x8'));var csv=require(_0x8220('0x9'));var ejs=require(_0x8220('0xa'));var fs=require('fs');var fs_extra=require(_0x8220('0xb'));var _=require(_0x8220('0xc'));var squel=require(_0x8220('0xd'));var crypto=require(_0x8220('0xe'));var jsforce=require(_0x8220('0xf'));var deskjs=require(_0x8220('0x10'));var toCsv=require(_0x8220('0x9'));var querystring=require(_0x8220('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8220('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8220('0x13'));var logger=require('../../config/logger')(_0x8220('0x14'));var utils=require(_0x8220('0x15'));var config=require(_0x8220('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8220('0x17'))['db'];function respondWithStatusCode(_0x55125a,_0x5aed3e){_0x5aed3e=_0x5aed3e||0xcc;return function(_0x74c654){if(_0x74c654){return _0x55125a['sendStatus'](_0x5aed3e);}return _0x55125a[_0x8220('0x18')](_0x5aed3e)[_0x8220('0x19')]();};}function respondWithResult(_0x14012c,_0x493d35){_0x493d35=_0x493d35||0xc8;return function(_0x33b3e9){if(_0x33b3e9){return _0x14012c[_0x8220('0x18')](_0x493d35)['json'](_0x33b3e9);}};}function respondWithFilteredResult(_0x1b2545,_0x61f22a){return function(_0x2df76a){if(_0x2df76a){var _0x2ee3ce=typeof _0x61f22a['offset']===_0x8220('0x1a')&&typeof _0x61f22a[_0x8220('0x1b')]==='undefined';var _0x263c9a=_0x2df76a['count'];var _0x5710fa=_0x2ee3ce?0x0:_0x61f22a[_0x8220('0x1c')];var _0x42735c=_0x2ee3ce?_0x2df76a[_0x8220('0x1d')]:_0x61f22a[_0x8220('0x1c')]+_0x61f22a[_0x8220('0x1b')];var _0x2b2461;if(_0x42735c>=_0x263c9a){_0x42735c=_0x263c9a;_0x2b2461=0xc8;}else{_0x2b2461=0xce;}_0x1b2545[_0x8220('0x18')](_0x2b2461);return _0x1b2545[_0x8220('0x1e')](_0x8220('0x1f'),_0x5710fa+'-'+_0x42735c+'/'+_0x263c9a)[_0x8220('0x20')](_0x2df76a);}return null;};}function patchUpdates(_0x18970b){return function(_0x42479c){try{jsonpatch[_0x8220('0x21')](_0x42479c,_0x18970b,!![]);}catch(_0x400b61){return BPromise[_0x8220('0x22')](_0x400b61);}return _0x42479c['save']();};}function saveUpdates(_0x19e126,_0x1e1a2d){return function(_0x392ccd){if(_0x392ccd){return _0x392ccd[_0x8220('0x23')](_0x19e126)[_0x8220('0x24')](function(_0xd2a7e1){return _0xd2a7e1;});}return null;};}function removeEntity(_0x597ad1,_0x240646){return function(_0x433da0){if(_0x433da0){return _0x433da0[_0x8220('0x25')]()[_0x8220('0x24')](function(){_0x597ad1[_0x8220('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5137e7,_0x1aed4d){return function(_0x790ad){if(!_0x790ad){_0x5137e7[_0x8220('0x26')](0x194);}return _0x790ad;};}function handleError(_0x522d59,_0x272cb0){_0x272cb0=_0x272cb0||0x1f4;return function(_0x7a07f6){logger[_0x8220('0x27')](_0x7a07f6['stack']);if(_0x7a07f6[_0x8220('0x28')]){delete _0x7a07f6[_0x8220('0x28')];}_0x522d59['status'](_0x272cb0)[_0x8220('0x29')](_0x7a07f6);};}exports[_0x8220('0x2a')]=function(_0x3e124f,_0xe3e884){var _0x3952fc={},_0x4da58b={},_0x30edec={'count':0x0,'rows':[]};var _0x45fd94=_[_0x8220('0x2b')](db['ServicenowConfiguration'][_0x8220('0x2c')],function(_0x44a077){return{'name':_0x44a077['fieldName'],'type':_0x44a077[_0x8220('0x2d')][_0x8220('0x2e')]};});_0x4da58b[_0x8220('0x2f')]=_[_0x8220('0x2b')](_0x45fd94,_0x8220('0x28'));_0x4da58b[_0x8220('0x30')]=_[_0x8220('0x31')](_0x3e124f[_0x8220('0x30')]);_0x4da58b[_0x8220('0x32')]=_[_0x8220('0x33')](_0x4da58b[_0x8220('0x2f')],_0x4da58b[_0x8220('0x30')]);_0x3952fc[_0x8220('0x34')]=_[_0x8220('0x33')](_0x4da58b[_0x8220('0x2f')],qs[_0x8220('0x35')](_0x3e124f[_0x8220('0x30')][_0x8220('0x35')]));_0x3952fc[_0x8220('0x34')]=_0x3952fc[_0x8220('0x34')][_0x8220('0x36')]?_0x3952fc[_0x8220('0x34')]:_0x4da58b[_0x8220('0x2f')];if(!_0x3e124f[_0x8220('0x30')]['hasOwnProperty'](_0x8220('0x37'))){_0x3952fc['limit']=qs[_0x8220('0x1b')](_0x3e124f[_0x8220('0x30')][_0x8220('0x1b')]);_0x3952fc['offset']=qs[_0x8220('0x1c')](_0x3e124f['query'][_0x8220('0x1c')]);}_0x3952fc['order']=qs[_0x8220('0x38')](_0x3e124f[_0x8220('0x30')][_0x8220('0x38')]);_0x3952fc[_0x8220('0x39')]=qs[_0x8220('0x32')](_['pick'](_0x3e124f[_0x8220('0x30')],_0x4da58b[_0x8220('0x32')]),_0x45fd94);if(_0x3e124f['query'][_0x8220('0x3a')]){_0x3952fc[_0x8220('0x39')]=_[_0x8220('0x3b')](_0x3952fc[_0x8220('0x39')],{'$or':_[_0x8220('0x2b')](_0x45fd94,function(_0x1981d3){if(_0x1981d3[_0x8220('0x2d')]!==_0x8220('0x3c')){var _0x2c889c={};_0x2c889c[_0x1981d3[_0x8220('0x28')]]={'$like':'%'+_0x3e124f['query'][_0x8220('0x3a')]+'%'};return _0x2c889c;}})});}_0x3952fc=_[_0x8220('0x3b')]({},_0x3952fc,_0x3e124f['options']);var _0x34d006={'where':_0x3952fc[_0x8220('0x39')]};return db[_0x8220('0x3d')]['count'](_0x34d006)[_0x8220('0x24')](function(_0x221d46){_0x30edec[_0x8220('0x1d')]=_0x221d46;if(_0x3e124f[_0x8220('0x30')][_0x8220('0x3e')]){_0x3952fc[_0x8220('0x3f')]=[{'all':!![]}];}return db[_0x8220('0x3d')][_0x8220('0x40')](_0x3952fc);})['then'](function(_0x3b7108){_0x30edec[_0x8220('0x41')]=_0x3b7108;return _0x30edec;})[_0x8220('0x24')](respondWithFilteredResult(_0xe3e884,_0x3952fc))['catch'](handleError(_0xe3e884,null));};exports[_0x8220('0x42')]=function(_0x2f4522,_0x8a482a){var _0x357ccb={'raw':![],'where':{'id':_0x2f4522['params']['id']}},_0x5e8876={};_0x5e8876[_0x8220('0x2f')]=_['keys'](db[_0x8220('0x3d')][_0x8220('0x2c')]);_0x5e8876[_0x8220('0x30')]=_[_0x8220('0x31')](_0x2f4522[_0x8220('0x30')]);_0x5e8876[_0x8220('0x32')]=_[_0x8220('0x33')](_0x5e8876['model'],_0x5e8876['query']);_0x357ccb['attributes']=_[_0x8220('0x33')](_0x5e8876[_0x8220('0x2f')],qs['fields'](_0x2f4522['query']['fields']));_0x357ccb['attributes']=_0x357ccb[_0x8220('0x34')]['length']?_0x357ccb['attributes']:_0x5e8876['model'];if(_0x2f4522[_0x8220('0x30')][_0x8220('0x3e')]){_0x357ccb['include']=[{'all':!![]}];}_0x357ccb=_[_0x8220('0x3b')]({},_0x357ccb,_0x2f4522['options']);return db[_0x8220('0x3d')]['find'](_0x357ccb)[_0x8220('0x24')](handleEntityNotFound(_0x8a482a,null))[_0x8220('0x24')](respondWithResult(_0x8a482a,null))[_0x8220('0x43')](handleError(_0x8a482a,null));};exports['create']=function(_0x35abcf,_0x5692e4){return db['ServicenowConfiguration'][_0x8220('0x44')](_0x35abcf[_0x8220('0x45')],{})[_0x8220('0x24')](respondWithResult(_0x5692e4,0xc9))[_0x8220('0x43')](handleError(_0x5692e4,null));};exports[_0x8220('0x23')]=function(_0x1c0910,_0x49804d){if(_0x1c0910[_0x8220('0x45')]['id']){delete _0x1c0910['body']['id'];}return db['ServicenowConfiguration'][_0x8220('0x46')]({'where':{'id':_0x1c0910[_0x8220('0x47')]['id']}})['then'](handleEntityNotFound(_0x49804d,null))[_0x8220('0x24')](saveUpdates(_0x1c0910[_0x8220('0x45')],null))['then'](respondWithResult(_0x49804d,null))['catch'](handleError(_0x49804d,null));};exports[_0x8220('0x25')]=function(_0x41ebb3,_0x1e86ed){return db['ServicenowConfiguration']['find']({'where':{'id':_0x41ebb3[_0x8220('0x47')]['id']}})['then'](handleEntityNotFound(_0x1e86ed,null))[_0x8220('0x24')](removeEntity(_0x1e86ed,null))['catch'](handleError(_0x1e86ed,null));};exports[_0x8220('0x48')]=function(_0x736760,_0x1b3ef0,_0x2c8e97){var _0x4d401c={};var _0x1e1161={};var _0x4943fe;var _0x300178;return db[_0x8220('0x3d')][_0x8220('0x49')]({'where':{'id':_0x736760[_0x8220('0x47')]['id']}})[_0x8220('0x24')](handleEntityNotFound(_0x1b3ef0,null))[_0x8220('0x24')](function(_0x41e608){if(_0x41e608){_0x4943fe=_0x41e608;_0x1e1161[_0x8220('0x2f')]=_[_0x8220('0x31')](db[_0x8220('0x4a')]['rawAttributes']);_0x1e1161[_0x8220('0x30')]=_[_0x8220('0x31')](_0x736760[_0x8220('0x30')]);_0x1e1161[_0x8220('0x32')]=_[_0x8220('0x33')](_0x1e1161[_0x8220('0x2f')],_0x1e1161[_0x8220('0x30')]);_0x4d401c[_0x8220('0x34')]=_[_0x8220('0x33')](_0x1e1161[_0x8220('0x2f')],qs[_0x8220('0x35')](_0x736760[_0x8220('0x30')][_0x8220('0x35')]));_0x4d401c[_0x8220('0x34')]=_0x4d401c['attributes']['length']?_0x4d401c[_0x8220('0x34')]:_0x1e1161[_0x8220('0x2f')];_0x4d401c[_0x8220('0x4b')]=qs[_0x8220('0x38')](_0x736760['query']['sort']);_0x4d401c[_0x8220('0x39')]=qs[_0x8220('0x32')](_[_0x8220('0x4c')](_0x736760['query'],_0x1e1161['filters']));if(_0x736760['query'][_0x8220('0x3a')]){_0x4d401c[_0x8220('0x39')]=_[_0x8220('0x3b')](_0x4d401c[_0x8220('0x39')],{'$or':_['map'](_0x4d401c[_0x8220('0x34')],function(_0x136c4d){var _0x15b4d8={};_0x15b4d8[_0x136c4d]={'$like':'%'+_0x736760[_0x8220('0x30')]['filter']+'%'};return _0x15b4d8;})});}_0x4d401c=_[_0x8220('0x3b')]({},_0x4d401c,_0x736760[_0x8220('0x4d')]);return _0x4943fe['getFields'](_0x4d401c);}})[_0x8220('0x24')](function(_0xaec2df){if(_0xaec2df){_0x300178=_0xaec2df[_0x8220('0x36')];if(!_0x736760['query'][_0x8220('0x4e')](_0x8220('0x37'))){_0x4d401c[_0x8220('0x1b')]=qs['limit'](_0x736760[_0x8220('0x30')][_0x8220('0x1b')]);_0x4d401c['offset']=qs[_0x8220('0x1c')](_0x736760[_0x8220('0x30')][_0x8220('0x1c')]);}return _0x4943fe[_0x8220('0x48')](_0x4d401c);}})[_0x8220('0x24')](function(_0x3dc42a){if(_0x3dc42a){return _0x3dc42a?{'count':_0x300178,'rows':_0x3dc42a}:null;}})['then'](respondWithResult(_0x1b3ef0,null))[_0x8220('0x43')](handleError(_0x1b3ef0,null));};exports[_0x8220('0x4f')]=function(_0x203d41,_0x5c2e69,_0x5140a1){var _0x54f1a7={};var _0x4f8208={};var _0x38c0ed;var _0x1fe8af;return db[_0x8220('0x3d')]['findOne']({'where':{'id':_0x203d41[_0x8220('0x47')]['id']}})['then'](handleEntityNotFound(_0x5c2e69,null))[_0x8220('0x24')](function(_0x5c575e){if(_0x5c575e){_0x38c0ed=_0x5c575e;_0x4f8208[_0x8220('0x2f')]=_[_0x8220('0x31')](db['ServicenowField'][_0x8220('0x2c')]);_0x4f8208[_0x8220('0x30')]=_[_0x8220('0x31')](_0x203d41[_0x8220('0x30')]);_0x4f8208[_0x8220('0x32')]=_[_0x8220('0x33')](_0x4f8208[_0x8220('0x2f')],_0x4f8208['query']);_0x54f1a7[_0x8220('0x34')]=_[_0x8220('0x33')](_0x4f8208['model'],qs['fields'](_0x203d41['query'][_0x8220('0x35')]));_0x54f1a7[_0x8220('0x34')]=_0x54f1a7['attributes']['length']?_0x54f1a7[_0x8220('0x34')]:_0x4f8208[_0x8220('0x2f')];_0x54f1a7[_0x8220('0x4b')]=qs[_0x8220('0x38')](_0x203d41[_0x8220('0x30')][_0x8220('0x38')]);_0x54f1a7[_0x8220('0x39')]=qs[_0x8220('0x32')](_[_0x8220('0x4c')](_0x203d41['query'],_0x4f8208[_0x8220('0x32')]));if(_0x203d41[_0x8220('0x30')][_0x8220('0x3a')]){_0x54f1a7[_0x8220('0x39')]=_[_0x8220('0x3b')](_0x54f1a7[_0x8220('0x39')],{'$or':_['map'](_0x54f1a7[_0x8220('0x34')],function(_0x40675c){var _0x1a3aab={};_0x1a3aab[_0x40675c]={'$like':'%'+_0x203d41[_0x8220('0x30')]['filter']+'%'};return _0x1a3aab;})});}_0x54f1a7=_[_0x8220('0x3b')]({},_0x54f1a7,_0x203d41[_0x8220('0x4d')]);return _0x38c0ed[_0x8220('0x4f')](_0x54f1a7);}})[_0x8220('0x24')](function(_0x1baebc){if(_0x1baebc){_0x1fe8af=_0x1baebc[_0x8220('0x36')];if(!_0x203d41[_0x8220('0x30')]['hasOwnProperty'](_0x8220('0x37'))){_0x54f1a7[_0x8220('0x1b')]=qs['limit'](_0x203d41[_0x8220('0x30')][_0x8220('0x1b')]);_0x54f1a7[_0x8220('0x1c')]=qs[_0x8220('0x1c')](_0x203d41['query'][_0x8220('0x1c')]);}return _0x38c0ed[_0x8220('0x4f')](_0x54f1a7);}})['then'](function(_0x7c4cf9){if(_0x7c4cf9){return _0x7c4cf9?{'count':_0x1fe8af,'rows':_0x7c4cf9}:null;}})[_0x8220('0x24')](respondWithResult(_0x5c2e69,null))[_0x8220('0x43')](handleError(_0x5c2e69,null));};exports[_0x8220('0x50')]=function(_0xccce04,_0x3c7eac,_0x395263){var _0x189491={};var _0x316544={};var _0x489fac;var _0x3f415d;return db[_0x8220('0x3d')][_0x8220('0x49')]({'where':{'id':_0xccce04[_0x8220('0x47')]['id']}})[_0x8220('0x24')](handleEntityNotFound(_0x3c7eac,null))[_0x8220('0x24')](function(_0x59c71b){if(_0x59c71b){_0x489fac=_0x59c71b;_0x316544[_0x8220('0x2f')]=_[_0x8220('0x31')](db[_0x8220('0x4a')][_0x8220('0x2c')]);_0x316544[_0x8220('0x30')]=_['keys'](_0xccce04[_0x8220('0x30')]);_0x316544[_0x8220('0x32')]=_[_0x8220('0x33')](_0x316544[_0x8220('0x2f')],_0x316544['query']);_0x189491['attributes']=_[_0x8220('0x33')](_0x316544[_0x8220('0x2f')],qs[_0x8220('0x35')](_0xccce04[_0x8220('0x30')][_0x8220('0x35')]));_0x189491[_0x8220('0x34')]=_0x189491[_0x8220('0x34')]['length']?_0x189491[_0x8220('0x34')]:_0x316544['model'];_0x189491[_0x8220('0x4b')]=qs[_0x8220('0x38')](_0xccce04[_0x8220('0x30')]['sort']);_0x189491['where']=qs['filters'](_['pick'](_0xccce04[_0x8220('0x30')],_0x316544['filters']));if(_0xccce04['query'][_0x8220('0x3a')]){_0x189491[_0x8220('0x39')]=_['merge'](_0x189491['where'],{'$or':_[_0x8220('0x2b')](_0x189491[_0x8220('0x34')],function(_0x49cc97){var _0x28ca89={};_0x28ca89[_0x49cc97]={'$like':'%'+_0xccce04[_0x8220('0x30')][_0x8220('0x3a')]+'%'};return _0x28ca89;})});}_0x189491=_[_0x8220('0x3b')]({},_0x189491,_0xccce04[_0x8220('0x4d')]);return _0x489fac[_0x8220('0x50')](_0x189491);}})[_0x8220('0x24')](function(_0x258adc){if(_0x258adc){_0x3f415d=_0x258adc[_0x8220('0x36')];if(!_0xccce04['query']['hasOwnProperty'](_0x8220('0x37'))){_0x189491[_0x8220('0x1b')]=qs[_0x8220('0x1b')](_0xccce04['query'][_0x8220('0x1b')]);_0x189491[_0x8220('0x1c')]=qs[_0x8220('0x1c')](_0xccce04[_0x8220('0x30')][_0x8220('0x1c')]);}return _0x489fac['getDescriptions'](_0x189491);}})[_0x8220('0x24')](function(_0x19f666){if(_0x19f666){return _0x19f666?{'count':_0x3f415d,'rows':_0x19f666}:null;}})[_0x8220('0x24')](respondWithResult(_0x3c7eac,null))[_0x8220('0x43')](handleError(_0x3c7eac,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index f7f25ea..7db77d2 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 _0x0cfa=['../../config/logger','api','moment','bluebird','path','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0cfa,0x73));var _0xa0cf=function(_0x1c2b11,_0x1ecdef){_0x1c2b11=_0x1c2b11-0x0;var _0x49f797=_0x0cfa[_0x1c2b11];return _0x49f797;};'use strict';var _=require(_0xa0cf('0x0'));var util=require(_0xa0cf('0x1'));var logger=require(_0xa0cf('0x2'))(_0xa0cf('0x3'));var moment=require(_0xa0cf('0x4'));var BPromise=require(_0xa0cf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa0cf('0x6'));var rimraf=require('rimraf');var config=require(_0xa0cf('0x7'));var attributes=require(_0xa0cf('0x8'));module[_0xa0cf('0x9')]=function(_0x265c33,_0x848d37){return _0x265c33[_0xa0cf('0xa')](_0xa0cf('0xb'),attributes,{'tableName':_0xa0cf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85ed=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','lodash','util'];(function(_0x37ef93,_0x8b26a6){var _0xa47012=function(_0x4c2ad8){while(--_0x4c2ad8){_0x37ef93['push'](_0x37ef93['shift']());}};_0xa47012(++_0x8b26a6);}(_0x85ed,0x66));var _0xd85e=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0x85ed[_0x2601b4];return _0x3e3661;};'use strict';var _=require(_0xd85e('0x0'));var util=require(_0xd85e('0x1'));var logger=require(_0xd85e('0x2'))(_0xd85e('0x3'));var moment=require(_0xd85e('0x4'));var BPromise=require(_0xd85e('0x5'));var rp=require(_0xd85e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd85e('0x7'));var config=require(_0xd85e('0x8'));var attributes=require(_0xd85e('0x9'));module[_0xd85e('0xa')]=function(_0x4decab,_0x442772){return _0x4decab[_0xd85e('0xb')]('ServicenowConfiguration',attributes,{'tableName':_0xd85e('0xc'),'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 28c9130..d7a40cb 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 _0x657b=['lodash','util','moment','bluebird','randomstring','ioredis','client','request','then','info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','ServicenowConfiguration,\x20%s,\x20%s','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x657b,0x98));var _0xb657=function(_0x404df3,_0x214ff3){_0x404df3=_0x404df3-0x0;var _0x29737b=_0x657b[_0x404df3];return _0x29737b;};'use strict';var _=require(_0xb657('0x0'));var util=require(_0xb657('0x1'));var moment=require(_0xb657('0x2'));var BPromise=require(_0xb657('0x3'));var rs=require(_0xb657('0x4'));var fs=require('fs');var Redis=require(_0xb657('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb657('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c18a5,_0x44dab9,_0x1023c9){return new BPromise(function(_0x5502cf,_0x5eb054){return client[_0xb657('0x7')](_0x1c18a5,_0x1023c9)[_0xb657('0x8')](function(_0x4c2e9d){logger[_0xb657('0x9')]('ServicenowConfiguration,\x20%s,\x20%s',_0x44dab9,_0xb657('0xa'));logger[_0xb657('0xb')](_0xb657('0xc'),_0x44dab9,_0xb657('0xa'),JSON['stringify'](_0x4c2e9d));if(_0x4c2e9d[_0xb657('0xd')]){if(_0x4c2e9d[_0xb657('0xd')][_0xb657('0xe')]===0x1f4){logger[_0xb657('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x44dab9,_0x4c2e9d['error'][_0xb657('0xf')]);return _0x5eb054(_0x4c2e9d['error'][_0xb657('0xf')]);}logger[_0xb657('0xd')](_0xb657('0x10'),_0x44dab9,_0x4c2e9d[_0xb657('0xd')]['message']);return _0x5502cf(_0x4c2e9d[_0xb657('0xd')][_0xb657('0xf')]);}else{logger[_0xb657('0x9')](_0xb657('0x10'),_0x44dab9,_0xb657('0xa'));_0x5502cf(_0x4c2e9d[_0xb657('0x11')]['message']);}})[_0xb657('0x12')](function(_0x16693c){logger[_0xb657('0xd')](_0xb657('0x10'),_0x44dab9,_0x16693c);_0x5eb054(_0x16693c);});});} \ No newline at end of file +var _0x8f5d=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x3885ce,_0x419b79){var _0x333333=function(_0x1de691){while(--_0x1de691){_0x3885ce['push'](_0x3885ce['shift']());}};_0x333333(++_0x419b79);}(_0x8f5d,0xb8));var _0xd8f5=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x8f5d[_0x25d386];return _0x857f4a;};'use strict';var _=require(_0xd8f5('0x0'));var util=require('util');var moment=require(_0xd8f5('0x1'));var BPromise=require(_0xd8f5('0x2'));var rs=require(_0xd8f5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd8f5('0x4'))['db'];var utils=require(_0xd8f5('0x5'));var logger=require('../../config/logger')(_0xd8f5('0x6'));var config=require(_0xd8f5('0x7'));var jayson=require(_0xd8f5('0x8'));var client=jayson[_0xd8f5('0x9')][_0xd8f5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12715d,_0x308372,_0x2d667c){return new BPromise(function(_0x2d1422,_0x567c63){return client[_0xd8f5('0xb')](_0x12715d,_0x2d667c)[_0xd8f5('0xc')](function(_0xd88b42){logger[_0xd8f5('0xd')](_0xd8f5('0xe'),_0x308372,'request\x20sent');logger[_0xd8f5('0xf')](_0xd8f5('0x10'),_0x308372,_0xd8f5('0x11'),JSON[_0xd8f5('0x12')](_0xd88b42));if(_0xd88b42[_0xd8f5('0x13')]){if(_0xd88b42[_0xd8f5('0x13')][_0xd8f5('0x14')]===0x1f4){logger[_0xd8f5('0x13')](_0xd8f5('0xe'),_0x308372,_0xd88b42['error'][_0xd8f5('0x15')]);return _0x567c63(_0xd88b42[_0xd8f5('0x13')][_0xd8f5('0x15')]);}logger[_0xd8f5('0x13')](_0xd8f5('0xe'),_0x308372,_0xd88b42[_0xd8f5('0x13')]['message']);return _0x2d1422(_0xd88b42[_0xd8f5('0x13')]['message']);}else{logger[_0xd8f5('0xd')](_0xd8f5('0xe'),_0x308372,_0xd8f5('0x11'));_0x2d1422(_0xd88b42[_0xd8f5('0x16')][_0xd8f5('0x15')]);}})['catch'](function(_0x55b796){logger[_0xd8f5('0x13')](_0xd8f5('0xe'),_0x308372,_0x55b796);_0x567c63(_0x55b796);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 3d97257..52247f5 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 _0xb9c2=['show','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','./intServicenowField.controller','get','isAuthenticated'];(function(_0x27380a,_0x11b4db){var _0x49557d=function(_0x11984a){while(--_0x11984a){_0x27380a['push'](_0x27380a['shift']());}};_0x49557d(++_0x11b4db);}(_0xb9c2,0xd5));var _0x2b9c=function(_0x9c8c83,_0x16ebdd){_0x9c8c83=_0x9c8c83-0x0;var _0x4636ac=_0xb9c2[_0x9c8c83];return _0x4636ac;};'use strict';var multer=require('multer');var util=require(_0x2b9c('0x0'));var path=require(_0x2b9c('0x1'));var timeout=require(_0x2b9c('0x2'));var express=require(_0x2b9c('0x3'));var router=express[_0x2b9c('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(_0x2b9c('0x5'));router[_0x2b9c('0x6')]('/',auth[_0x2b9c('0x7')](),controller['index']);router['get']('/:id',auth[_0x2b9c('0x7')](),controller[_0x2b9c('0x8')]);router[_0x2b9c('0x9')]('/',auth['isAuthenticated'](),controller[_0x2b9c('0xa')]);router[_0x2b9c('0xb')](_0x2b9c('0xc'),auth['isAuthenticated'](),controller[_0x2b9c('0xd')]);router[_0x2b9c('0xe')](_0x2b9c('0xc'),auth['isAuthenticated'](),controller[_0x2b9c('0xf')]);module[_0x2b9c('0x10')]=router; \ No newline at end of file +var _0xaa81=['show','create','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','/:id'];(function(_0x2b949a,_0x41eba3){var _0x1e355b=function(_0x5d3ac4){while(--_0x5d3ac4){_0x2b949a['push'](_0x2b949a['shift']());}};_0x1e355b(++_0x41eba3);}(_0xaa81,0x95));var _0x1aa8=function(_0x3f292f,_0x52ce50){_0x3f292f=_0x3f292f-0x0;var _0x529a82=_0xaa81[_0x3f292f];return _0x529a82;};'use strict';var multer=require(_0x1aa8('0x0'));var util=require('util');var path=require(_0x1aa8('0x1'));var timeout=require(_0x1aa8('0x2'));var express=require(_0x1aa8('0x3'));var router=express[_0x1aa8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1aa8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1aa8('0x6'));var controller=require(_0x1aa8('0x7'));router[_0x1aa8('0x8')]('/',auth[_0x1aa8('0x9')](),controller['index']);router[_0x1aa8('0x8')](_0x1aa8('0xa'),auth[_0x1aa8('0x9')](),controller[_0x1aa8('0xb')]);router['post']('/',auth[_0x1aa8('0x9')](),controller[_0x1aa8('0xc')]);router['put'](_0x1aa8('0xa'),auth[_0x1aa8('0x9')](),controller[_0x1aa8('0xd')]);router[_0x1aa8('0xe')](_0x1aa8('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x1aa8('0xf')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 6cc04a6..4b23d2c 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 _0x0cdb=['ENUM','string','customVariable','picklist','STRING','BOOLEAN','sequelize'];(function(_0x2d203f,_0x3e6d07){var _0x4ea716=function(_0x8c6dea){while(--_0x8c6dea){_0x2d203f['push'](_0x2d203f['shift']());}};_0x4ea716(++_0x3e6d07);}(_0x0cdb,0x6f));var _0xb0cd=function(_0x44c742,_0x5d69a4){_0x44c742=_0x44c742-0x0;var _0x40fcf0=_0x0cdb[_0x44c742];return _0x40fcf0;};'use strict';var Sequelize=require(_0xb0cd('0x0'));module['exports']={'type':{'type':Sequelize[_0xb0cd('0x1')](_0xb0cd('0x2'),'variable',_0xb0cd('0x3'),'keyValue',_0xb0cd('0x4')),'defaultValue':_0xb0cd('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb0cd('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xb0cd('0x2'),'variable',_0xb0cd('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb0cd('0x5')]},'customField':{'type':Sequelize[_0xb0cd('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb0cd('0x5')]}}; \ No newline at end of file +var _0x82e9=['STRING','BOOLEAN','exports','ENUM','variable','customVariable','picklist','string'];(function(_0x26b622,_0x237e9e){var _0x58a028=function(_0xde1652){while(--_0xde1652){_0x26b622['push'](_0x26b622['shift']());}};_0x58a028(++_0x237e9e);}(_0x82e9,0x1b2));var _0x982e=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x82e9[_0x186376];return _0x2dbdd9;};'use strict';var Sequelize=require('sequelize');module[_0x982e('0x0')]={'type':{'type':Sequelize[_0x982e('0x1')]('string',_0x982e('0x2'),_0x982e('0x3'),'keyValue',_0x982e('0x4')),'defaultValue':_0x982e('0x5')},'content':{'type':Sequelize[_0x982e('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x982e('0x1')](_0x982e('0x5'),_0x982e('0x2'),_0x982e('0x3'))},'keyContent':{'type':Sequelize[_0x982e('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x982e('0x6')]},'customField':{'type':Sequelize[_0x982e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x982e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 0d8d62d..179a542 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 _0x8619=['sort','where','pick','filter','merge','include','findAll','catch','show','fields','includeAll','options','find','create','body','update','params','destroy','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','order'];(function(_0x2ef959,_0x554a29){var _0xe3120=function(_0x305a73){while(--_0x305a73){_0x2ef959['push'](_0x2ef959['shift']());}};_0xe3120(++_0x554a29);}(_0x8619,0x1c8));var _0x9861=function(_0x4ece16,_0x788e42){_0x4ece16=_0x4ece16-0x0;var _0x426749=_0x8619[_0x4ece16];return _0x426749;};'use strict';var emlformat=require(_0x9861('0x0'));var rimraf=require(_0x9861('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9861('0x2'));var rp=require('request-promise');var moment=require(_0x9861('0x3'));var BPromise=require(_0x9861('0x4'));var Mustache=require(_0x9861('0x5'));var util=require('util');var path=require(_0x9861('0x6'));var sox=require(_0x9861('0x7'));var csv=require('to-csv');var ejs=require(_0x9861('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9861('0x9'));var crypto=require(_0x9861('0xa'));var jsforce=require(_0x9861('0xb'));var deskjs=require(_0x9861('0xc'));var toCsv=require(_0x9861('0xd'));var querystring=require(_0x9861('0xe'));var Papa=require(_0x9861('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9861('0x10'));var as=require(_0x9861('0x11'));var hardwareService=require(_0x9861('0x12'));var logger=require(_0x9861('0x13'))('api');var utils=require(_0x9861('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9861('0x15'));var db=require(_0x9861('0x16'))['db'];function respondWithStatusCode(_0x43321a,_0x420fab){_0x420fab=_0x420fab||0xcc;return function(_0x4b4d08){if(_0x4b4d08){return _0x43321a[_0x9861('0x17')](_0x420fab);}return _0x43321a[_0x9861('0x18')](_0x420fab)[_0x9861('0x19')]();};}function respondWithResult(_0x498379,_0xd5f86b){_0xd5f86b=_0xd5f86b||0xc8;return function(_0x1a5dd5){if(_0x1a5dd5){return _0x498379[_0x9861('0x18')](_0xd5f86b)[_0x9861('0x1a')](_0x1a5dd5);}};}function respondWithFilteredResult(_0x294470,_0x2fb513){return function(_0x37ac47){if(_0x37ac47){var _0x5eb666=typeof _0x2fb513['offset']===_0x9861('0x1b')&&typeof _0x2fb513['limit']===_0x9861('0x1b');var _0x3de524=_0x37ac47[_0x9861('0x1c')];var _0x2c7077=_0x5eb666?0x0:_0x2fb513[_0x9861('0x1d')];var _0x57aed9=_0x5eb666?_0x37ac47[_0x9861('0x1c')]:_0x2fb513[_0x9861('0x1d')]+_0x2fb513[_0x9861('0x1e')];var _0x5ed8ee;if(_0x57aed9>=_0x3de524){_0x57aed9=_0x3de524;_0x5ed8ee=0xc8;}else{_0x5ed8ee=0xce;}_0x294470[_0x9861('0x18')](_0x5ed8ee);return _0x294470[_0x9861('0x1f')](_0x9861('0x20'),_0x2c7077+'-'+_0x57aed9+'/'+_0x3de524)[_0x9861('0x1a')](_0x37ac47);}return null;};}function patchUpdates(_0x29961a){return function(_0x278a66){try{jsonpatch[_0x9861('0x21')](_0x278a66,_0x29961a,!![]);}catch(_0x1d0593){return BPromise[_0x9861('0x22')](_0x1d0593);}return _0x278a66[_0x9861('0x23')]();};}function saveUpdates(_0x4a7b7e,_0xd3ce74){return function(_0xff57f3){if(_0xff57f3){return _0xff57f3['update'](_0x4a7b7e)[_0x9861('0x24')](function(_0x3e19b8){return _0x3e19b8;});}return null;};}function removeEntity(_0x411306,_0xc0b7a8){return function(_0x1fca38){if(_0x1fca38){return _0x1fca38['destroy']()['then'](function(){_0x411306[_0x9861('0x18')](0xcc)[_0x9861('0x19')]();});}};}function handleEntityNotFound(_0x3a6943,_0x3463a3){return function(_0x20fd9e){if(!_0x20fd9e){_0x3a6943[_0x9861('0x17')](0x194);}return _0x20fd9e;};}function handleError(_0x4a82d6,_0x485f77){_0x485f77=_0x485f77||0x1f4;return function(_0x794d38){logger[_0x9861('0x25')](_0x794d38[_0x9861('0x26')]);if(_0x794d38[_0x9861('0x27')]){delete _0x794d38[_0x9861('0x27')];}_0x4a82d6[_0x9861('0x18')](_0x485f77)[_0x9861('0x28')](_0x794d38);};}exports[_0x9861('0x29')]=function(_0x1fab86,_0x4175e1){var _0x494d7f={},_0xecf199={},_0x39567e={'count':0x0,'rows':[]};var _0x44b8c9=_[_0x9861('0x2a')](db[_0x9861('0x2b')][_0x9861('0x2c')],function(_0x3ddf25){return{'name':_0x3ddf25[_0x9861('0x2d')],'type':_0x3ddf25[_0x9861('0x2e')]['key']};});_0xecf199[_0x9861('0x2f')]=_['map'](_0x44b8c9,'name');_0xecf199[_0x9861('0x30')]=_[_0x9861('0x31')](_0x1fab86[_0x9861('0x30')]);_0xecf199[_0x9861('0x32')]=_[_0x9861('0x33')](_0xecf199['model'],_0xecf199[_0x9861('0x30')]);_0x494d7f[_0x9861('0x34')]=_[_0x9861('0x33')](_0xecf199['model'],qs['fields'](_0x1fab86[_0x9861('0x30')]['fields']));_0x494d7f['attributes']=_0x494d7f[_0x9861('0x34')][_0x9861('0x35')]?_0x494d7f[_0x9861('0x34')]:_0xecf199[_0x9861('0x2f')];if(!_0x1fab86[_0x9861('0x30')]['hasOwnProperty']('nolimit')){_0x494d7f[_0x9861('0x1e')]=qs[_0x9861('0x1e')](_0x1fab86[_0x9861('0x30')][_0x9861('0x1e')]);_0x494d7f[_0x9861('0x1d')]=qs[_0x9861('0x1d')](_0x1fab86[_0x9861('0x30')][_0x9861('0x1d')]);}_0x494d7f[_0x9861('0x36')]=qs['sort'](_0x1fab86[_0x9861('0x30')][_0x9861('0x37')]);_0x494d7f[_0x9861('0x38')]=qs[_0x9861('0x32')](_[_0x9861('0x39')](_0x1fab86[_0x9861('0x30')],_0xecf199[_0x9861('0x32')]),_0x44b8c9);if(_0x1fab86[_0x9861('0x30')][_0x9861('0x3a')]){_0x494d7f['where']=_['merge'](_0x494d7f[_0x9861('0x38')],{'$or':_[_0x9861('0x2a')](_0x44b8c9,function(_0x2f81ba){if(_0x2f81ba[_0x9861('0x2e')]!=='VIRTUAL'){var _0xf4411b={};_0xf4411b[_0x2f81ba[_0x9861('0x27')]]={'$like':'%'+_0x1fab86[_0x9861('0x30')][_0x9861('0x3a')]+'%'};return _0xf4411b;}})});}_0x494d7f=_[_0x9861('0x3b')]({},_0x494d7f,_0x1fab86['options']);var _0x8693f9={'where':_0x494d7f[_0x9861('0x38')]};return db[_0x9861('0x2b')][_0x9861('0x1c')](_0x8693f9)[_0x9861('0x24')](function(_0x454bbe){_0x39567e[_0x9861('0x1c')]=_0x454bbe;if(_0x1fab86['query']['includeAll']){_0x494d7f[_0x9861('0x3c')]=[{'all':!![]}];}return db[_0x9861('0x2b')][_0x9861('0x3d')](_0x494d7f);})[_0x9861('0x24')](function(_0x1d5db2){_0x39567e['rows']=_0x1d5db2;return _0x39567e;})[_0x9861('0x24')](respondWithFilteredResult(_0x4175e1,_0x494d7f))[_0x9861('0x3e')](handleError(_0x4175e1,null));};exports[_0x9861('0x3f')]=function(_0x2efae8,_0x7c35dc){var _0x5500a9={'raw':!![],'where':{'id':_0x2efae8['params']['id']}},_0x466491={};_0x466491[_0x9861('0x2f')]=_[_0x9861('0x31')](db['ServicenowField'][_0x9861('0x2c')]);_0x466491['query']=_['keys'](_0x2efae8[_0x9861('0x30')]);_0x466491['filters']=_['intersection'](_0x466491[_0x9861('0x2f')],_0x466491['query']);_0x5500a9[_0x9861('0x34')]=_[_0x9861('0x33')](_0x466491['model'],qs[_0x9861('0x40')](_0x2efae8[_0x9861('0x30')][_0x9861('0x40')]));_0x5500a9[_0x9861('0x34')]=_0x5500a9[_0x9861('0x34')][_0x9861('0x35')]?_0x5500a9[_0x9861('0x34')]:_0x466491[_0x9861('0x2f')];if(_0x2efae8[_0x9861('0x30')][_0x9861('0x41')]){_0x5500a9[_0x9861('0x3c')]=[{'all':!![]}];}_0x5500a9=_[_0x9861('0x3b')]({},_0x5500a9,_0x2efae8[_0x9861('0x42')]);return db['ServicenowField'][_0x9861('0x43')](_0x5500a9)[_0x9861('0x24')](handleEntityNotFound(_0x7c35dc,null))[_0x9861('0x24')](respondWithResult(_0x7c35dc,null))['catch'](handleError(_0x7c35dc,null));};exports[_0x9861('0x44')]=function(_0xc87817,_0x4b875f){return db[_0x9861('0x2b')][_0x9861('0x44')](_0xc87817[_0x9861('0x45')],{})[_0x9861('0x24')](respondWithResult(_0x4b875f,0xc9))[_0x9861('0x3e')](handleError(_0x4b875f,null));};exports[_0x9861('0x46')]=function(_0x161825,_0x2236b8){if(_0x161825[_0x9861('0x45')]['id']){delete _0x161825['body']['id'];}return db[_0x9861('0x2b')][_0x9861('0x43')]({'where':{'id':_0x161825[_0x9861('0x47')]['id']}})[_0x9861('0x24')](handleEntityNotFound(_0x2236b8,null))['then'](saveUpdates(_0x161825['body'],null))[_0x9861('0x24')](respondWithResult(_0x2236b8,null))[_0x9861('0x3e')](handleError(_0x2236b8,null));};exports[_0x9861('0x48')]=function(_0x3b8bc3,_0x27a952){return db[_0x9861('0x2b')][_0x9861('0x43')]({'where':{'id':_0x3b8bc3['params']['id']}})[_0x9861('0x24')](handleEntityNotFound(_0x27a952,null))['then'](removeEntity(_0x27a952,null))[_0x9861('0x3e')](handleError(_0x27a952,null));}; \ No newline at end of file +var _0xa2f6=['undefined','limit','count','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','rawAttributes','fieldName','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','ServicenowField','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','offset'];(function(_0x1ef5c4,_0x14e675){var _0x55f13f=function(_0x16d2a4){while(--_0x16d2a4){_0x1ef5c4['push'](_0x1ef5c4['shift']());}};_0x55f13f(++_0x14e675);}(_0xa2f6,0x14b));var _0x6a2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa2f6[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6a2f('0x0'));var rimraf=require(_0x6a2f('0x1'));var zipdir=require(_0x6a2f('0x2'));var jsonpatch=require(_0x6a2f('0x3'));var rp=require('request-promise');var moment=require(_0x6a2f('0x4'));var BPromise=require(_0x6a2f('0x5'));var Mustache=require('mustache');var util=require(_0x6a2f('0x6'));var path=require(_0x6a2f('0x7'));var sox=require(_0x6a2f('0x8'));var csv=require(_0x6a2f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6a2f('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6a2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6a2f('0x9'));var querystring=require(_0x6a2f('0xc'));var Papa=require(_0x6a2f('0xd'));var Redis=require('ioredis');var authService=require(_0x6a2f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6a2f('0xf'));var hardwareService=require(_0x6a2f('0x10'));var logger=require(_0x6a2f('0x11'))(_0x6a2f('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6a2f('0x13'));var db=require(_0x6a2f('0x14'))['db'];function respondWithStatusCode(_0x86e0dd,_0x28a619){_0x28a619=_0x28a619||0xcc;return function(_0x12492b){if(_0x12492b){return _0x86e0dd['sendStatus'](_0x28a619);}return _0x86e0dd[_0x6a2f('0x15')](_0x28a619)[_0x6a2f('0x16')]();};}function respondWithResult(_0x2f985d,_0x1d82f6){_0x1d82f6=_0x1d82f6||0xc8;return function(_0x1756b3){if(_0x1756b3){return _0x2f985d[_0x6a2f('0x15')](_0x1d82f6)['json'](_0x1756b3);}};}function respondWithFilteredResult(_0x4693b4,_0x121458){return function(_0x1aa7aa){if(_0x1aa7aa){var _0x386a2c=typeof _0x121458[_0x6a2f('0x17')]===_0x6a2f('0x18')&&typeof _0x121458[_0x6a2f('0x19')]===_0x6a2f('0x18');var _0x9be3f0=_0x1aa7aa[_0x6a2f('0x1a')];var _0x5b08cf=_0x386a2c?0x0:_0x121458[_0x6a2f('0x17')];var _0x133f08=_0x386a2c?_0x1aa7aa[_0x6a2f('0x1a')]:_0x121458[_0x6a2f('0x17')]+_0x121458[_0x6a2f('0x19')];var _0x4a11f6;if(_0x133f08>=_0x9be3f0){_0x133f08=_0x9be3f0;_0x4a11f6=0xc8;}else{_0x4a11f6=0xce;}_0x4693b4[_0x6a2f('0x15')](_0x4a11f6);return _0x4693b4['set'](_0x6a2f('0x1b'),_0x5b08cf+'-'+_0x133f08+'/'+_0x9be3f0)['json'](_0x1aa7aa);}return null;};}function patchUpdates(_0x193f08){return function(_0x15e495){try{jsonpatch['apply'](_0x15e495,_0x193f08,!![]);}catch(_0x187442){return BPromise[_0x6a2f('0x1c')](_0x187442);}return _0x15e495[_0x6a2f('0x1d')]();};}function saveUpdates(_0x14a39a,_0xd432d6){return function(_0x1860e1){if(_0x1860e1){return _0x1860e1[_0x6a2f('0x1e')](_0x14a39a)[_0x6a2f('0x1f')](function(_0x1e4c11){return _0x1e4c11;});}return null;};}function removeEntity(_0x51bf56,_0x4bb625){return function(_0x2ede55){if(_0x2ede55){return _0x2ede55[_0x6a2f('0x20')]()[_0x6a2f('0x1f')](function(){_0x51bf56[_0x6a2f('0x15')](0xcc)[_0x6a2f('0x16')]();});}};}function handleEntityNotFound(_0x2e4859,_0x1fa2e4){return function(_0x250d93){if(!_0x250d93){_0x2e4859[_0x6a2f('0x21')](0x194);}return _0x250d93;};}function handleError(_0x202eea,_0x1b399a){_0x1b399a=_0x1b399a||0x1f4;return function(_0x372894){logger[_0x6a2f('0x22')](_0x372894[_0x6a2f('0x23')]);if(_0x372894[_0x6a2f('0x24')]){delete _0x372894[_0x6a2f('0x24')];}_0x202eea[_0x6a2f('0x15')](_0x1b399a)[_0x6a2f('0x25')](_0x372894);};}exports['index']=function(_0x2128cd,_0x191fc6){var _0x5b685f={},_0x33afa8={},_0x232344={'count':0x0,'rows':[]};var _0x314028=_['map'](db['ServicenowField'][_0x6a2f('0x26')],function(_0x524c45){return{'name':_0x524c45[_0x6a2f('0x27')],'type':_0x524c45['type']['key']};});_0x33afa8[_0x6a2f('0x28')]=_[_0x6a2f('0x29')](_0x314028,_0x6a2f('0x24'));_0x33afa8[_0x6a2f('0x2a')]=_[_0x6a2f('0x2b')](_0x2128cd['query']);_0x33afa8[_0x6a2f('0x2c')]=_[_0x6a2f('0x2d')](_0x33afa8['model'],_0x33afa8['query']);_0x5b685f['attributes']=_[_0x6a2f('0x2d')](_0x33afa8[_0x6a2f('0x28')],qs[_0x6a2f('0x2e')](_0x2128cd[_0x6a2f('0x2a')][_0x6a2f('0x2e')]));_0x5b685f[_0x6a2f('0x2f')]=_0x5b685f[_0x6a2f('0x2f')][_0x6a2f('0x30')]?_0x5b685f[_0x6a2f('0x2f')]:_0x33afa8[_0x6a2f('0x28')];if(!_0x2128cd['query'][_0x6a2f('0x31')](_0x6a2f('0x32'))){_0x5b685f['limit']=qs['limit'](_0x2128cd[_0x6a2f('0x2a')][_0x6a2f('0x19')]);_0x5b685f['offset']=qs[_0x6a2f('0x17')](_0x2128cd[_0x6a2f('0x2a')]['offset']);}_0x5b685f[_0x6a2f('0x33')]=qs[_0x6a2f('0x34')](_0x2128cd[_0x6a2f('0x2a')][_0x6a2f('0x34')]);_0x5b685f[_0x6a2f('0x35')]=qs[_0x6a2f('0x2c')](_[_0x6a2f('0x36')](_0x2128cd[_0x6a2f('0x2a')],_0x33afa8['filters']),_0x314028);if(_0x2128cd[_0x6a2f('0x2a')][_0x6a2f('0x37')]){_0x5b685f[_0x6a2f('0x35')]=_[_0x6a2f('0x38')](_0x5b685f[_0x6a2f('0x35')],{'$or':_['map'](_0x314028,function(_0x27249b){if(_0x27249b[_0x6a2f('0x39')]!==_0x6a2f('0x3a')){var _0x5c0ce8={};_0x5c0ce8[_0x27249b[_0x6a2f('0x24')]]={'$like':'%'+_0x2128cd[_0x6a2f('0x2a')][_0x6a2f('0x37')]+'%'};return _0x5c0ce8;}})});}_0x5b685f=_[_0x6a2f('0x38')]({},_0x5b685f,_0x2128cd[_0x6a2f('0x3b')]);var _0x3b73a7={'where':_0x5b685f[_0x6a2f('0x35')]};return db['ServicenowField'][_0x6a2f('0x1a')](_0x3b73a7)['then'](function(_0x3df4ab){_0x232344[_0x6a2f('0x1a')]=_0x3df4ab;if(_0x2128cd[_0x6a2f('0x2a')][_0x6a2f('0x3c')]){_0x5b685f[_0x6a2f('0x3d')]=[{'all':!![]}];}return db[_0x6a2f('0x3e')][_0x6a2f('0x3f')](_0x5b685f);})[_0x6a2f('0x1f')](function(_0x2856a8){_0x232344[_0x6a2f('0x40')]=_0x2856a8;return _0x232344;})[_0x6a2f('0x1f')](respondWithFilteredResult(_0x191fc6,_0x5b685f))[_0x6a2f('0x41')](handleError(_0x191fc6,null));};exports[_0x6a2f('0x42')]=function(_0x376cfd,_0x28e5a9){var _0xb2c32d={'raw':!![],'where':{'id':_0x376cfd[_0x6a2f('0x43')]['id']}},_0x45917e={};_0x45917e[_0x6a2f('0x28')]=_[_0x6a2f('0x2b')](db['ServicenowField'][_0x6a2f('0x26')]);_0x45917e[_0x6a2f('0x2a')]=_[_0x6a2f('0x2b')](_0x376cfd[_0x6a2f('0x2a')]);_0x45917e[_0x6a2f('0x2c')]=_[_0x6a2f('0x2d')](_0x45917e[_0x6a2f('0x28')],_0x45917e[_0x6a2f('0x2a')]);_0xb2c32d[_0x6a2f('0x2f')]=_[_0x6a2f('0x2d')](_0x45917e[_0x6a2f('0x28')],qs['fields'](_0x376cfd[_0x6a2f('0x2a')][_0x6a2f('0x2e')]));_0xb2c32d[_0x6a2f('0x2f')]=_0xb2c32d[_0x6a2f('0x2f')]['length']?_0xb2c32d[_0x6a2f('0x2f')]:_0x45917e[_0x6a2f('0x28')];if(_0x376cfd[_0x6a2f('0x2a')][_0x6a2f('0x3c')]){_0xb2c32d[_0x6a2f('0x3d')]=[{'all':!![]}];}_0xb2c32d=_['merge']({},_0xb2c32d,_0x376cfd[_0x6a2f('0x3b')]);return db[_0x6a2f('0x3e')][_0x6a2f('0x44')](_0xb2c32d)[_0x6a2f('0x1f')](handleEntityNotFound(_0x28e5a9,null))[_0x6a2f('0x1f')](respondWithResult(_0x28e5a9,null))[_0x6a2f('0x41')](handleError(_0x28e5a9,null));};exports[_0x6a2f('0x45')]=function(_0x26ec34,_0x102b31){return db['ServicenowField']['create'](_0x26ec34['body'],{})[_0x6a2f('0x1f')](respondWithResult(_0x102b31,0xc9))[_0x6a2f('0x41')](handleError(_0x102b31,null));};exports[_0x6a2f('0x1e')]=function(_0x1edee0,_0x4a5878){if(_0x1edee0[_0x6a2f('0x46')]['id']){delete _0x1edee0[_0x6a2f('0x46')]['id'];}return db[_0x6a2f('0x3e')][_0x6a2f('0x44')]({'where':{'id':_0x1edee0['params']['id']}})[_0x6a2f('0x1f')](handleEntityNotFound(_0x4a5878,null))['then'](saveUpdates(_0x1edee0['body'],null))[_0x6a2f('0x1f')](respondWithResult(_0x4a5878,null))[_0x6a2f('0x41')](handleError(_0x4a5878,null));};exports['destroy']=function(_0x1ca267,_0x3bdb0e){return db[_0x6a2f('0x3e')]['find']({'where':{'id':_0x1ca267[_0x6a2f('0x43')]['id']}})[_0x6a2f('0x1f')](handleEntityNotFound(_0x3bdb0e,null))['then'](removeEntity(_0x3bdb0e,null))[_0x6a2f('0x41')](handleError(_0x3bdb0e,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 77a3dbb..0a268e3 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 _0x0ca4=['idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intServicenowField.attributes','int_servicenow_fields','servicenow_unique_index'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0x0ca4,0x151));var _0x40ca=function(_0x3aa4f6,_0x3fe56d){_0x3aa4f6=_0x3aa4f6-0x0;var _0x5dfdc4=_0x0ca4[_0x3aa4f6];return _0x5dfdc4;};'use strict';var _=require(_0x40ca('0x0'));var util=require(_0x40ca('0x1'));var logger=require(_0x40ca('0x2'))(_0x40ca('0x3'));var moment=require(_0x40ca('0x4'));var BPromise=require(_0x40ca('0x5'));var rp=require(_0x40ca('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x40ca('0x7'));var config=require('../../config/environment');var attributes=require(_0x40ca('0x8'));module['exports']=function(_0x3b8736,_0x4f84ca){return _0x3b8736['define']('ServicenowField',attributes,{'tableName':_0x40ca('0x9'),'paranoid':![],'indexes':[{'name':_0x40ca('0xa'),'fields':[_0x40ca('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0db4=['bluebird','path','rimraf','../../config/environment','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','util','../../config/logger','api','moment'];(function(_0x433084,_0xadd619){var _0x331b89=function(_0x2d97b4){while(--_0x2d97b4){_0x433084['push'](_0x433084['shift']());}};_0x331b89(++_0xadd619);}(_0x0db4,0xec));var _0x40db=function(_0x119705,_0xba9427){_0x119705=_0x119705-0x0;var _0x2affc2=_0x0db4[_0x119705];return _0x2affc2;};'use strict';var _=require('lodash');var util=require(_0x40db('0x0'));var logger=require(_0x40db('0x1'))(_0x40db('0x2'));var moment=require(_0x40db('0x3'));var BPromise=require(_0x40db('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x40db('0x5'));var rimraf=require(_0x40db('0x6'));var config=require(_0x40db('0x7'));var attributes=require('./intServicenowField.attributes');module[_0x40db('0x8')]=function(_0x9a94bf,_0x452a4a){return _0x9a94bf[_0x40db('0x9')](_0x40db('0xa'),attributes,{'tableName':_0x40db('0xb'),'paranoid':![],'indexes':[{'name':_0x40db('0xc'),'fields':[_0x40db('0xd'),_0x40db('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index b97728b..1514c6b 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x47c1f4,_0x4847a5){var _0x3e17b3=function(_0x437145){while(--_0x437145){_0x47c1f4['push'](_0x47c1f4['shift']());}};_0x3e17b3(++_0x4847a5);}(_0xf4eb,0xec));var _0xbf4e=function(_0xf3492d,_0x5f2ed5){_0xf3492d=_0xf3492d-0x0;var _0x2cd998=_0xf4eb[_0xf3492d];return _0x2cd998;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0x0713=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x54c69a,_0x274111){var _0x1ff390=function(_0x220f50){while(--_0x220f50){_0x54c69a['push'](_0x54c69a['shift']());}};_0x1ff390(++_0x274111);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 163e5d4..2c9b23a 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(_0x4b544f,_0x5cd1bb){var _0x3892d7=function(_0x293d73){while(--_0x293d73){_0x4b544f['push'](_0x4b544f['shift']());}};_0x3892d7(++_0x5cd1bb);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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(_0x20cdda,_0x5bd66b){var _0x2e48a7=function(_0x501879){while(--_0x501879){_0x20cdda['push'](_0x20cdda['shift']());}};_0x2e48a7(++_0x5bd66b);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index efc28fa..bd7e388 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(_0x4c006f,_0x49f6a1){var _0x2849cb=function(_0xb79ceb){while(--_0xb79ceb){_0x4c006f['push'](_0x4c006f['shift']());}};_0x2849cb(++_0x49f6a1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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(_0x1ca9e9,_0x1790f3){var _0x317758=function(_0xaeb6fc){while(--_0xaeb6fc){_0x1ca9e9['push'](_0x1ca9e9['shift']());}};_0x317758(++_0x1790f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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 b099464..bcd69fe 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 _0x3ee0=['getConfigurations','AccountId','Subjects','Descriptions','getDescriptions','channel','SugarcrmField','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_id','parent_type','direction','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','login','JSON','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','stringify','Calls','remove','label','endsWith','values','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','send','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','VIRTUAL','merge','options','include','findAll','catch','show','params','includeAll','find','create','body','findOne','SugarcrmConfiguration','pick'];(function(_0xbf48eb,_0x54fb10){var _0x306c75=function(_0x408cab){while(--_0x408cab){_0xbf48eb['push'](_0xbf48eb['shift']());}};_0x306c75(++_0x54fb10);}(_0x3ee0,0xa2));var _0x03ee=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3ee0[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x03ee('0x0'));var rimraf=require(_0x03ee('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x03ee('0x2'));var BPromise=require(_0x03ee('0x3'));var Mustache=require(_0x03ee('0x4'));var util=require(_0x03ee('0x5'));var path=require(_0x03ee('0x6'));var sox=require(_0x03ee('0x7'));var csv=require(_0x03ee('0x8'));var ejs=require(_0x03ee('0x9'));var fs=require('fs');var fs_extra=require(_0x03ee('0xa'));var _=require('lodash');var squel=require(_0x03ee('0xb'));var crypto=require('crypto');var jsforce=require(_0x03ee('0xc'));var deskjs=require(_0x03ee('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x03ee('0xe'));var Redis=require('ioredis');var authService=require(_0x03ee('0xf'));var qs=require(_0x03ee('0x10'));var as=require(_0x03ee('0x11'));var hardwareService=require(_0x03ee('0x12'));var logger=require(_0x03ee('0x13'))(_0x03ee('0x14'));var utils=require('../../config/utils');var config=require(_0x03ee('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x03ee('0x16'))['db'];var integrations=require(_0x03ee('0x17'));function respondWithStatusCode(_0x18c07b,_0xb4bc9){_0xb4bc9=_0xb4bc9||0xcc;return function(_0x5bb0d4){if(_0x5bb0d4){return _0x18c07b[_0x03ee('0x18')](_0xb4bc9);}return _0x18c07b[_0x03ee('0x19')](_0xb4bc9)['end']();};}function respondWithResult(_0x10c3cb,_0x28b873){_0x28b873=_0x28b873||0xc8;return function(_0x474e96){if(_0x474e96){return _0x10c3cb[_0x03ee('0x19')](_0x28b873)[_0x03ee('0x1a')](_0x474e96);}};}function respondWithFilteredResult(_0x86f12a,_0x477df5){return function(_0xe18f79){if(_0xe18f79){var _0x5bcd40=typeof _0x477df5[_0x03ee('0x1b')]===_0x03ee('0x1c')&&typeof _0x477df5[_0x03ee('0x1d')]===_0x03ee('0x1c');var _0x4288e4=_0xe18f79[_0x03ee('0x1e')];var _0x4f2dc7=_0x5bcd40?0x0:_0x477df5[_0x03ee('0x1b')];var _0x5c9dda=_0x5bcd40?_0xe18f79[_0x03ee('0x1e')]:_0x477df5[_0x03ee('0x1b')]+_0x477df5[_0x03ee('0x1d')];var _0x1b24c5;if(_0x5c9dda>=_0x4288e4){_0x5c9dda=_0x4288e4;_0x1b24c5=0xc8;}else{_0x1b24c5=0xce;}_0x86f12a[_0x03ee('0x19')](_0x1b24c5);return _0x86f12a[_0x03ee('0x1f')](_0x03ee('0x20'),_0x4f2dc7+'-'+_0x5c9dda+'/'+_0x4288e4)[_0x03ee('0x1a')](_0xe18f79);}return null;};}function patchUpdates(_0x41ee8d){return function(_0x43b693){try{jsonpatch[_0x03ee('0x21')](_0x43b693,_0x41ee8d,!![]);}catch(_0x1a34b0){return BPromise[_0x03ee('0x22')](_0x1a34b0);}return _0x43b693[_0x03ee('0x23')]();};}function saveUpdates(_0x5223a1,_0x121639){return function(_0x58a71a){if(_0x58a71a){return _0x58a71a[_0x03ee('0x24')](_0x5223a1)[_0x03ee('0x25')](function(_0x450f34){return _0x450f34;});}return null;};}function removeEntity(_0x419284,_0x3e8eee){return function(_0x1938f1){if(_0x1938f1){return _0x1938f1[_0x03ee('0x26')]()[_0x03ee('0x25')](function(){_0x419284['status'](0xcc)[_0x03ee('0x27')]();});}};}function handleEntityNotFound(_0x6dd231,_0x3ce1c3){return function(_0x5a5b6b){if(!_0x5a5b6b){_0x6dd231['sendStatus'](0x194);}return _0x5a5b6b;};}function handleError(_0x66fbfa,_0x177369){_0x177369=_0x177369||0x1f4;return function(_0x37ed0f){logger[_0x03ee('0x28')](_0x37ed0f[_0x03ee('0x29')]);if(_0x37ed0f[_0x03ee('0x2a')]){delete _0x37ed0f['name'];}_0x66fbfa[_0x03ee('0x19')](_0x177369)['send'](_0x37ed0f);};}exports[_0x03ee('0x2b')]=function(_0x4a5c35,_0x4b273f){var _0x43919b={},_0x3a0c5a={},_0x18dfb6={'count':0x0,'rows':[]};var _0x3a126d=_[_0x03ee('0x2c')](db[_0x03ee('0x2d')][_0x03ee('0x2e')],function(_0x2fe271){return{'name':_0x2fe271[_0x03ee('0x2f')],'type':_0x2fe271[_0x03ee('0x30')][_0x03ee('0x31')]};});_0x3a0c5a[_0x03ee('0x32')]=_[_0x03ee('0x2c')](_0x3a126d,_0x03ee('0x2a'));_0x3a0c5a[_0x03ee('0x33')]=_[_0x03ee('0x34')](_0x4a5c35[_0x03ee('0x33')]);_0x3a0c5a[_0x03ee('0x35')]=_[_0x03ee('0x36')](_0x3a0c5a[_0x03ee('0x32')],_0x3a0c5a[_0x03ee('0x33')]);_0x43919b[_0x03ee('0x37')]=_[_0x03ee('0x36')](_0x3a0c5a[_0x03ee('0x32')],qs['fields'](_0x4a5c35[_0x03ee('0x33')][_0x03ee('0x38')]));_0x43919b[_0x03ee('0x37')]=_0x43919b[_0x03ee('0x37')][_0x03ee('0x39')]?_0x43919b[_0x03ee('0x37')]:_0x3a0c5a[_0x03ee('0x32')];if(!_0x4a5c35[_0x03ee('0x33')][_0x03ee('0x3a')]('nolimit')){_0x43919b[_0x03ee('0x1d')]=qs['limit'](_0x4a5c35[_0x03ee('0x33')][_0x03ee('0x1d')]);_0x43919b[_0x03ee('0x1b')]=qs['offset'](_0x4a5c35[_0x03ee('0x33')][_0x03ee('0x1b')]);}_0x43919b[_0x03ee('0x3b')]=qs[_0x03ee('0x3c')](_0x4a5c35[_0x03ee('0x33')][_0x03ee('0x3c')]);_0x43919b['where']=qs[_0x03ee('0x35')](_['pick'](_0x4a5c35[_0x03ee('0x33')],_0x3a0c5a[_0x03ee('0x35')]),_0x3a126d);if(_0x4a5c35[_0x03ee('0x33')][_0x03ee('0x3d')]){_0x43919b['where']=_['merge'](_0x43919b[_0x03ee('0x3e')],{'$or':_[_0x03ee('0x2c')](_0x3a126d,function(_0x561d1e){if(_0x561d1e[_0x03ee('0x30')]!==_0x03ee('0x3f')){var _0x54d6bf={};_0x54d6bf[_0x561d1e[_0x03ee('0x2a')]]={'$like':'%'+_0x4a5c35[_0x03ee('0x33')][_0x03ee('0x3d')]+'%'};return _0x54d6bf;}})});}_0x43919b=_[_0x03ee('0x40')]({},_0x43919b,_0x4a5c35[_0x03ee('0x41')]);var _0x194c9c={'where':_0x43919b[_0x03ee('0x3e')]};return db[_0x03ee('0x2d')]['count'](_0x194c9c)[_0x03ee('0x25')](function(_0x5e2b3d){_0x18dfb6[_0x03ee('0x1e')]=_0x5e2b3d;if(_0x4a5c35['query']['includeAll']){_0x43919b[_0x03ee('0x42')]=[{'all':!![]}];}return db[_0x03ee('0x2d')][_0x03ee('0x43')](_0x43919b);})[_0x03ee('0x25')](function(_0x3a6890){_0x18dfb6['rows']=_0x3a6890;return _0x18dfb6;})[_0x03ee('0x25')](respondWithFilteredResult(_0x4b273f,_0x43919b))[_0x03ee('0x44')](handleError(_0x4b273f,null));};exports[_0x03ee('0x45')]=function(_0x1fbccd,_0x3e09c6){var _0x381188={'raw':![],'where':{'id':_0x1fbccd[_0x03ee('0x46')]['id']}},_0x527e63={};_0x527e63[_0x03ee('0x32')]=_['keys'](db['SugarcrmAccount'][_0x03ee('0x2e')]);_0x527e63[_0x03ee('0x33')]=_[_0x03ee('0x34')](_0x1fbccd[_0x03ee('0x33')]);_0x527e63['filters']=_[_0x03ee('0x36')](_0x527e63['model'],_0x527e63[_0x03ee('0x33')]);_0x381188[_0x03ee('0x37')]=_[_0x03ee('0x36')](_0x527e63['model'],qs['fields'](_0x1fbccd['query'][_0x03ee('0x38')]));_0x381188[_0x03ee('0x37')]=_0x381188[_0x03ee('0x37')][_0x03ee('0x39')]?_0x381188[_0x03ee('0x37')]:_0x527e63[_0x03ee('0x32')];if(_0x1fbccd[_0x03ee('0x33')][_0x03ee('0x47')]){_0x381188['include']=[{'all':!![]}];}_0x381188=_[_0x03ee('0x40')]({},_0x381188,_0x1fbccd['options']);return db['SugarcrmAccount'][_0x03ee('0x48')](_0x381188)[_0x03ee('0x25')](handleEntityNotFound(_0x3e09c6,null))['then'](respondWithResult(_0x3e09c6,null))['catch'](handleError(_0x3e09c6,null));};exports[_0x03ee('0x49')]=function(_0x3ccfed,_0x25d737){return db[_0x03ee('0x2d')][_0x03ee('0x49')](_0x3ccfed[_0x03ee('0x4a')],{})[_0x03ee('0x25')](respondWithResult(_0x25d737,0xc9))[_0x03ee('0x44')](handleError(_0x25d737,null));};exports[_0x03ee('0x24')]=function(_0x1df672,_0x317a18){if(_0x1df672[_0x03ee('0x4a')]['id']){delete _0x1df672['body']['id'];}return db[_0x03ee('0x2d')][_0x03ee('0x48')]({'where':{'id':_0x1df672[_0x03ee('0x46')]['id']}})[_0x03ee('0x25')](handleEntityNotFound(_0x317a18,null))[_0x03ee('0x25')](saveUpdates(_0x1df672['body'],null))[_0x03ee('0x25')](respondWithResult(_0x317a18,null))[_0x03ee('0x44')](handleError(_0x317a18,null));};exports[_0x03ee('0x26')]=function(_0x107a02,_0x352a1d){return db[_0x03ee('0x2d')]['find']({'where':{'id':_0x107a02[_0x03ee('0x46')]['id']}})[_0x03ee('0x25')](handleEntityNotFound(_0x352a1d,null))[_0x03ee('0x25')](removeEntity(_0x352a1d,null))[_0x03ee('0x44')](handleError(_0x352a1d,null));};exports['getConfigurations']=function(_0x1cbfd5,_0xd6b575,_0x2cbe38){var _0x362e1e={};var _0x1d1107={};var _0x5a2779;var _0x2431f4;return db[_0x03ee('0x2d')][_0x03ee('0x4b')]({'where':{'id':_0x1cbfd5[_0x03ee('0x46')]['id']}})[_0x03ee('0x25')](handleEntityNotFound(_0xd6b575,null))[_0x03ee('0x25')](function(_0x343d1e){if(_0x343d1e){_0x5a2779=_0x343d1e;_0x1d1107['model']=_[_0x03ee('0x34')](db[_0x03ee('0x4c')]['rawAttributes']);_0x1d1107[_0x03ee('0x33')]=_[_0x03ee('0x34')](_0x1cbfd5[_0x03ee('0x33')]);_0x1d1107[_0x03ee('0x35')]=_[_0x03ee('0x36')](_0x1d1107[_0x03ee('0x32')],_0x1d1107[_0x03ee('0x33')]);_0x362e1e[_0x03ee('0x37')]=_[_0x03ee('0x36')](_0x1d1107[_0x03ee('0x32')],qs['fields'](_0x1cbfd5['query'][_0x03ee('0x38')]));_0x362e1e[_0x03ee('0x37')]=_0x362e1e[_0x03ee('0x37')]['length']?_0x362e1e[_0x03ee('0x37')]:_0x1d1107[_0x03ee('0x32')];_0x362e1e[_0x03ee('0x3b')]=qs[_0x03ee('0x3c')](_0x1cbfd5[_0x03ee('0x33')]['sort']);_0x362e1e[_0x03ee('0x3e')]=qs[_0x03ee('0x35')](_[_0x03ee('0x4d')](_0x1cbfd5[_0x03ee('0x33')],_0x1d1107['filters']));if(_0x1cbfd5[_0x03ee('0x33')][_0x03ee('0x3d')]){_0x362e1e[_0x03ee('0x3e')]=_[_0x03ee('0x40')](_0x362e1e['where'],{'$or':_[_0x03ee('0x2c')](_0x362e1e[_0x03ee('0x37')],function(_0x175880){var _0x94ec0d={};_0x94ec0d[_0x175880]={'$like':'%'+_0x1cbfd5[_0x03ee('0x33')][_0x03ee('0x3d')]+'%'};return _0x94ec0d;})});}_0x362e1e=_['merge']({},_0x362e1e,_0x1cbfd5[_0x03ee('0x41')]);return _0x5a2779[_0x03ee('0x4e')](_0x362e1e);}})[_0x03ee('0x25')](function(_0x5605cc){if(_0x5605cc){_0x2431f4=_0x5605cc[_0x03ee('0x39')];if(!_0x1cbfd5[_0x03ee('0x33')][_0x03ee('0x3a')]('nolimit')){_0x362e1e[_0x03ee('0x1d')]=qs[_0x03ee('0x1d')](_0x1cbfd5[_0x03ee('0x33')][_0x03ee('0x1d')]);_0x362e1e['offset']=qs['offset'](_0x1cbfd5[_0x03ee('0x33')][_0x03ee('0x1b')]);}return _0x5a2779[_0x03ee('0x4e')](_0x362e1e);}})['then'](function(_0x50904f){if(_0x50904f){return _0x50904f?{'count':_0x2431f4,'rows':_0x50904f}:null;}})[_0x03ee('0x25')](respondWithResult(_0xd6b575,null))[_0x03ee('0x44')](handleError(_0xd6b575,null));};exports['addConfiguration']=function(_0x580cb4,_0x2d7688,_0x115bc1){if(_0x580cb4[_0x03ee('0x4a')]['id']){delete _0x580cb4['body']['id'];}return db[_0x03ee('0x2d')][_0x03ee('0x4b')]({'where':{'id':_0x580cb4[_0x03ee('0x46')]['id']}})['then'](handleEntityNotFound(_0x2d7688,null))[_0x03ee('0x25')](function(_0x433a43){if(_0x433a43){_0x580cb4[_0x03ee('0x4a')][_0x03ee('0x4f')]=_0x433a43['id'];_0x580cb4[_0x03ee('0x4a')][_0x03ee('0x50')]=integrations['getSubjects'](_0x580cb4[_0x03ee('0x4a')]['channel'],_0x580cb4[_0x03ee('0x4a')]['type']);_0x580cb4[_0x03ee('0x4a')][_0x03ee('0x51')]=integrations[_0x03ee('0x52')](_0x580cb4[_0x03ee('0x4a')][_0x03ee('0x53')],_0x580cb4['body']['type']);return db['SugarcrmConfiguration'][_0x03ee('0x49')](_0x580cb4[_0x03ee('0x4a')],{'include':[{'model':db['SugarcrmField'],'as':_0x03ee('0x50')},{'model':db[_0x03ee('0x54')],'as':_0x03ee('0x51')}]});}return null;})['then'](respondWithResult(_0x2d7688,null))[_0x03ee('0x44')](handleError(_0x2d7688,null));};exports['getFields']=function(_0x4385b3,_0x3ce7b1,_0x2a66cd){var _0x3dc179='';var _0x474d97=['id','name',_0x03ee('0x55'),_0x03ee('0x56'),'description',_0x03ee('0x57'),_0x03ee('0x58'),_0x03ee('0x59'),_0x03ee('0x5a'),_0x03ee('0x5b'),'parent_name',_0x03ee('0x5c')];return db[_0x03ee('0x2d')][_0x03ee('0x4b')]({'where':{'id':_0x4385b3[_0x03ee('0x46')]['id']},'attributes':['id','username',_0x03ee('0x5d'),_0x03ee('0x5e')]})['then'](handleEntityNotFound(_0x3ce7b1,null))[_0x03ee('0x25')](function(_0x1220d5){if(_0x1220d5){_0x3dc179=_0x1220d5[_0x03ee('0x5e')];var _0x1545a9=_0x3dc179[_0x03ee('0x5f')](-0x1);if(_0x1545a9==='/'){_0x3dc179=_0x3dc179[_0x03ee('0x60')](0x0,_0x3dc179[_0x03ee('0x61')](_0x1545a9));}return rp({'method':_0x03ee('0x62'),'uri':util[_0x03ee('0x63')](_0x03ee('0x64'),_0x3dc179,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x03ee('0x65'),'input_type':_0x03ee('0x66'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x1220d5[_0x03ee('0x67')],'password':_0x1220d5[_0x03ee('0x5d')],'encryption':_0x03ee('0x68')},'application':_0x03ee('0x69')})}});}})[_0x03ee('0x25')](function(_0x3f0495){if(_0x3f0495&&_0x3f0495[_0x03ee('0x2a')]!==_0x03ee('0x6a')&&_0x3f0495[_0x03ee('0x2a')]!==_0x03ee('0x6b')){return rp({'method':_0x03ee('0x62'),'uri':util['format'](_0x03ee('0x64'),_0x3dc179,_0x03ee('0x6c')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0x03ee('0x66'),'rest_data':JSON[_0x03ee('0x6d')]({'session':_0x3f0495['id'],'module_name':_0x03ee('0x6e')})}})[_0x03ee('0x25')](function(_0x359af2){if(_0x359af2){var _0x242a17=_['values'](_0x359af2['module_fields']);_[_0x03ee('0x6f')](_0x242a17,function(_0x1de004){return _0x474d97['includes'](_0x1de004[_0x03ee('0x2a')]);});return{'count':_0x242a17[_0x03ee('0x39')],'rows':_[_0x03ee('0x2c')](_0x242a17,function(_0x1c285a){return{'id':_0x1c285a['name'],'name':_0x1c285a[_0x03ee('0x70')],'custom':_[_0x03ee('0x71')](_0x1c285a[_0x03ee('0x2a')],'_c')?!![]:![],'options':_0x1c285a[_0x03ee('0x41')]?_[_0x03ee('0x2c')](_[_0x03ee('0x72')](_0x1c285a[_0x03ee('0x41')]),function(_0x5e5c7e){return{'name':_0x5e5c7e['value'],'value':_0x5e5c7e[_0x03ee('0x2a')]};}):[]};})};}})[_0x03ee('0x25')](respondWithResult(_0x3ce7b1,null))['catch'](function(_0x4c28b1){var _0x2d1d9e=_0x4385b3[_0x03ee('0x33')][_0x03ee('0x73')]?0x1f4:_0x4c28b1['statusCode']||0x1f4;logger[_0x03ee('0x28')](_0x03ee('0x74'),'getFields',_0x2d1d9e,JSON[_0x03ee('0x6d')](_0x4c28b1));delete _0x4c28b1[_0x03ee('0x2a')];if(_0x2d1d9e===0x191){_0x2d1d9e=0x190;}_0x3ce7b1['status'](_0x2d1d9e)['send'](_0x4385b3[_0x03ee('0x33')][_0x03ee('0x73')]?{'message':_0x03ee('0x75'),'statusCode':_0x4c28b1[_0x03ee('0x76')]}:_0x4c28b1);});}else{var _0x21152e=0x1f4;_0x3ce7b1[_0x03ee('0x19')](_0x21152e)[_0x03ee('0x77')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x6f9c=['module_fields','includes','label','endsWith','values','value','test','getFields,\x20%s,\x20%s,\x20%s','statusCode','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','count','offset','set','reject','save','then','destroy','end','error','stack','name','send','map','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','SugarcrmAccount','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','update','SugarcrmConfiguration','rawAttributes','order','getConfigurations','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','remoteUri','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','JSON','Calls'];(function(_0x512dc6,_0x18757e){var _0x4cefe7=function(_0xc1633e){while(--_0xc1633e){_0x512dc6['push'](_0x512dc6['shift']());}};_0x4cefe7(++_0x18757e);}(_0x6f9c,0x85));var _0xc6f9=function(_0x550a6a,_0x30e1c7){_0x550a6a=_0x550a6a-0x0;var _0x3f543b=_0x6f9c[_0x550a6a];return _0x3f543b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc6f9('0x0'));var zipdir=require(_0xc6f9('0x1'));var jsonpatch=require(_0xc6f9('0x2'));var rp=require(_0xc6f9('0x3'));var moment=require(_0xc6f9('0x4'));var BPromise=require(_0xc6f9('0x5'));var Mustache=require(_0xc6f9('0x6'));var util=require(_0xc6f9('0x7'));var path=require(_0xc6f9('0x8'));var sox=require(_0xc6f9('0x9'));var csv=require(_0xc6f9('0xa'));var ejs=require(_0xc6f9('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6f9('0xc'));var squel=require('squel');var crypto=require(_0xc6f9('0xd'));var jsforce=require(_0xc6f9('0xe'));var deskjs=require(_0xc6f9('0xf'));var toCsv=require(_0xc6f9('0xa'));var querystring=require('querystring');var Papa=require(_0xc6f9('0x10'));var Redis=require(_0xc6f9('0x11'));var authService=require(_0xc6f9('0x12'));var qs=require(_0xc6f9('0x13'));var as=require(_0xc6f9('0x14'));var hardwareService=require(_0xc6f9('0x15'));var logger=require(_0xc6f9('0x16'))(_0xc6f9('0x17'));var utils=require(_0xc6f9('0x18'));var config=require(_0xc6f9('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc6f9('0x1a'))['db'];var integrations=require(_0xc6f9('0x1b'));function respondWithStatusCode(_0x506896,_0x43988c){_0x43988c=_0x43988c||0xcc;return function(_0x5b490f){if(_0x5b490f){return _0x506896[_0xc6f9('0x1c')](_0x43988c);}return _0x506896[_0xc6f9('0x1d')](_0x43988c)['end']();};}function respondWithResult(_0x233c4e,_0x588bf8){_0x588bf8=_0x588bf8||0xc8;return function(_0x50c65c){if(_0x50c65c){return _0x233c4e[_0xc6f9('0x1d')](_0x588bf8)[_0xc6f9('0x1e')](_0x50c65c);}};}function respondWithFilteredResult(_0x10ebc9,_0x151213){return function(_0x53f286){if(_0x53f286){var _0x3c3cf1=typeof _0x151213['offset']===_0xc6f9('0x1f')&&typeof _0x151213[_0xc6f9('0x20')]==='undefined';var _0x430b11=_0x53f286[_0xc6f9('0x21')];var _0x30ec87=_0x3c3cf1?0x0:_0x151213[_0xc6f9('0x22')];var _0x255922=_0x3c3cf1?_0x53f286['count']:_0x151213[_0xc6f9('0x22')]+_0x151213[_0xc6f9('0x20')];var _0x59403d;if(_0x255922>=_0x430b11){_0x255922=_0x430b11;_0x59403d=0xc8;}else{_0x59403d=0xce;}_0x10ebc9['status'](_0x59403d);return _0x10ebc9[_0xc6f9('0x23')]('Content-Range',_0x30ec87+'-'+_0x255922+'/'+_0x430b11)[_0xc6f9('0x1e')](_0x53f286);}return null;};}function patchUpdates(_0x576a56){return function(_0x57ef3e){try{jsonpatch['apply'](_0x57ef3e,_0x576a56,!![]);}catch(_0xebffe5){return BPromise[_0xc6f9('0x24')](_0xebffe5);}return _0x57ef3e[_0xc6f9('0x25')]();};}function saveUpdates(_0x721c5b,_0x3fca0f){return function(_0x1d35aa){if(_0x1d35aa){return _0x1d35aa['update'](_0x721c5b)[_0xc6f9('0x26')](function(_0x4ac72a){return _0x4ac72a;});}return null;};}function removeEntity(_0x4cef47,_0x144dde){return function(_0x378d0d){if(_0x378d0d){return _0x378d0d[_0xc6f9('0x27')]()[_0xc6f9('0x26')](function(){_0x4cef47['status'](0xcc)[_0xc6f9('0x28')]();});}};}function handleEntityNotFound(_0x38fac6,_0x79b86e){return function(_0x158717){if(!_0x158717){_0x38fac6[_0xc6f9('0x1c')](0x194);}return _0x158717;};}function handleError(_0x52253e,_0x29caef){_0x29caef=_0x29caef||0x1f4;return function(_0x57c91c){logger[_0xc6f9('0x29')](_0x57c91c[_0xc6f9('0x2a')]);if(_0x57c91c[_0xc6f9('0x2b')]){delete _0x57c91c[_0xc6f9('0x2b')];}_0x52253e[_0xc6f9('0x1d')](_0x29caef)[_0xc6f9('0x2c')](_0x57c91c);};}exports['index']=function(_0x45a834,_0x36af4d){var _0x38f918={},_0x1d92ab={},_0x231f13={'count':0x0,'rows':[]};var _0xc00c24=_[_0xc6f9('0x2d')](db['SugarcrmAccount']['rawAttributes'],function(_0x684324){return{'name':_0x684324['fieldName'],'type':_0x684324[_0xc6f9('0x2e')][_0xc6f9('0x2f')]};});_0x1d92ab[_0xc6f9('0x30')]=_['map'](_0xc00c24,_0xc6f9('0x2b'));_0x1d92ab['query']=_['keys'](_0x45a834[_0xc6f9('0x31')]);_0x1d92ab[_0xc6f9('0x32')]=_[_0xc6f9('0x33')](_0x1d92ab[_0xc6f9('0x30')],_0x1d92ab[_0xc6f9('0x31')]);_0x38f918[_0xc6f9('0x34')]=_['intersection'](_0x1d92ab[_0xc6f9('0x30')],qs[_0xc6f9('0x35')](_0x45a834['query'][_0xc6f9('0x35')]));_0x38f918[_0xc6f9('0x34')]=_0x38f918[_0xc6f9('0x34')][_0xc6f9('0x36')]?_0x38f918[_0xc6f9('0x34')]:_0x1d92ab[_0xc6f9('0x30')];if(!_0x45a834[_0xc6f9('0x31')][_0xc6f9('0x37')](_0xc6f9('0x38'))){_0x38f918[_0xc6f9('0x20')]=qs[_0xc6f9('0x20')](_0x45a834['query']['limit']);_0x38f918['offset']=qs[_0xc6f9('0x22')](_0x45a834[_0xc6f9('0x31')][_0xc6f9('0x22')]);}_0x38f918['order']=qs[_0xc6f9('0x39')](_0x45a834[_0xc6f9('0x31')][_0xc6f9('0x39')]);_0x38f918['where']=qs['filters'](_[_0xc6f9('0x3a')](_0x45a834[_0xc6f9('0x31')],_0x1d92ab['filters']),_0xc00c24);if(_0x45a834[_0xc6f9('0x31')][_0xc6f9('0x3b')]){_0x38f918[_0xc6f9('0x3c')]=_[_0xc6f9('0x3d')](_0x38f918[_0xc6f9('0x3c')],{'$or':_['map'](_0xc00c24,function(_0xe2a315){if(_0xe2a315[_0xc6f9('0x2e')]!==_0xc6f9('0x3e')){var _0x17da16={};_0x17da16[_0xe2a315[_0xc6f9('0x2b')]]={'$like':'%'+_0x45a834[_0xc6f9('0x31')][_0xc6f9('0x3b')]+'%'};return _0x17da16;}})});}_0x38f918=_[_0xc6f9('0x3d')]({},_0x38f918,_0x45a834[_0xc6f9('0x3f')]);var _0x34ab99={'where':_0x38f918[_0xc6f9('0x3c')]};return db[_0xc6f9('0x40')][_0xc6f9('0x21')](_0x34ab99)[_0xc6f9('0x26')](function(_0x8f8408){_0x231f13[_0xc6f9('0x21')]=_0x8f8408;if(_0x45a834['query'][_0xc6f9('0x41')]){_0x38f918['include']=[{'all':!![]}];}return db['SugarcrmAccount'][_0xc6f9('0x42')](_0x38f918);})[_0xc6f9('0x26')](function(_0x2ec0ea){_0x231f13[_0xc6f9('0x43')]=_0x2ec0ea;return _0x231f13;})['then'](respondWithFilteredResult(_0x36af4d,_0x38f918))[_0xc6f9('0x44')](handleError(_0x36af4d,null));};exports[_0xc6f9('0x45')]=function(_0x3b6f4a,_0x8a284d){var _0x499c62={'raw':![],'where':{'id':_0x3b6f4a[_0xc6f9('0x46')]['id']}},_0x500f11={};_0x500f11['model']=_['keys'](db[_0xc6f9('0x40')]['rawAttributes']);_0x500f11[_0xc6f9('0x31')]=_[_0xc6f9('0x47')](_0x3b6f4a[_0xc6f9('0x31')]);_0x500f11[_0xc6f9('0x32')]=_[_0xc6f9('0x33')](_0x500f11['model'],_0x500f11[_0xc6f9('0x31')]);_0x499c62[_0xc6f9('0x34')]=_[_0xc6f9('0x33')](_0x500f11[_0xc6f9('0x30')],qs[_0xc6f9('0x35')](_0x3b6f4a['query'][_0xc6f9('0x35')]));_0x499c62['attributes']=_0x499c62[_0xc6f9('0x34')][_0xc6f9('0x36')]?_0x499c62[_0xc6f9('0x34')]:_0x500f11[_0xc6f9('0x30')];if(_0x3b6f4a['query'][_0xc6f9('0x41')]){_0x499c62[_0xc6f9('0x48')]=[{'all':!![]}];}_0x499c62=_[_0xc6f9('0x3d')]({},_0x499c62,_0x3b6f4a[_0xc6f9('0x3f')]);return db[_0xc6f9('0x40')][_0xc6f9('0x49')](_0x499c62)[_0xc6f9('0x26')](handleEntityNotFound(_0x8a284d,null))[_0xc6f9('0x26')](respondWithResult(_0x8a284d,null))[_0xc6f9('0x44')](handleError(_0x8a284d,null));};exports[_0xc6f9('0x4a')]=function(_0x4fe2ed,_0x1f2808){return db[_0xc6f9('0x40')]['create'](_0x4fe2ed[_0xc6f9('0x4b')],{})['then'](respondWithResult(_0x1f2808,0xc9))[_0xc6f9('0x44')](handleError(_0x1f2808,null));};exports[_0xc6f9('0x4c')]=function(_0x35ba5e,_0x15a4cf){if(_0x35ba5e[_0xc6f9('0x4b')]['id']){delete _0x35ba5e[_0xc6f9('0x4b')]['id'];}return db[_0xc6f9('0x40')][_0xc6f9('0x49')]({'where':{'id':_0x35ba5e['params']['id']}})[_0xc6f9('0x26')](handleEntityNotFound(_0x15a4cf,null))[_0xc6f9('0x26')](saveUpdates(_0x35ba5e[_0xc6f9('0x4b')],null))[_0xc6f9('0x26')](respondWithResult(_0x15a4cf,null))[_0xc6f9('0x44')](handleError(_0x15a4cf,null));};exports[_0xc6f9('0x27')]=function(_0x4889e3,_0x4fcbf5){return db[_0xc6f9('0x40')][_0xc6f9('0x49')]({'where':{'id':_0x4889e3[_0xc6f9('0x46')]['id']}})[_0xc6f9('0x26')](handleEntityNotFound(_0x4fcbf5,null))[_0xc6f9('0x26')](removeEntity(_0x4fcbf5,null))[_0xc6f9('0x44')](handleError(_0x4fcbf5,null));};exports['getConfigurations']=function(_0x2f2001,_0x552566,_0x99521){var _0x276501={};var _0x5dac9b={};var _0x1581c4;var _0x3886a5;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x2f2001['params']['id']}})[_0xc6f9('0x26')](handleEntityNotFound(_0x552566,null))[_0xc6f9('0x26')](function(_0x3f02d4){if(_0x3f02d4){_0x1581c4=_0x3f02d4;_0x5dac9b[_0xc6f9('0x30')]=_[_0xc6f9('0x47')](db[_0xc6f9('0x4d')][_0xc6f9('0x4e')]);_0x5dac9b[_0xc6f9('0x31')]=_['keys'](_0x2f2001['query']);_0x5dac9b['filters']=_[_0xc6f9('0x33')](_0x5dac9b['model'],_0x5dac9b[_0xc6f9('0x31')]);_0x276501[_0xc6f9('0x34')]=_[_0xc6f9('0x33')](_0x5dac9b['model'],qs['fields'](_0x2f2001['query'][_0xc6f9('0x35')]));_0x276501[_0xc6f9('0x34')]=_0x276501[_0xc6f9('0x34')][_0xc6f9('0x36')]?_0x276501[_0xc6f9('0x34')]:_0x5dac9b[_0xc6f9('0x30')];_0x276501[_0xc6f9('0x4f')]=qs['sort'](_0x2f2001['query'][_0xc6f9('0x39')]);_0x276501[_0xc6f9('0x3c')]=qs['filters'](_[_0xc6f9('0x3a')](_0x2f2001[_0xc6f9('0x31')],_0x5dac9b[_0xc6f9('0x32')]));if(_0x2f2001[_0xc6f9('0x31')][_0xc6f9('0x3b')]){_0x276501[_0xc6f9('0x3c')]=_['merge'](_0x276501[_0xc6f9('0x3c')],{'$or':_[_0xc6f9('0x2d')](_0x276501[_0xc6f9('0x34')],function(_0x579252){var _0x217a54={};_0x217a54[_0x579252]={'$like':'%'+_0x2f2001[_0xc6f9('0x31')][_0xc6f9('0x3b')]+'%'};return _0x217a54;})});}_0x276501=_[_0xc6f9('0x3d')]({},_0x276501,_0x2f2001[_0xc6f9('0x3f')]);return _0x1581c4['getConfigurations'](_0x276501);}})[_0xc6f9('0x26')](function(_0x3d426a){if(_0x3d426a){_0x3886a5=_0x3d426a[_0xc6f9('0x36')];if(!_0x2f2001[_0xc6f9('0x31')][_0xc6f9('0x37')](_0xc6f9('0x38'))){_0x276501[_0xc6f9('0x20')]=qs[_0xc6f9('0x20')](_0x2f2001[_0xc6f9('0x31')][_0xc6f9('0x20')]);_0x276501['offset']=qs[_0xc6f9('0x22')](_0x2f2001[_0xc6f9('0x31')][_0xc6f9('0x22')]);}return _0x1581c4[_0xc6f9('0x50')](_0x276501);}})[_0xc6f9('0x26')](function(_0x498cf2){if(_0x498cf2){return _0x498cf2?{'count':_0x3886a5,'rows':_0x498cf2}:null;}})[_0xc6f9('0x26')](respondWithResult(_0x552566,null))[_0xc6f9('0x44')](handleError(_0x552566,null));};exports[_0xc6f9('0x51')]=function(_0x48fc98,_0x2bca29,_0x1516c3){if(_0x48fc98[_0xc6f9('0x4b')]['id']){delete _0x48fc98[_0xc6f9('0x4b')]['id'];}return db[_0xc6f9('0x40')][_0xc6f9('0x52')]({'where':{'id':_0x48fc98['params']['id']}})[_0xc6f9('0x26')](handleEntityNotFound(_0x2bca29,null))[_0xc6f9('0x26')](function(_0x2ca06c){if(_0x2ca06c){_0x48fc98[_0xc6f9('0x4b')][_0xc6f9('0x53')]=_0x2ca06c['id'];_0x48fc98[_0xc6f9('0x4b')][_0xc6f9('0x54')]=integrations['getSubjects'](_0x48fc98['body'][_0xc6f9('0x55')],_0x48fc98[_0xc6f9('0x4b')]['type']);_0x48fc98[_0xc6f9('0x4b')][_0xc6f9('0x56')]=integrations[_0xc6f9('0x57')](_0x48fc98[_0xc6f9('0x4b')][_0xc6f9('0x55')],_0x48fc98[_0xc6f9('0x4b')]['type']);return db[_0xc6f9('0x4d')][_0xc6f9('0x4a')](_0x48fc98[_0xc6f9('0x4b')],{'include':[{'model':db[_0xc6f9('0x58')],'as':_0xc6f9('0x54')},{'model':db[_0xc6f9('0x58')],'as':_0xc6f9('0x56')}]});}return null;})['then'](respondWithResult(_0x2bca29,null))[_0xc6f9('0x44')](handleError(_0x2bca29,null));};exports[_0xc6f9('0x59')]=function(_0x41aed9,_0x3b8249,_0x39c4d2){var _0x325f3f='';var _0x1b485b=['id',_0xc6f9('0x2b'),_0xc6f9('0x5a'),'created_by',_0xc6f9('0x5b'),_0xc6f9('0x5c'),_0xc6f9('0x5d'),_0xc6f9('0x5e'),'parent_id',_0xc6f9('0x5f'),_0xc6f9('0x60'),_0xc6f9('0x61')];return db[_0xc6f9('0x40')][_0xc6f9('0x52')]({'where':{'id':_0x41aed9[_0xc6f9('0x46')]['id']},'attributes':['id',_0xc6f9('0x62'),_0xc6f9('0x63'),_0xc6f9('0x64')]})[_0xc6f9('0x26')](handleEntityNotFound(_0x3b8249,null))[_0xc6f9('0x26')](function(_0x2e7f5e){if(_0x2e7f5e){_0x325f3f=_0x2e7f5e[_0xc6f9('0x64')];var _0x497b03=_0x325f3f['slice'](-0x1);if(_0x497b03==='/'){_0x325f3f=_0x325f3f[_0xc6f9('0x65')](0x0,_0x325f3f[_0xc6f9('0x66')](_0x497b03));}return rp({'method':_0xc6f9('0x67'),'uri':util[_0xc6f9('0x68')]('%s%s',_0x325f3f,_0xc6f9('0x69')),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xc6f9('0x6a')]({'user_auth':{'user_name':_0x2e7f5e[_0xc6f9('0x62')],'password':_0x2e7f5e[_0xc6f9('0x63')],'encryption':'PLAIN'},'application':_0xc6f9('0x6b')})}});}})[_0xc6f9('0x26')](function(_0xf12a51){if(_0xf12a51&&_0xf12a51[_0xc6f9('0x2b')]!==_0xc6f9('0x6c')&&_0xf12a51['name']!==_0xc6f9('0x6d')){return rp({'method':_0xc6f9('0x67'),'uri':util[_0xc6f9('0x68')]('%s%s',_0x325f3f,_0xc6f9('0x69')),'json':!![],'form':{'method':_0xc6f9('0x6e'),'input_type':'JSON','response_type':_0xc6f9('0x6f'),'rest_data':JSON['stringify']({'session':_0xf12a51['id'],'module_name':_0xc6f9('0x70')})}})[_0xc6f9('0x26')](function(_0x5a0a05){if(_0x5a0a05){var _0x5f3bff=_['values'](_0x5a0a05[_0xc6f9('0x71')]);_['remove'](_0x5f3bff,function(_0xd13683){return _0x1b485b[_0xc6f9('0x72')](_0xd13683[_0xc6f9('0x2b')]);});return{'count':_0x5f3bff[_0xc6f9('0x36')],'rows':_[_0xc6f9('0x2d')](_0x5f3bff,function(_0xa39267){return{'id':_0xa39267[_0xc6f9('0x2b')],'name':_0xa39267[_0xc6f9('0x73')],'custom':_[_0xc6f9('0x74')](_0xa39267['name'],'_c')?!![]:![],'options':_0xa39267[_0xc6f9('0x3f')]?_[_0xc6f9('0x2d')](_[_0xc6f9('0x75')](_0xa39267[_0xc6f9('0x3f')]),function(_0x50f331){return{'name':_0x50f331[_0xc6f9('0x76')],'value':_0x50f331[_0xc6f9('0x2b')]};}):[]};})};}})[_0xc6f9('0x26')](respondWithResult(_0x3b8249,null))[_0xc6f9('0x44')](function(_0x2238d8){var _0x512ee8=_0x41aed9[_0xc6f9('0x31')][_0xc6f9('0x77')]?0x1f4:_0x2238d8['statusCode']||0x1f4;logger['error'](_0xc6f9('0x78'),_0xc6f9('0x59'),_0x512ee8,JSON[_0xc6f9('0x6a')](_0x2238d8));delete _0x2238d8[_0xc6f9('0x2b')];if(_0x512ee8===0x191){_0x512ee8=0x190;}_0x3b8249[_0xc6f9('0x1d')](_0x512ee8)[_0xc6f9('0x2c')](_0x41aed9[_0xc6f9('0x31')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x2238d8[_0xc6f9('0x79')]}:_0x2238d8);});}else{var _0x3bbe2b=0x1f4;_0x3b8249[_0xc6f9('0x1d')](_0x3bbe2b)[_0xc6f9('0x2c')]({'message':_0xc6f9('0x7a'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 0a2c32e..067a45c 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 _0x3b68=['../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','lodash','../../config/logger','api','request-promise','path','rimraf'];(function(_0xdf765b,_0x47bbfb){var _0x48beaf=function(_0x185890){while(--_0x185890){_0xdf765b['push'](_0xdf765b['shift']());}};_0x48beaf(++_0x47bbfb);}(_0x3b68,0xd6));var _0x83b6=function(_0xe3ef81,_0x418531){_0xe3ef81=_0xe3ef81-0x0;var _0x58cfb9=_0x3b68[_0xe3ef81];return _0x58cfb9;};'use strict';var _=require(_0x83b6('0x0'));var util=require('util');var logger=require(_0x83b6('0x1'))(_0x83b6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x83b6('0x3'));var fs=require('fs');var path=require(_0x83b6('0x4'));var rimraf=require(_0x83b6('0x5'));var config=require(_0x83b6('0x6'));var attributes=require(_0x83b6('0x7'));var integrations=require(_0x83b6('0x8'));module['exports']=function(_0x2e3d2a,_0x117dad){return _0x2e3d2a[_0x83b6('0x9')](_0x83b6('0xa'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c38=['../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes'];(function(_0x1f9f5f,_0x509fb7){var _0x51d649=function(_0x4a5285){while(--_0x4a5285){_0x1f9f5f['push'](_0x1f9f5f['shift']());}};_0x51d649(++_0x509fb7);}(_0x2c38,0x109));var _0x82c3=function(_0x12d013,_0x286e4c){_0x12d013=_0x12d013-0x0;var _0x54220c=_0x2c38[_0x12d013];return _0x54220c;};'use strict';var _=require(_0x82c3('0x0'));var util=require(_0x82c3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x82c3('0x2'));var BPromise=require(_0x82c3('0x3'));var rp=require(_0x82c3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x82c3('0x5'));var config=require(_0x82c3('0x6'));var attributes=require(_0x82c3('0x7'));var integrations=require(_0x82c3('0x8'));module[_0x82c3('0x9')]=function(_0x1c760f,_0x5abaeb){return _0x1c760f[_0x82c3('0xa')](_0x82c3('0xb'),attributes,{'tableName':_0x82c3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 1d0c762..5132ad4 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 _0x55d6=['findAll','options','where','attributes','limit','map','model','include','GetSugarcrmAccount','catch','SugarcrmAccount','find','raw','ShowSugarcrmAccount','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','result'];(function(_0x23fbc5,_0x38d996){var _0x21565a=function(_0x224eaa){while(--_0x224eaa){_0x23fbc5['push'](_0x23fbc5['shift']());}};_0x21565a(++_0x38d996);}(_0x55d6,0x118));var _0x655d=function(_0xc0c3c,_0x442aac){_0xc0c3c=_0xc0c3c-0x0;var _0x100dbe=_0x55d6[_0xc0c3c];return _0x100dbe;};'use strict';var _=require(_0x655d('0x0'));var util=require(_0x655d('0x1'));var moment=require(_0x655d('0x2'));var BPromise=require('bluebird');var rs=require(_0x655d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x655d('0x4'))['db'];var utils=require(_0x655d('0x5'));var logger=require(_0x655d('0x6'))(_0x655d('0x7'));var config=require(_0x655d('0x8'));var jayson=require(_0x655d('0x9'));var client=jayson[_0x655d('0xa')][_0x655d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f67d0,_0x67d599,_0x2e5153){return new BPromise(function(_0x587deb,_0x42f376){return client[_0x655d('0xc')](_0x2f67d0,_0x2e5153)[_0x655d('0xd')](function(_0x39037f){logger[_0x655d('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x67d599,'request\x20sent');logger[_0x655d('0xf')](_0x655d('0x10'),_0x67d599,'request\x20sent',JSON[_0x655d('0x11')](_0x39037f));if(_0x39037f[_0x655d('0x12')]){if(_0x39037f[_0x655d('0x12')][_0x655d('0x13')]===0x1f4){logger[_0x655d('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x67d599,_0x39037f[_0x655d('0x12')][_0x655d('0x14')]);return _0x42f376(_0x39037f[_0x655d('0x12')]['message']);}logger['error'](_0x655d('0x15'),_0x67d599,_0x39037f[_0x655d('0x12')]['message']);return _0x587deb(_0x39037f['error'][_0x655d('0x14')]);}else{logger['info'](_0x655d('0x15'),_0x67d599,_0x655d('0x16'));_0x587deb(_0x39037f[_0x655d('0x17')][_0x655d('0x14')]);}})['catch'](function(_0x36495f){logger[_0x655d('0x12')](_0x655d('0x15'),_0x67d599,_0x36495f);_0x42f376(_0x36495f);});});}exports['GetSugarcrmAccount']=function(_0x19aaa7){var _0x266d5e=this;return new Promise(function(_0x72fc87,_0x1cfa6b){return db['SugarcrmAccount'][_0x655d('0x18')]({'raw':_0x19aaa7[_0x655d('0x19')]?_0x19aaa7[_0x655d('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x19aaa7[_0x655d('0x19')]?_0x19aaa7[_0x655d('0x19')][_0x655d('0x1a')]||null:null,'attributes':_0x19aaa7[_0x655d('0x19')]?_0x19aaa7['options'][_0x655d('0x1b')]||null:null,'limit':_0x19aaa7[_0x655d('0x19')]?_0x19aaa7[_0x655d('0x19')][_0x655d('0x1c')]||null:null,'include':_0x19aaa7['options']?_0x19aaa7[_0x655d('0x19')]['include']?_[_0x655d('0x1d')](_0x19aaa7[_0x655d('0x19')]['include'],function(_0x52610){return{'model':db[_0x52610[_0x655d('0x1e')]],'as':_0x52610['as'],'attributes':_0x52610[_0x655d('0x1b')],'include':_0x52610[_0x655d('0x1f')]?_[_0x655d('0x1d')](_0x52610[_0x655d('0x1f')],function(_0x2bf6bc){return{'model':db[_0x2bf6bc[_0x655d('0x1e')]],'as':_0x2bf6bc['as'],'attributes':_0x2bf6bc['attributes'],'include':_0x2bf6bc[_0x655d('0x1f')]?_[_0x655d('0x1d')](_0x2bf6bc[_0x655d('0x1f')],function(_0x51f9bd){return{'model':db[_0x51f9bd[_0x655d('0x1e')]],'as':_0x51f9bd['as'],'attributes':_0x51f9bd[_0x655d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x655d('0xd')](function(_0x2229f6){logger[_0x655d('0xe')](_0x655d('0x20'),_0x19aaa7);logger[_0x655d('0xf')](_0x655d('0x20'),_0x19aaa7,JSON['stringify'](_0x2229f6));_0x72fc87(_0x2229f6);})[_0x655d('0x21')](function(_0x75ed4a){logger[_0x655d('0x12')](_0x655d('0x20'),_0x75ed4a[_0x655d('0x14')],_0x19aaa7);_0x1cfa6b(_0x266d5e[_0x655d('0x12')](0x1f4,_0x75ed4a[_0x655d('0x14')]));});});};exports['ShowSugarcrmAccount']=function(_0xdc3a75){var _0x40d1be=this;return new Promise(function(_0x3a5221,_0x570be6){return db[_0x655d('0x22')][_0x655d('0x23')]({'raw':_0xdc3a75[_0x655d('0x19')]?_0xdc3a75[_0x655d('0x19')][_0x655d('0x24')]===undefined?!![]:![]:!![],'where':_0xdc3a75[_0x655d('0x19')]?_0xdc3a75[_0x655d('0x19')][_0x655d('0x1a')]||null:null,'attributes':_0xdc3a75[_0x655d('0x19')]?_0xdc3a75[_0x655d('0x19')][_0x655d('0x1b')]||null:null,'include':_0xdc3a75[_0x655d('0x19')]?_0xdc3a75[_0x655d('0x19')][_0x655d('0x1f')]?_[_0x655d('0x1d')](_0xdc3a75[_0x655d('0x19')][_0x655d('0x1f')],function(_0x4f9e46){return{'model':db[_0x4f9e46[_0x655d('0x1e')]],'as':_0x4f9e46['as'],'attributes':_0x4f9e46['attributes'],'include':_0x4f9e46[_0x655d('0x1f')]?_['map'](_0x4f9e46[_0x655d('0x1f')],function(_0x6836a0){return{'model':db[_0x6836a0[_0x655d('0x1e')]],'as':_0x6836a0['as'],'attributes':_0x6836a0[_0x655d('0x1b')],'include':_0x6836a0[_0x655d('0x1f')]?_[_0x655d('0x1d')](_0x6836a0[_0x655d('0x1f')],function(_0x2e9f4f){return{'model':db[_0x2e9f4f['model']],'as':_0x2e9f4f['as'],'attributes':_0x2e9f4f[_0x655d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x655d('0xd')](function(_0x31a5cf){logger['info'](_0x655d('0x25'),_0xdc3a75);logger[_0x655d('0xf')](_0x655d('0x25'),_0xdc3a75,JSON[_0x655d('0x11')](_0x31a5cf));_0x3a5221(_0x31a5cf);})['catch'](function(_0x5e22f8){logger[_0x655d('0x12')](_0x655d('0x25'),_0x5e22f8[_0x655d('0x14')],_0xdc3a75);_0x570be6(_0x40d1be[_0x655d('0x12')](0x1f4,_0x5e22f8['message']));});});}; \ No newline at end of file +var _0x510b=['map','find','ShowSugarcrmAccount','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','model'];(function(_0x8654d5,_0x43cc81){var _0x2c330f=function(_0xa6b9cf){while(--_0xa6b9cf){_0x8654d5['push'](_0x8654d5['shift']());}};_0x2c330f(++_0x43cc81);}(_0x510b,0xe3));var _0xb510=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x510b[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb510('0x0'));var BPromise=require(_0xb510('0x1'));var rs=require(_0xb510('0x2'));var fs=require('fs');var Redis=require(_0xb510('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb510('0x4'));var config=require('../../config/environment');var jayson=require(_0xb510('0x5'));var client=jayson[_0xb510('0x6')][_0xb510('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x59f9e6,_0x164974,_0x66ef2){return new BPromise(function(_0x11f494,_0x4062e4){return client[_0xb510('0x8')](_0x59f9e6,_0x66ef2)[_0xb510('0x9')](function(_0x2b70bf){logger[_0xb510('0xa')](_0xb510('0xb'),_0x164974,_0xb510('0xc'));logger[_0xb510('0xd')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x164974,'request\x20sent',JSON[_0xb510('0xe')](_0x2b70bf));if(_0x2b70bf[_0xb510('0xf')]){if(_0x2b70bf[_0xb510('0xf')]['code']===0x1f4){logger[_0xb510('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x164974,_0x2b70bf[_0xb510('0xf')][_0xb510('0x10')]);return _0x4062e4(_0x2b70bf['error'][_0xb510('0x10')]);}logger['error'](_0xb510('0xb'),_0x164974,_0x2b70bf['error']['message']);return _0x11f494(_0x2b70bf[_0xb510('0xf')]['message']);}else{logger[_0xb510('0xa')](_0xb510('0xb'),_0x164974,_0xb510('0xc'));_0x11f494(_0x2b70bf[_0xb510('0x11')][_0xb510('0x10')]);}})[_0xb510('0x12')](function(_0x4381b9){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x164974,_0x4381b9);_0x4062e4(_0x4381b9);});});}exports[_0xb510('0x13')]=function(_0x3666f6){var _0x4b3f3a=this;return new Promise(function(_0x3a81ff,_0x427014){return db[_0xb510('0x14')][_0xb510('0x15')]({'raw':_0x3666f6[_0xb510('0x16')]?_0x3666f6[_0xb510('0x16')][_0xb510('0x17')]===undefined?!![]:![]:!![],'where':_0x3666f6['options']?_0x3666f6[_0xb510('0x16')][_0xb510('0x18')]||null:null,'attributes':_0x3666f6[_0xb510('0x16')]?_0x3666f6[_0xb510('0x16')][_0xb510('0x19')]||null:null,'limit':_0x3666f6[_0xb510('0x16')]?_0x3666f6[_0xb510('0x16')][_0xb510('0x1a')]||null:null,'include':_0x3666f6[_0xb510('0x16')]?_0x3666f6['options'][_0xb510('0x1b')]?_['map'](_0x3666f6[_0xb510('0x16')]['include'],function(_0x3c4218){return{'model':db[_0x3c4218[_0xb510('0x1c')]],'as':_0x3c4218['as'],'attributes':_0x3c4218[_0xb510('0x19')],'include':_0x3c4218[_0xb510('0x1b')]?_[_0xb510('0x1d')](_0x3c4218[_0xb510('0x1b')],function(_0x4eb512){return{'model':db[_0x4eb512[_0xb510('0x1c')]],'as':_0x4eb512['as'],'attributes':_0x4eb512['attributes'],'include':_0x4eb512[_0xb510('0x1b')]?_['map'](_0x4eb512[_0xb510('0x1b')],function(_0x3d53ed){return{'model':db[_0x3d53ed[_0xb510('0x1c')]],'as':_0x3d53ed['as'],'attributes':_0x3d53ed['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xf16dd1){logger[_0xb510('0xa')](_0xb510('0x13'),_0x3666f6);logger[_0xb510('0xd')]('GetSugarcrmAccount',_0x3666f6,JSON[_0xb510('0xe')](_0xf16dd1));_0x3a81ff(_0xf16dd1);})[_0xb510('0x12')](function(_0x2438bd){logger['error'](_0xb510('0x13'),_0x2438bd[_0xb510('0x10')],_0x3666f6);_0x427014(_0x4b3f3a[_0xb510('0xf')](0x1f4,_0x2438bd['message']));});});};exports['ShowSugarcrmAccount']=function(_0xe2b092){var _0x35a337=this;return new Promise(function(_0x13d029,_0x16d6aa){return db[_0xb510('0x14')][_0xb510('0x1e')]({'raw':_0xe2b092[_0xb510('0x16')]?_0xe2b092[_0xb510('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xe2b092[_0xb510('0x16')]?_0xe2b092['options']['where']||null:null,'attributes':_0xe2b092['options']?_0xe2b092[_0xb510('0x16')][_0xb510('0x19')]||null:null,'include':_0xe2b092[_0xb510('0x16')]?_0xe2b092['options'][_0xb510('0x1b')]?_[_0xb510('0x1d')](_0xe2b092[_0xb510('0x16')]['include'],function(_0x1fbdd6){return{'model':db[_0x1fbdd6[_0xb510('0x1c')]],'as':_0x1fbdd6['as'],'attributes':_0x1fbdd6['attributes'],'include':_0x1fbdd6[_0xb510('0x1b')]?_[_0xb510('0x1d')](_0x1fbdd6[_0xb510('0x1b')],function(_0x5bd892){return{'model':db[_0x5bd892['model']],'as':_0x5bd892['as'],'attributes':_0x5bd892[_0xb510('0x19')],'include':_0x5bd892[_0xb510('0x1b')]?_['map'](_0x5bd892[_0xb510('0x1b')],function(_0x16e859){return{'model':db[_0x16e859['model']],'as':_0x16e859['as'],'attributes':_0x16e859[_0xb510('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb510('0x9')](function(_0xd245c8){logger[_0xb510('0xa')](_0xb510('0x1f'),_0xe2b092);logger[_0xb510('0xd')](_0xb510('0x1f'),_0xe2b092,JSON['stringify'](_0xd245c8));_0x13d029(_0xd245c8);})['catch'](function(_0x559b16){logger[_0xb510('0xf')](_0xb510('0x1f'),_0x559b16[_0xb510('0x10')],_0xe2b092);_0x16d6aa(_0x35a337['error'](0x1f4,_0x559b16[_0xb510('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 5f956de..4491e87 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 _0x2243=['./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x16ab76,_0x275a14){var _0x2ceabf=function(_0x405b4b){while(--_0x405b4b){_0x16ab76['push'](_0x16ab76['shift']());}};_0x2ceabf(++_0x275a14);}(_0x2243,0x149));var _0x3224=function(_0x340257,_0x12cfb3){_0x340257=_0x340257-0x0;var _0x2ae857=_0x2243[_0x340257];return _0x2ae857;};'use strict';var multer=require(_0x3224('0x0'));var util=require('util');var path=require(_0x3224('0x1'));var timeout=require('connect-timeout');var express=require(_0x3224('0x2'));var router=express['Router']();var fs_extra=require(_0x3224('0x3'));var auth=require(_0x3224('0x4'));var interaction=require(_0x3224('0x5'));var config=require(_0x3224('0x6'));var controller=require(_0x3224('0x7'));router[_0x3224('0x8')]('/',auth[_0x3224('0x9')](),controller['index']);router[_0x3224('0x8')](_0x3224('0xa'),auth['isAuthenticated'](),controller[_0x3224('0xb')]);router[_0x3224('0x8')](_0x3224('0xc'),auth[_0x3224('0x9')](),controller[_0x3224('0xd')]);router[_0x3224('0x8')](_0x3224('0xe'),auth[_0x3224('0x9')](),controller[_0x3224('0xf')]);router[_0x3224('0x8')](_0x3224('0x10'),auth[_0x3224('0x9')](),controller[_0x3224('0x11')]);router[_0x3224('0x12')]('/',auth[_0x3224('0x9')](),controller[_0x3224('0x13')]);router[_0x3224('0x14')](_0x3224('0xa'),auth[_0x3224('0x9')](),controller['update']);router[_0x3224('0x15')]('/:id',auth[_0x3224('0x9')](),controller[_0x3224('0x16')]);module[_0x3224('0x17')]=router; \ No newline at end of file +var _0xcaae=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','destroy','exports','multer','util','express','Router','fs-extra'];(function(_0x408b6c,_0x3f6a76){var _0x554a3f=function(_0xec32fa){while(--_0xec32fa){_0x408b6c['push'](_0x408b6c['shift']());}};_0x554a3f(++_0x3f6a76);}(_0xcaae,0x13b));var _0xecaa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcaae[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xecaa('0x0'));var util=require(_0xecaa('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xecaa('0x2'));var router=express[_0xecaa('0x3')]();var fs_extra=require(_0xecaa('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xecaa('0x5'));var config=require(_0xecaa('0x6'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xecaa('0x7')]('/',auth[_0xecaa('0x8')](),controller[_0xecaa('0x9')]);router[_0xecaa('0x7')](_0xecaa('0xa'),auth[_0xecaa('0x8')](),controller[_0xecaa('0xb')]);router[_0xecaa('0x7')](_0xecaa('0xc'),auth[_0xecaa('0x8')](),controller['getFields']);router[_0xecaa('0x7')](_0xecaa('0xd'),auth[_0xecaa('0x8')](),controller[_0xecaa('0xe')]);router['get'](_0xecaa('0xf'),auth[_0xecaa('0x8')](),controller[_0xecaa('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xecaa('0x11')]);router['put']('/:id',auth[_0xecaa('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xecaa('0x12')]);module[_0xecaa('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index f329961..4de50e2 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 _0xe6b1=['exports','sequelize'];(function(_0x57ef75,_0x2658e0){var _0x4f34f9=function(_0xfb53bf){while(--_0xfb53bf){_0x57ef75['push'](_0x57ef75['shift']());}};_0x4f34f9(++_0x2658e0);}(_0xe6b1,0x1b3));var _0x1e6b=function(_0x52f5e6,_0x142357){_0x52f5e6=_0x52f5e6-0x0;var _0x5f09d4=_0xe6b1[_0x52f5e6];return _0x5f09d4;};'use strict';var Sequelize=require(_0x1e6b('0x0'));module[_0x1e6b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcef1=['exports','STRING','sequelize'];(function(_0x20d362,_0x324c71){var _0x5041c5=function(_0x1a8712){while(--_0x1a8712){_0x20d362['push'](_0x20d362['shift']());}};_0x5041c5(++_0x324c71);}(_0xcef1,0x98));var _0x1cef=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcef1[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x1cef('0x0'));module[_0x1cef('0x1')]={'name':{'type':Sequelize[_0x1cef('0x2')]},'description':{'type':Sequelize[_0x1cef('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 02ea99f..e824010 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 _0x8e61=['index','SugarcrmConfiguration','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','getFields','findOne','SugarcrmField','getSubjects','nolimit','getDescriptions','eml-format','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','name','send'];(function(_0x4f383e,_0x1f98ba){var _0xe53f3c=function(_0x166b16){while(--_0x166b16){_0x4f383e['push'](_0x4f383e['shift']());}};_0xe53f3c(++_0x1f98ba);}(_0x8e61,0x15d));var _0x18e6=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x8e61[_0x2b5eae];return _0x5f3ac9;};'use strict';var emlformat=require(_0x18e6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x18e6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x18e6('0x2'));var moment=require(_0x18e6('0x3'));var BPromise=require(_0x18e6('0x4'));var Mustache=require(_0x18e6('0x5'));var util=require('util');var path=require('path');var sox=require(_0x18e6('0x6'));var csv=require(_0x18e6('0x7'));var ejs=require(_0x18e6('0x8'));var fs=require('fs');var fs_extra=require(_0x18e6('0x9'));var _=require(_0x18e6('0xa'));var squel=require('squel');var crypto=require(_0x18e6('0xb'));var jsforce=require(_0x18e6('0xc'));var deskjs=require(_0x18e6('0xd'));var toCsv=require(_0x18e6('0x7'));var querystring=require(_0x18e6('0xe'));var Papa=require(_0x18e6('0xf'));var Redis=require('ioredis');var authService=require(_0x18e6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x18e6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x18e6('0x12'))(_0x18e6('0x13'));var utils=require(_0x18e6('0x14'));var config=require(_0x18e6('0x15'));var licenseUtil=require(_0x18e6('0x16'));var db=require(_0x18e6('0x17'))['db'];function respondWithStatusCode(_0x11354d,_0x4f9d35){_0x4f9d35=_0x4f9d35||0xcc;return function(_0x54fb69){if(_0x54fb69){return _0x11354d[_0x18e6('0x18')](_0x4f9d35);}return _0x11354d[_0x18e6('0x19')](_0x4f9d35)[_0x18e6('0x1a')]();};}function respondWithResult(_0x42cc7b,_0x284451){_0x284451=_0x284451||0xc8;return function(_0x379c79){if(_0x379c79){return _0x42cc7b[_0x18e6('0x19')](_0x284451)[_0x18e6('0x1b')](_0x379c79);}};}function respondWithFilteredResult(_0x3ca932,_0x5215dc){return function(_0x45b349){if(_0x45b349){var _0x303f3b=typeof _0x5215dc[_0x18e6('0x1c')]===_0x18e6('0x1d')&&typeof _0x5215dc[_0x18e6('0x1e')]==='undefined';var _0xceb3eb=_0x45b349[_0x18e6('0x1f')];var _0x571595=_0x303f3b?0x0:_0x5215dc['offset'];var _0x171aea=_0x303f3b?_0x45b349['count']:_0x5215dc[_0x18e6('0x1c')]+_0x5215dc[_0x18e6('0x1e')];var _0x3a346f;if(_0x171aea>=_0xceb3eb){_0x171aea=_0xceb3eb;_0x3a346f=0xc8;}else{_0x3a346f=0xce;}_0x3ca932[_0x18e6('0x19')](_0x3a346f);return _0x3ca932[_0x18e6('0x20')]('Content-Range',_0x571595+'-'+_0x171aea+'/'+_0xceb3eb)[_0x18e6('0x1b')](_0x45b349);}return null;};}function patchUpdates(_0x4690ef){return function(_0x40f41e){try{jsonpatch['apply'](_0x40f41e,_0x4690ef,!![]);}catch(_0x5b5f40){return BPromise[_0x18e6('0x21')](_0x5b5f40);}return _0x40f41e[_0x18e6('0x22')]();};}function saveUpdates(_0x38040c,_0x567db){return function(_0x269075){if(_0x269075){return _0x269075[_0x18e6('0x23')](_0x38040c)[_0x18e6('0x24')](function(_0x2c2735){return _0x2c2735;});}return null;};}function removeEntity(_0x29186a,_0x2fc544){return function(_0x59425a){if(_0x59425a){return _0x59425a[_0x18e6('0x25')]()['then'](function(){_0x29186a[_0x18e6('0x19')](0xcc)[_0x18e6('0x1a')]();});}};}function handleEntityNotFound(_0x57b2c4,_0x39ac62){return function(_0x2f3d93){if(!_0x2f3d93){_0x57b2c4[_0x18e6('0x18')](0x194);}return _0x2f3d93;};}function handleError(_0x4db122,_0x5ca7ae){_0x5ca7ae=_0x5ca7ae||0x1f4;return function(_0x3b7a7c){logger[_0x18e6('0x26')](_0x3b7a7c['stack']);if(_0x3b7a7c[_0x18e6('0x27')]){delete _0x3b7a7c[_0x18e6('0x27')];}_0x4db122[_0x18e6('0x19')](_0x5ca7ae)[_0x18e6('0x28')](_0x3b7a7c);};}exports[_0x18e6('0x29')]=function(_0x402f1b,_0x2fe73e){var _0x4ca1d0={},_0x53729b={},_0x28e6c2={'count':0x0,'rows':[]};var _0x185a19=_['map'](db[_0x18e6('0x2a')]['rawAttributes'],function(_0x259521){return{'name':_0x259521[_0x18e6('0x2b')],'type':_0x259521[_0x18e6('0x2c')]['key']};});_0x53729b[_0x18e6('0x2d')]=_['map'](_0x185a19,_0x18e6('0x27'));_0x53729b[_0x18e6('0x2e')]=_[_0x18e6('0x2f')](_0x402f1b['query']);_0x53729b[_0x18e6('0x30')]=_[_0x18e6('0x31')](_0x53729b[_0x18e6('0x2d')],_0x53729b['query']);_0x4ca1d0['attributes']=_[_0x18e6('0x31')](_0x53729b['model'],qs[_0x18e6('0x32')](_0x402f1b[_0x18e6('0x2e')][_0x18e6('0x32')]));_0x4ca1d0[_0x18e6('0x33')]=_0x4ca1d0[_0x18e6('0x33')][_0x18e6('0x34')]?_0x4ca1d0[_0x18e6('0x33')]:_0x53729b[_0x18e6('0x2d')];if(!_0x402f1b[_0x18e6('0x2e')][_0x18e6('0x35')]('nolimit')){_0x4ca1d0[_0x18e6('0x1e')]=qs['limit'](_0x402f1b[_0x18e6('0x2e')]['limit']);_0x4ca1d0[_0x18e6('0x1c')]=qs[_0x18e6('0x1c')](_0x402f1b[_0x18e6('0x2e')][_0x18e6('0x1c')]);}_0x4ca1d0[_0x18e6('0x36')]=qs[_0x18e6('0x37')](_0x402f1b['query'][_0x18e6('0x37')]);_0x4ca1d0[_0x18e6('0x38')]=qs[_0x18e6('0x30')](_[_0x18e6('0x39')](_0x402f1b[_0x18e6('0x2e')],_0x53729b[_0x18e6('0x30')]),_0x185a19);if(_0x402f1b['query'][_0x18e6('0x3a')]){_0x4ca1d0[_0x18e6('0x38')]=_[_0x18e6('0x3b')](_0x4ca1d0[_0x18e6('0x38')],{'$or':_[_0x18e6('0x3c')](_0x185a19,function(_0x36357f){if(_0x36357f['type']!=='VIRTUAL'){var _0x3d5107={};_0x3d5107[_0x36357f['name']]={'$like':'%'+_0x402f1b[_0x18e6('0x2e')][_0x18e6('0x3a')]+'%'};return _0x3d5107;}})});}_0x4ca1d0=_['merge']({},_0x4ca1d0,_0x402f1b[_0x18e6('0x3d')]);var _0x47a8c0={'where':_0x4ca1d0['where']};return db['SugarcrmConfiguration'][_0x18e6('0x1f')](_0x47a8c0)[_0x18e6('0x24')](function(_0x34527d){_0x28e6c2[_0x18e6('0x1f')]=_0x34527d;if(_0x402f1b['query'][_0x18e6('0x3e')]){_0x4ca1d0[_0x18e6('0x3f')]=[{'all':!![]}];}return db[_0x18e6('0x2a')][_0x18e6('0x40')](_0x4ca1d0);})[_0x18e6('0x24')](function(_0x84c3ab){_0x28e6c2['rows']=_0x84c3ab;return _0x28e6c2;})[_0x18e6('0x24')](respondWithFilteredResult(_0x2fe73e,_0x4ca1d0))[_0x18e6('0x41')](handleError(_0x2fe73e,null));};exports[_0x18e6('0x42')]=function(_0x299805,_0x12e6f5){var _0x277f05={'raw':![],'where':{'id':_0x299805[_0x18e6('0x43')]['id']}},_0x44d9b9={};_0x44d9b9[_0x18e6('0x2d')]=_[_0x18e6('0x2f')](db[_0x18e6('0x2a')][_0x18e6('0x44')]);_0x44d9b9[_0x18e6('0x2e')]=_[_0x18e6('0x2f')](_0x299805['query']);_0x44d9b9[_0x18e6('0x30')]=_['intersection'](_0x44d9b9['model'],_0x44d9b9[_0x18e6('0x2e')]);_0x277f05['attributes']=_['intersection'](_0x44d9b9[_0x18e6('0x2d')],qs['fields'](_0x299805['query'][_0x18e6('0x32')]));_0x277f05[_0x18e6('0x33')]=_0x277f05['attributes'][_0x18e6('0x34')]?_0x277f05[_0x18e6('0x33')]:_0x44d9b9['model'];if(_0x299805[_0x18e6('0x2e')][_0x18e6('0x3e')]){_0x277f05['include']=[{'all':!![]}];}_0x277f05=_[_0x18e6('0x3b')]({},_0x277f05,_0x299805[_0x18e6('0x3d')]);return db['SugarcrmConfiguration'][_0x18e6('0x45')](_0x277f05)[_0x18e6('0x24')](handleEntityNotFound(_0x12e6f5,null))[_0x18e6('0x24')](respondWithResult(_0x12e6f5,null))[_0x18e6('0x41')](handleError(_0x12e6f5,null));};exports[_0x18e6('0x46')]=function(_0x17a466,_0x4396da){return db['SugarcrmConfiguration'][_0x18e6('0x46')](_0x17a466[_0x18e6('0x47')],{})[_0x18e6('0x24')](respondWithResult(_0x4396da,0xc9))[_0x18e6('0x41')](handleError(_0x4396da,null));};exports[_0x18e6('0x23')]=function(_0x4f7b26,_0xe3e553){if(_0x4f7b26[_0x18e6('0x47')]['id']){delete _0x4f7b26[_0x18e6('0x47')]['id'];}return db[_0x18e6('0x2a')][_0x18e6('0x45')]({'where':{'id':_0x4f7b26[_0x18e6('0x43')]['id']}})[_0x18e6('0x24')](handleEntityNotFound(_0xe3e553,null))[_0x18e6('0x24')](saveUpdates(_0x4f7b26[_0x18e6('0x47')],null))[_0x18e6('0x24')](respondWithResult(_0xe3e553,null))[_0x18e6('0x41')](handleError(_0xe3e553,null));};exports[_0x18e6('0x25')]=function(_0x12645e,_0x16ff09){return db[_0x18e6('0x2a')]['find']({'where':{'id':_0x12645e[_0x18e6('0x43')]['id']}})[_0x18e6('0x24')](handleEntityNotFound(_0x16ff09,null))[_0x18e6('0x24')](removeEntity(_0x16ff09,null))[_0x18e6('0x41')](handleError(_0x16ff09,null));};exports[_0x18e6('0x48')]=function(_0x132881,_0x17314e,_0x1a6ab4){var _0xfa803c={};var _0x907c72={};var _0xb20740;var _0x53dac3;return db[_0x18e6('0x2a')][_0x18e6('0x49')]({'where':{'id':_0x132881[_0x18e6('0x43')]['id']}})[_0x18e6('0x24')](handleEntityNotFound(_0x17314e,null))['then'](function(_0x134403){if(_0x134403){_0xb20740=_0x134403;_0x907c72[_0x18e6('0x2d')]=_['keys'](db[_0x18e6('0x4a')]['rawAttributes']);_0x907c72[_0x18e6('0x2e')]=_[_0x18e6('0x2f')](_0x132881[_0x18e6('0x2e')]);_0x907c72[_0x18e6('0x30')]=_[_0x18e6('0x31')](_0x907c72['model'],_0x907c72[_0x18e6('0x2e')]);_0xfa803c[_0x18e6('0x33')]=_[_0x18e6('0x31')](_0x907c72[_0x18e6('0x2d')],qs[_0x18e6('0x32')](_0x132881[_0x18e6('0x2e')][_0x18e6('0x32')]));_0xfa803c[_0x18e6('0x33')]=_0xfa803c[_0x18e6('0x33')][_0x18e6('0x34')]?_0xfa803c['attributes']:_0x907c72[_0x18e6('0x2d')];_0xfa803c['order']=qs[_0x18e6('0x37')](_0x132881['query'][_0x18e6('0x37')]);_0xfa803c[_0x18e6('0x38')]=qs['filters'](_[_0x18e6('0x39')](_0x132881['query'],_0x907c72[_0x18e6('0x30')]));if(_0x132881[_0x18e6('0x2e')][_0x18e6('0x3a')]){_0xfa803c['where']=_['merge'](_0xfa803c[_0x18e6('0x38')],{'$or':_[_0x18e6('0x3c')](_0xfa803c[_0x18e6('0x33')],function(_0x4c45cd){var _0x13e876={};_0x13e876[_0x4c45cd]={'$like':'%'+_0x132881[_0x18e6('0x2e')]['filter']+'%'};return _0x13e876;})});}_0xfa803c=_[_0x18e6('0x3b')]({},_0xfa803c,_0x132881[_0x18e6('0x3d')]);return _0xb20740[_0x18e6('0x48')](_0xfa803c);}})[_0x18e6('0x24')](function(_0x513eae){if(_0x513eae){_0x53dac3=_0x513eae[_0x18e6('0x34')];if(!_0x132881[_0x18e6('0x2e')][_0x18e6('0x35')]('nolimit')){_0xfa803c[_0x18e6('0x1e')]=qs[_0x18e6('0x1e')](_0x132881[_0x18e6('0x2e')][_0x18e6('0x1e')]);_0xfa803c[_0x18e6('0x1c')]=qs[_0x18e6('0x1c')](_0x132881[_0x18e6('0x2e')][_0x18e6('0x1c')]);}return _0xb20740['getFields'](_0xfa803c);}})[_0x18e6('0x24')](function(_0x4cd1b9){if(_0x4cd1b9){return _0x4cd1b9?{'count':_0x53dac3,'rows':_0x4cd1b9}:null;}})[_0x18e6('0x24')](respondWithResult(_0x17314e,null))['catch'](handleError(_0x17314e,null));};exports[_0x18e6('0x4b')]=function(_0x54761c,_0x444f4e,_0x491ef5){var _0xea75f8={};var _0x5eb15d={};var _0x3664b8;var _0x380742;return db[_0x18e6('0x2a')]['findOne']({'where':{'id':_0x54761c[_0x18e6('0x43')]['id']}})[_0x18e6('0x24')](handleEntityNotFound(_0x444f4e,null))[_0x18e6('0x24')](function(_0xf12f5){if(_0xf12f5){_0x3664b8=_0xf12f5;_0x5eb15d[_0x18e6('0x2d')]=_[_0x18e6('0x2f')](db[_0x18e6('0x4a')][_0x18e6('0x44')]);_0x5eb15d[_0x18e6('0x2e')]=_[_0x18e6('0x2f')](_0x54761c[_0x18e6('0x2e')]);_0x5eb15d[_0x18e6('0x30')]=_[_0x18e6('0x31')](_0x5eb15d['model'],_0x5eb15d['query']);_0xea75f8[_0x18e6('0x33')]=_['intersection'](_0x5eb15d[_0x18e6('0x2d')],qs[_0x18e6('0x32')](_0x54761c['query']['fields']));_0xea75f8['attributes']=_0xea75f8[_0x18e6('0x33')]['length']?_0xea75f8[_0x18e6('0x33')]:_0x5eb15d[_0x18e6('0x2d')];_0xea75f8[_0x18e6('0x36')]=qs[_0x18e6('0x37')](_0x54761c[_0x18e6('0x2e')]['sort']);_0xea75f8[_0x18e6('0x38')]=qs[_0x18e6('0x30')](_['pick'](_0x54761c[_0x18e6('0x2e')],_0x5eb15d[_0x18e6('0x30')]));if(_0x54761c[_0x18e6('0x2e')][_0x18e6('0x3a')]){_0xea75f8['where']=_[_0x18e6('0x3b')](_0xea75f8[_0x18e6('0x38')],{'$or':_[_0x18e6('0x3c')](_0xea75f8[_0x18e6('0x33')],function(_0x249f1b){var _0x280abc={};_0x280abc[_0x249f1b]={'$like':'%'+_0x54761c[_0x18e6('0x2e')][_0x18e6('0x3a')]+'%'};return _0x280abc;})});}_0xea75f8=_['merge']({},_0xea75f8,_0x54761c[_0x18e6('0x3d')]);return _0x3664b8['getSubjects'](_0xea75f8);}})[_0x18e6('0x24')](function(_0xf8fa6c){if(_0xf8fa6c){_0x380742=_0xf8fa6c[_0x18e6('0x34')];if(!_0x54761c[_0x18e6('0x2e')][_0x18e6('0x35')](_0x18e6('0x4c'))){_0xea75f8[_0x18e6('0x1e')]=qs[_0x18e6('0x1e')](_0x54761c[_0x18e6('0x2e')]['limit']);_0xea75f8[_0x18e6('0x1c')]=qs[_0x18e6('0x1c')](_0x54761c['query'][_0x18e6('0x1c')]);}return _0x3664b8['getSubjects'](_0xea75f8);}})[_0x18e6('0x24')](function(_0x251e86){if(_0x251e86){return _0x251e86?{'count':_0x380742,'rows':_0x251e86}:null;}})[_0x18e6('0x24')](respondWithResult(_0x444f4e,null))['catch'](handleError(_0x444f4e,null));};exports[_0x18e6('0x4d')]=function(_0x31264c,_0x4bd8df,_0x5d8696){var _0x189623={};var _0x116228={};var _0x24eaee;var _0x30e9a1;return db[_0x18e6('0x2a')]['findOne']({'where':{'id':_0x31264c[_0x18e6('0x43')]['id']}})[_0x18e6('0x24')](handleEntityNotFound(_0x4bd8df,null))[_0x18e6('0x24')](function(_0x176991){if(_0x176991){_0x24eaee=_0x176991;_0x116228[_0x18e6('0x2d')]=_[_0x18e6('0x2f')](db['SugarcrmField'][_0x18e6('0x44')]);_0x116228[_0x18e6('0x2e')]=_[_0x18e6('0x2f')](_0x31264c[_0x18e6('0x2e')]);_0x116228['filters']=_[_0x18e6('0x31')](_0x116228[_0x18e6('0x2d')],_0x116228[_0x18e6('0x2e')]);_0x189623[_0x18e6('0x33')]=_[_0x18e6('0x31')](_0x116228[_0x18e6('0x2d')],qs[_0x18e6('0x32')](_0x31264c['query'][_0x18e6('0x32')]));_0x189623[_0x18e6('0x33')]=_0x189623[_0x18e6('0x33')][_0x18e6('0x34')]?_0x189623[_0x18e6('0x33')]:_0x116228[_0x18e6('0x2d')];_0x189623[_0x18e6('0x36')]=qs[_0x18e6('0x37')](_0x31264c[_0x18e6('0x2e')]['sort']);_0x189623[_0x18e6('0x38')]=qs[_0x18e6('0x30')](_['pick'](_0x31264c[_0x18e6('0x2e')],_0x116228[_0x18e6('0x30')]));if(_0x31264c[_0x18e6('0x2e')][_0x18e6('0x3a')]){_0x189623['where']=_[_0x18e6('0x3b')](_0x189623[_0x18e6('0x38')],{'$or':_[_0x18e6('0x3c')](_0x189623[_0x18e6('0x33')],function(_0x29d23a){var _0xef8851={};_0xef8851[_0x29d23a]={'$like':'%'+_0x31264c['query'][_0x18e6('0x3a')]+'%'};return _0xef8851;})});}_0x189623=_[_0x18e6('0x3b')]({},_0x189623,_0x31264c['options']);return _0x24eaee[_0x18e6('0x4d')](_0x189623);}})[_0x18e6('0x24')](function(_0x4153dd){if(_0x4153dd){_0x30e9a1=_0x4153dd['length'];if(!_0x31264c[_0x18e6('0x2e')][_0x18e6('0x35')](_0x18e6('0x4c'))){_0x189623['limit']=qs[_0x18e6('0x1e')](_0x31264c['query'][_0x18e6('0x1e')]);_0x189623['offset']=qs[_0x18e6('0x1c')](_0x31264c[_0x18e6('0x2e')][_0x18e6('0x1c')]);}return _0x24eaee[_0x18e6('0x4d')](_0x189623);}})[_0x18e6('0x24')](function(_0x3d625f){if(_0x3d625f){return _0x3d625f?{'count':_0x30e9a1,'rows':_0x3d625f}:null;}})[_0x18e6('0x24')](respondWithResult(_0x4bd8df,null))['catch'](handleError(_0x4bd8df,null));}; \ No newline at end of file +var _0x8b9b=['sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','getFields','findOne','length','getSubjects','SugarcrmField','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','nolimit','order'];(function(_0x53b96b,_0xd1c78b){var _0x11d297=function(_0x11294b){while(--_0x11294b){_0x53b96b['push'](_0x53b96b['shift']());}};_0x11d297(++_0xd1c78b);}(_0x8b9b,0x1a1));var _0xb8b9=function(_0x11239b,_0xdfd2b0){_0x11239b=_0x11239b-0x0;var _0x1d51c4=_0x8b9b[_0x11239b];return _0x1d51c4;};'use strict';var emlformat=require(_0xb8b9('0x0'));var rimraf=require(_0xb8b9('0x1'));var zipdir=require(_0xb8b9('0x2'));var jsonpatch=require(_0xb8b9('0x3'));var rp=require('request-promise');var moment=require(_0xb8b9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb8b9('0x5'));var util=require('util');var path=require(_0xb8b9('0x6'));var sox=require('sox');var csv=require(_0xb8b9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb8b9('0x8'));var squel=require('squel');var crypto=require(_0xb8b9('0x9'));var jsforce=require(_0xb8b9('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb8b9('0xb'));var Redis=require('ioredis');var authService=require(_0xb8b9('0xc'));var qs=require(_0xb8b9('0xd'));var as=require(_0xb8b9('0xe'));var hardwareService=require(_0xb8b9('0xf'));var logger=require(_0xb8b9('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xb8b9('0x11'));var licenseUtil=require(_0xb8b9('0x12'));var db=require(_0xb8b9('0x13'))['db'];function respondWithStatusCode(_0x9c99c3,_0x15bd73){_0x15bd73=_0x15bd73||0xcc;return function(_0x25d49f){if(_0x25d49f){return _0x9c99c3[_0xb8b9('0x14')](_0x15bd73);}return _0x9c99c3['status'](_0x15bd73)[_0xb8b9('0x15')]();};}function respondWithResult(_0x59c625,_0x916371){_0x916371=_0x916371||0xc8;return function(_0x20cb68){if(_0x20cb68){return _0x59c625[_0xb8b9('0x16')](_0x916371)[_0xb8b9('0x17')](_0x20cb68);}};}function respondWithFilteredResult(_0x36f7b7,_0x47b387){return function(_0xdf2e69){if(_0xdf2e69){var _0x4730dd=typeof _0x47b387[_0xb8b9('0x18')]==='undefined'&&typeof _0x47b387['limit']===_0xb8b9('0x19');var _0x7a5cde=_0xdf2e69[_0xb8b9('0x1a')];var _0x4d0800=_0x4730dd?0x0:_0x47b387['offset'];var _0x7716ec=_0x4730dd?_0xdf2e69[_0xb8b9('0x1a')]:_0x47b387[_0xb8b9('0x18')]+_0x47b387[_0xb8b9('0x1b')];var _0x590119;if(_0x7716ec>=_0x7a5cde){_0x7716ec=_0x7a5cde;_0x590119=0xc8;}else{_0x590119=0xce;}_0x36f7b7[_0xb8b9('0x16')](_0x590119);return _0x36f7b7['set'](_0xb8b9('0x1c'),_0x4d0800+'-'+_0x7716ec+'/'+_0x7a5cde)[_0xb8b9('0x17')](_0xdf2e69);}return null;};}function patchUpdates(_0x49d00c){return function(_0x52655c){try{jsonpatch[_0xb8b9('0x1d')](_0x52655c,_0x49d00c,!![]);}catch(_0x219631){return BPromise[_0xb8b9('0x1e')](_0x219631);}return _0x52655c[_0xb8b9('0x1f')]();};}function saveUpdates(_0x1160d0,_0x48a96e){return function(_0x2ac21f){if(_0x2ac21f){return _0x2ac21f[_0xb8b9('0x20')](_0x1160d0)[_0xb8b9('0x21')](function(_0x1ccaab){return _0x1ccaab;});}return null;};}function removeEntity(_0x23979f,_0x329e08){return function(_0x589546){if(_0x589546){return _0x589546[_0xb8b9('0x22')]()[_0xb8b9('0x21')](function(){_0x23979f[_0xb8b9('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8789c2,_0x113eca){return function(_0x83ba55){if(!_0x83ba55){_0x8789c2[_0xb8b9('0x14')](0x194);}return _0x83ba55;};}function handleError(_0x1e9100,_0x576859){_0x576859=_0x576859||0x1f4;return function(_0x18bdc0){logger['error'](_0x18bdc0[_0xb8b9('0x23')]);if(_0x18bdc0[_0xb8b9('0x24')]){delete _0x18bdc0[_0xb8b9('0x24')];}_0x1e9100[_0xb8b9('0x16')](_0x576859)[_0xb8b9('0x25')](_0x18bdc0);};}exports[_0xb8b9('0x26')]=function(_0x13db45,_0x2b978e){var _0x1f4ddb={},_0x3c5973={},_0x5e52c7={'count':0x0,'rows':[]};var _0x224cac=_[_0xb8b9('0x27')](db[_0xb8b9('0x28')][_0xb8b9('0x29')],function(_0x40d6cd){return{'name':_0x40d6cd[_0xb8b9('0x2a')],'type':_0x40d6cd['type'][_0xb8b9('0x2b')]};});_0x3c5973[_0xb8b9('0x2c')]=_['map'](_0x224cac,_0xb8b9('0x24'));_0x3c5973[_0xb8b9('0x2d')]=_['keys'](_0x13db45[_0xb8b9('0x2d')]);_0x3c5973['filters']=_[_0xb8b9('0x2e')](_0x3c5973['model'],_0x3c5973[_0xb8b9('0x2d')]);_0x1f4ddb[_0xb8b9('0x2f')]=_['intersection'](_0x3c5973['model'],qs[_0xb8b9('0x30')](_0x13db45['query'][_0xb8b9('0x30')]));_0x1f4ddb['attributes']=_0x1f4ddb['attributes']['length']?_0x1f4ddb[_0xb8b9('0x2f')]:_0x3c5973['model'];if(!_0x13db45['query']['hasOwnProperty'](_0xb8b9('0x31'))){_0x1f4ddb[_0xb8b9('0x1b')]=qs[_0xb8b9('0x1b')](_0x13db45[_0xb8b9('0x2d')][_0xb8b9('0x1b')]);_0x1f4ddb[_0xb8b9('0x18')]=qs[_0xb8b9('0x18')](_0x13db45[_0xb8b9('0x2d')][_0xb8b9('0x18')]);}_0x1f4ddb[_0xb8b9('0x32')]=qs['sort'](_0x13db45[_0xb8b9('0x2d')][_0xb8b9('0x33')]);_0x1f4ddb[_0xb8b9('0x34')]=qs[_0xb8b9('0x35')](_[_0xb8b9('0x36')](_0x13db45['query'],_0x3c5973[_0xb8b9('0x35')]),_0x224cac);if(_0x13db45[_0xb8b9('0x2d')][_0xb8b9('0x37')]){_0x1f4ddb[_0xb8b9('0x34')]=_[_0xb8b9('0x38')](_0x1f4ddb[_0xb8b9('0x34')],{'$or':_[_0xb8b9('0x27')](_0x224cac,function(_0x16039a){if(_0x16039a[_0xb8b9('0x39')]!==_0xb8b9('0x3a')){var _0x291a40={};_0x291a40[_0x16039a[_0xb8b9('0x24')]]={'$like':'%'+_0x13db45[_0xb8b9('0x2d')][_0xb8b9('0x37')]+'%'};return _0x291a40;}})});}_0x1f4ddb=_['merge']({},_0x1f4ddb,_0x13db45[_0xb8b9('0x3b')]);var _0x423b19={'where':_0x1f4ddb['where']};return db['SugarcrmConfiguration'][_0xb8b9('0x1a')](_0x423b19)[_0xb8b9('0x21')](function(_0x3de633){_0x5e52c7[_0xb8b9('0x1a')]=_0x3de633;if(_0x13db45['query'][_0xb8b9('0x3c')]){_0x1f4ddb[_0xb8b9('0x3d')]=[{'all':!![]}];}return db[_0xb8b9('0x28')][_0xb8b9('0x3e')](_0x1f4ddb);})['then'](function(_0x16dd09){_0x5e52c7[_0xb8b9('0x3f')]=_0x16dd09;return _0x5e52c7;})[_0xb8b9('0x21')](respondWithFilteredResult(_0x2b978e,_0x1f4ddb))['catch'](handleError(_0x2b978e,null));};exports[_0xb8b9('0x40')]=function(_0x1d8b20,_0x53ccec){var _0x298680={'raw':![],'where':{'id':_0x1d8b20[_0xb8b9('0x41')]['id']}},_0x12910e={};_0x12910e[_0xb8b9('0x2c')]=_[_0xb8b9('0x42')](db[_0xb8b9('0x28')]['rawAttributes']);_0x12910e[_0xb8b9('0x2d')]=_[_0xb8b9('0x42')](_0x1d8b20['query']);_0x12910e[_0xb8b9('0x35')]=_[_0xb8b9('0x2e')](_0x12910e[_0xb8b9('0x2c')],_0x12910e[_0xb8b9('0x2d')]);_0x298680[_0xb8b9('0x2f')]=_[_0xb8b9('0x2e')](_0x12910e['model'],qs['fields'](_0x1d8b20[_0xb8b9('0x2d')][_0xb8b9('0x30')]));_0x298680['attributes']=_0x298680[_0xb8b9('0x2f')]['length']?_0x298680['attributes']:_0x12910e[_0xb8b9('0x2c')];if(_0x1d8b20['query'][_0xb8b9('0x3c')]){_0x298680[_0xb8b9('0x3d')]=[{'all':!![]}];}_0x298680=_[_0xb8b9('0x38')]({},_0x298680,_0x1d8b20[_0xb8b9('0x3b')]);return db[_0xb8b9('0x28')][_0xb8b9('0x43')](_0x298680)[_0xb8b9('0x21')](handleEntityNotFound(_0x53ccec,null))[_0xb8b9('0x21')](respondWithResult(_0x53ccec,null))['catch'](handleError(_0x53ccec,null));};exports[_0xb8b9('0x44')]=function(_0x3f0dcd,_0xd0bb5f){return db[_0xb8b9('0x28')][_0xb8b9('0x44')](_0x3f0dcd[_0xb8b9('0x45')],{})['then'](respondWithResult(_0xd0bb5f,0xc9))[_0xb8b9('0x46')](handleError(_0xd0bb5f,null));};exports[_0xb8b9('0x20')]=function(_0x142160,_0xa42680){if(_0x142160[_0xb8b9('0x45')]['id']){delete _0x142160['body']['id'];}return db[_0xb8b9('0x28')][_0xb8b9('0x43')]({'where':{'id':_0x142160[_0xb8b9('0x41')]['id']}})[_0xb8b9('0x21')](handleEntityNotFound(_0xa42680,null))[_0xb8b9('0x21')](saveUpdates(_0x142160[_0xb8b9('0x45')],null))[_0xb8b9('0x21')](respondWithResult(_0xa42680,null))[_0xb8b9('0x46')](handleError(_0xa42680,null));};exports[_0xb8b9('0x22')]=function(_0x39fb07,_0xe35e8d){return db[_0xb8b9('0x28')][_0xb8b9('0x43')]({'where':{'id':_0x39fb07[_0xb8b9('0x41')]['id']}})[_0xb8b9('0x21')](handleEntityNotFound(_0xe35e8d,null))[_0xb8b9('0x21')](removeEntity(_0xe35e8d,null))[_0xb8b9('0x46')](handleError(_0xe35e8d,null));};exports[_0xb8b9('0x47')]=function(_0x52c9cc,_0x451b4d,_0x20a520){var _0x359b4a={};var _0x2f91c3={};var _0x3bc527;var _0x14458a;return db[_0xb8b9('0x28')][_0xb8b9('0x48')]({'where':{'id':_0x52c9cc['params']['id']}})['then'](handleEntityNotFound(_0x451b4d,null))['then'](function(_0xba63e1){if(_0xba63e1){_0x3bc527=_0xba63e1;_0x2f91c3[_0xb8b9('0x2c')]=_[_0xb8b9('0x42')](db['SugarcrmField'][_0xb8b9('0x29')]);_0x2f91c3[_0xb8b9('0x2d')]=_[_0xb8b9('0x42')](_0x52c9cc[_0xb8b9('0x2d')]);_0x2f91c3[_0xb8b9('0x35')]=_[_0xb8b9('0x2e')](_0x2f91c3[_0xb8b9('0x2c')],_0x2f91c3[_0xb8b9('0x2d')]);_0x359b4a[_0xb8b9('0x2f')]=_['intersection'](_0x2f91c3[_0xb8b9('0x2c')],qs['fields'](_0x52c9cc['query'][_0xb8b9('0x30')]));_0x359b4a['attributes']=_0x359b4a['attributes'][_0xb8b9('0x49')]?_0x359b4a[_0xb8b9('0x2f')]:_0x2f91c3[_0xb8b9('0x2c')];_0x359b4a[_0xb8b9('0x32')]=qs['sort'](_0x52c9cc[_0xb8b9('0x2d')][_0xb8b9('0x33')]);_0x359b4a[_0xb8b9('0x34')]=qs['filters'](_[_0xb8b9('0x36')](_0x52c9cc[_0xb8b9('0x2d')],_0x2f91c3[_0xb8b9('0x35')]));if(_0x52c9cc[_0xb8b9('0x2d')][_0xb8b9('0x37')]){_0x359b4a[_0xb8b9('0x34')]=_[_0xb8b9('0x38')](_0x359b4a[_0xb8b9('0x34')],{'$or':_[_0xb8b9('0x27')](_0x359b4a[_0xb8b9('0x2f')],function(_0xcd2cc2){var _0x4d66e2={};_0x4d66e2[_0xcd2cc2]={'$like':'%'+_0x52c9cc[_0xb8b9('0x2d')][_0xb8b9('0x37')]+'%'};return _0x4d66e2;})});}_0x359b4a=_['merge']({},_0x359b4a,_0x52c9cc[_0xb8b9('0x3b')]);return _0x3bc527[_0xb8b9('0x47')](_0x359b4a);}})['then'](function(_0x37e69d){if(_0x37e69d){_0x14458a=_0x37e69d['length'];if(!_0x52c9cc[_0xb8b9('0x2d')]['hasOwnProperty']('nolimit')){_0x359b4a[_0xb8b9('0x1b')]=qs[_0xb8b9('0x1b')](_0x52c9cc[_0xb8b9('0x2d')][_0xb8b9('0x1b')]);_0x359b4a[_0xb8b9('0x18')]=qs[_0xb8b9('0x18')](_0x52c9cc[_0xb8b9('0x2d')][_0xb8b9('0x18')]);}return _0x3bc527['getFields'](_0x359b4a);}})[_0xb8b9('0x21')](function(_0x31bcda){if(_0x31bcda){return _0x31bcda?{'count':_0x14458a,'rows':_0x31bcda}:null;}})[_0xb8b9('0x21')](respondWithResult(_0x451b4d,null))[_0xb8b9('0x46')](handleError(_0x451b4d,null));};exports[_0xb8b9('0x4a')]=function(_0x25149f,_0xa9f205,_0x301b6d){var _0x1db27b={};var _0x1457ef={};var _0x23df67;var _0x579a63;return db['SugarcrmConfiguration'][_0xb8b9('0x48')]({'where':{'id':_0x25149f[_0xb8b9('0x41')]['id']}})['then'](handleEntityNotFound(_0xa9f205,null))['then'](function(_0x460c28){if(_0x460c28){_0x23df67=_0x460c28;_0x1457ef[_0xb8b9('0x2c')]=_[_0xb8b9('0x42')](db[_0xb8b9('0x4b')][_0xb8b9('0x29')]);_0x1457ef[_0xb8b9('0x2d')]=_[_0xb8b9('0x42')](_0x25149f['query']);_0x1457ef['filters']=_[_0xb8b9('0x2e')](_0x1457ef['model'],_0x1457ef['query']);_0x1db27b['attributes']=_[_0xb8b9('0x2e')](_0x1457ef['model'],qs[_0xb8b9('0x30')](_0x25149f[_0xb8b9('0x2d')][_0xb8b9('0x30')]));_0x1db27b[_0xb8b9('0x2f')]=_0x1db27b['attributes'][_0xb8b9('0x49')]?_0x1db27b['attributes']:_0x1457ef[_0xb8b9('0x2c')];_0x1db27b[_0xb8b9('0x32')]=qs[_0xb8b9('0x33')](_0x25149f[_0xb8b9('0x2d')][_0xb8b9('0x33')]);_0x1db27b[_0xb8b9('0x34')]=qs[_0xb8b9('0x35')](_[_0xb8b9('0x36')](_0x25149f[_0xb8b9('0x2d')],_0x1457ef[_0xb8b9('0x35')]));if(_0x25149f['query']['filter']){_0x1db27b[_0xb8b9('0x34')]=_['merge'](_0x1db27b[_0xb8b9('0x34')],{'$or':_[_0xb8b9('0x27')](_0x1db27b[_0xb8b9('0x2f')],function(_0x49c16f){var _0x56ce10={};_0x56ce10[_0x49c16f]={'$like':'%'+_0x25149f[_0xb8b9('0x2d')][_0xb8b9('0x37')]+'%'};return _0x56ce10;})});}_0x1db27b=_[_0xb8b9('0x38')]({},_0x1db27b,_0x25149f['options']);return _0x23df67['getSubjects'](_0x1db27b);}})['then'](function(_0x27d61d){if(_0x27d61d){_0x579a63=_0x27d61d[_0xb8b9('0x49')];if(!_0x25149f[_0xb8b9('0x2d')][_0xb8b9('0x4c')]('nolimit')){_0x1db27b['limit']=qs['limit'](_0x25149f['query'][_0xb8b9('0x1b')]);_0x1db27b[_0xb8b9('0x18')]=qs[_0xb8b9('0x18')](_0x25149f[_0xb8b9('0x2d')][_0xb8b9('0x18')]);}return _0x23df67[_0xb8b9('0x4a')](_0x1db27b);}})[_0xb8b9('0x21')](function(_0x44d2fb){if(_0x44d2fb){return _0x44d2fb?{'count':_0x579a63,'rows':_0x44d2fb}:null;}})['then'](respondWithResult(_0xa9f205,null))[_0xb8b9('0x46')](handleError(_0xa9f205,null));};exports[_0xb8b9('0x4d')]=function(_0x54b981,_0x348f8b,_0x1ffd69){var _0x58afc4={};var _0x17f053={};var _0x15562a;var _0x543369;return db[_0xb8b9('0x28')][_0xb8b9('0x48')]({'where':{'id':_0x54b981[_0xb8b9('0x41')]['id']}})[_0xb8b9('0x21')](handleEntityNotFound(_0x348f8b,null))[_0xb8b9('0x21')](function(_0x6108a1){if(_0x6108a1){_0x15562a=_0x6108a1;_0x17f053['model']=_[_0xb8b9('0x42')](db[_0xb8b9('0x4b')][_0xb8b9('0x29')]);_0x17f053[_0xb8b9('0x2d')]=_['keys'](_0x54b981[_0xb8b9('0x2d')]);_0x17f053[_0xb8b9('0x35')]=_[_0xb8b9('0x2e')](_0x17f053[_0xb8b9('0x2c')],_0x17f053[_0xb8b9('0x2d')]);_0x58afc4[_0xb8b9('0x2f')]=_['intersection'](_0x17f053[_0xb8b9('0x2c')],qs[_0xb8b9('0x30')](_0x54b981[_0xb8b9('0x2d')][_0xb8b9('0x30')]));_0x58afc4['attributes']=_0x58afc4[_0xb8b9('0x2f')][_0xb8b9('0x49')]?_0x58afc4[_0xb8b9('0x2f')]:_0x17f053[_0xb8b9('0x2c')];_0x58afc4[_0xb8b9('0x32')]=qs[_0xb8b9('0x33')](_0x54b981['query'][_0xb8b9('0x33')]);_0x58afc4['where']=qs[_0xb8b9('0x35')](_[_0xb8b9('0x36')](_0x54b981[_0xb8b9('0x2d')],_0x17f053[_0xb8b9('0x35')]));if(_0x54b981[_0xb8b9('0x2d')]['filter']){_0x58afc4[_0xb8b9('0x34')]=_['merge'](_0x58afc4[_0xb8b9('0x34')],{'$or':_[_0xb8b9('0x27')](_0x58afc4[_0xb8b9('0x2f')],function(_0x409ca8){var _0x26ef56={};_0x26ef56[_0x409ca8]={'$like':'%'+_0x54b981[_0xb8b9('0x2d')][_0xb8b9('0x37')]+'%'};return _0x26ef56;})});}_0x58afc4=_[_0xb8b9('0x38')]({},_0x58afc4,_0x54b981['options']);return _0x15562a[_0xb8b9('0x4d')](_0x58afc4);}})[_0xb8b9('0x21')](function(_0x26f339){if(_0x26f339){_0x543369=_0x26f339[_0xb8b9('0x49')];if(!_0x54b981[_0xb8b9('0x2d')][_0xb8b9('0x4c')](_0xb8b9('0x31'))){_0x58afc4[_0xb8b9('0x1b')]=qs['limit'](_0x54b981[_0xb8b9('0x2d')]['limit']);_0x58afc4[_0xb8b9('0x18')]=qs[_0xb8b9('0x18')](_0x54b981[_0xb8b9('0x2d')]['offset']);}return _0x15562a['getDescriptions'](_0x58afc4);}})['then'](function(_0x43ef21){if(_0x43ef21){return _0x43ef21?{'count':_0x543369,'rows':_0x43ef21}:null;}})[_0xb8b9('0x21')](respondWithResult(_0x348f8b,null))[_0xb8b9('0x46')](handleError(_0x348f8b,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 142867a..5939763 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 _0xdd81=['moment','bluebird','request-promise','rimraf','./intSugarcrmConfiguration.attributes','exports','int_sugarcrm_configurations','lodash','util','../../config/logger'];(function(_0x284932,_0x2a0f13){var _0x1b9a24=function(_0x3f5301){while(--_0x3f5301){_0x284932['push'](_0x284932['shift']());}};_0x1b9a24(++_0x2a0f13);}(_0xdd81,0xc5));var _0x1dd8=function(_0x5bce63,_0x206618){_0x5bce63=_0x5bce63-0x0;var _0x1cb080=_0xdd81[_0x5bce63];return _0x1cb080;};'use strict';var _=require(_0x1dd8('0x0'));var util=require(_0x1dd8('0x1'));var logger=require(_0x1dd8('0x2'))('api');var moment=require(_0x1dd8('0x3'));var BPromise=require(_0x1dd8('0x4'));var rp=require(_0x1dd8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1dd8('0x6'));var config=require('../../config/environment');var attributes=require(_0x1dd8('0x7'));module[_0x1dd8('0x8')]=function(_0x4f7df8,_0x5d60c6){return _0x4f7df8['define']('SugarcrmConfiguration',attributes,{'tableName':_0x1dd8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb041=['util','../../config/logger','api','moment','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','define','lodash'];(function(_0x30e7a6,_0x443470){var _0x5b175d=function(_0x7c76a6){while(--_0x7c76a6){_0x30e7a6['push'](_0x30e7a6['shift']());}};_0x5b175d(++_0x443470);}(_0xb041,0x74));var _0x1b04=function(_0x38ade8,_0x55dc2c){_0x38ade8=_0x38ade8-0x0;var _0x527aa8=_0xb041[_0x38ade8];return _0x527aa8;};'use strict';var _=require(_0x1b04('0x0'));var util=require(_0x1b04('0x1'));var logger=require(_0x1b04('0x2'))(_0x1b04('0x3'));var moment=require(_0x1b04('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b04('0x5'));var config=require(_0x1b04('0x6'));var attributes=require(_0x1b04('0x7'));module['exports']=function(_0x19f70f,_0x4eda11){return _0x19f70f[_0x1b04('0x8')]('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','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 5b55784..bbf2340 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 _0x05c6=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','bluebird','randomstring'];(function(_0x1ba257,_0x5ec449){var _0x13f1fd=function(_0x5799a9){while(--_0x5799a9){_0x1ba257['push'](_0x1ba257['shift']());}};_0x13f1fd(++_0x5ec449);}(_0x05c6,0x80));var _0x605c=function(_0x24f3af,_0x349c6c){_0x24f3af=_0x24f3af-0x0;var _0x435a6e=_0x05c6[_0x24f3af];return _0x435a6e;};'use strict';var _=require(_0x605c('0x0'));var util=require(_0x605c('0x1'));var moment=require('moment');var BPromise=require(_0x605c('0x2'));var rs=require(_0x605c('0x3'));var fs=require('fs');var Redis=require(_0x605c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x605c('0x5'));var logger=require(_0x605c('0x6'))('rpc');var config=require(_0x605c('0x7'));var jayson=require(_0x605c('0x8'));var client=jayson[_0x605c('0x9')][_0x605c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe6e6c0,_0x297a57,_0x549985){return new BPromise(function(_0x1f5fc0,_0x11667f){return client[_0x605c('0xb')](_0xe6e6c0,_0x549985)[_0x605c('0xc')](function(_0x230dc1){logger[_0x605c('0xd')](_0x605c('0xe'),_0x297a57,_0x605c('0xf'));logger[_0x605c('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x297a57,_0x605c('0xf'),JSON[_0x605c('0x11')](_0x230dc1));if(_0x230dc1['error']){if(_0x230dc1[_0x605c('0x12')][_0x605c('0x13')]===0x1f4){logger[_0x605c('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x297a57,_0x230dc1['error'][_0x605c('0x14')]);return _0x11667f(_0x230dc1[_0x605c('0x12')]['message']);}logger[_0x605c('0x12')](_0x605c('0xe'),_0x297a57,_0x230dc1[_0x605c('0x12')][_0x605c('0x14')]);return _0x1f5fc0(_0x230dc1[_0x605c('0x12')][_0x605c('0x14')]);}else{logger[_0x605c('0xd')](_0x605c('0xe'),_0x297a57,_0x605c('0xf'));_0x1f5fc0(_0x230dc1['result'][_0x605c('0x14')]);}})[_0x605c('0x15')](function(_0x1ba3c1){logger[_0x605c('0x12')](_0x605c('0xe'),_0x297a57,_0x1ba3c1);_0x11667f(_0x1ba3c1);});});} \ No newline at end of file +var _0x2bfb=['then','info','SugarcrmConfiguration,\x20%s,\x20%s','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x2bfb,0x1ef));var _0xb2bf=function(_0x1e5cbd,_0x2c3a1b){_0x1e5cbd=_0x1e5cbd-0x0;var _0x1d8677=_0x2bfb[_0x1e5cbd];return _0x1d8677;};'use strict';var _=require(_0xb2bf('0x0'));var util=require(_0xb2bf('0x1'));var moment=require('moment');var BPromise=require(_0xb2bf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb2bf('0x3'));var db=require(_0xb2bf('0x4'))['db'];var utils=require(_0xb2bf('0x5'));var logger=require(_0xb2bf('0x6'))(_0xb2bf('0x7'));var config=require('../../config/environment');var jayson=require(_0xb2bf('0x8'));var client=jayson[_0xb2bf('0x9')][_0xb2bf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57510d,_0x221720,_0x3b88d5){return new BPromise(function(_0xa83ff4,_0xdaa949){return client['request'](_0x57510d,_0x3b88d5)[_0xb2bf('0xb')](function(_0x359f80){logger[_0xb2bf('0xc')](_0xb2bf('0xd'),_0x221720,'request\x20sent');logger['debug'](_0xb2bf('0xe'),_0x221720,'request\x20sent',JSON[_0xb2bf('0xf')](_0x359f80));if(_0x359f80['error']){if(_0x359f80[_0xb2bf('0x10')][_0xb2bf('0x11')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x221720,_0x359f80[_0xb2bf('0x10')][_0xb2bf('0x12')]);return _0xdaa949(_0x359f80['error']['message']);}logger[_0xb2bf('0x10')](_0xb2bf('0xd'),_0x221720,_0x359f80['error'][_0xb2bf('0x12')]);return _0xa83ff4(_0x359f80[_0xb2bf('0x10')][_0xb2bf('0x12')]);}else{logger[_0xb2bf('0xc')](_0xb2bf('0xd'),_0x221720,_0xb2bf('0x13'));_0xa83ff4(_0x359f80[_0xb2bf('0x14')][_0xb2bf('0x12')]);}})[_0xb2bf('0x15')](function(_0x42fe4f){logger[_0xb2bf('0x10')](_0xb2bf('0xd'),_0x221720,_0x42fe4f);_0xdaa949(_0x42fe4f);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index f99be09..f4298c5 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 _0x03f5=['create','put','delete','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','index','/:id','post','isAuthenticated'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x03f5,0x154));var _0x503f=function(_0x33247c,_0x3c76a7){_0x33247c=_0x33247c-0x0;var _0x1d37a7=_0x03f5[_0x33247c];return _0x1d37a7;};'use strict';var multer=require(_0x503f('0x0'));var util=require(_0x503f('0x1'));var path=require(_0x503f('0x2'));var timeout=require(_0x503f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x503f('0x4'));var interaction=require(_0x503f('0x5'));var config=require('../../config/environment');var controller=require(_0x503f('0x6'));router[_0x503f('0x7')]('/',auth['isAuthenticated'](),controller[_0x503f('0x8')]);router[_0x503f('0x7')](_0x503f('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x503f('0xa')]('/',auth[_0x503f('0xb')](),controller[_0x503f('0xc')]);router[_0x503f('0xd')](_0x503f('0x9'),auth[_0x503f('0xb')](),controller['update']);router[_0x503f('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x503f('0xf')]);module['exports']=router; \ No newline at end of file +var _0x7c99=['../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','/:id','post','create','put','update','exports','multer','util','connect-timeout','fs-extra'];(function(_0x146a97,_0x2d8483){var _0x259d5c=function(_0x3ca436){while(--_0x3ca436){_0x146a97['push'](_0x146a97['shift']());}};_0x259d5c(++_0x2d8483);}(_0x7c99,0x155));var _0x97c9=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7c99[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x97c9('0x0'));var util=require(_0x97c9('0x1'));var path=require('path');var timeout=require(_0x97c9('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x97c9('0x3'));var auth=require(_0x97c9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x97c9('0x5'));var controller=require(_0x97c9('0x6'));router[_0x97c9('0x7')]('/',auth[_0x97c9('0x8')](),controller['index']);router[_0x97c9('0x7')](_0x97c9('0x9'),auth[_0x97c9('0x8')](),controller['show']);router[_0x97c9('0xa')]('/',auth[_0x97c9('0x8')](),controller[_0x97c9('0xb')]);router[_0x97c9('0xc')](_0x97c9('0x9'),auth[_0x97c9('0x8')](),controller[_0x97c9('0xd')]);router['delete'](_0x97c9('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x97c9('0xe')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 7a9dcfd..188829f 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 _0xbb02=['variable','keyValue','string','STRING','ENUM','customVariable','BOOLEAN','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb02,0xff));var _0x2bb0=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xbb02[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0x2bb0('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x2bb0('0x1'),'customVariable',_0x2bb0('0x2'),'picklist'),'defaultValue':_0x2bb0('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2bb0('0x4')]},'keyType':{'type':Sequelize[_0x2bb0('0x5')]('string',_0x2bb0('0x1'),_0x2bb0('0x6'))},'keyContent':{'type':Sequelize[_0x2bb0('0x4')]},'idField':{'type':Sequelize[_0x2bb0('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2bb0('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2bb0('0x4')]}}; \ No newline at end of file +var _0xb4b1=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x52c010,_0x5052d7){var _0x133f0b=function(_0x1e13e7){while(--_0x1e13e7){_0x52c010['push'](_0x52c010['shift']());}};_0x133f0b(++_0x5052d7);}(_0xb4b1,0x11d));var _0x1b4b=function(_0x4d64b7,_0x551d88){_0x4d64b7=_0x4d64b7-0x0;var _0x15a29e=_0xb4b1[_0x4d64b7];return _0x15a29e;};'use strict';var Sequelize=require('sequelize');module[_0x1b4b('0x0')]={'type':{'type':Sequelize[_0x1b4b('0x1')](_0x1b4b('0x2'),_0x1b4b('0x3'),_0x1b4b('0x4'),_0x1b4b('0x5'),_0x1b4b('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1b4b('0x7')]},'keyType':{'type':Sequelize[_0x1b4b('0x1')]('string',_0x1b4b('0x3'),_0x1b4b('0x4'))},'keyContent':{'type':Sequelize[_0x1b4b('0x7')]},'idField':{'type':Sequelize[_0x1b4b('0x7')]},'nameField':{'type':Sequelize[_0x1b4b('0x7')]},'customField':{'type':Sequelize[_0x1b4b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1b4b('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 2d42143..53e8fd6 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 _0xc352=['reject','save','update','then','destroy','end','error','stack','name','send','index','map','SugarcrmField','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','include','findAll','rows','catch','show','options','find','create','body','params','eml-format','zip-dir','fast-json-patch','moment','mustache','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','status','offset','undefined','count','limit','Content-Range','json','apply'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xc352,0x72));var _0x2c35=function(_0xf26c2e,_0x56c3ea){_0xf26c2e=_0xf26c2e-0x0;var _0x46ecb4=_0xc352[_0xf26c2e];return _0x46ecb4;};'use strict';var emlformat=require(_0x2c35('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2c35('0x1'));var jsonpatch=require(_0x2c35('0x2'));var rp=require('request-promise');var moment=require(_0x2c35('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2c35('0x4'));var util=require('util');var path=require(_0x2c35('0x5'));var sox=require(_0x2c35('0x6'));var csv=require('to-csv');var ejs=require(_0x2c35('0x7'));var fs=require('fs');var fs_extra=require(_0x2c35('0x8'));var _=require(_0x2c35('0x9'));var squel=require(_0x2c35('0xa'));var crypto=require(_0x2c35('0xb'));var jsforce=require(_0x2c35('0xc'));var deskjs=require(_0x2c35('0xd'));var toCsv=require(_0x2c35('0xe'));var querystring=require(_0x2c35('0xf'));var Papa=require(_0x2c35('0x10'));var Redis=require(_0x2c35('0x11'));var authService=require(_0x2c35('0x12'));var qs=require(_0x2c35('0x13'));var as=require(_0x2c35('0x14'));var hardwareService=require(_0x2c35('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x2c35('0x16'));var config=require(_0x2c35('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49c183,_0x4611e5){_0x4611e5=_0x4611e5||0xcc;return function(_0xa72712){if(_0xa72712){return _0x49c183['sendStatus'](_0x4611e5);}return _0x49c183[_0x2c35('0x18')](_0x4611e5)['end']();};}function respondWithResult(_0x2cfb3d,_0x27fe0b){_0x27fe0b=_0x27fe0b||0xc8;return function(_0xd1320a){if(_0xd1320a){return _0x2cfb3d[_0x2c35('0x18')](_0x27fe0b)['json'](_0xd1320a);}};}function respondWithFilteredResult(_0x125321,_0xf23557){return function(_0x311a0b){if(_0x311a0b){var _0x4097ba=typeof _0xf23557[_0x2c35('0x19')]===_0x2c35('0x1a')&&typeof _0xf23557['limit']===_0x2c35('0x1a');var _0x52731f=_0x311a0b[_0x2c35('0x1b')];var _0x348737=_0x4097ba?0x0:_0xf23557[_0x2c35('0x19')];var _0xce96a7=_0x4097ba?_0x311a0b['count']:_0xf23557['offset']+_0xf23557[_0x2c35('0x1c')];var _0x1868b3;if(_0xce96a7>=_0x52731f){_0xce96a7=_0x52731f;_0x1868b3=0xc8;}else{_0x1868b3=0xce;}_0x125321[_0x2c35('0x18')](_0x1868b3);return _0x125321['set'](_0x2c35('0x1d'),_0x348737+'-'+_0xce96a7+'/'+_0x52731f)[_0x2c35('0x1e')](_0x311a0b);}return null;};}function patchUpdates(_0x401f0f){return function(_0x18fed2){try{jsonpatch[_0x2c35('0x1f')](_0x18fed2,_0x401f0f,!![]);}catch(_0x4566ba){return BPromise[_0x2c35('0x20')](_0x4566ba);}return _0x18fed2[_0x2c35('0x21')]();};}function saveUpdates(_0x5c372a,_0x4bb7dd){return function(_0x15b989){if(_0x15b989){return _0x15b989[_0x2c35('0x22')](_0x5c372a)[_0x2c35('0x23')](function(_0xe5c12e){return _0xe5c12e;});}return null;};}function removeEntity(_0x25b09c,_0x3046a7){return function(_0x2c9617){if(_0x2c9617){return _0x2c9617[_0x2c35('0x24')]()[_0x2c35('0x23')](function(){_0x25b09c[_0x2c35('0x18')](0xcc)[_0x2c35('0x25')]();});}};}function handleEntityNotFound(_0x197660,_0x35cfd8){return function(_0x116627){if(!_0x116627){_0x197660['sendStatus'](0x194);}return _0x116627;};}function handleError(_0x21ae57,_0x31ff97){_0x31ff97=_0x31ff97||0x1f4;return function(_0x53726c){logger[_0x2c35('0x26')](_0x53726c[_0x2c35('0x27')]);if(_0x53726c[_0x2c35('0x28')]){delete _0x53726c[_0x2c35('0x28')];}_0x21ae57[_0x2c35('0x18')](_0x31ff97)[_0x2c35('0x29')](_0x53726c);};}exports[_0x2c35('0x2a')]=function(_0x53e93a,_0x5a13a2){var _0x119037={},_0x327758={},_0x2bfb00={'count':0x0,'rows':[]};var _0x5e9822=_[_0x2c35('0x2b')](db[_0x2c35('0x2c')][_0x2c35('0x2d')],function(_0x1b83f7){return{'name':_0x1b83f7['fieldName'],'type':_0x1b83f7[_0x2c35('0x2e')]['key']};});_0x327758[_0x2c35('0x2f')]=_[_0x2c35('0x2b')](_0x5e9822,_0x2c35('0x28'));_0x327758[_0x2c35('0x30')]=_[_0x2c35('0x31')](_0x53e93a[_0x2c35('0x30')]);_0x327758[_0x2c35('0x32')]=_['intersection'](_0x327758[_0x2c35('0x2f')],_0x327758['query']);_0x119037[_0x2c35('0x33')]=_[_0x2c35('0x34')](_0x327758[_0x2c35('0x2f')],qs[_0x2c35('0x35')](_0x53e93a[_0x2c35('0x30')][_0x2c35('0x35')]));_0x119037['attributes']=_0x119037[_0x2c35('0x33')][_0x2c35('0x36')]?_0x119037[_0x2c35('0x33')]:_0x327758[_0x2c35('0x2f')];if(!_0x53e93a[_0x2c35('0x30')]['hasOwnProperty'](_0x2c35('0x37'))){_0x119037[_0x2c35('0x1c')]=qs[_0x2c35('0x1c')](_0x53e93a[_0x2c35('0x30')][_0x2c35('0x1c')]);_0x119037[_0x2c35('0x19')]=qs[_0x2c35('0x19')](_0x53e93a[_0x2c35('0x30')][_0x2c35('0x19')]);}_0x119037[_0x2c35('0x38')]=qs['sort'](_0x53e93a[_0x2c35('0x30')][_0x2c35('0x39')]);_0x119037['where']=qs[_0x2c35('0x32')](_[_0x2c35('0x3a')](_0x53e93a[_0x2c35('0x30')],_0x327758['filters']),_0x5e9822);if(_0x53e93a[_0x2c35('0x30')][_0x2c35('0x3b')]){_0x119037['where']=_['merge'](_0x119037[_0x2c35('0x3c')],{'$or':_['map'](_0x5e9822,function(_0x123700){if(_0x123700[_0x2c35('0x2e')]!==_0x2c35('0x3d')){var _0x45ab5f={};_0x45ab5f[_0x123700[_0x2c35('0x28')]]={'$like':'%'+_0x53e93a['query']['filter']+'%'};return _0x45ab5f;}})});}_0x119037=_[_0x2c35('0x3e')]({},_0x119037,_0x53e93a['options']);var _0x52bb4f={'where':_0x119037[_0x2c35('0x3c')]};return db[_0x2c35('0x2c')][_0x2c35('0x1b')](_0x52bb4f)[_0x2c35('0x23')](function(_0x1283e4){_0x2bfb00[_0x2c35('0x1b')]=_0x1283e4;if(_0x53e93a[_0x2c35('0x30')]['includeAll']){_0x119037[_0x2c35('0x3f')]=[{'all':!![]}];}return db['SugarcrmField'][_0x2c35('0x40')](_0x119037);})[_0x2c35('0x23')](function(_0x129ad2){_0x2bfb00[_0x2c35('0x41')]=_0x129ad2;return _0x2bfb00;})['then'](respondWithFilteredResult(_0x5a13a2,_0x119037))[_0x2c35('0x42')](handleError(_0x5a13a2,null));};exports[_0x2c35('0x43')]=function(_0x536294,_0x2cb6f2){var _0x363a9f={'raw':!![],'where':{'id':_0x536294['params']['id']}},_0x5eae33={};_0x5eae33[_0x2c35('0x2f')]=_[_0x2c35('0x31')](db['SugarcrmField'][_0x2c35('0x2d')]);_0x5eae33[_0x2c35('0x30')]=_['keys'](_0x536294['query']);_0x5eae33[_0x2c35('0x32')]=_[_0x2c35('0x34')](_0x5eae33[_0x2c35('0x2f')],_0x5eae33[_0x2c35('0x30')]);_0x363a9f[_0x2c35('0x33')]=_[_0x2c35('0x34')](_0x5eae33[_0x2c35('0x2f')],qs['fields'](_0x536294[_0x2c35('0x30')][_0x2c35('0x35')]));_0x363a9f['attributes']=_0x363a9f['attributes'][_0x2c35('0x36')]?_0x363a9f[_0x2c35('0x33')]:_0x5eae33[_0x2c35('0x2f')];if(_0x536294[_0x2c35('0x30')]['includeAll']){_0x363a9f[_0x2c35('0x3f')]=[{'all':!![]}];}_0x363a9f=_[_0x2c35('0x3e')]({},_0x363a9f,_0x536294[_0x2c35('0x44')]);return db[_0x2c35('0x2c')][_0x2c35('0x45')](_0x363a9f)[_0x2c35('0x23')](handleEntityNotFound(_0x2cb6f2,null))[_0x2c35('0x23')](respondWithResult(_0x2cb6f2,null))[_0x2c35('0x42')](handleError(_0x2cb6f2,null));};exports[_0x2c35('0x46')]=function(_0x4cba63,_0x2b170f){return db[_0x2c35('0x2c')][_0x2c35('0x46')](_0x4cba63['body'],{})['then'](respondWithResult(_0x2b170f,0xc9))[_0x2c35('0x42')](handleError(_0x2b170f,null));};exports[_0x2c35('0x22')]=function(_0x4b7f68,_0x562031){if(_0x4b7f68[_0x2c35('0x47')]['id']){delete _0x4b7f68[_0x2c35('0x47')]['id'];}return db[_0x2c35('0x2c')][_0x2c35('0x45')]({'where':{'id':_0x4b7f68[_0x2c35('0x48')]['id']}})[_0x2c35('0x23')](handleEntityNotFound(_0x562031,null))[_0x2c35('0x23')](saveUpdates(_0x4b7f68[_0x2c35('0x47')],null))[_0x2c35('0x23')](respondWithResult(_0x562031,null))['catch'](handleError(_0x562031,null));};exports[_0x2c35('0x24')]=function(_0x180088,_0x1a64b0){return db[_0x2c35('0x2c')][_0x2c35('0x45')]({'where':{'id':_0x180088['params']['id']}})[_0x2c35('0x23')](handleEntityNotFound(_0x1a64b0,null))['then'](removeEntity(_0x1a64b0,null))[_0x2c35('0x42')](handleError(_0x1a64b0,null));}; \ No newline at end of file +var _0x7287=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','index','map','SugarcrmField','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','pick','filters','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x54db65,_0x2806c0){var _0x4941f9=function(_0x35d5bc){while(--_0x35d5bc){_0x54db65['push'](_0x54db65['shift']());}};_0x4941f9(++_0x2806c0);}(_0x7287,0x1c4));var _0x7728=function(_0x5e22c9,_0x432567){_0x5e22c9=_0x5e22c9-0x0;var _0x484daf=_0x7287[_0x5e22c9];return _0x484daf;};'use strict';var emlformat=require(_0x7728('0x0'));var rimraf=require(_0x7728('0x1'));var zipdir=require(_0x7728('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7728('0x3'));var BPromise=require(_0x7728('0x4'));var Mustache=require(_0x7728('0x5'));var util=require(_0x7728('0x6'));var path=require(_0x7728('0x7'));var sox=require(_0x7728('0x8'));var csv=require(_0x7728('0x9'));var ejs=require(_0x7728('0xa'));var fs=require('fs');var fs_extra=require(_0x7728('0xb'));var _=require(_0x7728('0xc'));var squel=require(_0x7728('0xd'));var crypto=require(_0x7728('0xe'));var jsforce=require(_0x7728('0xf'));var deskjs=require(_0x7728('0x10'));var toCsv=require(_0x7728('0x9'));var querystring=require('querystring');var Papa=require(_0x7728('0x11'));var Redis=require(_0x7728('0x12'));var authService=require(_0x7728('0x13'));var qs=require(_0x7728('0x14'));var as=require(_0x7728('0x15'));var hardwareService=require(_0x7728('0x16'));var logger=require(_0x7728('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x7728('0x18'));var licenseUtil=require(_0x7728('0x19'));var db=require(_0x7728('0x1a'))['db'];function respondWithStatusCode(_0x2d642e,_0x3c463d){_0x3c463d=_0x3c463d||0xcc;return function(_0x12a176){if(_0x12a176){return _0x2d642e['sendStatus'](_0x3c463d);}return _0x2d642e['status'](_0x3c463d)['end']();};}function respondWithResult(_0x23cbcc,_0x5e39c3){_0x5e39c3=_0x5e39c3||0xc8;return function(_0x269a53){if(_0x269a53){return _0x23cbcc[_0x7728('0x1b')](_0x5e39c3)[_0x7728('0x1c')](_0x269a53);}};}function respondWithFilteredResult(_0x5210f0,_0x21b21a){return function(_0xda198a){if(_0xda198a){var _0x16a8cc=typeof _0x21b21a[_0x7728('0x1d')]===_0x7728('0x1e')&&typeof _0x21b21a[_0x7728('0x1f')]===_0x7728('0x1e');var _0x4ee9b3=_0xda198a[_0x7728('0x20')];var _0x316613=_0x16a8cc?0x0:_0x21b21a[_0x7728('0x1d')];var _0x3bf6af=_0x16a8cc?_0xda198a[_0x7728('0x20')]:_0x21b21a[_0x7728('0x1d')]+_0x21b21a[_0x7728('0x1f')];var _0x265f34;if(_0x3bf6af>=_0x4ee9b3){_0x3bf6af=_0x4ee9b3;_0x265f34=0xc8;}else{_0x265f34=0xce;}_0x5210f0[_0x7728('0x1b')](_0x265f34);return _0x5210f0[_0x7728('0x21')](_0x7728('0x22'),_0x316613+'-'+_0x3bf6af+'/'+_0x4ee9b3)[_0x7728('0x1c')](_0xda198a);}return null;};}function patchUpdates(_0x828e19){return function(_0x509c91){try{jsonpatch[_0x7728('0x23')](_0x509c91,_0x828e19,!![]);}catch(_0x5edda5){return BPromise[_0x7728('0x24')](_0x5edda5);}return _0x509c91[_0x7728('0x25')]();};}function saveUpdates(_0x15db3b,_0x372991){return function(_0x99f0a9){if(_0x99f0a9){return _0x99f0a9[_0x7728('0x26')](_0x15db3b)['then'](function(_0x28a909){return _0x28a909;});}return null;};}function removeEntity(_0x597b8d,_0x4807ea){return function(_0x20815b){if(_0x20815b){return _0x20815b[_0x7728('0x27')]()[_0x7728('0x28')](function(){_0x597b8d['status'](0xcc)[_0x7728('0x29')]();});}};}function handleEntityNotFound(_0x348b17,_0x5b5a85){return function(_0x135689){if(!_0x135689){_0x348b17['sendStatus'](0x194);}return _0x135689;};}function handleError(_0x3917f6,_0x450240){_0x450240=_0x450240||0x1f4;return function(_0x5d9c09){logger[_0x7728('0x2a')](_0x5d9c09[_0x7728('0x2b')]);if(_0x5d9c09[_0x7728('0x2c')]){delete _0x5d9c09['name'];}_0x3917f6['status'](_0x450240)['send'](_0x5d9c09);};}exports[_0x7728('0x2d')]=function(_0x198531,_0x43251c){var _0x38b0ac={},_0x521900={},_0x14621f={'count':0x0,'rows':[]};var _0xab4fff=_[_0x7728('0x2e')](db[_0x7728('0x2f')][_0x7728('0x30')],function(_0x54901c){return{'name':_0x54901c[_0x7728('0x31')],'type':_0x54901c[_0x7728('0x32')]['key']};});_0x521900[_0x7728('0x33')]=_['map'](_0xab4fff,_0x7728('0x2c'));_0x521900[_0x7728('0x34')]=_[_0x7728('0x35')](_0x198531[_0x7728('0x34')]);_0x521900['filters']=_[_0x7728('0x36')](_0x521900[_0x7728('0x33')],_0x521900['query']);_0x38b0ac[_0x7728('0x37')]=_[_0x7728('0x36')](_0x521900[_0x7728('0x33')],qs['fields'](_0x198531[_0x7728('0x34')][_0x7728('0x38')]));_0x38b0ac['attributes']=_0x38b0ac[_0x7728('0x37')][_0x7728('0x39')]?_0x38b0ac[_0x7728('0x37')]:_0x521900['model'];if(!_0x198531[_0x7728('0x34')]['hasOwnProperty'](_0x7728('0x3a'))){_0x38b0ac['limit']=qs[_0x7728('0x1f')](_0x198531[_0x7728('0x34')]['limit']);_0x38b0ac[_0x7728('0x1d')]=qs[_0x7728('0x1d')](_0x198531[_0x7728('0x34')][_0x7728('0x1d')]);}_0x38b0ac[_0x7728('0x3b')]=qs[_0x7728('0x3c')](_0x198531[_0x7728('0x34')][_0x7728('0x3c')]);_0x38b0ac['where']=qs['filters'](_[_0x7728('0x3d')](_0x198531[_0x7728('0x34')],_0x521900[_0x7728('0x3e')]),_0xab4fff);if(_0x198531[_0x7728('0x34')][_0x7728('0x3f')]){_0x38b0ac['where']=_[_0x7728('0x40')](_0x38b0ac[_0x7728('0x41')],{'$or':_[_0x7728('0x2e')](_0xab4fff,function(_0xaf84ec){if(_0xaf84ec[_0x7728('0x32')]!==_0x7728('0x42')){var _0x39348d={};_0x39348d[_0xaf84ec[_0x7728('0x2c')]]={'$like':'%'+_0x198531['query'][_0x7728('0x3f')]+'%'};return _0x39348d;}})});}_0x38b0ac=_[_0x7728('0x40')]({},_0x38b0ac,_0x198531[_0x7728('0x43')]);var _0x3caec3={'where':_0x38b0ac[_0x7728('0x41')]};return db['SugarcrmField']['count'](_0x3caec3)[_0x7728('0x28')](function(_0x4fb5b5){_0x14621f[_0x7728('0x20')]=_0x4fb5b5;if(_0x198531['query'][_0x7728('0x44')]){_0x38b0ac[_0x7728('0x45')]=[{'all':!![]}];}return db[_0x7728('0x2f')][_0x7728('0x46')](_0x38b0ac);})[_0x7728('0x28')](function(_0x2bce85){_0x14621f[_0x7728('0x47')]=_0x2bce85;return _0x14621f;})[_0x7728('0x28')](respondWithFilteredResult(_0x43251c,_0x38b0ac))['catch'](handleError(_0x43251c,null));};exports[_0x7728('0x48')]=function(_0x213143,_0x3a7055){var _0x210d5e={'raw':!![],'where':{'id':_0x213143[_0x7728('0x49')]['id']}},_0x37108c={};_0x37108c[_0x7728('0x33')]=_[_0x7728('0x35')](db['SugarcrmField'][_0x7728('0x30')]);_0x37108c['query']=_[_0x7728('0x35')](_0x213143[_0x7728('0x34')]);_0x37108c[_0x7728('0x3e')]=_[_0x7728('0x36')](_0x37108c[_0x7728('0x33')],_0x37108c[_0x7728('0x34')]);_0x210d5e[_0x7728('0x37')]=_[_0x7728('0x36')](_0x37108c[_0x7728('0x33')],qs['fields'](_0x213143[_0x7728('0x34')][_0x7728('0x38')]));_0x210d5e['attributes']=_0x210d5e[_0x7728('0x37')][_0x7728('0x39')]?_0x210d5e[_0x7728('0x37')]:_0x37108c['model'];if(_0x213143[_0x7728('0x34')][_0x7728('0x44')]){_0x210d5e[_0x7728('0x45')]=[{'all':!![]}];}_0x210d5e=_[_0x7728('0x40')]({},_0x210d5e,_0x213143[_0x7728('0x43')]);return db[_0x7728('0x2f')][_0x7728('0x4a')](_0x210d5e)[_0x7728('0x28')](handleEntityNotFound(_0x3a7055,null))[_0x7728('0x28')](respondWithResult(_0x3a7055,null))[_0x7728('0x4b')](handleError(_0x3a7055,null));};exports[_0x7728('0x4c')]=function(_0x481eb4,_0x4fe486){return db[_0x7728('0x2f')][_0x7728('0x4c')](_0x481eb4['body'],{})[_0x7728('0x28')](respondWithResult(_0x4fe486,0xc9))[_0x7728('0x4b')](handleError(_0x4fe486,null));};exports[_0x7728('0x26')]=function(_0x4f695c,_0x15b155){if(_0x4f695c['body']['id']){delete _0x4f695c[_0x7728('0x4d')]['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x4f695c[_0x7728('0x49')]['id']}})[_0x7728('0x28')](handleEntityNotFound(_0x15b155,null))[_0x7728('0x28')](saveUpdates(_0x4f695c[_0x7728('0x4d')],null))[_0x7728('0x28')](respondWithResult(_0x15b155,null))[_0x7728('0x4b')](handleError(_0x15b155,null));};exports[_0x7728('0x27')]=function(_0x5337d3,_0x2b64ac){return db[_0x7728('0x2f')]['find']({'where':{'id':_0x5337d3[_0x7728('0x49')]['id']}})[_0x7728('0x28')](handleEntityNotFound(_0x2b64ac,null))['then'](removeEntity(_0x2b64ac,null))['catch'](handleError(_0x2b64ac,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index c30071c..613826f 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 _0xa924=['define','SugarcrmField','int_sugarcrm_fields','idField','FieldId','lodash','util','api','request-promise','path','rimraf','./intSugarcrmField.attributes'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xa924,0xdd));var _0x4a92=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xa924[_0x500419];return _0x241c1a;};'use strict';var _=require(_0x4a92('0x0'));var util=require(_0x4a92('0x1'));var logger=require('../../config/logger')(_0x4a92('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4a92('0x3'));var fs=require('fs');var path=require(_0x4a92('0x4'));var rimraf=require(_0x4a92('0x5'));var config=require('../../config/environment');var attributes=require(_0x4a92('0x6'));module['exports']=function(_0x1747a3,_0x3f0f89){return _0x1747a3[_0x4a92('0x7')](_0x4a92('0x8'),attributes,{'tableName':_0x4a92('0x9'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x4a92('0xa'),_0x4a92('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdf53=['request-promise','path','rimraf','../../config/environment','exports','define','SugarcrmField','int_sugarcrm_fields','FieldId','lodash','util','api','moment'];(function(_0x34eb31,_0x8f0f70){var _0x254994=function(_0xbec9a3){while(--_0xbec9a3){_0x34eb31['push'](_0x34eb31['shift']());}};_0x254994(++_0x8f0f70);}(_0xdf53,0x71));var _0x3df5=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xdf53[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x3df5('0x0'));var util=require(_0x3df5('0x1'));var logger=require('../../config/logger')(_0x3df5('0x2'));var moment=require(_0x3df5('0x3'));var BPromise=require('bluebird');var rp=require(_0x3df5('0x4'));var fs=require('fs');var path=require(_0x3df5('0x5'));var rimraf=require(_0x3df5('0x6'));var config=require(_0x3df5('0x7'));var attributes=require('./intSugarcrmField.attributes');module[_0x3df5('0x8')]=function(_0x2885e4,_0x286921){return _0x2885e4[_0x3df5('0x9')](_0x3df5('0xa'),attributes,{'tableName':_0x3df5('0xb'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField',_0x3df5('0xc')],'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 d70da12..db6ada6 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 _0x9091=['lodash','bluebird','ioredis','../../mysqldb','../../config/logger','client','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9091,0x10e));var _0x1909=function(_0x168656,_0x29cdcc){_0x168656=_0x168656-0x0;var _0x18e641=_0x9091[_0x168656];return _0x18e641;};'use strict';var _=require(_0x1909('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1909('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1909('0x2'));var db=require(_0x1909('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1909('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1909('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa9a2e7,_0x3674e,_0x1f007a){return new BPromise(function(_0x31ffa9,_0x54033e){return client[_0x1909('0x6')](_0xa9a2e7,_0x1f007a)[_0x1909('0x7')](function(_0x2234a0){logger[_0x1909('0x8')](_0x1909('0x9'),_0x3674e,_0x1909('0xa'));logger['debug'](_0x1909('0xb'),_0x3674e,_0x1909('0xa'),JSON[_0x1909('0xc')](_0x2234a0));if(_0x2234a0[_0x1909('0xd')]){if(_0x2234a0['error'][_0x1909('0xe')]===0x1f4){logger[_0x1909('0xd')](_0x1909('0x9'),_0x3674e,_0x2234a0['error'][_0x1909('0xf')]);return _0x54033e(_0x2234a0[_0x1909('0xd')][_0x1909('0xf')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x3674e,_0x2234a0[_0x1909('0xd')]['message']);return _0x31ffa9(_0x2234a0[_0x1909('0xd')][_0x1909('0xf')]);}else{logger[_0x1909('0x8')](_0x1909('0x9'),_0x3674e,'request\x20sent');_0x31ffa9(_0x2234a0[_0x1909('0x10')][_0x1909('0xf')]);}})[_0x1909('0x11')](function(_0x194fcd){logger[_0x1909('0xd')](_0x1909('0x9'),_0x3674e,_0x194fcd);_0x54033e(_0x194fcd);});});} \ No newline at end of file +var _0x2c89=['SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','SugarcrmField,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x2c89,0x11a));var _0x92c8=function(_0x391917,_0x107308){_0x391917=_0x391917-0x0;var _0xa86c17=_0x2c89[_0x391917];return _0xa86c17;};'use strict';var _=require(_0x92c8('0x0'));var util=require(_0x92c8('0x1'));var moment=require(_0x92c8('0x2'));var BPromise=require('bluebird');var rs=require(_0x92c8('0x3'));var fs=require('fs');var Redis=require(_0x92c8('0x4'));var db=require(_0x92c8('0x5'))['db'];var utils=require(_0x92c8('0x6'));var logger=require(_0x92c8('0x7'))(_0x92c8('0x8'));var config=require(_0x92c8('0x9'));var jayson=require(_0x92c8('0xa'));var client=jayson[_0x92c8('0xb')][_0x92c8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d0d52,_0x1a0bb3,_0x273772){return new BPromise(function(_0x36ad8e,_0x106905){return client[_0x92c8('0xd')](_0x1d0d52,_0x273772)[_0x92c8('0xe')](function(_0x1128e2){logger[_0x92c8('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x1a0bb3,_0x92c8('0x10'));logger[_0x92c8('0x11')](_0x92c8('0x12'),_0x1a0bb3,_0x92c8('0x10'),JSON[_0x92c8('0x13')](_0x1128e2));if(_0x1128e2['error']){if(_0x1128e2[_0x92c8('0x14')]['code']===0x1f4){logger[_0x92c8('0x14')]('SugarcrmField,\x20%s,\x20%s',_0x1a0bb3,_0x1128e2[_0x92c8('0x14')][_0x92c8('0x15')]);return _0x106905(_0x1128e2[_0x92c8('0x14')]['message']);}logger[_0x92c8('0x14')](_0x92c8('0x16'),_0x1a0bb3,_0x1128e2[_0x92c8('0x14')]['message']);return _0x36ad8e(_0x1128e2[_0x92c8('0x14')][_0x92c8('0x15')]);}else{logger[_0x92c8('0xf')](_0x92c8('0x16'),_0x1a0bb3,_0x92c8('0x10'));_0x36ad8e(_0x1128e2[_0x92c8('0x17')][_0x92c8('0x15')]);}})[_0x92c8('0x18')](function(_0x19c2cc){logger['error'](_0x92c8('0x16'),_0x1a0bb3,_0x19c2cc);_0x106905(_0x19c2cc);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 5259be0..3662877 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 _0x170f=['destroy','multer','util','path','connect-timeout','express','../../components/auth/service','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','update'];(function(_0x32fe5b,_0x464e33){var _0x2440e5=function(_0x43522f){while(--_0x43522f){_0x32fe5b['push'](_0x32fe5b['shift']());}};_0x2440e5(++_0x464e33);}(_0x170f,0x65));var _0xf170=function(_0x590851,_0x496bee){_0x590851=_0x590851-0x0;var _0x3b0115=_0x170f[_0x590851];return _0x3b0115;};'use strict';var multer=require(_0xf170('0x0'));var util=require(_0xf170('0x1'));var path=require(_0xf170('0x2'));var timeout=require(_0xf170('0x3'));var express=require(_0xf170('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf170('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf170('0x6'));router[_0xf170('0x7')]('/',auth[_0xf170('0x8')](),controller[_0xf170('0x9')]);router[_0xf170('0x7')](_0xf170('0xa'),auth[_0xf170('0x8')](),controller[_0xf170('0xb')]);router[_0xf170('0x7')](_0xf170('0xc'),auth[_0xf170('0x8')](),controller[_0xf170('0xd')]);router[_0xf170('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0xf170('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf170('0xf')]);router[_0xf170('0x10')](_0xf170('0xc'),auth[_0xf170('0x8')](),controller[_0xf170('0x11')]);router['put'](_0xf170('0xa'),auth[_0xf170('0x8')](),controller[_0xf170('0x12')]);router['delete'](_0xf170('0xa'),auth[_0xf170('0x8')](),controller[_0xf170('0x13')]);module['exports']=router; \ No newline at end of file +var _0xfa2b=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x626f86,_0x7619b5){var _0x418916=function(_0x4a68f0){while(--_0x4a68f0){_0x626f86['push'](_0x626f86['shift']());}};_0x418916(++_0x7619b5);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x55c05c,_0x594613){_0x55c05c=_0x55c05c-0x0;var _0x27ba87=_0xfa2b[_0x55c05c];return _0x27ba87;};'use strict';var multer=require(_0xbfa2('0x0'));var util=require(_0xbfa2('0x1'));var path=require(_0xbfa2('0x2'));var timeout=require(_0xbfa2('0x3'));var express=require(_0xbfa2('0x4'));var router=express[_0xbfa2('0x5')]();var fs_extra=require(_0xbfa2('0x6'));var auth=require(_0xbfa2('0x7'));var interaction=require(_0xbfa2('0x8'));var config=require(_0xbfa2('0x9'));var controller=require(_0xbfa2('0xa'));router[_0xbfa2('0xb')]('/',auth[_0xbfa2('0xc')](),controller[_0xbfa2('0xd')]);router[_0xbfa2('0xb')](_0xbfa2('0xe'),auth['isAuthenticated'](),controller[_0xbfa2('0xf')]);router['get'](_0xbfa2('0x10'),auth[_0xbfa2('0xc')](),controller[_0xbfa2('0x11')]);router[_0xbfa2('0xb')](_0xbfa2('0x12'),auth[_0xbfa2('0xc')](),controller[_0xbfa2('0x13')]);router[_0xbfa2('0x14')]('/',auth[_0xbfa2('0xc')](),controller['create']);router['post']('/:id/configurations',auth[_0xbfa2('0xc')](),controller[_0xbfa2('0x15')]);router[_0xbfa2('0x16')](_0xbfa2('0xe'),auth[_0xbfa2('0xc')](),controller[_0xbfa2('0x17')]);router['delete'](_0xbfa2('0xe'),auth[_0xbfa2('0xc')](),controller[_0xbfa2('0x18')]);module[_0xbfa2('0x19')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index a9c8dca..31048a5 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 _0xca52=['STRING','sequelize','exports'];(function(_0x3f4ee9,_0x37a3e6){var _0x13e6d7=function(_0x5c6b2e){while(--_0x5c6b2e){_0x3f4ee9['push'](_0x3f4ee9['shift']());}};_0x13e6d7(++_0x37a3e6);}(_0xca52,0x1d2));var _0x2ca5=function(_0x59039a,_0x36838f){_0x59039a=_0x59039a-0x0;var _0x2807c2=_0xca52[_0x59039a];return _0x2807c2;};'use strict';var Sequelize=require(_0x2ca5('0x0'));module[_0x2ca5('0x1')]={'name':{'type':Sequelize[_0x2ca5('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x2ca5('0x2')]},'username':{'type':Sequelize[_0x2ca5('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x2ca5('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x2ca5('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x2ca5('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x2ca5('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x28ab=['sequelize','STRING','HelpDesk'];(function(_0x4ed34a,_0x298421){var _0x3a1571=function(_0x52b136){while(--_0x52b136){_0x4ed34a['push'](_0x4ed34a['shift']());}};_0x3a1571(++_0x298421);}(_0x28ab,0x18c));var _0xb28a=function(_0x12668b,_0x447f1b){_0x12668b=_0x12668b-0x0;var _0x3b3792=_0x28ab[_0x12668b];return _0x3b3792;};'use strict';var Sequelize=require(_0xb28a('0x0'));module['exports']={'name':{'type':Sequelize[_0xb28a('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb28a('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xb28a('0x1')],'allowNull':![],'defaultValue':_0xb28a('0x2')},'remoteUri':{'type':Sequelize[_0xb28a('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xb28a('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xb28a('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 2a338f1..e033afd 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 _0x89d6=['path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','limit','order','where','pick','filter','type','VIRTUAL','options','includeAll','include','VtigerAccount','findAll','rows','show','params','keys','merge','find','catch','create','body','getConfigurations','VtigerConfiguration','sort','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','description','moduleName','remoteUri','serverUrl','accessKey','username','substring','format','%s/webservice.php','GET','getchallenge','POST','login','result','token','success','describe','sessionName','autogenerated','reference','owner','remove','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','getFields,\x20%s,\x20%s,\x20%s','stringify','test','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x4a96d2,_0x689504){var _0x38af04=function(_0x3a67cd){while(--_0x3a67cd){_0x4a96d2['push'](_0x4a96d2['shift']());}};_0x38af04(++_0x689504);}(_0x89d6,0x74));var _0x689d=function(_0x3437b0,_0x3920d4){_0x3437b0=_0x3437b0-0x0;var _0x2e2a64=_0x89d6[_0x3437b0];return _0x2e2a64;};'use strict';var emlformat=require(_0x689d('0x0'));var rimraf=require(_0x689d('0x1'));var zipdir=require(_0x689d('0x2'));var jsonpatch=require(_0x689d('0x3'));var rp=require(_0x689d('0x4'));var moment=require(_0x689d('0x5'));var BPromise=require(_0x689d('0x6'));var Mustache=require(_0x689d('0x7'));var util=require(_0x689d('0x8'));var path=require(_0x689d('0x9'));var sox=require(_0x689d('0xa'));var csv=require(_0x689d('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x689d('0xc'));var _=require(_0x689d('0xd'));var squel=require(_0x689d('0xe'));var crypto=require(_0x689d('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x689d('0x10'));var toCsv=require(_0x689d('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x689d('0x11'));var authService=require(_0x689d('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x689d('0x13'));var logger=require(_0x689d('0x14'))(_0x689d('0x15'));var utils=require(_0x689d('0x16'));var config=require(_0x689d('0x17'));var licenseUtil=require(_0x689d('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x689d('0x19'));function respondWithStatusCode(_0x545d8f,_0x2551fc){_0x2551fc=_0x2551fc||0xcc;return function(_0x840cda){if(_0x840cda){return _0x545d8f[_0x689d('0x1a')](_0x2551fc);}return _0x545d8f['status'](_0x2551fc)[_0x689d('0x1b')]();};}function respondWithResult(_0x39ae7b,_0xac7b20){_0xac7b20=_0xac7b20||0xc8;return function(_0x3e8bab){if(_0x3e8bab){return _0x39ae7b[_0x689d('0x1c')](_0xac7b20)[_0x689d('0x1d')](_0x3e8bab);}};}function respondWithFilteredResult(_0x2b61d9,_0x2656a6){return function(_0x528006){if(_0x528006){var _0x197a5e=typeof _0x2656a6[_0x689d('0x1e')]===_0x689d('0x1f')&&typeof _0x2656a6['limit']==='undefined';var _0x16d010=_0x528006[_0x689d('0x20')];var _0x43ad7f=_0x197a5e?0x0:_0x2656a6[_0x689d('0x1e')];var _0x28a2cc=_0x197a5e?_0x528006[_0x689d('0x20')]:_0x2656a6[_0x689d('0x1e')]+_0x2656a6['limit'];var _0x55e06f;if(_0x28a2cc>=_0x16d010){_0x28a2cc=_0x16d010;_0x55e06f=0xc8;}else{_0x55e06f=0xce;}_0x2b61d9[_0x689d('0x1c')](_0x55e06f);return _0x2b61d9[_0x689d('0x21')](_0x689d('0x22'),_0x43ad7f+'-'+_0x28a2cc+'/'+_0x16d010)[_0x689d('0x1d')](_0x528006);}return null;};}function patchUpdates(_0x283f2c){return function(_0x1b6432){try{jsonpatch[_0x689d('0x23')](_0x1b6432,_0x283f2c,!![]);}catch(_0x14ef0d){return BPromise[_0x689d('0x24')](_0x14ef0d);}return _0x1b6432[_0x689d('0x25')]();};}function saveUpdates(_0x2b9d7d,_0x5879a7){return function(_0x44dbaf){if(_0x44dbaf){return _0x44dbaf[_0x689d('0x26')](_0x2b9d7d)[_0x689d('0x27')](function(_0x20ca63){return _0x20ca63;});}return null;};}function removeEntity(_0x4e1f13,_0xfba011){return function(_0x45371a){if(_0x45371a){return _0x45371a[_0x689d('0x28')]()[_0x689d('0x27')](function(){_0x4e1f13[_0x689d('0x1c')](0xcc)[_0x689d('0x1b')]();});}};}function handleEntityNotFound(_0x2aeced,_0x5595de){return function(_0x4f4c1a){if(!_0x4f4c1a){_0x2aeced[_0x689d('0x1a')](0x194);}return _0x4f4c1a;};}function handleError(_0x43c8e3,_0x105868){_0x105868=_0x105868||0x1f4;return function(_0x1b51f3){logger[_0x689d('0x29')](_0x1b51f3['stack']);if(_0x1b51f3[_0x689d('0x2a')]){delete _0x1b51f3[_0x689d('0x2a')];}_0x43c8e3[_0x689d('0x1c')](_0x105868)[_0x689d('0x2b')](_0x1b51f3);};}exports[_0x689d('0x2c')]=function(_0x510fe2,_0x4a77ca){var _0xa0d468={},_0x49c141={},_0x3c1d19={'count':0x0,'rows':[]};var _0x1a93c2=_[_0x689d('0x2d')](db['VtigerAccount'][_0x689d('0x2e')],function(_0x24b000){return{'name':_0x24b000[_0x689d('0x2f')],'type':_0x24b000['type'][_0x689d('0x30')]};});_0x49c141[_0x689d('0x31')]=_[_0x689d('0x2d')](_0x1a93c2,_0x689d('0x2a'));_0x49c141[_0x689d('0x32')]=_['keys'](_0x510fe2[_0x689d('0x32')]);_0x49c141[_0x689d('0x33')]=_[_0x689d('0x34')](_0x49c141[_0x689d('0x31')],_0x49c141['query']);_0xa0d468[_0x689d('0x35')]=_[_0x689d('0x34')](_0x49c141[_0x689d('0x31')],qs[_0x689d('0x36')](_0x510fe2[_0x689d('0x32')][_0x689d('0x36')]));_0xa0d468[_0x689d('0x35')]=_0xa0d468[_0x689d('0x35')][_0x689d('0x37')]?_0xa0d468[_0x689d('0x35')]:_0x49c141[_0x689d('0x31')];if(!_0x510fe2[_0x689d('0x32')]['hasOwnProperty']('nolimit')){_0xa0d468[_0x689d('0x38')]=qs['limit'](_0x510fe2[_0x689d('0x32')]['limit']);_0xa0d468[_0x689d('0x1e')]=qs['offset'](_0x510fe2[_0x689d('0x32')]['offset']);}_0xa0d468[_0x689d('0x39')]=qs['sort'](_0x510fe2['query']['sort']);_0xa0d468[_0x689d('0x3a')]=qs['filters'](_[_0x689d('0x3b')](_0x510fe2[_0x689d('0x32')],_0x49c141['filters']),_0x1a93c2);if(_0x510fe2[_0x689d('0x32')][_0x689d('0x3c')]){_0xa0d468[_0x689d('0x3a')]=_['merge'](_0xa0d468[_0x689d('0x3a')],{'$or':_[_0x689d('0x2d')](_0x1a93c2,function(_0x527151){if(_0x527151[_0x689d('0x3d')]!==_0x689d('0x3e')){var _0x151e89={};_0x151e89[_0x527151['name']]={'$like':'%'+_0x510fe2[_0x689d('0x32')]['filter']+'%'};return _0x151e89;}})});}_0xa0d468=_['merge']({},_0xa0d468,_0x510fe2[_0x689d('0x3f')]);var _0x3a7ce0={'where':_0xa0d468[_0x689d('0x3a')]};return db['VtigerAccount']['count'](_0x3a7ce0)[_0x689d('0x27')](function(_0x368235){_0x3c1d19[_0x689d('0x20')]=_0x368235;if(_0x510fe2[_0x689d('0x32')][_0x689d('0x40')]){_0xa0d468[_0x689d('0x41')]=[{'all':!![]}];}return db[_0x689d('0x42')][_0x689d('0x43')](_0xa0d468);})['then'](function(_0x53ed9b){_0x3c1d19[_0x689d('0x44')]=_0x53ed9b;return _0x3c1d19;})[_0x689d('0x27')](respondWithFilteredResult(_0x4a77ca,_0xa0d468))['catch'](handleError(_0x4a77ca,null));};exports[_0x689d('0x45')]=function(_0x2092d1,_0x52bd9f){var _0x1ee2ae={'raw':![],'where':{'id':_0x2092d1[_0x689d('0x46')]['id']}},_0x1e0898={};_0x1e0898[_0x689d('0x31')]=_['keys'](db['VtigerAccount']['rawAttributes']);_0x1e0898[_0x689d('0x32')]=_[_0x689d('0x47')](_0x2092d1['query']);_0x1e0898['filters']=_[_0x689d('0x34')](_0x1e0898[_0x689d('0x31')],_0x1e0898[_0x689d('0x32')]);_0x1ee2ae[_0x689d('0x35')]=_[_0x689d('0x34')](_0x1e0898['model'],qs[_0x689d('0x36')](_0x2092d1[_0x689d('0x32')]['fields']));_0x1ee2ae[_0x689d('0x35')]=_0x1ee2ae['attributes']['length']?_0x1ee2ae[_0x689d('0x35')]:_0x1e0898[_0x689d('0x31')];if(_0x2092d1[_0x689d('0x32')][_0x689d('0x40')]){_0x1ee2ae[_0x689d('0x41')]=[{'all':!![]}];}_0x1ee2ae=_[_0x689d('0x48')]({},_0x1ee2ae,_0x2092d1[_0x689d('0x3f')]);return db[_0x689d('0x42')][_0x689d('0x49')](_0x1ee2ae)[_0x689d('0x27')](handleEntityNotFound(_0x52bd9f,null))[_0x689d('0x27')](respondWithResult(_0x52bd9f,null))[_0x689d('0x4a')](handleError(_0x52bd9f,null));};exports[_0x689d('0x4b')]=function(_0x4484f7,_0x2ae38a){return db[_0x689d('0x42')]['create'](_0x4484f7[_0x689d('0x4c')],{})['then'](respondWithResult(_0x2ae38a,0xc9))[_0x689d('0x4a')](handleError(_0x2ae38a,null));};exports[_0x689d('0x26')]=function(_0x416664,_0x5de3ba){if(_0x416664[_0x689d('0x4c')]['id']){delete _0x416664[_0x689d('0x4c')]['id'];}return db[_0x689d('0x42')]['find']({'where':{'id':_0x416664[_0x689d('0x46')]['id']}})[_0x689d('0x27')](handleEntityNotFound(_0x5de3ba,null))[_0x689d('0x27')](saveUpdates(_0x416664[_0x689d('0x4c')],null))[_0x689d('0x27')](respondWithResult(_0x5de3ba,null))[_0x689d('0x4a')](handleError(_0x5de3ba,null));};exports[_0x689d('0x28')]=function(_0x2bf59e,_0x3576ea){return db[_0x689d('0x42')][_0x689d('0x49')]({'where':{'id':_0x2bf59e[_0x689d('0x46')]['id']}})['then'](handleEntityNotFound(_0x3576ea,null))['then'](removeEntity(_0x3576ea,null))['catch'](handleError(_0x3576ea,null));};exports[_0x689d('0x4d')]=function(_0x2d4895,_0x2bd36c,_0x1b0d64){var _0x222fe1={};var _0x44fe39={};var _0x4cd6fa;var _0x489e63;return db[_0x689d('0x42')]['findOne']({'where':{'id':_0x2d4895[_0x689d('0x46')]['id']}})[_0x689d('0x27')](handleEntityNotFound(_0x2bd36c,null))[_0x689d('0x27')](function(_0x5cc02d){if(_0x5cc02d){_0x4cd6fa=_0x5cc02d;_0x44fe39[_0x689d('0x31')]=_['keys'](db[_0x689d('0x4e')][_0x689d('0x2e')]);_0x44fe39[_0x689d('0x32')]=_['keys'](_0x2d4895[_0x689d('0x32')]);_0x44fe39[_0x689d('0x33')]=_[_0x689d('0x34')](_0x44fe39[_0x689d('0x31')],_0x44fe39['query']);_0x222fe1[_0x689d('0x35')]=_['intersection'](_0x44fe39['model'],qs[_0x689d('0x36')](_0x2d4895[_0x689d('0x32')][_0x689d('0x36')]));_0x222fe1['attributes']=_0x222fe1['attributes'][_0x689d('0x37')]?_0x222fe1[_0x689d('0x35')]:_0x44fe39[_0x689d('0x31')];_0x222fe1[_0x689d('0x39')]=qs[_0x689d('0x4f')](_0x2d4895['query'][_0x689d('0x4f')]);_0x222fe1[_0x689d('0x3a')]=qs[_0x689d('0x33')](_[_0x689d('0x3b')](_0x2d4895[_0x689d('0x32')],_0x44fe39[_0x689d('0x33')]));if(_0x2d4895[_0x689d('0x32')][_0x689d('0x3c')]){_0x222fe1[_0x689d('0x3a')]=_[_0x689d('0x48')](_0x222fe1[_0x689d('0x3a')],{'$or':_[_0x689d('0x2d')](_0x222fe1['attributes'],function(_0x3f3808){var _0xa80c4f={};_0xa80c4f[_0x3f3808]={'$like':'%'+_0x2d4895[_0x689d('0x32')][_0x689d('0x3c')]+'%'};return _0xa80c4f;})});}_0x222fe1=_['merge']({},_0x222fe1,_0x2d4895[_0x689d('0x3f')]);return _0x4cd6fa[_0x689d('0x4d')](_0x222fe1);}})[_0x689d('0x27')](function(_0x13f5b5){if(_0x13f5b5){_0x489e63=_0x13f5b5[_0x689d('0x37')];if(!_0x2d4895[_0x689d('0x32')]['hasOwnProperty'](_0x689d('0x50'))){_0x222fe1[_0x689d('0x38')]=qs[_0x689d('0x38')](_0x2d4895[_0x689d('0x32')][_0x689d('0x38')]);_0x222fe1[_0x689d('0x1e')]=qs[_0x689d('0x1e')](_0x2d4895['query'][_0x689d('0x1e')]);}return _0x4cd6fa[_0x689d('0x4d')](_0x222fe1);}})[_0x689d('0x27')](function(_0x315cc3){if(_0x315cc3){return _0x315cc3?{'count':_0x489e63,'rows':_0x315cc3}:null;}})[_0x689d('0x27')](respondWithResult(_0x2bd36c,null))[_0x689d('0x4a')](handleError(_0x2bd36c,null));};exports[_0x689d('0x51')]=function(_0x38337e,_0x3e190f,_0x34c11c){if(_0x38337e['body']['id']){delete _0x38337e['body']['id'];}return db[_0x689d('0x42')][_0x689d('0x52')]({'where':{'id':_0x38337e[_0x689d('0x46')]['id']}})[_0x689d('0x27')](handleEntityNotFound(_0x3e190f,null))[_0x689d('0x27')](function(_0x55cf29){if(_0x55cf29){_0x38337e[_0x689d('0x4c')][_0x689d('0x53')]=_0x55cf29['id'];_0x38337e[_0x689d('0x4c')][_0x689d('0x54')]=integrations[_0x689d('0x55')](_0x38337e[_0x689d('0x4c')][_0x689d('0x56')],_0x38337e[_0x689d('0x4c')]['type']);_0x38337e[_0x689d('0x4c')][_0x689d('0x57')]=integrations[_0x689d('0x58')](_0x38337e[_0x689d('0x4c')][_0x689d('0x56')],_0x38337e[_0x689d('0x4c')][_0x689d('0x3d')]);return db[_0x689d('0x4e')][_0x689d('0x4b')](_0x38337e[_0x689d('0x4c')],{'include':[{'model':db[_0x689d('0x59')],'as':_0x689d('0x54')},{'model':db[_0x689d('0x59')],'as':_0x689d('0x57')}]});}return null;})[_0x689d('0x27')](respondWithResult(_0x3e190f,null))[_0x689d('0x4a')](handleError(_0x3e190f,null));};var md5=require('md5');exports['getFields']=function(_0xfb0d3c,_0x331732,_0x43be80){var _0xf19627=null;var _0x3e8d43=null;var _0x23fff7=null;var _0x2889fc=null;var _0x1eb436='';return db[_0x689d('0x42')][_0x689d('0x52')]({'where':{'id':_0xfb0d3c['params']['id']},'attributes':['id',_0x689d('0x2a'),'username',_0x689d('0x5a'),_0x689d('0x5b'),_0x689d('0x5c'),_0x689d('0x5d'),_0x689d('0x5e')]})['then'](handleEntityNotFound(_0x331732,null))[_0x689d('0x27')](function(_0x26403e){if(_0x26403e){_0xf19627=_0x26403e[_0x689d('0x5f')];_0x3e8d43=_0x26403e[_0x689d('0x5e')];_0x23fff7=_0x26403e['moduleName'];_0x1eb436=_0x26403e[_0x689d('0x5c')];var _0x48e531=_0x1eb436['slice'](-0x1);if(_0x48e531==='/'){_0x1eb436=_0x1eb436[_0x689d('0x60')](0x0,_0x1eb436['lastIndexOf'](_0x48e531));}_0x2889fc=util[_0x689d('0x61')](_0x689d('0x62'),_0x1eb436);var _0x36fc08={'method':_0x689d('0x63'),'uri':_0x2889fc,'qs':{'operation':_0x689d('0x64'),'username':_0x26403e['username']},'json':!![]};return rp(_0x36fc08);}})['then'](function(_0x507646){if(_0x507646['success']){var _0x5205ad={'method':_0x689d('0x65'),'uri':_0x2889fc,'form':{'operation':_0x689d('0x66'),'username':_0xf19627,'accessKey':md5(_0x507646[_0x689d('0x67')][_0x689d('0x68')]+_0x3e8d43)},'json':!![]};return rp(_0x5205ad);}})['then'](function(_0x39e916){if(_0x39e916[_0x689d('0x69')]){var _0xb7532c={'method':_0x689d('0x63'),'uri':_0x2889fc,'qs':{'operation':_0x689d('0x6a'),'username':_0xf19627,'sessionName':_0x39e916[_0x689d('0x67')][_0x689d('0x6b')],'elementType':_0x23fff7},'json':!![]};return rp(_0xb7532c);}})[_0x689d('0x27')](function(_0x192ecc){if(_0x192ecc['success']){var _0x598677=[_0x689d('0x6c'),_0x689d('0x6d'),_0x689d('0x6e')];_['remove'](_0x192ecc[_0x689d('0x67')][_0x689d('0x36')],function(_0xa6eb0f){return _0x598677['includes'](_0xa6eb0f[_0x689d('0x3d')][_0x689d('0x2a')]);});_[_0x689d('0x6f')](_0x192ecc['result']['fields'],function(_0x2fb8e2){return _0x2fb8e2['editable']===_0x689d('0x70');});return{'count':_0x192ecc[_0x689d('0x67')]['fields'][_0x689d('0x37')],'rows':_['map'](_0x192ecc[_0x689d('0x67')][_0x689d('0x36')],function(_0x523e5f){return{'id':_0x523e5f['name'],'name':_0x523e5f[_0x689d('0x71')],'custom':_[_0x689d('0x72')](_0x523e5f[_0x689d('0x2a')],_0x689d('0x73'))?!![]:![],'options':_0x523e5f['type'][_0x689d('0x2a')]===_0x689d('0x74')&&_0x523e5f[_0x689d('0x3d')][_0x689d('0x75')][_0x689d('0x37')]>0x0?_[_0x689d('0x2d')](_0x523e5f['type'][_0x689d('0x75')],function(_0x298e9b){return{'name':_0x298e9b['label'],'value':_0x298e9b[_0x689d('0x76')]};}):[]};})};}})[_0x689d('0x27')](respondWithResult(_0x331732,null))[_0x689d('0x4a')](function(_0x7f6c72){console[_0x689d('0x77')](_0x689d('0x78')+_0x7f6c72);var _0x51a65d=_0xfb0d3c['query']['test']?0x1f4:_0x7f6c72['statusCode']||0x1f4;logger[_0x689d('0x29')](_0x689d('0x79'),'getFields',_0x51a65d,JSON[_0x689d('0x7a')](_0x7f6c72));delete _0x7f6c72['name'];if(_0x51a65d===0x191){_0x51a65d=0x190;}_0x331732['status'](_0x51a65d)[_0x689d('0x2b')](_0xfb0d3c[_0x689d('0x32')][_0x689d('0x7b')]?{'message':'Wrong\x20credentials','statusCode':_0x7f6c72[_0x689d('0x7c')]}:_0x7f6c72);});}; \ No newline at end of file +var _0x4e09=['fields','length','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','find','create','params','getConfigurations','findOne','pick','hasOwnProperty','addConfiguration','body','AccountId','Subjects','getSubjects','channel','type','Descriptions','VtigerConfiguration','VtigerField','username','description','remoteUri','serverUrl','accessKey','moduleName','slice','substring','lastIndexOf','format','%s/webservice.php','GET','POST','result','token','success','describe','sessionName','autogenerated','reference','remove','includes','editable','false','label','cf_','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields','stringify','send','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','VtigerAccount','rawAttributes','fieldName','key','model','query','keys','intersection','attributes'];(function(_0x117ab9,_0x45c7b6){var _0x258a48=function(_0xe6e07c){while(--_0xe6e07c){_0x117ab9['push'](_0x117ab9['shift']());}};_0x258a48(++_0x45c7b6);}(_0x4e09,0xbb));var _0x94e0=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4e09[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0x94e0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x94e0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x94e0('0x2'));var moment=require('moment');var BPromise=require(_0x94e0('0x3'));var Mustache=require(_0x94e0('0x4'));var util=require(_0x94e0('0x5'));var path=require(_0x94e0('0x6'));var sox=require(_0x94e0('0x7'));var csv=require(_0x94e0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x94e0('0x9'));var _=require('lodash');var squel=require(_0x94e0('0xa'));var crypto=require(_0x94e0('0xb'));var jsforce=require(_0x94e0('0xc'));var deskjs=require(_0x94e0('0xd'));var toCsv=require(_0x94e0('0x8'));var querystring=require(_0x94e0('0xe'));var Papa=require(_0x94e0('0xf'));var Redis=require(_0x94e0('0x10'));var authService=require(_0x94e0('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x94e0('0x12'));var logger=require(_0x94e0('0x13'))(_0x94e0('0x14'));var utils=require('../../config/utils');var config=require(_0x94e0('0x15'));var licenseUtil=require(_0x94e0('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2b2639,_0x4b9714){_0x4b9714=_0x4b9714||0xcc;return function(_0xdd822d){if(_0xdd822d){return _0x2b2639['sendStatus'](_0x4b9714);}return _0x2b2639[_0x94e0('0x17')](_0x4b9714)[_0x94e0('0x18')]();};}function respondWithResult(_0x1ab935,_0x5f5cb0){_0x5f5cb0=_0x5f5cb0||0xc8;return function(_0x2ac1d4){if(_0x2ac1d4){return _0x1ab935[_0x94e0('0x17')](_0x5f5cb0)['json'](_0x2ac1d4);}};}function respondWithFilteredResult(_0x514d81,_0x3c2ad2){return function(_0x9c3aac){if(_0x9c3aac){var _0x32b5ad=typeof _0x3c2ad2[_0x94e0('0x19')]===_0x94e0('0x1a')&&typeof _0x3c2ad2[_0x94e0('0x1b')]===_0x94e0('0x1a');var _0x23db30=_0x9c3aac[_0x94e0('0x1c')];var _0x452167=_0x32b5ad?0x0:_0x3c2ad2[_0x94e0('0x19')];var _0x43ac07=_0x32b5ad?_0x9c3aac[_0x94e0('0x1c')]:_0x3c2ad2[_0x94e0('0x19')]+_0x3c2ad2[_0x94e0('0x1b')];var _0x94511a;if(_0x43ac07>=_0x23db30){_0x43ac07=_0x23db30;_0x94511a=0xc8;}else{_0x94511a=0xce;}_0x514d81[_0x94e0('0x17')](_0x94511a);return _0x514d81['set'](_0x94e0('0x1d'),_0x452167+'-'+_0x43ac07+'/'+_0x23db30)['json'](_0x9c3aac);}return null;};}function patchUpdates(_0x1062a8){return function(_0x4cb94d){try{jsonpatch[_0x94e0('0x1e')](_0x4cb94d,_0x1062a8,!![]);}catch(_0x4e89e7){return BPromise[_0x94e0('0x1f')](_0x4e89e7);}return _0x4cb94d[_0x94e0('0x20')]();};}function saveUpdates(_0x36ddc1,_0x48015e){return function(_0x582f0a){if(_0x582f0a){return _0x582f0a[_0x94e0('0x21')](_0x36ddc1)[_0x94e0('0x22')](function(_0x9c3c77){return _0x9c3c77;});}return null;};}function removeEntity(_0x34afe0,_0x1056f1){return function(_0x5187c5){if(_0x5187c5){return _0x5187c5[_0x94e0('0x23')]()['then'](function(){_0x34afe0[_0x94e0('0x17')](0xcc)[_0x94e0('0x18')]();});}};}function handleEntityNotFound(_0x50fb39,_0x2cf21d){return function(_0x4dacee){if(!_0x4dacee){_0x50fb39[_0x94e0('0x24')](0x194);}return _0x4dacee;};}function handleError(_0x1cad6a,_0x5d830d){_0x5d830d=_0x5d830d||0x1f4;return function(_0x31902a){logger[_0x94e0('0x25')](_0x31902a[_0x94e0('0x26')]);if(_0x31902a[_0x94e0('0x27')]){delete _0x31902a[_0x94e0('0x27')];}_0x1cad6a['status'](_0x5d830d)['send'](_0x31902a);};}exports[_0x94e0('0x28')]=function(_0x3af8ea,_0x400df5){var _0x5593bd={},_0x581c35={},_0x1371ca={'count':0x0,'rows':[]};var _0x2616b6=_[_0x94e0('0x29')](db[_0x94e0('0x2a')][_0x94e0('0x2b')],function(_0xa9e087){return{'name':_0xa9e087[_0x94e0('0x2c')],'type':_0xa9e087['type'][_0x94e0('0x2d')]};});_0x581c35[_0x94e0('0x2e')]=_[_0x94e0('0x29')](_0x2616b6,_0x94e0('0x27'));_0x581c35[_0x94e0('0x2f')]=_[_0x94e0('0x30')](_0x3af8ea[_0x94e0('0x2f')]);_0x581c35['filters']=_[_0x94e0('0x31')](_0x581c35['model'],_0x581c35['query']);_0x5593bd[_0x94e0('0x32')]=_['intersection'](_0x581c35[_0x94e0('0x2e')],qs[_0x94e0('0x33')](_0x3af8ea[_0x94e0('0x2f')][_0x94e0('0x33')]));_0x5593bd['attributes']=_0x5593bd['attributes'][_0x94e0('0x34')]?_0x5593bd[_0x94e0('0x32')]:_0x581c35[_0x94e0('0x2e')];if(!_0x3af8ea['query']['hasOwnProperty'](_0x94e0('0x35'))){_0x5593bd[_0x94e0('0x1b')]=qs['limit'](_0x3af8ea[_0x94e0('0x2f')][_0x94e0('0x1b')]);_0x5593bd[_0x94e0('0x19')]=qs[_0x94e0('0x19')](_0x3af8ea[_0x94e0('0x2f')][_0x94e0('0x19')]);}_0x5593bd[_0x94e0('0x36')]=qs['sort'](_0x3af8ea['query'][_0x94e0('0x37')]);_0x5593bd[_0x94e0('0x38')]=qs['filters'](_['pick'](_0x3af8ea[_0x94e0('0x2f')],_0x581c35[_0x94e0('0x39')]),_0x2616b6);if(_0x3af8ea[_0x94e0('0x2f')][_0x94e0('0x3a')]){_0x5593bd[_0x94e0('0x38')]=_['merge'](_0x5593bd[_0x94e0('0x38')],{'$or':_[_0x94e0('0x29')](_0x2616b6,function(_0x44a617){if(_0x44a617['type']!==_0x94e0('0x3b')){var _0xdc9a53={};_0xdc9a53[_0x44a617[_0x94e0('0x27')]]={'$like':'%'+_0x3af8ea[_0x94e0('0x2f')]['filter']+'%'};return _0xdc9a53;}})});}_0x5593bd=_[_0x94e0('0x3c')]({},_0x5593bd,_0x3af8ea[_0x94e0('0x3d')]);var _0x3df1a4={'where':_0x5593bd['where']};return db[_0x94e0('0x2a')]['count'](_0x3df1a4)[_0x94e0('0x22')](function(_0x57508b){_0x1371ca[_0x94e0('0x1c')]=_0x57508b;if(_0x3af8ea['query'][_0x94e0('0x3e')]){_0x5593bd[_0x94e0('0x3f')]=[{'all':!![]}];}return db['VtigerAccount'][_0x94e0('0x40')](_0x5593bd);})[_0x94e0('0x22')](function(_0x4ef5bd){_0x1371ca['rows']=_0x4ef5bd;return _0x1371ca;})['then'](respondWithFilteredResult(_0x400df5,_0x5593bd))[_0x94e0('0x41')](handleError(_0x400df5,null));};exports[_0x94e0('0x42')]=function(_0x31476c,_0x44e1dc){var _0x56d6e8={'raw':![],'where':{'id':_0x31476c['params']['id']}},_0x27d6fe={};_0x27d6fe['model']=_['keys'](db[_0x94e0('0x2a')][_0x94e0('0x2b')]);_0x27d6fe[_0x94e0('0x2f')]=_[_0x94e0('0x30')](_0x31476c[_0x94e0('0x2f')]);_0x27d6fe[_0x94e0('0x39')]=_['intersection'](_0x27d6fe[_0x94e0('0x2e')],_0x27d6fe[_0x94e0('0x2f')]);_0x56d6e8['attributes']=_['intersection'](_0x27d6fe[_0x94e0('0x2e')],qs[_0x94e0('0x33')](_0x31476c[_0x94e0('0x2f')][_0x94e0('0x33')]));_0x56d6e8[_0x94e0('0x32')]=_0x56d6e8[_0x94e0('0x32')]['length']?_0x56d6e8[_0x94e0('0x32')]:_0x27d6fe[_0x94e0('0x2e')];if(_0x31476c[_0x94e0('0x2f')][_0x94e0('0x3e')]){_0x56d6e8[_0x94e0('0x3f')]=[{'all':!![]}];}_0x56d6e8=_[_0x94e0('0x3c')]({},_0x56d6e8,_0x31476c['options']);return db[_0x94e0('0x2a')][_0x94e0('0x43')](_0x56d6e8)[_0x94e0('0x22')](handleEntityNotFound(_0x44e1dc,null))[_0x94e0('0x22')](respondWithResult(_0x44e1dc,null))[_0x94e0('0x41')](handleError(_0x44e1dc,null));};exports[_0x94e0('0x44')]=function(_0x583405,_0xc5c7c4){return db[_0x94e0('0x2a')][_0x94e0('0x44')](_0x583405['body'],{})[_0x94e0('0x22')](respondWithResult(_0xc5c7c4,0xc9))['catch'](handleError(_0xc5c7c4,null));};exports[_0x94e0('0x21')]=function(_0x588b7f,_0x4bd483){if(_0x588b7f['body']['id']){delete _0x588b7f['body']['id'];}return db[_0x94e0('0x2a')][_0x94e0('0x43')]({'where':{'id':_0x588b7f[_0x94e0('0x45')]['id']}})[_0x94e0('0x22')](handleEntityNotFound(_0x4bd483,null))['then'](saveUpdates(_0x588b7f['body'],null))[_0x94e0('0x22')](respondWithResult(_0x4bd483,null))[_0x94e0('0x41')](handleError(_0x4bd483,null));};exports['destroy']=function(_0x3304fe,_0x10ee9e){return db[_0x94e0('0x2a')]['find']({'where':{'id':_0x3304fe[_0x94e0('0x45')]['id']}})[_0x94e0('0x22')](handleEntityNotFound(_0x10ee9e,null))[_0x94e0('0x22')](removeEntity(_0x10ee9e,null))[_0x94e0('0x41')](handleError(_0x10ee9e,null));};exports[_0x94e0('0x46')]=function(_0x4c83de,_0x4fa1d5,_0x14a60f){var _0xeb4852={};var _0x11a36b={};var _0x684b4;var _0x37b918;return db[_0x94e0('0x2a')][_0x94e0('0x47')]({'where':{'id':_0x4c83de[_0x94e0('0x45')]['id']}})[_0x94e0('0x22')](handleEntityNotFound(_0x4fa1d5,null))[_0x94e0('0x22')](function(_0x3c5f23){if(_0x3c5f23){_0x684b4=_0x3c5f23;_0x11a36b[_0x94e0('0x2e')]=_[_0x94e0('0x30')](db['VtigerConfiguration'][_0x94e0('0x2b')]);_0x11a36b[_0x94e0('0x2f')]=_[_0x94e0('0x30')](_0x4c83de[_0x94e0('0x2f')]);_0x11a36b[_0x94e0('0x39')]=_[_0x94e0('0x31')](_0x11a36b['model'],_0x11a36b[_0x94e0('0x2f')]);_0xeb4852[_0x94e0('0x32')]=_['intersection'](_0x11a36b[_0x94e0('0x2e')],qs[_0x94e0('0x33')](_0x4c83de[_0x94e0('0x2f')][_0x94e0('0x33')]));_0xeb4852['attributes']=_0xeb4852[_0x94e0('0x32')]['length']?_0xeb4852[_0x94e0('0x32')]:_0x11a36b[_0x94e0('0x2e')];_0xeb4852[_0x94e0('0x36')]=qs[_0x94e0('0x37')](_0x4c83de['query']['sort']);_0xeb4852[_0x94e0('0x38')]=qs[_0x94e0('0x39')](_[_0x94e0('0x48')](_0x4c83de[_0x94e0('0x2f')],_0x11a36b[_0x94e0('0x39')]));if(_0x4c83de[_0x94e0('0x2f')][_0x94e0('0x3a')]){_0xeb4852['where']=_[_0x94e0('0x3c')](_0xeb4852[_0x94e0('0x38')],{'$or':_['map'](_0xeb4852[_0x94e0('0x32')],function(_0x3be79f){var _0x2e7007={};_0x2e7007[_0x3be79f]={'$like':'%'+_0x4c83de[_0x94e0('0x2f')]['filter']+'%'};return _0x2e7007;})});}_0xeb4852=_[_0x94e0('0x3c')]({},_0xeb4852,_0x4c83de[_0x94e0('0x3d')]);return _0x684b4['getConfigurations'](_0xeb4852);}})[_0x94e0('0x22')](function(_0xa1f6fb){if(_0xa1f6fb){_0x37b918=_0xa1f6fb[_0x94e0('0x34')];if(!_0x4c83de['query'][_0x94e0('0x49')](_0x94e0('0x35'))){_0xeb4852[_0x94e0('0x1b')]=qs[_0x94e0('0x1b')](_0x4c83de['query']['limit']);_0xeb4852[_0x94e0('0x19')]=qs['offset'](_0x4c83de[_0x94e0('0x2f')]['offset']);}return _0x684b4[_0x94e0('0x46')](_0xeb4852);}})[_0x94e0('0x22')](function(_0x35d8cc){if(_0x35d8cc){return _0x35d8cc?{'count':_0x37b918,'rows':_0x35d8cc}:null;}})['then'](respondWithResult(_0x4fa1d5,null))[_0x94e0('0x41')](handleError(_0x4fa1d5,null));};exports[_0x94e0('0x4a')]=function(_0x571ec6,_0x4ae408,_0x316fe9){if(_0x571ec6[_0x94e0('0x4b')]['id']){delete _0x571ec6[_0x94e0('0x4b')]['id'];}return db[_0x94e0('0x2a')][_0x94e0('0x47')]({'where':{'id':_0x571ec6[_0x94e0('0x45')]['id']}})[_0x94e0('0x22')](handleEntityNotFound(_0x4ae408,null))['then'](function(_0x3166db){if(_0x3166db){_0x571ec6[_0x94e0('0x4b')][_0x94e0('0x4c')]=_0x3166db['id'];_0x571ec6[_0x94e0('0x4b')][_0x94e0('0x4d')]=integrations[_0x94e0('0x4e')](_0x571ec6[_0x94e0('0x4b')][_0x94e0('0x4f')],_0x571ec6[_0x94e0('0x4b')][_0x94e0('0x50')]);_0x571ec6[_0x94e0('0x4b')][_0x94e0('0x51')]=integrations['getDescriptions'](_0x571ec6[_0x94e0('0x4b')][_0x94e0('0x4f')],_0x571ec6[_0x94e0('0x4b')][_0x94e0('0x50')]);return db[_0x94e0('0x52')][_0x94e0('0x44')](_0x571ec6[_0x94e0('0x4b')],{'include':[{'model':db[_0x94e0('0x53')],'as':_0x94e0('0x4d')},{'model':db[_0x94e0('0x53')],'as':'Descriptions'}]});}return null;})[_0x94e0('0x22')](respondWithResult(_0x4ae408,null))['catch'](handleError(_0x4ae408,null));};var md5=require('md5');exports['getFields']=function(_0x459ca6,_0x2ac0eb,_0x304249){var _0x2a0209=null;var _0x4125ac=null;var _0x312d07=null;var _0x5c7216=null;var _0x137a55='';return db[_0x94e0('0x2a')][_0x94e0('0x47')]({'where':{'id':_0x459ca6[_0x94e0('0x45')]['id']},'attributes':['id','name',_0x94e0('0x54'),_0x94e0('0x55'),'moduleName',_0x94e0('0x56'),_0x94e0('0x57'),_0x94e0('0x58')]})[_0x94e0('0x22')](handleEntityNotFound(_0x2ac0eb,null))[_0x94e0('0x22')](function(_0xd45cd6){if(_0xd45cd6){_0x2a0209=_0xd45cd6[_0x94e0('0x54')];_0x4125ac=_0xd45cd6[_0x94e0('0x58')];_0x312d07=_0xd45cd6[_0x94e0('0x59')];_0x137a55=_0xd45cd6[_0x94e0('0x56')];var _0x3491bc=_0x137a55[_0x94e0('0x5a')](-0x1);if(_0x3491bc==='/'){_0x137a55=_0x137a55[_0x94e0('0x5b')](0x0,_0x137a55[_0x94e0('0x5c')](_0x3491bc));}_0x5c7216=util[_0x94e0('0x5d')](_0x94e0('0x5e'),_0x137a55);var _0x25736b={'method':_0x94e0('0x5f'),'uri':_0x5c7216,'qs':{'operation':'getchallenge','username':_0xd45cd6[_0x94e0('0x54')]},'json':!![]};return rp(_0x25736b);}})[_0x94e0('0x22')](function(_0x188911){if(_0x188911['success']){var _0x50a869={'method':_0x94e0('0x60'),'uri':_0x5c7216,'form':{'operation':'login','username':_0x2a0209,'accessKey':md5(_0x188911[_0x94e0('0x61')][_0x94e0('0x62')]+_0x4125ac)},'json':!![]};return rp(_0x50a869);}})[_0x94e0('0x22')](function(_0xb5dd90){if(_0xb5dd90[_0x94e0('0x63')]){var _0x4a0cc4={'method':_0x94e0('0x5f'),'uri':_0x5c7216,'qs':{'operation':_0x94e0('0x64'),'username':_0x2a0209,'sessionName':_0xb5dd90['result'][_0x94e0('0x65')],'elementType':_0x312d07},'json':!![]};return rp(_0x4a0cc4);}})[_0x94e0('0x22')](function(_0x487259){if(_0x487259[_0x94e0('0x63')]){var _0x374a51=[_0x94e0('0x66'),_0x94e0('0x67'),'owner'];_[_0x94e0('0x68')](_0x487259[_0x94e0('0x61')]['fields'],function(_0x44a00f){return _0x374a51[_0x94e0('0x69')](_0x44a00f[_0x94e0('0x50')][_0x94e0('0x27')]);});_[_0x94e0('0x68')](_0x487259['result'][_0x94e0('0x33')],function(_0x5ea2cf){return _0x5ea2cf[_0x94e0('0x6a')]===_0x94e0('0x6b');});return{'count':_0x487259[_0x94e0('0x61')][_0x94e0('0x33')][_0x94e0('0x34')],'rows':_[_0x94e0('0x29')](_0x487259['result'][_0x94e0('0x33')],function(_0x3e1309){return{'id':_0x3e1309[_0x94e0('0x27')],'name':_0x3e1309[_0x94e0('0x6c')],'custom':_['startsWith'](_0x3e1309['name'],_0x94e0('0x6d'))?!![]:![],'options':_0x3e1309[_0x94e0('0x50')][_0x94e0('0x27')]==='picklist'&&_0x3e1309[_0x94e0('0x50')][_0x94e0('0x6e')][_0x94e0('0x34')]>0x0?_[_0x94e0('0x29')](_0x3e1309[_0x94e0('0x50')][_0x94e0('0x6e')],function(_0x34285d){return{'name':_0x34285d[_0x94e0('0x6c')],'value':_0x34285d[_0x94e0('0x6f')]};}):[]};})};}})[_0x94e0('0x22')](respondWithResult(_0x2ac0eb,null))['catch'](function(_0x31f261){console[_0x94e0('0x70')](_0x94e0('0x71')+_0x31f261);var _0x3c090b=_0x459ca6[_0x94e0('0x2f')][_0x94e0('0x72')]?0x1f4:_0x31f261[_0x94e0('0x73')]||0x1f4;logger[_0x94e0('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x94e0('0x74'),_0x3c090b,JSON[_0x94e0('0x75')](_0x31f261));delete _0x31f261[_0x94e0('0x27')];if(_0x3c090b===0x191){_0x3c090b=0x190;}_0x2ac0eb[_0x94e0('0x17')](_0x3c090b)[_0x94e0('0x76')](_0x459ca6[_0x94e0('0x2f')][_0x94e0('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x31f261[_0x94e0('0x73')]}:_0x31f261);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 9be2e4a..ce8135c 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 _0xab1d=['request-promise','rimraf','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api'];(function(_0x210603,_0x4adbac){var _0x1bcb7d=function(_0x2cdf89){while(--_0x2cdf89){_0x210603['push'](_0x210603['shift']());}};_0x1bcb7d(++_0x4adbac);}(_0xab1d,0x6a));var _0xdab1=function(_0x1bd3dd,_0x40a78a){_0x1bd3dd=_0x1bd3dd-0x0;var _0xe1a1d4=_0xab1d[_0x1bd3dd];return _0xe1a1d4;};'use strict';var _=require(_0xdab1('0x0'));var util=require(_0xdab1('0x1'));var logger=require(_0xdab1('0x2'))(_0xdab1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdab1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdab1('0x5'));var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xdab1('0x6'));module[_0xdab1('0x7')]=function(_0x534142,_0x9dd227){return _0x534142[_0xdab1('0x8')](_0xdab1('0x9'),attributes,{'tableName':_0xdab1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7aad=['int_vtiger_accounts','lodash','api','moment','request-promise','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount'];(function(_0x494299,_0x1b6f2a){var _0x5637a9=function(_0x381c66){while(--_0x381c66){_0x494299['push'](_0x494299['shift']());}};_0x5637a9(++_0x1b6f2a);}(_0x7aad,0x1e1));var _0xd7aa=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x7aad[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0xd7aa('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd7aa('0x1'));var moment=require(_0xd7aa('0x2'));var BPromise=require('bluebird');var rp=require(_0xd7aa('0x3'));var fs=require('fs');var path=require(_0xd7aa('0x4'));var rimraf=require('rimraf');var config=require(_0xd7aa('0x5'));var attributes=require(_0xd7aa('0x6'));var integrations=require(_0xd7aa('0x7'));module[_0xd7aa('0x8')]=function(_0xfe2c1c,_0x21bbca){return _0xfe2c1c[_0xd7aa('0x9')](_0xd7aa('0xa'),attributes,{'tableName':_0xd7aa('0xb'),'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 a33b8cb..cc0e66a 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 _0x63a5=['then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','raw','options','where','attributes','limit','include','map','model','GetVtigerAccount','ShowVtigerAccount','VtigerAccount','find','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request'];(function(_0x581c23,_0x485718){var _0x2dea41=function(_0x16cfaa){while(--_0x16cfaa){_0x581c23['push'](_0x581c23['shift']());}};_0x2dea41(++_0x485718);}(_0x63a5,0x18e));var _0x563a=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x63a5[_0x11c573];return _0x6b72de;};'use strict';var _=require(_0x563a('0x0'));var util=require(_0x563a('0x1'));var moment=require(_0x563a('0x2'));var BPromise=require('bluebird');var rs=require(_0x563a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x563a('0x4'))['db'];var utils=require(_0x563a('0x5'));var logger=require(_0x563a('0x6'))(_0x563a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x563a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2662f7,_0x4f89b4,_0x4d71a0){return new BPromise(function(_0x543920,_0xff1f59){return client[_0x563a('0x9')](_0x2662f7,_0x4d71a0)[_0x563a('0xa')](function(_0x606235){logger[_0x563a('0xb')](_0x563a('0xc'),_0x4f89b4,_0x563a('0xd'));logger[_0x563a('0xe')](_0x563a('0xf'),_0x4f89b4,_0x563a('0xd'),JSON[_0x563a('0x10')](_0x606235));if(_0x606235[_0x563a('0x11')]){if(_0x606235[_0x563a('0x11')][_0x563a('0x12')]===0x1f4){logger['error'](_0x563a('0xc'),_0x4f89b4,_0x606235[_0x563a('0x11')][_0x563a('0x13')]);return _0xff1f59(_0x606235[_0x563a('0x11')][_0x563a('0x13')]);}logger[_0x563a('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x4f89b4,_0x606235[_0x563a('0x11')][_0x563a('0x13')]);return _0x543920(_0x606235[_0x563a('0x11')][_0x563a('0x13')]);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x4f89b4,_0x563a('0xd'));_0x543920(_0x606235[_0x563a('0x14')]['message']);}})[_0x563a('0x15')](function(_0x43fb16){logger[_0x563a('0x11')](_0x563a('0xc'),_0x4f89b4,_0x43fb16);_0xff1f59(_0x43fb16);});});}exports['GetVtigerAccount']=function(_0x598693){var _0xe3d2bd=this;return new Promise(function(_0x422aaf,_0x54a3b4){return db['VtigerAccount']['findAll']({'raw':_0x598693['options']?_0x598693['options'][_0x563a('0x16')]===undefined?!![]:![]:!![],'where':_0x598693[_0x563a('0x17')]?_0x598693[_0x563a('0x17')][_0x563a('0x18')]||null:null,'attributes':_0x598693['options']?_0x598693['options'][_0x563a('0x19')]||null:null,'limit':_0x598693[_0x563a('0x17')]?_0x598693[_0x563a('0x17')][_0x563a('0x1a')]||null:null,'include':_0x598693[_0x563a('0x17')]?_0x598693[_0x563a('0x17')][_0x563a('0x1b')]?_[_0x563a('0x1c')](_0x598693['options'][_0x563a('0x1b')],function(_0x5422f6){return{'model':db[_0x5422f6[_0x563a('0x1d')]],'as':_0x5422f6['as'],'attributes':_0x5422f6[_0x563a('0x19')],'include':_0x5422f6[_0x563a('0x1b')]?_[_0x563a('0x1c')](_0x5422f6[_0x563a('0x1b')],function(_0x1682ee){return{'model':db[_0x1682ee[_0x563a('0x1d')]],'as':_0x1682ee['as'],'attributes':_0x1682ee[_0x563a('0x19')],'include':_0x1682ee['include']?_[_0x563a('0x1c')](_0x1682ee[_0x563a('0x1b')],function(_0x2311f2){return{'model':db[_0x2311f2[_0x563a('0x1d')]],'as':_0x2311f2['as'],'attributes':_0x2311f2[_0x563a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x563a('0xa')](function(_0x1afdff){logger[_0x563a('0xb')](_0x563a('0x1e'),_0x598693);logger[_0x563a('0xe')](_0x563a('0x1e'),_0x598693,JSON[_0x563a('0x10')](_0x1afdff));_0x422aaf(_0x1afdff);})[_0x563a('0x15')](function(_0x7696c2){logger['error'](_0x563a('0x1e'),_0x7696c2[_0x563a('0x13')],_0x598693);_0x54a3b4(_0xe3d2bd[_0x563a('0x11')](0x1f4,_0x7696c2['message']));});});};exports[_0x563a('0x1f')]=function(_0x2e5c4b){var _0x3a59cb=this;return new Promise(function(_0x28a8f6,_0x166f89){return db[_0x563a('0x20')][_0x563a('0x21')]({'raw':_0x2e5c4b['options']?_0x2e5c4b[_0x563a('0x17')][_0x563a('0x16')]===undefined?!![]:![]:!![],'where':_0x2e5c4b[_0x563a('0x17')]?_0x2e5c4b[_0x563a('0x17')][_0x563a('0x18')]||null:null,'attributes':_0x2e5c4b['options']?_0x2e5c4b['options']['attributes']||null:null,'include':_0x2e5c4b['options']?_0x2e5c4b[_0x563a('0x17')][_0x563a('0x1b')]?_[_0x563a('0x1c')](_0x2e5c4b[_0x563a('0x17')][_0x563a('0x1b')],function(_0x3dc83a){return{'model':db[_0x3dc83a['model']],'as':_0x3dc83a['as'],'attributes':_0x3dc83a['attributes'],'include':_0x3dc83a[_0x563a('0x1b')]?_[_0x563a('0x1c')](_0x3dc83a[_0x563a('0x1b')],function(_0x3a3423){return{'model':db[_0x3a3423[_0x563a('0x1d')]],'as':_0x3a3423['as'],'attributes':_0x3a3423[_0x563a('0x19')],'include':_0x3a3423[_0x563a('0x1b')]?_[_0x563a('0x1c')](_0x3a3423[_0x563a('0x1b')],function(_0x4d98be){return{'model':db[_0x4d98be[_0x563a('0x1d')]],'as':_0x4d98be['as'],'attributes':_0x4d98be[_0x563a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x563a('0xa')](function(_0xa334b7){logger[_0x563a('0xb')](_0x563a('0x1f'),_0x2e5c4b);logger['debug'](_0x563a('0x1f'),_0x2e5c4b,JSON[_0x563a('0x10')](_0xa334b7));_0x28a8f6(_0xa334b7);})[_0x563a('0x15')](function(_0x5abfe4){logger[_0x563a('0x11')]('ShowVtigerAccount',_0x5abfe4[_0x563a('0x13')],_0x2e5c4b);_0x166f89(_0x3a59cb[_0x563a('0x11')](0x1f4,_0x5abfe4['message']));});});}; \ No newline at end of file +var _0x0713=['findAll','options','raw','attributes','limit','include','map','model','ShowVtigerAccount','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount'];(function(_0x44f3c2,_0x3c981b){var _0x4cb315=function(_0x335df8){while(--_0x335df8){_0x44f3c2['push'](_0x44f3c2['shift']());}};_0x4cb315(++_0x3c981b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});}exports[_0x3071('0x18')]=function(_0x17dbda){var _0x1068d9=this;return new Promise(function(_0x108a83,_0x3acf0e){return db[_0x3071('0x19')][_0x3071('0x1a')]({'raw':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')]['where']||null:null,'attributes':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1d')]||null:null,'limit':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1e')]||null:null,'include':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x17dbda['options']['include'],function(_0x2ce48a){return{'model':db[_0x2ce48a[_0x3071('0x21')]],'as':_0x2ce48a['as'],'attributes':_0x2ce48a[_0x3071('0x1d')],'include':_0x2ce48a[_0x3071('0x1f')]?_[_0x3071('0x20')](_0x2ce48a[_0x3071('0x1f')],function(_0x7a4cb4){return{'model':db[_0x7a4cb4[_0x3071('0x21')]],'as':_0x7a4cb4['as'],'attributes':_0x7a4cb4[_0x3071('0x1d')],'include':_0x7a4cb4['include']?_[_0x3071('0x20')](_0x7a4cb4[_0x3071('0x1f')],function(_0x177138){return{'model':db[_0x177138['model']],'as':_0x177138['as'],'attributes':_0x177138[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x163604){logger[_0x3071('0xd')](_0x3071('0x18'),_0x17dbda);logger[_0x3071('0x10')](_0x3071('0x18'),_0x17dbda,JSON[_0x3071('0x12')](_0x163604));_0x108a83(_0x163604);})[_0x3071('0x17')](function(_0x292205){logger[_0x3071('0x13')]('GetVtigerAccount',_0x292205['message'],_0x17dbda);_0x3acf0e(_0x1068d9[_0x3071('0x13')](0x1f4,_0x292205[_0x3071('0x15')]));});});};exports[_0x3071('0x22')]=function(_0x40be95){var _0x3f6d90=this;return new Promise(function(_0x29538c,_0x32b6b1){return db[_0x3071('0x19')]['find']({'raw':_0x40be95['options']?_0x40be95['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x40be95[_0x3071('0x1b')]?_0x40be95['options'][_0x3071('0x23')]||null:null,'attributes':_0x40be95[_0x3071('0x1b')]?_0x40be95[_0x3071('0x1b')][_0x3071('0x1d')]||null:null,'include':_0x40be95['options']?_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')],function(_0x2068ce){return{'model':db[_0x2068ce[_0x3071('0x21')]],'as':_0x2068ce['as'],'attributes':_0x2068ce[_0x3071('0x1d')],'include':_0x2068ce['include']?_[_0x3071('0x20')](_0x2068ce['include'],function(_0x4fb1ec){return{'model':db[_0x4fb1ec[_0x3071('0x21')]],'as':_0x4fb1ec['as'],'attributes':_0x4fb1ec[_0x3071('0x1d')],'include':_0x4fb1ec['include']?_[_0x3071('0x20')](_0x4fb1ec[_0x3071('0x1f')],function(_0x265d76){return{'model':db[_0x265d76[_0x3071('0x21')]],'as':_0x265d76['as'],'attributes':_0x265d76[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x5610ab){logger[_0x3071('0xd')](_0x3071('0x22'),_0x40be95);logger['debug'](_0x3071('0x22'),_0x40be95,JSON['stringify'](_0x5610ab));_0x29538c(_0x5610ab);})[_0x3071('0x17')](function(_0x43133a){logger['error']('ShowVtigerAccount',_0x43133a[_0x3071('0x15')],_0x40be95);_0x32b6b1(_0x3f6d90[_0x3071('0x13')](0x1f4,_0x43133a[_0x3071('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index e0b74c1..ae29d79 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 _0xda43=['Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','getDescriptions','post','create','put','update','delete','exports','multer','util','path','express'];(function(_0x3f5ecf,_0x32fc3c){var _0x507dcb=function(_0x2ca4ba){while(--_0x2ca4ba){_0x3f5ecf['push'](_0x3f5ecf['shift']());}};_0x507dcb(++_0x32fc3c);}(_0xda43,0x1c8));var _0x3da4=function(_0x4002df,_0x41cf93){_0x4002df=_0x4002df-0x0;var _0x518504=_0xda43[_0x4002df];return _0x518504;};'use strict';var multer=require(_0x3da4('0x0'));var util=require(_0x3da4('0x1'));var path=require(_0x3da4('0x2'));var timeout=require('connect-timeout');var express=require(_0x3da4('0x3'));var router=express[_0x3da4('0x4')]();var fs_extra=require(_0x3da4('0x5'));var auth=require(_0x3da4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3da4('0x7'));var controller=require(_0x3da4('0x8'));router['get']('/',auth[_0x3da4('0x9')](),controller[_0x3da4('0xa')]);router[_0x3da4('0xb')](_0x3da4('0xc'),auth[_0x3da4('0x9')](),controller[_0x3da4('0xd')]);router['get'](_0x3da4('0xe'),auth['isAuthenticated'](),controller[_0x3da4('0xf')]);router[_0x3da4('0xb')]('/:id/subjects',auth[_0x3da4('0x9')](),controller['getSubjects']);router[_0x3da4('0xb')]('/:id/descriptions',auth[_0x3da4('0x9')](),controller[_0x3da4('0x10')]);router[_0x3da4('0x11')]('/',auth[_0x3da4('0x9')](),controller[_0x3da4('0x12')]);router[_0x3da4('0x13')](_0x3da4('0xc'),auth[_0x3da4('0x9')](),controller[_0x3da4('0x14')]);router[_0x3da4('0x15')](_0x3da4('0xc'),auth[_0x3da4('0x9')](),controller['destroy']);module[_0x3da4('0x16')]=router; \ No newline at end of file +var _0xdd04=['getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','./intVtigerConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields'];(function(_0x1e8b56,_0x18652b){var _0xd33375=function(_0x47c1e0){while(--_0x47c1e0){_0x1e8b56['push'](_0x1e8b56['shift']());}};_0xd33375(++_0x18652b);}(_0xdd04,0x158));var _0x4dd0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd04[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4dd0('0x0'));var util=require(_0x4dd0('0x1'));var path=require('path');var timeout=require(_0x4dd0('0x2'));var express=require('express');var router=express[_0x4dd0('0x3')]();var fs_extra=require(_0x4dd0('0x4'));var auth=require(_0x4dd0('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4dd0('0x6'));router[_0x4dd0('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4dd0('0x7')](_0x4dd0('0x8'),auth[_0x4dd0('0x9')](),controller[_0x4dd0('0xa')]);router['get'](_0x4dd0('0xb'),auth['isAuthenticated'](),controller[_0x4dd0('0xc')]);router[_0x4dd0('0x7')]('/:id/subjects',auth[_0x4dd0('0x9')](),controller[_0x4dd0('0xd')]);router[_0x4dd0('0x7')](_0x4dd0('0xe'),auth[_0x4dd0('0x9')](),controller[_0x4dd0('0xf')]);router[_0x4dd0('0x10')]('/',auth[_0x4dd0('0x9')](),controller[_0x4dd0('0x11')]);router[_0x4dd0('0x12')](_0x4dd0('0x8'),auth['isAuthenticated'](),controller[_0x4dd0('0x13')]);router[_0x4dd0('0x14')](_0x4dd0('0x8'),auth[_0x4dd0('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 08f1c20..eaf841b 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 _0xf69d=['sequelize','exports','STRING'];(function(_0xc01862,_0x4447bf){var _0x45d496=function(_0x258244){while(--_0x258244){_0xc01862['push'](_0xc01862['shift']());}};_0x45d496(++_0x4447bf);}(_0xf69d,0x75));var _0xdf69=function(_0x146f49,_0x51cca3){_0x146f49=_0x146f49-0x0;var _0x3e0885=_0xf69d[_0x146f49];return _0x3e0885;};'use strict';var Sequelize=require(_0xdf69('0x0'));module[_0xdf69('0x1')]={'name':{'type':Sequelize[_0xdf69('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd8d4=['STRING','exports'];(function(_0x1b46ce,_0x2e6a63){var _0x5be83a=function(_0x2a8650){while(--_0x2a8650){_0x1b46ce['push'](_0x1b46ce['shift']());}};_0x5be83a(++_0x2e6a63);}(_0xd8d4,0x159));var _0x4d8d=function(_0x3a0840,_0x54c20c){_0x3a0840=_0x3a0840-0x0;var _0x407e44=_0xd8d4[_0x3a0840];return _0x407e44;};'use strict';var Sequelize=require('sequelize');module[_0x4d8d('0x0')]={'name':{'type':Sequelize[_0x4d8d('0x1')]},'description':{'type':Sequelize[_0x4d8d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 7bc1091..c0d309c 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 _0x6e67=['intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','count','includeAll','findAll','rows','catch','params','include','create','body','find','getFields','findOne','VtigerField','length','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','save','update','then','destroy','error','stack','name','index','VtigerConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters'];(function(_0x3a96d4,_0x10415d){var _0xdb1983=function(_0x2cb066){while(--_0x2cb066){_0x3a96d4['push'](_0x3a96d4['shift']());}};_0xdb1983(++_0x10415d);}(_0x6e67,0x114));var _0x76e6=function(_0x2e5981,_0xe4e846){_0x2e5981=_0x2e5981-0x0;var _0x6e4fef=_0x6e67[_0x2e5981];return _0x6e4fef;};'use strict';var emlformat=require(_0x76e6('0x0'));var rimraf=require(_0x76e6('0x1'));var zipdir=require(_0x76e6('0x2'));var jsonpatch=require(_0x76e6('0x3'));var rp=require(_0x76e6('0x4'));var moment=require(_0x76e6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x76e6('0x6'));var util=require(_0x76e6('0x7'));var path=require(_0x76e6('0x8'));var sox=require(_0x76e6('0x9'));var csv=require(_0x76e6('0xa'));var ejs=require(_0x76e6('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76e6('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x76e6('0xd'));var deskjs=require(_0x76e6('0xe'));var toCsv=require(_0x76e6('0xa'));var querystring=require(_0x76e6('0xf'));var Papa=require(_0x76e6('0x10'));var Redis=require(_0x76e6('0x11'));var authService=require(_0x76e6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x76e6('0x13'));var hardwareService=require(_0x76e6('0x14'));var logger=require(_0x76e6('0x15'))(_0x76e6('0x16'));var utils=require(_0x76e6('0x17'));var config=require(_0x76e6('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x76e6('0x19'))['db'];function respondWithStatusCode(_0x11eb73,_0x517dce){_0x517dce=_0x517dce||0xcc;return function(_0x4c9b4c){if(_0x4c9b4c){return _0x11eb73[_0x76e6('0x1a')](_0x517dce);}return _0x11eb73[_0x76e6('0x1b')](_0x517dce)[_0x76e6('0x1c')]();};}function respondWithResult(_0x27694e,_0xb3fa4d){_0xb3fa4d=_0xb3fa4d||0xc8;return function(_0x18fa10){if(_0x18fa10){return _0x27694e[_0x76e6('0x1b')](_0xb3fa4d)[_0x76e6('0x1d')](_0x18fa10);}};}function respondWithFilteredResult(_0x16e7b1,_0x7fa29d){return function(_0x295904){if(_0x295904){var _0x1361b9=typeof _0x7fa29d[_0x76e6('0x1e')]===_0x76e6('0x1f')&&typeof _0x7fa29d[_0x76e6('0x20')]===_0x76e6('0x1f');var _0x4a114d=_0x295904['count'];var _0x45e9e2=_0x1361b9?0x0:_0x7fa29d[_0x76e6('0x1e')];var _0x6ead8a=_0x1361b9?_0x295904['count']:_0x7fa29d[_0x76e6('0x1e')]+_0x7fa29d[_0x76e6('0x20')];var _0x3247d9;if(_0x6ead8a>=_0x4a114d){_0x6ead8a=_0x4a114d;_0x3247d9=0xc8;}else{_0x3247d9=0xce;}_0x16e7b1[_0x76e6('0x1b')](_0x3247d9);return _0x16e7b1['set'](_0x76e6('0x21'),_0x45e9e2+'-'+_0x6ead8a+'/'+_0x4a114d)['json'](_0x295904);}return null;};}function patchUpdates(_0x1e0ea8){return function(_0x1516a9){try{jsonpatch[_0x76e6('0x22')](_0x1516a9,_0x1e0ea8,!![]);}catch(_0x54fccf){return BPromise['reject'](_0x54fccf);}return _0x1516a9[_0x76e6('0x23')]();};}function saveUpdates(_0x153ce3,_0x507b3c){return function(_0x57a614){if(_0x57a614){return _0x57a614[_0x76e6('0x24')](_0x153ce3)[_0x76e6('0x25')](function(_0x25cdfb){return _0x25cdfb;});}return null;};}function removeEntity(_0x88eb46,_0x50cbc8){return function(_0xb3dbc4){if(_0xb3dbc4){return _0xb3dbc4[_0x76e6('0x26')]()[_0x76e6('0x25')](function(){_0x88eb46['status'](0xcc)[_0x76e6('0x1c')]();});}};}function handleEntityNotFound(_0x590d3f,_0x1e0d07){return function(_0x47aab1){if(!_0x47aab1){_0x590d3f[_0x76e6('0x1a')](0x194);}return _0x47aab1;};}function handleError(_0x2b9421,_0x1c11c6){_0x1c11c6=_0x1c11c6||0x1f4;return function(_0x22ec79){logger[_0x76e6('0x27')](_0x22ec79[_0x76e6('0x28')]);if(_0x22ec79[_0x76e6('0x29')]){delete _0x22ec79[_0x76e6('0x29')];}_0x2b9421['status'](_0x1c11c6)['send'](_0x22ec79);};}exports[_0x76e6('0x2a')]=function(_0x28cec7,_0x5be028){var _0x3f2155={},_0x2b001c={},_0x2ce488={'count':0x0,'rows':[]};var _0x47daaf=_['map'](db[_0x76e6('0x2b')][_0x76e6('0x2c')],function(_0xa2d63a){return{'name':_0xa2d63a[_0x76e6('0x2d')],'type':_0xa2d63a['type'][_0x76e6('0x2e')]};});_0x2b001c[_0x76e6('0x2f')]=_[_0x76e6('0x30')](_0x47daaf,_0x76e6('0x29'));_0x2b001c[_0x76e6('0x31')]=_[_0x76e6('0x32')](_0x28cec7[_0x76e6('0x31')]);_0x2b001c[_0x76e6('0x33')]=_[_0x76e6('0x34')](_0x2b001c['model'],_0x2b001c[_0x76e6('0x31')]);_0x3f2155[_0x76e6('0x35')]=_['intersection'](_0x2b001c[_0x76e6('0x2f')],qs[_0x76e6('0x36')](_0x28cec7['query'][_0x76e6('0x36')]));_0x3f2155[_0x76e6('0x35')]=_0x3f2155[_0x76e6('0x35')]['length']?_0x3f2155[_0x76e6('0x35')]:_0x2b001c['model'];if(!_0x28cec7[_0x76e6('0x31')][_0x76e6('0x37')](_0x76e6('0x38'))){_0x3f2155[_0x76e6('0x20')]=qs[_0x76e6('0x20')](_0x28cec7[_0x76e6('0x31')]['limit']);_0x3f2155[_0x76e6('0x1e')]=qs[_0x76e6('0x1e')](_0x28cec7['query'][_0x76e6('0x1e')]);}_0x3f2155[_0x76e6('0x39')]=qs[_0x76e6('0x3a')](_0x28cec7[_0x76e6('0x31')]['sort']);_0x3f2155[_0x76e6('0x3b')]=qs['filters'](_[_0x76e6('0x3c')](_0x28cec7['query'],_0x2b001c[_0x76e6('0x33')]),_0x47daaf);if(_0x28cec7[_0x76e6('0x31')]['filter']){_0x3f2155[_0x76e6('0x3b')]=_[_0x76e6('0x3d')](_0x3f2155[_0x76e6('0x3b')],{'$or':_['map'](_0x47daaf,function(_0x24dc84){if(_0x24dc84[_0x76e6('0x3e')]!==_0x76e6('0x3f')){var _0x59c719={};_0x59c719[_0x24dc84['name']]={'$like':'%'+_0x28cec7[_0x76e6('0x31')][_0x76e6('0x40')]+'%'};return _0x59c719;}})});}_0x3f2155=_[_0x76e6('0x3d')]({},_0x3f2155,_0x28cec7[_0x76e6('0x41')]);var _0x4a2a24={'where':_0x3f2155['where']};return db[_0x76e6('0x2b')][_0x76e6('0x42')](_0x4a2a24)[_0x76e6('0x25')](function(_0x547cc1){_0x2ce488[_0x76e6('0x42')]=_0x547cc1;if(_0x28cec7['query'][_0x76e6('0x43')]){_0x3f2155['include']=[{'all':!![]}];}return db[_0x76e6('0x2b')][_0x76e6('0x44')](_0x3f2155);})[_0x76e6('0x25')](function(_0x557137){_0x2ce488[_0x76e6('0x45')]=_0x557137;return _0x2ce488;})['then'](respondWithFilteredResult(_0x5be028,_0x3f2155))[_0x76e6('0x46')](handleError(_0x5be028,null));};exports['show']=function(_0x2dfb1b,_0x12e882){var _0x33d3a4={'raw':![],'where':{'id':_0x2dfb1b[_0x76e6('0x47')]['id']}},_0x4c3042={};_0x4c3042[_0x76e6('0x2f')]=_['keys'](db[_0x76e6('0x2b')][_0x76e6('0x2c')]);_0x4c3042['query']=_[_0x76e6('0x32')](_0x2dfb1b['query']);_0x4c3042[_0x76e6('0x33')]=_['intersection'](_0x4c3042[_0x76e6('0x2f')],_0x4c3042[_0x76e6('0x31')]);_0x33d3a4['attributes']=_[_0x76e6('0x34')](_0x4c3042[_0x76e6('0x2f')],qs[_0x76e6('0x36')](_0x2dfb1b[_0x76e6('0x31')]['fields']));_0x33d3a4['attributes']=_0x33d3a4[_0x76e6('0x35')]['length']?_0x33d3a4[_0x76e6('0x35')]:_0x4c3042['model'];if(_0x2dfb1b[_0x76e6('0x31')][_0x76e6('0x43')]){_0x33d3a4[_0x76e6('0x48')]=[{'all':!![]}];}_0x33d3a4=_[_0x76e6('0x3d')]({},_0x33d3a4,_0x2dfb1b[_0x76e6('0x41')]);return db[_0x76e6('0x2b')]['find'](_0x33d3a4)['then'](handleEntityNotFound(_0x12e882,null))[_0x76e6('0x25')](respondWithResult(_0x12e882,null))[_0x76e6('0x46')](handleError(_0x12e882,null));};exports[_0x76e6('0x49')]=function(_0x4de416,_0x1309ae){return db[_0x76e6('0x2b')][_0x76e6('0x49')](_0x4de416['body'],{})[_0x76e6('0x25')](respondWithResult(_0x1309ae,0xc9))[_0x76e6('0x46')](handleError(_0x1309ae,null));};exports[_0x76e6('0x24')]=function(_0x25bcf2,_0x3466ab){if(_0x25bcf2[_0x76e6('0x4a')]['id']){delete _0x25bcf2[_0x76e6('0x4a')]['id'];}return db[_0x76e6('0x2b')][_0x76e6('0x4b')]({'where':{'id':_0x25bcf2[_0x76e6('0x47')]['id']}})['then'](handleEntityNotFound(_0x3466ab,null))['then'](saveUpdates(_0x25bcf2[_0x76e6('0x4a')],null))[_0x76e6('0x25')](respondWithResult(_0x3466ab,null))['catch'](handleError(_0x3466ab,null));};exports[_0x76e6('0x26')]=function(_0x37f4b6,_0x1422f1){return db[_0x76e6('0x2b')][_0x76e6('0x4b')]({'where':{'id':_0x37f4b6[_0x76e6('0x47')]['id']}})['then'](handleEntityNotFound(_0x1422f1,null))[_0x76e6('0x25')](removeEntity(_0x1422f1,null))[_0x76e6('0x46')](handleError(_0x1422f1,null));};exports[_0x76e6('0x4c')]=function(_0x4dc2cb,_0x306145,_0x14f99f){var _0x46e2db={};var _0x52ae8e={};var _0x1a14ff;var _0x16afea;return db['VtigerConfiguration'][_0x76e6('0x4d')]({'where':{'id':_0x4dc2cb[_0x76e6('0x47')]['id']}})[_0x76e6('0x25')](handleEntityNotFound(_0x306145,null))['then'](function(_0x5a737e){if(_0x5a737e){_0x1a14ff=_0x5a737e;_0x52ae8e[_0x76e6('0x2f')]=_['keys'](db[_0x76e6('0x4e')][_0x76e6('0x2c')]);_0x52ae8e[_0x76e6('0x31')]=_[_0x76e6('0x32')](_0x4dc2cb['query']);_0x52ae8e[_0x76e6('0x33')]=_['intersection'](_0x52ae8e[_0x76e6('0x2f')],_0x52ae8e[_0x76e6('0x31')]);_0x46e2db[_0x76e6('0x35')]=_['intersection'](_0x52ae8e['model'],qs[_0x76e6('0x36')](_0x4dc2cb[_0x76e6('0x31')]['fields']));_0x46e2db['attributes']=_0x46e2db[_0x76e6('0x35')][_0x76e6('0x4f')]?_0x46e2db['attributes']:_0x52ae8e[_0x76e6('0x2f')];_0x46e2db['order']=qs[_0x76e6('0x3a')](_0x4dc2cb['query'][_0x76e6('0x3a')]);_0x46e2db[_0x76e6('0x3b')]=qs[_0x76e6('0x33')](_[_0x76e6('0x3c')](_0x4dc2cb[_0x76e6('0x31')],_0x52ae8e['filters']));if(_0x4dc2cb[_0x76e6('0x31')][_0x76e6('0x40')]){_0x46e2db[_0x76e6('0x3b')]=_[_0x76e6('0x3d')](_0x46e2db['where'],{'$or':_[_0x76e6('0x30')](_0x46e2db[_0x76e6('0x35')],function(_0x4a9a4a){var _0x52bd4d={};_0x52bd4d[_0x4a9a4a]={'$like':'%'+_0x4dc2cb[_0x76e6('0x31')][_0x76e6('0x40')]+'%'};return _0x52bd4d;})});}_0x46e2db=_[_0x76e6('0x3d')]({},_0x46e2db,_0x4dc2cb['options']);return _0x1a14ff[_0x76e6('0x4c')](_0x46e2db);}})[_0x76e6('0x25')](function(_0x268ac2){if(_0x268ac2){_0x16afea=_0x268ac2[_0x76e6('0x4f')];if(!_0x4dc2cb[_0x76e6('0x31')][_0x76e6('0x37')](_0x76e6('0x38'))){_0x46e2db[_0x76e6('0x20')]=qs[_0x76e6('0x20')](_0x4dc2cb['query'][_0x76e6('0x20')]);_0x46e2db[_0x76e6('0x1e')]=qs['offset'](_0x4dc2cb[_0x76e6('0x31')][_0x76e6('0x1e')]);}return _0x1a14ff[_0x76e6('0x4c')](_0x46e2db);}})[_0x76e6('0x25')](function(_0x1cbbe4){if(_0x1cbbe4){return _0x1cbbe4?{'count':_0x16afea,'rows':_0x1cbbe4}:null;}})[_0x76e6('0x25')](respondWithResult(_0x306145,null))['catch'](handleError(_0x306145,null));};exports[_0x76e6('0x50')]=function(_0x3b4f3c,_0x46bf0a,_0x47b6f0){var _0x4ceb1c={};var _0x360a1c={};var _0x246686;var _0x5f1917;return db[_0x76e6('0x2b')][_0x76e6('0x4d')]({'where':{'id':_0x3b4f3c['params']['id']}})[_0x76e6('0x25')](handleEntityNotFound(_0x46bf0a,null))[_0x76e6('0x25')](function(_0x4cba22){if(_0x4cba22){_0x246686=_0x4cba22;_0x360a1c[_0x76e6('0x2f')]=_[_0x76e6('0x32')](db['VtigerField'][_0x76e6('0x2c')]);_0x360a1c[_0x76e6('0x31')]=_['keys'](_0x3b4f3c[_0x76e6('0x31')]);_0x360a1c['filters']=_[_0x76e6('0x34')](_0x360a1c[_0x76e6('0x2f')],_0x360a1c['query']);_0x4ceb1c[_0x76e6('0x35')]=_[_0x76e6('0x34')](_0x360a1c[_0x76e6('0x2f')],qs[_0x76e6('0x36')](_0x3b4f3c[_0x76e6('0x31')][_0x76e6('0x36')]));_0x4ceb1c[_0x76e6('0x35')]=_0x4ceb1c[_0x76e6('0x35')]['length']?_0x4ceb1c[_0x76e6('0x35')]:_0x360a1c[_0x76e6('0x2f')];_0x4ceb1c[_0x76e6('0x39')]=qs[_0x76e6('0x3a')](_0x3b4f3c[_0x76e6('0x31')]['sort']);_0x4ceb1c[_0x76e6('0x3b')]=qs[_0x76e6('0x33')](_[_0x76e6('0x3c')](_0x3b4f3c['query'],_0x360a1c[_0x76e6('0x33')]));if(_0x3b4f3c[_0x76e6('0x31')][_0x76e6('0x40')]){_0x4ceb1c[_0x76e6('0x3b')]=_[_0x76e6('0x3d')](_0x4ceb1c[_0x76e6('0x3b')],{'$or':_[_0x76e6('0x30')](_0x4ceb1c[_0x76e6('0x35')],function(_0x92935b){var _0xb214b4={};_0xb214b4[_0x92935b]={'$like':'%'+_0x3b4f3c['query'][_0x76e6('0x40')]+'%'};return _0xb214b4;})});}_0x4ceb1c=_[_0x76e6('0x3d')]({},_0x4ceb1c,_0x3b4f3c[_0x76e6('0x41')]);return _0x246686[_0x76e6('0x50')](_0x4ceb1c);}})['then'](function(_0x1ae59f){if(_0x1ae59f){_0x5f1917=_0x1ae59f['length'];if(!_0x3b4f3c[_0x76e6('0x31')]['hasOwnProperty'](_0x76e6('0x38'))){_0x4ceb1c[_0x76e6('0x20')]=qs[_0x76e6('0x20')](_0x3b4f3c[_0x76e6('0x31')]['limit']);_0x4ceb1c[_0x76e6('0x1e')]=qs[_0x76e6('0x1e')](_0x3b4f3c[_0x76e6('0x31')][_0x76e6('0x1e')]);}return _0x246686[_0x76e6('0x50')](_0x4ceb1c);}})[_0x76e6('0x25')](function(_0x5f5ac5){if(_0x5f5ac5){return _0x5f5ac5?{'count':_0x5f1917,'rows':_0x5f5ac5}:null;}})['then'](respondWithResult(_0x46bf0a,null))[_0x76e6('0x46')](handleError(_0x46bf0a,null));};exports[_0x76e6('0x51')]=function(_0x5cbd3e,_0x3ab9b0,_0x50c270){var _0x1df568={};var _0xf7293f={};var _0x238311;var _0xb43971;return db[_0x76e6('0x2b')][_0x76e6('0x4d')]({'where':{'id':_0x5cbd3e[_0x76e6('0x47')]['id']}})[_0x76e6('0x25')](handleEntityNotFound(_0x3ab9b0,null))[_0x76e6('0x25')](function(_0x5c03fb){if(_0x5c03fb){_0x238311=_0x5c03fb;_0xf7293f['model']=_[_0x76e6('0x32')](db[_0x76e6('0x4e')][_0x76e6('0x2c')]);_0xf7293f[_0x76e6('0x31')]=_['keys'](_0x5cbd3e[_0x76e6('0x31')]);_0xf7293f[_0x76e6('0x33')]=_[_0x76e6('0x34')](_0xf7293f[_0x76e6('0x2f')],_0xf7293f[_0x76e6('0x31')]);_0x1df568[_0x76e6('0x35')]=_[_0x76e6('0x34')](_0xf7293f[_0x76e6('0x2f')],qs[_0x76e6('0x36')](_0x5cbd3e[_0x76e6('0x31')][_0x76e6('0x36')]));_0x1df568[_0x76e6('0x35')]=_0x1df568[_0x76e6('0x35')][_0x76e6('0x4f')]?_0x1df568[_0x76e6('0x35')]:_0xf7293f['model'];_0x1df568[_0x76e6('0x39')]=qs[_0x76e6('0x3a')](_0x5cbd3e[_0x76e6('0x31')][_0x76e6('0x3a')]);_0x1df568[_0x76e6('0x3b')]=qs['filters'](_[_0x76e6('0x3c')](_0x5cbd3e[_0x76e6('0x31')],_0xf7293f[_0x76e6('0x33')]));if(_0x5cbd3e[_0x76e6('0x31')][_0x76e6('0x40')]){_0x1df568[_0x76e6('0x3b')]=_[_0x76e6('0x3d')](_0x1df568[_0x76e6('0x3b')],{'$or':_['map'](_0x1df568[_0x76e6('0x35')],function(_0x139a1d){var _0x379aed={};_0x379aed[_0x139a1d]={'$like':'%'+_0x5cbd3e[_0x76e6('0x31')][_0x76e6('0x40')]+'%'};return _0x379aed;})});}_0x1df568=_[_0x76e6('0x3d')]({},_0x1df568,_0x5cbd3e[_0x76e6('0x41')]);return _0x238311[_0x76e6('0x51')](_0x1df568);}})[_0x76e6('0x25')](function(_0x107171){if(_0x107171){_0xb43971=_0x107171[_0x76e6('0x4f')];if(!_0x5cbd3e['query']['hasOwnProperty'](_0x76e6('0x38'))){_0x1df568[_0x76e6('0x20')]=qs[_0x76e6('0x20')](_0x5cbd3e[_0x76e6('0x31')][_0x76e6('0x20')]);_0x1df568[_0x76e6('0x1e')]=qs[_0x76e6('0x1e')](_0x5cbd3e['query'][_0x76e6('0x1e')]);}return _0x238311[_0x76e6('0x51')](_0x1df568);}})['then'](function(_0x1ee2c6){if(_0x1ee2c6){return _0x1ee2c6?{'count':_0xb43971,'rows':_0x1ee2c6}:null;}})[_0x76e6('0x25')](respondWithResult(_0x3ab9b0,null))['catch'](handleError(_0x3ab9b0,null));}; \ No newline at end of file +var _0x94cc=['util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','offset','undefined','limit','count','set','Content-Range','save','update','then','status','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VtigerConfiguration','includeAll','include','rows','catch','show','params','find','create','body','destroy','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x5defe5,_0x454030){var _0x1a53f2=function(_0x5d5502){while(--_0x5d5502){_0x5defe5['push'](_0x5defe5['shift']());}};_0x1a53f2(++_0x454030);}(_0x94cc,0x133));var _0xc94c=function(_0x2dae89,_0x49c1c4){_0x2dae89=_0x2dae89-0x0;var _0x8b89e1=_0x94cc[_0x2dae89];return _0x8b89e1;};'use strict';var emlformat=require(_0xc94c('0x0'));var rimraf=require(_0xc94c('0x1'));var zipdir=require(_0xc94c('0x2'));var jsonpatch=require(_0xc94c('0x3'));var rp=require('request-promise');var moment=require(_0xc94c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc94c('0x5'));var path=require(_0xc94c('0x6'));var sox=require(_0xc94c('0x7'));var csv=require(_0xc94c('0x8'));var ejs=require(_0xc94c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc94c('0xa'));var deskjs=require(_0xc94c('0xb'));var toCsv=require(_0xc94c('0x8'));var querystring=require(_0xc94c('0xc'));var Papa=require(_0xc94c('0xd'));var Redis=require(_0xc94c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc94c('0xf'));var as=require(_0xc94c('0x10'));var hardwareService=require(_0xc94c('0x11'));var logger=require(_0xc94c('0x12'))(_0xc94c('0x13'));var utils=require(_0xc94c('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc94c('0x15'))['db'];function respondWithStatusCode(_0x144a47,_0x2f97e4){_0x2f97e4=_0x2f97e4||0xcc;return function(_0x725c97){if(_0x725c97){return _0x144a47[_0xc94c('0x16')](_0x2f97e4);}return _0x144a47['status'](_0x2f97e4)['end']();};}function respondWithResult(_0x20a1ba,_0x5b1b4e){_0x5b1b4e=_0x5b1b4e||0xc8;return function(_0x14e89d){if(_0x14e89d){return _0x20a1ba['status'](_0x5b1b4e)['json'](_0x14e89d);}};}function respondWithFilteredResult(_0x1902fc,_0x6f555a){return function(_0x4afe09){if(_0x4afe09){var _0x1b847d=typeof _0x6f555a[_0xc94c('0x17')]===_0xc94c('0x18')&&typeof _0x6f555a[_0xc94c('0x19')]===_0xc94c('0x18');var _0x3e5980=_0x4afe09[_0xc94c('0x1a')];var _0x401668=_0x1b847d?0x0:_0x6f555a[_0xc94c('0x17')];var _0x2d391f=_0x1b847d?_0x4afe09[_0xc94c('0x1a')]:_0x6f555a[_0xc94c('0x17')]+_0x6f555a[_0xc94c('0x19')];var _0x46f6fa;if(_0x2d391f>=_0x3e5980){_0x2d391f=_0x3e5980;_0x46f6fa=0xc8;}else{_0x46f6fa=0xce;}_0x1902fc['status'](_0x46f6fa);return _0x1902fc[_0xc94c('0x1b')](_0xc94c('0x1c'),_0x401668+'-'+_0x2d391f+'/'+_0x3e5980)['json'](_0x4afe09);}return null;};}function patchUpdates(_0x378cb0){return function(_0x5691a1){try{jsonpatch['apply'](_0x5691a1,_0x378cb0,!![]);}catch(_0x31e423){return BPromise['reject'](_0x31e423);}return _0x5691a1[_0xc94c('0x1d')]();};}function saveUpdates(_0x293e71,_0x2524d6){return function(_0x90b8ab){if(_0x90b8ab){return _0x90b8ab[_0xc94c('0x1e')](_0x293e71)[_0xc94c('0x1f')](function(_0x3a65c2){return _0x3a65c2;});}return null;};}function removeEntity(_0x121257,_0x4b6970){return function(_0x2a17ca){if(_0x2a17ca){return _0x2a17ca['destroy']()[_0xc94c('0x1f')](function(){_0x121257[_0xc94c('0x20')](0xcc)[_0xc94c('0x21')]();});}};}function handleEntityNotFound(_0x5570e9,_0x51c0f6){return function(_0x588e19){if(!_0x588e19){_0x5570e9[_0xc94c('0x16')](0x194);}return _0x588e19;};}function handleError(_0x8fdde9,_0x31580b){_0x31580b=_0x31580b||0x1f4;return function(_0x518508){logger[_0xc94c('0x22')](_0x518508[_0xc94c('0x23')]);if(_0x518508['name']){delete _0x518508[_0xc94c('0x24')];}_0x8fdde9[_0xc94c('0x20')](_0x31580b)[_0xc94c('0x25')](_0x518508);};}exports[_0xc94c('0x26')]=function(_0x46a1,_0x532676){var _0x4eb7e4={},_0x3234ff={},_0x5a6648={'count':0x0,'rows':[]};var _0x373b3e=_['map'](db['VtigerConfiguration'][_0xc94c('0x27')],function(_0x5208ff){return{'name':_0x5208ff[_0xc94c('0x28')],'type':_0x5208ff[_0xc94c('0x29')][_0xc94c('0x2a')]};});_0x3234ff[_0xc94c('0x2b')]=_[_0xc94c('0x2c')](_0x373b3e,_0xc94c('0x24'));_0x3234ff[_0xc94c('0x2d')]=_[_0xc94c('0x2e')](_0x46a1['query']);_0x3234ff[_0xc94c('0x2f')]=_[_0xc94c('0x30')](_0x3234ff[_0xc94c('0x2b')],_0x3234ff[_0xc94c('0x2d')]);_0x4eb7e4['attributes']=_[_0xc94c('0x30')](_0x3234ff['model'],qs[_0xc94c('0x31')](_0x46a1[_0xc94c('0x2d')][_0xc94c('0x31')]));_0x4eb7e4[_0xc94c('0x32')]=_0x4eb7e4['attributes'][_0xc94c('0x33')]?_0x4eb7e4[_0xc94c('0x32')]:_0x3234ff[_0xc94c('0x2b')];if(!_0x46a1[_0xc94c('0x2d')][_0xc94c('0x34')](_0xc94c('0x35'))){_0x4eb7e4['limit']=qs['limit'](_0x46a1[_0xc94c('0x2d')][_0xc94c('0x19')]);_0x4eb7e4[_0xc94c('0x17')]=qs['offset'](_0x46a1[_0xc94c('0x2d')][_0xc94c('0x17')]);}_0x4eb7e4[_0xc94c('0x36')]=qs[_0xc94c('0x37')](_0x46a1[_0xc94c('0x2d')][_0xc94c('0x37')]);_0x4eb7e4[_0xc94c('0x38')]=qs[_0xc94c('0x2f')](_[_0xc94c('0x39')](_0x46a1['query'],_0x3234ff[_0xc94c('0x2f')]),_0x373b3e);if(_0x46a1[_0xc94c('0x2d')][_0xc94c('0x3a')]){_0x4eb7e4[_0xc94c('0x38')]=_[_0xc94c('0x3b')](_0x4eb7e4[_0xc94c('0x38')],{'$or':_[_0xc94c('0x2c')](_0x373b3e,function(_0x739966){if(_0x739966[_0xc94c('0x29')]!==_0xc94c('0x3c')){var _0x28a7ac={};_0x28a7ac[_0x739966[_0xc94c('0x24')]]={'$like':'%'+_0x46a1[_0xc94c('0x2d')][_0xc94c('0x3a')]+'%'};return _0x28a7ac;}})});}_0x4eb7e4=_[_0xc94c('0x3b')]({},_0x4eb7e4,_0x46a1[_0xc94c('0x3d')]);var _0x445f82={'where':_0x4eb7e4[_0xc94c('0x38')]};return db[_0xc94c('0x3e')]['count'](_0x445f82)[_0xc94c('0x1f')](function(_0x59c74f){_0x5a6648['count']=_0x59c74f;if(_0x46a1['query'][_0xc94c('0x3f')]){_0x4eb7e4[_0xc94c('0x40')]=[{'all':!![]}];}return db[_0xc94c('0x3e')]['findAll'](_0x4eb7e4);})['then'](function(_0x262acc){_0x5a6648[_0xc94c('0x41')]=_0x262acc;return _0x5a6648;})[_0xc94c('0x1f')](respondWithFilteredResult(_0x532676,_0x4eb7e4))[_0xc94c('0x42')](handleError(_0x532676,null));};exports[_0xc94c('0x43')]=function(_0x1e805e,_0x3970fe){var _0x2ef477={'raw':![],'where':{'id':_0x1e805e[_0xc94c('0x44')]['id']}},_0x560817={};_0x560817[_0xc94c('0x2b')]=_[_0xc94c('0x2e')](db[_0xc94c('0x3e')][_0xc94c('0x27')]);_0x560817['query']=_[_0xc94c('0x2e')](_0x1e805e[_0xc94c('0x2d')]);_0x560817[_0xc94c('0x2f')]=_[_0xc94c('0x30')](_0x560817[_0xc94c('0x2b')],_0x560817[_0xc94c('0x2d')]);_0x2ef477['attributes']=_[_0xc94c('0x30')](_0x560817[_0xc94c('0x2b')],qs[_0xc94c('0x31')](_0x1e805e[_0xc94c('0x2d')][_0xc94c('0x31')]));_0x2ef477[_0xc94c('0x32')]=_0x2ef477[_0xc94c('0x32')]['length']?_0x2ef477[_0xc94c('0x32')]:_0x560817['model'];if(_0x1e805e[_0xc94c('0x2d')][_0xc94c('0x3f')]){_0x2ef477[_0xc94c('0x40')]=[{'all':!![]}];}_0x2ef477=_[_0xc94c('0x3b')]({},_0x2ef477,_0x1e805e['options']);return db[_0xc94c('0x3e')][_0xc94c('0x45')](_0x2ef477)[_0xc94c('0x1f')](handleEntityNotFound(_0x3970fe,null))[_0xc94c('0x1f')](respondWithResult(_0x3970fe,null))[_0xc94c('0x42')](handleError(_0x3970fe,null));};exports[_0xc94c('0x46')]=function(_0x2db761,_0x4e1169){return db[_0xc94c('0x3e')][_0xc94c('0x46')](_0x2db761['body'],{})[_0xc94c('0x1f')](respondWithResult(_0x4e1169,0xc9))[_0xc94c('0x42')](handleError(_0x4e1169,null));};exports['update']=function(_0xee371,_0x5cbad8){if(_0xee371[_0xc94c('0x47')]['id']){delete _0xee371[_0xc94c('0x47')]['id'];}return db[_0xc94c('0x3e')]['find']({'where':{'id':_0xee371[_0xc94c('0x44')]['id']}})[_0xc94c('0x1f')](handleEntityNotFound(_0x5cbad8,null))['then'](saveUpdates(_0xee371[_0xc94c('0x47')],null))[_0xc94c('0x1f')](respondWithResult(_0x5cbad8,null))[_0xc94c('0x42')](handleError(_0x5cbad8,null));};exports[_0xc94c('0x48')]=function(_0x2f59e3,_0xb7cc7c){return db[_0xc94c('0x3e')][_0xc94c('0x45')]({'where':{'id':_0x2f59e3[_0xc94c('0x44')]['id']}})[_0xc94c('0x1f')](handleEntityNotFound(_0xb7cc7c,null))[_0xc94c('0x1f')](removeEntity(_0xb7cc7c,null))[_0xc94c('0x42')](handleError(_0xb7cc7c,null));};exports[_0xc94c('0x49')]=function(_0x22346a,_0x2007db,_0x36c6d0){var _0x179cdc={};var _0x183353={};var _0x4331fd;var _0x5713c4;return db[_0xc94c('0x3e')][_0xc94c('0x4a')]({'where':{'id':_0x22346a[_0xc94c('0x44')]['id']}})[_0xc94c('0x1f')](handleEntityNotFound(_0x2007db,null))[_0xc94c('0x1f')](function(_0x467335){if(_0x467335){_0x4331fd=_0x467335;_0x183353['model']=_[_0xc94c('0x2e')](db[_0xc94c('0x4b')][_0xc94c('0x27')]);_0x183353[_0xc94c('0x2d')]=_[_0xc94c('0x2e')](_0x22346a[_0xc94c('0x2d')]);_0x183353[_0xc94c('0x2f')]=_[_0xc94c('0x30')](_0x183353[_0xc94c('0x2b')],_0x183353['query']);_0x179cdc[_0xc94c('0x32')]=_[_0xc94c('0x30')](_0x183353[_0xc94c('0x2b')],qs[_0xc94c('0x31')](_0x22346a[_0xc94c('0x2d')][_0xc94c('0x31')]));_0x179cdc[_0xc94c('0x32')]=_0x179cdc[_0xc94c('0x32')][_0xc94c('0x33')]?_0x179cdc[_0xc94c('0x32')]:_0x183353[_0xc94c('0x2b')];_0x179cdc[_0xc94c('0x36')]=qs[_0xc94c('0x37')](_0x22346a['query'][_0xc94c('0x37')]);_0x179cdc[_0xc94c('0x38')]=qs[_0xc94c('0x2f')](_[_0xc94c('0x39')](_0x22346a[_0xc94c('0x2d')],_0x183353['filters']));if(_0x22346a[_0xc94c('0x2d')][_0xc94c('0x3a')]){_0x179cdc[_0xc94c('0x38')]=_[_0xc94c('0x3b')](_0x179cdc[_0xc94c('0x38')],{'$or':_[_0xc94c('0x2c')](_0x179cdc[_0xc94c('0x32')],function(_0x16f4d9){var _0x4f1446={};_0x4f1446[_0x16f4d9]={'$like':'%'+_0x22346a[_0xc94c('0x2d')][_0xc94c('0x3a')]+'%'};return _0x4f1446;})});}_0x179cdc=_[_0xc94c('0x3b')]({},_0x179cdc,_0x22346a['options']);return _0x4331fd[_0xc94c('0x49')](_0x179cdc);}})[_0xc94c('0x1f')](function(_0x258182){if(_0x258182){_0x5713c4=_0x258182[_0xc94c('0x33')];if(!_0x22346a['query'][_0xc94c('0x34')]('nolimit')){_0x179cdc['limit']=qs[_0xc94c('0x19')](_0x22346a[_0xc94c('0x2d')][_0xc94c('0x19')]);_0x179cdc[_0xc94c('0x17')]=qs[_0xc94c('0x17')](_0x22346a[_0xc94c('0x2d')][_0xc94c('0x17')]);}return _0x4331fd[_0xc94c('0x49')](_0x179cdc);}})[_0xc94c('0x1f')](function(_0x3c8169){if(_0x3c8169){return _0x3c8169?{'count':_0x5713c4,'rows':_0x3c8169}:null;}})[_0xc94c('0x1f')](respondWithResult(_0x2007db,null))[_0xc94c('0x42')](handleError(_0x2007db,null));};exports[_0xc94c('0x4c')]=function(_0x85bc05,_0x388281,_0x3f8f65){var _0x4cbda8={};var _0x2f62df={};var _0x5dafde;var _0x5606a1;return db[_0xc94c('0x3e')]['findOne']({'where':{'id':_0x85bc05[_0xc94c('0x44')]['id']}})[_0xc94c('0x1f')](handleEntityNotFound(_0x388281,null))['then'](function(_0x569d78){if(_0x569d78){_0x5dafde=_0x569d78;_0x2f62df[_0xc94c('0x2b')]=_[_0xc94c('0x2e')](db['VtigerField'][_0xc94c('0x27')]);_0x2f62df['query']=_[_0xc94c('0x2e')](_0x85bc05['query']);_0x2f62df[_0xc94c('0x2f')]=_[_0xc94c('0x30')](_0x2f62df[_0xc94c('0x2b')],_0x2f62df[_0xc94c('0x2d')]);_0x4cbda8[_0xc94c('0x32')]=_[_0xc94c('0x30')](_0x2f62df[_0xc94c('0x2b')],qs['fields'](_0x85bc05[_0xc94c('0x2d')][_0xc94c('0x31')]));_0x4cbda8[_0xc94c('0x32')]=_0x4cbda8[_0xc94c('0x32')][_0xc94c('0x33')]?_0x4cbda8[_0xc94c('0x32')]:_0x2f62df[_0xc94c('0x2b')];_0x4cbda8[_0xc94c('0x36')]=qs['sort'](_0x85bc05[_0xc94c('0x2d')]['sort']);_0x4cbda8[_0xc94c('0x38')]=qs[_0xc94c('0x2f')](_[_0xc94c('0x39')](_0x85bc05['query'],_0x2f62df[_0xc94c('0x2f')]));if(_0x85bc05[_0xc94c('0x2d')]['filter']){_0x4cbda8[_0xc94c('0x38')]=_[_0xc94c('0x3b')](_0x4cbda8['where'],{'$or':_[_0xc94c('0x2c')](_0x4cbda8[_0xc94c('0x32')],function(_0x5ed8e7){var _0x313f88={};_0x313f88[_0x5ed8e7]={'$like':'%'+_0x85bc05[_0xc94c('0x2d')][_0xc94c('0x3a')]+'%'};return _0x313f88;})});}_0x4cbda8=_['merge']({},_0x4cbda8,_0x85bc05[_0xc94c('0x3d')]);return _0x5dafde[_0xc94c('0x4c')](_0x4cbda8);}})[_0xc94c('0x1f')](function(_0x4f143c){if(_0x4f143c){_0x5606a1=_0x4f143c[_0xc94c('0x33')];if(!_0x85bc05[_0xc94c('0x2d')][_0xc94c('0x34')](_0xc94c('0x35'))){_0x4cbda8['limit']=qs['limit'](_0x85bc05[_0xc94c('0x2d')][_0xc94c('0x19')]);_0x4cbda8[_0xc94c('0x17')]=qs[_0xc94c('0x17')](_0x85bc05[_0xc94c('0x2d')]['offset']);}return _0x5dafde[_0xc94c('0x4c')](_0x4cbda8);}})[_0xc94c('0x1f')](function(_0x414507){if(_0x414507){return _0x414507?{'count':_0x5606a1,'rows':_0x414507}:null;}})[_0xc94c('0x1f')](respondWithResult(_0x388281,null))[_0xc94c('0x42')](handleError(_0x388281,null));};exports['getDescriptions']=function(_0x365126,_0x56905d,_0x56bb61){var _0x1c089a={};var _0x1e4fdb={};var _0x125c65;var _0x497aec;return db[_0xc94c('0x3e')]['findOne']({'where':{'id':_0x365126[_0xc94c('0x44')]['id']}})[_0xc94c('0x1f')](handleEntityNotFound(_0x56905d,null))[_0xc94c('0x1f')](function(_0x11a8ae){if(_0x11a8ae){_0x125c65=_0x11a8ae;_0x1e4fdb[_0xc94c('0x2b')]=_[_0xc94c('0x2e')](db['VtigerField'][_0xc94c('0x27')]);_0x1e4fdb[_0xc94c('0x2d')]=_['keys'](_0x365126['query']);_0x1e4fdb[_0xc94c('0x2f')]=_[_0xc94c('0x30')](_0x1e4fdb['model'],_0x1e4fdb[_0xc94c('0x2d')]);_0x1c089a[_0xc94c('0x32')]=_['intersection'](_0x1e4fdb[_0xc94c('0x2b')],qs[_0xc94c('0x31')](_0x365126[_0xc94c('0x2d')][_0xc94c('0x31')]));_0x1c089a[_0xc94c('0x32')]=_0x1c089a[_0xc94c('0x32')][_0xc94c('0x33')]?_0x1c089a['attributes']:_0x1e4fdb[_0xc94c('0x2b')];_0x1c089a[_0xc94c('0x36')]=qs['sort'](_0x365126[_0xc94c('0x2d')]['sort']);_0x1c089a[_0xc94c('0x38')]=qs[_0xc94c('0x2f')](_[_0xc94c('0x39')](_0x365126[_0xc94c('0x2d')],_0x1e4fdb[_0xc94c('0x2f')]));if(_0x365126['query'][_0xc94c('0x3a')]){_0x1c089a['where']=_['merge'](_0x1c089a[_0xc94c('0x38')],{'$or':_['map'](_0x1c089a[_0xc94c('0x32')],function(_0xaa09a8){var _0x59f5d4={};_0x59f5d4[_0xaa09a8]={'$like':'%'+_0x365126[_0xc94c('0x2d')][_0xc94c('0x3a')]+'%'};return _0x59f5d4;})});}_0x1c089a=_[_0xc94c('0x3b')]({},_0x1c089a,_0x365126[_0xc94c('0x3d')]);return _0x125c65[_0xc94c('0x4d')](_0x1c089a);}})['then'](function(_0x1586ee){if(_0x1586ee){_0x497aec=_0x1586ee[_0xc94c('0x33')];if(!_0x365126[_0xc94c('0x2d')]['hasOwnProperty'](_0xc94c('0x35'))){_0x1c089a[_0xc94c('0x19')]=qs[_0xc94c('0x19')](_0x365126['query'][_0xc94c('0x19')]);_0x1c089a[_0xc94c('0x17')]=qs['offset'](_0x365126[_0xc94c('0x2d')][_0xc94c('0x17')]);}return _0x125c65['getDescriptions'](_0x1c089a);}})[_0xc94c('0x1f')](function(_0x5098c3){if(_0x5098c3){return _0x5098c3?{'count':_0x497aec,'rows':_0x5098c3}:null;}})[_0xc94c('0x1f')](respondWithResult(_0x56905d,null))[_0xc94c('0x42')](handleError(_0x56905d,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index e5f39eb..9cf9a31 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 _0xe73d=['bluebird','path','../../config/environment','./intVtigerConfiguration.attributes','exports','define','int_vtiger_configurations','util','../../config/logger','api','moment'];(function(_0x473da0,_0xe4dcb3){var _0x1e5f0a=function(_0x1a91c9){while(--_0x1a91c9){_0x473da0['push'](_0x473da0['shift']());}};_0x1e5f0a(++_0xe4dcb3);}(_0xe73d,0xf9));var _0xde73=function(_0xb7ecf7,_0x47dd9a){_0xb7ecf7=_0xb7ecf7-0x0;var _0x49099c=_0xe73d[_0xb7ecf7];return _0x49099c;};'use strict';var _=require('lodash');var util=require(_0xde73('0x0'));var logger=require(_0xde73('0x1'))(_0xde73('0x2'));var moment=require(_0xde73('0x3'));var BPromise=require(_0xde73('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xde73('0x5'));var rimraf=require('rimraf');var config=require(_0xde73('0x6'));var attributes=require(_0xde73('0x7'));module[_0xde73('0x8')]=function(_0x5173f8,_0x57240b){return _0x5173f8[_0xde73('0x9')]('VtigerConfiguration',attributes,{'tableName':_0xde73('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26e5=['rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x50f13d,_0x234dba){var _0x1a93d1=function(_0x60ba3c){while(--_0x60ba3c){_0x50f13d['push'](_0x50f13d['shift']());}};_0x1a93d1(++_0x234dba);}(_0x26e5,0xca));var _0x526e=function(_0x581f8e,_0x5617cb){_0x581f8e=_0x581f8e-0x0;var _0x18aec=_0x26e5[_0x581f8e];return _0x18aec;};'use strict';var _=require('lodash');var util=require(_0x526e('0x0'));var logger=require(_0x526e('0x1'))(_0x526e('0x2'));var moment=require(_0x526e('0x3'));var BPromise=require(_0x526e('0x4'));var rp=require(_0x526e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x526e('0x6'));var config=require(_0x526e('0x7'));var attributes=require(_0x526e('0x8'));module[_0x526e('0x9')]=function(_0x473477,_0x1c8438){return _0x473477[_0x526e('0xa')](_0x526e('0xb'),attributes,{'tableName':_0x526e('0xc'),'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 b3c67fe..174af3b 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 _0x1adf=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x34a17c,_0x53c082){var _0x56f06d=function(_0x2e0d7f){while(--_0x2e0d7f){_0x34a17c['push'](_0x34a17c['shift']());}};_0x56f06d(++_0x53c082);}(_0x1adf,0xe6));var _0xf1ad=function(_0x219632,_0x476c58){_0x219632=_0x219632-0x0;var _0x192b37=_0x1adf[_0x219632];return _0x192b37;};'use strict';var _=require(_0xf1ad('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf1ad('0x1'));var db=require(_0xf1ad('0x2'))['db'];var utils=require(_0xf1ad('0x3'));var logger=require(_0xf1ad('0x4'))(_0xf1ad('0x5'));var config=require(_0xf1ad('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf1ad('0x7')][_0xf1ad('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c6d51,_0xff3c41,_0x455fe3){return new BPromise(function(_0x3cec8e,_0x188a90){return client[_0xf1ad('0x9')](_0x3c6d51,_0x455fe3)[_0xf1ad('0xa')](function(_0xa8d001){logger['info'](_0xf1ad('0xb'),_0xff3c41,_0xf1ad('0xc'));logger[_0xf1ad('0xd')](_0xf1ad('0xe'),_0xff3c41,'request\x20sent',JSON[_0xf1ad('0xf')](_0xa8d001));if(_0xa8d001[_0xf1ad('0x10')]){if(_0xa8d001['error'][_0xf1ad('0x11')]===0x1f4){logger[_0xf1ad('0x10')](_0xf1ad('0xb'),_0xff3c41,_0xa8d001[_0xf1ad('0x10')][_0xf1ad('0x12')]);return _0x188a90(_0xa8d001[_0xf1ad('0x10')][_0xf1ad('0x12')]);}logger[_0xf1ad('0x10')](_0xf1ad('0xb'),_0xff3c41,_0xa8d001[_0xf1ad('0x10')][_0xf1ad('0x12')]);return _0x3cec8e(_0xa8d001[_0xf1ad('0x10')]['message']);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0xff3c41,_0xf1ad('0xc'));_0x3cec8e(_0xa8d001[_0xf1ad('0x13')]['message']);}})[_0xf1ad('0x14')](function(_0x56b6b4){logger['error'](_0xf1ad('0xb'),_0xff3c41,_0x56b6b4);_0x188a90(_0x56b6b4);});});} \ No newline at end of file +var _0x95ca=['rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x21cd8b,_0x559c39){var _0x4b1124=function(_0x321644){while(--_0x321644){_0x21cd8b['push'](_0x21cd8b['shift']());}};_0x4b1124(++_0x559c39);}(_0x95ca,0xb9));var _0xa95c=function(_0x423af4,_0x23090f){_0x423af4=_0x423af4-0x0;var _0x222628=_0x95ca[_0x423af4];return _0x222628;};'use strict';var _=require(_0xa95c('0x0'));var util=require(_0xa95c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa95c('0x2'));var fs=require('fs');var Redis=require(_0xa95c('0x3'));var db=require(_0xa95c('0x4'))['db'];var utils=require(_0xa95c('0x5'));var logger=require(_0xa95c('0x6'))(_0xa95c('0x7'));var config=require(_0xa95c('0x8'));var jayson=require(_0xa95c('0x9'));var client=jayson[_0xa95c('0xa')][_0xa95c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xdcc682,_0x4343f2,_0x50e3b4){return new BPromise(function(_0x596e15,_0x1a4757){return client[_0xa95c('0xc')](_0xdcc682,_0x50e3b4)['then'](function(_0x45a596){logger[_0xa95c('0xd')](_0xa95c('0xe'),_0x4343f2,'request\x20sent');logger[_0xa95c('0xf')](_0xa95c('0x10'),_0x4343f2,'request\x20sent',JSON[_0xa95c('0x11')](_0x45a596));if(_0x45a596[_0xa95c('0x12')]){if(_0x45a596[_0xa95c('0x12')][_0xa95c('0x13')]===0x1f4){logger[_0xa95c('0x12')](_0xa95c('0xe'),_0x4343f2,_0x45a596['error'][_0xa95c('0x14')]);return _0x1a4757(_0x45a596[_0xa95c('0x12')][_0xa95c('0x14')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x4343f2,_0x45a596[_0xa95c('0x12')][_0xa95c('0x14')]);return _0x596e15(_0x45a596[_0xa95c('0x12')][_0xa95c('0x14')]);}else{logger[_0xa95c('0xd')](_0xa95c('0xe'),_0x4343f2,_0xa95c('0x15'));_0x596e15(_0x45a596[_0xa95c('0x16')][_0xa95c('0x14')]);}})[_0xa95c('0x17')](function(_0x481e7c){logger[_0xa95c('0x12')](_0xa95c('0xe'),_0x4343f2,_0x481e7c);_0x1a4757(_0x481e7c);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 0fa8f13..8da74ee 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 _0x4738=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5bb50d,_0x34c934){var _0x3714fe=function(_0x193609){while(--_0x193609){_0x5bb50d['push'](_0x5bb50d['shift']());}};_0x3714fe(++_0x34c934);}(_0x4738,0xd8));var _0x8473=function(_0x4adac1,_0x2fba43){_0x4adac1=_0x4adac1-0x0;var _0x5155ae=_0x4738[_0x4adac1];return _0x5155ae;};'use strict';var multer=require(_0x8473('0x0'));var util=require(_0x8473('0x1'));var path=require(_0x8473('0x2'));var timeout=require(_0x8473('0x3'));var express=require('express');var router=express[_0x8473('0x4')]();var fs_extra=require(_0x8473('0x5'));var auth=require(_0x8473('0x6'));var interaction=require(_0x8473('0x7'));var config=require(_0x8473('0x8'));var controller=require(_0x8473('0x9'));router[_0x8473('0xa')]('/',auth[_0x8473('0xb')](),controller[_0x8473('0xc')]);router[_0x8473('0xa')](_0x8473('0xd'),auth[_0x8473('0xb')](),controller[_0x8473('0xe')]);router[_0x8473('0xf')]('/',auth['isAuthenticated'](),controller[_0x8473('0x10')]);router[_0x8473('0x11')](_0x8473('0xd'),auth[_0x8473('0xb')](),controller[_0x8473('0x12')]);router[_0x8473('0x13')](_0x8473('0xd'),auth[_0x8473('0xb')](),controller[_0x8473('0x14')]);module[_0x8473('0x15')]=router; \ No newline at end of file +var _0x2c2d=['isAuthenticated','show','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','./intVtigerField.controller','get'];(function(_0x5e734d,_0x104071){var _0xeae2eb=function(_0x1b01b7){while(--_0x1b01b7){_0x5e734d['push'](_0x5e734d['shift']());}};_0xeae2eb(++_0x104071);}(_0x2c2d,0x1c8));var _0xd2c2=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x2c2d[_0x2261ce];return _0x524640;};'use strict';var multer=require(_0xd2c2('0x0'));var util=require(_0xd2c2('0x1'));var path=require(_0xd2c2('0x2'));var timeout=require(_0xd2c2('0x3'));var express=require('express');var router=express[_0xd2c2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd2c2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd2c2('0x6'));router[_0xd2c2('0x7')]('/',auth[_0xd2c2('0x8')](),controller['index']);router[_0xd2c2('0x7')]('/:id',auth[_0xd2c2('0x8')](),controller[_0xd2c2('0x9')]);router['post']('/',auth[_0xd2c2('0x8')](),controller[_0xd2c2('0xa')]);router[_0xd2c2('0xb')](_0xd2c2('0xc'),auth[_0xd2c2('0x8')](),controller[_0xd2c2('0xd')]);router[_0xd2c2('0xe')](_0xd2c2('0xc'),auth[_0xd2c2('0x8')](),controller[_0xd2c2('0xf')]);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 baa68c7..d7ade92 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 _0x618e=['customVariable','keyValue','string','STRING','sequelize','exports','ENUM','variable'];(function(_0x24159c,_0x50c47b){var _0x55b30f=function(_0x195ae7){while(--_0x195ae7){_0x24159c['push'](_0x24159c['shift']());}};_0x55b30f(++_0x50c47b);}(_0x618e,0x174));var _0xe618=function(_0x20dc31,_0x5d3146){_0x20dc31=_0x20dc31-0x0;var _0x536e02=_0x618e[_0x20dc31];return _0x536e02;};'use strict';var Sequelize=require(_0xe618('0x0'));module[_0xe618('0x1')]={'type':{'type':Sequelize[_0xe618('0x2')]('string',_0xe618('0x3'),_0xe618('0x4'),_0xe618('0x5'),'picklist'),'defaultValue':_0xe618('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xe618('0x7')]},'keyType':{'type':Sequelize[_0xe618('0x2')](_0xe618('0x6'),'variable',_0xe618('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe618('0x7')]},'nameField':{'type':Sequelize[_0xe618('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd8d1=['string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM'];(function(_0xb9bf2c,_0xb7e799){var _0x187411=function(_0x11a5af){while(--_0x11a5af){_0xb9bf2c['push'](_0xb9bf2c['shift']());}};_0x187411(++_0xb7e799);}(_0xd8d1,0x13d));var _0x1d8d=function(_0x1dc969,_0x588676){_0x1dc969=_0x1dc969-0x0;var _0x2095f4=_0xd8d1[_0x1dc969];return _0x2095f4;};'use strict';var Sequelize=require(_0x1d8d('0x0'));module[_0x1d8d('0x1')]={'type':{'type':Sequelize[_0x1d8d('0x2')](_0x1d8d('0x3'),'variable',_0x1d8d('0x4'),_0x1d8d('0x5'),_0x1d8d('0x6')),'defaultValue':_0x1d8d('0x3')},'content':{'type':Sequelize[_0x1d8d('0x7')]},'key':{'type':Sequelize[_0x1d8d('0x7')]},'keyType':{'type':Sequelize[_0x1d8d('0x2')](_0x1d8d('0x3'),_0x1d8d('0x8'),_0x1d8d('0x4'))},'keyContent':{'type':Sequelize[_0x1d8d('0x7')]},'idField':{'type':Sequelize[_0x1d8d('0x7')]},'nameField':{'type':Sequelize[_0x1d8d('0x7')]},'customField':{'type':Sequelize[_0x1d8d('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1d8d('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index aa74841..3786aaa 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 _0xd707=['includeAll','include','findAll','rows','catch','show','params','attributes','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','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','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0xb8ce15,_0x3f4c3f){var _0x34eccb=function(_0x5f51a7){while(--_0x5f51a7){_0xb8ce15['push'](_0xb8ce15['shift']());}};_0x34eccb(++_0x3f4c3f);}(_0xd707,0x14b));var _0x7d70=function(_0x12d2be,_0x1076ef){_0x12d2be=_0x12d2be-0x0;var _0x526fcb=_0xd707[_0x12d2be];return _0x526fcb;};'use strict';var emlformat=require(_0x7d70('0x0'));var rimraf=require(_0x7d70('0x1'));var zipdir=require(_0x7d70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7d70('0x3'));var moment=require(_0x7d70('0x4'));var BPromise=require(_0x7d70('0x5'));var Mustache=require(_0x7d70('0x6'));var util=require(_0x7d70('0x7'));var path=require(_0x7d70('0x8'));var sox=require(_0x7d70('0x9'));var csv=require(_0x7d70('0xa'));var ejs=require(_0x7d70('0xb'));var fs=require('fs');var fs_extra=require(_0x7d70('0xc'));var _=require(_0x7d70('0xd'));var squel=require(_0x7d70('0xe'));var crypto=require(_0x7d70('0xf'));var jsforce=require(_0x7d70('0x10'));var deskjs=require(_0x7d70('0x11'));var toCsv=require(_0x7d70('0xa'));var querystring=require(_0x7d70('0x12'));var Papa=require('papaparse');var Redis=require(_0x7d70('0x13'));var authService=require(_0x7d70('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7d70('0x15'));var hardwareService=require(_0x7d70('0x16'));var logger=require(_0x7d70('0x17'))(_0x7d70('0x18'));var utils=require('../../config/utils');var config=require(_0x7d70('0x19'));var licenseUtil=require(_0x7d70('0x1a'));var db=require(_0x7d70('0x1b'))['db'];function respondWithStatusCode(_0x1c728a,_0x4562d9){_0x4562d9=_0x4562d9||0xcc;return function(_0x2847d2){if(_0x2847d2){return _0x1c728a[_0x7d70('0x1c')](_0x4562d9);}return _0x1c728a['status'](_0x4562d9)['end']();};}function respondWithResult(_0x27ede2,_0x3c7731){_0x3c7731=_0x3c7731||0xc8;return function(_0x320c1a){if(_0x320c1a){return _0x27ede2['status'](_0x3c7731)[_0x7d70('0x1d')](_0x320c1a);}};}function respondWithFilteredResult(_0x1ff66c,_0x54d35e){return function(_0x4ed87f){if(_0x4ed87f){var _0x152d44=typeof _0x54d35e[_0x7d70('0x1e')]===_0x7d70('0x1f')&&typeof _0x54d35e[_0x7d70('0x20')]===_0x7d70('0x1f');var _0x18a705=_0x4ed87f[_0x7d70('0x21')];var _0x3caa8a=_0x152d44?0x0:_0x54d35e[_0x7d70('0x1e')];var _0x524026=_0x152d44?_0x4ed87f[_0x7d70('0x21')]:_0x54d35e['offset']+_0x54d35e[_0x7d70('0x20')];var _0x16e9e2;if(_0x524026>=_0x18a705){_0x524026=_0x18a705;_0x16e9e2=0xc8;}else{_0x16e9e2=0xce;}_0x1ff66c[_0x7d70('0x22')](_0x16e9e2);return _0x1ff66c[_0x7d70('0x23')](_0x7d70('0x24'),_0x3caa8a+'-'+_0x524026+'/'+_0x18a705)['json'](_0x4ed87f);}return null;};}function patchUpdates(_0x22873f){return function(_0x1faec4){try{jsonpatch[_0x7d70('0x25')](_0x1faec4,_0x22873f,!![]);}catch(_0x1d3720){return BPromise[_0x7d70('0x26')](_0x1d3720);}return _0x1faec4[_0x7d70('0x27')]();};}function saveUpdates(_0x7b2352,_0x3f5dcc){return function(_0x436d58){if(_0x436d58){return _0x436d58[_0x7d70('0x28')](_0x7b2352)[_0x7d70('0x29')](function(_0x2b4555){return _0x2b4555;});}return null;};}function removeEntity(_0x25998d,_0x1a834d){return function(_0x381084){if(_0x381084){return _0x381084[_0x7d70('0x2a')]()[_0x7d70('0x29')](function(){_0x25998d['status'](0xcc)[_0x7d70('0x2b')]();});}};}function handleEntityNotFound(_0x49f361,_0x15cfea){return function(_0x4d03a5){if(!_0x4d03a5){_0x49f361['sendStatus'](0x194);}return _0x4d03a5;};}function handleError(_0x3532cd,_0x2c99c7){_0x2c99c7=_0x2c99c7||0x1f4;return function(_0x1751b4){logger[_0x7d70('0x2c')](_0x1751b4['stack']);if(_0x1751b4[_0x7d70('0x2d')]){delete _0x1751b4[_0x7d70('0x2d')];}_0x3532cd[_0x7d70('0x22')](_0x2c99c7)['send'](_0x1751b4);};}exports[_0x7d70('0x2e')]=function(_0x381aec,_0x164e6a){var _0x544807={},_0x973943={},_0x17a520={'count':0x0,'rows':[]};var _0x3f642b=_[_0x7d70('0x2f')](db[_0x7d70('0x30')][_0x7d70('0x31')],function(_0x26af83){return{'name':_0x26af83[_0x7d70('0x32')],'type':_0x26af83[_0x7d70('0x33')][_0x7d70('0x34')]};});_0x973943[_0x7d70('0x35')]=_[_0x7d70('0x2f')](_0x3f642b,_0x7d70('0x2d'));_0x973943[_0x7d70('0x36')]=_[_0x7d70('0x37')](_0x381aec['query']);_0x973943[_0x7d70('0x38')]=_['intersection'](_0x973943[_0x7d70('0x35')],_0x973943[_0x7d70('0x36')]);_0x544807['attributes']=_[_0x7d70('0x39')](_0x973943[_0x7d70('0x35')],qs[_0x7d70('0x3a')](_0x381aec[_0x7d70('0x36')][_0x7d70('0x3a')]));_0x544807['attributes']=_0x544807['attributes'][_0x7d70('0x3b')]?_0x544807['attributes']:_0x973943['model'];if(!_0x381aec[_0x7d70('0x36')][_0x7d70('0x3c')]('nolimit')){_0x544807[_0x7d70('0x20')]=qs[_0x7d70('0x20')](_0x381aec[_0x7d70('0x36')][_0x7d70('0x20')]);_0x544807[_0x7d70('0x1e')]=qs[_0x7d70('0x1e')](_0x381aec[_0x7d70('0x36')][_0x7d70('0x1e')]);}_0x544807[_0x7d70('0x3d')]=qs[_0x7d70('0x3e')](_0x381aec[_0x7d70('0x36')][_0x7d70('0x3e')]);_0x544807[_0x7d70('0x3f')]=qs['filters'](_[_0x7d70('0x40')](_0x381aec[_0x7d70('0x36')],_0x973943[_0x7d70('0x38')]),_0x3f642b);if(_0x381aec[_0x7d70('0x36')][_0x7d70('0x41')]){_0x544807[_0x7d70('0x3f')]=_[_0x7d70('0x42')](_0x544807[_0x7d70('0x3f')],{'$or':_['map'](_0x3f642b,function(_0x32ebfa){if(_0x32ebfa[_0x7d70('0x33')]!==_0x7d70('0x43')){var _0x4eb46e={};_0x4eb46e[_0x32ebfa[_0x7d70('0x2d')]]={'$like':'%'+_0x381aec[_0x7d70('0x36')][_0x7d70('0x41')]+'%'};return _0x4eb46e;}})});}_0x544807=_['merge']({},_0x544807,_0x381aec[_0x7d70('0x44')]);var _0x683dfe={'where':_0x544807[_0x7d70('0x3f')]};return db[_0x7d70('0x30')][_0x7d70('0x21')](_0x683dfe)['then'](function(_0x359dd5){_0x17a520[_0x7d70('0x21')]=_0x359dd5;if(_0x381aec[_0x7d70('0x36')][_0x7d70('0x45')]){_0x544807[_0x7d70('0x46')]=[{'all':!![]}];}return db[_0x7d70('0x30')][_0x7d70('0x47')](_0x544807);})['then'](function(_0x33c3b0){_0x17a520[_0x7d70('0x48')]=_0x33c3b0;return _0x17a520;})['then'](respondWithFilteredResult(_0x164e6a,_0x544807))[_0x7d70('0x49')](handleError(_0x164e6a,null));};exports[_0x7d70('0x4a')]=function(_0x11a946,_0x3e8c1a){var _0x5f243f={'raw':!![],'where':{'id':_0x11a946[_0x7d70('0x4b')]['id']}},_0x5199a2={};_0x5199a2[_0x7d70('0x35')]=_[_0x7d70('0x37')](db['VtigerField']['rawAttributes']);_0x5199a2['query']=_[_0x7d70('0x37')](_0x11a946['query']);_0x5199a2[_0x7d70('0x38')]=_['intersection'](_0x5199a2[_0x7d70('0x35')],_0x5199a2['query']);_0x5f243f[_0x7d70('0x4c')]=_['intersection'](_0x5199a2[_0x7d70('0x35')],qs[_0x7d70('0x3a')](_0x11a946['query'][_0x7d70('0x3a')]));_0x5f243f[_0x7d70('0x4c')]=_0x5f243f['attributes'][_0x7d70('0x3b')]?_0x5f243f[_0x7d70('0x4c')]:_0x5199a2[_0x7d70('0x35')];if(_0x11a946[_0x7d70('0x36')]['includeAll']){_0x5f243f[_0x7d70('0x46')]=[{'all':!![]}];}_0x5f243f=_['merge']({},_0x5f243f,_0x11a946[_0x7d70('0x44')]);return db[_0x7d70('0x30')][_0x7d70('0x4d')](_0x5f243f)[_0x7d70('0x29')](handleEntityNotFound(_0x3e8c1a,null))[_0x7d70('0x29')](respondWithResult(_0x3e8c1a,null))['catch'](handleError(_0x3e8c1a,null));};exports[_0x7d70('0x4e')]=function(_0x4f48f1,_0x5adf70){return db[_0x7d70('0x30')]['create'](_0x4f48f1[_0x7d70('0x4f')],{})[_0x7d70('0x29')](respondWithResult(_0x5adf70,0xc9))[_0x7d70('0x49')](handleError(_0x5adf70,null));};exports[_0x7d70('0x28')]=function(_0x3b73d6,_0x3addc2){if(_0x3b73d6['body']['id']){delete _0x3b73d6[_0x7d70('0x4f')]['id'];}return db[_0x7d70('0x30')][_0x7d70('0x4d')]({'where':{'id':_0x3b73d6[_0x7d70('0x4b')]['id']}})[_0x7d70('0x29')](handleEntityNotFound(_0x3addc2,null))[_0x7d70('0x29')](saveUpdates(_0x3b73d6['body'],null))['then'](respondWithResult(_0x3addc2,null))[_0x7d70('0x49')](handleError(_0x3addc2,null));};exports[_0x7d70('0x2a')]=function(_0xd92047,_0x1ce65b){return db[_0x7d70('0x30')][_0x7d70('0x4d')]({'where':{'id':_0xd92047[_0x7d70('0x4b')]['id']}})[_0x7d70('0x29')](handleEntityNotFound(_0x1ce65b,null))[_0x7d70('0x29')](removeEntity(_0x1ce65b,null))[_0x7d70('0x49')](handleError(_0x1ce65b,null));}; \ No newline at end of file +var _0x82ca=['count','apply','reject','save','then','destroy','error','stack','name','send','index','map','VtigerField','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x6d394d,_0x185b80){var _0x1f0621=function(_0x2e5c81){while(--_0x2e5c81){_0x6d394d['push'](_0x6d394d['shift']());}};_0x1f0621(++_0x185b80);}(_0x82ca,0x152));var _0xa82c=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x82ca[_0x2160a9];return _0xa88cf7;};'use strict';var emlformat=require(_0xa82c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa82c('0x1'));var jsonpatch=require(_0xa82c('0x2'));var rp=require(_0xa82c('0x3'));var moment=require(_0xa82c('0x4'));var BPromise=require(_0xa82c('0x5'));var Mustache=require(_0xa82c('0x6'));var util=require(_0xa82c('0x7'));var path=require(_0xa82c('0x8'));var sox=require(_0xa82c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa82c('0xa'));var _=require(_0xa82c('0xb'));var squel=require('squel');var crypto=require(_0xa82c('0xc'));var jsforce=require(_0xa82c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa82c('0xe'));var querystring=require('querystring');var Papa=require(_0xa82c('0xf'));var Redis=require(_0xa82c('0x10'));var authService=require(_0xa82c('0x11'));var qs=require(_0xa82c('0x12'));var as=require(_0xa82c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa82c('0x14'))(_0xa82c('0x15'));var utils=require('../../config/utils');var config=require(_0xa82c('0x16'));var licenseUtil=require(_0xa82c('0x17'));var db=require(_0xa82c('0x18'))['db'];function respondWithStatusCode(_0x434958,_0x9e9119){_0x9e9119=_0x9e9119||0xcc;return function(_0x3e549f){if(_0x3e549f){return _0x434958[_0xa82c('0x19')](_0x9e9119);}return _0x434958[_0xa82c('0x1a')](_0x9e9119)[_0xa82c('0x1b')]();};}function respondWithResult(_0x87b9cb,_0x19244e){_0x19244e=_0x19244e||0xc8;return function(_0x117488){if(_0x117488){return _0x87b9cb['status'](_0x19244e)[_0xa82c('0x1c')](_0x117488);}};}function respondWithFilteredResult(_0x5eaa1d,_0x3d01c3){return function(_0x2ae380){if(_0x2ae380){var _0x2ac08e=typeof _0x3d01c3[_0xa82c('0x1d')]===_0xa82c('0x1e')&&typeof _0x3d01c3[_0xa82c('0x1f')]===_0xa82c('0x1e');var _0x3d71a4=_0x2ae380[_0xa82c('0x20')];var _0x3e8e42=_0x2ac08e?0x0:_0x3d01c3['offset'];var _0x2a97be=_0x2ac08e?_0x2ae380['count']:_0x3d01c3['offset']+_0x3d01c3[_0xa82c('0x1f')];var _0x5853ef;if(_0x2a97be>=_0x3d71a4){_0x2a97be=_0x3d71a4;_0x5853ef=0xc8;}else{_0x5853ef=0xce;}_0x5eaa1d['status'](_0x5853ef);return _0x5eaa1d['set']('Content-Range',_0x3e8e42+'-'+_0x2a97be+'/'+_0x3d71a4)[_0xa82c('0x1c')](_0x2ae380);}return null;};}function patchUpdates(_0x3f5e80){return function(_0x205fc2){try{jsonpatch[_0xa82c('0x21')](_0x205fc2,_0x3f5e80,!![]);}catch(_0x12f655){return BPromise[_0xa82c('0x22')](_0x12f655);}return _0x205fc2[_0xa82c('0x23')]();};}function saveUpdates(_0x2895a8,_0x5d04b6){return function(_0xae0b58){if(_0xae0b58){return _0xae0b58['update'](_0x2895a8)[_0xa82c('0x24')](function(_0x31566d){return _0x31566d;});}return null;};}function removeEntity(_0x2da425,_0x5770f9){return function(_0x5ab4f8){if(_0x5ab4f8){return _0x5ab4f8[_0xa82c('0x25')]()['then'](function(){_0x2da425[_0xa82c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8fd47,_0x4dfead){return function(_0x4f747b){if(!_0x4f747b){_0xe8fd47[_0xa82c('0x19')](0x194);}return _0x4f747b;};}function handleError(_0x3750ed,_0x1ab5d2){_0x1ab5d2=_0x1ab5d2||0x1f4;return function(_0xd2fd67){logger[_0xa82c('0x26')](_0xd2fd67[_0xa82c('0x27')]);if(_0xd2fd67[_0xa82c('0x28')]){delete _0xd2fd67['name'];}_0x3750ed[_0xa82c('0x1a')](_0x1ab5d2)[_0xa82c('0x29')](_0xd2fd67);};}exports[_0xa82c('0x2a')]=function(_0x2a2c60,_0xd59cc8){var _0x52575f={},_0x5baed0={},_0x3912fc={'count':0x0,'rows':[]};var _0x3e24ca=_[_0xa82c('0x2b')](db[_0xa82c('0x2c')]['rawAttributes'],function(_0xfc323d){return{'name':_0xfc323d['fieldName'],'type':_0xfc323d[_0xa82c('0x2d')][_0xa82c('0x2e')]};});_0x5baed0[_0xa82c('0x2f')]=_[_0xa82c('0x2b')](_0x3e24ca,_0xa82c('0x28'));_0x5baed0[_0xa82c('0x30')]=_[_0xa82c('0x31')](_0x2a2c60[_0xa82c('0x30')]);_0x5baed0[_0xa82c('0x32')]=_[_0xa82c('0x33')](_0x5baed0['model'],_0x5baed0['query']);_0x52575f[_0xa82c('0x34')]=_[_0xa82c('0x33')](_0x5baed0[_0xa82c('0x2f')],qs[_0xa82c('0x35')](_0x2a2c60[_0xa82c('0x30')][_0xa82c('0x35')]));_0x52575f[_0xa82c('0x34')]=_0x52575f[_0xa82c('0x34')][_0xa82c('0x36')]?_0x52575f[_0xa82c('0x34')]:_0x5baed0[_0xa82c('0x2f')];if(!_0x2a2c60[_0xa82c('0x30')][_0xa82c('0x37')]('nolimit')){_0x52575f[_0xa82c('0x1f')]=qs[_0xa82c('0x1f')](_0x2a2c60[_0xa82c('0x30')]['limit']);_0x52575f[_0xa82c('0x1d')]=qs[_0xa82c('0x1d')](_0x2a2c60[_0xa82c('0x30')][_0xa82c('0x1d')]);}_0x52575f[_0xa82c('0x38')]=qs['sort'](_0x2a2c60[_0xa82c('0x30')][_0xa82c('0x39')]);_0x52575f[_0xa82c('0x3a')]=qs[_0xa82c('0x32')](_[_0xa82c('0x3b')](_0x2a2c60[_0xa82c('0x30')],_0x5baed0[_0xa82c('0x32')]),_0x3e24ca);if(_0x2a2c60[_0xa82c('0x30')]['filter']){_0x52575f[_0xa82c('0x3a')]=_[_0xa82c('0x3c')](_0x52575f[_0xa82c('0x3a')],{'$or':_[_0xa82c('0x2b')](_0x3e24ca,function(_0x1a6762){if(_0x1a6762['type']!==_0xa82c('0x3d')){var _0x11eff7={};_0x11eff7[_0x1a6762[_0xa82c('0x28')]]={'$like':'%'+_0x2a2c60[_0xa82c('0x30')]['filter']+'%'};return _0x11eff7;}})});}_0x52575f=_[_0xa82c('0x3c')]({},_0x52575f,_0x2a2c60[_0xa82c('0x3e')]);var _0x50394c={'where':_0x52575f[_0xa82c('0x3a')]};return db[_0xa82c('0x2c')][_0xa82c('0x20')](_0x50394c)[_0xa82c('0x24')](function(_0xaaf552){_0x3912fc['count']=_0xaaf552;if(_0x2a2c60[_0xa82c('0x30')]['includeAll']){_0x52575f[_0xa82c('0x3f')]=[{'all':!![]}];}return db[_0xa82c('0x2c')][_0xa82c('0x40')](_0x52575f);})[_0xa82c('0x24')](function(_0x22531a){_0x3912fc[_0xa82c('0x41')]=_0x22531a;return _0x3912fc;})[_0xa82c('0x24')](respondWithFilteredResult(_0xd59cc8,_0x52575f))[_0xa82c('0x42')](handleError(_0xd59cc8,null));};exports[_0xa82c('0x43')]=function(_0x30f826,_0x4e30f4){var _0x30c912={'raw':!![],'where':{'id':_0x30f826[_0xa82c('0x44')]['id']}},_0x6bfe39={};_0x6bfe39[_0xa82c('0x2f')]=_[_0xa82c('0x31')](db[_0xa82c('0x2c')][_0xa82c('0x45')]);_0x6bfe39[_0xa82c('0x30')]=_[_0xa82c('0x31')](_0x30f826[_0xa82c('0x30')]);_0x6bfe39[_0xa82c('0x32')]=_['intersection'](_0x6bfe39[_0xa82c('0x2f')],_0x6bfe39[_0xa82c('0x30')]);_0x30c912['attributes']=_[_0xa82c('0x33')](_0x6bfe39[_0xa82c('0x2f')],qs[_0xa82c('0x35')](_0x30f826['query']['fields']));_0x30c912[_0xa82c('0x34')]=_0x30c912[_0xa82c('0x34')][_0xa82c('0x36')]?_0x30c912[_0xa82c('0x34')]:_0x6bfe39[_0xa82c('0x2f')];if(_0x30f826[_0xa82c('0x30')][_0xa82c('0x46')]){_0x30c912[_0xa82c('0x3f')]=[{'all':!![]}];}_0x30c912=_[_0xa82c('0x3c')]({},_0x30c912,_0x30f826[_0xa82c('0x3e')]);return db[_0xa82c('0x2c')][_0xa82c('0x47')](_0x30c912)[_0xa82c('0x24')](handleEntityNotFound(_0x4e30f4,null))[_0xa82c('0x24')](respondWithResult(_0x4e30f4,null))['catch'](handleError(_0x4e30f4,null));};exports['create']=function(_0x325bbc,_0x391611){return db[_0xa82c('0x2c')][_0xa82c('0x48')](_0x325bbc['body'],{})[_0xa82c('0x24')](respondWithResult(_0x391611,0xc9))[_0xa82c('0x42')](handleError(_0x391611,null));};exports['update']=function(_0x27c0f4,_0xbaa280){if(_0x27c0f4[_0xa82c('0x49')]['id']){delete _0x27c0f4[_0xa82c('0x49')]['id'];}return db[_0xa82c('0x2c')]['find']({'where':{'id':_0x27c0f4[_0xa82c('0x44')]['id']}})[_0xa82c('0x24')](handleEntityNotFound(_0xbaa280,null))[_0xa82c('0x24')](saveUpdates(_0x27c0f4[_0xa82c('0x49')],null))[_0xa82c('0x24')](respondWithResult(_0xbaa280,null))[_0xa82c('0x42')](handleError(_0xbaa280,null));};exports['destroy']=function(_0xdbafbf,_0x509e5d){return db['VtigerField']['find']({'where':{'id':_0xdbafbf[_0xa82c('0x44')]['id']}})[_0xa82c('0x24')](handleEntityNotFound(_0x509e5d,null))['then'](removeEntity(_0x509e5d,null))[_0xa82c('0x42')](handleError(_0x509e5d,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 6467810..e65b8ba 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 _0x150b=['api','bluebird','request-promise','path','rimraf','../../config/environment','VtigerField','int_vtiger_fields','vtiger_unique_index','FieldId','lodash','util','../../config/logger'];(function(_0x43b08,_0x15f967){var _0x5e05f4=function(_0x4bb0cb){while(--_0x4bb0cb){_0x43b08['push'](_0x43b08['shift']());}};_0x5e05f4(++_0x15f967);}(_0x150b,0x169));var _0xb150=function(_0x7ff50b,_0x399dc0){_0x7ff50b=_0x7ff50b-0x0;var _0x43e570=_0x150b[_0x7ff50b];return _0x43e570;};'use strict';var _=require(_0xb150('0x0'));var util=require(_0xb150('0x1'));var logger=require(_0xb150('0x2'))(_0xb150('0x3'));var moment=require('moment');var BPromise=require(_0xb150('0x4'));var rp=require(_0xb150('0x5'));var fs=require('fs');var path=require(_0xb150('0x6'));var rimraf=require(_0xb150('0x7'));var config=require(_0xb150('0x8'));var attributes=require('./intVtigerField.attributes');module['exports']=function(_0x47ee71,_0x5da2a1){return _0x47ee71['define'](_0xb150('0x9'),attributes,{'tableName':_0xb150('0xa'),'paranoid':![],'indexes':[{'name':_0xb150('0xb'),'fields':['idField',_0xb150('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5433=['path','rimraf','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','FieldId','lodash','util','api','moment'];(function(_0x2b8806,_0x84bb25){var _0x3032a6=function(_0x2df98e){while(--_0x2df98e){_0x2b8806['push'](_0x2b8806['shift']());}};_0x3032a6(++_0x84bb25);}(_0x5433,0x104));var _0x3543=function(_0x3d80af,_0x491283){_0x3d80af=_0x3d80af-0x0;var _0x1865fc=_0x5433[_0x3d80af];return _0x1865fc;};'use strict';var _=require(_0x3543('0x0'));var util=require(_0x3543('0x1'));var logger=require('../../config/logger')(_0x3543('0x2'));var moment=require(_0x3543('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3543('0x4'));var rimraf=require(_0x3543('0x5'));var config=require('../../config/environment');var attributes=require('./intVtigerField.attributes');module[_0x3543('0x6')]=function(_0x80fc7a,_0x11ead7){return _0x80fc7a[_0x3543('0x7')](_0x3543('0x8'),attributes,{'tableName':_0x3543('0x9'),'paranoid':![],'indexes':[{'name':_0x3543('0xa'),'fields':['idField',_0x3543('0xb')],'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 23f05f5..164310d 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 _0xc3fc=['error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5b4df0,_0x119142){var _0x79cfd7=function(_0x514042){while(--_0x514042){_0x5b4df0['push'](_0x5b4df0['shift']());}};_0x79cfd7(++_0x119142);}(_0xc3fc,0x1cf));var _0xcc3f=function(_0x54d261,_0x2bf9dd){_0x54d261=_0x54d261-0x0;var _0x1d646d=_0xc3fc[_0x54d261];return _0x1d646d;};'use strict';var _=require(_0xcc3f('0x0'));var util=require(_0xcc3f('0x1'));var moment=require(_0xcc3f('0x2'));var BPromise=require(_0xcc3f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc3f('0x4'));var db=require(_0xcc3f('0x5'))['db'];var utils=require(_0xcc3f('0x6'));var logger=require(_0xcc3f('0x7'))(_0xcc3f('0x8'));var config=require(_0xcc3f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcc3f('0xa')][_0xcc3f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8d0d70,_0x3910d9,_0x455a7b){return new BPromise(function(_0x1dc868,_0x5d9814){return client[_0xcc3f('0xc')](_0x8d0d70,_0x455a7b)[_0xcc3f('0xd')](function(_0x315dcb){logger[_0xcc3f('0xe')](_0xcc3f('0xf'),_0x3910d9,_0xcc3f('0x10'));logger[_0xcc3f('0x11')](_0xcc3f('0x12'),_0x3910d9,_0xcc3f('0x10'),JSON[_0xcc3f('0x13')](_0x315dcb));if(_0x315dcb[_0xcc3f('0x14')]){if(_0x315dcb[_0xcc3f('0x14')]['code']===0x1f4){logger[_0xcc3f('0x14')](_0xcc3f('0xf'),_0x3910d9,_0x315dcb['error']['message']);return _0x5d9814(_0x315dcb['error']['message']);}logger[_0xcc3f('0x14')](_0xcc3f('0xf'),_0x3910d9,_0x315dcb['error'][_0xcc3f('0x15')]);return _0x1dc868(_0x315dcb[_0xcc3f('0x14')][_0xcc3f('0x15')]);}else{logger[_0xcc3f('0xe')](_0xcc3f('0xf'),_0x3910d9,_0xcc3f('0x10'));_0x1dc868(_0x315dcb[_0xcc3f('0x16')][_0xcc3f('0x15')]);}})['catch'](function(_0x2076d5){logger[_0xcc3f('0x14')](_0xcc3f('0xf'),_0x3910d9,_0x2076d5);_0x5d9814(_0x2076d5);});});} \ No newline at end of file +var _0xde2a=['VtigerField,\x20%s,\x20%s','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x429948,_0x1a6851){var _0x35d5d1=function(_0x574853){while(--_0x574853){_0x429948['push'](_0x429948['shift']());}};_0x35d5d1(++_0x1a6851);}(_0xde2a,0x161));var _0xade2=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0xde2a[_0x51c819];return _0x15c5d2;};'use strict';var _=require(_0xade2('0x0'));var util=require('util');var moment=require(_0xade2('0x1'));var BPromise=require('bluebird');var rs=require(_0xade2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xade2('0x3'))['db'];var utils=require(_0xade2('0x4'));var logger=require(_0xade2('0x5'))(_0xade2('0x6'));var config=require(_0xade2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xade2('0x8')][_0xade2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x179046,_0x2d0b0b,_0x2aeb84){return new BPromise(function(_0x534fc5,_0x53e8b8){return client[_0xade2('0xa')](_0x179046,_0x2aeb84)[_0xade2('0xb')](function(_0x49a1ef){logger[_0xade2('0xc')]('VtigerField,\x20%s,\x20%s',_0x2d0b0b,_0xade2('0xd'));logger['debug'](_0xade2('0xe'),_0x2d0b0b,'request\x20sent',JSON[_0xade2('0xf')](_0x49a1ef));if(_0x49a1ef[_0xade2('0x10')]){if(_0x49a1ef[_0xade2('0x10')][_0xade2('0x11')]===0x1f4){logger[_0xade2('0x10')]('VtigerField,\x20%s,\x20%s',_0x2d0b0b,_0x49a1ef[_0xade2('0x10')][_0xade2('0x12')]);return _0x53e8b8(_0x49a1ef['error'][_0xade2('0x12')]);}logger[_0xade2('0x10')]('VtigerField,\x20%s,\x20%s',_0x2d0b0b,_0x49a1ef[_0xade2('0x10')][_0xade2('0x12')]);return _0x534fc5(_0x49a1ef[_0xade2('0x10')][_0xade2('0x12')]);}else{logger[_0xade2('0xc')]('VtigerField,\x20%s,\x20%s',_0x2d0b0b,'request\x20sent');_0x534fc5(_0x49a1ef[_0xade2('0x13')][_0xade2('0x12')]);}})[_0xade2('0x14')](function(_0x1cb07c){logger[_0xade2('0x10')](_0xade2('0x15'),_0x2d0b0b,_0x1cb07c);_0x53e8b8(_0x1cb07c);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 24df8c3..0ba4524 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 _0x01f7=['/:id/fields','post','create','addConfiguration','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','/:id/configurations','getConfigurations'];(function(_0x120a99,_0x29e4ca){var _0x1a5701=function(_0x1b2b37){while(--_0x1b2b37){_0x120a99['push'](_0x120a99['shift']());}};_0x1a5701(++_0x29e4ca);}(_0x01f7,0x13a));var _0x701f=function(_0x2377e3,_0x2c0352){_0x2377e3=_0x2377e3-0x0;var _0x2a6d1b=_0x01f7[_0x2377e3];return _0x2a6d1b;};'use strict';var multer=require(_0x701f('0x0'));var util=require(_0x701f('0x1'));var path=require(_0x701f('0x2'));var timeout=require(_0x701f('0x3'));var express=require(_0x701f('0x4'));var router=express[_0x701f('0x5')]();var fs_extra=require(_0x701f('0x6'));var auth=require(_0x701f('0x7'));var interaction=require(_0x701f('0x8'));var config=require(_0x701f('0x9'));var controller=require('./intZendeskAccount.controller');router['get']('/',auth[_0x701f('0xa')](),controller['index']);router[_0x701f('0xb')](_0x701f('0xc'),auth[_0x701f('0xa')](),controller[_0x701f('0xd')]);router[_0x701f('0xb')](_0x701f('0xe'),auth['isAuthenticated'](),controller[_0x701f('0xf')]);router[_0x701f('0xb')](_0x701f('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0x701f('0x11')]('/',auth['isAuthenticated'](),controller[_0x701f('0x12')]);router[_0x701f('0x11')](_0x701f('0xe'),auth[_0x701f('0xa')](),controller[_0x701f('0x13')]);router[_0x701f('0x14')]('/:id',auth[_0x701f('0xa')](),controller['update']);router[_0x701f('0x15')](_0x701f('0xc'),auth[_0x701f('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xeff8=['post','addConfiguration','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./intZendeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create'];(function(_0x445d1b,_0x43c798){var _0x511b8d=function(_0x5d1e7f){while(--_0x5d1e7f){_0x445d1b['push'](_0x445d1b['shift']());}};_0x511b8d(++_0x43c798);}(_0xeff8,0xf8));var _0x8eff=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xeff8[_0x9aada2];return _0x196dff;};'use strict';var multer=require('multer');var util=require(_0x8eff('0x0'));var path=require(_0x8eff('0x1'));var timeout=require(_0x8eff('0x2'));var express=require(_0x8eff('0x3'));var router=express['Router']();var fs_extra=require(_0x8eff('0x4'));var auth=require(_0x8eff('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8eff('0x6'));router[_0x8eff('0x7')]('/',auth[_0x8eff('0x8')](),controller[_0x8eff('0x9')]);router[_0x8eff('0x7')]('/:id',auth[_0x8eff('0x8')](),controller[_0x8eff('0xa')]);router[_0x8eff('0x7')](_0x8eff('0xb'),auth[_0x8eff('0x8')](),controller[_0x8eff('0xc')]);router[_0x8eff('0x7')](_0x8eff('0xd'),auth['isAuthenticated'](),controller[_0x8eff('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8eff('0xf')]);router[_0x8eff('0x10')](_0x8eff('0xb'),auth[_0x8eff('0x8')](),controller[_0x8eff('0x11')]);router[_0x8eff('0x12')](_0x8eff('0x13'),auth[_0x8eff('0x8')](),controller[_0x8eff('0x14')]);router[_0x8eff('0x15')](_0x8eff('0x13'),auth[_0x8eff('0x8')](),controller[_0x8eff('0x16')]);module[_0x8eff('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 6df3c12..9267a6a 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 _0x5bc1=['remoteUri','ENUM','password','integrationTab','newTab','exports','STRING','username'];(function(_0x40cf40,_0x250ce2){var _0x37e951=function(_0x2215a2){while(--_0x2215a2){_0x40cf40['push'](_0x40cf40['shift']());}};_0x37e951(++_0x250ce2);}(_0x5bc1,0xb5));var _0x15bc=function(_0x53ad5f,_0x165793){_0x53ad5f=_0x53ad5f-0x0;var _0x61e1da=_0x5bc1[_0x53ad5f];return _0x61e1da;};'use strict';var Sequelize=require('sequelize');module[_0x15bc('0x0')]={'name':{'type':Sequelize[_0x15bc('0x1')]},'description':{'type':Sequelize[_0x15bc('0x1')]},'username':{'type':Sequelize[_0x15bc('0x1')],'unique':_0x15bc('0x2')},'password':{'type':Sequelize[_0x15bc('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x15bc('0x3')},'authType':{'type':Sequelize[_0x15bc('0x4')](_0x15bc('0x5'),'token'),'defaultValue':_0x15bc('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x15bc('0x4')](_0x15bc('0x6'),_0x15bc('0x7')),'defaultValue':_0x15bc('0x6')}}; \ No newline at end of file +var _0x9fe7=['newTab','integrationTab','sequelize','exports','STRING','username','remoteUri','ENUM','password'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9fe7,0x1df));var _0x79fe=function(_0x48c268,_0x2615c4){_0x48c268=_0x48c268-0x0;var _0x57ac2c=_0x9fe7[_0x48c268];return _0x57ac2c;};'use strict';var Sequelize=require(_0x79fe('0x0'));module[_0x79fe('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x79fe('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x79fe('0x3')},'password':{'type':Sequelize[_0x79fe('0x2')]},'token':{'type':Sequelize[_0x79fe('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x79fe('0x4')},'authType':{'type':Sequelize[_0x79fe('0x5')](_0x79fe('0x6'),'token'),'defaultValue':_0x79fe('0x6')},'serverUrl':{'type':Sequelize[_0x79fe('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x79fe('0x5')]('integrationTab',_0x79fe('0x7')),'defaultValue':_0x79fe('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index e466ae4..ecfae04 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 _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(_0x215f4d,_0x389111){var _0x54828b=function(_0x4a0822){while(--_0x4a0822){_0x215f4d['push'](_0x215f4d['shift']());}};_0x54828b(++_0x389111);}(_0x84a0,0x66));var _0x084a=function(_0x109fe4,_0x286340){_0x109fe4=_0x109fe4-0x0;var _0x50cc95=_0x84a0[_0x109fe4];return _0x50cc95;};'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 +var _0x2547=['Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','remove','system_field_options','custom_field_options','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','ZendeskAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','params','create','catch','body','find','findOne','ZendeskConfiguration','getConfigurations','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','toString','%s/token:%s'];(function(_0x4ca6a4,_0x5e9694){var _0x120555=function(_0x56888c){while(--_0x56888c){_0x4ca6a4['push'](_0x4ca6a4['shift']());}};_0x120555(++_0x5e9694);}(_0x2547,0x1cd));var _0x7254=function(_0x1e7468,_0x556a58){_0x1e7468=_0x1e7468-0x0;var _0x320590=_0x2547[_0x1e7468];return _0x320590;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7254('0x0'));var zipdir=require(_0x7254('0x1'));var jsonpatch=require(_0x7254('0x2'));var rp=require(_0x7254('0x3'));var moment=require(_0x7254('0x4'));var BPromise=require(_0x7254('0x5'));var Mustache=require(_0x7254('0x6'));var util=require(_0x7254('0x7'));var path=require('path');var sox=require(_0x7254('0x8'));var csv=require(_0x7254('0x9'));var ejs=require(_0x7254('0xa'));var fs=require('fs');var fs_extra=require(_0x7254('0xb'));var _=require('lodash');var squel=require(_0x7254('0xc'));var crypto=require(_0x7254('0xd'));var jsforce=require(_0x7254('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7254('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7254('0xf'));var qs=require(_0x7254('0x10'));var as=require(_0x7254('0x11'));var hardwareService=require(_0x7254('0x12'));var logger=require(_0x7254('0x13'))(_0x7254('0x14'));var utils=require('../../config/utils');var config=require(_0x7254('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7254('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x16c08e,_0x2bfff8){_0x2bfff8=_0x2bfff8||0xcc;return function(_0x348d4e){if(_0x348d4e){return _0x16c08e[_0x7254('0x17')](_0x2bfff8);}return _0x16c08e[_0x7254('0x18')](_0x2bfff8)[_0x7254('0x19')]();};}function respondWithResult(_0x124192,_0x21cecc){_0x21cecc=_0x21cecc||0xc8;return function(_0x1625ea){if(_0x1625ea){return _0x124192[_0x7254('0x18')](_0x21cecc)[_0x7254('0x1a')](_0x1625ea);}};}function respondWithFilteredResult(_0x1ee5cb,_0x163c8c){return function(_0x535065){if(_0x535065){var _0x265293=typeof _0x163c8c[_0x7254('0x1b')]===_0x7254('0x1c')&&typeof _0x163c8c[_0x7254('0x1d')]===_0x7254('0x1c');var _0x1e4aff=_0x535065[_0x7254('0x1e')];var _0x5dd23b=_0x265293?0x0:_0x163c8c[_0x7254('0x1b')];var _0x2283b7=_0x265293?_0x535065[_0x7254('0x1e')]:_0x163c8c[_0x7254('0x1b')]+_0x163c8c[_0x7254('0x1d')];var _0x301f00;if(_0x2283b7>=_0x1e4aff){_0x2283b7=_0x1e4aff;_0x301f00=0xc8;}else{_0x301f00=0xce;}_0x1ee5cb[_0x7254('0x18')](_0x301f00);return _0x1ee5cb[_0x7254('0x1f')](_0x7254('0x20'),_0x5dd23b+'-'+_0x2283b7+'/'+_0x1e4aff)[_0x7254('0x1a')](_0x535065);}return null;};}function patchUpdates(_0x2594b8){return function(_0x24bc73){try{jsonpatch[_0x7254('0x21')](_0x24bc73,_0x2594b8,!![]);}catch(_0x41ef72){return BPromise[_0x7254('0x22')](_0x41ef72);}return _0x24bc73[_0x7254('0x23')]();};}function saveUpdates(_0x2bb2fe,_0x46c0a2){return function(_0x195fd2){if(_0x195fd2){return _0x195fd2[_0x7254('0x24')](_0x2bb2fe)[_0x7254('0x25')](function(_0x50c34b){return _0x50c34b;});}return null;};}function removeEntity(_0x493bfd,_0x136ea3){return function(_0xd91c1f){if(_0xd91c1f){return _0xd91c1f[_0x7254('0x26')]()[_0x7254('0x25')](function(){_0x493bfd[_0x7254('0x18')](0xcc)[_0x7254('0x19')]();});}};}function handleEntityNotFound(_0x133aee,_0x5d6df5){return function(_0x133287){if(!_0x133287){_0x133aee[_0x7254('0x17')](0x194);}return _0x133287;};}function handleError(_0x2b4f46,_0x494cdb){_0x494cdb=_0x494cdb||0x1f4;return function(_0x3c22d0){logger['error'](_0x3c22d0[_0x7254('0x27')]);if(_0x3c22d0[_0x7254('0x28')]){delete _0x3c22d0['name'];}_0x2b4f46[_0x7254('0x18')](_0x494cdb)[_0x7254('0x29')](_0x3c22d0);};}exports['index']=function(_0x14cbea,_0x6c4927){var _0x37cb5c={},_0xb9198b={},_0x43bf02={'count':0x0,'rows':[]};var _0xfe02ea=_['map'](db[_0x7254('0x2a')][_0x7254('0x2b')],function(_0x5569be){return{'name':_0x5569be[_0x7254('0x2c')],'type':_0x5569be[_0x7254('0x2d')][_0x7254('0x2e')]};});_0xb9198b['model']=_[_0x7254('0x2f')](_0xfe02ea,_0x7254('0x28'));_0xb9198b[_0x7254('0x30')]=_[_0x7254('0x31')](_0x14cbea[_0x7254('0x30')]);_0xb9198b[_0x7254('0x32')]=_[_0x7254('0x33')](_0xb9198b['model'],_0xb9198b[_0x7254('0x30')]);_0x37cb5c['attributes']=_['intersection'](_0xb9198b[_0x7254('0x34')],qs[_0x7254('0x35')](_0x14cbea[_0x7254('0x30')][_0x7254('0x35')]));_0x37cb5c[_0x7254('0x36')]=_0x37cb5c[_0x7254('0x36')][_0x7254('0x37')]?_0x37cb5c[_0x7254('0x36')]:_0xb9198b[_0x7254('0x34')];if(!_0x14cbea[_0x7254('0x30')][_0x7254('0x38')](_0x7254('0x39'))){_0x37cb5c[_0x7254('0x1d')]=qs[_0x7254('0x1d')](_0x14cbea['query'][_0x7254('0x1d')]);_0x37cb5c[_0x7254('0x1b')]=qs[_0x7254('0x1b')](_0x14cbea[_0x7254('0x30')][_0x7254('0x1b')]);}_0x37cb5c['order']=qs[_0x7254('0x3a')](_0x14cbea['query'][_0x7254('0x3a')]);_0x37cb5c[_0x7254('0x3b')]=qs[_0x7254('0x32')](_[_0x7254('0x3c')](_0x14cbea[_0x7254('0x30')],_0xb9198b['filters']),_0xfe02ea);if(_0x14cbea[_0x7254('0x30')]['filter']){_0x37cb5c[_0x7254('0x3b')]=_[_0x7254('0x3d')](_0x37cb5c['where'],{'$or':_[_0x7254('0x2f')](_0xfe02ea,function(_0x3c5bf4){if(_0x3c5bf4[_0x7254('0x2d')]!==_0x7254('0x3e')){var _0x14b625={};_0x14b625[_0x3c5bf4[_0x7254('0x28')]]={'$like':'%'+_0x14cbea['query'][_0x7254('0x3f')]+'%'};return _0x14b625;}})});}_0x37cb5c=_[_0x7254('0x3d')]({},_0x37cb5c,_0x14cbea[_0x7254('0x40')]);var _0x4eca7a={'where':_0x37cb5c[_0x7254('0x3b')]};return db[_0x7254('0x2a')][_0x7254('0x1e')](_0x4eca7a)['then'](function(_0xc09711){_0x43bf02[_0x7254('0x1e')]=_0xc09711;if(_0x14cbea[_0x7254('0x30')][_0x7254('0x41')]){_0x37cb5c[_0x7254('0x42')]=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x37cb5c);})[_0x7254('0x25')](function(_0x17bc29){_0x43bf02[_0x7254('0x43')]=_0x17bc29;return _0x43bf02;})[_0x7254('0x25')](respondWithFilteredResult(_0x6c4927,_0x37cb5c))['catch'](handleError(_0x6c4927,null));};exports['show']=function(_0x29821a,_0x565cd8){var _0x2ae22e={'raw':![],'where':{'id':_0x29821a[_0x7254('0x44')]['id']}},_0x3187b0={};_0x3187b0[_0x7254('0x34')]=_['keys'](db['ZendeskAccount'][_0x7254('0x2b')]);_0x3187b0[_0x7254('0x30')]=_[_0x7254('0x31')](_0x29821a[_0x7254('0x30')]);_0x3187b0[_0x7254('0x32')]=_['intersection'](_0x3187b0['model'],_0x3187b0[_0x7254('0x30')]);_0x2ae22e[_0x7254('0x36')]=_[_0x7254('0x33')](_0x3187b0['model'],qs[_0x7254('0x35')](_0x29821a[_0x7254('0x30')]['fields']));_0x2ae22e[_0x7254('0x36')]=_0x2ae22e[_0x7254('0x36')][_0x7254('0x37')]?_0x2ae22e[_0x7254('0x36')]:_0x3187b0['model'];if(_0x29821a[_0x7254('0x30')][_0x7254('0x41')]){_0x2ae22e['include']=[{'all':!![]}];}_0x2ae22e=_[_0x7254('0x3d')]({},_0x2ae22e,_0x29821a[_0x7254('0x40')]);return db[_0x7254('0x2a')]['find'](_0x2ae22e)[_0x7254('0x25')](handleEntityNotFound(_0x565cd8,null))[_0x7254('0x25')](respondWithResult(_0x565cd8,null))['catch'](handleError(_0x565cd8,null));};exports['create']=function(_0x10b32f,_0x54c792){return db[_0x7254('0x2a')][_0x7254('0x45')](_0x10b32f['body'],{})['then'](respondWithResult(_0x54c792,0xc9))[_0x7254('0x46')](handleError(_0x54c792,null));};exports[_0x7254('0x24')]=function(_0x38bcd5,_0x104d98){if(_0x38bcd5[_0x7254('0x47')]['id']){delete _0x38bcd5[_0x7254('0x47')]['id'];}return db['ZendeskAccount'][_0x7254('0x48')]({'where':{'id':_0x38bcd5['params']['id']}})[_0x7254('0x25')](handleEntityNotFound(_0x104d98,null))[_0x7254('0x25')](saveUpdates(_0x38bcd5[_0x7254('0x47')],null))['then'](respondWithResult(_0x104d98,null))[_0x7254('0x46')](handleError(_0x104d98,null));};exports[_0x7254('0x26')]=function(_0x252758,_0x5b3b6e){return db[_0x7254('0x2a')][_0x7254('0x48')]({'where':{'id':_0x252758[_0x7254('0x44')]['id']}})[_0x7254('0x25')](handleEntityNotFound(_0x5b3b6e,null))[_0x7254('0x25')](removeEntity(_0x5b3b6e,null))['catch'](handleError(_0x5b3b6e,null));};exports['getConfigurations']=function(_0x24c532,_0x2cb7cd,_0x441d23){var _0x10e1cb={};var _0x3b0002={};var _0x4c6838;var _0x5a44fb;return db[_0x7254('0x2a')][_0x7254('0x49')]({'where':{'id':_0x24c532[_0x7254('0x44')]['id']}})[_0x7254('0x25')](handleEntityNotFound(_0x2cb7cd,null))['then'](function(_0xaf6d3d){if(_0xaf6d3d){_0x4c6838=_0xaf6d3d;_0x3b0002[_0x7254('0x34')]=_['keys'](db[_0x7254('0x4a')]['rawAttributes']);_0x3b0002[_0x7254('0x30')]=_['keys'](_0x24c532[_0x7254('0x30')]);_0x3b0002['filters']=_['intersection'](_0x3b0002[_0x7254('0x34')],_0x3b0002[_0x7254('0x30')]);_0x10e1cb[_0x7254('0x36')]=_[_0x7254('0x33')](_0x3b0002['model'],qs[_0x7254('0x35')](_0x24c532['query'][_0x7254('0x35')]));_0x10e1cb[_0x7254('0x36')]=_0x10e1cb[_0x7254('0x36')][_0x7254('0x37')]?_0x10e1cb[_0x7254('0x36')]:_0x3b0002[_0x7254('0x34')];_0x10e1cb['order']=qs[_0x7254('0x3a')](_0x24c532[_0x7254('0x30')][_0x7254('0x3a')]);_0x10e1cb[_0x7254('0x3b')]=qs[_0x7254('0x32')](_[_0x7254('0x3c')](_0x24c532['query'],_0x3b0002[_0x7254('0x32')]));if(_0x24c532[_0x7254('0x30')][_0x7254('0x3f')]){_0x10e1cb[_0x7254('0x3b')]=_[_0x7254('0x3d')](_0x10e1cb[_0x7254('0x3b')],{'$or':_[_0x7254('0x2f')](_0x10e1cb['attributes'],function(_0x5dd108){var _0xac4d0={};_0xac4d0[_0x5dd108]={'$like':'%'+_0x24c532['query']['filter']+'%'};return _0xac4d0;})});}_0x10e1cb=_[_0x7254('0x3d')]({},_0x10e1cb,_0x24c532[_0x7254('0x40')]);return _0x4c6838[_0x7254('0x4b')](_0x10e1cb);}})['then'](function(_0x1821f0){if(_0x1821f0){_0x5a44fb=_0x1821f0['length'];if(!_0x24c532[_0x7254('0x30')][_0x7254('0x38')](_0x7254('0x39'))){_0x10e1cb[_0x7254('0x1d')]=qs[_0x7254('0x1d')](_0x24c532['query'][_0x7254('0x1d')]);_0x10e1cb[_0x7254('0x1b')]=qs[_0x7254('0x1b')](_0x24c532[_0x7254('0x30')]['offset']);}return _0x4c6838['getConfigurations'](_0x10e1cb);}})[_0x7254('0x25')](function(_0x41355e){if(_0x41355e){return _0x41355e?{'count':_0x5a44fb,'rows':_0x41355e}:null;}})[_0x7254('0x25')](respondWithResult(_0x2cb7cd,null))[_0x7254('0x46')](handleError(_0x2cb7cd,null));};exports[_0x7254('0x4c')]=function(_0x1cf028,_0x464680,_0x38cba1){if(_0x1cf028[_0x7254('0x47')]['id']){delete _0x1cf028[_0x7254('0x47')]['id'];}return db[_0x7254('0x2a')][_0x7254('0x49')]({'where':{'id':_0x1cf028[_0x7254('0x44')]['id']}})['then'](handleEntityNotFound(_0x464680,null))[_0x7254('0x25')](function(_0x4716a2){if(_0x4716a2){_0x1cf028[_0x7254('0x47')]['AccountId']=_0x4716a2['id'];_0x1cf028[_0x7254('0x47')][_0x7254('0x4d')]=integrations[_0x7254('0x4e')](_0x1cf028[_0x7254('0x47')]['channel'],_0x1cf028[_0x7254('0x47')]['type']);_0x1cf028[_0x7254('0x47')][_0x7254('0x4f')]=integrations[_0x7254('0x50')](_0x1cf028[_0x7254('0x47')]['channel'],_0x1cf028[_0x7254('0x47')]['type']);return db[_0x7254('0x4a')]['create'](_0x1cf028[_0x7254('0x47')],{'include':[{'model':db[_0x7254('0x51')],'as':_0x7254('0x4d')},{'model':db[_0x7254('0x51')],'as':_0x7254('0x4f')}]});}return null;})[_0x7254('0x25')](respondWithResult(_0x464680,null))[_0x7254('0x46')](handleError(_0x464680,null));};exports[_0x7254('0x52')]=function(_0x4e07c6,_0x37562a,_0x57c0a0){var _0x12c36e='';return db[_0x7254('0x2a')][_0x7254('0x49')]({'where':{'id':_0x4e07c6[_0x7254('0x44')]['id']},'attributes':['id',_0x7254('0x53'),_0x7254('0x54'),_0x7254('0x55'),_0x7254('0x56'),'remoteUri']})[_0x7254('0x25')](handleEntityNotFound(_0x37562a,null))['then'](function(_0x231184){if(_0x231184){_0x12c36e=_0x231184[_0x7254('0x57')];var _0x2399ef=_0x12c36e[_0x7254('0x58')](-0x1);if(_0x2399ef==='/'){_0x12c36e=_0x12c36e[_0x7254('0x59')](0x0,_0x12c36e[_0x7254('0x5a')](_0x2399ef));}var _0xb65570={'method':_0x7254('0x5b'),'uri':util[_0x7254('0x5c')](_0x7254('0x5d'),_0x12c36e,_0x7254('0x5e')),'json':!![]};switch(_0x231184[_0x7254('0x56')]){case _0x7254('0x54'):_0xb65570[_0x7254('0x5f')]={'Authorization':util[_0x7254('0x5c')](_0x7254('0x60'),new Buffer(util[_0x7254('0x5c')]('%s:%s',_0x231184['username'],_0x231184[_0x7254('0x54')]))[_0x7254('0x61')]('base64'))};break;case'token':_0xb65570['headers']={'Authorization':util[_0x7254('0x5c')](_0x7254('0x60'),new Buffer(util[_0x7254('0x5c')](_0x7254('0x62'),_0x231184['username'],_0x231184[_0x7254('0x55')]))[_0x7254('0x61')]('base64'))};break;default:throw new db[(_0x7254('0x63'))][(_0x7254('0x64'))](_0x7254('0x65'));}return rp(_0xb65570);}})['then'](function(_0x4aa036){if(_0x4aa036){var _0x220066=[_0x7254('0x66'),'description',_0x7254('0x67'),_0x7254('0x68')];_[_0x7254('0x69')](_0x4aa036[_0x7254('0x5e')],function(_0x24fcb1){return _0x220066['includes'](_0x24fcb1[_0x7254('0x2d')]);});return{'count':_0x4aa036[_0x7254('0x5e')][_0x7254('0x37')],'rows':_['map'](_0x4aa036[_0x7254('0x5e')],function(_0x4cf18d){return{'id':_0x4cf18d['id'],'name':_0x4cf18d['position']>0x7?_0x4cf18d['title']:_0x4cf18d[_0x7254('0x2d')],'custom':_0x4cf18d['position']>0x7?!![]:![],'options':_0x4cf18d['system_field_options']?_0x4cf18d[_0x7254('0x6a')]:_0x4cf18d[_0x7254('0x6b')]?_0x4cf18d[_0x7254('0x6b')]:[]};})};}})['then'](respondWithResult(_0x37562a,null))[_0x7254('0x46')](function(_0x5a0c41){var _0x175379=_0x4e07c6[_0x7254('0x30')]['test']?0x1f4:_0x5a0c41[_0x7254('0x6c')]||0x1f4;logger[_0x7254('0x6d')](_0x7254('0x6e'),_0x7254('0x52'),_0x175379,JSON[_0x7254('0x6f')](_0x5a0c41));delete _0x5a0c41[_0x7254('0x28')];if(_0x175379===0x191){_0x175379=0x190;}_0x37562a[_0x7254('0x18')](_0x175379)['send'](_0x4e07c6[_0x7254('0x30')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x5a0c41[_0x7254('0x6c')]}:_0x5a0c41);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 844b37d..0d28f62 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 _0xa774=['./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','int_zendesk_accounts','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xa774,0x1e6));var _0x4a77=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0xa774[_0x474bc0];return _0x4b24cf;};'use strict';var _=require(_0x4a77('0x0'));var util=require('util');var logger=require(_0x4a77('0x1'))(_0x4a77('0x2'));var moment=require(_0x4a77('0x3'));var BPromise=require(_0x4a77('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a77('0x5'));var rimraf=require(_0x4a77('0x6'));var config=require(_0x4a77('0x7'));var attributes=require(_0x4a77('0x8'));var integrations=require(_0x4a77('0x9'));module[_0x4a77('0xa')]=function(_0x1c5522,_0x202960){return _0x1c5522[_0x4a77('0xb')]('ZendeskAccount',attributes,{'tableName':_0x4a77('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf309=['bluebird','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','api','moment'];(function(_0x1c6f5d,_0x44b08b){var _0x32b6b0=function(_0x360a34){while(--_0x360a34){_0x1c6f5d['push'](_0x1c6f5d['shift']());}};_0x32b6b0(++_0x44b08b);}(_0xf309,0x14e));var _0x9f30=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xf309[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x9f30('0x0'));var util=require(_0x9f30('0x1'));var logger=require('../../config/logger')(_0x9f30('0x2'));var moment=require(_0x9f30('0x3'));var BPromise=require(_0x9f30('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f30('0x5'));var rimraf=require('rimraf');var config=require(_0x9f30('0x6'));var attributes=require(_0x9f30('0x7'));var integrations=require(_0x9f30('0x8'));module[_0x9f30('0x9')]=function(_0x397d66,_0xaac3ba){return _0x397d66[_0x9f30('0xa')](_0x9f30('0xb'),attributes,{'tableName':_0x9f30('0xc'),'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 7aa926d..3e4b9db 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 _0xf2a9=['ZendeskAccount,\x20%s,\x20%s','message','result','catch','GetZendeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','stringify','ZendeskAccount','ShowZendeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','error'];(function(_0x59042d,_0x232c62){var _0x2f82ff=function(_0x57a903){while(--_0x57a903){_0x59042d['push'](_0x59042d['shift']());}};_0x2f82ff(++_0x232c62);}(_0xf2a9,0x19d));var _0x9f2a=function(_0x3e24d7,_0x1bd851){_0x3e24d7=_0x3e24d7-0x0;var _0x3e645d=_0xf2a9[_0x3e24d7];return _0x3e645d;};'use strict';var _=require(_0x9f2a('0x0'));var util=require(_0x9f2a('0x1'));var moment=require(_0x9f2a('0x2'));var BPromise=require(_0x9f2a('0x3'));var rs=require(_0x9f2a('0x4'));var fs=require('fs');var Redis=require(_0x9f2a('0x5'));var db=require(_0x9f2a('0x6'))['db'];var utils=require(_0x9f2a('0x7'));var logger=require(_0x9f2a('0x8'))(_0x9f2a('0x9'));var config=require(_0x9f2a('0xa'));var jayson=require(_0x9f2a('0xb'));var client=jayson[_0x9f2a('0xc')][_0x9f2a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x175314,_0x2e302b,_0x5ff344){return new BPromise(function(_0x3c8618,_0x335b79){return client['request'](_0x175314,_0x5ff344)[_0x9f2a('0xe')](function(_0x104ced){logger[_0x9f2a('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x2e302b,_0x9f2a('0x10'));logger[_0x9f2a('0x11')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x2e302b,_0x9f2a('0x10'),JSON['stringify'](_0x104ced));if(_0x104ced[_0x9f2a('0x12')]){if(_0x104ced[_0x9f2a('0x12')]['code']===0x1f4){logger['error'](_0x9f2a('0x13'),_0x2e302b,_0x104ced[_0x9f2a('0x12')]['message']);return _0x335b79(_0x104ced[_0x9f2a('0x12')]['message']);}logger[_0x9f2a('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x2e302b,_0x104ced['error']['message']);return _0x3c8618(_0x104ced[_0x9f2a('0x12')][_0x9f2a('0x14')]);}else{logger['info'](_0x9f2a('0x13'),_0x2e302b,'request\x20sent');_0x3c8618(_0x104ced[_0x9f2a('0x15')][_0x9f2a('0x14')]);}})[_0x9f2a('0x16')](function(_0x29fa40){logger[_0x9f2a('0x12')](_0x9f2a('0x13'),_0x2e302b,_0x29fa40);_0x335b79(_0x29fa40);});});}exports[_0x9f2a('0x17')]=function(_0x44af2b){var _0x274f89=this;return new Promise(function(_0x8b0883,_0x186673){return db['ZendeskAccount'][_0x9f2a('0x18')]({'raw':_0x44af2b['options']?_0x44af2b[_0x9f2a('0x19')][_0x9f2a('0x1a')]===undefined?!![]:![]:!![],'where':_0x44af2b[_0x9f2a('0x19')]?_0x44af2b[_0x9f2a('0x19')][_0x9f2a('0x1b')]||null:null,'attributes':_0x44af2b[_0x9f2a('0x19')]?_0x44af2b['options']['attributes']||null:null,'limit':_0x44af2b[_0x9f2a('0x19')]?_0x44af2b[_0x9f2a('0x19')][_0x9f2a('0x1c')]||null:null,'include':_0x44af2b[_0x9f2a('0x19')]?_0x44af2b['options'][_0x9f2a('0x1d')]?_[_0x9f2a('0x1e')](_0x44af2b[_0x9f2a('0x19')][_0x9f2a('0x1d')],function(_0x1155e5){return{'model':db[_0x1155e5[_0x9f2a('0x1f')]],'as':_0x1155e5['as'],'attributes':_0x1155e5[_0x9f2a('0x20')],'include':_0x1155e5[_0x9f2a('0x1d')]?_[_0x9f2a('0x1e')](_0x1155e5[_0x9f2a('0x1d')],function(_0x46c0ad){return{'model':db[_0x46c0ad[_0x9f2a('0x1f')]],'as':_0x46c0ad['as'],'attributes':_0x46c0ad[_0x9f2a('0x20')],'include':_0x46c0ad['include']?_[_0x9f2a('0x1e')](_0x46c0ad[_0x9f2a('0x1d')],function(_0x4c5aac){return{'model':db[_0x4c5aac['model']],'as':_0x4c5aac['as'],'attributes':_0x4c5aac[_0x9f2a('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e0f3a){logger[_0x9f2a('0xf')](_0x9f2a('0x17'),_0x44af2b);logger[_0x9f2a('0x11')]('GetZendeskAccount',_0x44af2b,JSON[_0x9f2a('0x21')](_0x5e0f3a));_0x8b0883(_0x5e0f3a);})[_0x9f2a('0x16')](function(_0x432de5){logger[_0x9f2a('0x12')]('GetZendeskAccount',_0x432de5[_0x9f2a('0x14')],_0x44af2b);_0x186673(_0x274f89['error'](0x1f4,_0x432de5[_0x9f2a('0x14')]));});});};exports['ShowZendeskAccount']=function(_0x594715){var _0x4102fb=this;return new Promise(function(_0x7be0ad,_0x5ed767){return db[_0x9f2a('0x22')]['find']({'raw':_0x594715[_0x9f2a('0x19')]?_0x594715[_0x9f2a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x594715[_0x9f2a('0x19')]?_0x594715['options'][_0x9f2a('0x1b')]||null:null,'attributes':_0x594715['options']?_0x594715[_0x9f2a('0x19')][_0x9f2a('0x20')]||null:null,'include':_0x594715[_0x9f2a('0x19')]?_0x594715['options'][_0x9f2a('0x1d')]?_['map'](_0x594715[_0x9f2a('0x19')][_0x9f2a('0x1d')],function(_0x5c51bb){return{'model':db[_0x5c51bb['model']],'as':_0x5c51bb['as'],'attributes':_0x5c51bb['attributes'],'include':_0x5c51bb[_0x9f2a('0x1d')]?_[_0x9f2a('0x1e')](_0x5c51bb[_0x9f2a('0x1d')],function(_0x5006f8){return{'model':db[_0x5006f8[_0x9f2a('0x1f')]],'as':_0x5006f8['as'],'attributes':_0x5006f8[_0x9f2a('0x20')],'include':_0x5006f8[_0x9f2a('0x1d')]?_[_0x9f2a('0x1e')](_0x5006f8[_0x9f2a('0x1d')],function(_0x3adbef){return{'model':db[_0x3adbef['model']],'as':_0x3adbef['as'],'attributes':_0x3adbef['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x435b2f){logger[_0x9f2a('0xf')](_0x9f2a('0x23'),_0x594715);logger['debug'](_0x9f2a('0x23'),_0x594715,JSON['stringify'](_0x435b2f));_0x7be0ad(_0x435b2f);})[_0x9f2a('0x16')](function(_0x4efb6d){logger[_0x9f2a('0x12')]('ShowZendeskAccount',_0x4efb6d[_0x9f2a('0x14')],_0x594715);_0x5ed767(_0x4102fb[_0x9f2a('0x12')](0x1f4,_0x4efb6d[_0x9f2a('0x14')]));});});}; \ No newline at end of file +var _0xe484=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetZendeskAccount','ShowZendeskAccount','debug'];(function(_0x1e088b,_0x3296a0){var _0x18fb38=function(_0x58cd81){while(--_0x58cd81){_0x1e088b['push'](_0x1e088b['shift']());}};_0x18fb38(++_0x3296a0);}(_0xe484,0x118));var _0x4e48=function(_0x3698c1,_0xfe4be7){_0x3698c1=_0x3698c1-0x0;var _0x4c8321=_0xe484[_0x3698c1];return _0x4c8321;};'use strict';var _=require(_0x4e48('0x0'));var util=require(_0x4e48('0x1'));var moment=require(_0x4e48('0x2'));var BPromise=require(_0x4e48('0x3'));var rs=require(_0x4e48('0x4'));var fs=require('fs');var Redis=require(_0x4e48('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4e48('0x6'));var logger=require(_0x4e48('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4e48('0x8'));var client=jayson[_0x4e48('0x9')][_0x4e48('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc3b44c,_0x1e6448,_0x44881c){return new BPromise(function(_0x587e0e,_0x52b02d){return client[_0x4e48('0xb')](_0xc3b44c,_0x44881c)[_0x4e48('0xc')](function(_0x2baac2){logger['info'](_0x4e48('0xd'),_0x1e6448,_0x4e48('0xe'));logger['debug'](_0x4e48('0xf'),_0x1e6448,_0x4e48('0xe'),JSON[_0x4e48('0x10')](_0x2baac2));if(_0x2baac2[_0x4e48('0x11')]){if(_0x2baac2[_0x4e48('0x11')][_0x4e48('0x12')]===0x1f4){logger[_0x4e48('0x11')](_0x4e48('0xd'),_0x1e6448,_0x2baac2[_0x4e48('0x11')][_0x4e48('0x13')]);return _0x52b02d(_0x2baac2[_0x4e48('0x11')]['message']);}logger[_0x4e48('0x11')](_0x4e48('0xd'),_0x1e6448,_0x2baac2[_0x4e48('0x11')][_0x4e48('0x13')]);return _0x587e0e(_0x2baac2[_0x4e48('0x11')][_0x4e48('0x13')]);}else{logger[_0x4e48('0x14')](_0x4e48('0xd'),_0x1e6448,_0x4e48('0xe'));_0x587e0e(_0x2baac2['result'][_0x4e48('0x13')]);}})[_0x4e48('0x15')](function(_0x1ac90d){logger[_0x4e48('0x11')](_0x4e48('0xd'),_0x1e6448,_0x1ac90d);_0x52b02d(_0x1ac90d);});});}exports['GetZendeskAccount']=function(_0xc2ff8b){var _0x1dc566=this;return new Promise(function(_0x4e7444,_0x26a413){return db[_0x4e48('0x16')][_0x4e48('0x17')]({'raw':_0xc2ff8b['options']?_0xc2ff8b[_0x4e48('0x18')][_0x4e48('0x19')]===undefined?!![]:![]:!![],'where':_0xc2ff8b[_0x4e48('0x18')]?_0xc2ff8b[_0x4e48('0x18')][_0x4e48('0x1a')]||null:null,'attributes':_0xc2ff8b[_0x4e48('0x18')]?_0xc2ff8b['options'][_0x4e48('0x1b')]||null:null,'limit':_0xc2ff8b[_0x4e48('0x18')]?_0xc2ff8b['options'][_0x4e48('0x1c')]||null:null,'include':_0xc2ff8b[_0x4e48('0x18')]?_0xc2ff8b[_0x4e48('0x18')][_0x4e48('0x1d')]?_[_0x4e48('0x1e')](_0xc2ff8b['options'][_0x4e48('0x1d')],function(_0x399f2e){return{'model':db[_0x399f2e['model']],'as':_0x399f2e['as'],'attributes':_0x399f2e[_0x4e48('0x1b')],'include':_0x399f2e['include']?_[_0x4e48('0x1e')](_0x399f2e[_0x4e48('0x1d')],function(_0x4be956){return{'model':db[_0x4be956[_0x4e48('0x1f')]],'as':_0x4be956['as'],'attributes':_0x4be956[_0x4e48('0x1b')],'include':_0x4be956[_0x4e48('0x1d')]?_[_0x4e48('0x1e')](_0x4be956['include'],function(_0x4cb13a){return{'model':db[_0x4cb13a['model']],'as':_0x4cb13a['as'],'attributes':_0x4cb13a['attributes']};}):[]};}):[]};}):[]:[]})[_0x4e48('0xc')](function(_0x319407){logger[_0x4e48('0x14')]('GetZendeskAccount',_0xc2ff8b);logger['debug'](_0x4e48('0x20'),_0xc2ff8b,JSON['stringify'](_0x319407));_0x4e7444(_0x319407);})[_0x4e48('0x15')](function(_0x2e32d1){logger['error']('GetZendeskAccount',_0x2e32d1[_0x4e48('0x13')],_0xc2ff8b);_0x26a413(_0x1dc566['error'](0x1f4,_0x2e32d1[_0x4e48('0x13')]));});});};exports[_0x4e48('0x21')]=function(_0x10c58d){var _0x3b3aad=this;return new Promise(function(_0x442e96,_0x12d61c){return db[_0x4e48('0x16')]['find']({'raw':_0x10c58d[_0x4e48('0x18')]?_0x10c58d[_0x4e48('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x10c58d['options']?_0x10c58d[_0x4e48('0x18')][_0x4e48('0x1a')]||null:null,'attributes':_0x10c58d[_0x4e48('0x18')]?_0x10c58d[_0x4e48('0x18')][_0x4e48('0x1b')]||null:null,'include':_0x10c58d['options']?_0x10c58d[_0x4e48('0x18')][_0x4e48('0x1d')]?_[_0x4e48('0x1e')](_0x10c58d[_0x4e48('0x18')][_0x4e48('0x1d')],function(_0x97bad1){return{'model':db[_0x97bad1[_0x4e48('0x1f')]],'as':_0x97bad1['as'],'attributes':_0x97bad1['attributes'],'include':_0x97bad1[_0x4e48('0x1d')]?_[_0x4e48('0x1e')](_0x97bad1['include'],function(_0x50c711){return{'model':db[_0x50c711[_0x4e48('0x1f')]],'as':_0x50c711['as'],'attributes':_0x50c711[_0x4e48('0x1b')],'include':_0x50c711[_0x4e48('0x1d')]?_[_0x4e48('0x1e')](_0x50c711['include'],function(_0x4a551b){return{'model':db[_0x4a551b[_0x4e48('0x1f')]],'as':_0x4a551b['as'],'attributes':_0x4a551b[_0x4e48('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4e48('0xc')](function(_0x5c5aa2){logger[_0x4e48('0x14')](_0x4e48('0x21'),_0x10c58d);logger[_0x4e48('0x22')](_0x4e48('0x21'),_0x10c58d,JSON[_0x4e48('0x10')](_0x5c5aa2));_0x442e96(_0x5c5aa2);})[_0x4e48('0x15')](function(_0x5d746f){logger[_0x4e48('0x11')](_0x4e48('0x21'),_0x5d746f[_0x4e48('0x13')],_0x10c58d);_0x12d61c(_0x3b3aad[_0x4e48('0x11')](0x1f4,_0x5d746f[_0x4e48('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 18d28a4..15a7774 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(_0x571cd4,_0x22b0ae){var _0x1242e3=function(_0x2b0eb2){while(--_0x2b0eb2){_0x571cd4['push'](_0x571cd4['shift']());}};_0x1242e3(++_0x22b0ae);}(_0x5eb8,0xb0));var _0x85eb=function(_0x3eff21,_0x5bf36c){_0x3eff21=_0x3eff21-0x0;var _0x1945bb=_0x5eb8[_0x3eff21];return _0x1945bb;};'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 _0xac4a=['../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','get','show','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x41249e,_0x275d84){var _0x2bff48=function(_0x33a84d){while(--_0x33a84d){_0x41249e['push'](_0x41249e['shift']());}};_0x2bff48(++_0x275d84);}(_0xac4a,0x13f));var _0xaac4=function(_0x377f1d,_0x59a418){_0x377f1d=_0x377f1d-0x0;var _0x5b1a11=_0xac4a[_0x377f1d];return _0x5b1a11;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['get']('/:id/fields',auth[_0xaac4('0x9')](),controller['getFields']);router[_0xaac4('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router[_0xaac4('0xa')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xe')]);router['get']('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')]('/',auth['isAuthenticated'](),controller[_0xaac4('0x11')]);router[_0xaac4('0x10')]('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0x12')]);router[_0xaac4('0x13')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x15')]);router[_0xaac4('0x16')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x17')]);module[_0xaac4('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 14ef260..2cd2702 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 _0x7da4=['STRING'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0x7da4,0x7a));var _0x47da=function(_0x17fbcc,_0x110750){_0x17fbcc=_0x17fbcc-0x0;var _0x21fece=_0x7da4[_0x17fbcc];return _0x21fece;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x47da('0x0')]},'description':{'type':Sequelize[_0x47da('0x0')]}}; \ No newline at end of file +var _0x675b=['exports','STRING','sequelize'];(function(_0x5d53ef,_0x76bdc){var _0x262f58=function(_0x152df6){while(--_0x152df6){_0x5d53ef['push'](_0x5d53ef['shift']());}};_0x262f58(++_0x76bdc);}(_0x675b,0xa4));var _0xb675=function(_0x3ad224,_0x2f713b){_0x3ad224=_0x3ad224-0x0;var _0x4c3e51=_0x675b[_0x3ad224];return _0x4c3e51;};'use strict';var Sequelize=require(_0xb675('0x0'));module[_0xb675('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb675('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 5d4418b..ef067a7 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 _0x4b5a=['count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','rows','catch','params','include','create','body','find','getFields','getSubjects','findOne','ZendeskField','getDescriptions','getTags','Tag','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../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'];(function(_0x1cf839,_0x3add9c){var _0x4305fb=function(_0x4c23fe){while(--_0x4c23fe){_0x1cf839['push'](_0x1cf839['shift']());}};_0x4305fb(++_0x3add9c);}(_0x4b5a,0x176));var _0xa4b5=function(_0x4f43e4,_0x876886){_0x4f43e4=_0x4f43e4-0x0;var _0x5639cc=_0x4b5a[_0x4f43e4];return _0x5639cc;};'use strict';var emlformat=require(_0xa4b5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa4b5('0x1'));var jsonpatch=require(_0xa4b5('0x2'));var rp=require(_0xa4b5('0x3'));var moment=require('moment');var BPromise=require(_0xa4b5('0x4'));var Mustache=require('mustache');var util=require(_0xa4b5('0x5'));var path=require('path');var sox=require(_0xa4b5('0x6'));var csv=require(_0xa4b5('0x7'));var ejs=require(_0xa4b5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa4b5('0x9'));var squel=require(_0xa4b5('0xa'));var crypto=require(_0xa4b5('0xb'));var jsforce=require(_0xa4b5('0xc'));var deskjs=require(_0xa4b5('0xd'));var toCsv=require(_0xa4b5('0x7'));var querystring=require(_0xa4b5('0xe'));var Papa=require(_0xa4b5('0xf'));var Redis=require('ioredis');var authService=require(_0xa4b5('0x10'));var qs=require(_0xa4b5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa4b5('0x12'));var logger=require(_0xa4b5('0x13'))('api');var utils=require(_0xa4b5('0x14'));var config=require(_0xa4b5('0x15'));var licenseUtil=require(_0xa4b5('0x16'));var db=require(_0xa4b5('0x17'))['db'];function respondWithStatusCode(_0x2a11cd,_0x245739){_0x245739=_0x245739||0xcc;return function(_0x3bd360){if(_0x3bd360){return _0x2a11cd[_0xa4b5('0x18')](_0x245739);}return _0x2a11cd[_0xa4b5('0x19')](_0x245739)[_0xa4b5('0x1a')]();};}function respondWithResult(_0x9718e2,_0x591247){_0x591247=_0x591247||0xc8;return function(_0x2fc909){if(_0x2fc909){return _0x9718e2[_0xa4b5('0x19')](_0x591247)[_0xa4b5('0x1b')](_0x2fc909);}};}function respondWithFilteredResult(_0xa3ab00,_0x31a699){return function(_0x932f39){if(_0x932f39){var _0x3a3552=typeof _0x31a699[_0xa4b5('0x1c')]===_0xa4b5('0x1d')&&typeof _0x31a699[_0xa4b5('0x1e')]===_0xa4b5('0x1d');var _0x4c6ff2=_0x932f39['count'];var _0x37ee4e=_0x3a3552?0x0:_0x31a699[_0xa4b5('0x1c')];var _0x14f82d=_0x3a3552?_0x932f39[_0xa4b5('0x1f')]:_0x31a699[_0xa4b5('0x1c')]+_0x31a699[_0xa4b5('0x1e')];var _0x2784ef;if(_0x14f82d>=_0x4c6ff2){_0x14f82d=_0x4c6ff2;_0x2784ef=0xc8;}else{_0x2784ef=0xce;}_0xa3ab00[_0xa4b5('0x19')](_0x2784ef);return _0xa3ab00[_0xa4b5('0x20')]('Content-Range',_0x37ee4e+'-'+_0x14f82d+'/'+_0x4c6ff2)[_0xa4b5('0x1b')](_0x932f39);}return null;};}function patchUpdates(_0x563c66){return function(_0x1b1342){try{jsonpatch[_0xa4b5('0x21')](_0x1b1342,_0x563c66,!![]);}catch(_0x5316dd){return BPromise[_0xa4b5('0x22')](_0x5316dd);}return _0x1b1342[_0xa4b5('0x23')]();};}function saveUpdates(_0x25184a,_0x27a821){return function(_0x3eeb03){if(_0x3eeb03){return _0x3eeb03[_0xa4b5('0x24')](_0x25184a)[_0xa4b5('0x25')](function(_0x1bd28d){return _0x1bd28d;});}return null;};}function removeEntity(_0x1188e8,_0x571ff5){return function(_0x1e78fd){if(_0x1e78fd){return _0x1e78fd[_0xa4b5('0x26')]()[_0xa4b5('0x25')](function(){_0x1188e8[_0xa4b5('0x19')](0xcc)[_0xa4b5('0x1a')]();});}};}function handleEntityNotFound(_0xb9081f,_0x1eed0d){return function(_0x55945f){if(!_0x55945f){_0xb9081f[_0xa4b5('0x18')](0x194);}return _0x55945f;};}function handleError(_0x37d35c,_0x2ba834){_0x2ba834=_0x2ba834||0x1f4;return function(_0x200255){logger[_0xa4b5('0x27')](_0x200255[_0xa4b5('0x28')]);if(_0x200255['name']){delete _0x200255[_0xa4b5('0x29')];}_0x37d35c[_0xa4b5('0x19')](_0x2ba834)[_0xa4b5('0x2a')](_0x200255);};}exports['index']=function(_0x47e16c,_0xcb081e){var _0x30b09a={},_0x408f29={},_0x52c859={'count':0x0,'rows':[]};var _0x4ba21d=_[_0xa4b5('0x2b')](db[_0xa4b5('0x2c')][_0xa4b5('0x2d')],function(_0x42188d){return{'name':_0x42188d[_0xa4b5('0x2e')],'type':_0x42188d[_0xa4b5('0x2f')][_0xa4b5('0x30')]};});_0x408f29[_0xa4b5('0x31')]=_[_0xa4b5('0x2b')](_0x4ba21d,_0xa4b5('0x29'));_0x408f29[_0xa4b5('0x32')]=_[_0xa4b5('0x33')](_0x47e16c['query']);_0x408f29['filters']=_[_0xa4b5('0x34')](_0x408f29[_0xa4b5('0x31')],_0x408f29[_0xa4b5('0x32')]);_0x30b09a['attributes']=_[_0xa4b5('0x34')](_0x408f29['model'],qs[_0xa4b5('0x35')](_0x47e16c[_0xa4b5('0x32')]['fields']));_0x30b09a[_0xa4b5('0x36')]=_0x30b09a[_0xa4b5('0x36')][_0xa4b5('0x37')]?_0x30b09a['attributes']:_0x408f29[_0xa4b5('0x31')];if(!_0x47e16c['query'][_0xa4b5('0x38')](_0xa4b5('0x39'))){_0x30b09a[_0xa4b5('0x1e')]=qs[_0xa4b5('0x1e')](_0x47e16c['query'][_0xa4b5('0x1e')]);_0x30b09a[_0xa4b5('0x1c')]=qs[_0xa4b5('0x1c')](_0x47e16c[_0xa4b5('0x32')][_0xa4b5('0x1c')]);}_0x30b09a[_0xa4b5('0x3a')]=qs['sort'](_0x47e16c['query'][_0xa4b5('0x3b')]);_0x30b09a[_0xa4b5('0x3c')]=qs['filters'](_[_0xa4b5('0x3d')](_0x47e16c[_0xa4b5('0x32')],_0x408f29[_0xa4b5('0x3e')]),_0x4ba21d);if(_0x47e16c[_0xa4b5('0x32')][_0xa4b5('0x3f')]){_0x30b09a[_0xa4b5('0x3c')]=_['merge'](_0x30b09a['where'],{'$or':_['map'](_0x4ba21d,function(_0xc03fe2){if(_0xc03fe2[_0xa4b5('0x2f')]!=='VIRTUAL'){var _0x192440={};_0x192440[_0xc03fe2[_0xa4b5('0x29')]]={'$like':'%'+_0x47e16c[_0xa4b5('0x32')][_0xa4b5('0x3f')]+'%'};return _0x192440;}})});}_0x30b09a=_[_0xa4b5('0x40')]({},_0x30b09a,_0x47e16c[_0xa4b5('0x41')]);var _0x4eac88={'where':_0x30b09a[_0xa4b5('0x3c')]};return db['ZendeskConfiguration'][_0xa4b5('0x1f')](_0x4eac88)[_0xa4b5('0x25')](function(_0x17f7b0){_0x52c859['count']=_0x17f7b0;if(_0x47e16c[_0xa4b5('0x32')][_0xa4b5('0x42')]){_0x30b09a['include']=[{'all':!![]}];}return db[_0xa4b5('0x2c')]['findAll'](_0x30b09a);})[_0xa4b5('0x25')](function(_0x213964){_0x52c859[_0xa4b5('0x43')]=_0x213964;return _0x52c859;})[_0xa4b5('0x25')](respondWithFilteredResult(_0xcb081e,_0x30b09a))[_0xa4b5('0x44')](handleError(_0xcb081e,null));};exports['show']=function(_0xa877e1,_0x3f2f0b){var _0xaf31cc={'raw':![],'where':{'id':_0xa877e1[_0xa4b5('0x45')]['id']}},_0x460801={};_0x460801['model']=_['keys'](db[_0xa4b5('0x2c')]['rawAttributes']);_0x460801[_0xa4b5('0x32')]=_[_0xa4b5('0x33')](_0xa877e1['query']);_0x460801[_0xa4b5('0x3e')]=_[_0xa4b5('0x34')](_0x460801['model'],_0x460801[_0xa4b5('0x32')]);_0xaf31cc[_0xa4b5('0x36')]=_[_0xa4b5('0x34')](_0x460801[_0xa4b5('0x31')],qs[_0xa4b5('0x35')](_0xa877e1[_0xa4b5('0x32')][_0xa4b5('0x35')]));_0xaf31cc[_0xa4b5('0x36')]=_0xaf31cc[_0xa4b5('0x36')][_0xa4b5('0x37')]?_0xaf31cc[_0xa4b5('0x36')]:_0x460801[_0xa4b5('0x31')];if(_0xa877e1[_0xa4b5('0x32')]['includeAll']){_0xaf31cc[_0xa4b5('0x46')]=[{'all':!![]}];}_0xaf31cc=_[_0xa4b5('0x40')]({},_0xaf31cc,_0xa877e1['options']);return db[_0xa4b5('0x2c')]['find'](_0xaf31cc)[_0xa4b5('0x25')](handleEntityNotFound(_0x3f2f0b,null))['then'](respondWithResult(_0x3f2f0b,null))[_0xa4b5('0x44')](handleError(_0x3f2f0b,null));};exports[_0xa4b5('0x47')]=function(_0x23c269,_0x22ec0f){return db[_0xa4b5('0x2c')][_0xa4b5('0x47')](_0x23c269[_0xa4b5('0x48')],{})[_0xa4b5('0x25')](respondWithResult(_0x22ec0f,0xc9))[_0xa4b5('0x44')](handleError(_0x22ec0f,null));};exports['update']=function(_0x2338d9,_0x34b010){if(_0x2338d9[_0xa4b5('0x48')]['id']){delete _0x2338d9[_0xa4b5('0x48')]['id'];}return db[_0xa4b5('0x2c')][_0xa4b5('0x49')]({'where':{'id':_0x2338d9[_0xa4b5('0x45')]['id']}})[_0xa4b5('0x25')](handleEntityNotFound(_0x34b010,null))[_0xa4b5('0x25')](saveUpdates(_0x2338d9[_0xa4b5('0x48')],null))[_0xa4b5('0x25')](respondWithResult(_0x34b010,null))[_0xa4b5('0x44')](handleError(_0x34b010,null));};exports[_0xa4b5('0x26')]=function(_0xdcfce7,_0x53e806){return db[_0xa4b5('0x2c')][_0xa4b5('0x49')]({'where':{'id':_0xdcfce7[_0xa4b5('0x45')]['id']}})['then'](handleEntityNotFound(_0x53e806,null))[_0xa4b5('0x25')](removeEntity(_0x53e806,null))['catch'](handleError(_0x53e806,null));};exports[_0xa4b5('0x4a')]=function(_0x109189,_0x320734,_0x3693d7){var _0x2a0834={};var _0x2de3ec={};var _0x5b6eaa;var _0x4fe32d;return db[_0xa4b5('0x2c')]['findOne']({'where':{'id':_0x109189['params']['id']}})[_0xa4b5('0x25')](handleEntityNotFound(_0x320734,null))[_0xa4b5('0x25')](function(_0x21631c){if(_0x21631c){_0x5b6eaa=_0x21631c;_0x2de3ec[_0xa4b5('0x31')]=_['keys'](db['ZendeskField'][_0xa4b5('0x2d')]);_0x2de3ec[_0xa4b5('0x32')]=_['keys'](_0x109189[_0xa4b5('0x32')]);_0x2de3ec['filters']=_[_0xa4b5('0x34')](_0x2de3ec['model'],_0x2de3ec[_0xa4b5('0x32')]);_0x2a0834['attributes']=_[_0xa4b5('0x34')](_0x2de3ec[_0xa4b5('0x31')],qs[_0xa4b5('0x35')](_0x109189['query'][_0xa4b5('0x35')]));_0x2a0834['attributes']=_0x2a0834['attributes']['length']?_0x2a0834[_0xa4b5('0x36')]:_0x2de3ec[_0xa4b5('0x31')];_0x2a0834[_0xa4b5('0x3a')]=qs['sort'](_0x109189[_0xa4b5('0x32')][_0xa4b5('0x3b')]);_0x2a0834['where']=qs[_0xa4b5('0x3e')](_[_0xa4b5('0x3d')](_0x109189[_0xa4b5('0x32')],_0x2de3ec['filters']));if(_0x109189['query'][_0xa4b5('0x3f')]){_0x2a0834[_0xa4b5('0x3c')]=_[_0xa4b5('0x40')](_0x2a0834['where'],{'$or':_['map'](_0x2a0834[_0xa4b5('0x36')],function(_0x3f9c6e){var _0x28404e={};_0x28404e[_0x3f9c6e]={'$like':'%'+_0x109189['query'][_0xa4b5('0x3f')]+'%'};return _0x28404e;})});}_0x2a0834=_[_0xa4b5('0x40')]({},_0x2a0834,_0x109189[_0xa4b5('0x41')]);return _0x5b6eaa[_0xa4b5('0x4a')](_0x2a0834);}})[_0xa4b5('0x25')](function(_0x7b7c6b){if(_0x7b7c6b){_0x4fe32d=_0x7b7c6b[_0xa4b5('0x37')];if(!_0x109189['query'][_0xa4b5('0x38')](_0xa4b5('0x39'))){_0x2a0834[_0xa4b5('0x1e')]=qs[_0xa4b5('0x1e')](_0x109189[_0xa4b5('0x32')][_0xa4b5('0x1e')]);_0x2a0834[_0xa4b5('0x1c')]=qs[_0xa4b5('0x1c')](_0x109189[_0xa4b5('0x32')]['offset']);}return _0x5b6eaa[_0xa4b5('0x4a')](_0x2a0834);}})[_0xa4b5('0x25')](function(_0x201dac){if(_0x201dac){return _0x201dac?{'count':_0x4fe32d,'rows':_0x201dac}:null;}})[_0xa4b5('0x25')](respondWithResult(_0x320734,null))[_0xa4b5('0x44')](handleError(_0x320734,null));};exports[_0xa4b5('0x4b')]=function(_0x581aec,_0x14005f,_0x42a934){var _0xf65c4b={};var _0x1615df={};var _0x3cf7d4;var _0x2d787e;return db['ZendeskConfiguration'][_0xa4b5('0x4c')]({'where':{'id':_0x581aec[_0xa4b5('0x45')]['id']}})[_0xa4b5('0x25')](handleEntityNotFound(_0x14005f,null))['then'](function(_0x1a50b4){if(_0x1a50b4){_0x3cf7d4=_0x1a50b4;_0x1615df['model']=_[_0xa4b5('0x33')](db[_0xa4b5('0x4d')][_0xa4b5('0x2d')]);_0x1615df[_0xa4b5('0x32')]=_['keys'](_0x581aec[_0xa4b5('0x32')]);_0x1615df[_0xa4b5('0x3e')]=_[_0xa4b5('0x34')](_0x1615df[_0xa4b5('0x31')],_0x1615df[_0xa4b5('0x32')]);_0xf65c4b[_0xa4b5('0x36')]=_[_0xa4b5('0x34')](_0x1615df[_0xa4b5('0x31')],qs[_0xa4b5('0x35')](_0x581aec[_0xa4b5('0x32')][_0xa4b5('0x35')]));_0xf65c4b[_0xa4b5('0x36')]=_0xf65c4b[_0xa4b5('0x36')][_0xa4b5('0x37')]?_0xf65c4b[_0xa4b5('0x36')]:_0x1615df[_0xa4b5('0x31')];_0xf65c4b[_0xa4b5('0x3a')]=qs[_0xa4b5('0x3b')](_0x581aec['query']['sort']);_0xf65c4b[_0xa4b5('0x3c')]=qs[_0xa4b5('0x3e')](_[_0xa4b5('0x3d')](_0x581aec['query'],_0x1615df[_0xa4b5('0x3e')]));if(_0x581aec[_0xa4b5('0x32')]['filter']){_0xf65c4b[_0xa4b5('0x3c')]=_[_0xa4b5('0x40')](_0xf65c4b[_0xa4b5('0x3c')],{'$or':_[_0xa4b5('0x2b')](_0xf65c4b[_0xa4b5('0x36')],function(_0x523784){var _0x509246={};_0x509246[_0x523784]={'$like':'%'+_0x581aec[_0xa4b5('0x32')][_0xa4b5('0x3f')]+'%'};return _0x509246;})});}_0xf65c4b=_[_0xa4b5('0x40')]({},_0xf65c4b,_0x581aec[_0xa4b5('0x41')]);return _0x3cf7d4[_0xa4b5('0x4b')](_0xf65c4b);}})[_0xa4b5('0x25')](function(_0x286829){if(_0x286829){_0x2d787e=_0x286829[_0xa4b5('0x37')];if(!_0x581aec[_0xa4b5('0x32')][_0xa4b5('0x38')](_0xa4b5('0x39'))){_0xf65c4b[_0xa4b5('0x1e')]=qs[_0xa4b5('0x1e')](_0x581aec[_0xa4b5('0x32')]['limit']);_0xf65c4b[_0xa4b5('0x1c')]=qs[_0xa4b5('0x1c')](_0x581aec[_0xa4b5('0x32')][_0xa4b5('0x1c')]);}return _0x3cf7d4[_0xa4b5('0x4b')](_0xf65c4b);}})[_0xa4b5('0x25')](function(_0x2028cb){if(_0x2028cb){return _0x2028cb?{'count':_0x2d787e,'rows':_0x2028cb}:null;}})[_0xa4b5('0x25')](respondWithResult(_0x14005f,null))[_0xa4b5('0x44')](handleError(_0x14005f,null));};exports['getDescriptions']=function(_0x55dadb,_0x219da6,_0x4b71f8){var _0xd70e6c={};var _0xffc8ad={};var _0x305a5c;var _0x1a544f;return db[_0xa4b5('0x2c')][_0xa4b5('0x4c')]({'where':{'id':_0x55dadb[_0xa4b5('0x45')]['id']}})[_0xa4b5('0x25')](handleEntityNotFound(_0x219da6,null))[_0xa4b5('0x25')](function(_0xf4efe3){if(_0xf4efe3){_0x305a5c=_0xf4efe3;_0xffc8ad[_0xa4b5('0x31')]=_[_0xa4b5('0x33')](db[_0xa4b5('0x4d')][_0xa4b5('0x2d')]);_0xffc8ad[_0xa4b5('0x32')]=_[_0xa4b5('0x33')](_0x55dadb[_0xa4b5('0x32')]);_0xffc8ad[_0xa4b5('0x3e')]=_[_0xa4b5('0x34')](_0xffc8ad[_0xa4b5('0x31')],_0xffc8ad[_0xa4b5('0x32')]);_0xd70e6c[_0xa4b5('0x36')]=_[_0xa4b5('0x34')](_0xffc8ad[_0xa4b5('0x31')],qs['fields'](_0x55dadb[_0xa4b5('0x32')][_0xa4b5('0x35')]));_0xd70e6c['attributes']=_0xd70e6c[_0xa4b5('0x36')][_0xa4b5('0x37')]?_0xd70e6c[_0xa4b5('0x36')]:_0xffc8ad[_0xa4b5('0x31')];_0xd70e6c[_0xa4b5('0x3a')]=qs['sort'](_0x55dadb['query']['sort']);_0xd70e6c[_0xa4b5('0x3c')]=qs[_0xa4b5('0x3e')](_['pick'](_0x55dadb[_0xa4b5('0x32')],_0xffc8ad[_0xa4b5('0x3e')]));if(_0x55dadb[_0xa4b5('0x32')][_0xa4b5('0x3f')]){_0xd70e6c[_0xa4b5('0x3c')]=_[_0xa4b5('0x40')](_0xd70e6c[_0xa4b5('0x3c')],{'$or':_['map'](_0xd70e6c[_0xa4b5('0x36')],function(_0x4b26a8){var _0x2b9d5c={};_0x2b9d5c[_0x4b26a8]={'$like':'%'+_0x55dadb[_0xa4b5('0x32')][_0xa4b5('0x3f')]+'%'};return _0x2b9d5c;})});}_0xd70e6c=_[_0xa4b5('0x40')]({},_0xd70e6c,_0x55dadb[_0xa4b5('0x41')]);return _0x305a5c[_0xa4b5('0x4e')](_0xd70e6c);}})[_0xa4b5('0x25')](function(_0xabd1a5){if(_0xabd1a5){_0x1a544f=_0xabd1a5[_0xa4b5('0x37')];if(!_0x55dadb[_0xa4b5('0x32')][_0xa4b5('0x38')]('nolimit')){_0xd70e6c[_0xa4b5('0x1e')]=qs[_0xa4b5('0x1e')](_0x55dadb[_0xa4b5('0x32')][_0xa4b5('0x1e')]);_0xd70e6c[_0xa4b5('0x1c')]=qs[_0xa4b5('0x1c')](_0x55dadb['query'][_0xa4b5('0x1c')]);}return _0x305a5c[_0xa4b5('0x4e')](_0xd70e6c);}})['then'](function(_0x39f283){if(_0x39f283){return _0x39f283?{'count':_0x1a544f,'rows':_0x39f283}:null;}})[_0xa4b5('0x25')](respondWithResult(_0x219da6,null))[_0xa4b5('0x44')](handleError(_0x219da6,null));};exports[_0xa4b5('0x4f')]=function(_0x5777b6,_0x41aa5e,_0x27d4df){var _0x1ccc3a={};var _0x423083={};var _0x46588b;var _0x27fe6f;return db[_0xa4b5('0x2c')][_0xa4b5('0x4c')]({'where':{'id':_0x5777b6[_0xa4b5('0x45')]['id']}})[_0xa4b5('0x25')](handleEntityNotFound(_0x41aa5e,null))[_0xa4b5('0x25')](function(_0x225c80){if(_0x225c80){_0x46588b=_0x225c80;_0x423083[_0xa4b5('0x31')]=_[_0xa4b5('0x33')](db[_0xa4b5('0x50')][_0xa4b5('0x2d')]);_0x423083[_0xa4b5('0x32')]=_['keys'](_0x5777b6['query']);_0x423083['filters']=_['intersection'](_0x423083[_0xa4b5('0x31')],_0x423083[_0xa4b5('0x32')]);_0x1ccc3a[_0xa4b5('0x36')]=_['intersection'](_0x423083['model'],qs['fields'](_0x5777b6[_0xa4b5('0x32')][_0xa4b5('0x35')]));_0x1ccc3a[_0xa4b5('0x36')]=_0x1ccc3a[_0xa4b5('0x36')]['length']?_0x1ccc3a[_0xa4b5('0x36')]:_0x423083[_0xa4b5('0x31')];_0x1ccc3a[_0xa4b5('0x3a')]=qs[_0xa4b5('0x3b')](_0x5777b6['query'][_0xa4b5('0x3b')]);_0x1ccc3a[_0xa4b5('0x3c')]=qs[_0xa4b5('0x3e')](_[_0xa4b5('0x3d')](_0x5777b6[_0xa4b5('0x32')],_0x423083[_0xa4b5('0x3e')]));if(_0x5777b6[_0xa4b5('0x32')][_0xa4b5('0x3f')]){_0x1ccc3a[_0xa4b5('0x3c')]=_[_0xa4b5('0x40')](_0x1ccc3a['where'],{'$or':_['map'](_0x1ccc3a['attributes'],function(_0xe6f471){var _0x2f64fb={};_0x2f64fb[_0xe6f471]={'$like':'%'+_0x5777b6[_0xa4b5('0x32')]['filter']+'%'};return _0x2f64fb;})});}_0x1ccc3a=_['merge']({},_0x1ccc3a,_0x5777b6[_0xa4b5('0x41')]);return _0x46588b[_0xa4b5('0x4f')](_0x1ccc3a);}})[_0xa4b5('0x25')](function(_0x27d110){if(_0x27d110){_0x27fe6f=_0x27d110['length'];if(!_0x5777b6[_0xa4b5('0x32')][_0xa4b5('0x38')](_0xa4b5('0x39'))){_0x1ccc3a[_0xa4b5('0x1e')]=qs[_0xa4b5('0x1e')](_0x5777b6[_0xa4b5('0x32')]['limit']);_0x1ccc3a[_0xa4b5('0x1c')]=qs[_0xa4b5('0x1c')](_0x5777b6['query'][_0xa4b5('0x1c')]);}return _0x46588b['getTags'](_0x1ccc3a);}})[_0xa4b5('0x25')](function(_0xa0f652){if(_0xa0f652){return _0xa0f652?{'count':_0x27fe6f,'rows':_0xa0f652}:null;}})['then'](respondWithResult(_0x41aa5e,null))[_0xa4b5('0x44')](handleError(_0x41aa5e,null));};exports['setTags']=function(_0x587a00,_0x123bae,_0x44839d){if(_0x587a00[_0xa4b5('0x48')]['id']){delete _0x587a00[_0xa4b5('0x48')]['id'];}return db[_0xa4b5('0x2c')][_0xa4b5('0x4c')]({'where':{'id':_0x587a00[_0xa4b5('0x45')]['id']}})[_0xa4b5('0x25')](handleEntityNotFound(_0x123bae,null))[_0xa4b5('0x25')](function(_0x2c4687){if(_0x2c4687){return _0x2c4687['setTags'](_0x587a00['body']['ids']||[]);}return null;})[_0xa4b5('0x25')](respondWithResult(_0x123bae,null))[_0xa4b5('0x44')](handleError(_0x123bae,null));}; \ No newline at end of file +var _0x6278=['send','map','ZendeskConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','find','create','body','destroy','getFields','findOne','ZendeskField','rawAttributes','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','request-promise','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','reject','save','then','error','stack','name'];(function(_0x2edde8,_0x488960){var _0x539fba=function(_0x240aff){while(--_0x240aff){_0x2edde8['push'](_0x2edde8['shift']());}};_0x539fba(++_0x488960);}(_0x6278,0x160));var _0x8627=function(_0x39ad4c,_0x2fa27e){_0x39ad4c=_0x39ad4c-0x0;var _0xf3314d=_0x6278[_0x39ad4c];return _0xf3314d;};'use strict';var emlformat=require(_0x8627('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8627('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8627('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8627('0x3'));var util=require(_0x8627('0x4'));var path=require(_0x8627('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8627('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8627('0x7'));var squel=require(_0x8627('0x8'));var crypto=require('crypto');var jsforce=require(_0x8627('0x9'));var deskjs=require(_0x8627('0xa'));var toCsv=require(_0x8627('0xb'));var querystring=require(_0x8627('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8627('0xd'));var qs=require(_0x8627('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8627('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x8627('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x8627('0x11'))['db'];function respondWithStatusCode(_0x3acf6e,_0xe1547e){_0xe1547e=_0xe1547e||0xcc;return function(_0x51ce29){if(_0x51ce29){return _0x3acf6e[_0x8627('0x12')](_0xe1547e);}return _0x3acf6e[_0x8627('0x13')](_0xe1547e)['end']();};}function respondWithResult(_0x3b3898,_0x4c4a70){_0x4c4a70=_0x4c4a70||0xc8;return function(_0x44f0f4){if(_0x44f0f4){return _0x3b3898['status'](_0x4c4a70)[_0x8627('0x14')](_0x44f0f4);}};}function respondWithFilteredResult(_0x1b7aff,_0x349795){return function(_0x56ccec){if(_0x56ccec){var _0x2b8ee5=typeof _0x349795['offset']===_0x8627('0x15')&&typeof _0x349795[_0x8627('0x16')]===_0x8627('0x15');var _0x3dab82=_0x56ccec['count'];var _0x237abe=_0x2b8ee5?0x0:_0x349795[_0x8627('0x17')];var _0x24ab34=_0x2b8ee5?_0x56ccec[_0x8627('0x18')]:_0x349795[_0x8627('0x17')]+_0x349795[_0x8627('0x16')];var _0xf9afdd;if(_0x24ab34>=_0x3dab82){_0x24ab34=_0x3dab82;_0xf9afdd=0xc8;}else{_0xf9afdd=0xce;}_0x1b7aff[_0x8627('0x13')](_0xf9afdd);return _0x1b7aff[_0x8627('0x19')](_0x8627('0x1a'),_0x237abe+'-'+_0x24ab34+'/'+_0x3dab82)[_0x8627('0x14')](_0x56ccec);}return null;};}function patchUpdates(_0x415761){return function(_0x34d950){try{jsonpatch['apply'](_0x34d950,_0x415761,!![]);}catch(_0x10b9bd){return BPromise[_0x8627('0x1b')](_0x10b9bd);}return _0x34d950[_0x8627('0x1c')]();};}function saveUpdates(_0x21f43d,_0x1b7e74){return function(_0x53d5ee){if(_0x53d5ee){return _0x53d5ee['update'](_0x21f43d)[_0x8627('0x1d')](function(_0x5a3d51){return _0x5a3d51;});}return null;};}function removeEntity(_0x2cce48,_0x31b8ab){return function(_0x13f3a6){if(_0x13f3a6){return _0x13f3a6['destroy']()[_0x8627('0x1d')](function(){_0x2cce48[_0x8627('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x412b80,_0x103f7f){return function(_0x3b68dd){if(!_0x3b68dd){_0x412b80[_0x8627('0x12')](0x194);}return _0x3b68dd;};}function handleError(_0x340d0e,_0x45967f){_0x45967f=_0x45967f||0x1f4;return function(_0x3a8a9c){logger[_0x8627('0x1e')](_0x3a8a9c[_0x8627('0x1f')]);if(_0x3a8a9c[_0x8627('0x20')]){delete _0x3a8a9c[_0x8627('0x20')];}_0x340d0e[_0x8627('0x13')](_0x45967f)[_0x8627('0x21')](_0x3a8a9c);};}exports['index']=function(_0x32f4bd,_0x158306){var _0x361650={},_0x1fe2fb={},_0x4ef9ec={'count':0x0,'rows':[]};var _0x21988d=_[_0x8627('0x22')](db[_0x8627('0x23')]['rawAttributes'],function(_0x491d60){return{'name':_0x491d60[_0x8627('0x24')],'type':_0x491d60[_0x8627('0x25')][_0x8627('0x26')]};});_0x1fe2fb[_0x8627('0x27')]=_[_0x8627('0x22')](_0x21988d,'name');_0x1fe2fb[_0x8627('0x28')]=_[_0x8627('0x29')](_0x32f4bd[_0x8627('0x28')]);_0x1fe2fb[_0x8627('0x2a')]=_[_0x8627('0x2b')](_0x1fe2fb[_0x8627('0x27')],_0x1fe2fb[_0x8627('0x28')]);_0x361650[_0x8627('0x2c')]=_['intersection'](_0x1fe2fb['model'],qs['fields'](_0x32f4bd[_0x8627('0x28')][_0x8627('0x2d')]));_0x361650[_0x8627('0x2c')]=_0x361650['attributes'][_0x8627('0x2e')]?_0x361650[_0x8627('0x2c')]:_0x1fe2fb[_0x8627('0x27')];if(!_0x32f4bd[_0x8627('0x28')][_0x8627('0x2f')](_0x8627('0x30'))){_0x361650[_0x8627('0x16')]=qs[_0x8627('0x16')](_0x32f4bd[_0x8627('0x28')][_0x8627('0x16')]);_0x361650[_0x8627('0x17')]=qs[_0x8627('0x17')](_0x32f4bd['query']['offset']);}_0x361650[_0x8627('0x31')]=qs['sort'](_0x32f4bd[_0x8627('0x28')][_0x8627('0x32')]);_0x361650[_0x8627('0x33')]=qs[_0x8627('0x2a')](_['pick'](_0x32f4bd['query'],_0x1fe2fb['filters']),_0x21988d);if(_0x32f4bd[_0x8627('0x28')][_0x8627('0x34')]){_0x361650[_0x8627('0x33')]=_['merge'](_0x361650[_0x8627('0x33')],{'$or':_[_0x8627('0x22')](_0x21988d,function(_0x405f31){if(_0x405f31[_0x8627('0x25')]!==_0x8627('0x35')){var _0x3fd463={};_0x3fd463[_0x405f31['name']]={'$like':'%'+_0x32f4bd[_0x8627('0x28')][_0x8627('0x34')]+'%'};return _0x3fd463;}})});}_0x361650=_[_0x8627('0x36')]({},_0x361650,_0x32f4bd[_0x8627('0x37')]);var _0x8c61a5={'where':_0x361650[_0x8627('0x33')]};return db[_0x8627('0x23')][_0x8627('0x18')](_0x8c61a5)[_0x8627('0x1d')](function(_0x36ffd4){_0x4ef9ec['count']=_0x36ffd4;if(_0x32f4bd[_0x8627('0x28')][_0x8627('0x38')]){_0x361650['include']=[{'all':!![]}];}return db[_0x8627('0x23')][_0x8627('0x39')](_0x361650);})[_0x8627('0x1d')](function(_0xe67f2e){_0x4ef9ec[_0x8627('0x3a')]=_0xe67f2e;return _0x4ef9ec;})[_0x8627('0x1d')](respondWithFilteredResult(_0x158306,_0x361650))[_0x8627('0x3b')](handleError(_0x158306,null));};exports[_0x8627('0x3c')]=function(_0xd110,_0x27484b){var _0x135f7e={'raw':![],'where':{'id':_0xd110[_0x8627('0x3d')]['id']}},_0x27fd02={};_0x27fd02[_0x8627('0x27')]=_[_0x8627('0x29')](db[_0x8627('0x23')]['rawAttributes']);_0x27fd02[_0x8627('0x28')]=_[_0x8627('0x29')](_0xd110[_0x8627('0x28')]);_0x27fd02['filters']=_['intersection'](_0x27fd02[_0x8627('0x27')],_0x27fd02[_0x8627('0x28')]);_0x135f7e[_0x8627('0x2c')]=_['intersection'](_0x27fd02[_0x8627('0x27')],qs[_0x8627('0x2d')](_0xd110[_0x8627('0x28')]['fields']));_0x135f7e[_0x8627('0x2c')]=_0x135f7e[_0x8627('0x2c')][_0x8627('0x2e')]?_0x135f7e[_0x8627('0x2c')]:_0x27fd02['model'];if(_0xd110['query'][_0x8627('0x38')]){_0x135f7e['include']=[{'all':!![]}];}_0x135f7e=_[_0x8627('0x36')]({},_0x135f7e,_0xd110[_0x8627('0x37')]);return db['ZendeskConfiguration'][_0x8627('0x3e')](_0x135f7e)[_0x8627('0x1d')](handleEntityNotFound(_0x27484b,null))['then'](respondWithResult(_0x27484b,null))['catch'](handleError(_0x27484b,null));};exports[_0x8627('0x3f')]=function(_0x5ad6f4,_0x16c509){return db['ZendeskConfiguration'][_0x8627('0x3f')](_0x5ad6f4[_0x8627('0x40')],{})[_0x8627('0x1d')](respondWithResult(_0x16c509,0xc9))[_0x8627('0x3b')](handleError(_0x16c509,null));};exports['update']=function(_0x43f78d,_0x1f0c2c){if(_0x43f78d['body']['id']){delete _0x43f78d[_0x8627('0x40')]['id'];}return db[_0x8627('0x23')][_0x8627('0x3e')]({'where':{'id':_0x43f78d[_0x8627('0x3d')]['id']}})[_0x8627('0x1d')](handleEntityNotFound(_0x1f0c2c,null))[_0x8627('0x1d')](saveUpdates(_0x43f78d[_0x8627('0x40')],null))[_0x8627('0x1d')](respondWithResult(_0x1f0c2c,null))[_0x8627('0x3b')](handleError(_0x1f0c2c,null));};exports[_0x8627('0x41')]=function(_0x114bc4,_0x118ef1){return db['ZendeskConfiguration'][_0x8627('0x3e')]({'where':{'id':_0x114bc4[_0x8627('0x3d')]['id']}})[_0x8627('0x1d')](handleEntityNotFound(_0x118ef1,null))[_0x8627('0x1d')](removeEntity(_0x118ef1,null))[_0x8627('0x3b')](handleError(_0x118ef1,null));};exports[_0x8627('0x42')]=function(_0x4684a8,_0x34b1e4,_0x178567){var _0x3812dc={};var _0x373c80={};var _0x864a;var _0x5c575e;return db[_0x8627('0x23')][_0x8627('0x43')]({'where':{'id':_0x4684a8[_0x8627('0x3d')]['id']}})['then'](handleEntityNotFound(_0x34b1e4,null))[_0x8627('0x1d')](function(_0x45240f){if(_0x45240f){_0x864a=_0x45240f;_0x373c80[_0x8627('0x27')]=_['keys'](db[_0x8627('0x44')][_0x8627('0x45')]);_0x373c80[_0x8627('0x28')]=_[_0x8627('0x29')](_0x4684a8[_0x8627('0x28')]);_0x373c80[_0x8627('0x2a')]=_[_0x8627('0x2b')](_0x373c80[_0x8627('0x27')],_0x373c80[_0x8627('0x28')]);_0x3812dc[_0x8627('0x2c')]=_[_0x8627('0x2b')](_0x373c80[_0x8627('0x27')],qs[_0x8627('0x2d')](_0x4684a8[_0x8627('0x28')][_0x8627('0x2d')]));_0x3812dc[_0x8627('0x2c')]=_0x3812dc['attributes'][_0x8627('0x2e')]?_0x3812dc['attributes']:_0x373c80[_0x8627('0x27')];_0x3812dc[_0x8627('0x31')]=qs[_0x8627('0x32')](_0x4684a8[_0x8627('0x28')][_0x8627('0x32')]);_0x3812dc[_0x8627('0x33')]=qs[_0x8627('0x2a')](_[_0x8627('0x46')](_0x4684a8[_0x8627('0x28')],_0x373c80[_0x8627('0x2a')]));if(_0x4684a8['query'][_0x8627('0x34')]){_0x3812dc['where']=_['merge'](_0x3812dc['where'],{'$or':_['map'](_0x3812dc[_0x8627('0x2c')],function(_0x351460){var _0x27820b={};_0x27820b[_0x351460]={'$like':'%'+_0x4684a8[_0x8627('0x28')][_0x8627('0x34')]+'%'};return _0x27820b;})});}_0x3812dc=_[_0x8627('0x36')]({},_0x3812dc,_0x4684a8[_0x8627('0x37')]);return _0x864a[_0x8627('0x42')](_0x3812dc);}})['then'](function(_0x56ae68){if(_0x56ae68){_0x5c575e=_0x56ae68['length'];if(!_0x4684a8[_0x8627('0x28')][_0x8627('0x2f')](_0x8627('0x30'))){_0x3812dc[_0x8627('0x16')]=qs['limit'](_0x4684a8[_0x8627('0x28')][_0x8627('0x16')]);_0x3812dc[_0x8627('0x17')]=qs[_0x8627('0x17')](_0x4684a8[_0x8627('0x28')][_0x8627('0x17')]);}return _0x864a[_0x8627('0x42')](_0x3812dc);}})[_0x8627('0x1d')](function(_0x27809a){if(_0x27809a){return _0x27809a?{'count':_0x5c575e,'rows':_0x27809a}:null;}})['then'](respondWithResult(_0x34b1e4,null))[_0x8627('0x3b')](handleError(_0x34b1e4,null));};exports[_0x8627('0x47')]=function(_0x317551,_0x40f411,_0x1b332b){var _0x1e3c48={};var _0x15c3cc={};var _0x5dadf1;var _0x55d96e;return db[_0x8627('0x23')][_0x8627('0x43')]({'where':{'id':_0x317551[_0x8627('0x3d')]['id']}})['then'](handleEntityNotFound(_0x40f411,null))[_0x8627('0x1d')](function(_0x2fe4d5){if(_0x2fe4d5){_0x5dadf1=_0x2fe4d5;_0x15c3cc[_0x8627('0x27')]=_[_0x8627('0x29')](db[_0x8627('0x44')]['rawAttributes']);_0x15c3cc[_0x8627('0x28')]=_[_0x8627('0x29')](_0x317551['query']);_0x15c3cc[_0x8627('0x2a')]=_['intersection'](_0x15c3cc[_0x8627('0x27')],_0x15c3cc['query']);_0x1e3c48[_0x8627('0x2c')]=_[_0x8627('0x2b')](_0x15c3cc[_0x8627('0x27')],qs['fields'](_0x317551[_0x8627('0x28')][_0x8627('0x2d')]));_0x1e3c48[_0x8627('0x2c')]=_0x1e3c48['attributes'][_0x8627('0x2e')]?_0x1e3c48[_0x8627('0x2c')]:_0x15c3cc[_0x8627('0x27')];_0x1e3c48[_0x8627('0x31')]=qs[_0x8627('0x32')](_0x317551[_0x8627('0x28')]['sort']);_0x1e3c48[_0x8627('0x33')]=qs[_0x8627('0x2a')](_[_0x8627('0x46')](_0x317551[_0x8627('0x28')],_0x15c3cc[_0x8627('0x2a')]));if(_0x317551[_0x8627('0x28')][_0x8627('0x34')]){_0x1e3c48[_0x8627('0x33')]=_['merge'](_0x1e3c48[_0x8627('0x33')],{'$or':_['map'](_0x1e3c48['attributes'],function(_0x3d79c0){var _0x86c0eb={};_0x86c0eb[_0x3d79c0]={'$like':'%'+_0x317551[_0x8627('0x28')][_0x8627('0x34')]+'%'};return _0x86c0eb;})});}_0x1e3c48=_[_0x8627('0x36')]({},_0x1e3c48,_0x317551[_0x8627('0x37')]);return _0x5dadf1[_0x8627('0x47')](_0x1e3c48);}})[_0x8627('0x1d')](function(_0x2475f1){if(_0x2475f1){_0x55d96e=_0x2475f1[_0x8627('0x2e')];if(!_0x317551[_0x8627('0x28')][_0x8627('0x2f')]('nolimit')){_0x1e3c48[_0x8627('0x16')]=qs[_0x8627('0x16')](_0x317551['query']['limit']);_0x1e3c48[_0x8627('0x17')]=qs[_0x8627('0x17')](_0x317551[_0x8627('0x28')]['offset']);}return _0x5dadf1['getSubjects'](_0x1e3c48);}})[_0x8627('0x1d')](function(_0x4dbbac){if(_0x4dbbac){return _0x4dbbac?{'count':_0x55d96e,'rows':_0x4dbbac}:null;}})[_0x8627('0x1d')](respondWithResult(_0x40f411,null))[_0x8627('0x3b')](handleError(_0x40f411,null));};exports[_0x8627('0x48')]=function(_0x99cec0,_0x3d6649,_0x4e20db){var _0x4e5637={};var _0x3f70cb={};var _0x359dc9;var _0x4d6d53;return db['ZendeskConfiguration'][_0x8627('0x43')]({'where':{'id':_0x99cec0['params']['id']}})['then'](handleEntityNotFound(_0x3d6649,null))[_0x8627('0x1d')](function(_0x4e1ae6){if(_0x4e1ae6){_0x359dc9=_0x4e1ae6;_0x3f70cb[_0x8627('0x27')]=_[_0x8627('0x29')](db['ZendeskField']['rawAttributes']);_0x3f70cb[_0x8627('0x28')]=_[_0x8627('0x29')](_0x99cec0[_0x8627('0x28')]);_0x3f70cb[_0x8627('0x2a')]=_[_0x8627('0x2b')](_0x3f70cb[_0x8627('0x27')],_0x3f70cb[_0x8627('0x28')]);_0x4e5637[_0x8627('0x2c')]=_[_0x8627('0x2b')](_0x3f70cb['model'],qs[_0x8627('0x2d')](_0x99cec0[_0x8627('0x28')]['fields']));_0x4e5637[_0x8627('0x2c')]=_0x4e5637[_0x8627('0x2c')]['length']?_0x4e5637[_0x8627('0x2c')]:_0x3f70cb['model'];_0x4e5637[_0x8627('0x31')]=qs[_0x8627('0x32')](_0x99cec0['query'][_0x8627('0x32')]);_0x4e5637[_0x8627('0x33')]=qs[_0x8627('0x2a')](_[_0x8627('0x46')](_0x99cec0[_0x8627('0x28')],_0x3f70cb[_0x8627('0x2a')]));if(_0x99cec0[_0x8627('0x28')][_0x8627('0x34')]){_0x4e5637[_0x8627('0x33')]=_[_0x8627('0x36')](_0x4e5637['where'],{'$or':_[_0x8627('0x22')](_0x4e5637[_0x8627('0x2c')],function(_0x2af9dc){var _0x35e32e={};_0x35e32e[_0x2af9dc]={'$like':'%'+_0x99cec0[_0x8627('0x28')][_0x8627('0x34')]+'%'};return _0x35e32e;})});}_0x4e5637=_[_0x8627('0x36')]({},_0x4e5637,_0x99cec0['options']);return _0x359dc9[_0x8627('0x48')](_0x4e5637);}})['then'](function(_0x5b31d8){if(_0x5b31d8){_0x4d6d53=_0x5b31d8[_0x8627('0x2e')];if(!_0x99cec0[_0x8627('0x28')][_0x8627('0x2f')](_0x8627('0x30'))){_0x4e5637['limit']=qs[_0x8627('0x16')](_0x99cec0[_0x8627('0x28')]['limit']);_0x4e5637[_0x8627('0x17')]=qs[_0x8627('0x17')](_0x99cec0['query'][_0x8627('0x17')]);}return _0x359dc9[_0x8627('0x48')](_0x4e5637);}})[_0x8627('0x1d')](function(_0xe9dba1){if(_0xe9dba1){return _0xe9dba1?{'count':_0x4d6d53,'rows':_0xe9dba1}:null;}})['then'](respondWithResult(_0x3d6649,null))[_0x8627('0x3b')](handleError(_0x3d6649,null));};exports[_0x8627('0x49')]=function(_0x11bc93,_0x2f55c3,_0x52a585){var _0x54e237={};var _0x32d39f={};var _0x246170;var _0x170014;return db[_0x8627('0x23')]['findOne']({'where':{'id':_0x11bc93[_0x8627('0x3d')]['id']}})[_0x8627('0x1d')](handleEntityNotFound(_0x2f55c3,null))['then'](function(_0x549c69){if(_0x549c69){_0x246170=_0x549c69;_0x32d39f[_0x8627('0x27')]=_['keys'](db[_0x8627('0x4a')][_0x8627('0x45')]);_0x32d39f[_0x8627('0x28')]=_[_0x8627('0x29')](_0x11bc93[_0x8627('0x28')]);_0x32d39f['filters']=_[_0x8627('0x2b')](_0x32d39f[_0x8627('0x27')],_0x32d39f['query']);_0x54e237['attributes']=_[_0x8627('0x2b')](_0x32d39f[_0x8627('0x27')],qs[_0x8627('0x2d')](_0x11bc93['query'][_0x8627('0x2d')]));_0x54e237[_0x8627('0x2c')]=_0x54e237[_0x8627('0x2c')][_0x8627('0x2e')]?_0x54e237['attributes']:_0x32d39f[_0x8627('0x27')];_0x54e237[_0x8627('0x31')]=qs['sort'](_0x11bc93[_0x8627('0x28')][_0x8627('0x32')]);_0x54e237[_0x8627('0x33')]=qs[_0x8627('0x2a')](_[_0x8627('0x46')](_0x11bc93[_0x8627('0x28')],_0x32d39f[_0x8627('0x2a')]));if(_0x11bc93[_0x8627('0x28')][_0x8627('0x34')]){_0x54e237[_0x8627('0x33')]=_[_0x8627('0x36')](_0x54e237['where'],{'$or':_['map'](_0x54e237['attributes'],function(_0x1bea7f){var _0x501634={};_0x501634[_0x1bea7f]={'$like':'%'+_0x11bc93[_0x8627('0x28')]['filter']+'%'};return _0x501634;})});}_0x54e237=_[_0x8627('0x36')]({},_0x54e237,_0x11bc93['options']);return _0x246170[_0x8627('0x49')](_0x54e237);}})['then'](function(_0x43eee8){if(_0x43eee8){_0x170014=_0x43eee8[_0x8627('0x2e')];if(!_0x11bc93[_0x8627('0x28')][_0x8627('0x2f')](_0x8627('0x30'))){_0x54e237[_0x8627('0x16')]=qs[_0x8627('0x16')](_0x11bc93[_0x8627('0x28')][_0x8627('0x16')]);_0x54e237[_0x8627('0x17')]=qs[_0x8627('0x17')](_0x11bc93[_0x8627('0x28')][_0x8627('0x17')]);}return _0x246170[_0x8627('0x49')](_0x54e237);}})[_0x8627('0x1d')](function(_0x28ce68){if(_0x28ce68){return _0x28ce68?{'count':_0x170014,'rows':_0x28ce68}:null;}})['then'](respondWithResult(_0x2f55c3,null))[_0x8627('0x3b')](handleError(_0x2f55c3,null));};exports['setTags']=function(_0x493a65,_0x402335,_0x2da251){if(_0x493a65[_0x8627('0x40')]['id']){delete _0x493a65[_0x8627('0x40')]['id'];}return db[_0x8627('0x23')]['findOne']({'where':{'id':_0x493a65[_0x8627('0x3d')]['id']}})['then'](handleEntityNotFound(_0x402335,null))['then'](function(_0x1d685f){if(_0x1d685f){return _0x1d685f[_0x8627('0x4b')](_0x493a65[_0x8627('0x40')][_0x8627('0x4c')]||[]);}return null;})[_0x8627('0x1d')](respondWithResult(_0x402335,null))[_0x8627('0x3b')](handleError(_0x402335,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 0d0e1b3..a946b3a 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 _0xe820=['exports','define','ZendeskConfiguration','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x51730e,_0x53967b){var _0x3b7bde=function(_0x3e1c19){while(--_0x3e1c19){_0x51730e['push'](_0x51730e['shift']());}};_0x3b7bde(++_0x53967b);}(_0xe820,0xd2));var _0x0e82=function(_0x429b5d,_0x35bd1f){_0x429b5d=_0x429b5d-0x0;var _0x3f2add=_0xe820[_0x429b5d];return _0x3f2add;};'use strict';var _=require(_0x0e82('0x0'));var util=require('util');var logger=require(_0x0e82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0e82('0x2'));var rp=require(_0x0e82('0x3'));var fs=require('fs');var path=require(_0x0e82('0x4'));var rimraf=require('rimraf');var config=require(_0x0e82('0x5'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x0e82('0x6')]=function(_0x105e3c,_0x69e27f){return _0x105e3c[_0x0e82('0x7')](_0x0e82('0x8'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x282b=['moment','path','../../config/environment','./intZendeskConfiguration.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0x286df4,_0x158ff6){var _0x58b14f=function(_0x428a97){while(--_0x428a97){_0x286df4['push'](_0x286df4['shift']());}};_0x58b14f(++_0x158ff6);}(_0x282b,0xec));var _0xb282=function(_0x807196,_0x5c8da2){_0x807196=_0x807196-0x0;var _0x2d5c37=_0x282b[_0x807196];return _0x2d5c37;};'use strict';var _=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var logger=require(_0xb282('0x2'))(_0xb282('0x3'));var moment=require(_0xb282('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb282('0x5'));var rimraf=require('rimraf');var config=require(_0xb282('0x6'));var attributes=require(_0xb282('0x7'));module[_0xb282('0x8')]=function(_0x1dd19b,_0x3cad41){return _0x1dd19b[_0xb282('0x9')]('ZendeskConfiguration',attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index c7883de..9431967 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 _0x966b=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment'];(function(_0x3f668b,_0xcba594){var _0x28d35f=function(_0x892e30){while(--_0x892e30){_0x3f668b['push'](_0x3f668b['shift']());}};_0x28d35f(++_0xcba594);}(_0x966b,0x195));var _0xb966=function(_0x2d97b1,_0x1c42d7){_0x2d97b1=_0x2d97b1-0x0;var _0x4e5249=_0x966b[_0x2d97b1];return _0x4e5249;};'use strict';var _=require(_0xb966('0x0'));var util=require(_0xb966('0x1'));var moment=require(_0xb966('0x2'));var BPromise=require('bluebird');var rs=require(_0xb966('0x3'));var fs=require('fs');var Redis=require(_0xb966('0x4'));var db=require(_0xb966('0x5'))['db'];var utils=require(_0xb966('0x6'));var logger=require(_0xb966('0x7'))(_0xb966('0x8'));var config=require(_0xb966('0x9'));var jayson=require(_0xb966('0xa'));var client=jayson[_0xb966('0xb')][_0xb966('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3364fa,_0x10fbd7,_0x2ea288){return new BPromise(function(_0x24d508,_0x7c1598){return client[_0xb966('0xd')](_0x3364fa,_0x2ea288)[_0xb966('0xe')](function(_0xa15ae4){logger[_0xb966('0xf')](_0xb966('0x10'),_0x10fbd7,_0xb966('0x11'));logger[_0xb966('0x12')](_0xb966('0x13'),_0x10fbd7,_0xb966('0x11'),JSON['stringify'](_0xa15ae4));if(_0xa15ae4[_0xb966('0x14')]){if(_0xa15ae4[_0xb966('0x14')][_0xb966('0x15')]===0x1f4){logger['error'](_0xb966('0x10'),_0x10fbd7,_0xa15ae4[_0xb966('0x14')][_0xb966('0x16')]);return _0x7c1598(_0xa15ae4['error'][_0xb966('0x16')]);}logger[_0xb966('0x14')](_0xb966('0x10'),_0x10fbd7,_0xa15ae4[_0xb966('0x14')]['message']);return _0x24d508(_0xa15ae4[_0xb966('0x14')][_0xb966('0x16')]);}else{logger[_0xb966('0xf')](_0xb966('0x10'),_0x10fbd7,_0xb966('0x11'));_0x24d508(_0xa15ae4[_0xb966('0x17')][_0xb966('0x16')]);}})['catch'](function(_0x230426){logger[_0xb966('0x14')](_0xb966('0x10'),_0x10fbd7,_0x230426);_0x7c1598(_0x230426);});});} \ No newline at end of file +var _0xbff4=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x3a02af,_0x434e1f){var _0x10068c=function(_0x1e453c){while(--_0x1e453c){_0x3a02af['push'](_0x3a02af['shift']());}};_0x10068c(++_0x434e1f);}(_0xbff4,0xcc));var _0x4bff=function(_0x19cce8,_0x23a814){_0x19cce8=_0x19cce8-0x0;var _0x575f93=_0xbff4[_0x19cce8];return _0x575f93;};'use strict';var _=require(_0x4bff('0x0'));var util=require(_0x4bff('0x1'));var moment=require(_0x4bff('0x2'));var BPromise=require('bluebird');var rs=require(_0x4bff('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4bff('0x4'));var logger=require(_0x4bff('0x5'))(_0x4bff('0x6'));var config=require(_0x4bff('0x7'));var jayson=require(_0x4bff('0x8'));var client=jayson[_0x4bff('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x153acd,_0x2f8057,_0x2a4ea5){return new BPromise(function(_0x350116,_0x2d0ec8){return client[_0x4bff('0xa')](_0x153acd,_0x2a4ea5)['then'](function(_0x371b30){logger[_0x4bff('0xb')](_0x4bff('0xc'),_0x2f8057,_0x4bff('0xd'));logger[_0x4bff('0xe')](_0x4bff('0xf'),_0x2f8057,_0x4bff('0xd'),JSON[_0x4bff('0x10')](_0x371b30));if(_0x371b30[_0x4bff('0x11')]){if(_0x371b30[_0x4bff('0x11')][_0x4bff('0x12')]===0x1f4){logger[_0x4bff('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2f8057,_0x371b30[_0x4bff('0x11')][_0x4bff('0x13')]);return _0x2d0ec8(_0x371b30[_0x4bff('0x11')]['message']);}logger[_0x4bff('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2f8057,_0x371b30['error'][_0x4bff('0x13')]);return _0x350116(_0x371b30[_0x4bff('0x11')][_0x4bff('0x13')]);}else{logger[_0x4bff('0xb')](_0x4bff('0xc'),_0x2f8057,_0x4bff('0xd'));_0x350116(_0x371b30[_0x4bff('0x14')][_0x4bff('0x13')]);}})[_0x4bff('0x15')](function(_0x1868de){logger['error'](_0x4bff('0xc'),_0x2f8057,_0x1868de);_0x2d0ec8(_0x1868de);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 6bcceaf..3c5bbe9 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 _0x1efb=['./intZendeskField.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4b900b,_0x2d904f){var _0x1ca9cb=function(_0x373c96){while(--_0x373c96){_0x4b900b['push'](_0x4b900b['shift']());}};_0x1ca9cb(++_0x2d904f);}(_0x1efb,0x1a2));var _0xb1ef=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x1efb[_0x2b7764];return _0x848dcb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb1ef('0x0'));var timeout=require(_0xb1ef('0x1'));var express=require(_0xb1ef('0x2'));var router=express[_0xb1ef('0x3')]();var fs_extra=require(_0xb1ef('0x4'));var auth=require(_0xb1ef('0x5'));var interaction=require(_0xb1ef('0x6'));var config=require('../../config/environment');var controller=require(_0xb1ef('0x7'));router['get']('/',auth[_0xb1ef('0x8')](),controller[_0xb1ef('0x9')]);router[_0xb1ef('0xa')](_0xb1ef('0xb'),auth[_0xb1ef('0x8')](),controller[_0xb1ef('0xc')]);router[_0xb1ef('0xd')]('/',auth[_0xb1ef('0x8')](),controller[_0xb1ef('0xe')]);router['put'](_0xb1ef('0xb'),auth[_0xb1ef('0x8')](),controller['update']);router[_0xb1ef('0xf')](_0xb1ef('0xb'),auth[_0xb1ef('0x8')](),controller[_0xb1ef('0x10')]);module['exports']=router; \ No newline at end of file +var _0xa3e5=['create','put','/:id','update','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','show'];(function(_0x2a011d,_0x531197){var _0xc72761=function(_0x549e0b){while(--_0x549e0b){_0x2a011d['push'](_0x2a011d['shift']());}};_0xc72761(++_0x531197);}(_0xa3e5,0x16b));var _0x5a3e=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xa3e5[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5a3e('0x0'));var express=require(_0x5a3e('0x1'));var router=express[_0x5a3e('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5a3e('0x3'));var interaction=require(_0x5a3e('0x4'));var config=require(_0x5a3e('0x5'));var controller=require(_0x5a3e('0x6'));router[_0x5a3e('0x7')]('/',auth[_0x5a3e('0x8')](),controller[_0x5a3e('0x9')]);router['get']('/:id',auth[_0x5a3e('0x8')](),controller[_0x5a3e('0xa')]);router['post']('/',auth[_0x5a3e('0x8')](),controller[_0x5a3e('0xb')]);router[_0x5a3e('0xc')](_0x5a3e('0xd'),auth[_0x5a3e('0x8')](),controller[_0x5a3e('0xe')]);router['delete'](_0x5a3e('0xd'),auth['isAuthenticated'](),controller[_0x5a3e('0xf')]);module[_0x5a3e('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 825ef87..330ff03 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 _0xdd7a=['string','picklist','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x1ca3e0,_0x5d7ad7){var _0x5d8ffe=function(_0x488787){while(--_0x488787){_0x1ca3e0['push'](_0x1ca3e0['shift']());}};_0x5d8ffe(++_0x5d7ad7);}(_0xdd7a,0x75));var _0xadd7=function(_0x5138b6,_0x28bf7a){_0x5138b6=_0x5138b6-0x0;var _0x3872eb=_0xdd7a[_0x5138b6];return _0x3872eb;};'use strict';var Sequelize=require(_0xadd7('0x0'));module[_0xadd7('0x1')]={'type':{'type':Sequelize['ENUM'](_0xadd7('0x2'),'variable','customVariable','keyValue',_0xadd7('0x3')),'defaultValue':_0xadd7('0x2')},'content':{'type':Sequelize[_0xadd7('0x4')]},'key':{'type':Sequelize[_0xadd7('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0xadd7('0x2'),_0xadd7('0x5'),'customVariable')},'keyContent':{'type':Sequelize[_0xadd7('0x4')]},'idField':{'type':Sequelize[_0xadd7('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xadd7('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xadd7('0x4')]}}; \ No newline at end of file +var _0xf2a8=['string','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xf2a8,0x14e));var _0x8f2a=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xf2a8[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x8f2a('0x0'));module['exports']={'type':{'type':Sequelize[_0x8f2a('0x1')](_0x8f2a('0x2'),'variable',_0x8f2a('0x3'),_0x8f2a('0x4'),_0x8f2a('0x5')),'defaultValue':_0x8f2a('0x2')},'content':{'type':Sequelize[_0x8f2a('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x8f2a('0x2'),'variable',_0x8f2a('0x3'))},'keyContent':{'type':Sequelize[_0x8f2a('0x6')]},'idField':{'type':Sequelize[_0x8f2a('0x6')]},'nameField':{'type':Sequelize[_0x8f2a('0x6')]},'customField':{'type':Sequelize[_0x8f2a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8f2a('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 04137d3..7f5faf9 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 _0x67bf=['merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','filters','create','body','update','find','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','json','reject','then','error','stack','name','send','index','map','ZendeskField','fieldName','key','model','query','attributes','intersection','fields','length','nolimit','order','sort','where'];(function(_0x2c44a8,_0xf161e6){var _0x28832a=function(_0x5f39df){while(--_0x5f39df){_0x2c44a8['push'](_0x2c44a8['shift']());}};_0x28832a(++_0xf161e6);}(_0x67bf,0xe1));var _0xf67b=function(_0xb8ab46,_0x38c556){_0xb8ab46=_0xb8ab46-0x0;var _0x28ce92=_0x67bf[_0xb8ab46];return _0x28ce92;};'use strict';var emlformat=require(_0xf67b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf67b('0x1'));var jsonpatch=require(_0xf67b('0x2'));var rp=require(_0xf67b('0x3'));var moment=require(_0xf67b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf67b('0x5'));var util=require(_0xf67b('0x6'));var path=require(_0xf67b('0x7'));var sox=require(_0xf67b('0x8'));var csv=require(_0xf67b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf67b('0xa'));var _=require(_0xf67b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf67b('0xc'));var toCsv=require(_0xf67b('0x9'));var querystring=require(_0xf67b('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf67b('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf67b('0xf'));var hardwareService=require(_0xf67b('0x10'));var logger=require(_0xf67b('0x11'))(_0xf67b('0x12'));var utils=require(_0xf67b('0x13'));var config=require(_0xf67b('0x14'));var licenseUtil=require(_0xf67b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x813f32,_0x30828a){_0x30828a=_0x30828a||0xcc;return function(_0x39c412){if(_0x39c412){return _0x813f32[_0xf67b('0x16')](_0x30828a);}return _0x813f32[_0xf67b('0x17')](_0x30828a)[_0xf67b('0x18')]();};}function respondWithResult(_0x40b6a2,_0x1929ea){_0x1929ea=_0x1929ea||0xc8;return function(_0x459792){if(_0x459792){return _0x40b6a2['status'](_0x1929ea)['json'](_0x459792);}};}function respondWithFilteredResult(_0x53dbe7,_0x4ee46a){return function(_0x4301fc){if(_0x4301fc){var _0x34432a=typeof _0x4ee46a['offset']==='undefined'&&typeof _0x4ee46a['limit']===_0xf67b('0x19');var _0x2916e5=_0x4301fc[_0xf67b('0x1a')];var _0x1d153e=_0x34432a?0x0:_0x4ee46a[_0xf67b('0x1b')];var _0x20fb7f=_0x34432a?_0x4301fc[_0xf67b('0x1a')]:_0x4ee46a[_0xf67b('0x1b')]+_0x4ee46a[_0xf67b('0x1c')];var _0x1a66fe;if(_0x20fb7f>=_0x2916e5){_0x20fb7f=_0x2916e5;_0x1a66fe=0xc8;}else{_0x1a66fe=0xce;}_0x53dbe7[_0xf67b('0x17')](_0x1a66fe);return _0x53dbe7['set']('Content-Range',_0x1d153e+'-'+_0x20fb7f+'/'+_0x2916e5)[_0xf67b('0x1d')](_0x4301fc);}return null;};}function patchUpdates(_0x1e0cfc){return function(_0xea1f59){try{jsonpatch['apply'](_0xea1f59,_0x1e0cfc,!![]);}catch(_0x5e07b5){return BPromise[_0xf67b('0x1e')](_0x5e07b5);}return _0xea1f59['save']();};}function saveUpdates(_0x1255be,_0xb847dc){return function(_0x4366f0){if(_0x4366f0){return _0x4366f0['update'](_0x1255be)[_0xf67b('0x1f')](function(_0x3b93c1){return _0x3b93c1;});}return null;};}function removeEntity(_0x5371f5,_0x2a74d2){return function(_0x227ed6){if(_0x227ed6){return _0x227ed6['destroy']()[_0xf67b('0x1f')](function(){_0x5371f5['status'](0xcc)[_0xf67b('0x18')]();});}};}function handleEntityNotFound(_0xe7c1c6,_0x11349f){return function(_0x527657){if(!_0x527657){_0xe7c1c6[_0xf67b('0x16')](0x194);}return _0x527657;};}function handleError(_0x3d1fee,_0x31134a){_0x31134a=_0x31134a||0x1f4;return function(_0x476219){logger[_0xf67b('0x20')](_0x476219[_0xf67b('0x21')]);if(_0x476219[_0xf67b('0x22')]){delete _0x476219[_0xf67b('0x22')];}_0x3d1fee['status'](_0x31134a)[_0xf67b('0x23')](_0x476219);};}exports[_0xf67b('0x24')]=function(_0x2e0a25,_0x18f86d){var _0x2e62d4={},_0x558e27={},_0xf34fca={'count':0x0,'rows':[]};var _0x277eaf=_[_0xf67b('0x25')](db[_0xf67b('0x26')]['rawAttributes'],function(_0x46d3e0){return{'name':_0x46d3e0[_0xf67b('0x27')],'type':_0x46d3e0['type'][_0xf67b('0x28')]};});_0x558e27[_0xf67b('0x29')]=_['map'](_0x277eaf,'name');_0x558e27['query']=_['keys'](_0x2e0a25[_0xf67b('0x2a')]);_0x558e27['filters']=_['intersection'](_0x558e27[_0xf67b('0x29')],_0x558e27[_0xf67b('0x2a')]);_0x2e62d4[_0xf67b('0x2b')]=_[_0xf67b('0x2c')](_0x558e27['model'],qs[_0xf67b('0x2d')](_0x2e0a25['query'][_0xf67b('0x2d')]));_0x2e62d4['attributes']=_0x2e62d4[_0xf67b('0x2b')][_0xf67b('0x2e')]?_0x2e62d4[_0xf67b('0x2b')]:_0x558e27[_0xf67b('0x29')];if(!_0x2e0a25[_0xf67b('0x2a')]['hasOwnProperty'](_0xf67b('0x2f'))){_0x2e62d4[_0xf67b('0x1c')]=qs['limit'](_0x2e0a25[_0xf67b('0x2a')][_0xf67b('0x1c')]);_0x2e62d4['offset']=qs[_0xf67b('0x1b')](_0x2e0a25[_0xf67b('0x2a')][_0xf67b('0x1b')]);}_0x2e62d4[_0xf67b('0x30')]=qs[_0xf67b('0x31')](_0x2e0a25[_0xf67b('0x2a')][_0xf67b('0x31')]);_0x2e62d4[_0xf67b('0x32')]=qs['filters'](_['pick'](_0x2e0a25[_0xf67b('0x2a')],_0x558e27['filters']),_0x277eaf);if(_0x2e0a25[_0xf67b('0x2a')]['filter']){_0x2e62d4[_0xf67b('0x32')]=_[_0xf67b('0x33')](_0x2e62d4[_0xf67b('0x32')],{'$or':_[_0xf67b('0x25')](_0x277eaf,function(_0x467a6e){if(_0x467a6e['type']!==_0xf67b('0x34')){var _0x30ad26={};_0x30ad26[_0x467a6e[_0xf67b('0x22')]]={'$like':'%'+_0x2e0a25[_0xf67b('0x2a')][_0xf67b('0x35')]+'%'};return _0x30ad26;}})});}_0x2e62d4=_['merge']({},_0x2e62d4,_0x2e0a25[_0xf67b('0x36')]);var _0xc7b087={'where':_0x2e62d4[_0xf67b('0x32')]};return db[_0xf67b('0x26')][_0xf67b('0x1a')](_0xc7b087)['then'](function(_0x2fd02c){_0xf34fca[_0xf67b('0x1a')]=_0x2fd02c;if(_0x2e0a25[_0xf67b('0x2a')][_0xf67b('0x37')]){_0x2e62d4[_0xf67b('0x38')]=[{'all':!![]}];}return db[_0xf67b('0x26')]['findAll'](_0x2e62d4);})[_0xf67b('0x1f')](function(_0x12383b){_0xf34fca[_0xf67b('0x39')]=_0x12383b;return _0xf34fca;})[_0xf67b('0x1f')](respondWithFilteredResult(_0x18f86d,_0x2e62d4))[_0xf67b('0x3a')](handleError(_0x18f86d,null));};exports[_0xf67b('0x3b')]=function(_0x15f287,_0xc62f0b){var _0x1998de={'raw':!![],'where':{'id':_0x15f287[_0xf67b('0x3c')]['id']}},_0xc4b557={};_0xc4b557['model']=_[_0xf67b('0x3d')](db[_0xf67b('0x26')][_0xf67b('0x3e')]);_0xc4b557['query']=_['keys'](_0x15f287['query']);_0xc4b557[_0xf67b('0x3f')]=_[_0xf67b('0x2c')](_0xc4b557['model'],_0xc4b557[_0xf67b('0x2a')]);_0x1998de['attributes']=_['intersection'](_0xc4b557[_0xf67b('0x29')],qs['fields'](_0x15f287['query'][_0xf67b('0x2d')]));_0x1998de[_0xf67b('0x2b')]=_0x1998de[_0xf67b('0x2b')][_0xf67b('0x2e')]?_0x1998de[_0xf67b('0x2b')]:_0xc4b557['model'];if(_0x15f287[_0xf67b('0x2a')][_0xf67b('0x37')]){_0x1998de['include']=[{'all':!![]}];}_0x1998de=_['merge']({},_0x1998de,_0x15f287[_0xf67b('0x36')]);return db[_0xf67b('0x26')]['find'](_0x1998de)[_0xf67b('0x1f')](handleEntityNotFound(_0xc62f0b,null))['then'](respondWithResult(_0xc62f0b,null))['catch'](handleError(_0xc62f0b,null));};exports['create']=function(_0x158068,_0x37469b){return db[_0xf67b('0x26')][_0xf67b('0x40')](_0x158068[_0xf67b('0x41')],{})[_0xf67b('0x1f')](respondWithResult(_0x37469b,0xc9))[_0xf67b('0x3a')](handleError(_0x37469b,null));};exports[_0xf67b('0x42')]=function(_0x3d45c2,_0x49b4d6){if(_0x3d45c2[_0xf67b('0x41')]['id']){delete _0x3d45c2[_0xf67b('0x41')]['id'];}return db[_0xf67b('0x26')][_0xf67b('0x43')]({'where':{'id':_0x3d45c2[_0xf67b('0x3c')]['id']}})[_0xf67b('0x1f')](handleEntityNotFound(_0x49b4d6,null))[_0xf67b('0x1f')](saveUpdates(_0x3d45c2[_0xf67b('0x41')],null))['then'](respondWithResult(_0x49b4d6,null))[_0xf67b('0x3a')](handleError(_0x49b4d6,null));};exports[_0xf67b('0x44')]=function(_0x41fabf,_0x1036c1){return db[_0xf67b('0x26')][_0xf67b('0x43')]({'where':{'id':_0x41fabf[_0xf67b('0x3c')]['id']}})[_0xf67b('0x1f')](handleEntityNotFound(_0x1036c1,null))['then'](removeEntity(_0x1036c1,null))['catch'](handleError(_0x1036c1,null));}; \ No newline at end of file +var _0x1058=['error','stack','name','send','index','map','ZendeskField','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','request-promise','moment','path','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then'];(function(_0x5998ec,_0x5d579c){var _0x2a6ff3=function(_0x3ab0d6){while(--_0x3ab0d6){_0x5998ec['push'](_0x5998ec['shift']());}};_0x2a6ff3(++_0x5d579c);}(_0x1058,0x148));var _0x8105=function(_0x2c21dc,_0x3e2256){_0x2c21dc=_0x2c21dc-0x0;var _0x339dc6=_0x1058[_0x2c21dc];return _0x339dc6;};'use strict';var emlformat=require(_0x8105('0x0'));var rimraf=require(_0x8105('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8105('0x2'));var moment=require(_0x8105('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8105('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8105('0x5'));var fs=require('fs');var fs_extra=require(_0x8105('0x6'));var _=require(_0x8105('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8105('0x8'));var deskjs=require(_0x8105('0x9'));var toCsv=require(_0x8105('0xa'));var querystring=require(_0x8105('0xb'));var Papa=require(_0x8105('0xc'));var Redis=require(_0x8105('0xd'));var authService=require(_0x8105('0xe'));var qs=require(_0x8105('0xf'));var as=require(_0x8105('0x10'));var hardwareService=require(_0x8105('0x11'));var logger=require('../../config/logger')(_0x8105('0x12'));var utils=require(_0x8105('0x13'));var config=require(_0x8105('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8105('0x15'))['db'];function respondWithStatusCode(_0x3868c0,_0x14534f){_0x14534f=_0x14534f||0xcc;return function(_0x23ea87){if(_0x23ea87){return _0x3868c0[_0x8105('0x16')](_0x14534f);}return _0x3868c0[_0x8105('0x17')](_0x14534f)[_0x8105('0x18')]();};}function respondWithResult(_0x1dba3d,_0x5536b7){_0x5536b7=_0x5536b7||0xc8;return function(_0xfe0de6){if(_0xfe0de6){return _0x1dba3d[_0x8105('0x17')](_0x5536b7)[_0x8105('0x19')](_0xfe0de6);}};}function respondWithFilteredResult(_0x36fb50,_0x1e5889){return function(_0x403bdc){if(_0x403bdc){var _0x122882=typeof _0x1e5889[_0x8105('0x1a')]==='undefined'&&typeof _0x1e5889[_0x8105('0x1b')]===_0x8105('0x1c');var _0x22d243=_0x403bdc[_0x8105('0x1d')];var _0x370377=_0x122882?0x0:_0x1e5889[_0x8105('0x1a')];var _0x350a3b=_0x122882?_0x403bdc[_0x8105('0x1d')]:_0x1e5889[_0x8105('0x1a')]+_0x1e5889['limit'];var _0xd36687;if(_0x350a3b>=_0x22d243){_0x350a3b=_0x22d243;_0xd36687=0xc8;}else{_0xd36687=0xce;}_0x36fb50[_0x8105('0x17')](_0xd36687);return _0x36fb50[_0x8105('0x1e')](_0x8105('0x1f'),_0x370377+'-'+_0x350a3b+'/'+_0x22d243)[_0x8105('0x19')](_0x403bdc);}return null;};}function patchUpdates(_0x3639e2){return function(_0x1b8bf9){try{jsonpatch[_0x8105('0x20')](_0x1b8bf9,_0x3639e2,!![]);}catch(_0x12bd92){return BPromise[_0x8105('0x21')](_0x12bd92);}return _0x1b8bf9['save']();};}function saveUpdates(_0x1424d1,_0x2219fa){return function(_0xa93ddb){if(_0xa93ddb){return _0xa93ddb[_0x8105('0x22')](_0x1424d1)['then'](function(_0x4cf239){return _0x4cf239;});}return null;};}function removeEntity(_0x4b9e0e,_0x47f1b5){return function(_0x66d606){if(_0x66d606){return _0x66d606[_0x8105('0x23')]()[_0x8105('0x24')](function(){_0x4b9e0e[_0x8105('0x17')](0xcc)[_0x8105('0x18')]();});}};}function handleEntityNotFound(_0x374c34,_0x534bf0){return function(_0x1ffbe0){if(!_0x1ffbe0){_0x374c34[_0x8105('0x16')](0x194);}return _0x1ffbe0;};}function handleError(_0x5f1795,_0x4b0732){_0x4b0732=_0x4b0732||0x1f4;return function(_0x40be64){logger[_0x8105('0x25')](_0x40be64[_0x8105('0x26')]);if(_0x40be64[_0x8105('0x27')]){delete _0x40be64['name'];}_0x5f1795[_0x8105('0x17')](_0x4b0732)[_0x8105('0x28')](_0x40be64);};}exports[_0x8105('0x29')]=function(_0x1a14b8,_0x9b92b1){var _0x487e96={},_0x177120={},_0x25235a={'count':0x0,'rows':[]};var _0x453669=_[_0x8105('0x2a')](db[_0x8105('0x2b')]['rawAttributes'],function(_0x57e96a){return{'name':_0x57e96a[_0x8105('0x2c')],'type':_0x57e96a[_0x8105('0x2d')][_0x8105('0x2e')]};});_0x177120[_0x8105('0x2f')]=_['map'](_0x453669,_0x8105('0x27'));_0x177120['query']=_['keys'](_0x1a14b8[_0x8105('0x30')]);_0x177120[_0x8105('0x31')]=_[_0x8105('0x32')](_0x177120[_0x8105('0x2f')],_0x177120[_0x8105('0x30')]);_0x487e96[_0x8105('0x33')]=_[_0x8105('0x32')](_0x177120['model'],qs[_0x8105('0x34')](_0x1a14b8[_0x8105('0x30')]['fields']));_0x487e96[_0x8105('0x33')]=_0x487e96[_0x8105('0x33')][_0x8105('0x35')]?_0x487e96['attributes']:_0x177120[_0x8105('0x2f')];if(!_0x1a14b8['query'][_0x8105('0x36')]('nolimit')){_0x487e96[_0x8105('0x1b')]=qs[_0x8105('0x1b')](_0x1a14b8['query'][_0x8105('0x1b')]);_0x487e96[_0x8105('0x1a')]=qs['offset'](_0x1a14b8[_0x8105('0x30')]['offset']);}_0x487e96[_0x8105('0x37')]=qs[_0x8105('0x38')](_0x1a14b8[_0x8105('0x30')][_0x8105('0x38')]);_0x487e96[_0x8105('0x39')]=qs[_0x8105('0x31')](_[_0x8105('0x3a')](_0x1a14b8[_0x8105('0x30')],_0x177120['filters']),_0x453669);if(_0x1a14b8[_0x8105('0x30')][_0x8105('0x3b')]){_0x487e96[_0x8105('0x39')]=_[_0x8105('0x3c')](_0x487e96[_0x8105('0x39')],{'$or':_[_0x8105('0x2a')](_0x453669,function(_0x16bf96){if(_0x16bf96['type']!==_0x8105('0x3d')){var _0x91a42c={};_0x91a42c[_0x16bf96[_0x8105('0x27')]]={'$like':'%'+_0x1a14b8['query']['filter']+'%'};return _0x91a42c;}})});}_0x487e96=_[_0x8105('0x3c')]({},_0x487e96,_0x1a14b8[_0x8105('0x3e')]);var _0x147c94={'where':_0x487e96[_0x8105('0x39')]};return db[_0x8105('0x2b')][_0x8105('0x1d')](_0x147c94)[_0x8105('0x24')](function(_0xa3e63e){_0x25235a['count']=_0xa3e63e;if(_0x1a14b8[_0x8105('0x30')][_0x8105('0x3f')]){_0x487e96['include']=[{'all':!![]}];}return db[_0x8105('0x2b')][_0x8105('0x40')](_0x487e96);})[_0x8105('0x24')](function(_0x16b5c6){_0x25235a[_0x8105('0x41')]=_0x16b5c6;return _0x25235a;})[_0x8105('0x24')](respondWithFilteredResult(_0x9b92b1,_0x487e96))[_0x8105('0x42')](handleError(_0x9b92b1,null));};exports[_0x8105('0x43')]=function(_0x953d4a,_0x2cd28d){var _0x3edd63={'raw':!![],'where':{'id':_0x953d4a[_0x8105('0x44')]['id']}},_0x340b6d={};_0x340b6d[_0x8105('0x2f')]=_['keys'](db[_0x8105('0x2b')][_0x8105('0x45')]);_0x340b6d['query']=_['keys'](_0x953d4a[_0x8105('0x30')]);_0x340b6d[_0x8105('0x31')]=_['intersection'](_0x340b6d['model'],_0x340b6d[_0x8105('0x30')]);_0x3edd63['attributes']=_['intersection'](_0x340b6d[_0x8105('0x2f')],qs[_0x8105('0x34')](_0x953d4a['query'][_0x8105('0x34')]));_0x3edd63[_0x8105('0x33')]=_0x3edd63[_0x8105('0x33')]['length']?_0x3edd63[_0x8105('0x33')]:_0x340b6d['model'];if(_0x953d4a[_0x8105('0x30')][_0x8105('0x3f')]){_0x3edd63['include']=[{'all':!![]}];}_0x3edd63=_[_0x8105('0x3c')]({},_0x3edd63,_0x953d4a[_0x8105('0x3e')]);return db[_0x8105('0x2b')][_0x8105('0x46')](_0x3edd63)[_0x8105('0x24')](handleEntityNotFound(_0x2cd28d,null))['then'](respondWithResult(_0x2cd28d,null))[_0x8105('0x42')](handleError(_0x2cd28d,null));};exports[_0x8105('0x47')]=function(_0x415359,_0x19ef3c){return db[_0x8105('0x2b')][_0x8105('0x47')](_0x415359[_0x8105('0x48')],{})['then'](respondWithResult(_0x19ef3c,0xc9))[_0x8105('0x42')](handleError(_0x19ef3c,null));};exports['update']=function(_0x2d0ee2,_0x5ce2c1){if(_0x2d0ee2[_0x8105('0x48')]['id']){delete _0x2d0ee2[_0x8105('0x48')]['id'];}return db[_0x8105('0x2b')][_0x8105('0x46')]({'where':{'id':_0x2d0ee2[_0x8105('0x44')]['id']}})['then'](handleEntityNotFound(_0x5ce2c1,null))[_0x8105('0x24')](saveUpdates(_0x2d0ee2['body'],null))[_0x8105('0x24')](respondWithResult(_0x5ce2c1,null))[_0x8105('0x42')](handleError(_0x5ce2c1,null));};exports[_0x8105('0x23')]=function(_0x426f7e,_0x5ccd99){return db[_0x8105('0x2b')]['find']({'where':{'id':_0x426f7e[_0x8105('0x44')]['id']}})[_0x8105('0x24')](handleEntityNotFound(_0x5ccd99,null))['then'](removeEntity(_0x5ccd99,null))[_0x8105('0x42')](handleError(_0x5ccd99,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 35bd021..e17f11e 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 _0xb6f8=['exports','define','ZendeskField','zendesk_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x2dc3b0,_0xa0529){var _0x5b8ab2=function(_0x3fcc01){while(--_0x3fcc01){_0x2dc3b0['push'](_0x2dc3b0['shift']());}};_0x5b8ab2(++_0xa0529);}(_0xb6f8,0x172));var _0x8b6f=function(_0x5b50ae,_0x7da7e1){_0x5b50ae=_0x5b50ae-0x0;var _0x84eb56=_0xb6f8[_0x5b50ae];return _0x84eb56;};'use strict';var _=require(_0x8b6f('0x0'));var util=require('util');var logger=require(_0x8b6f('0x1'))(_0x8b6f('0x2'));var moment=require(_0x8b6f('0x3'));var BPromise=require(_0x8b6f('0x4'));var rp=require(_0x8b6f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8b6f('0x6'));var attributes=require('./intZendeskField.attributes');module[_0x8b6f('0x7')]=function(_0x239186,_0x280c1){return _0x239186[_0x8b6f('0x8')](_0x8b6f('0x9'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x8b6f('0xa'),'fields':[_0x8b6f('0xb'),_0x8b6f('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb90a=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','int_zendesk_fields','zendesk_unique_index','idField','FieldId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb90a,0x126));var _0xab90=function(_0x4dfaad,_0x5a7b52){_0x4dfaad=_0x4dfaad-0x0;var _0x51146d=_0xb90a[_0x4dfaad];return _0x51146d;};'use strict';var _=require('lodash');var util=require(_0xab90('0x0'));var logger=require(_0xab90('0x1'))(_0xab90('0x2'));var moment=require(_0xab90('0x3'));var BPromise=require(_0xab90('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xab90('0x5'));var rimraf=require(_0xab90('0x6'));var config=require(_0xab90('0x7'));var attributes=require('./intZendeskField.attributes');module[_0xab90('0x8')]=function(_0x194bbb,_0x3485ec){return _0x194bbb[_0xab90('0x9')]('ZendeskField',attributes,{'tableName':_0xab90('0xa'),'paranoid':![],'indexes':[{'name':_0xab90('0xb'),'fields':[_0xab90('0xc'),_0xab90('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 23513dd..2c3c987 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 _0x80a0=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','catch','util','moment','bluebird'];(function(_0x1ddbc9,_0x571e52){var _0x53ac99=function(_0x6ec29){while(--_0x6ec29){_0x1ddbc9['push'](_0x1ddbc9['shift']());}};_0x53ac99(++_0x571e52);}(_0x80a0,0x131));var _0x080a=function(_0x15f299,_0x37249d){_0x15f299=_0x15f299-0x0;var _0x5a271b=_0x80a0[_0x15f299];return _0x5a271b;};'use strict';var _=require('lodash');var util=require(_0x080a('0x0'));var moment=require(_0x080a('0x1'));var BPromise=require(_0x080a('0x2'));var rs=require(_0x080a('0x3'));var fs=require('fs');var Redis=require(_0x080a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x080a('0x5'))(_0x080a('0x6'));var config=require(_0x080a('0x7'));var jayson=require(_0x080a('0x8'));var client=jayson[_0x080a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1346f5,_0xeeb10f,_0xca134d){return new BPromise(function(_0x3b223c,_0x7a24ce){return client[_0x080a('0xa')](_0x1346f5,_0xca134d)[_0x080a('0xb')](function(_0x203720){logger[_0x080a('0xc')]('ZendeskField,\x20%s,\x20%s',_0xeeb10f,'request\x20sent');logger[_0x080a('0xd')](_0x080a('0xe'),_0xeeb10f,_0x080a('0xf'),JSON[_0x080a('0x10')](_0x203720));if(_0x203720[_0x080a('0x11')]){if(_0x203720[_0x080a('0x11')][_0x080a('0x12')]===0x1f4){logger[_0x080a('0x11')](_0x080a('0x13'),_0xeeb10f,_0x203720['error'][_0x080a('0x14')]);return _0x7a24ce(_0x203720[_0x080a('0x11')][_0x080a('0x14')]);}logger['error']('ZendeskField,\x20%s,\x20%s',_0xeeb10f,_0x203720[_0x080a('0x11')][_0x080a('0x14')]);return _0x3b223c(_0x203720[_0x080a('0x11')][_0x080a('0x14')]);}else{logger[_0x080a('0xc')](_0x080a('0x13'),_0xeeb10f,_0x080a('0xf'));_0x3b223c(_0x203720['result'][_0x080a('0x14')]);}})[_0x080a('0x15')](function(_0x323152){logger['error']('ZendeskField,\x20%s,\x20%s',_0xeeb10f,_0x323152);_0x7a24ce(_0x323152);});});} \ No newline at end of file +var _0x99fa=['code','message','result','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x31052a,_0x3ebd6f){var _0x39fb86=function(_0x11a92b){while(--_0x11a92b){_0x31052a['push'](_0x31052a['shift']());}};_0x39fb86(++_0x3ebd6f);}(_0x99fa,0x11b));var _0xa99f=function(_0x217332,_0x3c4328){_0x217332=_0x217332-0x0;var _0x141ba3=_0x99fa[_0x217332];return _0x141ba3;};'use strict';var _=require(_0xa99f('0x0'));var util=require('util');var moment=require(_0xa99f('0x1'));var BPromise=require(_0xa99f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa99f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa99f('0x4'))(_0xa99f('0x5'));var config=require('../../config/environment');var jayson=require(_0xa99f('0x6'));var client=jayson[_0xa99f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x215233,_0x14120f,_0xedf647){return new BPromise(function(_0x32f0ff,_0x1f79e7){return client[_0xa99f('0x8')](_0x215233,_0xedf647)[_0xa99f('0x9')](function(_0x55c85f){logger[_0xa99f('0xa')](_0xa99f('0xb'),_0x14120f,_0xa99f('0xc'));logger[_0xa99f('0xd')](_0xa99f('0xe'),_0x14120f,_0xa99f('0xc'),JSON[_0xa99f('0xf')](_0x55c85f));if(_0x55c85f['error']){if(_0x55c85f[_0xa99f('0x10')][_0xa99f('0x11')]===0x1f4){logger[_0xa99f('0x10')](_0xa99f('0xb'),_0x14120f,_0x55c85f[_0xa99f('0x10')][_0xa99f('0x12')]);return _0x1f79e7(_0x55c85f[_0xa99f('0x10')][_0xa99f('0x12')]);}logger[_0xa99f('0x10')]('ZendeskField,\x20%s,\x20%s',_0x14120f,_0x55c85f[_0xa99f('0x10')][_0xa99f('0x12')]);return _0x32f0ff(_0x55c85f['error'][_0xa99f('0x12')]);}else{logger[_0xa99f('0xa')](_0xa99f('0xb'),_0x14120f,_0xa99f('0xc'));_0x32f0ff(_0x55c85f[_0xa99f('0x13')]['message']);}})['catch'](function(_0x408b4e){logger[_0xa99f('0x10')](_0xa99f('0xb'),_0x14120f,_0x408b4e);_0x1f79e7(_0x408b4e);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 41f781a..d105db0 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 _0x63a0=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','update','delete','destroy','exports'];(function(_0x5acf45,_0x5eb851){var _0x100b31=function(_0x50813c){while(--_0x50813c){_0x5acf45['push'](_0x5acf45['shift']());}};_0x100b31(++_0x5eb851);}(_0x63a0,0xe1));var _0x063a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x63a0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x063a('0x0'));var util=require(_0x063a('0x1'));var path=require(_0x063a('0x2'));var timeout=require(_0x063a('0x3'));var express=require(_0x063a('0x4'));var router=express[_0x063a('0x5')]();var fs_extra=require(_0x063a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x063a('0x7'));var config=require(_0x063a('0x8'));var controller=require(_0x063a('0x9'));router[_0x063a('0xa')]('/',auth[_0x063a('0xb')](),controller[_0x063a('0xc')]);router[_0x063a('0xa')](_0x063a('0xd'),auth[_0x063a('0xb')](),controller[_0x063a('0xe')]);router[_0x063a('0xa')]('/:id/configurations',auth[_0x063a('0xb')](),controller[_0x063a('0xf')]);router[_0x063a('0xa')]('/:id/fields',auth[_0x063a('0xb')](),controller[_0x063a('0x10')]);router[_0x063a('0x11')]('/',auth[_0x063a('0xb')](),controller[_0x063a('0x12')]);router[_0x063a('0x11')](_0x063a('0x13'),auth[_0x063a('0xb')](),controller[_0x063a('0x14')]);router['put'](_0x063a('0xd'),auth[_0x063a('0xb')](),controller[_0x063a('0x15')]);router[_0x063a('0x16')](_0x063a('0xd'),auth[_0x063a('0xb')](),controller[_0x063a('0x17')]);module[_0x063a('0x18')]=router; \ No newline at end of file +var _0x9454=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','put','update','destroy','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x489b87,_0xd51c93){var _0x1823b6=function(_0x451c70){while(--_0x451c70){_0x489b87['push'](_0x489b87['shift']());}};_0x1823b6(++_0xd51c93);}(_0x9454,0x8e));var _0x4945=function(_0xad2852,_0x303c97){_0xad2852=_0xad2852-0x0;var _0x21ec0d=_0x9454[_0xad2852];return _0x21ec0d;};'use strict';var multer=require(_0x4945('0x0'));var util=require('util');var path=require(_0x4945('0x1'));var timeout=require(_0x4945('0x2'));var express=require(_0x4945('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4945('0x4'));var interaction=require(_0x4945('0x5'));var config=require(_0x4945('0x6'));var controller=require('./intZohoAccount.controller');router[_0x4945('0x7')]('/',auth[_0x4945('0x8')](),controller[_0x4945('0x9')]);router[_0x4945('0x7')](_0x4945('0xa'),auth[_0x4945('0x8')](),controller[_0x4945('0xb')]);router['get'](_0x4945('0xc'),auth[_0x4945('0x8')](),controller[_0x4945('0xd')]);router[_0x4945('0x7')]('/:id/fields',auth[_0x4945('0x8')](),controller[_0x4945('0xe')]);router['post']('/',auth[_0x4945('0x8')](),controller[_0x4945('0xf')]);router[_0x4945('0x10')](_0x4945('0xc'),auth['isAuthenticated'](),controller[_0x4945('0x11')]);router[_0x4945('0x12')]('/:id',auth[_0x4945('0x8')](),controller[_0x4945('0x13')]);router['delete'](_0x4945('0xa'),auth[_0x4945('0x8')](),controller[_0x4945('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 5098dda..7e76de8 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 _0xf109=['exports','STRING','sequelize'];(function(_0x32997d,_0x470968){var _0x765203=function(_0x2620ce){while(--_0x2620ce){_0x32997d['push'](_0x32997d['shift']());}};_0x765203(++_0x470968);}(_0xf109,0xce));var _0x9f10=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xf109[_0x2aea9e];return _0x430b92;};'use strict';var Sequelize=require(_0x9f10('0x0'));module[_0x9f10('0x1')]={'name':{'type':Sequelize[_0x9f10('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x9f10('0x2')]},'clientSecret':{'type':Sequelize[_0x9f10('0x2')]},'serverUrl':{'type':Sequelize[_0x9f10('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x9f10('0x2')]},'refreshToken':{'type':Sequelize[_0x9f10('0x2')]}}; \ No newline at end of file +var _0x22fb=['STRING'];(function(_0x22bb06,_0x36f1d1){var _0x5e05e2=function(_0x2dbd8b){while(--_0x2dbd8b){_0x22bb06['push'](_0x22bb06['shift']());}};_0x5e05e2(++_0x36f1d1);}(_0x22fb,0x192));var _0xb22f=function(_0x32255f,_0x11dd7c){_0x32255f=_0x32255f-0x0;var _0x4701f6=_0x22fb[_0x32255f];return _0x4701f6;};'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 diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index bb2c18c..11b86c6 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 _0x339a=['rows','show','params','find','create','body','catch','findOne','ZohoConfiguration','getConfigurations','AccountId','Subjects','Descriptions','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','access_token','host','clientSecret','serverUrl','code','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','push','custom_field','data_type','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','request-promise','moment','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','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','end','error','stack','name','send','index','map','ZohoAccount','rawAttributes','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x339a,0x1c2));var _0xa339=function(_0x2eea36,_0xbc5c32){_0x2eea36=_0x2eea36-0x0;var _0x2c403f=_0x339a[_0x2eea36];return _0x2c403f;};'use strict';var emlformat=require(_0xa339('0x0'));var rimraf=require(_0xa339('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa339('0x2'));var moment=require(_0xa339('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa339('0x4'));var util=require(_0xa339('0x5'));var path=require(_0xa339('0x6'));var sox=require(_0xa339('0x7'));var csv=require('to-csv');var ejs=require(_0xa339('0x8'));var fs=require('fs');var fs_extra=require(_0xa339('0x9'));var _=require(_0xa339('0xa'));var squel=require(_0xa339('0xb'));var crypto=require(_0xa339('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa339('0xd'));var toCsv=require(_0xa339('0xe'));var querystring=require(_0xa339('0xf'));var Papa=require(_0xa339('0x10'));var Redis=require(_0xa339('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa339('0x12'));var as=require(_0xa339('0x13'));var hardwareService=require(_0xa339('0x14'));var logger=require(_0xa339('0x15'))(_0xa339('0x16'));var utils=require(_0xa339('0x17'));var config=require(_0xa339('0x18'));var licenseUtil=require(_0xa339('0x19'));var db=require(_0xa339('0x1a'))['db'];var integrations=require(_0xa339('0x1b'));function respondWithStatusCode(_0x3028c4,_0x530e02){_0x530e02=_0x530e02||0xcc;return function(_0x556830){if(_0x556830){return _0x3028c4[_0xa339('0x1c')](_0x530e02);}return _0x3028c4[_0xa339('0x1d')](_0x530e02)['end']();};}function respondWithResult(_0x122c9d,_0x46bc86){_0x46bc86=_0x46bc86||0xc8;return function(_0x1d218a){if(_0x1d218a){return _0x122c9d[_0xa339('0x1d')](_0x46bc86)['json'](_0x1d218a);}};}function respondWithFilteredResult(_0x58ec5f,_0x1e073c){return function(_0xf2656a){if(_0xf2656a){var _0x1ee017=typeof _0x1e073c[_0xa339('0x1e')]==='undefined'&&typeof _0x1e073c[_0xa339('0x1f')]===_0xa339('0x20');var _0x201b0d=_0xf2656a['count'];var _0x18dd42=_0x1ee017?0x0:_0x1e073c[_0xa339('0x1e')];var _0x5ed65c=_0x1ee017?_0xf2656a[_0xa339('0x21')]:_0x1e073c[_0xa339('0x1e')]+_0x1e073c[_0xa339('0x1f')];var _0x8f57aa;if(_0x5ed65c>=_0x201b0d){_0x5ed65c=_0x201b0d;_0x8f57aa=0xc8;}else{_0x8f57aa=0xce;}_0x58ec5f[_0xa339('0x1d')](_0x8f57aa);return _0x58ec5f[_0xa339('0x22')](_0xa339('0x23'),_0x18dd42+'-'+_0x5ed65c+'/'+_0x201b0d)['json'](_0xf2656a);}return null;};}function patchUpdates(_0x5b7f0d){return function(_0x2b3bcb){try{jsonpatch[_0xa339('0x24')](_0x2b3bcb,_0x5b7f0d,!![]);}catch(_0xfb0881){return BPromise['reject'](_0xfb0881);}return _0x2b3bcb['save']();};}function saveUpdates(_0x231e37,_0x5f434b){return function(_0x1bd375){if(_0x1bd375){return _0x1bd375[_0xa339('0x25')](_0x231e37)[_0xa339('0x26')](function(_0x4bf44e){return _0x4bf44e;});}return null;};}function removeEntity(_0x30dd8b,_0x8c198d){return function(_0x501ed9){if(_0x501ed9){return _0x501ed9[_0xa339('0x27')]()['then'](function(){_0x30dd8b[_0xa339('0x1d')](0xcc)[_0xa339('0x28')]();});}};}function handleEntityNotFound(_0x2377bb,_0x54ecd0){return function(_0x3b9aab){if(!_0x3b9aab){_0x2377bb[_0xa339('0x1c')](0x194);}return _0x3b9aab;};}function handleError(_0xc02f50,_0x43a260){_0x43a260=_0x43a260||0x1f4;return function(_0x1effc8){logger[_0xa339('0x29')](_0x1effc8[_0xa339('0x2a')]);if(_0x1effc8['name']){delete _0x1effc8[_0xa339('0x2b')];}_0xc02f50[_0xa339('0x1d')](_0x43a260)[_0xa339('0x2c')](_0x1effc8);};}exports[_0xa339('0x2d')]=function(_0x469133,_0x55fa58){var _0x4dca9d={},_0x429b2d={},_0x11a7f0={'count':0x0,'rows':[]};var _0x2d4204=_[_0xa339('0x2e')](db[_0xa339('0x2f')][_0xa339('0x30')],function(_0x278d18){return{'name':_0x278d18['fieldName'],'type':_0x278d18[_0xa339('0x31')]['key']};});_0x429b2d[_0xa339('0x32')]=_['map'](_0x2d4204,'name');_0x429b2d['query']=_[_0xa339('0x33')](_0x469133['query']);_0x429b2d[_0xa339('0x34')]=_[_0xa339('0x35')](_0x429b2d[_0xa339('0x32')],_0x429b2d[_0xa339('0x36')]);_0x4dca9d[_0xa339('0x37')]=_[_0xa339('0x35')](_0x429b2d[_0xa339('0x32')],qs[_0xa339('0x38')](_0x469133[_0xa339('0x36')]['fields']));_0x4dca9d['attributes']=_0x4dca9d['attributes'][_0xa339('0x39')]?_0x4dca9d[_0xa339('0x37')]:_0x429b2d[_0xa339('0x32')];if(!_0x469133['query'][_0xa339('0x3a')](_0xa339('0x3b'))){_0x4dca9d[_0xa339('0x1f')]=qs[_0xa339('0x1f')](_0x469133['query'][_0xa339('0x1f')]);_0x4dca9d[_0xa339('0x1e')]=qs[_0xa339('0x1e')](_0x469133['query'][_0xa339('0x1e')]);}_0x4dca9d[_0xa339('0x3c')]=qs['sort'](_0x469133['query'][_0xa339('0x3d')]);_0x4dca9d[_0xa339('0x3e')]=qs[_0xa339('0x34')](_[_0xa339('0x3f')](_0x469133['query'],_0x429b2d['filters']),_0x2d4204);if(_0x469133[_0xa339('0x36')][_0xa339('0x40')]){_0x4dca9d[_0xa339('0x3e')]=_['merge'](_0x4dca9d[_0xa339('0x3e')],{'$or':_[_0xa339('0x2e')](_0x2d4204,function(_0x5db8c8){if(_0x5db8c8['type']!==_0xa339('0x41')){var _0x16cc6d={};_0x16cc6d[_0x5db8c8['name']]={'$like':'%'+_0x469133['query'][_0xa339('0x40')]+'%'};return _0x16cc6d;}})});}_0x4dca9d=_[_0xa339('0x42')]({},_0x4dca9d,_0x469133[_0xa339('0x43')]);var _0x4db488={'where':_0x4dca9d['where']};return db[_0xa339('0x2f')][_0xa339('0x21')](_0x4db488)[_0xa339('0x26')](function(_0x1ee06a){_0x11a7f0['count']=_0x1ee06a;if(_0x469133[_0xa339('0x36')][_0xa339('0x44')]){_0x4dca9d[_0xa339('0x45')]=[{'all':!![]}];}return db[_0xa339('0x2f')]['findAll'](_0x4dca9d);})[_0xa339('0x26')](function(_0x125767){_0x11a7f0[_0xa339('0x46')]=_0x125767;return _0x11a7f0;})[_0xa339('0x26')](respondWithFilteredResult(_0x55fa58,_0x4dca9d))['catch'](handleError(_0x55fa58,null));};exports[_0xa339('0x47')]=function(_0x1999af,_0x45cb98){var _0x2d48e6={'raw':![],'where':{'id':_0x1999af[_0xa339('0x48')]['id']}},_0x2e1e22={};_0x2e1e22['model']=_['keys'](db[_0xa339('0x2f')][_0xa339('0x30')]);_0x2e1e22[_0xa339('0x36')]=_['keys'](_0x1999af[_0xa339('0x36')]);_0x2e1e22[_0xa339('0x34')]=_['intersection'](_0x2e1e22[_0xa339('0x32')],_0x2e1e22[_0xa339('0x36')]);_0x2d48e6[_0xa339('0x37')]=_[_0xa339('0x35')](_0x2e1e22[_0xa339('0x32')],qs[_0xa339('0x38')](_0x1999af['query'][_0xa339('0x38')]));_0x2d48e6['attributes']=_0x2d48e6[_0xa339('0x37')][_0xa339('0x39')]?_0x2d48e6['attributes']:_0x2e1e22['model'];if(_0x1999af[_0xa339('0x36')][_0xa339('0x44')]){_0x2d48e6[_0xa339('0x45')]=[{'all':!![]}];}_0x2d48e6=_[_0xa339('0x42')]({},_0x2d48e6,_0x1999af[_0xa339('0x43')]);return db['ZohoAccount'][_0xa339('0x49')](_0x2d48e6)[_0xa339('0x26')](handleEntityNotFound(_0x45cb98,null))[_0xa339('0x26')](respondWithResult(_0x45cb98,null))['catch'](handleError(_0x45cb98,null));};exports['create']=function(_0x2e5cce,_0x437451){return db[_0xa339('0x2f')][_0xa339('0x4a')](_0x2e5cce[_0xa339('0x4b')],{})[_0xa339('0x26')](respondWithResult(_0x437451,0xc9))[_0xa339('0x4c')](handleError(_0x437451,null));};exports[_0xa339('0x25')]=function(_0xa8a96a,_0x36b2a5){if(_0xa8a96a['body']['id']){delete _0xa8a96a['body']['id'];}return db[_0xa339('0x2f')]['find']({'where':{'id':_0xa8a96a['params']['id']}})['then'](handleEntityNotFound(_0x36b2a5,null))[_0xa339('0x26')](saveUpdates(_0xa8a96a[_0xa339('0x4b')],null))[_0xa339('0x26')](respondWithResult(_0x36b2a5,null))[_0xa339('0x4c')](handleError(_0x36b2a5,null));};exports[_0xa339('0x27')]=function(_0x218b95,_0x452376){return db['ZohoAccount'][_0xa339('0x49')]({'where':{'id':_0x218b95[_0xa339('0x48')]['id']}})['then'](handleEntityNotFound(_0x452376,null))[_0xa339('0x26')](removeEntity(_0x452376,null))[_0xa339('0x4c')](handleError(_0x452376,null));};exports['getConfigurations']=function(_0x16b185,_0x1519c7,_0x223688){var _0x328f9d={};var _0x197f7b={};var _0x48df53;var _0x451f84;return db['ZohoAccount'][_0xa339('0x4d')]({'where':{'id':_0x16b185['params']['id']}})[_0xa339('0x26')](handleEntityNotFound(_0x1519c7,null))[_0xa339('0x26')](function(_0x4f4a6c){if(_0x4f4a6c){_0x48df53=_0x4f4a6c;_0x197f7b[_0xa339('0x32')]=_[_0xa339('0x33')](db[_0xa339('0x4e')][_0xa339('0x30')]);_0x197f7b[_0xa339('0x36')]=_[_0xa339('0x33')](_0x16b185['query']);_0x197f7b[_0xa339('0x34')]=_['intersection'](_0x197f7b[_0xa339('0x32')],_0x197f7b['query']);_0x328f9d[_0xa339('0x37')]=_[_0xa339('0x35')](_0x197f7b[_0xa339('0x32')],qs[_0xa339('0x38')](_0x16b185[_0xa339('0x36')]['fields']));_0x328f9d[_0xa339('0x37')]=_0x328f9d['attributes'][_0xa339('0x39')]?_0x328f9d['attributes']:_0x197f7b[_0xa339('0x32')];_0x328f9d[_0xa339('0x3c')]=qs[_0xa339('0x3d')](_0x16b185[_0xa339('0x36')][_0xa339('0x3d')]);_0x328f9d['where']=qs[_0xa339('0x34')](_[_0xa339('0x3f')](_0x16b185['query'],_0x197f7b[_0xa339('0x34')]));if(_0x16b185[_0xa339('0x36')][_0xa339('0x40')]){_0x328f9d[_0xa339('0x3e')]=_[_0xa339('0x42')](_0x328f9d[_0xa339('0x3e')],{'$or':_[_0xa339('0x2e')](_0x328f9d[_0xa339('0x37')],function(_0x2a5dee){var _0x55edd8={};_0x55edd8[_0x2a5dee]={'$like':'%'+_0x16b185['query'][_0xa339('0x40')]+'%'};return _0x55edd8;})});}_0x328f9d=_[_0xa339('0x42')]({},_0x328f9d,_0x16b185[_0xa339('0x43')]);return _0x48df53[_0xa339('0x4f')](_0x328f9d);}})['then'](function(_0x29a4e3){if(_0x29a4e3){_0x451f84=_0x29a4e3[_0xa339('0x39')];if(!_0x16b185[_0xa339('0x36')]['hasOwnProperty']('nolimit')){_0x328f9d['limit']=qs[_0xa339('0x1f')](_0x16b185[_0xa339('0x36')][_0xa339('0x1f')]);_0x328f9d['offset']=qs['offset'](_0x16b185[_0xa339('0x36')][_0xa339('0x1e')]);}return _0x48df53[_0xa339('0x4f')](_0x328f9d);}})[_0xa339('0x26')](function(_0x4dd761){if(_0x4dd761){return _0x4dd761?{'count':_0x451f84,'rows':_0x4dd761}:null;}})[_0xa339('0x26')](respondWithResult(_0x1519c7,null))[_0xa339('0x4c')](handleError(_0x1519c7,null));};exports['addConfiguration']=function(_0x383eab,_0x38b967,_0x1669e5){if(_0x383eab[_0xa339('0x4b')]['id']){delete _0x383eab[_0xa339('0x4b')]['id'];}return db[_0xa339('0x2f')][_0xa339('0x4d')]({'where':{'id':_0x383eab['params']['id']}})[_0xa339('0x26')](handleEntityNotFound(_0x38b967,null))[_0xa339('0x26')](function(_0x2ed9b0){if(_0x2ed9b0){_0x383eab[_0xa339('0x4b')][_0xa339('0x50')]=_0x2ed9b0['id'];_0x383eab[_0xa339('0x4b')][_0xa339('0x51')]=integrations['getSubjects'](_0x383eab[_0xa339('0x4b')]['channel'],_0x383eab['body'][_0xa339('0x31')]);_0x383eab[_0xa339('0x4b')][_0xa339('0x52')]=integrations[_0xa339('0x53')](_0x383eab[_0xa339('0x4b')][_0xa339('0x54')],_0x383eab[_0xa339('0x4b')][_0xa339('0x31')]);return db['ZohoConfiguration'][_0xa339('0x4a')](_0x383eab[_0xa339('0x4b')],{'include':[{'model':db[_0xa339('0x55')],'as':'Subjects'},{'model':db[_0xa339('0x55')],'as':_0xa339('0x52')}]});}return null;})['then'](respondWithResult(_0x38b967,null))[_0xa339('0x4c')](handleError(_0x38b967,null));};function getAccessToken(_0x2141f8){return new Promise(function(_0x5e6526,_0x2893cd){var _0x6d0696;switch(_0x2141f8[_0xa339('0x56')]){case'US':_0x6d0696=_0xa339('0x57');break;case'AU':_0x6d0696=_0xa339('0x58');break;case'EU':_0x6d0696=_0xa339('0x59');break;case'IN':_0x6d0696=_0xa339('0x5a');break;case'CN':_0x6d0696=_0xa339('0x5b');break;default:_0x6d0696=_0xa339('0x59');break;}var _0xcc391d={'method':_0xa339('0x5c'),'uri':_0x6d0696+'/oauth/v2/token','qs':{'refresh_token':_0x2141f8[_0xa339('0x5d')],'client_id':_0x2141f8[_0xa339('0x5e')],'client_secret':_0x2141f8['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0xcc391d)['then'](function(_0x19fdc7){if(_0x19fdc7[_0xa339('0x5f')]){_0x5e6526(_0x19fdc7[_0xa339('0x5f')]);}else{_0x2893cd('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xa339('0x4c')](function(_0x5db2e9){_0x2893cd(_0x5db2e9);});});}exports['getFields']=function(_0x37f341,_0x2d1b10,_0x2b7061){var _0x226287,_0x486cff,_0x5e707d,_0x3ae4f3,_0x5cd83f;return db[_0xa339('0x2f')][_0xa339('0x4d')]({'where':{'id':_0x37f341[_0xa339('0x48')]['id']},'attributes':['id',_0xa339('0x60'),_0xa339('0x56'),_0xa339('0x5e'),_0xa339('0x61'),_0xa339('0x62'),_0xa339('0x63'),'refreshToken']})[_0xa339('0x26')](handleEntityNotFound(_0x2d1b10,null))[_0xa339('0x26')](function(_0x2808d9){_0x5cd83f=_0x2808d9;_0x226287=_0x5cd83f['host'];_0x486cff=_0x226287===_0xa339('0x64')?'eu':'com';_0x5e707d=_0x5cd83f['serverUrl'];var _0x5854ad=_0x5e707d[_0xa339('0x65')](-0x1);if(_0x5854ad==='/'||_0x5854ad==='\x5c'||_0x5854ad===':'){_0x5e707d=_0x5e707d[_0xa339('0x66')](0x0,_0x5e707d[_0xa339('0x67')](_0x5854ad));}if(!_0x5cd83f[_0xa339('0x5d')]){throw new Error(_0xa339('0x68'));}return getAccessToken(_0x5cd83f);})[_0xa339('0x26')](function(_0x3dda3d){if(_0x3dda3d){return rp({'method':_0xa339('0x69'),'uri':util['format'](_0xa339('0x6a'),_0x486cff),'qs':{'module':_0xa339('0x6b')},'headers':{'Authorization':_0xa339('0x6c')+_0x3dda3d},'json':!![]});}})[_0xa339('0x26')](function(_0xcc1c10){if(_0xcc1c10){if(_0xcc1c10[_0xa339('0x6d')]&&_0xcc1c10['response'][_0xa339('0x29')]){throw new Error(_0xcc1c10[_0xa339('0x6d')]['error'][_0xa339('0x6e')]);}var _0x4ca76c=[];var _0x42f9ea=[];var _0x456d7a=[_0xa339('0x6f'),_0xa339('0x70'),'Description',_0xa339('0x71'),_0xa339('0x72'),_0xa339('0x73'),_0xa339('0x74'),_0xa339('0x75')];_0x42f9ea=_[_0xa339('0x76')](_0xcc1c10['fields'],function(_0x3f1eef){return _0x456d7a[_0xa339('0x77')](_0x3f1eef['api_name']);});for(var _0xf8980f=0x0;_0xf8980f<_0x42f9ea['length'];_0xf8980f++){if(_0x42f9ea[_0xf8980f]['system_mandatory']===![]){_0x4ca76c[_0xa339('0x78')]({'id':_0x42f9ea[_0xf8980f]['id'],'name':_0x42f9ea[_0xf8980f]['display_label'],'custom':_0x42f9ea[_0xf8980f][_0xa339('0x79')],'options':_0x42f9ea[_0xf8980f][_0xa339('0x7a')]===_0xa339('0x7b')&&_0x42f9ea[_0xf8980f][_0xa339('0x7c')][_0xa339('0x39')]>-0x1?_['map'](_0x42f9ea[_0xf8980f][_0xa339('0x7c')],function(_0x5dd61b){return{'name':_0x5dd61b,'value':_0x5dd61b};}):[]});}}return{'count':_0x4ca76c['length'],'rows':_0x4ca76c};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x2d1b10,null))[_0xa339('0x4c')](function(_0x376f46){var _0x32aa7a=_0x37f341['query'][_0xa339('0x7d')]?0x1f4:_0x376f46['statusCode']||0x1f4;logger['error'](_0xa339('0x7e'),'getFields',_0x32aa7a,JSON[_0xa339('0x7f')](_0x376f46));delete _0x376f46[_0xa339('0x2b')];if(_0x32aa7a===0x191){_0x32aa7a=0x190;}_0x2d1b10[_0xa339('0x1d')](_0x32aa7a)[_0xa339('0x2c')](_0x37f341[_0xa339('0x36')][_0xa339('0x7d')]?{'message':_0xa339('0x80'),'statusCode':_0x376f46[_0xa339('0x81')]}:_0x376f46);});}; \ No newline at end of file +var _0xe6f5=['stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','keys','filters','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','find','getConfigurations','findOne','ZohoConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','zoho.eu','com','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Owner','Subject','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error'];(function(_0x903228,_0x42c429){var _0xcec81d=function(_0x4da97a){while(--_0x4da97a){_0x903228['push'](_0x903228['shift']());}};_0xcec81d(++_0x42c429);}(_0xe6f5,0x161));var _0x5e6f=function(_0x3f948c,_0x40fd18){_0x3f948c=_0x3f948c-0x0;var _0x23a160=_0xe6f5[_0x3f948c];return _0x23a160;};'use strict';var emlformat=require(_0x5e6f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5e6f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5e6f('0x2'));var BPromise=require(_0x5e6f('0x3'));var Mustache=require(_0x5e6f('0x4'));var util=require(_0x5e6f('0x5'));var path=require('path');var sox=require(_0x5e6f('0x6'));var csv=require(_0x5e6f('0x7'));var ejs=require(_0x5e6f('0x8'));var fs=require('fs');var fs_extra=require(_0x5e6f('0x9'));var _=require('lodash');var squel=require(_0x5e6f('0xa'));var crypto=require('crypto');var jsforce=require(_0x5e6f('0xb'));var deskjs=require(_0x5e6f('0xc'));var toCsv=require(_0x5e6f('0x7'));var querystring=require('querystring');var Papa=require(_0x5e6f('0xd'));var Redis=require(_0x5e6f('0xe'));var authService=require(_0x5e6f('0xf'));var qs=require(_0x5e6f('0x10'));var as=require(_0x5e6f('0x11'));var hardwareService=require(_0x5e6f('0x12'));var logger=require(_0x5e6f('0x13'))(_0x5e6f('0x14'));var utils=require(_0x5e6f('0x15'));var config=require(_0x5e6f('0x16'));var licenseUtil=require(_0x5e6f('0x17'));var db=require(_0x5e6f('0x18'))['db'];var integrations=require(_0x5e6f('0x19'));function respondWithStatusCode(_0x3b0cfd,_0x3e2b2e){_0x3e2b2e=_0x3e2b2e||0xcc;return function(_0x41748b){if(_0x41748b){return _0x3b0cfd['sendStatus'](_0x3e2b2e);}return _0x3b0cfd[_0x5e6f('0x1a')](_0x3e2b2e)[_0x5e6f('0x1b')]();};}function respondWithResult(_0x517c97,_0x155b6b){_0x155b6b=_0x155b6b||0xc8;return function(_0x5949c2){if(_0x5949c2){return _0x517c97[_0x5e6f('0x1a')](_0x155b6b)[_0x5e6f('0x1c')](_0x5949c2);}};}function respondWithFilteredResult(_0x4ca3f0,_0x3db5ac){return function(_0x23b15a){if(_0x23b15a){var _0x382788=typeof _0x3db5ac[_0x5e6f('0x1d')]===_0x5e6f('0x1e')&&typeof _0x3db5ac[_0x5e6f('0x1f')]==='undefined';var _0x543e22=_0x23b15a[_0x5e6f('0x20')];var _0x38cd1f=_0x382788?0x0:_0x3db5ac[_0x5e6f('0x1d')];var _0x22a76c=_0x382788?_0x23b15a[_0x5e6f('0x20')]:_0x3db5ac[_0x5e6f('0x1d')]+_0x3db5ac[_0x5e6f('0x1f')];var _0x7e916b;if(_0x22a76c>=_0x543e22){_0x22a76c=_0x543e22;_0x7e916b=0xc8;}else{_0x7e916b=0xce;}_0x4ca3f0[_0x5e6f('0x1a')](_0x7e916b);return _0x4ca3f0[_0x5e6f('0x21')](_0x5e6f('0x22'),_0x38cd1f+'-'+_0x22a76c+'/'+_0x543e22)['json'](_0x23b15a);}return null;};}function patchUpdates(_0x21d613){return function(_0x4b878e){try{jsonpatch[_0x5e6f('0x23')](_0x4b878e,_0x21d613,!![]);}catch(_0x335ea4){return BPromise[_0x5e6f('0x24')](_0x335ea4);}return _0x4b878e[_0x5e6f('0x25')]();};}function saveUpdates(_0x438ba2,_0x30deb7){return function(_0xe7f116){if(_0xe7f116){return _0xe7f116[_0x5e6f('0x26')](_0x438ba2)[_0x5e6f('0x27')](function(_0x333338){return _0x333338;});}return null;};}function removeEntity(_0x46b252,_0x4c7c63){return function(_0x36dd7e){if(_0x36dd7e){return _0x36dd7e[_0x5e6f('0x28')]()[_0x5e6f('0x27')](function(){_0x46b252[_0x5e6f('0x1a')](0xcc)[_0x5e6f('0x1b')]();});}};}function handleEntityNotFound(_0xc0d89d,_0x4251b0){return function(_0x33afd1){if(!_0x33afd1){_0xc0d89d[_0x5e6f('0x29')](0x194);}return _0x33afd1;};}function handleError(_0x28e9f8,_0x3e3e05){_0x3e3e05=_0x3e3e05||0x1f4;return function(_0x23899f){logger[_0x5e6f('0x2a')](_0x23899f[_0x5e6f('0x2b')]);if(_0x23899f[_0x5e6f('0x2c')]){delete _0x23899f[_0x5e6f('0x2c')];}_0x28e9f8[_0x5e6f('0x1a')](_0x3e3e05)[_0x5e6f('0x2d')](_0x23899f);};}exports[_0x5e6f('0x2e')]=function(_0x34ed9c,_0x4e5bbd){var _0x57ff13={},_0x45a115={},_0x2af5e1={'count':0x0,'rows':[]};var _0x97456b=_[_0x5e6f('0x2f')](db[_0x5e6f('0x30')][_0x5e6f('0x31')],function(_0x1459f9){return{'name':_0x1459f9[_0x5e6f('0x32')],'type':_0x1459f9['type']['key']};});_0x45a115['model']=_['map'](_0x97456b,_0x5e6f('0x2c'));_0x45a115['query']=_[_0x5e6f('0x33')](_0x34ed9c['query']);_0x45a115[_0x5e6f('0x34')]=_['intersection'](_0x45a115[_0x5e6f('0x35')],_0x45a115[_0x5e6f('0x36')]);_0x57ff13['attributes']=_[_0x5e6f('0x37')](_0x45a115[_0x5e6f('0x35')],qs['fields'](_0x34ed9c[_0x5e6f('0x36')][_0x5e6f('0x38')]));_0x57ff13[_0x5e6f('0x39')]=_0x57ff13[_0x5e6f('0x39')][_0x5e6f('0x3a')]?_0x57ff13[_0x5e6f('0x39')]:_0x45a115[_0x5e6f('0x35')];if(!_0x34ed9c[_0x5e6f('0x36')][_0x5e6f('0x3b')](_0x5e6f('0x3c'))){_0x57ff13[_0x5e6f('0x1f')]=qs[_0x5e6f('0x1f')](_0x34ed9c[_0x5e6f('0x36')]['limit']);_0x57ff13[_0x5e6f('0x1d')]=qs[_0x5e6f('0x1d')](_0x34ed9c[_0x5e6f('0x36')][_0x5e6f('0x1d')]);}_0x57ff13['order']=qs[_0x5e6f('0x3d')](_0x34ed9c[_0x5e6f('0x36')][_0x5e6f('0x3d')]);_0x57ff13[_0x5e6f('0x3e')]=qs[_0x5e6f('0x34')](_[_0x5e6f('0x3f')](_0x34ed9c[_0x5e6f('0x36')],_0x45a115[_0x5e6f('0x34')]),_0x97456b);if(_0x34ed9c[_0x5e6f('0x36')][_0x5e6f('0x40')]){_0x57ff13[_0x5e6f('0x3e')]=_[_0x5e6f('0x41')](_0x57ff13['where'],{'$or':_[_0x5e6f('0x2f')](_0x97456b,function(_0xea4396){if(_0xea4396[_0x5e6f('0x42')]!==_0x5e6f('0x43')){var _0x312ec2={};_0x312ec2[_0xea4396['name']]={'$like':'%'+_0x34ed9c[_0x5e6f('0x36')][_0x5e6f('0x40')]+'%'};return _0x312ec2;}})});}_0x57ff13=_['merge']({},_0x57ff13,_0x34ed9c[_0x5e6f('0x44')]);var _0x10b452={'where':_0x57ff13[_0x5e6f('0x3e')]};return db[_0x5e6f('0x30')]['count'](_0x10b452)['then'](function(_0xf240fe){_0x2af5e1['count']=_0xf240fe;if(_0x34ed9c[_0x5e6f('0x36')][_0x5e6f('0x45')]){_0x57ff13[_0x5e6f('0x46')]=[{'all':!![]}];}return db['ZohoAccount'][_0x5e6f('0x47')](_0x57ff13);})['then'](function(_0x565f0a){_0x2af5e1[_0x5e6f('0x48')]=_0x565f0a;return _0x2af5e1;})['then'](respondWithFilteredResult(_0x4e5bbd,_0x57ff13))[_0x5e6f('0x49')](handleError(_0x4e5bbd,null));};exports['show']=function(_0x1191c1,_0x2767cb){var _0x227463={'raw':![],'where':{'id':_0x1191c1[_0x5e6f('0x4a')]['id']}},_0x9149f3={};_0x9149f3[_0x5e6f('0x35')]=_[_0x5e6f('0x33')](db['ZohoAccount'][_0x5e6f('0x31')]);_0x9149f3['query']=_[_0x5e6f('0x33')](_0x1191c1['query']);_0x9149f3[_0x5e6f('0x34')]=_['intersection'](_0x9149f3[_0x5e6f('0x35')],_0x9149f3['query']);_0x227463[_0x5e6f('0x39')]=_['intersection'](_0x9149f3[_0x5e6f('0x35')],qs['fields'](_0x1191c1[_0x5e6f('0x36')][_0x5e6f('0x38')]));_0x227463[_0x5e6f('0x39')]=_0x227463[_0x5e6f('0x39')][_0x5e6f('0x3a')]?_0x227463[_0x5e6f('0x39')]:_0x9149f3['model'];if(_0x1191c1['query']['includeAll']){_0x227463[_0x5e6f('0x46')]=[{'all':!![]}];}_0x227463=_[_0x5e6f('0x41')]({},_0x227463,_0x1191c1[_0x5e6f('0x44')]);return db[_0x5e6f('0x30')]['find'](_0x227463)['then'](handleEntityNotFound(_0x2767cb,null))['then'](respondWithResult(_0x2767cb,null))[_0x5e6f('0x49')](handleError(_0x2767cb,null));};exports[_0x5e6f('0x4b')]=function(_0x2194cf,_0x9b90f9){return db[_0x5e6f('0x30')][_0x5e6f('0x4b')](_0x2194cf[_0x5e6f('0x4c')],{})[_0x5e6f('0x27')](respondWithResult(_0x9b90f9,0xc9))[_0x5e6f('0x49')](handleError(_0x9b90f9,null));};exports[_0x5e6f('0x26')]=function(_0x128425,_0x479021){if(_0x128425[_0x5e6f('0x4c')]['id']){delete _0x128425['body']['id'];}return db[_0x5e6f('0x30')][_0x5e6f('0x4d')]({'where':{'id':_0x128425[_0x5e6f('0x4a')]['id']}})[_0x5e6f('0x27')](handleEntityNotFound(_0x479021,null))['then'](saveUpdates(_0x128425[_0x5e6f('0x4c')],null))[_0x5e6f('0x27')](respondWithResult(_0x479021,null))[_0x5e6f('0x49')](handleError(_0x479021,null));};exports[_0x5e6f('0x28')]=function(_0x55aee0,_0x33ae57){return db[_0x5e6f('0x30')][_0x5e6f('0x4d')]({'where':{'id':_0x55aee0[_0x5e6f('0x4a')]['id']}})[_0x5e6f('0x27')](handleEntityNotFound(_0x33ae57,null))[_0x5e6f('0x27')](removeEntity(_0x33ae57,null))[_0x5e6f('0x49')](handleError(_0x33ae57,null));};exports[_0x5e6f('0x4e')]=function(_0x4319a3,_0x1dba80,_0x23a06a){var _0x5ef005={};var _0x1559b5={};var _0x36d8c1;var _0x29e761;return db['ZohoAccount'][_0x5e6f('0x4f')]({'where':{'id':_0x4319a3[_0x5e6f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1dba80,null))[_0x5e6f('0x27')](function(_0x3b0726){if(_0x3b0726){_0x36d8c1=_0x3b0726;_0x1559b5['model']=_['keys'](db[_0x5e6f('0x50')][_0x5e6f('0x31')]);_0x1559b5[_0x5e6f('0x36')]=_['keys'](_0x4319a3[_0x5e6f('0x36')]);_0x1559b5[_0x5e6f('0x34')]=_[_0x5e6f('0x37')](_0x1559b5[_0x5e6f('0x35')],_0x1559b5[_0x5e6f('0x36')]);_0x5ef005[_0x5e6f('0x39')]=_[_0x5e6f('0x37')](_0x1559b5[_0x5e6f('0x35')],qs[_0x5e6f('0x38')](_0x4319a3[_0x5e6f('0x36')]['fields']));_0x5ef005[_0x5e6f('0x39')]=_0x5ef005[_0x5e6f('0x39')][_0x5e6f('0x3a')]?_0x5ef005[_0x5e6f('0x39')]:_0x1559b5[_0x5e6f('0x35')];_0x5ef005['order']=qs[_0x5e6f('0x3d')](_0x4319a3[_0x5e6f('0x36')]['sort']);_0x5ef005[_0x5e6f('0x3e')]=qs[_0x5e6f('0x34')](_[_0x5e6f('0x3f')](_0x4319a3[_0x5e6f('0x36')],_0x1559b5[_0x5e6f('0x34')]));if(_0x4319a3['query']['filter']){_0x5ef005[_0x5e6f('0x3e')]=_['merge'](_0x5ef005[_0x5e6f('0x3e')],{'$or':_[_0x5e6f('0x2f')](_0x5ef005[_0x5e6f('0x39')],function(_0x2620ca){var _0x352eaa={};_0x352eaa[_0x2620ca]={'$like':'%'+_0x4319a3[_0x5e6f('0x36')][_0x5e6f('0x40')]+'%'};return _0x352eaa;})});}_0x5ef005=_['merge']({},_0x5ef005,_0x4319a3[_0x5e6f('0x44')]);return _0x36d8c1[_0x5e6f('0x4e')](_0x5ef005);}})['then'](function(_0x3de953){if(_0x3de953){_0x29e761=_0x3de953[_0x5e6f('0x3a')];if(!_0x4319a3[_0x5e6f('0x36')][_0x5e6f('0x3b')](_0x5e6f('0x3c'))){_0x5ef005[_0x5e6f('0x1f')]=qs[_0x5e6f('0x1f')](_0x4319a3[_0x5e6f('0x36')][_0x5e6f('0x1f')]);_0x5ef005[_0x5e6f('0x1d')]=qs[_0x5e6f('0x1d')](_0x4319a3[_0x5e6f('0x36')]['offset']);}return _0x36d8c1[_0x5e6f('0x4e')](_0x5ef005);}})[_0x5e6f('0x27')](function(_0x2ead83){if(_0x2ead83){return _0x2ead83?{'count':_0x29e761,'rows':_0x2ead83}:null;}})[_0x5e6f('0x27')](respondWithResult(_0x1dba80,null))['catch'](handleError(_0x1dba80,null));};exports[_0x5e6f('0x51')]=function(_0x1db476,_0x1460c2,_0x5bd516){if(_0x1db476['body']['id']){delete _0x1db476[_0x5e6f('0x4c')]['id'];}return db[_0x5e6f('0x30')]['findOne']({'where':{'id':_0x1db476['params']['id']}})[_0x5e6f('0x27')](handleEntityNotFound(_0x1460c2,null))[_0x5e6f('0x27')](function(_0x149915){if(_0x149915){_0x1db476[_0x5e6f('0x4c')][_0x5e6f('0x52')]=_0x149915['id'];_0x1db476[_0x5e6f('0x4c')][_0x5e6f('0x53')]=integrations[_0x5e6f('0x54')](_0x1db476[_0x5e6f('0x4c')][_0x5e6f('0x55')],_0x1db476[_0x5e6f('0x4c')][_0x5e6f('0x42')]);_0x1db476[_0x5e6f('0x4c')][_0x5e6f('0x56')]=integrations[_0x5e6f('0x57')](_0x1db476[_0x5e6f('0x4c')][_0x5e6f('0x55')],_0x1db476['body'][_0x5e6f('0x42')]);return db[_0x5e6f('0x50')][_0x5e6f('0x4b')](_0x1db476[_0x5e6f('0x4c')],{'include':[{'model':db[_0x5e6f('0x58')],'as':_0x5e6f('0x53')},{'model':db[_0x5e6f('0x58')],'as':_0x5e6f('0x56')}]});}return null;})[_0x5e6f('0x27')](respondWithResult(_0x1460c2,null))[_0x5e6f('0x49')](handleError(_0x1460c2,null));};function getAccessToken(_0xac2c36){return new Promise(function(_0xc80e3e,_0x53530c){var _0x4f6ec7;switch(_0xac2c36[_0x5e6f('0x59')]){case'US':_0x4f6ec7='https://accounts.zoho.com';break;case'AU':_0x4f6ec7=_0x5e6f('0x5a');break;case'EU':_0x4f6ec7='https://accounts.zoho.eu';break;case'IN':_0x4f6ec7=_0x5e6f('0x5b');break;case'CN':_0x4f6ec7=_0x5e6f('0x5c');break;default:_0x4f6ec7=_0x5e6f('0x5d');break;}var _0x2fc345={'method':_0x5e6f('0x5e'),'uri':_0x4f6ec7+_0x5e6f('0x5f'),'qs':{'refresh_token':_0xac2c36[_0x5e6f('0x60')],'client_id':_0xac2c36[_0x5e6f('0x61')],'client_secret':_0xac2c36[_0x5e6f('0x62')],'grant_type':_0x5e6f('0x63')},'json':!![]};return rp(_0x2fc345)[_0x5e6f('0x27')](function(_0x146d00){if(_0x146d00[_0x5e6f('0x64')]){_0xc80e3e(_0x146d00[_0x5e6f('0x64')]);}else{_0x53530c('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x5e6f('0x49')](function(_0x5154ce){_0x53530c(_0x5154ce);});});}exports[_0x5e6f('0x65')]=function(_0x2b41b7,_0x2d2f71,_0x2d8204){var _0x5b3338,_0x562fad,_0x5a8ea6,_0x303551,_0x1feca9;return db['ZohoAccount']['findOne']({'where':{'id':_0x2b41b7[_0x5e6f('0x4a')]['id']},'attributes':['id',_0x5e6f('0x66'),_0x5e6f('0x59'),'clientId','clientSecret','serverUrl','code','refreshToken']})[_0x5e6f('0x27')](handleEntityNotFound(_0x2d2f71,null))[_0x5e6f('0x27')](function(_0x3dd829){_0x1feca9=_0x3dd829;_0x5b3338=_0x1feca9[_0x5e6f('0x66')];_0x562fad=_0x5b3338===_0x5e6f('0x67')?'eu':_0x5e6f('0x68');_0x5a8ea6=_0x1feca9['serverUrl'];var _0x5e5c8f=_0x5a8ea6['slice'](-0x1);if(_0x5e5c8f==='/'||_0x5e5c8f==='\x5c'||_0x5e5c8f===':'){_0x5a8ea6=_0x5a8ea6[_0x5e6f('0x69')](0x0,_0x5a8ea6[_0x5e6f('0x6a')](_0x5e5c8f));}if(!_0x1feca9[_0x5e6f('0x60')]){throw new Error(_0x5e6f('0x6b'));}return getAccessToken(_0x1feca9);})[_0x5e6f('0x27')](function(_0x10a6d7){if(_0x10a6d7){return rp({'method':_0x5e6f('0x6c'),'uri':util['format'](_0x5e6f('0x6d'),_0x562fad),'qs':{'module':_0x5e6f('0x6e')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x10a6d7},'json':!![]});}})[_0x5e6f('0x27')](function(_0xea9d73){if(_0xea9d73){if(_0xea9d73[_0x5e6f('0x6f')]&&_0xea9d73[_0x5e6f('0x6f')][_0x5e6f('0x2a')]){throw new Error(_0xea9d73[_0x5e6f('0x6f')][_0x5e6f('0x2a')]['message']);}var _0x36a0ce=[];var _0xa6811c=[];var _0x1cb2e3=[_0x5e6f('0x70'),_0x5e6f('0x71'),'Description','WhoId',_0x5e6f('0x72'),_0x5e6f('0x73'),_0x5e6f('0x74'),_0x5e6f('0x75')];_0xa6811c=_[_0x5e6f('0x76')](_0xea9d73[_0x5e6f('0x38')],function(_0x5a7f34){return _0x1cb2e3[_0x5e6f('0x77')](_0x5a7f34[_0x5e6f('0x78')]);});for(var _0x4665b9=0x0;_0x4665b9<_0xa6811c[_0x5e6f('0x3a')];_0x4665b9++){if(_0xa6811c[_0x4665b9][_0x5e6f('0x79')]===![]){_0x36a0ce[_0x5e6f('0x7a')]({'id':_0xa6811c[_0x4665b9]['id'],'name':_0xa6811c[_0x4665b9][_0x5e6f('0x7b')],'custom':_0xa6811c[_0x4665b9][_0x5e6f('0x7c')],'options':_0xa6811c[_0x4665b9]['data_type']===_0x5e6f('0x7d')&&_0xa6811c[_0x4665b9][_0x5e6f('0x7e')][_0x5e6f('0x3a')]>-0x1?_[_0x5e6f('0x2f')](_0xa6811c[_0x4665b9][_0x5e6f('0x7e')],function(_0x7f1774){return{'name':_0x7f1774,'value':_0x7f1774};}):[]});}}return{'count':_0x36a0ce[_0x5e6f('0x3a')],'rows':_0x36a0ce};}else{return{'count':0x0,'rows':[]};}})[_0x5e6f('0x27')](respondWithResult(_0x2d2f71,null))[_0x5e6f('0x49')](function(_0x4efdf7){var _0x32556a=_0x2b41b7[_0x5e6f('0x36')][_0x5e6f('0x7f')]?0x1f4:_0x4efdf7[_0x5e6f('0x80')]||0x1f4;logger[_0x5e6f('0x2a')](_0x5e6f('0x81'),_0x5e6f('0x65'),_0x32556a,JSON[_0x5e6f('0x82')](_0x4efdf7));delete _0x4efdf7['name'];if(_0x32556a===0x191){_0x32556a=0x190;}_0x2d2f71[_0x5e6f('0x1a')](_0x32556a)[_0x5e6f('0x2d')](_0x2b41b7[_0x5e6f('0x36')][_0x5e6f('0x7f')]?{'message':_0x5e6f('0x83'),'statusCode':_0x4efdf7[_0x5e6f('0x80')]}:_0x4efdf7);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 1243222..5033a10 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 _0x42b9=['serverUrl','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','clientId','application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','https://accounts.zoho.eu','parse','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','changed','zone','clientSecret','code','host'];(function(_0x3afe59,_0x549c3b){var _0x24817b=function(_0xe64f12){while(--_0xe64f12){_0x3afe59['push'](_0x3afe59['shift']());}};_0x24817b(++_0x549c3b);}(_0x42b9,0xc9));var _0x942b=function(_0x24ec92,_0x34a45e){_0x24ec92=_0x24ec92-0x0;var _0x49fec3=_0x42b9[_0x24ec92];return _0x49fec3;};'use strict';var _=require('lodash');var util=require(_0x942b('0x0'));var logger=require(_0x942b('0x1'))(_0x942b('0x2'));var moment=require(_0x942b('0x3'));var BPromise=require(_0x942b('0x4'));var rp=require(_0x942b('0x5'));var fs=require('fs');var path=require(_0x942b('0x6'));var rimraf=require(_0x942b('0x7'));var config=require(_0x942b('0x8'));var attributes=require(_0x942b('0x9'));var integrations=require(_0x942b('0xa'));module[_0x942b('0xb')]=function(_0x55b548,_0x96d6c6){return _0x55b548[_0x942b('0xc')](_0x942b('0xd'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x478bfb,_0x12506f,_0x354a4c){if(_0x478bfb[_0x942b('0xe')](_0x942b('0xf'))||_0x478bfb['changed']('serverUrl')||_0x478bfb[_0x942b('0xe')]('clientId')||_0x478bfb['changed'](_0x942b('0x10'))||_0x478bfb[_0x942b('0xe')](_0x942b('0x11'))||_0x478bfb[_0x942b('0xe')](_0x942b('0x12'))){var _0xea229b,_0x14f19d;_0xea229b=_0x478bfb[_0x942b('0x13')];var _0x1603c3=_0xea229b[_0x942b('0x14')](-0x1);if(_0x1603c3==='/'||_0x1603c3==='\x5c'||_0x1603c3===':'){_0xea229b=_0xea229b['substring'](0x0,_0xea229b[_0x942b('0x15')](_0x1603c3));}switch(_0x478bfb[_0x942b('0xf')]){case'US':_0x14f19d=_0x942b('0x16');break;case'AU':_0x14f19d=_0x942b('0x17');break;case'IN':_0x14f19d=_0x942b('0x18');break;case'CN':_0x14f19d=_0x942b('0x19');break;default:_0x14f19d='https://accounts.zoho.eu';break;}var _0x234156={'method':_0x942b('0x1a'),'uri':_0x14f19d+_0x942b('0x1b'),'form':{'grant_type':_0x942b('0x1c'),'client_id':_0x478bfb[_0x942b('0x1d')],'client_secret':_0x478bfb[_0x942b('0x10')],'redirect_uri':_0x478bfb[_0x942b('0x13')],'code':_0x478bfb[_0x942b('0x11')]},'headers':{'Content-Type':_0x942b('0x1e')}};return rp(_0x234156)[_0x942b('0x1f')](function(_0x1054ca){var _0x2621b6=JSON['parse'](_0x1054ca);if(_0x2621b6[_0x942b('0x20')]){_0x478bfb[_0x942b('0x21')]=_0x2621b6['refresh_token'];logger[_0x942b('0x22')](util[_0x942b('0x23')](_0x942b('0x24'),_0x478bfb[_0x942b('0x25')],_0x478bfb['id']));}else{logger['error'](util[_0x942b('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x478bfb[_0x942b('0x25')],_0x478bfb['id']),util[_0x942b('0x26')](_0x2621b6,{'showHidden':![],'depth':null}));}return _0x354a4c(null,_0x12506f);})[_0x942b('0x27')](function(_0x1b0894){logger['error'](util[_0x942b('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x478bfb['name'],_0x478bfb['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x354a4c(_0x1b0894);});}else{return _0x354a4c(null,_0x12506f);}},'beforeUpdate':function(_0x26ed7c,_0x400007,_0x350d9c){if(_0x26ed7c[_0x942b('0xe')]('zone')||_0x26ed7c[_0x942b('0xe')](_0x942b('0x13'))||_0x26ed7c['changed']('clientId')||_0x26ed7c[_0x942b('0xe')]('clientSecret')||_0x26ed7c[_0x942b('0xe')]('code')||_0x26ed7c[_0x942b('0xe')](_0x942b('0x12'))){var _0x487f12,_0x277d4e;_0x487f12=_0x26ed7c[_0x942b('0x13')];var _0x4e1ec2=_0x487f12[_0x942b('0x14')](-0x1);if(_0x4e1ec2==='/'||_0x4e1ec2==='\x5c'||_0x4e1ec2===':'){_0x487f12=_0x487f12['substring'](0x0,_0x487f12[_0x942b('0x15')](_0x4e1ec2));}switch(_0x26ed7c[_0x942b('0xf')]){case'US':_0x277d4e=_0x942b('0x16');break;case'AU':_0x277d4e=_0x942b('0x17');break;case'IN':_0x277d4e='https://accounts.zoho.in';break;case'CN':_0x277d4e='https://accounts.zoho.com.cn';break;default:_0x277d4e=_0x942b('0x28');break;}var _0x18db98={'method':_0x942b('0x1a'),'uri':_0x277d4e+_0x942b('0x1b'),'form':{'grant_type':_0x942b('0x1c'),'client_id':_0x26ed7c[_0x942b('0x1d')],'client_secret':_0x26ed7c[_0x942b('0x10')],'redirect_uri':_0x26ed7c[_0x942b('0x13')],'code':_0x26ed7c['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x18db98)[_0x942b('0x1f')](function(_0x323bd3){var _0x278028=JSON[_0x942b('0x29')](_0x323bd3);if(_0x278028['refresh_token']){_0x26ed7c[_0x942b('0x21')]=_0x278028[_0x942b('0x20')];logger['info'](util[_0x942b('0x23')](_0x942b('0x24'),_0x26ed7c[_0x942b('0x25')],_0x26ed7c['id']));}else{logger[_0x942b('0x2a')](util['format'](_0x942b('0x2b'),_0x26ed7c[_0x942b('0x25')],_0x26ed7c['id']),util[_0x942b('0x26')](_0x278028,{'showHidden':![],'depth':null}));}return _0x350d9c(null,_0x400007);})['catch'](function(_0x5ad487){logger[_0x942b('0x2a')](util[_0x942b('0x23')](_0x942b('0x2b'),_0x26ed7c['name'],_0x26ed7c['id']),util[_0x942b('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x350d9c(_0x5ad487);});}else{return _0x350d9c(null,_0x400007);}}}});}; \ No newline at end of file +var _0xcdcb=['moment','bluebird','path','rimraf','../../components/integrations/configuration','define','int_zoho_accounts','changed','zone','serverUrl','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com.au','POST','clientId','clientSecret','application/x-www-form-urlencoded','parse','refresh_token','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','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','then','refreshToken','info','util','../../config/logger','api'];(function(_0x5c6c1b,_0x3a73b3){var _0x12e0b9=function(_0x41feb4){while(--_0x41feb4){_0x5c6c1b['push'](_0x5c6c1b['shift']());}};_0x12e0b9(++_0x3a73b3);}(_0xcdcb,0x75));var _0xbcdc=function(_0x5b0b2d,_0x46ac12){_0x5b0b2d=_0x5b0b2d-0x0;var _0x49e516=_0xcdcb[_0x5b0b2d];return _0x49e516;};'use strict';var _=require('lodash');var util=require(_0xbcdc('0x0'));var logger=require(_0xbcdc('0x1'))(_0xbcdc('0x2'));var moment=require(_0xbcdc('0x3'));var BPromise=require(_0xbcdc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbcdc('0x5'));var rimraf=require(_0xbcdc('0x6'));var config=require('../../config/environment');var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xbcdc('0x7'));module['exports']=function(_0x48a0ab,_0x280311){return _0x48a0ab[_0xbcdc('0x8')]('ZohoAccount',attributes,{'tableName':_0xbcdc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x391750,_0x16053e,_0x60ad74){if(_0x391750[_0xbcdc('0xa')](_0xbcdc('0xb'))||_0x391750[_0xbcdc('0xa')](_0xbcdc('0xc'))||_0x391750[_0xbcdc('0xa')]('clientId')||_0x391750[_0xbcdc('0xa')]('clientSecret')||_0x391750[_0xbcdc('0xa')](_0xbcdc('0xd'))||_0x391750[_0xbcdc('0xa')](_0xbcdc('0xe'))){var _0x52212b,_0x16cef6;_0x52212b=_0x391750[_0xbcdc('0xc')];var _0xcefe2f=_0x52212b[_0xbcdc('0xf')](-0x1);if(_0xcefe2f==='/'||_0xcefe2f==='\x5c'||_0xcefe2f===':'){_0x52212b=_0x52212b[_0xbcdc('0x10')](0x0,_0x52212b[_0xbcdc('0x11')](_0xcefe2f));}switch(_0x391750[_0xbcdc('0xb')]){case'US':_0x16cef6='https://accounts.zoho.com';break;case'AU':_0x16cef6=_0xbcdc('0x12');break;case'IN':_0x16cef6='https://accounts.zoho.in';break;case'CN':_0x16cef6='https://accounts.zoho.com.cn';break;default:_0x16cef6='https://accounts.zoho.eu';break;}var _0x2973ee={'method':_0xbcdc('0x13'),'uri':_0x16cef6+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x391750[_0xbcdc('0x14')],'client_secret':_0x391750[_0xbcdc('0x15')],'redirect_uri':_0x391750[_0xbcdc('0xc')],'code':_0x391750[_0xbcdc('0xd')]},'headers':{'Content-Type':_0xbcdc('0x16')}};return rp(_0x2973ee)['then'](function(_0x271b39){var _0x549abe=JSON[_0xbcdc('0x17')](_0x271b39);if(_0x549abe[_0xbcdc('0x18')]){_0x391750['refreshToken']=_0x549abe[_0xbcdc('0x18')];logger['info'](util[_0xbcdc('0x19')](_0xbcdc('0x1a'),_0x391750[_0xbcdc('0x1b')],_0x391750['id']));}else{logger[_0xbcdc('0x1c')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x391750[_0xbcdc('0x1b')],_0x391750['id']),util[_0xbcdc('0x1d')](_0x549abe,{'showHidden':![],'depth':null}));}return _0x60ad74(null,_0x16053e);})[_0xbcdc('0x1e')](function(_0x521578){logger[_0xbcdc('0x1c')](util[_0xbcdc('0x19')](_0xbcdc('0x1f'),_0x391750[_0xbcdc('0x1b')],_0x391750['id']),util[_0xbcdc('0x1d')](parsedResult,{'showHidden':![],'depth':null}));return _0x60ad74(_0x521578);});}else{return _0x60ad74(null,_0x16053e);}},'beforeUpdate':function(_0x1ddab5,_0xf5fa1a,_0x3d60b9){if(_0x1ddab5[_0xbcdc('0xa')]('zone')||_0x1ddab5[_0xbcdc('0xa')]('serverUrl')||_0x1ddab5['changed'](_0xbcdc('0x14'))||_0x1ddab5[_0xbcdc('0xa')]('clientSecret')||_0x1ddab5[_0xbcdc('0xa')](_0xbcdc('0xd'))||_0x1ddab5[_0xbcdc('0xa')]('host')){var _0x8a7029,_0x29bc40;_0x8a7029=_0x1ddab5[_0xbcdc('0xc')];var _0x599cf0=_0x8a7029[_0xbcdc('0xf')](-0x1);if(_0x599cf0==='/'||_0x599cf0==='\x5c'||_0x599cf0===':'){_0x8a7029=_0x8a7029[_0xbcdc('0x10')](0x0,_0x8a7029[_0xbcdc('0x11')](_0x599cf0));}switch(_0x1ddab5[_0xbcdc('0xb')]){case'US':_0x29bc40=_0xbcdc('0x20');break;case'AU':_0x29bc40=_0xbcdc('0x12');break;case'IN':_0x29bc40=_0xbcdc('0x21');break;case'CN':_0x29bc40=_0xbcdc('0x22');break;default:_0x29bc40=_0xbcdc('0x23');break;}var _0x299958={'method':_0xbcdc('0x13'),'uri':_0x29bc40+_0xbcdc('0x24'),'form':{'grant_type':'authorization_code','client_id':_0x1ddab5[_0xbcdc('0x14')],'client_secret':_0x1ddab5[_0xbcdc('0x15')],'redirect_uri':_0x1ddab5[_0xbcdc('0xc')],'code':_0x1ddab5[_0xbcdc('0xd')]},'headers':{'Content-Type':_0xbcdc('0x16')}};return rp(_0x299958)[_0xbcdc('0x25')](function(_0x5bb5ab){var _0x443477=JSON[_0xbcdc('0x17')](_0x5bb5ab);if(_0x443477['refresh_token']){_0x1ddab5[_0xbcdc('0x26')]=_0x443477[_0xbcdc('0x18')];logger[_0xbcdc('0x27')](util['format'](_0xbcdc('0x1a'),_0x1ddab5[_0xbcdc('0x1b')],_0x1ddab5['id']));}else{logger[_0xbcdc('0x1c')](util['format'](_0xbcdc('0x1f'),_0x1ddab5[_0xbcdc('0x1b')],_0x1ddab5['id']),util['inspect'](_0x443477,{'showHidden':![],'depth':null}));}return _0x3d60b9(null,_0xf5fa1a);})['catch'](function(_0x427ce7){logger[_0xbcdc('0x1c')](util[_0xbcdc('0x19')](_0xbcdc('0x1f'),_0x1ddab5[_0xbcdc('0x1b')],_0x1ddab5['id']),util[_0xbcdc('0x1d')](parsedResult,{'showHidden':![],'depth':null}));return _0x3d60b9(_0x427ce7);});}else{return _0x3d60b9(null,_0xf5fa1a);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 6a310fa..4e3392d 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 _0xb422=['code','message','info','result','catch','GetZohoAccount','ZohoAccount','options','where','limit','map','model','attributes','include','then','find','ShowZohoAccount','bluebird','../../mysqldb','../../config/logger','../../config/environment','client','http','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1d3a72,_0x47274d){var _0x394b80=function(_0x119fe9){while(--_0x119fe9){_0x1d3a72['push'](_0x1d3a72['shift']());}};_0x394b80(++_0x47274d);}(_0xb422,0x85));var _0x2b42=function(_0x3aed6b,_0x10d63e){_0x3aed6b=_0x3aed6b-0x0;var _0x50cc84=_0xb422[_0x3aed6b];return _0x50cc84;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2b42('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b42('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x2b42('0x2'))('rpc');var config=require(_0x2b42('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x2b42('0x4')][_0x2b42('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x750c2,_0x51b3bd,_0xde9c67){return new BPromise(function(_0x1b64f7,_0x12b303){return client['request'](_0x750c2,_0xde9c67)['then'](function(_0x4174e8){logger['info'](_0x2b42('0x6'),_0x51b3bd,_0x2b42('0x7'));logger[_0x2b42('0x8')](_0x2b42('0x9'),_0x51b3bd,'request\x20sent',JSON[_0x2b42('0xa')](_0x4174e8));if(_0x4174e8[_0x2b42('0xb')]){if(_0x4174e8['error'][_0x2b42('0xc')]===0x1f4){logger[_0x2b42('0xb')](_0x2b42('0x6'),_0x51b3bd,_0x4174e8[_0x2b42('0xb')]['message']);return _0x12b303(_0x4174e8['error'][_0x2b42('0xd')]);}logger[_0x2b42('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x51b3bd,_0x4174e8[_0x2b42('0xb')][_0x2b42('0xd')]);return _0x1b64f7(_0x4174e8[_0x2b42('0xb')][_0x2b42('0xd')]);}else{logger[_0x2b42('0xe')](_0x2b42('0x6'),_0x51b3bd,_0x2b42('0x7'));_0x1b64f7(_0x4174e8[_0x2b42('0xf')][_0x2b42('0xd')]);}})[_0x2b42('0x10')](function(_0x4897d8){logger[_0x2b42('0xb')](_0x2b42('0x6'),_0x51b3bd,_0x4897d8);_0x12b303(_0x4897d8);});});}exports[_0x2b42('0x11')]=function(_0x3e3426){var _0x27419d=this;return new Promise(function(_0x3ab83c,_0xa28ba4){return db[_0x2b42('0x12')]['findAll']({'raw':_0x3e3426[_0x2b42('0x13')]?_0x3e3426[_0x2b42('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x3e3426[_0x2b42('0x13')]?_0x3e3426['options'][_0x2b42('0x14')]||null:null,'attributes':_0x3e3426[_0x2b42('0x13')]?_0x3e3426[_0x2b42('0x13')]['attributes']||null:null,'limit':_0x3e3426['options']?_0x3e3426[_0x2b42('0x13')][_0x2b42('0x15')]||null:null,'include':_0x3e3426[_0x2b42('0x13')]?_0x3e3426[_0x2b42('0x13')]['include']?_[_0x2b42('0x16')](_0x3e3426[_0x2b42('0x13')]['include'],function(_0x2b9531){return{'model':db[_0x2b9531[_0x2b42('0x17')]],'as':_0x2b9531['as'],'attributes':_0x2b9531[_0x2b42('0x18')],'include':_0x2b9531[_0x2b42('0x19')]?_[_0x2b42('0x16')](_0x2b9531[_0x2b42('0x19')],function(_0x5367f0){return{'model':db[_0x5367f0[_0x2b42('0x17')]],'as':_0x5367f0['as'],'attributes':_0x5367f0[_0x2b42('0x18')],'include':_0x5367f0[_0x2b42('0x19')]?_[_0x2b42('0x16')](_0x5367f0[_0x2b42('0x19')],function(_0x807625){return{'model':db[_0x807625[_0x2b42('0x17')]],'as':_0x807625['as'],'attributes':_0x807625[_0x2b42('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2b42('0x1a')](function(_0xe32cdc){logger[_0x2b42('0xe')]('GetZohoAccount',_0x3e3426);logger['debug'](_0x2b42('0x11'),_0x3e3426,JSON[_0x2b42('0xa')](_0xe32cdc));_0x3ab83c(_0xe32cdc);})[_0x2b42('0x10')](function(_0x352ef7){logger['error'](_0x2b42('0x11'),_0x352ef7[_0x2b42('0xd')],_0x3e3426);_0xa28ba4(_0x27419d[_0x2b42('0xb')](0x1f4,_0x352ef7['message']));});});};exports['ShowZohoAccount']=function(_0x39e32e){var _0x15298d=this;return new Promise(function(_0x41d4ef,_0x17d28a){return db['ZohoAccount'][_0x2b42('0x1b')]({'raw':_0x39e32e[_0x2b42('0x13')]?_0x39e32e[_0x2b42('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x39e32e[_0x2b42('0x13')]?_0x39e32e[_0x2b42('0x13')][_0x2b42('0x14')]||null:null,'attributes':_0x39e32e[_0x2b42('0x13')]?_0x39e32e[_0x2b42('0x13')][_0x2b42('0x18')]||null:null,'include':_0x39e32e[_0x2b42('0x13')]?_0x39e32e[_0x2b42('0x13')][_0x2b42('0x19')]?_[_0x2b42('0x16')](_0x39e32e[_0x2b42('0x13')]['include'],function(_0x2b5d28){return{'model':db[_0x2b5d28['model']],'as':_0x2b5d28['as'],'attributes':_0x2b5d28['attributes'],'include':_0x2b5d28[_0x2b42('0x19')]?_[_0x2b42('0x16')](_0x2b5d28['include'],function(_0x480315){return{'model':db[_0x480315['model']],'as':_0x480315['as'],'attributes':_0x480315[_0x2b42('0x18')],'include':_0x480315[_0x2b42('0x19')]?_[_0x2b42('0x16')](_0x480315['include'],function(_0x45f8d5){return{'model':db[_0x45f8d5[_0x2b42('0x17')]],'as':_0x45f8d5['as'],'attributes':_0x45f8d5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2603f7){logger[_0x2b42('0xe')](_0x2b42('0x1c'),_0x39e32e);logger['debug'](_0x2b42('0x1c'),_0x39e32e,JSON[_0x2b42('0xa')](_0x2603f7));_0x41d4ef(_0x2603f7);})[_0x2b42('0x10')](function(_0x45d4ab){logger[_0x2b42('0xb')]('ShowZohoAccount',_0x45d4ab[_0x2b42('0xd')],_0x39e32e);_0x17d28a(_0x15298d[_0x2b42('0xb')](0x1f4,_0x45d4ab[_0x2b42('0xd')]));});});}; \ No newline at end of file +var _0x06ae=['rpc','http','request','info','request\x20sent','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','ZohoAccount','findAll','options','attributes','limit','include','map','model','debug','GetZohoAccount','catch','find','raw','then','ShowZohoAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x38bf96,_0x3341de){var _0x34dd6c=function(_0x5ea5af){while(--_0x5ea5af){_0x38bf96['push'](_0x38bf96['shift']());}};_0x34dd6c(++_0x3341de);}(_0x06ae,0x16e));var _0xe06a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x06ae[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xe06a('0x0'));var moment=require(_0xe06a('0x1'));var BPromise=require(_0xe06a('0x2'));var rs=require(_0xe06a('0x3'));var fs=require('fs');var Redis=require(_0xe06a('0x4'));var db=require(_0xe06a('0x5'))['db'];var utils=require(_0xe06a('0x6'));var logger=require(_0xe06a('0x7'))(_0xe06a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe06a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x745f79,_0x20bd8a,_0x3dfa60){return new BPromise(function(_0x1ea66c,_0x563322){return client[_0xe06a('0xa')](_0x745f79,_0x3dfa60)['then'](function(_0x586e05){logger[_0xe06a('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x20bd8a,_0xe06a('0xc'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x20bd8a,_0xe06a('0xc'),JSON[_0xe06a('0xd')](_0x586e05));if(_0x586e05['error']){if(_0x586e05[_0xe06a('0xe')][_0xe06a('0xf')]===0x1f4){logger['error'](_0xe06a('0x10'),_0x20bd8a,_0x586e05[_0xe06a('0xe')][_0xe06a('0x11')]);return _0x563322(_0x586e05['error'][_0xe06a('0x11')]);}logger[_0xe06a('0xe')](_0xe06a('0x10'),_0x20bd8a,_0x586e05[_0xe06a('0xe')][_0xe06a('0x11')]);return _0x1ea66c(_0x586e05['error'][_0xe06a('0x11')]);}else{logger[_0xe06a('0xb')](_0xe06a('0x10'),_0x20bd8a,_0xe06a('0xc'));_0x1ea66c(_0x586e05[_0xe06a('0x12')][_0xe06a('0x11')]);}})['catch'](function(_0xa9b1af){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x20bd8a,_0xa9b1af);_0x563322(_0xa9b1af);});});}exports['GetZohoAccount']=function(_0x7a5a6f){var _0x43ce7b=this;return new Promise(function(_0xc62c1f,_0x57f5aa){return db[_0xe06a('0x13')][_0xe06a('0x14')]({'raw':_0x7a5a6f['options']?_0x7a5a6f[_0xe06a('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x7a5a6f[_0xe06a('0x15')]?_0x7a5a6f['options']['where']||null:null,'attributes':_0x7a5a6f[_0xe06a('0x15')]?_0x7a5a6f[_0xe06a('0x15')][_0xe06a('0x16')]||null:null,'limit':_0x7a5a6f[_0xe06a('0x15')]?_0x7a5a6f[_0xe06a('0x15')][_0xe06a('0x17')]||null:null,'include':_0x7a5a6f[_0xe06a('0x15')]?_0x7a5a6f[_0xe06a('0x15')][_0xe06a('0x18')]?_[_0xe06a('0x19')](_0x7a5a6f['options'][_0xe06a('0x18')],function(_0x31c2cb){return{'model':db[_0x31c2cb[_0xe06a('0x1a')]],'as':_0x31c2cb['as'],'attributes':_0x31c2cb[_0xe06a('0x16')],'include':_0x31c2cb[_0xe06a('0x18')]?_[_0xe06a('0x19')](_0x31c2cb[_0xe06a('0x18')],function(_0x19a7e0){return{'model':db[_0x19a7e0[_0xe06a('0x1a')]],'as':_0x19a7e0['as'],'attributes':_0x19a7e0['attributes'],'include':_0x19a7e0['include']?_[_0xe06a('0x19')](_0x19a7e0['include'],function(_0x319e25){return{'model':db[_0x319e25['model']],'as':_0x319e25['as'],'attributes':_0x319e25['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x37ff49){logger[_0xe06a('0xb')]('GetZohoAccount',_0x7a5a6f);logger[_0xe06a('0x1b')](_0xe06a('0x1c'),_0x7a5a6f,JSON[_0xe06a('0xd')](_0x37ff49));_0xc62c1f(_0x37ff49);})[_0xe06a('0x1d')](function(_0x15cf61){logger[_0xe06a('0xe')](_0xe06a('0x1c'),_0x15cf61[_0xe06a('0x11')],_0x7a5a6f);_0x57f5aa(_0x43ce7b[_0xe06a('0xe')](0x1f4,_0x15cf61['message']));});});};exports['ShowZohoAccount']=function(_0x177d3e){var _0x1f985b=this;return new Promise(function(_0x46c75a,_0x1d4375){return db['ZohoAccount'][_0xe06a('0x1e')]({'raw':_0x177d3e['options']?_0x177d3e[_0xe06a('0x15')][_0xe06a('0x1f')]===undefined?!![]:![]:!![],'where':_0x177d3e[_0xe06a('0x15')]?_0x177d3e[_0xe06a('0x15')]['where']||null:null,'attributes':_0x177d3e[_0xe06a('0x15')]?_0x177d3e[_0xe06a('0x15')][_0xe06a('0x16')]||null:null,'include':_0x177d3e[_0xe06a('0x15')]?_0x177d3e['options']['include']?_[_0xe06a('0x19')](_0x177d3e[_0xe06a('0x15')][_0xe06a('0x18')],function(_0x1a0800){return{'model':db[_0x1a0800[_0xe06a('0x1a')]],'as':_0x1a0800['as'],'attributes':_0x1a0800[_0xe06a('0x16')],'include':_0x1a0800['include']?_['map'](_0x1a0800[_0xe06a('0x18')],function(_0x541bf5){return{'model':db[_0x541bf5[_0xe06a('0x1a')]],'as':_0x541bf5['as'],'attributes':_0x541bf5['attributes'],'include':_0x541bf5[_0xe06a('0x18')]?_[_0xe06a('0x19')](_0x541bf5[_0xe06a('0x18')],function(_0x52df2c){return{'model':db[_0x52df2c['model']],'as':_0x52df2c['as'],'attributes':_0x52df2c[_0xe06a('0x16')]};}):[]};}):[]};}):[]:[]})[_0xe06a('0x20')](function(_0xefd764){logger[_0xe06a('0xb')](_0xe06a('0x21'),_0x177d3e);logger[_0xe06a('0x1b')]('ShowZohoAccount',_0x177d3e,JSON['stringify'](_0xefd764));_0x46c75a(_0xefd764);})['catch'](function(_0x598caf){logger[_0xe06a('0xe')](_0xe06a('0x21'),_0x598caf[_0xe06a('0x11')],_0x177d3e);_0x1d4375(_0x1f985b[_0xe06a('0xe')](0x1f4,_0x598caf[_0xe06a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 72bc0ca..d16fd82 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 _0x130c=['index','get','/:id','show','getFields','/:id/subjects','getSubjects','getDescriptions','post','update','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x130c,0x1da));var _0xc130=function(_0x439716,_0x386f49){_0x439716=_0x439716-0x0;var _0x18feb1=_0x130c[_0x439716];return _0x18feb1;};'use strict';var multer=require(_0xc130('0x0'));var util=require(_0xc130('0x1'));var path=require(_0xc130('0x2'));var timeout=require('connect-timeout');var express=require(_0xc130('0x3'));var router=express['Router']();var fs_extra=require(_0xc130('0x4'));var auth=require(_0xc130('0x5'));var interaction=require(_0xc130('0x6'));var config=require(_0xc130('0x7'));var controller=require(_0xc130('0x8'));router['get']('/',auth[_0xc130('0x9')](),controller[_0xc130('0xa')]);router[_0xc130('0xb')](_0xc130('0xc'),auth[_0xc130('0x9')](),controller[_0xc130('0xd')]);router[_0xc130('0xb')]('/:id/fields',auth[_0xc130('0x9')](),controller[_0xc130('0xe')]);router[_0xc130('0xb')](_0xc130('0xf'),auth[_0xc130('0x9')](),controller[_0xc130('0x10')]);router['get']('/:id/descriptions',auth[_0xc130('0x9')](),controller[_0xc130('0x11')]);router[_0xc130('0x12')]('/',auth[_0xc130('0x9')](),controller['create']);router['put'](_0xc130('0xc'),auth[_0xc130('0x9')](),controller[_0xc130('0x13')]);router['delete'](_0xc130('0xc'),auth[_0xc130('0x9')](),controller[_0xc130('0x14')]);module[_0xc130('0x15')]=router; \ No newline at end of file +var _0x3b04=['get','index','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intZohoConfiguration.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3b04,0x87));var _0x43b0=function(_0x2ab4e4,_0x49da6e){_0x2ab4e4=_0x2ab4e4-0x0;var _0x15e8de=_0x3b04[_0x2ab4e4];return _0x15e8de;};'use strict';var multer=require(_0x43b0('0x0'));var util=require(_0x43b0('0x1'));var path=require(_0x43b0('0x2'));var timeout=require(_0x43b0('0x3'));var express=require(_0x43b0('0x4'));var router=express[_0x43b0('0x5')]();var fs_extra=require(_0x43b0('0x6'));var auth=require(_0x43b0('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x43b0('0x8'));router[_0x43b0('0x9')]('/',auth['isAuthenticated'](),controller[_0x43b0('0xa')]);router[_0x43b0('0x9')](_0x43b0('0xb'),auth[_0x43b0('0xc')](),controller['show']);router[_0x43b0('0x9')](_0x43b0('0xd'),auth['isAuthenticated'](),controller[_0x43b0('0xe')]);router[_0x43b0('0x9')](_0x43b0('0xf'),auth[_0x43b0('0xc')](),controller[_0x43b0('0x10')]);router['get'](_0x43b0('0x11'),auth[_0x43b0('0xc')](),controller[_0x43b0('0x12')]);router[_0x43b0('0x13')]('/',auth[_0x43b0('0xc')](),controller['create']);router[_0x43b0('0x14')]('/:id',auth[_0x43b0('0xc')](),controller['update']);router[_0x43b0('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x43b0('0x16')]);module[_0x43b0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index fde0427..4abf3ad 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 _0x7ed3=['lead','contact','contact_lead','STRING','ENUM'];(function(_0x40eccd,_0x2f4b1){var _0xd79dca=function(_0x5d3c6d){while(--_0x5d3c6d){_0x40eccd['push'](_0x40eccd['shift']());}};_0xd79dca(++_0x2f4b1);}(_0x7ed3,0x1c0));var _0x37ed=function(_0x180176,_0x3ac574){_0x180176=_0x180176-0x0;var _0x327925=_0x7ed3[_0x180176];return _0x327925;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x37ed('0x0')]},'moduleCreate':{'type':Sequelize[_0x37ed('0x1')](_0x37ed('0x2'),_0x37ed('0x3'),'nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0x37ed('0x3'),_0x37ed('0x2')),'defaultValue':_0x37ed('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb7b6=['STRING','sequelize','exports','lead','contact','ENUM','contact_lead'];(function(_0x9479f4,_0x3b1977){var _0x1335cb=function(_0x22eb6e){while(--_0x22eb6e){_0x9479f4['push'](_0x9479f4['shift']());}};_0x1335cb(++_0x3b1977);}(_0xb7b6,0x15f));var _0x6b7b=function(_0x1ebb81,_0x5e36ba){_0x1ebb81=_0x1ebb81-0x0;var _0x1b0d8f=_0xb7b6[_0x1ebb81];return _0x1b0d8f;};'use strict';var Sequelize=require(_0x6b7b('0x0'));module[_0x6b7b('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM'](_0x6b7b('0x2'),_0x6b7b('0x3'),'nothing'),'defaultValue':_0x6b7b('0x2')},'moduleSearch':{'type':Sequelize[_0x6b7b('0x4')]('contact_lead','contact',_0x6b7b('0x2')),'defaultValue':_0x6b7b('0x5')},'description':{'type':Sequelize[_0x6b7b('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 283ddf7..3dd3fba 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 _0xce40=['offset','undefined','count','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','name','send','index','map','ZohoConfiguration','type','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','findAll','rows','catch','show','keys','rawAttributes','includeAll','include','merge','find','create','update','body','params','getFields','findOne','ZohoField','length','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json'];(function(_0x5423a6,_0x67c878){var _0x4c33c5=function(_0x28c949){while(--_0x28c949){_0x5423a6['push'](_0x5423a6['shift']());}};_0x4c33c5(++_0x67c878);}(_0xce40,0x1c2));var _0x0ce4=function(_0x4702ee,_0xaf6a45){_0x4702ee=_0x4702ee-0x0;var _0x62ca7d=_0xce40[_0x4702ee];return _0x62ca7d;};'use strict';var emlformat=require(_0x0ce4('0x0'));var rimraf=require(_0x0ce4('0x1'));var zipdir=require(_0x0ce4('0x2'));var jsonpatch=require(_0x0ce4('0x3'));var rp=require(_0x0ce4('0x4'));var moment=require(_0x0ce4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0ce4('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0ce4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ce4('0x8'));var squel=require(_0x0ce4('0x9'));var crypto=require(_0x0ce4('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0ce4('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0ce4('0xc'));var authService=require(_0x0ce4('0xd'));var qs=require(_0x0ce4('0xe'));var as=require(_0x0ce4('0xf'));var hardwareService=require(_0x0ce4('0x10'));var logger=require(_0x0ce4('0x11'))(_0x0ce4('0x12'));var utils=require(_0x0ce4('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0ce4('0x14'));var db=require(_0x0ce4('0x15'))['db'];function respondWithStatusCode(_0x3da260,_0x424b93){_0x424b93=_0x424b93||0xcc;return function(_0x3cce56){if(_0x3cce56){return _0x3da260['sendStatus'](_0x424b93);}return _0x3da260[_0x0ce4('0x16')](_0x424b93)['end']();};}function respondWithResult(_0x23ed27,_0x130d84){_0x130d84=_0x130d84||0xc8;return function(_0x200910){if(_0x200910){return _0x23ed27['status'](_0x130d84)[_0x0ce4('0x17')](_0x200910);}};}function respondWithFilteredResult(_0x3d20a9,_0x17282f){return function(_0x16d4fc){if(_0x16d4fc){var _0x8c7a0e=typeof _0x17282f[_0x0ce4('0x18')]==='undefined'&&typeof _0x17282f['limit']===_0x0ce4('0x19');var _0x34f42c=_0x16d4fc[_0x0ce4('0x1a')];var _0xf90da4=_0x8c7a0e?0x0:_0x17282f['offset'];var _0x44cf8a=_0x8c7a0e?_0x16d4fc[_0x0ce4('0x1a')]:_0x17282f[_0x0ce4('0x18')]+_0x17282f['limit'];var _0x4fa66c;if(_0x44cf8a>=_0x34f42c){_0x44cf8a=_0x34f42c;_0x4fa66c=0xc8;}else{_0x4fa66c=0xce;}_0x3d20a9[_0x0ce4('0x16')](_0x4fa66c);return _0x3d20a9['set'](_0x0ce4('0x1b'),_0xf90da4+'-'+_0x44cf8a+'/'+_0x34f42c)[_0x0ce4('0x17')](_0x16d4fc);}return null;};}function patchUpdates(_0x12b7e8){return function(_0x51bbbd){try{jsonpatch[_0x0ce4('0x1c')](_0x51bbbd,_0x12b7e8,!![]);}catch(_0x279100){return BPromise[_0x0ce4('0x1d')](_0x279100);}return _0x51bbbd[_0x0ce4('0x1e')]();};}function saveUpdates(_0x31134c,_0x570227){return function(_0x38816f){if(_0x38816f){return _0x38816f['update'](_0x31134c)[_0x0ce4('0x1f')](function(_0x3e0884){return _0x3e0884;});}return null;};}function removeEntity(_0x3d3cd1,_0x451b68){return function(_0x184be7){if(_0x184be7){return _0x184be7[_0x0ce4('0x20')]()['then'](function(){_0x3d3cd1['status'](0xcc)[_0x0ce4('0x21')]();});}};}function handleEntityNotFound(_0x8e64f5,_0x25b39e){return function(_0x5bf1ca){if(!_0x5bf1ca){_0x8e64f5[_0x0ce4('0x22')](0x194);}return _0x5bf1ca;};}function handleError(_0x4fcc09,_0x3f04f9){_0x3f04f9=_0x3f04f9||0x1f4;return function(_0x2ff859){logger[_0x0ce4('0x23')](_0x2ff859['stack']);if(_0x2ff859['name']){delete _0x2ff859[_0x0ce4('0x24')];}_0x4fcc09[_0x0ce4('0x16')](_0x3f04f9)[_0x0ce4('0x25')](_0x2ff859);};}exports[_0x0ce4('0x26')]=function(_0x20cb6d,_0x3a1e30){var _0x3210bc={},_0x2de3aa={},_0x5567e8={'count':0x0,'rows':[]};var _0x106a38=_[_0x0ce4('0x27')](db[_0x0ce4('0x28')]['rawAttributes'],function(_0x2c31e0){return{'name':_0x2c31e0['fieldName'],'type':_0x2c31e0[_0x0ce4('0x29')][_0x0ce4('0x2a')]};});_0x2de3aa['model']=_[_0x0ce4('0x27')](_0x106a38,_0x0ce4('0x24'));_0x2de3aa[_0x0ce4('0x2b')]=_['keys'](_0x20cb6d['query']);_0x2de3aa[_0x0ce4('0x2c')]=_['intersection'](_0x2de3aa[_0x0ce4('0x2d')],_0x2de3aa['query']);_0x3210bc[_0x0ce4('0x2e')]=_[_0x0ce4('0x2f')](_0x2de3aa[_0x0ce4('0x2d')],qs['fields'](_0x20cb6d['query'][_0x0ce4('0x30')]));_0x3210bc[_0x0ce4('0x2e')]=_0x3210bc[_0x0ce4('0x2e')]['length']?_0x3210bc[_0x0ce4('0x2e')]:_0x2de3aa[_0x0ce4('0x2d')];if(!_0x20cb6d[_0x0ce4('0x2b')][_0x0ce4('0x31')](_0x0ce4('0x32'))){_0x3210bc[_0x0ce4('0x33')]=qs[_0x0ce4('0x33')](_0x20cb6d[_0x0ce4('0x2b')]['limit']);_0x3210bc['offset']=qs[_0x0ce4('0x18')](_0x20cb6d['query']['offset']);}_0x3210bc[_0x0ce4('0x34')]=qs[_0x0ce4('0x35')](_0x20cb6d[_0x0ce4('0x2b')]['sort']);_0x3210bc[_0x0ce4('0x36')]=qs[_0x0ce4('0x2c')](_[_0x0ce4('0x37')](_0x20cb6d[_0x0ce4('0x2b')],_0x2de3aa[_0x0ce4('0x2c')]),_0x106a38);if(_0x20cb6d[_0x0ce4('0x2b')][_0x0ce4('0x38')]){_0x3210bc[_0x0ce4('0x36')]=_['merge'](_0x3210bc[_0x0ce4('0x36')],{'$or':_[_0x0ce4('0x27')](_0x106a38,function(_0x2c35ac){if(_0x2c35ac[_0x0ce4('0x29')]!==_0x0ce4('0x39')){var _0x36a8f9={};_0x36a8f9[_0x2c35ac[_0x0ce4('0x24')]]={'$like':'%'+_0x20cb6d[_0x0ce4('0x2b')]['filter']+'%'};return _0x36a8f9;}})});}_0x3210bc=_['merge']({},_0x3210bc,_0x20cb6d[_0x0ce4('0x3a')]);var _0x4cdb87={'where':_0x3210bc[_0x0ce4('0x36')]};return db['ZohoConfiguration']['count'](_0x4cdb87)[_0x0ce4('0x1f')](function(_0x570e5e){_0x5567e8[_0x0ce4('0x1a')]=_0x570e5e;if(_0x20cb6d[_0x0ce4('0x2b')]['includeAll']){_0x3210bc['include']=[{'all':!![]}];}return db['ZohoConfiguration'][_0x0ce4('0x3b')](_0x3210bc);})[_0x0ce4('0x1f')](function(_0x28ced7){_0x5567e8[_0x0ce4('0x3c')]=_0x28ced7;return _0x5567e8;})['then'](respondWithFilteredResult(_0x3a1e30,_0x3210bc))[_0x0ce4('0x3d')](handleError(_0x3a1e30,null));};exports[_0x0ce4('0x3e')]=function(_0x2ad325,_0x34804c){var _0x5205ca={'raw':![],'where':{'id':_0x2ad325['params']['id']}},_0x4214c2={};_0x4214c2[_0x0ce4('0x2d')]=_[_0x0ce4('0x3f')](db[_0x0ce4('0x28')][_0x0ce4('0x40')]);_0x4214c2['query']=_[_0x0ce4('0x3f')](_0x2ad325['query']);_0x4214c2['filters']=_[_0x0ce4('0x2f')](_0x4214c2['model'],_0x4214c2[_0x0ce4('0x2b')]);_0x5205ca[_0x0ce4('0x2e')]=_[_0x0ce4('0x2f')](_0x4214c2[_0x0ce4('0x2d')],qs[_0x0ce4('0x30')](_0x2ad325[_0x0ce4('0x2b')]['fields']));_0x5205ca['attributes']=_0x5205ca[_0x0ce4('0x2e')]['length']?_0x5205ca['attributes']:_0x4214c2[_0x0ce4('0x2d')];if(_0x2ad325[_0x0ce4('0x2b')][_0x0ce4('0x41')]){_0x5205ca[_0x0ce4('0x42')]=[{'all':!![]}];}_0x5205ca=_[_0x0ce4('0x43')]({},_0x5205ca,_0x2ad325[_0x0ce4('0x3a')]);return db[_0x0ce4('0x28')][_0x0ce4('0x44')](_0x5205ca)[_0x0ce4('0x1f')](handleEntityNotFound(_0x34804c,null))[_0x0ce4('0x1f')](respondWithResult(_0x34804c,null))['catch'](handleError(_0x34804c,null));};exports[_0x0ce4('0x45')]=function(_0xf8ebb9,_0x3751ca){return db[_0x0ce4('0x28')]['create'](_0xf8ebb9['body'],{})[_0x0ce4('0x1f')](respondWithResult(_0x3751ca,0xc9))[_0x0ce4('0x3d')](handleError(_0x3751ca,null));};exports[_0x0ce4('0x46')]=function(_0x4b2935,_0xf605e1){if(_0x4b2935[_0x0ce4('0x47')]['id']){delete _0x4b2935[_0x0ce4('0x47')]['id'];}return db['ZohoConfiguration'][_0x0ce4('0x44')]({'where':{'id':_0x4b2935[_0x0ce4('0x48')]['id']}})[_0x0ce4('0x1f')](handleEntityNotFound(_0xf605e1,null))[_0x0ce4('0x1f')](saveUpdates(_0x4b2935[_0x0ce4('0x47')],null))[_0x0ce4('0x1f')](respondWithResult(_0xf605e1,null))[_0x0ce4('0x3d')](handleError(_0xf605e1,null));};exports['destroy']=function(_0x4fb691,_0x52c7ed){return db['ZohoConfiguration'][_0x0ce4('0x44')]({'where':{'id':_0x4fb691[_0x0ce4('0x48')]['id']}})[_0x0ce4('0x1f')](handleEntityNotFound(_0x52c7ed,null))[_0x0ce4('0x1f')](removeEntity(_0x52c7ed,null))[_0x0ce4('0x3d')](handleError(_0x52c7ed,null));};exports[_0x0ce4('0x49')]=function(_0x4526f9,_0x324fee,_0x344283){var _0x434121={};var _0x13886d={};var _0x2a0018;var _0x5a467f;return db[_0x0ce4('0x28')][_0x0ce4('0x4a')]({'where':{'id':_0x4526f9['params']['id']}})[_0x0ce4('0x1f')](handleEntityNotFound(_0x324fee,null))[_0x0ce4('0x1f')](function(_0x4d1448){if(_0x4d1448){_0x2a0018=_0x4d1448;_0x13886d['model']=_[_0x0ce4('0x3f')](db[_0x0ce4('0x4b')][_0x0ce4('0x40')]);_0x13886d[_0x0ce4('0x2b')]=_[_0x0ce4('0x3f')](_0x4526f9['query']);_0x13886d[_0x0ce4('0x2c')]=_[_0x0ce4('0x2f')](_0x13886d['model'],_0x13886d['query']);_0x434121['attributes']=_['intersection'](_0x13886d[_0x0ce4('0x2d')],qs[_0x0ce4('0x30')](_0x4526f9[_0x0ce4('0x2b')][_0x0ce4('0x30')]));_0x434121[_0x0ce4('0x2e')]=_0x434121['attributes']['length']?_0x434121[_0x0ce4('0x2e')]:_0x13886d['model'];_0x434121[_0x0ce4('0x34')]=qs[_0x0ce4('0x35')](_0x4526f9[_0x0ce4('0x2b')][_0x0ce4('0x35')]);_0x434121['where']=qs[_0x0ce4('0x2c')](_['pick'](_0x4526f9[_0x0ce4('0x2b')],_0x13886d[_0x0ce4('0x2c')]));if(_0x4526f9['query'][_0x0ce4('0x38')]){_0x434121[_0x0ce4('0x36')]=_[_0x0ce4('0x43')](_0x434121['where'],{'$or':_[_0x0ce4('0x27')](_0x434121[_0x0ce4('0x2e')],function(_0x249cd7){var _0x57db1a={};_0x57db1a[_0x249cd7]={'$like':'%'+_0x4526f9[_0x0ce4('0x2b')][_0x0ce4('0x38')]+'%'};return _0x57db1a;})});}_0x434121=_[_0x0ce4('0x43')]({},_0x434121,_0x4526f9['options']);return _0x2a0018[_0x0ce4('0x49')](_0x434121);}})[_0x0ce4('0x1f')](function(_0x48b77b){if(_0x48b77b){_0x5a467f=_0x48b77b[_0x0ce4('0x4c')];if(!_0x4526f9[_0x0ce4('0x2b')][_0x0ce4('0x31')](_0x0ce4('0x32'))){_0x434121[_0x0ce4('0x33')]=qs[_0x0ce4('0x33')](_0x4526f9['query'][_0x0ce4('0x33')]);_0x434121[_0x0ce4('0x18')]=qs[_0x0ce4('0x18')](_0x4526f9[_0x0ce4('0x2b')]['offset']);}return _0x2a0018[_0x0ce4('0x49')](_0x434121);}})[_0x0ce4('0x1f')](function(_0x1ec511){if(_0x1ec511){return _0x1ec511?{'count':_0x5a467f,'rows':_0x1ec511}:null;}})[_0x0ce4('0x1f')](respondWithResult(_0x324fee,null))[_0x0ce4('0x3d')](handleError(_0x324fee,null));};exports[_0x0ce4('0x4d')]=function(_0x8b095,_0x452d7f,_0x1b79b4){var _0x2af761={};var _0x125e37={};var _0x1aaad0;var _0xaeb3b5;return db[_0x0ce4('0x28')][_0x0ce4('0x4a')]({'where':{'id':_0x8b095[_0x0ce4('0x48')]['id']}})[_0x0ce4('0x1f')](handleEntityNotFound(_0x452d7f,null))[_0x0ce4('0x1f')](function(_0x5bcce5){if(_0x5bcce5){_0x1aaad0=_0x5bcce5;_0x125e37[_0x0ce4('0x2d')]=_['keys'](db[_0x0ce4('0x4b')]['rawAttributes']);_0x125e37['query']=_[_0x0ce4('0x3f')](_0x8b095[_0x0ce4('0x2b')]);_0x125e37[_0x0ce4('0x2c')]=_[_0x0ce4('0x2f')](_0x125e37[_0x0ce4('0x2d')],_0x125e37[_0x0ce4('0x2b')]);_0x2af761['attributes']=_[_0x0ce4('0x2f')](_0x125e37[_0x0ce4('0x2d')],qs[_0x0ce4('0x30')](_0x8b095[_0x0ce4('0x2b')]['fields']));_0x2af761['attributes']=_0x2af761[_0x0ce4('0x2e')][_0x0ce4('0x4c')]?_0x2af761[_0x0ce4('0x2e')]:_0x125e37['model'];_0x2af761[_0x0ce4('0x34')]=qs[_0x0ce4('0x35')](_0x8b095[_0x0ce4('0x2b')][_0x0ce4('0x35')]);_0x2af761['where']=qs[_0x0ce4('0x2c')](_['pick'](_0x8b095['query'],_0x125e37['filters']));if(_0x8b095['query'][_0x0ce4('0x38')]){_0x2af761[_0x0ce4('0x36')]=_['merge'](_0x2af761[_0x0ce4('0x36')],{'$or':_[_0x0ce4('0x27')](_0x2af761[_0x0ce4('0x2e')],function(_0x37353f){var _0x3dd90d={};_0x3dd90d[_0x37353f]={'$like':'%'+_0x8b095['query'][_0x0ce4('0x38')]+'%'};return _0x3dd90d;})});}_0x2af761=_[_0x0ce4('0x43')]({},_0x2af761,_0x8b095[_0x0ce4('0x3a')]);return _0x1aaad0['getSubjects'](_0x2af761);}})['then'](function(_0x5e0ab7){if(_0x5e0ab7){_0xaeb3b5=_0x5e0ab7[_0x0ce4('0x4c')];if(!_0x8b095['query'][_0x0ce4('0x31')](_0x0ce4('0x32'))){_0x2af761[_0x0ce4('0x33')]=qs[_0x0ce4('0x33')](_0x8b095[_0x0ce4('0x2b')][_0x0ce4('0x33')]);_0x2af761[_0x0ce4('0x18')]=qs[_0x0ce4('0x18')](_0x8b095[_0x0ce4('0x2b')][_0x0ce4('0x18')]);}return _0x1aaad0[_0x0ce4('0x4d')](_0x2af761);}})[_0x0ce4('0x1f')](function(_0x4a9383){if(_0x4a9383){return _0x4a9383?{'count':_0xaeb3b5,'rows':_0x4a9383}:null;}})[_0x0ce4('0x1f')](respondWithResult(_0x452d7f,null))[_0x0ce4('0x3d')](handleError(_0x452d7f,null));};exports['getDescriptions']=function(_0x49c8a9,_0x3ac90e,_0x396cab){var _0xab8cdb={};var _0x1fd15f={};var _0x58ed19;var _0x479a54;return db[_0x0ce4('0x28')]['findOne']({'where':{'id':_0x49c8a9['params']['id']}})['then'](handleEntityNotFound(_0x3ac90e,null))[_0x0ce4('0x1f')](function(_0x481283){if(_0x481283){_0x58ed19=_0x481283;_0x1fd15f[_0x0ce4('0x2d')]=_['keys'](db[_0x0ce4('0x4b')][_0x0ce4('0x40')]);_0x1fd15f[_0x0ce4('0x2b')]=_[_0x0ce4('0x3f')](_0x49c8a9[_0x0ce4('0x2b')]);_0x1fd15f[_0x0ce4('0x2c')]=_[_0x0ce4('0x2f')](_0x1fd15f[_0x0ce4('0x2d')],_0x1fd15f['query']);_0xab8cdb[_0x0ce4('0x2e')]=_[_0x0ce4('0x2f')](_0x1fd15f[_0x0ce4('0x2d')],qs[_0x0ce4('0x30')](_0x49c8a9['query'][_0x0ce4('0x30')]));_0xab8cdb['attributes']=_0xab8cdb[_0x0ce4('0x2e')][_0x0ce4('0x4c')]?_0xab8cdb[_0x0ce4('0x2e')]:_0x1fd15f['model'];_0xab8cdb['order']=qs[_0x0ce4('0x35')](_0x49c8a9['query']['sort']);_0xab8cdb['where']=qs[_0x0ce4('0x2c')](_[_0x0ce4('0x37')](_0x49c8a9[_0x0ce4('0x2b')],_0x1fd15f[_0x0ce4('0x2c')]));if(_0x49c8a9[_0x0ce4('0x2b')][_0x0ce4('0x38')]){_0xab8cdb[_0x0ce4('0x36')]=_[_0x0ce4('0x43')](_0xab8cdb[_0x0ce4('0x36')],{'$or':_[_0x0ce4('0x27')](_0xab8cdb[_0x0ce4('0x2e')],function(_0x45dff1){var _0x12ff47={};_0x12ff47[_0x45dff1]={'$like':'%'+_0x49c8a9[_0x0ce4('0x2b')][_0x0ce4('0x38')]+'%'};return _0x12ff47;})});}_0xab8cdb=_[_0x0ce4('0x43')]({},_0xab8cdb,_0x49c8a9[_0x0ce4('0x3a')]);return _0x58ed19[_0x0ce4('0x4e')](_0xab8cdb);}})['then'](function(_0x207fcc){if(_0x207fcc){_0x479a54=_0x207fcc[_0x0ce4('0x4c')];if(!_0x49c8a9[_0x0ce4('0x2b')][_0x0ce4('0x31')](_0x0ce4('0x32'))){_0xab8cdb[_0x0ce4('0x33')]=qs[_0x0ce4('0x33')](_0x49c8a9[_0x0ce4('0x2b')][_0x0ce4('0x33')]);_0xab8cdb['offset']=qs[_0x0ce4('0x18')](_0x49c8a9[_0x0ce4('0x2b')][_0x0ce4('0x18')]);}return _0x58ed19[_0x0ce4('0x4e')](_0xab8cdb);}})[_0x0ce4('0x1f')](function(_0x55a936){if(_0x55a936){return _0x55a936?{'count':_0x479a54,'rows':_0x55a936}:null;}})[_0x0ce4('0x1f')](respondWithResult(_0x3ac90e,null))[_0x0ce4('0x3d')](handleError(_0x3ac90e,null));}; \ No newline at end of file +var _0xe194=['rows','catch','show','length','find','create','body','params','getFields','findOne','ZohoField','hasOwnProperty','getSubjects','getDescriptions','rimraf','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','then','destroy','error','name','send','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x501186,_0x4bb701){var _0x2e22a4=function(_0x48e5ee){while(--_0x48e5ee){_0x501186['push'](_0x501186['shift']());}};_0x2e22a4(++_0x4bb701);}(_0xe194,0x1dc));var _0x4e19=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xe194[_0x334841];return _0x5beb4b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e19('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4e19('0x1'));var moment=require(_0x4e19('0x2'));var BPromise=require(_0x4e19('0x3'));var Mustache=require(_0x4e19('0x4'));var util=require('util');var path=require(_0x4e19('0x5'));var sox=require(_0x4e19('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4e19('0x7'));var _=require(_0x4e19('0x8'));var squel=require('squel');var crypto=require(_0x4e19('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x4e19('0xa'));var toCsv=require(_0x4e19('0xb'));var querystring=require(_0x4e19('0xc'));var Papa=require('papaparse');var Redis=require(_0x4e19('0xd'));var authService=require(_0x4e19('0xe'));var qs=require(_0x4e19('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e19('0x10'));var logger=require(_0x4e19('0x11'))(_0x4e19('0x12'));var utils=require(_0x4e19('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4e19('0x14'));var db=require(_0x4e19('0x15'))['db'];function respondWithStatusCode(_0x1028b4,_0x549583){_0x549583=_0x549583||0xcc;return function(_0x6c07b1){if(_0x6c07b1){return _0x1028b4[_0x4e19('0x16')](_0x549583);}return _0x1028b4[_0x4e19('0x17')](_0x549583)[_0x4e19('0x18')]();};}function respondWithResult(_0x477c62,_0x3fd5e7){_0x3fd5e7=_0x3fd5e7||0xc8;return function(_0x48fbf0){if(_0x48fbf0){return _0x477c62[_0x4e19('0x17')](_0x3fd5e7)[_0x4e19('0x19')](_0x48fbf0);}};}function respondWithFilteredResult(_0xbf4540,_0x2a48f2){return function(_0x47e875){if(_0x47e875){var _0x2fd5c9=typeof _0x2a48f2[_0x4e19('0x1a')]===_0x4e19('0x1b')&&typeof _0x2a48f2[_0x4e19('0x1c')]===_0x4e19('0x1b');var _0x3cd1c6=_0x47e875[_0x4e19('0x1d')];var _0x4ea1d1=_0x2fd5c9?0x0:_0x2a48f2['offset'];var _0x25794c=_0x2fd5c9?_0x47e875[_0x4e19('0x1d')]:_0x2a48f2[_0x4e19('0x1a')]+_0x2a48f2[_0x4e19('0x1c')];var _0x18f509;if(_0x25794c>=_0x3cd1c6){_0x25794c=_0x3cd1c6;_0x18f509=0xc8;}else{_0x18f509=0xce;}_0xbf4540[_0x4e19('0x17')](_0x18f509);return _0xbf4540['set']('Content-Range',_0x4ea1d1+'-'+_0x25794c+'/'+_0x3cd1c6)[_0x4e19('0x19')](_0x47e875);}return null;};}function patchUpdates(_0x3109b9){return function(_0x31abfb){try{jsonpatch['apply'](_0x31abfb,_0x3109b9,!![]);}catch(_0x1ba5f9){return BPromise[_0x4e19('0x1e')](_0x1ba5f9);}return _0x31abfb[_0x4e19('0x1f')]();};}function saveUpdates(_0x457d34,_0x4d9df7){return function(_0x37ad8e){if(_0x37ad8e){return _0x37ad8e[_0x4e19('0x20')](_0x457d34)[_0x4e19('0x21')](function(_0x27b6b9){return _0x27b6b9;});}return null;};}function removeEntity(_0x4f87a9,_0x690ba9){return function(_0x1571c8){if(_0x1571c8){return _0x1571c8[_0x4e19('0x22')]()[_0x4e19('0x21')](function(){_0x4f87a9['status'](0xcc)[_0x4e19('0x18')]();});}};}function handleEntityNotFound(_0x512be5,_0x374981){return function(_0x174bf2){if(!_0x174bf2){_0x512be5[_0x4e19('0x16')](0x194);}return _0x174bf2;};}function handleError(_0x41cf0e,_0x1db626){_0x1db626=_0x1db626||0x1f4;return function(_0x4d4e52){logger[_0x4e19('0x23')](_0x4d4e52['stack']);if(_0x4d4e52['name']){delete _0x4d4e52[_0x4e19('0x24')];}_0x41cf0e['status'](_0x1db626)[_0x4e19('0x25')](_0x4d4e52);};}exports['index']=function(_0x46cfeb,_0x4aa114){var _0x2ba333={},_0x5f2292={},_0x2fd584={'count':0x0,'rows':[]};var _0x51181d=_[_0x4e19('0x26')](db[_0x4e19('0x27')][_0x4e19('0x28')],function(_0x24dc65){return{'name':_0x24dc65[_0x4e19('0x29')],'type':_0x24dc65[_0x4e19('0x2a')][_0x4e19('0x2b')]};});_0x5f2292[_0x4e19('0x2c')]=_[_0x4e19('0x26')](_0x51181d,'name');_0x5f2292['query']=_[_0x4e19('0x2d')](_0x46cfeb[_0x4e19('0x2e')]);_0x5f2292[_0x4e19('0x2f')]=_[_0x4e19('0x30')](_0x5f2292[_0x4e19('0x2c')],_0x5f2292['query']);_0x2ba333['attributes']=_['intersection'](_0x5f2292[_0x4e19('0x2c')],qs[_0x4e19('0x31')](_0x46cfeb[_0x4e19('0x2e')]['fields']));_0x2ba333[_0x4e19('0x32')]=_0x2ba333[_0x4e19('0x32')]['length']?_0x2ba333[_0x4e19('0x32')]:_0x5f2292[_0x4e19('0x2c')];if(!_0x46cfeb[_0x4e19('0x2e')]['hasOwnProperty'](_0x4e19('0x33'))){_0x2ba333[_0x4e19('0x1c')]=qs['limit'](_0x46cfeb[_0x4e19('0x2e')][_0x4e19('0x1c')]);_0x2ba333[_0x4e19('0x1a')]=qs[_0x4e19('0x1a')](_0x46cfeb['query'][_0x4e19('0x1a')]);}_0x2ba333[_0x4e19('0x34')]=qs['sort'](_0x46cfeb[_0x4e19('0x2e')][_0x4e19('0x35')]);_0x2ba333[_0x4e19('0x36')]=qs[_0x4e19('0x2f')](_[_0x4e19('0x37')](_0x46cfeb[_0x4e19('0x2e')],_0x5f2292['filters']),_0x51181d);if(_0x46cfeb[_0x4e19('0x2e')][_0x4e19('0x38')]){_0x2ba333[_0x4e19('0x36')]=_[_0x4e19('0x39')](_0x2ba333[_0x4e19('0x36')],{'$or':_['map'](_0x51181d,function(_0x21572b){if(_0x21572b['type']!==_0x4e19('0x3a')){var _0x34667a={};_0x34667a[_0x21572b[_0x4e19('0x24')]]={'$like':'%'+_0x46cfeb[_0x4e19('0x2e')]['filter']+'%'};return _0x34667a;}})});}_0x2ba333=_[_0x4e19('0x39')]({},_0x2ba333,_0x46cfeb[_0x4e19('0x3b')]);var _0x378bb9={'where':_0x2ba333['where']};return db[_0x4e19('0x27')][_0x4e19('0x1d')](_0x378bb9)[_0x4e19('0x21')](function(_0x117431){_0x2fd584[_0x4e19('0x1d')]=_0x117431;if(_0x46cfeb[_0x4e19('0x2e')][_0x4e19('0x3c')]){_0x2ba333[_0x4e19('0x3d')]=[{'all':!![]}];}return db[_0x4e19('0x27')][_0x4e19('0x3e')](_0x2ba333);})[_0x4e19('0x21')](function(_0x2a8252){_0x2fd584[_0x4e19('0x3f')]=_0x2a8252;return _0x2fd584;})[_0x4e19('0x21')](respondWithFilteredResult(_0x4aa114,_0x2ba333))[_0x4e19('0x40')](handleError(_0x4aa114,null));};exports[_0x4e19('0x41')]=function(_0xfc4e91,_0x35235b){var _0x5b9735={'raw':![],'where':{'id':_0xfc4e91['params']['id']}},_0x36903f={};_0x36903f[_0x4e19('0x2c')]=_[_0x4e19('0x2d')](db[_0x4e19('0x27')][_0x4e19('0x28')]);_0x36903f[_0x4e19('0x2e')]=_[_0x4e19('0x2d')](_0xfc4e91[_0x4e19('0x2e')]);_0x36903f[_0x4e19('0x2f')]=_[_0x4e19('0x30')](_0x36903f[_0x4e19('0x2c')],_0x36903f['query']);_0x5b9735['attributes']=_[_0x4e19('0x30')](_0x36903f[_0x4e19('0x2c')],qs[_0x4e19('0x31')](_0xfc4e91[_0x4e19('0x2e')]['fields']));_0x5b9735[_0x4e19('0x32')]=_0x5b9735[_0x4e19('0x32')][_0x4e19('0x42')]?_0x5b9735[_0x4e19('0x32')]:_0x36903f['model'];if(_0xfc4e91['query'][_0x4e19('0x3c')]){_0x5b9735['include']=[{'all':!![]}];}_0x5b9735=_['merge']({},_0x5b9735,_0xfc4e91[_0x4e19('0x3b')]);return db[_0x4e19('0x27')][_0x4e19('0x43')](_0x5b9735)[_0x4e19('0x21')](handleEntityNotFound(_0x35235b,null))['then'](respondWithResult(_0x35235b,null))['catch'](handleError(_0x35235b,null));};exports['create']=function(_0x2df8c0,_0x46ee64){return db[_0x4e19('0x27')][_0x4e19('0x44')](_0x2df8c0[_0x4e19('0x45')],{})['then'](respondWithResult(_0x46ee64,0xc9))['catch'](handleError(_0x46ee64,null));};exports[_0x4e19('0x20')]=function(_0x2b9dcd,_0x4bd8be){if(_0x2b9dcd[_0x4e19('0x45')]['id']){delete _0x2b9dcd[_0x4e19('0x45')]['id'];}return db[_0x4e19('0x27')][_0x4e19('0x43')]({'where':{'id':_0x2b9dcd[_0x4e19('0x46')]['id']}})[_0x4e19('0x21')](handleEntityNotFound(_0x4bd8be,null))['then'](saveUpdates(_0x2b9dcd[_0x4e19('0x45')],null))[_0x4e19('0x21')](respondWithResult(_0x4bd8be,null))['catch'](handleError(_0x4bd8be,null));};exports[_0x4e19('0x22')]=function(_0x1be65f,_0x10bf57){return db[_0x4e19('0x27')]['find']({'where':{'id':_0x1be65f[_0x4e19('0x46')]['id']}})[_0x4e19('0x21')](handleEntityNotFound(_0x10bf57,null))[_0x4e19('0x21')](removeEntity(_0x10bf57,null))['catch'](handleError(_0x10bf57,null));};exports[_0x4e19('0x47')]=function(_0x48b8f2,_0x11e8a1,_0x393cf8){var _0xecdbf5={};var _0xd89a83={};var _0x22d64d;var _0x4aae0e;return db[_0x4e19('0x27')][_0x4e19('0x48')]({'where':{'id':_0x48b8f2['params']['id']}})[_0x4e19('0x21')](handleEntityNotFound(_0x11e8a1,null))[_0x4e19('0x21')](function(_0x57462e){if(_0x57462e){_0x22d64d=_0x57462e;_0xd89a83['model']=_[_0x4e19('0x2d')](db[_0x4e19('0x49')][_0x4e19('0x28')]);_0xd89a83['query']=_['keys'](_0x48b8f2[_0x4e19('0x2e')]);_0xd89a83[_0x4e19('0x2f')]=_[_0x4e19('0x30')](_0xd89a83[_0x4e19('0x2c')],_0xd89a83[_0x4e19('0x2e')]);_0xecdbf5[_0x4e19('0x32')]=_['intersection'](_0xd89a83[_0x4e19('0x2c')],qs[_0x4e19('0x31')](_0x48b8f2['query'][_0x4e19('0x31')]));_0xecdbf5[_0x4e19('0x32')]=_0xecdbf5['attributes']['length']?_0xecdbf5[_0x4e19('0x32')]:_0xd89a83[_0x4e19('0x2c')];_0xecdbf5[_0x4e19('0x34')]=qs['sort'](_0x48b8f2['query'][_0x4e19('0x35')]);_0xecdbf5['where']=qs[_0x4e19('0x2f')](_[_0x4e19('0x37')](_0x48b8f2[_0x4e19('0x2e')],_0xd89a83[_0x4e19('0x2f')]));if(_0x48b8f2[_0x4e19('0x2e')]['filter']){_0xecdbf5[_0x4e19('0x36')]=_[_0x4e19('0x39')](_0xecdbf5[_0x4e19('0x36')],{'$or':_[_0x4e19('0x26')](_0xecdbf5[_0x4e19('0x32')],function(_0x4cb158){var _0x6c0c9c={};_0x6c0c9c[_0x4cb158]={'$like':'%'+_0x48b8f2[_0x4e19('0x2e')][_0x4e19('0x38')]+'%'};return _0x6c0c9c;})});}_0xecdbf5=_['merge']({},_0xecdbf5,_0x48b8f2[_0x4e19('0x3b')]);return _0x22d64d[_0x4e19('0x47')](_0xecdbf5);}})[_0x4e19('0x21')](function(_0x244719){if(_0x244719){_0x4aae0e=_0x244719['length'];if(!_0x48b8f2[_0x4e19('0x2e')][_0x4e19('0x4a')]('nolimit')){_0xecdbf5['limit']=qs[_0x4e19('0x1c')](_0x48b8f2[_0x4e19('0x2e')][_0x4e19('0x1c')]);_0xecdbf5['offset']=qs['offset'](_0x48b8f2[_0x4e19('0x2e')][_0x4e19('0x1a')]);}return _0x22d64d[_0x4e19('0x47')](_0xecdbf5);}})[_0x4e19('0x21')](function(_0x132375){if(_0x132375){return _0x132375?{'count':_0x4aae0e,'rows':_0x132375}:null;}})[_0x4e19('0x21')](respondWithResult(_0x11e8a1,null))['catch'](handleError(_0x11e8a1,null));};exports['getSubjects']=function(_0xe9e832,_0x44fe0e,_0x3139b9){var _0x5c06a2={};var _0x4ee63f={};var _0x52be7b;var _0xefc68e;return db[_0x4e19('0x27')][_0x4e19('0x48')]({'where':{'id':_0xe9e832[_0x4e19('0x46')]['id']}})['then'](handleEntityNotFound(_0x44fe0e,null))['then'](function(_0x91337a){if(_0x91337a){_0x52be7b=_0x91337a;_0x4ee63f[_0x4e19('0x2c')]=_[_0x4e19('0x2d')](db[_0x4e19('0x49')][_0x4e19('0x28')]);_0x4ee63f[_0x4e19('0x2e')]=_['keys'](_0xe9e832['query']);_0x4ee63f[_0x4e19('0x2f')]=_[_0x4e19('0x30')](_0x4ee63f[_0x4e19('0x2c')],_0x4ee63f[_0x4e19('0x2e')]);_0x5c06a2[_0x4e19('0x32')]=_[_0x4e19('0x30')](_0x4ee63f[_0x4e19('0x2c')],qs['fields'](_0xe9e832[_0x4e19('0x2e')][_0x4e19('0x31')]));_0x5c06a2[_0x4e19('0x32')]=_0x5c06a2[_0x4e19('0x32')]['length']?_0x5c06a2[_0x4e19('0x32')]:_0x4ee63f[_0x4e19('0x2c')];_0x5c06a2[_0x4e19('0x34')]=qs[_0x4e19('0x35')](_0xe9e832[_0x4e19('0x2e')][_0x4e19('0x35')]);_0x5c06a2['where']=qs[_0x4e19('0x2f')](_[_0x4e19('0x37')](_0xe9e832[_0x4e19('0x2e')],_0x4ee63f['filters']));if(_0xe9e832['query'][_0x4e19('0x38')]){_0x5c06a2['where']=_[_0x4e19('0x39')](_0x5c06a2[_0x4e19('0x36')],{'$or':_[_0x4e19('0x26')](_0x5c06a2[_0x4e19('0x32')],function(_0x3b7811){var _0x404aaf={};_0x404aaf[_0x3b7811]={'$like':'%'+_0xe9e832[_0x4e19('0x2e')][_0x4e19('0x38')]+'%'};return _0x404aaf;})});}_0x5c06a2=_[_0x4e19('0x39')]({},_0x5c06a2,_0xe9e832['options']);return _0x52be7b[_0x4e19('0x4b')](_0x5c06a2);}})['then'](function(_0x1e1dd4){if(_0x1e1dd4){_0xefc68e=_0x1e1dd4['length'];if(!_0xe9e832[_0x4e19('0x2e')]['hasOwnProperty'](_0x4e19('0x33'))){_0x5c06a2[_0x4e19('0x1c')]=qs[_0x4e19('0x1c')](_0xe9e832[_0x4e19('0x2e')]['limit']);_0x5c06a2[_0x4e19('0x1a')]=qs['offset'](_0xe9e832[_0x4e19('0x2e')]['offset']);}return _0x52be7b['getSubjects'](_0x5c06a2);}})['then'](function(_0x3ea221){if(_0x3ea221){return _0x3ea221?{'count':_0xefc68e,'rows':_0x3ea221}:null;}})['then'](respondWithResult(_0x44fe0e,null))[_0x4e19('0x40')](handleError(_0x44fe0e,null));};exports[_0x4e19('0x4c')]=function(_0x5039dd,_0x230f5a,_0x57be19){var _0x47f467={};var _0x3ea73c={};var _0x1b6801;var _0x441976;return db['ZohoConfiguration'][_0x4e19('0x48')]({'where':{'id':_0x5039dd['params']['id']}})['then'](handleEntityNotFound(_0x230f5a,null))[_0x4e19('0x21')](function(_0x4a10be){if(_0x4a10be){_0x1b6801=_0x4a10be;_0x3ea73c[_0x4e19('0x2c')]=_[_0x4e19('0x2d')](db[_0x4e19('0x49')][_0x4e19('0x28')]);_0x3ea73c[_0x4e19('0x2e')]=_[_0x4e19('0x2d')](_0x5039dd[_0x4e19('0x2e')]);_0x3ea73c[_0x4e19('0x2f')]=_[_0x4e19('0x30')](_0x3ea73c['model'],_0x3ea73c['query']);_0x47f467[_0x4e19('0x32')]=_[_0x4e19('0x30')](_0x3ea73c['model'],qs['fields'](_0x5039dd[_0x4e19('0x2e')][_0x4e19('0x31')]));_0x47f467['attributes']=_0x47f467[_0x4e19('0x32')][_0x4e19('0x42')]?_0x47f467[_0x4e19('0x32')]:_0x3ea73c[_0x4e19('0x2c')];_0x47f467[_0x4e19('0x34')]=qs[_0x4e19('0x35')](_0x5039dd[_0x4e19('0x2e')][_0x4e19('0x35')]);_0x47f467['where']=qs[_0x4e19('0x2f')](_[_0x4e19('0x37')](_0x5039dd[_0x4e19('0x2e')],_0x3ea73c[_0x4e19('0x2f')]));if(_0x5039dd[_0x4e19('0x2e')]['filter']){_0x47f467[_0x4e19('0x36')]=_[_0x4e19('0x39')](_0x47f467[_0x4e19('0x36')],{'$or':_[_0x4e19('0x26')](_0x47f467[_0x4e19('0x32')],function(_0x205872){var _0x8267df={};_0x8267df[_0x205872]={'$like':'%'+_0x5039dd[_0x4e19('0x2e')][_0x4e19('0x38')]+'%'};return _0x8267df;})});}_0x47f467=_[_0x4e19('0x39')]({},_0x47f467,_0x5039dd['options']);return _0x1b6801[_0x4e19('0x4c')](_0x47f467);}})[_0x4e19('0x21')](function(_0x2fea9c){if(_0x2fea9c){_0x441976=_0x2fea9c[_0x4e19('0x42')];if(!_0x5039dd[_0x4e19('0x2e')][_0x4e19('0x4a')]('nolimit')){_0x47f467['limit']=qs['limit'](_0x5039dd[_0x4e19('0x2e')]['limit']);_0x47f467[_0x4e19('0x1a')]=qs[_0x4e19('0x1a')](_0x5039dd['query']['offset']);}return _0x1b6801[_0x4e19('0x4c')](_0x47f467);}})[_0x4e19('0x21')](function(_0x3d3825){if(_0x3d3825){return _0x3d3825?{'count':_0x441976,'rows':_0x3d3825}:null;}})[_0x4e19('0x21')](respondWithResult(_0x230f5a,null))['catch'](handleError(_0x230f5a,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index c89dbbe..c139745 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 _0x948b=['./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','lodash','util','api','bluebird','request-promise','rimraf'];(function(_0x2af235,_0x45f664){var _0x593c0e=function(_0x1b12d4){while(--_0x1b12d4){_0x2af235['push'](_0x2af235['shift']());}};_0x593c0e(++_0x45f664);}(_0x948b,0x176));var _0xb948=function(_0x8dc04d,_0xaa7559){_0x8dc04d=_0x8dc04d-0x0;var _0x2f5f28=_0x948b[_0x8dc04d];return _0x2f5f28;};'use strict';var _=require(_0xb948('0x0'));var util=require(_0xb948('0x1'));var logger=require('../../config/logger')(_0xb948('0x2'));var moment=require('moment');var BPromise=require(_0xb948('0x3'));var rp=require(_0xb948('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb948('0x5'));var config=require('../../config/environment');var attributes=require(_0xb948('0x6'));module[_0xb948('0x7')]=function(_0x57f51f,_0x2e502b){return _0x57f51f[_0xb948('0x8')]('ZohoConfiguration',attributes,{'tableName':_0xb948('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x862c=['ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x4c0d2f,_0x2ede30){var _0x5376e2=function(_0x287556){while(--_0x287556){_0x4c0d2f['push'](_0x4c0d2f['shift']());}};_0x5376e2(++_0x2ede30);}(_0x862c,0x91));var _0xc862=function(_0x112d5b,_0x7d1151){_0x112d5b=_0x112d5b-0x0;var _0x5c58a6=_0x862c[_0x112d5b];return _0x5c58a6;};'use strict';var _=require(_0xc862('0x0'));var util=require(_0xc862('0x1'));var logger=require(_0xc862('0x2'))(_0xc862('0x3'));var moment=require(_0xc862('0x4'));var BPromise=require(_0xc862('0x5'));var rp=require(_0xc862('0x6'));var fs=require('fs');var path=require(_0xc862('0x7'));var rimraf=require('rimraf');var config=require(_0xc862('0x8'));var attributes=require('./intZohoConfiguration.attributes');module[_0xc862('0x9')]=function(_0x4e086c,_0x31e835){return _0x4e086c[_0xc862('0xa')](_0xc862('0xb'),attributes,{'tableName':_0xc862('0xc'),'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 f741532..190324e 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 _0x49a8=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x4a82ac,_0x1fb931){var _0x58ee97=function(_0xc7050a){while(--_0xc7050a){_0x4a82ac['push'](_0x4a82ac['shift']());}};_0x58ee97(++_0x1fb931);}(_0x49a8,0x12b));var _0x849a=function(_0x514f28,_0xe771bb){_0x514f28=_0x514f28-0x0;var _0x4d3d61=_0x49a8[_0x514f28];return _0x4d3d61;};'use strict';var _=require(_0x849a('0x0'));var util=require('util');var moment=require(_0x849a('0x1'));var BPromise=require(_0x849a('0x2'));var rs=require(_0x849a('0x3'));var fs=require('fs');var Redis=require(_0x849a('0x4'));var db=require(_0x849a('0x5'))['db'];var utils=require(_0x849a('0x6'));var logger=require('../../config/logger')(_0x849a('0x7'));var config=require(_0x849a('0x8'));var jayson=require(_0x849a('0x9'));var client=jayson[_0x849a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d71fa,_0x1a1657,_0x279475){return new BPromise(function(_0x3fa438,_0x302aab){return client[_0x849a('0xb')](_0x4d71fa,_0x279475)[_0x849a('0xc')](function(_0x699f03){logger[_0x849a('0xd')](_0x849a('0xe'),_0x1a1657,_0x849a('0xf'));logger[_0x849a('0x10')](_0x849a('0x11'),_0x1a1657,_0x849a('0xf'),JSON[_0x849a('0x12')](_0x699f03));if(_0x699f03[_0x849a('0x13')]){if(_0x699f03[_0x849a('0x13')]['code']===0x1f4){logger[_0x849a('0x13')](_0x849a('0xe'),_0x1a1657,_0x699f03[_0x849a('0x13')][_0x849a('0x14')]);return _0x302aab(_0x699f03[_0x849a('0x13')][_0x849a('0x14')]);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x1a1657,_0x699f03[_0x849a('0x13')][_0x849a('0x14')]);return _0x3fa438(_0x699f03['error']['message']);}else{logger['info'](_0x849a('0xe'),_0x1a1657,_0x849a('0xf'));_0x3fa438(_0x699f03[_0x849a('0x15')][_0x849a('0x14')]);}})[_0x849a('0x16')](function(_0x24f14e){logger[_0x849a('0x13')](_0x849a('0xe'),_0x1a1657,_0x24f14e);_0x302aab(_0x24f14e);});});} \ No newline at end of file +var _0xe0ea=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','moment','randomstring','../../mysqldb'];(function(_0x389504,_0x281797){var _0x439ccb=function(_0x547b9e){while(--_0x547b9e){_0x389504['push'](_0x389504['shift']());}};_0x439ccb(++_0x281797);}(_0xe0ea,0x18c));var _0xae0e=function(_0xb4aea,_0x513abc){_0xb4aea=_0xb4aea-0x0;var _0x5a1829=_0xe0ea[_0xb4aea];return _0x5a1829;};'use strict';var _=require(_0xae0e('0x0'));var util=require('util');var moment=require(_0xae0e('0x1'));var BPromise=require('bluebird');var rs=require(_0xae0e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae0e('0x3'))['db'];var utils=require(_0xae0e('0x4'));var logger=require('../../config/logger')(_0xae0e('0x5'));var config=require(_0xae0e('0x6'));var jayson=require(_0xae0e('0x7'));var client=jayson[_0xae0e('0x8')][_0xae0e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xeadba4,_0x5cae93,_0x4c7c3b){return new BPromise(function(_0x1ac07f,_0x3e5407){return client[_0xae0e('0xa')](_0xeadba4,_0x4c7c3b)[_0xae0e('0xb')](function(_0x36278f){logger['info'](_0xae0e('0xc'),_0x5cae93,_0xae0e('0xd'));logger['debug'](_0xae0e('0xe'),_0x5cae93,_0xae0e('0xd'),JSON[_0xae0e('0xf')](_0x36278f));if(_0x36278f['error']){if(_0x36278f['error'][_0xae0e('0x10')]===0x1f4){logger[_0xae0e('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x5cae93,_0x36278f[_0xae0e('0x11')][_0xae0e('0x12')]);return _0x3e5407(_0x36278f[_0xae0e('0x11')][_0xae0e('0x12')]);}logger[_0xae0e('0x11')](_0xae0e('0xc'),_0x5cae93,_0x36278f[_0xae0e('0x11')][_0xae0e('0x12')]);return _0x1ac07f(_0x36278f[_0xae0e('0x11')][_0xae0e('0x12')]);}else{logger['info'](_0xae0e('0xc'),_0x5cae93,_0xae0e('0xd'));_0x1ac07f(_0x36278f['result'][_0xae0e('0x12')]);}})[_0xae0e('0x13')](function(_0x4ee132){logger[_0xae0e('0x11')](_0xae0e('0xc'),_0x5cae93,_0x4ee132);_0x3e5407(_0x4ee132);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 2d0535b..317378f 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 _0xa9ed=['../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3fdd94,_0x1ae697){var _0x2efcf1=function(_0x485a41){while(--_0x485a41){_0x3fdd94['push'](_0x3fdd94['shift']());}};_0x2efcf1(++_0x1ae697);}(_0xa9ed,0x187));var _0xda9e=function(_0x57a50d,_0x2871f8){_0x57a50d=_0x57a50d-0x0;var _0x1b25b3=_0xa9ed[_0x57a50d];return _0x1b25b3;};'use strict';var multer=require(_0xda9e('0x0'));var util=require(_0xda9e('0x1'));var path=require(_0xda9e('0x2'));var timeout=require(_0xda9e('0x3'));var express=require(_0xda9e('0x4'));var router=express['Router']();var fs_extra=require(_0xda9e('0x5'));var auth=require(_0xda9e('0x6'));var interaction=require(_0xda9e('0x7'));var config=require(_0xda9e('0x8'));var controller=require(_0xda9e('0x9'));router[_0xda9e('0xa')]('/',auth[_0xda9e('0xb')](),controller[_0xda9e('0xc')]);router[_0xda9e('0xa')](_0xda9e('0xd'),auth[_0xda9e('0xb')](),controller[_0xda9e('0xe')]);router['post']('/',auth[_0xda9e('0xb')](),controller[_0xda9e('0xf')]);router[_0xda9e('0x10')](_0xda9e('0xd'),auth[_0xda9e('0xb')](),controller[_0xda9e('0x11')]);router[_0xda9e('0x12')]('/:id',auth[_0xda9e('0xb')](),controller[_0xda9e('0x13')]);module[_0xda9e('0x14')]=router; \ No newline at end of file +var _0x3c7c=['show','create','put','/:id','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./intZohoField.controller','isAuthenticated','index','get'];(function(_0x1bedce,_0x4f0124){var _0x4db91f=function(_0x371d3a){while(--_0x371d3a){_0x1bedce['push'](_0x1bedce['shift']());}};_0x4db91f(++_0x4f0124);}(_0x3c7c,0x122));var _0xc3c7=function(_0x265b8a,_0x1c5f49){_0x265b8a=_0x265b8a-0x0;var _0x204a98=_0x3c7c[_0x265b8a];return _0x204a98;};'use strict';var multer=require(_0xc3c7('0x0'));var util=require(_0xc3c7('0x1'));var path=require(_0xc3c7('0x2'));var timeout=require(_0xc3c7('0x3'));var express=require(_0xc3c7('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc3c7('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc3c7('0x6'));router['get']('/',auth[_0xc3c7('0x7')](),controller[_0xc3c7('0x8')]);router[_0xc3c7('0x9')]('/:id',auth[_0xc3c7('0x7')](),controller[_0xc3c7('0xa')]);router['post']('/',auth[_0xc3c7('0x7')](),controller[_0xc3c7('0xb')]);router[_0xc3c7('0xc')](_0xc3c7('0xd'),auth[_0xc3c7('0x7')](),controller['update']);router['delete'](_0xc3c7('0xd'),auth[_0xc3c7('0x7')](),controller['destroy']);module[_0xc3c7('0xe')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 3641f67..257e57c 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 _0x6b6a=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x3ebccf,_0x1f7fe7){var _0xdaf025=function(_0x14f91b){while(--_0x14f91b){_0x3ebccf['push'](_0x3ebccf['shift']());}};_0xdaf025(++_0x1f7fe7);}(_0x6b6a,0x1a1));var _0xa6b6=function(_0x54516e,_0x5df54c){_0x54516e=_0x54516e-0x0;var _0x4d1e6f=_0x6b6a[_0x54516e];return _0x4d1e6f;};'use strict';var Sequelize=require(_0xa6b6('0x0'));module[_0xa6b6('0x1')]={'type':{'type':Sequelize[_0xa6b6('0x2')](_0xa6b6('0x3'),_0xa6b6('0x4'),_0xa6b6('0x5'),_0xa6b6('0x6'),_0xa6b6('0x7')),'defaultValue':_0xa6b6('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa6b6('0x8')]},'keyType':{'type':Sequelize[_0xa6b6('0x2')](_0xa6b6('0x3'),_0xa6b6('0x4'),_0xa6b6('0x5'))},'keyContent':{'type':Sequelize[_0xa6b6('0x8')]},'idField':{'type':Sequelize[_0xa6b6('0x8')]},'nameField':{'type':Sequelize[_0xa6b6('0x8')]},'customField':{'type':Sequelize[_0xa6b6('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa6b6('0x8')]}}; \ No newline at end of file +var _0x1780=['ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x550d9e,_0x19f5a9){var _0x4cacbf=function(_0x33be7e){while(--_0x33be7e){_0x550d9e['push'](_0x550d9e['shift']());}};_0x4cacbf(++_0x19f5a9);}(_0x1780,0x18f));var _0x0178=function(_0x234c67,_0x29f790){_0x234c67=_0x234c67-0x0;var _0x3637d9=_0x1780[_0x234c67];return _0x3637d9;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x0178('0x0')](_0x0178('0x1'),_0x0178('0x2'),_0x0178('0x3'),_0x0178('0x4'),_0x0178('0x5')),'defaultValue':_0x0178('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0178('0x0')](_0x0178('0x1'),_0x0178('0x2'),_0x0178('0x3'))},'keyContent':{'type':Sequelize[_0x0178('0x6')]},'idField':{'type':Sequelize[_0x0178('0x6')]},'nameField':{'type':Sequelize[_0x0178('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0178('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 362aaac..d5398c8 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 _0xaff6=['error','stack','name','index','ZohoField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy'];(function(_0x3e4341,_0x2db8d7){var _0x380469=function(_0x2f5874){while(--_0x2f5874){_0x3e4341['push'](_0x3e4341['shift']());}};_0x380469(++_0x2db8d7);}(_0xaff6,0xef));var _0x6aff=function(_0x56f9f8,_0x28498e){_0x56f9f8=_0x56f9f8-0x0;var _0x9728f3=_0xaff6[_0x56f9f8];return _0x9728f3;};'use strict';var emlformat=require(_0x6aff('0x0'));var rimraf=require(_0x6aff('0x1'));var zipdir=require(_0x6aff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6aff('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6aff('0x4'));var util=require(_0x6aff('0x5'));var path=require(_0x6aff('0x6'));var sox=require(_0x6aff('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6aff('0x8'));var _=require(_0x6aff('0x9'));var squel=require('squel');var crypto=require(_0x6aff('0xa'));var jsforce=require(_0x6aff('0xb'));var deskjs=require(_0x6aff('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6aff('0xd'));var Papa=require(_0x6aff('0xe'));var Redis=require('ioredis');var authService=require(_0x6aff('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6aff('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6aff('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6aff('0x12'))['db'];function respondWithStatusCode(_0x4e21bb,_0x38fdc7){_0x38fdc7=_0x38fdc7||0xcc;return function(_0x492baa){if(_0x492baa){return _0x4e21bb['sendStatus'](_0x38fdc7);}return _0x4e21bb[_0x6aff('0x13')](_0x38fdc7)[_0x6aff('0x14')]();};}function respondWithResult(_0x21a5f7,_0x1a6d83){_0x1a6d83=_0x1a6d83||0xc8;return function(_0x242c7a){if(_0x242c7a){return _0x21a5f7[_0x6aff('0x13')](_0x1a6d83)[_0x6aff('0x15')](_0x242c7a);}};}function respondWithFilteredResult(_0x5360f4,_0x2d2d3d){return function(_0xbd499d){if(_0xbd499d){var _0x5b35d9=typeof _0x2d2d3d[_0x6aff('0x16')]===_0x6aff('0x17')&&typeof _0x2d2d3d[_0x6aff('0x18')]===_0x6aff('0x17');var _0x2992aa=_0xbd499d[_0x6aff('0x19')];var _0x2799e5=_0x5b35d9?0x0:_0x2d2d3d['offset'];var _0x469ca7=_0x5b35d9?_0xbd499d[_0x6aff('0x19')]:_0x2d2d3d[_0x6aff('0x16')]+_0x2d2d3d['limit'];var _0x9bc33d;if(_0x469ca7>=_0x2992aa){_0x469ca7=_0x2992aa;_0x9bc33d=0xc8;}else{_0x9bc33d=0xce;}_0x5360f4[_0x6aff('0x13')](_0x9bc33d);return _0x5360f4[_0x6aff('0x1a')](_0x6aff('0x1b'),_0x2799e5+'-'+_0x469ca7+'/'+_0x2992aa)[_0x6aff('0x15')](_0xbd499d);}return null;};}function patchUpdates(_0x579046){return function(_0x3b0c49){try{jsonpatch['apply'](_0x3b0c49,_0x579046,!![]);}catch(_0x1c5aac){return BPromise[_0x6aff('0x1c')](_0x1c5aac);}return _0x3b0c49[_0x6aff('0x1d')]();};}function saveUpdates(_0x115e43,_0x1c6535){return function(_0x40fc8a){if(_0x40fc8a){return _0x40fc8a[_0x6aff('0x1e')](_0x115e43)[_0x6aff('0x1f')](function(_0x2ff073){return _0x2ff073;});}return null;};}function removeEntity(_0x1df0fd,_0x50c51b){return function(_0xd7b886){if(_0xd7b886){return _0xd7b886[_0x6aff('0x20')]()[_0x6aff('0x1f')](function(){_0x1df0fd[_0x6aff('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a9078,_0x6037b9){return function(_0x1e8d25){if(!_0x1e8d25){_0x5a9078['sendStatus'](0x194);}return _0x1e8d25;};}function handleError(_0x29c987,_0x41c791){_0x41c791=_0x41c791||0x1f4;return function(_0x6897e6){logger[_0x6aff('0x21')](_0x6897e6[_0x6aff('0x22')]);if(_0x6897e6[_0x6aff('0x23')]){delete _0x6897e6[_0x6aff('0x23')];}_0x29c987[_0x6aff('0x13')](_0x41c791)['send'](_0x6897e6);};}exports[_0x6aff('0x24')]=function(_0x173a95,_0x4af487){var _0x1336ce={},_0x18faa6={},_0x167f75={'count':0x0,'rows':[]};var _0x26556c=_['map'](db[_0x6aff('0x25')][_0x6aff('0x26')],function(_0x57eadd){return{'name':_0x57eadd[_0x6aff('0x27')],'type':_0x57eadd[_0x6aff('0x28')][_0x6aff('0x29')]};});_0x18faa6[_0x6aff('0x2a')]=_[_0x6aff('0x2b')](_0x26556c,'name');_0x18faa6[_0x6aff('0x2c')]=_[_0x6aff('0x2d')](_0x173a95[_0x6aff('0x2c')]);_0x18faa6[_0x6aff('0x2e')]=_[_0x6aff('0x2f')](_0x18faa6[_0x6aff('0x2a')],_0x18faa6[_0x6aff('0x2c')]);_0x1336ce['attributes']=_['intersection'](_0x18faa6[_0x6aff('0x2a')],qs[_0x6aff('0x30')](_0x173a95[_0x6aff('0x2c')][_0x6aff('0x30')]));_0x1336ce[_0x6aff('0x31')]=_0x1336ce[_0x6aff('0x31')][_0x6aff('0x32')]?_0x1336ce['attributes']:_0x18faa6[_0x6aff('0x2a')];if(!_0x173a95[_0x6aff('0x2c')][_0x6aff('0x33')]('nolimit')){_0x1336ce['limit']=qs[_0x6aff('0x18')](_0x173a95[_0x6aff('0x2c')]['limit']);_0x1336ce[_0x6aff('0x16')]=qs[_0x6aff('0x16')](_0x173a95[_0x6aff('0x2c')][_0x6aff('0x16')]);}_0x1336ce[_0x6aff('0x34')]=qs[_0x6aff('0x35')](_0x173a95['query'][_0x6aff('0x35')]);_0x1336ce[_0x6aff('0x36')]=qs[_0x6aff('0x2e')](_['pick'](_0x173a95[_0x6aff('0x2c')],_0x18faa6[_0x6aff('0x2e')]),_0x26556c);if(_0x173a95[_0x6aff('0x2c')][_0x6aff('0x37')]){_0x1336ce[_0x6aff('0x36')]=_['merge'](_0x1336ce['where'],{'$or':_[_0x6aff('0x2b')](_0x26556c,function(_0x55ac73){if(_0x55ac73[_0x6aff('0x28')]!==_0x6aff('0x38')){var _0x36690a={};_0x36690a[_0x55ac73[_0x6aff('0x23')]]={'$like':'%'+_0x173a95[_0x6aff('0x2c')][_0x6aff('0x37')]+'%'};return _0x36690a;}})});}_0x1336ce=_[_0x6aff('0x39')]({},_0x1336ce,_0x173a95[_0x6aff('0x3a')]);var _0x7158c5={'where':_0x1336ce[_0x6aff('0x36')]};return db[_0x6aff('0x25')][_0x6aff('0x19')](_0x7158c5)[_0x6aff('0x1f')](function(_0x4baa71){_0x167f75[_0x6aff('0x19')]=_0x4baa71;if(_0x173a95[_0x6aff('0x2c')][_0x6aff('0x3b')]){_0x1336ce[_0x6aff('0x3c')]=[{'all':!![]}];}return db[_0x6aff('0x25')][_0x6aff('0x3d')](_0x1336ce);})['then'](function(_0x3bea9d){_0x167f75['rows']=_0x3bea9d;return _0x167f75;})[_0x6aff('0x1f')](respondWithFilteredResult(_0x4af487,_0x1336ce))[_0x6aff('0x3e')](handleError(_0x4af487,null));};exports[_0x6aff('0x3f')]=function(_0x47a008,_0x8b5f36){var _0x50ed76={'raw':!![],'where':{'id':_0x47a008[_0x6aff('0x40')]['id']}},_0x10db0b={};_0x10db0b[_0x6aff('0x2a')]=_['keys'](db[_0x6aff('0x25')][_0x6aff('0x26')]);_0x10db0b[_0x6aff('0x2c')]=_[_0x6aff('0x2d')](_0x47a008['query']);_0x10db0b['filters']=_[_0x6aff('0x2f')](_0x10db0b[_0x6aff('0x2a')],_0x10db0b[_0x6aff('0x2c')]);_0x50ed76[_0x6aff('0x31')]=_['intersection'](_0x10db0b['model'],qs[_0x6aff('0x30')](_0x47a008['query'][_0x6aff('0x30')]));_0x50ed76['attributes']=_0x50ed76[_0x6aff('0x31')][_0x6aff('0x32')]?_0x50ed76['attributes']:_0x10db0b[_0x6aff('0x2a')];if(_0x47a008[_0x6aff('0x2c')][_0x6aff('0x3b')]){_0x50ed76[_0x6aff('0x3c')]=[{'all':!![]}];}_0x50ed76=_[_0x6aff('0x39')]({},_0x50ed76,_0x47a008[_0x6aff('0x3a')]);return db[_0x6aff('0x25')][_0x6aff('0x41')](_0x50ed76)['then'](handleEntityNotFound(_0x8b5f36,null))[_0x6aff('0x1f')](respondWithResult(_0x8b5f36,null))[_0x6aff('0x3e')](handleError(_0x8b5f36,null));};exports[_0x6aff('0x42')]=function(_0x57686c,_0x4ca762){return db[_0x6aff('0x25')]['create'](_0x57686c['body'],{})[_0x6aff('0x1f')](respondWithResult(_0x4ca762,0xc9))[_0x6aff('0x3e')](handleError(_0x4ca762,null));};exports[_0x6aff('0x1e')]=function(_0x447b2b,_0x22637d){if(_0x447b2b[_0x6aff('0x43')]['id']){delete _0x447b2b[_0x6aff('0x43')]['id'];}return db[_0x6aff('0x25')][_0x6aff('0x41')]({'where':{'id':_0x447b2b['params']['id']}})[_0x6aff('0x1f')](handleEntityNotFound(_0x22637d,null))[_0x6aff('0x1f')](saveUpdates(_0x447b2b[_0x6aff('0x43')],null))[_0x6aff('0x1f')](respondWithResult(_0x22637d,null))[_0x6aff('0x3e')](handleError(_0x22637d,null));};exports[_0x6aff('0x20')]=function(_0x48e71c,_0x2992f3){return db[_0x6aff('0x25')][_0x6aff('0x41')]({'where':{'id':_0x48e71c[_0x6aff('0x40')]['id']}})[_0x6aff('0x1f')](handleEntityNotFound(_0x2992f3,null))['then'](removeEntity(_0x2992f3,null))[_0x6aff('0x3e')](handleError(_0x2992f3,null));}; \ No newline at end of file +var _0x5f4d=['catch','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','offset','undefined','limit','count','Content-Range','reject','save','update','then','error','stack','name','ZohoField','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','attributes','fields','query','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x5d0064,_0xd2d4a3){var _0xf26d30=function(_0xe50214){while(--_0xe50214){_0x5d0064['push'](_0x5d0064['shift']());}};_0xf26d30(++_0xd2d4a3);}(_0x5f4d,0x86));var _0xd5f4=function(_0x55d25d,_0x8b7687){_0x55d25d=_0x55d25d-0x0;var _0x23708=_0x5f4d[_0x55d25d];return _0x23708;};'use strict';var emlformat=require(_0xd5f4('0x0'));var rimraf=require(_0xd5f4('0x1'));var zipdir=require(_0xd5f4('0x2'));var jsonpatch=require(_0xd5f4('0x3'));var rp=require('request-promise');var moment=require(_0xd5f4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd5f4('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd5f4('0x6'));var fs=require('fs');var fs_extra=require(_0xd5f4('0x7'));var _=require(_0xd5f4('0x8'));var squel=require('squel');var crypto=require(_0xd5f4('0x9'));var jsforce=require(_0xd5f4('0xa'));var deskjs=require(_0xd5f4('0xb'));var toCsv=require(_0xd5f4('0xc'));var querystring=require(_0xd5f4('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd5f4('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd5f4('0xf'));var logger=require(_0xd5f4('0x10'))(_0xd5f4('0x11'));var utils=require(_0xd5f4('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xd5f4('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x95e52,_0x10caf0){_0x10caf0=_0x10caf0||0xcc;return function(_0x1abf69){if(_0x1abf69){return _0x95e52['sendStatus'](_0x10caf0);}return _0x95e52[_0xd5f4('0x14')](_0x10caf0)['end']();};}function respondWithResult(_0xf8461d,_0x14e08f){_0x14e08f=_0x14e08f||0xc8;return function(_0x1fa931){if(_0x1fa931){return _0xf8461d[_0xd5f4('0x14')](_0x14e08f)['json'](_0x1fa931);}};}function respondWithFilteredResult(_0x4df25f,_0x37222b){return function(_0x1fe572){if(_0x1fe572){var _0x5b874e=typeof _0x37222b[_0xd5f4('0x15')]===_0xd5f4('0x16')&&typeof _0x37222b[_0xd5f4('0x17')]==='undefined';var _0x236db4=_0x1fe572[_0xd5f4('0x18')];var _0x35c46e=_0x5b874e?0x0:_0x37222b[_0xd5f4('0x15')];var _0x28b8eb=_0x5b874e?_0x1fe572[_0xd5f4('0x18')]:_0x37222b['offset']+_0x37222b['limit'];var _0x659eac;if(_0x28b8eb>=_0x236db4){_0x28b8eb=_0x236db4;_0x659eac=0xc8;}else{_0x659eac=0xce;}_0x4df25f[_0xd5f4('0x14')](_0x659eac);return _0x4df25f['set'](_0xd5f4('0x19'),_0x35c46e+'-'+_0x28b8eb+'/'+_0x236db4)['json'](_0x1fe572);}return null;};}function patchUpdates(_0x39eae9){return function(_0x4d9e32){try{jsonpatch['apply'](_0x4d9e32,_0x39eae9,!![]);}catch(_0x28a760){return BPromise[_0xd5f4('0x1a')](_0x28a760);}return _0x4d9e32[_0xd5f4('0x1b')]();};}function saveUpdates(_0x976dd1,_0x29f207){return function(_0x23735c){if(_0x23735c){return _0x23735c[_0xd5f4('0x1c')](_0x976dd1)[_0xd5f4('0x1d')](function(_0x37327c){return _0x37327c;});}return null;};}function removeEntity(_0xd9c688,_0x384fb1){return function(_0x2d5177){if(_0x2d5177){return _0x2d5177['destroy']()[_0xd5f4('0x1d')](function(){_0xd9c688[_0xd5f4('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dc04c,_0x5291f3){return function(_0x53413c){if(!_0x53413c){_0x4dc04c['sendStatus'](0x194);}return _0x53413c;};}function handleError(_0x5a765f,_0x203cad){_0x203cad=_0x203cad||0x1f4;return function(_0xcdd6c0){logger[_0xd5f4('0x1e')](_0xcdd6c0[_0xd5f4('0x1f')]);if(_0xcdd6c0[_0xd5f4('0x20')]){delete _0xcdd6c0['name'];}_0x5a765f[_0xd5f4('0x14')](_0x203cad)['send'](_0xcdd6c0);};}exports['index']=function(_0x30ddf6,_0x227be6){var _0x1d1c2b={},_0x151b32={},_0x403fb7={'count':0x0,'rows':[]};var _0x210f19=_['map'](db[_0xd5f4('0x21')][_0xd5f4('0x22')],function(_0xb0b528){return{'name':_0xb0b528[_0xd5f4('0x23')],'type':_0xb0b528[_0xd5f4('0x24')][_0xd5f4('0x25')]};});_0x151b32[_0xd5f4('0x26')]=_[_0xd5f4('0x27')](_0x210f19,'name');_0x151b32['query']=_[_0xd5f4('0x28')](_0x30ddf6['query']);_0x151b32[_0xd5f4('0x29')]=_[_0xd5f4('0x2a')](_0x151b32[_0xd5f4('0x26')],_0x151b32['query']);_0x1d1c2b[_0xd5f4('0x2b')]=_[_0xd5f4('0x2a')](_0x151b32['model'],qs[_0xd5f4('0x2c')](_0x30ddf6[_0xd5f4('0x2d')]['fields']));_0x1d1c2b[_0xd5f4('0x2b')]=_0x1d1c2b[_0xd5f4('0x2b')][_0xd5f4('0x2e')]?_0x1d1c2b[_0xd5f4('0x2b')]:_0x151b32[_0xd5f4('0x26')];if(!_0x30ddf6[_0xd5f4('0x2d')]['hasOwnProperty'](_0xd5f4('0x2f'))){_0x1d1c2b[_0xd5f4('0x17')]=qs[_0xd5f4('0x17')](_0x30ddf6[_0xd5f4('0x2d')]['limit']);_0x1d1c2b[_0xd5f4('0x15')]=qs[_0xd5f4('0x15')](_0x30ddf6[_0xd5f4('0x2d')]['offset']);}_0x1d1c2b['order']=qs[_0xd5f4('0x30')](_0x30ddf6[_0xd5f4('0x2d')][_0xd5f4('0x30')]);_0x1d1c2b[_0xd5f4('0x31')]=qs[_0xd5f4('0x29')](_['pick'](_0x30ddf6[_0xd5f4('0x2d')],_0x151b32[_0xd5f4('0x29')]),_0x210f19);if(_0x30ddf6['query'][_0xd5f4('0x32')]){_0x1d1c2b['where']=_[_0xd5f4('0x33')](_0x1d1c2b[_0xd5f4('0x31')],{'$or':_[_0xd5f4('0x27')](_0x210f19,function(_0x46a479){if(_0x46a479[_0xd5f4('0x24')]!==_0xd5f4('0x34')){var _0x565fde={};_0x565fde[_0x46a479[_0xd5f4('0x20')]]={'$like':'%'+_0x30ddf6[_0xd5f4('0x2d')]['filter']+'%'};return _0x565fde;}})});}_0x1d1c2b=_['merge']({},_0x1d1c2b,_0x30ddf6[_0xd5f4('0x35')]);var _0x15d9fd={'where':_0x1d1c2b[_0xd5f4('0x31')]};return db[_0xd5f4('0x21')][_0xd5f4('0x18')](_0x15d9fd)['then'](function(_0x5e76bb){_0x403fb7[_0xd5f4('0x18')]=_0x5e76bb;if(_0x30ddf6[_0xd5f4('0x2d')][_0xd5f4('0x36')]){_0x1d1c2b[_0xd5f4('0x37')]=[{'all':!![]}];}return db[_0xd5f4('0x21')][_0xd5f4('0x38')](_0x1d1c2b);})['then'](function(_0x1842cc){_0x403fb7[_0xd5f4('0x39')]=_0x1842cc;return _0x403fb7;})[_0xd5f4('0x1d')](respondWithFilteredResult(_0x227be6,_0x1d1c2b))[_0xd5f4('0x3a')](handleError(_0x227be6,null));};exports['show']=function(_0x5011a0,_0x27e3f6){var _0x1b9cd8={'raw':!![],'where':{'id':_0x5011a0[_0xd5f4('0x3b')]['id']}},_0x3b1638={};_0x3b1638[_0xd5f4('0x26')]=_['keys'](db['ZohoField'][_0xd5f4('0x22')]);_0x3b1638[_0xd5f4('0x2d')]=_[_0xd5f4('0x28')](_0x5011a0[_0xd5f4('0x2d')]);_0x3b1638[_0xd5f4('0x29')]=_[_0xd5f4('0x2a')](_0x3b1638['model'],_0x3b1638[_0xd5f4('0x2d')]);_0x1b9cd8[_0xd5f4('0x2b')]=_[_0xd5f4('0x2a')](_0x3b1638['model'],qs[_0xd5f4('0x2c')](_0x5011a0[_0xd5f4('0x2d')][_0xd5f4('0x2c')]));_0x1b9cd8[_0xd5f4('0x2b')]=_0x1b9cd8['attributes'][_0xd5f4('0x2e')]?_0x1b9cd8[_0xd5f4('0x2b')]:_0x3b1638[_0xd5f4('0x26')];if(_0x5011a0[_0xd5f4('0x2d')]['includeAll']){_0x1b9cd8[_0xd5f4('0x37')]=[{'all':!![]}];}_0x1b9cd8=_[_0xd5f4('0x33')]({},_0x1b9cd8,_0x5011a0[_0xd5f4('0x35')]);return db[_0xd5f4('0x21')][_0xd5f4('0x3c')](_0x1b9cd8)[_0xd5f4('0x1d')](handleEntityNotFound(_0x27e3f6,null))['then'](respondWithResult(_0x27e3f6,null))[_0xd5f4('0x3a')](handleError(_0x27e3f6,null));};exports[_0xd5f4('0x3d')]=function(_0x43d47a,_0xffa861){return db[_0xd5f4('0x21')][_0xd5f4('0x3d')](_0x43d47a[_0xd5f4('0x3e')],{})['then'](respondWithResult(_0xffa861,0xc9))[_0xd5f4('0x3a')](handleError(_0xffa861,null));};exports[_0xd5f4('0x1c')]=function(_0x193503,_0x4a328c){if(_0x193503[_0xd5f4('0x3e')]['id']){delete _0x193503['body']['id'];}return db[_0xd5f4('0x21')]['find']({'where':{'id':_0x193503[_0xd5f4('0x3b')]['id']}})[_0xd5f4('0x1d')](handleEntityNotFound(_0x4a328c,null))[_0xd5f4('0x1d')](saveUpdates(_0x193503[_0xd5f4('0x3e')],null))['then'](respondWithResult(_0x4a328c,null))[_0xd5f4('0x3a')](handleError(_0x4a328c,null));};exports[_0xd5f4('0x3f')]=function(_0x43ffca,_0x44e483){return db[_0xd5f4('0x21')][_0xd5f4('0x3c')]({'where':{'id':_0x43ffca[_0xd5f4('0x3b')]['id']}})[_0xd5f4('0x1d')](handleEntityNotFound(_0x44e483,null))[_0xd5f4('0x1d')](removeEntity(_0x44e483,null))[_0xd5f4('0x3a')](handleError(_0x44e483,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index d8b6c77..888c6b8 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 _0xe3da=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','zoho_unique_index','idField','lodash','util','../../config/logger'];(function(_0x4a14ec,_0x90fcd6){var _0x351ba9=function(_0x433916){while(--_0x433916){_0x4a14ec['push'](_0x4a14ec['shift']());}};_0x351ba9(++_0x90fcd6);}(_0xe3da,0x1cd));var _0xae3d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe3da[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var logger=require(_0xae3d('0x2'))(_0xae3d('0x3'));var moment=require(_0xae3d('0x4'));var BPromise=require(_0xae3d('0x5'));var rp=require(_0xae3d('0x6'));var fs=require('fs');var path=require(_0xae3d('0x7'));var rimraf=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var attributes=require(_0xae3d('0xa'));module[_0xae3d('0xb')]=function(_0xa9a1a,_0xa54808){return _0xa9a1a[_0xae3d('0xc')](_0xae3d('0xd'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xae3d('0xe'),'fields':[_0xae3d('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7278=['idField','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index'];(function(_0x25cfcf,_0x306701){var _0x4ae0b0=function(_0xe62967){while(--_0xe62967){_0x25cfcf['push'](_0x25cfcf['shift']());}};_0x4ae0b0(++_0x306701);}(_0x7278,0x161));var _0x8727=function(_0x3a76a6,_0x596c41){_0x3a76a6=_0x3a76a6-0x0;var _0x51e498=_0x7278[_0x3a76a6];return _0x51e498;};'use strict';var _=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var logger=require(_0x8727('0x2'))(_0x8727('0x3'));var moment=require(_0x8727('0x4'));var BPromise=require('bluebird');var rp=require(_0x8727('0x5'));var fs=require('fs');var path=require(_0x8727('0x6'));var rimraf=require(_0x8727('0x7'));var config=require(_0x8727('0x8'));var attributes=require(_0x8727('0x9'));module[_0x8727('0xa')]=function(_0x180b71,_0x5549d5){return _0x180b71[_0x8727('0xb')](_0x8727('0xc'),attributes,{'tableName':_0x8727('0xd'),'paranoid':![],'indexes':[{'name':_0x8727('0xe'),'fields':[_0x8727('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index e14a5b0..d72086b 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 _0x357e=['jayson/promise','client','http','request','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x609988,_0x507944){var _0x159984=function(_0x39d9ce){while(--_0x39d9ce){_0x609988['push'](_0x609988['shift']());}};_0x159984(++_0x507944);}(_0x357e,0x100));var _0xe357=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x357e[_0x1203f];return _0x365f0a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe357('0x0'));var BPromise=require(_0xe357('0x1'));var rs=require(_0xe357('0x2'));var fs=require('fs');var Redis=require(_0xe357('0x3'));var db=require(_0xe357('0x4'))['db'];var utils=require(_0xe357('0x5'));var logger=require('../../config/logger')(_0xe357('0x6'));var config=require(_0xe357('0x7'));var jayson=require(_0xe357('0x8'));var client=jayson[_0xe357('0x9')][_0xe357('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c0d01,_0x55b7b0,_0x148b00){return new BPromise(function(_0x3e01d5,_0x50b9c8){return client[_0xe357('0xb')](_0x3c0d01,_0x148b00)['then'](function(_0x32f62a){logger['info'](_0xe357('0xc'),_0x55b7b0,_0xe357('0xd'));logger['debug'](_0xe357('0xe'),_0x55b7b0,'request\x20sent',JSON[_0xe357('0xf')](_0x32f62a));if(_0x32f62a[_0xe357('0x10')]){if(_0x32f62a['error'][_0xe357('0x11')]===0x1f4){logger[_0xe357('0x10')](_0xe357('0xc'),_0x55b7b0,_0x32f62a[_0xe357('0x10')][_0xe357('0x12')]);return _0x50b9c8(_0x32f62a[_0xe357('0x10')]['message']);}logger[_0xe357('0x10')]('ZohoField,\x20%s,\x20%s',_0x55b7b0,_0x32f62a[_0xe357('0x10')]['message']);return _0x3e01d5(_0x32f62a[_0xe357('0x10')][_0xe357('0x12')]);}else{logger[_0xe357('0x13')]('ZohoField,\x20%s,\x20%s',_0x55b7b0,_0xe357('0xd'));_0x3e01d5(_0x32f62a[_0xe357('0x14')][_0xe357('0x12')]);}})[_0xe357('0x15')](function(_0x223e24){logger[_0xe357('0x10')](_0xe357('0xc'),_0x55b7b0,_0x223e24);_0x50b9c8(_0x223e24);});});} \ No newline at end of file +var _0x4921=['request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x45feaa,_0x310e19){var _0x452b04=function(_0x142c90){while(--_0x142c90){_0x45feaa['push'](_0x45feaa['shift']());}};_0x452b04(++_0x310e19);}(_0x4921,0x192));var _0x1492=function(_0x4e518d,_0x32a45d){_0x4e518d=_0x4e518d-0x0;var _0x458ff2=_0x4921[_0x4e518d];return _0x458ff2;};'use strict';var _=require(_0x1492('0x0'));var util=require(_0x1492('0x1'));var moment=require(_0x1492('0x2'));var BPromise=require(_0x1492('0x3'));var rs=require(_0x1492('0x4'));var fs=require('fs');var Redis=require(_0x1492('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1492('0x6'));var logger=require('../../config/logger')(_0x1492('0x7'));var config=require(_0x1492('0x8'));var jayson=require(_0x1492('0x9'));var client=jayson[_0x1492('0xa')][_0x1492('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3550f1,_0x2ee300,_0x26e0e8){return new BPromise(function(_0xe4d9b3,_0x32cecf){return client[_0x1492('0xc')](_0x3550f1,_0x26e0e8)[_0x1492('0xd')](function(_0x5d8dae){logger[_0x1492('0xe')](_0x1492('0xf'),_0x2ee300,_0x1492('0x10'));logger[_0x1492('0x11')](_0x1492('0x12'),_0x2ee300,'request\x20sent',JSON['stringify'](_0x5d8dae));if(_0x5d8dae['error']){if(_0x5d8dae['error']['code']===0x1f4){logger[_0x1492('0x13')](_0x1492('0xf'),_0x2ee300,_0x5d8dae[_0x1492('0x13')][_0x1492('0x14')]);return _0x32cecf(_0x5d8dae[_0x1492('0x13')][_0x1492('0x14')]);}logger['error'](_0x1492('0xf'),_0x2ee300,_0x5d8dae[_0x1492('0x13')]['message']);return _0xe4d9b3(_0x5d8dae[_0x1492('0x13')]['message']);}else{logger[_0x1492('0xe')](_0x1492('0xf'),_0x2ee300,'request\x20sent');_0xe4d9b3(_0x5d8dae[_0x1492('0x15')][_0x1492('0x14')]);}})[_0x1492('0x16')](function(_0x50a416){logger[_0x1492('0x13')](_0x1492('0xf'),_0x2ee300,_0x50a416);_0x32cecf(_0x50a416);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 2982858..4f3a2cf 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x23cd30,_0x32d7c3){var _0x520c9d=function(_0x155a22){while(--_0x155a22){_0x23cd30['push'](_0x23cd30['shift']());}};_0x520c9d(++_0x32d7c3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xf678b5,_0x119905){var _0x2c8c82=function(_0x2eece6){while(--_0x2eece6){_0xf678b5['push'](_0xf678b5['shift']());}};_0x2c8c82(++_0x119905);}(_0xe706,0xa3));var _0x6e70=function(_0x1428d9,_0xded63c){_0x1428d9=_0x1428d9-0x0;var _0x438019=_0xe706[_0x1428d9];return _0x438019;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 27b2167..17c86a7 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 _0x7868=['STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x348188,_0x4f2fc5){var _0x5827a0=function(_0x33dfc8){while(--_0x33dfc8){_0x348188['push'](_0x348188['shift']());}};_0x5827a0(++_0x4f2fc5);}(_0x7868,0x67));var _0x8786=function(_0x401b0b,_0x2f9acf){_0x401b0b=_0x401b0b-0x0;var _0x266190=_0x7868[_0x401b0b];return _0x266190;};'use strict';var Sequelize=require(_0x8786('0x0'));module[_0x8786('0x1')]={'name':{'type':Sequelize[_0x8786('0x2')],'allowNull':![],'unique':_0x8786('0x3')},'version':{'type':Sequelize[_0x8786('0x2')],'allowNull':![],'unique':_0x8786('0x3')},'main':{'type':Sequelize[_0x8786('0x2')],'defaultValue':_0x8786('0x4')},'filename':{'type':Sequelize[_0x8786('0x2')]},'path':{'type':Sequelize[_0x8786('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x8786('0x5')]},'active':{'type':Sequelize[_0x8786('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x8786('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x8786('0x2')],'unique':'state'},'description':{'type':Sequelize[_0x8786('0x2')]},'title':{'type':Sequelize[_0x8786('0x2')]},'remoteUri':{'type':Sequelize[_0x8786('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x0608=['app.js','BOOLEAN','sequelize','exports','STRING','unique_name_and_version'];(function(_0x3f3a52,_0x2b5de5){var _0x296df7=function(_0x11d3bb){while(--_0x11d3bb){_0x3f3a52['push'](_0x3f3a52['shift']());}};_0x296df7(++_0x2b5de5);}(_0x0608,0x1d6));var _0x8060=function(_0x5e9237,_0x2c88c5){_0x5e9237=_0x5e9237-0x0;var _0x57d454=_0x0608[_0x5e9237];return _0x57d454;};'use strict';var Sequelize=require(_0x8060('0x0'));module[_0x8060('0x1')]={'name':{'type':Sequelize[_0x8060('0x2')],'allowNull':![],'unique':_0x8060('0x3')},'version':{'type':Sequelize[_0x8060('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':_0x8060('0x4')},'filename':{'type':Sequelize[_0x8060('0x2')]},'path':{'type':Sequelize[_0x8060('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x8060('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x8060('0x2')]},'logo':{'type':Sequelize[_0x8060('0x2')]},'state':{'type':Sequelize[_0x8060('0x2')],'unique':'state'},'description':{'type':Sequelize[_0x8060('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x8060('0x2')]},'link':{'type':Sequelize[_0x8060('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 795bb28..562106e 100644 --- a/server/api/integration/integration.controller.js +++ b/server/api/integration/integration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4991=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','filter','options','Integration','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','map','rawAttributes','fieldName','key','model','query','filters'];(function(_0xc66c50,_0x4dfbc1){var _0x48bc6f=function(_0x781d40){while(--_0x781d40){_0xc66c50['push'](_0xc66c50['shift']());}};_0x48bc6f(++_0x4dfbc1);}(_0x4991,0xf7));var _0x1499=function(_0x22386a,_0x482919){_0x22386a=_0x22386a-0x0;var _0x20f6ee=_0x4991[_0x22386a];return _0x20f6ee;};'use strict';var emlformat=require(_0x1499('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1499('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1499('0x2'));var moment=require(_0x1499('0x3'));var BPromise=require(_0x1499('0x4'));var Mustache=require(_0x1499('0x5'));var util=require(_0x1499('0x6'));var path=require(_0x1499('0x7'));var sox=require(_0x1499('0x8'));var csv=require(_0x1499('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1499('0xa'));var _=require(_0x1499('0xb'));var squel=require(_0x1499('0xc'));var crypto=require(_0x1499('0xd'));var jsforce=require(_0x1499('0xe'));var deskjs=require(_0x1499('0xf'));var toCsv=require(_0x1499('0x9'));var querystring=require(_0x1499('0x10'));var Papa=require('papaparse');var Redis=require(_0x1499('0x11'));var authService=require(_0x1499('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1499('0x13'));var hardwareService=require(_0x1499('0x14'));var logger=require('../../config/logger')(_0x1499('0x15'));var utils=require(_0x1499('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3039ce,_0x274bc1){_0x274bc1=_0x274bc1||0xcc;return function(_0x34a928){if(_0x34a928){return _0x3039ce[_0x1499('0x17')](_0x274bc1);}return _0x3039ce[_0x1499('0x18')](_0x274bc1)['end']();};}function respondWithResult(_0x5f34f2,_0x308177){_0x308177=_0x308177||0xc8;return function(_0x4e5195){if(_0x4e5195){return _0x5f34f2[_0x1499('0x18')](_0x308177)[_0x1499('0x19')](_0x4e5195);}};}function respondWithFilteredResult(_0x308318,_0x3ab605){return function(_0x48f654){if(_0x48f654){var _0x1ed43b=typeof _0x3ab605[_0x1499('0x1a')]==='undefined'&&typeof _0x3ab605[_0x1499('0x1b')]===_0x1499('0x1c');var _0x46b364=_0x48f654[_0x1499('0x1d')];var _0x1e45a9=_0x1ed43b?0x0:_0x3ab605[_0x1499('0x1a')];var _0x5b9859=_0x1ed43b?_0x48f654['count']:_0x3ab605['offset']+_0x3ab605[_0x1499('0x1b')];var _0xad534b;if(_0x5b9859>=_0x46b364){_0x5b9859=_0x46b364;_0xad534b=0xc8;}else{_0xad534b=0xce;}_0x308318['status'](_0xad534b);return _0x308318[_0x1499('0x1e')](_0x1499('0x1f'),_0x1e45a9+'-'+_0x5b9859+'/'+_0x46b364)[_0x1499('0x19')](_0x48f654);}return null;};}function patchUpdates(_0x18e4a6){return function(_0x21e887){try{jsonpatch[_0x1499('0x20')](_0x21e887,_0x18e4a6,!![]);}catch(_0x2b0458){return BPromise[_0x1499('0x21')](_0x2b0458);}return _0x21e887[_0x1499('0x22')]();};}function saveUpdates(_0x15bcd4,_0x2bb71f){return function(_0x836081){if(_0x836081){return _0x836081[_0x1499('0x23')](_0x15bcd4)[_0x1499('0x24')](function(_0x4ec57a){return _0x4ec57a;});}return null;};}function removeEntity(_0x1e2c51,_0x2c7f57){return function(_0x5615b4){if(_0x5615b4){return _0x5615b4[_0x1499('0x25')]()[_0x1499('0x24')](function(){_0x1e2c51[_0x1499('0x18')](0xcc)[_0x1499('0x26')]();});}};}function handleEntityNotFound(_0x3968e0,_0x16d036){return function(_0x54f3c2){if(!_0x54f3c2){_0x3968e0['sendStatus'](0x194);}return _0x54f3c2;};}function handleError(_0x12739b,_0x3c9aca){_0x3c9aca=_0x3c9aca||0x1f4;return function(_0x3b9259){logger[_0x1499('0x27')](_0x3b9259[_0x1499('0x28')]);if(_0x3b9259['name']){delete _0x3b9259[_0x1499('0x29')];}_0x12739b['status'](_0x3c9aca)['send'](_0x3b9259);};}exports['index']=function(_0x21d204,_0x103efa){var _0x40932a={},_0x1b460b={},_0x3dad86={'count':0x0,'rows':[]};var _0x388513=_[_0x1499('0x2a')](db['Integration'][_0x1499('0x2b')],function(_0x1a2c99){return{'name':_0x1a2c99[_0x1499('0x2c')],'type':_0x1a2c99['type'][_0x1499('0x2d')]};});_0x1b460b[_0x1499('0x2e')]=_['map'](_0x388513,_0x1499('0x29'));_0x1b460b[_0x1499('0x2f')]=_['keys'](_0x21d204[_0x1499('0x2f')]);_0x1b460b[_0x1499('0x30')]=_[_0x1499('0x31')](_0x1b460b[_0x1499('0x2e')],_0x1b460b[_0x1499('0x2f')]);_0x40932a[_0x1499('0x32')]=_[_0x1499('0x31')](_0x1b460b[_0x1499('0x2e')],qs[_0x1499('0x33')](_0x21d204[_0x1499('0x2f')][_0x1499('0x33')]));_0x40932a[_0x1499('0x32')]=_0x40932a[_0x1499('0x32')][_0x1499('0x34')]?_0x40932a[_0x1499('0x32')]:_0x1b460b[_0x1499('0x2e')];if(!_0x21d204[_0x1499('0x2f')][_0x1499('0x35')](_0x1499('0x36'))){_0x40932a[_0x1499('0x1b')]=qs['limit'](_0x21d204[_0x1499('0x2f')][_0x1499('0x1b')]);_0x40932a[_0x1499('0x1a')]=qs[_0x1499('0x1a')](_0x21d204[_0x1499('0x2f')][_0x1499('0x1a')]);}_0x40932a[_0x1499('0x37')]=qs[_0x1499('0x38')](_0x21d204[_0x1499('0x2f')][_0x1499('0x38')]);_0x40932a[_0x1499('0x39')]=qs['filters'](_['pick'](_0x21d204[_0x1499('0x2f')],_0x1b460b['filters']),_0x388513);if(_0x21d204[_0x1499('0x2f')]['filter']){_0x40932a[_0x1499('0x39')]=_[_0x1499('0x3a')](_0x40932a[_0x1499('0x39')],{'$or':_[_0x1499('0x2a')](_0x388513,function(_0x531933){if(_0x531933[_0x1499('0x3b')]!=='VIRTUAL'){var _0x2f9c59={};_0x2f9c59[_0x531933[_0x1499('0x29')]]={'$like':'%'+_0x21d204[_0x1499('0x2f')][_0x1499('0x3c')]+'%'};return _0x2f9c59;}})});}_0x40932a=_['merge']({},_0x40932a,_0x21d204[_0x1499('0x3d')]);var _0x815a99={'where':_0x40932a[_0x1499('0x39')]};return db[_0x1499('0x3e')]['count'](_0x815a99)[_0x1499('0x24')](function(_0x4cc411){_0x3dad86[_0x1499('0x1d')]=_0x4cc411;if(_0x21d204[_0x1499('0x2f')][_0x1499('0x3f')]){_0x40932a[_0x1499('0x40')]=[{'all':!![]}];}return db[_0x1499('0x3e')][_0x1499('0x41')](_0x40932a);})[_0x1499('0x24')](function(_0xcb85eb){_0x3dad86[_0x1499('0x42')]=_0xcb85eb;return _0x3dad86;})[_0x1499('0x24')](respondWithFilteredResult(_0x103efa,_0x40932a))['catch'](handleError(_0x103efa,null));};exports[_0x1499('0x43')]=function(_0x5dd36c,_0x2cfdaf){var _0x1af1a1={'raw':![],'where':{'id':_0x5dd36c[_0x1499('0x44')]['id']}},_0x5646cf={};_0x5646cf[_0x1499('0x2e')]=_[_0x1499('0x45')](db[_0x1499('0x3e')][_0x1499('0x2b')]);_0x5646cf['query']=_['keys'](_0x5dd36c[_0x1499('0x2f')]);_0x5646cf[_0x1499('0x30')]=_['intersection'](_0x5646cf[_0x1499('0x2e')],_0x5646cf[_0x1499('0x2f')]);_0x1af1a1['attributes']=_['intersection'](_0x5646cf[_0x1499('0x2e')],qs[_0x1499('0x33')](_0x5dd36c[_0x1499('0x2f')]['fields']));_0x1af1a1[_0x1499('0x32')]=_0x1af1a1[_0x1499('0x32')][_0x1499('0x34')]?_0x1af1a1[_0x1499('0x32')]:_0x5646cf['model'];if(_0x5dd36c[_0x1499('0x2f')][_0x1499('0x3f')]){_0x1af1a1[_0x1499('0x40')]=[{'all':!![]}];}_0x1af1a1=_[_0x1499('0x3a')]({},_0x1af1a1,_0x5dd36c['options']);return db[_0x1499('0x3e')][_0x1499('0x46')](_0x1af1a1)[_0x1499('0x24')](handleEntityNotFound(_0x2cfdaf,null))['then'](respondWithResult(_0x2cfdaf,null))['catch'](handleError(_0x2cfdaf,null));};exports[_0x1499('0x47')]=function(_0x491777,_0x7fa101){return db[_0x1499('0x3e')][_0x1499('0x47')](_0x491777[_0x1499('0x48')],{})[_0x1499('0x24')](respondWithResult(_0x7fa101,0xc9))[_0x1499('0x49')](handleError(_0x7fa101,null));};exports[_0x1499('0x23')]=function(_0x591aa8,_0x420d16){if(_0x591aa8['body']['id']){delete _0x591aa8[_0x1499('0x48')]['id'];}return db[_0x1499('0x3e')]['find']({'where':{'id':_0x591aa8[_0x1499('0x44')]['id']}})[_0x1499('0x24')](handleEntityNotFound(_0x420d16,null))[_0x1499('0x24')](saveUpdates(_0x591aa8['body'],null))[_0x1499('0x24')](respondWithResult(_0x420d16,null))[_0x1499('0x49')](handleError(_0x420d16,null));};exports[_0x1499('0x25')]=function(_0x29ac0f,_0x305599){return db[_0x1499('0x3e')][_0x1499('0x46')]({'where':{'id':_0x29ac0f[_0x1499('0x44')]['id']}})[_0x1499('0x24')](handleEntityNotFound(_0x305599,null))[_0x1499('0x24')](removeEntity(_0x305599,null))['catch'](handleError(_0x305599,null));}; \ No newline at end of file +var _0x5496=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','Integration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','fields','include','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x5496,0x175));var _0x6549=function(_0x548bd3,_0x87c3ee){_0x548bd3=_0x548bd3-0x0;var _0x7ce1c0=_0x5496[_0x548bd3];return _0x7ce1c0;};'use strict';var emlformat=require(_0x6549('0x0'));var rimraf=require(_0x6549('0x1'));var zipdir=require(_0x6549('0x2'));var jsonpatch=require(_0x6549('0x3'));var rp=require(_0x6549('0x4'));var moment=require('moment');var BPromise=require(_0x6549('0x5'));var Mustache=require('mustache');var util=require(_0x6549('0x6'));var path=require(_0x6549('0x7'));var sox=require(_0x6549('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6549('0x9'));var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var licenseUtil=require(_0x6549('0x17'));var db=require(_0x6549('0x18'))['db'];function respondWithStatusCode(_0x5bc018,_0x4dfb06){_0x4dfb06=_0x4dfb06||0xcc;return function(_0x3f844f){if(_0x3f844f){return _0x5bc018[_0x6549('0x19')](_0x4dfb06);}return _0x5bc018['status'](_0x4dfb06)[_0x6549('0x1a')]();};}function respondWithResult(_0x150fc8,_0x195d25){_0x195d25=_0x195d25||0xc8;return function(_0x12b068){if(_0x12b068){return _0x150fc8[_0x6549('0x1b')](_0x195d25)[_0x6549('0x1c')](_0x12b068);}};}function respondWithFilteredResult(_0x55c112,_0x5db86d){return function(_0x384f75){if(_0x384f75){var _0x25da29=typeof _0x5db86d['offset']===_0x6549('0x1d')&&typeof _0x5db86d[_0x6549('0x1e')]===_0x6549('0x1d');var _0x387e60=_0x384f75[_0x6549('0x1f')];var _0x53b12b=_0x25da29?0x0:_0x5db86d['offset'];var _0x26a212=_0x25da29?_0x384f75['count']:_0x5db86d['offset']+_0x5db86d[_0x6549('0x1e')];var _0x1e5079;if(_0x26a212>=_0x387e60){_0x26a212=_0x387e60;_0x1e5079=0xc8;}else{_0x1e5079=0xce;}_0x55c112[_0x6549('0x1b')](_0x1e5079);return _0x55c112[_0x6549('0x20')](_0x6549('0x21'),_0x53b12b+'-'+_0x26a212+'/'+_0x387e60)['json'](_0x384f75);}return null;};}function patchUpdates(_0x228117){return function(_0x4b40c1){try{jsonpatch[_0x6549('0x22')](_0x4b40c1,_0x228117,!![]);}catch(_0x72322b){return BPromise[_0x6549('0x23')](_0x72322b);}return _0x4b40c1[_0x6549('0x24')]();};}function saveUpdates(_0x22bcf8,_0x12d547){return function(_0x427b47){if(_0x427b47){return _0x427b47[_0x6549('0x25')](_0x22bcf8)[_0x6549('0x26')](function(_0x6ae00c){return _0x6ae00c;});}return null;};}function removeEntity(_0x40d3f9,_0x1fbfa4){return function(_0x23c0ba){if(_0x23c0ba){return _0x23c0ba['destroy']()[_0x6549('0x26')](function(){_0x40d3f9[_0x6549('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126967,_0x29f89e){return function(_0x3768cb){if(!_0x3768cb){_0x126967['sendStatus'](0x194);}return _0x3768cb;};}function handleError(_0x31a95,_0xfb51a1){_0xfb51a1=_0xfb51a1||0x1f4;return function(_0x14de1f){logger[_0x6549('0x27')](_0x14de1f[_0x6549('0x28')]);if(_0x14de1f[_0x6549('0x29')]){delete _0x14de1f[_0x6549('0x29')];}_0x31a95[_0x6549('0x1b')](_0xfb51a1)['send'](_0x14de1f);};}exports[_0x6549('0x2a')]=function(_0x136518,_0x17fdfb){var _0x4c605c={},_0x3f1502={},_0x4acaf5={'count':0x0,'rows':[]};var _0x4f0ad1=_['map'](db[_0x6549('0x2b')][_0x6549('0x2c')],function(_0x4f3069){return{'name':_0x4f3069[_0x6549('0x2d')],'type':_0x4f3069[_0x6549('0x2e')][_0x6549('0x2f')]};});_0x3f1502[_0x6549('0x30')]=_[_0x6549('0x31')](_0x4f0ad1,_0x6549('0x29'));_0x3f1502[_0x6549('0x32')]=_['keys'](_0x136518[_0x6549('0x32')]);_0x3f1502[_0x6549('0x33')]=_[_0x6549('0x34')](_0x3f1502[_0x6549('0x30')],_0x3f1502[_0x6549('0x32')]);_0x4c605c[_0x6549('0x35')]=_['intersection'](_0x3f1502[_0x6549('0x30')],qs['fields'](_0x136518[_0x6549('0x32')]['fields']));_0x4c605c[_0x6549('0x35')]=_0x4c605c[_0x6549('0x35')][_0x6549('0x36')]?_0x4c605c['attributes']:_0x3f1502[_0x6549('0x30')];if(!_0x136518[_0x6549('0x32')][_0x6549('0x37')](_0x6549('0x38'))){_0x4c605c['limit']=qs['limit'](_0x136518['query'][_0x6549('0x1e')]);_0x4c605c[_0x6549('0x39')]=qs['offset'](_0x136518[_0x6549('0x32')][_0x6549('0x39')]);}_0x4c605c[_0x6549('0x3a')]=qs[_0x6549('0x3b')](_0x136518[_0x6549('0x32')]['sort']);_0x4c605c['where']=qs[_0x6549('0x33')](_[_0x6549('0x3c')](_0x136518[_0x6549('0x32')],_0x3f1502[_0x6549('0x33')]),_0x4f0ad1);if(_0x136518[_0x6549('0x32')][_0x6549('0x3d')]){_0x4c605c[_0x6549('0x3e')]=_[_0x6549('0x3f')](_0x4c605c[_0x6549('0x3e')],{'$or':_[_0x6549('0x31')](_0x4f0ad1,function(_0x525f82){if(_0x525f82[_0x6549('0x2e')]!==_0x6549('0x40')){var _0x2ea977={};_0x2ea977[_0x525f82[_0x6549('0x29')]]={'$like':'%'+_0x136518[_0x6549('0x32')]['filter']+'%'};return _0x2ea977;}})});}_0x4c605c=_['merge']({},_0x4c605c,_0x136518['options']);var _0x22b919={'where':_0x4c605c[_0x6549('0x3e')]};return db[_0x6549('0x2b')][_0x6549('0x1f')](_0x22b919)['then'](function(_0x56ce9f){_0x4acaf5[_0x6549('0x1f')]=_0x56ce9f;if(_0x136518[_0x6549('0x32')][_0x6549('0x41')]){_0x4c605c['include']=[{'all':!![]}];}return db[_0x6549('0x2b')]['findAll'](_0x4c605c);})[_0x6549('0x26')](function(_0x2ec614){_0x4acaf5[_0x6549('0x42')]=_0x2ec614;return _0x4acaf5;})[_0x6549('0x26')](respondWithFilteredResult(_0x17fdfb,_0x4c605c))[_0x6549('0x43')](handleError(_0x17fdfb,null));};exports[_0x6549('0x44')]=function(_0xbbfdc9,_0x4deaab){var _0x132625={'raw':![],'where':{'id':_0xbbfdc9[_0x6549('0x45')]['id']}},_0x309f45={};_0x309f45[_0x6549('0x30')]=_[_0x6549('0x46')](db[_0x6549('0x2b')][_0x6549('0x2c')]);_0x309f45[_0x6549('0x32')]=_[_0x6549('0x46')](_0xbbfdc9[_0x6549('0x32')]);_0x309f45[_0x6549('0x33')]=_[_0x6549('0x34')](_0x309f45[_0x6549('0x30')],_0x309f45[_0x6549('0x32')]);_0x132625[_0x6549('0x35')]=_[_0x6549('0x34')](_0x309f45['model'],qs[_0x6549('0x47')](_0xbbfdc9[_0x6549('0x32')][_0x6549('0x47')]));_0x132625[_0x6549('0x35')]=_0x132625['attributes'][_0x6549('0x36')]?_0x132625['attributes']:_0x309f45[_0x6549('0x30')];if(_0xbbfdc9[_0x6549('0x32')]['includeAll']){_0x132625[_0x6549('0x48')]=[{'all':!![]}];}_0x132625=_[_0x6549('0x3f')]({},_0x132625,_0xbbfdc9[_0x6549('0x49')]);return db[_0x6549('0x2b')][_0x6549('0x4a')](_0x132625)['then'](handleEntityNotFound(_0x4deaab,null))['then'](respondWithResult(_0x4deaab,null))[_0x6549('0x43')](handleError(_0x4deaab,null));};exports[_0x6549('0x4b')]=function(_0x41d675,_0x1712f3){return db[_0x6549('0x2b')]['create'](_0x41d675[_0x6549('0x4c')],{})[_0x6549('0x26')](respondWithResult(_0x1712f3,0xc9))[_0x6549('0x43')](handleError(_0x1712f3,null));};exports[_0x6549('0x25')]=function(_0xa4c650,_0x25a6ee){if(_0xa4c650[_0x6549('0x4c')]['id']){delete _0xa4c650[_0x6549('0x4c')]['id'];}return db['Integration'][_0x6549('0x4a')]({'where':{'id':_0xa4c650['params']['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x25a6ee,null))[_0x6549('0x26')](saveUpdates(_0xa4c650[_0x6549('0x4c')],null))['then'](respondWithResult(_0x25a6ee,null))[_0x6549('0x43')](handleError(_0x25a6ee,null));};exports[_0x6549('0x4d')]=function(_0x2ef4d2,_0x5300c8){return db[_0x6549('0x2b')][_0x6549('0x4a')]({'where':{'id':_0x2ef4d2[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x5300c8,null))[_0x6549('0x26')](removeEntity(_0x5300c8,null))[_0x6549('0x43')](handleError(_0x5300c8,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index c599681..c8e5383 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 _0xbeea=['lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./integration.attributes','exports','define','Integration','integrations'];(function(_0x11adbd,_0x5055f5){var _0x270029=function(_0x25feb6){while(--_0x25feb6){_0x11adbd['push'](_0x11adbd['shift']());}};_0x270029(++_0x5055f5);}(_0xbeea,0x1e0));var _0xabee=function(_0x3331f8,_0x492685){_0x3331f8=_0x3331f8-0x0;var _0x422f06=_0xbeea[_0x3331f8];return _0x422f06;};'use strict';var _=require(_0xabee('0x0'));var util=require('util');var logger=require(_0xabee('0x1'))(_0xabee('0x2'));var moment=require('moment');var BPromise=require(_0xabee('0x3'));var rp=require(_0xabee('0x4'));var fs=require('fs');var path=require(_0xabee('0x5'));var rimraf=require('rimraf');var config=require(_0xabee('0x6'));var attributes=require(_0xabee('0x7'));module[_0xabee('0x8')]=function(_0x3b1bbf,_0x3f7daa){return _0x3b1bbf[_0xabee('0x9')](_0xabee('0xa'),attributes,{'tableName':_0xabee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ecf=['integrations','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./integration.attributes','exports','define'];(function(_0xa43d10,_0x536153){var _0x20a6fb=function(_0x36e3ab){while(--_0x36e3ab){_0xa43d10['push'](_0xa43d10['shift']());}};_0x20a6fb(++_0x536153);}(_0x2ecf,0x191));var _0xf2ec=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x2ecf[_0x543084];return _0x306a57;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf2ec('0x0'))(_0xf2ec('0x1'));var moment=require('moment');var BPromise=require(_0xf2ec('0x2'));var rp=require(_0xf2ec('0x3'));var fs=require('fs');var path=require(_0xf2ec('0x4'));var rimraf=require('rimraf');var config=require(_0xf2ec('0x5'));var attributes=require(_0xf2ec('0x6'));module[_0xf2ec('0x7')]=function(_0x51b57d,_0x131c3f){return _0x51b57d[_0xf2ec('0x8')]('Integration',attributes,{'tableName':_0xf2ec('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 1d309db..fa5f1ee 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 _0x896e=['Integration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x195fbb,_0x3e7933){var _0x6c5304=function(_0x124714){while(--_0x124714){_0x195fbb['push'](_0x195fbb['shift']());}};_0x6c5304(++_0x3e7933);}(_0x896e,0x1e9));var _0xe896=function(_0x3e019b,_0x328930){_0x3e019b=_0x3e019b-0x0;var _0x53a307=_0x896e[_0x3e019b];return _0x53a307;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7a0721,_0x3b902c,_0x264eeb){return new BPromise(function(_0x43c619,_0x5a1909){return client[_0xe896('0xd')](_0x7a0721,_0x264eeb)[_0xe896('0xe')](function(_0x37a90d){logger['info'](_0xe896('0xf'),_0x3b902c,'request\x20sent');logger[_0xe896('0x10')]('Integration,\x20%s,\x20%s,\x20%s',_0x3b902c,_0xe896('0x11'),JSON[_0xe896('0x12')](_0x37a90d));if(_0x37a90d[_0xe896('0x13')]){if(_0x37a90d['error'][_0xe896('0x14')]===0x1f4){logger[_0xe896('0x13')](_0xe896('0xf'),_0x3b902c,_0x37a90d['error'][_0xe896('0x15')]);return _0x5a1909(_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);}logger['error'](_0xe896('0xf'),_0x3b902c,_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);return _0x43c619(_0x37a90d['error']['message']);}else{logger[_0xe896('0x16')](_0xe896('0xf'),_0x3b902c,'request\x20sent');_0x43c619(_0x37a90d['result'][_0xe896('0x15')]);}})[_0xe896('0x17')](function(_0x57f04b){logger[_0xe896('0x13')]('Integration,\x20%s,\x20%s',_0x3b902c,_0x57f04b);_0x5a1909(_0x57f04b);});});} \ No newline at end of file +var _0xd943=['info','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','Integration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x1542b7,_0x38d80f){var _0x4e3b4c=function(_0x3e8cd8){while(--_0x3e8cd8){_0x1542b7['push'](_0x1542b7['shift']());}};_0x4e3b4c(++_0x38d80f);}(_0xd943,0x15d));var _0x3d94=function(_0xe5c2c3,_0x5c6ffe){_0xe5c2c3=_0xe5c2c3-0x0;var _0x17848b=_0xd943[_0xe5c2c3];return _0x17848b;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('Integration,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index c00e3e4..01fbfa4 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 _0x2542=['put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x116c5e,_0x5e6c7b){var _0x5cb2d5=function(_0xb305bb){while(--_0xb305bb){_0x116c5e['push'](_0x116c5e['shift']());}};_0x5cb2d5(++_0x5e6c7b);}(_0x2542,0x169));var _0x2254=function(_0x3430f2,_0x2bf10e){_0x3430f2=_0x3430f2-0x0;var _0xf3c036=_0x2542[_0x3430f2];return _0xf3c036;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2254('0x5'));var interaction=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var controller=require(_0x2254('0x8'));router[_0x2254('0x9')]('/',auth['isAuthenticated'](),controller[_0x2254('0xa')]);router[_0x2254('0x9')](_0x2254('0xb'),auth[_0x2254('0xc')](),controller[_0x2254('0xd')]);router[_0x2254('0x9')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0xf')]);router[_0x2254('0x10')]('/',auth[_0x2254('0xc')](),controller['create']);router[_0x2254('0x11')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0x12')]);router['delete']('/:id',auth[_0x2254('0xc')](),controller[_0x2254('0x13')]);module[_0x2254('0x14')]=router; \ No newline at end of file +var _0xc6ac=['./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x554918,_0x26aff4){var _0x177fb8=function(_0x30347f){while(--_0x30347f){_0x554918['push'](_0x554918['shift']());}};_0x177fb8(++_0x26aff4);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x79beb1,_0x520fc6){_0x79beb1=_0x79beb1-0x0;var _0x8f078c=_0xc6ac[_0x79beb1];return _0x8f078c;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var fs_extra=require(_0xcc6a('0x6'));var auth=require(_0xcc6a('0x7'));var interaction=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var controller=require(_0xcc6a('0xa'));router[_0xcc6a('0xb')]('/',auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xd')]);router['get'](_0xcc6a('0xe'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xf')]);router['get'](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x11')]);router[_0xcc6a('0x12')]('/',auth[_0xcc6a('0xc')](),controller['create']);router[_0xcc6a('0x13')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller['update']);router[_0xcc6a('0x14')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 23b6be6..3553aa9 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 _0x83f1=['SENDING','RECEIVED','FAILED','STRING','DATE','INTEGER','BOOLEAN','TEXT','ENUM','SENT'];(function(_0x55dff6,_0x22eaf6){var _0x2b23d5=function(_0xf411d){while(--_0xf411d){_0x55dff6['push'](_0x55dff6['shift']());}};_0x2b23d5(++_0x22eaf6);}(_0x83f1,0x17f));var _0x183f=function(_0x5fd2e5,_0x43367b){_0x5fd2e5=_0x5fd2e5-0x0;var _0x4d09d7=_0x83f1[_0x5fd2e5];return _0x4d09d7;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize[_0x183f('0x0')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x183f('0x0')]},'ticketId':{'type':Sequelize[_0x183f('0x0')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x183f('0x0')]},'calleridname':{'type':Sequelize[_0x183f('0x0')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x183f('0x0')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x183f('0x1')]},'holdtime':{'type':Sequelize[_0x183f('0x2')]},'agentcomplete':{'type':Sequelize[_0x183f('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x183f('0x1')]},'talktime':{'type':Sequelize[_0x183f('0x2')]},'agentacw':{'type':Sequelize[_0x183f('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x183f('0x2')]},'reason':{'type':Sequelize[_0x183f('0x0')]},'agentringnoanswer':{'type':Sequelize[_0x183f('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x183f('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x183f('0x0')]},'channel':{'type':Sequelize[_0x183f('0x0')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x183f('0x0')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x183f('0x0')]},'language':{'type':Sequelize[_0x183f('0x0')]},'accountcode':{'type':Sequelize[_0x183f('0x0')]},'context':{'type':Sequelize[_0x183f('0x0')]},'exten':{'type':Sequelize[_0x183f('0x0')]},'priority':{'type':Sequelize[_0x183f('0x0')]},'destchannel':{'type':Sequelize[_0x183f('0x0')]},'destchannelstate':{'type':Sequelize[_0x183f('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x183f('0x0')]},'destcalleridnum':{'type':Sequelize[_0x183f('0x0')]},'destcalleridname':{'type':Sequelize[_0x183f('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0x183f('0x0')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x183f('0x0')]},'destaccountcode':{'type':Sequelize[_0x183f('0x0')]},'destcontext':{'type':Sequelize[_0x183f('0x0')]},'destexten':{'type':Sequelize[_0x183f('0x0')]},'destpriority':{'type':Sequelize[_0x183f('0x0')]},'destuniqueid':{'type':Sequelize[_0x183f('0x0')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x183f('0x0')]},'subject':{'type':Sequelize[_0x183f('0x0')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x183f('0x0')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x183f('0x4')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x183f('0x5')](_0x183f('0x6'),_0x183f('0x7'),_0x183f('0x8'),_0x183f('0x9'))},'url':{'type':Sequelize[_0x183f('0x0')]},'app':{'type':Sequelize[_0x183f('0x0')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x4399=['DATE','BOOLEAN','TEXT','ENUM','SENT','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER'];(function(_0x33242d,_0x87cb3c){var _0x430967=function(_0x70920d){while(--_0x70920d){_0x33242d['push'](_0x33242d['shift']());}};_0x430967(++_0x87cb3c);}(_0x4399,0x13b));var _0x9439=function(_0x1c6230,_0x37c771){_0x1c6230=_0x1c6230-0x0;var _0x1419c5=_0x4399[_0x1c6230];return _0x1419c5;};'use strict';var Sequelize=require(_0x9439('0x0'));module[_0x9439('0x1')]={'integration':{'type':Sequelize[_0x9439('0x2')]},'eventChannel':{'type':Sequelize[_0x9439('0x2')]},'exitStatus':{'type':Sequelize[_0x9439('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x9439('0x3')]},'contacts':{'type':Sequelize[_0x9439('0x2')]},'uniqueid':{'type':Sequelize[_0x9439('0x2')]},'calleridnum':{'type':Sequelize[_0x9439('0x2')]},'calleridname':{'type':Sequelize[_0x9439('0x2')]},'queue':{'type':Sequelize[_0x9439('0x2')]},'interface':{'type':Sequelize[_0x9439('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x9439('0x4')]},'holdtime':{'type':Sequelize[_0x9439('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x9439('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x9439('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x9439('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x9439('0x4')]},'agentdump':{'type':Sequelize[_0x9439('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x9439('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x9439('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x9439('0x2')]},'connectedlinenum':{'type':Sequelize[_0x9439('0x2')]},'connectedlinename':{'type':Sequelize[_0x9439('0x2')]},'language':{'type':Sequelize[_0x9439('0x2')]},'accountcode':{'type':Sequelize[_0x9439('0x2')]},'context':{'type':Sequelize[_0x9439('0x2')]},'exten':{'type':Sequelize[_0x9439('0x2')]},'priority':{'type':Sequelize[_0x9439('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x9439('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x9439('0x2')]},'destcalleridname':{'type':Sequelize[_0x9439('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x9439('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x9439('0x2')]},'destaccountcode':{'type':Sequelize[_0x9439('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x9439('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x9439('0x2')]},'inReplyTo':{'type':Sequelize[_0x9439('0x2')]},'subject':{'type':Sequelize[_0x9439('0x2')]},'from':{'type':Sequelize[_0x9439('0x2')]},'to':{'type':Sequelize[_0x9439('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x9439('0x6')]},'html':{'type':Sequelize[_0x9439('0x6')]},'text':{'type':Sequelize[_0x9439('0x6')]},'status':{'type':Sequelize[_0x9439('0x7')](_0x9439('0x8'),'SENDING',_0x9439('0x9'),_0x9439('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x9439('0x2')]},'projectId':{'type':Sequelize[_0x9439('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index d4aa458..bbc161e 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 _0xd988=['findAll','rows','params','find','catch','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','offset','limit','count','status','Content-Range','json','save','update','then','destroy','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x5ca999,_0x357796){var _0x17b97c=function(_0x55c0c6){while(--_0x55c0c6){_0x5ca999['push'](_0x5ca999['shift']());}};_0x17b97c(++_0x357796);}(_0xd988,0xe0));var _0x8d98=function(_0x56f15d,_0x28f21e){_0x56f15d=_0x56f15d-0x0;var _0x1c3a56=_0xd988[_0x56f15d];return _0x1c3a56;};'use strict';var emlformat=require(_0x8d98('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8d98('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8d98('0x2'));var moment=require(_0x8d98('0x3'));var BPromise=require(_0x8d98('0x4'));var Mustache=require(_0x8d98('0x5'));var util=require(_0x8d98('0x6'));var path=require(_0x8d98('0x7'));var sox=require(_0x8d98('0x8'));var csv=require(_0x8d98('0x9'));var ejs=require(_0x8d98('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8d98('0xb'));var squel=require(_0x8d98('0xc'));var crypto=require('crypto');var jsforce=require(_0x8d98('0xd'));var deskjs=require(_0x8d98('0xe'));var toCsv=require(_0x8d98('0x9'));var querystring=require(_0x8d98('0xf'));var Papa=require(_0x8d98('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8d98('0x11'));var as=require(_0x8d98('0x12'));var hardwareService=require(_0x8d98('0x13'));var logger=require(_0x8d98('0x14'))(_0x8d98('0x15'));var utils=require(_0x8d98('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8d98('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x380f64,_0x34b69c){_0x34b69c=_0x34b69c||0xcc;return function(_0x40221f){if(_0x40221f){return _0x380f64[_0x8d98('0x18')](_0x34b69c);}return _0x380f64['status'](_0x34b69c)[_0x8d98('0x19')]();};}function respondWithResult(_0x3fa106,_0x44adaa){_0x44adaa=_0x44adaa||0xc8;return function(_0xce2c75){if(_0xce2c75){return _0x3fa106['status'](_0x44adaa)['json'](_0xce2c75);}};}function respondWithFilteredResult(_0x4855d0,_0x404873){return function(_0x50196b){if(_0x50196b){var _0x36d634=typeof _0x404873[_0x8d98('0x1a')]==='undefined'&&typeof _0x404873[_0x8d98('0x1b')]==='undefined';var _0x1bdf4c=_0x50196b[_0x8d98('0x1c')];var _0x31f538=_0x36d634?0x0:_0x404873[_0x8d98('0x1a')];var _0x22003e=_0x36d634?_0x50196b[_0x8d98('0x1c')]:_0x404873['offset']+_0x404873[_0x8d98('0x1b')];var _0x55dbf7;if(_0x22003e>=_0x1bdf4c){_0x22003e=_0x1bdf4c;_0x55dbf7=0xc8;}else{_0x55dbf7=0xce;}_0x4855d0[_0x8d98('0x1d')](_0x55dbf7);return _0x4855d0['set'](_0x8d98('0x1e'),_0x31f538+'-'+_0x22003e+'/'+_0x1bdf4c)[_0x8d98('0x1f')](_0x50196b);}return null;};}function patchUpdates(_0x260706){return function(_0x516dba){try{jsonpatch['apply'](_0x516dba,_0x260706,!![]);}catch(_0x4d528d){return BPromise['reject'](_0x4d528d);}return _0x516dba[_0x8d98('0x20')]();};}function saveUpdates(_0x2215e8,_0x4024a0){return function(_0x166bc9){if(_0x166bc9){return _0x166bc9[_0x8d98('0x21')](_0x2215e8)[_0x8d98('0x22')](function(_0x2fb86a){return _0x2fb86a;});}return null;};}function removeEntity(_0x2a20a2,_0x369e85){return function(_0x585897){if(_0x585897){return _0x585897[_0x8d98('0x23')]()[_0x8d98('0x22')](function(){_0x2a20a2[_0x8d98('0x1d')](0xcc)[_0x8d98('0x19')]();});}};}function handleEntityNotFound(_0x4efc18,_0xc7fc88){return function(_0x464e08){if(!_0x464e08){_0x4efc18[_0x8d98('0x18')](0x194);}return _0x464e08;};}function handleError(_0x1ca3ad,_0x292018){_0x292018=_0x292018||0x1f4;return function(_0x5219cc){logger[_0x8d98('0x24')](_0x5219cc[_0x8d98('0x25')]);if(_0x5219cc['name']){delete _0x5219cc[_0x8d98('0x26')];}_0x1ca3ad[_0x8d98('0x1d')](_0x292018)[_0x8d98('0x27')](_0x5219cc);};}exports[_0x8d98('0x28')]=function(_0x373494,_0x1ada51){var _0x4ac04b={},_0x2dd8e4={},_0x50c438={'count':0x0,'rows':[]};var _0x58eb5b=_[_0x8d98('0x29')](db[_0x8d98('0x2a')][_0x8d98('0x2b')],function(_0x286f0c){return{'name':_0x286f0c[_0x8d98('0x2c')],'type':_0x286f0c['type']['key']};});_0x2dd8e4[_0x8d98('0x2d')]=_[_0x8d98('0x29')](_0x58eb5b,_0x8d98('0x26'));_0x2dd8e4[_0x8d98('0x2e')]=_[_0x8d98('0x2f')](_0x373494[_0x8d98('0x2e')]);_0x2dd8e4[_0x8d98('0x30')]=_[_0x8d98('0x31')](_0x2dd8e4[_0x8d98('0x2d')],_0x2dd8e4[_0x8d98('0x2e')]);_0x4ac04b[_0x8d98('0x32')]=_[_0x8d98('0x31')](_0x2dd8e4[_0x8d98('0x2d')],qs['fields'](_0x373494[_0x8d98('0x2e')][_0x8d98('0x33')]));_0x4ac04b[_0x8d98('0x32')]=_0x4ac04b[_0x8d98('0x32')][_0x8d98('0x34')]?_0x4ac04b[_0x8d98('0x32')]:_0x2dd8e4['model'];if(!_0x373494[_0x8d98('0x2e')][_0x8d98('0x35')](_0x8d98('0x36'))){_0x4ac04b[_0x8d98('0x1b')]=qs['limit'](_0x373494[_0x8d98('0x2e')][_0x8d98('0x1b')]);_0x4ac04b[_0x8d98('0x1a')]=qs[_0x8d98('0x1a')](_0x373494[_0x8d98('0x2e')][_0x8d98('0x1a')]);}_0x4ac04b[_0x8d98('0x37')]=qs[_0x8d98('0x38')](_0x373494[_0x8d98('0x2e')]['sort']);_0x4ac04b[_0x8d98('0x39')]=qs[_0x8d98('0x30')](_['pick'](_0x373494[_0x8d98('0x2e')],_0x2dd8e4[_0x8d98('0x30')]),_0x58eb5b);if(_0x373494[_0x8d98('0x2e')][_0x8d98('0x3a')]){_0x4ac04b[_0x8d98('0x39')]=_[_0x8d98('0x3b')](_0x4ac04b[_0x8d98('0x39')],{'$or':_[_0x8d98('0x29')](_0x58eb5b,function(_0x400cdc){if(_0x400cdc['type']!==_0x8d98('0x3c')){var _0x307673={};_0x307673[_0x400cdc['name']]={'$like':'%'+_0x373494[_0x8d98('0x2e')]['filter']+'%'};return _0x307673;}})});}_0x4ac04b=_[_0x8d98('0x3b')]({},_0x4ac04b,_0x373494[_0x8d98('0x3d')]);var _0x3c3384={'where':_0x4ac04b[_0x8d98('0x39')]};return db['IntegrationReport'][_0x8d98('0x1c')](_0x3c3384)[_0x8d98('0x22')](function(_0x5b762f){_0x50c438[_0x8d98('0x1c')]=_0x5b762f;if(_0x373494[_0x8d98('0x2e')][_0x8d98('0x3e')]){_0x4ac04b[_0x8d98('0x3f')]=[{'all':!![]}];}return db[_0x8d98('0x2a')][_0x8d98('0x40')](_0x4ac04b);})['then'](function(_0x1429c4){_0x50c438[_0x8d98('0x41')]=_0x1429c4;return _0x50c438;})[_0x8d98('0x22')](respondWithFilteredResult(_0x1ada51,_0x4ac04b))['catch'](handleError(_0x1ada51,null));};exports['show']=function(_0x3f80d9,_0x395fe1){var _0x5a7341={'raw':![],'where':{'id':_0x3f80d9[_0x8d98('0x42')]['id']}},_0x50c2b0={};_0x50c2b0[_0x8d98('0x2d')]=_[_0x8d98('0x2f')](db['IntegrationReport'][_0x8d98('0x2b')]);_0x50c2b0['query']=_[_0x8d98('0x2f')](_0x3f80d9[_0x8d98('0x2e')]);_0x50c2b0[_0x8d98('0x30')]=_[_0x8d98('0x31')](_0x50c2b0[_0x8d98('0x2d')],_0x50c2b0[_0x8d98('0x2e')]);_0x5a7341[_0x8d98('0x32')]=_[_0x8d98('0x31')](_0x50c2b0['model'],qs[_0x8d98('0x33')](_0x3f80d9['query'][_0x8d98('0x33')]));_0x5a7341[_0x8d98('0x32')]=_0x5a7341[_0x8d98('0x32')]['length']?_0x5a7341[_0x8d98('0x32')]:_0x50c2b0[_0x8d98('0x2d')];if(_0x3f80d9[_0x8d98('0x2e')][_0x8d98('0x3e')]){_0x5a7341[_0x8d98('0x3f')]=[{'all':!![]}];}_0x5a7341=_['merge']({},_0x5a7341,_0x3f80d9[_0x8d98('0x3d')]);return db[_0x8d98('0x2a')][_0x8d98('0x43')](_0x5a7341)[_0x8d98('0x22')](handleEntityNotFound(_0x395fe1,null))['then'](respondWithResult(_0x395fe1,null))[_0x8d98('0x44')](handleError(_0x395fe1,null));};exports[_0x8d98('0x45')]=function(_0x4c51b5,_0x550cbb){return db[_0x8d98('0x2a')][_0x8d98('0x45')](_0x4c51b5[_0x8d98('0x46')],{})[_0x8d98('0x22')](respondWithResult(_0x550cbb,0xc9))[_0x8d98('0x44')](handleError(_0x550cbb,null));};exports['update']=function(_0x38f8a1,_0x3ad7df){if(_0x38f8a1['body']['id']){delete _0x38f8a1[_0x8d98('0x46')]['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x38f8a1['params']['id']}})[_0x8d98('0x22')](handleEntityNotFound(_0x3ad7df,null))[_0x8d98('0x22')](saveUpdates(_0x38f8a1[_0x8d98('0x46')],null))[_0x8d98('0x22')](respondWithResult(_0x3ad7df,null))[_0x8d98('0x44')](handleError(_0x3ad7df,null));};exports[_0x8d98('0x23')]=function(_0x15bd4d,_0x8f55b0){return db[_0x8d98('0x2a')]['find']({'where':{'id':_0x15bd4d[_0x8d98('0x42')]['id']}})[_0x8d98('0x22')](handleEntityNotFound(_0x8f55b0,null))[_0x8d98('0x22')](removeEntity(_0x8f55b0,null))[_0x8d98('0x44')](handleError(_0x8f55b0,null));};exports[_0x8d98('0x47')]=function(_0x3ce2d4,_0x504aaf){return db[_0x8d98('0x2a')][_0x8d98('0x47')]()['then'](respondWithResult(_0x504aaf,null))[_0x8d98('0x44')](handleError(_0x504aaf,null));}; \ No newline at end of file +var _0x6fcb=['set','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','send','map','IntegrationReport','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','include','findAll','rows','catch','length','includeAll','options','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','end','status','json','offset','undefined','count','limit'];(function(_0x356005,_0x411466){var _0x2bb35b=function(_0x449cfb){while(--_0x449cfb){_0x356005['push'](_0x356005['shift']());}};_0x2bb35b(++_0x411466);}(_0x6fcb,0x1a3));var _0xb6fc=function(_0x4a55ee,_0x1ef0b2){_0x4a55ee=_0x4a55ee-0x0;var _0x52eb4a=_0x6fcb[_0x4a55ee];return _0x52eb4a;};'use strict';var emlformat=require(_0xb6fc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb6fc('0x1'));var jsonpatch=require(_0xb6fc('0x2'));var rp=require(_0xb6fc('0x3'));var moment=require(_0xb6fc('0x4'));var BPromise=require(_0xb6fc('0x5'));var Mustache=require(_0xb6fc('0x6'));var util=require(_0xb6fc('0x7'));var path=require(_0xb6fc('0x8'));var sox=require(_0xb6fc('0x9'));var csv=require(_0xb6fc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb6fc('0xb'));var _=require('lodash');var squel=require(_0xb6fc('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb6fc('0xd'));var toCsv=require(_0xb6fc('0xa'));var querystring=require(_0xb6fc('0xe'));var Papa=require(_0xb6fc('0xf'));var Redis=require(_0xb6fc('0x10'));var authService=require(_0xb6fc('0x11'));var qs=require(_0xb6fc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb6fc('0x13'));var logger=require(_0xb6fc('0x14'))(_0xb6fc('0x15'));var utils=require(_0xb6fc('0x16'));var config=require(_0xb6fc('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x225db4,_0x5aa512){_0x5aa512=_0x5aa512||0xcc;return function(_0x5dd188){if(_0x5dd188){return _0x225db4['sendStatus'](_0x5aa512);}return _0x225db4['status'](_0x5aa512)[_0xb6fc('0x18')]();};}function respondWithResult(_0x3af1cc,_0x40c25e){_0x40c25e=_0x40c25e||0xc8;return function(_0x1db737){if(_0x1db737){return _0x3af1cc[_0xb6fc('0x19')](_0x40c25e)[_0xb6fc('0x1a')](_0x1db737);}};}function respondWithFilteredResult(_0x1cc219,_0x688970){return function(_0x185322){if(_0x185322){var _0x927f92=typeof _0x688970[_0xb6fc('0x1b')]===_0xb6fc('0x1c')&&typeof _0x688970['limit']==='undefined';var _0x2dc7c6=_0x185322[_0xb6fc('0x1d')];var _0x3be35d=_0x927f92?0x0:_0x688970['offset'];var _0x43b509=_0x927f92?_0x185322[_0xb6fc('0x1d')]:_0x688970['offset']+_0x688970[_0xb6fc('0x1e')];var _0x57b947;if(_0x43b509>=_0x2dc7c6){_0x43b509=_0x2dc7c6;_0x57b947=0xc8;}else{_0x57b947=0xce;}_0x1cc219[_0xb6fc('0x19')](_0x57b947);return _0x1cc219[_0xb6fc('0x1f')](_0xb6fc('0x20'),_0x3be35d+'-'+_0x43b509+'/'+_0x2dc7c6)[_0xb6fc('0x1a')](_0x185322);}return null;};}function patchUpdates(_0x480a57){return function(_0x2707b8){try{jsonpatch['apply'](_0x2707b8,_0x480a57,!![]);}catch(_0x3e2835){return BPromise[_0xb6fc('0x21')](_0x3e2835);}return _0x2707b8[_0xb6fc('0x22')]();};}function saveUpdates(_0x32134e,_0x22ce46){return function(_0x2436f9){if(_0x2436f9){return _0x2436f9[_0xb6fc('0x23')](_0x32134e)['then'](function(_0x1027e8){return _0x1027e8;});}return null;};}function removeEntity(_0x137745,_0x1611f8){return function(_0x130ce9){if(_0x130ce9){return _0x130ce9[_0xb6fc('0x24')]()[_0xb6fc('0x25')](function(){_0x137745[_0xb6fc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26de35,_0x43e6e8){return function(_0x2dd59e){if(!_0x2dd59e){_0x26de35[_0xb6fc('0x26')](0x194);}return _0x2dd59e;};}function handleError(_0x306d61,_0x484884){_0x484884=_0x484884||0x1f4;return function(_0x192a63){logger[_0xb6fc('0x27')](_0x192a63[_0xb6fc('0x28')]);if(_0x192a63[_0xb6fc('0x29')]){delete _0x192a63['name'];}_0x306d61[_0xb6fc('0x19')](_0x484884)[_0xb6fc('0x2a')](_0x192a63);};}exports['index']=function(_0x1c1a28,_0x283a75){var _0x303807={},_0x44e5c5={},_0x26fa5a={'count':0x0,'rows':[]};var _0x3250e4=_[_0xb6fc('0x2b')](db[_0xb6fc('0x2c')][_0xb6fc('0x2d')],function(_0x496eaa){return{'name':_0x496eaa[_0xb6fc('0x2e')],'type':_0x496eaa['type'][_0xb6fc('0x2f')]};});_0x44e5c5[_0xb6fc('0x30')]=_['map'](_0x3250e4,_0xb6fc('0x29'));_0x44e5c5['query']=_[_0xb6fc('0x31')](_0x1c1a28[_0xb6fc('0x32')]);_0x44e5c5[_0xb6fc('0x33')]=_['intersection'](_0x44e5c5['model'],_0x44e5c5[_0xb6fc('0x32')]);_0x303807[_0xb6fc('0x34')]=_[_0xb6fc('0x35')](_0x44e5c5[_0xb6fc('0x30')],qs['fields'](_0x1c1a28[_0xb6fc('0x32')][_0xb6fc('0x36')]));_0x303807[_0xb6fc('0x34')]=_0x303807['attributes']['length']?_0x303807[_0xb6fc('0x34')]:_0x44e5c5[_0xb6fc('0x30')];if(!_0x1c1a28[_0xb6fc('0x32')][_0xb6fc('0x37')](_0xb6fc('0x38'))){_0x303807[_0xb6fc('0x1e')]=qs['limit'](_0x1c1a28[_0xb6fc('0x32')]['limit']);_0x303807['offset']=qs['offset'](_0x1c1a28[_0xb6fc('0x32')][_0xb6fc('0x1b')]);}_0x303807[_0xb6fc('0x39')]=qs[_0xb6fc('0x3a')](_0x1c1a28[_0xb6fc('0x32')][_0xb6fc('0x3a')]);_0x303807['where']=qs[_0xb6fc('0x33')](_['pick'](_0x1c1a28[_0xb6fc('0x32')],_0x44e5c5[_0xb6fc('0x33')]),_0x3250e4);if(_0x1c1a28[_0xb6fc('0x32')][_0xb6fc('0x3b')]){_0x303807[_0xb6fc('0x3c')]=_[_0xb6fc('0x3d')](_0x303807[_0xb6fc('0x3c')],{'$or':_[_0xb6fc('0x2b')](_0x3250e4,function(_0x8599e9){if(_0x8599e9[_0xb6fc('0x3e')]!=='VIRTUAL'){var _0x2e77cd={};_0x2e77cd[_0x8599e9['name']]={'$like':'%'+_0x1c1a28['query']['filter']+'%'};return _0x2e77cd;}})});}_0x303807=_[_0xb6fc('0x3d')]({},_0x303807,_0x1c1a28['options']);var _0x338050={'where':_0x303807['where']};return db['IntegrationReport'][_0xb6fc('0x1d')](_0x338050)['then'](function(_0x287588){_0x26fa5a['count']=_0x287588;if(_0x1c1a28['query']['includeAll']){_0x303807[_0xb6fc('0x3f')]=[{'all':!![]}];}return db['IntegrationReport'][_0xb6fc('0x40')](_0x303807);})[_0xb6fc('0x25')](function(_0x21e1c4){_0x26fa5a[_0xb6fc('0x41')]=_0x21e1c4;return _0x26fa5a;})[_0xb6fc('0x25')](respondWithFilteredResult(_0x283a75,_0x303807))[_0xb6fc('0x42')](handleError(_0x283a75,null));};exports['show']=function(_0x546bba,_0x2b69b9){var _0x197287={'raw':![],'where':{'id':_0x546bba['params']['id']}},_0x319b1b={};_0x319b1b[_0xb6fc('0x30')]=_[_0xb6fc('0x31')](db['IntegrationReport'][_0xb6fc('0x2d')]);_0x319b1b['query']=_['keys'](_0x546bba[_0xb6fc('0x32')]);_0x319b1b['filters']=_['intersection'](_0x319b1b['model'],_0x319b1b[_0xb6fc('0x32')]);_0x197287[_0xb6fc('0x34')]=_[_0xb6fc('0x35')](_0x319b1b[_0xb6fc('0x30')],qs[_0xb6fc('0x36')](_0x546bba[_0xb6fc('0x32')][_0xb6fc('0x36')]));_0x197287[_0xb6fc('0x34')]=_0x197287[_0xb6fc('0x34')][_0xb6fc('0x43')]?_0x197287[_0xb6fc('0x34')]:_0x319b1b[_0xb6fc('0x30')];if(_0x546bba['query'][_0xb6fc('0x44')]){_0x197287[_0xb6fc('0x3f')]=[{'all':!![]}];}_0x197287=_[_0xb6fc('0x3d')]({},_0x197287,_0x546bba[_0xb6fc('0x45')]);return db[_0xb6fc('0x2c')][_0xb6fc('0x46')](_0x197287)[_0xb6fc('0x25')](handleEntityNotFound(_0x2b69b9,null))['then'](respondWithResult(_0x2b69b9,null))[_0xb6fc('0x42')](handleError(_0x2b69b9,null));};exports[_0xb6fc('0x47')]=function(_0x477a06,_0xa21ba7){return db[_0xb6fc('0x2c')][_0xb6fc('0x47')](_0x477a06['body'],{})[_0xb6fc('0x25')](respondWithResult(_0xa21ba7,0xc9))[_0xb6fc('0x42')](handleError(_0xa21ba7,null));};exports[_0xb6fc('0x23')]=function(_0x4b6d5f,_0x446a5d){if(_0x4b6d5f['body']['id']){delete _0x4b6d5f[_0xb6fc('0x48')]['id'];}return db[_0xb6fc('0x2c')][_0xb6fc('0x46')]({'where':{'id':_0x4b6d5f[_0xb6fc('0x49')]['id']}})['then'](handleEntityNotFound(_0x446a5d,null))[_0xb6fc('0x25')](saveUpdates(_0x4b6d5f[_0xb6fc('0x48')],null))[_0xb6fc('0x25')](respondWithResult(_0x446a5d,null))[_0xb6fc('0x42')](handleError(_0x446a5d,null));};exports[_0xb6fc('0x24')]=function(_0x57d3a0,_0x2d6a85){return db[_0xb6fc('0x2c')]['find']({'where':{'id':_0x57d3a0[_0xb6fc('0x49')]['id']}})[_0xb6fc('0x25')](handleEntityNotFound(_0x2d6a85,null))[_0xb6fc('0x25')](removeEntity(_0x2d6a85,null))[_0xb6fc('0x42')](handleError(_0x2d6a85,null));};exports[_0xb6fc('0x4a')]=function(_0x1187b0,_0x8540fc){return db[_0xb6fc('0x2c')][_0xb6fc('0x4a')]()['then'](respondWithResult(_0x8540fc,null))['catch'](handleError(_0x8540fc,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index b880490..251aa90 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 _0x650a=['./integrationReport.attributes','exports','IntegrationReport','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x4403a8,_0x5a8205){var _0x345a84=function(_0x4b9b61){while(--_0x4b9b61){_0x4403a8['push'](_0x4403a8['shift']());}};_0x345a84(++_0x5a8205);}(_0x650a,0x99));var _0xa650=function(_0x40d4bf,_0x2faffb){_0x40d4bf=_0x40d4bf-0x0;var _0x1a890e=_0x650a[_0x40d4bf];return _0x1a890e;};'use strict';var _=require('lodash');var util=require(_0xa650('0x0'));var logger=require(_0xa650('0x1'))(_0xa650('0x2'));var moment=require(_0xa650('0x3'));var BPromise=require(_0xa650('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa650('0x5'));var rimraf=require(_0xa650('0x6'));var config=require('../../config/environment');var attributes=require(_0xa650('0x7'));module[_0xa650('0x8')]=function(_0x139fdb,_0x2287e4){return _0x139fdb['define'](_0xa650('0x9'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b73=['IntegrationReport','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','define'];(function(_0x47bb4f,_0x502052){var _0xd853ab=function(_0x5adcc2){while(--_0x5adcc2){_0x47bb4f['push'](_0x47bb4f['shift']());}};_0xd853ab(++_0x502052);}(_0x0b73,0xb5));var _0x30b7=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x0b73[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0x30b7('0x0'));var util=require(_0x30b7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x30b7('0x2'));var BPromise=require('bluebird');var rp=require(_0x30b7('0x3'));var fs=require('fs');var path=require(_0x30b7('0x4'));var rimraf=require(_0x30b7('0x5'));var config=require(_0x30b7('0x6'));var attributes=require(_0x30b7('0x7'));module['exports']=function(_0x12f448,_0x2579b7){return _0x12f448[_0x30b7('0x8')](_0x30b7('0x9'),attributes,{'tableName':'report_integration','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 a2b4051..0b71910 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 _0x4819=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment'];(function(_0x56482e,_0x2b6c0e){var _0x9c5978=function(_0x511ef6){while(--_0x511ef6){_0x56482e['push'](_0x56482e['shift']());}};_0x9c5978(++_0x2b6c0e);}(_0x4819,0xcd));var _0x9481=function(_0x13e758,_0x317d23){_0x13e758=_0x13e758-0x0;var _0x5b53c3=_0x4819[_0x13e758];return _0x5b53c3;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var moment=require(_0x9481('0x1'));var BPromise=require(_0x9481('0x2'));var rs=require(_0x9481('0x3'));var fs=require('fs');var Redis=require(_0x9481('0x4'));var db=require(_0x9481('0x5'))['db'];var utils=require(_0x9481('0x6'));var logger=require(_0x9481('0x7'))(_0x9481('0x8'));var config=require(_0x9481('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9481('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54cc78,_0x14e05a,_0x6c6a08){return new BPromise(function(_0x27c033,_0x3278ff){return client[_0x9481('0xb')](_0x54cc78,_0x6c6a08)['then'](function(_0x1818cf){logger['info'](_0x9481('0xc'),_0x14e05a,'request\x20sent');logger[_0x9481('0xd')](_0x9481('0xe'),_0x14e05a,_0x9481('0xf'),JSON[_0x9481('0x10')](_0x1818cf));if(_0x1818cf[_0x9481('0x11')]){if(_0x1818cf[_0x9481('0x11')][_0x9481('0x12')]===0x1f4){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf['error']['message']);return _0x3278ff(_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);}logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);return _0x27c033(_0x1818cf[_0x9481('0x11')]['message']);}else{logger[_0x9481('0x14')](_0x9481('0xc'),_0x14e05a,'request\x20sent');_0x27c033(_0x1818cf[_0x9481('0x15')]['message']);}})[_0x9481('0x16')](function(_0x7a2ac8){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x7a2ac8);_0x3278ff(_0x7a2ac8);});});} \ No newline at end of file +var _0x57ca=['client','http','request','info','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','IntegrationReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1325d7,_0x1d93c8){var _0xd599ef=function(_0x12fd5a){while(--_0x12fd5a){_0x1325d7['push'](_0x1325d7['shift']());}};_0xd599ef(++_0x1d93c8);}(_0x57ca,0x108));var _0xa57c=function(_0x3acd5a,_0x18bb90){_0x3acd5a=_0x3acd5a-0x0;var _0x46f2a2=_0x57ca[_0x3acd5a];return _0x46f2a2;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 48d860a..e3cd2b1 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 _0x04cc=['/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','delete','/:id','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','show'];(function(_0x525b7b,_0x160ae7){var _0x5f2b1c=function(_0x1edaed){while(--_0x1edaed){_0x525b7b['push'](_0x525b7b['shift']());}};_0x5f2b1c(++_0x160ae7);}(_0x04cc,0x11a));var _0xc04c=function(_0x2534a0,_0xda89db){_0x2534a0=_0x2534a0-0x0;var _0x3209c0=_0x04cc[_0x2534a0];return _0x3209c0;};'use strict';var multer=require(_0xc04c('0x0'));var util=require(_0xc04c('0x1'));var path=require(_0xc04c('0x2'));var timeout=require(_0xc04c('0x3'));var express=require('express');var router=express[_0xc04c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc04c('0x5'));var config=require(_0xc04c('0x6'));var controller=require(_0xc04c('0x7'));router[_0xc04c('0x8')]('/',auth[_0xc04c('0x9')](),controller[_0xc04c('0xa')]);router[_0xc04c('0x8')]('/:id',auth[_0xc04c('0x9')](),controller[_0xc04c('0xb')]);router[_0xc04c('0x8')](_0xc04c('0xc'),auth[_0xc04c('0x9')](),controller[_0xc04c('0xd')]);router[_0xc04c('0xe')]('/',auth[_0xc04c('0x9')](),controller['create']);router['post'](_0xc04c('0xc'),auth[_0xc04c('0x9')](),controller[_0xc04c('0xf')]);router[_0xc04c('0xe')](_0xc04c('0x10'),auth[_0xc04c('0x9')](),controller[_0xc04c('0x11')]);router['put']('/:id',auth[_0xc04c('0x9')](),controller['update']);router[_0xc04c('0x12')](_0xc04c('0x13'),auth[_0xc04c('0x9')](),controller[_0xc04c('0x14')]);module['exports']=router; \ No newline at end of file +var _0x6439=['put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./interval.controller','isAuthenticated','index','show','/:id/sub_intervals','getIntervals','create','post','addInterval','/:id/sub_intervals/create_many','addIntervals'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x6439,0x1ce));var _0x9643=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x6439[_0x3c8e9a];return _0x2d4c57;};'use strict';var multer=require(_0x9643('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9643('0x1'));var express=require(_0x9643('0x2'));var router=express[_0x9643('0x3')]();var fs_extra=require(_0x9643('0x4'));var auth=require(_0x9643('0x5'));var interaction=require(_0x9643('0x6'));var config=require('../../config/environment');var controller=require(_0x9643('0x7'));router['get']('/',auth[_0x9643('0x8')](),controller[_0x9643('0x9')]);router['get']('/:id',auth[_0x9643('0x8')](),controller[_0x9643('0xa')]);router['get'](_0x9643('0xb'),auth[_0x9643('0x8')](),controller[_0x9643('0xc')]);router['post']('/',auth[_0x9643('0x8')](),controller[_0x9643('0xd')]);router[_0x9643('0xe')](_0x9643('0xb'),auth[_0x9643('0x8')](),controller[_0x9643('0xf')]);router[_0x9643('0xe')](_0x9643('0x10'),auth[_0x9643('0x8')](),controller[_0x9643('0x11')]);router[_0x9643('0x12')](_0x9643('0x13'),auth[_0x9643('0x8')](),controller[_0x9643('0x14')]);router[_0x9643('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x9643('0x16')]);module[_0x9643('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index a9cfde0..fef75c6 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 _0xd357=['exports','STRING','sequelize'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0xd357,0x167));var _0x7d35=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xd357[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x7d35('0x0'));module[_0x7d35('0x1')]={'name':{'type':Sequelize[_0x7d35('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7d35('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x3afb=['STRING','exports'];(function(_0x12c2fe,_0x340166){var _0x5572d4=function(_0x45f0f5){while(--_0x45f0f5){_0x12c2fe['push'](_0x12c2fe['shift']());}};_0x5572d4(++_0x340166);}(_0x3afb,0xaf));var _0xb3af=function(_0x14fad0,_0x278d75){_0x14fad0=_0x14fad0-0x0;var _0x5c665f=_0x3afb[_0x14fad0];return _0x5c665f;};'use strict';var Sequelize=require('sequelize');module[_0xb3af('0x0')]={'name':{'type':Sequelize[_0xb3af('0x1')]},'description':{'type':Sequelize[_0xb3af('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 559c07c..953f621 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 _0xdc37=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','Interval','includeAll','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','findOne','map','getIntervals','nolimit','addIntervals','IntervalId','bulkCreate','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x310aa1,_0xf62068){var _0x3a1287=function(_0xd68780){while(--_0xd68780){_0x310aa1['push'](_0x310aa1['shift']());}};_0x3a1287(++_0xf62068);}(_0xdc37,0x162));var _0x7dc3=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0xdc37[_0x3430aa];return _0x2ac5c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7dc3('0x0'));var jsonpatch=require(_0x7dc3('0x1'));var rp=require(_0x7dc3('0x2'));var moment=require(_0x7dc3('0x3'));var BPromise=require(_0x7dc3('0x4'));var Mustache=require(_0x7dc3('0x5'));var util=require(_0x7dc3('0x6'));var path=require(_0x7dc3('0x7'));var sox=require(_0x7dc3('0x8'));var csv=require(_0x7dc3('0x9'));var ejs=require(_0x7dc3('0xa'));var fs=require('fs');var fs_extra=require(_0x7dc3('0xb'));var _=require(_0x7dc3('0xc'));var squel=require(_0x7dc3('0xd'));var crypto=require(_0x7dc3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7dc3('0x9'));var querystring=require(_0x7dc3('0xf'));var Papa=require(_0x7dc3('0x10'));var Redis=require(_0x7dc3('0x11'));var authService=require(_0x7dc3('0x12'));var qs=require(_0x7dc3('0x13'));var as=require(_0x7dc3('0x14'));var hardwareService=require(_0x7dc3('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x7dc3('0x16'));var config=require(_0x7dc3('0x17'));var licenseUtil=require(_0x7dc3('0x18'));var db=require(_0x7dc3('0x19'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0xc39ab6,_0x1c579f){_0x1c579f=_0x1c579f||0xcc;return function(_0x10bfac){if(_0x10bfac){return _0xc39ab6[_0x7dc3('0x1a')](_0x1c579f);}return _0xc39ab6[_0x7dc3('0x1b')](_0x1c579f)[_0x7dc3('0x1c')]();};}function respondWithResult(_0x620558,_0x1afb24){_0x1afb24=_0x1afb24||0xc8;return function(_0x26f815){if(_0x26f815){return _0x620558[_0x7dc3('0x1b')](_0x1afb24)[_0x7dc3('0x1d')](_0x26f815);}};}function respondWithFilteredResult(_0x1aac8d,_0x3a182b){return function(_0x810d38){if(_0x810d38){var _0x5c8776=typeof _0x3a182b[_0x7dc3('0x1e')]===_0x7dc3('0x1f')&&typeof _0x3a182b[_0x7dc3('0x20')]===_0x7dc3('0x1f');var _0x3e6ef3=_0x810d38['count'];var _0x406cf0=_0x5c8776?0x0:_0x3a182b[_0x7dc3('0x1e')];var _0x575851=_0x5c8776?_0x810d38[_0x7dc3('0x21')]:_0x3a182b[_0x7dc3('0x1e')]+_0x3a182b['limit'];var _0x492d32;if(_0x575851>=_0x3e6ef3){_0x575851=_0x3e6ef3;_0x492d32=0xc8;}else{_0x492d32=0xce;}_0x1aac8d[_0x7dc3('0x1b')](_0x492d32);return _0x1aac8d[_0x7dc3('0x22')](_0x7dc3('0x23'),_0x406cf0+'-'+_0x575851+'/'+_0x3e6ef3)[_0x7dc3('0x1d')](_0x810d38);}return null;};}function patchUpdates(_0x563a1d){return function(_0x4b1d4e){try{jsonpatch[_0x7dc3('0x24')](_0x4b1d4e,_0x563a1d,!![]);}catch(_0x5c360b){return BPromise[_0x7dc3('0x25')](_0x5c360b);}return _0x4b1d4e[_0x7dc3('0x26')]();};}function saveUpdates(_0x450a0d,_0x57f94a){return function(_0x32e1eb){if(_0x32e1eb){return _0x32e1eb[_0x7dc3('0x27')](_0x450a0d)[_0x7dc3('0x28')](function(_0x654e18){return _0x654e18;});}return null;};}function removeEntity(_0x4a4307,_0x30dd8e){return function(_0x149a5f){if(_0x149a5f){return _0x149a5f[_0x7dc3('0x29')]()[_0x7dc3('0x28')](function(){var _0xc6544b=_0x149a5f[_0x7dc3('0x2a')]({'plain':!![]});var _0xb7b438='Intervals';return db[_0x7dc3('0x2b')]['destroy']({'where':{'type':_0xb7b438,'resourceId':_0xc6544b['id']}})[_0x7dc3('0x28')](function(){return _0x149a5f;});})[_0x7dc3('0x28')](function(){_0x4a4307[_0x7dc3('0x1b')](0xcc)[_0x7dc3('0x1c')]();});}};}function handleEntityNotFound(_0x1e1a6a,_0x5b0ebd){return function(_0x4387b9){if(!_0x4387b9){_0x1e1a6a[_0x7dc3('0x1a')](0x194);}return _0x4387b9;};}function handleError(_0x2835a7,_0x34e779){_0x34e779=_0x34e779||0x1f4;return function(_0x21fc50){logger[_0x7dc3('0x2c')](_0x21fc50[_0x7dc3('0x2d')]);if(_0x21fc50[_0x7dc3('0x2e')]){delete _0x21fc50['name'];}_0x2835a7[_0x7dc3('0x1b')](_0x34e779)[_0x7dc3('0x2f')](_0x21fc50);};}exports[_0x7dc3('0x30')]=function(_0x5da7e5,_0x9f6466){var _0x25a986={},_0x5e346a={},_0xd1be21={'count':0x0,'rows':[]};var _0x2197cb=_['map'](db['Interval']['rawAttributes'],function(_0x3e34c2){return{'name':_0x3e34c2[_0x7dc3('0x31')],'type':_0x3e34c2[_0x7dc3('0x32')]['key']};});_0x5e346a[_0x7dc3('0x33')]=_['map'](_0x2197cb,_0x7dc3('0x2e'));_0x5e346a[_0x7dc3('0x34')]=_[_0x7dc3('0x35')](_0x5da7e5[_0x7dc3('0x34')]);_0x5e346a[_0x7dc3('0x36')]=_['intersection'](_0x5e346a[_0x7dc3('0x33')],_0x5e346a[_0x7dc3('0x34')]);_0x25a986['attributes']=_[_0x7dc3('0x37')](_0x5e346a['model'],qs[_0x7dc3('0x38')](_0x5da7e5['query'][_0x7dc3('0x38')]));_0x25a986['attributes']=_0x25a986[_0x7dc3('0x39')]['length']?_0x25a986[_0x7dc3('0x39')]:_0x5e346a['model'];if(!_0x5da7e5[_0x7dc3('0x34')][_0x7dc3('0x3a')]('nolimit')){_0x25a986[_0x7dc3('0x20')]=qs[_0x7dc3('0x20')](_0x5da7e5[_0x7dc3('0x34')][_0x7dc3('0x20')]);_0x25a986[_0x7dc3('0x1e')]=qs[_0x7dc3('0x1e')](_0x5da7e5[_0x7dc3('0x34')][_0x7dc3('0x1e')]);}_0x25a986[_0x7dc3('0x3b')]=qs[_0x7dc3('0x3c')](_0x5da7e5[_0x7dc3('0x34')][_0x7dc3('0x3c')]);_0x25a986[_0x7dc3('0x3d')]=qs['filters'](_[_0x7dc3('0x3e')](_0x5da7e5['query'],_0x5e346a[_0x7dc3('0x36')]),_0x2197cb);if(_0x5da7e5['query'][_0x7dc3('0x3f')]){_0x25a986[_0x7dc3('0x3d')]=_['merge'](_0x25a986[_0x7dc3('0x3d')],{'$or':_['map'](_0x2197cb,function(_0x2603b6){if(_0x2603b6[_0x7dc3('0x32')]!==_0x7dc3('0x40')){var _0x3e5af5={};_0x3e5af5[_0x2603b6[_0x7dc3('0x2e')]]={'$like':'%'+_0x5da7e5[_0x7dc3('0x34')][_0x7dc3('0x3f')]+'%'};return _0x3e5af5;}})});}_0x25a986=_[_0x7dc3('0x41')]({},_0x25a986,_0x5da7e5[_0x7dc3('0x42')]);var _0xfeb740={'where':_0x25a986[_0x7dc3('0x3d')]};return db[_0x7dc3('0x43')]['count'](_0xfeb740)['then'](function(_0x1e0ba7){_0xd1be21[_0x7dc3('0x21')]=_0x1e0ba7;if(_0x5da7e5['query'][_0x7dc3('0x44')]){_0x25a986['include']=[{'all':!![]}];}return db['Interval'][_0x7dc3('0x45')](_0x25a986);})[_0x7dc3('0x28')](function(_0x4d5858){_0xd1be21[_0x7dc3('0x46')]=_0x4d5858;return _0xd1be21;})[_0x7dc3('0x28')](respondWithFilteredResult(_0x9f6466,_0x25a986))[_0x7dc3('0x47')](handleError(_0x9f6466,null));};exports[_0x7dc3('0x48')]=function(_0x57774e,_0x2f17a1){var _0xbe397a={'raw':!![],'where':{'id':_0x57774e[_0x7dc3('0x49')]['id']}},_0x3d1037={};_0x3d1037['model']=_['keys'](db[_0x7dc3('0x43')][_0x7dc3('0x4a')]);_0x3d1037[_0x7dc3('0x34')]=_[_0x7dc3('0x35')](_0x57774e[_0x7dc3('0x34')]);_0x3d1037[_0x7dc3('0x36')]=_['intersection'](_0x3d1037[_0x7dc3('0x33')],_0x3d1037[_0x7dc3('0x34')]);_0xbe397a[_0x7dc3('0x39')]=_['intersection'](_0x3d1037['model'],qs[_0x7dc3('0x38')](_0x57774e[_0x7dc3('0x34')][_0x7dc3('0x38')]));_0xbe397a[_0x7dc3('0x39')]=_0xbe397a['attributes'][_0x7dc3('0x4b')]?_0xbe397a[_0x7dc3('0x39')]:_0x3d1037[_0x7dc3('0x33')];if(_0x57774e[_0x7dc3('0x34')]['includeAll']){_0xbe397a['include']=[{'all':!![]}];}_0xbe397a=_[_0x7dc3('0x41')]({},_0xbe397a,_0x57774e['options']);return db[_0x7dc3('0x43')][_0x7dc3('0x4c')](_0xbe397a)[_0x7dc3('0x28')](handleEntityNotFound(_0x2f17a1,null))[_0x7dc3('0x28')](respondWithResult(_0x2f17a1,null))['catch'](handleError(_0x2f17a1,null));};exports['create']=function(_0x162cb6,_0x54115b){return db[_0x7dc3('0x43')][_0x7dc3('0x4d')](_0x162cb6[_0x7dc3('0x4e')],{})['then'](function(_0x4f06fa){var _0x1a4e67=_0x162cb6[_0x7dc3('0x4f')][_0x7dc3('0x2a')]({'plain':!![]});if(!_0x1a4e67)throw new Error(_0x7dc3('0x50'));if(_0x1a4e67[_0x7dc3('0x51')]===_0x7dc3('0x4f')){var _0x5043f5=_0x4f06fa[_0x7dc3('0x2a')]({'plain':!![]});var _0x3b0e2e=_0x7dc3('0x52');return db[_0x7dc3('0x53')][_0x7dc3('0x4c')]({'where':{'name':_0x3b0e2e,'userProfileId':_0x1a4e67[_0x7dc3('0x54')]},'raw':!![]})[_0x7dc3('0x28')](function(_0x56c6cf){if(_0x56c6cf&&_0x56c6cf[_0x7dc3('0x55')]===0x0){return db['UserProfileResource'][_0x7dc3('0x4d')]({'name':_0x5043f5[_0x7dc3('0x2e')],'resourceId':_0x5043f5['id'],'type':_0x56c6cf[_0x7dc3('0x2e')],'sectionId':_0x56c6cf['id']},{})['then'](function(){return _0x4f06fa;});}else{return _0x4f06fa;}})['catch'](function(_0x3cc33){logger[_0x7dc3('0x2c')](_0x7dc3('0x56'),_0x3cc33);throw _0x3cc33;});}return _0x4f06fa;})[_0x7dc3('0x28')](respondWithResult(_0x54115b,0xc9))[_0x7dc3('0x47')](handleError(_0x54115b,null));};exports[_0x7dc3('0x27')]=function(_0x287b14,_0x59d314){if(_0x287b14[_0x7dc3('0x4e')]['id']){delete _0x287b14[_0x7dc3('0x4e')]['id'];}return db['Interval'][_0x7dc3('0x4c')]({'where':{'id':_0x287b14[_0x7dc3('0x49')]['id']}})[_0x7dc3('0x28')](handleEntityNotFound(_0x59d314,null))[_0x7dc3('0x28')](saveUpdates(_0x287b14[_0x7dc3('0x4e')],null))[_0x7dc3('0x28')](respondWithResult(_0x59d314,null))[_0x7dc3('0x47')](handleError(_0x59d314,null));};exports[_0x7dc3('0x29')]=function(_0x45dba7,_0x589338){return db[_0x7dc3('0x43')]['find']({'where':{'id':_0x45dba7[_0x7dc3('0x49')]['id']}})[_0x7dc3('0x28')](handleEntityNotFound(_0x589338,null))[_0x7dc3('0x28')](removeEntity(_0x589338,null))[_0x7dc3('0x47')](handleError(_0x589338,null));};exports[_0x7dc3('0x57')]=function(_0x396b18,_0xda81c8,_0x39ef86){if(_0x396b18['body']['id']){delete _0x396b18[_0x7dc3('0x4e')]['id'];}return db[_0x7dc3('0x43')][_0x7dc3('0x4c')]({'where':{'id':_0x396b18[_0x7dc3('0x49')]['id']}})[_0x7dc3('0x28')](handleEntityNotFound(_0xda81c8,null))[_0x7dc3('0x28')](function(_0x50a817){if(_0x50a817){_0x396b18[_0x7dc3('0x4e')]['IntervalId']=_0x50a817['id'];return db['Interval']['create'](_0x396b18['body']);}})[_0x7dc3('0x28')](respondWithResult(_0xda81c8,null))[_0x7dc3('0x47')](handleError(_0xda81c8,null));};exports['getIntervals']=function(_0x3eeac4,_0x75afc2,_0x519559){var _0x1c0718={};var _0x3916e6={};var _0x7ebdfa;var _0x55d5e7;return db['Interval'][_0x7dc3('0x58')]({'where':{'id':_0x3eeac4[_0x7dc3('0x49')]['id']}})[_0x7dc3('0x28')](handleEntityNotFound(_0x75afc2,null))['then'](function(_0x492b29){if(_0x492b29){_0x7ebdfa=_0x492b29;_0x3916e6['model']=_[_0x7dc3('0x35')](db['Interval'][_0x7dc3('0x4a')]);_0x3916e6[_0x7dc3('0x34')]=_[_0x7dc3('0x35')](_0x3eeac4['query']);_0x3916e6[_0x7dc3('0x36')]=_[_0x7dc3('0x37')](_0x3916e6[_0x7dc3('0x33')],_0x3916e6[_0x7dc3('0x34')]);_0x1c0718[_0x7dc3('0x39')]=_[_0x7dc3('0x37')](_0x3916e6[_0x7dc3('0x33')],qs[_0x7dc3('0x38')](_0x3eeac4[_0x7dc3('0x34')][_0x7dc3('0x38')]));_0x1c0718['attributes']=_0x1c0718[_0x7dc3('0x39')][_0x7dc3('0x4b')]?_0x1c0718[_0x7dc3('0x39')]:_0x3916e6[_0x7dc3('0x33')];_0x1c0718[_0x7dc3('0x3b')]=qs[_0x7dc3('0x3c')](_0x3eeac4[_0x7dc3('0x34')][_0x7dc3('0x3c')]);_0x1c0718[_0x7dc3('0x3d')]=qs[_0x7dc3('0x36')](_[_0x7dc3('0x3e')](_0x3eeac4[_0x7dc3('0x34')],_0x3916e6[_0x7dc3('0x36')]));if(_0x3eeac4[_0x7dc3('0x34')]['filter']){_0x1c0718[_0x7dc3('0x3d')]=_[_0x7dc3('0x41')](_0x1c0718[_0x7dc3('0x3d')],{'$or':_[_0x7dc3('0x59')](_0x1c0718[_0x7dc3('0x39')],function(_0x520bd1){var _0x2b4db6={};_0x2b4db6[_0x520bd1]={'$like':'%'+_0x3eeac4[_0x7dc3('0x34')][_0x7dc3('0x3f')]+'%'};return _0x2b4db6;})});}_0x1c0718=_[_0x7dc3('0x41')]({},_0x1c0718,_0x3eeac4[_0x7dc3('0x42')]);return _0x7ebdfa[_0x7dc3('0x5a')](_0x1c0718);}})[_0x7dc3('0x28')](function(_0x2ea091){if(_0x2ea091){_0x55d5e7=_0x2ea091[_0x7dc3('0x4b')];if(!_0x3eeac4[_0x7dc3('0x34')][_0x7dc3('0x3a')](_0x7dc3('0x5b'))){_0x1c0718['limit']=qs[_0x7dc3('0x20')](_0x3eeac4['query'][_0x7dc3('0x20')]);_0x1c0718['offset']=qs[_0x7dc3('0x1e')](_0x3eeac4[_0x7dc3('0x34')][_0x7dc3('0x1e')]);}return _0x7ebdfa['getIntervals'](_0x1c0718);}})[_0x7dc3('0x28')](function(_0x36c96f){if(_0x36c96f){return _0x36c96f?{'count':_0x55d5e7,'rows':_0x36c96f}:null;}})[_0x7dc3('0x28')](respondWithResult(_0x75afc2,null))['catch'](handleError(_0x75afc2,null));};exports[_0x7dc3('0x5c')]=function(_0x39d28d,_0x3e87d4,_0x4c2dcd){return db[_0x7dc3('0x43')][_0x7dc3('0x58')]({'where':{'id':_0x39d28d[_0x7dc3('0x49')]['id']}})['then'](handleEntityNotFound(_0x3e87d4,null))['then'](function(_0x422fbb){if(_0x422fbb){return db['sequelize']['transaction'](function(_0x2773a0){return db[_0x7dc3('0x43')][_0x7dc3('0x29')]({'where':{'IntervalId':_0x39d28d[_0x7dc3('0x49')]['id']},'transaction':_0x2773a0})[_0x7dc3('0x28')](function(_0x43e50d){var _0x3cd201=_[_0x7dc3('0x59')](_0x39d28d[_0x7dc3('0x4e')],function(_0x57bd59){delete _0x57bd59['id'];_0x57bd59[_0x7dc3('0x5d')]=_0x39d28d[_0x7dc3('0x49')]['id'];return _0x57bd59;});return db[_0x7dc3('0x43')][_0x7dc3('0x5e')](_0x3cd201,{'transaction':_0x2773a0});});})[_0x7dc3('0x28')](function(){return db[_0x7dc3('0x43')][_0x7dc3('0x45')]({'where':{'IntervalId':_0x39d28d[_0x7dc3('0x49')]['id']}});});}})[_0x7dc3('0x28')](respondWithResult(_0x3e87d4,null))[_0x7dc3('0x47')](handleError(_0x3e87d4,null));}; \ No newline at end of file +var _0xc807=['status','end','json','offset','undefined','limit','count','set','apply','save','then','destroy','get','Intervals','error','stack','send','Interval','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','findAll','rows','show','params','keys','includeAll','include','find','catch','create','user','role','UserProfileSection','userProfileId','autoAssociation','name','update','body','IntervalId','getIntervals','findOne','sequelize','transaction','bulkCreate','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus'];(function(_0x2a0738,_0x3c0bc5){var _0x159679=function(_0x9c9ec7){while(--_0x9c9ec7){_0x2a0738['push'](_0x2a0738['shift']());}};_0x159679(++_0x3c0bc5);}(_0xc807,0x1a0));var _0x7c80=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xc807[_0x50aa2e];return _0x5e07f0;};'use strict';var emlformat=require(_0x7c80('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7c80('0x1'));var rp=require('request-promise');var moment=require(_0x7c80('0x2'));var BPromise=require(_0x7c80('0x3'));var Mustache=require(_0x7c80('0x4'));var util=require('util');var path=require(_0x7c80('0x5'));var sox=require(_0x7c80('0x6'));var csv=require(_0x7c80('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7c80('0x8'));var _=require(_0x7c80('0x9'));var squel=require('squel');var crypto=require(_0x7c80('0xa'));var jsforce=require(_0x7c80('0xb'));var deskjs=require(_0x7c80('0xc'));var toCsv=require(_0x7c80('0x7'));var querystring=require(_0x7c80('0xd'));var Papa=require('papaparse');var Redis=require(_0x7c80('0xe'));var authService=require(_0x7c80('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7c80('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c80('0x11'))('api');var utils=require(_0x7c80('0x12'));var config=require(_0x7c80('0x13'));var licenseUtil=require(_0x7c80('0x14'));var db=require(_0x7c80('0x15'))['db'];var extensions=require(_0x7c80('0x16'));function respondWithStatusCode(_0x10d57e,_0x4079a1){_0x4079a1=_0x4079a1||0xcc;return function(_0x1388dd){if(_0x1388dd){return _0x10d57e[_0x7c80('0x17')](_0x4079a1);}return _0x10d57e[_0x7c80('0x18')](_0x4079a1)[_0x7c80('0x19')]();};}function respondWithResult(_0x5acde4,_0x334a7b){_0x334a7b=_0x334a7b||0xc8;return function(_0x29287f){if(_0x29287f){return _0x5acde4[_0x7c80('0x18')](_0x334a7b)[_0x7c80('0x1a')](_0x29287f);}};}function respondWithFilteredResult(_0x92f5ff,_0x57dc28){return function(_0x485aca){if(_0x485aca){var _0x395948=typeof _0x57dc28[_0x7c80('0x1b')]===_0x7c80('0x1c')&&typeof _0x57dc28[_0x7c80('0x1d')]===_0x7c80('0x1c');var _0x412b61=_0x485aca['count'];var _0x5433c6=_0x395948?0x0:_0x57dc28[_0x7c80('0x1b')];var _0x38f1b5=_0x395948?_0x485aca[_0x7c80('0x1e')]:_0x57dc28['offset']+_0x57dc28[_0x7c80('0x1d')];var _0x4b1608;if(_0x38f1b5>=_0x412b61){_0x38f1b5=_0x412b61;_0x4b1608=0xc8;}else{_0x4b1608=0xce;}_0x92f5ff[_0x7c80('0x18')](_0x4b1608);return _0x92f5ff[_0x7c80('0x1f')]('Content-Range',_0x5433c6+'-'+_0x38f1b5+'/'+_0x412b61)[_0x7c80('0x1a')](_0x485aca);}return null;};}function patchUpdates(_0x20af0e){return function(_0x51b144){try{jsonpatch[_0x7c80('0x20')](_0x51b144,_0x20af0e,!![]);}catch(_0x461634){return BPromise['reject'](_0x461634);}return _0x51b144[_0x7c80('0x21')]();};}function saveUpdates(_0x3330c6,_0x293f91){return function(_0x4b72e0){if(_0x4b72e0){return _0x4b72e0['update'](_0x3330c6)[_0x7c80('0x22')](function(_0x272f74){return _0x272f74;});}return null;};}function removeEntity(_0x535795,_0x4be59e){return function(_0x4b0ec5){if(_0x4b0ec5){return _0x4b0ec5[_0x7c80('0x23')]()['then'](function(){var _0xab09d7=_0x4b0ec5[_0x7c80('0x24')]({'plain':!![]});var _0x3752e8=_0x7c80('0x25');return db['UserProfileResource'][_0x7c80('0x23')]({'where':{'type':_0x3752e8,'resourceId':_0xab09d7['id']}})[_0x7c80('0x22')](function(){return _0x4b0ec5;});})[_0x7c80('0x22')](function(){_0x535795['status'](0xcc)[_0x7c80('0x19')]();});}};}function handleEntityNotFound(_0x17bc7d,_0x4208c4){return function(_0x2d1a2a){if(!_0x2d1a2a){_0x17bc7d[_0x7c80('0x17')](0x194);}return _0x2d1a2a;};}function handleError(_0x3a9995,_0x47448b){_0x47448b=_0x47448b||0x1f4;return function(_0x47faea){logger[_0x7c80('0x26')](_0x47faea[_0x7c80('0x27')]);if(_0x47faea['name']){delete _0x47faea['name'];}_0x3a9995[_0x7c80('0x18')](_0x47448b)[_0x7c80('0x28')](_0x47faea);};}exports['index']=function(_0x1be744,_0x26c3bf){var _0x5f2741={},_0x1b03bb={},_0x2ef0ee={'count':0x0,'rows':[]};var _0x3dfaa5=_['map'](db[_0x7c80('0x29')][_0x7c80('0x2a')],function(_0x503dd1){return{'name':_0x503dd1[_0x7c80('0x2b')],'type':_0x503dd1[_0x7c80('0x2c')][_0x7c80('0x2d')]};});_0x1b03bb[_0x7c80('0x2e')]=_[_0x7c80('0x2f')](_0x3dfaa5,'name');_0x1b03bb[_0x7c80('0x30')]=_['keys'](_0x1be744['query']);_0x1b03bb['filters']=_[_0x7c80('0x31')](_0x1b03bb[_0x7c80('0x2e')],_0x1b03bb[_0x7c80('0x30')]);_0x5f2741[_0x7c80('0x32')]=_[_0x7c80('0x31')](_0x1b03bb[_0x7c80('0x2e')],qs[_0x7c80('0x33')](_0x1be744['query'][_0x7c80('0x33')]));_0x5f2741[_0x7c80('0x32')]=_0x5f2741[_0x7c80('0x32')][_0x7c80('0x34')]?_0x5f2741['attributes']:_0x1b03bb['model'];if(!_0x1be744['query'][_0x7c80('0x35')](_0x7c80('0x36'))){_0x5f2741[_0x7c80('0x1d')]=qs[_0x7c80('0x1d')](_0x1be744[_0x7c80('0x30')][_0x7c80('0x1d')]);_0x5f2741[_0x7c80('0x1b')]=qs[_0x7c80('0x1b')](_0x1be744[_0x7c80('0x30')]['offset']);}_0x5f2741[_0x7c80('0x37')]=qs[_0x7c80('0x38')](_0x1be744[_0x7c80('0x30')]['sort']);_0x5f2741['where']=qs[_0x7c80('0x39')](_[_0x7c80('0x3a')](_0x1be744['query'],_0x1b03bb['filters']),_0x3dfaa5);if(_0x1be744[_0x7c80('0x30')][_0x7c80('0x3b')]){_0x5f2741[_0x7c80('0x3c')]=_[_0x7c80('0x3d')](_0x5f2741[_0x7c80('0x3c')],{'$or':_[_0x7c80('0x2f')](_0x3dfaa5,function(_0x499e49){if(_0x499e49[_0x7c80('0x2c')]!==_0x7c80('0x3e')){var _0x38a446={};_0x38a446[_0x499e49['name']]={'$like':'%'+_0x1be744[_0x7c80('0x30')]['filter']+'%'};return _0x38a446;}})});}_0x5f2741=_[_0x7c80('0x3d')]({},_0x5f2741,_0x1be744[_0x7c80('0x3f')]);var _0x11bf22={'where':_0x5f2741[_0x7c80('0x3c')]};return db[_0x7c80('0x29')][_0x7c80('0x1e')](_0x11bf22)[_0x7c80('0x22')](function(_0x6b284c){_0x2ef0ee[_0x7c80('0x1e')]=_0x6b284c;if(_0x1be744['query']['includeAll']){_0x5f2741['include']=[{'all':!![]}];}return db['Interval'][_0x7c80('0x40')](_0x5f2741);})[_0x7c80('0x22')](function(_0x1b84ad){_0x2ef0ee[_0x7c80('0x41')]=_0x1b84ad;return _0x2ef0ee;})[_0x7c80('0x22')](respondWithFilteredResult(_0x26c3bf,_0x5f2741))['catch'](handleError(_0x26c3bf,null));};exports[_0x7c80('0x42')]=function(_0x12dd9c,_0x9e5ee0){var _0x450b1f={'raw':!![],'where':{'id':_0x12dd9c[_0x7c80('0x43')]['id']}},_0xb41700={};_0xb41700[_0x7c80('0x2e')]=_[_0x7c80('0x44')](db[_0x7c80('0x29')][_0x7c80('0x2a')]);_0xb41700[_0x7c80('0x30')]=_[_0x7c80('0x44')](_0x12dd9c[_0x7c80('0x30')]);_0xb41700['filters']=_[_0x7c80('0x31')](_0xb41700['model'],_0xb41700[_0x7c80('0x30')]);_0x450b1f[_0x7c80('0x32')]=_[_0x7c80('0x31')](_0xb41700[_0x7c80('0x2e')],qs[_0x7c80('0x33')](_0x12dd9c['query'][_0x7c80('0x33')]));_0x450b1f[_0x7c80('0x32')]=_0x450b1f[_0x7c80('0x32')][_0x7c80('0x34')]?_0x450b1f[_0x7c80('0x32')]:_0xb41700[_0x7c80('0x2e')];if(_0x12dd9c[_0x7c80('0x30')][_0x7c80('0x45')]){_0x450b1f[_0x7c80('0x46')]=[{'all':!![]}];}_0x450b1f=_[_0x7c80('0x3d')]({},_0x450b1f,_0x12dd9c[_0x7c80('0x3f')]);return db[_0x7c80('0x29')][_0x7c80('0x47')](_0x450b1f)[_0x7c80('0x22')](handleEntityNotFound(_0x9e5ee0,null))[_0x7c80('0x22')](respondWithResult(_0x9e5ee0,null))[_0x7c80('0x48')](handleError(_0x9e5ee0,null));};exports[_0x7c80('0x49')]=function(_0x36c077,_0x1d716c){return db['Interval']['create'](_0x36c077['body'],{})[_0x7c80('0x22')](function(_0x19ab3b){var _0x350a6d=_0x36c077[_0x7c80('0x4a')][_0x7c80('0x24')]({'plain':!![]});if(!_0x350a6d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x350a6d[_0x7c80('0x4b')]===_0x7c80('0x4a')){var _0x4b2a28=_0x19ab3b['get']({'plain':!![]});var _0x46ba05=_0x7c80('0x25');return db[_0x7c80('0x4c')][_0x7c80('0x47')]({'where':{'name':_0x46ba05,'userProfileId':_0x350a6d[_0x7c80('0x4d')]},'raw':!![]})[_0x7c80('0x22')](function(_0x44a3d5){if(_0x44a3d5&&_0x44a3d5[_0x7c80('0x4e')]===0x0){return db['UserProfileResource'][_0x7c80('0x49')]({'name':_0x4b2a28[_0x7c80('0x4f')],'resourceId':_0x4b2a28['id'],'type':_0x44a3d5[_0x7c80('0x4f')],'sectionId':_0x44a3d5['id']},{})['then'](function(){return _0x19ab3b;});}else{return _0x19ab3b;}})[_0x7c80('0x48')](function(_0x59c57c){logger[_0x7c80('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59c57c);throw _0x59c57c;});}return _0x19ab3b;})['then'](respondWithResult(_0x1d716c,0xc9))['catch'](handleError(_0x1d716c,null));};exports[_0x7c80('0x50')]=function(_0x334ce1,_0x5e8c66){if(_0x334ce1[_0x7c80('0x51')]['id']){delete _0x334ce1[_0x7c80('0x51')]['id'];}return db[_0x7c80('0x29')][_0x7c80('0x47')]({'where':{'id':_0x334ce1[_0x7c80('0x43')]['id']}})[_0x7c80('0x22')](handleEntityNotFound(_0x5e8c66,null))['then'](saveUpdates(_0x334ce1[_0x7c80('0x51')],null))[_0x7c80('0x22')](respondWithResult(_0x5e8c66,null))['catch'](handleError(_0x5e8c66,null));};exports[_0x7c80('0x23')]=function(_0x329610,_0x3e5fdb){return db[_0x7c80('0x29')][_0x7c80('0x47')]({'where':{'id':_0x329610[_0x7c80('0x43')]['id']}})['then'](handleEntityNotFound(_0x3e5fdb,null))[_0x7c80('0x22')](removeEntity(_0x3e5fdb,null))[_0x7c80('0x48')](handleError(_0x3e5fdb,null));};exports['addInterval']=function(_0x20d450,_0x403425,_0x4da6b5){if(_0x20d450[_0x7c80('0x51')]['id']){delete _0x20d450[_0x7c80('0x51')]['id'];}return db['Interval'][_0x7c80('0x47')]({'where':{'id':_0x20d450[_0x7c80('0x43')]['id']}})[_0x7c80('0x22')](handleEntityNotFound(_0x403425,null))['then'](function(_0x1febd4){if(_0x1febd4){_0x20d450[_0x7c80('0x51')][_0x7c80('0x52')]=_0x1febd4['id'];return db['Interval'][_0x7c80('0x49')](_0x20d450['body']);}})[_0x7c80('0x22')](respondWithResult(_0x403425,null))['catch'](handleError(_0x403425,null));};exports[_0x7c80('0x53')]=function(_0x584215,_0x17d60f,_0x36f710){var _0x496c52={};var _0x3a65b1={};var _0x286d38;var _0x2795e8;return db[_0x7c80('0x29')]['findOne']({'where':{'id':_0x584215['params']['id']}})['then'](handleEntityNotFound(_0x17d60f,null))[_0x7c80('0x22')](function(_0x5255bd){if(_0x5255bd){_0x286d38=_0x5255bd;_0x3a65b1['model']=_[_0x7c80('0x44')](db[_0x7c80('0x29')][_0x7c80('0x2a')]);_0x3a65b1[_0x7c80('0x30')]=_['keys'](_0x584215[_0x7c80('0x30')]);_0x3a65b1[_0x7c80('0x39')]=_[_0x7c80('0x31')](_0x3a65b1[_0x7c80('0x2e')],_0x3a65b1[_0x7c80('0x30')]);_0x496c52[_0x7c80('0x32')]=_[_0x7c80('0x31')](_0x3a65b1['model'],qs[_0x7c80('0x33')](_0x584215[_0x7c80('0x30')][_0x7c80('0x33')]));_0x496c52[_0x7c80('0x32')]=_0x496c52[_0x7c80('0x32')]['length']?_0x496c52[_0x7c80('0x32')]:_0x3a65b1[_0x7c80('0x2e')];_0x496c52[_0x7c80('0x37')]=qs['sort'](_0x584215[_0x7c80('0x30')][_0x7c80('0x38')]);_0x496c52[_0x7c80('0x3c')]=qs[_0x7c80('0x39')](_[_0x7c80('0x3a')](_0x584215[_0x7c80('0x30')],_0x3a65b1[_0x7c80('0x39')]));if(_0x584215[_0x7c80('0x30')]['filter']){_0x496c52['where']=_[_0x7c80('0x3d')](_0x496c52[_0x7c80('0x3c')],{'$or':_['map'](_0x496c52[_0x7c80('0x32')],function(_0x597a5a){var _0x585bda={};_0x585bda[_0x597a5a]={'$like':'%'+_0x584215[_0x7c80('0x30')]['filter']+'%'};return _0x585bda;})});}_0x496c52=_[_0x7c80('0x3d')]({},_0x496c52,_0x584215[_0x7c80('0x3f')]);return _0x286d38[_0x7c80('0x53')](_0x496c52);}})[_0x7c80('0x22')](function(_0xcc0cf5){if(_0xcc0cf5){_0x2795e8=_0xcc0cf5[_0x7c80('0x34')];if(!_0x584215[_0x7c80('0x30')][_0x7c80('0x35')](_0x7c80('0x36'))){_0x496c52['limit']=qs[_0x7c80('0x1d')](_0x584215[_0x7c80('0x30')][_0x7c80('0x1d')]);_0x496c52[_0x7c80('0x1b')]=qs[_0x7c80('0x1b')](_0x584215[_0x7c80('0x30')]['offset']);}return _0x286d38['getIntervals'](_0x496c52);}})[_0x7c80('0x22')](function(_0x4c4d7b){if(_0x4c4d7b){return _0x4c4d7b?{'count':_0x2795e8,'rows':_0x4c4d7b}:null;}})[_0x7c80('0x22')](respondWithResult(_0x17d60f,null))[_0x7c80('0x48')](handleError(_0x17d60f,null));};exports['addIntervals']=function(_0x1b99b5,_0xf7794e,_0x1d3acf){return db['Interval'][_0x7c80('0x54')]({'where':{'id':_0x1b99b5[_0x7c80('0x43')]['id']}})['then'](handleEntityNotFound(_0xf7794e,null))[_0x7c80('0x22')](function(_0x56591c){if(_0x56591c){return db[_0x7c80('0x55')][_0x7c80('0x56')](function(_0x47042a){return db[_0x7c80('0x29')][_0x7c80('0x23')]({'where':{'IntervalId':_0x1b99b5[_0x7c80('0x43')]['id']},'transaction':_0x47042a})[_0x7c80('0x22')](function(_0x44e13e){var _0x4038fe=_[_0x7c80('0x2f')](_0x1b99b5[_0x7c80('0x51')],function(_0x3e940a){delete _0x3e940a['id'];_0x3e940a[_0x7c80('0x52')]=_0x1b99b5['params']['id'];return _0x3e940a;});return db['Interval'][_0x7c80('0x57')](_0x4038fe,{'transaction':_0x47042a});});})[_0x7c80('0x22')](function(){return db[_0x7c80('0x29')][_0x7c80('0x40')]({'where':{'IntervalId':_0x1b99b5[_0x7c80('0x43')]['id']}});});}})[_0x7c80('0x22')](respondWithResult(_0xf7794e,null))[_0x7c80('0x48')](handleError(_0xf7794e,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index ec722dc..add06ca 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 _0x13a5=['define','Interval','rewrite','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./interval.attributes','exports'];(function(_0x57de03,_0x1b6a5d){var _0x51c79c=function(_0x19d8f7){while(--_0x19d8f7){_0x57de03['push'](_0x57de03['shift']());}};_0x51c79c(++_0x1b6a5d);}(_0x13a5,0x13b));var _0x513a=function(_0x2678b8,_0x1fe1ea){_0x2678b8=_0x2678b8-0x0;var _0x4de0de=_0x13a5[_0x2678b8];return _0x4de0de;};'use strict';var _=require(_0x513a('0x0'));var util=require(_0x513a('0x1'));var logger=require('../../config/logger')(_0x513a('0x2'));var moment=require(_0x513a('0x3'));var BPromise=require(_0x513a('0x4'));var rp=require(_0x513a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x513a('0x6'));var config=require(_0x513a('0x7'));var attributes=require(_0x513a('0x8'));var extensions=require('../../components/extensions/rewrite');module[_0x513a('0x9')]=function(_0x235fc2,_0x1c925c){return _0x235fc2[_0x513a('0xa')](_0x513a('0xb'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x29fba3,_0x1016b0){extensions[_0x513a('0xc')](_0x235fc2,_0x29fba3);},'afterBulkCreate':function(_0x401245,_0x144fff,_0x150959){_0x150959();extensions[_0x513a('0xc')](_0x235fc2,_0x401245[0x0]);},'afterUpdate':function(_0x32dbae,_0x447357){extensions[_0x513a('0xc')](_0x235fc2,_0x32dbae);},'afterDestroy':function(_0x42b011,_0x23e3f7){extensions[_0x513a('0xc')](_0x235fc2,_0x42b011);}}});}; \ No newline at end of file +var _0x5fad=['exports','define','Interval','rewrite','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite'];(function(_0x4088c9,_0xf0400d){var _0x23bc59=function(_0x510928){while(--_0x510928){_0x4088c9['push'](_0x4088c9['shift']());}};_0x23bc59(++_0xf0400d);}(_0x5fad,0x12f));var _0xd5fa=function(_0x1bf839,_0x3c51a1){_0x1bf839=_0x1bf839-0x0;var _0x2ceb01=_0x5fad[_0x1bf839];return _0x2ceb01;};'use strict';var _=require(_0xd5fa('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd5fa('0x1'));var moment=require(_0xd5fa('0x2'));var BPromise=require('bluebird');var rp=require(_0xd5fa('0x3'));var fs=require('fs');var path=require(_0xd5fa('0x4'));var rimraf=require(_0xd5fa('0x5'));var config=require(_0xd5fa('0x6'));var attributes=require(_0xd5fa('0x7'));var extensions=require(_0xd5fa('0x8'));module[_0xd5fa('0x9')]=function(_0x4944b7,_0x5df3f6){return _0x4944b7[_0xd5fa('0xa')](_0xd5fa('0xb'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x152b03,_0x418f3d){extensions[_0xd5fa('0xc')](_0x4944b7,_0x152b03);},'afterBulkCreate':function(_0x12097d,_0x1ce8b6,_0x32a7e4){_0x32a7e4();extensions[_0xd5fa('0xc')](_0x4944b7,_0x12097d[0x0]);},'afterUpdate':function(_0x27350a,_0xb336f8){extensions['rewrite'](_0x4944b7,_0x27350a);},'afterDestroy':function(_0x505a54,_0x4e6c50){extensions[_0xd5fa('0xc')](_0x4944b7,_0x505a54);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index a841f20..9800f84 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(_0x519c88,_0xb84103){var _0x4668d7=function(_0x596c2c){while(--_0x596c2c){_0x519c88['push'](_0x519c88['shift']());}};_0x4668d7(++_0xb84103);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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(_0x49ad79,_0x48ee93){var _0xa4e38a=function(_0x4925c7){while(--_0x4925c7){_0x49ad79['push'](_0x49ad79['shift']());}};_0xa4e38a(++_0x48ee93);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 92b31c1..72aa5e2 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 _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0xdb0fed,_0xc01b61){var _0x151ed5=function(_0x2309f6){while(--_0x2309f6){_0xdb0fed['push'](_0xdb0fed['shift']());}};_0x151ed5(++_0xc01b61);}(_0xdb28,0x106));var _0x8db2=function(_0x3450eb,_0xf04eb1){_0x3450eb=_0x3450eb-0x0;var _0x19e7d3=_0xdb28[_0x3450eb];return _0x19e7d3;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file +var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x31c03f,_0x834eb5){var _0x159334=function(_0x259206){while(--_0x259206){_0x31c03f['push'](_0x31c03f['shift']());}};_0x159334(++_0x834eb5);}(_0xdb28,0x106));var _0x8db2=function(_0x293de0,_0x224358){_0x293de0=_0x293de0-0x0;var _0x39d14e=_0xdb28[_0x293de0];return _0x39d14e;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index aa38606..64421b9 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 _0xa4be=['../../config/logger','support','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','description','stringify','issuetype','Bug','customfield_11500','fields','customfield_11501','customfield_11502','newToken','customfield_11503','reason','track.xcallymotion.com','POST','application/json','toString','base64','request','setEncoding','utf8','status','statusCode','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','openIssue','send','body','x-forwarded-for','connection','socket','remoteAddress','https'];(function(_0x433cfe,_0x47ce1e){var _0x1843a8=function(_0x3685bb){while(--_0x3685bb){_0x433cfe['push'](_0x433cfe['shift']());}};_0x1843a8(++_0x47ce1e);}(_0xa4be,0xf5));var _0xea4b=function(_0x498ce7,_0x4ee6ff){_0x498ce7=_0x498ce7-0x0;var _0x304fbf=_0xa4be[_0x498ce7];return _0x304fbf;};'use strict';var BPromise=require('bluebird');var https=require(_0xea4b('0x0'));var logger=require(_0xea4b('0x1'))('api');var USERNAME=_0xea4b('0x2');var PASSWORD=_0xea4b('0x3');function openIssue(_0xf0b1e5,_0x47dbe8){var _0x22918a={'fields':{'project':{'key':_0xf0b1e5[_0xea4b('0x4')]||_0xea4b('0x5')},'summary':(_0xf0b1e5['summary']||_0xea4b('0x6'))+_0xea4b('0x7')+_0xf0b1e5['ip'],'description':_0xf0b1e5[_0xea4b('0x8')]||JSON[_0xea4b('0x9')](_0xf0b1e5),'issuetype':{'name':_0xf0b1e5[_0xea4b('0xa')]||_0xea4b('0xb')}}};_0x22918a['fields'][_0xea4b('0xc')]=_0xf0b1e5['email'];_0x22918a[_0xea4b('0xd')][_0xea4b('0xe')]=_0xf0b1e5['oldToken'];_0x22918a[_0xea4b('0xd')][_0xea4b('0xf')]=_0xf0b1e5[_0xea4b('0x10')];_0x22918a['fields'][_0xea4b('0x11')]=_0xf0b1e5['name'];_0x22918a[_0xea4b('0xd')]['customfield_11504']=_0xf0b1e5[_0xea4b('0x12')];_0x22918a['fields']['customfield_10102']=_0xf0b1e5['ip'];var _0xfaaabb={'host':_0xea4b('0x13'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xea4b('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0xea4b('0x15'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xea4b('0x16')](_0xea4b('0x17'))}};var _0x466a08=JSON['stringify'](_0x22918a);var _0x4cd554=https[_0xea4b('0x18')](_0xfaaabb,function(_0x466df4){_0x466df4[_0xea4b('0x19')](_0xea4b('0x1a'));var _0xfbfb41='';_0x466df4['on']('data',function(_0x48045d){_0xfbfb41+=_0x48045d;});_0x466df4['on']('end',function(){if(_0x47dbe8){return _0x47dbe8[_0xea4b('0x1b')](_0x466df4[_0xea4b('0x1c')])['json'](JSON['parse'](_0xfbfb41));}});});_0x4cd554['on']('error',function(_0x4a0dae){if(_0x47dbe8){return _0x47dbe8['status'](0x1f4)[_0xea4b('0x1d')]({'errors':[{'message':_0xea4b('0x1e'),'type':_0xea4b('0x1f')}]});}});_0x4cd554[_0xea4b('0x20')](_0x466a08);_0x4cd554[_0xea4b('0x21')]();}exports[_0xea4b('0x22')]=openIssue;exports[_0xea4b('0x23')]=function(_0x55adf9,_0x167917){_0x55adf9[_0xea4b('0x24')]['ip']=_0x55adf9['headers'][_0xea4b('0x25')]||_0x55adf9[_0xea4b('0x26')]['remoteAddress']||_0x55adf9['socket']['remoteAddress']||_0x55adf9[_0xea4b('0x26')][_0xea4b('0x27')][_0xea4b('0x28')];return openIssue(_0x55adf9['body'],_0x167917);}; \ No newline at end of file +var _0x011a=['base64','request','setEncoding','utf8','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','summary','Report','stringify','issuetype','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString'];(function(_0x34103e,_0x575c6c){var _0x2668c4=function(_0x304180){while(--_0x304180){_0x34103e['push'](_0x34103e['shift']());}};_0x2668c4(++_0x575c6c);}(_0x011a,0x6f));var _0xa011=function(_0x5352d0,_0x41e8b4){_0x5352d0=_0x5352d0-0x0;var _0x352b00=_0x011a[_0x5352d0];return _0x352b00;};'use strict';var BPromise=require(_0xa011('0x0'));var https=require(_0xa011('0x1'));var logger=require(_0xa011('0x2'))(_0xa011('0x3'));var USERNAME=_0xa011('0x4');var PASSWORD=_0xa011('0x5');function openIssue(_0x1000c7,_0x4f3dba){var _0x2773b7={'fields':{'project':{'key':_0x1000c7[_0xa011('0x6')]||'MOTGUI'},'summary':(_0x1000c7[_0xa011('0x7')]||_0xa011('0x8'))+'\x20from\x20'+_0x1000c7['ip'],'description':_0x1000c7['description']||JSON[_0xa011('0x9')](_0x1000c7),'issuetype':{'name':_0x1000c7[_0xa011('0xa')]||'Bug'}}};_0x2773b7[_0xa011('0xb')][_0xa011('0xc')]=_0x1000c7[_0xa011('0xd')];_0x2773b7[_0xa011('0xb')][_0xa011('0xe')]=_0x1000c7[_0xa011('0xf')];_0x2773b7[_0xa011('0xb')][_0xa011('0x10')]=_0x1000c7[_0xa011('0x11')];_0x2773b7['fields'][_0xa011('0x12')]=_0x1000c7[_0xa011('0x13')];_0x2773b7[_0xa011('0xb')]['customfield_11504']=_0x1000c7[_0xa011('0x14')];_0x2773b7['fields']['customfield_10102']=_0x1000c7['ip'];var _0x682b13={'host':_0xa011('0x15'),'port':0x1bb,'path':_0xa011('0x16'),'method':_0xa011('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0xa011('0x18'),'Authorization':_0xa011('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0xa011('0x1a')](_0xa011('0x1b'))}};var _0x548f41=JSON[_0xa011('0x9')](_0x2773b7);var _0x454fe3=https[_0xa011('0x1c')](_0x682b13,function(_0x5e219d){_0x5e219d[_0xa011('0x1d')](_0xa011('0x1e'));var _0x177be2='';_0x5e219d['on']('data',function(_0x2a019e){_0x177be2+=_0x2a019e;});_0x5e219d['on'](_0xa011('0x1f'),function(){if(_0x4f3dba){return _0x4f3dba[_0xa011('0x20')](_0x5e219d[_0xa011('0x21')])[_0xa011('0x22')](JSON[_0xa011('0x23')](_0x177be2));}});});_0x454fe3['on'](_0xa011('0x24'),function(_0x357e0e){if(_0x4f3dba){return _0x4f3dba[_0xa011('0x20')](0x1f4)[_0xa011('0x22')]({'errors':[{'message':_0xa011('0x25'),'type':_0xa011('0x26')}]});}});_0x454fe3[_0xa011('0x27')](_0x548f41);_0x454fe3['end']();}exports[_0xa011('0x28')]=openIssue;exports[_0xa011('0x29')]=function(_0x357063,_0x177fc8){_0x357063[_0xa011('0x2a')]['ip']=_0x357063[_0xa011('0x2b')]['x-forwarded-for']||_0x357063['connection'][_0xa011('0x2c')]||_0x357063[_0xa011('0x2d')][_0xa011('0x2c')]||_0x357063['connection']['socket'][_0xa011('0x2c')];return openIssue(_0x357063[_0xa011('0x2a')],_0x177fc8);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index d89a1c7..a230ac3 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 _0x99e9=['update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put'];(function(_0x295abe,_0x3a10b3){var _0x41f594=function(_0x585e74){while(--_0x585e74){_0x295abe['push'](_0x295abe['shift']());}};_0x41f594(++_0x3a10b3);}(_0x99e9,0xb4));var _0x999e=function(_0x200827,_0x4af951){_0x200827=_0x200827-0x0;var _0x120047=_0x99e9[_0x200827];return _0x120047;};'use strict';var multer=require('multer');var util=require(_0x999e('0x0'));var path=require(_0x999e('0x1'));var timeout=require(_0x999e('0x2'));var express=require(_0x999e('0x3'));var router=express['Router']();var fs_extra=require(_0x999e('0x4'));var auth=require(_0x999e('0x5'));var interaction=require(_0x999e('0x6'));var config=require('../../config/environment');var controller=require(_0x999e('0x7'));router['get']('/',auth[_0x999e('0x8')](),controller[_0x999e('0x9')]);router[_0x999e('0xa')](_0x999e('0xb'),auth['isAuthenticated'](),controller[_0x999e('0xc')]);router[_0x999e('0xa')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0xe')]);router[_0x999e('0xf')]('/',auth[_0x999e('0x8')](),controller[_0x999e('0x10')]);router[_0x999e('0x11')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0x12')]);router[_0x999e('0x13')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0x14')]);module[_0x999e('0x15')]=router; \ No newline at end of file +var _0x153f=['Router','fs-extra','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2c6256,_0x59df1d){var _0x105063=function(_0x57dcf4){while(--_0x57dcf4){_0x2c6256['push'](_0x2c6256['shift']());}};_0x105063(++_0x59df1d);}(_0x153f,0x15b));var _0xf153=function(_0x385fe6,_0x5de4fb){_0x385fe6=_0x385fe6-0x0;var _0x27c5a9=_0x153f[_0x385fe6];return _0x27c5a9;};'use strict';var multer=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var path=require(_0xf153('0x2'));var timeout=require(_0xf153('0x3'));var express=require(_0xf153('0x4'));var router=express[_0xf153('0x5')]();var fs_extra=require(_0xf153('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf153('0x7'));var config=require('../../config/environment');var controller=require(_0xf153('0x8'));router[_0xf153('0x9')]('/',auth[_0xf153('0xa')](),controller[_0xf153('0xb')]);router[_0xf153('0x9')]('/describe',auth[_0xf153('0xa')](),controller[_0xf153('0xc')]);router[_0xf153('0x9')](_0xf153('0xd'),auth[_0xf153('0xa')](),controller[_0xf153('0xe')]);router[_0xf153('0xf')]('/',auth[_0xf153('0xa')](),controller[_0xf153('0x10')]);router[_0xf153('0x11')]('/:id',auth[_0xf153('0xa')](),controller[_0xf153('0x12')]);router[_0xf153('0x13')]('/:id',auth[_0xf153('0xa')](),controller[_0xf153('0x14')]);module[_0xf153('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 36ade5c..c5034db 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(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x7a54,0x106));var _0x47a5=function(_0x482d74,_0x346096){_0x482d74=_0x482d74-0x0;var _0x22f3e1=_0x7a54[_0x482d74];return _0x22f3e1;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7a54,0x106));var _0x47a5=function(_0x2a47b6,_0x2c020a){_0x2a47b6=_0x2a47b6-0x0;var _0x3f589f=_0x7a54[_0x2a47b6];return _0x3f589f;};'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 a28ccdd..7b28680 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 _0x4b19=['model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','end','error','name','index','map','JscriptyAnswerReport','fieldName','key'];(function(_0x1b502e,_0x147c80){var _0x544f60=function(_0x264d35){while(--_0x264d35){_0x1b502e['push'](_0x1b502e['shift']());}};_0x544f60(++_0x147c80);}(_0x4b19,0x195));var _0x94b1=function(_0x31f94d,_0x97563){_0x31f94d=_0x31f94d-0x0;var _0xca77c0=_0x4b19[_0x31f94d];return _0xca77c0;};'use strict';var emlformat=require(_0x94b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x94b1('0x1'));var jsonpatch=require(_0x94b1('0x2'));var rp=require(_0x94b1('0x3'));var moment=require('moment');var BPromise=require(_0x94b1('0x4'));var Mustache=require(_0x94b1('0x5'));var util=require(_0x94b1('0x6'));var path=require('path');var sox=require(_0x94b1('0x7'));var csv=require(_0x94b1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x94b1('0x9'));var _=require(_0x94b1('0xa'));var squel=require('squel');var crypto=require(_0x94b1('0xb'));var jsforce=require(_0x94b1('0xc'));var deskjs=require(_0x94b1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x94b1('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x94b1('0xf'));var qs=require(_0x94b1('0x10'));var as=require(_0x94b1('0x11'));var hardwareService=require(_0x94b1('0x12'));var logger=require(_0x94b1('0x13'))(_0x94b1('0x14'));var utils=require('../../config/utils');var config=require(_0x94b1('0x15'));var licenseUtil=require(_0x94b1('0x16'));var db=require(_0x94b1('0x17'))['db'];function respondWithStatusCode(_0x2b378c,_0x5cbf96){_0x5cbf96=_0x5cbf96||0xcc;return function(_0x4a4fe6){if(_0x4a4fe6){return _0x2b378c[_0x94b1('0x18')](_0x5cbf96);}return _0x2b378c[_0x94b1('0x19')](_0x5cbf96)['end']();};}function respondWithResult(_0x5059d8,_0x9329c9){_0x9329c9=_0x9329c9||0xc8;return function(_0xb9924c){if(_0xb9924c){return _0x5059d8['status'](_0x9329c9)[_0x94b1('0x1a')](_0xb9924c);}};}function respondWithFilteredResult(_0x58fab3,_0x4ea6a4){return function(_0x192c03){if(_0x192c03){var _0x1f0560=typeof _0x4ea6a4[_0x94b1('0x1b')]===_0x94b1('0x1c')&&typeof _0x4ea6a4['limit']===_0x94b1('0x1c');var _0x424c45=_0x192c03[_0x94b1('0x1d')];var _0x224099=_0x1f0560?0x0:_0x4ea6a4[_0x94b1('0x1b')];var _0x1abb7f=_0x1f0560?_0x192c03[_0x94b1('0x1d')]:_0x4ea6a4['offset']+_0x4ea6a4[_0x94b1('0x1e')];var _0x447b8f;if(_0x1abb7f>=_0x424c45){_0x1abb7f=_0x424c45;_0x447b8f=0xc8;}else{_0x447b8f=0xce;}_0x58fab3[_0x94b1('0x19')](_0x447b8f);return _0x58fab3['set'](_0x94b1('0x1f'),_0x224099+'-'+_0x1abb7f+'/'+_0x424c45)[_0x94b1('0x1a')](_0x192c03);}return null;};}function patchUpdates(_0x4c40c5){return function(_0x602c3b){try{jsonpatch[_0x94b1('0x20')](_0x602c3b,_0x4c40c5,!![]);}catch(_0x29af54){return BPromise[_0x94b1('0x21')](_0x29af54);}return _0x602c3b[_0x94b1('0x22')]();};}function saveUpdates(_0x38448d,_0x36180a){return function(_0xc8543){if(_0xc8543){return _0xc8543[_0x94b1('0x23')](_0x38448d)[_0x94b1('0x24')](function(_0x49c248){return _0x49c248;});}return null;};}function removeEntity(_0xa333a8,_0xa112b1){return function(_0x34c324){if(_0x34c324){return _0x34c324['destroy']()[_0x94b1('0x24')](function(){_0xa333a8['status'](0xcc)[_0x94b1('0x25')]();});}};}function handleEntityNotFound(_0x3d10ea,_0x14b8fe){return function(_0x109a81){if(!_0x109a81){_0x3d10ea['sendStatus'](0x194);}return _0x109a81;};}function handleError(_0x4ea6d9,_0x1d6ea6){_0x1d6ea6=_0x1d6ea6||0x1f4;return function(_0x4d5685){logger[_0x94b1('0x26')](_0x4d5685['stack']);if(_0x4d5685[_0x94b1('0x27')]){delete _0x4d5685[_0x94b1('0x27')];}_0x4ea6d9[_0x94b1('0x19')](_0x1d6ea6)['send'](_0x4d5685);};}exports[_0x94b1('0x28')]=function(_0x1d86bd,_0x467c42){var _0x319618={},_0xd86145={},_0x43b67c={'count':0x0,'rows':[]};var _0x2661ca=_[_0x94b1('0x29')](db[_0x94b1('0x2a')]['rawAttributes'],function(_0x2eb1fa){return{'name':_0x2eb1fa[_0x94b1('0x2b')],'type':_0x2eb1fa['type'][_0x94b1('0x2c')]};});_0xd86145[_0x94b1('0x2d')]=_[_0x94b1('0x29')](_0x2661ca,_0x94b1('0x27'));_0xd86145[_0x94b1('0x2e')]=_[_0x94b1('0x2f')](_0x1d86bd['query']);_0xd86145[_0x94b1('0x30')]=_['intersection'](_0xd86145[_0x94b1('0x2d')],_0xd86145['query']);_0x319618['attributes']=_[_0x94b1('0x31')](_0xd86145[_0x94b1('0x2d')],qs[_0x94b1('0x32')](_0x1d86bd[_0x94b1('0x2e')][_0x94b1('0x32')]));_0x319618[_0x94b1('0x33')]=_0x319618[_0x94b1('0x33')][_0x94b1('0x34')]?_0x319618[_0x94b1('0x33')]:_0xd86145[_0x94b1('0x2d')];if(!_0x1d86bd[_0x94b1('0x2e')][_0x94b1('0x35')]('nolimit')){_0x319618['limit']=qs[_0x94b1('0x1e')](_0x1d86bd[_0x94b1('0x2e')][_0x94b1('0x1e')]);_0x319618[_0x94b1('0x1b')]=qs[_0x94b1('0x1b')](_0x1d86bd[_0x94b1('0x2e')][_0x94b1('0x1b')]);}_0x319618[_0x94b1('0x36')]=qs[_0x94b1('0x37')](_0x1d86bd['query'][_0x94b1('0x37')]);_0x319618['where']=qs[_0x94b1('0x30')](_[_0x94b1('0x38')](_0x1d86bd[_0x94b1('0x2e')],_0xd86145['filters']),_0x2661ca);if(_0x1d86bd[_0x94b1('0x2e')][_0x94b1('0x39')]){_0x319618[_0x94b1('0x3a')]=_['merge'](_0x319618[_0x94b1('0x3a')],{'$or':_[_0x94b1('0x29')](_0x2661ca,function(_0x1d4168){if(_0x1d4168[_0x94b1('0x3b')]!==_0x94b1('0x3c')){var _0x2e6fb9={};_0x2e6fb9[_0x1d4168[_0x94b1('0x27')]]={'$like':'%'+_0x1d86bd[_0x94b1('0x2e')][_0x94b1('0x39')]+'%'};return _0x2e6fb9;}})});}_0x319618=_[_0x94b1('0x3d')]({},_0x319618,_0x1d86bd[_0x94b1('0x3e')]);var _0xfb5e55={'where':_0x319618[_0x94b1('0x3a')]};return db['JscriptyAnswerReport'][_0x94b1('0x1d')](_0xfb5e55)[_0x94b1('0x24')](function(_0xf29a10){_0x43b67c[_0x94b1('0x1d')]=_0xf29a10;if(_0x1d86bd[_0x94b1('0x2e')]['includeAll']){_0x319618[_0x94b1('0x3f')]=[{'all':!![]}];}return db[_0x94b1('0x2a')][_0x94b1('0x40')](_0x319618);})[_0x94b1('0x24')](function(_0x3cf664){_0x43b67c[_0x94b1('0x41')]=_0x3cf664;return _0x43b67c;})['then'](respondWithFilteredResult(_0x467c42,_0x319618))[_0x94b1('0x42')](handleError(_0x467c42,null));};exports[_0x94b1('0x43')]=function(_0x592daa,_0x317932){var _0x19d4e4={'raw':!![],'where':{'id':_0x592daa[_0x94b1('0x44')]['id']}},_0x59311b={};_0x59311b[_0x94b1('0x2d')]=_[_0x94b1('0x2f')](db['JscriptyAnswerReport'][_0x94b1('0x45')]);_0x59311b[_0x94b1('0x2e')]=_[_0x94b1('0x2f')](_0x592daa[_0x94b1('0x2e')]);_0x59311b[_0x94b1('0x30')]=_[_0x94b1('0x31')](_0x59311b[_0x94b1('0x2d')],_0x59311b['query']);_0x19d4e4[_0x94b1('0x33')]=_[_0x94b1('0x31')](_0x59311b[_0x94b1('0x2d')],qs['fields'](_0x592daa[_0x94b1('0x2e')][_0x94b1('0x32')]));_0x19d4e4['attributes']=_0x19d4e4[_0x94b1('0x33')][_0x94b1('0x34')]?_0x19d4e4[_0x94b1('0x33')]:_0x59311b[_0x94b1('0x2d')];if(_0x592daa[_0x94b1('0x2e')][_0x94b1('0x46')]){_0x19d4e4[_0x94b1('0x3f')]=[{'all':!![]}];}_0x19d4e4=_[_0x94b1('0x3d')]({},_0x19d4e4,_0x592daa[_0x94b1('0x3e')]);return db[_0x94b1('0x2a')][_0x94b1('0x47')](_0x19d4e4)[_0x94b1('0x24')](handleEntityNotFound(_0x317932,null))[_0x94b1('0x24')](respondWithResult(_0x317932,null))[_0x94b1('0x42')](handleError(_0x317932,null));};exports[_0x94b1('0x48')]=function(_0x1a2aab,_0xfe1c8f){return db[_0x94b1('0x2a')][_0x94b1('0x48')](_0x1a2aab['body'],{})[_0x94b1('0x24')](respondWithResult(_0xfe1c8f,0xc9))['catch'](handleError(_0xfe1c8f,null));};exports[_0x94b1('0x23')]=function(_0x3fc0fc,_0x1d8e57){if(_0x3fc0fc['body']['id']){delete _0x3fc0fc['body']['id'];}return db['JscriptyAnswerReport'][_0x94b1('0x47')]({'where':{'id':_0x3fc0fc[_0x94b1('0x44')]['id']}})[_0x94b1('0x24')](handleEntityNotFound(_0x1d8e57,null))['then'](saveUpdates(_0x3fc0fc['body'],null))['then'](respondWithResult(_0x1d8e57,null))[_0x94b1('0x42')](handleError(_0x1d8e57,null));};exports[_0x94b1('0x49')]=function(_0xbfd51b,_0x2a0f4c){return db[_0x94b1('0x2a')][_0x94b1('0x47')]({'where':{'id':_0xbfd51b[_0x94b1('0x44')]['id']}})['then'](handleEntityNotFound(_0x2a0f4c,null))[_0x94b1('0x24')](removeEntity(_0x2a0f4c,null))[_0x94b1('0x42')](handleError(_0x2a0f4c,null));};exports[_0x94b1('0x4a')]=function(_0x1d9648,_0x344ebe){return db[_0x94b1('0x2a')][_0x94b1('0x4a')]()[_0x94b1('0x24')](respondWithResult(_0x344ebe,null))[_0x94b1('0x42')](handleError(_0x344ebe,null));}; \ No newline at end of file +var _0xafdd=['pick','filter','merge','type','VIRTUAL','options','JscriptyAnswerReport','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','fieldName','model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','sort','where'];(function(_0x111777,_0x43e893){var _0x18b652=function(_0x24a8fa){while(--_0x24a8fa){_0x111777['push'](_0x111777['shift']());}};_0x18b652(++_0x43e893);}(_0xafdd,0x19a));var _0xdafd=function(_0x11ea69,_0x5da7d8){_0x11ea69=_0x11ea69-0x0;var _0x29dec7=_0xafdd[_0x11ea69];return _0x29dec7;};'use strict';var emlformat=require(_0xdafd('0x0'));var rimraf=require(_0xdafd('0x1'));var zipdir=require(_0xdafd('0x2'));var jsonpatch=require(_0xdafd('0x3'));var rp=require(_0xdafd('0x4'));var moment=require(_0xdafd('0x5'));var BPromise=require(_0xdafd('0x6'));var Mustache=require(_0xdafd('0x7'));var util=require('util');var path=require(_0xdafd('0x8'));var sox=require(_0xdafd('0x9'));var csv=require(_0xdafd('0xa'));var ejs=require(_0xdafd('0xb'));var fs=require('fs');var fs_extra=require(_0xdafd('0xc'));var _=require(_0xdafd('0xd'));var squel=require(_0xdafd('0xe'));var crypto=require('crypto');var jsforce=require(_0xdafd('0xf'));var deskjs=require(_0xdafd('0x10'));var toCsv=require(_0xdafd('0xa'));var querystring=require('querystring');var Papa=require(_0xdafd('0x11'));var Redis=require(_0xdafd('0x12'));var authService=require(_0xdafd('0x13'));var qs=require(_0xdafd('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdafd('0x15'));var logger=require(_0xdafd('0x16'))(_0xdafd('0x17'));var utils=require(_0xdafd('0x18'));var config=require(_0xdafd('0x19'));var licenseUtil=require(_0xdafd('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x166176,_0x594f47){_0x594f47=_0x594f47||0xcc;return function(_0x553508){if(_0x553508){return _0x166176[_0xdafd('0x1b')](_0x594f47);}return _0x166176[_0xdafd('0x1c')](_0x594f47)['end']();};}function respondWithResult(_0x43a716,_0x490382){_0x490382=_0x490382||0xc8;return function(_0x4b09da){if(_0x4b09da){return _0x43a716[_0xdafd('0x1c')](_0x490382)[_0xdafd('0x1d')](_0x4b09da);}};}function respondWithFilteredResult(_0x583b1d,_0x267bfc){return function(_0x186379){if(_0x186379){var _0x496515=typeof _0x267bfc[_0xdafd('0x1e')]===_0xdafd('0x1f')&&typeof _0x267bfc[_0xdafd('0x20')]==='undefined';var _0xb382ca=_0x186379[_0xdafd('0x21')];var _0x4fc3a4=_0x496515?0x0:_0x267bfc['offset'];var _0x2569b2=_0x496515?_0x186379['count']:_0x267bfc[_0xdafd('0x1e')]+_0x267bfc[_0xdafd('0x20')];var _0x1e64d3;if(_0x2569b2>=_0xb382ca){_0x2569b2=_0xb382ca;_0x1e64d3=0xc8;}else{_0x1e64d3=0xce;}_0x583b1d[_0xdafd('0x1c')](_0x1e64d3);return _0x583b1d[_0xdafd('0x22')](_0xdafd('0x23'),_0x4fc3a4+'-'+_0x2569b2+'/'+_0xb382ca)[_0xdafd('0x1d')](_0x186379);}return null;};}function patchUpdates(_0x42e0f9){return function(_0x8480a8){try{jsonpatch[_0xdafd('0x24')](_0x8480a8,_0x42e0f9,!![]);}catch(_0xee767e){return BPromise[_0xdafd('0x25')](_0xee767e);}return _0x8480a8[_0xdafd('0x26')]();};}function saveUpdates(_0xf4a521,_0x491d96){return function(_0x230495){if(_0x230495){return _0x230495['update'](_0xf4a521)[_0xdafd('0x27')](function(_0x5e96cc){return _0x5e96cc;});}return null;};}function removeEntity(_0x439bbf,_0x35ef78){return function(_0x7f10f6){if(_0x7f10f6){return _0x7f10f6[_0xdafd('0x28')]()[_0xdafd('0x27')](function(){_0x439bbf[_0xdafd('0x1c')](0xcc)[_0xdafd('0x29')]();});}};}function handleEntityNotFound(_0x30cba9,_0x3846dd){return function(_0x5cd11d){if(!_0x5cd11d){_0x30cba9[_0xdafd('0x1b')](0x194);}return _0x5cd11d;};}function handleError(_0x2ab575,_0x18554c){_0x18554c=_0x18554c||0x1f4;return function(_0x1feb5b){logger[_0xdafd('0x2a')](_0x1feb5b[_0xdafd('0x2b')]);if(_0x1feb5b[_0xdafd('0x2c')]){delete _0x1feb5b[_0xdafd('0x2c')];}_0x2ab575[_0xdafd('0x1c')](_0x18554c)[_0xdafd('0x2d')](_0x1feb5b);};}exports['index']=function(_0x243182,_0x14626b){var _0x13ab81={},_0x249743={},_0x21edb6={'count':0x0,'rows':[]};var _0x324f0f=_['map'](db['JscriptyAnswerReport']['rawAttributes'],function(_0xcca4f){return{'name':_0xcca4f[_0xdafd('0x2e')],'type':_0xcca4f['type']['key']};});_0x249743[_0xdafd('0x2f')]=_[_0xdafd('0x30')](_0x324f0f,_0xdafd('0x2c'));_0x249743[_0xdafd('0x31')]=_[_0xdafd('0x32')](_0x243182[_0xdafd('0x31')]);_0x249743[_0xdafd('0x33')]=_['intersection'](_0x249743[_0xdafd('0x2f')],_0x249743[_0xdafd('0x31')]);_0x13ab81[_0xdafd('0x34')]=_['intersection'](_0x249743[_0xdafd('0x2f')],qs[_0xdafd('0x35')](_0x243182['query'][_0xdafd('0x35')]));_0x13ab81[_0xdafd('0x34')]=_0x13ab81[_0xdafd('0x34')]['length']?_0x13ab81[_0xdafd('0x34')]:_0x249743[_0xdafd('0x2f')];if(!_0x243182[_0xdafd('0x31')][_0xdafd('0x36')](_0xdafd('0x37'))){_0x13ab81[_0xdafd('0x20')]=qs[_0xdafd('0x20')](_0x243182['query'][_0xdafd('0x20')]);_0x13ab81[_0xdafd('0x1e')]=qs[_0xdafd('0x1e')](_0x243182[_0xdafd('0x31')][_0xdafd('0x1e')]);}_0x13ab81['order']=qs[_0xdafd('0x38')](_0x243182[_0xdafd('0x31')]['sort']);_0x13ab81[_0xdafd('0x39')]=qs[_0xdafd('0x33')](_[_0xdafd('0x3a')](_0x243182[_0xdafd('0x31')],_0x249743[_0xdafd('0x33')]),_0x324f0f);if(_0x243182[_0xdafd('0x31')][_0xdafd('0x3b')]){_0x13ab81[_0xdafd('0x39')]=_[_0xdafd('0x3c')](_0x13ab81[_0xdafd('0x39')],{'$or':_[_0xdafd('0x30')](_0x324f0f,function(_0x245163){if(_0x245163[_0xdafd('0x3d')]!==_0xdafd('0x3e')){var _0xb1e264={};_0xb1e264[_0x245163[_0xdafd('0x2c')]]={'$like':'%'+_0x243182[_0xdafd('0x31')][_0xdafd('0x3b')]+'%'};return _0xb1e264;}})});}_0x13ab81=_[_0xdafd('0x3c')]({},_0x13ab81,_0x243182[_0xdafd('0x3f')]);var _0x3f25c2={'where':_0x13ab81[_0xdafd('0x39')]};return db[_0xdafd('0x40')][_0xdafd('0x21')](_0x3f25c2)[_0xdafd('0x27')](function(_0x21d43d){_0x21edb6['count']=_0x21d43d;if(_0x243182['query'][_0xdafd('0x41')]){_0x13ab81['include']=[{'all':!![]}];}return db[_0xdafd('0x40')][_0xdafd('0x42')](_0x13ab81);})['then'](function(_0x4b463c){_0x21edb6[_0xdafd('0x43')]=_0x4b463c;return _0x21edb6;})[_0xdafd('0x27')](respondWithFilteredResult(_0x14626b,_0x13ab81))[_0xdafd('0x44')](handleError(_0x14626b,null));};exports[_0xdafd('0x45')]=function(_0xbc5159,_0x184a59){var _0x3a3a14={'raw':!![],'where':{'id':_0xbc5159[_0xdafd('0x46')]['id']}},_0x2417f8={};_0x2417f8['model']=_['keys'](db[_0xdafd('0x40')][_0xdafd('0x47')]);_0x2417f8[_0xdafd('0x31')]=_[_0xdafd('0x32')](_0xbc5159[_0xdafd('0x31')]);_0x2417f8[_0xdafd('0x33')]=_[_0xdafd('0x48')](_0x2417f8[_0xdafd('0x2f')],_0x2417f8[_0xdafd('0x31')]);_0x3a3a14[_0xdafd('0x34')]=_[_0xdafd('0x48')](_0x2417f8[_0xdafd('0x2f')],qs[_0xdafd('0x35')](_0xbc5159['query'][_0xdafd('0x35')]));_0x3a3a14['attributes']=_0x3a3a14[_0xdafd('0x34')]['length']?_0x3a3a14[_0xdafd('0x34')]:_0x2417f8[_0xdafd('0x2f')];if(_0xbc5159[_0xdafd('0x31')][_0xdafd('0x41')]){_0x3a3a14[_0xdafd('0x49')]=[{'all':!![]}];}_0x3a3a14=_[_0xdafd('0x3c')]({},_0x3a3a14,_0xbc5159['options']);return db[_0xdafd('0x40')][_0xdafd('0x4a')](_0x3a3a14)[_0xdafd('0x27')](handleEntityNotFound(_0x184a59,null))[_0xdafd('0x27')](respondWithResult(_0x184a59,null))[_0xdafd('0x44')](handleError(_0x184a59,null));};exports['create']=function(_0x48cc85,_0x189d61){return db[_0xdafd('0x40')][_0xdafd('0x4b')](_0x48cc85[_0xdafd('0x4c')],{})[_0xdafd('0x27')](respondWithResult(_0x189d61,0xc9))[_0xdafd('0x44')](handleError(_0x189d61,null));};exports[_0xdafd('0x4d')]=function(_0x2f5e4c,_0x2ae4cd){if(_0x2f5e4c['body']['id']){delete _0x2f5e4c[_0xdafd('0x4c')]['id'];}return db[_0xdafd('0x40')][_0xdafd('0x4a')]({'where':{'id':_0x2f5e4c[_0xdafd('0x46')]['id']}})['then'](handleEntityNotFound(_0x2ae4cd,null))[_0xdafd('0x27')](saveUpdates(_0x2f5e4c[_0xdafd('0x4c')],null))[_0xdafd('0x27')](respondWithResult(_0x2ae4cd,null))[_0xdafd('0x44')](handleError(_0x2ae4cd,null));};exports[_0xdafd('0x28')]=function(_0x4b6fbb,_0x5af1a8){return db[_0xdafd('0x40')][_0xdafd('0x4a')]({'where':{'id':_0x4b6fbb['params']['id']}})['then'](handleEntityNotFound(_0x5af1a8,null))[_0xdafd('0x27')](removeEntity(_0x5af1a8,null))[_0xdafd('0x44')](handleError(_0x5af1a8,null));};exports['describe']=function(_0x2dde06,_0x5dc9a0){return db[_0xdafd('0x40')]['describe']()['then'](respondWithResult(_0x5dc9a0,null))[_0xdafd('0x44')](handleError(_0x5dc9a0,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 56d79b2..c2e95af 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 _0x41b4=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','report_jscripty_answers','api'];(function(_0x2e50f4,_0xef43a){var _0x5dad48=function(_0x24cde1){while(--_0x24cde1){_0x2e50f4['push'](_0x2e50f4['shift']());}};_0x5dad48(++_0xef43a);}(_0x41b4,0x97));var _0x441b=function(_0x3355c0,_0x4b530b){_0x3355c0=_0x3355c0-0x0;var _0x5a3288=_0x41b4[_0x3355c0];return _0x5a3288;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x441b('0x0'));var moment=require(_0x441b('0x1'));var BPromise=require(_0x441b('0x2'));var rp=require(_0x441b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x441b('0x4'));var config=require(_0x441b('0x5'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x441b('0x6')]=function(_0x1c4c5c,_0x51cad0){return _0x1c4c5c['define']('JscriptyAnswerReport',attributes,{'tableName':_0x441b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x488a=['JscriptyAnswerReport','report_jscripty_answers','../../config/logger','api','request-promise','../../config/environment','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x488a,0x17c));var _0xa488=function(_0x321b0b,_0x2207cd){_0x321b0b=_0x321b0b-0x0;var _0x57b8b7=_0x488a[_0x321b0b];return _0x57b8b7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa488('0x0'))(_0xa488('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa488('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa488('0x3'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x5b4e93,_0x1245bc){return _0x5b4e93[_0xa488('0x4')](_0xa488('0x5'),attributes,{'tableName':_0xa488('0x6'),'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 1a230d4..72ad6d3 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 _0xd0ef=['../../mysqldb','../../config/utils','rpc','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x18c937,_0x32d230){var _0xc920b3=function(_0x3f8610){while(--_0x3f8610){_0x18c937['push'](_0x18c937['shift']());}};_0xc920b3(++_0x32d230);}(_0xd0ef,0x7b));var _0xfd0e=function(_0x5de876,_0xdc9382){_0x5de876=_0x5de876-0x0;var _0x343949=_0xd0ef[_0x5de876];return _0x343949;};'use strict';var _=require(_0xfd0e('0x0'));var util=require('util');var moment=require(_0xfd0e('0x1'));var BPromise=require(_0xfd0e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd0e('0x3'))['db'];var utils=require(_0xfd0e('0x4'));var logger=require('../../config/logger')(_0xfd0e('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfd0e('0x6')][_0xfd0e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x33eccf,_0x18ac71,_0x2eed37){return new BPromise(function(_0x47005e,_0x3d9a2b){return client[_0xfd0e('0x8')](_0x33eccf,_0x2eed37)[_0xfd0e('0x9')](function(_0x1624ff){logger[_0xfd0e('0xa')](_0xfd0e('0xb'),_0x18ac71,'request\x20sent');logger[_0xfd0e('0xc')](_0xfd0e('0xd'),_0x18ac71,_0xfd0e('0xe'),JSON[_0xfd0e('0xf')](_0x1624ff));if(_0x1624ff[_0xfd0e('0x10')]){if(_0x1624ff[_0xfd0e('0x10')][_0xfd0e('0x11')]===0x1f4){logger[_0xfd0e('0x10')](_0xfd0e('0xb'),_0x18ac71,_0x1624ff[_0xfd0e('0x10')][_0xfd0e('0x12')]);return _0x3d9a2b(_0x1624ff['error'][_0xfd0e('0x12')]);}logger[_0xfd0e('0x10')](_0xfd0e('0xb'),_0x18ac71,_0x1624ff['error'][_0xfd0e('0x12')]);return _0x47005e(_0x1624ff[_0xfd0e('0x10')][_0xfd0e('0x12')]);}else{logger[_0xfd0e('0xa')](_0xfd0e('0xb'),_0x18ac71,_0xfd0e('0xe'));_0x47005e(_0x1624ff[_0xfd0e('0x13')][_0xfd0e('0x12')]);}})[_0xfd0e('0x14')](function(_0xa7be5e){logger[_0xfd0e('0x10')](_0xfd0e('0xb'),_0x18ac71,_0xa7be5e);_0x3d9a2b(_0xa7be5e);});});} \ No newline at end of file +var _0x363c=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x35e290,_0x1156b1){var _0x19dd62=function(_0x5796c8){while(--_0x5796c8){_0x35e290['push'](_0x35e290['shift']());}};_0x19dd62(++_0x1156b1);}(_0x363c,0xbb));var _0xc363=function(_0x5f3cd9,_0x393394){_0x5f3cd9=_0x5f3cd9-0x0;var _0xe10e57=_0x363c[_0x5f3cd9];return _0xe10e57;};'use strict';var _=require(_0xc363('0x0'));var util=require(_0xc363('0x1'));var moment=require(_0xc363('0x2'));var BPromise=require('bluebird');var rs=require(_0xc363('0x3'));var fs=require('fs');var Redis=require(_0xc363('0x4'));var db=require(_0xc363('0x5'))['db'];var utils=require(_0xc363('0x6'));var logger=require(_0xc363('0x7'))(_0xc363('0x8'));var config=require(_0xc363('0x9'));var jayson=require(_0xc363('0xa'));var client=jayson[_0xc363('0xb')][_0xc363('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe1c810,_0x423769,_0x1a7a5e){return new BPromise(function(_0x595228,_0x39ab17){return client['request'](_0xe1c810,_0x1a7a5e)['then'](function(_0x383b84){logger[_0xc363('0xd')](_0xc363('0xe'),_0x423769,_0xc363('0xf'));logger[_0xc363('0x10')](_0xc363('0x11'),_0x423769,_0xc363('0xf'),JSON[_0xc363('0x12')](_0x383b84));if(_0x383b84[_0xc363('0x13')]){if(_0x383b84['error']['code']===0x1f4){logger[_0xc363('0x13')](_0xc363('0xe'),_0x423769,_0x383b84[_0xc363('0x13')][_0xc363('0x14')]);return _0x39ab17(_0x383b84[_0xc363('0x13')][_0xc363('0x14')]);}logger[_0xc363('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x423769,_0x383b84['error']['message']);return _0x595228(_0x383b84[_0xc363('0x13')][_0xc363('0x14')]);}else{logger[_0xc363('0xd')](_0xc363('0xe'),_0x423769,_0xc363('0xf'));_0x595228(_0x383b84[_0xc363('0x15')]['message']);}})[_0xc363('0x16')](function(_0x10f80f){logger['error'](_0xc363('0xe'),_0x423769,_0x10f80f);_0x39ab17(_0x10f80f);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 4e24ccc..b302198 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 _0x18d7=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','index','/:id','isAuthenticated','get','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','/:id/clone','clone','put','update','destroy','exports','util'];(function(_0x1de77f,_0xe121a4){var _0x24e0b3=function(_0x1054ae){while(--_0x1054ae){_0x1de77f['push'](_0x1de77f['shift']());}};_0x24e0b3(++_0xe121a4);}(_0x18d7,0x176));var _0x718d=function(_0x250bbc,_0x3297f3){_0x250bbc=_0x250bbc-0x0;var _0x489e34=_0x18d7[_0x250bbc];return _0x489e34;};'use strict';var multer=require('multer');var util=require(_0x718d('0x0'));var path=require('path');var timeout=require(_0x718d('0x1'));var express=require('express');var router=express[_0x718d('0x2')]();var fs_extra=require(_0x718d('0x3'));var auth=require(_0x718d('0x4'));var interaction=require(_0x718d('0x5'));var config=require('../../config/environment');var controller=require(_0x718d('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x718d('0x7')]);router['get'](_0x718d('0x8'),auth[_0x718d('0x9')](),controller['show']);router[_0x718d('0xa')](_0x718d('0xb'),auth['isAuthenticated'](),controller[_0x718d('0xc')]);router[_0x718d('0xa')](_0x718d('0xd'),auth[_0x718d('0x9')](),controller[_0x718d('0xe')]);router[_0x718d('0xa')](_0x718d('0xf'),auth[_0x718d('0x9')](),timeout(_0x718d('0x10')),controller[_0x718d('0x11')]);router[_0x718d('0x12')]('/',auth[_0x718d('0x9')](),controller['create']);router[_0x718d('0x12')](_0x718d('0x13'),auth[_0x718d('0x9')](),controller[_0x718d('0x14')]);router[_0x718d('0x15')](_0x718d('0x8'),auth[_0x718d('0x9')](),controller[_0x718d('0x16')]);router['delete']('/:id',auth[_0x718d('0x9')](),controller[_0x718d('0x17')]);module[_0x718d('0x18')]=router; \ No newline at end of file +var _0x6be4=['get','/:id','show','/:id/sessions','getSessions','getAnswers','30s','create','post','/:id/clone','clone','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyProject.controller','isAuthenticated'];(function(_0x858ea8,_0x25e5be){var _0x413e8a=function(_0x1bf985){while(--_0x1bf985){_0x858ea8['push'](_0x858ea8['shift']());}};_0x413e8a(++_0x25e5be);}(_0x6be4,0x72));var _0x46be=function(_0x436b13,_0x3b6fdc){_0x436b13=_0x436b13-0x0;var _0x1903bd=_0x6be4[_0x436b13];return _0x1903bd;};'use strict';var multer=require(_0x46be('0x0'));var util=require(_0x46be('0x1'));var path=require(_0x46be('0x2'));var timeout=require(_0x46be('0x3'));var express=require(_0x46be('0x4'));var router=express[_0x46be('0x5')]();var fs_extra=require(_0x46be('0x6'));var auth=require(_0x46be('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x46be('0x8'));var controller=require(_0x46be('0x9'));router['get']('/',auth[_0x46be('0xa')](),controller['index']);router[_0x46be('0xb')](_0x46be('0xc'),auth[_0x46be('0xa')](),controller[_0x46be('0xd')]);router[_0x46be('0xb')](_0x46be('0xe'),auth[_0x46be('0xa')](),controller[_0x46be('0xf')]);router[_0x46be('0xb')]('/:id/answers',auth[_0x46be('0xa')](),controller[_0x46be('0x10')]);router[_0x46be('0xb')]('/:id/summary',auth[_0x46be('0xa')](),timeout(_0x46be('0x11')),controller['getSummary']);router['post']('/',auth['isAuthenticated'](),controller[_0x46be('0x12')]);router[_0x46be('0x13')](_0x46be('0x14'),auth[_0x46be('0xa')](),controller[_0x46be('0x15')]);router[_0x46be('0x16')](_0x46be('0xc'),auth[_0x46be('0xa')](),controller['update']);router['delete'](_0x46be('0xc'),auth[_0x46be('0xa')](),controller[_0x46be('0x17')]);module[_0x46be('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index b082d39..3190efe 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 _0xd3a5=['formData','format','getDataValue','description','BOOLEAN','sequelize','lodash','util','STRING','name','TEXT','long','setDataValue','isString'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xd3a5,0xbb));var _0x5d3a=function(_0x533990,_0x21fe8d){_0x533990=_0x533990-0x0;var _0x5a5e2a=_0xd3a5[_0x533990];return _0x5a5e2a;};'use strict';var Sequelize=require(_0x5d3a('0x0'));var _=require(_0x5d3a('0x1'));var util=require(_0x5d3a('0x2'));module['exports']={'name':{'type':Sequelize[_0x5d3a('0x3')],'unique':_0x5d3a('0x4')},'description':{'type':Sequelize[_0x5d3a('0x3')]},'formData':{'type':Sequelize[_0x5d3a('0x5')](_0x5d3a('0x6')),'set':function(_0xa295b0){if(_['isObjectLike'](_0xa295b0)){this[_0x5d3a('0x7')]('formData',JSON['stringify'](_0xa295b0));}else if(_[_0x5d3a('0x8')](_0xa295b0)){this[_0x5d3a('0x7')](_0x5d3a('0x9'),_0xa295b0);}else{this[_0x5d3a('0x7')](_0x5d3a('0x9'),util[_0x5d3a('0xa')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x5d3a('0xb')](_0x5d3a('0x4'))||'',this[_0x5d3a('0xb')](_0x5d3a('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x5d3a('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x5d3a('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x1360=['description','BOOLEAN','sequelize','util','STRING','name','isObjectLike','setDataValue','formData','stringify','isString','getDataValue'];(function(_0x42758d,_0x475877){var _0x3e7fe4=function(_0x5f26fb){while(--_0x5f26fb){_0x42758d['push'](_0x42758d['shift']());}};_0x3e7fe4(++_0x475877);}(_0x1360,0x19a));var _0x0136=function(_0x55527b,_0x293c9a){_0x55527b=_0x55527b-0x0;var _0xd2577b=_0x1360[_0x55527b];return _0xd2577b;};'use strict';var Sequelize=require(_0x0136('0x0'));var _=require('lodash');var util=require(_0x0136('0x1'));module['exports']={'name':{'type':Sequelize[_0x0136('0x2')],'unique':_0x0136('0x3')},'description':{'type':Sequelize[_0x0136('0x2')]},'formData':{'type':Sequelize['TEXT']('long'),'set':function(_0x20d1ca){if(_[_0x0136('0x4')](_0x20d1ca)){this[_0x0136('0x5')](_0x0136('0x6'),JSON[_0x0136('0x7')](_0x20d1ca));}else if(_[_0x0136('0x8')](_0x20d1ca)){this[_0x0136('0x5')](_0x0136('0x6'),_0x20d1ca);}else{this[_0x0136('0x5')](_0x0136('0x6'),util['format']('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x0136('0x9')](_0x0136('0x3'))||'',this[_0x0136('0x9')](_0x0136('0xa'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x0136('0xb')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x0136('0xb')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 24307f0..bea7f80 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 _0x5d36=['params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','omit','createdAt','updatedAt','body','userProfileId','update','getSessions','findOne','hasOwnProperty','ProjectId','filter','JscriptySessionReport','getAnswers','JscriptyAnswerReport','pick','number','fromCharCode','toString','indexOf','replace','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','save','then','destroy','get','error','stack','name','send','index','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','VIRTUAL','merge','options','includeAll','JscriptyProject','findAll','rows','catch','show'];(function(_0x1c0f3d,_0x55a9e2){var _0x4d71a8=function(_0xeff131){while(--_0xeff131){_0x1c0f3d['push'](_0x1c0f3d['shift']());}};_0x4d71a8(++_0x55a9e2);}(_0x5d36,0x11a));var _0x65d3=function(_0x3dcd52,_0x2c151a){_0x3dcd52=_0x3dcd52-0x0;var _0x4fb1c2=_0x5d36[_0x3dcd52];return _0x4fb1c2;};'use strict';var emlformat=require(_0x65d3('0x0'));var rimraf=require(_0x65d3('0x1'));var zipdir=require(_0x65d3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x65d3('0x3'));var BPromise=require(_0x65d3('0x4'));var Mustache=require(_0x65d3('0x5'));var util=require(_0x65d3('0x6'));var path=require(_0x65d3('0x7'));var sox=require(_0x65d3('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x65d3('0x9'));var _=require('lodash');var squel=require(_0x65d3('0xa'));var crypto=require(_0x65d3('0xb'));var jsforce=require(_0x65d3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x65d3('0xd'));var querystring=require(_0x65d3('0xe'));var Papa=require(_0x65d3('0xf'));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(_0x65d3('0x10'));var logger=require(_0x65d3('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x65d3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x65d3('0x13'))['db'];function respondWithStatusCode(_0x21a7f6,_0xc67d44){_0xc67d44=_0xc67d44||0xcc;return function(_0x3583a6){if(_0x3583a6){return _0x21a7f6[_0x65d3('0x14')](_0xc67d44);}return _0x21a7f6['status'](_0xc67d44)[_0x65d3('0x15')]();};}function respondWithResult(_0x1a5833,_0x2ebc82){_0x2ebc82=_0x2ebc82||0xc8;return function(_0x2ac16c){if(_0x2ac16c){return _0x1a5833['status'](_0x2ebc82)[_0x65d3('0x16')](_0x2ac16c);}};}function respondWithFilteredResult(_0x1173dd,_0x33b570){return function(_0x129a86){if(_0x129a86){var _0x3fbe5d=typeof _0x33b570[_0x65d3('0x17')]===_0x65d3('0x18')&&typeof _0x33b570[_0x65d3('0x19')]===_0x65d3('0x18');var _0x31594c=_0x129a86[_0x65d3('0x1a')];var _0x2ec9b7=_0x3fbe5d?0x0:_0x33b570['offset'];var _0x532474=_0x3fbe5d?_0x129a86[_0x65d3('0x1a')]:_0x33b570['offset']+_0x33b570[_0x65d3('0x19')];var _0x4605a1;if(_0x532474>=_0x31594c){_0x532474=_0x31594c;_0x4605a1=0xc8;}else{_0x4605a1=0xce;}_0x1173dd[_0x65d3('0x1b')](_0x4605a1);return _0x1173dd['set'](_0x65d3('0x1c'),_0x2ec9b7+'-'+_0x532474+'/'+_0x31594c)[_0x65d3('0x16')](_0x129a86);}return null;};}function patchUpdates(_0x260b56){return function(_0x183079){try{jsonpatch['apply'](_0x183079,_0x260b56,!![]);}catch(_0x425f57){return BPromise['reject'](_0x425f57);}return _0x183079[_0x65d3('0x1d')]();};}function saveUpdates(_0x16f9ca,_0x26e28c){return function(_0x390eb9){if(_0x390eb9){return _0x390eb9['update'](_0x16f9ca)[_0x65d3('0x1e')](function(_0x11dd3e){return _0x11dd3e;});}return null;};}function removeEntity(_0x19b8c0,_0x23626d){return function(_0x43c918){if(_0x43c918){return _0x43c918[_0x65d3('0x1f')]()['then'](function(){var _0x36ea53=_0x43c918[_0x65d3('0x20')]({'plain':!![]});var _0x4306bd='Projects';return db['UserProfileResource'][_0x65d3('0x1f')]({'where':{'type':_0x4306bd,'resourceId':_0x36ea53['id']}})[_0x65d3('0x1e')](function(){return _0x43c918;});})[_0x65d3('0x1e')](function(){_0x19b8c0[_0x65d3('0x1b')](0xcc)[_0x65d3('0x15')]();});}};}function handleEntityNotFound(_0x1976bb,_0x2a8881){return function(_0x3289bb){if(!_0x3289bb){_0x1976bb['sendStatus'](0x194);}return _0x3289bb;};}function handleError(_0x549a2d,_0x1cf810){_0x1cf810=_0x1cf810||0x1f4;return function(_0x26cee7){logger[_0x65d3('0x21')](_0x26cee7[_0x65d3('0x22')]);if(_0x26cee7[_0x65d3('0x23')]){delete _0x26cee7[_0x65d3('0x23')];}_0x549a2d[_0x65d3('0x1b')](_0x1cf810)[_0x65d3('0x24')](_0x26cee7);};}exports[_0x65d3('0x25')]=function(_0x92ea90,_0x5ed400){var _0x530434={},_0xd8a08c={},_0x1459d2={'count':0x0,'rows':[]};var _0x163318=_['map'](db['JscriptyProject']['rawAttributes'],function(_0x273901){return{'name':_0x273901[_0x65d3('0x26')],'type':_0x273901[_0x65d3('0x27')][_0x65d3('0x28')]};});_0xd8a08c[_0x65d3('0x29')]=_[_0x65d3('0x2a')](_0x163318,_0x65d3('0x23'));_0xd8a08c['query']=_[_0x65d3('0x2b')](_0x92ea90[_0x65d3('0x2c')]);_0xd8a08c[_0x65d3('0x2d')]=_[_0x65d3('0x2e')](_0xd8a08c[_0x65d3('0x29')],_0xd8a08c[_0x65d3('0x2c')]);_0x530434[_0x65d3('0x2f')]=_[_0x65d3('0x2e')](_0xd8a08c[_0x65d3('0x29')],qs[_0x65d3('0x30')](_0x92ea90[_0x65d3('0x2c')][_0x65d3('0x30')]));_0x530434[_0x65d3('0x2f')]=_0x530434[_0x65d3('0x2f')][_0x65d3('0x31')]?_0x530434[_0x65d3('0x2f')]:_0xd8a08c[_0x65d3('0x29')];if(!_0x92ea90['query']['hasOwnProperty'](_0x65d3('0x32'))){_0x530434['limit']=qs[_0x65d3('0x19')](_0x92ea90[_0x65d3('0x2c')]['limit']);_0x530434['offset']=qs[_0x65d3('0x17')](_0x92ea90['query'][_0x65d3('0x17')]);}_0x530434[_0x65d3('0x33')]=qs[_0x65d3('0x34')](_0x92ea90[_0x65d3('0x2c')][_0x65d3('0x34')]);_0x530434[_0x65d3('0x35')]=qs['filters'](_['pick'](_0x92ea90['query'],_0xd8a08c[_0x65d3('0x2d')]),_0x163318);if(_0x92ea90[_0x65d3('0x2c')]['filter']){_0x530434[_0x65d3('0x35')]=_['merge'](_0x530434[_0x65d3('0x35')],{'$or':_[_0x65d3('0x2a')](_0x163318,function(_0x18c419){if(_0x18c419['type']!==_0x65d3('0x36')){var _0x2f8d93={};_0x2f8d93[_0x18c419[_0x65d3('0x23')]]={'$like':'%'+_0x92ea90[_0x65d3('0x2c')]['filter']+'%'};return _0x2f8d93;}})});}_0x530434=_[_0x65d3('0x37')]({},_0x530434,_0x92ea90[_0x65d3('0x38')]);var _0x5ad94d={'where':_0x530434[_0x65d3('0x35')]};return db['JscriptyProject'][_0x65d3('0x1a')](_0x5ad94d)[_0x65d3('0x1e')](function(_0x207aff){_0x1459d2['count']=_0x207aff;if(_0x92ea90[_0x65d3('0x2c')][_0x65d3('0x39')]){_0x530434['include']=[{'all':!![]}];}return db[_0x65d3('0x3a')][_0x65d3('0x3b')](_0x530434);})['then'](function(_0x51b4b7){_0x1459d2[_0x65d3('0x3c')]=_0x51b4b7;return _0x1459d2;})[_0x65d3('0x1e')](respondWithFilteredResult(_0x5ed400,_0x530434))[_0x65d3('0x3d')](handleError(_0x5ed400,null));};exports[_0x65d3('0x3e')]=function(_0x18ecde,_0x3f4e80){var _0x288b2a={'raw':![],'where':{'id':_0x18ecde[_0x65d3('0x3f')]['id']}},_0x3735e8={};_0x3735e8[_0x65d3('0x29')]=_[_0x65d3('0x2b')](db['JscriptyProject']['rawAttributes']);_0x3735e8[_0x65d3('0x2c')]=_[_0x65d3('0x2b')](_0x18ecde[_0x65d3('0x2c')]);_0x3735e8[_0x65d3('0x2d')]=_[_0x65d3('0x2e')](_0x3735e8[_0x65d3('0x29')],_0x3735e8['query']);_0x288b2a[_0x65d3('0x2f')]=_[_0x65d3('0x2e')](_0x3735e8['model'],qs['fields'](_0x18ecde[_0x65d3('0x2c')][_0x65d3('0x30')]));_0x288b2a[_0x65d3('0x2f')]=_0x288b2a['attributes'][_0x65d3('0x31')]?_0x288b2a[_0x65d3('0x2f')]:_0x3735e8['model'];if(_0x18ecde[_0x65d3('0x2c')][_0x65d3('0x39')]){_0x288b2a[_0x65d3('0x40')]=[{'all':!![]}];}_0x288b2a=_['merge']({},_0x288b2a,_0x18ecde['options']);return db[_0x65d3('0x3a')][_0x65d3('0x41')](_0x288b2a)[_0x65d3('0x1e')](handleEntityNotFound(_0x3f4e80,null))[_0x65d3('0x1e')](respondWithResult(_0x3f4e80,null))[_0x65d3('0x3d')](handleError(_0x3f4e80,null));};exports[_0x65d3('0x42')]=function(_0x5af3a3,_0x5cda21){return db[_0x65d3('0x3a')][_0x65d3('0x42')](_0x5af3a3['body'],{})['then'](function(_0x5cb801){var _0x48ed2d=_0x5af3a3[_0x65d3('0x43')][_0x65d3('0x20')]({'plain':!![]});if(!_0x48ed2d)throw new Error(_0x65d3('0x44'));if(_0x48ed2d[_0x65d3('0x45')]==='user'){var _0x47e724=_0x5cb801[_0x65d3('0x20')]({'plain':!![]});var _0x2b6128=_0x65d3('0x46');return db[_0x65d3('0x47')]['find']({'where':{'name':_0x2b6128,'userProfileId':_0x48ed2d['userProfileId']},'raw':!![]})['then'](function(_0x57acb3){if(_0x57acb3&&_0x57acb3[_0x65d3('0x48')]===0x0){return db[_0x65d3('0x49')][_0x65d3('0x42')]({'name':_0x47e724['name'],'resourceId':_0x47e724['id'],'type':_0x57acb3[_0x65d3('0x23')],'sectionId':_0x57acb3['id']},{})[_0x65d3('0x1e')](function(){return _0x5cb801;});}else{return _0x5cb801;}})[_0x65d3('0x3d')](function(_0xdbe2ba){logger[_0x65d3('0x21')](_0x65d3('0x4a'),_0xdbe2ba);throw _0xdbe2ba;});}return _0x5cb801;})[_0x65d3('0x1e')](respondWithResult(_0x5cda21,0xc9))[_0x65d3('0x3d')](handleError(_0x5cda21,null));};exports[_0x65d3('0x4b')]=function(_0x42b951,_0x4655e7){var _0x9af79a={'where':{'id':_0x42b951[_0x65d3('0x3f')]['id']}},_0x3344a4={};_0x3344a4['model']=_[_0x65d3('0x2b')](db[_0x65d3('0x3a')][_0x65d3('0x4c')]);_0x9af79a[_0x65d3('0x2f')]=_[_0x65d3('0x2e')](_0x3344a4['model'],qs['fields'](_0x42b951['query'][_0x65d3('0x30')]));_0x9af79a[_0x65d3('0x2f')]=_0x9af79a[_0x65d3('0x2f')][_0x65d3('0x31')]?_0x9af79a['attributes']:_0x3344a4[_0x65d3('0x29')];if(_0x42b951['query'][_0x65d3('0x39')]){_0x9af79a[_0x65d3('0x40')]=[{'all':!![]}];}_0x9af79a=_[_0x65d3('0x37')]({},_0x9af79a,_0x42b951[_0x65d3('0x38')]);return db['JscriptyProject'][_0x65d3('0x41')](_0x9af79a)[_0x65d3('0x1e')](handleEntityNotFound(_0x4655e7,null))[_0x65d3('0x1e')](function(_0xf54f41){if(_0xf54f41){var _0x23a6b6=_0xf54f41[_0x65d3('0x20')]({'plain':!![]});_0x23a6b6=qs[_0x65d3('0x4d')](_0x23a6b6,['id',_0x65d3('0x4e'),_0x65d3('0x4f')]);_0x42b951[_0x65d3('0x50')]=_['omit'](_0x42b951['body'],['id',_0x65d3('0x4e'),_0x65d3('0x4f')]);return db['JscriptyProject'][_0x65d3('0x42')](_[_0x65d3('0x37')](_0x23a6b6,_0x42b951[_0x65d3('0x50')]),{'include':_0x42b951[_0x65d3('0x2c')][_0x65d3('0x39')]?[{'all':!![]}]:undefined})[_0x65d3('0x1e')](function(_0x168ac0){var _0x982a0c=_0x42b951[_0x65d3('0x43')]['get']({'plain':!![]});if(!_0x982a0c)throw new Error(_0x65d3('0x44'));if(_0x982a0c[_0x65d3('0x45')]===_0x65d3('0x43')){var _0x34068c=_0x168ac0[_0x65d3('0x20')]({'plain':!![]});var _0x3e2942=_0x65d3('0x46');return db[_0x65d3('0x47')][_0x65d3('0x41')]({'where':{'name':_0x3e2942,'userProfileId':_0x982a0c[_0x65d3('0x51')]},'raw':!![]})[_0x65d3('0x1e')](function(_0x4737b0){if(_0x4737b0&&_0x4737b0[_0x65d3('0x48')]===0x0){return db[_0x65d3('0x49')][_0x65d3('0x42')]({'name':_0x34068c[_0x65d3('0x23')],'resourceId':_0x34068c['id'],'type':_0x4737b0['name'],'sectionId':_0x4737b0['id']},{})['then'](function(){return _0x168ac0;});}else{return _0x168ac0;}})['catch'](function(_0x64e7b2){logger[_0x65d3('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x64e7b2);throw _0x64e7b2;});}return _0x168ac0;});}})[_0x65d3('0x1e')](respondWithResult(_0x4655e7,0xc9))['catch'](handleError(_0x4655e7,null));};exports[_0x65d3('0x52')]=function(_0x383ef1,_0x4cecac){if(_0x383ef1[_0x65d3('0x50')]['id']){delete _0x383ef1[_0x65d3('0x50')]['id'];}return db[_0x65d3('0x3a')][_0x65d3('0x41')]({'where':{'id':_0x383ef1[_0x65d3('0x3f')]['id']}})[_0x65d3('0x1e')](handleEntityNotFound(_0x4cecac,null))[_0x65d3('0x1e')](saveUpdates(_0x383ef1['body'],null))[_0x65d3('0x1e')](respondWithResult(_0x4cecac,null))['catch'](handleError(_0x4cecac,null));};exports[_0x65d3('0x1f')]=function(_0x2e1b98,_0x29b0ad){return db['JscriptyProject'][_0x65d3('0x41')]({'where':{'id':_0x2e1b98[_0x65d3('0x3f')]['id']}})[_0x65d3('0x1e')](handleEntityNotFound(_0x29b0ad,null))[_0x65d3('0x1e')](removeEntity(_0x29b0ad,null))[_0x65d3('0x3d')](handleError(_0x29b0ad,null));};exports[_0x65d3('0x53')]=function(_0x2c7a59,_0x1fc3b8,_0x358368){var _0x475b8c={'raw':!![],'where':{}};var _0x1a4358={};var _0x4412b1={'count':0x0,'rows':[]};return db[_0x65d3('0x3a')][_0x65d3('0x54')]({'where':{'id':_0x2c7a59[_0x65d3('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1fc3b8,null))[_0x65d3('0x1e')](function(_0x3795bf){if(_0x3795bf){_0x1a4358[_0x65d3('0x29')]=_[_0x65d3('0x2b')](db['JscriptySessionReport']['rawAttributes']);_0x1a4358['query']=_[_0x65d3('0x2b')](_0x2c7a59[_0x65d3('0x2c')]);_0x1a4358[_0x65d3('0x2d')]=_['intersection'](_0x1a4358['model'],_0x1a4358[_0x65d3('0x2c')]);_0x475b8c[_0x65d3('0x2f')]=_[_0x65d3('0x2e')](_0x1a4358[_0x65d3('0x29')],qs[_0x65d3('0x30')](_0x2c7a59[_0x65d3('0x2c')][_0x65d3('0x30')]));_0x475b8c[_0x65d3('0x2f')]=_0x475b8c[_0x65d3('0x2f')][_0x65d3('0x31')]?_0x475b8c[_0x65d3('0x2f')]:_0x1a4358['model'];if(!_0x2c7a59[_0x65d3('0x2c')][_0x65d3('0x55')](_0x65d3('0x32'))){_0x475b8c[_0x65d3('0x19')]=qs[_0x65d3('0x19')](_0x2c7a59[_0x65d3('0x2c')][_0x65d3('0x19')]);_0x475b8c['offset']=qs[_0x65d3('0x17')](_0x2c7a59['query'][_0x65d3('0x17')]);}_0x475b8c[_0x65d3('0x33')]=qs[_0x65d3('0x34')](_0x2c7a59[_0x65d3('0x2c')][_0x65d3('0x34')]);_0x475b8c[_0x65d3('0x35')]=qs[_0x65d3('0x2d')](_['pick'](_0x2c7a59[_0x65d3('0x2c')],_0x1a4358[_0x65d3('0x2d')]));_0x475b8c[_0x65d3('0x35')][_0x65d3('0x56')]=_0x3795bf['id'];if(_0x2c7a59['query']['filter']){_0x475b8c['where']=_['merge'](_0x475b8c['where'],{'$or':_[_0x65d3('0x2a')](_0x475b8c[_0x65d3('0x2f')],function(_0x583d77){var _0x69a17d={};_0x69a17d[_0x583d77]={'$like':'%'+_0x2c7a59[_0x65d3('0x2c')][_0x65d3('0x57')]+'%'};return _0x69a17d;})});}_0x475b8c=_[_0x65d3('0x37')]({},_0x475b8c,_0x2c7a59[_0x65d3('0x38')]);return db[_0x65d3('0x58')][_0x65d3('0x1a')]({'where':_0x475b8c[_0x65d3('0x35')]})['then'](function(_0x12c18a){_0x4412b1[_0x65d3('0x1a')]=_0x12c18a;if(_0x2c7a59[_0x65d3('0x2c')][_0x65d3('0x39')]){_0x475b8c[_0x65d3('0x40')]=[{'all':!![]}];}return db[_0x65d3('0x58')][_0x65d3('0x3b')](_0x475b8c);})[_0x65d3('0x1e')](function(_0x1a705f){_0x4412b1[_0x65d3('0x3c')]=_0x1a705f;return _0x4412b1;});}})[_0x65d3('0x1e')](respondWithFilteredResult(_0x1fc3b8,_0x475b8c))[_0x65d3('0x3d')](handleError(_0x1fc3b8,null));};exports[_0x65d3('0x59')]=function(_0x3b026a,_0x169f73,_0x440a3d){var _0x513aea={'raw':!![],'where':{}};var _0x3316e8={};var _0x5bd813={'count':0x0,'rows':[]};return db[_0x65d3('0x3a')][_0x65d3('0x54')]({'where':{'id':_0x3b026a['params']['id']}})[_0x65d3('0x1e')](handleEntityNotFound(_0x169f73,null))[_0x65d3('0x1e')](function(_0x2a4368){if(_0x2a4368){_0x3316e8[_0x65d3('0x29')]=_[_0x65d3('0x2b')](db[_0x65d3('0x5a')][_0x65d3('0x4c')]);_0x3316e8['query']=_[_0x65d3('0x2b')](_0x3b026a[_0x65d3('0x2c')]);_0x3316e8[_0x65d3('0x2d')]=_[_0x65d3('0x2e')](_0x3316e8[_0x65d3('0x29')],_0x3316e8[_0x65d3('0x2c')]);_0x513aea[_0x65d3('0x2f')]=_['intersection'](_0x3316e8['model'],qs['fields'](_0x3b026a['query'][_0x65d3('0x30')]));_0x513aea[_0x65d3('0x2f')]=_0x513aea[_0x65d3('0x2f')][_0x65d3('0x31')]?_0x513aea[_0x65d3('0x2f')]:_0x3316e8['model'];if(!_0x3b026a[_0x65d3('0x2c')][_0x65d3('0x55')](_0x65d3('0x32'))){_0x513aea[_0x65d3('0x19')]=qs['limit'](_0x3b026a['query'][_0x65d3('0x19')]);_0x513aea[_0x65d3('0x17')]=qs['offset'](_0x3b026a[_0x65d3('0x2c')]['offset']);}_0x513aea[_0x65d3('0x33')]=qs[_0x65d3('0x34')](_0x3b026a['query'][_0x65d3('0x34')]);_0x513aea['where']=qs[_0x65d3('0x2d')](_[_0x65d3('0x5b')](_0x3b026a[_0x65d3('0x2c')],_0x3316e8[_0x65d3('0x2d')]));_0x513aea[_0x65d3('0x35')]['ProjectId']=_0x2a4368['id'];if(_0x3b026a[_0x65d3('0x2c')]['filter']){_0x513aea['where']=_[_0x65d3('0x37')](_0x513aea[_0x65d3('0x35')],{'$or':_[_0x65d3('0x2a')](_0x513aea[_0x65d3('0x2f')],function(_0x247bd9){var _0x3c461b={};_0x3c461b[_0x247bd9]={'$like':'%'+_0x3b026a['query'][_0x65d3('0x57')]+'%'};return _0x3c461b;})});}_0x513aea=_[_0x65d3('0x37')]({},_0x513aea,_0x3b026a['options']);return db[_0x65d3('0x5a')]['count']({'where':_0x513aea[_0x65d3('0x35')]})[_0x65d3('0x1e')](function(_0xe5bbf){_0x5bd813[_0x65d3('0x1a')]=_0xe5bbf;if(_0x3b026a[_0x65d3('0x2c')][_0x65d3('0x39')]){_0x513aea['include']=[{'all':!![]}];}return db[_0x65d3('0x5a')]['findAll'](_0x513aea);})[_0x65d3('0x1e')](function(_0x2a8042){_0x5bd813[_0x65d3('0x3c')]=_0x2a8042;return _0x5bd813;});}})[_0x65d3('0x1e')](respondWithFilteredResult(_0x169f73,_0x513aea))[_0x65d3('0x3d')](handleError(_0x169f73,null));};function char(_0x2b2747){return _0x65d3('0x5c')===typeof _0x2b2747?String[_0x65d3('0x5d')]['apply'](null,arguments):_0x2b2747;}function needsEncapsulation(_0x13b197){return!!_0x13b197&&(_0x13b197[_0x65d3('0x5e')]()[_0x65d3('0x5f')](char(0xd))>=0x0||_0x13b197[_0x65d3('0x5e')]()[_0x65d3('0x5f')](char(0xa))>=0x0||_0x13b197['toString']()[_0x65d3('0x5f')](char(0x2c))>=0x0||_0x13b197['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x4db3c6){var _0x41e67f=char(0x22),_0x271061='\x5c'+char(0x22),_0xe01528=_0x4db3c6[_0x65d3('0x5e')]()[_0x65d3('0x60')](new RegExp(_0x41e67f,'g'),_0x271061);return _0x41e67f+_0xe01528+_0x41e67f;}exports['getSummary']=function(_0x1a93bd,_0x3d8b09,_0x14b8e8){var _0x226597,_0x4d1ffd;var _0x46a712={'where':{'ProjectId':_0x1a93bd[_0x65d3('0x3f')]['id']}};if(_0x1a93bd[_0x65d3('0x2c')][_0x65d3('0x61')]){_0x46a712[_0x65d3('0x35')][_0x65d3('0x62')]=JSON[_0x65d3('0x63')](_0x1a93bd[_0x65d3('0x2c')][_0x65d3('0x61')]);}return db['JscriptySessionReport']['findAll'](_0x46a712)[_0x65d3('0x1e')](handleEntityNotFound(_0x3d8b09,null))[_0x65d3('0x1e')](function(_0x5343d1){if(_0x5343d1){_0x226597=_0x5343d1;return db[_0x65d3('0x64')]['findAll']({'where':{'SessionId':{'$in':_[_0x65d3('0x2a')](_0x226597,'id')},'ProjectId':_0x1a93bd[_0x65d3('0x3f')]['id']},'order':_0x65d3('0x65')});}})[_0x65d3('0x1e')](handleEntityNotFound(_0x3d8b09,null))[_0x65d3('0x1e')](function(_0x55f668){if(_0x55f668){_0x4d1ffd=_0x55f668;var _0xd880c2={};for(var _0x45b67a=0x0,_0x5b0655=_0x4d1ffd[_0x65d3('0x31')];_0x45b67a<_0x5b0655;_0x45b67a++){if(!_0xd880c2[_0x65d3('0x55')](_0x4d1ffd[_0x45b67a]['questionId'])){_0xd880c2[_0x4d1ffd[_0x45b67a][_0x65d3('0x66')]]=needsEncapsulation(_0x4d1ffd[_0x45b67a][_0x65d3('0x67')])?encapsulate(_0x4d1ffd[_0x45b67a][_0x65d3('0x67')]):_0x4d1ffd[_0x45b67a][_0x65d3('0x67')];}}var _0x3eb2c3=[],_0x2bb785={};for(var _0x4ed6fe=0x0,_0x15ba25=_0x226597[_0x65d3('0x31')];_0x4ed6fe<_0x15ba25;_0x4ed6fe++){_0x2bb785={'ProjectId':_0x1a93bd['params']['id'],'SessionId':_0x226597[_0x4ed6fe]['id'],'StartTime':moment(_0x226597[_0x4ed6fe]['starttime'])[_0x65d3('0x68')](_0x65d3('0x69'))};for(var _0x4cff42=0x0,_0x12febc=_0x4d1ffd[_0x65d3('0x31')];_0x4cff42<_0x12febc;_0x4cff42++){if(_0x4d1ffd[_0x4cff42][_0x65d3('0x6a')]==_0x226597[_0x4ed6fe]['id']&&_0xd880c2[_0x65d3('0x55')](_0x4d1ffd[_0x4cff42][_0x65d3('0x66')])){_0x2bb785[_0xd880c2[_0x4d1ffd[_0x4cff42][_0x65d3('0x66')]]]=_0x4d1ffd[_0x4cff42][_0x65d3('0x6b')];}}for(var _0x580c47 in _0xd880c2){if(!_0x2bb785[_0x65d3('0x55')](_0xd880c2[_0x580c47])){_0x2bb785[_0xd880c2[_0x580c47]]=null;}}_0x3eb2c3[_0x65d3('0x6c')](_0x2bb785);}return _0x3eb2c3;}})[_0x65d3('0x1e')](function(_0x177c08){if(!_['isEmpty'](_0x177c08)){var _0x342f27=toCsv(_0x177c08);var _0x4bc064=Date['now']();fs['writeFileSync'](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1a93bd[_0x65d3('0x3f')]['id'],_0x4bc064),_0x342f27);_0x3d8b09[_0x65d3('0x6d')](_0x65d3('0x6e'),'attachment;\x20filename='+util[_0x65d3('0x68')](_0x65d3('0x6f'),_0x1a93bd[_0x65d3('0x3f')]['id'],_0x4bc064));_0x3d8b09[_0x65d3('0x6d')](_0x65d3('0x70'),_0x65d3('0x71'));return _0x3d8b09[_0x65d3('0x72')](util[_0x65d3('0x68')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1a93bd[_0x65d3('0x3f')]['id'],_0x4bc064));}else{return _0x3d8b09[_0x65d3('0x14')](0xcc);}})['catch'](handleError(_0x3d8b09,null));}; \ No newline at end of file +var _0x9189=['json','apply','reject','then','destroy','get','Projects','UserProfileResource','end','error','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','JscriptyProject','show','params','keys','include','find','catch','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','autoAssociation','update','getSessions','findOne','JscriptySessionReport','nolimit','ProjectId','rows','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','findAll','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','fs-extra','lodash','squel','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0x9189,0x1b0));var _0x9918=function(_0x131f4a,_0xfc35fb){_0x131f4a=_0x131f4a-0x0;var _0x41e0ee=_0x9189[_0x131f4a];return _0x41e0ee;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9918('0x0'));var jsonpatch=require(_0x9918('0x1'));var rp=require(_0x9918('0x2'));var moment=require(_0x9918('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9918('0x4'));var util=require('util');var path=require('path');var sox=require(_0x9918('0x5'));var csv=require(_0x9918('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9918('0x7'));var _=require(_0x9918('0x8'));var squel=require(_0x9918('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9918('0x6'));var querystring=require(_0x9918('0xa'));var Papa=require('papaparse');var Redis=require(_0x9918('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x9918('0xc'));var as=require(_0x9918('0xd'));var hardwareService=require(_0x9918('0xe'));var logger=require(_0x9918('0xf'))(_0x9918('0x10'));var utils=require(_0x9918('0x11'));var config=require(_0x9918('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x9918('0x13'))['db'];function respondWithStatusCode(_0x1a8f69,_0x548f67){_0x548f67=_0x548f67||0xcc;return function(_0x511a2c){if(_0x511a2c){return _0x1a8f69[_0x9918('0x14')](_0x548f67);}return _0x1a8f69['status'](_0x548f67)['end']();};}function respondWithResult(_0x15ff69,_0x38f36a){_0x38f36a=_0x38f36a||0xc8;return function(_0x53e3e9){if(_0x53e3e9){return _0x15ff69[_0x9918('0x15')](_0x38f36a)['json'](_0x53e3e9);}};}function respondWithFilteredResult(_0x131708,_0x27fbe7){return function(_0x2a2347){if(_0x2a2347){var _0x420db0=typeof _0x27fbe7[_0x9918('0x16')]===_0x9918('0x17')&&typeof _0x27fbe7[_0x9918('0x18')]===_0x9918('0x17');var _0x3f4011=_0x2a2347[_0x9918('0x19')];var _0x45f368=_0x420db0?0x0:_0x27fbe7[_0x9918('0x16')];var _0x1a9452=_0x420db0?_0x2a2347[_0x9918('0x19')]:_0x27fbe7[_0x9918('0x16')]+_0x27fbe7[_0x9918('0x18')];var _0x2f5b89;if(_0x1a9452>=_0x3f4011){_0x1a9452=_0x3f4011;_0x2f5b89=0xc8;}else{_0x2f5b89=0xce;}_0x131708[_0x9918('0x15')](_0x2f5b89);return _0x131708[_0x9918('0x1a')](_0x9918('0x1b'),_0x45f368+'-'+_0x1a9452+'/'+_0x3f4011)[_0x9918('0x1c')](_0x2a2347);}return null;};}function patchUpdates(_0x20be15){return function(_0x1af6cf){try{jsonpatch[_0x9918('0x1d')](_0x1af6cf,_0x20be15,!![]);}catch(_0x3858f3){return BPromise[_0x9918('0x1e')](_0x3858f3);}return _0x1af6cf['save']();};}function saveUpdates(_0x2dc468,_0x1f0bca){return function(_0x24ff02){if(_0x24ff02){return _0x24ff02['update'](_0x2dc468)[_0x9918('0x1f')](function(_0x2367f3){return _0x2367f3;});}return null;};}function removeEntity(_0x44893d,_0x4562aa){return function(_0x44691e){if(_0x44691e){return _0x44691e[_0x9918('0x20')]()[_0x9918('0x1f')](function(){var _0x216cc1=_0x44691e[_0x9918('0x21')]({'plain':!![]});var _0x143a5b=_0x9918('0x22');return db[_0x9918('0x23')][_0x9918('0x20')]({'where':{'type':_0x143a5b,'resourceId':_0x216cc1['id']}})['then'](function(){return _0x44691e;});})[_0x9918('0x1f')](function(){_0x44893d[_0x9918('0x15')](0xcc)[_0x9918('0x24')]();});}};}function handleEntityNotFound(_0x46526f,_0x1f8549){return function(_0x4e0c9b){if(!_0x4e0c9b){_0x46526f[_0x9918('0x14')](0x194);}return _0x4e0c9b;};}function handleError(_0xbf2888,_0x58f5af){_0x58f5af=_0x58f5af||0x1f4;return function(_0x5ac401){logger[_0x9918('0x25')](_0x5ac401['stack']);if(_0x5ac401['name']){delete _0x5ac401[_0x9918('0x26')];}_0xbf2888['status'](_0x58f5af)[_0x9918('0x27')](_0x5ac401);};}exports[_0x9918('0x28')]=function(_0x5db8c9,_0x4baa13){var _0x321f6d={},_0xa6409e={},_0x1eacfa={'count':0x0,'rows':[]};var _0x7405e5=_[_0x9918('0x29')](db['JscriptyProject'][_0x9918('0x2a')],function(_0x29d5b5){return{'name':_0x29d5b5[_0x9918('0x2b')],'type':_0x29d5b5[_0x9918('0x2c')][_0x9918('0x2d')]};});_0xa6409e['model']=_[_0x9918('0x29')](_0x7405e5,'name');_0xa6409e[_0x9918('0x2e')]=_['keys'](_0x5db8c9[_0x9918('0x2e')]);_0xa6409e[_0x9918('0x2f')]=_[_0x9918('0x30')](_0xa6409e[_0x9918('0x31')],_0xa6409e[_0x9918('0x2e')]);_0x321f6d[_0x9918('0x32')]=_[_0x9918('0x30')](_0xa6409e[_0x9918('0x31')],qs[_0x9918('0x33')](_0x5db8c9['query'][_0x9918('0x33')]));_0x321f6d[_0x9918('0x32')]=_0x321f6d[_0x9918('0x32')][_0x9918('0x34')]?_0x321f6d[_0x9918('0x32')]:_0xa6409e[_0x9918('0x31')];if(!_0x5db8c9[_0x9918('0x2e')][_0x9918('0x35')]('nolimit')){_0x321f6d['limit']=qs[_0x9918('0x18')](_0x5db8c9[_0x9918('0x2e')][_0x9918('0x18')]);_0x321f6d[_0x9918('0x16')]=qs['offset'](_0x5db8c9[_0x9918('0x2e')]['offset']);}_0x321f6d[_0x9918('0x36')]=qs[_0x9918('0x37')](_0x5db8c9[_0x9918('0x2e')][_0x9918('0x37')]);_0x321f6d['where']=qs['filters'](_[_0x9918('0x38')](_0x5db8c9[_0x9918('0x2e')],_0xa6409e['filters']),_0x7405e5);if(_0x5db8c9[_0x9918('0x2e')][_0x9918('0x39')]){_0x321f6d[_0x9918('0x3a')]=_[_0x9918('0x3b')](_0x321f6d[_0x9918('0x3a')],{'$or':_['map'](_0x7405e5,function(_0x4646d8){if(_0x4646d8[_0x9918('0x2c')]!==_0x9918('0x3c')){var _0x24b640={};_0x24b640[_0x4646d8[_0x9918('0x26')]]={'$like':'%'+_0x5db8c9[_0x9918('0x2e')]['filter']+'%'};return _0x24b640;}})});}_0x321f6d=_[_0x9918('0x3b')]({},_0x321f6d,_0x5db8c9[_0x9918('0x3d')]);var _0x373627={'where':_0x321f6d[_0x9918('0x3a')]};return db['JscriptyProject'][_0x9918('0x19')](_0x373627)[_0x9918('0x1f')](function(_0x39100e){_0x1eacfa[_0x9918('0x19')]=_0x39100e;if(_0x5db8c9['query'][_0x9918('0x3e')]){_0x321f6d['include']=[{'all':!![]}];}return db[_0x9918('0x3f')]['findAll'](_0x321f6d);})[_0x9918('0x1f')](function(_0x33c787){_0x1eacfa['rows']=_0x33c787;return _0x1eacfa;})[_0x9918('0x1f')](respondWithFilteredResult(_0x4baa13,_0x321f6d))['catch'](handleError(_0x4baa13,null));};exports[_0x9918('0x40')]=function(_0x336236,_0x379812){var _0x28b191={'raw':![],'where':{'id':_0x336236[_0x9918('0x41')]['id']}},_0x27c0f3={};_0x27c0f3['model']=_[_0x9918('0x42')](db[_0x9918('0x3f')]['rawAttributes']);_0x27c0f3[_0x9918('0x2e')]=_[_0x9918('0x42')](_0x336236[_0x9918('0x2e')]);_0x27c0f3[_0x9918('0x2f')]=_[_0x9918('0x30')](_0x27c0f3['model'],_0x27c0f3[_0x9918('0x2e')]);_0x28b191[_0x9918('0x32')]=_[_0x9918('0x30')](_0x27c0f3[_0x9918('0x31')],qs[_0x9918('0x33')](_0x336236[_0x9918('0x2e')][_0x9918('0x33')]));_0x28b191[_0x9918('0x32')]=_0x28b191['attributes'][_0x9918('0x34')]?_0x28b191[_0x9918('0x32')]:_0x27c0f3['model'];if(_0x336236['query']['includeAll']){_0x28b191[_0x9918('0x43')]=[{'all':!![]}];}_0x28b191=_[_0x9918('0x3b')]({},_0x28b191,_0x336236[_0x9918('0x3d')]);return db['JscriptyProject'][_0x9918('0x44')](_0x28b191)['then'](handleEntityNotFound(_0x379812,null))['then'](respondWithResult(_0x379812,null))[_0x9918('0x45')](handleError(_0x379812,null));};exports['create']=function(_0x5ca79e,_0x7f211a){return db['JscriptyProject']['create'](_0x5ca79e[_0x9918('0x46')],{})[_0x9918('0x1f')](function(_0x33d12a){var _0x53459d=_0x5ca79e['user']['get']({'plain':!![]});if(!_0x53459d)throw new Error(_0x9918('0x47'));if(_0x53459d[_0x9918('0x48')]===_0x9918('0x49')){var _0x3a1106=_0x33d12a[_0x9918('0x21')]({'plain':!![]});var _0x6861a3=_0x9918('0x22');return db[_0x9918('0x4a')][_0x9918('0x44')]({'where':{'name':_0x6861a3,'userProfileId':_0x53459d[_0x9918('0x4b')]},'raw':!![]})[_0x9918('0x1f')](function(_0x3b07fb){if(_0x3b07fb&&_0x3b07fb['autoAssociation']===0x0){return db[_0x9918('0x23')][_0x9918('0x4c')]({'name':_0x3a1106[_0x9918('0x26')],'resourceId':_0x3a1106['id'],'type':_0x3b07fb['name'],'sectionId':_0x3b07fb['id']},{})[_0x9918('0x1f')](function(){return _0x33d12a;});}else{return _0x33d12a;}})[_0x9918('0x45')](function(_0x458c00){logger[_0x9918('0x25')](_0x9918('0x4d'),_0x458c00);throw _0x458c00;});}return _0x33d12a;})[_0x9918('0x1f')](respondWithResult(_0x7f211a,0xc9))[_0x9918('0x45')](handleError(_0x7f211a,null));};exports['clone']=function(_0x567430,_0x30cde2){var _0x313e2f={'where':{'id':_0x567430[_0x9918('0x41')]['id']}},_0x4ee8dd={};_0x4ee8dd[_0x9918('0x31')]=_[_0x9918('0x42')](db['JscriptyProject'][_0x9918('0x2a')]);_0x313e2f[_0x9918('0x32')]=_[_0x9918('0x30')](_0x4ee8dd[_0x9918('0x31')],qs['fields'](_0x567430[_0x9918('0x2e')][_0x9918('0x33')]));_0x313e2f[_0x9918('0x32')]=_0x313e2f[_0x9918('0x32')][_0x9918('0x34')]?_0x313e2f[_0x9918('0x32')]:_0x4ee8dd[_0x9918('0x31')];if(_0x567430[_0x9918('0x2e')][_0x9918('0x3e')]){_0x313e2f[_0x9918('0x43')]=[{'all':!![]}];}_0x313e2f=_[_0x9918('0x3b')]({},_0x313e2f,_0x567430[_0x9918('0x3d')]);return db[_0x9918('0x3f')]['find'](_0x313e2f)['then'](handleEntityNotFound(_0x30cde2,null))[_0x9918('0x1f')](function(_0x5ee320){if(_0x5ee320){var _0x96a5a0=_0x5ee320[_0x9918('0x21')]({'plain':!![]});_0x96a5a0=qs[_0x9918('0x4e')](_0x96a5a0,['id',_0x9918('0x4f'),'updatedAt']);_0x567430[_0x9918('0x46')]=_[_0x9918('0x4e')](_0x567430[_0x9918('0x46')],['id','createdAt',_0x9918('0x50')]);return db['JscriptyProject'][_0x9918('0x4c')](_['merge'](_0x96a5a0,_0x567430['body']),{'include':_0x567430[_0x9918('0x2e')][_0x9918('0x3e')]?[{'all':!![]}]:undefined})[_0x9918('0x1f')](function(_0x2be017){var _0x3ee1db=_0x567430[_0x9918('0x49')][_0x9918('0x21')]({'plain':!![]});if(!_0x3ee1db)throw new Error(_0x9918('0x47'));if(_0x3ee1db[_0x9918('0x48')]===_0x9918('0x49')){var _0x22c45e=_0x2be017[_0x9918('0x21')]({'plain':!![]});var _0x563ad4=_0x9918('0x22');return db['UserProfileSection'][_0x9918('0x44')]({'where':{'name':_0x563ad4,'userProfileId':_0x3ee1db[_0x9918('0x4b')]},'raw':!![]})['then'](function(_0x3836a7){if(_0x3836a7&&_0x3836a7[_0x9918('0x51')]===0x0){return db[_0x9918('0x23')][_0x9918('0x4c')]({'name':_0x22c45e[_0x9918('0x26')],'resourceId':_0x22c45e['id'],'type':_0x3836a7[_0x9918('0x26')],'sectionId':_0x3836a7['id']},{})['then'](function(){return _0x2be017;});}else{return _0x2be017;}})['catch'](function(_0x2fb912){logger[_0x9918('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2fb912);throw _0x2fb912;});}return _0x2be017;});}})[_0x9918('0x1f')](respondWithResult(_0x30cde2,0xc9))['catch'](handleError(_0x30cde2,null));};exports[_0x9918('0x52')]=function(_0x31f4eb,_0x5ba7d2){if(_0x31f4eb[_0x9918('0x46')]['id']){delete _0x31f4eb['body']['id'];}return db[_0x9918('0x3f')][_0x9918('0x44')]({'where':{'id':_0x31f4eb[_0x9918('0x41')]['id']}})[_0x9918('0x1f')](handleEntityNotFound(_0x5ba7d2,null))[_0x9918('0x1f')](saveUpdates(_0x31f4eb[_0x9918('0x46')],null))[_0x9918('0x1f')](respondWithResult(_0x5ba7d2,null))['catch'](handleError(_0x5ba7d2,null));};exports[_0x9918('0x20')]=function(_0x2a5fff,_0x23e780){return db[_0x9918('0x3f')][_0x9918('0x44')]({'where':{'id':_0x2a5fff[_0x9918('0x41')]['id']}})[_0x9918('0x1f')](handleEntityNotFound(_0x23e780,null))[_0x9918('0x1f')](removeEntity(_0x23e780,null))[_0x9918('0x45')](handleError(_0x23e780,null));};exports[_0x9918('0x53')]=function(_0x574115,_0x11e6e0,_0x29055a){var _0x12272b={'raw':!![],'where':{}};var _0x336794={};var _0x430589={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x9918('0x54')]({'where':{'id':_0x574115['params']['id']}})[_0x9918('0x1f')](handleEntityNotFound(_0x11e6e0,null))[_0x9918('0x1f')](function(_0x3f1dbd){if(_0x3f1dbd){_0x336794['model']=_[_0x9918('0x42')](db[_0x9918('0x55')]['rawAttributes']);_0x336794['query']=_[_0x9918('0x42')](_0x574115['query']);_0x336794[_0x9918('0x2f')]=_[_0x9918('0x30')](_0x336794[_0x9918('0x31')],_0x336794[_0x9918('0x2e')]);_0x12272b['attributes']=_['intersection'](_0x336794['model'],qs[_0x9918('0x33')](_0x574115[_0x9918('0x2e')]['fields']));_0x12272b[_0x9918('0x32')]=_0x12272b[_0x9918('0x32')][_0x9918('0x34')]?_0x12272b[_0x9918('0x32')]:_0x336794['model'];if(!_0x574115[_0x9918('0x2e')]['hasOwnProperty'](_0x9918('0x56'))){_0x12272b['limit']=qs[_0x9918('0x18')](_0x574115[_0x9918('0x2e')]['limit']);_0x12272b[_0x9918('0x16')]=qs[_0x9918('0x16')](_0x574115[_0x9918('0x2e')]['offset']);}_0x12272b['order']=qs[_0x9918('0x37')](_0x574115[_0x9918('0x2e')][_0x9918('0x37')]);_0x12272b[_0x9918('0x3a')]=qs[_0x9918('0x2f')](_[_0x9918('0x38')](_0x574115[_0x9918('0x2e')],_0x336794[_0x9918('0x2f')]));_0x12272b[_0x9918('0x3a')][_0x9918('0x57')]=_0x3f1dbd['id'];if(_0x574115['query'][_0x9918('0x39')]){_0x12272b[_0x9918('0x3a')]=_[_0x9918('0x3b')](_0x12272b[_0x9918('0x3a')],{'$or':_['map'](_0x12272b[_0x9918('0x32')],function(_0x4bf6a4){var _0x239b60={};_0x239b60[_0x4bf6a4]={'$like':'%'+_0x574115[_0x9918('0x2e')][_0x9918('0x39')]+'%'};return _0x239b60;})});}_0x12272b=_[_0x9918('0x3b')]({},_0x12272b,_0x574115['options']);return db[_0x9918('0x55')][_0x9918('0x19')]({'where':_0x12272b[_0x9918('0x3a')]})[_0x9918('0x1f')](function(_0x245872){_0x430589['count']=_0x245872;if(_0x574115[_0x9918('0x2e')][_0x9918('0x3e')]){_0x12272b[_0x9918('0x43')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x12272b);})[_0x9918('0x1f')](function(_0x227048){_0x430589[_0x9918('0x58')]=_0x227048;return _0x430589;});}})[_0x9918('0x1f')](respondWithFilteredResult(_0x11e6e0,_0x12272b))[_0x9918('0x45')](handleError(_0x11e6e0,null));};exports['getAnswers']=function(_0x16c3d6,_0x1cf37d,_0x4c8b80){var _0xc7267b={'raw':!![],'where':{}};var _0x43a03e={};var _0x7991b={'count':0x0,'rows':[]};return db[_0x9918('0x3f')]['findOne']({'where':{'id':_0x16c3d6[_0x9918('0x41')]['id']}})['then'](handleEntityNotFound(_0x1cf37d,null))[_0x9918('0x1f')](function(_0x508791){if(_0x508791){_0x43a03e[_0x9918('0x31')]=_['keys'](db['JscriptyAnswerReport'][_0x9918('0x2a')]);_0x43a03e[_0x9918('0x2e')]=_[_0x9918('0x42')](_0x16c3d6['query']);_0x43a03e[_0x9918('0x2f')]=_[_0x9918('0x30')](_0x43a03e[_0x9918('0x31')],_0x43a03e[_0x9918('0x2e')]);_0xc7267b[_0x9918('0x32')]=_[_0x9918('0x30')](_0x43a03e[_0x9918('0x31')],qs[_0x9918('0x33')](_0x16c3d6[_0x9918('0x2e')]['fields']));_0xc7267b[_0x9918('0x32')]=_0xc7267b[_0x9918('0x32')][_0x9918('0x34')]?_0xc7267b[_0x9918('0x32')]:_0x43a03e[_0x9918('0x31')];if(!_0x16c3d6[_0x9918('0x2e')][_0x9918('0x35')](_0x9918('0x56'))){_0xc7267b[_0x9918('0x18')]=qs[_0x9918('0x18')](_0x16c3d6['query'][_0x9918('0x18')]);_0xc7267b['offset']=qs[_0x9918('0x16')](_0x16c3d6[_0x9918('0x2e')][_0x9918('0x16')]);}_0xc7267b[_0x9918('0x36')]=qs['sort'](_0x16c3d6[_0x9918('0x2e')][_0x9918('0x37')]);_0xc7267b[_0x9918('0x3a')]=qs[_0x9918('0x2f')](_['pick'](_0x16c3d6[_0x9918('0x2e')],_0x43a03e['filters']));_0xc7267b[_0x9918('0x3a')][_0x9918('0x57')]=_0x508791['id'];if(_0x16c3d6['query']['filter']){_0xc7267b[_0x9918('0x3a')]=_[_0x9918('0x3b')](_0xc7267b[_0x9918('0x3a')],{'$or':_[_0x9918('0x29')](_0xc7267b[_0x9918('0x32')],function(_0x1a3aba){var _0x3e2d09={};_0x3e2d09[_0x1a3aba]={'$like':'%'+_0x16c3d6[_0x9918('0x2e')][_0x9918('0x39')]+'%'};return _0x3e2d09;})});}_0xc7267b=_[_0x9918('0x3b')]({},_0xc7267b,_0x16c3d6['options']);return db[_0x9918('0x59')][_0x9918('0x19')]({'where':_0xc7267b['where']})[_0x9918('0x1f')](function(_0x4ab2dc){_0x7991b['count']=_0x4ab2dc;if(_0x16c3d6[_0x9918('0x2e')][_0x9918('0x3e')]){_0xc7267b[_0x9918('0x43')]=[{'all':!![]}];}return db[_0x9918('0x59')]['findAll'](_0xc7267b);})[_0x9918('0x1f')](function(_0x4a1066){_0x7991b[_0x9918('0x58')]=_0x4a1066;return _0x7991b;});}})[_0x9918('0x1f')](respondWithFilteredResult(_0x1cf37d,_0xc7267b))[_0x9918('0x45')](handleError(_0x1cf37d,null));};function char(_0x2af703){return _0x9918('0x5a')===typeof _0x2af703?String[_0x9918('0x5b')][_0x9918('0x1d')](null,arguments):_0x2af703;}function needsEncapsulation(_0x2faa18){return!!_0x2faa18&&(_0x2faa18[_0x9918('0x5c')]()[_0x9918('0x5d')](char(0xd))>=0x0||_0x2faa18[_0x9918('0x5c')]()['indexOf'](char(0xa))>=0x0||_0x2faa18[_0x9918('0x5c')]()[_0x9918('0x5d')](char(0x2c))>=0x0||_0x2faa18[_0x9918('0x5c')]()[_0x9918('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x1aa80e){var _0x42b5a6=char(0x22),_0x450c70='\x5c'+char(0x22),_0xeea7f6=_0x1aa80e[_0x9918('0x5c')]()[_0x9918('0x5e')](new RegExp(_0x42b5a6,'g'),_0x450c70);return _0x42b5a6+_0xeea7f6+_0x42b5a6;}exports[_0x9918('0x5f')]=function(_0x50d199,_0x1a4b46,_0x3037cb){var _0x470d41,_0x579ee8;var _0x45de2f={'where':{'ProjectId':_0x50d199[_0x9918('0x41')]['id']}};if(_0x50d199[_0x9918('0x2e')][_0x9918('0x60')]){_0x45de2f[_0x9918('0x3a')][_0x9918('0x61')]=JSON[_0x9918('0x62')](_0x50d199['query'][_0x9918('0x60')]);}return db[_0x9918('0x55')][_0x9918('0x63')](_0x45de2f)[_0x9918('0x1f')](handleEntityNotFound(_0x1a4b46,null))[_0x9918('0x1f')](function(_0x59768e){if(_0x59768e){_0x470d41=_0x59768e;return db['JscriptyQuestionReport'][_0x9918('0x63')]({'where':{'SessionId':{'$in':_[_0x9918('0x29')](_0x470d41,'id')},'ProjectId':_0x50d199[_0x9918('0x41')]['id']},'order':_0x9918('0x64')});}})[_0x9918('0x1f')](handleEntityNotFound(_0x1a4b46,null))[_0x9918('0x1f')](function(_0x4f562d){if(_0x4f562d){_0x579ee8=_0x4f562d;var _0x38395f={};for(var _0x391ef6=0x0,_0x327018=_0x579ee8['length'];_0x391ef6<_0x327018;_0x391ef6++){if(!_0x38395f[_0x9918('0x35')](_0x579ee8[_0x391ef6][_0x9918('0x65')])){_0x38395f[_0x579ee8[_0x391ef6][_0x9918('0x65')]]=needsEncapsulation(_0x579ee8[_0x391ef6][_0x9918('0x66')])?encapsulate(_0x579ee8[_0x391ef6][_0x9918('0x66')]):_0x579ee8[_0x391ef6]['question'];}}var _0x48b06a=[],_0x376180={};for(var _0x16e834=0x0,_0x307ce2=_0x470d41[_0x9918('0x34')];_0x16e834<_0x307ce2;_0x16e834++){_0x376180={'ProjectId':_0x50d199[_0x9918('0x41')]['id'],'SessionId':_0x470d41[_0x16e834]['id'],'StartTime':moment(_0x470d41[_0x16e834][_0x9918('0x61')])[_0x9918('0x67')](_0x9918('0x68'))};for(var _0x49cbe5=0x0,_0x72becb=_0x579ee8['length'];_0x49cbe5<_0x72becb;_0x49cbe5++){if(_0x579ee8[_0x49cbe5][_0x9918('0x69')]==_0x470d41[_0x16e834]['id']&&_0x38395f['hasOwnProperty'](_0x579ee8[_0x49cbe5][_0x9918('0x65')])){_0x376180[_0x38395f[_0x579ee8[_0x49cbe5][_0x9918('0x65')]]]=_0x579ee8[_0x49cbe5][_0x9918('0x6a')];}}for(var _0xdee1a8 in _0x38395f){if(!_0x376180['hasOwnProperty'](_0x38395f[_0xdee1a8])){_0x376180[_0x38395f[_0xdee1a8]]=null;}}_0x48b06a['push'](_0x376180);}return _0x48b06a;}})[_0x9918('0x1f')](function(_0x49a69c){if(!_['isEmpty'](_0x49a69c)){var _0x5ac2d4=toCsv(_0x49a69c);var _0x141d04=Date['now']();fs[_0x9918('0x6b')](util[_0x9918('0x67')](_0x9918('0x6c'),_0x50d199[_0x9918('0x41')]['id'],_0x141d04),_0x5ac2d4);_0x1a4b46[_0x9918('0x6d')](_0x9918('0x6e'),'attachment;\x20filename='+util[_0x9918('0x67')](_0x9918('0x6f'),_0x50d199[_0x9918('0x41')]['id'],_0x141d04));_0x1a4b46['setHeader'](_0x9918('0x70'),_0x9918('0x71'));return _0x1a4b46[_0x9918('0x72')](util[_0x9918('0x67')](_0x9918('0x6c'),_0x50d199[_0x9918('0x41')]['id'],_0x141d04));}else{return _0x1a4b46['sendStatus'](0xcc);}})[_0x9918('0x45')](handleError(_0x1a4b46,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 0ed682c..e9e6c38 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 _0x3937=['exports','define','JscriptyProject','jscripty_projects','lodash','../../config/logger','api','bluebird','path','../../config/environment','./jscriptyProject.attributes'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x3937,0xbf));var _0x7393=function(_0x436e22,_0x2f6821){_0x436e22=_0x436e22-0x0;var _0x524f42=_0x3937[_0x436e22];return _0x524f42;};'use strict';var _=require(_0x7393('0x0'));var util=require('util');var logger=require(_0x7393('0x1'))(_0x7393('0x2'));var moment=require('moment');var BPromise=require(_0x7393('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7393('0x4'));var rimraf=require('rimraf');var config=require(_0x7393('0x5'));var attributes=require(_0x7393('0x6'));module[_0x7393('0x7')]=function(_0x1f538f,_0x15eabd){return _0x1f538f[_0x7393('0x8')](_0x7393('0x9'),attributes,{'tableName':_0x7393('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50a6=['./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','lodash','util','moment','request-promise','path','rimraf'];(function(_0x3a2e49,_0x21ebea){var _0x257140=function(_0x5a2362){while(--_0x5a2362){_0x3a2e49['push'](_0x3a2e49['shift']());}};_0x257140(++_0x21ebea);}(_0x50a6,0xa4));var _0x650a=function(_0x432bd3,_0x173894){_0x432bd3=_0x432bd3-0x0;var _0x4586d1=_0x50a6[_0x432bd3];return _0x4586d1;};'use strict';var _=require(_0x650a('0x0'));var util=require(_0x650a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x650a('0x2'));var BPromise=require('bluebird');var rp=require(_0x650a('0x3'));var fs=require('fs');var path=require(_0x650a('0x4'));var rimraf=require(_0x650a('0x5'));var config=require('../../config/environment');var attributes=require(_0x650a('0x6'));module['exports']=function(_0x4eabde,_0x2d486d){return _0x4eabde[_0x650a('0x7')](_0x650a('0x8'),attributes,{'tableName':_0x650a('0x9'),'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 b4c140e..167de2d 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 _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xac4a,0x13f));var _0xaac4=function(_0x45c5ce,_0x4bea05){_0x45c5ce=_0x45c5ce-0x0;var _0x21efc4=_0xac4a[_0x45c5ce];return _0x21efc4;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x46f3f8,_0x12c74b){var _0xbc57cd=function(_0x34df37){while(--_0x34df37){_0x46f3f8['push'](_0x46f3f8['shift']());}};_0xbc57cd(++_0x12c74b);}(_0xda3f,0xec));var _0xfda3=function(_0x437a36,_0x45f2f0){_0x437a36=_0x437a36-0x0;var _0x1d9db4=_0xda3f[_0x437a36];return _0x1d9db4;};'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')]('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('JscriptyProject,\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/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 20df527..f08a692 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 _0xda4c=['update','delete','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','/:id','post','create'];(function(_0x2181b1,_0x569637){var _0x530548=function(_0x4b31f1){while(--_0x4b31f1){_0x2181b1['push'](_0x2181b1['shift']());}};_0x530548(++_0x569637);}(_0xda4c,0x1f3));var _0xcda4=function(_0x47d303,_0x235af7){_0x47d303=_0x47d303-0x0;var _0x457a01=_0xda4c[_0x47d303];return _0x457a01;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcda4('0x0'));var timeout=require(_0xcda4('0x1'));var express=require(_0xcda4('0x2'));var router=express['Router']();var fs_extra=require(_0xcda4('0x3'));var auth=require(_0xcda4('0x4'));var interaction=require(_0xcda4('0x5'));var config=require(_0xcda4('0x6'));var controller=require('./jscriptyQuestionReport.controller');router['get']('/',auth[_0xcda4('0x7')](),controller['index']);router[_0xcda4('0x8')]('/describe',auth[_0xcda4('0x7')](),controller[_0xcda4('0x9')]);router['get'](_0xcda4('0xa'),auth[_0xcda4('0x7')](),controller['show']);router[_0xcda4('0xb')]('/',auth[_0xcda4('0x7')](),controller[_0xcda4('0xc')]);router['put']('/:id',auth[_0xcda4('0x7')](),controller[_0xcda4('0xd')]);router[_0xcda4('0xe')](_0xcda4('0xa'),auth[_0xcda4('0x7')](),controller['destroy']);module[_0xcda4('0xf')]=router; \ No newline at end of file +var _0xf9e8=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','/describe','describe','isAuthenticated','show','post','put','/:id','destroy','exports','multer'];(function(_0x52d45f,_0x5232c3){var _0xda9852=function(_0x3ef213){while(--_0x3ef213){_0x52d45f['push'](_0x52d45f['shift']());}};_0xda9852(++_0x5232c3);}(_0xf9e8,0x1cd));var _0x8f9e=function(_0x440ad1,_0x329511){_0x440ad1=_0x440ad1-0x0;var _0x32cebd=_0xf9e8[_0x440ad1];return _0x32cebd;};'use strict';var multer=require(_0x8f9e('0x0'));var util=require(_0x8f9e('0x1'));var path=require(_0x8f9e('0x2'));var timeout=require(_0x8f9e('0x3'));var express=require(_0x8f9e('0x4'));var router=express[_0x8f9e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8f9e('0x6'));var interaction=require(_0x8f9e('0x7'));var config=require(_0x8f9e('0x8'));var controller=require(_0x8f9e('0x9'));router[_0x8f9e('0xa')]('/',auth['isAuthenticated'](),controller[_0x8f9e('0xb')]);router[_0x8f9e('0xa')](_0x8f9e('0xc'),auth['isAuthenticated'](),controller[_0x8f9e('0xd')]);router[_0x8f9e('0xa')]('/:id',auth[_0x8f9e('0xe')](),controller[_0x8f9e('0xf')]);router[_0x8f9e('0x10')]('/',auth[_0x8f9e('0xe')](),controller['create']);router[_0x8f9e('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x8f9e('0x12'),auth['isAuthenticated'](),controller[_0x8f9e('0x13')]);module[_0x8f9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 9af4835..ce32831 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(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x7a54,0x106));var _0x47a5=function(_0x43a59a,_0x19ca20){_0x43a59a=_0x43a59a-0x0;var _0x1a1c6e=_0x7a54[_0x43a59a];return _0x1a1c6e;};'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(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x7a54,0x106));var _0x47a5=function(_0x16eee1,_0xfa7601){_0x16eee1=_0x16eee1-0x0;var _0x3698a0=_0x7a54[_0x16eee1];return _0x3698a0;};'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 3627d8d..e2a5ec9 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 _0x86e0=['jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','attributes','fields','length','hasOwnProperty','limit','sort','filters','pick','filter','where','merge','options','JscriptyQuestionReport','include','findAll','rows','show','params','keys','intersection','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto'];(function(_0x448de5,_0x34d9d1){var _0x138c77=function(_0x2e5090){while(--_0x2e5090){_0x448de5['push'](_0x448de5['shift']());}};_0x138c77(++_0x34d9d1);}(_0x86e0,0x83));var _0x086e=function(_0x560773,_0x554e61){_0x560773=_0x560773-0x0;var _0x42c919=_0x86e0[_0x560773];return _0x42c919;};'use strict';var emlformat=require(_0x086e('0x0'));var rimraf=require(_0x086e('0x1'));var zipdir=require(_0x086e('0x2'));var jsonpatch=require(_0x086e('0x3'));var rp=require(_0x086e('0x4'));var moment=require('moment');var BPromise=require(_0x086e('0x5'));var Mustache=require(_0x086e('0x6'));var util=require(_0x086e('0x7'));var path=require('path');var sox=require(_0x086e('0x8'));var csv=require(_0x086e('0x9'));var ejs=require(_0x086e('0xa'));var fs=require('fs');var fs_extra=require(_0x086e('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x086e('0xc'));var jsforce=require(_0x086e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x086e('0x9'));var querystring=require(_0x086e('0xe'));var Papa=require(_0x086e('0xf'));var Redis=require(_0x086e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x086e('0x11'));var as=require(_0x086e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x086e('0x13'));var utils=require(_0x086e('0x14'));var config=require(_0x086e('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d37be,_0x3eb20c){_0x3eb20c=_0x3eb20c||0xcc;return function(_0x20c7ab){if(_0x20c7ab){return _0x3d37be['sendStatus'](_0x3eb20c);}return _0x3d37be['status'](_0x3eb20c)[_0x086e('0x16')]();};}function respondWithResult(_0x5590db,_0x10e7b9){_0x10e7b9=_0x10e7b9||0xc8;return function(_0x249bd2){if(_0x249bd2){return _0x5590db[_0x086e('0x17')](_0x10e7b9)[_0x086e('0x18')](_0x249bd2);}};}function respondWithFilteredResult(_0x144fc2,_0x4a32c6){return function(_0x3e38d1){if(_0x3e38d1){var _0x4d1cb2=typeof _0x4a32c6[_0x086e('0x19')]===_0x086e('0x1a')&&typeof _0x4a32c6['limit']===_0x086e('0x1a');var _0x44d2b2=_0x3e38d1[_0x086e('0x1b')];var _0xbcaa0f=_0x4d1cb2?0x0:_0x4a32c6[_0x086e('0x19')];var _0x22cf2c=_0x4d1cb2?_0x3e38d1[_0x086e('0x1b')]:_0x4a32c6[_0x086e('0x19')]+_0x4a32c6['limit'];var _0x2eb11e;if(_0x22cf2c>=_0x44d2b2){_0x22cf2c=_0x44d2b2;_0x2eb11e=0xc8;}else{_0x2eb11e=0xce;}_0x144fc2[_0x086e('0x17')](_0x2eb11e);return _0x144fc2[_0x086e('0x1c')](_0x086e('0x1d'),_0xbcaa0f+'-'+_0x22cf2c+'/'+_0x44d2b2)[_0x086e('0x18')](_0x3e38d1);}return null;};}function patchUpdates(_0x34dee2){return function(_0x525bb9){try{jsonpatch[_0x086e('0x1e')](_0x525bb9,_0x34dee2,!![]);}catch(_0x2ed7bd){return BPromise[_0x086e('0x1f')](_0x2ed7bd);}return _0x525bb9[_0x086e('0x20')]();};}function saveUpdates(_0x16b269,_0x36f29c){return function(_0x58925a){if(_0x58925a){return _0x58925a[_0x086e('0x21')](_0x16b269)[_0x086e('0x22')](function(_0x119466){return _0x119466;});}return null;};}function removeEntity(_0x32ade5,_0x11a497){return function(_0x3dc250){if(_0x3dc250){return _0x3dc250[_0x086e('0x23')]()[_0x086e('0x22')](function(){_0x32ade5[_0x086e('0x17')](0xcc)[_0x086e('0x16')]();});}};}function handleEntityNotFound(_0x28cbde,_0x3b2e5d){return function(_0x208e20){if(!_0x208e20){_0x28cbde['sendStatus'](0x194);}return _0x208e20;};}function handleError(_0x8e92cd,_0xc1b254){_0xc1b254=_0xc1b254||0x1f4;return function(_0x2aad22){logger[_0x086e('0x24')](_0x2aad22[_0x086e('0x25')]);if(_0x2aad22[_0x086e('0x26')]){delete _0x2aad22[_0x086e('0x26')];}_0x8e92cd[_0x086e('0x17')](_0xc1b254)[_0x086e('0x27')](_0x2aad22);};}exports['index']=function(_0xb67f77,_0x5a98c8){var _0x26918e={},_0x191181={},_0x17006a={'count':0x0,'rows':[]};var _0x4fdb0b=_[_0x086e('0x28')](db['JscriptyQuestionReport'][_0x086e('0x29')],function(_0x22c7c2){return{'name':_0x22c7c2[_0x086e('0x2a')],'type':_0x22c7c2[_0x086e('0x2b')][_0x086e('0x2c')]};});_0x191181[_0x086e('0x2d')]=_['map'](_0x4fdb0b,'name');_0x191181[_0x086e('0x2e')]=_['keys'](_0xb67f77[_0x086e('0x2e')]);_0x191181['filters']=_['intersection'](_0x191181[_0x086e('0x2d')],_0x191181[_0x086e('0x2e')]);_0x26918e[_0x086e('0x2f')]=_['intersection'](_0x191181[_0x086e('0x2d')],qs[_0x086e('0x30')](_0xb67f77[_0x086e('0x2e')][_0x086e('0x30')]));_0x26918e[_0x086e('0x2f')]=_0x26918e[_0x086e('0x2f')][_0x086e('0x31')]?_0x26918e[_0x086e('0x2f')]:_0x191181[_0x086e('0x2d')];if(!_0xb67f77['query'][_0x086e('0x32')]('nolimit')){_0x26918e['limit']=qs[_0x086e('0x33')](_0xb67f77[_0x086e('0x2e')][_0x086e('0x33')]);_0x26918e['offset']=qs[_0x086e('0x19')](_0xb67f77[_0x086e('0x2e')][_0x086e('0x19')]);}_0x26918e['order']=qs[_0x086e('0x34')](_0xb67f77[_0x086e('0x2e')][_0x086e('0x34')]);_0x26918e['where']=qs[_0x086e('0x35')](_[_0x086e('0x36')](_0xb67f77[_0x086e('0x2e')],_0x191181[_0x086e('0x35')]),_0x4fdb0b);if(_0xb67f77[_0x086e('0x2e')][_0x086e('0x37')]){_0x26918e[_0x086e('0x38')]=_['merge'](_0x26918e[_0x086e('0x38')],{'$or':_[_0x086e('0x28')](_0x4fdb0b,function(_0x239276){if(_0x239276[_0x086e('0x2b')]!=='VIRTUAL'){var _0x8dae6a={};_0x8dae6a[_0x239276['name']]={'$like':'%'+_0xb67f77[_0x086e('0x2e')][_0x086e('0x37')]+'%'};return _0x8dae6a;}})});}_0x26918e=_[_0x086e('0x39')]({},_0x26918e,_0xb67f77[_0x086e('0x3a')]);var _0x33a831={'where':_0x26918e[_0x086e('0x38')]};return db[_0x086e('0x3b')][_0x086e('0x1b')](_0x33a831)[_0x086e('0x22')](function(_0x323447){_0x17006a['count']=_0x323447;if(_0xb67f77['query']['includeAll']){_0x26918e[_0x086e('0x3c')]=[{'all':!![]}];}return db[_0x086e('0x3b')][_0x086e('0x3d')](_0x26918e);})[_0x086e('0x22')](function(_0xc9657b){_0x17006a[_0x086e('0x3e')]=_0xc9657b;return _0x17006a;})[_0x086e('0x22')](respondWithFilteredResult(_0x5a98c8,_0x26918e))['catch'](handleError(_0x5a98c8,null));};exports[_0x086e('0x3f')]=function(_0x420816,_0x3f7cda){var _0x5d54c0={'raw':!![],'where':{'id':_0x420816[_0x086e('0x40')]['id']}},_0x18071c={};_0x18071c[_0x086e('0x2d')]=_[_0x086e('0x41')](db[_0x086e('0x3b')][_0x086e('0x29')]);_0x18071c[_0x086e('0x2e')]=_[_0x086e('0x41')](_0x420816[_0x086e('0x2e')]);_0x18071c[_0x086e('0x35')]=_[_0x086e('0x42')](_0x18071c['model'],_0x18071c[_0x086e('0x2e')]);_0x5d54c0[_0x086e('0x2f')]=_[_0x086e('0x42')](_0x18071c[_0x086e('0x2d')],qs[_0x086e('0x30')](_0x420816[_0x086e('0x2e')][_0x086e('0x30')]));_0x5d54c0['attributes']=_0x5d54c0['attributes']['length']?_0x5d54c0[_0x086e('0x2f')]:_0x18071c['model'];if(_0x420816[_0x086e('0x2e')]['includeAll']){_0x5d54c0[_0x086e('0x3c')]=[{'all':!![]}];}_0x5d54c0=_[_0x086e('0x39')]({},_0x5d54c0,_0x420816[_0x086e('0x3a')]);return db[_0x086e('0x3b')][_0x086e('0x43')](_0x5d54c0)[_0x086e('0x22')](handleEntityNotFound(_0x3f7cda,null))[_0x086e('0x22')](respondWithResult(_0x3f7cda,null))[_0x086e('0x44')](handleError(_0x3f7cda,null));};exports[_0x086e('0x45')]=function(_0x530b05,_0x365a6a){return db[_0x086e('0x3b')][_0x086e('0x45')](_0x530b05[_0x086e('0x46')],{})['then'](respondWithResult(_0x365a6a,0xc9))[_0x086e('0x44')](handleError(_0x365a6a,null));};exports[_0x086e('0x21')]=function(_0x52b10,_0x295f3d){if(_0x52b10['body']['id']){delete _0x52b10[_0x086e('0x46')]['id'];}return db[_0x086e('0x3b')]['find']({'where':{'id':_0x52b10[_0x086e('0x40')]['id']}})[_0x086e('0x22')](handleEntityNotFound(_0x295f3d,null))[_0x086e('0x22')](saveUpdates(_0x52b10['body'],null))[_0x086e('0x22')](respondWithResult(_0x295f3d,null))[_0x086e('0x44')](handleError(_0x295f3d,null));};exports[_0x086e('0x23')]=function(_0x120dc1,_0x4f51c7){return db[_0x086e('0x3b')][_0x086e('0x43')]({'where':{'id':_0x120dc1[_0x086e('0x40')]['id']}})[_0x086e('0x22')](handleEntityNotFound(_0x4f51c7,null))[_0x086e('0x22')](removeEntity(_0x4f51c7,null))[_0x086e('0x44')](handleError(_0x4f51c7,null));};exports[_0x086e('0x47')]=function(_0x21e8fe,_0x1ee89d){return db[_0x086e('0x3b')][_0x086e('0x47')]()['then'](respondWithResult(_0x1ee89d,null))[_0x086e('0x44')](handleError(_0x1ee89d,null));}; \ No newline at end of file +var _0x2103=['offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','JscriptyQuestionReport','includeAll','findAll','show','params','keys','include','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json'];(function(_0x2284bf,_0x26aec7){var _0x338594=function(_0xf5c100){while(--_0xf5c100){_0x2284bf['push'](_0x2284bf['shift']());}};_0x338594(++_0x26aec7);}(_0x2103,0xc3));var _0x3210=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x2103[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require(_0x3210('0x0'));var rimraf=require(_0x3210('0x1'));var zipdir=require(_0x3210('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3210('0x3'));var moment=require(_0x3210('0x4'));var BPromise=require(_0x3210('0x5'));var Mustache=require(_0x3210('0x6'));var util=require('util');var path=require(_0x3210('0x7'));var sox=require(_0x3210('0x8'));var csv=require(_0x3210('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3210('0xa'));var _=require(_0x3210('0xb'));var squel=require(_0x3210('0xc'));var crypto=require(_0x3210('0xd'));var jsforce=require(_0x3210('0xe'));var deskjs=require(_0x3210('0xf'));var toCsv=require(_0x3210('0x9'));var querystring=require(_0x3210('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3210('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3210('0x12'));var logger=require(_0x3210('0x13'))(_0x3210('0x14'));var utils=require(_0x3210('0x15'));var config=require(_0x3210('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3210('0x17'))['db'];function respondWithStatusCode(_0x347d4b,_0x1264bb){_0x1264bb=_0x1264bb||0xcc;return function(_0x4fa03d){if(_0x4fa03d){return _0x347d4b['sendStatus'](_0x1264bb);}return _0x347d4b[_0x3210('0x18')](_0x1264bb)[_0x3210('0x19')]();};}function respondWithResult(_0x4534d4,_0x1cd38b){_0x1cd38b=_0x1cd38b||0xc8;return function(_0x66ddf4){if(_0x66ddf4){return _0x4534d4['status'](_0x1cd38b)[_0x3210('0x1a')](_0x66ddf4);}};}function respondWithFilteredResult(_0x3d9b99,_0x2db39b){return function(_0x3300a2){if(_0x3300a2){var _0x21c674=typeof _0x2db39b[_0x3210('0x1b')]===_0x3210('0x1c')&&typeof _0x2db39b['limit']===_0x3210('0x1c');var _0x55b4b5=_0x3300a2[_0x3210('0x1d')];var _0x17b6ee=_0x21c674?0x0:_0x2db39b[_0x3210('0x1b')];var _0x58d3d7=_0x21c674?_0x3300a2['count']:_0x2db39b[_0x3210('0x1b')]+_0x2db39b[_0x3210('0x1e')];var _0x2c4533;if(_0x58d3d7>=_0x55b4b5){_0x58d3d7=_0x55b4b5;_0x2c4533=0xc8;}else{_0x2c4533=0xce;}_0x3d9b99[_0x3210('0x18')](_0x2c4533);return _0x3d9b99['set'](_0x3210('0x1f'),_0x17b6ee+'-'+_0x58d3d7+'/'+_0x55b4b5)[_0x3210('0x1a')](_0x3300a2);}return null;};}function patchUpdates(_0x1060b4){return function(_0x27d847){try{jsonpatch[_0x3210('0x20')](_0x27d847,_0x1060b4,!![]);}catch(_0x3c17d4){return BPromise[_0x3210('0x21')](_0x3c17d4);}return _0x27d847[_0x3210('0x22')]();};}function saveUpdates(_0xaddf70,_0x112063){return function(_0x5cdd9a){if(_0x5cdd9a){return _0x5cdd9a[_0x3210('0x23')](_0xaddf70)[_0x3210('0x24')](function(_0x433cc8){return _0x433cc8;});}return null;};}function removeEntity(_0x589ba3,_0x1b8caf){return function(_0x5b67c8){if(_0x5b67c8){return _0x5b67c8[_0x3210('0x25')]()[_0x3210('0x24')](function(){_0x589ba3['status'](0xcc)[_0x3210('0x19')]();});}};}function handleEntityNotFound(_0x4ced22,_0x34b67e){return function(_0x38be5a){if(!_0x38be5a){_0x4ced22['sendStatus'](0x194);}return _0x38be5a;};}function handleError(_0x344257,_0x1eebf7){_0x1eebf7=_0x1eebf7||0x1f4;return function(_0xf38cd6){logger[_0x3210('0x26')](_0xf38cd6['stack']);if(_0xf38cd6[_0x3210('0x27')]){delete _0xf38cd6['name'];}_0x344257[_0x3210('0x18')](_0x1eebf7)[_0x3210('0x28')](_0xf38cd6);};}exports[_0x3210('0x29')]=function(_0x238702,_0x5103e7){var _0x18091e={},_0x2addba={},_0x47c605={'count':0x0,'rows':[]};var _0x11c3b=_['map'](db['JscriptyQuestionReport'][_0x3210('0x2a')],function(_0x134e19){return{'name':_0x134e19['fieldName'],'type':_0x134e19[_0x3210('0x2b')][_0x3210('0x2c')]};});_0x2addba[_0x3210('0x2d')]=_[_0x3210('0x2e')](_0x11c3b,_0x3210('0x27'));_0x2addba[_0x3210('0x2f')]=_['keys'](_0x238702[_0x3210('0x2f')]);_0x2addba[_0x3210('0x30')]=_[_0x3210('0x31')](_0x2addba[_0x3210('0x2d')],_0x2addba[_0x3210('0x2f')]);_0x18091e[_0x3210('0x32')]=_[_0x3210('0x31')](_0x2addba['model'],qs[_0x3210('0x33')](_0x238702[_0x3210('0x2f')][_0x3210('0x33')]));_0x18091e[_0x3210('0x32')]=_0x18091e[_0x3210('0x32')][_0x3210('0x34')]?_0x18091e['attributes']:_0x2addba[_0x3210('0x2d')];if(!_0x238702['query']['hasOwnProperty'](_0x3210('0x35'))){_0x18091e[_0x3210('0x1e')]=qs[_0x3210('0x1e')](_0x238702[_0x3210('0x2f')][_0x3210('0x1e')]);_0x18091e[_0x3210('0x1b')]=qs['offset'](_0x238702[_0x3210('0x2f')]['offset']);}_0x18091e[_0x3210('0x36')]=qs[_0x3210('0x37')](_0x238702['query'][_0x3210('0x37')]);_0x18091e['where']=qs[_0x3210('0x30')](_[_0x3210('0x38')](_0x238702['query'],_0x2addba['filters']),_0x11c3b);if(_0x238702[_0x3210('0x2f')][_0x3210('0x39')]){_0x18091e[_0x3210('0x3a')]=_[_0x3210('0x3b')](_0x18091e[_0x3210('0x3a')],{'$or':_[_0x3210('0x2e')](_0x11c3b,function(_0xf448eb){if(_0xf448eb[_0x3210('0x2b')]!==_0x3210('0x3c')){var _0x8780c5={};_0x8780c5[_0xf448eb[_0x3210('0x27')]]={'$like':'%'+_0x238702[_0x3210('0x2f')][_0x3210('0x39')]+'%'};return _0x8780c5;}})});}_0x18091e=_['merge']({},_0x18091e,_0x238702[_0x3210('0x3d')]);var _0x5ea2f1={'where':_0x18091e[_0x3210('0x3a')]};return db[_0x3210('0x3e')][_0x3210('0x1d')](_0x5ea2f1)[_0x3210('0x24')](function(_0xc0142e){_0x47c605[_0x3210('0x1d')]=_0xc0142e;if(_0x238702['query'][_0x3210('0x3f')]){_0x18091e['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x3210('0x40')](_0x18091e);})[_0x3210('0x24')](function(_0x109fb3){_0x47c605['rows']=_0x109fb3;return _0x47c605;})[_0x3210('0x24')](respondWithFilteredResult(_0x5103e7,_0x18091e))['catch'](handleError(_0x5103e7,null));};exports[_0x3210('0x41')]=function(_0x624047,_0x5d35da){var _0x20a77e={'raw':!![],'where':{'id':_0x624047[_0x3210('0x42')]['id']}},_0x4eff59={};_0x4eff59[_0x3210('0x2d')]=_[_0x3210('0x43')](db[_0x3210('0x3e')]['rawAttributes']);_0x4eff59['query']=_['keys'](_0x624047['query']);_0x4eff59[_0x3210('0x30')]=_[_0x3210('0x31')](_0x4eff59['model'],_0x4eff59[_0x3210('0x2f')]);_0x20a77e[_0x3210('0x32')]=_[_0x3210('0x31')](_0x4eff59[_0x3210('0x2d')],qs['fields'](_0x624047[_0x3210('0x2f')]['fields']));_0x20a77e[_0x3210('0x32')]=_0x20a77e['attributes'][_0x3210('0x34')]?_0x20a77e['attributes']:_0x4eff59[_0x3210('0x2d')];if(_0x624047[_0x3210('0x2f')][_0x3210('0x3f')]){_0x20a77e[_0x3210('0x44')]=[{'all':!![]}];}_0x20a77e=_[_0x3210('0x3b')]({},_0x20a77e,_0x624047[_0x3210('0x3d')]);return db[_0x3210('0x3e')][_0x3210('0x45')](_0x20a77e)['then'](handleEntityNotFound(_0x5d35da,null))[_0x3210('0x24')](respondWithResult(_0x5d35da,null))[_0x3210('0x46')](handleError(_0x5d35da,null));};exports['create']=function(_0xeb05fe,_0x4ed9cf){return db[_0x3210('0x3e')][_0x3210('0x47')](_0xeb05fe[_0x3210('0x48')],{})['then'](respondWithResult(_0x4ed9cf,0xc9))[_0x3210('0x46')](handleError(_0x4ed9cf,null));};exports[_0x3210('0x23')]=function(_0x25f3f4,_0x329204){if(_0x25f3f4[_0x3210('0x48')]['id']){delete _0x25f3f4[_0x3210('0x48')]['id'];}return db[_0x3210('0x3e')][_0x3210('0x45')]({'where':{'id':_0x25f3f4[_0x3210('0x42')]['id']}})['then'](handleEntityNotFound(_0x329204,null))[_0x3210('0x24')](saveUpdates(_0x25f3f4[_0x3210('0x48')],null))['then'](respondWithResult(_0x329204,null))['catch'](handleError(_0x329204,null));};exports[_0x3210('0x25')]=function(_0x77fd48,_0x12081b){return db[_0x3210('0x3e')][_0x3210('0x45')]({'where':{'id':_0x77fd48[_0x3210('0x42')]['id']}})[_0x3210('0x24')](handleEntityNotFound(_0x12081b,null))['then'](removeEntity(_0x12081b,null))['catch'](handleError(_0x12081b,null));};exports['describe']=function(_0x1872c4,_0x55728f){return db[_0x3210('0x3e')][_0x3210('0x49')]()[_0x3210('0x24')](respondWithResult(_0x55728f,null))['catch'](handleError(_0x55728f,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 84aee36..4c82fc3 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 _0x6104=['JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define'];(function(_0x5e6c43,_0x132a12){var _0x23d90e=function(_0x279b49){while(--_0x279b49){_0x5e6c43['push'](_0x5e6c43['shift']());}};_0x23d90e(++_0x132a12);}(_0x6104,0x1b4));var _0x4610=function(_0x4552fa,_0x46cded){_0x4552fa=_0x4552fa-0x0;var _0x3c77bb=_0x6104[_0x4552fa];return _0x3c77bb;};'use strict';var _=require(_0x4610('0x0'));var util=require(_0x4610('0x1'));var logger=require(_0x4610('0x2'))('api');var moment=require(_0x4610('0x3'));var BPromise=require(_0x4610('0x4'));var rp=require(_0x4610('0x5'));var fs=require('fs');var path=require(_0x4610('0x6'));var rimraf=require(_0x4610('0x7'));var config=require(_0x4610('0x8'));var attributes=require(_0x4610('0x9'));module[_0x4610('0xa')]=function(_0x281219,_0x5a338f){return _0x281219[_0x4610('0xb')](_0x4610('0xc'),attributes,{'tableName':_0x4610('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa27c=['define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0xb149b7,_0x26066d){var _0x1f504c=function(_0x3f50fc){while(--_0x3f50fc){_0xb149b7['push'](_0xb149b7['shift']());}};_0x1f504c(++_0x26066d);}(_0xa27c,0x12c));var _0xca27=function(_0x1582fe,_0x4a3d11){_0x1582fe=_0x1582fe-0x0;var _0x2a1075=_0xa27c[_0x1582fe];return _0x2a1075;};'use strict';var _=require(_0xca27('0x0'));var util=require(_0xca27('0x1'));var logger=require(_0xca27('0x2'))(_0xca27('0x3'));var moment=require(_0xca27('0x4'));var BPromise=require(_0xca27('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xca27('0x6'));var rimraf=require('rimraf');var config=require(_0xca27('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0xfe71d8,_0x50ad68){return _0xfe71d8[_0xca27('0x8')](_0xca27('0x9'),attributes,{'tableName':_0xca27('0xa'),'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 84d272a..cc781a9 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 _0x3860=['request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','JscriptyQuestionReport,\x20%s,\x20%s'];(function(_0x1a9390,_0x3339e6){var _0x2b4514=function(_0x1c07d5){while(--_0x1c07d5){_0x1a9390['push'](_0x1a9390['shift']());}};_0x2b4514(++_0x3339e6);}(_0x3860,0xae));var _0x0386=function(_0x3891c0,_0x4d2913){_0x3891c0=_0x3891c0-0x0;var _0x32bc90=_0x3860[_0x3891c0];return _0x32bc90;};'use strict';var _=require(_0x0386('0x0'));var util=require(_0x0386('0x1'));var moment=require(_0x0386('0x2'));var BPromise=require(_0x0386('0x3'));var rs=require(_0x0386('0x4'));var fs=require('fs');var Redis=require(_0x0386('0x5'));var db=require(_0x0386('0x6'))['db'];var utils=require(_0x0386('0x7'));var logger=require(_0x0386('0x8'))(_0x0386('0x9'));var config=require(_0x0386('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x0386('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43db0f,_0x430fb6,_0x4d97d6){return new BPromise(function(_0x8818d1,_0x2aa9bd){return client['request'](_0x43db0f,_0x4d97d6)[_0x0386('0xc')](function(_0x6be5f6){logger[_0x0386('0xd')](_0x0386('0xe'),_0x430fb6,_0x0386('0xf'));logger[_0x0386('0x10')](_0x0386('0x11'),_0x430fb6,_0x0386('0xf'),JSON[_0x0386('0x12')](_0x6be5f6));if(_0x6be5f6[_0x0386('0x13')]){if(_0x6be5f6[_0x0386('0x13')]['code']===0x1f4){logger[_0x0386('0x13')](_0x0386('0xe'),_0x430fb6,_0x6be5f6[_0x0386('0x13')][_0x0386('0x14')]);return _0x2aa9bd(_0x6be5f6[_0x0386('0x13')][_0x0386('0x14')]);}logger[_0x0386('0x13')](_0x0386('0xe'),_0x430fb6,_0x6be5f6[_0x0386('0x13')]['message']);return _0x8818d1(_0x6be5f6[_0x0386('0x13')]['message']);}else{logger['info'](_0x0386('0xe'),_0x430fb6,'request\x20sent');_0x8818d1(_0x6be5f6['result'][_0x0386('0x14')]);}})['catch'](function(_0x447f33){logger[_0x0386('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x430fb6,_0x447f33);_0x2aa9bd(_0x447f33);});});} \ No newline at end of file +var _0x0727=['client','http','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1b3a9e,_0x3b6e29){var _0x53cdc2=function(_0x4b14ec){while(--_0x4b14ec){_0x1b3a9e['push'](_0x1b3a9e['shift']());}};_0x53cdc2(++_0x3b6e29);}(_0x0727,0x15d));var _0x7072=function(_0xee3051,_0xbe4f18){_0xee3051=_0xee3051-0x0;var _0x139e81=_0x0727[_0xee3051];return _0x139e81;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7072('0x0'));var BPromise=require('bluebird');var rs=require(_0x7072('0x1'));var fs=require('fs');var Redis=require(_0x7072('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x7072('0x3'));var logger=require(_0x7072('0x4'))(_0x7072('0x5'));var config=require(_0x7072('0x6'));var jayson=require(_0x7072('0x7'));var client=jayson[_0x7072('0x8')][_0x7072('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x254bbf,_0xeec918,_0x2f7257){return new BPromise(function(_0x3025e7,_0x33c327){return client['request'](_0x254bbf,_0x2f7257)['then'](function(_0x393cb0){logger[_0x7072('0xa')](_0x7072('0xb'),_0xeec918,'request\x20sent');logger[_0x7072('0xc')](_0x7072('0xd'),_0xeec918,_0x7072('0xe'),JSON[_0x7072('0xf')](_0x393cb0));if(_0x393cb0[_0x7072('0x10')]){if(_0x393cb0['error'][_0x7072('0x11')]===0x1f4){logger[_0x7072('0x10')](_0x7072('0xb'),_0xeec918,_0x393cb0[_0x7072('0x10')][_0x7072('0x12')]);return _0x33c327(_0x393cb0['error']['message']);}logger[_0x7072('0x10')](_0x7072('0xb'),_0xeec918,_0x393cb0[_0x7072('0x10')][_0x7072('0x12')]);return _0x3025e7(_0x393cb0[_0x7072('0x10')][_0x7072('0x12')]);}else{logger[_0x7072('0xa')](_0x7072('0xb'),_0xeec918,_0x7072('0xe'));_0x3025e7(_0x393cb0[_0x7072('0x13')][_0x7072('0x12')]);}})[_0x7072('0x14')](function(_0x36181a){logger['error'](_0x7072('0xb'),_0xeec918,_0x36181a);_0x33c327(_0x36181a);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 68f93ff..731d7c7 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 _0xbe32=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','/:id','show','/:id/questions','getQuestions','post','create'];(function(_0x1ca576,_0x97486f){var _0x327b6a=function(_0x565d36){while(--_0x565d36){_0x1ca576['push'](_0x1ca576['shift']());}};_0x327b6a(++_0x97486f);}(_0xbe32,0x1d2));var _0x2be3=function(_0x1057e2,_0x231169){_0x1057e2=_0x1057e2-0x0;var _0x50a2a5=_0xbe32[_0x1057e2];return _0x50a2a5;};'use strict';var multer=require(_0x2be3('0x0'));var util=require(_0x2be3('0x1'));var path=require(_0x2be3('0x2'));var timeout=require(_0x2be3('0x3'));var express=require(_0x2be3('0x4'));var router=express[_0x2be3('0x5')]();var fs_extra=require(_0x2be3('0x6'));var auth=require(_0x2be3('0x7'));var interaction=require(_0x2be3('0x8'));var config=require('../../config/environment');var controller=require(_0x2be3('0x9'));router[_0x2be3('0xa')]('/',auth[_0x2be3('0xb')](),controller['index']);router['get']('/describe',auth[_0x2be3('0xb')](),controller['describe']);router[_0x2be3('0xa')](_0x2be3('0xc'),auth[_0x2be3('0xb')](),controller[_0x2be3('0xd')]);router['get'](_0x2be3('0xe'),auth[_0x2be3('0xb')](),controller[_0x2be3('0xf')]);router[_0x2be3('0x10')]('/',auth[_0x2be3('0xb')](),controller[_0x2be3('0x11')]);router['put'](_0x2be3('0xc'),auth[_0x2be3('0xb')](),controller[_0x2be3('0x12')]);router[_0x2be3('0x13')](_0x2be3('0xc'),auth['isAuthenticated'](),controller[_0x2be3('0x14')]);module[_0x2be3('0x15')]=router; \ No newline at end of file +var _0x8706=['create','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','show','getQuestions','post'];(function(_0x543448,_0x17000a){var _0x1824ad=function(_0x3015b3){while(--_0x3015b3){_0x543448['push'](_0x543448['shift']());}};_0x1824ad(++_0x17000a);}(_0x8706,0x164));var _0x6870=function(_0x2ebc31,_0x336378){_0x2ebc31=_0x2ebc31-0x0;var _0x4a96ef=_0x8706[_0x2ebc31];return _0x4a96ef;};'use strict';var multer=require(_0x6870('0x0'));var util=require(_0x6870('0x1'));var path=require('path');var timeout=require(_0x6870('0x2'));var express=require(_0x6870('0x3'));var router=express[_0x6870('0x4')]();var fs_extra=require(_0x6870('0x5'));var auth=require(_0x6870('0x6'));var interaction=require(_0x6870('0x7'));var config=require(_0x6870('0x8'));var controller=require(_0x6870('0x9'));router[_0x6870('0xa')]('/',auth[_0x6870('0xb')](),controller[_0x6870('0xc')]);router[_0x6870('0xa')](_0x6870('0xd'),auth[_0x6870('0xb')](),controller[_0x6870('0xe')]);router[_0x6870('0xa')]('/:id',auth[_0x6870('0xb')](),controller[_0x6870('0xf')]);router[_0x6870('0xa')]('/:id/questions',auth[_0x6870('0xb')](),controller[_0x6870('0x10')]);router[_0x6870('0x11')]('/',auth['isAuthenticated'](),controller[_0x6870('0x12')]);router['put'](_0x6870('0x13'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x6870('0x13'),auth['isAuthenticated'](),controller[_0x6870('0x14')]);module[_0x6870('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index b293ade..28009aa 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 _0x39f7=['moment','sequelize','exports','DATE','setDataValue','starttime','endtime','format','STRING'];(function(_0x52a08b,_0x12388d){var _0x2c6670=function(_0x253827){while(--_0x253827){_0x52a08b['push'](_0x52a08b['shift']());}};_0x2c6670(++_0x12388d);}(_0x39f7,0xcf));var _0x739f=function(_0x4cfc1d,_0x2c0927){_0x4cfc1d=_0x4cfc1d-0x0;var _0x1c01a0=_0x39f7[_0x4cfc1d];return _0x1c01a0;};'use strict';var moment=require(_0x739f('0x0'));var Sequelize=require(_0x739f('0x1'));module[_0x739f('0x2')]={'starttime':{'type':Sequelize[_0x739f('0x3')],'set':function(_0x70bd33){this[_0x739f('0x4')](_0x739f('0x5'),_0x70bd33);this[_0x739f('0x4')](_0x739f('0x6'),moment()[_0x739f('0x7')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x739f('0x3')]},'membername':{'type':Sequelize[_0x739f('0x8')]},'projectname':{'type':Sequelize[_0x739f('0x8')]},'queue':{'type':Sequelize[_0x739f('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x739f('0x8')]},'calleridnum':{'type':Sequelize[_0x739f('0x8')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x183f=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','DATE','setDataValue','endtime'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x183f,0x9d));var _0xf183=function(_0x2ffc29,_0x5770cf){_0x2ffc29=_0x2ffc29-0x0;var _0x4bf99f=_0x183f[_0x2ffc29];return _0x4bf99f;};'use strict';var moment=require(_0xf183('0x0'));var Sequelize=require(_0xf183('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xf183('0x2')],'set':function(_0x189241){this[_0xf183('0x3')]('starttime',_0x189241);this[_0xf183('0x3')](_0xf183('0x4'),moment()[_0xf183('0x5')](_0xf183('0x6')));}},'endtime':{'type':Sequelize[_0xf183('0x2')]},'membername':{'type':Sequelize[_0xf183('0x7')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xf183('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf183('0x7')]},'calleridnum':{'type':Sequelize[_0xf183('0x7')]},'completed':{'type':Sequelize[_0xf183('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 432559c..69bd20a 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 _0xfc4b=['status','undefined','offset','count','limit','set','Content-Range','json','apply','then','destroy','stack','name','map','JscriptySessionReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','show','params','intersection','length','find','catch','create','body','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','nolimit','SessionId','findAll','rows','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x9a0b66,_0x3e2037){var _0x4fcc09=function(_0x34c33d){while(--_0x34c33d){_0x9a0b66['push'](_0x9a0b66['shift']());}};_0x4fcc09(++_0x3e2037);}(_0xfc4b,0x7f));var _0xbfc4=function(_0x3e543c,_0x4c9f3f){_0x3e543c=_0x3e543c-0x0;var _0xda19de=_0xfc4b[_0x3e543c];return _0xda19de;};'use strict';var emlformat=require(_0xbfc4('0x0'));var rimraf=require(_0xbfc4('0x1'));var zipdir=require(_0xbfc4('0x2'));var jsonpatch=require(_0xbfc4('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbfc4('0x4'));var Mustache=require(_0xbfc4('0x5'));var util=require(_0xbfc4('0x6'));var path=require(_0xbfc4('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbfc4('0x8'));var fs=require('fs');var fs_extra=require(_0xbfc4('0x9'));var _=require(_0xbfc4('0xa'));var squel=require(_0xbfc4('0xb'));var crypto=require('crypto');var jsforce=require(_0xbfc4('0xc'));var deskjs=require(_0xbfc4('0xd'));var toCsv=require(_0xbfc4('0xe'));var querystring=require(_0xbfc4('0xf'));var Papa=require(_0xbfc4('0x10'));var Redis=require(_0xbfc4('0x11'));var authService=require(_0xbfc4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbfc4('0x13'));var hardwareService=require(_0xbfc4('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xbfc4('0x15'));var config=require(_0xbfc4('0x16'));var licenseUtil=require(_0xbfc4('0x17'));var db=require(_0xbfc4('0x18'))['db'];function respondWithStatusCode(_0x305d86,_0xc22c35){_0xc22c35=_0xc22c35||0xcc;return function(_0x5b2563){if(_0x5b2563){return _0x305d86[_0xbfc4('0x19')](_0xc22c35);}return _0x305d86['status'](_0xc22c35)[_0xbfc4('0x1a')]();};}function respondWithResult(_0x234e33,_0x363e2f){_0x363e2f=_0x363e2f||0xc8;return function(_0x5b67a1){if(_0x5b67a1){return _0x234e33[_0xbfc4('0x1b')](_0x363e2f)['json'](_0x5b67a1);}};}function respondWithFilteredResult(_0x227446,_0x1af053){return function(_0xd1310d){if(_0xd1310d){var _0x32e09f=typeof _0x1af053['offset']===_0xbfc4('0x1c')&&typeof _0x1af053['limit']===_0xbfc4('0x1c');var _0x567dee=_0xd1310d['count'];var _0x2f6993=_0x32e09f?0x0:_0x1af053[_0xbfc4('0x1d')];var _0x1f0593=_0x32e09f?_0xd1310d[_0xbfc4('0x1e')]:_0x1af053[_0xbfc4('0x1d')]+_0x1af053[_0xbfc4('0x1f')];var _0x1d3a8c;if(_0x1f0593>=_0x567dee){_0x1f0593=_0x567dee;_0x1d3a8c=0xc8;}else{_0x1d3a8c=0xce;}_0x227446[_0xbfc4('0x1b')](_0x1d3a8c);return _0x227446[_0xbfc4('0x20')](_0xbfc4('0x21'),_0x2f6993+'-'+_0x1f0593+'/'+_0x567dee)[_0xbfc4('0x22')](_0xd1310d);}return null;};}function patchUpdates(_0x17ac00){return function(_0x24a8a2){try{jsonpatch[_0xbfc4('0x23')](_0x24a8a2,_0x17ac00,!![]);}catch(_0x4abed2){return BPromise['reject'](_0x4abed2);}return _0x24a8a2['save']();};}function saveUpdates(_0x33e47f,_0x467990){return function(_0x5432d5){if(_0x5432d5){return _0x5432d5['update'](_0x33e47f)[_0xbfc4('0x24')](function(_0x21340c){return _0x21340c;});}return null;};}function removeEntity(_0x1d7187,_0x55347d){return function(_0x5de787){if(_0x5de787){return _0x5de787[_0xbfc4('0x25')]()[_0xbfc4('0x24')](function(){_0x1d7187[_0xbfc4('0x1b')](0xcc)[_0xbfc4('0x1a')]();});}};}function handleEntityNotFound(_0x1cb930,_0x40d793){return function(_0x120466){if(!_0x120466){_0x1cb930[_0xbfc4('0x19')](0x194);}return _0x120466;};}function handleError(_0x50f74c,_0x54ca39){_0x54ca39=_0x54ca39||0x1f4;return function(_0x1c5d76){logger['error'](_0x1c5d76[_0xbfc4('0x26')]);if(_0x1c5d76[_0xbfc4('0x27')]){delete _0x1c5d76['name'];}_0x50f74c[_0xbfc4('0x1b')](_0x54ca39)['send'](_0x1c5d76);};}exports['index']=function(_0x3e94db,_0x53f20d){var _0xe610b6={},_0x414666={},_0x5956b9={'count':0x0,'rows':[]};var _0x5b5e7b=_[_0xbfc4('0x28')](db[_0xbfc4('0x29')][_0xbfc4('0x2a')],function(_0x2bdbed){return{'name':_0x2bdbed[_0xbfc4('0x2b')],'type':_0x2bdbed[_0xbfc4('0x2c')]['key']};});_0x414666[_0xbfc4('0x2d')]=_[_0xbfc4('0x28')](_0x5b5e7b,_0xbfc4('0x27'));_0x414666[_0xbfc4('0x2e')]=_[_0xbfc4('0x2f')](_0x3e94db['query']);_0x414666[_0xbfc4('0x30')]=_['intersection'](_0x414666[_0xbfc4('0x2d')],_0x414666[_0xbfc4('0x2e')]);_0xe610b6[_0xbfc4('0x31')]=_['intersection'](_0x414666[_0xbfc4('0x2d')],qs['fields'](_0x3e94db[_0xbfc4('0x2e')][_0xbfc4('0x32')]));_0xe610b6[_0xbfc4('0x31')]=_0xe610b6[_0xbfc4('0x31')]['length']?_0xe610b6[_0xbfc4('0x31')]:_0x414666['model'];if(!_0x3e94db[_0xbfc4('0x2e')]['hasOwnProperty']('nolimit')){_0xe610b6[_0xbfc4('0x1f')]=qs[_0xbfc4('0x1f')](_0x3e94db[_0xbfc4('0x2e')][_0xbfc4('0x1f')]);_0xe610b6[_0xbfc4('0x1d')]=qs['offset'](_0x3e94db[_0xbfc4('0x2e')]['offset']);}_0xe610b6[_0xbfc4('0x33')]=qs[_0xbfc4('0x34')](_0x3e94db['query'][_0xbfc4('0x34')]);_0xe610b6[_0xbfc4('0x35')]=qs[_0xbfc4('0x30')](_[_0xbfc4('0x36')](_0x3e94db[_0xbfc4('0x2e')],_0x414666[_0xbfc4('0x30')]),_0x5b5e7b);if(_0x3e94db[_0xbfc4('0x2e')][_0xbfc4('0x37')]){_0xe610b6[_0xbfc4('0x35')]=_[_0xbfc4('0x38')](_0xe610b6[_0xbfc4('0x35')],{'$or':_[_0xbfc4('0x28')](_0x5b5e7b,function(_0x2f90b8){if(_0x2f90b8[_0xbfc4('0x2c')]!==_0xbfc4('0x39')){var _0x329ae4={};_0x329ae4[_0x2f90b8[_0xbfc4('0x27')]]={'$like':'%'+_0x3e94db[_0xbfc4('0x2e')][_0xbfc4('0x37')]+'%'};return _0x329ae4;}})});}_0xe610b6=_[_0xbfc4('0x38')]({},_0xe610b6,_0x3e94db[_0xbfc4('0x3a')]);var _0x42beaf={'where':_0xe610b6[_0xbfc4('0x35')]};return db['JscriptySessionReport'][_0xbfc4('0x1e')](_0x42beaf)['then'](function(_0x24bd05){_0x5956b9[_0xbfc4('0x1e')]=_0x24bd05;if(_0x3e94db[_0xbfc4('0x2e')][_0xbfc4('0x3b')]){_0xe610b6[_0xbfc4('0x3c')]=[{'all':!![]}];}return db[_0xbfc4('0x29')]['findAll'](_0xe610b6);})[_0xbfc4('0x24')](function(_0x16da7c){_0x5956b9['rows']=_0x16da7c;return _0x5956b9;})[_0xbfc4('0x24')](respondWithFilteredResult(_0x53f20d,_0xe610b6))['catch'](handleError(_0x53f20d,null));};exports[_0xbfc4('0x3d')]=function(_0x1c059c,_0x3b667a){var _0x286d2a={'raw':!![],'where':{'id':_0x1c059c[_0xbfc4('0x3e')]['id']}},_0x2de757={};_0x2de757[_0xbfc4('0x2d')]=_['keys'](db[_0xbfc4('0x29')][_0xbfc4('0x2a')]);_0x2de757[_0xbfc4('0x2e')]=_[_0xbfc4('0x2f')](_0x1c059c[_0xbfc4('0x2e')]);_0x2de757[_0xbfc4('0x30')]=_[_0xbfc4('0x3f')](_0x2de757[_0xbfc4('0x2d')],_0x2de757[_0xbfc4('0x2e')]);_0x286d2a['attributes']=_[_0xbfc4('0x3f')](_0x2de757['model'],qs[_0xbfc4('0x32')](_0x1c059c[_0xbfc4('0x2e')][_0xbfc4('0x32')]));_0x286d2a[_0xbfc4('0x31')]=_0x286d2a[_0xbfc4('0x31')][_0xbfc4('0x40')]?_0x286d2a[_0xbfc4('0x31')]:_0x2de757[_0xbfc4('0x2d')];if(_0x1c059c[_0xbfc4('0x2e')][_0xbfc4('0x3b')]){_0x286d2a[_0xbfc4('0x3c')]=[{'all':!![]}];}_0x286d2a=_['merge']({},_0x286d2a,_0x1c059c[_0xbfc4('0x3a')]);return db[_0xbfc4('0x29')][_0xbfc4('0x41')](_0x286d2a)[_0xbfc4('0x24')](handleEntityNotFound(_0x3b667a,null))[_0xbfc4('0x24')](respondWithResult(_0x3b667a,null))[_0xbfc4('0x42')](handleError(_0x3b667a,null));};exports[_0xbfc4('0x43')]=function(_0x458359,_0x3b425a){return db['JscriptySessionReport'][_0xbfc4('0x43')](_0x458359[_0xbfc4('0x44')],{})[_0xbfc4('0x24')](respondWithResult(_0x3b425a,0xc9))['catch'](handleError(_0x3b425a,null));};exports['update']=function(_0x28eb05,_0x3c19c3){if(_0x28eb05[_0xbfc4('0x44')]['id']){delete _0x28eb05[_0xbfc4('0x44')]['id'];}return db['JscriptySessionReport']['find']({'where':{'id':_0x28eb05[_0xbfc4('0x3e')]['id']}})[_0xbfc4('0x24')](handleEntityNotFound(_0x3c19c3,null))[_0xbfc4('0x24')](saveUpdates(_0x28eb05['body'],null))[_0xbfc4('0x24')](respondWithResult(_0x3c19c3,null))[_0xbfc4('0x42')](handleError(_0x3c19c3,null));};exports[_0xbfc4('0x25')]=function(_0x5c6b2f,_0x184c1b){return db[_0xbfc4('0x29')][_0xbfc4('0x41')]({'where':{'id':_0x5c6b2f[_0xbfc4('0x3e')]['id']}})[_0xbfc4('0x24')](handleEntityNotFound(_0x184c1b,null))[_0xbfc4('0x24')](removeEntity(_0x184c1b,null))[_0xbfc4('0x42')](handleError(_0x184c1b,null));};exports['describe']=function(_0x2f6817,_0x39cda3){return db[_0xbfc4('0x29')]['describe']()['then'](respondWithResult(_0x39cda3,null))[_0xbfc4('0x42')](handleError(_0x39cda3,null));};exports[_0xbfc4('0x45')]=function(_0x460f3d,_0x4abb4a,_0x33b1a9){var _0x476c1b={'raw':!![],'where':{}};var _0x5bf1c0={};var _0x4ffc5a={'count':0x0,'rows':[]};return db[_0xbfc4('0x29')][_0xbfc4('0x46')]({'where':{'id':_0x460f3d[_0xbfc4('0x3e')]['id']}})[_0xbfc4('0x24')](handleEntityNotFound(_0x4abb4a,null))[_0xbfc4('0x24')](function(_0xee1dc3){if(_0xee1dc3){_0x5bf1c0[_0xbfc4('0x2d')]=_[_0xbfc4('0x2f')](db[_0xbfc4('0x47')][_0xbfc4('0x2a')]);_0x5bf1c0[_0xbfc4('0x2e')]=_[_0xbfc4('0x2f')](_0x460f3d[_0xbfc4('0x2e')]);_0x5bf1c0[_0xbfc4('0x30')]=_[_0xbfc4('0x3f')](_0x5bf1c0[_0xbfc4('0x2d')],_0x5bf1c0[_0xbfc4('0x2e')]);_0x476c1b[_0xbfc4('0x31')]=_['intersection'](_0x5bf1c0[_0xbfc4('0x2d')],qs[_0xbfc4('0x32')](_0x460f3d[_0xbfc4('0x2e')][_0xbfc4('0x32')]));_0x476c1b[_0xbfc4('0x31')]=_0x476c1b['attributes'][_0xbfc4('0x40')]?_0x476c1b[_0xbfc4('0x31')]:_0x5bf1c0['model'];if(!_0x460f3d[_0xbfc4('0x2e')][_0xbfc4('0x48')](_0xbfc4('0x49'))){_0x476c1b[_0xbfc4('0x1f')]=qs['limit'](_0x460f3d[_0xbfc4('0x2e')][_0xbfc4('0x1f')]);_0x476c1b['offset']=qs[_0xbfc4('0x1d')](_0x460f3d[_0xbfc4('0x2e')][_0xbfc4('0x1d')]);}_0x476c1b[_0xbfc4('0x33')]=qs['sort'](_0x460f3d[_0xbfc4('0x2e')][_0xbfc4('0x34')]);_0x476c1b[_0xbfc4('0x35')]=qs[_0xbfc4('0x30')](_['pick'](_0x460f3d[_0xbfc4('0x2e')],_0x5bf1c0[_0xbfc4('0x30')]));_0x476c1b[_0xbfc4('0x35')][_0xbfc4('0x4a')]=_0xee1dc3['id'];if(_0x460f3d[_0xbfc4('0x2e')][_0xbfc4('0x37')]){_0x476c1b[_0xbfc4('0x35')]=_[_0xbfc4('0x38')](_0x476c1b['where'],{'$or':_[_0xbfc4('0x28')](_0x476c1b['attributes'],function(_0x37f635){var _0x1360b4={};_0x1360b4[_0x37f635]={'$like':'%'+_0x460f3d[_0xbfc4('0x2e')]['filter']+'%'};return _0x1360b4;})});}_0x476c1b=_[_0xbfc4('0x38')]({},_0x476c1b,_0x460f3d[_0xbfc4('0x3a')]);return db[_0xbfc4('0x47')][_0xbfc4('0x1e')]({'where':_0x476c1b[_0xbfc4('0x35')]})[_0xbfc4('0x24')](function(_0x3d8ae4){_0x4ffc5a[_0xbfc4('0x1e')]=_0x3d8ae4;if(_0x460f3d[_0xbfc4('0x2e')][_0xbfc4('0x3b')]){_0x476c1b[_0xbfc4('0x3c')]=[{'all':!![]}];}return db[_0xbfc4('0x47')][_0xbfc4('0x4b')](_0x476c1b);})[_0xbfc4('0x24')](function(_0x40c9eb){_0x4ffc5a[_0xbfc4('0x4c')]=_0x40c9eb;return _0x4ffc5a;});}})[_0xbfc4('0x24')](respondWithFilteredResult(_0x4abb4a,_0x476c1b))[_0xbfc4('0x42')](handleError(_0x4abb4a,null));}; \ No newline at end of file +var _0x715b=['findOne','JscriptyQuestionReport','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','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','undefined','count','limit','set','Content-Range','reject','save','then','destroy','error','name','JscriptySessionReport','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','filter','include','findAll','rows','catch','includeAll','options','find','create','body','update','params','describe','getQuestions'];(function(_0x577adf,_0x44e709){var _0x5d0ba3=function(_0x543b90){while(--_0x543b90){_0x577adf['push'](_0x577adf['shift']());}};_0x5d0ba3(++_0x44e709);}(_0x715b,0xa7));var _0xb715=function(_0x406077,_0x172056){_0x406077=_0x406077-0x0;var _0x25cd31=_0x715b[_0x406077];return _0x25cd31;};'use strict';var emlformat=require(_0xb715('0x0'));var rimraf=require(_0xb715('0x1'));var zipdir=require(_0xb715('0x2'));var jsonpatch=require(_0xb715('0x3'));var rp=require(_0xb715('0x4'));var moment=require(_0xb715('0x5'));var BPromise=require(_0xb715('0x6'));var Mustache=require(_0xb715('0x7'));var util=require(_0xb715('0x8'));var path=require(_0xb715('0x9'));var sox=require(_0xb715('0xa'));var csv=require('to-csv');var ejs=require(_0xb715('0xb'));var fs=require('fs');var fs_extra=require(_0xb715('0xc'));var _=require(_0xb715('0xd'));var squel=require(_0xb715('0xe'));var crypto=require(_0xb715('0xf'));var jsforce=require(_0xb715('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xb715('0x11'));var querystring=require(_0xb715('0x12'));var Papa=require(_0xb715('0x13'));var Redis=require(_0xb715('0x14'));var authService=require(_0xb715('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xb715('0x16'));var hardwareService=require(_0xb715('0x17'));var logger=require(_0xb715('0x18'))(_0xb715('0x19'));var utils=require('../../config/utils');var config=require(_0xb715('0x1a'));var licenseUtil=require(_0xb715('0x1b'));var db=require(_0xb715('0x1c'))['db'];function respondWithStatusCode(_0xf92f0b,_0xd38ef0){_0xd38ef0=_0xd38ef0||0xcc;return function(_0x4920bf){if(_0x4920bf){return _0xf92f0b[_0xb715('0x1d')](_0xd38ef0);}return _0xf92f0b[_0xb715('0x1e')](_0xd38ef0)[_0xb715('0x1f')]();};}function respondWithResult(_0x2145a7,_0x33b883){_0x33b883=_0x33b883||0xc8;return function(_0x1a7abf){if(_0x1a7abf){return _0x2145a7[_0xb715('0x1e')](_0x33b883)[_0xb715('0x20')](_0x1a7abf);}};}function respondWithFilteredResult(_0x2da373,_0x300dbc){return function(_0x5d10d1){if(_0x5d10d1){var _0xb084d9=typeof _0x300dbc[_0xb715('0x21')]==='undefined'&&typeof _0x300dbc['limit']===_0xb715('0x22');var _0x4a784d=_0x5d10d1[_0xb715('0x23')];var _0x3f3366=_0xb084d9?0x0:_0x300dbc[_0xb715('0x21')];var _0x519402=_0xb084d9?_0x5d10d1['count']:_0x300dbc[_0xb715('0x21')]+_0x300dbc[_0xb715('0x24')];var _0x456b2b;if(_0x519402>=_0x4a784d){_0x519402=_0x4a784d;_0x456b2b=0xc8;}else{_0x456b2b=0xce;}_0x2da373['status'](_0x456b2b);return _0x2da373[_0xb715('0x25')](_0xb715('0x26'),_0x3f3366+'-'+_0x519402+'/'+_0x4a784d)[_0xb715('0x20')](_0x5d10d1);}return null;};}function patchUpdates(_0x4556a6){return function(_0x41368d){try{jsonpatch['apply'](_0x41368d,_0x4556a6,!![]);}catch(_0x159000){return BPromise[_0xb715('0x27')](_0x159000);}return _0x41368d[_0xb715('0x28')]();};}function saveUpdates(_0x23cc80,_0x38f9e2){return function(_0x389acf){if(_0x389acf){return _0x389acf['update'](_0x23cc80)[_0xb715('0x29')](function(_0x188b89){return _0x188b89;});}return null;};}function removeEntity(_0x10ba61,_0x3d8fc7){return function(_0x12af55){if(_0x12af55){return _0x12af55[_0xb715('0x2a')]()[_0xb715('0x29')](function(){_0x10ba61[_0xb715('0x1e')](0xcc)[_0xb715('0x1f')]();});}};}function handleEntityNotFound(_0x27d7d5,_0x1ce071){return function(_0x17b268){if(!_0x17b268){_0x27d7d5[_0xb715('0x1d')](0x194);}return _0x17b268;};}function handleError(_0x36fa4b,_0x1d0fc3){_0x1d0fc3=_0x1d0fc3||0x1f4;return function(_0x13aed3){logger[_0xb715('0x2b')](_0x13aed3['stack']);if(_0x13aed3[_0xb715('0x2c')]){delete _0x13aed3[_0xb715('0x2c')];}_0x36fa4b[_0xb715('0x1e')](_0x1d0fc3)['send'](_0x13aed3);};}exports['index']=function(_0x20bf83,_0x4a258f){var _0x4950c3={},_0x5643c4={},_0x3f3ec8={'count':0x0,'rows':[]};var _0x36ce19=_['map'](db[_0xb715('0x2d')][_0xb715('0x2e')],function(_0x8c2b89){return{'name':_0x8c2b89[_0xb715('0x2f')],'type':_0x8c2b89['type'][_0xb715('0x30')]};});_0x5643c4[_0xb715('0x31')]=_[_0xb715('0x32')](_0x36ce19,_0xb715('0x2c'));_0x5643c4[_0xb715('0x33')]=_[_0xb715('0x34')](_0x20bf83[_0xb715('0x33')]);_0x5643c4[_0xb715('0x35')]=_['intersection'](_0x5643c4[_0xb715('0x31')],_0x5643c4[_0xb715('0x33')]);_0x4950c3[_0xb715('0x36')]=_[_0xb715('0x37')](_0x5643c4[_0xb715('0x31')],qs[_0xb715('0x38')](_0x20bf83[_0xb715('0x33')][_0xb715('0x38')]));_0x4950c3['attributes']=_0x4950c3[_0xb715('0x36')][_0xb715('0x39')]?_0x4950c3[_0xb715('0x36')]:_0x5643c4[_0xb715('0x31')];if(!_0x20bf83[_0xb715('0x33')][_0xb715('0x3a')](_0xb715('0x3b'))){_0x4950c3[_0xb715('0x24')]=qs[_0xb715('0x24')](_0x20bf83[_0xb715('0x33')][_0xb715('0x24')]);_0x4950c3['offset']=qs[_0xb715('0x21')](_0x20bf83[_0xb715('0x33')]['offset']);}_0x4950c3[_0xb715('0x3c')]=qs[_0xb715('0x3d')](_0x20bf83[_0xb715('0x33')][_0xb715('0x3d')]);_0x4950c3['where']=qs[_0xb715('0x35')](_[_0xb715('0x3e')](_0x20bf83[_0xb715('0x33')],_0x5643c4['filters']),_0x36ce19);if(_0x20bf83[_0xb715('0x33')]['filter']){_0x4950c3['where']=_[_0xb715('0x3f')](_0x4950c3[_0xb715('0x40')],{'$or':_[_0xb715('0x32')](_0x36ce19,function(_0x1693c8){if(_0x1693c8['type']!=='VIRTUAL'){var _0x497439={};_0x497439[_0x1693c8['name']]={'$like':'%'+_0x20bf83[_0xb715('0x33')][_0xb715('0x41')]+'%'};return _0x497439;}})});}_0x4950c3=_[_0xb715('0x3f')]({},_0x4950c3,_0x20bf83['options']);var _0xbb172c={'where':_0x4950c3[_0xb715('0x40')]};return db[_0xb715('0x2d')][_0xb715('0x23')](_0xbb172c)[_0xb715('0x29')](function(_0x19d803){_0x3f3ec8[_0xb715('0x23')]=_0x19d803;if(_0x20bf83[_0xb715('0x33')]['includeAll']){_0x4950c3[_0xb715('0x42')]=[{'all':!![]}];}return db[_0xb715('0x2d')][_0xb715('0x43')](_0x4950c3);})[_0xb715('0x29')](function(_0x267704){_0x3f3ec8[_0xb715('0x44')]=_0x267704;return _0x3f3ec8;})['then'](respondWithFilteredResult(_0x4a258f,_0x4950c3))[_0xb715('0x45')](handleError(_0x4a258f,null));};exports['show']=function(_0xd09eee,_0x1689bb){var _0x583a7e={'raw':!![],'where':{'id':_0xd09eee['params']['id']}},_0x37ce1d={};_0x37ce1d[_0xb715('0x31')]=_[_0xb715('0x34')](db[_0xb715('0x2d')]['rawAttributes']);_0x37ce1d[_0xb715('0x33')]=_[_0xb715('0x34')](_0xd09eee[_0xb715('0x33')]);_0x37ce1d['filters']=_[_0xb715('0x37')](_0x37ce1d[_0xb715('0x31')],_0x37ce1d[_0xb715('0x33')]);_0x583a7e[_0xb715('0x36')]=_[_0xb715('0x37')](_0x37ce1d[_0xb715('0x31')],qs['fields'](_0xd09eee[_0xb715('0x33')][_0xb715('0x38')]));_0x583a7e[_0xb715('0x36')]=_0x583a7e[_0xb715('0x36')][_0xb715('0x39')]?_0x583a7e[_0xb715('0x36')]:_0x37ce1d['model'];if(_0xd09eee[_0xb715('0x33')][_0xb715('0x46')]){_0x583a7e[_0xb715('0x42')]=[{'all':!![]}];}_0x583a7e=_[_0xb715('0x3f')]({},_0x583a7e,_0xd09eee[_0xb715('0x47')]);return db['JscriptySessionReport'][_0xb715('0x48')](_0x583a7e)[_0xb715('0x29')](handleEntityNotFound(_0x1689bb,null))['then'](respondWithResult(_0x1689bb,null))[_0xb715('0x45')](handleError(_0x1689bb,null));};exports['create']=function(_0x160f45,_0x241fa9){return db[_0xb715('0x2d')][_0xb715('0x49')](_0x160f45[_0xb715('0x4a')],{})[_0xb715('0x29')](respondWithResult(_0x241fa9,0xc9))['catch'](handleError(_0x241fa9,null));};exports[_0xb715('0x4b')]=function(_0x50392b,_0x370a40){if(_0x50392b[_0xb715('0x4a')]['id']){delete _0x50392b[_0xb715('0x4a')]['id'];}return db[_0xb715('0x2d')]['find']({'where':{'id':_0x50392b[_0xb715('0x4c')]['id']}})[_0xb715('0x29')](handleEntityNotFound(_0x370a40,null))[_0xb715('0x29')](saveUpdates(_0x50392b['body'],null))[_0xb715('0x29')](respondWithResult(_0x370a40,null))['catch'](handleError(_0x370a40,null));};exports[_0xb715('0x2a')]=function(_0x4d9bcb,_0xed582f){return db[_0xb715('0x2d')][_0xb715('0x48')]({'where':{'id':_0x4d9bcb[_0xb715('0x4c')]['id']}})[_0xb715('0x29')](handleEntityNotFound(_0xed582f,null))[_0xb715('0x29')](removeEntity(_0xed582f,null))['catch'](handleError(_0xed582f,null));};exports['describe']=function(_0x46b662,_0x234a63){return db[_0xb715('0x2d')][_0xb715('0x4d')]()[_0xb715('0x29')](respondWithResult(_0x234a63,null))['catch'](handleError(_0x234a63,null));};exports[_0xb715('0x4e')]=function(_0x297032,_0x5e9a19,_0x454de4){var _0x3bb94f={'raw':!![],'where':{}};var _0x16f9a1={};var _0x1d7a8e={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xb715('0x4f')]({'where':{'id':_0x297032[_0xb715('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5e9a19,null))[_0xb715('0x29')](function(_0x5c0c65){if(_0x5c0c65){_0x16f9a1[_0xb715('0x31')]=_[_0xb715('0x34')](db[_0xb715('0x50')][_0xb715('0x2e')]);_0x16f9a1['query']=_[_0xb715('0x34')](_0x297032[_0xb715('0x33')]);_0x16f9a1[_0xb715('0x35')]=_[_0xb715('0x37')](_0x16f9a1[_0xb715('0x31')],_0x16f9a1['query']);_0x3bb94f[_0xb715('0x36')]=_['intersection'](_0x16f9a1[_0xb715('0x31')],qs[_0xb715('0x38')](_0x297032['query'][_0xb715('0x38')]));_0x3bb94f[_0xb715('0x36')]=_0x3bb94f[_0xb715('0x36')]['length']?_0x3bb94f[_0xb715('0x36')]:_0x16f9a1[_0xb715('0x31')];if(!_0x297032[_0xb715('0x33')]['hasOwnProperty'](_0xb715('0x3b'))){_0x3bb94f[_0xb715('0x24')]=qs[_0xb715('0x24')](_0x297032[_0xb715('0x33')]['limit']);_0x3bb94f['offset']=qs[_0xb715('0x21')](_0x297032[_0xb715('0x33')][_0xb715('0x21')]);}_0x3bb94f[_0xb715('0x3c')]=qs['sort'](_0x297032[_0xb715('0x33')][_0xb715('0x3d')]);_0x3bb94f[_0xb715('0x40')]=qs[_0xb715('0x35')](_[_0xb715('0x3e')](_0x297032[_0xb715('0x33')],_0x16f9a1[_0xb715('0x35')]));_0x3bb94f[_0xb715('0x40')][_0xb715('0x51')]=_0x5c0c65['id'];if(_0x297032[_0xb715('0x33')][_0xb715('0x41')]){_0x3bb94f[_0xb715('0x40')]=_['merge'](_0x3bb94f['where'],{'$or':_[_0xb715('0x32')](_0x3bb94f[_0xb715('0x36')],function(_0x52d055){var _0x53c93b={};_0x53c93b[_0x52d055]={'$like':'%'+_0x297032[_0xb715('0x33')][_0xb715('0x41')]+'%'};return _0x53c93b;})});}_0x3bb94f=_[_0xb715('0x3f')]({},_0x3bb94f,_0x297032['options']);return db[_0xb715('0x50')]['count']({'where':_0x3bb94f['where']})[_0xb715('0x29')](function(_0x487a71){_0x1d7a8e[_0xb715('0x23')]=_0x487a71;if(_0x297032[_0xb715('0x33')][_0xb715('0x46')]){_0x3bb94f['include']=[{'all':!![]}];}return db[_0xb715('0x50')]['findAll'](_0x3bb94f);})[_0xb715('0x29')](function(_0x1e143f){_0x1d7a8e[_0xb715('0x44')]=_0x1e143f;return _0x1d7a8e;});}})[_0xb715('0x29')](respondWithFilteredResult(_0x5e9a19,_0x3bb94f))['catch'](handleError(_0x5e9a19,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index f8c3502..399bbb9 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 _0xa46e=['api','moment','bluebird','path','../../config/environment','exports','define','report_jscripty_sessions','lodash','util'];(function(_0x36436d,_0x20292c){var _0x34615d=function(_0x5447af){while(--_0x5447af){_0x36436d['push'](_0x36436d['shift']());}};_0x34615d(++_0x20292c);}(_0xa46e,0x8a));var _0xea46=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xa46e[_0xd0b415];return _0x2bdf2c;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var logger=require('../../config/logger')(_0xea46('0x2'));var moment=require(_0xea46('0x3'));var BPromise=require(_0xea46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea46('0x5'));var rimraf=require('rimraf');var config=require(_0xea46('0x6'));var attributes=require('./jscriptySessionReport.attributes');module[_0xea46('0x7')]=function(_0x528404,_0x10bee5){return _0x528404[_0xea46('0x8')]('JscriptySessionReport',attributes,{'tableName':_0xea46('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4745=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions','lodash','util','../../config/logger'];(function(_0x25c090,_0x411e12){var _0x51569b=function(_0x30db3d){while(--_0x30db3d){_0x25c090['push'](_0x25c090['shift']());}};_0x51569b(++_0x411e12);}(_0x4745,0x1e7));var _0x5474=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x4745[_0x43d11d];return _0x38cd08;};'use strict';var _=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var logger=require(_0x5474('0x2'))(_0x5474('0x3'));var moment=require(_0x5474('0x4'));var BPromise=require(_0x5474('0x5'));var rp=require(_0x5474('0x6'));var fs=require('fs');var path=require(_0x5474('0x7'));var rimraf=require(_0x5474('0x8'));var config=require(_0x5474('0x9'));var attributes=require(_0x5474('0xa'));module[_0x5474('0xb')]=function(_0x4e7ce7,_0x3d1e1){return _0x4e7ce7[_0x5474('0xc')]('JscriptySessionReport',attributes,{'tableName':_0x5474('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index ff1ddef..e028476 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 _0x0295=['client','http','then','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4f6add,_0x22b994){var _0x5adf5e=function(_0x1c9358){while(--_0x1c9358){_0x4f6add['push'](_0x4f6add['shift']());}};_0x5adf5e(++_0x22b994);}(_0x0295,0x1f0));var _0x5029=function(_0xb1b616,_0x3b9023){_0xb1b616=_0xb1b616-0x0;var _0x1259b0=_0x0295[_0xb1b616];return _0x1259b0;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('JscriptySessionReport,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file +var _0x7ee1=['request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0xb68695,_0x1881a4){var _0x15a817=function(_0x4d04d6){while(--_0x4d04d6){_0xb68695['push'](_0xb68695['shift']());}};_0x15a817(++_0x1881a4);}(_0x7ee1,0x8d));var _0x17ee=function(_0xfd5334,_0x40d048){_0xfd5334=_0xfd5334-0x0;var _0x58dee5=_0x7ee1[_0xfd5334];return _0x58dee5;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x17ee('0x1'));var fs=require('fs');var Redis=require(_0x17ee('0x2'));var db=require(_0x17ee('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x17ee('0x4'))(_0x17ee('0x5'));var config=require(_0x17ee('0x6'));var jayson=require(_0x17ee('0x7'));var client=jayson['client'][_0x17ee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29b9eb,_0x54b4f6,_0x3f61af){return new BPromise(function(_0x57e1d1,_0x3d767b){return client[_0x17ee('0x9')](_0x29b9eb,_0x3f61af)[_0x17ee('0xa')](function(_0x4af369){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x54b4f6,_0x17ee('0xb'));logger['debug'](_0x17ee('0xc'),_0x54b4f6,_0x17ee('0xb'),JSON[_0x17ee('0xd')](_0x4af369));if(_0x4af369[_0x17ee('0xe')]){if(_0x4af369['error'][_0x17ee('0xf')]===0x1f4){logger['error'](_0x17ee('0x10'),_0x54b4f6,_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);return _0x3d767b(_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);}logger[_0x17ee('0xe')](_0x17ee('0x10'),_0x54b4f6,_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);return _0x57e1d1(_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x54b4f6,'request\x20sent');_0x57e1d1(_0x4af369['result'][_0x17ee('0x11')]);}})[_0x17ee('0x12')](function(_0x1b87c3){logger[_0x17ee('0xe')](_0x17ee('0x10'),_0x54b4f6,_0x1b87c3);_0x3d767b(_0x1b87c3);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index b725000..586a89f 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 _0xa261=['path','connect-timeout','express','Router','fs-extra','./license.controller','get','index','put','/:id','update','multer'];(function(_0x258651,_0x1e4c89){var _0x35dfa2=function(_0x41f491){while(--_0x41f491){_0x258651['push'](_0x258651['shift']());}};_0x35dfa2(++_0x1e4c89);}(_0xa261,0x1a3));var _0x1a26=function(_0x236df9,_0x5c6b2b){_0x236df9=_0x236df9-0x0;var _0x42612f=_0xa261[_0x236df9];return _0x42612f;};'use strict';var multer=require(_0x1a26('0x0'));var util=require('util');var path=require(_0x1a26('0x1'));var timeout=require(_0x1a26('0x2'));var express=require(_0x1a26('0x3'));var router=express[_0x1a26('0x4')]();var fs_extra=require(_0x1a26('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1a26('0x6'));router[_0x1a26('0x7')]('/',controller[_0x1a26('0x8')]);router[_0x1a26('0x9')](_0x1a26('0xa'),auth['isAuthenticated'](),controller[_0x1a26('0xb')]);module['exports']=router; \ No newline at end of file +var _0x6347=['update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./license.controller','get','/:id','isAuthenticated'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x6347,0x1c9));var _0x7634=function(_0x4b8886,_0x13b9eb){_0x4b8886=_0x4b8886-0x0;var _0x39d8f4=_0x6347[_0x4b8886];return _0x39d8f4;};'use strict';var multer=require(_0x7634('0x0'));var util=require(_0x7634('0x1'));var path=require('path');var timeout=require(_0x7634('0x2'));var express=require(_0x7634('0x3'));var router=express[_0x7634('0x4')]();var fs_extra=require(_0x7634('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7634('0x6'));var config=require('../../config/environment');var controller=require(_0x7634('0x7'));router[_0x7634('0x8')]('/',controller['index']);router['put'](_0x7634('0x9'),auth[_0x7634('0xa')](),controller[_0x7634('0xb')]);module[_0x7634('0xc')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 7a1dfdd..d76f5cd 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 _0x74ae=['STRING','INTEGER','sequelize','TEXT'];(function(_0x12fb0e,_0x5d3f3a){var _0x419f2a=function(_0x299a8c){while(--_0x299a8c){_0x12fb0e['push'](_0x12fb0e['shift']());}};_0x419f2a(++_0x5d3f3a);}(_0x74ae,0x19a));var _0xe74a=function(_0x22e11c,_0x32ef49){_0x22e11c=_0x22e11c-0x0;var _0x4fd8ed=_0x74ae[_0x22e11c];return _0x4fd8ed;};'use strict';var Sequelize=require(_0xe74a('0x0'));module['exports']={'license':{'type':Sequelize[_0xe74a('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xe74a('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xe74a('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x14b5=['exports','STRING','INTEGER'];(function(_0x263b7f,_0x125eec){var _0x34be59=function(_0x310595){while(--_0x310595){_0x263b7f['push'](_0x263b7f['shift']());}};_0x34be59(++_0x125eec);}(_0x14b5,0x159));var _0x514b=function(_0x38d183,_0x14f199){_0x38d183=_0x38d183-0x0;var _0x4ba68e=_0x14b5[_0x38d183];return _0x4ba68e;};'use strict';var Sequelize=require('sequelize');module[_0x514b('0x0')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x514b('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x514b('0x2')],'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 b15c9b0..4bdfff4 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 _0x7a54=['count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','model','License','query','keys','intersection','attributes','fields','length','options','getLicense','body','find','checkLicense','key','demo','catch','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'];(function(_0x4beb08,_0x38a1e4){var _0x56a591=function(_0x26d077){while(--_0x26d077){_0x4beb08['push'](_0x4beb08['shift']());}};_0x56a591(++_0x38a1e4);}(_0x7a54,0x106));var _0x47a5=function(_0x36c930,_0xa91248){_0x36c930=_0x36c930-0x0;var _0x29a361=_0x7a54[_0x36c930];return _0x29a361;};'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);};}var utilLicense=require(_0x47a5('0x14'));exports[_0x47a5('0x29')]=function(_0x16631f,_0x361bfa){var _0x1127f8={'raw':!![],'where':{'id':0x1}},_0x11a4fa={};_0x11a4fa[_0x47a5('0x2a')]=_['keys'](db[_0x47a5('0x2b')]['rawAttributes']);_0x11a4fa[_0x47a5('0x2c')]=_[_0x47a5('0x2d')](_0x16631f[_0x47a5('0x2c')]);_0x11a4fa['filters']=_[_0x47a5('0x2e')](_0x11a4fa[_0x47a5('0x2a')],_0x11a4fa[_0x47a5('0x2c')]);_0x1127f8[_0x47a5('0x2f')]=_['intersection'](_0x11a4fa['model'],qs[_0x47a5('0x30')](_0x16631f[_0x47a5('0x2c')]['fields']));_0x1127f8['attributes']=_0x1127f8[_0x47a5('0x2f')][_0x47a5('0x31')]?_0x1127f8['attributes']:_0x11a4fa[_0x47a5('0x2a')];_0x1127f8=_['merge']({},_0x1127f8,_0x16631f[_0x47a5('0x32')]);return utilLicense[_0x47a5('0x33')](_0x1127f8)['then'](respondWithResult(_0x361bfa,null))['catch'](handleError(_0x361bfa,null));};exports[_0x47a5('0x22')]=function(_0x5910bb,_0x403028){if(_0x5910bb[_0x47a5('0x34')]['id']){delete _0x5910bb[_0x47a5('0x34')]['id'];}return db['License'][_0x47a5('0x35')]({'where':{'id':_0x5910bb['params']['id']}})['then'](handleEntityNotFound(_0x403028,null))[_0x47a5('0x23')](function(_0x5a8a7c){var _0x25cce0=_0x5a8a7c['get']({'plain':!![]});return utilLicense[_0x47a5('0x36')](_0x25cce0,_0x5910bb[_0x47a5('0x34')][_0x47a5('0x37')]);})[_0x47a5('0x23')](function(_0x36add5){if(!_0x36add5[_0x47a5('0x38')]){return saveUpdates(_0x5910bb[_0x47a5('0x34')],null);}return _0x36add5;})[_0x47a5('0x23')](respondWithResult(_0x403028,null))[_0x47a5('0x39')](handleError(_0x403028,null));}; \ No newline at end of file +var _0x1261=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','index','model','License','query','intersection','fields','attributes','merge','options','getLicense','catch','body','find','params','get','key','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis'];(function(_0x3eba32,_0x5839d8){var _0x2c3469=function(_0x84f03c){while(--_0x84f03c){_0x3eba32['push'](_0x3eba32['shift']());}};_0x2c3469(++_0x5839d8);}(_0x1261,0x144));var _0x1126=function(_0x137f1a,_0x2887df){_0x137f1a=_0x137f1a-0x0;var _0x439923=_0x1261[_0x137f1a];return _0x439923;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}var utilLicense=require('../../config/license/util');exports[_0x1126('0x29')]=function(_0x23d2bc,_0x4a334a){var _0x3fa694={'raw':!![],'where':{'id':0x1}},_0x4bf807={};_0x4bf807[_0x1126('0x2a')]=_['keys'](db[_0x1126('0x2b')]['rawAttributes']);_0x4bf807[_0x1126('0x2c')]=_['keys'](_0x23d2bc['query']);_0x4bf807['filters']=_[_0x1126('0x2d')](_0x4bf807[_0x1126('0x2a')],_0x4bf807[_0x1126('0x2c')]);_0x3fa694['attributes']=_[_0x1126('0x2d')](_0x4bf807[_0x1126('0x2a')],qs['fields'](_0x23d2bc[_0x1126('0x2c')][_0x1126('0x2e')]));_0x3fa694[_0x1126('0x2f')]=_0x3fa694[_0x1126('0x2f')]['length']?_0x3fa694['attributes']:_0x4bf807[_0x1126('0x2a')];_0x3fa694=_[_0x1126('0x30')]({},_0x3fa694,_0x23d2bc[_0x1126('0x31')]);return utilLicense[_0x1126('0x32')](_0x3fa694)['then'](respondWithResult(_0x4a334a,null))[_0x1126('0x33')](handleError(_0x4a334a,null));};exports[_0x1126('0x24')]=function(_0x313ebe,_0x22436c){if(_0x313ebe[_0x1126('0x34')]['id']){delete _0x313ebe['body']['id'];}return db[_0x1126('0x2b')][_0x1126('0x35')]({'where':{'id':_0x313ebe[_0x1126('0x36')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0x22436c,null))['then'](function(_0x4ca51c){var _0x22827a=_0x4ca51c[_0x1126('0x37')]({'plain':!![]});return utilLicense['checkLicense'](_0x22827a,_0x313ebe[_0x1126('0x34')][_0x1126('0x38')]);})[_0x1126('0x25')](function(_0x5c08b9){if(!_0x5c08b9['demo']){return saveUpdates(_0x313ebe[_0x1126('0x34')],null);}return _0x5c08b9;})[_0x1126('0x25')](respondWithResult(_0x22436c,null))[_0x1126('0x33')](handleError(_0x22436c,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 0ec300f..f8be26d 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 _0x392a=['path','../../config/environment','./license.attributes','exports','define','License','license','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x49253b,_0x10de1e){var _0x207882=function(_0x193596){while(--_0x193596){_0x49253b['push'](_0x49253b['shift']());}};_0x207882(++_0x10de1e);}(_0x392a,0x85));var _0xa392=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x392a[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xa392('0x0'));var util=require(_0xa392('0x1'));var logger=require(_0xa392('0x2'))(_0xa392('0x3'));var moment=require(_0xa392('0x4'));var BPromise=require(_0xa392('0x5'));var rp=require(_0xa392('0x6'));var fs=require('fs');var path=require(_0xa392('0x7'));var rimraf=require('rimraf');var config=require(_0xa392('0x8'));var attributes=require(_0xa392('0x9'));module[_0xa392('0xa')]=function(_0x5561b4,_0x296aa0){return _0x5561b4[_0xa392('0xb')](_0xa392('0xc'),attributes,{'tableName':_0xa392('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5917=['api','moment','bluebird','request-promise','rimraf','../../config/environment','define','License','lodash','util','../../config/logger'];(function(_0x156484,_0x47bf36){var _0x4c714f=function(_0x20c48e){while(--_0x20c48e){_0x156484['push'](_0x156484['shift']());}};_0x4c714f(++_0x47bf36);}(_0x5917,0x1c0));var _0x7591=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5917[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7591('0x0'));var util=require(_0x7591('0x1'));var logger=require(_0x7591('0x2'))(_0x7591('0x3'));var moment=require(_0x7591('0x4'));var BPromise=require(_0x7591('0x5'));var rp=require(_0x7591('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7591('0x7'));var config=require(_0x7591('0x8'));var attributes=require('./license.attributes');module['exports']=function(_0x486fec,_0x686e45){return _0x486fec[_0x7591('0x9')](_0x7591('0xa'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index fded9f1..d24a269 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 _0x3227=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird'];(function(_0x2f02d4,_0x27b24a){var _0x4b707d=function(_0x52f3ba){while(--_0x52f3ba){_0x2f02d4['push'](_0x2f02d4['shift']());}};_0x4b707d(++_0x27b24a);}(_0x3227,0x6b));var _0x7322=function(_0x495a37,_0xe2afb2){_0x495a37=_0x495a37-0x0;var _0x1d1b72=_0x3227[_0x495a37];return _0x1d1b72;};'use strict';var _=require('lodash');var util=require(_0x7322('0x0'));var moment=require(_0x7322('0x1'));var BPromise=require(_0x7322('0x2'));var rs=require(_0x7322('0x3'));var fs=require('fs');var Redis=require(_0x7322('0x4'));var db=require(_0x7322('0x5'))['db'];var utils=require(_0x7322('0x6'));var logger=require(_0x7322('0x7'))('rpc');var config=require(_0x7322('0x8'));var jayson=require(_0x7322('0x9'));var client=jayson[_0x7322('0xa')][_0x7322('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3fb687,_0x11ce21,_0x26d244){return new BPromise(function(_0x477af3,_0x43fb72){return client['request'](_0x3fb687,_0x26d244)[_0x7322('0xc')](function(_0x141140){logger['info'](_0x7322('0xd'),_0x11ce21,_0x7322('0xe'));logger['debug'](_0x7322('0xf'),_0x11ce21,_0x7322('0xe'),JSON[_0x7322('0x10')](_0x141140));if(_0x141140['error']){if(_0x141140[_0x7322('0x11')][_0x7322('0x12')]===0x1f4){logger['error'](_0x7322('0xd'),_0x11ce21,_0x141140[_0x7322('0x11')][_0x7322('0x13')]);return _0x43fb72(_0x141140[_0x7322('0x11')][_0x7322('0x13')]);}logger[_0x7322('0x11')]('License,\x20%s,\x20%s',_0x11ce21,_0x141140[_0x7322('0x11')]['message']);return _0x477af3(_0x141140['error'][_0x7322('0x13')]);}else{logger['info'](_0x7322('0xd'),_0x11ce21,_0x7322('0xe'));_0x477af3(_0x141140[_0x7322('0x14')][_0x7322('0x13')]);}})[_0x7322('0x15')](function(_0x46aff3){logger['error'](_0x7322('0xd'),_0x11ce21,_0x46aff3);_0x43fb72(_0x46aff3);});});} \ No newline at end of file +var _0x892c=['http','request','then','info','License,\x20%s,\x20%s','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x545055,_0x481c6d){var _0x40fbd6=function(_0x2e1626){while(--_0x2e1626){_0x545055['push'](_0x545055['shift']());}};_0x40fbd6(++_0x481c6d);}(_0x892c,0xb5));var _0xc892=function(_0x2acbb3,_0x29e1b4){_0x2acbb3=_0x2acbb3-0x0;var _0x5c0cc7=_0x892c[_0x2acbb3];return _0x5c0cc7;};'use strict';var _=require('lodash');var util=require(_0xc892('0x0'));var moment=require(_0xc892('0x1'));var BPromise=require(_0xc892('0x2'));var rs=require(_0xc892('0x3'));var fs=require('fs');var Redis=require(_0xc892('0x4'));var db=require(_0xc892('0x5'))['db'];var utils=require(_0xc892('0x6'));var logger=require(_0xc892('0x7'))(_0xc892('0x8'));var config=require(_0xc892('0x9'));var jayson=require(_0xc892('0xa'));var client=jayson['client'][_0xc892('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58a1f7,_0x3b982f,_0x3ba040){return new BPromise(function(_0x4e41a3,_0x45b139){return client[_0xc892('0xc')](_0x58a1f7,_0x3ba040)[_0xc892('0xd')](function(_0x396262){logger[_0xc892('0xe')](_0xc892('0xf'),_0x3b982f,'request\x20sent');logger['debug'](_0xc892('0x10'),_0x3b982f,'request\x20sent',JSON[_0xc892('0x11')](_0x396262));if(_0x396262[_0xc892('0x12')]){if(_0x396262[_0xc892('0x12')][_0xc892('0x13')]===0x1f4){logger[_0xc892('0x12')](_0xc892('0xf'),_0x3b982f,_0x396262[_0xc892('0x12')][_0xc892('0x14')]);return _0x45b139(_0x396262[_0xc892('0x12')][_0xc892('0x14')]);}logger[_0xc892('0x12')](_0xc892('0xf'),_0x3b982f,_0x396262[_0xc892('0x12')][_0xc892('0x14')]);return _0x4e41a3(_0x396262['error'][_0xc892('0x14')]);}else{logger[_0xc892('0xe')](_0xc892('0xf'),_0x3b982f,_0xc892('0x15'));_0x4e41a3(_0x396262[_0xc892('0x16')][_0xc892('0x14')]);}})[_0xc892('0x17')](function(_0x51a1c6){logger[_0xc892('0x12')](_0xc892('0xf'),_0x3b982f,_0x51a1c6);_0x45b139(_0x51a1c6);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 7eb3215..9deebe9 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 _0x781a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','/:id/out_servers','addSmtp','addInteraction','/:id/applications','addApplications','/:id/send','addAgents','put','removeDispositions','delete','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x781a,0x91));var _0xa781=function(_0x30bee6,_0x7021d2){_0x30bee6=_0x30bee6-0x0;var _0x1c565a=_0x781a[_0x30bee6];return _0x1c565a;};'use strict';var multer=require(_0xa781('0x0'));var util=require(_0xa781('0x1'));var path=require(_0xa781('0x2'));var timeout=require(_0xa781('0x3'));var express=require(_0xa781('0x4'));var router=express[_0xa781('0x5')]();var fs_extra=require(_0xa781('0x6'));var auth=require(_0xa781('0x7'));var interaction=require(_0xa781('0x8'));var config=require('../../config/environment');var controller=require(_0xa781('0x9'));router[_0xa781('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa781('0xb'),auth[_0xa781('0xc')](),controller[_0xa781('0xd')]);router[_0xa781('0xa')](_0xa781('0xe'),auth[_0xa781('0xc')](),controller[_0xa781('0xf')]);router[_0xa781('0xa')](_0xa781('0x10'),auth[_0xa781('0xc')](),controller[_0xa781('0x11')]);router[_0xa781('0xa')](_0xa781('0x12'),auth[_0xa781('0xc')](),controller[_0xa781('0x13')]);router[_0xa781('0xa')](_0xa781('0x14'),auth[_0xa781('0xc')](),controller['getImap']);router[_0xa781('0xa')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0xa781('0x15')]);router[_0xa781('0xa')](_0xa781('0x16'),auth['isAuthenticated'](),controller[_0xa781('0x17')]);router[_0xa781('0xa')]('/:id/applications',auth[_0xa781('0xc')](),controller[_0xa781('0x18')]);router[_0xa781('0xa')](_0xa781('0x19'),auth[_0xa781('0xc')](),controller['getMessages']);router[_0xa781('0xa')](_0xa781('0x1a'),auth['isAuthenticated'](),controller[_0xa781('0x1b')]);router['get'](_0xa781('0x1c'),auth['isAuthenticated'](),controller[_0xa781('0x1d')]);router[_0xa781('0x1e')](_0xa781('0x10'),auth['isAuthenticated'](),controller[_0xa781('0x1f')]);router[_0xa781('0x1e')](_0xa781('0x12'),auth[_0xa781('0xc')](),controller[_0xa781('0x20')]);router['post']('/',auth[_0xa781('0xc')](),controller[_0xa781('0x21')]);router[_0xa781('0x1e')]('/:id/in_servers',auth[_0xa781('0xc')](),controller[_0xa781('0x22')]);router[_0xa781('0x1e')](_0xa781('0x23'),auth[_0xa781('0xc')](),controller[_0xa781('0x24')]);router[_0xa781('0x1e')]('/:id/interactions',auth[_0xa781('0xc')](),controller[_0xa781('0x25')]);router['post'](_0xa781('0x26'),auth[_0xa781('0xc')](),controller[_0xa781('0x27')]);router[_0xa781('0x1e')](_0xa781('0x28'),auth[_0xa781('0xc')](),controller['send']);router[_0xa781('0x1e')](_0xa781('0x1c'),auth[_0xa781('0xc')](),controller[_0xa781('0x29')]);router[_0xa781('0x2a')](_0xa781('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xa781('0x10'),auth[_0xa781('0xc')](),controller[_0xa781('0x2b')]);router[_0xa781('0x2c')](_0xa781('0x12'),auth[_0xa781('0xc')](),controller['removeAnswers']);router['delete'](_0xa781('0x14'),auth['isAuthenticated'](),controller[_0xa781('0x2d')]);router[_0xa781('0x2c')](_0xa781('0x23'),auth[_0xa781('0xc')](),controller[_0xa781('0x2e')]);router[_0xa781('0x2c')]('/:id',auth[_0xa781('0xc')](),controller[_0xa781('0x2f')]);router[_0xa781('0x2c')](_0xa781('0x1c'),auth[_0xa781('0xc')](),controller[_0xa781('0x30')]);module[_0xa781('0x31')]=router; \ No newline at end of file +var _0x9faa=['/:id/messages','getMessages','verifySmtp','/:id/users','getAgents','/:id/dispositions','addDisposition','post','addAnswer','create','addImap','/:id/out_servers','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeSmtp','destroy','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/interactions','/:id/applications','getApplications'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9faa,0x146));var _0xa9fa=function(_0xebf5,_0x3754f3){_0xebf5=_0xebf5-0x0;var _0x4c52bf=_0x9faa[_0xebf5];return _0x4c52bf;};'use strict';var multer=require(_0xa9fa('0x0'));var util=require(_0xa9fa('0x1'));var path=require('path');var timeout=require(_0xa9fa('0x2'));var express=require(_0xa9fa('0x3'));var router=express[_0xa9fa('0x4')]();var fs_extra=require(_0xa9fa('0x5'));var auth=require(_0xa9fa('0x6'));var interaction=require(_0xa9fa('0x7'));var config=require(_0xa9fa('0x8'));var controller=require(_0xa9fa('0x9'));router[_0xa9fa('0xa')]('/',auth[_0xa9fa('0xb')](),controller['index']);router['get'](_0xa9fa('0xc'),auth[_0xa9fa('0xb')](),controller[_0xa9fa('0xd')]);router['get'](_0xa9fa('0xe'),auth['isAuthenticated'](),controller[_0xa9fa('0xf')]);router[_0xa9fa('0xa')]('/:id/dispositions',auth[_0xa9fa('0xb')](),controller[_0xa9fa('0x10')]);router[_0xa9fa('0xa')](_0xa9fa('0x11'),auth[_0xa9fa('0xb')](),controller[_0xa9fa('0x12')]);router[_0xa9fa('0xa')](_0xa9fa('0x13'),auth[_0xa9fa('0xb')](),controller[_0xa9fa('0x14')]);router[_0xa9fa('0xa')]('/:id/out_servers',auth[_0xa9fa('0xb')](),controller['getSmtp']);router[_0xa9fa('0xa')](_0xa9fa('0x15'),auth[_0xa9fa('0xb')](),controller['getInteractions']);router[_0xa9fa('0xa')](_0xa9fa('0x16'),auth['isAuthenticated'](),controller[_0xa9fa('0x17')]);router[_0xa9fa('0xa')](_0xa9fa('0x18'),auth['isAuthenticated'](),controller[_0xa9fa('0x19')]);router[_0xa9fa('0xa')]('/:id/verify',auth['isAuthenticated'](),controller[_0xa9fa('0x1a')]);router['get'](_0xa9fa('0x1b'),auth['isAuthenticated'](),controller[_0xa9fa('0x1c')]);router['post'](_0xa9fa('0x1d'),auth[_0xa9fa('0xb')](),controller[_0xa9fa('0x1e')]);router[_0xa9fa('0x1f')](_0xa9fa('0x11'),auth['isAuthenticated'](),controller[_0xa9fa('0x20')]);router[_0xa9fa('0x1f')]('/',auth[_0xa9fa('0xb')](),controller[_0xa9fa('0x21')]);router[_0xa9fa('0x1f')](_0xa9fa('0x13'),auth[_0xa9fa('0xb')](),controller[_0xa9fa('0x22')]);router[_0xa9fa('0x1f')](_0xa9fa('0x23'),auth[_0xa9fa('0xb')](),controller[_0xa9fa('0x24')]);router[_0xa9fa('0x1f')](_0xa9fa('0x15'),auth[_0xa9fa('0xb')](),controller[_0xa9fa('0x25')]);router[_0xa9fa('0x1f')](_0xa9fa('0x16'),auth[_0xa9fa('0xb')](),controller[_0xa9fa('0x26')]);router[_0xa9fa('0x1f')](_0xa9fa('0x27'),auth[_0xa9fa('0xb')](),controller[_0xa9fa('0x28')]);router[_0xa9fa('0x1f')](_0xa9fa('0x1b'),auth['isAuthenticated'](),controller[_0xa9fa('0x29')]);router[_0xa9fa('0x2a')](_0xa9fa('0xe'),auth[_0xa9fa('0xb')](),controller[_0xa9fa('0x2b')]);router[_0xa9fa('0x2c')](_0xa9fa('0x1d'),auth[_0xa9fa('0xb')](),controller[_0xa9fa('0x2d')]);router['delete'](_0xa9fa('0x11'),auth[_0xa9fa('0xb')](),controller['removeAnswers']);router[_0xa9fa('0x2c')](_0xa9fa('0x13'),auth[_0xa9fa('0xb')](),controller['removeImap']);router['delete'](_0xa9fa('0x23'),auth['isAuthenticated'](),controller[_0xa9fa('0x2e')]);router[_0xa9fa('0x2c')]('/:id',auth[_0xa9fa('0xb')](),controller[_0xa9fa('0x2f')]);router[_0xa9fa('0x2c')]('/:id/users',auth[_0xa9fa('0xb')](),controller[_0xa9fa('0x30')]);module[_0xa9fa('0x31')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 03fd6e3..ad2b9a0 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 _0x7764=['INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x7764,0xa4));var _0x4776=function(_0x595bd1,_0xb1e7a){_0x595bd1=_0x595bd1-0x0;var _0xd0344f=_0x7764[_0x595bd1];return _0xd0344f;};'use strict';var Sequelize=require(_0x4776('0x0'));module[_0x4776('0x1')]={'description':{'type':Sequelize[_0x4776('0x2')]},'name':{'type':Sequelize[_0x4776('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x4776('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x4776('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x4776('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x4776('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x4776('0x4')]},'markAsUnread':{'type':Sequelize[_0x4776('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x4776('0x5')](0x2)[_0x4776('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x4776('0x7');}},'notificationSound':{'type':Sequelize[_0x4776('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4776('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4776('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4776('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x4776('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x4776('0x3')],'defaultValue':![],'comment':_0x4776('0x9'),'set':function(_0x1237b8){if(!_0x1237b8)this[_0x4776('0xa')](_0x4776('0xb'),null);this[_0x4776('0xa')](_0x4776('0xc'),_0x1237b8);}}}; \ No newline at end of file +var _0x64f5=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','BOOLEAN','STRING','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(_0xd43cf9,_0x1f6eb2){var _0x4efafa=function(_0x479f1c){while(--_0x479f1c){_0xd43cf9['push'](_0xd43cf9['shift']());}};_0x4efafa(++_0x1f6eb2);}(_0x64f5,0x17e));var _0x564f=function(_0x50bc9d,_0x172e00){_0x50bc9d=_0x50bc9d-0x0;var _0x40f52f=_0x64f5[_0x50bc9d];return _0x40f52f;};'use strict';var Sequelize=require(_0x564f('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x564f('0x1')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x564f('0x1')],'defaultValue':!![]},'key':{'type':Sequelize[_0x564f('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x564f('0x1')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x564f('0x2')],'allowNull':![],'defaultValue':_0x564f('0x3')},'fontSize':{'type':Sequelize[_0x564f('0x4')](0x2)[_0x564f('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x564f('0x6');}},'notificationSound':{'type':Sequelize[_0x564f('0x1')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x564f('0x1')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x564f('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x564f('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x564f('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x564f('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x564f('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x564f('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x564f('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x564f('0x1')],'defaultValue':![],'comment':_0x564f('0x8'),'set':function(_0x6b234d){if(!_0x6b234d)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x564f('0x9')]('mandatoryDisposition',_0x6b234d);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 9cb60c1..417d571 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 _0x83a4=['out','Interaction','verifySmtp','VerifySmtp','Sequelize','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','html-to-text','juice','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./mailAccount.socket','register','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','destroy','MailAccounts','UserProfileResource','stack','send','index','MailServerIn','MailServerOut','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','query','model','attributes','intersection','fields','length','nolimit','sort','filters','pick','filter','where','VIRTUAL','name','merge','options','includeAll','rows','show','params','Imap','Smtp','Pause','keys','find','update','body','describe','addDisposition','MailAccountId','Disposition','create','order','include','findAll','removeDispositions','CannedAnswer','findOne','hasOwnProperty','ids','email','ListId','active','description','isNil','cauthentication','user','cuser','password','cpassword','authentication','host','port','service','cservice','pass','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','CmContact','Contact','User','fullname','Tag','Tags','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','CmList','List','Contacts','DESC','from','attachments','join','server/files/attachments','auth','secure','SendMail','sendMail','List\x20not\x20found'];(function(_0x53aea5,_0x5e31c0){var _0xefb246=function(_0x11363d){while(--_0x11363d){_0x53aea5['push'](_0x53aea5['shift']());}};_0xefb246(++_0x5e31c0);}(_0x83a4,0x182));var _0x483a=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x83a4[_0x3b0731];return _0x4204d7;};'use strict';var emlformat=require(_0x483a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x483a('0x1'));var rp=require(_0x483a('0x2'));var moment=require('moment');var BPromise=require(_0x483a('0x3'));var Mustache=require(_0x483a('0x4'));var util=require(_0x483a('0x5'));var path=require(_0x483a('0x6'));var sox=require(_0x483a('0x7'));var csv=require(_0x483a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x483a('0x9'));var _=require(_0x483a('0xa'));var squel=require(_0x483a('0xb'));var crypto=require(_0x483a('0xc'));var jsforce=require(_0x483a('0xd'));var deskjs=require(_0x483a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x483a('0xf'));var Papa=require('papaparse');var htmlToText=require(_0x483a('0x10'));var juice=require(_0x483a('0x11'));var Redis=require('ioredis');var authService=require(_0x483a('0x12'));var qs=require(_0x483a('0x13'));var as=require(_0x483a('0x14'));var hardwareService=require(_0x483a('0x15'));var logger=require('../../config/logger')(_0x483a('0x16'));var utils=require(_0x483a('0x17'));var config=require(_0x483a('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x483a('0x19')]=_[_0x483a('0x1a')](config[_0x483a('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x483a('0x1b'))(new Redis(config[_0x483a('0x19')]));require(_0x483a('0x1c'))[_0x483a('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x483a('0x1e')][_0x483a('0x1f')]({'port':0x232b});function respondWithRpcPromise(_0x95a260,_0x2c973f,_0x48217d,_0x5463f0){return new BPromise(function(_0x39b614,_0x29e8a3){var _0x47df88=_0x5463f0||client;return _0x47df88[_0x483a('0x20')](_0x95a260,_0x48217d)[_0x483a('0x21')](function(_0x509be4){logger[_0x483a('0x22')](_0x483a('0x23'),_0x2c973f,_0x483a('0x24'));logger['debug'](_0x483a('0x25'),_0x2c973f,_0x483a('0x24'),JSON[_0x483a('0x26')](_0x509be4));if(_0x509be4[_0x483a('0x27')]){if(_0x509be4[_0x483a('0x27')][_0x483a('0x28')]===0x1f4){logger['error'](_0x483a('0x23'),_0x2c973f,_0x509be4[_0x483a('0x27')]['message']);return _0x29e8a3(_0x509be4[_0x483a('0x27')][_0x483a('0x29')]);}logger[_0x483a('0x27')](_0x483a('0x23'),_0x2c973f,_0x509be4[_0x483a('0x27')][_0x483a('0x29')]);return _0x39b614(_0x509be4[_0x483a('0x27')][_0x483a('0x29')]);}else{logger['info'](_0x483a('0x23'),_0x2c973f,_0x483a('0x24'));_0x39b614(_0x509be4['result'][_0x483a('0x29')]);}})[_0x483a('0x2a')](function(_0x3c8c1c){logger[_0x483a('0x27')](_0x483a('0x23'),_0x2c973f,_0x3c8c1c);_0x29e8a3(_0x3c8c1c);});});}function respondWithStatusCode(_0x2965fd,_0x418131){_0x418131=_0x418131||0xcc;return function(_0x57ceac){if(_0x57ceac){return _0x2965fd[_0x483a('0x2b')](_0x418131);}return _0x2965fd[_0x483a('0x2c')](_0x418131)[_0x483a('0x2d')]();};}function respondWithResult(_0xd46239,_0x559794){_0x559794=_0x559794||0xc8;return function(_0x44263b){if(_0x44263b){return _0xd46239[_0x483a('0x2c')](_0x559794)['json'](_0x44263b);}};}function respondWithFilteredResult(_0x2ab184,_0x308265){return function(_0x575784){if(_0x575784){var _0x5a37e5=typeof _0x308265[_0x483a('0x2e')]===_0x483a('0x2f')&&typeof _0x308265['limit']===_0x483a('0x2f');var _0x22d831=_0x575784[_0x483a('0x30')];var _0x55f051=_0x5a37e5?0x0:_0x308265['offset'];var _0x2a7903=_0x5a37e5?_0x575784[_0x483a('0x30')]:_0x308265['offset']+_0x308265[_0x483a('0x31')];var _0x2eac17;if(_0x2a7903>=_0x22d831){_0x2a7903=_0x22d831;_0x2eac17=0xc8;}else{_0x2eac17=0xce;}_0x2ab184[_0x483a('0x2c')](_0x2eac17);return _0x2ab184[_0x483a('0x32')](_0x483a('0x33'),_0x55f051+'-'+_0x2a7903+'/'+_0x22d831)['json'](_0x575784);}return null;};}function patchUpdates(_0x58b558){return function(_0x5ef63b){try{jsonpatch[_0x483a('0x34')](_0x5ef63b,_0x58b558,!![]);}catch(_0xbe1ff4){return BPromise[_0x483a('0x35')](_0xbe1ff4);}return _0x5ef63b['save']();};}function saveUpdates(_0x4d2bfc,_0x3f835c){return function(_0x28a414){if(_0x28a414){return _0x28a414['update'](_0x4d2bfc)[_0x483a('0x21')](function(_0x51d6ce){return _0x51d6ce;});}return null;};}function removeEntity(_0x1d36b0,_0x3d1753){return function(_0x5df28f){if(_0x5df28f){return _0x5df28f[_0x483a('0x36')]()[_0x483a('0x21')](function(){var _0xd7a915=_0x5df28f['get']({'plain':!![]});var _0x431724=_0x483a('0x37');return db[_0x483a('0x38')]['destroy']({'where':{'type':_0x431724,'resourceId':_0xd7a915['id']}})[_0x483a('0x21')](function(){return _0x5df28f;});})[_0x483a('0x21')](function(){_0x1d36b0[_0x483a('0x2c')](0xcc)[_0x483a('0x2d')]();});}};}function handleEntityNotFound(_0x5f4b36,_0x232d3a){return function(_0x8d51a0){if(!_0x8d51a0){_0x5f4b36['sendStatus'](0x194);}return _0x8d51a0;};}function handleError(_0x405692,_0x910df6){_0x910df6=_0x910df6||0x1f4;return function(_0x2b5b6b){logger[_0x483a('0x27')](_0x2b5b6b[_0x483a('0x39')]);if(_0x2b5b6b['name']){delete _0x2b5b6b['name'];}_0x405692[_0x483a('0x2c')](_0x910df6)[_0x483a('0x3a')](_0x2b5b6b);};}exports[_0x483a('0x3b')]=function(_0x41221b,_0x4f12ff){var _0x31254e={'include':[{'model':db[_0x483a('0x3c')],'as':'Imap'},{'model':db[_0x483a('0x3d')],'as':'Smtp'},{'model':db['Pause'],'as':_0x483a('0x3e')}]},_0x25ce06={},_0x16520c={'count':0x0,'rows':[]};var _0x3aaf26=_[_0x483a('0x3f')](db[_0x483a('0x40')][_0x483a('0x41')],function(_0x21bfb3){return{'name':_0x21bfb3[_0x483a('0x42')],'type':_0x21bfb3[_0x483a('0x43')][_0x483a('0x44')]};});_0x25ce06['model']=_[_0x483a('0x3f')](_0x3aaf26,'name');_0x25ce06[_0x483a('0x45')]=_['keys'](_0x41221b[_0x483a('0x45')]);_0x25ce06['filters']=_['intersection'](_0x25ce06[_0x483a('0x46')],_0x25ce06[_0x483a('0x45')]);_0x31254e[_0x483a('0x47')]=_[_0x483a('0x48')](_0x25ce06['model'],qs[_0x483a('0x49')](_0x41221b[_0x483a('0x45')][_0x483a('0x49')]));_0x31254e[_0x483a('0x47')]=_0x31254e[_0x483a('0x47')][_0x483a('0x4a')]?_0x31254e[_0x483a('0x47')]:_0x25ce06['model'];if(!_0x41221b[_0x483a('0x45')]['hasOwnProperty'](_0x483a('0x4b'))){_0x31254e[_0x483a('0x31')]=qs[_0x483a('0x31')](_0x41221b[_0x483a('0x45')][_0x483a('0x31')]);_0x31254e[_0x483a('0x2e')]=qs[_0x483a('0x2e')](_0x41221b[_0x483a('0x45')]['offset']);}_0x31254e['order']=qs[_0x483a('0x4c')](_0x41221b[_0x483a('0x45')][_0x483a('0x4c')]);_0x31254e['where']=qs[_0x483a('0x4d')](_[_0x483a('0x4e')](_0x41221b[_0x483a('0x45')],_0x25ce06['filters']),_0x3aaf26);if(_0x41221b[_0x483a('0x45')][_0x483a('0x4f')]){_0x31254e[_0x483a('0x50')]=_['merge'](_0x31254e[_0x483a('0x50')],{'$or':_[_0x483a('0x3f')](_0x3aaf26,function(_0x213cca){if(_0x213cca[_0x483a('0x43')]!==_0x483a('0x51')){var _0x25ae4d={};_0x25ae4d[_0x213cca[_0x483a('0x52')]]={'$like':'%'+_0x41221b['query'][_0x483a('0x4f')]+'%'};return _0x25ae4d;}})});}_0x31254e=_[_0x483a('0x53')]({},_0x31254e,_0x41221b[_0x483a('0x54')]);var _0xf7de1={'where':_0x31254e[_0x483a('0x50')]};return db[_0x483a('0x40')][_0x483a('0x30')](_0xf7de1)[_0x483a('0x21')](function(_0x5afc80){_0x16520c['count']=_0x5afc80;if(_0x41221b[_0x483a('0x45')][_0x483a('0x55')]){_0x31254e['include']=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x31254e);})['then'](function(_0x909940){_0x16520c[_0x483a('0x56')]=_0x909940;return _0x16520c;})[_0x483a('0x21')](respondWithFilteredResult(_0x4f12ff,_0x31254e))['catch'](handleError(_0x4f12ff,null));};exports[_0x483a('0x57')]=function(_0x3772ef,_0x4e09b4){var _0x1f9a82={'raw':![],'where':{'id':_0x3772ef[_0x483a('0x58')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x483a('0x59')},{'model':db['MailServerOut'],'as':_0x483a('0x5a')},{'model':db[_0x483a('0x5b')],'as':_0x483a('0x3e')}]},_0x19a566={};_0x19a566[_0x483a('0x46')]=_[_0x483a('0x5c')](db[_0x483a('0x40')][_0x483a('0x41')]);_0x19a566[_0x483a('0x45')]=_[_0x483a('0x5c')](_0x3772ef['query']);_0x19a566[_0x483a('0x4d')]=_[_0x483a('0x48')](_0x19a566[_0x483a('0x46')],_0x19a566[_0x483a('0x45')]);_0x1f9a82[_0x483a('0x47')]=_[_0x483a('0x48')](_0x19a566[_0x483a('0x46')],qs['fields'](_0x3772ef['query'][_0x483a('0x49')]));_0x1f9a82[_0x483a('0x47')]=_0x1f9a82['attributes'][_0x483a('0x4a')]?_0x1f9a82[_0x483a('0x47')]:_0x19a566['model'];if(_0x3772ef[_0x483a('0x45')][_0x483a('0x55')]){_0x1f9a82['include']=[{'all':!![]}];}_0x1f9a82=_[_0x483a('0x53')]({},_0x1f9a82,_0x3772ef[_0x483a('0x54')]);return db[_0x483a('0x40')][_0x483a('0x5d')](_0x1f9a82)[_0x483a('0x21')](handleEntityNotFound(_0x4e09b4,null))[_0x483a('0x21')](respondWithResult(_0x4e09b4,null))[_0x483a('0x2a')](handleError(_0x4e09b4,null));};exports[_0x483a('0x5e')]=function(_0x48dec3,_0x592fd6){if(_0x48dec3[_0x483a('0x5f')]['id']){delete _0x48dec3[_0x483a('0x5f')]['id'];}return db[_0x483a('0x40')][_0x483a('0x5d')]({'where':{'id':_0x48dec3[_0x483a('0x58')]['id']},'include':[{'model':db[_0x483a('0x3c')],'as':_0x483a('0x59')},{'model':db[_0x483a('0x3d')],'as':_0x483a('0x5a')},{'model':db[_0x483a('0x5b')],'as':_0x483a('0x3e')}]})['then'](handleEntityNotFound(_0x592fd6,null))[_0x483a('0x21')](saveUpdates(_0x48dec3[_0x483a('0x5f')],null))[_0x483a('0x21')](function(_0x4adba2){if(_0x4adba2&&_0x48dec3[_0x483a('0x5f')][_0x483a('0x59')]){return db[_0x483a('0x3c')][_0x483a('0x5e')](_0x48dec3['body'][_0x483a('0x59')],{'where':{'MailAccountId':_0x4adba2['id']}})[_0x483a('0x21')](function(){return _0x4adba2;});}return _0x4adba2;})[_0x483a('0x21')](function(_0x524037){if(_0x524037&&_0x48dec3[_0x483a('0x5f')][_0x483a('0x5a')]){return db[_0x483a('0x3d')][_0x483a('0x5e')](_0x48dec3[_0x483a('0x5f')]['Smtp'],{'where':{'MailAccountId':_0x524037['id']}})[_0x483a('0x21')](function(){return _0x524037;});}return _0x524037;})[_0x483a('0x21')](respondWithResult(_0x592fd6,null))[_0x483a('0x2a')](handleError(_0x592fd6,null));};exports[_0x483a('0x60')]=function(_0x362bcb,_0x4aa544){return db['MailAccount'][_0x483a('0x60')]()[_0x483a('0x21')](respondWithResult(_0x4aa544,null))[_0x483a('0x2a')](handleError(_0x4aa544,null));};exports[_0x483a('0x61')]=function(_0x44f731,_0x2f24a0,_0x58d6a2){if(_0x44f731[_0x483a('0x5f')]['id']){delete _0x44f731[_0x483a('0x5f')]['id'];}return db[_0x483a('0x40')]['find']({'where':{'id':_0x44f731[_0x483a('0x58')]['id']}})[_0x483a('0x21')](handleEntityNotFound(_0x2f24a0,null))[_0x483a('0x21')](function(_0x5f3298){if(_0x5f3298){_0x44f731[_0x483a('0x5f')][_0x483a('0x62')]=_0x5f3298['id'];return db[_0x483a('0x63')][_0x483a('0x64')](_0x44f731['body']);}})[_0x483a('0x21')](respondWithResult(_0x2f24a0,null))[_0x483a('0x2a')](handleError(_0x2f24a0,null));};exports['getDispositions']=function(_0x23d7db,_0x4c4f21,_0x1aeee0){var _0x3d9c4f={'raw':![],'where':{}};var _0x451dbf={};var _0x299c91={'count':0x0,'rows':[]};return db[_0x483a('0x40')]['findOne']({'where':{'id':_0x23d7db[_0x483a('0x58')]['id']}})[_0x483a('0x21')](handleEntityNotFound(_0x4c4f21,null))[_0x483a('0x21')](function(_0xd56d3a){if(_0xd56d3a){_0x451dbf[_0x483a('0x46')]=_['keys'](db['Disposition'][_0x483a('0x41')]);_0x451dbf[_0x483a('0x45')]=_['keys'](_0x23d7db[_0x483a('0x45')]);_0x451dbf[_0x483a('0x4d')]=_[_0x483a('0x48')](_0x451dbf['model'],_0x451dbf[_0x483a('0x45')]);_0x3d9c4f[_0x483a('0x47')]=_['intersection'](_0x451dbf[_0x483a('0x46')],qs[_0x483a('0x49')](_0x23d7db['query'][_0x483a('0x49')]));_0x3d9c4f['attributes']=_0x3d9c4f['attributes'][_0x483a('0x4a')]?_0x3d9c4f[_0x483a('0x47')]:_0x451dbf['model'];if(!_0x23d7db[_0x483a('0x45')]['hasOwnProperty'](_0x483a('0x4b'))){_0x3d9c4f[_0x483a('0x31')]=qs['limit'](_0x23d7db[_0x483a('0x45')][_0x483a('0x31')]);_0x3d9c4f[_0x483a('0x2e')]=qs[_0x483a('0x2e')](_0x23d7db[_0x483a('0x45')][_0x483a('0x2e')]);}_0x3d9c4f[_0x483a('0x65')]=qs[_0x483a('0x4c')](_0x23d7db['query'][_0x483a('0x4c')]);_0x3d9c4f['where']=qs[_0x483a('0x4d')](_[_0x483a('0x4e')](_0x23d7db[_0x483a('0x45')],_0x451dbf[_0x483a('0x4d')]));_0x3d9c4f['where'][_0x483a('0x62')]=_0xd56d3a['id'];if(_0x23d7db[_0x483a('0x45')]['filter']){_0x3d9c4f[_0x483a('0x50')]=_['merge'](_0x3d9c4f[_0x483a('0x50')],{'$or':_['map'](_0x3d9c4f[_0x483a('0x47')],function(_0x415fb7){var _0x2c86b0={};_0x2c86b0[_0x415fb7]={'$like':'%'+_0x23d7db[_0x483a('0x45')][_0x483a('0x4f')]+'%'};return _0x2c86b0;})});}_0x3d9c4f=_[_0x483a('0x53')]({},_0x3d9c4f,_0x23d7db[_0x483a('0x54')]);return db[_0x483a('0x63')]['count']({'where':_0x3d9c4f[_0x483a('0x50')]})['then'](function(_0x545542){_0x299c91[_0x483a('0x30')]=_0x545542;if(_0x23d7db[_0x483a('0x45')][_0x483a('0x55')]){_0x3d9c4f[_0x483a('0x66')]=[{'all':!![]}];}return db['Disposition'][_0x483a('0x67')](_0x3d9c4f);})[_0x483a('0x21')](function(_0x273e7e){_0x299c91[_0x483a('0x56')]=_0x273e7e;return _0x299c91;});}})['then'](respondWithFilteredResult(_0x4c4f21,_0x3d9c4f))[_0x483a('0x2a')](handleError(_0x4c4f21,null));};exports[_0x483a('0x68')]=function(_0x49b9ae,_0x1dab76,_0x22eabd){return db[_0x483a('0x40')][_0x483a('0x5d')]({'where':{'id':_0x49b9ae[_0x483a('0x58')]['id']}})['then'](handleEntityNotFound(_0x1dab76,null))['then'](function(_0x26fba9){if(_0x26fba9){return _0x26fba9[_0x483a('0x68')](_0x49b9ae['query']['ids']);}})[_0x483a('0x21')](respondWithStatusCode(_0x1dab76,null))['catch'](handleError(_0x1dab76,null));};exports['addAnswer']=function(_0x3fa26c,_0x366413,_0x489d00){if(_0x3fa26c[_0x483a('0x5f')]['id']){delete _0x3fa26c[_0x483a('0x5f')]['id'];}return db[_0x483a('0x40')][_0x483a('0x5d')]({'where':{'id':_0x3fa26c[_0x483a('0x58')]['id']}})[_0x483a('0x21')](handleEntityNotFound(_0x366413,null))[_0x483a('0x21')](function(_0x140fb4){if(_0x140fb4){_0x3fa26c[_0x483a('0x5f')][_0x483a('0x62')]=_0x140fb4['id'];return db[_0x483a('0x69')][_0x483a('0x64')](_0x3fa26c[_0x483a('0x5f')]);}})[_0x483a('0x21')](respondWithResult(_0x366413,null))[_0x483a('0x2a')](handleError(_0x366413,null));};exports['getAnswers']=function(_0x52379f,_0x14f2fc,_0x26a659){var _0x15bf80={'raw':![],'where':{}};var _0x440245={};var _0x544f4d={'count':0x0,'rows':[]};return db['MailAccount'][_0x483a('0x6a')]({'where':{'id':_0x52379f['params']['id']}})['then'](handleEntityNotFound(_0x14f2fc,null))[_0x483a('0x21')](function(_0x4c316a){if(_0x4c316a){_0x440245['model']=_['keys'](db[_0x483a('0x69')][_0x483a('0x41')]);_0x440245[_0x483a('0x45')]=_[_0x483a('0x5c')](_0x52379f[_0x483a('0x45')]);_0x440245[_0x483a('0x4d')]=_[_0x483a('0x48')](_0x440245[_0x483a('0x46')],_0x440245[_0x483a('0x45')]);_0x15bf80[_0x483a('0x47')]=_['intersection'](_0x440245[_0x483a('0x46')],qs[_0x483a('0x49')](_0x52379f[_0x483a('0x45')]['fields']));_0x15bf80[_0x483a('0x47')]=_0x15bf80[_0x483a('0x47')][_0x483a('0x4a')]?_0x15bf80[_0x483a('0x47')]:_0x440245[_0x483a('0x46')];if(!_0x52379f[_0x483a('0x45')][_0x483a('0x6b')](_0x483a('0x4b'))){_0x15bf80['limit']=qs[_0x483a('0x31')](_0x52379f[_0x483a('0x45')][_0x483a('0x31')]);_0x15bf80[_0x483a('0x2e')]=qs[_0x483a('0x2e')](_0x52379f[_0x483a('0x45')]['offset']);}_0x15bf80[_0x483a('0x65')]=qs[_0x483a('0x4c')](_0x52379f[_0x483a('0x45')]['sort']);_0x15bf80['where']=qs[_0x483a('0x4d')](_[_0x483a('0x4e')](_0x52379f[_0x483a('0x45')],_0x440245['filters']));_0x15bf80[_0x483a('0x50')][_0x483a('0x62')]=_0x4c316a['id'];if(_0x52379f['query'][_0x483a('0x4f')]){_0x15bf80[_0x483a('0x50')]=_[_0x483a('0x53')](_0x15bf80[_0x483a('0x50')],{'$or':_[_0x483a('0x3f')](_0x15bf80['attributes'],function(_0x198f8f){var _0xe53669={};_0xe53669[_0x198f8f]={'$like':'%'+_0x52379f[_0x483a('0x45')][_0x483a('0x4f')]+'%'};return _0xe53669;})});}_0x15bf80=_[_0x483a('0x53')]({},_0x15bf80,_0x52379f['options']);return db['CannedAnswer']['count']({'where':_0x15bf80[_0x483a('0x50')]})[_0x483a('0x21')](function(_0x446d47){_0x544f4d['count']=_0x446d47;if(_0x52379f['query'][_0x483a('0x55')]){_0x15bf80[_0x483a('0x66')]=[{'all':!![]}];}return db[_0x483a('0x69')][_0x483a('0x67')](_0x15bf80);})['then'](function(_0x38e379){_0x544f4d[_0x483a('0x56')]=_0x38e379;return _0x544f4d;});}})[_0x483a('0x21')](respondWithFilteredResult(_0x14f2fc,_0x15bf80))[_0x483a('0x2a')](handleError(_0x14f2fc,null));};exports['removeAnswers']=function(_0x34c6b6,_0x58cfa8,_0x427b12){return db['MailAccount'][_0x483a('0x5d')]({'where':{'id':_0x34c6b6['params']['id']}})[_0x483a('0x21')](handleEntityNotFound(_0x58cfa8,null))[_0x483a('0x21')](function(_0x5a8156){if(_0x5a8156){return _0x5a8156['removeAnswers'](_0x34c6b6[_0x483a('0x45')][_0x483a('0x6c')]);}})[_0x483a('0x21')](respondWithStatusCode(_0x58cfa8,null))[_0x483a('0x2a')](handleError(_0x58cfa8,null));};exports[_0x483a('0x64')]=function(_0x34e8b1,_0x1f210e){var _0x2ca19f={'name':_0x34e8b1[_0x483a('0x5f')][_0x483a('0x52')],'key':_0x34e8b1[_0x483a('0x5f')]['key'],'email':_0x34e8b1['body'][_0x483a('0x6d')],'ListId':_0x34e8b1[_0x483a('0x5f')][_0x483a('0x6e')],'active':!_['isNil'](_0x34e8b1['body']['active'])?_0x34e8b1['body'][_0x483a('0x6f')]:!![],'description':_0x34e8b1[_0x483a('0x5f')][_0x483a('0x70')]||null,'Imap':{},'Smtp':{}};if(_[_0x483a('0x71')](_0x34e8b1['body']['cservice'])){if(_0x34e8b1[_0x483a('0x5f')][_0x483a('0x72')]){_0x2ca19f[_0x483a('0x59')][_0x483a('0x73')]=_0x2ca19f[_0x483a('0x5a')]['user']=_0x34e8b1[_0x483a('0x5f')][_0x483a('0x74')];_0x2ca19f[_0x483a('0x59')][_0x483a('0x75')]=_0x2ca19f[_0x483a('0x5a')]['pass']=_0x34e8b1[_0x483a('0x5f')][_0x483a('0x76')];}else{_0x2ca19f['Imap']['authentication']=_0x2ca19f[_0x483a('0x5a')][_0x483a('0x77')]=![];}_0x2ca19f['Imap'][_0x483a('0x78')]=_0x34e8b1[_0x483a('0x5f')][_0x483a('0x59')]['host'];_0x2ca19f[_0x483a('0x59')][_0x483a('0x79')]=_0x34e8b1['body'][_0x483a('0x59')][_0x483a('0x79')];_0x2ca19f[_0x483a('0x5a')][_0x483a('0x78')]=_0x34e8b1[_0x483a('0x5f')]['Smtp'][_0x483a('0x78')];_0x2ca19f[_0x483a('0x5a')]['port']=_0x34e8b1['body'][_0x483a('0x5a')][_0x483a('0x79')];}else{_0x2ca19f[_0x483a('0x59')][_0x483a('0x7a')]=_0x2ca19f['Smtp'][_0x483a('0x7a')]=_0x34e8b1[_0x483a('0x5f')][_0x483a('0x7b')];_0x2ca19f[_0x483a('0x59')][_0x483a('0x73')]=_0x2ca19f['Smtp']['user']=_0x34e8b1['body']['cuser'];_0x2ca19f[_0x483a('0x59')]['password']=_0x2ca19f[_0x483a('0x5a')][_0x483a('0x7c')]=_0x34e8b1[_0x483a('0x5f')][_0x483a('0x76')];}return db['MailAccount'][_0x483a('0x64')](_0x2ca19f,{'include':[{'model':db[_0x483a('0x3d')],'as':_0x483a('0x5a')},{'model':db[_0x483a('0x3c')],'as':'Imap'}]})[_0x483a('0x21')](function(_0x1edb65){var _0x217138=_0x34e8b1[_0x483a('0x73')][_0x483a('0x7d')]({'plain':!![]});if(!_0x217138)throw new Error(_0x483a('0x7e'));if(_0x217138[_0x483a('0x7f')]==='user'){var _0xeb2e0=_0x1edb65[_0x483a('0x7d')]({'plain':!![]});return db[_0x483a('0x80')][_0x483a('0x5d')]({'where':{'name':_0x483a('0x37'),'userProfileId':_0x217138['userProfileId']},'raw':!![]})['then'](function(_0x13a57b){if(_0x13a57b&&_0x13a57b['autoAssociation']===0x0){return db['UserProfileResource'][_0x483a('0x64')]({'name':_0xeb2e0['name'],'resourceId':_0xeb2e0['id'],'type':_0x13a57b[_0x483a('0x52')],'sectionId':_0x13a57b['id']},{})['then'](function(){return _0x1edb65;});}else{return _0x1edb65;}})[_0x483a('0x2a')](function(_0x5c2cad){logger[_0x483a('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c2cad);throw _0x5c2cad;});}return _0x1edb65;})[_0x483a('0x21')](respondWithResult(_0x1f210e,0xc9))[_0x483a('0x2a')](handleError(_0x1f210e,null));};exports[_0x483a('0x81')]=function(_0x449b40,_0x5447d8,_0x40798d){return db[_0x483a('0x40')][_0x483a('0x6a')]({'where':{'id':_0x449b40[_0x483a('0x58')]['id']}})['then'](handleEntityNotFound(_0x5447d8,null))[_0x483a('0x21')](function(_0x4148e2){if(_0x4148e2){return _0x4148e2['getImap']();}return null;})['then'](respondWithResult(_0x5447d8,null))[_0x483a('0x2a')](handleError(_0x5447d8,null));};exports[_0x483a('0x82')]=function(_0x2d5b4a,_0x2d1f99,_0x430d9b){if(_0x2d5b4a[_0x483a('0x5f')]['id']){delete _0x2d5b4a[_0x483a('0x5f')]['id'];}return db[_0x483a('0x40')][_0x483a('0x5d')]({'where':{'id':_0x2d5b4a[_0x483a('0x58')]['id']}})[_0x483a('0x21')](handleEntityNotFound(_0x2d1f99,null))['then'](function(_0x161363){if(_0x161363){_0x2d5b4a[_0x483a('0x5f')][_0x483a('0x62')]=_0x161363['id'];return db['MailServerIn'][_0x483a('0x64')](_0x2d5b4a['body']);}})[_0x483a('0x21')](respondWithResult(_0x2d1f99,null))['catch'](handleError(_0x2d1f99,null));};exports[_0x483a('0x83')]=function(_0x2bbee0,_0x59cea9,_0x41abf0){return db[_0x483a('0x40')]['findOne']({'where':{'id':_0x2bbee0[_0x483a('0x58')]['id']}})['then'](handleEntityNotFound(_0x59cea9,null))['then'](function(_0x3ac261){if(_0x3ac261){return _0x3ac261[_0x483a('0x84')](null);}return null;})[_0x483a('0x21')](respondWithStatusCode(_0x59cea9,null))[_0x483a('0x2a')](handleError(_0x59cea9,null));};exports['getSmtp']=function(_0x58bfd4,_0x6f932e,_0x4f3d61){return db[_0x483a('0x40')][_0x483a('0x6a')]({'where':{'id':_0x58bfd4[_0x483a('0x58')]['id']}})[_0x483a('0x21')](handleEntityNotFound(_0x6f932e,null))[_0x483a('0x21')](function(_0x365c1b){if(_0x365c1b){return _0x365c1b[_0x483a('0x85')]();}return null;})[_0x483a('0x21')](respondWithResult(_0x6f932e,null))[_0x483a('0x2a')](handleError(_0x6f932e,null));};exports[_0x483a('0x86')]=function(_0x4fdd4e,_0x5f0ff0,_0x5ccf3b){if(_0x4fdd4e['body']['id']){delete _0x4fdd4e[_0x483a('0x5f')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x4fdd4e[_0x483a('0x58')]['id']}})['then'](handleEntityNotFound(_0x5f0ff0,null))[_0x483a('0x21')](function(_0x4f1500){if(_0x4f1500){_0x4fdd4e[_0x483a('0x5f')][_0x483a('0x62')]=_0x4f1500['id'];return db[_0x483a('0x3d')][_0x483a('0x64')](_0x4fdd4e['body']);}})[_0x483a('0x21')](respondWithResult(_0x5f0ff0,null))[_0x483a('0x2a')](handleError(_0x5f0ff0,null));};exports[_0x483a('0x87')]=function(_0x3c6d2e,_0x4b0449,_0x11a9f2){return db['MailAccount'][_0x483a('0x6a')]({'where':{'id':_0x3c6d2e[_0x483a('0x58')]['id']}})[_0x483a('0x21')](handleEntityNotFound(_0x4b0449,null))[_0x483a('0x21')](function(_0x490251){if(_0x490251){return _0x490251[_0x483a('0x88')](null);}return null;})['then'](respondWithStatusCode(_0x4b0449,null))[_0x483a('0x2a')](handleError(_0x4b0449,null));};exports[_0x483a('0x89')]=function(_0x3b214f,_0x26477a,_0x3aa578){return db[_0x483a('0x8a')][_0x483a('0x5d')]({'where':{'id':_0x3b214f[_0x483a('0x58')]['id']}})[_0x483a('0x21')](handleEntityNotFound(_0x26477a,null))[_0x483a('0x21')](function(_0x296568){if(_0x296568){return _0x296568[_0x483a('0x89')](_0x3b214f[_0x483a('0x5f')][_0x483a('0x6c')],_['omit'](_0x3b214f['body'],[_0x483a('0x6c'),'id'])||{});}})[_0x483a('0x21')](respondWithResult(_0x26477a,null))[_0x483a('0x2a')](handleError(_0x26477a,null));};exports['getInteractions']=function(_0x477254,_0x12f9af,_0x572cfb){var _0x2b806d={'raw':![],'where':{}};var _0xe6bdcc={};var _0x11278f={'count':0x0,'rows':[]};return db[_0x483a('0x40')][_0x483a('0x6a')]({'where':{'id':_0x477254[_0x483a('0x58')]['id']}})[_0x483a('0x21')](handleEntityNotFound(_0x12f9af,null))['then'](function(_0xef5ee){if(_0xef5ee){_0xe6bdcc[_0x483a('0x46')]=_[_0x483a('0x5c')](db[_0x483a('0x8a')][_0x483a('0x41')]);_0xe6bdcc[_0x483a('0x45')]=_[_0x483a('0x5c')](_0x477254[_0x483a('0x45')]);_0xe6bdcc[_0x483a('0x4d')]=_[_0x483a('0x48')](_0xe6bdcc[_0x483a('0x46')],_0xe6bdcc[_0x483a('0x45')]);_0x2b806d[_0x483a('0x47')]=_[_0x483a('0x48')](_0xe6bdcc[_0x483a('0x46')],qs[_0x483a('0x49')](_0x477254[_0x483a('0x45')][_0x483a('0x49')]));_0x2b806d['attributes']=_0x2b806d[_0x483a('0x47')][_0x483a('0x4a')]?_0x2b806d['attributes']:_0xe6bdcc[_0x483a('0x46')];if(!_0x477254[_0x483a('0x45')][_0x483a('0x6b')](_0x483a('0x4b'))){_0x2b806d['limit']=qs[_0x483a('0x31')](_0x477254[_0x483a('0x45')][_0x483a('0x31')]);_0x2b806d['offset']=qs[_0x483a('0x2e')](_0x477254[_0x483a('0x45')][_0x483a('0x2e')]);}_0x2b806d['order']=qs[_0x483a('0x4c')](_0x477254[_0x483a('0x45')]['sort']);_0x2b806d['where']=qs[_0x483a('0x4d')](_[_0x483a('0x4e')](_0x477254[_0x483a('0x45')],_0xe6bdcc['filters']));_0x2b806d['where'][_0x483a('0x62')]=_0xef5ee['id'];if(_0x477254['query'][_0x483a('0x4f')]){_0x2b806d[_0x483a('0x50')]=_[_0x483a('0x53')](_0x2b806d[_0x483a('0x50')],{'$or':_[_0x483a('0x3f')](_0x2b806d[_0x483a('0x47')],function(_0x26e430){var _0x5c6267={};_0x5c6267[_0x26e430]={'$like':'%'+_0x477254[_0x483a('0x45')]['filter']+'%'};return _0x5c6267;})});}_0x2b806d=_[_0x483a('0x53')]({},_0x2b806d,_0x477254['options']);return db['MailInteraction'][_0x483a('0x30')]({'where':_0x2b806d[_0x483a('0x50')]})[_0x483a('0x21')](function(_0x4246c9){_0x11278f[_0x483a('0x30')]=_0x4246c9;if(_0x477254[_0x483a('0x45')][_0x483a('0x55')]){_0x2b806d[_0x483a('0x66')]=[{'model':db[_0x483a('0x8b')],'as':_0x483a('0x8c'),'required':![]},{'model':db[_0x483a('0x8d')],'as':'Owner','attributes':['name',_0x483a('0x8e'),'internal'],'required':![]},{'model':db[_0x483a('0x8f')],'as':_0x483a('0x90'),'attributes':['id','name','color'],'where':_0x477254['query']['tag']?{'id':_0x477254[_0x483a('0x45')]['tag']}:undefined,'required':_0x477254[_0x483a('0x45')][_0x483a('0x91')]?!![]:![]}];}return db[_0x483a('0x8a')]['findAll'](_0x2b806d);})[_0x483a('0x21')](function(_0x1b4093){_0x11278f[_0x483a('0x56')]=_0x1b4093;return _0x11278f;});}})[_0x483a('0x21')](respondWithFilteredResult(_0x12f9af,_0x2b806d))['catch'](handleError(_0x12f9af,null));};exports[_0x483a('0x92')]=function(_0x321d0d,_0x21d7df,_0x4a85fa){return db[_0x483a('0x40')]['findOne']({'where':{'id':_0x321d0d[_0x483a('0x58')]['id']}})[_0x483a('0x21')](handleEntityNotFound(_0x21d7df,null))['then'](function(_0x439638){if(_0x439638){return db[_0x483a('0x93')][_0x483a('0x94')](function(_0x2321ff){return db[_0x483a('0x95')][_0x483a('0x36')]({'where':{'MailAccountId':_0x321d0d[_0x483a('0x58')]['id']},'transaction':_0x2321ff})['then'](function(_0x2bf21d){var _0x342f3b=_['map'](_0x321d0d[_0x483a('0x5f')],function(_0x5874b1){_0x5874b1['MailAccountId']=_0x321d0d[_0x483a('0x58')]['id'];return _0x5874b1;});return db[_0x483a('0x95')][_0x483a('0x96')](_0x342f3b,{'transaction':_0x2321ff});});})[_0x483a('0x21')](function(){return db[_0x483a('0x95')][_0x483a('0x97')]({'where':{'MailAccountId':_0x321d0d[_0x483a('0x58')]['id']},'order':_0x483a('0x98')});});}})['then'](respondWithResult(_0x21d7df,null))['catch'](handleError(_0x21d7df,null));};exports[_0x483a('0x99')]=function(_0x36b497,_0x20b006,_0x17a74f){var _0x415889={};var _0x23182f={};var _0x273727;var _0x2e5ade;return db[_0x483a('0x40')][_0x483a('0x6a')]({'where':{'id':_0x36b497[_0x483a('0x58')]['id']}})['then'](handleEntityNotFound(_0x20b006,null))[_0x483a('0x21')](function(_0xbe68ab){if(_0xbe68ab){_0x273727=_0xbe68ab;_0x23182f[_0x483a('0x46')]=_[_0x483a('0x5c')](db[_0x483a('0x95')][_0x483a('0x41')]);_0x23182f['query']=_[_0x483a('0x5c')](_0x36b497[_0x483a('0x45')]);_0x23182f[_0x483a('0x4d')]=_[_0x483a('0x48')](_0x23182f[_0x483a('0x46')],_0x23182f[_0x483a('0x45')]);_0x415889[_0x483a('0x47')]=_[_0x483a('0x48')](_0x23182f['model'],qs[_0x483a('0x49')](_0x36b497[_0x483a('0x45')][_0x483a('0x49')]));_0x415889[_0x483a('0x47')]=_0x415889[_0x483a('0x47')][_0x483a('0x4a')]?_0x415889[_0x483a('0x47')]:_0x23182f[_0x483a('0x46')];_0x415889[_0x483a('0x65')]=qs['sort'](_0x36b497['query']['sort']);_0x415889['where']=qs[_0x483a('0x4d')](_[_0x483a('0x4e')](_0x36b497[_0x483a('0x45')],_0x23182f[_0x483a('0x4d')]));if(_0x36b497[_0x483a('0x45')]['filter']){_0x415889['where']=_[_0x483a('0x53')](_0x415889[_0x483a('0x50')],{'$or':_['map'](_0x415889['attributes'],function(_0x3afa0b){var _0x9b4a3e={};_0x9b4a3e[_0x3afa0b]={'$like':'%'+_0x36b497[_0x483a('0x45')]['filter']+'%'};return _0x9b4a3e;})});}_0x415889=_[_0x483a('0x53')]({},_0x415889,_0x36b497[_0x483a('0x54')]);return _0x273727[_0x483a('0x99')](_0x415889);}})[_0x483a('0x21')](function(_0x5a8f79){if(_0x5a8f79){_0x2e5ade=_0x5a8f79[_0x483a('0x4a')];if(!_0x36b497[_0x483a('0x45')]['hasOwnProperty'](_0x483a('0x4b'))){_0x415889[_0x483a('0x31')]=qs['limit'](_0x36b497[_0x483a('0x45')]['limit']);_0x415889[_0x483a('0x2e')]=qs[_0x483a('0x2e')](_0x36b497[_0x483a('0x45')]['offset']);}return _0x273727[_0x483a('0x99')](_0x415889);}})['then'](function(_0x4c6a33){if(_0x4c6a33){return _0x4c6a33?{'count':_0x2e5ade,'rows':_0x4c6a33}:null;}})[_0x483a('0x21')](respondWithResult(_0x20b006,null))[_0x483a('0x2a')](handleError(_0x20b006,null));};exports[_0x483a('0x9a')]=function(_0x15db62,_0xa85bc2,_0x6a6380){var _0x2c6d00={'raw':!![],'where':{}};var _0x17d39d={};var _0x209c45={'count':0x0,'rows':[]};return db[_0x483a('0x40')][_0x483a('0x6a')]({'where':{'id':_0x15db62[_0x483a('0x58')]['id']}})[_0x483a('0x21')](handleEntityNotFound(_0xa85bc2,null))[_0x483a('0x21')](function(_0xb0d1c0){if(_0xb0d1c0){_0x17d39d[_0x483a('0x46')]=_['keys'](db['MailMessage'][_0x483a('0x41')]);_0x17d39d[_0x483a('0x45')]=_['keys'](_0x15db62[_0x483a('0x45')]);_0x17d39d['filters']=_[_0x483a('0x48')](_0x17d39d[_0x483a('0x46')],_0x17d39d['query']);_0x2c6d00[_0x483a('0x47')]=_[_0x483a('0x48')](_0x17d39d[_0x483a('0x46')],qs[_0x483a('0x49')](_0x15db62[_0x483a('0x45')][_0x483a('0x49')]));_0x2c6d00[_0x483a('0x47')]=_0x2c6d00['attributes'][_0x483a('0x4a')]?_0x2c6d00['attributes']:_0x17d39d['model'];if(!_0x15db62[_0x483a('0x45')][_0x483a('0x6b')]('nolimit')){_0x2c6d00['limit']=qs['limit'](_0x15db62['query'][_0x483a('0x31')]);_0x2c6d00[_0x483a('0x2e')]=qs[_0x483a('0x2e')](_0x15db62[_0x483a('0x45')][_0x483a('0x2e')]);}_0x2c6d00[_0x483a('0x65')]=qs[_0x483a('0x4c')](_0x15db62[_0x483a('0x45')][_0x483a('0x4c')]);_0x2c6d00[_0x483a('0x50')]=qs['filters'](_[_0x483a('0x4e')](_0x15db62[_0x483a('0x45')],_0x17d39d[_0x483a('0x4d')]));_0x2c6d00[_0x483a('0x50')][_0x483a('0x62')]=_0xb0d1c0['id'];if(_0x15db62[_0x483a('0x45')][_0x483a('0x4f')]){_0x2c6d00[_0x483a('0x50')]=_[_0x483a('0x53')](_0x2c6d00['where'],{'$or':_[_0x483a('0x3f')](_0x2c6d00[_0x483a('0x47')],function(_0x2dfdc5){var _0xc0fa1a={};_0xc0fa1a[_0x2dfdc5]={'$like':'%'+_0x15db62[_0x483a('0x45')]['filter']+'%'};return _0xc0fa1a;})});}if(_0x15db62['query'][_0x483a('0x9b')]){var _0x2eec2e=_0x15db62[_0x483a('0x45')][_0x483a('0x9b')][_0x483a('0x9c')](',');var _0x1ad744={};_0x1ad744[_0x2eec2e[0x0]]={'$gte':moment(_0x2eec2e[0x1])[_0x483a('0x9d')](_0x483a('0x9e'))};_0x2c6d00[_0x483a('0x50')]=_['merge'](_0x2c6d00[_0x483a('0x50')],_0x1ad744);}_0x2c6d00=_[_0x483a('0x53')]({},_0x2c6d00,_0x15db62[_0x483a('0x54')]);return db[_0x483a('0x9f')][_0x483a('0x30')]({'where':_0x2c6d00[_0x483a('0x50')]})[_0x483a('0x21')](function(_0x13ca85){_0x209c45[_0x483a('0x30')]=_0x13ca85;if(_0x15db62[_0x483a('0x45')]['includeAll']){_0x2c6d00[_0x483a('0x66')]=[{'all':!![]}];}return db[_0x483a('0x9f')][_0x483a('0x67')](_0x2c6d00);})['then'](function(_0x82add7){if(_0x15db62[_0x483a('0x45')][_0x483a('0xa0')]===_0x483a('0xa1')){for(var _0x2e2e59=0x0;_0x2e2e59<_0x82add7[_0x483a('0x4a')];_0x2e2e59++){_0x82add7[_0x2e2e59][_0x483a('0x5f')]=juice(_0x82add7[_0x2e2e59][_0x483a('0x5f')]);}}_0x209c45[_0x483a('0x56')]=_0x82add7;return _0x209c45;});}})[_0x483a('0x21')](respondWithFilteredResult(_0xa85bc2,_0x2c6d00))['catch'](handleError(_0xa85bc2,null));};exports[_0x483a('0x3a')]=function(_0x319423,_0x37fd14,_0x12242e){var _0x482169,_0x2a1556={},_0x4f9190;if(_0x319423[_0x483a('0x5f')]['to']){_0x4f9190=_0x319423[_0x483a('0x5f')]['to'][_0x483a('0x9c')](',')[0x0];}return db['MailAccount'][_0x483a('0x5d')]({'where':{'id':_0x319423[_0x483a('0x58')]['id']},'include':[{'model':db[_0x483a('0xa2')],'as':_0x483a('0xa3'),'include':[{'model':db['CmContact'],'as':_0x483a('0xa4'),'where':{'email':_0x4f9190},'limit':0x1,'order':[['updatedAt',_0x483a('0xa5')]]}]},{'model':db['MailServerOut'],'as':_0x483a('0x5a'),'raw':!![]}]})['then'](handleEntityNotFound(_0x37fd14,null))[_0x483a('0x21')](function(_0x39e90e){if(_0x39e90e){_0x482169=_0x39e90e;if(_0x39e90e['Smtp']){if(_[_0x483a('0x71')](_0x319423[_0x483a('0x5f')][_0x483a('0xa6')])){_0x319423[_0x483a('0x5f')][_0x483a('0xa6')]=util[_0x483a('0x9d')]('%s\x20<%s>',_0x39e90e[_0x483a('0x52')],_0x39e90e['email']||_0x39e90e[_0x483a('0x5a')][_0x483a('0x73')]);}if(_0x319423[_0x483a('0x5f')][_0x483a('0xa7')]&&_0x319423['body'][_0x483a('0xa7')][_0x483a('0x4a')]){for(var _0x1477e6=0x0;_0x1477e6<_0x319423[_0x483a('0x5f')][_0x483a('0xa7')]['length'];_0x1477e6+=0x1){_0x319423[_0x483a('0x5f')][_0x483a('0xa7')][_0x1477e6]={'filename':_0x319423[_0x483a('0x5f')][_0x483a('0xa7')][_0x1477e6][_0x483a('0x52')],'path':path[_0x483a('0xa8')](config['root'],_0x483a('0xa9'),_0x319423['body'][_0x483a('0xa7')][_0x1477e6]['basename'])};}}var _0x15469e={'tls':{'rejectUnauthorized':![]}};if(_[_0x483a('0x71')](_0x39e90e[_0x483a('0x5a')]['service'])){if(_0x39e90e['Smtp'][_0x483a('0x77')]){_0x15469e[_0x483a('0xaa')]={'user':_0x39e90e[_0x483a('0x5a')]['user'],'pass':_0x39e90e[_0x483a('0x5a')][_0x483a('0x7c')]};}_0x15469e[_0x483a('0x78')]=_0x39e90e[_0x483a('0x5a')][_0x483a('0x78')];_0x15469e['port']=_0x39e90e[_0x483a('0x5a')][_0x483a('0x79')];_0x15469e['secure']=_0x39e90e[_0x483a('0x5a')][_0x483a('0xab')];}else{_0x15469e[_0x483a('0x7a')]=_0x39e90e[_0x483a('0x5a')]['service'];_0x15469e['auth']={'user':_0x39e90e[_0x483a('0x5a')]['user'],'pass':_0x39e90e[_0x483a('0x5a')][_0x483a('0x7c')]};}return respondWithRpcPromise(_0x483a('0xac'),_0x483a('0xad'),{'account':_0x15469e,'message':_0x319423['body']});}else{throw new Error(_0x483a('0xae'));}}})[_0x483a('0x21')](function(_0x57b8ce){if(_0x57b8ce){_0x2a1556=_0x57b8ce;if(_0x482169[_0x483a('0xa3')]){if(_0x482169[_0x483a('0xa3')][_0x483a('0xa4')][_0x483a('0x4a')]){return _0x482169[_0x483a('0xa3')][_0x483a('0xa4')][0x0];}else{return db[_0x483a('0x8b')][_0x483a('0x64')](_[_0x483a('0x1a')](_0x319423[_0x483a('0x5f')],{'firstName':_0x319423['body']['to'],'email':_0x319423[_0x483a('0x5f')]['to'],'phone':_0x319423[_0x483a('0x5f')]['to'],'ListId':_0x482169['ListId']}));}}else{throw new Error(_0x483a('0xae'));}}})[_0x483a('0x21')](function(_0xfd71f0){if(_0xfd71f0){var _0xd59bb2={'UserId':_0x319423[_0x483a('0x73')]['id'],'ContactId':_0xfd71f0['id'],'MailAccountId':_0x482169['id'],'inReplyTo':_0x2a1556['messageId'],'to':_0x319423[_0x483a('0x5f')][_0x483a('0xa6')],'cc':_0x319423[_0x483a('0x5f')]['cc'],'subject':_0x319423['body']['subject'],'attach':_0x319423[_0x483a('0x5f')]['attach'],'firstMsgDirection':_0x483a('0xaf'),'lastMsgAt':moment()[_0x483a('0x9d')](_0x483a('0x9e')),'lastMsgDirection':_0x483a('0xaf'),'Messages':[_[_0x483a('0x53')](_0x319423['body'],{'messageId':_0x2a1556['messageId'],'sentAt':moment()[_0x483a('0x9d')](_0x483a('0x9e')),'read':!![],'MailAccountId':_0x482169['id'],'UserId':_0x319423[_0x483a('0x73')]['id'],'ContactId':_0xfd71f0['id']})]};if(_0x319423[_0x483a('0x5f')][_0x483a('0xb0')]){_0xd59bb2=_['merge'](_0xd59bb2,_0x319423[_0x483a('0x5f')][_0x483a('0xb0')]);}return db[_0x483a('0x8a')]['create'](_0xd59bb2,{'include':[{'model':db[_0x483a('0x9f')],'as':'Messages'}]});}})[_0x483a('0x21')](respondWithResult(_0x37fd14,null))[_0x483a('0x2a')](handleError(_0x37fd14,null));};exports[_0x483a('0xb1')]=function(_0x5e40ee,_0x3206d9,_0x25b955){return db[_0x483a('0x40')][_0x483a('0x5d')]({'where':{'id':_0x5e40ee['params']['id']},'include':[{'model':db[_0x483a('0x3d')],'as':_0x483a('0x5a'),'raw':!![]}]})[_0x483a('0x21')](handleEntityNotFound(_0x3206d9,null))[_0x483a('0x21')](function(_0x25fbd5){if(_0x25fbd5&&_0x25fbd5[_0x483a('0x5a')]){var _0x2c804d={'id':_0x25fbd5['id'],'tls':{'rejectUnauthorized':![]}};if(_0x25fbd5['Smtp']['service']){_0x2c804d[_0x483a('0x7a')]=_0x25fbd5[_0x483a('0x5a')]['service'];}else{_0x2c804d['host']=_0x25fbd5[_0x483a('0x5a')][_0x483a('0x78')];_0x2c804d[_0x483a('0x79')]=_0x25fbd5[_0x483a('0x5a')]['port'];_0x2c804d[_0x483a('0xab')]=_0x25fbd5[_0x483a('0x5a')][_0x483a('0xab')];}if(_0x25fbd5['Smtp']['authentication']){_0x2c804d[_0x483a('0xaa')]={'user':_0x25fbd5[_0x483a('0x5a')]['user'],'pass':_0x25fbd5[_0x483a('0x5a')]['pass']};}return respondWithRpcPromise(_0x483a('0xb2'),'verifySmtp',{'account':_0x2c804d});}})[_0x483a('0x21')](respondWithResult(_0x3206d9,null))['catch'](handleError(_0x3206d9,null));};exports[_0x483a('0x36')]=function(_0x1f4aca,_0x337283){return db[_0x483a('0x40')][_0x483a('0x5d')]({'where':{'id':_0x1f4aca[_0x483a('0x58')]['id']}})['then'](handleEntityNotFound(_0x337283,null))[_0x483a('0x21')](function(_0xbcc318){if(_0xbcc318&&_0xbcc318['service']){throw new db[(_0x483a('0xb3'))]['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0xbcc318;})[_0x483a('0x21')](removeEntity(_0x337283,null))[_0x483a('0x2a')](handleError(_0x337283,null));};exports[_0x483a('0xb4')]=function(_0x358716,_0x1a337d,_0xbb2d78){return db[_0x483a('0x40')]['find']({'where':{'id':_0x358716[_0x483a('0x58')]['id']}})[_0x483a('0x21')](handleEntityNotFound(_0x1a337d,null))[_0x483a('0x21')](function(_0x1f013b){if(_0x1f013b){return _0x1f013b[_0x483a('0xb4')](_0x358716[_0x483a('0x5f')]['ids'],_['omit'](_0x358716['body'],[_0x483a('0x6c'),'id'])||{})['spread'](function(_0x5be8a3){for(var _0x3b4c2f=0x0;_0x3b4c2f<_0x358716['body'][_0x483a('0x6c')][_0x483a('0x4a')];_0x3b4c2f+=0x1){socket[_0x483a('0xb5')](_0x483a('0xb6'),{'UserId':Number(_0x358716[_0x483a('0x5f')][_0x483a('0x6c')][_0x3b4c2f]),'MailAccountId':Number(_0x358716['params']['id'])});}return _0x5be8a3;});}})[_0x483a('0x21')](respondWithResult(_0x1a337d,null))[_0x483a('0x2a')](handleError(_0x1a337d,null));};exports[_0x483a('0xb7')]=function(_0x28f01a,_0xdbaae6,_0x4b24d0){return db[_0x483a('0x40')][_0x483a('0x5d')]({'where':{'id':_0x28f01a[_0x483a('0x58')]['id']}})['then'](handleEntityNotFound(_0xdbaae6,null))['then'](function(_0x351615){if(_0x351615){return _0x351615[_0x483a('0xb7')](_0x28f01a[_0x483a('0x45')][_0x483a('0x6c')])['then'](function(){if(_[_0x483a('0xb8')](_0x28f01a['query'][_0x483a('0x6c')])){for(var _0x50f8c5=0x0;_0x50f8c5<_0x28f01a[_0x483a('0x45')][_0x483a('0x6c')][_0x483a('0x4a')];_0x50f8c5+=0x1){socket[_0x483a('0xb5')]('userMailAccount:remove',{'UserId':Number(_0x28f01a[_0x483a('0x45')][_0x483a('0x6c')][_0x50f8c5]),'MailAccountId':Number(_0x28f01a[_0x483a('0x58')]['id'])});}}else{socket[_0x483a('0xb5')](_0x483a('0xb9'),{'UserId':Number(_0x28f01a[_0x483a('0x45')][_0x483a('0x6c')]),'MailAccountId':Number(_0x28f01a[_0x483a('0x58')]['id'])});}});}})[_0x483a('0x21')](respondWithStatusCode(_0xdbaae6,null))[_0x483a('0x2a')](handleError(_0xdbaae6,null));};exports['getAgents']=function(_0x5054c6,_0x383b66,_0x470788){var _0x12758a={};var _0x56fd91={};var _0x38cfea;var _0x2d2b18;return db[_0x483a('0x40')][_0x483a('0x6a')]({'where':{'id':_0x5054c6['params']['id']}})[_0x483a('0x21')](handleEntityNotFound(_0x383b66,null))[_0x483a('0x21')](function(_0x38052d){if(_0x38052d){_0x38cfea=_0x38052d;_0x56fd91['model']=_['keys'](db[_0x483a('0x8d')]['rawAttributes']);_0x56fd91['query']=_[_0x483a('0x5c')](_0x5054c6[_0x483a('0x45')]);_0x56fd91[_0x483a('0x4d')]=_[_0x483a('0x48')](_0x56fd91['model'],_0x56fd91[_0x483a('0x45')]);_0x12758a[_0x483a('0x47')]=_['intersection'](_0x56fd91[_0x483a('0x46')],qs[_0x483a('0x49')](_0x5054c6[_0x483a('0x45')][_0x483a('0x49')]));_0x12758a['attributes']=_0x12758a[_0x483a('0x47')][_0x483a('0x4a')]?_0x12758a[_0x483a('0x47')]:_0x56fd91[_0x483a('0x46')];_0x12758a[_0x483a('0x65')]=qs[_0x483a('0x4c')](_0x5054c6[_0x483a('0x45')][_0x483a('0x4c')]);_0x12758a[_0x483a('0x50')]=qs[_0x483a('0x4d')](_[_0x483a('0x4e')](_0x5054c6['query'],_0x56fd91[_0x483a('0x4d')]));if(_0x5054c6[_0x483a('0x45')]['filter']){_0x12758a[_0x483a('0x50')]=_[_0x483a('0x53')](_0x12758a[_0x483a('0x50')],{'$or':_[_0x483a('0x3f')](_0x12758a[_0x483a('0x47')],function(_0x1725ce){var _0x40efca={};_0x40efca[_0x1725ce]={'$like':'%'+_0x5054c6[_0x483a('0x45')][_0x483a('0x4f')]+'%'};return _0x40efca;})});}_0x12758a=_[_0x483a('0x53')]({},_0x12758a,_0x5054c6['options']);return _0x38cfea[_0x483a('0xba')](_0x12758a);}})[_0x483a('0x21')](function(_0x18b3cf){if(_0x18b3cf){_0x2d2b18=_0x18b3cf[_0x483a('0x4a')];if(!_0x5054c6[_0x483a('0x45')][_0x483a('0x6b')](_0x483a('0x4b'))){_0x12758a[_0x483a('0x31')]=qs[_0x483a('0x31')](_0x5054c6[_0x483a('0x45')][_0x483a('0x31')]);_0x12758a['offset']=qs[_0x483a('0x2e')](_0x5054c6['query'][_0x483a('0x2e')]);}return _0x38cfea[_0x483a('0xba')](_0x12758a);}})[_0x483a('0x21')](function(_0x532ffe){if(_0x532ffe){return _0x532ffe?{'count':_0x2d2b18,'rows':_0x532ffe}:null;}})[_0x483a('0x21')](respondWithResult(_0x383b66,null))['catch'](handleError(_0x383b66,null));}; \ No newline at end of file +var _0xdbb7=['cservice','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','Contact','User','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','$gte','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','split','CmList','List','updatedAt','DESC','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','service','auth','secure','SendMail','sendMail','List\x20not\x20found','Contacts','subject','attach','out','messageId','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','juice','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./mailAccount.socket','jayson/promise','client','http','request','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','MailServerIn','Imap','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','show','params','Smtp','options','find','body','describe','addDisposition','MailAccountId','Disposition','findOne','length','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','create','key','ListId','active','description','isNil'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xdbb7,0x11d));var _0x7dbb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdbb7[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7dbb('0x0'));var rimraf=require(_0x7dbb('0x1'));var zipdir=require(_0x7dbb('0x2'));var jsonpatch=require(_0x7dbb('0x3'));var rp=require(_0x7dbb('0x4'));var moment=require(_0x7dbb('0x5'));var BPromise=require(_0x7dbb('0x6'));var Mustache=require(_0x7dbb('0x7'));var util=require(_0x7dbb('0x8'));var path=require(_0x7dbb('0x9'));var sox=require(_0x7dbb('0xa'));var csv=require(_0x7dbb('0xb'));var ejs=require(_0x7dbb('0xc'));var fs=require('fs');var fs_extra=require(_0x7dbb('0xd'));var _=require(_0x7dbb('0xe'));var squel=require('squel');var crypto=require(_0x7dbb('0xf'));var jsforce=require(_0x7dbb('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x7dbb('0xb'));var querystring=require(_0x7dbb('0x11'));var Papa=require('papaparse');var htmlToText=require('html-to-text');var juice=require(_0x7dbb('0x12'));var Redis=require('ioredis');var authService=require(_0x7dbb('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7dbb('0x14'));var logger=require(_0x7dbb('0x15'))(_0x7dbb('0x16'));var utils=require(_0x7dbb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7dbb('0x18'));var db=require(_0x7dbb('0x19'))['db'];config[_0x7dbb('0x1a')]=_[_0x7dbb('0x1b')](config[_0x7dbb('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7dbb('0x1a')]));require(_0x7dbb('0x1c'))['register'](socket);var jayson=require(_0x7dbb('0x1d'));var client=jayson[_0x7dbb('0x1e')][_0x7dbb('0x1f')]({'port':0x232b});function respondWithRpcPromise(_0x4cbb92,_0x597357,_0x100ed9,_0x164d94){return new BPromise(function(_0x3428d7,_0x15fb99){var _0x418bc5=_0x164d94||client;return _0x418bc5[_0x7dbb('0x20')](_0x4cbb92,_0x100ed9)['then'](function(_0x865db1){logger[_0x7dbb('0x21')](_0x7dbb('0x22'),_0x597357,'request\x20sent');logger[_0x7dbb('0x23')](_0x7dbb('0x24'),_0x597357,_0x7dbb('0x25'),JSON[_0x7dbb('0x26')](_0x865db1));if(_0x865db1[_0x7dbb('0x27')]){if(_0x865db1[_0x7dbb('0x27')]['code']===0x1f4){logger[_0x7dbb('0x27')](_0x7dbb('0x22'),_0x597357,_0x865db1[_0x7dbb('0x27')]['message']);return _0x15fb99(_0x865db1[_0x7dbb('0x27')][_0x7dbb('0x28')]);}logger[_0x7dbb('0x27')](_0x7dbb('0x22'),_0x597357,_0x865db1[_0x7dbb('0x27')][_0x7dbb('0x28')]);return _0x3428d7(_0x865db1['error'][_0x7dbb('0x28')]);}else{logger[_0x7dbb('0x21')](_0x7dbb('0x22'),_0x597357,_0x7dbb('0x25'));_0x3428d7(_0x865db1['result'][_0x7dbb('0x28')]);}})[_0x7dbb('0x29')](function(_0x258fa9){logger[_0x7dbb('0x27')]('MailAccount,\x20%s,\x20%s',_0x597357,_0x258fa9);_0x15fb99(_0x258fa9);});});}function respondWithStatusCode(_0x476c41,_0x363973){_0x363973=_0x363973||0xcc;return function(_0x351edd){if(_0x351edd){return _0x476c41[_0x7dbb('0x2a')](_0x363973);}return _0x476c41[_0x7dbb('0x2b')](_0x363973)[_0x7dbb('0x2c')]();};}function respondWithResult(_0x465c66,_0x2d0289){_0x2d0289=_0x2d0289||0xc8;return function(_0x44a973){if(_0x44a973){return _0x465c66[_0x7dbb('0x2b')](_0x2d0289)[_0x7dbb('0x2d')](_0x44a973);}};}function respondWithFilteredResult(_0x5b99e8,_0xc8f256){return function(_0x5981eb){if(_0x5981eb){var _0x504adb=typeof _0xc8f256[_0x7dbb('0x2e')]===_0x7dbb('0x2f')&&typeof _0xc8f256[_0x7dbb('0x30')]===_0x7dbb('0x2f');var _0x8be971=_0x5981eb[_0x7dbb('0x31')];var _0x27da81=_0x504adb?0x0:_0xc8f256[_0x7dbb('0x2e')];var _0x216e4a=_0x504adb?_0x5981eb['count']:_0xc8f256[_0x7dbb('0x2e')]+_0xc8f256['limit'];var _0x4cb0f7;if(_0x216e4a>=_0x8be971){_0x216e4a=_0x8be971;_0x4cb0f7=0xc8;}else{_0x4cb0f7=0xce;}_0x5b99e8[_0x7dbb('0x2b')](_0x4cb0f7);return _0x5b99e8[_0x7dbb('0x32')](_0x7dbb('0x33'),_0x27da81+'-'+_0x216e4a+'/'+_0x8be971)[_0x7dbb('0x2d')](_0x5981eb);}return null;};}function patchUpdates(_0x4988fa){return function(_0x3341f0){try{jsonpatch[_0x7dbb('0x34')](_0x3341f0,_0x4988fa,!![]);}catch(_0x3bf4a6){return BPromise[_0x7dbb('0x35')](_0x3bf4a6);}return _0x3341f0[_0x7dbb('0x36')]();};}function saveUpdates(_0x3b3836,_0x33d93e){return function(_0x4b7015){if(_0x4b7015){return _0x4b7015[_0x7dbb('0x37')](_0x3b3836)[_0x7dbb('0x38')](function(_0x3786ac){return _0x3786ac;});}return null;};}function removeEntity(_0x5573ad,_0x13d34d){return function(_0x5e2643){if(_0x5e2643){return _0x5e2643[_0x7dbb('0x39')]()['then'](function(){var _0x132faf=_0x5e2643[_0x7dbb('0x3a')]({'plain':!![]});var _0x3d8cb5='MailAccounts';return db[_0x7dbb('0x3b')][_0x7dbb('0x39')]({'where':{'type':_0x3d8cb5,'resourceId':_0x132faf['id']}})[_0x7dbb('0x38')](function(){return _0x5e2643;});})[_0x7dbb('0x38')](function(){_0x5573ad[_0x7dbb('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a93f9,_0x1b91d8){return function(_0x1a2f02){if(!_0x1a2f02){_0x2a93f9[_0x7dbb('0x2a')](0x194);}return _0x1a2f02;};}function handleError(_0x547859,_0x2c5490){_0x2c5490=_0x2c5490||0x1f4;return function(_0x5956c1){logger[_0x7dbb('0x27')](_0x5956c1[_0x7dbb('0x3c')]);if(_0x5956c1[_0x7dbb('0x3d')]){delete _0x5956c1[_0x7dbb('0x3d')];}_0x547859[_0x7dbb('0x2b')](_0x2c5490)[_0x7dbb('0x3e')](_0x5956c1);};}exports['index']=function(_0x94d2f9,_0x315b22){var _0x543b98={'include':[{'model':db[_0x7dbb('0x3f')],'as':_0x7dbb('0x40')},{'model':db[_0x7dbb('0x41')],'as':'Smtp'},{'model':db[_0x7dbb('0x42')],'as':_0x7dbb('0x43')}]},_0x6d8b30={},_0x4cd1f9={'count':0x0,'rows':[]};var _0x6db8fa=_['map'](db[_0x7dbb('0x44')][_0x7dbb('0x45')],function(_0x3b8b57){return{'name':_0x3b8b57['fieldName'],'type':_0x3b8b57['type']['key']};});_0x6d8b30[_0x7dbb('0x46')]=_[_0x7dbb('0x47')](_0x6db8fa,_0x7dbb('0x3d'));_0x6d8b30[_0x7dbb('0x48')]=_[_0x7dbb('0x49')](_0x94d2f9[_0x7dbb('0x48')]);_0x6d8b30[_0x7dbb('0x4a')]=_[_0x7dbb('0x4b')](_0x6d8b30['model'],_0x6d8b30['query']);_0x543b98[_0x7dbb('0x4c')]=_[_0x7dbb('0x4b')](_0x6d8b30[_0x7dbb('0x46')],qs[_0x7dbb('0x4d')](_0x94d2f9[_0x7dbb('0x48')][_0x7dbb('0x4d')]));_0x543b98['attributes']=_0x543b98['attributes']['length']?_0x543b98[_0x7dbb('0x4c')]:_0x6d8b30['model'];if(!_0x94d2f9['query'][_0x7dbb('0x4e')]('nolimit')){_0x543b98['limit']=qs[_0x7dbb('0x30')](_0x94d2f9[_0x7dbb('0x48')][_0x7dbb('0x30')]);_0x543b98[_0x7dbb('0x2e')]=qs[_0x7dbb('0x2e')](_0x94d2f9[_0x7dbb('0x48')]['offset']);}_0x543b98[_0x7dbb('0x4f')]=qs[_0x7dbb('0x50')](_0x94d2f9['query'][_0x7dbb('0x50')]);_0x543b98[_0x7dbb('0x51')]=qs[_0x7dbb('0x4a')](_[_0x7dbb('0x52')](_0x94d2f9['query'],_0x6d8b30[_0x7dbb('0x4a')]),_0x6db8fa);if(_0x94d2f9['query'][_0x7dbb('0x53')]){_0x543b98['where']=_[_0x7dbb('0x54')](_0x543b98[_0x7dbb('0x51')],{'$or':_[_0x7dbb('0x47')](_0x6db8fa,function(_0x1bf030){if(_0x1bf030[_0x7dbb('0x55')]!=='VIRTUAL'){var _0x2c48ab={};_0x2c48ab[_0x1bf030[_0x7dbb('0x3d')]]={'$like':'%'+_0x94d2f9[_0x7dbb('0x48')]['filter']+'%'};return _0x2c48ab;}})});}_0x543b98=_[_0x7dbb('0x54')]({},_0x543b98,_0x94d2f9['options']);var _0xdb3432={'where':_0x543b98['where']};return db['MailAccount'][_0x7dbb('0x31')](_0xdb3432)[_0x7dbb('0x38')](function(_0x42d490){_0x4cd1f9[_0x7dbb('0x31')]=_0x42d490;if(_0x94d2f9[_0x7dbb('0x48')][_0x7dbb('0x56')]){_0x543b98[_0x7dbb('0x57')]=[{'all':!![]}];}return db[_0x7dbb('0x44')][_0x7dbb('0x58')](_0x543b98);})['then'](function(_0x30f26b){_0x4cd1f9[_0x7dbb('0x59')]=_0x30f26b;return _0x4cd1f9;})[_0x7dbb('0x38')](respondWithFilteredResult(_0x315b22,_0x543b98))[_0x7dbb('0x29')](handleError(_0x315b22,null));};exports[_0x7dbb('0x5a')]=function(_0x4dfb19,_0x29da17){var _0x2fa0da={'raw':![],'where':{'id':_0x4dfb19[_0x7dbb('0x5b')]['id']},'include':[{'model':db[_0x7dbb('0x3f')],'as':'Imap'},{'model':db[_0x7dbb('0x41')],'as':_0x7dbb('0x5c')},{'model':db['Pause'],'as':_0x7dbb('0x43')}]},_0x26dc53={};_0x26dc53['model']=_['keys'](db['MailAccount'][_0x7dbb('0x45')]);_0x26dc53[_0x7dbb('0x48')]=_[_0x7dbb('0x49')](_0x4dfb19[_0x7dbb('0x48')]);_0x26dc53[_0x7dbb('0x4a')]=_[_0x7dbb('0x4b')](_0x26dc53[_0x7dbb('0x46')],_0x26dc53['query']);_0x2fa0da[_0x7dbb('0x4c')]=_[_0x7dbb('0x4b')](_0x26dc53['model'],qs[_0x7dbb('0x4d')](_0x4dfb19[_0x7dbb('0x48')][_0x7dbb('0x4d')]));_0x2fa0da[_0x7dbb('0x4c')]=_0x2fa0da[_0x7dbb('0x4c')]['length']?_0x2fa0da[_0x7dbb('0x4c')]:_0x26dc53['model'];if(_0x4dfb19[_0x7dbb('0x48')]['includeAll']){_0x2fa0da[_0x7dbb('0x57')]=[{'all':!![]}];}_0x2fa0da=_[_0x7dbb('0x54')]({},_0x2fa0da,_0x4dfb19[_0x7dbb('0x5d')]);return db[_0x7dbb('0x44')][_0x7dbb('0x5e')](_0x2fa0da)[_0x7dbb('0x38')](handleEntityNotFound(_0x29da17,null))['then'](respondWithResult(_0x29da17,null))[_0x7dbb('0x29')](handleError(_0x29da17,null));};exports[_0x7dbb('0x37')]=function(_0x56a8fc,_0x3eca60){if(_0x56a8fc[_0x7dbb('0x5f')]['id']){delete _0x56a8fc[_0x7dbb('0x5f')]['id'];}return db[_0x7dbb('0x44')][_0x7dbb('0x5e')]({'where':{'id':_0x56a8fc['params']['id']},'include':[{'model':db[_0x7dbb('0x3f')],'as':_0x7dbb('0x40')},{'model':db[_0x7dbb('0x41')],'as':_0x7dbb('0x5c')},{'model':db[_0x7dbb('0x42')],'as':_0x7dbb('0x43')}]})['then'](handleEntityNotFound(_0x3eca60,null))[_0x7dbb('0x38')](saveUpdates(_0x56a8fc[_0x7dbb('0x5f')],null))[_0x7dbb('0x38')](function(_0xe8a9ce){if(_0xe8a9ce&&_0x56a8fc[_0x7dbb('0x5f')]['Imap']){return db[_0x7dbb('0x3f')][_0x7dbb('0x37')](_0x56a8fc[_0x7dbb('0x5f')]['Imap'],{'where':{'MailAccountId':_0xe8a9ce['id']}})[_0x7dbb('0x38')](function(){return _0xe8a9ce;});}return _0xe8a9ce;})['then'](function(_0x344c9f){if(_0x344c9f&&_0x56a8fc[_0x7dbb('0x5f')][_0x7dbb('0x5c')]){return db['MailServerOut'][_0x7dbb('0x37')](_0x56a8fc[_0x7dbb('0x5f')][_0x7dbb('0x5c')],{'where':{'MailAccountId':_0x344c9f['id']}})[_0x7dbb('0x38')](function(){return _0x344c9f;});}return _0x344c9f;})[_0x7dbb('0x38')](respondWithResult(_0x3eca60,null))['catch'](handleError(_0x3eca60,null));};exports[_0x7dbb('0x60')]=function(_0xb16e8a,_0x53aaf6){return db[_0x7dbb('0x44')][_0x7dbb('0x60')]()[_0x7dbb('0x38')](respondWithResult(_0x53aaf6,null))[_0x7dbb('0x29')](handleError(_0x53aaf6,null));};exports[_0x7dbb('0x61')]=function(_0x340376,_0xfb7384,_0x120077){if(_0x340376[_0x7dbb('0x5f')]['id']){delete _0x340376[_0x7dbb('0x5f')]['id'];}return db[_0x7dbb('0x44')][_0x7dbb('0x5e')]({'where':{'id':_0x340376[_0x7dbb('0x5b')]['id']}})[_0x7dbb('0x38')](handleEntityNotFound(_0xfb7384,null))[_0x7dbb('0x38')](function(_0x2b1c23){if(_0x2b1c23){_0x340376[_0x7dbb('0x5f')][_0x7dbb('0x62')]=_0x2b1c23['id'];return db[_0x7dbb('0x63')]['create'](_0x340376[_0x7dbb('0x5f')]);}})[_0x7dbb('0x38')](respondWithResult(_0xfb7384,null))[_0x7dbb('0x29')](handleError(_0xfb7384,null));};exports['getDispositions']=function(_0x3b2664,_0xeb421b,_0x47e456){var _0x180833={'raw':![],'where':{}};var _0x1e2632={};var _0xf5c0f7={'count':0x0,'rows':[]};return db[_0x7dbb('0x44')][_0x7dbb('0x64')]({'where':{'id':_0x3b2664[_0x7dbb('0x5b')]['id']}})['then'](handleEntityNotFound(_0xeb421b,null))[_0x7dbb('0x38')](function(_0x28c093){if(_0x28c093){_0x1e2632[_0x7dbb('0x46')]=_[_0x7dbb('0x49')](db[_0x7dbb('0x63')][_0x7dbb('0x45')]);_0x1e2632[_0x7dbb('0x48')]=_['keys'](_0x3b2664['query']);_0x1e2632[_0x7dbb('0x4a')]=_[_0x7dbb('0x4b')](_0x1e2632[_0x7dbb('0x46')],_0x1e2632[_0x7dbb('0x48')]);_0x180833[_0x7dbb('0x4c')]=_[_0x7dbb('0x4b')](_0x1e2632['model'],qs[_0x7dbb('0x4d')](_0x3b2664[_0x7dbb('0x48')][_0x7dbb('0x4d')]));_0x180833['attributes']=_0x180833['attributes'][_0x7dbb('0x65')]?_0x180833['attributes']:_0x1e2632[_0x7dbb('0x46')];if(!_0x3b2664[_0x7dbb('0x48')][_0x7dbb('0x4e')](_0x7dbb('0x66'))){_0x180833[_0x7dbb('0x30')]=qs[_0x7dbb('0x30')](_0x3b2664['query']['limit']);_0x180833[_0x7dbb('0x2e')]=qs[_0x7dbb('0x2e')](_0x3b2664[_0x7dbb('0x48')][_0x7dbb('0x2e')]);}_0x180833[_0x7dbb('0x4f')]=qs[_0x7dbb('0x50')](_0x3b2664['query'][_0x7dbb('0x50')]);_0x180833['where']=qs[_0x7dbb('0x4a')](_[_0x7dbb('0x52')](_0x3b2664[_0x7dbb('0x48')],_0x1e2632[_0x7dbb('0x4a')]));_0x180833[_0x7dbb('0x51')][_0x7dbb('0x62')]=_0x28c093['id'];if(_0x3b2664[_0x7dbb('0x48')]['filter']){_0x180833[_0x7dbb('0x51')]=_[_0x7dbb('0x54')](_0x180833[_0x7dbb('0x51')],{'$or':_[_0x7dbb('0x47')](_0x180833[_0x7dbb('0x4c')],function(_0x444267){var _0x47fc75={};_0x47fc75[_0x444267]={'$like':'%'+_0x3b2664[_0x7dbb('0x48')][_0x7dbb('0x53')]+'%'};return _0x47fc75;})});}_0x180833=_[_0x7dbb('0x54')]({},_0x180833,_0x3b2664[_0x7dbb('0x5d')]);return db[_0x7dbb('0x63')][_0x7dbb('0x31')]({'where':_0x180833[_0x7dbb('0x51')]})[_0x7dbb('0x38')](function(_0x5b7636){_0xf5c0f7['count']=_0x5b7636;if(_0x3b2664[_0x7dbb('0x48')]['includeAll']){_0x180833[_0x7dbb('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x7dbb('0x58')](_0x180833);})['then'](function(_0x12b40a){_0xf5c0f7['rows']=_0x12b40a;return _0xf5c0f7;});}})[_0x7dbb('0x38')](respondWithFilteredResult(_0xeb421b,_0x180833))[_0x7dbb('0x29')](handleError(_0xeb421b,null));};exports['removeDispositions']=function(_0x432c16,_0x2ef105,_0x51e489){return db[_0x7dbb('0x44')][_0x7dbb('0x5e')]({'where':{'id':_0x432c16[_0x7dbb('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2ef105,null))['then'](function(_0x564f58){if(_0x564f58){return _0x564f58[_0x7dbb('0x67')](_0x432c16[_0x7dbb('0x48')][_0x7dbb('0x68')]);}})[_0x7dbb('0x38')](respondWithStatusCode(_0x2ef105,null))[_0x7dbb('0x29')](handleError(_0x2ef105,null));};exports[_0x7dbb('0x69')]=function(_0x5df0a8,_0x4e8ff7,_0x5af50f){if(_0x5df0a8[_0x7dbb('0x5f')]['id']){delete _0x5df0a8[_0x7dbb('0x5f')]['id'];}return db[_0x7dbb('0x44')]['find']({'where':{'id':_0x5df0a8[_0x7dbb('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4e8ff7,null))[_0x7dbb('0x38')](function(_0x20cc47){if(_0x20cc47){_0x5df0a8[_0x7dbb('0x5f')]['MailAccountId']=_0x20cc47['id'];return db[_0x7dbb('0x6a')][_0x7dbb('0x6b')](_0x5df0a8[_0x7dbb('0x5f')]);}})[_0x7dbb('0x38')](respondWithResult(_0x4e8ff7,null))[_0x7dbb('0x29')](handleError(_0x4e8ff7,null));};exports['getAnswers']=function(_0x82152e,_0x5b45ca,_0x334af9){var _0x5bd944={'raw':![],'where':{}};var _0x1b5ee8={};var _0x22b518={'count':0x0,'rows':[]};return db[_0x7dbb('0x44')]['findOne']({'where':{'id':_0x82152e[_0x7dbb('0x5b')]['id']}})[_0x7dbb('0x38')](handleEntityNotFound(_0x5b45ca,null))[_0x7dbb('0x38')](function(_0x164e31){if(_0x164e31){_0x1b5ee8[_0x7dbb('0x46')]=_[_0x7dbb('0x49')](db[_0x7dbb('0x6a')][_0x7dbb('0x45')]);_0x1b5ee8[_0x7dbb('0x48')]=_[_0x7dbb('0x49')](_0x82152e[_0x7dbb('0x48')]);_0x1b5ee8['filters']=_[_0x7dbb('0x4b')](_0x1b5ee8[_0x7dbb('0x46')],_0x1b5ee8[_0x7dbb('0x48')]);_0x5bd944['attributes']=_['intersection'](_0x1b5ee8[_0x7dbb('0x46')],qs['fields'](_0x82152e[_0x7dbb('0x48')]['fields']));_0x5bd944[_0x7dbb('0x4c')]=_0x5bd944[_0x7dbb('0x4c')][_0x7dbb('0x65')]?_0x5bd944[_0x7dbb('0x4c')]:_0x1b5ee8[_0x7dbb('0x46')];if(!_0x82152e[_0x7dbb('0x48')][_0x7dbb('0x4e')](_0x7dbb('0x66'))){_0x5bd944[_0x7dbb('0x30')]=qs['limit'](_0x82152e[_0x7dbb('0x48')][_0x7dbb('0x30')]);_0x5bd944['offset']=qs[_0x7dbb('0x2e')](_0x82152e[_0x7dbb('0x48')]['offset']);}_0x5bd944[_0x7dbb('0x4f')]=qs['sort'](_0x82152e['query'][_0x7dbb('0x50')]);_0x5bd944['where']=qs[_0x7dbb('0x4a')](_[_0x7dbb('0x52')](_0x82152e['query'],_0x1b5ee8['filters']));_0x5bd944[_0x7dbb('0x51')][_0x7dbb('0x62')]=_0x164e31['id'];if(_0x82152e[_0x7dbb('0x48')][_0x7dbb('0x53')]){_0x5bd944[_0x7dbb('0x51')]=_[_0x7dbb('0x54')](_0x5bd944[_0x7dbb('0x51')],{'$or':_[_0x7dbb('0x47')](_0x5bd944[_0x7dbb('0x4c')],function(_0x1e38fc){var _0x593b61={};_0x593b61[_0x1e38fc]={'$like':'%'+_0x82152e['query'][_0x7dbb('0x53')]+'%'};return _0x593b61;})});}_0x5bd944=_[_0x7dbb('0x54')]({},_0x5bd944,_0x82152e[_0x7dbb('0x5d')]);return db[_0x7dbb('0x6a')][_0x7dbb('0x31')]({'where':_0x5bd944['where']})[_0x7dbb('0x38')](function(_0x5018a4){_0x22b518[_0x7dbb('0x31')]=_0x5018a4;if(_0x82152e[_0x7dbb('0x48')][_0x7dbb('0x56')]){_0x5bd944[_0x7dbb('0x57')]=[{'all':!![]}];}return db[_0x7dbb('0x6a')][_0x7dbb('0x58')](_0x5bd944);})[_0x7dbb('0x38')](function(_0x14aba2){_0x22b518['rows']=_0x14aba2;return _0x22b518;});}})[_0x7dbb('0x38')](respondWithFilteredResult(_0x5b45ca,_0x5bd944))[_0x7dbb('0x29')](handleError(_0x5b45ca,null));};exports['removeAnswers']=function(_0x50ff41,_0x46f5e1,_0x220c58){return db[_0x7dbb('0x44')]['find']({'where':{'id':_0x50ff41['params']['id']}})['then'](handleEntityNotFound(_0x46f5e1,null))['then'](function(_0xaf53cf){if(_0xaf53cf){return _0xaf53cf['removeAnswers'](_0x50ff41[_0x7dbb('0x48')]['ids']);}})[_0x7dbb('0x38')](respondWithStatusCode(_0x46f5e1,null))[_0x7dbb('0x29')](handleError(_0x46f5e1,null));};exports[_0x7dbb('0x6b')]=function(_0x85196b,_0x5b300c){var _0x42356f={'name':_0x85196b[_0x7dbb('0x5f')][_0x7dbb('0x3d')],'key':_0x85196b[_0x7dbb('0x5f')][_0x7dbb('0x6c')],'email':_0x85196b[_0x7dbb('0x5f')]['email'],'ListId':_0x85196b[_0x7dbb('0x5f')][_0x7dbb('0x6d')],'active':!_['isNil'](_0x85196b[_0x7dbb('0x5f')][_0x7dbb('0x6e')])?_0x85196b[_0x7dbb('0x5f')][_0x7dbb('0x6e')]:!![],'description':_0x85196b[_0x7dbb('0x5f')][_0x7dbb('0x6f')]||null,'Imap':{},'Smtp':{}};if(_[_0x7dbb('0x70')](_0x85196b['body'][_0x7dbb('0x71')])){if(_0x85196b[_0x7dbb('0x5f')][_0x7dbb('0x72')]){_0x42356f[_0x7dbb('0x40')][_0x7dbb('0x73')]=_0x42356f['Smtp'][_0x7dbb('0x73')]=_0x85196b['body'][_0x7dbb('0x74')];_0x42356f[_0x7dbb('0x40')][_0x7dbb('0x75')]=_0x42356f[_0x7dbb('0x5c')][_0x7dbb('0x76')]=_0x85196b['body'][_0x7dbb('0x77')];}else{_0x42356f[_0x7dbb('0x40')][_0x7dbb('0x78')]=_0x42356f[_0x7dbb('0x5c')]['authentication']=![];}_0x42356f[_0x7dbb('0x40')][_0x7dbb('0x79')]=_0x85196b['body'][_0x7dbb('0x40')][_0x7dbb('0x79')];_0x42356f[_0x7dbb('0x40')][_0x7dbb('0x7a')]=_0x85196b['body'][_0x7dbb('0x40')][_0x7dbb('0x7a')];_0x42356f[_0x7dbb('0x5c')]['host']=_0x85196b[_0x7dbb('0x5f')][_0x7dbb('0x5c')][_0x7dbb('0x79')];_0x42356f[_0x7dbb('0x5c')][_0x7dbb('0x7a')]=_0x85196b[_0x7dbb('0x5f')][_0x7dbb('0x5c')][_0x7dbb('0x7a')];}else{_0x42356f['Imap']['service']=_0x42356f['Smtp']['service']=_0x85196b[_0x7dbb('0x5f')][_0x7dbb('0x71')];_0x42356f[_0x7dbb('0x40')][_0x7dbb('0x73')]=_0x42356f[_0x7dbb('0x5c')]['user']=_0x85196b[_0x7dbb('0x5f')][_0x7dbb('0x74')];_0x42356f['Imap'][_0x7dbb('0x75')]=_0x42356f[_0x7dbb('0x5c')]['pass']=_0x85196b['body']['cpassword'];}return db['MailAccount'][_0x7dbb('0x6b')](_0x42356f,{'include':[{'model':db[_0x7dbb('0x41')],'as':_0x7dbb('0x5c')},{'model':db[_0x7dbb('0x3f')],'as':'Imap'}]})['then'](function(_0x5bbd42){var _0x47eaaf=_0x85196b[_0x7dbb('0x73')][_0x7dbb('0x3a')]({'plain':!![]});if(!_0x47eaaf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47eaaf[_0x7dbb('0x7b')]==='user'){var _0x46bdba=_0x5bbd42['get']({'plain':!![]});return db[_0x7dbb('0x7c')]['find']({'where':{'name':'MailAccounts','userProfileId':_0x47eaaf['userProfileId']},'raw':!![]})['then'](function(_0x44a319){if(_0x44a319&&_0x44a319[_0x7dbb('0x7d')]===0x0){return db['UserProfileResource'][_0x7dbb('0x6b')]({'name':_0x46bdba[_0x7dbb('0x3d')],'resourceId':_0x46bdba['id'],'type':_0x44a319[_0x7dbb('0x3d')],'sectionId':_0x44a319['id']},{})[_0x7dbb('0x38')](function(){return _0x5bbd42;});}else{return _0x5bbd42;}})[_0x7dbb('0x29')](function(_0x65ced1){logger[_0x7dbb('0x27')](_0x7dbb('0x7e'),_0x65ced1);throw _0x65ced1;});}return _0x5bbd42;})[_0x7dbb('0x38')](respondWithResult(_0x5b300c,0xc9))[_0x7dbb('0x29')](handleError(_0x5b300c,null));};exports[_0x7dbb('0x7f')]=function(_0x2f4da8,_0x10cf07,_0x33af2f){return db[_0x7dbb('0x44')][_0x7dbb('0x64')]({'where':{'id':_0x2f4da8[_0x7dbb('0x5b')]['id']}})[_0x7dbb('0x38')](handleEntityNotFound(_0x10cf07,null))['then'](function(_0x4b68fe){if(_0x4b68fe){return _0x4b68fe[_0x7dbb('0x7f')]();}return null;})['then'](respondWithResult(_0x10cf07,null))[_0x7dbb('0x29')](handleError(_0x10cf07,null));};exports['addImap']=function(_0x299db7,_0x6cadd2,_0x59c0a3){if(_0x299db7['body']['id']){delete _0x299db7['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x299db7[_0x7dbb('0x5b')]['id']}})[_0x7dbb('0x38')](handleEntityNotFound(_0x6cadd2,null))[_0x7dbb('0x38')](function(_0x16744a){if(_0x16744a){_0x299db7['body']['MailAccountId']=_0x16744a['id'];return db['MailServerIn'][_0x7dbb('0x6b')](_0x299db7[_0x7dbb('0x5f')]);}})['then'](respondWithResult(_0x6cadd2,null))[_0x7dbb('0x29')](handleError(_0x6cadd2,null));};exports[_0x7dbb('0x80')]=function(_0x400842,_0x4dae40,_0xb4403f){return db['MailAccount'][_0x7dbb('0x64')]({'where':{'id':_0x400842[_0x7dbb('0x5b')]['id']}})[_0x7dbb('0x38')](handleEntityNotFound(_0x4dae40,null))[_0x7dbb('0x38')](function(_0x3e352e){if(_0x3e352e){return _0x3e352e[_0x7dbb('0x81')](null);}return null;})[_0x7dbb('0x38')](respondWithStatusCode(_0x4dae40,null))[_0x7dbb('0x29')](handleError(_0x4dae40,null));};exports[_0x7dbb('0x82')]=function(_0x4a9515,_0x1a586a,_0x33e253){return db[_0x7dbb('0x44')]['findOne']({'where':{'id':_0x4a9515[_0x7dbb('0x5b')]['id']}})[_0x7dbb('0x38')](handleEntityNotFound(_0x1a586a,null))[_0x7dbb('0x38')](function(_0x2295f9){if(_0x2295f9){return _0x2295f9[_0x7dbb('0x82')]();}return null;})[_0x7dbb('0x38')](respondWithResult(_0x1a586a,null))[_0x7dbb('0x29')](handleError(_0x1a586a,null));};exports[_0x7dbb('0x83')]=function(_0x7a214d,_0x47f9a2,_0x5b56a9){if(_0x7a214d[_0x7dbb('0x5f')]['id']){delete _0x7a214d['body']['id'];}return db[_0x7dbb('0x44')][_0x7dbb('0x5e')]({'where':{'id':_0x7a214d[_0x7dbb('0x5b')]['id']}})[_0x7dbb('0x38')](handleEntityNotFound(_0x47f9a2,null))[_0x7dbb('0x38')](function(_0x22abc3){if(_0x22abc3){_0x7a214d[_0x7dbb('0x5f')]['MailAccountId']=_0x22abc3['id'];return db['MailServerOut'][_0x7dbb('0x6b')](_0x7a214d[_0x7dbb('0x5f')]);}})[_0x7dbb('0x38')](respondWithResult(_0x47f9a2,null))[_0x7dbb('0x29')](handleError(_0x47f9a2,null));};exports[_0x7dbb('0x84')]=function(_0x392699,_0x5e6bc6,_0x437ed9){return db['MailAccount'][_0x7dbb('0x64')]({'where':{'id':_0x392699[_0x7dbb('0x5b')]['id']}})[_0x7dbb('0x38')](handleEntityNotFound(_0x5e6bc6,null))['then'](function(_0x4ea30e){if(_0x4ea30e){return _0x4ea30e[_0x7dbb('0x85')](null);}return null;})[_0x7dbb('0x38')](respondWithStatusCode(_0x5e6bc6,null))['catch'](handleError(_0x5e6bc6,null));};exports[_0x7dbb('0x86')]=function(_0x22d6a5,_0x407d12,_0x348d4e){return db['MailInteraction'][_0x7dbb('0x5e')]({'where':{'id':_0x22d6a5[_0x7dbb('0x5b')]['id']}})[_0x7dbb('0x38')](handleEntityNotFound(_0x407d12,null))['then'](function(_0x36b3a9){if(_0x36b3a9){return _0x36b3a9[_0x7dbb('0x86')](_0x22d6a5[_0x7dbb('0x5f')][_0x7dbb('0x68')],_[_0x7dbb('0x87')](_0x22d6a5[_0x7dbb('0x5f')],[_0x7dbb('0x68'),'id'])||{});}})[_0x7dbb('0x38')](respondWithResult(_0x407d12,null))['catch'](handleError(_0x407d12,null));};exports[_0x7dbb('0x88')]=function(_0x42b206,_0xae6649,_0x47e27e){var _0x1b5b96={'raw':![],'where':{}};var _0x44a07a={};var _0x5d18ce={'count':0x0,'rows':[]};return db[_0x7dbb('0x44')][_0x7dbb('0x64')]({'where':{'id':_0x42b206[_0x7dbb('0x5b')]['id']}})[_0x7dbb('0x38')](handleEntityNotFound(_0xae6649,null))['then'](function(_0x3c2ccc){if(_0x3c2ccc){_0x44a07a[_0x7dbb('0x46')]=_[_0x7dbb('0x49')](db[_0x7dbb('0x89')]['rawAttributes']);_0x44a07a['query']=_[_0x7dbb('0x49')](_0x42b206[_0x7dbb('0x48')]);_0x44a07a[_0x7dbb('0x4a')]=_['intersection'](_0x44a07a[_0x7dbb('0x46')],_0x44a07a[_0x7dbb('0x48')]);_0x1b5b96[_0x7dbb('0x4c')]=_[_0x7dbb('0x4b')](_0x44a07a['model'],qs[_0x7dbb('0x4d')](_0x42b206[_0x7dbb('0x48')][_0x7dbb('0x4d')]));_0x1b5b96[_0x7dbb('0x4c')]=_0x1b5b96[_0x7dbb('0x4c')][_0x7dbb('0x65')]?_0x1b5b96[_0x7dbb('0x4c')]:_0x44a07a[_0x7dbb('0x46')];if(!_0x42b206[_0x7dbb('0x48')]['hasOwnProperty'](_0x7dbb('0x66'))){_0x1b5b96[_0x7dbb('0x30')]=qs[_0x7dbb('0x30')](_0x42b206[_0x7dbb('0x48')]['limit']);_0x1b5b96[_0x7dbb('0x2e')]=qs[_0x7dbb('0x2e')](_0x42b206[_0x7dbb('0x48')]['offset']);}_0x1b5b96[_0x7dbb('0x4f')]=qs['sort'](_0x42b206[_0x7dbb('0x48')][_0x7dbb('0x50')]);_0x1b5b96[_0x7dbb('0x51')]=qs[_0x7dbb('0x4a')](_[_0x7dbb('0x52')](_0x42b206[_0x7dbb('0x48')],_0x44a07a['filters']));_0x1b5b96['where'][_0x7dbb('0x62')]=_0x3c2ccc['id'];if(_0x42b206[_0x7dbb('0x48')][_0x7dbb('0x53')]){_0x1b5b96[_0x7dbb('0x51')]=_[_0x7dbb('0x54')](_0x1b5b96[_0x7dbb('0x51')],{'$or':_[_0x7dbb('0x47')](_0x1b5b96[_0x7dbb('0x4c')],function(_0xae31d){var _0x1b2a4b={};_0x1b2a4b[_0xae31d]={'$like':'%'+_0x42b206[_0x7dbb('0x48')][_0x7dbb('0x53')]+'%'};return _0x1b2a4b;})});}_0x1b5b96=_[_0x7dbb('0x54')]({},_0x1b5b96,_0x42b206['options']);return db[_0x7dbb('0x89')][_0x7dbb('0x31')]({'where':_0x1b5b96[_0x7dbb('0x51')]})['then'](function(_0x35a599){_0x5d18ce[_0x7dbb('0x31')]=_0x35a599;if(_0x42b206[_0x7dbb('0x48')][_0x7dbb('0x56')]){_0x1b5b96[_0x7dbb('0x57')]=[{'model':db[_0x7dbb('0x8a')],'as':_0x7dbb('0x8b'),'required':![]},{'model':db[_0x7dbb('0x8c')],'as':'Owner','attributes':[_0x7dbb('0x3d'),_0x7dbb('0x8d'),_0x7dbb('0x8e')],'required':![]},{'model':db[_0x7dbb('0x8f')],'as':_0x7dbb('0x90'),'attributes':['id',_0x7dbb('0x3d'),_0x7dbb('0x91')],'where':_0x42b206[_0x7dbb('0x48')][_0x7dbb('0x92')]?{'id':_0x42b206[_0x7dbb('0x48')][_0x7dbb('0x92')]}:undefined,'required':_0x42b206[_0x7dbb('0x48')][_0x7dbb('0x92')]?!![]:![]}];}return db['MailInteraction'][_0x7dbb('0x58')](_0x1b5b96);})['then'](function(_0x2c51bf){_0x5d18ce[_0x7dbb('0x59')]=_0x2c51bf;return _0x5d18ce;});}})[_0x7dbb('0x38')](respondWithFilteredResult(_0xae6649,_0x1b5b96))[_0x7dbb('0x29')](handleError(_0xae6649,null));};exports['addApplications']=function(_0x25b853,_0x56d770,_0x27836e){return db[_0x7dbb('0x44')]['findOne']({'where':{'id':_0x25b853[_0x7dbb('0x5b')]['id']}})['then'](handleEntityNotFound(_0x56d770,null))[_0x7dbb('0x38')](function(_0x2d1539){if(_0x2d1539){return db[_0x7dbb('0x93')][_0x7dbb('0x94')](function(_0x1807b1){return db['MailApplication']['destroy']({'where':{'MailAccountId':_0x25b853[_0x7dbb('0x5b')]['id']},'transaction':_0x1807b1})['then'](function(_0xacb703){var _0xda7f55=_['map'](_0x25b853[_0x7dbb('0x5f')],function(_0x3a32df){_0x3a32df[_0x7dbb('0x62')]=_0x25b853[_0x7dbb('0x5b')]['id'];return _0x3a32df;});return db[_0x7dbb('0x95')][_0x7dbb('0x96')](_0xda7f55,{'transaction':_0x1807b1});});})[_0x7dbb('0x38')](function(){return db[_0x7dbb('0x95')][_0x7dbb('0x97')]({'where':{'MailAccountId':_0x25b853['params']['id']},'order':_0x7dbb('0x98')});});}})[_0x7dbb('0x38')](respondWithResult(_0x56d770,null))['catch'](handleError(_0x56d770,null));};exports[_0x7dbb('0x99')]=function(_0x51dd3e,_0x4cefb9,_0x2394ab){var _0x32e7d7={};var _0x45e8b7={};var _0x5ce8b0;var _0x3f8a97;return db[_0x7dbb('0x44')][_0x7dbb('0x64')]({'where':{'id':_0x51dd3e['params']['id']}})['then'](handleEntityNotFound(_0x4cefb9,null))['then'](function(_0x27112b){if(_0x27112b){_0x5ce8b0=_0x27112b;_0x45e8b7[_0x7dbb('0x46')]=_[_0x7dbb('0x49')](db[_0x7dbb('0x95')][_0x7dbb('0x45')]);_0x45e8b7[_0x7dbb('0x48')]=_['keys'](_0x51dd3e[_0x7dbb('0x48')]);_0x45e8b7[_0x7dbb('0x4a')]=_[_0x7dbb('0x4b')](_0x45e8b7['model'],_0x45e8b7[_0x7dbb('0x48')]);_0x32e7d7['attributes']=_[_0x7dbb('0x4b')](_0x45e8b7['model'],qs[_0x7dbb('0x4d')](_0x51dd3e['query'][_0x7dbb('0x4d')]));_0x32e7d7[_0x7dbb('0x4c')]=_0x32e7d7['attributes'][_0x7dbb('0x65')]?_0x32e7d7['attributes']:_0x45e8b7['model'];_0x32e7d7[_0x7dbb('0x4f')]=qs[_0x7dbb('0x50')](_0x51dd3e['query'][_0x7dbb('0x50')]);_0x32e7d7[_0x7dbb('0x51')]=qs['filters'](_[_0x7dbb('0x52')](_0x51dd3e[_0x7dbb('0x48')],_0x45e8b7[_0x7dbb('0x4a')]));if(_0x51dd3e['query'][_0x7dbb('0x53')]){_0x32e7d7[_0x7dbb('0x51')]=_[_0x7dbb('0x54')](_0x32e7d7[_0x7dbb('0x51')],{'$or':_[_0x7dbb('0x47')](_0x32e7d7[_0x7dbb('0x4c')],function(_0x1cbaa8){var _0x1117d3={};_0x1117d3[_0x1cbaa8]={'$like':'%'+_0x51dd3e[_0x7dbb('0x48')][_0x7dbb('0x53')]+'%'};return _0x1117d3;})});}_0x32e7d7=_[_0x7dbb('0x54')]({},_0x32e7d7,_0x51dd3e['options']);return _0x5ce8b0[_0x7dbb('0x99')](_0x32e7d7);}})[_0x7dbb('0x38')](function(_0x5013e4){if(_0x5013e4){_0x3f8a97=_0x5013e4['length'];if(!_0x51dd3e['query'][_0x7dbb('0x4e')](_0x7dbb('0x66'))){_0x32e7d7[_0x7dbb('0x30')]=qs['limit'](_0x51dd3e[_0x7dbb('0x48')][_0x7dbb('0x30')]);_0x32e7d7[_0x7dbb('0x2e')]=qs[_0x7dbb('0x2e')](_0x51dd3e[_0x7dbb('0x48')]['offset']);}return _0x5ce8b0[_0x7dbb('0x99')](_0x32e7d7);}})[_0x7dbb('0x38')](function(_0x52be14){if(_0x52be14){return _0x52be14?{'count':_0x3f8a97,'rows':_0x52be14}:null;}})['then'](respondWithResult(_0x4cefb9,null))[_0x7dbb('0x29')](handleError(_0x4cefb9,null));};exports['getMessages']=function(_0x203d54,_0x2b55b1,_0x5818a8){var _0x1800f1={'raw':!![],'where':{}};var _0x156746={};var _0x1ab366={'count':0x0,'rows':[]};return db[_0x7dbb('0x44')][_0x7dbb('0x64')]({'where':{'id':_0x203d54[_0x7dbb('0x5b')]['id']}})[_0x7dbb('0x38')](handleEntityNotFound(_0x2b55b1,null))['then'](function(_0x4ba616){if(_0x4ba616){_0x156746[_0x7dbb('0x46')]=_[_0x7dbb('0x49')](db['MailMessage']['rawAttributes']);_0x156746[_0x7dbb('0x48')]=_['keys'](_0x203d54['query']);_0x156746['filters']=_[_0x7dbb('0x4b')](_0x156746[_0x7dbb('0x46')],_0x156746[_0x7dbb('0x48')]);_0x1800f1[_0x7dbb('0x4c')]=_['intersection'](_0x156746[_0x7dbb('0x46')],qs['fields'](_0x203d54[_0x7dbb('0x48')][_0x7dbb('0x4d')]));_0x1800f1['attributes']=_0x1800f1[_0x7dbb('0x4c')][_0x7dbb('0x65')]?_0x1800f1[_0x7dbb('0x4c')]:_0x156746[_0x7dbb('0x46')];if(!_0x203d54[_0x7dbb('0x48')][_0x7dbb('0x4e')](_0x7dbb('0x66'))){_0x1800f1[_0x7dbb('0x30')]=qs['limit'](_0x203d54[_0x7dbb('0x48')][_0x7dbb('0x30')]);_0x1800f1[_0x7dbb('0x2e')]=qs[_0x7dbb('0x2e')](_0x203d54[_0x7dbb('0x48')][_0x7dbb('0x2e')]);}_0x1800f1['order']=qs['sort'](_0x203d54[_0x7dbb('0x48')][_0x7dbb('0x50')]);_0x1800f1[_0x7dbb('0x51')]=qs[_0x7dbb('0x4a')](_['pick'](_0x203d54['query'],_0x156746[_0x7dbb('0x4a')]));_0x1800f1[_0x7dbb('0x51')][_0x7dbb('0x62')]=_0x4ba616['id'];if(_0x203d54[_0x7dbb('0x48')][_0x7dbb('0x53')]){_0x1800f1['where']=_['merge'](_0x1800f1[_0x7dbb('0x51')],{'$or':_['map'](_0x1800f1[_0x7dbb('0x4c')],function(_0x174d84){var _0x6b3720={};_0x6b3720[_0x174d84]={'$like':'%'+_0x203d54[_0x7dbb('0x48')]['filter']+'%'};return _0x6b3720;})});}if(_0x203d54[_0x7dbb('0x48')][_0x7dbb('0x9a')]){var _0x4446bd=_0x203d54[_0x7dbb('0x48')]['$gte']['split'](',');var _0x319706={};_0x319706[_0x4446bd[0x0]]={'$gte':moment(_0x4446bd[0x1])[_0x7dbb('0x9b')](_0x7dbb('0x9c'))};_0x1800f1['where']=_[_0x7dbb('0x54')](_0x1800f1['where'],_0x319706);}_0x1800f1=_[_0x7dbb('0x54')]({},_0x1800f1,_0x203d54[_0x7dbb('0x5d')]);return db['MailMessage'][_0x7dbb('0x31')]({'where':_0x1800f1[_0x7dbb('0x51')]})[_0x7dbb('0x38')](function(_0x38509c){_0x1ab366[_0x7dbb('0x31')]=_0x38509c;if(_0x203d54[_0x7dbb('0x48')][_0x7dbb('0x56')]){_0x1800f1[_0x7dbb('0x57')]=[{'all':!![]}];}return db[_0x7dbb('0x9d')][_0x7dbb('0x58')](_0x1800f1);})[_0x7dbb('0x38')](function(_0x1f825e){if(_0x203d54['query'][_0x7dbb('0x9e')]===_0x7dbb('0x9f')){for(var _0x155ab3=0x0;_0x155ab3<_0x1f825e[_0x7dbb('0x65')];_0x155ab3++){_0x1f825e[_0x155ab3][_0x7dbb('0x5f')]=juice(_0x1f825e[_0x155ab3][_0x7dbb('0x5f')]);}}_0x1ab366[_0x7dbb('0x59')]=_0x1f825e;return _0x1ab366;});}})[_0x7dbb('0x38')](respondWithFilteredResult(_0x2b55b1,_0x1800f1))[_0x7dbb('0x29')](handleError(_0x2b55b1,null));};exports[_0x7dbb('0x3e')]=function(_0x5e9b5b,_0x29caab,_0x466251){var _0x3e88ea,_0x24cf30={},_0x3ce903;if(_0x5e9b5b[_0x7dbb('0x5f')]['to']){_0x3ce903=_0x5e9b5b[_0x7dbb('0x5f')]['to'][_0x7dbb('0xa0')](',')[0x0];}return db[_0x7dbb('0x44')][_0x7dbb('0x5e')]({'where':{'id':_0x5e9b5b[_0x7dbb('0x5b')]['id']},'include':[{'model':db[_0x7dbb('0xa1')],'as':_0x7dbb('0xa2'),'include':[{'model':db[_0x7dbb('0x8a')],'as':'Contacts','where':{'email':_0x3ce903},'limit':0x1,'order':[[_0x7dbb('0xa3'),_0x7dbb('0xa4')]]}]},{'model':db[_0x7dbb('0x41')],'as':_0x7dbb('0x5c'),'raw':!![]}]})['then'](handleEntityNotFound(_0x29caab,null))[_0x7dbb('0x38')](function(_0x4ed91e){if(_0x4ed91e){_0x3e88ea=_0x4ed91e;if(_0x4ed91e[_0x7dbb('0x5c')]){if(_[_0x7dbb('0x70')](_0x5e9b5b[_0x7dbb('0x5f')][_0x7dbb('0xa5')])){_0x5e9b5b[_0x7dbb('0x5f')][_0x7dbb('0xa5')]=util['format'](_0x7dbb('0xa6'),_0x4ed91e[_0x7dbb('0x3d')],_0x4ed91e[_0x7dbb('0xa7')]||_0x4ed91e['Smtp'][_0x7dbb('0x73')]);}if(_0x5e9b5b[_0x7dbb('0x5f')][_0x7dbb('0xa8')]&&_0x5e9b5b['body']['attachments'][_0x7dbb('0x65')]){for(var _0x11079a=0x0;_0x11079a<_0x5e9b5b[_0x7dbb('0x5f')][_0x7dbb('0xa8')][_0x7dbb('0x65')];_0x11079a+=0x1){_0x5e9b5b[_0x7dbb('0x5f')]['attachments'][_0x11079a]={'filename':_0x5e9b5b[_0x7dbb('0x5f')][_0x7dbb('0xa8')][_0x11079a][_0x7dbb('0x3d')],'path':path[_0x7dbb('0xa9')](config[_0x7dbb('0xaa')],_0x7dbb('0xab'),_0x5e9b5b[_0x7dbb('0x5f')][_0x7dbb('0xa8')][_0x11079a][_0x7dbb('0xac')])};}}var _0x41e03c={'tls':{'rejectUnauthorized':![]}};if(_[_0x7dbb('0x70')](_0x4ed91e['Smtp'][_0x7dbb('0xad')])){if(_0x4ed91e[_0x7dbb('0x5c')]['authentication']){_0x41e03c[_0x7dbb('0xae')]={'user':_0x4ed91e[_0x7dbb('0x5c')][_0x7dbb('0x73')],'pass':_0x4ed91e[_0x7dbb('0x5c')]['pass']};}_0x41e03c[_0x7dbb('0x79')]=_0x4ed91e['Smtp'][_0x7dbb('0x79')];_0x41e03c[_0x7dbb('0x7a')]=_0x4ed91e[_0x7dbb('0x5c')]['port'];_0x41e03c[_0x7dbb('0xaf')]=_0x4ed91e['Smtp'][_0x7dbb('0xaf')];}else{_0x41e03c[_0x7dbb('0xad')]=_0x4ed91e[_0x7dbb('0x5c')][_0x7dbb('0xad')];_0x41e03c['auth']={'user':_0x4ed91e[_0x7dbb('0x5c')][_0x7dbb('0x73')],'pass':_0x4ed91e['Smtp'][_0x7dbb('0x76')]};}return respondWithRpcPromise(_0x7dbb('0xb0'),_0x7dbb('0xb1'),{'account':_0x41e03c,'message':_0x5e9b5b[_0x7dbb('0x5f')]});}else{throw new Error(_0x7dbb('0xb2'));}}})[_0x7dbb('0x38')](function(_0x476f83){if(_0x476f83){_0x24cf30=_0x476f83;if(_0x3e88ea[_0x7dbb('0xa2')]){if(_0x3e88ea[_0x7dbb('0xa2')][_0x7dbb('0xb3')][_0x7dbb('0x65')]){return _0x3e88ea[_0x7dbb('0xa2')][_0x7dbb('0xb3')][0x0];}else{return db[_0x7dbb('0x8a')]['create'](_['defaults'](_0x5e9b5b[_0x7dbb('0x5f')],{'firstName':_0x5e9b5b[_0x7dbb('0x5f')]['to'],'email':_0x5e9b5b[_0x7dbb('0x5f')]['to'],'phone':_0x5e9b5b[_0x7dbb('0x5f')]['to'],'ListId':_0x3e88ea['ListId']}));}}else{throw new Error(_0x7dbb('0xb2'));}}})[_0x7dbb('0x38')](function(_0x3430a7){if(_0x3430a7){var _0x288613={'UserId':_0x5e9b5b[_0x7dbb('0x73')]['id'],'ContactId':_0x3430a7['id'],'MailAccountId':_0x3e88ea['id'],'inReplyTo':_0x24cf30['messageId'],'to':_0x5e9b5b[_0x7dbb('0x5f')][_0x7dbb('0xa5')],'cc':_0x5e9b5b[_0x7dbb('0x5f')]['cc'],'subject':_0x5e9b5b['body'][_0x7dbb('0xb4')],'attach':_0x5e9b5b[_0x7dbb('0x5f')][_0x7dbb('0xb5')],'firstMsgDirection':_0x7dbb('0xb6'),'lastMsgAt':moment()['format'](_0x7dbb('0x9c')),'lastMsgDirection':_0x7dbb('0xb6'),'Messages':[_[_0x7dbb('0x54')](_0x5e9b5b[_0x7dbb('0x5f')],{'messageId':_0x24cf30[_0x7dbb('0xb7')],'sentAt':moment()[_0x7dbb('0x9b')](_0x7dbb('0x9c')),'read':!![],'MailAccountId':_0x3e88ea['id'],'UserId':_0x5e9b5b[_0x7dbb('0x73')]['id'],'ContactId':_0x3430a7['id']})]};if(_0x5e9b5b[_0x7dbb('0x5f')]['Interaction']){_0x288613=_[_0x7dbb('0x54')](_0x288613,_0x5e9b5b[_0x7dbb('0x5f')][_0x7dbb('0xb8')]);}return db[_0x7dbb('0x89')]['create'](_0x288613,{'include':[{'model':db[_0x7dbb('0x9d')],'as':_0x7dbb('0xb9')}]});}})['then'](respondWithResult(_0x29caab,null))['catch'](handleError(_0x29caab,null));};exports[_0x7dbb('0xba')]=function(_0x55b0d3,_0x312382,_0x3a26dd){return db[_0x7dbb('0x44')][_0x7dbb('0x5e')]({'where':{'id':_0x55b0d3[_0x7dbb('0x5b')]['id']},'include':[{'model':db[_0x7dbb('0x41')],'as':_0x7dbb('0x5c'),'raw':!![]}]})['then'](handleEntityNotFound(_0x312382,null))[_0x7dbb('0x38')](function(_0x7edb8e){if(_0x7edb8e&&_0x7edb8e['Smtp']){var _0x9db40a={'id':_0x7edb8e['id'],'tls':{'rejectUnauthorized':![]}};if(_0x7edb8e[_0x7dbb('0x5c')][_0x7dbb('0xad')]){_0x9db40a[_0x7dbb('0xad')]=_0x7edb8e[_0x7dbb('0x5c')]['service'];}else{_0x9db40a[_0x7dbb('0x79')]=_0x7edb8e['Smtp']['host'];_0x9db40a[_0x7dbb('0x7a')]=_0x7edb8e[_0x7dbb('0x5c')][_0x7dbb('0x7a')];_0x9db40a[_0x7dbb('0xaf')]=_0x7edb8e['Smtp'][_0x7dbb('0xaf')];}if(_0x7edb8e[_0x7dbb('0x5c')][_0x7dbb('0x78')]){_0x9db40a[_0x7dbb('0xae')]={'user':_0x7edb8e[_0x7dbb('0x5c')][_0x7dbb('0x73')],'pass':_0x7edb8e[_0x7dbb('0x5c')][_0x7dbb('0x76')]};}return respondWithRpcPromise(_0x7dbb('0xbb'),_0x7dbb('0xba'),{'account':_0x9db40a});}})[_0x7dbb('0x38')](respondWithResult(_0x312382,null))['catch'](handleError(_0x312382,null));};exports['destroy']=function(_0x57bd13,_0x50201d){return db[_0x7dbb('0x44')]['find']({'where':{'id':_0x57bd13[_0x7dbb('0x5b')]['id']}})[_0x7dbb('0x38')](handleEntityNotFound(_0x50201d,null))['then'](function(_0x3a0d66){if(_0x3a0d66&&_0x3a0d66['service']){throw new db[(_0x7dbb('0xbc'))][(_0x7dbb('0xbd'))](_0x7dbb('0xbe'));}return _0x3a0d66;})[_0x7dbb('0x38')](removeEntity(_0x50201d,null))[_0x7dbb('0x29')](handleError(_0x50201d,null));};exports[_0x7dbb('0xbf')]=function(_0x31cdbd,_0x32d787,_0x1928cf){return db[_0x7dbb('0x44')][_0x7dbb('0x5e')]({'where':{'id':_0x31cdbd[_0x7dbb('0x5b')]['id']}})[_0x7dbb('0x38')](handleEntityNotFound(_0x32d787,null))[_0x7dbb('0x38')](function(_0x15ca2a){if(_0x15ca2a){return _0x15ca2a[_0x7dbb('0xbf')](_0x31cdbd['body'][_0x7dbb('0x68')],_[_0x7dbb('0x87')](_0x31cdbd[_0x7dbb('0x5f')],[_0x7dbb('0x68'),'id'])||{})[_0x7dbb('0xc0')](function(_0x289617){for(var _0x1b5f1c=0x0;_0x1b5f1c<_0x31cdbd[_0x7dbb('0x5f')][_0x7dbb('0x68')]['length'];_0x1b5f1c+=0x1){socket['emit'](_0x7dbb('0xc1'),{'UserId':Number(_0x31cdbd[_0x7dbb('0x5f')]['ids'][_0x1b5f1c]),'MailAccountId':Number(_0x31cdbd['params']['id'])});}return _0x289617;});}})[_0x7dbb('0x38')](respondWithResult(_0x32d787,null))[_0x7dbb('0x29')](handleError(_0x32d787,null));};exports[_0x7dbb('0xc2')]=function(_0xc74d85,_0x56e1ae,_0x2cb54f){return db[_0x7dbb('0x44')][_0x7dbb('0x5e')]({'where':{'id':_0xc74d85[_0x7dbb('0x5b')]['id']}})[_0x7dbb('0x38')](handleEntityNotFound(_0x56e1ae,null))[_0x7dbb('0x38')](function(_0x3589e8){if(_0x3589e8){return _0x3589e8['removeAgents'](_0xc74d85[_0x7dbb('0x48')]['ids'])[_0x7dbb('0x38')](function(){if(_[_0x7dbb('0xc3')](_0xc74d85['query']['ids'])){for(var _0x2e1fd1=0x0;_0x2e1fd1<_0xc74d85[_0x7dbb('0x48')][_0x7dbb('0x68')][_0x7dbb('0x65')];_0x2e1fd1+=0x1){socket[_0x7dbb('0xc4')](_0x7dbb('0xc5'),{'UserId':Number(_0xc74d85['query']['ids'][_0x2e1fd1]),'MailAccountId':Number(_0xc74d85[_0x7dbb('0x5b')]['id'])});}}else{socket[_0x7dbb('0xc4')](_0x7dbb('0xc5'),{'UserId':Number(_0xc74d85[_0x7dbb('0x48')][_0x7dbb('0x68')]),'MailAccountId':Number(_0xc74d85[_0x7dbb('0x5b')]['id'])});}});}})[_0x7dbb('0x38')](respondWithStatusCode(_0x56e1ae,null))[_0x7dbb('0x29')](handleError(_0x56e1ae,null));};exports[_0x7dbb('0xc6')]=function(_0x127db9,_0x5b963e,_0x5e420c){var _0x5d3f4b={};var _0x4acd97={};var _0x30ea48;var _0x3045db;return db['MailAccount'][_0x7dbb('0x64')]({'where':{'id':_0x127db9[_0x7dbb('0x5b')]['id']}})[_0x7dbb('0x38')](handleEntityNotFound(_0x5b963e,null))['then'](function(_0x25eb18){if(_0x25eb18){_0x30ea48=_0x25eb18;_0x4acd97[_0x7dbb('0x46')]=_[_0x7dbb('0x49')](db[_0x7dbb('0x8c')][_0x7dbb('0x45')]);_0x4acd97[_0x7dbb('0x48')]=_[_0x7dbb('0x49')](_0x127db9[_0x7dbb('0x48')]);_0x4acd97['filters']=_[_0x7dbb('0x4b')](_0x4acd97[_0x7dbb('0x46')],_0x4acd97['query']);_0x5d3f4b[_0x7dbb('0x4c')]=_[_0x7dbb('0x4b')](_0x4acd97['model'],qs[_0x7dbb('0x4d')](_0x127db9['query'][_0x7dbb('0x4d')]));_0x5d3f4b[_0x7dbb('0x4c')]=_0x5d3f4b['attributes'][_0x7dbb('0x65')]?_0x5d3f4b[_0x7dbb('0x4c')]:_0x4acd97['model'];_0x5d3f4b[_0x7dbb('0x4f')]=qs[_0x7dbb('0x50')](_0x127db9[_0x7dbb('0x48')]['sort']);_0x5d3f4b[_0x7dbb('0x51')]=qs[_0x7dbb('0x4a')](_[_0x7dbb('0x52')](_0x127db9[_0x7dbb('0x48')],_0x4acd97[_0x7dbb('0x4a')]));if(_0x127db9[_0x7dbb('0x48')][_0x7dbb('0x53')]){_0x5d3f4b[_0x7dbb('0x51')]=_[_0x7dbb('0x54')](_0x5d3f4b[_0x7dbb('0x51')],{'$or':_['map'](_0x5d3f4b[_0x7dbb('0x4c')],function(_0xf10469){var _0x205922={};_0x205922[_0xf10469]={'$like':'%'+_0x127db9[_0x7dbb('0x48')][_0x7dbb('0x53')]+'%'};return _0x205922;})});}_0x5d3f4b=_[_0x7dbb('0x54')]({},_0x5d3f4b,_0x127db9[_0x7dbb('0x5d')]);return _0x30ea48[_0x7dbb('0xc6')](_0x5d3f4b);}})[_0x7dbb('0x38')](function(_0x370413){if(_0x370413){_0x3045db=_0x370413[_0x7dbb('0x65')];if(!_0x127db9[_0x7dbb('0x48')][_0x7dbb('0x4e')](_0x7dbb('0x66'))){_0x5d3f4b[_0x7dbb('0x30')]=qs[_0x7dbb('0x30')](_0x127db9['query'][_0x7dbb('0x30')]);_0x5d3f4b[_0x7dbb('0x2e')]=qs[_0x7dbb('0x2e')](_0x127db9[_0x7dbb('0x48')][_0x7dbb('0x2e')]);}return _0x30ea48[_0x7dbb('0xc6')](_0x5d3f4b);}})[_0x7dbb('0x38')](function(_0x3be77a){if(_0x3be77a){return _0x3be77a?{'count':_0x3045db,'rows':_0x3be77a}:null;}})[_0x7dbb('0x38')](respondWithResult(_0x5b963e,null))['catch'](handleError(_0x5b963e,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 1d57f31..a253121 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 _0x0755=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailAccount','setMaxListeners','save','update'];(function(_0x5a9155,_0x5c8a5b){var _0x326676=function(_0xc0756f){while(--_0xc0756f){_0x5a9155['push'](_0x5a9155['shift']());}};_0x326676(++_0x5c8a5b);}(_0x0755,0x7c));var _0x5075=function(_0x12cf51,_0x34571a){_0x12cf51=_0x12cf51-0x0;var _0x590740=_0x0755[_0x12cf51];return _0x590740;};'use strict';var EventEmitter=require(_0x5075('0x0'));var MailAccount=require(_0x5075('0x1'))['db'][_0x5075('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x5075('0x3')](0x0);var events={'afterCreate':_0x5075('0x4'),'afterUpdate':_0x5075('0x5'),'afterDestroy':_0x5075('0x6')};function emitEvent(_0x87c82d){return function(_0x348813,_0x23cb87,_0x48f487){MailAccountEvents[_0x5075('0x7')](_0x87c82d+':'+_0x348813['id'],_0x348813);MailAccountEvents[_0x5075('0x7')](_0x87c82d,_0x348813);_0x48f487(null);};}for(var e in events){if(events[_0x5075('0x8')](e)){var event=events[e];MailAccount[_0x5075('0x9')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0xf9b7=['hasOwnProperty','events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit'];(function(_0x26bceb,_0x124ed3){var _0xcb6fef=function(_0x22acf7){while(--_0x22acf7){_0x26bceb['push'](_0x26bceb['shift']());}};_0xcb6fef(++_0x124ed3);}(_0xf9b7,0x91));var _0x7f9b=function(_0x727522,_0x49a925){_0x727522=_0x727522-0x0;var _0x55041f=_0xf9b7[_0x727522];return _0x55041f;};'use strict';var EventEmitter=require(_0x7f9b('0x0'));var MailAccount=require(_0x7f9b('0x1'))['db'][_0x7f9b('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7f9b('0x3')](0x0);var events={'afterCreate':_0x7f9b('0x4'),'afterUpdate':_0x7f9b('0x5'),'afterDestroy':_0x7f9b('0x6')};function emitEvent(_0xbfe740){return function(_0x4fa181,_0x527476,_0x3666e1){MailAccountEvents['emit'](_0xbfe740+':'+_0x4fa181['id'],_0x4fa181);MailAccountEvents[_0x7f9b('0x7')](_0xbfe740,_0x4fa181);_0x3666e1(null);};}for(var e in events){if(events[_0x7f9b('0x8')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index fc7d5b9..4368938 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 _0xd788=['./mailAccount.attributes','exports','MailAccount','util','../../config/logger','api','moment','../../config/environment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd788,0x9b));var _0x8d78=function(_0x2da254,_0x3d258b){_0x2da254=_0x2da254-0x0;var _0x22e826=_0xd788[_0x2da254];return _0x22e826;};'use strict';var _=require('lodash');var util=require(_0x8d78('0x0'));var logger=require(_0x8d78('0x1'))(_0x8d78('0x2'));var moment=require(_0x8d78('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8d78('0x4'));var attributes=require(_0x8d78('0x5'));module[_0x8d78('0x6')]=function(_0x621182,_0x27ab6f){return _0x621182['define'](_0x8d78('0x7'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0db=['moment','bluebird','request-promise','path','./mailAccount.attributes','exports','MailAccount','mail_accounts','lodash','util','../../config/logger','api'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf0db,0x110));var _0xbf0d=function(_0x109b9d,_0x450b69){_0x109b9d=_0x109b9d-0x0;var _0x4a39d7=_0xf0db[_0x109b9d];return _0x4a39d7;};'use strict';var _=require(_0xbf0d('0x0'));var util=require(_0xbf0d('0x1'));var logger=require(_0xbf0d('0x2'))(_0xbf0d('0x3'));var moment=require(_0xbf0d('0x4'));var BPromise=require(_0xbf0d('0x5'));var rp=require(_0xbf0d('0x6'));var fs=require('fs');var path=require(_0xbf0d('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbf0d('0x8'));module[_0xbf0d('0x9')]=function(_0x4c9190,_0x1c005c){return _0x4c9190['define'](_0xbf0d('0xa'),attributes,{'tableName':_0xbf0d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index f02b895..2ddeb74 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 _0x350e=['applications','list','priority','autoclose','push','close','*,*,*,*','length','defaults','create','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','spread','update','interaction','originTo','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','User','name','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','localhost','socket.io-emitter','./mailAccount.socket','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','GetMailAccount','findAll','options','raw','where','map','include','model','attributes','stringify','catch','ShowMailAccount','MailAccount','find','debug','body','mail','difference','keys','CmContact','createdAt','updatedAt','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','DESC','Applications','MailServerOut','Smtp','get','account','omit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x350e,0xf2));var _0xe350=function(_0x18624e,_0x172c43){_0x18624e=_0x18624e-0x0;var _0x41ef95=_0x350e[_0x18624e];return _0x41ef95;};'use strict';var _=require(_0xe350('0x0'));var util=require(_0xe350('0x1'));var moment=require(_0xe350('0x2'));var BPromise=require('bluebird');var rs=require(_0xe350('0x3'));var fs=require('fs');var Redis=require(_0xe350('0x4'));var db=require(_0xe350('0x5'))['db'];var utils=require(_0xe350('0x6'));var logger=require(_0xe350('0x7'))(_0xe350('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe350('0x9')]['http']({'port':0x232c});config[_0xe350('0xa')]=_['defaults'](config['redis'],{'host':_0xe350('0xb'),'port':0x18eb});var socket=require(_0xe350('0xc'))(new Redis(config[_0xe350('0xa')]));require(_0xe350('0xd'))['register'](socket);function respondWithRpcPromise(_0x4dc5a7,_0x592b32,_0x404f2d){return new BPromise(function(_0x56dd9d,_0x2594fb){return client[_0xe350('0xe')](_0x4dc5a7,_0x404f2d)[_0xe350('0xf')](function(_0x5df80a){logger[_0xe350('0x10')](_0xe350('0x11'),_0x592b32,_0xe350('0x12'));logger['debug'](_0xe350('0x13'),_0x592b32,'request\x20sent',JSON['stringify'](_0x5df80a));if(_0x5df80a[_0xe350('0x14')]){if(_0x5df80a['error'][_0xe350('0x15')]===0x1f4){logger[_0xe350('0x14')](_0xe350('0x11'),_0x592b32,_0x5df80a[_0xe350('0x14')][_0xe350('0x16')]);return _0x2594fb(_0x5df80a[_0xe350('0x14')]['message']);}logger[_0xe350('0x14')]('MailAccount,\x20%s,\x20%s',_0x592b32,_0x5df80a[_0xe350('0x14')]['message']);return _0x56dd9d(_0x5df80a[_0xe350('0x14')]['message']);}else{logger[_0xe350('0x10')](_0xe350('0x11'),_0x592b32,_0xe350('0x12'));_0x56dd9d(_0x5df80a['result'][_0xe350('0x16')]);}})['catch'](function(_0x3e648d){logger[_0xe350('0x14')](_0xe350('0x11'),_0x592b32,_0x3e648d);_0x2594fb(_0x3e648d);});});}exports[_0xe350('0x17')]=function(_0xdb917f){var _0xecb760=this;return new Promise(function(_0x3baab8,_0x15d794){return db['MailAccount'][_0xe350('0x18')]({'raw':_0xdb917f[_0xe350('0x19')]?_0xdb917f['options'][_0xe350('0x1a')]===undefined?!![]:![]:!![],'where':_0xdb917f['options']?_0xdb917f[_0xe350('0x19')][_0xe350('0x1b')]||null:null,'attributes':_0xdb917f[_0xe350('0x19')]?_0xdb917f[_0xe350('0x19')]['attributes']||null:null,'limit':_0xdb917f['options']?_0xdb917f[_0xe350('0x19')]['limit']||null:null,'include':_0xdb917f[_0xe350('0x19')]?_0xdb917f[_0xe350('0x19')]['include']?_[_0xe350('0x1c')](_0xdb917f[_0xe350('0x19')][_0xe350('0x1d')],function(_0x55713a){return{'model':db[_0x55713a[_0xe350('0x1e')]],'as':_0x55713a['as'],'attributes':_0x55713a[_0xe350('0x1f')],'include':_0x55713a[_0xe350('0x1d')]?_[_0xe350('0x1c')](_0x55713a[_0xe350('0x1d')],function(_0x2cf9cc){return{'model':db[_0x2cf9cc['model']],'as':_0x2cf9cc['as'],'attributes':_0x2cf9cc[_0xe350('0x1f')],'include':_0x2cf9cc[_0xe350('0x1d')]?_['map'](_0x2cf9cc[_0xe350('0x1d')],function(_0x3f56cd){return{'model':db[_0x3f56cd[_0xe350('0x1e')]],'as':_0x3f56cd['as'],'attributes':_0x3f56cd[_0xe350('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4be80b){logger['info'](_0xe350('0x17'),_0xdb917f);logger['debug'](_0xe350('0x17'),_0xdb917f,JSON[_0xe350('0x20')](_0x4be80b));_0x3baab8(_0x4be80b);})[_0xe350('0x21')](function(_0x4d8346){logger[_0xe350('0x14')](_0xe350('0x17'),_0x4d8346[_0xe350('0x16')],_0xdb917f);_0x15d794(_0xecb760[_0xe350('0x14')](0x1f4,_0x4d8346[_0xe350('0x16')]));});});};exports[_0xe350('0x22')]=function(_0x170522){var _0x4ce982=this;return new Promise(function(_0x21e0fb,_0x193c31){return db[_0xe350('0x23')][_0xe350('0x24')]({'raw':_0x170522[_0xe350('0x19')]?_0x170522['options'][_0xe350('0x1a')]===undefined?!![]:![]:!![],'where':_0x170522[_0xe350('0x19')]?_0x170522[_0xe350('0x19')]['where']||null:null,'attributes':_0x170522[_0xe350('0x19')]?_0x170522[_0xe350('0x19')][_0xe350('0x1f')]||null:null,'include':_0x170522[_0xe350('0x19')]?_0x170522[_0xe350('0x19')][_0xe350('0x1d')]?_[_0xe350('0x1c')](_0x170522[_0xe350('0x19')][_0xe350('0x1d')],function(_0x32e2d3){return{'model':db[_0x32e2d3[_0xe350('0x1e')]],'as':_0x32e2d3['as'],'attributes':_0x32e2d3['attributes'],'include':_0x32e2d3[_0xe350('0x1d')]?_[_0xe350('0x1c')](_0x32e2d3[_0xe350('0x1d')],function(_0x123a8a){return{'model':db[_0x123a8a['model']],'as':_0x123a8a['as'],'attributes':_0x123a8a['attributes'],'include':_0x123a8a[_0xe350('0x1d')]?_[_0xe350('0x1c')](_0x123a8a[_0xe350('0x1d')],function(_0x59d2ac){return{'model':db[_0x59d2ac[_0xe350('0x1e')]],'as':_0x59d2ac['as'],'attributes':_0x59d2ac[_0xe350('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ffbc4){logger['info'](_0xe350('0x22'),_0x170522);logger[_0xe350('0x25')](_0xe350('0x22'),_0x170522,JSON['stringify'](_0x4ffbc4));_0x21e0fb(_0x4ffbc4);})[_0xe350('0x21')](function(_0x5458b5){logger[_0xe350('0x14')](_0xe350('0x22'),_0x5458b5[_0xe350('0x16')],_0x170522);_0x193c31(_0x4ce982[_0xe350('0x14')](0x1f4,_0x5458b5[_0xe350('0x16')]));});});};exports['NotifyMailAccount']=function(_0x528272){var _0x5e7ea9=this;return new Promise(function(_0x29be5c,_0x54d11d){var _0x284103={'body':_0x528272[_0xe350('0x26')],'channel':_0xe350('0x27')};var _0x16d3f3=_[_0xe350('0x28')](_[_0xe350('0x29')](db[_0xe350('0x2a')]['rawAttributes']),[_0xe350('0x2b'),_0xe350('0x2c'),'CompanyId','ListId']);var _0x34553d=![];if(_0x528272[_0xe350('0x26')]['id']){delete _0x528272[_0xe350('0x26')]['id'];}if(_[_0xe350('0x2d')](_0x528272[_0xe350('0x26')][_0xe350('0x2e')])){return _0x54d11d(_0x5e7ea9['error'](0x1f4,_0xe350('0x2f')));}if(_[_0xe350('0x2d')](_0x528272[_0xe350('0x26')][_0xe350('0x26')])||_0x528272[_0xe350('0x26')][_0xe350('0x26')]===''){return _0x54d11d(_0x5e7ea9[_0xe350('0x14')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x528272['body'][_0xe350('0x30')])){return _0x54d11d(_0x5e7ea9[_0xe350('0x14')](0x1f4,_0xe350('0x31')+_0x16d3f3));}if(!_[_0xe350('0x32')](_0x16d3f3,_0x528272[_0xe350('0x26')][_0xe350('0x30')])){return _0x54d11d(_0x5e7ea9[_0xe350('0x14')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x16d3f3));}var _0x1aeff3={};_0x1aeff3[_0x528272['body'][_0xe350('0x30')]]=_0x528272[_0xe350('0x26')][_0xe350('0x2e')];return db[_0xe350('0x23')][_0xe350('0x24')]({'where':{'id':_0x528272['account']['id']},'include':[{'model':db[_0xe350('0x33')],'as':_0xe350('0x34'),'include':[{'model':db[_0xe350('0x2a')],'as':_0xe350('0x35'),'where':_0x1aeff3,'limit':0x1,'order':[[_0xe350('0x2c'),_0xe350('0x36')]]}]},{'model':db['MailApplication'],'as':_0xe350('0x37')},{'model':db[_0xe350('0x38')],'as':_0xe350('0x39')}]})[_0xe350('0xf')](function(_0xb3502){if(_0xb3502&&_0xb3502[_0xe350('0x34')]){var _0xc52320=_0xb3502[_0xe350('0x3a')]({'plain':!![]});_0x284103[_0xe350('0x3b')]=_[_0xe350('0x3c')](_0xc52320,[_0xe350('0x37'),_0xe350('0x34')]);_0x284103[_0xe350('0x3d')]=_0xc52320[_0xe350('0x37')];_0x284103[_0xe350('0x3e')]=_0xc52320[_0xe350('0x34')];_0x284103['applications']=_['orderBy'](_0x284103[_0xe350('0x3d')],[_0xe350('0x3f')],['asc']);if(_0x284103[_0xe350('0x3b')]&&_0x284103[_0xe350('0x3b')][_0xe350('0x40')]){_0x284103[_0xe350('0x3d')][_0xe350('0x41')]({'id':0x0,'priority':_0x284103[_0xe350('0x3d')]['length']+0x1,'app':_0xe350('0x42'),'appdata':_0xe350('0x40'),'interval':_0xe350('0x43')});}if(_0x284103['account'][_0xe350('0x37')]){delete _0x284103[_0xe350('0x3b')][_0xe350('0x37')];}if(_0x284103[_0xe350('0x3b')][_0xe350('0x34')]){delete _0x284103[_0xe350('0x3b')][_0xe350('0x34')];}if(_0xc52320[_0xe350('0x34')][_0xe350('0x35')][_0xe350('0x44')]){return _0xc52320['List'][_0xe350('0x35')][0x0];}var _0x3cbb70=_[_0xe350('0x45')](_0x528272[_0xe350('0x26')],{'firstName':_0x528272[_0xe350('0x26')][_0xe350('0x2e')],'ListId':_0xc52320['ListId']});_0x3cbb70[_0x528272[_0xe350('0x26')][_0xe350('0x30')]]=_0x528272[_0xe350('0x26')][_0xe350('0x2e')];return db[_0xe350('0x2a')][_0xe350('0x46')](_0x3cbb70);}else{throw new Error('List\x20not\x20found');}})[_0xe350('0xf')](function(_0x3be845){_0x284103[_0xe350('0x47')]=_0x3be845;if(_0x3be845){if(!_0x528272[_0xe350('0x26')][_0xe350('0x16')][_0xe350('0x48')]){_0x528272[_0xe350('0x26')][_0xe350('0x16')]['messageId']=rs[_0xe350('0x49')]()+'\x20'+_0x528272[_0xe350('0x26')][_0xe350('0x16')][_0xe350('0x2e')];}var _0x100b63={'ContactId':_0x3be845['id'],'MailAccountId':_0x528272['account']['id'],'inReplyTo':_0x528272['body'][_0xe350('0x16')]['messageId'],'to':_0x528272[_0xe350('0x26')][_0xe350('0x16')][_0xe350('0x2e')],'cc':_0x528272[_0xe350('0x26')][_0xe350('0x16')]['cc'],'subject':_0x528272[_0xe350('0x26')]['message'][_0xe350('0x4a')],'attach':_0x528272[_0xe350('0x26')][_0xe350('0x16')][_0xe350('0x4b')],'lastMsgAt':moment()[_0xe350('0x4c')](_0xe350('0x4d')),'lastMsgDirection':'in'};return db[_0xe350('0x4e')][_0xe350('0x24')]({'where':{'closed':![],'MailAccountId':_0x528272['account']['id']},'include':[{'model':db[_0xe350('0x4f')],'as':_0xe350('0x50'),'attributes':[_0xe350('0x48')],'where':{'messageId':_0x528272[_0xe350('0x26')]['message'][_0xe350('0x51')]}}]})[_0xe350('0xf')](function(_0x254276){if(_0x254276){return[_0x254276,![]];}return db['MailInteraction']['create'](_0x100b63)[_0xe350('0xf')](function(_0x303edf){return[_0x303edf,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xe350('0x52')](function(_0x10419a,_0x30d37c){if(_0x10419a){_0x34553d=_0x30d37c;if(!_0x30d37c){return _0x10419a[_0xe350('0x53')]({'inReplyTo':_0x528272[_0xe350('0x26')]['message'][_0xe350('0x48')],'to':_0x528272[_0xe350('0x26')]['message'][_0xe350('0x2e')],'cc':_0x528272[_0xe350('0x26')][_0xe350('0x16')]['cc'],'subject':_0x528272[_0xe350('0x26')][_0xe350('0x16')]['subject'],'attach':_0x10419a['attach']?_0x10419a[_0xe350('0x4b')]:_0x528272[_0xe350('0x26')][_0xe350('0x16')]['attach'],'substatus':null,'substatusAt':moment()[_0xe350('0x4c')](_0xe350('0x4d')),'lastMsgAt':moment()[_0xe350('0x4c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x10419a;}}})[_0xe350('0xf')](function(_0xdaf688){_0x284103[_0xe350('0x54')]=_0xdaf688['get']({'plain':!![]});_0x284103[_0xe350('0x54')]['created']=_0x34553d;return db[_0xe350('0x4f')]['create']({'body':_0x528272[_0xe350('0x26')][_0xe350('0x26')],'MailAccountId':_0x528272[_0xe350('0x3b')]['id'],'MailInteractionId':_0xdaf688['id'],'direction':'in','ContactId':_0x284103[_0xe350('0x47')]['id'],'messageId':_0x528272[_0xe350('0x26')][_0xe350('0x16')][_0xe350('0x48')],'from':_0x528272[_0xe350('0x26')]['message']['from'],'to':_0x528272[_0xe350('0x26')][_0xe350('0x16')]['to'],'cc':_0x528272[_0xe350('0x26')][_0xe350('0x16')]['cc'],'subject':_0x528272[_0xe350('0x26')][_0xe350('0x16')][_0xe350('0x4a')],'attach':_0x528272[_0xe350('0x26')][_0xe350('0x16')][_0xe350('0x4b')],'Attachments':_0x528272[_0xe350('0x26')][_0xe350('0x16')]['attachments'],'originTo':_0x528272['body'][_0xe350('0x16')][_0xe350('0x55')],'originCc':_0x528272['body'][_0xe350('0x16')]['originCc'],'bcc':_0x528272['body'][_0xe350('0x16')][_0xe350('0x56')],'ChatWebsiteId':_0x528272['body'][_0xe350('0x16')][_0xe350('0x57')]||null,'originChannel':_0x528272[_0xe350('0x26')][_0xe350('0x16')][_0xe350('0x58')]||_0xe350('0x59'),'ChatOfflineMessageId':_0x528272[_0xe350('0x26')][_0xe350('0x16')][_0xe350('0x5a')]||null},{'include':[{'model':db[_0xe350('0x5b')],'as':_0xe350('0x5c')}]});})[_0xe350('0xf')](function(_0x4cd537){_0x284103[_0xe350('0x16')]=_0x4cd537;if(_0x284103['interaction']['UserId']){return db[_0xe350('0x5d')][_0xe350('0x24')]({'attributes':['id',_0xe350('0x5e')],'where':{'id':_0x284103[_0xe350('0x54')][_0xe350('0x5f')]}})[_0xe350('0xf')](function(_0x5eb132){if(_0x5eb132){_0x284103[_0xe350('0x3d')][_0xe350('0x60')]({'id':0x0,'priority':0x0,'app':_0xe350('0x61'),'appdata':_0x5eb132[_0xe350('0x5e')]+','+(_0x284103['account'][_0xe350('0x62')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xe350('0x63'),_0xe350('0x64'),_0x284103);});}return respondWithRpcPromise(_0xe350('0x63'),_0xe350('0x64'),_0x284103);})[_0xe350('0xf')](function(_0x1c3170){_0x29be5c(_0x1c3170);})[_0xe350('0x21')](function(_0x4f80ee){_0x54d11d(_0x5e7ea9[_0xe350('0x14')](0x1f4,_0x4f80ee[_0xe350('0x16')]));});});}; \ No newline at end of file +var _0x12ac=['List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','interaction','created','attachments','originTo','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','options','raw','where','attributes','limit','include','map','model','GetMailAccount','ShowMailAccount','MailAccount','find','catch','NotifyMailAccount','body','mail','keys','updatedAt','CompanyId','isNil','from\x20is\x20mandatory','mapKey','from','account','CmList','List','Contacts','DESC','MailApplication','MailServerOut','Smtp','get','list','applications','orderBy','priority','autoclose','push','length','*,*,*,*','Applications','ListId','CmContact','create'];(function(_0x1ef79c,_0x5c0687){var _0x31d9b9=function(_0x2ffd11){while(--_0x2ffd11){_0x1ef79c['push'](_0x1ef79c['shift']());}};_0x31d9b9(++_0x5c0687);}(_0x12ac,0xf1));var _0xc12a=function(_0x4d14f9,_0x318c62){_0x4d14f9=_0x4d14f9-0x0;var _0x3a286d=_0x12ac[_0x4d14f9];return _0x3a286d;};'use strict';var _=require(_0xc12a('0x0'));var util=require(_0xc12a('0x1'));var moment=require(_0xc12a('0x2'));var BPromise=require(_0xc12a('0x3'));var rs=require(_0xc12a('0x4'));var fs=require('fs');var Redis=require(_0xc12a('0x5'));var db=require(_0xc12a('0x6'))['db'];var utils=require(_0xc12a('0x7'));var logger=require(_0xc12a('0x8'))(_0xc12a('0x9'));var config=require(_0xc12a('0xa'));var jayson=require(_0xc12a('0xb'));var client=jayson[_0xc12a('0xc')][_0xc12a('0xd')]({'port':0x232c});config['redis']=_[_0xc12a('0xe')](config[_0xc12a('0xf')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc12a('0x10'))[_0xc12a('0x11')](socket);function respondWithRpcPromise(_0x1c8bba,_0x3da371,_0x28da7e){return new BPromise(function(_0x2501c9,_0x506356){return client[_0xc12a('0x12')](_0x1c8bba,_0x28da7e)[_0xc12a('0x13')](function(_0x326b9a){logger[_0xc12a('0x14')](_0xc12a('0x15'),_0x3da371,_0xc12a('0x16'));logger['debug'](_0xc12a('0x17'),_0x3da371,'request\x20sent',JSON[_0xc12a('0x18')](_0x326b9a));if(_0x326b9a[_0xc12a('0x19')]){if(_0x326b9a[_0xc12a('0x19')]['code']===0x1f4){logger[_0xc12a('0x19')](_0xc12a('0x15'),_0x3da371,_0x326b9a[_0xc12a('0x19')]['message']);return _0x506356(_0x326b9a[_0xc12a('0x19')]['message']);}logger[_0xc12a('0x19')](_0xc12a('0x15'),_0x3da371,_0x326b9a['error'][_0xc12a('0x1a')]);return _0x2501c9(_0x326b9a[_0xc12a('0x19')][_0xc12a('0x1a')]);}else{logger[_0xc12a('0x14')](_0xc12a('0x15'),_0x3da371,_0xc12a('0x16'));_0x2501c9(_0x326b9a['result']['message']);}})['catch'](function(_0x477293){logger[_0xc12a('0x19')](_0xc12a('0x15'),_0x3da371,_0x477293);_0x506356(_0x477293);});});}exports['GetMailAccount']=function(_0x4f06e0){var _0x12b755=this;return new Promise(function(_0x2aad88,_0x547162){return db['MailAccount']['findAll']({'raw':_0x4f06e0['options']?_0x4f06e0[_0xc12a('0x1b')][_0xc12a('0x1c')]===undefined?!![]:![]:!![],'where':_0x4f06e0[_0xc12a('0x1b')]?_0x4f06e0['options'][_0xc12a('0x1d')]||null:null,'attributes':_0x4f06e0[_0xc12a('0x1b')]?_0x4f06e0[_0xc12a('0x1b')][_0xc12a('0x1e')]||null:null,'limit':_0x4f06e0[_0xc12a('0x1b')]?_0x4f06e0[_0xc12a('0x1b')][_0xc12a('0x1f')]||null:null,'include':_0x4f06e0['options']?_0x4f06e0[_0xc12a('0x1b')][_0xc12a('0x20')]?_[_0xc12a('0x21')](_0x4f06e0[_0xc12a('0x1b')][_0xc12a('0x20')],function(_0x2aa8b9){return{'model':db[_0x2aa8b9[_0xc12a('0x22')]],'as':_0x2aa8b9['as'],'attributes':_0x2aa8b9[_0xc12a('0x1e')],'include':_0x2aa8b9['include']?_[_0xc12a('0x21')](_0x2aa8b9[_0xc12a('0x20')],function(_0x2b8c21){return{'model':db[_0x2b8c21[_0xc12a('0x22')]],'as':_0x2b8c21['as'],'attributes':_0x2b8c21[_0xc12a('0x1e')],'include':_0x2b8c21[_0xc12a('0x20')]?_[_0xc12a('0x21')](_0x2b8c21[_0xc12a('0x20')],function(_0x413bd4){return{'model':db[_0x413bd4[_0xc12a('0x22')]],'as':_0x413bd4['as'],'attributes':_0x413bd4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x56d701){logger[_0xc12a('0x14')]('GetMailAccount',_0x4f06e0);logger['debug']('GetMailAccount',_0x4f06e0,JSON[_0xc12a('0x18')](_0x56d701));_0x2aad88(_0x56d701);})['catch'](function(_0x3300d4){logger[_0xc12a('0x19')](_0xc12a('0x23'),_0x3300d4[_0xc12a('0x1a')],_0x4f06e0);_0x547162(_0x12b755['error'](0x1f4,_0x3300d4[_0xc12a('0x1a')]));});});};exports[_0xc12a('0x24')]=function(_0x9f10a9){var _0x5f275d=this;return new Promise(function(_0xf08609,_0x14f3ac){return db[_0xc12a('0x25')][_0xc12a('0x26')]({'raw':_0x9f10a9[_0xc12a('0x1b')]?_0x9f10a9[_0xc12a('0x1b')][_0xc12a('0x1c')]===undefined?!![]:![]:!![],'where':_0x9f10a9[_0xc12a('0x1b')]?_0x9f10a9[_0xc12a('0x1b')]['where']||null:null,'attributes':_0x9f10a9[_0xc12a('0x1b')]?_0x9f10a9['options'][_0xc12a('0x1e')]||null:null,'include':_0x9f10a9[_0xc12a('0x1b')]?_0x9f10a9[_0xc12a('0x1b')][_0xc12a('0x20')]?_[_0xc12a('0x21')](_0x9f10a9[_0xc12a('0x1b')][_0xc12a('0x20')],function(_0x3ec84c){return{'model':db[_0x3ec84c[_0xc12a('0x22')]],'as':_0x3ec84c['as'],'attributes':_0x3ec84c[_0xc12a('0x1e')],'include':_0x3ec84c[_0xc12a('0x20')]?_[_0xc12a('0x21')](_0x3ec84c['include'],function(_0x20552a){return{'model':db[_0x20552a[_0xc12a('0x22')]],'as':_0x20552a['as'],'attributes':_0x20552a[_0xc12a('0x1e')],'include':_0x20552a[_0xc12a('0x20')]?_[_0xc12a('0x21')](_0x20552a['include'],function(_0x301964){return{'model':db[_0x301964[_0xc12a('0x22')]],'as':_0x301964['as'],'attributes':_0x301964['attributes']};}):[]};}):[]};}):[]:[]})[_0xc12a('0x13')](function(_0x53574e){logger[_0xc12a('0x14')](_0xc12a('0x24'),_0x9f10a9);logger['debug'](_0xc12a('0x24'),_0x9f10a9,JSON[_0xc12a('0x18')](_0x53574e));_0xf08609(_0x53574e);})[_0xc12a('0x27')](function(_0x42efad){logger[_0xc12a('0x19')](_0xc12a('0x24'),_0x42efad['message'],_0x9f10a9);_0x14f3ac(_0x5f275d[_0xc12a('0x19')](0x1f4,_0x42efad[_0xc12a('0x1a')]));});});};exports[_0xc12a('0x28')]=function(_0x21ae9c){var _0x5765a4=this;return new Promise(function(_0x5658b2,_0x9a6375){var _0x2ef0a9={'body':_0x21ae9c[_0xc12a('0x29')],'channel':_0xc12a('0x2a')};var _0x24fa9d=_['difference'](_[_0xc12a('0x2b')](db['CmContact']['rawAttributes']),['createdAt',_0xc12a('0x2c'),_0xc12a('0x2d'),'ListId']);var _0x225972=![];if(_0x21ae9c[_0xc12a('0x29')]['id']){delete _0x21ae9c[_0xc12a('0x29')]['id'];}if(_[_0xc12a('0x2e')](_0x21ae9c['body']['from'])){return _0x9a6375(_0x5765a4[_0xc12a('0x19')](0x1f4,_0xc12a('0x2f')));}if(_[_0xc12a('0x2e')](_0x21ae9c['body']['body'])||_0x21ae9c['body'][_0xc12a('0x29')]===''){return _0x9a6375(_0x5765a4[_0xc12a('0x19')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xc12a('0x2e')](_0x21ae9c[_0xc12a('0x29')][_0xc12a('0x30')])){return _0x9a6375(_0x5765a4[_0xc12a('0x19')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x24fa9d));}if(!_['includes'](_0x24fa9d,_0x21ae9c[_0xc12a('0x29')][_0xc12a('0x30')])){return _0x9a6375(_0x5765a4[_0xc12a('0x19')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x24fa9d));}var _0x498e1c={};_0x498e1c[_0x21ae9c[_0xc12a('0x29')][_0xc12a('0x30')]]=_0x21ae9c[_0xc12a('0x29')][_0xc12a('0x31')];return db[_0xc12a('0x25')]['find']({'where':{'id':_0x21ae9c[_0xc12a('0x32')]['id']},'include':[{'model':db[_0xc12a('0x33')],'as':_0xc12a('0x34'),'include':[{'model':db['CmContact'],'as':_0xc12a('0x35'),'where':_0x498e1c,'limit':0x1,'order':[[_0xc12a('0x2c'),_0xc12a('0x36')]]}]},{'model':db[_0xc12a('0x37')],'as':'Applications'},{'model':db[_0xc12a('0x38')],'as':_0xc12a('0x39')}]})[_0xc12a('0x13')](function(_0x15c214){if(_0x15c214&&_0x15c214[_0xc12a('0x34')]){var _0x195af8=_0x15c214[_0xc12a('0x3a')]({'plain':!![]});_0x2ef0a9[_0xc12a('0x32')]=_['omit'](_0x195af8,['Applications',_0xc12a('0x34')]);_0x2ef0a9['applications']=_0x195af8['Applications'];_0x2ef0a9[_0xc12a('0x3b')]=_0x195af8[_0xc12a('0x34')];_0x2ef0a9[_0xc12a('0x3c')]=_[_0xc12a('0x3d')](_0x2ef0a9[_0xc12a('0x3c')],[_0xc12a('0x3e')],['asc']);if(_0x2ef0a9[_0xc12a('0x32')]&&_0x2ef0a9[_0xc12a('0x32')][_0xc12a('0x3f')]){_0x2ef0a9[_0xc12a('0x3c')][_0xc12a('0x40')]({'id':0x0,'priority':_0x2ef0a9[_0xc12a('0x3c')][_0xc12a('0x41')]+0x1,'app':'close','appdata':'autoclose','interval':_0xc12a('0x42')});}if(_0x2ef0a9[_0xc12a('0x32')][_0xc12a('0x43')]){delete _0x2ef0a9[_0xc12a('0x32')][_0xc12a('0x43')];}if(_0x2ef0a9[_0xc12a('0x32')][_0xc12a('0x34')]){delete _0x2ef0a9[_0xc12a('0x32')][_0xc12a('0x34')];}if(_0x195af8['List'][_0xc12a('0x35')]['length']){return _0x195af8['List'][_0xc12a('0x35')][0x0];}var _0x49b2e3=_[_0xc12a('0xe')](_0x21ae9c[_0xc12a('0x29')],{'firstName':_0x21ae9c[_0xc12a('0x29')]['from'],'ListId':_0x195af8[_0xc12a('0x44')]});_0x49b2e3[_0x21ae9c[_0xc12a('0x29')][_0xc12a('0x30')]]=_0x21ae9c[_0xc12a('0x29')][_0xc12a('0x31')];return db[_0xc12a('0x45')][_0xc12a('0x46')](_0x49b2e3);}else{throw new Error(_0xc12a('0x47'));}})['then'](function(_0x1bb0c4){_0x2ef0a9[_0xc12a('0x48')]=_0x1bb0c4;if(_0x1bb0c4){if(!_0x21ae9c['body'][_0xc12a('0x1a')][_0xc12a('0x49')]){_0x21ae9c[_0xc12a('0x29')][_0xc12a('0x1a')][_0xc12a('0x49')]=rs[_0xc12a('0x4a')]()+'\x20'+_0x21ae9c[_0xc12a('0x29')][_0xc12a('0x1a')][_0xc12a('0x31')];}var _0x4d6af0={'ContactId':_0x1bb0c4['id'],'MailAccountId':_0x21ae9c[_0xc12a('0x32')]['id'],'inReplyTo':_0x21ae9c[_0xc12a('0x29')]['message'][_0xc12a('0x49')],'to':_0x21ae9c['body']['message']['from'],'cc':_0x21ae9c['body'][_0xc12a('0x1a')]['cc'],'subject':_0x21ae9c[_0xc12a('0x29')][_0xc12a('0x1a')][_0xc12a('0x4b')],'attach':_0x21ae9c[_0xc12a('0x29')]['message'][_0xc12a('0x4c')],'lastMsgAt':moment()[_0xc12a('0x4d')](_0xc12a('0x4e')),'lastMsgDirection':'in'};return db[_0xc12a('0x4f')]['find']({'where':{'closed':![],'MailAccountId':_0x21ae9c[_0xc12a('0x32')]['id']},'include':[{'model':db[_0xc12a('0x50')],'as':_0xc12a('0x51'),'attributes':['messageId'],'where':{'messageId':_0x21ae9c[_0xc12a('0x29')][_0xc12a('0x1a')][_0xc12a('0x52')]}}]})[_0xc12a('0x13')](function(_0x4f023d){if(_0x4f023d){return[_0x4f023d,![]];}return db['MailInteraction'][_0xc12a('0x46')](_0x4d6af0)['then'](function(_0x48c166){return[_0x48c166,!![]];});});}else{throw new Error(_0xc12a('0x53'));}})[_0xc12a('0x54')](function(_0x57318f,_0x44d83b){if(_0x57318f){_0x225972=_0x44d83b;if(!_0x44d83b){return _0x57318f[_0xc12a('0x55')]({'inReplyTo':_0x21ae9c[_0xc12a('0x29')][_0xc12a('0x1a')][_0xc12a('0x49')],'to':_0x21ae9c[_0xc12a('0x29')]['message']['from'],'cc':_0x21ae9c[_0xc12a('0x29')][_0xc12a('0x1a')]['cc'],'subject':_0x21ae9c[_0xc12a('0x29')][_0xc12a('0x1a')]['subject'],'attach':_0x57318f[_0xc12a('0x4c')]?_0x57318f['attach']:_0x21ae9c[_0xc12a('0x29')][_0xc12a('0x1a')][_0xc12a('0x4c')],'substatus':null,'substatusAt':moment()[_0xc12a('0x4d')](_0xc12a('0x4e')),'lastMsgAt':moment()['format'](_0xc12a('0x4e')),'lastMsgDirection':'in'});}else{return _0x57318f;}}})[_0xc12a('0x13')](function(_0x1681c7){_0x2ef0a9[_0xc12a('0x56')]=_0x1681c7['get']({'plain':!![]});_0x2ef0a9[_0xc12a('0x56')][_0xc12a('0x57')]=_0x225972;return db['MailMessage'][_0xc12a('0x46')]({'body':_0x21ae9c[_0xc12a('0x29')]['body'],'MailAccountId':_0x21ae9c['account']['id'],'MailInteractionId':_0x1681c7['id'],'direction':'in','ContactId':_0x2ef0a9[_0xc12a('0x48')]['id'],'messageId':_0x21ae9c[_0xc12a('0x29')][_0xc12a('0x1a')][_0xc12a('0x49')],'from':_0x21ae9c[_0xc12a('0x29')][_0xc12a('0x1a')]['from'],'to':_0x21ae9c[_0xc12a('0x29')][_0xc12a('0x1a')]['to'],'cc':_0x21ae9c[_0xc12a('0x29')][_0xc12a('0x1a')]['cc'],'subject':_0x21ae9c['body'][_0xc12a('0x1a')][_0xc12a('0x4b')],'attach':_0x21ae9c[_0xc12a('0x29')][_0xc12a('0x1a')][_0xc12a('0x4c')],'Attachments':_0x21ae9c['body']['message'][_0xc12a('0x58')],'originTo':_0x21ae9c[_0xc12a('0x29')][_0xc12a('0x1a')][_0xc12a('0x59')],'originCc':_0x21ae9c['body'][_0xc12a('0x1a')][_0xc12a('0x5a')],'bcc':_0x21ae9c[_0xc12a('0x29')]['message']['bcc'],'ChatWebsiteId':_0x21ae9c[_0xc12a('0x29')][_0xc12a('0x1a')][_0xc12a('0x5b')]||null,'originChannel':_0x21ae9c[_0xc12a('0x29')][_0xc12a('0x1a')][_0xc12a('0x5c')]||_0xc12a('0x5d'),'ChatOfflineMessageId':_0x21ae9c[_0xc12a('0x29')][_0xc12a('0x1a')][_0xc12a('0x5e')]||null},{'include':[{'model':db[_0xc12a('0x5f')],'as':_0xc12a('0x60')}]});})[_0xc12a('0x13')](function(_0x501d98){_0x2ef0a9[_0xc12a('0x1a')]=_0x501d98;if(_0x2ef0a9['interaction']['UserId']){return db[_0xc12a('0x61')]['find']({'attributes':['id','name'],'where':{'id':_0x2ef0a9[_0xc12a('0x56')][_0xc12a('0x62')]}})[_0xc12a('0x13')](function(_0x408dac){if(_0x408dac){_0x2ef0a9[_0xc12a('0x3c')][_0xc12a('0x63')]({'id':0x0,'priority':0x0,'app':_0xc12a('0x64'),'appdata':_0x408dac['name']+','+(_0x2ef0a9[_0xc12a('0x32')][_0xc12a('0x65')]||0xa),'interval':_0xc12a('0x42')});}return respondWithRpcPromise(_0xc12a('0x66'),_0xc12a('0x67'),_0x2ef0a9);});}return respondWithRpcPromise(_0xc12a('0x66'),_0xc12a('0x67'),_0x2ef0a9);})[_0xc12a('0x13')](function(_0x490dfe){_0x5658b2(_0x490dfe);})[_0xc12a('0x27')](function(_0x173386){_0x9a6375(_0x5765a4['error'](0x1f4,_0x173386[_0xc12a('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 368b3ac..53f8a73 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 _0xc50c=['update','emit','removeListener','register','length','./mailAccount.events','save','remove'];(function(_0x5bb710,_0x2f29f4){var _0x40ed91=function(_0x111bcb){while(--_0x111bcb){_0x5bb710['push'](_0x5bb710['shift']());}};_0x40ed91(++_0x2f29f4);}(_0xc50c,0x11d));var _0xcc50=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xc50c[_0x36884e];return _0x1cc367;};'use strict';var MailAccountEvents=require(_0xcc50('0x0'));var events=[_0xcc50('0x1'),_0xcc50('0x2'),_0xcc50('0x3')];function createListener(_0x200d0e,_0x3568a8){return function(_0x3784dd){_0x3568a8[_0xcc50('0x4')](_0x200d0e,_0x3784dd);};}function removeListener(_0x376579,_0x3715be){return function(){MailAccountEvents[_0xcc50('0x5')](_0x376579,_0x3715be);};}exports[_0xcc50('0x6')]=function(_0x48312b){for(var _0x394bda=0x0,_0x26355a=events[_0xcc50('0x7')];_0x394bda<_0x26355a;_0x394bda++){var _0x3175d1=events[_0x394bda];var _0x42e947=createListener('mailAccount:'+_0x3175d1,_0x48312b);MailAccountEvents['on'](_0x3175d1,_0x42e947);}}; \ No newline at end of file +var _0x1018=['./mailAccount.events','save','remove','update','emit','register','length','mailAccount:'];(function(_0x2440b8,_0x3a44df){var _0x5509aa=function(_0xbee2c2){while(--_0xbee2c2){_0x2440b8['push'](_0x2440b8['shift']());}};_0x5509aa(++_0x3a44df);}(_0x1018,0x148));var _0x8101=function(_0xe44825,_0x580831){_0xe44825=_0xe44825-0x0;var _0x2dea7a=_0x1018[_0xe44825];return _0x2dea7a;};'use strict';var MailAccountEvents=require(_0x8101('0x0'));var events=[_0x8101('0x1'),_0x8101('0x2'),_0x8101('0x3')];function createListener(_0x937be,_0x83770f){return function(_0x1182d2){_0x83770f[_0x8101('0x4')](_0x937be,_0x1182d2);};}function removeListener(_0x14d8d5,_0x206c9d){return function(){MailAccountEvents['removeListener'](_0x14d8d5,_0x206c9d);};}exports[_0x8101('0x5')]=function(_0x204501){for(var _0x3745d3=0x0,_0x55bf39=events[_0x8101('0x6')];_0x3745d3<_0x55bf39;_0x3745d3++){var _0x3ea57d=events[_0x3745d3];var _0x3d730b=createListener(_0x8101('0x7')+_0x3ea57d,_0x204501);MailAccountEvents['on'](_0x3ea57d,_0x3d730b);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 4f26ae4..0cac670 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 _0x4f8b=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','show','put'];(function(_0x1351d5,_0x296c46){var _0x455b69=function(_0x1007a0){while(--_0x1007a0){_0x1351d5['push'](_0x1351d5['shift']());}};_0x455b69(++_0x296c46);}(_0x4f8b,0x1f3));var _0xb4f8=function(_0x4fa451,_0x148917){_0x4fa451=_0x4fa451-0x0;var _0x554180=_0x4f8b[_0x4fa451];return _0x554180;};'use strict';var multer=require('multer');var util=require(_0xb4f8('0x0'));var path=require(_0xb4f8('0x1'));var timeout=require(_0xb4f8('0x2'));var express=require(_0xb4f8('0x3'));var router=express[_0xb4f8('0x4')]();var fs_extra=require(_0xb4f8('0x5'));var auth=require(_0xb4f8('0x6'));var interaction=require(_0xb4f8('0x7'));var config=require(_0xb4f8('0x8'));var controller=require('./mailApplication.controller');router['get'](_0xb4f8('0x9'),auth[_0xb4f8('0xa')](),controller[_0xb4f8('0xb')]);router[_0xb4f8('0xc')](_0xb4f8('0x9'),auth[_0xb4f8('0xa')](),controller['update']);router[_0xb4f8('0xd')](_0xb4f8('0x9'),auth[_0xb4f8('0xa')](),controller[_0xb4f8('0xe')]);module[_0xb4f8('0xf')]=router; \ No newline at end of file +var _0xdc5b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','isAuthenticated','put','/:id','update','delete','multer','connect-timeout','express','Router'];(function(_0x1e1a96,_0x1480d6){var _0xbef7bd=function(_0x32b265){while(--_0x32b265){_0x1e1a96['push'](_0x1e1a96['shift']());}};_0xbef7bd(++_0x1480d6);}(_0xdc5b,0x192));var _0xbdc5=function(_0xea2899,_0x3495c9){_0xea2899=_0xea2899-0x0;var _0x34b872=_0xdc5b[_0xea2899];return _0x34b872;};'use strict';var multer=require(_0xbdc5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbdc5('0x1'));var express=require(_0xbdc5('0x2'));var router=express[_0xbdc5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbdc5('0x4'));var interaction=require(_0xbdc5('0x5'));var config=require(_0xbdc5('0x6'));var controller=require(_0xbdc5('0x7'));router[_0xbdc5('0x8')]('/:id',auth[_0xbdc5('0x9')](),controller['show']);router[_0xbdc5('0xa')](_0xbdc5('0xb'),auth[_0xbdc5('0x9')](),controller[_0xbdc5('0xc')]);router[_0xbdc5('0xd')](_0xbdc5('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index e488df3..0ca0d08 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 _0x7cbf=['INTEGER','noop','TEXT','STRING','sequelize'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7cbf,0x112));var _0xf7cb=function(_0x287de8,_0x1be6b3){_0x287de8=_0x287de8-0x0;var _0x440307=_0x7cbf[_0x287de8];return _0x440307;};'use strict';var Sequelize=require(_0xf7cb('0x0'));module['exports']={'priority':{'type':Sequelize[_0xf7cb('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf7cb('0x2')},'appdata':{'type':Sequelize[_0xf7cb('0x3')]()},'description':{'type':Sequelize[_0xf7cb('0x4')]},'interval':{'type':Sequelize[_0xf7cb('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x951b=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x48995d,_0xe965b8){var _0xdadd49=function(_0x4f4212){while(--_0x4f4212){_0x48995d['push'](_0x48995d['shift']());}};_0xdadd49(++_0xe965b8);}(_0x951b,0x14c));var _0xb951=function(_0x1a1a39,_0xc1491b){_0x1a1a39=_0x1a1a39-0x0;var _0x346c63=_0x951b[_0x1a1a39];return _0x346c63;};'use strict';var Sequelize=require(_0xb951('0x0'));module[_0xb951('0x1')]={'priority':{'type':Sequelize[_0xb951('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb951('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb951('0x4')]()},'description':{'type':Sequelize[_0xb951('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xb951('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index d64a214..715d9d5 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(_0x526911,_0x412903){var _0x57102e=function(_0x42682a){while(--_0x42682a){_0x526911['push'](_0x526911['shift']());}};_0x57102e(++_0x412903);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3aec67,_0x3371c2){_0x3aec67=_0x3aec67-0x0;var _0x4a13ad=_0xb43b[_0x3aec67];return _0x4a13ad;};'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 _0x54ef=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','show','params','model','rawAttributes','query','keys','filters','intersection','attributes','fields','length','merge','options','MailApplication','find','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x20446d,_0x196b02){var _0x3b126d=function(_0x38b2c7){while(--_0x38b2c7){_0x20446d['push'](_0x20446d['shift']());}};_0x3b126d(++_0x196b02);}(_0x54ef,0x112));var _0xf54e=function(_0x384613,_0x34e08c){_0x384613=_0x384613-0x0;var _0x32ac5c=_0x54ef[_0x384613];return _0x32ac5c;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];function respondWithStatusCode(_0x4b0ee1,_0x4bd828){_0x4bd828=_0x4bd828||0xcc;return function(_0x15a9d4){if(_0x15a9d4){return _0x4b0ee1[_0xf54e('0x19')](_0x4bd828);}return _0x4b0ee1[_0xf54e('0x1a')](_0x4bd828)[_0xf54e('0x1b')]();};}function respondWithResult(_0x5644aa,_0x331732){_0x331732=_0x331732||0xc8;return function(_0x1bbeaa){if(_0x1bbeaa){return _0x5644aa[_0xf54e('0x1a')](_0x331732)[_0xf54e('0x1c')](_0x1bbeaa);}};}function respondWithFilteredResult(_0x56828e,_0x2366ee){return function(_0x389abc){if(_0x389abc){var _0x3eb415=typeof _0x2366ee['offset']==='undefined'&&typeof _0x2366ee[_0xf54e('0x1d')]===_0xf54e('0x1e');var _0x1c02e7=_0x389abc[_0xf54e('0x1f')];var _0x15cc48=_0x3eb415?0x0:_0x2366ee[_0xf54e('0x20')];var _0x2e27b6=_0x3eb415?_0x389abc[_0xf54e('0x1f')]:_0x2366ee[_0xf54e('0x20')]+_0x2366ee[_0xf54e('0x1d')];var _0x226c96;if(_0x2e27b6>=_0x1c02e7){_0x2e27b6=_0x1c02e7;_0x226c96=0xc8;}else{_0x226c96=0xce;}_0x56828e['status'](_0x226c96);return _0x56828e['set'](_0xf54e('0x21'),_0x15cc48+'-'+_0x2e27b6+'/'+_0x1c02e7)['json'](_0x389abc);}return null;};}function patchUpdates(_0x3e1556){return function(_0x1bfe99){try{jsonpatch[_0xf54e('0x22')](_0x1bfe99,_0x3e1556,!![]);}catch(_0x9903fc){return BPromise[_0xf54e('0x23')](_0x9903fc);}return _0x1bfe99[_0xf54e('0x24')]();};}function saveUpdates(_0x388aa0,_0x11985e){return function(_0x3c0169){if(_0x3c0169){return _0x3c0169[_0xf54e('0x25')](_0x388aa0)[_0xf54e('0x26')](function(_0x5b83df){return _0x5b83df;});}return null;};}function removeEntity(_0x6f6d29,_0x54f914){return function(_0x264a8f){if(_0x264a8f){return _0x264a8f[_0xf54e('0x27')]()[_0xf54e('0x26')](function(){_0x6f6d29[_0xf54e('0x1a')](0xcc)[_0xf54e('0x1b')]();});}};}function handleEntityNotFound(_0x160160,_0x1e08d1){return function(_0x43488d){if(!_0x43488d){_0x160160[_0xf54e('0x19')](0x194);}return _0x43488d;};}function handleError(_0x33457f,_0xf6cdd7){_0xf6cdd7=_0xf6cdd7||0x1f4;return function(_0x39c0ae){logger[_0xf54e('0x28')](_0x39c0ae['stack']);if(_0x39c0ae[_0xf54e('0x29')]){delete _0x39c0ae['name'];}_0x33457f[_0xf54e('0x1a')](_0xf6cdd7)['send'](_0x39c0ae);};}exports[_0xf54e('0x2a')]=function(_0x269f47,_0x21ba00){var _0xa13cd0={'raw':!![],'where':{'id':_0x269f47[_0xf54e('0x2b')]['id']}},_0x25b643={};_0x25b643[_0xf54e('0x2c')]=_['keys'](db['MailApplication'][_0xf54e('0x2d')]);_0x25b643[_0xf54e('0x2e')]=_[_0xf54e('0x2f')](_0x269f47[_0xf54e('0x2e')]);_0x25b643[_0xf54e('0x30')]=_[_0xf54e('0x31')](_0x25b643[_0xf54e('0x2c')],_0x25b643[_0xf54e('0x2e')]);_0xa13cd0[_0xf54e('0x32')]=_[_0xf54e('0x31')](_0x25b643['model'],qs['fields'](_0x269f47[_0xf54e('0x2e')][_0xf54e('0x33')]));_0xa13cd0['attributes']=_0xa13cd0[_0xf54e('0x32')][_0xf54e('0x34')]?_0xa13cd0[_0xf54e('0x32')]:_0x25b643[_0xf54e('0x2c')];if(_0x269f47['query']['includeAll']){_0xa13cd0['include']=[{'all':!![]}];}_0xa13cd0=_[_0xf54e('0x35')]({},_0xa13cd0,_0x269f47[_0xf54e('0x36')]);return db[_0xf54e('0x37')][_0xf54e('0x38')](_0xa13cd0)[_0xf54e('0x26')](handleEntityNotFound(_0x21ba00,null))[_0xf54e('0x26')](respondWithResult(_0x21ba00,null))['catch'](handleError(_0x21ba00,null));};exports['update']=function(_0x530cee,_0xc04e04){if(_0x530cee[_0xf54e('0x39')]['id']){delete _0x530cee['body']['id'];}return db['MailApplication'][_0xf54e('0x38')]({'where':{'id':_0x530cee[_0xf54e('0x2b')]['id']}})[_0xf54e('0x26')](handleEntityNotFound(_0xc04e04,null))['then'](saveUpdates(_0x530cee[_0xf54e('0x39')],null))[_0xf54e('0x26')](respondWithResult(_0xc04e04,null))['catch'](handleError(_0xc04e04,null));};exports[_0xf54e('0x27')]=function(_0x6e5bdf,_0x5af03){return db[_0xf54e('0x37')][_0xf54e('0x38')]({'where':{'id':_0x6e5bdf[_0xf54e('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5af03,null))['then'](removeEntity(_0x5af03,null))[_0xf54e('0x3a')](handleError(_0x5af03,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 3fc0bc3..11cedc9 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 _0x7318=['moment','path','rimraf','./mailApplication.attributes','exports','define','mail_applications','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x1a019f,_0x36a028){var _0x25bd63=function(_0x17803d){while(--_0x17803d){_0x1a019f['push'](_0x1a019f['shift']());}};_0x25bd63(++_0x36a028);}(_0x7318,0x97));var _0x8731=function(_0x298054,_0x412508){_0x298054=_0x298054-0x0;var _0x3b3db1=_0x7318[_0x298054];return _0x3b3db1;};'use strict';var _=require('lodash');var util=require(_0x8731('0x0'));var logger=require(_0x8731('0x1'))(_0x8731('0x2'));var moment=require(_0x8731('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8731('0x4'));var rimraf=require(_0x8731('0x5'));var config=require('../../config/environment');var attributes=require(_0x8731('0x6'));module[_0x8731('0x7')]=function(_0x4c467c,_0x2516a6){return _0x4c467c[_0x8731('0x8')]('MailApplication',attributes,{'tableName':_0x8731('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8731('0xa')});}; \ No newline at end of file +var _0x31b1=['utf8mb4','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','define','MailApplication','mail_applications'];(function(_0x48f2c2,_0x38f0d6){var _0x2d5de0=function(_0x55774d){while(--_0x55774d){_0x48f2c2['push'](_0x48f2c2['shift']());}};_0x2d5de0(++_0x38f0d6);}(_0x31b1,0x1b2));var _0x131b=function(_0x1a1560,_0xd98cd5){_0x1a1560=_0x1a1560-0x0;var _0x282f40=_0x31b1[_0x1a1560];return _0x282f40;};'use strict';var _=require(_0x131b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x131b('0x1'));var BPromise=require(_0x131b('0x2'));var rp=require(_0x131b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x131b('0x4'));var config=require(_0x131b('0x5'));var attributes=require(_0x131b('0x6'));module['exports']=function(_0x4b6d18,_0x2eba67){return _0x4b6d18[_0x131b('0x7')](_0x131b('0x8'),attributes,{'tableName':_0x131b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x131b('0xa'),'collate':_0x131b('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index c40e63c..87e95df 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 _0xd36f=['MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','update','body','options','raw','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xd36f,0x1a4));var _0xfd36=function(_0x2aa7e1,_0x15b2aa){_0x2aa7e1=_0x2aa7e1-0x0;var _0xb885e3=_0xd36f[_0x2aa7e1];return _0xb885e3;};'use strict';var _=require(_0xfd36('0x0'));var util=require(_0xfd36('0x1'));var moment=require(_0xfd36('0x2'));var BPromise=require(_0xfd36('0x3'));var rs=require(_0xfd36('0x4'));var fs=require('fs');var Redis=require(_0xfd36('0x5'));var db=require(_0xfd36('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfd36('0x7'))(_0xfd36('0x8'));var config=require(_0xfd36('0x9'));var jayson=require(_0xfd36('0xa'));var client=jayson['client'][_0xfd36('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x416290,_0xdbb45e,_0x39640d){return new BPromise(function(_0x4f0c44,_0x4c7c1f){return client['request'](_0x416290,_0x39640d)[_0xfd36('0xc')](function(_0x2ffdfc){logger[_0xfd36('0xd')](_0xfd36('0xe'),_0xdbb45e,_0xfd36('0xf'));logger[_0xfd36('0x10')](_0xfd36('0x11'),_0xdbb45e,_0xfd36('0xf'),JSON[_0xfd36('0x12')](_0x2ffdfc));if(_0x2ffdfc[_0xfd36('0x13')]){if(_0x2ffdfc[_0xfd36('0x13')][_0xfd36('0x14')]===0x1f4){logger[_0xfd36('0x13')]('MailApplication,\x20%s,\x20%s',_0xdbb45e,_0x2ffdfc[_0xfd36('0x13')][_0xfd36('0x15')]);return _0x4c7c1f(_0x2ffdfc[_0xfd36('0x13')][_0xfd36('0x15')]);}logger['error'](_0xfd36('0xe'),_0xdbb45e,_0x2ffdfc[_0xfd36('0x13')][_0xfd36('0x15')]);return _0x4f0c44(_0x2ffdfc[_0xfd36('0x13')][_0xfd36('0x15')]);}else{logger[_0xfd36('0xd')](_0xfd36('0xe'),_0xdbb45e,_0xfd36('0xf'));_0x4f0c44(_0x2ffdfc[_0xfd36('0x16')][_0xfd36('0x15')]);}})[_0xfd36('0x17')](function(_0x738f8b){logger['error'](_0xfd36('0xe'),_0xdbb45e,_0x738f8b);_0x4c7c1f(_0x738f8b);});});}exports[_0xfd36('0x18')]=function(_0x4b173e){var _0x41da0f=this;return new Promise(function(_0x1469aa,_0x2aa5eb){return db['MailApplication'][_0xfd36('0x19')](_0x4b173e[_0xfd36('0x1a')],{'raw':_0x4b173e[_0xfd36('0x1b')]?_0x4b173e[_0xfd36('0x1b')][_0xfd36('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b173e[_0xfd36('0x1b')]?_0x4b173e[_0xfd36('0x1b')][_0xfd36('0x1d')]||null:null,'attributes':_0x4b173e[_0xfd36('0x1b')]?_0x4b173e[_0xfd36('0x1b')]['attributes']||null:null,'limit':_0x4b173e[_0xfd36('0x1b')]?_0x4b173e[_0xfd36('0x1b')][_0xfd36('0x1e')]||null:null})[_0xfd36('0xc')](function(_0x440d5a){logger[_0xfd36('0xd')]('UpdateMailApplication',_0x4b173e);logger[_0xfd36('0x10')]('UpdateMailApplication',_0x4b173e,JSON['stringify'](_0x440d5a));_0x1469aa(_0x440d5a);})['catch'](function(_0x14128d){logger[_0xfd36('0x13')]('UpdateMailApplication',_0x14128d[_0xfd36('0x15')],_0x4b173e);_0x2aa5eb(_0x41da0f[_0xfd36('0x13')](0x1f4,_0x14128d[_0xfd36('0x15')]));});});}; \ No newline at end of file +var _0x0343=['debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailApplication','update','body','options','raw','where','attributes','limit','UpdateMailApplication'];(function(_0x5efbac,_0x4ad9b8){var _0x368212=function(_0x2fa3f2){while(--_0x2fa3f2){_0x5efbac['push'](_0x5efbac['shift']());}};_0x368212(++_0x4ad9b8);}(_0x0343,0x13c));var _0x3034=function(_0x483d2a,_0x4bffba){_0x483d2a=_0x483d2a-0x0;var _0x5ba5d5=_0x0343[_0x483d2a];return _0x5ba5d5;};'use strict';var _=require(_0x3034('0x0'));var util=require(_0x3034('0x1'));var moment=require(_0x3034('0x2'));var BPromise=require(_0x3034('0x3'));var rs=require(_0x3034('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3034('0x5'))['db'];var utils=require(_0x3034('0x6'));var logger=require(_0x3034('0x7'))(_0x3034('0x8'));var config=require(_0x3034('0x9'));var jayson=require(_0x3034('0xa'));var client=jayson[_0x3034('0xb')][_0x3034('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x368c09,_0x216e58,_0x59de14){return new BPromise(function(_0x4f6776,_0x5e97ba){return client[_0x3034('0xd')](_0x368c09,_0x59de14)[_0x3034('0xe')](function(_0x17a0c8){logger[_0x3034('0xf')](_0x3034('0x10'),_0x216e58,_0x3034('0x11'));logger['debug'](_0x3034('0x12'),_0x216e58,_0x3034('0x11'),JSON[_0x3034('0x13')](_0x17a0c8));if(_0x17a0c8[_0x3034('0x14')]){if(_0x17a0c8[_0x3034('0x14')][_0x3034('0x15')]===0x1f4){logger['error'](_0x3034('0x10'),_0x216e58,_0x17a0c8[_0x3034('0x14')]['message']);return _0x5e97ba(_0x17a0c8[_0x3034('0x14')][_0x3034('0x16')]);}logger[_0x3034('0x14')](_0x3034('0x10'),_0x216e58,_0x17a0c8['error'][_0x3034('0x16')]);return _0x4f6776(_0x17a0c8['error'][_0x3034('0x16')]);}else{logger[_0x3034('0xf')]('MailApplication,\x20%s,\x20%s',_0x216e58,_0x3034('0x11'));_0x4f6776(_0x17a0c8[_0x3034('0x17')][_0x3034('0x16')]);}})[_0x3034('0x18')](function(_0x40acb4){logger[_0x3034('0x14')](_0x3034('0x10'),_0x216e58,_0x40acb4);_0x5e97ba(_0x40acb4);});});}exports['UpdateMailApplication']=function(_0x9bccd4){var _0x54fcfa=this;return new Promise(function(_0x40c0db,_0x590ac9){return db[_0x3034('0x19')][_0x3034('0x1a')](_0x9bccd4[_0x3034('0x1b')],{'raw':_0x9bccd4['options']?_0x9bccd4[_0x3034('0x1c')][_0x3034('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9bccd4[_0x3034('0x1c')]?_0x9bccd4[_0x3034('0x1c')][_0x3034('0x1e')]||null:null,'attributes':_0x9bccd4[_0x3034('0x1c')]?_0x9bccd4[_0x3034('0x1c')][_0x3034('0x1f')]||null:null,'limit':_0x9bccd4['options']?_0x9bccd4[_0x3034('0x1c')][_0x3034('0x20')]||null:null})[_0x3034('0xe')](function(_0x2c2178){logger[_0x3034('0xf')](_0x3034('0x21'),_0x9bccd4);logger[_0x3034('0x22')]('UpdateMailApplication',_0x9bccd4,JSON[_0x3034('0x13')](_0x2c2178));_0x40c0db(_0x2c2178);})[_0x3034('0x18')](function(_0x3eb64d){logger[_0x3034('0x14')]('UpdateMailApplication',_0x3eb64d[_0x3034('0x16')],_0x9bccd4);_0x590ac9(_0x54fcfa['error'](0x1f4,_0x3eb64d[_0x3034('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index e1918cf..1b6f81e 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 _0x11f3=['put','update','mailinteraction:destroy','destroy','/:id/tags','removeTags','exports','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','getMessages','post','create','addMessage','tracked','mail'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x11f3,0xe3));var _0x311f=function(_0x16c2b1,_0x36a70c){_0x16c2b1=_0x16c2b1-0x0;var _0x199ac4=_0x11f3[_0x16c2b1];return _0x199ac4;};'use strict';var express=require('express');var router=express[_0x311f('0x0')]();var auth=require(_0x311f('0x1'));var interaction=require(_0x311f('0x2'));var controller=require('./mailInteraction.controller');router['get']('/',auth[_0x311f('0x3')](),controller[_0x311f('0x4')]);router[_0x311f('0x5')](_0x311f('0x6'),auth[_0x311f('0x3')](),controller[_0x311f('0x7')]);router['get'](_0x311f('0x8'),auth[_0x311f('0x3')](),controller['show']);router[_0x311f('0x5')]('/:id/messages',auth[_0x311f('0x3')](),controller[_0x311f('0x9')]);router[_0x311f('0x5')]('/:id/download',auth[_0x311f('0x3')](),controller['download']);router[_0x311f('0xa')]('/',auth[_0x311f('0x3')](),controller[_0x311f('0xb')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0x311f('0xc')]);router[_0x311f('0xa')]('/:id/tags',auth[_0x311f('0x3')](),interaction[_0x311f('0xd')](_0x311f('0xe'),'mailinteraction:addtags'),controller['addTags']);router[_0x311f('0xf')](_0x311f('0x8'),auth[_0x311f('0x3')](),interaction[_0x311f('0xd')](_0x311f('0xe'),'mailinteraction:update'),controller[_0x311f('0x10')]);router['delete'](_0x311f('0x8'),auth[_0x311f('0x3')](),interaction[_0x311f('0xd')](_0x311f('0xe'),_0x311f('0x11')),controller[_0x311f('0x12')]);router['delete'](_0x311f('0x13'),auth[_0x311f('0x3')](),controller[_0x311f('0x14')]);module[_0x311f('0x15')]=router; \ No newline at end of file +var _0xc484=['describe','/:id','getMessages','/:id/download','download','post','create','/:id/tags','mail','addTags','put','mailinteraction:update','update','delete','tracked','destroy','removeTags','exports','express','../../components/interaction/service','get','isAuthenticated','/describe'];(function(_0x1261c2,_0x3ef819){var _0x3aabd2=function(_0x425d76){while(--_0x425d76){_0x1261c2['push'](_0x1261c2['shift']());}};_0x3aabd2(++_0x3ef819);}(_0xc484,0x10f));var _0x4c48=function(_0x24b5d8,_0x203128){_0x24b5d8=_0x24b5d8-0x0;var _0x54908d=_0xc484[_0x24b5d8];return _0x54908d;};'use strict';var express=require(_0x4c48('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4c48('0x1'));var controller=require('./mailInteraction.controller');router[_0x4c48('0x2')]('/',auth[_0x4c48('0x3')](),controller['index']);router[_0x4c48('0x2')](_0x4c48('0x4'),auth[_0x4c48('0x3')](),controller[_0x4c48('0x5')]);router['get'](_0x4c48('0x6'),auth[_0x4c48('0x3')](),controller['show']);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x4c48('0x7')]);router[_0x4c48('0x2')](_0x4c48('0x8'),auth[_0x4c48('0x3')](),controller[_0x4c48('0x9')]);router[_0x4c48('0xa')]('/',auth[_0x4c48('0x3')](),controller[_0x4c48('0xb')]);router[_0x4c48('0xa')]('/:id/messages',auth[_0x4c48('0x3')](),controller['addMessage']);router[_0x4c48('0xa')](_0x4c48('0xc'),auth[_0x4c48('0x3')](),interaction['tracked'](_0x4c48('0xd'),'mailinteraction:addtags'),controller[_0x4c48('0xe')]);router[_0x4c48('0xf')](_0x4c48('0x6'),auth['isAuthenticated'](),interaction['tracked']('mail',_0x4c48('0x10')),controller[_0x4c48('0x11')]);router[_0x4c48('0x12')](_0x4c48('0x6'),auth[_0x4c48('0x3')](),interaction[_0x4c48('0x13')]('mail','mailinteraction:destroy'),controller[_0x4c48('0x14')]);router[_0x4c48('0x12')](_0x4c48('0xc'),auth[_0x4c48('0x3')](),controller[_0x4c48('0x15')]);module[_0x4c48('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 73969fc..2de4c56 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 _0xf0dd=['STRING','TEXT','long','DATE','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf0dd,0x84));var _0xdf0d=function(_0x393078,_0x137ad1){_0x393078=_0x393078-0x0;var _0x4fdaab=_0xf0dd[_0x393078];return _0x4fdaab;};'use strict';var Sequelize=require(_0xdf0d('0x0'));var iconv=require('iconv');module[_0xdf0d('0x1')]={'closed':{'type':Sequelize[_0xdf0d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xdf0d('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xdf0d('0x3')]},'note':{'type':Sequelize[_0xdf0d('0x3')]},'inReplyTo':{'type':Sequelize[_0xdf0d('0x3')](0x1fe)},'to':{'type':Sequelize[_0xdf0d('0x3')]},'cc':{'type':Sequelize[_0xdf0d('0x4')](_0xdf0d('0x5'))},'subject':{'type':Sequelize[_0xdf0d('0x4')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xdf0d('0x6')]},'substatus':{'type':Sequelize[_0xdf0d('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xdf0d('0x6')]},'firstMsgDirection':{'type':Sequelize[_0xdf0d('0x7')]('in',_0xdf0d('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xdf0d('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xee24=['exports','DATE','STRING','TEXT','long','BOOLEAN','ENUM','out','iconv'];(function(_0xc2c89,_0x22c701){var _0x4f9032=function(_0x1fbeae){while(--_0x1fbeae){_0xc2c89['push'](_0xc2c89['shift']());}};_0x4f9032(++_0x22c701);}(_0xee24,0x1a6));var _0x4ee2=function(_0x2163fc,_0x58ea83){_0x2163fc=_0x2163fc-0x0;var _0xd34cbf=_0xee24[_0x2163fc];return _0xd34cbf;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x4ee2('0x0'));module[_0x4ee2('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4ee2('0x2')]},'disposition':{'type':Sequelize[_0x4ee2('0x3')]},'secondDisposition':{'type':Sequelize[_0x4ee2('0x3')]},'thirdDisposition':{'type':Sequelize[_0x4ee2('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x4ee2('0x3')](0x1fe)},'to':{'type':Sequelize[_0x4ee2('0x3')]},'cc':{'type':Sequelize[_0x4ee2('0x4')](_0x4ee2('0x5'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x4ee2('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x4ee2('0x2')]},'substatus':{'type':Sequelize[_0x4ee2('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x4ee2('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x4ee2('0x7')]('in',_0x4ee2('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4ee2('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x4ee2('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index cc67d4b..9712f80 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 _0x92fd=['Tags','split','forEach','push','MailMessage','out','plainBody','-id','lastMsgText','catch','index','MailInteraction','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','select','field','name','color','from','tools_tags','u.id','u.fullname','user_has_mail_interactions','users','u.id\x20=\x20ui.UserId','mail_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','value','having','`\x20>\x200','Contact','operator','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.MailAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','o.fullname','Owner.fullname','Owner.internal','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','findOne','enableEmailPreview','all','rows','show','rawAttributes','includeAll','include','options','create','body','update','params','describe','addMessage','ids','getMessages','hasOwnProperty','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','omit','spread','Tag','mailInteractionTags:save','removeTags','download','unix','join','root','server','tmp','transcript-%d-%s.zip','Attachment','Attachments','subject','Messages','mkdirSync','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','attachments','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','path','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','send','Users','map','fullname','TagIds'];(function(_0x3a689c,_0x3d8869){var _0xe47487=function(_0x9d6361){while(--_0x9d6361){_0x3a689c['push'](_0x3a689c['shift']());}};_0xe47487(++_0x3d8869);}(_0x92fd,0x1b8));var _0xd92f=function(_0x13594e,_0x6f0ed0){_0x13594e=_0x13594e-0x0;var _0x1a4f42=_0x92fd[_0x13594e];return _0x1a4f42;};'use strict';var emlformat=require(_0xd92f('0x0'));var rimraf=require(_0xd92f('0x1'));var zipdir=require(_0xd92f('0x2'));var moment=require(_0xd92f('0x3'));var BPromise=require(_0xd92f('0x4'));var util=require('util');var path=require(_0xd92f('0x5'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd92f('0x6'));var juice=require(_0xd92f('0x7'));var Redis=require(_0xd92f('0x8'));var qs=require(_0xd92f('0x9'));var as=require(_0xd92f('0xa'));var logger=require(_0xd92f('0xb'))(_0xd92f('0xc'));var config=require(_0xd92f('0xd'));var db=require(_0xd92f('0xe'))['db'];var htmlEntities=require('html-entities');config['redis']=_['defaults'](config[_0xd92f('0xf')],{'host':_0xd92f('0x10'),'port':0x18eb});var socket=require(_0xd92f('0x11'))(new Redis(config[_0xd92f('0xf')]));require(_0xd92f('0x12'))[_0xd92f('0x13')](socket);function respondWithStatusCode(_0x5bda97,_0x2682e9){_0x2682e9=_0x2682e9||0xcc;return function(_0x50758b){if(_0x50758b){return _0x5bda97[_0xd92f('0x14')](_0x2682e9);}return _0x5bda97[_0xd92f('0x15')](_0x2682e9)[_0xd92f('0x16')]();};}function respondWithResult(_0xe85c2b,_0x2b5de8){_0x2b5de8=_0x2b5de8||0xc8;return function(_0x44febc){if(_0x44febc){return _0xe85c2b[_0xd92f('0x15')](_0x2b5de8)[_0xd92f('0x17')](_0x44febc);}};}function respondWithFilteredResult(_0x4ce6e1,_0xe58b39){return function(_0x384dfd){if(_0x384dfd){var _0x1efde0=typeof _0xe58b39[_0xd92f('0x18')]==='undefined'&&typeof _0xe58b39['limit']===_0xd92f('0x19');var _0x1e9ac0=_0x384dfd[_0xd92f('0x1a')];var _0x28ebab=_0x1efde0?0x0:_0xe58b39[_0xd92f('0x18')];var _0x3e4efd=_0x1efde0?_0x384dfd['count']:_0xe58b39['offset']+_0xe58b39[_0xd92f('0x1b')];var _0x39e8f0;if(_0x3e4efd>=_0x1e9ac0){_0x3e4efd=_0x1e9ac0;_0x39e8f0=0xc8;}else{_0x39e8f0=0xce;}_0x4ce6e1['status'](_0x39e8f0);return _0x4ce6e1[_0xd92f('0x1c')](_0xd92f('0x1d'),_0x28ebab+'-'+_0x3e4efd+'/'+_0x1e9ac0)[_0xd92f('0x17')](_0x384dfd);}return null;};}function saveUpdates(_0x11b4d2){return function(_0x315792){if(_0x315792){return _0x315792['update'](_0x11b4d2)['then'](function(_0x5e4f51){return _0x5e4f51;});}return null;};}function removeEntity(_0x497675){return function(_0x358b5c){if(_0x358b5c){return _0x358b5c['destroy']()[_0xd92f('0x1e')](function(){_0x497675[_0xd92f('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a0e62){return function(_0x36e12c){if(!_0x36e12c){_0x5a0e62[_0xd92f('0x14')](0x194);}return _0x36e12c;};}function handleError(_0x2f77d2,_0x483082){_0x483082=_0x483082||0x1f4;return function(_0x80f865){logger['error'](_0x80f865['stack']);if(_0x80f865['name']){delete _0x80f865['name'];}_0x2f77d2['status'](_0x483082)[_0xd92f('0x1f')](_0x80f865);};}function getInteractionUsers(_0x4b8dac,_0x21b22c){return new BPromise(function(_0x136218,_0x28e3dd){try{if(_0x21b22c[_0x4b8dac['id']]){_0x4b8dac[_0xd92f('0x20')]=_[_0xd92f('0x21')](_0x21b22c[_0x4b8dac['id']],function(_0x1970fc){return{'id':_0x1970fc['id'],'fullname':_0x1970fc[_0xd92f('0x22')]};});}}catch(_0x446dd4){_0x28e3dd(_0x446dd4);}_0x136218(_0x4b8dac);});}function getInteractionTags(_0x3ad679,_0x32de2e){return new BPromise(function(_0x4ccb92,_0xd45f7a){try{if(_0x3ad679[_0xd92f('0x23')]){_0x3ad679[_0xd92f('0x24')]=[];_0x3ad679[_0xd92f('0x23')][_0xd92f('0x25')](',')[_0xd92f('0x26')](function(_0x344801){_0x3ad679['Tags'][_0xd92f('0x27')](_0x32de2e[_0x344801]);});}delete _0x3ad679[_0xd92f('0x23')];}catch(_0x2f0a11){_0xd45f7a(_0x2f0a11);}_0x4ccb92(_0x3ad679);});}function getLastMessageText(_0x4f6c01){return new BPromise(function(_0xa75b49,_0x5a5277){return db[_0xd92f('0x28')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x4f6c01['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xd92f('0x29')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xd92f('0x2a')],'order':_0xd92f('0x2b'),'raw':!![]})['then'](function(_0x1e3623){if(_0x1e3623&&_0x1e3623['plainBody']){_0x4f6c01[_0xd92f('0x2c')]=_['trimStart'](_0x1e3623['plainBody']);}_0xa75b49(_0x4f6c01);})[_0xd92f('0x2d')](function(_0xafd0c0){_0x5a5277(_0xafd0c0);});});}function updateMailInteraction(_0x249b0a,_0x5121d3,_0x53a4d1,_0x371b05){return new BPromise(function(_0x51e606,_0x5180ef){return getInteractionUsers(_0x249b0a,_0x53a4d1)[_0xd92f('0x1e')](function(_0x29e455){return getInteractionTags(_0x29e455,_0x5121d3);})['then'](function(_0x2ff199){if(_0x371b05){_0x51e606(getLastMessageText(_0x2ff199));}else{_0x51e606(_0x2ff199);}})[_0xd92f('0x2d')](function(_0x2f444d){_0x5180ef(_0x2f444d);});});}exports[_0xd92f('0x2e')]=function(_0x22e34a,_0x11c321){var _0x19e949={},_0x52a492={},_0x2aacde={'count':0x0,'rows':[]};var _0x3d4f16=_[_0xd92f('0x21')](db[_0xd92f('0x2f')]['rawAttributes'],function(_0x37b515){return{'name':_0x37b515[_0xd92f('0x30')],'type':_0x37b515[_0xd92f('0x31')][_0xd92f('0x32')]};});_0x52a492[_0xd92f('0x33')]=_['map'](_0x3d4f16,'name');_0x52a492[_0xd92f('0x34')]=_[_0xd92f('0x35')](_0x22e34a['query']);_0x52a492[_0xd92f('0x36')]=_[_0xd92f('0x37')](_0x52a492[_0xd92f('0x33')],_0x52a492['query']);_0x19e949['attributes']=_[_0xd92f('0x37')](_0x52a492[_0xd92f('0x33')],qs[_0xd92f('0x38')](_0x22e34a[_0xd92f('0x34')][_0xd92f('0x38')]));_0x19e949[_0xd92f('0x39')]=_0x19e949[_0xd92f('0x39')]['length']?_0x19e949[_0xd92f('0x39')]:_0x52a492[_0xd92f('0x33')];if(!_0x22e34a['query']['hasOwnProperty'](_0xd92f('0x3a'))){_0x19e949[_0xd92f('0x1b')]=qs[_0xd92f('0x1b')](_0x22e34a[_0xd92f('0x34')][_0xd92f('0x1b')]);_0x19e949[_0xd92f('0x18')]=qs['offset'](_0x22e34a['query'][_0xd92f('0x18')]);}_0x19e949[_0xd92f('0x3b')]=qs[_0xd92f('0x3c')](_0x22e34a[_0xd92f('0x34')][_0xd92f('0x3c')]);_0x19e949[_0xd92f('0x3d')]=qs[_0xd92f('0x36')](_[_0xd92f('0x3e')](_0x22e34a[_0xd92f('0x34')],_0x52a492[_0xd92f('0x36')]),_0x3d4f16);var _0x5f3dc9=[];var _0x533387=squel[_0xd92f('0x3f')]()['field']('id')[_0xd92f('0x40')](_0xd92f('0x41'))[_0xd92f('0x40')](_0xd92f('0x42'))[_0xd92f('0x43')](_0xd92f('0x44'));var _0xbb5a2a=squel[_0xd92f('0x3f')]()[_0xd92f('0x40')](_0xd92f('0x45'))[_0xd92f('0x40')](_0xd92f('0x46'))[_0xd92f('0x40')]('ui.MailInteractionId')[_0xd92f('0x43')](_0xd92f('0x47'),'ui')['left_join'](_0xd92f('0x48'),'u',_0xd92f('0x49'));var _0x4ed9d8=squel['select']()['from'](_0xd92f('0x4a'),'i')[_0xd92f('0x4b')](_0xd92f('0x4c'),'c',_0xd92f('0x4d'))[_0xd92f('0x4b')](_0xd92f('0x48'),'o','o.id\x20=\x20i.UserId')[_0xd92f('0x4b')]('mail_accounts','a','a.id\x20=\x20i.MailAccountId')[_0xd92f('0x4b')](_0xd92f('0x4e'),'me',_0xd92f('0x4f'))['left_join'](_0xd92f('0x50'),'it',_0xd92f('0x51'))[_0xd92f('0x4b')](_0xd92f('0x44'),'t',_0xd92f('0x52'));var _0x5f189a=squel[_0xd92f('0x53')]();var _0x5f3967=[];var _0x5b91a8=squel[_0xd92f('0x53')]();var _0x4394ba;if(_0x22e34a['query'][_0xd92f('0x54')]){_0x4394ba=as[_0xd92f('0x55')](_0x22e34a[_0xd92f('0x34')]['search']);var _0x306da7=_0x4394ba[_0xd92f('0x56')];for(var _0x25ee29=0x0;_0x25ee29<_0x4394ba[_0xd92f('0x57')][_0xd92f('0x58')];_0x25ee29++){var _0x4b5706=_0x4394ba['conditions'][_0x25ee29];var _0x2817d9='i';var _0x1c8c04=_[_0xd92f('0x59')](_0x3d4f16,['name',_0x4b5706[_0xd92f('0x40')]]);if(!_0x1c8c04){switch(_0x4b5706[_0xd92f('0x40')]){case'unreadMessages':if(_0x4b5706[_0xd92f('0x5a')]==0x1){_0x4ed9d8['having']('`'+_0x4b5706[_0xd92f('0x40')]+'`\x20=\x200');}else{_0x4ed9d8[_0xd92f('0x5b')]('`'+_0x4b5706[_0xd92f('0x40')]+_0xd92f('0x5c'));}break;case _0xd92f('0x5d'):if(_0x4b5706[_0xd92f('0x5e')]===_0xd92f('0x5f')){if(_0x4b5706[_0xd92f('0x5a')][_0xd92f('0x25')]('\x20')[_0xd92f('0x58')]>0x1){_0x5f189a[_0x306da7]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4b5706[_0xd92f('0x5a')]),null);}else{var _0x43f669='%'+_0x4b5706[_0xd92f('0x5a')]+'%';_0x5f189a[_0x306da7](_0xd92f('0x60'),_0x43f669,_0x43f669,_0x43f669);}}else{_0x1c8c04=_[_0xd92f('0x59')](_0x3d4f16,[_0xd92f('0x41'),_0xd92f('0x61')]);_0x4b5706[_0xd92f('0x40')]=_0xd92f('0x61');_0x36fedc=as[_0xd92f('0x62')](_0x2817d9,_0x1c8c04['type'],_0x4b5706);_0x5f189a[_0x306da7](_0x36fedc[_0xd92f('0x63')],_0x36fedc[_0xd92f('0x5a')][_0xd92f('0x64')],_0x36fedc[_0xd92f('0x5a')][_0xd92f('0x16')]);}break;case'Tag':var _0x18b216=_0x4b5706[_0xd92f('0x5a')][_0xd92f('0x25')](',')['map'](function(_0x32716e){return Number(_0x32716e);});_0x18b216[_0xd92f('0x26')](function(_0x2fa953){_0x5b91a8['or'](_0xd92f('0x65'),'%,'+_0x2fa953+',%');});_0x5f3967=_[_0xd92f('0x66')](_0x5f3967,_0x18b216);break;case _0xd92f('0x67'):if(_0x4b5706[_0xd92f('0x5e')]==='$substring'){_0x5f189a[_0x306da7](_0xd92f('0x68'),'%'+_0x4b5706['value']+'%',null);}else{_0x1c8c04=_['find'](_0x3d4f16,['name',_0xd92f('0x69')]);_0x4b5706[_0xd92f('0x40')]=_0xd92f('0x69');_0x36fedc=as[_0xd92f('0x62')](_0x2817d9,_0x1c8c04[_0xd92f('0x31')],_0x4b5706);_0x5f189a[_0x306da7](_0x36fedc[_0xd92f('0x63')],_0x36fedc[_0xd92f('0x5a')][_0xd92f('0x64')],_0x36fedc['value'][_0xd92f('0x16')]);}break;case _0xd92f('0x2a'):_0x36fedc=as['buildExpression']('me',null,_0x4b5706);_0x5f189a[_0x306da7](_0x36fedc[_0xd92f('0x63')],_0x36fedc['value'][_0xd92f('0x64')],_0x36fedc[_0xd92f('0x5a')][_0xd92f('0x16')]);break;}}else{var _0x36fedc=as[_0xd92f('0x62')](_0x2817d9,_0x1c8c04[_0xd92f('0x31')],_0x4b5706);_0x5f189a[_0x306da7](_0x36fedc[_0xd92f('0x63')],_0x36fedc[_0xd92f('0x5a')][_0xd92f('0x64')],_0x36fedc[_0xd92f('0x5a')][_0xd92f('0x16')]);}}}else{var _0x53f70f=_(_0x22e34a[_0xd92f('0x34')])[_0xd92f('0x35')]()[_0xd92f('0x21')](function(_0x2c9e52){return _[_0xd92f('0x6a')](_0x3d4f16,[_0xd92f('0x41'),_0x2c9e52])?_0x2c9e52:undefined;})['compact']()[_0xd92f('0x5a')]();if(!_[_0xd92f('0x6b')](_0x53f70f)){_0x53f70f['forEach'](function(_0x3210a0){if(_0x3210a0===_0xd92f('0x6c')){_0x4ed9d8[_0xd92f('0x3d')](_0xd92f('0x6d'),[][_0xd92f('0x6e')](_0x22e34a['query'][_0x3210a0]));}else if(_0x3210a0===_0xd92f('0x6f')){var _0x30cb2c=JSON[_0xd92f('0x70')](_0x22e34a[_0xd92f('0x34')][_0x3210a0])['$gte'];var _0x489b38=JSON[_0xd92f('0x70')](_0x22e34a[_0xd92f('0x34')][_0x3210a0])[_0xd92f('0x71')];_0x4ed9d8[_0xd92f('0x3d')](_0xd92f('0x72'),_0x30cb2c,_0x489b38);}else{if(_0x22e34a['query'][_0x3210a0]===_0xd92f('0x73')){_0x4ed9d8[_0xd92f('0x3d')]('i.'+_0x3210a0+_0xd92f('0x74'));}else{_0x4ed9d8[_0xd92f('0x3d')]('i.'+_0x3210a0+_0xd92f('0x75'),_0x22e34a[_0xd92f('0x34')][_0x3210a0]);}}});}if(_0x22e34a[_0xd92f('0x34')][_0xd92f('0x76')]){if(_0x22e34a[_0xd92f('0x34')][_0xd92f('0x76')]==0x1){_0x4ed9d8[_0xd92f('0x5b')](_0xd92f('0x77'));}else{_0x4ed9d8[_0xd92f('0x5b')](_0xd92f('0x78'));}}if(_0x22e34a['query'][_0xd92f('0x79')]){_0x5f3967=_[_0xd92f('0x7a')](_0x22e34a['query'][_0xd92f('0x79')])?_0x22e34a[_0xd92f('0x34')][_0xd92f('0x79')]:new Array(_0x22e34a[_0xd92f('0x34')][_0xd92f('0x79')]);_0x5f3967[_0xd92f('0x26')](function(_0x3640b9){_0x5b91a8['or'](_0xd92f('0x65'),'%,'+_0x3640b9+',%');});}if(_0x22e34a[_0xd92f('0x34')][_0xd92f('0x7b')]){var _0x201bf9=_0x22e34a['query']['filter'][_0xd92f('0x7c')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xd92f('0x7d')](_0x201bf9)){_0x5f189a['or'](_0xd92f('0x7e'),_0x201bf9+'%');}else if(qs[_0xd92f('0x7f')](_0x201bf9)){_0x5f189a['or']('c.email\x20LIKE\x20?',_0x201bf9+'%');}else{_0x5f189a['or'](_0xd92f('0x80'),qs[_0xd92f('0x81')](_0x201bf9))['or'](_0xd92f('0x82'),qs[_0xd92f('0x81')](_0x201bf9));}}}_0x4ed9d8[_0xd92f('0x3d')](_0x5f189a);_0x4ed9d8[_0xd92f('0x83')]('i.id');var _0x35aa8e={'type':db['Sequelize'][_0xd92f('0x84')][_0xd92f('0x85')],'raw':!![]};var _0x41adfb=_0x4ed9d8[_0xd92f('0x86')]();_0x41adfb['field'](_0xd92f('0x87'));_0x41adfb[_0xd92f('0x40')](_0xd92f('0x88'),_0xd92f('0x89'));if(_0x19e949[_0xd92f('0x3b')]){_0x19e949[_0xd92f('0x3b')][_0xd92f('0x26')](function(_0x392663){var _0x33f7ca=_0x392663[0x0]===_0xd92f('0x8a')?_0x392663[0x0]:'i.'+_0x392663[0x0];_0x4ed9d8[_0xd92f('0x3b')](_0x33f7ca,_0x392663[0x1]===_0xd92f('0x8b')?![]:!![]);});}if(!_[_0xd92f('0x6b')](_0x5f3967)){_0x4ed9d8['having'](_0x5b91a8);_0x41adfb[_0xd92f('0x3d')](_0xd92f('0x8c'),_0x5f3967);}BPromise[_0xd92f('0x8d')]()[_0xd92f('0x1e')](function(){if(!_0x4394ba){if(_0x22e34a[_0xd92f('0x34')][_0xd92f('0x6c')])return;_0x41adfb[_0xd92f('0x3d')](_0xd92f('0x8e'));_0x4ed9d8[_0xd92f('0x3d')](_0xd92f('0x8e'));return;}if(_0x22e34a[_0xd92f('0x8f')][_0xd92f('0x90')]!==_0xd92f('0x91'))return;return _0x22e34a['user']['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0xd92f('0x1e')](function(_0x3f06cb){if(_[_0xd92f('0x6b')](_0x3f06cb)){_0x41adfb[_0xd92f('0x3d')](_0xd92f('0x92'));_0x4ed9d8[_0xd92f('0x3d')](_0xd92f('0x92'));}else{_0x41adfb[_0xd92f('0x3d')](_0xd92f('0x6d'),_[_0xd92f('0x21')](_0x3f06cb,'id'));_0x4ed9d8[_0xd92f('0x3d')](_0xd92f('0x6d'),_[_0xd92f('0x21')](_0x3f06cb,'id'));}});})[_0xd92f('0x1e')](function(){if(_0x22e34a['user'][_0xd92f('0x90')]===_0xd92f('0x91')&&!_0x4394ba&&!_0x22e34a[_0xd92f('0x34')][_0xd92f('0x6c')])return[];return db['sequelize'][_0xd92f('0x34')](_0x41adfb[_0xd92f('0x93')](),_0x35aa8e);})[_0xd92f('0x1e')](function(_0x20a5db){_0x2aacde[_0xd92f('0x1a')]=_0x20a5db[_0xd92f('0x58')];if(_0x2aacde['count']===0x0)return[];return db[_0xd92f('0x94')][_0xd92f('0x34')](_0x533387[_0xd92f('0x93')](),_0x35aa8e)['then'](function(_0x2c6c49){_0x5f3dc9=_[_0xd92f('0x95')](_0x2c6c49,'id');_0x35aa8e=_[_0xd92f('0x96')](_0x35aa8e,{'model':db[_0xd92f('0x2f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x22e34a['query'][_0xd92f('0x38')]){_0x19e949[_0xd92f('0x39')]['forEach'](function(_0x229392){_0x4ed9d8[_0xd92f('0x40')]('i.'+_0x229392);});}else{_0x4ed9d8['field'](_0xd92f('0x88'),_0xd92f('0x89'));_0x4ed9d8[_0xd92f('0x40')](_0xd92f('0x97'),_0xd92f('0x98'));_0x4ed9d8[_0xd92f('0x40')](_0xd92f('0x99'),_0xd92f('0x9a'));_0x4ed9d8[_0xd92f('0x40')](_0xd92f('0x9b'),_0xd92f('0x8a'));_0x4ed9d8[_0xd92f('0x40')](_0xd92f('0x87'));_0x4ed9d8[_0xd92f('0x40')](_0xd92f('0x9c'));_0x4ed9d8[_0xd92f('0x40')]('i.updatedAt');_0x4ed9d8[_0xd92f('0x40')]('i.closed');_0x4ed9d8['field'](_0xd92f('0x9d'));_0x4ed9d8[_0xd92f('0x40')]('i.attach');_0x4ed9d8[_0xd92f('0x40')](_0xd92f('0x9e'));_0x4ed9d8[_0xd92f('0x40')](_0xd92f('0x9f'));_0x4ed9d8[_0xd92f('0x40')](_0xd92f('0xa0'));_0x4ed9d8['field'](_0xd92f('0xa1'));_0x4ed9d8[_0xd92f('0x40')]('i.secondDisposition');_0x4ed9d8[_0xd92f('0x40')](_0xd92f('0xa2'));_0x4ed9d8[_0xd92f('0x40')]('i.substatus');_0x4ed9d8[_0xd92f('0x40')](_0xd92f('0xa3'));_0x4ed9d8['field'](_0xd92f('0xa4'));_0x4ed9d8[_0xd92f('0x40')](_0xd92f('0xa5'));_0x4ed9d8[_0xd92f('0x40')](_0xd92f('0xa6'));_0x4ed9d8['field'](_0xd92f('0xa7'),_0xd92f('0xa8'));_0x4ed9d8[_0xd92f('0x40')](_0xd92f('0xa9'),_0xd92f('0xaa'));_0x4ed9d8['field']('c.email',_0xd92f('0xab'));_0x4ed9d8[_0xd92f('0x40')](_0xd92f('0xac'),_0xd92f('0xad'));_0x4ed9d8[_0xd92f('0x40')](_0xd92f('0xae'),'Contact.mobile');_0x4ed9d8[_0xd92f('0x40')](_0xd92f('0xaf'),'Contact.fax');_0x4ed9d8[_0xd92f('0x40')](_0xd92f('0xb0'),_0xd92f('0xb1'));_0x4ed9d8[_0xd92f('0x40')]('o.internal',_0xd92f('0xb2'));_0x4ed9d8[_0xd92f('0x40')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xd92f('0x23'));}if(_0x19e949[_0xd92f('0x1b')])_0x4ed9d8['limit'](_0x19e949[_0xd92f('0x1b')]);if(_0x19e949['offset'])_0x4ed9d8[_0xd92f('0x18')](_0x19e949[_0xd92f('0x18')]);return db[_0xd92f('0x94')]['query'](_0x4ed9d8[_0xd92f('0x93')](),_0x35aa8e);})['then'](function(_0x42f8d9){if(_0x42f8d9['length']>0x0)_0xbb5a2a['where'](_0xd92f('0xb3'),_['map'](_0x42f8d9,'id'));return db[_0xd92f('0x94')][_0xd92f('0x34')](_0xbb5a2a['toString'](),_0x35aa8e)[_0xd92f('0x1e')](function(_0x2bebc6){var _0x58f8cd=_[_0xd92f('0xb4')](_0x2bebc6,_0xd92f('0xb5'));var _0x5c55b7=[];return db[_0xd92f('0xb6')][_0xd92f('0xb7')]({'attributes':[_0xd92f('0xb8')],'raw':!![]})[_0xd92f('0x1e')](function(_0x4ec8b2){var _0x4f43f9=_0x4ec8b2[_0xd92f('0xb8')];_0x42f8d9['forEach'](function(_0x878334){_0x5c55b7[_0xd92f('0x27')](updateMailInteraction(_0x878334,_0x5f3dc9,_0x58f8cd,_0x4f43f9));});return BPromise[_0xd92f('0xb9')](_0x5c55b7);});});});})[_0xd92f('0x1e')](function(_0x10b293){_0x2aacde[_0xd92f('0xba')]=_0x10b293;return _0x2aacde;})['then'](respondWithFilteredResult(_0x11c321,_0x19e949))['catch'](handleError(_0x11c321,null));};exports[_0xd92f('0xbb')]=function(_0xbe980,_0x25455a){var _0x276b7d={'raw':![],'where':{'id':_0xbe980['params']['id']}},_0x5d7992={};_0x5d7992['model']=_[_0xd92f('0x35')](db[_0xd92f('0x2f')][_0xd92f('0xbc')]);_0x5d7992[_0xd92f('0x34')]=_[_0xd92f('0x35')](_0xbe980[_0xd92f('0x34')]);_0x5d7992[_0xd92f('0x36')]=_['intersection'](_0x5d7992[_0xd92f('0x33')],_0x5d7992['query']);_0x276b7d[_0xd92f('0x39')]=_[_0xd92f('0x37')](_0x5d7992[_0xd92f('0x33')],qs[_0xd92f('0x38')](_0xbe980[_0xd92f('0x34')][_0xd92f('0x38')]));_0x276b7d['attributes']=_0x276b7d[_0xd92f('0x39')][_0xd92f('0x58')]?_0x276b7d[_0xd92f('0x39')]:_0x5d7992[_0xd92f('0x33')];if(_0xbe980[_0xd92f('0x34')][_0xd92f('0xbd')]){_0x276b7d[_0xd92f('0xbe')]=[{'all':!![]}];}_0x276b7d=_[_0xd92f('0x96')]({},_0x276b7d,_0xbe980[_0xd92f('0xbf')]);return db[_0xd92f('0x2f')][_0xd92f('0x59')](_0x276b7d)[_0xd92f('0x1e')](handleEntityNotFound(_0x25455a,null))['then'](respondWithResult(_0x25455a,null))[_0xd92f('0x2d')](handleError(_0x25455a,null));};exports[_0xd92f('0xc0')]=function(_0x57aacf,_0x46ebb3){return db['MailInteraction'][_0xd92f('0xc0')](_0x57aacf[_0xd92f('0xc1')],{})[_0xd92f('0x1e')](respondWithResult(_0x46ebb3,0xc9))[_0xd92f('0x2d')](handleError(_0x46ebb3,null));};exports[_0xd92f('0xc2')]=function(_0x492ca7,_0x5a47f0){if(_0x492ca7[_0xd92f('0xc1')]['id']){delete _0x492ca7[_0xd92f('0xc1')]['id'];}return db[_0xd92f('0x2f')][_0xd92f('0x59')]({'where':{'id':_0x492ca7[_0xd92f('0xc3')]['id']}})['then'](handleEntityNotFound(_0x5a47f0,null))[_0xd92f('0x1e')](saveUpdates(_0x492ca7[_0xd92f('0xc1')],null))['then'](respondWithResult(_0x5a47f0,null))[_0xd92f('0x2d')](handleError(_0x5a47f0,null));};exports['destroy']=function(_0x81e0b,_0x159e11){return db[_0xd92f('0x2f')][_0xd92f('0x59')]({'where':{'id':_0x81e0b['params']['id']}})[_0xd92f('0x1e')](handleEntityNotFound(_0x159e11,null))['then'](removeEntity(_0x159e11,null))[_0xd92f('0x2d')](handleError(_0x159e11,null));};exports['describe']=function(_0x38a92e,_0x4cc310){return db[_0xd92f('0x2f')][_0xd92f('0xc4')]()['then'](respondWithResult(_0x4cc310,null))['catch'](handleError(_0x4cc310,null));};exports[_0xd92f('0xc5')]=function(_0x513baa,_0x20829d){return db[_0xd92f('0x28')]['find']({'where':{'id':_0x513baa[_0xd92f('0xc3')]['id']}})['then'](handleEntityNotFound(_0x20829d,null))[_0xd92f('0x1e')](function(_0x359959){if(_0x359959){return _0x359959[_0xd92f('0xc5')](_0x513baa[_0xd92f('0xc1')][_0xd92f('0xc6')],_['omit'](_0x513baa[_0xd92f('0xc1')],[_0xd92f('0xc6'),'id'])||{});}})[_0xd92f('0x1e')](respondWithResult(_0x20829d,null))[_0xd92f('0x2d')](handleError(_0x20829d,null));};exports[_0xd92f('0xc7')]=function(_0x387200,_0x4344f9){var _0x268b10={'raw':![],'where':{}};var _0x32e760={};var _0x51a832={'count':0x0,'rows':[]};return db[_0xd92f('0x2f')][_0xd92f('0xb7')]({'where':{'id':_0x387200[_0xd92f('0xc3')]['id']}})[_0xd92f('0x1e')](handleEntityNotFound(_0x4344f9,null))['then'](function(_0xc5aa85){if(_0xc5aa85){_0x32e760[_0xd92f('0x33')]=_[_0xd92f('0x35')](db['MailMessage'][_0xd92f('0xbc')]);_0x32e760[_0xd92f('0x34')]=_['keys'](_0x387200['query']);_0x32e760[_0xd92f('0x36')]=_[_0xd92f('0x37')](_0x32e760[_0xd92f('0x33')],_0x32e760[_0xd92f('0x34')]);_0x268b10[_0xd92f('0x39')]=_[_0xd92f('0x37')](_0x32e760[_0xd92f('0x33')],qs[_0xd92f('0x38')](_0x387200[_0xd92f('0x34')][_0xd92f('0x38')]));_0x268b10[_0xd92f('0x39')]=_0x268b10[_0xd92f('0x39')][_0xd92f('0x58')]?_0x268b10[_0xd92f('0x39')]:_0x32e760[_0xd92f('0x33')];if(!_0x387200[_0xd92f('0x34')][_0xd92f('0xc8')](_0xd92f('0x3a'))){_0x268b10[_0xd92f('0x1b')]=qs[_0xd92f('0x1b')](_0x387200[_0xd92f('0x34')][_0xd92f('0x1b')]);_0x268b10['offset']=qs[_0xd92f('0x18')](_0x387200[_0xd92f('0x34')][_0xd92f('0x18')]);}_0x268b10[_0xd92f('0x3b')]=qs[_0xd92f('0x3c')](_0x387200[_0xd92f('0x34')][_0xd92f('0x3c')]);_0x268b10['where']=qs[_0xd92f('0x36')](_[_0xd92f('0x3e')](_0x387200[_0xd92f('0x34')],_0x32e760['filters']));_0x268b10[_0xd92f('0x3d')][_0xd92f('0xb5')]=_0xc5aa85['id'];if(_0x387200[_0xd92f('0x34')][_0xd92f('0x7b')]){_0x268b10[_0xd92f('0x3d')]=_[_0xd92f('0x96')](_0x268b10['where'],{'$or':_[_0xd92f('0x21')](_0x268b10[_0xd92f('0x39')],function(_0x32c7db){var _0x5b884d={};_0x5b884d[_0x32c7db]={'$like':'%'+_0x387200[_0xd92f('0x34')]['filter']+'%'};return _0x5b884d;})});}if(_0x387200['query'][_0xd92f('0xc9')]){var _0x2b08ac=_0x387200[_0xd92f('0x34')][_0xd92f('0xc9')][_0xd92f('0x25')](',');var _0x1b4780={};_0x1b4780[_0x2b08ac[0x0]]={'$gte':moment(_0x2b08ac[0x1])[_0xd92f('0xca')](_0xd92f('0xcb'))};_0x268b10[_0xd92f('0x3d')]=_['merge'](_0x268b10['where'],_0x1b4780);}_0x268b10=_[_0xd92f('0x96')]({},_0x268b10,_0x387200[_0xd92f('0xbf')]);return db['MailMessage']['count']({'where':_0x268b10[_0xd92f('0x3d')]})[_0xd92f('0x1e')](function(_0x9d3820){_0x51a832['count']=_0x9d3820;if(_0x387200[_0xd92f('0x34')][_0xd92f('0xbd')]){_0x268b10['include']=[{'all':!![]}];}return db[_0xd92f('0x28')][_0xd92f('0xcc')](_0x268b10);})[_0xd92f('0x1e')](function(_0x50cd9a){if(_0x387200['query'][_0xd92f('0xcd')]===_0xd92f('0xce')){for(var _0x966c76=0x0;_0x966c76<_0x50cd9a[_0xd92f('0x58')];_0x966c76++){_0x50cd9a[_0x966c76][_0xd92f('0xc1')]=juice(_0x50cd9a[_0x966c76][_0xd92f('0xc1')]);}}_0x51a832[_0xd92f('0xba')]=_0x50cd9a;return _0x51a832;});}})['then'](respondWithFilteredResult(_0x4344f9,_0x268b10))[_0xd92f('0x2d')](handleError(_0x4344f9,null));};exports[_0xd92f('0xcf')]=function(_0x21df7c,_0x3b47f4){return db[_0xd92f('0x2f')][_0xd92f('0x59')]({'where':{'id':_0x21df7c[_0xd92f('0xc3')]['id']}})[_0xd92f('0x1e')](handleEntityNotFound(_0x3b47f4,null))[_0xd92f('0x1e')](function(_0x426667){if(_0x426667){return _0x426667[_0xd92f('0xd0')](_0x21df7c[_0xd92f('0xc1')]['ids'],_[_0xd92f('0xd1')](_0x21df7c[_0xd92f('0xc1')],['ids','id'])||{})[_0xd92f('0xd2')](function(){return db[_0xd92f('0xd3')]['findAll']({'attributes':['id',_0xd92f('0x41'),_0xd92f('0x42')],'where':{'id':_0x21df7c['body'][_0xd92f('0xc6')]}});})[_0xd92f('0x1e')](function(_0x1ce1b7){socket['emit'](_0xd92f('0xd4'),{'id':Number(_0x21df7c['params']['id']),'tags':_0x1ce1b7||[]});return{'id':Number(_0x21df7c['params']['id']),'tags':_0x1ce1b7||[]};});}})[_0xd92f('0x1e')](respondWithResult(_0x3b47f4,null))[_0xd92f('0x2d')](handleError(_0x3b47f4,null));};exports[_0xd92f('0xd5')]=function(_0xc8e8f7,_0x50254d){return db[_0xd92f('0x2f')][_0xd92f('0x59')]({'where':{'id':_0xc8e8f7[_0xd92f('0xc3')]['id']}})[_0xd92f('0x1e')](handleEntityNotFound(_0x50254d,null))['then'](function(_0xaed05f){if(_0xaed05f){return _0xaed05f['removeTags'](_0xc8e8f7['query'][_0xd92f('0xc6')]);}})[_0xd92f('0x1e')](respondWithStatusCode(_0x50254d,null))['catch'](handleError(_0x50254d,null));};exports[_0xd92f('0xd6')]=function(_0x21167d,_0x54b429){var _0x139ee0=moment()[_0xd92f('0xd7')]()[_0xd92f('0x93')]();var _0x1e3480=path[_0xd92f('0xd8')](config[_0xd92f('0xd9')],_0xd92f('0xda'),'files',_0xd92f('0xdb'));var _0x2f08e9=path[_0xd92f('0xd8')](config[_0xd92f('0xd9')],_0xd92f('0xda'),'files','attachments');var _0x210ae6=path['join'](_0x1e3480,_0x139ee0);var _0x54128b=util['format'](_0xd92f('0xdc'),_0x21167d[_0xd92f('0xc3')]['id'],_0x139ee0);var _0x1ef21b=path['join'](_0x1e3480,_0x54128b);var _0x709330=[];if(_0x21167d[_0xd92f('0x34')]['attachments']){_0x709330[_0xd92f('0x27')]({'model':db[_0xd92f('0xdd')],'as':_0xd92f('0xde'),'raw':!![]});}var _0x4e49c0=[{'model':db[_0xd92f('0x28')],'as':'Messages','attributes':['id',_0xd92f('0xc1'),_0xd92f('0x43'),'to','cc','bcc',_0xd92f('0xdf'),_0xd92f('0x6f')],'where':{'secret':![]},'order':qs[_0xd92f('0x3c')]('id'),'include':_0x709330}];return db[_0xd92f('0x2f')][_0xd92f('0x59')]({'where':{'id':_0x21167d[_0xd92f('0xc3')]['id']},'include':_0x4e49c0})[_0xd92f('0x1e')](handleEntityNotFound(_0x54b429,null))[_0xd92f('0x1e')](function(_0x155f6d){if(_0x155f6d&&_0x155f6d[_0xd92f('0xe0')]){var _0x3f2d87=_0x155f6d['get']({'plain':!![]});fs[_0xd92f('0xe1')](_0x210ae6);return BPromise['each'](_0x3f2d87[_0xd92f('0xe0')],function(_0x41f54a,_0x1bbf30){var _0x1538dc={'from':_0x41f54a[_0xd92f('0x43')],'to':_0x41f54a['to'],'subject':_0x41f54a[_0xd92f('0xdf')],'html':htmlEntities[_0xd92f('0xe2')](_0x41f54a[_0xd92f('0xc1')]),'headers':{'Date':moment(_0x41f54a['createdAt'])[_0xd92f('0xca')](_0xd92f('0xe3'))},'attachments':[]};if(_0x41f54a['cc']){_0x1538dc[_0xd92f('0xe4')]['Cc']=_0x41f54a['cc'];}if(_0x41f54a[_0xd92f('0xe5')]){_0x1538dc['headers'][_0xd92f('0xe6')]=_0x41f54a[_0xd92f('0xe5')];}return new BPromise(function(_0x309913,_0x80c06){if(_0x41f54a['Attachments']){for(var _0x32c3e3=0x0;_0x32c3e3<_0x41f54a[_0xd92f('0xde')][_0xd92f('0x58')];_0x32c3e3++){var _0x1ee63c=_0x41f54a[_0xd92f('0xde')][_0x32c3e3];var _0x4502f0=path['join'](_0x2f08e9,_0x1ee63c[_0xd92f('0xe7')]);if(fs['existsSync'](_0x4502f0)){_0x1538dc[_0xd92f('0xe8')][_0xd92f('0x27')]({'name':_0x1ee63c['name'],'contentType':_0x1ee63c[_0xd92f('0x31')],'data':fs[_0xd92f('0xe9')](_0x4502f0)});}}}emlformat[_0xd92f('0xea')](_0x1538dc,function(_0x4cfd99,_0x2b0d10){if(_0x4cfd99)return _0x80c06(_0x4cfd99);fs[_0xd92f('0xeb')](path[_0xd92f('0xd8')](_0x210ae6,util['format'](_0xd92f('0xec'),_0x1bbf30)),_0x2b0d10);return _0x309913(_0x2b0d10);});});})[_0xd92f('0x1e')](function(){return new BPromise(function(_0x28af7c,_0x1d9d05){zipdir(_0x210ae6,{'saveTo':_0x1ef21b},function(_0x9bbc6d,_0x2d0977){if(_0x9bbc6d)return _0x1d9d05(_0x9bbc6d);return _0x28af7c(_0x2d0977);});})[_0xd92f('0x1e')](function(){return new BPromise(function(_0x3a8cb4,_0x2b60ad){rimraf(_0x210ae6,function(_0x245f82){if(_0x245f82)_0x2b60ad(_0x245f82);return _0x3a8cb4();});});})[_0xd92f('0x1e')](function(){return _0x54b429[_0xd92f('0xd6')](_0x1ef21b,_0x54128b,function(_0x48303f){if(!_0x48303f)fs[_0xd92f('0xed')](_0x1ef21b);});});});}else{return _0x54b429[_0xd92f('0x14')](0xc8);}})[_0xd92f('0x2d')](handleError(_0x54b429,null));}; \ No newline at end of file +var _0xf09c=['include','merge','options','create','body','describe','addMessage','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','rows','addTags','emit','removeTags','download','server','files','tmp','join','attachments','Attachment','Attachments','Messages','bcc','get','mkdirSync','each','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','build','writeFileSync','unlinkSync','sendStatus','eml-format','rimraf','zip-dir','moment','bluebird','path','lodash','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','status','offset','undefined','limit','count','set','Content-Range','json','destroy','then','end','send','Users','map','fullname','TagIds','split','forEach','Tags','MailMessage','findOne','plainBody','lastMsgText','trimStart','catch','index','MailInteraction','fieldName','type','key','model','filters','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','field','name','color','from','tools_tags','select','u.id','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','expr','parseSearch','search','conditions','find','value','having','`\x20=\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','Tag','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','start','keys','some','compact','MailAccountId','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','getMailAccounts','isEmpty','i.MailAccountId\x20IS\x20NULL','agent','sequelize','toString','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.disposition','i.secondDisposition','i.to','i.ContactId','i.MailAccountId','c.firstName','Contact.firstName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','MailInteractionId','Setting','push','all','show','params','rawAttributes','intersection','includeAll'];(function(_0x541591,_0x19a1d0){var _0x331ed4=function(_0x48de09){while(--_0x48de09){_0x541591['push'](_0x541591['shift']());}};_0x331ed4(++_0x19a1d0);}(_0xf09c,0x1eb));var _0xcf09=function(_0x6fbe19,_0x48167b){_0x6fbe19=_0x6fbe19-0x0;var _0x44db72=_0xf09c[_0x6fbe19];return _0x44db72;};'use strict';var emlformat=require(_0xcf09('0x0'));var rimraf=require(_0xcf09('0x1'));var zipdir=require(_0xcf09('0x2'));var moment=require(_0xcf09('0x3'));var BPromise=require(_0xcf09('0x4'));var util=require('util');var path=require(_0xcf09('0x5'));var fs=require('fs');var _=require(_0xcf09('0x6'));var squel=require('squel');var juice=require('juice');var Redis=require(_0xcf09('0x7'));var qs=require(_0xcf09('0x8'));var as=require(_0xcf09('0x9'));var logger=require(_0xcf09('0xa'))('api');var config=require(_0xcf09('0xb'));var db=require(_0xcf09('0xc'))['db'];var htmlEntities=require('html-entities');config[_0xcf09('0xd')]=_[_0xcf09('0xe')](config[_0xcf09('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xcf09('0xf'))(new Redis(config['redis']));require(_0xcf09('0x10'))[_0xcf09('0x11')](socket);function respondWithStatusCode(_0x595cea,_0x185079){_0x185079=_0x185079||0xcc;return function(_0x48aec6){if(_0x48aec6){return _0x595cea['sendStatus'](_0x185079);}return _0x595cea[_0xcf09('0x12')](_0x185079)['end']();};}function respondWithResult(_0x3d6547,_0x2d96cf){_0x2d96cf=_0x2d96cf||0xc8;return function(_0x4790f2){if(_0x4790f2){return _0x3d6547[_0xcf09('0x12')](_0x2d96cf)['json'](_0x4790f2);}};}function respondWithFilteredResult(_0x46e3b9,_0x708142){return function(_0x448ec4){if(_0x448ec4){var _0x2053b4=typeof _0x708142[_0xcf09('0x13')]===_0xcf09('0x14')&&typeof _0x708142[_0xcf09('0x15')]===_0xcf09('0x14');var _0x247101=_0x448ec4[_0xcf09('0x16')];var _0x4c798c=_0x2053b4?0x0:_0x708142[_0xcf09('0x13')];var _0x291377=_0x2053b4?_0x448ec4[_0xcf09('0x16')]:_0x708142[_0xcf09('0x13')]+_0x708142['limit'];var _0x8812e6;if(_0x291377>=_0x247101){_0x291377=_0x247101;_0x8812e6=0xc8;}else{_0x8812e6=0xce;}_0x46e3b9[_0xcf09('0x12')](_0x8812e6);return _0x46e3b9[_0xcf09('0x17')](_0xcf09('0x18'),_0x4c798c+'-'+_0x291377+'/'+_0x247101)[_0xcf09('0x19')](_0x448ec4);}return null;};}function saveUpdates(_0x4b5bfa){return function(_0x1a8dbf){if(_0x1a8dbf){return _0x1a8dbf['update'](_0x4b5bfa)['then'](function(_0x18997a){return _0x18997a;});}return null;};}function removeEntity(_0xd754ba){return function(_0x1bae0e){if(_0x1bae0e){return _0x1bae0e[_0xcf09('0x1a')]()[_0xcf09('0x1b')](function(){_0xd754ba['status'](0xcc)[_0xcf09('0x1c')]();});}};}function handleEntityNotFound(_0x2a7d79){return function(_0x450312){if(!_0x450312){_0x2a7d79['sendStatus'](0x194);}return _0x450312;};}function handleError(_0x960845,_0x2364f7){_0x2364f7=_0x2364f7||0x1f4;return function(_0x52edff){logger['error'](_0x52edff['stack']);if(_0x52edff['name']){delete _0x52edff['name'];}_0x960845[_0xcf09('0x12')](_0x2364f7)[_0xcf09('0x1d')](_0x52edff);};}function getInteractionUsers(_0x54ac27,_0x2de35f){return new BPromise(function(_0x48d1b4,_0x41cc6e){try{if(_0x2de35f[_0x54ac27['id']]){_0x54ac27[_0xcf09('0x1e')]=_[_0xcf09('0x1f')](_0x2de35f[_0x54ac27['id']],function(_0x3dded8){return{'id':_0x3dded8['id'],'fullname':_0x3dded8[_0xcf09('0x20')]};});}}catch(_0xad7bce){_0x41cc6e(_0xad7bce);}_0x48d1b4(_0x54ac27);});}function getInteractionTags(_0x5482cf,_0x2d0ce5){return new BPromise(function(_0xa1e43,_0x5b9390){try{if(_0x5482cf[_0xcf09('0x21')]){_0x5482cf['Tags']=[];_0x5482cf[_0xcf09('0x21')][_0xcf09('0x22')](',')[_0xcf09('0x23')](function(_0x3dff56){_0x5482cf[_0xcf09('0x24')]['push'](_0x2d0ce5[_0x3dff56]);});}delete _0x5482cf[_0xcf09('0x21')];}catch(_0x326e39){_0x5b9390(_0x326e39);}_0xa1e43(_0x5482cf);});}function getLastMessageText(_0x3a0fba){return new BPromise(function(_0x48fd15,_0x43a1a3){return db[_0xcf09('0x25')][_0xcf09('0x26')]({'where':{'$and':[{'MailInteractionId':_0x3a0fba['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xcf09('0x27')],'order':'-id','raw':!![]})['then'](function(_0x48cb22){if(_0x48cb22&&_0x48cb22['plainBody']){_0x3a0fba[_0xcf09('0x28')]=_[_0xcf09('0x29')](_0x48cb22[_0xcf09('0x27')]);}_0x48fd15(_0x3a0fba);})[_0xcf09('0x2a')](function(_0x43d1f1){_0x43a1a3(_0x43d1f1);});});}function updateMailInteraction(_0x3ee8ef,_0x442a2d,_0x5daa9d,_0x1ad97){return new BPromise(function(_0x407635,_0x362926){return getInteractionUsers(_0x3ee8ef,_0x5daa9d)['then'](function(_0xf5daac){return getInteractionTags(_0xf5daac,_0x442a2d);})[_0xcf09('0x1b')](function(_0xd1a5d3){if(_0x1ad97){_0x407635(getLastMessageText(_0xd1a5d3));}else{_0x407635(_0xd1a5d3);}})[_0xcf09('0x2a')](function(_0x3af044){_0x362926(_0x3af044);});});}exports[_0xcf09('0x2b')]=function(_0x1bb602,_0x47a09d){var _0x147024={},_0x486cdb={},_0x347c20={'count':0x0,'rows':[]};var _0x415b4f=_[_0xcf09('0x1f')](db[_0xcf09('0x2c')]['rawAttributes'],function(_0x3ae683){return{'name':_0x3ae683[_0xcf09('0x2d')],'type':_0x3ae683[_0xcf09('0x2e')][_0xcf09('0x2f')]};});_0x486cdb[_0xcf09('0x30')]=_['map'](_0x415b4f,'name');_0x486cdb['query']=_['keys'](_0x1bb602['query']);_0x486cdb[_0xcf09('0x31')]=_['intersection'](_0x486cdb['model'],_0x486cdb[_0xcf09('0x32')]);_0x147024[_0xcf09('0x33')]=_['intersection'](_0x486cdb[_0xcf09('0x30')],qs[_0xcf09('0x34')](_0x1bb602[_0xcf09('0x32')][_0xcf09('0x34')]));_0x147024[_0xcf09('0x33')]=_0x147024['attributes'][_0xcf09('0x35')]?_0x147024[_0xcf09('0x33')]:_0x486cdb[_0xcf09('0x30')];if(!_0x1bb602[_0xcf09('0x32')][_0xcf09('0x36')](_0xcf09('0x37'))){_0x147024[_0xcf09('0x15')]=qs[_0xcf09('0x15')](_0x1bb602['query'][_0xcf09('0x15')]);_0x147024[_0xcf09('0x13')]=qs[_0xcf09('0x13')](_0x1bb602[_0xcf09('0x32')][_0xcf09('0x13')]);}_0x147024[_0xcf09('0x38')]=qs['sort'](_0x1bb602[_0xcf09('0x32')][_0xcf09('0x39')]);_0x147024['where']=qs[_0xcf09('0x31')](_[_0xcf09('0x3a')](_0x1bb602[_0xcf09('0x32')],_0x486cdb[_0xcf09('0x31')]),_0x415b4f);var _0x1ba709=[];var _0x21aa5e=squel['select']()[_0xcf09('0x3b')]('id')[_0xcf09('0x3b')](_0xcf09('0x3c'))[_0xcf09('0x3b')](_0xcf09('0x3d'))[_0xcf09('0x3e')](_0xcf09('0x3f'));var _0xf8ae5c=squel[_0xcf09('0x40')]()[_0xcf09('0x3b')](_0xcf09('0x41'))[_0xcf09('0x3b')]('u.fullname')['field'](_0xcf09('0x42'))[_0xcf09('0x3e')](_0xcf09('0x43'),'ui')[_0xcf09('0x44')](_0xcf09('0x45'),'u',_0xcf09('0x46'));var _0x427106=squel[_0xcf09('0x40')]()[_0xcf09('0x3e')](_0xcf09('0x47'),'i')[_0xcf09('0x44')](_0xcf09('0x48'),'c',_0xcf09('0x49'))[_0xcf09('0x44')](_0xcf09('0x45'),'o',_0xcf09('0x4a'))[_0xcf09('0x44')](_0xcf09('0x4b'),'a',_0xcf09('0x4c'))[_0xcf09('0x44')](_0xcf09('0x4d'),'me',_0xcf09('0x4e'))['left_join'](_0xcf09('0x4f'),'it','it.MailInteractionId\x20=\x20i.id')[_0xcf09('0x44')](_0xcf09('0x3f'),'t','t.id\x20=\x20it.TagId');var _0x267518=squel[_0xcf09('0x50')]();var _0x3e5a5d=[];var _0x48e47e=squel[_0xcf09('0x50')]();var _0x9597e3;if(_0x1bb602[_0xcf09('0x32')]['search']){_0x9597e3=as[_0xcf09('0x51')](_0x1bb602[_0xcf09('0x32')][_0xcf09('0x52')]);var _0x204676=_0x9597e3['sqlOperator'];for(var _0x247e79=0x0;_0x247e79<_0x9597e3[_0xcf09('0x53')][_0xcf09('0x35')];_0x247e79++){var _0x3ef42d=_0x9597e3[_0xcf09('0x53')][_0x247e79];var _0x3a6d97='i';var _0x2e859f=_[_0xcf09('0x54')](_0x415b4f,[_0xcf09('0x3c'),_0x3ef42d[_0xcf09('0x3b')]]);if(!_0x2e859f){switch(_0x3ef42d[_0xcf09('0x3b')]){case'unreadMessages':if(_0x3ef42d[_0xcf09('0x55')]==0x1){_0x427106[_0xcf09('0x56')]('`'+_0x3ef42d[_0xcf09('0x3b')]+_0xcf09('0x57'));}else{_0x427106[_0xcf09('0x56')]('`'+_0x3ef42d[_0xcf09('0x3b')]+'`\x20>\x200');}break;case _0xcf09('0x58'):if(_0x3ef42d[_0xcf09('0x59')]==='$substring'){if(_0x3ef42d[_0xcf09('0x55')][_0xcf09('0x22')]('\x20')[_0xcf09('0x35')]>0x1){_0x267518[_0x204676](_0xcf09('0x5a'),qs[_0xcf09('0x5b')](_0x3ef42d[_0xcf09('0x55')]),null);}else{var _0x3a2340='%'+_0x3ef42d[_0xcf09('0x55')]+'%';_0x267518[_0x204676](_0xcf09('0x5c'),_0x3a2340,_0x3a2340,_0x3a2340);}}else{_0x2e859f=_[_0xcf09('0x54')](_0x415b4f,[_0xcf09('0x3c'),_0xcf09('0x5d')]);_0x3ef42d[_0xcf09('0x3b')]=_0xcf09('0x5d');_0x468641=as[_0xcf09('0x5e')](_0x3a6d97,_0x2e859f['type'],_0x3ef42d);_0x267518[_0x204676](_0x468641['text'],_0x468641[_0xcf09('0x55')]['start'],_0x468641[_0xcf09('0x55')][_0xcf09('0x1c')]);}break;case _0xcf09('0x5f'):var _0x59b5ef=_0x3ef42d['value']['split'](',')[_0xcf09('0x1f')](function(_0x363038){return Number(_0x363038);});_0x59b5ef[_0xcf09('0x23')](function(_0x2b000b){_0x48e47e['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2b000b+',%');});_0x3e5a5d=_['union'](_0x3e5a5d,_0x59b5ef);break;case _0xcf09('0x60'):if(_0x3ef42d[_0xcf09('0x59')]==='$substring'){_0x267518[_0x204676](_0xcf09('0x61'),'%'+_0x3ef42d['value']+'%',null);}else{_0x2e859f=_[_0xcf09('0x54')](_0x415b4f,[_0xcf09('0x3c'),_0xcf09('0x62')]);_0x3ef42d[_0xcf09('0x3b')]=_0xcf09('0x62');_0x468641=as[_0xcf09('0x5e')](_0x3a6d97,_0x2e859f[_0xcf09('0x2e')],_0x3ef42d);_0x267518[_0x204676](_0x468641['text'],_0x468641[_0xcf09('0x55')]['start'],_0x468641[_0xcf09('0x55')]['end']);}break;case _0xcf09('0x27'):_0x468641=as['buildExpression']('me',null,_0x3ef42d);_0x267518[_0x204676](_0x468641[_0xcf09('0x63')],_0x468641[_0xcf09('0x55')][_0xcf09('0x64')],_0x468641[_0xcf09('0x55')]['end']);break;}}else{var _0x468641=as[_0xcf09('0x5e')](_0x3a6d97,_0x2e859f[_0xcf09('0x2e')],_0x3ef42d);_0x267518[_0x204676](_0x468641[_0xcf09('0x63')],_0x468641[_0xcf09('0x55')][_0xcf09('0x64')],_0x468641[_0xcf09('0x55')][_0xcf09('0x1c')]);}}}else{var _0x466128=_(_0x1bb602['query'])[_0xcf09('0x65')]()['map'](function(_0x5c94bc){return _[_0xcf09('0x66')](_0x415b4f,[_0xcf09('0x3c'),_0x5c94bc])?_0x5c94bc:undefined;})[_0xcf09('0x67')]()[_0xcf09('0x55')]();if(!_['isEmpty'](_0x466128)){_0x466128['forEach'](function(_0x1b0b50){if(_0x1b0b50===_0xcf09('0x68')){_0x427106[_0xcf09('0x69')](_0xcf09('0x6a'),[][_0xcf09('0x6b')](_0x1bb602[_0xcf09('0x32')][_0x1b0b50]));}else if(_0x1b0b50===_0xcf09('0x6c')){var _0x1e737c=JSON[_0xcf09('0x6d')](_0x1bb602[_0xcf09('0x32')][_0x1b0b50])[_0xcf09('0x6e')];var _0x35258f=JSON[_0xcf09('0x6d')](_0x1bb602['query'][_0x1b0b50])[_0xcf09('0x6f')];_0x427106['where'](_0xcf09('0x70'),_0x1e737c,_0x35258f);}else{if(_0x1bb602[_0xcf09('0x32')][_0x1b0b50]===_0xcf09('0x71')){_0x427106[_0xcf09('0x69')]('i.'+_0x1b0b50+_0xcf09('0x72'));}else{_0x427106[_0xcf09('0x69')]('i.'+_0x1b0b50+_0xcf09('0x73'),_0x1bb602[_0xcf09('0x32')][_0x1b0b50]);}}});}if(_0x1bb602[_0xcf09('0x32')][_0xcf09('0x74')]){if(_0x1bb602[_0xcf09('0x32')][_0xcf09('0x74')]==0x1){_0x427106[_0xcf09('0x56')](_0xcf09('0x75'));}else{_0x427106[_0xcf09('0x56')]('`unreadMessages`\x20>\x200');}}if(_0x1bb602[_0xcf09('0x32')][_0xcf09('0x76')]){_0x3e5a5d=_['isArray'](_0x1bb602[_0xcf09('0x32')][_0xcf09('0x76')])?_0x1bb602['query']['tag']:new Array(_0x1bb602['query'][_0xcf09('0x76')]);_0x3e5a5d[_0xcf09('0x23')](function(_0x51c885){_0x48e47e['or'](_0xcf09('0x77'),'%,'+_0x51c885+',%');});}if(_0x1bb602['query']['filter']){var _0x33ddf9=_0x1bb602[_0xcf09('0x32')][_0xcf09('0x78')]['replace']('\x5c','\x5c\x5c')[_0xcf09('0x79')](/'/g,'\x27\x27');if(qs[_0xcf09('0x7a')](_0x33ddf9)){_0x267518['or'](_0xcf09('0x7b'),_0x33ddf9+'%');}else if(qs['isEmail'](_0x33ddf9)){_0x267518['or'](_0xcf09('0x7c'),_0x33ddf9+'%');}else{_0x267518['or'](_0xcf09('0x7d'),qs['getFullTextValue'](_0x33ddf9))['or'](_0xcf09('0x7e'),qs['getFullTextValue'](_0x33ddf9));}}}_0x427106[_0xcf09('0x69')](_0x267518);_0x427106[_0xcf09('0x7f')](_0xcf09('0x80'));var _0x1ce537={'type':db[_0xcf09('0x81')]['QueryTypes']['SELECT'],'raw':!![]};var _0x516794=_0x427106[_0xcf09('0x82')]();_0x516794['field'](_0xcf09('0x80'));_0x516794[_0xcf09('0x3b')](_0xcf09('0x83'),'unreadMessages');if(_0x147024['order']){_0x147024[_0xcf09('0x38')][_0xcf09('0x23')](function(_0xa989c2){var _0x4fc56b=_0xa989c2[0x0]==='contactName'?_0xa989c2[0x0]:'i.'+_0xa989c2[0x0];_0x427106[_0xcf09('0x38')](_0x4fc56b,_0xa989c2[0x1]===_0xcf09('0x84')?![]:!![]);});}if(!_['isEmpty'](_0x3e5a5d)){_0x427106[_0xcf09('0x56')](_0x48e47e);_0x516794['where'](_0xcf09('0x85'),_0x3e5a5d);}BPromise[_0xcf09('0x86')]()['then'](function(){if(!_0x9597e3){if(_0x1bb602['query'][_0xcf09('0x68')])return;_0x516794[_0xcf09('0x69')](_0xcf09('0x87'));_0x427106['where'](_0xcf09('0x87'));return;}if(_0x1bb602[_0xcf09('0x88')][_0xcf09('0x89')]!=='agent')return;return _0x1bb602[_0xcf09('0x88')][_0xcf09('0x8a')]({'attributes':['id'],'raw':!![]})[_0xcf09('0x1b')](function(_0x4d2965){if(_[_0xcf09('0x8b')](_0x4d2965)){_0x516794[_0xcf09('0x69')](_0xcf09('0x8c'));_0x427106[_0xcf09('0x69')](_0xcf09('0x8c'));}else{_0x516794[_0xcf09('0x69')](_0xcf09('0x6a'),_[_0xcf09('0x1f')](_0x4d2965,'id'));_0x427106[_0xcf09('0x69')](_0xcf09('0x6a'),_[_0xcf09('0x1f')](_0x4d2965,'id'));}});})[_0xcf09('0x1b')](function(){if(_0x1bb602[_0xcf09('0x88')][_0xcf09('0x89')]===_0xcf09('0x8d')&&!_0x9597e3&&!_0x1bb602['query'][_0xcf09('0x68')])return[];return db[_0xcf09('0x8e')][_0xcf09('0x32')](_0x516794['toString'](),_0x1ce537);})[_0xcf09('0x1b')](function(_0x2a732f){_0x347c20[_0xcf09('0x16')]=_0x2a732f['length'];if(_0x347c20[_0xcf09('0x16')]===0x0)return[];return db[_0xcf09('0x8e')][_0xcf09('0x32')](_0x21aa5e[_0xcf09('0x8f')](),_0x1ce537)[_0xcf09('0x1b')](function(_0x371a5c){_0x1ba709=_['keyBy'](_0x371a5c,'id');_0x1ce537=_['merge'](_0x1ce537,{'model':db[_0xcf09('0x2c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1bb602[_0xcf09('0x32')][_0xcf09('0x34')]){_0x147024[_0xcf09('0x33')][_0xcf09('0x23')](function(_0x5a256a){_0x427106[_0xcf09('0x3b')]('i.'+_0x5a256a);});}else{_0x427106['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x427106['field'](_0xcf09('0x90'),_0xcf09('0x91'));_0x427106['field'](_0xcf09('0x92'),_0xcf09('0x93'));_0x427106['field'](_0xcf09('0x94'),_0xcf09('0x95'));_0x427106[_0xcf09('0x3b')](_0xcf09('0x80'));_0x427106['field'](_0xcf09('0x96'));_0x427106['field']('i.updatedAt');_0x427106[_0xcf09('0x3b')](_0xcf09('0x97'));_0x427106[_0xcf09('0x3b')](_0xcf09('0x98'));_0x427106[_0xcf09('0x3b')]('i.attach');_0x427106[_0xcf09('0x3b')](_0xcf09('0x99'));_0x427106[_0xcf09('0x3b')](_0xcf09('0x9a'));_0x427106[_0xcf09('0x3b')]('i.subject');_0x427106[_0xcf09('0x3b')](_0xcf09('0x9b'));_0x427106[_0xcf09('0x3b')](_0xcf09('0x9c'));_0x427106[_0xcf09('0x3b')]('i.thirdDisposition');_0x427106[_0xcf09('0x3b')]('i.substatus');_0x427106[_0xcf09('0x3b')](_0xcf09('0x9d'));_0x427106[_0xcf09('0x3b')](_0xcf09('0x9e'));_0x427106[_0xcf09('0x3b')](_0xcf09('0x9f'));_0x427106[_0xcf09('0x3b')]('i.UserId');_0x427106[_0xcf09('0x3b')](_0xcf09('0xa0'),_0xcf09('0xa1'));_0x427106['field']('c.lastName','Contact.lastName');_0x427106[_0xcf09('0x3b')](_0xcf09('0xa2'),_0xcf09('0xa3'));_0x427106[_0xcf09('0x3b')](_0xcf09('0xa4'),_0xcf09('0xa5'));_0x427106[_0xcf09('0x3b')]('c.mobile',_0xcf09('0xa6'));_0x427106['field'](_0xcf09('0xa7'),_0xcf09('0xa8'));_0x427106[_0xcf09('0x3b')](_0xcf09('0xa9'),_0xcf09('0xaa'));_0x427106[_0xcf09('0x3b')](_0xcf09('0xab'),_0xcf09('0xac'));_0x427106['field'](_0xcf09('0xad'),'TagIds');}if(_0x147024[_0xcf09('0x15')])_0x427106[_0xcf09('0x15')](_0x147024['limit']);if(_0x147024[_0xcf09('0x13')])_0x427106[_0xcf09('0x13')](_0x147024[_0xcf09('0x13')]);return db[_0xcf09('0x8e')][_0xcf09('0x32')](_0x427106[_0xcf09('0x8f')](),_0x1ce537);})[_0xcf09('0x1b')](function(_0x3eda21){if(_0x3eda21[_0xcf09('0x35')]>0x0)_0xf8ae5c[_0xcf09('0x69')]('ui.MailInteractionId\x20IN\x20?',_['map'](_0x3eda21,'id'));return db[_0xcf09('0x8e')][_0xcf09('0x32')](_0xf8ae5c[_0xcf09('0x8f')](),_0x1ce537)['then'](function(_0x96c1){var _0x17a606=_[_0xcf09('0xae')](_0x96c1,_0xcf09('0xaf'));var _0x3071a2=[];return db[_0xcf09('0xb0')][_0xcf09('0x26')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0xcf09('0x1b')](function(_0x245636){var _0x1aa12b=_0x245636['enableEmailPreview'];_0x3eda21[_0xcf09('0x23')](function(_0x320971){_0x3071a2[_0xcf09('0xb1')](updateMailInteraction(_0x320971,_0x1ba709,_0x17a606,_0x1aa12b));});return BPromise[_0xcf09('0xb2')](_0x3071a2);});});});})[_0xcf09('0x1b')](function(_0x6d28f8){_0x347c20['rows']=_0x6d28f8;return _0x347c20;})[_0xcf09('0x1b')](respondWithFilteredResult(_0x47a09d,_0x147024))['catch'](handleError(_0x47a09d,null));};exports[_0xcf09('0xb3')]=function(_0x29937e,_0x1e05a9){var _0x54beda={'raw':![],'where':{'id':_0x29937e[_0xcf09('0xb4')]['id']}},_0x529a6a={};_0x529a6a['model']=_[_0xcf09('0x65')](db[_0xcf09('0x2c')][_0xcf09('0xb5')]);_0x529a6a[_0xcf09('0x32')]=_[_0xcf09('0x65')](_0x29937e['query']);_0x529a6a[_0xcf09('0x31')]=_[_0xcf09('0xb6')](_0x529a6a['model'],_0x529a6a[_0xcf09('0x32')]);_0x54beda[_0xcf09('0x33')]=_[_0xcf09('0xb6')](_0x529a6a[_0xcf09('0x30')],qs['fields'](_0x29937e[_0xcf09('0x32')][_0xcf09('0x34')]));_0x54beda['attributes']=_0x54beda[_0xcf09('0x33')][_0xcf09('0x35')]?_0x54beda[_0xcf09('0x33')]:_0x529a6a[_0xcf09('0x30')];if(_0x29937e[_0xcf09('0x32')][_0xcf09('0xb7')]){_0x54beda[_0xcf09('0xb8')]=[{'all':!![]}];}_0x54beda=_[_0xcf09('0xb9')]({},_0x54beda,_0x29937e[_0xcf09('0xba')]);return db['MailInteraction']['find'](_0x54beda)[_0xcf09('0x1b')](handleEntityNotFound(_0x1e05a9,null))[_0xcf09('0x1b')](respondWithResult(_0x1e05a9,null))[_0xcf09('0x2a')](handleError(_0x1e05a9,null));};exports[_0xcf09('0xbb')]=function(_0x150ade,_0x20b9a5){return db[_0xcf09('0x2c')][_0xcf09('0xbb')](_0x150ade[_0xcf09('0xbc')],{})[_0xcf09('0x1b')](respondWithResult(_0x20b9a5,0xc9))['catch'](handleError(_0x20b9a5,null));};exports['update']=function(_0x41a409,_0x237c95){if(_0x41a409[_0xcf09('0xbc')]['id']){delete _0x41a409[_0xcf09('0xbc')]['id'];}return db[_0xcf09('0x2c')][_0xcf09('0x54')]({'where':{'id':_0x41a409[_0xcf09('0xb4')]['id']}})[_0xcf09('0x1b')](handleEntityNotFound(_0x237c95,null))[_0xcf09('0x1b')](saveUpdates(_0x41a409['body'],null))[_0xcf09('0x1b')](respondWithResult(_0x237c95,null))['catch'](handleError(_0x237c95,null));};exports[_0xcf09('0x1a')]=function(_0x47422a,_0x5748){return db[_0xcf09('0x2c')][_0xcf09('0x54')]({'where':{'id':_0x47422a[_0xcf09('0xb4')]['id']}})[_0xcf09('0x1b')](handleEntityNotFound(_0x5748,null))[_0xcf09('0x1b')](removeEntity(_0x5748,null))[_0xcf09('0x2a')](handleError(_0x5748,null));};exports[_0xcf09('0xbd')]=function(_0x2644e0,_0x702424){return db[_0xcf09('0x2c')][_0xcf09('0xbd')]()[_0xcf09('0x1b')](respondWithResult(_0x702424,null))[_0xcf09('0x2a')](handleError(_0x702424,null));};exports[_0xcf09('0xbe')]=function(_0x83729b,_0x1c316a){return db[_0xcf09('0x25')][_0xcf09('0x54')]({'where':{'id':_0x83729b[_0xcf09('0xb4')]['id']}})['then'](handleEntityNotFound(_0x1c316a,null))[_0xcf09('0x1b')](function(_0x56bb04){if(_0x56bb04){return _0x56bb04[_0xcf09('0xbe')](_0x83729b[_0xcf09('0xbc')][_0xcf09('0xbf')],_[_0xcf09('0xc0')](_0x83729b[_0xcf09('0xbc')],[_0xcf09('0xbf'),'id'])||{});}})[_0xcf09('0x1b')](respondWithResult(_0x1c316a,null))[_0xcf09('0x2a')](handleError(_0x1c316a,null));};exports[_0xcf09('0xc1')]=function(_0x114481,_0xfbb6cf){var _0x5ba2fa={'raw':![],'where':{}};var _0x2a5269={};var _0x7025ea={'count':0x0,'rows':[]};return db[_0xcf09('0x2c')][_0xcf09('0x26')]({'where':{'id':_0x114481[_0xcf09('0xb4')]['id']}})[_0xcf09('0x1b')](handleEntityNotFound(_0xfbb6cf,null))[_0xcf09('0x1b')](function(_0x5639f6){if(_0x5639f6){_0x2a5269[_0xcf09('0x30')]=_[_0xcf09('0x65')](db['MailMessage']['rawAttributes']);_0x2a5269[_0xcf09('0x32')]=_['keys'](_0x114481[_0xcf09('0x32')]);_0x2a5269[_0xcf09('0x31')]=_[_0xcf09('0xb6')](_0x2a5269['model'],_0x2a5269['query']);_0x5ba2fa[_0xcf09('0x33')]=_[_0xcf09('0xb6')](_0x2a5269['model'],qs['fields'](_0x114481[_0xcf09('0x32')][_0xcf09('0x34')]));_0x5ba2fa[_0xcf09('0x33')]=_0x5ba2fa[_0xcf09('0x33')][_0xcf09('0x35')]?_0x5ba2fa[_0xcf09('0x33')]:_0x2a5269['model'];if(!_0x114481[_0xcf09('0x32')][_0xcf09('0x36')]('nolimit')){_0x5ba2fa[_0xcf09('0x15')]=qs[_0xcf09('0x15')](_0x114481['query'][_0xcf09('0x15')]);_0x5ba2fa[_0xcf09('0x13')]=qs[_0xcf09('0x13')](_0x114481[_0xcf09('0x32')][_0xcf09('0x13')]);}_0x5ba2fa[_0xcf09('0x38')]=qs[_0xcf09('0x39')](_0x114481[_0xcf09('0x32')][_0xcf09('0x39')]);_0x5ba2fa['where']=qs[_0xcf09('0x31')](_['pick'](_0x114481['query'],_0x2a5269[_0xcf09('0x31')]));_0x5ba2fa[_0xcf09('0x69')][_0xcf09('0xaf')]=_0x5639f6['id'];if(_0x114481[_0xcf09('0x32')][_0xcf09('0x78')]){_0x5ba2fa[_0xcf09('0x69')]=_[_0xcf09('0xb9')](_0x5ba2fa[_0xcf09('0x69')],{'$or':_['map'](_0x5ba2fa['attributes'],function(_0x52a856){var _0x171c8c={};_0x171c8c[_0x52a856]={'$like':'%'+_0x114481[_0xcf09('0x32')]['filter']+'%'};return _0x171c8c;})});}if(_0x114481[_0xcf09('0x32')][_0xcf09('0x6e')]){var _0xed6f65=_0x114481[_0xcf09('0x32')][_0xcf09('0x6e')]['split'](',');var _0x558499={};_0x558499[_0xed6f65[0x0]]={'$gte':moment(_0xed6f65[0x1])[_0xcf09('0xc2')](_0xcf09('0xc3'))};_0x5ba2fa[_0xcf09('0x69')]=_[_0xcf09('0xb9')](_0x5ba2fa[_0xcf09('0x69')],_0x558499);}_0x5ba2fa=_[_0xcf09('0xb9')]({},_0x5ba2fa,_0x114481[_0xcf09('0xba')]);return db[_0xcf09('0x25')][_0xcf09('0x16')]({'where':_0x5ba2fa[_0xcf09('0x69')]})[_0xcf09('0x1b')](function(_0x3c05fa){_0x7025ea[_0xcf09('0x16')]=_0x3c05fa;if(_0x114481[_0xcf09('0x32')][_0xcf09('0xb7')]){_0x5ba2fa[_0xcf09('0xb8')]=[{'all':!![]}];}return db[_0xcf09('0x25')][_0xcf09('0xc4')](_0x5ba2fa);})['then'](function(_0x2030bf){if(_0x114481[_0xcf09('0x32')][_0xcf09('0xc5')]===_0xcf09('0xc6')){for(var _0xb82266=0x0;_0xb82266<_0x2030bf[_0xcf09('0x35')];_0xb82266++){_0x2030bf[_0xb82266][_0xcf09('0xbc')]=juice(_0x2030bf[_0xb82266][_0xcf09('0xbc')]);}}_0x7025ea[_0xcf09('0xc7')]=_0x2030bf;return _0x7025ea;});}})[_0xcf09('0x1b')](respondWithFilteredResult(_0xfbb6cf,_0x5ba2fa))[_0xcf09('0x2a')](handleError(_0xfbb6cf,null));};exports[_0xcf09('0xc8')]=function(_0x267eaa,_0x5d5592){return db[_0xcf09('0x2c')][_0xcf09('0x54')]({'where':{'id':_0x267eaa[_0xcf09('0xb4')]['id']}})['then'](handleEntityNotFound(_0x5d5592,null))[_0xcf09('0x1b')](function(_0x11012a){if(_0x11012a){return _0x11012a['setTags'](_0x267eaa['body'][_0xcf09('0xbf')],_[_0xcf09('0xc0')](_0x267eaa[_0xcf09('0xbc')],[_0xcf09('0xbf'),'id'])||{})['spread'](function(){return db[_0xcf09('0x5f')]['findAll']({'attributes':['id','name',_0xcf09('0x3d')],'where':{'id':_0x267eaa[_0xcf09('0xbc')][_0xcf09('0xbf')]}});})[_0xcf09('0x1b')](function(_0x28bfe1){socket[_0xcf09('0xc9')]('mailInteractionTags:save',{'id':Number(_0x267eaa[_0xcf09('0xb4')]['id']),'tags':_0x28bfe1||[]});return{'id':Number(_0x267eaa[_0xcf09('0xb4')]['id']),'tags':_0x28bfe1||[]};});}})[_0xcf09('0x1b')](respondWithResult(_0x5d5592,null))[_0xcf09('0x2a')](handleError(_0x5d5592,null));};exports[_0xcf09('0xca')]=function(_0x2e74f3,_0x4b7795){return db[_0xcf09('0x2c')]['find']({'where':{'id':_0x2e74f3[_0xcf09('0xb4')]['id']}})[_0xcf09('0x1b')](handleEntityNotFound(_0x4b7795,null))[_0xcf09('0x1b')](function(_0x14208c){if(_0x14208c){return _0x14208c[_0xcf09('0xca')](_0x2e74f3[_0xcf09('0x32')]['ids']);}})['then'](respondWithStatusCode(_0x4b7795,null))[_0xcf09('0x2a')](handleError(_0x4b7795,null));};exports[_0xcf09('0xcb')]=function(_0x5e5d9f,_0x4ca2d9){var _0x5c41f6=moment()['unix']()['toString']();var _0x2c3bb6=path['join'](config['root'],_0xcf09('0xcc'),_0xcf09('0xcd'),_0xcf09('0xce'));var _0x349256=path[_0xcf09('0xcf')](config['root'],'server',_0xcf09('0xcd'),'attachments');var _0x2f07b9=path['join'](_0x2c3bb6,_0x5c41f6);var _0x6dbb0d=util[_0xcf09('0xc2')]('transcript-%d-%s.zip',_0x5e5d9f['params']['id'],_0x5c41f6);var _0x344600=path['join'](_0x2c3bb6,_0x6dbb0d);var _0x2845e6=[];if(_0x5e5d9f[_0xcf09('0x32')][_0xcf09('0xd0')]){_0x2845e6[_0xcf09('0xb1')]({'model':db[_0xcf09('0xd1')],'as':_0xcf09('0xd2'),'raw':!![]});}var _0x3df716=[{'model':db[_0xcf09('0x25')],'as':_0xcf09('0xd3'),'attributes':['id','body','from','to','cc',_0xcf09('0xd4'),'subject',_0xcf09('0x6c')],'where':{'secret':![]},'order':qs[_0xcf09('0x39')]('id'),'include':_0x2845e6}];return db[_0xcf09('0x2c')][_0xcf09('0x54')]({'where':{'id':_0x5e5d9f[_0xcf09('0xb4')]['id']},'include':_0x3df716})[_0xcf09('0x1b')](handleEntityNotFound(_0x4ca2d9,null))[_0xcf09('0x1b')](function(_0x5a4d0c){if(_0x5a4d0c&&_0x5a4d0c['Messages']){var _0x353b8a=_0x5a4d0c[_0xcf09('0xd5')]({'plain':!![]});fs[_0xcf09('0xd6')](_0x2f07b9);return BPromise[_0xcf09('0xd7')](_0x353b8a[_0xcf09('0xd3')],function(_0x2ebbcd,_0x461f82){var _0xa22036={'from':_0x2ebbcd['from'],'to':_0x2ebbcd['to'],'subject':_0x2ebbcd[_0xcf09('0xd8')],'html':htmlEntities['decode'](_0x2ebbcd[_0xcf09('0xbc')]),'headers':{'Date':moment(_0x2ebbcd['createdAt'])[_0xcf09('0xc2')](_0xcf09('0xd9'))},'attachments':[]};if(_0x2ebbcd['cc']){_0xa22036[_0xcf09('0xda')]['Cc']=_0x2ebbcd['cc'];}if(_0x2ebbcd[_0xcf09('0xd4')]){_0xa22036[_0xcf09('0xda')][_0xcf09('0xdb')]=_0x2ebbcd['bcc'];}return new BPromise(function(_0x1ffad8,_0x5e8d4f){if(_0x2ebbcd[_0xcf09('0xd2')]){for(var _0x2d4db3=0x0;_0x2d4db3<_0x2ebbcd['Attachments'][_0xcf09('0x35')];_0x2d4db3++){var _0x177efc=_0x2ebbcd[_0xcf09('0xd2')][_0x2d4db3];var _0x497895=path[_0xcf09('0xcf')](_0x349256,_0x177efc[_0xcf09('0xdc')]);if(fs['existsSync'](_0x497895)){_0xa22036[_0xcf09('0xd0')][_0xcf09('0xb1')]({'name':_0x177efc['name'],'contentType':_0x177efc[_0xcf09('0x2e')],'data':fs['readFileSync'](_0x497895)});}}}emlformat[_0xcf09('0xdd')](_0xa22036,function(_0x5c8dfe,_0x13dff9){if(_0x5c8dfe)return _0x5e8d4f(_0x5c8dfe);fs[_0xcf09('0xde')](path[_0xcf09('0xcf')](_0x2f07b9,util[_0xcf09('0xc2')]('message%d.eml',_0x461f82)),_0x13dff9);return _0x1ffad8(_0x13dff9);});});})[_0xcf09('0x1b')](function(){return new BPromise(function(_0xddb92a,_0x4e7730){zipdir(_0x2f07b9,{'saveTo':_0x344600},function(_0x3a8078,_0x5d58a1){if(_0x3a8078)return _0x4e7730(_0x3a8078);return _0xddb92a(_0x5d58a1);});})[_0xcf09('0x1b')](function(){return new BPromise(function(_0x56d4b1,_0x2be6fc){rimraf(_0x2f07b9,function(_0x42be9a){if(_0x42be9a)_0x2be6fc(_0x42be9a);return _0x56d4b1();});});})[_0xcf09('0x1b')](function(){return _0x4ca2d9[_0xcf09('0xcb')](_0x344600,_0x6dbb0d,function(_0x39515f){if(!_0x39515f)fs[_0xcf09('0xdf')](_0x344600);});});});}else{return _0x4ca2d9[_0xcf09('0xe0')](0xc8);}})[_0xcf09('0x2a')](handleError(_0x4ca2d9,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index c7479ea..bd25b82 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 _0xff3c=['../../mysqldb','MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll','length','emit','hasOwnProperty','hook','exports','events','MailInteraction'];(function(_0x9c3c56,_0x169b56){var _0x2dd782=function(_0x386962){while(--_0x386962){_0x9c3c56['push'](_0x9c3c56['shift']());}};_0x2dd782(++_0x169b56);}(_0xff3c,0x178));var _0xcff3=function(_0x30a7f1,_0x243f53){_0x30a7f1=_0x30a7f1-0x0;var _0x4e2229=_0xff3c[_0x30a7f1];return _0x4e2229;};'use strict';var EventEmitter=require(_0xcff3('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xcff3('0x1')];var MailMessage=require(_0xcff3('0x2'))['db'][_0xcff3('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xcff3('0x4')](0x0);var events={'afterCreate':_0xcff3('0x5'),'afterUpdate':_0xcff3('0x6'),'afterDestroy':_0xcff3('0x7')};function emitEvent(_0x2da6da){return function(_0x475d83,_0xd44cf8,_0x1fcc7a){_0x475d83[_0xcff3('0x8')]({'attributes':['id'],'raw':!![]})[_0xcff3('0x9')](function(_0x363f18){_0x475d83[_0xcff3('0xa')](_0xcff3('0xb'),_0x363f18['map'](function(_0xfe0f3e){return{'id':_0xfe0f3e['id']};}));return MailMessage[_0xcff3('0xc')]({'where':{'MailInteractionId':_0x475d83['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3403c7){_0x475d83[_0xcff3('0xa')]('unreadMessages',_0x3403c7[_0xcff3('0xd')]);MailInteractionEvents[_0xcff3('0xe')](_0x2da6da+':'+_0x475d83['id'],_0x475d83);MailInteractionEvents[_0xcff3('0xe')](_0x2da6da,_0x475d83);_0x1fcc7a(null);})['catch'](_0x1fcc7a(null));};}for(var e in events){if(events[_0xcff3('0xf')](e)){var event=events[e];MailInteraction[_0xcff3('0x10')](e,emitEvent(event));}}module[_0xcff3('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0x43fe=['save','update','remove','getUsers','then','setDataValue','Users','unreadMessages','length','emit','hasOwnProperty','hook','events','MailInteraction','../../mysqldb','MailMessage'];(function(_0x644ecd,_0x397f36){var _0x1c66ce=function(_0x4cf42b){while(--_0x4cf42b){_0x644ecd['push'](_0x644ecd['shift']());}};_0x1c66ce(++_0x397f36);}(_0x43fe,0x17c));var _0xe43f=function(_0x403c39,_0x195ee5){_0x403c39=_0x403c39-0x0;var _0x54495b=_0x43fe[_0x403c39];return _0x54495b;};'use strict';var EventEmitter=require(_0xe43f('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xe43f('0x1')];var MailMessage=require(_0xe43f('0x2'))['db'][_0xe43f('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe43f('0x4'),'afterUpdate':_0xe43f('0x5'),'afterDestroy':_0xe43f('0x6')};function emitEvent(_0x82e351){return function(_0x43d2a6,_0x591350,_0x1cb318){_0x43d2a6[_0xe43f('0x7')]({'attributes':['id'],'raw':!![]})[_0xe43f('0x8')](function(_0x59f0eb){_0x43d2a6[_0xe43f('0x9')](_0xe43f('0xa'),_0x59f0eb['map'](function(_0x5e0b0e){return{'id':_0x5e0b0e['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x43d2a6['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x6a931a){_0x43d2a6[_0xe43f('0x9')](_0xe43f('0xb'),_0x6a931a[_0xe43f('0xc')]);MailInteractionEvents[_0xe43f('0xd')](_0x82e351+':'+_0x43d2a6['id'],_0x43d2a6);MailInteractionEvents[_0xe43f('0xd')](_0x82e351,_0x43d2a6);_0x1cb318(null);})['catch'](_0x1cb318(null));};}for(var e in events){if(events[_0xe43f('0xe')](e)){var event=events[e];MailInteraction[_0xe43f('0xf')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 90a0828..68183ad 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 _0xf769=['FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','MailMessage','update','then','catch','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions'];(function(_0x12b83d,_0x4bcec7){var _0x1fd39d=function(_0x449185){while(--_0x449185){_0x12b83d['push'](_0x12b83d['shift']());}};_0x1fd39d(++_0x4bcec7);}(_0xf769,0x15f));var _0x9f76=function(_0x16ea87,_0x378d8b){_0x16ea87=_0x16ea87-0x0;var _0x6e7b1c=_0xf769[_0x16ea87];return _0x6e7b1c;};'use strict';var _=require(_0x9f76('0x0'));var util=require(_0x9f76('0x1'));var logger=require(_0x9f76('0x2'))(_0x9f76('0x3'));var moment=require(_0x9f76('0x4'));var BPromise=require('bluebird');var rp=require(_0x9f76('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9f76('0x6'));var config=require('../../config/environment');var attributes=require(_0x9f76('0x7'));module[_0x9f76('0x8')]=function(_0xdaf6fe,_0x5a59bb){return _0xdaf6fe[_0x9f76('0x9')](_0x9f76('0xa'),attributes,{'tableName':_0x9f76('0xb'),'paranoid':![],'indexes':[{'name':_0x9f76('0xc'),'fields':['subject','to'],'type':_0x9f76('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x12114,_0x3e5532,_0x5e4800){if(_0x12114[_0x9f76('0xe')]){_0x12114[_0x9f76('0xf')]=moment()[_0x9f76('0x10')](_0x9f76('0x11'));}if(_0x12114[_0x9f76('0x12')]){_0x12114[_0x9f76('0x13')]=moment()[_0x9f76('0x10')](_0x9f76('0x11'));}_0x5e4800(null,_0x3e5532);},'beforeUpdate':function(_0x28d0d3,_0x5c0dbc,_0x20e38f){if(_0x28d0d3['changed']('substatus')){_0x28d0d3[_0x9f76('0xf')]=_0x28d0d3[_0x9f76('0xe')]?moment()[_0x9f76('0x10')](_0x9f76('0x11')):null;}if(_0x28d0d3[_0x9f76('0x14')](_0x9f76('0x12'))){_0x28d0d3[_0x9f76('0x13')]=moment()[_0x9f76('0x10')](_0x9f76('0x11'));_0x28d0d3['substatus']=null;_0x28d0d3[_0x9f76('0xf')]=null;}_0x20e38f(null,_0x28d0d3);},'afterUpdate':function(_0x79d13f,_0x74259c,_0x2baa1d){var _0x1cb5e5=_0xdaf6fe[_0x9f76('0x15')];var _0x5eb13d=_0x79d13f['get']({'plain':!![]});if(_0x5eb13d[_0x9f76('0x12')]){return _0x1cb5e5[_0x9f76('0x16')][_0x9f76('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x5eb13d['id']}})[_0x9f76('0x18')](function(){_0x2baa1d();})[_0x9f76('0x19')](function(_0x5a9c4d){_0x2baa1d(_0x5a9c4d);});}else{_0x2baa1d();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8908=['changed','YYYY-MM-DD\x20HH:mm:ss','closed','models','MailMessage','then','catch','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','closedAt','format'];(function(_0x3bc034,_0x12d101){var _0x99c0db=function(_0x40eebc){while(--_0x40eebc){_0x3bc034['push'](_0x3bc034['shift']());}};_0x99c0db(++_0x12d101);}(_0x8908,0x8a));var _0x8890=function(_0x212beb,_0x1a3081){_0x212beb=_0x212beb-0x0;var _0x4d7dfb=_0x8908[_0x212beb];return _0x4d7dfb;};'use strict';var _=require(_0x8890('0x0'));var util=require(_0x8890('0x1'));var logger=require('../../config/logger')(_0x8890('0x2'));var moment=require(_0x8890('0x3'));var BPromise=require(_0x8890('0x4'));var rp=require(_0x8890('0x5'));var fs=require('fs');var path=require(_0x8890('0x6'));var rimraf=require('rimraf');var config=require(_0x8890('0x7'));var attributes=require(_0x8890('0x8'));module[_0x8890('0x9')]=function(_0x3fc30a,_0x286cd6){return _0x3fc30a['define'](_0x8890('0xa'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x8890('0xb'),'fields':[_0x8890('0xc'),'to'],'type':_0x8890('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x870ae0,_0x19dc42,_0x3bd0d2){if(_0x870ae0[_0x8890('0xe')]){_0x870ae0[_0x8890('0xf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x870ae0['closed']){_0x870ae0[_0x8890('0x10')]=moment()[_0x8890('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3bd0d2(null,_0x19dc42);},'beforeUpdate':function(_0xe1807a,_0x36e186,_0x975479){if(_0xe1807a[_0x8890('0x12')](_0x8890('0xe'))){_0xe1807a[_0x8890('0xf')]=_0xe1807a[_0x8890('0xe')]?moment()[_0x8890('0x11')](_0x8890('0x13')):null;}if(_0xe1807a[_0x8890('0x12')](_0x8890('0x14'))){_0xe1807a[_0x8890('0x10')]=moment()['format'](_0x8890('0x13'));_0xe1807a[_0x8890('0xe')]=null;_0xe1807a[_0x8890('0xf')]=null;}_0x975479(null,_0xe1807a);},'afterUpdate':function(_0x4b8089,_0x224319,_0x1d739a){var _0x1c3bfb=_0x3fc30a[_0x8890('0x15')];var _0x5c9170=_0x4b8089['get']({'plain':!![]});if(_0x5c9170[_0x8890('0x14')]){return _0x1c3bfb[_0x8890('0x16')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x5c9170['id']}})[_0x8890('0x17')](function(){_0x1d739a();})[_0x8890('0x18')](function(_0xd78ebc){_0x1d739a(_0xd78ebc);});}else{_0x1d739a();}}},'charset':'utf8mb4','collate':_0x8890('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index caa52b4..766633c 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 _0xf75b=['register','request','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailInteraction,\x20%s,\x20%s','result','UpdateMailInteraction','MailInteraction','options','raw','limit','then','find','where','addTags','ids','omit','body','spread','AddTags','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x5b84da,_0x172c33){var _0x489428=function(_0xd10968){while(--_0xd10968){_0x5b84da['push'](_0x5b84da['shift']());}};_0x489428(++_0x172c33);}(_0xf75b,0x1f4));var _0xbf75=function(_0x2343fc,_0x2c69e6){_0x2343fc=_0x2343fc-0x0;var _0x48780b=_0xf75b[_0x2343fc];return _0x48780b;};'use strict';var _=require(_0xbf75('0x0'));var util=require(_0xbf75('0x1'));var moment=require(_0xbf75('0x2'));var BPromise=require(_0xbf75('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf75('0x4'));var db=require(_0xbf75('0x5'))['db'];var utils=require(_0xbf75('0x6'));var logger=require(_0xbf75('0x7'))(_0xbf75('0x8'));var config=require(_0xbf75('0x9'));var jayson=require(_0xbf75('0xa'));var client=jayson['client'][_0xbf75('0xb')]({'port':0x232a});config['redis']=_[_0xbf75('0xc')](config[_0xbf75('0xd')],{'host':_0xbf75('0xe'),'port':0x18eb});var socket=require(_0xbf75('0xf'))(new Redis(config[_0xbf75('0xd')]));require('./mailInteraction.socket')[_0xbf75('0x10')](socket);function respondWithRpcPromise(_0x33363d,_0x26e5e6,_0x1f65e8){return new BPromise(function(_0x1662dc,_0x23a876){return client[_0xbf75('0x11')](_0x33363d,_0x1f65e8)['then'](function(_0x251423){logger[_0xbf75('0x12')]('MailInteraction,\x20%s,\x20%s',_0x26e5e6,_0xbf75('0x13'));logger[_0xbf75('0x14')](_0xbf75('0x15'),_0x26e5e6,'request\x20sent',JSON[_0xbf75('0x16')](_0x251423));if(_0x251423[_0xbf75('0x17')]){if(_0x251423[_0xbf75('0x17')][_0xbf75('0x18')]===0x1f4){logger['error']('MailInteraction,\x20%s,\x20%s',_0x26e5e6,_0x251423[_0xbf75('0x17')][_0xbf75('0x19')]);return _0x23a876(_0x251423[_0xbf75('0x17')][_0xbf75('0x19')]);}logger[_0xbf75('0x17')](_0xbf75('0x1a'),_0x26e5e6,_0x251423[_0xbf75('0x17')]['message']);return _0x1662dc(_0x251423['error'][_0xbf75('0x19')]);}else{logger[_0xbf75('0x12')](_0xbf75('0x1a'),_0x26e5e6,_0xbf75('0x13'));_0x1662dc(_0x251423[_0xbf75('0x1b')][_0xbf75('0x19')]);}})['catch'](function(_0x534787){logger[_0xbf75('0x17')](_0xbf75('0x1a'),_0x26e5e6,_0x534787);_0x23a876(_0x534787);});});}exports[_0xbf75('0x1c')]=function(_0x18cde3){var _0xcd8d82=this;return new Promise(function(_0x354be7,_0x31b08c){return db[_0xbf75('0x1d')]['update'](_0x18cde3['body'],{'raw':_0x18cde3[_0xbf75('0x1e')]?_0x18cde3[_0xbf75('0x1e')][_0xbf75('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18cde3[_0xbf75('0x1e')]?_0x18cde3[_0xbf75('0x1e')]['where']||null:null,'attributes':_0x18cde3['options']?_0x18cde3[_0xbf75('0x1e')]['attributes']||null:null,'limit':_0x18cde3[_0xbf75('0x1e')]?_0x18cde3[_0xbf75('0x1e')][_0xbf75('0x20')]||null:null})[_0xbf75('0x21')](function(_0x69bb2e){logger[_0xbf75('0x12')](_0xbf75('0x1c'),_0x18cde3);logger[_0xbf75('0x14')]('UpdateMailInteraction',_0x18cde3,JSON[_0xbf75('0x16')](_0x69bb2e));_0x354be7(_0x69bb2e);})['catch'](function(_0x1248fd){logger['error'](_0xbf75('0x1c'),_0x1248fd['message'],_0x18cde3);_0x31b08c(_0xcd8d82[_0xbf75('0x17')](0x1f4,_0x1248fd[_0xbf75('0x19')]));});});};exports['AddTagsToMailInteraction']=function(_0x2fbba8){return new Promise(function(_0x47ca34,_0x292aaa){return db[_0xbf75('0x1d')][_0xbf75('0x22')]({'where':_0x2fbba8[_0xbf75('0x1e')]?_0x2fbba8[_0xbf75('0x1e')][_0xbf75('0x23')]||null:null})[_0xbf75('0x21')](function(_0x597129){if(_0x597129){return _0x597129[_0xbf75('0x24')](_0x2fbba8['body'][_0xbf75('0x25')],_[_0xbf75('0x26')](_0x2fbba8[_0xbf75('0x27')],['ids','id'])||{});}})[_0xbf75('0x28')](function(_0x38aa9a){logger[_0xbf75('0x12')](_0xbf75('0x29'),_0x2fbba8);logger[_0xbf75('0x14')](_0xbf75('0x29'),_0x2fbba8,JSON[_0xbf75('0x16')](_0x38aa9a));_0x47ca34(_0x38aa9a);})[_0xbf75('0x2a')](function(_0x5ab2a8){logger[_0xbf75('0x17')](_0xbf75('0x29'),_0x5ab2a8[_0xbf75('0x19')],_0x2fbba8);_0x292aaa(_this[_0xbf75('0x17')](0x1f4,_0x5ab2a8[_0xbf75('0x19')]));});});}; \ No newline at end of file +var _0x4c6f=['result','catch','UpdateMailInteraction','MailInteraction','body','options','attributes','limit','AddTagsToMailInteraction','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','register','request','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','MailInteraction,\x20%s,\x20%s','message'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x4c6f,0x7e));var _0xf4c6=function(_0x20cf8a,_0x44cd6b){_0x20cf8a=_0x20cf8a-0x0;var _0x54e165=_0x4c6f[_0x20cf8a];return _0x54e165;};'use strict';var _=require(_0xf4c6('0x0'));var util=require(_0xf4c6('0x1'));var moment=require(_0xf4c6('0x2'));var BPromise=require(_0xf4c6('0x3'));var rs=require(_0xf4c6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4c6('0x5'))['db'];var utils=require(_0xf4c6('0x6'));var logger=require('../../config/logger')(_0xf4c6('0x7'));var config=require(_0xf4c6('0x8'));var jayson=require(_0xf4c6('0x9'));var client=jayson[_0xf4c6('0xa')][_0xf4c6('0xb')]({'port':0x232a});config[_0xf4c6('0xc')]=_[_0xf4c6('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailInteraction.socket')[_0xf4c6('0xe')](socket);function respondWithRpcPromise(_0x39d914,_0x3eda7e,_0x21c42c){return new BPromise(function(_0x4e1aeb,_0x40b263){return client[_0xf4c6('0xf')](_0x39d914,_0x21c42c)[_0xf4c6('0x10')](function(_0x14e415){logger[_0xf4c6('0x11')]('MailInteraction,\x20%s,\x20%s',_0x3eda7e,_0xf4c6('0x12'));logger[_0xf4c6('0x13')](_0xf4c6('0x14'),_0x3eda7e,_0xf4c6('0x12'),JSON[_0xf4c6('0x15')](_0x14e415));if(_0x14e415[_0xf4c6('0x16')]){if(_0x14e415['error'][_0xf4c6('0x17')]===0x1f4){logger[_0xf4c6('0x16')](_0xf4c6('0x18'),_0x3eda7e,_0x14e415[_0xf4c6('0x16')]['message']);return _0x40b263(_0x14e415[_0xf4c6('0x16')][_0xf4c6('0x19')]);}logger[_0xf4c6('0x16')]('MailInteraction,\x20%s,\x20%s',_0x3eda7e,_0x14e415['error']['message']);return _0x4e1aeb(_0x14e415[_0xf4c6('0x16')][_0xf4c6('0x19')]);}else{logger[_0xf4c6('0x11')](_0xf4c6('0x18'),_0x3eda7e,_0xf4c6('0x12'));_0x4e1aeb(_0x14e415[_0xf4c6('0x1a')]['message']);}})[_0xf4c6('0x1b')](function(_0x115ac3){logger[_0xf4c6('0x16')](_0xf4c6('0x18'),_0x3eda7e,_0x115ac3);_0x40b263(_0x115ac3);});});}exports[_0xf4c6('0x1c')]=function(_0x608ccf){var _0x1d96c0=this;return new Promise(function(_0x2d9aba,_0x462468){return db[_0xf4c6('0x1d')]['update'](_0x608ccf[_0xf4c6('0x1e')],{'raw':_0x608ccf[_0xf4c6('0x1f')]?_0x608ccf[_0xf4c6('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x608ccf[_0xf4c6('0x1f')]?_0x608ccf[_0xf4c6('0x1f')]['where']||null:null,'attributes':_0x608ccf[_0xf4c6('0x1f')]?_0x608ccf[_0xf4c6('0x1f')][_0xf4c6('0x20')]||null:null,'limit':_0x608ccf[_0xf4c6('0x1f')]?_0x608ccf[_0xf4c6('0x1f')][_0xf4c6('0x21')]||null:null})[_0xf4c6('0x10')](function(_0x89fe3){logger[_0xf4c6('0x11')](_0xf4c6('0x1c'),_0x608ccf);logger[_0xf4c6('0x13')](_0xf4c6('0x1c'),_0x608ccf,JSON[_0xf4c6('0x15')](_0x89fe3));_0x2d9aba(_0x89fe3);})[_0xf4c6('0x1b')](function(_0x5aa2ab){logger[_0xf4c6('0x16')](_0xf4c6('0x1c'),_0x5aa2ab[_0xf4c6('0x19')],_0x608ccf);_0x462468(_0x1d96c0[_0xf4c6('0x16')](0x1f4,_0x5aa2ab[_0xf4c6('0x19')]));});});};exports[_0xf4c6('0x22')]=function(_0x4b46a1){return new Promise(function(_0x30bd5f,_0x16a6e9){return db[_0xf4c6('0x1d')]['find']({'where':_0x4b46a1[_0xf4c6('0x1f')]?_0x4b46a1[_0xf4c6('0x1f')]['where']||null:null})[_0xf4c6('0x10')](function(_0x4e94a7){if(_0x4e94a7){return _0x4e94a7['addTags'](_0x4b46a1[_0xf4c6('0x1e')][_0xf4c6('0x23')],_['omit'](_0x4b46a1[_0xf4c6('0x1e')],['ids','id'])||{});}})[_0xf4c6('0x24')](function(_0x19d18e){logger[_0xf4c6('0x11')](_0xf4c6('0x25'),_0x4b46a1);logger[_0xf4c6('0x13')](_0xf4c6('0x25'),_0x4b46a1,JSON[_0xf4c6('0x15')](_0x19d18e));_0x30bd5f(_0x19d18e);})['catch'](function(_0x565420){logger['error']('AddTags',_0x565420[_0xf4c6('0x19')],_0x4b46a1);_0x16a6e9(_this[_0xf4c6('0x16')](0x1f4,_0x565420['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index ff589f3..37caed4 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 _0x7ab5=['save','remove','removeListener','register','length','./mailInteraction.events'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x7ab5,0xd1));var _0x57ab=function(_0x36f06d,_0x5567fa){_0x36f06d=_0x36f06d-0x0;var _0x402ab5=_0x7ab5[_0x36f06d];return _0x402ab5;};'use strict';var MailInteractionEvents=require(_0x57ab('0x0'));var events=[_0x57ab('0x1'),_0x57ab('0x2'),'update'];function createListener(_0x18c37f,_0x4635e6){return function(_0x5cae39){_0x4635e6['emit'](_0x18c37f,_0x5cae39);};}function removeListener(_0x4538b6,_0x16a655){return function(){MailInteractionEvents[_0x57ab('0x3')](_0x4538b6,_0x16a655);};}exports[_0x57ab('0x4')]=function(_0x7bc778){for(var _0x6d481c=0x0,_0x1facdd=events[_0x57ab('0x5')];_0x6d481c<_0x1facdd;_0x6d481c++){var _0x2ac88e=events[_0x6d481c];var _0x3a4af0=createListener('mailInteraction:'+_0x2ac88e,_0x7bc778);MailInteractionEvents['on'](_0x2ac88e,_0x3a4af0);}}; \ No newline at end of file +var _0xd53d=['./mailInteraction.events','save','update','emit','removeListener','register','mailInteraction:'];(function(_0xee5094,_0x2399b9){var _0x1696d1=function(_0x342ed0){while(--_0x342ed0){_0xee5094['push'](_0xee5094['shift']());}};_0x1696d1(++_0x2399b9);}(_0xd53d,0xbd));var _0xdd53=function(_0x5bc0f9,_0x1de7b0){_0x5bc0f9=_0x5bc0f9-0x0;var _0x50c294=_0xd53d[_0x5bc0f9];return _0x50c294;};'use strict';var MailInteractionEvents=require(_0xdd53('0x0'));var events=[_0xdd53('0x1'),'remove',_0xdd53('0x2')];function createListener(_0x1414ec,_0x4d82de){return function(_0x147449){_0x4d82de[_0xdd53('0x3')](_0x1414ec,_0x147449);};}function removeListener(_0x455705,_0xfaa681){return function(){MailInteractionEvents[_0xdd53('0x4')](_0x455705,_0xfaa681);};}exports[_0xdd53('0x5')]=function(_0x7b3f16){for(var _0x5ab0d2=0x0,_0x5b02d2=events['length'];_0x5ab0d2<_0x5b02d2;_0x5ab0d2++){var _0x2d3b87=events[_0x5ab0d2];var _0x2b916d=createListener(_0xdd53('0x6')+_0x2d3b87,_0x7b3f16);MailInteractionEvents['on'](_0x2d3b87,_0x2b916d);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 38395e9..4add36d 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 _0x8b88=['index','/describe','/:id','/:id/download','post','tracked','create','put','/:id/accept','accept','reject','delete','destroy','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x8b88,0x14f));var _0x88b8=function(_0x233a03,_0xc2cb1e){_0x233a03=_0x233a03-0x0;var _0x56ad33=_0x8b88[_0x233a03];return _0x56ad33;};'use strict';var multer=require('multer');var util=require(_0x88b8('0x0'));var path=require('path');var timeout=require(_0x88b8('0x1'));var express=require('express');var router=express[_0x88b8('0x2')]();var fs_extra=require(_0x88b8('0x3'));var auth=require(_0x88b8('0x4'));var interaction=require(_0x88b8('0x5'));var config=require(_0x88b8('0x6'));var controller=require(_0x88b8('0x7'));router[_0x88b8('0x8')]('/',auth[_0x88b8('0x9')](),controller[_0x88b8('0xa')]);router[_0x88b8('0x8')](_0x88b8('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x88b8('0x8')](_0x88b8('0xc'),auth[_0x88b8('0x9')](),controller['show']);router[_0x88b8('0x8')](_0x88b8('0xd'),auth[_0x88b8('0x9')](),controller['download']);router[_0x88b8('0xe')]('/',auth[_0x88b8('0x9')](),interaction[_0x88b8('0xf')]('mail','mailmessage:create'),controller[_0x88b8('0x10')]);router[_0x88b8('0x11')](_0x88b8('0xc'),auth[_0x88b8('0x9')](),controller['update']);router['put'](_0x88b8('0x12'),auth['isAuthenticated'](),controller[_0x88b8('0x13')]);router[_0x88b8('0x11')]('/:id/reject',auth[_0x88b8('0x9')](),controller[_0x88b8('0x14')]);router[_0x88b8('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x88b8('0x16')]);module['exports']=router; \ No newline at end of file +var _0x51f4=['mailmessage:create','create','update','/:id/accept','accept','put','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','/describe','/:id','show','/:id/download','download','post','tracked','mail'];(function(_0x246148,_0x1358ee){var _0x453d94=function(_0x59920e){while(--_0x59920e){_0x246148['push'](_0x246148['shift']());}};_0x453d94(++_0x1358ee);}(_0x51f4,0x1c2));var _0x451f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x51f4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x451f('0x0'));var util=require(_0x451f('0x1'));var path=require(_0x451f('0x2'));var timeout=require('connect-timeout');var express=require(_0x451f('0x3'));var router=express[_0x451f('0x4')]();var fs_extra=require(_0x451f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x451f('0x6'));var config=require('../../config/environment');var controller=require(_0x451f('0x7'));router[_0x451f('0x8')]('/',auth[_0x451f('0x9')](),controller['index']);router[_0x451f('0x8')](_0x451f('0xa'),auth[_0x451f('0x9')](),controller['describe']);router[_0x451f('0x8')](_0x451f('0xb'),auth[_0x451f('0x9')](),controller[_0x451f('0xc')]);router['get'](_0x451f('0xd'),auth['isAuthenticated'](),controller[_0x451f('0xe')]);router[_0x451f('0xf')]('/',auth[_0x451f('0x9')](),interaction[_0x451f('0x10')](_0x451f('0x11'),_0x451f('0x12')),controller[_0x451f('0x13')]);router['put'](_0x451f('0xb'),auth[_0x451f('0x9')](),controller[_0x451f('0x14')]);router['put'](_0x451f('0x15'),auth[_0x451f('0x9')](),controller[_0x451f('0x16')]);router[_0x451f('0x17')]('/:id/reject',auth[_0x451f('0x9')](),controller['reject']);router[_0x451f('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x451f('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index fb20ade..68c4f34 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 _0x354e=['ENUM','out','STRING','DATE','INTEGER','Email','lodash','exports','long','TEXT','medium','BOOLEAN'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x354e,0xea));var _0xe354=function(_0x7d7f20,_0x4d334b){_0x7d7f20=_0x7d7f20-0x0;var _0x332452=_0x354e[_0x7d7f20];return _0x332452;};'use strict';var Sequelize=require('sequelize');var _=require(_0xe354('0x0'));module[_0xe354('0x1')]={'body':{'type':Sequelize['TEXT'](_0xe354('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe354('0x3')](_0xe354('0x4'))},'read':{'type':Sequelize[_0xe354('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe354('0x6')]('in',_0xe354('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xe354('0x8')]},'to':{'type':Sequelize['TEXT'](_0xe354('0x2'))},'cc':{'type':Sequelize[_0xe354('0x3')](_0xe354('0x2'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0xe354('0x3')]},'sentAt':{'type':Sequelize[_0xe354('0x9')]},'attach':{'type':Sequelize[_0xe354('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xe354('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xe354('0x9')]},'originTo':{'type':Sequelize[_0xe354('0x3')](_0xe354('0x2'))},'originCc':{'type':Sequelize[_0xe354('0x3')]('long')},'originChannel':{'type':Sequelize[_0xe354('0x6')](_0xe354('0xb'),'Chat'),'defaultValue':_0xe354('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x7a53=['Chat','sequelize','lodash','exports','TEXT','long','BOOLEAN','ENUM','out','STRING','DATE','Email'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x7a53,0x79));var _0x37a5=function(_0x1b392d,_0x52f398){_0x1b392d=_0x1b392d-0x0;var _0x523e93=_0x7a53[_0x1b392d];return _0x523e93;};'use strict';var Sequelize=require(_0x37a5('0x0'));var _=require(_0x37a5('0x1'));module[_0x37a5('0x2')]={'body':{'type':Sequelize[_0x37a5('0x3')](_0x37a5('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x37a5('0x3')]('medium')},'read':{'type':Sequelize[_0x37a5('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x37a5('0x6')]('in',_0x37a5('0x7')),'defaultValue':_0x37a5('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x37a5('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x37a5('0x3')](_0x37a5('0x4'))},'cc':{'type':Sequelize[_0x37a5('0x3')]('long')},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x37a5('0x3')]},'sentAt':{'type':Sequelize[_0x37a5('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x37a5('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x37a5('0x9')]},'originTo':{'type':Sequelize[_0x37a5('0x3')]('long')},'originCc':{'type':Sequelize[_0x37a5('0x3')]('long')},'originChannel':{'type':Sequelize[_0x37a5('0x6')](_0x37a5('0xa'),_0x37a5('0xb')),'defaultValue':_0x37a5('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 4f06285..c850cfd 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 _0xc7af=['create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','service','host','port','secure','auth','pass','user','attachments','join','basename','defaults','ListId','List\x20not\x20found','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','readAt','UserId','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','User','agent','email','internal','manual','channel','event','fromString','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','interface','SIP/%s','motionChannel','reject','rejectmessage','download','unix','root','server','files','bcc','createdAt','Attachment','Attachments','from','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','push','type','readFileSync','build','writeFileSync','unlinkSync','bluebird','util','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','limit','undefined','Content-Range','update','end','sendStatus','stack','name','send','map','MailMessage','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','params','find','body','destroy','describe'];(function(_0x18c917,_0x589c41){var _0x77f600=function(_0x476467){while(--_0x476467){_0x18c917['push'](_0x18c917['shift']());}};_0x77f600(++_0x589c41);}(_0xc7af,0xfe));var _0xfc7a=function(_0x1c5142,_0x30ea72){_0x1c5142=_0x1c5142-0x0;var _0x1268cb=_0xc7af[_0x1c5142];return _0x1268cb;};'use strict';var emlformat=require('eml-format');var moment=require('moment');var BPromise=require(_0xfc7a('0x0'));var util=require(_0xfc7a('0x1'));var path=require('path');var fs=require('fs');var _=require(_0xfc7a('0x2'));var Redis=require(_0xfc7a('0x3'));var htmlToText=require(_0xfc7a('0x4'));var qs=require(_0xfc7a('0x5'));var logger=require(_0xfc7a('0x6'))(_0xfc7a('0x7'));var interaction_log=require(_0xfc7a('0x6'))(_0xfc7a('0x8'));var config=require('../../config/environment');var db=require(_0xfc7a('0x9'))['db'];config[_0xfc7a('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfc7a('0xb'))(new Redis(config[_0xfc7a('0xa')]));var htmlEntities=require('html-entities');require('./mailMessage.socket')[_0xfc7a('0xc')](socket);var jayson=require(_0xfc7a('0xd'));var client=jayson[_0xfc7a('0xe')][_0xfc7a('0xf')]({'port':0x232c});var client9003=jayson[_0xfc7a('0xe')][_0xfc7a('0xf')]({'port':0x232b});var client9002=jayson['client'][_0xfc7a('0xf')]({'port':0x232a});function respondWithRpcPromise(_0xdc205f,_0x225964,_0x3596fd,_0xa1bf3){return new BPromise(function(_0x115afd,_0x15905e){var _0x1f2f32=_0xa1bf3||client;return _0x1f2f32[_0xfc7a('0x10')](_0xdc205f,_0x3596fd)[_0xfc7a('0x11')](function(_0x32eaee){logger[_0xfc7a('0x12')](_0xfc7a('0x13'),_0x225964,_0xfc7a('0x14'));logger[_0xfc7a('0x15')](_0xfc7a('0x16'),_0x225964,'request\x20sent',JSON[_0xfc7a('0x17')](_0x32eaee));if(_0x32eaee[_0xfc7a('0x18')]){if(_0x32eaee[_0xfc7a('0x18')][_0xfc7a('0x19')]===0x1f4){logger[_0xfc7a('0x18')](_0xfc7a('0x13'),_0x225964,_0x32eaee['error'][_0xfc7a('0x1a')]);return _0x15905e(_0x32eaee['error'][_0xfc7a('0x1a')]);}logger[_0xfc7a('0x18')](_0xfc7a('0x13'),_0x225964,_0x32eaee[_0xfc7a('0x18')]['message']);return _0x115afd(_0x32eaee[_0xfc7a('0x18')][_0xfc7a('0x1a')]);}else{logger[_0xfc7a('0x12')]('MailMessage,\x20%s,\x20%s',_0x225964,'request\x20sent');_0x115afd(_0x32eaee[_0xfc7a('0x1b')]['message']);}})[_0xfc7a('0x1c')](function(_0x2a178e){logger[_0xfc7a('0x18')](_0xfc7a('0x13'),_0x225964,_0x2a178e);_0x15905e(_0x2a178e);});});}function respondWithResult(_0x438d8a,_0x4fc0c1){_0x4fc0c1=_0x4fc0c1||0xc8;return function(_0x2afabf){if(_0x2afabf){return _0x438d8a[_0xfc7a('0x1d')](_0x4fc0c1)[_0xfc7a('0x1e')](_0x2afabf);}};}function respondWithFilteredResult(_0x24ac70,_0x52992d){return function(_0x2f055d){if(_0x2f055d){var _0x429d57=typeof _0x52992d[_0xfc7a('0x1f')]==='undefined'&&typeof _0x52992d[_0xfc7a('0x20')]===_0xfc7a('0x21');var _0x3668bb=_0x2f055d['count'];var _0xe7a34b=_0x429d57?0x0:_0x52992d['offset'];var _0x48aa7d=_0x429d57?_0x2f055d['count']:_0x52992d[_0xfc7a('0x1f')]+_0x52992d[_0xfc7a('0x20')];var _0x2c2d2d;if(_0x48aa7d>=_0x3668bb){_0x48aa7d=_0x3668bb;_0x2c2d2d=0xc8;}else{_0x2c2d2d=0xce;}_0x24ac70[_0xfc7a('0x1d')](_0x2c2d2d);return _0x24ac70['set'](_0xfc7a('0x22'),_0xe7a34b+'-'+_0x48aa7d+'/'+_0x3668bb)['json'](_0x2f055d);}return null;};}function saveUpdates(_0x1c6e7c){return function(_0x2bd493){if(_0x2bd493){return _0x2bd493[_0xfc7a('0x23')](_0x1c6e7c)[_0xfc7a('0x11')](function(_0x1b5000){return _0x1b5000;});}return null;};}function removeEntity(_0x1b6fef){return function(_0x412a94){if(_0x412a94){return _0x412a94['destroy']()[_0xfc7a('0x11')](function(){_0x1b6fef['status'](0xcc)[_0xfc7a('0x24')]();});}};}function handleEntityNotFound(_0x156c79){return function(_0x14c64c){if(!_0x14c64c){_0x156c79[_0xfc7a('0x25')](0x194);}return _0x14c64c;};}function handleError(_0x5ee5e6,_0x4fed2c){_0x4fed2c=_0x4fed2c||0x1f4;return function(_0x2ed73b){logger['error'](_0x2ed73b[_0xfc7a('0x26')]);if(_0x2ed73b[_0xfc7a('0x27')]){delete _0x2ed73b[_0xfc7a('0x27')];}_0x5ee5e6[_0xfc7a('0x1d')](_0x4fed2c)[_0xfc7a('0x28')](_0x2ed73b);};}exports['index']=function(_0x5805e9,_0xb1b70c){var _0x5389b6={},_0x236acb={},_0x4d9138={'count':0x0,'rows':[]};var _0x31a919=_[_0xfc7a('0x29')](db[_0xfc7a('0x2a')][_0xfc7a('0x2b')],function(_0x532497){return{'name':_0x532497[_0xfc7a('0x2c')],'type':_0x532497['type'][_0xfc7a('0x2d')]};});_0x236acb[_0xfc7a('0x2e')]=_['map'](_0x31a919,'name');_0x236acb[_0xfc7a('0x2f')]=_[_0xfc7a('0x30')](_0x5805e9[_0xfc7a('0x2f')]);_0x236acb['filters']=_[_0xfc7a('0x31')](_0x236acb[_0xfc7a('0x2e')],_0x236acb[_0xfc7a('0x2f')]);_0x5389b6[_0xfc7a('0x32')]=_[_0xfc7a('0x31')](_0x236acb[_0xfc7a('0x2e')],qs[_0xfc7a('0x33')](_0x5805e9[_0xfc7a('0x2f')][_0xfc7a('0x33')]));_0x5389b6['attributes']=_0x5389b6['attributes'][_0xfc7a('0x34')]?_0x5389b6['attributes']:_0x236acb[_0xfc7a('0x2e')];if(!_0x5805e9[_0xfc7a('0x2f')]['hasOwnProperty']('nolimit')){_0x5389b6[_0xfc7a('0x20')]=qs[_0xfc7a('0x20')](_0x5805e9[_0xfc7a('0x2f')][_0xfc7a('0x20')]);_0x5389b6[_0xfc7a('0x1f')]=qs['offset'](_0x5805e9[_0xfc7a('0x2f')][_0xfc7a('0x1f')]);}_0x5389b6['order']=qs[_0xfc7a('0x35')](_0x5805e9[_0xfc7a('0x2f')][_0xfc7a('0x35')]);_0x5389b6[_0xfc7a('0x36')]=qs[_0xfc7a('0x37')](_[_0xfc7a('0x38')](_0x5805e9[_0xfc7a('0x2f')],_0x236acb[_0xfc7a('0x37')]),_0x31a919);if(_0x5805e9[_0xfc7a('0x2f')][_0xfc7a('0x39')]){_0x5389b6['where']=_[_0xfc7a('0x3a')](_0x5389b6['where'],{'$or':_[_0xfc7a('0x29')](_0x31a919,function(_0x27a7f3){if(_0x27a7f3['type']!==_0xfc7a('0x3b')){var _0x51eddd={};_0x51eddd[_0x27a7f3['name']]={'$like':'%'+_0x5805e9[_0xfc7a('0x2f')][_0xfc7a('0x39')]+'%'};return _0x51eddd;}})});}_0x5389b6=_[_0xfc7a('0x3a')]({},_0x5389b6,_0x5805e9[_0xfc7a('0x3c')]);var _0x52a5db={'where':_0x5389b6[_0xfc7a('0x36')]};return db['MailMessage'][_0xfc7a('0x3d')](_0x52a5db)[_0xfc7a('0x11')](function(_0x265857){_0x4d9138[_0xfc7a('0x3d')]=_0x265857;if(_0x5805e9['query'][_0xfc7a('0x3e')]){_0x5389b6['include']=[{'all':!![]}];}return db['MailMessage'][_0xfc7a('0x3f')](_0x5389b6);})[_0xfc7a('0x11')](function(_0x23a145){_0x4d9138[_0xfc7a('0x40')]=_0x23a145;return _0x4d9138;})[_0xfc7a('0x11')](respondWithFilteredResult(_0xb1b70c,_0x5389b6))[_0xfc7a('0x1c')](handleError(_0xb1b70c,null));};exports['show']=function(_0x326d82,_0x5b61a7){var _0x3caf52={'raw':!![],'where':{'id':_0x326d82[_0xfc7a('0x41')]['id']}},_0x559fec={};_0x559fec['model']=_[_0xfc7a('0x30')](db['MailMessage'][_0xfc7a('0x2b')]);_0x559fec[_0xfc7a('0x2f')]=_[_0xfc7a('0x30')](_0x326d82[_0xfc7a('0x2f')]);_0x559fec['filters']=_[_0xfc7a('0x31')](_0x559fec[_0xfc7a('0x2e')],_0x559fec[_0xfc7a('0x2f')]);_0x3caf52[_0xfc7a('0x32')]=_['intersection'](_0x559fec[_0xfc7a('0x2e')],qs[_0xfc7a('0x33')](_0x326d82['query'][_0xfc7a('0x33')]));_0x3caf52[_0xfc7a('0x32')]=_0x3caf52[_0xfc7a('0x32')]['length']?_0x3caf52[_0xfc7a('0x32')]:_0x559fec[_0xfc7a('0x2e')];if(_0x326d82['query'][_0xfc7a('0x3e')]){_0x3caf52['include']=[{'all':!![]}];}_0x3caf52=_[_0xfc7a('0x3a')]({},_0x3caf52,_0x326d82[_0xfc7a('0x3c')]);return db[_0xfc7a('0x2a')][_0xfc7a('0x42')](_0x3caf52)[_0xfc7a('0x11')](handleEntityNotFound(_0x5b61a7,null))[_0xfc7a('0x11')](respondWithResult(_0x5b61a7,null))['catch'](handleError(_0x5b61a7,null));};exports[_0xfc7a('0x23')]=function(_0x382b89,_0x708674){if(_0x382b89[_0xfc7a('0x43')]['id']){delete _0x382b89[_0xfc7a('0x43')]['id'];}return db[_0xfc7a('0x2a')][_0xfc7a('0x42')]({'where':{'id':_0x382b89[_0xfc7a('0x41')]['id']}})[_0xfc7a('0x11')](handleEntityNotFound(_0x708674,null))['then'](saveUpdates(_0x382b89[_0xfc7a('0x43')],null))['then'](respondWithResult(_0x708674,null))['catch'](handleError(_0x708674,null));};exports[_0xfc7a('0x44')]=function(_0x56888c,_0x33f0d9){return db[_0xfc7a('0x2a')][_0xfc7a('0x42')]({'where':{'id':_0x56888c[_0xfc7a('0x41')]['id']}})[_0xfc7a('0x11')](handleEntityNotFound(_0x33f0d9,null))['then'](removeEntity(_0x33f0d9,null))[_0xfc7a('0x1c')](handleError(_0x33f0d9,null));};exports[_0xfc7a('0x45')]=function(_0x5ac779,_0x50b45a){return db[_0xfc7a('0x2a')][_0xfc7a('0x45')]()['then'](respondWithResult(_0x50b45a,null))[_0xfc7a('0x1c')](handleError(_0x50b45a,null));};exports[_0xfc7a('0x46')]=function(_0x1b1376,_0x1c6a84){return db[_0xfc7a('0x2a')][_0xfc7a('0x46')](_0x1b1376[_0xfc7a('0x43')])['then'](function(_0x3a5273){if(_0x3a5273){if(_0x3a5273[_0xfc7a('0x47')]===_0xfc7a('0x48')&&!_0x3a5273[_0xfc7a('0x49')]){var _0x489ff7,_0x124954,_0x2343d4;if(_0x1b1376['body']['to']){_0x124954=_0x1b1376[_0xfc7a('0x43')]['to'][_0xfc7a('0x4a')](',')[0x0];}return db[_0xfc7a('0x4b')][_0xfc7a('0x4c')]({'where':{'id':_0x3a5273[_0xfc7a('0x4d')]},'include':[{'model':db[_0xfc7a('0x4e')],'as':_0xfc7a('0x4f'),'include':[{'model':db[_0xfc7a('0x50')],'as':_0xfc7a('0x51'),'where':{'email':_0x124954},'limit':0x1,'order':[[_0xfc7a('0x52'),_0xfc7a('0x53')]]}]},{'model':db[_0xfc7a('0x54')],'as':_0xfc7a('0x55'),'raw':!![]}]})[_0xfc7a('0x11')](function(_0x5f67ce){_0x489ff7=_0x5f67ce;if(_0x489ff7&&_0x489ff7['Smtp']){var _0x25c574={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x489ff7['Smtp'][_0xfc7a('0x56')])){_0x25c574['host']=_0x489ff7[_0xfc7a('0x55')][_0xfc7a('0x57')];_0x25c574[_0xfc7a('0x58')]=_0x489ff7['Smtp'][_0xfc7a('0x58')];_0x25c574[_0xfc7a('0x59')]=_0x489ff7[_0xfc7a('0x55')]['secure'];if(_0x489ff7[_0xfc7a('0x55')]['authentication']){_0x25c574[_0xfc7a('0x5a')]={'user':_0x489ff7['Smtp']['user'],'pass':_0x489ff7[_0xfc7a('0x55')][_0xfc7a('0x5b')]};}}else{_0x25c574[_0xfc7a('0x56')]=_0x489ff7[_0xfc7a('0x55')]['service'];_0x25c574[_0xfc7a('0x5a')]={'user':_0x489ff7[_0xfc7a('0x55')][_0xfc7a('0x5c')],'pass':_0x489ff7[_0xfc7a('0x55')][_0xfc7a('0x5b')]};_0x25c574[_0xfc7a('0x59')]=_0x489ff7[_0xfc7a('0x55')][_0xfc7a('0x59')];}if(_0x1b1376[_0xfc7a('0x43')]['attachments']&&_0x1b1376[_0xfc7a('0x43')][_0xfc7a('0x5d')][_0xfc7a('0x34')]){for(var _0x4a063e=0x0;_0x4a063e<_0x1b1376[_0xfc7a('0x43')]['attachments'][_0xfc7a('0x34')];_0x4a063e+=0x1){_0x1b1376[_0xfc7a('0x43')]['attachments'][_0x4a063e]={'filename':_0x1b1376[_0xfc7a('0x43')][_0xfc7a('0x5d')][_0x4a063e][_0xfc7a('0x27')],'path':path[_0xfc7a('0x5e')](config['root'],'server/files/attachments',_0x1b1376[_0xfc7a('0x43')][_0xfc7a('0x5d')][_0x4a063e][_0xfc7a('0x5f')])};}}_0x2343d4={'account':_0x25c574,'message':_0x1b1376[_0xfc7a('0x43')]};return;}})['then'](function(){if(_0x489ff7[_0xfc7a('0x4f')]){if(_0x489ff7[_0xfc7a('0x4f')][_0xfc7a('0x51')][_0xfc7a('0x34')]){return _0x489ff7[_0xfc7a('0x4f')]['Contacts'][0x0];}else{return db['CmContact'][_0xfc7a('0x46')](_[_0xfc7a('0x60')](_0x1b1376['body'],{'firstName':_0x1b1376['body']['to'],'email':_0x1b1376[_0xfc7a('0x43')]['to'],'phone':_0x1b1376[_0xfc7a('0x43')]['to'],'ListId':_0x489ff7[_0xfc7a('0x61')]}));}}else{throw new Error(_0xfc7a('0x62'));}})[_0xfc7a('0x11')](function(){if(_0x2343d4){return respondWithRpcPromise(_0xfc7a('0x63'),'sendMail',_0x2343d4,client9003)['then'](function(_0x28f6f8){return _0x3a5273[_0xfc7a('0x23')]({'read':!![],'messageId':_0x28f6f8[_0xfc7a('0x64')],'sentAt':moment()[_0xfc7a('0x65')](_0xfc7a('0x66'))});})[_0xfc7a('0x1c')](function(_0x2b844b){logger[_0xfc7a('0x18')]('%s',JSON[_0xfc7a('0x17')](_0x2b844b));return _0x3a5273;});}return _0x3a5273;});}return _0x3a5273;}})['then'](respondWithResult(_0x1c6a84,0xc9))['catch'](handleError(_0x1c6a84,null));};exports[_0xfc7a('0x67')]=function(_0x282b7e,_0x53738a){var _0x3665b3={'agent':{},'channel':_0xfc7a('0x68')};if(_0x282b7e['body']['id']){delete _0x282b7e[_0xfc7a('0x43')]['id'];}_0x282b7e[_0xfc7a('0x43')]['read']=!![];_0x282b7e['body'][_0xfc7a('0x69')]=moment()[_0xfc7a('0x65')](_0xfc7a('0x66'));_0x282b7e['body'][_0xfc7a('0x6a')]=_0x282b7e[_0xfc7a('0x43')][_0xfc7a('0x6a')]||_0x282b7e[_0xfc7a('0x5c')]['id'];_0x3665b3['agent']['id']=_0x282b7e[_0xfc7a('0x43')][_0xfc7a('0x6a')];return db[_0xfc7a('0x2a')][_0xfc7a('0x42')]({'where':{'id':_0x282b7e[_0xfc7a('0x41')]['id'],'UserId':null}})[_0xfc7a('0x11')](handleEntityNotFound(_0x53738a,null))[_0xfc7a('0x11')](saveUpdates(_0x282b7e[_0xfc7a('0x43')],null))[_0xfc7a('0x11')](function(_0x5250f7){if(_0x5250f7){_0x3665b3[_0xfc7a('0x1a')]=_0x5250f7[_0xfc7a('0x6b')]({'plain':!![]});return db[_0xfc7a('0x6c')]['find']({'where':{'id':_0x5250f7[_0xfc7a('0x6d')]}});}return null;})[_0xfc7a('0x11')](handleEntityNotFound(_0x53738a,null))[_0xfc7a('0x11')](function(_0x4ee381){if(_0x4ee381){return _0x4ee381[_0xfc7a('0x23')]({'UserId':_0x282b7e[_0xfc7a('0x43')][_0xfc7a('0x6a')],'read1stAt':_['isNil'](_0x4ee381[_0xfc7a('0x6e')])?moment()['format'](_0xfc7a('0x66')):undefined});}return null;})[_0xfc7a('0x11')](function(_0x54db2d){if(_0x54db2d){_0x3665b3[_0xfc7a('0x6f')]=_0x54db2d[_0xfc7a('0x6b')]({'plain':!![]});interaction_log[_0xfc7a('0x12')](_0xfc7a('0x70'),_0x282b7e['user']['id'],_0x282b7e[_0xfc7a('0x5c')]['name'],_0x282b7e['user'][_0xfc7a('0x71')],_0x3665b3[_0xfc7a('0x6f')]['id'],_0x282b7e[_0xfc7a('0x43')]?JSON[_0xfc7a('0x17')](_0x282b7e[_0xfc7a('0x43')]):_0xfc7a('0x72'));return respondWithRpcPromise(_0xfc7a('0x73'),_0xfc7a('0x74'),_0x3665b3);}return null;})[_0xfc7a('0x11')](function(_0x55b233){var _0x227fe9=_0xfc7a('0x75')+_0x55b233[_0xfc7a('0x1a')][_0xfc7a('0x76')];return db[_0xfc7a('0x77')][_0xfc7a('0x2f')](_0x227fe9,{'type':db['Sequelize'][_0xfc7a('0x78')][_0xfc7a('0x79')],'raw':!![]})[_0xfc7a('0x11')](function(_0x1cd3cf){return _0x1cd3cf;});})['then'](function(_0x3ffbc2){if(_0x3ffbc2){_0x3665b3['message']['contact']=_0x3ffbc2[0x0];if(!_0x282b7e[_0xfc7a('0x43')]['UserId'])return;return db[_0xfc7a('0x7a')][_0xfc7a('0x42')]({'where':{'id':_0x282b7e[_0xfc7a('0x43')][_0xfc7a('0x6a')],'role':_0xfc7a('0x7b')},'attributes':['id',_0xfc7a('0x27'),'fullname',_0xfc7a('0x7c'),_0xfc7a('0x7d')],'raw':!![]});}return null;})[_0xfc7a('0x11')](function(_0x42cadd){if(!_0x42cadd)return null;_0x3665b3[_0xfc7a('0x1a')]['agent']=_0x42cadd;return _0x3665b3;})['then'](function(_0x29735b){if(_0x29735b){if(_0x282b7e[_0xfc7a('0x43')][_0xfc7a('0x7e')]){_0x3665b3['message']['interface']=util[_0xfc7a('0x65')]('SIP/%s',_0x282b7e['user'][_0xfc7a('0x27')]);_0x3665b3[_0xfc7a('0x1a')][_0xfc7a('0x7f')]=_0x3665b3[_0xfc7a('0x7f')];_0x3665b3[_0xfc7a('0x1a')]['motionChannel']=_0x3665b3[_0xfc7a('0x7f')];_0x3665b3[_0xfc7a('0x1a')][_0xfc7a('0x80')]='accept';_0x3665b3['message'][_0xfc7a('0x43')]=htmlToText[_0xfc7a('0x81')](_0x3665b3[_0xfc7a('0x1a')][_0xfc7a('0x43')]);return respondWithRpcPromise('EventManager',_0xfc7a('0x82'),{'event':_0xfc7a('0x83'),'message':_0x3665b3[_0xfc7a('0x1a')]},client9002)['then'](function(){return _0x3665b3;});}return _0x3665b3;}return null;})[_0xfc7a('0x11')](respondWithResult(_0x53738a,null))[_0xfc7a('0x1c')](handleError(_0x53738a,null));};exports['reject']=function(_0x293032,_0x37eeba){var _0x401b5c={'agent':{},'channel':_0xfc7a('0x68')};if(_0x293032[_0xfc7a('0x43')]['id']){delete _0x293032[_0xfc7a('0x43')]['id'];}_0x293032[_0xfc7a('0x43')][_0xfc7a('0x6a')]=_0x293032[_0xfc7a('0x43')][_0xfc7a('0x6a')]||_0x293032['user']['id'];_0x401b5c[_0xfc7a('0x7b')]['id']=_0x293032[_0xfc7a('0x43')]['UserId'];return db['MailMessage'][_0xfc7a('0x42')]({'where':{'id':_0x293032[_0xfc7a('0x41')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x37eeba,null))[_0xfc7a('0x11')](function(_0x294702){if(_0x294702){_0x401b5c[_0xfc7a('0x1a')]=_0x294702[_0xfc7a('0x6b')]({'plain':!![]});return db[_0xfc7a('0x6c')][_0xfc7a('0x42')]({'where':{'id':_0x294702[_0xfc7a('0x6d')]}});}return null;})['then'](handleEntityNotFound(_0x37eeba,null))['then'](function(_0x54fecb){if(_0x54fecb){_0x401b5c[_0xfc7a('0x6f')]=_0x54fecb['get']({'plain':!![]});interaction_log['info'](_0xfc7a('0x84'),_0x293032['user']['id'],_0x293032[_0xfc7a('0x5c')][_0xfc7a('0x27')],_0x293032[_0xfc7a('0x5c')][_0xfc7a('0x71')],_0x401b5c[_0xfc7a('0x6f')]['id'],_0x293032['body']?JSON[_0xfc7a('0x17')](_0x293032[_0xfc7a('0x43')]):_0xfc7a('0x72'));return respondWithRpcPromise(_0xfc7a('0x85'),_0xfc7a('0x86'),_0x401b5c);}return null;})[_0xfc7a('0x11')](function(_0x50a676){var _0x2892f2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x50a676['message'][_0xfc7a('0x76')];return db['sequelize']['query'](_0x2892f2,{'type':db[_0xfc7a('0x87')][_0xfc7a('0x78')][_0xfc7a('0x79')],'raw':!![]})[_0xfc7a('0x11')](function(_0x1e445c){return _0x1e445c;});})['then'](function(_0x4c3076){if(_0x4c3076){_0x401b5c['message']['contact']=_0x4c3076[0x0];if(!_0x293032['body'][_0xfc7a('0x6a')])return;return db[_0xfc7a('0x7a')][_0xfc7a('0x42')]({'where':{'id':_0x293032[_0xfc7a('0x43')][_0xfc7a('0x6a')],'role':_0xfc7a('0x7b')},'attributes':['id','name','fullname',_0xfc7a('0x7c'),_0xfc7a('0x7d')],'raw':!![]});}return null;})[_0xfc7a('0x11')](function(_0x225718){if(!_0x225718)return null;_0x401b5c['message'][_0xfc7a('0x7b')]=_0x225718;return _0x401b5c;})[_0xfc7a('0x11')](function(_0x42cd8f){if(_0x42cd8f){_0x42cd8f[_0xfc7a('0x1a')][_0xfc7a('0x88')]=util[_0xfc7a('0x65')](_0xfc7a('0x89'),_0x293032[_0xfc7a('0x5c')][_0xfc7a('0x27')]);_0x42cd8f[_0xfc7a('0x1a')][_0xfc7a('0x7f')]=_0x401b5c['channel'];_0x42cd8f[_0xfc7a('0x1a')][_0xfc7a('0x8a')]=_0x401b5c[_0xfc7a('0x7f')];_0x42cd8f[_0xfc7a('0x1a')]['event']=_0xfc7a('0x8b');_0x42cd8f[_0xfc7a('0x1a')][_0xfc7a('0x43')]=htmlToText[_0xfc7a('0x81')](_0x401b5c[_0xfc7a('0x1a')][_0xfc7a('0x43')]);respondWithRpcPromise(_0xfc7a('0x82'),'EventManager',{'event':_0xfc7a('0x8c'),'message':_0x42cd8f[_0xfc7a('0x1a')]},client9002);return _0x401b5c;}return null;})[_0xfc7a('0x11')](respondWithResult(_0x37eeba,null))[_0xfc7a('0x1c')](handleError(_0x37eeba,null));};exports[_0xfc7a('0x8d')]=function(_0xb980fe,_0x141bba){var _0x2a617e=moment()[_0xfc7a('0x8e')]()['toString']();var _0x486e59=path[_0xfc7a('0x5e')](config[_0xfc7a('0x8f')],_0xfc7a('0x90'),_0xfc7a('0x91'),'tmp');var _0xbfe388=path[_0xfc7a('0x5e')](config[_0xfc7a('0x8f')],_0xfc7a('0x90'),_0xfc7a('0x91'),_0xfc7a('0x5d'));var _0x5afcdf=util[_0xfc7a('0x65')]('message-%s.eml',_0x2a617e);return db['MailMessage'][_0xfc7a('0x42')]({'where':{'id':_0xb980fe[_0xfc7a('0x41')]['id']},'attributes':['id',_0xfc7a('0x43'),'from','to','cc',_0xfc7a('0x92'),'subject',_0xfc7a('0x93')],'include':_0xb980fe['query'][_0xfc7a('0x5d')]?[{'model':db[_0xfc7a('0x94')],'as':_0xfc7a('0x95')}]:undefined})[_0xfc7a('0x11')](handleEntityNotFound(_0x141bba,null))[_0xfc7a('0x11')](function(_0x5a3be2){if(_0x5a3be2){var _0x275117=_0x5a3be2;var _0x34e3af={'from':_0x275117[_0xfc7a('0x96')],'to':_0x275117['to'],'subject':_0x275117[_0xfc7a('0x97')],'html':htmlEntities[_0xfc7a('0x98')](_0x275117[_0xfc7a('0x43')]),'headers':{'Date':moment(_0x275117[_0xfc7a('0x93')])[_0xfc7a('0x65')](_0xfc7a('0x99'))},'attachments':[]};if(_0x5a3be2['cc']){_0x34e3af[_0xfc7a('0x9a')]['Cc']=_0x5a3be2['cc'];}if(_0x5a3be2[_0xfc7a('0x92')]){_0x34e3af[_0xfc7a('0x9a')][_0xfc7a('0x9b')]=_0x5a3be2[_0xfc7a('0x92')];}return new BPromise(function(_0x140222,_0x22bf34){if(_0x5a3be2['Attachments']){for(var _0x1707cf=0x0;_0x1707cf<_0x5a3be2[_0xfc7a('0x95')][_0xfc7a('0x34')];_0x1707cf++){var _0xf5b531=_0x5a3be2['Attachments'][_0x1707cf];var _0x32e3f1=path[_0xfc7a('0x5e')](_0xbfe388,_0xf5b531[_0xfc7a('0x5f')]);if(fs['existsSync'](_0x32e3f1)){_0x34e3af[_0xfc7a('0x5d')][_0xfc7a('0x9c')]({'name':_0xf5b531[_0xfc7a('0x27')],'contentType':_0xf5b531[_0xfc7a('0x9d')],'data':fs[_0xfc7a('0x9e')](_0x32e3f1)});}}}emlformat[_0xfc7a('0x9f')](_0x34e3af,function(_0x513df4,_0x382c4d){if(_0x513df4)return _0x22bf34(_0x513df4);fs[_0xfc7a('0xa0')](path[_0xfc7a('0x5e')](_0x486e59,_0x5afcdf),_0x382c4d);return _0x140222(_0x382c4d);});});}})['then'](function(_0x3fb6f9){if(_0x3fb6f9){return _0x141bba[_0xfc7a('0x8d')](path[_0xfc7a('0x5e')](_0x486e59,_0x5afcdf),_0x5afcdf,function(_0x1ec894){if(!_0x1ec894)fs[_0xfc7a('0xa1')](path[_0xfc7a('0x5e')](_0x486e59,_0x5afcdf));});}})[_0xfc7a('0x1c')](handleError(_0x141bba,null));}; \ No newline at end of file +var _0x9529=['json','offset','undefined','limit','Content-Range','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','rows','params','include','options','find','update','body','describe','create','out','secret','split','MailAccount','MailAccountId','CmList','List','CmContact','Contacts','DESC','MailServerOut','Smtp','host','port','secure','authentication','auth','service','user','pass','attachments','join','server/files/attachments','defaults','List\x20not\x20found','SendMail','sendMail','messageId','accept','mail','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','MailInteraction','MailInteractionId','interaction','null','AcceptMessage','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','internal','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','get','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','QueryTypes','email','interface','SIP/%s','rejectmessage','download','unix','server','files','tmp','root','from','createdAt','Attachment','Attachments','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','util','path','lodash','ioredis','api','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailMessage.socket','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status'];(function(_0x2de2c5,_0x47e417){var _0x1c496f=function(_0x3f5f35){while(--_0x3f5f35){_0x2de2c5['push'](_0x2de2c5['shift']());}};_0x1c496f(++_0x47e417);}(_0x9529,0x85));var _0x9952=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9529[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x9952('0x0'));var moment=require(_0x9952('0x1'));var BPromise=require('bluebird');var util=require(_0x9952('0x2'));var path=require(_0x9952('0x3'));var fs=require('fs');var _=require(_0x9952('0x4'));var Redis=require(_0x9952('0x5'));var htmlToText=require('html-to-text');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x9952('0x6'));var interaction_log=require(_0x9952('0x7'))(_0x9952('0x8'));var config=require(_0x9952('0x9'));var db=require(_0x9952('0xa'))['db'];config[_0x9952('0xb')]=_['defaults'](config['redis'],{'host':_0x9952('0xc'),'port':0x18eb});var socket=require(_0x9952('0xd'))(new Redis(config['redis']));var htmlEntities=require('html-entities');require(_0x9952('0xe'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x9952('0xf')]['http']({'port':0x232c});var client9003=jayson['client'][_0x9952('0x10')]({'port':0x232b});var client9002=jayson[_0x9952('0xf')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41931a,_0x1e7a00,_0x254a3b,_0x4a043c){return new BPromise(function(_0x2aa3e0,_0x2bf9d6){var _0x3a7493=_0x4a043c||client;return _0x3a7493[_0x9952('0x11')](_0x41931a,_0x254a3b)[_0x9952('0x12')](function(_0x200f2d){logger[_0x9952('0x13')](_0x9952('0x14'),_0x1e7a00,_0x9952('0x15'));logger[_0x9952('0x16')](_0x9952('0x17'),_0x1e7a00,_0x9952('0x15'),JSON[_0x9952('0x18')](_0x200f2d));if(_0x200f2d[_0x9952('0x19')]){if(_0x200f2d['error'][_0x9952('0x1a')]===0x1f4){logger[_0x9952('0x19')]('MailMessage,\x20%s,\x20%s',_0x1e7a00,_0x200f2d[_0x9952('0x19')][_0x9952('0x1b')]);return _0x2bf9d6(_0x200f2d[_0x9952('0x19')][_0x9952('0x1b')]);}logger['error'](_0x9952('0x14'),_0x1e7a00,_0x200f2d[_0x9952('0x19')][_0x9952('0x1b')]);return _0x2aa3e0(_0x200f2d[_0x9952('0x19')]['message']);}else{logger['info'](_0x9952('0x14'),_0x1e7a00,_0x9952('0x15'));_0x2aa3e0(_0x200f2d[_0x9952('0x1c')][_0x9952('0x1b')]);}})[_0x9952('0x1d')](function(_0x59a4d4){logger[_0x9952('0x19')](_0x9952('0x14'),_0x1e7a00,_0x59a4d4);_0x2bf9d6(_0x59a4d4);});});}function respondWithResult(_0x3b603a,_0x268d0d){_0x268d0d=_0x268d0d||0xc8;return function(_0x39aa5c){if(_0x39aa5c){return _0x3b603a[_0x9952('0x1e')](_0x268d0d)[_0x9952('0x1f')](_0x39aa5c);}};}function respondWithFilteredResult(_0x5b1ca0,_0x4c36a7){return function(_0x42039f){if(_0x42039f){var _0x28566e=typeof _0x4c36a7[_0x9952('0x20')]===_0x9952('0x21')&&typeof _0x4c36a7[_0x9952('0x22')]===_0x9952('0x21');var _0x5a6481=_0x42039f['count'];var _0x31d227=_0x28566e?0x0:_0x4c36a7['offset'];var _0x528354=_0x28566e?_0x42039f['count']:_0x4c36a7['offset']+_0x4c36a7[_0x9952('0x22')];var _0x531625;if(_0x528354>=_0x5a6481){_0x528354=_0x5a6481;_0x531625=0xc8;}else{_0x531625=0xce;}_0x5b1ca0[_0x9952('0x1e')](_0x531625);return _0x5b1ca0['set'](_0x9952('0x23'),_0x31d227+'-'+_0x528354+'/'+_0x5a6481)['json'](_0x42039f);}return null;};}function saveUpdates(_0x27c41b){return function(_0x418f42){if(_0x418f42){return _0x418f42['update'](_0x27c41b)[_0x9952('0x12')](function(_0xa60a85){return _0xa60a85;});}return null;};}function removeEntity(_0x44fb39){return function(_0x48ba2a){if(_0x48ba2a){return _0x48ba2a[_0x9952('0x24')]()[_0x9952('0x12')](function(){_0x44fb39[_0x9952('0x1e')](0xcc)[_0x9952('0x25')]();});}};}function handleEntityNotFound(_0x316b87){return function(_0x53b39c){if(!_0x53b39c){_0x316b87[_0x9952('0x26')](0x194);}return _0x53b39c;};}function handleError(_0x1af6a9,_0x573344){_0x573344=_0x573344||0x1f4;return function(_0x30a161){logger[_0x9952('0x19')](_0x30a161[_0x9952('0x27')]);if(_0x30a161[_0x9952('0x28')]){delete _0x30a161[_0x9952('0x28')];}_0x1af6a9[_0x9952('0x1e')](_0x573344)[_0x9952('0x29')](_0x30a161);};}exports[_0x9952('0x2a')]=function(_0x3cef3b,_0x1b38a7){var _0x2d16c5={},_0x1d12dc={},_0x5c05a7={'count':0x0,'rows':[]};var _0x283e69=_[_0x9952('0x2b')](db[_0x9952('0x2c')][_0x9952('0x2d')],function(_0x46d218){return{'name':_0x46d218[_0x9952('0x2e')],'type':_0x46d218[_0x9952('0x2f')][_0x9952('0x30')]};});_0x1d12dc['model']=_['map'](_0x283e69,_0x9952('0x28'));_0x1d12dc[_0x9952('0x31')]=_[_0x9952('0x32')](_0x3cef3b[_0x9952('0x31')]);_0x1d12dc[_0x9952('0x33')]=_[_0x9952('0x34')](_0x1d12dc[_0x9952('0x35')],_0x1d12dc[_0x9952('0x31')]);_0x2d16c5[_0x9952('0x36')]=_[_0x9952('0x34')](_0x1d12dc[_0x9952('0x35')],qs[_0x9952('0x37')](_0x3cef3b['query'][_0x9952('0x37')]));_0x2d16c5[_0x9952('0x36')]=_0x2d16c5['attributes'][_0x9952('0x38')]?_0x2d16c5[_0x9952('0x36')]:_0x1d12dc[_0x9952('0x35')];if(!_0x3cef3b[_0x9952('0x31')]['hasOwnProperty'](_0x9952('0x39'))){_0x2d16c5['limit']=qs[_0x9952('0x22')](_0x3cef3b[_0x9952('0x31')][_0x9952('0x22')]);_0x2d16c5[_0x9952('0x20')]=qs[_0x9952('0x20')](_0x3cef3b['query'][_0x9952('0x20')]);}_0x2d16c5[_0x9952('0x3a')]=qs[_0x9952('0x3b')](_0x3cef3b[_0x9952('0x31')]['sort']);_0x2d16c5[_0x9952('0x3c')]=qs[_0x9952('0x33')](_[_0x9952('0x3d')](_0x3cef3b[_0x9952('0x31')],_0x1d12dc[_0x9952('0x33')]),_0x283e69);if(_0x3cef3b[_0x9952('0x31')][_0x9952('0x3e')]){_0x2d16c5[_0x9952('0x3c')]=_[_0x9952('0x3f')](_0x2d16c5[_0x9952('0x3c')],{'$or':_[_0x9952('0x2b')](_0x283e69,function(_0x54d267){if(_0x54d267['type']!==_0x9952('0x40')){var _0x35b27c={};_0x35b27c[_0x54d267[_0x9952('0x28')]]={'$like':'%'+_0x3cef3b[_0x9952('0x31')][_0x9952('0x3e')]+'%'};return _0x35b27c;}})});}_0x2d16c5=_['merge']({},_0x2d16c5,_0x3cef3b['options']);var _0x125be9={'where':_0x2d16c5[_0x9952('0x3c')]};return db[_0x9952('0x2c')][_0x9952('0x41')](_0x125be9)['then'](function(_0x35c236){_0x5c05a7[_0x9952('0x41')]=_0x35c236;if(_0x3cef3b[_0x9952('0x31')][_0x9952('0x42')]){_0x2d16c5['include']=[{'all':!![]}];}return db[_0x9952('0x2c')]['findAll'](_0x2d16c5);})[_0x9952('0x12')](function(_0x37b346){_0x5c05a7[_0x9952('0x43')]=_0x37b346;return _0x5c05a7;})[_0x9952('0x12')](respondWithFilteredResult(_0x1b38a7,_0x2d16c5))[_0x9952('0x1d')](handleError(_0x1b38a7,null));};exports['show']=function(_0xd6565f,_0x250ef2){var _0x361322={'raw':!![],'where':{'id':_0xd6565f[_0x9952('0x44')]['id']}},_0x3b5cbe={};_0x3b5cbe[_0x9952('0x35')]=_[_0x9952('0x32')](db[_0x9952('0x2c')][_0x9952('0x2d')]);_0x3b5cbe['query']=_[_0x9952('0x32')](_0xd6565f[_0x9952('0x31')]);_0x3b5cbe['filters']=_['intersection'](_0x3b5cbe[_0x9952('0x35')],_0x3b5cbe[_0x9952('0x31')]);_0x361322['attributes']=_[_0x9952('0x34')](_0x3b5cbe[_0x9952('0x35')],qs[_0x9952('0x37')](_0xd6565f['query']['fields']));_0x361322[_0x9952('0x36')]=_0x361322['attributes'][_0x9952('0x38')]?_0x361322[_0x9952('0x36')]:_0x3b5cbe['model'];if(_0xd6565f[_0x9952('0x31')][_0x9952('0x42')]){_0x361322[_0x9952('0x45')]=[{'all':!![]}];}_0x361322=_['merge']({},_0x361322,_0xd6565f[_0x9952('0x46')]);return db[_0x9952('0x2c')][_0x9952('0x47')](_0x361322)[_0x9952('0x12')](handleEntityNotFound(_0x250ef2,null))['then'](respondWithResult(_0x250ef2,null))[_0x9952('0x1d')](handleError(_0x250ef2,null));};exports[_0x9952('0x48')]=function(_0x1ed06a,_0x24910c){if(_0x1ed06a['body']['id']){delete _0x1ed06a['body']['id'];}return db['MailMessage'][_0x9952('0x47')]({'where':{'id':_0x1ed06a['params']['id']}})[_0x9952('0x12')](handleEntityNotFound(_0x24910c,null))[_0x9952('0x12')](saveUpdates(_0x1ed06a[_0x9952('0x49')],null))['then'](respondWithResult(_0x24910c,null))[_0x9952('0x1d')](handleError(_0x24910c,null));};exports['destroy']=function(_0x49eac5,_0xbab88e){return db[_0x9952('0x2c')][_0x9952('0x47')]({'where':{'id':_0x49eac5[_0x9952('0x44')]['id']}})[_0x9952('0x12')](handleEntityNotFound(_0xbab88e,null))[_0x9952('0x12')](removeEntity(_0xbab88e,null))[_0x9952('0x1d')](handleError(_0xbab88e,null));};exports[_0x9952('0x4a')]=function(_0x4f8903,_0x9aef06){return db[_0x9952('0x2c')][_0x9952('0x4a')]()[_0x9952('0x12')](respondWithResult(_0x9aef06,null))[_0x9952('0x1d')](handleError(_0x9aef06,null));};exports[_0x9952('0x4b')]=function(_0x27fbe5,_0x4cde3){return db['MailMessage'][_0x9952('0x4b')](_0x27fbe5['body'])[_0x9952('0x12')](function(_0xed03b7){if(_0xed03b7){if(_0xed03b7['direction']===_0x9952('0x4c')&&!_0xed03b7[_0x9952('0x4d')]){var _0x2d3397,_0x56fcff,_0xc944be;if(_0x27fbe5[_0x9952('0x49')]['to']){_0x56fcff=_0x27fbe5[_0x9952('0x49')]['to'][_0x9952('0x4e')](',')[0x0];}return db[_0x9952('0x4f')]['findOne']({'where':{'id':_0xed03b7[_0x9952('0x50')]},'include':[{'model':db[_0x9952('0x51')],'as':_0x9952('0x52'),'include':[{'model':db[_0x9952('0x53')],'as':_0x9952('0x54'),'where':{'email':_0x56fcff},'limit':0x1,'order':[['updatedAt',_0x9952('0x55')]]}]},{'model':db[_0x9952('0x56')],'as':'Smtp','raw':!![]}]})[_0x9952('0x12')](function(_0x27f4ed){_0x2d3397=_0x27f4ed;if(_0x2d3397&&_0x2d3397[_0x9952('0x57')]){var _0x589ca2={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x2d3397[_0x9952('0x57')]['service'])){_0x589ca2[_0x9952('0x58')]=_0x2d3397[_0x9952('0x57')][_0x9952('0x58')];_0x589ca2[_0x9952('0x59')]=_0x2d3397[_0x9952('0x57')][_0x9952('0x59')];_0x589ca2[_0x9952('0x5a')]=_0x2d3397[_0x9952('0x57')][_0x9952('0x5a')];if(_0x2d3397[_0x9952('0x57')][_0x9952('0x5b')]){_0x589ca2[_0x9952('0x5c')]={'user':_0x2d3397[_0x9952('0x57')]['user'],'pass':_0x2d3397['Smtp']['pass']};}}else{_0x589ca2[_0x9952('0x5d')]=_0x2d3397[_0x9952('0x57')][_0x9952('0x5d')];_0x589ca2['auth']={'user':_0x2d3397[_0x9952('0x57')][_0x9952('0x5e')],'pass':_0x2d3397[_0x9952('0x57')][_0x9952('0x5f')]};_0x589ca2[_0x9952('0x5a')]=_0x2d3397[_0x9952('0x57')]['secure'];}if(_0x27fbe5[_0x9952('0x49')][_0x9952('0x60')]&&_0x27fbe5[_0x9952('0x49')][_0x9952('0x60')][_0x9952('0x38')]){for(var _0x4cac1d=0x0;_0x4cac1d<_0x27fbe5['body'][_0x9952('0x60')][_0x9952('0x38')];_0x4cac1d+=0x1){_0x27fbe5[_0x9952('0x49')]['attachments'][_0x4cac1d]={'filename':_0x27fbe5[_0x9952('0x49')][_0x9952('0x60')][_0x4cac1d][_0x9952('0x28')],'path':path[_0x9952('0x61')](config['root'],_0x9952('0x62'),_0x27fbe5[_0x9952('0x49')][_0x9952('0x60')][_0x4cac1d]['basename'])};}}_0xc944be={'account':_0x589ca2,'message':_0x27fbe5['body']};return;}})[_0x9952('0x12')](function(){if(_0x2d3397[_0x9952('0x52')]){if(_0x2d3397[_0x9952('0x52')][_0x9952('0x54')][_0x9952('0x38')]){return _0x2d3397['List']['Contacts'][0x0];}else{return db[_0x9952('0x53')][_0x9952('0x4b')](_[_0x9952('0x63')](_0x27fbe5['body'],{'firstName':_0x27fbe5[_0x9952('0x49')]['to'],'email':_0x27fbe5[_0x9952('0x49')]['to'],'phone':_0x27fbe5[_0x9952('0x49')]['to'],'ListId':_0x2d3397['ListId']}));}}else{throw new Error(_0x9952('0x64'));}})[_0x9952('0x12')](function(){if(_0xc944be){return respondWithRpcPromise(_0x9952('0x65'),_0x9952('0x66'),_0xc944be,client9003)[_0x9952('0x12')](function(_0x109e66){return _0xed03b7['update']({'read':!![],'messageId':_0x109e66[_0x9952('0x67')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x9952('0x1d')](function(_0x3c16e3){logger['error']('%s',JSON[_0x9952('0x18')](_0x3c16e3));return _0xed03b7;});}return _0xed03b7;});}return _0xed03b7;}})[_0x9952('0x12')](respondWithResult(_0x4cde3,0xc9))[_0x9952('0x1d')](handleError(_0x4cde3,null));};exports[_0x9952('0x68')]=function(_0x4543ae,_0x3e88d2){var _0x19dfe5={'agent':{},'channel':_0x9952('0x69')};if(_0x4543ae['body']['id']){delete _0x4543ae[_0x9952('0x49')]['id'];}_0x4543ae[_0x9952('0x49')][_0x9952('0x6a')]=!![];_0x4543ae[_0x9952('0x49')][_0x9952('0x6b')]=moment()[_0x9952('0x6c')](_0x9952('0x6d'));_0x4543ae[_0x9952('0x49')]['UserId']=_0x4543ae[_0x9952('0x49')][_0x9952('0x6e')]||_0x4543ae[_0x9952('0x5e')]['id'];_0x19dfe5[_0x9952('0x6f')]['id']=_0x4543ae[_0x9952('0x49')][_0x9952('0x6e')];return db[_0x9952('0x2c')][_0x9952('0x47')]({'where':{'id':_0x4543ae[_0x9952('0x44')]['id'],'UserId':null}})[_0x9952('0x12')](handleEntityNotFound(_0x3e88d2,null))[_0x9952('0x12')](saveUpdates(_0x4543ae[_0x9952('0x49')],null))['then'](function(_0x24bf58){if(_0x24bf58){_0x19dfe5[_0x9952('0x1b')]=_0x24bf58['get']({'plain':!![]});return db[_0x9952('0x70')][_0x9952('0x47')]({'where':{'id':_0x24bf58[_0x9952('0x71')]}});}return null;})[_0x9952('0x12')](handleEntityNotFound(_0x3e88d2,null))[_0x9952('0x12')](function(_0x591a68){if(_0x591a68){return _0x591a68[_0x9952('0x48')]({'UserId':_0x4543ae[_0x9952('0x49')][_0x9952('0x6e')],'read1stAt':_['isNil'](_0x591a68['read1stAt'])?moment()['format'](_0x9952('0x6d')):undefined});}return null;})[_0x9952('0x12')](function(_0x46b2d2){if(_0x46b2d2){_0x19dfe5[_0x9952('0x72')]=_0x46b2d2['get']({'plain':!![]});interaction_log[_0x9952('0x13')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4543ae['user']['id'],_0x4543ae[_0x9952('0x5e')][_0x9952('0x28')],_0x4543ae[_0x9952('0x5e')]['role'],_0x19dfe5[_0x9952('0x72')]['id'],_0x4543ae[_0x9952('0x49')]?JSON[_0x9952('0x18')](_0x4543ae[_0x9952('0x49')]):_0x9952('0x73'));return respondWithRpcPromise(_0x9952('0x74'),'acceptMessage',_0x19dfe5);}return null;})[_0x9952('0x12')](function(_0x565ebc){var _0xd41531='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x565ebc[_0x9952('0x1b')][_0x9952('0x75')];return db[_0x9952('0x76')][_0x9952('0x31')](_0xd41531,{'type':db[_0x9952('0x77')]['QueryTypes'][_0x9952('0x78')],'raw':!![]})[_0x9952('0x12')](function(_0x30deb5){return _0x30deb5;});})[_0x9952('0x12')](function(_0x5aeaa1){if(_0x5aeaa1){_0x19dfe5[_0x9952('0x1b')][_0x9952('0x79')]=_0x5aeaa1[0x0];if(!_0x4543ae['body'][_0x9952('0x6e')])return;return db[_0x9952('0x7a')]['find']({'where':{'id':_0x4543ae[_0x9952('0x49')][_0x9952('0x6e')],'role':_0x9952('0x6f')},'attributes':['id',_0x9952('0x28'),_0x9952('0x7b'),'email',_0x9952('0x7c')],'raw':!![]});}return null;})[_0x9952('0x12')](function(_0x4de13d){if(!_0x4de13d)return null;_0x19dfe5[_0x9952('0x1b')]['agent']=_0x4de13d;return _0x19dfe5;})[_0x9952('0x12')](function(_0x220257){if(_0x220257){if(_0x4543ae[_0x9952('0x49')]['manual']){_0x19dfe5['message']['interface']=util['format']('SIP/%s',_0x4543ae[_0x9952('0x5e')][_0x9952('0x28')]);_0x19dfe5[_0x9952('0x1b')][_0x9952('0x7d')]=_0x19dfe5[_0x9952('0x7d')];_0x19dfe5['message'][_0x9952('0x7e')]=_0x19dfe5[_0x9952('0x7d')];_0x19dfe5[_0x9952('0x1b')][_0x9952('0x7f')]=_0x9952('0x68');_0x19dfe5[_0x9952('0x1b')][_0x9952('0x49')]=htmlToText[_0x9952('0x80')](_0x19dfe5[_0x9952('0x1b')][_0x9952('0x49')]);return respondWithRpcPromise(_0x9952('0x81'),_0x9952('0x81'),{'event':_0x9952('0x82'),'message':_0x19dfe5[_0x9952('0x1b')]},client9002)[_0x9952('0x12')](function(){return _0x19dfe5;});}return _0x19dfe5;}return null;})[_0x9952('0x12')](respondWithResult(_0x3e88d2,null))[_0x9952('0x1d')](handleError(_0x3e88d2,null));};exports[_0x9952('0x83')]=function(_0x787adb,_0x5648c1){var _0x41b2bd={'agent':{},'channel':_0x9952('0x69')};if(_0x787adb[_0x9952('0x49')]['id']){delete _0x787adb[_0x9952('0x49')]['id'];}_0x787adb[_0x9952('0x49')][_0x9952('0x6e')]=_0x787adb[_0x9952('0x49')][_0x9952('0x6e')]||_0x787adb['user']['id'];_0x41b2bd[_0x9952('0x6f')]['id']=_0x787adb[_0x9952('0x49')]['UserId'];return db[_0x9952('0x2c')][_0x9952('0x47')]({'where':{'id':_0x787adb[_0x9952('0x44')]['id'],'UserId':null}})[_0x9952('0x12')](handleEntityNotFound(_0x5648c1,null))[_0x9952('0x12')](function(_0x1899da){if(_0x1899da){_0x41b2bd[_0x9952('0x1b')]=_0x1899da[_0x9952('0x84')]({'plain':!![]});return db[_0x9952('0x70')][_0x9952('0x47')]({'where':{'id':_0x1899da[_0x9952('0x71')]}});}return null;})[_0x9952('0x12')](handleEntityNotFound(_0x5648c1,null))[_0x9952('0x12')](function(_0x42654d){if(_0x42654d){_0x41b2bd[_0x9952('0x72')]=_0x42654d[_0x9952('0x84')]({'plain':!![]});interaction_log[_0x9952('0x13')](_0x9952('0x85'),_0x787adb[_0x9952('0x5e')]['id'],_0x787adb[_0x9952('0x5e')][_0x9952('0x28')],_0x787adb[_0x9952('0x5e')][_0x9952('0x86')],_0x41b2bd[_0x9952('0x72')]['id'],_0x787adb[_0x9952('0x49')]?JSON[_0x9952('0x18')](_0x787adb['body']):'null');return respondWithRpcPromise(_0x9952('0x87'),_0x9952('0x88'),_0x41b2bd);}return null;})[_0x9952('0x12')](function(_0xcc8e0b){var _0x26d46d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xcc8e0b['message'][_0x9952('0x75')];return db[_0x9952('0x76')]['query'](_0x26d46d,{'type':db[_0x9952('0x77')][_0x9952('0x89')]['SELECT'],'raw':!![]})[_0x9952('0x12')](function(_0xe46820){return _0xe46820;});})[_0x9952('0x12')](function(_0x15b502){if(_0x15b502){_0x41b2bd['message'][_0x9952('0x79')]=_0x15b502[0x0];if(!_0x787adb['body'][_0x9952('0x6e')])return;return db[_0x9952('0x7a')][_0x9952('0x47')]({'where':{'id':_0x787adb[_0x9952('0x49')]['UserId'],'role':_0x9952('0x6f')},'attributes':['id',_0x9952('0x28'),'fullname',_0x9952('0x8a'),_0x9952('0x7c')],'raw':!![]});}return null;})[_0x9952('0x12')](function(_0x252e10){if(!_0x252e10)return null;_0x41b2bd[_0x9952('0x1b')][_0x9952('0x6f')]=_0x252e10;return _0x41b2bd;})['then'](function(_0x16cc6a){if(_0x16cc6a){_0x16cc6a[_0x9952('0x1b')][_0x9952('0x8b')]=util['format'](_0x9952('0x8c'),_0x787adb[_0x9952('0x5e')][_0x9952('0x28')]);_0x16cc6a['message'][_0x9952('0x7d')]=_0x41b2bd[_0x9952('0x7d')];_0x16cc6a['message'][_0x9952('0x7e')]=_0x41b2bd['channel'];_0x16cc6a['message']['event']=_0x9952('0x83');_0x16cc6a[_0x9952('0x1b')][_0x9952('0x49')]=htmlToText[_0x9952('0x80')](_0x41b2bd[_0x9952('0x1b')][_0x9952('0x49')]);respondWithRpcPromise(_0x9952('0x81'),_0x9952('0x81'),{'event':_0x9952('0x8d'),'message':_0x16cc6a['message']},client9002);return _0x41b2bd;}return null;})['then'](respondWithResult(_0x5648c1,null))[_0x9952('0x1d')](handleError(_0x5648c1,null));};exports[_0x9952('0x8e')]=function(_0x21cbb0,_0x214811){var _0x4fcd23=moment()[_0x9952('0x8f')]()['toString']();var _0xcb4443=path[_0x9952('0x61')](config['root'],_0x9952('0x90'),_0x9952('0x91'),_0x9952('0x92'));var _0x15f558=path[_0x9952('0x61')](config[_0x9952('0x93')],_0x9952('0x90'),_0x9952('0x91'),'attachments');var _0x36d009=util[_0x9952('0x6c')]('message-%s.eml',_0x4fcd23);return db[_0x9952('0x2c')]['find']({'where':{'id':_0x21cbb0[_0x9952('0x44')]['id']},'attributes':['id',_0x9952('0x49'),_0x9952('0x94'),'to','cc','bcc','subject',_0x9952('0x95')],'include':_0x21cbb0[_0x9952('0x31')][_0x9952('0x60')]?[{'model':db[_0x9952('0x96')],'as':_0x9952('0x97')}]:undefined})[_0x9952('0x12')](handleEntityNotFound(_0x214811,null))[_0x9952('0x12')](function(_0x5576fd){if(_0x5576fd){var _0x3f635d=_0x5576fd;var _0x50f3de={'from':_0x3f635d[_0x9952('0x94')],'to':_0x3f635d['to'],'subject':_0x3f635d[_0x9952('0x98')],'html':htmlEntities[_0x9952('0x99')](_0x3f635d[_0x9952('0x49')]),'headers':{'Date':moment(_0x3f635d['createdAt'])[_0x9952('0x6c')](_0x9952('0x9a'))},'attachments':[]};if(_0x5576fd['cc']){_0x50f3de[_0x9952('0x9b')]['Cc']=_0x5576fd['cc'];}if(_0x5576fd[_0x9952('0x9c')]){_0x50f3de['headers'][_0x9952('0x9d')]=_0x5576fd['bcc'];}return new BPromise(function(_0x537687,_0x20da42){if(_0x5576fd['Attachments']){for(var _0x54b98e=0x0;_0x54b98e<_0x5576fd[_0x9952('0x97')]['length'];_0x54b98e++){var _0x39b016=_0x5576fd['Attachments'][_0x54b98e];var _0x24af07=path[_0x9952('0x61')](_0x15f558,_0x39b016['basename']);if(fs[_0x9952('0x9e')](_0x24af07)){_0x50f3de[_0x9952('0x60')][_0x9952('0x9f')]({'name':_0x39b016[_0x9952('0x28')],'contentType':_0x39b016[_0x9952('0x2f')],'data':fs[_0x9952('0xa0')](_0x24af07)});}}}emlformat[_0x9952('0xa1')](_0x50f3de,function(_0x1bf928,_0x3af010){if(_0x1bf928)return _0x20da42(_0x1bf928);fs[_0x9952('0xa2')](path['join'](_0xcb4443,_0x36d009),_0x3af010);return _0x537687(_0x3af010);});});}})[_0x9952('0x12')](function(_0x3ba3e0){if(_0x3ba3e0){return _0x214811['download'](path['join'](_0xcb4443,_0x36d009),_0x36d009,function(_0x262eeb){if(!_0x262eeb)fs[_0x9952('0xa3')](path[_0x9952('0x61')](_0xcb4443,_0x36d009));});}})[_0x9952('0x1d')](handleError(_0x214811,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 78cd30d..b5a82c4 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 _0x20e1=['../../mysqldb','MailMessage','setMaxListeners','update','remove','emit','exports','events'];(function(_0x16cebe,_0x2e3f92){var _0xd5a828=function(_0x4309a1){while(--_0x4309a1){_0x16cebe['push'](_0x16cebe['shift']());}};_0xd5a828(++_0x2e3f92);}(_0x20e1,0xf7));var _0x120e=function(_0x454876,_0x580571){_0x454876=_0x454876-0x0;var _0x1084e6=_0x20e1[_0x454876];return _0x1084e6;};'use strict';var EventEmitter=require(_0x120e('0x0'));var MailMessage=require(_0x120e('0x1'))['db'][_0x120e('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x120e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x120e('0x4'),'afterDestroy':_0x120e('0x5')};function emitEvent(_0x547b1f){return function(_0x2242e7,_0xe74c05,_0x2cd809){MailMessageEvents[_0x120e('0x6')](_0x547b1f+':'+_0x2242e7['id'],_0x2242e7);MailMessageEvents[_0x120e('0x6')](_0x547b1f,_0x2242e7);_0x2cd809(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x120e('0x7')]=MailMessageEvents; \ No newline at end of file +var _0x8a2e=['emit','hasOwnProperty','hook','exports','../../mysqldb','MailMessage','setMaxListeners','save','update','remove'];(function(_0x8d7db5,_0x69856){var _0x42cdfd=function(_0x185b61){while(--_0x185b61){_0x8d7db5['push'](_0x8d7db5['shift']());}};_0x42cdfd(++_0x69856);}(_0x8a2e,0x19e));var _0xe8a2=function(_0x3715b6,_0x34d568){_0x3715b6=_0x3715b6-0x0;var _0x44297a=_0x8a2e[_0x3715b6];return _0x44297a;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xe8a2('0x0'))['db'][_0xe8a2('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xe8a2('0x2')](0x0);var events={'afterCreate':_0xe8a2('0x3'),'afterUpdate':_0xe8a2('0x4'),'afterDestroy':_0xe8a2('0x5')};function emitEvent(_0x1e35e3){return function(_0x57574b,_0x25484f,_0x4c1e05){MailMessageEvents[_0xe8a2('0x6')](_0x1e35e3+':'+_0x57574b['id'],_0x57574b);MailMessageEvents[_0xe8a2('0x6')](_0x1e35e3,_0x57574b);_0x4c1e05(null);};}for(var e in events){if(events[_0xe8a2('0x7')](e)){var event=events[e];MailMessage[_0xe8a2('0x8')](e,emitEvent(event));}}module[_0xe8a2('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 85fd930..023efb8 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 _0xb0f2=['error','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','body','plainBody','fromString','models','get','direction','toLowerCase','out','secret','UserId','findOne','MailInteractionId','then','createdAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb0f2,0x85));var _0x2b0f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb0f2[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x2b0f('0x0'));var util=require(_0x2b0f('0x1'));var logger=require(_0x2b0f('0x2'))(_0x2b0f('0x3'));var moment=require(_0x2b0f('0x4'));var BPromise=require(_0x2b0f('0x5'));var rp=require(_0x2b0f('0x6'));var htmlToText=require(_0x2b0f('0x7'));var fs=require('fs');var path=require(_0x2b0f('0x8'));var rimraf=require(_0x2b0f('0x9'));var config=require(_0x2b0f('0xa'));var attributes=require(_0x2b0f('0xb'));module[_0x2b0f('0xc')]=function(_0x12a5a7,_0x2728d0){return _0x12a5a7[_0x2b0f('0xd')](_0x2b0f('0xe'),attributes,{'tableName':_0x2b0f('0xf'),'paranoid':![],'indexes':[{'name':_0x2b0f('0x10'),'fields':['messageId']},{'name':_0x2b0f('0x11'),'fields':['plainBody','subject'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4e0d75,_0x2c6214,_0x237bd9){if(_0x4e0d75[_0x2b0f('0x12')]){_0x4e0d75[_0x2b0f('0x13')]=htmlToText[_0x2b0f('0x14')](_0x4e0d75[_0x2b0f('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x237bd9(null,_0x2c6214);},'afterCreate':function(_0x2aac0a,_0x3692f9,_0x192306){var _0x54d1c9=_0x12a5a7[_0x2b0f('0x15')];var _0x18a78b=_0x2aac0a[_0x2b0f('0x16')]({'plain':!![]});if(_0x18a78b[_0x2b0f('0x17')][_0x2b0f('0x18')]()==='in'||_0x18a78b[_0x2b0f('0x17')]['toLowerCase']()===_0x2b0f('0x19')&&!_0x18a78b[_0x2b0f('0x1a')]&&!_['isNil'](_0x18a78b[_0x2b0f('0x1b')])){_0x54d1c9['MailInteraction'][_0x2b0f('0x1c')]({'where':{'id':_0x18a78b[_0x2b0f('0x1d')]}})[_0x2b0f('0x1e')](function(_0x4b8db1){if(_0x4b8db1){_0x4b8db1['update']({'lastMsgAt':_0x18a78b[_0x2b0f('0x1f')],'lastMsgDirection':_0x18a78b[_0x2b0f('0x17')]['toLowerCase']()});}})['catch'](function(_0x2b1b1d){console[_0x2b0f('0x20')](_0x2b1b1d);});}_0x192306();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa0bc=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','html-to-text','path','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch'];(function(_0x54f9a1,_0xd7842d){var _0x16d888=function(_0x17572f){while(--_0x17572f){_0x54f9a1['push'](_0x54f9a1['shift']());}};_0x16d888(++_0xd7842d);}(_0xa0bc,0x1b2));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xca0b('0x0'));var util=require('util');var logger=require(_0xca0b('0x1'))('api');var moment=require(_0xca0b('0x2'));var BPromise=require(_0xca0b('0x3'));var rp=require(_0xca0b('0x4'));var htmlToText=require(_0xca0b('0x5'));var fs=require('fs');var path=require(_0xca0b('0x6'));var rimraf=require('rimraf');var config=require(_0xca0b('0x7'));var attributes=require(_0xca0b('0x8'));module[_0xca0b('0x9')]=function(_0x8a19d9,_0x42cda3){return _0x8a19d9[_0xca0b('0xa')](_0xca0b('0xb'),attributes,{'tableName':_0xca0b('0xc'),'paranoid':![],'indexes':[{'name':_0xca0b('0xd'),'fields':[_0xca0b('0xd')]},{'name':_0xca0b('0xe'),'fields':[_0xca0b('0xf'),_0xca0b('0x10')],'type':_0xca0b('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x16a0af,_0xc5538a,_0x5e2a11){if(_0x16a0af[_0xca0b('0x12')]){_0x16a0af['plainBody']=htmlToText[_0xca0b('0x13')](_0x16a0af[_0xca0b('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5e2a11(null,_0xc5538a);},'afterCreate':function(_0x463c5d,_0x40dedb,_0x2b28a8){var _0x565826=_0x8a19d9[_0xca0b('0x14')];var _0x1f7ed3=_0x463c5d['get']({'plain':!![]});if(_0x1f7ed3[_0xca0b('0x15')]['toLowerCase']()==='in'||_0x1f7ed3[_0xca0b('0x15')][_0xca0b('0x16')]()===_0xca0b('0x17')&&!_0x1f7ed3[_0xca0b('0x18')]&&!_[_0xca0b('0x19')](_0x1f7ed3[_0xca0b('0x1a')])){_0x565826[_0xca0b('0x1b')][_0xca0b('0x1c')]({'where':{'id':_0x1f7ed3[_0xca0b('0x1d')]}})[_0xca0b('0x1e')](function(_0x1bbe46){if(_0x1bbe46){_0x1bbe46[_0xca0b('0x1f')]({'lastMsgAt':_0x1f7ed3[_0xca0b('0x20')],'lastMsgDirection':_0x1f7ed3[_0xca0b('0x15')]['toLowerCase']()});}})[_0xca0b('0x21')](function(_0x3889be){console['error'](_0x3889be);});}_0x2b28a8();}},'charset':_0xca0b('0x22'),'collate':_0xca0b('0x23')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 70e7e4d..e3ce60e 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 _0xb62e=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','options','raw','lodash','util'];(function(_0x56b725,_0x225a12){var _0x105986=function(_0xc2f36b){while(--_0xc2f36b){_0x56b725['push'](_0x56b725['shift']());}};_0x105986(++_0x225a12);}(_0xb62e,0x1de));var _0xeb62=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb62e[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var moment=require(_0xeb62('0x2'));var BPromise=require(_0xeb62('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb62('0x4'));var db=require(_0xeb62('0x5'))['db'];var utils=require(_0xeb62('0x6'));var logger=require(_0xeb62('0x7'))(_0xeb62('0x8'));var config=require(_0xeb62('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb62('0xa')][_0xeb62('0xb')]({'port':0x232a});config[_0xeb62('0xc')]=_['defaults'](config[_0xeb62('0xc')],{'host':_0xeb62('0xd'),'port':0x18eb});var socket=require(_0xeb62('0xe'))(new Redis(config[_0xeb62('0xc')]));require('./mailMessage.socket')['register'](socket);function respondWithRpcPromise(_0x4693c9,_0x40584b,_0x6d5e94){return new BPromise(function(_0xf93c21,_0x2fe923){return client[_0xeb62('0xf')](_0x4693c9,_0x6d5e94)[_0xeb62('0x10')](function(_0x3a826a){logger[_0xeb62('0x11')](_0xeb62('0x12'),_0x40584b,'request\x20sent');logger[_0xeb62('0x13')](_0xeb62('0x14'),_0x40584b,_0xeb62('0x15'),JSON[_0xeb62('0x16')](_0x3a826a));if(_0x3a826a['error']){if(_0x3a826a[_0xeb62('0x17')][_0xeb62('0x18')]===0x1f4){logger[_0xeb62('0x17')]('MailMessage,\x20%s,\x20%s',_0x40584b,_0x3a826a[_0xeb62('0x17')][_0xeb62('0x19')]);return _0x2fe923(_0x3a826a[_0xeb62('0x17')]['message']);}logger[_0xeb62('0x17')](_0xeb62('0x12'),_0x40584b,_0x3a826a[_0xeb62('0x17')][_0xeb62('0x19')]);return _0xf93c21(_0x3a826a[_0xeb62('0x17')][_0xeb62('0x19')]);}else{logger[_0xeb62('0x11')](_0xeb62('0x12'),_0x40584b,_0xeb62('0x15'));_0xf93c21(_0x3a826a[_0xeb62('0x1a')][_0xeb62('0x19')]);}})[_0xeb62('0x1b')](function(_0x3cdf76){logger['error'](_0xeb62('0x12'),_0x40584b,_0x3cdf76);_0x2fe923(_0x3cdf76);});});}exports[_0xeb62('0x1c')]=function(_0x332396){var _0xb44905=this;return new Promise(function(_0x425817,_0x24cbf3){return db[_0xeb62('0x1d')]['create'](_0x332396['body'],{'raw':_0x332396[_0xeb62('0x1e')]?_0x332396[_0xeb62('0x1e')][_0xeb62('0x1f')]===undefined?!![]:![]:!![]})[_0xeb62('0x10')](function(_0x122b15){logger['info']('CreateMailMessage',_0x332396);logger[_0xeb62('0x13')](_0xeb62('0x1c'),_0x332396,JSON[_0xeb62('0x16')](_0x122b15));_0x425817(_0x122b15);})[_0xeb62('0x1b')](function(_0x55a169){logger['error'](_0xeb62('0x1c'),_0x55a169['message'],_0x332396);_0x24cbf3(_0xb44905[_0xeb62('0x17')](0x1f4,_0x55a169['message']));});});}; \ No newline at end of file +var _0x47c5=['request','then','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','MailMessage','create','options','info','debug','CreateMailMessage','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register'];(function(_0x22aa3a,_0x2fb1ab){var _0x57dde4=function(_0x35f9d5){while(--_0x35f9d5){_0x22aa3a['push'](_0x22aa3a['shift']());}};_0x57dde4(++_0x2fb1ab);}(_0x47c5,0x165));var _0x547c=function(_0x14305a,_0x55304b){_0x14305a=_0x14305a-0x0;var _0x124349=_0x47c5[_0x14305a];return _0x124349;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});config[_0x547c('0xb')]=_[_0x547c('0xc')](config[_0x547c('0xb')],{'host':_0x547c('0xd'),'port':0x18eb});var socket=require(_0x547c('0xe'))(new Redis(config[_0x547c('0xb')]));require(_0x547c('0xf'))[_0x547c('0x10')](socket);function respondWithRpcPromise(_0x44a581,_0x72828d,_0x2c54e){return new BPromise(function(_0x111457,_0x2455e9){return client[_0x547c('0x11')](_0x44a581,_0x2c54e)[_0x547c('0x12')](function(_0x44ab17){logger['info'](_0x547c('0x13'),_0x72828d,_0x547c('0x14'));logger['debug'](_0x547c('0x15'),_0x72828d,_0x547c('0x14'),JSON[_0x547c('0x16')](_0x44ab17));if(_0x44ab17[_0x547c('0x17')]){if(_0x44ab17[_0x547c('0x17')][_0x547c('0x18')]===0x1f4){logger[_0x547c('0x17')](_0x547c('0x13'),_0x72828d,_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);return _0x2455e9(_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);}logger[_0x547c('0x17')](_0x547c('0x13'),_0x72828d,_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);return _0x111457(_0x44ab17[_0x547c('0x17')][_0x547c('0x19')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x72828d,_0x547c('0x14'));_0x111457(_0x44ab17[_0x547c('0x1a')][_0x547c('0x19')]);}})['catch'](function(_0x248aca){logger[_0x547c('0x17')](_0x547c('0x13'),_0x72828d,_0x248aca);_0x2455e9(_0x248aca);});});}exports['CreateMailMessage']=function(_0x4511d3){var _0x41149f=this;return new Promise(function(_0x496c38,_0x5453f9){return db[_0x547c('0x1b')][_0x547c('0x1c')](_0x4511d3['body'],{'raw':_0x4511d3[_0x547c('0x1d')]?_0x4511d3[_0x547c('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x547c('0x12')](function(_0x17fd97){logger[_0x547c('0x1e')]('CreateMailMessage',_0x4511d3);logger[_0x547c('0x1f')](_0x547c('0x20'),_0x4511d3,JSON[_0x547c('0x16')](_0x17fd97));_0x496c38(_0x17fd97);})[_0x547c('0x21')](function(_0x1f3581){logger[_0x547c('0x17')](_0x547c('0x20'),_0x1f3581[_0x547c('0x19')],_0x4511d3);_0x5453f9(_0x41149f['error'](0x1f4,_0x1f3581[_0x547c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 64b460f..61a3179 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 _0xb201=['mailMessage:','./mailMessage.events','remove','update','emit','removeListener','register','length'];(function(_0x1df473,_0x1a6931){var _0x1bdd49=function(_0x519be6){while(--_0x519be6){_0x1df473['push'](_0x1df473['shift']());}};_0x1bdd49(++_0x1a6931);}(_0xb201,0x1b1));var _0x1b20=function(_0x35ca7d,_0x284a66){_0x35ca7d=_0x35ca7d-0x0;var _0x52fb8a=_0xb201[_0x35ca7d];return _0x52fb8a;};'use strict';var MailMessageEvents=require(_0x1b20('0x0'));var events=['save',_0x1b20('0x1'),_0x1b20('0x2')];function createListener(_0x3c9ef4,_0x30b3a4){return function(_0x43521c){_0x30b3a4[_0x1b20('0x3')](_0x3c9ef4,_0x43521c);};}function removeListener(_0x48d5c9,_0x3aae83){return function(){MailMessageEvents[_0x1b20('0x4')](_0x48d5c9,_0x3aae83);};}exports[_0x1b20('0x5')]=function(_0x4da5a7){for(var _0x29fbc1=0x0,_0x50cdbc=events[_0x1b20('0x6')];_0x29fbc1<_0x50cdbc;_0x29fbc1++){var _0x2a184f=events[_0x29fbc1];var _0x3cc600=createListener(_0x1b20('0x7')+_0x2a184f,_0x4da5a7);MailMessageEvents['on'](_0x2a184f,_0x3cc600);}}; \ No newline at end of file +var _0xb081=['save','emit','removeListener','register','mailMessage:','./mailMessage.events'];(function(_0x240b0a,_0x50335f){var _0x35346a=function(_0x56d904){while(--_0x56d904){_0x240b0a['push'](_0x240b0a['shift']());}};_0x35346a(++_0x50335f);}(_0xb081,0x1a3));var _0x1b08=function(_0x21001b,_0x3ff1a8){_0x21001b=_0x21001b-0x0;var _0x665a00=_0xb081[_0x21001b];return _0x665a00;};'use strict';var MailMessageEvents=require(_0x1b08('0x0'));var events=[_0x1b08('0x1'),'remove','update'];function createListener(_0x3818a7,_0x797a8a){return function(_0xf02374){_0x797a8a[_0x1b08('0x2')](_0x3818a7,_0xf02374);};}function removeListener(_0x29b868,_0xa46b4e){return function(){MailMessageEvents[_0x1b08('0x3')](_0x29b868,_0xa46b4e);};}exports[_0x1b08('0x4')]=function(_0x1e2564){for(var _0x20ad4a=0x0,_0xb0146f=events['length'];_0x20ad4a<_0xb0146f;_0x20ad4a++){var _0x3ff26a=events[_0x20ad4a];var _0x38836=createListener(_0x1b08('0x5')+_0x3ff26a,_0x1e2564);MailMessageEvents['on'](_0x3ff26a,_0x38836);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index c46d637..1247565 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 _0xeebc=['removeAgents','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./mailQueue.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','destroy','delete','removeTeams'];(function(_0x585ee5,_0x1c9dba){var _0x470808=function(_0x35c90d){while(--_0x35c90d){_0x585ee5['push'](_0x585ee5['shift']());}};_0x470808(++_0x1c9dba);}(_0xeebc,0x110));var _0xceeb=function(_0x50d170,_0x338779){_0x50d170=_0x50d170-0x0;var _0x458072=_0xeebc[_0x50d170];return _0x458072;};'use strict';var multer=require('multer');var util=require(_0xceeb('0x0'));var path=require(_0xceeb('0x1'));var timeout=require('connect-timeout');var express=require(_0xceeb('0x2'));var router=express[_0xceeb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xceeb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xceeb('0x5'));var controller=require(_0xceeb('0x6'));router[_0xceeb('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xceeb('0x7')](_0xceeb('0x8'),auth[_0xceeb('0x9')](),controller[_0xceeb('0xa')]);router[_0xceeb('0x7')](_0xceeb('0xb'),auth[_0xceeb('0x9')](),controller[_0xceeb('0xc')]);router[_0xceeb('0x7')](_0xceeb('0xd'),auth[_0xceeb('0x9')](),controller[_0xceeb('0xe')]);router[_0xceeb('0x7')](_0xceeb('0xf'),auth[_0xceeb('0x9')](),controller[_0xceeb('0x10')]);router[_0xceeb('0x7')](_0xceeb('0x11'),auth[_0xceeb('0x9')](),controller[_0xceeb('0x12')]);router[_0xceeb('0x13')]('/',auth['isAuthenticated'](),controller[_0xceeb('0x14')]);router[_0xceeb('0x13')](_0xceeb('0xf'),auth['isAuthenticated'](),controller[_0xceeb('0x15')]);router[_0xceeb('0x13')]('/:id/users',auth[_0xceeb('0x9')](),controller[_0xceeb('0x16')]);router[_0xceeb('0x17')]('/:id',auth[_0xceeb('0x9')](),controller[_0xceeb('0x18')]);router['delete'](_0xceeb('0xb'),auth[_0xceeb('0x9')](),controller[_0xceeb('0x19')]);router[_0xceeb('0x1a')](_0xceeb('0xf'),auth[_0xceeb('0x9')](),controller[_0xceeb('0x1b')]);router[_0xceeb('0x1a')](_0xceeb('0x11'),auth[_0xceeb('0x9')](),controller[_0xceeb('0x1c')]);module[_0xceeb('0x1d')]=router; \ No newline at end of file +var _0xdbe3=['show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','/:id','update','delete','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','/describe','describe','get'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xdbe3,0x13b));var _0x3dbe=function(_0x5ac376,_0x4ae82a){_0x5ac376=_0x5ac376-0x0;var _0x3f4ebd=_0xdbe3[_0x5ac376];return _0x3f4ebd;};'use strict';var multer=require(_0x3dbe('0x0'));var util=require(_0x3dbe('0x1'));var path=require(_0x3dbe('0x2'));var timeout=require('connect-timeout');var express=require(_0x3dbe('0x3'));var router=express[_0x3dbe('0x4')]();var fs_extra=require(_0x3dbe('0x5'));var auth=require(_0x3dbe('0x6'));var interaction=require(_0x3dbe('0x7'));var config=require(_0x3dbe('0x8'));var controller=require(_0x3dbe('0x9'));router['get']('/',auth[_0x3dbe('0xa')](),controller[_0x3dbe('0xb')]);router['get'](_0x3dbe('0xc'),auth[_0x3dbe('0xa')](),controller[_0x3dbe('0xd')]);router[_0x3dbe('0xe')]('/:id',auth[_0x3dbe('0xa')](),controller[_0x3dbe('0xf')]);router[_0x3dbe('0xe')](_0x3dbe('0x10'),auth[_0x3dbe('0xa')](),controller['getMembers']);router['get'](_0x3dbe('0x11'),auth[_0x3dbe('0xa')](),controller[_0x3dbe('0x12')]);router[_0x3dbe('0xe')](_0x3dbe('0x13'),auth[_0x3dbe('0xa')](),controller[_0x3dbe('0x14')]);router[_0x3dbe('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3dbe('0x15')](_0x3dbe('0x11'),auth[_0x3dbe('0xa')](),controller[_0x3dbe('0x16')]);router[_0x3dbe('0x15')](_0x3dbe('0x13'),auth[_0x3dbe('0xa')](),controller[_0x3dbe('0x17')]);router['put'](_0x3dbe('0x18'),auth['isAuthenticated'](),controller[_0x3dbe('0x19')]);router[_0x3dbe('0x1a')](_0x3dbe('0x18'),auth[_0x3dbe('0xa')](),controller['destroy']);router[_0x3dbe('0x1a')](_0x3dbe('0x11'),auth[_0x3dbe('0xa')](),controller[_0x3dbe('0x1b')]);router[_0x3dbe('0x1a')](_0x3dbe('0x13'),auth[_0x3dbe('0xa')](),controller[_0x3dbe('0x1c')]);module[_0x3dbe('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 039f6e1..d6e721a 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 _0xbd3d=['name','STRING','INTEGER','ENUM','rrmemory','roundrobin','exports'];(function(_0x688f32,_0x4ff749){var _0x497c16=function(_0x4ccb4a){while(--_0x4ccb4a){_0x688f32['push'](_0x688f32['shift']());}};_0x497c16(++_0x4ff749);}(_0xbd3d,0xfb));var _0xdbd3=function(_0x16517a,_0x16dd3b){_0x16517a=_0x16517a-0x0;var _0x379cb8=_0xbd3d[_0x16517a];return _0x379cb8;};'use strict';var Sequelize=require('sequelize');module[_0xdbd3('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xdbd3('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdbd3('0x2')]},'timeout':{'type':Sequelize[_0xdbd3('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdbd3('0x4')](_0xdbd3('0x5'),'beepall',_0xdbd3('0x6'))}}; \ No newline at end of file +var _0x140c=['sequelize','exports','STRING','name','INTEGER','rrmemory','beepall','roundrobin'];(function(_0x14d042,_0x19eaea){var _0x28f422=function(_0x351c7c){while(--_0x351c7c){_0x14d042['push'](_0x14d042['shift']());}};_0x28f422(++_0x19eaea);}(_0x140c,0x188));var _0xc140=function(_0x28363c,_0x5481c9){_0x28363c=_0x28363c-0x0;var _0x4e6607=_0x140c[_0x28363c];return _0x4e6607;};'use strict';var Sequelize=require(_0xc140('0x0'));module[_0xc140('0x1')]={'name':{'type':Sequelize[_0xc140('0x2')],'unique':_0xc140('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc140('0x2')]},'timeout':{'type':Sequelize[_0xc140('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xc140('0x5'),_0xc140('0x6'),_0xc140('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index a88b206..4294543 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 _0x0ab9=['crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailQueue.socket','register','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','end','sendStatus','error','name','send','index','map','MailQueue','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','options','includeAll','include','findAll','rows','catch','params','rawAttributes','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','MailQueueId','User','UserId','updatedAt','createdAt','%s/%s','SIP','mailPause','Team','getTeams','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userMailQueue:save','select','field','tq.TeamId','join','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','includes','all','union','compact','transaction','isEmpty','userMailQueue:remove','addAgents','omit','getAgents','rimraf','zip-dir','fast-json-patch','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ab9,0x101));var _0x90ab=function(_0x207bdc,_0x238ae0){_0x207bdc=_0x207bdc-0x0;var _0x2c1811=_0x0ab9[_0x207bdc];return _0x2c1811;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x90ab('0x0'));var zipdir=require(_0x90ab('0x1'));var jsonpatch=require(_0x90ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x90ab('0x3'));var util=require(_0x90ab('0x4'));var path=require(_0x90ab('0x5'));var sox=require('sox');var csv=require(_0x90ab('0x6'));var ejs=require(_0x90ab('0x7'));var fs=require('fs');var fs_extra=require(_0x90ab('0x8'));var _=require(_0x90ab('0x9'));var squel=require(_0x90ab('0xa'));var crypto=require(_0x90ab('0xb'));var jsforce=require(_0x90ab('0xc'));var deskjs=require(_0x90ab('0xd'));var toCsv=require(_0x90ab('0x6'));var querystring=require(_0x90ab('0xe'));var Papa=require('papaparse');var Redis=require(_0x90ab('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x90ab('0x10'));var as=require(_0x90ab('0x11'));var hardwareService=require(_0x90ab('0x12'));var logger=require(_0x90ab('0x13'))(_0x90ab('0x14'));var utils=require(_0x90ab('0x15'));var config=require(_0x90ab('0x16'));var licenseUtil=require(_0x90ab('0x17'));var db=require(_0x90ab('0x18'))['db'];config[_0x90ab('0x19')]=_[_0x90ab('0x1a')](config[_0x90ab('0x19')],{'host':_0x90ab('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x90ab('0x19')]));require(_0x90ab('0x1c'))[_0x90ab('0x1d')](socket);function respondWithStatusCode(_0x237c90,_0x1b00f2){_0x1b00f2=_0x1b00f2||0xcc;return function(_0x46cdf8){if(_0x46cdf8){return _0x237c90['sendStatus'](_0x1b00f2);}return _0x237c90['status'](_0x1b00f2)['end']();};}function respondWithResult(_0x5353f8,_0x49c335){_0x49c335=_0x49c335||0xc8;return function(_0x318e25){if(_0x318e25){return _0x5353f8[_0x90ab('0x1e')](_0x49c335)[_0x90ab('0x1f')](_0x318e25);}};}function respondWithFilteredResult(_0x146fbe,_0x1d1a96){return function(_0x19a3eb){if(_0x19a3eb){var _0x5af22d=typeof _0x1d1a96[_0x90ab('0x20')]==='undefined'&&typeof _0x1d1a96['limit']===_0x90ab('0x21');var _0x50e928=_0x19a3eb['count'];var _0x29d7f7=_0x5af22d?0x0:_0x1d1a96[_0x90ab('0x20')];var _0x3e40b7=_0x5af22d?_0x19a3eb[_0x90ab('0x22')]:_0x1d1a96['offset']+_0x1d1a96[_0x90ab('0x23')];var _0x480f3c;if(_0x3e40b7>=_0x50e928){_0x3e40b7=_0x50e928;_0x480f3c=0xc8;}else{_0x480f3c=0xce;}_0x146fbe[_0x90ab('0x1e')](_0x480f3c);return _0x146fbe['set'](_0x90ab('0x24'),_0x29d7f7+'-'+_0x3e40b7+'/'+_0x50e928)[_0x90ab('0x1f')](_0x19a3eb);}return null;};}function patchUpdates(_0x5eb7f2){return function(_0x45c2a8){try{jsonpatch['apply'](_0x45c2a8,_0x5eb7f2,!![]);}catch(_0x29475b){return BPromise[_0x90ab('0x25')](_0x29475b);}return _0x45c2a8[_0x90ab('0x26')]();};}function saveUpdates(_0x4fcf71,_0x57d845){return function(_0x596eba){if(_0x596eba){return _0x596eba[_0x90ab('0x27')](_0x4fcf71)[_0x90ab('0x28')](function(_0x2621ef){return _0x2621ef;});}return null;};}function removeEntity(_0x42a96b,_0x2dca9c){return function(_0x18d036){if(_0x18d036){return _0x18d036[_0x90ab('0x29')]()[_0x90ab('0x28')](function(){var _0x59299b=_0x18d036[_0x90ab('0x2a')]({'plain':!![]});var _0x2c364d=_0x90ab('0x2b');return db[_0x90ab('0x2c')][_0x90ab('0x29')]({'where':{'type':_0x2c364d,'resourceId':_0x59299b['id']}})[_0x90ab('0x28')](function(){return _0x18d036;});})[_0x90ab('0x28')](function(){_0x42a96b[_0x90ab('0x1e')](0xcc)[_0x90ab('0x2d')]();});}};}function handleEntityNotFound(_0x376b77,_0x6df47c){return function(_0xe8e094){if(!_0xe8e094){_0x376b77[_0x90ab('0x2e')](0x194);}return _0xe8e094;};}function handleError(_0x383d18,_0x123cd4){_0x123cd4=_0x123cd4||0x1f4;return function(_0xe7f56){logger[_0x90ab('0x2f')](_0xe7f56['stack']);if(_0xe7f56['name']){delete _0xe7f56[_0x90ab('0x30')];}_0x383d18[_0x90ab('0x1e')](_0x123cd4)[_0x90ab('0x31')](_0xe7f56);};}exports[_0x90ab('0x32')]=function(_0x509531,_0x13b47c){var _0x57a41d={},_0x18013d={},_0x48fec9={'count':0x0,'rows':[]};var _0x2e82ef=_[_0x90ab('0x33')](db[_0x90ab('0x34')]['rawAttributes'],function(_0x273c23){return{'name':_0x273c23[_0x90ab('0x35')],'type':_0x273c23['type']['key']};});_0x18013d[_0x90ab('0x36')]=_[_0x90ab('0x33')](_0x2e82ef,_0x90ab('0x30'));_0x18013d[_0x90ab('0x37')]=_[_0x90ab('0x38')](_0x509531[_0x90ab('0x37')]);_0x18013d[_0x90ab('0x39')]=_[_0x90ab('0x3a')](_0x18013d[_0x90ab('0x36')],_0x18013d[_0x90ab('0x37')]);_0x57a41d[_0x90ab('0x3b')]=_[_0x90ab('0x3a')](_0x18013d[_0x90ab('0x36')],qs[_0x90ab('0x3c')](_0x509531[_0x90ab('0x37')][_0x90ab('0x3c')]));_0x57a41d[_0x90ab('0x3b')]=_0x57a41d['attributes'][_0x90ab('0x3d')]?_0x57a41d[_0x90ab('0x3b')]:_0x18013d[_0x90ab('0x36')];if(!_0x509531[_0x90ab('0x37')]['hasOwnProperty'](_0x90ab('0x3e'))){_0x57a41d[_0x90ab('0x23')]=qs[_0x90ab('0x23')](_0x509531[_0x90ab('0x37')][_0x90ab('0x23')]);_0x57a41d[_0x90ab('0x20')]=qs[_0x90ab('0x20')](_0x509531[_0x90ab('0x37')][_0x90ab('0x20')]);}_0x57a41d[_0x90ab('0x3f')]=qs['sort'](_0x509531[_0x90ab('0x37')][_0x90ab('0x40')]);_0x57a41d[_0x90ab('0x41')]=qs[_0x90ab('0x39')](_[_0x90ab('0x42')](_0x509531['query'],_0x18013d[_0x90ab('0x39')]),_0x2e82ef);if(_0x509531[_0x90ab('0x37')][_0x90ab('0x43')]){_0x57a41d[_0x90ab('0x41')]=_['merge'](_0x57a41d[_0x90ab('0x41')],{'$or':_['map'](_0x2e82ef,function(_0x50aa20){if(_0x50aa20[_0x90ab('0x44')]!=='VIRTUAL'){var _0x10cfc0={};_0x10cfc0[_0x50aa20[_0x90ab('0x30')]]={'$like':'%'+_0x509531[_0x90ab('0x37')][_0x90ab('0x43')]+'%'};return _0x10cfc0;}})});}_0x57a41d=_['merge']({},_0x57a41d,_0x509531[_0x90ab('0x45')]);var _0x260778={'where':_0x57a41d[_0x90ab('0x41')]};return db[_0x90ab('0x34')][_0x90ab('0x22')](_0x260778)[_0x90ab('0x28')](function(_0x5ea659){_0x48fec9['count']=_0x5ea659;if(_0x509531[_0x90ab('0x37')][_0x90ab('0x46')]){_0x57a41d[_0x90ab('0x47')]=[{'all':!![]}];}return db[_0x90ab('0x34')][_0x90ab('0x48')](_0x57a41d);})[_0x90ab('0x28')](function(_0x2f70e9){_0x48fec9[_0x90ab('0x49')]=_0x2f70e9;return _0x48fec9;})[_0x90ab('0x28')](respondWithFilteredResult(_0x13b47c,_0x57a41d))[_0x90ab('0x4a')](handleError(_0x13b47c,null));};exports['show']=function(_0x11a7fa,_0x39df44){var _0x5e3969={'raw':!![],'where':{'id':_0x11a7fa[_0x90ab('0x4b')]['id']}},_0x5b5b07={};_0x5b5b07[_0x90ab('0x36')]=_[_0x90ab('0x38')](db[_0x90ab('0x34')][_0x90ab('0x4c')]);_0x5b5b07['query']=_[_0x90ab('0x38')](_0x11a7fa['query']);_0x5b5b07['filters']=_[_0x90ab('0x3a')](_0x5b5b07['model'],_0x5b5b07[_0x90ab('0x37')]);_0x5e3969[_0x90ab('0x3b')]=_[_0x90ab('0x3a')](_0x5b5b07[_0x90ab('0x36')],qs['fields'](_0x11a7fa['query']['fields']));_0x5e3969[_0x90ab('0x3b')]=_0x5e3969[_0x90ab('0x3b')]['length']?_0x5e3969[_0x90ab('0x3b')]:_0x5b5b07['model'];if(_0x11a7fa['query'][_0x90ab('0x46')]){_0x5e3969[_0x90ab('0x47')]=[{'all':!![]}];}_0x5e3969=_[_0x90ab('0x4d')]({},_0x5e3969,_0x11a7fa[_0x90ab('0x45')]);return db[_0x90ab('0x34')]['find'](_0x5e3969)[_0x90ab('0x28')](handleEntityNotFound(_0x39df44,null))[_0x90ab('0x28')](respondWithResult(_0x39df44,null))['catch'](handleError(_0x39df44,null));};exports[_0x90ab('0x4e')]=function(_0x150343,_0x1388b1){return db[_0x90ab('0x34')][_0x90ab('0x4e')](_0x150343[_0x90ab('0x4f')],{})[_0x90ab('0x28')](function(_0x516388){var _0x5c4bb5=_0x150343[_0x90ab('0x50')][_0x90ab('0x2a')]({'plain':!![]});if(!_0x5c4bb5)throw new Error(_0x90ab('0x51'));if(_0x5c4bb5[_0x90ab('0x52')]===_0x90ab('0x50')){var _0xa3e657=_0x516388[_0x90ab('0x2a')]({'plain':!![]});var _0x2d48d0='MailQueues';return db[_0x90ab('0x53')][_0x90ab('0x54')]({'where':{'name':_0x2d48d0,'userProfileId':_0x5c4bb5['userProfileId']},'raw':!![]})[_0x90ab('0x28')](function(_0xb51113){if(_0xb51113&&_0xb51113[_0x90ab('0x55')]===0x0){return db['UserProfileResource'][_0x90ab('0x4e')]({'name':_0xa3e657[_0x90ab('0x30')],'resourceId':_0xa3e657['id'],'type':_0xb51113[_0x90ab('0x30')],'sectionId':_0xb51113['id']},{})[_0x90ab('0x28')](function(){return _0x516388;});}else{return _0x516388;}})[_0x90ab('0x4a')](function(_0x1d7b85){logger[_0x90ab('0x2f')](_0x90ab('0x56'),_0x1d7b85);throw _0x1d7b85;});}return _0x516388;})['then'](respondWithResult(_0x1388b1,0xc9))[_0x90ab('0x4a')](handleError(_0x1388b1,null));};exports[_0x90ab('0x27')]=function(_0x3ff2df,_0x1f5623){if(_0x3ff2df['body']['id']){delete _0x3ff2df[_0x90ab('0x4f')]['id'];}return db['MailQueue'][_0x90ab('0x54')]({'where':{'id':_0x3ff2df[_0x90ab('0x4b')]['id']}})[_0x90ab('0x28')](handleEntityNotFound(_0x1f5623,null))[_0x90ab('0x28')](saveUpdates(_0x3ff2df[_0x90ab('0x4f')],null))[_0x90ab('0x28')](respondWithResult(_0x1f5623,null))[_0x90ab('0x4a')](handleError(_0x1f5623,null));};exports['destroy']=function(_0x243100,_0x27228c){return db[_0x90ab('0x34')]['find']({'where':{'id':_0x243100[_0x90ab('0x4b')]['id']}})['then'](handleEntityNotFound(_0x27228c,null))[_0x90ab('0x28')](removeEntity(_0x27228c,null))['catch'](handleError(_0x27228c,null));};exports['describe']=function(_0x168a94,_0xabb4a1){return db[_0x90ab('0x34')][_0x90ab('0x57')]()[_0x90ab('0x28')](respondWithResult(_0xabb4a1,null))[_0x90ab('0x4a')](handleError(_0xabb4a1,null));};exports[_0x90ab('0x58')]=function(_0x5d3dc6,_0x2616e9,_0x51d81e){var _0xeb6198={'raw':!![],'where':{}},_0x3855e8={},_0x146fb9;return db[_0x90ab('0x34')][_0x90ab('0x59')]({'where':{'id':_0x5d3dc6[_0x90ab('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2616e9,null))['then'](function(_0x471b1c){if(_0x471b1c){_0x146fb9=_0x471b1c[_0x90ab('0x2a')]({'plain':!![]});_0x3855e8[_0x90ab('0x36')]=_[_0x90ab('0x38')](db[_0x90ab('0x5a')][_0x90ab('0x4c')]);_0x3855e8[_0x90ab('0x37')]=_[_0x90ab('0x38')](_0x5d3dc6[_0x90ab('0x37')]);_0x3855e8[_0x90ab('0x39')]=_[_0x90ab('0x3a')](_0x3855e8['model'],_0x3855e8[_0x90ab('0x37')]);_0xeb6198[_0x90ab('0x3b')]=_[_0x90ab('0x3a')](_0x3855e8['model'],qs[_0x90ab('0x3c')](_0x5d3dc6[_0x90ab('0x37')][_0x90ab('0x3c')]));_0xeb6198[_0x90ab('0x3b')]=_0xeb6198[_0x90ab('0x3b')][_0x90ab('0x3d')]?_0xeb6198[_0x90ab('0x3b')]:_0x3855e8[_0x90ab('0x36')];if(!_0x5d3dc6['query'][_0x90ab('0x5b')](_0x90ab('0x3e'))){_0xeb6198[_0x90ab('0x23')]=qs['limit'](_0x5d3dc6[_0x90ab('0x37')]['limit']);_0xeb6198[_0x90ab('0x20')]=qs[_0x90ab('0x20')](_0x5d3dc6[_0x90ab('0x37')]['offset']);}_0xeb6198[_0x90ab('0x3f')]=qs['sort'](_0x5d3dc6[_0x90ab('0x37')][_0x90ab('0x40')]);_0xeb6198[_0x90ab('0x41')]=qs[_0x90ab('0x39')](_[_0x90ab('0x42')](_0x5d3dc6[_0x90ab('0x37')],_0x3855e8['filters']));_0xeb6198[_0x90ab('0x41')][_0x90ab('0x5c')]=_0x471b1c['id'];if(_0x5d3dc6[_0x90ab('0x37')][_0x90ab('0x43')]){_0xeb6198[_0x90ab('0x41')]=_[_0x90ab('0x4d')](_0xeb6198[_0x90ab('0x41')],{'$or':_['map'](_0xeb6198['attributes'],function(_0x5910a7){var _0x460cf6={};_0x460cf6[_0x5910a7]={'$like':'%'+_0x5d3dc6[_0x90ab('0x37')][_0x90ab('0x43')]+'%'};return _0x460cf6;})});}_0xeb6198=_['merge']({},_0xeb6198,_0x5d3dc6[_0x90ab('0x45')]);return db[_0x90ab('0x5a')][_0x90ab('0x48')](_0xeb6198);}})['then'](function(_0xa8ba18){if(_0xa8ba18){return db[_0x90ab('0x5d')]['findAndCountAll']({'where':{'id':_[_0x90ab('0x33')](_0xa8ba18,_0x90ab('0x5e')),'role':'agent'},'attributes':['id',_0x90ab('0x30'),'mailPause',_0x90ab('0x5f'),_0x90ab('0x60')]});}})['then'](function(_0x3fccb9){if(_0x3fccb9){return{'count':_0x3fccb9[_0x90ab('0x22')],'rows':_[_0x90ab('0x33')](_0x3fccb9[_0x90ab('0x49')],function(_0x1d4f01){return{'membername':_0x1d4f01[_0x90ab('0x30')],'UserId':_0x1d4f01['id'],'queue_name':_0x146fb9[_0x90ab('0x30')],'MailQueueId':_0x146fb9['id'],'interface':util['format'](_0x90ab('0x61'),_0x90ab('0x62'),_0x1d4f01[_0x90ab('0x30')]),'penalty':0x0,'paused':_0x1d4f01[_0x90ab('0x63')],'createdAt':_0x1d4f01[_0x90ab('0x60')],'updatedAt':_0x1d4f01[_0x90ab('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x90ab('0x28')](respondWithFilteredResult(_0x2616e9,_0xeb6198))[_0x90ab('0x4a')](handleError(_0x2616e9,null));};exports['getTeams']=function(_0x2abbc6,_0x193091,_0x544340){var _0x22d044={};var _0x3bba69={};var _0x26fdd0;var _0x217ef0;return db[_0x90ab('0x34')]['findOne']({'where':{'id':_0x2abbc6['params']['id']}})['then'](handleEntityNotFound(_0x193091,null))['then'](function(_0x8def4f){if(_0x8def4f){_0x26fdd0=_0x8def4f;_0x3bba69[_0x90ab('0x36')]=_[_0x90ab('0x38')](db[_0x90ab('0x64')][_0x90ab('0x4c')]);_0x3bba69[_0x90ab('0x37')]=_['keys'](_0x2abbc6['query']);_0x3bba69['filters']=_[_0x90ab('0x3a')](_0x3bba69[_0x90ab('0x36')],_0x3bba69['query']);_0x22d044[_0x90ab('0x3b')]=_['intersection'](_0x3bba69[_0x90ab('0x36')],qs[_0x90ab('0x3c')](_0x2abbc6[_0x90ab('0x37')][_0x90ab('0x3c')]));_0x22d044[_0x90ab('0x3b')]=_0x22d044[_0x90ab('0x3b')][_0x90ab('0x3d')]?_0x22d044[_0x90ab('0x3b')]:_0x3bba69['model'];_0x22d044[_0x90ab('0x3f')]=qs[_0x90ab('0x40')](_0x2abbc6['query'][_0x90ab('0x40')]);_0x22d044[_0x90ab('0x41')]=qs['filters'](_[_0x90ab('0x42')](_0x2abbc6[_0x90ab('0x37')],_0x3bba69[_0x90ab('0x39')]));if(_0x2abbc6[_0x90ab('0x37')][_0x90ab('0x43')]){_0x22d044[_0x90ab('0x41')]=_[_0x90ab('0x4d')](_0x22d044[_0x90ab('0x41')],{'$or':_[_0x90ab('0x33')](_0x22d044[_0x90ab('0x3b')],function(_0x20f4c8){var _0xcebbfe={};_0xcebbfe[_0x20f4c8]={'$like':'%'+_0x2abbc6[_0x90ab('0x37')][_0x90ab('0x43')]+'%'};return _0xcebbfe;})});}_0x22d044=_['merge']({},_0x22d044,_0x2abbc6[_0x90ab('0x45')]);return _0x26fdd0['getTeams'](_0x22d044);}})[_0x90ab('0x28')](function(_0x483906){if(_0x483906){_0x217ef0=_0x483906[_0x90ab('0x3d')];if(!_0x2abbc6['query'][_0x90ab('0x5b')](_0x90ab('0x3e'))){_0x22d044[_0x90ab('0x23')]=qs[_0x90ab('0x23')](_0x2abbc6[_0x90ab('0x37')][_0x90ab('0x23')]);_0x22d044[_0x90ab('0x20')]=qs['offset'](_0x2abbc6[_0x90ab('0x37')]['offset']);}return _0x26fdd0[_0x90ab('0x65')](_0x22d044);}})['then'](function(_0xc63b85){if(_0xc63b85){return _0xc63b85?{'count':_0x217ef0,'rows':_0xc63b85}:null;}})['then'](respondWithResult(_0x193091,null))[_0x90ab('0x4a')](handleError(_0x193091,null));};exports[_0x90ab('0x66')]=function(_0x382bc2,_0x55a4a3,_0x4d11be){var _0x1870ff=_0x382bc2[_0x90ab('0x4f')][_0x90ab('0x67')];return db['Team'][_0x90ab('0x48')]({'where':{'id':_0x1870ff},'attributes':['id'],'include':[{'model':db[_0x90ab('0x5d')],'as':_0x90ab('0x68'),'attributes':['id',_0x90ab('0x30'),'online',_0x90ab('0x69'),_0x90ab('0x6a')],'raw':!![]}]})[_0x90ab('0x28')](function(_0x23a8e8){if(_0x23a8e8){var _0x39320e=_[_0x90ab('0x6b')](_0x23a8e8,function(_0x47fb33){var _0xf7f60=_0x47fb33[_0x90ab('0x2a')]({'plain':!![]});return _0xf7f60[_0x90ab('0x68')];});return db['MailQueue'][_0x90ab('0x54')]({'where':{'id':_0x382bc2[_0x90ab('0x4b')]['id']}})[_0x90ab('0x28')](function(_0x3232f5){return db[_0x90ab('0x6c')]['transaction'](function(_0x2a1b2f){return _0x3232f5[_0x90ab('0x66')](_0x1870ff,{'transaction':_0x2a1b2f})[_0x90ab('0x28')](function(){return BPromise[_0x90ab('0x6d')](_0x39320e,function(_0x5568b8){return db[_0x90ab('0x5a')][_0x90ab('0x6e')]({'where':{'UserId':_0x5568b8['id'],'MailQueueId':_0x382bc2['params']['id']},'transaction':_0x2a1b2f});});})[_0x90ab('0x28')](function(){_0x39320e[_0x90ab('0x6f')](function(_0x492b70){socket[_0x90ab('0x70')](_0x90ab('0x71'),{'UserId':_0x492b70['id'],'MailQueueId':_0x3232f5['id']});});});});});}})[_0x90ab('0x28')](respondWithStatusCode(_0x55a4a3,null))['catch'](handleError(_0x55a4a3,null));};exports['removeTeams']=function(_0x411288,_0x4944a6,_0x32dbcd){return db[_0x90ab('0x64')]['findAll']({'where':{'id':_0x411288['query'][_0x90ab('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x90ab('0x68'),'attributes':['id'],'raw':!![]}]})[_0x90ab('0x28')](handleEntityNotFound(_0x4944a6,null))[_0x90ab('0x28')](function(_0x5e8988){var _0x469ff8=_[_0x90ab('0x33')](_0x5e8988,'id');var _0x3f91f9=[];var _0x76d1d=[];var _0x194a40=squel[_0x90ab('0x72')]();_0x194a40[_0x90ab('0x73')](_0x90ab('0x74'))['from']('team_has_mail_queues','tq')[_0x90ab('0x75')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x90ab('0x41')]('MailQueueId\x20=\x20?',_0x411288[_0x90ab('0x4b')]['id']);for(var _0x503b65=0x0;_0x503b65<_0x5e8988['length'];_0x503b65+=0x1){let _0x38958b=_0x5e8988[_0x503b65];for(var _0x479305=0x0;_0x479305<_0x38958b[_0x90ab('0x68')][_0x90ab('0x3d')];_0x479305+=0x1){let _0xbeff7c=_0x38958b[_0x90ab('0x68')][_0x479305];var _0x1a5dd1=_0x194a40[_0x90ab('0x76')]();_0x1a5dd1[_0x90ab('0x41')](_0x90ab('0x77'),_0xbeff7c['id']);_0x76d1d[_0x90ab('0x78')](db['sequelize'][_0x90ab('0x37')](_0x1a5dd1['toString'](),{'type':db[_0x90ab('0x6c')][_0x90ab('0x79')][_0x90ab('0x7a')]})['then'](function(_0x4d13c3){if(_0x4d13c3[_0x90ab('0x3d')]===0x1){return _0xbeff7c['id'];}else{var _0x36c2dd=_[_0x90ab('0x7b')](_[_0x90ab('0x33')](_0x4d13c3,'TeamId'),function(_0x5ec658){return _[_0x90ab('0x7c')](_0x469ff8,_0x5ec658);});if(_0x36c2dd){return _0xbeff7c['id'];}}}));}}return BPromise[_0x90ab('0x7d')](_0x76d1d)[_0x90ab('0x28')](function(_0x20eb0c){_0x3f91f9=_(_0x3f91f9)[_0x90ab('0x7e')](_0x20eb0c)[_0x90ab('0x7f')]()['value']();return db[_0x90ab('0x34')][_0x90ab('0x54')]({'where':{'id':_0x411288[_0x90ab('0x4b')]['id']}})['then'](function(_0x5045f9){return db[_0x90ab('0x6c')][_0x90ab('0x80')](function(_0x1af088){return _0x5045f9['removeTeams'](_0x411288[_0x90ab('0x37')][_0x90ab('0x67')],{'transaction':_0x1af088})[_0x90ab('0x28')](function(){if(!_[_0x90ab('0x81')](_0x3f91f9)){return _0x5045f9['removeAgents'](_0x3f91f9,{'transaction':_0x1af088});}})['then'](function(){_0x3f91f9[_0x90ab('0x6f')](function(_0x5d500a){socket[_0x90ab('0x70')](_0x90ab('0x82'),{'UserId':_0x5d500a,'MailQueueId':_0x5045f9['id']});});});});});});})[_0x90ab('0x28')](respondWithStatusCode(_0x4944a6,null))[_0x90ab('0x4a')](handleError(_0x4944a6,null));};exports[_0x90ab('0x83')]=function(_0x55bd93,_0x3cf0fd,_0xaee048){return db[_0x90ab('0x34')][_0x90ab('0x54')]({'where':{'id':_0x55bd93[_0x90ab('0x4b')]['id']}})[_0x90ab('0x28')](handleEntityNotFound(_0x3cf0fd,null))[_0x90ab('0x28')](function(_0x504988){if(_0x504988){return _0x504988['addAgents'](_0x55bd93[_0x90ab('0x4f')]['ids'],_[_0x90ab('0x84')](_0x55bd93['body'],[_0x90ab('0x67'),'id'])||{})['spread'](function(_0x19af88){for(var _0x20ad17=0x0;_0x20ad17<_0x55bd93['body'][_0x90ab('0x67')]['length'];_0x20ad17+=0x1){socket[_0x90ab('0x70')](_0x90ab('0x71'),{'UserId':Number(_0x55bd93[_0x90ab('0x4f')][_0x90ab('0x67')][_0x20ad17]),'MailQueueId':Number(_0x55bd93[_0x90ab('0x4b')]['id'])});}return _0x19af88;});}})[_0x90ab('0x28')](respondWithResult(_0x3cf0fd,null))[_0x90ab('0x4a')](handleError(_0x3cf0fd,null));};exports['removeAgents']=function(_0x47d873,_0x2ee0d6,_0x52cda7){return db[_0x90ab('0x34')][_0x90ab('0x54')]({'where':{'id':_0x47d873[_0x90ab('0x4b')]['id']}})[_0x90ab('0x28')](handleEntityNotFound(_0x2ee0d6,null))[_0x90ab('0x28')](function(_0x55d09a){if(_0x55d09a){return _0x55d09a['removeAgents'](_0x47d873[_0x90ab('0x37')][_0x90ab('0x67')])[_0x90ab('0x28')](function(){if(_['isArray'](_0x47d873[_0x90ab('0x37')][_0x90ab('0x67')])){for(var _0x3190a6=0x0;_0x3190a6<_0x47d873['query'][_0x90ab('0x67')][_0x90ab('0x3d')];_0x3190a6+=0x1){socket[_0x90ab('0x70')](_0x90ab('0x82'),{'UserId':Number(_0x47d873[_0x90ab('0x37')]['ids'][_0x3190a6]),'MailQueueId':Number(_0x47d873[_0x90ab('0x4b')]['id'])});}}else{socket[_0x90ab('0x70')](_0x90ab('0x82'),{'UserId':Number(_0x47d873['query']['ids']),'MailQueueId':Number(_0x47d873['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2ee0d6,null))['catch'](handleError(_0x2ee0d6,null));};exports[_0x90ab('0x85')]=function(_0x57014c,_0x417607,_0x914959){var _0x1c78c4={};var _0x455860={};var _0x4ad5c0;var _0xdbd319;return db['MailQueue'][_0x90ab('0x59')]({'where':{'id':_0x57014c['params']['id']}})[_0x90ab('0x28')](handleEntityNotFound(_0x417607,null))['then'](function(_0x16d41d){if(_0x16d41d){_0x4ad5c0=_0x16d41d;_0x455860[_0x90ab('0x36')]=_['keys'](db[_0x90ab('0x5d')]['rawAttributes']);_0x455860[_0x90ab('0x37')]=_[_0x90ab('0x38')](_0x57014c[_0x90ab('0x37')]);_0x455860[_0x90ab('0x39')]=_['intersection'](_0x455860[_0x90ab('0x36')],_0x455860[_0x90ab('0x37')]);_0x1c78c4[_0x90ab('0x3b')]=_['intersection'](_0x455860['model'],qs[_0x90ab('0x3c')](_0x57014c['query'][_0x90ab('0x3c')]));_0x1c78c4['attributes']=_0x1c78c4[_0x90ab('0x3b')][_0x90ab('0x3d')]?_0x1c78c4[_0x90ab('0x3b')]:_0x455860['model'];_0x1c78c4[_0x90ab('0x3f')]=qs[_0x90ab('0x40')](_0x57014c[_0x90ab('0x37')][_0x90ab('0x40')]);_0x1c78c4['where']=qs[_0x90ab('0x39')](_[_0x90ab('0x42')](_0x57014c[_0x90ab('0x37')],_0x455860[_0x90ab('0x39')]));if(_0x57014c[_0x90ab('0x37')][_0x90ab('0x43')]){_0x1c78c4[_0x90ab('0x41')]=_[_0x90ab('0x4d')](_0x1c78c4[_0x90ab('0x41')],{'$or':_[_0x90ab('0x33')](_0x1c78c4['attributes'],function(_0x309775){var _0x32dd33={};_0x32dd33[_0x309775]={'$like':'%'+_0x57014c[_0x90ab('0x37')][_0x90ab('0x43')]+'%'};return _0x32dd33;})});}_0x1c78c4=_['merge']({},_0x1c78c4,_0x57014c[_0x90ab('0x45')]);return _0x4ad5c0[_0x90ab('0x85')](_0x1c78c4);}})[_0x90ab('0x28')](function(_0x3864fd){if(_0x3864fd){_0xdbd319=_0x3864fd['length'];if(!_0x57014c['query'][_0x90ab('0x5b')](_0x90ab('0x3e'))){_0x1c78c4[_0x90ab('0x23')]=qs['limit'](_0x57014c[_0x90ab('0x37')][_0x90ab('0x23')]);_0x1c78c4[_0x90ab('0x20')]=qs['offset'](_0x57014c['query'][_0x90ab('0x20')]);}return _0x4ad5c0['getAgents'](_0x1c78c4);}})[_0x90ab('0x28')](function(_0x7d529e){if(_0x7d529e){return _0x7d529e?{'count':_0xdbd319,'rows':_0x7d529e}:null;}})[_0x90ab('0x28')](respondWithResult(_0x417607,null))[_0x90ab('0x4a')](handleError(_0x417607,null));}; \ No newline at end of file +var _0xea63=['rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','userProfileId','autoAssociation','UserProfileResource','describe','getMembers','findOne','nolimit','pick','MailQueueId','UserMailQueue','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','getTeams','addTeams','ids','online','voicePause','interface','flatMap','Agents','transaction','each','findOrCreate','forEach','removeTeams','Team','field','from','team_has_mail_queues','join','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','all','union','compact','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','emit','userMailQueue:save','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','status','end','offset','undefined','limit','count','set','reject','update','then','get','destroy','error','name','send','index','map','MailQueue','fieldName','type','key','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x3be8e8,_0x246a8f){var _0x5f7c64=function(_0x14b674){while(--_0x14b674){_0x3be8e8['push'](_0x3be8e8['shift']());}};_0x5f7c64(++_0x246a8f);}(_0xea63,0x1d6));var _0x3ea6=function(_0x2d518,_0x61c0e9){_0x2d518=_0x2d518-0x0;var _0xdc2ee7=_0xea63[_0x2d518];return _0xdc2ee7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3ea6('0x0'));var zipdir=require(_0x3ea6('0x1'));var jsonpatch=require(_0x3ea6('0x2'));var rp=require(_0x3ea6('0x3'));var moment=require(_0x3ea6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3ea6('0x5'));var path=require(_0x3ea6('0x6'));var sox=require(_0x3ea6('0x7'));var csv=require('to-csv');var ejs=require(_0x3ea6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3ea6('0x9'));var squel=require(_0x3ea6('0xa'));var crypto=require(_0x3ea6('0xb'));var jsforce=require(_0x3ea6('0xc'));var deskjs=require(_0x3ea6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3ea6('0xe'));var Papa=require(_0x3ea6('0xf'));var Redis=require('ioredis');var authService=require(_0x3ea6('0x10'));var qs=require(_0x3ea6('0x11'));var as=require(_0x3ea6('0x12'));var hardwareService=require(_0x3ea6('0x13'));var logger=require('../../config/logger')(_0x3ea6('0x14'));var utils=require('../../config/utils');var config=require(_0x3ea6('0x15'));var licenseUtil=require(_0x3ea6('0x16'));var db=require('../../mysqldb')['db'];config[_0x3ea6('0x17')]=_[_0x3ea6('0x18')](config['redis'],{'host':_0x3ea6('0x19'),'port':0x18eb});var socket=require(_0x3ea6('0x1a'))(new Redis(config['redis']));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0x28a18c,_0x2abac4){_0x2abac4=_0x2abac4||0xcc;return function(_0x1a7693){if(_0x1a7693){return _0x28a18c['sendStatus'](_0x2abac4);}return _0x28a18c[_0x3ea6('0x1b')](_0x2abac4)[_0x3ea6('0x1c')]();};}function respondWithResult(_0x4b0c4e,_0x224a4b){_0x224a4b=_0x224a4b||0xc8;return function(_0x47e631){if(_0x47e631){return _0x4b0c4e[_0x3ea6('0x1b')](_0x224a4b)['json'](_0x47e631);}};}function respondWithFilteredResult(_0xb4d77e,_0x3bb245){return function(_0x371661){if(_0x371661){var _0x4363c7=typeof _0x3bb245[_0x3ea6('0x1d')]===_0x3ea6('0x1e')&&typeof _0x3bb245[_0x3ea6('0x1f')]===_0x3ea6('0x1e');var _0x4025fe=_0x371661['count'];var _0x228bfa=_0x4363c7?0x0:_0x3bb245[_0x3ea6('0x1d')];var _0x4b91f6=_0x4363c7?_0x371661[_0x3ea6('0x20')]:_0x3bb245['offset']+_0x3bb245[_0x3ea6('0x1f')];var _0x2b1310;if(_0x4b91f6>=_0x4025fe){_0x4b91f6=_0x4025fe;_0x2b1310=0xc8;}else{_0x2b1310=0xce;}_0xb4d77e[_0x3ea6('0x1b')](_0x2b1310);return _0xb4d77e[_0x3ea6('0x21')]('Content-Range',_0x228bfa+'-'+_0x4b91f6+'/'+_0x4025fe)['json'](_0x371661);}return null;};}function patchUpdates(_0x15b63a){return function(_0x11b511){try{jsonpatch['apply'](_0x11b511,_0x15b63a,!![]);}catch(_0x3afddf){return BPromise[_0x3ea6('0x22')](_0x3afddf);}return _0x11b511['save']();};}function saveUpdates(_0x485f86,_0x1283bf){return function(_0x517d07){if(_0x517d07){return _0x517d07[_0x3ea6('0x23')](_0x485f86)[_0x3ea6('0x24')](function(_0x4cfcf2){return _0x4cfcf2;});}return null;};}function removeEntity(_0x426078,_0x2aaf42){return function(_0xcf2a39){if(_0xcf2a39){return _0xcf2a39['destroy']()['then'](function(){var _0x2aee0f=_0xcf2a39[_0x3ea6('0x25')]({'plain':!![]});var _0x3e3abb='MailQueues';return db['UserProfileResource'][_0x3ea6('0x26')]({'where':{'type':_0x3e3abb,'resourceId':_0x2aee0f['id']}})[_0x3ea6('0x24')](function(){return _0xcf2a39;});})[_0x3ea6('0x24')](function(){_0x426078[_0x3ea6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fa712,_0xe13681){return function(_0x138cf6){if(!_0x138cf6){_0x1fa712['sendStatus'](0x194);}return _0x138cf6;};}function handleError(_0x20345b,_0x528a2c){_0x528a2c=_0x528a2c||0x1f4;return function(_0x20c524){logger[_0x3ea6('0x27')](_0x20c524['stack']);if(_0x20c524[_0x3ea6('0x28')]){delete _0x20c524[_0x3ea6('0x28')];}_0x20345b[_0x3ea6('0x1b')](_0x528a2c)[_0x3ea6('0x29')](_0x20c524);};}exports[_0x3ea6('0x2a')]=function(_0x203de2,_0x292ec7){var _0x50f54f={},_0x506cfa={},_0xe43617={'count':0x0,'rows':[]};var _0x5c15b2=_[_0x3ea6('0x2b')](db[_0x3ea6('0x2c')]['rawAttributes'],function(_0x3c86b6){return{'name':_0x3c86b6[_0x3ea6('0x2d')],'type':_0x3c86b6[_0x3ea6('0x2e')][_0x3ea6('0x2f')]};});_0x506cfa['model']=_[_0x3ea6('0x2b')](_0x5c15b2,_0x3ea6('0x28'));_0x506cfa['query']=_[_0x3ea6('0x30')](_0x203de2['query']);_0x506cfa['filters']=_[_0x3ea6('0x31')](_0x506cfa[_0x3ea6('0x32')],_0x506cfa[_0x3ea6('0x33')]);_0x50f54f[_0x3ea6('0x34')]=_[_0x3ea6('0x31')](_0x506cfa[_0x3ea6('0x32')],qs[_0x3ea6('0x35')](_0x203de2[_0x3ea6('0x33')][_0x3ea6('0x35')]));_0x50f54f[_0x3ea6('0x34')]=_0x50f54f['attributes'][_0x3ea6('0x36')]?_0x50f54f['attributes']:_0x506cfa['model'];if(!_0x203de2[_0x3ea6('0x33')][_0x3ea6('0x37')]('nolimit')){_0x50f54f['limit']=qs[_0x3ea6('0x1f')](_0x203de2[_0x3ea6('0x33')][_0x3ea6('0x1f')]);_0x50f54f['offset']=qs['offset'](_0x203de2[_0x3ea6('0x33')][_0x3ea6('0x1d')]);}_0x50f54f[_0x3ea6('0x38')]=qs['sort'](_0x203de2[_0x3ea6('0x33')][_0x3ea6('0x39')]);_0x50f54f['where']=qs['filters'](_['pick'](_0x203de2[_0x3ea6('0x33')],_0x506cfa[_0x3ea6('0x3a')]),_0x5c15b2);if(_0x203de2[_0x3ea6('0x33')][_0x3ea6('0x3b')]){_0x50f54f[_0x3ea6('0x3c')]=_['merge'](_0x50f54f['where'],{'$or':_[_0x3ea6('0x2b')](_0x5c15b2,function(_0x15a1dc){if(_0x15a1dc['type']!=='VIRTUAL'){var _0x17d5ca={};_0x17d5ca[_0x15a1dc['name']]={'$like':'%'+_0x203de2[_0x3ea6('0x33')][_0x3ea6('0x3b')]+'%'};return _0x17d5ca;}})});}_0x50f54f=_[_0x3ea6('0x3d')]({},_0x50f54f,_0x203de2[_0x3ea6('0x3e')]);var _0x541077={'where':_0x50f54f['where']};return db[_0x3ea6('0x2c')][_0x3ea6('0x20')](_0x541077)[_0x3ea6('0x24')](function(_0x5521ca){_0xe43617['count']=_0x5521ca;if(_0x203de2[_0x3ea6('0x33')][_0x3ea6('0x3f')]){_0x50f54f[_0x3ea6('0x40')]=[{'all':!![]}];}return db['MailQueue'][_0x3ea6('0x41')](_0x50f54f);})[_0x3ea6('0x24')](function(_0x53c230){_0xe43617[_0x3ea6('0x42')]=_0x53c230;return _0xe43617;})[_0x3ea6('0x24')](respondWithFilteredResult(_0x292ec7,_0x50f54f))[_0x3ea6('0x43')](handleError(_0x292ec7,null));};exports[_0x3ea6('0x44')]=function(_0x1fc64b,_0x988b05){var _0x16149c={'raw':!![],'where':{'id':_0x1fc64b[_0x3ea6('0x45')]['id']}},_0x47057e={};_0x47057e['model']=_[_0x3ea6('0x30')](db[_0x3ea6('0x2c')][_0x3ea6('0x46')]);_0x47057e['query']=_['keys'](_0x1fc64b[_0x3ea6('0x33')]);_0x47057e[_0x3ea6('0x3a')]=_[_0x3ea6('0x31')](_0x47057e[_0x3ea6('0x32')],_0x47057e[_0x3ea6('0x33')]);_0x16149c[_0x3ea6('0x34')]=_[_0x3ea6('0x31')](_0x47057e['model'],qs[_0x3ea6('0x35')](_0x1fc64b[_0x3ea6('0x33')]['fields']));_0x16149c[_0x3ea6('0x34')]=_0x16149c['attributes']['length']?_0x16149c[_0x3ea6('0x34')]:_0x47057e[_0x3ea6('0x32')];if(_0x1fc64b[_0x3ea6('0x33')][_0x3ea6('0x3f')]){_0x16149c[_0x3ea6('0x40')]=[{'all':!![]}];}_0x16149c=_[_0x3ea6('0x3d')]({},_0x16149c,_0x1fc64b[_0x3ea6('0x3e')]);return db[_0x3ea6('0x2c')][_0x3ea6('0x47')](_0x16149c)[_0x3ea6('0x24')](handleEntityNotFound(_0x988b05,null))[_0x3ea6('0x24')](respondWithResult(_0x988b05,null))['catch'](handleError(_0x988b05,null));};exports[_0x3ea6('0x48')]=function(_0x44bcf0,_0xa0c28c){return db[_0x3ea6('0x2c')][_0x3ea6('0x48')](_0x44bcf0[_0x3ea6('0x49')],{})[_0x3ea6('0x24')](function(_0x18fde7){var _0x277758=_0x44bcf0[_0x3ea6('0x4a')][_0x3ea6('0x25')]({'plain':!![]});if(!_0x277758)throw new Error(_0x3ea6('0x4b'));if(_0x277758[_0x3ea6('0x4c')]===_0x3ea6('0x4a')){var _0x17cc0e=_0x18fde7['get']({'plain':!![]});var _0x97065b=_0x3ea6('0x4d');return db['UserProfileSection'][_0x3ea6('0x47')]({'where':{'name':_0x97065b,'userProfileId':_0x277758[_0x3ea6('0x4e')]},'raw':!![]})[_0x3ea6('0x24')](function(_0x59c104){if(_0x59c104&&_0x59c104[_0x3ea6('0x4f')]===0x0){return db[_0x3ea6('0x50')][_0x3ea6('0x48')]({'name':_0x17cc0e['name'],'resourceId':_0x17cc0e['id'],'type':_0x59c104[_0x3ea6('0x28')],'sectionId':_0x59c104['id']},{})[_0x3ea6('0x24')](function(){return _0x18fde7;});}else{return _0x18fde7;}})[_0x3ea6('0x43')](function(_0x2c3225){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c3225);throw _0x2c3225;});}return _0x18fde7;})[_0x3ea6('0x24')](respondWithResult(_0xa0c28c,0xc9))[_0x3ea6('0x43')](handleError(_0xa0c28c,null));};exports[_0x3ea6('0x23')]=function(_0x4572fa,_0x56943e){if(_0x4572fa[_0x3ea6('0x49')]['id']){delete _0x4572fa[_0x3ea6('0x49')]['id'];}return db[_0x3ea6('0x2c')]['find']({'where':{'id':_0x4572fa[_0x3ea6('0x45')]['id']}})[_0x3ea6('0x24')](handleEntityNotFound(_0x56943e,null))[_0x3ea6('0x24')](saveUpdates(_0x4572fa[_0x3ea6('0x49')],null))[_0x3ea6('0x24')](respondWithResult(_0x56943e,null))['catch'](handleError(_0x56943e,null));};exports[_0x3ea6('0x26')]=function(_0x41517c,_0x209e11){return db[_0x3ea6('0x2c')][_0x3ea6('0x47')]({'where':{'id':_0x41517c[_0x3ea6('0x45')]['id']}})[_0x3ea6('0x24')](handleEntityNotFound(_0x209e11,null))[_0x3ea6('0x24')](removeEntity(_0x209e11,null))['catch'](handleError(_0x209e11,null));};exports[_0x3ea6('0x51')]=function(_0x2e8574,_0x5a0d92){return db[_0x3ea6('0x2c')][_0x3ea6('0x51')]()[_0x3ea6('0x24')](respondWithResult(_0x5a0d92,null))[_0x3ea6('0x43')](handleError(_0x5a0d92,null));};exports[_0x3ea6('0x52')]=function(_0x1ca9b1,_0x1cd3b6,_0x413749){var _0x547d3e={'raw':!![],'where':{}},_0x3d29ec={},_0x41e867;return db[_0x3ea6('0x2c')][_0x3ea6('0x53')]({'where':{'id':_0x1ca9b1[_0x3ea6('0x45')]['id']}})['then'](handleEntityNotFound(_0x1cd3b6,null))[_0x3ea6('0x24')](function(_0x455a53){if(_0x455a53){_0x41e867=_0x455a53[_0x3ea6('0x25')]({'plain':!![]});_0x3d29ec[_0x3ea6('0x32')]=_[_0x3ea6('0x30')](db['UserMailQueue'][_0x3ea6('0x46')]);_0x3d29ec[_0x3ea6('0x33')]=_['keys'](_0x1ca9b1[_0x3ea6('0x33')]);_0x3d29ec[_0x3ea6('0x3a')]=_['intersection'](_0x3d29ec['model'],_0x3d29ec[_0x3ea6('0x33')]);_0x547d3e[_0x3ea6('0x34')]=_['intersection'](_0x3d29ec[_0x3ea6('0x32')],qs[_0x3ea6('0x35')](_0x1ca9b1[_0x3ea6('0x33')][_0x3ea6('0x35')]));_0x547d3e[_0x3ea6('0x34')]=_0x547d3e['attributes']['length']?_0x547d3e[_0x3ea6('0x34')]:_0x3d29ec['model'];if(!_0x1ca9b1[_0x3ea6('0x33')][_0x3ea6('0x37')](_0x3ea6('0x54'))){_0x547d3e['limit']=qs[_0x3ea6('0x1f')](_0x1ca9b1[_0x3ea6('0x33')][_0x3ea6('0x1f')]);_0x547d3e['offset']=qs[_0x3ea6('0x1d')](_0x1ca9b1['query'][_0x3ea6('0x1d')]);}_0x547d3e[_0x3ea6('0x38')]=qs[_0x3ea6('0x39')](_0x1ca9b1[_0x3ea6('0x33')][_0x3ea6('0x39')]);_0x547d3e[_0x3ea6('0x3c')]=qs[_0x3ea6('0x3a')](_[_0x3ea6('0x55')](_0x1ca9b1['query'],_0x3d29ec[_0x3ea6('0x3a')]));_0x547d3e[_0x3ea6('0x3c')][_0x3ea6('0x56')]=_0x455a53['id'];if(_0x1ca9b1[_0x3ea6('0x33')][_0x3ea6('0x3b')]){_0x547d3e[_0x3ea6('0x3c')]=_[_0x3ea6('0x3d')](_0x547d3e['where'],{'$or':_[_0x3ea6('0x2b')](_0x547d3e[_0x3ea6('0x34')],function(_0x5a5a6b){var _0x5ceeb5={};_0x5ceeb5[_0x5a5a6b]={'$like':'%'+_0x1ca9b1[_0x3ea6('0x33')]['filter']+'%'};return _0x5ceeb5;})});}_0x547d3e=_[_0x3ea6('0x3d')]({},_0x547d3e,_0x1ca9b1[_0x3ea6('0x3e')]);return db[_0x3ea6('0x57')]['findAll'](_0x547d3e);}})[_0x3ea6('0x24')](function(_0x1d34a2){if(_0x1d34a2){return db[_0x3ea6('0x58')][_0x3ea6('0x59')]({'where':{'id':_[_0x3ea6('0x2b')](_0x1d34a2,_0x3ea6('0x5a')),'role':_0x3ea6('0x5b')},'attributes':['id',_0x3ea6('0x28'),_0x3ea6('0x5c'),_0x3ea6('0x5d'),_0x3ea6('0x5e')]});}})[_0x3ea6('0x24')](function(_0x20f62d){if(_0x20f62d){return{'count':_0x20f62d[_0x3ea6('0x20')],'rows':_[_0x3ea6('0x2b')](_0x20f62d[_0x3ea6('0x42')],function(_0x45523a){return{'membername':_0x45523a[_0x3ea6('0x28')],'UserId':_0x45523a['id'],'queue_name':_0x41e867[_0x3ea6('0x28')],'MailQueueId':_0x41e867['id'],'interface':util[_0x3ea6('0x5f')](_0x3ea6('0x60'),'SIP',_0x45523a[_0x3ea6('0x28')]),'penalty':0x0,'paused':_0x45523a[_0x3ea6('0x5c')],'createdAt':_0x45523a[_0x3ea6('0x5e')],'updatedAt':_0x45523a['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1cd3b6,_0x547d3e))[_0x3ea6('0x43')](handleError(_0x1cd3b6,null));};exports['getTeams']=function(_0x118e91,_0x332114,_0x165d90){var _0x6948c7={};var _0x563a39={};var _0x4e08b1;var _0x4bedbc;return db[_0x3ea6('0x2c')][_0x3ea6('0x53')]({'where':{'id':_0x118e91[_0x3ea6('0x45')]['id']}})[_0x3ea6('0x24')](handleEntityNotFound(_0x332114,null))['then'](function(_0x29d7c4){if(_0x29d7c4){_0x4e08b1=_0x29d7c4;_0x563a39['model']=_[_0x3ea6('0x30')](db['Team'][_0x3ea6('0x46')]);_0x563a39[_0x3ea6('0x33')]=_[_0x3ea6('0x30')](_0x118e91[_0x3ea6('0x33')]);_0x563a39[_0x3ea6('0x3a')]=_[_0x3ea6('0x31')](_0x563a39[_0x3ea6('0x32')],_0x563a39[_0x3ea6('0x33')]);_0x6948c7[_0x3ea6('0x34')]=_[_0x3ea6('0x31')](_0x563a39[_0x3ea6('0x32')],qs['fields'](_0x118e91[_0x3ea6('0x33')][_0x3ea6('0x35')]));_0x6948c7['attributes']=_0x6948c7['attributes'][_0x3ea6('0x36')]?_0x6948c7[_0x3ea6('0x34')]:_0x563a39['model'];_0x6948c7[_0x3ea6('0x38')]=qs['sort'](_0x118e91[_0x3ea6('0x33')]['sort']);_0x6948c7['where']=qs[_0x3ea6('0x3a')](_[_0x3ea6('0x55')](_0x118e91[_0x3ea6('0x33')],_0x563a39['filters']));if(_0x118e91[_0x3ea6('0x33')][_0x3ea6('0x3b')]){_0x6948c7[_0x3ea6('0x3c')]=_['merge'](_0x6948c7['where'],{'$or':_[_0x3ea6('0x2b')](_0x6948c7[_0x3ea6('0x34')],function(_0x4d627e){var _0x46004c={};_0x46004c[_0x4d627e]={'$like':'%'+_0x118e91[_0x3ea6('0x33')]['filter']+'%'};return _0x46004c;})});}_0x6948c7=_[_0x3ea6('0x3d')]({},_0x6948c7,_0x118e91[_0x3ea6('0x3e')]);return _0x4e08b1[_0x3ea6('0x61')](_0x6948c7);}})[_0x3ea6('0x24')](function(_0x13eca5){if(_0x13eca5){_0x4bedbc=_0x13eca5['length'];if(!_0x118e91[_0x3ea6('0x33')][_0x3ea6('0x37')](_0x3ea6('0x54'))){_0x6948c7[_0x3ea6('0x1f')]=qs['limit'](_0x118e91[_0x3ea6('0x33')][_0x3ea6('0x1f')]);_0x6948c7[_0x3ea6('0x1d')]=qs[_0x3ea6('0x1d')](_0x118e91[_0x3ea6('0x33')][_0x3ea6('0x1d')]);}return _0x4e08b1[_0x3ea6('0x61')](_0x6948c7);}})[_0x3ea6('0x24')](function(_0x244748){if(_0x244748){return _0x244748?{'count':_0x4bedbc,'rows':_0x244748}:null;}})[_0x3ea6('0x24')](respondWithResult(_0x332114,null))[_0x3ea6('0x43')](handleError(_0x332114,null));};exports[_0x3ea6('0x62')]=function(_0x3be189,_0x530d34,_0xfc6305){var _0x1c62bf=_0x3be189[_0x3ea6('0x49')][_0x3ea6('0x63')];return db['Team'][_0x3ea6('0x41')]({'where':{'id':_0x1c62bf},'attributes':['id'],'include':[{'model':db[_0x3ea6('0x58')],'as':'Agents','attributes':['id',_0x3ea6('0x28'),_0x3ea6('0x64'),_0x3ea6('0x65'),_0x3ea6('0x66')],'raw':!![]}]})['then'](function(_0x4625a6){if(_0x4625a6){var _0xce192e=_[_0x3ea6('0x67')](_0x4625a6,function(_0x28b5c6){var _0x2c4ce5=_0x28b5c6[_0x3ea6('0x25')]({'plain':!![]});return _0x2c4ce5[_0x3ea6('0x68')];});return db['MailQueue'][_0x3ea6('0x47')]({'where':{'id':_0x3be189[_0x3ea6('0x45')]['id']}})[_0x3ea6('0x24')](function(_0x3b4dd9){return db['sequelize'][_0x3ea6('0x69')](function(_0x324755){return _0x3b4dd9[_0x3ea6('0x62')](_0x1c62bf,{'transaction':_0x324755})[_0x3ea6('0x24')](function(){return BPromise[_0x3ea6('0x6a')](_0xce192e,function(_0x3372de){return db[_0x3ea6('0x57')][_0x3ea6('0x6b')]({'where':{'UserId':_0x3372de['id'],'MailQueueId':_0x3be189[_0x3ea6('0x45')]['id']},'transaction':_0x324755});});})[_0x3ea6('0x24')](function(){_0xce192e[_0x3ea6('0x6c')](function(_0x3b741b){socket['emit']('userMailQueue:save',{'UserId':_0x3b741b['id'],'MailQueueId':_0x3b4dd9['id']});});});});});}})[_0x3ea6('0x24')](respondWithStatusCode(_0x530d34,null))[_0x3ea6('0x43')](handleError(_0x530d34,null));};exports[_0x3ea6('0x6d')]=function(_0xd19f96,_0xb42500,_0x4f705e){return db[_0x3ea6('0x6e')]['findAll']({'where':{'id':_0xd19f96['query'][_0x3ea6('0x63')]},'attributes':['id'],'include':[{'model':db[_0x3ea6('0x58')],'as':_0x3ea6('0x68'),'attributes':['id'],'raw':!![]}]})[_0x3ea6('0x24')](handleEntityNotFound(_0xb42500,null))[_0x3ea6('0x24')](function(_0xc0cc52){var _0x4a274b=_[_0x3ea6('0x2b')](_0xc0cc52,'id');var _0x11e988=[];var _0x3fa5bd=[];var _0x1bcdaf=squel['select']();_0x1bcdaf[_0x3ea6('0x6f')]('tq.TeamId')[_0x3ea6('0x70')](_0x3ea6('0x71'),'tq')[_0x3ea6('0x72')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x3ea6('0x3c')](_0x3ea6('0x73'),_0xd19f96['params']['id']);for(var _0x5d0e99=0x0;_0x5d0e99<_0xc0cc52[_0x3ea6('0x36')];_0x5d0e99+=0x1){let _0x1e4f2a=_0xc0cc52[_0x5d0e99];for(var _0x3d9fa9=0x0;_0x3d9fa9<_0x1e4f2a[_0x3ea6('0x68')]['length'];_0x3d9fa9+=0x1){let _0x18cc53=_0x1e4f2a[_0x3ea6('0x68')][_0x3d9fa9];var _0x36ec89=_0x1bcdaf['clone']();_0x36ec89[_0x3ea6('0x3c')](_0x3ea6('0x74'),_0x18cc53['id']);_0x3fa5bd[_0x3ea6('0x75')](db['sequelize'][_0x3ea6('0x33')](_0x36ec89['toString'](),{'type':db[_0x3ea6('0x76')][_0x3ea6('0x77')][_0x3ea6('0x78')]})[_0x3ea6('0x24')](function(_0x34be1){if(_0x34be1[_0x3ea6('0x36')]===0x1){return _0x18cc53['id'];}else{var _0x2766a8=_[_0x3ea6('0x79')](_[_0x3ea6('0x2b')](_0x34be1,'TeamId'),function(_0x750035){return _['includes'](_0x4a274b,_0x750035);});if(_0x2766a8){return _0x18cc53['id'];}}}));}}return BPromise[_0x3ea6('0x7a')](_0x3fa5bd)[_0x3ea6('0x24')](function(_0x465e05){_0x11e988=_(_0x11e988)[_0x3ea6('0x7b')](_0x465e05)[_0x3ea6('0x7c')]()['value']();return db[_0x3ea6('0x2c')]['find']({'where':{'id':_0xd19f96[_0x3ea6('0x45')]['id']}})['then'](function(_0x316444){return db[_0x3ea6('0x76')][_0x3ea6('0x69')](function(_0x391ec3){return _0x316444[_0x3ea6('0x6d')](_0xd19f96[_0x3ea6('0x33')][_0x3ea6('0x63')],{'transaction':_0x391ec3})[_0x3ea6('0x24')](function(){if(!_[_0x3ea6('0x7d')](_0x11e988)){return _0x316444[_0x3ea6('0x7e')](_0x11e988,{'transaction':_0x391ec3});}})[_0x3ea6('0x24')](function(){_0x11e988[_0x3ea6('0x6c')](function(_0x31e2ee){socket['emit'](_0x3ea6('0x7f'),{'UserId':_0x31e2ee,'MailQueueId':_0x316444['id']});});});});});});})[_0x3ea6('0x24')](respondWithStatusCode(_0xb42500,null))[_0x3ea6('0x43')](handleError(_0xb42500,null));};exports[_0x3ea6('0x80')]=function(_0x1f4261,_0x296dcb,_0x161eda){return db['MailQueue'][_0x3ea6('0x47')]({'where':{'id':_0x1f4261[_0x3ea6('0x45')]['id']}})['then'](handleEntityNotFound(_0x296dcb,null))[_0x3ea6('0x24')](function(_0x33bc05){if(_0x33bc05){return _0x33bc05[_0x3ea6('0x80')](_0x1f4261[_0x3ea6('0x49')]['ids'],_[_0x3ea6('0x81')](_0x1f4261[_0x3ea6('0x49')],[_0x3ea6('0x63'),'id'])||{})[_0x3ea6('0x82')](function(_0xba4a63){for(var _0x46e15f=0x0;_0x46e15f<_0x1f4261[_0x3ea6('0x49')][_0x3ea6('0x63')]['length'];_0x46e15f+=0x1){socket[_0x3ea6('0x83')](_0x3ea6('0x84'),{'UserId':Number(_0x1f4261[_0x3ea6('0x49')][_0x3ea6('0x63')][_0x46e15f]),'MailQueueId':Number(_0x1f4261[_0x3ea6('0x45')]['id'])});}return _0xba4a63;});}})[_0x3ea6('0x24')](respondWithResult(_0x296dcb,null))[_0x3ea6('0x43')](handleError(_0x296dcb,null));};exports[_0x3ea6('0x7e')]=function(_0x141630,_0x11a005,_0x537d75){return db[_0x3ea6('0x2c')][_0x3ea6('0x47')]({'where':{'id':_0x141630[_0x3ea6('0x45')]['id']}})['then'](handleEntityNotFound(_0x11a005,null))[_0x3ea6('0x24')](function(_0x3970fc){if(_0x3970fc){return _0x3970fc[_0x3ea6('0x7e')](_0x141630['query'][_0x3ea6('0x63')])[_0x3ea6('0x24')](function(){if(_[_0x3ea6('0x85')](_0x141630['query'][_0x3ea6('0x63')])){for(var _0x5d4a77=0x0;_0x5d4a77<_0x141630[_0x3ea6('0x33')]['ids'][_0x3ea6('0x36')];_0x5d4a77+=0x1){socket[_0x3ea6('0x83')](_0x3ea6('0x7f'),{'UserId':Number(_0x141630[_0x3ea6('0x33')][_0x3ea6('0x63')][_0x5d4a77]),'MailQueueId':Number(_0x141630['params']['id'])});}}else{socket[_0x3ea6('0x83')]('userMailQueue:remove',{'UserId':Number(_0x141630[_0x3ea6('0x33')][_0x3ea6('0x63')]),'MailQueueId':Number(_0x141630['params']['id'])});}});}})[_0x3ea6('0x24')](respondWithStatusCode(_0x11a005,null))[_0x3ea6('0x43')](handleError(_0x11a005,null));};exports['getAgents']=function(_0x4dffb7,_0x487ff6,_0x5652fa){var _0x4c586d={};var _0x2db36c={};var _0x79b850;var _0x2398e5;return db[_0x3ea6('0x2c')][_0x3ea6('0x53')]({'where':{'id':_0x4dffb7['params']['id']}})['then'](handleEntityNotFound(_0x487ff6,null))[_0x3ea6('0x24')](function(_0x14721a){if(_0x14721a){_0x79b850=_0x14721a;_0x2db36c[_0x3ea6('0x32')]=_[_0x3ea6('0x30')](db[_0x3ea6('0x58')][_0x3ea6('0x46')]);_0x2db36c[_0x3ea6('0x33')]=_[_0x3ea6('0x30')](_0x4dffb7[_0x3ea6('0x33')]);_0x2db36c[_0x3ea6('0x3a')]=_['intersection'](_0x2db36c[_0x3ea6('0x32')],_0x2db36c['query']);_0x4c586d[_0x3ea6('0x34')]=_[_0x3ea6('0x31')](_0x2db36c[_0x3ea6('0x32')],qs[_0x3ea6('0x35')](_0x4dffb7['query']['fields']));_0x4c586d[_0x3ea6('0x34')]=_0x4c586d[_0x3ea6('0x34')][_0x3ea6('0x36')]?_0x4c586d[_0x3ea6('0x34')]:_0x2db36c[_0x3ea6('0x32')];_0x4c586d[_0x3ea6('0x38')]=qs[_0x3ea6('0x39')](_0x4dffb7['query']['sort']);_0x4c586d[_0x3ea6('0x3c')]=qs[_0x3ea6('0x3a')](_[_0x3ea6('0x55')](_0x4dffb7[_0x3ea6('0x33')],_0x2db36c['filters']));if(_0x4dffb7[_0x3ea6('0x33')][_0x3ea6('0x3b')]){_0x4c586d[_0x3ea6('0x3c')]=_[_0x3ea6('0x3d')](_0x4c586d[_0x3ea6('0x3c')],{'$or':_['map'](_0x4c586d['attributes'],function(_0x3e5757){var _0x49dcab={};_0x49dcab[_0x3e5757]={'$like':'%'+_0x4dffb7[_0x3ea6('0x33')]['filter']+'%'};return _0x49dcab;})});}_0x4c586d=_[_0x3ea6('0x3d')]({},_0x4c586d,_0x4dffb7['options']);return _0x79b850[_0x3ea6('0x86')](_0x4c586d);}})['then'](function(_0x361b75){if(_0x361b75){_0x2398e5=_0x361b75['length'];if(!_0x4dffb7[_0x3ea6('0x33')][_0x3ea6('0x37')](_0x3ea6('0x54'))){_0x4c586d['limit']=qs['limit'](_0x4dffb7['query']['limit']);_0x4c586d[_0x3ea6('0x1d')]=qs['offset'](_0x4dffb7['query']['offset']);}return _0x79b850[_0x3ea6('0x86')](_0x4c586d);}})[_0x3ea6('0x24')](function(_0x579b07){if(_0x579b07){return _0x579b07?{'count':_0x2398e5,'rows':_0x579b07}:null;}})['then'](respondWithResult(_0x487ff6,null))['catch'](handleError(_0x487ff6,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 37a8ec9..dae69ae 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 _0x402d=['exports','events','../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x402d,0x141));var _0xd402=function(_0x5d31e4,_0x2775e0){_0x5d31e4=_0x5d31e4-0x0;var _0xad568d=_0x402d[_0x5d31e4];return _0xad568d;};'use strict';var EventEmitter=require(_0xd402('0x0'));var MailQueue=require(_0xd402('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xd402('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd402('0x3'),'afterDestroy':'remove'};function emitEvent(_0x50aeb7){return function(_0x4d6ad5,_0x95b5ea,_0x8296dc){MailQueueEvents[_0xd402('0x4')](_0x50aeb7+':'+_0x4d6ad5['id'],_0x4d6ad5);MailQueueEvents['emit'](_0x50aeb7,_0x4d6ad5);_0x8296dc(null);};}for(var e in events){if(events[_0xd402('0x5')](e)){var event=events[e];MailQueue[_0xd402('0x6')](e,emitEvent(event));}}module[_0xd402('0x7')]=MailQueueEvents; \ No newline at end of file +var _0x5175=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x34848a,_0x1ed529){var _0x51acd9=function(_0x1bfa6f){while(--_0x1bfa6f){_0x34848a['push'](_0x34848a['shift']());}};_0x51acd9(++_0x1ed529);}(_0x5175,0x10d));var _0x5517=function(_0x20e929,_0x5260d7){_0x20e929=_0x20e929-0x0;var _0x1a6042=_0x5175[_0x20e929];return _0x1a6042;};'use strict';var EventEmitter=require(_0x5517('0x0'));var MailQueue=require(_0x5517('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x5517('0x2')](0x0);var events={'afterCreate':_0x5517('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5c0511){return function(_0x2d4ab9,_0x227da4,_0x1be509){MailQueueEvents[_0x5517('0x4')](_0x5c0511+':'+_0x2d4ab9['id'],_0x2d4ab9);MailQueueEvents[_0x5517('0x4')](_0x5c0511,_0x2d4ab9);_0x1be509(null);};}for(var e in events){if(events[_0x5517('0x5')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x5517('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 57074c5..889cc10 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 _0x33b9=['api','moment','request-promise','path','rimraf','./mailQueue.attributes','exports','define','MailQueue','lodash','../../config/logger'];(function(_0x44ea1b,_0x36bbd3){var _0x239690=function(_0x3ec34b){while(--_0x3ec34b){_0x44ea1b['push'](_0x44ea1b['shift']());}};_0x239690(++_0x36bbd3);}(_0x33b9,0xda));var _0x933b=function(_0x2ef461,_0x48c29e){_0x2ef461=_0x2ef461-0x0;var _0x8a2194=_0x33b9[_0x2ef461];return _0x8a2194;};'use strict';var _=require(_0x933b('0x0'));var util=require('util');var logger=require(_0x933b('0x1'))(_0x933b('0x2'));var moment=require(_0x933b('0x3'));var BPromise=require('bluebird');var rp=require(_0x933b('0x4'));var fs=require('fs');var path=require(_0x933b('0x5'));var rimraf=require(_0x933b('0x6'));var config=require('../../config/environment');var attributes=require(_0x933b('0x7'));module[_0x933b('0x8')]=function(_0x15b432,_0x2780cf){return _0x15b432[_0x933b('0x9')](_0x933b('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c05=['api','moment','bluebird','request-promise','path','rimraf','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger'];(function(_0x19bd0c,_0x3bb2f3){var _0x2dbaad=function(_0xd548f7){while(--_0xd548f7){_0x19bd0c['push'](_0x19bd0c['shift']());}};_0x2dbaad(++_0x3bb2f3);}(_0x7c05,0x1d9));var _0x57c0=function(_0x52e68e,_0x309912){_0x52e68e=_0x52e68e-0x0;var _0x3211a4=_0x7c05[_0x52e68e];return _0x3211a4;};'use strict';var _=require(_0x57c0('0x0'));var util=require(_0x57c0('0x1'));var logger=require(_0x57c0('0x2'))(_0x57c0('0x3'));var moment=require(_0x57c0('0x4'));var BPromise=require(_0x57c0('0x5'));var rp=require(_0x57c0('0x6'));var fs=require('fs');var path=require(_0x57c0('0x7'));var rimraf=require(_0x57c0('0x8'));var config=require('../../config/environment');var attributes=require(_0x57c0('0x9'));module[_0x57c0('0xa')]=function(_0x16aceb,_0x5e0c79){return _0x16aceb[_0x57c0('0xb')](_0x57c0('0xc'),attributes,{'tableName':_0x57c0('0xd'),'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 a632048..5cbec75 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 _0x0f68=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailQueue.socket','request','then','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetMailQueue','MailQueue','findAll','options','attributes','limit','include','model','debug','where','map','ShowMailQueue'];(function(_0x4550bc,_0x1f6b01){var _0x1b3588=function(_0x5e7fbf){while(--_0x5e7fbf){_0x4550bc['push'](_0x4550bc['shift']());}};_0x1b3588(++_0x1f6b01);}(_0x0f68,0xea));var _0x80f6=function(_0x37ea64,_0x118c0e){_0x37ea64=_0x37ea64-0x0;var _0x348249=_0x0f68[_0x37ea64];return _0x348249;};'use strict';var _=require(_0x80f6('0x0'));var util=require(_0x80f6('0x1'));var moment=require(_0x80f6('0x2'));var BPromise=require(_0x80f6('0x3'));var rs=require(_0x80f6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x80f6('0x5'))['db'];var utils=require(_0x80f6('0x6'));var logger=require('../../config/logger')(_0x80f6('0x7'));var config=require(_0x80f6('0x8'));var jayson=require(_0x80f6('0x9'));var client=jayson[_0x80f6('0xa')][_0x80f6('0xb')]({'port':0x232a});config[_0x80f6('0xc')]=_[_0x80f6('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x80f6('0xe'))(new Redis(config['redis']));require(_0x80f6('0xf'))['register'](socket);function respondWithRpcPromise(_0xf9492e,_0x13e6b0,_0x9daea1){return new BPromise(function(_0x8a6a5f,_0x215ae8){return client[_0x80f6('0x10')](_0xf9492e,_0x9daea1)[_0x80f6('0x11')](function(_0x130f6e){logger['info'](_0x80f6('0x12'),_0x13e6b0,_0x80f6('0x13'));logger['debug'](_0x80f6('0x14'),_0x13e6b0,_0x80f6('0x13'),JSON[_0x80f6('0x15')](_0x130f6e));if(_0x130f6e[_0x80f6('0x16')]){if(_0x130f6e[_0x80f6('0x16')][_0x80f6('0x17')]===0x1f4){logger[_0x80f6('0x16')](_0x80f6('0x12'),_0x13e6b0,_0x130f6e[_0x80f6('0x16')][_0x80f6('0x18')]);return _0x215ae8(_0x130f6e[_0x80f6('0x16')][_0x80f6('0x18')]);}logger[_0x80f6('0x16')](_0x80f6('0x12'),_0x13e6b0,_0x130f6e[_0x80f6('0x16')]['message']);return _0x8a6a5f(_0x130f6e[_0x80f6('0x16')][_0x80f6('0x18')]);}else{logger[_0x80f6('0x19')]('MailQueue,\x20%s,\x20%s',_0x13e6b0,_0x80f6('0x13'));_0x8a6a5f(_0x130f6e['result'][_0x80f6('0x18')]);}})[_0x80f6('0x1a')](function(_0x2fd8a1){logger[_0x80f6('0x16')](_0x80f6('0x12'),_0x13e6b0,_0x2fd8a1);_0x215ae8(_0x2fd8a1);});});}exports[_0x80f6('0x1b')]=function(_0x1f1ee5){var _0x1419cc=this;return new Promise(function(_0x44472d,_0x335ad8){return db[_0x80f6('0x1c')][_0x80f6('0x1d')]({'raw':_0x1f1ee5['options']?_0x1f1ee5[_0x80f6('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x1f1ee5['options']?_0x1f1ee5[_0x80f6('0x1e')]['where']||null:null,'attributes':_0x1f1ee5['options']?_0x1f1ee5[_0x80f6('0x1e')][_0x80f6('0x1f')]||null:null,'limit':_0x1f1ee5[_0x80f6('0x1e')]?_0x1f1ee5[_0x80f6('0x1e')][_0x80f6('0x20')]||null:null,'include':_0x1f1ee5[_0x80f6('0x1e')]?_0x1f1ee5[_0x80f6('0x1e')][_0x80f6('0x21')]?_['map'](_0x1f1ee5['options']['include'],function(_0x17a441){return{'model':db[_0x17a441[_0x80f6('0x22')]],'as':_0x17a441['as'],'attributes':_0x17a441[_0x80f6('0x1f')],'include':_0x17a441[_0x80f6('0x21')]?_['map'](_0x17a441[_0x80f6('0x21')],function(_0xc27df6){return{'model':db[_0xc27df6[_0x80f6('0x22')]],'as':_0xc27df6['as'],'attributes':_0xc27df6[_0x80f6('0x1f')],'include':_0xc27df6[_0x80f6('0x21')]?_['map'](_0xc27df6['include'],function(_0x2816be){return{'model':db[_0x2816be['model']],'as':_0x2816be['as'],'attributes':_0x2816be[_0x80f6('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x80f6('0x11')](function(_0x4ab23e){logger[_0x80f6('0x19')](_0x80f6('0x1b'),_0x1f1ee5);logger[_0x80f6('0x23')]('GetMailQueue',_0x1f1ee5,JSON[_0x80f6('0x15')](_0x4ab23e));_0x44472d(_0x4ab23e);})[_0x80f6('0x1a')](function(_0x30e0ed){logger[_0x80f6('0x16')](_0x80f6('0x1b'),_0x30e0ed['message'],_0x1f1ee5);_0x335ad8(_0x1419cc[_0x80f6('0x16')](0x1f4,_0x30e0ed[_0x80f6('0x18')]));});});};exports['ShowMailQueue']=function(_0x53c13b){var _0x49c8f5=this;return new Promise(function(_0x3e5a54,_0x17857e){return db[_0x80f6('0x1c')]['find']({'raw':_0x53c13b['options']?_0x53c13b[_0x80f6('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x53c13b[_0x80f6('0x1e')]?_0x53c13b[_0x80f6('0x1e')][_0x80f6('0x24')]||null:null,'attributes':_0x53c13b[_0x80f6('0x1e')]?_0x53c13b[_0x80f6('0x1e')][_0x80f6('0x1f')]||null:null,'include':_0x53c13b['options']?_0x53c13b[_0x80f6('0x1e')][_0x80f6('0x21')]?_[_0x80f6('0x25')](_0x53c13b[_0x80f6('0x1e')][_0x80f6('0x21')],function(_0x3a8440){return{'model':db[_0x3a8440[_0x80f6('0x22')]],'as':_0x3a8440['as'],'attributes':_0x3a8440[_0x80f6('0x1f')],'include':_0x3a8440[_0x80f6('0x21')]?_[_0x80f6('0x25')](_0x3a8440['include'],function(_0x4552aa){return{'model':db[_0x4552aa[_0x80f6('0x22')]],'as':_0x4552aa['as'],'attributes':_0x4552aa[_0x80f6('0x1f')],'include':_0x4552aa[_0x80f6('0x21')]?_[_0x80f6('0x25')](_0x4552aa['include'],function(_0x39b8ad){return{'model':db[_0x39b8ad[_0x80f6('0x22')]],'as':_0x39b8ad['as'],'attributes':_0x39b8ad[_0x80f6('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2605ed){logger[_0x80f6('0x19')](_0x80f6('0x26'),_0x53c13b);logger[_0x80f6('0x23')](_0x80f6('0x26'),_0x53c13b,JSON[_0x80f6('0x15')](_0x2605ed));_0x3e5a54(_0x2605ed);})[_0x80f6('0x1a')](function(_0x4a5ad4){logger[_0x80f6('0x16')](_0x80f6('0x26'),_0x4a5ad4['message'],_0x53c13b);_0x17857e(_0x49c8f5['error'](0x1f4,_0x4a5ad4[_0x80f6('0x18')]));});});}; \ No newline at end of file +var _0x38fd=['request\x20sent','result','catch','MailQueue','findAll','options','raw','include','map','model','GetMailQueue','debug','ShowMailQueue','find','attributes','then','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailQueue.socket','register','request','MailQueue,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x3808e6,_0x5806c9){var _0x413cc0=function(_0x4cc4d3){while(--_0x4cc4d3){_0x3808e6['push'](_0x3808e6['shift']());}};_0x413cc0(++_0x5806c9);}(_0x38fd,0x100));var _0xd38f=function(_0x39932f,_0x2b99b5){_0x39932f=_0x39932f-0x0;var _0x3b9e95=_0x38fd[_0x39932f];return _0x3b9e95;};'use strict';var _=require(_0xd38f('0x0'));var util=require(_0xd38f('0x1'));var moment=require(_0xd38f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd38f('0x3'));var db=require(_0xd38f('0x4'))['db'];var utils=require(_0xd38f('0x5'));var logger=require(_0xd38f('0x6'))(_0xd38f('0x7'));var config=require(_0xd38f('0x8'));var jayson=require(_0xd38f('0x9'));var client=jayson[_0xd38f('0xa')][_0xd38f('0xb')]({'port':0x232a});config[_0xd38f('0xc')]=_[_0xd38f('0xd')](config[_0xd38f('0xc')],{'host':_0xd38f('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd38f('0xc')]));require(_0xd38f('0xf'))[_0xd38f('0x10')](socket);function respondWithRpcPromise(_0xd4cc94,_0x217157,_0x3c2afe){return new BPromise(function(_0x52a0d7,_0x56b79a){return client[_0xd38f('0x11')](_0xd4cc94,_0x3c2afe)['then'](function(_0x9f473b){logger['info'](_0xd38f('0x12'),_0x217157,'request\x20sent');logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0x217157,'request\x20sent',JSON[_0xd38f('0x13')](_0x9f473b));if(_0x9f473b[_0xd38f('0x14')]){if(_0x9f473b[_0xd38f('0x14')][_0xd38f('0x15')]===0x1f4){logger[_0xd38f('0x14')]('MailQueue,\x20%s,\x20%s',_0x217157,_0x9f473b[_0xd38f('0x14')][_0xd38f('0x16')]);return _0x56b79a(_0x9f473b[_0xd38f('0x14')][_0xd38f('0x16')]);}logger[_0xd38f('0x14')](_0xd38f('0x12'),_0x217157,_0x9f473b[_0xd38f('0x14')]['message']);return _0x52a0d7(_0x9f473b[_0xd38f('0x14')]['message']);}else{logger[_0xd38f('0x17')](_0xd38f('0x12'),_0x217157,_0xd38f('0x18'));_0x52a0d7(_0x9f473b[_0xd38f('0x19')][_0xd38f('0x16')]);}})[_0xd38f('0x1a')](function(_0x3a6fa5){logger[_0xd38f('0x14')](_0xd38f('0x12'),_0x217157,_0x3a6fa5);_0x56b79a(_0x3a6fa5);});});}exports['GetMailQueue']=function(_0x8bc840){var _0x4c821f=this;return new Promise(function(_0xba723b,_0x5ee996){return db[_0xd38f('0x1b')][_0xd38f('0x1c')]({'raw':_0x8bc840[_0xd38f('0x1d')]?_0x8bc840[_0xd38f('0x1d')][_0xd38f('0x1e')]===undefined?!![]:![]:!![],'where':_0x8bc840[_0xd38f('0x1d')]?_0x8bc840[_0xd38f('0x1d')]['where']||null:null,'attributes':_0x8bc840[_0xd38f('0x1d')]?_0x8bc840['options']['attributes']||null:null,'limit':_0x8bc840[_0xd38f('0x1d')]?_0x8bc840['options']['limit']||null:null,'include':_0x8bc840[_0xd38f('0x1d')]?_0x8bc840[_0xd38f('0x1d')][_0xd38f('0x1f')]?_[_0xd38f('0x20')](_0x8bc840[_0xd38f('0x1d')][_0xd38f('0x1f')],function(_0x264793){return{'model':db[_0x264793[_0xd38f('0x21')]],'as':_0x264793['as'],'attributes':_0x264793['attributes'],'include':_0x264793[_0xd38f('0x1f')]?_[_0xd38f('0x20')](_0x264793[_0xd38f('0x1f')],function(_0xd38804){return{'model':db[_0xd38804['model']],'as':_0xd38804['as'],'attributes':_0xd38804['attributes'],'include':_0xd38804['include']?_[_0xd38f('0x20')](_0xd38804['include'],function(_0x34f02c){return{'model':db[_0x34f02c[_0xd38f('0x21')]],'as':_0x34f02c['as'],'attributes':_0x34f02c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1755b7){logger[_0xd38f('0x17')](_0xd38f('0x22'),_0x8bc840);logger[_0xd38f('0x23')]('GetMailQueue',_0x8bc840,JSON['stringify'](_0x1755b7));_0xba723b(_0x1755b7);})[_0xd38f('0x1a')](function(_0x43af1b){logger['error'](_0xd38f('0x22'),_0x43af1b[_0xd38f('0x16')],_0x8bc840);_0x5ee996(_0x4c821f[_0xd38f('0x14')](0x1f4,_0x43af1b[_0xd38f('0x16')]));});});};exports[_0xd38f('0x24')]=function(_0x8d2910){var _0x20324d=this;return new Promise(function(_0x579094,_0x312d71){return db[_0xd38f('0x1b')][_0xd38f('0x25')]({'raw':_0x8d2910['options']?_0x8d2910[_0xd38f('0x1d')][_0xd38f('0x1e')]===undefined?!![]:![]:!![],'where':_0x8d2910[_0xd38f('0x1d')]?_0x8d2910[_0xd38f('0x1d')]['where']||null:null,'attributes':_0x8d2910[_0xd38f('0x1d')]?_0x8d2910[_0xd38f('0x1d')]['attributes']||null:null,'include':_0x8d2910['options']?_0x8d2910[_0xd38f('0x1d')][_0xd38f('0x1f')]?_[_0xd38f('0x20')](_0x8d2910[_0xd38f('0x1d')][_0xd38f('0x1f')],function(_0x5eb322){return{'model':db[_0x5eb322[_0xd38f('0x21')]],'as':_0x5eb322['as'],'attributes':_0x5eb322[_0xd38f('0x26')],'include':_0x5eb322['include']?_[_0xd38f('0x20')](_0x5eb322[_0xd38f('0x1f')],function(_0x2f9139){return{'model':db[_0x2f9139[_0xd38f('0x21')]],'as':_0x2f9139['as'],'attributes':_0x2f9139[_0xd38f('0x26')],'include':_0x2f9139[_0xd38f('0x1f')]?_[_0xd38f('0x20')](_0x2f9139['include'],function(_0x2cfbe1){return{'model':db[_0x2cfbe1['model']],'as':_0x2cfbe1['as'],'attributes':_0x2cfbe1[_0xd38f('0x26')]};}):[]};}):[]};}):[]:[]})[_0xd38f('0x27')](function(_0x415a04){logger[_0xd38f('0x17')](_0xd38f('0x24'),_0x8d2910);logger[_0xd38f('0x23')](_0xd38f('0x24'),_0x8d2910,JSON['stringify'](_0x415a04));_0x579094(_0x415a04);})['catch'](function(_0x168d68){logger[_0xd38f('0x14')]('ShowMailQueue',_0x168d68['message'],_0x8d2910);_0x312d71(_0x20324d[_0xd38f('0x14')](0x1f4,_0x168d68[_0xd38f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index f946604..078b2d6 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 _0x5eb3=['mailQueue:','./mailQueue.events','save','remove','update','emit','removeListener','register','length'];(function(_0x164097,_0x47399b){var _0x17092a=function(_0x507cc9){while(--_0x507cc9){_0x164097['push'](_0x164097['shift']());}};_0x17092a(++_0x47399b);}(_0x5eb3,0xd0));var _0x35eb=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x5eb3[_0x2283dc];return _0x16db90;};'use strict';var MailQueueEvents=require(_0x35eb('0x0'));var events=[_0x35eb('0x1'),_0x35eb('0x2'),_0x35eb('0x3')];function createListener(_0x45441e,_0x186413){return function(_0x32b599){_0x186413[_0x35eb('0x4')](_0x45441e,_0x32b599);};}function removeListener(_0x54ec1a,_0x252036){return function(){MailQueueEvents[_0x35eb('0x5')](_0x54ec1a,_0x252036);};}exports[_0x35eb('0x6')]=function(_0x1062ca){for(var _0x2a8d75=0x0,_0x45a283=events[_0x35eb('0x7')];_0x2a8d75<_0x45a283;_0x2a8d75++){var _0x231395=events[_0x2a8d75];var _0x5973e0=createListener(_0x35eb('0x8')+_0x231395,_0x1062ca);MailQueueEvents['on'](_0x231395,_0x5973e0);}}; \ No newline at end of file +var _0x75b2=['remove','register','length','mailQueue:','./mailQueue.events','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x75b2,0x70));var _0x275b=function(_0x1364f9,_0x422296){_0x1364f9=_0x1364f9-0x0;var _0x1af7b9=_0x75b2[_0x1364f9];return _0x1af7b9;};'use strict';var MailQueueEvents=require(_0x275b('0x0'));var events=[_0x275b('0x1'),_0x275b('0x2'),'update'];function createListener(_0xb8a051,_0x1117c2){return function(_0x4d4846){_0x1117c2['emit'](_0xb8a051,_0x4d4846);};}function removeListener(_0x52fac7,_0x4a951f){return function(){MailQueueEvents['removeListener'](_0x52fac7,_0x4a951f);};}exports[_0x275b('0x3')]=function(_0x2dd470){for(var _0x4d61f5=0x0,_0x4c75be=events[_0x275b('0x4')];_0x4d61f5<_0x4c75be;_0x4d61f5++){var _0x254edd=events[_0x4d61f5];var _0x567c5f=createListener(_0x275b('0x5')+_0x254edd,_0x2dd470);MailQueueEvents['on'](_0x254edd,_0x567c5f);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index c429acc..2cb314d 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 _0xb2b1=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','/describe','describe','get','/:id','show','create','put','update','delete'];(function(_0x5554de,_0x48e926){var _0x20a405=function(_0xf62196){while(--_0xf62196){_0x5554de['push'](_0x5554de['shift']());}};_0x20a405(++_0x48e926);}(_0xb2b1,0xde));var _0x1b2b=function(_0x5791f3,_0x5d5453){_0x5791f3=_0x5791f3-0x0;var _0x1564a2=_0xb2b1[_0x5791f3];return _0x1564a2;};'use strict';var multer=require(_0x1b2b('0x0'));var util=require(_0x1b2b('0x1'));var path=require(_0x1b2b('0x2'));var timeout=require(_0x1b2b('0x3'));var express=require(_0x1b2b('0x4'));var router=express['Router']();var fs_extra=require(_0x1b2b('0x5'));var auth=require(_0x1b2b('0x6'));var interaction=require(_0x1b2b('0x7'));var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router['get']('/',auth[_0x1b2b('0x8')](),controller['index']);router['get'](_0x1b2b('0x9'),auth[_0x1b2b('0x8')](),controller[_0x1b2b('0xa')]);router[_0x1b2b('0xb')](_0x1b2b('0xc'),auth[_0x1b2b('0x8')](),controller[_0x1b2b('0xd')]);router['post']('/',auth[_0x1b2b('0x8')](),controller[_0x1b2b('0xe')]);router[_0x1b2b('0xf')]('/:id',auth[_0x1b2b('0x8')](),controller[_0x1b2b('0x10')]);router[_0x1b2b('0x11')](_0x1b2b('0xc'),auth['isAuthenticated'](),controller[_0x1b2b('0x12')]);module[_0x1b2b('0x13')]=router; \ No newline at end of file +var _0x1e6c=['describe','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','index','get','/describe','isAuthenticated'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x1e6c,0xaa));var _0xc1e6=function(_0x42c3ea,_0x2cae04){_0x42c3ea=_0x42c3ea-0x0;var _0x294a04=_0x1e6c[_0x42c3ea];return _0x294a04;};'use strict';var multer=require(_0xc1e6('0x0'));var util=require(_0xc1e6('0x1'));var path=require(_0xc1e6('0x2'));var timeout=require(_0xc1e6('0x3'));var express=require(_0xc1e6('0x4'));var router=express[_0xc1e6('0x5')]();var fs_extra=require(_0xc1e6('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc1e6('0x7'));var config=require(_0xc1e6('0x8'));var controller=require(_0xc1e6('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xc1e6('0xa')]);router[_0xc1e6('0xb')](_0xc1e6('0xc'),auth[_0xc1e6('0xd')](),controller[_0xc1e6('0xe')]);router[_0xc1e6('0xb')]('/:id',auth[_0xc1e6('0xd')](),controller[_0xc1e6('0xf')]);router[_0xc1e6('0x10')]('/',auth[_0xc1e6('0xd')](),controller[_0xc1e6('0x11')]);router['put'](_0xc1e6('0x12'),auth[_0xc1e6('0xd')](),controller[_0xc1e6('0x13')]);router[_0xc1e6('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xc1e6('0x15')]);module[_0xc1e6('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 4b2d59e..77e3d84 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 _0xde5f=['DATE','moment','sequelize','exports','STRING'];(function(_0x21ef85,_0x2d9f4f){var _0x5b9a7d=function(_0x5b5f13){while(--_0x5b5f13){_0x21ef85['push'](_0x21ef85['shift']());}};_0x5b9a7d(++_0x2d9f4f);}(_0xde5f,0x97));var _0xfde5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde5f[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xfde5('0x0'));var Sequelize=require(_0xfde5('0x1'));module[_0xfde5('0x2')]={'uniqueid':{'type':Sequelize[_0xfde5('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xfde5('0x3')]},'joinAt':{'type':Sequelize[_0xfde5('0x4')]},'leaveAt':{'type':Sequelize[_0xfde5('0x4')]},'acceptAt':{'type':Sequelize[_0xfde5('0x4')]},'exitAt':{'type':Sequelize[_0xfde5('0x4')]},'reason':{'type':Sequelize[_0xfde5('0x3')]}}; \ No newline at end of file +var _0xcb14=['DATE','STRING','moment','sequelize','exports'];(function(_0x3e37b1,_0x2baf5d){var _0x2fe97e=function(_0x47d061){while(--_0x47d061){_0x3e37b1['push'](_0x3e37b1['shift']());}};_0x2fe97e(++_0x2baf5d);}(_0xcb14,0x106));var _0x4cb1=function(_0x276221,_0x378da4){_0x276221=_0x276221-0x0;var _0x4fa716=_0xcb14[_0x276221];return _0x4fa716;};'use strict';var moment=require(_0x4cb1('0x0'));var Sequelize=require(_0x4cb1('0x1'));module[_0x4cb1('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x4cb1('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x4cb1('0x3')]},'exitAt':{'type':Sequelize[_0x4cb1('0x3')]},'reason':{'type':Sequelize[_0x4cb1('0x4')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 7df5068..368aa27 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 _0xa456=['where','filters','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','params','keys','options','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','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/utils','../../config/environment','sendStatus','status','end','undefined','count','offset','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','nolimit','limit','order','sort'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xa456,0x142));var _0x6a45=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xa456[_0x4c12ec];return _0x3ae42c;};'use strict';var emlformat=require(_0x6a45('0x0'));var rimraf=require(_0x6a45('0x1'));var zipdir=require(_0x6a45('0x2'));var jsonpatch=require(_0x6a45('0x3'));var rp=require('request-promise');var moment=require(_0x6a45('0x4'));var BPromise=require(_0x6a45('0x5'));var Mustache=require(_0x6a45('0x6'));var util=require('util');var path=require(_0x6a45('0x7'));var sox=require(_0x6a45('0x8'));var csv=require(_0x6a45('0x9'));var ejs=require(_0x6a45('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6a45('0xb'));var squel=require(_0x6a45('0xc'));var crypto=require(_0x6a45('0xd'));var jsforce=require(_0x6a45('0xe'));var deskjs=require(_0x6a45('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6a45('0x10'));var Papa=require('papaparse');var Redis=require(_0x6a45('0x11'));var authService=require(_0x6a45('0x12'));var qs=require(_0x6a45('0x13'));var as=require(_0x6a45('0x14'));var hardwareService=require(_0x6a45('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x6a45('0x16'));var config=require(_0x6a45('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x511b92,_0x1aa4b4){_0x1aa4b4=_0x1aa4b4||0xcc;return function(_0x25a8b9){if(_0x25a8b9){return _0x511b92[_0x6a45('0x18')](_0x1aa4b4);}return _0x511b92[_0x6a45('0x19')](_0x1aa4b4)[_0x6a45('0x1a')]();};}function respondWithResult(_0x5a9f29,_0x563c3b){_0x563c3b=_0x563c3b||0xc8;return function(_0x3a5d94){if(_0x3a5d94){return _0x5a9f29[_0x6a45('0x19')](_0x563c3b)['json'](_0x3a5d94);}};}function respondWithFilteredResult(_0x2c20db,_0x171176){return function(_0x3fab82){if(_0x3fab82){var _0x13adc0=typeof _0x171176['offset']==='undefined'&&typeof _0x171176['limit']===_0x6a45('0x1b');var _0x391f81=_0x3fab82[_0x6a45('0x1c')];var _0x52a055=_0x13adc0?0x0:_0x171176[_0x6a45('0x1d')];var _0x102981=_0x13adc0?_0x3fab82[_0x6a45('0x1c')]:_0x171176['offset']+_0x171176['limit'];var _0x573453;if(_0x102981>=_0x391f81){_0x102981=_0x391f81;_0x573453=0xc8;}else{_0x573453=0xce;}_0x2c20db[_0x6a45('0x19')](_0x573453);return _0x2c20db[_0x6a45('0x1e')]('Content-Range',_0x52a055+'-'+_0x102981+'/'+_0x391f81)[_0x6a45('0x1f')](_0x3fab82);}return null;};}function patchUpdates(_0x1be485){return function(_0x4f7000){try{jsonpatch[_0x6a45('0x20')](_0x4f7000,_0x1be485,!![]);}catch(_0xdf10c6){return BPromise[_0x6a45('0x21')](_0xdf10c6);}return _0x4f7000[_0x6a45('0x22')]();};}function saveUpdates(_0x15ad0e,_0x487666){return function(_0x5d990e){if(_0x5d990e){return _0x5d990e[_0x6a45('0x23')](_0x15ad0e)[_0x6a45('0x24')](function(_0x11290c){return _0x11290c;});}return null;};}function removeEntity(_0x22373c,_0x25a380){return function(_0x3ad898){if(_0x3ad898){return _0x3ad898[_0x6a45('0x25')]()[_0x6a45('0x24')](function(){_0x22373c[_0x6a45('0x19')](0xcc)[_0x6a45('0x1a')]();});}};}function handleEntityNotFound(_0x1310d7,_0x46587a){return function(_0x5cd761){if(!_0x5cd761){_0x1310d7[_0x6a45('0x18')](0x194);}return _0x5cd761;};}function handleError(_0x5a0389,_0x1b83fa){_0x1b83fa=_0x1b83fa||0x1f4;return function(_0x25467d){logger[_0x6a45('0x26')](_0x25467d[_0x6a45('0x27')]);if(_0x25467d[_0x6a45('0x28')]){delete _0x25467d['name'];}_0x5a0389[_0x6a45('0x19')](_0x1b83fa)[_0x6a45('0x29')](_0x25467d);};}exports[_0x6a45('0x2a')]=function(_0x1ccff0,_0x8265d9){var _0x227b6f={},_0x3fac9b={},_0x313c13={'count':0x0,'rows':[]};var _0x54286d=_[_0x6a45('0x2b')](db[_0x6a45('0x2c')][_0x6a45('0x2d')],function(_0x201369){return{'name':_0x201369[_0x6a45('0x2e')],'type':_0x201369['type'][_0x6a45('0x2f')]};});_0x3fac9b[_0x6a45('0x30')]=_[_0x6a45('0x2b')](_0x54286d,_0x6a45('0x28'));_0x3fac9b['query']=_['keys'](_0x1ccff0[_0x6a45('0x31')]);_0x3fac9b['filters']=_[_0x6a45('0x32')](_0x3fac9b['model'],_0x3fac9b[_0x6a45('0x31')]);_0x227b6f[_0x6a45('0x33')]=_[_0x6a45('0x32')](_0x3fac9b[_0x6a45('0x30')],qs[_0x6a45('0x34')](_0x1ccff0[_0x6a45('0x31')][_0x6a45('0x34')]));_0x227b6f[_0x6a45('0x33')]=_0x227b6f[_0x6a45('0x33')][_0x6a45('0x35')]?_0x227b6f[_0x6a45('0x33')]:_0x3fac9b[_0x6a45('0x30')];if(!_0x1ccff0[_0x6a45('0x31')]['hasOwnProperty'](_0x6a45('0x36'))){_0x227b6f['limit']=qs[_0x6a45('0x37')](_0x1ccff0[_0x6a45('0x31')][_0x6a45('0x37')]);_0x227b6f[_0x6a45('0x1d')]=qs[_0x6a45('0x1d')](_0x1ccff0[_0x6a45('0x31')]['offset']);}_0x227b6f[_0x6a45('0x38')]=qs[_0x6a45('0x39')](_0x1ccff0[_0x6a45('0x31')][_0x6a45('0x39')]);_0x227b6f[_0x6a45('0x3a')]=qs[_0x6a45('0x3b')](_['pick'](_0x1ccff0[_0x6a45('0x31')],_0x3fac9b[_0x6a45('0x3b')]),_0x54286d);if(_0x1ccff0['query'][_0x6a45('0x3c')]){_0x227b6f[_0x6a45('0x3a')]=_[_0x6a45('0x3d')](_0x227b6f[_0x6a45('0x3a')],{'$or':_[_0x6a45('0x2b')](_0x54286d,function(_0x50ebe0){if(_0x50ebe0[_0x6a45('0x3e')]!==_0x6a45('0x3f')){var _0x205afd={};_0x205afd[_0x50ebe0[_0x6a45('0x28')]]={'$like':'%'+_0x1ccff0[_0x6a45('0x31')][_0x6a45('0x3c')]+'%'};return _0x205afd;}})});}_0x227b6f=_[_0x6a45('0x3d')]({},_0x227b6f,_0x1ccff0['options']);var _0x1c941a={'where':_0x227b6f['where']};return db[_0x6a45('0x2c')][_0x6a45('0x1c')](_0x1c941a)[_0x6a45('0x24')](function(_0x2715dc){_0x313c13['count']=_0x2715dc;if(_0x1ccff0['query'][_0x6a45('0x40')]){_0x227b6f[_0x6a45('0x41')]=[{'all':!![]}];}return db['MailQueueReport'][_0x6a45('0x42')](_0x227b6f);})[_0x6a45('0x24')](function(_0x3bd926){_0x313c13[_0x6a45('0x43')]=_0x3bd926;return _0x313c13;})['then'](respondWithFilteredResult(_0x8265d9,_0x227b6f))['catch'](handleError(_0x8265d9,null));};exports['show']=function(_0x5b9798,_0xe90201){var _0xb5d191={'raw':!![],'where':{'id':_0x5b9798[_0x6a45('0x44')]['id']}},_0x328d9f={};_0x328d9f[_0x6a45('0x30')]=_[_0x6a45('0x45')](db[_0x6a45('0x2c')][_0x6a45('0x2d')]);_0x328d9f['query']=_[_0x6a45('0x45')](_0x5b9798['query']);_0x328d9f['filters']=_[_0x6a45('0x32')](_0x328d9f[_0x6a45('0x30')],_0x328d9f['query']);_0xb5d191[_0x6a45('0x33')]=_['intersection'](_0x328d9f[_0x6a45('0x30')],qs[_0x6a45('0x34')](_0x5b9798[_0x6a45('0x31')][_0x6a45('0x34')]));_0xb5d191['attributes']=_0xb5d191[_0x6a45('0x33')][_0x6a45('0x35')]?_0xb5d191[_0x6a45('0x33')]:_0x328d9f[_0x6a45('0x30')];if(_0x5b9798[_0x6a45('0x31')]['includeAll']){_0xb5d191[_0x6a45('0x41')]=[{'all':!![]}];}_0xb5d191=_['merge']({},_0xb5d191,_0x5b9798[_0x6a45('0x46')]);return db[_0x6a45('0x2c')]['find'](_0xb5d191)[_0x6a45('0x24')](handleEntityNotFound(_0xe90201,null))[_0x6a45('0x24')](respondWithResult(_0xe90201,null))[_0x6a45('0x47')](handleError(_0xe90201,null));};exports[_0x6a45('0x48')]=function(_0x524296,_0x34bbb7){return db['MailQueueReport'][_0x6a45('0x48')](_0x524296['body'],{})[_0x6a45('0x24')](respondWithResult(_0x34bbb7,0xc9))[_0x6a45('0x47')](handleError(_0x34bbb7,null));};exports[_0x6a45('0x23')]=function(_0x2bf8d3,_0x5d9f52){if(_0x2bf8d3[_0x6a45('0x49')]['id']){delete _0x2bf8d3[_0x6a45('0x49')]['id'];}return db[_0x6a45('0x2c')][_0x6a45('0x4a')]({'where':{'id':_0x2bf8d3[_0x6a45('0x44')]['id']}})[_0x6a45('0x24')](handleEntityNotFound(_0x5d9f52,null))[_0x6a45('0x24')](saveUpdates(_0x2bf8d3[_0x6a45('0x49')],null))[_0x6a45('0x24')](respondWithResult(_0x5d9f52,null))[_0x6a45('0x47')](handleError(_0x5d9f52,null));};exports['destroy']=function(_0x3ea4a7,_0x8877c7){return db[_0x6a45('0x2c')][_0x6a45('0x4a')]({'where':{'id':_0x3ea4a7['params']['id']}})[_0x6a45('0x24')](handleEntityNotFound(_0x8877c7,null))[_0x6a45('0x24')](removeEntity(_0x8877c7,null))[_0x6a45('0x47')](handleError(_0x8877c7,null));};exports['describe']=function(_0x4e7967,_0x5a17b8){return db[_0x6a45('0x2c')][_0x6a45('0x4b')]()[_0x6a45('0x24')](respondWithResult(_0x5a17b8,null))[_0x6a45('0x47')](handleError(_0x5a17b8,null));}; \ No newline at end of file +var _0x5fdc=['papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0x5fdc,0x127));var _0xc5fd=function(_0xd56523,_0x3a5fdc){_0xd56523=_0xd56523-0x0;var _0x5b05ce=_0x5fdc[_0xd56523];return _0x5b05ce;};'use strict';var emlformat=require(_0xc5fd('0x0'));var rimraf=require(_0xc5fd('0x1'));var zipdir=require(_0xc5fd('0x2'));var jsonpatch=require(_0xc5fd('0x3'));var rp=require(_0xc5fd('0x4'));var moment=require(_0xc5fd('0x5'));var BPromise=require(_0xc5fd('0x6'));var Mustache=require(_0xc5fd('0x7'));var util=require(_0xc5fd('0x8'));var path=require(_0xc5fd('0x9'));var sox=require(_0xc5fd('0xa'));var csv=require(_0xc5fd('0xb'));var ejs=require(_0xc5fd('0xc'));var fs=require('fs');var fs_extra=require(_0xc5fd('0xd'));var _=require(_0xc5fd('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc5fd('0xf'));var toCsv=require(_0xc5fd('0xb'));var querystring=require(_0xc5fd('0x10'));var Papa=require(_0xc5fd('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc5fd('0x12'));var as=require(_0xc5fd('0x13'));var hardwareService=require(_0xc5fd('0x14'));var logger=require(_0xc5fd('0x15'))(_0xc5fd('0x16'));var utils=require(_0xc5fd('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc5fd('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x558939,_0x1b1b2b){_0x1b1b2b=_0x1b1b2b||0xcc;return function(_0x1bc6d1){if(_0x1bc6d1){return _0x558939[_0xc5fd('0x19')](_0x1b1b2b);}return _0x558939[_0xc5fd('0x1a')](_0x1b1b2b)[_0xc5fd('0x1b')]();};}function respondWithResult(_0x40b0f8,_0x27447e){_0x27447e=_0x27447e||0xc8;return function(_0xa7a954){if(_0xa7a954){return _0x40b0f8['status'](_0x27447e)[_0xc5fd('0x1c')](_0xa7a954);}};}function respondWithFilteredResult(_0x103c3d,_0x2221da){return function(_0x3404e0){if(_0x3404e0){var _0x4d3636=typeof _0x2221da['offset']==='undefined'&&typeof _0x2221da['limit']==='undefined';var _0x35a9d0=_0x3404e0[_0xc5fd('0x1d')];var _0x27f611=_0x4d3636?0x0:_0x2221da[_0xc5fd('0x1e')];var _0x2ee392=_0x4d3636?_0x3404e0[_0xc5fd('0x1d')]:_0x2221da[_0xc5fd('0x1e')]+_0x2221da['limit'];var _0xb7bab1;if(_0x2ee392>=_0x35a9d0){_0x2ee392=_0x35a9d0;_0xb7bab1=0xc8;}else{_0xb7bab1=0xce;}_0x103c3d[_0xc5fd('0x1a')](_0xb7bab1);return _0x103c3d[_0xc5fd('0x1f')](_0xc5fd('0x20'),_0x27f611+'-'+_0x2ee392+'/'+_0x35a9d0)[_0xc5fd('0x1c')](_0x3404e0);}return null;};}function patchUpdates(_0x48024e){return function(_0x3966a2){try{jsonpatch[_0xc5fd('0x21')](_0x3966a2,_0x48024e,!![]);}catch(_0x18048e){return BPromise[_0xc5fd('0x22')](_0x18048e);}return _0x3966a2['save']();};}function saveUpdates(_0x4c85d5,_0x13cc42){return function(_0x2ab935){if(_0x2ab935){return _0x2ab935[_0xc5fd('0x23')](_0x4c85d5)[_0xc5fd('0x24')](function(_0x334401){return _0x334401;});}return null;};}function removeEntity(_0x311952,_0x56d473){return function(_0x1a3f21){if(_0x1a3f21){return _0x1a3f21[_0xc5fd('0x25')]()[_0xc5fd('0x24')](function(){_0x311952[_0xc5fd('0x1a')](0xcc)[_0xc5fd('0x1b')]();});}};}function handleEntityNotFound(_0x4020af,_0x475b91){return function(_0x527018){if(!_0x527018){_0x4020af[_0xc5fd('0x19')](0x194);}return _0x527018;};}function handleError(_0x48cd1d,_0x2ee700){_0x2ee700=_0x2ee700||0x1f4;return function(_0x231368){logger[_0xc5fd('0x26')](_0x231368[_0xc5fd('0x27')]);if(_0x231368['name']){delete _0x231368[_0xc5fd('0x28')];}_0x48cd1d[_0xc5fd('0x1a')](_0x2ee700)[_0xc5fd('0x29')](_0x231368);};}exports[_0xc5fd('0x2a')]=function(_0x19df33,_0x209975){var _0x541c12={},_0x412ef7={},_0x5d4f70={'count':0x0,'rows':[]};var _0x4859f7=_[_0xc5fd('0x2b')](db[_0xc5fd('0x2c')][_0xc5fd('0x2d')],function(_0x38db1d){return{'name':_0x38db1d[_0xc5fd('0x2e')],'type':_0x38db1d[_0xc5fd('0x2f')][_0xc5fd('0x30')]};});_0x412ef7[_0xc5fd('0x31')]=_['map'](_0x4859f7,_0xc5fd('0x28'));_0x412ef7[_0xc5fd('0x32')]=_[_0xc5fd('0x33')](_0x19df33[_0xc5fd('0x32')]);_0x412ef7[_0xc5fd('0x34')]=_[_0xc5fd('0x35')](_0x412ef7[_0xc5fd('0x31')],_0x412ef7[_0xc5fd('0x32')]);_0x541c12[_0xc5fd('0x36')]=_[_0xc5fd('0x35')](_0x412ef7[_0xc5fd('0x31')],qs[_0xc5fd('0x37')](_0x19df33['query'][_0xc5fd('0x37')]));_0x541c12[_0xc5fd('0x36')]=_0x541c12[_0xc5fd('0x36')][_0xc5fd('0x38')]?_0x541c12[_0xc5fd('0x36')]:_0x412ef7[_0xc5fd('0x31')];if(!_0x19df33[_0xc5fd('0x32')][_0xc5fd('0x39')](_0xc5fd('0x3a'))){_0x541c12['limit']=qs[_0xc5fd('0x3b')](_0x19df33[_0xc5fd('0x32')][_0xc5fd('0x3b')]);_0x541c12[_0xc5fd('0x1e')]=qs[_0xc5fd('0x1e')](_0x19df33[_0xc5fd('0x32')][_0xc5fd('0x1e')]);}_0x541c12['order']=qs[_0xc5fd('0x3c')](_0x19df33[_0xc5fd('0x32')]['sort']);_0x541c12[_0xc5fd('0x3d')]=qs['filters'](_[_0xc5fd('0x3e')](_0x19df33[_0xc5fd('0x32')],_0x412ef7[_0xc5fd('0x34')]),_0x4859f7);if(_0x19df33['query'][_0xc5fd('0x3f')]){_0x541c12[_0xc5fd('0x3d')]=_['merge'](_0x541c12[_0xc5fd('0x3d')],{'$or':_[_0xc5fd('0x2b')](_0x4859f7,function(_0x31b457){if(_0x31b457[_0xc5fd('0x2f')]!==_0xc5fd('0x40')){var _0x33f669={};_0x33f669[_0x31b457['name']]={'$like':'%'+_0x19df33[_0xc5fd('0x32')][_0xc5fd('0x3f')]+'%'};return _0x33f669;}})});}_0x541c12=_[_0xc5fd('0x41')]({},_0x541c12,_0x19df33[_0xc5fd('0x42')]);var _0x5d3fce={'where':_0x541c12['where']};return db['MailQueueReport'][_0xc5fd('0x1d')](_0x5d3fce)[_0xc5fd('0x24')](function(_0x2dd4ca){_0x5d4f70[_0xc5fd('0x1d')]=_0x2dd4ca;if(_0x19df33[_0xc5fd('0x32')][_0xc5fd('0x43')]){_0x541c12[_0xc5fd('0x44')]=[{'all':!![]}];}return db[_0xc5fd('0x2c')][_0xc5fd('0x45')](_0x541c12);})['then'](function(_0x5a2199){_0x5d4f70[_0xc5fd('0x46')]=_0x5a2199;return _0x5d4f70;})['then'](respondWithFilteredResult(_0x209975,_0x541c12))[_0xc5fd('0x47')](handleError(_0x209975,null));};exports[_0xc5fd('0x48')]=function(_0x2259e4,_0x57fd81){var _0x6ebcbf={'raw':!![],'where':{'id':_0x2259e4['params']['id']}},_0x350753={};_0x350753[_0xc5fd('0x31')]=_[_0xc5fd('0x33')](db['MailQueueReport'][_0xc5fd('0x2d')]);_0x350753['query']=_[_0xc5fd('0x33')](_0x2259e4[_0xc5fd('0x32')]);_0x350753['filters']=_[_0xc5fd('0x35')](_0x350753[_0xc5fd('0x31')],_0x350753[_0xc5fd('0x32')]);_0x6ebcbf['attributes']=_[_0xc5fd('0x35')](_0x350753[_0xc5fd('0x31')],qs['fields'](_0x2259e4['query'][_0xc5fd('0x37')]));_0x6ebcbf['attributes']=_0x6ebcbf['attributes']['length']?_0x6ebcbf[_0xc5fd('0x36')]:_0x350753[_0xc5fd('0x31')];if(_0x2259e4[_0xc5fd('0x32')][_0xc5fd('0x43')]){_0x6ebcbf[_0xc5fd('0x44')]=[{'all':!![]}];}_0x6ebcbf=_[_0xc5fd('0x41')]({},_0x6ebcbf,_0x2259e4['options']);return db['MailQueueReport']['find'](_0x6ebcbf)[_0xc5fd('0x24')](handleEntityNotFound(_0x57fd81,null))[_0xc5fd('0x24')](respondWithResult(_0x57fd81,null))[_0xc5fd('0x47')](handleError(_0x57fd81,null));};exports['create']=function(_0x1a2200,_0x51641b){return db[_0xc5fd('0x2c')][_0xc5fd('0x49')](_0x1a2200[_0xc5fd('0x4a')],{})[_0xc5fd('0x24')](respondWithResult(_0x51641b,0xc9))[_0xc5fd('0x47')](handleError(_0x51641b,null));};exports[_0xc5fd('0x23')]=function(_0x54d86c,_0x6b2f77){if(_0x54d86c[_0xc5fd('0x4a')]['id']){delete _0x54d86c['body']['id'];}return db['MailQueueReport'][_0xc5fd('0x4b')]({'where':{'id':_0x54d86c['params']['id']}})['then'](handleEntityNotFound(_0x6b2f77,null))[_0xc5fd('0x24')](saveUpdates(_0x54d86c[_0xc5fd('0x4a')],null))['then'](respondWithResult(_0x6b2f77,null))[_0xc5fd('0x47')](handleError(_0x6b2f77,null));};exports[_0xc5fd('0x25')]=function(_0x5c49e7,_0x21d418){return db[_0xc5fd('0x2c')][_0xc5fd('0x4b')]({'where':{'id':_0x5c49e7[_0xc5fd('0x4c')]['id']}})[_0xc5fd('0x24')](handleEntityNotFound(_0x21d418,null))[_0xc5fd('0x24')](removeEntity(_0x21d418,null))[_0xc5fd('0x47')](handleError(_0x21d418,null));};exports[_0xc5fd('0x4d')]=function(_0x4217f7,_0x32721e){return db[_0xc5fd('0x2c')]['describe']()[_0xc5fd('0x24')](respondWithResult(_0x32721e,null))[_0xc5fd('0x47')](handleError(_0x32721e,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index ad12579..4aaccf6 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 _0x10fc=['exports','define','uniqueid','lodash','util','api','bluebird','request-promise','path','../../config/environment','./mailQueueReport.attributes'];(function(_0x3926f8,_0xb3ecef){var _0x4cbcfd=function(_0x1277fd){while(--_0x1277fd){_0x3926f8['push'](_0x3926f8['shift']());}};_0x4cbcfd(++_0xb3ecef);}(_0x10fc,0x1bb));var _0xc10f=function(_0x3a5864,_0x157394){_0x3a5864=_0x3a5864-0x0;var _0x164fbc=_0x10fc[_0x3a5864];return _0x164fbc;};'use strict';var _=require(_0xc10f('0x0'));var util=require(_0xc10f('0x1'));var logger=require('../../config/logger')(_0xc10f('0x2'));var moment=require('moment');var BPromise=require(_0xc10f('0x3'));var rp=require(_0xc10f('0x4'));var fs=require('fs');var path=require(_0xc10f('0x5'));var rimraf=require('rimraf');var config=require(_0xc10f('0x6'));var attributes=require(_0xc10f('0x7'));module[_0xc10f('0x8')]=function(_0x538527,_0x53ddda){return _0x538527[_0xc10f('0x9')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xc10f('0xa'),'fields':[_0xc10f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf571=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue','uniqueid','lodash'];(function(_0x1d6c1d,_0x3e36c5){var _0x50a394=function(_0x11b629){while(--_0x11b629){_0x1d6c1d['push'](_0x1d6c1d['shift']());}};_0x50a394(++_0x3e36c5);}(_0xf571,0xdf));var _0x1f57=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf571[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x1f57('0x0'));var util=require(_0x1f57('0x1'));var logger=require(_0x1f57('0x2'))(_0x1f57('0x3'));var moment=require('moment');var BPromise=require(_0x1f57('0x4'));var rp=require(_0x1f57('0x5'));var fs=require('fs');var path=require(_0x1f57('0x6'));var rimraf=require(_0x1f57('0x7'));var config=require(_0x1f57('0x8'));var attributes=require(_0x1f57('0x9'));module[_0x1f57('0xa')]=function(_0x33546c,_0x33fc83){return _0x33546c['define'](_0x1f57('0xb'),attributes,{'tableName':_0x1f57('0xc'),'paranoid':![],'indexes':[{'name':_0x1f57('0xd'),'fields':[_0x1f57('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index d300463..2bdd9ed 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 _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x52e0da,_0x46546d){var _0x3490ec=function(_0x426afd){while(--_0x426afd){_0x52e0da['push'](_0x52e0da['shift']());}};_0x3490ec(++_0x46546d);}(_0xdb28,0x106));var _0x8db2=function(_0x1893cd,_0x5a2c01){_0x1893cd=_0x1893cd-0x0;var _0x2103d2=_0xdb28[_0x1893cd];return _0x2103d2;};'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')]('MailQueueReport,\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);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file +var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x1c9298,_0x2637b2){var _0x5cc935=function(_0x532980){while(--_0x532980){_0x1c9298['push'](_0x1c9298['shift']());}};_0x5cc935(++_0x2637b2);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xc4aa[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 5eebbd7..be7a330 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(_0x12c12b,_0x2f19d9){var _0x184238=function(_0x4c6f76){while(--_0x4c6f76){_0x12c12b['push'](_0x12c12b['shift']());}};_0x184238(++_0x2f19d9);}(_0xedd9,0xfc));var _0x9edd=function(_0x141152,_0x102dbb){_0x141152=_0x141152-0x0;var _0x3727e0=_0xedd9[_0x141152];return _0x3727e0;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x26a810,_0x247776){var _0x4758a3=function(_0xa1fbb9){while(--_0xa1fbb9){_0x26a810['push'](_0x26a810['shift']());}};_0x4758a3(++_0x247776);}(_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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 3d68899..5cfc1b7 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 _0x8b29=['INTEGER','sequelize','STRING'];(function(_0x24c135,_0xdb4450){var _0x290c66=function(_0x537cf8){while(--_0x537cf8){_0x24c135['push'](_0x24c135['shift']());}};_0x290c66(++_0xdb4450);}(_0x8b29,0xbe));var _0x98b2=function(_0x597a1a,_0x19c5bf){_0x597a1a=_0x597a1a-0x0;var _0x2229ed=_0x8b29[_0x597a1a];return _0x2229ed;};'use strict';var Sequelize=require(_0x98b2('0x0'));module['exports']={'description':{'type':Sequelize[_0x98b2('0x1')]},'host':{'type':Sequelize[_0x98b2('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x98b2('0x1')]},'port':{'type':Sequelize[_0x98b2('0x2')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x98b2('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x98b2('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x98b2('0x2')],'defaultValue':0x5},'service':{'type':Sequelize[_0x98b2('0x1')]}}; \ No newline at end of file +var _0x24cf=['INTEGER','STRING','BOOLEAN','INBOX'];(function(_0x5209ef,_0x3a4592){var _0x63f75f=function(_0x2591e1){while(--_0x2591e1){_0x5209ef['push'](_0x5209ef['shift']());}};_0x63f75f(++_0x3a4592);}(_0x24cf,0x1d5));var _0xf24c=function(_0x58c669,_0x3431fa){_0x58c669=_0x58c669-0x0;var _0x390088=_0x24cf[_0x58c669];return _0x390088;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xf24c('0x0')]},'host':{'type':Sequelize[_0xf24c('0x0')]},'authentication':{'type':Sequelize[_0xf24c('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0xf24c('0x0')]},'password':{'type':Sequelize[_0xf24c('0x0')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0xf24c('0x1')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xf24c('0x0')],'defaultValue':_0xf24c('0x2')},'connTimeout':{'type':Sequelize[_0xf24c('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 9b0f8c2..1b41faa 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 _0x3d75=['define','lodash','moment','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d75,0x1a8));var _0x53d7=function(_0xbe5956,_0xceec28){_0xbe5956=_0xbe5956-0x0;var _0x4473b2=_0x3d75[_0xbe5956];return _0x4473b2;};'use strict';var _=require(_0x53d7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x53d7('0x1'));var BPromise=require('bluebird');var rp=require(_0x53d7('0x2'));var fs=require('fs');var path=require(_0x53d7('0x3'));var rimraf=require(_0x53d7('0x4'));var config=require(_0x53d7('0x5'));var attributes=require(_0x53d7('0x6'));module[_0x53d7('0x7')]=function(_0xddd996,_0x437754){return _0xddd996[_0x53d7('0x8')]('MailServerIn',attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f1d=['mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailServerIn'];(function(_0x2a87e9,_0x11b6a9){var _0x379136=function(_0x1413a8){while(--_0x1413a8){_0x2a87e9['push'](_0x2a87e9['shift']());}};_0x379136(++_0x11b6a9);}(_0x7f1d,0x17b));var _0xd7f1=function(_0x11b19b,_0x213234){_0x11b19b=_0x11b19b-0x0;var _0x1daac1=_0x7f1d[_0x11b19b];return _0x1daac1;};'use strict';var _=require(_0xd7f1('0x0'));var util=require(_0xd7f1('0x1'));var logger=require(_0xd7f1('0x2'))(_0xd7f1('0x3'));var moment=require(_0xd7f1('0x4'));var BPromise=require(_0xd7f1('0x5'));var rp=require(_0xd7f1('0x6'));var fs=require('fs');var path=require(_0xd7f1('0x7'));var rimraf=require(_0xd7f1('0x8'));var config=require(_0xd7f1('0x9'));var attributes=require('./mailServerIn.attributes');module[_0xd7f1('0xa')]=function(_0x1610c9,_0x1137a6){return _0x1610c9[_0xd7f1('0xb')](_0xd7f1('0xc'),attributes,{'tableName':_0xd7f1('0xd'),'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 1d70954..0fc4b92 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 _0x0e12=['request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailServerIn','MailServerIn','options','raw','where','attributes','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x34e567,_0x2490ba){var _0x50ba4e=function(_0x1db8ff){while(--_0x1db8ff){_0x34e567['push'](_0x34e567['shift']());}};_0x50ba4e(++_0x2490ba);}(_0x0e12,0x180));var _0x20e1=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0x0e12[_0x349367];return _0x14179b;};'use strict';var _=require(_0x20e1('0x0'));var util=require(_0x20e1('0x1'));var moment=require(_0x20e1('0x2'));var BPromise=require(_0x20e1('0x3'));var rs=require(_0x20e1('0x4'));var fs=require('fs');var Redis=require(_0x20e1('0x5'));var db=require(_0x20e1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x20e1('0x7'))(_0x20e1('0x8'));var config=require(_0x20e1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x20e1('0xa')][_0x20e1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51499b,_0x33efe6,_0x47eb0a){return new BPromise(function(_0x2b7184,_0x47a077){return client[_0x20e1('0xc')](_0x51499b,_0x47eb0a)[_0x20e1('0xd')](function(_0x4e9e99){logger[_0x20e1('0xe')](_0x20e1('0xf'),_0x33efe6,_0x20e1('0x10'));logger[_0x20e1('0x11')](_0x20e1('0x12'),_0x33efe6,_0x20e1('0x10'),JSON[_0x20e1('0x13')](_0x4e9e99));if(_0x4e9e99[_0x20e1('0x14')]){if(_0x4e9e99[_0x20e1('0x14')]['code']===0x1f4){logger[_0x20e1('0x14')](_0x20e1('0xf'),_0x33efe6,_0x4e9e99['error']['message']);return _0x47a077(_0x4e9e99[_0x20e1('0x14')][_0x20e1('0x15')]);}logger[_0x20e1('0x14')](_0x20e1('0xf'),_0x33efe6,_0x4e9e99[_0x20e1('0x14')][_0x20e1('0x15')]);return _0x2b7184(_0x4e9e99[_0x20e1('0x14')][_0x20e1('0x15')]);}else{logger['info'](_0x20e1('0xf'),_0x33efe6,_0x20e1('0x10'));_0x2b7184(_0x4e9e99[_0x20e1('0x16')][_0x20e1('0x15')]);}})[_0x20e1('0x17')](function(_0x5ae8dd){logger[_0x20e1('0x14')]('MailServerIn,\x20%s,\x20%s',_0x33efe6,_0x5ae8dd);_0x47a077(_0x5ae8dd);});});}exports[_0x20e1('0x18')]=function(_0x47d1a5){var _0x226698=this;return new Promise(function(_0x5765f9,_0x2275f7){return db[_0x20e1('0x19')]['findAll']({'raw':_0x47d1a5[_0x20e1('0x1a')]?_0x47d1a5[_0x20e1('0x1a')][_0x20e1('0x1b')]===undefined?!![]:![]:!![],'where':_0x47d1a5['options']?_0x47d1a5[_0x20e1('0x1a')][_0x20e1('0x1c')]||null:null,'attributes':_0x47d1a5[_0x20e1('0x1a')]?_0x47d1a5[_0x20e1('0x1a')][_0x20e1('0x1d')]||null:null,'limit':_0x47d1a5['options']?_0x47d1a5[_0x20e1('0x1a')]['limit']||null:null,'include':_0x47d1a5[_0x20e1('0x1a')]?_0x47d1a5[_0x20e1('0x1a')]['include']?_[_0x20e1('0x1e')](_0x47d1a5[_0x20e1('0x1a')][_0x20e1('0x1f')],function(_0x17617e){return{'model':db[_0x17617e['model']],'as':_0x17617e['as'],'attributes':_0x17617e[_0x20e1('0x1d')],'include':_0x17617e['include']?_['map'](_0x17617e[_0x20e1('0x1f')],function(_0x1be38a){return{'model':db[_0x1be38a[_0x20e1('0x20')]],'as':_0x1be38a['as'],'attributes':_0x1be38a[_0x20e1('0x1d')],'include':_0x1be38a[_0x20e1('0x1f')]?_[_0x20e1('0x1e')](_0x1be38a[_0x20e1('0x1f')],function(_0x4fdf8b){return{'model':db[_0x4fdf8b[_0x20e1('0x20')]],'as':_0x4fdf8b['as'],'attributes':_0x4fdf8b[_0x20e1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x20e1('0xd')](function(_0x5d4097){logger['info']('GetMailServerIn',_0x47d1a5);logger[_0x20e1('0x11')](_0x20e1('0x18'),_0x47d1a5,JSON[_0x20e1('0x13')](_0x5d4097));_0x5765f9(_0x5d4097);})[_0x20e1('0x17')](function(_0x129800){logger[_0x20e1('0x14')](_0x20e1('0x18'),_0x129800[_0x20e1('0x15')],_0x47d1a5);_0x2275f7(_0x226698[_0x20e1('0x14')](0x1f4,_0x129800['message']));});});}; \ No newline at end of file +var _0xbaa9=['MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','result','GetMailServerIn','MailServerIn','findAll','options','raw','where','include','map','model','attributes','stringify','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info'];(function(_0x1bef07,_0x2a4e64){var _0x29edf6=function(_0x3e0230){while(--_0x3e0230){_0x1bef07['push'](_0x1bef07['shift']());}};_0x29edf6(++_0x2a4e64);}(_0xbaa9,0x188));var _0x9baa=function(_0x4f7fbd,_0x12f330){_0x4f7fbd=_0x4f7fbd-0x0;var _0x208b69=_0xbaa9[_0x4f7fbd];return _0x208b69;};'use strict';var _=require(_0x9baa('0x0'));var util=require('util');var moment=require(_0x9baa('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9baa('0x2'));var db=require(_0x9baa('0x3'))['db'];var utils=require(_0x9baa('0x4'));var logger=require(_0x9baa('0x5'))(_0x9baa('0x6'));var config=require(_0x9baa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9baa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x102c4d,_0x25abea,_0x32bcf0){return new BPromise(function(_0x1be8a7,_0x3a3a36){return client['request'](_0x102c4d,_0x32bcf0)[_0x9baa('0x9')](function(_0x292612){logger[_0x9baa('0xa')](_0x9baa('0xb'),_0x25abea,_0x9baa('0xc'));logger[_0x9baa('0xd')](_0x9baa('0xe'),_0x25abea,_0x9baa('0xc'),JSON['stringify'](_0x292612));if(_0x292612[_0x9baa('0xf')]){if(_0x292612[_0x9baa('0xf')][_0x9baa('0x10')]===0x1f4){logger[_0x9baa('0xf')](_0x9baa('0xb'),_0x25abea,_0x292612[_0x9baa('0xf')][_0x9baa('0x11')]);return _0x3a3a36(_0x292612[_0x9baa('0xf')][_0x9baa('0x11')]);}logger[_0x9baa('0xf')](_0x9baa('0xb'),_0x25abea,_0x292612[_0x9baa('0xf')]['message']);return _0x1be8a7(_0x292612[_0x9baa('0xf')][_0x9baa('0x11')]);}else{logger[_0x9baa('0xa')](_0x9baa('0xb'),_0x25abea,_0x9baa('0xc'));_0x1be8a7(_0x292612[_0x9baa('0x12')]['message']);}})['catch'](function(_0x41a661){logger[_0x9baa('0xf')](_0x9baa('0xb'),_0x25abea,_0x41a661);_0x3a3a36(_0x41a661);});});}exports[_0x9baa('0x13')]=function(_0xd18640){var _0x4e583c=this;return new Promise(function(_0x4e806e,_0x4587f0){return db[_0x9baa('0x14')][_0x9baa('0x15')]({'raw':_0xd18640[_0x9baa('0x16')]?_0xd18640[_0x9baa('0x16')][_0x9baa('0x17')]===undefined?!![]:![]:!![],'where':_0xd18640[_0x9baa('0x16')]?_0xd18640[_0x9baa('0x16')][_0x9baa('0x18')]||null:null,'attributes':_0xd18640[_0x9baa('0x16')]?_0xd18640[_0x9baa('0x16')]['attributes']||null:null,'limit':_0xd18640['options']?_0xd18640['options']['limit']||null:null,'include':_0xd18640[_0x9baa('0x16')]?_0xd18640['options'][_0x9baa('0x19')]?_[_0x9baa('0x1a')](_0xd18640[_0x9baa('0x16')][_0x9baa('0x19')],function(_0x1478ac){return{'model':db[_0x1478ac[_0x9baa('0x1b')]],'as':_0x1478ac['as'],'attributes':_0x1478ac[_0x9baa('0x1c')],'include':_0x1478ac[_0x9baa('0x19')]?_['map'](_0x1478ac[_0x9baa('0x19')],function(_0x4efa7d){return{'model':db[_0x4efa7d[_0x9baa('0x1b')]],'as':_0x4efa7d['as'],'attributes':_0x4efa7d['attributes'],'include':_0x4efa7d[_0x9baa('0x19')]?_[_0x9baa('0x1a')](_0x4efa7d['include'],function(_0x59ceb9){return{'model':db[_0x59ceb9[_0x9baa('0x1b')]],'as':_0x59ceb9['as'],'attributes':_0x59ceb9[_0x9baa('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9baa('0x9')](function(_0x9a2d5d){logger[_0x9baa('0xa')](_0x9baa('0x13'),_0xd18640);logger[_0x9baa('0xd')](_0x9baa('0x13'),_0xd18640,JSON[_0x9baa('0x1d')](_0x9a2d5d));_0x4e806e(_0x9a2d5d);})[_0x9baa('0x1e')](function(_0x5923d7){logger[_0x9baa('0xf')]('GetMailServerIn',_0x5923d7['message'],_0xd18640);_0x4587f0(_0x4e583c[_0x9baa('0xf')](0x1f4,_0x5923d7[_0x9baa('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index f6d2097..7ed1775 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(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x7a54,0x106));var _0x47a5=function(_0x54cb5a,_0x522d34){_0x54cb5a=_0x54cb5a-0x0;var _0x4095af=_0x7a54[_0x54cb5a];return _0x4095af;};'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 0dc9383..5ab84b3 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 _0xb37e=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x5650b4,_0x2723ba){var _0x297a62=function(_0x4ceedf){while(--_0x4ceedf){_0x5650b4['push'](_0x5650b4['shift']());}};_0x297a62(++_0x2723ba);}(_0xb37e,0x1cb));var _0xeb37=function(_0x59df82,_0x1cb313){_0x59df82=_0x59df82-0x0;var _0x2b9ce5=_0xb37e[_0x59df82];return _0x2b9ce5;};'use strict';var Sequelize=require(_0xeb37('0x0'));module[_0xeb37('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xeb37('0x2')]},'user':{'type':Sequelize[_0xeb37('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xeb37('0x3')]},'secure':{'type':Sequelize[_0xeb37('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xeb37('0x2')]},'authentication':{'type':Sequelize[_0xeb37('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0x55e2=['sequelize','STRING','INTEGER','BOOLEAN'];(function(_0x1397bb,_0x1a1c3f){var _0x3bfd56=function(_0x22ec57){while(--_0x22ec57){_0x1397bb['push'](_0x1397bb['shift']());}};_0x3bfd56(++_0x1a1c3f);}(_0x55e2,0x84));var _0x255e=function(_0x2d25b6,_0x482fc3){_0x2d25b6=_0x2d25b6-0x0;var _0x5f205b=_0x55e2[_0x2d25b6];return _0x5f205b;};'use strict';var Sequelize=require(_0x255e('0x0'));module['exports']={'description':{'type':Sequelize[_0x255e('0x1')]},'host':{'type':Sequelize[_0x255e('0x1')]},'user':{'type':Sequelize[_0x255e('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x255e('0x2')]},'secure':{'type':Sequelize[_0x255e('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x255e('0x1')]},'authentication':{'type':Sequelize[_0x255e('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 1294192..4f8fa63 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 _0x4ced=['path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','undefined','count','offset','limit','Content-Range','json','apply','reject','save','then','destroy','name','send','map','MailServerOut','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','keys','fields','length','find','catch','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4ced,0x1c0));var _0xd4ce=function(_0x40d1a4,_0xd9aa4d){_0x40d1a4=_0x40d1a4-0x0;var _0x52ea60=_0x4ced[_0x40d1a4];return _0x52ea60;};'use strict';var emlformat=require(_0xd4ce('0x0'));var rimraf=require(_0xd4ce('0x1'));var zipdir=require(_0xd4ce('0x2'));var jsonpatch=require(_0xd4ce('0x3'));var rp=require(_0xd4ce('0x4'));var moment=require(_0xd4ce('0x5'));var BPromise=require(_0xd4ce('0x6'));var Mustache=require('mustache');var util=require(_0xd4ce('0x7'));var path=require(_0xd4ce('0x8'));var sox=require('sox');var csv=require(_0xd4ce('0x9'));var ejs=require(_0xd4ce('0xa'));var fs=require('fs');var fs_extra=require(_0xd4ce('0xb'));var _=require('lodash');var squel=require(_0xd4ce('0xc'));var crypto=require(_0xd4ce('0xd'));var jsforce=require(_0xd4ce('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd4ce('0x9'));var querystring=require(_0xd4ce('0xf'));var Papa=require(_0xd4ce('0x10'));var Redis=require(_0xd4ce('0x11'));var authService=require(_0xd4ce('0x12'));var qs=require(_0xd4ce('0x13'));var as=require(_0xd4ce('0x14'));var hardwareService=require(_0xd4ce('0x15'));var logger=require(_0xd4ce('0x16'))(_0xd4ce('0x17'));var utils=require(_0xd4ce('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd4ce('0x19'));var db=require(_0xd4ce('0x1a'))['db'];function respondWithStatusCode(_0x344d14,_0x23dc68){_0x23dc68=_0x23dc68||0xcc;return function(_0x27ab0b){if(_0x27ab0b){return _0x344d14['sendStatus'](_0x23dc68);}return _0x344d14[_0xd4ce('0x1b')](_0x23dc68)[_0xd4ce('0x1c')]();};}function respondWithResult(_0x2a49c1,_0x4d14eb){_0x4d14eb=_0x4d14eb||0xc8;return function(_0x17be77){if(_0x17be77){return _0x2a49c1[_0xd4ce('0x1b')](_0x4d14eb)['json'](_0x17be77);}};}function respondWithFilteredResult(_0x27c4f8,_0x427018){return function(_0x525f6f){if(_0x525f6f){var _0x5a5928=typeof _0x427018['offset']===_0xd4ce('0x1d')&&typeof _0x427018['limit']===_0xd4ce('0x1d');var _0x3b7361=_0x525f6f[_0xd4ce('0x1e')];var _0x28941f=_0x5a5928?0x0:_0x427018[_0xd4ce('0x1f')];var _0x2abda2=_0x5a5928?_0x525f6f[_0xd4ce('0x1e')]:_0x427018['offset']+_0x427018[_0xd4ce('0x20')];var _0x2e729f;if(_0x2abda2>=_0x3b7361){_0x2abda2=_0x3b7361;_0x2e729f=0xc8;}else{_0x2e729f=0xce;}_0x27c4f8[_0xd4ce('0x1b')](_0x2e729f);return _0x27c4f8['set'](_0xd4ce('0x21'),_0x28941f+'-'+_0x2abda2+'/'+_0x3b7361)[_0xd4ce('0x22')](_0x525f6f);}return null;};}function patchUpdates(_0x2ea093){return function(_0x4af3b2){try{jsonpatch[_0xd4ce('0x23')](_0x4af3b2,_0x2ea093,!![]);}catch(_0x1f219a){return BPromise[_0xd4ce('0x24')](_0x1f219a);}return _0x4af3b2[_0xd4ce('0x25')]();};}function saveUpdates(_0x3d6b0b,_0x5ee571){return function(_0x46a0c4){if(_0x46a0c4){return _0x46a0c4['update'](_0x3d6b0b)[_0xd4ce('0x26')](function(_0x565971){return _0x565971;});}return null;};}function removeEntity(_0x149a8c,_0x558b72){return function(_0x28049b){if(_0x28049b){return _0x28049b[_0xd4ce('0x27')]()['then'](function(){_0x149a8c['status'](0xcc)[_0xd4ce('0x1c')]();});}};}function handleEntityNotFound(_0x3287bb,_0x4b5d28){return function(_0x45a4a7){if(!_0x45a4a7){_0x3287bb['sendStatus'](0x194);}return _0x45a4a7;};}function handleError(_0x5380ca,_0x39e68f){_0x39e68f=_0x39e68f||0x1f4;return function(_0x148cad){logger['error'](_0x148cad['stack']);if(_0x148cad['name']){delete _0x148cad[_0xd4ce('0x28')];}_0x5380ca[_0xd4ce('0x1b')](_0x39e68f)[_0xd4ce('0x29')](_0x148cad);};}exports['index']=function(_0x3d69c0,_0x30ddc1){var _0x1bd8ce={},_0x1af660={},_0x21c03e={'count':0x0,'rows':[]};var _0x71c52e=_[_0xd4ce('0x2a')](db[_0xd4ce('0x2b')][_0xd4ce('0x2c')],function(_0x4c7a7b){return{'name':_0x4c7a7b[_0xd4ce('0x2d')],'type':_0x4c7a7b[_0xd4ce('0x2e')][_0xd4ce('0x2f')]};});_0x1af660[_0xd4ce('0x30')]=_[_0xd4ce('0x2a')](_0x71c52e,_0xd4ce('0x28'));_0x1af660['query']=_['keys'](_0x3d69c0['query']);_0x1af660[_0xd4ce('0x31')]=_[_0xd4ce('0x32')](_0x1af660['model'],_0x1af660[_0xd4ce('0x33')]);_0x1bd8ce[_0xd4ce('0x34')]=_['intersection'](_0x1af660[_0xd4ce('0x30')],qs['fields'](_0x3d69c0[_0xd4ce('0x33')]['fields']));_0x1bd8ce[_0xd4ce('0x34')]=_0x1bd8ce['attributes']['length']?_0x1bd8ce[_0xd4ce('0x34')]:_0x1af660[_0xd4ce('0x30')];if(!_0x3d69c0[_0xd4ce('0x33')][_0xd4ce('0x35')](_0xd4ce('0x36'))){_0x1bd8ce[_0xd4ce('0x20')]=qs[_0xd4ce('0x20')](_0x3d69c0[_0xd4ce('0x33')]['limit']);_0x1bd8ce[_0xd4ce('0x1f')]=qs[_0xd4ce('0x1f')](_0x3d69c0[_0xd4ce('0x33')][_0xd4ce('0x1f')]);}_0x1bd8ce[_0xd4ce('0x37')]=qs['sort'](_0x3d69c0[_0xd4ce('0x33')][_0xd4ce('0x38')]);_0x1bd8ce[_0xd4ce('0x39')]=qs['filters'](_[_0xd4ce('0x3a')](_0x3d69c0[_0xd4ce('0x33')],_0x1af660[_0xd4ce('0x31')]),_0x71c52e);if(_0x3d69c0[_0xd4ce('0x33')][_0xd4ce('0x3b')]){_0x1bd8ce[_0xd4ce('0x39')]=_[_0xd4ce('0x3c')](_0x1bd8ce['where'],{'$or':_[_0xd4ce('0x2a')](_0x71c52e,function(_0x3be06c){if(_0x3be06c[_0xd4ce('0x2e')]!==_0xd4ce('0x3d')){var _0x129b25={};_0x129b25[_0x3be06c[_0xd4ce('0x28')]]={'$like':'%'+_0x3d69c0[_0xd4ce('0x33')][_0xd4ce('0x3b')]+'%'};return _0x129b25;}})});}_0x1bd8ce=_[_0xd4ce('0x3c')]({},_0x1bd8ce,_0x3d69c0[_0xd4ce('0x3e')]);var _0x1cd508={'where':_0x1bd8ce['where']};return db['MailServerOut'][_0xd4ce('0x1e')](_0x1cd508)['then'](function(_0x2a0a90){_0x21c03e[_0xd4ce('0x1e')]=_0x2a0a90;if(_0x3d69c0[_0xd4ce('0x33')][_0xd4ce('0x3f')]){_0x1bd8ce[_0xd4ce('0x40')]=[{'all':!![]}];}return db[_0xd4ce('0x2b')][_0xd4ce('0x41')](_0x1bd8ce);})[_0xd4ce('0x26')](function(_0x1a074c){_0x21c03e[_0xd4ce('0x42')]=_0x1a074c;return _0x21c03e;})['then'](respondWithFilteredResult(_0x30ddc1,_0x1bd8ce))['catch'](handleError(_0x30ddc1,null));};exports['show']=function(_0x15659b,_0x4f5520){var _0x1e0569={'raw':!![],'where':{'id':_0x15659b['params']['id']}},_0x212909={};_0x212909[_0xd4ce('0x30')]=_[_0xd4ce('0x43')](db[_0xd4ce('0x2b')][_0xd4ce('0x2c')]);_0x212909['query']=_[_0xd4ce('0x43')](_0x15659b[_0xd4ce('0x33')]);_0x212909[_0xd4ce('0x31')]=_['intersection'](_0x212909['model'],_0x212909[_0xd4ce('0x33')]);_0x1e0569[_0xd4ce('0x34')]=_[_0xd4ce('0x32')](_0x212909['model'],qs[_0xd4ce('0x44')](_0x15659b[_0xd4ce('0x33')]['fields']));_0x1e0569[_0xd4ce('0x34')]=_0x1e0569[_0xd4ce('0x34')][_0xd4ce('0x45')]?_0x1e0569[_0xd4ce('0x34')]:_0x212909[_0xd4ce('0x30')];if(_0x15659b[_0xd4ce('0x33')][_0xd4ce('0x3f')]){_0x1e0569['include']=[{'all':!![]}];}_0x1e0569=_['merge']({},_0x1e0569,_0x15659b[_0xd4ce('0x3e')]);return db[_0xd4ce('0x2b')][_0xd4ce('0x46')](_0x1e0569)['then'](handleEntityNotFound(_0x4f5520,null))[_0xd4ce('0x26')](respondWithResult(_0x4f5520,null))[_0xd4ce('0x47')](handleError(_0x4f5520,null));};exports[_0xd4ce('0x48')]=function(_0x126c14,_0x3286c0){return db[_0xd4ce('0x2b')][_0xd4ce('0x48')](_0x126c14[_0xd4ce('0x49')],{})['then'](respondWithResult(_0x3286c0,0xc9))[_0xd4ce('0x47')](handleError(_0x3286c0,null));};exports[_0xd4ce('0x4a')]=function(_0x4756b7,_0x5c44a8){if(_0x4756b7[_0xd4ce('0x49')]['id']){delete _0x4756b7['body']['id'];}return db[_0xd4ce('0x2b')][_0xd4ce('0x46')]({'where':{'id':_0x4756b7['params']['id']}})[_0xd4ce('0x26')](handleEntityNotFound(_0x5c44a8,null))['then'](saveUpdates(_0x4756b7[_0xd4ce('0x49')],null))['then'](respondWithResult(_0x5c44a8,null))[_0xd4ce('0x47')](handleError(_0x5c44a8,null));};exports[_0xd4ce('0x27')]=function(_0x58119b,_0x3bcf60){return db[_0xd4ce('0x2b')][_0xd4ce('0x46')]({'where':{'id':_0x58119b[_0xd4ce('0x4b')]['id']}})[_0xd4ce('0x26')](handleEntityNotFound(_0x3bcf60,null))[_0xd4ce('0x26')](removeEntity(_0x3bcf60,null))[_0xd4ce('0x47')](handleError(_0x3bcf60,null));}; \ No newline at end of file +var _0x46ba=['fields','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','show','params','keys','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','end','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','query','filters','model','attributes','intersection'];(function(_0x18c25a,_0x17dfc0){var _0x4b1782=function(_0xdeb482){while(--_0xdeb482){_0x18c25a['push'](_0x18c25a['shift']());}};_0x4b1782(++_0x17dfc0);}(_0x46ba,0x139));var _0xa46b=function(_0x46d91b,_0x49a7b2){_0x46d91b=_0x46d91b-0x0;var _0x308c64=_0x46ba[_0x46d91b];return _0x308c64;};'use strict';var emlformat=require(_0xa46b('0x0'));var rimraf=require(_0xa46b('0x1'));var zipdir=require(_0xa46b('0x2'));var jsonpatch=require(_0xa46b('0x3'));var rp=require('request-promise');var moment=require(_0xa46b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa46b('0x5'));var util=require(_0xa46b('0x6'));var path=require(_0xa46b('0x7'));var sox=require('sox');var csv=require(_0xa46b('0x8'));var ejs=require(_0xa46b('0x9'));var fs=require('fs');var fs_extra=require(_0xa46b('0xa'));var _=require(_0xa46b('0xb'));var squel=require(_0xa46b('0xc'));var crypto=require(_0xa46b('0xd'));var jsforce=require(_0xa46b('0xe'));var deskjs=require(_0xa46b('0xf'));var toCsv=require(_0xa46b('0x8'));var querystring=require(_0xa46b('0x10'));var Papa=require('papaparse');var Redis=require(_0xa46b('0x11'));var authService=require(_0xa46b('0x12'));var qs=require(_0xa46b('0x13'));var as=require(_0xa46b('0x14'));var hardwareService=require(_0xa46b('0x15'));var logger=require('../../config/logger')(_0xa46b('0x16'));var utils=require(_0xa46b('0x17'));var config=require(_0xa46b('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa46b('0x19'))['db'];function respondWithStatusCode(_0x4604ee,_0x9aaa2a){_0x9aaa2a=_0x9aaa2a||0xcc;return function(_0x3f9b94){if(_0x3f9b94){return _0x4604ee[_0xa46b('0x1a')](_0x9aaa2a);}return _0x4604ee['status'](_0x9aaa2a)['end']();};}function respondWithResult(_0x573d6d,_0x590c3f){_0x590c3f=_0x590c3f||0xc8;return function(_0x53d256){if(_0x53d256){return _0x573d6d[_0xa46b('0x1b')](_0x590c3f)[_0xa46b('0x1c')](_0x53d256);}};}function respondWithFilteredResult(_0x401ac8,_0x3ec763){return function(_0x20f011){if(_0x20f011){var _0x5a1513=typeof _0x3ec763[_0xa46b('0x1d')]==='undefined'&&typeof _0x3ec763[_0xa46b('0x1e')]===_0xa46b('0x1f');var _0xd86d05=_0x20f011[_0xa46b('0x20')];var _0x4e007f=_0x5a1513?0x0:_0x3ec763[_0xa46b('0x1d')];var _0x1bd996=_0x5a1513?_0x20f011[_0xa46b('0x20')]:_0x3ec763[_0xa46b('0x1d')]+_0x3ec763['limit'];var _0x4e2341;if(_0x1bd996>=_0xd86d05){_0x1bd996=_0xd86d05;_0x4e2341=0xc8;}else{_0x4e2341=0xce;}_0x401ac8[_0xa46b('0x1b')](_0x4e2341);return _0x401ac8['set'](_0xa46b('0x21'),_0x4e007f+'-'+_0x1bd996+'/'+_0xd86d05)[_0xa46b('0x1c')](_0x20f011);}return null;};}function patchUpdates(_0x18aae8){return function(_0x12b258){try{jsonpatch[_0xa46b('0x22')](_0x12b258,_0x18aae8,!![]);}catch(_0x54e888){return BPromise['reject'](_0x54e888);}return _0x12b258[_0xa46b('0x23')]();};}function saveUpdates(_0x2420b7,_0x5b01c3){return function(_0x7b1b12){if(_0x7b1b12){return _0x7b1b12[_0xa46b('0x24')](_0x2420b7)[_0xa46b('0x25')](function(_0x167f40){return _0x167f40;});}return null;};}function removeEntity(_0x472608,_0x35d93d){return function(_0x4a0462){if(_0x4a0462){return _0x4a0462['destroy']()[_0xa46b('0x25')](function(){_0x472608['status'](0xcc)[_0xa46b('0x26')]();});}};}function handleEntityNotFound(_0x43f396,_0x215e5f){return function(_0x21cbb9){if(!_0x21cbb9){_0x43f396[_0xa46b('0x1a')](0x194);}return _0x21cbb9;};}function handleError(_0x4d66e9,_0x4233a8){_0x4233a8=_0x4233a8||0x1f4;return function(_0x207068){logger['error'](_0x207068[_0xa46b('0x27')]);if(_0x207068[_0xa46b('0x28')]){delete _0x207068['name'];}_0x4d66e9[_0xa46b('0x1b')](_0x4233a8)[_0xa46b('0x29')](_0x207068);};}exports[_0xa46b('0x2a')]=function(_0x5346ab,_0x977152){var _0x9f910f={},_0x563aab={},_0x29780c={'count':0x0,'rows':[]};var _0x3a1552=_[_0xa46b('0x2b')](db[_0xa46b('0x2c')][_0xa46b('0x2d')],function(_0x1f29fd){return{'name':_0x1f29fd[_0xa46b('0x2e')],'type':_0x1f29fd['type']['key']};});_0x563aab['model']=_[_0xa46b('0x2b')](_0x3a1552,_0xa46b('0x28'));_0x563aab[_0xa46b('0x2f')]=_['keys'](_0x5346ab[_0xa46b('0x2f')]);_0x563aab[_0xa46b('0x30')]=_['intersection'](_0x563aab[_0xa46b('0x31')],_0x563aab['query']);_0x9f910f[_0xa46b('0x32')]=_[_0xa46b('0x33')](_0x563aab[_0xa46b('0x31')],qs[_0xa46b('0x34')](_0x5346ab[_0xa46b('0x2f')]['fields']));_0x9f910f[_0xa46b('0x32')]=_0x9f910f[_0xa46b('0x32')][_0xa46b('0x35')]?_0x9f910f[_0xa46b('0x32')]:_0x563aab[_0xa46b('0x31')];if(!_0x5346ab[_0xa46b('0x2f')]['hasOwnProperty'](_0xa46b('0x36'))){_0x9f910f[_0xa46b('0x1e')]=qs[_0xa46b('0x1e')](_0x5346ab[_0xa46b('0x2f')]['limit']);_0x9f910f[_0xa46b('0x1d')]=qs['offset'](_0x5346ab['query'][_0xa46b('0x1d')]);}_0x9f910f[_0xa46b('0x37')]=qs[_0xa46b('0x38')](_0x5346ab['query']['sort']);_0x9f910f[_0xa46b('0x39')]=qs[_0xa46b('0x30')](_[_0xa46b('0x3a')](_0x5346ab[_0xa46b('0x2f')],_0x563aab[_0xa46b('0x30')]),_0x3a1552);if(_0x5346ab[_0xa46b('0x2f')][_0xa46b('0x3b')]){_0x9f910f[_0xa46b('0x39')]=_[_0xa46b('0x3c')](_0x9f910f['where'],{'$or':_[_0xa46b('0x2b')](_0x3a1552,function(_0x5da7fd){if(_0x5da7fd[_0xa46b('0x3d')]!=='VIRTUAL'){var _0x928cd4={};_0x928cd4[_0x5da7fd[_0xa46b('0x28')]]={'$like':'%'+_0x5346ab[_0xa46b('0x2f')]['filter']+'%'};return _0x928cd4;}})});}_0x9f910f=_['merge']({},_0x9f910f,_0x5346ab[_0xa46b('0x3e')]);var _0x30bdd1={'where':_0x9f910f[_0xa46b('0x39')]};return db['MailServerOut']['count'](_0x30bdd1)[_0xa46b('0x25')](function(_0x4e9215){_0x29780c['count']=_0x4e9215;if(_0x5346ab[_0xa46b('0x2f')][_0xa46b('0x3f')]){_0x9f910f['include']=[{'all':!![]}];}return db[_0xa46b('0x2c')][_0xa46b('0x40')](_0x9f910f);})[_0xa46b('0x25')](function(_0x1e39f9){_0x29780c[_0xa46b('0x41')]=_0x1e39f9;return _0x29780c;})[_0xa46b('0x25')](respondWithFilteredResult(_0x977152,_0x9f910f))['catch'](handleError(_0x977152,null));};exports[_0xa46b('0x42')]=function(_0xf1f6e5,_0x58280f){var _0x58db9f={'raw':!![],'where':{'id':_0xf1f6e5[_0xa46b('0x43')]['id']}},_0xf6659c={};_0xf6659c[_0xa46b('0x31')]=_[_0xa46b('0x44')](db['MailServerOut'][_0xa46b('0x2d')]);_0xf6659c[_0xa46b('0x2f')]=_[_0xa46b('0x44')](_0xf1f6e5['query']);_0xf6659c[_0xa46b('0x30')]=_[_0xa46b('0x33')](_0xf6659c['model'],_0xf6659c[_0xa46b('0x2f')]);_0x58db9f[_0xa46b('0x32')]=_[_0xa46b('0x33')](_0xf6659c['model'],qs[_0xa46b('0x34')](_0xf1f6e5[_0xa46b('0x2f')][_0xa46b('0x34')]));_0x58db9f['attributes']=_0x58db9f[_0xa46b('0x32')][_0xa46b('0x35')]?_0x58db9f['attributes']:_0xf6659c['model'];if(_0xf1f6e5[_0xa46b('0x2f')]['includeAll']){_0x58db9f['include']=[{'all':!![]}];}_0x58db9f=_[_0xa46b('0x3c')]({},_0x58db9f,_0xf1f6e5[_0xa46b('0x3e')]);return db[_0xa46b('0x2c')][_0xa46b('0x45')](_0x58db9f)[_0xa46b('0x25')](handleEntityNotFound(_0x58280f,null))['then'](respondWithResult(_0x58280f,null))['catch'](handleError(_0x58280f,null));};exports[_0xa46b('0x46')]=function(_0x2bc7ff,_0x2a46ee){return db[_0xa46b('0x2c')][_0xa46b('0x46')](_0x2bc7ff[_0xa46b('0x47')],{})[_0xa46b('0x25')](respondWithResult(_0x2a46ee,0xc9))['catch'](handleError(_0x2a46ee,null));};exports['update']=function(_0xfbfaa3,_0xb55eea){if(_0xfbfaa3['body']['id']){delete _0xfbfaa3[_0xa46b('0x47')]['id'];}return db[_0xa46b('0x2c')][_0xa46b('0x45')]({'where':{'id':_0xfbfaa3[_0xa46b('0x43')]['id']}})[_0xa46b('0x25')](handleEntityNotFound(_0xb55eea,null))[_0xa46b('0x25')](saveUpdates(_0xfbfaa3[_0xa46b('0x47')],null))[_0xa46b('0x25')](respondWithResult(_0xb55eea,null))['catch'](handleError(_0xb55eea,null));};exports['destroy']=function(_0x23d966,_0x18b099){return db[_0xa46b('0x2c')][_0xa46b('0x45')]({'where':{'id':_0x23d966[_0xa46b('0x43')]['id']}})[_0xa46b('0x25')](handleEntityNotFound(_0x18b099,null))[_0xa46b('0x25')](removeEntity(_0x18b099,null))[_0xa46b('0x48')](handleError(_0x18b099,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 0844c5b..4e265d1 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 _0xd7db=['../../config/environment','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x15b167,_0x4bcba4){var _0x53edfc=function(_0x3f40f3){while(--_0x3f40f3){_0x15b167['push'](_0x15b167['shift']());}};_0x53edfc(++_0x4bcba4);}(_0xd7db,0x1e7));var _0xbd7d=function(_0x3667ee,_0x12257f){_0x3667ee=_0x3667ee-0x0;var _0x3bcb96=_0xd7db[_0x3667ee];return _0x3bcb96;};'use strict';var _=require(_0xbd7d('0x0'));var util=require(_0xbd7d('0x1'));var logger=require(_0xbd7d('0x2'))(_0xbd7d('0x3'));var moment=require(_0xbd7d('0x4'));var BPromise=require(_0xbd7d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd7d('0x6'));var rimraf=require(_0xbd7d('0x7'));var config=require(_0xbd7d('0x8'));var attributes=require('./mailServerOut.attributes');module['exports']=function(_0x2767bc,_0x381bcb){return _0x2767bc['define'](_0xbd7d('0x9'),attributes,{'tableName':_0xbd7d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ca1=['exports','MailServerOut','mail_servers_out','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./mailServerOut.attributes'];(function(_0x5c5bcf,_0x31b1c0){var _0x101d79=function(_0x1837a3){while(--_0x1837a3){_0x5c5bcf['push'](_0x5c5bcf['shift']());}};_0x101d79(++_0x31b1c0);}(_0x6ca1,0x19a));var _0x16ca=function(_0x50847a,_0x434bf3){_0x50847a=_0x50847a-0x0;var _0x44bd68=_0x6ca1[_0x50847a];return _0x44bd68;};'use strict';var _=require(_0x16ca('0x0'));var util=require(_0x16ca('0x1'));var logger=require(_0x16ca('0x2'))('api');var moment=require(_0x16ca('0x3'));var BPromise=require(_0x16ca('0x4'));var rp=require(_0x16ca('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x16ca('0x6'));var attributes=require(_0x16ca('0x7'));module[_0x16ca('0x8')]=function(_0x16f601,_0x39936c){return _0x16f601['define'](_0x16ca('0x9'),attributes,{'tableName':_0x16ca('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index b15a0d1..1873ea2 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x554d8c,_0x3433c8){var _0x36ea6f=function(_0x58cd5d){while(--_0x58cd5d){_0x554d8c['push'](_0x554d8c['shift']());}};_0x36ea6f(++_0x3433c8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5f5c74,_0x330dca){_0x5f5c74=_0x5f5c74-0x0;var _0x130b4b=_0x5f2f[_0x5f5c74];return _0x130b4b;};'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')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0xd697e,_0x406582){var _0x254c7f=function(_0x5d8600){while(--_0x5d8600){_0xd697e['push'](_0xd697e['shift']());}};_0x254c7f(++_0x406582);}(_0x5f2f,0x73));var _0xf5f2=function(_0x332d17,_0x2eab35){_0x332d17=_0x332d17-0x0;var _0x29cc50=_0x5f2f[_0x332d17];return _0x29cc50;};'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')]('MailServerOut,\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/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index bd8ede6..78a9c6d 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 _0xf010=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','isAuthenticated','describe','/:id','show','post','put','update','destroy','exports'];(function(_0x557f28,_0xc7a5a6){var _0x2ffa93=function(_0x57abe2){while(--_0x57abe2){_0x557f28['push'](_0x557f28['shift']());}};_0x2ffa93(++_0xc7a5a6);}(_0xf010,0x6e));var _0x0f01=function(_0x4a3506,_0x2cac8e){_0x4a3506=_0x4a3506-0x0;var _0x870c1b=_0xf010[_0x4a3506];return _0x870c1b;};'use strict';var multer=require(_0x0f01('0x0'));var util=require(_0x0f01('0x1'));var path=require(_0x0f01('0x2'));var timeout=require(_0x0f01('0x3'));var express=require(_0x0f01('0x4'));var router=express[_0x0f01('0x5')]();var fs_extra=require(_0x0f01('0x6'));var auth=require(_0x0f01('0x7'));var interaction=require(_0x0f01('0x8'));var config=require(_0x0f01('0x9'));var controller=require(_0x0f01('0xa'));router[_0x0f01('0xb')]('/',auth['isAuthenticated'](),controller[_0x0f01('0xc')]);router[_0x0f01('0xb')]('/describe',auth[_0x0f01('0xd')](),controller[_0x0f01('0xe')]);router['get'](_0x0f01('0xf'),auth[_0x0f01('0xd')](),controller[_0x0f01('0x10')]);router[_0x0f01('0x11')]('/',auth[_0x0f01('0xd')](),controller['create']);router[_0x0f01('0x12')]('/:id',auth[_0x0f01('0xd')](),controller[_0x0f01('0x13')]);router['delete']('/:id',auth[_0x0f01('0xd')](),controller[_0x0f01('0x14')]);module[_0x0f01('0x15')]=router; \ No newline at end of file +var _0xb202=['multer','util','path','../../components/auth/service','isAuthenticated','index','get','/describe','/:id','put','update','delete','destroy','exports'];(function(_0x1fe14f,_0x36745d){var _0x4c4904=function(_0x346961){while(--_0x346961){_0x1fe14f['push'](_0x1fe14f['shift']());}};_0x4c4904(++_0x36745d);}(_0xb202,0x15e));var _0x2b20=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0xb202[_0x1e3c16];return _0x47a0c9;};'use strict';var multer=require(_0x2b20('0x0'));var util=require(_0x2b20('0x1'));var path=require(_0x2b20('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2b20('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0x2b20('0x4')](),controller[_0x2b20('0x5')]);router[_0x2b20('0x6')](_0x2b20('0x7'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x2b20('0x8'),auth[_0x2b20('0x4')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2b20('0x9')](_0x2b20('0x8'),auth['isAuthenticated'](),controller[_0x2b20('0xa')]);router[_0x2b20('0xb')](_0x2b20('0x8'),auth['isAuthenticated'](),controller[_0x2b20('0xc')]);module[_0x2b20('0xd')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 09b44a4..059ac48 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 _0xeae8=['sequelize','exports','STRING'];(function(_0x5c04b1,_0x4a3572){var _0x253991=function(_0x242514){while(--_0x242514){_0x5c04b1['push'](_0x5c04b1['shift']());}};_0x253991(++_0x4a3572);}(_0xeae8,0x66));var _0x8eae=function(_0x3180ec,_0x157efc){_0x3180ec=_0x3180ec-0x0;var _0x514df3=_0xeae8[_0x3180ec];return _0x514df3;};'use strict';var Sequelize=require(_0x8eae('0x0'));module[_0x8eae('0x1')]={'name':{'type':Sequelize[_0x8eae('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8eae('0x2')]}}; \ No newline at end of file +var _0xc7a3=['exports','STRING','name'];(function(_0x23a971,_0x70b461){var _0x36c6d3=function(_0x3ccc4e){while(--_0x3ccc4e){_0x23a971['push'](_0x23a971['shift']());}};_0x36c6d3(++_0x70b461);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x29bbb9,_0x55ad58){_0x29bbb9=_0x29bbb9-0x0;var _0x230614=_0xc7a3[_0x29bbb9];return _0x230614;};'use strict';var Sequelize=require('sequelize');module[_0x3c7a('0x0')]={'name':{'type':Sequelize[_0x3c7a('0x1')],'unique':_0x3c7a('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3c7a('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 7d1e2bb..6c17059 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 _0x6434=['count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','MailSubstatus','rawAttributes','type','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','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/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit'];(function(_0x5f5495,_0x30d087){var _0x14d8a3=function(_0x40e773){while(--_0x40e773){_0x5f5495['push'](_0x5f5495['shift']());}};_0x14d8a3(++_0x30d087);}(_0x6434,0x112));var _0x4643=function(_0x42eb24,_0x30a401){_0x42eb24=_0x42eb24-0x0;var _0x190d0a=_0x6434[_0x42eb24];return _0x190d0a;};'use strict';var emlformat=require(_0x4643('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4643('0x1'));var jsonpatch=require(_0x4643('0x2'));var rp=require(_0x4643('0x3'));var moment=require('moment');var BPromise=require(_0x4643('0x4'));var Mustache=require(_0x4643('0x5'));var util=require(_0x4643('0x6'));var path=require(_0x4643('0x7'));var sox=require(_0x4643('0x8'));var csv=require(_0x4643('0x9'));var ejs=require(_0x4643('0xa'));var fs=require('fs');var fs_extra=require(_0x4643('0xb'));var _=require(_0x4643('0xc'));var squel=require('squel');var crypto=require(_0x4643('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4643('0xe'));var toCsv=require(_0x4643('0x9'));var querystring=require(_0x4643('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4643('0x10'));var qs=require(_0x4643('0x11'));var as=require(_0x4643('0x12'));var hardwareService=require(_0x4643('0x13'));var logger=require(_0x4643('0x14'))(_0x4643('0x15'));var utils=require('../../config/utils');var config=require(_0x4643('0x16'));var licenseUtil=require(_0x4643('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8c98a3,_0x671b1e){_0x671b1e=_0x671b1e||0xcc;return function(_0x302fec){if(_0x302fec){return _0x8c98a3[_0x4643('0x18')](_0x671b1e);}return _0x8c98a3[_0x4643('0x19')](_0x671b1e)[_0x4643('0x1a')]();};}function respondWithResult(_0x38c9d9,_0x50db38){_0x50db38=_0x50db38||0xc8;return function(_0xc85369){if(_0xc85369){return _0x38c9d9[_0x4643('0x19')](_0x50db38)[_0x4643('0x1b')](_0xc85369);}};}function respondWithFilteredResult(_0x2aa573,_0x127fda){return function(_0x35acf5){if(_0x35acf5){var _0x530396=typeof _0x127fda['offset']===_0x4643('0x1c')&&typeof _0x127fda[_0x4643('0x1d')]===_0x4643('0x1c');var _0x1136ab=_0x35acf5[_0x4643('0x1e')];var _0x561ab9=_0x530396?0x0:_0x127fda[_0x4643('0x1f')];var _0x395158=_0x530396?_0x35acf5['count']:_0x127fda[_0x4643('0x1f')]+_0x127fda['limit'];var _0x289fa0;if(_0x395158>=_0x1136ab){_0x395158=_0x1136ab;_0x289fa0=0xc8;}else{_0x289fa0=0xce;}_0x2aa573['status'](_0x289fa0);return _0x2aa573[_0x4643('0x20')](_0x4643('0x21'),_0x561ab9+'-'+_0x395158+'/'+_0x1136ab)[_0x4643('0x1b')](_0x35acf5);}return null;};}function patchUpdates(_0x378d04){return function(_0x2c2de4){try{jsonpatch[_0x4643('0x22')](_0x2c2de4,_0x378d04,!![]);}catch(_0x3f7b1d){return BPromise[_0x4643('0x23')](_0x3f7b1d);}return _0x2c2de4[_0x4643('0x24')]();};}function saveUpdates(_0x4f2fd5,_0x2993dc){return function(_0x3fb229){if(_0x3fb229){return _0x3fb229['update'](_0x4f2fd5)[_0x4643('0x25')](function(_0xb88c80){return _0xb88c80;});}return null;};}function removeEntity(_0x907d35,_0x1f7796){return function(_0x21ae84){if(_0x21ae84){return _0x21ae84[_0x4643('0x26')]()[_0x4643('0x25')](function(){_0x907d35['status'](0xcc)[_0x4643('0x1a')]();});}};}function handleEntityNotFound(_0x159745,_0x33bd67){return function(_0x5ab3b7){if(!_0x5ab3b7){_0x159745[_0x4643('0x18')](0x194);}return _0x5ab3b7;};}function handleError(_0x527150,_0x2f18ff){_0x2f18ff=_0x2f18ff||0x1f4;return function(_0x4b95f4){logger[_0x4643('0x27')](_0x4b95f4[_0x4643('0x28')]);if(_0x4b95f4['name']){delete _0x4b95f4[_0x4643('0x29')];}_0x527150[_0x4643('0x19')](_0x2f18ff)[_0x4643('0x2a')](_0x4b95f4);};}exports[_0x4643('0x2b')]=function(_0x3ba879,_0xd8ae43){var _0x222239={},_0x1748ad={},_0x3a957b={'count':0x0,'rows':[]};var _0x3f16e1=_[_0x4643('0x2c')](db[_0x4643('0x2d')][_0x4643('0x2e')],function(_0x2528f5){return{'name':_0x2528f5['fieldName'],'type':_0x2528f5[_0x4643('0x2f')]['key']};});_0x1748ad['model']=_['map'](_0x3f16e1,_0x4643('0x29'));_0x1748ad['query']=_[_0x4643('0x30')](_0x3ba879[_0x4643('0x31')]);_0x1748ad[_0x4643('0x32')]=_[_0x4643('0x33')](_0x1748ad['model'],_0x1748ad[_0x4643('0x31')]);_0x222239[_0x4643('0x34')]=_[_0x4643('0x33')](_0x1748ad[_0x4643('0x35')],qs[_0x4643('0x36')](_0x3ba879['query'][_0x4643('0x36')]));_0x222239[_0x4643('0x34')]=_0x222239['attributes'][_0x4643('0x37')]?_0x222239['attributes']:_0x1748ad[_0x4643('0x35')];if(!_0x3ba879[_0x4643('0x31')][_0x4643('0x38')](_0x4643('0x39'))){_0x222239[_0x4643('0x1d')]=qs[_0x4643('0x1d')](_0x3ba879[_0x4643('0x31')]['limit']);_0x222239[_0x4643('0x1f')]=qs[_0x4643('0x1f')](_0x3ba879[_0x4643('0x31')][_0x4643('0x1f')]);}_0x222239[_0x4643('0x3a')]=qs['sort'](_0x3ba879[_0x4643('0x31')]['sort']);_0x222239['where']=qs['filters'](_[_0x4643('0x3b')](_0x3ba879[_0x4643('0x31')],_0x1748ad[_0x4643('0x32')]),_0x3f16e1);if(_0x3ba879[_0x4643('0x31')][_0x4643('0x3c')]){_0x222239[_0x4643('0x3d')]=_[_0x4643('0x3e')](_0x222239[_0x4643('0x3d')],{'$or':_['map'](_0x3f16e1,function(_0x5aeb7b){if(_0x5aeb7b[_0x4643('0x2f')]!==_0x4643('0x3f')){var _0x2eedaa={};_0x2eedaa[_0x5aeb7b['name']]={'$like':'%'+_0x3ba879[_0x4643('0x31')][_0x4643('0x3c')]+'%'};return _0x2eedaa;}})});}_0x222239=_[_0x4643('0x3e')]({},_0x222239,_0x3ba879[_0x4643('0x40')]);var _0x5c5af6={'where':_0x222239[_0x4643('0x3d')]};return db['MailSubstatus']['count'](_0x5c5af6)[_0x4643('0x25')](function(_0x9e1c60){_0x3a957b[_0x4643('0x1e')]=_0x9e1c60;if(_0x3ba879[_0x4643('0x31')][_0x4643('0x41')]){_0x222239[_0x4643('0x42')]=[{'all':!![]}];}return db['MailSubstatus'][_0x4643('0x43')](_0x222239);})[_0x4643('0x25')](function(_0x5e37f8){_0x3a957b[_0x4643('0x44')]=_0x5e37f8;return _0x3a957b;})[_0x4643('0x25')](respondWithFilteredResult(_0xd8ae43,_0x222239))[_0x4643('0x45')](handleError(_0xd8ae43,null));};exports[_0x4643('0x46')]=function(_0x1f12c3,_0x451126){var _0x2a7f94={'raw':!![],'where':{'id':_0x1f12c3[_0x4643('0x47')]['id']}},_0x5ec083={};_0x5ec083[_0x4643('0x35')]=_['keys'](db[_0x4643('0x2d')]['rawAttributes']);_0x5ec083['query']=_[_0x4643('0x30')](_0x1f12c3[_0x4643('0x31')]);_0x5ec083[_0x4643('0x32')]=_[_0x4643('0x33')](_0x5ec083[_0x4643('0x35')],_0x5ec083['query']);_0x2a7f94[_0x4643('0x34')]=_[_0x4643('0x33')](_0x5ec083[_0x4643('0x35')],qs[_0x4643('0x36')](_0x1f12c3[_0x4643('0x31')][_0x4643('0x36')]));_0x2a7f94[_0x4643('0x34')]=_0x2a7f94[_0x4643('0x34')][_0x4643('0x37')]?_0x2a7f94['attributes']:_0x5ec083['model'];if(_0x1f12c3[_0x4643('0x31')][_0x4643('0x41')]){_0x2a7f94[_0x4643('0x42')]=[{'all':!![]}];}_0x2a7f94=_[_0x4643('0x3e')]({},_0x2a7f94,_0x1f12c3[_0x4643('0x40')]);return db[_0x4643('0x2d')][_0x4643('0x48')](_0x2a7f94)[_0x4643('0x25')](handleEntityNotFound(_0x451126,null))[_0x4643('0x25')](respondWithResult(_0x451126,null))[_0x4643('0x45')](handleError(_0x451126,null));};exports['create']=function(_0x44058f,_0x9cb5d7){return db[_0x4643('0x2d')]['create'](_0x44058f[_0x4643('0x49')],{})[_0x4643('0x25')](respondWithResult(_0x9cb5d7,0xc9))[_0x4643('0x45')](handleError(_0x9cb5d7,null));};exports[_0x4643('0x4a')]=function(_0x53203f,_0x4c136c){if(_0x53203f[_0x4643('0x49')]['id']){delete _0x53203f[_0x4643('0x49')]['id'];}return db[_0x4643('0x2d')]['find']({'where':{'id':_0x53203f[_0x4643('0x47')]['id']}})[_0x4643('0x25')](handleEntityNotFound(_0x4c136c,null))['then'](saveUpdates(_0x53203f[_0x4643('0x49')],null))[_0x4643('0x25')](respondWithResult(_0x4c136c,null))[_0x4643('0x45')](handleError(_0x4c136c,null));};exports[_0x4643('0x26')]=function(_0x4a4d37,_0x2cac78){return db[_0x4643('0x2d')][_0x4643('0x48')]({'where':{'id':_0x4a4d37['params']['id']}})[_0x4643('0x25')](handleEntityNotFound(_0x2cac78,null))[_0x4643('0x25')](removeEntity(_0x2cac78,null))['catch'](handleError(_0x2cac78,null));};exports[_0x4643('0x4b')]=function(_0x1071db,_0x5baaae){return db['MailSubstatus']['describe']()[_0x4643('0x25')](respondWithResult(_0x5baaae,null))[_0x4643('0x45')](handleError(_0x5baaae,null));}; \ No newline at end of file +var _0x32bf=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','name','send','index','map','MailSubstatus','rawAttributes','model','query','keys','attributes','intersection','fields','length','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','include','catch','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse'];(function(_0x528090,_0x53e439){var _0x43d41e=function(_0x1d69e7){while(--_0x1d69e7){_0x528090['push'](_0x528090['shift']());}};_0x43d41e(++_0x53e439);}(_0x32bf,0x15d));var _0xf32b=function(_0x7c1f32,_0x5af766){_0x7c1f32=_0x7c1f32-0x0;var _0x9c767d=_0x32bf[_0x7c1f32];return _0x9c767d;};'use strict';var emlformat=require(_0xf32b('0x0'));var rimraf=require(_0xf32b('0x1'));var zipdir=require(_0xf32b('0x2'));var jsonpatch=require(_0xf32b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf32b('0x4'));var util=require(_0xf32b('0x5'));var path=require(_0xf32b('0x6'));var sox=require(_0xf32b('0x7'));var csv=require(_0xf32b('0x8'));var ejs=require(_0xf32b('0x9'));var fs=require('fs');var fs_extra=require(_0xf32b('0xa'));var _=require('lodash');var squel=require(_0xf32b('0xb'));var crypto=require(_0xf32b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf32b('0xd'));var toCsv=require(_0xf32b('0x8'));var querystring=require(_0xf32b('0xe'));var Papa=require(_0xf32b('0xf'));var Redis=require(_0xf32b('0x10'));var authService=require(_0xf32b('0x11'));var qs=require(_0xf32b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf32b('0x13'));var logger=require('../../config/logger')(_0xf32b('0x14'));var utils=require(_0xf32b('0x15'));var config=require(_0xf32b('0x16'));var licenseUtil=require(_0xf32b('0x17'));var db=require(_0xf32b('0x18'))['db'];function respondWithStatusCode(_0x430a57,_0x2685cc){_0x2685cc=_0x2685cc||0xcc;return function(_0x429986){if(_0x429986){return _0x430a57[_0xf32b('0x19')](_0x2685cc);}return _0x430a57[_0xf32b('0x1a')](_0x2685cc)['end']();};}function respondWithResult(_0x2c2e43,_0x165234){_0x165234=_0x165234||0xc8;return function(_0x348906){if(_0x348906){return _0x2c2e43[_0xf32b('0x1a')](_0x165234)[_0xf32b('0x1b')](_0x348906);}};}function respondWithFilteredResult(_0xdcd7e5,_0xd6477e){return function(_0x464ec6){if(_0x464ec6){var _0x24be81=typeof _0xd6477e['offset']===_0xf32b('0x1c')&&typeof _0xd6477e[_0xf32b('0x1d')]===_0xf32b('0x1c');var _0x37cbe8=_0x464ec6[_0xf32b('0x1e')];var _0x26c728=_0x24be81?0x0:_0xd6477e['offset'];var _0x3650ef=_0x24be81?_0x464ec6['count']:_0xd6477e['offset']+_0xd6477e[_0xf32b('0x1d')];var _0x342a58;if(_0x3650ef>=_0x37cbe8){_0x3650ef=_0x37cbe8;_0x342a58=0xc8;}else{_0x342a58=0xce;}_0xdcd7e5[_0xf32b('0x1a')](_0x342a58);return _0xdcd7e5[_0xf32b('0x1f')](_0xf32b('0x20'),_0x26c728+'-'+_0x3650ef+'/'+_0x37cbe8)[_0xf32b('0x1b')](_0x464ec6);}return null;};}function patchUpdates(_0x13d694){return function(_0x30bbd5){try{jsonpatch['apply'](_0x30bbd5,_0x13d694,!![]);}catch(_0x55c7ae){return BPromise[_0xf32b('0x21')](_0x55c7ae);}return _0x30bbd5[_0xf32b('0x22')]();};}function saveUpdates(_0x192bf1,_0x3dd0ce){return function(_0x1936d2){if(_0x1936d2){return _0x1936d2[_0xf32b('0x23')](_0x192bf1)[_0xf32b('0x24')](function(_0x5c0310){return _0x5c0310;});}return null;};}function removeEntity(_0x211a20,_0x225b6d){return function(_0x2f3020){if(_0x2f3020){return _0x2f3020[_0xf32b('0x25')]()['then'](function(){_0x211a20[_0xf32b('0x1a')](0xcc)[_0xf32b('0x26')]();});}};}function handleEntityNotFound(_0x490810,_0x24e313){return function(_0x4c2526){if(!_0x4c2526){_0x490810[_0xf32b('0x19')](0x194);}return _0x4c2526;};}function handleError(_0x972c99,_0x13d3aa){_0x13d3aa=_0x13d3aa||0x1f4;return function(_0x2adcd9){logger[_0xf32b('0x27')](_0x2adcd9['stack']);if(_0x2adcd9[_0xf32b('0x28')]){delete _0x2adcd9[_0xf32b('0x28')];}_0x972c99[_0xf32b('0x1a')](_0x13d3aa)[_0xf32b('0x29')](_0x2adcd9);};}exports[_0xf32b('0x2a')]=function(_0x4616ff,_0x2a0150){var _0x32dc47={},_0x52b264={},_0x13b64c={'count':0x0,'rows':[]};var _0x57e0c2=_[_0xf32b('0x2b')](db[_0xf32b('0x2c')][_0xf32b('0x2d')],function(_0x2bbfd9){return{'name':_0x2bbfd9['fieldName'],'type':_0x2bbfd9['type']['key']};});_0x52b264[_0xf32b('0x2e')]=_[_0xf32b('0x2b')](_0x57e0c2,_0xf32b('0x28'));_0x52b264[_0xf32b('0x2f')]=_[_0xf32b('0x30')](_0x4616ff[_0xf32b('0x2f')]);_0x52b264['filters']=_['intersection'](_0x52b264[_0xf32b('0x2e')],_0x52b264[_0xf32b('0x2f')]);_0x32dc47[_0xf32b('0x31')]=_[_0xf32b('0x32')](_0x52b264[_0xf32b('0x2e')],qs[_0xf32b('0x33')](_0x4616ff[_0xf32b('0x2f')][_0xf32b('0x33')]));_0x32dc47[_0xf32b('0x31')]=_0x32dc47[_0xf32b('0x31')][_0xf32b('0x34')]?_0x32dc47[_0xf32b('0x31')]:_0x52b264[_0xf32b('0x2e')];if(!_0x4616ff[_0xf32b('0x2f')]['hasOwnProperty'](_0xf32b('0x35'))){_0x32dc47['limit']=qs[_0xf32b('0x1d')](_0x4616ff['query']['limit']);_0x32dc47[_0xf32b('0x36')]=qs[_0xf32b('0x36')](_0x4616ff[_0xf32b('0x2f')][_0xf32b('0x36')]);}_0x32dc47[_0xf32b('0x37')]=qs[_0xf32b('0x38')](_0x4616ff[_0xf32b('0x2f')]['sort']);_0x32dc47[_0xf32b('0x39')]=qs[_0xf32b('0x3a')](_[_0xf32b('0x3b')](_0x4616ff['query'],_0x52b264[_0xf32b('0x3a')]),_0x57e0c2);if(_0x4616ff['query'][_0xf32b('0x3c')]){_0x32dc47[_0xf32b('0x39')]=_[_0xf32b('0x3d')](_0x32dc47[_0xf32b('0x39')],{'$or':_[_0xf32b('0x2b')](_0x57e0c2,function(_0x5013a7){if(_0x5013a7['type']!==_0xf32b('0x3e')){var _0x5990f9={};_0x5990f9[_0x5013a7['name']]={'$like':'%'+_0x4616ff['query'][_0xf32b('0x3c')]+'%'};return _0x5990f9;}})});}_0x32dc47=_[_0xf32b('0x3d')]({},_0x32dc47,_0x4616ff[_0xf32b('0x3f')]);var _0x338363={'where':_0x32dc47[_0xf32b('0x39')]};return db[_0xf32b('0x2c')][_0xf32b('0x1e')](_0x338363)[_0xf32b('0x24')](function(_0x25539d){_0x13b64c[_0xf32b('0x1e')]=_0x25539d;if(_0x4616ff[_0xf32b('0x2f')][_0xf32b('0x40')]){_0x32dc47['include']=[{'all':!![]}];}return db[_0xf32b('0x2c')]['findAll'](_0x32dc47);})[_0xf32b('0x24')](function(_0x5ccd9c){_0x13b64c[_0xf32b('0x41')]=_0x5ccd9c;return _0x13b64c;})[_0xf32b('0x24')](respondWithFilteredResult(_0x2a0150,_0x32dc47))['catch'](handleError(_0x2a0150,null));};exports[_0xf32b('0x42')]=function(_0x157680,_0x3db93f){var _0x552239={'raw':!![],'where':{'id':_0x157680['params']['id']}},_0x14b046={};_0x14b046['model']=_[_0xf32b('0x30')](db[_0xf32b('0x2c')][_0xf32b('0x2d')]);_0x14b046[_0xf32b('0x2f')]=_['keys'](_0x157680[_0xf32b('0x2f')]);_0x14b046[_0xf32b('0x3a')]=_[_0xf32b('0x32')](_0x14b046['model'],_0x14b046['query']);_0x552239[_0xf32b('0x31')]=_['intersection'](_0x14b046[_0xf32b('0x2e')],qs['fields'](_0x157680[_0xf32b('0x2f')][_0xf32b('0x33')]));_0x552239[_0xf32b('0x31')]=_0x552239[_0xf32b('0x31')][_0xf32b('0x34')]?_0x552239[_0xf32b('0x31')]:_0x14b046['model'];if(_0x157680['query'][_0xf32b('0x40')]){_0x552239[_0xf32b('0x43')]=[{'all':!![]}];}_0x552239=_[_0xf32b('0x3d')]({},_0x552239,_0x157680[_0xf32b('0x3f')]);return db['MailSubstatus']['find'](_0x552239)[_0xf32b('0x24')](handleEntityNotFound(_0x3db93f,null))[_0xf32b('0x24')](respondWithResult(_0x3db93f,null))[_0xf32b('0x44')](handleError(_0x3db93f,null));};exports['create']=function(_0x5ed127,_0x3b1617){return db[_0xf32b('0x2c')]['create'](_0x5ed127['body'],{})['then'](respondWithResult(_0x3b1617,0xc9))[_0xf32b('0x44')](handleError(_0x3b1617,null));};exports['update']=function(_0x2a3005,_0x4775fa){if(_0x2a3005['body']['id']){delete _0x2a3005[_0xf32b('0x45')]['id'];}return db[_0xf32b('0x2c')][_0xf32b('0x46')]({'where':{'id':_0x2a3005[_0xf32b('0x47')]['id']}})[_0xf32b('0x24')](handleEntityNotFound(_0x4775fa,null))[_0xf32b('0x24')](saveUpdates(_0x2a3005[_0xf32b('0x45')],null))[_0xf32b('0x24')](respondWithResult(_0x4775fa,null))[_0xf32b('0x44')](handleError(_0x4775fa,null));};exports[_0xf32b('0x25')]=function(_0x1ce8c2,_0x65fc73){return db[_0xf32b('0x2c')][_0xf32b('0x46')]({'where':{'id':_0x1ce8c2[_0xf32b('0x47')]['id']}})[_0xf32b('0x24')](handleEntityNotFound(_0x65fc73,null))['then'](removeEntity(_0x65fc73,null))['catch'](handleError(_0x65fc73,null));};exports[_0xf32b('0x48')]=function(_0x2916c1,_0x36acfd){return db['MailSubstatus']['describe']()[_0xf32b('0x24')](respondWithResult(_0x36acfd,null))[_0xf32b('0x44')](handleError(_0x36acfd,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 3885e67..21555e4 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 _0x4cdb=['MailSubstatus','mail_substatuses','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define'];(function(_0x1cbd98,_0x23933e){var _0x37eedc=function(_0x26b95a){while(--_0x26b95a){_0x1cbd98['push'](_0x1cbd98['shift']());}};_0x37eedc(++_0x23933e);}(_0x4cdb,0x182));var _0xb4cd=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0x4cdb[_0x245afe];return _0x4eefde;};'use strict';var _=require(_0xb4cd('0x0'));var util=require(_0xb4cd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb4cd('0x2'));var BPromise=require('bluebird');var rp=require(_0xb4cd('0x3'));var fs=require('fs');var path=require(_0xb4cd('0x4'));var rimraf=require(_0xb4cd('0x5'));var config=require(_0xb4cd('0x6'));var attributes=require(_0xb4cd('0x7'));module[_0xb4cd('0x8')]=function(_0x46ba2b,_0x33f3c0){return _0x46ba2b[_0xb4cd('0x9')](_0xb4cd('0xa'),attributes,{'tableName':_0xb4cd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66f2=['request-promise','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','lodash','util','api','bluebird'];(function(_0x3480f4,_0x3fde4a){var _0x60e129=function(_0x48101e){while(--_0x48101e){_0x3480f4['push'](_0x3480f4['shift']());}};_0x60e129(++_0x3fde4a);}(_0x66f2,0x134));var _0x266f=function(_0x5161fc,_0x37c5f6){_0x5161fc=_0x5161fc-0x0;var _0x38490b=_0x66f2[_0x5161fc];return _0x38490b;};'use strict';var _=require(_0x266f('0x0'));var util=require(_0x266f('0x1'));var logger=require('../../config/logger')(_0x266f('0x2'));var moment=require('moment');var BPromise=require(_0x266f('0x3'));var rp=require(_0x266f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x266f('0x5'));var config=require(_0x266f('0x6'));var attributes=require(_0x266f('0x7'));module[_0x266f('0x8')]=function(_0x10a602,_0xb708dd){return _0x10a602[_0x266f('0x9')](_0x266f('0xa'),attributes,{'tableName':_0x266f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 85084a2..b5148e7 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 _0x529c=['debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent'];(function(_0x33908d,_0x208069){var _0xc3fe2=function(_0x52504f){while(--_0x52504f){_0x33908d['push'](_0x33908d['shift']());}};_0xc3fe2(++_0x208069);}(_0x529c,0x132));var _0xc529=function(_0x408359,_0x475fe7){_0x408359=_0x408359-0x0;var _0x44b33c=_0x529c[_0x408359];return _0x44b33c;};'use strict';var _=require(_0xc529('0x0'));var util=require(_0xc529('0x1'));var moment=require('moment');var BPromise=require(_0xc529('0x2'));var rs=require(_0xc529('0x3'));var fs=require('fs');var Redis=require(_0xc529('0x4'));var db=require(_0xc529('0x5'))['db'];var utils=require(_0xc529('0x6'));var logger=require(_0xc529('0x7'))(_0xc529('0x8'));var config=require('../../config/environment');var jayson=require(_0xc529('0x9'));var client=jayson['client'][_0xc529('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb6bc,_0x98b424,_0x4d1aa2){return new BPromise(function(_0x5ba5ce,_0x127b54){return client[_0xc529('0xb')](_0x2bb6bc,_0x4d1aa2)[_0xc529('0xc')](function(_0x18db45){logger[_0xc529('0xd')](_0xc529('0xe'),_0x98b424,_0xc529('0xf'));logger[_0xc529('0x10')](_0xc529('0x11'),_0x98b424,'request\x20sent',JSON[_0xc529('0x12')](_0x18db45));if(_0x18db45[_0xc529('0x13')]){if(_0x18db45['error']['code']===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x98b424,_0x18db45['error']['message']);return _0x127b54(_0x18db45['error'][_0xc529('0x14')]);}logger[_0xc529('0x13')](_0xc529('0xe'),_0x98b424,_0x18db45[_0xc529('0x13')][_0xc529('0x14')]);return _0x5ba5ce(_0x18db45[_0xc529('0x13')]['message']);}else{logger[_0xc529('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x98b424,'request\x20sent');_0x5ba5ce(_0x18db45[_0xc529('0x15')]['message']);}})[_0xc529('0x16')](function(_0x579a72){logger['error'](_0xc529('0xe'),_0x98b424,_0x579a72);_0x127b54(_0x579a72);});});} \ No newline at end of file +var _0x176e=['then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x176e,0x1d3));var _0xe176=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x176e[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0xe176('0x0'));var util=require(_0xe176('0x1'));var moment=require(_0xe176('0x2'));var BPromise=require(_0xe176('0x3'));var rs=require(_0xe176('0x4'));var fs=require('fs');var Redis=require(_0xe176('0x5'));var db=require(_0xe176('0x6'))['db'];var utils=require(_0xe176('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xe176('0x8'));var jayson=require(_0xe176('0x9'));var client=jayson[_0xe176('0xa')][_0xe176('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x121d32,_0x5a3cc6,_0x2931d1){return new BPromise(function(_0x5ef9e3,_0x18bfc2){return client[_0xe176('0xc')](_0x121d32,_0x2931d1)[_0xe176('0xd')](function(_0x3c95ce){logger[_0xe176('0xe')](_0xe176('0xf'),_0x5a3cc6,_0xe176('0x10'));logger[_0xe176('0x11')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x5a3cc6,_0xe176('0x10'),JSON[_0xe176('0x12')](_0x3c95ce));if(_0x3c95ce[_0xe176('0x13')]){if(_0x3c95ce[_0xe176('0x13')][_0xe176('0x14')]===0x1f4){logger[_0xe176('0x13')](_0xe176('0xf'),_0x5a3cc6,_0x3c95ce['error'][_0xe176('0x15')]);return _0x18bfc2(_0x3c95ce[_0xe176('0x13')][_0xe176('0x15')]);}logger[_0xe176('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x5a3cc6,_0x3c95ce['error'][_0xe176('0x15')]);return _0x5ef9e3(_0x3c95ce[_0xe176('0x13')][_0xe176('0x15')]);}else{logger[_0xe176('0xe')](_0xe176('0xf'),_0x5a3cc6,_0xe176('0x10'));_0x5ef9e3(_0x3c95ce[_0xe176('0x16')][_0xe176('0x15')]);}})[_0xe176('0x17')](function(_0xf08e94){logger[_0xe176('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x5a3cc6,_0xf08e94);_0x18bfc2(_0xf08e94);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 90bc1cf..f96d84f 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 _0x57b3=['express','Router','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','describe','show','put','/:id','delete','path','connect-timeout'];(function(_0x3ceddf,_0x224055){var _0x2e5d2e=function(_0x1e2413){while(--_0x1e2413){_0x3ceddf['push'](_0x3ceddf['shift']());}};_0x2e5d2e(++_0x224055);}(_0x57b3,0xa6));var _0x357b=function(_0x3b80d6,_0x18a56a){_0x3b80d6=_0x3b80d6-0x0;var _0x4e08f1=_0x57b3[_0x3b80d6];return _0x4e08f1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x357b('0x0'));var timeout=require(_0x357b('0x1'));var express=require(_0x357b('0x2'));var router=express[_0x357b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x357b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x357b('0x5'));var controller=require(_0x357b('0x6'));router[_0x357b('0x7')]('/',auth[_0x357b('0x8')](),controller['index']);router['get']('/describe',auth[_0x357b('0x8')](),controller[_0x357b('0x9')]);router[_0x357b('0x7')]('/:id',auth[_0x357b('0x8')](),controller[_0x357b('0xa')]);router['post']('/',auth[_0x357b('0x8')](),controller['create']);router[_0x357b('0xb')](_0x357b('0xc'),auth[_0x357b('0x8')](),controller['update']);router[_0x357b('0xd')]('/:id',auth[_0x357b('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x11c2=['/describe','/:id','show','post','create','delete','destroy','exports','util','path','Router','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index'];(function(_0x4b7389,_0x367042){var _0x13f0b6=function(_0x33d120){while(--_0x33d120){_0x4b7389['push'](_0x4b7389['shift']());}};_0x13f0b6(++_0x367042);}(_0x11c2,0xf6));var _0x211c=function(_0x1b929c,_0x200c6a){_0x1b929c=_0x1b929c-0x0;var _0x52ca51=_0x11c2[_0x1b929c];return _0x52ca51;};'use strict';var multer=require('multer');var util=require(_0x211c('0x0'));var path=require(_0x211c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x211c('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x211c('0x3'));var config=require(_0x211c('0x4'));var controller=require(_0x211c('0x5'));router[_0x211c('0x6')]('/',auth[_0x211c('0x7')](),controller[_0x211c('0x8')]);router[_0x211c('0x6')](_0x211c('0x9'),auth[_0x211c('0x7')](),controller['describe']);router[_0x211c('0x6')](_0x211c('0xa'),auth['isAuthenticated'](),controller[_0x211c('0xb')]);router[_0x211c('0xc')]('/',auth[_0x211c('0x7')](),controller[_0x211c('0xd')]);router['put']('/:id',auth[_0x211c('0x7')](),controller['update']);router[_0x211c('0xe')](_0x211c('0xa'),auth[_0x211c('0x7')](),controller[_0x211c('0xf')]);module[_0x211c('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index bb2d2d3..2db21b6 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x28111f,_0x254934){var _0x5203e6=function(_0x2c639a){while(--_0x2c639a){_0x28111f['push'](_0x28111f['shift']());}};_0x5203e6(++_0x254934);}(_0x54ef,0x112));var _0xf54e=function(_0x4416b7,_0x11d51c){_0x4416b7=_0x4416b7-0x0;var _0x9619e6=_0x54ef[_0x4416b7];return _0x9619e6;};'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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x26a716,_0xee412e){var _0x5db2e5=function(_0x71df64){while(--_0x71df64){_0x26a716['push'](_0x26a716['shift']());}};_0x5db2e5(++_0xee412e);}(_0xedd9,0xfc));var _0x9edd=function(_0x4a32b5,_0x29ad5e){_0x4a32b5=_0x4a32b5-0x0;var _0x184477=_0xedd9[_0x4a32b5];return _0x184477;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 6f44e18..a482886 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 _0xb77f=['key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','create','catch','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','squel','jsforce','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','undefined','count','limit','set','apply','reject','update','then','destroy','error','name','map','MailTransferReport','rawAttributes','fieldName','type'];(function(_0x5ebec4,_0x474731){var _0x3b9d3b=function(_0x3aa9da){while(--_0x3aa9da){_0x5ebec4['push'](_0x5ebec4['shift']());}};_0x3b9d3b(++_0x474731);}(_0xb77f,0x13d));var _0xfb77=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb77f[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xfb77('0x0'));var rimraf=require(_0xfb77('0x1'));var zipdir=require(_0xfb77('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfb77('0x3'));var moment=require(_0xfb77('0x4'));var BPromise=require(_0xfb77('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xfb77('0x6'));var csv=require(_0xfb77('0x7'));var ejs=require(_0xfb77('0x8'));var fs=require('fs');var fs_extra=require(_0xfb77('0x9'));var _=require('lodash');var squel=require(_0xfb77('0xa'));var crypto=require('crypto');var jsforce=require(_0xfb77('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfb77('0x7'));var querystring=require('querystring');var Papa=require(_0xfb77('0xc'));var Redis=require(_0xfb77('0xd'));var authService=require(_0xfb77('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfb77('0xf'));var hardwareService=require(_0xfb77('0x10'));var logger=require(_0xfb77('0x11'))(_0xfb77('0x12'));var utils=require('../../config/utils');var config=require(_0xfb77('0x13'));var licenseUtil=require(_0xfb77('0x14'));var db=require(_0xfb77('0x15'))['db'];function respondWithStatusCode(_0x4a0174,_0x482a50){_0x482a50=_0x482a50||0xcc;return function(_0x3a7379){if(_0x3a7379){return _0x4a0174[_0xfb77('0x16')](_0x482a50);}return _0x4a0174[_0xfb77('0x17')](_0x482a50)[_0xfb77('0x18')]();};}function respondWithResult(_0x407799,_0x464320){_0x464320=_0x464320||0xc8;return function(_0x23f76c){if(_0x23f76c){return _0x407799[_0xfb77('0x17')](_0x464320)[_0xfb77('0x19')](_0x23f76c);}};}function respondWithFilteredResult(_0x1797fb,_0x5a5a9e){return function(_0x5365fd){if(_0x5365fd){var _0x4c4c73=typeof _0x5a5a9e[_0xfb77('0x1a')]===_0xfb77('0x1b')&&typeof _0x5a5a9e['limit']===_0xfb77('0x1b');var _0x1ed328=_0x5365fd[_0xfb77('0x1c')];var _0x36b1d2=_0x4c4c73?0x0:_0x5a5a9e['offset'];var _0x4cfff8=_0x4c4c73?_0x5365fd[_0xfb77('0x1c')]:_0x5a5a9e[_0xfb77('0x1a')]+_0x5a5a9e[_0xfb77('0x1d')];var _0x248e07;if(_0x4cfff8>=_0x1ed328){_0x4cfff8=_0x1ed328;_0x248e07=0xc8;}else{_0x248e07=0xce;}_0x1797fb['status'](_0x248e07);return _0x1797fb[_0xfb77('0x1e')]('Content-Range',_0x36b1d2+'-'+_0x4cfff8+'/'+_0x1ed328)[_0xfb77('0x19')](_0x5365fd);}return null;};}function patchUpdates(_0x5815b0){return function(_0x4c1ae4){try{jsonpatch[_0xfb77('0x1f')](_0x4c1ae4,_0x5815b0,!![]);}catch(_0x4adb0d){return BPromise[_0xfb77('0x20')](_0x4adb0d);}return _0x4c1ae4['save']();};}function saveUpdates(_0x203db2,_0x1cfb90){return function(_0x43ad77){if(_0x43ad77){return _0x43ad77[_0xfb77('0x21')](_0x203db2)[_0xfb77('0x22')](function(_0x16a73c){return _0x16a73c;});}return null;};}function removeEntity(_0x482a41,_0x5f2b16){return function(_0x320014){if(_0x320014){return _0x320014[_0xfb77('0x23')]()[_0xfb77('0x22')](function(){_0x482a41[_0xfb77('0x17')](0xcc)[_0xfb77('0x18')]();});}};}function handleEntityNotFound(_0x2f7743,_0x5cf91d){return function(_0xfc192c){if(!_0xfc192c){_0x2f7743[_0xfb77('0x16')](0x194);}return _0xfc192c;};}function handleError(_0x549f7a,_0x4160f4){_0x4160f4=_0x4160f4||0x1f4;return function(_0x210582){logger[_0xfb77('0x24')](_0x210582['stack']);if(_0x210582['name']){delete _0x210582[_0xfb77('0x25')];}_0x549f7a[_0xfb77('0x17')](_0x4160f4)['send'](_0x210582);};}exports['index']=function(_0xee212c,_0x2c6b5c){var _0x2d12df={},_0x2bb9aa={},_0x411658={'count':0x0,'rows':[]};var _0x3efb49=_[_0xfb77('0x26')](db[_0xfb77('0x27')][_0xfb77('0x28')],function(_0x4bbe5e){return{'name':_0x4bbe5e[_0xfb77('0x29')],'type':_0x4bbe5e[_0xfb77('0x2a')][_0xfb77('0x2b')]};});_0x2bb9aa[_0xfb77('0x2c')]=_[_0xfb77('0x26')](_0x3efb49,_0xfb77('0x25'));_0x2bb9aa[_0xfb77('0x2d')]=_[_0xfb77('0x2e')](_0xee212c[_0xfb77('0x2d')]);_0x2bb9aa[_0xfb77('0x2f')]=_['intersection'](_0x2bb9aa[_0xfb77('0x2c')],_0x2bb9aa[_0xfb77('0x2d')]);_0x2d12df[_0xfb77('0x30')]=_[_0xfb77('0x31')](_0x2bb9aa[_0xfb77('0x2c')],qs[_0xfb77('0x32')](_0xee212c[_0xfb77('0x2d')][_0xfb77('0x32')]));_0x2d12df[_0xfb77('0x30')]=_0x2d12df['attributes'][_0xfb77('0x33')]?_0x2d12df[_0xfb77('0x30')]:_0x2bb9aa[_0xfb77('0x2c')];if(!_0xee212c['query'][_0xfb77('0x34')]('nolimit')){_0x2d12df[_0xfb77('0x1d')]=qs[_0xfb77('0x1d')](_0xee212c[_0xfb77('0x2d')][_0xfb77('0x1d')]);_0x2d12df['offset']=qs[_0xfb77('0x1a')](_0xee212c['query'][_0xfb77('0x1a')]);}_0x2d12df[_0xfb77('0x35')]=qs['sort'](_0xee212c['query'][_0xfb77('0x36')]);_0x2d12df[_0xfb77('0x37')]=qs[_0xfb77('0x2f')](_[_0xfb77('0x38')](_0xee212c[_0xfb77('0x2d')],_0x2bb9aa[_0xfb77('0x2f')]),_0x3efb49);if(_0xee212c[_0xfb77('0x2d')][_0xfb77('0x39')]){_0x2d12df[_0xfb77('0x37')]=_[_0xfb77('0x3a')](_0x2d12df[_0xfb77('0x37')],{'$or':_[_0xfb77('0x26')](_0x3efb49,function(_0x2a5bc7){if(_0x2a5bc7[_0xfb77('0x2a')]!==_0xfb77('0x3b')){var _0x169c1b={};_0x169c1b[_0x2a5bc7[_0xfb77('0x25')]]={'$like':'%'+_0xee212c[_0xfb77('0x2d')][_0xfb77('0x39')]+'%'};return _0x169c1b;}})});}_0x2d12df=_['merge']({},_0x2d12df,_0xee212c[_0xfb77('0x3c')]);var _0x3a0a63={'where':_0x2d12df[_0xfb77('0x37')]};return db[_0xfb77('0x27')]['count'](_0x3a0a63)['then'](function(_0x3f02dc){_0x411658[_0xfb77('0x1c')]=_0x3f02dc;if(_0xee212c['query']['includeAll']){_0x2d12df[_0xfb77('0x3d')]=[{'all':!![]}];}return db[_0xfb77('0x27')][_0xfb77('0x3e')](_0x2d12df);})[_0xfb77('0x22')](function(_0x3ff379){_0x411658[_0xfb77('0x3f')]=_0x3ff379;return _0x411658;})[_0xfb77('0x22')](respondWithFilteredResult(_0x2c6b5c,_0x2d12df))['catch'](handleError(_0x2c6b5c,null));};exports[_0xfb77('0x40')]=function(_0x397776,_0x420105){var _0x3c0a8c={'raw':!![],'where':{'id':_0x397776[_0xfb77('0x41')]['id']}},_0x5a1492={};_0x5a1492[_0xfb77('0x2c')]=_[_0xfb77('0x2e')](db[_0xfb77('0x27')][_0xfb77('0x28')]);_0x5a1492[_0xfb77('0x2d')]=_[_0xfb77('0x2e')](_0x397776[_0xfb77('0x2d')]);_0x5a1492['filters']=_[_0xfb77('0x31')](_0x5a1492['model'],_0x5a1492[_0xfb77('0x2d')]);_0x3c0a8c[_0xfb77('0x30')]=_[_0xfb77('0x31')](_0x5a1492[_0xfb77('0x2c')],qs['fields'](_0x397776[_0xfb77('0x2d')][_0xfb77('0x32')]));_0x3c0a8c[_0xfb77('0x30')]=_0x3c0a8c[_0xfb77('0x30')][_0xfb77('0x33')]?_0x3c0a8c[_0xfb77('0x30')]:_0x5a1492[_0xfb77('0x2c')];if(_0x397776[_0xfb77('0x2d')][_0xfb77('0x42')]){_0x3c0a8c[_0xfb77('0x3d')]=[{'all':!![]}];}_0x3c0a8c=_[_0xfb77('0x3a')]({},_0x3c0a8c,_0x397776[_0xfb77('0x3c')]);return db[_0xfb77('0x27')]['find'](_0x3c0a8c)[_0xfb77('0x22')](handleEntityNotFound(_0x420105,null))['then'](respondWithResult(_0x420105,null))['catch'](handleError(_0x420105,null));};exports['create']=function(_0x5cab17,_0x2fe5ff){return db[_0xfb77('0x27')][_0xfb77('0x43')](_0x5cab17['body'],{})['then'](respondWithResult(_0x2fe5ff,0xc9))[_0xfb77('0x44')](handleError(_0x2fe5ff,null));};exports[_0xfb77('0x21')]=function(_0x3d0c2e,_0x1063e1){if(_0x3d0c2e[_0xfb77('0x45')]['id']){delete _0x3d0c2e[_0xfb77('0x45')]['id'];}return db[_0xfb77('0x27')][_0xfb77('0x46')]({'where':{'id':_0x3d0c2e[_0xfb77('0x41')]['id']}})[_0xfb77('0x22')](handleEntityNotFound(_0x1063e1,null))[_0xfb77('0x22')](saveUpdates(_0x3d0c2e[_0xfb77('0x45')],null))[_0xfb77('0x22')](respondWithResult(_0x1063e1,null))[_0xfb77('0x44')](handleError(_0x1063e1,null));};exports[_0xfb77('0x23')]=function(_0x5b9570,_0x4a33a1){return db[_0xfb77('0x27')][_0xfb77('0x46')]({'where':{'id':_0x5b9570[_0xfb77('0x41')]['id']}})[_0xfb77('0x22')](handleEntityNotFound(_0x4a33a1,null))[_0xfb77('0x22')](removeEntity(_0x4a33a1,null))[_0xfb77('0x44')](handleError(_0x4a33a1,null));};exports[_0xfb77('0x47')]=function(_0x15b0d4,_0x482652){return db[_0xfb77('0x27')]['describe']()[_0xfb77('0x22')](respondWithResult(_0x482652,null))[_0xfb77('0x44')](handleError(_0x482652,null));}; \ No newline at end of file +var _0x0954=['MailTransferReport','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','destroy','describe','eml-format','rimraf','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','then','end','error','stack','name','send','index','map','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','type','VIRTUAL','merge','options','includeAll','include'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x0954,0x1b7));var _0x4095=function(_0x4347ec,_0x41c4b8){_0x4347ec=_0x4347ec-0x0;var _0x4c8314=_0x0954[_0x4347ec];return _0x4c8314;};'use strict';var emlformat=require(_0x4095('0x0'));var rimraf=require(_0x4095('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4095('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4095('0x3'));var sox=require(_0x4095('0x4'));var csv=require('to-csv');var ejs=require(_0x4095('0x5'));var fs=require('fs');var fs_extra=require(_0x4095('0x6'));var _=require(_0x4095('0x7'));var squel=require(_0x4095('0x8'));var crypto=require(_0x4095('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x4095('0xa'));var toCsv=require(_0x4095('0xb'));var querystring=require(_0x4095('0xc'));var Papa=require(_0x4095('0xd'));var Redis=require(_0x4095('0xe'));var authService=require(_0x4095('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4095('0x10'))('api');var utils=require(_0x4095('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x4095('0x12'));var db=require(_0x4095('0x13'))['db'];function respondWithStatusCode(_0x2c163f,_0x3ebd55){_0x3ebd55=_0x3ebd55||0xcc;return function(_0x3dd871){if(_0x3dd871){return _0x2c163f[_0x4095('0x14')](_0x3ebd55);}return _0x2c163f[_0x4095('0x15')](_0x3ebd55)['end']();};}function respondWithResult(_0x1ea65c,_0x54ddb8){_0x54ddb8=_0x54ddb8||0xc8;return function(_0x590351){if(_0x590351){return _0x1ea65c[_0x4095('0x15')](_0x54ddb8)[_0x4095('0x16')](_0x590351);}};}function respondWithFilteredResult(_0x5387b6,_0x56c322){return function(_0x170a61){if(_0x170a61){var _0x418538=typeof _0x56c322[_0x4095('0x17')]==='undefined'&&typeof _0x56c322[_0x4095('0x18')]==='undefined';var _0x502c86=_0x170a61[_0x4095('0x19')];var _0x871250=_0x418538?0x0:_0x56c322[_0x4095('0x17')];var _0x3b2e47=_0x418538?_0x170a61[_0x4095('0x19')]:_0x56c322[_0x4095('0x17')]+_0x56c322['limit'];var _0x1385e6;if(_0x3b2e47>=_0x502c86){_0x3b2e47=_0x502c86;_0x1385e6=0xc8;}else{_0x1385e6=0xce;}_0x5387b6[_0x4095('0x15')](_0x1385e6);return _0x5387b6[_0x4095('0x1a')](_0x4095('0x1b'),_0x871250+'-'+_0x3b2e47+'/'+_0x502c86)['json'](_0x170a61);}return null;};}function patchUpdates(_0x5212fb){return function(_0x4f227d){try{jsonpatch['apply'](_0x4f227d,_0x5212fb,!![]);}catch(_0x17254a){return BPromise['reject'](_0x17254a);}return _0x4f227d['save']();};}function saveUpdates(_0x2bce52,_0x4d37ec){return function(_0x50bf1b){if(_0x50bf1b){return _0x50bf1b['update'](_0x2bce52)['then'](function(_0x253594){return _0x253594;});}return null;};}function removeEntity(_0x40031d,_0x5a8ff4){return function(_0x54e9ba){if(_0x54e9ba){return _0x54e9ba['destroy']()[_0x4095('0x1c')](function(){_0x40031d['status'](0xcc)[_0x4095('0x1d')]();});}};}function handleEntityNotFound(_0x2abe7a,_0x380eb3){return function(_0x38421b){if(!_0x38421b){_0x2abe7a[_0x4095('0x14')](0x194);}return _0x38421b;};}function handleError(_0x171b28,_0x21b97a){_0x21b97a=_0x21b97a||0x1f4;return function(_0x35de7a){logger[_0x4095('0x1e')](_0x35de7a[_0x4095('0x1f')]);if(_0x35de7a[_0x4095('0x20')]){delete _0x35de7a['name'];}_0x171b28[_0x4095('0x15')](_0x21b97a)[_0x4095('0x21')](_0x35de7a);};}exports[_0x4095('0x22')]=function(_0x570595,_0x498b84){var _0x5ed5a9={},_0x333282={},_0x156f84={'count':0x0,'rows':[]};var _0x1a9ebb=_[_0x4095('0x23')](db['MailTransferReport']['rawAttributes'],function(_0x3c6298){return{'name':_0x3c6298[_0x4095('0x24')],'type':_0x3c6298['type'][_0x4095('0x25')]};});_0x333282[_0x4095('0x26')]=_[_0x4095('0x23')](_0x1a9ebb,_0x4095('0x20'));_0x333282[_0x4095('0x27')]=_[_0x4095('0x28')](_0x570595['query']);_0x333282['filters']=_[_0x4095('0x29')](_0x333282[_0x4095('0x26')],_0x333282['query']);_0x5ed5a9[_0x4095('0x2a')]=_[_0x4095('0x29')](_0x333282[_0x4095('0x26')],qs[_0x4095('0x2b')](_0x570595[_0x4095('0x27')][_0x4095('0x2b')]));_0x5ed5a9[_0x4095('0x2a')]=_0x5ed5a9[_0x4095('0x2a')][_0x4095('0x2c')]?_0x5ed5a9[_0x4095('0x2a')]:_0x333282['model'];if(!_0x570595[_0x4095('0x27')]['hasOwnProperty'](_0x4095('0x2d'))){_0x5ed5a9[_0x4095('0x18')]=qs[_0x4095('0x18')](_0x570595[_0x4095('0x27')]['limit']);_0x5ed5a9[_0x4095('0x17')]=qs[_0x4095('0x17')](_0x570595[_0x4095('0x27')][_0x4095('0x17')]);}_0x5ed5a9[_0x4095('0x2e')]=qs[_0x4095('0x2f')](_0x570595[_0x4095('0x27')][_0x4095('0x2f')]);_0x5ed5a9[_0x4095('0x30')]=qs['filters'](_[_0x4095('0x31')](_0x570595[_0x4095('0x27')],_0x333282[_0x4095('0x32')]),_0x1a9ebb);if(_0x570595[_0x4095('0x27')][_0x4095('0x33')]){_0x5ed5a9['where']=_['merge'](_0x5ed5a9[_0x4095('0x30')],{'$or':_['map'](_0x1a9ebb,function(_0x41532b){if(_0x41532b[_0x4095('0x34')]!==_0x4095('0x35')){var _0x5136ed={};_0x5136ed[_0x41532b[_0x4095('0x20')]]={'$like':'%'+_0x570595['query'][_0x4095('0x33')]+'%'};return _0x5136ed;}})});}_0x5ed5a9=_[_0x4095('0x36')]({},_0x5ed5a9,_0x570595[_0x4095('0x37')]);var _0x4b3caf={'where':_0x5ed5a9['where']};return db['MailTransferReport'][_0x4095('0x19')](_0x4b3caf)[_0x4095('0x1c')](function(_0x570ba7){_0x156f84[_0x4095('0x19')]=_0x570ba7;if(_0x570595[_0x4095('0x27')][_0x4095('0x38')]){_0x5ed5a9[_0x4095('0x39')]=[{'all':!![]}];}return db[_0x4095('0x3a')][_0x4095('0x3b')](_0x5ed5a9);})[_0x4095('0x1c')](function(_0x451a15){_0x156f84[_0x4095('0x3c')]=_0x451a15;return _0x156f84;})[_0x4095('0x1c')](respondWithFilteredResult(_0x498b84,_0x5ed5a9))[_0x4095('0x3d')](handleError(_0x498b84,null));};exports[_0x4095('0x3e')]=function(_0x66d70c,_0x3940c2){var _0x350ef2={'raw':!![],'where':{'id':_0x66d70c[_0x4095('0x3f')]['id']}},_0x386fc8={};_0x386fc8[_0x4095('0x26')]=_[_0x4095('0x28')](db[_0x4095('0x3a')][_0x4095('0x40')]);_0x386fc8[_0x4095('0x27')]=_[_0x4095('0x28')](_0x66d70c[_0x4095('0x27')]);_0x386fc8['filters']=_[_0x4095('0x29')](_0x386fc8[_0x4095('0x26')],_0x386fc8[_0x4095('0x27')]);_0x350ef2[_0x4095('0x2a')]=_['intersection'](_0x386fc8['model'],qs['fields'](_0x66d70c[_0x4095('0x27')]['fields']));_0x350ef2[_0x4095('0x2a')]=_0x350ef2[_0x4095('0x2a')][_0x4095('0x2c')]?_0x350ef2[_0x4095('0x2a')]:_0x386fc8[_0x4095('0x26')];if(_0x66d70c['query'][_0x4095('0x38')]){_0x350ef2[_0x4095('0x39')]=[{'all':!![]}];}_0x350ef2=_[_0x4095('0x36')]({},_0x350ef2,_0x66d70c['options']);return db[_0x4095('0x3a')][_0x4095('0x41')](_0x350ef2)[_0x4095('0x1c')](handleEntityNotFound(_0x3940c2,null))['then'](respondWithResult(_0x3940c2,null))[_0x4095('0x3d')](handleError(_0x3940c2,null));};exports[_0x4095('0x42')]=function(_0x51190e,_0x3c5952){return db[_0x4095('0x3a')][_0x4095('0x42')](_0x51190e[_0x4095('0x43')],{})[_0x4095('0x1c')](respondWithResult(_0x3c5952,0xc9))[_0x4095('0x3d')](handleError(_0x3c5952,null));};exports[_0x4095('0x44')]=function(_0x349326,_0x528b71){if(_0x349326[_0x4095('0x43')]['id']){delete _0x349326[_0x4095('0x43')]['id'];}return db[_0x4095('0x3a')]['find']({'where':{'id':_0x349326[_0x4095('0x3f')]['id']}})[_0x4095('0x1c')](handleEntityNotFound(_0x528b71,null))[_0x4095('0x1c')](saveUpdates(_0x349326[_0x4095('0x43')],null))[_0x4095('0x1c')](respondWithResult(_0x528b71,null))['catch'](handleError(_0x528b71,null));};exports[_0x4095('0x45')]=function(_0x55f51c,_0x4dd55a){return db[_0x4095('0x3a')][_0x4095('0x41')]({'where':{'id':_0x55f51c[_0x4095('0x3f')]['id']}})[_0x4095('0x1c')](handleEntityNotFound(_0x4dd55a,null))[_0x4095('0x1c')](removeEntity(_0x4dd55a,null))[_0x4095('0x3d')](handleError(_0x4dd55a,null));};exports['describe']=function(_0x34e88e,_0x35fc99){return db[_0x4095('0x3a')][_0x4095('0x46')]()[_0x4095('0x1c')](respondWithResult(_0x35fc99,null))[_0x4095('0x3d')](handleError(_0x35fc99,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index c91a45f..ccf2dc7 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 _0x289c=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid','lodash'];(function(_0x52c820,_0x81c4e2){var _0x1e9d87=function(_0x225934){while(--_0x225934){_0x52c820['push'](_0x52c820['shift']());}};_0x1e9d87(++_0x81c4e2);}(_0x289c,0x110));var _0xc289=function(_0xb1f6,_0x4db48b){_0xb1f6=_0xb1f6-0x0;var _0x702049=_0x289c[_0xb1f6];return _0x702049;};'use strict';var _=require(_0xc289('0x0'));var util=require(_0xc289('0x1'));var logger=require(_0xc289('0x2'))(_0xc289('0x3'));var moment=require('moment');var BPromise=require(_0xc289('0x4'));var rp=require(_0xc289('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc289('0x6'));var config=require(_0xc289('0x7'));var attributes=require(_0xc289('0x8'));module['exports']=function(_0x17573e,_0x15145c){return _0x17573e[_0xc289('0x9')](_0xc289('0xa'),attributes,{'tableName':_0xc289('0xb'),'paranoid':![],'indexes':[{'name':_0xc289('0xc'),'fields':[_0xc289('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd6d6=['request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x5f41ac,_0x3e4c64){var _0x396554=function(_0x15861b){while(--_0x15861b){_0x5f41ac['push'](_0x5f41ac['shift']());}};_0x396554(++_0x3e4c64);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x1d43d2,_0x52fb06){_0x1d43d2=_0x1d43d2-0x0;var _0x450cf7=_0xd6d6[_0x1d43d2];return _0x450cf7;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var moment=require('moment');var BPromise=require(_0x6d6d('0x4'));var rp=require(_0x6d6d('0x5'));var fs=require('fs');var path=require(_0x6d6d('0x6'));var rimraf=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var attributes=require(_0x6d6d('0x9'));module[_0x6d6d('0xa')]=function(_0x5702dc,_0x210ff7){return _0x5702dc[_0x6d6d('0xb')](_0x6d6d('0xc'),attributes,{'tableName':_0x6d6d('0xd'),'paranoid':![],'indexes':[{'name':_0x6d6d('0xe'),'fields':[_0x6d6d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index d4e8eaf..b0caf7d 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 _0x741a=['http','request','then','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client'];(function(_0x43f00e,_0x5abac8){var _0x4206ea=function(_0x5647b4){while(--_0x5647b4){_0x43f00e['push'](_0x43f00e['shift']());}};_0x4206ea(++_0x5abac8);}(_0x741a,0x7b));var _0xa741=function(_0x223a3e,_0x2da798){_0x223a3e=_0x223a3e-0x0;var _0x582005=_0x741a[_0x223a3e];return _0x582005;};'use strict';var _=require(_0xa741('0x0'));var util=require(_0xa741('0x1'));var moment=require(_0xa741('0x2'));var BPromise=require(_0xa741('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa741('0x4'));var db=require(_0xa741('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa741('0x6'));var jayson=require(_0xa741('0x7'));var client=jayson[_0xa741('0x8')][_0xa741('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37182c,_0x9b6033,_0x33be28){return new BPromise(function(_0x1e9c51,_0x183e10){return client[_0xa741('0xa')](_0x37182c,_0x33be28)[_0xa741('0xb')](function(_0x5b9529){logger['info'](_0xa741('0xc'),_0x9b6033,'request\x20sent');logger[_0xa741('0xd')](_0xa741('0xe'),_0x9b6033,_0xa741('0xf'),JSON[_0xa741('0x10')](_0x5b9529));if(_0x5b9529[_0xa741('0x11')]){if(_0x5b9529['error'][_0xa741('0x12')]===0x1f4){logger[_0xa741('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x9b6033,_0x5b9529['error'][_0xa741('0x13')]);return _0x183e10(_0x5b9529[_0xa741('0x11')]['message']);}logger[_0xa741('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x9b6033,_0x5b9529[_0xa741('0x11')][_0xa741('0x13')]);return _0x1e9c51(_0x5b9529[_0xa741('0x11')][_0xa741('0x13')]);}else{logger[_0xa741('0x14')]('MailTransferReport,\x20%s,\x20%s',_0x9b6033,_0xa741('0xf'));_0x1e9c51(_0x5b9529['result'][_0xa741('0x13')]);}})[_0xa741('0x15')](function(_0xae3701){logger[_0xa741('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x9b6033,_0xae3701);_0x183e10(_0xae3701);});});} \ No newline at end of file +var _0xd6ba=['client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x587693,_0x27fe90){var _0x510a1a=function(_0x290f71){while(--_0x290f71){_0x587693['push'](_0x587693['shift']());}};_0x510a1a(++_0x27fe90);}(_0xd6ba,0xe0));var _0xad6b=function(_0x1c253d,_0x21e2d9){_0x1c253d=_0x1c253d-0x0;var _0x3409ed=_0xd6ba[_0x1c253d];return _0x3409ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xad6b('0x0'));var BPromise=require(_0xad6b('0x1'));var rs=require(_0xad6b('0x2'));var fs=require('fs');var Redis=require(_0xad6b('0x3'));var db=require(_0xad6b('0x4'))['db'];var utils=require(_0xad6b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xad6b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xad6b('0x7')][_0xad6b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3eaf25,_0xd879e8,_0x3f586d){return new BPromise(function(_0x4859d0,_0x422a29){return client[_0xad6b('0x9')](_0x3eaf25,_0x3f586d)[_0xad6b('0xa')](function(_0x46f029){logger[_0xad6b('0xb')](_0xad6b('0xc'),_0xd879e8,_0xad6b('0xd'));logger[_0xad6b('0xe')](_0xad6b('0xf'),_0xd879e8,_0xad6b('0xd'),JSON[_0xad6b('0x10')](_0x46f029));if(_0x46f029['error']){if(_0x46f029[_0xad6b('0x11')]['code']===0x1f4){logger[_0xad6b('0x11')](_0xad6b('0xc'),_0xd879e8,_0x46f029['error'][_0xad6b('0x12')]);return _0x422a29(_0x46f029['error']['message']);}logger[_0xad6b('0x11')]('MailTransferReport,\x20%s,\x20%s',_0xd879e8,_0x46f029[_0xad6b('0x11')][_0xad6b('0x12')]);return _0x4859d0(_0x46f029[_0xad6b('0x11')][_0xad6b('0x12')]);}else{logger[_0xad6b('0xb')](_0xad6b('0xc'),_0xd879e8,_0xad6b('0xd'));_0x4859d0(_0x46f029[_0xad6b('0x13')][_0xad6b('0x12')]);}})[_0xad6b('0x14')](function(_0x5adf04){logger[_0xad6b('0x11')](_0xad6b('0xc'),_0xd879e8,_0x5adf04);_0x422a29(_0x5adf04);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index d1efd27..e4cdb2a 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 _0x0c35=['./memberReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x29b997,_0x3f7266){var _0x18fe58=function(_0x11ba28){while(--_0x11ba28){_0x29b997['push'](_0x29b997['shift']());}};_0x18fe58(++_0x3f7266);}(_0x0c35,0x161));var _0x50c3=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x0c35[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x50c3('0x0'));var util=require(_0x50c3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50c3('0x2'));var router=express[_0x50c3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x50c3('0x4'));var interaction=require(_0x50c3('0x5'));var config=require(_0x50c3('0x6'));var controller=require(_0x50c3('0x7'));router[_0x50c3('0x8')]('/',auth[_0x50c3('0x9')](),controller[_0x50c3('0xa')]);router[_0x50c3('0x8')](_0x50c3('0xb'),auth[_0x50c3('0x9')](),controller['describe']);router['get']('/:id',auth[_0x50c3('0x9')](),controller[_0x50c3('0xc')]);router[_0x50c3('0xd')]('/',auth[_0x50c3('0x9')](),controller[_0x50c3('0xe')]);router[_0x50c3('0xf')](_0x50c3('0x10'),auth[_0x50c3('0x9')](),controller['update']);router[_0x50c3('0x11')](_0x50c3('0x10'),auth[_0x50c3('0x9')](),controller[_0x50c3('0x12')]);module[_0x50c3('0x13')]=router; \ No newline at end of file +var _0x9ed9=['get','isAuthenticated','/describe','describe','/:id','show','post','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x421b46,_0x1f8d2b){var _0x1bc39e=function(_0x4122aa){while(--_0x4122aa){_0x421b46['push'](_0x421b46['shift']());}};_0x1bc39e(++_0x1f8d2b);}(_0x9ed9,0x13b));var _0x99ed=function(_0x3bd806,_0x310fc5){_0x3bd806=_0x3bd806-0x0;var _0x2c43fe=_0x9ed9[_0x3bd806];return _0x2c43fe;};'use strict';var multer=require(_0x99ed('0x0'));var util=require(_0x99ed('0x1'));var path=require('path');var timeout=require(_0x99ed('0x2'));var express=require(_0x99ed('0x3'));var router=express[_0x99ed('0x4')]();var fs_extra=require(_0x99ed('0x5'));var auth=require(_0x99ed('0x6'));var interaction=require(_0x99ed('0x7'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0x99ed('0x8')]('/',auth[_0x99ed('0x9')](),controller['index']);router[_0x99ed('0x8')](_0x99ed('0xa'),auth[_0x99ed('0x9')](),controller[_0x99ed('0xb')]);router[_0x99ed('0x8')](_0x99ed('0xc'),auth[_0x99ed('0x9')](),controller[_0x99ed('0xd')]);router[_0x99ed('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x99ed('0xf')]('/:id',auth[_0x99ed('0x9')](),controller[_0x99ed('0x10')]);router[_0x99ed('0x11')](_0x99ed('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x99ed('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index cd02fc2..d07187d 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 _0x74f0=['talk:[dial\x20string]','talk:[queue]','INTEGER','moment','STRING','DEFAULT\x20PAUSE','DATE','getDataValue','enterAt','diff','seconds','exitAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]'];(function(_0x5756f8,_0x22b6d5){var _0x3bb749=function(_0x332204){while(--_0x332204){_0x5756f8['push'](_0x5756f8['shift']());}};_0x3bb749(++_0x22b6d5);}(_0x74f0,0xf3));var _0x074f=function(_0x2298f0,_0x3bbf4f){_0x2298f0=_0x2298f0-0x0;var _0x39b136=_0x74f0[_0x2298f0];return _0x39b136;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x074f('0x0'));module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x074f('0x1')]},'interface':{'type':Sequelize[_0x074f('0x1')]},'type':{'type':Sequelize[_0x074f('0x1')],'defaultValue':_0x074f('0x2'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x074f('0x3')]},'exitAt':{'type':Sequelize[_0x074f('0x3')],'set':function(_0x203f47){var _0x126607=moment(_0x203f47);var _0x10b244=moment(this[_0x074f('0x4')](_0x074f('0x5')));var _0x547297=_0x126607[_0x074f('0x6')](_0x10b244,_0x074f('0x7'));this['setDataValue'](_0x074f('0x8'),_0x203f47);this[_0x074f('0x9')](_0x074f('0xa'),_0x547297||null);}},'data1':{'type':Sequelize[_0x074f('0x1')],'comment':_0x074f('0xb')},'data2':{'type':Sequelize['STRING'],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x074f('0x1')],'comment':_0x074f('0xc')},'data4':{'type':Sequelize[_0x074f('0x1')],'comment':_0x074f('0xd')},'data5':{'type':Sequelize[_0x074f('0x1')],'comment':_0x074f('0xe')},'role':{'type':Sequelize[_0x074f('0x1')]},'internal':{'type':Sequelize[_0x074f('0xf')]},'uniqueid':{'type':Sequelize[_0x074f('0x1')]}}; \ No newline at end of file +var _0x3cfb=['setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3cfb,0x1b8));var _0xb3cf=function(_0x47b0bd,_0x4abdb6){_0x47b0bd=_0x47b0bd-0x0;var _0x183b0b=_0x3cfb[_0x47b0bd];return _0x183b0b;};'use strict';var Sequelize=require(_0xb3cf('0x0'));var moment=require(_0xb3cf('0x1'));module[_0xb3cf('0x2')]={'channel':{'type':Sequelize[_0xb3cf('0x3')]},'membername':{'type':Sequelize[_0xb3cf('0x3')]},'interface':{'type':Sequelize[_0xb3cf('0x3')]},'type':{'type':Sequelize[_0xb3cf('0x3')],'defaultValue':_0xb3cf('0x4'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xb3cf('0x5')]},'enterAt':{'type':Sequelize[_0xb3cf('0x6')]},'exitAt':{'type':Sequelize[_0xb3cf('0x6')],'set':function(_0x59c604){var _0x2e5c00=moment(_0x59c604);var _0x1b7131=moment(this[_0xb3cf('0x7')]('enterAt'));var _0x19ed7d=_0x2e5c00['diff'](_0x1b7131,'seconds');this[_0xb3cf('0x8')](_0xb3cf('0x9'),_0x59c604);this[_0xb3cf('0x8')](_0xb3cf('0xa'),_0x19ed7d||null);}},'data1':{'type':Sequelize[_0xb3cf('0x3')],'comment':_0xb3cf('0xb')},'data2':{'type':Sequelize[_0xb3cf('0x3')],'comment':_0xb3cf('0xc')},'data3':{'type':Sequelize[_0xb3cf('0x3')],'comment':_0xb3cf('0xd')},'data4':{'type':Sequelize[_0xb3cf('0x3')],'comment':_0xb3cf('0xe')},'data5':{'type':Sequelize[_0xb3cf('0x3')],'comment':_0xb3cf('0xf')},'role':{'type':Sequelize[_0xb3cf('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 19055cc..10c3cdb 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 _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x58965a,_0x2e71db){var _0x254efc=function(_0xf14fb4){while(--_0xf14fb4){_0x58965a['push'](_0x58965a['shift']());}};_0x254efc(++_0x2e71db);}(_0x34e8,0x12c));var _0x834e=function(_0x456b8f,_0x27a95b){_0x456b8f=_0x456b8f-0x0;var _0x2a354e=_0x34e8[_0x456b8f];return _0x2a354e;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file +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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x55ca,0x126));var _0xa55c=function(_0x1261c2,_0x3ef819){_0x1261c2=_0x1261c2-0x0;var _0x3aabd2=_0x55ca[_0x1261c2];return _0x3aabd2;};'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 9b04b80..44daf93 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 _0x89a1=['exports','define','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes'];(function(_0x21895f,_0x1cd21e){var _0x13fcf0=function(_0x1e9197){while(--_0x1e9197){_0x21895f['push'](_0x21895f['shift']());}};_0x13fcf0(++_0x1cd21e);}(_0x89a1,0x1db));var _0x189a=function(_0x3b51e6,_0x1d683c){_0x3b51e6=_0x3b51e6-0x0;var _0x1615cd=_0x89a1[_0x3b51e6];return _0x1615cd;};'use strict';var _=require(_0x189a('0x0'));var util=require(_0x189a('0x1'));var logger=require(_0x189a('0x2'))(_0x189a('0x3'));var moment=require(_0x189a('0x4'));var BPromise=require(_0x189a('0x5'));var rp=require(_0x189a('0x6'));var fs=require('fs');var path=require(_0x189a('0x7'));var rimraf=require(_0x189a('0x8'));var config=require(_0x189a('0x9'));var attributes=require(_0x189a('0xa'));module[_0x189a('0xb')]=function(_0x46f95c,_0xcfdbdc){return _0x46f95c[_0x189a('0xc')](_0x189a('0xd'),attributes,{'tableName':_0x189a('0xe'),'paranoid':![],'indexes':[{'name':_0x189a('0xf'),'fields':[_0x189a('0x10'),_0x189a('0x11')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1666=['../../config/environment','define','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x5393a6,_0x3c972d){var _0x477463=function(_0x5d6f37){while(--_0x5d6f37){_0x5393a6['push'](_0x5393a6['shift']());}};_0x477463(++_0x3c972d);}(_0x1666,0x133));var _0x6166=function(_0x14c7c3,_0x39cd23){_0x14c7c3=_0x14c7c3-0x0;var _0x1e0350=_0x1666[_0x14c7c3];return _0x1e0350;};'use strict';var _=require(_0x6166('0x0'));var util=require(_0x6166('0x1'));var logger=require(_0x6166('0x2'))(_0x6166('0x3'));var moment=require(_0x6166('0x4'));var BPromise=require('bluebird');var rp=require(_0x6166('0x5'));var fs=require('fs');var path=require(_0x6166('0x6'));var rimraf=require(_0x6166('0x7'));var config=require(_0x6166('0x8'));var attributes=require('./memberReport.attributes');module['exports']=function(_0x945f31,_0x154ac2){return _0x945f31[_0x6166('0x9')](_0x6166('0xa'),attributes,{'tableName':_0x6166('0xb'),'paranoid':![],'indexes':[{'name':_0x6166('0xc'),'fields':[_0x6166('0xd'),_0x6166('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index d4fcf1c..4dbeb2a 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 _0x1298=['raw','options','where','attributes','limit','map','include','model','info','GetMemberReport','catch','CreateMemberReport','create','then','stringify','update','body','UpdateMemberReport','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','request\x20sent','debug','error','MemberReport,\x20%s,\x20%s','message','MemberReport','findAll'];(function(_0x41cad2,_0x5bc021){var _0x459ea8=function(_0x33b629){while(--_0x33b629){_0x41cad2['push'](_0x41cad2['shift']());}};_0x459ea8(++_0x5bc021);}(_0x1298,0x19e));var _0x8129=function(_0x493f7e,_0x15453d){_0x493f7e=_0x493f7e-0x0;var _0x4982e2=_0x1298[_0x493f7e];return _0x4982e2;};'use strict';var _=require('lodash');var util=require(_0x8129('0x0'));var moment=require('moment');var BPromise=require(_0x8129('0x1'));var rs=require(_0x8129('0x2'));var fs=require('fs');var Redis=require(_0x8129('0x3'));var db=require(_0x8129('0x4'))['db'];var utils=require(_0x8129('0x5'));var logger=require(_0x8129('0x6'))(_0x8129('0x7'));var config=require('../../config/environment');var jayson=require(_0x8129('0x8'));var client=jayson[_0x8129('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f0a40,_0x1cd6a6,_0x2d07d5){return new BPromise(function(_0x3ff6e0,_0x3d94f8){return client[_0x8129('0xa')](_0x4f0a40,_0x2d07d5)['then'](function(_0x5a0545){logger['info']('MemberReport,\x20%s,\x20%s',_0x1cd6a6,_0x8129('0xb'));logger[_0x8129('0xc')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x1cd6a6,_0x8129('0xb'),JSON['stringify'](_0x5a0545));if(_0x5a0545['error']){if(_0x5a0545[_0x8129('0xd')]['code']===0x1f4){logger['error'](_0x8129('0xe'),_0x1cd6a6,_0x5a0545[_0x8129('0xd')][_0x8129('0xf')]);return _0x3d94f8(_0x5a0545[_0x8129('0xd')][_0x8129('0xf')]);}logger[_0x8129('0xd')]('MemberReport,\x20%s,\x20%s',_0x1cd6a6,_0x5a0545['error'][_0x8129('0xf')]);return _0x3ff6e0(_0x5a0545['error'][_0x8129('0xf')]);}else{logger['info'](_0x8129('0xe'),_0x1cd6a6,_0x8129('0xb'));_0x3ff6e0(_0x5a0545['result'][_0x8129('0xf')]);}})['catch'](function(_0x3b15ac){logger[_0x8129('0xd')](_0x8129('0xe'),_0x1cd6a6,_0x3b15ac);_0x3d94f8(_0x3b15ac);});});}exports['GetMemberReport']=function(_0x17e742){var _0x1ec668=this;return new Promise(function(_0x21c6c2,_0x1a5940){return db[_0x8129('0x10')][_0x8129('0x11')]({'raw':_0x17e742['options']?_0x17e742['options'][_0x8129('0x12')]===undefined?!![]:![]:!![],'where':_0x17e742['options']?_0x17e742[_0x8129('0x13')][_0x8129('0x14')]||null:null,'attributes':_0x17e742[_0x8129('0x13')]?_0x17e742[_0x8129('0x13')][_0x8129('0x15')]||null:null,'limit':_0x17e742[_0x8129('0x13')]?_0x17e742[_0x8129('0x13')][_0x8129('0x16')]||null:null,'include':_0x17e742[_0x8129('0x13')]?_0x17e742[_0x8129('0x13')]['include']?_[_0x8129('0x17')](_0x17e742[_0x8129('0x13')][_0x8129('0x18')],function(_0x322f63){return{'model':db[_0x322f63['model']],'as':_0x322f63['as'],'attributes':_0x322f63[_0x8129('0x15')],'include':_0x322f63[_0x8129('0x18')]?_['map'](_0x322f63[_0x8129('0x18')],function(_0x58a641){return{'model':db[_0x58a641[_0x8129('0x19')]],'as':_0x58a641['as'],'attributes':_0x58a641[_0x8129('0x15')],'include':_0x58a641[_0x8129('0x18')]?_['map'](_0x58a641[_0x8129('0x18')],function(_0x3a37c0){return{'model':db[_0x3a37c0[_0x8129('0x19')]],'as':_0x3a37c0['as'],'attributes':_0x3a37c0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e4512){logger[_0x8129('0x1a')]('GetMemberReport',_0x17e742);logger[_0x8129('0xc')](_0x8129('0x1b'),_0x17e742,JSON['stringify'](_0x2e4512));_0x21c6c2(_0x2e4512);})[_0x8129('0x1c')](function(_0x1956ae){logger['error'](_0x8129('0x1b'),_0x1956ae[_0x8129('0xf')],_0x17e742);_0x1a5940(_0x1ec668[_0x8129('0xd')](0x1f4,_0x1956ae[_0x8129('0xf')]));});});};exports[_0x8129('0x1d')]=function(_0x1e48b8){var _0x3708e3=this;return new Promise(function(_0x403d04,_0x2a6f89){return db[_0x8129('0x10')][_0x8129('0x1e')](_0x1e48b8['body'],{'raw':_0x1e48b8['options']?_0x1e48b8[_0x8129('0x13')][_0x8129('0x12')]===undefined?!![]:![]:!![]})[_0x8129('0x1f')](function(_0x3d55d3){logger['info'](_0x8129('0x1d'),_0x1e48b8);logger[_0x8129('0xc')](_0x8129('0x1d'),_0x1e48b8,JSON[_0x8129('0x20')](_0x3d55d3));_0x403d04(_0x3d55d3);})[_0x8129('0x1c')](function(_0x4cbd50){logger['error'](_0x8129('0x1d'),_0x4cbd50[_0x8129('0xf')],_0x1e48b8);_0x2a6f89(_0x3708e3[_0x8129('0xd')](0x1f4,_0x4cbd50[_0x8129('0xf')]));});});};exports['UpdateMemberReport']=function(_0x54fd3c){var _0x1d0632=this;return new Promise(function(_0x4fadbc,_0x23d0d8){return db[_0x8129('0x10')][_0x8129('0x21')](_0x54fd3c[_0x8129('0x22')],{'raw':_0x54fd3c[_0x8129('0x13')]?_0x54fd3c[_0x8129('0x13')][_0x8129('0x12')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54fd3c[_0x8129('0x13')]?_0x54fd3c['options'][_0x8129('0x14')]||null:null,'attributes':_0x54fd3c[_0x8129('0x13')]?_0x54fd3c['options']['attributes']||null:null,'limit':_0x54fd3c['options']?_0x54fd3c[_0x8129('0x13')][_0x8129('0x16')]||null:null})[_0x8129('0x1f')](function(_0x55d7af){logger[_0x8129('0x1a')]('UpdateMemberReport',_0x54fd3c);logger[_0x8129('0xc')](_0x8129('0x23'),_0x54fd3c,JSON[_0x8129('0x20')](_0x55d7af));_0x4fadbc(_0x55d7af);})[_0x8129('0x1c')](function(_0x8ecd42){logger['error'](_0x8129('0x23'),_0x8ecd42[_0x8129('0xf')],_0x54fd3c);_0x23d0d8(_0x1d0632[_0x8129('0xd')](0x1f4,_0x8ecd42[_0x8129('0xf')]));});});}; \ No newline at end of file +var _0x0272=['request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','findAll','options','raw','where','attributes','limit','include','model','map','then','CreateMemberReport','MemberReport','create','UpdateMemberReport','update','body','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','MemberReport,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0272,0x15a));var _0x2027=function(_0x730fb1,_0x5122f3){_0x730fb1=_0x730fb1-0x0;var _0x4b2c2d=_0x0272[_0x730fb1];return _0x4b2c2d;};'use strict';var _=require(_0x2027('0x0'));var util=require(_0x2027('0x1'));var moment=require('moment');var BPromise=require(_0x2027('0x2'));var rs=require(_0x2027('0x3'));var fs=require('fs');var Redis=require(_0x2027('0x4'));var db=require(_0x2027('0x5'))['db'];var utils=require(_0x2027('0x6'));var logger=require(_0x2027('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2027('0x8'));var client=jayson[_0x2027('0x9')][_0x2027('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54a8f1,_0x5cd8f3,_0x56c261){return new BPromise(function(_0x2ac3bd,_0x4eb86c){return client[_0x2027('0xb')](_0x54a8f1,_0x56c261)['then'](function(_0x2f549d){logger[_0x2027('0xc')](_0x2027('0xd'),_0x5cd8f3,_0x2027('0xe'));logger['debug'](_0x2027('0xf'),_0x5cd8f3,_0x2027('0xe'),JSON[_0x2027('0x10')](_0x2f549d));if(_0x2f549d[_0x2027('0x11')]){if(_0x2f549d[_0x2027('0x11')][_0x2027('0x12')]===0x1f4){logger['error'](_0x2027('0xd'),_0x5cd8f3,_0x2f549d[_0x2027('0x11')]['message']);return _0x4eb86c(_0x2f549d[_0x2027('0x11')][_0x2027('0x13')]);}logger[_0x2027('0x11')](_0x2027('0xd'),_0x5cd8f3,_0x2f549d['error'][_0x2027('0x13')]);return _0x2ac3bd(_0x2f549d['error'][_0x2027('0x13')]);}else{logger[_0x2027('0xc')](_0x2027('0xd'),_0x5cd8f3,_0x2027('0xe'));_0x2ac3bd(_0x2f549d[_0x2027('0x14')][_0x2027('0x13')]);}})[_0x2027('0x15')](function(_0x4e8bc8){logger[_0x2027('0x11')](_0x2027('0xd'),_0x5cd8f3,_0x4e8bc8);_0x4eb86c(_0x4e8bc8);});});}exports[_0x2027('0x16')]=function(_0x532a2c){var _0x3bd053=this;return new Promise(function(_0x5d47bf,_0x28092f){return db['MemberReport'][_0x2027('0x17')]({'raw':_0x532a2c[_0x2027('0x18')]?_0x532a2c[_0x2027('0x18')][_0x2027('0x19')]===undefined?!![]:![]:!![],'where':_0x532a2c['options']?_0x532a2c[_0x2027('0x18')][_0x2027('0x1a')]||null:null,'attributes':_0x532a2c[_0x2027('0x18')]?_0x532a2c['options'][_0x2027('0x1b')]||null:null,'limit':_0x532a2c[_0x2027('0x18')]?_0x532a2c[_0x2027('0x18')][_0x2027('0x1c')]||null:null,'include':_0x532a2c['options']?_0x532a2c[_0x2027('0x18')]['include']?_['map'](_0x532a2c[_0x2027('0x18')][_0x2027('0x1d')],function(_0x462ff){return{'model':db[_0x462ff['model']],'as':_0x462ff['as'],'attributes':_0x462ff['attributes'],'include':_0x462ff[_0x2027('0x1d')]?_['map'](_0x462ff[_0x2027('0x1d')],function(_0x250775){return{'model':db[_0x250775[_0x2027('0x1e')]],'as':_0x250775['as'],'attributes':_0x250775[_0x2027('0x1b')],'include':_0x250775[_0x2027('0x1d')]?_[_0x2027('0x1f')](_0x250775[_0x2027('0x1d')],function(_0x49f9f8){return{'model':db[_0x49f9f8[_0x2027('0x1e')]],'as':_0x49f9f8['as'],'attributes':_0x49f9f8[_0x2027('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2027('0x20')](function(_0x47b184){logger['info'](_0x2027('0x16'),_0x532a2c);logger['debug'](_0x2027('0x16'),_0x532a2c,JSON['stringify'](_0x47b184));_0x5d47bf(_0x47b184);})['catch'](function(_0x36f98d){logger[_0x2027('0x11')](_0x2027('0x16'),_0x36f98d[_0x2027('0x13')],_0x532a2c);_0x28092f(_0x3bd053[_0x2027('0x11')](0x1f4,_0x36f98d[_0x2027('0x13')]));});});};exports[_0x2027('0x21')]=function(_0x3b1bbd){var _0x510fc0=this;return new Promise(function(_0x2fe2a6,_0x3ae017){return db[_0x2027('0x22')][_0x2027('0x23')](_0x3b1bbd['body'],{'raw':_0x3b1bbd['options']?_0x3b1bbd[_0x2027('0x18')][_0x2027('0x19')]===undefined?!![]:![]:!![]})[_0x2027('0x20')](function(_0x320e52){logger[_0x2027('0xc')]('CreateMemberReport',_0x3b1bbd);logger['debug'](_0x2027('0x21'),_0x3b1bbd,JSON['stringify'](_0x320e52));_0x2fe2a6(_0x320e52);})[_0x2027('0x15')](function(_0x35b562){logger[_0x2027('0x11')](_0x2027('0x21'),_0x35b562[_0x2027('0x13')],_0x3b1bbd);_0x3ae017(_0x510fc0['error'](0x1f4,_0x35b562[_0x2027('0x13')]));});});};exports[_0x2027('0x24')]=function(_0xfa5977){var _0x4a6fb7=this;return new Promise(function(_0x2fcf0e,_0x4c9ed0){return db['MemberReport'][_0x2027('0x25')](_0xfa5977[_0x2027('0x26')],{'raw':_0xfa5977[_0x2027('0x18')]?_0xfa5977[_0x2027('0x18')][_0x2027('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfa5977['options']?_0xfa5977['options'][_0x2027('0x1a')]||null:null,'attributes':_0xfa5977[_0x2027('0x18')]?_0xfa5977[_0x2027('0x18')][_0x2027('0x1b')]||null:null,'limit':_0xfa5977['options']?_0xfa5977['options'][_0x2027('0x1c')]||null:null})[_0x2027('0x20')](function(_0x4eaaaa){logger[_0x2027('0xc')](_0x2027('0x24'),_0xfa5977);logger[_0x2027('0x27')](_0x2027('0x24'),_0xfa5977,JSON[_0x2027('0x10')](_0x4eaaaa));_0x2fcf0e(_0x4eaaaa);})[_0x2027('0x15')](function(_0x1239b6){logger[_0x2027('0x11')](_0x2027('0x24'),_0x1239b6[_0x2027('0x13')],_0xfa5977);_0x4c9ed0(_0x4a6fb7['error'](0x1f4,_0x1239b6[_0x2027('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 0364571..eaa13c7 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 _0x5f2b=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','multer','util'];(function(_0x10fb07,_0xf1ac7c){var _0x350f36=function(_0x3c27b0){while(--_0x3c27b0){_0x10fb07['push'](_0x10fb07['shift']());}};_0x350f36(++_0xf1ac7c);}(_0x5f2b,0x17a));var _0xb5f2=function(_0x272f85,_0x49e3e7){_0x272f85=_0x272f85-0x0;var _0x46eef4=_0x5f2b[_0x272f85];return _0x46eef4;};'use strict';var multer=require(_0xb5f2('0x0'));var util=require(_0xb5f2('0x1'));var path=require(_0xb5f2('0x2'));var timeout=require(_0xb5f2('0x3'));var express=require(_0xb5f2('0x4'));var router=express['Router']();var fs_extra=require(_0xb5f2('0x5'));var auth=require(_0xb5f2('0x6'));var interaction=require(_0xb5f2('0x7'));var config=require(_0xb5f2('0x8'));var controller=require('./migration.controller');router['get']('/',controller[_0xb5f2('0x9')]);module['exports']=router; \ No newline at end of file +var _0x7d6a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4bf17a,_0x24d74c){var _0xe22657=function(_0x3e8cca){while(--_0x3e8cca){_0x4bf17a['push'](_0x4bf17a['shift']());}};_0xe22657(++_0x24d74c);}(_0x7d6a,0xf6));var _0xa7d6=function(_0x46db16,_0x47e975){_0x46db16=_0x46db16-0x0;var _0x33b318=_0x7d6a[_0x46db16];return _0x33b318;};'use strict';var multer=require(_0xa7d6('0x0'));var util=require(_0xa7d6('0x1'));var path=require(_0xa7d6('0x2'));var timeout=require(_0xa7d6('0x3'));var express=require(_0xa7d6('0x4'));var router=express[_0xa7d6('0x5')]();var fs_extra=require(_0xa7d6('0x6'));var auth=require(_0xa7d6('0x7'));var interaction=require(_0xa7d6('0x8'));var config=require(_0xa7d6('0x9'));var controller=require(_0xa7d6('0xa'));router['get']('/',controller['index']);module[_0xa7d6('0xb')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 1482035..28894d5 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 _0x832e=['STRING','version','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x832e,0xd7));var _0xe832=function(_0x57060f,_0x4925c1){_0x57060f=_0x57060f-0x0;var _0xb59942=_0x832e[_0x57060f];return _0xb59942;};'use strict';var Sequelize=require(_0xe832('0x0'));module['exports']={'version':{'type':Sequelize[_0xe832('0x1')],'unique':_0xe832('0x2')}}; \ No newline at end of file +var _0x1d81=['sequelize','version'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d81,0x134));var _0x11d8=function(_0x1dab5f,_0x10cd21){_0x1dab5f=_0x1dab5f-0x0;var _0x40c2f3=_0x1d81[_0x1dab5f];return _0x40c2f3;};'use strict';var Sequelize=require(_0x11d8('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0x11d8('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index ad66be6..d3d63ea 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 _0x0503=['type','key','model','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Migration','then','includeAll','catch','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','map','rawAttributes','fieldName'];(function(_0x501d22,_0x442483){var _0x4681ec=function(_0x30adc7){while(--_0x30adc7){_0x501d22['push'](_0x501d22['shift']());}};_0x4681ec(++_0x442483);}(_0x0503,0xa3));var _0x3050=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x0503[_0x5f0089];return _0x193892;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3050('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3050('0x1'));var moment=require(_0x3050('0x2'));var BPromise=require(_0x3050('0x3'));var Mustache=require(_0x3050('0x4'));var util=require(_0x3050('0x5'));var path=require(_0x3050('0x6'));var sox=require(_0x3050('0x7'));var csv=require(_0x3050('0x8'));var ejs=require(_0x3050('0x9'));var fs=require('fs');var fs_extra=require(_0x3050('0xa'));var _=require('lodash');var squel=require(_0x3050('0xb'));var crypto=require(_0x3050('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3050('0xd'));var toCsv=require(_0x3050('0x8'));var querystring=require(_0x3050('0xe'));var Papa=require('papaparse');var Redis=require(_0x3050('0xf'));var authService=require(_0x3050('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3050('0x11'));var hardwareService=require(_0x3050('0x12'));var logger=require(_0x3050('0x13'))(_0x3050('0x14'));var utils=require(_0x3050('0x15'));var config=require(_0x3050('0x16'));var licenseUtil=require(_0x3050('0x17'));var db=require(_0x3050('0x18'))['db'];function respondWithStatusCode(_0x2c9d4a,_0x25d5c1){_0x25d5c1=_0x25d5c1||0xcc;return function(_0x5d794){if(_0x5d794){return _0x2c9d4a[_0x3050('0x19')](_0x25d5c1);}return _0x2c9d4a[_0x3050('0x1a')](_0x25d5c1)[_0x3050('0x1b')]();};}function respondWithResult(_0x12d707,_0x291c78){_0x291c78=_0x291c78||0xc8;return function(_0x453f30){if(_0x453f30){return _0x12d707[_0x3050('0x1a')](_0x291c78)[_0x3050('0x1c')](_0x453f30);}};}function respondWithFilteredResult(_0x4a4e50,_0x5e5768){return function(_0xa63a78){if(_0xa63a78){var _0x2a8784=typeof _0x5e5768['offset']===_0x3050('0x1d')&&typeof _0x5e5768[_0x3050('0x1e')]===_0x3050('0x1d');var _0x3cacb4=_0xa63a78['count'];var _0x42b273=_0x2a8784?0x0:_0x5e5768[_0x3050('0x1f')];var _0x10989d=_0x2a8784?_0xa63a78[_0x3050('0x20')]:_0x5e5768[_0x3050('0x1f')]+_0x5e5768[_0x3050('0x1e')];var _0x28f7a5;if(_0x10989d>=_0x3cacb4){_0x10989d=_0x3cacb4;_0x28f7a5=0xc8;}else{_0x28f7a5=0xce;}_0x4a4e50[_0x3050('0x1a')](_0x28f7a5);return _0x4a4e50[_0x3050('0x21')](_0x3050('0x22'),_0x42b273+'-'+_0x10989d+'/'+_0x3cacb4)[_0x3050('0x1c')](_0xa63a78);}return null;};}function patchUpdates(_0x2fa910){return function(_0x1ceb55){try{jsonpatch[_0x3050('0x23')](_0x1ceb55,_0x2fa910,!![]);}catch(_0x2f5276){return BPromise[_0x3050('0x24')](_0x2f5276);}return _0x1ceb55[_0x3050('0x25')]();};}function saveUpdates(_0x421679,_0x1a6bee){return function(_0x5d42d7){if(_0x5d42d7){return _0x5d42d7[_0x3050('0x26')](_0x421679)['then'](function(_0xddf3c){return _0xddf3c;});}return null;};}function removeEntity(_0x1a6061,_0x23243f){return function(_0x3c0eaf){if(_0x3c0eaf){return _0x3c0eaf[_0x3050('0x27')]()['then'](function(){_0x1a6061[_0x3050('0x1a')](0xcc)[_0x3050('0x1b')]();});}};}function handleEntityNotFound(_0x34c11d,_0x453b56){return function(_0x1a94b5){if(!_0x1a94b5){_0x34c11d['sendStatus'](0x194);}return _0x1a94b5;};}function handleError(_0x2ed27c,_0x51ec60){_0x51ec60=_0x51ec60||0x1f4;return function(_0x102af8){logger[_0x3050('0x28')](_0x102af8[_0x3050('0x29')]);if(_0x102af8[_0x3050('0x2a')]){delete _0x102af8[_0x3050('0x2a')];}_0x2ed27c[_0x3050('0x1a')](_0x51ec60)[_0x3050('0x2b')](_0x102af8);};}exports['index']=function(_0x32b1a9,_0x474f22){var _0x216763={},_0x104119={},_0x59b6a1={'count':0x0,'rows':[]};var _0x53a346=_[_0x3050('0x2c')](db['Migration'][_0x3050('0x2d')],function(_0x10ffdc){return{'name':_0x10ffdc[_0x3050('0x2e')],'type':_0x10ffdc[_0x3050('0x2f')][_0x3050('0x30')]};});_0x104119[_0x3050('0x31')]=_[_0x3050('0x2c')](_0x53a346,_0x3050('0x2a'));_0x104119['query']=_['keys'](_0x32b1a9['query']);_0x104119['filters']=_[_0x3050('0x32')](_0x104119[_0x3050('0x31')],_0x104119[_0x3050('0x33')]);_0x216763[_0x3050('0x34')]=_[_0x3050('0x32')](_0x104119[_0x3050('0x31')],qs[_0x3050('0x35')](_0x32b1a9[_0x3050('0x33')]['fields']));_0x216763[_0x3050('0x34')]=_0x216763[_0x3050('0x34')][_0x3050('0x36')]?_0x216763[_0x3050('0x34')]:_0x104119['model'];if(!_0x32b1a9[_0x3050('0x33')][_0x3050('0x37')](_0x3050('0x38'))){_0x216763[_0x3050('0x1e')]=qs[_0x3050('0x1e')](_0x32b1a9[_0x3050('0x33')][_0x3050('0x1e')]);_0x216763[_0x3050('0x1f')]=qs['offset'](_0x32b1a9[_0x3050('0x33')][_0x3050('0x1f')]);}_0x216763[_0x3050('0x39')]=qs[_0x3050('0x3a')](_0x32b1a9[_0x3050('0x33')][_0x3050('0x3a')]);_0x216763[_0x3050('0x3b')]=qs[_0x3050('0x3c')](_[_0x3050('0x3d')](_0x32b1a9[_0x3050('0x33')],_0x104119[_0x3050('0x3c')]),_0x53a346);if(_0x32b1a9[_0x3050('0x33')][_0x3050('0x3e')]){_0x216763['where']=_[_0x3050('0x3f')](_0x216763[_0x3050('0x3b')],{'$or':_['map'](_0x53a346,function(_0x1c0c92){if(_0x1c0c92['type']!==_0x3050('0x40')){var _0x585851={};_0x585851[_0x1c0c92[_0x3050('0x2a')]]={'$like':'%'+_0x32b1a9['query'][_0x3050('0x3e')]+'%'};return _0x585851;}})});}_0x216763=_['merge']({},_0x216763,_0x32b1a9[_0x3050('0x41')]);var _0x43330c={'where':_0x216763[_0x3050('0x3b')]};return db[_0x3050('0x42')]['count'](_0x43330c)[_0x3050('0x43')](function(_0x5cc46e){_0x59b6a1[_0x3050('0x20')]=_0x5cc46e;if(_0x32b1a9[_0x3050('0x33')][_0x3050('0x44')]){_0x216763['include']=[{'all':!![]}];}return db[_0x3050('0x42')]['findAll'](_0x216763);})[_0x3050('0x43')](function(_0x220e6e){_0x59b6a1['rows']=_0x220e6e;return _0x59b6a1;})[_0x3050('0x43')](respondWithFilteredResult(_0x474f22,_0x216763))[_0x3050('0x45')](handleError(_0x474f22,null));}; \ No newline at end of file +var _0x7816=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','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','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Migration','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','filter','where'];(function(_0x31021e,_0x248900){var _0x1e6fe5=function(_0x420acf){while(--_0x420acf){_0x31021e['push'](_0x31021e['shift']());}};_0x1e6fe5(++_0x248900);}(_0x7816,0x166));var _0x6781=function(_0x4fe99f,_0x5e352e){_0x4fe99f=_0x4fe99f-0x0;var _0x196e80=_0x7816[_0x4fe99f];return _0x196e80;};'use strict';var emlformat=require(_0x6781('0x0'));var rimraf=require(_0x6781('0x1'));var zipdir=require(_0x6781('0x2'));var jsonpatch=require(_0x6781('0x3'));var rp=require('request-promise');var moment=require(_0x6781('0x4'));var BPromise=require(_0x6781('0x5'));var Mustache=require(_0x6781('0x6'));var util=require(_0x6781('0x7'));var path=require(_0x6781('0x8'));var sox=require(_0x6781('0x9'));var csv=require(_0x6781('0xa'));var ejs=require(_0x6781('0xb'));var fs=require('fs');var fs_extra=require(_0x6781('0xc'));var _=require(_0x6781('0xd'));var squel=require(_0x6781('0xe'));var crypto=require('crypto');var jsforce=require(_0x6781('0xf'));var deskjs=require(_0x6781('0x10'));var toCsv=require('to-csv');var querystring=require(_0x6781('0x11'));var Papa=require(_0x6781('0x12'));var Redis=require(_0x6781('0x13'));var authService=require(_0x6781('0x14'));var qs=require(_0x6781('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6781('0x16'));var logger=require(_0x6781('0x17'))(_0x6781('0x18'));var utils=require(_0x6781('0x19'));var config=require(_0x6781('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3afab4,_0x5cd0eb){_0x5cd0eb=_0x5cd0eb||0xcc;return function(_0x256034){if(_0x256034){return _0x3afab4['sendStatus'](_0x5cd0eb);}return _0x3afab4['status'](_0x5cd0eb)[_0x6781('0x1b')]();};}function respondWithResult(_0x495560,_0x2dd0b6){_0x2dd0b6=_0x2dd0b6||0xc8;return function(_0x37feb0){if(_0x37feb0){return _0x495560[_0x6781('0x1c')](_0x2dd0b6)[_0x6781('0x1d')](_0x37feb0);}};}function respondWithFilteredResult(_0x54661d,_0x558e21){return function(_0xb0d5c5){if(_0xb0d5c5){var _0x19d4fe=typeof _0x558e21[_0x6781('0x1e')]===_0x6781('0x1f')&&typeof _0x558e21[_0x6781('0x20')]===_0x6781('0x1f');var _0x4d3abf=_0xb0d5c5['count'];var _0x237270=_0x19d4fe?0x0:_0x558e21['offset'];var _0x1cbb2a=_0x19d4fe?_0xb0d5c5[_0x6781('0x21')]:_0x558e21[_0x6781('0x1e')]+_0x558e21[_0x6781('0x20')];var _0x2b0363;if(_0x1cbb2a>=_0x4d3abf){_0x1cbb2a=_0x4d3abf;_0x2b0363=0xc8;}else{_0x2b0363=0xce;}_0x54661d[_0x6781('0x1c')](_0x2b0363);return _0x54661d[_0x6781('0x22')]('Content-Range',_0x237270+'-'+_0x1cbb2a+'/'+_0x4d3abf)[_0x6781('0x1d')](_0xb0d5c5);}return null;};}function patchUpdates(_0x23e915){return function(_0x11bc6f){try{jsonpatch[_0x6781('0x23')](_0x11bc6f,_0x23e915,!![]);}catch(_0x855a){return BPromise['reject'](_0x855a);}return _0x11bc6f[_0x6781('0x24')]();};}function saveUpdates(_0x584605,_0x3ecce2){return function(_0x39a2a2){if(_0x39a2a2){return _0x39a2a2[_0x6781('0x25')](_0x584605)[_0x6781('0x26')](function(_0x1d14d6){return _0x1d14d6;});}return null;};}function removeEntity(_0x29f4a4,_0xd7a69b){return function(_0x5779cf){if(_0x5779cf){return _0x5779cf[_0x6781('0x27')]()[_0x6781('0x26')](function(){_0x29f4a4[_0x6781('0x1c')](0xcc)[_0x6781('0x1b')]();});}};}function handleEntityNotFound(_0xc65088,_0x23ca4e){return function(_0x4aff5d){if(!_0x4aff5d){_0xc65088[_0x6781('0x28')](0x194);}return _0x4aff5d;};}function handleError(_0x1a3e2e,_0x4247e1){_0x4247e1=_0x4247e1||0x1f4;return function(_0x1970c1){logger[_0x6781('0x29')](_0x1970c1[_0x6781('0x2a')]);if(_0x1970c1[_0x6781('0x2b')]){delete _0x1970c1[_0x6781('0x2b')];}_0x1a3e2e['status'](_0x4247e1)[_0x6781('0x2c')](_0x1970c1);};}exports[_0x6781('0x2d')]=function(_0x12b2e0,_0x3d72d5){var _0x4360b4={},_0x2e4a8c={},_0x24eb75={'count':0x0,'rows':[]};var _0x412436=_[_0x6781('0x2e')](db[_0x6781('0x2f')][_0x6781('0x30')],function(_0x4495f8){return{'name':_0x4495f8['fieldName'],'type':_0x4495f8[_0x6781('0x31')]['key']};});_0x2e4a8c[_0x6781('0x32')]=_[_0x6781('0x2e')](_0x412436,_0x6781('0x2b'));_0x2e4a8c[_0x6781('0x33')]=_[_0x6781('0x34')](_0x12b2e0[_0x6781('0x33')]);_0x2e4a8c[_0x6781('0x35')]=_[_0x6781('0x36')](_0x2e4a8c[_0x6781('0x32')],_0x2e4a8c[_0x6781('0x33')]);_0x4360b4['attributes']=_[_0x6781('0x36')](_0x2e4a8c[_0x6781('0x32')],qs[_0x6781('0x37')](_0x12b2e0[_0x6781('0x33')][_0x6781('0x37')]));_0x4360b4[_0x6781('0x38')]=_0x4360b4[_0x6781('0x38')]['length']?_0x4360b4[_0x6781('0x38')]:_0x2e4a8c[_0x6781('0x32')];if(!_0x12b2e0[_0x6781('0x33')][_0x6781('0x39')]('nolimit')){_0x4360b4[_0x6781('0x20')]=qs[_0x6781('0x20')](_0x12b2e0[_0x6781('0x33')]['limit']);_0x4360b4[_0x6781('0x1e')]=qs[_0x6781('0x1e')](_0x12b2e0[_0x6781('0x33')][_0x6781('0x1e')]);}_0x4360b4[_0x6781('0x3a')]=qs[_0x6781('0x3b')](_0x12b2e0[_0x6781('0x33')][_0x6781('0x3b')]);_0x4360b4['where']=qs['filters'](_['pick'](_0x12b2e0[_0x6781('0x33')],_0x2e4a8c[_0x6781('0x35')]),_0x412436);if(_0x12b2e0[_0x6781('0x33')][_0x6781('0x3c')]){_0x4360b4[_0x6781('0x3d')]=_[_0x6781('0x3e')](_0x4360b4[_0x6781('0x3d')],{'$or':_[_0x6781('0x2e')](_0x412436,function(_0x7da2df){if(_0x7da2df['type']!==_0x6781('0x3f')){var _0x193403={};_0x193403[_0x7da2df['name']]={'$like':'%'+_0x12b2e0[_0x6781('0x33')]['filter']+'%'};return _0x193403;}})});}_0x4360b4=_['merge']({},_0x4360b4,_0x12b2e0[_0x6781('0x40')]);var _0x54b23c={'where':_0x4360b4['where']};return db[_0x6781('0x2f')][_0x6781('0x21')](_0x54b23c)[_0x6781('0x26')](function(_0x4e8279){_0x24eb75[_0x6781('0x21')]=_0x4e8279;if(_0x12b2e0[_0x6781('0x33')][_0x6781('0x41')]){_0x4360b4[_0x6781('0x42')]=[{'all':!![]}];}return db['Migration'][_0x6781('0x43')](_0x4360b4);})[_0x6781('0x26')](function(_0x183e73){_0x24eb75[_0x6781('0x44')]=_0x183e73;return _0x24eb75;})['then'](respondWithFilteredResult(_0x3d72d5,_0x4360b4))[_0x6781('0x45')](handleError(_0x3d72d5,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 5b692c8..a73a96d 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 _0xc1b3=['define','Migration','migrations','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x18f0c0,_0x9cfaf4){var _0x17fad1=function(_0xcd4c3a){while(--_0xcd4c3a){_0x18f0c0['push'](_0x18f0c0['shift']());}};_0x17fad1(++_0x9cfaf4);}(_0xc1b3,0x1a5));var _0x3c1b=function(_0x258095,_0x4fee5f){_0x258095=_0x258095-0x0;var _0x45a4af=_0xc1b3[_0x258095];return _0x45a4af;};'use strict';var _=require(_0x3c1b('0x0'));var util=require(_0x3c1b('0x1'));var logger=require(_0x3c1b('0x2'))(_0x3c1b('0x3'));var moment=require(_0x3c1b('0x4'));var BPromise=require('bluebird');var rp=require(_0x3c1b('0x5'));var fs=require('fs');var path=require(_0x3c1b('0x6'));var rimraf=require('rimraf');var config=require(_0x3c1b('0x7'));var attributes=require('./migration.attributes');module['exports']=function(_0x4da5ae,_0x3b185b){return _0x4da5ae[_0x3c1b('0x8')](_0x3c1b('0x9'),attributes,{'tableName':_0x3c1b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6752=['exports','define','Migration','lodash','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./migration.attributes'];(function(_0x39ff9b,_0x4ab82d){var _0x2295e8=function(_0x78f1dc){while(--_0x78f1dc){_0x39ff9b['push'](_0x39ff9b['shift']());}};_0x2295e8(++_0x4ab82d);}(_0x6752,0x17f));var _0x2675=function(_0xd19004,_0x5c44b7){_0xd19004=_0xd19004-0x0;var _0x4e4b7c=_0x6752[_0xd19004];return _0x4e4b7c;};'use strict';var _=require(_0x2675('0x0'));var util=require('util');var logger=require(_0x2675('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2675('0x2'));var rp=require(_0x2675('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2675('0x4'));var config=require(_0x2675('0x5'));var attributes=require(_0x2675('0x6'));module[_0x2675('0x7')]=function(_0x1ec336,_0x41dd7a){return _0x1ec336[_0x2675('0x8')](_0x2675('0x9'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index f97a165..f7b74d2 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 _0x1b32=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Migration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x30b284,_0x4d6836){var _0x5b50a5=function(_0x5c4059){while(--_0x5c4059){_0x30b284['push'](_0x30b284['shift']());}};_0x5b50a5(++_0x4d6836);}(_0x1b32,0x85));var _0x21b3=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x1b32[_0x3fba9f];return _0x192cf1;};'use strict';var _=require('lodash');var util=require(_0x21b3('0x0'));var moment=require(_0x21b3('0x1'));var BPromise=require(_0x21b3('0x2'));var rs=require(_0x21b3('0x3'));var fs=require('fs');var Redis=require(_0x21b3('0x4'));var db=require(_0x21b3('0x5'))['db'];var utils=require(_0x21b3('0x6'));var logger=require(_0x21b3('0x7'))(_0x21b3('0x8'));var config=require(_0x21b3('0x9'));var jayson=require(_0x21b3('0xa'));var client=jayson[_0x21b3('0xb')][_0x21b3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x47516a,_0x21e881,_0x5c0f36){return new BPromise(function(_0x45b1b7,_0x5639eb){return client['request'](_0x47516a,_0x5c0f36)['then'](function(_0xd7a981){logger[_0x21b3('0xd')]('Migration,\x20%s,\x20%s',_0x21e881,'request\x20sent');logger[_0x21b3('0xe')](_0x21b3('0xf'),_0x21e881,_0x21b3('0x10'),JSON['stringify'](_0xd7a981));if(_0xd7a981[_0x21b3('0x11')]){if(_0xd7a981[_0x21b3('0x11')][_0x21b3('0x12')]===0x1f4){logger[_0x21b3('0x11')](_0x21b3('0x13'),_0x21e881,_0xd7a981[_0x21b3('0x11')][_0x21b3('0x14')]);return _0x5639eb(_0xd7a981[_0x21b3('0x11')][_0x21b3('0x14')]);}logger['error'](_0x21b3('0x13'),_0x21e881,_0xd7a981[_0x21b3('0x11')][_0x21b3('0x14')]);return _0x45b1b7(_0xd7a981['error'][_0x21b3('0x14')]);}else{logger['info'](_0x21b3('0x13'),_0x21e881,'request\x20sent');_0x45b1b7(_0xd7a981[_0x21b3('0x15')][_0x21b3('0x14')]);}})[_0x21b3('0x16')](function(_0x4217d6){logger['error'](_0x21b3('0x13'),_0x21e881,_0x4217d6);_0x5639eb(_0x4217d6);});});} \ No newline at end of file +var _0xe74e=['../../config/logger','rpc','../../config/environment','http','request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xeba235,_0x145da4){var _0x1034c8=function(_0x1107d8){while(--_0x1107d8){_0xeba235['push'](_0xeba235['shift']());}};_0x1034c8(++_0x145da4);}(_0xe74e,0x10a));var _0xee74=function(_0x3d366f,_0x27c753){_0x3d366f=_0x3d366f-0x0;var _0x253002=_0xe74e[_0x3d366f];return _0x253002;};'use strict';var _=require('lodash');var util=require(_0xee74('0x0'));var moment=require(_0xee74('0x1'));var BPromise=require(_0xee74('0x2'));var rs=require(_0xee74('0x3'));var fs=require('fs');var Redis=require(_0xee74('0x4'));var db=require(_0xee74('0x5'))['db'];var utils=require(_0xee74('0x6'));var logger=require(_0xee74('0x7'))(_0xee74('0x8'));var config=require(_0xee74('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xee74('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x242ac6,_0x539a7b,_0x58fa11){return new BPromise(function(_0x11c67e,_0x21043c){return client[_0xee74('0xb')](_0x242ac6,_0x58fa11)['then'](function(_0x48cdb0){logger[_0xee74('0xc')](_0xee74('0xd'),_0x539a7b,_0xee74('0xe'));logger[_0xee74('0xf')](_0xee74('0x10'),_0x539a7b,_0xee74('0xe'),JSON['stringify'](_0x48cdb0));if(_0x48cdb0[_0xee74('0x11')]){if(_0x48cdb0[_0xee74('0x11')][_0xee74('0x12')]===0x1f4){logger[_0xee74('0x11')]('Migration,\x20%s,\x20%s',_0x539a7b,_0x48cdb0[_0xee74('0x11')][_0xee74('0x13')]);return _0x21043c(_0x48cdb0[_0xee74('0x11')][_0xee74('0x13')]);}logger['error'](_0xee74('0xd'),_0x539a7b,_0x48cdb0[_0xee74('0x11')][_0xee74('0x13')]);return _0x11c67e(_0x48cdb0[_0xee74('0x11')][_0xee74('0x13')]);}else{logger[_0xee74('0xc')]('Migration,\x20%s,\x20%s',_0x539a7b,_0xee74('0xe'));_0x11c67e(_0x48cdb0[_0xee74('0x14')][_0xee74('0x13')]);}})['catch'](function(_0x988fb5){logger[_0xee74('0x11')]('Migration,\x20%s,\x20%s',_0x539a7b,_0x988fb5);_0x21043c(_0x988fb5);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index ed1acc9..2d884c3 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 _0x4128=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./network.controller','get','index','isAuthenticated','show','post','put','/:id','update','delete','destroy'];(function(_0xbd7d4f,_0x27e09f){var _0xdbd4a0=function(_0x182737){while(--_0x182737){_0xbd7d4f['push'](_0xbd7d4f['shift']());}};_0xdbd4a0(++_0x27e09f);}(_0x4128,0x1a5));var _0x8412=function(_0x4aea59,_0x1b9dc6){_0x4aea59=_0x4aea59-0x0;var _0xac72bc=_0x4128[_0x4aea59];return _0xac72bc;};'use strict';var multer=require(_0x8412('0x0'));var util=require(_0x8412('0x1'));var path=require(_0x8412('0x2'));var timeout=require(_0x8412('0x3'));var express=require(_0x8412('0x4'));var router=express[_0x8412('0x5')]();var fs_extra=require(_0x8412('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8412('0x7'));var config=require('../../config/environment');var controller=require(_0x8412('0x8'));router[_0x8412('0x9')]('/',auth['isAuthenticated'](),controller[_0x8412('0xa')]);router['get']('/:id',auth[_0x8412('0xb')](),controller[_0x8412('0xc')]);router[_0x8412('0xd')]('/',auth[_0x8412('0xb')](),controller['create']);router[_0x8412('0xe')](_0x8412('0xf'),auth[_0x8412('0xb')](),controller[_0x8412('0x10')]);router[_0x8412('0x11')]('/:id',auth[_0x8412('0xb')](),controller[_0x8412('0x12')]);module[_0x8412('0x13')]=router; \ No newline at end of file +var _0x753c=['delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x385076,_0x3f623f){var _0x5066a9=function(_0x3e64de){while(--_0x3e64de){_0x385076['push'](_0x385076['shift']());}};_0x5066a9(++_0x3f623f);}(_0x753c,0x96));var _0xc753=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x753c[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require('multer');var util=require(_0xc753('0x0'));var path=require('path');var timeout=require(_0xc753('0x1'));var express=require(_0xc753('0x2'));var router=express[_0xc753('0x3')]();var fs_extra=require(_0xc753('0x4'));var auth=require(_0xc753('0x5'));var interaction=require(_0xc753('0x6'));var config=require(_0xc753('0x7'));var controller=require(_0xc753('0x8'));router[_0xc753('0x9')]('/',auth[_0xc753('0xa')](),controller[_0xc753('0xb')]);router[_0xc753('0x9')](_0xc753('0xc'),auth[_0xc753('0xa')](),controller[_0xc753('0xd')]);router[_0xc753('0xe')]('/',auth[_0xc753('0xa')](),controller[_0xc753('0xf')]);router[_0xc753('0x10')](_0xc753('0xc'),auth[_0xc753('0xa')](),controller[_0xc753('0x11')]);router[_0xc753('0x12')](_0xc753('0xc'),auth['isAuthenticated'](),controller[_0xc753('0x13')]);module[_0xc753('0x14')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index c7f2446..806c6b5 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 _0x3c92=['turn','STRING','ENUM','localnet','externip','stun'];(function(_0x3bbff8,_0xf06686){var _0x4b6361=function(_0xd662b6){while(--_0xd662b6){_0x3bbff8['push'](_0x3bbff8['shift']());}};_0x4b6361(++_0xf06686);}(_0x3c92,0x128));var _0x23c9=function(_0x24e76c,_0x1570b1){_0x24e76c=_0x24e76c-0x0;var _0x514c84=_0x3c92[_0x24e76c];return _0x514c84;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x23c9('0x0')](_0x23c9('0x1'),_0x23c9('0x2'),_0x23c9('0x3'),_0x23c9('0x4'))},'value':{'type':Sequelize[_0x23c9('0x5')]},'username':{'type':Sequelize[_0x23c9('0x5')]},'password':{'type':Sequelize[_0x23c9('0x5')]}}; \ No newline at end of file +var _0x572f=['ENUM','localnet','externip','stun','STRING','sequelize','exports'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x572f,0x14e));var _0xf572=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x572f[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xf572('0x0'));module[_0xf572('0x1')]={'type':{'type':Sequelize[_0xf572('0x2')](_0xf572('0x3'),_0xf572('0x4'),_0xf572('0x5'),'turn')},'value':{'type':Sequelize[_0xf572('0x6')]},'username':{'type':Sequelize[_0xf572('0x6')]},'password':{'type':Sequelize[_0xf572('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index a66247b..af6c9c0 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 _0x0324=['fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','Network','count','includeAll','include','rows','catch','show','params','keys','filters','find','create','sequelize','transaction','body','findAll','toUpperCase','STUN','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','readFileSync','join','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','server/files/templates/turn_multiple.ejs','chan_sip.so','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','client','http','then','info','request\x20sent','debug','stringify','error','Network,\x20%s,\x20%s','message','result','end','status','offset','undefined','limit','set','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','attributes'];(function(_0x119880,_0x4f291f){var _0x4a1707=function(_0x4e88c2){while(--_0x4e88c2){_0x119880['push'](_0x119880['shift']());}};_0x4a1707(++_0x4f291f);}(_0x0324,0x1e0));var _0x4032=function(_0x3728a3,_0x1345af){_0x3728a3=_0x3728a3-0x0;var _0x27ff6b=_0x0324[_0x3728a3];return _0x27ff6b;};'use strict';var emlformat=require(_0x4032('0x0'));var rimraf=require(_0x4032('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4032('0x2'));var rp=require(_0x4032('0x3'));var moment=require(_0x4032('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4032('0x5'));var util=require(_0x4032('0x6'));var path=require('path');var sox=require(_0x4032('0x7'));var csv=require(_0x4032('0x8'));var ejs=require(_0x4032('0x9'));var fs=require('fs');var fs_extra=require(_0x4032('0xa'));var _=require('lodash');var squel=require(_0x4032('0xb'));var crypto=require(_0x4032('0xc'));var jsforce=require(_0x4032('0xd'));var deskjs=require(_0x4032('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4032('0xf'));var Papa=require(_0x4032('0x10'));var Redis=require(_0x4032('0x11'));var authService=require(_0x4032('0x12'));var qs=require(_0x4032('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4032('0x14'));var logger=require(_0x4032('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x4032('0x16'));var licenseUtil=require(_0x4032('0x17'));var db=require(_0x4032('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x4032('0x19')][_0x4032('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xef8d54,_0x5978a1,_0x42f2f2,_0x261877){return new BPromise(function(_0x57c31a,_0x3880bc){var _0x647314=_0x261877||client;return _0x647314['request'](_0xef8d54,_0x42f2f2)[_0x4032('0x1b')](function(_0x16d0b6){logger[_0x4032('0x1c')]('Network,\x20%s,\x20%s',_0x5978a1,_0x4032('0x1d'));logger[_0x4032('0x1e')]('Network,\x20%s,\x20%s,\x20%s',_0x5978a1,_0x4032('0x1d'),JSON[_0x4032('0x1f')](_0x16d0b6));if(_0x16d0b6[_0x4032('0x20')]){if(_0x16d0b6[_0x4032('0x20')]['code']===0x1f4){logger[_0x4032('0x20')](_0x4032('0x21'),_0x5978a1,_0x16d0b6[_0x4032('0x20')][_0x4032('0x22')]);return _0x3880bc(_0x16d0b6[_0x4032('0x20')][_0x4032('0x22')]);}logger['error'](_0x4032('0x21'),_0x5978a1,_0x16d0b6['error'][_0x4032('0x22')]);return _0x57c31a(_0x16d0b6[_0x4032('0x20')][_0x4032('0x22')]);}else{logger[_0x4032('0x1c')](_0x4032('0x21'),_0x5978a1,_0x4032('0x1d'));_0x57c31a(_0x16d0b6[_0x4032('0x23')][_0x4032('0x22')]);}})['catch'](function(_0x381fa3){logger[_0x4032('0x20')](_0x4032('0x21'),_0x5978a1,_0x381fa3);_0x3880bc(_0x381fa3);});});}function respondWithStatusCode(_0x11e7a0,_0x2c6aef){_0x2c6aef=_0x2c6aef||0xcc;return function(_0x3f9df7){if(_0x3f9df7){return _0x11e7a0['sendStatus'](_0x2c6aef);}return _0x11e7a0['status'](_0x2c6aef)[_0x4032('0x24')]();};}function respondWithResult(_0x3f70ac,_0x355783){_0x355783=_0x355783||0xc8;return function(_0x1e6d82){if(_0x1e6d82){return _0x3f70ac[_0x4032('0x25')](_0x355783)['json'](_0x1e6d82);}};}function respondWithFilteredResult(_0x22db0b,_0x420c9b){return function(_0x115680){if(_0x115680){var _0x365e04=typeof _0x420c9b[_0x4032('0x26')]===_0x4032('0x27')&&typeof _0x420c9b[_0x4032('0x28')]===_0x4032('0x27');var _0xaa5331=_0x115680['count'];var _0x4c6a58=_0x365e04?0x0:_0x420c9b['offset'];var _0x3f6fc6=_0x365e04?_0x115680['count']:_0x420c9b[_0x4032('0x26')]+_0x420c9b['limit'];var _0x215fa6;if(_0x3f6fc6>=_0xaa5331){_0x3f6fc6=_0xaa5331;_0x215fa6=0xc8;}else{_0x215fa6=0xce;}_0x22db0b['status'](_0x215fa6);return _0x22db0b[_0x4032('0x29')]('Content-Range',_0x4c6a58+'-'+_0x3f6fc6+'/'+_0xaa5331)['json'](_0x115680);}return null;};}function patchUpdates(_0x4e5378){return function(_0x23e34c){try{jsonpatch[_0x4032('0x2a')](_0x23e34c,_0x4e5378,!![]);}catch(_0x400f4a){return BPromise[_0x4032('0x2b')](_0x400f4a);}return _0x23e34c[_0x4032('0x2c')]();};}function saveUpdates(_0x35eaaa,_0x5071f7){return function(_0x29351b){if(_0x29351b){return _0x29351b[_0x4032('0x2d')](_0x35eaaa)[_0x4032('0x1b')](function(_0x26f2ae){return _0x26f2ae;});}return null;};}function removeEntity(_0x426d06,_0xe4c7bb){return function(_0x490738){if(_0x490738){return _0x490738[_0x4032('0x2e')]()[_0x4032('0x1b')](function(){_0x426d06[_0x4032('0x25')](0xcc)[_0x4032('0x24')]();});}};}function handleEntityNotFound(_0xbb6c43,_0x32dee2){return function(_0x2ef5a6){if(!_0x2ef5a6){_0xbb6c43[_0x4032('0x2f')](0x194);}return _0x2ef5a6;};}function handleError(_0x2861ec,_0x272eb9){_0x272eb9=_0x272eb9||0x1f4;return function(_0x218a83){logger[_0x4032('0x20')](_0x218a83[_0x4032('0x30')]);if(_0x218a83[_0x4032('0x31')]){delete _0x218a83[_0x4032('0x31')];}_0x2861ec[_0x4032('0x25')](_0x272eb9)[_0x4032('0x32')](_0x218a83);};}exports[_0x4032('0x33')]=function(_0x3fd9a9,_0x510c15){var _0x402f49={},_0x2b1336={},_0x28e8fe={'count':0x0,'rows':[]};var _0x1d7ad9=_[_0x4032('0x34')](db['Network'][_0x4032('0x35')],function(_0x34fa6c){return{'name':_0x34fa6c['fieldName'],'type':_0x34fa6c[_0x4032('0x36')][_0x4032('0x37')]};});_0x2b1336[_0x4032('0x38')]=_[_0x4032('0x34')](_0x1d7ad9,'name');_0x2b1336[_0x4032('0x39')]=_['keys'](_0x3fd9a9[_0x4032('0x39')]);_0x2b1336['filters']=_[_0x4032('0x3a')](_0x2b1336[_0x4032('0x38')],_0x2b1336['query']);_0x402f49[_0x4032('0x3b')]=_[_0x4032('0x3a')](_0x2b1336['model'],qs[_0x4032('0x3c')](_0x3fd9a9[_0x4032('0x39')][_0x4032('0x3c')]));_0x402f49[_0x4032('0x3b')]=_0x402f49[_0x4032('0x3b')][_0x4032('0x3d')]?_0x402f49[_0x4032('0x3b')]:_0x2b1336[_0x4032('0x38')];if(!_0x3fd9a9[_0x4032('0x39')][_0x4032('0x3e')](_0x4032('0x3f'))){_0x402f49[_0x4032('0x28')]=qs[_0x4032('0x28')](_0x3fd9a9[_0x4032('0x39')][_0x4032('0x28')]);_0x402f49[_0x4032('0x26')]=qs[_0x4032('0x26')](_0x3fd9a9[_0x4032('0x39')][_0x4032('0x26')]);}_0x402f49[_0x4032('0x40')]=qs[_0x4032('0x41')](_0x3fd9a9['query'][_0x4032('0x41')]);_0x402f49['where']=qs['filters'](_[_0x4032('0x42')](_0x3fd9a9[_0x4032('0x39')],_0x2b1336['filters']),_0x1d7ad9);if(_0x3fd9a9[_0x4032('0x39')]['filter']){_0x402f49['where']=_['merge'](_0x402f49[_0x4032('0x43')],{'$or':_[_0x4032('0x34')](_0x1d7ad9,function(_0x542b84){if(_0x542b84[_0x4032('0x36')]!==_0x4032('0x44')){var _0x23c8b6={};_0x23c8b6[_0x542b84[_0x4032('0x31')]]={'$like':'%'+_0x3fd9a9[_0x4032('0x39')][_0x4032('0x45')]+'%'};return _0x23c8b6;}})});}_0x402f49=_[_0x4032('0x46')]({},_0x402f49,_0x3fd9a9[_0x4032('0x47')]);var _0x31a9b3={'where':_0x402f49['where']};return db[_0x4032('0x48')][_0x4032('0x49')](_0x31a9b3)[_0x4032('0x1b')](function(_0x37d912){_0x28e8fe[_0x4032('0x49')]=_0x37d912;if(_0x3fd9a9[_0x4032('0x39')][_0x4032('0x4a')]){_0x402f49[_0x4032('0x4b')]=[{'all':!![]}];}return db['Network']['findAll'](_0x402f49);})[_0x4032('0x1b')](function(_0x357554){_0x28e8fe[_0x4032('0x4c')]=_0x357554;return _0x28e8fe;})[_0x4032('0x1b')](respondWithFilteredResult(_0x510c15,_0x402f49))[_0x4032('0x4d')](handleError(_0x510c15,null));};exports[_0x4032('0x4e')]=function(_0x3a10c3,_0x3c5faf){var _0x128557={'raw':!![],'where':{'id':_0x3a10c3[_0x4032('0x4f')]['id']}},_0x42cd3d={};_0x42cd3d[_0x4032('0x38')]=_[_0x4032('0x50')](db[_0x4032('0x48')][_0x4032('0x35')]);_0x42cd3d[_0x4032('0x39')]=_['keys'](_0x3a10c3['query']);_0x42cd3d[_0x4032('0x51')]=_['intersection'](_0x42cd3d[_0x4032('0x38')],_0x42cd3d[_0x4032('0x39')]);_0x128557['attributes']=_[_0x4032('0x3a')](_0x42cd3d[_0x4032('0x38')],qs[_0x4032('0x3c')](_0x3a10c3[_0x4032('0x39')][_0x4032('0x3c')]));_0x128557['attributes']=_0x128557['attributes'][_0x4032('0x3d')]?_0x128557['attributes']:_0x42cd3d['model'];if(_0x3a10c3[_0x4032('0x39')][_0x4032('0x4a')]){_0x128557['include']=[{'all':!![]}];}_0x128557=_[_0x4032('0x46')]({},_0x128557,_0x3a10c3[_0x4032('0x47')]);return db[_0x4032('0x48')][_0x4032('0x52')](_0x128557)[_0x4032('0x1b')](handleEntityNotFound(_0x3c5faf,null))[_0x4032('0x1b')](respondWithResult(_0x3c5faf,null))[_0x4032('0x4d')](handleError(_0x3c5faf,null));};exports[_0x4032('0x53')]=function(_0x1d0b42,_0x231164,_0x5334f9){var _0x442d9f;return db[_0x4032('0x54')][_0x4032('0x55')](function(_0x5c4db3){return db[_0x4032('0x48')]['create'](_0x1d0b42[_0x4032('0x56')],{'raw':!![]})[_0x4032('0x1b')](function(_0x504433){_0x442d9f=_0x504433;return db[_0x4032('0x48')][_0x4032('0x57')]({'where':{'type':_0x1d0b42[_0x4032('0x56')][_0x4032('0x36')]},'raw':!![]});})[_0x4032('0x1b')](function(_0x5ca35d){if(_0x442d9f[_0x4032('0x36')][_0x4032('0x58')]()==_0x4032('0x59')){var _0x4fa0bb=fs['readFileSync'](path['join'](config[_0x4032('0x5a')],_0x4032('0x5b')),_0x4032('0x5c'));var _0x131aed=ejs[_0x4032('0x5d')](_0x4fa0bb,{'networks':_0x5ca35d||[]});fs[_0x4032('0x5e')](_0x4032('0x5f'),_0x131aed);return respondWithRpcPromise(_0x4032('0x60'),_0x4032('0x53'),{'module':_0x4032('0x61')});}else if(_0x442d9f[_0x4032('0x36')]['toUpperCase']()==_0x4032('0x62')){var _0x5c20f0=fs[_0x4032('0x63')](path[_0x4032('0x64')](config[_0x4032('0x5a')],'server/files/templates/turn_multiple.ejs'),_0x4032('0x5c'));var _0x11b5ff=ejs[_0x4032('0x5d')](_0x5c20f0,{'networks':_0x5ca35d||[]});fs[_0x4032('0x5e')](_0x4032('0x65'),_0x11b5ff);return respondWithRpcPromise('Reload',_0x4032('0x53'),{'module':_0x4032('0x61')});}else{var _0x3de1f7=fs[_0x4032('0x63')](path[_0x4032('0x64')](config['root'],_0x4032('0x66')),_0x4032('0x5c'));var _0x32b0a2=ejs[_0x4032('0x5d')](_0x3de1f7,{'networks':_0x5ca35d||[]});fs['writeFileSync'](util[_0x4032('0x67')](_0x4032('0x68'),_0x1d0b42['body'][_0x4032('0x36')][_0x4032('0x69')]()),_0x32b0a2);return respondWithRpcPromise('Reload',_0x4032('0x53'),{'module':'chan_sip.so'});}return null;})['then'](function(){return _0x442d9f;});})[_0x4032('0x1b')](respondWithResult(_0x231164,0xc9))['catch'](handleError(_0x231164,null));};exports[_0x4032('0x2d')]=function(_0x4eb338,_0x3b2ad6,_0x460601){var _0x44ce1d;return db['sequelize']['transaction'](function(_0xc54ad1){return db[_0x4032('0x48')][_0x4032('0x52')]({'where':{'id':_0x4eb338[_0x4032('0x4f')]['id']}})[_0x4032('0x1b')](handleEntityNotFound(_0x3b2ad6,null))[_0x4032('0x1b')](saveUpdates(_0x4eb338[_0x4032('0x56')],null))['then'](function(_0x5b92b3){if(_0x5b92b3){_0x44ce1d=_0x5b92b3;return db[_0x4032('0x48')][_0x4032('0x57')]({'where':{'type':_0x44ce1d['type']},'raw':!![]});}return null;})[_0x4032('0x1b')](function(_0x3d055f){if(_0x44ce1d[_0x4032('0x36')]['toUpperCase']()==_0x4032('0x59')){var _0x218bce=fs[_0x4032('0x63')](path[_0x4032('0x64')](config[_0x4032('0x5a')],_0x4032('0x5b')),_0x4032('0x5c'));var _0x1676a9=ejs[_0x4032('0x5d')](_0x218bce,{'networks':_0x3d055f||[]});fs[_0x4032('0x5e')](_0x4032('0x5f'),_0x1676a9);return respondWithRpcPromise(_0x4032('0x60'),_0x4032('0x2d'),{'module':_0x4032('0x61')});}else if(_0x44ce1d['type'][_0x4032('0x58')]()==_0x4032('0x62')){var _0x150675=fs['readFileSync'](path[_0x4032('0x64')](config['root'],_0x4032('0x6a')),_0x4032('0x5c'));var _0x113868=ejs['render'](_0x150675,{'networks':_0x3d055f||[]});fs[_0x4032('0x5e')](_0x4032('0x65'),_0x113868);return respondWithRpcPromise(_0x4032('0x60'),_0x4032('0x2d'),{'module':_0x4032('0x61')});}else{var _0x57fdb4=fs['readFileSync'](path[_0x4032('0x64')](config[_0x4032('0x5a')],_0x4032('0x66')),'utf8');var _0x4a4d3e=ejs[_0x4032('0x5d')](_0x57fdb4,{'networks':_0x3d055f||[]});fs[_0x4032('0x5e')](util[_0x4032('0x67')](_0x4032('0x68'),_0x4eb338[_0x4032('0x56')][_0x4032('0x36')][_0x4032('0x69')]()),_0x4a4d3e);return respondWithRpcPromise(_0x4032('0x60'),_0x4032('0x2d'),{'module':_0x4032('0x6b')});}return null;})['then'](function(_0x1d7703){if(_0x1d7703){return _0x44ce1d;}return null;});})[_0x4032('0x1b')](respondWithResult(_0x3b2ad6,null))[_0x4032('0x4d')](handleError(_0x3b2ad6,null));};exports['destroy']=function(_0x247a94,_0x34c913,_0x4311e8){var _0x41d32f;return db[_0x4032('0x48')][_0x4032('0x52')]({'where':{'id':_0x247a94[_0x4032('0x4f')]['id']}})['then'](function(_0x31e8ab){_0x41d32f=_0x31e8ab;return _0x31e8ab;})['then'](handleEntityNotFound(_0x34c913,null))['then'](removeEntity(_0x34c913,null))[_0x4032('0x1b')](function(){if(_0x41d32f){return db[_0x4032('0x48')]['findAll']({'where':{'type':_0x41d32f[_0x4032('0x36')]},'raw':!![]});}})[_0x4032('0x1b')](function(_0x31123c){if(_0x41d32f[_0x4032('0x36')]['toUpperCase']()==_0x4032('0x59')){var _0x4af9e3=fs['readFileSync'](path[_0x4032('0x64')](config[_0x4032('0x5a')],_0x4032('0x5b')),'utf8');var _0x2f9b0c=ejs[_0x4032('0x5d')](_0x4af9e3,{'networks':_0x31123c||[]});fs[_0x4032('0x5e')]('/etc/asterisk/stun_xcally.conf',_0x2f9b0c);return respondWithRpcPromise(_0x4032('0x60'),_0x4032('0x2e'),{'module':_0x4032('0x61')});}else if(_0x41d32f[_0x4032('0x36')][_0x4032('0x58')]()==_0x4032('0x62')){var _0x3e8c71=fs[_0x4032('0x63')](path[_0x4032('0x64')](config[_0x4032('0x5a')],_0x4032('0x6a')),'utf8');var _0x4a4331=ejs[_0x4032('0x5d')](_0x3e8c71,{'networks':_0x31123c||[]});fs['writeFileSync'](_0x4032('0x65'),_0x4a4331);return respondWithRpcPromise(_0x4032('0x60'),'destroy',{'module':'res_stun_monitor.so'});}else{var _0x188605=fs[_0x4032('0x63')](path[_0x4032('0x64')](config['root'],_0x4032('0x66')),_0x4032('0x5c'));var _0x55ff88=ejs[_0x4032('0x5d')](_0x188605,{'networks':_0x31123c||[]});fs[_0x4032('0x5e')](util[_0x4032('0x67')](_0x4032('0x68'),_0x247a94[_0x4032('0x56')][_0x4032('0x36')]['toLowerCase']()),_0x55ff88);return respondWithRpcPromise('Reload',_0x4032('0x2e'),{'module':_0x4032('0x6b')});}return null;})['catch'](handleError(_0x34c913,null));}; \ No newline at end of file +var _0xce50=['name','send','index','map','Network','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','include','findAll','rows','show','params','keys','includeAll','find','create','sequelize','transaction','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','server/files/templates/turn_multiple.ejs','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','stack'];(function(_0x45346d,_0xffd56b){var _0x5ce7ca=function(_0x27ce87){while(--_0x27ce87){_0x45346d['push'](_0x45346d['shift']());}};_0x5ce7ca(++_0xffd56b);}(_0xce50,0x1d8));var _0x0ce5=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xce50[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0ce5('0x0'));var zipdir=require(_0x0ce5('0x1'));var jsonpatch=require(_0x0ce5('0x2'));var rp=require(_0x0ce5('0x3'));var moment=require(_0x0ce5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0ce5('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x0ce5('0x6'));var ejs=require(_0x0ce5('0x7'));var fs=require('fs');var fs_extra=require(_0x0ce5('0x8'));var _=require(_0x0ce5('0x9'));var squel=require('squel');var crypto=require(_0x0ce5('0xa'));var jsforce=require(_0x0ce5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0ce5('0x6'));var querystring=require('querystring');var Papa=require(_0x0ce5('0xc'));var Redis=require(_0x0ce5('0xd'));var authService=require(_0x0ce5('0xe'));var qs=require(_0x0ce5('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0ce5('0x10'));var logger=require(_0x0ce5('0x11'))(_0x0ce5('0x12'));var utils=require(_0x0ce5('0x13'));var config=require(_0x0ce5('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x0ce5('0x15')][_0x0ce5('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x352865,_0x282453,_0x4f4a14,_0x85bbb){return new BPromise(function(_0x117fa9,_0x5f4317){var _0x45dacd=_0x85bbb||client;return _0x45dacd['request'](_0x352865,_0x4f4a14)[_0x0ce5('0x17')](function(_0x1dd856){logger[_0x0ce5('0x18')](_0x0ce5('0x19'),_0x282453,_0x0ce5('0x1a'));logger[_0x0ce5('0x1b')](_0x0ce5('0x1c'),_0x282453,_0x0ce5('0x1a'),JSON['stringify'](_0x1dd856));if(_0x1dd856[_0x0ce5('0x1d')]){if(_0x1dd856[_0x0ce5('0x1d')]['code']===0x1f4){logger['error'](_0x0ce5('0x19'),_0x282453,_0x1dd856['error'][_0x0ce5('0x1e')]);return _0x5f4317(_0x1dd856[_0x0ce5('0x1d')][_0x0ce5('0x1e')]);}logger[_0x0ce5('0x1d')](_0x0ce5('0x19'),_0x282453,_0x1dd856[_0x0ce5('0x1d')]['message']);return _0x117fa9(_0x1dd856[_0x0ce5('0x1d')][_0x0ce5('0x1e')]);}else{logger[_0x0ce5('0x18')](_0x0ce5('0x19'),_0x282453,'request\x20sent');_0x117fa9(_0x1dd856[_0x0ce5('0x1f')]['message']);}})[_0x0ce5('0x20')](function(_0x3c59d1){logger[_0x0ce5('0x1d')](_0x0ce5('0x19'),_0x282453,_0x3c59d1);_0x5f4317(_0x3c59d1);});});}function respondWithStatusCode(_0x334e7d,_0xbb1a2c){_0xbb1a2c=_0xbb1a2c||0xcc;return function(_0x3ca9de){if(_0x3ca9de){return _0x334e7d[_0x0ce5('0x21')](_0xbb1a2c);}return _0x334e7d[_0x0ce5('0x22')](_0xbb1a2c)[_0x0ce5('0x23')]();};}function respondWithResult(_0x5adffe,_0x5392a4){_0x5392a4=_0x5392a4||0xc8;return function(_0x2332d4){if(_0x2332d4){return _0x5adffe['status'](_0x5392a4)['json'](_0x2332d4);}};}function respondWithFilteredResult(_0x73f240,_0x564276){return function(_0x2c7414){if(_0x2c7414){var _0x1c0731=typeof _0x564276['offset']==='undefined'&&typeof _0x564276[_0x0ce5('0x24')]===_0x0ce5('0x25');var _0x565295=_0x2c7414[_0x0ce5('0x26')];var _0x470fb6=_0x1c0731?0x0:_0x564276[_0x0ce5('0x27')];var _0x54a385=_0x1c0731?_0x2c7414['count']:_0x564276[_0x0ce5('0x27')]+_0x564276[_0x0ce5('0x24')];var _0x295402;if(_0x54a385>=_0x565295){_0x54a385=_0x565295;_0x295402=0xc8;}else{_0x295402=0xce;}_0x73f240[_0x0ce5('0x22')](_0x295402);return _0x73f240[_0x0ce5('0x28')](_0x0ce5('0x29'),_0x470fb6+'-'+_0x54a385+'/'+_0x565295)[_0x0ce5('0x2a')](_0x2c7414);}return null;};}function patchUpdates(_0xf5d353){return function(_0x34612a){try{jsonpatch[_0x0ce5('0x2b')](_0x34612a,_0xf5d353,!![]);}catch(_0x2f392c){return BPromise[_0x0ce5('0x2c')](_0x2f392c);}return _0x34612a[_0x0ce5('0x2d')]();};}function saveUpdates(_0xfef4a3,_0x733d8a){return function(_0x143960){if(_0x143960){return _0x143960[_0x0ce5('0x2e')](_0xfef4a3)[_0x0ce5('0x17')](function(_0x15712d){return _0x15712d;});}return null;};}function removeEntity(_0x40dcf8,_0x1d7351){return function(_0x441ff1){if(_0x441ff1){return _0x441ff1['destroy']()[_0x0ce5('0x17')](function(){_0x40dcf8[_0x0ce5('0x22')](0xcc)[_0x0ce5('0x23')]();});}};}function handleEntityNotFound(_0x510021,_0x37a303){return function(_0x14cceb){if(!_0x14cceb){_0x510021[_0x0ce5('0x21')](0x194);}return _0x14cceb;};}function handleError(_0x92c9c7,_0x530707){_0x530707=_0x530707||0x1f4;return function(_0x3ec9c2){logger[_0x0ce5('0x1d')](_0x3ec9c2[_0x0ce5('0x2f')]);if(_0x3ec9c2[_0x0ce5('0x30')]){delete _0x3ec9c2[_0x0ce5('0x30')];}_0x92c9c7[_0x0ce5('0x22')](_0x530707)[_0x0ce5('0x31')](_0x3ec9c2);};}exports[_0x0ce5('0x32')]=function(_0x454101,_0x19c9a4){var _0x163541={},_0x453ee4={},_0x4d5a1d={'count':0x0,'rows':[]};var _0x13d73e=_[_0x0ce5('0x33')](db[_0x0ce5('0x34')]['rawAttributes'],function(_0x15cbde){return{'name':_0x15cbde[_0x0ce5('0x35')],'type':_0x15cbde[_0x0ce5('0x36')][_0x0ce5('0x37')]};});_0x453ee4['model']=_[_0x0ce5('0x33')](_0x13d73e,'name');_0x453ee4[_0x0ce5('0x38')]=_['keys'](_0x454101['query']);_0x453ee4[_0x0ce5('0x39')]=_[_0x0ce5('0x3a')](_0x453ee4[_0x0ce5('0x3b')],_0x453ee4['query']);_0x163541[_0x0ce5('0x3c')]=_[_0x0ce5('0x3a')](_0x453ee4[_0x0ce5('0x3b')],qs[_0x0ce5('0x3d')](_0x454101['query'][_0x0ce5('0x3d')]));_0x163541[_0x0ce5('0x3c')]=_0x163541[_0x0ce5('0x3c')][_0x0ce5('0x3e')]?_0x163541[_0x0ce5('0x3c')]:_0x453ee4[_0x0ce5('0x3b')];if(!_0x454101['query'][_0x0ce5('0x3f')](_0x0ce5('0x40'))){_0x163541[_0x0ce5('0x24')]=qs[_0x0ce5('0x24')](_0x454101[_0x0ce5('0x38')][_0x0ce5('0x24')]);_0x163541[_0x0ce5('0x27')]=qs[_0x0ce5('0x27')](_0x454101[_0x0ce5('0x38')]['offset']);}_0x163541['order']=qs[_0x0ce5('0x41')](_0x454101[_0x0ce5('0x38')]['sort']);_0x163541['where']=qs[_0x0ce5('0x39')](_[_0x0ce5('0x42')](_0x454101[_0x0ce5('0x38')],_0x453ee4[_0x0ce5('0x39')]),_0x13d73e);if(_0x454101[_0x0ce5('0x38')][_0x0ce5('0x43')]){_0x163541[_0x0ce5('0x44')]=_[_0x0ce5('0x45')](_0x163541[_0x0ce5('0x44')],{'$or':_[_0x0ce5('0x33')](_0x13d73e,function(_0x4f218b){if(_0x4f218b['type']!=='VIRTUAL'){var _0x3b0caf={};_0x3b0caf[_0x4f218b[_0x0ce5('0x30')]]={'$like':'%'+_0x454101[_0x0ce5('0x38')][_0x0ce5('0x43')]+'%'};return _0x3b0caf;}})});}_0x163541=_[_0x0ce5('0x45')]({},_0x163541,_0x454101[_0x0ce5('0x46')]);var _0x525c20={'where':_0x163541[_0x0ce5('0x44')]};return db[_0x0ce5('0x34')][_0x0ce5('0x26')](_0x525c20)[_0x0ce5('0x17')](function(_0x48e6c8){_0x4d5a1d[_0x0ce5('0x26')]=_0x48e6c8;if(_0x454101['query']['includeAll']){_0x163541[_0x0ce5('0x47')]=[{'all':!![]}];}return db[_0x0ce5('0x34')][_0x0ce5('0x48')](_0x163541);})[_0x0ce5('0x17')](function(_0x3a3ec5){_0x4d5a1d[_0x0ce5('0x49')]=_0x3a3ec5;return _0x4d5a1d;})[_0x0ce5('0x17')](respondWithFilteredResult(_0x19c9a4,_0x163541))[_0x0ce5('0x20')](handleError(_0x19c9a4,null));};exports[_0x0ce5('0x4a')]=function(_0x41607c,_0x3eded5){var _0x40e47c={'raw':!![],'where':{'id':_0x41607c[_0x0ce5('0x4b')]['id']}},_0x5629f4={};_0x5629f4['model']=_[_0x0ce5('0x4c')](db['Network']['rawAttributes']);_0x5629f4['query']=_[_0x0ce5('0x4c')](_0x41607c['query']);_0x5629f4['filters']=_['intersection'](_0x5629f4[_0x0ce5('0x3b')],_0x5629f4[_0x0ce5('0x38')]);_0x40e47c[_0x0ce5('0x3c')]=_[_0x0ce5('0x3a')](_0x5629f4['model'],qs['fields'](_0x41607c[_0x0ce5('0x38')][_0x0ce5('0x3d')]));_0x40e47c[_0x0ce5('0x3c')]=_0x40e47c[_0x0ce5('0x3c')][_0x0ce5('0x3e')]?_0x40e47c[_0x0ce5('0x3c')]:_0x5629f4[_0x0ce5('0x3b')];if(_0x41607c[_0x0ce5('0x38')][_0x0ce5('0x4d')]){_0x40e47c[_0x0ce5('0x47')]=[{'all':!![]}];}_0x40e47c=_[_0x0ce5('0x45')]({},_0x40e47c,_0x41607c[_0x0ce5('0x46')]);return db[_0x0ce5('0x34')][_0x0ce5('0x4e')](_0x40e47c)[_0x0ce5('0x17')](handleEntityNotFound(_0x3eded5,null))[_0x0ce5('0x17')](respondWithResult(_0x3eded5,null))[_0x0ce5('0x20')](handleError(_0x3eded5,null));};exports[_0x0ce5('0x4f')]=function(_0x1be40d,_0x5462bf,_0x1c2442){var _0x4c6377;return db[_0x0ce5('0x50')][_0x0ce5('0x51')](function(_0xe7f050){return db[_0x0ce5('0x34')][_0x0ce5('0x4f')](_0x1be40d[_0x0ce5('0x52')],{'raw':!![]})[_0x0ce5('0x17')](function(_0x42222c){_0x4c6377=_0x42222c;return db[_0x0ce5('0x34')][_0x0ce5('0x48')]({'where':{'type':_0x1be40d[_0x0ce5('0x52')][_0x0ce5('0x36')]},'raw':!![]});})[_0x0ce5('0x17')](function(_0x122ca3){if(_0x4c6377[_0x0ce5('0x36')][_0x0ce5('0x53')]()==_0x0ce5('0x54')){var _0xa669ac=fs[_0x0ce5('0x55')](path[_0x0ce5('0x56')](config[_0x0ce5('0x57')],_0x0ce5('0x58')),_0x0ce5('0x59'));var _0x2ea5f5=ejs[_0x0ce5('0x5a')](_0xa669ac,{'networks':_0x122ca3||[]});fs[_0x0ce5('0x5b')](_0x0ce5('0x5c'),_0x2ea5f5);return respondWithRpcPromise(_0x0ce5('0x5d'),_0x0ce5('0x4f'),{'module':_0x0ce5('0x5e')});}else if(_0x4c6377[_0x0ce5('0x36')][_0x0ce5('0x53')]()==_0x0ce5('0x5f')){var _0x1179fa=fs[_0x0ce5('0x55')](path[_0x0ce5('0x56')](config[_0x0ce5('0x57')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x5931fe=ejs['render'](_0x1179fa,{'networks':_0x122ca3||[]});fs['writeFileSync'](_0x0ce5('0x60'),_0x5931fe);return respondWithRpcPromise(_0x0ce5('0x5d'),_0x0ce5('0x4f'),{'module':_0x0ce5('0x5e')});}else{var _0x29cedd=fs[_0x0ce5('0x55')](path[_0x0ce5('0x56')](config[_0x0ce5('0x57')],_0x0ce5('0x61')),_0x0ce5('0x59'));var _0x3f6301=ejs[_0x0ce5('0x5a')](_0x29cedd,{'networks':_0x122ca3||[]});fs['writeFileSync'](util[_0x0ce5('0x62')](_0x0ce5('0x63'),_0x1be40d['body'][_0x0ce5('0x36')][_0x0ce5('0x64')]()),_0x3f6301);return respondWithRpcPromise(_0x0ce5('0x5d'),_0x0ce5('0x4f'),{'module':_0x0ce5('0x65')});}return null;})[_0x0ce5('0x17')](function(){return _0x4c6377;});})[_0x0ce5('0x17')](respondWithResult(_0x5462bf,0xc9))[_0x0ce5('0x20')](handleError(_0x5462bf,null));};exports[_0x0ce5('0x2e')]=function(_0x2e8922,_0x562092,_0x1b19ac){var _0x42efa9;return db[_0x0ce5('0x50')][_0x0ce5('0x51')](function(_0x12c8b8){return db[_0x0ce5('0x34')]['find']({'where':{'id':_0x2e8922[_0x0ce5('0x4b')]['id']}})[_0x0ce5('0x17')](handleEntityNotFound(_0x562092,null))[_0x0ce5('0x17')](saveUpdates(_0x2e8922[_0x0ce5('0x52')],null))[_0x0ce5('0x17')](function(_0x429410){if(_0x429410){_0x42efa9=_0x429410;return db['Network'][_0x0ce5('0x48')]({'where':{'type':_0x42efa9[_0x0ce5('0x36')]},'raw':!![]});}return null;})[_0x0ce5('0x17')](function(_0x4b5076){if(_0x42efa9[_0x0ce5('0x36')][_0x0ce5('0x53')]()=='STUN'){var _0x134d30=fs[_0x0ce5('0x55')](path['join'](config[_0x0ce5('0x57')],_0x0ce5('0x58')),_0x0ce5('0x59'));var _0x2ba60c=ejs['render'](_0x134d30,{'networks':_0x4b5076||[]});fs[_0x0ce5('0x5b')](_0x0ce5('0x5c'),_0x2ba60c);return respondWithRpcPromise('Reload',_0x0ce5('0x2e'),{'module':_0x0ce5('0x5e')});}else if(_0x42efa9['type']['toUpperCase']()==_0x0ce5('0x5f')){var _0x1ea4c7=fs[_0x0ce5('0x55')](path['join'](config[_0x0ce5('0x57')],_0x0ce5('0x66')),_0x0ce5('0x59'));var _0x58597b=ejs[_0x0ce5('0x5a')](_0x1ea4c7,{'networks':_0x4b5076||[]});fs[_0x0ce5('0x5b')]('/etc/asterisk/turn_xcally.conf',_0x58597b);return respondWithRpcPromise(_0x0ce5('0x5d'),_0x0ce5('0x2e'),{'module':'res_stun_monitor.so'});}else{var _0x1bfc4f=fs[_0x0ce5('0x55')](path[_0x0ce5('0x56')](config[_0x0ce5('0x57')],'server/files/templates/network.ejs'),_0x0ce5('0x59'));var _0x1eacc4=ejs[_0x0ce5('0x5a')](_0x1bfc4f,{'networks':_0x4b5076||[]});fs[_0x0ce5('0x5b')](util['format'](_0x0ce5('0x63'),_0x2e8922[_0x0ce5('0x52')][_0x0ce5('0x36')][_0x0ce5('0x64')]()),_0x1eacc4);return respondWithRpcPromise(_0x0ce5('0x5d'),'update',{'module':'chan_sip.so'});}return null;})[_0x0ce5('0x17')](function(_0xd070b5){if(_0xd070b5){return _0x42efa9;}return null;});})[_0x0ce5('0x17')](respondWithResult(_0x562092,null))['catch'](handleError(_0x562092,null));};exports[_0x0ce5('0x67')]=function(_0x424884,_0x2b2189,_0x1741c6){var _0x154ef3;return db[_0x0ce5('0x34')][_0x0ce5('0x4e')]({'where':{'id':_0x424884[_0x0ce5('0x4b')]['id']}})['then'](function(_0x23ab40){_0x154ef3=_0x23ab40;return _0x23ab40;})[_0x0ce5('0x17')](handleEntityNotFound(_0x2b2189,null))[_0x0ce5('0x17')](removeEntity(_0x2b2189,null))[_0x0ce5('0x17')](function(){if(_0x154ef3){return db[_0x0ce5('0x34')][_0x0ce5('0x48')]({'where':{'type':_0x154ef3[_0x0ce5('0x36')]},'raw':!![]});}})['then'](function(_0x216280){if(_0x154ef3['type']['toUpperCase']()==_0x0ce5('0x54')){var _0x415068=fs[_0x0ce5('0x55')](path['join'](config[_0x0ce5('0x57')],_0x0ce5('0x58')),_0x0ce5('0x59'));var _0xe8a509=ejs[_0x0ce5('0x5a')](_0x415068,{'networks':_0x216280||[]});fs[_0x0ce5('0x5b')](_0x0ce5('0x5c'),_0xe8a509);return respondWithRpcPromise(_0x0ce5('0x5d'),_0x0ce5('0x67'),{'module':_0x0ce5('0x5e')});}else if(_0x154ef3[_0x0ce5('0x36')][_0x0ce5('0x53')]()==_0x0ce5('0x5f')){var _0x4081e1=fs[_0x0ce5('0x55')](path['join'](config[_0x0ce5('0x57')],'server/files/templates/turn_multiple.ejs'),_0x0ce5('0x59'));var _0x1e20e1=ejs[_0x0ce5('0x5a')](_0x4081e1,{'networks':_0x216280||[]});fs['writeFileSync'](_0x0ce5('0x60'),_0x1e20e1);return respondWithRpcPromise(_0x0ce5('0x5d'),'destroy',{'module':'res_stun_monitor.so'});}else{var _0x4659fb=fs[_0x0ce5('0x55')](path['join'](config['root'],_0x0ce5('0x61')),'utf8');var _0x45b0ca=ejs[_0x0ce5('0x5a')](_0x4659fb,{'networks':_0x216280||[]});fs['writeFileSync'](util[_0x0ce5('0x62')]('/etc/asterisk/sip_xcally_%s.conf',_0x424884[_0x0ce5('0x52')][_0x0ce5('0x36')][_0x0ce5('0x64')]()),_0x45b0ca);return respondWithRpcPromise(_0x0ce5('0x5d'),_0x0ce5('0x67'),{'module':'chan_sip.so'});}return null;})[_0x0ce5('0x20')](handleError(_0x2b2189,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 35362e7..40754ca 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 _0x34e5=['request-promise','path','../../config/environment','./network.attributes','exports','define','Network','util','api','moment','bluebird'];(function(_0x2562aa,_0x333cc5){var _0x1d2f74=function(_0x54b4fb){while(--_0x54b4fb){_0x2562aa['push'](_0x2562aa['shift']());}};_0x1d2f74(++_0x333cc5);}(_0x34e5,0x172));var _0x534e=function(_0x52baa8,_0x63d620){_0x52baa8=_0x52baa8-0x0;var _0x21bb3d=_0x34e5[_0x52baa8];return _0x21bb3d;};'use strict';var _=require('lodash');var util=require(_0x534e('0x0'));var logger=require('../../config/logger')(_0x534e('0x1'));var moment=require(_0x534e('0x2'));var BPromise=require(_0x534e('0x3'));var rp=require(_0x534e('0x4'));var fs=require('fs');var path=require(_0x534e('0x5'));var rimraf=require('rimraf');var config=require(_0x534e('0x6'));var attributes=require(_0x534e('0x7'));module[_0x534e('0x8')]=function(_0x117f0c,_0x436a92){return _0x117f0c[_0x534e('0x9')](_0x534e('0xa'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41bb=['bluebird','request-promise','path','rimraf','./network.attributes','exports','network','lodash','util','api'];(function(_0xfe59d5,_0x184f5d){var _0x488670=function(_0x401dcf){while(--_0x401dcf){_0xfe59d5['push'](_0xfe59d5['shift']());}};_0x488670(++_0x184f5d);}(_0x41bb,0xc5));var _0xb41b=function(_0x426fcf,_0x5b7ca1){_0x426fcf=_0x426fcf-0x0;var _0x4780ce=_0x41bb[_0x426fcf];return _0x4780ce;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var logger=require('../../config/logger')(_0xb41b('0x2'));var moment=require('moment');var BPromise=require(_0xb41b('0x3'));var rp=require(_0xb41b('0x4'));var fs=require('fs');var path=require(_0xb41b('0x5'));var rimraf=require(_0xb41b('0x6'));var config=require('../../config/environment');var attributes=require(_0xb41b('0x7'));module[_0xb41b('0x8')]=function(_0x2dbaa3,_0x50bc62){return _0x2dbaa3['define']('Network',attributes,{'tableName':_0xb41b('0x9'),'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 d5c8d62..21cb6c3 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(_0x4b998e,_0x550e01){var _0x3a6c2b=function(_0x21532a){while(--_0x21532a){_0x4b998e['push'](_0x4b998e['shift']());}};_0x3a6c2b(++_0x550e01);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x52cef8,_0x31b070){_0x52cef8=_0x52cef8-0x0;var _0x141d47=_0x7a54[_0x52cef8];return _0x141d47;};'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 9701264..751eb55 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 _0x7ca3=['/:id/users','addAgents','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','index','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','getAgents','post','addDisposition','addAnswer','/:id/notify','notify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7ca3,0x1ec));var _0x37ca=function(_0x474a72,_0x439f5a){_0x474a72=_0x474a72-0x0;var _0x304966=_0x7ca3[_0x474a72];return _0x304966;};'use strict';var multer=require('multer');var util=require(_0x37ca('0x0'));var path=require('path');var timeout=require(_0x37ca('0x1'));var express=require(_0x37ca('0x2'));var router=express[_0x37ca('0x3')]();var fs_extra=require(_0x37ca('0x4'));var auth=require(_0x37ca('0x5'));var interaction=require(_0x37ca('0x6'));var config=require('../../config/environment');var controller=require(_0x37ca('0x7'));router[_0x37ca('0x8')]('/',auth['isAuthenticated'](),controller[_0x37ca('0x9')]);router[_0x37ca('0x8')]('/describe',auth[_0x37ca('0xa')](),controller[_0x37ca('0xb')]);router[_0x37ca('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x37ca('0xc')]);router[_0x37ca('0x8')](_0x37ca('0xd'),auth[_0x37ca('0xa')](),controller[_0x37ca('0xe')]);router[_0x37ca('0x8')](_0x37ca('0xf'),auth[_0x37ca('0xa')](),controller[_0x37ca('0x10')]);router[_0x37ca('0x8')]('/:id/applications',auth[_0x37ca('0xa')](),controller[_0x37ca('0x11')]);router[_0x37ca('0x8')](_0x37ca('0x12'),auth[_0x37ca('0xa')](),controller[_0x37ca('0x13')]);router['get']('/:id/users',auth[_0x37ca('0xa')](),controller[_0x37ca('0x14')]);router[_0x37ca('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0x37ca('0x15')]('/:id/dispositions',auth[_0x37ca('0xa')](),controller[_0x37ca('0x16')]);router[_0x37ca('0x15')](_0x37ca('0xf'),auth['isAuthenticated'](),controller[_0x37ca('0x17')]);router['post'](_0x37ca('0x18'),controller[_0x37ca('0x19')]);router[_0x37ca('0x15')]('/:id/applications',auth[_0x37ca('0xa')](),controller['addApplications']);router[_0x37ca('0x15')](_0x37ca('0x1a'),auth[_0x37ca('0xa')](),controller[_0x37ca('0x1b')]);router[_0x37ca('0x15')](_0x37ca('0x1c'),auth[_0x37ca('0xa')](),controller[_0x37ca('0x1d')]);router[_0x37ca('0x1e')](_0x37ca('0x1f'),auth[_0x37ca('0xa')](),controller[_0x37ca('0x20')]);router[_0x37ca('0x21')]('/:id',auth[_0x37ca('0xa')](),controller[_0x37ca('0x22')]);router[_0x37ca('0x21')](_0x37ca('0xd'),auth[_0x37ca('0xa')](),controller[_0x37ca('0x23')]);router[_0x37ca('0x21')]('/:id/canned_answers',auth[_0x37ca('0xa')](),controller['removeAnswers']);router[_0x37ca('0x21')](_0x37ca('0x1a'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x37ca('0x24')]=router; \ No newline at end of file +var _0x6d28=['index','get','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getAgents','post','create','addDisposition','/:id/notify','notify','addApplications','/:id/users','addAgents','/:id/send','send','put','update','destroy','delete','removeAnswers','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelAccount.controller','isAuthenticated'];(function(_0x4fa892,_0x4e66a0){var _0x260ef6=function(_0x3ac4a5){while(--_0x3ac4a5){_0x4fa892['push'](_0x4fa892['shift']());}};_0x260ef6(++_0x4e66a0);}(_0x6d28,0xb0));var _0x86d2=function(_0x3a04ab,_0x31b9fd){_0x3a04ab=_0x3a04ab-0x0;var _0x4bff6d=_0x6d28[_0x3a04ab];return _0x4bff6d;};'use strict';var multer=require(_0x86d2('0x0'));var util=require(_0x86d2('0x1'));var path=require(_0x86d2('0x2'));var timeout=require('connect-timeout');var express=require(_0x86d2('0x3'));var router=express['Router']();var fs_extra=require(_0x86d2('0x4'));var auth=require(_0x86d2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x86d2('0x6'));var controller=require(_0x86d2('0x7'));router['get']('/',auth[_0x86d2('0x8')](),controller[_0x86d2('0x9')]);router[_0x86d2('0xa')](_0x86d2('0xb'),auth[_0x86d2('0x8')](),controller['describe']);router['get'](_0x86d2('0xc'),auth[_0x86d2('0x8')](),controller[_0x86d2('0xd')]);router['get'](_0x86d2('0xe'),auth[_0x86d2('0x8')](),controller[_0x86d2('0xf')]);router[_0x86d2('0xa')](_0x86d2('0x10'),auth[_0x86d2('0x8')](),controller[_0x86d2('0x11')]);router[_0x86d2('0xa')](_0x86d2('0x12'),auth[_0x86d2('0x8')](),controller[_0x86d2('0x13')]);router[_0x86d2('0xa')](_0x86d2('0x14'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x86d2('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0x86d2('0x15')]);router[_0x86d2('0x16')]('/',auth[_0x86d2('0x8')](),controller[_0x86d2('0x17')]);router[_0x86d2('0x16')]('/:id/dispositions',auth[_0x86d2('0x8')](),controller[_0x86d2('0x18')]);router['post'](_0x86d2('0x10'),auth[_0x86d2('0x8')](),controller['addAnswer']);router[_0x86d2('0x16')](_0x86d2('0x19'),controller[_0x86d2('0x1a')]);router[_0x86d2('0x16')]('/:id/applications',auth[_0x86d2('0x8')](),controller[_0x86d2('0x1b')]);router[_0x86d2('0x16')](_0x86d2('0x1c'),auth[_0x86d2('0x8')](),controller[_0x86d2('0x1d')]);router[_0x86d2('0x16')](_0x86d2('0x1e'),auth[_0x86d2('0x8')](),controller[_0x86d2('0x1f')]);router[_0x86d2('0x20')](_0x86d2('0xc'),auth[_0x86d2('0x8')](),controller[_0x86d2('0x21')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x86d2('0x22')]);router[_0x86d2('0x23')]('/:id/dispositions',auth[_0x86d2('0x8')](),controller['removeDispositions']);router[_0x86d2('0x23')]('/:id/canned_answers',auth[_0x86d2('0x8')](),controller[_0x86d2('0x24')]);router[_0x86d2('0x23')](_0x86d2('0x1c'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 4289c16..42afe89 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 _0x07c1=['sequelize','exports','STRING','name','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId'];(function(_0x492137,_0xf3da28){var _0x315947=function(_0x4444f2){while(--_0x4444f2){_0x492137['push'](_0x492137['shift']());}};_0x315947(++_0xf3da28);}(_0x07c1,0xc6));var _0x107c=function(_0x3d0598,_0x52ebe9){_0x3d0598=_0x3d0598-0x0;var _0x522674=_0x07c1[_0x3d0598];return _0x522674;};'use strict';var Sequelize=require(_0x107c('0x0'));var rs=require('randomstring');module[_0x107c('0x1')]={'name':{'type':Sequelize[_0x107c('0x2')],'unique':_0x107c('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x107c('0x2')]},'token':{'type':Sequelize[_0x107c('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x107c('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x107c('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x107c('0x4')],'defaultValue':function(){return _0x107c('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x107c('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x107c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x107c('0x2')]},'queueTransfer':{'type':Sequelize[_0x107c('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x107c('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x107c('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x107c('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xe2187a){if(!_0xe2187a)this[_0x107c('0x9')](_0x107c('0xa'),null);this[_0x107c('0x9')]('mandatoryDisposition',_0xe2187a);}}}; \ No newline at end of file +var _0x584b=['generate','BOOLEAN','INTEGER','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name'];(function(_0x3a758d,_0xbca29f){var _0x46f386=function(_0x581f4b){while(--_0x581f4b){_0x3a758d['push'](_0x3a758d['shift']());}};_0x46f386(++_0xbca29f);}(_0x584b,0xa0));var _0xb584=function(_0x286bfb,_0x46ac3c){_0x286bfb=_0x286bfb-0x0;var _0x52b683=_0x584b[_0x286bfb];return _0x52b683;};'use strict';var Sequelize=require(_0xb584('0x0'));var rs=require(_0xb584('0x1'));module[_0xb584('0x2')]={'name':{'type':Sequelize[_0xb584('0x3')],'unique':_0xb584('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xb584('0x3')],'defaultValue':function(){return rs[_0xb584('0x5')]();}},'replyUri':{'type':Sequelize[_0xb584('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xb584('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xb584('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb584('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb584('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xb584('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb584('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb584('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb584('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xb584('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x110f28){if(!_0x110f28)this[_0xb584('0x8')](_0xb584('0x9'),null);this['setDataValue'](_0xb584('0xa'),_0x110f28);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 84cddee..9695174 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 _0x084c=['send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','Disposition','hasOwnProperty','OpenchannelAccountId','removeDispositions','ids','addAnswer','findOne','CannedAnswer','removeAnswers','notify','openchannel','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','applications','Applications','orderBy','priority','asc','account','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','firstName','messageId','interaction','created','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','agent','forcedOwnership','startRouting','Start','EventManager','transaction','OpenchannelApplication','bulkCreate','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','tag','addAgents','omit','spread','removeAgents','emit','userOpenchannelAccount:remove','getAgents','CmList','dataValues','Messages','push','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','sendStatus','status','end','json','undefined','limit','count','offset','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0x084c,0x7c));var _0xc084=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x084c[_0x5d6456];return _0x4d66c1;};'use strict';var emlformat=require(_0xc084('0x0'));var rimraf=require(_0xc084('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc084('0x2'));var rp=require('request-promise');var moment=require(_0xc084('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc084('0x4'));var util=require(_0xc084('0x5'));var path=require(_0xc084('0x6'));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(_0xc084('0x7'));var squel=require(_0xc084('0x8'));var crypto=require(_0xc084('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc084('0xa'));var querystring=require(_0xc084('0xb'));var Papa=require(_0xc084('0xc'));var Redis=require(_0xc084('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc084('0xe'));var as=require(_0xc084('0xf'));var hardwareService=require(_0xc084('0x10'));var logger=require(_0xc084('0x11'))(_0xc084('0x12'));var utils=require(_0xc084('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc084('0x14'));var db=require(_0xc084('0x15'))['db'];config[_0xc084('0x16')]=_[_0xc084('0x17')](config['redis'],{'host':_0xc084('0x18'),'port':0x18eb});var socket=require(_0xc084('0x19'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0xc084('0x1a')](socket);var jayson=require(_0xc084('0x1b'));var client=jayson[_0xc084('0x1c')][_0xc084('0x1d')]({'port':0x232c});var client9002=jayson[_0xc084('0x1c')][_0xc084('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0xbd70c5,_0x31e662,_0x3a4f9f,_0x583500){return new BPromise(function(_0x19191f,_0x3e3510){var _0x442db3=_0x583500||client;return _0x442db3[_0xc084('0x1e')](_0xbd70c5,_0x3a4f9f)[_0xc084('0x1f')](function(_0x421526){logger[_0xc084('0x20')](_0xc084('0x21'),_0x31e662,'request\x20sent');logger[_0xc084('0x22')](_0xc084('0x23'),_0x31e662,'request\x20sent',JSON[_0xc084('0x24')](_0x421526));if(_0x421526['error']){if(_0x421526[_0xc084('0x25')][_0xc084('0x26')]===0x1f4){logger[_0xc084('0x25')](_0xc084('0x21'),_0x31e662,_0x421526['error'][_0xc084('0x27')]);return _0x3e3510(_0x421526[_0xc084('0x25')][_0xc084('0x27')]);}logger[_0xc084('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x31e662,_0x421526[_0xc084('0x25')][_0xc084('0x27')]);return _0x19191f(_0x421526['error'][_0xc084('0x27')]);}else{logger[_0xc084('0x20')](_0xc084('0x21'),_0x31e662,_0xc084('0x28'));_0x19191f(_0x421526[_0xc084('0x29')][_0xc084('0x27')]);}})['catch'](function(_0x41f734){logger[_0xc084('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x31e662,_0x41f734);_0x3e3510(_0x41f734);});});}function respondWithStatusCode(_0x4507a0,_0x1bbc19){_0x1bbc19=_0x1bbc19||0xcc;return function(_0x2bb0e7){if(_0x2bb0e7){return _0x4507a0[_0xc084('0x2a')](_0x1bbc19);}return _0x4507a0[_0xc084('0x2b')](_0x1bbc19)[_0xc084('0x2c')]();};}function respondWithResult(_0x100264,_0x4e8dee){_0x4e8dee=_0x4e8dee||0xc8;return function(_0x21a545){if(_0x21a545){return _0x100264[_0xc084('0x2b')](_0x4e8dee)[_0xc084('0x2d')](_0x21a545);}};}function respondWithFilteredResult(_0xf2b5e5,_0x52a42b){return function(_0x454ea2){if(_0x454ea2){var _0x27dfc6=typeof _0x52a42b['offset']===_0xc084('0x2e')&&typeof _0x52a42b[_0xc084('0x2f')]===_0xc084('0x2e');var _0x2204b7=_0x454ea2[_0xc084('0x30')];var _0x5da262=_0x27dfc6?0x0:_0x52a42b[_0xc084('0x31')];var _0x3db8d4=_0x27dfc6?_0x454ea2[_0xc084('0x30')]:_0x52a42b[_0xc084('0x31')]+_0x52a42b[_0xc084('0x2f')];var _0x25f579;if(_0x3db8d4>=_0x2204b7){_0x3db8d4=_0x2204b7;_0x25f579=0xc8;}else{_0x25f579=0xce;}_0xf2b5e5[_0xc084('0x2b')](_0x25f579);return _0xf2b5e5['set']('Content-Range',_0x5da262+'-'+_0x3db8d4+'/'+_0x2204b7)[_0xc084('0x2d')](_0x454ea2);}return null;};}function patchUpdates(_0x533da){return function(_0x46fc92){try{jsonpatch['apply'](_0x46fc92,_0x533da,!![]);}catch(_0x1d37e7){return BPromise[_0xc084('0x32')](_0x1d37e7);}return _0x46fc92[_0xc084('0x33')]();};}function saveUpdates(_0x2ea1fe,_0x126bd2){return function(_0x5df761){if(_0x5df761){return _0x5df761[_0xc084('0x34')](_0x2ea1fe)['then'](function(_0x109d1f){return _0x109d1f;});}return null;};}function removeEntity(_0x41b13d,_0x52ceda){return function(_0x2d6c66){if(_0x2d6c66){return _0x2d6c66[_0xc084('0x35')]()[_0xc084('0x1f')](function(){var _0xc9914=_0x2d6c66[_0xc084('0x36')]({'plain':!![]});var _0x294a4b=_0xc084('0x37');return db[_0xc084('0x38')]['destroy']({'where':{'type':_0x294a4b,'resourceId':_0xc9914['id']}})[_0xc084('0x1f')](function(){return _0x2d6c66;});})[_0xc084('0x1f')](function(){_0x41b13d[_0xc084('0x2b')](0xcc)[_0xc084('0x2c')]();});}};}function handleEntityNotFound(_0x5b7bd4,_0x71221a){return function(_0x1c5995){if(!_0x1c5995){_0x5b7bd4['sendStatus'](0x194);}return _0x1c5995;};}function handleError(_0x55673c,_0x1b575b){_0x1b575b=_0x1b575b||0x1f4;return function(_0x5e18b9){logger['error'](_0x5e18b9[_0xc084('0x39')]);if(_0x5e18b9[_0xc084('0x3a')]){delete _0x5e18b9[_0xc084('0x3a')];}_0x55673c[_0xc084('0x2b')](_0x1b575b)[_0xc084('0x3b')](_0x5e18b9);};}exports[_0xc084('0x3c')]=function(_0x421f4c,_0x55dea8){var _0x51ea52={'include':[{'model':db[_0xc084('0x3d')],'as':_0xc084('0x3e')}]},_0x38ffa6={},_0x143a28={'count':0x0,'rows':[]};var _0x5b24f1=_[_0xc084('0x3f')](db[_0xc084('0x40')][_0xc084('0x41')],function(_0x5c534d){return{'name':_0x5c534d[_0xc084('0x42')],'type':_0x5c534d[_0xc084('0x43')][_0xc084('0x44')]};});_0x38ffa6[_0xc084('0x45')]=_[_0xc084('0x3f')](_0x5b24f1,_0xc084('0x3a'));_0x38ffa6['query']=_[_0xc084('0x46')](_0x421f4c[_0xc084('0x47')]);_0x38ffa6[_0xc084('0x48')]=_[_0xc084('0x49')](_0x38ffa6[_0xc084('0x45')],_0x38ffa6[_0xc084('0x47')]);_0x51ea52[_0xc084('0x4a')]=_[_0xc084('0x49')](_0x38ffa6[_0xc084('0x45')],qs[_0xc084('0x4b')](_0x421f4c['query'][_0xc084('0x4b')]));_0x51ea52[_0xc084('0x4a')]=_0x51ea52[_0xc084('0x4a')]['length']?_0x51ea52[_0xc084('0x4a')]:_0x38ffa6[_0xc084('0x45')];if(!_0x421f4c['query']['hasOwnProperty'](_0xc084('0x4c'))){_0x51ea52[_0xc084('0x2f')]=qs[_0xc084('0x2f')](_0x421f4c[_0xc084('0x47')][_0xc084('0x2f')]);_0x51ea52[_0xc084('0x31')]=qs[_0xc084('0x31')](_0x421f4c[_0xc084('0x47')][_0xc084('0x31')]);}_0x51ea52[_0xc084('0x4d')]=qs[_0xc084('0x4e')](_0x421f4c[_0xc084('0x47')][_0xc084('0x4e')]);_0x51ea52[_0xc084('0x4f')]=qs[_0xc084('0x48')](_[_0xc084('0x50')](_0x421f4c[_0xc084('0x47')],_0x38ffa6['filters']),_0x5b24f1);if(_0x421f4c[_0xc084('0x47')][_0xc084('0x51')]){_0x51ea52[_0xc084('0x4f')]=_[_0xc084('0x52')](_0x51ea52[_0xc084('0x4f')],{'$or':_['map'](_0x5b24f1,function(_0x48075){if(_0x48075['type']!==_0xc084('0x53')){var _0x5ae1da={};_0x5ae1da[_0x48075['name']]={'$like':'%'+_0x421f4c[_0xc084('0x47')]['filter']+'%'};return _0x5ae1da;}})});}_0x51ea52=_[_0xc084('0x52')]({},_0x51ea52,_0x421f4c[_0xc084('0x54')]);var _0x50289a={'where':_0x51ea52[_0xc084('0x4f')]};return db['OpenchannelAccount'][_0xc084('0x30')](_0x50289a)[_0xc084('0x1f')](function(_0x82b374){_0x143a28[_0xc084('0x30')]=_0x82b374;if(_0x421f4c[_0xc084('0x47')][_0xc084('0x55')]){_0x51ea52[_0xc084('0x56')]=[{'all':!![]}];}return db[_0xc084('0x40')][_0xc084('0x57')](_0x51ea52);})[_0xc084('0x1f')](function(_0x2797b6){_0x143a28[_0xc084('0x58')]=_0x2797b6;return _0x143a28;})[_0xc084('0x1f')](respondWithFilteredResult(_0x55dea8,_0x51ea52))['catch'](handleError(_0x55dea8,null));};exports[_0xc084('0x59')]=function(_0x7c8433,_0x5035a0){var _0xa5c8d6={'raw':![],'where':{'id':_0x7c8433[_0xc084('0x5a')]['id']},'include':[{'model':db[_0xc084('0x3d')],'as':_0xc084('0x3e')}]},_0x11ab13={};_0x11ab13[_0xc084('0x45')]=_[_0xc084('0x46')](db['OpenchannelAccount'][_0xc084('0x41')]);_0x11ab13[_0xc084('0x47')]=_['keys'](_0x7c8433[_0xc084('0x47')]);_0x11ab13[_0xc084('0x48')]=_[_0xc084('0x49')](_0x11ab13[_0xc084('0x45')],_0x11ab13['query']);_0xa5c8d6[_0xc084('0x4a')]=_[_0xc084('0x49')](_0x11ab13[_0xc084('0x45')],qs[_0xc084('0x4b')](_0x7c8433['query'][_0xc084('0x4b')]));_0xa5c8d6[_0xc084('0x4a')]=_0xa5c8d6['attributes'][_0xc084('0x5b')]?_0xa5c8d6[_0xc084('0x4a')]:_0x11ab13[_0xc084('0x45')];if(_0x7c8433[_0xc084('0x47')][_0xc084('0x55')]){_0xa5c8d6[_0xc084('0x56')]=[{'all':!![]}];}_0xa5c8d6=_[_0xc084('0x52')]({},_0xa5c8d6,_0x7c8433[_0xc084('0x54')]);return db['OpenchannelAccount'][_0xc084('0x5c')](_0xa5c8d6)[_0xc084('0x1f')](handleEntityNotFound(_0x5035a0,null))[_0xc084('0x1f')](respondWithResult(_0x5035a0,null))[_0xc084('0x5d')](handleError(_0x5035a0,null));};exports[_0xc084('0x5e')]=function(_0x4d8b5d,_0x54c508){return db[_0xc084('0x40')][_0xc084('0x5e')](_0x4d8b5d[_0xc084('0x5f')],{})[_0xc084('0x1f')](function(_0x269665){var _0x17ec4d=_0x4d8b5d['user'][_0xc084('0x36')]({'plain':!![]});if(!_0x17ec4d)throw new Error(_0xc084('0x60'));if(_0x17ec4d[_0xc084('0x61')]===_0xc084('0x62')){var _0x179f08=_0x269665[_0xc084('0x36')]({'plain':!![]});var _0x4c8faa=_0xc084('0x37');return db[_0xc084('0x63')][_0xc084('0x5c')]({'where':{'name':_0x4c8faa,'userProfileId':_0x17ec4d[_0xc084('0x64')]},'raw':!![]})['then'](function(_0x1bd45e){if(_0x1bd45e&&_0x1bd45e['autoAssociation']===0x0){return db[_0xc084('0x38')]['create']({'name':_0x179f08[_0xc084('0x3a')],'resourceId':_0x179f08['id'],'type':_0x1bd45e[_0xc084('0x3a')],'sectionId':_0x1bd45e['id']},{})[_0xc084('0x1f')](function(){return _0x269665;});}else{return _0x269665;}})['catch'](function(_0x121d49){logger[_0xc084('0x25')](_0xc084('0x65'),_0x121d49);throw _0x121d49;});}return _0x269665;})[_0xc084('0x1f')](respondWithResult(_0x54c508,0xc9))[_0xc084('0x5d')](handleError(_0x54c508,null));};exports['update']=function(_0x22be70,_0x44a019){if(_0x22be70[_0xc084('0x5f')]['id']){delete _0x22be70[_0xc084('0x5f')]['id'];}return db[_0xc084('0x40')][_0xc084('0x5c')]({'where':{'id':_0x22be70[_0xc084('0x5a')]['id']},'include':[{'model':db[_0xc084('0x3d')],'as':_0xc084('0x3e')}]})[_0xc084('0x1f')](handleEntityNotFound(_0x44a019,null))[_0xc084('0x1f')](saveUpdates(_0x22be70[_0xc084('0x5f')],null))[_0xc084('0x1f')](respondWithResult(_0x44a019,null))[_0xc084('0x5d')](handleError(_0x44a019,null));};exports[_0xc084('0x35')]=function(_0x40d0a9,_0x438671){return db[_0xc084('0x40')][_0xc084('0x5c')]({'where':{'id':_0x40d0a9[_0xc084('0x5a')]['id']}})[_0xc084('0x1f')](handleEntityNotFound(_0x438671,null))[_0xc084('0x1f')](removeEntity(_0x438671,null))['catch'](handleError(_0x438671,null));};exports['describe']=function(_0x525565,_0x3729fc){return db['OpenchannelAccount']['describe']()[_0xc084('0x1f')](respondWithResult(_0x3729fc,null))['catch'](handleError(_0x3729fc,null));};exports[_0xc084('0x66')]=function(_0x5ea9d0,_0x26741d,_0x23442a){if(_0x5ea9d0[_0xc084('0x5f')]['id']){delete _0x5ea9d0['body']['id'];}return db[_0xc084('0x40')]['find']({'where':{'id':_0x5ea9d0[_0xc084('0x5a')]['id']}})['then'](handleEntityNotFound(_0x26741d,null))[_0xc084('0x1f')](function(_0xcaca54){if(_0xcaca54){_0x5ea9d0[_0xc084('0x5f')]['OpenchannelAccountId']=_0xcaca54['id'];return db[_0xc084('0x67')]['create'](_0x5ea9d0[_0xc084('0x5f')]);}})['then'](respondWithResult(_0x26741d,null))[_0xc084('0x5d')](handleError(_0x26741d,null));};exports['getDispositions']=function(_0x48d811,_0x5c6272,_0x4ef4c8){var _0x547910={'raw':![],'where':{}};var _0x3d75f2={};var _0x5e7037={'count':0x0,'rows':[]};return db[_0xc084('0x40')]['findOne']({'where':{'id':_0x48d811[_0xc084('0x5a')]['id']}})[_0xc084('0x1f')](handleEntityNotFound(_0x5c6272,null))[_0xc084('0x1f')](function(_0x12726d){if(_0x12726d){_0x3d75f2[_0xc084('0x45')]=_[_0xc084('0x46')](db[_0xc084('0x67')]['rawAttributes']);_0x3d75f2[_0xc084('0x47')]=_[_0xc084('0x46')](_0x48d811[_0xc084('0x47')]);_0x3d75f2[_0xc084('0x48')]=_[_0xc084('0x49')](_0x3d75f2[_0xc084('0x45')],_0x3d75f2[_0xc084('0x47')]);_0x547910[_0xc084('0x4a')]=_[_0xc084('0x49')](_0x3d75f2[_0xc084('0x45')],qs[_0xc084('0x4b')](_0x48d811[_0xc084('0x47')][_0xc084('0x4b')]));_0x547910[_0xc084('0x4a')]=_0x547910[_0xc084('0x4a')][_0xc084('0x5b')]?_0x547910[_0xc084('0x4a')]:_0x3d75f2[_0xc084('0x45')];if(!_0x48d811['query'][_0xc084('0x68')](_0xc084('0x4c'))){_0x547910['limit']=qs[_0xc084('0x2f')](_0x48d811[_0xc084('0x47')]['limit']);_0x547910['offset']=qs[_0xc084('0x31')](_0x48d811[_0xc084('0x47')][_0xc084('0x31')]);}_0x547910['order']=qs['sort'](_0x48d811[_0xc084('0x47')][_0xc084('0x4e')]);_0x547910[_0xc084('0x4f')]=qs['filters'](_[_0xc084('0x50')](_0x48d811[_0xc084('0x47')],_0x3d75f2['filters']));_0x547910[_0xc084('0x4f')][_0xc084('0x69')]=_0x12726d['id'];if(_0x48d811[_0xc084('0x47')][_0xc084('0x51')]){_0x547910[_0xc084('0x4f')]=_['merge'](_0x547910[_0xc084('0x4f')],{'$or':_[_0xc084('0x3f')](_0x547910['attributes'],function(_0x5d0770){var _0x654e59={};_0x654e59[_0x5d0770]={'$like':'%'+_0x48d811[_0xc084('0x47')]['filter']+'%'};return _0x654e59;})});}_0x547910=_[_0xc084('0x52')]({},_0x547910,_0x48d811['options']);return db[_0xc084('0x67')][_0xc084('0x30')]({'where':_0x547910[_0xc084('0x4f')]})[_0xc084('0x1f')](function(_0x1c5255){_0x5e7037[_0xc084('0x30')]=_0x1c5255;if(_0x48d811['query'][_0xc084('0x55')]){_0x547910[_0xc084('0x56')]=[{'all':!![]}];}return db[_0xc084('0x67')][_0xc084('0x57')](_0x547910);})[_0xc084('0x1f')](function(_0x56d2c1){_0x5e7037[_0xc084('0x58')]=_0x56d2c1;return _0x5e7037;});}})['then'](respondWithFilteredResult(_0x5c6272,_0x547910))['catch'](handleError(_0x5c6272,null));};exports['removeDispositions']=function(_0x19b7d2,_0x52cd1a,_0xe297be){return db[_0xc084('0x40')]['find']({'where':{'id':_0x19b7d2[_0xc084('0x5a')]['id']}})[_0xc084('0x1f')](handleEntityNotFound(_0x52cd1a,null))[_0xc084('0x1f')](function(_0x333d03){if(_0x333d03){return _0x333d03[_0xc084('0x6a')](_0x19b7d2['query'][_0xc084('0x6b')]);}})[_0xc084('0x1f')](respondWithStatusCode(_0x52cd1a,null))[_0xc084('0x5d')](handleError(_0x52cd1a,null));};exports[_0xc084('0x6c')]=function(_0x199eef,_0x3091b6,_0x4b5184){if(_0x199eef['body']['id']){delete _0x199eef['body']['id'];}return db[_0xc084('0x40')]['find']({'where':{'id':_0x199eef[_0xc084('0x5a')]['id']}})[_0xc084('0x1f')](handleEntityNotFound(_0x3091b6,null))['then'](function(_0xbaa94f){if(_0xbaa94f){_0x199eef['body'][_0xc084('0x69')]=_0xbaa94f['id'];return db['CannedAnswer']['create'](_0x199eef[_0xc084('0x5f')]);}})[_0xc084('0x1f')](respondWithResult(_0x3091b6,null))[_0xc084('0x5d')](handleError(_0x3091b6,null));};exports['getAnswers']=function(_0xa2bb08,_0x363e5e,_0x2cd2de){var _0x384933={'raw':![],'where':{}};var _0x18ac7b={};var _0x103d9a={'count':0x0,'rows':[]};return db[_0xc084('0x40')][_0xc084('0x6d')]({'where':{'id':_0xa2bb08[_0xc084('0x5a')]['id']}})[_0xc084('0x1f')](handleEntityNotFound(_0x363e5e,null))[_0xc084('0x1f')](function(_0x4e526c){if(_0x4e526c){_0x18ac7b[_0xc084('0x45')]=_[_0xc084('0x46')](db[_0xc084('0x6e')][_0xc084('0x41')]);_0x18ac7b[_0xc084('0x47')]=_['keys'](_0xa2bb08[_0xc084('0x47')]);_0x18ac7b[_0xc084('0x48')]=_[_0xc084('0x49')](_0x18ac7b['model'],_0x18ac7b[_0xc084('0x47')]);_0x384933[_0xc084('0x4a')]=_[_0xc084('0x49')](_0x18ac7b[_0xc084('0x45')],qs[_0xc084('0x4b')](_0xa2bb08['query']['fields']));_0x384933[_0xc084('0x4a')]=_0x384933[_0xc084('0x4a')][_0xc084('0x5b')]?_0x384933[_0xc084('0x4a')]:_0x18ac7b[_0xc084('0x45')];if(!_0xa2bb08[_0xc084('0x47')][_0xc084('0x68')](_0xc084('0x4c'))){_0x384933[_0xc084('0x2f')]=qs[_0xc084('0x2f')](_0xa2bb08[_0xc084('0x47')][_0xc084('0x2f')]);_0x384933[_0xc084('0x31')]=qs[_0xc084('0x31')](_0xa2bb08[_0xc084('0x47')][_0xc084('0x31')]);}_0x384933[_0xc084('0x4d')]=qs['sort'](_0xa2bb08['query'][_0xc084('0x4e')]);_0x384933[_0xc084('0x4f')]=qs[_0xc084('0x48')](_[_0xc084('0x50')](_0xa2bb08[_0xc084('0x47')],_0x18ac7b[_0xc084('0x48')]));_0x384933[_0xc084('0x4f')][_0xc084('0x69')]=_0x4e526c['id'];if(_0xa2bb08[_0xc084('0x47')][_0xc084('0x51')]){_0x384933['where']=_['merge'](_0x384933[_0xc084('0x4f')],{'$or':_[_0xc084('0x3f')](_0x384933[_0xc084('0x4a')],function(_0x5051d2){var _0xaae194={};_0xaae194[_0x5051d2]={'$like':'%'+_0xa2bb08[_0xc084('0x47')]['filter']+'%'};return _0xaae194;})});}_0x384933=_[_0xc084('0x52')]({},_0x384933,_0xa2bb08[_0xc084('0x54')]);return db[_0xc084('0x6e')][_0xc084('0x30')]({'where':_0x384933[_0xc084('0x4f')]})['then'](function(_0x43e75e){_0x103d9a[_0xc084('0x30')]=_0x43e75e;if(_0xa2bb08[_0xc084('0x47')]['includeAll']){_0x384933[_0xc084('0x56')]=[{'all':!![]}];}return db[_0xc084('0x6e')][_0xc084('0x57')](_0x384933);})[_0xc084('0x1f')](function(_0x2e08e3){_0x103d9a[_0xc084('0x58')]=_0x2e08e3;return _0x103d9a;});}})[_0xc084('0x1f')](respondWithFilteredResult(_0x363e5e,_0x384933))[_0xc084('0x5d')](handleError(_0x363e5e,null));};exports[_0xc084('0x6f')]=function(_0x51d845,_0x68dffc,_0x12087c){return db[_0xc084('0x40')][_0xc084('0x5c')]({'where':{'id':_0x51d845[_0xc084('0x5a')]['id']}})[_0xc084('0x1f')](handleEntityNotFound(_0x68dffc,null))[_0xc084('0x1f')](function(_0x15acce){if(_0x15acce){return _0x15acce[_0xc084('0x6f')](_0x51d845['query'][_0xc084('0x6b')]);}})[_0xc084('0x1f')](respondWithStatusCode(_0x68dffc,null))['catch'](handleError(_0x68dffc,null));};exports[_0xc084('0x70')]=function(_0x3c2e61,_0xd1b0e5,_0x4035ce){var _0x2cba3f={'body':_0x3c2e61[_0xc084('0x5f')],'channel':_0xc084('0x71')};var _0x3f5555=[];var _0x4317e9=[];var _0x5a6278={};var _0x5c7ec9=![];return db[_0xc084('0x72')][_0xc084('0x73')]()[_0xc084('0x1f')](function(_0x852ab7){if(!_0x852ab7){throw new db[(_0xc084('0x74'))][(_0xc084('0x75'))](_0xc084('0x76'));}_0x3f5555=_[_0xc084('0x77')](_['keys'](_0x852ab7),[_0xc084('0x78'),_0xc084('0x79')]);_0x4317e9=_[_0xc084('0x77')](_[_0xc084('0x46')](_0x852ab7),[_0xc084('0x78'),'updatedAt',_0xc084('0x7a'),_0xc084('0x7b')]);if(_0x3c2e61[_0xc084('0x5f')]['id']){delete _0x3c2e61[_0xc084('0x5f')]['id'];}if(_[_0xc084('0x7c')](_0x3c2e61[_0xc084('0x5f')][_0xc084('0x7d')])){throw new db['Sequelize']['ValidationError'](_0xc084('0x7e'));}if(_[_0xc084('0x7c')](_0x3c2e61[_0xc084('0x5f')][_0xc084('0x5f')])||_0x3c2e61['body'][_0xc084('0x5f')]===''){throw new db['Sequelize'][(_0xc084('0x75'))](_0xc084('0x7f'));}if(_[_0xc084('0x7c')](_0x3c2e61[_0xc084('0x5f')][_0xc084('0x80')])){throw new db[(_0xc084('0x74'))]['ValidationError'](_0xc084('0x81')+_0x4317e9);}if(!_['includes'](_0x4317e9,_0x3c2e61[_0xc084('0x5f')][_0xc084('0x80')])){throw new db[(_0xc084('0x74'))]['ValidationError'](_0xc084('0x82')+_0x4317e9);}_0x5a6278[_0x3c2e61[_0xc084('0x5f')][_0xc084('0x80')]]=_0x3c2e61[_0xc084('0x5f')][_0xc084('0x7d')];})[_0xc084('0x1f')](function(){return db[_0xc084('0x40')][_0xc084('0x5c')]({'where':{'id':_0x3c2e61[_0xc084('0x5a')]['id']},'include':[{'model':db['CmList'],'as':_0xc084('0x83'),'include':[{'model':db[_0xc084('0x72')],'as':_0xc084('0x84'),'where':_0x5a6278,'limit':0x1,'order':[[_0xc084('0x79'),_0xc084('0x85')]]}]},{'model':db['OpenchannelApplication'],'as':'Applications'}]});})[_0xc084('0x1f')](handleEntityNotFound(_0xd1b0e5,null))[_0xc084('0x1f')](function(_0x13f485){if(_0x13f485&&_0x13f485[_0xc084('0x83')]){_0x2cba3f['account']=_0x13f485;_0x2cba3f[_0xc084('0x86')]=_0x13f485[_0xc084('0x87')];_0x2cba3f['list']=_0x13f485[_0xc084('0x83')];_0x2cba3f['applications']=_[_0xc084('0x88')](_0x2cba3f[_0xc084('0x86')],[_0xc084('0x89')],[_0xc084('0x8a')]);if(_0x2cba3f[_0xc084('0x8b')][_0xc084('0x87')]){delete _0x2cba3f[_0xc084('0x8b')]['Applications'];}if(_0x2cba3f[_0xc084('0x8b')][_0xc084('0x83')]&&_0x2cba3f[_0xc084('0x8b')][_0xc084('0x83')]['Contacts'][_0xc084('0x5b')]){return _0x2cba3f['account']['List'][_0xc084('0x84')][0x0];}var _0x1f26dc=_[_0xc084('0x17')](_0x3c2e61[_0xc084('0x5f')],{'firstName':_0x3c2e61[_0xc084('0x5f')][_0xc084('0x7d')],'ListId':_0x13f485[_0xc084('0x7b')]});_0x1f26dc[_0x3c2e61[_0xc084('0x5f')][_0xc084('0x80')]]=_0x3c2e61[_0xc084('0x5f')]['from'];return db[_0xc084('0x72')]['create'](_0x1f26dc,{'fields':_0x3f5555,'raw':!![]});}})[_0xc084('0x1f')](handleEntityNotFound(_0xd1b0e5,null))[_0xc084('0x1f')](function(_0x4e6223){_0x2cba3f[_0xc084('0x8c')]=_0x4e6223;if(_0x4e6223){var _0xa00d84={'ContactId':_0x4e6223['id'],'OpenchannelAccountId':_0x3c2e61['params']['id'],'from':(_0x4e6223['firstName']||'')+'\x20'+(_0x4e6223[_0xc084('0x8d')]||'')};var _0x24f8d7={'OpenchannelAccountId':_0x3c2e61[_0xc084('0x5a')]['id'],'closed':![]};if(_0x3c2e61[_0xc084('0x5f')]['threadId']){_0x24f8d7[_0xc084('0x8e')]=_0x3c2e61[_0xc084('0x5f')]['threadId'];return db[_0xc084('0x8f')][_0xc084('0x5c')]({'where':_0x24f8d7})[_0xc084('0x1f')](function(_0x65d619){if(_0x65d619){return[_0x65d619,![]];}_0xa00d84[_0xc084('0x8e')]=_0x3c2e61[_0xc084('0x5f')]['threadId'];_0xa00d84[_0xc084('0x90')]=_0x3c2e61['body']['externalUrl'];return db[_0xc084('0x8f')]['create'](_0xa00d84)['then'](function(_0x39ab16){return[_0x39ab16,!![]];});});}else{_0x24f8d7[_0xc084('0x8e')]=null;}_0x24f8d7[_0xc084('0x91')]=_0x4e6223['id'];return db[_0xc084('0x8f')][_0xc084('0x5c')]({'where':_0x24f8d7})[_0xc084('0x1f')](function(_0x50b97a){if(_0x50b97a){return[_0x50b97a,![]];}return db['OpenchannelInteraction'][_0xc084('0x5e')](_0xa00d84)[_0xc084('0x1f')](function(_0x14c40f){return[_0x14c40f,!![]];});});}})['spread'](function(_0x2acf52,_0x4bd03d){if(_0x2acf52){_0x5c7ec9=_0x4bd03d;if(!_0x4bd03d){var _0x47b65f={'from':(_0x2cba3f[_0xc084('0x8c')][_0xc084('0x92')]||'')+'\x20'+(_0x2cba3f[_0xc084('0x8c')][_0xc084('0x8d')]||'')};if(_0x3c2e61[_0xc084('0x5f')]['threadId']&&_0x3c2e61[_0xc084('0x5f')][_0xc084('0x93')]&&_0x3c2e61[_0xc084('0x5f')][_0xc084('0x8e')]!=_0x3c2e61[_0xc084('0x5f')]['messageId']){_0x47b65f['threadId']=_0x3c2e61[_0xc084('0x5f')][_0xc084('0x93')];}return _0x2acf52[_0xc084('0x34')](_0x47b65f);}else{return _0x2acf52;}}})['then'](function(_0x43dfd9){_0x2cba3f[_0xc084('0x94')]=_0x43dfd9['get']({'plain':!![]});_0x2cba3f['interaction'][_0xc084('0x95')]=_0x5c7ec9;if(_0x2cba3f[_0xc084('0x94')][_0xc084('0x95')]){if(_0x2cba3f['account']['autoclose']){_0x2cba3f[_0xc084('0x86')]['push']({'id':0x0,'priority':_0x2cba3f[_0xc084('0x86')][_0xc084('0x5b')]+0x1,'app':'close','appdata':_0xc084('0x96'),'interval':_0xc084('0x97')});}}return db[_0xc084('0x98')][_0xc084('0x5e')]({'body':_0x3c2e61['body'][_0xc084('0x5f')],'OpenchannelAccountId':_0x3c2e61[_0xc084('0x5a')]['id'],'OpenchannelInteractionId':_0x43dfd9['id'],'direction':'in','ContactId':_0x2cba3f[_0xc084('0x8c')]['id'],'AttachmentId':_0x3c2e61[_0xc084('0x5f')][_0xc084('0x99')]});})[_0xc084('0x1f')](function(_0x1c8d53){_0x2cba3f[_0xc084('0x27')]=_0x1c8d53;if(_0x2cba3f['interaction'][_0xc084('0x9a')]){return db[_0xc084('0x9b')][_0xc084('0x5c')]({'attributes':['id',_0xc084('0x3a')],'where':{'id':_0x2cba3f[_0xc084('0x94')][_0xc084('0x9a')]}})['then'](function(_0x23db26){if(_0x23db26){_0x2cba3f[_0xc084('0x86')]['unshift']({'id':0x0,'priority':0x0,'app':_0xc084('0x9c'),'appdata':_0x23db26['name']+','+(_0x2cba3f['account']['waitForTheAssignedAgent']||0xa),'interval':_0xc084('0x97')});_0x2cba3f[_0xc084('0x9d')]=![];}return respondWithRpcPromise('Start',_0xc084('0x9e'),_0x2cba3f);});}return respondWithRpcPromise(_0xc084('0x9f'),_0xc084('0x9e'),_0x2cba3f);})[_0xc084('0x1f')](function(_0x12c88b){respondWithRpcPromise(_0xc084('0xa0'),_0xc084('0xa0'),{'event':'notify','message':_0x12c88b},client9002);return _0x12c88b;})['then'](respondWithResult(_0xd1b0e5,null))['catch'](handleError(_0xd1b0e5,null));};exports['addApplications']=function(_0x575318,_0x4d96c0,_0x2a6483){return db[_0xc084('0x40')][_0xc084('0x6d')]({'where':{'id':_0x575318[_0xc084('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4d96c0,null))[_0xc084('0x1f')](function(_0x2cd94e){if(_0x2cd94e){return db['sequelize'][_0xc084('0xa1')](function(_0x5494e0){return db[_0xc084('0xa2')][_0xc084('0x35')]({'where':{'OpenchannelAccountId':_0x575318[_0xc084('0x5a')]['id']},'transaction':_0x5494e0})[_0xc084('0x1f')](function(_0x5119df){var _0x5cc5b4=_[_0xc084('0x3f')](_0x575318['body'],function(_0x435098){_0x435098['OpenchannelAccountId']=_0x575318['params']['id'];return _0x435098;});return db[_0xc084('0xa2')][_0xc084('0xa3')](_0x5cc5b4,{'transaction':_0x5494e0});});})[_0xc084('0x1f')](function(){return db[_0xc084('0xa2')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x575318['params']['id']},'order':'priority'});});}})[_0xc084('0x1f')](respondWithResult(_0x4d96c0,null))[_0xc084('0x5d')](handleError(_0x4d96c0,null));};exports[_0xc084('0xa4')]=function(_0x1557e0,_0x5606f4,_0x1ee56a){var _0x6dfbb4={};var _0x1db97f={};var _0x884508;var _0x1aa646;return db[_0xc084('0x40')][_0xc084('0x6d')]({'where':{'id':_0x1557e0[_0xc084('0x5a')]['id']}})[_0xc084('0x1f')](handleEntityNotFound(_0x5606f4,null))[_0xc084('0x1f')](function(_0x1d0c34){if(_0x1d0c34){_0x884508=_0x1d0c34;_0x1db97f[_0xc084('0x45')]=_[_0xc084('0x46')](db[_0xc084('0xa2')]['rawAttributes']);_0x1db97f[_0xc084('0x47')]=_[_0xc084('0x46')](_0x1557e0[_0xc084('0x47')]);_0x1db97f['filters']=_[_0xc084('0x49')](_0x1db97f[_0xc084('0x45')],_0x1db97f['query']);_0x6dfbb4[_0xc084('0x4a')]=_[_0xc084('0x49')](_0x1db97f[_0xc084('0x45')],qs[_0xc084('0x4b')](_0x1557e0[_0xc084('0x47')][_0xc084('0x4b')]));_0x6dfbb4[_0xc084('0x4a')]=_0x6dfbb4[_0xc084('0x4a')][_0xc084('0x5b')]?_0x6dfbb4[_0xc084('0x4a')]:_0x1db97f[_0xc084('0x45')];_0x6dfbb4['order']=qs[_0xc084('0x4e')](_0x1557e0[_0xc084('0x47')][_0xc084('0x4e')]);_0x6dfbb4[_0xc084('0x4f')]=qs[_0xc084('0x48')](_[_0xc084('0x50')](_0x1557e0[_0xc084('0x47')],_0x1db97f[_0xc084('0x48')]));if(_0x1557e0[_0xc084('0x47')][_0xc084('0x51')]){_0x6dfbb4[_0xc084('0x4f')]=_[_0xc084('0x52')](_0x6dfbb4['where'],{'$or':_[_0xc084('0x3f')](_0x6dfbb4[_0xc084('0x4a')],function(_0x3316d2){var _0x398c72={};_0x398c72[_0x3316d2]={'$like':'%'+_0x1557e0[_0xc084('0x47')][_0xc084('0x51')]+'%'};return _0x398c72;})});}_0x6dfbb4=_[_0xc084('0x52')]({},_0x6dfbb4,_0x1557e0[_0xc084('0x54')]);return _0x884508[_0xc084('0xa4')](_0x6dfbb4);}})[_0xc084('0x1f')](function(_0x18edbe){if(_0x18edbe){_0x1aa646=_0x18edbe[_0xc084('0x5b')];if(!_0x1557e0[_0xc084('0x47')][_0xc084('0x68')]('nolimit')){_0x6dfbb4[_0xc084('0x2f')]=qs[_0xc084('0x2f')](_0x1557e0['query']['limit']);_0x6dfbb4[_0xc084('0x31')]=qs[_0xc084('0x31')](_0x1557e0[_0xc084('0x47')][_0xc084('0x31')]);}return _0x884508[_0xc084('0xa4')](_0x6dfbb4);}})[_0xc084('0x1f')](function(_0x114d31){if(_0x114d31){return _0x114d31?{'count':_0x1aa646,'rows':_0x114d31}:null;}})[_0xc084('0x1f')](respondWithResult(_0x5606f4,null))[_0xc084('0x5d')](handleError(_0x5606f4,null));};exports[_0xc084('0xa5')]=function(_0x3c5044,_0x3d8016,_0x363df7){var _0x311e5d={'raw':![],'where':{}};var _0x51585a={};var _0x361b1e={'count':0x0,'rows':[]};return db[_0xc084('0x40')][_0xc084('0x6d')]({'where':{'id':_0x3c5044['params']['id']}})[_0xc084('0x1f')](handleEntityNotFound(_0x3d8016,null))['then'](function(_0x47849d){if(_0x47849d){_0x51585a[_0xc084('0x45')]=_['keys'](db[_0xc084('0x8f')][_0xc084('0x41')]);_0x51585a[_0xc084('0x47')]=_['keys'](_0x3c5044[_0xc084('0x47')]);_0x51585a[_0xc084('0x48')]=_['intersection'](_0x51585a[_0xc084('0x45')],_0x51585a[_0xc084('0x47')]);_0x311e5d[_0xc084('0x4a')]=_[_0xc084('0x49')](_0x51585a[_0xc084('0x45')],qs[_0xc084('0x4b')](_0x3c5044[_0xc084('0x47')][_0xc084('0x4b')]));_0x311e5d['attributes']=_0x311e5d['attributes'][_0xc084('0x5b')]?_0x311e5d[_0xc084('0x4a')]:_0x51585a['model'];if(!_0x3c5044[_0xc084('0x47')]['hasOwnProperty'](_0xc084('0x4c'))){_0x311e5d[_0xc084('0x2f')]=qs[_0xc084('0x2f')](_0x3c5044[_0xc084('0x47')][_0xc084('0x2f')]);_0x311e5d[_0xc084('0x31')]=qs[_0xc084('0x31')](_0x3c5044[_0xc084('0x47')][_0xc084('0x31')]);}_0x311e5d[_0xc084('0x4d')]=qs['sort'](_0x3c5044[_0xc084('0x47')][_0xc084('0x4e')]);_0x311e5d[_0xc084('0x4f')]=qs[_0xc084('0x48')](_[_0xc084('0x50')](_0x3c5044['query'],_0x51585a[_0xc084('0x48')]));_0x311e5d[_0xc084('0x4f')]['OpenchannelAccountId']=_0x47849d['id'];if(_0x3c5044[_0xc084('0x47')][_0xc084('0x51')]){_0x311e5d[_0xc084('0x4f')]=_[_0xc084('0x52')](_0x311e5d['where'],{'$or':_[_0xc084('0x3f')](_0x311e5d[_0xc084('0x4a')],function(_0x303da8){var _0x1f2572={};_0x1f2572[_0x303da8]={'$like':'%'+_0x3c5044['query'][_0xc084('0x51')]+'%'};return _0x1f2572;})});}_0x311e5d=_[_0xc084('0x52')]({},_0x311e5d,_0x3c5044[_0xc084('0x54')]);return db[_0xc084('0x8f')][_0xc084('0x30')]({'where':_0x311e5d['where']})[_0xc084('0x1f')](function(_0x20b2b6){_0x361b1e[_0xc084('0x30')]=_0x20b2b6;if(_0x3c5044[_0xc084('0x47')][_0xc084('0x55')]){_0x311e5d[_0xc084('0x56')]=[{'model':db[_0xc084('0x72')],'as':_0xc084('0xa6'),'required':![]},{'model':db[_0xc084('0x9b')],'as':'Owner','attributes':[_0xc084('0x3a'),_0xc084('0xa7'),_0xc084('0xa8')],'required':![]},{'model':db[_0xc084('0xa9')],'as':_0xc084('0xaa'),'attributes':['id','name','color'],'where':_0x3c5044[_0xc084('0x47')][_0xc084('0xab')]?{'id':_0x3c5044[_0xc084('0x47')]['tag']}:undefined,'required':_0x3c5044[_0xc084('0x47')][_0xc084('0xab')]?!![]:![]}];}return db[_0xc084('0x8f')][_0xc084('0x57')](_0x311e5d);})[_0xc084('0x1f')](function(_0x4750e2){_0x361b1e['rows']=_0x4750e2;return _0x361b1e;});}})[_0xc084('0x1f')](respondWithFilteredResult(_0x3d8016,_0x311e5d))[_0xc084('0x5d')](handleError(_0x3d8016,null));};exports[_0xc084('0xac')]=function(_0x10e5eb,_0x41c297,_0x3d27cf){return db[_0xc084('0x40')][_0xc084('0x5c')]({'where':{'id':_0x10e5eb[_0xc084('0x5a')]['id']}})[_0xc084('0x1f')](handleEntityNotFound(_0x41c297,null))[_0xc084('0x1f')](function(_0x2437e3){if(_0x2437e3){return _0x2437e3[_0xc084('0xac')](_0x10e5eb[_0xc084('0x5f')]['ids'],_[_0xc084('0xad')](_0x10e5eb[_0xc084('0x5f')],[_0xc084('0x6b'),'id'])||{})[_0xc084('0xae')](function(_0xf912f8){for(var _0x5de855=0x0;_0x5de855<_0x10e5eb['body'][_0xc084('0x6b')][_0xc084('0x5b')];_0x5de855+=0x1){socket['emit']('userOpenchannelAccount:save',{'UserId':Number(_0x10e5eb[_0xc084('0x5f')][_0xc084('0x6b')][_0x5de855]),'OpenchannelAccountId':Number(_0x10e5eb['params']['id'])});}return _0xf912f8;});}})[_0xc084('0x1f')](respondWithResult(_0x41c297,null))['catch'](handleError(_0x41c297,null));};exports['removeAgents']=function(_0x2f0c9b,_0x255132,_0x353fd1){return db[_0xc084('0x40')]['find']({'where':{'id':_0x2f0c9b[_0xc084('0x5a')]['id']}})[_0xc084('0x1f')](handleEntityNotFound(_0x255132,null))[_0xc084('0x1f')](function(_0x487d3b){if(_0x487d3b){return _0x487d3b[_0xc084('0xaf')](_0x2f0c9b[_0xc084('0x47')]['ids'])['then'](function(){if(_['isArray'](_0x2f0c9b[_0xc084('0x47')]['ids'])){for(var _0x3c99ef=0x0;_0x3c99ef<_0x2f0c9b[_0xc084('0x47')][_0xc084('0x6b')][_0xc084('0x5b')];_0x3c99ef+=0x1){socket[_0xc084('0xb0')](_0xc084('0xb1'),{'UserId':Number(_0x2f0c9b['query'][_0xc084('0x6b')][_0x3c99ef]),'OpenchannelAccountId':Number(_0x2f0c9b[_0xc084('0x5a')]['id'])});}}else{socket[_0xc084('0xb0')](_0xc084('0xb1'),{'UserId':Number(_0x2f0c9b['query']['ids']),'OpenchannelAccountId':Number(_0x2f0c9b[_0xc084('0x5a')]['id'])});}});}})[_0xc084('0x1f')](respondWithStatusCode(_0x255132,null))[_0xc084('0x5d')](handleError(_0x255132,null));};exports[_0xc084('0xb2')]=function(_0x38865e,_0x18542a,_0x1a5f66){var _0x28dc73={};var _0x382db9={};var _0x40d6fd;var _0x3d656d;return db[_0xc084('0x40')][_0xc084('0x6d')]({'where':{'id':_0x38865e[_0xc084('0x5a')]['id']}})[_0xc084('0x1f')](handleEntityNotFound(_0x18542a,null))[_0xc084('0x1f')](function(_0x42d6fb){if(_0x42d6fb){_0x40d6fd=_0x42d6fb;_0x382db9['model']=_[_0xc084('0x46')](db[_0xc084('0x9b')]['rawAttributes']);_0x382db9['query']=_['keys'](_0x38865e[_0xc084('0x47')]);_0x382db9['filters']=_[_0xc084('0x49')](_0x382db9[_0xc084('0x45')],_0x382db9[_0xc084('0x47')]);_0x28dc73[_0xc084('0x4a')]=_[_0xc084('0x49')](_0x382db9[_0xc084('0x45')],qs[_0xc084('0x4b')](_0x38865e['query'][_0xc084('0x4b')]));_0x28dc73['attributes']=_0x28dc73[_0xc084('0x4a')]['length']?_0x28dc73['attributes']:_0x382db9[_0xc084('0x45')];_0x28dc73[_0xc084('0x4d')]=qs[_0xc084('0x4e')](_0x38865e[_0xc084('0x47')]['sort']);_0x28dc73[_0xc084('0x4f')]=qs[_0xc084('0x48')](_[_0xc084('0x50')](_0x38865e[_0xc084('0x47')],_0x382db9['filters']));if(_0x38865e['query']['filter']){_0x28dc73[_0xc084('0x4f')]=_['merge'](_0x28dc73['where'],{'$or':_[_0xc084('0x3f')](_0x28dc73[_0xc084('0x4a')],function(_0x15e316){var _0x26837b={};_0x26837b[_0x15e316]={'$like':'%'+_0x38865e['query'][_0xc084('0x51')]+'%'};return _0x26837b;})});}_0x28dc73=_[_0xc084('0x52')]({},_0x28dc73,_0x38865e['options']);return _0x40d6fd[_0xc084('0xb2')](_0x28dc73);}})['then'](function(_0x258b2d){if(_0x258b2d){_0x3d656d=_0x258b2d[_0xc084('0x5b')];if(!_0x38865e['query'][_0xc084('0x68')]('nolimit')){_0x28dc73[_0xc084('0x2f')]=qs[_0xc084('0x2f')](_0x38865e[_0xc084('0x47')]['limit']);_0x28dc73[_0xc084('0x31')]=qs[_0xc084('0x31')](_0x38865e[_0xc084('0x47')][_0xc084('0x31')]);}return _0x40d6fd[_0xc084('0xb2')](_0x28dc73);}})[_0xc084('0x1f')](function(_0x3f8327){if(_0x3f8327){return _0x3f8327?{'count':_0x3d656d,'rows':_0x3f8327}:null;}})['then'](respondWithResult(_0x18542a,null))[_0xc084('0x5d')](handleError(_0x18542a,null));};exports[_0xc084('0x3b')]=function(_0x111d7e,_0x1c0091,_0x35bef5){var _0x121988,_0x369ed6,_0x59ee29;if(_[_0xc084('0x7c')](_0x111d7e[_0xc084('0x5f')][_0xc084('0x5f')])||_0x111d7e[_0xc084('0x5f')][_0xc084('0x5f')]===''){throw new db[(_0xc084('0x74'))]['ValidationError'](_0xc084('0x7f'));}if(_['isNil'](_0x111d7e[_0xc084('0x5f')]['to'])){}_0x121988=_0x111d7e['body']['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x111d7e['params']['id']}})[_0xc084('0x1f')](handleEntityNotFound(_0x1c0091,null))[_0xc084('0x1f')](function(_0x25b0c9){if(_0x25b0c9){return db['OpenchannelAccount'][_0xc084('0x5c')]({'where':{'id':_0x25b0c9['id']},'include':[{'model':db[_0xc084('0xb3')],'as':_0xc084('0x83'),'include':[{'model':db[_0xc084('0x72')],'as':_0xc084('0x84'),'where':{[_0x25b0c9[_0xc084('0x80')]]:_0x121988},'limit':0x1,'order':[[_0xc084('0x79'),_0xc084('0x85')]]}]}]})[_0xc084('0x1f')](handleEntityNotFound(_0x1c0091,null))[_0xc084('0x1f')](function(_0x54b473){if(_0x54b473&&_0x54b473[_0xc084('0x83')]){_0x369ed6=_0x54b473[_0xc084('0x36')]({'plain':!![]});if(_0x369ed6[_0xc084('0x83')]&&_0x369ed6[_0xc084('0x83')]['Contacts'][_0xc084('0x5b')]){return _0x369ed6[_0xc084('0x83')][_0xc084('0x84')][0x0];}return db[_0xc084('0x72')][_0xc084('0x5e')](_[_0xc084('0x17')](_0x111d7e[_0xc084('0x5f')],{'firstName':_0x121988,[_0x54b473[_0xc084('0x80')]]:_0x121988,'phone':_0x121988,'ListId':_0x369ed6[_0xc084('0x7b')]}));}})[_0xc084('0x1f')](handleEntityNotFound(_0x1c0091,null))[_0xc084('0x1f')](function(_0x55cbfe){if(_0x55cbfe){_0x59ee29=_0x55cbfe;return db[_0xc084('0x8f')][_0xc084('0x5c')]({'where':{'ContactId':_0x59ee29['id'],'closed':![],'OpenchannelAccountId':_0x369ed6['id']}})['then'](function(_0x1d5614){if(_0x1d5614){return[_0x1d5614,![]];}return db['OpenchannelInteraction'][_0xc084('0x5e')]({'UserId':_0x111d7e[_0xc084('0x62')]['id'],'ContactId':_0x59ee29['id'],'OpenchannelAccountId':_0x369ed6['id'],'lastMsgDirection':'out','Messages':[_[_0xc084('0x52')](_0x111d7e['body'],{'read':![],'body':_0x111d7e[_0xc084('0x5f')][_0xc084('0x5f')],'OpenchannelAccountId':_0x369ed6['id'],'UserId':_0x111d7e[_0xc084('0x62')]['id'],'ContactId':_0x59ee29['id']})]},{'include':[{'model':db[_0xc084('0x98')],'as':'Messages'}]})[_0xc084('0x1f')](function(_0x4d1a6d){return[_0x4d1a6d,!![]];});});}})[_0xc084('0xae')](function(_0x3cd2ee,_0x220af1){if(_0x220af1){return _0x3cd2ee;}return db[_0xc084('0x98')][_0xc084('0x5e')](_['merge'](_0x111d7e[_0xc084('0x5f')],{'read':![],'body':_0x111d7e['body']['body'],'OpenchannelAccountId':_0x369ed6['id'],'OpenchannelInteractionId':_0x3cd2ee['id'],'UserId':_0x111d7e[_0xc084('0x62')]['id'],'ContactId':_0x59ee29['id']}))[_0xc084('0x1f')](function(_0x2f8ec9){_0x3cd2ee[_0xc084('0xb4')]['Messages']=[];_0x3cd2ee['dataValues'][_0xc084('0xb5')][_0xc084('0xb6')](_0x2f8ec9[_0xc084('0xb4')]);return _0x3cd2ee;});});}})['then'](respondWithResult(_0x1c0091,null))[_0xc084('0x5d')](handleError(_0x1c0091,null));}; \ No newline at end of file +var _0x735d=['asc','firstName','lastName','threadId','OpenchannelInteraction','ContactId','contact','messageId','interaction','created','autoclose','push','close','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','OpenchannelApplication','findAndCountAll','getApplications','getInteractions','Contact','internal','Tag','Tags','color','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','send','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','ListId','OpenchannelMessage','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','OpenchannelAccount,\x20%s,\x20%s','result','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','filter','where','type','VIRTUAL','merge','options','includeAll','include','length','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','describe','addDisposition','OpenchannelAccountId','getDispositions','Disposition','nolimit','sort','pick','findAll','rows','removeDispositions','ids','findOne','CannedAnswer','removeAnswers','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','account','applications','Applications','list','orderBy'];(function(_0x3f23d3,_0x14c09b){var _0x29e3e4=function(_0x3f0582){while(--_0x3f0582){_0x3f23d3['push'](_0x3f23d3['shift']());}};_0x29e3e4(++_0x14c09b);}(_0x735d,0xf0));var _0xd735=function(_0x416cdc,_0x213b87){_0x416cdc=_0x416cdc-0x0;var _0x1931ce=_0x735d[_0x416cdc];return _0x1931ce;};'use strict';var emlformat=require(_0xd735('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd735('0x1'));var jsonpatch=require(_0xd735('0x2'));var rp=require(_0xd735('0x3'));var moment=require(_0xd735('0x4'));var BPromise=require(_0xd735('0x5'));var Mustache=require('mustache');var util=require(_0xd735('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd735('0x7'));var ejs=require(_0xd735('0x8'));var fs=require('fs');var fs_extra=require(_0xd735('0x9'));var _=require(_0xd735('0xa'));var squel=require('squel');var crypto=require(_0xd735('0xb'));var jsforce=require(_0xd735('0xc'));var deskjs=require(_0xd735('0xd'));var toCsv=require(_0xd735('0x7'));var querystring=require(_0xd735('0xe'));var Papa=require(_0xd735('0xf'));var Redis=require(_0xd735('0x10'));var authService=require(_0xd735('0x11'));var qs=require(_0xd735('0x12'));var as=require(_0xd735('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd735('0x14'))(_0xd735('0x15'));var utils=require(_0xd735('0x16'));var config=require(_0xd735('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd735('0x18'))['db'];config[_0xd735('0x19')]=_[_0xd735('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd735('0x1b'))(new Redis(config['redis']));require(_0xd735('0x1c'))[_0xd735('0x1d')](socket);var jayson=require(_0xd735('0x1e'));var client=jayson[_0xd735('0x1f')][_0xd735('0x20')]({'port':0x232c});var client9002=jayson[_0xd735('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x453cbb,_0x2095ae,_0x3c67b0,_0x55da2c){return new BPromise(function(_0x467491,_0x2995d0){var _0xc05cda=_0x55da2c||client;return _0xc05cda['request'](_0x453cbb,_0x3c67b0)['then'](function(_0x30299e){logger[_0xd735('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x2095ae,_0xd735('0x22'));logger[_0xd735('0x23')](_0xd735('0x24'),_0x2095ae,_0xd735('0x22'),JSON['stringify'](_0x30299e));if(_0x30299e[_0xd735('0x25')]){if(_0x30299e[_0xd735('0x25')][_0xd735('0x26')]===0x1f4){logger[_0xd735('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x2095ae,_0x30299e['error'][_0xd735('0x27')]);return _0x2995d0(_0x30299e[_0xd735('0x25')][_0xd735('0x27')]);}logger['error'](_0xd735('0x28'),_0x2095ae,_0x30299e['error'][_0xd735('0x27')]);return _0x467491(_0x30299e[_0xd735('0x25')][_0xd735('0x27')]);}else{logger[_0xd735('0x21')](_0xd735('0x28'),_0x2095ae,_0xd735('0x22'));_0x467491(_0x30299e[_0xd735('0x29')][_0xd735('0x27')]);}})['catch'](function(_0x1e598b){logger[_0xd735('0x25')](_0xd735('0x28'),_0x2095ae,_0x1e598b);_0x2995d0(_0x1e598b);});});}function respondWithStatusCode(_0x127398,_0x4d9bd4){_0x4d9bd4=_0x4d9bd4||0xcc;return function(_0x223eae){if(_0x223eae){return _0x127398[_0xd735('0x2a')](_0x4d9bd4);}return _0x127398[_0xd735('0x2b')](_0x4d9bd4)[_0xd735('0x2c')]();};}function respondWithResult(_0x570d19,_0x43563b){_0x43563b=_0x43563b||0xc8;return function(_0x7c2246){if(_0x7c2246){return _0x570d19['status'](_0x43563b)[_0xd735('0x2d')](_0x7c2246);}};}function respondWithFilteredResult(_0x18fa4e,_0x35af62){return function(_0x3041c4){if(_0x3041c4){var _0x4e6c77=typeof _0x35af62[_0xd735('0x2e')]===_0xd735('0x2f')&&typeof _0x35af62[_0xd735('0x30')]==='undefined';var _0xaecee7=_0x3041c4['count'];var _0x37da5b=_0x4e6c77?0x0:_0x35af62[_0xd735('0x2e')];var _0x349685=_0x4e6c77?_0x3041c4[_0xd735('0x31')]:_0x35af62['offset']+_0x35af62['limit'];var _0x105c3f;if(_0x349685>=_0xaecee7){_0x349685=_0xaecee7;_0x105c3f=0xc8;}else{_0x105c3f=0xce;}_0x18fa4e[_0xd735('0x2b')](_0x105c3f);return _0x18fa4e['set'](_0xd735('0x32'),_0x37da5b+'-'+_0x349685+'/'+_0xaecee7)[_0xd735('0x2d')](_0x3041c4);}return null;};}function patchUpdates(_0x5d7870){return function(_0x28bb43){try{jsonpatch['apply'](_0x28bb43,_0x5d7870,!![]);}catch(_0x20e91c){return BPromise[_0xd735('0x33')](_0x20e91c);}return _0x28bb43[_0xd735('0x34')]();};}function saveUpdates(_0xd67ecc,_0x34a290){return function(_0x4832c4){if(_0x4832c4){return _0x4832c4[_0xd735('0x35')](_0xd67ecc)[_0xd735('0x36')](function(_0x59733d){return _0x59733d;});}return null;};}function removeEntity(_0x33dec3,_0x5240b4){return function(_0x3ae1bc){if(_0x3ae1bc){return _0x3ae1bc[_0xd735('0x37')]()[_0xd735('0x36')](function(){var _0x2d1ef0=_0x3ae1bc[_0xd735('0x38')]({'plain':!![]});var _0xad5ba8=_0xd735('0x39');return db[_0xd735('0x3a')][_0xd735('0x37')]({'where':{'type':_0xad5ba8,'resourceId':_0x2d1ef0['id']}})['then'](function(){return _0x3ae1bc;});})[_0xd735('0x36')](function(){_0x33dec3[_0xd735('0x2b')](0xcc)[_0xd735('0x2c')]();});}};}function handleEntityNotFound(_0x40f1b2,_0x1f8933){return function(_0x33cefe){if(!_0x33cefe){_0x40f1b2[_0xd735('0x2a')](0x194);}return _0x33cefe;};}function handleError(_0x11e9fa,_0x23630e){_0x23630e=_0x23630e||0x1f4;return function(_0x1720db){logger['error'](_0x1720db[_0xd735('0x3b')]);if(_0x1720db[_0xd735('0x3c')]){delete _0x1720db['name'];}_0x11e9fa[_0xd735('0x2b')](_0x23630e)['send'](_0x1720db);};}exports[_0xd735('0x3d')]=function(_0x168b1e,_0x57d21a){var _0x4314cf={'include':[{'model':db[_0xd735('0x3e')],'as':_0xd735('0x3f')}]},_0x4a1c87={},_0x360e18={'count':0x0,'rows':[]};var _0x6bd0b0=_[_0xd735('0x40')](db[_0xd735('0x41')][_0xd735('0x42')],function(_0x462a24){return{'name':_0x462a24[_0xd735('0x43')],'type':_0x462a24['type']['key']};});_0x4a1c87[_0xd735('0x44')]=_[_0xd735('0x40')](_0x6bd0b0,_0xd735('0x3c'));_0x4a1c87[_0xd735('0x45')]=_[_0xd735('0x46')](_0x168b1e[_0xd735('0x45')]);_0x4a1c87[_0xd735('0x47')]=_['intersection'](_0x4a1c87['model'],_0x4a1c87[_0xd735('0x45')]);_0x4314cf[_0xd735('0x48')]=_[_0xd735('0x49')](_0x4a1c87[_0xd735('0x44')],qs[_0xd735('0x4a')](_0x168b1e[_0xd735('0x45')][_0xd735('0x4a')]));_0x4314cf['attributes']=_0x4314cf['attributes']['length']?_0x4314cf['attributes']:_0x4a1c87[_0xd735('0x44')];if(!_0x168b1e['query'][_0xd735('0x4b')]('nolimit')){_0x4314cf['limit']=qs[_0xd735('0x30')](_0x168b1e['query'][_0xd735('0x30')]);_0x4314cf[_0xd735('0x2e')]=qs[_0xd735('0x2e')](_0x168b1e[_0xd735('0x45')]['offset']);}_0x4314cf[_0xd735('0x4c')]=qs['sort'](_0x168b1e[_0xd735('0x45')]['sort']);_0x4314cf['where']=qs[_0xd735('0x47')](_['pick'](_0x168b1e[_0xd735('0x45')],_0x4a1c87['filters']),_0x6bd0b0);if(_0x168b1e[_0xd735('0x45')][_0xd735('0x4d')]){_0x4314cf[_0xd735('0x4e')]=_['merge'](_0x4314cf[_0xd735('0x4e')],{'$or':_[_0xd735('0x40')](_0x6bd0b0,function(_0x45deef){if(_0x45deef[_0xd735('0x4f')]!==_0xd735('0x50')){var _0x2417c8={};_0x2417c8[_0x45deef['name']]={'$like':'%'+_0x168b1e['query']['filter']+'%'};return _0x2417c8;}})});}_0x4314cf=_[_0xd735('0x51')]({},_0x4314cf,_0x168b1e[_0xd735('0x52')]);var _0x23c5f4={'where':_0x4314cf[_0xd735('0x4e')]};return db[_0xd735('0x41')]['count'](_0x23c5f4)[_0xd735('0x36')](function(_0x258b92){_0x360e18['count']=_0x258b92;if(_0x168b1e[_0xd735('0x45')][_0xd735('0x53')]){_0x4314cf[_0xd735('0x54')]=[{'all':!![]}];}return db[_0xd735('0x41')]['findAll'](_0x4314cf);})[_0xd735('0x36')](function(_0x1a6bd3){_0x360e18['rows']=_0x1a6bd3;return _0x360e18;})[_0xd735('0x36')](respondWithFilteredResult(_0x57d21a,_0x4314cf))['catch'](handleError(_0x57d21a,null));};exports['show']=function(_0x3609fc,_0x1059b1){var _0x207307={'raw':![],'where':{'id':_0x3609fc['params']['id']},'include':[{'model':db[_0xd735('0x3e')],'as':_0xd735('0x3f')}]},_0x42ff29={};_0x42ff29[_0xd735('0x44')]=_[_0xd735('0x46')](db['OpenchannelAccount'][_0xd735('0x42')]);_0x42ff29['query']=_[_0xd735('0x46')](_0x3609fc[_0xd735('0x45')]);_0x42ff29[_0xd735('0x47')]=_['intersection'](_0x42ff29[_0xd735('0x44')],_0x42ff29[_0xd735('0x45')]);_0x207307['attributes']=_['intersection'](_0x42ff29[_0xd735('0x44')],qs['fields'](_0x3609fc[_0xd735('0x45')][_0xd735('0x4a')]));_0x207307['attributes']=_0x207307[_0xd735('0x48')][_0xd735('0x55')]?_0x207307[_0xd735('0x48')]:_0x42ff29[_0xd735('0x44')];if(_0x3609fc[_0xd735('0x45')][_0xd735('0x53')]){_0x207307['include']=[{'all':!![]}];}_0x207307=_[_0xd735('0x51')]({},_0x207307,_0x3609fc['options']);return db[_0xd735('0x41')][_0xd735('0x56')](_0x207307)[_0xd735('0x36')](handleEntityNotFound(_0x1059b1,null))[_0xd735('0x36')](respondWithResult(_0x1059b1,null))[_0xd735('0x57')](handleError(_0x1059b1,null));};exports[_0xd735('0x58')]=function(_0x933523,_0x526444){return db[_0xd735('0x41')]['create'](_0x933523[_0xd735('0x59')],{})[_0xd735('0x36')](function(_0x460e2a){var _0x1787b0=_0x933523[_0xd735('0x5a')][_0xd735('0x38')]({'plain':!![]});if(!_0x1787b0)throw new Error(_0xd735('0x5b'));if(_0x1787b0[_0xd735('0x5c')]===_0xd735('0x5a')){var _0x56dbf1=_0x460e2a[_0xd735('0x38')]({'plain':!![]});var _0x338491=_0xd735('0x39');return db[_0xd735('0x5d')][_0xd735('0x56')]({'where':{'name':_0x338491,'userProfileId':_0x1787b0['userProfileId']},'raw':!![]})['then'](function(_0x20a9f3){if(_0x20a9f3&&_0x20a9f3[_0xd735('0x5e')]===0x0){return db[_0xd735('0x3a')][_0xd735('0x58')]({'name':_0x56dbf1['name'],'resourceId':_0x56dbf1['id'],'type':_0x20a9f3[_0xd735('0x3c')],'sectionId':_0x20a9f3['id']},{})[_0xd735('0x36')](function(){return _0x460e2a;});}else{return _0x460e2a;}})[_0xd735('0x57')](function(_0x310502){logger['error'](_0xd735('0x5f'),_0x310502);throw _0x310502;});}return _0x460e2a;})[_0xd735('0x36')](respondWithResult(_0x526444,0xc9))['catch'](handleError(_0x526444,null));};exports[_0xd735('0x35')]=function(_0x22d263,_0x5cadfb){if(_0x22d263[_0xd735('0x59')]['id']){delete _0x22d263[_0xd735('0x59')]['id'];}return db[_0xd735('0x41')][_0xd735('0x56')]({'where':{'id':_0x22d263[_0xd735('0x60')]['id']},'include':[{'model':db[_0xd735('0x3e')],'as':_0xd735('0x3f')}]})[_0xd735('0x36')](handleEntityNotFound(_0x5cadfb,null))[_0xd735('0x36')](saveUpdates(_0x22d263[_0xd735('0x59')],null))['then'](respondWithResult(_0x5cadfb,null))[_0xd735('0x57')](handleError(_0x5cadfb,null));};exports['destroy']=function(_0x5438f1,_0x2cf23c){return db[_0xd735('0x41')][_0xd735('0x56')]({'where':{'id':_0x5438f1[_0xd735('0x60')]['id']}})[_0xd735('0x36')](handleEntityNotFound(_0x2cf23c,null))[_0xd735('0x36')](removeEntity(_0x2cf23c,null))[_0xd735('0x57')](handleError(_0x2cf23c,null));};exports[_0xd735('0x61')]=function(_0x4d9e1d,_0x244f56){return db[_0xd735('0x41')][_0xd735('0x61')]()[_0xd735('0x36')](respondWithResult(_0x244f56,null))[_0xd735('0x57')](handleError(_0x244f56,null));};exports[_0xd735('0x62')]=function(_0x1768c8,_0x147eaf,_0x14f0a3){if(_0x1768c8['body']['id']){delete _0x1768c8[_0xd735('0x59')]['id'];}return db[_0xd735('0x41')][_0xd735('0x56')]({'where':{'id':_0x1768c8['params']['id']}})[_0xd735('0x36')](handleEntityNotFound(_0x147eaf,null))['then'](function(_0x341182){if(_0x341182){_0x1768c8[_0xd735('0x59')][_0xd735('0x63')]=_0x341182['id'];return db['Disposition'][_0xd735('0x58')](_0x1768c8[_0xd735('0x59')]);}})[_0xd735('0x36')](respondWithResult(_0x147eaf,null))[_0xd735('0x57')](handleError(_0x147eaf,null));};exports[_0xd735('0x64')]=function(_0x359089,_0x29cdd1,_0x4ab780){var _0x1f981b={'raw':![],'where':{}};var _0x2a554a={};var _0xc586e2={'count':0x0,'rows':[]};return db[_0xd735('0x41')]['findOne']({'where':{'id':_0x359089[_0xd735('0x60')]['id']}})[_0xd735('0x36')](handleEntityNotFound(_0x29cdd1,null))[_0xd735('0x36')](function(_0x5b413a){if(_0x5b413a){_0x2a554a[_0xd735('0x44')]=_[_0xd735('0x46')](db[_0xd735('0x65')][_0xd735('0x42')]);_0x2a554a[_0xd735('0x45')]=_['keys'](_0x359089[_0xd735('0x45')]);_0x2a554a[_0xd735('0x47')]=_[_0xd735('0x49')](_0x2a554a[_0xd735('0x44')],_0x2a554a['query']);_0x1f981b[_0xd735('0x48')]=_[_0xd735('0x49')](_0x2a554a[_0xd735('0x44')],qs[_0xd735('0x4a')](_0x359089['query']['fields']));_0x1f981b[_0xd735('0x48')]=_0x1f981b['attributes'][_0xd735('0x55')]?_0x1f981b['attributes']:_0x2a554a[_0xd735('0x44')];if(!_0x359089[_0xd735('0x45')][_0xd735('0x4b')](_0xd735('0x66'))){_0x1f981b[_0xd735('0x30')]=qs['limit'](_0x359089[_0xd735('0x45')][_0xd735('0x30')]);_0x1f981b[_0xd735('0x2e')]=qs[_0xd735('0x2e')](_0x359089[_0xd735('0x45')][_0xd735('0x2e')]);}_0x1f981b[_0xd735('0x4c')]=qs[_0xd735('0x67')](_0x359089[_0xd735('0x45')]['sort']);_0x1f981b[_0xd735('0x4e')]=qs['filters'](_[_0xd735('0x68')](_0x359089[_0xd735('0x45')],_0x2a554a[_0xd735('0x47')]));_0x1f981b['where'][_0xd735('0x63')]=_0x5b413a['id'];if(_0x359089[_0xd735('0x45')]['filter']){_0x1f981b[_0xd735('0x4e')]=_[_0xd735('0x51')](_0x1f981b[_0xd735('0x4e')],{'$or':_['map'](_0x1f981b[_0xd735('0x48')],function(_0x48930d){var _0x5dd066={};_0x5dd066[_0x48930d]={'$like':'%'+_0x359089['query'][_0xd735('0x4d')]+'%'};return _0x5dd066;})});}_0x1f981b=_[_0xd735('0x51')]({},_0x1f981b,_0x359089[_0xd735('0x52')]);return db[_0xd735('0x65')][_0xd735('0x31')]({'where':_0x1f981b[_0xd735('0x4e')]})[_0xd735('0x36')](function(_0x43d29d){_0xc586e2['count']=_0x43d29d;if(_0x359089['query'][_0xd735('0x53')]){_0x1f981b[_0xd735('0x54')]=[{'all':!![]}];}return db[_0xd735('0x65')][_0xd735('0x69')](_0x1f981b);})[_0xd735('0x36')](function(_0x58fdb2){_0xc586e2[_0xd735('0x6a')]=_0x58fdb2;return _0xc586e2;});}})[_0xd735('0x36')](respondWithFilteredResult(_0x29cdd1,_0x1f981b))[_0xd735('0x57')](handleError(_0x29cdd1,null));};exports[_0xd735('0x6b')]=function(_0x94ad4c,_0x1e1dc2,_0x271c5c){return db[_0xd735('0x41')][_0xd735('0x56')]({'where':{'id':_0x94ad4c[_0xd735('0x60')]['id']}})[_0xd735('0x36')](handleEntityNotFound(_0x1e1dc2,null))['then'](function(_0x53e2c3){if(_0x53e2c3){return _0x53e2c3[_0xd735('0x6b')](_0x94ad4c[_0xd735('0x45')][_0xd735('0x6c')]);}})[_0xd735('0x36')](respondWithStatusCode(_0x1e1dc2,null))[_0xd735('0x57')](handleError(_0x1e1dc2,null));};exports['addAnswer']=function(_0x4694b1,_0x364d4c,_0x3dad09){if(_0x4694b1[_0xd735('0x59')]['id']){delete _0x4694b1[_0xd735('0x59')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x4694b1[_0xd735('0x60')]['id']}})['then'](handleEntityNotFound(_0x364d4c,null))[_0xd735('0x36')](function(_0x3044ec){if(_0x3044ec){_0x4694b1[_0xd735('0x59')][_0xd735('0x63')]=_0x3044ec['id'];return db['CannedAnswer'][_0xd735('0x58')](_0x4694b1['body']);}})[_0xd735('0x36')](respondWithResult(_0x364d4c,null))[_0xd735('0x57')](handleError(_0x364d4c,null));};exports['getAnswers']=function(_0x556b41,_0x53e882,_0x4128b5){var _0x319c78={'raw':![],'where':{}};var _0x162dff={};var _0x414845={'count':0x0,'rows':[]};return db[_0xd735('0x41')][_0xd735('0x6d')]({'where':{'id':_0x556b41[_0xd735('0x60')]['id']}})[_0xd735('0x36')](handleEntityNotFound(_0x53e882,null))[_0xd735('0x36')](function(_0x494d14){if(_0x494d14){_0x162dff[_0xd735('0x44')]=_['keys'](db[_0xd735('0x6e')][_0xd735('0x42')]);_0x162dff[_0xd735('0x45')]=_['keys'](_0x556b41[_0xd735('0x45')]);_0x162dff[_0xd735('0x47')]=_[_0xd735('0x49')](_0x162dff['model'],_0x162dff['query']);_0x319c78['attributes']=_[_0xd735('0x49')](_0x162dff[_0xd735('0x44')],qs['fields'](_0x556b41[_0xd735('0x45')][_0xd735('0x4a')]));_0x319c78[_0xd735('0x48')]=_0x319c78[_0xd735('0x48')][_0xd735('0x55')]?_0x319c78[_0xd735('0x48')]:_0x162dff[_0xd735('0x44')];if(!_0x556b41[_0xd735('0x45')][_0xd735('0x4b')](_0xd735('0x66'))){_0x319c78['limit']=qs[_0xd735('0x30')](_0x556b41[_0xd735('0x45')][_0xd735('0x30')]);_0x319c78[_0xd735('0x2e')]=qs[_0xd735('0x2e')](_0x556b41[_0xd735('0x45')][_0xd735('0x2e')]);}_0x319c78[_0xd735('0x4c')]=qs['sort'](_0x556b41[_0xd735('0x45')][_0xd735('0x67')]);_0x319c78['where']=qs[_0xd735('0x47')](_[_0xd735('0x68')](_0x556b41['query'],_0x162dff[_0xd735('0x47')]));_0x319c78['where'][_0xd735('0x63')]=_0x494d14['id'];if(_0x556b41[_0xd735('0x45')][_0xd735('0x4d')]){_0x319c78[_0xd735('0x4e')]=_['merge'](_0x319c78[_0xd735('0x4e')],{'$or':_['map'](_0x319c78[_0xd735('0x48')],function(_0x1234ce){var _0x738982={};_0x738982[_0x1234ce]={'$like':'%'+_0x556b41[_0xd735('0x45')]['filter']+'%'};return _0x738982;})});}_0x319c78=_[_0xd735('0x51')]({},_0x319c78,_0x556b41[_0xd735('0x52')]);return db['CannedAnswer'][_0xd735('0x31')]({'where':_0x319c78[_0xd735('0x4e')]})[_0xd735('0x36')](function(_0x373370){_0x414845[_0xd735('0x31')]=_0x373370;if(_0x556b41[_0xd735('0x45')][_0xd735('0x53')]){_0x319c78[_0xd735('0x54')]=[{'all':!![]}];}return db[_0xd735('0x6e')][_0xd735('0x69')](_0x319c78);})[_0xd735('0x36')](function(_0x4eff89){_0x414845['rows']=_0x4eff89;return _0x414845;});}})[_0xd735('0x36')](respondWithFilteredResult(_0x53e882,_0x319c78))[_0xd735('0x57')](handleError(_0x53e882,null));};exports[_0xd735('0x6f')]=function(_0x275ce5,_0x5d7ec0,_0x153eed){return db[_0xd735('0x41')][_0xd735('0x56')]({'where':{'id':_0x275ce5['params']['id']}})[_0xd735('0x36')](handleEntityNotFound(_0x5d7ec0,null))['then'](function(_0x94b2a6){if(_0x94b2a6){return _0x94b2a6['removeAnswers'](_0x275ce5[_0xd735('0x45')]['ids']);}})['then'](respondWithStatusCode(_0x5d7ec0,null))[_0xd735('0x57')](handleError(_0x5d7ec0,null));};exports[_0xd735('0x70')]=function(_0x4f654f,_0x4841df,_0x2a7738){var _0x219bb8={'body':_0x4f654f['body'],'channel':'openchannel'};var _0x113def=[];var _0x378e06=[];var _0x364b9a={};var _0x28058b=![];return db[_0xd735('0x71')]['describe']()['then'](function(_0x21b54f){if(!_0x21b54f){throw new db[(_0xd735('0x72'))][(_0xd735('0x73'))](_0xd735('0x74'));}_0x113def=_[_0xd735('0x75')](_[_0xd735('0x46')](_0x21b54f),[_0xd735('0x76'),_0xd735('0x77')]);_0x378e06=_[_0xd735('0x75')](_['keys'](_0x21b54f),[_0xd735('0x76'),_0xd735('0x77'),_0xd735('0x78'),'ListId']);if(_0x4f654f[_0xd735('0x59')]['id']){delete _0x4f654f[_0xd735('0x59')]['id'];}if(_['isNil'](_0x4f654f[_0xd735('0x59')][_0xd735('0x79')])){throw new db['Sequelize']['ValidationError'](_0xd735('0x7a'));}if(_['isNil'](_0x4f654f[_0xd735('0x59')][_0xd735('0x59')])||_0x4f654f['body'][_0xd735('0x59')]===''){throw new db[(_0xd735('0x72'))][(_0xd735('0x73'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x4f654f[_0xd735('0x59')][_0xd735('0x7b')])){throw new db[(_0xd735('0x72'))][(_0xd735('0x73'))](_0xd735('0x7c')+_0x378e06);}if(!_['includes'](_0x378e06,_0x4f654f[_0xd735('0x59')][_0xd735('0x7b')])){throw new db[(_0xd735('0x72'))]['ValidationError'](_0xd735('0x7d')+_0x378e06);}_0x364b9a[_0x4f654f['body'][_0xd735('0x7b')]]=_0x4f654f[_0xd735('0x59')][_0xd735('0x79')];})['then'](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x4f654f['params']['id']},'include':[{'model':db['CmList'],'as':_0xd735('0x7e'),'include':[{'model':db[_0xd735('0x71')],'as':_0xd735('0x7f'),'where':_0x364b9a,'limit':0x1,'order':[['updatedAt',_0xd735('0x80')]]}]},{'model':db['OpenchannelApplication'],'as':'Applications'}]});})[_0xd735('0x36')](handleEntityNotFound(_0x4841df,null))[_0xd735('0x36')](function(_0x2cc178){if(_0x2cc178&&_0x2cc178[_0xd735('0x7e')]){_0x219bb8[_0xd735('0x81')]=_0x2cc178;_0x219bb8[_0xd735('0x82')]=_0x2cc178[_0xd735('0x83')];_0x219bb8[_0xd735('0x84')]=_0x2cc178[_0xd735('0x7e')];_0x219bb8[_0xd735('0x82')]=_[_0xd735('0x85')](_0x219bb8['applications'],['priority'],[_0xd735('0x86')]);if(_0x219bb8['account'][_0xd735('0x83')]){delete _0x219bb8[_0xd735('0x81')][_0xd735('0x83')];}if(_0x219bb8[_0xd735('0x81')]['List']&&_0x219bb8[_0xd735('0x81')][_0xd735('0x7e')][_0xd735('0x7f')][_0xd735('0x55')]){return _0x219bb8[_0xd735('0x81')]['List'][_0xd735('0x7f')][0x0];}var _0x5eb25c=_[_0xd735('0x1a')](_0x4f654f[_0xd735('0x59')],{'firstName':_0x4f654f[_0xd735('0x59')][_0xd735('0x79')],'ListId':_0x2cc178['ListId']});_0x5eb25c[_0x4f654f[_0xd735('0x59')][_0xd735('0x7b')]]=_0x4f654f[_0xd735('0x59')][_0xd735('0x79')];return db[_0xd735('0x71')]['create'](_0x5eb25c,{'fields':_0x113def,'raw':!![]});}})[_0xd735('0x36')](handleEntityNotFound(_0x4841df,null))['then'](function(_0x105d8a){_0x219bb8['contact']=_0x105d8a;if(_0x105d8a){var _0x12ad92={'ContactId':_0x105d8a['id'],'OpenchannelAccountId':_0x4f654f[_0xd735('0x60')]['id'],'from':(_0x105d8a[_0xd735('0x87')]||'')+'\x20'+(_0x105d8a[_0xd735('0x88')]||'')};var _0x201662={'OpenchannelAccountId':_0x4f654f[_0xd735('0x60')]['id'],'closed':![]};if(_0x4f654f[_0xd735('0x59')][_0xd735('0x89')]){_0x201662[_0xd735('0x89')]=_0x4f654f[_0xd735('0x59')][_0xd735('0x89')];return db['OpenchannelInteraction'][_0xd735('0x56')]({'where':_0x201662})[_0xd735('0x36')](function(_0xc9f094){if(_0xc9f094){return[_0xc9f094,![]];}_0x12ad92[_0xd735('0x89')]=_0x4f654f['body'][_0xd735('0x89')];_0x12ad92['externalUrl']=_0x4f654f[_0xd735('0x59')]['externalUrl'];return db[_0xd735('0x8a')][_0xd735('0x58')](_0x12ad92)[_0xd735('0x36')](function(_0x45a22a){return[_0x45a22a,!![]];});});}else{_0x201662['threadId']=null;}_0x201662[_0xd735('0x8b')]=_0x105d8a['id'];return db['OpenchannelInteraction'][_0xd735('0x56')]({'where':_0x201662})[_0xd735('0x36')](function(_0x4e24fe){if(_0x4e24fe){return[_0x4e24fe,![]];}return db['OpenchannelInteraction'][_0xd735('0x58')](_0x12ad92)['then'](function(_0x2d4630){return[_0x2d4630,!![]];});});}})['spread'](function(_0x18be11,_0x29a6f5){if(_0x18be11){_0x28058b=_0x29a6f5;if(!_0x29a6f5){var _0x40955a={'from':(_0x219bb8[_0xd735('0x8c')][_0xd735('0x87')]||'')+'\x20'+(_0x219bb8[_0xd735('0x8c')][_0xd735('0x88')]||'')};if(_0x4f654f[_0xd735('0x59')][_0xd735('0x89')]&&_0x4f654f['body'][_0xd735('0x8d')]&&_0x4f654f['body'][_0xd735('0x89')]!=_0x4f654f[_0xd735('0x59')]['messageId']){_0x40955a[_0xd735('0x89')]=_0x4f654f[_0xd735('0x59')]['messageId'];}return _0x18be11[_0xd735('0x35')](_0x40955a);}else{return _0x18be11;}}})[_0xd735('0x36')](function(_0x415854){_0x219bb8['interaction']=_0x415854[_0xd735('0x38')]({'plain':!![]});_0x219bb8[_0xd735('0x8e')]['created']=_0x28058b;if(_0x219bb8['interaction'][_0xd735('0x8f')]){if(_0x219bb8[_0xd735('0x81')][_0xd735('0x90')]){_0x219bb8[_0xd735('0x82')][_0xd735('0x91')]({'id':0x0,'priority':_0x219bb8[_0xd735('0x82')]['length']+0x1,'app':_0xd735('0x92'),'appdata':'unmanaged','interval':_0xd735('0x93')});}}return db['OpenchannelMessage'][_0xd735('0x58')]({'body':_0x4f654f['body'][_0xd735('0x59')],'OpenchannelAccountId':_0x4f654f[_0xd735('0x60')]['id'],'OpenchannelInteractionId':_0x415854['id'],'direction':'in','ContactId':_0x219bb8[_0xd735('0x8c')]['id'],'AttachmentId':_0x4f654f[_0xd735('0x59')][_0xd735('0x94')]});})[_0xd735('0x36')](function(_0x35cebd){_0x219bb8[_0xd735('0x27')]=_0x35cebd;if(_0x219bb8[_0xd735('0x8e')][_0xd735('0x95')]){return db[_0xd735('0x96')][_0xd735('0x56')]({'attributes':['id',_0xd735('0x3c')],'where':{'id':_0x219bb8[_0xd735('0x8e')][_0xd735('0x95')]}})['then'](function(_0x1b0f1b){if(_0x1b0f1b){_0x219bb8['applications'][_0xd735('0x97')]({'id':0x0,'priority':0x0,'app':_0xd735('0x98'),'appdata':_0x1b0f1b['name']+','+(_0x219bb8[_0xd735('0x81')][_0xd735('0x99')]||0xa),'interval':_0xd735('0x93')});_0x219bb8[_0xd735('0x9a')]=![];}return respondWithRpcPromise('Start','startRouting',_0x219bb8);});}return respondWithRpcPromise(_0xd735('0x9b'),_0xd735('0x9c'),_0x219bb8);})['then'](function(_0x188df0){respondWithRpcPromise(_0xd735('0x9d'),_0xd735('0x9d'),{'event':'notify','message':_0x188df0},client9002);return _0x188df0;})[_0xd735('0x36')](respondWithResult(_0x4841df,null))[_0xd735('0x57')](handleError(_0x4841df,null));};exports[_0xd735('0x9e')]=function(_0xfe39a,_0x2dddca,_0x4e4c75){return db[_0xd735('0x41')][_0xd735('0x6d')]({'where':{'id':_0xfe39a[_0xd735('0x60')]['id']}})[_0xd735('0x36')](handleEntityNotFound(_0x2dddca,null))[_0xd735('0x36')](function(_0x50eaec){if(_0x50eaec){return db[_0xd735('0x9f')][_0xd735('0xa0')](function(_0x3e43a0){return db[_0xd735('0xa1')][_0xd735('0x37')]({'where':{'OpenchannelAccountId':_0xfe39a[_0xd735('0x60')]['id']},'transaction':_0x3e43a0})[_0xd735('0x36')](function(_0x2bd5d4){var _0x4bbfde=_['map'](_0xfe39a[_0xd735('0x59')],function(_0x30f41d){_0x30f41d[_0xd735('0x63')]=_0xfe39a[_0xd735('0x60')]['id'];return _0x30f41d;});return db[_0xd735('0xa1')]['bulkCreate'](_0x4bbfde,{'transaction':_0x3e43a0});});})[_0xd735('0x36')](function(){return db[_0xd735('0xa1')][_0xd735('0xa2')]({'where':{'OpenchannelAccountId':_0xfe39a[_0xd735('0x60')]['id']},'order':'priority'});});}})[_0xd735('0x36')](respondWithResult(_0x2dddca,null))[_0xd735('0x57')](handleError(_0x2dddca,null));};exports[_0xd735('0xa3')]=function(_0x25f0b2,_0x4b4f38,_0x5581f8){var _0x11d308={};var _0x48c536={};var _0x28edf1;var _0x19364c;return db[_0xd735('0x41')][_0xd735('0x6d')]({'where':{'id':_0x25f0b2[_0xd735('0x60')]['id']}})[_0xd735('0x36')](handleEntityNotFound(_0x4b4f38,null))[_0xd735('0x36')](function(_0x45ff56){if(_0x45ff56){_0x28edf1=_0x45ff56;_0x48c536[_0xd735('0x44')]=_[_0xd735('0x46')](db[_0xd735('0xa1')][_0xd735('0x42')]);_0x48c536[_0xd735('0x45')]=_[_0xd735('0x46')](_0x25f0b2[_0xd735('0x45')]);_0x48c536[_0xd735('0x47')]=_[_0xd735('0x49')](_0x48c536['model'],_0x48c536[_0xd735('0x45')]);_0x11d308['attributes']=_['intersection'](_0x48c536[_0xd735('0x44')],qs[_0xd735('0x4a')](_0x25f0b2['query'][_0xd735('0x4a')]));_0x11d308[_0xd735('0x48')]=_0x11d308[_0xd735('0x48')][_0xd735('0x55')]?_0x11d308[_0xd735('0x48')]:_0x48c536['model'];_0x11d308[_0xd735('0x4c')]=qs['sort'](_0x25f0b2['query']['sort']);_0x11d308[_0xd735('0x4e')]=qs[_0xd735('0x47')](_[_0xd735('0x68')](_0x25f0b2[_0xd735('0x45')],_0x48c536[_0xd735('0x47')]));if(_0x25f0b2[_0xd735('0x45')][_0xd735('0x4d')]){_0x11d308[_0xd735('0x4e')]=_[_0xd735('0x51')](_0x11d308['where'],{'$or':_[_0xd735('0x40')](_0x11d308['attributes'],function(_0x3959e2){var _0x3750e4={};_0x3750e4[_0x3959e2]={'$like':'%'+_0x25f0b2[_0xd735('0x45')]['filter']+'%'};return _0x3750e4;})});}_0x11d308=_[_0xd735('0x51')]({},_0x11d308,_0x25f0b2[_0xd735('0x52')]);return _0x28edf1['getApplications'](_0x11d308);}})[_0xd735('0x36')](function(_0x572fe6){if(_0x572fe6){_0x19364c=_0x572fe6[_0xd735('0x55')];if(!_0x25f0b2['query'][_0xd735('0x4b')](_0xd735('0x66'))){_0x11d308[_0xd735('0x30')]=qs[_0xd735('0x30')](_0x25f0b2[_0xd735('0x45')][_0xd735('0x30')]);_0x11d308['offset']=qs[_0xd735('0x2e')](_0x25f0b2[_0xd735('0x45')]['offset']);}return _0x28edf1[_0xd735('0xa3')](_0x11d308);}})['then'](function(_0x2ef558){if(_0x2ef558){return _0x2ef558?{'count':_0x19364c,'rows':_0x2ef558}:null;}})[_0xd735('0x36')](respondWithResult(_0x4b4f38,null))['catch'](handleError(_0x4b4f38,null));};exports[_0xd735('0xa4')]=function(_0x531a46,_0x456ccb,_0x47092d){var _0x36f986={'raw':![],'where':{}};var _0x55e85c={};var _0x167f73={'count':0x0,'rows':[]};return db[_0xd735('0x41')][_0xd735('0x6d')]({'where':{'id':_0x531a46[_0xd735('0x60')]['id']}})[_0xd735('0x36')](handleEntityNotFound(_0x456ccb,null))[_0xd735('0x36')](function(_0x36026b){if(_0x36026b){_0x55e85c[_0xd735('0x44')]=_[_0xd735('0x46')](db[_0xd735('0x8a')][_0xd735('0x42')]);_0x55e85c[_0xd735('0x45')]=_['keys'](_0x531a46[_0xd735('0x45')]);_0x55e85c['filters']=_['intersection'](_0x55e85c['model'],_0x55e85c[_0xd735('0x45')]);_0x36f986[_0xd735('0x48')]=_[_0xd735('0x49')](_0x55e85c[_0xd735('0x44')],qs[_0xd735('0x4a')](_0x531a46[_0xd735('0x45')][_0xd735('0x4a')]));_0x36f986[_0xd735('0x48')]=_0x36f986[_0xd735('0x48')][_0xd735('0x55')]?_0x36f986[_0xd735('0x48')]:_0x55e85c[_0xd735('0x44')];if(!_0x531a46[_0xd735('0x45')][_0xd735('0x4b')]('nolimit')){_0x36f986[_0xd735('0x30')]=qs[_0xd735('0x30')](_0x531a46[_0xd735('0x45')][_0xd735('0x30')]);_0x36f986[_0xd735('0x2e')]=qs['offset'](_0x531a46[_0xd735('0x45')][_0xd735('0x2e')]);}_0x36f986[_0xd735('0x4c')]=qs[_0xd735('0x67')](_0x531a46[_0xd735('0x45')][_0xd735('0x67')]);_0x36f986[_0xd735('0x4e')]=qs[_0xd735('0x47')](_[_0xd735('0x68')](_0x531a46[_0xd735('0x45')],_0x55e85c['filters']));_0x36f986[_0xd735('0x4e')][_0xd735('0x63')]=_0x36026b['id'];if(_0x531a46['query']['filter']){_0x36f986[_0xd735('0x4e')]=_[_0xd735('0x51')](_0x36f986[_0xd735('0x4e')],{'$or':_[_0xd735('0x40')](_0x36f986['attributes'],function(_0x107ea1){var _0x5b0b71={};_0x5b0b71[_0x107ea1]={'$like':'%'+_0x531a46['query'][_0xd735('0x4d')]+'%'};return _0x5b0b71;})});}_0x36f986=_[_0xd735('0x51')]({},_0x36f986,_0x531a46['options']);return db[_0xd735('0x8a')][_0xd735('0x31')]({'where':_0x36f986['where']})['then'](function(_0x55ec7d){_0x167f73['count']=_0x55ec7d;if(_0x531a46[_0xd735('0x45')][_0xd735('0x53')]){_0x36f986[_0xd735('0x54')]=[{'model':db['CmContact'],'as':_0xd735('0xa5'),'required':![]},{'model':db[_0xd735('0x96')],'as':'Owner','attributes':[_0xd735('0x3c'),'fullname',_0xd735('0xa6')],'required':![]},{'model':db[_0xd735('0xa7')],'as':_0xd735('0xa8'),'attributes':['id',_0xd735('0x3c'),_0xd735('0xa9')],'where':_0x531a46[_0xd735('0x45')][_0xd735('0xaa')]?{'id':_0x531a46[_0xd735('0x45')][_0xd735('0xaa')]}:undefined,'required':_0x531a46[_0xd735('0x45')]['tag']?!![]:![]}];}return db[_0xd735('0x8a')][_0xd735('0x69')](_0x36f986);})[_0xd735('0x36')](function(_0x466fac){_0x167f73[_0xd735('0x6a')]=_0x466fac;return _0x167f73;});}})[_0xd735('0x36')](respondWithFilteredResult(_0x456ccb,_0x36f986))[_0xd735('0x57')](handleError(_0x456ccb,null));};exports[_0xd735('0xab')]=function(_0x493e22,_0x531a14,_0x402360){return db[_0xd735('0x41')][_0xd735('0x56')]({'where':{'id':_0x493e22[_0xd735('0x60')]['id']}})[_0xd735('0x36')](handleEntityNotFound(_0x531a14,null))[_0xd735('0x36')](function(_0x578f47){if(_0x578f47){return _0x578f47[_0xd735('0xab')](_0x493e22['body']['ids'],_[_0xd735('0xac')](_0x493e22['body'],[_0xd735('0x6c'),'id'])||{})[_0xd735('0xad')](function(_0x57b6a5){for(var _0x2982ab=0x0;_0x2982ab<_0x493e22[_0xd735('0x59')][_0xd735('0x6c')][_0xd735('0x55')];_0x2982ab+=0x1){socket[_0xd735('0xae')](_0xd735('0xaf'),{'UserId':Number(_0x493e22[_0xd735('0x59')][_0xd735('0x6c')][_0x2982ab]),'OpenchannelAccountId':Number(_0x493e22[_0xd735('0x60')]['id'])});}return _0x57b6a5;});}})[_0xd735('0x36')](respondWithResult(_0x531a14,null))[_0xd735('0x57')](handleError(_0x531a14,null));};exports[_0xd735('0xb0')]=function(_0x429cfa,_0x2122b2,_0x3f9dd3){return db['OpenchannelAccount'][_0xd735('0x56')]({'where':{'id':_0x429cfa[_0xd735('0x60')]['id']}})['then'](handleEntityNotFound(_0x2122b2,null))[_0xd735('0x36')](function(_0x529802){if(_0x529802){return _0x529802['removeAgents'](_0x429cfa[_0xd735('0x45')]['ids'])['then'](function(){if(_['isArray'](_0x429cfa[_0xd735('0x45')][_0xd735('0x6c')])){for(var _0xed4ac=0x0;_0xed4ac<_0x429cfa[_0xd735('0x45')][_0xd735('0x6c')][_0xd735('0x55')];_0xed4ac+=0x1){socket['emit'](_0xd735('0xb1'),{'UserId':Number(_0x429cfa[_0xd735('0x45')]['ids'][_0xed4ac]),'OpenchannelAccountId':Number(_0x429cfa[_0xd735('0x60')]['id'])});}}else{socket['emit'](_0xd735('0xb1'),{'UserId':Number(_0x429cfa['query'][_0xd735('0x6c')]),'OpenchannelAccountId':Number(_0x429cfa[_0xd735('0x60')]['id'])});}});}})[_0xd735('0x36')](respondWithStatusCode(_0x2122b2,null))[_0xd735('0x57')](handleError(_0x2122b2,null));};exports['getAgents']=function(_0x5af3aa,_0xa6b4c,_0x31711e){var _0x3973bb={};var _0x5e5c33={};var _0x3882bf;var _0x438f28;return db[_0xd735('0x41')]['findOne']({'where':{'id':_0x5af3aa['params']['id']}})[_0xd735('0x36')](handleEntityNotFound(_0xa6b4c,null))[_0xd735('0x36')](function(_0x5ffe4e){if(_0x5ffe4e){_0x3882bf=_0x5ffe4e;_0x5e5c33[_0xd735('0x44')]=_[_0xd735('0x46')](db[_0xd735('0x96')][_0xd735('0x42')]);_0x5e5c33[_0xd735('0x45')]=_[_0xd735('0x46')](_0x5af3aa[_0xd735('0x45')]);_0x5e5c33[_0xd735('0x47')]=_[_0xd735('0x49')](_0x5e5c33[_0xd735('0x44')],_0x5e5c33[_0xd735('0x45')]);_0x3973bb[_0xd735('0x48')]=_[_0xd735('0x49')](_0x5e5c33[_0xd735('0x44')],qs['fields'](_0x5af3aa[_0xd735('0x45')][_0xd735('0x4a')]));_0x3973bb[_0xd735('0x48')]=_0x3973bb[_0xd735('0x48')][_0xd735('0x55')]?_0x3973bb[_0xd735('0x48')]:_0x5e5c33[_0xd735('0x44')];_0x3973bb[_0xd735('0x4c')]=qs['sort'](_0x5af3aa[_0xd735('0x45')][_0xd735('0x67')]);_0x3973bb[_0xd735('0x4e')]=qs['filters'](_[_0xd735('0x68')](_0x5af3aa[_0xd735('0x45')],_0x5e5c33['filters']));if(_0x5af3aa[_0xd735('0x45')][_0xd735('0x4d')]){_0x3973bb[_0xd735('0x4e')]=_[_0xd735('0x51')](_0x3973bb['where'],{'$or':_[_0xd735('0x40')](_0x3973bb[_0xd735('0x48')],function(_0x5ebfe4){var _0x4f5e40={};_0x4f5e40[_0x5ebfe4]={'$like':'%'+_0x5af3aa[_0xd735('0x45')]['filter']+'%'};return _0x4f5e40;})});}_0x3973bb=_['merge']({},_0x3973bb,_0x5af3aa[_0xd735('0x52')]);return _0x3882bf[_0xd735('0xb2')](_0x3973bb);}})[_0xd735('0x36')](function(_0x177ed7){if(_0x177ed7){_0x438f28=_0x177ed7[_0xd735('0x55')];if(!_0x5af3aa[_0xd735('0x45')][_0xd735('0x4b')]('nolimit')){_0x3973bb[_0xd735('0x30')]=qs['limit'](_0x5af3aa[_0xd735('0x45')][_0xd735('0x30')]);_0x3973bb[_0xd735('0x2e')]=qs[_0xd735('0x2e')](_0x5af3aa[_0xd735('0x45')]['offset']);}return _0x3882bf[_0xd735('0xb2')](_0x3973bb);}})['then'](function(_0x3d2888){if(_0x3d2888){return _0x3d2888?{'count':_0x438f28,'rows':_0x3d2888}:null;}})[_0xd735('0x36')](respondWithResult(_0xa6b4c,null))[_0xd735('0x57')](handleError(_0xa6b4c,null));};exports[_0xd735('0xb3')]=function(_0x11afdc,_0x3844de,_0x434339){var _0x43c3d5,_0x3a4d10,_0x1f2069;if(_[_0xd735('0xb4')](_0x11afdc[_0xd735('0x59')][_0xd735('0x59')])||_0x11afdc[_0xd735('0x59')][_0xd735('0x59')]===''){throw new db[(_0xd735('0x72'))][(_0xd735('0x73'))](_0xd735('0xb5'));}if(_[_0xd735('0xb4')](_0x11afdc[_0xd735('0x59')]['to'])){}_0x43c3d5=_0x11afdc[_0xd735('0x59')]['to'];return db[_0xd735('0x41')]['findOne']({'where':{'id':_0x11afdc[_0xd735('0x60')]['id']}})['then'](handleEntityNotFound(_0x3844de,null))['then'](function(_0x12cca5){if(_0x12cca5){return db['OpenchannelAccount']['find']({'where':{'id':_0x12cca5['id']},'include':[{'model':db[_0xd735('0xb6')],'as':'List','include':[{'model':db[_0xd735('0x71')],'as':'Contacts','where':{[_0x12cca5[_0xd735('0x7b')]]:_0x43c3d5},'limit':0x1,'order':[[_0xd735('0x77'),_0xd735('0x80')]]}]}]})[_0xd735('0x36')](handleEntityNotFound(_0x3844de,null))[_0xd735('0x36')](function(_0x486965){if(_0x486965&&_0x486965[_0xd735('0x7e')]){_0x3a4d10=_0x486965[_0xd735('0x38')]({'plain':!![]});if(_0x3a4d10[_0xd735('0x7e')]&&_0x3a4d10['List'][_0xd735('0x7f')]['length']){return _0x3a4d10['List'][_0xd735('0x7f')][0x0];}return db[_0xd735('0x71')]['create'](_['defaults'](_0x11afdc['body'],{'firstName':_0x43c3d5,[_0x486965[_0xd735('0x7b')]]:_0x43c3d5,'phone':_0x43c3d5,'ListId':_0x3a4d10[_0xd735('0xb7')]}));}})[_0xd735('0x36')](handleEntityNotFound(_0x3844de,null))['then'](function(_0x30d97d){if(_0x30d97d){_0x1f2069=_0x30d97d;return db['OpenchannelInteraction'][_0xd735('0x56')]({'where':{'ContactId':_0x1f2069['id'],'closed':![],'OpenchannelAccountId':_0x3a4d10['id']}})[_0xd735('0x36')](function(_0x4b9a91){if(_0x4b9a91){return[_0x4b9a91,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x11afdc[_0xd735('0x5a')]['id'],'ContactId':_0x1f2069['id'],'OpenchannelAccountId':_0x3a4d10['id'],'lastMsgDirection':'out','Messages':[_[_0xd735('0x51')](_0x11afdc[_0xd735('0x59')],{'read':![],'body':_0x11afdc['body'][_0xd735('0x59')],'OpenchannelAccountId':_0x3a4d10['id'],'UserId':_0x11afdc[_0xd735('0x5a')]['id'],'ContactId':_0x1f2069['id']})]},{'include':[{'model':db[_0xd735('0xb8')],'as':'Messages'}]})[_0xd735('0x36')](function(_0x23f120){return[_0x23f120,!![]];});});}})['spread'](function(_0x237dc1,_0x19d6ee){if(_0x19d6ee){return _0x237dc1;}return db['OpenchannelMessage'][_0xd735('0x58')](_[_0xd735('0x51')](_0x11afdc['body'],{'read':![],'body':_0x11afdc[_0xd735('0x59')][_0xd735('0x59')],'OpenchannelAccountId':_0x3a4d10['id'],'OpenchannelInteractionId':_0x237dc1['id'],'UserId':_0x11afdc[_0xd735('0x5a')]['id'],'ContactId':_0x1f2069['id']}))[_0xd735('0x36')](function(_0x435345){_0x237dc1['dataValues'][_0xd735('0xb9')]=[];_0x237dc1[_0xd735('0xba')][_0xd735('0xb9')][_0xd735('0x91')](_0x435345[_0xd735('0xba')]);return _0x237dc1;});});}})[_0xd735('0x36')](respondWithResult(_0x3844de,null))['catch'](handleError(_0x3844de,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 7de5520..2812d82 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 _0xdace=['save','remove','emit','hasOwnProperty','exports','events','OpenchannelAccount','setMaxListeners'];(function(_0x16af15,_0x55bc76){var _0xfeda8a=function(_0x13ad56){while(--_0x13ad56){_0x16af15['push'](_0x16af15['shift']());}};_0xfeda8a(++_0x55bc76);}(_0xdace,0xc5));var _0xedac=function(_0xc87d08,_0x59c9be){_0xc87d08=_0xc87d08-0x0;var _0x30a714=_0xdace[_0xc87d08];return _0x30a714;};'use strict';var EventEmitter=require(_0xedac('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xedac('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xedac('0x2')](0x0);var events={'afterCreate':_0xedac('0x3'),'afterUpdate':'update','afterDestroy':_0xedac('0x4')};function emitEvent(_0x36bcd2){return function(_0x15d3bd,_0xefb142,_0x5a97c0){OpenchannelAccountEvents[_0xedac('0x5')](_0x36bcd2+':'+_0x15d3bd['id'],_0x15d3bd);OpenchannelAccountEvents[_0xedac('0x5')](_0x36bcd2,_0x15d3bd);_0x5a97c0(null);};}for(var e in events){if(events[_0xedac('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0xedac('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x878f=['hook','exports','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit'];(function(_0x4a20fb,_0x39be40){var _0x51fbdd=function(_0x3cf7b2){while(--_0x3cf7b2){_0x4a20fb['push'](_0x4a20fb['shift']());}};_0x51fbdd(++_0x39be40);}(_0x878f,0x173));var _0xf878=function(_0x155699,_0x4577b6){_0x155699=_0x155699-0x0;var _0x2d4989=_0x878f[_0x155699];return _0x2d4989;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xf878('0x0'))['db'][_0xf878('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xf878('0x2')](0x0);var events={'afterCreate':_0xf878('0x3'),'afterUpdate':_0xf878('0x4'),'afterDestroy':_0xf878('0x5')};function emitEvent(_0x9e6783){return function(_0x45a37b,_0x240b48,_0xcf1927){OpenchannelAccountEvents[_0xf878('0x6')](_0x9e6783+':'+_0x45a37b['id'],_0x45a37b);OpenchannelAccountEvents['emit'](_0x9e6783,_0x45a37b);_0xcf1927(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xf878('0x7')](e,emitEvent(event));}}module[_0xf878('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index b2a7be8..c820804 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(_0x1ae646,_0x475dfb){var _0x5ddb01=function(_0x24ac79){while(--_0x24ac79){_0x1ae646['push'](_0x1ae646['shift']());}};_0x5ddb01(++_0x475dfb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0x8a5499,_0x542668){var _0x5892e4=function(_0x49b402){while(--_0x49b402){_0x8a5499['push'](_0x8a5499['shift']());}};_0x5892e4(++_0x542668);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 ae1b068..8297c1b 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 _0x5eb8=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','register','request','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4c6cbb,_0x109cbe){var _0x4ac1ee=function(_0x4fec6e){while(--_0x4fec6e){_0x4c6cbb['push'](_0x4c6cbb['shift']());}};_0x4ac1ee(++_0x109cbe);}(_0x5eb8,0xb0));var _0x85eb=function(_0x2cb3eb,_0x4d83aa){_0x2cb3eb=_0x2cb3eb-0x0;var _0x2759ee=_0x5eb8[_0x2cb3eb];return _0x2759ee;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});config['redis']=_[_0x85eb('0xc')](config[_0x85eb('0xd')],{'host':_0x85eb('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x85eb('0xd')]));require('./openchannelAccount.socket')[_0x85eb('0xf')](socket);function respondWithRpcPromise(_0x40d6b6,_0x673228,_0x29030b){return new BPromise(function(_0x1dacf2,_0x73e6d0){return client[_0x85eb('0x10')](_0x40d6b6,_0x29030b)['then'](function(_0x163f32){logger[_0x85eb('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x673228,_0x85eb('0x12'));logger[_0x85eb('0x13')](_0x85eb('0x14'),_0x673228,_0x85eb('0x12'),JSON['stringify'](_0x163f32));if(_0x163f32['error']){if(_0x163f32[_0x85eb('0x15')]['code']===0x1f4){logger[_0x85eb('0x15')](_0x85eb('0x16'),_0x673228,_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);return _0x73e6d0(_0x163f32[_0x85eb('0x15')]['message']);}logger[_0x85eb('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x673228,_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);return _0x1dacf2(_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x673228,'request\x20sent');_0x1dacf2(_0x163f32[_0x85eb('0x18')][_0x85eb('0x17')]);}})[_0x85eb('0x19')](function(_0x2e986c){logger[_0x85eb('0x15')](_0x85eb('0x16'),_0x673228,_0x2e986c);_0x73e6d0(_0x2e986c);});});} \ No newline at end of file +var _0x8130=['redis','defaults','localhost','socket.io-emitter','register','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http'];(function(_0x1784d8,_0x2acdde){var _0x1ecc15=function(_0x545162){while(--_0x545162){_0x1784d8['push'](_0x1784d8['shift']());}};_0x1ecc15(++_0x2acdde);}(_0x8130,0x146));var _0x0813=function(_0x14600a,_0x371ae1){_0x14600a=_0x14600a-0x0;var _0x4192f0=_0x8130[_0x14600a];return _0x4192f0;};'use strict';var _=require(_0x0813('0x0'));var util=require(_0x0813('0x1'));var moment=require('moment');var BPromise=require(_0x0813('0x2'));var rs=require(_0x0813('0x3'));var fs=require('fs');var Redis=require(_0x0813('0x4'));var db=require(_0x0813('0x5'))['db'];var utils=require(_0x0813('0x6'));var logger=require(_0x0813('0x7'))('rpc');var config=require(_0x0813('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0813('0x9')]({'port':0x232a});config[_0x0813('0xa')]=_[_0x0813('0xb')](config[_0x0813('0xa')],{'host':_0x0813('0xc'),'port':0x18eb});var socket=require(_0x0813('0xd'))(new Redis(config[_0x0813('0xa')]));require('./openchannelAccount.socket')[_0x0813('0xe')](socket);function respondWithRpcPromise(_0x1815be,_0x251ca8,_0x5a9c5e){return new BPromise(function(_0x5550c8,_0x15f8d6){return client['request'](_0x1815be,_0x5a9c5e)[_0x0813('0xf')](function(_0x5b54ec){logger[_0x0813('0x10')](_0x0813('0x11'),_0x251ca8,_0x0813('0x12'));logger[_0x0813('0x13')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x251ca8,'request\x20sent',JSON[_0x0813('0x14')](_0x5b54ec));if(_0x5b54ec[_0x0813('0x15')]){if(_0x5b54ec['error'][_0x0813('0x16')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x251ca8,_0x5b54ec[_0x0813('0x15')][_0x0813('0x17')]);return _0x15f8d6(_0x5b54ec['error'][_0x0813('0x17')]);}logger['error'](_0x0813('0x11'),_0x251ca8,_0x5b54ec[_0x0813('0x15')][_0x0813('0x17')]);return _0x5550c8(_0x5b54ec[_0x0813('0x15')][_0x0813('0x17')]);}else{logger[_0x0813('0x10')](_0x0813('0x11'),_0x251ca8,_0x0813('0x12'));_0x5550c8(_0x5b54ec['result'][_0x0813('0x17')]);}})['catch'](function(_0x112720){logger[_0x0813('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x251ca8,_0x112720);_0x15f8d6(_0x112720);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 7df1c0b..d711743 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 _0x4156=['emit','removeListener','register','./openchannelAccount.events','save','remove','update'];(function(_0x4b541e,_0x1f234c){var _0x2255eb=function(_0x479855){while(--_0x479855){_0x4b541e['push'](_0x4b541e['shift']());}};_0x2255eb(++_0x1f234c);}(_0x4156,0xf1));var _0x6415=function(_0x5cea57,_0x450263){_0x5cea57=_0x5cea57-0x0;var _0xc2827=_0x4156[_0x5cea57];return _0xc2827;};'use strict';var OpenchannelAccountEvents=require(_0x6415('0x0'));var events=[_0x6415('0x1'),_0x6415('0x2'),_0x6415('0x3')];function createListener(_0x9e13c0,_0x5438c5){return function(_0x138d73){_0x5438c5[_0x6415('0x4')](_0x9e13c0,_0x138d73);};}function removeListener(_0xfd06c2,_0x25732f){return function(){OpenchannelAccountEvents[_0x6415('0x5')](_0xfd06c2,_0x25732f);};}exports[_0x6415('0x6')]=function(_0x192a98){for(var _0x496a42=0x0,_0x24cb0=events['length'];_0x496a42<_0x24cb0;_0x496a42++){var _0x4045ec=events[_0x496a42];var _0x266237=createListener('openchannelAccount:'+_0x4045ec,_0x192a98);OpenchannelAccountEvents['on'](_0x4045ec,_0x266237);}}; \ No newline at end of file +var _0xb43b=['./openchannelAccount.events','save','update','emit','removeListener','length','openchannelAccount:'];(function(_0x3f2302,_0x3c3363){var _0x55fed4=function(_0x14d32e){while(--_0x14d32e){_0x3f2302['push'](_0x3f2302['shift']());}};_0x55fed4(++_0x3c3363);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5295e1,_0x45c327){_0x5295e1=_0x5295e1-0x0;var _0x3ef789=_0xb43b[_0x5295e1];return _0x3ef789;};'use strict';var OpenchannelAccountEvents=require(_0xbb43('0x0'));var events=[_0xbb43('0x1'),'remove',_0xbb43('0x2')];function createListener(_0x1995f8,_0x22bc86){return function(_0x4cf605){_0x22bc86[_0xbb43('0x3')](_0x1995f8,_0x4cf605);};}function removeListener(_0x41aff6,_0x351254){return function(){OpenchannelAccountEvents[_0xbb43('0x4')](_0x41aff6,_0x351254);};}exports['register']=function(_0x491fb9){for(var _0x378df5=0x0,_0x553520=events[_0xbb43('0x5')];_0x378df5<_0x553520;_0x378df5++){var _0x1ccd49=events[_0x378df5];var _0x2a2f11=createListener(_0xbb43('0x6')+_0x1ccd49,_0x491fb9);OpenchannelAccountEvents['on'](_0x1ccd49,_0x2a2f11);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 4516d52..7e41b7d 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 _0xb751=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','delete','destroy','multer','util','path','express'];(function(_0xbed58e,_0x3a1272){var _0x295e44=function(_0x45755a){while(--_0x45755a){_0xbed58e['push'](_0xbed58e['shift']());}};_0x295e44(++_0x3a1272);}(_0xb751,0x6e));var _0x1b75=function(_0xec6db1,_0x5a69c1){_0xec6db1=_0xec6db1-0x0;var _0x23c2bb=_0xb751[_0xec6db1];return _0x23c2bb;};'use strict';var multer=require(_0x1b75('0x0'));var util=require(_0x1b75('0x1'));var path=require(_0x1b75('0x2'));var timeout=require('connect-timeout');var express=require(_0x1b75('0x3'));var router=express[_0x1b75('0x4')]();var fs_extra=require(_0x1b75('0x5'));var auth=require(_0x1b75('0x6'));var interaction=require(_0x1b75('0x7'));var config=require(_0x1b75('0x8'));var controller=require('./openchannelApplication.controller');router['get']('/',auth[_0x1b75('0x9')](),controller[_0x1b75('0xa')]);router[_0x1b75('0xb')](_0x1b75('0xc'),auth['isAuthenticated'](),controller[_0x1b75('0xd')]);router[_0x1b75('0xe')]('/',auth[_0x1b75('0x9')](),controller[_0x1b75('0xf')]);router[_0x1b75('0x10')](_0x1b75('0xc'),auth[_0x1b75('0x9')](),controller['update']);router[_0x1b75('0x11')]('/:id',auth[_0x1b75('0x9')](),controller[_0x1b75('0x12')]);module['exports']=router; \ No newline at end of file +var _0x13ca=['show','post','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','isAuthenticated'];(function(_0x77d286,_0x1ddc6d){var _0x5446a5=function(_0x45e2cf){while(--_0x45e2cf){_0x77d286['push'](_0x77d286['shift']());}};_0x5446a5(++_0x1ddc6d);}(_0x13ca,0x1d0));var _0xa13c=function(_0x2c345e,_0x468c57){_0x2c345e=_0x2c345e-0x0;var _0x5460b6=_0x13ca[_0x2c345e];return _0x5460b6;};'use strict';var multer=require('multer');var util=require(_0xa13c('0x0'));var path=require(_0xa13c('0x1'));var timeout=require(_0xa13c('0x2'));var express=require(_0xa13c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa13c('0x4'));var interaction=require(_0xa13c('0x5'));var config=require(_0xa13c('0x6'));var controller=require(_0xa13c('0x7'));router[_0xa13c('0x8')]('/',auth['isAuthenticated'](),controller[_0xa13c('0x9')]);router['get']('/:id',auth[_0xa13c('0xa')](),controller[_0xa13c('0xb')]);router[_0xa13c('0xc')]('/',auth[_0xa13c('0xa')](),controller['create']);router[_0xa13c('0xd')](_0xa13c('0xe'),auth[_0xa13c('0xa')](),controller[_0xa13c('0xf')]);router[_0xa13c('0x10')](_0xa13c('0xe'),auth[_0xa13c('0xa')](),controller[_0xa13c('0x11')]);module[_0xa13c('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 92f8415..28e9d22 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 _0x0966=['TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x579dee,_0x5f430c){var _0x537a66=function(_0x3df519){while(--_0x3df519){_0x579dee['push'](_0x579dee['shift']());}};_0x537a66(++_0x5f430c);}(_0x0966,0x9d));var _0x6096=function(_0x564bca,_0x5c83f9){_0x564bca=_0x564bca-0x0;var _0xe47f38=_0x0966[_0x564bca];return _0xe47f38;};'use strict';var Sequelize=require(_0x6096('0x0'));module[_0x6096('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x6096('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x6096('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x6096('0x2')],'defaultValue':_0x6096('0x4')}}; \ No newline at end of file +var _0xf117=['noop','TEXT','STRING','sequelize','exports','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf117,0x99));var _0x7f11=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xf117[_0x599f41];return _0x2e4d58;};'use strict';var Sequelize=require(_0x7f11('0x0'));module[_0x7f11('0x1')]={'priority':{'type':Sequelize[_0x7f11('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7f11('0x3')},'appdata':{'type':Sequelize[_0x7f11('0x4')]()},'description':{'type':Sequelize[_0x7f11('0x5')]},'interval':{'type':Sequelize[_0x7f11('0x5')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 0a26ba2..8d36fb3 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 _0x4bdc=['set','apply','reject','save','then','destroy','error','stack','name','index','OpenchannelApplication','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','update','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x5bd04d,_0x41b250){var _0x4e3968=function(_0x125b71){while(--_0x125b71){_0x5bd04d['push'](_0x5bd04d['shift']());}};_0x4e3968(++_0x41b250);}(_0x4bdc,0x1ee));var _0xc4bd=function(_0x513c79,_0x446006){_0x513c79=_0x513c79-0x0;var _0x221f87=_0x4bdc[_0x513c79];return _0x221f87;};'use strict';var emlformat=require(_0xc4bd('0x0'));var rimraf=require(_0xc4bd('0x1'));var zipdir=require(_0xc4bd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc4bd('0x3'));var BPromise=require(_0xc4bd('0x4'));var Mustache=require(_0xc4bd('0x5'));var util=require(_0xc4bd('0x6'));var path=require(_0xc4bd('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc4bd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc4bd('0x9'));var squel=require(_0xc4bd('0xa'));var crypto=require(_0xc4bd('0xb'));var jsforce=require(_0xc4bd('0xc'));var deskjs=require(_0xc4bd('0xd'));var toCsv=require(_0xc4bd('0xe'));var querystring=require('querystring');var Papa=require(_0xc4bd('0xf'));var Redis=require('ioredis');var authService=require(_0xc4bd('0x10'));var qs=require(_0xc4bd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc4bd('0x12'));var logger=require(_0xc4bd('0x13'))(_0xc4bd('0x14'));var utils=require('../../config/utils');var config=require(_0xc4bd('0x15'));var licenseUtil=require(_0xc4bd('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46eb24,_0x411cbc){_0x411cbc=_0x411cbc||0xcc;return function(_0x46e1f9){if(_0x46e1f9){return _0x46eb24[_0xc4bd('0x17')](_0x411cbc);}return _0x46eb24[_0xc4bd('0x18')](_0x411cbc)[_0xc4bd('0x19')]();};}function respondWithResult(_0x333924,_0x5f09f6){_0x5f09f6=_0x5f09f6||0xc8;return function(_0x507255){if(_0x507255){return _0x333924[_0xc4bd('0x18')](_0x5f09f6)[_0xc4bd('0x1a')](_0x507255);}};}function respondWithFilteredResult(_0x3de765,_0x3d8ad1){return function(_0x369765){if(_0x369765){var _0x55ecfd=typeof _0x3d8ad1[_0xc4bd('0x1b')]===_0xc4bd('0x1c')&&typeof _0x3d8ad1[_0xc4bd('0x1d')]===_0xc4bd('0x1c');var _0x3cefff=_0x369765[_0xc4bd('0x1e')];var _0xf1b66a=_0x55ecfd?0x0:_0x3d8ad1[_0xc4bd('0x1b')];var _0x56083f=_0x55ecfd?_0x369765[_0xc4bd('0x1e')]:_0x3d8ad1[_0xc4bd('0x1b')]+_0x3d8ad1[_0xc4bd('0x1d')];var _0x4f3d70;if(_0x56083f>=_0x3cefff){_0x56083f=_0x3cefff;_0x4f3d70=0xc8;}else{_0x4f3d70=0xce;}_0x3de765['status'](_0x4f3d70);return _0x3de765[_0xc4bd('0x1f')]('Content-Range',_0xf1b66a+'-'+_0x56083f+'/'+_0x3cefff)['json'](_0x369765);}return null;};}function patchUpdates(_0x38a7a2){return function(_0x11b51e){try{jsonpatch[_0xc4bd('0x20')](_0x11b51e,_0x38a7a2,!![]);}catch(_0x2cef69){return BPromise[_0xc4bd('0x21')](_0x2cef69);}return _0x11b51e[_0xc4bd('0x22')]();};}function saveUpdates(_0x9763de,_0x3c6ec6){return function(_0x4d8e95){if(_0x4d8e95){return _0x4d8e95['update'](_0x9763de)[_0xc4bd('0x23')](function(_0x6d9bfa){return _0x6d9bfa;});}return null;};}function removeEntity(_0x39329c,_0x89ce42){return function(_0x38fd8d){if(_0x38fd8d){return _0x38fd8d[_0xc4bd('0x24')]()['then'](function(){_0x39329c[_0xc4bd('0x18')](0xcc)[_0xc4bd('0x19')]();});}};}function handleEntityNotFound(_0x43d81d,_0x5e117e){return function(_0x5654d7){if(!_0x5654d7){_0x43d81d[_0xc4bd('0x17')](0x194);}return _0x5654d7;};}function handleError(_0x4277e4,_0x584a6f){_0x584a6f=_0x584a6f||0x1f4;return function(_0x2e8363){logger[_0xc4bd('0x25')](_0x2e8363[_0xc4bd('0x26')]);if(_0x2e8363[_0xc4bd('0x27')]){delete _0x2e8363[_0xc4bd('0x27')];}_0x4277e4['status'](_0x584a6f)['send'](_0x2e8363);};}exports[_0xc4bd('0x28')]=function(_0x4895c3,_0x35b524){var _0x4cbaf8={},_0x5f0b31={},_0x5557f9={'count':0x0,'rows':[]};var _0x917a33=_['map'](db[_0xc4bd('0x29')][_0xc4bd('0x2a')],function(_0x493061){return{'name':_0x493061[_0xc4bd('0x2b')],'type':_0x493061[_0xc4bd('0x2c')][_0xc4bd('0x2d')]};});_0x5f0b31[_0xc4bd('0x2e')]=_[_0xc4bd('0x2f')](_0x917a33,'name');_0x5f0b31[_0xc4bd('0x30')]=_['keys'](_0x4895c3['query']);_0x5f0b31[_0xc4bd('0x31')]=_[_0xc4bd('0x32')](_0x5f0b31[_0xc4bd('0x2e')],_0x5f0b31['query']);_0x4cbaf8[_0xc4bd('0x33')]=_['intersection'](_0x5f0b31[_0xc4bd('0x2e')],qs['fields'](_0x4895c3[_0xc4bd('0x30')][_0xc4bd('0x34')]));_0x4cbaf8[_0xc4bd('0x33')]=_0x4cbaf8['attributes'][_0xc4bd('0x35')]?_0x4cbaf8[_0xc4bd('0x33')]:_0x5f0b31['model'];if(!_0x4895c3[_0xc4bd('0x30')][_0xc4bd('0x36')](_0xc4bd('0x37'))){_0x4cbaf8[_0xc4bd('0x1d')]=qs[_0xc4bd('0x1d')](_0x4895c3['query'][_0xc4bd('0x1d')]);_0x4cbaf8[_0xc4bd('0x1b')]=qs[_0xc4bd('0x1b')](_0x4895c3[_0xc4bd('0x30')][_0xc4bd('0x1b')]);}_0x4cbaf8[_0xc4bd('0x38')]=qs[_0xc4bd('0x39')](_0x4895c3[_0xc4bd('0x30')][_0xc4bd('0x39')]);_0x4cbaf8[_0xc4bd('0x3a')]=qs[_0xc4bd('0x31')](_[_0xc4bd('0x3b')](_0x4895c3[_0xc4bd('0x30')],_0x5f0b31[_0xc4bd('0x31')]),_0x917a33);if(_0x4895c3[_0xc4bd('0x30')]['filter']){_0x4cbaf8[_0xc4bd('0x3a')]=_[_0xc4bd('0x3c')](_0x4cbaf8[_0xc4bd('0x3a')],{'$or':_[_0xc4bd('0x2f')](_0x917a33,function(_0x238334){if(_0x238334[_0xc4bd('0x2c')]!==_0xc4bd('0x3d')){var _0xbde5de={};_0xbde5de[_0x238334[_0xc4bd('0x27')]]={'$like':'%'+_0x4895c3[_0xc4bd('0x30')][_0xc4bd('0x3e')]+'%'};return _0xbde5de;}})});}_0x4cbaf8=_[_0xc4bd('0x3c')]({},_0x4cbaf8,_0x4895c3[_0xc4bd('0x3f')]);var _0x35a99f={'where':_0x4cbaf8[_0xc4bd('0x3a')]};return db[_0xc4bd('0x29')][_0xc4bd('0x1e')](_0x35a99f)[_0xc4bd('0x23')](function(_0x13cb48){_0x5557f9['count']=_0x13cb48;if(_0x4895c3[_0xc4bd('0x30')][_0xc4bd('0x40')]){_0x4cbaf8[_0xc4bd('0x41')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0xc4bd('0x42')](_0x4cbaf8);})['then'](function(_0x3f3d58){_0x5557f9['rows']=_0x3f3d58;return _0x5557f9;})[_0xc4bd('0x23')](respondWithFilteredResult(_0x35b524,_0x4cbaf8))[_0xc4bd('0x43')](handleError(_0x35b524,null));};exports[_0xc4bd('0x44')]=function(_0x24e099,_0x2500ff){var _0x52b8de={'raw':!![],'where':{'id':_0x24e099[_0xc4bd('0x45')]['id']}},_0x4c529a={};_0x4c529a[_0xc4bd('0x2e')]=_[_0xc4bd('0x46')](db[_0xc4bd('0x29')][_0xc4bd('0x2a')]);_0x4c529a[_0xc4bd('0x30')]=_['keys'](_0x24e099[_0xc4bd('0x30')]);_0x4c529a[_0xc4bd('0x31')]=_[_0xc4bd('0x32')](_0x4c529a[_0xc4bd('0x2e')],_0x4c529a[_0xc4bd('0x30')]);_0x52b8de[_0xc4bd('0x33')]=_['intersection'](_0x4c529a[_0xc4bd('0x2e')],qs[_0xc4bd('0x34')](_0x24e099[_0xc4bd('0x30')][_0xc4bd('0x34')]));_0x52b8de['attributes']=_0x52b8de[_0xc4bd('0x33')][_0xc4bd('0x35')]?_0x52b8de['attributes']:_0x4c529a[_0xc4bd('0x2e')];if(_0x24e099[_0xc4bd('0x30')][_0xc4bd('0x40')]){_0x52b8de[_0xc4bd('0x41')]=[{'all':!![]}];}_0x52b8de=_[_0xc4bd('0x3c')]({},_0x52b8de,_0x24e099[_0xc4bd('0x3f')]);return db[_0xc4bd('0x29')][_0xc4bd('0x47')](_0x52b8de)[_0xc4bd('0x23')](handleEntityNotFound(_0x2500ff,null))[_0xc4bd('0x23')](respondWithResult(_0x2500ff,null))[_0xc4bd('0x43')](handleError(_0x2500ff,null));};exports[_0xc4bd('0x48')]=function(_0x38867b,_0x143bee){return db[_0xc4bd('0x29')][_0xc4bd('0x48')](_0x38867b[_0xc4bd('0x49')],{})['then'](respondWithResult(_0x143bee,0xc9))[_0xc4bd('0x43')](handleError(_0x143bee,null));};exports[_0xc4bd('0x4a')]=function(_0xbf0fd4,_0x50b814){if(_0xbf0fd4[_0xc4bd('0x49')]['id']){delete _0xbf0fd4['body']['id'];}return db[_0xc4bd('0x29')][_0xc4bd('0x47')]({'where':{'id':_0xbf0fd4['params']['id']}})[_0xc4bd('0x23')](handleEntityNotFound(_0x50b814,null))[_0xc4bd('0x23')](saveUpdates(_0xbf0fd4[_0xc4bd('0x49')],null))['then'](respondWithResult(_0x50b814,null))['catch'](handleError(_0x50b814,null));};exports[_0xc4bd('0x24')]=function(_0x205449,_0x25fa9b){return db[_0xc4bd('0x29')]['find']({'where':{'id':_0x205449[_0xc4bd('0x45')]['id']}})[_0xc4bd('0x23')](handleEntityNotFound(_0x25fa9b,null))[_0xc4bd('0x23')](removeEntity(_0x25fa9b,null))[_0xc4bd('0x43')](handleError(_0x25fa9b,null));}; \ No newline at end of file +var _0x07a1=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','sort','filter','where','merge','VIRTUAL','options','includeAll','rows','catch','show','params','intersection','length','include','find','create','body','update','rimraf','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x550aed,_0x1ba6cb){var _0x1c43a5=function(_0x39e5f7){while(--_0x39e5f7){_0x550aed['push'](_0x550aed['shift']());}};_0x1c43a5(++_0x1ba6cb);}(_0x07a1,0xc5));var _0x107a=function(_0x4e3e7a,_0xbf1432){_0x4e3e7a=_0x4e3e7a-0x0;var _0x1c5abc=_0x07a1[_0x4e3e7a];return _0x1c5abc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x107a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x107a('0x1'));var Mustache=require(_0x107a('0x2'));var util=require('util');var path=require(_0x107a('0x3'));var sox=require(_0x107a('0x4'));var csv=require(_0x107a('0x5'));var ejs=require(_0x107a('0x6'));var fs=require('fs');var fs_extra=require(_0x107a('0x7'));var _=require(_0x107a('0x8'));var squel=require(_0x107a('0x9'));var crypto=require(_0x107a('0xa'));var jsforce=require(_0x107a('0xb'));var deskjs=require(_0x107a('0xc'));var toCsv=require(_0x107a('0x5'));var querystring=require(_0x107a('0xd'));var Papa=require(_0x107a('0xe'));var Redis=require(_0x107a('0xf'));var authService=require(_0x107a('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x107a('0x11'));var logger=require(_0x107a('0x12'))(_0x107a('0x13'));var utils=require(_0x107a('0x14'));var config=require(_0x107a('0x15'));var licenseUtil=require(_0x107a('0x16'));var db=require(_0x107a('0x17'))['db'];function respondWithStatusCode(_0x322399,_0x98fdea){_0x98fdea=_0x98fdea||0xcc;return function(_0xb3035){if(_0xb3035){return _0x322399[_0x107a('0x18')](_0x98fdea);}return _0x322399[_0x107a('0x19')](_0x98fdea)[_0x107a('0x1a')]();};}function respondWithResult(_0x2da463,_0x263ee0){_0x263ee0=_0x263ee0||0xc8;return function(_0x4f559b){if(_0x4f559b){return _0x2da463['status'](_0x263ee0)[_0x107a('0x1b')](_0x4f559b);}};}function respondWithFilteredResult(_0x587ad6,_0x4c590a){return function(_0x27636c){if(_0x27636c){var _0x394b31=typeof _0x4c590a['offset']===_0x107a('0x1c')&&typeof _0x4c590a[_0x107a('0x1d')]===_0x107a('0x1c');var _0x2911f8=_0x27636c[_0x107a('0x1e')];var _0x27f734=_0x394b31?0x0:_0x4c590a['offset'];var _0x1a32b9=_0x394b31?_0x27636c[_0x107a('0x1e')]:_0x4c590a[_0x107a('0x1f')]+_0x4c590a[_0x107a('0x1d')];var _0x1dca8a;if(_0x1a32b9>=_0x2911f8){_0x1a32b9=_0x2911f8;_0x1dca8a=0xc8;}else{_0x1dca8a=0xce;}_0x587ad6[_0x107a('0x19')](_0x1dca8a);return _0x587ad6[_0x107a('0x20')](_0x107a('0x21'),_0x27f734+'-'+_0x1a32b9+'/'+_0x2911f8)[_0x107a('0x1b')](_0x27636c);}return null;};}function patchUpdates(_0x1c822a){return function(_0x17105e){try{jsonpatch[_0x107a('0x22')](_0x17105e,_0x1c822a,!![]);}catch(_0x1ba150){return BPromise[_0x107a('0x23')](_0x1ba150);}return _0x17105e[_0x107a('0x24')]();};}function saveUpdates(_0x3f7c1a,_0x272644){return function(_0x5038a8){if(_0x5038a8){return _0x5038a8['update'](_0x3f7c1a)['then'](function(_0x436149){return _0x436149;});}return null;};}function removeEntity(_0x2ba8e6,_0x8463ce){return function(_0x4db520){if(_0x4db520){return _0x4db520[_0x107a('0x25')]()[_0x107a('0x26')](function(){_0x2ba8e6[_0x107a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d55fd,_0x5b6b21){return function(_0x33d551){if(!_0x33d551){_0x5d55fd[_0x107a('0x18')](0x194);}return _0x33d551;};}function handleError(_0x30f62e,_0x5cbd6d){_0x5cbd6d=_0x5cbd6d||0x1f4;return function(_0x13541f){logger['error'](_0x13541f[_0x107a('0x27')]);if(_0x13541f[_0x107a('0x28')]){delete _0x13541f['name'];}_0x30f62e[_0x107a('0x19')](_0x5cbd6d)[_0x107a('0x29')](_0x13541f);};}exports[_0x107a('0x2a')]=function(_0x19b5df,_0x225e44){var _0x40fda2={},_0x136470={},_0x4a5dba={'count':0x0,'rows':[]};var _0x1aadbf=_[_0x107a('0x2b')](db[_0x107a('0x2c')][_0x107a('0x2d')],function(_0x31906c){return{'name':_0x31906c[_0x107a('0x2e')],'type':_0x31906c[_0x107a('0x2f')][_0x107a('0x30')]};});_0x136470[_0x107a('0x31')]=_[_0x107a('0x2b')](_0x1aadbf,_0x107a('0x28'));_0x136470['query']=_[_0x107a('0x32')](_0x19b5df[_0x107a('0x33')]);_0x136470[_0x107a('0x34')]=_['intersection'](_0x136470[_0x107a('0x31')],_0x136470[_0x107a('0x33')]);_0x40fda2[_0x107a('0x35')]=_['intersection'](_0x136470[_0x107a('0x31')],qs['fields'](_0x19b5df[_0x107a('0x33')][_0x107a('0x36')]));_0x40fda2[_0x107a('0x35')]=_0x40fda2['attributes']['length']?_0x40fda2[_0x107a('0x35')]:_0x136470[_0x107a('0x31')];if(!_0x19b5df['query']['hasOwnProperty']('nolimit')){_0x40fda2[_0x107a('0x1d')]=qs['limit'](_0x19b5df[_0x107a('0x33')][_0x107a('0x1d')]);_0x40fda2[_0x107a('0x1f')]=qs[_0x107a('0x1f')](_0x19b5df['query'][_0x107a('0x1f')]);}_0x40fda2['order']=qs['sort'](_0x19b5df[_0x107a('0x33')][_0x107a('0x37')]);_0x40fda2['where']=qs[_0x107a('0x34')](_['pick'](_0x19b5df[_0x107a('0x33')],_0x136470[_0x107a('0x34')]),_0x1aadbf);if(_0x19b5df[_0x107a('0x33')][_0x107a('0x38')]){_0x40fda2[_0x107a('0x39')]=_[_0x107a('0x3a')](_0x40fda2[_0x107a('0x39')],{'$or':_[_0x107a('0x2b')](_0x1aadbf,function(_0x1d4f69){if(_0x1d4f69['type']!==_0x107a('0x3b')){var _0x5297cd={};_0x5297cd[_0x1d4f69[_0x107a('0x28')]]={'$like':'%'+_0x19b5df[_0x107a('0x33')][_0x107a('0x38')]+'%'};return _0x5297cd;}})});}_0x40fda2=_[_0x107a('0x3a')]({},_0x40fda2,_0x19b5df[_0x107a('0x3c')]);var _0x2528b2={'where':_0x40fda2[_0x107a('0x39')]};return db[_0x107a('0x2c')][_0x107a('0x1e')](_0x2528b2)['then'](function(_0x468ae0){_0x4a5dba[_0x107a('0x1e')]=_0x468ae0;if(_0x19b5df['query'][_0x107a('0x3d')]){_0x40fda2['include']=[{'all':!![]}];}return db[_0x107a('0x2c')]['findAll'](_0x40fda2);})[_0x107a('0x26')](function(_0xda3b25){_0x4a5dba[_0x107a('0x3e')]=_0xda3b25;return _0x4a5dba;})[_0x107a('0x26')](respondWithFilteredResult(_0x225e44,_0x40fda2))[_0x107a('0x3f')](handleError(_0x225e44,null));};exports[_0x107a('0x40')]=function(_0x208dfa,_0xd2c06b){var _0x45fa08={'raw':!![],'where':{'id':_0x208dfa[_0x107a('0x41')]['id']}},_0x16c6b4={};_0x16c6b4[_0x107a('0x31')]=_[_0x107a('0x32')](db[_0x107a('0x2c')][_0x107a('0x2d')]);_0x16c6b4[_0x107a('0x33')]=_[_0x107a('0x32')](_0x208dfa[_0x107a('0x33')]);_0x16c6b4[_0x107a('0x34')]=_[_0x107a('0x42')](_0x16c6b4[_0x107a('0x31')],_0x16c6b4[_0x107a('0x33')]);_0x45fa08['attributes']=_['intersection'](_0x16c6b4[_0x107a('0x31')],qs[_0x107a('0x36')](_0x208dfa[_0x107a('0x33')][_0x107a('0x36')]));_0x45fa08[_0x107a('0x35')]=_0x45fa08[_0x107a('0x35')][_0x107a('0x43')]?_0x45fa08[_0x107a('0x35')]:_0x16c6b4[_0x107a('0x31')];if(_0x208dfa[_0x107a('0x33')]['includeAll']){_0x45fa08[_0x107a('0x44')]=[{'all':!![]}];}_0x45fa08=_['merge']({},_0x45fa08,_0x208dfa[_0x107a('0x3c')]);return db[_0x107a('0x2c')][_0x107a('0x45')](_0x45fa08)['then'](handleEntityNotFound(_0xd2c06b,null))[_0x107a('0x26')](respondWithResult(_0xd2c06b,null))[_0x107a('0x3f')](handleError(_0xd2c06b,null));};exports[_0x107a('0x46')]=function(_0x3de3f9,_0x5f95ff){return db[_0x107a('0x2c')]['create'](_0x3de3f9[_0x107a('0x47')],{})['then'](respondWithResult(_0x5f95ff,0xc9))[_0x107a('0x3f')](handleError(_0x5f95ff,null));};exports[_0x107a('0x48')]=function(_0x2aac3b,_0x562aa4){if(_0x2aac3b[_0x107a('0x47')]['id']){delete _0x2aac3b[_0x107a('0x47')]['id'];}return db[_0x107a('0x2c')][_0x107a('0x45')]({'where':{'id':_0x2aac3b[_0x107a('0x41')]['id']}})[_0x107a('0x26')](handleEntityNotFound(_0x562aa4,null))['then'](saveUpdates(_0x2aac3b[_0x107a('0x47')],null))[_0x107a('0x26')](respondWithResult(_0x562aa4,null))['catch'](handleError(_0x562aa4,null));};exports[_0x107a('0x25')]=function(_0x2ec7a1,_0x47c344){return db['OpenchannelApplication'][_0x107a('0x45')]({'where':{'id':_0x2ec7a1[_0x107a('0x41')]['id']}})[_0x107a('0x26')](handleEntityNotFound(_0x47c344,null))[_0x107a('0x26')](removeEntity(_0x47c344,null))['catch'](handleError(_0x47c344,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 7d90854..b0bdc3e 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 _0x64ec=['path','rimraf','../../config/environment','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise'];(function(_0x4e9559,_0x4cc183){var _0x525158=function(_0x326ff3){while(--_0x326ff3){_0x4e9559['push'](_0x4e9559['shift']());}};_0x525158(++_0x4cc183);}(_0x64ec,0xd8));var _0xc64e=function(_0x19e8bd,_0x468986){_0x19e8bd=_0x19e8bd-0x0;var _0x313fb0=_0x64ec[_0x19e8bd];return _0x313fb0;};'use strict';var _=require(_0xc64e('0x0'));var util=require(_0xc64e('0x1'));var logger=require('../../config/logger')(_0xc64e('0x2'));var moment=require('moment');var BPromise=require(_0xc64e('0x3'));var rp=require(_0xc64e('0x4'));var fs=require('fs');var path=require(_0xc64e('0x5'));var rimraf=require(_0xc64e('0x6'));var config=require(_0xc64e('0x7'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x5083dc,_0x4a9bf0){return _0x5083dc[_0xc64e('0x8')](_0xc64e('0x9'),attributes,{'tableName':_0xc64e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc64e('0xb'),'collate':_0xc64e('0xc')});}; \ No newline at end of file +var _0xa46e=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xa46e,0x14f));var _0xea46=function(_0x17a32f,_0x5a51a){_0x17a32f=_0x17a32f-0x0;var _0x15a293=_0xa46e[_0x17a32f];return _0x15a293;};'use strict';var _=require('lodash');var util=require(_0xea46('0x0'));var logger=require(_0xea46('0x1'))(_0xea46('0x2'));var moment=require(_0xea46('0x3'));var BPromise=require(_0xea46('0x4'));var rp=require(_0xea46('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea46('0x6'));var config=require(_0xea46('0x7'));var attributes=require(_0xea46('0x8'));module['exports']=function(_0x270e68,_0x29bb47){return _0x270e68[_0xea46('0x9')](_0xea46('0xa'),attributes,{'tableName':_0xea46('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xea46('0xc'),'collate':_0xea46('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 9d7b187..e7ffffb 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 _0xa42f=['catch','UpdateOpenchannelApplication','update','body','options','raw','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','result'];(function(_0xcf858e,_0x5f4451){var _0x513b28=function(_0xfff850){while(--_0xfff850){_0xcf858e['push'](_0xcf858e['shift']());}};_0x513b28(++_0x5f4451);}(_0xa42f,0x15e));var _0xfa42=function(_0x54ba5b,_0x5b7508){_0x54ba5b=_0x54ba5b-0x0;var _0x5e16ac=_0xa42f[_0x54ba5b];return _0x5e16ac;};'use strict';var _=require('lodash');var util=require(_0xfa42('0x0'));var moment=require(_0xfa42('0x1'));var BPromise=require(_0xfa42('0x2'));var rs=require(_0xfa42('0x3'));var fs=require('fs');var Redis=require(_0xfa42('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfa42('0x5'));var logger=require(_0xfa42('0x6'))(_0xfa42('0x7'));var config=require('../../config/environment');var jayson=require(_0xfa42('0x8'));var client=jayson[_0xfa42('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39cf63,_0x28d684,_0x1bde3c){return new BPromise(function(_0x19303b,_0x5d8d4e){return client[_0xfa42('0xa')](_0x39cf63,_0x1bde3c)[_0xfa42('0xb')](function(_0x35e6c2){logger[_0xfa42('0xc')]('OpenchannelApplication,\x20%s,\x20%s',_0x28d684,_0xfa42('0xd'));logger[_0xfa42('0xe')](_0xfa42('0xf'),_0x28d684,'request\x20sent',JSON[_0xfa42('0x10')](_0x35e6c2));if(_0x35e6c2[_0xfa42('0x11')]){if(_0x35e6c2[_0xfa42('0x11')][_0xfa42('0x12')]===0x1f4){logger[_0xfa42('0x11')](_0xfa42('0x13'),_0x28d684,_0x35e6c2[_0xfa42('0x11')]['message']);return _0x5d8d4e(_0x35e6c2[_0xfa42('0x11')]['message']);}logger[_0xfa42('0x11')](_0xfa42('0x13'),_0x28d684,_0x35e6c2['error']['message']);return _0x19303b(_0x35e6c2[_0xfa42('0x11')][_0xfa42('0x14')]);}else{logger[_0xfa42('0xc')](_0xfa42('0x13'),_0x28d684,_0xfa42('0xd'));_0x19303b(_0x35e6c2[_0xfa42('0x15')][_0xfa42('0x14')]);}})[_0xfa42('0x16')](function(_0x55c6e){logger[_0xfa42('0x11')](_0xfa42('0x13'),_0x28d684,_0x55c6e);_0x5d8d4e(_0x55c6e);});});}exports[_0xfa42('0x17')]=function(_0x48bb96){var _0x4b31d7=this;return new Promise(function(_0x4ace8b,_0x3333f4){return db['OpenchannelApplication'][_0xfa42('0x18')](_0x48bb96[_0xfa42('0x19')],{'raw':_0x48bb96['options']?_0x48bb96[_0xfa42('0x1a')][_0xfa42('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48bb96['options']?_0x48bb96['options'][_0xfa42('0x1c')]||null:null,'attributes':_0x48bb96[_0xfa42('0x1a')]?_0x48bb96[_0xfa42('0x1a')][_0xfa42('0x1d')]||null:null,'limit':_0x48bb96['options']?_0x48bb96[_0xfa42('0x1a')][_0xfa42('0x1e')]||null:null})[_0xfa42('0xb')](function(_0x4bd9b6){logger[_0xfa42('0xc')](_0xfa42('0x17'),_0x48bb96);logger[_0xfa42('0xe')]('UpdateOpenchannelApplication',_0x48bb96,JSON[_0xfa42('0x10')](_0x4bd9b6));_0x4ace8b(_0x4bd9b6);})[_0xfa42('0x16')](function(_0xdd9d6c){logger['error'](_0xfa42('0x17'),_0xdd9d6c[_0xfa42('0x14')],_0x48bb96);_0x3333f4(_0x4b31d7['error'](0x1f4,_0xdd9d6c[_0xfa42('0x14')]));});});}; \ No newline at end of file +var _0x00f6=['../../config/environment','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','OpenchannelApplication','update','options','raw','where','attributes','UpdateOpenchannelApplication','debug','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xaf6b1c,_0x590733){var _0xe0e84f=function(_0x393dce){while(--_0x393dce){_0xaf6b1c['push'](_0xaf6b1c['shift']());}};_0xe0e84f(++_0x590733);}(_0x00f6,0x1de));var _0x600f=function(_0x4ed66e,_0x40f45a){_0x4ed66e=_0x4ed66e-0x0;var _0x4ef7bd=_0x00f6[_0x4ed66e];return _0x4ef7bd;};'use strict';var _=require(_0x600f('0x0'));var util=require(_0x600f('0x1'));var moment=require(_0x600f('0x2'));var BPromise=require('bluebird');var rs=require(_0x600f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x600f('0x4'))['db'];var utils=require(_0x600f('0x5'));var logger=require(_0x600f('0x6'))(_0x600f('0x7'));var config=require(_0x600f('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x727659,_0x53afee,_0x27db6d){return new BPromise(function(_0x5182ed,_0x25b7ad){return client[_0x600f('0x9')](_0x727659,_0x27db6d)['then'](function(_0x443d37){logger[_0x600f('0xa')](_0x600f('0xb'),_0x53afee,_0x600f('0xc'));logger['debug'](_0x600f('0xd'),_0x53afee,'request\x20sent',JSON[_0x600f('0xe')](_0x443d37));if(_0x443d37['error']){if(_0x443d37[_0x600f('0xf')][_0x600f('0x10')]===0x1f4){logger[_0x600f('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x53afee,_0x443d37['error'][_0x600f('0x11')]);return _0x25b7ad(_0x443d37['error'][_0x600f('0x11')]);}logger[_0x600f('0xf')](_0x600f('0xb'),_0x53afee,_0x443d37[_0x600f('0xf')][_0x600f('0x11')]);return _0x5182ed(_0x443d37['error']['message']);}else{logger[_0x600f('0xa')]('OpenchannelApplication,\x20%s,\x20%s',_0x53afee,_0x600f('0xc'));_0x5182ed(_0x443d37['result'][_0x600f('0x11')]);}})[_0x600f('0x12')](function(_0x2917a9){logger[_0x600f('0xf')](_0x600f('0xb'),_0x53afee,_0x2917a9);_0x25b7ad(_0x2917a9);});});}exports['UpdateOpenchannelApplication']=function(_0x24b01f){var _0xbb3125=this;return new Promise(function(_0x19c61d,_0x10d4c5){return db[_0x600f('0x13')][_0x600f('0x14')](_0x24b01f['body'],{'raw':_0x24b01f['options']?_0x24b01f[_0x600f('0x15')][_0x600f('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24b01f[_0x600f('0x15')]?_0x24b01f[_0x600f('0x15')][_0x600f('0x17')]||null:null,'attributes':_0x24b01f[_0x600f('0x15')]?_0x24b01f[_0x600f('0x15')][_0x600f('0x18')]||null:null,'limit':_0x24b01f[_0x600f('0x15')]?_0x24b01f[_0x600f('0x15')]['limit']||null:null})['then'](function(_0x270df6){logger['info'](_0x600f('0x19'),_0x24b01f);logger[_0x600f('0x1a')]('UpdateOpenchannelApplication',_0x24b01f,JSON[_0x600f('0xe')](_0x270df6));_0x19c61d(_0x270df6);})[_0x600f('0x12')](function(_0x394dd4){logger[_0x600f('0xf')](_0x600f('0x19'),_0x394dd4[_0x600f('0x11')],_0x24b01f);_0x10d4c5(_0xbb3125[_0x600f('0xf')](0x1f4,_0x394dd4[_0x600f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index dbd916c..00e3fe1 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 _0x5097=['update','delete','openchannelinteraction:destroy','destroy','/:id/tags','removeTags','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','index','describe','isAuthenticated','show','get','/:id/download','download','post','/:id/messages','addMessage','tracked','openchannel','openchannelinteraction:addtags','/:id','openchannelinteraction:update'];(function(_0x59a563,_0x5a2ec3){var _0x515c91=function(_0x1b122a){while(--_0x1b122a){_0x59a563['push'](_0x59a563['shift']());}};_0x515c91(++_0x5a2ec3);}(_0x5097,0x13a));var _0x7509=function(_0x2c6e86,_0x594664){_0x2c6e86=_0x2c6e86-0x0;var _0x2a8a10=_0x5097[_0x2c6e86];return _0x2a8a10;};'use strict';var multer=require(_0x7509('0x0'));var util=require('util');var path=require(_0x7509('0x1'));var timeout=require(_0x7509('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7509('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7509('0x4'));var config=require(_0x7509('0x5'));var controller=require(_0x7509('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7509('0x7')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7509('0x8')]);router['get']('/:id',auth[_0x7509('0x9')](),controller[_0x7509('0xa')]);router['get']('/:id/messages',auth[_0x7509('0x9')](),controller['getMessages']);router[_0x7509('0xb')](_0x7509('0xc'),auth[_0x7509('0x9')](),controller[_0x7509('0xd')]);router[_0x7509('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7509('0xe')](_0x7509('0xf'),auth['isAuthenticated'](),controller[_0x7509('0x10')]);router['post']('/:id/tags',auth[_0x7509('0x9')](),interaction[_0x7509('0x11')](_0x7509('0x12'),_0x7509('0x13')),controller['addTags']);router['put'](_0x7509('0x14'),auth[_0x7509('0x9')](),interaction[_0x7509('0x11')](_0x7509('0x12'),_0x7509('0x15')),controller[_0x7509('0x16')]);router[_0x7509('0x17')]('/:id',auth[_0x7509('0x9')](),interaction[_0x7509('0x11')](_0x7509('0x12'),_0x7509('0x18')),controller[_0x7509('0x19')]);router['delete'](_0x7509('0x1a'),auth['isAuthenticated'](),controller[_0x7509('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xf760=['describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','/:id/tags','tracked','openchannelinteraction:addtags','addTags','openchannel','openchannelinteraction:update','update','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe'];(function(_0x5276ce,_0x2bdcaa){var _0x470958=function(_0x296400){while(--_0x296400){_0x5276ce['push'](_0x5276ce['shift']());}};_0x470958(++_0x2bdcaa);}(_0xf760,0xb9));var _0x0f76=function(_0x41c96a,_0x53e6ab){_0x41c96a=_0x41c96a-0x0;var _0x3fece5=_0xf760[_0x41c96a];return _0x3fece5;};'use strict';var multer=require(_0x0f76('0x0'));var util=require(_0x0f76('0x1'));var path=require(_0x0f76('0x2'));var timeout=require(_0x0f76('0x3'));var express=require(_0x0f76('0x4'));var router=express[_0x0f76('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0f76('0x6'));var interaction=require(_0x0f76('0x7'));var config=require(_0x0f76('0x8'));var controller=require(_0x0f76('0x9'));router[_0x0f76('0xa')]('/',auth[_0x0f76('0xb')](),controller['index']);router['get'](_0x0f76('0xc'),auth[_0x0f76('0xb')](),controller[_0x0f76('0xd')]);router[_0x0f76('0xa')](_0x0f76('0xe'),auth[_0x0f76('0xb')](),controller[_0x0f76('0xf')]);router['get']('/:id/messages',auth[_0x0f76('0xb')](),controller[_0x0f76('0x10')]);router[_0x0f76('0xa')](_0x0f76('0x11'),auth['isAuthenticated'](),controller[_0x0f76('0x12')]);router[_0x0f76('0x13')]('/',auth['isAuthenticated'](),controller[_0x0f76('0x14')]);router[_0x0f76('0x13')](_0x0f76('0x15'),auth[_0x0f76('0xb')](),controller['addMessage']);router[_0x0f76('0x13')](_0x0f76('0x16'),auth[_0x0f76('0xb')](),interaction[_0x0f76('0x17')]('openchannel',_0x0f76('0x18')),controller[_0x0f76('0x19')]);router['put'](_0x0f76('0xe'),auth[_0x0f76('0xb')](),interaction[_0x0f76('0x17')](_0x0f76('0x1a'),_0x0f76('0x1b')),controller[_0x0f76('0x1c')]);router[_0x0f76('0x1d')]('/:id',auth[_0x0f76('0xb')](),interaction['tracked'](_0x0f76('0x1a'),'openchannelinteraction:destroy'),controller[_0x0f76('0x1e')]);router['delete'](_0x0f76('0x16'),auth['isAuthenticated'](),controller[_0x0f76('0x1f')]);module[_0x0f76('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 4584af3..ab282a7 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 _0xdffe=['STRING','ENUM','out','BOOLEAN','exports','DATE'];(function(_0x5141f1,_0x34ea5c){var _0xdddfb=function(_0x5df4c9){while(--_0x5df4c9){_0x5141f1['push'](_0x5141f1['shift']());}};_0xdddfb(++_0x34ea5c);}(_0xdffe,0x1d2));var _0xedff=function(_0x326f81,_0x57c9d8){_0x326f81=_0x326f81-0x0;var _0x8a3c6e=_0xdffe[_0x326f81];return _0x8a3c6e;};'use strict';var Sequelize=require('sequelize');module[_0xedff('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xedff('0x1')]},'disposition':{'type':Sequelize[_0xedff('0x2')]},'secondDisposition':{'type':Sequelize[_0xedff('0x2')]},'thirdDisposition':{'type':Sequelize[_0xedff('0x2')]},'note':{'type':Sequelize[_0xedff('0x2')]},'read1stAt':{'type':Sequelize[_0xedff('0x1')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xedff('0x2')]},'lastMsgAt':{'type':Sequelize[_0xedff('0x1')]},'lastMsgDirection':{'type':Sequelize[_0xedff('0x3')]('in',_0xedff('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xedff('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0xdd0c=['STRING','out','exports','BOOLEAN','DATE'];(function(_0x160165,_0x5db56f){var _0x53e891=function(_0x53d4e3){while(--_0x53d4e3){_0x160165['push'](_0x160165['shift']());}};_0x53e891(++_0x5db56f);}(_0xdd0c,0x165));var _0xcdd0=function(_0x50dbf7,_0x23095a){_0x50dbf7=_0x50dbf7-0x0;var _0x3760c6=_0xdd0c[_0x50dbf7];return _0x3760c6;};'use strict';var Sequelize=require('sequelize');module[_0xcdd0('0x0')]={'closed':{'type':Sequelize[_0xcdd0('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcdd0('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xcdd0('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xcdd0('0x3')]},'read1stAt':{'type':Sequelize[_0xcdd0('0x2')]},'threadId':{'type':Sequelize[_0xcdd0('0x3')]},'externalUrl':{'type':Sequelize[_0xcdd0('0x3')]},'lastMsgAt':{'type':Sequelize[_0xcdd0('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xcdd0('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xcdd0('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xcdd0('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 01ac20f..aaa2f21 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 _0x8db8=['tools_tags','u.id','ui.OpenchannelInteractionId','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','UserId','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','SELECT','clone','DESC','t.id\x20IN\x20?','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','OpenchannelInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','Contact.firstName','c.lastName','Contact.lastName','c.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','OpenchannelInteractionId','all','rows','catch','show','params','includeAll','include','merge','options','create','body','describe','addMessage','ids','omit','OpenchannelMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','emit','openchannelInteractionTags:save','removeTags','download','unix','join','files','tmp','root','server','attachments','User','fullname','CmContact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closedAt','disposition','threadId','Public','Private','existsSync','createReadStream','pipe','basename','out','System','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','Users','Tags','TagIds','split','push','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from'];(function(_0x336264,_0x32e1d9){var _0x53cf91=function(_0x21026c){while(--_0x21026c){_0x336264['push'](_0x336264['shift']());}};_0x53cf91(++_0x32e1d9);}(_0x8db8,0x189));var _0x88db=function(_0x5baf63,_0x35b6c4){_0x5baf63=_0x5baf63-0x0;var _0x288650=_0x8db8[_0x5baf63];return _0x288650;};'use strict';var emlformat=require(_0x88db('0x0'));var rimraf=require(_0x88db('0x1'));var zipdir=require(_0x88db('0x2'));var jsonpatch=require(_0x88db('0x3'));var rp=require(_0x88db('0x4'));var moment=require(_0x88db('0x5'));var BPromise=require(_0x88db('0x6'));var Mustache=require('mustache');var util=require(_0x88db('0x7'));var path=require('path');var sox=require(_0x88db('0x8'));var csv=require(_0x88db('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x88db('0xa'));var _=require(_0x88db('0xb'));var squel=require(_0x88db('0xc'));var crypto=require(_0x88db('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x88db('0xe'));var toCsv=require(_0x88db('0x9'));var querystring=require('querystring');var Papa=require(_0x88db('0xf'));var Redis=require(_0x88db('0x10'));var authService=require(_0x88db('0x11'));var qs=require(_0x88db('0x12'));var as=require(_0x88db('0x13'));var pdf=require(_0x88db('0x14'));var hardwareService=require(_0x88db('0x15'));var logger=require(_0x88db('0x16'))(_0x88db('0x17'));var utils=require('../../config/utils');var config=require(_0x88db('0x18'));var licenseUtil=require(_0x88db('0x19'));var db=require('../../mysqldb')['db'];config[_0x88db('0x1a')]=_[_0x88db('0x1b')](config[_0x88db('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x88db('0x1a')]));require('./openchannelInteraction.socket')[_0x88db('0x1c')](socket);function respondWithStatusCode(_0x198920,_0x40c3c4){_0x40c3c4=_0x40c3c4||0xcc;return function(_0x28ae0a){if(_0x28ae0a){return _0x198920[_0x88db('0x1d')](_0x40c3c4);}return _0x198920[_0x88db('0x1e')](_0x40c3c4)[_0x88db('0x1f')]();};}function respondWithResult(_0x3cc3f1,_0x539572){_0x539572=_0x539572||0xc8;return function(_0x1da298){if(_0x1da298){return _0x3cc3f1[_0x88db('0x1e')](_0x539572)[_0x88db('0x20')](_0x1da298);}};}function respondWithFilteredResult(_0x27df9b,_0x5665af){return function(_0x418044){if(_0x418044){var _0x15e0d0=typeof _0x5665af[_0x88db('0x21')]===_0x88db('0x22')&&typeof _0x5665af[_0x88db('0x23')]===_0x88db('0x22');var _0x590150=_0x418044[_0x88db('0x24')];var _0x5c3ddd=_0x15e0d0?0x0:_0x5665af[_0x88db('0x21')];var _0x300dd4=_0x15e0d0?_0x418044['count']:_0x5665af[_0x88db('0x21')]+_0x5665af[_0x88db('0x23')];var _0x55c930;if(_0x300dd4>=_0x590150){_0x300dd4=_0x590150;_0x55c930=0xc8;}else{_0x55c930=0xce;}_0x27df9b[_0x88db('0x1e')](_0x55c930);return _0x27df9b[_0x88db('0x25')](_0x88db('0x26'),_0x5c3ddd+'-'+_0x300dd4+'/'+_0x590150)[_0x88db('0x20')](_0x418044);}return null;};}function patchUpdates(_0x1451e3){return function(_0x15794e){try{jsonpatch[_0x88db('0x27')](_0x15794e,_0x1451e3,!![]);}catch(_0x5cf2b0){return BPromise[_0x88db('0x28')](_0x5cf2b0);}return _0x15794e['save']();};}function saveUpdates(_0x75dcb3,_0x3c8d5a){return function(_0x3f875c){if(_0x3f875c){return _0x3f875c[_0x88db('0x29')](_0x75dcb3)[_0x88db('0x2a')](function(_0x3bf670){return _0x3bf670;});}return null;};}function removeEntity(_0x14994c,_0x5d4ee9){return function(_0x3ff44b){if(_0x3ff44b){return _0x3ff44b[_0x88db('0x2b')]()['then'](function(){_0x14994c[_0x88db('0x1e')](0xcc)[_0x88db('0x1f')]();});}};}function handleEntityNotFound(_0x2a175c,_0x422f04){return function(_0x5f2eaa){if(!_0x5f2eaa){_0x2a175c[_0x88db('0x1d')](0x194);}return _0x5f2eaa;};}function handleError(_0x45459f,_0x63c55c){_0x63c55c=_0x63c55c||0x1f4;return function(_0x27f00a){logger['error'](_0x27f00a[_0x88db('0x2c')]);if(_0x27f00a[_0x88db('0x2d')]){delete _0x27f00a[_0x88db('0x2d')];}_0x45459f[_0x88db('0x1e')](_0x63c55c)['send'](_0x27f00a);};}function getInteractionUsers(_0x2e7e59,_0x4241fb){return new BPromise(function(_0x4c181c,_0x3c0a34){try{if(_0x4241fb[_0x2e7e59['id']]){_0x2e7e59[_0x88db('0x2e')]=_['map'](_0x4241fb[_0x2e7e59['id']],function(_0x4ac682){return{'id':_0x4ac682['id'],'fullname':_0x4ac682['fullname']};});}}catch(_0x2d52dc){_0x3c0a34(_0x2d52dc);}_0x4c181c(_0x2e7e59);});}function getInteractionTags(_0x5e09bd,_0x350fe1){return new BPromise(function(_0x1ef3f0,_0x2f1869){try{if(_0x5e09bd['TagIds']){_0x5e09bd[_0x88db('0x2f')]=[];_0x5e09bd[_0x88db('0x30')][_0x88db('0x31')](',')['forEach'](function(_0x1da32f){_0x5e09bd[_0x88db('0x2f')][_0x88db('0x32')](_0x350fe1[_0x1da32f]);});}delete _0x5e09bd['TagIds'];}catch(_0x1056cf){_0x2f1869(_0x1056cf);}_0x1ef3f0(_0x5e09bd);});}function updateOpenchannelInteraction(_0x25bf5b,_0x58d82f,_0x3c7742){return new BPromise(function(_0x221f21,_0x16cced){return getInteractionUsers(_0x25bf5b,_0x3c7742)[_0x88db('0x2a')](function(_0x3fbc95){return getInteractionTags(_0x3fbc95,_0x58d82f);})[_0x88db('0x2a')](function(_0x3ba00e){_0x221f21(_0x3ba00e);})['catch'](function(_0x4bfddc){_0x16cced(_0x4bfddc);});});}exports[_0x88db('0x33')]=function(_0xc0f208,_0x717534){var _0x34a6b4={},_0x2e9df4={},_0x5f0f8f={'count':0x0,'rows':[]};var _0xb59419=_[_0x88db('0x34')](db['OpenchannelInteraction'][_0x88db('0x35')],function(_0x32be65){return{'name':_0x32be65[_0x88db('0x36')],'type':_0x32be65[_0x88db('0x37')][_0x88db('0x38')]};});_0x2e9df4[_0x88db('0x39')]=_[_0x88db('0x34')](_0xb59419,_0x88db('0x2d'));_0x2e9df4[_0x88db('0x3a')]=_[_0x88db('0x3b')](_0xc0f208[_0x88db('0x3a')]);_0x2e9df4[_0x88db('0x3c')]=_[_0x88db('0x3d')](_0x2e9df4[_0x88db('0x39')],_0x2e9df4[_0x88db('0x3a')]);_0x34a6b4[_0x88db('0x3e')]=_['intersection'](_0x2e9df4[_0x88db('0x39')],qs[_0x88db('0x3f')](_0xc0f208['query']['fields']));_0x34a6b4[_0x88db('0x3e')]=_0x34a6b4['attributes'][_0x88db('0x40')]?_0x34a6b4[_0x88db('0x3e')]:_0x2e9df4[_0x88db('0x39')];if(!_0xc0f208[_0x88db('0x3a')][_0x88db('0x41')](_0x88db('0x42'))){_0x34a6b4[_0x88db('0x23')]=qs['limit'](_0xc0f208[_0x88db('0x3a')][_0x88db('0x23')]);_0x34a6b4[_0x88db('0x21')]=qs['offset'](_0xc0f208[_0x88db('0x3a')][_0x88db('0x21')]);}_0x34a6b4[_0x88db('0x43')]=qs['sort'](_0xc0f208['query'][_0x88db('0x44')]);_0x34a6b4[_0x88db('0x45')]=qs[_0x88db('0x3c')](_[_0x88db('0x46')](_0xc0f208['query'],_0x2e9df4[_0x88db('0x3c')]),_0xb59419);var _0x4d3c61=[];var _0xd4b78d=squel[_0x88db('0x47')]()[_0x88db('0x48')]('id')['field']('name')[_0x88db('0x48')](_0x88db('0x49'))[_0x88db('0x4a')](_0x88db('0x4b'));var _0x9ae9ba=squel['select']()['field'](_0x88db('0x4c'))[_0x88db('0x48')]('u.fullname')[_0x88db('0x48')](_0x88db('0x4d'))['from']('user_has_openchannel_interactions','ui')[_0x88db('0x4e')](_0x88db('0x4f'),'u',_0x88db('0x50'));var _0x2b20e3=squel[_0x88db('0x47')]()['from']('openchannel_interactions','i')[_0x88db('0x4e')](_0x88db('0x51'),'c',_0x88db('0x52'))[_0x88db('0x4e')](_0x88db('0x4f'),'o',_0x88db('0x53'))[_0x88db('0x4e')](_0x88db('0x54'),'a',_0x88db('0x55'))[_0x88db('0x4e')](_0x88db('0x56'),'me','me.OpenchannelInteractionId\x20=\x20i.id')['left_join'](_0x88db('0x57'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x88db('0x4e')](_0x88db('0x4b'),'t',_0x88db('0x58'));var _0x1c9ab7=squel['expr']();var _0x485a75=[];var _0x1a9b4a=squel[_0x88db('0x59')]();var _0x542edd;if(_0xc0f208[_0x88db('0x3a')][_0x88db('0x5a')]){_0x542edd=as[_0x88db('0x5b')](_0xc0f208[_0x88db('0x3a')][_0x88db('0x5a')]);var _0x5e8e37=_0x542edd[_0x88db('0x5c')];for(var _0x4c70bb=0x0;_0x4c70bb<_0x542edd[_0x88db('0x5d')][_0x88db('0x40')];_0x4c70bb++){var _0x51c239=_0x542edd[_0x88db('0x5d')][_0x4c70bb];var _0x8fb052='i';var _0x5435e1=_[_0x88db('0x5e')](_0xb59419,[_0x88db('0x2d'),_0x51c239[_0x88db('0x48')]]);if(!_0x5435e1){switch(_0x51c239[_0x88db('0x48')]){case _0x88db('0x5f'):if(_0x51c239[_0x88db('0x60')]==0x1){_0x2b20e3[_0x88db('0x61')]('`'+_0x51c239[_0x88db('0x48')]+_0x88db('0x62'));}else{_0x2b20e3[_0x88db('0x61')]('`'+_0x51c239[_0x88db('0x48')]+'`\x20>\x200');}break;case _0x88db('0x63'):if(_0x51c239[_0x88db('0x64')]===_0x88db('0x65')){if(_0x51c239['value'][_0x88db('0x31')]('\x20')[_0x88db('0x40')]>0x1){_0x1c9ab7[_0x5e8e37](_0x88db('0x66'),qs[_0x88db('0x67')](_0x51c239[_0x88db('0x60')]),null);}else{var _0x5e7048='%'+_0x51c239[_0x88db('0x60')]+'%';_0x1c9ab7[_0x5e8e37]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5e7048,_0x5e7048,_0x5e7048);}}else{_0x5435e1=_[_0x88db('0x5e')](_0xb59419,['name','ContactId']);_0x51c239['field']='ContactId';_0x1c788d=as[_0x88db('0x68')](_0x8fb052,_0x5435e1[_0x88db('0x37')],_0x51c239);_0x1c9ab7[_0x5e8e37](_0x1c788d[_0x88db('0x69')],_0x1c788d[_0x88db('0x60')][_0x88db('0x6a')],_0x1c788d[_0x88db('0x60')]['end']);}break;case _0x88db('0x6b'):var _0x587382=_0x51c239[_0x88db('0x60')][_0x88db('0x31')](',')['map'](function(_0x3c28cd){return Number(_0x3c28cd);});_0x587382[_0x88db('0x6c')](function(_0x145bdb){_0x1a9b4a['or'](_0x88db('0x6d'),'%,'+_0x145bdb+',%');});_0x485a75=_[_0x88db('0x6e')](_0x485a75,_0x587382);break;case'User':if(_0x51c239[_0x88db('0x64')]===_0x88db('0x65')){_0x1c9ab7[_0x5e8e37]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x51c239['value']+'%',null);}else{_0x5435e1=_['find'](_0xb59419,['name',_0x88db('0x6f')]);_0x51c239['field']='UserId';_0x1c788d=as[_0x88db('0x68')](_0x8fb052,_0x5435e1[_0x88db('0x37')],_0x51c239);_0x1c9ab7[_0x5e8e37](_0x1c788d[_0x88db('0x69')],_0x1c788d[_0x88db('0x60')][_0x88db('0x6a')],_0x1c788d[_0x88db('0x60')]['end']);}break;case'body':_0x1c788d=as[_0x88db('0x68')]('me',null,_0x51c239);_0x1c9ab7[_0x5e8e37](_0x1c788d[_0x88db('0x69')],_0x1c788d[_0x88db('0x60')][_0x88db('0x6a')],_0x1c788d[_0x88db('0x60')][_0x88db('0x1f')]);break;}}else{var _0x1c788d=as[_0x88db('0x68')](_0x8fb052,_0x5435e1[_0x88db('0x37')],_0x51c239);_0x1c9ab7[_0x5e8e37](_0x1c788d[_0x88db('0x69')],_0x1c788d[_0x88db('0x60')]['start'],_0x1c788d['value'][_0x88db('0x1f')]);}}}else{var _0x15b256=_(_0xc0f208[_0x88db('0x3a')])['keys']()[_0x88db('0x34')](function(_0x1213a3){return _[_0x88db('0x70')](_0xb59419,[_0x88db('0x2d'),_0x1213a3])?_0x1213a3:undefined;})[_0x88db('0x71')]()['value']();if(!_[_0x88db('0x72')](_0x15b256)){_0x15b256[_0x88db('0x6c')](function(_0x54b6d2){if(_0x54b6d2===_0x88db('0x73')){_0x2b20e3[_0x88db('0x45')](_0x88db('0x74'),[][_0x88db('0x75')](_0xc0f208[_0x88db('0x3a')][_0x54b6d2]));}else if(_0x54b6d2==='createdAt'){var _0x50d26f=JSON['parse'](_0xc0f208[_0x88db('0x3a')][_0x54b6d2])['$gte'];var _0x48cb06=JSON[_0x88db('0x76')](_0xc0f208['query'][_0x54b6d2])['$lte'];_0x2b20e3['where'](_0x88db('0x77'),_0x50d26f,_0x48cb06);}else{if(_0xc0f208[_0x88db('0x3a')][_0x54b6d2]===_0x88db('0x78')){_0x2b20e3[_0x88db('0x45')]('i.'+_0x54b6d2+'\x20IS\x20NULL');}else{_0x2b20e3[_0x88db('0x45')]('i.'+_0x54b6d2+_0x88db('0x79'),_0xc0f208[_0x88db('0x3a')][_0x54b6d2]);}}});}if(_0xc0f208[_0x88db('0x3a')]['read']){if(_0xc0f208[_0x88db('0x3a')][_0x88db('0x7a')]==0x1){_0x2b20e3[_0x88db('0x61')](_0x88db('0x7b'));}else{_0x2b20e3[_0x88db('0x61')]('`unreadMessages`\x20>\x200');}}if(_0xc0f208[_0x88db('0x3a')][_0x88db('0x7c')]){_0x485a75=_['isArray'](_0xc0f208[_0x88db('0x3a')][_0x88db('0x7c')])?_0xc0f208[_0x88db('0x3a')][_0x88db('0x7c')]:new Array(_0xc0f208[_0x88db('0x3a')][_0x88db('0x7c')]);_0x485a75[_0x88db('0x6c')](function(_0x231ec5){_0x1a9b4a['or'](_0x88db('0x6d'),'%,'+_0x231ec5+',%');});}if(_0xc0f208['query'][_0x88db('0x7d')]){var _0x1c1d18=_0xc0f208[_0x88db('0x3a')]['filter'][_0x88db('0x7e')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x88db('0x7f')](_0x1c1d18)){_0x1c9ab7['or']('i.id\x20LIKE\x20?',_0x1c1d18+'%');}else{_0x1c9ab7['or'](_0x88db('0x80'),qs[_0x88db('0x67')](_0x1c1d18))['or'](_0x88db('0x81'),_0x1c1d18+'%')['or'](_0x88db('0x82'),_0x1c1d18+'%');}}}_0x2b20e3[_0x88db('0x45')](_0x1c9ab7);_0x2b20e3['group'](_0x88db('0x83'));var _0x166fd5={'type':db[_0x88db('0x84')]['QueryTypes'][_0x88db('0x85')],'raw':!![]};var _0x119ff7=_0x2b20e3[_0x88db('0x86')]();_0x119ff7[_0x88db('0x48')]('i.id');_0x119ff7['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x88db('0x5f'));if(_0x34a6b4[_0x88db('0x43')]){_0x34a6b4[_0x88db('0x43')][_0x88db('0x6c')](function(_0x3ac53b){var _0x11fb35=_0x3ac53b[0x0]==='contactName'?_0x3ac53b[0x0]:'i.'+_0x3ac53b[0x0];_0x2b20e3[_0x88db('0x43')](_0x11fb35,_0x3ac53b[0x1]===_0x88db('0x87')?![]:!![]);});}if(!_[_0x88db('0x72')](_0x485a75)){_0x2b20e3[_0x88db('0x61')](_0x1a9b4a);_0x119ff7[_0x88db('0x45')](_0x88db('0x88'),_0x485a75);}BPromise['resolve']()['then'](function(){if(!_0x542edd){if(_0xc0f208[_0x88db('0x3a')]['OpenchannelAccountId'])return;_0x119ff7[_0x88db('0x45')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x2b20e3['where'](_0x88db('0x89'));return;}if(_0xc0f208[_0x88db('0x8a')]['role']!==_0x88db('0x8b'))return;return _0xc0f208[_0x88db('0x8a')][_0x88db('0x8c')]({'attributes':['id'],'raw':!![]})[_0x88db('0x2a')](function(_0x2c87ff){if(_[_0x88db('0x72')](_0x2c87ff)){_0x119ff7['where'](_0x88db('0x8d'));_0x2b20e3['where'](_0x88db('0x8d'));}else{_0x119ff7[_0x88db('0x45')](_0x88db('0x74'),_[_0x88db('0x34')](_0x2c87ff,'id'));_0x2b20e3[_0x88db('0x45')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x88db('0x34')](_0x2c87ff,'id'));}});})[_0x88db('0x2a')](function(){if(_0xc0f208[_0x88db('0x8a')][_0x88db('0x8e')]===_0x88db('0x8b')&&!_0x542edd&&!_0xc0f208[_0x88db('0x3a')]['OpenchannelAccountId'])return[];return db[_0x88db('0x8f')][_0x88db('0x3a')](_0x119ff7['toString'](),_0x166fd5);})[_0x88db('0x2a')](function(_0x592eb2){_0x5f0f8f[_0x88db('0x24')]=_0x592eb2['length'];if(_0x5f0f8f[_0x88db('0x24')]===0x0)return[];return db[_0x88db('0x8f')]['query'](_0xd4b78d[_0x88db('0x90')](),_0x166fd5)[_0x88db('0x2a')](function(_0x581609){_0x4d3c61=_[_0x88db('0x91')](_0x581609,'id');_0x166fd5=_['merge'](_0x166fd5,{'model':db[_0x88db('0x92')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xc0f208[_0x88db('0x3a')][_0x88db('0x3f')]){_0x34a6b4[_0x88db('0x3e')]['forEach'](function(_0x408929){_0x2b20e3[_0x88db('0x48')]('i.'+_0x408929);});}else{_0x2b20e3['field'](_0x88db('0x93'),'unreadMessages');_0x2b20e3[_0x88db('0x48')]('a.key',_0x88db('0x94'));_0x2b20e3['field'](_0x88db('0x95'),_0x88db('0x96'));_0x2b20e3[_0x88db('0x48')](_0x88db('0x97'),_0x88db('0x98'));_0x2b20e3['field'](_0x88db('0x99'));_0x2b20e3[_0x88db('0x48')]('c.firstName',_0x88db('0x9a'));_0x2b20e3[_0x88db('0x48')](_0x88db('0x9b'),_0x88db('0x9c'));_0x2b20e3[_0x88db('0x48')]('c.email','Contact.email');_0x2b20e3[_0x88db('0x48')](_0x88db('0x9d'),'Contact.phone');_0x2b20e3[_0x88db('0x48')](_0x88db('0x9e'),_0x88db('0x9f'));_0x2b20e3[_0x88db('0x48')]('c.fax',_0x88db('0xa0'));_0x2b20e3['field']('o.fullname',_0x88db('0xa1'));_0x2b20e3[_0x88db('0x48')](_0x88db('0xa2'),'Owner.internal');_0x2b20e3['field'](_0x88db('0xa3'),'TagIds');}if(_0x34a6b4['limit'])_0x2b20e3['limit'](_0x34a6b4['limit']);if(_0x34a6b4['offset'])_0x2b20e3[_0x88db('0x21')](_0x34a6b4[_0x88db('0x21')]);return db[_0x88db('0x8f')]['query'](_0x2b20e3[_0x88db('0x90')](),_0x166fd5);})[_0x88db('0x2a')](function(_0x2d87f0){if(_0x2d87f0[_0x88db('0x40')]>0x0)_0x9ae9ba['where']('ui.OpenchannelInteractionId\x20IN\x20?',_[_0x88db('0x34')](_0x2d87f0,'id'));return db['sequelize'][_0x88db('0x3a')](_0x9ae9ba['toString'](),_0x166fd5)['then'](function(_0x48f285){var _0x5b2f4b=_[_0x88db('0xa4')](_0x48f285,_0x88db('0xa5'));var _0x80fe0e=[];_0x2d87f0[_0x88db('0x6c')](function(_0x226774){_0x80fe0e['push'](updateOpenchannelInteraction(_0x226774,_0x4d3c61,_0x5b2f4b));});return BPromise[_0x88db('0xa6')](_0x80fe0e);});});})[_0x88db('0x2a')](function(_0x149523){_0x5f0f8f[_0x88db('0xa7')]=_0x149523;return _0x5f0f8f;})[_0x88db('0x2a')](respondWithFilteredResult(_0x717534,_0x34a6b4))[_0x88db('0xa8')](handleError(_0x717534,null));};exports[_0x88db('0xa9')]=function(_0x1862ff,_0x28f6c5){var _0x540d7e={};if(_0x1862ff[_0x88db('0x3a')][_0x88db('0x37')]&&_0x1862ff[_0x88db('0x3a')][_0x88db('0x37')]==='from'){_0x540d7e['from']=_0x1862ff['params']['id'];}else{_0x540d7e['id']=_0x1862ff[_0x88db('0xaa')]['id'];}var _0x542dd5={'raw':![],'where':_0x540d7e},_0x411dfc={};_0x411dfc[_0x88db('0x39')]=_[_0x88db('0x3b')](db[_0x88db('0x92')][_0x88db('0x35')]);_0x411dfc[_0x88db('0x3a')]=_[_0x88db('0x3b')](_0x1862ff['query']);_0x411dfc[_0x88db('0x3c')]=_[_0x88db('0x3d')](_0x411dfc['model'],_0x411dfc['query']);_0x542dd5[_0x88db('0x3e')]=_['intersection'](_0x411dfc[_0x88db('0x39')],qs[_0x88db('0x3f')](_0x1862ff['query'][_0x88db('0x3f')]));_0x542dd5[_0x88db('0x3e')]=_0x542dd5[_0x88db('0x3e')]['length']?_0x542dd5[_0x88db('0x3e')]:_0x411dfc[_0x88db('0x39')];if(_0x1862ff[_0x88db('0x3a')][_0x88db('0xab')]){_0x542dd5[_0x88db('0xac')]=[{'all':!![]}];}_0x542dd5=_[_0x88db('0xad')]({},_0x542dd5,_0x1862ff[_0x88db('0xae')]);return db[_0x88db('0x92')][_0x88db('0x5e')](_0x542dd5)[_0x88db('0x2a')](handleEntityNotFound(_0x28f6c5,null))[_0x88db('0x2a')](respondWithResult(_0x28f6c5,null))[_0x88db('0xa8')](handleError(_0x28f6c5,null));};exports[_0x88db('0xaf')]=function(_0x4e0b3b,_0x1afc1e){return db[_0x88db('0x92')][_0x88db('0xaf')](_0x4e0b3b[_0x88db('0xb0')],{})[_0x88db('0x2a')](respondWithResult(_0x1afc1e,0xc9))[_0x88db('0xa8')](handleError(_0x1afc1e,null));};exports[_0x88db('0x29')]=function(_0xee0c86,_0x3c1a87){if(_0xee0c86[_0x88db('0xb0')]['id']){delete _0xee0c86[_0x88db('0xb0')]['id'];}return db['OpenchannelInteraction'][_0x88db('0x5e')]({'where':{'id':_0xee0c86[_0x88db('0xaa')]['id']}})[_0x88db('0x2a')](handleEntityNotFound(_0x3c1a87,null))[_0x88db('0x2a')](saveUpdates(_0xee0c86['body'],null))[_0x88db('0x2a')](respondWithResult(_0x3c1a87,null))['catch'](handleError(_0x3c1a87,null));};exports[_0x88db('0x2b')]=function(_0x57dc80,_0x19b56a){return db[_0x88db('0x92')][_0x88db('0x5e')]({'where':{'id':_0x57dc80[_0x88db('0xaa')]['id']}})[_0x88db('0x2a')](handleEntityNotFound(_0x19b56a,null))[_0x88db('0x2a')](removeEntity(_0x19b56a,null))[_0x88db('0xa8')](handleError(_0x19b56a,null));};exports[_0x88db('0xb1')]=function(_0x58389c,_0x28e5d2){return db[_0x88db('0x92')]['describe']()[_0x88db('0x2a')](respondWithResult(_0x28e5d2,null))[_0x88db('0xa8')](handleError(_0x28e5d2,null));};exports[_0x88db('0xb2')]=function(_0x4c823d,_0x29c859,_0x3bcc99){return db['OpenchannelMessage']['find']({'where':{'id':_0x4c823d[_0x88db('0xaa')]['id']}})[_0x88db('0x2a')](handleEntityNotFound(_0x29c859,null))[_0x88db('0x2a')](function(_0xded777){if(_0xded777){return _0xded777[_0x88db('0xb2')](_0x4c823d['body'][_0x88db('0xb3')],_[_0x88db('0xb4')](_0x4c823d[_0x88db('0xb0')],[_0x88db('0xb3'),'id'])||{});}})['then'](respondWithResult(_0x29c859,null))['catch'](handleError(_0x29c859,null));};exports['getMessages']=function(_0x1493ce,_0x49c60e,_0x33f7a8){var _0x5e8591={'raw':![],'where':{}};var _0x5dc9c5={};var _0x4cdeec={'count':0x0,'rows':[]};return db[_0x88db('0x92')]['findOne']({'where':{'id':_0x1493ce[_0x88db('0xaa')]['id']}})[_0x88db('0x2a')](handleEntityNotFound(_0x49c60e,null))[_0x88db('0x2a')](function(_0x302bab){if(_0x302bab){_0x5dc9c5[_0x88db('0x39')]=_[_0x88db('0x3b')](db[_0x88db('0xb5')]['rawAttributes']);_0x5dc9c5[_0x88db('0x3a')]=_[_0x88db('0x3b')](_0x1493ce[_0x88db('0x3a')]);_0x5dc9c5[_0x88db('0x3c')]=_[_0x88db('0x3d')](_0x5dc9c5[_0x88db('0x39')],_0x5dc9c5['query']);_0x5e8591[_0x88db('0x3e')]=_[_0x88db('0x3d')](_0x5dc9c5[_0x88db('0x39')],qs[_0x88db('0x3f')](_0x1493ce[_0x88db('0x3a')][_0x88db('0x3f')]));_0x5e8591[_0x88db('0x3e')]=_0x5e8591['attributes'][_0x88db('0x40')]?_0x5e8591['attributes']:_0x5dc9c5[_0x88db('0x39')];if(!_0x1493ce[_0x88db('0x3a')][_0x88db('0x41')](_0x88db('0x42'))){_0x5e8591[_0x88db('0x23')]=qs['limit'](_0x1493ce[_0x88db('0x3a')][_0x88db('0x23')]);_0x5e8591[_0x88db('0x21')]=qs[_0x88db('0x21')](_0x1493ce['query'][_0x88db('0x21')]);}_0x5e8591['order']=qs[_0x88db('0x44')](_0x1493ce['query'][_0x88db('0x44')]);_0x5e8591[_0x88db('0x45')]=qs[_0x88db('0x3c')](_[_0x88db('0x46')](_0x1493ce[_0x88db('0x3a')],_0x5dc9c5[_0x88db('0x3c')]));_0x5e8591[_0x88db('0x45')][_0x88db('0xa5')]=_0x302bab['id'];if(_0x1493ce[_0x88db('0x3a')][_0x88db('0x7d')]){_0x5e8591['where']=_[_0x88db('0xad')](_0x5e8591[_0x88db('0x45')],{'$or':_[_0x88db('0x34')](_0x5e8591[_0x88db('0x3e')],function(_0x3313c2){var _0x117b92={};_0x117b92[_0x3313c2]={'$like':'%'+_0x1493ce[_0x88db('0x3a')]['filter']+'%'};return _0x117b92;})});}if(_0x1493ce['query']['$gte']){var _0x5eade5=_0x1493ce[_0x88db('0x3a')][_0x88db('0xb6')][_0x88db('0x31')](',');var _0x159681={};_0x159681[_0x5eade5[0x0]]={'$gte':moment(_0x5eade5[0x1])[_0x88db('0xb7')](_0x88db('0xb8'))};_0x5e8591[_0x88db('0x45')]=_['merge'](_0x5e8591[_0x88db('0x45')],_0x159681);}_0x5e8591=_[_0x88db('0xad')]({},_0x5e8591,_0x1493ce['options']);return db[_0x88db('0xb5')][_0x88db('0x24')]({'where':_0x5e8591[_0x88db('0x45')]})[_0x88db('0x2a')](function(_0x100373){_0x4cdeec[_0x88db('0x24')]=_0x100373;if(_0x1493ce[_0x88db('0x3a')][_0x88db('0xab')]){_0x5e8591[_0x88db('0xac')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x88db('0xb9')](_0x5e8591);})[_0x88db('0x2a')](function(_0x3e06fc){_0x4cdeec[_0x88db('0xa7')]=_0x3e06fc;return _0x4cdeec;});}})[_0x88db('0x2a')](respondWithFilteredResult(_0x49c60e,_0x5e8591))[_0x88db('0xa8')](handleError(_0x49c60e,null));};exports['addTags']=function(_0x3dd320,_0x1ba1ea,_0x49c8dd){return db[_0x88db('0x92')][_0x88db('0x5e')]({'where':{'id':_0x3dd320[_0x88db('0xaa')]['id']}})['then'](handleEntityNotFound(_0x1ba1ea,null))[_0x88db('0x2a')](function(_0x4b576c){if(_0x4b576c){return _0x4b576c[_0x88db('0xba')](_0x3dd320[_0x88db('0xb0')]['ids'],_[_0x88db('0xb4')](_0x3dd320[_0x88db('0xb0')],[_0x88db('0xb3'),'id'])||{})['spread'](function(){return db[_0x88db('0x6b')][_0x88db('0xb9')]({'attributes':['id','name',_0x88db('0x49')],'where':{'id':_0x3dd320[_0x88db('0xb0')][_0x88db('0xb3')]}});})[_0x88db('0x2a')](function(_0x208da9){socket[_0x88db('0xbb')](_0x88db('0xbc'),{'id':Number(_0x3dd320[_0x88db('0xaa')]['id']),'tags':_0x208da9||[]});return{'id':Number(_0x3dd320[_0x88db('0xaa')]['id']),'tags':_0x208da9||[]};});}})[_0x88db('0x2a')](respondWithResult(_0x1ba1ea,null))[_0x88db('0xa8')](handleError(_0x1ba1ea,null));};exports[_0x88db('0xbd')]=function(_0x342632,_0x5a6bcf,_0x41403b){return db[_0x88db('0x92')][_0x88db('0x5e')]({'where':{'id':_0x342632['params']['id']}})['then'](handleEntityNotFound(_0x5a6bcf,null))[_0x88db('0x2a')](function(_0x137992){if(_0x137992){return _0x137992[_0x88db('0xbd')](_0x342632['query'][_0x88db('0xb3')]);}})[_0x88db('0x2a')](respondWithStatusCode(_0x5a6bcf,null))['catch'](handleError(_0x5a6bcf,null));};exports[_0x88db('0xbe')]=function(_0x48aa33,_0x3e96be){var _0x573730=moment()[_0x88db('0xbf')]()[_0x88db('0x90')]();var _0x2f869a=path[_0x88db('0xc0')](config['root'],'server',_0x88db('0xc1'),_0x88db('0xc2'));var _0x291823=path[_0x88db('0xc0')](config[_0x88db('0xc3')],_0x88db('0xc4'),_0x88db('0xc1'),_0x88db('0xc5'));var _0xe5b5f1=path[_0x88db('0xc0')](_0x2f869a,_0x573730);var _0x37b64d=util[_0x88db('0xb7')]('transcript-%d-%s.zip',_0x48aa33[_0x88db('0xaa')]['id'],_0x573730);var _0x3d7933=path['join'](_0x2f869a,_0x37b64d);var _0x3611f0=[];_0x3611f0[_0x88db('0x32')]({'model':db[_0x88db('0xc6')],'as':'User','attributes':['id',_0x88db('0xc7')],'raw':!![]});_0x3611f0[_0x88db('0x32')]({'model':db[_0x88db('0xc8')],'as':_0x88db('0x63'),'attributes':['id',_0x88db('0xc9'),_0x88db('0xca')],'raw':!![]});if(_0x48aa33[_0x88db('0x3a')][_0x88db('0xc5')]){_0x3611f0['push']({'model':db['Attachment'],'as':_0x88db('0xcb'),'raw':!![]});}var _0x45d0d5=[{'model':db[_0x88db('0xb5')],'as':_0x88db('0xcc'),'attributes':['id',_0x88db('0xb0'),_0x88db('0xcd'),_0x88db('0xce'),_0x88db('0xcf'),_0x88db('0x7a')],'include':_0x3611f0}];_0x45d0d5[_0x88db('0x32')]({'model':db[_0x88db('0xd0')],'as':_0x88db('0xd1'),'attributes':['id','name']});_0x45d0d5['push']({'model':db[_0x88db('0xc6')],'as':_0x88db('0xd2'),'attributes':['id','fullname']});return db[_0x88db('0x92')]['find']({'where':{'id':_0x48aa33[_0x88db('0xaa')]['id']},'include':_0x45d0d5})[_0x88db('0x2a')](handleEntityNotFound(_0x3e96be,null))[_0x88db('0x2a')](function(_0x3ad06c){if(_0x3ad06c){var _0x16cba6=_0x3ad06c[_0x88db('0xd3')]({'plain':!![]});fs[_0x88db('0xd4')](_0xe5b5f1);var _0x1a6e36={'channel':_0x88db('0xd5'),'account':_0x16cba6[_0x88db('0xd1')]['name'],'agent':_0x16cba6[_0x88db('0xd2')]?_0x16cba6[_0x88db('0xd2')][_0x88db('0xc7')]:_0x88db('0xd6'),'createdAt':moment(_0x16cba6['createdAt'])[_0x88db('0xb7')]('YYYY-MM-DD\x20HH:mm:ss')[_0x88db('0x90')](),'closedAt':_0x16cba6['closed']?moment(_0x16cba6[_0x88db('0xd7')])[_0x88db('0xb7')](_0x88db('0xb8'))[_0x88db('0x90')]():'','disposition':_0x16cba6[_0x88db('0xd8')],'visibility':_0x16cba6[_0x88db('0xd9')]?_0x88db('0xda'):_0x88db('0xdb'),'messages':_(_0x16cba6[_0x88db('0xcc')])[_0x88db('0x7d')]({'secret':![]})[_0x88db('0x34')](function(_0x4d8508){if(_0x4d8508['Attachment']){var _0x2a30ea=path[_0x88db('0xc0')](_0x291823,_0x4d8508[_0x88db('0xcb')]['basename']);if(fs[_0x88db('0xdc')](_0x2a30ea)){fs[_0x88db('0xdd')](_0x2a30ea)[_0x88db('0xde')](fs['createWriteStream'](path[_0x88db('0xc0')](_0xe5b5f1,_0x4d8508[_0x88db('0xcb')][_0x88db('0xdf')])));}}return{'date':moment(_0x4d8508[_0x88db('0xcd')])[_0x88db('0xb7')](_0x88db('0xb8'))['toString'](),'sender':_0x4d8508[_0x88db('0xce')]===_0x88db('0xe0')?_0x4d8508[_0x88db('0xc6')]?_0x4d8508[_0x88db('0xc6')][_0x88db('0xc7')]:_0x88db('0xe1'):_0x4d8508['Contact'][_0x88db('0xc9')]+(_0x4d8508[_0x88db('0x63')][_0x88db('0xca')]?'\x20'+_0x4d8508[_0x88db('0x63')]['lastName']:''),'body':_0x4d8508[_0x88db('0xcb')]?_0x4d8508[_0x88db('0xcb')][_0x88db('0xdf')]:_0x4d8508[_0x88db('0xb0')],'direction':_0x4d8508[_0x88db('0xce')]===_0x88db('0xe0')?'A':'C','secret':_0x4d8508[_0x88db('0xcf')],'read':_0x4d8508[_0x88db('0x7a')],'attachment':_0x4d8508['Attachment']};})[_0x88db('0x60')]()};return ejs[_0x88db('0xe2')](path[_0x88db('0xc0')](config[_0x88db('0xc3')],'server',_0x88db('0xe3'),'downloadInteraction.ejs'),{'interaction':_0x1a6e36})['then'](function(_0x308532){var _0x45f139=path[_0x88db('0xc0')](_0xe5b5f1,_0x88db('0xe4')+_0x16cba6['id']+'-'+_0x573730+_0x88db('0xe5'));var _0x382ce1={'path':_0x45f139,'channel':_0x88db('0xd5'),'interactionId':_0x16cba6['id']};return pdf[_0x88db('0xe6')](_0x308532,_0x382ce1);})[_0x88db('0x2a')](function(){return new BPromise(function(_0x37db6d,_0x66b8f8){zipdir(_0xe5b5f1,{'saveTo':_0x3d7933},function(_0xcaeaec,_0x544417){if(_0xcaeaec)return _0x66b8f8(_0xcaeaec);return _0x37db6d(_0x544417);});})[_0x88db('0x2a')](function(){return new BPromise(function(_0x2bd709,_0x16ab2c){rimraf(_0xe5b5f1,function(_0x31df9c){if(_0x31df9c)_0x16ab2c(_0x31df9c);return _0x2bd709();});});})[_0x88db('0x2a')](function(){return _0x3e96be['download'](_0x3d7933,_0x37b64d,function(_0x368220){if(_0x368220){console[_0x88db('0xe7')](_0x88db('0xe8'),_0x368220);}else{fs[_0x88db('0xe9')](_0x3d7933);}});});});}else{return _0x3e96be[_0x88db('0x1d')](0xc8);}})[_0x88db('0xa8')](handleError(_0x3e96be,null));}; \ No newline at end of file +var _0x5c11=['unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','OpenchannelAccountId','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','i.id\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.fax','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','push','rows','params','rawAttributes','includeAll','merge','create','describe','addMessage','ids','omit','getMessages','findOne','OpenchannelInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','options','OpenchannelMessage','findAll','addTags','setTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','fullname','CmContact','firstName','attachments','Attachment','Messages','direction','Account','Owner','get','mkdirSync','Openchannel','closed','closedAt','disposition','Private','basename','existsSync','createReadStream','pipe','createWriteStream','lastName','out','secret','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','log','unlinkSync','rimraf','fast-json-patch','moment','mustache','sox','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','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','send','Users','map','TagIds','Tags','catch','index','OpenchannelInteraction','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','select','field','color','from','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','conditions','find'];(function(_0x46c98e,_0x30717c){var _0x57700d=function(_0x3231aa){while(--_0x3231aa){_0x46c98e['push'](_0x46c98e['shift']());}};_0x57700d(++_0x30717c);}(_0x5c11,0x16f));var _0x15c1=function(_0x1f2941,_0x3544ce){_0x1f2941=_0x1f2941-0x0;var _0x31e313=_0x5c11[_0x1f2941];return _0x31e313;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x15c1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x15c1('0x1'));var rp=require('request-promise');var moment=require(_0x15c1('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x15c1('0x3'));var util=require('util');var path=require('path');var sox=require(_0x15c1('0x4'));var csv=require(_0x15c1('0x5'));var ejs=require(_0x15c1('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x15c1('0x7'));var squel=require(_0x15c1('0x8'));var crypto=require(_0x15c1('0x9'));var jsforce=require(_0x15c1('0xa'));var deskjs=require(_0x15c1('0xb'));var toCsv=require(_0x15c1('0x5'));var querystring=require('querystring');var Papa=require(_0x15c1('0xc'));var Redis=require(_0x15c1('0xd'));var authService=require(_0x15c1('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x15c1('0xf'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x15c1('0x10'));var logger=require(_0x15c1('0x11'))(_0x15c1('0x12'));var utils=require(_0x15c1('0x13'));var config=require(_0x15c1('0x14'));var licenseUtil=require(_0x15c1('0x15'));var db=require(_0x15c1('0x16'))['db'];config[_0x15c1('0x17')]=_[_0x15c1('0x18')](config[_0x15c1('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x15c1('0x19'))(new Redis(config[_0x15c1('0x17')]));require(_0x15c1('0x1a'))[_0x15c1('0x1b')](socket);function respondWithStatusCode(_0x48c54e,_0x4e0555){_0x4e0555=_0x4e0555||0xcc;return function(_0x470247){if(_0x470247){return _0x48c54e[_0x15c1('0x1c')](_0x4e0555);}return _0x48c54e[_0x15c1('0x1d')](_0x4e0555)['end']();};}function respondWithResult(_0x2896cb,_0x5ed05d){_0x5ed05d=_0x5ed05d||0xc8;return function(_0x1ccbb8){if(_0x1ccbb8){return _0x2896cb['status'](_0x5ed05d)['json'](_0x1ccbb8);}};}function respondWithFilteredResult(_0x2e6263,_0x17e29f){return function(_0xfbda20){if(_0xfbda20){var _0x4b0034=typeof _0x17e29f[_0x15c1('0x1e')]===_0x15c1('0x1f')&&typeof _0x17e29f[_0x15c1('0x20')]===_0x15c1('0x1f');var _0x2a92bc=_0xfbda20[_0x15c1('0x21')];var _0x13cc18=_0x4b0034?0x0:_0x17e29f[_0x15c1('0x1e')];var _0x460cec=_0x4b0034?_0xfbda20[_0x15c1('0x21')]:_0x17e29f[_0x15c1('0x1e')]+_0x17e29f[_0x15c1('0x20')];var _0x11acbd;if(_0x460cec>=_0x2a92bc){_0x460cec=_0x2a92bc;_0x11acbd=0xc8;}else{_0x11acbd=0xce;}_0x2e6263[_0x15c1('0x1d')](_0x11acbd);return _0x2e6263[_0x15c1('0x22')](_0x15c1('0x23'),_0x13cc18+'-'+_0x460cec+'/'+_0x2a92bc)[_0x15c1('0x24')](_0xfbda20);}return null;};}function patchUpdates(_0x2edf7d){return function(_0x53acb9){try{jsonpatch[_0x15c1('0x25')](_0x53acb9,_0x2edf7d,!![]);}catch(_0x4dcb75){return BPromise[_0x15c1('0x26')](_0x4dcb75);}return _0x53acb9[_0x15c1('0x27')]();};}function saveUpdates(_0x45e88d,_0x1b5283){return function(_0x49f504){if(_0x49f504){return _0x49f504[_0x15c1('0x28')](_0x45e88d)[_0x15c1('0x29')](function(_0x43e35e){return _0x43e35e;});}return null;};}function removeEntity(_0x46d375,_0x3ebc5a){return function(_0x36556d){if(_0x36556d){return _0x36556d[_0x15c1('0x2a')]()[_0x15c1('0x29')](function(){_0x46d375[_0x15c1('0x1d')](0xcc)[_0x15c1('0x2b')]();});}};}function handleEntityNotFound(_0x21e039,_0x27e7ee){return function(_0x548e7d){if(!_0x548e7d){_0x21e039[_0x15c1('0x1c')](0x194);}return _0x548e7d;};}function handleError(_0x311cf6,_0x48a36d){_0x48a36d=_0x48a36d||0x1f4;return function(_0x3e0e55){logger[_0x15c1('0x2c')](_0x3e0e55[_0x15c1('0x2d')]);if(_0x3e0e55['name']){delete _0x3e0e55['name'];}_0x311cf6['status'](_0x48a36d)[_0x15c1('0x2e')](_0x3e0e55);};}function getInteractionUsers(_0x4f6516,_0x29de8d){return new BPromise(function(_0x1092f3,_0x410317){try{if(_0x29de8d[_0x4f6516['id']]){_0x4f6516[_0x15c1('0x2f')]=_[_0x15c1('0x30')](_0x29de8d[_0x4f6516['id']],function(_0x3bbc31){return{'id':_0x3bbc31['id'],'fullname':_0x3bbc31['fullname']};});}}catch(_0x68ed20){_0x410317(_0x68ed20);}_0x1092f3(_0x4f6516);});}function getInteractionTags(_0x5a4969,_0x2ca895){return new BPromise(function(_0x3703e9,_0x44f811){try{if(_0x5a4969[_0x15c1('0x31')]){_0x5a4969[_0x15c1('0x32')]=[];_0x5a4969[_0x15c1('0x31')]['split'](',')['forEach'](function(_0x7fe021){_0x5a4969[_0x15c1('0x32')]['push'](_0x2ca895[_0x7fe021]);});}delete _0x5a4969[_0x15c1('0x31')];}catch(_0x2f752e){_0x44f811(_0x2f752e);}_0x3703e9(_0x5a4969);});}function updateOpenchannelInteraction(_0x33c7a4,_0x47e480,_0x16b7fa){return new BPromise(function(_0x36377a,_0x380317){return getInteractionUsers(_0x33c7a4,_0x16b7fa)[_0x15c1('0x29')](function(_0x59ae74){return getInteractionTags(_0x59ae74,_0x47e480);})[_0x15c1('0x29')](function(_0x186201){_0x36377a(_0x186201);})[_0x15c1('0x33')](function(_0x3ff62f){_0x380317(_0x3ff62f);});});}exports[_0x15c1('0x34')]=function(_0x2d92fa,_0x2600d5){var _0x3d69cf={},_0x2569e0={},_0x3806ae={'count':0x0,'rows':[]};var _0x5a8fef=_[_0x15c1('0x30')](db[_0x15c1('0x35')]['rawAttributes'],function(_0x55eafb){return{'name':_0x55eafb[_0x15c1('0x36')],'type':_0x55eafb[_0x15c1('0x37')][_0x15c1('0x38')]};});_0x2569e0[_0x15c1('0x39')]=_[_0x15c1('0x30')](_0x5a8fef,_0x15c1('0x3a'));_0x2569e0[_0x15c1('0x3b')]=_[_0x15c1('0x3c')](_0x2d92fa[_0x15c1('0x3b')]);_0x2569e0[_0x15c1('0x3d')]=_[_0x15c1('0x3e')](_0x2569e0[_0x15c1('0x39')],_0x2569e0[_0x15c1('0x3b')]);_0x3d69cf[_0x15c1('0x3f')]=_['intersection'](_0x2569e0[_0x15c1('0x39')],qs[_0x15c1('0x40')](_0x2d92fa[_0x15c1('0x3b')][_0x15c1('0x40')]));_0x3d69cf[_0x15c1('0x3f')]=_0x3d69cf[_0x15c1('0x3f')][_0x15c1('0x41')]?_0x3d69cf[_0x15c1('0x3f')]:_0x2569e0['model'];if(!_0x2d92fa[_0x15c1('0x3b')]['hasOwnProperty'](_0x15c1('0x42'))){_0x3d69cf[_0x15c1('0x20')]=qs[_0x15c1('0x20')](_0x2d92fa[_0x15c1('0x3b')][_0x15c1('0x20')]);_0x3d69cf[_0x15c1('0x1e')]=qs[_0x15c1('0x1e')](_0x2d92fa['query'][_0x15c1('0x1e')]);}_0x3d69cf['order']=qs[_0x15c1('0x43')](_0x2d92fa[_0x15c1('0x3b')][_0x15c1('0x43')]);_0x3d69cf[_0x15c1('0x44')]=qs[_0x15c1('0x3d')](_[_0x15c1('0x45')](_0x2d92fa[_0x15c1('0x3b')],_0x2569e0[_0x15c1('0x3d')]),_0x5a8fef);var _0x8266da=[];var _0x5326d7=squel[_0x15c1('0x46')]()[_0x15c1('0x47')]('id')[_0x15c1('0x47')](_0x15c1('0x3a'))[_0x15c1('0x47')](_0x15c1('0x48'))[_0x15c1('0x49')]('tools_tags');var _0x2b4799=squel[_0x15c1('0x46')]()[_0x15c1('0x47')]('u.id')[_0x15c1('0x47')](_0x15c1('0x4a'))['field'](_0x15c1('0x4b'))['from'](_0x15c1('0x4c'),'ui')[_0x15c1('0x4d')](_0x15c1('0x4e'),'u','u.id\x20=\x20ui.UserId');var _0x1de841=squel[_0x15c1('0x46')]()[_0x15c1('0x49')]('openchannel_interactions','i')[_0x15c1('0x4d')](_0x15c1('0x4f'),'c',_0x15c1('0x50'))[_0x15c1('0x4d')](_0x15c1('0x4e'),'o',_0x15c1('0x51'))[_0x15c1('0x4d')]('openchannel_accounts','a',_0x15c1('0x52'))[_0x15c1('0x4d')](_0x15c1('0x53'),'me',_0x15c1('0x54'))['left_join'](_0x15c1('0x55'),'it',_0x15c1('0x56'))['left_join'](_0x15c1('0x57'),'t',_0x15c1('0x58'));var _0x4d5a5a=squel[_0x15c1('0x59')]();var _0x41f835=[];var _0x5b4984=squel['expr']();var _0x30ee1c;if(_0x2d92fa['query']['search']){_0x30ee1c=as['parseSearch'](_0x2d92fa[_0x15c1('0x3b')][_0x15c1('0x5a')]);var _0x585a98=_0x30ee1c['sqlOperator'];for(var _0x46b12d=0x0;_0x46b12d<_0x30ee1c[_0x15c1('0x5b')][_0x15c1('0x41')];_0x46b12d++){var _0x4bced9=_0x30ee1c['conditions'][_0x46b12d];var _0x4d71bd='i';var _0x363dd3=_[_0x15c1('0x5c')](_0x5a8fef,[_0x15c1('0x3a'),_0x4bced9[_0x15c1('0x47')]]);if(!_0x363dd3){switch(_0x4bced9[_0x15c1('0x47')]){case _0x15c1('0x5d'):if(_0x4bced9[_0x15c1('0x5e')]==0x1){_0x1de841[_0x15c1('0x5f')]('`'+_0x4bced9[_0x15c1('0x47')]+_0x15c1('0x60'));}else{_0x1de841[_0x15c1('0x5f')]('`'+_0x4bced9[_0x15c1('0x47')]+_0x15c1('0x61'));}break;case _0x15c1('0x62'):if(_0x4bced9[_0x15c1('0x63')]===_0x15c1('0x64')){if(_0x4bced9[_0x15c1('0x5e')][_0x15c1('0x65')]('\x20')[_0x15c1('0x41')]>0x1){_0x4d5a5a[_0x585a98]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x15c1('0x66')](_0x4bced9['value']),null);}else{var _0x4de81e='%'+_0x4bced9['value']+'%';_0x4d5a5a[_0x585a98](_0x15c1('0x67'),_0x4de81e,_0x4de81e,_0x4de81e);}}else{_0x363dd3=_[_0x15c1('0x5c')](_0x5a8fef,['name',_0x15c1('0x68')]);_0x4bced9['field']=_0x15c1('0x68');_0x440ad1=as[_0x15c1('0x69')](_0x4d71bd,_0x363dd3[_0x15c1('0x37')],_0x4bced9);_0x4d5a5a[_0x585a98](_0x440ad1[_0x15c1('0x6a')],_0x440ad1[_0x15c1('0x5e')][_0x15c1('0x6b')],_0x440ad1[_0x15c1('0x5e')][_0x15c1('0x2b')]);}break;case _0x15c1('0x6c'):var _0x1b28f5=_0x4bced9[_0x15c1('0x5e')][_0x15c1('0x65')](',')['map'](function(_0x226d2a){return Number(_0x226d2a);});_0x1b28f5[_0x15c1('0x6d')](function(_0x1d2387){_0x5b4984['or'](_0x15c1('0x6e'),'%,'+_0x1d2387+',%');});_0x41f835=_[_0x15c1('0x6f')](_0x41f835,_0x1b28f5);break;case _0x15c1('0x70'):if(_0x4bced9[_0x15c1('0x63')]===_0x15c1('0x64')){_0x4d5a5a[_0x585a98](_0x15c1('0x71'),'%'+_0x4bced9[_0x15c1('0x5e')]+'%',null);}else{_0x363dd3=_[_0x15c1('0x5c')](_0x5a8fef,[_0x15c1('0x3a'),_0x15c1('0x72')]);_0x4bced9[_0x15c1('0x47')]=_0x15c1('0x72');_0x440ad1=as[_0x15c1('0x69')](_0x4d71bd,_0x363dd3[_0x15c1('0x37')],_0x4bced9);_0x4d5a5a[_0x585a98](_0x440ad1[_0x15c1('0x6a')],_0x440ad1[_0x15c1('0x5e')][_0x15c1('0x6b')],_0x440ad1[_0x15c1('0x5e')]['end']);}break;case _0x15c1('0x73'):_0x440ad1=as[_0x15c1('0x69')]('me',null,_0x4bced9);_0x4d5a5a[_0x585a98](_0x440ad1[_0x15c1('0x6a')],_0x440ad1[_0x15c1('0x5e')][_0x15c1('0x6b')],_0x440ad1['value'][_0x15c1('0x2b')]);break;}}else{var _0x440ad1=as[_0x15c1('0x69')](_0x4d71bd,_0x363dd3[_0x15c1('0x37')],_0x4bced9);_0x4d5a5a[_0x585a98](_0x440ad1[_0x15c1('0x6a')],_0x440ad1['value'][_0x15c1('0x6b')],_0x440ad1['value'][_0x15c1('0x2b')]);}}}else{var _0x37b016=_(_0x2d92fa['query'])[_0x15c1('0x3c')]()[_0x15c1('0x30')](function(_0x3dd137){return _['some'](_0x5a8fef,['name',_0x3dd137])?_0x3dd137:undefined;})['compact']()[_0x15c1('0x5e')]();if(!_['isEmpty'](_0x37b016)){_0x37b016[_0x15c1('0x6d')](function(_0x295877){if(_0x295877===_0x15c1('0x74')){_0x1de841[_0x15c1('0x44')]('i.OpenchannelAccountId\x20IN\x20?',[][_0x15c1('0x75')](_0x2d92fa[_0x15c1('0x3b')][_0x295877]));}else if(_0x295877===_0x15c1('0x76')){var _0x1eb904=JSON['parse'](_0x2d92fa['query'][_0x295877])[_0x15c1('0x77')];var _0x4e23a6=JSON[_0x15c1('0x78')](_0x2d92fa[_0x15c1('0x3b')][_0x295877])[_0x15c1('0x79')];_0x1de841[_0x15c1('0x44')](_0x15c1('0x7a'),_0x1eb904,_0x4e23a6);}else{if(_0x2d92fa[_0x15c1('0x3b')][_0x295877]===_0x15c1('0x7b')){_0x1de841[_0x15c1('0x44')]('i.'+_0x295877+_0x15c1('0x7c'));}else{_0x1de841['where']('i.'+_0x295877+_0x15c1('0x7d'),_0x2d92fa[_0x15c1('0x3b')][_0x295877]);}}});}if(_0x2d92fa[_0x15c1('0x3b')][_0x15c1('0x7e')]){if(_0x2d92fa['query'][_0x15c1('0x7e')]==0x1){_0x1de841[_0x15c1('0x5f')](_0x15c1('0x7f'));}else{_0x1de841[_0x15c1('0x5f')](_0x15c1('0x80'));}}if(_0x2d92fa['query']['tag']){_0x41f835=_[_0x15c1('0x81')](_0x2d92fa[_0x15c1('0x3b')][_0x15c1('0x82')])?_0x2d92fa['query']['tag']:new Array(_0x2d92fa['query']['tag']);_0x41f835[_0x15c1('0x6d')](function(_0x2d40cb){_0x5b4984['or'](_0x15c1('0x6e'),'%,'+_0x2d40cb+',%');});}if(_0x2d92fa[_0x15c1('0x3b')][_0x15c1('0x83')]){var _0x382830=_0x2d92fa[_0x15c1('0x3b')][_0x15c1('0x83')][_0x15c1('0x84')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x382830)){_0x4d5a5a['or'](_0x15c1('0x85'),_0x382830+'%');}else{_0x4d5a5a['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x382830))['or']('i.from\x20LIKE\x20?',_0x382830+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x382830+'%');}}}_0x1de841['where'](_0x4d5a5a);_0x1de841[_0x15c1('0x86')](_0x15c1('0x87'));var _0x43acc3={'type':db[_0x15c1('0x88')]['QueryTypes'][_0x15c1('0x89')],'raw':!![]};var _0x32d943=_0x1de841[_0x15c1('0x8a')]();_0x32d943[_0x15c1('0x47')]('i.id');_0x32d943[_0x15c1('0x47')](_0x15c1('0x8b'),_0x15c1('0x5d'));if(_0x3d69cf['order']){_0x3d69cf[_0x15c1('0x8c')][_0x15c1('0x6d')](function(_0xefdf4b){var _0x4a5898=_0xefdf4b[0x0]==='contactName'?_0xefdf4b[0x0]:'i.'+_0xefdf4b[0x0];_0x1de841[_0x15c1('0x8c')](_0x4a5898,_0xefdf4b[0x1]===_0x15c1('0x8d')?![]:!![]);});}if(!_[_0x15c1('0x8e')](_0x41f835)){_0x1de841[_0x15c1('0x5f')](_0x5b4984);_0x32d943[_0x15c1('0x44')](_0x15c1('0x8f'),_0x41f835);}BPromise[_0x15c1('0x90')]()[_0x15c1('0x29')](function(){if(!_0x30ee1c){if(_0x2d92fa[_0x15c1('0x3b')][_0x15c1('0x74')])return;_0x32d943['where'](_0x15c1('0x91'));_0x1de841[_0x15c1('0x44')](_0x15c1('0x91'));return;}if(_0x2d92fa[_0x15c1('0x92')]['role']!==_0x15c1('0x93'))return;return _0x2d92fa[_0x15c1('0x92')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x15c1('0x29')](function(_0x20b5ca){if(_[_0x15c1('0x8e')](_0x20b5ca)){_0x32d943[_0x15c1('0x44')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x1de841['where'](_0x15c1('0x94'));}else{_0x32d943[_0x15c1('0x44')](_0x15c1('0x95'),_[_0x15c1('0x30')](_0x20b5ca,'id'));_0x1de841[_0x15c1('0x44')](_0x15c1('0x95'),_[_0x15c1('0x30')](_0x20b5ca,'id'));}});})[_0x15c1('0x29')](function(){if(_0x2d92fa[_0x15c1('0x92')]['role']===_0x15c1('0x93')&&!_0x30ee1c&&!_0x2d92fa[_0x15c1('0x3b')][_0x15c1('0x74')])return[];return db[_0x15c1('0x96')][_0x15c1('0x3b')](_0x32d943[_0x15c1('0x97')](),_0x43acc3);})[_0x15c1('0x29')](function(_0x588eda){_0x3806ae['count']=_0x588eda[_0x15c1('0x41')];if(_0x3806ae['count']===0x0)return[];return db['sequelize']['query'](_0x5326d7[_0x15c1('0x97')](),_0x43acc3)[_0x15c1('0x29')](function(_0x1b95a4){_0x8266da=_[_0x15c1('0x98')](_0x1b95a4,'id');_0x43acc3=_['merge'](_0x43acc3,{'model':db[_0x15c1('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2d92fa[_0x15c1('0x3b')][_0x15c1('0x40')]){_0x3d69cf[_0x15c1('0x3f')][_0x15c1('0x6d')](function(_0x3cda22){_0x1de841['field']('i.'+_0x3cda22);});}else{_0x1de841[_0x15c1('0x47')](_0x15c1('0x8b'),_0x15c1('0x5d'));_0x1de841[_0x15c1('0x47')](_0x15c1('0x99'),'Account.key');_0x1de841[_0x15c1('0x47')](_0x15c1('0x9a'),'Account.mandatoryDisposition');_0x1de841['field'](_0x15c1('0x9b'),'contactName');_0x1de841[_0x15c1('0x47')](_0x15c1('0x9c'));_0x1de841[_0x15c1('0x47')](_0x15c1('0x9d'),'Contact.firstName');_0x1de841[_0x15c1('0x47')](_0x15c1('0x9e'),_0x15c1('0x9f'));_0x1de841['field']('c.email',_0x15c1('0xa0'));_0x1de841['field']('c.phone',_0x15c1('0xa1'));_0x1de841[_0x15c1('0x47')](_0x15c1('0xa2'),'Contact.mobile');_0x1de841[_0x15c1('0x47')]('c.fax',_0x15c1('0xa3'));_0x1de841[_0x15c1('0x47')]('o.fullname','Owner.fullname');_0x1de841[_0x15c1('0x47')](_0x15c1('0xa4'),'Owner.internal');_0x1de841[_0x15c1('0x47')](_0x15c1('0xa5'),_0x15c1('0x31'));}if(_0x3d69cf[_0x15c1('0x20')])_0x1de841[_0x15c1('0x20')](_0x3d69cf['limit']);if(_0x3d69cf[_0x15c1('0x1e')])_0x1de841[_0x15c1('0x1e')](_0x3d69cf[_0x15c1('0x1e')]);return db[_0x15c1('0x96')][_0x15c1('0x3b')](_0x1de841[_0x15c1('0x97')](),_0x43acc3);})[_0x15c1('0x29')](function(_0x5b2e11){if(_0x5b2e11[_0x15c1('0x41')]>0x0)_0x2b4799[_0x15c1('0x44')](_0x15c1('0xa6'),_[_0x15c1('0x30')](_0x5b2e11,'id'));return db[_0x15c1('0x96')]['query'](_0x2b4799[_0x15c1('0x97')](),_0x43acc3)[_0x15c1('0x29')](function(_0xb79890){var _0x476709=_[_0x15c1('0xa7')](_0xb79890,'OpenchannelInteractionId');var _0x586c04=[];_0x5b2e11['forEach'](function(_0x11e7da){_0x586c04[_0x15c1('0xa8')](updateOpenchannelInteraction(_0x11e7da,_0x8266da,_0x476709));});return BPromise['all'](_0x586c04);});});})[_0x15c1('0x29')](function(_0x40b0b6){_0x3806ae[_0x15c1('0xa9')]=_0x40b0b6;return _0x3806ae;})[_0x15c1('0x29')](respondWithFilteredResult(_0x2600d5,_0x3d69cf))['catch'](handleError(_0x2600d5,null));};exports['show']=function(_0xb65aa1,_0x10068f){var _0x400f4e={};if(_0xb65aa1[_0x15c1('0x3b')][_0x15c1('0x37')]&&_0xb65aa1['query']['type']===_0x15c1('0x49')){_0x400f4e[_0x15c1('0x49')]=_0xb65aa1[_0x15c1('0xaa')]['id'];}else{_0x400f4e['id']=_0xb65aa1[_0x15c1('0xaa')]['id'];}var _0x810cf6={'raw':![],'where':_0x400f4e},_0xcee11={};_0xcee11[_0x15c1('0x39')]=_[_0x15c1('0x3c')](db[_0x15c1('0x35')][_0x15c1('0xab')]);_0xcee11[_0x15c1('0x3b')]=_[_0x15c1('0x3c')](_0xb65aa1[_0x15c1('0x3b')]);_0xcee11['filters']=_[_0x15c1('0x3e')](_0xcee11[_0x15c1('0x39')],_0xcee11[_0x15c1('0x3b')]);_0x810cf6[_0x15c1('0x3f')]=_['intersection'](_0xcee11[_0x15c1('0x39')],qs[_0x15c1('0x40')](_0xb65aa1[_0x15c1('0x3b')][_0x15c1('0x40')]));_0x810cf6[_0x15c1('0x3f')]=_0x810cf6['attributes'][_0x15c1('0x41')]?_0x810cf6['attributes']:_0xcee11[_0x15c1('0x39')];if(_0xb65aa1['query'][_0x15c1('0xac')]){_0x810cf6['include']=[{'all':!![]}];}_0x810cf6=_[_0x15c1('0xad')]({},_0x810cf6,_0xb65aa1['options']);return db[_0x15c1('0x35')][_0x15c1('0x5c')](_0x810cf6)[_0x15c1('0x29')](handleEntityNotFound(_0x10068f,null))['then'](respondWithResult(_0x10068f,null))[_0x15c1('0x33')](handleError(_0x10068f,null));};exports[_0x15c1('0xae')]=function(_0x184922,_0x504d78){return db[_0x15c1('0x35')][_0x15c1('0xae')](_0x184922[_0x15c1('0x73')],{})['then'](respondWithResult(_0x504d78,0xc9))[_0x15c1('0x33')](handleError(_0x504d78,null));};exports[_0x15c1('0x28')]=function(_0x2f647e,_0x2280bc){if(_0x2f647e[_0x15c1('0x73')]['id']){delete _0x2f647e[_0x15c1('0x73')]['id'];}return db['OpenchannelInteraction'][_0x15c1('0x5c')]({'where':{'id':_0x2f647e[_0x15c1('0xaa')]['id']}})[_0x15c1('0x29')](handleEntityNotFound(_0x2280bc,null))[_0x15c1('0x29')](saveUpdates(_0x2f647e[_0x15c1('0x73')],null))[_0x15c1('0x29')](respondWithResult(_0x2280bc,null))[_0x15c1('0x33')](handleError(_0x2280bc,null));};exports[_0x15c1('0x2a')]=function(_0x5a2cc8,_0x212e0f){return db[_0x15c1('0x35')][_0x15c1('0x5c')]({'where':{'id':_0x5a2cc8['params']['id']}})[_0x15c1('0x29')](handleEntityNotFound(_0x212e0f,null))[_0x15c1('0x29')](removeEntity(_0x212e0f,null))['catch'](handleError(_0x212e0f,null));};exports[_0x15c1('0xaf')]=function(_0x100db7,_0x74cf07){return db['OpenchannelInteraction'][_0x15c1('0xaf')]()[_0x15c1('0x29')](respondWithResult(_0x74cf07,null))[_0x15c1('0x33')](handleError(_0x74cf07,null));};exports[_0x15c1('0xb0')]=function(_0x5124ac,_0x29ca90,_0x571074){return db['OpenchannelMessage'][_0x15c1('0x5c')]({'where':{'id':_0x5124ac['params']['id']}})['then'](handleEntityNotFound(_0x29ca90,null))['then'](function(_0x346b9d){if(_0x346b9d){return _0x346b9d[_0x15c1('0xb0')](_0x5124ac['body'][_0x15c1('0xb1')],_[_0x15c1('0xb2')](_0x5124ac['body'],[_0x15c1('0xb1'),'id'])||{});}})['then'](respondWithResult(_0x29ca90,null))[_0x15c1('0x33')](handleError(_0x29ca90,null));};exports[_0x15c1('0xb3')]=function(_0xfe11f,_0xf6e69b,_0x39676e){var _0x30a753={'raw':![],'where':{}};var _0x33f032={};var _0x49c8e4={'count':0x0,'rows':[]};return db[_0x15c1('0x35')][_0x15c1('0xb4')]({'where':{'id':_0xfe11f['params']['id']}})[_0x15c1('0x29')](handleEntityNotFound(_0xf6e69b,null))[_0x15c1('0x29')](function(_0x25ec22){if(_0x25ec22){_0x33f032[_0x15c1('0x39')]=_[_0x15c1('0x3c')](db['OpenchannelMessage'][_0x15c1('0xab')]);_0x33f032[_0x15c1('0x3b')]=_[_0x15c1('0x3c')](_0xfe11f[_0x15c1('0x3b')]);_0x33f032['filters']=_[_0x15c1('0x3e')](_0x33f032[_0x15c1('0x39')],_0x33f032[_0x15c1('0x3b')]);_0x30a753[_0x15c1('0x3f')]=_[_0x15c1('0x3e')](_0x33f032['model'],qs['fields'](_0xfe11f[_0x15c1('0x3b')][_0x15c1('0x40')]));_0x30a753[_0x15c1('0x3f')]=_0x30a753[_0x15c1('0x3f')][_0x15c1('0x41')]?_0x30a753[_0x15c1('0x3f')]:_0x33f032[_0x15c1('0x39')];if(!_0xfe11f['query']['hasOwnProperty'](_0x15c1('0x42'))){_0x30a753['limit']=qs[_0x15c1('0x20')](_0xfe11f[_0x15c1('0x3b')][_0x15c1('0x20')]);_0x30a753[_0x15c1('0x1e')]=qs[_0x15c1('0x1e')](_0xfe11f[_0x15c1('0x3b')]['offset']);}_0x30a753[_0x15c1('0x8c')]=qs[_0x15c1('0x43')](_0xfe11f[_0x15c1('0x3b')][_0x15c1('0x43')]);_0x30a753[_0x15c1('0x44')]=qs['filters'](_[_0x15c1('0x45')](_0xfe11f[_0x15c1('0x3b')],_0x33f032[_0x15c1('0x3d')]));_0x30a753[_0x15c1('0x44')][_0x15c1('0xb5')]=_0x25ec22['id'];if(_0xfe11f['query'][_0x15c1('0x83')]){_0x30a753[_0x15c1('0x44')]=_[_0x15c1('0xad')](_0x30a753[_0x15c1('0x44')],{'$or':_[_0x15c1('0x30')](_0x30a753[_0x15c1('0x3f')],function(_0x31fcfd){var _0x4a86c0={};_0x4a86c0[_0x31fcfd]={'$like':'%'+_0xfe11f[_0x15c1('0x3b')][_0x15c1('0x83')]+'%'};return _0x4a86c0;})});}if(_0xfe11f[_0x15c1('0x3b')][_0x15c1('0x77')]){var _0xbf92d2=_0xfe11f[_0x15c1('0x3b')][_0x15c1('0x77')][_0x15c1('0x65')](',');var _0x8b4c0={};_0x8b4c0[_0xbf92d2[0x0]]={'$gte':moment(_0xbf92d2[0x1])[_0x15c1('0xb6')](_0x15c1('0xb7'))};_0x30a753['where']=_['merge'](_0x30a753[_0x15c1('0x44')],_0x8b4c0);}_0x30a753=_[_0x15c1('0xad')]({},_0x30a753,_0xfe11f[_0x15c1('0xb8')]);return db[_0x15c1('0xb9')][_0x15c1('0x21')]({'where':_0x30a753[_0x15c1('0x44')]})[_0x15c1('0x29')](function(_0x59cc84){_0x49c8e4['count']=_0x59cc84;if(_0xfe11f['query'][_0x15c1('0xac')]){_0x30a753['include']=[{'all':!![]}];}return db[_0x15c1('0xb9')][_0x15c1('0xba')](_0x30a753);})[_0x15c1('0x29')](function(_0xfc53dc){_0x49c8e4[_0x15c1('0xa9')]=_0xfc53dc;return _0x49c8e4;});}})[_0x15c1('0x29')](respondWithFilteredResult(_0xf6e69b,_0x30a753))[_0x15c1('0x33')](handleError(_0xf6e69b,null));};exports[_0x15c1('0xbb')]=function(_0x46e649,_0x5920dd,_0x6d7b15){return db[_0x15c1('0x35')][_0x15c1('0x5c')]({'where':{'id':_0x46e649['params']['id']}})[_0x15c1('0x29')](handleEntityNotFound(_0x5920dd,null))[_0x15c1('0x29')](function(_0x561b4){if(_0x561b4){return _0x561b4[_0x15c1('0xbc')](_0x46e649['body'][_0x15c1('0xb1')],_[_0x15c1('0xb2')](_0x46e649['body'],['ids','id'])||{})[_0x15c1('0xbd')](function(){return db[_0x15c1('0x6c')][_0x15c1('0xba')]({'attributes':['id',_0x15c1('0x3a'),_0x15c1('0x48')],'where':{'id':_0x46e649[_0x15c1('0x73')]['ids']}});})['then'](function(_0x11b15b){socket[_0x15c1('0xbe')](_0x15c1('0xbf'),{'id':Number(_0x46e649[_0x15c1('0xaa')]['id']),'tags':_0x11b15b||[]});return{'id':Number(_0x46e649[_0x15c1('0xaa')]['id']),'tags':_0x11b15b||[]};});}})['then'](respondWithResult(_0x5920dd,null))[_0x15c1('0x33')](handleError(_0x5920dd,null));};exports[_0x15c1('0xc0')]=function(_0x513cb4,_0x339bbc,_0xc7d270){return db['OpenchannelInteraction'][_0x15c1('0x5c')]({'where':{'id':_0x513cb4[_0x15c1('0xaa')]['id']}})[_0x15c1('0x29')](handleEntityNotFound(_0x339bbc,null))[_0x15c1('0x29')](function(_0x5925a8){if(_0x5925a8){return _0x5925a8[_0x15c1('0xc0')](_0x513cb4['query'][_0x15c1('0xb1')]);}})[_0x15c1('0x29')](respondWithStatusCode(_0x339bbc,null))[_0x15c1('0x33')](handleError(_0x339bbc,null));};exports[_0x15c1('0xc1')]=function(_0x3ca147,_0x48c1e0){var _0x3386d1=moment()[_0x15c1('0xc2')]()[_0x15c1('0x97')]();var _0x290fee=path[_0x15c1('0xc3')](config[_0x15c1('0xc4')],_0x15c1('0xc5'),_0x15c1('0xc6'),'tmp');var _0x54cd75=path[_0x15c1('0xc3')](config['root'],_0x15c1('0xc5'),'files','attachments');var _0x5c2c20=path['join'](_0x290fee,_0x3386d1);var _0x38b672=util['format']('transcript-%d-%s.zip',_0x3ca147['params']['id'],_0x3386d1);var _0x351557=path[_0x15c1('0xc3')](_0x290fee,_0x38b672);var _0xef5d7=[];_0xef5d7[_0x15c1('0xa8')]({'model':db[_0x15c1('0x70')],'as':_0x15c1('0x70'),'attributes':['id',_0x15c1('0xc7')],'raw':!![]});_0xef5d7[_0x15c1('0xa8')]({'model':db[_0x15c1('0xc8')],'as':_0x15c1('0x62'),'attributes':['id',_0x15c1('0xc9'),'lastName'],'raw':!![]});if(_0x3ca147['query'][_0x15c1('0xca')]){_0xef5d7[_0x15c1('0xa8')]({'model':db['Attachment'],'as':_0x15c1('0xcb'),'raw':!![]});}var _0x5f585a=[{'model':db[_0x15c1('0xb9')],'as':_0x15c1('0xcc'),'attributes':['id','body',_0x15c1('0x76'),_0x15c1('0xcd'),'secret',_0x15c1('0x7e')],'include':_0xef5d7}];_0x5f585a[_0x15c1('0xa8')]({'model':db['OpenchannelAccount'],'as':_0x15c1('0xce'),'attributes':['id',_0x15c1('0x3a')]});_0x5f585a['push']({'model':db['User'],'as':_0x15c1('0xcf'),'attributes':['id',_0x15c1('0xc7')]});return db[_0x15c1('0x35')][_0x15c1('0x5c')]({'where':{'id':_0x3ca147[_0x15c1('0xaa')]['id']},'include':_0x5f585a})['then'](handleEntityNotFound(_0x48c1e0,null))['then'](function(_0x5176d9){if(_0x5176d9){var _0x151b49=_0x5176d9[_0x15c1('0xd0')]({'plain':!![]});fs[_0x15c1('0xd1')](_0x5c2c20);var _0x4d3db6={'channel':_0x15c1('0xd2'),'account':_0x151b49['Account'][_0x15c1('0x3a')],'agent':_0x151b49[_0x15c1('0xcf')]?_0x151b49[_0x15c1('0xcf')][_0x15c1('0xc7')]:'N.A.','createdAt':moment(_0x151b49[_0x15c1('0x76')])[_0x15c1('0xb6')](_0x15c1('0xb7'))[_0x15c1('0x97')](),'closedAt':_0x151b49[_0x15c1('0xd3')]?moment(_0x151b49[_0x15c1('0xd4')])['format'](_0x15c1('0xb7'))[_0x15c1('0x97')]():'','disposition':_0x151b49[_0x15c1('0xd5')],'visibility':_0x151b49['threadId']?'Public':_0x15c1('0xd6'),'messages':_(_0x151b49['Messages'])[_0x15c1('0x83')]({'secret':![]})[_0x15c1('0x30')](function(_0x485c4f){if(_0x485c4f[_0x15c1('0xcb')]){var _0x17b99f=path[_0x15c1('0xc3')](_0x54cd75,_0x485c4f[_0x15c1('0xcb')][_0x15c1('0xd7')]);if(fs[_0x15c1('0xd8')](_0x17b99f)){fs[_0x15c1('0xd9')](_0x17b99f)[_0x15c1('0xda')](fs[_0x15c1('0xdb')](path[_0x15c1('0xc3')](_0x5c2c20,_0x485c4f['Attachment']['basename'])));}}return{'date':moment(_0x485c4f['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x485c4f[_0x15c1('0xcd')]==='out'?_0x485c4f[_0x15c1('0x70')]?_0x485c4f['User'][_0x15c1('0xc7')]:'System':_0x485c4f[_0x15c1('0x62')][_0x15c1('0xc9')]+(_0x485c4f[_0x15c1('0x62')][_0x15c1('0xdc')]?'\x20'+_0x485c4f[_0x15c1('0x62')]['lastName']:''),'body':_0x485c4f[_0x15c1('0xcb')]?_0x485c4f[_0x15c1('0xcb')][_0x15c1('0xd7')]:_0x485c4f[_0x15c1('0x73')],'direction':_0x485c4f[_0x15c1('0xcd')]===_0x15c1('0xdd')?'A':'C','secret':_0x485c4f[_0x15c1('0xde')],'read':_0x485c4f[_0x15c1('0x7e')],'attachment':_0x485c4f[_0x15c1('0xcb')]};})[_0x15c1('0x5e')]()};return ejs[_0x15c1('0xdf')](path[_0x15c1('0xc3')](config[_0x15c1('0xc4')],'server',_0x15c1('0xe0'),_0x15c1('0xe1')),{'interaction':_0x4d3db6})[_0x15c1('0x29')](function(_0x1d3fdb){var _0x4de7cb=path[_0x15c1('0xc3')](_0x5c2c20,_0x15c1('0xe2')+_0x151b49['id']+'-'+_0x3386d1+_0x15c1('0xe3'));var _0x5956a3={'path':_0x4de7cb,'channel':_0x15c1('0xd2'),'interactionId':_0x151b49['id']};return pdf['createPdfFromHTML'](_0x1d3fdb,_0x5956a3);})[_0x15c1('0x29')](function(){return new BPromise(function(_0x1050b1,_0x2667d1){zipdir(_0x5c2c20,{'saveTo':_0x351557},function(_0x216596,_0x4d90e7){if(_0x216596)return _0x2667d1(_0x216596);return _0x1050b1(_0x4d90e7);});})[_0x15c1('0x29')](function(){return new BPromise(function(_0x270334,_0xab6f76){rimraf(_0x5c2c20,function(_0x102250){if(_0x102250)_0xab6f76(_0x102250);return _0x270334();});});})[_0x15c1('0x29')](function(){return _0x48c1e0[_0x15c1('0xc1')](_0x351557,_0x38b672,function(_0x292b07){if(_0x292b07){console[_0x15c1('0xe4')]('err',_0x292b07);}else{fs[_0x15c1('0xe5')](_0x351557);}});});});}else{return _0x48c1e0[_0x15c1('0x1c')](0xc8);}})['catch'](handleError(_0x48c1e0,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index b591d57..a369ad7 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 _0x7743=['Users','map','unreadMessages','emit','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue'];(function(_0x5527b0,_0x51d104){var _0x82ea2c=function(_0x349295){while(--_0x349295){_0x5527b0['push'](_0x5527b0['shift']());}};_0x82ea2c(++_0x51d104);}(_0x7743,0x139));var _0x3774=function(_0x27f06a,_0x42ec29){_0x27f06a=_0x27f06a-0x0;var _0x567b00=_0x7743[_0x27f06a];return _0x567b00;};'use strict';var EventEmitter=require(_0x3774('0x0'));var OpenchannelInteraction=require(_0x3774('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x3774('0x1'))['db'][_0x3774('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x3774('0x3')](0x0);var events={'afterCreate':_0x3774('0x4'),'afterUpdate':_0x3774('0x5'),'afterDestroy':_0x3774('0x6')};function emitEvent(_0x28f582){return function(_0x1db679,_0x46c2fb,_0xf6d966){_0x1db679[_0x3774('0x7')]({'attributes':['id'],'raw':!![]})[_0x3774('0x8')](function(_0x470517){_0x1db679[_0x3774('0x9')](_0x3774('0xa'),_0x470517[_0x3774('0xb')](function(_0x4484a3){return{'id':_0x4484a3['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x1db679['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3774('0x8')](function(_0x381ec3){_0x1db679[_0x3774('0x9')](_0x3774('0xc'),_0x381ec3['length']);OpenchannelInteractionEvents['emit'](_0x28f582+':'+_0x1db679['id'],_0x1db679);OpenchannelInteractionEvents[_0x3774('0xd')](_0x28f582,_0x1db679);_0xf6d966(null);})[_0x3774('0xe')](_0xf6d966(null));};}for(var e in events){if(events[_0x3774('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x3774('0x10')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0xa240=['Users','findAll','emit','catch','hasOwnProperty','hook','exports','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa240,0xd7));var _0x0a24=function(_0x30d87a,_0xf3a07f){_0x30d87a=_0x30d87a-0x0;var _0x48f64b=_0xa240[_0x30d87a];return _0x48f64b;};'use strict';var EventEmitter=require(_0x0a24('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x0a24('0x1')];var OpenchannelMessage=require(_0x0a24('0x2'))['db'][_0x0a24('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x0a24('0x4')](0x0);var events={'afterCreate':_0x0a24('0x5'),'afterUpdate':_0x0a24('0x6'),'afterDestroy':_0x0a24('0x7')};function emitEvent(_0x4ef1f7){return function(_0x326dfb,_0x3bf341,_0x2e7b73){_0x326dfb[_0x0a24('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x32bf81){_0x326dfb['setDataValue'](_0x0a24('0x9'),_0x32bf81['map'](function(_0x263a7a){return{'id':_0x263a7a['id']};}));return OpenchannelMessage[_0x0a24('0xa')]({'where':{'OpenchannelInteractionId':_0x326dfb['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3cada0){_0x326dfb['setDataValue']('unreadMessages',_0x3cada0['length']);OpenchannelInteractionEvents[_0x0a24('0xb')](_0x4ef1f7+':'+_0x326dfb['id'],_0x326dfb);OpenchannelInteractionEvents['emit'](_0x4ef1f7,_0x326dfb);_0x2e7b73(null);})[_0x0a24('0xc')](_0x2e7b73(null));};}for(var e in events){if(events[_0x0a24('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x0a24('0xe')](e,emitEvent(event));}}module[_0x0a24('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 1a2a094..51d1e5e 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 _0x291f=['request-promise','rimraf','exports','define','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','../../config/logger','moment'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x291f,0xa6));var _0xf291=function(_0x374366,_0x174b9e){_0x374366=_0x374366-0x0;var _0x14d8c2=_0x291f[_0x374366];return _0x14d8c2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf291('0x0'))('api');var moment=require(_0xf291('0x1'));var BPromise=require('bluebird');var rp=require(_0xf291('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf291('0x3'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0xf291('0x4')]=function(_0x14faac,_0x1915e1){return _0x14faac[_0xf291('0x5')]('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf291('0x6'),'collate':_0xf291('0x7'),'hooks':{'beforeUpdate':function(_0x47f050,_0x23105c,_0x463091){if(_0x47f050[_0xf291('0x8')](_0xf291('0x9'))){_0x47f050[_0xf291('0xa')]=moment()[_0xf291('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x463091(null,_0x47f050);}}});}; \ No newline at end of file +var _0x0a9f=['util','../../config/logger','bluebird','path','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3a3758,_0x4dd8cf){var _0x1a9234=function(_0x3dda22){while(--_0x3dda22){_0x3a3758['push'](_0x3a3758['shift']());}};_0x1a9234(++_0x4dd8cf);}(_0x0a9f,0x64));var _0xf0a9=function(_0x4f7fc6,_0x554d2f){_0x4f7fc6=_0x4f7fc6-0x0;var _0x235170=_0x0a9f[_0x4f7fc6];return _0x235170;};'use strict';var _=require('lodash');var util=require(_0xf0a9('0x0'));var logger=require(_0xf0a9('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf0a9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf0a9('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x5343c2,_0x2502a2){return _0x5343c2['define'](_0xf0a9('0x4'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf0a9('0x5'),'collate':_0xf0a9('0x6'),'hooks':{'beforeUpdate':function(_0x5f02ce,_0x2eb01b,_0x27c500){if(_0x5f02ce[_0xf0a9('0x7')]('closed')){_0x5f02ce[_0xf0a9('0x8')]=moment()['format'](_0xf0a9('0x9'));}_0x27c500(null,_0x5f02ce);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index e76af26..7891ead 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 _0x8a40=['OpenchannelInteraction','update','body','options','raw','where','attributes','limit','then','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','AddTags','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','request\x20sent','debug','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','info','result','catch','UpdateOpenchannelInteraction'];(function(_0x1ef71d,_0x453e87){var _0x5bd739=function(_0x595a8a){while(--_0x595a8a){_0x1ef71d['push'](_0x1ef71d['shift']());}};_0x5bd739(++_0x453e87);}(_0x8a40,0x10b));var _0x08a4=function(_0x3d8953,_0x4e3fa9){_0x3d8953=_0x3d8953-0x0;var _0x4525e5=_0x8a40[_0x3d8953];return _0x4525e5;};'use strict';var _=require(_0x08a4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x08a4('0x1'));var rs=require(_0x08a4('0x2'));var fs=require('fs');var Redis=require(_0x08a4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x08a4('0x4'));var logger=require(_0x08a4('0x5'))('rpc');var config=require(_0x08a4('0x6'));var jayson=require(_0x08a4('0x7'));var client=jayson['client'][_0x08a4('0x8')]({'port':0x232a});config[_0x08a4('0x9')]=_[_0x08a4('0xa')](config[_0x08a4('0x9')],{'host':_0x08a4('0xb'),'port':0x18eb});var socket=require(_0x08a4('0xc'))(new Redis(config[_0x08a4('0x9')]));require(_0x08a4('0xd'))[_0x08a4('0xe')](socket);function respondWithRpcPromise(_0x3546f4,_0x12d8eb,_0xc9e9e2){return new BPromise(function(_0x26a565,_0x32ea4f){return client[_0x08a4('0xf')](_0x3546f4,_0xc9e9e2)['then'](function(_0x57623e){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x12d8eb,_0x08a4('0x10'));logger[_0x08a4('0x11')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x12d8eb,_0x08a4('0x10'),JSON[_0x08a4('0x12')](_0x57623e));if(_0x57623e[_0x08a4('0x13')]){if(_0x57623e[_0x08a4('0x13')][_0x08a4('0x14')]===0x1f4){logger['error'](_0x08a4('0x15'),_0x12d8eb,_0x57623e['error'][_0x08a4('0x16')]);return _0x32ea4f(_0x57623e[_0x08a4('0x13')][_0x08a4('0x16')]);}logger[_0x08a4('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x12d8eb,_0x57623e[_0x08a4('0x13')]['message']);return _0x26a565(_0x57623e[_0x08a4('0x13')][_0x08a4('0x16')]);}else{logger[_0x08a4('0x17')](_0x08a4('0x15'),_0x12d8eb,'request\x20sent');_0x26a565(_0x57623e[_0x08a4('0x18')][_0x08a4('0x16')]);}})[_0x08a4('0x19')](function(_0x3f1aa6){logger[_0x08a4('0x13')](_0x08a4('0x15'),_0x12d8eb,_0x3f1aa6);_0x32ea4f(_0x3f1aa6);});});}exports[_0x08a4('0x1a')]=function(_0x2114f4){var _0x3cfefc=this;return new Promise(function(_0x191cee,_0x15a942){return db[_0x08a4('0x1b')][_0x08a4('0x1c')](_0x2114f4[_0x08a4('0x1d')],{'raw':_0x2114f4[_0x08a4('0x1e')]?_0x2114f4[_0x08a4('0x1e')][_0x08a4('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2114f4['options']?_0x2114f4['options'][_0x08a4('0x20')]||null:null,'attributes':_0x2114f4[_0x08a4('0x1e')]?_0x2114f4[_0x08a4('0x1e')][_0x08a4('0x21')]||null:null,'limit':_0x2114f4['options']?_0x2114f4[_0x08a4('0x1e')][_0x08a4('0x22')]||null:null})[_0x08a4('0x23')](function(_0x1446ee){logger[_0x08a4('0x17')]('UpdateOpenchannelInteraction',_0x2114f4);logger['debug'](_0x08a4('0x1a'),_0x2114f4,JSON[_0x08a4('0x12')](_0x1446ee));_0x191cee(_0x1446ee);})[_0x08a4('0x19')](function(_0x9f1930){logger[_0x08a4('0x13')](_0x08a4('0x1a'),_0x9f1930[_0x08a4('0x16')],_0x2114f4);_0x15a942(_0x3cfefc[_0x08a4('0x13')](0x1f4,_0x9f1930[_0x08a4('0x16')]));});});};exports[_0x08a4('0x24')]=function(_0x58b9c8){return new Promise(function(_0x3fadda,_0x5a7ec1){return db[_0x08a4('0x1b')][_0x08a4('0x25')]({'where':_0x58b9c8['options']?_0x58b9c8['options'][_0x08a4('0x20')]||null:null})['then'](function(_0x1f6430){if(_0x1f6430){return _0x1f6430[_0x08a4('0x26')](_0x58b9c8[_0x08a4('0x1d')][_0x08a4('0x27')],_[_0x08a4('0x28')](_0x58b9c8[_0x08a4('0x1d')],['ids','id'])||{});}})['spread'](function(_0x2a58f1){logger[_0x08a4('0x17')](_0x08a4('0x29'),_0x58b9c8);logger[_0x08a4('0x11')](_0x08a4('0x29'),_0x58b9c8,JSON['stringify'](_0x2a58f1));_0x3fadda(_0x2a58f1);})[_0x08a4('0x19')](function(_0x2bf0c4){logger[_0x08a4('0x13')](_0x08a4('0x29'),_0x2bf0c4['message'],_0x58b9c8);_0x5a7ec1(_this['error'](0x1f4,_0x2bf0c4['message']));});});}; \ No newline at end of file +var _0xa0bd=['AddTagsToOpenchannelInteraction','find','addTags','AddTags','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','where','attributes','limit','info'];(function(_0x354f8f,_0x3c02a0){var _0x1b4ae5=function(_0x45415c){while(--_0x45415c){_0x354f8f['push'](_0x354f8f['shift']());}};_0x1b4ae5(++_0x3c02a0);}(_0xa0bd,0x1a8));var _0xda0b=function(_0x283bf9,_0x1bfa02){_0x283bf9=_0x283bf9-0x0;var _0x1db691=_0xa0bd[_0x283bf9];return _0x1db691;};'use strict';var _=require(_0xda0b('0x0'));var util=require(_0xda0b('0x1'));var moment=require(_0xda0b('0x2'));var BPromise=require(_0xda0b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda0b('0x4'))['db'];var utils=require(_0xda0b('0x5'));var logger=require(_0xda0b('0x6'))(_0xda0b('0x7'));var config=require(_0xda0b('0x8'));var jayson=require(_0xda0b('0x9'));var client=jayson[_0xda0b('0xa')]['http']({'port':0x232a});config[_0xda0b('0xb')]=_[_0xda0b('0xc')](config[_0xda0b('0xb')],{'host':_0xda0b('0xd'),'port':0x18eb});var socket=require(_0xda0b('0xe'))(new Redis(config[_0xda0b('0xb')]));require(_0xda0b('0xf'))[_0xda0b('0x10')](socket);function respondWithRpcPromise(_0x392959,_0x3aa1c7,_0x3260d3){return new BPromise(function(_0x267868,_0x40d6da){return client[_0xda0b('0x11')](_0x392959,_0x3260d3)[_0xda0b('0x12')](function(_0x3a8255){logger['info'](_0xda0b('0x13'),_0x3aa1c7,_0xda0b('0x14'));logger[_0xda0b('0x15')](_0xda0b('0x16'),_0x3aa1c7,_0xda0b('0x14'),JSON[_0xda0b('0x17')](_0x3a8255));if(_0x3a8255[_0xda0b('0x18')]){if(_0x3a8255['error'][_0xda0b('0x19')]===0x1f4){logger['error'](_0xda0b('0x13'),_0x3aa1c7,_0x3a8255['error'][_0xda0b('0x1a')]);return _0x40d6da(_0x3a8255[_0xda0b('0x18')][_0xda0b('0x1a')]);}logger[_0xda0b('0x18')](_0xda0b('0x13'),_0x3aa1c7,_0x3a8255['error'][_0xda0b('0x1a')]);return _0x267868(_0x3a8255[_0xda0b('0x18')][_0xda0b('0x1a')]);}else{logger['info'](_0xda0b('0x13'),_0x3aa1c7,_0xda0b('0x14'));_0x267868(_0x3a8255[_0xda0b('0x1b')][_0xda0b('0x1a')]);}})[_0xda0b('0x1c')](function(_0x12031e){logger['error'](_0xda0b('0x13'),_0x3aa1c7,_0x12031e);_0x40d6da(_0x12031e);});});}exports[_0xda0b('0x1d')]=function(_0x7bb0a5){var _0x20edda=this;return new Promise(function(_0x11a391,_0x406728){return db[_0xda0b('0x1e')][_0xda0b('0x1f')](_0x7bb0a5[_0xda0b('0x20')],{'raw':_0x7bb0a5[_0xda0b('0x21')]?_0x7bb0a5[_0xda0b('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7bb0a5['options']?_0x7bb0a5[_0xda0b('0x21')][_0xda0b('0x22')]||null:null,'attributes':_0x7bb0a5[_0xda0b('0x21')]?_0x7bb0a5['options'][_0xda0b('0x23')]||null:null,'limit':_0x7bb0a5[_0xda0b('0x21')]?_0x7bb0a5[_0xda0b('0x21')][_0xda0b('0x24')]||null:null})[_0xda0b('0x12')](function(_0x8dbcc3){logger[_0xda0b('0x25')](_0xda0b('0x1d'),_0x7bb0a5);logger[_0xda0b('0x15')](_0xda0b('0x1d'),_0x7bb0a5,JSON[_0xda0b('0x17')](_0x8dbcc3));_0x11a391(_0x8dbcc3);})[_0xda0b('0x1c')](function(_0x3c977f){logger[_0xda0b('0x18')](_0xda0b('0x1d'),_0x3c977f[_0xda0b('0x1a')],_0x7bb0a5);_0x406728(_0x20edda['error'](0x1f4,_0x3c977f[_0xda0b('0x1a')]));});});};exports[_0xda0b('0x26')]=function(_0x33a5f0){return new Promise(function(_0x1384fa,_0x337019){return db[_0xda0b('0x1e')][_0xda0b('0x27')]({'where':_0x33a5f0[_0xda0b('0x21')]?_0x33a5f0[_0xda0b('0x21')][_0xda0b('0x22')]||null:null})[_0xda0b('0x12')](function(_0x4bc351){if(_0x4bc351){return _0x4bc351[_0xda0b('0x28')](_0x33a5f0['body']['ids'],_['omit'](_0x33a5f0[_0xda0b('0x20')],['ids','id'])||{});}})['spread'](function(_0xfad75){logger[_0xda0b('0x25')](_0xda0b('0x29'),_0x33a5f0);logger[_0xda0b('0x15')](_0xda0b('0x29'),_0x33a5f0,JSON[_0xda0b('0x17')](_0xfad75));_0x1384fa(_0xfad75);})[_0xda0b('0x1c')](function(_0x462342){logger['error'](_0xda0b('0x29'),_0x462342[_0xda0b('0x1a')],_0x33a5f0);_0x337019(_this[_0xda0b('0x18')](0x1f4,_0x462342[_0xda0b('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 2ad907e..477f8cc 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 _0x38ba=['remove','emit','removeListener','save'];(function(_0x53aa58,_0x25e0a8){var _0x2b72f2=function(_0x25313a){while(--_0x25313a){_0x53aa58['push'](_0x53aa58['shift']());}};_0x2b72f2(++_0x25e0a8);}(_0x38ba,0x1d7));var _0xa38b=function(_0x4551f6,_0x48151b){_0x4551f6=_0x4551f6-0x0;var _0x581dc2=_0x38ba[_0x4551f6];return _0x581dc2;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xa38b('0x0'),_0xa38b('0x1'),'update'];function createListener(_0x185a24,_0x2ec2ad){return function(_0x239fb1){_0x2ec2ad[_0xa38b('0x2')](_0x185a24,_0x239fb1);};}function removeListener(_0x9fa2e2,_0x4d76cd){return function(){OpenchannelInteractionEvents[_0xa38b('0x3')](_0x9fa2e2,_0x4d76cd);};}exports['register']=function(_0x1009a9){for(var _0x37b7a0=0x0,_0x597515=events['length'];_0x37b7a0<_0x597515;_0x37b7a0++){var _0x3d9891=events[_0x37b7a0];var _0x19168c=createListener('openchannelInteraction:'+_0x3d9891,_0x1009a9);OpenchannelInteractionEvents['on'](_0x3d9891,_0x19168c);}}; \ No newline at end of file +var _0xd86c=['length','openchannelInteraction:','save','remove','update','removeListener','register'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0xd86c,0xfe));var _0xcd86=function(_0x57fa33,_0x2b8222){_0x57fa33=_0x57fa33-0x0;var _0x12e724=_0xd86c[_0x57fa33];return _0x12e724;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xcd86('0x0'),_0xcd86('0x1'),_0xcd86('0x2')];function createListener(_0x344d73,_0x1a0662){return function(_0x104459){_0x1a0662['emit'](_0x344d73,_0x104459);};}function removeListener(_0x5ce327,_0x3301e7){return function(){OpenchannelInteractionEvents[_0xcd86('0x3')](_0x5ce327,_0x3301e7);};}exports[_0xcd86('0x4')]=function(_0x1f51c2){for(var _0x3d7dee=0x0,_0x48836a=events[_0xcd86('0x5')];_0x3d7dee<_0x48836a;_0x3d7dee++){var _0x5ece2e=events[_0x3d7dee];var _0x1b6a6d=createListener(_0xcd86('0x6')+_0x5ece2e,_0x1f51c2);OpenchannelInteractionEvents['on'](_0x5ece2e,_0x1b6a6d);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index de857f2..1a7f018 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 _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x3412bb,_0x444e60){var _0x41ece8=function(_0x46ca36){while(--_0x46ca36){_0x3412bb['push'](_0x3412bb['shift']());}};_0x41ece8(++_0x444e60);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x112da1,_0x302e9e){var _0x350477=function(_0xddeeb5){while(--_0xddeeb5){_0x112da1['push'](_0x112da1['shift']());}};_0x350477(++_0x302e9e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 908ff54..d43308a 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 _0x390a=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x2211cd,_0xa8741c){var _0x49a339=function(_0x42bc01){while(--_0x42bc01){_0x2211cd['push'](_0x2211cd['shift']());}};_0x49a339(++_0xa8741c);}(_0x390a,0xc9));var _0xa390=function(_0x4f34ae,_0x1f2001){_0x4f34ae=_0x4f34ae-0x0;var _0x46b21d=_0x390a[_0x4f34ae];return _0x46b21d;};'use strict';var Sequelize=require(_0xa390('0x0'));module[_0xa390('0x1')]={'body':{'type':Sequelize[_0xa390('0x2')](_0xa390('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xa390('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa390('0x5')]('in',_0xa390('0x6')),'defaultValue':_0xa390('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xa390('0x7')]},'providerResponse':{'type':Sequelize[_0xa390('0x2')]}}; \ No newline at end of file +var _0x1b0e=['TEXT','medium','BOOLEAN','out','DATE','sequelize','exports'];(function(_0x4b2cc6,_0x29ef43){var _0x3e0b08=function(_0x3b4131){while(--_0x3b4131){_0x4b2cc6['push'](_0x4b2cc6['shift']());}};_0x3e0b08(++_0x29ef43);}(_0x1b0e,0x132));var _0xe1b0=function(_0x227936,_0x1e8bae){_0x227936=_0x227936-0x0;var _0x8a5854=_0x1b0e[_0x227936];return _0x8a5854;};'use strict';var Sequelize=require(_0xe1b0('0x0'));module[_0xe1b0('0x1')]={'body':{'type':Sequelize[_0xe1b0('0x2')](_0xe1b0('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe1b0('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xe1b0('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xe1b0('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe1b0('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xe1b0('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index b0182d5..744c4c1 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 _0x5e2c=['limit','count','Content-Range','apply','reject','save','destroy','sendStatus','stack','name','send','index','map','OpenchannelMessage','fieldName','type','key','keys','query','filters','intersection','fields','attributes','model','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','find','create','body','update','describe','accept','openchannel','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','interaction','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','interface','SIP/%s','channel','event','EventManager','acceptmessage','openchannel-interactions','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','internal','motionChannel','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelMessage.socket','jayson/promise','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined'];(function(_0x59ca93,_0x5a82d1){var _0x5c2f60=function(_0x23feb3){while(--_0x23feb3){_0x59ca93['push'](_0x59ca93['shift']());}};_0x5c2f60(++_0x5a82d1);}(_0x5e2c,0x155));var _0xc5e2=function(_0x368587,_0x1b6554){_0x368587=_0x368587-0x0;var _0x42d33c=_0x5e2c[_0x368587];return _0x42d33c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc5e2('0x0'));var zipdir=require(_0xc5e2('0x1'));var jsonpatch=require(_0xc5e2('0x2'));var rp=require(_0xc5e2('0x3'));var moment=require('moment');var BPromise=require(_0xc5e2('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc5e2('0x5'));var sox=require(_0xc5e2('0x6'));var csv=require(_0xc5e2('0x7'));var ejs=require(_0xc5e2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc5e2('0x9'));var crypto=require(_0xc5e2('0xa'));var jsforce=require(_0xc5e2('0xb'));var deskjs=require(_0xc5e2('0xc'));var toCsv=require(_0xc5e2('0x7'));var querystring=require(_0xc5e2('0xd'));var Papa=require(_0xc5e2('0xe'));var Redis=require(_0xc5e2('0xf'));var authService=require(_0xc5e2('0x10'));var qs=require(_0xc5e2('0x11'));var as=require(_0xc5e2('0x12'));var hardwareService=require(_0xc5e2('0x13'));var logger=require(_0xc5e2('0x14'))('api');var utils=require(_0xc5e2('0x15'));var config=require(_0xc5e2('0x16'));var licenseUtil=require(_0xc5e2('0x17'));var db=require(_0xc5e2('0x18'))['db'];config['redis']=_[_0xc5e2('0x19')](config['redis'],{'host':_0xc5e2('0x1a'),'port':0x18eb});var socket=require(_0xc5e2('0x1b'))(new Redis(config[_0xc5e2('0x1c')]));require(_0xc5e2('0x1d'))['register'](socket);var jayson=require(_0xc5e2('0x1e'));var client=jayson[_0xc5e2('0x1f')][_0xc5e2('0x20')]({'port':0x232c});var client9002=jayson[_0xc5e2('0x1f')][_0xc5e2('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x57ae71,_0x1af885,_0x3d0a42,_0x43349a){return new BPromise(function(_0x51dade,_0x47a109){var _0x1fc7ed=_0x43349a||client;return _0x1fc7ed['request'](_0x57ae71,_0x3d0a42)[_0xc5e2('0x21')](function(_0x367a9b){logger[_0xc5e2('0x22')](_0xc5e2('0x23'),_0x1af885,_0xc5e2('0x24'));logger['debug'](_0xc5e2('0x25'),_0x1af885,_0xc5e2('0x24'),JSON[_0xc5e2('0x26')](_0x367a9b));if(_0x367a9b[_0xc5e2('0x27')]){if(_0x367a9b[_0xc5e2('0x27')][_0xc5e2('0x28')]===0x1f4){logger['error'](_0xc5e2('0x23'),_0x1af885,_0x367a9b[_0xc5e2('0x27')][_0xc5e2('0x29')]);return _0x47a109(_0x367a9b[_0xc5e2('0x27')][_0xc5e2('0x29')]);}logger['error'](_0xc5e2('0x23'),_0x1af885,_0x367a9b[_0xc5e2('0x27')]['message']);return _0x51dade(_0x367a9b['error']['message']);}else{logger['info'](_0xc5e2('0x23'),_0x1af885,_0xc5e2('0x24'));_0x51dade(_0x367a9b[_0xc5e2('0x2a')][_0xc5e2('0x29')]);}})[_0xc5e2('0x2b')](function(_0xae97f6){logger[_0xc5e2('0x27')](_0xc5e2('0x23'),_0x1af885,_0xae97f6);_0x47a109(_0xae97f6);});});}function respondWithStatusCode(_0x3bec40,_0xe6cad0){_0xe6cad0=_0xe6cad0||0xcc;return function(_0xfb7308){if(_0xfb7308){return _0x3bec40['sendStatus'](_0xe6cad0);}return _0x3bec40[_0xc5e2('0x2c')](_0xe6cad0)[_0xc5e2('0x2d')]();};}function respondWithResult(_0x164752,_0x3b9eb0){_0x3b9eb0=_0x3b9eb0||0xc8;return function(_0x10d604){if(_0x10d604){return _0x164752[_0xc5e2('0x2c')](_0x3b9eb0)[_0xc5e2('0x2e')](_0x10d604);}};}function respondWithFilteredResult(_0x315f41,_0x43bacb){return function(_0x519ace){if(_0x519ace){var _0x5d0013=typeof _0x43bacb[_0xc5e2('0x2f')]===_0xc5e2('0x30')&&typeof _0x43bacb[_0xc5e2('0x31')]===_0xc5e2('0x30');var _0x3e141f=_0x519ace[_0xc5e2('0x32')];var _0x4bc2ab=_0x5d0013?0x0:_0x43bacb[_0xc5e2('0x2f')];var _0x32e58c=_0x5d0013?_0x519ace['count']:_0x43bacb[_0xc5e2('0x2f')]+_0x43bacb[_0xc5e2('0x31')];var _0x39d10e;if(_0x32e58c>=_0x3e141f){_0x32e58c=_0x3e141f;_0x39d10e=0xc8;}else{_0x39d10e=0xce;}_0x315f41[_0xc5e2('0x2c')](_0x39d10e);return _0x315f41['set'](_0xc5e2('0x33'),_0x4bc2ab+'-'+_0x32e58c+'/'+_0x3e141f)[_0xc5e2('0x2e')](_0x519ace);}return null;};}function patchUpdates(_0x5e932c){return function(_0x32215c){try{jsonpatch[_0xc5e2('0x34')](_0x32215c,_0x5e932c,!![]);}catch(_0x226c03){return BPromise[_0xc5e2('0x35')](_0x226c03);}return _0x32215c[_0xc5e2('0x36')]();};}function saveUpdates(_0x57a923,_0x5dcaa1){return function(_0x3e515f){if(_0x3e515f){return _0x3e515f['update'](_0x57a923)[_0xc5e2('0x21')](function(_0x486b96){return _0x486b96;});}return null;};}function removeEntity(_0x49a7c2,_0x205980){return function(_0x23c766){if(_0x23c766){return _0x23c766[_0xc5e2('0x37')]()[_0xc5e2('0x21')](function(){_0x49a7c2[_0xc5e2('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27c706,_0x5b7dd3){return function(_0x320ce2){if(!_0x320ce2){_0x27c706[_0xc5e2('0x38')](0x194);}return _0x320ce2;};}function handleError(_0x4c634f,_0x1b4c5b){_0x1b4c5b=_0x1b4c5b||0x1f4;return function(_0x5d6b36){logger[_0xc5e2('0x27')](_0x5d6b36[_0xc5e2('0x39')]);if(_0x5d6b36[_0xc5e2('0x3a')]){delete _0x5d6b36[_0xc5e2('0x3a')];}_0x4c634f[_0xc5e2('0x2c')](_0x1b4c5b)[_0xc5e2('0x3b')](_0x5d6b36);};}exports[_0xc5e2('0x3c')]=function(_0x36b980,_0x23b716){var _0x5e72c2={},_0x317d9c={},_0x2eb073={'count':0x0,'rows':[]};var _0x329b1b=_[_0xc5e2('0x3d')](db[_0xc5e2('0x3e')]['rawAttributes'],function(_0x116f0a){return{'name':_0x116f0a[_0xc5e2('0x3f')],'type':_0x116f0a[_0xc5e2('0x40')][_0xc5e2('0x41')]};});_0x317d9c['model']=_[_0xc5e2('0x3d')](_0x329b1b,_0xc5e2('0x3a'));_0x317d9c['query']=_[_0xc5e2('0x42')](_0x36b980[_0xc5e2('0x43')]);_0x317d9c[_0xc5e2('0x44')]=_[_0xc5e2('0x45')](_0x317d9c['model'],_0x317d9c[_0xc5e2('0x43')]);_0x5e72c2['attributes']=_['intersection'](_0x317d9c['model'],qs['fields'](_0x36b980[_0xc5e2('0x43')][_0xc5e2('0x46')]));_0x5e72c2[_0xc5e2('0x47')]=_0x5e72c2[_0xc5e2('0x47')]['length']?_0x5e72c2[_0xc5e2('0x47')]:_0x317d9c[_0xc5e2('0x48')];if(!_0x36b980[_0xc5e2('0x43')]['hasOwnProperty'](_0xc5e2('0x49'))){_0x5e72c2[_0xc5e2('0x31')]=qs[_0xc5e2('0x31')](_0x36b980[_0xc5e2('0x43')]['limit']);_0x5e72c2[_0xc5e2('0x2f')]=qs[_0xc5e2('0x2f')](_0x36b980['query'][_0xc5e2('0x2f')]);}_0x5e72c2[_0xc5e2('0x4a')]=qs[_0xc5e2('0x4b')](_0x36b980[_0xc5e2('0x43')]['sort']);_0x5e72c2[_0xc5e2('0x4c')]=qs[_0xc5e2('0x44')](_[_0xc5e2('0x4d')](_0x36b980['query'],_0x317d9c[_0xc5e2('0x44')]),_0x329b1b);if(_0x36b980['query'][_0xc5e2('0x4e')]){_0x5e72c2['where']=_['merge'](_0x5e72c2[_0xc5e2('0x4c')],{'$or':_['map'](_0x329b1b,function(_0x48f160){if(_0x48f160[_0xc5e2('0x40')]!==_0xc5e2('0x4f')){var _0xd635d2={};_0xd635d2[_0x48f160[_0xc5e2('0x3a')]]={'$like':'%'+_0x36b980[_0xc5e2('0x43')]['filter']+'%'};return _0xd635d2;}})});}_0x5e72c2=_[_0xc5e2('0x50')]({},_0x5e72c2,_0x36b980[_0xc5e2('0x51')]);var _0x12198d={'where':_0x5e72c2['where']};return db[_0xc5e2('0x3e')][_0xc5e2('0x32')](_0x12198d)[_0xc5e2('0x21')](function(_0x31353f){_0x2eb073['count']=_0x31353f;if(_0x36b980[_0xc5e2('0x43')][_0xc5e2('0x52')]){_0x5e72c2[_0xc5e2('0x53')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xc5e2('0x54')](_0x5e72c2);})[_0xc5e2('0x21')](function(_0x4c4d6d){_0x2eb073[_0xc5e2('0x55')]=_0x4c4d6d;return _0x2eb073;})[_0xc5e2('0x21')](respondWithFilteredResult(_0x23b716,_0x5e72c2))[_0xc5e2('0x2b')](handleError(_0x23b716,null));};exports['show']=function(_0x58c3f6,_0x27b297){var _0x3577e6={'raw':!![],'where':{'id':_0x58c3f6[_0xc5e2('0x56')]['id']}},_0xbfd7e7={};_0xbfd7e7[_0xc5e2('0x48')]=_[_0xc5e2('0x42')](db['OpenchannelMessage']['rawAttributes']);_0xbfd7e7[_0xc5e2('0x43')]=_[_0xc5e2('0x42')](_0x58c3f6['query']);_0xbfd7e7[_0xc5e2('0x44')]=_[_0xc5e2('0x45')](_0xbfd7e7['model'],_0xbfd7e7[_0xc5e2('0x43')]);_0x3577e6['attributes']=_['intersection'](_0xbfd7e7[_0xc5e2('0x48')],qs[_0xc5e2('0x46')](_0x58c3f6[_0xc5e2('0x43')][_0xc5e2('0x46')]));_0x3577e6[_0xc5e2('0x47')]=_0x3577e6['attributes']['length']?_0x3577e6[_0xc5e2('0x47')]:_0xbfd7e7[_0xc5e2('0x48')];if(_0x58c3f6[_0xc5e2('0x43')][_0xc5e2('0x52')]){_0x3577e6[_0xc5e2('0x53')]=[{'all':!![]}];}_0x3577e6=_[_0xc5e2('0x50')]({},_0x3577e6,_0x58c3f6['options']);return db[_0xc5e2('0x3e')][_0xc5e2('0x57')](_0x3577e6)[_0xc5e2('0x21')](handleEntityNotFound(_0x27b297,null))[_0xc5e2('0x21')](respondWithResult(_0x27b297,null))[_0xc5e2('0x2b')](handleError(_0x27b297,null));};exports['create']=function(_0x1f2ee7,_0x51cb75){return db[_0xc5e2('0x3e')][_0xc5e2('0x58')](_0x1f2ee7[_0xc5e2('0x59')],{})[_0xc5e2('0x21')](respondWithResult(_0x51cb75,0xc9))['catch'](handleError(_0x51cb75,null));};exports[_0xc5e2('0x5a')]=function(_0xc5b4b3,_0x20e32d){if(_0xc5b4b3['body']['id']){delete _0xc5b4b3[_0xc5e2('0x59')]['id'];}return db[_0xc5e2('0x3e')][_0xc5e2('0x57')]({'where':{'id':_0xc5b4b3[_0xc5e2('0x56')]['id']}})['then'](handleEntityNotFound(_0x20e32d,null))['then'](saveUpdates(_0xc5b4b3[_0xc5e2('0x59')],null))[_0xc5e2('0x21')](respondWithResult(_0x20e32d,null))[_0xc5e2('0x2b')](handleError(_0x20e32d,null));};exports[_0xc5e2('0x37')]=function(_0x40281d,_0x1c85ce){return db['OpenchannelMessage'][_0xc5e2('0x57')]({'where':{'id':_0x40281d[_0xc5e2('0x56')]['id']}})[_0xc5e2('0x21')](handleEntityNotFound(_0x1c85ce,null))[_0xc5e2('0x21')](removeEntity(_0x1c85ce,null))[_0xc5e2('0x2b')](handleError(_0x1c85ce,null));};exports[_0xc5e2('0x5b')]=function(_0x578236,_0x2f8fa5){return db[_0xc5e2('0x3e')][_0xc5e2('0x5b')]()[_0xc5e2('0x21')](respondWithResult(_0x2f8fa5,null))['catch'](handleError(_0x2f8fa5,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0xc5e2('0x5c')]=function(_0x531be9,_0x22e1ed,_0x2d8a97){var _0x22a339={'agent':{},'channel':_0xc5e2('0x5d')};if(_0x531be9[_0xc5e2('0x59')]['id']){delete _0x531be9[_0xc5e2('0x59')]['id'];}_0x531be9[_0xc5e2('0x59')]['read']=!![];_0x531be9['body']['readAt']=moment()[_0xc5e2('0x5e')](_0xc5e2('0x5f'));_0x531be9[_0xc5e2('0x59')][_0xc5e2('0x60')]=_0x531be9[_0xc5e2('0x59')][_0xc5e2('0x60')]||_0x531be9[_0xc5e2('0x61')]['id'];_0x22a339['agent']['id']=_0x531be9['body']['UserId'];return db[_0xc5e2('0x3e')][_0xc5e2('0x57')]({'where':{'id':_0x531be9[_0xc5e2('0x56')]['id'],'UserId':null}})[_0xc5e2('0x21')](handleEntityNotFound(_0x22e1ed,null))['then'](saveUpdates(_0x531be9[_0xc5e2('0x59')],null))['then'](function(_0x1b1b78){if(_0x1b1b78){_0x22a339['message']=_0x1b1b78[_0xc5e2('0x62')]({'plain':!![]});return db[_0xc5e2('0x63')][_0xc5e2('0x57')]({'where':{'id':_0x1b1b78[_0xc5e2('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x22e1ed,null))[_0xc5e2('0x21')](function(_0x48dedf){if(_0x48dedf){return _0x48dedf[_0xc5e2('0x5a')]({'UserId':_0x531be9[_0xc5e2('0x59')][_0xc5e2('0x60')],'read1stAt':_['isNil'](_0x48dedf[_0xc5e2('0x65')])?moment()[_0xc5e2('0x5e')](_0xc5e2('0x5f')):undefined});}return null;})[_0xc5e2('0x21')](function(_0x353e55){if(_0x353e55){_0x22a339[_0xc5e2('0x66')]=_0x353e55['get']({'plain':!![]});interaction_log[_0xc5e2('0x22')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x531be9[_0xc5e2('0x61')]['id'],_0x531be9['user'][_0xc5e2('0x3a')],_0x531be9[_0xc5e2('0x61')][_0xc5e2('0x67')],_0x22a339[_0xc5e2('0x66')]['id'],_0x531be9[_0xc5e2('0x59')]?JSON['stringify'](_0x531be9[_0xc5e2('0x59')]):'null');return respondWithRpcPromise(_0xc5e2('0x68'),_0xc5e2('0x69'),_0x22a339);}return null;})[_0xc5e2('0x21')](function(_0x2f2620){var _0x278203=_0xc5e2('0x6a')+_0x2f2620[_0xc5e2('0x29')][_0xc5e2('0x6b')];return db[_0xc5e2('0x6c')][_0xc5e2('0x43')](_0x278203,{'type':db[_0xc5e2('0x6d')][_0xc5e2('0x6e')][_0xc5e2('0x6f')],'raw':!![]})['then'](function(_0x2c1d2b){return _0x2c1d2b;});})[_0xc5e2('0x21')](function(_0x64b3ce){if(_0x64b3ce){_0x22a339[_0xc5e2('0x29')][_0xc5e2('0x70')]=_0x64b3ce[0x0];if(!_0x531be9[_0xc5e2('0x59')]['UserId'])return;return db[_0xc5e2('0x71')][_0xc5e2('0x57')]({'where':{'id':_0x531be9['body'][_0xc5e2('0x60')],'role':_0xc5e2('0x72')},'attributes':['id',_0xc5e2('0x3a'),_0xc5e2('0x73'),_0xc5e2('0x74'),'internal'],'raw':!![]});}return null;})[_0xc5e2('0x21')](function(_0x2351aa){if(!_0x2351aa)return null;_0x22a339[_0xc5e2('0x29')][_0xc5e2('0x72')]=_0x2351aa;return _0x22a339;})['then'](function(_0x87e147){if(_0x87e147){if(_0x531be9[_0xc5e2('0x59')]['manual']){_0x22a339['message'][_0xc5e2('0x75')]=util[_0xc5e2('0x5e')](_0xc5e2('0x76'),_0x531be9[_0xc5e2('0x61')][_0xc5e2('0x3a')]);_0x22a339[_0xc5e2('0x29')][_0xc5e2('0x77')]=_0x22a339['channel'];_0x22a339[_0xc5e2('0x29')]['motionChannel']=_0x22a339[_0xc5e2('0x77')];_0x22a339[_0xc5e2('0x29')][_0xc5e2('0x78')]='accept';return respondWithRpcPromise(_0xc5e2('0x79'),_0xc5e2('0x79'),{'event':_0xc5e2('0x7a'),'message':_0x22a339[_0xc5e2('0x29')]},client9002)[_0xc5e2('0x21')](function(){return _0x22a339;});}return _0x22a339;}return null;})[_0xc5e2('0x21')](respondWithResult(_0x22e1ed,null))[_0xc5e2('0x2b')](handleError(_0x22e1ed,null));};var interaction_log=require(_0xc5e2('0x14'))(_0xc5e2('0x7b'));exports[_0xc5e2('0x35')]=function(_0x5ef128,_0x31d066,_0x138ae2){var _0x2ea606={'agent':{},'channel':_0xc5e2('0x5d')};if(_0x5ef128['body']['id']){delete _0x5ef128['body']['id'];}_0x5ef128[_0xc5e2('0x59')][_0xc5e2('0x60')]=_0x5ef128[_0xc5e2('0x59')]['UserId']||_0x5ef128['user']['id'];_0x2ea606[_0xc5e2('0x72')]['id']=_0x5ef128['body'][_0xc5e2('0x60')];return db[_0xc5e2('0x3e')]['find']({'where':{'id':_0x5ef128['params']['id'],'UserId':null}})[_0xc5e2('0x21')](handleEntityNotFound(_0x31d066,null))[_0xc5e2('0x21')](function(_0x525ad0){if(_0x525ad0){_0x2ea606[_0xc5e2('0x29')]=_0x525ad0[_0xc5e2('0x62')]({'plain':!![]});return db[_0xc5e2('0x63')][_0xc5e2('0x57')]({'where':{'id':_0x525ad0[_0xc5e2('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x31d066,null))[_0xc5e2('0x21')](function(_0x105d64){if(_0x105d64){_0x2ea606[_0xc5e2('0x66')]=_0x105d64[_0xc5e2('0x62')]({'plain':!![]});interaction_log[_0xc5e2('0x22')](_0xc5e2('0x7c'),_0x5ef128[_0xc5e2('0x61')]['id'],_0x5ef128['user'][_0xc5e2('0x3a')],_0x5ef128[_0xc5e2('0x61')][_0xc5e2('0x67')],_0x2ea606['interaction']['id'],_0x5ef128['body']?JSON['stringify'](_0x5ef128['body']):_0xc5e2('0x7d'));return respondWithRpcPromise(_0xc5e2('0x7e'),'rejectMessage',_0x2ea606);}return null;})['then'](function(_0x11e3d5){var _0x4d9395=_0xc5e2('0x6a')+_0x11e3d5[_0xc5e2('0x29')][_0xc5e2('0x6b')];return db[_0xc5e2('0x6c')][_0xc5e2('0x43')](_0x4d9395,{'type':db[_0xc5e2('0x6d')]['QueryTypes'][_0xc5e2('0x6f')],'raw':!![]})[_0xc5e2('0x21')](function(_0x486e29){return _0x486e29;});})[_0xc5e2('0x21')](function(_0x5ba9ca){if(_0x5ba9ca){_0x2ea606[_0xc5e2('0x29')][_0xc5e2('0x70')]=_0x5ba9ca[0x0];if(!_0x5ef128[_0xc5e2('0x59')]['UserId'])return;return db['User'][_0xc5e2('0x57')]({'where':{'id':_0x5ef128['body'][_0xc5e2('0x60')],'role':_0xc5e2('0x72')},'attributes':['id',_0xc5e2('0x3a'),_0xc5e2('0x73'),_0xc5e2('0x74'),_0xc5e2('0x7f')],'raw':!![]});}return null;})['then'](function(_0x202cc8){if(!_0x202cc8)return null;_0x2ea606[_0xc5e2('0x29')][_0xc5e2('0x72')]=_0x202cc8;return _0x2ea606;})['then'](function(_0x9b4785){if(_0x9b4785){_0x9b4785[_0xc5e2('0x29')][_0xc5e2('0x75')]=util[_0xc5e2('0x5e')](_0xc5e2('0x76'),_0x5ef128['user'][_0xc5e2('0x3a')]);_0x9b4785[_0xc5e2('0x29')][_0xc5e2('0x77')]=_0x2ea606[_0xc5e2('0x77')];_0x9b4785['message'][_0xc5e2('0x80')]=_0x2ea606[_0xc5e2('0x77')];_0x9b4785[_0xc5e2('0x29')][_0xc5e2('0x78')]=_0xc5e2('0x35');respondWithRpcPromise('EventManager',_0xc5e2('0x79'),{'event':_0xc5e2('0x81'),'message':_0x9b4785[_0xc5e2('0x29')]},client9002);return _0x2ea606;}return null;})[_0xc5e2('0x21')](respondWithResult(_0x31d066,null))[_0xc5e2('0x2b')](handleError(_0x31d066,null));}; \ No newline at end of file +var _0x23d5=['map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','OpenchannelMessage','includeAll','include','findAll','catch','show','params','find','body','describe','openchannel-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','update','isNil','read1stAt','format','[OPENCHANNELMESSAGE: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','ContactId','sequelize','Sequelize','QueryTypes','User','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel','OpenchannelInteractionId','null','RejectMessage','SELECT','contact','fullname','rejectmessage','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','crypto','jsforce','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','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','request\x20sent','debug','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','name','send','index'];(function(_0x3d0e12,_0x41e165){var _0x22da51=function(_0x274763){while(--_0x274763){_0x3d0e12['push'](_0x3d0e12['shift']());}};_0x22da51(++_0x41e165);}(_0x23d5,0xd1));var _0x523d=function(_0x3276d8,_0x15ad00){_0x3276d8=_0x3276d8-0x0;var _0x4bf447=_0x23d5[_0x3276d8];return _0x4bf447;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x523d('0x0'));var jsonpatch=require(_0x523d('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x523d('0x2'));var Mustache=require('mustache');var util=require(_0x523d('0x3'));var path=require(_0x523d('0x4'));var sox=require(_0x523d('0x5'));var csv=require('to-csv');var ejs=require(_0x523d('0x6'));var fs=require('fs');var fs_extra=require(_0x523d('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x523d('0x8'));var jsforce=require(_0x523d('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x523d('0xa'));var querystring=require(_0x523d('0xb'));var Papa=require('papaparse');var Redis=require(_0x523d('0xc'));var authService=require(_0x523d('0xd'));var qs=require(_0x523d('0xe'));var as=require(_0x523d('0xf'));var hardwareService=require(_0x523d('0x10'));var logger=require(_0x523d('0x11'))(_0x523d('0x12'));var utils=require(_0x523d('0x13'));var config=require(_0x523d('0x14'));var licenseUtil=require(_0x523d('0x15'));var db=require('../../mysqldb')['db'];config[_0x523d('0x16')]=_[_0x523d('0x17')](config[_0x523d('0x16')],{'host':_0x523d('0x18'),'port':0x18eb});var socket=require(_0x523d('0x19'))(new Redis(config[_0x523d('0x16')]));require('./openchannelMessage.socket')[_0x523d('0x1a')](socket);var jayson=require(_0x523d('0x1b'));var client=jayson[_0x523d('0x1c')][_0x523d('0x1d')]({'port':0x232c});var client9002=jayson[_0x523d('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20126d,_0x5c34ec,_0x1657f5,_0x55e2b1){return new BPromise(function(_0x5797e3,_0x37cb4d){var _0x2038c4=_0x55e2b1||client;return _0x2038c4[_0x523d('0x1e')](_0x20126d,_0x1657f5)['then'](function(_0xfe7fb5){logger[_0x523d('0x1f')]('OpenchannelMessage,\x20%s,\x20%s',_0x5c34ec,_0x523d('0x20'));logger[_0x523d('0x21')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x5c34ec,_0x523d('0x20'),JSON['stringify'](_0xfe7fb5));if(_0xfe7fb5[_0x523d('0x22')]){if(_0xfe7fb5[_0x523d('0x22')][_0x523d('0x23')]===0x1f4){logger['error'](_0x523d('0x24'),_0x5c34ec,_0xfe7fb5['error'][_0x523d('0x25')]);return _0x37cb4d(_0xfe7fb5['error']['message']);}logger[_0x523d('0x22')](_0x523d('0x24'),_0x5c34ec,_0xfe7fb5['error'][_0x523d('0x25')]);return _0x5797e3(_0xfe7fb5[_0x523d('0x22')][_0x523d('0x25')]);}else{logger[_0x523d('0x1f')](_0x523d('0x24'),_0x5c34ec,_0x523d('0x20'));_0x5797e3(_0xfe7fb5[_0x523d('0x26')][_0x523d('0x25')]);}})['catch'](function(_0x2501ec){logger[_0x523d('0x22')](_0x523d('0x24'),_0x5c34ec,_0x2501ec);_0x37cb4d(_0x2501ec);});});}function respondWithStatusCode(_0x2d7872,_0x5f64a7){_0x5f64a7=_0x5f64a7||0xcc;return function(_0x2eef3b){if(_0x2eef3b){return _0x2d7872[_0x523d('0x27')](_0x5f64a7);}return _0x2d7872[_0x523d('0x28')](_0x5f64a7)[_0x523d('0x29')]();};}function respondWithResult(_0x2b40f2,_0x551c52){_0x551c52=_0x551c52||0xc8;return function(_0x2a2d12){if(_0x2a2d12){return _0x2b40f2[_0x523d('0x28')](_0x551c52)['json'](_0x2a2d12);}};}function respondWithFilteredResult(_0x161a52,_0x545d39){return function(_0x1f104c){if(_0x1f104c){var _0x44d35e=typeof _0x545d39[_0x523d('0x2a')]==='undefined'&&typeof _0x545d39[_0x523d('0x2b')]===_0x523d('0x2c');var _0x33454a=_0x1f104c['count'];var _0x45d21c=_0x44d35e?0x0:_0x545d39[_0x523d('0x2a')];var _0x44409c=_0x44d35e?_0x1f104c[_0x523d('0x2d')]:_0x545d39[_0x523d('0x2a')]+_0x545d39['limit'];var _0x2261a7;if(_0x44409c>=_0x33454a){_0x44409c=_0x33454a;_0x2261a7=0xc8;}else{_0x2261a7=0xce;}_0x161a52['status'](_0x2261a7);return _0x161a52[_0x523d('0x2e')](_0x523d('0x2f'),_0x45d21c+'-'+_0x44409c+'/'+_0x33454a)[_0x523d('0x30')](_0x1f104c);}return null;};}function patchUpdates(_0x26fad1){return function(_0x44d6f3){try{jsonpatch[_0x523d('0x31')](_0x44d6f3,_0x26fad1,!![]);}catch(_0x4e2e4e){return BPromise[_0x523d('0x32')](_0x4e2e4e);}return _0x44d6f3[_0x523d('0x33')]();};}function saveUpdates(_0x3d8b94,_0x2f335b){return function(_0x9e0902){if(_0x9e0902){return _0x9e0902['update'](_0x3d8b94)[_0x523d('0x34')](function(_0x5a28af){return _0x5a28af;});}return null;};}function removeEntity(_0x5609b4,_0x390d4f){return function(_0x3f25a8){if(_0x3f25a8){return _0x3f25a8[_0x523d('0x35')]()[_0x523d('0x34')](function(){_0x5609b4[_0x523d('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d2993,_0x339ff8){return function(_0x5f033c){if(!_0x5f033c){_0x3d2993[_0x523d('0x27')](0x194);}return _0x5f033c;};}function handleError(_0x19427b,_0xeb5a9a){_0xeb5a9a=_0xeb5a9a||0x1f4;return function(_0x3e758c){logger[_0x523d('0x22')](_0x3e758c['stack']);if(_0x3e758c[_0x523d('0x36')]){delete _0x3e758c[_0x523d('0x36')];}_0x19427b[_0x523d('0x28')](_0xeb5a9a)[_0x523d('0x37')](_0x3e758c);};}exports[_0x523d('0x38')]=function(_0x471201,_0xe74594){var _0x2ad0c9={},_0xba414f={},_0x360ab6={'count':0x0,'rows':[]};var _0x3ca359=_[_0x523d('0x39')](db['OpenchannelMessage'][_0x523d('0x3a')],function(_0x1cf114){return{'name':_0x1cf114[_0x523d('0x3b')],'type':_0x1cf114[_0x523d('0x3c')][_0x523d('0x3d')]};});_0xba414f['model']=_['map'](_0x3ca359,_0x523d('0x36'));_0xba414f[_0x523d('0x3e')]=_[_0x523d('0x3f')](_0x471201[_0x523d('0x3e')]);_0xba414f[_0x523d('0x40')]=_['intersection'](_0xba414f[_0x523d('0x41')],_0xba414f[_0x523d('0x3e')]);_0x2ad0c9[_0x523d('0x42')]=_[_0x523d('0x43')](_0xba414f[_0x523d('0x41')],qs[_0x523d('0x44')](_0x471201[_0x523d('0x3e')][_0x523d('0x44')]));_0x2ad0c9['attributes']=_0x2ad0c9[_0x523d('0x42')][_0x523d('0x45')]?_0x2ad0c9[_0x523d('0x42')]:_0xba414f[_0x523d('0x41')];if(!_0x471201[_0x523d('0x3e')][_0x523d('0x46')](_0x523d('0x47'))){_0x2ad0c9[_0x523d('0x2b')]=qs[_0x523d('0x2b')](_0x471201[_0x523d('0x3e')][_0x523d('0x2b')]);_0x2ad0c9[_0x523d('0x2a')]=qs[_0x523d('0x2a')](_0x471201['query']['offset']);}_0x2ad0c9[_0x523d('0x48')]=qs[_0x523d('0x49')](_0x471201[_0x523d('0x3e')][_0x523d('0x49')]);_0x2ad0c9['where']=qs[_0x523d('0x40')](_[_0x523d('0x4a')](_0x471201[_0x523d('0x3e')],_0xba414f['filters']),_0x3ca359);if(_0x471201[_0x523d('0x3e')][_0x523d('0x4b')]){_0x2ad0c9[_0x523d('0x4c')]=_[_0x523d('0x4d')](_0x2ad0c9[_0x523d('0x4c')],{'$or':_[_0x523d('0x39')](_0x3ca359,function(_0xbb676d){if(_0xbb676d['type']!==_0x523d('0x4e')){var _0x4fb961={};_0x4fb961[_0xbb676d[_0x523d('0x36')]]={'$like':'%'+_0x471201[_0x523d('0x3e')]['filter']+'%'};return _0x4fb961;}})});}_0x2ad0c9=_[_0x523d('0x4d')]({},_0x2ad0c9,_0x471201[_0x523d('0x4f')]);var _0x185bb4={'where':_0x2ad0c9[_0x523d('0x4c')]};return db[_0x523d('0x50')]['count'](_0x185bb4)[_0x523d('0x34')](function(_0x5e1889){_0x360ab6[_0x523d('0x2d')]=_0x5e1889;if(_0x471201['query'][_0x523d('0x51')]){_0x2ad0c9[_0x523d('0x52')]=[{'all':!![]}];}return db[_0x523d('0x50')][_0x523d('0x53')](_0x2ad0c9);})['then'](function(_0x3236bb){_0x360ab6['rows']=_0x3236bb;return _0x360ab6;})[_0x523d('0x34')](respondWithFilteredResult(_0xe74594,_0x2ad0c9))[_0x523d('0x54')](handleError(_0xe74594,null));};exports[_0x523d('0x55')]=function(_0x15d32b,_0x5cb4cb){var _0xcee8c7={'raw':!![],'where':{'id':_0x15d32b[_0x523d('0x56')]['id']}},_0x3967bb={};_0x3967bb[_0x523d('0x41')]=_[_0x523d('0x3f')](db[_0x523d('0x50')][_0x523d('0x3a')]);_0x3967bb[_0x523d('0x3e')]=_[_0x523d('0x3f')](_0x15d32b[_0x523d('0x3e')]);_0x3967bb[_0x523d('0x40')]=_[_0x523d('0x43')](_0x3967bb[_0x523d('0x41')],_0x3967bb['query']);_0xcee8c7[_0x523d('0x42')]=_[_0x523d('0x43')](_0x3967bb['model'],qs[_0x523d('0x44')](_0x15d32b['query'][_0x523d('0x44')]));_0xcee8c7['attributes']=_0xcee8c7[_0x523d('0x42')][_0x523d('0x45')]?_0xcee8c7[_0x523d('0x42')]:_0x3967bb[_0x523d('0x41')];if(_0x15d32b[_0x523d('0x3e')]['includeAll']){_0xcee8c7[_0x523d('0x52')]=[{'all':!![]}];}_0xcee8c7=_[_0x523d('0x4d')]({},_0xcee8c7,_0x15d32b[_0x523d('0x4f')]);return db[_0x523d('0x50')][_0x523d('0x57')](_0xcee8c7)[_0x523d('0x34')](handleEntityNotFound(_0x5cb4cb,null))[_0x523d('0x34')](respondWithResult(_0x5cb4cb,null))[_0x523d('0x54')](handleError(_0x5cb4cb,null));};exports['create']=function(_0x448556,_0x1f5054){return db[_0x523d('0x50')]['create'](_0x448556[_0x523d('0x58')],{})[_0x523d('0x34')](respondWithResult(_0x1f5054,0xc9))[_0x523d('0x54')](handleError(_0x1f5054,null));};exports['update']=function(_0x148569,_0x38f785){if(_0x148569[_0x523d('0x58')]['id']){delete _0x148569[_0x523d('0x58')]['id'];}return db['OpenchannelMessage'][_0x523d('0x57')]({'where':{'id':_0x148569[_0x523d('0x56')]['id']}})[_0x523d('0x34')](handleEntityNotFound(_0x38f785,null))[_0x523d('0x34')](saveUpdates(_0x148569['body'],null))['then'](respondWithResult(_0x38f785,null))[_0x523d('0x54')](handleError(_0x38f785,null));};exports[_0x523d('0x35')]=function(_0x3befec,_0x214705){return db[_0x523d('0x50')][_0x523d('0x57')]({'where':{'id':_0x3befec[_0x523d('0x56')]['id']}})[_0x523d('0x34')](handleEntityNotFound(_0x214705,null))[_0x523d('0x34')](removeEntity(_0x214705,null))[_0x523d('0x54')](handleError(_0x214705,null));};exports[_0x523d('0x59')]=function(_0x197fff,_0x90878){return db['OpenchannelMessage'][_0x523d('0x59')]()['then'](respondWithResult(_0x90878,null))['catch'](handleError(_0x90878,null));};var interaction_log=require(_0x523d('0x11'))(_0x523d('0x5a'));exports[_0x523d('0x5b')]=function(_0x44e8d6,_0x537db0,_0x19e00c){var _0x43a16e={'agent':{},'channel':'openchannel'};if(_0x44e8d6[_0x523d('0x58')]['id']){delete _0x44e8d6[_0x523d('0x58')]['id'];}_0x44e8d6[_0x523d('0x58')][_0x523d('0x5c')]=!![];_0x44e8d6[_0x523d('0x58')][_0x523d('0x5d')]=moment()['format'](_0x523d('0x5e'));_0x44e8d6['body']['UserId']=_0x44e8d6['body'][_0x523d('0x5f')]||_0x44e8d6[_0x523d('0x60')]['id'];_0x43a16e[_0x523d('0x61')]['id']=_0x44e8d6[_0x523d('0x58')]['UserId'];return db['OpenchannelMessage'][_0x523d('0x57')]({'where':{'id':_0x44e8d6[_0x523d('0x56')]['id'],'UserId':null}})[_0x523d('0x34')](handleEntityNotFound(_0x537db0,null))[_0x523d('0x34')](saveUpdates(_0x44e8d6['body'],null))[_0x523d('0x34')](function(_0x2f3e74){if(_0x2f3e74){_0x43a16e[_0x523d('0x25')]=_0x2f3e74[_0x523d('0x62')]({'plain':!![]});return db[_0x523d('0x63')][_0x523d('0x57')]({'where':{'id':_0x2f3e74['OpenchannelInteractionId']}});}return null;})[_0x523d('0x34')](handleEntityNotFound(_0x537db0,null))['then'](function(_0x172be6){if(_0x172be6){return _0x172be6[_0x523d('0x64')]({'UserId':_0x44e8d6['body'][_0x523d('0x5f')],'read1stAt':_[_0x523d('0x65')](_0x172be6[_0x523d('0x66')])?moment()[_0x523d('0x67')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x523d('0x34')](function(_0x1c2ac8){if(_0x1c2ac8){_0x43a16e['interaction']=_0x1c2ac8[_0x523d('0x62')]({'plain':!![]});interaction_log[_0x523d('0x1f')](_0x523d('0x68'),_0x44e8d6[_0x523d('0x60')]['id'],_0x44e8d6['user'][_0x523d('0x36')],_0x44e8d6[_0x523d('0x60')][_0x523d('0x69')],_0x43a16e[_0x523d('0x6a')]['id'],_0x44e8d6[_0x523d('0x58')]?JSON[_0x523d('0x6b')](_0x44e8d6['body']):'null');return respondWithRpcPromise(_0x523d('0x6c'),_0x523d('0x6d'),_0x43a16e);}return null;})[_0x523d('0x34')](function(_0x48c23f){var _0x5e9747=_0x523d('0x6e')+_0x48c23f[_0x523d('0x25')][_0x523d('0x6f')];return db[_0x523d('0x70')][_0x523d('0x3e')](_0x5e9747,{'type':db[_0x523d('0x71')][_0x523d('0x72')]['SELECT'],'raw':!![]})[_0x523d('0x34')](function(_0x4ca424){return _0x4ca424;});})[_0x523d('0x34')](function(_0x1cea31){if(_0x1cea31){_0x43a16e['message']['contact']=_0x1cea31[0x0];if(!_0x44e8d6[_0x523d('0x58')][_0x523d('0x5f')])return;return db[_0x523d('0x73')][_0x523d('0x57')]({'where':{'id':_0x44e8d6[_0x523d('0x58')]['UserId'],'role':_0x523d('0x61')},'attributes':['id','name','fullname',_0x523d('0x74'),_0x523d('0x75')],'raw':!![]});}return null;})[_0x523d('0x34')](function(_0x120f6a){if(!_0x120f6a)return null;_0x43a16e[_0x523d('0x25')]['agent']=_0x120f6a;return _0x43a16e;})[_0x523d('0x34')](function(_0x11b571){if(_0x11b571){if(_0x44e8d6[_0x523d('0x58')]['manual']){_0x43a16e[_0x523d('0x25')][_0x523d('0x76')]=util[_0x523d('0x67')](_0x523d('0x77'),_0x44e8d6[_0x523d('0x60')][_0x523d('0x36')]);_0x43a16e['message'][_0x523d('0x78')]=_0x43a16e[_0x523d('0x78')];_0x43a16e['message'][_0x523d('0x79')]=_0x43a16e[_0x523d('0x78')];_0x43a16e[_0x523d('0x25')][_0x523d('0x7a')]='accept';return respondWithRpcPromise(_0x523d('0x7b'),_0x523d('0x7b'),{'event':_0x523d('0x7c'),'message':_0x43a16e[_0x523d('0x25')]},client9002)[_0x523d('0x34')](function(){return _0x43a16e;});}return _0x43a16e;}return null;})[_0x523d('0x34')](respondWithResult(_0x537db0,null))[_0x523d('0x54')](handleError(_0x537db0,null));};var interaction_log=require('../../config/logger')(_0x523d('0x5a'));exports[_0x523d('0x32')]=function(_0x2c64bc,_0x5a0bb,_0xf555c9){var _0x52078f={'agent':{},'channel':_0x523d('0x7d')};if(_0x2c64bc[_0x523d('0x58')]['id']){delete _0x2c64bc[_0x523d('0x58')]['id'];}_0x2c64bc[_0x523d('0x58')][_0x523d('0x5f')]=_0x2c64bc[_0x523d('0x58')][_0x523d('0x5f')]||_0x2c64bc['user']['id'];_0x52078f[_0x523d('0x61')]['id']=_0x2c64bc[_0x523d('0x58')][_0x523d('0x5f')];return db[_0x523d('0x50')][_0x523d('0x57')]({'where':{'id':_0x2c64bc['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5a0bb,null))[_0x523d('0x34')](function(_0x3fa313){if(_0x3fa313){_0x52078f[_0x523d('0x25')]=_0x3fa313[_0x523d('0x62')]({'plain':!![]});return db['OpenchannelInteraction'][_0x523d('0x57')]({'where':{'id':_0x3fa313[_0x523d('0x7e')]}});}return null;})['then'](handleEntityNotFound(_0x5a0bb,null))['then'](function(_0x58f965){if(_0x58f965){_0x52078f[_0x523d('0x6a')]=_0x58f965[_0x523d('0x62')]({'plain':!![]});interaction_log[_0x523d('0x1f')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2c64bc[_0x523d('0x60')]['id'],_0x2c64bc[_0x523d('0x60')]['name'],_0x2c64bc[_0x523d('0x60')]['role'],_0x52078f['interaction']['id'],_0x2c64bc[_0x523d('0x58')]?JSON['stringify'](_0x2c64bc[_0x523d('0x58')]):_0x523d('0x7f'));return respondWithRpcPromise(_0x523d('0x80'),'rejectMessage',_0x52078f);}return null;})[_0x523d('0x34')](function(_0x21bdca){var _0xef39e8=_0x523d('0x6e')+_0x21bdca['message']['ContactId'];return db['sequelize']['query'](_0xef39e8,{'type':db[_0x523d('0x71')]['QueryTypes'][_0x523d('0x81')],'raw':!![]})[_0x523d('0x34')](function(_0x1255e7){return _0x1255e7;});})[_0x523d('0x34')](function(_0x18b91c){if(_0x18b91c){_0x52078f[_0x523d('0x25')][_0x523d('0x82')]=_0x18b91c[0x0];if(!_0x2c64bc[_0x523d('0x58')][_0x523d('0x5f')])return;return db['User'][_0x523d('0x57')]({'where':{'id':_0x2c64bc['body'][_0x523d('0x5f')],'role':_0x523d('0x61')},'attributes':['id',_0x523d('0x36'),_0x523d('0x83'),_0x523d('0x74'),_0x523d('0x75')],'raw':!![]});}return null;})[_0x523d('0x34')](function(_0x1a8352){if(!_0x1a8352)return null;_0x52078f[_0x523d('0x25')][_0x523d('0x61')]=_0x1a8352;return _0x52078f;})['then'](function(_0x5c8438){if(_0x5c8438){_0x5c8438[_0x523d('0x25')][_0x523d('0x76')]=util[_0x523d('0x67')](_0x523d('0x77'),_0x2c64bc[_0x523d('0x60')]['name']);_0x5c8438[_0x523d('0x25')][_0x523d('0x78')]=_0x52078f['channel'];_0x5c8438['message'][_0x523d('0x79')]=_0x52078f[_0x523d('0x78')];_0x5c8438[_0x523d('0x25')][_0x523d('0x7a')]=_0x523d('0x32');respondWithRpcPromise('EventManager',_0x523d('0x7b'),{'event':_0x523d('0x84'),'message':_0x5c8438['message']},client9002);return _0x52078f;}return null;})[_0x523d('0x34')](respondWithResult(_0x5a0bb,null))['catch'](handleError(_0x5a0bb,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 1a553c5..d20c4c6 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 _0xbcb8=['update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x118a3e,_0x58c42d){var _0x1d1024=function(_0x1f1fd6){while(--_0x1f1fd6){_0x118a3e['push'](_0x118a3e['shift']());}};_0x1d1024(++_0x58c42d);}(_0xbcb8,0x137));var _0x8bcb=function(_0x474d7b,_0x1c312f){_0x474d7b=_0x474d7b-0x0;var _0x398b29=_0xbcb8[_0x474d7b];return _0x398b29;};'use strict';var EventEmitter=require(_0x8bcb('0x0'));var OpenchannelMessage=require(_0x8bcb('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x8bcb('0x2')](0x0);var events={'afterCreate':_0x8bcb('0x3'),'afterUpdate':_0x8bcb('0x4'),'afterDestroy':_0x8bcb('0x5')};function emitEvent(_0x366c65){return function(_0x446d1c,_0xc22721,_0x335539){OpenchannelMessageEvents[_0x8bcb('0x6')](_0x366c65+':'+_0x446d1c['id'],_0x446d1c);OpenchannelMessageEvents['emit'](_0x366c65,_0x446d1c);_0x335539(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x8bcb('0x7')](e,emitEvent(event));}}module[_0x8bcb('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x9b34=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x22cd0d,_0x543317){var _0xc00426=function(_0x3bd8bb){while(--_0x3bd8bb){_0x22cd0d['push'](_0x22cd0d['shift']());}};_0xc00426(++_0x543317);}(_0x9b34,0xcc));var _0x49b3=function(_0x3943a1,_0x4043b0){_0x3943a1=_0x3943a1-0x0;var _0x1f2796=_0x9b34[_0x3943a1];return _0x1f2796;};'use strict';var EventEmitter=require(_0x49b3('0x0'));var OpenchannelMessage=require(_0x49b3('0x1'))['db'][_0x49b3('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x49b3('0x3')](0x0);var events={'afterCreate':_0x49b3('0x4'),'afterUpdate':_0x49b3('0x5'),'afterDestroy':'remove'};function emitEvent(_0x231ec9){return function(_0xdb4ec2,_0x14ee08,_0x3d6f92){OpenchannelMessageEvents[_0x49b3('0x6')](_0x231ec9+':'+_0xdb4ec2['id'],_0xdb4ec2);OpenchannelMessageEvents[_0x49b3('0x6')](_0x231ec9,_0xdb4ec2);_0x3d6f92(null);};}for(var e in events){if(events[_0x49b3('0x7')](e)){var event=events[e];OpenchannelMessage[_0x49b3('0x8')](e,emitEvent(event));}}module[_0x49b3('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 5460578..4972e0c 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 _0x5f66=['catch','error','secret','CmContact','describe','OpenchannelAccount','find','Interactions','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','length','Interaction','Contact','POST','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','toLowerCase','out','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','direction'];(function(_0x4373a7,_0x5f0541){var _0x2160b8=function(_0x4946cf){while(--_0x4946cf){_0x4373a7['push'](_0x4373a7['shift']());}};_0x2160b8(++_0x5f0541);}(_0x5f66,0x1a0));var _0x65f6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5f66[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./openchannelMessage.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[{'name':_0x65f6('0xa'),'fields':[_0x65f6('0xb')],'type':_0x65f6('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x14f4c7,_0x48d85c,_0x5123ee){var _0x18fea1=_0x22b017[_0x65f6('0xd')];var _0x264647=_0x14f4c7[_0x65f6('0xe')]({'plain':!![]});if(_0x264647['direction'][_0x65f6('0xf')]()==='in'||_0x264647['direction']['toLowerCase']()===_0x65f6('0x10')&&!_0x264647['secret']&&!_[_0x65f6('0x11')](_0x264647['UserId'])){_0x18fea1[_0x65f6('0x12')][_0x65f6('0x13')]({'where':{'id':_0x264647[_0x65f6('0x14')]}})[_0x65f6('0x15')](function(_0x369f96){if(_0x369f96){_0x369f96[_0x65f6('0x16')]({'lastMsgAt':_0x264647[_0x65f6('0x17')],'lastMsgDirection':_0x264647[_0x65f6('0x18')][_0x65f6('0xf')]()});}})[_0x65f6('0x19')](function(_0x59154e){console[_0x65f6('0x1a')](_0x59154e);});}if(_0x264647['direction']==='out'&&!_0x264647[_0x65f6('0x1b')]){var _0x5c69f8;_0x18fea1[_0x65f6('0x1c')][_0x65f6('0x1d')]()[_0x65f6('0x15')](function(_0x1f974c){return _0x18fea1[_0x65f6('0x1e')][_0x65f6('0x1f')]({'where':{'id':_0x264647['OpenchannelAccountId']},'include':[{'model':_0x18fea1['OpenchannelInteraction'],'as':_0x65f6('0x20'),'where':{'id':_0x264647['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x18fea1['CmContact'],'as':'Contact','attributes':_[_0x65f6('0x21')](_0x1f974c)}]}]});})[_0x65f6('0x15')](function(_0x5114a4){_0x5c69f8=_0x5114a4[_0x65f6('0xe')]({'plain':!![]});if(_0x5c69f8&&_0x5c69f8[_0x65f6('0x22')]){logger[_0x65f6('0x23')](_0x65f6('0x24'),_0x65f6('0x25'),util[_0x65f6('0x26')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x264647['id'],_0x5c69f8[_0x65f6('0x22')]));if(_0x5c69f8['Interactions']&&_0x5c69f8['Interactions'][_0x65f6('0x27')]){_0x264647[_0x65f6('0x28')]=_['omit'](_0x5c69f8[_0x65f6('0x20')][0x0],_0x65f6('0x29'));_0x264647[_0x65f6('0x29')]=_0x5c69f8[_0x65f6('0x20')][0x0]['Contact'];}var _0x48d85c={'method':_0x65f6('0x2a'),'uri':encodeURI(_0x5c69f8[_0x65f6('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x48d85c['method']){case'GET':_0x48d85c['qs']=_0x264647;break;case'POST':_0x48d85c[_0x65f6('0xb')]=_0x264647;break;}return rp(_0x48d85c)[_0x65f6('0x15')](function(_0x4b2292){logger[_0x65f6('0x23')](_0x65f6('0x24'),'afterCreate',util[_0x65f6('0x26')](_0x65f6('0x2b'),_0x264647['id'],_0x5c69f8[_0x65f6('0x22')]));if(_0x4b2292['body']['threadId']&&_0x4b2292['body'][_0x65f6('0x2c')]!=_0x264647[_0x65f6('0x28')][_0x65f6('0x2c')]){return _0x18fea1[_0x65f6('0x12')][_0x65f6('0x16')]({'threadId':_0x4b2292[_0x65f6('0xb')][_0x65f6('0x2c')]},{'logging':!![],'where':{'id':_0x264647['Interaction']['id']}});}else{return;}})['then'](function(){return _0x14f4c7[_0x65f6('0x16')]({'read':!![]});})[_0x65f6('0x19')](function(_0x5878bc){logger['error'](_0x65f6('0x24'),_0x65f6('0x25'),util[_0x65f6('0x2d')](_0x5878bc,{'showHidden':![],'depth':null}));_0x5123ee();});}else{_0x5123ee();}})[_0x65f6('0x2e')](function(){_0x5123ee();});}else{_0x5123ee();}}},'charset':_0x65f6('0x2f'),'collate':_0x65f6('0x30')});}; \ No newline at end of file +var _0x0b0e=['get','toLowerCase','direction','secret','isNil','UserId','OpenchannelInteraction','findOne','then','update','createdAt','catch','error','CmContact','describe','OpenchannelAccount','Interactions','Contact','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','length','omit','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','fti_openchannel_messages','body','FULLTEXT'];(function(_0xc40b9f,_0x17ec1f){var _0x535b9c=function(_0x591b19){while(--_0x591b19){_0xc40b9f['push'](_0xc40b9f['shift']());}};_0x535b9c(++_0x17ec1f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x32f9ca,_0x2fa8bc){_0x32f9ca=_0x32f9ca-0x0;var _0x52e083=_0x0b0e[_0x32f9ca];return _0x52e083;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var logger=require(_0xe0b0('0x1'))('api');var moment=require(_0xe0b0('0x2'));var BPromise=require(_0xe0b0('0x3'));var rp=require(_0xe0b0('0x4'));var fs=require('fs');var path=require(_0xe0b0('0x5'));var rimraf=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var attributes=require(_0xe0b0('0x8'));module[_0xe0b0('0x9')]=function(_0x30e20d,_0x28e40f){return _0x30e20d[_0xe0b0('0xa')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xe0b0('0xb'),'fields':[_0xe0b0('0xc')],'type':_0xe0b0('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2ac27e,_0x4c24f9,_0x338e7c){var _0x1dd3b8=_0x30e20d['models'];var _0x1fef28=_0x2ac27e[_0xe0b0('0xe')]({'plain':!![]});if(_0x1fef28['direction'][_0xe0b0('0xf')]()==='in'||_0x1fef28[_0xe0b0('0x10')][_0xe0b0('0xf')]()==='out'&&!_0x1fef28[_0xe0b0('0x11')]&&!_[_0xe0b0('0x12')](_0x1fef28[_0xe0b0('0x13')])){_0x1dd3b8[_0xe0b0('0x14')][_0xe0b0('0x15')]({'where':{'id':_0x1fef28['OpenchannelInteractionId']}})[_0xe0b0('0x16')](function(_0x154de6){if(_0x154de6){_0x154de6[_0xe0b0('0x17')]({'lastMsgAt':_0x1fef28[_0xe0b0('0x18')],'lastMsgDirection':_0x1fef28[_0xe0b0('0x10')]['toLowerCase']()});}})[_0xe0b0('0x19')](function(_0x5adb01){console[_0xe0b0('0x1a')](_0x5adb01);});}if(_0x1fef28[_0xe0b0('0x10')]==='out'&&!_0x1fef28[_0xe0b0('0x11')]){var _0x4a4cc0;_0x1dd3b8[_0xe0b0('0x1b')][_0xe0b0('0x1c')]()['then'](function(_0x54a3eb){return _0x1dd3b8[_0xe0b0('0x1d')]['find']({'where':{'id':_0x1fef28['OpenchannelAccountId']},'include':[{'model':_0x1dd3b8['OpenchannelInteraction'],'as':_0xe0b0('0x1e'),'where':{'id':_0x1fef28['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x1dd3b8['CmContact'],'as':_0xe0b0('0x1f'),'attributes':_['keys'](_0x54a3eb)}]}]});})[_0xe0b0('0x16')](function(_0x5dba2f){_0x4a4cc0=_0x5dba2f[_0xe0b0('0xe')]({'plain':!![]});if(_0x4a4cc0&&_0x4a4cc0[_0xe0b0('0x20')]){logger[_0xe0b0('0x21')](_0xe0b0('0x22'),_0xe0b0('0x23'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0x1fef28['id'],_0x4a4cc0[_0xe0b0('0x20')]));if(_0x4a4cc0['Interactions']&&_0x4a4cc0[_0xe0b0('0x1e')][_0xe0b0('0x24')]){_0x1fef28['Interaction']=_[_0xe0b0('0x25')](_0x4a4cc0['Interactions'][0x0],_0xe0b0('0x1f'));_0x1fef28['Contact']=_0x4a4cc0[_0xe0b0('0x1e')][0x0]['Contact'];}var _0x4c24f9={'method':'POST','uri':encodeURI(_0x4a4cc0[_0xe0b0('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4c24f9['method']){case _0xe0b0('0x26'):_0x4c24f9['qs']=_0x1fef28;break;case'POST':_0x4c24f9[_0xe0b0('0xc')]=_0x1fef28;break;}return rp(_0x4c24f9)[_0xe0b0('0x16')](function(_0x1f1ebd){logger[_0xe0b0('0x21')](_0xe0b0('0x22'),_0xe0b0('0x23'),util['format'](_0xe0b0('0x27'),_0x1fef28['id'],_0x4a4cc0[_0xe0b0('0x20')]));if(_0x1f1ebd['body'][_0xe0b0('0x28')]&&_0x1f1ebd[_0xe0b0('0xc')][_0xe0b0('0x28')]!=_0x1fef28[_0xe0b0('0x29')][_0xe0b0('0x28')]){return _0x1dd3b8[_0xe0b0('0x14')][_0xe0b0('0x17')]({'threadId':_0x1f1ebd['body'][_0xe0b0('0x28')]},{'logging':!![],'where':{'id':_0x1fef28[_0xe0b0('0x29')]['id']}});}else{return;}})['then'](function(){return _0x2ac27e['update']({'read':!![]});})[_0xe0b0('0x19')](function(_0x33e672){logger[_0xe0b0('0x1a')](_0xe0b0('0x22'),_0xe0b0('0x23'),util['inspect'](_0x33e672,{'showHidden':![],'depth':null}));_0x338e7c();});}else{_0x338e7c();}})[_0xe0b0('0x2a')](function(){_0x338e7c();});}else{_0x338e7c();}}},'charset':_0xe0b0('0x2b'),'collate':_0xe0b0('0x2c')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 80dae5a..47514cf 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 _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(_0x4fb1e7,_0x4fe4d7){var _0x364d55=function(_0x4ec4ec){while(--_0x4ec4ec){_0x4fb1e7['push'](_0x4fb1e7['shift']());}};_0x364d55(++_0x4fe4d7);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f66[_0x5d4607];return _0x5e4a86;};'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 +var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3cc810,_0x4f11e9){var _0x2cc71c=function(_0x547bd3){while(--_0x547bd3){_0x3cc810['push'](_0x3cc810['shift']());}};_0x2cc71c(++_0x4f11e9);}(_0x7a54,0x106));var _0x47a5=function(_0x2eada2,_0xd684a5){_0x2eada2=_0x2eada2-0x0;var _0x225c79=_0x7a54[_0x2eada2];return _0x225c79;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index ecd8eb9..ccf82c8 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 _0x1e6c=['./openchannelMessage.events','remove','update','removeListener','register','length'];(function(_0x542ecd,_0x4ca01f){var _0x146224=function(_0x98b385){while(--_0x98b385){_0x542ecd['push'](_0x542ecd['shift']());}};_0x146224(++_0x4ca01f);}(_0x1e6c,0x11a));var _0xc1e6=function(_0x275caa,_0x166d5e){_0x275caa=_0x275caa-0x0;var _0x28d670=_0x1e6c[_0x275caa];return _0x28d670;};'use strict';var OpenchannelMessageEvents=require(_0xc1e6('0x0'));var events=['save',_0xc1e6('0x1'),_0xc1e6('0x2')];function createListener(_0x3eea0c,_0x17d44e){return function(_0x21faab){_0x17d44e['emit'](_0x3eea0c,_0x21faab);};}function removeListener(_0x579250,_0x477d95){return function(){OpenchannelMessageEvents[_0xc1e6('0x3')](_0x579250,_0x477d95);};}exports[_0xc1e6('0x4')]=function(_0x157b8d){for(var _0x36968b=0x0,_0x36c625=events[_0xc1e6('0x5')];_0x36968b<_0x36c625;_0x36968b++){var _0x5cd563=events[_0x36968b];var _0x399c3e=createListener('openchannelMessage:'+_0x5cd563,_0x157b8d);OpenchannelMessageEvents['on'](_0x5cd563,_0x399c3e);}}; \ No newline at end of file +var _0xef54=['update','emit','removeListener','length','openchannelMessage:','./openchannelMessage.events','save','remove'];(function(_0x21b067,_0x2fedcf){var _0x10120d=function(_0x4eb45c){while(--_0x4eb45c){_0x21b067['push'](_0x21b067['shift']());}};_0x10120d(++_0x2fedcf);}(_0xef54,0x9d));var _0x4ef5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xef54[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelMessageEvents=require(_0x4ef5('0x0'));var events=[_0x4ef5('0x1'),_0x4ef5('0x2'),_0x4ef5('0x3')];function createListener(_0x5c2dec,_0x510611){return function(_0x4204db){_0x510611[_0x4ef5('0x4')](_0x5c2dec,_0x4204db);};}function removeListener(_0x5c4ed7,_0x19afa6){return function(){OpenchannelMessageEvents[_0x4ef5('0x5')](_0x5c4ed7,_0x19afa6);};}exports['register']=function(_0x2ee02e){for(var _0x46aba3=0x0,_0x1b86ce=events[_0x4ef5('0x6')];_0x46aba3<_0x1b86ce;_0x46aba3++){var _0x53012b=events[_0x46aba3];var _0x27995c=createListener(_0x4ef5('0x7')+_0x53012b,_0x2ee02e);OpenchannelMessageEvents['on'](_0x53012b,_0x27995c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index ffb2856..cc72ef8 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 _0x7fde=['addTeams','addAgents','/:id','update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','/describe','describe','get','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post'];(function(_0x39cf50,_0x2fba3c){var _0xe76855=function(_0x27d0f6){while(--_0x27d0f6){_0x39cf50['push'](_0x39cf50['shift']());}};_0xe76855(++_0x2fba3c);}(_0x7fde,0xf9));var _0xe7fd=function(_0x4ba8bb,_0x500c86){_0x4ba8bb=_0x4ba8bb-0x0;var _0x453f6b=_0x7fde[_0x4ba8bb];return _0x453f6b;};'use strict';var multer=require('multer');var util=require(_0xe7fd('0x0'));var path=require(_0xe7fd('0x1'));var timeout=require(_0xe7fd('0x2'));var express=require(_0xe7fd('0x3'));var router=express[_0xe7fd('0x4')]();var fs_extra=require(_0xe7fd('0x5'));var auth=require(_0xe7fd('0x6'));var interaction=require(_0xe7fd('0x7'));var config=require(_0xe7fd('0x8'));var controller=require(_0xe7fd('0x9'));router['get']('/',auth[_0xe7fd('0xa')](),controller['index']);router['get'](_0xe7fd('0xb'),auth[_0xe7fd('0xa')](),controller[_0xe7fd('0xc')]);router[_0xe7fd('0xd')]('/:id',auth[_0xe7fd('0xa')](),controller['show']);router[_0xe7fd('0xd')](_0xe7fd('0xe'),auth['isAuthenticated'](),controller[_0xe7fd('0xf')]);router['get'](_0xe7fd('0x10'),auth[_0xe7fd('0xa')](),controller[_0xe7fd('0x11')]);router[_0xe7fd('0xd')](_0xe7fd('0x12'),auth[_0xe7fd('0xa')](),controller[_0xe7fd('0x13')]);router[_0xe7fd('0x14')]('/',auth[_0xe7fd('0xa')](),controller['create']);router[_0xe7fd('0x14')](_0xe7fd('0x10'),auth[_0xe7fd('0xa')](),controller[_0xe7fd('0x15')]);router[_0xe7fd('0x14')](_0xe7fd('0x12'),auth[_0xe7fd('0xa')](),controller[_0xe7fd('0x16')]);router['put'](_0xe7fd('0x17'),auth[_0xe7fd('0xa')](),controller[_0xe7fd('0x18')]);router[_0xe7fd('0x19')](_0xe7fd('0x17'),auth[_0xe7fd('0xa')](),controller[_0xe7fd('0x1a')]);router[_0xe7fd('0x19')](_0xe7fd('0x10'),auth[_0xe7fd('0xa')](),controller[_0xe7fd('0x1b')]);router[_0xe7fd('0x19')](_0xe7fd('0x12'),auth[_0xe7fd('0xa')](),controller[_0xe7fd('0x1c')]);module[_0xe7fd('0x1d')]=router; \ No newline at end of file +var _0xf5c3=['describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x3b8e7d,_0x4424be){var _0x52b641=function(_0x2bba33){while(--_0x2bba33){_0x3b8e7d['push'](_0x3b8e7d['shift']());}};_0x52b641(++_0x4424be);}(_0xf5c3,0xc6));var _0x3f5c=function(_0x4f8fe4,_0x2c19c2){_0x4f8fe4=_0x4f8fe4-0x0;var _0x27be20=_0xf5c3[_0x4f8fe4];return _0x27be20;};'use strict';var multer=require(_0x3f5c('0x0'));var util=require(_0x3f5c('0x1'));var path=require('path');var timeout=require(_0x3f5c('0x2'));var express=require(_0x3f5c('0x3'));var router=express[_0x3f5c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3f5c('0x5'));var interaction=require(_0x3f5c('0x6'));var config=require(_0x3f5c('0x7'));var controller=require('./openchannelQueue.controller');router[_0x3f5c('0x8')]('/',auth[_0x3f5c('0x9')](),controller[_0x3f5c('0xa')]);router[_0x3f5c('0x8')](_0x3f5c('0xb'),auth[_0x3f5c('0x9')](),controller[_0x3f5c('0xc')]);router['get'](_0x3f5c('0xd'),auth[_0x3f5c('0x9')](),controller[_0x3f5c('0xe')]);router[_0x3f5c('0x8')](_0x3f5c('0xf'),auth[_0x3f5c('0x9')](),controller[_0x3f5c('0x10')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller[_0x3f5c('0x11')]);router['get'](_0x3f5c('0x12'),auth['isAuthenticated'](),controller['getAgents']);router[_0x3f5c('0x13')]('/',auth[_0x3f5c('0x9')](),controller[_0x3f5c('0x14')]);router[_0x3f5c('0x13')](_0x3f5c('0x15'),auth[_0x3f5c('0x9')](),controller[_0x3f5c('0x16')]);router[_0x3f5c('0x13')](_0x3f5c('0x12'),auth[_0x3f5c('0x9')](),controller[_0x3f5c('0x17')]);router[_0x3f5c('0x18')]('/:id',auth[_0x3f5c('0x9')](),controller[_0x3f5c('0x19')]);router[_0x3f5c('0x1a')](_0x3f5c('0xd'),auth[_0x3f5c('0x9')](),controller[_0x3f5c('0x1b')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0x3f5c('0x12'),auth[_0x3f5c('0x9')](),controller[_0x3f5c('0x1c')]);module[_0x3f5c('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 8925eee..311f962 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 _0x8ce7=['sequelize','exports','STRING','ENUM','rrmemory','roundrobin'];(function(_0x5f15f4,_0x5efcaf){var _0x17d662=function(_0x59516d){while(--_0x59516d){_0x5f15f4['push'](_0x5f15f4['shift']());}};_0x17d662(++_0x5efcaf);}(_0x8ce7,0x9c));var _0x78ce=function(_0x268da0,_0x1785ee){_0x268da0=_0x268da0-0x0;var _0x22f5f8=_0x8ce7[_0x268da0];return _0x22f5f8;};'use strict';var Sequelize=require(_0x78ce('0x0'));module[_0x78ce('0x1')]={'name':{'type':Sequelize[_0x78ce('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x78ce('0x3')](_0x78ce('0x4'),'beepall',_0x78ce('0x5'))}}; \ No newline at end of file +var _0xff6f=['exports','STRING','INTEGER','rrmemory','sequelize'];(function(_0x251d9c,_0x580977){var _0x16ae64=function(_0x4d3b53){while(--_0x4d3b53){_0x251d9c['push'](_0x251d9c['shift']());}};_0x16ae64(++_0x580977);}(_0xff6f,0x1da));var _0xfff6=function(_0x3e5acd,_0x1f772b){_0x3e5acd=_0x3e5acd-0x0;var _0x3c9efa=_0xff6f[_0x3e5acd];return _0x3c9efa;};'use strict';var Sequelize=require(_0xfff6('0x0'));module[_0xfff6('0x1')]={'name':{'type':Sequelize[_0xfff6('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xfff6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xfff6('0x4'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index ab6bfa2..a7e50c8 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 _0x71e8=['redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','get','OpenchannelQueues','UserProfileResource','destroy','error','stack','send','map','OpenchannelQueue','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','show','rawAttributes','include','catch','create','body','role','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','pick','OpenchannelQueueId','options','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','ids','Agents','online','interface','flatMap','sequelize','each','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','select','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','compact','transaction','isEmpty','removeAgents','addAgents','omit','isArray','emit','userOpenchannelQueue:remove','getAgents','hasOwnProperty','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x4d59de,_0x38990e){var _0x129f63=function(_0xd5ce9b){while(--_0xd5ce9b){_0x4d59de['push'](_0x4d59de['shift']());}};_0x129f63(++_0x38990e);}(_0x71e8,0x74));var _0x871e=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x71e8[_0x126558];return _0x1f6d14;};'use strict';var emlformat=require(_0x871e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x871e('0x1'));var rp=require(_0x871e('0x2'));var moment=require(_0x871e('0x3'));var BPromise=require(_0x871e('0x4'));var Mustache=require(_0x871e('0x5'));var util=require(_0x871e('0x6'));var path=require(_0x871e('0x7'));var sox=require(_0x871e('0x8'));var csv=require(_0x871e('0x9'));var ejs=require(_0x871e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x871e('0xb'));var squel=require('squel');var crypto=require(_0x871e('0xc'));var jsforce=require(_0x871e('0xd'));var deskjs=require(_0x871e('0xe'));var toCsv=require(_0x871e('0x9'));var querystring=require(_0x871e('0xf'));var Papa=require(_0x871e('0x10'));var Redis=require(_0x871e('0x11'));var authService=require(_0x871e('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x871e('0x13'));var logger=require(_0x871e('0x14'))('api');var utils=require(_0x871e('0x15'));var config=require(_0x871e('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x871e('0x17')]=_[_0x871e('0x18')](config['redis'],{'host':_0x871e('0x19'),'port':0x18eb});var socket=require(_0x871e('0x1a'))(new Redis(config[_0x871e('0x17')]));require(_0x871e('0x1b'))['register'](socket);function respondWithStatusCode(_0x1332f9,_0x6dd909){_0x6dd909=_0x6dd909||0xcc;return function(_0x4358bb){if(_0x4358bb){return _0x1332f9[_0x871e('0x1c')](_0x6dd909);}return _0x1332f9[_0x871e('0x1d')](_0x6dd909)[_0x871e('0x1e')]();};}function respondWithResult(_0x3732a6,_0x554b75){_0x554b75=_0x554b75||0xc8;return function(_0x16c12a){if(_0x16c12a){return _0x3732a6['status'](_0x554b75)[_0x871e('0x1f')](_0x16c12a);}};}function respondWithFilteredResult(_0x2249c4,_0x14b90a){return function(_0x187060){if(_0x187060){var _0x27d274=typeof _0x14b90a[_0x871e('0x20')]===_0x871e('0x21')&&typeof _0x14b90a['limit']===_0x871e('0x21');var _0x172cfc=_0x187060[_0x871e('0x22')];var _0xfb987e=_0x27d274?0x0:_0x14b90a[_0x871e('0x20')];var _0x204bf6=_0x27d274?_0x187060[_0x871e('0x22')]:_0x14b90a[_0x871e('0x20')]+_0x14b90a[_0x871e('0x23')];var _0x187d9c;if(_0x204bf6>=_0x172cfc){_0x204bf6=_0x172cfc;_0x187d9c=0xc8;}else{_0x187d9c=0xce;}_0x2249c4[_0x871e('0x1d')](_0x187d9c);return _0x2249c4[_0x871e('0x24')]('Content-Range',_0xfb987e+'-'+_0x204bf6+'/'+_0x172cfc)[_0x871e('0x1f')](_0x187060);}return null;};}function patchUpdates(_0x4908c1){return function(_0x23ae07){try{jsonpatch[_0x871e('0x25')](_0x23ae07,_0x4908c1,!![]);}catch(_0x1e423d){return BPromise[_0x871e('0x26')](_0x1e423d);}return _0x23ae07['save']();};}function saveUpdates(_0x51a85d,_0x99ba9){return function(_0x7ffabc){if(_0x7ffabc){return _0x7ffabc[_0x871e('0x27')](_0x51a85d)[_0x871e('0x28')](function(_0x40e403){return _0x40e403;});}return null;};}function removeEntity(_0x5791f9,_0xbfb1d4){return function(_0xcff0cf){if(_0xcff0cf){return _0xcff0cf['destroy']()[_0x871e('0x28')](function(){var _0x6fe64d=_0xcff0cf[_0x871e('0x29')]({'plain':!![]});var _0x43a860=_0x871e('0x2a');return db[_0x871e('0x2b')][_0x871e('0x2c')]({'where':{'type':_0x43a860,'resourceId':_0x6fe64d['id']}})['then'](function(){return _0xcff0cf;});})['then'](function(){_0x5791f9[_0x871e('0x1d')](0xcc)[_0x871e('0x1e')]();});}};}function handleEntityNotFound(_0x3e7369,_0x52a12d){return function(_0x3201d3){if(!_0x3201d3){_0x3e7369['sendStatus'](0x194);}return _0x3201d3;};}function handleError(_0x7a4b45,_0x32d7c4){_0x32d7c4=_0x32d7c4||0x1f4;return function(_0x242a59){logger[_0x871e('0x2d')](_0x242a59[_0x871e('0x2e')]);if(_0x242a59['name']){delete _0x242a59['name'];}_0x7a4b45[_0x871e('0x1d')](_0x32d7c4)[_0x871e('0x2f')](_0x242a59);};}exports['index']=function(_0x5106c1,_0x501506){var _0x2f4f48={},_0x55054e={},_0x38b945={'count':0x0,'rows':[]};var _0x939b13=_[_0x871e('0x30')](db[_0x871e('0x31')]['rawAttributes'],function(_0xfa6eeb){return{'name':_0xfa6eeb['fieldName'],'type':_0xfa6eeb[_0x871e('0x32')][_0x871e('0x33')]};});_0x55054e[_0x871e('0x34')]=_[_0x871e('0x30')](_0x939b13,_0x871e('0x35'));_0x55054e[_0x871e('0x36')]=_[_0x871e('0x37')](_0x5106c1[_0x871e('0x36')]);_0x55054e[_0x871e('0x38')]=_[_0x871e('0x39')](_0x55054e[_0x871e('0x34')],_0x55054e[_0x871e('0x36')]);_0x2f4f48[_0x871e('0x3a')]=_[_0x871e('0x39')](_0x55054e[_0x871e('0x34')],qs[_0x871e('0x3b')](_0x5106c1[_0x871e('0x36')]['fields']));_0x2f4f48[_0x871e('0x3a')]=_0x2f4f48[_0x871e('0x3a')][_0x871e('0x3c')]?_0x2f4f48[_0x871e('0x3a')]:_0x55054e[_0x871e('0x34')];if(!_0x5106c1[_0x871e('0x36')]['hasOwnProperty'](_0x871e('0x3d'))){_0x2f4f48[_0x871e('0x23')]=qs[_0x871e('0x23')](_0x5106c1[_0x871e('0x36')]['limit']);_0x2f4f48[_0x871e('0x20')]=qs[_0x871e('0x20')](_0x5106c1['query']['offset']);}_0x2f4f48[_0x871e('0x3e')]=qs[_0x871e('0x3f')](_0x5106c1[_0x871e('0x36')][_0x871e('0x3f')]);_0x2f4f48[_0x871e('0x40')]=qs[_0x871e('0x38')](_['pick'](_0x5106c1[_0x871e('0x36')],_0x55054e[_0x871e('0x38')]),_0x939b13);if(_0x5106c1[_0x871e('0x36')][_0x871e('0x41')]){_0x2f4f48[_0x871e('0x40')]=_[_0x871e('0x42')](_0x2f4f48[_0x871e('0x40')],{'$or':_[_0x871e('0x30')](_0x939b13,function(_0x115366){if(_0x115366[_0x871e('0x32')]!==_0x871e('0x43')){var _0x5c5e5a={};_0x5c5e5a[_0x115366['name']]={'$like':'%'+_0x5106c1['query'][_0x871e('0x41')]+'%'};return _0x5c5e5a;}})});}_0x2f4f48=_[_0x871e('0x42')]({},_0x2f4f48,_0x5106c1['options']);var _0x182a0d={'where':_0x2f4f48[_0x871e('0x40')]};return db['OpenchannelQueue'][_0x871e('0x22')](_0x182a0d)[_0x871e('0x28')](function(_0x36d095){_0x38b945[_0x871e('0x22')]=_0x36d095;if(_0x5106c1[_0x871e('0x36')][_0x871e('0x44')]){_0x2f4f48['include']=[{'all':!![]}];}return db[_0x871e('0x31')][_0x871e('0x45')](_0x2f4f48);})[_0x871e('0x28')](function(_0x413198){_0x38b945[_0x871e('0x46')]=_0x413198;return _0x38b945;})[_0x871e('0x28')](respondWithFilteredResult(_0x501506,_0x2f4f48))['catch'](handleError(_0x501506,null));};exports[_0x871e('0x47')]=function(_0x46d495,_0x23eb9b){var _0x28bca5={'raw':!![],'where':{'id':_0x46d495['params']['id']}},_0x500c35={};_0x500c35[_0x871e('0x34')]=_[_0x871e('0x37')](db[_0x871e('0x31')][_0x871e('0x48')]);_0x500c35[_0x871e('0x36')]=_[_0x871e('0x37')](_0x46d495['query']);_0x500c35[_0x871e('0x38')]=_['intersection'](_0x500c35[_0x871e('0x34')],_0x500c35[_0x871e('0x36')]);_0x28bca5[_0x871e('0x3a')]=_['intersection'](_0x500c35[_0x871e('0x34')],qs[_0x871e('0x3b')](_0x46d495[_0x871e('0x36')]['fields']));_0x28bca5[_0x871e('0x3a')]=_0x28bca5[_0x871e('0x3a')][_0x871e('0x3c')]?_0x28bca5[_0x871e('0x3a')]:_0x500c35['model'];if(_0x46d495[_0x871e('0x36')][_0x871e('0x44')]){_0x28bca5[_0x871e('0x49')]=[{'all':!![]}];}_0x28bca5=_[_0x871e('0x42')]({},_0x28bca5,_0x46d495['options']);return db[_0x871e('0x31')]['find'](_0x28bca5)[_0x871e('0x28')](handleEntityNotFound(_0x23eb9b,null))[_0x871e('0x28')](respondWithResult(_0x23eb9b,null))[_0x871e('0x4a')](handleError(_0x23eb9b,null));};exports[_0x871e('0x4b')]=function(_0x9437aa,_0x535f44){return db[_0x871e('0x31')][_0x871e('0x4b')](_0x9437aa[_0x871e('0x4c')],{})[_0x871e('0x28')](function(_0x547c01){var _0x10dfe7=_0x9437aa['user'][_0x871e('0x29')]({'plain':!![]});if(!_0x10dfe7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10dfe7[_0x871e('0x4d')]===_0x871e('0x4e')){var _0x55a46b=_0x547c01[_0x871e('0x29')]({'plain':!![]});var _0x4abcc9=_0x871e('0x2a');return db[_0x871e('0x4f')][_0x871e('0x50')]({'where':{'name':_0x4abcc9,'userProfileId':_0x10dfe7['userProfileId']},'raw':!![]})['then'](function(_0x2a7ec5){if(_0x2a7ec5&&_0x2a7ec5[_0x871e('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x55a46b[_0x871e('0x35')],'resourceId':_0x55a46b['id'],'type':_0x2a7ec5[_0x871e('0x35')],'sectionId':_0x2a7ec5['id']},{})[_0x871e('0x28')](function(){return _0x547c01;});}else{return _0x547c01;}})[_0x871e('0x4a')](function(_0x15817b){logger[_0x871e('0x2d')](_0x871e('0x52'),_0x15817b);throw _0x15817b;});}return _0x547c01;})[_0x871e('0x28')](respondWithResult(_0x535f44,0xc9))[_0x871e('0x4a')](handleError(_0x535f44,null));};exports['update']=function(_0x7ca252,_0x452618){if(_0x7ca252[_0x871e('0x4c')]['id']){delete _0x7ca252[_0x871e('0x4c')]['id'];}return db[_0x871e('0x31')][_0x871e('0x50')]({'where':{'id':_0x7ca252[_0x871e('0x53')]['id']}})[_0x871e('0x28')](handleEntityNotFound(_0x452618,null))[_0x871e('0x28')](saveUpdates(_0x7ca252[_0x871e('0x4c')],null))['then'](respondWithResult(_0x452618,null))['catch'](handleError(_0x452618,null));};exports[_0x871e('0x2c')]=function(_0x2c0708,_0x2bc17a){return db[_0x871e('0x31')]['find']({'where':{'id':_0x2c0708['params']['id']}})['then'](handleEntityNotFound(_0x2bc17a,null))[_0x871e('0x28')](removeEntity(_0x2bc17a,null))[_0x871e('0x4a')](handleError(_0x2bc17a,null));};exports[_0x871e('0x54')]=function(_0xeefe7d,_0x209989){return db[_0x871e('0x31')][_0x871e('0x54')]()[_0x871e('0x28')](respondWithResult(_0x209989,null))[_0x871e('0x4a')](handleError(_0x209989,null));};exports[_0x871e('0x55')]=function(_0x126026,_0x324f67,_0x4fe0d4){var _0x2b46d2={'raw':!![],'where':{}},_0x3195d8={},_0x47e0eb;return db[_0x871e('0x31')][_0x871e('0x56')]({'where':{'id':_0x126026[_0x871e('0x53')]['id']}})[_0x871e('0x28')](handleEntityNotFound(_0x324f67,null))[_0x871e('0x28')](function(_0x2da5c3){if(_0x2da5c3){_0x47e0eb=_0x2da5c3[_0x871e('0x29')]({'plain':!![]});_0x3195d8[_0x871e('0x34')]=_[_0x871e('0x37')](db['UserOpenchannelQueue'][_0x871e('0x48')]);_0x3195d8[_0x871e('0x36')]=_[_0x871e('0x37')](_0x126026['query']);_0x3195d8[_0x871e('0x38')]=_[_0x871e('0x39')](_0x3195d8[_0x871e('0x34')],_0x3195d8['query']);_0x2b46d2[_0x871e('0x3a')]=_[_0x871e('0x39')](_0x3195d8[_0x871e('0x34')],qs['fields'](_0x126026[_0x871e('0x36')][_0x871e('0x3b')]));_0x2b46d2[_0x871e('0x3a')]=_0x2b46d2[_0x871e('0x3a')][_0x871e('0x3c')]?_0x2b46d2[_0x871e('0x3a')]:_0x3195d8[_0x871e('0x34')];if(!_0x126026['query']['hasOwnProperty']('nolimit')){_0x2b46d2[_0x871e('0x23')]=qs[_0x871e('0x23')](_0x126026[_0x871e('0x36')][_0x871e('0x23')]);_0x2b46d2[_0x871e('0x20')]=qs['offset'](_0x126026[_0x871e('0x36')][_0x871e('0x20')]);}_0x2b46d2[_0x871e('0x3e')]=qs[_0x871e('0x3f')](_0x126026[_0x871e('0x36')][_0x871e('0x3f')]);_0x2b46d2[_0x871e('0x40')]=qs[_0x871e('0x38')](_[_0x871e('0x57')](_0x126026[_0x871e('0x36')],_0x3195d8[_0x871e('0x38')]));_0x2b46d2[_0x871e('0x40')][_0x871e('0x58')]=_0x2da5c3['id'];if(_0x126026[_0x871e('0x36')][_0x871e('0x41')]){_0x2b46d2[_0x871e('0x40')]=_[_0x871e('0x42')](_0x2b46d2[_0x871e('0x40')],{'$or':_[_0x871e('0x30')](_0x2b46d2['attributes'],function(_0x41e3d1){var _0x5c216c={};_0x5c216c[_0x41e3d1]={'$like':'%'+_0x126026['query'][_0x871e('0x41')]+'%'};return _0x5c216c;})});}_0x2b46d2=_[_0x871e('0x42')]({},_0x2b46d2,_0x126026[_0x871e('0x59')]);return db[_0x871e('0x5a')]['findAll'](_0x2b46d2);}})[_0x871e('0x28')](function(_0x4a234){if(_0x4a234){return db[_0x871e('0x5b')][_0x871e('0x5c')]({'where':{'id':_[_0x871e('0x30')](_0x4a234,_0x871e('0x5d')),'role':_0x871e('0x5e')},'attributes':['id','name',_0x871e('0x5f'),_0x871e('0x60'),_0x871e('0x61')]});}})[_0x871e('0x28')](function(_0xb02cf){if(_0xb02cf){return{'count':_0xb02cf[_0x871e('0x22')],'rows':_[_0x871e('0x30')](_0xb02cf['rows'],function(_0x5108e5){return{'membername':_0x5108e5[_0x871e('0x35')],'UserId':_0x5108e5['id'],'queue_name':_0x47e0eb[_0x871e('0x35')],'OpenchannelQueueId':_0x47e0eb['id'],'interface':util['format'](_0x871e('0x62'),_0x871e('0x63'),_0x5108e5[_0x871e('0x35')]),'penalty':0x0,'paused':_0x5108e5['openchannelPause'],'createdAt':_0x5108e5[_0x871e('0x61')],'updatedAt':_0x5108e5[_0x871e('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x871e('0x28')](respondWithFilteredResult(_0x324f67,_0x2b46d2))['catch'](handleError(_0x324f67,null));};exports[_0x871e('0x64')]=function(_0x125813,_0x244554,_0x5ba80d){var _0x6ef585={};var _0x2cc083={};var _0x2a8a34;var _0x13bb3f;return db[_0x871e('0x31')][_0x871e('0x56')]({'where':{'id':_0x125813['params']['id']}})[_0x871e('0x28')](handleEntityNotFound(_0x244554,null))[_0x871e('0x28')](function(_0x14f20c){if(_0x14f20c){_0x2a8a34=_0x14f20c;_0x2cc083[_0x871e('0x34')]=_['keys'](db[_0x871e('0x65')][_0x871e('0x48')]);_0x2cc083[_0x871e('0x36')]=_['keys'](_0x125813['query']);_0x2cc083[_0x871e('0x38')]=_[_0x871e('0x39')](_0x2cc083[_0x871e('0x34')],_0x2cc083[_0x871e('0x36')]);_0x6ef585[_0x871e('0x3a')]=_[_0x871e('0x39')](_0x2cc083[_0x871e('0x34')],qs[_0x871e('0x3b')](_0x125813[_0x871e('0x36')]['fields']));_0x6ef585['attributes']=_0x6ef585[_0x871e('0x3a')][_0x871e('0x3c')]?_0x6ef585[_0x871e('0x3a')]:_0x2cc083[_0x871e('0x34')];_0x6ef585[_0x871e('0x3e')]=qs[_0x871e('0x3f')](_0x125813[_0x871e('0x36')][_0x871e('0x3f')]);_0x6ef585[_0x871e('0x40')]=qs[_0x871e('0x38')](_['pick'](_0x125813[_0x871e('0x36')],_0x2cc083[_0x871e('0x38')]));if(_0x125813[_0x871e('0x36')][_0x871e('0x41')]){_0x6ef585[_0x871e('0x40')]=_['merge'](_0x6ef585['where'],{'$or':_['map'](_0x6ef585[_0x871e('0x3a')],function(_0x4baa9e){var _0x2f7340={};_0x2f7340[_0x4baa9e]={'$like':'%'+_0x125813[_0x871e('0x36')]['filter']+'%'};return _0x2f7340;})});}_0x6ef585=_['merge']({},_0x6ef585,_0x125813[_0x871e('0x59')]);return _0x2a8a34[_0x871e('0x64')](_0x6ef585);}})['then'](function(_0x5a0d32){if(_0x5a0d32){_0x13bb3f=_0x5a0d32[_0x871e('0x3c')];if(!_0x125813[_0x871e('0x36')]['hasOwnProperty']('nolimit')){_0x6ef585[_0x871e('0x23')]=qs[_0x871e('0x23')](_0x125813[_0x871e('0x36')][_0x871e('0x23')]);_0x6ef585[_0x871e('0x20')]=qs['offset'](_0x125813[_0x871e('0x36')][_0x871e('0x20')]);}return _0x2a8a34[_0x871e('0x64')](_0x6ef585);}})['then'](function(_0x49197a){if(_0x49197a){return _0x49197a?{'count':_0x13bb3f,'rows':_0x49197a}:null;}})[_0x871e('0x28')](respondWithResult(_0x244554,null))['catch'](handleError(_0x244554,null));};exports['addTeams']=function(_0x292c44,_0x360f4f,_0x5565ed){var _0x4ed7fd=_0x292c44[_0x871e('0x4c')][_0x871e('0x66')];return db['Team']['findAll']({'where':{'id':_0x4ed7fd},'attributes':['id'],'include':[{'model':db[_0x871e('0x5b')],'as':_0x871e('0x67'),'attributes':['id','name',_0x871e('0x68'),'voicePause',_0x871e('0x69')],'raw':!![]}]})[_0x871e('0x28')](function(_0x1e2cd7){if(_0x1e2cd7){var _0x4e0bfa=_[_0x871e('0x6a')](_0x1e2cd7,function(_0x1ec440){var _0x31fe15=_0x1ec440[_0x871e('0x29')]({'plain':!![]});return _0x31fe15[_0x871e('0x67')];});return db['OpenchannelQueue'][_0x871e('0x50')]({'where':{'id':_0x292c44[_0x871e('0x53')]['id']}})[_0x871e('0x28')](function(_0x333ddc){return db[_0x871e('0x6b')]['transaction'](function(_0x308beb){return _0x333ddc['addTeams'](_0x4ed7fd,{'transaction':_0x308beb})[_0x871e('0x28')](function(){return BPromise[_0x871e('0x6c')](_0x4e0bfa,function(_0x218a4c){return db[_0x871e('0x5a')][_0x871e('0x6d')]({'where':{'UserId':_0x218a4c['id'],'OpenchannelQueueId':_0x292c44[_0x871e('0x53')]['id']},'transaction':_0x308beb});});})[_0x871e('0x28')](function(){_0x4e0bfa[_0x871e('0x6e')](function(_0x7dcfac){socket['emit'](_0x871e('0x6f'),{'UserId':_0x7dcfac['id'],'OpenchannelQueueId':_0x333ddc['id']});});});});});}})[_0x871e('0x28')](respondWithStatusCode(_0x360f4f,null))[_0x871e('0x4a')](handleError(_0x360f4f,null));};exports[_0x871e('0x70')]=function(_0x3a98fc,_0x5ab9c6,_0x3db3bb){return db[_0x871e('0x65')]['findAll']({'where':{'id':_0x3a98fc[_0x871e('0x36')][_0x871e('0x66')]},'attributes':['id'],'include':[{'model':db[_0x871e('0x5b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x871e('0x28')](handleEntityNotFound(_0x5ab9c6,null))['then'](function(_0x586949){var _0x197073=_[_0x871e('0x30')](_0x586949,'id');var _0x2b9435=[];var _0x3cb615=[];var _0x41e725=squel[_0x871e('0x71')]();_0x41e725['field'](_0x871e('0x72'))[_0x871e('0x73')](_0x871e('0x74'),'tq')[_0x871e('0x75')](_0x871e('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x871e('0x40')](_0x871e('0x77'),_0x3a98fc['params']['id']);for(var _0x413f81=0x0;_0x413f81<_0x586949[_0x871e('0x3c')];_0x413f81+=0x1){let _0x204b3f=_0x586949[_0x413f81];for(var _0x389fbf=0x0;_0x389fbf<_0x204b3f[_0x871e('0x67')][_0x871e('0x3c')];_0x389fbf+=0x1){let _0x1e0f2f=_0x204b3f[_0x871e('0x67')][_0x389fbf];var _0x2a7628=_0x41e725[_0x871e('0x78')]();_0x2a7628[_0x871e('0x40')](_0x871e('0x79'),_0x1e0f2f['id']);_0x3cb615[_0x871e('0x7a')](db[_0x871e('0x6b')][_0x871e('0x36')](_0x2a7628[_0x871e('0x7b')](),{'type':db[_0x871e('0x6b')][_0x871e('0x7c')][_0x871e('0x7d')]})[_0x871e('0x28')](function(_0x3d8650){if(_0x3d8650['length']===0x1){return _0x1e0f2f['id'];}else{var _0x587392=_[_0x871e('0x7e')](_[_0x871e('0x30')](_0x3d8650,_0x871e('0x7f')),function(_0x5819f9){return _['includes'](_0x197073,_0x5819f9);});if(_0x587392){return _0x1e0f2f['id'];}}}));}}return BPromise['all'](_0x3cb615)[_0x871e('0x28')](function(_0x459c1d){_0x2b9435=_(_0x2b9435)['union'](_0x459c1d)[_0x871e('0x80')]()['value']();return db[_0x871e('0x31')][_0x871e('0x50')]({'where':{'id':_0x3a98fc[_0x871e('0x53')]['id']}})[_0x871e('0x28')](function(_0x12255f){return db[_0x871e('0x6b')][_0x871e('0x81')](function(_0x1f9555){return _0x12255f['removeTeams'](_0x3a98fc[_0x871e('0x36')][_0x871e('0x66')],{'transaction':_0x1f9555})[_0x871e('0x28')](function(){if(!_[_0x871e('0x82')](_0x2b9435)){return _0x12255f[_0x871e('0x83')](_0x2b9435,{'transaction':_0x1f9555});}})[_0x871e('0x28')](function(){_0x2b9435[_0x871e('0x6e')](function(_0x30d126){socket['emit']('userOpenchannelQueue:remove',{'UserId':_0x30d126,'OpenchannelQueueId':_0x12255f['id']});});});});});});})[_0x871e('0x28')](respondWithStatusCode(_0x5ab9c6,null))[_0x871e('0x4a')](handleError(_0x5ab9c6,null));};exports[_0x871e('0x84')]=function(_0x29af1d,_0x36ffdf,_0x5ec4b1){return db[_0x871e('0x31')][_0x871e('0x50')]({'where':{'id':_0x29af1d['params']['id']}})[_0x871e('0x28')](handleEntityNotFound(_0x36ffdf,null))['then'](function(_0x44516c){if(_0x44516c){return _0x44516c[_0x871e('0x84')](_0x29af1d[_0x871e('0x4c')][_0x871e('0x66')],_[_0x871e('0x85')](_0x29af1d['body'],[_0x871e('0x66'),'id'])||{})['spread'](function(_0x2581f1){for(var _0x412314=0x0;_0x412314<_0x29af1d[_0x871e('0x4c')][_0x871e('0x66')]['length'];_0x412314+=0x1){socket['emit'](_0x871e('0x6f'),{'UserId':Number(_0x29af1d[_0x871e('0x4c')][_0x871e('0x66')][_0x412314]),'OpenchannelQueueId':Number(_0x29af1d['params']['id'])});}return _0x2581f1;});}})[_0x871e('0x28')](respondWithResult(_0x36ffdf,null))[_0x871e('0x4a')](handleError(_0x36ffdf,null));};exports[_0x871e('0x83')]=function(_0x1face2,_0x26a412,_0x56ee15){return db[_0x871e('0x31')][_0x871e('0x50')]({'where':{'id':_0x1face2[_0x871e('0x53')]['id']}})[_0x871e('0x28')](handleEntityNotFound(_0x26a412,null))[_0x871e('0x28')](function(_0x5610cb){if(_0x5610cb){return _0x5610cb[_0x871e('0x83')](_0x1face2[_0x871e('0x36')][_0x871e('0x66')])[_0x871e('0x28')](function(){if(_[_0x871e('0x86')](_0x1face2[_0x871e('0x36')][_0x871e('0x66')])){for(var _0x489c5c=0x0;_0x489c5c<_0x1face2[_0x871e('0x36')][_0x871e('0x66')][_0x871e('0x3c')];_0x489c5c+=0x1){socket[_0x871e('0x87')](_0x871e('0x88'),{'UserId':Number(_0x1face2[_0x871e('0x36')][_0x871e('0x66')][_0x489c5c]),'OpenchannelQueueId':Number(_0x1face2[_0x871e('0x53')]['id'])});}}else{socket[_0x871e('0x87')](_0x871e('0x88'),{'UserId':Number(_0x1face2['query'][_0x871e('0x66')]),'OpenchannelQueueId':Number(_0x1face2[_0x871e('0x53')]['id'])});}});}})[_0x871e('0x28')](respondWithStatusCode(_0x26a412,null))[_0x871e('0x4a')](handleError(_0x26a412,null));};exports[_0x871e('0x89')]=function(_0x180df2,_0x445952,_0x978851){var _0x1dc4e1={};var _0x2ee5f2={};var _0x22b816;var _0x4d2c29;return db[_0x871e('0x31')][_0x871e('0x56')]({'where':{'id':_0x180df2[_0x871e('0x53')]['id']}})[_0x871e('0x28')](handleEntityNotFound(_0x445952,null))[_0x871e('0x28')](function(_0x4c0731){if(_0x4c0731){_0x22b816=_0x4c0731;_0x2ee5f2[_0x871e('0x34')]=_[_0x871e('0x37')](db[_0x871e('0x5b')][_0x871e('0x48')]);_0x2ee5f2[_0x871e('0x36')]=_[_0x871e('0x37')](_0x180df2[_0x871e('0x36')]);_0x2ee5f2[_0x871e('0x38')]=_['intersection'](_0x2ee5f2[_0x871e('0x34')],_0x2ee5f2[_0x871e('0x36')]);_0x1dc4e1[_0x871e('0x3a')]=_[_0x871e('0x39')](_0x2ee5f2['model'],qs[_0x871e('0x3b')](_0x180df2['query'][_0x871e('0x3b')]));_0x1dc4e1[_0x871e('0x3a')]=_0x1dc4e1[_0x871e('0x3a')][_0x871e('0x3c')]?_0x1dc4e1[_0x871e('0x3a')]:_0x2ee5f2['model'];_0x1dc4e1['order']=qs[_0x871e('0x3f')](_0x180df2['query'][_0x871e('0x3f')]);_0x1dc4e1[_0x871e('0x40')]=qs['filters'](_['pick'](_0x180df2[_0x871e('0x36')],_0x2ee5f2[_0x871e('0x38')]));if(_0x180df2[_0x871e('0x36')]['filter']){_0x1dc4e1[_0x871e('0x40')]=_['merge'](_0x1dc4e1[_0x871e('0x40')],{'$or':_[_0x871e('0x30')](_0x1dc4e1['attributes'],function(_0x3e9213){var _0x2e914a={};_0x2e914a[_0x3e9213]={'$like':'%'+_0x180df2[_0x871e('0x36')][_0x871e('0x41')]+'%'};return _0x2e914a;})});}_0x1dc4e1=_[_0x871e('0x42')]({},_0x1dc4e1,_0x180df2[_0x871e('0x59')]);return _0x22b816[_0x871e('0x89')](_0x1dc4e1);}})[_0x871e('0x28')](function(_0x1ddc5d){if(_0x1ddc5d){_0x4d2c29=_0x1ddc5d['length'];if(!_0x180df2['query'][_0x871e('0x8a')]('nolimit')){_0x1dc4e1[_0x871e('0x23')]=qs[_0x871e('0x23')](_0x180df2[_0x871e('0x36')]['limit']);_0x1dc4e1[_0x871e('0x20')]=qs[_0x871e('0x20')](_0x180df2[_0x871e('0x36')]['offset']);}return _0x22b816[_0x871e('0x89')](_0x1dc4e1);}})['then'](function(_0x115245){if(_0x115245){return _0x115245?{'count':_0x4d2c29,'rows':_0x115245}:null;}})[_0x871e('0x28')](respondWithResult(_0x445952,null))['catch'](handleError(_0x445952,null));}; \ No newline at end of file +var _0x29e8=['sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','UserProfileResource','error','stack','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','OpenchannelQueue','includeAll','findAll','catch','show','params','rawAttributes','length','include','find','create','get','role','UserProfileSection','body','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','agent','openchannelPause','updatedAt','createdAt','rows','%s/%s','SIP','getTeams','Team','hasOwnProperty','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','compact','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register'];(function(_0x459ecb,_0x531e17){var _0x54a6fd=function(_0x43581a){while(--_0x43581a){_0x459ecb['push'](_0x459ecb['shift']());}};_0x54a6fd(++_0x531e17);}(_0x29e8,0x17b));var _0x829e=function(_0x191423,_0x2284a4){_0x191423=_0x191423-0x0;var _0x5b054a=_0x29e8[_0x191423];return _0x5b054a;};'use strict';var emlformat=require(_0x829e('0x0'));var rimraf=require(_0x829e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x829e('0x2'));var rp=require(_0x829e('0x3'));var moment=require('moment');var BPromise=require(_0x829e('0x4'));var Mustache=require(_0x829e('0x5'));var util=require('util');var path=require(_0x829e('0x6'));var sox=require(_0x829e('0x7'));var csv=require(_0x829e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x829e('0x9'));var _=require(_0x829e('0xa'));var squel=require(_0x829e('0xb'));var crypto=require(_0x829e('0xc'));var jsforce=require(_0x829e('0xd'));var deskjs=require(_0x829e('0xe'));var toCsv=require(_0x829e('0x8'));var querystring=require(_0x829e('0xf'));var Papa=require(_0x829e('0x10'));var Redis=require(_0x829e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x829e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x829e('0x13'));var logger=require(_0x829e('0x14'))(_0x829e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x829e('0x16'));var db=require(_0x829e('0x17'))['db'];config[_0x829e('0x18')]=_[_0x829e('0x19')](config[_0x829e('0x18')],{'host':_0x829e('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x829e('0x1b'))[_0x829e('0x1c')](socket);function respondWithStatusCode(_0x419975,_0x3f9dbb){_0x3f9dbb=_0x3f9dbb||0xcc;return function(_0x30d38d){if(_0x30d38d){return _0x419975[_0x829e('0x1d')](_0x3f9dbb);}return _0x419975[_0x829e('0x1e')](_0x3f9dbb)[_0x829e('0x1f')]();};}function respondWithResult(_0x402670,_0xbd96d8){_0xbd96d8=_0xbd96d8||0xc8;return function(_0xc0175){if(_0xc0175){return _0x402670[_0x829e('0x1e')](_0xbd96d8)[_0x829e('0x20')](_0xc0175);}};}function respondWithFilteredResult(_0x3645ca,_0x339e43){return function(_0x111dca){if(_0x111dca){var _0x58c767=typeof _0x339e43[_0x829e('0x21')]===_0x829e('0x22')&&typeof _0x339e43[_0x829e('0x23')]===_0x829e('0x22');var _0x1a1758=_0x111dca[_0x829e('0x24')];var _0xf7a222=_0x58c767?0x0:_0x339e43[_0x829e('0x21')];var _0x127c11=_0x58c767?_0x111dca['count']:_0x339e43[_0x829e('0x21')]+_0x339e43[_0x829e('0x23')];var _0x5f3732;if(_0x127c11>=_0x1a1758){_0x127c11=_0x1a1758;_0x5f3732=0xc8;}else{_0x5f3732=0xce;}_0x3645ca['status'](_0x5f3732);return _0x3645ca['set'](_0x829e('0x25'),_0xf7a222+'-'+_0x127c11+'/'+_0x1a1758)[_0x829e('0x20')](_0x111dca);}return null;};}function patchUpdates(_0x3d673f){return function(_0x1920d2){try{jsonpatch['apply'](_0x1920d2,_0x3d673f,!![]);}catch(_0x50ab02){return BPromise[_0x829e('0x26')](_0x50ab02);}return _0x1920d2[_0x829e('0x27')]();};}function saveUpdates(_0x212b3b,_0x14ed1b){return function(_0x453040){if(_0x453040){return _0x453040[_0x829e('0x28')](_0x212b3b)['then'](function(_0x5a4804){return _0x5a4804;});}return null;};}function removeEntity(_0x72b28b,_0x1636b0){return function(_0x134a05){if(_0x134a05){return _0x134a05[_0x829e('0x29')]()[_0x829e('0x2a')](function(){var _0x14b9a3=_0x134a05['get']({'plain':!![]});var _0x5724a2='OpenchannelQueues';return db[_0x829e('0x2b')][_0x829e('0x29')]({'where':{'type':_0x5724a2,'resourceId':_0x14b9a3['id']}})['then'](function(){return _0x134a05;});})['then'](function(){_0x72b28b[_0x829e('0x1e')](0xcc)[_0x829e('0x1f')]();});}};}function handleEntityNotFound(_0xa840f4,_0x556dad){return function(_0x3bf913){if(!_0x3bf913){_0xa840f4[_0x829e('0x1d')](0x194);}return _0x3bf913;};}function handleError(_0x364852,_0x1862e6){_0x1862e6=_0x1862e6||0x1f4;return function(_0x3c3e86){logger[_0x829e('0x2c')](_0x3c3e86[_0x829e('0x2d')]);if(_0x3c3e86[_0x829e('0x2e')]){delete _0x3c3e86[_0x829e('0x2e')];}_0x364852[_0x829e('0x1e')](_0x1862e6)[_0x829e('0x2f')](_0x3c3e86);};}exports['index']=function(_0x3198ae,_0x7a9d74){var _0x42bbb5={},_0x2116f2={},_0x1a4e86={'count':0x0,'rows':[]};var _0x449c06=_[_0x829e('0x30')](db['OpenchannelQueue']['rawAttributes'],function(_0x5c0d5d){return{'name':_0x5c0d5d[_0x829e('0x31')],'type':_0x5c0d5d[_0x829e('0x32')][_0x829e('0x33')]};});_0x2116f2[_0x829e('0x34')]=_['map'](_0x449c06,_0x829e('0x2e'));_0x2116f2[_0x829e('0x35')]=_[_0x829e('0x36')](_0x3198ae[_0x829e('0x35')]);_0x2116f2[_0x829e('0x37')]=_[_0x829e('0x38')](_0x2116f2[_0x829e('0x34')],_0x2116f2[_0x829e('0x35')]);_0x42bbb5[_0x829e('0x39')]=_[_0x829e('0x38')](_0x2116f2[_0x829e('0x34')],qs[_0x829e('0x3a')](_0x3198ae['query'][_0x829e('0x3a')]));_0x42bbb5[_0x829e('0x39')]=_0x42bbb5[_0x829e('0x39')]['length']?_0x42bbb5[_0x829e('0x39')]:_0x2116f2[_0x829e('0x34')];if(!_0x3198ae[_0x829e('0x35')]['hasOwnProperty'](_0x829e('0x3b'))){_0x42bbb5['limit']=qs['limit'](_0x3198ae[_0x829e('0x35')][_0x829e('0x23')]);_0x42bbb5[_0x829e('0x21')]=qs[_0x829e('0x21')](_0x3198ae[_0x829e('0x35')][_0x829e('0x21')]);}_0x42bbb5[_0x829e('0x3c')]=qs['sort'](_0x3198ae[_0x829e('0x35')][_0x829e('0x3d')]);_0x42bbb5[_0x829e('0x3e')]=qs['filters'](_[_0x829e('0x3f')](_0x3198ae[_0x829e('0x35')],_0x2116f2[_0x829e('0x37')]),_0x449c06);if(_0x3198ae[_0x829e('0x35')][_0x829e('0x40')]){_0x42bbb5[_0x829e('0x3e')]=_['merge'](_0x42bbb5[_0x829e('0x3e')],{'$or':_[_0x829e('0x30')](_0x449c06,function(_0x4d78b9){if(_0x4d78b9[_0x829e('0x32')]!==_0x829e('0x41')){var _0x409cdf={};_0x409cdf[_0x4d78b9[_0x829e('0x2e')]]={'$like':'%'+_0x3198ae[_0x829e('0x35')][_0x829e('0x40')]+'%'};return _0x409cdf;}})});}_0x42bbb5=_[_0x829e('0x42')]({},_0x42bbb5,_0x3198ae[_0x829e('0x43')]);var _0x192fd9={'where':_0x42bbb5[_0x829e('0x3e')]};return db[_0x829e('0x44')][_0x829e('0x24')](_0x192fd9)['then'](function(_0x26c47c){_0x1a4e86[_0x829e('0x24')]=_0x26c47c;if(_0x3198ae[_0x829e('0x35')][_0x829e('0x45')]){_0x42bbb5['include']=[{'all':!![]}];}return db[_0x829e('0x44')][_0x829e('0x46')](_0x42bbb5);})['then'](function(_0x1437ad){_0x1a4e86['rows']=_0x1437ad;return _0x1a4e86;})[_0x829e('0x2a')](respondWithFilteredResult(_0x7a9d74,_0x42bbb5))[_0x829e('0x47')](handleError(_0x7a9d74,null));};exports[_0x829e('0x48')]=function(_0x4e7486,_0x5ec418){var _0x186692={'raw':!![],'where':{'id':_0x4e7486[_0x829e('0x49')]['id']}},_0xbf99={};_0xbf99[_0x829e('0x34')]=_['keys'](db[_0x829e('0x44')][_0x829e('0x4a')]);_0xbf99[_0x829e('0x35')]=_[_0x829e('0x36')](_0x4e7486[_0x829e('0x35')]);_0xbf99[_0x829e('0x37')]=_[_0x829e('0x38')](_0xbf99[_0x829e('0x34')],_0xbf99[_0x829e('0x35')]);_0x186692[_0x829e('0x39')]=_['intersection'](_0xbf99['model'],qs[_0x829e('0x3a')](_0x4e7486[_0x829e('0x35')][_0x829e('0x3a')]));_0x186692[_0x829e('0x39')]=_0x186692['attributes'][_0x829e('0x4b')]?_0x186692[_0x829e('0x39')]:_0xbf99[_0x829e('0x34')];if(_0x4e7486[_0x829e('0x35')][_0x829e('0x45')]){_0x186692[_0x829e('0x4c')]=[{'all':!![]}];}_0x186692=_['merge']({},_0x186692,_0x4e7486[_0x829e('0x43')]);return db['OpenchannelQueue'][_0x829e('0x4d')](_0x186692)[_0x829e('0x2a')](handleEntityNotFound(_0x5ec418,null))[_0x829e('0x2a')](respondWithResult(_0x5ec418,null))['catch'](handleError(_0x5ec418,null));};exports[_0x829e('0x4e')]=function(_0x1b7aad,_0x51548b){return db['OpenchannelQueue'][_0x829e('0x4e')](_0x1b7aad['body'],{})[_0x829e('0x2a')](function(_0x5a2f4b){var _0x1e1b74=_0x1b7aad['user'][_0x829e('0x4f')]({'plain':!![]});if(!_0x1e1b74)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e1b74[_0x829e('0x50')]==='user'){var _0x2b94f8=_0x5a2f4b[_0x829e('0x4f')]({'plain':!![]});var _0x3c6307='OpenchannelQueues';return db[_0x829e('0x51')][_0x829e('0x4d')]({'where':{'name':_0x3c6307,'userProfileId':_0x1e1b74['userProfileId']},'raw':!![]})[_0x829e('0x2a')](function(_0x54b531){if(_0x54b531&&_0x54b531['autoAssociation']===0x0){return db[_0x829e('0x2b')][_0x829e('0x4e')]({'name':_0x2b94f8['name'],'resourceId':_0x2b94f8['id'],'type':_0x54b531[_0x829e('0x2e')],'sectionId':_0x54b531['id']},{})[_0x829e('0x2a')](function(){return _0x5a2f4b;});}else{return _0x5a2f4b;}})[_0x829e('0x47')](function(_0x501f19){logger[_0x829e('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x501f19);throw _0x501f19;});}return _0x5a2f4b;})[_0x829e('0x2a')](respondWithResult(_0x51548b,0xc9))[_0x829e('0x47')](handleError(_0x51548b,null));};exports[_0x829e('0x28')]=function(_0x3f7d6e,_0x2d9b7f){if(_0x3f7d6e[_0x829e('0x52')]['id']){delete _0x3f7d6e[_0x829e('0x52')]['id'];}return db[_0x829e('0x44')][_0x829e('0x4d')]({'where':{'id':_0x3f7d6e[_0x829e('0x49')]['id']}})[_0x829e('0x2a')](handleEntityNotFound(_0x2d9b7f,null))[_0x829e('0x2a')](saveUpdates(_0x3f7d6e[_0x829e('0x52')],null))['then'](respondWithResult(_0x2d9b7f,null))[_0x829e('0x47')](handleError(_0x2d9b7f,null));};exports[_0x829e('0x29')]=function(_0x13ab3b,_0x473513){return db['OpenchannelQueue']['find']({'where':{'id':_0x13ab3b[_0x829e('0x49')]['id']}})[_0x829e('0x2a')](handleEntityNotFound(_0x473513,null))['then'](removeEntity(_0x473513,null))[_0x829e('0x47')](handleError(_0x473513,null));};exports['describe']=function(_0x53bbb2,_0x5d1cbb){return db[_0x829e('0x44')][_0x829e('0x53')]()[_0x829e('0x2a')](respondWithResult(_0x5d1cbb,null))[_0x829e('0x47')](handleError(_0x5d1cbb,null));};exports[_0x829e('0x54')]=function(_0x2f2f37,_0x36e2a6,_0x1c62be){var _0x528845={'raw':!![],'where':{}},_0x356580={},_0x148ec6;return db[_0x829e('0x44')][_0x829e('0x55')]({'where':{'id':_0x2f2f37['params']['id']}})[_0x829e('0x2a')](handleEntityNotFound(_0x36e2a6,null))[_0x829e('0x2a')](function(_0x56364b){if(_0x56364b){_0x148ec6=_0x56364b[_0x829e('0x4f')]({'plain':!![]});_0x356580[_0x829e('0x34')]=_[_0x829e('0x36')](db[_0x829e('0x56')]['rawAttributes']);_0x356580[_0x829e('0x35')]=_['keys'](_0x2f2f37[_0x829e('0x35')]);_0x356580[_0x829e('0x37')]=_[_0x829e('0x38')](_0x356580[_0x829e('0x34')],_0x356580[_0x829e('0x35')]);_0x528845[_0x829e('0x39')]=_[_0x829e('0x38')](_0x356580['model'],qs[_0x829e('0x3a')](_0x2f2f37['query'][_0x829e('0x3a')]));_0x528845[_0x829e('0x39')]=_0x528845[_0x829e('0x39')][_0x829e('0x4b')]?_0x528845[_0x829e('0x39')]:_0x356580[_0x829e('0x34')];if(!_0x2f2f37[_0x829e('0x35')]['hasOwnProperty'](_0x829e('0x3b'))){_0x528845[_0x829e('0x23')]=qs[_0x829e('0x23')](_0x2f2f37[_0x829e('0x35')][_0x829e('0x23')]);_0x528845['offset']=qs[_0x829e('0x21')](_0x2f2f37[_0x829e('0x35')][_0x829e('0x21')]);}_0x528845[_0x829e('0x3c')]=qs['sort'](_0x2f2f37[_0x829e('0x35')][_0x829e('0x3d')]);_0x528845['where']=qs[_0x829e('0x37')](_['pick'](_0x2f2f37['query'],_0x356580['filters']));_0x528845[_0x829e('0x3e')][_0x829e('0x57')]=_0x56364b['id'];if(_0x2f2f37['query'][_0x829e('0x40')]){_0x528845['where']=_['merge'](_0x528845[_0x829e('0x3e')],{'$or':_[_0x829e('0x30')](_0x528845[_0x829e('0x39')],function(_0x452232){var _0x4e6bae={};_0x4e6bae[_0x452232]={'$like':'%'+_0x2f2f37[_0x829e('0x35')][_0x829e('0x40')]+'%'};return _0x4e6bae;})});}_0x528845=_[_0x829e('0x42')]({},_0x528845,_0x2f2f37[_0x829e('0x43')]);return db[_0x829e('0x56')][_0x829e('0x46')](_0x528845);}})['then'](function(_0x418246){if(_0x418246){return db[_0x829e('0x58')]['findAndCountAll']({'where':{'id':_[_0x829e('0x30')](_0x418246,'UserId'),'role':_0x829e('0x59')},'attributes':['id',_0x829e('0x2e'),_0x829e('0x5a'),_0x829e('0x5b'),_0x829e('0x5c')]});}})[_0x829e('0x2a')](function(_0xec011c){if(_0xec011c){return{'count':_0xec011c[_0x829e('0x24')],'rows':_[_0x829e('0x30')](_0xec011c[_0x829e('0x5d')],function(_0x127deb){return{'membername':_0x127deb[_0x829e('0x2e')],'UserId':_0x127deb['id'],'queue_name':_0x148ec6[_0x829e('0x2e')],'OpenchannelQueueId':_0x148ec6['id'],'interface':util['format'](_0x829e('0x5e'),_0x829e('0x5f'),_0x127deb[_0x829e('0x2e')]),'penalty':0x0,'paused':_0x127deb[_0x829e('0x5a')],'createdAt':_0x127deb[_0x829e('0x5c')],'updatedAt':_0x127deb[_0x829e('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x36e2a6,_0x528845))[_0x829e('0x47')](handleError(_0x36e2a6,null));};exports[_0x829e('0x60')]=function(_0x187cdc,_0x14f135,_0x504694){var _0x430c9a={};var _0x2d5d00={};var _0x521487;var _0x2ebfbc;return db[_0x829e('0x44')][_0x829e('0x55')]({'where':{'id':_0x187cdc['params']['id']}})[_0x829e('0x2a')](handleEntityNotFound(_0x14f135,null))[_0x829e('0x2a')](function(_0x197a9c){if(_0x197a9c){_0x521487=_0x197a9c;_0x2d5d00['model']=_[_0x829e('0x36')](db[_0x829e('0x61')][_0x829e('0x4a')]);_0x2d5d00[_0x829e('0x35')]=_[_0x829e('0x36')](_0x187cdc[_0x829e('0x35')]);_0x2d5d00['filters']=_[_0x829e('0x38')](_0x2d5d00['model'],_0x2d5d00[_0x829e('0x35')]);_0x430c9a[_0x829e('0x39')]=_[_0x829e('0x38')](_0x2d5d00[_0x829e('0x34')],qs[_0x829e('0x3a')](_0x187cdc[_0x829e('0x35')][_0x829e('0x3a')]));_0x430c9a['attributes']=_0x430c9a[_0x829e('0x39')][_0x829e('0x4b')]?_0x430c9a[_0x829e('0x39')]:_0x2d5d00['model'];_0x430c9a['order']=qs[_0x829e('0x3d')](_0x187cdc['query'][_0x829e('0x3d')]);_0x430c9a['where']=qs[_0x829e('0x37')](_['pick'](_0x187cdc[_0x829e('0x35')],_0x2d5d00[_0x829e('0x37')]));if(_0x187cdc[_0x829e('0x35')][_0x829e('0x40')]){_0x430c9a[_0x829e('0x3e')]=_[_0x829e('0x42')](_0x430c9a[_0x829e('0x3e')],{'$or':_[_0x829e('0x30')](_0x430c9a[_0x829e('0x39')],function(_0x23a166){var _0x32b2f2={};_0x32b2f2[_0x23a166]={'$like':'%'+_0x187cdc[_0x829e('0x35')][_0x829e('0x40')]+'%'};return _0x32b2f2;})});}_0x430c9a=_[_0x829e('0x42')]({},_0x430c9a,_0x187cdc[_0x829e('0x43')]);return _0x521487[_0x829e('0x60')](_0x430c9a);}})['then'](function(_0x1d021c){if(_0x1d021c){_0x2ebfbc=_0x1d021c[_0x829e('0x4b')];if(!_0x187cdc[_0x829e('0x35')][_0x829e('0x62')](_0x829e('0x3b'))){_0x430c9a[_0x829e('0x23')]=qs[_0x829e('0x23')](_0x187cdc[_0x829e('0x35')][_0x829e('0x23')]);_0x430c9a[_0x829e('0x21')]=qs[_0x829e('0x21')](_0x187cdc[_0x829e('0x35')]['offset']);}return _0x521487[_0x829e('0x60')](_0x430c9a);}})['then'](function(_0x59f2de){if(_0x59f2de){return _0x59f2de?{'count':_0x2ebfbc,'rows':_0x59f2de}:null;}})[_0x829e('0x2a')](respondWithResult(_0x14f135,null))[_0x829e('0x47')](handleError(_0x14f135,null));};exports[_0x829e('0x63')]=function(_0x4b42e1,_0x54ae59,_0x53dbc2){var _0x242841=_0x4b42e1['body'][_0x829e('0x64')];return db[_0x829e('0x61')][_0x829e('0x46')]({'where':{'id':_0x242841},'attributes':['id'],'include':[{'model':db['User'],'as':_0x829e('0x65'),'attributes':['id',_0x829e('0x2e'),_0x829e('0x66'),_0x829e('0x67'),_0x829e('0x68')],'raw':!![]}]})['then'](function(_0x22b0a7){if(_0x22b0a7){var _0x2e1d7d=_['flatMap'](_0x22b0a7,function(_0x995574){var _0x3e661a=_0x995574['get']({'plain':!![]});return _0x3e661a[_0x829e('0x65')];});return db[_0x829e('0x44')]['find']({'where':{'id':_0x4b42e1[_0x829e('0x49')]['id']}})[_0x829e('0x2a')](function(_0x349685){return db[_0x829e('0x69')][_0x829e('0x6a')](function(_0x304d52){return _0x349685[_0x829e('0x63')](_0x242841,{'transaction':_0x304d52})[_0x829e('0x2a')](function(){return BPromise['each'](_0x2e1d7d,function(_0x5fc003){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x5fc003['id'],'OpenchannelQueueId':_0x4b42e1[_0x829e('0x49')]['id']},'transaction':_0x304d52});});})[_0x829e('0x2a')](function(){_0x2e1d7d['forEach'](function(_0x13b8e8){socket[_0x829e('0x6b')](_0x829e('0x6c'),{'UserId':_0x13b8e8['id'],'OpenchannelQueueId':_0x349685['id']});});});});});}})['then'](respondWithStatusCode(_0x54ae59,null))[_0x829e('0x47')](handleError(_0x54ae59,null));};exports[_0x829e('0x6d')]=function(_0x2479f7,_0x50211a,_0x2202b7){return db[_0x829e('0x61')][_0x829e('0x46')]({'where':{'id':_0x2479f7[_0x829e('0x35')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x829e('0x65'),'attributes':['id'],'raw':!![]}]})[_0x829e('0x2a')](handleEntityNotFound(_0x50211a,null))['then'](function(_0x5947ed){var _0x40102b=_[_0x829e('0x30')](_0x5947ed,'id');var _0x5afff1=[];var _0x2a2bf1=[];var _0x50efe3=squel[_0x829e('0x6e')]();_0x50efe3[_0x829e('0x6f')](_0x829e('0x70'))[_0x829e('0x71')](_0x829e('0x72'),'tq')['join'](_0x829e('0x73'),'ut',_0x829e('0x74'))[_0x829e('0x3e')](_0x829e('0x75'),_0x2479f7[_0x829e('0x49')]['id']);for(var _0x4c71c4=0x0;_0x4c71c4<_0x5947ed[_0x829e('0x4b')];_0x4c71c4+=0x1){let _0x1a6332=_0x5947ed[_0x4c71c4];for(var _0x4a07ab=0x0;_0x4a07ab<_0x1a6332[_0x829e('0x65')]['length'];_0x4a07ab+=0x1){let _0x4e14ed=_0x1a6332['Agents'][_0x4a07ab];var _0x3bc6f4=_0x50efe3[_0x829e('0x76')]();_0x3bc6f4[_0x829e('0x3e')](_0x829e('0x77'),_0x4e14ed['id']);_0x2a2bf1[_0x829e('0x78')](db[_0x829e('0x69')]['query'](_0x3bc6f4[_0x829e('0x79')](),{'type':db[_0x829e('0x69')][_0x829e('0x7a')][_0x829e('0x7b')]})[_0x829e('0x2a')](function(_0x4477fd){if(_0x4477fd[_0x829e('0x4b')]===0x1){return _0x4e14ed['id'];}else{var _0x12c664=_[_0x829e('0x7c')](_['map'](_0x4477fd,_0x829e('0x7d')),function(_0x436c90){return _[_0x829e('0x7e')](_0x40102b,_0x436c90);});if(_0x12c664){return _0x4e14ed['id'];}}}));}}return BPromise['all'](_0x2a2bf1)[_0x829e('0x2a')](function(_0x48dd15){_0x5afff1=_(_0x5afff1)['union'](_0x48dd15)[_0x829e('0x7f')]()['value']();return db[_0x829e('0x44')]['find']({'where':{'id':_0x2479f7[_0x829e('0x49')]['id']}})[_0x829e('0x2a')](function(_0x160203){return db[_0x829e('0x69')][_0x829e('0x6a')](function(_0x18cdf){return _0x160203[_0x829e('0x6d')](_0x2479f7[_0x829e('0x35')]['ids'],{'transaction':_0x18cdf})['then'](function(){if(!_[_0x829e('0x80')](_0x5afff1)){return _0x160203[_0x829e('0x81')](_0x5afff1,{'transaction':_0x18cdf});}})[_0x829e('0x2a')](function(){_0x5afff1[_0x829e('0x82')](function(_0x4c148d){socket[_0x829e('0x6b')](_0x829e('0x83'),{'UserId':_0x4c148d,'OpenchannelQueueId':_0x160203['id']});});});});});});})[_0x829e('0x2a')](respondWithStatusCode(_0x50211a,null))[_0x829e('0x47')](handleError(_0x50211a,null));};exports[_0x829e('0x84')]=function(_0x44e047,_0xbfb106,_0x19a81e){return db['OpenchannelQueue']['find']({'where':{'id':_0x44e047[_0x829e('0x49')]['id']}})[_0x829e('0x2a')](handleEntityNotFound(_0xbfb106,null))['then'](function(_0x27e667){if(_0x27e667){return _0x27e667['addAgents'](_0x44e047[_0x829e('0x52')]['ids'],_[_0x829e('0x85')](_0x44e047['body'],[_0x829e('0x64'),'id'])||{})['spread'](function(_0x51c355){for(var _0x220d57=0x0;_0x220d57<_0x44e047[_0x829e('0x52')]['ids']['length'];_0x220d57+=0x1){socket[_0x829e('0x6b')](_0x829e('0x6c'),{'UserId':Number(_0x44e047['body'][_0x829e('0x64')][_0x220d57]),'OpenchannelQueueId':Number(_0x44e047[_0x829e('0x49')]['id'])});}return _0x51c355;});}})[_0x829e('0x2a')](respondWithResult(_0xbfb106,null))[_0x829e('0x47')](handleError(_0xbfb106,null));};exports['removeAgents']=function(_0x30d57b,_0x5d785c,_0x281119){return db[_0x829e('0x44')][_0x829e('0x4d')]({'where':{'id':_0x30d57b[_0x829e('0x49')]['id']}})['then'](handleEntityNotFound(_0x5d785c,null))[_0x829e('0x2a')](function(_0x36d278){if(_0x36d278){return _0x36d278[_0x829e('0x81')](_0x30d57b[_0x829e('0x35')][_0x829e('0x64')])[_0x829e('0x2a')](function(){if(_[_0x829e('0x86')](_0x30d57b['query'][_0x829e('0x64')])){for(var _0x14cda9=0x0;_0x14cda9<_0x30d57b[_0x829e('0x35')]['ids'][_0x829e('0x4b')];_0x14cda9+=0x1){socket[_0x829e('0x6b')](_0x829e('0x83'),{'UserId':Number(_0x30d57b[_0x829e('0x35')][_0x829e('0x64')][_0x14cda9]),'OpenchannelQueueId':Number(_0x30d57b[_0x829e('0x49')]['id'])});}}else{socket[_0x829e('0x6b')](_0x829e('0x83'),{'UserId':Number(_0x30d57b[_0x829e('0x35')][_0x829e('0x64')]),'OpenchannelQueueId':Number(_0x30d57b[_0x829e('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x5d785c,null))[_0x829e('0x47')](handleError(_0x5d785c,null));};exports[_0x829e('0x87')]=function(_0x50be93,_0xf4aee,_0x3b15ff){var _0x14cd9e={};var _0x48947f={};var _0xf1491b;var _0x322892;return db[_0x829e('0x44')]['findOne']({'where':{'id':_0x50be93[_0x829e('0x49')]['id']}})[_0x829e('0x2a')](handleEntityNotFound(_0xf4aee,null))[_0x829e('0x2a')](function(_0x35e92e){if(_0x35e92e){_0xf1491b=_0x35e92e;_0x48947f[_0x829e('0x34')]=_['keys'](db[_0x829e('0x58')][_0x829e('0x4a')]);_0x48947f[_0x829e('0x35')]=_['keys'](_0x50be93[_0x829e('0x35')]);_0x48947f[_0x829e('0x37')]=_[_0x829e('0x38')](_0x48947f['model'],_0x48947f['query']);_0x14cd9e[_0x829e('0x39')]=_[_0x829e('0x38')](_0x48947f[_0x829e('0x34')],qs[_0x829e('0x3a')](_0x50be93[_0x829e('0x35')][_0x829e('0x3a')]));_0x14cd9e[_0x829e('0x39')]=_0x14cd9e[_0x829e('0x39')]['length']?_0x14cd9e[_0x829e('0x39')]:_0x48947f[_0x829e('0x34')];_0x14cd9e[_0x829e('0x3c')]=qs['sort'](_0x50be93['query'][_0x829e('0x3d')]);_0x14cd9e[_0x829e('0x3e')]=qs[_0x829e('0x37')](_[_0x829e('0x3f')](_0x50be93[_0x829e('0x35')],_0x48947f[_0x829e('0x37')]));if(_0x50be93['query'][_0x829e('0x40')]){_0x14cd9e[_0x829e('0x3e')]=_[_0x829e('0x42')](_0x14cd9e[_0x829e('0x3e')],{'$or':_[_0x829e('0x30')](_0x14cd9e[_0x829e('0x39')],function(_0x2c2217){var _0x534f43={};_0x534f43[_0x2c2217]={'$like':'%'+_0x50be93[_0x829e('0x35')]['filter']+'%'};return _0x534f43;})});}_0x14cd9e=_['merge']({},_0x14cd9e,_0x50be93[_0x829e('0x43')]);return _0xf1491b[_0x829e('0x87')](_0x14cd9e);}})['then'](function(_0x556ff8){if(_0x556ff8){_0x322892=_0x556ff8['length'];if(!_0x50be93[_0x829e('0x35')][_0x829e('0x62')]('nolimit')){_0x14cd9e[_0x829e('0x23')]=qs[_0x829e('0x23')](_0x50be93[_0x829e('0x35')][_0x829e('0x23')]);_0x14cd9e[_0x829e('0x21')]=qs['offset'](_0x50be93[_0x829e('0x35')][_0x829e('0x21')]);}return _0xf1491b[_0x829e('0x87')](_0x14cd9e);}})[_0x829e('0x2a')](function(_0x589cec){if(_0x589cec){return _0x589cec?{'count':_0x322892,'rows':_0x589cec}:null;}})[_0x829e('0x2a')](respondWithResult(_0xf4aee,null))[_0x829e('0x47')](handleError(_0xf4aee,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index bfb4474..ba99d65 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 _0x291d=['remove','emit','hasOwnProperty','hook','../../mysqldb','OpenchannelQueue','save','update'];(function(_0x1da9ee,_0xbd9e7e){var _0x35dfa8=function(_0x250081){while(--_0x250081){_0x1da9ee['push'](_0x1da9ee['shift']());}};_0x35dfa8(++_0xbd9e7e);}(_0x291d,0x1cc));var _0xd291=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x291d[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xd291('0x0'))['db'][_0xd291('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd291('0x2'),'afterUpdate':_0xd291('0x3'),'afterDestroy':_0xd291('0x4')};function emitEvent(_0x568765){return function(_0xd3df14,_0x18fa71,_0x196480){OpenchannelQueueEvents[_0xd291('0x5')](_0x568765+':'+_0xd3df14['id'],_0xd3df14);OpenchannelQueueEvents['emit'](_0x568765,_0xd3df14);_0x196480(null);};}for(var e in events){if(events[_0xd291('0x6')](e)){var event=events[e];OpenchannelQueue[_0xd291('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x916f=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove'];(function(_0x860b7b,_0x15ee50){var _0x123e88=function(_0x3c8a70){while(--_0x3c8a70){_0x860b7b['push'](_0x860b7b['shift']());}};_0x123e88(++_0x15ee50);}(_0x916f,0x1b4));var _0xf916=function(_0x4b094c,_0x24722a){_0x4b094c=_0x4b094c-0x0;var _0x4027fa=_0x916f[_0x4b094c];return _0x4027fa;};'use strict';var EventEmitter=require(_0xf916('0x0'));var OpenchannelQueue=require(_0xf916('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf916('0x2'),'afterUpdate':_0xf916('0x3'),'afterDestroy':_0xf916('0x4')};function emitEvent(_0x416014){return function(_0x400dde,_0x21c569,_0xcdcd7f){OpenchannelQueueEvents[_0xf916('0x5')](_0x416014+':'+_0x400dde['id'],_0x400dde);OpenchannelQueueEvents[_0xf916('0x5')](_0x416014,_0x400dde);_0xcdcd7f(null);};}for(var e in events){if(events[_0xf916('0x6')](e)){var event=events[e];OpenchannelQueue[_0xf916('0x7')](e,emitEvent(event));}}module[_0xf916('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index f59461f..a2e5797 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 _0xc7e3=['openchannel_queues','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','exports','define','OpenchannelQueue'];(function(_0x5e4ec9,_0x4ead71){var _0x2a03f5=function(_0x536f80){while(--_0x536f80){_0x5e4ec9['push'](_0x5e4ec9['shift']());}};_0x2a03f5(++_0x4ead71);}(_0xc7e3,0x1f0));var _0x3c7e=function(_0x260f64,_0x1d9db2){_0x260f64=_0x260f64-0x0;var _0x2c7abc=_0xc7e3[_0x260f64];return _0x2c7abc;};'use strict';var _=require(_0x3c7e('0x0'));var util=require(_0x3c7e('0x1'));var logger=require(_0x3c7e('0x2'))(_0x3c7e('0x3'));var moment=require('moment');var BPromise=require(_0x3c7e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3c7e('0x5'));var rimraf=require('rimraf');var config=require(_0x3c7e('0x6'));var attributes=require('./openchannelQueue.attributes');module[_0x3c7e('0x7')]=function(_0x194d7e,_0x2dd38a){return _0x194d7e[_0x3c7e('0x8')](_0x3c7e('0x9'),attributes,{'tableName':_0x3c7e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38b2=['rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','openchannel_queues','lodash','util','request-promise','path'];(function(_0x2c70f3,_0x3bd2a9){var _0x517a5f=function(_0x2e6355){while(--_0x2e6355){_0x2c70f3['push'](_0x2c70f3['shift']());}};_0x517a5f(++_0x3bd2a9);}(_0x38b2,0x1d2));var _0x238b=function(_0x585b8b,_0x2bb23f){_0x585b8b=_0x585b8b-0x0;var _0xd38738=_0x38b2[_0x585b8b];return _0xd38738;};'use strict';var _=require(_0x238b('0x0'));var util=require(_0x238b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x238b('0x2'));var fs=require('fs');var path=require(_0x238b('0x3'));var rimraf=require(_0x238b('0x4'));var config=require(_0x238b('0x5'));var attributes=require(_0x238b('0x6'));module[_0x238b('0x7')]=function(_0x271349,_0x2c1315){return _0x271349[_0x238b('0x8')]('OpenchannelQueue',attributes,{'tableName':_0x238b('0x9'),'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 6bd7d1d..3ff4609 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 _0x7b09=['map','model','debug','ShowOpenchannelQueue','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7b09,0xcd));var _0x97b0=function(_0x1db69a,_0x12d160){_0x1db69a=_0x1db69a-0x0;var _0x7c9840=_0x7b09[_0x1db69a];return _0x7c9840;};'use strict';var _=require(_0x97b0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x97b0('0x1'));var rs=require(_0x97b0('0x2'));var fs=require('fs');var Redis=require(_0x97b0('0x3'));var db=require(_0x97b0('0x4'))['db'];var utils=require(_0x97b0('0x5'));var logger=require(_0x97b0('0x6'))(_0x97b0('0x7'));var config=require(_0x97b0('0x8'));var jayson=require(_0x97b0('0x9'));var client=jayson[_0x97b0('0xa')][_0x97b0('0xb')]({'port':0x232a});config[_0x97b0('0xc')]=_[_0x97b0('0xd')](config[_0x97b0('0xc')],{'host':_0x97b0('0xe'),'port':0x18eb});var socket=require(_0x97b0('0xf'))(new Redis(config[_0x97b0('0xc')]));require(_0x97b0('0x10'))[_0x97b0('0x11')](socket);function respondWithRpcPromise(_0x37037a,_0x40bab7,_0x59a088){return new BPromise(function(_0x2ef5ef,_0x4af81b){return client['request'](_0x37037a,_0x59a088)[_0x97b0('0x12')](function(_0x3db908){logger[_0x97b0('0x13')](_0x97b0('0x14'),_0x40bab7,_0x97b0('0x15'));logger['debug'](_0x97b0('0x16'),_0x40bab7,'request\x20sent',JSON[_0x97b0('0x17')](_0x3db908));if(_0x3db908[_0x97b0('0x18')]){if(_0x3db908[_0x97b0('0x18')]['code']===0x1f4){logger[_0x97b0('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x40bab7,_0x3db908[_0x97b0('0x18')]['message']);return _0x4af81b(_0x3db908[_0x97b0('0x18')][_0x97b0('0x19')]);}logger[_0x97b0('0x18')](_0x97b0('0x14'),_0x40bab7,_0x3db908['error'][_0x97b0('0x19')]);return _0x2ef5ef(_0x3db908[_0x97b0('0x18')][_0x97b0('0x19')]);}else{logger[_0x97b0('0x13')](_0x97b0('0x14'),_0x40bab7,_0x97b0('0x15'));_0x2ef5ef(_0x3db908['result']['message']);}})[_0x97b0('0x1a')](function(_0x1a57ce){logger[_0x97b0('0x18')](_0x97b0('0x14'),_0x40bab7,_0x1a57ce);_0x4af81b(_0x1a57ce);});});}exports[_0x97b0('0x1b')]=function(_0xc112fd){var _0x1443e4=this;return new Promise(function(_0x2bb2ad,_0x1d77d9){return db[_0x97b0('0x1c')][_0x97b0('0x1d')]({'raw':_0xc112fd[_0x97b0('0x1e')]?_0xc112fd[_0x97b0('0x1e')][_0x97b0('0x1f')]===undefined?!![]:![]:!![],'where':_0xc112fd['options']?_0xc112fd[_0x97b0('0x1e')][_0x97b0('0x20')]||null:null,'attributes':_0xc112fd[_0x97b0('0x1e')]?_0xc112fd[_0x97b0('0x1e')][_0x97b0('0x21')]||null:null,'limit':_0xc112fd[_0x97b0('0x1e')]?_0xc112fd[_0x97b0('0x1e')]['limit']||null:null,'include':_0xc112fd[_0x97b0('0x1e')]?_0xc112fd[_0x97b0('0x1e')][_0x97b0('0x22')]?_[_0x97b0('0x23')](_0xc112fd['options'][_0x97b0('0x22')],function(_0xb63eb2){return{'model':db[_0xb63eb2[_0x97b0('0x24')]],'as':_0xb63eb2['as'],'attributes':_0xb63eb2[_0x97b0('0x21')],'include':_0xb63eb2[_0x97b0('0x22')]?_['map'](_0xb63eb2['include'],function(_0x5c49f6){return{'model':db[_0x5c49f6['model']],'as':_0x5c49f6['as'],'attributes':_0x5c49f6['attributes'],'include':_0x5c49f6['include']?_[_0x97b0('0x23')](_0x5c49f6[_0x97b0('0x22')],function(_0x1a4bff){return{'model':db[_0x1a4bff[_0x97b0('0x24')]],'as':_0x1a4bff['as'],'attributes':_0x1a4bff[_0x97b0('0x21')]};}):[]};}):[]};}):[]:[]})[_0x97b0('0x12')](function(_0x4fb82a){logger['info']('GetOpenchannelQueue',_0xc112fd);logger[_0x97b0('0x25')]('GetOpenchannelQueue',_0xc112fd,JSON[_0x97b0('0x17')](_0x4fb82a));_0x2bb2ad(_0x4fb82a);})[_0x97b0('0x1a')](function(_0x28d3fd){logger['error'](_0x97b0('0x1b'),_0x28d3fd[_0x97b0('0x19')],_0xc112fd);_0x1d77d9(_0x1443e4[_0x97b0('0x18')](0x1f4,_0x28d3fd[_0x97b0('0x19')]));});});};exports[_0x97b0('0x26')]=function(_0x13fb52){var _0x280ef6=this;return new Promise(function(_0x6aa1b9,_0x547b4c){return db[_0x97b0('0x1c')][_0x97b0('0x27')]({'raw':_0x13fb52[_0x97b0('0x1e')]?_0x13fb52[_0x97b0('0x1e')][_0x97b0('0x1f')]===undefined?!![]:![]:!![],'where':_0x13fb52[_0x97b0('0x1e')]?_0x13fb52[_0x97b0('0x1e')][_0x97b0('0x20')]||null:null,'attributes':_0x13fb52[_0x97b0('0x1e')]?_0x13fb52[_0x97b0('0x1e')][_0x97b0('0x21')]||null:null,'include':_0x13fb52[_0x97b0('0x1e')]?_0x13fb52['options'][_0x97b0('0x22')]?_[_0x97b0('0x23')](_0x13fb52[_0x97b0('0x1e')]['include'],function(_0xedecb7){return{'model':db[_0xedecb7[_0x97b0('0x24')]],'as':_0xedecb7['as'],'attributes':_0xedecb7['attributes'],'include':_0xedecb7[_0x97b0('0x22')]?_[_0x97b0('0x23')](_0xedecb7[_0x97b0('0x22')],function(_0x288153){return{'model':db[_0x288153[_0x97b0('0x24')]],'as':_0x288153['as'],'attributes':_0x288153['attributes'],'include':_0x288153['include']?_['map'](_0x288153[_0x97b0('0x22')],function(_0x5e7ba9){return{'model':db[_0x5e7ba9[_0x97b0('0x24')]],'as':_0x5e7ba9['as'],'attributes':_0x5e7ba9[_0x97b0('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5acb2f){logger[_0x97b0('0x13')](_0x97b0('0x26'),_0x13fb52);logger[_0x97b0('0x25')](_0x97b0('0x26'),_0x13fb52,JSON['stringify'](_0x5acb2f));_0x6aa1b9(_0x5acb2f);})[_0x97b0('0x1a')](function(_0x446870){logger[_0x97b0('0x18')](_0x97b0('0x26'),_0x446870[_0x97b0('0x19')],_0x13fb52);_0x547b4c(_0x280ef6['error'](0x1f4,_0x446870[_0x97b0('0x19')]));});});}; \ No newline at end of file +var _0xb9a6=['raw','where','limit','include','model','attributes','map','ShowOpenchannelQueue','find','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options'];(function(_0x5c7e5e,_0x5e59f8){var _0x2d40cf=function(_0x25e8f6){while(--_0x25e8f6){_0x5c7e5e['push'](_0x5c7e5e['shift']());}};_0x2d40cf(++_0x5e59f8);}(_0xb9a6,0xf9));var _0x6b9a=function(_0x154e5f,_0x4559b9){_0x154e5f=_0x154e5f-0x0;var _0x5f0e44=_0xb9a6[_0x154e5f];return _0x5f0e44;};'use strict';var _=require('lodash');var util=require(_0x6b9a('0x0'));var moment=require(_0x6b9a('0x1'));var BPromise=require('bluebird');var rs=require(_0x6b9a('0x2'));var fs=require('fs');var Redis=require(_0x6b9a('0x3'));var db=require(_0x6b9a('0x4'))['db'];var utils=require(_0x6b9a('0x5'));var logger=require(_0x6b9a('0x6'))(_0x6b9a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6b9a('0x8')][_0x6b9a('0x9')]({'port':0x232a});config['redis']=_[_0x6b9a('0xa')](config['redis'],{'host':_0x6b9a('0xb'),'port':0x18eb});var socket=require(_0x6b9a('0xc'))(new Redis(config['redis']));require(_0x6b9a('0xd'))[_0x6b9a('0xe')](socket);function respondWithRpcPromise(_0x1c7dad,_0x212441,_0x3db809){return new BPromise(function(_0x6bcd5c,_0x39e88f){return client[_0x6b9a('0xf')](_0x1c7dad,_0x3db809)[_0x6b9a('0x10')](function(_0x311367){logger[_0x6b9a('0x11')](_0x6b9a('0x12'),_0x212441,'request\x20sent');logger[_0x6b9a('0x13')](_0x6b9a('0x14'),_0x212441,_0x6b9a('0x15'),JSON[_0x6b9a('0x16')](_0x311367));if(_0x311367[_0x6b9a('0x17')]){if(_0x311367[_0x6b9a('0x17')]['code']===0x1f4){logger[_0x6b9a('0x17')](_0x6b9a('0x12'),_0x212441,_0x311367[_0x6b9a('0x17')][_0x6b9a('0x18')]);return _0x39e88f(_0x311367[_0x6b9a('0x17')][_0x6b9a('0x18')]);}logger['error'](_0x6b9a('0x12'),_0x212441,_0x311367['error'][_0x6b9a('0x18')]);return _0x6bcd5c(_0x311367['error'][_0x6b9a('0x18')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x212441,'request\x20sent');_0x6bcd5c(_0x311367[_0x6b9a('0x19')][_0x6b9a('0x18')]);}})[_0x6b9a('0x1a')](function(_0x359841){logger[_0x6b9a('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x212441,_0x359841);_0x39e88f(_0x359841);});});}exports[_0x6b9a('0x1b')]=function(_0x472ca1){var _0x1df0f9=this;return new Promise(function(_0x1451dc,_0x1cdd2b){return db[_0x6b9a('0x1c')][_0x6b9a('0x1d')]({'raw':_0x472ca1[_0x6b9a('0x1e')]?_0x472ca1[_0x6b9a('0x1e')][_0x6b9a('0x1f')]===undefined?!![]:![]:!![],'where':_0x472ca1[_0x6b9a('0x1e')]?_0x472ca1['options'][_0x6b9a('0x20')]||null:null,'attributes':_0x472ca1['options']?_0x472ca1['options']['attributes']||null:null,'limit':_0x472ca1['options']?_0x472ca1[_0x6b9a('0x1e')][_0x6b9a('0x21')]||null:null,'include':_0x472ca1[_0x6b9a('0x1e')]?_0x472ca1[_0x6b9a('0x1e')][_0x6b9a('0x22')]?_['map'](_0x472ca1[_0x6b9a('0x1e')][_0x6b9a('0x22')],function(_0x4bff7d){return{'model':db[_0x4bff7d[_0x6b9a('0x23')]],'as':_0x4bff7d['as'],'attributes':_0x4bff7d[_0x6b9a('0x24')],'include':_0x4bff7d[_0x6b9a('0x22')]?_[_0x6b9a('0x25')](_0x4bff7d[_0x6b9a('0x22')],function(_0x8f0da4){return{'model':db[_0x8f0da4[_0x6b9a('0x23')]],'as':_0x8f0da4['as'],'attributes':_0x8f0da4[_0x6b9a('0x24')],'include':_0x8f0da4[_0x6b9a('0x22')]?_[_0x6b9a('0x25')](_0x8f0da4[_0x6b9a('0x22')],function(_0x478c0c){return{'model':db[_0x478c0c[_0x6b9a('0x23')]],'as':_0x478c0c['as'],'attributes':_0x478c0c[_0x6b9a('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43209c){logger[_0x6b9a('0x11')](_0x6b9a('0x1b'),_0x472ca1);logger[_0x6b9a('0x13')](_0x6b9a('0x1b'),_0x472ca1,JSON[_0x6b9a('0x16')](_0x43209c));_0x1451dc(_0x43209c);})[_0x6b9a('0x1a')](function(_0x319e51){logger[_0x6b9a('0x17')](_0x6b9a('0x1b'),_0x319e51[_0x6b9a('0x18')],_0x472ca1);_0x1cdd2b(_0x1df0f9[_0x6b9a('0x17')](0x1f4,_0x319e51[_0x6b9a('0x18')]));});});};exports[_0x6b9a('0x26')]=function(_0x3351d9){var _0x5c5a3e=this;return new Promise(function(_0x6e2b7,_0x18d42d){return db[_0x6b9a('0x1c')][_0x6b9a('0x27')]({'raw':_0x3351d9[_0x6b9a('0x1e')]?_0x3351d9['options'][_0x6b9a('0x1f')]===undefined?!![]:![]:!![],'where':_0x3351d9['options']?_0x3351d9[_0x6b9a('0x1e')][_0x6b9a('0x20')]||null:null,'attributes':_0x3351d9[_0x6b9a('0x1e')]?_0x3351d9[_0x6b9a('0x1e')]['attributes']||null:null,'include':_0x3351d9[_0x6b9a('0x1e')]?_0x3351d9['options']['include']?_[_0x6b9a('0x25')](_0x3351d9[_0x6b9a('0x1e')][_0x6b9a('0x22')],function(_0x247843){return{'model':db[_0x247843[_0x6b9a('0x23')]],'as':_0x247843['as'],'attributes':_0x247843['attributes'],'include':_0x247843[_0x6b9a('0x22')]?_[_0x6b9a('0x25')](_0x247843[_0x6b9a('0x22')],function(_0x296a73){return{'model':db[_0x296a73[_0x6b9a('0x23')]],'as':_0x296a73['as'],'attributes':_0x296a73[_0x6b9a('0x24')],'include':_0x296a73[_0x6b9a('0x22')]?_[_0x6b9a('0x25')](_0x296a73[_0x6b9a('0x22')],function(_0x76495){return{'model':db[_0x76495[_0x6b9a('0x23')]],'as':_0x76495['as'],'attributes':_0x76495[_0x6b9a('0x24')]};}):[]};}):[]};}):[]:[]})[_0x6b9a('0x10')](function(_0xaba65e){logger[_0x6b9a('0x11')](_0x6b9a('0x26'),_0x3351d9);logger['debug'](_0x6b9a('0x26'),_0x3351d9,JSON[_0x6b9a('0x16')](_0xaba65e));_0x6e2b7(_0xaba65e);})[_0x6b9a('0x1a')](function(_0x2b023c){logger[_0x6b9a('0x17')]('ShowOpenchannelQueue',_0x2b023c[_0x6b9a('0x18')],_0x3351d9);_0x18d42d(_0x5c5a3e[_0x6b9a('0x17')](0x1f4,_0x2b023c[_0x6b9a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 32880fb..354a29b 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 _0xb6a7=['update','emit','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save'];(function(_0x2d2a32,_0x1abc3c){var _0x535e3d=function(_0x63a2a8){while(--_0x63a2a8){_0x2d2a32['push'](_0x2d2a32['shift']());}};_0x535e3d(++_0x1abc3c);}(_0xb6a7,0x18e));var _0x7b6a=function(_0x58c20f,_0x4cdb1b){_0x58c20f=_0x58c20f-0x0;var _0x3b0318=_0xb6a7[_0x58c20f];return _0x3b0318;};'use strict';var OpenchannelQueueEvents=require(_0x7b6a('0x0'));var events=[_0x7b6a('0x1'),'remove',_0x7b6a('0x2')];function createListener(_0xea6eda,_0x17bdf7){return function(_0x1ed80c){_0x17bdf7[_0x7b6a('0x3')](_0xea6eda,_0x1ed80c);};}function removeListener(_0x52d4f6,_0x362b88){return function(){OpenchannelQueueEvents[_0x7b6a('0x4')](_0x52d4f6,_0x362b88);};}exports[_0x7b6a('0x5')]=function(_0x3bba99){for(var _0x20ccfa=0x0,_0x149ce8=events[_0x7b6a('0x6')];_0x20ccfa<_0x149ce8;_0x20ccfa++){var _0x465dbb=events[_0x20ccfa];var _0x5649a2=createListener(_0x7b6a('0x7')+_0x465dbb,_0x3bba99);OpenchannelQueueEvents['on'](_0x465dbb,_0x5649a2);}}; \ No newline at end of file +var _0xf123=['update','removeListener','length'];(function(_0x2e9268,_0x2ea9c5){var _0x27fc00=function(_0x9efe8a){while(--_0x9efe8a){_0x2e9268['push'](_0x2e9268['shift']());}};_0x27fc00(++_0x2ea9c5);}(_0xf123,0x1aa));var _0x3f12=function(_0xd336fa,_0x39d1b2){_0xd336fa=_0xd336fa-0x0;var _0x3370b1=_0xf123[_0xd336fa];return _0x3370b1;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save','remove',_0x3f12('0x0')];function createListener(_0x432a82,_0x21a363){return function(_0x5e19a2){_0x21a363['emit'](_0x432a82,_0x5e19a2);};}function removeListener(_0x3084f0,_0x264e3d){return function(){OpenchannelQueueEvents[_0x3f12('0x1')](_0x3084f0,_0x264e3d);};}exports['register']=function(_0x183460){for(var _0x40fa48=0x0,_0x2d9f5d=events[_0x3f12('0x2')];_0x40fa48<_0x2d9f5d;_0x40fa48++){var _0x35ed98=events[_0x40fa48];var _0xa2eac0=createListener('openchannelQueue:'+_0x35ed98,_0x183460);OpenchannelQueueEvents['on'](_0x35ed98,_0xa2eac0);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 60b06d3..105bdd8 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 _0xf4dd=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','put','destroy','exports','multer','path'];(function(_0x48f65a,_0x898b56){var _0x21b8a7=function(_0x1229f2){while(--_0x1229f2){_0x48f65a['push'](_0x48f65a['shift']());}};_0x21b8a7(++_0x898b56);}(_0xf4dd,0xec));var _0xdf4d=function(_0x3ba502,_0x24bf4b){_0x3ba502=_0x3ba502-0x0;var _0x4e5b26=_0xf4dd[_0x3ba502];return _0x4e5b26;};'use strict';var multer=require(_0xdf4d('0x0'));var util=require('util');var path=require(_0xdf4d('0x1'));var timeout=require('connect-timeout');var express=require(_0xdf4d('0x2'));var router=express[_0xdf4d('0x3')]();var fs_extra=require(_0xdf4d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdf4d('0x5'));var config=require(_0xdf4d('0x6'));var controller=require('./openchannelQueueReport.controller');router[_0xdf4d('0x7')]('/',auth[_0xdf4d('0x8')](),controller['index']);router['get'](_0xdf4d('0x9'),auth['isAuthenticated'](),controller[_0xdf4d('0xa')]);router[_0xdf4d('0x7')](_0xdf4d('0xb'),auth[_0xdf4d('0x8')](),controller[_0xdf4d('0xc')]);router[_0xdf4d('0xd')]('/',auth[_0xdf4d('0x8')](),controller['create']);router[_0xdf4d('0xe')](_0xdf4d('0xb'),auth[_0xdf4d('0x8')](),controller['update']);router['delete']('/:id',auth[_0xdf4d('0x8')](),controller[_0xdf4d('0xf')]);module[_0xdf4d('0x10')]=router; \ No newline at end of file +var _0xb1a9=['describe','post','update','delete','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xb1a9,0x139));var _0x9b1a=function(_0x54b0f3,_0x1fe2f7){_0x54b0f3=_0x54b0f3-0x0;var _0x5ae957=_0xb1a9[_0x54b0f3];return _0x5ae957;};'use strict';var multer=require('multer');var util=require(_0x9b1a('0x0'));var path=require(_0x9b1a('0x1'));var timeout=require(_0x9b1a('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9b1a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9b1a('0x4'));var config=require(_0x9b1a('0x5'));var controller=require('./openchannelQueueReport.controller');router[_0x9b1a('0x6')]('/',auth[_0x9b1a('0x7')](),controller[_0x9b1a('0x8')]);router[_0x9b1a('0x6')]('/describe',auth[_0x9b1a('0x7')](),controller[_0x9b1a('0x9')]);router[_0x9b1a('0x6')]('/:id',auth[_0x9b1a('0x7')](),controller['show']);router[_0x9b1a('0xa')]('/',auth[_0x9b1a('0x7')](),controller['create']);router['put']('/:id',auth[_0x9b1a('0x7')](),controller[_0x9b1a('0xb')]);router[_0x9b1a('0xc')]('/:id',auth[_0x9b1a('0x7')](),controller['destroy']);module[_0x9b1a('0xd')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index adfacff..d285907 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 _0xac8f=['moment','sequelize','exports','STRING','DATE'];(function(_0x400ccc,_0x1726c2){var _0x4a0ca3=function(_0x366e6d){while(--_0x366e6d){_0x400ccc['push'](_0x400ccc['shift']());}};_0x4a0ca3(++_0x1726c2);}(_0xac8f,0x1d6));var _0xfac8=function(_0x3db122,_0x5e6bee){_0x3db122=_0x3db122-0x0;var _0x325b67=_0xac8f[_0x3db122];return _0x325b67;};'use strict';var moment=require(_0xfac8('0x0'));var Sequelize=require(_0xfac8('0x1'));module[_0xfac8('0x2')]={'uniqueid':{'type':Sequelize[_0xfac8('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xfac8('0x3')]},'joinAt':{'type':Sequelize[_0xfac8('0x4')]},'leaveAt':{'type':Sequelize[_0xfac8('0x4')]},'acceptAt':{'type':Sequelize[_0xfac8('0x4')]},'exitAt':{'type':Sequelize[_0xfac8('0x4')]},'reason':{'type':Sequelize[_0xfac8('0x3')]}}; \ No newline at end of file +var _0x9a14=['exports','STRING','DATE','sequelize'];(function(_0x5ed563,_0x3d3001){var _0x594164=function(_0x40a310){while(--_0x40a310){_0x5ed563['push'](_0x5ed563['shift']());}};_0x594164(++_0x3d3001);}(_0x9a14,0x1d3));var _0x49a1=function(_0x1434c3,_0x45e72b){_0x1434c3=_0x1434c3-0x0;var _0x127fd0=_0x9a14[_0x1434c3];return _0x127fd0;};'use strict';var moment=require('moment');var Sequelize=require(_0x49a1('0x0'));module[_0x49a1('0x1')]={'uniqueid':{'type':Sequelize[_0x49a1('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x49a1('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x49a1('0x3')]},'exitAt':{'type':Sequelize[_0x49a1('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 8055c05..2c3df6e 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 _0x857f=['undefined','count','limit','set','apply','save','update','then','error','stack','name','send','map','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filter','where','merge','type','VIRTUAL','options','OpenchannelQueueReport','include','findAll','rows','catch','show','params','keys','length','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset'];(function(_0x2e772e,_0x13e53e){var _0x30d66c=function(_0xaf2a5e){while(--_0xaf2a5e){_0x2e772e['push'](_0x2e772e['shift']());}};_0x30d66c(++_0x13e53e);}(_0x857f,0xc0));var _0xf857=function(_0x4e58e3,_0x9c4995){_0x4e58e3=_0x4e58e3-0x0;var _0x11927a=_0x857f[_0x4e58e3];return _0x11927a;};'use strict';var emlformat=require(_0xf857('0x0'));var rimraf=require(_0xf857('0x1'));var zipdir=require(_0xf857('0x2'));var jsonpatch=require(_0xf857('0x3'));var rp=require(_0xf857('0x4'));var moment=require(_0xf857('0x5'));var BPromise=require(_0xf857('0x6'));var Mustache=require('mustache');var util=require(_0xf857('0x7'));var path=require(_0xf857('0x8'));var sox=require(_0xf857('0x9'));var csv=require(_0xf857('0xa'));var ejs=require(_0xf857('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf857('0xc'));var squel=require('squel');var crypto=require(_0xf857('0xd'));var jsforce=require(_0xf857('0xe'));var deskjs=require(_0xf857('0xf'));var toCsv=require(_0xf857('0xa'));var querystring=require(_0xf857('0x10'));var Papa=require('papaparse');var Redis=require(_0xf857('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf857('0x12'));var as=require(_0xf857('0x13'));var hardwareService=require(_0xf857('0x14'));var logger=require(_0xf857('0x15'))(_0xf857('0x16'));var utils=require(_0xf857('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf857('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e6b5a,_0x26b102){_0x26b102=_0x26b102||0xcc;return function(_0x488781){if(_0x488781){return _0x1e6b5a[_0xf857('0x19')](_0x26b102);}return _0x1e6b5a[_0xf857('0x1a')](_0x26b102)[_0xf857('0x1b')]();};}function respondWithResult(_0x2f0912,_0x59e93e){_0x59e93e=_0x59e93e||0xc8;return function(_0x1a5c74){if(_0x1a5c74){return _0x2f0912[_0xf857('0x1a')](_0x59e93e)[_0xf857('0x1c')](_0x1a5c74);}};}function respondWithFilteredResult(_0x3cc171,_0x4c8c31){return function(_0x40bc68){if(_0x40bc68){var _0x5631ad=typeof _0x4c8c31[_0xf857('0x1d')]==='undefined'&&typeof _0x4c8c31['limit']===_0xf857('0x1e');var _0xb9660f=_0x40bc68[_0xf857('0x1f')];var _0x1695fe=_0x5631ad?0x0:_0x4c8c31['offset'];var _0xed8229=_0x5631ad?_0x40bc68['count']:_0x4c8c31[_0xf857('0x1d')]+_0x4c8c31[_0xf857('0x20')];var _0xa52ff2;if(_0xed8229>=_0xb9660f){_0xed8229=_0xb9660f;_0xa52ff2=0xc8;}else{_0xa52ff2=0xce;}_0x3cc171[_0xf857('0x1a')](_0xa52ff2);return _0x3cc171[_0xf857('0x21')]('Content-Range',_0x1695fe+'-'+_0xed8229+'/'+_0xb9660f)[_0xf857('0x1c')](_0x40bc68);}return null;};}function patchUpdates(_0x5b9471){return function(_0x419c4f){try{jsonpatch[_0xf857('0x22')](_0x419c4f,_0x5b9471,!![]);}catch(_0x5c4735){return BPromise['reject'](_0x5c4735);}return _0x419c4f[_0xf857('0x23')]();};}function saveUpdates(_0x3d49d4,_0x551cb1){return function(_0x3eb689){if(_0x3eb689){return _0x3eb689[_0xf857('0x24')](_0x3d49d4)['then'](function(_0x2cb957){return _0x2cb957;});}return null;};}function removeEntity(_0x531677,_0xe408fb){return function(_0x4501bb){if(_0x4501bb){return _0x4501bb['destroy']()[_0xf857('0x25')](function(){_0x531677['status'](0xcc)[_0xf857('0x1b')]();});}};}function handleEntityNotFound(_0x539e37,_0x55c09e){return function(_0x37aa8e){if(!_0x37aa8e){_0x539e37['sendStatus'](0x194);}return _0x37aa8e;};}function handleError(_0x12c763,_0x407184){_0x407184=_0x407184||0x1f4;return function(_0x39afe1){logger[_0xf857('0x26')](_0x39afe1[_0xf857('0x27')]);if(_0x39afe1[_0xf857('0x28')]){delete _0x39afe1[_0xf857('0x28')];}_0x12c763[_0xf857('0x1a')](_0x407184)[_0xf857('0x29')](_0x39afe1);};}exports['index']=function(_0x144554,_0x9ee2e3){var _0x3795d9={},_0x13526e={},_0xbfdeec={'count':0x0,'rows':[]};var _0x556326=_[_0xf857('0x2a')](db['OpenchannelQueueReport']['rawAttributes'],function(_0x707f33){return{'name':_0x707f33[_0xf857('0x2b')],'type':_0x707f33['type'][_0xf857('0x2c')]};});_0x13526e[_0xf857('0x2d')]=_[_0xf857('0x2a')](_0x556326,_0xf857('0x28'));_0x13526e['query']=_['keys'](_0x144554[_0xf857('0x2e')]);_0x13526e[_0xf857('0x2f')]=_[_0xf857('0x30')](_0x13526e[_0xf857('0x2d')],_0x13526e[_0xf857('0x2e')]);_0x3795d9['attributes']=_[_0xf857('0x30')](_0x13526e[_0xf857('0x2d')],qs['fields'](_0x144554['query'][_0xf857('0x31')]));_0x3795d9[_0xf857('0x32')]=_0x3795d9['attributes']['length']?_0x3795d9[_0xf857('0x32')]:_0x13526e[_0xf857('0x2d')];if(!_0x144554[_0xf857('0x2e')][_0xf857('0x33')](_0xf857('0x34'))){_0x3795d9[_0xf857('0x20')]=qs['limit'](_0x144554['query'][_0xf857('0x20')]);_0x3795d9[_0xf857('0x1d')]=qs['offset'](_0x144554['query']['offset']);}_0x3795d9['order']=qs[_0xf857('0x35')](_0x144554['query']['sort']);_0x3795d9['where']=qs['filters'](_['pick'](_0x144554[_0xf857('0x2e')],_0x13526e[_0xf857('0x2f')]),_0x556326);if(_0x144554[_0xf857('0x2e')][_0xf857('0x36')]){_0x3795d9[_0xf857('0x37')]=_[_0xf857('0x38')](_0x3795d9[_0xf857('0x37')],{'$or':_[_0xf857('0x2a')](_0x556326,function(_0xb836ca){if(_0xb836ca[_0xf857('0x39')]!==_0xf857('0x3a')){var _0x148222={};_0x148222[_0xb836ca[_0xf857('0x28')]]={'$like':'%'+_0x144554[_0xf857('0x2e')][_0xf857('0x36')]+'%'};return _0x148222;}})});}_0x3795d9=_[_0xf857('0x38')]({},_0x3795d9,_0x144554[_0xf857('0x3b')]);var _0x2f9e72={'where':_0x3795d9[_0xf857('0x37')]};return db[_0xf857('0x3c')][_0xf857('0x1f')](_0x2f9e72)[_0xf857('0x25')](function(_0x5bb64b){_0xbfdeec[_0xf857('0x1f')]=_0x5bb64b;if(_0x144554[_0xf857('0x2e')]['includeAll']){_0x3795d9[_0xf857('0x3d')]=[{'all':!![]}];}return db[_0xf857('0x3c')][_0xf857('0x3e')](_0x3795d9);})[_0xf857('0x25')](function(_0xc1f57){_0xbfdeec[_0xf857('0x3f')]=_0xc1f57;return _0xbfdeec;})[_0xf857('0x25')](respondWithFilteredResult(_0x9ee2e3,_0x3795d9))[_0xf857('0x40')](handleError(_0x9ee2e3,null));};exports[_0xf857('0x41')]=function(_0x2a147d,_0x130fde){var _0x2ab4e9={'raw':!![],'where':{'id':_0x2a147d[_0xf857('0x42')]['id']}},_0xec8036={};_0xec8036['model']=_[_0xf857('0x43')](db[_0xf857('0x3c')]['rawAttributes']);_0xec8036[_0xf857('0x2e')]=_[_0xf857('0x43')](_0x2a147d['query']);_0xec8036[_0xf857('0x2f')]=_['intersection'](_0xec8036[_0xf857('0x2d')],_0xec8036['query']);_0x2ab4e9[_0xf857('0x32')]=_[_0xf857('0x30')](_0xec8036[_0xf857('0x2d')],qs[_0xf857('0x31')](_0x2a147d[_0xf857('0x2e')][_0xf857('0x31')]));_0x2ab4e9[_0xf857('0x32')]=_0x2ab4e9[_0xf857('0x32')][_0xf857('0x44')]?_0x2ab4e9['attributes']:_0xec8036['model'];if(_0x2a147d[_0xf857('0x2e')]['includeAll']){_0x2ab4e9[_0xf857('0x3d')]=[{'all':!![]}];}_0x2ab4e9=_['merge']({},_0x2ab4e9,_0x2a147d[_0xf857('0x3b')]);return db[_0xf857('0x3c')]['find'](_0x2ab4e9)[_0xf857('0x25')](handleEntityNotFound(_0x130fde,null))[_0xf857('0x25')](respondWithResult(_0x130fde,null))['catch'](handleError(_0x130fde,null));};exports[_0xf857('0x45')]=function(_0x24be4d,_0x4fbb12){return db[_0xf857('0x3c')][_0xf857('0x45')](_0x24be4d[_0xf857('0x46')],{})[_0xf857('0x25')](respondWithResult(_0x4fbb12,0xc9))[_0xf857('0x40')](handleError(_0x4fbb12,null));};exports[_0xf857('0x24')]=function(_0x3be638,_0x504b0d){if(_0x3be638[_0xf857('0x46')]['id']){delete _0x3be638['body']['id'];}return db[_0xf857('0x3c')][_0xf857('0x47')]({'where':{'id':_0x3be638[_0xf857('0x42')]['id']}})[_0xf857('0x25')](handleEntityNotFound(_0x504b0d,null))[_0xf857('0x25')](saveUpdates(_0x3be638[_0xf857('0x46')],null))[_0xf857('0x25')](respondWithResult(_0x504b0d,null))[_0xf857('0x40')](handleError(_0x504b0d,null));};exports[_0xf857('0x48')]=function(_0x79361f,_0x53d952){return db[_0xf857('0x3c')][_0xf857('0x47')]({'where':{'id':_0x79361f[_0xf857('0x42')]['id']}})['then'](handleEntityNotFound(_0x53d952,null))[_0xf857('0x25')](removeEntity(_0x53d952,null))[_0xf857('0x40')](handleError(_0x53d952,null));};exports[_0xf857('0x49')]=function(_0xf44a5,_0x34c7e4){return db['OpenchannelQueueReport']['describe']()[_0xf857('0x25')](respondWithResult(_0x34c7e4,null))[_0xf857('0x40')](handleError(_0x34c7e4,null));}; \ No newline at end of file +var _0x70c2=['include','findAll','rows','catch','show','params','keys','length','includeAll','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','error','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filter','type','VIRTUAL','merge','options'];(function(_0x36d703,_0x55b354){var _0x12c909=function(_0x5e846a){while(--_0x5e846a){_0x36d703['push'](_0x36d703['shift']());}};_0x12c909(++_0x55b354);}(_0x70c2,0x179));var _0x270c=function(_0x5e258e,_0x57e8c2){_0x5e258e=_0x5e258e-0x0;var _0x2c3c46=_0x70c2[_0x5e258e];return _0x2c3c46;};'use strict';var emlformat=require(_0x270c('0x0'));var rimraf=require(_0x270c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x270c('0x2'));var moment=require(_0x270c('0x3'));var BPromise=require(_0x270c('0x4'));var Mustache=require(_0x270c('0x5'));var util=require(_0x270c('0x6'));var path=require(_0x270c('0x7'));var sox=require(_0x270c('0x8'));var csv=require(_0x270c('0x9'));var ejs=require(_0x270c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x270c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x270c('0xc'));var deskjs=require(_0x270c('0xd'));var toCsv=require(_0x270c('0x9'));var querystring=require('querystring');var Papa=require(_0x270c('0xe'));var Redis=require('ioredis');var authService=require(_0x270c('0xf'));var qs=require(_0x270c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x270c('0x11'));var logger=require('../../config/logger')(_0x270c('0x12'));var utils=require(_0x270c('0x13'));var config=require(_0x270c('0x14'));var licenseUtil=require(_0x270c('0x15'));var db=require(_0x270c('0x16'))['db'];function respondWithStatusCode(_0x43a507,_0x3d6445){_0x3d6445=_0x3d6445||0xcc;return function(_0x301a1c){if(_0x301a1c){return _0x43a507[_0x270c('0x17')](_0x3d6445);}return _0x43a507[_0x270c('0x18')](_0x3d6445)['end']();};}function respondWithResult(_0x1e0c05,_0x2224cc){_0x2224cc=_0x2224cc||0xc8;return function(_0x23827f){if(_0x23827f){return _0x1e0c05[_0x270c('0x18')](_0x2224cc)['json'](_0x23827f);}};}function respondWithFilteredResult(_0x4f60a8,_0x467c6d){return function(_0x476485){if(_0x476485){var _0x38d061=typeof _0x467c6d[_0x270c('0x19')]===_0x270c('0x1a')&&typeof _0x467c6d['limit']===_0x270c('0x1a');var _0x1f544d=_0x476485[_0x270c('0x1b')];var _0x36c905=_0x38d061?0x0:_0x467c6d[_0x270c('0x19')];var _0x2dcb4d=_0x38d061?_0x476485['count']:_0x467c6d['offset']+_0x467c6d['limit'];var _0x26ac12;if(_0x2dcb4d>=_0x1f544d){_0x2dcb4d=_0x1f544d;_0x26ac12=0xc8;}else{_0x26ac12=0xce;}_0x4f60a8[_0x270c('0x18')](_0x26ac12);return _0x4f60a8[_0x270c('0x1c')](_0x270c('0x1d'),_0x36c905+'-'+_0x2dcb4d+'/'+_0x1f544d)[_0x270c('0x1e')](_0x476485);}return null;};}function patchUpdates(_0x3a18ea){return function(_0x12de66){try{jsonpatch[_0x270c('0x1f')](_0x12de66,_0x3a18ea,!![]);}catch(_0xa1fb2b){return BPromise['reject'](_0xa1fb2b);}return _0x12de66[_0x270c('0x20')]();};}function saveUpdates(_0x17f812,_0x18068a){return function(_0x592403){if(_0x592403){return _0x592403[_0x270c('0x21')](_0x17f812)[_0x270c('0x22')](function(_0x3b9d47){return _0x3b9d47;});}return null;};}function removeEntity(_0x1ae756,_0x363a4c){return function(_0x1ee558){if(_0x1ee558){return _0x1ee558[_0x270c('0x23')]()['then'](function(){_0x1ae756['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59e213,_0xc1a8ac){return function(_0x5cf5e2){if(!_0x5cf5e2){_0x59e213['sendStatus'](0x194);}return _0x5cf5e2;};}function handleError(_0x12a610,_0x37308b){_0x37308b=_0x37308b||0x1f4;return function(_0x8a2f8e){logger[_0x270c('0x24')](_0x8a2f8e['stack']);if(_0x8a2f8e[_0x270c('0x25')]){delete _0x8a2f8e[_0x270c('0x25')];}_0x12a610[_0x270c('0x18')](_0x37308b)[_0x270c('0x26')](_0x8a2f8e);};}exports[_0x270c('0x27')]=function(_0x1c035b,_0xabcbe0){var _0x1e302b={},_0x2e7ca0={},_0xc2ec8d={'count':0x0,'rows':[]};var _0x222718=_[_0x270c('0x28')](db[_0x270c('0x29')][_0x270c('0x2a')],function(_0x129fa4){return{'name':_0x129fa4[_0x270c('0x2b')],'type':_0x129fa4['type'][_0x270c('0x2c')]};});_0x2e7ca0[_0x270c('0x2d')]=_[_0x270c('0x28')](_0x222718,_0x270c('0x25'));_0x2e7ca0['query']=_['keys'](_0x1c035b[_0x270c('0x2e')]);_0x2e7ca0[_0x270c('0x2f')]=_[_0x270c('0x30')](_0x2e7ca0[_0x270c('0x2d')],_0x2e7ca0['query']);_0x1e302b[_0x270c('0x31')]=_[_0x270c('0x30')](_0x2e7ca0[_0x270c('0x2d')],qs[_0x270c('0x32')](_0x1c035b[_0x270c('0x2e')]['fields']));_0x1e302b[_0x270c('0x31')]=_0x1e302b[_0x270c('0x31')]['length']?_0x1e302b[_0x270c('0x31')]:_0x2e7ca0[_0x270c('0x2d')];if(!_0x1c035b[_0x270c('0x2e')][_0x270c('0x33')]('nolimit')){_0x1e302b['limit']=qs[_0x270c('0x34')](_0x1c035b[_0x270c('0x2e')][_0x270c('0x34')]);_0x1e302b['offset']=qs['offset'](_0x1c035b['query'][_0x270c('0x19')]);}_0x1e302b[_0x270c('0x35')]=qs[_0x270c('0x36')](_0x1c035b[_0x270c('0x2e')][_0x270c('0x36')]);_0x1e302b[_0x270c('0x37')]=qs[_0x270c('0x2f')](_['pick'](_0x1c035b[_0x270c('0x2e')],_0x2e7ca0['filters']),_0x222718);if(_0x1c035b[_0x270c('0x2e')][_0x270c('0x38')]){_0x1e302b[_0x270c('0x37')]=_['merge'](_0x1e302b[_0x270c('0x37')],{'$or':_[_0x270c('0x28')](_0x222718,function(_0x3fb419){if(_0x3fb419[_0x270c('0x39')]!==_0x270c('0x3a')){var _0x54d2dc={};_0x54d2dc[_0x3fb419[_0x270c('0x25')]]={'$like':'%'+_0x1c035b[_0x270c('0x2e')][_0x270c('0x38')]+'%'};return _0x54d2dc;}})});}_0x1e302b=_[_0x270c('0x3b')]({},_0x1e302b,_0x1c035b[_0x270c('0x3c')]);var _0x202df4={'where':_0x1e302b['where']};return db[_0x270c('0x29')][_0x270c('0x1b')](_0x202df4)[_0x270c('0x22')](function(_0x101aed){_0xc2ec8d[_0x270c('0x1b')]=_0x101aed;if(_0x1c035b['query']['includeAll']){_0x1e302b[_0x270c('0x3d')]=[{'all':!![]}];}return db[_0x270c('0x29')][_0x270c('0x3e')](_0x1e302b);})['then'](function(_0x549002){_0xc2ec8d[_0x270c('0x3f')]=_0x549002;return _0xc2ec8d;})[_0x270c('0x22')](respondWithFilteredResult(_0xabcbe0,_0x1e302b))[_0x270c('0x40')](handleError(_0xabcbe0,null));};exports[_0x270c('0x41')]=function(_0x299fea,_0x3c3f25){var _0x45dd4d={'raw':!![],'where':{'id':_0x299fea[_0x270c('0x42')]['id']}},_0x1f169f={};_0x1f169f['model']=_[_0x270c('0x43')](db[_0x270c('0x29')][_0x270c('0x2a')]);_0x1f169f[_0x270c('0x2e')]=_['keys'](_0x299fea[_0x270c('0x2e')]);_0x1f169f[_0x270c('0x2f')]=_[_0x270c('0x30')](_0x1f169f[_0x270c('0x2d')],_0x1f169f[_0x270c('0x2e')]);_0x45dd4d['attributes']=_[_0x270c('0x30')](_0x1f169f[_0x270c('0x2d')],qs['fields'](_0x299fea['query'][_0x270c('0x32')]));_0x45dd4d[_0x270c('0x31')]=_0x45dd4d[_0x270c('0x31')][_0x270c('0x44')]?_0x45dd4d[_0x270c('0x31')]:_0x1f169f['model'];if(_0x299fea['query'][_0x270c('0x45')]){_0x45dd4d[_0x270c('0x3d')]=[{'all':!![]}];}_0x45dd4d=_['merge']({},_0x45dd4d,_0x299fea[_0x270c('0x3c')]);return db[_0x270c('0x29')]['find'](_0x45dd4d)['then'](handleEntityNotFound(_0x3c3f25,null))[_0x270c('0x22')](respondWithResult(_0x3c3f25,null))[_0x270c('0x40')](handleError(_0x3c3f25,null));};exports[_0x270c('0x46')]=function(_0x474057,_0x42b3ac){return db[_0x270c('0x29')][_0x270c('0x46')](_0x474057[_0x270c('0x47')],{})[_0x270c('0x22')](respondWithResult(_0x42b3ac,0xc9))[_0x270c('0x40')](handleError(_0x42b3ac,null));};exports[_0x270c('0x21')]=function(_0x30fa2e,_0x4516c1){if(_0x30fa2e[_0x270c('0x47')]['id']){delete _0x30fa2e[_0x270c('0x47')]['id'];}return db[_0x270c('0x29')]['find']({'where':{'id':_0x30fa2e[_0x270c('0x42')]['id']}})[_0x270c('0x22')](handleEntityNotFound(_0x4516c1,null))['then'](saveUpdates(_0x30fa2e[_0x270c('0x47')],null))[_0x270c('0x22')](respondWithResult(_0x4516c1,null))[_0x270c('0x40')](handleError(_0x4516c1,null));};exports[_0x270c('0x23')]=function(_0x48f6a1,_0x42562e){return db[_0x270c('0x29')]['find']({'where':{'id':_0x48f6a1[_0x270c('0x42')]['id']}})['then'](handleEntityNotFound(_0x42562e,null))['then'](removeEntity(_0x42562e,null))[_0x270c('0x40')](handleError(_0x42562e,null));};exports[_0x270c('0x48')]=function(_0x2ad68a,_0x1a80f7){return db[_0x270c('0x29')][_0x270c('0x48')]()[_0x270c('0x22')](respondWithResult(_0x1a80f7,null))[_0x270c('0x40')](handleError(_0x1a80f7,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 9ecba26..093fc19 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(_0x130fb2,_0x211bb3){var _0x2f02d1=function(_0x290923){while(--_0x290923){_0x130fb2['push'](_0x130fb2['shift']());}};_0x2f02d1(++_0x211bb3);}(_0x1261,0x144));var _0x1126=function(_0xa7efd7,_0x45c885){_0xa7efd7=_0xa7efd7-0x0;var _0x572019=_0x1261[_0xa7efd7];return _0x572019;};'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 _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x1b0cf5,_0x1bd306){var _0x43e601=function(_0x52bdef){while(--_0x52bdef){_0x1b0cf5['push'](_0x1b0cf5['shift']());}};_0x43e601(++_0x1bd306);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xc4aa[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index d817cd2..c5e2581 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 _0xe820=['OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','catch','UpdateOpenchannelQueueReport','update','where','attributes','limit','info','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x49fcc7,_0x24e9b0){var _0x4fb05a=function(_0x3701aa){while(--_0x3701aa){_0x49fcc7['push'](_0x49fcc7['shift']());}};_0x4fb05a(++_0x24e9b0);}(_0xe820,0xd2));var _0x0e82=function(_0x571c1d,_0xe989f3){_0x571c1d=_0x571c1d-0x0;var _0x3dcd37=_0xe820[_0x571c1d];return _0x3dcd37;};'use strict';var _=require(_0x0e82('0x0'));var util=require('util');var moment=require(_0x0e82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e82('0x2'));var db=require(_0x0e82('0x3'))['db'];var utils=require(_0x0e82('0x4'));var logger=require('../../config/logger')(_0x0e82('0x5'));var config=require('../../config/environment');var jayson=require(_0x0e82('0x6'));var client=jayson[_0x0e82('0x7')][_0x0e82('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x328b32,_0x2a0f9b,_0x55f277){return new BPromise(function(_0x10013b,_0x33c8a2){return client[_0x0e82('0x9')](_0x328b32,_0x55f277)[_0x0e82('0xa')](function(_0x3b7792){logger['info'](_0x0e82('0xb'),_0x2a0f9b,_0x0e82('0xc'));logger[_0x0e82('0xd')](_0x0e82('0xe'),_0x2a0f9b,_0x0e82('0xc'),JSON[_0x0e82('0xf')](_0x3b7792));if(_0x3b7792[_0x0e82('0x10')]){if(_0x3b7792['error'][_0x0e82('0x11')]===0x1f4){logger[_0x0e82('0x10')](_0x0e82('0xb'),_0x2a0f9b,_0x3b7792[_0x0e82('0x10')][_0x0e82('0x12')]);return _0x33c8a2(_0x3b7792[_0x0e82('0x10')]['message']);}logger[_0x0e82('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2a0f9b,_0x3b7792['error'][_0x0e82('0x12')]);return _0x10013b(_0x3b7792['error']['message']);}else{logger['info'](_0x0e82('0xb'),_0x2a0f9b,'request\x20sent');_0x10013b(_0x3b7792['result'][_0x0e82('0x12')]);}})['catch'](function(_0x319303){logger[_0x0e82('0x10')](_0x0e82('0xb'),_0x2a0f9b,_0x319303);_0x33c8a2(_0x319303);});});}exports[_0x0e82('0x13')]=function(_0x53622b){var _0x25ac21=this;return new Promise(function(_0x310aac,_0x3a3ddf){return db[_0x0e82('0x14')][_0x0e82('0x15')](_0x53622b[_0x0e82('0x16')],{'raw':_0x53622b[_0x0e82('0x17')]?_0x53622b[_0x0e82('0x17')][_0x0e82('0x18')]===undefined?!![]:![]:!![]})[_0x0e82('0xa')](function(_0x5903c){logger['info']('CreateOpenchannelQueueReport',_0x53622b);logger[_0x0e82('0xd')](_0x0e82('0x13'),_0x53622b,JSON[_0x0e82('0xf')](_0x5903c));_0x310aac(_0x5903c);})[_0x0e82('0x19')](function(_0xd48046){logger[_0x0e82('0x10')](_0x0e82('0x13'),_0xd48046[_0x0e82('0x12')],_0x53622b);_0x3a3ddf(_0x25ac21['error'](0x1f4,_0xd48046[_0x0e82('0x12')]));});});};exports[_0x0e82('0x1a')]=function(_0x3d6c28){var _0x24f883=this;return new Promise(function(_0x507f08,_0xee85dd){return db[_0x0e82('0x14')][_0x0e82('0x1b')](_0x3d6c28[_0x0e82('0x16')],{'raw':_0x3d6c28['options']?_0x3d6c28[_0x0e82('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d6c28['options']?_0x3d6c28[_0x0e82('0x17')][_0x0e82('0x1c')]||null:null,'attributes':_0x3d6c28['options']?_0x3d6c28[_0x0e82('0x17')][_0x0e82('0x1d')]||null:null,'limit':_0x3d6c28[_0x0e82('0x17')]?_0x3d6c28['options'][_0x0e82('0x1e')]||null:null})[_0x0e82('0xa')](function(_0x4ee65a){logger[_0x0e82('0x1f')]('UpdateOpenchannelQueueReport',_0x3d6c28);logger[_0x0e82('0xd')](_0x0e82('0x1a'),_0x3d6c28,JSON['stringify'](_0x4ee65a));_0x507f08(_0x4ee65a);})[_0x0e82('0x19')](function(_0x268af5){logger[_0x0e82('0x10')]('UpdateOpenchannelQueueReport',_0x268af5['message'],_0x3d6c28);_0xee85dd(_0x24f883[_0x0e82('0x10')](0x1f4,_0x268af5['message']));});});}; \ No newline at end of file +var _0x26f9=['rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','OpenchannelQueueReport','create','options','CreateOpenchannelQueueReport','update','body','where','attributes','UpdateOpenchannelQueueReport','lodash','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x3b268d,_0x3eafcf){var _0x23b25f=function(_0x4b2787){while(--_0x4b2787){_0x3b268d['push'](_0x3b268d['shift']());}};_0x23b25f(++_0x3eafcf);}(_0x26f9,0x16f));var _0x926f=function(_0x3382e2,_0x6fbda2){_0x3382e2=_0x3382e2-0x0;var _0x25381b=_0x26f9[_0x3382e2];return _0x25381b;};'use strict';var _=require(_0x926f('0x0'));var util=require(_0x926f('0x1'));var moment=require('moment');var BPromise=require(_0x926f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x926f('0x3'))['db'];var utils=require(_0x926f('0x4'));var logger=require('../../config/logger')(_0x926f('0x5'));var config=require(_0x926f('0x6'));var jayson=require(_0x926f('0x7'));var client=jayson[_0x926f('0x8')][_0x926f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d2ded,_0xf56fcb,_0x1e455d){return new BPromise(function(_0x41a7ed,_0x2af11e){return client['request'](_0x3d2ded,_0x1e455d)[_0x926f('0xa')](function(_0x593c13){logger[_0x926f('0xb')](_0x926f('0xc'),_0xf56fcb,'request\x20sent');logger[_0x926f('0xd')](_0x926f('0xe'),_0xf56fcb,_0x926f('0xf'),JSON[_0x926f('0x10')](_0x593c13));if(_0x593c13[_0x926f('0x11')]){if(_0x593c13['error'][_0x926f('0x12')]===0x1f4){logger[_0x926f('0x11')](_0x926f('0xc'),_0xf56fcb,_0x593c13[_0x926f('0x11')][_0x926f('0x13')]);return _0x2af11e(_0x593c13[_0x926f('0x11')][_0x926f('0x13')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0xf56fcb,_0x593c13['error'][_0x926f('0x13')]);return _0x41a7ed(_0x593c13[_0x926f('0x11')][_0x926f('0x13')]);}else{logger[_0x926f('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xf56fcb,_0x926f('0xf'));_0x41a7ed(_0x593c13[_0x926f('0x14')]['message']);}})[_0x926f('0x15')](function(_0x52865b){logger[_0x926f('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xf56fcb,_0x52865b);_0x2af11e(_0x52865b);});});}exports['CreateOpenchannelQueueReport']=function(_0x36ead3){var _0xab29b3=this;return new Promise(function(_0x4f25e3,_0x3ed07d){return db[_0x926f('0x16')][_0x926f('0x17')](_0x36ead3['body'],{'raw':_0x36ead3[_0x926f('0x18')]?_0x36ead3[_0x926f('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x926f('0xa')](function(_0x4241ac){logger['info'](_0x926f('0x19'),_0x36ead3);logger[_0x926f('0xd')](_0x926f('0x19'),_0x36ead3,JSON[_0x926f('0x10')](_0x4241ac));_0x4f25e3(_0x4241ac);})[_0x926f('0x15')](function(_0x3b7179){logger[_0x926f('0x11')](_0x926f('0x19'),_0x3b7179[_0x926f('0x13')],_0x36ead3);_0x3ed07d(_0xab29b3[_0x926f('0x11')](0x1f4,_0x3b7179[_0x926f('0x13')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x2d76eb){var _0x151f71=this;return new Promise(function(_0x53f10c,_0x640fe0){return db[_0x926f('0x16')][_0x926f('0x1a')](_0x2d76eb[_0x926f('0x1b')],{'raw':_0x2d76eb[_0x926f('0x18')]?_0x2d76eb[_0x926f('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d76eb[_0x926f('0x18')]?_0x2d76eb['options'][_0x926f('0x1c')]||null:null,'attributes':_0x2d76eb[_0x926f('0x18')]?_0x2d76eb[_0x926f('0x18')][_0x926f('0x1d')]||null:null,'limit':_0x2d76eb['options']?_0x2d76eb[_0x926f('0x18')]['limit']||null:null})[_0x926f('0xa')](function(_0x2556ce){logger['info']('UpdateOpenchannelQueueReport',_0x2d76eb);logger[_0x926f('0xd')](_0x926f('0x1e'),_0x2d76eb,JSON['stringify'](_0x2556ce));_0x53f10c(_0x2556ce);})[_0x926f('0x15')](function(_0xb6b509){logger['error']('UpdateOpenchannelQueueReport',_0xb6b509[_0x926f('0x13')],_0x2d76eb);_0x640fe0(_0x151f71[_0x926f('0x11')](0x1f4,_0xb6b509[_0x926f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 4b3d727..effce59 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 _0x5924=['show','create','put','update','delete','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x102214,_0x28d5cf){var _0xa95bab=function(_0x452234){while(--_0x452234){_0x102214['push'](_0x102214['shift']());}};_0xa95bab(++_0x28d5cf);}(_0x5924,0x122));var _0x4592=function(_0x5545f7,_0x570414){_0x5545f7=_0x5545f7-0x0;var _0x52a979=_0x5924[_0x5545f7];return _0x52a979;};'use strict';var multer=require(_0x4592('0x0'));var util=require(_0x4592('0x1'));var path=require(_0x4592('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4592('0x3')]();var fs_extra=require(_0x4592('0x4'));var auth=require(_0x4592('0x5'));var interaction=require(_0x4592('0x6'));var config=require('../../config/environment');var controller=require(_0x4592('0x7'));router[_0x4592('0x8')]('/',auth['isAuthenticated'](),controller[_0x4592('0x9')]);router[_0x4592('0x8')](_0x4592('0xa'),auth[_0x4592('0xb')](),controller[_0x4592('0xc')]);router[_0x4592('0x8')](_0x4592('0xd'),auth['isAuthenticated'](),controller[_0x4592('0xe')]);router['post']('/',auth[_0x4592('0xb')](),controller[_0x4592('0xf')]);router[_0x4592('0x10')](_0x4592('0xd'),auth[_0x4592('0xb')](),controller[_0x4592('0x11')]);router[_0x4592('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf143=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','index','/describe','isAuthenticated','describe','get','/:id','show','post','put','delete'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xf143,0xb1));var _0x3f14=function(_0x51292d,_0x259f8c){_0x51292d=_0x51292d-0x0;var _0x2a62a8=_0xf143[_0x51292d];return _0x2a62a8;};'use strict';var multer=require(_0x3f14('0x0'));var util=require(_0x3f14('0x1'));var path=require(_0x3f14('0x2'));var timeout=require(_0x3f14('0x3'));var express=require(_0x3f14('0x4'));var router=express[_0x3f14('0x5')]();var fs_extra=require(_0x3f14('0x6'));var auth=require(_0x3f14('0x7'));var interaction=require(_0x3f14('0x8'));var config=require(_0x3f14('0x9'));var controller=require(_0x3f14('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x3f14('0xb')]);router['get'](_0x3f14('0xc'),auth[_0x3f14('0xd')](),controller[_0x3f14('0xe')]);router[_0x3f14('0xf')](_0x3f14('0x10'),auth['isAuthenticated'](),controller[_0x3f14('0x11')]);router[_0x3f14('0x12')]('/',auth[_0x3f14('0xd')](),controller['create']);router[_0x3f14('0x13')]('/:id',auth[_0x3f14('0xd')](),controller['update']);router[_0x3f14('0x14')](_0x3f14('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x3f14('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 b3079b8..e3aae8b 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x33692e,_0x12b5b0){var _0x5966e3=function(_0x2dd696){while(--_0x2dd696){_0x33692e['push'](_0x33692e['shift']());}};_0x5966e3(++_0x12b5b0);}(_0x34e8,0x12c));var _0x834e=function(_0x32e8a1,_0x133a9f){_0x32e8a1=_0x32e8a1-0x0;var _0x235f0d=_0x34e8[_0x32e8a1];return _0x235f0d;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x8b92e5,_0x257b4a){var _0x1c8281=function(_0x3bea85){while(--_0x3bea85){_0x8b92e5['push'](_0x8b92e5['shift']());}};_0x1c8281(++_0x257b4a);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x5a905e,_0x31aa4a){_0x5a905e=_0x5a905e-0x0;var _0x4124d6=_0xf3cd[_0x5a905e];return _0x4124d6;};'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 c034aa4..e61ef5c 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 _0xbffd=['jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','count','offset','limit','status','Content-Range','apply','reject','save','update','then','error','name','send','index','map','OpenchannelTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','include','rows','catch','show','params','includeAll','options','create','body','find','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','crypto'];(function(_0xfef9d8,_0x336e1b){var _0x2d5e85=function(_0x554a4a){while(--_0x554a4a){_0xfef9d8['push'](_0xfef9d8['shift']());}};_0x2d5e85(++_0x336e1b);}(_0xbffd,0x84));var _0xdbff=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xbffd[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0xdbff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdbff('0x1'));var jsonpatch=require(_0xdbff('0x2'));var rp=require(_0xdbff('0x3'));var moment=require(_0xdbff('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdbff('0x5'));var util=require(_0xdbff('0x6'));var path=require(_0xdbff('0x7'));var sox=require(_0xdbff('0x8'));var csv=require('to-csv');var ejs=require(_0xdbff('0x9'));var fs=require('fs');var fs_extra=require(_0xdbff('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xdbff('0xb'));var jsforce=require(_0xdbff('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdbff('0xd'));var querystring=require('querystring');var Papa=require(_0xdbff('0xe'));var Redis=require(_0xdbff('0xf'));var authService=require(_0xdbff('0x10'));var qs=require(_0xdbff('0x11'));var as=require(_0xdbff('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xdbff('0x13'));var config=require(_0xdbff('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xdbff('0x15'))['db'];function respondWithStatusCode(_0x1e7007,_0x18683c){_0x18683c=_0x18683c||0xcc;return function(_0x5dc514){if(_0x5dc514){return _0x1e7007['sendStatus'](_0x18683c);}return _0x1e7007['status'](_0x18683c)[_0xdbff('0x16')]();};}function respondWithResult(_0x4a83ad,_0x5ce781){_0x5ce781=_0x5ce781||0xc8;return function(_0x47d850){if(_0x47d850){return _0x4a83ad['status'](_0x5ce781)[_0xdbff('0x17')](_0x47d850);}};}function respondWithFilteredResult(_0x4428aa,_0x2add0c){return function(_0x4dc514){if(_0x4dc514){var _0x4682d2=typeof _0x2add0c['offset']===_0xdbff('0x18')&&typeof _0x2add0c['limit']===_0xdbff('0x18');var _0x62fe01=_0x4dc514[_0xdbff('0x19')];var _0x271c71=_0x4682d2?0x0:_0x2add0c[_0xdbff('0x1a')];var _0x22851a=_0x4682d2?_0x4dc514[_0xdbff('0x19')]:_0x2add0c[_0xdbff('0x1a')]+_0x2add0c[_0xdbff('0x1b')];var _0x57cef4;if(_0x22851a>=_0x62fe01){_0x22851a=_0x62fe01;_0x57cef4=0xc8;}else{_0x57cef4=0xce;}_0x4428aa[_0xdbff('0x1c')](_0x57cef4);return _0x4428aa['set'](_0xdbff('0x1d'),_0x271c71+'-'+_0x22851a+'/'+_0x62fe01)[_0xdbff('0x17')](_0x4dc514);}return null;};}function patchUpdates(_0x4ef23e){return function(_0x52b2db){try{jsonpatch[_0xdbff('0x1e')](_0x52b2db,_0x4ef23e,!![]);}catch(_0xcb4a0){return BPromise[_0xdbff('0x1f')](_0xcb4a0);}return _0x52b2db[_0xdbff('0x20')]();};}function saveUpdates(_0x4f0d5b,_0x1ba593){return function(_0x482786){if(_0x482786){return _0x482786[_0xdbff('0x21')](_0x4f0d5b)[_0xdbff('0x22')](function(_0x5c461d){return _0x5c461d;});}return null;};}function removeEntity(_0x4c3af7,_0x2f8c7a){return function(_0x50fee7){if(_0x50fee7){return _0x50fee7['destroy']()[_0xdbff('0x22')](function(){_0x4c3af7['status'](0xcc)[_0xdbff('0x16')]();});}};}function handleEntityNotFound(_0x2673b9,_0x2587fe){return function(_0x11646c){if(!_0x11646c){_0x2673b9['sendStatus'](0x194);}return _0x11646c;};}function handleError(_0x5b0bd4,_0x17c925){_0x17c925=_0x17c925||0x1f4;return function(_0x1b2ca9){logger[_0xdbff('0x23')](_0x1b2ca9['stack']);if(_0x1b2ca9['name']){delete _0x1b2ca9[_0xdbff('0x24')];}_0x5b0bd4[_0xdbff('0x1c')](_0x17c925)[_0xdbff('0x25')](_0x1b2ca9);};}exports[_0xdbff('0x26')]=function(_0x391e59,_0x3732db){var _0x36e93f={},_0x475654={},_0x808d78={'count':0x0,'rows':[]};var _0x38aa35=_[_0xdbff('0x27')](db[_0xdbff('0x28')][_0xdbff('0x29')],function(_0x2edc45){return{'name':_0x2edc45['fieldName'],'type':_0x2edc45[_0xdbff('0x2a')][_0xdbff('0x2b')]};});_0x475654[_0xdbff('0x2c')]=_[_0xdbff('0x27')](_0x38aa35,_0xdbff('0x24'));_0x475654[_0xdbff('0x2d')]=_[_0xdbff('0x2e')](_0x391e59['query']);_0x475654[_0xdbff('0x2f')]=_[_0xdbff('0x30')](_0x475654[_0xdbff('0x2c')],_0x475654['query']);_0x36e93f[_0xdbff('0x31')]=_[_0xdbff('0x30')](_0x475654[_0xdbff('0x2c')],qs[_0xdbff('0x32')](_0x391e59[_0xdbff('0x2d')]['fields']));_0x36e93f[_0xdbff('0x31')]=_0x36e93f[_0xdbff('0x31')][_0xdbff('0x33')]?_0x36e93f[_0xdbff('0x31')]:_0x475654['model'];if(!_0x391e59[_0xdbff('0x2d')][_0xdbff('0x34')]('nolimit')){_0x36e93f[_0xdbff('0x1b')]=qs[_0xdbff('0x1b')](_0x391e59[_0xdbff('0x2d')][_0xdbff('0x1b')]);_0x36e93f[_0xdbff('0x1a')]=qs[_0xdbff('0x1a')](_0x391e59['query'][_0xdbff('0x1a')]);}_0x36e93f[_0xdbff('0x35')]=qs['sort'](_0x391e59['query'][_0xdbff('0x36')]);_0x36e93f['where']=qs['filters'](_[_0xdbff('0x37')](_0x391e59[_0xdbff('0x2d')],_0x475654[_0xdbff('0x2f')]),_0x38aa35);if(_0x391e59[_0xdbff('0x2d')][_0xdbff('0x38')]){_0x36e93f[_0xdbff('0x39')]=_[_0xdbff('0x3a')](_0x36e93f[_0xdbff('0x39')],{'$or':_[_0xdbff('0x27')](_0x38aa35,function(_0x48b98c){if(_0x48b98c[_0xdbff('0x2a')]!==_0xdbff('0x3b')){var _0x392bfa={};_0x392bfa[_0x48b98c[_0xdbff('0x24')]]={'$like':'%'+_0x391e59[_0xdbff('0x2d')][_0xdbff('0x38')]+'%'};return _0x392bfa;}})});}_0x36e93f=_[_0xdbff('0x3a')]({},_0x36e93f,_0x391e59['options']);var _0x36be61={'where':_0x36e93f[_0xdbff('0x39')]};return db[_0xdbff('0x28')]['count'](_0x36be61)['then'](function(_0xf3d04e){_0x808d78[_0xdbff('0x19')]=_0xf3d04e;if(_0x391e59[_0xdbff('0x2d')]['includeAll']){_0x36e93f[_0xdbff('0x3c')]=[{'all':!![]}];}return db[_0xdbff('0x28')]['findAll'](_0x36e93f);})[_0xdbff('0x22')](function(_0x7d9a2b){_0x808d78[_0xdbff('0x3d')]=_0x7d9a2b;return _0x808d78;})[_0xdbff('0x22')](respondWithFilteredResult(_0x3732db,_0x36e93f))[_0xdbff('0x3e')](handleError(_0x3732db,null));};exports[_0xdbff('0x3f')]=function(_0x5c1f16,_0x396cbf){var _0x17970f={'raw':!![],'where':{'id':_0x5c1f16[_0xdbff('0x40')]['id']}},_0x588d6b={};_0x588d6b['model']=_[_0xdbff('0x2e')](db[_0xdbff('0x28')]['rawAttributes']);_0x588d6b[_0xdbff('0x2d')]=_[_0xdbff('0x2e')](_0x5c1f16['query']);_0x588d6b[_0xdbff('0x2f')]=_['intersection'](_0x588d6b['model'],_0x588d6b[_0xdbff('0x2d')]);_0x17970f[_0xdbff('0x31')]=_[_0xdbff('0x30')](_0x588d6b['model'],qs[_0xdbff('0x32')](_0x5c1f16['query']['fields']));_0x17970f[_0xdbff('0x31')]=_0x17970f[_0xdbff('0x31')][_0xdbff('0x33')]?_0x17970f[_0xdbff('0x31')]:_0x588d6b[_0xdbff('0x2c')];if(_0x5c1f16[_0xdbff('0x2d')][_0xdbff('0x41')]){_0x17970f[_0xdbff('0x3c')]=[{'all':!![]}];}_0x17970f=_[_0xdbff('0x3a')]({},_0x17970f,_0x5c1f16[_0xdbff('0x42')]);return db[_0xdbff('0x28')]['find'](_0x17970f)[_0xdbff('0x22')](handleEntityNotFound(_0x396cbf,null))[_0xdbff('0x22')](respondWithResult(_0x396cbf,null))['catch'](handleError(_0x396cbf,null));};exports[_0xdbff('0x43')]=function(_0x5e484f,_0xdc3b7b){return db[_0xdbff('0x28')][_0xdbff('0x43')](_0x5e484f[_0xdbff('0x44')],{})[_0xdbff('0x22')](respondWithResult(_0xdc3b7b,0xc9))[_0xdbff('0x3e')](handleError(_0xdc3b7b,null));};exports[_0xdbff('0x21')]=function(_0xf7cf4f,_0x480b89){if(_0xf7cf4f[_0xdbff('0x44')]['id']){delete _0xf7cf4f['body']['id'];}return db['OpenchannelTransferReport'][_0xdbff('0x45')]({'where':{'id':_0xf7cf4f['params']['id']}})['then'](handleEntityNotFound(_0x480b89,null))[_0xdbff('0x22')](saveUpdates(_0xf7cf4f['body'],null))[_0xdbff('0x22')](respondWithResult(_0x480b89,null))[_0xdbff('0x3e')](handleError(_0x480b89,null));};exports[_0xdbff('0x46')]=function(_0x50f371,_0x4aa622){return db[_0xdbff('0x28')][_0xdbff('0x45')]({'where':{'id':_0x50f371[_0xdbff('0x40')]['id']}})[_0xdbff('0x22')](handleEntityNotFound(_0x4aa622,null))[_0xdbff('0x22')](removeEntity(_0x4aa622,null))[_0xdbff('0x3e')](handleError(_0x4aa622,null));};exports[_0xdbff('0x47')]=function(_0x41166c,_0x4def6e){return db[_0xdbff('0x28')][_0xdbff('0x47')]()[_0xdbff('0x22')](respondWithResult(_0x4def6e,null))[_0xdbff('0x3e')](handleError(_0x4def6e,null));}; \ No newline at end of file +var _0x3dc8=['hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','params','includeAll','find','create','body','destroy','describe','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','then','error','stack','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length'];(function(_0x1e5a89,_0x1ddcd1){var _0x488f72=function(_0x1a1854){while(--_0x1a1854){_0x1e5a89['push'](_0x1e5a89['shift']());}};_0x488f72(++_0x1ddcd1);}(_0x3dc8,0x17a));var _0x83dc=function(_0x9e64f2,_0x36e7c3){_0x9e64f2=_0x9e64f2-0x0;var _0x29b523=_0x3dc8[_0x9e64f2];return _0x29b523;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x83dc('0x0'));var rp=require('request-promise');var moment=require(_0x83dc('0x1'));var BPromise=require(_0x83dc('0x2'));var Mustache=require(_0x83dc('0x3'));var util=require(_0x83dc('0x4'));var path=require('path');var sox=require(_0x83dc('0x5'));var csv=require(_0x83dc('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x83dc('0x7'));var _=require('lodash');var squel=require(_0x83dc('0x8'));var crypto=require(_0x83dc('0x9'));var jsforce=require(_0x83dc('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x83dc('0x6'));var querystring=require(_0x83dc('0xb'));var Papa=require(_0x83dc('0xc'));var Redis=require(_0x83dc('0xd'));var authService=require(_0x83dc('0xe'));var qs=require(_0x83dc('0xf'));var as=require(_0x83dc('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x83dc('0x11'))(_0x83dc('0x12'));var utils=require(_0x83dc('0x13'));var config=require(_0x83dc('0x14'));var licenseUtil=require(_0x83dc('0x15'));var db=require(_0x83dc('0x16'))['db'];function respondWithStatusCode(_0x2236d2,_0x9add02){_0x9add02=_0x9add02||0xcc;return function(_0x469091){if(_0x469091){return _0x2236d2[_0x83dc('0x17')](_0x9add02);}return _0x2236d2[_0x83dc('0x18')](_0x9add02)[_0x83dc('0x19')]();};}function respondWithResult(_0x1ac755,_0x207bd4){_0x207bd4=_0x207bd4||0xc8;return function(_0x1bb532){if(_0x1bb532){return _0x1ac755[_0x83dc('0x18')](_0x207bd4)[_0x83dc('0x1a')](_0x1bb532);}};}function respondWithFilteredResult(_0x5a37aa,_0x4b99d9){return function(_0x23abd2){if(_0x23abd2){var _0x50a0b5=typeof _0x4b99d9['offset']==='undefined'&&typeof _0x4b99d9[_0x83dc('0x1b')]===_0x83dc('0x1c');var _0x3cd171=_0x23abd2[_0x83dc('0x1d')];var _0x5d6498=_0x50a0b5?0x0:_0x4b99d9[_0x83dc('0x1e')];var _0x38515d=_0x50a0b5?_0x23abd2['count']:_0x4b99d9[_0x83dc('0x1e')]+_0x4b99d9[_0x83dc('0x1b')];var _0x2101de;if(_0x38515d>=_0x3cd171){_0x38515d=_0x3cd171;_0x2101de=0xc8;}else{_0x2101de=0xce;}_0x5a37aa[_0x83dc('0x18')](_0x2101de);return _0x5a37aa[_0x83dc('0x1f')]('Content-Range',_0x5d6498+'-'+_0x38515d+'/'+_0x3cd171)[_0x83dc('0x1a')](_0x23abd2);}return null;};}function patchUpdates(_0x3b4289){return function(_0x307cb5){try{jsonpatch[_0x83dc('0x20')](_0x307cb5,_0x3b4289,!![]);}catch(_0x2dcba4){return BPromise[_0x83dc('0x21')](_0x2dcba4);}return _0x307cb5['save']();};}function saveUpdates(_0x252170,_0x38a19c){return function(_0xab8ece){if(_0xab8ece){return _0xab8ece['update'](_0x252170)['then'](function(_0x30ca02){return _0x30ca02;});}return null;};}function removeEntity(_0x5cf34a,_0x12be93){return function(_0x1c1398){if(_0x1c1398){return _0x1c1398['destroy']()[_0x83dc('0x22')](function(){_0x5cf34a[_0x83dc('0x18')](0xcc)[_0x83dc('0x19')]();});}};}function handleEntityNotFound(_0x50087c,_0x98ab6a){return function(_0x8f5568){if(!_0x8f5568){_0x50087c[_0x83dc('0x17')](0x194);}return _0x8f5568;};}function handleError(_0x509045,_0x5881af){_0x5881af=_0x5881af||0x1f4;return function(_0x45e1c0){logger[_0x83dc('0x23')](_0x45e1c0[_0x83dc('0x24')]);if(_0x45e1c0['name']){delete _0x45e1c0['name'];}_0x509045['status'](_0x5881af)[_0x83dc('0x25')](_0x45e1c0);};}exports[_0x83dc('0x26')]=function(_0x5a63c8,_0x3664ae){var _0x2f47ab={},_0x8278b4={},_0x1b1575={'count':0x0,'rows':[]};var _0x15587d=_[_0x83dc('0x27')](db[_0x83dc('0x28')][_0x83dc('0x29')],function(_0x2caab5){return{'name':_0x2caab5[_0x83dc('0x2a')],'type':_0x2caab5[_0x83dc('0x2b')][_0x83dc('0x2c')]};});_0x8278b4[_0x83dc('0x2d')]=_[_0x83dc('0x27')](_0x15587d,_0x83dc('0x2e'));_0x8278b4[_0x83dc('0x2f')]=_[_0x83dc('0x30')](_0x5a63c8[_0x83dc('0x2f')]);_0x8278b4[_0x83dc('0x31')]=_[_0x83dc('0x32')](_0x8278b4[_0x83dc('0x2d')],_0x8278b4[_0x83dc('0x2f')]);_0x2f47ab[_0x83dc('0x33')]=_[_0x83dc('0x32')](_0x8278b4[_0x83dc('0x2d')],qs[_0x83dc('0x34')](_0x5a63c8[_0x83dc('0x2f')][_0x83dc('0x34')]));_0x2f47ab['attributes']=_0x2f47ab['attributes'][_0x83dc('0x35')]?_0x2f47ab['attributes']:_0x8278b4[_0x83dc('0x2d')];if(!_0x5a63c8[_0x83dc('0x2f')][_0x83dc('0x36')]('nolimit')){_0x2f47ab['limit']=qs[_0x83dc('0x1b')](_0x5a63c8[_0x83dc('0x2f')][_0x83dc('0x1b')]);_0x2f47ab[_0x83dc('0x1e')]=qs[_0x83dc('0x1e')](_0x5a63c8[_0x83dc('0x2f')][_0x83dc('0x1e')]);}_0x2f47ab[_0x83dc('0x37')]=qs['sort'](_0x5a63c8['query'][_0x83dc('0x38')]);_0x2f47ab[_0x83dc('0x39')]=qs['filters'](_[_0x83dc('0x3a')](_0x5a63c8[_0x83dc('0x2f')],_0x8278b4[_0x83dc('0x31')]),_0x15587d);if(_0x5a63c8[_0x83dc('0x2f')][_0x83dc('0x3b')]){_0x2f47ab['where']=_[_0x83dc('0x3c')](_0x2f47ab[_0x83dc('0x39')],{'$or':_[_0x83dc('0x27')](_0x15587d,function(_0x280f04){if(_0x280f04[_0x83dc('0x2b')]!==_0x83dc('0x3d')){var _0x461e2e={};_0x461e2e[_0x280f04['name']]={'$like':'%'+_0x5a63c8[_0x83dc('0x2f')]['filter']+'%'};return _0x461e2e;}})});}_0x2f47ab=_['merge']({},_0x2f47ab,_0x5a63c8['options']);var _0x2543d7={'where':_0x2f47ab[_0x83dc('0x39')]};return db['OpenchannelTransferReport']['count'](_0x2543d7)[_0x83dc('0x22')](function(_0x36847f){_0x1b1575[_0x83dc('0x1d')]=_0x36847f;if(_0x5a63c8[_0x83dc('0x2f')]['includeAll']){_0x2f47ab[_0x83dc('0x3e')]=[{'all':!![]}];}return db[_0x83dc('0x28')]['findAll'](_0x2f47ab);})[_0x83dc('0x22')](function(_0x49ce74){_0x1b1575[_0x83dc('0x3f')]=_0x49ce74;return _0x1b1575;})[_0x83dc('0x22')](respondWithFilteredResult(_0x3664ae,_0x2f47ab))[_0x83dc('0x40')](handleError(_0x3664ae,null));};exports['show']=function(_0x5d34e2,_0x1956f5){var _0x69d23d={'raw':!![],'where':{'id':_0x5d34e2[_0x83dc('0x41')]['id']}},_0x4036bd={};_0x4036bd['model']=_[_0x83dc('0x30')](db[_0x83dc('0x28')]['rawAttributes']);_0x4036bd[_0x83dc('0x2f')]=_[_0x83dc('0x30')](_0x5d34e2['query']);_0x4036bd[_0x83dc('0x31')]=_[_0x83dc('0x32')](_0x4036bd[_0x83dc('0x2d')],_0x4036bd[_0x83dc('0x2f')]);_0x69d23d[_0x83dc('0x33')]=_[_0x83dc('0x32')](_0x4036bd[_0x83dc('0x2d')],qs[_0x83dc('0x34')](_0x5d34e2[_0x83dc('0x2f')]['fields']));_0x69d23d[_0x83dc('0x33')]=_0x69d23d[_0x83dc('0x33')][_0x83dc('0x35')]?_0x69d23d[_0x83dc('0x33')]:_0x4036bd[_0x83dc('0x2d')];if(_0x5d34e2['query'][_0x83dc('0x42')]){_0x69d23d['include']=[{'all':!![]}];}_0x69d23d=_['merge']({},_0x69d23d,_0x5d34e2['options']);return db[_0x83dc('0x28')][_0x83dc('0x43')](_0x69d23d)['then'](handleEntityNotFound(_0x1956f5,null))['then'](respondWithResult(_0x1956f5,null))[_0x83dc('0x40')](handleError(_0x1956f5,null));};exports[_0x83dc('0x44')]=function(_0x3131fc,_0x2d9d9c){return db['OpenchannelTransferReport'][_0x83dc('0x44')](_0x3131fc[_0x83dc('0x45')],{})[_0x83dc('0x22')](respondWithResult(_0x2d9d9c,0xc9))[_0x83dc('0x40')](handleError(_0x2d9d9c,null));};exports['update']=function(_0x1f21bb,_0x3a56af){if(_0x1f21bb['body']['id']){delete _0x1f21bb[_0x83dc('0x45')]['id'];}return db[_0x83dc('0x28')][_0x83dc('0x43')]({'where':{'id':_0x1f21bb[_0x83dc('0x41')]['id']}})[_0x83dc('0x22')](handleEntityNotFound(_0x3a56af,null))[_0x83dc('0x22')](saveUpdates(_0x1f21bb['body'],null))[_0x83dc('0x22')](respondWithResult(_0x3a56af,null))[_0x83dc('0x40')](handleError(_0x3a56af,null));};exports[_0x83dc('0x46')]=function(_0x42c5c0,_0x32e1e2){return db[_0x83dc('0x28')][_0x83dc('0x43')]({'where':{'id':_0x42c5c0['params']['id']}})[_0x83dc('0x22')](handleEntityNotFound(_0x32e1e2,null))[_0x83dc('0x22')](removeEntity(_0x32e1e2,null))['catch'](handleError(_0x32e1e2,null));};exports[_0x83dc('0x47')]=function(_0xf013e0,_0x429d99){return db[_0x83dc('0x28')][_0x83dc('0x47')]()[_0x83dc('0x22')](respondWithResult(_0x429d99,null))['catch'](handleError(_0x429d99,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index e1e38eb..0962d86 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 _0xa676=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer'];(function(_0x57ea7b,_0x4f6ff4){var _0x1b444c=function(_0x2b093c){while(--_0x2b093c){_0x57ea7b['push'](_0x57ea7b['shift']());}};_0x1b444c(++_0x4f6ff4);}(_0xa676,0xc1));var _0x6a67=function(_0x1c15aa,_0x343fc2){_0x1c15aa=_0x1c15aa-0x0;var _0x47c365=_0xa676[_0x1c15aa];return _0x47c365;};'use strict';var _=require(_0x6a67('0x0'));var util=require(_0x6a67('0x1'));var logger=require(_0x6a67('0x2'))(_0x6a67('0x3'));var moment=require(_0x6a67('0x4'));var BPromise=require(_0x6a67('0x5'));var rp=require(_0x6a67('0x6'));var fs=require('fs');var path=require(_0x6a67('0x7'));var rimraf=require(_0x6a67('0x8'));var config=require(_0x6a67('0x9'));var attributes=require(_0x6a67('0xa'));module[_0x6a67('0xb')]=function(_0x622dd1,_0x55aa69){return _0x622dd1[_0x6a67('0xc')](_0x6a67('0xd'),attributes,{'tableName':_0x6a67('0xe'),'paranoid':![],'indexes':[{'name':_0x6a67('0xf'),'fields':[_0x6a67('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0791=['path','../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x19a49f,_0x444d74){var _0x5351ae=function(_0x58b1ed){while(--_0x58b1ed){_0x19a49f['push'](_0x19a49f['shift']());}};_0x5351ae(++_0x444d74);}(_0x0791,0x1a7));var _0x1079=function(_0x27a3cb,_0x4af597){_0x27a3cb=_0x27a3cb-0x0;var _0x54ff38=_0x0791[_0x27a3cb];return _0x54ff38;};'use strict';var _=require(_0x1079('0x0'));var util=require('util');var logger=require(_0x1079('0x1'))(_0x1079('0x2'));var moment=require(_0x1079('0x3'));var BPromise=require(_0x1079('0x4'));var rp=require(_0x1079('0x5'));var fs=require('fs');var path=require(_0x1079('0x6'));var rimraf=require('rimraf');var config=require(_0x1079('0x7'));var attributes=require(_0x1079('0x8'));module['exports']=function(_0x299eed,_0xbd3cf6){return _0x299eed[_0x1079('0x9')](_0x1079('0xa'),attributes,{'tableName':_0x1079('0xb'),'paranoid':![],'indexes':[{'name':_0x1079('0xc'),'fields':[_0x1079('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 1c91ab2..8b0c98a 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 _0xa23f=['code','OpenchannelTransferReport,\x20%s,\x20%s','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','debug','request\x20sent','error'];(function(_0x41a7dd,_0x2cc7b6){var _0x4db8dc=function(_0x3fbd5d){while(--_0x3fbd5d){_0x41a7dd['push'](_0x41a7dd['shift']());}};_0x4db8dc(++_0x2cc7b6);}(_0xa23f,0x7c));var _0xfa23=function(_0x2c50d9,_0xf95d6){_0x2c50d9=_0x2c50d9-0x0;var _0xba901a=_0xa23f[_0x2c50d9];return _0xba901a;};'use strict';var _=require(_0xfa23('0x0'));var util=require(_0xfa23('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfa23('0x2'));var fs=require('fs');var Redis=require(_0xfa23('0x3'));var db=require(_0xfa23('0x4'))['db'];var utils=require(_0xfa23('0x5'));var logger=require('../../config/logger')(_0xfa23('0x6'));var config=require('../../config/environment');var jayson=require(_0xfa23('0x7'));var client=jayson[_0xfa23('0x8')][_0xfa23('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3696ef,_0x4fb6e6,_0x5a7882){return new BPromise(function(_0x59d53e,_0x19a1ac){return client[_0xfa23('0xa')](_0x3696ef,_0x5a7882)[_0xfa23('0xb')](function(_0x31bb2c){logger[_0xfa23('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4fb6e6,'request\x20sent');logger[_0xfa23('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x4fb6e6,_0xfa23('0xe'),JSON['stringify'](_0x31bb2c));if(_0x31bb2c[_0xfa23('0xf')]){if(_0x31bb2c[_0xfa23('0xf')][_0xfa23('0x10')]===0x1f4){logger['error'](_0xfa23('0x11'),_0x4fb6e6,_0x31bb2c[_0xfa23('0xf')][_0xfa23('0x12')]);return _0x19a1ac(_0x31bb2c['error']['message']);}logger[_0xfa23('0xf')](_0xfa23('0x11'),_0x4fb6e6,_0x31bb2c[_0xfa23('0xf')][_0xfa23('0x12')]);return _0x59d53e(_0x31bb2c['error'][_0xfa23('0x12')]);}else{logger[_0xfa23('0xc')](_0xfa23('0x11'),_0x4fb6e6,_0xfa23('0xe'));_0x59d53e(_0x31bb2c['result'][_0xfa23('0x12')]);}})[_0xfa23('0x13')](function(_0x3ca6be){logger[_0xfa23('0xf')](_0xfa23('0x11'),_0x4fb6e6,_0x3ca6be);_0x19a1ac(_0x3ca6be);});});} \ No newline at end of file +var _0x0bde=['request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5a04ce,_0x5dfecd){var _0xb3ad7c=function(_0x2d5041){while(--_0x2d5041){_0x5a04ce['push'](_0x5a04ce['shift']());}};_0xb3ad7c(++_0x5dfecd);}(_0x0bde,0xe7));var _0xe0bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bde[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xe0bd('0x0'));var moment=require('moment');var BPromise=require(_0xe0bd('0x1'));var rs=require(_0xe0bd('0x2'));var fs=require('fs');var Redis=require(_0xe0bd('0x3'));var db=require(_0xe0bd('0x4'))['db'];var utils=require(_0xe0bd('0x5'));var logger=require('../../config/logger')(_0xe0bd('0x6'));var config=require(_0xe0bd('0x7'));var jayson=require(_0xe0bd('0x8'));var client=jayson[_0xe0bd('0x9')][_0xe0bd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26393f,_0x217145,_0x491dc7){return new BPromise(function(_0x40b36a,_0x44cb0b){return client[_0xe0bd('0xb')](_0x26393f,_0x491dc7)[_0xe0bd('0xc')](function(_0x393379){logger[_0xe0bd('0xd')](_0xe0bd('0xe'),_0x217145,_0xe0bd('0xf'));logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x217145,'request\x20sent',JSON[_0xe0bd('0x10')](_0x393379));if(_0x393379['error']){if(_0x393379['error'][_0xe0bd('0x11')]===0x1f4){logger[_0xe0bd('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x217145,_0x393379[_0xe0bd('0x12')]['message']);return _0x44cb0b(_0x393379[_0xe0bd('0x12')][_0xe0bd('0x13')]);}logger[_0xe0bd('0x12')](_0xe0bd('0xe'),_0x217145,_0x393379[_0xe0bd('0x12')][_0xe0bd('0x13')]);return _0x40b36a(_0x393379[_0xe0bd('0x12')][_0xe0bd('0x13')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x217145,'request\x20sent');_0x40b36a(_0x393379[_0xe0bd('0x14')][_0xe0bd('0x13')]);}})[_0xe0bd('0x15')](function(_0x379ea2){logger[_0xe0bd('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x217145,_0x379ea2);_0x44cb0b(_0x379ea2);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 7147f69..5a1d1df 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 _0x1d2b=['destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','show','put','/:id','update','delete'];(function(_0x1b06ca,_0x1cea98){var _0x4056e2=function(_0x524e7d){while(--_0x524e7d){_0x1b06ca['push'](_0x1b06ca['shift']());}};_0x4056e2(++_0x1cea98);}(_0x1d2b,0x1c9));var _0xb1d2=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x1d2b[_0x34021d];return _0x16597b;};'use strict';var multer=require(_0xb1d2('0x0'));var util=require(_0xb1d2('0x1'));var path=require(_0xb1d2('0x2'));var timeout=require(_0xb1d2('0x3'));var express=require(_0xb1d2('0x4'));var router=express[_0xb1d2('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb1d2('0x6'));var interaction=require(_0xb1d2('0x7'));var config=require(_0xb1d2('0x8'));var controller=require(_0xb1d2('0x9'));router[_0xb1d2('0xa')]('/',auth[_0xb1d2('0xb')](),controller[_0xb1d2('0xc')]);router['get']('/:id',auth[_0xb1d2('0xb')](),controller[_0xb1d2('0xd')]);router['post']('/',auth[_0xb1d2('0xb')](),controller['create']);router[_0xb1d2('0xe')](_0xb1d2('0xf'),auth[_0xb1d2('0xb')](),controller[_0xb1d2('0x10')]);router[_0xb1d2('0x11')](_0xb1d2('0xf'),auth['isAuthenticated'](),controller[_0xb1d2('0x12')]);module['exports']=router; \ No newline at end of file +var _0x14a2=['path','express','Router','../../components/auth/service','../../config/environment','./pause.controller','get','isAuthenticated','/:id','show','post','put','update','delete','exports','multer'];(function(_0x496923,_0x57825d){var _0x51b947=function(_0x20a04d){while(--_0x20a04d){_0x496923['push'](_0x496923['shift']());}};_0x51b947(++_0x57825d);}(_0x14a2,0x17f));var _0x214a=function(_0x386d8c,_0x3fcdf2){_0x386d8c=_0x386d8c-0x0;var _0x1ffa08=_0x14a2[_0x386d8c];return _0x1ffa08;};'use strict';var multer=require(_0x214a('0x0'));var util=require('util');var path=require(_0x214a('0x1'));var timeout=require('connect-timeout');var express=require(_0x214a('0x2'));var router=express[_0x214a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x214a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x214a('0x5'));var controller=require(_0x214a('0x6'));router[_0x214a('0x7')]('/',auth[_0x214a('0x8')](),controller['index']);router[_0x214a('0x7')](_0x214a('0x9'),auth[_0x214a('0x8')](),controller[_0x214a('0xa')]);router[_0x214a('0xb')]('/',auth[_0x214a('0x8')](),controller['create']);router[_0x214a('0xc')]('/:id',auth[_0x214a('0x8')](),controller[_0x214a('0xd')]);router[_0x214a('0xe')]('/:id',auth[_0x214a('0x8')](),controller['destroy']);module[_0x214a('0xf')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 7b68eec..a405a7a 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 _0xa321=['STRING','sequelize','exports','name'];(function(_0x3bb5b4,_0x128455){var _0x586c60=function(_0x179226){while(--_0x179226){_0x3bb5b4['push'](_0x3bb5b4['shift']());}};_0x586c60(++_0x128455);}(_0xa321,0xc1));var _0x1a32=function(_0x23cc76,_0x9c756b){_0x23cc76=_0x23cc76-0x0;var _0x2f5c13=_0xa321[_0x23cc76];return _0x2f5c13;};'use strict';var Sequelize=require(_0x1a32('0x0'));module[_0x1a32('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1a32('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x1a32('0x3')]}}; \ No newline at end of file +var _0x4d97=['sequelize','exports','STRING'];(function(_0x2f3757,_0x221083){var _0x3c4eaa=function(_0x395bf0){while(--_0x395bf0){_0x2f3757['push'](_0x2f3757['shift']());}};_0x3c4eaa(++_0x221083);}(_0x4d97,0xe1));var _0x74d9=function(_0x1b77e5,_0x266203){_0x1b77e5=_0x1b77e5-0x0;var _0x4eabf8=_0x4d97[_0x1b77e5];return _0x4eabf8;};'use strict';var Sequelize=require(_0x74d9('0x0'));module[_0x74d9('0x1')]={'name':{'type':Sequelize[_0x74d9('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x74d9('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 4a438e3..1e068bf 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 _0x05c5=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy','get','Pauses','UserProfileResource','end','error','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create'];(function(_0x2e38cd,_0x446de2){var _0x5120c9=function(_0x18768e){while(--_0x18768e){_0x2e38cd['push'](_0x2e38cd['shift']());}};_0x5120c9(++_0x446de2);}(_0x05c5,0x10a));var _0x505c=function(_0x5d6392,_0x271a01){_0x5d6392=_0x5d6392-0x0;var _0x5808ab=_0x05c5[_0x5d6392];return _0x5808ab;};'use strict';var emlformat=require(_0x505c('0x0'));var rimraf=require(_0x505c('0x1'));var zipdir=require(_0x505c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x505c('0x3'));var moment=require(_0x505c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x505c('0x5'));var util=require(_0x505c('0x6'));var path=require(_0x505c('0x7'));var sox=require(_0x505c('0x8'));var csv=require(_0x505c('0x9'));var ejs=require(_0x505c('0xa'));var fs=require('fs');var fs_extra=require(_0x505c('0xb'));var _=require(_0x505c('0xc'));var squel=require(_0x505c('0xd'));var crypto=require(_0x505c('0xe'));var jsforce=require(_0x505c('0xf'));var deskjs=require(_0x505c('0x10'));var toCsv=require('to-csv');var querystring=require(_0x505c('0x11'));var Papa=require(_0x505c('0x12'));var Redis=require(_0x505c('0x13'));var authService=require(_0x505c('0x14'));var qs=require(_0x505c('0x15'));var as=require(_0x505c('0x16'));var hardwareService=require(_0x505c('0x17'));var logger=require(_0x505c('0x18'))(_0x505c('0x19'));var utils=require(_0x505c('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x505c('0x1b'))['db'];function respondWithStatusCode(_0x389b19,_0x4c094c){_0x4c094c=_0x4c094c||0xcc;return function(_0x432b32){if(_0x432b32){return _0x389b19['sendStatus'](_0x4c094c);}return _0x389b19[_0x505c('0x1c')](_0x4c094c)['end']();};}function respondWithResult(_0x378ee0,_0x51e79c){_0x51e79c=_0x51e79c||0xc8;return function(_0x1ce2fc){if(_0x1ce2fc){return _0x378ee0['status'](_0x51e79c)[_0x505c('0x1d')](_0x1ce2fc);}};}function respondWithFilteredResult(_0x4f2009,_0x5d142b){return function(_0xf3ba1){if(_0xf3ba1){var _0x1c5860=typeof _0x5d142b[_0x505c('0x1e')]===_0x505c('0x1f')&&typeof _0x5d142b['limit']===_0x505c('0x1f');var _0x5f0769=_0xf3ba1[_0x505c('0x20')];var _0x15452b=_0x1c5860?0x0:_0x5d142b[_0x505c('0x1e')];var _0xb22612=_0x1c5860?_0xf3ba1[_0x505c('0x20')]:_0x5d142b[_0x505c('0x1e')]+_0x5d142b[_0x505c('0x21')];var _0xe4728c;if(_0xb22612>=_0x5f0769){_0xb22612=_0x5f0769;_0xe4728c=0xc8;}else{_0xe4728c=0xce;}_0x4f2009[_0x505c('0x1c')](_0xe4728c);return _0x4f2009[_0x505c('0x22')]('Content-Range',_0x15452b+'-'+_0xb22612+'/'+_0x5f0769)[_0x505c('0x1d')](_0xf3ba1);}return null;};}function patchUpdates(_0x1a922e){return function(_0x3fd1d0){try{jsonpatch[_0x505c('0x23')](_0x3fd1d0,_0x1a922e,!![]);}catch(_0x2d4a60){return BPromise[_0x505c('0x24')](_0x2d4a60);}return _0x3fd1d0[_0x505c('0x25')]();};}function saveUpdates(_0x3d8983,_0x5c7295){return function(_0x1c7478){if(_0x1c7478){return _0x1c7478['update'](_0x3d8983)[_0x505c('0x26')](function(_0x209664){return _0x209664;});}return null;};}function removeEntity(_0x4eecc0,_0x295635){return function(_0x738e7c){if(_0x738e7c){return _0x738e7c[_0x505c('0x27')]()[_0x505c('0x26')](function(){var _0x14e38d=_0x738e7c[_0x505c('0x28')]({'plain':!![]});var _0x1a0458=_0x505c('0x29');return db[_0x505c('0x2a')]['destroy']({'where':{'type':_0x1a0458,'resourceId':_0x14e38d['id']}})[_0x505c('0x26')](function(){return _0x738e7c;});})['then'](function(){_0x4eecc0['status'](0xcc)[_0x505c('0x2b')]();});}};}function handleEntityNotFound(_0x22a383,_0x1f6103){return function(_0x808155){if(!_0x808155){_0x22a383['sendStatus'](0x194);}return _0x808155;};}function handleError(_0x4ae715,_0x47e7be){_0x47e7be=_0x47e7be||0x1f4;return function(_0x24471f){logger[_0x505c('0x2c')](_0x24471f['stack']);if(_0x24471f['name']){delete _0x24471f[_0x505c('0x2d')];}_0x4ae715[_0x505c('0x1c')](_0x47e7be)[_0x505c('0x2e')](_0x24471f);};}exports[_0x505c('0x2f')]=function(_0xe20294,_0x320d63){var _0x32eb8d={},_0x51c50e={},_0x18b261={'count':0x0,'rows':[]};var _0xeb0eec=_[_0x505c('0x30')](db[_0x505c('0x31')][_0x505c('0x32')],function(_0x236131){return{'name':_0x236131[_0x505c('0x33')],'type':_0x236131[_0x505c('0x34')][_0x505c('0x35')]};});_0x51c50e[_0x505c('0x36')]=_[_0x505c('0x30')](_0xeb0eec,'name');_0x51c50e['query']=_[_0x505c('0x37')](_0xe20294[_0x505c('0x38')]);_0x51c50e['filters']=_[_0x505c('0x39')](_0x51c50e[_0x505c('0x36')],_0x51c50e[_0x505c('0x38')]);_0x32eb8d[_0x505c('0x3a')]=_['intersection'](_0x51c50e[_0x505c('0x36')],qs[_0x505c('0x3b')](_0xe20294[_0x505c('0x38')]['fields']));_0x32eb8d[_0x505c('0x3a')]=_0x32eb8d[_0x505c('0x3a')][_0x505c('0x3c')]?_0x32eb8d['attributes']:_0x51c50e[_0x505c('0x36')];if(!_0xe20294['query']['hasOwnProperty'](_0x505c('0x3d'))){_0x32eb8d[_0x505c('0x21')]=qs[_0x505c('0x21')](_0xe20294[_0x505c('0x38')][_0x505c('0x21')]);_0x32eb8d['offset']=qs['offset'](_0xe20294['query'][_0x505c('0x1e')]);}_0x32eb8d[_0x505c('0x3e')]=qs[_0x505c('0x3f')](_0xe20294[_0x505c('0x38')][_0x505c('0x3f')]);_0x32eb8d[_0x505c('0x40')]=qs[_0x505c('0x41')](_[_0x505c('0x42')](_0xe20294['query'],_0x51c50e[_0x505c('0x41')]),_0xeb0eec);if(_0xe20294['query'][_0x505c('0x43')]){_0x32eb8d[_0x505c('0x40')]=_[_0x505c('0x44')](_0x32eb8d[_0x505c('0x40')],{'$or':_[_0x505c('0x30')](_0xeb0eec,function(_0x145028){if(_0x145028['type']!==_0x505c('0x45')){var _0x509222={};_0x509222[_0x145028['name']]={'$like':'%'+_0xe20294[_0x505c('0x38')][_0x505c('0x43')]+'%'};return _0x509222;}})});}_0x32eb8d=_['merge']({},_0x32eb8d,_0xe20294[_0x505c('0x46')]);var _0x5c54fc={'where':_0x32eb8d[_0x505c('0x40')]};return db[_0x505c('0x31')][_0x505c('0x20')](_0x5c54fc)[_0x505c('0x26')](function(_0x4992d3){_0x18b261['count']=_0x4992d3;if(_0xe20294[_0x505c('0x38')][_0x505c('0x47')]){_0x32eb8d[_0x505c('0x48')]=[{'all':!![]}];}return db[_0x505c('0x31')][_0x505c('0x49')](_0x32eb8d);})[_0x505c('0x26')](function(_0x2ce434){_0x18b261[_0x505c('0x4a')]=_0x2ce434;return _0x18b261;})[_0x505c('0x26')](respondWithFilteredResult(_0x320d63,_0x32eb8d))[_0x505c('0x4b')](handleError(_0x320d63,null));};exports['show']=function(_0x4c2c5c,_0x221869){var _0x2b523d={'raw':!![],'where':{'id':_0x4c2c5c['params']['id']}},_0x5892e7={};_0x5892e7['model']=_[_0x505c('0x37')](db['Pause']['rawAttributes']);_0x5892e7[_0x505c('0x38')]=_[_0x505c('0x37')](_0x4c2c5c['query']);_0x5892e7[_0x505c('0x41')]=_[_0x505c('0x39')](_0x5892e7[_0x505c('0x36')],_0x5892e7[_0x505c('0x38')]);_0x2b523d[_0x505c('0x3a')]=_[_0x505c('0x39')](_0x5892e7[_0x505c('0x36')],qs[_0x505c('0x3b')](_0x4c2c5c[_0x505c('0x38')]['fields']));_0x2b523d[_0x505c('0x3a')]=_0x2b523d[_0x505c('0x3a')][_0x505c('0x3c')]?_0x2b523d[_0x505c('0x3a')]:_0x5892e7[_0x505c('0x36')];if(_0x4c2c5c[_0x505c('0x38')]['includeAll']){_0x2b523d[_0x505c('0x48')]=[{'all':!![]}];}_0x2b523d=_[_0x505c('0x44')]({},_0x2b523d,_0x4c2c5c['options']);return db[_0x505c('0x31')][_0x505c('0x4c')](_0x2b523d)[_0x505c('0x26')](handleEntityNotFound(_0x221869,null))['then'](respondWithResult(_0x221869,null))['catch'](handleError(_0x221869,null));};exports[_0x505c('0x4d')]=function(_0x3dadf3,_0x2b34a){return db[_0x505c('0x31')][_0x505c('0x4d')](_0x3dadf3['body'],{})['then'](function(_0x219024){var _0x568f6d=_0x3dadf3[_0x505c('0x4e')][_0x505c('0x28')]({'plain':!![]});if(!_0x568f6d)throw new Error(_0x505c('0x4f'));if(_0x568f6d['role']===_0x505c('0x4e')){var _0x386c45=_0x219024[_0x505c('0x28')]({'plain':!![]});var _0x2f26bb=_0x505c('0x29');return db[_0x505c('0x50')][_0x505c('0x4c')]({'where':{'name':_0x2f26bb,'userProfileId':_0x568f6d[_0x505c('0x51')]},'raw':!![]})[_0x505c('0x26')](function(_0x1995a7){if(_0x1995a7&&_0x1995a7[_0x505c('0x52')]===0x0){return db[_0x505c('0x2a')][_0x505c('0x4d')]({'name':_0x386c45[_0x505c('0x2d')],'resourceId':_0x386c45['id'],'type':_0x1995a7[_0x505c('0x2d')],'sectionId':_0x1995a7['id']},{})[_0x505c('0x26')](function(){return _0x219024;});}else{return _0x219024;}})[_0x505c('0x4b')](function(_0x3f4731){logger['error'](_0x505c('0x53'),_0x3f4731);throw _0x3f4731;});}return _0x219024;})[_0x505c('0x26')](respondWithResult(_0x2b34a,0xc9))[_0x505c('0x4b')](handleError(_0x2b34a,null));};exports['update']=function(_0x484152,_0x13ca61){if(_0x484152[_0x505c('0x54')]['id']){delete _0x484152[_0x505c('0x54')]['id'];}return db[_0x505c('0x31')]['find']({'where':{'id':_0x484152[_0x505c('0x55')]['id']}})[_0x505c('0x26')](handleEntityNotFound(_0x13ca61,null))[_0x505c('0x26')](saveUpdates(_0x484152[_0x505c('0x54')],null))[_0x505c('0x26')](respondWithResult(_0x13ca61,null))['catch'](handleError(_0x13ca61,null));};exports['destroy']=function(_0x2e6b8e,_0x5e2cff){return db[_0x505c('0x31')][_0x505c('0x4c')]({'where':{'id':_0x2e6b8e[_0x505c('0x55')]['id']}})[_0x505c('0x26')](handleEntityNotFound(_0x5e2cff,null))['then'](removeEntity(_0x5e2cff,null))[_0x505c('0x4b')](handleError(_0x5e2cff,null));}; \ No newline at end of file +var _0xb3bd=['map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','Pauses','UserProfileResource','stack','name','send','index'];(function(_0x32b324,_0x31a67d){var _0x35301a=function(_0x24e19e){while(--_0x24e19e){_0x32b324['push'](_0x32b324['shift']());}};_0x35301a(++_0x31a67d);}(_0xb3bd,0x7e));var _0xdb3b=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0xb3bd[_0x37a79c];return _0x561d89;};'use strict';var emlformat=require(_0xdb3b('0x0'));var rimraf=require(_0xdb3b('0x1'));var zipdir=require(_0xdb3b('0x2'));var jsonpatch=require(_0xdb3b('0x3'));var rp=require('request-promise');var moment=require(_0xdb3b('0x4'));var BPromise=require(_0xdb3b('0x5'));var Mustache=require(_0xdb3b('0x6'));var util=require('util');var path=require(_0xdb3b('0x7'));var sox=require(_0xdb3b('0x8'));var csv=require(_0xdb3b('0x9'));var ejs=require(_0xdb3b('0xa'));var fs=require('fs');var fs_extra=require(_0xdb3b('0xb'));var _=require(_0xdb3b('0xc'));var squel=require(_0xdb3b('0xd'));var crypto=require(_0xdb3b('0xe'));var jsforce=require(_0xdb3b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xdb3b('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdb3b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xdb3b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb3b('0x12'));var logger=require(_0xdb3b('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xdb3b('0x14'));var licenseUtil=require(_0xdb3b('0x15'));var db=require(_0xdb3b('0x16'))['db'];function respondWithStatusCode(_0x49ac56,_0x46ff65){_0x46ff65=_0x46ff65||0xcc;return function(_0x2f3574){if(_0x2f3574){return _0x49ac56[_0xdb3b('0x17')](_0x46ff65);}return _0x49ac56[_0xdb3b('0x18')](_0x46ff65)[_0xdb3b('0x19')]();};}function respondWithResult(_0x3268cf,_0x235425){_0x235425=_0x235425||0xc8;return function(_0x1a0bf7){if(_0x1a0bf7){return _0x3268cf[_0xdb3b('0x18')](_0x235425)[_0xdb3b('0x1a')](_0x1a0bf7);}};}function respondWithFilteredResult(_0x4328d7,_0x5a9796){return function(_0x223a25){if(_0x223a25){var _0x39abab=typeof _0x5a9796[_0xdb3b('0x1b')]==='undefined'&&typeof _0x5a9796[_0xdb3b('0x1c')]===_0xdb3b('0x1d');var _0x2f4f60=_0x223a25[_0xdb3b('0x1e')];var _0x15362d=_0x39abab?0x0:_0x5a9796[_0xdb3b('0x1b')];var _0x1f7b61=_0x39abab?_0x223a25[_0xdb3b('0x1e')]:_0x5a9796[_0xdb3b('0x1b')]+_0x5a9796['limit'];var _0x1a8f4d;if(_0x1f7b61>=_0x2f4f60){_0x1f7b61=_0x2f4f60;_0x1a8f4d=0xc8;}else{_0x1a8f4d=0xce;}_0x4328d7[_0xdb3b('0x18')](_0x1a8f4d);return _0x4328d7[_0xdb3b('0x1f')](_0xdb3b('0x20'),_0x15362d+'-'+_0x1f7b61+'/'+_0x2f4f60)[_0xdb3b('0x1a')](_0x223a25);}return null;};}function patchUpdates(_0x1c0487){return function(_0x51c7e3){try{jsonpatch[_0xdb3b('0x21')](_0x51c7e3,_0x1c0487,!![]);}catch(_0x4496d1){return BPromise[_0xdb3b('0x22')](_0x4496d1);}return _0x51c7e3[_0xdb3b('0x23')]();};}function saveUpdates(_0x1f7d82,_0x30a22d){return function(_0x17ba18){if(_0x17ba18){return _0x17ba18['update'](_0x1f7d82)[_0xdb3b('0x24')](function(_0x4ab377){return _0x4ab377;});}return null;};}function removeEntity(_0x85649c,_0x8ab006){return function(_0x1e648d){if(_0x1e648d){return _0x1e648d[_0xdb3b('0x25')]()['then'](function(){var _0x283a6d=_0x1e648d['get']({'plain':!![]});var _0x3af0a0=_0xdb3b('0x26');return db[_0xdb3b('0x27')]['destroy']({'where':{'type':_0x3af0a0,'resourceId':_0x283a6d['id']}})[_0xdb3b('0x24')](function(){return _0x1e648d;});})[_0xdb3b('0x24')](function(){_0x85649c['status'](0xcc)[_0xdb3b('0x19')]();});}};}function handleEntityNotFound(_0x38c24e,_0x1384e5){return function(_0x160292){if(!_0x160292){_0x38c24e[_0xdb3b('0x17')](0x194);}return _0x160292;};}function handleError(_0x2c42b1,_0x607b02){_0x607b02=_0x607b02||0x1f4;return function(_0x628cb5){logger['error'](_0x628cb5[_0xdb3b('0x28')]);if(_0x628cb5[_0xdb3b('0x29')]){delete _0x628cb5['name'];}_0x2c42b1[_0xdb3b('0x18')](_0x607b02)[_0xdb3b('0x2a')](_0x628cb5);};}exports[_0xdb3b('0x2b')]=function(_0x3e3b91,_0x62ce20){var _0x31d099={},_0x25ecef={},_0x4cdb72={'count':0x0,'rows':[]};var _0x5d4eab=_[_0xdb3b('0x2c')](db[_0xdb3b('0x2d')][_0xdb3b('0x2e')],function(_0x23c427){return{'name':_0x23c427[_0xdb3b('0x2f')],'type':_0x23c427[_0xdb3b('0x30')][_0xdb3b('0x31')]};});_0x25ecef[_0xdb3b('0x32')]=_[_0xdb3b('0x2c')](_0x5d4eab,_0xdb3b('0x29'));_0x25ecef[_0xdb3b('0x33')]=_[_0xdb3b('0x34')](_0x3e3b91[_0xdb3b('0x33')]);_0x25ecef[_0xdb3b('0x35')]=_['intersection'](_0x25ecef['model'],_0x25ecef['query']);_0x31d099[_0xdb3b('0x36')]=_[_0xdb3b('0x37')](_0x25ecef['model'],qs[_0xdb3b('0x38')](_0x3e3b91[_0xdb3b('0x33')][_0xdb3b('0x38')]));_0x31d099[_0xdb3b('0x36')]=_0x31d099[_0xdb3b('0x36')][_0xdb3b('0x39')]?_0x31d099[_0xdb3b('0x36')]:_0x25ecef[_0xdb3b('0x32')];if(!_0x3e3b91[_0xdb3b('0x33')][_0xdb3b('0x3a')]('nolimit')){_0x31d099[_0xdb3b('0x1c')]=qs[_0xdb3b('0x1c')](_0x3e3b91[_0xdb3b('0x33')][_0xdb3b('0x1c')]);_0x31d099[_0xdb3b('0x1b')]=qs[_0xdb3b('0x1b')](_0x3e3b91[_0xdb3b('0x33')][_0xdb3b('0x1b')]);}_0x31d099[_0xdb3b('0x3b')]=qs[_0xdb3b('0x3c')](_0x3e3b91['query']['sort']);_0x31d099[_0xdb3b('0x3d')]=qs['filters'](_[_0xdb3b('0x3e')](_0x3e3b91['query'],_0x25ecef[_0xdb3b('0x35')]),_0x5d4eab);if(_0x3e3b91[_0xdb3b('0x33')][_0xdb3b('0x3f')]){_0x31d099['where']=_[_0xdb3b('0x40')](_0x31d099[_0xdb3b('0x3d')],{'$or':_[_0xdb3b('0x2c')](_0x5d4eab,function(_0x2c3758){if(_0x2c3758['type']!==_0xdb3b('0x41')){var _0x239b61={};_0x239b61[_0x2c3758[_0xdb3b('0x29')]]={'$like':'%'+_0x3e3b91[_0xdb3b('0x33')]['filter']+'%'};return _0x239b61;}})});}_0x31d099=_[_0xdb3b('0x40')]({},_0x31d099,_0x3e3b91[_0xdb3b('0x42')]);var _0x5c50ea={'where':_0x31d099[_0xdb3b('0x3d')]};return db[_0xdb3b('0x2d')][_0xdb3b('0x1e')](_0x5c50ea)['then'](function(_0x82a6b4){_0x4cdb72[_0xdb3b('0x1e')]=_0x82a6b4;if(_0x3e3b91[_0xdb3b('0x33')][_0xdb3b('0x43')]){_0x31d099[_0xdb3b('0x44')]=[{'all':!![]}];}return db['Pause']['findAll'](_0x31d099);})[_0xdb3b('0x24')](function(_0x33d19f){_0x4cdb72[_0xdb3b('0x45')]=_0x33d19f;return _0x4cdb72;})[_0xdb3b('0x24')](respondWithFilteredResult(_0x62ce20,_0x31d099))[_0xdb3b('0x46')](handleError(_0x62ce20,null));};exports[_0xdb3b('0x47')]=function(_0x530435,_0x49499e){var _0x4b12be={'raw':!![],'where':{'id':_0x530435[_0xdb3b('0x48')]['id']}},_0x1c9ac9={};_0x1c9ac9['model']=_[_0xdb3b('0x34')](db[_0xdb3b('0x2d')][_0xdb3b('0x2e')]);_0x1c9ac9[_0xdb3b('0x33')]=_[_0xdb3b('0x34')](_0x530435['query']);_0x1c9ac9[_0xdb3b('0x35')]=_[_0xdb3b('0x37')](_0x1c9ac9[_0xdb3b('0x32')],_0x1c9ac9[_0xdb3b('0x33')]);_0x4b12be[_0xdb3b('0x36')]=_['intersection'](_0x1c9ac9['model'],qs['fields'](_0x530435[_0xdb3b('0x33')][_0xdb3b('0x38')]));_0x4b12be[_0xdb3b('0x36')]=_0x4b12be[_0xdb3b('0x36')][_0xdb3b('0x39')]?_0x4b12be[_0xdb3b('0x36')]:_0x1c9ac9[_0xdb3b('0x32')];if(_0x530435[_0xdb3b('0x33')][_0xdb3b('0x43')]){_0x4b12be[_0xdb3b('0x44')]=[{'all':!![]}];}_0x4b12be=_[_0xdb3b('0x40')]({},_0x4b12be,_0x530435[_0xdb3b('0x42')]);return db['Pause']['find'](_0x4b12be)[_0xdb3b('0x24')](handleEntityNotFound(_0x49499e,null))[_0xdb3b('0x24')](respondWithResult(_0x49499e,null))[_0xdb3b('0x46')](handleError(_0x49499e,null));};exports['create']=function(_0x4bb0f9,_0x23b917){return db[_0xdb3b('0x2d')][_0xdb3b('0x49')](_0x4bb0f9['body'],{})[_0xdb3b('0x24')](function(_0x3b17dc){var _0x39bfd8=_0x4bb0f9[_0xdb3b('0x4a')][_0xdb3b('0x4b')]({'plain':!![]});if(!_0x39bfd8)throw new Error(_0xdb3b('0x4c'));if(_0x39bfd8[_0xdb3b('0x4d')]===_0xdb3b('0x4a')){var _0xaf7f4=_0x3b17dc[_0xdb3b('0x4b')]({'plain':!![]});var _0x5cede8=_0xdb3b('0x26');return db[_0xdb3b('0x4e')]['find']({'where':{'name':_0x5cede8,'userProfileId':_0x39bfd8[_0xdb3b('0x4f')]},'raw':!![]})['then'](function(_0x4263f4){if(_0x4263f4&&_0x4263f4['autoAssociation']===0x0){return db['UserProfileResource'][_0xdb3b('0x49')]({'name':_0xaf7f4[_0xdb3b('0x29')],'resourceId':_0xaf7f4['id'],'type':_0x4263f4[_0xdb3b('0x29')],'sectionId':_0x4263f4['id']},{})[_0xdb3b('0x24')](function(){return _0x3b17dc;});}else{return _0x3b17dc;}})['catch'](function(_0x13537e){logger[_0xdb3b('0x50')](_0xdb3b('0x51'),_0x13537e);throw _0x13537e;});}return _0x3b17dc;})[_0xdb3b('0x24')](respondWithResult(_0x23b917,0xc9))[_0xdb3b('0x46')](handleError(_0x23b917,null));};exports[_0xdb3b('0x52')]=function(_0x48affc,_0x17a678){if(_0x48affc[_0xdb3b('0x53')]['id']){delete _0x48affc[_0xdb3b('0x53')]['id'];}return db[_0xdb3b('0x2d')][_0xdb3b('0x54')]({'where':{'id':_0x48affc[_0xdb3b('0x48')]['id']}})[_0xdb3b('0x24')](handleEntityNotFound(_0x17a678,null))['then'](saveUpdates(_0x48affc[_0xdb3b('0x53')],null))[_0xdb3b('0x24')](respondWithResult(_0x17a678,null))[_0xdb3b('0x46')](handleError(_0x17a678,null));};exports['destroy']=function(_0x1f9e9a,_0x4fd26c){return db[_0xdb3b('0x2d')][_0xdb3b('0x54')]({'where':{'id':_0x1f9e9a[_0xdb3b('0x48')]['id']}})['then'](handleEntityNotFound(_0x4fd26c,null))[_0xdb3b('0x24')](removeEntity(_0x4fd26c,null))[_0xdb3b('0x46')](handleError(_0x4fd26c,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 0d8094a..ed3e433 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['bluebird','path','../../config/environment','./pause.attributes','define','Pause','lodash','util','../../config/logger','api','moment'];(function(_0x3fbbdd,_0x150a98){var _0x14bab7=function(_0x193e8f){while(--_0x193e8f){_0x3fbbdd['push'](_0x3fbbdd['shift']());}};_0x14bab7(++_0x150a98);}(_0x53ec,0x192));var _0xc53e=function(_0x22f82a,_0x36ea1d){_0x22f82a=_0x22f82a-0x0;var _0x3abd49=_0x53ec[_0x22f82a];return _0x3abd49;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x493a97,_0x50a93e){_0x493a97=_0x493a97-0x0;var _0x51f171=_0x7fbe[_0x493a97];return _0x51f171;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 419d0e7..da83993 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0xa53c4f,_0x25a76d){var _0x3d113b=function(_0x3fe57d){while(--_0x3fe57d){_0xa53c4f['push'](_0xa53c4f['shift']());}};_0x3d113b(++_0x25a76d);}(_0xb10b,0x12a));var _0xbb10=function(_0x3ea8b8,_0x508efb){_0x3ea8b8=_0x3ea8b8-0x0;var _0x7d213f=_0xb10b[_0x3ea8b8];return _0x7d213f;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x3ecd65,_0x4edf5a){var _0x15c8bd=function(_0x541f39){while(--_0x541f39){_0x3ecd65['push'](_0x3ecd65['shift']());}};_0x15c8bd(++_0x4edf5a);}(_0xb10b,0x12a));var _0xbb10=function(_0x4a4b9b,_0x47c325){_0x4a4b9b=_0x4a4b9b-0x0;var _0x260375=_0xb10b[_0x4a4b9b];return _0x260375;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 83c5ced..e59e541 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 _0x6f0d=['delete','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','get','/webhook','webhookGet','show','/:id/download','download','join','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','post','single','file','upload','webhookPost','put','/:id','update'];(function(_0x507403,_0x3f954d){var _0x1327c=function(_0x2aea1b){while(--_0x2aea1b){_0x507403['push'](_0x507403['shift']());}};_0x1327c(++_0x3f954d);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x29e613,_0x44f310){_0x29e613=_0x29e613-0x0;var _0x44a5aa=_0x6f0d[_0x29e613];return _0x44a5aa;};'use strict';var multer=require('multer');var util=require(_0xd6f0('0x0'));var path=require(_0xd6f0('0x1'));var timeout=require(_0xd6f0('0x2'));var express=require(_0xd6f0('0x3'));var router=express['Router']();var fs_extra=require(_0xd6f0('0x4'));var auth=require(_0xd6f0('0x5'));var interaction=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var controller=require(_0xd6f0('0x8'));router['get']('/',auth[_0xd6f0('0x9')](),controller['index']);router[_0xd6f0('0xa')](_0xd6f0('0xb'),controller[_0xd6f0('0xc')]);router[_0xd6f0('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xd6f0('0xd')]);router[_0xd6f0('0xa')](_0xd6f0('0xe'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x136eee,_0xee144c,_0x329f69){_0x329f69(null,path[_0xd6f0('0x10')](config['root'],_0xd6f0('0x11')));},'filename':function(_0x2f0459,_0x306aad,_0x45973d){_0x306aad[_0xd6f0('0x12')]=_0x306aad[_0xd6f0('0x12')][_0xd6f0('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x45973d(null,util[_0xd6f0('0x14')](_0xd6f0('0x15'),path['basename'](_0x306aad[_0xd6f0('0x12')],path[_0xd6f0('0x16')](_0x306aad['originalname'])),Date[_0xd6f0('0x17')](),path['extname'](_0x306aad[_0xd6f0('0x12')])));}})});router[_0xd6f0('0x18')]('/',upload[_0xd6f0('0x19')](_0xd6f0('0x1a')),controller[_0xd6f0('0x1b')]);router[_0xd6f0('0x18')](_0xd6f0('0xb'),controller[_0xd6f0('0x1c')]);router[_0xd6f0('0x1d')](_0xd6f0('0x1e'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x1f')]);router[_0xd6f0('0x20')](_0xd6f0('0x1e'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x20')]);module['exports']=router; \ No newline at end of file +var _0xf873=['update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','basename','extname','now','post','file','upload','webhookPost'];(function(_0x1e1f48,_0x2bc4f9){var _0xc7eb3c=function(_0x2123a2){while(--_0x2123a2){_0x1e1f48['push'](_0x1e1f48['shift']());}};_0xc7eb3c(++_0x2bc4f9);}(_0xf873,0xb2));var _0x3f87=function(_0x8357f5,_0x490afd){_0x8357f5=_0x8357f5-0x0;var _0x522e6e=_0xf873[_0x8357f5];return _0x522e6e;};'use strict';var multer=require('multer');var util=require(_0x3f87('0x0'));var path=require(_0x3f87('0x1'));var timeout=require(_0x3f87('0x2'));var express=require(_0x3f87('0x3'));var router=express[_0x3f87('0x4')]();var fs_extra=require(_0x3f87('0x5'));var auth=require(_0x3f87('0x6'));var interaction=require(_0x3f87('0x7'));var config=require(_0x3f87('0x8'));var controller=require('./plugin.controller');router[_0x3f87('0x9')]('/',auth[_0x3f87('0xa')](),controller[_0x3f87('0xb')]);router['get'](_0x3f87('0xc'),controller[_0x3f87('0xd')]);router[_0x3f87('0x9')](_0x3f87('0xe'),auth[_0x3f87('0xa')](),controller[_0x3f87('0xf')]);router['get'](_0x3f87('0x10'),auth[_0x3f87('0xa')](),controller[_0x3f87('0x11')]);var upload=multer({'storage':multer[_0x3f87('0x12')]({'destination':function(_0x1ad2a9,_0xd41ca0,_0x2aa592){_0x2aa592(null,path[_0x3f87('0x13')](config[_0x3f87('0x14')],_0x3f87('0x15')));},'filename':function(_0x42fde8,_0x593e9,_0xfd5b65){_0x593e9[_0x3f87('0x16')]=_0x593e9['originalname'][_0x3f87('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xfd5b65(null,util[_0x3f87('0x18')]('%s-%s%s',path[_0x3f87('0x19')](_0x593e9[_0x3f87('0x16')],path[_0x3f87('0x1a')](_0x593e9[_0x3f87('0x16')])),Date[_0x3f87('0x1b')](),path[_0x3f87('0x1a')](_0x593e9[_0x3f87('0x16')])));}})});router[_0x3f87('0x1c')]('/',upload['single'](_0x3f87('0x1d')),controller[_0x3f87('0x1e')]);router[_0x3f87('0x1c')]('/webhook',controller[_0x3f87('0x1f')]);router['put'](_0x3f87('0xe'),auth[_0x3f87('0xa')](),controller[_0x3f87('0x20')]);router[_0x3f87('0x21')](_0x3f87('0xe'),auth['isAuthenticated'](),controller[_0x3f87('0x21')]);module[_0x3f87('0x22')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index b7dc802..75cedf1 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 _0x3304=['TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','html','script'];(function(_0x3afc75,_0x32dc5b){var _0x16f415=function(_0x405862){while(--_0x405862){_0x3afc75['push'](_0x3afc75['shift']());}};_0x16f415(++_0x32dc5b);}(_0x3304,0xb1));var _0x4330=function(_0x47e5ea,_0x4a820f){_0x47e5ea=_0x47e5ea-0x0;var _0x13b3ee=_0x3304[_0x47e5ea];return _0x13b3ee;};'use strict';var Sequelize=require(_0x4330('0x0'));module[_0x4330('0x1')]={'name':{'type':Sequelize[_0x4330('0x2')]},'type':{'type':Sequelize['ENUM'](_0x4330('0x3'),_0x4330('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x4330('0x5')]},'path':{'type':Sequelize['STRING'],'comment':_0x4330('0x6')},'active':{'type':Sequelize[_0x4330('0x7')],'defaultValue':0x0,'comment':_0x4330('0x8')},'sidebar':{'type':Sequelize['ENUM'](_0x4330('0x9'),_0x4330('0xa'),_0x4330('0xb'),_0x4330('0xc')),'defaultValue':_0x4330('0xb'),'comment':_0x4330('0xd')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x4330('0x2')]},'scriptName':{'type':Sequelize[_0x4330('0x2')]},'scriptPath':{'type':Sequelize[_0x4330('0x2')]}}; \ No newline at end of file +var _0xd305=['TEXT','BOOLEAN','adminOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','html','script'];(function(_0x58d5ac,_0x11c4bc){var _0x37985c=function(_0x419671){while(--_0x419671){_0x58d5ac['push'](_0x58d5ac['shift']());}};_0x37985c(++_0x11c4bc);}(_0xd305,0x1f0));var _0x5d30=function(_0x414166,_0x5e87f3){_0x414166=_0x414166-0x0;var _0x373505=_0xd305[_0x414166];return _0x373505;};'use strict';var Sequelize=require('sequelize');module[_0x5d30('0x0')]={'name':{'type':Sequelize[_0x5d30('0x1')]},'type':{'type':Sequelize['ENUM'](_0x5d30('0x2'),_0x5d30('0x3'))},'description':{'type':Sequelize[_0x5d30('0x4')]},'version':{'type':Sequelize[_0x5d30('0x4')]},'path':{'type':Sequelize[_0x5d30('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x5d30('0x5')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0x5d30('0x6'),'agentOnly',_0x5d30('0x7'),_0x5d30('0x8')),'defaultValue':'always','comment':_0x5d30('0x9')},'icon':{'type':Sequelize[_0x5d30('0x1')]},'adminUrl':{'type':Sequelize[_0x5d30('0x1')]},'agentUrl':{'type':Sequelize[_0x5d30('0x1')]},'scriptName':{'type':Sequelize[_0x5d30('0x1')]},'scriptPath':{'type':Sequelize[_0x5d30('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 5adbc51..b8f52e1 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 _0x23a8=['sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','download','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','unlinkSync','info','Temporary\x20file\x20removed','upload','extname','file','filename','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','scriptName','scriptPath','description','sidebar','icon-apps','version','plugins','agent','test','script','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','extract-zip','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./plugin.socket','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error','name','index','map','Plugin','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0xb2a71b,_0x136574){var _0x3b2a94=function(_0x3d09d4){while(--_0x3d09d4){_0xb2a71b['push'](_0xb2a71b['shift']());}};_0x3b2a94(++_0x136574);}(_0x23a8,0x65));var _0x823a=function(_0x39666c,_0x3b6dce){_0x39666c=_0x39666c-0x0;var _0x163fb7=_0x23a8[_0x39666c];return _0x163fb7;};'use strict';var emlformat=require(_0x823a('0x0'));var rimraf=require(_0x823a('0x1'));var zipdir=require(_0x823a('0x2'));var jsonpatch=require(_0x823a('0x3'));var rp=require(_0x823a('0x4'));var moment=require(_0x823a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x823a('0x6'));var util=require('util');var path=require(_0x823a('0x7'));var sox=require(_0x823a('0x8'));var csv=require(_0x823a('0x9'));var ejs=require(_0x823a('0xa'));var fs=require('fs');var fs_extra=require(_0x823a('0xb'));var _=require(_0x823a('0xc'));var squel=require(_0x823a('0xd'));var crypto=require(_0x823a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x823a('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x823a('0x10'));var extract=require(_0x823a('0x11'));var rimraf=require('rimraf');var archiver=require(_0x823a('0x12'));var Redis=require(_0x823a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x823a('0x14'));var as=require(_0x823a('0x15'));var hardwareService=require(_0x823a('0x16'));var logger=require('../../config/logger')(_0x823a('0x17'));var utils=require(_0x823a('0x18'));var config=require(_0x823a('0x19'));var licenseUtil=require(_0x823a('0x1a'));var db=require(_0x823a('0x1b'))['db'];config[_0x823a('0x1c')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x823a('0x1d'))(new Redis(config[_0x823a('0x1c')]));require(_0x823a('0x1e'))['register'](socket);function respondWithStatusCode(_0x4007ec,_0x496dfa){_0x496dfa=_0x496dfa||0xcc;return function(_0x552e83){if(_0x552e83){return _0x4007ec[_0x823a('0x1f')](_0x496dfa);}return _0x4007ec['status'](_0x496dfa)[_0x823a('0x20')]();};}function respondWithResult(_0x5dda95,_0x2fbb5b){_0x2fbb5b=_0x2fbb5b||0xc8;return function(_0x490d39){if(_0x490d39){return _0x5dda95[_0x823a('0x21')](_0x2fbb5b)[_0x823a('0x22')](_0x490d39);}};}function respondWithFilteredResult(_0x36d077,_0x3b4b92){return function(_0x180a6b){if(_0x180a6b){var _0x28de45=typeof _0x3b4b92[_0x823a('0x23')]==='undefined'&&typeof _0x3b4b92[_0x823a('0x24')]===_0x823a('0x25');var _0x7cb7ff=_0x180a6b['count'];var _0x2fb751=_0x28de45?0x0:_0x3b4b92['offset'];var _0x140a77=_0x28de45?_0x180a6b[_0x823a('0x26')]:_0x3b4b92[_0x823a('0x23')]+_0x3b4b92[_0x823a('0x24')];var _0x4c1389;if(_0x140a77>=_0x7cb7ff){_0x140a77=_0x7cb7ff;_0x4c1389=0xc8;}else{_0x4c1389=0xce;}_0x36d077[_0x823a('0x21')](_0x4c1389);return _0x36d077[_0x823a('0x27')](_0x823a('0x28'),_0x2fb751+'-'+_0x140a77+'/'+_0x7cb7ff)[_0x823a('0x22')](_0x180a6b);}return null;};}function patchUpdates(_0x3de16e){return function(_0x36c4b0){try{jsonpatch[_0x823a('0x29')](_0x36c4b0,_0x3de16e,!![]);}catch(_0x344aa5){return BPromise[_0x823a('0x2a')](_0x344aa5);}return _0x36c4b0[_0x823a('0x2b')]();};}function saveUpdates(_0x59af7c,_0x40365b){return function(_0x375cf9){if(_0x375cf9){return _0x375cf9[_0x823a('0x2c')](_0x59af7c)['then'](function(_0xe4488b){return _0xe4488b;});}return null;};}function removeEntity(_0x380397,_0x2b73c4){return function(_0x25f18c){if(_0x25f18c){return _0x25f18c['destroy']()[_0x823a('0x2d')](function(){var _0x217014=_0x25f18c[_0x823a('0x2e')]({'plain':!![]});var _0x5bfc35='Plugins';return db[_0x823a('0x2f')][_0x823a('0x30')]({'where':{'type':_0x5bfc35,'resourceId':_0x217014['id']}})[_0x823a('0x2d')](function(){return _0x25f18c;});})['then'](function(){_0x380397['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x515776,_0x273601){return function(_0x1ae12b){if(!_0x1ae12b){_0x515776[_0x823a('0x1f')](0x194);}return _0x1ae12b;};}function handleError(_0x28cdb2,_0x56d34f){_0x56d34f=_0x56d34f||0x1f4;return function(_0x9b701a){logger[_0x823a('0x31')](_0x9b701a['stack']);if(_0x9b701a['name']){delete _0x9b701a[_0x823a('0x32')];}_0x28cdb2['status'](_0x56d34f)['send'](_0x9b701a);};}exports[_0x823a('0x33')]=function(_0x2e4284,_0x564121){var _0x3e32de={},_0x3796b8={},_0x1b586b={'count':0x0,'rows':[]};var _0x1f254b=_[_0x823a('0x34')](db[_0x823a('0x35')]['rawAttributes'],function(_0x57b653){return{'name':_0x57b653[_0x823a('0x36')],'type':_0x57b653[_0x823a('0x37')][_0x823a('0x38')]};});_0x3796b8[_0x823a('0x39')]=_[_0x823a('0x34')](_0x1f254b,_0x823a('0x32'));_0x3796b8[_0x823a('0x3a')]=_['keys'](_0x2e4284['query']);_0x3796b8[_0x823a('0x3b')]=_[_0x823a('0x3c')](_0x3796b8[_0x823a('0x39')],_0x3796b8[_0x823a('0x3a')]);_0x3e32de[_0x823a('0x3d')]=_[_0x823a('0x3c')](_0x3796b8[_0x823a('0x39')],qs[_0x823a('0x3e')](_0x2e4284[_0x823a('0x3a')]['fields']));_0x3e32de[_0x823a('0x3d')]=_0x3e32de['attributes'][_0x823a('0x3f')]?_0x3e32de[_0x823a('0x3d')]:_0x3796b8[_0x823a('0x39')];if(!_0x2e4284[_0x823a('0x3a')][_0x823a('0x40')](_0x823a('0x41'))){_0x3e32de['limit']=qs['limit'](_0x2e4284[_0x823a('0x3a')][_0x823a('0x24')]);_0x3e32de[_0x823a('0x23')]=qs['offset'](_0x2e4284['query'][_0x823a('0x23')]);}_0x3e32de[_0x823a('0x42')]=qs[_0x823a('0x43')](_0x2e4284['query'][_0x823a('0x43')]);_0x3e32de['where']=qs['filters'](_[_0x823a('0x44')](_0x2e4284[_0x823a('0x3a')],_0x3796b8[_0x823a('0x3b')]),_0x1f254b);if(_0x2e4284[_0x823a('0x3a')][_0x823a('0x45')]){_0x3e32de['where']=_['merge'](_0x3e32de[_0x823a('0x46')],{'$or':_[_0x823a('0x34')](_0x1f254b,function(_0x16cc02){if(_0x16cc02[_0x823a('0x37')]!=='VIRTUAL'){var _0x16cd06={};_0x16cd06[_0x16cc02[_0x823a('0x32')]]={'$like':'%'+_0x2e4284['query'][_0x823a('0x45')]+'%'};return _0x16cd06;}})});}_0x3e32de=_[_0x823a('0x47')]({},_0x3e32de,_0x2e4284[_0x823a('0x48')]);var _0x4c5075={'where':_0x3e32de[_0x823a('0x46')]};return db[_0x823a('0x35')][_0x823a('0x26')](_0x4c5075)['then'](function(_0x18d5d1){_0x1b586b[_0x823a('0x26')]=_0x18d5d1;if(_0x2e4284[_0x823a('0x3a')][_0x823a('0x49')]){_0x3e32de[_0x823a('0x4a')]=[{'all':!![]}];}return db['Plugin'][_0x823a('0x4b')](_0x3e32de);})[_0x823a('0x2d')](function(_0x22b396){_0x1b586b[_0x823a('0x4c')]=_0x22b396;return _0x1b586b;})[_0x823a('0x2d')](respondWithFilteredResult(_0x564121,_0x3e32de))[_0x823a('0x4d')](handleError(_0x564121,null));};exports[_0x823a('0x4e')]=function(_0x4b7285,_0x2a5c61){var _0x52c359={'raw':!![],'where':{'id':_0x4b7285[_0x823a('0x4f')]['id']}},_0x57d75f={};_0x57d75f['model']=_[_0x823a('0x50')](db[_0x823a('0x35')]['rawAttributes']);_0x57d75f[_0x823a('0x3a')]=_[_0x823a('0x50')](_0x4b7285[_0x823a('0x3a')]);_0x57d75f[_0x823a('0x3b')]=_[_0x823a('0x3c')](_0x57d75f[_0x823a('0x39')],_0x57d75f[_0x823a('0x3a')]);_0x52c359[_0x823a('0x3d')]=_[_0x823a('0x3c')](_0x57d75f[_0x823a('0x39')],qs[_0x823a('0x3e')](_0x4b7285['query']['fields']));_0x52c359[_0x823a('0x3d')]=_0x52c359[_0x823a('0x3d')]['length']?_0x52c359[_0x823a('0x3d')]:_0x57d75f[_0x823a('0x39')];if(_0x4b7285['query'][_0x823a('0x49')]){_0x52c359['include']=[{'all':!![]}];}_0x52c359=_['merge']({},_0x52c359,_0x4b7285['options']);return db[_0x823a('0x35')][_0x823a('0x51')](_0x52c359)[_0x823a('0x2d')](handleEntityNotFound(_0x2a5c61,null))[_0x823a('0x2d')](respondWithResult(_0x2a5c61,null))[_0x823a('0x4d')](handleError(_0x2a5c61,null));};exports[_0x823a('0x52')]=function(_0x326258,_0x57acac,_0x2d58ce){return db[_0x823a('0x35')][_0x823a('0x51')]({'where':{'id':_0x326258['params']['id']},'attributes':[_0x823a('0x32'),_0x823a('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0x57acac,null))[_0x823a('0x2d')](function(_0x25dda4){if(_0x25dda4){var _0x431659=path[_0x823a('0x53')](config[_0x823a('0x54')],_0x823a('0x55'),util[_0x823a('0x56')](_0x823a('0x57'),path[_0x823a('0x58')](_0x25dda4[_0x823a('0x7')])));var _0x5aeb32=fs[_0x823a('0x59')](_0x431659);var _0x1b3453=archiver(_0x823a('0x5a'),{'zlib':{'level':0x9}});_0x1b3453['on']('warning',function(_0x256400){if(_0x256400['code']===_0x823a('0x5b')){logger[_0x823a('0x31')](_0x256400);}else{throw new db['Sequelize'][(_0x823a('0x5c'))](_0x823a('0x5d'));}});_0x1b3453['on'](_0x823a('0x31'),function(_0x3231f0){throw new db[(_0x823a('0x5e'))][(_0x823a('0x5c'))](_0x823a('0x5d'));});_0x1b3453[_0x823a('0x5f')](_0x5aeb32);_0x1b3453['glob'](_0x823a('0x60'),{'cwd':path[_0x823a('0x53')](config[_0x823a('0x54')],_0x823a('0x55'),path[_0x823a('0x61')](_0x25dda4[_0x823a('0x7')])),'ignore':[path[_0x823a('0x53')](path['basename'](_0x25dda4[_0x823a('0x7')]),_0x823a('0x62')),path[_0x823a('0x53')](path[_0x823a('0x58')](_0x25dda4[_0x823a('0x7')]),_0x823a('0x63'))],'nodir':!![]})[_0x823a('0x64')]();_0x5aeb32['on'](_0x823a('0x65'),function(){if(!fs[_0x823a('0x66')](_0x431659)){throw new db['Sequelize'][(_0x823a('0x5c'))](_0x823a('0x67'));}return _0x57acac['download'](_0x431659,util['format'](_0x823a('0x57'),path[_0x823a('0x58')](_0x25dda4[_0x823a('0x7')])),function(_0x442cda){if(_0x442cda){throw new db[(_0x823a('0x5e'))][(_0x823a('0x5c'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x823a('0x68')](_0x431659);logger[_0x823a('0x69')]('Download\x20completed');logger[_0x823a('0x69')](_0x823a('0x6a'));});});}return null;})[_0x823a('0x4d')](handleError(_0x57acac,null));};exports[_0x823a('0x6b')]=function(_0x5db23c,_0x299541,_0xa606bf){var _0x2cf087=path[_0x823a('0x58')](_0x5db23c['file']['filename'],path[_0x823a('0x6c')](_0x5db23c[_0x823a('0x6d')]['filename']));var _0x37e20e=path[_0x823a('0x53')](config[_0x823a('0x54')],_0x823a('0x55'),_0x5db23c[_0x823a('0x6d')][_0x823a('0x6e')]);var _0x308937=path[_0x823a('0x53')](config['root'],'server/files/plugins',_0x2cf087);logger[_0x823a('0x69')](_0x823a('0x6f'),_0x37e20e);logger[_0x823a('0x69')]('Plugin\x20upload\x20destination:\x20%s',_0x308937);try{fs[_0x823a('0x70')](_0x37e20e,parseInt(_0x823a('0x71'),0x8));extract(_0x37e20e,{'dir':_0x308937},function(_0x2712c7){if(_0x2712c7){logger[_0x823a('0x31')](_0x2712c7);handleError(_0x2712c7,!![]);};var _0x56b1e8=fs[_0x823a('0x72')](_0x308937);if(_0x56b1e8[_0x823a('0x3f')]>0x1){removeReferences(_0x37e20e,_0x308937);logger[_0x823a('0x31')]('Invalid\x20plugin\x20structure');return _0xa606bf(new Error(_0x823a('0x73')));}var _0xc5c4ec=fs[_0x823a('0x74')](path[_0x823a('0x53')](_0x308937,_0x56b1e8[0x0]));if(_0xc5c4ec['isFile']()){removeReferences(_0x37e20e,_0x308937);logger['error'](_0x823a('0x73'));return _0xa606bf(new Error(_0x823a('0x73')));}if(_0xc5c4ec[_0x823a('0x75')]()){var _0x4d91e9=fs[_0x823a('0x72')](path[_0x823a('0x53')](_0x308937,_0x56b1e8[0x0]));if(_0x4d91e9[_0x823a('0x3f')]===0x0){removeReferences(_0x37e20e,_0x308937);logger['error'](_0x823a('0x73'));return _0xa606bf(new Error('Invalid\x20plugin\x20structure'));}var _0x69787b=_0x4d91e9[_0x823a('0x76')](function(_0x2f3cd2){return _0x2f3cd2===_0x823a('0x77');});if(!_0x69787b){return _0xa606bf(new Error(_0x823a('0x78')));}var _0x157d8b=fs['readFileSync'](path[_0x823a('0x53')](_0x308937,_0x56b1e8[0x0],'manifest.json'));var _0x45b972=JSON[_0x823a('0x79')](_0x157d8b);if(_0x823a('0x25')==typeof _0x45b972[_0x823a('0x32')]){return _0xa606bf(new Error(_0x823a('0x7a')));}if(_0x823a('0x25')==typeof _0x45b972[_0x823a('0x37')]){return _0xa606bf(new Error(_0x823a('0x7b')));}if(_0x823a('0x25')==typeof _0x45b972['version']){return _0xa606bf(new Error(_0x823a('0x7c')));}if(_0x823a('0x25')==typeof _0x45b972[_0x823a('0x7d')]){return _0xa606bf(new Error(_0x823a('0x7e')));}if(_0x45b972[_0x823a('0x37')]===_0x823a('0x7f')){if(_0x823a('0x25')==typeof _0x45b972[_0x823a('0x7d')][_0x823a('0x80')]){return _0xa606bf(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x823a('0x25')==typeof _0x45b972[_0x823a('0x7d')]['views'][_0x823a('0x81')]&&_0x823a('0x25')==typeof _0x45b972[_0x823a('0x7d')][_0x823a('0x80')]['agent']){return _0xa606bf(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x45b972[_0x823a('0x37')]==='script'){if(_0x823a('0x25')==typeof _0x45b972['parameters'][_0x823a('0x82')]){return _0xa606bf(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x823a('0x25')==typeof _0x45b972[_0x823a('0x7d')][_0x823a('0x83')]){return _0xa606bf(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0xa606bf(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x50f9c8=_0x45b972['name'];var _0x5710f6=_0x45b972[_0x823a('0x84')];var _0x2e069e=_0x45b972[_0x823a('0x37')];var _0x5d8e99=_0x45b972[_0x823a('0x85')]?_0x45b972[_0x823a('0x85')]:'always';var _0x496c70=_0x45b972['icon']?_0x45b972['icon']:_0x823a('0x86');var _0x56f528='';var _0x37d80a='';var _0x1dde56='';var _0x189406='';var _0x557433=_0x45b972[_0x823a('0x87')];if(_0x2e069e===_0x823a('0x7f')){if(_0x823a('0x25')!=typeof _0x45b972[_0x823a('0x7d')][_0x823a('0x80')]['admin']){var _0x44a311=_0x45b972[_0x823a('0x7d')][_0x823a('0x80')][_0x823a('0x81')];if(!/^(f|ht)tps?:\/\//i['test'](_0x44a311)){_0x56f528=path[_0x823a('0x53')](_0x823a('0x88'),_0x2cf087,_0x56b1e8[0x0],_0x44a311);}else{_0x56f528=_0x44a311;}}else{logger[_0x823a('0x69')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x823a('0x25')!=typeof _0x45b972[_0x823a('0x7d')][_0x823a('0x80')][_0x823a('0x89')]){var _0x2a9bc4=_0x45b972[_0x823a('0x7d')][_0x823a('0x80')][_0x823a('0x89')];if(!/^(f|ht)tps?:\/\//i[_0x823a('0x8a')](_0x2a9bc4)){_0x37d80a=path[_0x823a('0x53')](_0x823a('0x88'),_0x2cf087,_0x56b1e8[0x0],_0x2a9bc4);}else{_0x37d80a=_0x2a9bc4;}}else{logger['info']('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x2e069e===_0x823a('0x8b')){_0x1dde56=_0x45b972[_0x823a('0x7d')][_0x823a('0x82')];_0x189406=_0x45b972[_0x823a('0x7d')]['scriptPath'];if(_0x823a('0x25')!=typeof _0x45b972[_0x823a('0x7d')]['views']){if(_0x823a('0x25')!=typeof _0x45b972[_0x823a('0x7d')][_0x823a('0x80')][_0x823a('0x81')]){var _0x44a311=_0x45b972[_0x823a('0x7d')][_0x823a('0x80')][_0x823a('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x823a('0x8a')](_0x44a311)){_0x56f528=path[_0x823a('0x53')](_0x823a('0x88'),_0x2cf087,_0x56b1e8[0x0],_0x44a311);}else{_0x56f528=_0x44a311;}}if(_0x823a('0x25')!=typeof _0x45b972['parameters']['views'][_0x823a('0x89')]){var _0x2a9bc4=_0x45b972[_0x823a('0x7d')][_0x823a('0x80')][_0x823a('0x89')];if(!/^(f|ht)tps?:\/\//i[_0x823a('0x8a')](_0x2a9bc4)){_0x37d80a=path[_0x823a('0x53')](_0x823a('0x88'),_0x2cf087,_0x56b1e8[0x0],_0x2a9bc4);}else{_0x37d80a=_0x2a9bc4;}}}}var _0x1ede7a={'name':_0x50f9c8,'description':_0x5710f6,'path':path['join'](_0x2cf087,_0x56b1e8[0x0]),'type':_0x2e069e,'sidebar':_0x5d8e99,'icon':_0x496c70,'adminUrl':_0x56f528,'agentUrl':_0x37d80a,'scriptName':_0x1dde56,'scriptPath':_0x189406,'version':_0x557433};removeReferences(_0x37e20e,null);return db['Plugin'][_0x823a('0x8c')](_0x1ede7a)[_0x823a('0x2d')](function(_0x37c8e8){var _0xf327e2={'role':_0x5db23c[_0x823a('0x8d')]['role'],'userProfileId':_0x5db23c[_0x823a('0x8d')][_0x823a('0x8e')]};if(!_0xf327e2)throw new Error(_0x823a('0x8f'));if(_0xf327e2['role']===_0x823a('0x90')){var _0x1e7307=_0x37c8e8[_0x823a('0x2e')]({'plain':!![]});return db[_0x823a('0x91')][_0x823a('0x51')]({'where':{'name':_0x823a('0x92'),'userProfileId':_0xf327e2[_0x823a('0x8e')]},'raw':!![]})[_0x823a('0x2d')](function(_0x39c707){if(_0x39c707&&_0x39c707[_0x823a('0x93')]===0x0){return db[_0x823a('0x2f')][_0x823a('0x8c')]({'name':_0x1e7307[_0x823a('0x32')],'resourceId':_0x1e7307['id'],'type':_0x39c707['name'],'sectionId':_0x39c707['id']},{})[_0x823a('0x2d')](function(){return _0x37c8e8;});}else{return _0x37c8e8;}})[_0x823a('0x4d')](function(_0x275f53){logger['error'](_0x823a('0x94'),_0x275f53);throw _0x275f53;});}return _0x37c8e8;})['then'](respondWithResult(_0x299541,null))[_0x823a('0x4d')](handleError(_0x299541,null));}});}catch(_0xa988bf){_0x299541[_0x823a('0x21')](0x1f4)[_0x823a('0x95')](_0xa988bf);}};function removeReferences(_0x5559e3,_0xeef40e){try{if(_0x5559e3){fs[_0x823a('0x68')](_0x5559e3);logger['info'](_0x823a('0x96'));}if(_0xeef40e){rimraf(_0xeef40e,function(){});logger[_0x823a('0x69')](_0x823a('0x97'));}}catch(_0x1d41f4){logger[_0x823a('0x31')](_0x1d41f4);}}exports[_0x823a('0x2c')]=function(_0x2ed6f9,_0x5ef80f,_0x52c1c3){return db[_0x823a('0x35')][_0x823a('0x51')]({'where':{'id':_0x2ed6f9[_0x823a('0x4f')]['id']}})[_0x823a('0x2d')](handleEntityNotFound(_0x5ef80f,null))[_0x823a('0x2d')](saveUpdates(_0x2ed6f9[_0x823a('0x8d')],null))['then'](respondWithResult(_0x5ef80f,null))[_0x823a('0x4d')](handleError(_0x5ef80f,null));};exports[_0x823a('0x98')]=function(_0x4067ab,_0x1d07ce,_0x587a6b){return db[_0x823a('0x35')][_0x823a('0x51')]({'where':{'id':_0x4067ab[_0x823a('0x4f')]['id']}})['then'](function(_0x592162){if(_0x592162){return _0x592162[_0x823a('0x30')]();}})[_0x823a('0x2d')](function(_0x168821){rimraf(path[_0x823a('0x53')](config[_0x823a('0x54')],_0x823a('0x55'),path['dirname'](_0x168821[_0x823a('0x7')])),function(){});return _0x168821;})[_0x823a('0x2d')](handleEntityNotFound(_0x1d07ce,null))[_0x823a('0x2d')](respondWithStatusCode(_0x1d07ce,null))['catch'](handleError(_0x1d07ce,null));};exports['webhookGet']=function(_0x1b3a73,_0x1af335,_0x8ddec6){return BPromise['resolve']()[_0x823a('0x2d')](function(){if(!_0x1b3a73[_0x823a('0x3a')]['path']){throw new Error(_0x823a('0x99'));}if(!_0x1b3a73[_0x823a('0x3a')][_0x823a('0x9a')]){throw new Error(_0x823a('0x9b'));}var _0x3d4a21=_0x1b3a73[_0x823a('0x3a')][_0x823a('0x9c')]?_0x1b3a73[_0x823a('0x3a')][_0x823a('0x9c')]+':'+_0x1b3a73['query'][_0x823a('0x9a')]:_0x823a('0x9d')+_0x1b3a73[_0x823a('0x3a')][_0x823a('0x9a')];var _0x478065=_0x1b3a73[_0x823a('0x3a')]['json']?_0x1b3a73[_0x823a('0x3a')][_0x823a('0x22')]:!![];var _0x5bde2e=_0x1b3a73[_0x823a('0x3a')]['encoding']?_0x1b3a73[_0x823a('0x3a')][_0x823a('0x9e')]:null;var _0x3376ca={'method':_0x1b3a73[_0x823a('0x9f')],'uri':util[_0x823a('0x56')](_0x823a('0xa0'),_0x3d4a21,_0x1b3a73[_0x823a('0x3a')][_0x823a('0x7')]),'json':_0x478065,'resolveWithFullResponse':!![],'encoding':_0x5bde2e,'qs':_0x1b3a73[_0x823a('0x3a')]};if(_0x1b3a73[_0x823a('0xa1')]){_0x3376ca[_0x823a('0xa1')]=_0x1b3a73[_0x823a('0xa1')];if(_0x3376ca[_0x823a('0xa1')][_0x823a('0xa2')]){delete _0x3376ca['headers'][_0x823a('0xa2')];}}if(_0x3376ca[_0x823a('0xa1')][_0x823a('0xa3')]){delete _0x3376ca[_0x823a('0xa1')][_0x823a('0xa3')];}return rp(_0x3376ca);})[_0x823a('0x2d')](function(_0x3c44bb){if(_0x3c44bb){_0x1af335[_0x823a('0x27')](_0x3c44bb['headers']);logger['info'](_0x3c44bb['body']);if(_[_0x823a('0xa4')](_0x1b3a73['query'][_0x823a('0x7')],_0x823a('0x52'))&&_0x3c44bb['statusCode']==0x1f4){return _0x1af335[_0x823a('0x1f')](_0x3c44bb[_0x823a('0xa5')]);}else{return _0x1af335[_0x823a('0x21')](_0x3c44bb['statusCode'])[_0x823a('0x95')](_0x3c44bb[_0x823a('0x8d')]);}}else{return _0x1af335[_0x823a('0x1f')](0xc8);}})[_0x823a('0x4d')](handleError(_0x1af335,null));};exports[_0x823a('0xa6')]=function(_0x9fba5c,_0x177296,_0xfa1297){return BPromise[_0x823a('0xa7')]()[_0x823a('0x2d')](function(){if(!_0x9fba5c[_0x823a('0x3a')][_0x823a('0x7')]){throw new Error(_0x823a('0x99'));}if(!_0x9fba5c['query'][_0x823a('0x9a')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x10e952=_0x9fba5c[_0x823a('0x3a')][_0x823a('0x9c')]?_0x9fba5c[_0x823a('0x3a')][_0x823a('0x9c')]+':'+_0x9fba5c[_0x823a('0x3a')][_0x823a('0x9a')]:_0x823a('0x9d')+_0x9fba5c[_0x823a('0x3a')][_0x823a('0x9a')];var _0x11c634=_0x9fba5c[_0x823a('0x3a')]['json']?_0x9fba5c[_0x823a('0x3a')][_0x823a('0x22')]:!![];var _0x1a46bb=_0x9fba5c[_0x823a('0x3a')]['encoding']?_0x9fba5c['query'][_0x823a('0x9e')]:null;var _0x192dd5={'method':_0x9fba5c[_0x823a('0x9f')],'uri':util[_0x823a('0x56')](_0x823a('0xa0'),_0x10e952,_0x9fba5c[_0x823a('0x3a')][_0x823a('0x7')]),'json':_0x11c634,'resolveWithFullResponse':!![],'encoding':_0x1a46bb,'body':_0x9fba5c[_0x823a('0x8d')]};if(_0x9fba5c[_0x823a('0xa1')]){_0x192dd5[_0x823a('0xa1')]=_0x9fba5c[_0x823a('0xa1')];if(_0x192dd5[_0x823a('0xa1')][_0x823a('0xa2')]){delete _0x192dd5[_0x823a('0xa1')]['content-length'];}}if(_0x192dd5['headers']['content-type']){delete _0x192dd5[_0x823a('0xa1')]['content-type'];}return rp(_0x192dd5);})[_0x823a('0x2d')](function(_0x5c2220){if(_0x5c2220){_0x177296['set'](_0x5c2220[_0x823a('0xa1')]);logger['info'](_0x5c2220['body']);return _0x177296['status'](_0x5c2220[_0x823a('0xa5')])[_0x823a('0x95')](_0x5c2220['body']);}else{return _0x177296[_0x823a('0x1f')](0xc8);}})['catch'](handleError(_0x177296,null));}; \ No newline at end of file +var _0x618c=['to-csv','fs-extra','squel','crypto','papaparse','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','Plugins','UserProfileResource','end','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','download','join','root','format','%s.zip','basename','createWriteStream','zip','warning','code','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','server/files/plugins','dirname','node_modules/**/*','finalize','close','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','script','create','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Extracted\x20folder\x20removed','update','body','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','rimraf','zip-dir','request-promise','moment','util','path','sox'];(function(_0x2657fa,_0x15fab8){var _0x555b92=function(_0x14b3f8){while(--_0x14b3f8){_0x2657fa['push'](_0x2657fa['shift']());}};_0x555b92(++_0x15fab8);}(_0x618c,0xa0));var _0xc618=function(_0x2b02ef,_0x742b7){_0x2b02ef=_0x2b02ef-0x0;var _0x547c50=_0x618c[_0x2b02ef];return _0x547c50;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc618('0x0'));var zipdir=require(_0xc618('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc618('0x2'));var moment=require(_0xc618('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc618('0x4'));var path=require(_0xc618('0x5'));var sox=require(_0xc618('0x6'));var csv=require(_0xc618('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc618('0x8'));var _=require('lodash');var squel=require(_0xc618('0x9'));var crypto=require(_0xc618('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc618('0xb'));var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require(_0xc618('0xc'));var Redis=require(_0xc618('0xd'));var authService=require(_0xc618('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc618('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc618('0x10'))(_0xc618('0x11'));var utils=require(_0xc618('0x12'));var config=require(_0xc618('0x13'));var licenseUtil=require(_0xc618('0x14'));var db=require(_0xc618('0x15'))['db'];config[_0xc618('0x16')]=_[_0xc618('0x17')](config[_0xc618('0x16')],{'host':_0xc618('0x18'),'port':0x18eb});var socket=require(_0xc618('0x19'))(new Redis(config[_0xc618('0x16')]));require('./plugin.socket')[_0xc618('0x1a')](socket);function respondWithStatusCode(_0x2256e7,_0x49b2cd){_0x49b2cd=_0x49b2cd||0xcc;return function(_0x3fbb1e){if(_0x3fbb1e){return _0x2256e7[_0xc618('0x1b')](_0x49b2cd);}return _0x2256e7[_0xc618('0x1c')](_0x49b2cd)['end']();};}function respondWithResult(_0x8425ab,_0x51832a){_0x51832a=_0x51832a||0xc8;return function(_0x1b2c8c){if(_0x1b2c8c){return _0x8425ab[_0xc618('0x1c')](_0x51832a)[_0xc618('0x1d')](_0x1b2c8c);}};}function respondWithFilteredResult(_0x111930,_0x1c92c1){return function(_0xe0cefb){if(_0xe0cefb){var _0x26bcde=typeof _0x1c92c1[_0xc618('0x1e')]===_0xc618('0x1f')&&typeof _0x1c92c1[_0xc618('0x20')]===_0xc618('0x1f');var _0x3f2825=_0xe0cefb[_0xc618('0x21')];var _0x232cc5=_0x26bcde?0x0:_0x1c92c1[_0xc618('0x1e')];var _0x30360a=_0x26bcde?_0xe0cefb[_0xc618('0x21')]:_0x1c92c1[_0xc618('0x1e')]+_0x1c92c1['limit'];var _0x28834d;if(_0x30360a>=_0x3f2825){_0x30360a=_0x3f2825;_0x28834d=0xc8;}else{_0x28834d=0xce;}_0x111930[_0xc618('0x1c')](_0x28834d);return _0x111930[_0xc618('0x22')](_0xc618('0x23'),_0x232cc5+'-'+_0x30360a+'/'+_0x3f2825)[_0xc618('0x1d')](_0xe0cefb);}return null;};}function patchUpdates(_0x59aa9c){return function(_0x14e201){try{jsonpatch[_0xc618('0x24')](_0x14e201,_0x59aa9c,!![]);}catch(_0x14613){return BPromise[_0xc618('0x25')](_0x14613);}return _0x14e201[_0xc618('0x26')]();};}function saveUpdates(_0x25b2f0,_0x5ec3c6){return function(_0x3e1335){if(_0x3e1335){return _0x3e1335['update'](_0x25b2f0)[_0xc618('0x27')](function(_0x3d62d8){return _0x3d62d8;});}return null;};}function removeEntity(_0x190733,_0x5a79b9){return function(_0x1fbd91){if(_0x1fbd91){return _0x1fbd91[_0xc618('0x28')]()[_0xc618('0x27')](function(){var _0x16a93a=_0x1fbd91['get']({'plain':!![]});var _0x4caa3f=_0xc618('0x29');return db[_0xc618('0x2a')][_0xc618('0x28')]({'where':{'type':_0x4caa3f,'resourceId':_0x16a93a['id']}})['then'](function(){return _0x1fbd91;});})[_0xc618('0x27')](function(){_0x190733[_0xc618('0x1c')](0xcc)[_0xc618('0x2b')]();});}};}function handleEntityNotFound(_0x560404,_0x240a97){return function(_0x4567ff){if(!_0x4567ff){_0x560404[_0xc618('0x1b')](0x194);}return _0x4567ff;};}function handleError(_0x15a0c2,_0xdad71){_0xdad71=_0xdad71||0x1f4;return function(_0x2b6cb7){logger[_0xc618('0x2c')](_0x2b6cb7[_0xc618('0x2d')]);if(_0x2b6cb7['name']){delete _0x2b6cb7[_0xc618('0x2e')];}_0x15a0c2[_0xc618('0x1c')](_0xdad71)[_0xc618('0x2f')](_0x2b6cb7);};}exports[_0xc618('0x30')]=function(_0x46c666,_0x1a5f00){var _0x42c258={},_0x584637={},_0x3581fa={'count':0x0,'rows':[]};var _0x1b4aaa=_[_0xc618('0x31')](db[_0xc618('0x32')][_0xc618('0x33')],function(_0x1571b7){return{'name':_0x1571b7[_0xc618('0x34')],'type':_0x1571b7[_0xc618('0x35')]['key']};});_0x584637[_0xc618('0x36')]=_[_0xc618('0x31')](_0x1b4aaa,_0xc618('0x2e'));_0x584637[_0xc618('0x37')]=_['keys'](_0x46c666[_0xc618('0x37')]);_0x584637['filters']=_[_0xc618('0x38')](_0x584637['model'],_0x584637[_0xc618('0x37')]);_0x42c258[_0xc618('0x39')]=_['intersection'](_0x584637['model'],qs[_0xc618('0x3a')](_0x46c666[_0xc618('0x37')][_0xc618('0x3a')]));_0x42c258[_0xc618('0x39')]=_0x42c258[_0xc618('0x39')][_0xc618('0x3b')]?_0x42c258[_0xc618('0x39')]:_0x584637[_0xc618('0x36')];if(!_0x46c666['query'][_0xc618('0x3c')](_0xc618('0x3d'))){_0x42c258['limit']=qs[_0xc618('0x20')](_0x46c666['query'][_0xc618('0x20')]);_0x42c258['offset']=qs[_0xc618('0x1e')](_0x46c666['query']['offset']);}_0x42c258['order']=qs[_0xc618('0x3e')](_0x46c666[_0xc618('0x37')][_0xc618('0x3e')]);_0x42c258[_0xc618('0x3f')]=qs['filters'](_[_0xc618('0x40')](_0x46c666[_0xc618('0x37')],_0x584637[_0xc618('0x41')]),_0x1b4aaa);if(_0x46c666['query'][_0xc618('0x42')]){_0x42c258['where']=_[_0xc618('0x43')](_0x42c258[_0xc618('0x3f')],{'$or':_[_0xc618('0x31')](_0x1b4aaa,function(_0x4e0a3a){if(_0x4e0a3a[_0xc618('0x35')]!==_0xc618('0x44')){var _0x1e1bea={};_0x1e1bea[_0x4e0a3a['name']]={'$like':'%'+_0x46c666[_0xc618('0x37')][_0xc618('0x42')]+'%'};return _0x1e1bea;}})});}_0x42c258=_[_0xc618('0x43')]({},_0x42c258,_0x46c666[_0xc618('0x45')]);var _0x5c319={'where':_0x42c258[_0xc618('0x3f')]};return db[_0xc618('0x32')][_0xc618('0x21')](_0x5c319)[_0xc618('0x27')](function(_0x2a0859){_0x3581fa[_0xc618('0x21')]=_0x2a0859;if(_0x46c666[_0xc618('0x37')][_0xc618('0x46')]){_0x42c258[_0xc618('0x47')]=[{'all':!![]}];}return db[_0xc618('0x32')][_0xc618('0x48')](_0x42c258);})[_0xc618('0x27')](function(_0x2e1df1){_0x3581fa['rows']=_0x2e1df1;return _0x3581fa;})[_0xc618('0x27')](respondWithFilteredResult(_0x1a5f00,_0x42c258))[_0xc618('0x49')](handleError(_0x1a5f00,null));};exports[_0xc618('0x4a')]=function(_0x2bd729,_0x2dd2fe){var _0x5923c5={'raw':!![],'where':{'id':_0x2bd729[_0xc618('0x4b')]['id']}},_0x174edf={};_0x174edf[_0xc618('0x36')]=_[_0xc618('0x4c')](db['Plugin']['rawAttributes']);_0x174edf['query']=_[_0xc618('0x4c')](_0x2bd729[_0xc618('0x37')]);_0x174edf[_0xc618('0x41')]=_[_0xc618('0x38')](_0x174edf[_0xc618('0x36')],_0x174edf['query']);_0x5923c5['attributes']=_[_0xc618('0x38')](_0x174edf['model'],qs[_0xc618('0x3a')](_0x2bd729[_0xc618('0x37')][_0xc618('0x3a')]));_0x5923c5['attributes']=_0x5923c5[_0xc618('0x39')]['length']?_0x5923c5[_0xc618('0x39')]:_0x174edf[_0xc618('0x36')];if(_0x2bd729['query'][_0xc618('0x46')]){_0x5923c5['include']=[{'all':!![]}];}_0x5923c5=_[_0xc618('0x43')]({},_0x5923c5,_0x2bd729[_0xc618('0x45')]);return db[_0xc618('0x32')][_0xc618('0x4d')](_0x5923c5)[_0xc618('0x27')](handleEntityNotFound(_0x2dd2fe,null))['then'](respondWithResult(_0x2dd2fe,null))[_0xc618('0x49')](handleError(_0x2dd2fe,null));};exports[_0xc618('0x4e')]=function(_0xf0e666,_0x406e59,_0x20e7bd){return db[_0xc618('0x32')][_0xc618('0x4d')]({'where':{'id':_0xf0e666[_0xc618('0x4b')]['id']},'attributes':[_0xc618('0x2e'),_0xc618('0x5')],'raw':!![]})[_0xc618('0x27')](handleEntityNotFound(_0x406e59,null))[_0xc618('0x27')](function(_0x23c5a1){if(_0x23c5a1){var _0xf9f848=path[_0xc618('0x4f')](config[_0xc618('0x50')],'server/files/plugins',util[_0xc618('0x51')](_0xc618('0x52'),path[_0xc618('0x53')](_0x23c5a1['path'])));var _0x4f0278=fs[_0xc618('0x54')](_0xf9f848);var _0xb8c69c=archiver(_0xc618('0x55'),{'zlib':{'level':0x9}});_0xb8c69c['on'](_0xc618('0x56'),function(_0x1ca59c){if(_0x1ca59c[_0xc618('0x57')]==='ENOENT'){logger[_0xc618('0x2c')](_0x1ca59c);}else{throw new db['Sequelize'][(_0xc618('0x58'))](_0xc618('0x59'));}});_0xb8c69c['on'](_0xc618('0x2c'),function(_0xf2825c){throw new db[(_0xc618('0x5a'))][(_0xc618('0x58'))](_0xc618('0x59'));});_0xb8c69c[_0xc618('0x5b')](_0x4f0278);_0xb8c69c[_0xc618('0x5c')]('**/*',{'cwd':path['join'](config[_0xc618('0x50')],_0xc618('0x5d'),path[_0xc618('0x5e')](_0x23c5a1[_0xc618('0x5')])),'ignore':[path['join'](path[_0xc618('0x53')](_0x23c5a1[_0xc618('0x5')]),_0xc618('0x5f')),path['join'](path[_0xc618('0x53')](_0x23c5a1[_0xc618('0x5')]),'attachments/**/*')],'nodir':!![]})[_0xc618('0x60')]();_0x4f0278['on'](_0xc618('0x61'),function(){if(!fs['existsSync'](_0xf9f848)){throw new db['Sequelize'][(_0xc618('0x58'))](_0xc618('0x62'));}return _0x406e59[_0xc618('0x4e')](_0xf9f848,util['format']('%s.zip',path[_0xc618('0x53')](_0x23c5a1[_0xc618('0x5')])),function(_0x1985cb){if(_0x1985cb){throw new db[(_0xc618('0x5a'))][(_0xc618('0x58'))](_0xc618('0x63'));}fs['unlinkSync'](_0xf9f848);logger[_0xc618('0x64')]('Download\x20completed');logger[_0xc618('0x64')](_0xc618('0x65'));});});}return null;})[_0xc618('0x49')](handleError(_0x406e59,null));};exports[_0xc618('0x66')]=function(_0x44ff8e,_0x564323,_0xf23cb1){var _0x566b26=path[_0xc618('0x53')](_0x44ff8e['file']['filename'],path['extname'](_0x44ff8e[_0xc618('0x67')][_0xc618('0x68')]));var _0xf2ded7=path[_0xc618('0x4f')](config[_0xc618('0x50')],_0xc618('0x5d'),_0x44ff8e[_0xc618('0x67')]['filename']);var _0x272003=path[_0xc618('0x4f')](config[_0xc618('0x50')],_0xc618('0x5d'),_0x566b26);logger[_0xc618('0x64')](_0xc618('0x69'),_0xf2ded7);logger[_0xc618('0x64')]('Plugin\x20upload\x20destination:\x20%s',_0x272003);try{fs[_0xc618('0x6a')](_0xf2ded7,parseInt(_0xc618('0x6b'),0x8));extract(_0xf2ded7,{'dir':_0x272003},function(_0x3c3107){if(_0x3c3107){logger[_0xc618('0x2c')](_0x3c3107);handleError(_0x3c3107,!![]);};var _0xcffa81=fs[_0xc618('0x6c')](_0x272003);if(_0xcffa81['length']>0x1){removeReferences(_0xf2ded7,_0x272003);logger[_0xc618('0x2c')]('Invalid\x20plugin\x20structure');return _0xf23cb1(new Error(_0xc618('0x6d')));}var _0x4b7f4d=fs['lstatSync'](path[_0xc618('0x4f')](_0x272003,_0xcffa81[0x0]));if(_0x4b7f4d[_0xc618('0x6e')]()){removeReferences(_0xf2ded7,_0x272003);logger['error']('Invalid\x20plugin\x20structure');return _0xf23cb1(new Error(_0xc618('0x6d')));}if(_0x4b7f4d[_0xc618('0x6f')]()){var _0x119ff6=fs[_0xc618('0x6c')](path[_0xc618('0x4f')](_0x272003,_0xcffa81[0x0]));if(_0x119ff6[_0xc618('0x3b')]===0x0){removeReferences(_0xf2ded7,_0x272003);logger[_0xc618('0x2c')](_0xc618('0x6d'));return _0xf23cb1(new Error('Invalid\x20plugin\x20structure'));}var _0x37c4f2=_0x119ff6[_0xc618('0x70')](function(_0x5a995d){return _0x5a995d===_0xc618('0x71');});if(!_0x37c4f2){return _0xf23cb1(new Error(_0xc618('0x72')));}var _0x124021=fs[_0xc618('0x73')](path[_0xc618('0x4f')](_0x272003,_0xcffa81[0x0],'manifest.json'));var _0x424611=JSON[_0xc618('0x74')](_0x124021);if(_0xc618('0x1f')==typeof _0x424611[_0xc618('0x2e')]){return _0xf23cb1(new Error(_0xc618('0x75')));}if(_0xc618('0x1f')==typeof _0x424611[_0xc618('0x35')]){return _0xf23cb1(new Error(_0xc618('0x76')));}if(_0xc618('0x1f')==typeof _0x424611[_0xc618('0x77')]){return _0xf23cb1(new Error(_0xc618('0x78')));}if(_0xc618('0x1f')==typeof _0x424611[_0xc618('0x79')]){return _0xf23cb1(new Error(_0xc618('0x7a')));}if(_0x424611[_0xc618('0x35')]===_0xc618('0x7b')){if(_0xc618('0x1f')==typeof _0x424611[_0xc618('0x79')][_0xc618('0x7c')]){return _0xf23cb1(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xc618('0x1f')==typeof _0x424611[_0xc618('0x79')][_0xc618('0x7c')][_0xc618('0x7d')]&&_0xc618('0x1f')==typeof _0x424611[_0xc618('0x79')][_0xc618('0x7c')][_0xc618('0x7e')]){return _0xf23cb1(new Error(_0xc618('0x7f')));}}else if(_0x424611['type']==='script'){if('undefined'==typeof _0x424611[_0xc618('0x79')][_0xc618('0x80')]){return _0xf23cb1(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0x424611[_0xc618('0x79')][_0xc618('0x81')]){return _0xf23cb1(new Error(_0xc618('0x82')));}}else{return _0xf23cb1(new Error(_0xc618('0x83')));}var _0x50cc57=_0x424611['name'];var _0x4121b=_0x424611[_0xc618('0x84')];var _0x256c39=_0x424611[_0xc618('0x35')];var _0xa0800f=_0x424611[_0xc618('0x85')]?_0x424611[_0xc618('0x85')]:_0xc618('0x86');var _0x394972=_0x424611[_0xc618('0x87')]?_0x424611[_0xc618('0x87')]:_0xc618('0x88');var _0x52a252='';var _0x45ff86='';var _0x528c48='';var _0x56ddf1='';var _0x61ef8=_0x424611[_0xc618('0x77')];if(_0x256c39===_0xc618('0x7b')){if(_0xc618('0x1f')!=typeof _0x424611[_0xc618('0x79')][_0xc618('0x7c')][_0xc618('0x7d')]){var _0x4cef30=_0x424611[_0xc618('0x79')][_0xc618('0x7c')][_0xc618('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0xc618('0x89')](_0x4cef30)){_0x52a252=path['join'](_0xc618('0x8a'),_0x566b26,_0xcffa81[0x0],_0x4cef30);}else{_0x52a252=_0x4cef30;}}else{logger[_0xc618('0x64')](_0xc618('0x8b'));}if(_0xc618('0x1f')!=typeof _0x424611['parameters'][_0xc618('0x7c')][_0xc618('0x7e')]){var _0x344a0c=_0x424611[_0xc618('0x79')][_0xc618('0x7c')][_0xc618('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xc618('0x89')](_0x344a0c)){_0x45ff86=path['join']('plugins',_0x566b26,_0xcffa81[0x0],_0x344a0c);}else{_0x45ff86=_0x344a0c;}}else{logger[_0xc618('0x64')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x256c39===_0xc618('0x8c')){_0x528c48=_0x424611[_0xc618('0x79')]['scriptName'];_0x56ddf1=_0x424611[_0xc618('0x79')][_0xc618('0x81')];if(_0xc618('0x1f')!=typeof _0x424611[_0xc618('0x79')][_0xc618('0x7c')]){if(_0xc618('0x1f')!=typeof _0x424611[_0xc618('0x79')]['views'][_0xc618('0x7d')]){var _0x4cef30=_0x424611[_0xc618('0x79')]['views'][_0xc618('0x7d')];if(!/^(f|ht)tps?:\/\//i['test'](_0x4cef30)){_0x52a252=path[_0xc618('0x4f')](_0xc618('0x8a'),_0x566b26,_0xcffa81[0x0],_0x4cef30);}else{_0x52a252=_0x4cef30;}}if('undefined'!=typeof _0x424611[_0xc618('0x79')][_0xc618('0x7c')]['agent']){var _0x344a0c=_0x424611['parameters']['views'][_0xc618('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xc618('0x89')](_0x344a0c)){_0x45ff86=path[_0xc618('0x4f')](_0xc618('0x8a'),_0x566b26,_0xcffa81[0x0],_0x344a0c);}else{_0x45ff86=_0x344a0c;}}}}var _0x207249={'name':_0x50cc57,'description':_0x4121b,'path':path['join'](_0x566b26,_0xcffa81[0x0]),'type':_0x256c39,'sidebar':_0xa0800f,'icon':_0x394972,'adminUrl':_0x52a252,'agentUrl':_0x45ff86,'scriptName':_0x528c48,'scriptPath':_0x56ddf1,'version':_0x61ef8};removeReferences(_0xf2ded7,null);return db[_0xc618('0x32')][_0xc618('0x8d')](_0x207249)[_0xc618('0x27')](function(_0x25c40f){var _0x332f97={'role':_0x44ff8e['body'][_0xc618('0x8e')],'userProfileId':_0x44ff8e['body'][_0xc618('0x8f')]};if(!_0x332f97)throw new Error(_0xc618('0x90'));if(_0x332f97['role']==='user'){var _0x45cacb=_0x25c40f[_0xc618('0x91')]({'plain':!![]});return db[_0xc618('0x92')][_0xc618('0x4d')]({'where':{'name':_0xc618('0x29'),'userProfileId':_0x332f97[_0xc618('0x8f')]},'raw':!![]})['then'](function(_0x2909a1){if(_0x2909a1&&_0x2909a1[_0xc618('0x93')]===0x0){return db['UserProfileResource']['create']({'name':_0x45cacb[_0xc618('0x2e')],'resourceId':_0x45cacb['id'],'type':_0x2909a1[_0xc618('0x2e')],'sectionId':_0x2909a1['id']},{})[_0xc618('0x27')](function(){return _0x25c40f;});}else{return _0x25c40f;}})['catch'](function(_0x3b32a3){logger['error'](_0xc618('0x94'),_0x3b32a3);throw _0x3b32a3;});}return _0x25c40f;})[_0xc618('0x27')](respondWithResult(_0x564323,null))[_0xc618('0x49')](handleError(_0x564323,null));}});}catch(_0x266bff){_0x564323[_0xc618('0x1c')](0x1f4)['send'](_0x266bff);}};function removeReferences(_0x29ebd4,_0x30d0dc){try{if(_0x29ebd4){fs[_0xc618('0x95')](_0x29ebd4);logger[_0xc618('0x64')]('Zip\x20archive\x20removed');}if(_0x30d0dc){rimraf(_0x30d0dc,function(){});logger[_0xc618('0x64')](_0xc618('0x96'));}}catch(_0x3e6132){logger[_0xc618('0x2c')](_0x3e6132);}}exports[_0xc618('0x97')]=function(_0x119412,_0x1509fd,_0x54003a){return db[_0xc618('0x32')][_0xc618('0x4d')]({'where':{'id':_0x119412['params']['id']}})[_0xc618('0x27')](handleEntityNotFound(_0x1509fd,null))[_0xc618('0x27')](saveUpdates(_0x119412[_0xc618('0x98')],null))[_0xc618('0x27')](respondWithResult(_0x1509fd,null))[_0xc618('0x49')](handleError(_0x1509fd,null));};exports['delete']=function(_0x3e9d0a,_0x1d5cd2,_0x519f9b){return db[_0xc618('0x32')][_0xc618('0x4d')]({'where':{'id':_0x3e9d0a[_0xc618('0x4b')]['id']}})[_0xc618('0x27')](function(_0x4ed431){if(_0x4ed431){return _0x4ed431[_0xc618('0x28')]();}})[_0xc618('0x27')](function(_0x445ef8){rimraf(path[_0xc618('0x4f')](config[_0xc618('0x50')],_0xc618('0x5d'),path['dirname'](_0x445ef8['path'])),function(){});return _0x445ef8;})[_0xc618('0x27')](handleEntityNotFound(_0x1d5cd2,null))['then'](respondWithStatusCode(_0x1d5cd2,null))[_0xc618('0x49')](handleError(_0x1d5cd2,null));};exports['webhookGet']=function(_0x426f2a,_0x485dd4,_0xac410c){return BPromise[_0xc618('0x99')]()[_0xc618('0x27')](function(){if(!_0x426f2a[_0xc618('0x37')][_0xc618('0x5')]){throw new Error(_0xc618('0x9a'));}if(!_0x426f2a[_0xc618('0x37')][_0xc618('0x9b')]){throw new Error(_0xc618('0x9c'));}var _0x2ac080=_0x426f2a[_0xc618('0x37')][_0xc618('0x9d')]?_0x426f2a['query'][_0xc618('0x9d')]+':'+_0x426f2a[_0xc618('0x37')][_0xc618('0x9b')]:_0xc618('0x9e')+_0x426f2a['query'][_0xc618('0x9b')];var _0x20daf9=_0x426f2a['query'][_0xc618('0x1d')]?_0x426f2a[_0xc618('0x37')][_0xc618('0x1d')]:!![];var _0x3d4b21=_0x426f2a[_0xc618('0x37')][_0xc618('0x9f')]?_0x426f2a[_0xc618('0x37')][_0xc618('0x9f')]:null;var _0x3af8a0={'method':_0x426f2a['method'],'uri':util['format'](_0xc618('0xa0'),_0x2ac080,_0x426f2a[_0xc618('0x37')][_0xc618('0x5')]),'json':_0x20daf9,'resolveWithFullResponse':!![],'encoding':_0x3d4b21,'qs':_0x426f2a[_0xc618('0x37')]};if(_0x426f2a[_0xc618('0xa1')]){_0x3af8a0[_0xc618('0xa1')]=_0x426f2a['headers'];if(_0x3af8a0[_0xc618('0xa1')][_0xc618('0xa2')]){delete _0x3af8a0[_0xc618('0xa1')]['content-length'];}}if(_0x3af8a0['headers']['content-type']){delete _0x3af8a0['headers'][_0xc618('0xa3')];}return rp(_0x3af8a0);})['then'](function(_0x1d576b){if(_0x1d576b){_0x485dd4['set'](_0x1d576b[_0xc618('0xa1')]);logger['info'](_0x1d576b[_0xc618('0x98')]);if(_[_0xc618('0xa4')](_0x426f2a['query']['path'],_0xc618('0x4e'))&&_0x1d576b[_0xc618('0xa5')]==0x1f4){return _0x485dd4[_0xc618('0x1b')](_0x1d576b[_0xc618('0xa5')]);}else{return _0x485dd4[_0xc618('0x1c')](_0x1d576b[_0xc618('0xa5')])[_0xc618('0x2f')](_0x1d576b[_0xc618('0x98')]);}}else{return _0x485dd4[_0xc618('0x1b')](0xc8);}})[_0xc618('0x49')](handleError(_0x485dd4,null));};exports[_0xc618('0xa6')]=function(_0x543b03,_0x1c0016,_0x1a573c){return BPromise['resolve']()[_0xc618('0x27')](function(){if(!_0x543b03['query'][_0xc618('0x5')]){throw new Error(_0xc618('0x9a'));}if(!_0x543b03[_0xc618('0x37')][_0xc618('0x9b')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x5f3c6e=_0x543b03[_0xc618('0x37')]['hostname']?_0x543b03[_0xc618('0x37')][_0xc618('0x9d')]+':'+_0x543b03['query'][_0xc618('0x9b')]:'http://localhost:'+_0x543b03[_0xc618('0x37')][_0xc618('0x9b')];var _0x47d2d4=_0x543b03[_0xc618('0x37')]['json']?_0x543b03['query']['json']:!![];var _0x3105e9=_0x543b03['query']['encoding']?_0x543b03[_0xc618('0x37')][_0xc618('0x9f')]:null;var _0x5f564a={'method':_0x543b03['method'],'uri':util[_0xc618('0x51')](_0xc618('0xa0'),_0x5f3c6e,_0x543b03[_0xc618('0x37')][_0xc618('0x5')]),'json':_0x47d2d4,'resolveWithFullResponse':!![],'encoding':_0x3105e9,'body':_0x543b03[_0xc618('0x98')]};if(_0x543b03[_0xc618('0xa1')]){_0x5f564a['headers']=_0x543b03[_0xc618('0xa1')];if(_0x5f564a[_0xc618('0xa1')]['content-length']){delete _0x5f564a[_0xc618('0xa1')]['content-length'];}}if(_0x5f564a['headers']['content-type']){delete _0x5f564a[_0xc618('0xa1')][_0xc618('0xa3')];}return rp(_0x5f564a);})[_0xc618('0x27')](function(_0x440464){if(_0x440464){_0x1c0016['set'](_0x440464[_0xc618('0xa1')]);logger['info'](_0x440464[_0xc618('0x98')]);return _0x1c0016[_0xc618('0x1c')](_0x440464[_0xc618('0xa5')])['send'](_0x440464['body']);}else{return _0x1c0016[_0xc618('0x1b')](0xc8);}})[_0xc618('0x49')](handleError(_0x1c0016,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 428d1d1..9d8bcfd 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 _0x9f02=['save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x9f02,0x68));var _0x29f0=function(_0x401e20,_0x3c5c83){_0x401e20=_0x401e20-0x0;var _0x5d7de8=_0x9f02[_0x401e20];return _0x5d7de8;};'use strict';var EventEmitter=require(_0x29f0('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x29f0('0x1'),'afterUpdate':_0x29f0('0x2'),'afterDestroy':_0x29f0('0x3')};function emitEvent(_0x24792b){return function(_0x1a49c1,_0x47e569,_0x204fc4){PluginEvents['emit'](_0x24792b+':'+_0x1a49c1['id'],_0x1a49c1);PluginEvents[_0x29f0('0x4')](_0x24792b,_0x1a49c1);_0x204fc4(null);};}for(var e in events){if(events[_0x29f0('0x5')](e)){var event=events[e];Plugin[_0x29f0('0x6')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x8819=['remove','emit','hasOwnProperty','exports','Plugin','setMaxListeners','save','update'];(function(_0x5adcc9,_0x304415){var _0x2eb1e6=function(_0x2ea9da){while(--_0x2ea9da){_0x5adcc9['push'](_0x5adcc9['shift']());}};_0x2eb1e6(++_0x304415);}(_0x8819,0x94));var _0x9881=function(_0x423757,_0x219b68){_0x423757=_0x423757-0x0;var _0x39b32f=_0x8819[_0x423757];return _0x39b32f;};'use strict';var EventEmitter=require('events');var Plugin=require('../../mysqldb')['db'][_0x9881('0x0')];var PluginEvents=new EventEmitter();PluginEvents[_0x9881('0x1')](0x0);var events={'afterCreate':_0x9881('0x2'),'afterUpdate':_0x9881('0x3'),'afterDestroy':_0x9881('0x4')};function emitEvent(_0x5e52c5){return function(_0x333d6f,_0x446deb,_0xf41442){PluginEvents[_0x9881('0x5')](_0x5e52c5+':'+_0x333d6f['id'],_0x333d6f);PluginEvents[_0x9881('0x5')](_0x5e52c5,_0x333d6f);_0xf41442(null);};}for(var e in events){if(events[_0x9881('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x9881('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index a781131..79b0ab4 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 _0xbacb=['rimraf','exports','define','plugins','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x521fb7,_0x1155cb){var _0x2ff4c5=function(_0x5152b9){while(--_0x5152b9){_0x521fb7['push'](_0x521fb7['shift']());}};_0x2ff4c5(++_0x1155cb);}(_0xbacb,0x1a6));var _0xbbac=function(_0x52ff77,_0x51ab49){_0x52ff77=_0x52ff77-0x0;var _0x280dae=_0xbacb[_0x52ff77];return _0x280dae;};'use strict';var _=require(_0xbbac('0x0'));var util=require(_0xbbac('0x1'));var logger=require('../../config/logger')(_0xbbac('0x2'));var moment=require(_0xbbac('0x3'));var BPromise=require(_0xbbac('0x4'));var rp=require(_0xbbac('0x5'));var fs=require('fs');var path=require(_0xbbac('0x6'));var rimraf=require(_0xbbac('0x7'));var config=require('../../config/environment');var attributes=require('./plugin.attributes');module[_0xbbac('0x8')]=function(_0x2b9236,_0x210763){return _0x2b9236[_0xbbac('0x9')]('Plugin',attributes,{'tableName':_0xbbac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x571d=['lodash','moment','request-promise','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins'];(function(_0x4df601,_0xaf4f77){var _0x2ccfdb=function(_0x4f6596){while(--_0x4f6596){_0x4df601['push'](_0x4df601['shift']());}};_0x2ccfdb(++_0xaf4f77);}(_0x571d,0xbe));var _0xd571=function(_0x588c1b,_0x497d6c){_0x588c1b=_0x588c1b-0x0;var _0x13c69f=_0x571d[_0x588c1b];return _0x13c69f;};'use strict';var _=require(_0xd571('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xd571('0x1'));var BPromise=require('bluebird');var rp=require(_0xd571('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd571('0x3'));var config=require(_0xd571('0x4'));var attributes=require(_0xd571('0x5'));module[_0xd571('0x6')]=function(_0x52f49f,_0x18d758){return _0x52f49f[_0xd571('0x7')](_0xd571('0x8'),attributes,{'tableName':_0xd571('0x9'),'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 8309cc0..69d54e7 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 _0xcb29=['jayson/promise','redis','defaults','socket.io-emitter','register','then','info','Plugin,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','create','body','options','raw','CreatePlugin','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x6e1239,_0x3562ac){var _0x418150=function(_0x279f06){while(--_0x279f06){_0x6e1239['push'](_0x6e1239['shift']());}};_0x418150(++_0x3562ac);}(_0xcb29,0x12d));var _0x9cb2=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xcb29[_0x50aa2e];return _0x5e07f0;};'use strict';var _=require('lodash');var util=require(_0x9cb2('0x0'));var moment=require(_0x9cb2('0x1'));var BPromise=require(_0x9cb2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9cb2('0x3'))['db'];var utils=require(_0x9cb2('0x4'));var logger=require(_0x9cb2('0x5'))('rpc');var config=require(_0x9cb2('0x6'));var jayson=require(_0x9cb2('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x9cb2('0x8')]=_[_0x9cb2('0x9')](config[_0x9cb2('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x9cb2('0xa'))(new Redis(config[_0x9cb2('0x8')]));require('./plugin.socket')[_0x9cb2('0xb')](socket);function respondWithRpcPromise(_0x4bdcbe,_0x51a3c8,_0x2167a0){return new BPromise(function(_0x58e20a,_0x15dcce){return client['request'](_0x4bdcbe,_0x2167a0)[_0x9cb2('0xc')](function(_0xc03302){logger[_0x9cb2('0xd')](_0x9cb2('0xe'),_0x51a3c8,'request\x20sent');logger[_0x9cb2('0xf')]('Plugin,\x20%s,\x20%s,\x20%s',_0x51a3c8,_0x9cb2('0x10'),JSON[_0x9cb2('0x11')](_0xc03302));if(_0xc03302[_0x9cb2('0x12')]){if(_0xc03302['error'][_0x9cb2('0x13')]===0x1f4){logger[_0x9cb2('0x12')]('Plugin,\x20%s,\x20%s',_0x51a3c8,_0xc03302[_0x9cb2('0x12')][_0x9cb2('0x14')]);return _0x15dcce(_0xc03302['error']['message']);}logger['error'](_0x9cb2('0xe'),_0x51a3c8,_0xc03302['error'][_0x9cb2('0x14')]);return _0x58e20a(_0xc03302[_0x9cb2('0x12')][_0x9cb2('0x14')]);}else{logger[_0x9cb2('0xd')]('Plugin,\x20%s,\x20%s',_0x51a3c8,_0x9cb2('0x10'));_0x58e20a(_0xc03302[_0x9cb2('0x15')][_0x9cb2('0x14')]);}})[_0x9cb2('0x16')](function(_0x592f0e){logger['error'](_0x9cb2('0xe'),_0x51a3c8,_0x592f0e);_0x15dcce(_0x592f0e);});});}exports['CreatePlugin']=function(_0x4c438a){var _0x15d19c=this;return new Promise(function(_0x487362,_0x10aed6){return db['Plugin'][_0x9cb2('0x17')](_0x4c438a[_0x9cb2('0x18')],{'raw':_0x4c438a[_0x9cb2('0x19')]?_0x4c438a['options'][_0x9cb2('0x1a')]===undefined?!![]:![]:!![]})[_0x9cb2('0xc')](function(_0x12c016){logger[_0x9cb2('0xd')]('CreatePlugin',_0x4c438a);logger[_0x9cb2('0xf')](_0x9cb2('0x1b'),_0x4c438a,JSON[_0x9cb2('0x11')](_0x12c016));_0x487362(_0x12c016);})[_0x9cb2('0x16')](function(_0x544143){logger[_0x9cb2('0x12')](_0x9cb2('0x1b'),_0x544143['message'],_0x4c438a);_0x10aed6(_0x15d19c['error'](0x1f4,_0x544143[_0x9cb2('0x14')]));});});}; \ No newline at end of file +var _0xd7d1=['redis','defaults','localhost','socket.io-emitter','./plugin.socket','then','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','CreatePlugin','Plugin','options','debug','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x114285,_0x40b000){var _0x32d047=function(_0x1265e7){while(--_0x1265e7){_0x114285['push'](_0x114285['shift']());}};_0x32d047(++_0x40b000);}(_0xd7d1,0xaa));var _0x1d7d=function(_0x3c6777,_0x2247ea){_0x3c6777=_0x3c6777-0x0;var _0x2cfefb=_0xd7d1[_0x3c6777];return _0x2cfefb;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var moment=require('moment');var BPromise=require(_0x1d7d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1d7d('0x3'));var db=require(_0x1d7d('0x4'))['db'];var utils=require(_0x1d7d('0x5'));var logger=require(_0x1d7d('0x6'))(_0x1d7d('0x7'));var config=require(_0x1d7d('0x8'));var jayson=require(_0x1d7d('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x1d7d('0xa')]=_[_0x1d7d('0xb')](config['redis'],{'host':_0x1d7d('0xc'),'port':0x18eb});var socket=require(_0x1d7d('0xd'))(new Redis(config['redis']));require(_0x1d7d('0xe'))['register'](socket);function respondWithRpcPromise(_0x1e1954,_0x1976d8,_0x7e056){return new BPromise(function(_0x1cc010,_0x1b4ea4){return client['request'](_0x1e1954,_0x7e056)[_0x1d7d('0xf')](function(_0x411357){logger[_0x1d7d('0x10')](_0x1d7d('0x11'),_0x1976d8,_0x1d7d('0x12'));logger['debug'](_0x1d7d('0x13'),_0x1976d8,'request\x20sent',JSON[_0x1d7d('0x14')](_0x411357));if(_0x411357['error']){if(_0x411357['error'][_0x1d7d('0x15')]===0x1f4){logger[_0x1d7d('0x16')](_0x1d7d('0x11'),_0x1976d8,_0x411357[_0x1d7d('0x16')][_0x1d7d('0x17')]);return _0x1b4ea4(_0x411357[_0x1d7d('0x16')][_0x1d7d('0x17')]);}logger['error'](_0x1d7d('0x11'),_0x1976d8,_0x411357[_0x1d7d('0x16')][_0x1d7d('0x17')]);return _0x1cc010(_0x411357[_0x1d7d('0x16')][_0x1d7d('0x17')]);}else{logger[_0x1d7d('0x10')]('Plugin,\x20%s,\x20%s',_0x1976d8,_0x1d7d('0x12'));_0x1cc010(_0x411357[_0x1d7d('0x18')][_0x1d7d('0x17')]);}})['catch'](function(_0x2b5900){logger[_0x1d7d('0x16')](_0x1d7d('0x11'),_0x1976d8,_0x2b5900);_0x1b4ea4(_0x2b5900);});});}exports[_0x1d7d('0x19')]=function(_0xe4c707){var _0x45adad=this;return new Promise(function(_0x544204,_0x172ed5){return db[_0x1d7d('0x1a')]['create'](_0xe4c707['body'],{'raw':_0xe4c707[_0x1d7d('0x1b')]?_0xe4c707[_0x1d7d('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x1d7d('0xf')](function(_0x547187){logger['info'](_0x1d7d('0x19'),_0xe4c707);logger[_0x1d7d('0x1c')](_0x1d7d('0x19'),_0xe4c707,JSON[_0x1d7d('0x14')](_0x547187));_0x544204(_0x547187);})[_0x1d7d('0x1d')](function(_0x539a12){logger[_0x1d7d('0x16')](_0x1d7d('0x19'),_0x539a12['message'],_0xe4c707);_0x172ed5(_0x45adad[_0x1d7d('0x16')](0x1f4,_0x539a12['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index f3a505d..06ea674 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 _0x09a7=['emit','removeListener','register','length','plugin:','./plugin.events','save','update'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x09a7,0x13d));var _0x709a=function(_0x5b3d1b,_0x27d008){_0x5b3d1b=_0x5b3d1b-0x0;var _0x267bfc=_0x09a7[_0x5b3d1b];return _0x267bfc;};'use strict';var PluginEvents=require(_0x709a('0x0'));var events=[_0x709a('0x1'),'remove',_0x709a('0x2')];function createListener(_0x377c7e,_0x229d21){return function(_0x1d8c58){_0x229d21[_0x709a('0x3')](_0x377c7e,_0x1d8c58);};}function removeListener(_0x5c3b4d,_0x56f420){return function(){PluginEvents[_0x709a('0x4')](_0x5c3b4d,_0x56f420);};}exports[_0x709a('0x5')]=function(_0x361ba3){for(var _0x2a3470=0x0,_0x1653a8=events[_0x709a('0x6')];_0x2a3470<_0x1653a8;_0x2a3470++){var _0x183fa3=events[_0x2a3470];var _0x48a137=createListener(_0x709a('0x7')+_0x183fa3,_0x361ba3);PluginEvents['on'](_0x183fa3,_0x48a137);}}; \ No newline at end of file +var _0xfa73=['remove','update','emit','removeListener','register','length','./plugin.events','save'];(function(_0x5a00e0,_0x1477e6){var _0x538ae3=function(_0xbba1c7){while(--_0xbba1c7){_0x5a00e0['push'](_0x5a00e0['shift']());}};_0x538ae3(++_0x1477e6);}(_0xfa73,0x1a6));var _0x3fa7=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xfa73[_0x5b644e];return _0x49c6bf;};'use strict';var PluginEvents=require(_0x3fa7('0x0'));var events=[_0x3fa7('0x1'),_0x3fa7('0x2'),_0x3fa7('0x3')];function createListener(_0x106a83,_0x3dc8dc){return function(_0x4ab243){_0x3dc8dc[_0x3fa7('0x4')](_0x106a83,_0x4ab243);};}function removeListener(_0x4d2920,_0xf30aaf){return function(){PluginEvents[_0x3fa7('0x5')](_0x4d2920,_0xf30aaf);};}exports[_0x3fa7('0x6')]=function(_0x1b0b9f){for(var _0x236b50=0x0,_0xca2fb9=events[_0x3fa7('0x7')];_0x236b50<_0xca2fb9;_0x236b50++){var _0x1398aa=events[_0x236b50];var _0x2dfced=createListener('plugin:'+_0x1398aa,_0x1b0b9f);PluginEvents['on'](_0x1398aa,_0x2dfced);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 966975d..f36a8c1 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(_0x5a12a5,_0x1e59b5){var _0x5e0f96=function(_0x4f24e6){while(--_0x4f24e6){_0x5a12a5['push'](_0x5a12a5['shift']());}};_0x5e0f96(++_0x1e59b5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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(_0x241930,_0x31d57b){var _0x1b94d5=function(_0x468b8e){while(--_0x468b8e){_0x241930['push'](_0x241930['shift']());}};_0x1b94d5(++_0x31d57b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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 d4e0ab9..31cf91f 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 _0xe5b5=['../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','npm\x20install','info','index','list','then','reject','motion2','length','show','describe','catch','body','script','join','../../files/plugins','chdir','dirname','start','dump','send','update','restart','stop','hasOwnProperty','params','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2'];(function(_0x5240bd,_0x2eda7c){var _0x5e5b96=function(_0x480322){while(--_0x480322){_0x5240bd['push'](_0x5240bd['shift']());}};_0x5e5b96(++_0x2eda7c);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x27d958,_0x29ef87){_0x27d958=_0x27d958-0x0;var _0x53e63e=_0xe5b5[_0x27d958];return _0x53e63e;};'use strict';var _=require(_0x5e5b('0x0'));var pm2=require(_0x5e5b('0x1'));var logger=require(_0x5e5b('0x2'))(_0x5e5b('0x3'));var path=require(_0x5e5b('0x4'));var exec=require(_0x5e5b('0x5'))[_0x5e5b('0x6')];var BPromise=require(_0x5e5b('0x7'));function handleEntityNotFound(_0xf20c6a,_0x20a50c){return function(_0xdc6616){if(!_0xdc6616){_0xf20c6a[_0x5e5b('0x8')](0x194);;}return _0xdc6616;};}function respondWithResult(_0xf1fbe2,_0x11e0e0){_0x11e0e0=_0x11e0e0||0xc8;return function(_0x545eb3){if(_0x545eb3){return _0xf1fbe2[_0x5e5b('0x9')](_0x11e0e0)[_0x5e5b('0xa')](_0x545eb3);}return null;};}function handleError(_0xcbd478,_0x258414){_0x258414=_0x258414||0x1f4;return function(_0xb9d72b){logger[_0x5e5b('0xb')](_0xb9d72b[_0x5e5b('0xc')]);if(_0xb9d72b[_0x5e5b('0xd')]){delete _0xb9d72b['name'];}_0xcbd478[_0x5e5b('0x9')](_0x258414)['send'](_0xb9d72b);};}function execChildProcess(){return new BPromise(function(_0x108c34,_0x58185){exec(_0x5e5b('0xe'),function(_0x3f64b6,_0x55c974,_0x4a1424){logger['info'](_0x55c974);logger[_0x5e5b('0xf')](_0x4a1424);if(_0x3f64b6){logger[_0x5e5b('0xb')](_0x3f64b6);return _0x58185(_0x3f64b6);}return _0x108c34(_0x55c974);});});}exports[_0x5e5b('0x10')]=function(_0x1694ff,_0x13a01e){return pm2[_0x5e5b('0x11')]()[_0x5e5b('0x12')](function(_0x49edd0){if(_0x49edd0){var _0x2b37fa=_[_0x5e5b('0x13')](_0x49edd0,function(_0x4ff37b){return _0x4ff37b[_0x5e5b('0xd')]==='express'||_0x4ff37b['name']===_0x5e5b('0x14');});return{'rows':_0x2b37fa,'count':_0x2b37fa[_0x5e5b('0x15')]};}return null;})[_0x5e5b('0x12')](respondWithResult(_0x13a01e,null))['catch'](handleError(_0x13a01e,null));};exports[_0x5e5b('0x16')]=function(_0x4d490c,_0x1796af){return pm2[_0x5e5b('0x17')](_0x4d490c['params']['id'])[_0x5e5b('0x12')](respondWithResult(_0x1796af,null))[_0x5e5b('0x12')](handleEntityNotFound(_0x1796af,null))[_0x5e5b('0x18')](handleError(_0x1796af,null));};exports['create']=function(_0x2bf0b7,_0x3f1103){if(_0x2bf0b7['body'][_0x5e5b('0xd')]&&_0x2bf0b7[_0x5e5b('0x19')][_0x5e5b('0x1a')]){var _0x2d8252=path[_0x5e5b('0x1b')](__dirname,_0x5e5b('0x1c'),_0x2bf0b7[_0x5e5b('0x19')][_0x5e5b('0x1a')]);var _0x4a78e3=process['cwd']();process[_0x5e5b('0x1d')](path[_0x5e5b('0x1e')](_0x2d8252));return execChildProcess()[_0x5e5b('0x12')](function(_0xe1c268){process[_0x5e5b('0x1d')](_0x4a78e3);return pm2[_0x5e5b('0x1f')]({'name':_0x2bf0b7[_0x5e5b('0x19')][_0x5e5b('0xd')],'script':_0x2d8252});})[_0x5e5b('0x12')](function(_0x26bc02){pm2[_0x5e5b('0x20')]();return _0x26bc02[0x0];})['then'](respondWithResult(_0x3f1103,0xc9))[_0x5e5b('0x18')](handleError(_0x3f1103,null));}else{return _0x3f1103[_0x5e5b('0x9')](0x1f4)[_0x5e5b('0x21')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x5e5b('0x22')]=function(_0xdb2863,_0x5ee866){if(_0xdb2863[_0x5e5b('0x19')]['id']){delete _0xdb2863[_0x5e5b('0x19')]['id'];}var _0x39ce16={'online':_0x5e5b('0x23'),'stopped':_0x5e5b('0x24')};if(_0x39ce16[_0x5e5b('0x25')](_0xdb2863[_0x5e5b('0x19')][_0x5e5b('0x9')])){return pm2[_0x39ce16[_0xdb2863[_0x5e5b('0x19')][_0x5e5b('0x9')]]](_0xdb2863[_0x5e5b('0x26')]['id'])[_0x5e5b('0x12')](respondWithResult(_0x5ee866,0xc8))['catch'](handleError(_0x5ee866,null));}else{return _0x5ee866['status'](0x1f4)[_0x5e5b('0x21')]({'message':_0x5e5b('0x27')});}};exports[_0x5e5b('0x28')]=function(_0x3dcdab,_0x12f1ee){if(_0x3dcdab['body']['id']){delete _0x3dcdab[_0x5e5b('0x19')]['id'];}if(_0x3dcdab['params']['id']){return pm2[_0x5e5b('0x29')](_0x3dcdab[_0x5e5b('0x26')]['id'])[_0x5e5b('0x12')](function(_0xc2bc09){pm2['dump']();return _0xc2bc09[0x0];})[_0x5e5b('0x12')](respondWithResult(_0x12f1ee,null))[_0x5e5b('0x18')](handleError(_0x12f1ee,null));}else{return _0x12f1ee['status'](0x1f4)[_0x5e5b('0x21')]({'message':_0x5e5b('0x2a')});}}; \ No newline at end of file +var _0xd3d1=['Unknown\x20id','lodash','../../config/pm2','path','child_process','exec','bluebird','sendStatus','status','json','error','name','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','describe','create','join','../../files/plugins','body','script','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','params','destroy','delete'];(function(_0x27b161,_0x1e1f5d){var _0x3a59dd=function(_0x1f586f){while(--_0x1f586f){_0x27b161['push'](_0x27b161['shift']());}};_0x3a59dd(++_0x1e1f5d);}(_0xd3d1,0x172));var _0x1d3d=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xd3d1[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x1d3d('0x0'));var pm2=require(_0x1d3d('0x1'));var logger=require('../../config/logger')('api');var path=require(_0x1d3d('0x2'));var exec=require(_0x1d3d('0x3'))[_0x1d3d('0x4')];var BPromise=require(_0x1d3d('0x5'));function handleEntityNotFound(_0x41a806,_0x328a4e){return function(_0x2445e8){if(!_0x2445e8){_0x41a806[_0x1d3d('0x6')](0x194);;}return _0x2445e8;};}function respondWithResult(_0x1cbe06,_0x449475){_0x449475=_0x449475||0xc8;return function(_0x3831ce){if(_0x3831ce){return _0x1cbe06[_0x1d3d('0x7')](_0x449475)[_0x1d3d('0x8')](_0x3831ce);}return null;};}function handleError(_0x2c377c,_0xbea61e){_0xbea61e=_0xbea61e||0x1f4;return function(_0x2ba122){logger[_0x1d3d('0x9')](_0x2ba122['stack']);if(_0x2ba122[_0x1d3d('0xa')]){delete _0x2ba122[_0x1d3d('0xa')];}_0x2c377c[_0x1d3d('0x7')](_0xbea61e)[_0x1d3d('0xb')](_0x2ba122);};}function execChildProcess(){return new BPromise(function(_0x27d914,_0x372ff2){exec(_0x1d3d('0xc'),function(_0x2fa11e,_0x3b3913,_0x3cffa5){logger[_0x1d3d('0xd')](_0x3b3913);logger['info'](_0x3cffa5);if(_0x2fa11e){logger[_0x1d3d('0x9')](_0x2fa11e);return _0x372ff2(_0x2fa11e);}return _0x27d914(_0x3b3913);});});}exports[_0x1d3d('0xe')]=function(_0x494b82,_0x4dd753){return pm2[_0x1d3d('0xf')]()[_0x1d3d('0x10')](function(_0x1a8035){if(_0x1a8035){var _0x59b907=_[_0x1d3d('0x11')](_0x1a8035,function(_0x4dcc22){return _0x4dcc22[_0x1d3d('0xa')]===_0x1d3d('0x12')||_0x4dcc22[_0x1d3d('0xa')]===_0x1d3d('0x13');});return{'rows':_0x59b907,'count':_0x59b907[_0x1d3d('0x14')]};}return null;})[_0x1d3d('0x10')](respondWithResult(_0x4dd753,null))[_0x1d3d('0x15')](handleError(_0x4dd753,null));};exports['show']=function(_0x5d3ac9,_0x316ab4){return pm2[_0x1d3d('0x16')](_0x5d3ac9['params']['id'])[_0x1d3d('0x10')](respondWithResult(_0x316ab4,null))['then'](handleEntityNotFound(_0x316ab4,null))[_0x1d3d('0x15')](handleError(_0x316ab4,null));};exports[_0x1d3d('0x17')]=function(_0x2cd430,_0x2d6dfb){if(_0x2cd430['body'][_0x1d3d('0xa')]&&_0x2cd430['body']['script']){var _0x108005=path[_0x1d3d('0x18')](__dirname,_0x1d3d('0x19'),_0x2cd430[_0x1d3d('0x1a')][_0x1d3d('0x1b')]);var _0xe4afa2=process[_0x1d3d('0x1c')]();process[_0x1d3d('0x1d')](path[_0x1d3d('0x1e')](_0x108005));return execChildProcess()[_0x1d3d('0x10')](function(_0x1610a6){process['chdir'](_0xe4afa2);return pm2[_0x1d3d('0x1f')]({'name':_0x2cd430[_0x1d3d('0x1a')]['name'],'script':_0x108005});})[_0x1d3d('0x10')](function(_0x5c52da){pm2[_0x1d3d('0x20')]();return _0x5c52da[0x0];})[_0x1d3d('0x10')](respondWithResult(_0x2d6dfb,0xc9))[_0x1d3d('0x15')](handleError(_0x2d6dfb,null));}else{return _0x2d6dfb[_0x1d3d('0x7')](0x1f4)[_0x1d3d('0xb')]({'message':_0x1d3d('0x21')});}};exports[_0x1d3d('0x22')]=function(_0x298fd3,_0x2294ee){if(_0x298fd3[_0x1d3d('0x1a')]['id']){delete _0x298fd3[_0x1d3d('0x1a')]['id'];}var _0x4f0aa7={'online':_0x1d3d('0x23'),'stopped':'stop'};if(_0x4f0aa7[_0x1d3d('0x24')](_0x298fd3[_0x1d3d('0x1a')]['status'])){return pm2[_0x4f0aa7[_0x298fd3[_0x1d3d('0x1a')][_0x1d3d('0x7')]]](_0x298fd3[_0x1d3d('0x25')]['id'])[_0x1d3d('0x10')](respondWithResult(_0x2294ee,0xc8))['catch'](handleError(_0x2294ee,null));}else{return _0x2294ee[_0x1d3d('0x7')](0x1f4)[_0x1d3d('0xb')]({'message':'Unknown\x20status'});}};exports[_0x1d3d('0x26')]=function(_0x4845b7,_0x4c04a8){if(_0x4845b7[_0x1d3d('0x1a')]['id']){delete _0x4845b7['body']['id'];}if(_0x4845b7[_0x1d3d('0x25')]['id']){return pm2[_0x1d3d('0x27')](_0x4845b7[_0x1d3d('0x25')]['id'])[_0x1d3d('0x10')](function(_0x3a4c01){pm2[_0x1d3d('0x20')]();return _0x3a4c01[0x0];})[_0x1d3d('0x10')](respondWithResult(_0x4c04a8,null))[_0x1d3d('0x15')](handleError(_0x4c04a8,null));}else{return _0x4c04a8[_0x1d3d('0x7')](0x1f4)['send']({'message':_0x1d3d('0x28')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 4b30ebb..7d8c651 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 _0x50be=['exports','express','Router','../../components/auth/service','get','/queues','isAuthenticated','getQueues'];(function(_0x467e9e,_0x4a6888){var _0x10376a=function(_0x5f3437){while(--_0x5f3437){_0x467e9e['push'](_0x467e9e['shift']());}};_0x10376a(++_0x4a6888);}(_0x50be,0x191));var _0xe50b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x50be[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xe50b('0x0'));var router=express[_0xe50b('0x1')]();var auth=require(_0xe50b('0x2'));var controller=require('./realtime.controller');router[_0xe50b('0x3')](_0xe50b('0x4'),auth[_0xe50b('0x5')](),controller[_0xe50b('0x6')]);module[_0xe50b('0x7')]=router; \ No newline at end of file +var _0xd08d=['/queues','isAuthenticated','exports','Router','../../components/auth/service','get'];(function(_0x3b4512,_0x5b9669){var _0x364ab4=function(_0x1d42b1){while(--_0x1d42b1){_0x3b4512['push'](_0x3b4512['shift']());}};_0x364ab4(++_0x5b9669);}(_0xd08d,0x81));var _0xdd08=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0xd08d[_0x4e6ae6];return _0x23c108;};'use strict';var express=require('express');var router=express[_0xdd08('0x0')]();var auth=require(_0xdd08('0x1'));var controller=require('./realtime.controller');router[_0xdd08('0x2')](_0xdd08('0x3'),auth[_0xdd08('0x4')](),controller['getQueues']);module[_0xdd08('0x5')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 09417a6..76f0ce6 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 _0x32f4=['findAll','QueueId','User','catch','util','lodash','jayson/promise','../../components/parsers/qs','api','../../mysqldb','http','client','offset','undefined','count','limit','status','Content-Range','json','stack','name','send','getQueues','chat','sms','openchannel','fax','voice','resolve','then','channel','query','toLowerCase','Invalid\x20channel','startCase','Queue','map','fieldName','key','user','role','userProfileId','type','QueueCampaigns','Queues','UserProfile','findAndCountAll','request','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','loggedIn','available','paused','outbound','push','pTalking','originated','message','dialActive','dialMethod','Trunk','erlangCalls','erlangCallToSecond','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','rows','get','loggedInDb','waiting','talking','agents','find','merge','pick','online','getMembers','length','UserId','Pause'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x32f4,0x154));var _0x432f=function(_0x3a6cfe,_0x4628ff){_0x3a6cfe=_0x3a6cfe-0x0;var _0xdf5c7f=_0x32f4[_0x3a6cfe];return _0xdf5c7f;};'use strict';var util=require(_0x432f('0x0'));var _=require(_0x432f('0x1'));var jayson=require(_0x432f('0x2'));var qs=require(_0x432f('0x3'));var logger=require('../../config/logger')(_0x432f('0x4'));var db=require(_0x432f('0x5'))['db'];var client=jayson['client'][_0x432f('0x6')]({'port':0x232a});var routingClient=jayson[_0x432f('0x7')][_0x432f('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x355b02,_0x2f5f03){return function(_0x5d8cc0){if(_0x5d8cc0){var _0x5b5f08=typeof _0x2f5f03[_0x432f('0x8')]===_0x432f('0x9')&&typeof _0x2f5f03['limit']===_0x432f('0x9');var _0x5aaf1a=_0x5d8cc0[_0x432f('0xa')];var _0x340fe9=_0x5b5f08?0x0:_0x2f5f03[_0x432f('0x8')];var _0x13369a=_0x5b5f08?_0x5d8cc0[_0x432f('0xa')]:_0x2f5f03['offset']+_0x2f5f03[_0x432f('0xb')];var _0x5758d7;if(_0x13369a>=_0x5aaf1a){_0x13369a=_0x5aaf1a;_0x5758d7=0xc8;}else{_0x5758d7=0xce;}_0x355b02[_0x432f('0xc')](_0x5758d7);return _0x355b02['set'](_0x432f('0xd'),_0x340fe9+'-'+_0x13369a+'/'+_0x5aaf1a)[_0x432f('0xe')](_0x5d8cc0);}return null;};}function handleError(_0x53459c,_0x457389){_0x457389=_0x457389||0x1f4;return function(_0x29f7d2){logger['error'](_0x29f7d2[_0x432f('0xf')]);if(_0x29f7d2[_0x432f('0x10')]){delete _0x29f7d2['name'];}_0x53459c['status'](_0x457389)[_0x432f('0x11')](_0x29f7d2);};}exports[_0x432f('0x12')]=function(_0x34add6,_0x453725){var _0x419bfe=['mail',_0x432f('0x13'),_0x432f('0x14'),_0x432f('0x15'),_0x432f('0x16'),'whatsapp',_0x432f('0x17')];var _0x30f231={'count':0x0,'rows':[]},_0x42c2d2={},_0x243cf;Promise[_0x432f('0x18')]()[_0x432f('0x19')](function(){if(_0x34add6['query'][_0x432f('0x1a')]){if(!_['includes'](_0x419bfe,_0x34add6[_0x432f('0x1b')][_0x432f('0x1a')][_0x432f('0x1c')]()))throw new Error(_0x432f('0x1d'));_0x243cf=_0x34add6[_0x432f('0x1b')][_0x432f('0x1a')][_0x432f('0x1c')]();}var _0x1899e6=_[_0x432f('0x1e')](_0x243cf)+_0x432f('0x1f');var _0x40176d=_[_0x432f('0x20')](db[_0x1899e6]['rawAttributes'],function(_0x5940bd){return{'name':_0x5940bd[_0x432f('0x21')],'type':_0x5940bd['type'][_0x432f('0x22')]};});_0x42c2d2=qs['getOptions'](_0x40176d,_0x34add6);if(_0x34add6[_0x432f('0x23')][_0x432f('0x24')]===_0x432f('0x23')){var _0x89ea50={'params':{'id':_0x34add6[_0x432f('0x23')][_0x432f('0x25')]},'query':{'section':_0x243cf==='voice'&&_0x34add6[_0x432f('0x1b')][_0x432f('0x26')]==='outbound'?_0x432f('0x27'):_[_0x432f('0x1e')](_0x243cf)+_0x432f('0x28'),'type':_0x34add6[_0x432f('0x1b')][_0x432f('0x26')],'nolimit':!![],'sort':_0x432f('0x10'),'filter':_0x34add6[_0x432f('0x1b')]['filter']}};return db[_0x432f('0x29')]['getResources'](_0x89ea50);}return db[_0x1899e6][_0x432f('0x2a')](_0x42c2d2);})['then'](function(_0x20404d){_0x30f231['count']=_0x20404d[_0x432f('0xa')];var _0x489ba6=_0x243cf===_0x432f('0x17')?client:routingClient;return _0x489ba6[_0x432f('0x2b')](_[_0x432f('0x1e')](_0x243cf)+'Queues',_0x34add6)[_0x432f('0x19')](function(_0x24406a){if(_0x24406a['error'])throw new Error(util['format'](_0x432f('0x2c'),_0x243cf));var _0x39dbcb=_0x24406a[_0x432f('0x2d')];var _0x3581c2=[_0x432f('0x2e'),_0x432f('0x2f'),'waiting','talking',_0x432f('0x30')];if(_0x243cf===_0x432f('0x17')&&_0x34add6[_0x432f('0x1b')]['type']===_0x432f('0x31')){_0x3581c2[_0x432f('0x32')](_0x432f('0x33'),_0x432f('0x34'),_0x432f('0x35'),_0x432f('0x36'),_0x432f('0x37'),_0x432f('0x38'),'startPredictive','startProgressive',_0x432f('0x39'),_0x432f('0x3a'),'erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval',_0x432f('0x3b'),_0x432f('0x3c'),'predictiveIntervalAvailable',_0x432f('0x3d'),_0x432f('0x3e'),_0x432f('0x3f'),'predictiveIntervalDroppedCallsCallersExit',_0x432f('0x40'),_0x432f('0x41'));}var _0x499e58=_0x20404d[_0x432f('0x42')][_0x432f('0x20')](function(_0x59e111){var _0x28da2e=_0x59e111[_0x432f('0x43')]({'plain':!![]});_0x28da2e[_0x432f('0x30')]=0x0;_0x28da2e[_0x432f('0x44')]=0x0;_0x28da2e[_0x432f('0x2e')]=0x0;_0x28da2e[_0x432f('0x2f')]=0x0;_0x28da2e[_0x432f('0x30')]=0x0;_0x28da2e[_0x432f('0x45')]=0x0;if(_0x243cf===_0x432f('0x17')){_0x28da2e[_0x432f('0x46')]=0x0;if(_0x34add6[_0x432f('0x1b')]['type']===_0x432f('0x31')){_0x28da2e['pTalking']=0x0;_0x28da2e[_0x432f('0x34')]=0x0;}}_0x28da2e[_0x432f('0x47')]=[];var _0x4f38e5=_[_0x432f('0x48')](_0x39dbcb['rows'],['id',_0x28da2e['id']]);if(_0x4f38e5)_[_0x432f('0x49')](_0x28da2e,_[_0x432f('0x4a')](_0x4f38e5,_0x3581c2));if(_0x243cf==='voice'){return _0x59e111['getAgents']({'attributes':['id',_0x432f('0x10'),_0x432f('0x4b')],'joinTableAttributes':[],'raw':!![]})[_0x432f('0x19')](function(_0x121687){return _0x59e111[_0x432f('0x4c')]({'raw':!![]})['then'](function(_0x5dade1){for(var _0x53516d=0x0;_0x53516d<_0x121687[_0x432f('0x4d')];_0x53516d++){var _0x2c1bd1=_['find'](_0x5dade1,[_0x432f('0x4e'),_0x121687[_0x53516d]['id']]);var _0x841572={'id':_0x121687[_0x53516d]['id'],'name':_0x121687[_0x53516d][_0x432f('0x10')],'online':Boolean(_0x121687[_0x53516d][_0x432f('0x4b')]),'paused':_0x2c1bd1?Boolean(_0x2c1bd1[_0x432f('0x30')]):![]};if(_0x841572[_0x432f('0x4b')])_0x28da2e[_0x432f('0x44')]++;if(_0x841572[_0x432f('0x30')])_0x28da2e[_0x432f('0x30')]++;_0x28da2e['agents'][_0x432f('0x32')](_0x841572);}return _0x28da2e;});});}else{var _0xd8264f='User'+_[_0x432f('0x1e')](_0x243cf)+_0x432f('0x1f');var _0x12b7a8=_0x243cf+_0x432f('0x4f');return db[_0xd8264f][_0x432f('0x50')]({'where':{[_[_0x432f('0x1e')](_0x243cf)+_0x432f('0x51')]:_0x59e111['id']},'raw':!![]})[_0x432f('0x19')](function(_0x42022d){return db[_0x432f('0x52')][_0x432f('0x50')]({'attributes':['id',_0x432f('0x10'),_0x432f('0x4b'),_0x12b7a8],'where':{'id':_[_0x432f('0x20')](_0x42022d,'UserId'),'role':'agent'},'raw':!![]});})[_0x432f('0x19')](function(_0x34dca6){for(var _0xcbdcc0=0x0;_0xcbdcc0<_0x34dca6[_0x432f('0x4d')];_0xcbdcc0++){var _0x12fd92={'id':_0x34dca6[_0xcbdcc0]['id'],'name':_0x34dca6[_0xcbdcc0]['name'],'online':Boolean(_0x34dca6[_0xcbdcc0][_0x432f('0x4b')]),'paused':Boolean(_0x34dca6[_0xcbdcc0][_0x12b7a8])};if(_0x12fd92[_0x432f('0x4b')])_0x28da2e[_0x432f('0x44')]++;if(_0x12fd92[_0x432f('0x30')])_0x28da2e[_0x432f('0x30')]++;_0x28da2e[_0x432f('0x47')][_0x432f('0x32')](_0x12fd92);}return _0x28da2e;});}});return Promise['all'](_0x499e58);});})[_0x432f('0x19')](function(_0x2dd9c2){_0x30f231[_0x432f('0x42')]=_0x2dd9c2;return _0x30f231;})['then'](respondWithFilteredResult(_0x453725,_0x42c2d2))[_0x432f('0x53')](handleError(_0x453725,null));}; \ No newline at end of file +var _0xc4aa=['status','send','getQueues','mail','chat','openchannel','fax','whatsapp','voice','resolve','channel','includes','query','toLowerCase','Invalid\x20channel','startCase','Queue','map','rawAttributes','fieldName','type','key','getOptions','role','user','userProfileId','outbound','QueueCampaigns','Queues','UserProfile','getResources','findAndCountAll','then','request','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','loggedIn','waiting','talking','paused','push','pTalking','originated','message','dialActive','dialMethod','Trunk','startProgressive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','rows','get','available','agents','find','merge','pick','getAgents','online','length','UserId','loggedInDb','User','Pause','findAll','QueueId','catch','util','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','api','client','http','offset','undefined','count','set','json','error','stack','name'];(function(_0x37423a,_0x13ea2b){var _0x129ee0=function(_0x12eca6){while(--_0x12eca6){_0x37423a['push'](_0x37423a['shift']());}};_0x129ee0(++_0x13ea2b);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xc4aa[_0x88cd7b];return _0x56fcc8;};'use strict';var util=require(_0xac4a('0x0'));var _=require(_0xac4a('0x1'));var jayson=require(_0xac4a('0x2'));var qs=require(_0xac4a('0x3'));var logger=require(_0xac4a('0x4'))(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var client=jayson['client']['http']({'port':0x232a});var routingClient=jayson[_0xac4a('0x6')][_0xac4a('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x730a38,_0x215f39){return function(_0x96be2b){if(_0x96be2b){var _0x15cd34=typeof _0x215f39[_0xac4a('0x8')]===_0xac4a('0x9')&&typeof _0x215f39['limit']==='undefined';var _0x1aba6d=_0x96be2b[_0xac4a('0xa')];var _0x26ec84=_0x15cd34?0x0:_0x215f39['offset'];var _0x1d182e=_0x15cd34?_0x96be2b[_0xac4a('0xa')]:_0x215f39[_0xac4a('0x8')]+_0x215f39['limit'];var _0x30135d;if(_0x1d182e>=_0x1aba6d){_0x1d182e=_0x1aba6d;_0x30135d=0xc8;}else{_0x30135d=0xce;}_0x730a38['status'](_0x30135d);return _0x730a38[_0xac4a('0xb')]('Content-Range',_0x26ec84+'-'+_0x1d182e+'/'+_0x1aba6d)[_0xac4a('0xc')](_0x96be2b);}return null;};}function handleError(_0x2a0776,_0x24291d){_0x24291d=_0x24291d||0x1f4;return function(_0x5e16aa){logger[_0xac4a('0xd')](_0x5e16aa[_0xac4a('0xe')]);if(_0x5e16aa[_0xac4a('0xf')]){delete _0x5e16aa[_0xac4a('0xf')];}_0x2a0776[_0xac4a('0x10')](_0x24291d)[_0xac4a('0x11')](_0x5e16aa);};}exports[_0xac4a('0x12')]=function(_0x33c287,_0x190418){var _0x42c7fc=[_0xac4a('0x13'),_0xac4a('0x14'),'sms',_0xac4a('0x15'),_0xac4a('0x16'),_0xac4a('0x17'),_0xac4a('0x18')];var _0x3e88e3={'count':0x0,'rows':[]},_0x387a54={},_0x28e304;Promise[_0xac4a('0x19')]()['then'](function(){if(_0x33c287['query'][_0xac4a('0x1a')]){if(!_[_0xac4a('0x1b')](_0x42c7fc,_0x33c287[_0xac4a('0x1c')]['channel'][_0xac4a('0x1d')]()))throw new Error(_0xac4a('0x1e'));_0x28e304=_0x33c287[_0xac4a('0x1c')][_0xac4a('0x1a')][_0xac4a('0x1d')]();}var _0x3e829c=_[_0xac4a('0x1f')](_0x28e304)+_0xac4a('0x20');var _0x534092=_[_0xac4a('0x21')](db[_0x3e829c][_0xac4a('0x22')],function(_0x599787){return{'name':_0x599787[_0xac4a('0x23')],'type':_0x599787[_0xac4a('0x24')][_0xac4a('0x25')]};});_0x387a54=qs[_0xac4a('0x26')](_0x534092,_0x33c287);if(_0x33c287['user'][_0xac4a('0x27')]===_0xac4a('0x28')){var _0x15435c={'params':{'id':_0x33c287[_0xac4a('0x28')][_0xac4a('0x29')]},'query':{'section':_0x28e304===_0xac4a('0x18')&&_0x33c287[_0xac4a('0x1c')][_0xac4a('0x24')]===_0xac4a('0x2a')?_0xac4a('0x2b'):_[_0xac4a('0x1f')](_0x28e304)+_0xac4a('0x2c'),'type':_0x33c287[_0xac4a('0x1c')][_0xac4a('0x24')],'nolimit':!![],'sort':_0xac4a('0xf'),'filter':_0x33c287[_0xac4a('0x1c')]['filter']}};return db[_0xac4a('0x2d')][_0xac4a('0x2e')](_0x15435c);}return db[_0x3e829c][_0xac4a('0x2f')](_0x387a54);})[_0xac4a('0x30')](function(_0x116700){_0x3e88e3['count']=_0x116700['count'];var _0xdb7e=_0x28e304===_0xac4a('0x18')?client:routingClient;return _0xdb7e[_0xac4a('0x31')](_['startCase'](_0x28e304)+'Queues',_0x33c287)[_0xac4a('0x30')](function(_0x2896bc){if(_0x2896bc[_0xac4a('0xd')])throw new Error(util[_0xac4a('0x32')](_0xac4a('0x33'),_0x28e304));var _0x53d3a5=_0x2896bc[_0xac4a('0x34')];var _0x482afc=[_0xac4a('0x35'),'available',_0xac4a('0x36'),_0xac4a('0x37'),_0xac4a('0x38')];if(_0x28e304===_0xac4a('0x18')&&_0x33c287[_0xac4a('0x1c')][_0xac4a('0x24')]===_0xac4a('0x2a')){_0x482afc[_0xac4a('0x39')](_0xac4a('0x3a'),_0xac4a('0x3b'),_0xac4a('0x3c'),_0xac4a('0x3d'),_0xac4a('0x3e'),_0xac4a('0x3f'),'startPredictive',_0xac4a('0x40'),_0xac4a('0x41'),'erlangCallToSecond',_0xac4a('0x42'),_0xac4a('0x43'),'dialPredictiveInterval','dialPredictiveIntervalMaxThreshold',_0xac4a('0x44'),_0xac4a('0x45'),_0xac4a('0x46'),_0xac4a('0x47'),'predictiveIntervalDroppedCallsTimeout',_0xac4a('0x48'),_0xac4a('0x49'),'predictiveIntervalAvgTalktime');}var _0x37f2ee=_0x116700[_0xac4a('0x4a')][_0xac4a('0x21')](function(_0x5f0eb8){var _0x121328=_0x5f0eb8[_0xac4a('0x4b')]({'plain':!![]});_0x121328[_0xac4a('0x38')]=0x0;_0x121328['loggedInDb']=0x0;_0x121328[_0xac4a('0x35')]=0x0;_0x121328[_0xac4a('0x4c')]=0x0;_0x121328['paused']=0x0;_0x121328['waiting']=0x0;if(_0x28e304===_0xac4a('0x18')){_0x121328['talking']=0x0;if(_0x33c287['query']['type']==='outbound'){_0x121328[_0xac4a('0x3a')]=0x0;_0x121328[_0xac4a('0x3b')]=0x0;}}_0x121328[_0xac4a('0x4d')]=[];var _0x472484=_[_0xac4a('0x4e')](_0x53d3a5[_0xac4a('0x4a')],['id',_0x121328['id']]);if(_0x472484)_[_0xac4a('0x4f')](_0x121328,_[_0xac4a('0x50')](_0x472484,_0x482afc));if(_0x28e304===_0xac4a('0x18')){return _0x5f0eb8[_0xac4a('0x51')]({'attributes':['id',_0xac4a('0xf'),_0xac4a('0x52')],'joinTableAttributes':[],'raw':!![]})['then'](function(_0x5086ff){return _0x5f0eb8['getMembers']({'raw':!![]})[_0xac4a('0x30')](function(_0x5c46a){for(var _0x14e80b=0x0;_0x14e80b<_0x5086ff[_0xac4a('0x53')];_0x14e80b++){var _0x9efd8d=_[_0xac4a('0x4e')](_0x5c46a,[_0xac4a('0x54'),_0x5086ff[_0x14e80b]['id']]);var _0x3441f2={'id':_0x5086ff[_0x14e80b]['id'],'name':_0x5086ff[_0x14e80b][_0xac4a('0xf')],'online':Boolean(_0x5086ff[_0x14e80b][_0xac4a('0x52')]),'paused':_0x9efd8d?Boolean(_0x9efd8d['paused']):![]};if(_0x3441f2[_0xac4a('0x52')])_0x121328[_0xac4a('0x55')]++;if(_0x3441f2[_0xac4a('0x38')])_0x121328[_0xac4a('0x38')]++;_0x121328[_0xac4a('0x4d')]['push'](_0x3441f2);}return _0x121328;});});}else{var _0x8700b4=_0xac4a('0x56')+_['startCase'](_0x28e304)+_0xac4a('0x20');var _0x5b1734=_0x28e304+_0xac4a('0x57');return db[_0x8700b4][_0xac4a('0x58')]({'where':{[_[_0xac4a('0x1f')](_0x28e304)+_0xac4a('0x59')]:_0x5f0eb8['id']},'raw':!![]})[_0xac4a('0x30')](function(_0x463f01){return db[_0xac4a('0x56')][_0xac4a('0x58')]({'attributes':['id',_0xac4a('0xf'),_0xac4a('0x52'),_0x5b1734],'where':{'id':_[_0xac4a('0x21')](_0x463f01,_0xac4a('0x54')),'role':'agent'},'raw':!![]});})[_0xac4a('0x30')](function(_0x41d11d){for(var _0xeca4e9=0x0;_0xeca4e9<_0x41d11d['length'];_0xeca4e9++){var _0x1764bf={'id':_0x41d11d[_0xeca4e9]['id'],'name':_0x41d11d[_0xeca4e9][_0xac4a('0xf')],'online':Boolean(_0x41d11d[_0xeca4e9]['online']),'paused':Boolean(_0x41d11d[_0xeca4e9][_0x5b1734])};if(_0x1764bf[_0xac4a('0x52')])_0x121328['loggedInDb']++;if(_0x1764bf[_0xac4a('0x38')])_0x121328[_0xac4a('0x38')]++;_0x121328[_0xac4a('0x4d')]['push'](_0x1764bf);}return _0x121328;});}});return Promise['all'](_0x37f2ee);});})[_0xac4a('0x30')](function(_0x4aaeff){_0x3e88e3[_0xac4a('0x4a')]=_0x4aaeff;return _0x3e88e3;})['then'](respondWithFilteredResult(_0x190418,_0x387a54))[_0xac4a('0x5a')](handleError(_0x190418,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 5185acf..14811f1 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2ffc5d,_0x564eba){var _0x57f0a=function(_0x44d8fb){while(--_0x44d8fb){_0x2ffc5d['push'](_0x2ffc5d['shift']());}};_0x57f0a(++_0x564eba);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'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(_0x145506,_0x260454){var _0x271793=function(_0x419e25){while(--_0x419e25){_0x145506['push'](_0x145506['shift']());}};_0x271793(++_0x260454);}(_0x70e0,0x17b));var _0x070e=function(_0x38e978,_0x27dec0){_0x38e978=_0x38e978-0x0;var _0x2db306=_0x70e0[_0x38e978];return _0x2db306;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 90c4af9..78a94c9 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 _0x7409=['sequelize','exports','STRING','DATE','INTEGER'];(function(_0x20ec65,_0x481a64){var _0x2c1e72=function(_0x40f244){while(--_0x40f244){_0x20ec65['push'](_0x20ec65['shift']());}};_0x2c1e72(++_0x481a64);}(_0x7409,0x6e));var _0x9740=function(_0x20be6c,_0x544e09){_0x20be6c=_0x20be6c-0x0;var _0x117c8d=_0x7409[_0x20be6c];return _0x117c8d;};'use strict';var Sequelize=require(_0x9740('0x0'));module[_0x9740('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x9740('0x2')]},'scheduledat':{'type':Sequelize[_0x9740('0x3')]},'uniqueid':{'type':Sequelize[_0x9740('0x2')]},'starttime':{'type':Sequelize[_0x9740('0x3')]},'responsetime':{'type':Sequelize[_0x9740('0x3')]},'ringtime':{'type':Sequelize[_0x9740('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x9740('0x2')]},'campaigntype':{'type':Sequelize[_0x9740('0x2')]},'membername':{'type':Sequelize[_0x9740('0x2')]}}; \ No newline at end of file +var _0x8458=['DATE','sequelize','INTEGER','STRING'];(function(_0x2e4a7a,_0x4d1078){var _0x40f88e=function(_0x203839){while(--_0x203839){_0x2e4a7a['push'](_0x2e4a7a['shift']());}};_0x40f88e(++_0x4d1078);}(_0x8458,0x1a5));var _0x8845=function(_0x37a63b,_0x33d7a8){_0x37a63b=_0x37a63b-0x0;var _0x3bf236=_0x8458[_0x37a63b];return _0x3bf236;};'use strict';var Sequelize=require(_0x8845('0x0'));module['exports']={'state':{'type':Sequelize[_0x8845('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x8845('0x2')]},'scheduledat':{'type':Sequelize[_0x8845('0x3')]},'uniqueid':{'type':Sequelize[_0x8845('0x2')]},'starttime':{'type':Sequelize[_0x8845('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x8845('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x8845('0x2')]},'campaigntype':{'type':Sequelize[_0x8845('0x2')]},'membername':{'type':Sequelize[_0x8845('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 4bc6b7e..58cd891 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 _0xb9ff=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb9ff,0xc6));var _0xfb9f=function(_0x46f4e5,_0xe9dd95){_0x46f4e5=_0x46f4e5-0x0;var _0x103fb3=_0xb9ff[_0x46f4e5];return _0x103fb3;};'use strict';var _=require(_0xfb9f('0x0'));var util=require('util');var logger=require(_0xfb9f('0x1'))(_0xfb9f('0x2'));var moment=require('moment');var BPromise=require(_0xfb9f('0x3'));var rp=require(_0xfb9f('0x4'));var fs=require('fs');var path=require(_0xfb9f('0x5'));var rimraf=require(_0xfb9f('0x6'));var config=require(_0xfb9f('0x7'));var attributes=require('./reportAgentPreview.attributes');module[_0xfb9f('0x8')]=function(_0x4f4289,_0x23855d){return _0x4f4289[_0xfb9f('0x9')]('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb4e=['bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','moment'];(function(_0x189bf0,_0x4625ae){var _0x3f9fec=function(_0x2705f1){while(--_0x2705f1){_0x189bf0['push'](_0x189bf0['shift']());}};_0x3f9fec(++_0x4625ae);}(_0xdb4e,0x7a));var _0xedb4=function(_0x1817f,_0x1ab0fb){_0x1817f=_0x1817f-0x0;var _0x1b1293=_0xdb4e[_0x1817f];return _0x1b1293;};'use strict';var _=require(_0xedb4('0x0'));var util=require(_0xedb4('0x1'));var logger=require(_0xedb4('0x2'))('api');var moment=require(_0xedb4('0x3'));var BPromise=require(_0xedb4('0x4'));var rp=require(_0xedb4('0x5'));var fs=require('fs');var path=require(_0xedb4('0x6'));var rimraf=require(_0xedb4('0x7'));var config=require(_0xedb4('0x8'));var attributes=require(_0xedb4('0x9'));module[_0xedb4('0xa')]=function(_0x1156e5,_0x4f60f7){return _0x1156e5[_0xedb4('0xb')](_0xedb4('0xc'),attributes,{'tableName':_0xedb4('0xd'),'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 ccf8c01..46eb27c 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 _0x4e74=['then','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','CreateReportAgentPreview','ReportAgentPreview','options','raw'];(function(_0x3a0ecd,_0x23c4f1){var _0x1d43c5=function(_0x119b40){while(--_0x119b40){_0x3a0ecd['push'](_0x3a0ecd['shift']());}};_0x1d43c5(++_0x23c4f1);}(_0x4e74,0x16e));var _0x44e7=function(_0x57da0a,_0x284aed){_0x57da0a=_0x57da0a-0x0;var _0x3145d5=_0x4e74[_0x57da0a];return _0x3145d5;};'use strict';var _=require(_0x44e7('0x0'));var util=require(_0x44e7('0x1'));var moment=require('moment');var BPromise=require(_0x44e7('0x2'));var rs=require(_0x44e7('0x3'));var fs=require('fs');var Redis=require(_0x44e7('0x4'));var db=require(_0x44e7('0x5'))['db'];var utils=require(_0x44e7('0x6'));var logger=require('../../config/logger')(_0x44e7('0x7'));var config=require(_0x44e7('0x8'));var jayson=require(_0x44e7('0x9'));var client=jayson[_0x44e7('0xa')][_0x44e7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46a16e,_0x40e387,_0x3c0924){return new BPromise(function(_0x167745,_0x2db2f3){return client[_0x44e7('0xc')](_0x46a16e,_0x3c0924)['then'](function(_0x4a5281){logger['info'](_0x44e7('0xd'),_0x40e387,_0x44e7('0xe'));logger[_0x44e7('0xf')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x40e387,'request\x20sent',JSON[_0x44e7('0x10')](_0x4a5281));if(_0x4a5281[_0x44e7('0x11')]){if(_0x4a5281['error'][_0x44e7('0x12')]===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x40e387,_0x4a5281[_0x44e7('0x11')][_0x44e7('0x13')]);return _0x2db2f3(_0x4a5281[_0x44e7('0x11')][_0x44e7('0x13')]);}logger[_0x44e7('0x11')](_0x44e7('0xd'),_0x40e387,_0x4a5281[_0x44e7('0x11')][_0x44e7('0x13')]);return _0x167745(_0x4a5281['error'][_0x44e7('0x13')]);}else{logger[_0x44e7('0x14')](_0x44e7('0xd'),_0x40e387,_0x44e7('0xe'));_0x167745(_0x4a5281[_0x44e7('0x15')][_0x44e7('0x13')]);}})['catch'](function(_0x5a4025){logger['error'](_0x44e7('0xd'),_0x40e387,_0x5a4025);_0x2db2f3(_0x5a4025);});});}exports[_0x44e7('0x16')]=function(_0xc49f75){var _0x515c6e=this;return new Promise(function(_0x5eaed1,_0x8e8d59){return db[_0x44e7('0x17')]['create'](_0xc49f75['body'],{'raw':_0xc49f75[_0x44e7('0x18')]?_0xc49f75[_0x44e7('0x18')][_0x44e7('0x19')]===undefined?!![]:![]:!![]})[_0x44e7('0x1a')](function(_0x4afce2){logger[_0x44e7('0x14')](_0x44e7('0x16'),_0xc49f75);logger['debug'](_0x44e7('0x16'),_0xc49f75,JSON[_0x44e7('0x10')](_0x4afce2));_0x5eaed1(_0x4afce2);})[_0x44e7('0x1b')](function(_0x10c064){logger[_0x44e7('0x11')](_0x44e7('0x16'),_0x10c064[_0x44e7('0x13')],_0xc49f75);_0x8e8d59(_0x515c6e['error'](0x1f4,_0x10c064[_0x44e7('0x13')]));});});}; \ No newline at end of file +var _0xc69e=['raw','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','code','error','message','info','result','CreateReportAgentPreview','ReportAgentPreview','create','body','options'];(function(_0x1804c3,_0x2f8996){var _0x33f216=function(_0x3acd6e){while(--_0x3acd6e){_0x1804c3['push'](_0x1804c3['shift']());}};_0x33f216(++_0x2f8996);}(_0xc69e,0x1d6));var _0xec69=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xc69e[_0x46e363];return _0x3fb059;};'use strict';var _=require('lodash');var util=require(_0xec69('0x0'));var moment=require(_0xec69('0x1'));var BPromise=require(_0xec69('0x2'));var rs=require(_0xec69('0x3'));var fs=require('fs');var Redis=require(_0xec69('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xec69('0x5'));var logger=require(_0xec69('0x6'))(_0xec69('0x7'));var config=require('../../config/environment');var jayson=require(_0xec69('0x8'));var client=jayson[_0xec69('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe2deb2,_0xd811cd,_0x520456){return new BPromise(function(_0x4173d2,_0x1bcda6){return client[_0xec69('0xa')](_0xe2deb2,_0x520456)['then'](function(_0x3d7d8d){logger['info'](_0xec69('0xb'),_0xd811cd,_0xec69('0xc'));logger[_0xec69('0xd')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0xd811cd,_0xec69('0xc'),JSON['stringify'](_0x3d7d8d));if(_0x3d7d8d['error']){if(_0x3d7d8d['error'][_0xec69('0xe')]===0x1f4){logger[_0xec69('0xf')]('ReportAgentPreview,\x20%s,\x20%s',_0xd811cd,_0x3d7d8d[_0xec69('0xf')]['message']);return _0x1bcda6(_0x3d7d8d[_0xec69('0xf')][_0xec69('0x10')]);}logger[_0xec69('0xf')](_0xec69('0xb'),_0xd811cd,_0x3d7d8d[_0xec69('0xf')][_0xec69('0x10')]);return _0x4173d2(_0x3d7d8d[_0xec69('0xf')][_0xec69('0x10')]);}else{logger[_0xec69('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0xd811cd,_0xec69('0xc'));_0x4173d2(_0x3d7d8d[_0xec69('0x12')][_0xec69('0x10')]);}})['catch'](function(_0xa1acc5){logger[_0xec69('0xf')]('ReportAgentPreview,\x20%s,\x20%s',_0xd811cd,_0xa1acc5);_0x1bcda6(_0xa1acc5);});});}exports[_0xec69('0x13')]=function(_0x5ac7d3){var _0x4fcceb=this;return new Promise(function(_0x2d2e0d,_0x450c11){return db[_0xec69('0x14')][_0xec69('0x15')](_0x5ac7d3[_0xec69('0x16')],{'raw':_0x5ac7d3[_0xec69('0x17')]?_0x5ac7d3[_0xec69('0x17')][_0xec69('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x48dc37){logger[_0xec69('0x11')]('CreateReportAgentPreview',_0x5ac7d3);logger['debug'](_0xec69('0x13'),_0x5ac7d3,JSON['stringify'](_0x48dc37));_0x2d2e0d(_0x48dc37);})[_0xec69('0x19')](function(_0x272ff0){logger[_0xec69('0xf')](_0xec69('0x13'),_0x272ff0[_0xec69('0x10')],_0x5ac7d3);_0x450c11(_0x4fcceb[_0xec69('0xf')](0x1f4,_0x272ff0['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 02a6d5f..6e96366 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 _0x99d9=['sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','express','../../components/auth/service','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','outbound','/outbound/channels','outboundChannels','/agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','/chat/queues/:id','/fax/queues/:id/notify','fax','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x99d9,0x19e));var _0x999d=function(_0x44b26a,_0x3b4c96){_0x44b26a=_0x44b26a-0x0;var _0x2d19ee=_0x99d9[_0x44b26a];return _0x2d19ee;};'use strict';var multer=require(_0x999d('0x0'));var util=require('util');var path=require('path');var express=require(_0x999d('0x1'));var router=express['Router']();var auth=require(_0x999d('0x2'));var controller=require('./rpc.controller');router[_0x999d('0x3')](_0x999d('0x4'),auth[_0x999d('0x5')](),controller['voiceChannels']);router['get'](_0x999d('0x6'),auth['isAuthenticated'](),controller[_0x999d('0x7')]);router[_0x999d('0x3')](_0x999d('0x8'),auth['isAuthenticated'](),controller[_0x999d('0x9')]);router['get'](_0x999d('0xa'),auth[_0x999d('0x5')](),controller['voiceQueues']);router[_0x999d('0x3')]('/chat/queues',auth[_0x999d('0x5')](),controller['chatQueues']);router[_0x999d('0x3')](_0x999d('0xb'),auth[_0x999d('0x5')](),controller[_0x999d('0xc')]);router[_0x999d('0x3')](_0x999d('0xd'),auth[_0x999d('0x5')](),controller[_0x999d('0xe')]);router[_0x999d('0x3')](_0x999d('0xf'),auth[_0x999d('0x5')](),controller[_0x999d('0x10')]);router['get'](_0x999d('0x11'),auth[_0x999d('0x5')](),controller[_0x999d('0x12')]);router['get'](_0x999d('0x13'),auth['isAuthenticated'](),controller[_0x999d('0x14')]);router[_0x999d('0x3')](_0x999d('0x15'),auth[_0x999d('0x5')](),controller[_0x999d('0x16')]);router['get']('/voice/queues/preview/:id',auth['isAuthenticated'](),controller[_0x999d('0x17')]);router[_0x999d('0x3')]('/voice/queues/channels',auth[_0x999d('0x5')](),controller['voiceQueuesChannels']);router[_0x999d('0x3')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x999d('0x18')]);router[_0x999d('0x3')](_0x999d('0x19'),auth[_0x999d('0x5')](),controller[_0x999d('0x1a')]);router[_0x999d('0x3')](_0x999d('0x1b'),auth[_0x999d('0x5')](),controller[_0x999d('0x1c')]);router['get'](_0x999d('0x1d'),auth[_0x999d('0x5')](),controller[_0x999d('0x1e')]);router[_0x999d('0x1f')](_0x999d('0x1d'),auth['isAuthenticated'](),controller['updateVoiceQueue']);router[_0x999d('0x3')]('/outbound',auth[_0x999d('0x5')](),controller[_0x999d('0x20')]);router[_0x999d('0x3')](_0x999d('0x21'),auth[_0x999d('0x5')](),controller[_0x999d('0x22')]);router[_0x999d('0x3')](_0x999d('0x23'),auth[_0x999d('0x5')](),controller['agents']);router[_0x999d('0x1f')](_0x999d('0x24'),auth['isAuthenticated'](),controller[_0x999d('0x25')]);router[_0x999d('0x3')](_0x999d('0x26'),auth[_0x999d('0x5')](),controller[_0x999d('0x27')]);router['get'](_0x999d('0x28'),auth[_0x999d('0x5')](),controller[_0x999d('0x29')]);router['get'](_0x999d('0x2a'),auth[_0x999d('0x5')](),controller[_0x999d('0x2b')]);router[_0x999d('0x3')](_0x999d('0x2c'),auth[_0x999d('0x5')](),controller[_0x999d('0x2d')]);router[_0x999d('0x3')](_0x999d('0x2e'),auth[_0x999d('0x5')](),controller['chatQueuesWaitingInteractions']);router['get']('/mail/queues/waitinginteractions',auth[_0x999d('0x5')](),controller[_0x999d('0x2f')]);router[_0x999d('0x3')](_0x999d('0x30'),auth[_0x999d('0x5')](),controller['openchannelQueuesWaitingInteractions']);router[_0x999d('0x3')](_0x999d('0x31'),auth[_0x999d('0x5')](),controller[_0x999d('0x32')]);router[_0x999d('0x3')](_0x999d('0x33'),auth['isAuthenticated'](),controller[_0x999d('0x34')]);router[_0x999d('0x3')](_0x999d('0x35'),auth[_0x999d('0x5')](),controller[_0x999d('0x36')]);router[_0x999d('0x3')](_0x999d('0x37'),auth['isAuthenticated'](),controller[_0x999d('0x38')]);router[_0x999d('0x39')](_0x999d('0x3a'),auth['isAuthenticated'](),controller[_0x999d('0x3b')](_0x999d('0x3c')));router[_0x999d('0x3')](_0x999d('0x3d'),auth[_0x999d('0x5')](),controller[_0x999d('0x3e')]);router['post'](_0x999d('0x3f'),auth[_0x999d('0x5')](),controller[_0x999d('0x3b')]('chat'));router[_0x999d('0x3')](_0x999d('0x40'),auth[_0x999d('0x5')](),controller['showChatQueues']);router['post'](_0x999d('0x41'),auth[_0x999d('0x5')](),controller[_0x999d('0x3b')](_0x999d('0x42')));router[_0x999d('0x3')]('/fax/queues/:id',auth[_0x999d('0x5')](),controller[_0x999d('0x43')]);router['post']('/openchannel/queues/:id/notify',auth['isAuthenticated'](),controller[_0x999d('0x3b')](_0x999d('0x44')));router[_0x999d('0x3')](_0x999d('0x45'),auth[_0x999d('0x5')](),controller[_0x999d('0x46')]);router[_0x999d('0x39')](_0x999d('0x47'),auth[_0x999d('0x5')](),controller[_0x999d('0x3b')](_0x999d('0x48')));router[_0x999d('0x39')](_0x999d('0x49'),auth[_0x999d('0x5')](),controller[_0x999d('0x3b')]('whatsapp'));router[_0x999d('0x3')](_0x999d('0x4a'),auth[_0x999d('0x5')](),controller[_0x999d('0x4b')]);router['get'](_0x999d('0x4c'),auth[_0x999d('0x5')](),controller[_0x999d('0x4d')]);router[_0x999d('0x39')](_0x999d('0x4e'),auth[_0x999d('0x5')](),controller[_0x999d('0x4f')]);module[_0x999d('0x50')]=router; \ No newline at end of file +var _0xe957=['/fax/queues','faxQueues','voiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','/outbound/channels','outboundChannels','agents','/agents/:id/capacity','/telephones','telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','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','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','showChatQueues','/fax/queues/:id/notify','queueNotify','fax','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','whatsappQueues'];(function(_0x7e3bb8,_0x27c048){var _0x44c887=function(_0x55d7c6){while(--_0x55d7c6){_0x7e3bb8['push'](_0x7e3bb8['shift']());}};_0x44c887(++_0x27c048);}(_0xe957,0x127));var _0x7e95=function(_0x28feea,_0x59f60a){_0x28feea=_0x28feea-0x0;var _0x3ded02=_0xe957[_0x28feea];return _0x3ded02;};'use strict';var multer=require(_0x7e95('0x0'));var util=require(_0x7e95('0x1'));var path=require(_0x7e95('0x2'));var express=require(_0x7e95('0x3'));var router=express[_0x7e95('0x4')]();var auth=require(_0x7e95('0x5'));var controller=require(_0x7e95('0x6'));router[_0x7e95('0x7')](_0x7e95('0x8'),auth[_0x7e95('0x9')](),controller[_0x7e95('0xa')]);router[_0x7e95('0x7')](_0x7e95('0xb'),auth[_0x7e95('0x9')](),controller[_0x7e95('0xc')]);router[_0x7e95('0x7')](_0x7e95('0xd'),auth[_0x7e95('0x9')](),controller[_0x7e95('0xe')]);router['get'](_0x7e95('0xf'),auth[_0x7e95('0x9')](),controller[_0x7e95('0x10')]);router[_0x7e95('0x7')]('/chat/queues',auth[_0x7e95('0x9')](),controller[_0x7e95('0x11')]);router[_0x7e95('0x7')]('/mail/queues',auth[_0x7e95('0x9')](),controller[_0x7e95('0x12')]);router[_0x7e95('0x7')](_0x7e95('0x13'),auth[_0x7e95('0x9')](),controller[_0x7e95('0x14')]);router[_0x7e95('0x7')](_0x7e95('0x15'),auth[_0x7e95('0x9')](),controller[_0x7e95('0x16')]);router[_0x7e95('0x7')]('/sms/queues',auth[_0x7e95('0x9')](),controller[_0x7e95('0x17')]);router[_0x7e95('0x7')]('/whatsapp/queues',auth[_0x7e95('0x9')](),controller[_0x7e95('0x18')]);router[_0x7e95('0x7')](_0x7e95('0x19'),auth[_0x7e95('0x9')](),controller[_0x7e95('0x1a')]);router[_0x7e95('0x7')]('/voice/queues/preview/:id',auth[_0x7e95('0x9')](),controller[_0x7e95('0x1b')]);router[_0x7e95('0x7')]('/voice/queues/channels',auth[_0x7e95('0x9')](),controller[_0x7e95('0x1c')]);router[_0x7e95('0x7')]('/voice/queues/channels/:uniqueid',auth[_0x7e95('0x9')](),controller[_0x7e95('0x1d')]);router[_0x7e95('0x7')](_0x7e95('0x1e'),auth[_0x7e95('0x9')](),controller[_0x7e95('0x1f')]);router[_0x7e95('0x7')](_0x7e95('0x20'),auth['isAuthenticated'](),controller[_0x7e95('0x21')]);router['get'](_0x7e95('0x22'),auth[_0x7e95('0x9')](),controller[_0x7e95('0x23')]);router[_0x7e95('0x24')]('/voice/queues/:id',auth[_0x7e95('0x9')](),controller['updateVoiceQueue']);router[_0x7e95('0x7')]('/outbound',auth[_0x7e95('0x9')](),controller['outbound']);router['get'](_0x7e95('0x25'),auth[_0x7e95('0x9')](),controller[_0x7e95('0x26')]);router['get']('/agents',auth[_0x7e95('0x9')](),controller[_0x7e95('0x27')]);router[_0x7e95('0x24')](_0x7e95('0x28'),auth[_0x7e95('0x9')](),controller['agentCapacity']);router[_0x7e95('0x7')](_0x7e95('0x29'),auth[_0x7e95('0x9')](),controller[_0x7e95('0x2a')]);router['get'](_0x7e95('0x2b'),auth[_0x7e95('0x9')](),controller[_0x7e95('0x2c')]);router['get']('/campaigns',auth[_0x7e95('0x9')](),controller[_0x7e95('0x2d')]);router['get'](_0x7e95('0x2e'),auth[_0x7e95('0x9')](),controller[_0x7e95('0x2f')]);router[_0x7e95('0x7')](_0x7e95('0x30'),auth['isAuthenticated'](),controller[_0x7e95('0x31')]);router['get'](_0x7e95('0x32'),auth[_0x7e95('0x9')](),controller['mailQueuesWaitingInteractions']);router[_0x7e95('0x7')](_0x7e95('0x33'),auth['isAuthenticated'](),controller[_0x7e95('0x34')]);router[_0x7e95('0x7')](_0x7e95('0x35'),auth[_0x7e95('0x9')](),controller[_0x7e95('0x36')]);router[_0x7e95('0x7')](_0x7e95('0x37'),auth['isAuthenticated'](),controller[_0x7e95('0x38')]);router['get'](_0x7e95('0x39'),auth['isAuthenticated'](),controller[_0x7e95('0x3a')]);router['get'](_0x7e95('0x3b'),auth[_0x7e95('0x9')](),controller['faxQueuesWaitingInteractions']);router[_0x7e95('0x3c')](_0x7e95('0x3d'),auth[_0x7e95('0x9')](),controller['queueNotify']('mail'));router['get'](_0x7e95('0x3e'),auth[_0x7e95('0x9')](),controller[_0x7e95('0x3f')]);router['post'](_0x7e95('0x40'),auth[_0x7e95('0x9')](),controller['queueNotify']('chat'));router[_0x7e95('0x7')]('/chat/queues/:id',auth[_0x7e95('0x9')](),controller[_0x7e95('0x41')]);router[_0x7e95('0x3c')](_0x7e95('0x42'),auth[_0x7e95('0x9')](),controller[_0x7e95('0x43')](_0x7e95('0x44')));router[_0x7e95('0x7')]('/fax/queues/:id',auth[_0x7e95('0x9')](),controller[_0x7e95('0x45')]);router[_0x7e95('0x3c')]('/openchannel/queues/:id/notify',auth[_0x7e95('0x9')](),controller[_0x7e95('0x43')](_0x7e95('0x46')));router[_0x7e95('0x7')](_0x7e95('0x47'),auth[_0x7e95('0x9')](),controller[_0x7e95('0x48')]);router['post'](_0x7e95('0x49'),auth[_0x7e95('0x9')](),controller[_0x7e95('0x43')](_0x7e95('0x4a')));router['post'](_0x7e95('0x4b'),auth[_0x7e95('0x9')](),controller[_0x7e95('0x43')]('whatsapp'));router[_0x7e95('0x7')]('/sms/queues/:id',auth[_0x7e95('0x9')](),controller[_0x7e95('0x4c')]);router[_0x7e95('0x7')](_0x7e95('0x4d'),auth['isAuthenticated'](),controller[_0x7e95('0x4e')]);router[_0x7e95('0x3c')]('/agents/:id/notify',auth['isAuthenticated'](),controller[_0x7e95('0x4f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 62c836f..0ab4f89 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 _0xf494=['WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','Account','\x20Message\x20not\x20found','MessageId','QueueId','TransferReport','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','messageId','update','InteractionId','From','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','message','status','json','sendStatus','stack','name','isNil','rows','find','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','catch','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues'];(function(_0xd2f4f5,_0x341930){var _0x41fc10=function(_0x496824){while(--_0x496824){_0xd2f4f5['push'](_0xd2f4f5['shift']());}};_0x41fc10(++_0x341930);}(_0xf494,0x1c6));var _0x4f49=function(_0x1ed54c,_0xe6599b){_0x1ed54c=_0x1ed54c-0x0;var _0x3ca3c1=_0xf494[_0x1ed54c];return _0x3ca3c1;};'use strict';var BPromise=require(_0x4f49('0x0'));var moment=require(_0x4f49('0x1'));var _=require(_0x4f49('0x2'));var util=require('util');var db=require(_0x4f49('0x3'))['db'];var logger=require(_0x4f49('0x4'))(_0x4f49('0x5'));var jayson=require(_0x4f49('0x6'));var amiClient=jayson[_0x4f49('0x7')][_0x4f49('0x8')]({'port':0x232a});var mailClient=jayson[_0x4f49('0x7')][_0x4f49('0x8')]({'port':0x232b});var routingClient=jayson[_0x4f49('0x7')][_0x4f49('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){var _0x31a725=_0x58e9a0?_0x58e9a0:amiClient;return _0x31a725[_0x4f49('0x9')](_0x42b0e8,_0x5eb186)[_0x4f49('0xa')](function(_0x174d0d){if(_0x174d0d[_0x4f49('0xb')]){if(_0x174d0d[_0x4f49('0xb')]['code']===0x1f4){return _0x327bd5(_0x174d0d[_0x4f49('0xb')][_0x4f49('0xc')]);}return _0x169c95(_0x174d0d['error'][_0x4f49('0xc')]);}else{_0x169c95(_0x174d0d['result']);}})['catch'](function(_0x4b9cd3){_0x327bd5(_0x4b9cd3);});});}function respondWithResult(_0x12527d,_0x4bf89f){_0x4bf89f=_0x4bf89f||0xc8;return function(_0x1e1c37){if(_0x1e1c37){return _0x12527d[_0x4f49('0xd')](_0x4bf89f)[_0x4f49('0xe')](_0x1e1c37);}return _0x12527d[_0x4f49('0xf')](0x194);};}function handleError(_0x1a0f1e,_0x2f0131){_0x2f0131=_0x2f0131||0x1f4;return function(_0xfdb477){logger['error'](_0xfdb477[_0x4f49('0x10')]);if(_0xfdb477[_0x4f49('0x11')]){delete _0xfdb477[_0x4f49('0x11')];}_0x1a0f1e['status'](_0x2f0131)['send'](_0xfdb477);};}function findById(_0x2f0a0d){return function(_0x2ecaaa){if(!_[_0x4f49('0x12')](_0x2f0a0d)&&!_['isNil'](_0x2ecaaa)&&!_[_0x4f49('0x12')](_0x2ecaaa[_0x4f49('0x13')])){return _[_0x4f49('0x14')](_0x2ecaaa['rows'],function(_0x5bb23b){return _0x5bb23b['id']==_0x2f0a0d;});}return null;};}exports['voiceChannels']=function(_0x47f1e8,_0xb2081a){return respondWithRpcPromise(_0x4f49('0x15'),_0x47f1e8[_0x4f49('0x16')])[_0x4f49('0xa')](respondWithResult(_0xb2081a,null))['catch'](handleError(_0xb2081a,null));};exports[_0x4f49('0x17')]=function(_0x2aed27,_0x197a49){return respondWithRpcPromise(_0x4f49('0x18'),_[_0x4f49('0x19')](_0x2aed27['query'],_0x2aed27[_0x4f49('0x1a')]))[_0x4f49('0xa')](respondWithResult(_0x197a49,null))[_0x4f49('0x1b')](handleError(_0x197a49,null));};exports['voiceChannelStopMixMonitor']=function(_0x40755e,_0x1d70a7){return respondWithRpcPromise(_0x4f49('0x1c'),_[_0x4f49('0x19')](_0x40755e[_0x4f49('0x16')],_0x40755e[_0x4f49('0x1a')]))['then'](respondWithResult(_0x1d70a7,null))['catch'](handleError(_0x1d70a7,null));};exports[_0x4f49('0x1d')]=function(_0x429de7,_0x4fedbb){return respondWithRpcPromise(_0x4f49('0x1e'),_0x429de7[_0x4f49('0x16')])[_0x4f49('0xa')](respondWithResult(_0x4fedbb,null))['catch'](handleError(_0x4fedbb,null));};exports[_0x4f49('0x1f')]=function(_0x2eed1c,_0x298785){return respondWithRpcPromise(_0x4f49('0x1e'),_0x2eed1c[_0x4f49('0x16')])[_0x4f49('0xa')](findById(_0x2eed1c['params']['id']))['then'](respondWithResult(_0x298785,null))[_0x4f49('0x1b')](handleError(_0x298785,null));};exports[_0x4f49('0x20')]=function(_0x605c91,_0x560050){return respondWithRpcPromise(_0x4f49('0x21'),_[_0x4f49('0x19')](_0x605c91[_0x4f49('0x22')],_0x605c91['params']))['then'](respondWithResult(_0x560050,null))[_0x4f49('0x1b')](handleError(_0x560050,null));};exports[_0x4f49('0x23')]=function(_0x7a6ea0,_0x5e7076){return respondWithRpcPromise(_0x4f49('0x24'),_[_0x4f49('0x19')](_0x7a6ea0[_0x4f49('0x16')],_0x7a6ea0[_0x4f49('0x1a')]))[_0x4f49('0xa')](respondWithResult(_0x5e7076,null))[_0x4f49('0x1b')](handleError(_0x5e7076,null));};exports[_0x4f49('0x25')]=function(_0x45ae19,_0x1f38d3){return respondWithRpcPromise(_0x4f49('0x26'),_0x45ae19[_0x4f49('0x16')])[_0x4f49('0xa')](respondWithResult(_0x1f38d3,null))[_0x4f49('0x1b')](handleError(_0x1f38d3,null));};exports[_0x4f49('0x27')]=function(_0x135d17,_0x97ef98){return respondWithRpcPromise(_0x4f49('0x28'),_[_0x4f49('0x19')](_0x135d17[_0x4f49('0x16')],_0x135d17['params']))[_0x4f49('0xa')](respondWithResult(_0x97ef98,null))[_0x4f49('0x1b')](handleError(_0x97ef98,null));};exports[_0x4f49('0x29')]=function(_0x1cb3cc,_0x1c3af8){return respondWithRpcPromise(_0x4f49('0x2a'),_[_0x4f49('0x19')](_0x1cb3cc[_0x4f49('0x16')],_0x1cb3cc[_0x4f49('0x1a')]))[_0x4f49('0xa')](respondWithResult(_0x1c3af8,null))[_0x4f49('0x1b')](handleError(_0x1c3af8,null));};exports[_0x4f49('0x2b')]=function(_0x3ec6c4,_0x4d2d57){return respondWithRpcPromise(_0x4f49('0x2c'),_[_0x4f49('0x19')](_0x3ec6c4[_0x4f49('0x16')],_0x3ec6c4[_0x4f49('0x1a')]))[_0x4f49('0xa')](respondWithResult(_0x4d2d57,null))[_0x4f49('0x1b')](handleError(_0x4d2d57,null));};exports[_0x4f49('0x2d')]=function(_0x25fdf8,_0x10bfc4){return respondWithRpcPromise(_0x4f49('0x2e'),_0x25fdf8[_0x4f49('0x16')])[_0x4f49('0xa')](respondWithResult(_0x10bfc4,null))[_0x4f49('0x1b')](handleError(_0x10bfc4,null));};exports[_0x4f49('0x2f')]=function(_0x4e3f72,_0x802f20){return respondWithRpcPromise(_0x4f49('0x30'),_0x4e3f72['query'])[_0x4f49('0xa')](respondWithResult(_0x802f20,null))[_0x4f49('0x1b')](handleError(_0x802f20,null));};exports['agents']=function(_0x29e762,_0x1dd1a6){var _0x2548ad;return respondWithRpcPromise(_0x4f49('0x31'),_0x29e762[_0x4f49('0x16')])[_0x4f49('0xa')](function(_0x29e910){_0x2548ad=_0x29e910;return respondWithRpcPromise('Agents',_0x29e762['query'],routingClient);})['then'](function(_0x15e4b3){return _[_0x4f49('0x19')]({},_0x15e4b3,_0x2548ad);})[_0x4f49('0xa')](respondWithResult(_0x1dd1a6,null))[_0x4f49('0x1b')](handleError(_0x1dd1a6,null));};exports[_0x4f49('0x32')]=function(_0x1ecf6c,_0x38aff8){if(_0x1ecf6c[_0x4f49('0x22')]&&_0x1ecf6c[_0x4f49('0x22')]['interaction']&&_0x1ecf6c['user']&&_0x1ecf6c[_0x4f49('0x33')][_0x4f49('0x11')]){for(var _0x159642 in _0x1ecf6c['body'][_0x4f49('0x34')]){if(_0x1ecf6c['body']['interaction'][_0x4f49('0x35')](_0x159642)){db[_0x4f49('0x36')][_0x4f49('0x37')]({'where':{'channel':_0x159642,'membername':_0x1ecf6c['user'][_0x4f49('0x11')],'type':_0x4f49('0x38'),'exitAt':null,'uniqueid':_0x1ecf6c['body'][_0x4f49('0x34')][_0x159642]&&_0x1ecf6c['body'][_0x4f49('0x34')][_0x159642][_0x4f49('0x39')]?{'$notIn':_0x1ecf6c[_0x4f49('0x22')]['interaction'][_0x159642]}:{'$ne':null}}})[_0x4f49('0xa')](function(_0x1e5f0b){var _0x33bb04=moment()[_0x4f49('0x3a')](_0x4f49('0x3b'));for(var _0x1c41e4=0x0,_0xe66867=_0x1e5f0b[_0x4f49('0x39')];_0x1c41e4<_0xe66867;_0x1c41e4+=0x1){_0x1e5f0b[_0x1c41e4][_0x4f49('0x3c')]({'exitAt':_0x33bb04});}});for(var _0x157a55=0x0;_0x157a55<_0x1ecf6c['body'][_0x4f49('0x34')][_0x159642][_0x4f49('0x39')];_0x157a55+=0x1){db['MemberReport'][_0x4f49('0x3d')]({'where':{'channel':_0x159642,'membername':_0x1ecf6c['user'][_0x4f49('0x11')],'type':_0x4f49('0x38'),'uniqueid':_0x1ecf6c[_0x4f49('0x22')][_0x4f49('0x34')][_0x159642][_0x157a55],'exitAt':null},'defaults':{'channel':_0x159642,'membername':_0x1ecf6c['user'][_0x4f49('0x11')],'interface':_[_0x4f49('0x12')](_0x1ecf6c[_0x4f49('0x33')][_0x4f49('0x3e')])?util[_0x4f49('0x3a')](_0x4f49('0x3f'),_0x1ecf6c[_0x4f49('0x33')][_0x4f49('0x11')]):_0x1ecf6c[_0x4f49('0x33')][_0x4f49('0x3e')],'type':_0x4f49('0x38'),'enterAt':moment()[_0x4f49('0x3a')](_0x4f49('0x3b')),'role':_0x4f49('0x40'),'internal':_0x1ecf6c[_0x4f49('0x33')][_0x4f49('0x41')],'uniqueid':_0x1ecf6c['body']['interaction'][_0x159642][_0x157a55]}});}}}}return respondWithRpcPromise(_0x4f49('0x42'),{'id':_0x1ecf6c[_0x4f49('0x1a')]['id'],'capacity':_0x1ecf6c[_0x4f49('0x22')][_0x4f49('0x43')]},routingClient)[_0x4f49('0xa')](respondWithResult(_0x38aff8,null))[_0x4f49('0x1b')](handleError(_0x38aff8,null));};exports[_0x4f49('0x44')]=function(_0x51c756,_0x6637f4){return respondWithRpcPromise('Telephones',_0x51c756[_0x4f49('0x16')])[_0x4f49('0xa')](respondWithResult(_0x6637f4,null))[_0x4f49('0x1b')](handleError(_0x6637f4,null));};exports[_0x4f49('0x45')]=function(_0x586095,_0x342980){return respondWithRpcPromise('Trunks',_0x586095['query'])[_0x4f49('0xa')](respondWithResult(_0x342980,null))[_0x4f49('0x1b')](handleError(_0x342980,null));};exports[_0x4f49('0x46')]=function(_0x26ae33,_0x56375a){return respondWithRpcPromise('Campaigns',_0x26ae33[_0x4f49('0x16')])[_0x4f49('0xa')](respondWithResult(_0x56375a,null))['catch'](handleError(_0x56375a,null));};exports[_0x4f49('0x47')]=function(_0x5b50bc,_0x5a929a){return respondWithRpcPromise(_0x4f49('0x48'),_0x5b50bc['query'],routingClient)[_0x4f49('0xa')](respondWithResult(_0x5a929a,null))['catch'](handleError(_0x5a929a,null));};exports[_0x4f49('0x49')]=function(_0x38a640,_0x2472c9){return respondWithRpcPromise(_0x4f49('0x48'),_0x38a640[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](findById(_0x38a640[_0x4f49('0x1a')]['id']))[_0x4f49('0xa')](respondWithResult(_0x2472c9,null))['catch'](handleError(_0x2472c9,null));};exports[_0x4f49('0x4a')]=function(_0x51f57e,_0x213608){return respondWithRpcPromise(_0x4f49('0x4b'),_0x51f57e[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](respondWithResult(_0x213608,null))[_0x4f49('0x1b')](handleError(_0x213608,null));};exports[_0x4f49('0x4c')]=function(_0x553981,_0x426c50){return respondWithRpcPromise(_0x4f49('0x4b'),_0x553981['query'],routingClient)['then'](findById(_0x553981[_0x4f49('0x1a')]['id']))[_0x4f49('0xa')](respondWithResult(_0x426c50,null))[_0x4f49('0x1b')](handleError(_0x426c50,null));};exports[_0x4f49('0x4d')]=function(_0x19a788,_0x4af08d){return respondWithRpcPromise(_0x4f49('0x4e'),_0x19a788['query'],mailClient)[_0x4f49('0xa')](respondWithResult(_0x4af08d,null))[_0x4f49('0x1b')](handleError(_0x4af08d,null));};exports[_0x4f49('0x4f')]=function(_0x4aae7c,_0x1dade6){return respondWithRpcPromise(_0x4f49('0x50'),_0x4aae7c[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](respondWithResult(_0x1dade6,null))['catch'](handleError(_0x1dade6,null));};exports[_0x4f49('0x51')]=function(_0x269564,_0x5e6898){return respondWithRpcPromise(_0x4f49('0x50'),_0x269564[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](findById(_0x269564[_0x4f49('0x1a')]['id']))[_0x4f49('0xa')](respondWithResult(_0x5e6898,null))[_0x4f49('0x1b')](handleError(_0x5e6898,null));};exports[_0x4f49('0x52')]=function(_0x30fc21,_0x519721){return respondWithRpcPromise(_0x4f49('0x53'),_0x30fc21[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](respondWithResult(_0x519721,null))[_0x4f49('0x1b')](handleError(_0x519721,null));};exports[_0x4f49('0x54')]=function(_0x26b022,_0x335875){return respondWithRpcPromise('SmsQueues',_0x26b022[_0x4f49('0x16')],routingClient)['then'](findById(_0x26b022[_0x4f49('0x1a')]['id']))[_0x4f49('0xa')](respondWithResult(_0x335875,null))[_0x4f49('0x1b')](handleError(_0x335875,null));};exports[_0x4f49('0x55')]=function(_0xc7743e,_0x3f2f3f){return respondWithRpcPromise(_0x4f49('0x56'),_0xc7743e[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](respondWithResult(_0x3f2f3f,null))[_0x4f49('0x1b')](handleError(_0x3f2f3f,null));};exports['showWhatsappQueues']=function(_0x2f9f2e,_0x141554){return respondWithRpcPromise(_0x4f49('0x56'),_0x2f9f2e[_0x4f49('0x16')],routingClient)['then'](findById(_0x2f9f2e['params']['id']))[_0x4f49('0xa')](respondWithResult(_0x141554,null))['catch'](handleError(_0x141554,null));};exports[_0x4f49('0x57')]=function(_0x287705,_0x43bdde){return respondWithRpcPromise(_0x4f49('0x58'),_0x287705[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](respondWithResult(_0x43bdde,null))[_0x4f49('0x1b')](handleError(_0x43bdde,null));};exports[_0x4f49('0x59')]=function(_0x3823f0,_0x3e9b47){return respondWithRpcPromise(_0x4f49('0x58'),_0x3823f0[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](findById(_0x3823f0[_0x4f49('0x1a')]['id']))[_0x4f49('0xa')](respondWithResult(_0x3e9b47,null))[_0x4f49('0x1b')](handleError(_0x3e9b47,null));};exports[_0x4f49('0x5a')]=function(_0x753863,_0x1f9161){return respondWithRpcPromise(_0x4f49('0x5b'),_0x753863[_0x4f49('0x16')])[_0x4f49('0xa')](respondWithResult(_0x1f9161,null))[_0x4f49('0x1b')](handleError(_0x1f9161,null));};exports[_0x4f49('0x5c')]=function(_0x2d0990,_0x49a79d){return respondWithRpcPromise(_0x4f49('0x5d'),_0x2d0990['query'],routingClient)[_0x4f49('0xa')](respondWithResult(_0x49a79d,null))[_0x4f49('0x1b')](handleError(_0x49a79d,null));};exports[_0x4f49('0x5e')]=function(_0x3c0f69,_0x26de18){return respondWithRpcPromise(_0x4f49('0x5f'),_0x3c0f69[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](respondWithResult(_0x26de18,null))[_0x4f49('0x1b')](handleError(_0x26de18,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x4b6ef4,_0x539e21){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4b6ef4[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](respondWithResult(_0x539e21,null))[_0x4f49('0x1b')](handleError(_0x539e21,null));};exports[_0x4f49('0x60')]=function(_0x1fc88a,_0x5a8b1c){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x1fc88a[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](function(_0x4bdd1b){if(_0x1fc88a[_0x4f49('0x16')][_0x4f49('0x61')]!==undefined){var _0x5c824f=_(_0x4bdd1b[_0x4f49('0x13')])['filter']([_0x1fc88a[_0x4f49('0x16')][_0x4f49('0x61')],_0x1fc88a['params']['id']])[_0x4f49('0x62')](_0x4f49('0x63'))[_0x4f49('0x64')]()[_0x4f49('0x65')]();return _0x4bdd1b[_0x4f49('0x13')][_0x4f49('0x66')](function(_0x5f0dbf){return _0x5c824f[_0x4f49('0x67')](_0x5f0dbf['queue_id'])>-0x1;});}else{return _0x4bdd1b[_0x4f49('0x13')]['filter'](function(_0x50c06e){return _0x50c06e['queue_id']===parseInt(_0x1fc88a[_0x4f49('0x1a')]['id']);});}})[_0x4f49('0xa')](respondWithResult(_0x5a8b1c,null))[_0x4f49('0x1b')](handleError(_0x5a8b1c,null));};exports[_0x4f49('0x68')]=function(_0x47af99,_0x39024d){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x47af99[_0x4f49('0x16')],routingClient)['then'](respondWithResult(_0x39024d,null))[_0x4f49('0x1b')](handleError(_0x39024d,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x4938a6,_0x329a49){return respondWithRpcPromise(_0x4f49('0x69'),_0x4938a6[_0x4f49('0x16')],routingClient)['then'](respondWithResult(_0x329a49,null))[_0x4f49('0x1b')](handleError(_0x329a49,null));};exports[_0x4f49('0x6a')]=function(_0x5c33c9,_0x5d52ae){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x5c33c9[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](respondWithResult(_0x5d52ae,null))[_0x4f49('0x1b')](handleError(_0x5d52ae,null));};exports[_0x4f49('0x6b')]=function(_0x1643fc){return function(_0x517144,_0x15b7e4){var _0x1b922e,_0x29de92;var _0x58d07e=_[_0x4f49('0x6c')](_0x1643fc);var _0x34843a=_0x1643fc===_0x4f49('0x6d')?_0x4f49('0x6e'):'Account';return db[_0x58d07e+_0x4f49('0x6f')][_0x4f49('0x70')]({'raw':!![],'where':{'id':_0x517144[_0x4f49('0x1a')]['id']}})[_0x4f49('0xa')](function(_0x389679){if(_['isNil'](_0x389679)){throw new Error(_0x58d07e+_0x4f49('0x71'));}_0x1b922e=_0x389679;return db[_0x58d07e+_0x4f49('0x72')]['findOne']({'where':{'id':_0x517144[_0x4f49('0x22')]['messageId']},'include':[{'model':db[_0x58d07e+_0x4f49('0x73')],'as':'Interaction'},{'model':db[_0x58d07e+_0x34843a],'as':_0x4f49('0x74')}]});})[_0x4f49('0xa')](function(_0x2ef19e){if(_[_0x4f49('0x12')](_0x2ef19e)){throw new Error(_0x58d07e+_0x4f49('0x75'));}_0x29de92=_0x2ef19e;return _0x2ef19e['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x4f49('0xa')](function(){var _0x1f3556={'uniqueid':_0x1643fc+'.'+_0x29de92['id']+'.'+_0x29de92[_0x4f49('0x73')]['id'],'FromUserId':_0x517144[_0x4f49('0x33')]['id'],'type':'queue'};_0x1f3556[_0x58d07e+_0x4f49('0x76')]=_0x29de92['id'];_0x1f3556[_0x58d07e+'InteractionId']=_0x29de92[_0x4f49('0x73')]['id'];_0x1f3556['From'+_0x58d07e+_0x34843a+'Id']=_0x29de92[_0x4f49('0x74')]['id'];_0x1f3556['To'+_0x58d07e+_0x4f49('0x77')]=_0x1b922e['id'];return db[_0x58d07e+_0x4f49('0x78')][_0x4f49('0x79')](_0x1f3556);})[_0x4f49('0xa')](function(){return respondWithRpcPromise(_0x4f49('0x7a'),{'channel':_0x1643fc,'interaction':_0x29de92[_0x4f49('0x73')],'message':_0x29de92,'account':_0x29de92[_0x4f49('0x74')],'applications':[{'id':0x0,'priority':0x1,'app':_0x4f49('0x7b'),'appdata':_0x1b922e[_0x4f49('0x11')]+','+(_0x29de92['Account'][_0x4f49('0x7c')]||0x12c),'interval':_0x4f49('0x7d')}]},routingClient);})[_0x4f49('0xa')](respondWithResult(_0x15b7e4,null))[_0x4f49('0x1b')](handleError(_0x15b7e4,null));};};exports[_0x4f49('0x7e')]=function(_0x24b033,_0x55b28b){var _0x2ec42b,_0x20a0d4;if(_[_0x4f49('0x12')](_0x24b033[_0x4f49('0x22')]['channel'])){throw new Error(_0x4f49('0x7f'));}var _0x57567a=_0x24b033[_0x4f49('0x22')][_0x4f49('0x80')];var _0x5c5d2=_[_0x4f49('0x6c')](_0x57567a);var _0x4cfb48=_0x57567a===_0x4f49('0x6d')?_0x4f49('0x6e'):_0x4f49('0x74');return db[_0x4f49('0x81')][_0x4f49('0x70')]({'raw':!![],'where':{'id':_0x24b033[_0x4f49('0x1a')]['id'],'role':_0x4f49('0x40')}})[_0x4f49('0xa')](function(_0x355787){if(_[_0x4f49('0x12')](_0x355787)){throw new Error(_0x4f49('0x82'));}_0x2ec42b=_0x355787;return db[_0x5c5d2+_0x4f49('0x72')][_0x4f49('0x70')]({'where':{'id':_0x24b033[_0x4f49('0x22')][_0x4f49('0x83')]},'include':[{'model':db[_0x5c5d2+_0x4f49('0x73')],'as':_0x4f49('0x73')},{'model':db[_0x5c5d2+_0x4cfb48],'as':_0x4f49('0x74')}]});})['then'](function(_0x1979ef){if(_[_0x4f49('0x12')](_0x1979ef)){throw new Error(_0x5c5d2+_0x4f49('0x75'));}_0x20a0d4=_0x1979ef;return _0x1979ef[_0x4f49('0x84')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x225e63={'uniqueid':_0x57567a+'.'+_0x20a0d4['id']+'.'+_0x20a0d4[_0x4f49('0x73')]['id'],'FromUserId':_0x24b033['user']['id'],'type':_0x4f49('0x7b'),'ToUserId':_0x2ec42b['id']};_0x225e63[_0x5c5d2+'MessageId']=_0x20a0d4['id'];_0x225e63[_0x5c5d2+_0x4f49('0x85')]=_0x20a0d4[_0x4f49('0x73')]['id'];_0x225e63[_0x4f49('0x86')+_0x5c5d2+_0x4cfb48+'Id']=_0x20a0d4[_0x4f49('0x74')]['id'];return db[_0x5c5d2+_0x4f49('0x78')][_0x4f49('0x79')](_0x225e63);})[_0x4f49('0xa')](function(){return respondWithRpcPromise(_0x4f49('0x7a'),{'channel':_0x57567a,'interaction':_0x20a0d4[_0x4f49('0x73')],'message':_0x20a0d4,'account':_0x20a0d4[_0x4f49('0x74')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x2ec42b['name']+','+(_0x20a0d4[_0x4f49('0x74')]['agentTransferTimeout']||0x12c),'interval':_0x4f49('0x7d')}]},routingClient);})[_0x4f49('0xa')](respondWithResult(_0x55b28b,null))['catch'](handleError(_0x55b28b,null));}; \ No newline at end of file +var _0x8ef6=['name','send','isNil','find','rows','VoiceChannels','voiceChannelMixMonitor','VoiceChannelMixMonitor','query','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','interface','SIP/%s','INTERACTION','agent','internal','AgentCapacity','telephones','trunks','Trunks','campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','queue_id','value','filter','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','User','Agent\x20not\x20found','TransferReport','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','catch','status','sendStatus','stack'];(function(_0x45c60e,_0x49c1eb){var _0x359d9e=function(_0x18308f){while(--_0x18308f){_0x45c60e['push'](_0x45c60e['shift']());}};_0x359d9e(++_0x49c1eb);}(_0x8ef6,0xf2));var _0x68ef=function(_0x527385,_0x21401b){_0x527385=_0x527385-0x0;var _0x5926d8=_0x8ef6[_0x527385];return _0x5926d8;};'use strict';var BPromise=require(_0x68ef('0x0'));var moment=require(_0x68ef('0x1'));var _=require(_0x68ef('0x2'));var util=require(_0x68ef('0x3'));var db=require(_0x68ef('0x4'))['db'];var logger=require(_0x68ef('0x5'))(_0x68ef('0x6'));var jayson=require('jayson/promise');var amiClient=jayson[_0x68ef('0x7')][_0x68ef('0x8')]({'port':0x232a});var mailClient=jayson[_0x68ef('0x7')][_0x68ef('0x8')]({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){var _0x31007e=_0x2de776?_0x2de776:amiClient;return _0x31007e[_0x68ef('0x9')](_0x3c2ff3,_0x4740e8)[_0x68ef('0xa')](function(_0x112b18){if(_0x112b18[_0x68ef('0xb')]){if(_0x112b18[_0x68ef('0xb')][_0x68ef('0xc')]===0x1f4){return _0x228967(_0x112b18[_0x68ef('0xb')][_0x68ef('0xd')]);}return _0x4eb5eb(_0x112b18[_0x68ef('0xb')][_0x68ef('0xd')]);}else{_0x4eb5eb(_0x112b18['result']);}})[_0x68ef('0xe')](function(_0x46356f){_0x228967(_0x46356f);});});}function respondWithResult(_0x1e117a,_0x454ef4){_0x454ef4=_0x454ef4||0xc8;return function(_0x40f253){if(_0x40f253){return _0x1e117a[_0x68ef('0xf')](_0x454ef4)['json'](_0x40f253);}return _0x1e117a[_0x68ef('0x10')](0x194);};}function handleError(_0xc50cce,_0x2657c5){_0x2657c5=_0x2657c5||0x1f4;return function(_0x47fbb5){logger[_0x68ef('0xb')](_0x47fbb5[_0x68ef('0x11')]);if(_0x47fbb5[_0x68ef('0x12')]){delete _0x47fbb5['name'];}_0xc50cce[_0x68ef('0xf')](_0x2657c5)[_0x68ef('0x13')](_0x47fbb5);};}function findById(_0x3d1e90){return function(_0x3780a4){if(!_['isNil'](_0x3d1e90)&&!_[_0x68ef('0x14')](_0x3780a4)&&!_['isNil'](_0x3780a4['rows'])){return _[_0x68ef('0x15')](_0x3780a4[_0x68ef('0x16')],function(_0x4ade0d){return _0x4ade0d['id']==_0x3d1e90;});}return null;};}exports['voiceChannels']=function(_0x3c4c1f,_0x2cd92c){return respondWithRpcPromise(_0x68ef('0x17'),_0x3c4c1f['query'])[_0x68ef('0xa')](respondWithResult(_0x2cd92c,null))[_0x68ef('0xe')](handleError(_0x2cd92c,null));};exports[_0x68ef('0x18')]=function(_0x5b246b,_0x3c46d4){return respondWithRpcPromise(_0x68ef('0x19'),_['merge'](_0x5b246b[_0x68ef('0x1a')],_0x5b246b[_0x68ef('0x1b')]))[_0x68ef('0xa')](respondWithResult(_0x3c46d4,null))['catch'](handleError(_0x3c46d4,null));};exports['voiceChannelStopMixMonitor']=function(_0x59bebc,_0x26018d){return respondWithRpcPromise(_0x68ef('0x1c'),_[_0x68ef('0x1d')](_0x59bebc[_0x68ef('0x1a')],_0x59bebc[_0x68ef('0x1b')]))[_0x68ef('0xa')](respondWithResult(_0x26018d,null))[_0x68ef('0xe')](handleError(_0x26018d,null));};exports[_0x68ef('0x1e')]=function(_0x65fd09,_0x13280b){return respondWithRpcPromise('VoiceQueues',_0x65fd09[_0x68ef('0x1a')])['then'](respondWithResult(_0x13280b,null))['catch'](handleError(_0x13280b,null));};exports['showVoiceQueues']=function(_0x1a7ce1,_0x268f32){return respondWithRpcPromise(_0x68ef('0x1f'),_0x1a7ce1[_0x68ef('0x1a')])['then'](findById(_0x1a7ce1['params']['id']))[_0x68ef('0xa')](respondWithResult(_0x268f32,null))[_0x68ef('0xe')](handleError(_0x268f32,null));};exports[_0x68ef('0x20')]=function(_0x263b30,_0x22ef25){return respondWithRpcPromise(_0x68ef('0x21'),_[_0x68ef('0x1d')](_0x263b30[_0x68ef('0x22')],_0x263b30['params']))[_0x68ef('0xa')](respondWithResult(_0x22ef25,null))[_0x68ef('0xe')](handleError(_0x22ef25,null));};exports[_0x68ef('0x23')]=function(_0x4c25aa,_0x370a8f){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x68ef('0x1d')](_0x4c25aa[_0x68ef('0x1a')],_0x4c25aa['params']))['then'](respondWithResult(_0x370a8f,null))[_0x68ef('0xe')](handleError(_0x370a8f,null));};exports[_0x68ef('0x24')]=function(_0x4b8fc8,_0xf58fa1){return respondWithRpcPromise(_0x68ef('0x25'),_0x4b8fc8[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0xf58fa1,null))['catch'](handleError(_0xf58fa1,null));};exports[_0x68ef('0x26')]=function(_0x1d69ac,_0x5f137b){return respondWithRpcPromise(_0x68ef('0x27'),_['merge'](_0x1d69ac[_0x68ef('0x1a')],_0x1d69ac[_0x68ef('0x1b')]))['then'](respondWithResult(_0x5f137b,null))[_0x68ef('0xe')](handleError(_0x5f137b,null));};exports['voiceQueuesChannelHangup']=function(_0x38c2f8,_0x575f43){return respondWithRpcPromise(_0x68ef('0x28'),_[_0x68ef('0x1d')](_0x38c2f8[_0x68ef('0x1a')],_0x38c2f8['params']))[_0x68ef('0xa')](respondWithResult(_0x575f43,null))['catch'](handleError(_0x575f43,null));};exports[_0x68ef('0x29')]=function(_0x4c9506,_0x474ffa){return respondWithRpcPromise(_0x68ef('0x2a'),_[_0x68ef('0x1d')](_0x4c9506[_0x68ef('0x1a')],_0x4c9506[_0x68ef('0x1b')]))[_0x68ef('0xa')](respondWithResult(_0x474ffa,null))['catch'](handleError(_0x474ffa,null));};exports[_0x68ef('0x2b')]=function(_0x15a6ab,_0x32074a){return respondWithRpcPromise('Outbound',_0x15a6ab[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0x32074a,null))[_0x68ef('0xe')](handleError(_0x32074a,null));};exports['outboundChannels']=function(_0x49f260,_0x14f0fc){return respondWithRpcPromise(_0x68ef('0x2c'),_0x49f260[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0x14f0fc,null))[_0x68ef('0xe')](handleError(_0x14f0fc,null));};exports[_0x68ef('0x2d')]=function(_0x41ffe0,_0x5b1246){var _0xaf7df1;return respondWithRpcPromise(_0x68ef('0x2e'),_0x41ffe0[_0x68ef('0x1a')])[_0x68ef('0xa')](function(_0x492b74){_0xaf7df1=_0x492b74;return respondWithRpcPromise(_0x68ef('0x2e'),_0x41ffe0[_0x68ef('0x1a')],routingClient);})[_0x68ef('0xa')](function(_0x410c10){return _[_0x68ef('0x1d')]({},_0x410c10,_0xaf7df1);})[_0x68ef('0xa')](respondWithResult(_0x5b1246,null))['catch'](handleError(_0x5b1246,null));};exports[_0x68ef('0x2f')]=function(_0x3f7699,_0xf5010c){if(_0x3f7699[_0x68ef('0x22')]&&_0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')]&&_0x3f7699[_0x68ef('0x31')]&&_0x3f7699[_0x68ef('0x31')][_0x68ef('0x12')]){for(var _0x531096 in _0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')]){if(_0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')][_0x68ef('0x32')](_0x531096)){db[_0x68ef('0x33')][_0x68ef('0x34')]({'where':{'channel':_0x531096,'membername':_0x3f7699['user'][_0x68ef('0x12')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')][_0x531096]&&_0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')][_0x531096]['length']?{'$notIn':_0x3f7699[_0x68ef('0x22')]['interaction'][_0x531096]}:{'$ne':null}}})[_0x68ef('0xa')](function(_0x499423){var _0x227e36=moment()[_0x68ef('0x35')](_0x68ef('0x36'));for(var _0x5c4a66=0x0,_0x59b148=_0x499423[_0x68ef('0x37')];_0x5c4a66<_0x59b148;_0x5c4a66+=0x1){_0x499423[_0x5c4a66][_0x68ef('0x38')]({'exitAt':_0x227e36});}});for(var _0x58d72a=0x0;_0x58d72a<_0x3f7699['body']['interaction'][_0x531096][_0x68ef('0x37')];_0x58d72a+=0x1){db[_0x68ef('0x33')][_0x68ef('0x39')]({'where':{'channel':_0x531096,'membername':_0x3f7699[_0x68ef('0x31')][_0x68ef('0x12')],'type':'INTERACTION','uniqueid':_0x3f7699['body'][_0x68ef('0x30')][_0x531096][_0x58d72a],'exitAt':null},'defaults':{'channel':_0x531096,'membername':_0x3f7699[_0x68ef('0x31')][_0x68ef('0x12')],'interface':_[_0x68ef('0x14')](_0x3f7699['user'][_0x68ef('0x3a')])?util[_0x68ef('0x35')](_0x68ef('0x3b'),_0x3f7699[_0x68ef('0x31')]['name']):_0x3f7699['user'][_0x68ef('0x3a')],'type':_0x68ef('0x3c'),'enterAt':moment()['format'](_0x68ef('0x36')),'role':_0x68ef('0x3d'),'internal':_0x3f7699[_0x68ef('0x31')][_0x68ef('0x3e')],'uniqueid':_0x3f7699[_0x68ef('0x22')]['interaction'][_0x531096][_0x58d72a]}});}}}}return respondWithRpcPromise(_0x68ef('0x3f'),{'id':_0x3f7699[_0x68ef('0x1b')]['id'],'capacity':_0x3f7699[_0x68ef('0x22')]['capacity']},routingClient)[_0x68ef('0xa')](respondWithResult(_0xf5010c,null))[_0x68ef('0xe')](handleError(_0xf5010c,null));};exports[_0x68ef('0x40')]=function(_0x50ef1f,_0x7dce90){return respondWithRpcPromise('Telephones',_0x50ef1f['query'])[_0x68ef('0xa')](respondWithResult(_0x7dce90,null))['catch'](handleError(_0x7dce90,null));};exports[_0x68ef('0x41')]=function(_0xb33afd,_0x53ebd){return respondWithRpcPromise(_0x68ef('0x42'),_0xb33afd[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0x53ebd,null))[_0x68ef('0xe')](handleError(_0x53ebd,null));};exports[_0x68ef('0x43')]=function(_0x2b35f4,_0x247915){return respondWithRpcPromise('Campaigns',_0x2b35f4['query'])[_0x68ef('0xa')](respondWithResult(_0x247915,null))[_0x68ef('0xe')](handleError(_0x247915,null));};exports[_0x68ef('0x44')]=function(_0xdc83f4,_0x82df12){return respondWithRpcPromise(_0x68ef('0x45'),_0xdc83f4[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x82df12,null))[_0x68ef('0xe')](handleError(_0x82df12,null));};exports['showChatQueues']=function(_0x5685bb,_0x42a4b2){return respondWithRpcPromise('ChatQueues',_0x5685bb[_0x68ef('0x1a')],routingClient)['then'](findById(_0x5685bb[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x42a4b2,null))['catch'](handleError(_0x42a4b2,null));};exports[_0x68ef('0x46')]=function(_0x4e097e,_0x407c6d){return respondWithRpcPromise(_0x68ef('0x47'),_0x4e097e[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x407c6d,null))[_0x68ef('0xe')](handleError(_0x407c6d,null));};exports[_0x68ef('0x48')]=function(_0x5c347c,_0x1cdaef){return respondWithRpcPromise(_0x68ef('0x47'),_0x5c347c[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](findById(_0x5c347c[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x1cdaef,null))['catch'](handleError(_0x1cdaef,null));};exports[_0x68ef('0x49')]=function(_0x42d2a3,_0x4886af){return respondWithRpcPromise(_0x68ef('0x4a'),_0x42d2a3[_0x68ef('0x1a')],mailClient)[_0x68ef('0xa')](respondWithResult(_0x4886af,null))['catch'](handleError(_0x4886af,null));};exports[_0x68ef('0x4b')]=function(_0x49d197,_0x5412ea){return respondWithRpcPromise(_0x68ef('0x4c'),_0x49d197['query'],routingClient)[_0x68ef('0xa')](respondWithResult(_0x5412ea,null))['catch'](handleError(_0x5412ea,null));};exports[_0x68ef('0x4d')]=function(_0x9e8554,_0x304405){return respondWithRpcPromise(_0x68ef('0x4c'),_0x9e8554[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](findById(_0x9e8554['params']['id']))[_0x68ef('0xa')](respondWithResult(_0x304405,null))['catch'](handleError(_0x304405,null));};exports[_0x68ef('0x4e')]=function(_0x4b0c3e,_0x2f97c5){return respondWithRpcPromise(_0x68ef('0x4f'),_0x4b0c3e[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x2f97c5,null))[_0x68ef('0xe')](handleError(_0x2f97c5,null));};exports[_0x68ef('0x50')]=function(_0x1be626,_0x52d29a){return respondWithRpcPromise(_0x68ef('0x4f'),_0x1be626[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](findById(_0x1be626[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x52d29a,null))['catch'](handleError(_0x52d29a,null));};exports[_0x68ef('0x51')]=function(_0x561e8d,_0x1ed172){return respondWithRpcPromise('WhatsappQueues',_0x561e8d['query'],routingClient)[_0x68ef('0xa')](respondWithResult(_0x1ed172,null))[_0x68ef('0xe')](handleError(_0x1ed172,null));};exports[_0x68ef('0x52')]=function(_0x21b2ce,_0x51f905){return respondWithRpcPromise(_0x68ef('0x53'),_0x21b2ce['query'],routingClient)[_0x68ef('0xa')](findById(_0x21b2ce[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x51f905,null))['catch'](handleError(_0x51f905,null));};exports['faxQueues']=function(_0x3e74d2,_0x1092f8){return respondWithRpcPromise(_0x68ef('0x54'),_0x3e74d2[_0x68ef('0x1a')],routingClient)['then'](respondWithResult(_0x1092f8,null))[_0x68ef('0xe')](handleError(_0x1092f8,null));};exports[_0x68ef('0x55')]=function(_0x19c20f,_0x21b104){return respondWithRpcPromise('FaxQueues',_0x19c20f[_0x68ef('0x1a')],routingClient)['then'](findById(_0x19c20f[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x21b104,null))[_0x68ef('0xe')](handleError(_0x21b104,null));};exports[_0x68ef('0x56')]=function(_0xed16d1,_0x52cb2a){return respondWithRpcPromise(_0x68ef('0x57'),_0xed16d1[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0x52cb2a,null))['catch'](handleError(_0x52cb2a,null));};exports[_0x68ef('0x58')]=function(_0x4de108,_0x69b1c){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x4de108['query'],routingClient)[_0x68ef('0xa')](respondWithResult(_0x69b1c,null))[_0x68ef('0xe')](handleError(_0x69b1c,null));};exports[_0x68ef('0x59')]=function(_0x405971,_0x501004){return respondWithRpcPromise(_0x68ef('0x5a'),_0x405971[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x501004,null))['catch'](handleError(_0x501004,null));};exports[_0x68ef('0x5b')]=function(_0x2db826,_0xea2a81){return respondWithRpcPromise(_0x68ef('0x5c'),_0x2db826[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0xea2a81,null))[_0x68ef('0xe')](handleError(_0xea2a81,null));};exports[_0x68ef('0x5d')]=function(_0x156ce3,_0x11feff){return respondWithRpcPromise(_0x68ef('0x5c'),_0x156ce3[_0x68ef('0x1a')],routingClient)['then'](function(_0x15378c){if(_0x156ce3[_0x68ef('0x1a')]['type']!==undefined){var _0x513c69=_(_0x15378c[_0x68ef('0x16')])['filter']([_0x156ce3[_0x68ef('0x1a')][_0x68ef('0x5e')],_0x156ce3['params']['id']])['map'](_0x68ef('0x5f'))['uniq']()[_0x68ef('0x60')]();return _0x15378c['rows'][_0x68ef('0x61')](function(_0x4f425f){return _0x513c69[_0x68ef('0x62')](_0x4f425f[_0x68ef('0x5f')])>-0x1;});}else{return _0x15378c['rows'][_0x68ef('0x61')](function(_0x357be7){return _0x357be7[_0x68ef('0x5f')]===parseInt(_0x156ce3[_0x68ef('0x1b')]['id']);});}})['then'](respondWithResult(_0x11feff,null))[_0x68ef('0xe')](handleError(_0x11feff,null));};exports[_0x68ef('0x63')]=function(_0x5b2e89,_0x3bb3b6){return respondWithRpcPromise(_0x68ef('0x64'),_0x5b2e89[_0x68ef('0x1a')],routingClient)['then'](respondWithResult(_0x3bb3b6,null))[_0x68ef('0xe')](handleError(_0x3bb3b6,null));};exports['whatsappQueuesWaitingInteractions']=function(_0xe6bf05,_0x36c109){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0xe6bf05['query'],routingClient)['then'](respondWithResult(_0x36c109,null))['catch'](handleError(_0x36c109,null));};exports[_0x68ef('0x65')]=function(_0x28ad22,_0x1217f9){return respondWithRpcPromise(_0x68ef('0x66'),_0x28ad22[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x1217f9,null))[_0x68ef('0xe')](handleError(_0x1217f9,null));};exports[_0x68ef('0x67')]=function(_0x24ba34){return function(_0x3ae3e9,_0x17892c){var _0x108223,_0x717d7b;var _0x4bd5c3=_[_0x68ef('0x68')](_0x24ba34);var _0x556dfc=_0x24ba34===_0x68ef('0x69')?'Website':'Account';return db[_0x4bd5c3+_0x68ef('0x6a')][_0x68ef('0x6b')]({'raw':!![],'where':{'id':_0x3ae3e9[_0x68ef('0x1b')]['id']}})[_0x68ef('0xa')](function(_0x518c9a){if(_['isNil'](_0x518c9a)){throw new Error(_0x4bd5c3+_0x68ef('0x6c'));}_0x108223=_0x518c9a;return db[_0x4bd5c3+_0x68ef('0x6d')][_0x68ef('0x6b')]({'where':{'id':_0x3ae3e9['body'][_0x68ef('0x6e')]},'include':[{'model':db[_0x4bd5c3+_0x68ef('0x6f')],'as':_0x68ef('0x6f')},{'model':db[_0x4bd5c3+_0x556dfc],'as':_0x68ef('0x70')}]});})['then'](function(_0x214e89){if(_[_0x68ef('0x14')](_0x214e89)){throw new Error(_0x4bd5c3+_0x68ef('0x71'));}_0x717d7b=_0x214e89;return _0x214e89[_0x68ef('0x72')]({'read':0x0,'readAt':null,'UserId':null});})[_0x68ef('0xa')](function(){var _0x346049={'uniqueid':_0x24ba34+'.'+_0x717d7b['id']+'.'+_0x717d7b['Interaction']['id'],'FromUserId':_0x3ae3e9[_0x68ef('0x31')]['id'],'type':'queue'};_0x346049[_0x4bd5c3+_0x68ef('0x73')]=_0x717d7b['id'];_0x346049[_0x4bd5c3+_0x68ef('0x74')]=_0x717d7b[_0x68ef('0x6f')]['id'];_0x346049[_0x68ef('0x75')+_0x4bd5c3+_0x556dfc+'Id']=_0x717d7b['Account']['id'];_0x346049['To'+_0x4bd5c3+_0x68ef('0x76')]=_0x108223['id'];return db[_0x4bd5c3+'TransferReport'][_0x68ef('0x77')](_0x346049);})[_0x68ef('0xa')](function(){return respondWithRpcPromise('Start',{'channel':_0x24ba34,'interaction':_0x717d7b['Interaction'],'message':_0x717d7b,'account':_0x717d7b[_0x68ef('0x70')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x108223[_0x68ef('0x12')]+','+(_0x717d7b['Account'][_0x68ef('0x78')]||0x12c),'interval':_0x68ef('0x79')}]},routingClient);})[_0x68ef('0xa')](respondWithResult(_0x17892c,null))[_0x68ef('0xe')](handleError(_0x17892c,null));};};exports[_0x68ef('0x7a')]=function(_0x66a7a8,_0x51b8db){var _0x17d014,_0x463356;if(_[_0x68ef('0x14')](_0x66a7a8[_0x68ef('0x22')][_0x68ef('0x7b')])){throw new Error(_0x68ef('0x7c'));}var _0x303add=_0x66a7a8['body'][_0x68ef('0x7b')];var _0x373ab4=_[_0x68ef('0x68')](_0x303add);var _0x2e20aa=_0x303add===_0x68ef('0x69')?_0x68ef('0x7d'):_0x68ef('0x70');return db[_0x68ef('0x7e')][_0x68ef('0x6b')]({'raw':!![],'where':{'id':_0x66a7a8['params']['id'],'role':_0x68ef('0x3d')}})['then'](function(_0x5f3b79){if(_['isNil'](_0x5f3b79)){throw new Error(_0x68ef('0x7f'));}_0x17d014=_0x5f3b79;return db[_0x373ab4+_0x68ef('0x6d')][_0x68ef('0x6b')]({'where':{'id':_0x66a7a8['body']['messageId']},'include':[{'model':db[_0x373ab4+'Interaction'],'as':_0x68ef('0x6f')},{'model':db[_0x373ab4+_0x2e20aa],'as':_0x68ef('0x70')}]});})[_0x68ef('0xa')](function(_0x40996e){if(_[_0x68ef('0x14')](_0x40996e)){throw new Error(_0x373ab4+_0x68ef('0x71'));}_0x463356=_0x40996e;return _0x40996e['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x68ef('0xa')](function(){var _0x2c7f18={'uniqueid':_0x303add+'.'+_0x463356['id']+'.'+_0x463356[_0x68ef('0x6f')]['id'],'FromUserId':_0x66a7a8[_0x68ef('0x31')]['id'],'type':'queue','ToUserId':_0x17d014['id']};_0x2c7f18[_0x373ab4+_0x68ef('0x73')]=_0x463356['id'];_0x2c7f18[_0x373ab4+_0x68ef('0x74')]=_0x463356[_0x68ef('0x6f')]['id'];_0x2c7f18[_0x68ef('0x75')+_0x373ab4+_0x2e20aa+'Id']=_0x463356[_0x68ef('0x70')]['id'];return db[_0x373ab4+_0x68ef('0x80')][_0x68ef('0x77')](_0x2c7f18);})[_0x68ef('0xa')](function(){return respondWithRpcPromise('Start',{'channel':_0x303add,'interaction':_0x463356[_0x68ef('0x6f')],'message':_0x463356,'account':_0x463356[_0x68ef('0x70')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x17d014[_0x68ef('0x12')]+','+(_0x463356[_0x68ef('0x70')][_0x68ef('0x81')]||0x12c),'interval':_0x68ef('0x79')}]},routingClient);})[_0x68ef('0xa')](respondWithResult(_0x51b8db,null))[_0x68ef('0xe')](handleError(_0x51b8db,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 1193955..e45f717 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 _0x2e3f=['path','connect-timeout','express','Router','fs-extra','../../config/environment','isAuthenticated','index','run','post','create','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x192491,_0x161fe8){var _0x2f208a=function(_0x308769){while(--_0x308769){_0x192491['push'](_0x192491['shift']());}};_0x2f208a(++_0x161fe8);}(_0x2e3f,0x96));var _0xf2e3=function(_0x51c529,_0x29e1b9){_0x51c529=_0x51c529-0x0;var _0x568d73=_0x2e3f[_0x51c529];return _0x568d73;};'use strict';var multer=require(_0xf2e3('0x0'));var util=require(_0xf2e3('0x1'));var path=require(_0xf2e3('0x2'));var timeout=require(_0xf2e3('0x3'));var express=require(_0xf2e3('0x4'));var router=express[_0xf2e3('0x5')]();var fs_extra=require(_0xf2e3('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf2e3('0x7'));var controller=require('./schedule.controller');router['get']('/',auth[_0xf2e3('0x8')](),controller[_0xf2e3('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/run',auth[_0xf2e3('0x8')](),controller[_0xf2e3('0xa')]);router[_0xf2e3('0xb')]('/',auth[_0xf2e3('0x8')](),controller[_0xf2e3('0xc')]);router[_0xf2e3('0xd')](_0xf2e3('0xe'),auth[_0xf2e3('0x8')](),controller[_0xf2e3('0xf')]);router[_0xf2e3('0x10')](_0xf2e3('0xe'),auth['isAuthenticated'](),controller[_0xf2e3('0x11')]);module[_0xf2e3('0x12')]=router; \ No newline at end of file +var _0x9019=['isAuthenticated','get','/:id','run','post','create','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller'];(function(_0x3692c4,_0xbb777f){var _0x21b1c5=function(_0x5ee6a2){while(--_0x5ee6a2){_0x3692c4['push'](_0x3692c4['shift']());}};_0x21b1c5(++_0xbb777f);}(_0x9019,0x173));var _0x9901=function(_0x6c59fc,_0x5fe88d){_0x6c59fc=_0x6c59fc-0x0;var _0x17c96f=_0x9019[_0x6c59fc];return _0x17c96f;};'use strict';var multer=require(_0x9901('0x0'));var util=require(_0x9901('0x1'));var path=require(_0x9901('0x2'));var timeout=require('connect-timeout');var express=require(_0x9901('0x3'));var router=express['Router']();var fs_extra=require(_0x9901('0x4'));var auth=require(_0x9901('0x5'));var interaction=require(_0x9901('0x6'));var config=require(_0x9901('0x7'));var controller=require(_0x9901('0x8'));router['get']('/',auth[_0x9901('0x9')](),controller['index']);router[_0x9901('0xa')](_0x9901('0xb'),auth[_0x9901('0x9')](),controller['show']);router[_0x9901('0xa')]('/:id/run',auth['isAuthenticated'](),controller[_0x9901('0xc')]);router[_0x9901('0xd')]('/',auth[_0x9901('0x9')](),controller[_0x9901('0xe')]);router[_0x9901('0xf')](_0x9901('0xb'),auth['isAuthenticated'](),controller[_0x9901('0x10')]);router[_0x9901('0x11')](_0x9901('0xb'),auth['isAuthenticated'](),controller[_0x9901('0x12')]);module[_0x9901('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index ddeb227..ac280f8 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 _0x08ef=['csv','pdf','xlsx','custom','TEXT','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','hours','minutes'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x08ef,0x149));var _0xf08e=function(_0x2dcaf5,_0x32998a){_0x2dcaf5=_0x2dcaf5-0x0;var _0x2ab3be=_0x08ef[_0x2dcaf5];return _0x2ab3be;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf08e('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xf08e('0x0')]},'active':{'type':Sequelize[_0xf08e('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xf08e('0x0')],'allowNull':![],'defaultValue':_0xf08e('0x2')},'startAt':{'type':Sequelize[_0xf08e('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0xf08e('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xf08e('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xf08e('0x5')](_0xf08e('0x6'),_0xf08e('0x7'),_0xf08e('0x8'),_0xf08e('0x9'),_0xf08e('0xa'),_0xf08e('0xb'),_0xf08e('0xc')),'allowNull':![],'defaultValue':_0xf08e('0xa')},'output':{'type':Sequelize[_0xf08e('0x5')](_0xf08e('0xd'),_0xf08e('0xe'),_0xf08e('0xf')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xf08e('0x5')](_0xf08e('0x10'),'default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xf08e('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0xf08e('0x0')]},'cc':{'type':Sequelize[_0xf08e('0x11')]},'bcc':{'type':Sequelize[_0xf08e('0x11')]},'sendIfEmpty':{'type':Sequelize[_0xf08e('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x296b=['0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','months','weeks','days','hours','minutes','xlsx','csv','custom','default','BOOLEAN','TEXT','sequelize','exports','STRING'];(function(_0x13d929,_0x28fa20){var _0x3b3f24=function(_0x44de8e){while(--_0x44de8e){_0x13d929['push'](_0x13d929['shift']());}};_0x3b3f24(++_0x28fa20);}(_0x296b,0xa8));var _0xb296=function(_0x4df6f9,_0x44bd65){_0x4df6f9=_0x4df6f9-0x0;var _0x4b1a73=_0x296b[_0x4df6f9];return _0x4b1a73;};'use strict';var Sequelize=require(_0xb296('0x0'));module[_0xb296('0x1')]={'name':{'type':Sequelize[_0xb296('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb296('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xb296('0x2')],'allowNull':![],'defaultValue':_0xb296('0x3')},'startAt':{'type':Sequelize[_0xb296('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xb296('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xb296('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xb296('0x6')]('years',_0xb296('0x7'),_0xb296('0x8'),_0xb296('0x9'),_0xb296('0xa'),_0xb296('0xb'),_0xb296('0xc')),'allowNull':![],'defaultValue':_0xb296('0xa')},'output':{'type':Sequelize['ENUM']('csv','pdf',_0xb296('0xd')),'allowNull':![],'defaultValue':_0xb296('0xe')},'type':{'type':Sequelize['ENUM'](_0xb296('0xf'),_0xb296('0x10')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xb296('0x11')],'defaultValue':![]},'email':{'type':Sequelize[_0xb296('0x2')]},'cc':{'type':Sequelize[_0xb296('0x12')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 4eea756..fe781bb 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 _0x26f3=['role','user','Scheduler','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','index','Schedule','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x26f3,0x10d));var _0x326f=function(_0x4fa291,_0x56e289){_0x4fa291=_0x4fa291-0x0;var _0x506d9b=_0x26f3[_0x4fa291];return _0x506d9b;};'use strict';var emlformat=require(_0x326f('0x0'));var rimraf=require(_0x326f('0x1'));var zipdir=require(_0x326f('0x2'));var jsonpatch=require(_0x326f('0x3'));var rp=require('request-promise');var moment=require(_0x326f('0x4'));var BPromise=require(_0x326f('0x5'));var Mustache=require(_0x326f('0x6'));var util=require(_0x326f('0x7'));var path=require(_0x326f('0x8'));var sox=require(_0x326f('0x9'));var csv=require('to-csv');var ejs=require(_0x326f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x326f('0xb'));var squel=require(_0x326f('0xc'));var crypto=require('crypto');var jsforce=require(_0x326f('0xd'));var deskjs=require(_0x326f('0xe'));var toCsv=require(_0x326f('0xf'));var querystring=require(_0x326f('0x10'));var Papa=require(_0x326f('0x11'));var Redis=require(_0x326f('0x12'));var authService=require(_0x326f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x326f('0x14'));var hardwareService=require(_0x326f('0x15'));var logger=require(_0x326f('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x326f('0x17'));var licenseUtil=require(_0x326f('0x18'));var db=require(_0x326f('0x19'))['db'];function respondWithStatusCode(_0x144492,_0x4efe90){_0x4efe90=_0x4efe90||0xcc;return function(_0x136dcc){if(_0x136dcc){return _0x144492[_0x326f('0x1a')](_0x4efe90);}return _0x144492[_0x326f('0x1b')](_0x4efe90)[_0x326f('0x1c')]();};}function respondWithResult(_0x4f171b,_0x33ea44){_0x33ea44=_0x33ea44||0xc8;return function(_0x7cd979){if(_0x7cd979){return _0x4f171b[_0x326f('0x1b')](_0x33ea44)[_0x326f('0x1d')](_0x7cd979);}};}function respondWithFilteredResult(_0x1b7ea8,_0x25cf77){return function(_0x1af30f){if(_0x1af30f){var _0xf392fb=typeof _0x25cf77[_0x326f('0x1e')]===_0x326f('0x1f')&&typeof _0x25cf77[_0x326f('0x20')]==='undefined';var _0x11cc29=_0x1af30f[_0x326f('0x21')];var _0x25697e=_0xf392fb?0x0:_0x25cf77[_0x326f('0x1e')];var _0xdb67=_0xf392fb?_0x1af30f[_0x326f('0x21')]:_0x25cf77[_0x326f('0x1e')]+_0x25cf77['limit'];var _0x1f89e7;if(_0xdb67>=_0x11cc29){_0xdb67=_0x11cc29;_0x1f89e7=0xc8;}else{_0x1f89e7=0xce;}_0x1b7ea8[_0x326f('0x1b')](_0x1f89e7);return _0x1b7ea8[_0x326f('0x22')](_0x326f('0x23'),_0x25697e+'-'+_0xdb67+'/'+_0x11cc29)[_0x326f('0x1d')](_0x1af30f);}return null;};}function patchUpdates(_0x15aef5){return function(_0x5d9708){try{jsonpatch[_0x326f('0x24')](_0x5d9708,_0x15aef5,!![]);}catch(_0x478d39){return BPromise[_0x326f('0x25')](_0x478d39);}return _0x5d9708[_0x326f('0x26')]();};}function saveUpdates(_0x446f0a,_0x4e11a1){return function(_0x45dc76){if(_0x45dc76){return _0x45dc76[_0x326f('0x27')](_0x446f0a)['then'](function(_0x53b9b5){return _0x53b9b5;});}return null;};}function removeEntity(_0x22306c,_0x35c1c7){return function(_0x46129a){if(_0x46129a){return _0x46129a[_0x326f('0x28')]()[_0x326f('0x29')](function(){var _0x1e5c3c=_0x46129a[_0x326f('0x2a')]({'plain':!![]});var _0x3be990='Scheduler';return db[_0x326f('0x2b')][_0x326f('0x28')]({'where':{'type':_0x3be990,'resourceId':_0x1e5c3c['id']}})[_0x326f('0x29')](function(){return _0x46129a;});})['then'](function(){_0x22306c['status'](0xcc)[_0x326f('0x1c')]();});}};}function handleEntityNotFound(_0x5dca5a,_0xc28d83){return function(_0x195fd4){if(!_0x195fd4){_0x5dca5a['sendStatus'](0x194);}return _0x195fd4;};}function handleError(_0x105239,_0xab7039){_0xab7039=_0xab7039||0x1f4;return function(_0x4c4211){logger[_0x326f('0x2c')](_0x4c4211[_0x326f('0x2d')]);if(_0x4c4211[_0x326f('0x2e')]){delete _0x4c4211[_0x326f('0x2e')];}_0x105239[_0x326f('0x1b')](_0xab7039)['send'](_0x4c4211);};}exports[_0x326f('0x2f')]=function(_0x33c9a0,_0x36e1f4){var _0x33f200={},_0x1809d3={},_0x40e7d3={'count':0x0,'rows':[]};var _0x39aa98=_['map'](db[_0x326f('0x30')][_0x326f('0x31')],function(_0x2ee919){return{'name':_0x2ee919[_0x326f('0x32')],'type':_0x2ee919[_0x326f('0x33')][_0x326f('0x34')]};});_0x1809d3[_0x326f('0x35')]=_[_0x326f('0x36')](_0x39aa98,_0x326f('0x2e'));_0x1809d3['query']=_[_0x326f('0x37')](_0x33c9a0[_0x326f('0x38')]);_0x1809d3[_0x326f('0x39')]=_[_0x326f('0x3a')](_0x1809d3[_0x326f('0x35')],_0x1809d3[_0x326f('0x38')]);_0x33f200[_0x326f('0x3b')]=_[_0x326f('0x3a')](_0x1809d3[_0x326f('0x35')],qs[_0x326f('0x3c')](_0x33c9a0[_0x326f('0x38')][_0x326f('0x3c')]));_0x33f200[_0x326f('0x3b')]=_0x33f200[_0x326f('0x3b')][_0x326f('0x3d')]?_0x33f200[_0x326f('0x3b')]:_0x1809d3[_0x326f('0x35')];if(!_0x33c9a0[_0x326f('0x38')]['hasOwnProperty'](_0x326f('0x3e'))){_0x33f200[_0x326f('0x20')]=qs[_0x326f('0x20')](_0x33c9a0[_0x326f('0x38')][_0x326f('0x20')]);_0x33f200[_0x326f('0x1e')]=qs[_0x326f('0x1e')](_0x33c9a0[_0x326f('0x38')]['offset']);}_0x33f200['order']=qs[_0x326f('0x3f')](_0x33c9a0[_0x326f('0x38')][_0x326f('0x3f')]);_0x33f200[_0x326f('0x40')]=qs[_0x326f('0x39')](_['pick'](_0x33c9a0[_0x326f('0x38')],_0x1809d3[_0x326f('0x39')]),_0x39aa98);if(_0x33c9a0[_0x326f('0x38')][_0x326f('0x41')]){_0x33f200[_0x326f('0x40')]=_[_0x326f('0x42')](_0x33f200[_0x326f('0x40')],{'$or':_['map'](_0x39aa98,function(_0x336897){if(_0x336897[_0x326f('0x33')]!==_0x326f('0x43')){var _0x20fde5={};_0x20fde5[_0x336897['name']]={'$like':'%'+_0x33c9a0[_0x326f('0x38')][_0x326f('0x41')]+'%'};return _0x20fde5;}})});}_0x33f200=_[_0x326f('0x42')]({},_0x33f200,_0x33c9a0[_0x326f('0x44')]);var _0x2e42cc={'where':_0x33f200[_0x326f('0x40')]};return db['Schedule'][_0x326f('0x21')](_0x2e42cc)['then'](function(_0x468c16){_0x40e7d3[_0x326f('0x21')]=_0x468c16;if(_0x33c9a0[_0x326f('0x38')][_0x326f('0x45')]){_0x33f200[_0x326f('0x46')]=[{'all':!![]}];}return db[_0x326f('0x30')]['findAll'](_0x33f200);})[_0x326f('0x29')](function(_0x3a79fa){_0x40e7d3[_0x326f('0x47')]=_0x3a79fa;return _0x40e7d3;})['then'](respondWithFilteredResult(_0x36e1f4,_0x33f200))[_0x326f('0x48')](handleError(_0x36e1f4,null));};exports[_0x326f('0x49')]=function(_0x552ae7,_0x212671){var _0x1bb88d={'raw':![],'where':{'id':_0x552ae7[_0x326f('0x4a')]['id']}},_0x65cc50={};_0x65cc50[_0x326f('0x35')]=_['keys'](db[_0x326f('0x30')]['rawAttributes']);_0x65cc50[_0x326f('0x38')]=_[_0x326f('0x37')](_0x552ae7[_0x326f('0x38')]);_0x65cc50['filters']=_[_0x326f('0x3a')](_0x65cc50[_0x326f('0x35')],_0x65cc50[_0x326f('0x38')]);_0x1bb88d['attributes']=_[_0x326f('0x3a')](_0x65cc50[_0x326f('0x35')],qs[_0x326f('0x3c')](_0x552ae7['query'][_0x326f('0x3c')]));_0x1bb88d['attributes']=_0x1bb88d[_0x326f('0x3b')][_0x326f('0x3d')]?_0x1bb88d[_0x326f('0x3b')]:_0x65cc50[_0x326f('0x35')];if(_0x552ae7[_0x326f('0x38')]['includeAll']){_0x1bb88d[_0x326f('0x46')]=[{'all':!![]}];}_0x1bb88d=_[_0x326f('0x42')]({},_0x1bb88d,_0x552ae7[_0x326f('0x44')]);return db['Schedule'][_0x326f('0x4b')](_0x1bb88d)['then'](handleEntityNotFound(_0x212671,null))['then'](respondWithResult(_0x212671,null))[_0x326f('0x48')](handleError(_0x212671,null));};exports['create']=function(_0x2830d3,_0x5ac972){return db['Schedule'][_0x326f('0x4c')](_0x2830d3[_0x326f('0x4d')],{})[_0x326f('0x29')](function(_0x1188e1){var _0x48a920=_0x2830d3['user'][_0x326f('0x2a')]({'plain':!![]});if(!_0x48a920)throw new Error(_0x326f('0x4e'));if(_0x48a920[_0x326f('0x4f')]===_0x326f('0x50')){var _0x5c6761=_0x1188e1[_0x326f('0x2a')]({'plain':!![]});var _0x4c2ae2=_0x326f('0x51');return db[_0x326f('0x52')][_0x326f('0x4b')]({'where':{'name':_0x4c2ae2,'userProfileId':_0x48a920[_0x326f('0x53')]},'raw':!![]})['then'](function(_0x4bdb84){if(_0x4bdb84&&_0x4bdb84['autoAssociation']===0x0){return db[_0x326f('0x2b')][_0x326f('0x4c')]({'name':_0x5c6761[_0x326f('0x2e')],'resourceId':_0x5c6761['id'],'type':_0x4bdb84[_0x326f('0x2e')],'sectionId':_0x4bdb84['id']},{})[_0x326f('0x29')](function(){return _0x1188e1;});}else{return _0x1188e1;}})[_0x326f('0x48')](function(_0x2dc9c6){logger[_0x326f('0x2c')](_0x326f('0x54'),_0x2dc9c6);throw _0x2dc9c6;});}return _0x1188e1;})[_0x326f('0x29')](respondWithResult(_0x5ac972,0xc9))[_0x326f('0x48')](handleError(_0x5ac972,null));};exports[_0x326f('0x27')]=function(_0x2bf33e,_0x25f9dc){if(_0x2bf33e[_0x326f('0x4d')]['id']){delete _0x2bf33e[_0x326f('0x4d')]['id'];}return db['Schedule']['find']({'where':{'id':_0x2bf33e['params']['id']}})[_0x326f('0x29')](handleEntityNotFound(_0x25f9dc,null))[_0x326f('0x29')](saveUpdates(_0x2bf33e[_0x326f('0x4d')],null))[_0x326f('0x29')](respondWithResult(_0x25f9dc,null))[_0x326f('0x48')](handleError(_0x25f9dc,null));};exports['destroy']=function(_0x898508,_0x295d9a){return db[_0x326f('0x30')]['find']({'where':{'id':_0x898508[_0x326f('0x4a')]['id']}})[_0x326f('0x29')](handleEntityNotFound(_0x295d9a,null))[_0x326f('0x29')](removeEntity(_0x295d9a,null))[_0x326f('0x48')](handleError(_0x295d9a,null));};exports[_0x326f('0x55')]=function(_0x2d51df,_0x592388,_0x582892){var _0x11c8d9=require(_0x326f('0x56'));return db[_0x326f('0x30')][_0x326f('0x4b')]({'where':{'id':_0x2d51df[_0x326f('0x4a')]['id']},'raw':!![]})[_0x326f('0x29')](handleEntityNotFound(_0x592388,null))[_0x326f('0x29')](function(){_0x11c8d9[_0x326f('0x55')](_0x2d51df[_0x326f('0x4a')]['id']);})[_0x326f('0x29')](respondWithStatusCode(_0x592388,null))[_0x326f('0x48')](handleError(_0x592388,null));}; \ No newline at end of file +var _0xcd82=['get','Scheduler','UserProfileResource','error','stack','name','send','map','Schedule','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','order','sort','filter','VIRTUAL','merge','options','where','includeAll','include','findAll','rows','catch','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xcd82,0x12e));var _0x2cd8=function(_0x383b5e,_0x201b91){_0x383b5e=_0x383b5e-0x0;var _0x56229f=_0xcd82[_0x383b5e];return _0x56229f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2cd8('0x0'));var zipdir=require(_0x2cd8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2cd8('0x2'));var moment=require(_0x2cd8('0x3'));var BPromise=require(_0x2cd8('0x4'));var Mustache=require(_0x2cd8('0x5'));var util=require(_0x2cd8('0x6'));var path=require(_0x2cd8('0x7'));var sox=require(_0x2cd8('0x8'));var csv=require(_0x2cd8('0x9'));var ejs=require(_0x2cd8('0xa'));var fs=require('fs');var fs_extra=require(_0x2cd8('0xb'));var _=require('lodash');var squel=require(_0x2cd8('0xc'));var crypto=require(_0x2cd8('0xd'));var jsforce=require(_0x2cd8('0xe'));var deskjs=require(_0x2cd8('0xf'));var toCsv=require(_0x2cd8('0x9'));var querystring=require(_0x2cd8('0x10'));var Papa=require('papaparse');var Redis=require(_0x2cd8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2cd8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2cd8('0x13'));var logger=require(_0x2cd8('0x14'))(_0x2cd8('0x15'));var utils=require(_0x2cd8('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2cd8('0x17'))['db'];function respondWithStatusCode(_0x334937,_0x116d34){_0x116d34=_0x116d34||0xcc;return function(_0x349db2){if(_0x349db2){return _0x334937[_0x2cd8('0x18')](_0x116d34);}return _0x334937[_0x2cd8('0x19')](_0x116d34)[_0x2cd8('0x1a')]();};}function respondWithResult(_0x1647a8,_0xd1e720){_0xd1e720=_0xd1e720||0xc8;return function(_0x573443){if(_0x573443){return _0x1647a8[_0x2cd8('0x19')](_0xd1e720)[_0x2cd8('0x1b')](_0x573443);}};}function respondWithFilteredResult(_0x1288ac,_0x1fa85c){return function(_0xfb764b){if(_0xfb764b){var _0x39caea=typeof _0x1fa85c['offset']==='undefined'&&typeof _0x1fa85c['limit']===_0x2cd8('0x1c');var _0x153fd7=_0xfb764b[_0x2cd8('0x1d')];var _0xe7ee6d=_0x39caea?0x0:_0x1fa85c[_0x2cd8('0x1e')];var _0x52c7f6=_0x39caea?_0xfb764b[_0x2cd8('0x1d')]:_0x1fa85c['offset']+_0x1fa85c['limit'];var _0x38db3d;if(_0x52c7f6>=_0x153fd7){_0x52c7f6=_0x153fd7;_0x38db3d=0xc8;}else{_0x38db3d=0xce;}_0x1288ac['status'](_0x38db3d);return _0x1288ac[_0x2cd8('0x1f')](_0x2cd8('0x20'),_0xe7ee6d+'-'+_0x52c7f6+'/'+_0x153fd7)[_0x2cd8('0x1b')](_0xfb764b);}return null;};}function patchUpdates(_0x501fbf){return function(_0x5eed17){try{jsonpatch['apply'](_0x5eed17,_0x501fbf,!![]);}catch(_0x1de49a){return BPromise[_0x2cd8('0x21')](_0x1de49a);}return _0x5eed17[_0x2cd8('0x22')]();};}function saveUpdates(_0x46a6fc,_0x344344){return function(_0x106903){if(_0x106903){return _0x106903[_0x2cd8('0x23')](_0x46a6fc)[_0x2cd8('0x24')](function(_0x558e41){return _0x558e41;});}return null;};}function removeEntity(_0x335001,_0x468f7d){return function(_0x5128e8){if(_0x5128e8){return _0x5128e8[_0x2cd8('0x25')]()[_0x2cd8('0x24')](function(){var _0x35c11a=_0x5128e8[_0x2cd8('0x26')]({'plain':!![]});var _0x53c228=_0x2cd8('0x27');return db[_0x2cd8('0x28')][_0x2cd8('0x25')]({'where':{'type':_0x53c228,'resourceId':_0x35c11a['id']}})['then'](function(){return _0x5128e8;});})[_0x2cd8('0x24')](function(){_0x335001[_0x2cd8('0x19')](0xcc)[_0x2cd8('0x1a')]();});}};}function handleEntityNotFound(_0x1924ea,_0x243b0e){return function(_0x4e3de5){if(!_0x4e3de5){_0x1924ea['sendStatus'](0x194);}return _0x4e3de5;};}function handleError(_0x56cb8e,_0xd0d150){_0xd0d150=_0xd0d150||0x1f4;return function(_0x5051ae){logger[_0x2cd8('0x29')](_0x5051ae[_0x2cd8('0x2a')]);if(_0x5051ae[_0x2cd8('0x2b')]){delete _0x5051ae['name'];}_0x56cb8e[_0x2cd8('0x19')](_0xd0d150)[_0x2cd8('0x2c')](_0x5051ae);};}exports['index']=function(_0x1d9c7d,_0x202513){var _0x2862d7={},_0x4a498d={},_0x197b3={'count':0x0,'rows':[]};var _0x4c9cae=_[_0x2cd8('0x2d')](db[_0x2cd8('0x2e')][_0x2cd8('0x2f')],function(_0x1a03f8){return{'name':_0x1a03f8[_0x2cd8('0x30')],'type':_0x1a03f8[_0x2cd8('0x31')][_0x2cd8('0x32')]};});_0x4a498d[_0x2cd8('0x33')]=_[_0x2cd8('0x2d')](_0x4c9cae,_0x2cd8('0x2b'));_0x4a498d[_0x2cd8('0x34')]=_[_0x2cd8('0x35')](_0x1d9c7d['query']);_0x4a498d[_0x2cd8('0x36')]=_[_0x2cd8('0x37')](_0x4a498d[_0x2cd8('0x33')],_0x4a498d[_0x2cd8('0x34')]);_0x2862d7['attributes']=_[_0x2cd8('0x37')](_0x4a498d[_0x2cd8('0x33')],qs['fields'](_0x1d9c7d['query'][_0x2cd8('0x38')]));_0x2862d7['attributes']=_0x2862d7[_0x2cd8('0x39')]['length']?_0x2862d7[_0x2cd8('0x39')]:_0x4a498d[_0x2cd8('0x33')];if(!_0x1d9c7d[_0x2cd8('0x34')][_0x2cd8('0x3a')]('nolimit')){_0x2862d7['limit']=qs[_0x2cd8('0x3b')](_0x1d9c7d['query'][_0x2cd8('0x3b')]);_0x2862d7[_0x2cd8('0x1e')]=qs[_0x2cd8('0x1e')](_0x1d9c7d[_0x2cd8('0x34')][_0x2cd8('0x1e')]);}_0x2862d7[_0x2cd8('0x3c')]=qs[_0x2cd8('0x3d')](_0x1d9c7d[_0x2cd8('0x34')][_0x2cd8('0x3d')]);_0x2862d7['where']=qs['filters'](_['pick'](_0x1d9c7d[_0x2cd8('0x34')],_0x4a498d[_0x2cd8('0x36')]),_0x4c9cae);if(_0x1d9c7d[_0x2cd8('0x34')][_0x2cd8('0x3e')]){_0x2862d7['where']=_['merge'](_0x2862d7['where'],{'$or':_['map'](_0x4c9cae,function(_0x5339af){if(_0x5339af['type']!==_0x2cd8('0x3f')){var _0xc2436d={};_0xc2436d[_0x5339af[_0x2cd8('0x2b')]]={'$like':'%'+_0x1d9c7d[_0x2cd8('0x34')][_0x2cd8('0x3e')]+'%'};return _0xc2436d;}})});}_0x2862d7=_[_0x2cd8('0x40')]({},_0x2862d7,_0x1d9c7d[_0x2cd8('0x41')]);var _0x2cd57f={'where':_0x2862d7[_0x2cd8('0x42')]};return db[_0x2cd8('0x2e')][_0x2cd8('0x1d')](_0x2cd57f)[_0x2cd8('0x24')](function(_0x3fc7dd){_0x197b3[_0x2cd8('0x1d')]=_0x3fc7dd;if(_0x1d9c7d[_0x2cd8('0x34')][_0x2cd8('0x43')]){_0x2862d7[_0x2cd8('0x44')]=[{'all':!![]}];}return db[_0x2cd8('0x2e')][_0x2cd8('0x45')](_0x2862d7);})['then'](function(_0x1374e7){_0x197b3[_0x2cd8('0x46')]=_0x1374e7;return _0x197b3;})[_0x2cd8('0x24')](respondWithFilteredResult(_0x202513,_0x2862d7))[_0x2cd8('0x47')](handleError(_0x202513,null));};exports[_0x2cd8('0x48')]=function(_0x10defa,_0x42d471){var _0x490404={'raw':![],'where':{'id':_0x10defa[_0x2cd8('0x49')]['id']}},_0x2b7bfa={};_0x2b7bfa[_0x2cd8('0x33')]=_['keys'](db['Schedule']['rawAttributes']);_0x2b7bfa[_0x2cd8('0x34')]=_[_0x2cd8('0x35')](_0x10defa[_0x2cd8('0x34')]);_0x2b7bfa[_0x2cd8('0x36')]=_[_0x2cd8('0x37')](_0x2b7bfa[_0x2cd8('0x33')],_0x2b7bfa['query']);_0x490404[_0x2cd8('0x39')]=_[_0x2cd8('0x37')](_0x2b7bfa['model'],qs[_0x2cd8('0x38')](_0x10defa[_0x2cd8('0x34')][_0x2cd8('0x38')]));_0x490404[_0x2cd8('0x39')]=_0x490404[_0x2cd8('0x39')][_0x2cd8('0x4a')]?_0x490404[_0x2cd8('0x39')]:_0x2b7bfa[_0x2cd8('0x33')];if(_0x10defa[_0x2cd8('0x34')][_0x2cd8('0x43')]){_0x490404[_0x2cd8('0x44')]=[{'all':!![]}];}_0x490404=_[_0x2cd8('0x40')]({},_0x490404,_0x10defa[_0x2cd8('0x41')]);return db[_0x2cd8('0x2e')]['find'](_0x490404)[_0x2cd8('0x24')](handleEntityNotFound(_0x42d471,null))['then'](respondWithResult(_0x42d471,null))['catch'](handleError(_0x42d471,null));};exports[_0x2cd8('0x4b')]=function(_0x214ecb,_0x393dbc){return db[_0x2cd8('0x2e')]['create'](_0x214ecb[_0x2cd8('0x4c')],{})[_0x2cd8('0x24')](function(_0x8ee90e){var _0x36c0dd=_0x214ecb[_0x2cd8('0x4d')][_0x2cd8('0x26')]({'plain':!![]});if(!_0x36c0dd)throw new Error(_0x2cd8('0x4e'));if(_0x36c0dd[_0x2cd8('0x4f')]==='user'){var _0x2ac272=_0x8ee90e[_0x2cd8('0x26')]({'plain':!![]});var _0x243ae8=_0x2cd8('0x27');return db[_0x2cd8('0x50')][_0x2cd8('0x51')]({'where':{'name':_0x243ae8,'userProfileId':_0x36c0dd[_0x2cd8('0x52')]},'raw':!![]})[_0x2cd8('0x24')](function(_0x4b2993){if(_0x4b2993&&_0x4b2993['autoAssociation']===0x0){return db[_0x2cd8('0x28')][_0x2cd8('0x4b')]({'name':_0x2ac272[_0x2cd8('0x2b')],'resourceId':_0x2ac272['id'],'type':_0x4b2993[_0x2cd8('0x2b')],'sectionId':_0x4b2993['id']},{})[_0x2cd8('0x24')](function(){return _0x8ee90e;});}else{return _0x8ee90e;}})[_0x2cd8('0x47')](function(_0x20a563){logger[_0x2cd8('0x29')](_0x2cd8('0x53'),_0x20a563);throw _0x20a563;});}return _0x8ee90e;})[_0x2cd8('0x24')](respondWithResult(_0x393dbc,0xc9))[_0x2cd8('0x47')](handleError(_0x393dbc,null));};exports[_0x2cd8('0x23')]=function(_0x2ca180,_0x5de21d){if(_0x2ca180['body']['id']){delete _0x2ca180[_0x2cd8('0x4c')]['id'];}return db[_0x2cd8('0x2e')][_0x2cd8('0x51')]({'where':{'id':_0x2ca180[_0x2cd8('0x49')]['id']}})[_0x2cd8('0x24')](handleEntityNotFound(_0x5de21d,null))[_0x2cd8('0x24')](saveUpdates(_0x2ca180[_0x2cd8('0x4c')],null))[_0x2cd8('0x24')](respondWithResult(_0x5de21d,null))[_0x2cd8('0x47')](handleError(_0x5de21d,null));};exports[_0x2cd8('0x25')]=function(_0x304192,_0x40e07a){return db['Schedule'][_0x2cd8('0x51')]({'where':{'id':_0x304192[_0x2cd8('0x49')]['id']}})[_0x2cd8('0x24')](handleEntityNotFound(_0x40e07a,null))['then'](removeEntity(_0x40e07a,null))[_0x2cd8('0x47')](handleError(_0x40e07a,null));};exports['run']=function(_0x519f4f,_0x3def4f,_0x1f1026){var _0x26de75=require(_0x2cd8('0x54'));return db[_0x2cd8('0x2e')][_0x2cd8('0x51')]({'where':{'id':_0x519f4f[_0x2cd8('0x49')]['id']},'raw':!![]})[_0x2cd8('0x24')](handleEntityNotFound(_0x3def4f,null))[_0x2cd8('0x24')](function(){_0x26de75['run'](_0x519f4f['params']['id']);})[_0x2cd8('0x24')](respondWithStatusCode(_0x3def4f,null))['catch'](handleError(_0x3def4f,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index ac42834..378906e 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 _0x1701=['rimraf','../../config/environment','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x593cad,_0x4ee03c){var _0x35b166=function(_0x13e5be){while(--_0x13e5be){_0x593cad['push'](_0x593cad['shift']());}};_0x35b166(++_0x4ee03c);}(_0x1701,0x18c));var _0x1170=function(_0x239dc7,_0x10df14){_0x239dc7=_0x239dc7-0x0;var _0x1ee670=_0x1701[_0x239dc7];return _0x1ee670;};'use strict';var _=require(_0x1170('0x0'));var util=require(_0x1170('0x1'));var logger=require(_0x1170('0x2'))(_0x1170('0x3'));var moment=require('moment');var BPromise=require(_0x1170('0x4'));var rp=require(_0x1170('0x5'));var fs=require('fs');var path=require(_0x1170('0x6'));var rimraf=require(_0x1170('0x7'));var config=require(_0x1170('0x8'));var attributes=require('./schedule.attributes');module[_0x1170('0x9')]=function(_0x324ec7,_0x1368d2){return _0x324ec7[_0x1170('0xa')](_0x1170('0xb'),attributes,{'tableName':_0x1170('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15e4=['define','Schedule','tools_schedules','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x20d73e,_0x39f9ec){var _0x52e84b=function(_0x11a4ac){while(--_0x11a4ac){_0x20d73e['push'](_0x20d73e['shift']());}};_0x52e84b(++_0x39f9ec);}(_0x15e4,0x1e3));var _0x415e=function(_0x6c49e3,_0x53c0c5){_0x6c49e3=_0x6c49e3-0x0;var _0x46006b=_0x15e4[_0x6c49e3];return _0x46006b;};'use strict';var _=require(_0x415e('0x0'));var util=require(_0x415e('0x1'));var logger=require(_0x415e('0x2'))('api');var moment=require(_0x415e('0x3'));var BPromise=require(_0x415e('0x4'));var rp=require(_0x415e('0x5'));var fs=require('fs');var path=require(_0x415e('0x6'));var rimraf=require(_0x415e('0x7'));var config=require('../../config/environment');var attributes=require('./schedule.attributes');module[_0x415e('0x8')]=function(_0x4a372f,_0x159625){return _0x4a372f[_0x415e('0x9')](_0x415e('0xa'),attributes,{'tableName':_0x415e('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 1bbe6a3..e07d86c 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 _0xff05=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Schedule,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff05,0x1b4));var _0x5ff0=function(_0x2002df,_0x7c27a7){_0x2002df=_0x2002df-0x0;var _0x17f7d7=_0xff05[_0x2002df];return _0x17f7d7;};'use strict';var _=require(_0x5ff0('0x0'));var util=require(_0x5ff0('0x1'));var moment=require(_0x5ff0('0x2'));var BPromise=require('bluebird');var rs=require(_0x5ff0('0x3'));var fs=require('fs');var Redis=require(_0x5ff0('0x4'));var db=require(_0x5ff0('0x5'))['db'];var utils=require(_0x5ff0('0x6'));var logger=require(_0x5ff0('0x7'))(_0x5ff0('0x8'));var config=require(_0x5ff0('0x9'));var jayson=require(_0x5ff0('0xa'));var client=jayson[_0x5ff0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcc526,_0x525bb9,_0x2aa22d){return new BPromise(function(_0x5d4b94,_0x4605ab){return client['request'](_0xcc526,_0x2aa22d)[_0x5ff0('0xc')](function(_0x446718){logger[_0x5ff0('0xd')](_0x5ff0('0xe'),_0x525bb9,'request\x20sent');logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0x525bb9,_0x5ff0('0xf'),JSON[_0x5ff0('0x10')](_0x446718));if(_0x446718[_0x5ff0('0x11')]){if(_0x446718[_0x5ff0('0x11')][_0x5ff0('0x12')]===0x1f4){logger[_0x5ff0('0x11')](_0x5ff0('0xe'),_0x525bb9,_0x446718[_0x5ff0('0x11')][_0x5ff0('0x13')]);return _0x4605ab(_0x446718[_0x5ff0('0x11')][_0x5ff0('0x13')]);}logger[_0x5ff0('0x11')](_0x5ff0('0xe'),_0x525bb9,_0x446718[_0x5ff0('0x11')][_0x5ff0('0x13')]);return _0x5d4b94(_0x446718[_0x5ff0('0x11')][_0x5ff0('0x13')]);}else{logger[_0x5ff0('0xd')](_0x5ff0('0xe'),_0x525bb9,_0x5ff0('0xf'));_0x5d4b94(_0x446718[_0x5ff0('0x14')]['message']);}})[_0x5ff0('0x15')](function(_0x2cccb9){logger[_0x5ff0('0x11')](_0x5ff0('0xe'),_0x525bb9,_0x2cccb9);_0x4605ab(_0x2cccb9);});});} \ No newline at end of file +var _0x8a19=['error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x41a8b1,_0xcf5a0d){var _0x3470ba=function(_0x5dd8d9){while(--_0x5dd8d9){_0x41a8b1['push'](_0x41a8b1['shift']());}};_0x3470ba(++_0xcf5a0d);}(_0x8a19,0x13d));var _0x98a1=function(_0x1df7ac,_0x19f9d5){_0x1df7ac=_0x1df7ac-0x0;var _0x287ee9=_0x8a19[_0x1df7ac];return _0x287ee9;};'use strict';var _=require(_0x98a1('0x0'));var util=require('util');var moment=require(_0x98a1('0x1'));var BPromise=require('bluebird');var rs=require(_0x98a1('0x2'));var fs=require('fs');var Redis=require(_0x98a1('0x3'));var db=require(_0x98a1('0x4'))['db'];var utils=require(_0x98a1('0x5'));var logger=require(_0x98a1('0x6'))(_0x98a1('0x7'));var config=require(_0x98a1('0x8'));var jayson=require(_0x98a1('0x9'));var client=jayson[_0x98a1('0xa')][_0x98a1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ba766,_0x2cd7bf,_0x48ac2b){return new BPromise(function(_0x4cc656,_0x1680c5){return client['request'](_0x1ba766,_0x48ac2b)[_0x98a1('0xc')](function(_0x48cfc5){logger[_0x98a1('0xd')](_0x98a1('0xe'),_0x2cd7bf,_0x98a1('0xf'));logger[_0x98a1('0x10')](_0x98a1('0x11'),_0x2cd7bf,_0x98a1('0xf'),JSON[_0x98a1('0x12')](_0x48cfc5));if(_0x48cfc5['error']){if(_0x48cfc5[_0x98a1('0x13')][_0x98a1('0x14')]===0x1f4){logger['error'](_0x98a1('0xe'),_0x2cd7bf,_0x48cfc5[_0x98a1('0x13')]['message']);return _0x1680c5(_0x48cfc5['error'][_0x98a1('0x15')]);}logger[_0x98a1('0x13')]('Schedule,\x20%s,\x20%s',_0x2cd7bf,_0x48cfc5['error'][_0x98a1('0x15')]);return _0x4cc656(_0x48cfc5['error'][_0x98a1('0x15')]);}else{logger[_0x98a1('0xd')](_0x98a1('0xe'),_0x2cd7bf,_0x98a1('0xf'));_0x4cc656(_0x48cfc5[_0x98a1('0x16')]['message']);}})[_0x98a1('0x17')](function(_0x17c167){logger[_0x98a1('0x13')]('Schedule,\x20%s,\x20%s',_0x2cd7bf,_0x17c167);_0x1680c5(_0x17c167);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 8dac6dc..792b8b0 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 _0x7131=['../../components/interaction/service','./screenRecording.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','download','post','create','update','delete','destroy','exports','multer','connect-timeout','express','../../components/auth/service'];(function(_0x2cddc0,_0x15f1c2){var _0x4e22e1=function(_0x573e6e){while(--_0x573e6e){_0x2cddc0['push'](_0x2cddc0['shift']());}};_0x4e22e1(++_0x15f1c2);}(_0x7131,0x18b));var _0x1713=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7131[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x1713('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1713('0x1'));var express=require(_0x1713('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1713('0x3'));var interaction=require(_0x1713('0x4'));var config=require('../../config/environment');var controller=require(_0x1713('0x5'));router['get']('/',auth[_0x1713('0x6')](),controller[_0x1713('0x7')]);router[_0x1713('0x8')](_0x1713('0x9'),auth['isAuthenticated'](),controller[_0x1713('0xa')]);router[_0x1713('0x8')](_0x1713('0xb'),auth['isAuthenticated'](),controller[_0x1713('0xc')]);router[_0x1713('0x8')](_0x1713('0xd'),auth[_0x1713('0x6')](),controller[_0x1713('0xe')]);router[_0x1713('0xf')]('/',auth[_0x1713('0x6')](),controller[_0x1713('0x10')]);router['put'](_0x1713('0xb'),auth[_0x1713('0x6')](),controller[_0x1713('0x11')]);router[_0x1713('0x12')](_0x1713('0xb'),auth[_0x1713('0x6')](),controller[_0x1713('0x13')]);module[_0x1713('0x14')]=router; \ No newline at end of file +var _0xbe02=['show','/:id/download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id'];(function(_0x6723bb,_0x1e984d){var _0x4a8b45=function(_0x4d6c8d){while(--_0x4d6c8d){_0x6723bb['push'](_0x6723bb['shift']());}};_0x4a8b45(++_0x1e984d);}(_0xbe02,0xd8));var _0x2be0=function(_0x314f46,_0x1581c9){_0x314f46=_0x314f46-0x0;var _0x5ad73b=_0xbe02[_0x314f46];return _0x5ad73b;};'use strict';var multer=require(_0x2be0('0x0'));var util=require(_0x2be0('0x1'));var path=require(_0x2be0('0x2'));var timeout=require(_0x2be0('0x3'));var express=require(_0x2be0('0x4'));var router=express[_0x2be0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2be0('0x6'));var interaction=require(_0x2be0('0x7'));var config=require(_0x2be0('0x8'));var controller=require('./screenRecording.controller');router[_0x2be0('0x9')]('/',auth[_0x2be0('0xa')](),controller['index']);router['get'](_0x2be0('0xb'),auth['isAuthenticated'](),controller[_0x2be0('0xc')]);router[_0x2be0('0x9')](_0x2be0('0xd'),auth[_0x2be0('0xa')](),controller[_0x2be0('0xe')]);router[_0x2be0('0x9')](_0x2be0('0xf'),auth['isAuthenticated'](),controller['download']);router[_0x2be0('0x10')]('/',auth[_0x2be0('0xa')](),controller[_0x2be0('0x11')]);router[_0x2be0('0x12')](_0x2be0('0xd'),auth[_0x2be0('0xa')](),controller[_0x2be0('0x13')]);router[_0x2be0('0x14')](_0x2be0('0xd'),auth[_0x2be0('0xa')](),controller[_0x2be0('0x15')]);module[_0x2be0('0x16')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 59fd4ce..c762ddd 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 _0x5fdc=['createdAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','INTEGER','subtract','setDataValue','closedAt','duration','DATE','startedAt','toString','format','MM-DD-YYYY\x20HH:mm'];(function(_0x197133,_0x5cc5be){var _0x4df7c3=function(_0x5aa042){while(--_0x5aa042){_0x197133['push'](_0x197133['shift']());}};_0x4df7c3(++_0x5cc5be);}(_0x5fdc,0x127));var _0xc5fd=function(_0xfbb726,_0x3e8d2f){_0xfbb726=_0xfbb726-0x0;var _0x5ed3d3=_0x5fdc[_0xfbb726];return _0x5ed3d3;};'use strict';var Sequelize=require(_0xc5fd('0x0'));var moment=require(_0xc5fd('0x1'));var path=require(_0xc5fd('0x2'));var config=require(_0xc5fd('0x3'));module[_0xc5fd('0x4')]={'format':{'type':Sequelize[_0xc5fd('0x5')],'get':function(){return this[_0xc5fd('0x6')](_0xc5fd('0x7'))?path[_0xc5fd('0x8')](this[_0xc5fd('0x6')](_0xc5fd('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0xc5fd('0x9')]},'channel':{'type':Sequelize[_0xc5fd('0x9')]},'value':{'type':Sequelize[_0xc5fd('0x9')],'set':function(_0x15ffe7){var _0x5a2eb4=_0x15ffe7['replace'](/\\/g,'/');this['setDataValue'](_0xc5fd('0x7'),_0x5a2eb4);}},'rating':{'type':Sequelize[_0xc5fd('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xc5fd('0xa')],'set':function(_0x45c91f){this['setDataValue']('startedAt',moment()[_0xc5fd('0xb')](_0x45c91f,'ms'));this[_0xc5fd('0xc')](_0xc5fd('0xd'),moment());this[_0xc5fd('0xc')](_0xc5fd('0xe'),_0x45c91f);}},'startedAt':{'type':Sequelize[_0xc5fd('0xf')],'get':function(){return moment(this['getDataValue'](_0xc5fd('0x10')))['format']('MM-DD-YYYY\x20HH:mm')[_0xc5fd('0x11')]();}},'closedAt':{'type':Sequelize[_0xc5fd('0xf')],'get':function(){return moment(this[_0xc5fd('0x6')](_0xc5fd('0xd')))[_0xc5fd('0x12')](_0xc5fd('0x13'))[_0xc5fd('0x11')]();}},'createdAt':{'type':Sequelize[_0xc5fd('0xf')],'get':function(){return moment(this['getDataValue'](_0xc5fd('0x14')))[_0xc5fd('0x12')](_0xc5fd('0x13'))[_0xc5fd('0x11')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('updatedAt'))['format']('MM-DD-YYYY\x20HH:mm')[_0xc5fd('0x11')]();}}}; \ No newline at end of file +var _0x3c66=['exports','VIRTUAL','getDataValue','value','extname','STRING','replace','INTEGER','setDataValue','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','../../config/environment'];(function(_0x2b6482,_0x95e8a8){var _0x53e68f=function(_0x544be1){while(--_0x544be1){_0x2b6482['push'](_0x2b6482['shift']());}};_0x53e68f(++_0x95e8a8);}(_0x3c66,0x8b));var _0x63c6=function(_0x527120,_0x4b3e08){_0x527120=_0x527120-0x0;var _0x2c5ef5=_0x3c66[_0x527120];return _0x2c5ef5;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require('path');var config=require(_0x63c6('0x0'));module[_0x63c6('0x1')]={'format':{'type':Sequelize[_0x63c6('0x2')],'get':function(){return this[_0x63c6('0x3')](_0x63c6('0x4'))?path[_0x63c6('0x5')](this[_0x63c6('0x3')](_0x63c6('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0x63c6('0x6')]},'channel':{'type':Sequelize[_0x63c6('0x6')]},'value':{'type':Sequelize[_0x63c6('0x6')],'set':function(_0x2b33e8){var _0x47b438=_0x2b33e8[_0x63c6('0x7')](/\\/g,'/');this['setDataValue'](_0x63c6('0x4'),_0x47b438);}},'rating':{'type':Sequelize[_0x63c6('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x386110){this[_0x63c6('0x9')](_0x63c6('0xa'),moment()[_0x63c6('0xb')](_0x386110,'ms'));this[_0x63c6('0x9')](_0x63c6('0xc'),moment());this['setDataValue'](_0x63c6('0xd'),_0x386110);}},'startedAt':{'type':Sequelize[_0x63c6('0xe')],'get':function(){return moment(this[_0x63c6('0x3')]('startedAt'))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x63c6('0xc')))[_0x63c6('0xf')](_0x63c6('0x10'))[_0x63c6('0x11')]();}},'createdAt':{'type':Sequelize[_0x63c6('0xe')],'get':function(){return moment(this['getDataValue'](_0x63c6('0x12')))[_0x63c6('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x63c6('0x11')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x63c6('0x13')))['format'](_0x63c6('0x10'))[_0x63c6('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 9fdf14e..e745dde 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 _0xeec6=['options','includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','duration','createdAt','value','describe','../../components/encryptor','uniqueid','find','join','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','recording','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','download','message','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','ScreenRecording','rawAttributes','fieldName','type','model','format','filters','intersection','query','attributes','fields','nolimit','order','sort','where','pick','filter','merge'];(function(_0x2b1f9a,_0x2c02ae){var _0x3d7d7b=function(_0x2793fd){while(--_0x2793fd){_0x2b1f9a['push'](_0x2b1f9a['shift']());}};_0x3d7d7b(++_0x2c02ae);}(_0xeec6,0x1c2));var _0x6eec=function(_0xf4129c,_0x44fcf1){_0xf4129c=_0xf4129c-0x0;var _0x426611=_0xeec6[_0xf4129c];return _0x426611;};'use strict';var emlformat=require(_0x6eec('0x0'));var rimraf=require(_0x6eec('0x1'));var zipdir=require(_0x6eec('0x2'));var jsonpatch=require(_0x6eec('0x3'));var rp=require('request-promise');var moment=require(_0x6eec('0x4'));var BPromise=require(_0x6eec('0x5'));var Mustache=require(_0x6eec('0x6'));var util=require(_0x6eec('0x7'));var path=require(_0x6eec('0x8'));var sox=require(_0x6eec('0x9'));var csv=require('to-csv');var ejs=require(_0x6eec('0xa'));var fs=require('fs');var fs_extra=require(_0x6eec('0xb'));var _=require('lodash');var squel=require(_0x6eec('0xc'));var crypto=require(_0x6eec('0xd'));var jsforce=require(_0x6eec('0xe'));var deskjs=require(_0x6eec('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6eec('0x10'));var Papa=require(_0x6eec('0x11'));var Redis=require(_0x6eec('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6eec('0x13'));var logger=require(_0x6eec('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x6eec('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6eec('0x16'))['db'];function respondWithStatusCode(_0x3387c2,_0x162db1){_0x162db1=_0x162db1||0xcc;return function(_0x3fe94b){if(_0x3fe94b){return _0x3387c2[_0x6eec('0x17')](_0x162db1);}return _0x3387c2['status'](_0x162db1)[_0x6eec('0x18')]();};}function respondWithResult(_0x3b2972,_0x462dbb){_0x462dbb=_0x462dbb||0xc8;return function(_0xc35914){if(_0xc35914){return _0x3b2972[_0x6eec('0x19')](_0x462dbb)[_0x6eec('0x1a')](_0xc35914);}};}function respondWithFilteredResult(_0x345852,_0x393271){return function(_0x34a7fc){if(_0x34a7fc){var _0x2ac797=typeof _0x393271['offset']===_0x6eec('0x1b')&&typeof _0x393271['limit']===_0x6eec('0x1b');var _0x45aa3f=_0x34a7fc['count'];var _0x3ee353=_0x2ac797?0x0:_0x393271[_0x6eec('0x1c')];var _0xb1eab7=_0x2ac797?_0x34a7fc['count']:_0x393271[_0x6eec('0x1c')]+_0x393271[_0x6eec('0x1d')];var _0x3c7152;if(_0xb1eab7>=_0x45aa3f){_0xb1eab7=_0x45aa3f;_0x3c7152=0xc8;}else{_0x3c7152=0xce;}_0x345852[_0x6eec('0x19')](_0x3c7152);return _0x345852[_0x6eec('0x1e')](_0x6eec('0x1f'),_0x3ee353+'-'+_0xb1eab7+'/'+_0x45aa3f)['json'](_0x34a7fc);}return null;};}function patchUpdates(_0x328693){return function(_0x2f843e){try{jsonpatch[_0x6eec('0x20')](_0x2f843e,_0x328693,!![]);}catch(_0x34522a){return BPromise[_0x6eec('0x21')](_0x34522a);}return _0x2f843e[_0x6eec('0x22')]();};}function saveUpdates(_0x52f941,_0x6e40b3){return function(_0x852d08){if(_0x852d08){return _0x852d08[_0x6eec('0x23')](_0x52f941)[_0x6eec('0x24')](function(_0x409b26){return _0x409b26;});}return null;};}function removeEntity(_0x13863c,_0x573249){return function(_0x384586){if(_0x384586){return _0x384586[_0x6eec('0x25')]()[_0x6eec('0x24')](function(){_0x13863c[_0x6eec('0x19')](0xcc)[_0x6eec('0x18')]();});}};}function handleEntityNotFound(_0x1f386c,_0x29879c){return function(_0x20bed3){if(!_0x20bed3){_0x1f386c[_0x6eec('0x17')](0x194);}return _0x20bed3;};}function handleError(_0x58f95c,_0x1d750c){_0x1d750c=_0x1d750c||0x1f4;return function(_0x44b31c){logger[_0x6eec('0x26')](_0x44b31c[_0x6eec('0x27')]);if(_0x44b31c['name']){delete _0x44b31c[_0x6eec('0x28')];}_0x58f95c[_0x6eec('0x19')](_0x1d750c)['send'](_0x44b31c);};}exports['index']=function(_0x3240c3,_0x47ed95){var _0x20a130={},_0xede270={},_0x3bbdf8={'count':0x0,'rows':[]};var _0x34bdea=_[_0x6eec('0x29')](db[_0x6eec('0x2a')][_0x6eec('0x2b')],function(_0x33e4a1){return{'name':_0x33e4a1[_0x6eec('0x2c')],'type':_0x33e4a1[_0x6eec('0x2d')]['key']};});_0xede270[_0x6eec('0x2e')]=_['differenceBy'](_[_0x6eec('0x29')](_0x34bdea,_0x6eec('0x28')),[_0x6eec('0x2f')]);_0xede270['query']=_['keys'](_0x3240c3['query']);_0xede270[_0x6eec('0x30')]=_[_0x6eec('0x31')](_0xede270[_0x6eec('0x2e')],_0xede270[_0x6eec('0x32')]);_0x20a130[_0x6eec('0x33')]=_[_0x6eec('0x31')](_0xede270[_0x6eec('0x2e')],qs[_0x6eec('0x34')](_0x3240c3[_0x6eec('0x32')][_0x6eec('0x34')]));_0x20a130[_0x6eec('0x33')]=_0x20a130[_0x6eec('0x33')]['length']?_0x20a130[_0x6eec('0x33')]:_0xede270[_0x6eec('0x2e')];if(!_0x3240c3[_0x6eec('0x32')]['hasOwnProperty'](_0x6eec('0x35'))){_0x20a130[_0x6eec('0x1d')]=qs[_0x6eec('0x1d')](_0x3240c3[_0x6eec('0x32')][_0x6eec('0x1d')]);_0x20a130[_0x6eec('0x1c')]=qs['offset'](_0x3240c3[_0x6eec('0x32')][_0x6eec('0x1c')]);}_0x20a130[_0x6eec('0x36')]=qs['sort'](_0x3240c3['query'][_0x6eec('0x37')]);_0x20a130[_0x6eec('0x38')]=qs[_0x6eec('0x30')](_[_0x6eec('0x39')](_0x3240c3[_0x6eec('0x32')],_0xede270['filters']),_0x34bdea);if(_0x3240c3[_0x6eec('0x32')][_0x6eec('0x3a')]){_0x20a130[_0x6eec('0x38')]=_[_0x6eec('0x3b')](_0x20a130[_0x6eec('0x38')],{'$or':_[_0x6eec('0x29')](_0x34bdea,function(_0x36cfe1){if(_0x36cfe1[_0x6eec('0x2d')]!=='VIRTUAL'){var _0x2f7a75={};_0x2f7a75[_0x36cfe1[_0x6eec('0x28')]]={'$like':'%'+_0x3240c3['query']['filter']+'%'};return _0x2f7a75;}})});}_0x20a130=_[_0x6eec('0x3b')]({},_0x20a130,_0x3240c3[_0x6eec('0x3c')]);var _0xf056e0={'where':_0x20a130[_0x6eec('0x38')]};return db['ScreenRecording']['count'](_0xf056e0)[_0x6eec('0x24')](function(_0x48fbf6){_0x3bbdf8['count']=_0x48fbf6;if(_0x3240c3[_0x6eec('0x32')][_0x6eec('0x3d')]){_0x20a130[_0x6eec('0x3e')]=[{'all':!![]}];}return db[_0x6eec('0x2a')][_0x6eec('0x3f')](_0x20a130);})['then'](function(_0x931bcf){_0x3bbdf8[_0x6eec('0x40')]=_0x931bcf;return _0x3bbdf8;})['then'](respondWithFilteredResult(_0x47ed95,_0x20a130))[_0x6eec('0x41')](handleError(_0x47ed95,null));};exports[_0x6eec('0x42')]=function(_0x5028a2,_0x2d39bf){var _0x44d75d={'raw':![],'where':{'id':_0x5028a2[_0x6eec('0x43')]['id']}},_0x4e3b1e={};_0x4e3b1e[_0x6eec('0x2e')]=_[_0x6eec('0x44')](db[_0x6eec('0x2a')]['rawAttributes']);_0x4e3b1e[_0x6eec('0x32')]=_[_0x6eec('0x44')](_0x5028a2[_0x6eec('0x32')]);_0x4e3b1e[_0x6eec('0x30')]=_[_0x6eec('0x31')](_0x4e3b1e['model'],_0x4e3b1e['query']);_0x44d75d[_0x6eec('0x33')]=_[_0x6eec('0x31')](_0x4e3b1e[_0x6eec('0x2e')],qs[_0x6eec('0x34')](_0x5028a2[_0x6eec('0x32')]['fields']));_0x44d75d[_0x6eec('0x33')]=_0x44d75d['attributes'][_0x6eec('0x45')]?_0x44d75d[_0x6eec('0x33')]:_0x4e3b1e[_0x6eec('0x2e')];if(_0x5028a2['query'][_0x6eec('0x3d')]){_0x44d75d[_0x6eec('0x3e')]=[{'all':!![]}];}_0x44d75d=_[_0x6eec('0x3b')]({},_0x44d75d,_0x5028a2[_0x6eec('0x3c')]);return db[_0x6eec('0x2a')]['find'](_0x44d75d)[_0x6eec('0x24')](handleEntityNotFound(_0x2d39bf,null))['then'](respondWithResult(_0x2d39bf,null))['catch'](handleError(_0x2d39bf,null));};exports[_0x6eec('0x46')]=function(_0x535d96,_0x245a1b){return db[_0x6eec('0x2a')][_0x6eec('0x46')](_0x535d96['body'],{})['then'](respondWithResult(_0x245a1b,0xc9))[_0x6eec('0x41')](handleError(_0x245a1b,null));};exports[_0x6eec('0x23')]=function(_0x1d6626,_0x2d0fc0){if(_0x1d6626[_0x6eec('0x47')]['id']){delete _0x1d6626[_0x6eec('0x47')]['id'];}delete _0x1d6626[_0x6eec('0x47')][_0x6eec('0x48')];delete _0x1d6626[_0x6eec('0x47')][_0x6eec('0x49')];delete _0x1d6626['body']['closedAt'];delete _0x1d6626[_0x6eec('0x47')][_0x6eec('0x4a')];return db[_0x6eec('0x2a')]['find']({'where':{'id':_0x1d6626[_0x6eec('0x43')]['id']}})[_0x6eec('0x24')](handleEntityNotFound(_0x2d0fc0,null))[_0x6eec('0x24')](saveUpdates(_0x1d6626[_0x6eec('0x47')],null))[_0x6eec('0x24')](respondWithResult(_0x2d0fc0,null))[_0x6eec('0x41')](handleError(_0x2d0fc0,null));};exports[_0x6eec('0x4b')]=function(_0x413de9,_0x5a6e05){return db[_0x6eec('0x2a')][_0x6eec('0x4b')]()[_0x6eec('0x24')](respondWithResult(_0x5a6e05,null))[_0x6eec('0x41')](handleError(_0x5a6e05,null));};exports['download']=function(_0x51fd37,_0x50436d,_0x36c49b){var _0x32b289=require(_0x6eec('0x4c'));var _0x1de626=![];var _0x5178f5={};if(_0x51fd37['query'][_0x6eec('0x2d')]&&_0x51fd37[_0x6eec('0x32')][_0x6eec('0x2d')]==='uniqueid'){_0x5178f5[_0x6eec('0x4d')]=_0x51fd37[_0x6eec('0x43')]['id'];}else{_0x5178f5['id']=_0x51fd37[_0x6eec('0x43')]['id'];}return db[_0x6eec('0x2a')][_0x6eec('0x4e')]({'where':_0x5178f5,'attributes':['id',_0x6eec('0x4a')],'raw':!![]})[_0x6eec('0x24')](handleEntityNotFound(_0x50436d,null))[_0x6eec('0x24')](function(_0x45fed3){if(_0x45fed3){var _0x4e921a=path[_0x6eec('0x4f')](config['root'],_0x6eec('0x50'),_0x45fed3[_0x6eec('0x4a')]);var _0x424962=util[_0x6eec('0x2f')](_0x6eec('0x51'),_0x4e921a);if(fs[_0x6eec('0x52')](_0x424962)){_0x1de626=!![];return _0x32b289[_0x6eec('0x53')](_0x424962,_0x4e921a,config['secrets'][_0x6eec('0x54')])['then'](function(){return _0x45fed3;});}return _0x45fed3;}})[_0x6eec('0x24')](function(_0x5c905f){if(_0x5c905f){var _0x237324=path[_0x6eec('0x4f')](config[_0x6eec('0x55')],_0x6eec('0x50'),_0x5c905f[_0x6eec('0x4a')]);if(!fs[_0x6eec('0x52')](_0x237324)){throw new db[(_0x6eec('0x56'))][(_0x6eec('0x57'))](_0x6eec('0x58'));}if(_0x5c905f[_0x6eec('0x59')]){return _0x50436d['download'](_0x237324,_0x5c905f['filename']+path[_0x6eec('0x5a')](_0x237324),function(){if(_0x1de626){fs[_0x6eec('0x5b')](_0x237324);}});}else{return _0x50436d[_0x6eec('0x5c')](_0x237324,function(_0x2c0644){if(_0x1de626){fs[_0x6eec('0x5b')](_0x237324);}});}}})['catch'](function(_0x1d8fb1){if(_0x1d8fb1[_0x6eec('0x5d')]==='ScreenRecording\x20not\x20found'){_0x50436d['status'](0x194)['send'](_0x6eec('0x5e'));}else{return handleError(_0x50436d,null);}});};exports[_0x6eec('0x25')]=function(_0x4cf859,_0x1d2baf){return db[_0x6eec('0x2a')]['find']({'where':{'id':_0x4cf859[_0x6eec('0x43')]['id']}})[_0x6eec('0x24')](function(_0xc852b3){if(_[_0x6eec('0x5f')](_0xc852b3)){throw new ReferenceError('Entity\x20not\x20found');}return _0xc852b3;})['then'](function(_0x54fcd0){var _0x1230fc=path[_0x6eec('0x4f')](config[_0x6eec('0x55')],_0x6eec('0x50'),_0x54fcd0[_0x6eec('0x4a')]);logger[_0x6eec('0x60')](_0x6eec('0x61'),_0x1230fc);if(!_[_0x6eec('0x5f')](_0x54fcd0[_0x6eec('0x4a')])&&fs[_0x6eec('0x52')](_0x1230fc)){logger[_0x6eec('0x60')](_0x6eec('0x62')+_0x1230fc+_0x6eec('0x63'));fs[_0x6eec('0x64')](_0x1230fc);}_0x1230fc=_0x1230fc+_0x6eec('0x65');if(!_[_0x6eec('0x5f')](_0x54fcd0['value'])&&fs[_0x6eec('0x52')](_0x1230fc)){logger[_0x6eec('0x60')]('File:\x20\x22'+_0x1230fc+_0x6eec('0x63'));fs[_0x6eec('0x64')](_0x1230fc);}return _0x54fcd0;})['then'](function(_0x7dd727){if(!_0x7dd727)throw new InternalError();return _0x7dd727[_0x6eec('0x25')]();})[_0x6eec('0x24')](function(){_0x1d2baf[_0x6eec('0x19')](0xcc)['end']();})[_0x6eec('0x41')](handleError(_0x1d2baf,null));}; \ No newline at end of file +var _0x5fc3=['status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','name','send','map','ScreenRecording','fieldName','type','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','include','rows','catch','show','params','length','includeAll','find','create','body','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','root','server/files/screen_recordings','existsSync','decryptFile','secrets','join','Sequelize','ValidationError','filename','unlink','message','ScreenRecording\x20not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus'];(function(_0x52890a,_0x4f0850){var _0x59c6d5=function(_0x2e1dbb){while(--_0x2e1dbb){_0x52890a['push'](_0x52890a['shift']());}};_0x59c6d5(++_0x4f0850);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x5fc3[_0x2df507];return _0x1f7167;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xcc;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x17')](_0x409357);}return _0x4cbe74[_0x35fc('0x18')](_0x409357)[_0x35fc('0x19')]();};}function respondWithResult(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0xc8;return function(_0x5cfe94){if(_0x5cfe94){return _0x29730f['status'](_0x38d9f2)['json'](_0x5cfe94);}};}function respondWithFilteredResult(_0x558364,_0x398b67){return function(_0x229d56){if(_0x229d56){var _0x53b898=typeof _0x398b67[_0x35fc('0x1a')]===_0x35fc('0x1b')&&typeof _0x398b67[_0x35fc('0x1c')]==='undefined';var _0x26ba54=_0x229d56[_0x35fc('0x1d')];var _0x553677=_0x53b898?0x0:_0x398b67[_0x35fc('0x1a')];var _0x363e47=_0x53b898?_0x229d56[_0x35fc('0x1d')]:_0x398b67['offset']+_0x398b67[_0x35fc('0x1c')];var _0x3c58ea;if(_0x363e47>=_0x26ba54){_0x363e47=_0x26ba54;_0x3c58ea=0xc8;}else{_0x3c58ea=0xce;}_0x558364[_0x35fc('0x18')](_0x3c58ea);return _0x558364['set'](_0x35fc('0x1e'),_0x553677+'-'+_0x363e47+'/'+_0x26ba54)[_0x35fc('0x1f')](_0x229d56);}return null;};}function patchUpdates(_0x3229d1){return function(_0x251a1f){try{jsonpatch[_0x35fc('0x20')](_0x251a1f,_0x3229d1,!![]);}catch(_0x21f1a9){return BPromise[_0x35fc('0x21')](_0x21f1a9);}return _0x251a1f[_0x35fc('0x22')]();};}function saveUpdates(_0x2405e8,_0x427eae){return function(_0x5bd2b8){if(_0x5bd2b8){return _0x5bd2b8[_0x35fc('0x23')](_0x2405e8)[_0x35fc('0x24')](function(_0x257719){return _0x257719;});}return null;};}function removeEntity(_0x2d8183,_0x3b4743){return function(_0x55e9e7){if(_0x55e9e7){return _0x55e9e7[_0x35fc('0x25')]()[_0x35fc('0x24')](function(){_0x2d8183['status'](0xcc)[_0x35fc('0x19')]();});}};}function handleEntityNotFound(_0x5a93df,_0x3d4a98){return function(_0x51cfec){if(!_0x51cfec){_0x5a93df[_0x35fc('0x17')](0x194);}return _0x51cfec;};}function handleError(_0x598d7a,_0x1bf180){_0x1bf180=_0x1bf180||0x1f4;return function(_0xdfab9f){logger['error'](_0xdfab9f['stack']);if(_0xdfab9f[_0x35fc('0x26')]){delete _0xdfab9f['name'];}_0x598d7a[_0x35fc('0x18')](_0x1bf180)[_0x35fc('0x27')](_0xdfab9f);};}exports['index']=function(_0x26b7cb,_0x645eac){var _0x383837={},_0x9f3c8a={},_0x3735da={'count':0x0,'rows':[]};var _0x134dfa=_[_0x35fc('0x28')](db[_0x35fc('0x29')]['rawAttributes'],function(_0x1cd1ae){return{'name':_0x1cd1ae[_0x35fc('0x2a')],'type':_0x1cd1ae[_0x35fc('0x2b')]['key']};});_0x9f3c8a[_0x35fc('0x2c')]=_[_0x35fc('0x2d')](_[_0x35fc('0x28')](_0x134dfa,_0x35fc('0x26')),[_0x35fc('0x2e')]);_0x9f3c8a[_0x35fc('0x2f')]=_[_0x35fc('0x30')](_0x26b7cb[_0x35fc('0x2f')]);_0x9f3c8a[_0x35fc('0x31')]=_[_0x35fc('0x32')](_0x9f3c8a['model'],_0x9f3c8a['query']);_0x383837[_0x35fc('0x33')]=_['intersection'](_0x9f3c8a[_0x35fc('0x2c')],qs[_0x35fc('0x34')](_0x26b7cb[_0x35fc('0x2f')][_0x35fc('0x34')]));_0x383837[_0x35fc('0x33')]=_0x383837[_0x35fc('0x33')]['length']?_0x383837[_0x35fc('0x33')]:_0x9f3c8a[_0x35fc('0x2c')];if(!_0x26b7cb[_0x35fc('0x2f')][_0x35fc('0x35')](_0x35fc('0x36'))){_0x383837[_0x35fc('0x1c')]=qs['limit'](_0x26b7cb[_0x35fc('0x2f')][_0x35fc('0x1c')]);_0x383837[_0x35fc('0x1a')]=qs['offset'](_0x26b7cb[_0x35fc('0x2f')]['offset']);}_0x383837[_0x35fc('0x37')]=qs[_0x35fc('0x38')](_0x26b7cb[_0x35fc('0x2f')][_0x35fc('0x38')]);_0x383837['where']=qs['filters'](_['pick'](_0x26b7cb[_0x35fc('0x2f')],_0x9f3c8a['filters']),_0x134dfa);if(_0x26b7cb[_0x35fc('0x2f')]['filter']){_0x383837[_0x35fc('0x39')]=_[_0x35fc('0x3a')](_0x383837[_0x35fc('0x39')],{'$or':_[_0x35fc('0x28')](_0x134dfa,function(_0x1c10e0){if(_0x1c10e0[_0x35fc('0x2b')]!==_0x35fc('0x3b')){var _0x4ec0dc={};_0x4ec0dc[_0x1c10e0[_0x35fc('0x26')]]={'$like':'%'+_0x26b7cb[_0x35fc('0x2f')]['filter']+'%'};return _0x4ec0dc;}})});}_0x383837=_[_0x35fc('0x3a')]({},_0x383837,_0x26b7cb[_0x35fc('0x3c')]);var _0x1aac67={'where':_0x383837[_0x35fc('0x39')]};return db[_0x35fc('0x29')][_0x35fc('0x1d')](_0x1aac67)['then'](function(_0x3f6480){_0x3735da[_0x35fc('0x1d')]=_0x3f6480;if(_0x26b7cb[_0x35fc('0x2f')]['includeAll']){_0x383837[_0x35fc('0x3d')]=[{'all':!![]}];}return db[_0x35fc('0x29')]['findAll'](_0x383837);})[_0x35fc('0x24')](function(_0x280af1){_0x3735da[_0x35fc('0x3e')]=_0x280af1;return _0x3735da;})[_0x35fc('0x24')](respondWithFilteredResult(_0x645eac,_0x383837))[_0x35fc('0x3f')](handleError(_0x645eac,null));};exports[_0x35fc('0x40')]=function(_0x211b70,_0x3ec51f){var _0x5a7e9e={'raw':![],'where':{'id':_0x211b70[_0x35fc('0x41')]['id']}},_0x596e83={};_0x596e83[_0x35fc('0x2c')]=_['keys'](db['ScreenRecording']['rawAttributes']);_0x596e83[_0x35fc('0x2f')]=_[_0x35fc('0x30')](_0x211b70['query']);_0x596e83[_0x35fc('0x31')]=_[_0x35fc('0x32')](_0x596e83[_0x35fc('0x2c')],_0x596e83[_0x35fc('0x2f')]);_0x5a7e9e['attributes']=_['intersection'](_0x596e83['model'],qs['fields'](_0x211b70['query'][_0x35fc('0x34')]));_0x5a7e9e[_0x35fc('0x33')]=_0x5a7e9e['attributes'][_0x35fc('0x42')]?_0x5a7e9e['attributes']:_0x596e83[_0x35fc('0x2c')];if(_0x211b70[_0x35fc('0x2f')][_0x35fc('0x43')]){_0x5a7e9e[_0x35fc('0x3d')]=[{'all':!![]}];}_0x5a7e9e=_[_0x35fc('0x3a')]({},_0x5a7e9e,_0x211b70['options']);return db[_0x35fc('0x29')][_0x35fc('0x44')](_0x5a7e9e)['then'](handleEntityNotFound(_0x3ec51f,null))[_0x35fc('0x24')](respondWithResult(_0x3ec51f,null))[_0x35fc('0x3f')](handleError(_0x3ec51f,null));};exports[_0x35fc('0x45')]=function(_0x211746,_0x5bc8c3){return db[_0x35fc('0x29')]['create'](_0x211746['body'],{})[_0x35fc('0x24')](respondWithResult(_0x5bc8c3,0xc9))[_0x35fc('0x3f')](handleError(_0x5bc8c3,null));};exports[_0x35fc('0x23')]=function(_0xca8aef,_0xf2ca20){if(_0xca8aef[_0x35fc('0x46')]['id']){delete _0xca8aef[_0x35fc('0x46')]['id'];}delete _0xca8aef[_0x35fc('0x46')]['duration'];delete _0xca8aef[_0x35fc('0x46')][_0x35fc('0x47')];delete _0xca8aef[_0x35fc('0x46')][_0x35fc('0x48')];delete _0xca8aef[_0x35fc('0x46')][_0x35fc('0x49')];return db[_0x35fc('0x29')][_0x35fc('0x44')]({'where':{'id':_0xca8aef[_0x35fc('0x41')]['id']}})[_0x35fc('0x24')](handleEntityNotFound(_0xf2ca20,null))[_0x35fc('0x24')](saveUpdates(_0xca8aef[_0x35fc('0x46')],null))[_0x35fc('0x24')](respondWithResult(_0xf2ca20,null))[_0x35fc('0x3f')](handleError(_0xf2ca20,null));};exports['describe']=function(_0x553ed6,_0x144f77){return db[_0x35fc('0x29')][_0x35fc('0x4a')]()[_0x35fc('0x24')](respondWithResult(_0x144f77,null))[_0x35fc('0x3f')](handleError(_0x144f77,null));};exports[_0x35fc('0x4b')]=function(_0x4a4798,_0x4f024c,_0x388521){var _0x19b2ce=require(_0x35fc('0x4c'));var _0x38bc78=![];var _0x5b2595={};if(_0x4a4798[_0x35fc('0x2f')][_0x35fc('0x2b')]&&_0x4a4798['query'][_0x35fc('0x2b')]===_0x35fc('0x4d')){_0x5b2595['uniqueid']=_0x4a4798[_0x35fc('0x41')]['id'];}else{_0x5b2595['id']=_0x4a4798[_0x35fc('0x41')]['id'];}return db[_0x35fc('0x29')][_0x35fc('0x44')]({'where':_0x5b2595,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x4f024c,null))['then'](function(_0x240338){if(_0x240338){var _0x2ea8d6=path['join'](config[_0x35fc('0x4e')],_0x35fc('0x4f'),_0x240338[_0x35fc('0x49')]);var _0x145854=util[_0x35fc('0x2e')]('%s.cypher',_0x2ea8d6);if(fs[_0x35fc('0x50')](_0x145854)){_0x38bc78=!![];return _0x19b2ce[_0x35fc('0x51')](_0x145854,_0x2ea8d6,config[_0x35fc('0x52')]['recording'])[_0x35fc('0x24')](function(){return _0x240338;});}return _0x240338;}})[_0x35fc('0x24')](function(_0x47fb1a){if(_0x47fb1a){var _0x35a676=path[_0x35fc('0x53')](config[_0x35fc('0x4e')],_0x35fc('0x4f'),_0x47fb1a[_0x35fc('0x49')]);if(!fs[_0x35fc('0x50')](_0x35a676)){throw new db[(_0x35fc('0x54'))][(_0x35fc('0x55'))]('ScreenRecording\x20not\x20found');}if(_0x47fb1a[_0x35fc('0x56')]){return _0x4f024c[_0x35fc('0x4b')](_0x35a676,_0x47fb1a[_0x35fc('0x56')]+path['extname'](_0x35a676),function(){if(_0x38bc78){fs[_0x35fc('0x57')](_0x35a676);}});}else{return _0x4f024c['download'](_0x35a676,function(_0x4ceacc){if(_0x38bc78){fs['unlink'](_0x35a676);}});}}})[_0x35fc('0x3f')](function(_0xb1c68a){if(_0xb1c68a[_0x35fc('0x58')]===_0x35fc('0x59')){_0x4f024c[_0x35fc('0x18')](0x194)['send']('Not\x20found');}else{return handleError(_0x4f024c,null);}});};exports['destroy']=function(_0x4faef4,_0x51d231){return db[_0x35fc('0x29')][_0x35fc('0x44')]({'where':{'id':_0x4faef4[_0x35fc('0x41')]['id']}})[_0x35fc('0x24')](function(_0x511e8b){if(_[_0x35fc('0x5a')](_0x511e8b)){throw new ReferenceError(_0x35fc('0x5b'));}return _0x511e8b;})[_0x35fc('0x24')](function(_0x1b0063){var _0x37bea1=path[_0x35fc('0x53')](config[_0x35fc('0x4e')],_0x35fc('0x4f'),_0x1b0063[_0x35fc('0x49')]);logger['info'](_0x35fc('0x5c'),_0x37bea1);if(!_['isNil'](_0x1b0063[_0x35fc('0x49')])&&fs[_0x35fc('0x50')](_0x37bea1)){logger[_0x35fc('0x5d')](_0x35fc('0x5e')+_0x37bea1+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x35fc('0x5f')](_0x37bea1);}_0x37bea1=_0x37bea1+'.cypher';if(!_['isNil'](_0x1b0063['value'])&&fs[_0x35fc('0x50')](_0x37bea1)){logger['info'](_0x35fc('0x5e')+_0x37bea1+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x35fc('0x5f')](_0x37bea1);}return _0x1b0063;})['then'](function(_0x42a53a){if(!_0x42a53a)throw new InternalError();return _0x42a53a[_0x35fc('0x25')]();})[_0x35fc('0x24')](function(){_0x51d231[_0x35fc('0x18')](0xcc)['end']();})[_0x35fc('0x3f')](handleError(_0x51d231,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index a1a370a..4c30dbe 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 _0x8acb=['./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2493f7,_0x49c670){var _0x594ab2=function(_0x344ec2){while(--_0x344ec2){_0x2493f7['push'](_0x2493f7['shift']());}};_0x594ab2(++_0x49c670);}(_0x8acb,0xf6));var _0xb8ac=function(_0x35667e,_0x5cb7e2){_0x35667e=_0x35667e-0x0;var _0x4f1ff4=_0x8acb[_0x35667e];return _0x4f1ff4;};'use strict';var _=require('lodash');var util=require(_0xb8ac('0x0'));var logger=require(_0xb8ac('0x1'))(_0xb8ac('0x2'));var moment=require(_0xb8ac('0x3'));var BPromise=require(_0xb8ac('0x4'));var rp=require(_0xb8ac('0x5'));var fs=require('fs');var path=require(_0xb8ac('0x6'));var rimraf=require(_0xb8ac('0x7'));var config=require(_0xb8ac('0x8'));var attributes=require(_0xb8ac('0x9'));module[_0xb8ac('0xa')]=function(_0x5a3d11,_0x3d32ae){return _0x5a3d11[_0xb8ac('0xb')](_0xb8ac('0xc'),attributes,{'tableName':_0xb8ac('0xd'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xb8ac('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x17e9=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','ScreenRecording','screen_recordings','interactionid','lodash'];(function(_0x5a7278,_0x348fdd){var _0x3b959d=function(_0xc7ce46){while(--_0xc7ce46){_0x5a7278['push'](_0x5a7278['shift']());}};_0x3b959d(++_0x348fdd);}(_0x17e9,0xe9));var _0x917e=function(_0x22f04d,_0x5acf86){_0x22f04d=_0x22f04d-0x0;var _0x223ba3=_0x17e9[_0x22f04d];return _0x223ba3;};'use strict';var _=require(_0x917e('0x0'));var util=require(_0x917e('0x1'));var logger=require('../../config/logger')(_0x917e('0x2'));var moment=require(_0x917e('0x3'));var BPromise=require(_0x917e('0x4'));var rp=require(_0x917e('0x5'));var fs=require('fs');var path=require(_0x917e('0x6'));var rimraf=require(_0x917e('0x7'));var config=require(_0x917e('0x8'));var attributes=require(_0x917e('0x9'));module['exports']=function(_0xd8b23,_0x338b8d){return _0xd8b23['define'](_0x917e('0xa'),attributes,{'tableName':_0x917e('0xb'),'paranoid':![],'indexes':[{'name':_0x917e('0xc'),'fields':[_0x917e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 5c24012..b7ff502 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 _0x4dfd=['message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x2118ad,_0xe8e3fd){var _0x4b5715=function(_0x399f72){while(--_0x399f72){_0x2118ad['push'](_0x2118ad['shift']());}};_0x4b5715(++_0xe8e3fd);}(_0x4dfd,0xcc));var _0xd4df=function(_0x5f4ab,_0x3bde55){_0x5f4ab=_0x5f4ab-0x0;var _0x1addc6=_0x4dfd[_0x5f4ab];return _0x1addc6;};'use strict';var _=require('lodash');var util=require(_0xd4df('0x0'));var moment=require('moment');var BPromise=require(_0xd4df('0x1'));var rs=require(_0xd4df('0x2'));var fs=require('fs');var Redis=require(_0xd4df('0x3'));var db=require(_0xd4df('0x4'))['db'];var utils=require(_0xd4df('0x5'));var logger=require(_0xd4df('0x6'))(_0xd4df('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd4df('0x8')][_0xd4df('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f4e8a,_0x5a14ba,_0x10d1b3){return new BPromise(function(_0x4f660a,_0x515d1a){return client[_0xd4df('0xa')](_0x5f4e8a,_0x10d1b3)['then'](function(_0x479bd6){logger['info'](_0xd4df('0xb'),_0x5a14ba,_0xd4df('0xc'));logger['debug'](_0xd4df('0xd'),_0x5a14ba,_0xd4df('0xc'),JSON['stringify'](_0x479bd6));if(_0x479bd6[_0xd4df('0xe')]){if(_0x479bd6[_0xd4df('0xe')][_0xd4df('0xf')]===0x1f4){logger[_0xd4df('0xe')](_0xd4df('0xb'),_0x5a14ba,_0x479bd6[_0xd4df('0xe')][_0xd4df('0x10')]);return _0x515d1a(_0x479bd6[_0xd4df('0xe')][_0xd4df('0x10')]);}logger[_0xd4df('0xe')](_0xd4df('0xb'),_0x5a14ba,_0x479bd6['error']['message']);return _0x4f660a(_0x479bd6[_0xd4df('0xe')]['message']);}else{logger[_0xd4df('0x11')](_0xd4df('0xb'),_0x5a14ba,_0xd4df('0xc'));_0x4f660a(_0x479bd6[_0xd4df('0x12')][_0xd4df('0x10')]);}})[_0xd4df('0x13')](function(_0x2b27a2){logger['error'](_0xd4df('0xb'),_0x5a14ba,_0x2b27a2);_0x515d1a(_0x2b27a2);});});} \ No newline at end of file +var _0x5fdc=['then','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','ScreenRecording,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x1a1ab5,_0x4791f5){var _0x45232d=function(_0x5c0494){while(--_0x5c0494){_0x1a1ab5['push'](_0x1a1ab5['shift']());}};_0x45232d(++_0x4791f5);}(_0x5fdc,0x1ed));var _0xc5fd=function(_0x115841,_0x5b0d03){_0x115841=_0x115841-0x0;var _0x32fe7f=_0x5fdc[_0x115841];return _0x32fe7f;};'use strict';var _=require(_0xc5fd('0x0'));var util=require(_0xc5fd('0x1'));var moment=require(_0xc5fd('0x2'));var BPromise=require(_0xc5fd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5fd('0x4'));var db=require(_0xc5fd('0x5'))['db'];var utils=require(_0xc5fd('0x6'));var logger=require(_0xc5fd('0x7'))(_0xc5fd('0x8'));var config=require(_0xc5fd('0x9'));var jayson=require(_0xc5fd('0xa'));var client=jayson[_0xc5fd('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46dc09,_0x3c20b9,_0x1c6c40){return new BPromise(function(_0x306f32,_0xfb9343){return client[_0xc5fd('0xc')](_0x46dc09,_0x1c6c40)[_0xc5fd('0xd')](function(_0x133034){logger['info']('ScreenRecording,\x20%s,\x20%s',_0x3c20b9,_0xc5fd('0xe'));logger['debug'](_0xc5fd('0xf'),_0x3c20b9,_0xc5fd('0xe'),JSON[_0xc5fd('0x10')](_0x133034));if(_0x133034[_0xc5fd('0x11')]){if(_0x133034[_0xc5fd('0x11')]['code']===0x1f4){logger[_0xc5fd('0x11')](_0xc5fd('0x12'),_0x3c20b9,_0x133034[_0xc5fd('0x11')]['message']);return _0xfb9343(_0x133034[_0xc5fd('0x11')]['message']);}logger[_0xc5fd('0x11')](_0xc5fd('0x12'),_0x3c20b9,_0x133034[_0xc5fd('0x11')][_0xc5fd('0x13')]);return _0x306f32(_0x133034[_0xc5fd('0x11')][_0xc5fd('0x13')]);}else{logger[_0xc5fd('0x14')](_0xc5fd('0x12'),_0x3c20b9,'request\x20sent');_0x306f32(_0x133034[_0xc5fd('0x15')][_0xc5fd('0x13')]);}})[_0xc5fd('0x16')](function(_0x2696fd){logger['error'](_0xc5fd('0x12'),_0x3c20b9,_0x2696fd);_0xfb9343(_0x2696fd);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 8ceb7ce..495d91e 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 _0x15ee=['util','path','connect-timeout','Router','fs-extra','../../config/environment','./setting.controller','get','/now','getDate','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','join','server/files/images/logos/','format','%s%s','extname','post','single','file','addLogo','logologin','originalname','addLogoLogin','root','addPreferred','favicon','addFavicon','put','/:id','isAuthenticated','update','exports'];(function(_0x2bfe4a,_0x56489a){var _0x4ce1ed=function(_0x2a2cdd){while(--_0x2a2cdd){_0x2bfe4a['push'](_0x2bfe4a['shift']());}};_0x4ce1ed(++_0x56489a);}(_0x15ee,0x7b));var _0xe15e=function(_0x35dc6a,_0x273cf4){_0x35dc6a=_0x35dc6a-0x0;var _0x38425c=_0x15ee[_0x35dc6a];return _0x38425c;};'use strict';var multer=require('multer');var util=require(_0xe15e('0x0'));var path=require(_0xe15e('0x1'));var timeout=require(_0xe15e('0x2'));var express=require('express');var router=express[_0xe15e('0x3')]();var fs_extra=require(_0xe15e('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe15e('0x5'));var controller=require(_0xe15e('0x6'));router[_0xe15e('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe15e('0x7')](_0xe15e('0x8'),controller[_0xe15e('0x9')]);router[_0xe15e('0x7')]('/:id',controller[_0xe15e('0xa')]);router['get'](_0xe15e('0xb'),controller[_0xe15e('0xc')]);router[_0xe15e('0x7')](_0xe15e('0xd'),controller[_0xe15e('0xe')]);router[_0xe15e('0x7')]('/:id/gdpr',controller[_0xe15e('0xf')]);router['get'](_0xe15e('0x10'),controller['getPreferred']);router[_0xe15e('0x7')](_0xe15e('0x11'),controller[_0xe15e('0x12')]);var upload=multer({'storage':multer[_0xe15e('0x13')]({'destination':function(_0x9ee0fa,_0x2ff123,_0x1b042c){_0x1b042c(null,path[_0xe15e('0x14')](config['root'],_0xe15e('0x15')));},'filename':function(_0x3a84c8,_0x2d0e71,_0x10feaa){_0x10feaa(null,util[_0xe15e('0x16')](_0xe15e('0x17'),'logo',path[_0xe15e('0x18')](_0x2d0e71['originalname'])));}})});router[_0xe15e('0x19')](_0xe15e('0xb'),upload[_0xe15e('0x1a')](_0xe15e('0x1b')),controller[_0xe15e('0x1c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x12ae64,_0x39bd49,_0x5f49e7){_0x5f49e7(null,path['join'](config['root'],_0xe15e('0x15')));},'filename':function(_0x9d3498,_0x1dbf6e,_0x2b7878){_0x2b7878(null,util[_0xe15e('0x16')]('%s%s',_0xe15e('0x1d'),path[_0xe15e('0x18')](_0x1dbf6e[_0xe15e('0x1e')])));}})});router['post']('/:id/logo_login',upload[_0xe15e('0x1a')](_0xe15e('0x1b')),controller[_0xe15e('0x1f')]);var upload=multer({'storage':multer[_0xe15e('0x13')]({'destination':function(_0x283316,_0x169848,_0x12a329){_0x12a329(null,path['join'](config[_0xe15e('0x20')],'server/files/images/logos/'));},'filename':function(_0x1382be,_0x10cb77,_0x1ce6b2){_0x1ce6b2(null,util['format']('%s%s','preferred',path['extname'](_0x10cb77['originalname'])));}})});router[_0xe15e('0x19')]('/:id/preferred',upload['single']('file'),controller[_0xe15e('0x21')]);var upload=multer({'storage':multer[_0xe15e('0x13')]({'destination':function(_0x4a502b,_0x3155c6,_0x22eb3a){_0x22eb3a(null,path[_0xe15e('0x14')](config[_0xe15e('0x20')],'server/files/images/logos/'));},'filename':function(_0x24c32a,_0x2b5143,_0x155af2){_0x155af2(null,util[_0xe15e('0x16')](_0xe15e('0x17'),_0xe15e('0x22'),path[_0xe15e('0x18')](_0x2b5143[_0xe15e('0x1e')])));}})});router['post'](_0xe15e('0x11'),upload[_0xe15e('0x1a')](_0xe15e('0x1b')),controller[_0xe15e('0x23')]);router[_0xe15e('0x24')](_0xe15e('0x25'),auth[_0xe15e('0x26')](),controller[_0xe15e('0x27')]);module[_0xe15e('0x28')]=router; \ No newline at end of file +var _0xc71d=['format','logo','extname','originalname','addLogo','%s%s','logologin','post','file','single','addPreferred','/:id/favicon','addFavicon','put','isAuthenticated','update','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./setting.controller','get','index','/now','getDate','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','join','root','server/files/images/logos/'];(function(_0x13202e,_0x51c85c){var _0x23ed9c=function(_0x32c5ff){while(--_0x32c5ff){_0x13202e['push'](_0x13202e['shift']());}};_0x23ed9c(++_0x51c85c);}(_0xc71d,0xe3));var _0xdc71=function(_0x5756c6,_0x58290a){_0x5756c6=_0x5756c6-0x0;var _0x4b5806=_0xc71d[_0x5756c6];return _0x4b5806;};'use strict';var multer=require('multer');var util=require(_0xdc71('0x0'));var path=require(_0xdc71('0x1'));var timeout=require('connect-timeout');var express=require(_0xdc71('0x2'));var router=express[_0xdc71('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdc71('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdc71('0x5'));var controller=require(_0xdc71('0x6'));router[_0xdc71('0x7')]('/',auth['isAuthenticated'](),controller[_0xdc71('0x8')]);router[_0xdc71('0x7')](_0xdc71('0x9'),controller[_0xdc71('0xa')]);router['get'](_0xdc71('0xb'),controller[_0xdc71('0xc')]);router[_0xdc71('0x7')](_0xdc71('0xd'),controller['getLogo']);router[_0xdc71('0x7')](_0xdc71('0xe'),controller[_0xdc71('0xf')]);router[_0xdc71('0x7')](_0xdc71('0x10'),controller[_0xdc71('0x11')]);router[_0xdc71('0x7')](_0xdc71('0x12'),controller[_0xdc71('0x13')]);router[_0xdc71('0x7')]('/:id/favicon',controller[_0xdc71('0x14')]);var upload=multer({'storage':multer[_0xdc71('0x15')]({'destination':function(_0x442e51,_0x48f850,_0xfb66a7){_0xfb66a7(null,path[_0xdc71('0x16')](config[_0xdc71('0x17')],_0xdc71('0x18')));},'filename':function(_0x56efc3,_0x49f326,_0x53bf90){_0x53bf90(null,util[_0xdc71('0x19')]('%s%s',_0xdc71('0x1a'),path[_0xdc71('0x1b')](_0x49f326[_0xdc71('0x1c')])));}})});router['post'](_0xdc71('0xd'),upload['single']('file'),controller[_0xdc71('0x1d')]);var upload=multer({'storage':multer[_0xdc71('0x15')]({'destination':function(_0x363b80,_0x3793d3,_0x15b4fe){_0x15b4fe(null,path[_0xdc71('0x16')](config[_0xdc71('0x17')],_0xdc71('0x18')));},'filename':function(_0x2600ec,_0x2c1249,_0x89ed06){_0x89ed06(null,util[_0xdc71('0x19')](_0xdc71('0x1e'),_0xdc71('0x1f'),path['extname'](_0x2c1249[_0xdc71('0x1c')])));}})});router[_0xdc71('0x20')](_0xdc71('0xe'),upload['single'](_0xdc71('0x21')),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5f02b2,_0x20068e,_0x548b8f){_0x548b8f(null,path[_0xdc71('0x16')](config[_0xdc71('0x17')],_0xdc71('0x18')));},'filename':function(_0x28ea55,_0xf4a4e7,_0x3eac7e){_0x3eac7e(null,util['format']('%s%s','preferred',path['extname'](_0xf4a4e7['originalname'])));}})});router[_0xdc71('0x20')]('/:id/preferred',upload[_0xdc71('0x22')]('file'),controller[_0xdc71('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2f36d7,_0x2c3ab1,_0x3ad8f8){_0x3ad8f8(null,path[_0xdc71('0x16')](config[_0xdc71('0x17')],'server/files/images/logos/'));},'filename':function(_0x6fe3d1,_0x104aef,_0xb55ef3){_0xb55ef3(null,util['format']('%s%s','favicon',path['extname'](_0x104aef[_0xdc71('0x1c')])));}})});router[_0xdc71('0x20')](_0xdc71('0x24'),upload['single'](_0xdc71('0x21')),controller[_0xdc71('0x25')]);router[_0xdc71('0x26')]('/:id',auth[_0xdc71('0x27')](),controller[_0xdc71('0x28')]);module[_0xdc71('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 2664ca5..7e1d9f6 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 _0x0b0e=['INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','UNSIGNED','sequelize'];(function(_0x17d715,_0x20e4b1){var _0x8b7ecf=function(_0x13b0ac){while(--_0x13b0ac){_0x17d715['push'](_0x17d715['shift']());}};_0x8b7ecf(++_0x20e4b1);}(_0x0b0e,0x187));var _0xe0b0=function(_0x323d87,_0x4ef3f9){_0x323d87=_0x323d87-0x0;var _0x5e8f74=_0x0b0e[_0x323d87];return _0x5e8f74;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0xe0b0('0x1')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xe0b0('0x1')](0xb),'unique':_0xe0b0('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xe0b0('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xe0b0('0x3')],'defaultValue':_0xe0b0('0x4')},'logo':{'type':Sequelize[_0xe0b0('0x3')]},'defaultLogo':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xe0b0('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xe0b0('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xe0b0('0x3')]},'turnaddr':{'type':Sequelize[_0xe0b0('0x3')]},'turnusername':{'type':Sequelize[_0xe0b0('0x3')]},'turnpassword':{'type':Sequelize[_0xe0b0('0x3')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xe0b0('0x3')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xe0b0('0x3')],'defaultValue':_0xe0b0('0x6')},'chatTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xe0b0('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0xe0b0('0x3')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xe0b0('0x1')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0xe0b0('0x3')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0xe0b0('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xe0b0('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xe0b0('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7a54=['UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate'];(function(_0x4db3d3,_0x383dcb){var _0x38fa58=function(_0x481e79){while(--_0x481e79){_0x4db3d3['push'](_0x4db3d3['shift']());}};_0x38fa58(++_0x383dcb);}(_0x7a54,0x106));var _0x47a5=function(_0x512b58,_0x14bac4){_0x512b58=_0x512b58-0x0;var _0x46f641=_0x7a54[_0x512b58];return _0x46f641;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'min_internal':{'type':Sequelize[_0x47a5('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x47a5('0x2')](0xb),'unique':_0x47a5('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x47a5('0x4')],'defaultValue':_0x47a5('0x5')},'logo':{'type':Sequelize[_0x47a5('0x4')]},'defaultLogo':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x47a5('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x47a5('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x47a5('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x47a5('0x4')],'defaultValue':_0x47a5('0x7')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x47a5('0x4')]},'defaultPreferred':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x47a5('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x47a5('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x47a5('0x2')]},'transcribeRegion':{'type':Sequelize[_0x47a5('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x47a5('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x47a5('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x47a5('0x2')](0x2)[_0x47a5('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x47a5('0x2')](0x2)[_0x47a5('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x47a5('0x2')](0x2)[_0x47a5('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x47a5('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index cf2ae12..3536d89 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 _0x7233=['defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','upperFirst','custom','existsSync','Sequelize','ValidationError','getLicense','preferred','default','\x20not\x20found','download','securePassword','addPreferred','getPreferred','default_preferred.png','getFavicon','default_favicon.ico','getDate','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','http','then','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','json','undefined','limit','offset','set','Content-Range','apply','save','update','end','name','send','map','Setting','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','rows','show','params','keys','body','addLogo','file','filename','logo','find','loginLogo','../../config/license/util','server/files/images/logos','favicon','defaultLogo','defaultLoginLogo'];(function(_0x3d5652,_0x3b7b99){var _0x9b36fe=function(_0x4dedd6){while(--_0x4dedd6){_0x3d5652['push'](_0x3d5652['shift']());}};_0x9b36fe(++_0x3b7b99);}(_0x7233,0x8d));var _0x3723=function(_0x19c3ed,_0x1ec992){_0x19c3ed=_0x19c3ed-0x0;var _0x1401bc=_0x7233[_0x19c3ed];return _0x1401bc;};'use strict';var emlformat=require(_0x3723('0x0'));var rimraf=require(_0x3723('0x1'));var zipdir=require(_0x3723('0x2'));var jsonpatch=require(_0x3723('0x3'));var rp=require(_0x3723('0x4'));var moment=require(_0x3723('0x5'));var BPromise=require(_0x3723('0x6'));var Mustache=require(_0x3723('0x7'));var util=require(_0x3723('0x8'));var path=require(_0x3723('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3723('0xa'));var crypto=require(_0x3723('0xb'));var jsforce=require(_0x3723('0xc'));var deskjs=require(_0x3723('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3723('0xe'));var Redis=require(_0x3723('0xf'));var authService=require(_0x3723('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3723('0x11'));var logger=require(_0x3723('0x12'))(_0x3723('0x13'));var utils=require(_0x3723('0x14'));var config=require(_0x3723('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3723('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x3723('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x3a2ea2,_0x17645a,_0x2d194f,_0x3c16eb){return new BPromise(function(_0x576200,_0x324400){var _0x21dbcd=_0x3c16eb||client;return _0x21dbcd['request'](_0x3a2ea2,_0x2d194f)[_0x3723('0x18')](function(_0x1bf37c){logger['info'](_0x3723('0x19'),_0x17645a,_0x3723('0x1a'));logger['debug'](_0x3723('0x1b'),_0x17645a,_0x3723('0x1a'),JSON['stringify'](_0x1bf37c));if(_0x1bf37c[_0x3723('0x1c')]){if(_0x1bf37c['error'][_0x3723('0x1d')]===0x1f4){logger[_0x3723('0x1c')](_0x3723('0x19'),_0x17645a,_0x1bf37c[_0x3723('0x1c')]['message']);return _0x324400(_0x1bf37c['error']['message']);}logger['error'](_0x3723('0x19'),_0x17645a,_0x1bf37c[_0x3723('0x1c')][_0x3723('0x1e')]);return _0x576200(_0x1bf37c[_0x3723('0x1c')][_0x3723('0x1e')]);}else{logger[_0x3723('0x1f')](_0x3723('0x19'),_0x17645a,_0x3723('0x1a'));_0x576200(_0x1bf37c[_0x3723('0x20')]['message']);}})[_0x3723('0x21')](function(_0x3eefb6){logger['error'](_0x3723('0x19'),_0x17645a,_0x3eefb6);_0x324400(_0x3eefb6);});});}function respondWithStatusCode(_0x345b47,_0x3ccd4a){_0x3ccd4a=_0x3ccd4a||0xcc;return function(_0x5a0263){if(_0x5a0263){return _0x345b47[_0x3723('0x22')](_0x3ccd4a);}return _0x345b47['status'](_0x3ccd4a)['end']();};}function respondWithResult(_0x6e9e73,_0x360d2d){_0x360d2d=_0x360d2d||0xc8;return function(_0x5991b8){if(_0x5991b8){return _0x6e9e73[_0x3723('0x23')](_0x360d2d)[_0x3723('0x24')](_0x5991b8);}};}function respondWithFilteredResult(_0x154398,_0x5d1fc1){return function(_0x2dc93d){if(_0x2dc93d){var _0x51efa8=typeof _0x5d1fc1['offset']===_0x3723('0x25')&&typeof _0x5d1fc1[_0x3723('0x26')]==='undefined';var _0x50fbc4=_0x2dc93d['count'];var _0x761213=_0x51efa8?0x0:_0x5d1fc1['offset'];var _0x1b596a=_0x51efa8?_0x2dc93d['count']:_0x5d1fc1[_0x3723('0x27')]+_0x5d1fc1[_0x3723('0x26')];var _0x17ddc2;if(_0x1b596a>=_0x50fbc4){_0x1b596a=_0x50fbc4;_0x17ddc2=0xc8;}else{_0x17ddc2=0xce;}_0x154398[_0x3723('0x23')](_0x17ddc2);return _0x154398[_0x3723('0x28')](_0x3723('0x29'),_0x761213+'-'+_0x1b596a+'/'+_0x50fbc4)[_0x3723('0x24')](_0x2dc93d);}return null;};}function patchUpdates(_0x53401e){return function(_0x52f8fa){try{jsonpatch[_0x3723('0x2a')](_0x52f8fa,_0x53401e,!![]);}catch(_0x2e92ac){return BPromise['reject'](_0x2e92ac);}return _0x52f8fa[_0x3723('0x2b')]();};}function saveUpdates(_0x584169,_0x1d0a72){return function(_0x5e5725){if(_0x5e5725){return _0x5e5725[_0x3723('0x2c')](_0x584169)[_0x3723('0x18')](function(_0xffdabe){return _0xffdabe;});}return null;};}function removeEntity(_0x57071f,_0x2b49ba){return function(_0x476e49){if(_0x476e49){return _0x476e49['destroy']()[_0x3723('0x18')](function(){_0x57071f[_0x3723('0x23')](0xcc)[_0x3723('0x2d')]();});}};}function handleEntityNotFound(_0x58baf4,_0x12a926){return function(_0x4ee091){if(!_0x4ee091){_0x58baf4[_0x3723('0x22')](0x194);}return _0x4ee091;};}function handleError(_0x166ff0,_0x4e687a){_0x4e687a=_0x4e687a||0x1f4;return function(_0x57f832){logger[_0x3723('0x1c')](_0x57f832['stack']);if(_0x57f832[_0x3723('0x2e')]){delete _0x57f832[_0x3723('0x2e')];}_0x166ff0[_0x3723('0x23')](_0x4e687a)[_0x3723('0x2f')](_0x57f832);};}exports['index']=function(_0x111d78,_0x24f2ab){var _0x3545fd={},_0x3f06b5={},_0x5fc772={'count':0x0,'rows':[]};var _0x11f4df=_[_0x3723('0x30')](db[_0x3723('0x31')][_0x3723('0x32')],function(_0x172b17){return{'name':_0x172b17[_0x3723('0x33')],'type':_0x172b17[_0x3723('0x34')][_0x3723('0x35')]};});_0x3f06b5[_0x3723('0x36')]=_['map'](_0x11f4df,_0x3723('0x2e'));_0x3f06b5[_0x3723('0x37')]=_['keys'](_0x111d78[_0x3723('0x37')]);_0x3f06b5[_0x3723('0x38')]=_[_0x3723('0x39')](_0x3f06b5[_0x3723('0x36')],_0x3f06b5[_0x3723('0x37')]);_0x3545fd[_0x3723('0x3a')]=_[_0x3723('0x39')](_0x3f06b5[_0x3723('0x36')],qs[_0x3723('0x3b')](_0x111d78[_0x3723('0x37')]['fields']));_0x3545fd[_0x3723('0x3a')]=_0x3545fd['attributes'][_0x3723('0x3c')]?_0x3545fd[_0x3723('0x3a')]:_0x3f06b5[_0x3723('0x36')];if(!_0x111d78[_0x3723('0x37')][_0x3723('0x3d')](_0x3723('0x3e'))){_0x3545fd[_0x3723('0x26')]=qs[_0x3723('0x26')](_0x111d78[_0x3723('0x37')][_0x3723('0x26')]);_0x3545fd['offset']=qs['offset'](_0x111d78[_0x3723('0x37')][_0x3723('0x27')]);}_0x3545fd[_0x3723('0x3f')]=qs[_0x3723('0x40')](_0x111d78['query'][_0x3723('0x40')]);_0x3545fd[_0x3723('0x41')]=qs[_0x3723('0x38')](_[_0x3723('0x42')](_0x111d78['query'],_0x3f06b5['filters']),_0x11f4df);if(_0x111d78[_0x3723('0x37')][_0x3723('0x43')]){_0x3545fd[_0x3723('0x41')]=_[_0x3723('0x44')](_0x3545fd[_0x3723('0x41')],{'$or':_['map'](_0x11f4df,function(_0xf43bff){if(_0xf43bff[_0x3723('0x34')]!==_0x3723('0x45')){var _0x1b320d={};_0x1b320d[_0xf43bff[_0x3723('0x2e')]]={'$like':'%'+_0x111d78['query'][_0x3723('0x43')]+'%'};return _0x1b320d;}})});}_0x3545fd=_[_0x3723('0x44')]({},_0x3545fd,_0x111d78[_0x3723('0x46')]);var _0x58280d={'where':_0x3545fd[_0x3723('0x41')]};return db[_0x3723('0x31')][_0x3723('0x47')](_0x58280d)[_0x3723('0x18')](function(_0x256259){_0x5fc772['count']=_0x256259;if(_0x111d78[_0x3723('0x37')][_0x3723('0x48')]){_0x3545fd['include']=[{'all':!![]}];}return db[_0x3723('0x31')]['findAll'](_0x3545fd);})['then'](function(_0x586c89){_0x5fc772[_0x3723('0x49')]=_0x586c89;return _0x5fc772;})[_0x3723('0x18')](respondWithFilteredResult(_0x24f2ab,_0x3545fd))[_0x3723('0x21')](handleError(_0x24f2ab,null));};exports[_0x3723('0x4a')]=function(_0x541723,_0x562c8b){var _0x2d9f60={'raw':![],'where':{'id':_0x541723[_0x3723('0x4b')]['id']}},_0x49c2c1={};_0x49c2c1[_0x3723('0x36')]=_['keys'](db[_0x3723('0x31')]['rawAttributes']);_0x49c2c1[_0x3723('0x37')]=_[_0x3723('0x4c')](_0x541723['query']);_0x49c2c1[_0x3723('0x38')]=_[_0x3723('0x39')](_0x49c2c1[_0x3723('0x36')],_0x49c2c1['query']);_0x2d9f60[_0x3723('0x3a')]=_[_0x3723('0x39')](_0x49c2c1[_0x3723('0x36')],qs[_0x3723('0x3b')](_0x541723['query'][_0x3723('0x3b')]));_0x2d9f60[_0x3723('0x3a')]=_0x2d9f60[_0x3723('0x3a')][_0x3723('0x3c')]?_0x2d9f60[_0x3723('0x3a')]:_0x49c2c1['model'];if(_0x541723[_0x3723('0x37')]['includeAll']){_0x2d9f60['include']=[{'all':!![]}];}_0x2d9f60=_[_0x3723('0x44')]({},_0x2d9f60,_0x541723[_0x3723('0x46')]);return db[_0x3723('0x31')]['find'](_0x2d9f60)[_0x3723('0x18')](handleEntityNotFound(_0x562c8b,null))[_0x3723('0x18')](respondWithResult(_0x562c8b,null))[_0x3723('0x21')](handleError(_0x562c8b,null));};exports[_0x3723('0x2c')]=function(_0x5cf80c,_0x5b1041){if(_0x5cf80c[_0x3723('0x4d')]['id']){delete _0x5cf80c[_0x3723('0x4d')]['id'];}return db[_0x3723('0x31')]['find']({'where':{'id':_0x5cf80c[_0x3723('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5b1041,null))[_0x3723('0x18')](saveUpdates(_0x5cf80c[_0x3723('0x4d')],null))[_0x3723('0x18')](respondWithResult(_0x5b1041,null))[_0x3723('0x21')](handleError(_0x5b1041,null));};exports[_0x3723('0x4e')]=function(_0x49a9dd,_0x5430fb,_0xc028f1){if(_0x49a9dd[_0x3723('0x4f')]&&_0x49a9dd[_0x3723('0x4f')][_0x3723('0x50')]){_0x49a9dd[_0x3723('0x4d')][_0x3723('0x51')]=_0x49a9dd[_0x3723('0x4f')]['filename'];}return db[_0x3723('0x31')][_0x3723('0x52')]({'where':{'id':_0x49a9dd[_0x3723('0x4b')]['id']}})[_0x3723('0x18')](handleEntityNotFound(_0x5430fb,null))[_0x3723('0x18')](saveUpdates(_0x49a9dd['body'],null))[_0x3723('0x18')](respondWithResult(_0x5430fb,null))['catch'](handleError(_0x5430fb,null));};exports['addLogoLogin']=function(_0x5abb7a,_0x354e11,_0x4e6dc8){if(_0x5abb7a[_0x3723('0x4f')]&&_0x5abb7a['file']['filename']){_0x5abb7a[_0x3723('0x4d')][_0x3723('0x53')]=_0x5abb7a[_0x3723('0x4f')][_0x3723('0x50')];}return db[_0x3723('0x31')][_0x3723('0x52')]({'where':{'id':_0x5abb7a['params']['id']}})[_0x3723('0x18')](handleEntityNotFound(_0x354e11,null))['then'](saveUpdates(_0x5abb7a[_0x3723('0x4d')],null))[_0x3723('0x18')](respondWithResult(_0x354e11,null))[_0x3723('0x21')](handleError(_0x354e11,null));};var utilLicense=require(_0x3723('0x54'));exports['getLogo']=function(_0x29c027,_0x2832b5,_0x1ef2ca){var _0x3f79a7=_0x3723('0x55');var _0x7c762={'custom':![]};return utilLicense['getLicense']()[_0x3723('0x18')](function(_0x23d75d){if(_0x23d75d){_0x7c762=_0x23d75d;}return db[_0x3723('0x31')]['find']({'where':{'id':_0x29c027[_0x3723('0x4b')]['id']},'attributes':[_0x3723('0x51'),'loginLogo','preferred',_0x3723('0x56'),_0x3723('0x57'),_0x3723('0x58'),_0x3723('0x59'),_0x3723('0x5a')],'raw':!![]});})[_0x3723('0x18')](handleEntityNotFound(_0x2832b5,null))['then'](function(_0x1e0c65){if(_0x1e0c65){var _0x458527=_0x1e0c65['logo']&&fs['existsSync'](path[_0x3723('0x5b')](config[_0x3723('0x5c')],_0x3f79a7,_['toLower'](_0x1e0c65['logo'])))?path[_0x3723('0x5b')](config[_0x3723('0x5c')],_0x3f79a7,_[_0x3723('0x5d')](_0x1e0c65[_0x3723('0x51')])):path[_0x3723('0x5b')](config['root'],_0x3f79a7,_[_0x3723('0x5d')](_0x3723('0x5e')));var _0x4e7caa='default'+_[_0x3723('0x5f')](_0x3723('0x51'));if(_0x1e0c65[_0x4e7caa]||!_0x7c762[_0x3723('0x60')]){_0x458527=path['join'](config[_0x3723('0x5c')],_0x3f79a7,_[_0x3723('0x5d')](_0x3723('0x5e')));}if(!fs[_0x3723('0x61')](_0x458527)){throw new db[(_0x3723('0x62'))][(_0x3723('0x63'))](_[_0x3723('0x5f')](_0x3723('0x51'))+'\x20not\x20found');}return _0x2832b5['download'](_0x458527);}})['catch'](handleError(_0x2832b5,null));};var utilLicense=require(_0x3723('0x54'));exports['getLogoLogin']=function(_0x4222e7,_0x329f18,_0x455c33){var _0x38bcb='server/files/images/logos';var _0x2959e2={'custom':![]};return utilLicense[_0x3723('0x64')]()[_0x3723('0x18')](function(_0x31f8f2){if(_0x31f8f2){_0x2959e2=_0x31f8f2;}return db[_0x3723('0x31')][_0x3723('0x52')]({'where':{'id':_0x4222e7[_0x3723('0x4b')]['id']},'attributes':[_0x3723('0x51'),_0x3723('0x53'),_0x3723('0x65'),_0x3723('0x56'),'defaultLogo','defaultLoginLogo','defaultPreferred',_0x3723('0x5a')],'raw':!![]});})[_0x3723('0x18')](handleEntityNotFound(_0x329f18,null))[_0x3723('0x18')](function(_0x1f32b5){if(_0x1f32b5){var _0x20da7b=_0x1f32b5[_0x3723('0x53')]&&fs['existsSync'](path[_0x3723('0x5b')](config[_0x3723('0x5c')],_0x38bcb,_[_0x3723('0x5d')](_0x1f32b5['loginLogo'])))?path[_0x3723('0x5b')](config[_0x3723('0x5c')],_0x38bcb,_[_0x3723('0x5d')](_0x1f32b5[_0x3723('0x53')])):path[_0x3723('0x5b')](config[_0x3723('0x5c')],_0x38bcb,_[_0x3723('0x5d')]('default_loginLogo.svg'));var _0x4726bd=_0x3723('0x66')+_[_0x3723('0x5f')](_0x3723('0x53'));if(_0x1f32b5[_0x4726bd]||!_0x2959e2['custom']){_0x20da7b=path[_0x3723('0x5b')](config['root'],_0x38bcb,_[_0x3723('0x5d')]('default_loginLogo.svg'));}if(!fs[_0x3723('0x61')](_0x20da7b)){throw new db[(_0x3723('0x62'))][(_0x3723('0x63'))](_[_0x3723('0x5f')]('loginLogo')+_0x3723('0x67'));}return _0x329f18[_0x3723('0x68')](_0x20da7b);}})[_0x3723('0x21')](handleError(_0x329f18,null));};exports['gdpr']=function(_0x1b2f76,_0x2e7755){return db[_0x3723('0x31')][_0x3723('0x52')]({'where':{'id':_0x1b2f76[_0x3723('0x4b')]['id']},'attributes':[_0x3723('0x69')]})[_0x3723('0x18')](respondWithResult(_0x2e7755,null))[_0x3723('0x21')](handleError(_0x2e7755,null));};exports[_0x3723('0x6a')]=function(_0x151658,_0x33b354,_0x14f3f1){if(_0x151658[_0x3723('0x4f')]&&_0x151658[_0x3723('0x4f')]['filename']){_0x151658[_0x3723('0x4d')][_0x3723('0x65')]=_0x151658[_0x3723('0x4f')]['filename'];}return db[_0x3723('0x31')][_0x3723('0x52')]({'where':{'id':_0x151658[_0x3723('0x4b')]['id']}})[_0x3723('0x18')](handleEntityNotFound(_0x33b354,null))[_0x3723('0x18')](saveUpdates(_0x151658[_0x3723('0x4d')],null))['then'](respondWithResult(_0x33b354,null))['catch'](handleError(_0x33b354,null));};var utilLicense=require('../../config/license/util');exports[_0x3723('0x6b')]=function(_0x310f68,_0x2e460f,_0x7478cd){var _0xdc5326=_0x3723('0x55');var _0x4d6cb4={'custom':![]};return utilLicense['getLicense']()[_0x3723('0x18')](function(_0xfd5447){if(_0xfd5447){_0x4d6cb4=_0xfd5447;}return db[_0x3723('0x31')]['find']({'where':{'id':_0x310f68[_0x3723('0x4b')]['id']},'attributes':[_0x3723('0x51'),_0x3723('0x53'),_0x3723('0x65'),_0x3723('0x56'),'defaultLogo',_0x3723('0x58'),'defaultPreferred',_0x3723('0x5a')],'raw':!![]});})[_0x3723('0x18')](handleEntityNotFound(_0x2e460f,null))[_0x3723('0x18')](function(_0x3a24d0){if(_0x3a24d0){var _0x3e1e18=_0x3a24d0['preferred']&&fs[_0x3723('0x61')](path[_0x3723('0x5b')](config[_0x3723('0x5c')],_0xdc5326,_[_0x3723('0x5d')](_0x3a24d0[_0x3723('0x65')])))?path[_0x3723('0x5b')](config[_0x3723('0x5c')],_0xdc5326,_[_0x3723('0x5d')](_0x3a24d0[_0x3723('0x65')])):path[_0x3723('0x5b')](config[_0x3723('0x5c')],_0xdc5326,_[_0x3723('0x5d')](_0x3723('0x6c')));var _0x185ca6='default'+_[_0x3723('0x5f')](_0x3723('0x65'));if(_0x3a24d0[_0x185ca6]||!_0x4d6cb4[_0x3723('0x60')]||!_0x4d6cb4[_0x3723('0x65')]){_0x3e1e18=path[_0x3723('0x5b')](config[_0x3723('0x5c')],_0xdc5326,_[_0x3723('0x5d')](_0x3723('0x6c')));}if(!fs[_0x3723('0x61')](_0x3e1e18)){throw new db[(_0x3723('0x62'))]['ValidationError'](_[_0x3723('0x5f')](_0x3723('0x65'))+_0x3723('0x67'));}return _0x2e460f[_0x3723('0x68')](_0x3e1e18);}})[_0x3723('0x21')](handleError(_0x2e460f,null));};exports['addFavicon']=function(_0x424156,_0x3562bc,_0x4dbfed){if(_0x424156[_0x3723('0x4f')]&&_0x424156[_0x3723('0x4f')][_0x3723('0x50')]){_0x424156[_0x3723('0x4d')][_0x3723('0x56')]=_0x424156['file']['filename'];}return db['Setting'][_0x3723('0x52')]({'where':{'id':_0x424156[_0x3723('0x4b')]['id']}})[_0x3723('0x18')](handleEntityNotFound(_0x3562bc,null))[_0x3723('0x18')](saveUpdates(_0x424156[_0x3723('0x4d')],null))[_0x3723('0x18')](respondWithResult(_0x3562bc,null))[_0x3723('0x21')](handleError(_0x3562bc,null));};var utilLicense=require(_0x3723('0x54'));exports[_0x3723('0x6d')]=function(_0x28008c,_0x460aee,_0x3d33b9){var _0x21f01f=_0x3723('0x55');var _0x3442bc={'custom':![]};return utilLicense[_0x3723('0x64')]()['then'](function(_0x575d1a){if(_0x575d1a){_0x3442bc=_0x575d1a;}return db[_0x3723('0x31')][_0x3723('0x52')]({'where':{'id':_0x28008c[_0x3723('0x4b')]['id']},'attributes':[_0x3723('0x51'),_0x3723('0x53'),_0x3723('0x65'),'favicon',_0x3723('0x57'),_0x3723('0x58'),_0x3723('0x59'),_0x3723('0x5a')],'raw':!![]});})[_0x3723('0x18')](handleEntityNotFound(_0x460aee,null))[_0x3723('0x18')](function(_0x486328){if(_0x486328){var _0x410ed0=_0x486328[_0x3723('0x56')]&&fs['existsSync'](path[_0x3723('0x5b')](config[_0x3723('0x5c')],_0x21f01f,_[_0x3723('0x5d')](_0x486328[_0x3723('0x56')])))?path['join'](config[_0x3723('0x5c')],_0x21f01f,_[_0x3723('0x5d')](_0x486328[_0x3723('0x56')])):path['join'](config[_0x3723('0x5c')],_0x21f01f,_[_0x3723('0x5d')]('default_favicon.ico'));var _0x2f6d79=_0x3723('0x66')+_[_0x3723('0x5f')]('favicon');if(_0x486328[_0x2f6d79]||!_0x3442bc[_0x3723('0x60')]){_0x410ed0=path['join'](config[_0x3723('0x5c')],_0x21f01f,_[_0x3723('0x5d')](_0x3723('0x6e')));}if(!fs[_0x3723('0x61')](_0x410ed0)){throw new db[(_0x3723('0x62'))]['ValidationError'](_[_0x3723('0x5f')](_0x3723('0x56'))+_0x3723('0x67'));}return _0x460aee[_0x3723('0x68')](_0x410ed0);}})['catch'](handleError(_0x460aee,null));};exports[_0x3723('0x6f')]=function(_0x63bf9,_0x27a45d){var _0x282250={'offset':moment()[_0x3723('0x70')]()};_0x282250[_0x3723('0x71')]=moment()[_0x3723('0x70')](_0x282250[_0x3723('0x27')])['format'](_0x3723('0x72'));return _0x27a45d[_0x3723('0x23')](0xc8)['send'](_0x282250);}; \ No newline at end of file +var _0x7c06=['custom','Sequelize','ValidationError','\x20not\x20found','download','../../config/license/util','loginLogo','defaultLogo','defaultFavicon','default_loginLogo.svg','gdpr','securePassword','addPreferred','getLicense','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','now','utcOffset','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','client','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','json','undefined','limit','count','offset','set','Content-Range','reject','save','stack','name','send','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','VIRTUAL','merge','options','findAll','params','includeAll','include','update','body','addLogo','file','filename','logo','find','server/files/images/logos','preferred','favicon','defaultLoginLogo','defaultPreferred','existsSync','join','root','toLower','default_logo.svg','default','upperFirst'];(function(_0x28ea64,_0x465ced){var _0x589ab7=function(_0x2bf7a1){while(--_0x2bf7a1){_0x28ea64['push'](_0x28ea64['shift']());}};_0x589ab7(++_0x465ced);}(_0x7c06,0x8e));var _0x67c0=function(_0x52a1be,_0x49f576){_0x52a1be=_0x52a1be-0x0;var _0x598cff=_0x7c06[_0x52a1be];return _0x598cff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x67c0('0x0'));var zipdir=require(_0x67c0('0x1'));var jsonpatch=require(_0x67c0('0x2'));var rp=require('request-promise');var moment=require(_0x67c0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x67c0('0x4'));var util=require(_0x67c0('0x5'));var path=require('path');var sox=require(_0x67c0('0x6'));var csv=require(_0x67c0('0x7'));var ejs=require(_0x67c0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x67c0('0x9'));var squel=require(_0x67c0('0xa'));var crypto=require(_0x67c0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x67c0('0xc'));var toCsv=require(_0x67c0('0x7'));var querystring=require(_0x67c0('0xd'));var Papa=require(_0x67c0('0xe'));var Redis=require('ioredis');var authService=require(_0x67c0('0xf'));var qs=require(_0x67c0('0x10'));var as=require(_0x67c0('0x11'));var hardwareService=require(_0x67c0('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x67c0('0x13'));var config=require(_0x67c0('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x67c0('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x67c0('0x16')][_0x67c0('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x2a6599,_0x521af0,_0x109e1b,_0x252bd1){return new BPromise(function(_0x1338dd,_0x929585){var _0xee12c1=_0x252bd1||client;return _0xee12c1[_0x67c0('0x18')](_0x2a6599,_0x109e1b)[_0x67c0('0x19')](function(_0xa9bd7a){logger[_0x67c0('0x1a')]('Setting,\x20%s,\x20%s',_0x521af0,_0x67c0('0x1b'));logger[_0x67c0('0x1c')](_0x67c0('0x1d'),_0x521af0,_0x67c0('0x1b'),JSON[_0x67c0('0x1e')](_0xa9bd7a));if(_0xa9bd7a['error']){if(_0xa9bd7a[_0x67c0('0x1f')][_0x67c0('0x20')]===0x1f4){logger['error'](_0x67c0('0x21'),_0x521af0,_0xa9bd7a['error'][_0x67c0('0x22')]);return _0x929585(_0xa9bd7a[_0x67c0('0x1f')]['message']);}logger[_0x67c0('0x1f')]('Setting,\x20%s,\x20%s',_0x521af0,_0xa9bd7a[_0x67c0('0x1f')][_0x67c0('0x22')]);return _0x1338dd(_0xa9bd7a['error'][_0x67c0('0x22')]);}else{logger[_0x67c0('0x1a')](_0x67c0('0x21'),_0x521af0,'request\x20sent');_0x1338dd(_0xa9bd7a[_0x67c0('0x23')][_0x67c0('0x22')]);}})[_0x67c0('0x24')](function(_0x201df8){logger[_0x67c0('0x1f')]('Setting,\x20%s,\x20%s',_0x521af0,_0x201df8);_0x929585(_0x201df8);});});}function respondWithStatusCode(_0x56952d,_0x27e8ea){_0x27e8ea=_0x27e8ea||0xcc;return function(_0x41e598){if(_0x41e598){return _0x56952d[_0x67c0('0x25')](_0x27e8ea);}return _0x56952d['status'](_0x27e8ea)['end']();};}function respondWithResult(_0x9b8194,_0x38859e){_0x38859e=_0x38859e||0xc8;return function(_0x4344c7){if(_0x4344c7){return _0x9b8194[_0x67c0('0x26')](_0x38859e)[_0x67c0('0x27')](_0x4344c7);}};}function respondWithFilteredResult(_0xc92c7c,_0x3fa58a){return function(_0x5a7dcd){if(_0x5a7dcd){var _0x53ee2c=typeof _0x3fa58a['offset']===_0x67c0('0x28')&&typeof _0x3fa58a[_0x67c0('0x29')]===_0x67c0('0x28');var _0x5ac6de=_0x5a7dcd[_0x67c0('0x2a')];var _0x2d76a1=_0x53ee2c?0x0:_0x3fa58a[_0x67c0('0x2b')];var _0x5e9174=_0x53ee2c?_0x5a7dcd[_0x67c0('0x2a')]:_0x3fa58a['offset']+_0x3fa58a[_0x67c0('0x29')];var _0x51287d;if(_0x5e9174>=_0x5ac6de){_0x5e9174=_0x5ac6de;_0x51287d=0xc8;}else{_0x51287d=0xce;}_0xc92c7c[_0x67c0('0x26')](_0x51287d);return _0xc92c7c[_0x67c0('0x2c')](_0x67c0('0x2d'),_0x2d76a1+'-'+_0x5e9174+'/'+_0x5ac6de)[_0x67c0('0x27')](_0x5a7dcd);}return null;};}function patchUpdates(_0x592d7a){return function(_0xdffcb8){try{jsonpatch['apply'](_0xdffcb8,_0x592d7a,!![]);}catch(_0x4b49e6){return BPromise[_0x67c0('0x2e')](_0x4b49e6);}return _0xdffcb8[_0x67c0('0x2f')]();};}function saveUpdates(_0x2dd547,_0x5ef15a){return function(_0x3ac202){if(_0x3ac202){return _0x3ac202['update'](_0x2dd547)[_0x67c0('0x19')](function(_0x45b382){return _0x45b382;});}return null;};}function removeEntity(_0x422aea,_0x38c3c7){return function(_0x3b35ad){if(_0x3b35ad){return _0x3b35ad['destroy']()['then'](function(){_0x422aea[_0x67c0('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23ac35,_0x2cfa43){return function(_0x54a689){if(!_0x54a689){_0x23ac35[_0x67c0('0x25')](0x194);}return _0x54a689;};}function handleError(_0x2aa93e,_0x178ed3){_0x178ed3=_0x178ed3||0x1f4;return function(_0x5bafd6){logger[_0x67c0('0x1f')](_0x5bafd6[_0x67c0('0x30')]);if(_0x5bafd6[_0x67c0('0x31')]){delete _0x5bafd6[_0x67c0('0x31')];}_0x2aa93e[_0x67c0('0x26')](_0x178ed3)[_0x67c0('0x32')](_0x5bafd6);};}exports['index']=function(_0x27cba3,_0x539dda){var _0x4aae7d={},_0x9fffd={},_0x47cd50={'count':0x0,'rows':[]};var _0x4e794b=_[_0x67c0('0x33')](db[_0x67c0('0x34')][_0x67c0('0x35')],function(_0x1d27c4){return{'name':_0x1d27c4[_0x67c0('0x36')],'type':_0x1d27c4[_0x67c0('0x37')][_0x67c0('0x38')]};});_0x9fffd[_0x67c0('0x39')]=_[_0x67c0('0x33')](_0x4e794b,_0x67c0('0x31'));_0x9fffd[_0x67c0('0x3a')]=_[_0x67c0('0x3b')](_0x27cba3[_0x67c0('0x3a')]);_0x9fffd['filters']=_[_0x67c0('0x3c')](_0x9fffd['model'],_0x9fffd[_0x67c0('0x3a')]);_0x4aae7d['attributes']=_[_0x67c0('0x3c')](_0x9fffd[_0x67c0('0x39')],qs['fields'](_0x27cba3['query'][_0x67c0('0x3d')]));_0x4aae7d[_0x67c0('0x3e')]=_0x4aae7d[_0x67c0('0x3e')][_0x67c0('0x3f')]?_0x4aae7d[_0x67c0('0x3e')]:_0x9fffd[_0x67c0('0x39')];if(!_0x27cba3[_0x67c0('0x3a')][_0x67c0('0x40')](_0x67c0('0x41'))){_0x4aae7d[_0x67c0('0x29')]=qs[_0x67c0('0x29')](_0x27cba3[_0x67c0('0x3a')][_0x67c0('0x29')]);_0x4aae7d[_0x67c0('0x2b')]=qs[_0x67c0('0x2b')](_0x27cba3[_0x67c0('0x3a')]['offset']);}_0x4aae7d[_0x67c0('0x42')]=qs['sort'](_0x27cba3[_0x67c0('0x3a')][_0x67c0('0x43')]);_0x4aae7d['where']=qs['filters'](_[_0x67c0('0x44')](_0x27cba3[_0x67c0('0x3a')],_0x9fffd[_0x67c0('0x45')]),_0x4e794b);if(_0x27cba3['query'][_0x67c0('0x46')]){_0x4aae7d[_0x67c0('0x47')]=_['merge'](_0x4aae7d['where'],{'$or':_['map'](_0x4e794b,function(_0x2fc181){if(_0x2fc181[_0x67c0('0x37')]!==_0x67c0('0x48')){var _0x5b41d1={};_0x5b41d1[_0x2fc181['name']]={'$like':'%'+_0x27cba3[_0x67c0('0x3a')][_0x67c0('0x46')]+'%'};return _0x5b41d1;}})});}_0x4aae7d=_[_0x67c0('0x49')]({},_0x4aae7d,_0x27cba3[_0x67c0('0x4a')]);var _0x80eb07={'where':_0x4aae7d[_0x67c0('0x47')]};return db[_0x67c0('0x34')][_0x67c0('0x2a')](_0x80eb07)[_0x67c0('0x19')](function(_0x1460f6){_0x47cd50['count']=_0x1460f6;if(_0x27cba3[_0x67c0('0x3a')]['includeAll']){_0x4aae7d['include']=[{'all':!![]}];}return db[_0x67c0('0x34')][_0x67c0('0x4b')](_0x4aae7d);})[_0x67c0('0x19')](function(_0xd022d7){_0x47cd50['rows']=_0xd022d7;return _0x47cd50;})[_0x67c0('0x19')](respondWithFilteredResult(_0x539dda,_0x4aae7d))['catch'](handleError(_0x539dda,null));};exports['show']=function(_0x36d19f,_0xfe0460){var _0xab0f2c={'raw':![],'where':{'id':_0x36d19f[_0x67c0('0x4c')]['id']}},_0x11037f={};_0x11037f[_0x67c0('0x39')]=_[_0x67c0('0x3b')](db[_0x67c0('0x34')][_0x67c0('0x35')]);_0x11037f['query']=_[_0x67c0('0x3b')](_0x36d19f[_0x67c0('0x3a')]);_0x11037f[_0x67c0('0x45')]=_['intersection'](_0x11037f[_0x67c0('0x39')],_0x11037f[_0x67c0('0x3a')]);_0xab0f2c[_0x67c0('0x3e')]=_[_0x67c0('0x3c')](_0x11037f[_0x67c0('0x39')],qs['fields'](_0x36d19f[_0x67c0('0x3a')]['fields']));_0xab0f2c[_0x67c0('0x3e')]=_0xab0f2c[_0x67c0('0x3e')]['length']?_0xab0f2c[_0x67c0('0x3e')]:_0x11037f[_0x67c0('0x39')];if(_0x36d19f[_0x67c0('0x3a')][_0x67c0('0x4d')]){_0xab0f2c[_0x67c0('0x4e')]=[{'all':!![]}];}_0xab0f2c=_[_0x67c0('0x49')]({},_0xab0f2c,_0x36d19f['options']);return db[_0x67c0('0x34')]['find'](_0xab0f2c)[_0x67c0('0x19')](handleEntityNotFound(_0xfe0460,null))[_0x67c0('0x19')](respondWithResult(_0xfe0460,null))[_0x67c0('0x24')](handleError(_0xfe0460,null));};exports[_0x67c0('0x4f')]=function(_0x26c541,_0x43f6ea){if(_0x26c541[_0x67c0('0x50')]['id']){delete _0x26c541[_0x67c0('0x50')]['id'];}return db[_0x67c0('0x34')]['find']({'where':{'id':_0x26c541[_0x67c0('0x4c')]['id']}})[_0x67c0('0x19')](handleEntityNotFound(_0x43f6ea,null))[_0x67c0('0x19')](saveUpdates(_0x26c541['body'],null))[_0x67c0('0x19')](respondWithResult(_0x43f6ea,null))[_0x67c0('0x24')](handleError(_0x43f6ea,null));};exports[_0x67c0('0x51')]=function(_0x14b57b,_0x5bcbb7,_0x13b13c){if(_0x14b57b['file']&&_0x14b57b[_0x67c0('0x52')][_0x67c0('0x53')]){_0x14b57b[_0x67c0('0x50')][_0x67c0('0x54')]=_0x14b57b['file']['filename'];}return db[_0x67c0('0x34')][_0x67c0('0x55')]({'where':{'id':_0x14b57b[_0x67c0('0x4c')]['id']}})[_0x67c0('0x19')](handleEntityNotFound(_0x5bcbb7,null))[_0x67c0('0x19')](saveUpdates(_0x14b57b[_0x67c0('0x50')],null))[_0x67c0('0x19')](respondWithResult(_0x5bcbb7,null))[_0x67c0('0x24')](handleError(_0x5bcbb7,null));};exports['addLogoLogin']=function(_0x35bc2c,_0x427c7f,_0x43b310){if(_0x35bc2c[_0x67c0('0x52')]&&_0x35bc2c[_0x67c0('0x52')][_0x67c0('0x53')]){_0x35bc2c['body']['loginLogo']=_0x35bc2c['file'][_0x67c0('0x53')];}return db[_0x67c0('0x34')]['find']({'where':{'id':_0x35bc2c['params']['id']}})[_0x67c0('0x19')](handleEntityNotFound(_0x427c7f,null))['then'](saveUpdates(_0x35bc2c['body'],null))[_0x67c0('0x19')](respondWithResult(_0x427c7f,null))[_0x67c0('0x24')](handleError(_0x427c7f,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x401a9b,_0x1da79c,_0x477a8d){var _0x504906=_0x67c0('0x56');var _0x51f517={'custom':![]};return utilLicense['getLicense']()[_0x67c0('0x19')](function(_0x5bfc36){if(_0x5bfc36){_0x51f517=_0x5bfc36;}return db[_0x67c0('0x34')][_0x67c0('0x55')]({'where':{'id':_0x401a9b[_0x67c0('0x4c')]['id']},'attributes':[_0x67c0('0x54'),'loginLogo',_0x67c0('0x57'),_0x67c0('0x58'),'defaultLogo',_0x67c0('0x59'),_0x67c0('0x5a'),'defaultFavicon'],'raw':!![]});})[_0x67c0('0x19')](handleEntityNotFound(_0x1da79c,null))['then'](function(_0x515ef6){if(_0x515ef6){var _0x355028=_0x515ef6[_0x67c0('0x54')]&&fs[_0x67c0('0x5b')](path[_0x67c0('0x5c')](config['root'],_0x504906,_['toLower'](_0x515ef6[_0x67c0('0x54')])))?path[_0x67c0('0x5c')](config[_0x67c0('0x5d')],_0x504906,_[_0x67c0('0x5e')](_0x515ef6[_0x67c0('0x54')])):path[_0x67c0('0x5c')](config[_0x67c0('0x5d')],_0x504906,_[_0x67c0('0x5e')](_0x67c0('0x5f')));var _0x584fa9=_0x67c0('0x60')+_[_0x67c0('0x61')]('logo');if(_0x515ef6[_0x584fa9]||!_0x51f517[_0x67c0('0x62')]){_0x355028=path['join'](config[_0x67c0('0x5d')],_0x504906,_[_0x67c0('0x5e')](_0x67c0('0x5f')));}if(!fs[_0x67c0('0x5b')](_0x355028)){throw new db[(_0x67c0('0x63'))][(_0x67c0('0x64'))](_[_0x67c0('0x61')]('logo')+_0x67c0('0x65'));}return _0x1da79c[_0x67c0('0x66')](_0x355028);}})[_0x67c0('0x24')](handleError(_0x1da79c,null));};var utilLicense=require(_0x67c0('0x67'));exports['getLogoLogin']=function(_0x4892a7,_0x34c4d5,_0x4577e2){var _0x16cca8='server/files/images/logos';var _0x2d139a={'custom':![]};return utilLicense['getLicense']()[_0x67c0('0x19')](function(_0x23dfc6){if(_0x23dfc6){_0x2d139a=_0x23dfc6;}return db[_0x67c0('0x34')][_0x67c0('0x55')]({'where':{'id':_0x4892a7[_0x67c0('0x4c')]['id']},'attributes':[_0x67c0('0x54'),_0x67c0('0x68'),'preferred',_0x67c0('0x58'),_0x67c0('0x69'),'defaultLoginLogo',_0x67c0('0x5a'),_0x67c0('0x6a')],'raw':!![]});})[_0x67c0('0x19')](handleEntityNotFound(_0x34c4d5,null))[_0x67c0('0x19')](function(_0x3831f7){if(_0x3831f7){var _0x154be2=_0x3831f7[_0x67c0('0x68')]&&fs[_0x67c0('0x5b')](path[_0x67c0('0x5c')](config[_0x67c0('0x5d')],_0x16cca8,_[_0x67c0('0x5e')](_0x3831f7['loginLogo'])))?path['join'](config[_0x67c0('0x5d')],_0x16cca8,_[_0x67c0('0x5e')](_0x3831f7[_0x67c0('0x68')])):path[_0x67c0('0x5c')](config[_0x67c0('0x5d')],_0x16cca8,_[_0x67c0('0x5e')](_0x67c0('0x6b')));var _0xd2f74e=_0x67c0('0x60')+_[_0x67c0('0x61')](_0x67c0('0x68'));if(_0x3831f7[_0xd2f74e]||!_0x2d139a['custom']){_0x154be2=path[_0x67c0('0x5c')](config[_0x67c0('0x5d')],_0x16cca8,_['toLower'](_0x67c0('0x6b')));}if(!fs[_0x67c0('0x5b')](_0x154be2)){throw new db['Sequelize'][(_0x67c0('0x64'))](_[_0x67c0('0x61')]('loginLogo')+_0x67c0('0x65'));}return _0x34c4d5[_0x67c0('0x66')](_0x154be2);}})['catch'](handleError(_0x34c4d5,null));};exports[_0x67c0('0x6c')]=function(_0x11fcd1,_0x53b97c){return db[_0x67c0('0x34')][_0x67c0('0x55')]({'where':{'id':_0x11fcd1[_0x67c0('0x4c')]['id']},'attributes':[_0x67c0('0x6d')]})[_0x67c0('0x19')](respondWithResult(_0x53b97c,null))[_0x67c0('0x24')](handleError(_0x53b97c,null));};exports[_0x67c0('0x6e')]=function(_0xcaae68,_0x148742,_0x5c77b3){if(_0xcaae68[_0x67c0('0x52')]&&_0xcaae68['file']['filename']){_0xcaae68[_0x67c0('0x50')][_0x67c0('0x57')]=_0xcaae68[_0x67c0('0x52')][_0x67c0('0x53')];}return db[_0x67c0('0x34')][_0x67c0('0x55')]({'where':{'id':_0xcaae68[_0x67c0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x148742,null))[_0x67c0('0x19')](saveUpdates(_0xcaae68[_0x67c0('0x50')],null))[_0x67c0('0x19')](respondWithResult(_0x148742,null))['catch'](handleError(_0x148742,null));};var utilLicense=require(_0x67c0('0x67'));exports['getPreferred']=function(_0x7a964f,_0x5ea52a,_0x329ad5){var _0x2f7caa='server/files/images/logos';var _0x1a4a84={'custom':![]};return utilLicense[_0x67c0('0x6f')]()[_0x67c0('0x19')](function(_0xba32f3){if(_0xba32f3){_0x1a4a84=_0xba32f3;}return db[_0x67c0('0x34')][_0x67c0('0x55')]({'where':{'id':_0x7a964f['params']['id']},'attributes':[_0x67c0('0x54'),'loginLogo',_0x67c0('0x57'),'favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x67c0('0x19')](handleEntityNotFound(_0x5ea52a,null))[_0x67c0('0x19')](function(_0x1346a4){if(_0x1346a4){var _0x2f8efb=_0x1346a4['preferred']&&fs[_0x67c0('0x5b')](path[_0x67c0('0x5c')](config['root'],_0x2f7caa,_[_0x67c0('0x5e')](_0x1346a4[_0x67c0('0x57')])))?path[_0x67c0('0x5c')](config['root'],_0x2f7caa,_['toLower'](_0x1346a4[_0x67c0('0x57')])):path[_0x67c0('0x5c')](config[_0x67c0('0x5d')],_0x2f7caa,_[_0x67c0('0x5e')](_0x67c0('0x70')));var _0x37ee2a=_0x67c0('0x60')+_[_0x67c0('0x61')](_0x67c0('0x57'));if(_0x1346a4[_0x37ee2a]||!_0x1a4a84[_0x67c0('0x62')]||!_0x1a4a84[_0x67c0('0x57')]){_0x2f8efb=path[_0x67c0('0x5c')](config[_0x67c0('0x5d')],_0x2f7caa,_[_0x67c0('0x5e')](_0x67c0('0x70')));}if(!fs[_0x67c0('0x5b')](_0x2f8efb)){throw new db[(_0x67c0('0x63'))]['ValidationError'](_[_0x67c0('0x61')](_0x67c0('0x57'))+_0x67c0('0x65'));}return _0x5ea52a[_0x67c0('0x66')](_0x2f8efb);}})['catch'](handleError(_0x5ea52a,null));};exports[_0x67c0('0x71')]=function(_0x12c086,_0x2afa30,_0x414aa5){if(_0x12c086[_0x67c0('0x52')]&&_0x12c086[_0x67c0('0x52')][_0x67c0('0x53')]){_0x12c086[_0x67c0('0x50')][_0x67c0('0x58')]=_0x12c086[_0x67c0('0x52')][_0x67c0('0x53')];}return db[_0x67c0('0x34')]['find']({'where':{'id':_0x12c086[_0x67c0('0x4c')]['id']}})[_0x67c0('0x19')](handleEntityNotFound(_0x2afa30,null))['then'](saveUpdates(_0x12c086[_0x67c0('0x50')],null))[_0x67c0('0x19')](respondWithResult(_0x2afa30,null))[_0x67c0('0x24')](handleError(_0x2afa30,null));};var utilLicense=require(_0x67c0('0x67'));exports[_0x67c0('0x72')]=function(_0x127a1e,_0x26cf08,_0x12fa57){var _0x294c79=_0x67c0('0x56');var _0x3c32bf={'custom':![]};return utilLicense[_0x67c0('0x6f')]()[_0x67c0('0x19')](function(_0x227593){if(_0x227593){_0x3c32bf=_0x227593;}return db['Setting'][_0x67c0('0x55')]({'where':{'id':_0x127a1e[_0x67c0('0x4c')]['id']},'attributes':[_0x67c0('0x54'),_0x67c0('0x68'),'preferred','favicon',_0x67c0('0x69'),_0x67c0('0x59'),'defaultPreferred',_0x67c0('0x6a')],'raw':!![]});})[_0x67c0('0x19')](handleEntityNotFound(_0x26cf08,null))[_0x67c0('0x19')](function(_0x5219d0){if(_0x5219d0){var _0x537eeb=_0x5219d0[_0x67c0('0x58')]&&fs['existsSync'](path[_0x67c0('0x5c')](config[_0x67c0('0x5d')],_0x294c79,_[_0x67c0('0x5e')](_0x5219d0[_0x67c0('0x58')])))?path[_0x67c0('0x5c')](config[_0x67c0('0x5d')],_0x294c79,_[_0x67c0('0x5e')](_0x5219d0[_0x67c0('0x58')])):path[_0x67c0('0x5c')](config[_0x67c0('0x5d')],_0x294c79,_[_0x67c0('0x5e')](_0x67c0('0x73')));var _0x194bf7='default'+_[_0x67c0('0x61')](_0x67c0('0x58'));if(_0x5219d0[_0x194bf7]||!_0x3c32bf['custom']){_0x537eeb=path[_0x67c0('0x5c')](config[_0x67c0('0x5d')],_0x294c79,_['toLower']('default_favicon.ico'));}if(!fs['existsSync'](_0x537eeb)){throw new db[(_0x67c0('0x63'))]['ValidationError'](_[_0x67c0('0x61')]('favicon')+_0x67c0('0x65'));}return _0x26cf08[_0x67c0('0x66')](_0x537eeb);}})[_0x67c0('0x24')](handleError(_0x26cf08,null));};exports[_0x67c0('0x74')]=function(_0x30f149,_0x575811){var _0x5dbdeb={'offset':moment()['utcOffset']()};_0x5dbdeb[_0x67c0('0x75')]=moment()[_0x67c0('0x76')](_0x5dbdeb[_0x67c0('0x2b')])['format'](_0x67c0('0x77'));return _0x575811['status'](0xc8)[_0x67c0('0x32')](_0x5dbdeb);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 98b0336..52713ad 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x2f7be9,_0x173b28){var _0x22b2ad=function(_0x2f50e4){while(--_0x2f50e4){_0x2f7be9['push'](_0x2f7be9['shift']());}};_0x22b2ad(++_0x173b28);}(_0x3e74,0x175));var _0x43e7=function(_0x59a29a,_0x56bce2){_0x59a29a=_0x59a29a-0x0;var _0x8e8301=_0x3e74[_0x59a29a];return _0x8e8301;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x2da405,_0x329592){var _0x58a42d=function(_0x484359){while(--_0x484359){_0x2da405['push'](_0x2da405['shift']());}};_0x58a42d(++_0x329592);}(_0xe14b,0x93));var _0xbe14=function(_0x2f7154,_0x1c2c71){_0x2f7154=_0x2f7154-0x0;var _0x12a260=_0xe14b[_0x2f7154];return _0x12a260;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 35e4eab..55edf17 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 _0x0107=['Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','ShowSetting','find','options','where','attributes','map','include','model','info','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x358f96,_0x24952b){var _0x5bc936=function(_0x5c9457){while(--_0x5c9457){_0x358f96['push'](_0x358f96['shift']());}};_0x5bc936(++_0x24952b);}(_0x0107,0xac));var _0x7010=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x0107[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x7010('0x0'));var util=require(_0x7010('0x1'));var moment=require(_0x7010('0x2'));var BPromise=require('bluebird');var rs=require(_0x7010('0x3'));var fs=require('fs');var Redis=require(_0x7010('0x4'));var db=require(_0x7010('0x5'))['db'];var utils=require(_0x7010('0x6'));var logger=require(_0x7010('0x7'))(_0x7010('0x8'));var config=require(_0x7010('0x9'));var jayson=require(_0x7010('0xa'));var client=jayson['client'][_0x7010('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ec269,_0x2a30e4,_0x1e217f){return new BPromise(function(_0x35eebb,_0x2023d0){return client[_0x7010('0xc')](_0x1ec269,_0x1e217f)[_0x7010('0xd')](function(_0x98f40e){logger['info'](_0x7010('0xe'),_0x2a30e4,_0x7010('0xf'));logger['debug'](_0x7010('0x10'),_0x2a30e4,_0x7010('0xf'),JSON[_0x7010('0x11')](_0x98f40e));if(_0x98f40e[_0x7010('0x12')]){if(_0x98f40e['error']['code']===0x1f4){logger[_0x7010('0x12')]('Setting,\x20%s,\x20%s',_0x2a30e4,_0x98f40e['error'][_0x7010('0x13')]);return _0x2023d0(_0x98f40e['error'][_0x7010('0x13')]);}logger[_0x7010('0x12')](_0x7010('0xe'),_0x2a30e4,_0x98f40e[_0x7010('0x12')]['message']);return _0x35eebb(_0x98f40e[_0x7010('0x12')][_0x7010('0x13')]);}else{logger['info'](_0x7010('0xe'),_0x2a30e4,_0x7010('0xf'));_0x35eebb(_0x98f40e['result']['message']);}})[_0x7010('0x14')](function(_0x3b8c91){logger[_0x7010('0x12')](_0x7010('0xe'),_0x2a30e4,_0x3b8c91);_0x2023d0(_0x3b8c91);});});}exports[_0x7010('0x15')]=function(_0x9971e7){var _0xa3f9cd=this;return new Promise(function(_0x4b8c84,_0x1b7db7){return db['Setting'][_0x7010('0x16')]({'raw':_0x9971e7[_0x7010('0x17')]?_0x9971e7[_0x7010('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x9971e7[_0x7010('0x17')]?_0x9971e7[_0x7010('0x17')][_0x7010('0x18')]||null:null,'attributes':_0x9971e7[_0x7010('0x17')]?_0x9971e7[_0x7010('0x17')][_0x7010('0x19')]||null:null,'include':_0x9971e7[_0x7010('0x17')]?_0x9971e7['options']['include']?_[_0x7010('0x1a')](_0x9971e7[_0x7010('0x17')][_0x7010('0x1b')],function(_0x679df4){return{'model':db[_0x679df4[_0x7010('0x1c')]],'as':_0x679df4['as'],'attributes':_0x679df4[_0x7010('0x19')],'include':_0x679df4['include']?_[_0x7010('0x1a')](_0x679df4[_0x7010('0x1b')],function(_0x200f47){return{'model':db[_0x200f47[_0x7010('0x1c')]],'as':_0x200f47['as'],'attributes':_0x200f47[_0x7010('0x19')],'include':_0x200f47[_0x7010('0x1b')]?_[_0x7010('0x1a')](_0x200f47[_0x7010('0x1b')],function(_0x319b5d){return{'model':db[_0x319b5d[_0x7010('0x1c')]],'as':_0x319b5d['as'],'attributes':_0x319b5d[_0x7010('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7010('0xd')](function(_0x55d3be){logger[_0x7010('0x1d')]('ShowSetting',_0x9971e7);logger[_0x7010('0x1e')]('ShowSetting',_0x9971e7,JSON[_0x7010('0x11')](_0x55d3be));_0x4b8c84(_0x55d3be);})[_0x7010('0x14')](function(_0x34281a){logger[_0x7010('0x12')]('ShowSetting',_0x34281a['message'],_0x9971e7);_0x1b7db7(_0xa3f9cd[_0x7010('0x12')](0x1f4,_0x34281a[_0x7010('0x13')]));});});}; \ No newline at end of file +var _0x356d=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','ShowSetting','Setting','options','raw','where','include','map','attributes','model','stringify'];(function(_0x15f67b,_0x9e38e5){var _0x14a4b1=function(_0x5088a1){while(--_0x5088a1){_0x15f67b['push'](_0x15f67b['shift']());}};_0x14a4b1(++_0x9e38e5);}(_0x356d,0x1ad));var _0xd356=function(_0x393b28,_0x234b68){_0x393b28=_0x393b28-0x0;var _0xfb4101=_0x356d[_0x393b28];return _0xfb4101;};'use strict';var _=require(_0xd356('0x0'));var util=require(_0xd356('0x1'));var moment=require(_0xd356('0x2'));var BPromise=require(_0xd356('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd356('0x4'));var db=require(_0xd356('0x5'))['db'];var utils=require(_0xd356('0x6'));var logger=require(_0xd356('0x7'))(_0xd356('0x8'));var config=require(_0xd356('0x9'));var jayson=require(_0xd356('0xa'));var client=jayson[_0xd356('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26410c,_0x376370,_0x11d3e0){return new BPromise(function(_0x1d1376,_0x29860a){return client[_0xd356('0xc')](_0x26410c,_0x11d3e0)[_0xd356('0xd')](function(_0x12cb22){logger['info'](_0xd356('0xe'),_0x376370,_0xd356('0xf'));logger[_0xd356('0x10')](_0xd356('0x11'),_0x376370,_0xd356('0xf'),JSON['stringify'](_0x12cb22));if(_0x12cb22[_0xd356('0x12')]){if(_0x12cb22['error'][_0xd356('0x13')]===0x1f4){logger[_0xd356('0x12')](_0xd356('0xe'),_0x376370,_0x12cb22['error'][_0xd356('0x14')]);return _0x29860a(_0x12cb22[_0xd356('0x12')]['message']);}logger[_0xd356('0x12')](_0xd356('0xe'),_0x376370,_0x12cb22[_0xd356('0x12')][_0xd356('0x14')]);return _0x1d1376(_0x12cb22['error'][_0xd356('0x14')]);}else{logger[_0xd356('0x15')](_0xd356('0xe'),_0x376370,_0xd356('0xf'));_0x1d1376(_0x12cb22['result'][_0xd356('0x14')]);}})[_0xd356('0x16')](function(_0xefe6d){logger[_0xd356('0x12')](_0xd356('0xe'),_0x376370,_0xefe6d);_0x29860a(_0xefe6d);});});}exports[_0xd356('0x17')]=function(_0x5622d9){var _0x3ece0e=this;return new Promise(function(_0x6d65d7,_0x38ad53){return db[_0xd356('0x18')]['find']({'raw':_0x5622d9[_0xd356('0x19')]?_0x5622d9[_0xd356('0x19')][_0xd356('0x1a')]===undefined?!![]:![]:!![],'where':_0x5622d9[_0xd356('0x19')]?_0x5622d9[_0xd356('0x19')][_0xd356('0x1b')]||null:null,'attributes':_0x5622d9[_0xd356('0x19')]?_0x5622d9['options']['attributes']||null:null,'include':_0x5622d9[_0xd356('0x19')]?_0x5622d9[_0xd356('0x19')][_0xd356('0x1c')]?_[_0xd356('0x1d')](_0x5622d9['options']['include'],function(_0x55e9ef){return{'model':db[_0x55e9ef['model']],'as':_0x55e9ef['as'],'attributes':_0x55e9ef[_0xd356('0x1e')],'include':_0x55e9ef[_0xd356('0x1c')]?_[_0xd356('0x1d')](_0x55e9ef[_0xd356('0x1c')],function(_0x1da881){return{'model':db[_0x1da881[_0xd356('0x1f')]],'as':_0x1da881['as'],'attributes':_0x1da881['attributes'],'include':_0x1da881[_0xd356('0x1c')]?_['map'](_0x1da881['include'],function(_0x27f7e9){return{'model':db[_0x27f7e9[_0xd356('0x1f')]],'as':_0x27f7e9['as'],'attributes':_0x27f7e9[_0xd356('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10e84e){logger[_0xd356('0x15')](_0xd356('0x17'),_0x5622d9);logger['debug'](_0xd356('0x17'),_0x5622d9,JSON[_0xd356('0x20')](_0x10e84e));_0x6d65d7(_0x10e84e);})[_0xd356('0x16')](function(_0x5644e9){logger[_0xd356('0x12')](_0xd356('0x17'),_0x5644e9[_0xd356('0x14')],_0x5622d9);_0x38ad53(_0x3ece0e[_0xd356('0x12')](0x1f4,_0x5644e9['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 162d029..52e5cb6 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 _0x8ef6=['addApplications','/:id/send','send','status','update','delete','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/status','statusGet','/:id/users','getAgents','create','post','addDisposition','addAnswer','notify'];(function(_0x4b50f4,_0x251870){var _0xf16240=function(_0x3dc52c){while(--_0x3dc52c){_0x4b50f4['push'](_0x4b50f4['shift']());}};_0xf16240(++_0x251870);}(_0x8ef6,0xf2));var _0x68ef=function(_0x1b89d7,_0x4ab8b6){_0x1b89d7=_0x1b89d7-0x0;var _0x1d320c=_0x8ef6[_0x1b89d7];return _0x1d320c;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var fs_extra=require(_0x68ef('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var controller=require(_0x68ef('0x9'));router[_0x68ef('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x68ef('0xa')](_0x68ef('0xb'),auth[_0x68ef('0xc')](),controller['describe']);router[_0x68ef('0xa')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0xe')]);router[_0x68ef('0xa')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x10')]);router[_0x68ef('0xa')](_0x68ef('0x11'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x12')]);router['get'](_0x68ef('0x13'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x14')]);router[_0x68ef('0xa')](_0x68ef('0x15'),auth[_0x68ef('0xc')](),controller['getInteractions']);router[_0x68ef('0xa')](_0x68ef('0x16'),controller[_0x68ef('0x17')]);router['get'](_0x68ef('0x18'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x19')]);router['post']('/',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1a')]);router[_0x68ef('0x1b')](_0x68ef('0xf'),auth['isAuthenticated'](),controller[_0x68ef('0x1c')]);router['post']('/:id/canned_answers',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1d')]);router['post']('/:id/notify',controller[_0x68ef('0x1e')]);router[_0x68ef('0x1b')](_0x68ef('0x13'),auth['isAuthenticated'](),controller[_0x68ef('0x1f')]);router[_0x68ef('0x1b')](_0x68ef('0x20'),auth['isAuthenticated'](),controller[_0x68ef('0x21')]);router[_0x68ef('0x1b')]('/:id/status',controller[_0x68ef('0x22')]);router[_0x68ef('0x1b')](_0x68ef('0x18'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x23')]);router[_0x68ef('0x24')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x25')]);router[_0x68ef('0x24')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller['removeDispositions']);router[_0x68ef('0x24')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x68ef('0x24')](_0x68ef('0x18'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x26')]);module['exports']=router; \ No newline at end of file +var _0xe14b=['./smsAccount.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','put','update','/:id','destroy','removeDispositions','delete','/:id/users','removeAgents','multer','util','express','Router','../../components/auth/service'];(function(_0x3c10b7,_0x10fb4a){var _0xbd891b=function(_0x256dc3){while(--_0x256dc3){_0x3c10b7['push'](_0x3c10b7['shift']());}};_0xbd891b(++_0x10fb4a);}(_0xe14b,0x93));var _0xbe14=function(_0x41e518,_0x5285c4){_0x41e518=_0x41e518-0x0;var _0x52062f=_0xe14b[_0x41e518];return _0x52062f;};'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['getDispositions']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x6')](_0xbe14('0x10'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x6')](_0xbe14('0x12'),controller[_0xbe14('0x13')]);router[_0xbe14('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x14')]);router[_0xbe14('0x15')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x16')]);router['post'](_0xbe14('0xb'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x15')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);router['post'](_0xbe14('0x19'),controller[_0xbe14('0x1a')]);router[_0xbe14('0x15')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x1b')]);router['post'](_0xbe14('0x1c'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x1d')]);router[_0xbe14('0x15')](_0xbe14('0x12'),controller['status']);router[_0xbe14('0x15')]('/:id/users',auth[_0xbe14('0x7')](),controller['addAgents']);router[_0xbe14('0x1e')]('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0x1f')]);router['delete'](_0xbe14('0x20'),auth['isAuthenticated'](),controller[_0xbe14('0x21')]);router['delete'](_0xbe14('0xb'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x22')]);router[_0xbe14('0x23')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeAnswers']);router[_0xbe14('0x23')](_0xbe14('0x24'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x25')]);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 3dccf4f..48a7207 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 _0x00a1=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','skebby','connectel','clickatell','bandwidth','csc','intelepeer','ENUM','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue'];(function(_0x3a77fd,_0xbb7eb6){var _0x361b42=function(_0x456612){while(--_0x456612){_0x3a77fd['push'](_0x3a77fd['shift']());}};_0x361b42(++_0xbb7eb6);}(_0x00a1,0x7a));var _0x100a=function(_0x527527,_0x16788d){_0x527527=_0x527527-0x0;var _0x590968=_0x00a1[_0x527527];return _0x590968;};'use strict';var Sequelize=require(_0x100a('0x0'));var rs=require(_0x100a('0x1'));module[_0x100a('0x2')]={'name':{'type':Sequelize[_0x100a('0x3')],'unique':_0x100a('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x100a('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x100a('0x3')],'defaultValue':function(){return rs[_0x100a('0x5')]();}},'phone':{'type':Sequelize[_0x100a('0x3')]},'type':{'type':Sequelize['ENUM']('twilio',_0x100a('0x6'),_0x100a('0x7'),'clicksend','plivo',_0x100a('0x8'),_0x100a('0x9'),_0x100a('0xa'),'infobip',_0x100a('0xb'))},'accountSid':{'type':Sequelize[_0x100a('0x3')]},'authId':{'type':Sequelize[_0x100a('0x3')]},'authToken':{'type':Sequelize[_0x100a('0x3')]},'smsMethod':{'type':Sequelize[_0x100a('0xc')]('SI','TI','GP')},'username':{'type':Sequelize[_0x100a('0x3')]},'password':{'type':Sequelize[_0x100a('0x3')]},'apiKey':{'type':Sequelize[_0x100a('0x3')]},'applicationId':{'type':Sequelize[_0x100a('0x3')]},'accountId':{'type':Sequelize[_0x100a('0x3')]},'senderString':{'type':Sequelize[_0x100a('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x100a('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x100a('0xd');}},'notificationSound':{'type':Sequelize[_0x100a('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x100a('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x100a('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x100a('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x100a('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x100a('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x100a('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x100a('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x100a('0xf')],'comment':_0x100a('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x100a('0xe')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3bc4e5){if(!_0x3bc4e5)this[_0x100a('0x11')](_0x100a('0x12'),null);this[_0x100a('0x11')](_0x100a('0x13'),_0x3bc4e5);}}}; \ No newline at end of file +var _0xdf68=['ENUM','skebby','connectel','clicksend','plivo','clickatell','bandwidth','infobip','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','randomstring','STRING','generate'];(function(_0x3a5b64,_0x210cf6){var _0x10c92f=function(_0x548d93){while(--_0x548d93){_0x3a5b64['push'](_0x3a5b64['shift']());}};_0x10c92f(++_0x210cf6);}(_0xdf68,0x1b6));var _0x8df6=function(_0x705b98,_0x1c345b){_0x705b98=_0x705b98-0x0;var _0x47b72f=_0xdf68[_0x705b98];return _0x47b72f;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x8df6('0x0'));module['exports']={'name':{'type':Sequelize[_0x8df6('0x1')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x8df6('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x8df6('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x8df6('0x1')],'defaultValue':function(){return rs[_0x8df6('0x2')]();}},'phone':{'type':Sequelize[_0x8df6('0x1')]},'type':{'type':Sequelize[_0x8df6('0x3')]('twilio',_0x8df6('0x4'),_0x8df6('0x5'),_0x8df6('0x6'),_0x8df6('0x7'),_0x8df6('0x8'),_0x8df6('0x9'),'csc',_0x8df6('0xa'),_0x8df6('0xb'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x8df6('0x1')]},'authToken':{'type':Sequelize[_0x8df6('0x1')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x8df6('0x1')]},'password':{'type':Sequelize[_0x8df6('0x1')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x8df6('0x1')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x8df6('0x1')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x8df6('0x1')]},'notificationTemplate':{'type':Sequelize[_0x8df6('0xc')],'defaultValue':function(){return _0x8df6('0xd');}},'notificationSound':{'type':Sequelize[_0x8df6('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8df6('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8df6('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8df6('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8df6('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8df6('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x8df6('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8df6('0xf')],'comment':_0x8df6('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x8df6('0xe')],'defaultValue':![],'comment':_0x8df6('0x11'),'set':function(_0xe30ae8){if(!_0xe30ae8)this['setDataValue'](_0x8df6('0x12'),null);this[_0x8df6('0x13')](_0x8df6('0x14'),_0xe30ae8);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 414e70f..e7e0c90 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 _0xab6b=['../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','end','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','keys','SmsAccount','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','SmsAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','findOne','order','CannedAnswer','findAll','removeAnswers','notify','sms','SmsApplication','account','Applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','Body','messageId','MessageSid','from','connectel','message_id','plivo','Text','MessageUUID','infobip','results','text','csc','segmentedMessage','fromNumber','replyMessageId','bandwidth','intelepeer','refid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','Contacts','DESC','list','omit','spread','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','\x0a','addApplications','bulkCreate','findAndCountAll','priority','getApplications','SmsInteraction','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','CmList','List','out','SmsMessage','Messages','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','status_code','DELIVERED','groupName','clickatell','redif','clicksend','error_code','DELIVERED_TO_GATEWAY','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','fast-json-patch','request-promise','bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xab6b,0x1b3));var _0xbab6=function(_0x10c5e5,_0x83df3f){_0x10c5e5=_0x10c5e5-0x0;var _0x42d237=_0xab6b[_0x10c5e5];return _0x42d237;};'use strict';var emlformat=require(_0xbab6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbab6('0x1'));var rp=require(_0xbab6('0x2'));var moment=require('moment');var BPromise=require(_0xbab6('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbab6('0x4'));var sox=require(_0xbab6('0x5'));var csv=require('to-csv');var ejs=require(_0xbab6('0x6'));var fs=require('fs');var fs_extra=require(_0xbab6('0x7'));var _=require(_0xbab6('0x8'));var squel=require(_0xbab6('0x9'));var crypto=require('crypto');var jsforce=require(_0xbab6('0xa'));var deskjs=require(_0xbab6('0xb'));var toCsv=require('to-csv');var querystring=require(_0xbab6('0xc'));var Papa=require('papaparse');var Redis=require(_0xbab6('0xd'));var authService=require(_0xbab6('0xe'));var qs=require(_0xbab6('0xf'));var as=require(_0xbab6('0x10'));var hardwareService=require(_0xbab6('0x11'));var logger=require(_0xbab6('0x12'))(_0xbab6('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbab6('0x14'));var db=require(_0xbab6('0x15'))['db'];config[_0xbab6('0x16')]=_[_0xbab6('0x17')](config[_0xbab6('0x16')],{'host':_0xbab6('0x18'),'port':0x18eb});var socket=require(_0xbab6('0x19'))(new Redis(config['redis']));require(_0xbab6('0x1a'))[_0xbab6('0x1b')](socket);var jayson=require(_0xbab6('0x1c'));var client=jayson[_0xbab6('0x1d')][_0xbab6('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0xc013ea,_0x4e32f7,_0x1a16c3,_0xfddb3d){return new BPromise(function(_0x5eee1e,_0x22e2a5){var _0xfbb243=_0xfddb3d||client;return _0xfbb243[_0xbab6('0x1f')](_0xc013ea,_0x1a16c3)[_0xbab6('0x20')](function(_0x39ada9){logger[_0xbab6('0x21')](_0xbab6('0x22'),_0x4e32f7,_0xbab6('0x23'));logger[_0xbab6('0x24')](_0xbab6('0x25'),_0x4e32f7,'request\x20sent',JSON[_0xbab6('0x26')](_0x39ada9));if(_0x39ada9['error']){if(_0x39ada9[_0xbab6('0x27')][_0xbab6('0x28')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x4e32f7,_0x39ada9[_0xbab6('0x27')][_0xbab6('0x29')]);return _0x22e2a5(_0x39ada9[_0xbab6('0x27')][_0xbab6('0x29')]);}logger[_0xbab6('0x27')](_0xbab6('0x22'),_0x4e32f7,_0x39ada9[_0xbab6('0x27')][_0xbab6('0x29')]);return _0x5eee1e(_0x39ada9[_0xbab6('0x27')][_0xbab6('0x29')]);}else{logger[_0xbab6('0x21')](_0xbab6('0x22'),_0x4e32f7,'request\x20sent');_0x5eee1e(_0x39ada9[_0xbab6('0x2a')][_0xbab6('0x29')]);}})['catch'](function(_0x76cc18){logger['error'](_0xbab6('0x22'),_0x4e32f7,_0x76cc18);_0x22e2a5(_0x76cc18);});});}function respondWithStatusCode(_0xb9861a,_0x490822){_0x490822=_0x490822||0xcc;return function(_0x31cd98){if(_0x31cd98){return _0xb9861a[_0xbab6('0x2b')](_0x490822);}return _0xb9861a[_0xbab6('0x2c')](_0x490822)['end']();};}function respondWithResult(_0x4a201b,_0x543002){_0x543002=_0x543002||0xc8;return function(_0x338ace){if(_0x338ace){return _0x4a201b[_0xbab6('0x2c')](_0x543002)[_0xbab6('0x2d')](_0x338ace);}};}function respondWithFilteredResult(_0x76c526,_0x5468ea){return function(_0x5d7a82){if(_0x5d7a82){var _0x5afc6d=typeof _0x5468ea[_0xbab6('0x2e')]===_0xbab6('0x2f')&&typeof _0x5468ea[_0xbab6('0x30')]==='undefined';var _0x17a479=_0x5d7a82[_0xbab6('0x31')];var _0x3862a5=_0x5afc6d?0x0:_0x5468ea[_0xbab6('0x2e')];var _0x33a80e=_0x5afc6d?_0x5d7a82[_0xbab6('0x31')]:_0x5468ea[_0xbab6('0x2e')]+_0x5468ea['limit'];var _0x3d0a47;if(_0x33a80e>=_0x17a479){_0x33a80e=_0x17a479;_0x3d0a47=0xc8;}else{_0x3d0a47=0xce;}_0x76c526['status'](_0x3d0a47);return _0x76c526[_0xbab6('0x32')]('Content-Range',_0x3862a5+'-'+_0x33a80e+'/'+_0x17a479)[_0xbab6('0x2d')](_0x5d7a82);}return null;};}function patchUpdates(_0x144c85){return function(_0x3dc84a){try{jsonpatch[_0xbab6('0x33')](_0x3dc84a,_0x144c85,!![]);}catch(_0x4b73f4){return BPromise[_0xbab6('0x34')](_0x4b73f4);}return _0x3dc84a[_0xbab6('0x35')]();};}function saveUpdates(_0x354607,_0x5659ea){return function(_0x30f37f){if(_0x30f37f){return _0x30f37f[_0xbab6('0x36')](_0x354607)['then'](function(_0x1bdbf7){return _0x1bdbf7;});}return null;};}function removeEntity(_0x53de53,_0x29592a){return function(_0x2deda3){if(_0x2deda3){return _0x2deda3[_0xbab6('0x37')]()['then'](function(){var _0x580a2e=_0x2deda3[_0xbab6('0x38')]({'plain':!![]});var _0x77fa2d=_0xbab6('0x39');return db[_0xbab6('0x3a')]['destroy']({'where':{'type':_0x77fa2d,'resourceId':_0x580a2e['id']}})[_0xbab6('0x20')](function(){return _0x2deda3;});})['then'](function(){_0x53de53[_0xbab6('0x2c')](0xcc)[_0xbab6('0x3b')]();});}};}function handleEntityNotFound(_0x22e0b8,_0x541271){return function(_0x246332){if(!_0x246332){_0x22e0b8[_0xbab6('0x2b')](0x194);}return _0x246332;};}function handleError(_0x5c4239,_0x593478){_0x593478=_0x593478||0x1f4;return function(_0x1d0ef2){logger['error'](_0x1d0ef2['stack']);if(_0x1d0ef2[_0xbab6('0x3c')]){delete _0x1d0ef2[_0xbab6('0x3c')];}_0x5c4239[_0xbab6('0x2c')](_0x593478)[_0xbab6('0x3d')](_0x1d0ef2);};}exports[_0xbab6('0x3e')]=function(_0x237d49,_0x126be0){var _0x5e8f78={'include':[{'model':db[_0xbab6('0x3f')],'as':_0xbab6('0x40')}]},_0x477589={},_0x56efe4={'count':0x0,'rows':[]};var _0x550310=_[_0xbab6('0x41')](db['SmsAccount'][_0xbab6('0x42')],function(_0x15c8c1){return{'name':_0x15c8c1[_0xbab6('0x43')],'type':_0x15c8c1[_0xbab6('0x44')][_0xbab6('0x45')]};});_0x477589[_0xbab6('0x46')]=_['map'](_0x550310,_0xbab6('0x3c'));_0x477589[_0xbab6('0x47')]=_['keys'](_0x237d49[_0xbab6('0x47')]);_0x477589[_0xbab6('0x48')]=_['intersection'](_0x477589[_0xbab6('0x46')],_0x477589[_0xbab6('0x47')]);_0x5e8f78[_0xbab6('0x49')]=_['intersection'](_0x477589[_0xbab6('0x46')],qs[_0xbab6('0x4a')](_0x237d49[_0xbab6('0x47')][_0xbab6('0x4a')]));_0x5e8f78[_0xbab6('0x49')]=_0x5e8f78[_0xbab6('0x49')][_0xbab6('0x4b')]?_0x5e8f78[_0xbab6('0x49')]:_0x477589['model'];if(!_0x237d49[_0xbab6('0x47')][_0xbab6('0x4c')](_0xbab6('0x4d'))){_0x5e8f78['limit']=qs['limit'](_0x237d49['query'][_0xbab6('0x30')]);_0x5e8f78['offset']=qs['offset'](_0x237d49['query'][_0xbab6('0x2e')]);}_0x5e8f78['order']=qs[_0xbab6('0x4e')](_0x237d49[_0xbab6('0x47')][_0xbab6('0x4e')]);_0x5e8f78[_0xbab6('0x4f')]=qs[_0xbab6('0x48')](_[_0xbab6('0x50')](_0x237d49['query'],_0x477589[_0xbab6('0x48')]),_0x550310);if(_0x237d49[_0xbab6('0x47')][_0xbab6('0x51')]){_0x5e8f78['where']=_[_0xbab6('0x52')](_0x5e8f78[_0xbab6('0x4f')],{'$or':_['map'](_0x550310,function(_0x240e5e){if(_0x240e5e[_0xbab6('0x44')]!==_0xbab6('0x53')){var _0x166522={};_0x166522[_0x240e5e[_0xbab6('0x3c')]]={'$like':'%'+_0x237d49[_0xbab6('0x47')][_0xbab6('0x51')]+'%'};return _0x166522;}})});}_0x5e8f78=_[_0xbab6('0x52')]({},_0x5e8f78,_0x237d49[_0xbab6('0x54')]);var _0x12d992={'where':_0x5e8f78[_0xbab6('0x4f')]};return db['SmsAccount'][_0xbab6('0x31')](_0x12d992)[_0xbab6('0x20')](function(_0x3a9c9a){_0x56efe4[_0xbab6('0x31')]=_0x3a9c9a;if(_0x237d49['query'][_0xbab6('0x55')]){_0x5e8f78[_0xbab6('0x56')]=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x5e8f78);})[_0xbab6('0x20')](function(_0x2f5163){_0x56efe4[_0xbab6('0x57')]=_0x2f5163;return _0x56efe4;})[_0xbab6('0x20')](respondWithFilteredResult(_0x126be0,_0x5e8f78))['catch'](handleError(_0x126be0,null));};exports['show']=function(_0x5a586d,_0x5751a1){var _0x306de5={'raw':![],'where':{'id':_0x5a586d[_0xbab6('0x58')]['id']},'include':[{'model':db[_0xbab6('0x3f')],'as':_0xbab6('0x40')}]},_0x3b1ec9={};_0x3b1ec9[_0xbab6('0x46')]=_[_0xbab6('0x59')](db[_0xbab6('0x5a')]['rawAttributes']);_0x3b1ec9[_0xbab6('0x47')]=_[_0xbab6('0x59')](_0x5a586d[_0xbab6('0x47')]);_0x3b1ec9[_0xbab6('0x48')]=_['intersection'](_0x3b1ec9['model'],_0x3b1ec9[_0xbab6('0x47')]);_0x306de5[_0xbab6('0x49')]=_[_0xbab6('0x5b')](_0x3b1ec9[_0xbab6('0x46')],qs['fields'](_0x5a586d[_0xbab6('0x47')][_0xbab6('0x4a')]));_0x306de5[_0xbab6('0x49')]=_0x306de5[_0xbab6('0x49')][_0xbab6('0x4b')]?_0x306de5[_0xbab6('0x49')]:_0x3b1ec9[_0xbab6('0x46')];if(_0x5a586d[_0xbab6('0x47')][_0xbab6('0x55')]){_0x306de5[_0xbab6('0x56')]=[{'all':!![]}];}_0x306de5=_[_0xbab6('0x52')]({},_0x306de5,_0x5a586d[_0xbab6('0x54')]);return db[_0xbab6('0x5a')][_0xbab6('0x5c')](_0x306de5)[_0xbab6('0x20')](handleEntityNotFound(_0x5751a1,null))[_0xbab6('0x20')](respondWithResult(_0x5751a1,null))['catch'](handleError(_0x5751a1,null));};exports['create']=function(_0x16a423,_0x505a81){return db[_0xbab6('0x5a')][_0xbab6('0x5d')](_0x16a423[_0xbab6('0x5e')],{})['then'](function(_0x5e11e4){var _0x1b09d8=_0x16a423[_0xbab6('0x5f')][_0xbab6('0x38')]({'plain':!![]});if(!_0x1b09d8)throw new Error(_0xbab6('0x60'));if(_0x1b09d8[_0xbab6('0x61')]===_0xbab6('0x5f')){var _0x498be0=_0x5e11e4['get']({'plain':!![]});var _0x314d91=_0xbab6('0x39');return db[_0xbab6('0x62')]['find']({'where':{'name':_0x314d91,'userProfileId':_0x1b09d8[_0xbab6('0x63')]},'raw':!![]})[_0xbab6('0x20')](function(_0x57a88){if(_0x57a88&&_0x57a88['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x498be0[_0xbab6('0x3c')],'resourceId':_0x498be0['id'],'type':_0x57a88['name'],'sectionId':_0x57a88['id']},{})['then'](function(){return _0x5e11e4;});}else{return _0x5e11e4;}})[_0xbab6('0x64')](function(_0x45949f){logger[_0xbab6('0x27')](_0xbab6('0x65'),_0x45949f);throw _0x45949f;});}return _0x5e11e4;})['then'](respondWithResult(_0x505a81,0xc9))[_0xbab6('0x64')](handleError(_0x505a81,null));};exports[_0xbab6('0x36')]=function(_0x5075e3,_0x4649a6){if(_0x5075e3[_0xbab6('0x5e')]['id']){delete _0x5075e3[_0xbab6('0x5e')]['id'];}return db[_0xbab6('0x5a')][_0xbab6('0x5c')]({'where':{'id':_0x5075e3['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xbab6('0x20')](handleEntityNotFound(_0x4649a6,null))[_0xbab6('0x20')](saveUpdates(_0x5075e3[_0xbab6('0x5e')],null))[_0xbab6('0x20')](respondWithResult(_0x4649a6,null))[_0xbab6('0x64')](handleError(_0x4649a6,null));};exports[_0xbab6('0x37')]=function(_0xbb1dc0,_0x3101f8){return db[_0xbab6('0x5a')][_0xbab6('0x5c')]({'where':{'id':_0xbb1dc0[_0xbab6('0x58')]['id']}})['then'](handleEntityNotFound(_0x3101f8,null))[_0xbab6('0x20')](removeEntity(_0x3101f8,null))[_0xbab6('0x64')](handleError(_0x3101f8,null));};exports[_0xbab6('0x66')]=function(_0x4f7ecd,_0x292319){return db[_0xbab6('0x5a')][_0xbab6('0x66')]()[_0xbab6('0x20')](respondWithResult(_0x292319,null))['catch'](handleError(_0x292319,null));};exports['addDisposition']=function(_0x185bee,_0xfb3583,_0x3327b4){if(_0x185bee[_0xbab6('0x5e')]['id']){delete _0x185bee['body']['id'];}return db[_0xbab6('0x5a')][_0xbab6('0x5c')]({'where':{'id':_0x185bee[_0xbab6('0x58')]['id']}})[_0xbab6('0x20')](handleEntityNotFound(_0xfb3583,null))[_0xbab6('0x20')](function(_0x26b955){if(_0x26b955){_0x185bee['body'][_0xbab6('0x67')]=_0x26b955['id'];return db[_0xbab6('0x68')][_0xbab6('0x5d')](_0x185bee[_0xbab6('0x5e')]);}})[_0xbab6('0x20')](respondWithResult(_0xfb3583,null))['catch'](handleError(_0xfb3583,null));};exports[_0xbab6('0x69')]=function(_0x1e226f,_0x2d919d,_0x153a2d){var _0x361e8c={'raw':![],'where':{}};var _0x42f202={};var _0x380c88={'count':0x0,'rows':[]};return db[_0xbab6('0x5a')]['findOne']({'where':{'id':_0x1e226f[_0xbab6('0x58')]['id']}})[_0xbab6('0x20')](handleEntityNotFound(_0x2d919d,null))[_0xbab6('0x20')](function(_0x2a66de){if(_0x2a66de){_0x42f202['model']=_[_0xbab6('0x59')](db[_0xbab6('0x68')][_0xbab6('0x42')]);_0x42f202[_0xbab6('0x47')]=_[_0xbab6('0x59')](_0x1e226f[_0xbab6('0x47')]);_0x42f202[_0xbab6('0x48')]=_['intersection'](_0x42f202[_0xbab6('0x46')],_0x42f202[_0xbab6('0x47')]);_0x361e8c['attributes']=_[_0xbab6('0x5b')](_0x42f202['model'],qs['fields'](_0x1e226f[_0xbab6('0x47')][_0xbab6('0x4a')]));_0x361e8c[_0xbab6('0x49')]=_0x361e8c['attributes'][_0xbab6('0x4b')]?_0x361e8c['attributes']:_0x42f202[_0xbab6('0x46')];if(!_0x1e226f[_0xbab6('0x47')][_0xbab6('0x4c')](_0xbab6('0x4d'))){_0x361e8c[_0xbab6('0x30')]=qs[_0xbab6('0x30')](_0x1e226f[_0xbab6('0x47')][_0xbab6('0x30')]);_0x361e8c[_0xbab6('0x2e')]=qs['offset'](_0x1e226f[_0xbab6('0x47')][_0xbab6('0x2e')]);}_0x361e8c['order']=qs[_0xbab6('0x4e')](_0x1e226f[_0xbab6('0x47')][_0xbab6('0x4e')]);_0x361e8c[_0xbab6('0x4f')]=qs[_0xbab6('0x48')](_[_0xbab6('0x50')](_0x1e226f[_0xbab6('0x47')],_0x42f202['filters']));_0x361e8c[_0xbab6('0x4f')][_0xbab6('0x67')]=_0x2a66de['id'];if(_0x1e226f['query']['filter']){_0x361e8c[_0xbab6('0x4f')]=_[_0xbab6('0x52')](_0x361e8c[_0xbab6('0x4f')],{'$or':_[_0xbab6('0x41')](_0x361e8c[_0xbab6('0x49')],function(_0x54b396){var _0x58d86e={};_0x58d86e[_0x54b396]={'$like':'%'+_0x1e226f[_0xbab6('0x47')][_0xbab6('0x51')]+'%'};return _0x58d86e;})});}_0x361e8c=_[_0xbab6('0x52')]({},_0x361e8c,_0x1e226f['options']);return db[_0xbab6('0x68')]['count']({'where':_0x361e8c[_0xbab6('0x4f')]})[_0xbab6('0x20')](function(_0x3cd369){_0x380c88[_0xbab6('0x31')]=_0x3cd369;if(_0x1e226f[_0xbab6('0x47')][_0xbab6('0x55')]){_0x361e8c[_0xbab6('0x56')]=[{'all':!![]}];}return db[_0xbab6('0x68')]['findAll'](_0x361e8c);})[_0xbab6('0x20')](function(_0x586b75){_0x380c88[_0xbab6('0x57')]=_0x586b75;return _0x380c88;});}})[_0xbab6('0x20')](respondWithFilteredResult(_0x2d919d,_0x361e8c))[_0xbab6('0x64')](handleError(_0x2d919d,null));};exports[_0xbab6('0x6a')]=function(_0x415748,_0x246c44,_0x256a5d){return db[_0xbab6('0x5a')][_0xbab6('0x5c')]({'where':{'id':_0x415748[_0xbab6('0x58')]['id']}})['then'](handleEntityNotFound(_0x246c44,null))['then'](function(_0xe91b0c){if(_0xe91b0c){return _0xe91b0c[_0xbab6('0x6a')](_0x415748[_0xbab6('0x47')][_0xbab6('0x6b')]);}})[_0xbab6('0x20')](respondWithStatusCode(_0x246c44,null))['catch'](handleError(_0x246c44,null));};exports[_0xbab6('0x6c')]=function(_0x4b725f,_0x4fcb4b,_0xef1a79){if(_0x4b725f[_0xbab6('0x5e')]['id']){delete _0x4b725f[_0xbab6('0x5e')]['id'];}return db['SmsAccount'][_0xbab6('0x5c')]({'where':{'id':_0x4b725f[_0xbab6('0x58')]['id']}})[_0xbab6('0x20')](handleEntityNotFound(_0x4fcb4b,null))[_0xbab6('0x20')](function(_0x511e29){if(_0x511e29){_0x4b725f[_0xbab6('0x5e')]['SmsAccountId']=_0x511e29['id'];return db['CannedAnswer'][_0xbab6('0x5d')](_0x4b725f['body']);}})['then'](respondWithResult(_0x4fcb4b,null))[_0xbab6('0x64')](handleError(_0x4fcb4b,null));};exports['getAnswers']=function(_0x59e87e,_0x43daea,_0x4ea6e0){var _0x2e8852={'raw':![],'where':{}};var _0x5c9843={};var _0x44b24f={'count':0x0,'rows':[]};return db[_0xbab6('0x5a')][_0xbab6('0x6d')]({'where':{'id':_0x59e87e['params']['id']}})[_0xbab6('0x20')](handleEntityNotFound(_0x43daea,null))[_0xbab6('0x20')](function(_0x304d7a){if(_0x304d7a){_0x5c9843[_0xbab6('0x46')]=_[_0xbab6('0x59')](db['CannedAnswer'][_0xbab6('0x42')]);_0x5c9843[_0xbab6('0x47')]=_['keys'](_0x59e87e[_0xbab6('0x47')]);_0x5c9843[_0xbab6('0x48')]=_[_0xbab6('0x5b')](_0x5c9843[_0xbab6('0x46')],_0x5c9843[_0xbab6('0x47')]);_0x2e8852[_0xbab6('0x49')]=_[_0xbab6('0x5b')](_0x5c9843[_0xbab6('0x46')],qs['fields'](_0x59e87e[_0xbab6('0x47')][_0xbab6('0x4a')]));_0x2e8852[_0xbab6('0x49')]=_0x2e8852[_0xbab6('0x49')][_0xbab6('0x4b')]?_0x2e8852[_0xbab6('0x49')]:_0x5c9843[_0xbab6('0x46')];if(!_0x59e87e['query']['hasOwnProperty'](_0xbab6('0x4d'))){_0x2e8852[_0xbab6('0x30')]=qs[_0xbab6('0x30')](_0x59e87e[_0xbab6('0x47')][_0xbab6('0x30')]);_0x2e8852[_0xbab6('0x2e')]=qs[_0xbab6('0x2e')](_0x59e87e['query'][_0xbab6('0x2e')]);}_0x2e8852[_0xbab6('0x6e')]=qs[_0xbab6('0x4e')](_0x59e87e['query'][_0xbab6('0x4e')]);_0x2e8852['where']=qs['filters'](_['pick'](_0x59e87e[_0xbab6('0x47')],_0x5c9843['filters']));_0x2e8852[_0xbab6('0x4f')]['SmsAccountId']=_0x304d7a['id'];if(_0x59e87e['query'][_0xbab6('0x51')]){_0x2e8852['where']=_[_0xbab6('0x52')](_0x2e8852[_0xbab6('0x4f')],{'$or':_['map'](_0x2e8852[_0xbab6('0x49')],function(_0x3119be){var _0xcba0af={};_0xcba0af[_0x3119be]={'$like':'%'+_0x59e87e[_0xbab6('0x47')]['filter']+'%'};return _0xcba0af;})});}_0x2e8852=_[_0xbab6('0x52')]({},_0x2e8852,_0x59e87e[_0xbab6('0x54')]);return db[_0xbab6('0x6f')]['count']({'where':_0x2e8852[_0xbab6('0x4f')]})['then'](function(_0x39d9fb){_0x44b24f[_0xbab6('0x31')]=_0x39d9fb;if(_0x59e87e[_0xbab6('0x47')][_0xbab6('0x55')]){_0x2e8852['include']=[{'all':!![]}];}return db[_0xbab6('0x6f')][_0xbab6('0x70')](_0x2e8852);})[_0xbab6('0x20')](function(_0x11504e){_0x44b24f['rows']=_0x11504e;return _0x44b24f;});}})[_0xbab6('0x20')](respondWithFilteredResult(_0x43daea,_0x2e8852))[_0xbab6('0x64')](handleError(_0x43daea,null));};exports[_0xbab6('0x71')]=function(_0x15ec26,_0xc907f,_0x23648b){return db['SmsAccount'][_0xbab6('0x5c')]({'where':{'id':_0x15ec26[_0xbab6('0x58')]['id']}})[_0xbab6('0x20')](handleEntityNotFound(_0xc907f,null))['then'](function(_0x429a35){if(_0x429a35){return _0x429a35[_0xbab6('0x71')](_0x15ec26[_0xbab6('0x47')][_0xbab6('0x6b')]);}})[_0xbab6('0x20')](respondWithStatusCode(_0xc907f,null))[_0xbab6('0x64')](handleError(_0xc907f,null));};exports[_0xbab6('0x72')]=function(_0x177306,_0x1e4b97,_0x3b964b){var _0x5a3c4a={'channel':_0xbab6('0x73')};var _0x16dca1=[];var _0x36d81e=[];var _0x16ee17={};return db[_0xbab6('0x5a')]['find']({'where':{'id':_0x177306[_0xbab6('0x58')]['id']},'include':[{'model':db[_0xbab6('0x74')],'as':'Applications'}]})[_0xbab6('0x20')](handleEntityNotFound(_0x1e4b97,null))['then'](function(_0x4da553){_0x5a3c4a[_0xbab6('0x75')]=_0x4da553;_0x5a3c4a['applications']=_['orderBy'](_0x4da553[_0xbab6('0x76')],['priority'],[_0xbab6('0x77')]);if(_0x5a3c4a[_0xbab6('0x75')][_0xbab6('0x76')]){delete _0x5a3c4a[_0xbab6('0x75')][_0xbab6('0x76')];}return db[_0xbab6('0x78')][_0xbab6('0x66')]();})[_0xbab6('0x20')](function(_0x23cf5b){if(!_0x23cf5b){throw new db[(_0xbab6('0x79'))][(_0xbab6('0x7a'))](_0xbab6('0x7b'));}_0x16dca1=_[_0xbab6('0x7c')](_[_0xbab6('0x59')](_0x23cf5b),[_0xbab6('0x7d'),_0xbab6('0x7e')]);_0x36d81e=_['difference'](_[_0xbab6('0x59')](_0x23cf5b),['createdAt','updatedAt',_0xbab6('0x7f'),_0xbab6('0x80')]);_0x5a3c4a[_0xbab6('0x5e')]={'mapKey':_0xbab6('0x81')};if(_0x5a3c4a[_0xbab6('0x75')][_0xbab6('0x44')]){switch(_0x5a3c4a[_0xbab6('0x75')][_0xbab6('0x44')]){case _0xbab6('0x82'):_0x5a3c4a[_0xbab6('0x5e')]['from']=_0x177306[_0xbab6('0x5e')][_0xbab6('0x83')];_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x5e')]=_0x177306[_0xbab6('0x5e')][_0xbab6('0x84')];_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x85')]=_0x177306[_0xbab6('0x5e')][_0xbab6('0x86')];break;case'skebby':_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x87')]='+'+_0x177306[_0xbab6('0x5e')]['sender'];_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x5e')]=_0x177306[_0xbab6('0x5e')]['text'];break;case _0xbab6('0x88'):_0x5a3c4a[_0xbab6('0x5e')]['from']=_0x177306[_0xbab6('0x5e')][_0xbab6('0x87')];_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x5e')]=_0x177306[_0xbab6('0x5e')]['message'];break;case'clicksend':_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x87')]=_0x177306[_0xbab6('0x5e')][_0xbab6('0x87')];_0x5a3c4a['body'][_0xbab6('0x5e')]=_0x177306[_0xbab6('0x5e')][_0xbab6('0x5e')];_0x5a3c4a['body'][_0xbab6('0x85')]=_0x177306[_0xbab6('0x5e')][_0xbab6('0x89')];break;case _0xbab6('0x8a'):_0x5a3c4a[_0xbab6('0x5e')]['from']=_0x177306[_0xbab6('0x5e')]['From'];_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x5e')]=_0x177306['body'][_0xbab6('0x8b')];_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x85')]=_0x177306[_0xbab6('0x5e')][_0xbab6('0x8c')];break;case _0xbab6('0x8d'):_0x5a3c4a['body'][_0xbab6('0x87')]='+'+_0x177306[_0xbab6('0x5e')][_0xbab6('0x8e')][0x0][_0xbab6('0x87')];_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x5e')]=_0x177306[_0xbab6('0x5e')]['results'][0x0][_0xbab6('0x8f')];_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x85')]=_0x177306['body'][_0xbab6('0x8e')][0x0]['messageId'];break;case _0xbab6('0x90'):_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x87')]=_0x177306[_0xbab6('0x5e')]['originatingAddress'];_0x5a3c4a[_0xbab6('0x5e')]['body']=_0x177306[_0xbab6('0x5e')][_0xbab6('0x91')]['message'];break;case'clickatell':_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x87')]=_0x177306['body'][_0xbab6('0x92')];_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x5e')]=_0x177306[_0xbab6('0x5e')][_0xbab6('0x8f')];_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x85')]=_0x177306['body'][_0xbab6('0x93')];break;case _0xbab6('0x94'):_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x85')]=_0x177306[_0xbab6('0x5e')][0x0][_0xbab6('0x29')]['id'];_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x87')]=_0x177306[_0xbab6('0x5e')][0x0][_0xbab6('0x29')][_0xbab6('0x87')];_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x5e')]=_0x177306['body'][0x0][_0xbab6('0x29')][_0xbab6('0x8f')];break;case _0xbab6('0x95'):_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x87')]=_0x177306[_0xbab6('0x5e')][_0xbab6('0x87')];_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x5e')]=_0x177306[_0xbab6('0x5e')][_0xbab6('0x29')];_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x85')]=_0x177306[_0xbab6('0x5e')][_0xbab6('0x96')];break;}}if(_0x5a3c4a[_0xbab6('0x5e')]['id']){delete _0x5a3c4a['body']['id'];}if(_['isNil'](_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x87')])){throw new db[(_0xbab6('0x79'))][(_0xbab6('0x7a'))](_0xbab6('0x97'));}if(_[_0xbab6('0x98')](_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x5e')])||_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x5e')]===''){throw new db[(_0xbab6('0x79'))]['ValidationError'](_0xbab6('0x99'));}if(_['isNil'](_0x5a3c4a[_0xbab6('0x5e')]['mapKey'])){throw new db[(_0xbab6('0x79'))]['ValidationError'](_0xbab6('0x9a')+_0x36d81e);}if(!_[_0xbab6('0x9b')](_0x36d81e,_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x9c')])){throw new db[(_0xbab6('0x79'))][(_0xbab6('0x7a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x36d81e);}_0x16ee17[_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x9c')]]=_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x87')];return db['CmList']['find']({'where':{'id':_0x5a3c4a[_0xbab6('0x75')][_0xbab6('0x80')]},'include':[{'model':db['CmContact'],'as':_0xbab6('0x9d'),'where':_0x16ee17,'limit':0x1,'order':[[_0xbab6('0x7e'),_0xbab6('0x9e')]]}]});})[_0xbab6('0x20')](handleEntityNotFound(_0x1e4b97,null))['then'](function(_0x211a9f){if(_0x211a9f){_0x5a3c4a[_0xbab6('0x9f')]=_[_0xbab6('0xa0')](_0x211a9f,[_0xbab6('0x9d')]);if(_0x211a9f[_0xbab6('0x9d')][_0xbab6('0x4b')]){return _0x211a9f['Contacts'][0x0];}var _0x579e98=_[_0xbab6('0x17')](_0x5a3c4a[_0xbab6('0x5e')],{'firstName':_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x87')],'ListId':_0x211a9f['id']});_0x579e98[_0x5a3c4a['body']['mapKey']]=_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x87')];return db[_0xbab6('0x78')][_0xbab6('0x5d')](_0x579e98,{'fields':_0x16dca1,'raw':!![]});}})[_0xbab6('0x20')](handleEntityNotFound(_0x1e4b97,null))[_0xbab6('0x20')](function(_0x5c896e){if(_0x5c896e){_0x5a3c4a['contact']=_0x5c896e;var _0x253533={'ContactId':_0x5c896e['id'],'phone':_0x5a3c4a['body'][_0xbab6('0x87')],'SmsAccountId':_0x177306[_0xbab6('0x58')]['id']};var _0x5e43c7={'ContactId':_0x5c896e['id'],'SmsAccountId':_0x177306[_0xbab6('0x58')]['id'],'closed':![]};return db['SmsInteraction'][_0xbab6('0x5c')]({'where':_0x5e43c7})[_0xbab6('0x20')](function(_0x4d4b9a){if(_0x4d4b9a){return[_0x4d4b9a,![]];}return db['SmsInteraction']['create'](_0x253533)['then'](function(_0xd3d06e){return[_0xd3d06e,!![]];});});}})[_0xbab6('0xa1')](function(_0x1e0d30,_0x47938d){_0x5a3c4a[_0xbab6('0xa2')]=_0x1e0d30[_0xbab6('0x38')]({'plain':!![]});_0x5a3c4a[_0xbab6('0xa2')][_0xbab6('0xa3')]=![];if(_0x47938d){if(_0x5a3c4a[_0xbab6('0x75')][_0xbab6('0xa4')]){_0x5a3c4a[_0xbab6('0xa5')][_0xbab6('0xa6')]({'id':0x0,'priority':_0x5a3c4a[_0xbab6('0xa5')]['length']+0x1,'app':_0xbab6('0xa7'),'appdata':_0xbab6('0xa8'),'interval':_0xbab6('0xa9')});}_0x5a3c4a[_0xbab6('0xa2')]['created']=!![];}return db['SmsMessage'][_0xbab6('0x5d')]({'phone':_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x87')],'messageId':_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x85')],'body':_0x5a3c4a[_0xbab6('0x5e')][_0xbab6('0x5e')],'SmsAccountId':_0x177306['params']['id'],'SmsInteractionId':_0x1e0d30['id'],'direction':'in','ContactId':_0x1e0d30['ContactId'],'AttachmentId':_0x5a3c4a[_0xbab6('0x5e')]['AttachmentId']});})[_0xbab6('0x20')](function(_0x3c6246){_0x5a3c4a[_0xbab6('0x29')]=_0x3c6246;if(_0x5a3c4a[_0xbab6('0xa2')][_0xbab6('0xaa')]){return db['User'][_0xbab6('0x5c')]({'attributes':['id',_0xbab6('0x3c')],'where':{'id':_0x5a3c4a[_0xbab6('0xa2')]['UserId']}})['then'](function(_0x5b10db){if(_0x5b10db){_0x5a3c4a[_0xbab6('0xa5')][_0xbab6('0xab')]({'id':0x0,'priority':0x0,'app':_0xbab6('0xac'),'appdata':_0x5b10db['name']+','+(_0x5a3c4a[_0xbab6('0x75')][_0xbab6('0xad')]||0xa),'interval':_0xbab6('0xa9')});}return respondWithRpcPromise(_0xbab6('0xae'),_0xbab6('0xaf'),_0x5a3c4a);});}return respondWithRpcPromise('Start','startRouting',_0x5a3c4a);})[_0xbab6('0x20')](function(_0x504ac6){if(_0x504ac6){var _0xf2ca47=0xc8;var _0x8ea86b=_0xbab6('0xb0');logger[_0xbab6('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8ea86b,_0xf2ca47,_0xbab6('0xb1'));logger[_0xbab6('0x24')](_0xbab6('0xb2'),_0x8ea86b,_0xf2ca47,'entity\x20found',JSON[_0xbab6('0x26')](_0x504ac6));if(_0x5a3c4a['account'][_0xbab6('0x44')]===_0xbab6('0x82')){return _0x1e4b97[_0xbab6('0x2c')](_0xf2ca47)['set']('Content-Type','text/xml')[_0xbab6('0x3d')](_0xbab6('0xb3'));}else{return _0x1e4b97['status'](_0xf2ca47)[_0xbab6('0x2d')](_0x504ac6);}}})[_0xbab6('0x64')](handleError(_0x1e4b97,null));};exports[_0xbab6('0xb4')]=function(_0x52f902,_0x25f806,_0x333091){return db[_0xbab6('0x5a')][_0xbab6('0x6d')]({'where':{'id':_0x52f902[_0xbab6('0x58')]['id']}})[_0xbab6('0x20')](handleEntityNotFound(_0x25f806,null))[_0xbab6('0x20')](function(_0x4025a5){if(_0x4025a5){return db['sequelize']['transaction'](function(_0x50e260){return db['SmsApplication'][_0xbab6('0x37')]({'where':{'SmsAccountId':_0x52f902[_0xbab6('0x58')]['id']},'transaction':_0x50e260})[_0xbab6('0x20')](function(_0x1fac13){var _0x176d04=_[_0xbab6('0x41')](_0x52f902[_0xbab6('0x5e')],function(_0x1a62bb){_0x1a62bb[_0xbab6('0x67')]=_0x52f902[_0xbab6('0x58')]['id'];return _0x1a62bb;});return db['SmsApplication'][_0xbab6('0xb5')](_0x176d04,{'transaction':_0x50e260});});})[_0xbab6('0x20')](function(){return db[_0xbab6('0x74')][_0xbab6('0xb6')]({'where':{'SmsAccountId':_0x52f902[_0xbab6('0x58')]['id']},'order':_0xbab6('0xb7')});});}})[_0xbab6('0x20')](respondWithResult(_0x25f806,null))[_0xbab6('0x64')](handleError(_0x25f806,null));};exports[_0xbab6('0xb8')]=function(_0x25c21b,_0x367bdd,_0x26701b){var _0x28d553={};var _0x4888a9={};var _0x53ca3a;var _0x4b9203;return db['SmsAccount'][_0xbab6('0x6d')]({'where':{'id':_0x25c21b[_0xbab6('0x58')]['id']}})[_0xbab6('0x20')](handleEntityNotFound(_0x367bdd,null))['then'](function(_0x588f77){if(_0x588f77){_0x53ca3a=_0x588f77;_0x4888a9['model']=_['keys'](db[_0xbab6('0x74')]['rawAttributes']);_0x4888a9[_0xbab6('0x47')]=_[_0xbab6('0x59')](_0x25c21b[_0xbab6('0x47')]);_0x4888a9['filters']=_[_0xbab6('0x5b')](_0x4888a9['model'],_0x4888a9[_0xbab6('0x47')]);_0x28d553[_0xbab6('0x49')]=_['intersection'](_0x4888a9['model'],qs[_0xbab6('0x4a')](_0x25c21b[_0xbab6('0x47')]['fields']));_0x28d553[_0xbab6('0x49')]=_0x28d553['attributes'][_0xbab6('0x4b')]?_0x28d553['attributes']:_0x4888a9['model'];_0x28d553[_0xbab6('0x6e')]=qs['sort'](_0x25c21b['query'][_0xbab6('0x4e')]);_0x28d553[_0xbab6('0x4f')]=qs[_0xbab6('0x48')](_[_0xbab6('0x50')](_0x25c21b[_0xbab6('0x47')],_0x4888a9[_0xbab6('0x48')]));if(_0x25c21b[_0xbab6('0x47')][_0xbab6('0x51')]){_0x28d553[_0xbab6('0x4f')]=_[_0xbab6('0x52')](_0x28d553['where'],{'$or':_['map'](_0x28d553[_0xbab6('0x49')],function(_0xf2485f){var _0x5c0dab={};_0x5c0dab[_0xf2485f]={'$like':'%'+_0x25c21b['query'][_0xbab6('0x51')]+'%'};return _0x5c0dab;})});}_0x28d553=_[_0xbab6('0x52')]({},_0x28d553,_0x25c21b['options']);return _0x53ca3a[_0xbab6('0xb8')](_0x28d553);}})[_0xbab6('0x20')](function(_0xde20e8){if(_0xde20e8){_0x4b9203=_0xde20e8['length'];if(!_0x25c21b[_0xbab6('0x47')]['hasOwnProperty'](_0xbab6('0x4d'))){_0x28d553[_0xbab6('0x30')]=qs[_0xbab6('0x30')](_0x25c21b[_0xbab6('0x47')][_0xbab6('0x30')]);_0x28d553[_0xbab6('0x2e')]=qs[_0xbab6('0x2e')](_0x25c21b[_0xbab6('0x47')]['offset']);}return _0x53ca3a['getApplications'](_0x28d553);}})['then'](function(_0x4bac8f){if(_0x4bac8f){return _0x4bac8f?{'count':_0x4b9203,'rows':_0x4bac8f}:null;}})['then'](respondWithResult(_0x367bdd,null))['catch'](handleError(_0x367bdd,null));};exports['getInteractions']=function(_0x4a5504,_0x43edf,_0x965b83){var _0x985977={'raw':![],'where':{}};var _0x48e379={};var _0x2ebcbc={'count':0x0,'rows':[]};return db['SmsAccount'][_0xbab6('0x6d')]({'where':{'id':_0x4a5504[_0xbab6('0x58')]['id']}})[_0xbab6('0x20')](handleEntityNotFound(_0x43edf,null))[_0xbab6('0x20')](function(_0x903385){if(_0x903385){_0x48e379[_0xbab6('0x46')]=_['keys'](db[_0xbab6('0xb9')]['rawAttributes']);_0x48e379[_0xbab6('0x47')]=_[_0xbab6('0x59')](_0x4a5504['query']);_0x48e379['filters']=_[_0xbab6('0x5b')](_0x48e379[_0xbab6('0x46')],_0x48e379[_0xbab6('0x47')]);_0x985977[_0xbab6('0x49')]=_['intersection'](_0x48e379[_0xbab6('0x46')],qs['fields'](_0x4a5504[_0xbab6('0x47')][_0xbab6('0x4a')]));_0x985977[_0xbab6('0x49')]=_0x985977['attributes'][_0xbab6('0x4b')]?_0x985977['attributes']:_0x48e379[_0xbab6('0x46')];if(!_0x4a5504[_0xbab6('0x47')][_0xbab6('0x4c')](_0xbab6('0x4d'))){_0x985977[_0xbab6('0x30')]=qs[_0xbab6('0x30')](_0x4a5504[_0xbab6('0x47')]['limit']);_0x985977[_0xbab6('0x2e')]=qs[_0xbab6('0x2e')](_0x4a5504['query'][_0xbab6('0x2e')]);}_0x985977[_0xbab6('0x6e')]=qs[_0xbab6('0x4e')](_0x4a5504['query'][_0xbab6('0x4e')]);_0x985977[_0xbab6('0x4f')]=qs[_0xbab6('0x48')](_[_0xbab6('0x50')](_0x4a5504['query'],_0x48e379[_0xbab6('0x48')]));_0x985977['where'][_0xbab6('0x67')]=_0x903385['id'];if(_0x4a5504[_0xbab6('0x47')]['filter']){_0x985977[_0xbab6('0x4f')]=_[_0xbab6('0x52')](_0x985977[_0xbab6('0x4f')],{'$or':_[_0xbab6('0x41')](_0x985977[_0xbab6('0x49')],function(_0x1b8ffb){var _0x3e4710={};_0x3e4710[_0x1b8ffb]={'$like':'%'+_0x4a5504['query'][_0xbab6('0x51')]+'%'};return _0x3e4710;})});}_0x985977=_['merge']({},_0x985977,_0x4a5504[_0xbab6('0x54')]);return db['SmsInteraction'][_0xbab6('0x31')]({'where':_0x985977['where']})[_0xbab6('0x20')](function(_0x1a02c7){_0x2ebcbc[_0xbab6('0x31')]=_0x1a02c7;if(_0x4a5504[_0xbab6('0x47')]['includeAll']){_0x985977[_0xbab6('0x56')]=[{'model':db['CmContact'],'as':_0xbab6('0xba'),'required':![]},{'model':db[_0xbab6('0xbb')],'as':_0xbab6('0xbc'),'attributes':[_0xbab6('0x3c'),_0xbab6('0xbd'),_0xbab6('0xbe')],'required':![]},{'model':db[_0xbab6('0xbf')],'as':_0xbab6('0xc0'),'attributes':['id',_0xbab6('0x3c'),_0xbab6('0xc1')],'where':_0x4a5504['query'][_0xbab6('0xc2')]?{'id':_0x4a5504[_0xbab6('0x47')][_0xbab6('0xc2')]}:undefined,'required':_0x4a5504[_0xbab6('0x47')]['tag']?!![]:![]}];}return db[_0xbab6('0xb9')][_0xbab6('0x70')](_0x985977);})[_0xbab6('0x20')](function(_0x4a3cb3){_0x2ebcbc[_0xbab6('0x57')]=_0x4a3cb3;return _0x2ebcbc;});}})[_0xbab6('0x20')](respondWithFilteredResult(_0x43edf,_0x985977))[_0xbab6('0x64')](handleError(_0x43edf,null));};exports[_0xbab6('0x3d')]=function(_0x1ade04,_0x4b6384,_0x595cd8){var _0x2b0b46,_0x2e0e82,_0xbffa1;if(_[_0xbab6('0x98')](_0x1ade04['body'][_0xbab6('0x5e')])||_0x1ade04['body']['body']===''){throw new db[(_0xbab6('0x79'))][(_0xbab6('0x7a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xbab6('0x98')](_0x1ade04[_0xbab6('0x5e')]['to'])){throw new db[(_0xbab6('0x79'))][(_0xbab6('0x7a'))](_0xbab6('0xc3'));}_0x2b0b46=_0x1ade04[_0xbab6('0x5e')]['to'];return db['SmsAccount'][_0xbab6('0x5c')]({'where':{'id':_0x1ade04['params']['id']},'include':[{'model':db[_0xbab6('0xc4')],'as':_0xbab6('0xc5'),'include':[{'model':db[_0xbab6('0x78')],'as':'Contacts','where':{'mobile':_0x2b0b46},'limit':0x1,'order':[[_0xbab6('0x7e'),_0xbab6('0x9e')]]}]}]})[_0xbab6('0x20')](handleEntityNotFound(_0x4b6384,null))[_0xbab6('0x20')](function(_0x316f6d){if(_0x316f6d&&_0x316f6d[_0xbab6('0xc5')]){_0x2e0e82=_0x316f6d['get']({'plain':!![]});if(_0x2e0e82[_0xbab6('0xc5')]&&_0x2e0e82[_0xbab6('0xc5')][_0xbab6('0x9d')][_0xbab6('0x4b')]){return _0x2e0e82['List'][_0xbab6('0x9d')][0x0];}return db[_0xbab6('0x78')][_0xbab6('0x5d')](_[_0xbab6('0x17')](_0x1ade04['body'],{'firstName':_0x2b0b46,'mobile':_0x2b0b46,'phone':_0x2b0b46,'ListId':_0x2e0e82['ListId']}));}})[_0xbab6('0x20')](handleEntityNotFound(_0x4b6384,null))[_0xbab6('0x20')](function(_0x35a310){if(_0x35a310){_0xbffa1=_0x35a310;return db[_0xbab6('0xb9')][_0xbab6('0x5c')]({'where':{'ContactId':_0xbffa1['id'],'closed':![],'SmsAccountId':_0x2e0e82['id']}})[_0xbab6('0x20')](function(_0x1bb3f2){if(_0x1bb3f2){return[_0x1bb3f2,![]];}return db[_0xbab6('0xb9')][_0xbab6('0x5d')]({'UserId':_0x1ade04[_0xbab6('0x5f')]['id'],'ContactId':_0xbffa1['id'],'SmsAccountId':_0x2e0e82['id'],'phone':_0x2b0b46,'firstMsgDirection':_0xbab6('0xc6'),'Messages':[_[_0xbab6('0x52')](_0x1ade04[_0xbab6('0x5e')],{'read':![],'body':_0x1ade04['body'][_0xbab6('0x5e')],'phone':_0x2b0b46,'SmsAccountId':_0x2e0e82['id'],'UserId':_0x1ade04[_0xbab6('0x5f')]['id'],'ContactId':_0xbffa1['id']})]},{'include':[{'model':db[_0xbab6('0xc7')],'as':'Messages'}]})[_0xbab6('0x20')](function(_0x1e1e35){return[_0x1e1e35,!![]];});});}})['spread'](function(_0x1b9bda,_0x11ba4d){if(_0x11ba4d){return _0x1b9bda;}return db['SmsMessage'][_0xbab6('0x5d')](_[_0xbab6('0x52')](_0x1ade04[_0xbab6('0x5e')],{'read':![],'body':_0x1ade04['body'][_0xbab6('0x5e')],'phone':_0x2b0b46,'SmsAccountId':_0x2e0e82['id'],'SmsInteractionId':_0x1b9bda['id'],'UserId':_0x1ade04[_0xbab6('0x5f')]['id'],'ContactId':_0xbffa1['id']}))['then'](function(_0xda0a1a){_0x1b9bda['dataValues'][_0xbab6('0xc8')]=[];_0x1b9bda['dataValues'][_0xbab6('0xc8')][_0xbab6('0xa6')](_0xda0a1a['dataValues']);return _0x1b9bda;});})[_0xbab6('0x20')](respondWithResult(_0x4b6384,null))[_0xbab6('0x64')](handleError(_0x4b6384,null));};exports[_0xbab6('0x2c')]=function(_0x250b75,_0x3b4bf1,_0x4c8ff5){if(_0x250b75[_0xbab6('0x5e')]['id']){delete _0x250b75['body']['id'];}var _0x588b16,_0x2721bc,_0x56de1b;return db[_0xbab6('0x5a')][_0xbab6('0x5c')]({'where':{'id':_0x250b75['params']['id']}})[_0xbab6('0x20')](handleEntityNotFound(_0x3b4bf1,null))[_0xbab6('0x20')](function(_0x51498c){if(_0x51498c){_0x56de1b=_0x51498c;logger[_0xbab6('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xbab6('0x2c'),_0xbab6('0xc9'),_0x51498c['type'],util[_0xbab6('0xca')](_0x250b75['body'],{'showHidden':![],'depth':null}));switch(_0x51498c[_0xbab6('0x44')]){case _0xbab6('0xcb'):if(_0x250b75[_0xbab6('0x5e')]['skebby_dispatch_id']&&_0x250b75[_0xbab6('0x5e')][_0xbab6('0x2c')]){_0x2721bc=_0x250b75['body'][_0xbab6('0x2c')];return db[_0xbab6('0xc7')][_0xbab6('0x5c')]({'where':{'messageId':_0x250b75[_0xbab6('0x5e')][_0xbab6('0xcc')]}});}break;case _0xbab6('0x88'):if(_0x250b75[_0xbab6('0x5e')][_0xbab6('0xcd')]&&_0x250b75[_0xbab6('0x5e')][_0xbab6('0xce')]){_0x2721bc=_0x250b75['body']['statusInt'];return db['SmsMessage'][_0xbab6('0x5c')]({'where':{'messageId':_0x250b75['body'][_0xbab6('0xcd')]}});}break;case'clicksend':if(_0x250b75[_0xbab6('0x5e')][_0xbab6('0x89')]&&_0x250b75[_0xbab6('0x5e')][_0xbab6('0xcf')]){_0x2721bc=_0x250b75[_0xbab6('0x5e')][_0xbab6('0xcf')];return db['SmsMessage'][_0xbab6('0x5c')]({'where':{'messageId':_0x250b75[_0xbab6('0x5e')][_0xbab6('0x89')]}});}break;case'infobip':var _0x108d27=_0x250b75['body'][_0xbab6('0x8e')][0x0];if(_0x108d27[_0xbab6('0x85')]&&_0x108d27[_0xbab6('0x2c')]['groupName']===_0xbab6('0xd0')){_0x2721bc=_0x108d27[_0xbab6('0x2c')][_0xbab6('0xd1')];return db[_0xbab6('0xc7')][_0xbab6('0x5c')]({'where':{'messageId':_0x108d27['messageId']}});}break;case _0xbab6('0xd2'):if(_0x250b75[_0xbab6('0x5e')][_0xbab6('0x85')]&&_0x250b75[_0xbab6('0x5e')][_0xbab6('0x2c')]){_0x2721bc=_0x250b75['body']['status'];return db[_0xbab6('0xc7')]['find']({'where':{'messageId':_0x250b75[_0xbab6('0x5e')][_0xbab6('0x85')]}});}break;case _0xbab6('0x94'):if(_0x250b75[_0xbab6('0x5e')][0x0][_0xbab6('0x29')]['id']){_0x2721bc=_0x250b75[_0xbab6('0x5e')][0x0][_0xbab6('0x44')];return db[_0xbab6('0xc7')][_0xbab6('0x5c')]({'where':{'messageId':_0x250b75[_0xbab6('0x5e')][0x0][_0xbab6('0x29')]['id']}});}break;case _0xbab6('0x95'):if(_0x250b75[_0xbab6('0x5e')][_0xbab6('0xd3')]&&_0x250b75[_0xbab6('0x5e')][_0xbab6('0x2c')]){_0x2721bc=_0x250b75[_0xbab6('0x5e')][_0xbab6('0x2c')];return db[_0xbab6('0xc7')][_0xbab6('0x5c')]({'where':{'messageId':_0x250b75[_0xbab6('0x5e')][_0xbab6('0xd3')]}});}break;}}})[_0xbab6('0x20')](handleEntityNotFound(_0x3b4bf1,null))[_0xbab6('0x20')](function(_0x4272e4){if(_0x4272e4){_0x588b16=_0x4272e4;switch(_0x56de1b[_0xbab6('0x44')]){case _0xbab6('0xcb'):if(_0x2721bc===_0xbab6('0xd0')){return _0x588b16[_0xbab6('0x36')]({'read':!![]});}else{logger[_0xbab6('0x27')](_0xbab6('0x25'),_0xbab6('0x2c'),_0xbab6('0xcb'),util[_0xbab6('0xca')](_0x250b75[_0xbab6('0x5e')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x2721bc==='1'){return _0x588b16['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xbab6('0x2c'),_0xbab6('0xcb'),util[_0xbab6('0xca')](_0x250b75[_0xbab6('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xbab6('0xd4'):if(!_0x250b75[_0xbab6('0x5e')][_0xbab6('0xd5')]&&_0x2721bc>=0xc8&&_0x2721bc<=0xce){return _0x588b16[_0xbab6('0x36')]({'read':!![]});}else{logger['error'](_0xbab6('0x25'),_0xbab6('0x2c'),_0xbab6('0xd4'),util[_0xbab6('0xca')](_0x250b75['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0xbca367=_0x250b75[_0xbab6('0x5e')][_0xbab6('0x8e')][0x0];if(_0xbca367[_0xbab6('0x2c')][_0xbab6('0xd1')]===_0xbab6('0xd0')){return _0x588b16['update']({'read':!![]});}else{logger[_0xbab6('0x27')](_0xbab6('0x25'),_0xbab6('0x2c'),'infobip',util['inspect'](_0x250b75['body'],{'showHidden':![],'depth':null}));}break;case _0xbab6('0xd2'):if(_0x2721bc==_0xbab6('0xd6')||_0x2721bc=='RECEIVED_BY_RECIPIENT'){return _0x588b16[_0xbab6('0x36')]({'read':!![]});}else{logger[_0xbab6('0x27')](_0xbab6('0x25'),_0xbab6('0x2c'),_0xbab6('0xd2'),util[_0xbab6('0xca')](_0x250b75['body'],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x2721bc=='message-delivered'){return _0x588b16[_0xbab6('0x36')]({'read':!![]});}else{logger[_0xbab6('0x27')](_0xbab6('0x25'),'status',_0xbab6('0x94'),util[_0xbab6('0xca')](_0x250b75[_0xbab6('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xbab6('0x95'):if(_0x2721bc===_0xbab6('0xd7')||_0x2721bc===_0xbab6('0xd8')){return _0x588b16[_0xbab6('0x36')]({'read':!![]});}else{logger[_0xbab6('0x27')](_0xbab6('0x25'),_0xbab6('0x2c'),_0xbab6('0x95'),util[_0xbab6('0xca')](_0x250b75['body'],{'showHidden':![],'depth':null}));}break;}return _0x588b16;}})[_0xbab6('0x20')](respondWithResult(_0x3b4bf1,null))[_0xbab6('0x64')](handleError(_0x3b4bf1,null));};exports[_0xbab6('0xd9')]=function(_0x32b661,_0x21d70d,_0x24d335){var _0x84b80b,_0x27eee1,_0x37fa33;return db[_0xbab6('0x5a')][_0xbab6('0x5c')]({'where':{'id':_0x32b661['params']['id']}})['then'](handleEntityNotFound(_0x21d70d,null))[_0xbab6('0x20')](function(_0x48f175){if(_0x48f175){_0x37fa33=_0x48f175;logger[_0xbab6('0x24')](_0xbab6('0x25'),_0xbab6('0x2c'),'received\x20delivery\x20report\x20from',_0x48f175[_0xbab6('0x44')],util['inspect'](_0x32b661['query'],{'showHidden':![],'depth':null}));switch(_0x48f175[_0xbab6('0x44')]){case'csc':if(_0x32b661[_0xbab6('0x47')][_0xbab6('0xda')]&&_0x32b661['query']['state']){_0x27eee1=_0x32b661[_0xbab6('0x47')][_0xbab6('0xdb')];return db['SmsMessage'][_0xbab6('0x5c')]({'where':{'messageId':_0x32b661[_0xbab6('0x47')]['message-id']}});}break;}}})[_0xbab6('0x20')](handleEntityNotFound(_0x21d70d,null))[_0xbab6('0x20')](function(_0x56f550){if(_0x56f550){_0x84b80b=_0x56f550;switch(_0x37fa33['type']){case _0xbab6('0x90'):if(_0x27eee1==='2'||_0x27eee1==='6'){return _0x84b80b[_0xbab6('0x36')]({'read':!![]});}else{logger['error'](_0xbab6('0x25'),_0xbab6('0x2c'),'csc',util[_0xbab6('0xca')](_0x32b661[_0xbab6('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x84b80b;}})[_0xbab6('0x20')](respondWithResult(_0x21d70d,null))[_0xbab6('0x64')](handleError(_0x21d70d,null));};exports[_0xbab6('0xdc')]=function(_0x50e33a,_0x74d1e2,_0x2d650a){return db[_0xbab6('0x5a')][_0xbab6('0x5c')]({'where':{'id':_0x50e33a['params']['id']}})[_0xbab6('0x20')](handleEntityNotFound(_0x74d1e2,null))['then'](function(_0xa9ac91){if(_0xa9ac91){return _0xa9ac91[_0xbab6('0xdc')](_0x50e33a[_0xbab6('0x5e')][_0xbab6('0x6b')],_[_0xbab6('0xa0')](_0x50e33a[_0xbab6('0x5e')],[_0xbab6('0x6b'),'id'])||{})[_0xbab6('0xa1')](function(_0x7e5140){for(var _0x495504=0x0;_0x495504<_0x50e33a[_0xbab6('0x5e')]['ids']['length'];_0x495504+=0x1){socket['emit'](_0xbab6('0xdd'),{'UserId':Number(_0x50e33a[_0xbab6('0x5e')]['ids'][_0x495504]),'SmsAccountId':Number(_0x50e33a[_0xbab6('0x58')]['id'])});}return _0x7e5140;});}})[_0xbab6('0x20')](respondWithResult(_0x74d1e2,null))[_0xbab6('0x64')](handleError(_0x74d1e2,null));};exports[_0xbab6('0xde')]=function(_0x1c97b6,_0x4805d4,_0x52b158){return db[_0xbab6('0x5a')][_0xbab6('0x5c')]({'where':{'id':_0x1c97b6[_0xbab6('0x58')]['id']}})[_0xbab6('0x20')](handleEntityNotFound(_0x4805d4,null))[_0xbab6('0x20')](function(_0x2cf6f5){if(_0x2cf6f5){return _0x2cf6f5[_0xbab6('0xde')](_0x1c97b6[_0xbab6('0x47')][_0xbab6('0x6b')])[_0xbab6('0x20')](function(){if(_[_0xbab6('0xdf')](_0x1c97b6[_0xbab6('0x47')][_0xbab6('0x6b')])){for(var _0x3f0f2e=0x0;_0x3f0f2e<_0x1c97b6[_0xbab6('0x47')][_0xbab6('0x6b')][_0xbab6('0x4b')];_0x3f0f2e+=0x1){socket['emit'](_0xbab6('0xe0'),{'UserId':Number(_0x1c97b6[_0xbab6('0x47')]['ids'][_0x3f0f2e]),'SmsAccountId':Number(_0x1c97b6['params']['id'])});}}else{socket['emit'](_0xbab6('0xe0'),{'UserId':Number(_0x1c97b6[_0xbab6('0x47')][_0xbab6('0x6b')]),'SmsAccountId':Number(_0x1c97b6[_0xbab6('0x58')]['id'])});}});}})[_0xbab6('0x20')](respondWithStatusCode(_0x4805d4,null))[_0xbab6('0x64')](handleError(_0x4805d4,null));};exports['getAgents']=function(_0x2bcfd9,_0x1e0dc7,_0x2dad89){var _0x398776={};var _0x221021={};var _0x57a244;var _0x56f17b;return db[_0xbab6('0x5a')][_0xbab6('0x6d')]({'where':{'id':_0x2bcfd9[_0xbab6('0x58')]['id']}})[_0xbab6('0x20')](handleEntityNotFound(_0x1e0dc7,null))['then'](function(_0x2a9a4e){if(_0x2a9a4e){_0x57a244=_0x2a9a4e;_0x221021[_0xbab6('0x46')]=_['keys'](db['User'][_0xbab6('0x42')]);_0x221021['query']=_[_0xbab6('0x59')](_0x2bcfd9['query']);_0x221021['filters']=_[_0xbab6('0x5b')](_0x221021['model'],_0x221021[_0xbab6('0x47')]);_0x398776[_0xbab6('0x49')]=_[_0xbab6('0x5b')](_0x221021[_0xbab6('0x46')],qs[_0xbab6('0x4a')](_0x2bcfd9[_0xbab6('0x47')][_0xbab6('0x4a')]));_0x398776['attributes']=_0x398776['attributes']['length']?_0x398776[_0xbab6('0x49')]:_0x221021['model'];_0x398776[_0xbab6('0x6e')]=qs[_0xbab6('0x4e')](_0x2bcfd9[_0xbab6('0x47')][_0xbab6('0x4e')]);_0x398776[_0xbab6('0x4f')]=qs[_0xbab6('0x48')](_[_0xbab6('0x50')](_0x2bcfd9[_0xbab6('0x47')],_0x221021[_0xbab6('0x48')]));if(_0x2bcfd9[_0xbab6('0x47')][_0xbab6('0x51')]){_0x398776['where']=_[_0xbab6('0x52')](_0x398776['where'],{'$or':_['map'](_0x398776[_0xbab6('0x49')],function(_0x589e4f){var _0x26b9cc={};_0x26b9cc[_0x589e4f]={'$like':'%'+_0x2bcfd9[_0xbab6('0x47')][_0xbab6('0x51')]+'%'};return _0x26b9cc;})});}_0x398776=_['merge']({},_0x398776,_0x2bcfd9['options']);return _0x57a244[_0xbab6('0xe1')](_0x398776);}})[_0xbab6('0x20')](function(_0x1b47aa){if(_0x1b47aa){_0x56f17b=_0x1b47aa[_0xbab6('0x4b')];if(!_0x2bcfd9[_0xbab6('0x47')]['hasOwnProperty']('nolimit')){_0x398776['limit']=qs[_0xbab6('0x30')](_0x2bcfd9[_0xbab6('0x47')]['limit']);_0x398776[_0xbab6('0x2e')]=qs[_0xbab6('0x2e')](_0x2bcfd9['query']['offset']);}return _0x57a244[_0xbab6('0xe1')](_0x398776);}})['then'](function(_0x4d670d){if(_0x4d670d){return _0x4d670d?{'count':_0x56f17b,'rows':_0x4d670d}:null;}})[_0xbab6('0x20')](respondWithResult(_0x1e0dc7,null))[_0xbab6('0x64')](handleError(_0x1e0dc7,null));}; \ No newline at end of file +var _0xfc44=['Disposition','getDispositions','order','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','hasOwnProperty','includeAll','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','Body','messageId','skebby','sender','connectel','clicksend','Text','MessageUUID','infobip','results','text','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','CmContact','Contacts','DESC','list','omit','SmsInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','\x0a','addApplications','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','List','out','Messages','spread','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','status_code','groupName','DELIVERED','redif','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','UserProfileResource','stack','name','send','Pause','map','SmsAccount','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','include','rows','show','params','mandatoryDispositionPause','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','SmsAccountId'];(function(_0x2b5a7e,_0x404521){var _0x10d210=function(_0x1a9357){while(--_0x1a9357){_0x2b5a7e['push'](_0x2b5a7e['shift']());}};_0x10d210(++_0x404521);}(_0xfc44,0x15f));var _0x4fc4=function(_0x5e0eeb,_0x36f208){_0x5e0eeb=_0x5e0eeb-0x0;var _0x52b9a0=_0xfc44[_0x5e0eeb];return _0x52b9a0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4fc4('0x0'));var jsonpatch=require(_0x4fc4('0x1'));var rp=require(_0x4fc4('0x2'));var moment=require(_0x4fc4('0x3'));var BPromise=require(_0x4fc4('0x4'));var Mustache=require(_0x4fc4('0x5'));var util=require(_0x4fc4('0x6'));var path=require('path');var sox=require(_0x4fc4('0x7'));var csv=require('to-csv');var ejs=require(_0x4fc4('0x8'));var fs=require('fs');var fs_extra=require(_0x4fc4('0x9'));var _=require('lodash');var squel=require(_0x4fc4('0xa'));var crypto=require(_0x4fc4('0xb'));var jsforce=require(_0x4fc4('0xc'));var deskjs=require(_0x4fc4('0xd'));var toCsv=require(_0x4fc4('0xe'));var querystring=require('querystring');var Papa=require(_0x4fc4('0xf'));var Redis=require('ioredis');var authService=require(_0x4fc4('0x10'));var qs=require(_0x4fc4('0x11'));var as=require(_0x4fc4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4fc4('0x13'))(_0x4fc4('0x14'));var utils=require(_0x4fc4('0x15'));var config=require(_0x4fc4('0x16'));var licenseUtil=require(_0x4fc4('0x17'));var db=require(_0x4fc4('0x18'))['db'];config[_0x4fc4('0x19')]=_[_0x4fc4('0x1a')](config[_0x4fc4('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x4fc4('0x1b'))(new Redis(config[_0x4fc4('0x19')]));require(_0x4fc4('0x1c'))[_0x4fc4('0x1d')](socket);var jayson=require(_0x4fc4('0x1e'));var client=jayson['client'][_0x4fc4('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x3b8987,_0x2c3d78,_0x4ed2ce,_0x418f7d){return new BPromise(function(_0x3bb2f8,_0x24c72a){var _0x13f697=_0x418f7d||client;return _0x13f697[_0x4fc4('0x20')](_0x3b8987,_0x4ed2ce)[_0x4fc4('0x21')](function(_0x406f3f){logger[_0x4fc4('0x22')](_0x4fc4('0x23'),_0x2c3d78,_0x4fc4('0x24'));logger[_0x4fc4('0x25')](_0x4fc4('0x26'),_0x2c3d78,_0x4fc4('0x24'),JSON['stringify'](_0x406f3f));if(_0x406f3f['error']){if(_0x406f3f[_0x4fc4('0x27')][_0x4fc4('0x28')]===0x1f4){logger[_0x4fc4('0x27')](_0x4fc4('0x23'),_0x2c3d78,_0x406f3f[_0x4fc4('0x27')][_0x4fc4('0x29')]);return _0x24c72a(_0x406f3f['error'][_0x4fc4('0x29')]);}logger[_0x4fc4('0x27')](_0x4fc4('0x23'),_0x2c3d78,_0x406f3f['error'][_0x4fc4('0x29')]);return _0x3bb2f8(_0x406f3f[_0x4fc4('0x27')][_0x4fc4('0x29')]);}else{logger[_0x4fc4('0x22')](_0x4fc4('0x23'),_0x2c3d78,_0x4fc4('0x24'));_0x3bb2f8(_0x406f3f[_0x4fc4('0x2a')]['message']);}})[_0x4fc4('0x2b')](function(_0x4baa25){logger[_0x4fc4('0x27')]('SmsAccount,\x20%s,\x20%s',_0x2c3d78,_0x4baa25);_0x24c72a(_0x4baa25);});});}function respondWithStatusCode(_0x255cbf,_0x15d2b7){_0x15d2b7=_0x15d2b7||0xcc;return function(_0x1cee50){if(_0x1cee50){return _0x255cbf[_0x4fc4('0x2c')](_0x15d2b7);}return _0x255cbf['status'](_0x15d2b7)[_0x4fc4('0x2d')]();};}function respondWithResult(_0x501cd4,_0x249646){_0x249646=_0x249646||0xc8;return function(_0x5aacf9){if(_0x5aacf9){return _0x501cd4[_0x4fc4('0x2e')](_0x249646)[_0x4fc4('0x2f')](_0x5aacf9);}};}function respondWithFilteredResult(_0x75a631,_0x1df476){return function(_0x2f0dda){if(_0x2f0dda){var _0x1415b0=typeof _0x1df476['offset']===_0x4fc4('0x30')&&typeof _0x1df476[_0x4fc4('0x31')]==='undefined';var _0x673863=_0x2f0dda[_0x4fc4('0x32')];var _0x54f87c=_0x1415b0?0x0:_0x1df476[_0x4fc4('0x33')];var _0x5672bc=_0x1415b0?_0x2f0dda[_0x4fc4('0x32')]:_0x1df476['offset']+_0x1df476[_0x4fc4('0x31')];var _0x5f086d;if(_0x5672bc>=_0x673863){_0x5672bc=_0x673863;_0x5f086d=0xc8;}else{_0x5f086d=0xce;}_0x75a631[_0x4fc4('0x2e')](_0x5f086d);return _0x75a631[_0x4fc4('0x34')](_0x4fc4('0x35'),_0x54f87c+'-'+_0x5672bc+'/'+_0x673863)[_0x4fc4('0x2f')](_0x2f0dda);}return null;};}function patchUpdates(_0x2a6e81){return function(_0x82ef5f){try{jsonpatch[_0x4fc4('0x36')](_0x82ef5f,_0x2a6e81,!![]);}catch(_0x2d8d55){return BPromise['reject'](_0x2d8d55);}return _0x82ef5f[_0x4fc4('0x37')]();};}function saveUpdates(_0xd93006,_0x534fc8){return function(_0x20e73e){if(_0x20e73e){return _0x20e73e[_0x4fc4('0x38')](_0xd93006)[_0x4fc4('0x21')](function(_0x5bdc27){return _0x5bdc27;});}return null;};}function removeEntity(_0x195746,_0x3617e2){return function(_0x71664b){if(_0x71664b){return _0x71664b[_0x4fc4('0x39')]()[_0x4fc4('0x21')](function(){var _0x3f4086=_0x71664b['get']({'plain':!![]});var _0x44d5d7='SmsAccounts';return db[_0x4fc4('0x3a')]['destroy']({'where':{'type':_0x44d5d7,'resourceId':_0x3f4086['id']}})[_0x4fc4('0x21')](function(){return _0x71664b;});})[_0x4fc4('0x21')](function(){_0x195746[_0x4fc4('0x2e')](0xcc)[_0x4fc4('0x2d')]();});}};}function handleEntityNotFound(_0x2cf590,_0x26149d){return function(_0x298aca){if(!_0x298aca){_0x2cf590['sendStatus'](0x194);}return _0x298aca;};}function handleError(_0x30623c,_0x11aae1){_0x11aae1=_0x11aae1||0x1f4;return function(_0x5ce05f){logger['error'](_0x5ce05f[_0x4fc4('0x3b')]);if(_0x5ce05f[_0x4fc4('0x3c')]){delete _0x5ce05f['name'];}_0x30623c[_0x4fc4('0x2e')](_0x11aae1)[_0x4fc4('0x3d')](_0x5ce05f);};}exports['index']=function(_0xa3b14c,_0x3ba75d){var _0x2a58a7={'include':[{'model':db[_0x4fc4('0x3e')],'as':'mandatoryDispositionPause'}]},_0x5ece49={},_0x1009a={'count':0x0,'rows':[]};var _0x46b8f8=_[_0x4fc4('0x3f')](db[_0x4fc4('0x40')][_0x4fc4('0x41')],function(_0x5c666b){return{'name':_0x5c666b[_0x4fc4('0x42')],'type':_0x5c666b[_0x4fc4('0x43')][_0x4fc4('0x44')]};});_0x5ece49['model']=_[_0x4fc4('0x3f')](_0x46b8f8,_0x4fc4('0x3c'));_0x5ece49['query']=_[_0x4fc4('0x45')](_0xa3b14c[_0x4fc4('0x46')]);_0x5ece49[_0x4fc4('0x47')]=_[_0x4fc4('0x48')](_0x5ece49[_0x4fc4('0x49')],_0x5ece49['query']);_0x2a58a7[_0x4fc4('0x4a')]=_[_0x4fc4('0x48')](_0x5ece49[_0x4fc4('0x49')],qs[_0x4fc4('0x4b')](_0xa3b14c[_0x4fc4('0x46')][_0x4fc4('0x4b')]));_0x2a58a7[_0x4fc4('0x4a')]=_0x2a58a7[_0x4fc4('0x4a')]['length']?_0x2a58a7[_0x4fc4('0x4a')]:_0x5ece49[_0x4fc4('0x49')];if(!_0xa3b14c[_0x4fc4('0x46')]['hasOwnProperty'](_0x4fc4('0x4c'))){_0x2a58a7[_0x4fc4('0x31')]=qs[_0x4fc4('0x31')](_0xa3b14c[_0x4fc4('0x46')][_0x4fc4('0x31')]);_0x2a58a7['offset']=qs[_0x4fc4('0x33')](_0xa3b14c[_0x4fc4('0x46')][_0x4fc4('0x33')]);}_0x2a58a7['order']=qs[_0x4fc4('0x4d')](_0xa3b14c[_0x4fc4('0x46')]['sort']);_0x2a58a7['where']=qs['filters'](_[_0x4fc4('0x4e')](_0xa3b14c[_0x4fc4('0x46')],_0x5ece49[_0x4fc4('0x47')]),_0x46b8f8);if(_0xa3b14c[_0x4fc4('0x46')][_0x4fc4('0x4f')]){_0x2a58a7['where']=_[_0x4fc4('0x50')](_0x2a58a7[_0x4fc4('0x51')],{'$or':_[_0x4fc4('0x3f')](_0x46b8f8,function(_0x45d3bb){if(_0x45d3bb['type']!==_0x4fc4('0x52')){var _0x2b9763={};_0x2b9763[_0x45d3bb[_0x4fc4('0x3c')]]={'$like':'%'+_0xa3b14c[_0x4fc4('0x46')][_0x4fc4('0x4f')]+'%'};return _0x2b9763;}})});}_0x2a58a7=_[_0x4fc4('0x50')]({},_0x2a58a7,_0xa3b14c[_0x4fc4('0x53')]);var _0x4f4fdd={'where':_0x2a58a7['where']};return db[_0x4fc4('0x40')][_0x4fc4('0x32')](_0x4f4fdd)[_0x4fc4('0x21')](function(_0x5774f2){_0x1009a[_0x4fc4('0x32')]=_0x5774f2;if(_0xa3b14c['query']['includeAll']){_0x2a58a7[_0x4fc4('0x54')]=[{'all':!![]}];}return db[_0x4fc4('0x40')]['findAll'](_0x2a58a7);})[_0x4fc4('0x21')](function(_0x203935){_0x1009a[_0x4fc4('0x55')]=_0x203935;return _0x1009a;})['then'](respondWithFilteredResult(_0x3ba75d,_0x2a58a7))[_0x4fc4('0x2b')](handleError(_0x3ba75d,null));};exports[_0x4fc4('0x56')]=function(_0x3e198d,_0x47ef58){var _0x478cd8={'raw':![],'where':{'id':_0x3e198d[_0x4fc4('0x57')]['id']},'include':[{'model':db[_0x4fc4('0x3e')],'as':_0x4fc4('0x58')}]},_0x5a1b48={};_0x5a1b48[_0x4fc4('0x49')]=_[_0x4fc4('0x45')](db['SmsAccount'][_0x4fc4('0x41')]);_0x5a1b48['query']=_[_0x4fc4('0x45')](_0x3e198d[_0x4fc4('0x46')]);_0x5a1b48[_0x4fc4('0x47')]=_[_0x4fc4('0x48')](_0x5a1b48['model'],_0x5a1b48['query']);_0x478cd8[_0x4fc4('0x4a')]=_[_0x4fc4('0x48')](_0x5a1b48[_0x4fc4('0x49')],qs['fields'](_0x3e198d[_0x4fc4('0x46')][_0x4fc4('0x4b')]));_0x478cd8[_0x4fc4('0x4a')]=_0x478cd8[_0x4fc4('0x4a')][_0x4fc4('0x59')]?_0x478cd8[_0x4fc4('0x4a')]:_0x5a1b48[_0x4fc4('0x49')];if(_0x3e198d['query']['includeAll']){_0x478cd8[_0x4fc4('0x54')]=[{'all':!![]}];}_0x478cd8=_[_0x4fc4('0x50')]({},_0x478cd8,_0x3e198d[_0x4fc4('0x53')]);return db[_0x4fc4('0x40')][_0x4fc4('0x5a')](_0x478cd8)[_0x4fc4('0x21')](handleEntityNotFound(_0x47ef58,null))[_0x4fc4('0x21')](respondWithResult(_0x47ef58,null))['catch'](handleError(_0x47ef58,null));};exports[_0x4fc4('0x5b')]=function(_0x2b4a03,_0x51f54e){return db[_0x4fc4('0x40')][_0x4fc4('0x5b')](_0x2b4a03[_0x4fc4('0x5c')],{})[_0x4fc4('0x21')](function(_0x430f24){var _0x18bc5c=_0x2b4a03[_0x4fc4('0x5d')]['get']({'plain':!![]});if(!_0x18bc5c)throw new Error(_0x4fc4('0x5e'));if(_0x18bc5c[_0x4fc4('0x5f')]===_0x4fc4('0x5d')){var _0x52d6f4=_0x430f24[_0x4fc4('0x60')]({'plain':!![]});var _0x2e2a37='SmsAccounts';return db[_0x4fc4('0x61')][_0x4fc4('0x5a')]({'where':{'name':_0x2e2a37,'userProfileId':_0x18bc5c[_0x4fc4('0x62')]},'raw':!![]})[_0x4fc4('0x21')](function(_0x1b7ace){if(_0x1b7ace&&_0x1b7ace[_0x4fc4('0x63')]===0x0){return db[_0x4fc4('0x3a')][_0x4fc4('0x5b')]({'name':_0x52d6f4[_0x4fc4('0x3c')],'resourceId':_0x52d6f4['id'],'type':_0x1b7ace['name'],'sectionId':_0x1b7ace['id']},{})[_0x4fc4('0x21')](function(){return _0x430f24;});}else{return _0x430f24;}})[_0x4fc4('0x2b')](function(_0x1c2652){logger[_0x4fc4('0x27')](_0x4fc4('0x64'),_0x1c2652);throw _0x1c2652;});}return _0x430f24;})[_0x4fc4('0x21')](respondWithResult(_0x51f54e,0xc9))['catch'](handleError(_0x51f54e,null));};exports[_0x4fc4('0x38')]=function(_0x4c9d13,_0x47ad15){if(_0x4c9d13[_0x4fc4('0x5c')]['id']){delete _0x4c9d13[_0x4fc4('0x5c')]['id'];}return db[_0x4fc4('0x40')]['find']({'where':{'id':_0x4c9d13['params']['id']},'include':[{'model':db[_0x4fc4('0x3e')],'as':_0x4fc4('0x58')}]})['then'](handleEntityNotFound(_0x47ad15,null))[_0x4fc4('0x21')](saveUpdates(_0x4c9d13['body'],null))[_0x4fc4('0x21')](respondWithResult(_0x47ad15,null))['catch'](handleError(_0x47ad15,null));};exports[_0x4fc4('0x39')]=function(_0x129301,_0x41bc70){return db[_0x4fc4('0x40')][_0x4fc4('0x5a')]({'where':{'id':_0x129301[_0x4fc4('0x57')]['id']}})[_0x4fc4('0x21')](handleEntityNotFound(_0x41bc70,null))['then'](removeEntity(_0x41bc70,null))['catch'](handleError(_0x41bc70,null));};exports['describe']=function(_0x86ae0b,_0x3ebf37){return db[_0x4fc4('0x40')]['describe']()[_0x4fc4('0x21')](respondWithResult(_0x3ebf37,null))[_0x4fc4('0x2b')](handleError(_0x3ebf37,null));};exports[_0x4fc4('0x65')]=function(_0xcba795,_0x49d545,_0xce8851){if(_0xcba795[_0x4fc4('0x5c')]['id']){delete _0xcba795['body']['id'];}return db[_0x4fc4('0x40')][_0x4fc4('0x5a')]({'where':{'id':_0xcba795[_0x4fc4('0x57')]['id']}})['then'](handleEntityNotFound(_0x49d545,null))[_0x4fc4('0x21')](function(_0x4afc47){if(_0x4afc47){_0xcba795['body'][_0x4fc4('0x66')]=_0x4afc47['id'];return db[_0x4fc4('0x67')][_0x4fc4('0x5b')](_0xcba795[_0x4fc4('0x5c')]);}})[_0x4fc4('0x21')](respondWithResult(_0x49d545,null))[_0x4fc4('0x2b')](handleError(_0x49d545,null));};exports[_0x4fc4('0x68')]=function(_0x49f1d0,_0x344941,_0x36c132){var _0x5c0aec={'raw':![],'where':{}};var _0x5523d5={};var _0x3bbe3b={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x49f1d0[_0x4fc4('0x57')]['id']}})[_0x4fc4('0x21')](handleEntityNotFound(_0x344941,null))['then'](function(_0x4f4f9c){if(_0x4f4f9c){_0x5523d5[_0x4fc4('0x49')]=_[_0x4fc4('0x45')](db[_0x4fc4('0x67')][_0x4fc4('0x41')]);_0x5523d5[_0x4fc4('0x46')]=_[_0x4fc4('0x45')](_0x49f1d0[_0x4fc4('0x46')]);_0x5523d5['filters']=_[_0x4fc4('0x48')](_0x5523d5[_0x4fc4('0x49')],_0x5523d5[_0x4fc4('0x46')]);_0x5c0aec['attributes']=_['intersection'](_0x5523d5[_0x4fc4('0x49')],qs[_0x4fc4('0x4b')](_0x49f1d0['query'][_0x4fc4('0x4b')]));_0x5c0aec[_0x4fc4('0x4a')]=_0x5c0aec[_0x4fc4('0x4a')][_0x4fc4('0x59')]?_0x5c0aec[_0x4fc4('0x4a')]:_0x5523d5['model'];if(!_0x49f1d0['query']['hasOwnProperty'](_0x4fc4('0x4c'))){_0x5c0aec[_0x4fc4('0x31')]=qs[_0x4fc4('0x31')](_0x49f1d0[_0x4fc4('0x46')]['limit']);_0x5c0aec['offset']=qs['offset'](_0x49f1d0['query'][_0x4fc4('0x33')]);}_0x5c0aec[_0x4fc4('0x69')]=qs[_0x4fc4('0x4d')](_0x49f1d0[_0x4fc4('0x46')][_0x4fc4('0x4d')]);_0x5c0aec[_0x4fc4('0x51')]=qs[_0x4fc4('0x47')](_['pick'](_0x49f1d0[_0x4fc4('0x46')],_0x5523d5[_0x4fc4('0x47')]));_0x5c0aec[_0x4fc4('0x51')][_0x4fc4('0x66')]=_0x4f4f9c['id'];if(_0x49f1d0['query'][_0x4fc4('0x4f')]){_0x5c0aec[_0x4fc4('0x51')]=_[_0x4fc4('0x50')](_0x5c0aec['where'],{'$or':_[_0x4fc4('0x3f')](_0x5c0aec['attributes'],function(_0x455309){var _0x2215fd={};_0x2215fd[_0x455309]={'$like':'%'+_0x49f1d0['query'][_0x4fc4('0x4f')]+'%'};return _0x2215fd;})});}_0x5c0aec=_['merge']({},_0x5c0aec,_0x49f1d0['options']);return db[_0x4fc4('0x67')]['count']({'where':_0x5c0aec[_0x4fc4('0x51')]})['then'](function(_0x3506de){_0x3bbe3b[_0x4fc4('0x32')]=_0x3506de;if(_0x49f1d0['query']['includeAll']){_0x5c0aec[_0x4fc4('0x54')]=[{'all':!![]}];}return db[_0x4fc4('0x67')][_0x4fc4('0x6a')](_0x5c0aec);})['then'](function(_0x181a8f){_0x3bbe3b[_0x4fc4('0x55')]=_0x181a8f;return _0x3bbe3b;});}})[_0x4fc4('0x21')](respondWithFilteredResult(_0x344941,_0x5c0aec))[_0x4fc4('0x2b')](handleError(_0x344941,null));};exports['removeDispositions']=function(_0x48f4b6,_0x13aaf6,_0x38a912){return db[_0x4fc4('0x40')][_0x4fc4('0x5a')]({'where':{'id':_0x48f4b6[_0x4fc4('0x57')]['id']}})[_0x4fc4('0x21')](handleEntityNotFound(_0x13aaf6,null))['then'](function(_0xe70fa1){if(_0xe70fa1){return _0xe70fa1[_0x4fc4('0x6b')](_0x48f4b6[_0x4fc4('0x46')][_0x4fc4('0x6c')]);}})[_0x4fc4('0x21')](respondWithStatusCode(_0x13aaf6,null))['catch'](handleError(_0x13aaf6,null));};exports[_0x4fc4('0x6d')]=function(_0x31184b,_0x3f2273,_0x29ba7c){if(_0x31184b[_0x4fc4('0x5c')]['id']){delete _0x31184b[_0x4fc4('0x5c')]['id'];}return db[_0x4fc4('0x40')][_0x4fc4('0x5a')]({'where':{'id':_0x31184b[_0x4fc4('0x57')]['id']}})[_0x4fc4('0x21')](handleEntityNotFound(_0x3f2273,null))['then'](function(_0x14f759){if(_0x14f759){_0x31184b['body']['SmsAccountId']=_0x14f759['id'];return db[_0x4fc4('0x6e')][_0x4fc4('0x5b')](_0x31184b[_0x4fc4('0x5c')]);}})[_0x4fc4('0x21')](respondWithResult(_0x3f2273,null))[_0x4fc4('0x2b')](handleError(_0x3f2273,null));};exports[_0x4fc4('0x6f')]=function(_0x4f294d,_0x340317,_0x3b23b9){var _0x4f5722={'raw':![],'where':{}};var _0x39d414={};var _0x2cdbf6={'count':0x0,'rows':[]};return db[_0x4fc4('0x40')][_0x4fc4('0x70')]({'where':{'id':_0x4f294d[_0x4fc4('0x57')]['id']}})['then'](handleEntityNotFound(_0x340317,null))[_0x4fc4('0x21')](function(_0x5ece2c){if(_0x5ece2c){_0x39d414[_0x4fc4('0x49')]=_[_0x4fc4('0x45')](db['CannedAnswer']['rawAttributes']);_0x39d414[_0x4fc4('0x46')]=_[_0x4fc4('0x45')](_0x4f294d[_0x4fc4('0x46')]);_0x39d414['filters']=_[_0x4fc4('0x48')](_0x39d414[_0x4fc4('0x49')],_0x39d414['query']);_0x4f5722['attributes']=_[_0x4fc4('0x48')](_0x39d414[_0x4fc4('0x49')],qs[_0x4fc4('0x4b')](_0x4f294d[_0x4fc4('0x46')][_0x4fc4('0x4b')]));_0x4f5722['attributes']=_0x4f5722['attributes'][_0x4fc4('0x59')]?_0x4f5722[_0x4fc4('0x4a')]:_0x39d414['model'];if(!_0x4f294d[_0x4fc4('0x46')][_0x4fc4('0x71')](_0x4fc4('0x4c'))){_0x4f5722['limit']=qs[_0x4fc4('0x31')](_0x4f294d['query']['limit']);_0x4f5722[_0x4fc4('0x33')]=qs['offset'](_0x4f294d[_0x4fc4('0x46')][_0x4fc4('0x33')]);}_0x4f5722[_0x4fc4('0x69')]=qs[_0x4fc4('0x4d')](_0x4f294d['query'][_0x4fc4('0x4d')]);_0x4f5722['where']=qs['filters'](_['pick'](_0x4f294d[_0x4fc4('0x46')],_0x39d414[_0x4fc4('0x47')]));_0x4f5722[_0x4fc4('0x51')]['SmsAccountId']=_0x5ece2c['id'];if(_0x4f294d[_0x4fc4('0x46')][_0x4fc4('0x4f')]){_0x4f5722[_0x4fc4('0x51')]=_[_0x4fc4('0x50')](_0x4f5722[_0x4fc4('0x51')],{'$or':_[_0x4fc4('0x3f')](_0x4f5722[_0x4fc4('0x4a')],function(_0x53c7a7){var _0x2ce426={};_0x2ce426[_0x53c7a7]={'$like':'%'+_0x4f294d[_0x4fc4('0x46')][_0x4fc4('0x4f')]+'%'};return _0x2ce426;})});}_0x4f5722=_[_0x4fc4('0x50')]({},_0x4f5722,_0x4f294d[_0x4fc4('0x53')]);return db[_0x4fc4('0x6e')]['count']({'where':_0x4f5722[_0x4fc4('0x51')]})[_0x4fc4('0x21')](function(_0x1dddc1){_0x2cdbf6[_0x4fc4('0x32')]=_0x1dddc1;if(_0x4f294d[_0x4fc4('0x46')][_0x4fc4('0x72')]){_0x4f5722['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x4f5722);})[_0x4fc4('0x21')](function(_0x4ec63f){_0x2cdbf6[_0x4fc4('0x55')]=_0x4ec63f;return _0x2cdbf6;});}})['then'](respondWithFilteredResult(_0x340317,_0x4f5722))[_0x4fc4('0x2b')](handleError(_0x340317,null));};exports[_0x4fc4('0x73')]=function(_0x46d63b,_0x34c71f,_0xc6fe65){return db[_0x4fc4('0x40')][_0x4fc4('0x5a')]({'where':{'id':_0x46d63b['params']['id']}})['then'](handleEntityNotFound(_0x34c71f,null))['then'](function(_0x19467c){if(_0x19467c){return _0x19467c[_0x4fc4('0x73')](_0x46d63b[_0x4fc4('0x46')][_0x4fc4('0x6c')]);}})[_0x4fc4('0x21')](respondWithStatusCode(_0x34c71f,null))[_0x4fc4('0x2b')](handleError(_0x34c71f,null));};exports[_0x4fc4('0x74')]=function(_0x908c9,_0x5df94d,_0x473c93){var _0xdd6640={'channel':_0x4fc4('0x75')};var _0x54ce37=[];var _0x4201d3=[];var _0x3a0c35={};return db[_0x4fc4('0x40')][_0x4fc4('0x5a')]({'where':{'id':_0x908c9['params']['id']},'include':[{'model':db[_0x4fc4('0x76')],'as':_0x4fc4('0x77')}]})[_0x4fc4('0x21')](handleEntityNotFound(_0x5df94d,null))[_0x4fc4('0x21')](function(_0x283c56){_0xdd6640[_0x4fc4('0x78')]=_0x283c56;_0xdd6640[_0x4fc4('0x79')]=_[_0x4fc4('0x7a')](_0x283c56[_0x4fc4('0x77')],[_0x4fc4('0x7b')],[_0x4fc4('0x7c')]);if(_0xdd6640['account'][_0x4fc4('0x77')]){delete _0xdd6640[_0x4fc4('0x78')]['Applications'];}return db['CmContact']['describe']();})[_0x4fc4('0x21')](function(_0x5335e9){if(!_0x5335e9){throw new db[(_0x4fc4('0x7d'))][(_0x4fc4('0x7e'))](_0x4fc4('0x7f'));}_0x54ce37=_[_0x4fc4('0x80')](_[_0x4fc4('0x45')](_0x5335e9),[_0x4fc4('0x81'),'updatedAt']);_0x4201d3=_[_0x4fc4('0x80')](_[_0x4fc4('0x45')](_0x5335e9),[_0x4fc4('0x81'),_0x4fc4('0x82'),_0x4fc4('0x83'),'ListId']);_0xdd6640[_0x4fc4('0x5c')]={'mapKey':_0x4fc4('0x84')};if(_0xdd6640[_0x4fc4('0x78')][_0x4fc4('0x43')]){switch(_0xdd6640['account'][_0x4fc4('0x43')]){case _0x4fc4('0x85'):_0xdd6640[_0x4fc4('0x5c')][_0x4fc4('0x86')]=_0x908c9[_0x4fc4('0x5c')][_0x4fc4('0x87')];_0xdd6640['body']['body']=_0x908c9[_0x4fc4('0x5c')][_0x4fc4('0x88')];_0xdd6640[_0x4fc4('0x5c')][_0x4fc4('0x89')]=_0x908c9[_0x4fc4('0x5c')]['MessageSid'];break;case _0x4fc4('0x8a'):_0xdd6640[_0x4fc4('0x5c')][_0x4fc4('0x86')]='+'+_0x908c9[_0x4fc4('0x5c')][_0x4fc4('0x8b')];_0xdd6640[_0x4fc4('0x5c')]['body']=_0x908c9[_0x4fc4('0x5c')]['text'];break;case _0x4fc4('0x8c'):_0xdd6640[_0x4fc4('0x5c')][_0x4fc4('0x86')]=_0x908c9[_0x4fc4('0x5c')][_0x4fc4('0x86')];_0xdd6640['body'][_0x4fc4('0x5c')]=_0x908c9['body']['message'];break;case _0x4fc4('0x8d'):_0xdd6640[_0x4fc4('0x5c')]['from']=_0x908c9['body']['from'];_0xdd6640[_0x4fc4('0x5c')]['body']=_0x908c9[_0x4fc4('0x5c')][_0x4fc4('0x5c')];_0xdd6640[_0x4fc4('0x5c')][_0x4fc4('0x89')]=_0x908c9['body']['message_id'];break;case'plivo':_0xdd6640['body'][_0x4fc4('0x86')]=_0x908c9[_0x4fc4('0x5c')][_0x4fc4('0x87')];_0xdd6640['body'][_0x4fc4('0x5c')]=_0x908c9['body'][_0x4fc4('0x8e')];_0xdd6640[_0x4fc4('0x5c')]['messageId']=_0x908c9[_0x4fc4('0x5c')][_0x4fc4('0x8f')];break;case _0x4fc4('0x90'):_0xdd6640['body'][_0x4fc4('0x86')]='+'+_0x908c9[_0x4fc4('0x5c')][_0x4fc4('0x91')][0x0][_0x4fc4('0x86')];_0xdd6640[_0x4fc4('0x5c')][_0x4fc4('0x5c')]=_0x908c9['body']['results'][0x0][_0x4fc4('0x92')];_0xdd6640[_0x4fc4('0x5c')][_0x4fc4('0x89')]=_0x908c9[_0x4fc4('0x5c')][_0x4fc4('0x91')][0x0][_0x4fc4('0x89')];break;case _0x4fc4('0x93'):_0xdd6640['body'][_0x4fc4('0x86')]=_0x908c9[_0x4fc4('0x5c')]['originatingAddress'];_0xdd6640[_0x4fc4('0x5c')]['body']=_0x908c9[_0x4fc4('0x5c')][_0x4fc4('0x94')][_0x4fc4('0x29')];break;case _0x4fc4('0x95'):_0xdd6640[_0x4fc4('0x5c')][_0x4fc4('0x86')]=_0x908c9[_0x4fc4('0x5c')][_0x4fc4('0x96')];_0xdd6640[_0x4fc4('0x5c')][_0x4fc4('0x5c')]=_0x908c9['body']['text'];_0xdd6640['body']['messageId']=_0x908c9[_0x4fc4('0x5c')][_0x4fc4('0x97')];break;case _0x4fc4('0x98'):_0xdd6640[_0x4fc4('0x5c')][_0x4fc4('0x89')]=_0x908c9[_0x4fc4('0x5c')][0x0][_0x4fc4('0x29')]['id'];_0xdd6640['body'][_0x4fc4('0x86')]=_0x908c9[_0x4fc4('0x5c')][0x0][_0x4fc4('0x29')][_0x4fc4('0x86')];_0xdd6640[_0x4fc4('0x5c')][_0x4fc4('0x5c')]=_0x908c9[_0x4fc4('0x5c')][0x0][_0x4fc4('0x29')][_0x4fc4('0x92')];break;case _0x4fc4('0x99'):_0xdd6640[_0x4fc4('0x5c')][_0x4fc4('0x86')]=_0x908c9['body'][_0x4fc4('0x86')];_0xdd6640[_0x4fc4('0x5c')]['body']=_0x908c9[_0x4fc4('0x5c')][_0x4fc4('0x29')];_0xdd6640['body']['messageId']=_0x908c9[_0x4fc4('0x5c')][_0x4fc4('0x9a')];break;}}if(_0xdd6640[_0x4fc4('0x5c')]['id']){delete _0xdd6640['body']['id'];}if(_[_0x4fc4('0x9b')](_0xdd6640['body']['from'])){throw new db[(_0x4fc4('0x7d'))]['ValidationError'](_0x4fc4('0x9c'));}if(_['isNil'](_0xdd6640[_0x4fc4('0x5c')][_0x4fc4('0x5c')])||_0xdd6640[_0x4fc4('0x5c')]['body']===''){throw new db[(_0x4fc4('0x7d'))][(_0x4fc4('0x7e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4fc4('0x9b')](_0xdd6640[_0x4fc4('0x5c')][_0x4fc4('0x9d')])){throw new db[(_0x4fc4('0x7d'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4201d3);}if(!_['includes'](_0x4201d3,_0xdd6640['body']['mapKey'])){throw new db['Sequelize'][(_0x4fc4('0x7e'))](_0x4fc4('0x9e')+_0x4201d3);}_0x3a0c35[_0xdd6640[_0x4fc4('0x5c')][_0x4fc4('0x9d')]]=_0xdd6640[_0x4fc4('0x5c')][_0x4fc4('0x86')];return db[_0x4fc4('0x9f')][_0x4fc4('0x5a')]({'where':{'id':_0xdd6640[_0x4fc4('0x78')][_0x4fc4('0xa0')]},'include':[{'model':db[_0x4fc4('0xa1')],'as':_0x4fc4('0xa2'),'where':_0x3a0c35,'limit':0x1,'order':[[_0x4fc4('0x82'),_0x4fc4('0xa3')]]}]});})[_0x4fc4('0x21')](handleEntityNotFound(_0x5df94d,null))[_0x4fc4('0x21')](function(_0x11ed43){if(_0x11ed43){_0xdd6640[_0x4fc4('0xa4')]=_[_0x4fc4('0xa5')](_0x11ed43,[_0x4fc4('0xa2')]);if(_0x11ed43[_0x4fc4('0xa2')][_0x4fc4('0x59')]){return _0x11ed43[_0x4fc4('0xa2')][0x0];}var _0x297876=_[_0x4fc4('0x1a')](_0xdd6640['body'],{'firstName':_0xdd6640[_0x4fc4('0x5c')][_0x4fc4('0x86')],'ListId':_0x11ed43['id']});_0x297876[_0xdd6640[_0x4fc4('0x5c')][_0x4fc4('0x9d')]]=_0xdd6640[_0x4fc4('0x5c')][_0x4fc4('0x86')];return db[_0x4fc4('0xa1')][_0x4fc4('0x5b')](_0x297876,{'fields':_0x54ce37,'raw':!![]});}})[_0x4fc4('0x21')](handleEntityNotFound(_0x5df94d,null))['then'](function(_0x1c6b0a){if(_0x1c6b0a){_0xdd6640['contact']=_0x1c6b0a;var _0x690458={'ContactId':_0x1c6b0a['id'],'phone':_0xdd6640['body'][_0x4fc4('0x86')],'SmsAccountId':_0x908c9[_0x4fc4('0x57')]['id']};var _0x4fb6ce={'ContactId':_0x1c6b0a['id'],'SmsAccountId':_0x908c9[_0x4fc4('0x57')]['id'],'closed':![]};return db[_0x4fc4('0xa6')][_0x4fc4('0x5a')]({'where':_0x4fb6ce})[_0x4fc4('0x21')](function(_0x1e1677){if(_0x1e1677){return[_0x1e1677,![]];}return db[_0x4fc4('0xa6')][_0x4fc4('0x5b')](_0x690458)[_0x4fc4('0x21')](function(_0x3b0a6c){return[_0x3b0a6c,!![]];});});}})['spread'](function(_0x599166,_0x3014cd){_0xdd6640[_0x4fc4('0xa7')]=_0x599166['get']({'plain':!![]});_0xdd6640['interaction'][_0x4fc4('0xa8')]=![];if(_0x3014cd){if(_0xdd6640[_0x4fc4('0x78')][_0x4fc4('0xa9')]){_0xdd6640[_0x4fc4('0x79')][_0x4fc4('0xaa')]({'id':0x0,'priority':_0xdd6640[_0x4fc4('0x79')]['length']+0x1,'app':_0x4fc4('0xab'),'appdata':_0x4fc4('0xac'),'interval':_0x4fc4('0xad')});}_0xdd6640[_0x4fc4('0xa7')][_0x4fc4('0xa8')]=!![];}return db[_0x4fc4('0xae')][_0x4fc4('0x5b')]({'phone':_0xdd6640['body'][_0x4fc4('0x86')],'messageId':_0xdd6640[_0x4fc4('0x5c')][_0x4fc4('0x89')],'body':_0xdd6640['body']['body'],'SmsAccountId':_0x908c9[_0x4fc4('0x57')]['id'],'SmsInteractionId':_0x599166['id'],'direction':'in','ContactId':_0x599166[_0x4fc4('0xaf')],'AttachmentId':_0xdd6640[_0x4fc4('0x5c')][_0x4fc4('0xb0')]});})[_0x4fc4('0x21')](function(_0x4bc45e){_0xdd6640[_0x4fc4('0x29')]=_0x4bc45e;if(_0xdd6640[_0x4fc4('0xa7')][_0x4fc4('0xb1')]){return db[_0x4fc4('0xb2')][_0x4fc4('0x5a')]({'attributes':['id',_0x4fc4('0x3c')],'where':{'id':_0xdd6640[_0x4fc4('0xa7')][_0x4fc4('0xb1')]}})['then'](function(_0x3fea6f){if(_0x3fea6f){_0xdd6640['applications'][_0x4fc4('0xb3')]({'id':0x0,'priority':0x0,'app':_0x4fc4('0xb4'),'appdata':_0x3fea6f[_0x4fc4('0x3c')]+','+(_0xdd6640[_0x4fc4('0x78')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x4fc4('0xb5'),'startRouting',_0xdd6640);});}return respondWithRpcPromise('Start','startRouting',_0xdd6640);})[_0x4fc4('0x21')](function(_0x13a5f4){if(_0x13a5f4){var _0x300e35=0xc8;var _0x672e85=_0x4fc4('0xb6');logger['info'](_0x4fc4('0x26'),_0x672e85,_0x300e35,_0x4fc4('0xb7'));logger[_0x4fc4('0x25')](_0x4fc4('0xb8'),_0x672e85,_0x300e35,_0x4fc4('0xb7'),JSON[_0x4fc4('0xb9')](_0x13a5f4));if(_0xdd6640[_0x4fc4('0x78')][_0x4fc4('0x43')]==='twilio'){return _0x5df94d[_0x4fc4('0x2e')](_0x300e35)[_0x4fc4('0x34')]('Content-Type','text/xml')['send'](_0x4fc4('0xba'));}else{return _0x5df94d[_0x4fc4('0x2e')](_0x300e35)['json'](_0x13a5f4);}}})[_0x4fc4('0x2b')](handleError(_0x5df94d,null));};exports[_0x4fc4('0xbb')]=function(_0x1b4e74,_0x28b013,_0x488c83){return db[_0x4fc4('0x40')][_0x4fc4('0x70')]({'where':{'id':_0x1b4e74[_0x4fc4('0x57')]['id']}})['then'](handleEntityNotFound(_0x28b013,null))[_0x4fc4('0x21')](function(_0x510a99){if(_0x510a99){return db['sequelize']['transaction'](function(_0x39334c){return db[_0x4fc4('0x76')][_0x4fc4('0x39')]({'where':{'SmsAccountId':_0x1b4e74[_0x4fc4('0x57')]['id']},'transaction':_0x39334c})['then'](function(_0x3e09b8){var _0x5b5827=_['map'](_0x1b4e74[_0x4fc4('0x5c')],function(_0x5afe60){_0x5afe60['SmsAccountId']=_0x1b4e74[_0x4fc4('0x57')]['id'];return _0x5afe60;});return db['SmsApplication'][_0x4fc4('0xbc')](_0x5b5827,{'transaction':_0x39334c});});})[_0x4fc4('0x21')](function(){return db[_0x4fc4('0x76')][_0x4fc4('0xbd')]({'where':{'SmsAccountId':_0x1b4e74[_0x4fc4('0x57')]['id']},'order':_0x4fc4('0x7b')});});}})[_0x4fc4('0x21')](respondWithResult(_0x28b013,null))[_0x4fc4('0x2b')](handleError(_0x28b013,null));};exports[_0x4fc4('0xbe')]=function(_0x898c1c,_0x51bed2,_0x28c857){var _0xe2020a={};var _0x2133dc={};var _0x3c4aa9;var _0xee9dad;return db[_0x4fc4('0x40')][_0x4fc4('0x70')]({'where':{'id':_0x898c1c[_0x4fc4('0x57')]['id']}})[_0x4fc4('0x21')](handleEntityNotFound(_0x51bed2,null))[_0x4fc4('0x21')](function(_0x11757f){if(_0x11757f){_0x3c4aa9=_0x11757f;_0x2133dc[_0x4fc4('0x49')]=_[_0x4fc4('0x45')](db[_0x4fc4('0x76')]['rawAttributes']);_0x2133dc[_0x4fc4('0x46')]=_[_0x4fc4('0x45')](_0x898c1c[_0x4fc4('0x46')]);_0x2133dc[_0x4fc4('0x47')]=_[_0x4fc4('0x48')](_0x2133dc[_0x4fc4('0x49')],_0x2133dc[_0x4fc4('0x46')]);_0xe2020a[_0x4fc4('0x4a')]=_[_0x4fc4('0x48')](_0x2133dc['model'],qs[_0x4fc4('0x4b')](_0x898c1c['query'][_0x4fc4('0x4b')]));_0xe2020a[_0x4fc4('0x4a')]=_0xe2020a[_0x4fc4('0x4a')][_0x4fc4('0x59')]?_0xe2020a[_0x4fc4('0x4a')]:_0x2133dc[_0x4fc4('0x49')];_0xe2020a[_0x4fc4('0x69')]=qs['sort'](_0x898c1c['query'][_0x4fc4('0x4d')]);_0xe2020a[_0x4fc4('0x51')]=qs[_0x4fc4('0x47')](_[_0x4fc4('0x4e')](_0x898c1c[_0x4fc4('0x46')],_0x2133dc[_0x4fc4('0x47')]));if(_0x898c1c[_0x4fc4('0x46')][_0x4fc4('0x4f')]){_0xe2020a[_0x4fc4('0x51')]=_[_0x4fc4('0x50')](_0xe2020a[_0x4fc4('0x51')],{'$or':_[_0x4fc4('0x3f')](_0xe2020a[_0x4fc4('0x4a')],function(_0x229745){var _0x5895f7={};_0x5895f7[_0x229745]={'$like':'%'+_0x898c1c['query'][_0x4fc4('0x4f')]+'%'};return _0x5895f7;})});}_0xe2020a=_[_0x4fc4('0x50')]({},_0xe2020a,_0x898c1c[_0x4fc4('0x53')]);return _0x3c4aa9[_0x4fc4('0xbe')](_0xe2020a);}})[_0x4fc4('0x21')](function(_0x511091){if(_0x511091){_0xee9dad=_0x511091[_0x4fc4('0x59')];if(!_0x898c1c[_0x4fc4('0x46')][_0x4fc4('0x71')](_0x4fc4('0x4c'))){_0xe2020a[_0x4fc4('0x31')]=qs[_0x4fc4('0x31')](_0x898c1c[_0x4fc4('0x46')][_0x4fc4('0x31')]);_0xe2020a[_0x4fc4('0x33')]=qs[_0x4fc4('0x33')](_0x898c1c[_0x4fc4('0x46')][_0x4fc4('0x33')]);}return _0x3c4aa9[_0x4fc4('0xbe')](_0xe2020a);}})['then'](function(_0x46e3b4){if(_0x46e3b4){return _0x46e3b4?{'count':_0xee9dad,'rows':_0x46e3b4}:null;}})[_0x4fc4('0x21')](respondWithResult(_0x51bed2,null))['catch'](handleError(_0x51bed2,null));};exports[_0x4fc4('0xbf')]=function(_0x751153,_0x4a897d,_0x2b2f50){var _0x4a8cc6={'raw':![],'where':{}};var _0x14b78b={};var _0x5c509b={'count':0x0,'rows':[]};return db[_0x4fc4('0x40')][_0x4fc4('0x70')]({'where':{'id':_0x751153[_0x4fc4('0x57')]['id']}})[_0x4fc4('0x21')](handleEntityNotFound(_0x4a897d,null))[_0x4fc4('0x21')](function(_0x57aaa7){if(_0x57aaa7){_0x14b78b[_0x4fc4('0x49')]=_['keys'](db[_0x4fc4('0xa6')][_0x4fc4('0x41')]);_0x14b78b['query']=_['keys'](_0x751153['query']);_0x14b78b[_0x4fc4('0x47')]=_['intersection'](_0x14b78b['model'],_0x14b78b[_0x4fc4('0x46')]);_0x4a8cc6[_0x4fc4('0x4a')]=_['intersection'](_0x14b78b[_0x4fc4('0x49')],qs[_0x4fc4('0x4b')](_0x751153[_0x4fc4('0x46')][_0x4fc4('0x4b')]));_0x4a8cc6[_0x4fc4('0x4a')]=_0x4a8cc6[_0x4fc4('0x4a')]['length']?_0x4a8cc6[_0x4fc4('0x4a')]:_0x14b78b[_0x4fc4('0x49')];if(!_0x751153['query'][_0x4fc4('0x71')](_0x4fc4('0x4c'))){_0x4a8cc6[_0x4fc4('0x31')]=qs[_0x4fc4('0x31')](_0x751153['query'][_0x4fc4('0x31')]);_0x4a8cc6[_0x4fc4('0x33')]=qs[_0x4fc4('0x33')](_0x751153['query'][_0x4fc4('0x33')]);}_0x4a8cc6[_0x4fc4('0x69')]=qs[_0x4fc4('0x4d')](_0x751153[_0x4fc4('0x46')][_0x4fc4('0x4d')]);_0x4a8cc6[_0x4fc4('0x51')]=qs[_0x4fc4('0x47')](_[_0x4fc4('0x4e')](_0x751153['query'],_0x14b78b[_0x4fc4('0x47')]));_0x4a8cc6[_0x4fc4('0x51')][_0x4fc4('0x66')]=_0x57aaa7['id'];if(_0x751153['query']['filter']){_0x4a8cc6[_0x4fc4('0x51')]=_[_0x4fc4('0x50')](_0x4a8cc6[_0x4fc4('0x51')],{'$or':_['map'](_0x4a8cc6[_0x4fc4('0x4a')],function(_0x3e486c){var _0x339115={};_0x339115[_0x3e486c]={'$like':'%'+_0x751153['query']['filter']+'%'};return _0x339115;})});}_0x4a8cc6=_[_0x4fc4('0x50')]({},_0x4a8cc6,_0x751153[_0x4fc4('0x53')]);return db[_0x4fc4('0xa6')][_0x4fc4('0x32')]({'where':_0x4a8cc6[_0x4fc4('0x51')]})[_0x4fc4('0x21')](function(_0xdaa839){_0x5c509b['count']=_0xdaa839;if(_0x751153['query'][_0x4fc4('0x72')]){_0x4a8cc6[_0x4fc4('0x54')]=[{'model':db[_0x4fc4('0xa1')],'as':_0x4fc4('0xc0'),'required':![]},{'model':db[_0x4fc4('0xb2')],'as':_0x4fc4('0xc1'),'attributes':[_0x4fc4('0x3c'),_0x4fc4('0xc2'),_0x4fc4('0xc3')],'required':![]},{'model':db[_0x4fc4('0xc4')],'as':'Tags','attributes':['id',_0x4fc4('0x3c'),_0x4fc4('0xc5')],'where':_0x751153[_0x4fc4('0x46')][_0x4fc4('0xc6')]?{'id':_0x751153[_0x4fc4('0x46')][_0x4fc4('0xc6')]}:undefined,'required':_0x751153[_0x4fc4('0x46')]['tag']?!![]:![]}];}return db[_0x4fc4('0xa6')][_0x4fc4('0x6a')](_0x4a8cc6);})[_0x4fc4('0x21')](function(_0x40390d){_0x5c509b['rows']=_0x40390d;return _0x5c509b;});}})[_0x4fc4('0x21')](respondWithFilteredResult(_0x4a897d,_0x4a8cc6))[_0x4fc4('0x2b')](handleError(_0x4a897d,null));};exports[_0x4fc4('0x3d')]=function(_0x3bbc41,_0x11f5f4,_0x5266d0){var _0x5ad53f,_0x2486b7,_0x3b59c8;if(_[_0x4fc4('0x9b')](_0x3bbc41['body']['body'])||_0x3bbc41[_0x4fc4('0x5c')][_0x4fc4('0x5c')]===''){throw new db[(_0x4fc4('0x7d'))][(_0x4fc4('0x7e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4fc4('0x9b')](_0x3bbc41[_0x4fc4('0x5c')]['to'])){throw new db[(_0x4fc4('0x7d'))][(_0x4fc4('0x7e'))]('to\x20is\x20mandatory');}_0x5ad53f=_0x3bbc41[_0x4fc4('0x5c')]['to'];return db[_0x4fc4('0x40')][_0x4fc4('0x5a')]({'where':{'id':_0x3bbc41['params']['id']},'include':[{'model':db[_0x4fc4('0x9f')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x5ad53f},'limit':0x1,'order':[[_0x4fc4('0x82'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x11f5f4,null))['then'](function(_0x458e86){if(_0x458e86&&_0x458e86[_0x4fc4('0xc7')]){_0x2486b7=_0x458e86['get']({'plain':!![]});if(_0x2486b7['List']&&_0x2486b7[_0x4fc4('0xc7')][_0x4fc4('0xa2')][_0x4fc4('0x59')]){return _0x2486b7[_0x4fc4('0xc7')][_0x4fc4('0xa2')][0x0];}return db[_0x4fc4('0xa1')][_0x4fc4('0x5b')](_[_0x4fc4('0x1a')](_0x3bbc41[_0x4fc4('0x5c')],{'firstName':_0x5ad53f,'mobile':_0x5ad53f,'phone':_0x5ad53f,'ListId':_0x2486b7[_0x4fc4('0xa0')]}));}})[_0x4fc4('0x21')](handleEntityNotFound(_0x11f5f4,null))[_0x4fc4('0x21')](function(_0xe4bdaf){if(_0xe4bdaf){_0x3b59c8=_0xe4bdaf;return db[_0x4fc4('0xa6')][_0x4fc4('0x5a')]({'where':{'ContactId':_0x3b59c8['id'],'closed':![],'SmsAccountId':_0x2486b7['id']}})[_0x4fc4('0x21')](function(_0x3aa2a7){if(_0x3aa2a7){return[_0x3aa2a7,![]];}return db[_0x4fc4('0xa6')][_0x4fc4('0x5b')]({'UserId':_0x3bbc41[_0x4fc4('0x5d')]['id'],'ContactId':_0x3b59c8['id'],'SmsAccountId':_0x2486b7['id'],'phone':_0x5ad53f,'firstMsgDirection':_0x4fc4('0xc8'),'Messages':[_[_0x4fc4('0x50')](_0x3bbc41[_0x4fc4('0x5c')],{'read':![],'body':_0x3bbc41[_0x4fc4('0x5c')][_0x4fc4('0x5c')],'phone':_0x5ad53f,'SmsAccountId':_0x2486b7['id'],'UserId':_0x3bbc41['user']['id'],'ContactId':_0x3b59c8['id']})]},{'include':[{'model':db[_0x4fc4('0xae')],'as':_0x4fc4('0xc9')}]})['then'](function(_0x753b0){return[_0x753b0,!![]];});});}})[_0x4fc4('0xca')](function(_0xe334c8,_0x315ee3){if(_0x315ee3){return _0xe334c8;}return db[_0x4fc4('0xae')][_0x4fc4('0x5b')](_['merge'](_0x3bbc41[_0x4fc4('0x5c')],{'read':![],'body':_0x3bbc41['body'][_0x4fc4('0x5c')],'phone':_0x5ad53f,'SmsAccountId':_0x2486b7['id'],'SmsInteractionId':_0xe334c8['id'],'UserId':_0x3bbc41[_0x4fc4('0x5d')]['id'],'ContactId':_0x3b59c8['id']}))['then'](function(_0xb4be72){_0xe334c8[_0x4fc4('0xcb')][_0x4fc4('0xc9')]=[];_0xe334c8[_0x4fc4('0xcb')][_0x4fc4('0xc9')][_0x4fc4('0xaa')](_0xb4be72[_0x4fc4('0xcb')]);return _0xe334c8;});})[_0x4fc4('0x21')](respondWithResult(_0x11f5f4,null))[_0x4fc4('0x2b')](handleError(_0x11f5f4,null));};exports[_0x4fc4('0x2e')]=function(_0x384cea,_0x4db5f7,_0x31c233){if(_0x384cea['body']['id']){delete _0x384cea[_0x4fc4('0x5c')]['id'];}var _0x25870a,_0xae149c,_0x5d94c0;return db[_0x4fc4('0x40')][_0x4fc4('0x5a')]({'where':{'id':_0x384cea[_0x4fc4('0x57')]['id']}})[_0x4fc4('0x21')](handleEntityNotFound(_0x4db5f7,null))['then'](function(_0x22ec3f){if(_0x22ec3f){_0x5d94c0=_0x22ec3f;logger[_0x4fc4('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x4fc4('0xcc'),_0x22ec3f[_0x4fc4('0x43')],util[_0x4fc4('0xcd')](_0x384cea[_0x4fc4('0x5c')],{'showHidden':![],'depth':null}));switch(_0x22ec3f[_0x4fc4('0x43')]){case _0x4fc4('0x8a'):if(_0x384cea[_0x4fc4('0x5c')][_0x4fc4('0xce')]&&_0x384cea['body']['status']){_0xae149c=_0x384cea[_0x4fc4('0x5c')][_0x4fc4('0x2e')];return db[_0x4fc4('0xae')][_0x4fc4('0x5a')]({'where':{'messageId':_0x384cea[_0x4fc4('0x5c')][_0x4fc4('0xce')]}});}break;case _0x4fc4('0x8c'):if(_0x384cea[_0x4fc4('0x5c')][_0x4fc4('0xcf')]&&_0x384cea[_0x4fc4('0x5c')]['statusInt']){_0xae149c=_0x384cea[_0x4fc4('0x5c')]['statusInt'];return db[_0x4fc4('0xae')][_0x4fc4('0x5a')]({'where':{'messageId':_0x384cea[_0x4fc4('0x5c')][_0x4fc4('0xcf')]}});}break;case'clicksend':if(_0x384cea[_0x4fc4('0x5c')]['message_id']&&_0x384cea[_0x4fc4('0x5c')][_0x4fc4('0xd0')]){_0xae149c=_0x384cea[_0x4fc4('0x5c')]['status_code'];return db[_0x4fc4('0xae')]['find']({'where':{'messageId':_0x384cea['body']['message_id']}});}break;case _0x4fc4('0x90'):var _0x1f71b3=_0x384cea[_0x4fc4('0x5c')][_0x4fc4('0x91')][0x0];if(_0x1f71b3[_0x4fc4('0x89')]&&_0x1f71b3[_0x4fc4('0x2e')][_0x4fc4('0xd1')]===_0x4fc4('0xd2')){_0xae149c=_0x1f71b3['status'][_0x4fc4('0xd1')];return db[_0x4fc4('0xae')]['find']({'where':{'messageId':_0x1f71b3['messageId']}});}break;case _0x4fc4('0x95'):if(_0x384cea['body'][_0x4fc4('0x89')]&&_0x384cea[_0x4fc4('0x5c')]['status']){_0xae149c=_0x384cea[_0x4fc4('0x5c')][_0x4fc4('0x2e')];return db[_0x4fc4('0xae')]['find']({'where':{'messageId':_0x384cea[_0x4fc4('0x5c')][_0x4fc4('0x89')]}});}break;case'bandwidth':if(_0x384cea[_0x4fc4('0x5c')][0x0][_0x4fc4('0x29')]['id']){_0xae149c=_0x384cea['body'][0x0][_0x4fc4('0x43')];return db['SmsMessage']['find']({'where':{'messageId':_0x384cea['body'][0x0][_0x4fc4('0x29')]['id']}});}break;case _0x4fc4('0x99'):if(_0x384cea[_0x4fc4('0x5c')][_0x4fc4('0xd3')]&&_0x384cea['body'][_0x4fc4('0x2e')]){_0xae149c=_0x384cea[_0x4fc4('0x5c')]['status'];return db['SmsMessage'][_0x4fc4('0x5a')]({'where':{'messageId':_0x384cea['body']['redif']}});}break;}}})[_0x4fc4('0x21')](handleEntityNotFound(_0x4db5f7,null))[_0x4fc4('0x21')](function(_0xd773d5){if(_0xd773d5){_0x25870a=_0xd773d5;switch(_0x5d94c0[_0x4fc4('0x43')]){case'skebby':if(_0xae149c===_0x4fc4('0xd2')){return _0x25870a[_0x4fc4('0x38')]({'read':!![]});}else{logger['error'](_0x4fc4('0x26'),_0x4fc4('0x2e'),_0x4fc4('0x8a'),util[_0x4fc4('0xcd')](_0x384cea[_0x4fc4('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x4fc4('0x8c'):if(_0xae149c==='1'){return _0x25870a['update']({'read':!![]});}else{logger[_0x4fc4('0x27')](_0x4fc4('0x26'),_0x4fc4('0x2e'),_0x4fc4('0x8a'),util[_0x4fc4('0xcd')](_0x384cea[_0x4fc4('0x5c')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x384cea[_0x4fc4('0x5c')]['error_code']&&_0xae149c>=0xc8&&_0xae149c<=0xce){return _0x25870a['update']({'read':!![]});}else{logger[_0x4fc4('0x27')](_0x4fc4('0x26'),'status',_0x4fc4('0x8d'),util[_0x4fc4('0xcd')](_0x384cea[_0x4fc4('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x4fc4('0x90'):var _0xb52e35=_0x384cea[_0x4fc4('0x5c')][_0x4fc4('0x91')][0x0];if(_0xb52e35[_0x4fc4('0x2e')]['groupName']===_0x4fc4('0xd2')){return _0x25870a[_0x4fc4('0x38')]({'read':!![]});}else{logger[_0x4fc4('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4fc4('0x2e'),'infobip',util[_0x4fc4('0xcd')](_0x384cea[_0x4fc4('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x4fc4('0x95'):if(_0xae149c==_0x4fc4('0xd4')||_0xae149c==_0x4fc4('0xd5')){return _0x25870a[_0x4fc4('0x38')]({'read':!![]});}else{logger[_0x4fc4('0x27')](_0x4fc4('0x26'),_0x4fc4('0x2e'),_0x4fc4('0x95'),util[_0x4fc4('0xcd')](_0x384cea['body'],{'showHidden':![],'depth':null}));}break;case _0x4fc4('0x98'):if(_0xae149c==_0x4fc4('0xd6')){return _0x25870a[_0x4fc4('0x38')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4fc4('0x2e'),_0x4fc4('0x98'),util[_0x4fc4('0xcd')](_0x384cea[_0x4fc4('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x4fc4('0x99'):if(_0xae149c===_0x4fc4('0xd7')||_0xae149c===_0x4fc4('0xd8')){return _0x25870a[_0x4fc4('0x38')]({'read':!![]});}else{logger[_0x4fc4('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4fc4('0x2e'),'intelepeer',util[_0x4fc4('0xcd')](_0x384cea[_0x4fc4('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x25870a;}})[_0x4fc4('0x21')](respondWithResult(_0x4db5f7,null))[_0x4fc4('0x2b')](handleError(_0x4db5f7,null));};exports[_0x4fc4('0xd9')]=function(_0x3b3c3d,_0x192c1f,_0x34bf90){var _0x31de01,_0x30b053,_0x3479cd;return db[_0x4fc4('0x40')][_0x4fc4('0x5a')]({'where':{'id':_0x3b3c3d['params']['id']}})[_0x4fc4('0x21')](handleEntityNotFound(_0x192c1f,null))[_0x4fc4('0x21')](function(_0x11c48a){if(_0x11c48a){_0x3479cd=_0x11c48a;logger[_0x4fc4('0x25')](_0x4fc4('0x26'),_0x4fc4('0x2e'),_0x4fc4('0xcc'),_0x11c48a[_0x4fc4('0x43')],util['inspect'](_0x3b3c3d[_0x4fc4('0x46')],{'showHidden':![],'depth':null}));switch(_0x11c48a[_0x4fc4('0x43')]){case'csc':if(_0x3b3c3d['query'][_0x4fc4('0xda')]&&_0x3b3c3d[_0x4fc4('0x46')][_0x4fc4('0xdb')]){_0x30b053=_0x3b3c3d[_0x4fc4('0x46')]['state'];return db['SmsMessage'][_0x4fc4('0x5a')]({'where':{'messageId':_0x3b3c3d[_0x4fc4('0x46')][_0x4fc4('0xda')]}});}break;}}})[_0x4fc4('0x21')](handleEntityNotFound(_0x192c1f,null))['then'](function(_0xf11adc){if(_0xf11adc){_0x31de01=_0xf11adc;switch(_0x3479cd[_0x4fc4('0x43')]){case _0x4fc4('0x93'):if(_0x30b053==='2'||_0x30b053==='6'){return _0x31de01[_0x4fc4('0x38')]({'read':!![]});}else{logger[_0x4fc4('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4fc4('0x2e'),_0x4fc4('0x93'),util['inspect'](_0x3b3c3d[_0x4fc4('0x46')],{'showHidden':![],'depth':null}));};break;}return _0x31de01;}})['then'](respondWithResult(_0x192c1f,null))['catch'](handleError(_0x192c1f,null));};exports['addAgents']=function(_0x5a0d1d,_0x50c1a8,_0x3aff36){return db['SmsAccount'][_0x4fc4('0x5a')]({'where':{'id':_0x5a0d1d[_0x4fc4('0x57')]['id']}})[_0x4fc4('0x21')](handleEntityNotFound(_0x50c1a8,null))['then'](function(_0x2bf889){if(_0x2bf889){return _0x2bf889[_0x4fc4('0xdc')](_0x5a0d1d[_0x4fc4('0x5c')][_0x4fc4('0x6c')],_[_0x4fc4('0xa5')](_0x5a0d1d[_0x4fc4('0x5c')],[_0x4fc4('0x6c'),'id'])||{})[_0x4fc4('0xca')](function(_0x31ed48){for(var _0x35cc72=0x0;_0x35cc72<_0x5a0d1d[_0x4fc4('0x5c')]['ids'][_0x4fc4('0x59')];_0x35cc72+=0x1){socket[_0x4fc4('0xdd')](_0x4fc4('0xde'),{'UserId':Number(_0x5a0d1d['body'][_0x4fc4('0x6c')][_0x35cc72]),'SmsAccountId':Number(_0x5a0d1d[_0x4fc4('0x57')]['id'])});}return _0x31ed48;});}})['then'](respondWithResult(_0x50c1a8,null))[_0x4fc4('0x2b')](handleError(_0x50c1a8,null));};exports['removeAgents']=function(_0x555eae,_0x4e0df4,_0x448785){return db['SmsAccount']['find']({'where':{'id':_0x555eae[_0x4fc4('0x57')]['id']}})[_0x4fc4('0x21')](handleEntityNotFound(_0x4e0df4,null))[_0x4fc4('0x21')](function(_0x1de2f3){if(_0x1de2f3){return _0x1de2f3[_0x4fc4('0xdf')](_0x555eae[_0x4fc4('0x46')][_0x4fc4('0x6c')])[_0x4fc4('0x21')](function(){if(_[_0x4fc4('0xe0')](_0x555eae['query'][_0x4fc4('0x6c')])){for(var _0xc045f3=0x0;_0xc045f3<_0x555eae[_0x4fc4('0x46')][_0x4fc4('0x6c')][_0x4fc4('0x59')];_0xc045f3+=0x1){socket['emit'](_0x4fc4('0xe1'),{'UserId':Number(_0x555eae[_0x4fc4('0x46')][_0x4fc4('0x6c')][_0xc045f3]),'SmsAccountId':Number(_0x555eae[_0x4fc4('0x57')]['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x555eae[_0x4fc4('0x46')][_0x4fc4('0x6c')]),'SmsAccountId':Number(_0x555eae[_0x4fc4('0x57')]['id'])});}});}})[_0x4fc4('0x21')](respondWithStatusCode(_0x4e0df4,null))[_0x4fc4('0x2b')](handleError(_0x4e0df4,null));};exports[_0x4fc4('0xe2')]=function(_0x41a76a,_0x3352e4,_0x19a69d){var _0x515ff5={};var _0x274d3a={};var _0x217ab5;var _0x44d1eb;return db[_0x4fc4('0x40')][_0x4fc4('0x70')]({'where':{'id':_0x41a76a[_0x4fc4('0x57')]['id']}})[_0x4fc4('0x21')](handleEntityNotFound(_0x3352e4,null))[_0x4fc4('0x21')](function(_0x4da506){if(_0x4da506){_0x217ab5=_0x4da506;_0x274d3a[_0x4fc4('0x49')]=_['keys'](db[_0x4fc4('0xb2')][_0x4fc4('0x41')]);_0x274d3a['query']=_[_0x4fc4('0x45')](_0x41a76a['query']);_0x274d3a[_0x4fc4('0x47')]=_[_0x4fc4('0x48')](_0x274d3a['model'],_0x274d3a[_0x4fc4('0x46')]);_0x515ff5[_0x4fc4('0x4a')]=_['intersection'](_0x274d3a[_0x4fc4('0x49')],qs[_0x4fc4('0x4b')](_0x41a76a['query'][_0x4fc4('0x4b')]));_0x515ff5[_0x4fc4('0x4a')]=_0x515ff5[_0x4fc4('0x4a')]['length']?_0x515ff5[_0x4fc4('0x4a')]:_0x274d3a[_0x4fc4('0x49')];_0x515ff5[_0x4fc4('0x69')]=qs[_0x4fc4('0x4d')](_0x41a76a[_0x4fc4('0x46')]['sort']);_0x515ff5[_0x4fc4('0x51')]=qs['filters'](_[_0x4fc4('0x4e')](_0x41a76a[_0x4fc4('0x46')],_0x274d3a['filters']));if(_0x41a76a[_0x4fc4('0x46')][_0x4fc4('0x4f')]){_0x515ff5[_0x4fc4('0x51')]=_[_0x4fc4('0x50')](_0x515ff5[_0x4fc4('0x51')],{'$or':_[_0x4fc4('0x3f')](_0x515ff5['attributes'],function(_0x25a8e3){var _0x1cbd74={};_0x1cbd74[_0x25a8e3]={'$like':'%'+_0x41a76a[_0x4fc4('0x46')][_0x4fc4('0x4f')]+'%'};return _0x1cbd74;})});}_0x515ff5=_[_0x4fc4('0x50')]({},_0x515ff5,_0x41a76a[_0x4fc4('0x53')]);return _0x217ab5[_0x4fc4('0xe2')](_0x515ff5);}})[_0x4fc4('0x21')](function(_0x5c9406){if(_0x5c9406){_0x44d1eb=_0x5c9406[_0x4fc4('0x59')];if(!_0x41a76a['query'][_0x4fc4('0x71')](_0x4fc4('0x4c'))){_0x515ff5[_0x4fc4('0x31')]=qs[_0x4fc4('0x31')](_0x41a76a[_0x4fc4('0x46')][_0x4fc4('0x31')]);_0x515ff5[_0x4fc4('0x33')]=qs[_0x4fc4('0x33')](_0x41a76a['query'][_0x4fc4('0x33')]);}return _0x217ab5[_0x4fc4('0xe2')](_0x515ff5);}})[_0x4fc4('0x21')](function(_0x351158){if(_0x351158){return _0x351158?{'count':_0x44d1eb,'rows':_0x351158}:null;}})['then'](respondWithResult(_0x3352e4,null))[_0x4fc4('0x2b')](handleError(_0x3352e4,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 798f2dc..49c7f6d 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 _0xa539=['hook','exports','events','../../mysqldb','SmsAccount','save','remove','emit','hasOwnProperty'];(function(_0x5eb5dd,_0xea0a6){var _0x42885d=function(_0x46136b){while(--_0x46136b){_0x5eb5dd['push'](_0x5eb5dd['shift']());}};_0x42885d(++_0xea0a6);}(_0xa539,0x16a));var _0x9a53=function(_0x22882a,_0x1ff220){_0x22882a=_0x22882a-0x0;var _0x1b32a1=_0xa539[_0x22882a];return _0x1b32a1;};'use strict';var EventEmitter=require(_0x9a53('0x0'));var SmsAccount=require(_0x9a53('0x1'))['db'][_0x9a53('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9a53('0x3'),'afterUpdate':'update','afterDestroy':_0x9a53('0x4')};function emitEvent(_0x13ebc7){return function(_0x310f5f,_0x4256f0,_0xaa111f){SmsAccountEvents[_0x9a53('0x5')](_0x13ebc7+':'+_0x310f5f['id'],_0x310f5f);SmsAccountEvents[_0x9a53('0x5')](_0x13ebc7,_0x310f5f);_0xaa111f(null);};}for(var e in events){if(events[_0x9a53('0x6')](e)){var event=events[e];SmsAccount[_0x9a53('0x7')](e,emitEvent(event));}}module[_0x9a53('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0xe551=['update','remove','hasOwnProperty','hook','events','../../mysqldb','SmsAccount'];(function(_0x59863a,_0x807e55){var _0x5c8b78=function(_0x46d7e3){while(--_0x46d7e3){_0x59863a['push'](_0x59863a['shift']());}};_0x5c8b78(++_0x807e55);}(_0xe551,0x10e));var _0x1e55=function(_0x31e071,_0x2f5d26){_0x31e071=_0x31e071-0x0;var _0x45630d=_0xe551[_0x31e071];return _0x45630d;};'use strict';var EventEmitter=require(_0x1e55('0x0'));var SmsAccount=require(_0x1e55('0x1'))['db'][_0x1e55('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1e55('0x3'),'afterDestroy':_0x1e55('0x4')};function emitEvent(_0x4c07f6){return function(_0x31dcd1,_0x234f77,_0x57b9f7){SmsAccountEvents['emit'](_0x4c07f6+':'+_0x31dcd1['id'],_0x31dcd1);SmsAccountEvents['emit'](_0x4c07f6,_0x31dcd1);_0x57b9f7(null);};}for(var e in events){if(events[_0x1e55('0x5')](e)){var event=events[e];SmsAccount[_0x1e55('0x6')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index ecf6203..4658256 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 _0x2229=['sms_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','SmsAccount'];(function(_0x5ec7f8,_0x5d5978){var _0x4cd2e1=function(_0x322023){while(--_0x322023){_0x5ec7f8['push'](_0x5ec7f8['shift']());}};_0x4cd2e1(++_0x5d5978);}(_0x2229,0xb5));var _0x9222=function(_0x40e854,_0x42f1f6){_0x40e854=_0x40e854-0x0;var _0x1463b3=_0x2229[_0x40e854];return _0x1463b3;};'use strict';var _=require(_0x9222('0x0'));var util=require('util');var logger=require(_0x9222('0x1'))(_0x9222('0x2'));var moment=require(_0x9222('0x3'));var BPromise=require(_0x9222('0x4'));var rp=require(_0x9222('0x5'));var fs=require('fs');var path=require(_0x9222('0x6'));var rimraf=require(_0x9222('0x7'));var config=require(_0x9222('0x8'));var attributes=require('./smsAccount.attributes');module[_0x9222('0x9')]=function(_0xb783f9,_0x1157ed){return _0xb783f9['define'](_0x9222('0xa'),attributes,{'tableName':_0x9222('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x436a=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','SmsAccount','lodash','../../config/logger'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x436a,0x12a));var _0xa436=function(_0x2a4702,_0x14d7a4){_0x2a4702=_0x2a4702-0x0;var _0x943198=_0x436a[_0x2a4702];return _0x943198;};'use strict';var _=require(_0xa436('0x0'));var util=require('util');var logger=require(_0xa436('0x1'))(_0xa436('0x2'));var moment=require(_0xa436('0x3'));var BPromise=require(_0xa436('0x4'));var rp=require(_0xa436('0x5'));var fs=require('fs');var path=require(_0xa436('0x6'));var rimraf=require(_0xa436('0x7'));var config=require(_0xa436('0x8'));var attributes=require(_0xa436('0x9'));module[_0xa436('0xa')]=function(_0x19be70,_0x19920f){return _0x19be70['define'](_0xa436('0xb'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index c3df0cb..80252f5 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 _0xf487=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','stringify'];(function(_0x42bfb7,_0x25a3ec){var _0x5c497d=function(_0x48e83e){while(--_0x48e83e){_0x42bfb7['push'](_0x42bfb7['shift']());}};_0x5c497d(++_0x25a3ec);}(_0xf487,0xfc));var _0x7f48=function(_0x321266,_0x22bd3f){_0x321266=_0x321266-0x0;var _0x28a444=_0xf487[_0x321266];return _0x28a444;};'use strict';var _=require('lodash');var util=require(_0x7f48('0x0'));var moment=require(_0x7f48('0x1'));var BPromise=require(_0x7f48('0x2'));var rs=require(_0x7f48('0x3'));var fs=require('fs');var Redis=require(_0x7f48('0x4'));var db=require(_0x7f48('0x5'))['db'];var utils=require(_0x7f48('0x6'));var logger=require(_0x7f48('0x7'))(_0x7f48('0x8'));var config=require('../../config/environment');var jayson=require(_0x7f48('0x9'));var client=jayson['client'][_0x7f48('0xa')]({'port':0x232a});config[_0x7f48('0xb')]=_[_0x7f48('0xc')](config[_0x7f48('0xb')],{'host':_0x7f48('0xd'),'port':0x18eb});var socket=require(_0x7f48('0xe'))(new Redis(config['redis']));require('./smsAccount.socket')[_0x7f48('0xf')](socket);function respondWithRpcPromise(_0xd2d22a,_0x1f7cac,_0x2438c8){return new BPromise(function(_0x1e2443,_0x4fcd77){return client['request'](_0xd2d22a,_0x2438c8)['then'](function(_0x277f4a){logger[_0x7f48('0x10')](_0x7f48('0x11'),_0x1f7cac,_0x7f48('0x12'));logger['debug'](_0x7f48('0x13'),_0x1f7cac,_0x7f48('0x12'),JSON['stringify'](_0x277f4a));if(_0x277f4a['error']){if(_0x277f4a[_0x7f48('0x14')][_0x7f48('0x15')]===0x1f4){logger[_0x7f48('0x14')](_0x7f48('0x11'),_0x1f7cac,_0x277f4a[_0x7f48('0x14')]['message']);return _0x4fcd77(_0x277f4a['error']['message']);}logger[_0x7f48('0x14')](_0x7f48('0x11'),_0x1f7cac,_0x277f4a['error'][_0x7f48('0x16')]);return _0x1e2443(_0x277f4a[_0x7f48('0x14')]['message']);}else{logger['info'](_0x7f48('0x11'),_0x1f7cac,_0x7f48('0x12'));_0x1e2443(_0x277f4a[_0x7f48('0x17')][_0x7f48('0x16')]);}})[_0x7f48('0x18')](function(_0xdd97de){logger['error'](_0x7f48('0x11'),_0x1f7cac,_0xdd97de);_0x4fcd77(_0xdd97de);});});}exports[_0x7f48('0x19')]=function(_0x1f07c1){var _0x53906c=this;return new Promise(function(_0x4493ad,_0x145436){return db[_0x7f48('0x1a')][_0x7f48('0x1b')]({'raw':_0x1f07c1['options']?_0x1f07c1[_0x7f48('0x1c')][_0x7f48('0x1d')]===undefined?!![]:![]:!![],'where':_0x1f07c1[_0x7f48('0x1c')]?_0x1f07c1[_0x7f48('0x1c')][_0x7f48('0x1e')]||null:null,'attributes':_0x1f07c1['options']?_0x1f07c1['options'][_0x7f48('0x1f')]||null:null,'include':_0x1f07c1[_0x7f48('0x1c')]?_0x1f07c1[_0x7f48('0x1c')][_0x7f48('0x20')]?_[_0x7f48('0x21')](_0x1f07c1[_0x7f48('0x1c')][_0x7f48('0x20')],function(_0x238e4d){return{'model':db[_0x238e4d[_0x7f48('0x22')]],'as':_0x238e4d['as'],'attributes':_0x238e4d[_0x7f48('0x1f')],'include':_0x238e4d['include']?_[_0x7f48('0x21')](_0x238e4d[_0x7f48('0x20')],function(_0x4a9151){return{'model':db[_0x4a9151[_0x7f48('0x22')]],'as':_0x4a9151['as'],'attributes':_0x4a9151[_0x7f48('0x1f')],'include':_0x4a9151[_0x7f48('0x20')]?_[_0x7f48('0x21')](_0x4a9151['include'],function(_0x23f783){return{'model':db[_0x23f783[_0x7f48('0x22')]],'as':_0x23f783['as'],'attributes':_0x23f783['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d0477){logger['info'](_0x7f48('0x19'),_0x1f07c1);logger['debug'](_0x7f48('0x19'),_0x1f07c1,JSON[_0x7f48('0x23')](_0x4d0477));_0x4493ad(_0x4d0477);})[_0x7f48('0x18')](function(_0x5827c){logger[_0x7f48('0x14')](_0x7f48('0x19'),_0x5827c[_0x7f48('0x16')],_0x1f07c1);_0x145436(_0x53906c[_0x7f48('0x14')](0x1f4,_0x5827c['message']));});});}; \ No newline at end of file +var _0xb0a2=['debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','attributes','include','map','model','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x13c45a,_0x270ac7){var _0x299c72=function(_0xb8d672){while(--_0xb8d672){_0x13c45a['push'](_0x13c45a['shift']());}};_0x299c72(++_0x270ac7);}(_0xb0a2,0x1cd));var _0x2b0a=function(_0x1ca1b8,_0x3d6cdb){_0x1ca1b8=_0x1ca1b8-0x0;var _0x76d76a=_0xb0a2[_0x1ca1b8];return _0x76d76a;};'use strict';var _=require('lodash');var util=require(_0x2b0a('0x0'));var moment=require(_0x2b0a('0x1'));var BPromise=require(_0x2b0a('0x2'));var rs=require(_0x2b0a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b0a('0x4'))['db'];var utils=require(_0x2b0a('0x5'));var logger=require(_0x2b0a('0x6'))(_0x2b0a('0x7'));var config=require(_0x2b0a('0x8'));var jayson=require(_0x2b0a('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x2b0a('0xa')]=_[_0x2b0a('0xb')](config['redis'],{'host':_0x2b0a('0xc'),'port':0x18eb});var socket=require(_0x2b0a('0xd'))(new Redis(config[_0x2b0a('0xa')]));require(_0x2b0a('0xe'))[_0x2b0a('0xf')](socket);function respondWithRpcPromise(_0x44e7d4,_0x2623b4,_0x7b9042){return new BPromise(function(_0x3bf3fc,_0x541d02){return client[_0x2b0a('0x10')](_0x44e7d4,_0x7b9042)[_0x2b0a('0x11')](function(_0x2d6d4f){logger['info'](_0x2b0a('0x12'),_0x2623b4,_0x2b0a('0x13'));logger[_0x2b0a('0x14')](_0x2b0a('0x15'),_0x2623b4,_0x2b0a('0x13'),JSON[_0x2b0a('0x16')](_0x2d6d4f));if(_0x2d6d4f[_0x2b0a('0x17')]){if(_0x2d6d4f[_0x2b0a('0x17')]['code']===0x1f4){logger[_0x2b0a('0x17')](_0x2b0a('0x12'),_0x2623b4,_0x2d6d4f[_0x2b0a('0x17')][_0x2b0a('0x18')]);return _0x541d02(_0x2d6d4f[_0x2b0a('0x17')]['message']);}logger[_0x2b0a('0x17')](_0x2b0a('0x12'),_0x2623b4,_0x2d6d4f[_0x2b0a('0x17')][_0x2b0a('0x18')]);return _0x3bf3fc(_0x2d6d4f[_0x2b0a('0x17')][_0x2b0a('0x18')]);}else{logger[_0x2b0a('0x19')](_0x2b0a('0x12'),_0x2623b4,_0x2b0a('0x13'));_0x3bf3fc(_0x2d6d4f[_0x2b0a('0x1a')][_0x2b0a('0x18')]);}})[_0x2b0a('0x1b')](function(_0x165394){logger[_0x2b0a('0x17')](_0x2b0a('0x12'),_0x2623b4,_0x165394);_0x541d02(_0x165394);});});}exports[_0x2b0a('0x1c')]=function(_0x2a021e){var _0x57485f=this;return new Promise(function(_0x571d60,_0x3da310){return db[_0x2b0a('0x1d')][_0x2b0a('0x1e')]({'raw':_0x2a021e[_0x2b0a('0x1f')]?_0x2a021e[_0x2b0a('0x1f')][_0x2b0a('0x20')]===undefined?!![]:![]:!![],'where':_0x2a021e[_0x2b0a('0x1f')]?_0x2a021e[_0x2b0a('0x1f')]['where']||null:null,'attributes':_0x2a021e[_0x2b0a('0x1f')]?_0x2a021e[_0x2b0a('0x1f')][_0x2b0a('0x21')]||null:null,'include':_0x2a021e[_0x2b0a('0x1f')]?_0x2a021e[_0x2b0a('0x1f')][_0x2b0a('0x22')]?_[_0x2b0a('0x23')](_0x2a021e[_0x2b0a('0x1f')]['include'],function(_0x59f973){return{'model':db[_0x59f973[_0x2b0a('0x24')]],'as':_0x59f973['as'],'attributes':_0x59f973[_0x2b0a('0x21')],'include':_0x59f973[_0x2b0a('0x22')]?_[_0x2b0a('0x23')](_0x59f973[_0x2b0a('0x22')],function(_0x2b6833){return{'model':db[_0x2b6833[_0x2b0a('0x24')]],'as':_0x2b6833['as'],'attributes':_0x2b6833[_0x2b0a('0x21')],'include':_0x2b6833['include']?_[_0x2b0a('0x23')](_0x2b6833[_0x2b0a('0x22')],function(_0x9df914){return{'model':db[_0x9df914['model']],'as':_0x9df914['as'],'attributes':_0x9df914[_0x2b0a('0x21')]};}):[]};}):[]};}):[]:[]})[_0x2b0a('0x11')](function(_0x4e4b92){logger[_0x2b0a('0x19')]('ShowSmsAccount',_0x2a021e);logger[_0x2b0a('0x14')](_0x2b0a('0x1c'),_0x2a021e,JSON[_0x2b0a('0x16')](_0x4e4b92));_0x571d60(_0x4e4b92);})[_0x2b0a('0x1b')](function(_0x1c4819){logger['error'](_0x2b0a('0x1c'),_0x1c4819[_0x2b0a('0x18')],_0x2a021e);_0x3da310(_0x57485f[_0x2b0a('0x17')](0x1f4,_0x1c4819['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index f6b4d2c..d88cb8b 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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 edeaaae..4fa3b44 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(_0x57252a,_0x1ceae9){var _0x2733a8=function(_0x1b8611){while(--_0x1b8611){_0x57252a['push'](_0x57252a['shift']());}};_0x2733a8(++_0x1ceae9);}(_0x3e74,0x175));var _0x43e7=function(_0x3688f1,_0x177488){_0x3688f1=_0x3688f1-0x0;var _0x9f1daa=_0x3e74[_0x3688f1];return _0x9f1daa;};'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 _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x35ce4e,_0x4904bf){var _0x3b7a52=function(_0x4cc441){while(--_0x4cc441){_0x35ce4e['push'](_0x35ce4e['shift']());}};_0x3b7a52(++_0x4904bf);}(_0x55ca,0x126));var _0xa55c=function(_0x4ac60a,_0x503a99){_0x4ac60a=_0x4ac60a-0x0;var _0x4b22e8=_0x55ca[_0x4ac60a];return _0x4b22e8;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 6f3a597..097653c 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 _0xd272=['noop','sequelize','STRING'];(function(_0x452fde,_0x50be29){var _0x533b5e=function(_0x7121dd){while(--_0x7121dd){_0x452fde['push'](_0x452fde['shift']());}};_0x533b5e(++_0x50be29);}(_0xd272,0xb2));var _0x2d27=function(_0x30f0be,_0x440da1){_0x30f0be=_0x30f0be-0x0;var _0x56c172=_0xd272[_0x30f0be];return _0x56c172;};'use strict';var Sequelize=require(_0x2d27('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2d27('0x1')],'allowNull':![],'defaultValue':_0x2d27('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2d27('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xb3be=['*,*,*,*','sequelize','exports','INTEGER','noop','TEXT','STRING'];(function(_0x4b9395,_0xee7ee4){var _0x583f02=function(_0x3b4d40){while(--_0x3b4d40){_0x4b9395['push'](_0x4b9395['shift']());}};_0x583f02(++_0xee7ee4);}(_0xb3be,0x86));var _0xeb3b=function(_0x56cd16,_0x1f7a0d){_0x56cd16=_0x56cd16-0x0;var _0x4d15a9=_0xb3be[_0x56cd16];return _0x4d15a9;};'use strict';var Sequelize=require(_0xeb3b('0x0'));module[_0xeb3b('0x1')]={'priority':{'type':Sequelize[_0xeb3b('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xeb3b('0x3')},'appdata':{'type':Sequelize[_0xeb3b('0x4')]()},'description':{'type':Sequelize[_0xeb3b('0x5')]},'interval':{'type':Sequelize[_0xeb3b('0x5')],'defaultValue':_0xeb3b('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 9246eba..775ec57 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 _0x12ce=['SmsApplication','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','catch','show','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x12ce,0x198));var _0xe12c=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x12ce[_0x4fc9e6];return _0x551d28;};'use strict';var emlformat=require(_0xe12c('0x0'));var rimraf=require(_0xe12c('0x1'));var zipdir=require(_0xe12c('0x2'));var jsonpatch=require(_0xe12c('0x3'));var rp=require(_0xe12c('0x4'));var moment=require(_0xe12c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe12c('0x6'));var util=require(_0xe12c('0x7'));var path=require(_0xe12c('0x8'));var sox=require(_0xe12c('0x9'));var csv=require(_0xe12c('0xa'));var ejs=require(_0xe12c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe12c('0xc'));var squel=require(_0xe12c('0xd'));var crypto=require(_0xe12c('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe12c('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe12c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe12c('0x11'));var logger=require('../../config/logger')(_0xe12c('0x12'));var utils=require(_0xe12c('0x13'));var config=require(_0xe12c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe12c('0x15'))['db'];function respondWithStatusCode(_0x2b569c,_0x886b21){_0x886b21=_0x886b21||0xcc;return function(_0x23a538){if(_0x23a538){return _0x2b569c[_0xe12c('0x16')](_0x886b21);}return _0x2b569c[_0xe12c('0x17')](_0x886b21)[_0xe12c('0x18')]();};}function respondWithResult(_0x996b4e,_0x2465ea){_0x2465ea=_0x2465ea||0xc8;return function(_0xb44b30){if(_0xb44b30){return _0x996b4e[_0xe12c('0x17')](_0x2465ea)[_0xe12c('0x19')](_0xb44b30);}};}function respondWithFilteredResult(_0x27767a,_0x4afa9d){return function(_0x49204e){if(_0x49204e){var _0xcb3dbe=typeof _0x4afa9d[_0xe12c('0x1a')]===_0xe12c('0x1b')&&typeof _0x4afa9d['limit']===_0xe12c('0x1b');var _0x359663=_0x49204e[_0xe12c('0x1c')];var _0x304ba2=_0xcb3dbe?0x0:_0x4afa9d['offset'];var _0xcb8134=_0xcb3dbe?_0x49204e[_0xe12c('0x1c')]:_0x4afa9d[_0xe12c('0x1a')]+_0x4afa9d[_0xe12c('0x1d')];var _0x111085;if(_0xcb8134>=_0x359663){_0xcb8134=_0x359663;_0x111085=0xc8;}else{_0x111085=0xce;}_0x27767a[_0xe12c('0x17')](_0x111085);return _0x27767a[_0xe12c('0x1e')](_0xe12c('0x1f'),_0x304ba2+'-'+_0xcb8134+'/'+_0x359663)[_0xe12c('0x19')](_0x49204e);}return null;};}function patchUpdates(_0x35ff20){return function(_0x580baf){try{jsonpatch[_0xe12c('0x20')](_0x580baf,_0x35ff20,!![]);}catch(_0x179b30){return BPromise[_0xe12c('0x21')](_0x179b30);}return _0x580baf['save']();};}function saveUpdates(_0x2159f3,_0x539802){return function(_0xf52d1b){if(_0xf52d1b){return _0xf52d1b[_0xe12c('0x22')](_0x2159f3)[_0xe12c('0x23')](function(_0xe9151f){return _0xe9151f;});}return null;};}function removeEntity(_0x2f0944,_0x1bb45b){return function(_0x2a163a){if(_0x2a163a){return _0x2a163a['destroy']()[_0xe12c('0x23')](function(){_0x2f0944[_0xe12c('0x17')](0xcc)[_0xe12c('0x18')]();});}};}function handleEntityNotFound(_0x395da5,_0x2dfd16){return function(_0x178bda){if(!_0x178bda){_0x395da5['sendStatus'](0x194);}return _0x178bda;};}function handleError(_0xae57cc,_0x5ae0ba){_0x5ae0ba=_0x5ae0ba||0x1f4;return function(_0x1afb8c){logger[_0xe12c('0x24')](_0x1afb8c[_0xe12c('0x25')]);if(_0x1afb8c['name']){delete _0x1afb8c[_0xe12c('0x26')];}_0xae57cc[_0xe12c('0x17')](_0x5ae0ba)[_0xe12c('0x27')](_0x1afb8c);};}exports[_0xe12c('0x28')]=function(_0x21f75d,_0x133677){var _0x396f55={},_0x356e96={},_0x421177={'count':0x0,'rows':[]};var _0x331487=_[_0xe12c('0x29')](db[_0xe12c('0x2a')][_0xe12c('0x2b')],function(_0x49334d){return{'name':_0x49334d[_0xe12c('0x2c')],'type':_0x49334d[_0xe12c('0x2d')][_0xe12c('0x2e')]};});_0x356e96[_0xe12c('0x2f')]=_[_0xe12c('0x29')](_0x331487,_0xe12c('0x26'));_0x356e96[_0xe12c('0x30')]=_[_0xe12c('0x31')](_0x21f75d[_0xe12c('0x30')]);_0x356e96[_0xe12c('0x32')]=_[_0xe12c('0x33')](_0x356e96[_0xe12c('0x2f')],_0x356e96[_0xe12c('0x30')]);_0x396f55[_0xe12c('0x34')]=_[_0xe12c('0x33')](_0x356e96[_0xe12c('0x2f')],qs[_0xe12c('0x35')](_0x21f75d['query'][_0xe12c('0x35')]));_0x396f55['attributes']=_0x396f55[_0xe12c('0x34')][_0xe12c('0x36')]?_0x396f55[_0xe12c('0x34')]:_0x356e96['model'];if(!_0x21f75d[_0xe12c('0x30')][_0xe12c('0x37')]('nolimit')){_0x396f55[_0xe12c('0x1d')]=qs[_0xe12c('0x1d')](_0x21f75d[_0xe12c('0x30')]['limit']);_0x396f55[_0xe12c('0x1a')]=qs[_0xe12c('0x1a')](_0x21f75d[_0xe12c('0x30')][_0xe12c('0x1a')]);}_0x396f55[_0xe12c('0x38')]=qs[_0xe12c('0x39')](_0x21f75d['query'][_0xe12c('0x39')]);_0x396f55[_0xe12c('0x3a')]=qs[_0xe12c('0x32')](_[_0xe12c('0x3b')](_0x21f75d[_0xe12c('0x30')],_0x356e96[_0xe12c('0x32')]),_0x331487);if(_0x21f75d[_0xe12c('0x30')][_0xe12c('0x3c')]){_0x396f55['where']=_[_0xe12c('0x3d')](_0x396f55[_0xe12c('0x3a')],{'$or':_[_0xe12c('0x29')](_0x331487,function(_0x2c7c68){if(_0x2c7c68[_0xe12c('0x2d')]!==_0xe12c('0x3e')){var _0x2e7f20={};_0x2e7f20[_0x2c7c68[_0xe12c('0x26')]]={'$like':'%'+_0x21f75d[_0xe12c('0x30')][_0xe12c('0x3c')]+'%'};return _0x2e7f20;}})});}_0x396f55=_[_0xe12c('0x3d')]({},_0x396f55,_0x21f75d[_0xe12c('0x3f')]);var _0x225c74={'where':_0x396f55[_0xe12c('0x3a')]};return db[_0xe12c('0x2a')][_0xe12c('0x1c')](_0x225c74)['then'](function(_0x3d09a0){_0x421177[_0xe12c('0x1c')]=_0x3d09a0;if(_0x21f75d[_0xe12c('0x30')][_0xe12c('0x40')]){_0x396f55[_0xe12c('0x41')]=[{'all':!![]}];}return db['SmsApplication'][_0xe12c('0x42')](_0x396f55);})[_0xe12c('0x23')](function(_0x3d6360){_0x421177[_0xe12c('0x43')]=_0x3d6360;return _0x421177;})[_0xe12c('0x23')](respondWithFilteredResult(_0x133677,_0x396f55))[_0xe12c('0x44')](handleError(_0x133677,null));};exports[_0xe12c('0x45')]=function(_0x4ae5ab,_0x5cae38){var _0x1c9ccb={'raw':!![],'where':{'id':_0x4ae5ab['params']['id']}},_0x38ce03={};_0x38ce03['model']=_[_0xe12c('0x31')](db['SmsApplication']['rawAttributes']);_0x38ce03[_0xe12c('0x30')]=_['keys'](_0x4ae5ab['query']);_0x38ce03[_0xe12c('0x32')]=_[_0xe12c('0x33')](_0x38ce03[_0xe12c('0x2f')],_0x38ce03[_0xe12c('0x30')]);_0x1c9ccb['attributes']=_[_0xe12c('0x33')](_0x38ce03[_0xe12c('0x2f')],qs[_0xe12c('0x35')](_0x4ae5ab[_0xe12c('0x30')][_0xe12c('0x35')]));_0x1c9ccb[_0xe12c('0x34')]=_0x1c9ccb[_0xe12c('0x34')][_0xe12c('0x36')]?_0x1c9ccb[_0xe12c('0x34')]:_0x38ce03['model'];if(_0x4ae5ab[_0xe12c('0x30')]['includeAll']){_0x1c9ccb['include']=[{'all':!![]}];}_0x1c9ccb=_[_0xe12c('0x3d')]({},_0x1c9ccb,_0x4ae5ab[_0xe12c('0x3f')]);return db['SmsApplication'][_0xe12c('0x46')](_0x1c9ccb)[_0xe12c('0x23')](handleEntityNotFound(_0x5cae38,null))['then'](respondWithResult(_0x5cae38,null))[_0xe12c('0x44')](handleError(_0x5cae38,null));};exports['create']=function(_0x3504df,_0x44803d){return db[_0xe12c('0x2a')][_0xe12c('0x47')](_0x3504df[_0xe12c('0x48')],{})['then'](respondWithResult(_0x44803d,0xc9))[_0xe12c('0x44')](handleError(_0x44803d,null));};exports[_0xe12c('0x22')]=function(_0x2170a3,_0x375398){if(_0x2170a3['body']['id']){delete _0x2170a3[_0xe12c('0x48')]['id'];}return db[_0xe12c('0x2a')][_0xe12c('0x46')]({'where':{'id':_0x2170a3[_0xe12c('0x49')]['id']}})['then'](handleEntityNotFound(_0x375398,null))[_0xe12c('0x23')](saveUpdates(_0x2170a3[_0xe12c('0x48')],null))['then'](respondWithResult(_0x375398,null))[_0xe12c('0x44')](handleError(_0x375398,null));};exports[_0xe12c('0x4a')]=function(_0x3b9233,_0x4a06d9){return db[_0xe12c('0x2a')][_0xe12c('0x46')]({'where':{'id':_0x3b9233['params']['id']}})[_0xe12c('0x23')](handleEntityNotFound(_0x4a06d9,null))[_0xe12c('0x23')](removeEntity(_0x4a06d9,null))[_0xe12c('0x44')](handleError(_0x4a06d9,null));}; \ No newline at end of file +var _0xa30d=['fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','Content-Range','json','save','update','then','destroy','end','stack','name','send','SmsApplication','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','zip-dir','fast-json-patch','request-promise','util','path','sox','ejs'];(function(_0x37f6d8,_0x444925){var _0x49f67b=function(_0x54cfe7){while(--_0x54cfe7){_0x37f6d8['push'](_0x37f6d8['shift']());}};_0x49f67b(++_0x444925);}(_0xa30d,0xc5));var _0xda30=function(_0x516c4a,_0x65f22f){_0x516c4a=_0x516c4a-0x0;var _0x2748f7=_0xa30d[_0x516c4a];return _0x2748f7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xda30('0x0'));var jsonpatch=require(_0xda30('0x1'));var rp=require(_0xda30('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xda30('0x3'));var path=require(_0xda30('0x4'));var sox=require(_0xda30('0x5'));var csv=require('to-csv');var ejs=require(_0xda30('0x6'));var fs=require('fs');var fs_extra=require(_0xda30('0x7'));var _=require(_0xda30('0x8'));var squel=require(_0xda30('0x9'));var crypto=require(_0xda30('0xa'));var jsforce=require(_0xda30('0xb'));var deskjs=require(_0xda30('0xc'));var toCsv=require(_0xda30('0xd'));var querystring=require(_0xda30('0xe'));var Papa=require(_0xda30('0xf'));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(_0xda30('0x10'))(_0xda30('0x11'));var utils=require(_0xda30('0x12'));var config=require(_0xda30('0x13'));var licenseUtil=require(_0xda30('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d0202,_0x58cedc){_0x58cedc=_0x58cedc||0xcc;return function(_0x525f09){if(_0x525f09){return _0x4d0202[_0xda30('0x15')](_0x58cedc);}return _0x4d0202[_0xda30('0x16')](_0x58cedc)['end']();};}function respondWithResult(_0xc58715,_0x41880b){_0x41880b=_0x41880b||0xc8;return function(_0x1429a8){if(_0x1429a8){return _0xc58715[_0xda30('0x16')](_0x41880b)['json'](_0x1429a8);}};}function respondWithFilteredResult(_0x54f529,_0x17bcfe){return function(_0x138014){if(_0x138014){var _0x48ac76=typeof _0x17bcfe[_0xda30('0x17')]===_0xda30('0x18')&&typeof _0x17bcfe[_0xda30('0x19')]===_0xda30('0x18');var _0x4588dc=_0x138014[_0xda30('0x1a')];var _0x4d7c76=_0x48ac76?0x0:_0x17bcfe['offset'];var _0x412498=_0x48ac76?_0x138014['count']:_0x17bcfe[_0xda30('0x17')]+_0x17bcfe[_0xda30('0x19')];var _0x57dfa4;if(_0x412498>=_0x4588dc){_0x412498=_0x4588dc;_0x57dfa4=0xc8;}else{_0x57dfa4=0xce;}_0x54f529['status'](_0x57dfa4);return _0x54f529['set'](_0xda30('0x1b'),_0x4d7c76+'-'+_0x412498+'/'+_0x4588dc)[_0xda30('0x1c')](_0x138014);}return null;};}function patchUpdates(_0x478c06){return function(_0x3cd6b7){try{jsonpatch['apply'](_0x3cd6b7,_0x478c06,!![]);}catch(_0x13af8a){return BPromise['reject'](_0x13af8a);}return _0x3cd6b7[_0xda30('0x1d')]();};}function saveUpdates(_0x3c7bb7,_0x4f1c52){return function(_0x2e8156){if(_0x2e8156){return _0x2e8156[_0xda30('0x1e')](_0x3c7bb7)[_0xda30('0x1f')](function(_0x2123cf){return _0x2123cf;});}return null;};}function removeEntity(_0x376e02,_0x541fd1){return function(_0xef77c8){if(_0xef77c8){return _0xef77c8[_0xda30('0x20')]()[_0xda30('0x1f')](function(){_0x376e02[_0xda30('0x16')](0xcc)[_0xda30('0x21')]();});}};}function handleEntityNotFound(_0x133312,_0x4d0daa){return function(_0x590162){if(!_0x590162){_0x133312[_0xda30('0x15')](0x194);}return _0x590162;};}function handleError(_0xb3e7f1,_0x1f84ab){_0x1f84ab=_0x1f84ab||0x1f4;return function(_0x40203f){logger['error'](_0x40203f[_0xda30('0x22')]);if(_0x40203f[_0xda30('0x23')]){delete _0x40203f[_0xda30('0x23')];}_0xb3e7f1[_0xda30('0x16')](_0x1f84ab)[_0xda30('0x24')](_0x40203f);};}exports['index']=function(_0x330fe5,_0x2d6bb2){var _0x3427a7={},_0x26c6c4={},_0x13155b={'count':0x0,'rows':[]};var _0x2a0abd=_['map'](db[_0xda30('0x25')]['rawAttributes'],function(_0x53fd33){return{'name':_0x53fd33['fieldName'],'type':_0x53fd33[_0xda30('0x26')]['key']};});_0x26c6c4[_0xda30('0x27')]=_[_0xda30('0x28')](_0x2a0abd,_0xda30('0x23'));_0x26c6c4[_0xda30('0x29')]=_[_0xda30('0x2a')](_0x330fe5[_0xda30('0x29')]);_0x26c6c4[_0xda30('0x2b')]=_[_0xda30('0x2c')](_0x26c6c4[_0xda30('0x27')],_0x26c6c4[_0xda30('0x29')]);_0x3427a7[_0xda30('0x2d')]=_['intersection'](_0x26c6c4[_0xda30('0x27')],qs['fields'](_0x330fe5['query'][_0xda30('0x2e')]));_0x3427a7[_0xda30('0x2d')]=_0x3427a7['attributes']['length']?_0x3427a7[_0xda30('0x2d')]:_0x26c6c4['model'];if(!_0x330fe5['query'][_0xda30('0x2f')](_0xda30('0x30'))){_0x3427a7[_0xda30('0x19')]=qs['limit'](_0x330fe5[_0xda30('0x29')][_0xda30('0x19')]);_0x3427a7[_0xda30('0x17')]=qs[_0xda30('0x17')](_0x330fe5[_0xda30('0x29')][_0xda30('0x17')]);}_0x3427a7[_0xda30('0x31')]=qs[_0xda30('0x32')](_0x330fe5['query'][_0xda30('0x32')]);_0x3427a7[_0xda30('0x33')]=qs['filters'](_[_0xda30('0x34')](_0x330fe5[_0xda30('0x29')],_0x26c6c4[_0xda30('0x2b')]),_0x2a0abd);if(_0x330fe5[_0xda30('0x29')]['filter']){_0x3427a7['where']=_['merge'](_0x3427a7[_0xda30('0x33')],{'$or':_[_0xda30('0x28')](_0x2a0abd,function(_0x2fd9d8){if(_0x2fd9d8['type']!==_0xda30('0x35')){var _0x5fad59={};_0x5fad59[_0x2fd9d8['name']]={'$like':'%'+_0x330fe5['query'][_0xda30('0x36')]+'%'};return _0x5fad59;}})});}_0x3427a7=_[_0xda30('0x37')]({},_0x3427a7,_0x330fe5[_0xda30('0x38')]);var _0x1683ae={'where':_0x3427a7['where']};return db[_0xda30('0x25')]['count'](_0x1683ae)[_0xda30('0x1f')](function(_0x453586){_0x13155b[_0xda30('0x1a')]=_0x453586;if(_0x330fe5['query'][_0xda30('0x39')]){_0x3427a7[_0xda30('0x3a')]=[{'all':!![]}];}return db[_0xda30('0x25')][_0xda30('0x3b')](_0x3427a7);})['then'](function(_0x40e078){_0x13155b[_0xda30('0x3c')]=_0x40e078;return _0x13155b;})[_0xda30('0x1f')](respondWithFilteredResult(_0x2d6bb2,_0x3427a7))[_0xda30('0x3d')](handleError(_0x2d6bb2,null));};exports[_0xda30('0x3e')]=function(_0x518def,_0x39a330){var _0x451354={'raw':!![],'where':{'id':_0x518def[_0xda30('0x3f')]['id']}},_0x21c486={};_0x21c486['model']=_['keys'](db['SmsApplication']['rawAttributes']);_0x21c486[_0xda30('0x29')]=_[_0xda30('0x2a')](_0x518def[_0xda30('0x29')]);_0x21c486[_0xda30('0x2b')]=_[_0xda30('0x2c')](_0x21c486[_0xda30('0x27')],_0x21c486[_0xda30('0x29')]);_0x451354['attributes']=_[_0xda30('0x2c')](_0x21c486[_0xda30('0x27')],qs[_0xda30('0x2e')](_0x518def[_0xda30('0x29')]['fields']));_0x451354['attributes']=_0x451354[_0xda30('0x2d')][_0xda30('0x40')]?_0x451354['attributes']:_0x21c486[_0xda30('0x27')];if(_0x518def[_0xda30('0x29')][_0xda30('0x39')]){_0x451354[_0xda30('0x3a')]=[{'all':!![]}];}_0x451354=_['merge']({},_0x451354,_0x518def[_0xda30('0x38')]);return db['SmsApplication'][_0xda30('0x41')](_0x451354)[_0xda30('0x1f')](handleEntityNotFound(_0x39a330,null))[_0xda30('0x1f')](respondWithResult(_0x39a330,null))[_0xda30('0x3d')](handleError(_0x39a330,null));};exports[_0xda30('0x42')]=function(_0x4b4948,_0xce0fe0){return db[_0xda30('0x25')][_0xda30('0x42')](_0x4b4948[_0xda30('0x43')],{})[_0xda30('0x1f')](respondWithResult(_0xce0fe0,0xc9))['catch'](handleError(_0xce0fe0,null));};exports[_0xda30('0x1e')]=function(_0x2d1903,_0x2e253f){if(_0x2d1903[_0xda30('0x43')]['id']){delete _0x2d1903['body']['id'];}return db[_0xda30('0x25')][_0xda30('0x41')]({'where':{'id':_0x2d1903[_0xda30('0x3f')]['id']}})[_0xda30('0x1f')](handleEntityNotFound(_0x2e253f,null))[_0xda30('0x1f')](saveUpdates(_0x2d1903[_0xda30('0x43')],null))['then'](respondWithResult(_0x2e253f,null))[_0xda30('0x3d')](handleError(_0x2e253f,null));};exports['destroy']=function(_0x4778e7,_0x5d2753){return db[_0xda30('0x25')]['find']({'where':{'id':_0x4778e7[_0xda30('0x3f')]['id']}})[_0xda30('0x1f')](handleEntityNotFound(_0x5d2753,null))[_0xda30('0x1f')](removeEntity(_0x5d2753,null))[_0xda30('0x3d')](handleError(_0x5d2753,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 1a365ed..e71bd4b 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 _0xc49f=['exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','bluebird','path','rimraf','../../config/environment','./smsApplication.attributes'];(function(_0x3ff610,_0xac27db){var _0x358846=function(_0x2cf1f3){while(--_0x2cf1f3){_0x3ff610['push'](_0x3ff610['shift']());}};_0x358846(++_0xac27db);}(_0xc49f,0x1c0));var _0xfc49=function(_0x54ae6e,_0x60ad30){_0x54ae6e=_0x54ae6e-0x0;var _0x2d3c06=_0xc49f[_0x54ae6e];return _0x2d3c06;};'use strict';var _=require(_0xfc49('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfc49('0x1'));var moment=require('moment');var BPromise=require(_0xfc49('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfc49('0x3'));var rimraf=require(_0xfc49('0x4'));var config=require(_0xfc49('0x5'));var attributes=require(_0xfc49('0x6'));module[_0xfc49('0x7')]=function(_0xbeceb4,_0x311442){return _0xbeceb4[_0xfc49('0x8')](_0xfc49('0x9'),attributes,{'tableName':_0xfc49('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfc49('0xb'),'collate':_0xfc49('0xc')});}; \ No newline at end of file +var _0x1d80=['../../config/environment','exports','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash','util','bluebird','path','rimraf'];(function(_0x39299e,_0x115c31){var _0x5438d5=function(_0x89b8be){while(--_0x89b8be){_0x39299e['push'](_0x39299e['shift']());}};_0x5438d5(++_0x115c31);}(_0x1d80,0xaf));var _0x01d8=function(_0x3c87a2,_0x102154){_0x3c87a2=_0x3c87a2-0x0;var _0xeb0a53=_0x1d80[_0x3c87a2];return _0xeb0a53;};'use strict';var _=require(_0x01d8('0x0'));var util=require(_0x01d8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x01d8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x01d8('0x3'));var rimraf=require(_0x01d8('0x4'));var config=require(_0x01d8('0x5'));var attributes=require('./smsApplication.attributes');module[_0x01d8('0x6')]=function(_0x356ab1,_0x425da1){return _0x356ab1['define'](_0x01d8('0x7'),attributes,{'tableName':_0x01d8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x01d8('0x9')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 7f8ab94..316d841 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 _0x689b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','lodash','moment'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x689b,0x142));var _0xb689=function(_0x10ea44,_0x4a1b7d){_0x10ea44=_0x10ea44-0x0;var _0x23e1a7=_0x689b[_0x10ea44];return _0x23e1a7;};'use strict';var _=require(_0xb689('0x0'));var util=require('util');var moment=require(_0xb689('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb689('0x2'));var db=require(_0xb689('0x3'))['db'];var utils=require(_0xb689('0x4'));var logger=require(_0xb689('0x5'))(_0xb689('0x6'));var config=require(_0xb689('0x7'));var jayson=require(_0xb689('0x8'));var client=jayson['client'][_0xb689('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ee263,_0x47752c,_0x56c6ba){return new BPromise(function(_0x6eaf58,_0x1cad3e){return client[_0xb689('0xa')](_0x5ee263,_0x56c6ba)['then'](function(_0x14ef33){logger['info']('SmsApplication,\x20%s,\x20%s',_0x47752c,_0xb689('0xb'));logger['debug'](_0xb689('0xc'),_0x47752c,'request\x20sent',JSON[_0xb689('0xd')](_0x14ef33));if(_0x14ef33[_0xb689('0xe')]){if(_0x14ef33[_0xb689('0xe')][_0xb689('0xf')]===0x1f4){logger[_0xb689('0xe')](_0xb689('0x10'),_0x47752c,_0x14ef33[_0xb689('0xe')][_0xb689('0x11')]);return _0x1cad3e(_0x14ef33[_0xb689('0xe')]['message']);}logger[_0xb689('0xe')](_0xb689('0x10'),_0x47752c,_0x14ef33[_0xb689('0xe')][_0xb689('0x11')]);return _0x6eaf58(_0x14ef33[_0xb689('0xe')][_0xb689('0x11')]);}else{logger['info'](_0xb689('0x10'),_0x47752c,_0xb689('0xb'));_0x6eaf58(_0x14ef33['result'][_0xb689('0x11')]);}})['catch'](function(_0xf950eb){logger['error']('SmsApplication,\x20%s,\x20%s',_0x47752c,_0xf950eb);_0x1cad3e(_0xf950eb);});});} \ No newline at end of file +var _0xf682=['SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info'];(function(_0x4a0f13,_0x1bf229){var _0x145949=function(_0x28c0f5){while(--_0x28c0f5){_0x4a0f13['push'](_0x4a0f13['shift']());}};_0x145949(++_0x1bf229);}(_0xf682,0x12f));var _0x2f68=function(_0x3b4eff,_0x3dc69e){_0x3b4eff=_0x3b4eff-0x0;var _0x27cb26=_0xf682[_0x3b4eff];return _0x27cb26;};'use strict';var _=require(_0x2f68('0x0'));var util=require(_0x2f68('0x1'));var moment=require(_0x2f68('0x2'));var BPromise=require(_0x2f68('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f68('0x4'))['db'];var utils=require(_0x2f68('0x5'));var logger=require(_0x2f68('0x6'))(_0x2f68('0x7'));var config=require('../../config/environment');var jayson=require(_0x2f68('0x8'));var client=jayson[_0x2f68('0x9')][_0x2f68('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c4e31,_0x48624e,_0x2523dc){return new BPromise(function(_0x3a4dad,_0x56d93c){return client['request'](_0x3c4e31,_0x2523dc)['then'](function(_0x57a6b0){logger[_0x2f68('0xb')](_0x2f68('0xc'),_0x48624e,_0x2f68('0xd'));logger[_0x2f68('0xe')](_0x2f68('0xf'),_0x48624e,_0x2f68('0xd'),JSON[_0x2f68('0x10')](_0x57a6b0));if(_0x57a6b0[_0x2f68('0x11')]){if(_0x57a6b0[_0x2f68('0x11')][_0x2f68('0x12')]===0x1f4){logger[_0x2f68('0x11')](_0x2f68('0xc'),_0x48624e,_0x57a6b0[_0x2f68('0x11')][_0x2f68('0x13')]);return _0x56d93c(_0x57a6b0[_0x2f68('0x11')][_0x2f68('0x13')]);}logger['error'](_0x2f68('0xc'),_0x48624e,_0x57a6b0[_0x2f68('0x11')][_0x2f68('0x13')]);return _0x3a4dad(_0x57a6b0[_0x2f68('0x11')][_0x2f68('0x13')]);}else{logger[_0x2f68('0xb')](_0x2f68('0xc'),_0x48624e,_0x2f68('0xd'));_0x3a4dad(_0x57a6b0['result'][_0x2f68('0x13')]);}})[_0x2f68('0x14')](function(_0xc2b460){logger['error'](_0x2f68('0xc'),_0x48624e,_0xc2b460);_0x56d93c(_0xc2b460);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 839b7d6..034e3a4 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 _0x4483=['isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','sms','addTags','put','/:id','smsinteraction:update','update','delete','smsinteraction:destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4483,0x1a3));var _0x3448=function(_0x2fc1ee,_0x587c2d){_0x2fc1ee=_0x2fc1ee-0x0;var _0x1457f5=_0x4483[_0x2fc1ee];return _0x1457f5;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var fs_extra=require(_0x3448('0x5'));var auth=require(_0x3448('0x6'));var interaction=require(_0x3448('0x7'));var config=require('../../config/environment');var controller=require(_0x3448('0x8'));router[_0x3448('0x9')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0x9')](_0x3448('0xc'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['get']('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);router[_0x3448('0x9')](_0x3448('0xf'),auth[_0x3448('0xa')](),controller[_0x3448('0x10')]);router[_0x3448('0x9')](_0x3448('0x11'),auth[_0x3448('0xa')](),controller[_0x3448('0x12')]);router[_0x3448('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3448('0x13')](_0x3448('0xf'),auth['isAuthenticated'](),controller[_0x3448('0x14')]);router[_0x3448('0x13')](_0x3448('0x15'),auth['isAuthenticated'](),interaction[_0x3448('0x16')](_0x3448('0x17'),'smsinteraction:addtags'),controller[_0x3448('0x18')]);router[_0x3448('0x19')](_0x3448('0x1a'),auth['isAuthenticated'](),interaction[_0x3448('0x16')](_0x3448('0x17'),_0x3448('0x1b')),controller[_0x3448('0x1c')]);router[_0x3448('0x1d')](_0x3448('0x1a'),auth[_0x3448('0xa')](),interaction[_0x3448('0x16')]('sms',_0x3448('0x1e')),controller['destroy']);router['delete']('/:id/tags',auth[_0x3448('0xa')](),controller[_0x3448('0x1f')]);module[_0x3448('0x20')]=router; \ No newline at end of file +var _0x9354=['/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x35f89,_0x2c004f){var _0x2ab980=function(_0x8f3809){while(--_0x8f3809){_0x35f89['push'](_0x35f89['shift']());}};_0x2ab980(++_0x2c004f);}(_0x9354,0x96));var _0x4935=function(_0x22a8c4,_0x51c09a){_0x22a8c4=_0x22a8c4-0x0;var _0x104c6d=_0x9354[_0x22a8c4];return _0x104c6d;};'use strict';var multer=require('multer');var util=require(_0x4935('0x0'));var path=require(_0x4935('0x1'));var timeout=require('connect-timeout');var express=require(_0x4935('0x2'));var router=express[_0x4935('0x3')]();var fs_extra=require(_0x4935('0x4'));var auth=require(_0x4935('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4935('0x6'));var controller=require(_0x4935('0x7'));router[_0x4935('0x8')]('/',auth[_0x4935('0x9')](),controller[_0x4935('0xa')]);router[_0x4935('0x8')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xc')]);router['get'](_0x4935('0xd'),auth['isAuthenticated'](),controller[_0x4935('0xe')]);router[_0x4935('0x8')](_0x4935('0xf'),auth[_0x4935('0x9')](),controller[_0x4935('0x10')]);router[_0x4935('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x4935('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4935('0x12')]);router[_0x4935('0x13')](_0x4935('0xf'),auth[_0x4935('0x9')](),controller[_0x4935('0x14')]);router[_0x4935('0x13')](_0x4935('0x15'),auth[_0x4935('0x9')](),interaction[_0x4935('0x16')](_0x4935('0x17'),_0x4935('0x18')),controller[_0x4935('0x19')]);router[_0x4935('0x1a')](_0x4935('0xd'),auth[_0x4935('0x9')](),interaction[_0x4935('0x16')]('sms',_0x4935('0x1b')),controller[_0x4935('0x1c')]);router[_0x4935('0x1d')](_0x4935('0xd'),auth[_0x4935('0x9')](),interaction[_0x4935('0x16')]('sms',_0x4935('0x1e')),controller[_0x4935('0x1f')]);router['delete'](_0x4935('0x15'),auth[_0x4935('0x9')](),controller[_0x4935('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 9632ce4..8013047 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 _0x9c48=['BOOLEAN','sequelize','moment','exports','DATE','STRING','out','ENUM'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x9c48,0xa1));var _0x89c4=function(_0x1e92e9,_0x11311e){_0x1e92e9=_0x1e92e9-0x0;var _0x38ca20=_0x9c48[_0x1e92e9];return _0x38ca20;};'use strict';var Sequelize=require(_0x89c4('0x0'));var moment=require(_0x89c4('0x1'));module[_0x89c4('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x89c4('0x3')]},'disposition':{'type':Sequelize[_0x89c4('0x4')]},'secondDisposition':{'type':Sequelize[_0x89c4('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x89c4('0x4')]},'read1stAt':{'type':Sequelize[_0x89c4('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x89c4('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x89c4('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x89c4('0x6')]('in',_0x89c4('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x89c4('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x0f9f=['moment','exports','BOOLEAN','DATE','STRING','out','sequelize'];(function(_0x481f54,_0x3d47d9){var _0x288091=function(_0x53dab5){while(--_0x53dab5){_0x481f54['push'](_0x481f54['shift']());}};_0x288091(++_0x3d47d9);}(_0x0f9f,0xae));var _0xf0f9=function(_0x5464ab,_0x329d11){_0x5464ab=_0x5464ab-0x0;var _0x15432c=_0x0f9f[_0x5464ab];return _0x15432c;};'use strict';var Sequelize=require(_0xf0f9('0x0'));var moment=require(_0xf0f9('0x1'));module[_0xf0f9('0x2')]={'closed':{'type':Sequelize[_0xf0f9('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf0f9('0x4')]},'disposition':{'type':Sequelize[_0xf0f9('0x5')]},'secondDisposition':{'type':Sequelize[_0xf0f9('0x5')]},'thirdDisposition':{'type':Sequelize[_0xf0f9('0x5')]},'note':{'type':Sequelize[_0xf0f9('0x5')]},'phone':{'type':Sequelize[_0xf0f9('0x5')]},'read1stAt':{'type':Sequelize[_0xf0f9('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xf0f9('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf0f9('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xf0f9('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xf0f9('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index d23a5ba..050254a 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 _0x3eae=['filter','isNumeric','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','isEmpty','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','a.key','Account.key','i.*','c.firstName','c.lastName','Contact.lastName','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','catch','show','params','keys','rawAttributes','include','create','describe','SmsMessage','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','setTags','findAll','color','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','User','CmContact','lastName','direction','secret','SmsAccount','Account','Owner','get','mkdirSync','Sms','closed','disposition','Messages','out','System','firstName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','sendStatus','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','status','end','json','offset','undefined','limit','count','reject','update','destroy','then','error','name','send','Users','map','fullname','Tags','TagIds','split','forEach','push','index','SmsInteraction','fieldName','type','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','pick','select','field','from','tools_tags','u.fullname','ui.SmsInteractionId','left_join','u.id\x20=\x20ui.UserId','cm_contacts','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3eae,0x66));var _0xe3ea=function(_0x30abff,_0x5f2c5f){_0x30abff=_0x30abff-0x0;var _0x4c571e=_0x3eae[_0x30abff];return _0x4c571e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe3ea('0x0'));var jsonpatch=require(_0xe3ea('0x1'));var rp=require('request-promise');var moment=require(_0xe3ea('0x2'));var BPromise=require(_0xe3ea('0x3'));var Mustache=require(_0xe3ea('0x4'));var util=require('util');var path=require('path');var sox=require(_0xe3ea('0x5'));var csv=require(_0xe3ea('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe3ea('0x7'));var _=require(_0xe3ea('0x8'));var squel=require('squel');var crypto=require(_0xe3ea('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe3ea('0xa'));var toCsv=require(_0xe3ea('0x6'));var querystring=require(_0xe3ea('0xb'));var Papa=require('papaparse');var Redis=require(_0xe3ea('0xc'));var authService=require(_0xe3ea('0xd'));var qs=require(_0xe3ea('0xe'));var as=require(_0xe3ea('0xf'));var pdf=require(_0xe3ea('0x10'));var hardwareService=require(_0xe3ea('0x11'));var logger=require(_0xe3ea('0x12'))(_0xe3ea('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe3ea('0x14'));var db=require(_0xe3ea('0x15'))['db'];config[_0xe3ea('0x16')]=_[_0xe3ea('0x17')](config[_0xe3ea('0x16')],{'host':_0xe3ea('0x18'),'port':0x18eb});var socket=require(_0xe3ea('0x19'))(new Redis(config[_0xe3ea('0x16')]));require(_0xe3ea('0x1a'))[_0xe3ea('0x1b')](socket);function respondWithStatusCode(_0x2bc281,_0x694842){_0x694842=_0x694842||0xcc;return function(_0x445775){if(_0x445775){return _0x2bc281['sendStatus'](_0x694842);}return _0x2bc281[_0xe3ea('0x1c')](_0x694842)[_0xe3ea('0x1d')]();};}function respondWithResult(_0x1d686c,_0x6f5ab2){_0x6f5ab2=_0x6f5ab2||0xc8;return function(_0x3d12be){if(_0x3d12be){return _0x1d686c[_0xe3ea('0x1c')](_0x6f5ab2)[_0xe3ea('0x1e')](_0x3d12be);}};}function respondWithFilteredResult(_0xf0f21e,_0x33f6f8){return function(_0x374cdb){if(_0x374cdb){var _0x3575be=typeof _0x33f6f8[_0xe3ea('0x1f')]===_0xe3ea('0x20')&&typeof _0x33f6f8[_0xe3ea('0x21')]===_0xe3ea('0x20');var _0x280adb=_0x374cdb[_0xe3ea('0x22')];var _0xa367ed=_0x3575be?0x0:_0x33f6f8[_0xe3ea('0x1f')];var _0x29e32e=_0x3575be?_0x374cdb[_0xe3ea('0x22')]:_0x33f6f8[_0xe3ea('0x1f')]+_0x33f6f8[_0xe3ea('0x21')];var _0x248e2a;if(_0x29e32e>=_0x280adb){_0x29e32e=_0x280adb;_0x248e2a=0xc8;}else{_0x248e2a=0xce;}_0xf0f21e[_0xe3ea('0x1c')](_0x248e2a);return _0xf0f21e['set']('Content-Range',_0xa367ed+'-'+_0x29e32e+'/'+_0x280adb)['json'](_0x374cdb);}return null;};}function patchUpdates(_0x4132fe){return function(_0x5b808e){try{jsonpatch['apply'](_0x5b808e,_0x4132fe,!![]);}catch(_0x350d8e){return BPromise[_0xe3ea('0x23')](_0x350d8e);}return _0x5b808e['save']();};}function saveUpdates(_0x3766eb,_0x44cafc){return function(_0x594ba1){if(_0x594ba1){return _0x594ba1[_0xe3ea('0x24')](_0x3766eb)['then'](function(_0x4e9ed1){return _0x4e9ed1;});}return null;};}function removeEntity(_0x3255ad,_0x99e84a){return function(_0x577e56){if(_0x577e56){return _0x577e56[_0xe3ea('0x25')]()[_0xe3ea('0x26')](function(){_0x3255ad['status'](0xcc)[_0xe3ea('0x1d')]();});}};}function handleEntityNotFound(_0x5518d3,_0x5bd356){return function(_0x58e3ff){if(!_0x58e3ff){_0x5518d3['sendStatus'](0x194);}return _0x58e3ff;};}function handleError(_0x3accb1,_0x3e7c9f){_0x3e7c9f=_0x3e7c9f||0x1f4;return function(_0x42d889){logger[_0xe3ea('0x27')](_0x42d889['stack']);if(_0x42d889['name']){delete _0x42d889[_0xe3ea('0x28')];}_0x3accb1['status'](_0x3e7c9f)[_0xe3ea('0x29')](_0x42d889);};}function getInteractionUsers(_0x2b1c07,_0x73a56e){return new BPromise(function(_0x51bdd4,_0x5c8a68){try{if(_0x73a56e[_0x2b1c07['id']]){_0x2b1c07[_0xe3ea('0x2a')]=_[_0xe3ea('0x2b')](_0x73a56e[_0x2b1c07['id']],function(_0x5d8150){return{'id':_0x5d8150['id'],'fullname':_0x5d8150[_0xe3ea('0x2c')]};});}}catch(_0x11e012){_0x5c8a68(_0x11e012);}_0x51bdd4(_0x2b1c07);});}function getInteractionTags(_0x3ee500,_0x482376){return new BPromise(function(_0x2aa2b9,_0x6e44a5){try{if(_0x3ee500['TagIds']){_0x3ee500[_0xe3ea('0x2d')]=[];_0x3ee500[_0xe3ea('0x2e')][_0xe3ea('0x2f')](',')[_0xe3ea('0x30')](function(_0x21db7d){_0x3ee500[_0xe3ea('0x2d')][_0xe3ea('0x31')](_0x482376[_0x21db7d]);});}delete _0x3ee500[_0xe3ea('0x2e')];}catch(_0x3f3ab5){_0x6e44a5(_0x3f3ab5);}_0x2aa2b9(_0x3ee500);});}function updateSmsInteraction(_0x505208,_0x59d18f,_0x20d375){return new BPromise(function(_0x272944,_0x237ed9){return getInteractionUsers(_0x505208,_0x20d375)[_0xe3ea('0x26')](function(_0x327168){return getInteractionTags(_0x327168,_0x59d18f);})[_0xe3ea('0x26')](function(_0x588595){_0x272944(_0x588595);})['catch'](function(_0x3568fa){_0x237ed9(_0x3568fa);});});}exports[_0xe3ea('0x32')]=function(_0x30dc8d,_0x17a278){var _0x18a547={},_0x15e4a0={},_0x133467={'count':0x0,'rows':[]};var _0x168a72=_[_0xe3ea('0x2b')](db[_0xe3ea('0x33')]['rawAttributes'],function(_0xbfc31b){return{'name':_0xbfc31b[_0xe3ea('0x34')],'type':_0xbfc31b[_0xe3ea('0x35')]['key']};});_0x15e4a0['model']=_['map'](_0x168a72,_0xe3ea('0x28'));_0x15e4a0[_0xe3ea('0x36')]=_['keys'](_0x30dc8d[_0xe3ea('0x36')]);_0x15e4a0[_0xe3ea('0x37')]=_[_0xe3ea('0x38')](_0x15e4a0['model'],_0x15e4a0[_0xe3ea('0x36')]);_0x18a547[_0xe3ea('0x39')]=_[_0xe3ea('0x38')](_0x15e4a0[_0xe3ea('0x3a')],qs['fields'](_0x30dc8d[_0xe3ea('0x36')][_0xe3ea('0x3b')]));_0x18a547[_0xe3ea('0x39')]=_0x18a547['attributes'][_0xe3ea('0x3c')]?_0x18a547[_0xe3ea('0x39')]:_0x15e4a0[_0xe3ea('0x3a')];if(!_0x30dc8d[_0xe3ea('0x36')][_0xe3ea('0x3d')](_0xe3ea('0x3e'))){_0x18a547['limit']=qs[_0xe3ea('0x21')](_0x30dc8d['query'][_0xe3ea('0x21')]);_0x18a547[_0xe3ea('0x1f')]=qs[_0xe3ea('0x1f')](_0x30dc8d['query'][_0xe3ea('0x1f')]);}_0x18a547['order']=qs[_0xe3ea('0x3f')](_0x30dc8d[_0xe3ea('0x36')][_0xe3ea('0x3f')]);_0x18a547['where']=qs['filters'](_[_0xe3ea('0x40')](_0x30dc8d['query'],_0x15e4a0[_0xe3ea('0x37')]),_0x168a72);var _0x50a9ca=[];var _0xea2469=squel[_0xe3ea('0x41')]()[_0xe3ea('0x42')]('id')[_0xe3ea('0x42')](_0xe3ea('0x28'))[_0xe3ea('0x42')]('color')[_0xe3ea('0x43')](_0xe3ea('0x44'));var _0x3620d4=squel[_0xe3ea('0x41')]()[_0xe3ea('0x42')]('u.id')[_0xe3ea('0x42')](_0xe3ea('0x45'))[_0xe3ea('0x42')](_0xe3ea('0x46'))[_0xe3ea('0x43')]('user_has_sms_interactions','ui')[_0xe3ea('0x47')]('users','u',_0xe3ea('0x48'));var _0x5c8ed6=squel[_0xe3ea('0x41')]()[_0xe3ea('0x43')]('sms_interactions','i')['left_join'](_0xe3ea('0x49'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0xe3ea('0x4a'))[_0xe3ea('0x47')](_0xe3ea('0x4b'),'a','a.id\x20=\x20i.SmsAccountId')[_0xe3ea('0x47')](_0xe3ea('0x4c'),'me',_0xe3ea('0x4d'))['left_join'](_0xe3ea('0x4e'),'it','it.SmsInteractionId\x20=\x20i.id')[_0xe3ea('0x47')](_0xe3ea('0x44'),'t',_0xe3ea('0x4f'));var _0x46d58a=squel['expr']();var _0xad99a5=[];var _0x31d0ce=squel[_0xe3ea('0x50')]();var _0x141a9d;if(_0x30dc8d['query'][_0xe3ea('0x51')]){_0x141a9d=as[_0xe3ea('0x52')](_0x30dc8d[_0xe3ea('0x36')][_0xe3ea('0x51')]);var _0x26e1a3=_0x141a9d['sqlOperator'];for(var _0x29c051=0x0;_0x29c051<_0x141a9d[_0xe3ea('0x53')][_0xe3ea('0x3c')];_0x29c051++){var _0x50806f=_0x141a9d['conditions'][_0x29c051];var _0x1221b5='i';var _0x521838=_[_0xe3ea('0x54')](_0x168a72,['name',_0x50806f['field']]);if(!_0x521838){switch(_0x50806f[_0xe3ea('0x42')]){case _0xe3ea('0x55'):if(_0x50806f['value']==0x1){_0x5c8ed6[_0xe3ea('0x56')]('`'+_0x50806f[_0xe3ea('0x42')]+_0xe3ea('0x57'));}else{_0x5c8ed6[_0xe3ea('0x56')]('`'+_0x50806f[_0xe3ea('0x42')]+_0xe3ea('0x58'));}break;case _0xe3ea('0x59'):if(_0x50806f[_0xe3ea('0x5a')]===_0xe3ea('0x5b')){if(_0x50806f[_0xe3ea('0x5c')][_0xe3ea('0x2f')]('\x20')[_0xe3ea('0x3c')]>0x1){_0x46d58a[_0x26e1a3](_0xe3ea('0x5d'),qs[_0xe3ea('0x5e')](_0x50806f[_0xe3ea('0x5c')]),null);}else{var _0x68028d='%'+_0x50806f[_0xe3ea('0x5c')]+'%';_0x46d58a[_0x26e1a3](_0xe3ea('0x5f'),_0x68028d,_0x68028d,_0x68028d);}}else{_0x521838=_['find'](_0x168a72,[_0xe3ea('0x28'),'ContactId']);_0x50806f[_0xe3ea('0x42')]=_0xe3ea('0x60');_0x2dad0c=as[_0xe3ea('0x61')](_0x1221b5,_0x521838[_0xe3ea('0x35')],_0x50806f);_0x46d58a[_0x26e1a3](_0x2dad0c[_0xe3ea('0x62')],_0x2dad0c['value'][_0xe3ea('0x63')],_0x2dad0c[_0xe3ea('0x5c')][_0xe3ea('0x1d')]);}break;case _0xe3ea('0x64'):var _0x52a381=_0x50806f[_0xe3ea('0x5c')]['split'](',')[_0xe3ea('0x2b')](function(_0x5948ee){return Number(_0x5948ee);});_0x52a381['forEach'](function(_0xffbfa3){_0x31d0ce['or'](_0xe3ea('0x65'),'%,'+_0xffbfa3+',%');});_0xad99a5=_[_0xe3ea('0x66')](_0xad99a5,_0x52a381);break;case'User':if(_0x50806f[_0xe3ea('0x5a')]===_0xe3ea('0x5b')){_0x46d58a[_0x26e1a3](_0xe3ea('0x67'),'%'+_0x50806f[_0xe3ea('0x5c')]+'%',null);}else{_0x521838=_['find'](_0x168a72,[_0xe3ea('0x28'),_0xe3ea('0x68')]);_0x50806f['field']='UserId';_0x2dad0c=as[_0xe3ea('0x61')](_0x1221b5,_0x521838[_0xe3ea('0x35')],_0x50806f);_0x46d58a[_0x26e1a3](_0x2dad0c[_0xe3ea('0x62')],_0x2dad0c[_0xe3ea('0x5c')][_0xe3ea('0x63')],_0x2dad0c[_0xe3ea('0x5c')][_0xe3ea('0x1d')]);}break;case _0xe3ea('0x69'):_0x2dad0c=as[_0xe3ea('0x61')]('me',null,_0x50806f);_0x46d58a[_0x26e1a3](_0x2dad0c[_0xe3ea('0x62')],_0x2dad0c[_0xe3ea('0x5c')][_0xe3ea('0x63')],_0x2dad0c[_0xe3ea('0x5c')]['end']);break;}}else{var _0x2dad0c=as[_0xe3ea('0x61')](_0x1221b5,_0x521838[_0xe3ea('0x35')],_0x50806f);_0x46d58a[_0x26e1a3](_0x2dad0c['text'],_0x2dad0c['value']['start'],_0x2dad0c[_0xe3ea('0x5c')]['end']);}}}else{var _0xa6eec=_(_0x30dc8d[_0xe3ea('0x36')])['keys']()[_0xe3ea('0x2b')](function(_0x4f52f8){return _[_0xe3ea('0x6a')](_0x168a72,['name',_0x4f52f8])?_0x4f52f8:undefined;})[_0xe3ea('0x6b')]()['value']();if(!_['isEmpty'](_0xa6eec)){_0xa6eec[_0xe3ea('0x30')](function(_0x1c4c8f){if(_0x1c4c8f===_0xe3ea('0x6c')){_0x5c8ed6[_0xe3ea('0x6d')](_0xe3ea('0x6e'),[][_0xe3ea('0x6f')](_0x30dc8d[_0xe3ea('0x36')][_0x1c4c8f]));}else if(_0x1c4c8f===_0xe3ea('0x70')){var _0x2765db=JSON[_0xe3ea('0x71')](_0x30dc8d[_0xe3ea('0x36')][_0x1c4c8f])[_0xe3ea('0x72')];var _0x4f0c92=JSON[_0xe3ea('0x71')](_0x30dc8d[_0xe3ea('0x36')][_0x1c4c8f])[_0xe3ea('0x73')];_0x5c8ed6[_0xe3ea('0x6d')](_0xe3ea('0x74'),_0x2765db,_0x4f0c92);}else{if(_0x30dc8d[_0xe3ea('0x36')][_0x1c4c8f]==='null'){_0x5c8ed6[_0xe3ea('0x6d')]('i.'+_0x1c4c8f+_0xe3ea('0x75'));}else{_0x5c8ed6[_0xe3ea('0x6d')]('i.'+_0x1c4c8f+'\x20=\x20?',_0x30dc8d[_0xe3ea('0x36')][_0x1c4c8f]);}}});}if(_0x30dc8d[_0xe3ea('0x36')][_0xe3ea('0x76')]){if(_0x30dc8d[_0xe3ea('0x36')][_0xe3ea('0x76')]==0x1){_0x5c8ed6[_0xe3ea('0x56')](_0xe3ea('0x77'));}else{_0x5c8ed6['having'](_0xe3ea('0x78'));}}if(_0x30dc8d[_0xe3ea('0x36')]['tag']){_0xad99a5=_[_0xe3ea('0x79')](_0x30dc8d['query'][_0xe3ea('0x7a')])?_0x30dc8d[_0xe3ea('0x36')][_0xe3ea('0x7a')]:new Array(_0x30dc8d[_0xe3ea('0x36')][_0xe3ea('0x7a')]);_0xad99a5[_0xe3ea('0x30')](function(_0x5cfef7){_0x31d0ce['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5cfef7+',%');});}if(_0x30dc8d['query'][_0xe3ea('0x7b')]){var _0x56158f=_0x30dc8d['query'][_0xe3ea('0x7b')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xe3ea('0x7c')](_0x56158f)){_0x46d58a['or']('i.id\x20LIKE\x20?',_0x56158f+'%')['or'](_0xe3ea('0x7d'),_0x56158f+'%');}else{_0x46d58a['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x56158f))['or'](_0xe3ea('0x7e'),_0x56158f+'%');}}}_0x5c8ed6[_0xe3ea('0x6d')](_0x46d58a);_0x5c8ed6[_0xe3ea('0x7f')](_0xe3ea('0x80'));var _0x51aaaf={'type':db[_0xe3ea('0x81')][_0xe3ea('0x82')]['SELECT'],'raw':!![]};var _0xc0e37d=_0x5c8ed6[_0xe3ea('0x83')]();_0xc0e37d[_0xe3ea('0x42')]('i.id');_0xc0e37d[_0xe3ea('0x42')](_0xe3ea('0x84'),_0xe3ea('0x55'));if(_0x18a547['order']){_0x18a547[_0xe3ea('0x85')][_0xe3ea('0x30')](function(_0x2c7078){var _0x17ec9=_0x2c7078[0x0]==='contactName'?_0x2c7078[0x0]:'i.'+_0x2c7078[0x0];_0x5c8ed6[_0xe3ea('0x85')](_0x17ec9,_0x2c7078[0x1]===_0xe3ea('0x86')?![]:!![]);});}if(!_[_0xe3ea('0x87')](_0xad99a5)){_0x5c8ed6[_0xe3ea('0x56')](_0x31d0ce);_0xc0e37d['where']('t.id\x20IN\x20?',_0xad99a5);}BPromise[_0xe3ea('0x88')]()[_0xe3ea('0x26')](function(){if(!_0x141a9d){if(_0x30dc8d[_0xe3ea('0x36')][_0xe3ea('0x6c')])return;_0xc0e37d[_0xe3ea('0x6d')](_0xe3ea('0x89'));_0x5c8ed6[_0xe3ea('0x6d')](_0xe3ea('0x89'));return;}if(_0x30dc8d[_0xe3ea('0x8a')][_0xe3ea('0x8b')]!=='agent')return;return _0x30dc8d['user'][_0xe3ea('0x8c')]({'attributes':['id'],'raw':!![]})['then'](function(_0x7d996f){if(_[_0xe3ea('0x87')](_0x7d996f)){_0xc0e37d[_0xe3ea('0x6d')](_0xe3ea('0x8d'));_0x5c8ed6[_0xe3ea('0x6d')](_0xe3ea('0x8d'));}else{_0xc0e37d[_0xe3ea('0x6d')](_0xe3ea('0x6e'),_[_0xe3ea('0x2b')](_0x7d996f,'id'));_0x5c8ed6[_0xe3ea('0x6d')](_0xe3ea('0x6e'),_[_0xe3ea('0x2b')](_0x7d996f,'id'));}});})[_0xe3ea('0x26')](function(){if(_0x30dc8d[_0xe3ea('0x8a')]['role']===_0xe3ea('0x8e')&&!_0x141a9d&&!_0x30dc8d[_0xe3ea('0x36')]['SmsAccountId'])return[];return db[_0xe3ea('0x8f')]['query'](_0xc0e37d[_0xe3ea('0x90')](),_0x51aaaf);})['then'](function(_0x49e25e){_0x133467[_0xe3ea('0x22')]=_0x49e25e[_0xe3ea('0x3c')];if(_0x133467['count']===0x0)return[];return db['sequelize'][_0xe3ea('0x36')](_0xea2469[_0xe3ea('0x90')](),_0x51aaaf)[_0xe3ea('0x26')](function(_0x513a48){_0x50a9ca=_[_0xe3ea('0x91')](_0x513a48,'id');_0x51aaaf=_[_0xe3ea('0x92')](_0x51aaaf,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x30dc8d['query'][_0xe3ea('0x3b')]){_0x18a547[_0xe3ea('0x39')][_0xe3ea('0x30')](function(_0x13f98c){_0x5c8ed6[_0xe3ea('0x42')]('i.'+_0x13f98c);});}else{_0x5c8ed6[_0xe3ea('0x42')](_0xe3ea('0x84'),_0xe3ea('0x55'));_0x5c8ed6['field'](_0xe3ea('0x93'),_0xe3ea('0x94'));_0x5c8ed6[_0xe3ea('0x42')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x5c8ed6[_0xe3ea('0x42')]('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');_0x5c8ed6[_0xe3ea('0x42')](_0xe3ea('0x95'));_0x5c8ed6[_0xe3ea('0x42')](_0xe3ea('0x96'),'Contact.firstName');_0x5c8ed6[_0xe3ea('0x42')](_0xe3ea('0x97'),_0xe3ea('0x98'));_0x5c8ed6['field']('c.email','Contact.email');_0x5c8ed6[_0xe3ea('0x42')](_0xe3ea('0x99'),_0xe3ea('0x9a'));_0x5c8ed6[_0xe3ea('0x42')](_0xe3ea('0x9b'),'Contact.mobile');_0x5c8ed6[_0xe3ea('0x42')](_0xe3ea('0x9c'),_0xe3ea('0x9d'));_0x5c8ed6[_0xe3ea('0x42')](_0xe3ea('0x9e'),_0xe3ea('0x9f'));_0x5c8ed6['field'](_0xe3ea('0xa0'),'Owner.internal');_0x5c8ed6[_0xe3ea('0x42')](_0xe3ea('0xa1'),_0xe3ea('0x2e'));}if(_0x18a547[_0xe3ea('0x21')])_0x5c8ed6[_0xe3ea('0x21')](_0x18a547[_0xe3ea('0x21')]);if(_0x18a547['offset'])_0x5c8ed6['offset'](_0x18a547[_0xe3ea('0x1f')]);return db['sequelize'][_0xe3ea('0x36')](_0x5c8ed6[_0xe3ea('0x90')](),_0x51aaaf);})[_0xe3ea('0x26')](function(_0x140209){if(_0x140209[_0xe3ea('0x3c')]>0x0)_0x3620d4['where'](_0xe3ea('0xa2'),_[_0xe3ea('0x2b')](_0x140209,'id'));return db[_0xe3ea('0x8f')][_0xe3ea('0x36')](_0x3620d4[_0xe3ea('0x90')](),_0x51aaaf)['then'](function(_0x29da93){var _0x15b989=_[_0xe3ea('0xa3')](_0x29da93,_0xe3ea('0xa4'));var _0x7b307c=[];_0x140209[_0xe3ea('0x30')](function(_0x3c036f){_0x7b307c[_0xe3ea('0x31')](updateSmsInteraction(_0x3c036f,_0x50a9ca,_0x15b989));});return BPromise[_0xe3ea('0xa5')](_0x7b307c);});});})[_0xe3ea('0x26')](function(_0x3ffb22){_0x133467[_0xe3ea('0xa6')]=_0x3ffb22;return _0x133467;})[_0xe3ea('0x26')](respondWithFilteredResult(_0x17a278,_0x18a547))[_0xe3ea('0xa7')](handleError(_0x17a278,null));};exports[_0xe3ea('0xa8')]=function(_0x35c292,_0x5659e0){var _0x2cb3c7={'raw':![],'where':{'id':_0x35c292[_0xe3ea('0xa9')]['id']}},_0x58d581={};_0x58d581['model']=_[_0xe3ea('0xaa')](db['SmsInteraction'][_0xe3ea('0xab')]);_0x58d581[_0xe3ea('0x36')]=_[_0xe3ea('0xaa')](_0x35c292[_0xe3ea('0x36')]);_0x58d581[_0xe3ea('0x37')]=_[_0xe3ea('0x38')](_0x58d581[_0xe3ea('0x3a')],_0x58d581[_0xe3ea('0x36')]);_0x2cb3c7[_0xe3ea('0x39')]=_[_0xe3ea('0x38')](_0x58d581['model'],qs[_0xe3ea('0x3b')](_0x35c292[_0xe3ea('0x36')]['fields']));_0x2cb3c7[_0xe3ea('0x39')]=_0x2cb3c7[_0xe3ea('0x39')][_0xe3ea('0x3c')]?_0x2cb3c7[_0xe3ea('0x39')]:_0x58d581['model'];if(_0x35c292[_0xe3ea('0x36')]['includeAll']){_0x2cb3c7[_0xe3ea('0xac')]=[{'all':!![]}];}_0x2cb3c7=_[_0xe3ea('0x92')]({},_0x2cb3c7,_0x35c292['options']);return db[_0xe3ea('0x33')][_0xe3ea('0x54')](_0x2cb3c7)[_0xe3ea('0x26')](handleEntityNotFound(_0x5659e0,null))[_0xe3ea('0x26')](respondWithResult(_0x5659e0,null))['catch'](handleError(_0x5659e0,null));};exports[_0xe3ea('0xad')]=function(_0x16a009,_0x374d15){return db[_0xe3ea('0x33')][_0xe3ea('0xad')](_0x16a009['body'],{})[_0xe3ea('0x26')](respondWithResult(_0x374d15,0xc9))[_0xe3ea('0xa7')](handleError(_0x374d15,null));};exports[_0xe3ea('0x24')]=function(_0x3b2a1c,_0x28fc63){if(_0x3b2a1c[_0xe3ea('0x69')]['id']){delete _0x3b2a1c[_0xe3ea('0x69')]['id'];}return db[_0xe3ea('0x33')][_0xe3ea('0x54')]({'where':{'id':_0x3b2a1c[_0xe3ea('0xa9')]['id']}})[_0xe3ea('0x26')](handleEntityNotFound(_0x28fc63,null))[_0xe3ea('0x26')](saveUpdates(_0x3b2a1c[_0xe3ea('0x69')],null))[_0xe3ea('0x26')](respondWithResult(_0x28fc63,null))[_0xe3ea('0xa7')](handleError(_0x28fc63,null));};exports[_0xe3ea('0x25')]=function(_0x5c24b0,_0x5b7902){return db[_0xe3ea('0x33')][_0xe3ea('0x54')]({'where':{'id':_0x5c24b0[_0xe3ea('0xa9')]['id']}})[_0xe3ea('0x26')](handleEntityNotFound(_0x5b7902,null))[_0xe3ea('0x26')](removeEntity(_0x5b7902,null))[_0xe3ea('0xa7')](handleError(_0x5b7902,null));};exports[_0xe3ea('0xae')]=function(_0x49aa71,_0x16919c){return db[_0xe3ea('0x33')][_0xe3ea('0xae')]()[_0xe3ea('0x26')](respondWithResult(_0x16919c,null))[_0xe3ea('0xa7')](handleError(_0x16919c,null));};exports['addMessage']=function(_0x2e6b20,_0x41bc19,_0x1ae306){return db[_0xe3ea('0xaf')]['find']({'where':{'id':_0x2e6b20[_0xe3ea('0xa9')]['id']}})['then'](handleEntityNotFound(_0x41bc19,null))[_0xe3ea('0x26')](function(_0x447634){if(_0x447634){return _0x447634['addMessage'](_0x2e6b20[_0xe3ea('0x69')][_0xe3ea('0xb0')],_[_0xe3ea('0xb1')](_0x2e6b20['body'],[_0xe3ea('0xb0'),'id'])||{});}})['then'](respondWithResult(_0x41bc19,null))[_0xe3ea('0xa7')](handleError(_0x41bc19,null));};exports[_0xe3ea('0xb2')]=function(_0x3f74da,_0x32d2cc,_0x50a434){var _0x10655b={'raw':![],'where':{}};var _0x3281a6={};var _0x489ead={'count':0x0,'rows':[]};return db[_0xe3ea('0x33')]['findOne']({'where':{'id':_0x3f74da[_0xe3ea('0xa9')]['id']}})[_0xe3ea('0x26')](handleEntityNotFound(_0x32d2cc,null))['then'](function(_0x42b465){if(_0x42b465){_0x3281a6[_0xe3ea('0x3a')]=_[_0xe3ea('0xaa')](db[_0xe3ea('0xaf')][_0xe3ea('0xab')]);_0x3281a6[_0xe3ea('0x36')]=_[_0xe3ea('0xaa')](_0x3f74da[_0xe3ea('0x36')]);_0x3281a6[_0xe3ea('0x37')]=_[_0xe3ea('0x38')](_0x3281a6[_0xe3ea('0x3a')],_0x3281a6['query']);_0x10655b[_0xe3ea('0x39')]=_['intersection'](_0x3281a6['model'],qs['fields'](_0x3f74da[_0xe3ea('0x36')][_0xe3ea('0x3b')]));_0x10655b['attributes']=_0x10655b[_0xe3ea('0x39')][_0xe3ea('0x3c')]?_0x10655b[_0xe3ea('0x39')]:_0x3281a6[_0xe3ea('0x3a')];if(!_0x3f74da[_0xe3ea('0x36')][_0xe3ea('0x3d')](_0xe3ea('0x3e'))){_0x10655b[_0xe3ea('0x21')]=qs['limit'](_0x3f74da[_0xe3ea('0x36')][_0xe3ea('0x21')]);_0x10655b[_0xe3ea('0x1f')]=qs[_0xe3ea('0x1f')](_0x3f74da[_0xe3ea('0x36')]['offset']);}_0x10655b['order']=qs['sort'](_0x3f74da[_0xe3ea('0x36')][_0xe3ea('0x3f')]);_0x10655b[_0xe3ea('0x6d')]=qs['filters'](_[_0xe3ea('0x40')](_0x3f74da[_0xe3ea('0x36')],_0x3281a6[_0xe3ea('0x37')]));_0x10655b['where'][_0xe3ea('0xa4')]=_0x42b465['id'];if(_0x3f74da['query']['filter']){_0x10655b[_0xe3ea('0x6d')]=_[_0xe3ea('0x92')](_0x10655b[_0xe3ea('0x6d')],{'$or':_[_0xe3ea('0x2b')](_0x10655b[_0xe3ea('0x39')],function(_0x448569){var _0xb8b9fe={};_0xb8b9fe[_0x448569]={'$like':'%'+_0x3f74da[_0xe3ea('0x36')]['filter']+'%'};return _0xb8b9fe;})});}if(_0x3f74da[_0xe3ea('0x36')][_0xe3ea('0x72')]){var _0x1e9eb0=_0x3f74da['query'][_0xe3ea('0x72')][_0xe3ea('0x2f')](',');var _0x190b8a={};_0x190b8a[_0x1e9eb0[0x0]]={'$gte':moment(_0x1e9eb0[0x1])[_0xe3ea('0xb3')](_0xe3ea('0xb4'))};_0x10655b['where']=_[_0xe3ea('0x92')](_0x10655b[_0xe3ea('0x6d')],_0x190b8a);}_0x10655b=_['merge']({},_0x10655b,_0x3f74da[_0xe3ea('0xb5')]);return db[_0xe3ea('0xaf')][_0xe3ea('0x22')]({'where':_0x10655b[_0xe3ea('0x6d')]})['then'](function(_0x495e86){_0x489ead[_0xe3ea('0x22')]=_0x495e86;if(_0x3f74da['query'][_0xe3ea('0xb6')]){_0x10655b[_0xe3ea('0xac')]=[{'all':!![]}];}return db[_0xe3ea('0xaf')]['findAll'](_0x10655b);})['then'](function(_0x4d38fb){_0x489ead[_0xe3ea('0xa6')]=_0x4d38fb;return _0x489ead;});}})[_0xe3ea('0x26')](respondWithFilteredResult(_0x32d2cc,_0x10655b))['catch'](handleError(_0x32d2cc,null));};exports['addTags']=function(_0x49a0b2,_0xc281b,_0x40b394){return db[_0xe3ea('0x33')][_0xe3ea('0x54')]({'where':{'id':_0x49a0b2[_0xe3ea('0xa9')]['id']}})[_0xe3ea('0x26')](handleEntityNotFound(_0xc281b,null))[_0xe3ea('0x26')](function(_0x1b233f){if(_0x1b233f){return _0x1b233f[_0xe3ea('0xb7')](_0x49a0b2[_0xe3ea('0x69')][_0xe3ea('0xb0')],_['omit'](_0x49a0b2[_0xe3ea('0x69')],['ids','id'])||{})['spread'](function(){return db[_0xe3ea('0x64')][_0xe3ea('0xb8')]({'attributes':['id','name',_0xe3ea('0xb9')],'where':{'id':_0x49a0b2[_0xe3ea('0x69')][_0xe3ea('0xb0')]}});})[_0xe3ea('0x26')](function(_0x251998){socket[_0xe3ea('0xba')](_0xe3ea('0xbb'),{'id':Number(_0x49a0b2['params']['id']),'tags':_0x251998||[]});return{'id':Number(_0x49a0b2[_0xe3ea('0xa9')]['id']),'tags':_0x251998||[]};});}})[_0xe3ea('0x26')](respondWithResult(_0xc281b,null))[_0xe3ea('0xa7')](handleError(_0xc281b,null));};exports['removeTags']=function(_0x45309f,_0x1bdd6b,_0x3f6bbd){return db[_0xe3ea('0x33')][_0xe3ea('0x54')]({'where':{'id':_0x45309f['params']['id']}})[_0xe3ea('0x26')](handleEntityNotFound(_0x1bdd6b,null))[_0xe3ea('0x26')](function(_0x213354){if(_0x213354){return _0x213354[_0xe3ea('0xbc')](_0x45309f['query']['ids']);}})[_0xe3ea('0x26')](respondWithStatusCode(_0x1bdd6b,null))[_0xe3ea('0xa7')](handleError(_0x1bdd6b,null));};exports[_0xe3ea('0xbd')]=function(_0x2e42b7,_0xada3eb){var _0x5d90a6=moment()[_0xe3ea('0xbe')]()[_0xe3ea('0x90')]();var _0x27505a=path[_0xe3ea('0xbf')](config[_0xe3ea('0xc0')],_0xe3ea('0xc1'),_0xe3ea('0xc2'),_0xe3ea('0xc3'));var _0x5bcbb5=path['join'](config['root'],_0xe3ea('0xc1'),'files',_0xe3ea('0xc4'));var _0x4f0112=path['join'](_0x27505a,_0x5d90a6);var _0x562c8c=util[_0xe3ea('0xb3')](_0xe3ea('0xc5'),_0x2e42b7[_0xe3ea('0xa9')]['id'],_0x5d90a6);var _0x3e9557=path['join'](_0x27505a,_0x562c8c);var _0x3bb580=[];_0x3bb580[_0xe3ea('0x31')]({'model':db[_0xe3ea('0xc6')],'as':_0xe3ea('0xc6'),'attributes':['id',_0xe3ea('0x2c')],'raw':!![]});_0x3bb580[_0xe3ea('0x31')]({'model':db[_0xe3ea('0xc7')],'as':_0xe3ea('0x59'),'attributes':['id','firstName',_0xe3ea('0xc8')],'raw':!![]});var _0x1cb7ac=[{'model':db[_0xe3ea('0xaf')],'as':'Messages','attributes':['id','body',_0xe3ea('0x70'),_0xe3ea('0xc9'),_0xe3ea('0xca'),_0xe3ea('0x76')],'include':_0x3bb580}];_0x1cb7ac[_0xe3ea('0x31')]({'model':db[_0xe3ea('0xcb')],'as':_0xe3ea('0xcc'),'attributes':['id',_0xe3ea('0x28')]});_0x1cb7ac[_0xe3ea('0x31')]({'model':db[_0xe3ea('0xc6')],'as':_0xe3ea('0xcd'),'attributes':['id',_0xe3ea('0x2c')]});return db[_0xe3ea('0x33')]['find']({'where':{'id':_0x2e42b7[_0xe3ea('0xa9')]['id']},'include':_0x1cb7ac})['then'](handleEntityNotFound(_0xada3eb,null))[_0xe3ea('0x26')](function(_0x3f0bf4){if(_0x3f0bf4){var _0x3b47bf=_0x3f0bf4[_0xe3ea('0xce')]({'plain':!![]});fs[_0xe3ea('0xcf')](_0x4f0112);var _0x582eb2={'channel':_0xe3ea('0xd0'),'account':_0x3b47bf[_0xe3ea('0xcc')]['name'],'agent':_0x3b47bf['Owner']?_0x3b47bf[_0xe3ea('0xcd')]['fullname']:'N.A.','createdAt':moment(_0x3b47bf[_0xe3ea('0x70')])[_0xe3ea('0xb3')](_0xe3ea('0xb4'))['toString'](),'closedAt':_0x3b47bf[_0xe3ea('0xd1')]?moment(_0x3b47bf['closedAt'])[_0xe3ea('0xb3')](_0xe3ea('0xb4'))[_0xe3ea('0x90')]():'','disposition':_0x3b47bf[_0xe3ea('0xd2')],'messages':_(_0x3b47bf[_0xe3ea('0xd3')])[_0xe3ea('0x7b')]({'secret':![]})['map'](function(_0x263ce5){return{'date':moment(_0x263ce5[_0xe3ea('0x70')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xe3ea('0x90')](),'sender':_0x263ce5[_0xe3ea('0xc9')]===_0xe3ea('0xd4')?_0x263ce5[_0xe3ea('0xc6')]?_0x263ce5['User']['fullname']:_0xe3ea('0xd5'):_0x263ce5['Contact'][_0xe3ea('0xd6')]+(_0x263ce5[_0xe3ea('0x59')][_0xe3ea('0xc8')]?'\x20'+_0x263ce5[_0xe3ea('0x59')][_0xe3ea('0xc8')]:''),'body':_0x263ce5['body'],'direction':_0x263ce5[_0xe3ea('0xc9')]===_0xe3ea('0xd4')?'A':'C','secret':_0x263ce5[_0xe3ea('0xca')],'read':_0x263ce5['read']};})[_0xe3ea('0x5c')]()};return ejs[_0xe3ea('0xd7')](path[_0xe3ea('0xbf')](config[_0xe3ea('0xc0')],'server',_0xe3ea('0xd8'),_0xe3ea('0xd9')),{'interaction':_0x582eb2})[_0xe3ea('0x26')](function(_0x96d1){var _0x53e891=path[_0xe3ea('0xbf')](_0x4f0112,_0xe3ea('0xda')+_0x3b47bf['id']+'-'+_0x5d90a6+_0xe3ea('0xdb'));var _0x54e2b3={'path':_0x53e891,'channel':_0xe3ea('0xd0'),'interactionId':_0x3b47bf['id']};return pdf[_0xe3ea('0xdc')](_0x96d1,_0x54e2b3);})['then'](function(){return new BPromise(function(_0x3b7f76,_0x3a3305){zipdir(_0x4f0112,{'saveTo':_0x3e9557},function(_0x15faba,_0x3492de){if(_0x15faba)return _0x3a3305(_0x15faba);return _0x3b7f76(_0x3492de);});})[_0xe3ea('0x26')](function(){return new BPromise(function(_0x5976c3,_0x199e1c){rimraf(_0x4f0112,function(_0x3351d3){if(_0x3351d3)_0x199e1c(_0x3351d3);return _0x5976c3();});});})[_0xe3ea('0x26')](function(){return _0xada3eb[_0xe3ea('0xbd')](_0x3e9557,_0x562c8c,function(_0x1b9486){if(_0x1b9486){console[_0xe3ea('0xdd')](_0xe3ea('0xde'),_0x1b9486);}else{fs[_0xe3ea('0xdf')](_0x3e9557);}});});});}else{return _0xada3eb[_0xe3ea('0xe0')](0xc8);}})['catch'](handleError(_0xada3eb,null));}; \ No newline at end of file +var _0x6268=['apply','save','update','destroy','then','error','name','send','Users','fullname','TagIds','Tags','split','forEach','push','catch','index','map','SmsInteraction','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','pick','select','field','from','tools_tags','u.id','user_has_sms_interactions','u.id\x20=\x20ui.UserId','sms_interactions','left_join','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','length','find','unreadMessages','value','`\x20=\x200','having','Contact','operator','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','isEmpty','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','read','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','resolve','SmsAccountId','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','fields','Account.key','a.mandatoryDisposition','c.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','rows','include','options','create','params','describe','ids','omit','getMessages','findOne','SmsMessage','format','includeAll','addTags','setTags','spread','findAll','color','emit','removeTags','unix','root','server','files','attachments','join','User','CmContact','firstName','lastName','direction','secret','SmsAccount','Account','Owner','get','mkdirSync','Sms','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','Messages','out','System','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','download','log','err','unlinkSync','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x4e321d,_0x2f1138){var _0x28b273=function(_0x4b2100){while(--_0x4b2100){_0x4e321d['push'](_0x4e321d['shift']());}};_0x28b273(++_0x2f1138);}(_0x6268,0x193));var _0x8626=function(_0x514a8d,_0x24f8ff){_0x514a8d=_0x514a8d-0x0;var _0x2cbea1=_0x6268[_0x514a8d];return _0x2cbea1;};'use strict';var emlformat=require(_0x8626('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8626('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8626('0x2'));var moment=require(_0x8626('0x3'));var BPromise=require(_0x8626('0x4'));var Mustache=require(_0x8626('0x5'));var util=require(_0x8626('0x6'));var path=require('path');var sox=require(_0x8626('0x7'));var csv=require(_0x8626('0x8'));var ejs=require(_0x8626('0x9'));var fs=require('fs');var fs_extra=require(_0x8626('0xa'));var _=require(_0x8626('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8626('0xc'));var deskjs=require(_0x8626('0xd'));var toCsv=require(_0x8626('0x8'));var querystring=require(_0x8626('0xe'));var Papa=require(_0x8626('0xf'));var Redis=require(_0x8626('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8626('0x11'));var as=require(_0x8626('0x12'));var pdf=require(_0x8626('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8626('0x14'))(_0x8626('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8626('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8626('0x17')](config[_0x8626('0x18')],{'host':_0x8626('0x19'),'port':0x18eb});var socket=require(_0x8626('0x1a'))(new Redis(config['redis']));require(_0x8626('0x1b'))['register'](socket);function respondWithStatusCode(_0x4d22ce,_0x54323a){_0x54323a=_0x54323a||0xcc;return function(_0x5b9a8a){if(_0x5b9a8a){return _0x4d22ce[_0x8626('0x1c')](_0x54323a);}return _0x4d22ce[_0x8626('0x1d')](_0x54323a)[_0x8626('0x1e')]();};}function respondWithResult(_0x1d4855,_0x5df78c){_0x5df78c=_0x5df78c||0xc8;return function(_0x41567b){if(_0x41567b){return _0x1d4855['status'](_0x5df78c)[_0x8626('0x1f')](_0x41567b);}};}function respondWithFilteredResult(_0x1670eb,_0x4c159c){return function(_0x4a86c5){if(_0x4a86c5){var _0x4f59a1=typeof _0x4c159c[_0x8626('0x20')]===_0x8626('0x21')&&typeof _0x4c159c[_0x8626('0x22')]===_0x8626('0x21');var _0x2a0136=_0x4a86c5['count'];var _0x5cce11=_0x4f59a1?0x0:_0x4c159c[_0x8626('0x20')];var _0x50cd87=_0x4f59a1?_0x4a86c5[_0x8626('0x23')]:_0x4c159c[_0x8626('0x20')]+_0x4c159c[_0x8626('0x22')];var _0x49401b;if(_0x50cd87>=_0x2a0136){_0x50cd87=_0x2a0136;_0x49401b=0xc8;}else{_0x49401b=0xce;}_0x1670eb['status'](_0x49401b);return _0x1670eb[_0x8626('0x24')]('Content-Range',_0x5cce11+'-'+_0x50cd87+'/'+_0x2a0136)[_0x8626('0x1f')](_0x4a86c5);}return null;};}function patchUpdates(_0x23ae9b){return function(_0x5c52c1){try{jsonpatch[_0x8626('0x25')](_0x5c52c1,_0x23ae9b,!![]);}catch(_0x2f6e4a){return BPromise['reject'](_0x2f6e4a);}return _0x5c52c1[_0x8626('0x26')]();};}function saveUpdates(_0xac5624,_0x5578cd){return function(_0x2f2934){if(_0x2f2934){return _0x2f2934[_0x8626('0x27')](_0xac5624)['then'](function(_0x420fb5){return _0x420fb5;});}return null;};}function removeEntity(_0x3540a6,_0xb5034b){return function(_0x88b070){if(_0x88b070){return _0x88b070[_0x8626('0x28')]()[_0x8626('0x29')](function(){_0x3540a6[_0x8626('0x1d')](0xcc)[_0x8626('0x1e')]();});}};}function handleEntityNotFound(_0x1b85ba,_0x2dc2ad){return function(_0x259d4d){if(!_0x259d4d){_0x1b85ba['sendStatus'](0x194);}return _0x259d4d;};}function handleError(_0x51358b,_0x1a759d){_0x1a759d=_0x1a759d||0x1f4;return function(_0x147e72){logger[_0x8626('0x2a')](_0x147e72['stack']);if(_0x147e72[_0x8626('0x2b')]){delete _0x147e72['name'];}_0x51358b[_0x8626('0x1d')](_0x1a759d)[_0x8626('0x2c')](_0x147e72);};}function getInteractionUsers(_0x4519fb,_0x7b6343){return new BPromise(function(_0x2fd61a,_0x4cd7b9){try{if(_0x7b6343[_0x4519fb['id']]){_0x4519fb[_0x8626('0x2d')]=_['map'](_0x7b6343[_0x4519fb['id']],function(_0x15aa9e){return{'id':_0x15aa9e['id'],'fullname':_0x15aa9e[_0x8626('0x2e')]};});}}catch(_0x4a5855){_0x4cd7b9(_0x4a5855);}_0x2fd61a(_0x4519fb);});}function getInteractionTags(_0x336818,_0x309efd){return new BPromise(function(_0x2ecc6a,_0x46825d){try{if(_0x336818[_0x8626('0x2f')]){_0x336818[_0x8626('0x30')]=[];_0x336818[_0x8626('0x2f')][_0x8626('0x31')](',')[_0x8626('0x32')](function(_0x2ecf25){_0x336818['Tags'][_0x8626('0x33')](_0x309efd[_0x2ecf25]);});}delete _0x336818[_0x8626('0x2f')];}catch(_0x229f01){_0x46825d(_0x229f01);}_0x2ecc6a(_0x336818);});}function updateSmsInteraction(_0x4e3a74,_0x59717a,_0x2c3e6c){return new BPromise(function(_0xbc32ec,_0x982375){return getInteractionUsers(_0x4e3a74,_0x2c3e6c)[_0x8626('0x29')](function(_0x59b579){return getInteractionTags(_0x59b579,_0x59717a);})[_0x8626('0x29')](function(_0x552b34){_0xbc32ec(_0x552b34);})[_0x8626('0x34')](function(_0x50a03f){_0x982375(_0x50a03f);});});}exports[_0x8626('0x35')]=function(_0x6a3faf,_0x20f388){var _0x1f9f80={},_0x41b95d={},_0x523462={'count':0x0,'rows':[]};var _0x374169=_[_0x8626('0x36')](db[_0x8626('0x37')][_0x8626('0x38')],function(_0x2fb8a0){return{'name':_0x2fb8a0[_0x8626('0x39')],'type':_0x2fb8a0[_0x8626('0x3a')][_0x8626('0x3b')]};});_0x41b95d['model']=_[_0x8626('0x36')](_0x374169,'name');_0x41b95d[_0x8626('0x3c')]=_[_0x8626('0x3d')](_0x6a3faf[_0x8626('0x3c')]);_0x41b95d[_0x8626('0x3e')]=_[_0x8626('0x3f')](_0x41b95d[_0x8626('0x40')],_0x41b95d[_0x8626('0x3c')]);_0x1f9f80[_0x8626('0x41')]=_[_0x8626('0x3f')](_0x41b95d[_0x8626('0x40')],qs['fields'](_0x6a3faf[_0x8626('0x3c')]['fields']));_0x1f9f80[_0x8626('0x41')]=_0x1f9f80['attributes']['length']?_0x1f9f80[_0x8626('0x41')]:_0x41b95d['model'];if(!_0x6a3faf[_0x8626('0x3c')][_0x8626('0x42')](_0x8626('0x43'))){_0x1f9f80[_0x8626('0x22')]=qs['limit'](_0x6a3faf['query']['limit']);_0x1f9f80[_0x8626('0x20')]=qs[_0x8626('0x20')](_0x6a3faf['query'][_0x8626('0x20')]);}_0x1f9f80[_0x8626('0x44')]=qs[_0x8626('0x45')](_0x6a3faf[_0x8626('0x3c')][_0x8626('0x45')]);_0x1f9f80[_0x8626('0x46')]=qs['filters'](_[_0x8626('0x47')](_0x6a3faf[_0x8626('0x3c')],_0x41b95d['filters']),_0x374169);var _0x585bdf=[];var _0x538b02=squel[_0x8626('0x48')]()[_0x8626('0x49')]('id')[_0x8626('0x49')]('name')['field']('color')[_0x8626('0x4a')](_0x8626('0x4b'));var _0x52b32d=squel['select']()[_0x8626('0x49')](_0x8626('0x4c'))[_0x8626('0x49')]('u.fullname')[_0x8626('0x49')]('ui.SmsInteractionId')[_0x8626('0x4a')](_0x8626('0x4d'),'ui')['left_join']('users','u',_0x8626('0x4e'));var _0x407d52=squel['select']()['from'](_0x8626('0x4f'),'i')[_0x8626('0x50')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x8626('0x50')]('users','o',_0x8626('0x51'))[_0x8626('0x50')](_0x8626('0x52'),'a',_0x8626('0x53'))[_0x8626('0x50')](_0x8626('0x54'),'me',_0x8626('0x55'))[_0x8626('0x50')]('sms_interaction_has_tags','it','it.SmsInteractionId\x20=\x20i.id')['left_join']('tools_tags','t',_0x8626('0x56'));var _0x44b29a=squel[_0x8626('0x57')]();var _0x2ab4e2=[];var _0x4c578d=squel[_0x8626('0x57')]();var _0x326e98;if(_0x6a3faf[_0x8626('0x3c')][_0x8626('0x58')]){_0x326e98=as[_0x8626('0x59')](_0x6a3faf[_0x8626('0x3c')][_0x8626('0x58')]);var _0x509c89=_0x326e98['sqlOperator'];for(var _0x559985=0x0;_0x559985<_0x326e98[_0x8626('0x5a')][_0x8626('0x5b')];_0x559985++){var _0x76f534=_0x326e98[_0x8626('0x5a')][_0x559985];var _0x5db162='i';var _0x3e690d=_[_0x8626('0x5c')](_0x374169,[_0x8626('0x2b'),_0x76f534[_0x8626('0x49')]]);if(!_0x3e690d){switch(_0x76f534['field']){case _0x8626('0x5d'):if(_0x76f534[_0x8626('0x5e')]==0x1){_0x407d52['having']('`'+_0x76f534['field']+_0x8626('0x5f'));}else{_0x407d52[_0x8626('0x60')]('`'+_0x76f534[_0x8626('0x49')]+'`\x20>\x200');}break;case _0x8626('0x61'):if(_0x76f534[_0x8626('0x62')]===_0x8626('0x63')){if(_0x76f534[_0x8626('0x5e')][_0x8626('0x31')]('\x20')[_0x8626('0x5b')]>0x1){_0x44b29a[_0x509c89]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x76f534[_0x8626('0x5e')]),null);}else{var _0x2fb96f='%'+_0x76f534[_0x8626('0x5e')]+'%';_0x44b29a[_0x509c89](_0x8626('0x64'),_0x2fb96f,_0x2fb96f,_0x2fb96f);}}else{_0x3e690d=_[_0x8626('0x5c')](_0x374169,[_0x8626('0x2b'),'ContactId']);_0x76f534['field']=_0x8626('0x65');_0x3cf75b=as[_0x8626('0x66')](_0x5db162,_0x3e690d[_0x8626('0x3a')],_0x76f534);_0x44b29a[_0x509c89](_0x3cf75b[_0x8626('0x67')],_0x3cf75b['value'][_0x8626('0x68')],_0x3cf75b['value'][_0x8626('0x1e')]);}break;case _0x8626('0x69'):var _0x47eb82=_0x76f534[_0x8626('0x5e')][_0x8626('0x31')](',')[_0x8626('0x36')](function(_0x119155){return Number(_0x119155);});_0x47eb82[_0x8626('0x32')](function(_0x16038d){_0x4c578d['or'](_0x8626('0x6a'),'%,'+_0x16038d+',%');});_0x2ab4e2=_[_0x8626('0x6b')](_0x2ab4e2,_0x47eb82);break;case'User':if(_0x76f534[_0x8626('0x62')]===_0x8626('0x63')){_0x44b29a[_0x509c89](_0x8626('0x6c'),'%'+_0x76f534[_0x8626('0x5e')]+'%',null);}else{_0x3e690d=_[_0x8626('0x5c')](_0x374169,['name',_0x8626('0x6d')]);_0x76f534[_0x8626('0x49')]=_0x8626('0x6d');_0x3cf75b=as[_0x8626('0x66')](_0x5db162,_0x3e690d[_0x8626('0x3a')],_0x76f534);_0x44b29a[_0x509c89](_0x3cf75b['text'],_0x3cf75b[_0x8626('0x5e')]['start'],_0x3cf75b[_0x8626('0x5e')]['end']);}break;case _0x8626('0x6e'):_0x3cf75b=as[_0x8626('0x66')]('me',null,_0x76f534);_0x44b29a[_0x509c89](_0x3cf75b[_0x8626('0x67')],_0x3cf75b[_0x8626('0x5e')][_0x8626('0x68')],_0x3cf75b['value'][_0x8626('0x1e')]);break;}}else{var _0x3cf75b=as['buildExpression'](_0x5db162,_0x3e690d[_0x8626('0x3a')],_0x76f534);_0x44b29a[_0x509c89](_0x3cf75b[_0x8626('0x67')],_0x3cf75b[_0x8626('0x5e')][_0x8626('0x68')],_0x3cf75b['value'][_0x8626('0x1e')]);}}}else{var _0x599111=_(_0x6a3faf[_0x8626('0x3c')])[_0x8626('0x3d')]()[_0x8626('0x36')](function(_0x1cb9c5){return _[_0x8626('0x6f')](_0x374169,[_0x8626('0x2b'),_0x1cb9c5])?_0x1cb9c5:undefined;})['compact']()[_0x8626('0x5e')]();if(!_[_0x8626('0x70')](_0x599111)){_0x599111[_0x8626('0x32')](function(_0x275e35){if(_0x275e35==='SmsAccountId'){_0x407d52[_0x8626('0x46')](_0x8626('0x71'),[][_0x8626('0x72')](_0x6a3faf[_0x8626('0x3c')][_0x275e35]));}else if(_0x275e35===_0x8626('0x73')){var _0x44ca5e=JSON[_0x8626('0x74')](_0x6a3faf[_0x8626('0x3c')][_0x275e35])[_0x8626('0x75')];var _0x20633a=JSON[_0x8626('0x74')](_0x6a3faf[_0x8626('0x3c')][_0x275e35])[_0x8626('0x76')];_0x407d52['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x44ca5e,_0x20633a);}else{if(_0x6a3faf[_0x8626('0x3c')][_0x275e35]===_0x8626('0x77')){_0x407d52[_0x8626('0x46')]('i.'+_0x275e35+_0x8626('0x78'));}else{_0x407d52[_0x8626('0x46')]('i.'+_0x275e35+'\x20=\x20?',_0x6a3faf[_0x8626('0x3c')][_0x275e35]);}}});}if(_0x6a3faf[_0x8626('0x3c')][_0x8626('0x79')]){if(_0x6a3faf[_0x8626('0x3c')][_0x8626('0x79')]==0x1){_0x407d52[_0x8626('0x60')]('`unreadMessages`\x20=\x200');}else{_0x407d52[_0x8626('0x60')]('`unreadMessages`\x20>\x200');}}if(_0x6a3faf[_0x8626('0x3c')][_0x8626('0x7a')]){_0x2ab4e2=_[_0x8626('0x7b')](_0x6a3faf[_0x8626('0x3c')]['tag'])?_0x6a3faf['query'][_0x8626('0x7a')]:new Array(_0x6a3faf['query'][_0x8626('0x7a')]);_0x2ab4e2[_0x8626('0x32')](function(_0x17aa87){_0x4c578d['or'](_0x8626('0x6a'),'%,'+_0x17aa87+',%');});}if(_0x6a3faf[_0x8626('0x3c')][_0x8626('0x7c')]){var _0x30ae28=_0x6a3faf[_0x8626('0x3c')][_0x8626('0x7c')][_0x8626('0x7d')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x8626('0x7e')](_0x30ae28)){_0x44b29a['or'](_0x8626('0x7f'),_0x30ae28+'%')['or'](_0x8626('0x80'),_0x30ae28+'%');}else{_0x44b29a['or'](_0x8626('0x81'),qs[_0x8626('0x82')](_0x30ae28))['or'](_0x8626('0x83'),_0x30ae28+'%');}}}_0x407d52['where'](_0x44b29a);_0x407d52[_0x8626('0x84')](_0x8626('0x85'));var _0x3a1d9d={'type':db[_0x8626('0x86')][_0x8626('0x87')][_0x8626('0x88')],'raw':!![]};var _0x2ff08e=_0x407d52[_0x8626('0x89')]();_0x2ff08e['field'](_0x8626('0x85'));_0x2ff08e[_0x8626('0x49')](_0x8626('0x8a'),_0x8626('0x5d'));if(_0x1f9f80['order']){_0x1f9f80['order'][_0x8626('0x32')](function(_0x4329a0){var _0x146c3a=_0x4329a0[0x0]===_0x8626('0x8b')?_0x4329a0[0x0]:'i.'+_0x4329a0[0x0];_0x407d52['order'](_0x146c3a,_0x4329a0[0x1]==='DESC'?![]:!![]);});}if(!_[_0x8626('0x70')](_0x2ab4e2)){_0x407d52[_0x8626('0x60')](_0x4c578d);_0x2ff08e[_0x8626('0x46')]('t.id\x20IN\x20?',_0x2ab4e2);}BPromise[_0x8626('0x8c')]()[_0x8626('0x29')](function(){if(!_0x326e98){if(_0x6a3faf[_0x8626('0x3c')][_0x8626('0x8d')])return;_0x2ff08e[_0x8626('0x46')](_0x8626('0x8e'));_0x407d52['where'](_0x8626('0x8e'));return;}if(_0x6a3faf[_0x8626('0x8f')][_0x8626('0x90')]!=='agent')return;return _0x6a3faf[_0x8626('0x8f')][_0x8626('0x91')]({'attributes':['id'],'raw':!![]})[_0x8626('0x29')](function(_0x33f90a){if(_[_0x8626('0x70')](_0x33f90a)){_0x2ff08e['where'](_0x8626('0x92'));_0x407d52[_0x8626('0x46')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x2ff08e['where'](_0x8626('0x71'),_[_0x8626('0x36')](_0x33f90a,'id'));_0x407d52['where'](_0x8626('0x71'),_['map'](_0x33f90a,'id'));}});})[_0x8626('0x29')](function(){if(_0x6a3faf[_0x8626('0x8f')][_0x8626('0x90')]===_0x8626('0x93')&&!_0x326e98&&!_0x6a3faf[_0x8626('0x3c')][_0x8626('0x8d')])return[];return db[_0x8626('0x94')][_0x8626('0x3c')](_0x2ff08e[_0x8626('0x95')](),_0x3a1d9d);})[_0x8626('0x29')](function(_0x58dce0){_0x523462[_0x8626('0x23')]=_0x58dce0[_0x8626('0x5b')];if(_0x523462[_0x8626('0x23')]===0x0)return[];return db[_0x8626('0x94')][_0x8626('0x3c')](_0x538b02['toString'](),_0x3a1d9d)[_0x8626('0x29')](function(_0x336192){_0x585bdf=_[_0x8626('0x96')](_0x336192,'id');_0x3a1d9d=_[_0x8626('0x97')](_0x3a1d9d,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x6a3faf[_0x8626('0x3c')][_0x8626('0x98')]){_0x1f9f80['attributes']['forEach'](function(_0x2961be){_0x407d52[_0x8626('0x49')]('i.'+_0x2961be);});}else{_0x407d52[_0x8626('0x49')](_0x8626('0x8a'),'unreadMessages');_0x407d52[_0x8626('0x49')]('a.key',_0x8626('0x99'));_0x407d52['field'](_0x8626('0x9a'),'Account.mandatoryDisposition');_0x407d52['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x8626('0x8b'));_0x407d52['field']('i.*');_0x407d52[_0x8626('0x49')](_0x8626('0x9b'),'Contact.firstName');_0x407d52[_0x8626('0x49')](_0x8626('0x9c'),_0x8626('0x9d'));_0x407d52[_0x8626('0x49')](_0x8626('0x9e'),'Contact.email');_0x407d52[_0x8626('0x49')](_0x8626('0x9f'),'Contact.phone');_0x407d52[_0x8626('0x49')]('c.mobile',_0x8626('0xa0'));_0x407d52['field'](_0x8626('0xa1'),_0x8626('0xa2'));_0x407d52['field'](_0x8626('0xa3'),'Owner.fullname');_0x407d52['field']('o.internal',_0x8626('0xa4'));_0x407d52['field'](_0x8626('0xa5'),_0x8626('0x2f'));}if(_0x1f9f80[_0x8626('0x22')])_0x407d52[_0x8626('0x22')](_0x1f9f80[_0x8626('0x22')]);if(_0x1f9f80[_0x8626('0x20')])_0x407d52[_0x8626('0x20')](_0x1f9f80[_0x8626('0x20')]);return db['sequelize'][_0x8626('0x3c')](_0x407d52[_0x8626('0x95')](),_0x3a1d9d);})[_0x8626('0x29')](function(_0x1d264d){if(_0x1d264d[_0x8626('0x5b')]>0x0)_0x52b32d[_0x8626('0x46')](_0x8626('0xa6'),_[_0x8626('0x36')](_0x1d264d,'id'));return db[_0x8626('0x94')][_0x8626('0x3c')](_0x52b32d['toString'](),_0x3a1d9d)[_0x8626('0x29')](function(_0x309df3){var _0x14afe9=_['groupBy'](_0x309df3,_0x8626('0xa7'));var _0x56e74d=[];_0x1d264d[_0x8626('0x32')](function(_0x491b5d){_0x56e74d['push'](updateSmsInteraction(_0x491b5d,_0x585bdf,_0x14afe9));});return BPromise['all'](_0x56e74d);});});})['then'](function(_0x218a59){_0x523462[_0x8626('0xa8')]=_0x218a59;return _0x523462;})[_0x8626('0x29')](respondWithFilteredResult(_0x20f388,_0x1f9f80))[_0x8626('0x34')](handleError(_0x20f388,null));};exports['show']=function(_0x4852a5,_0x39dc51){var _0x31733c={'raw':![],'where':{'id':_0x4852a5['params']['id']}},_0x38787c={};_0x38787c[_0x8626('0x40')]=_[_0x8626('0x3d')](db[_0x8626('0x37')]['rawAttributes']);_0x38787c['query']=_[_0x8626('0x3d')](_0x4852a5[_0x8626('0x3c')]);_0x38787c[_0x8626('0x3e')]=_[_0x8626('0x3f')](_0x38787c[_0x8626('0x40')],_0x38787c[_0x8626('0x3c')]);_0x31733c['attributes']=_[_0x8626('0x3f')](_0x38787c[_0x8626('0x40')],qs['fields'](_0x4852a5[_0x8626('0x3c')][_0x8626('0x98')]));_0x31733c[_0x8626('0x41')]=_0x31733c['attributes'][_0x8626('0x5b')]?_0x31733c[_0x8626('0x41')]:_0x38787c['model'];if(_0x4852a5['query']['includeAll']){_0x31733c[_0x8626('0xa9')]=[{'all':!![]}];}_0x31733c=_[_0x8626('0x97')]({},_0x31733c,_0x4852a5[_0x8626('0xaa')]);return db[_0x8626('0x37')][_0x8626('0x5c')](_0x31733c)['then'](handleEntityNotFound(_0x39dc51,null))[_0x8626('0x29')](respondWithResult(_0x39dc51,null))[_0x8626('0x34')](handleError(_0x39dc51,null));};exports[_0x8626('0xab')]=function(_0x334734,_0x38bc6b){return db[_0x8626('0x37')]['create'](_0x334734['body'],{})[_0x8626('0x29')](respondWithResult(_0x38bc6b,0xc9))[_0x8626('0x34')](handleError(_0x38bc6b,null));};exports['update']=function(_0x5cf47c,_0x2e6ece){if(_0x5cf47c[_0x8626('0x6e')]['id']){delete _0x5cf47c[_0x8626('0x6e')]['id'];}return db[_0x8626('0x37')][_0x8626('0x5c')]({'where':{'id':_0x5cf47c[_0x8626('0xac')]['id']}})['then'](handleEntityNotFound(_0x2e6ece,null))[_0x8626('0x29')](saveUpdates(_0x5cf47c[_0x8626('0x6e')],null))['then'](respondWithResult(_0x2e6ece,null))['catch'](handleError(_0x2e6ece,null));};exports[_0x8626('0x28')]=function(_0x186c27,_0x5419f4){return db['SmsInteraction'][_0x8626('0x5c')]({'where':{'id':_0x186c27[_0x8626('0xac')]['id']}})[_0x8626('0x29')](handleEntityNotFound(_0x5419f4,null))[_0x8626('0x29')](removeEntity(_0x5419f4,null))[_0x8626('0x34')](handleError(_0x5419f4,null));};exports[_0x8626('0xad')]=function(_0x367f4c,_0x3db8a9){return db[_0x8626('0x37')]['describe']()[_0x8626('0x29')](respondWithResult(_0x3db8a9,null))[_0x8626('0x34')](handleError(_0x3db8a9,null));};exports['addMessage']=function(_0xae6271,_0xb0402c,_0x2737bd){return db['SmsMessage'][_0x8626('0x5c')]({'where':{'id':_0xae6271[_0x8626('0xac')]['id']}})['then'](handleEntityNotFound(_0xb0402c,null))[_0x8626('0x29')](function(_0x146885){if(_0x146885){return _0x146885['addMessage'](_0xae6271[_0x8626('0x6e')][_0x8626('0xae')],_[_0x8626('0xaf')](_0xae6271[_0x8626('0x6e')],[_0x8626('0xae'),'id'])||{});}})[_0x8626('0x29')](respondWithResult(_0xb0402c,null))[_0x8626('0x34')](handleError(_0xb0402c,null));};exports[_0x8626('0xb0')]=function(_0x2b1bbe,_0x751869,_0xa7fa9f){var _0x50af70={'raw':![],'where':{}};var _0x33ab39={};var _0x2d0513={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x8626('0xb1')]({'where':{'id':_0x2b1bbe[_0x8626('0xac')]['id']}})['then'](handleEntityNotFound(_0x751869,null))[_0x8626('0x29')](function(_0x185a21){if(_0x185a21){_0x33ab39[_0x8626('0x40')]=_['keys'](db[_0x8626('0xb2')][_0x8626('0x38')]);_0x33ab39['query']=_[_0x8626('0x3d')](_0x2b1bbe['query']);_0x33ab39[_0x8626('0x3e')]=_['intersection'](_0x33ab39['model'],_0x33ab39[_0x8626('0x3c')]);_0x50af70[_0x8626('0x41')]=_[_0x8626('0x3f')](_0x33ab39[_0x8626('0x40')],qs[_0x8626('0x98')](_0x2b1bbe[_0x8626('0x3c')][_0x8626('0x98')]));_0x50af70['attributes']=_0x50af70['attributes'][_0x8626('0x5b')]?_0x50af70[_0x8626('0x41')]:_0x33ab39[_0x8626('0x40')];if(!_0x2b1bbe[_0x8626('0x3c')]['hasOwnProperty']('nolimit')){_0x50af70[_0x8626('0x22')]=qs[_0x8626('0x22')](_0x2b1bbe[_0x8626('0x3c')][_0x8626('0x22')]);_0x50af70[_0x8626('0x20')]=qs['offset'](_0x2b1bbe[_0x8626('0x3c')][_0x8626('0x20')]);}_0x50af70[_0x8626('0x44')]=qs[_0x8626('0x45')](_0x2b1bbe[_0x8626('0x3c')][_0x8626('0x45')]);_0x50af70['where']=qs['filters'](_[_0x8626('0x47')](_0x2b1bbe[_0x8626('0x3c')],_0x33ab39[_0x8626('0x3e')]));_0x50af70[_0x8626('0x46')][_0x8626('0xa7')]=_0x185a21['id'];if(_0x2b1bbe['query'][_0x8626('0x7c')]){_0x50af70[_0x8626('0x46')]=_[_0x8626('0x97')](_0x50af70[_0x8626('0x46')],{'$or':_[_0x8626('0x36')](_0x50af70['attributes'],function(_0x533147){var _0xa38852={};_0xa38852[_0x533147]={'$like':'%'+_0x2b1bbe[_0x8626('0x3c')][_0x8626('0x7c')]+'%'};return _0xa38852;})});}if(_0x2b1bbe[_0x8626('0x3c')][_0x8626('0x75')]){var _0x2a3d87=_0x2b1bbe[_0x8626('0x3c')][_0x8626('0x75')][_0x8626('0x31')](',');var _0x1007f5={};_0x1007f5[_0x2a3d87[0x0]]={'$gte':moment(_0x2a3d87[0x1])[_0x8626('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')};_0x50af70['where']=_[_0x8626('0x97')](_0x50af70[_0x8626('0x46')],_0x1007f5);}_0x50af70=_[_0x8626('0x97')]({},_0x50af70,_0x2b1bbe[_0x8626('0xaa')]);return db['SmsMessage'][_0x8626('0x23')]({'where':_0x50af70[_0x8626('0x46')]})[_0x8626('0x29')](function(_0xb5385d){_0x2d0513['count']=_0xb5385d;if(_0x2b1bbe[_0x8626('0x3c')][_0x8626('0xb4')]){_0x50af70[_0x8626('0xa9')]=[{'all':!![]}];}return db[_0x8626('0xb2')]['findAll'](_0x50af70);})[_0x8626('0x29')](function(_0x78c763){_0x2d0513[_0x8626('0xa8')]=_0x78c763;return _0x2d0513;});}})[_0x8626('0x29')](respondWithFilteredResult(_0x751869,_0x50af70))['catch'](handleError(_0x751869,null));};exports[_0x8626('0xb5')]=function(_0x100170,_0x13318a,_0x3e148c){return db[_0x8626('0x37')][_0x8626('0x5c')]({'where':{'id':_0x100170[_0x8626('0xac')]['id']}})[_0x8626('0x29')](handleEntityNotFound(_0x13318a,null))['then'](function(_0x557892){if(_0x557892){return _0x557892[_0x8626('0xb6')](_0x100170[_0x8626('0x6e')][_0x8626('0xae')],_['omit'](_0x100170['body'],[_0x8626('0xae'),'id'])||{})[_0x8626('0xb7')](function(){return db['Tag'][_0x8626('0xb8')]({'attributes':['id',_0x8626('0x2b'),_0x8626('0xb9')],'where':{'id':_0x100170['body'][_0x8626('0xae')]}});})['then'](function(_0xe67b0b){socket[_0x8626('0xba')]('smsInteractionTags:save',{'id':Number(_0x100170['params']['id']),'tags':_0xe67b0b||[]});return{'id':Number(_0x100170[_0x8626('0xac')]['id']),'tags':_0xe67b0b||[]};});}})['then'](respondWithResult(_0x13318a,null))[_0x8626('0x34')](handleError(_0x13318a,null));};exports['removeTags']=function(_0x692778,_0x283085,_0x4af1b6){return db[_0x8626('0x37')][_0x8626('0x5c')]({'where':{'id':_0x692778[_0x8626('0xac')]['id']}})[_0x8626('0x29')](handleEntityNotFound(_0x283085,null))[_0x8626('0x29')](function(_0x3c2562){if(_0x3c2562){return _0x3c2562[_0x8626('0xbb')](_0x692778[_0x8626('0x3c')][_0x8626('0xae')]);}})[_0x8626('0x29')](respondWithStatusCode(_0x283085,null))[_0x8626('0x34')](handleError(_0x283085,null));};exports['download']=function(_0x1050c0,_0x3a4a75){var _0x338bd8=moment()[_0x8626('0xbc')]()[_0x8626('0x95')]();var _0xbc444=path['join'](config[_0x8626('0xbd')],_0x8626('0xbe'),_0x8626('0xbf'),'tmp');var _0x49dc25=path['join'](config['root'],_0x8626('0xbe'),_0x8626('0xbf'),_0x8626('0xc0'));var _0x3a9e6c=path[_0x8626('0xc1')](_0xbc444,_0x338bd8);var _0x243a83=util['format']('transcript-%d-%s.zip',_0x1050c0[_0x8626('0xac')]['id'],_0x338bd8);var _0x8f163e=path['join'](_0xbc444,_0x243a83);var _0x695dd8=[];_0x695dd8['push']({'model':db[_0x8626('0xc2')],'as':_0x8626('0xc2'),'attributes':['id',_0x8626('0x2e')],'raw':!![]});_0x695dd8[_0x8626('0x33')]({'model':db[_0x8626('0xc3')],'as':'Contact','attributes':['id',_0x8626('0xc4'),_0x8626('0xc5')],'raw':!![]});var _0x3adf77=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id',_0x8626('0x6e'),_0x8626('0x73'),_0x8626('0xc6'),_0x8626('0xc7'),_0x8626('0x79')],'include':_0x695dd8}];_0x3adf77[_0x8626('0x33')]({'model':db[_0x8626('0xc8')],'as':_0x8626('0xc9'),'attributes':['id',_0x8626('0x2b')]});_0x3adf77[_0x8626('0x33')]({'model':db[_0x8626('0xc2')],'as':_0x8626('0xca'),'attributes':['id',_0x8626('0x2e')]});return db[_0x8626('0x37')][_0x8626('0x5c')]({'where':{'id':_0x1050c0[_0x8626('0xac')]['id']},'include':_0x3adf77})['then'](handleEntityNotFound(_0x3a4a75,null))['then'](function(_0x5551c1){if(_0x5551c1){var _0xe705da=_0x5551c1[_0x8626('0xcb')]({'plain':!![]});fs[_0x8626('0xcc')](_0x3a9e6c);var _0x230931={'channel':_0x8626('0xcd'),'account':_0xe705da[_0x8626('0xc9')][_0x8626('0x2b')],'agent':_0xe705da[_0x8626('0xca')]?_0xe705da[_0x8626('0xca')][_0x8626('0x2e')]:'N.A.','createdAt':moment(_0xe705da['createdAt'])[_0x8626('0xb3')](_0x8626('0xce'))[_0x8626('0x95')](),'closedAt':_0xe705da[_0x8626('0xcf')]?moment(_0xe705da[_0x8626('0xd0')])[_0x8626('0xb3')](_0x8626('0xce'))['toString']():'','disposition':_0xe705da['disposition'],'messages':_(_0xe705da[_0x8626('0xd1')])['filter']({'secret':![]})['map'](function(_0x19f19f){return{'date':moment(_0x19f19f['createdAt'])[_0x8626('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x19f19f[_0x8626('0xc6')]===_0x8626('0xd2')?_0x19f19f[_0x8626('0xc2')]?_0x19f19f[_0x8626('0xc2')]['fullname']:_0x8626('0xd3'):_0x19f19f[_0x8626('0x61')][_0x8626('0xc4')]+(_0x19f19f['Contact'][_0x8626('0xc5')]?'\x20'+_0x19f19f[_0x8626('0x61')][_0x8626('0xc5')]:''),'body':_0x19f19f[_0x8626('0x6e')],'direction':_0x19f19f[_0x8626('0xc6')]===_0x8626('0xd2')?'A':'C','secret':_0x19f19f[_0x8626('0xc7')],'read':_0x19f19f[_0x8626('0x79')]};})[_0x8626('0x5e')]()};return ejs['renderFile'](path['join'](config[_0x8626('0xbd')],'server',_0x8626('0xd4'),_0x8626('0xd5')),{'interaction':_0x230931})[_0x8626('0x29')](function(_0x29da92){var _0x196ddb=path[_0x8626('0xc1')](_0x3a9e6c,'transcript-'+_0xe705da['id']+'-'+_0x338bd8+_0x8626('0xd6'));var _0x448978={'path':_0x196ddb,'channel':'Sms','interactionId':_0xe705da['id']};return pdf[_0x8626('0xd7')](_0x29da92,_0x448978);})[_0x8626('0x29')](function(){return new BPromise(function(_0x16e514,_0x325ae0){zipdir(_0x3a9e6c,{'saveTo':_0x8f163e},function(_0x25fc22,_0x376167){if(_0x25fc22)return _0x325ae0(_0x25fc22);return _0x16e514(_0x376167);});})[_0x8626('0x29')](function(){return new BPromise(function(_0xd5b214,_0x44faab){rimraf(_0x3a9e6c,function(_0x4d362f){if(_0x4d362f)_0x44faab(_0x4d362f);return _0xd5b214();});});})[_0x8626('0x29')](function(){return _0x3a4a75[_0x8626('0xd8')](_0x8f163e,_0x243a83,function(_0x37ac15){if(_0x37ac15){console[_0x8626('0xd9')](_0x8626('0xda'),_0x37ac15);}else{fs[_0x8626('0xdb')](_0x8f163e);}});});});}else{return _0x3a4a75[_0x8626('0x1c')](0xc8);}})[_0x8626('0x34')](handleError(_0x3a4a75,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index a41bb7a..4e64a66 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 _0x1775=['map','findAll','length','emit','catch','hasOwnProperty','exports','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0xb08e68,_0xd1183e){var _0x57a539=function(_0x1adbb3){while(--_0x1adbb3){_0xb08e68['push'](_0xb08e68['shift']());}};_0x57a539(++_0xd1183e);}(_0x1775,0x1db));var _0x5177=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1775[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x5177('0x0'))['db'][_0x5177('0x1')];var SmsMessage=require(_0x5177('0x0'))['db'][_0x5177('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x5177('0x3')](0x0);var events={'afterCreate':_0x5177('0x4'),'afterUpdate':_0x5177('0x5'),'afterDestroy':_0x5177('0x6')};function emitEvent(_0x359401){return function(_0x51275f,_0x159a20,_0x2c5c42){_0x51275f[_0x5177('0x7')]({'attributes':['id'],'raw':!![]})[_0x5177('0x8')](function(_0x300b43){_0x51275f[_0x5177('0x9')](_0x5177('0xa'),_0x300b43[_0x5177('0xb')](function(_0x16e7a7){return{'id':_0x16e7a7['id']};}));return SmsMessage[_0x5177('0xc')]({'where':{'SmsInteractionId':_0x51275f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5177('0x8')](function(_0x206035){_0x51275f['setDataValue']('unreadMessages',_0x206035[_0x5177('0xd')]);SmsInteractionEvents[_0x5177('0xe')](_0x359401+':'+_0x51275f['id'],_0x51275f);SmsInteractionEvents[_0x5177('0xe')](_0x359401,_0x51275f);_0x2c5c42(null);})[_0x5177('0xf')](_0x2c5c42(null));};}for(var e in events){if(events[_0x5177('0x10')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x5177('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0x77e6=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','then','Users','map'];(function(_0x4e7c2,_0x3b3347){var _0x84bb35=function(_0x217b38){while(--_0x217b38){_0x4e7c2['push'](_0x4e7c2['shift']());}};_0x84bb35(++_0x3b3347);}(_0x77e6,0x1a6));var _0x677e=function(_0x8d257b,_0x242401){_0x8d257b=_0x8d257b-0x0;var _0x48c7ae=_0x77e6[_0x8d257b];return _0x48c7ae;};'use strict';var EventEmitter=require(_0x677e('0x0'));var SmsInteraction=require(_0x677e('0x1'))['db'][_0x677e('0x2')];var SmsMessage=require(_0x677e('0x1'))['db'][_0x677e('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x677e('0x4')](0x0);var events={'afterCreate':_0x677e('0x5'),'afterUpdate':_0x677e('0x6'),'afterDestroy':'remove'};function emitEvent(_0x2f0307){return function(_0x2560a6,_0x52e3f9,_0x18c5e1){_0x2560a6['getUsers']({'attributes':['id'],'raw':!![]})[_0x677e('0x7')](function(_0x4d1a57){_0x2560a6['setDataValue'](_0x677e('0x8'),_0x4d1a57[_0x677e('0x9')](function(_0x28d41e){return{'id':_0x28d41e['id']};}));return SmsMessage[_0x677e('0xa')]({'where':{'SmsInteractionId':_0x2560a6['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x206305){_0x2560a6['setDataValue'](_0x677e('0xb'),_0x206305[_0x677e('0xc')]);SmsInteractionEvents[_0x677e('0xd')](_0x2f0307+':'+_0x2560a6['id'],_0x2560a6);SmsInteractionEvents[_0x677e('0xd')](_0x2f0307,_0x2560a6);_0x18c5e1(null);})[_0x677e('0xe')](_0x18c5e1(null));};}for(var e in events){if(events[_0x677e('0xf')](e)){var event=events[e];SmsInteraction[_0x677e('0x10')](e,emitEvent(event));}}module[_0x677e('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 a3e448f..87cd72d 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 _0x7090=['path','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x29f271,_0x27d37c){var _0x348329=function(_0x428d13){while(--_0x428d13){_0x29f271['push'](_0x29f271['shift']());}};_0x348329(++_0x27d37c);}(_0x7090,0xf9));var _0x0709=function(_0x5d5bcb,_0x25e2ea){_0x5d5bcb=_0x5d5bcb-0x0;var _0x4ea5eb=_0x7090[_0x5d5bcb];return _0x4ea5eb;};'use strict';var _=require(_0x0709('0x0'));var util=require(_0x0709('0x1'));var logger=require(_0x0709('0x2'))(_0x0709('0x3'));var moment=require(_0x0709('0x4'));var BPromise=require('bluebird');var rp=require(_0x0709('0x5'));var fs=require('fs');var path=require(_0x0709('0x6'));var rimraf=require('rimraf');var config=require(_0x0709('0x7'));var attributes=require(_0x0709('0x8'));module[_0x0709('0x9')]=function(_0x4d46a5,_0x799202){return _0x4d46a5[_0x0709('0xa')](_0x0709('0xb'),attributes,{'tableName':_0x0709('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1e5652,_0x37bb8f,_0x257c37){if(_0x1e5652[_0x0709('0xd')](_0x0709('0xe'))){_0x1e5652[_0x0709('0xf')]=moment()['format'](_0x0709('0x10'));}_0x257c37(null,_0x1e5652);}}});}; \ No newline at end of file +var _0x5af1=['../../config/environment','./smsInteraction.attributes','exports','define','sms_interactions','changed','closedAt','format','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x50af9c,_0xf03b1e){var _0x5b5e5a=function(_0x309a92){while(--_0x309a92){_0x50af9c['push'](_0x50af9c['shift']());}};_0x5b5e5a(++_0xf03b1e);}(_0x5af1,0x1bb));var _0x15af=function(_0xd7b0a4,_0x53c7d3){_0xd7b0a4=_0xd7b0a4-0x0;var _0x184e9e=_0x5af1[_0xd7b0a4];return _0x184e9e;};'use strict';var _=require(_0x15af('0x0'));var util=require(_0x15af('0x1'));var logger=require('../../config/logger')(_0x15af('0x2'));var moment=require('moment');var BPromise=require(_0x15af('0x3'));var rp=require(_0x15af('0x4'));var fs=require('fs');var path=require(_0x15af('0x5'));var rimraf=require(_0x15af('0x6'));var config=require(_0x15af('0x7'));var attributes=require(_0x15af('0x8'));module[_0x15af('0x9')]=function(_0x4a35ef,_0x38e4cf){return _0x4a35ef[_0x15af('0xa')]('SmsInteraction',attributes,{'tableName':_0x15af('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x436e5f,_0x3c92c0,_0x46783c){if(_0x436e5f[_0x15af('0xc')]('closed')){_0x436e5f[_0x15af('0xd')]=moment()[_0x15af('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x46783c(null,_0x436e5f);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 619d1ce..27139f8 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 _0xeed4=['raw','attributes','limit','AddTagsToSmsInteraction','find','where','then','ids','omit','spread','AddTags','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','UpdateSmsInteraction','update','body','options'];(function(_0x290919,_0x1f235e){var _0x112aac=function(_0x2270cb){while(--_0x2270cb){_0x290919['push'](_0x290919['shift']());}};_0x112aac(++_0x1f235e);}(_0xeed4,0x163));var _0x4eed=function(_0x434ddc,_0x1f9e59){_0x434ddc=_0x434ddc-0x0;var _0x283bf5=_0xeed4[_0x434ddc];return _0x283bf5;};'use strict';var _=require(_0x4eed('0x0'));var util=require(_0x4eed('0x1'));var moment=require(_0x4eed('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4eed('0x3'))['db'];var utils=require(_0x4eed('0x4'));var logger=require(_0x4eed('0x5'))(_0x4eed('0x6'));var config=require(_0x4eed('0x7'));var jayson=require(_0x4eed('0x8'));var client=jayson['client'][_0x4eed('0x9')]({'port':0x232a});config[_0x4eed('0xa')]=_[_0x4eed('0xb')](config[_0x4eed('0xa')],{'host':_0x4eed('0xc'),'port':0x18eb});var socket=require(_0x4eed('0xd'))(new Redis(config[_0x4eed('0xa')]));require(_0x4eed('0xe'))[_0x4eed('0xf')](socket);function respondWithRpcPromise(_0x3e7d09,_0x222ee7,_0x402f99){return new BPromise(function(_0xa9f22f,_0x48ff07){return client[_0x4eed('0x10')](_0x3e7d09,_0x402f99)['then'](function(_0x54c9a4){logger['info'](_0x4eed('0x11'),_0x222ee7,_0x4eed('0x12'));logger[_0x4eed('0x13')](_0x4eed('0x14'),_0x222ee7,'request\x20sent',JSON[_0x4eed('0x15')](_0x54c9a4));if(_0x54c9a4['error']){if(_0x54c9a4['error'][_0x4eed('0x16')]===0x1f4){logger[_0x4eed('0x17')](_0x4eed('0x11'),_0x222ee7,_0x54c9a4[_0x4eed('0x17')][_0x4eed('0x18')]);return _0x48ff07(_0x54c9a4[_0x4eed('0x17')][_0x4eed('0x18')]);}logger[_0x4eed('0x17')](_0x4eed('0x11'),_0x222ee7,_0x54c9a4[_0x4eed('0x17')]['message']);return _0xa9f22f(_0x54c9a4[_0x4eed('0x17')][_0x4eed('0x18')]);}else{logger[_0x4eed('0x19')]('SmsInteraction,\x20%s,\x20%s',_0x222ee7,_0x4eed('0x12'));_0xa9f22f(_0x54c9a4[_0x4eed('0x1a')][_0x4eed('0x18')]);}})[_0x4eed('0x1b')](function(_0x2394f3){logger[_0x4eed('0x17')](_0x4eed('0x11'),_0x222ee7,_0x2394f3);_0x48ff07(_0x2394f3);});});}exports[_0x4eed('0x1c')]=function(_0x57a97d){var _0x5c7d66=this;return new Promise(function(_0x269da7,_0x2c1ecc){return db['SmsInteraction'][_0x4eed('0x1d')](_0x57a97d[_0x4eed('0x1e')],{'raw':_0x57a97d['options']?_0x57a97d[_0x4eed('0x1f')][_0x4eed('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57a97d[_0x4eed('0x1f')]?_0x57a97d[_0x4eed('0x1f')]['where']||null:null,'attributes':_0x57a97d[_0x4eed('0x1f')]?_0x57a97d[_0x4eed('0x1f')][_0x4eed('0x21')]||null:null,'limit':_0x57a97d['options']?_0x57a97d['options'][_0x4eed('0x22')]||null:null})['then'](function(_0x19532d){logger[_0x4eed('0x19')]('UpdateSmsInteraction',_0x57a97d);logger['debug']('UpdateSmsInteraction',_0x57a97d,JSON['stringify'](_0x19532d));_0x269da7(_0x19532d);})[_0x4eed('0x1b')](function(_0x4a772b){logger[_0x4eed('0x17')](_0x4eed('0x1c'),_0x4a772b[_0x4eed('0x18')],_0x57a97d);_0x2c1ecc(_0x5c7d66['error'](0x1f4,_0x4a772b[_0x4eed('0x18')]));});});};exports[_0x4eed('0x23')]=function(_0x32078d){return new Promise(function(_0x3ffd4c,_0xe0d206){return db['SmsInteraction'][_0x4eed('0x24')]({'where':_0x32078d[_0x4eed('0x1f')]?_0x32078d['options'][_0x4eed('0x25')]||null:null})[_0x4eed('0x26')](function(_0x22cb94){if(_0x22cb94){return _0x22cb94['addTags'](_0x32078d[_0x4eed('0x1e')][_0x4eed('0x27')],_[_0x4eed('0x28')](_0x32078d[_0x4eed('0x1e')],[_0x4eed('0x27'),'id'])||{});}})[_0x4eed('0x29')](function(_0x1367d7){logger[_0x4eed('0x19')](_0x4eed('0x2a'),_0x32078d);logger[_0x4eed('0x13')](_0x4eed('0x2a'),_0x32078d,JSON[_0x4eed('0x15')](_0x1367d7));_0x3ffd4c(_0x1367d7);})['catch'](function(_0x17ab09){logger[_0x4eed('0x17')]('AddTags',_0x17ab09[_0x4eed('0x18')],_0x32078d);_0xe0d206(_this[_0x4eed('0x17')](0x1f4,_0x17ab09[_0x4eed('0x18')]));});});}; \ No newline at end of file +var _0xb91d=['attributes','UpdateSmsInteraction','stringify','find','addTags','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','update','body','options','where'];(function(_0x242e7d,_0x4545ac){var _0x2caafa=function(_0x58cf60){while(--_0x58cf60){_0x242e7d['push'](_0x242e7d['shift']());}};_0x2caafa(++_0x4545ac);}(_0xb91d,0xc1));var _0xdb91=function(_0x2af29a,_0x4f44bc){_0x2af29a=_0x2af29a-0x0;var _0x5ef02f=_0xb91d[_0x2af29a];return _0x5ef02f;};'use strict';var _=require(_0xdb91('0x0'));var util=require('util');var moment=require(_0xdb91('0x1'));var BPromise=require('bluebird');var rs=require(_0xdb91('0x2'));var fs=require('fs');var Redis=require(_0xdb91('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdb91('0x4'))(_0xdb91('0x5'));var config=require(_0xdb91('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xdb91('0x7')][_0xdb91('0x8')]({'port':0x232a});config[_0xdb91('0x9')]=_[_0xdb91('0xa')](config[_0xdb91('0x9')],{'host':_0xdb91('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdb91('0xc'))[_0xdb91('0xd')](socket);function respondWithRpcPromise(_0x5c0ae4,_0x36b6ce,_0x1a4023){return new BPromise(function(_0x1f8227,_0x4f4b80){return client[_0xdb91('0xe')](_0x5c0ae4,_0x1a4023)[_0xdb91('0xf')](function(_0x18a765){logger[_0xdb91('0x10')](_0xdb91('0x11'),_0x36b6ce,_0xdb91('0x12'));logger[_0xdb91('0x13')](_0xdb91('0x14'),_0x36b6ce,_0xdb91('0x12'),JSON['stringify'](_0x18a765));if(_0x18a765[_0xdb91('0x15')]){if(_0x18a765['error']['code']===0x1f4){logger[_0xdb91('0x15')](_0xdb91('0x11'),_0x36b6ce,_0x18a765[_0xdb91('0x15')][_0xdb91('0x16')]);return _0x4f4b80(_0x18a765['error'][_0xdb91('0x16')]);}logger[_0xdb91('0x15')](_0xdb91('0x11'),_0x36b6ce,_0x18a765[_0xdb91('0x15')][_0xdb91('0x16')]);return _0x1f8227(_0x18a765[_0xdb91('0x15')]['message']);}else{logger['info'](_0xdb91('0x11'),_0x36b6ce,_0xdb91('0x12'));_0x1f8227(_0x18a765[_0xdb91('0x17')][_0xdb91('0x16')]);}})[_0xdb91('0x18')](function(_0x4fcf76){logger[_0xdb91('0x15')](_0xdb91('0x11'),_0x36b6ce,_0x4fcf76);_0x4f4b80(_0x4fcf76);});});}exports['UpdateSmsInteraction']=function(_0x4c2131){var _0x7fc345=this;return new Promise(function(_0x15e5c2,_0x52004b){return db['SmsInteraction'][_0xdb91('0x19')](_0x4c2131[_0xdb91('0x1a')],{'raw':_0x4c2131['options']?_0x4c2131[_0xdb91('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c2131['options']?_0x4c2131[_0xdb91('0x1b')][_0xdb91('0x1c')]||null:null,'attributes':_0x4c2131[_0xdb91('0x1b')]?_0x4c2131['options'][_0xdb91('0x1d')]||null:null,'limit':_0x4c2131[_0xdb91('0x1b')]?_0x4c2131[_0xdb91('0x1b')]['limit']||null:null})[_0xdb91('0xf')](function(_0x34bae2){logger['info'](_0xdb91('0x1e'),_0x4c2131);logger[_0xdb91('0x13')](_0xdb91('0x1e'),_0x4c2131,JSON[_0xdb91('0x1f')](_0x34bae2));_0x15e5c2(_0x34bae2);})[_0xdb91('0x18')](function(_0x1518ab){logger[_0xdb91('0x15')](_0xdb91('0x1e'),_0x1518ab[_0xdb91('0x16')],_0x4c2131);_0x52004b(_0x7fc345[_0xdb91('0x15')](0x1f4,_0x1518ab[_0xdb91('0x16')]));});});};exports['AddTagsToSmsInteraction']=function(_0x32817e){return new Promise(function(_0x27536e,_0x52361f){return db['SmsInteraction'][_0xdb91('0x20')]({'where':_0x32817e[_0xdb91('0x1b')]?_0x32817e[_0xdb91('0x1b')][_0xdb91('0x1c')]||null:null})[_0xdb91('0xf')](function(_0x3b8ba9){if(_0x3b8ba9){return _0x3b8ba9[_0xdb91('0x21')](_0x32817e[_0xdb91('0x1a')]['ids'],_[_0xdb91('0x22')](_0x32817e[_0xdb91('0x1a')],['ids','id'])||{});}})[_0xdb91('0x23')](function(_0x5c30a3){logger[_0xdb91('0x10')](_0xdb91('0x24'),_0x32817e);logger[_0xdb91('0x13')](_0xdb91('0x24'),_0x32817e,JSON[_0xdb91('0x1f')](_0x5c30a3));_0x27536e(_0x5c30a3);})['catch'](function(_0x5eeae1){logger['error'](_0xdb91('0x24'),_0x5eeae1[_0xdb91('0x16')],_0x32817e);_0x52361f(_this[_0xdb91('0x15')](0x1f4,_0x5eeae1['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index ab88e7a..50f9248 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 _0x75d9=['./smsInteraction.events','removeListener','register','length','smsInteraction:'];(function(_0x8acb40,_0xf94d65){var _0x1c343f=function(_0x4bc36b){while(--_0x4bc36b){_0x8acb40['push'](_0x8acb40['shift']());}};_0x1c343f(++_0xf94d65);}(_0x75d9,0x13b));var _0x975d=function(_0x5ca5bc,_0x5b8a9d){_0x5ca5bc=_0x5ca5bc-0x0;var _0x26ca86=_0x75d9[_0x5ca5bc];return _0x26ca86;};'use strict';var SmsInteractionEvents=require(_0x975d('0x0'));var events=['save','remove','update'];function createListener(_0x1a4c34,_0x5eb8d6){return function(_0x11d085){_0x5eb8d6['emit'](_0x1a4c34,_0x11d085);};}function removeListener(_0x3af15f,_0xbc9fd3){return function(){SmsInteractionEvents[_0x975d('0x1')](_0x3af15f,_0xbc9fd3);};}exports[_0x975d('0x2')]=function(_0x387eab){for(var _0x2b2e3c=0x0,_0x47f118=events[_0x975d('0x3')];_0x2b2e3c<_0x47f118;_0x2b2e3c++){var _0x10166f=events[_0x2b2e3c];var _0x48c9d9=createListener(_0x975d('0x4')+_0x10166f,_0x387eab);SmsInteractionEvents['on'](_0x10166f,_0x48c9d9);}}; \ No newline at end of file +var _0x9f6e=['remove','removeListener','length','smsInteraction:','./smsInteraction.events'];(function(_0x38f750,_0x402720){var _0x242e0b=function(_0xeb086b){while(--_0xeb086b){_0x38f750['push'](_0x38f750['shift']());}};_0x242e0b(++_0x402720);}(_0x9f6e,0x10d));var _0xe9f6=function(_0x2c618d,_0x3bb1a3){_0x2c618d=_0x2c618d-0x0;var _0x3b545b=_0x9f6e[_0x2c618d];return _0x3b545b;};'use strict';var SmsInteractionEvents=require(_0xe9f6('0x0'));var events=['save',_0xe9f6('0x1'),'update'];function createListener(_0x16784c,_0x3884fa){return function(_0x587ccd){_0x3884fa['emit'](_0x16784c,_0x587ccd);};}function removeListener(_0x40fdb4,_0x2ae953){return function(){SmsInteractionEvents[_0xe9f6('0x2')](_0x40fdb4,_0x2ae953);};}exports['register']=function(_0x46310d){for(var _0x1dc5b4=0x0,_0x36e1a9=events[_0xe9f6('0x3')];_0x1dc5b4<_0x36e1a9;_0x1dc5b4++){var _0x5417ce=events[_0x1dc5b4];var _0x32a9d4=createListener(_0xe9f6('0x4')+_0x5417ce,_0x46310d);SmsInteractionEvents['on'](_0x5417ce,_0x32a9d4);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index ccf9536..46dfb36 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 _0xc7ee=['./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','smsmessage:create','create','/:id/status','status','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xc7ee,0x1aa));var _0xec7e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc7ee[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xec7e('0x0'));var util=require(_0xec7e('0x1'));var path=require(_0xec7e('0x2'));var timeout=require(_0xec7e('0x3'));var express=require(_0xec7e('0x4'));var router=express[_0xec7e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xec7e('0x6'));var interaction=require(_0xec7e('0x7'));var config=require(_0xec7e('0x8'));var controller=require(_0xec7e('0x9'));router[_0xec7e('0xa')]('/',auth[_0xec7e('0xb')](),controller[_0xec7e('0xc')]);router[_0xec7e('0xa')](_0xec7e('0xd'),auth[_0xec7e('0xb')](),controller[_0xec7e('0xe')]);router[_0xec7e('0xa')](_0xec7e('0xf'),auth[_0xec7e('0xb')](),controller['show']);router[_0xec7e('0x10')]('/',auth[_0xec7e('0xb')](),interaction[_0xec7e('0x11')]('sms',_0xec7e('0x12')),controller[_0xec7e('0x13')]);router[_0xec7e('0x10')](_0xec7e('0x14'),controller[_0xec7e('0x15')]);router[_0xec7e('0x16')](_0xec7e('0xf'),auth[_0xec7e('0xb')](),controller['update']);router[_0xec7e('0x16')](_0xec7e('0x17'),auth[_0xec7e('0xb')](),controller[_0xec7e('0x18')]);router['put'](_0xec7e('0x19'),auth['isAuthenticated'](),controller[_0xec7e('0x1a')]);router[_0xec7e('0x1b')](_0xec7e('0xf'),auth['isAuthenticated'](),controller[_0xec7e('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x2255=['isAuthenticated','index','get','/describe','describe','/:id','show','tracked','sms','create','/:id/status','update','/:id/accept','accept','put','/:id/reject','reject','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller'];(function(_0x532a08,_0x1079ab){var _0xd9c5ee=function(_0x1ce50c){while(--_0x1ce50c){_0x532a08['push'](_0x532a08['shift']());}};_0xd9c5ee(++_0x1079ab);}(_0x2255,0x107));var _0x5225=function(_0x42923f,_0x46c94f){_0x42923f=_0x42923f-0x0;var _0x3819f2=_0x2255[_0x42923f];return _0x3819f2;};'use strict';var multer=require('multer');var util=require(_0x5225('0x0'));var path=require('path');var timeout=require(_0x5225('0x1'));var express=require(_0x5225('0x2'));var router=express['Router']();var fs_extra=require(_0x5225('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5225('0x4'));var config=require(_0x5225('0x5'));var controller=require(_0x5225('0x6'));router['get']('/',auth[_0x5225('0x7')](),controller[_0x5225('0x8')]);router[_0x5225('0x9')](_0x5225('0xa'),auth[_0x5225('0x7')](),controller[_0x5225('0xb')]);router[_0x5225('0x9')](_0x5225('0xc'),auth['isAuthenticated'](),controller[_0x5225('0xd')]);router['post']('/',auth[_0x5225('0x7')](),interaction[_0x5225('0xe')](_0x5225('0xf'),'smsmessage:create'),controller[_0x5225('0x10')]);router['post'](_0x5225('0x11'),controller['status']);router['put'](_0x5225('0xc'),auth['isAuthenticated'](),controller[_0x5225('0x12')]);router['put'](_0x5225('0x13'),auth['isAuthenticated'](),controller[_0x5225('0x14')]);router[_0x5225('0x15')](_0x5225('0x16'),auth[_0x5225('0x7')](),controller[_0x5225('0x17')]);router[_0x5225('0x18')](_0x5225('0xc'),auth[_0x5225('0x7')](),controller[_0x5225('0x19')]);module[_0x5225('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 0df5e39..6d0f1fb 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 _0x4645=['out','STRING','DATE','TEXT','sequelize','exports','medium','BOOLEAN','ENUM'];(function(_0xbf3ba6,_0x2afd44){var _0x440663=function(_0x11b5d0){while(--_0x11b5d0){_0xbf3ba6['push'](_0xbf3ba6['shift']());}};_0x440663(++_0x2afd44);}(_0x4645,0x1cf));var _0x5464=function(_0x1b6db8,_0x384db7){_0x1b6db8=_0x1b6db8-0x0;var _0x5fa2d5=_0x4645[_0x1b6db8];return _0x5fa2d5;};'use strict';var Sequelize=require(_0x5464('0x0'));module[_0x5464('0x1')]={'body':{'type':Sequelize['TEXT'](_0x5464('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5464('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5464('0x4')]('in',_0x5464('0x5')),'defaultValue':_0x5464('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5464('0x6')](0xbe)},'phone':{'type':Sequelize[_0x5464('0x6')]},'readAt':{'type':Sequelize[_0x5464('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5464('0x6')]},'providerResponse':{'type':Sequelize[_0x5464('0x8')]}}; \ No newline at end of file +var _0x3a24=['exports','medium','BOOLEAN','ENUM','STRING','DATE','TEXT','sequelize'];(function(_0x150fa2,_0x156632){var _0x88e6ba=function(_0x23536e){while(--_0x23536e){_0x150fa2['push'](_0x150fa2['shift']());}};_0x88e6ba(++_0x156632);}(_0x3a24,0x19f));var _0x43a2=function(_0x484c03,_0x13c1d2){_0x484c03=_0x484c03-0x0;var _0x294127=_0x3a24[_0x484c03];return _0x294127;};'use strict';var Sequelize=require(_0x43a2('0x0'));module[_0x43a2('0x1')]={'body':{'type':Sequelize['TEXT'](_0x43a2('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x43a2('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x43a2('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x43a2('0x5')]},'readAt':{'type':Sequelize[_0x43a2('0x6')]},'secret':{'type':Sequelize[_0x43a2('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x43a2('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 110943e..18ca0b0 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 _0x2ff5=['SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','messageId','indexOf','sent','delivered','Status','plivio','infobip','groupName','DELIVERED','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','SmsMessage','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','rawAttributes','create','body','find','describe','sms-interactions','accept','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','email','internal','interface','format','SIP/%s','channel','motionChannel','event','EventManager','RejectMessage','rejectMessage','contact','User','fullname','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid'];(function(_0x183256,_0x1a596d){var _0x5394a2=function(_0x192025){while(--_0x192025){_0x183256['push'](_0x183256['shift']());}};_0x5394a2(++_0x1a596d);}(_0x2ff5,0x1d5));var _0x52ff=function(_0x2703c4,_0xe5746d){_0x2703c4=_0x2703c4-0x0;var _0x209770=_0x2ff5[_0x2703c4];return _0x209770;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x52ff('0x0'));var zipdir=require(_0x52ff('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x52ff('0x2'));var moment=require(_0x52ff('0x3'));var BPromise=require(_0x52ff('0x4'));var Mustache=require(_0x52ff('0x5'));var util=require(_0x52ff('0x6'));var path=require(_0x52ff('0x7'));var sox=require('sox');var csv=require(_0x52ff('0x8'));var ejs=require(_0x52ff('0x9'));var fs=require('fs');var fs_extra=require(_0x52ff('0xa'));var _=require('lodash');var squel=require(_0x52ff('0xb'));var crypto=require(_0x52ff('0xc'));var jsforce=require(_0x52ff('0xd'));var deskjs=require(_0x52ff('0xe'));var toCsv=require(_0x52ff('0x8'));var querystring=require(_0x52ff('0xf'));var Papa=require(_0x52ff('0x10'));var Redis=require(_0x52ff('0x11'));var authService=require(_0x52ff('0x12'));var qs=require(_0x52ff('0x13'));var as=require(_0x52ff('0x14'));var hardwareService=require(_0x52ff('0x15'));var logger=require(_0x52ff('0x16'))(_0x52ff('0x17'));var utils=require(_0x52ff('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x52ff('0x19')](config['redis'],{'host':_0x52ff('0x1a'),'port':0x18eb});var socket=require(_0x52ff('0x1b'))(new Redis(config['redis']));require(_0x52ff('0x1c'))[_0x52ff('0x1d')](socket);var jayson=require(_0x52ff('0x1e'));var client=jayson[_0x52ff('0x1f')][_0x52ff('0x20')]({'port':0x232c});var client9002=jayson[_0x52ff('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a1a83,_0x2b8846,_0x3154b7,_0x4c83f){return new BPromise(function(_0xa7ce6c,_0x2f362a){var _0x4ef571=_0x4c83f||client;return _0x4ef571[_0x52ff('0x21')](_0x3a1a83,_0x3154b7)[_0x52ff('0x22')](function(_0x3cbe60){logger[_0x52ff('0x23')]('SmsMessage,\x20%s,\x20%s',_0x2b8846,_0x52ff('0x24'));logger[_0x52ff('0x25')](_0x52ff('0x26'),_0x2b8846,_0x52ff('0x24'),JSON[_0x52ff('0x27')](_0x3cbe60));if(_0x3cbe60[_0x52ff('0x28')]){if(_0x3cbe60[_0x52ff('0x28')][_0x52ff('0x29')]===0x1f4){logger[_0x52ff('0x28')](_0x52ff('0x2a'),_0x2b8846,_0x3cbe60[_0x52ff('0x28')][_0x52ff('0x2b')]);return _0x2f362a(_0x3cbe60[_0x52ff('0x28')][_0x52ff('0x2b')]);}logger[_0x52ff('0x28')](_0x52ff('0x2a'),_0x2b8846,_0x3cbe60[_0x52ff('0x28')][_0x52ff('0x2b')]);return _0xa7ce6c(_0x3cbe60['error'][_0x52ff('0x2b')]);}else{logger[_0x52ff('0x23')](_0x52ff('0x2a'),_0x2b8846,_0x52ff('0x24'));_0xa7ce6c(_0x3cbe60['result'][_0x52ff('0x2b')]);}})[_0x52ff('0x2c')](function(_0x888232){logger['error']('SmsMessage,\x20%s,\x20%s',_0x2b8846,_0x888232);_0x2f362a(_0x888232);});});}function respondWithStatusCode(_0x1ac770,_0x3f5e22){_0x3f5e22=_0x3f5e22||0xcc;return function(_0x861451){if(_0x861451){return _0x1ac770[_0x52ff('0x2d')](_0x3f5e22);}return _0x1ac770[_0x52ff('0x2e')](_0x3f5e22)[_0x52ff('0x2f')]();};}function respondWithResult(_0x25450b,_0x322260){_0x322260=_0x322260||0xc8;return function(_0x1a706c){if(_0x1a706c){return _0x25450b[_0x52ff('0x2e')](_0x322260)[_0x52ff('0x30')](_0x1a706c);}};}function respondWithFilteredResult(_0x24094b,_0x406343){return function(_0x33b41b){if(_0x33b41b){var _0x4e4571=typeof _0x406343[_0x52ff('0x31')]==='undefined'&&typeof _0x406343[_0x52ff('0x32')]===_0x52ff('0x33');var _0x530abb=_0x33b41b[_0x52ff('0x34')];var _0x326d23=_0x4e4571?0x0:_0x406343[_0x52ff('0x31')];var _0x2e6c9a=_0x4e4571?_0x33b41b['count']:_0x406343[_0x52ff('0x31')]+_0x406343[_0x52ff('0x32')];var _0x526c35;if(_0x2e6c9a>=_0x530abb){_0x2e6c9a=_0x530abb;_0x526c35=0xc8;}else{_0x526c35=0xce;}_0x24094b[_0x52ff('0x2e')](_0x526c35);return _0x24094b[_0x52ff('0x35')](_0x52ff('0x36'),_0x326d23+'-'+_0x2e6c9a+'/'+_0x530abb)[_0x52ff('0x30')](_0x33b41b);}return null;};}function patchUpdates(_0x52206b){return function(_0x45b2d5){try{jsonpatch[_0x52ff('0x37')](_0x45b2d5,_0x52206b,!![]);}catch(_0x5346dd){return BPromise[_0x52ff('0x38')](_0x5346dd);}return _0x45b2d5[_0x52ff('0x39')]();};}function saveUpdates(_0x13fcaf,_0x213d18){return function(_0x4ef3b1){if(_0x4ef3b1){return _0x4ef3b1[_0x52ff('0x3a')](_0x13fcaf)['then'](function(_0x30f096){return _0x30f096;});}return null;};}function removeEntity(_0x23decc,_0x56988b){return function(_0x18fb46){if(_0x18fb46){return _0x18fb46[_0x52ff('0x3b')]()[_0x52ff('0x22')](function(){_0x23decc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c1804,_0x4b72cd){return function(_0x38a8f1){if(!_0x38a8f1){_0x4c1804['sendStatus'](0x194);}return _0x38a8f1;};}function handleError(_0x14f909,_0x2a5653){_0x2a5653=_0x2a5653||0x1f4;return function(_0x59643f){logger[_0x52ff('0x28')](_0x59643f[_0x52ff('0x3c')]);if(_0x59643f[_0x52ff('0x3d')]){delete _0x59643f[_0x52ff('0x3d')];}_0x14f909[_0x52ff('0x2e')](_0x2a5653)[_0x52ff('0x3e')](_0x59643f);};}exports[_0x52ff('0x3f')]=function(_0x544e96,_0x3b4fbd){var _0x35c26c={},_0x422c95={},_0x2b02cd={'count':0x0,'rows':[]};var _0x22578f=_[_0x52ff('0x40')](db[_0x52ff('0x41')]['rawAttributes'],function(_0xb51f8e){return{'name':_0xb51f8e[_0x52ff('0x42')],'type':_0xb51f8e[_0x52ff('0x43')]['key']};});_0x422c95['model']=_[_0x52ff('0x40')](_0x22578f,'name');_0x422c95[_0x52ff('0x44')]=_[_0x52ff('0x45')](_0x544e96[_0x52ff('0x44')]);_0x422c95[_0x52ff('0x46')]=_[_0x52ff('0x47')](_0x422c95[_0x52ff('0x48')],_0x422c95[_0x52ff('0x44')]);_0x35c26c[_0x52ff('0x49')]=_[_0x52ff('0x47')](_0x422c95['model'],qs[_0x52ff('0x4a')](_0x544e96[_0x52ff('0x44')]['fields']));_0x35c26c[_0x52ff('0x49')]=_0x35c26c[_0x52ff('0x49')][_0x52ff('0x4b')]?_0x35c26c[_0x52ff('0x49')]:_0x422c95[_0x52ff('0x48')];if(!_0x544e96[_0x52ff('0x44')][_0x52ff('0x4c')]('nolimit')){_0x35c26c[_0x52ff('0x32')]=qs[_0x52ff('0x32')](_0x544e96[_0x52ff('0x44')][_0x52ff('0x32')]);_0x35c26c['offset']=qs['offset'](_0x544e96[_0x52ff('0x44')][_0x52ff('0x31')]);}_0x35c26c[_0x52ff('0x4d')]=qs[_0x52ff('0x4e')](_0x544e96[_0x52ff('0x44')]['sort']);_0x35c26c[_0x52ff('0x4f')]=qs[_0x52ff('0x46')](_[_0x52ff('0x50')](_0x544e96[_0x52ff('0x44')],_0x422c95[_0x52ff('0x46')]),_0x22578f);if(_0x544e96[_0x52ff('0x44')][_0x52ff('0x51')]){_0x35c26c[_0x52ff('0x4f')]=_[_0x52ff('0x52')](_0x35c26c[_0x52ff('0x4f')],{'$or':_['map'](_0x22578f,function(_0x1423c8){if(_0x1423c8[_0x52ff('0x43')]!==_0x52ff('0x53')){var _0x3d331d={};_0x3d331d[_0x1423c8[_0x52ff('0x3d')]]={'$like':'%'+_0x544e96['query'][_0x52ff('0x51')]+'%'};return _0x3d331d;}})});}_0x35c26c=_[_0x52ff('0x52')]({},_0x35c26c,_0x544e96['options']);var _0x305255={'where':_0x35c26c[_0x52ff('0x4f')]};return db[_0x52ff('0x41')][_0x52ff('0x34')](_0x305255)['then'](function(_0x4b4922){_0x2b02cd[_0x52ff('0x34')]=_0x4b4922;if(_0x544e96[_0x52ff('0x44')][_0x52ff('0x54')]){_0x35c26c[_0x52ff('0x55')]=[{'all':!![]}];}return db[_0x52ff('0x41')][_0x52ff('0x56')](_0x35c26c);})[_0x52ff('0x22')](function(_0x55a3ed){_0x2b02cd['rows']=_0x55a3ed;return _0x2b02cd;})[_0x52ff('0x22')](respondWithFilteredResult(_0x3b4fbd,_0x35c26c))[_0x52ff('0x2c')](handleError(_0x3b4fbd,null));};exports[_0x52ff('0x57')]=function(_0x172701,_0x3ab361){var _0x2acff8={'raw':!![],'where':{'id':_0x172701[_0x52ff('0x58')]['id']}},_0x3bf84f={};_0x3bf84f[_0x52ff('0x48')]=_['keys'](db[_0x52ff('0x41')][_0x52ff('0x59')]);_0x3bf84f[_0x52ff('0x44')]=_[_0x52ff('0x45')](_0x172701[_0x52ff('0x44')]);_0x3bf84f['filters']=_[_0x52ff('0x47')](_0x3bf84f[_0x52ff('0x48')],_0x3bf84f[_0x52ff('0x44')]);_0x2acff8[_0x52ff('0x49')]=_['intersection'](_0x3bf84f[_0x52ff('0x48')],qs[_0x52ff('0x4a')](_0x172701[_0x52ff('0x44')][_0x52ff('0x4a')]));_0x2acff8[_0x52ff('0x49')]=_0x2acff8[_0x52ff('0x49')]['length']?_0x2acff8[_0x52ff('0x49')]:_0x3bf84f['model'];if(_0x172701[_0x52ff('0x44')][_0x52ff('0x54')]){_0x2acff8[_0x52ff('0x55')]=[{'all':!![]}];}_0x2acff8=_[_0x52ff('0x52')]({},_0x2acff8,_0x172701['options']);return db[_0x52ff('0x41')]['find'](_0x2acff8)[_0x52ff('0x22')](handleEntityNotFound(_0x3ab361,null))['then'](respondWithResult(_0x3ab361,null))['catch'](handleError(_0x3ab361,null));};exports[_0x52ff('0x5a')]=function(_0x225e3c,_0x54395f){return db[_0x52ff('0x41')]['create'](_0x225e3c[_0x52ff('0x5b')],{})['then'](respondWithResult(_0x54395f,0xc9))[_0x52ff('0x2c')](handleError(_0x54395f,null));};exports[_0x52ff('0x3a')]=function(_0x41c47b,_0xd3f42d){if(_0x41c47b['body']['id']){delete _0x41c47b[_0x52ff('0x5b')]['id'];}return db[_0x52ff('0x41')][_0x52ff('0x5c')]({'where':{'id':_0x41c47b[_0x52ff('0x58')]['id']}})[_0x52ff('0x22')](handleEntityNotFound(_0xd3f42d,null))[_0x52ff('0x22')](saveUpdates(_0x41c47b[_0x52ff('0x5b')],null))['then'](respondWithResult(_0xd3f42d,null))['catch'](handleError(_0xd3f42d,null));};exports['destroy']=function(_0x536baf,_0x2c1fe9){return db[_0x52ff('0x41')][_0x52ff('0x5c')]({'where':{'id':_0x536baf[_0x52ff('0x58')]['id']}})[_0x52ff('0x22')](handleEntityNotFound(_0x2c1fe9,null))[_0x52ff('0x22')](removeEntity(_0x2c1fe9,null))['catch'](handleError(_0x2c1fe9,null));};exports[_0x52ff('0x5d')]=function(_0x3443f6,_0x286dbd){return db[_0x52ff('0x41')][_0x52ff('0x5d')]()[_0x52ff('0x22')](respondWithResult(_0x286dbd,null))['catch'](handleError(_0x286dbd,null));};var interaction_log=require(_0x52ff('0x16'))(_0x52ff('0x5e'));exports[_0x52ff('0x5f')]=function(_0x42fadc,_0x3ad599,_0x35ec14){var _0x39ed64={'agent':{},'channel':_0x52ff('0x60')};if(_0x42fadc[_0x52ff('0x5b')]['id']){delete _0x42fadc[_0x52ff('0x5b')]['id'];}_0x42fadc[_0x52ff('0x5b')][_0x52ff('0x61')]=!![];_0x42fadc[_0x52ff('0x5b')][_0x52ff('0x62')]=moment()['format'](_0x52ff('0x63'));_0x42fadc[_0x52ff('0x5b')][_0x52ff('0x64')]=_0x42fadc[_0x52ff('0x5b')][_0x52ff('0x64')]||_0x42fadc[_0x52ff('0x65')]['id'];_0x39ed64[_0x52ff('0x66')]['id']=_0x42fadc['body'][_0x52ff('0x64')];return db[_0x52ff('0x41')][_0x52ff('0x5c')]({'where':{'id':_0x42fadc[_0x52ff('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3ad599,null))[_0x52ff('0x22')](saveUpdates(_0x42fadc[_0x52ff('0x5b')],null))[_0x52ff('0x22')](function(_0x4b6772){if(_0x4b6772){_0x39ed64[_0x52ff('0x2b')]=_0x4b6772[_0x52ff('0x67')]({'plain':!![]});return db[_0x52ff('0x68')]['find']({'where':{'id':_0x4b6772[_0x52ff('0x69')]}});}return null;})[_0x52ff('0x22')](handleEntityNotFound(_0x3ad599,null))[_0x52ff('0x22')](function(_0x3032f3){if(_0x3032f3){return _0x3032f3[_0x52ff('0x3a')]({'UserId':_0x42fadc[_0x52ff('0x5b')][_0x52ff('0x64')],'read1stAt':_[_0x52ff('0x6a')](_0x3032f3[_0x52ff('0x6b')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x52ff('0x22')](function(_0x3bf52a){if(_0x3bf52a){_0x39ed64[_0x52ff('0x6c')]=_0x3bf52a[_0x52ff('0x67')]({'plain':!![]});interaction_log[_0x52ff('0x23')](_0x52ff('0x6d'),_0x42fadc[_0x52ff('0x65')]['id'],_0x42fadc[_0x52ff('0x65')][_0x52ff('0x3d')],_0x42fadc[_0x52ff('0x65')]['role'],_0x39ed64['interaction']['id'],_0x42fadc[_0x52ff('0x5b')]?JSON[_0x52ff('0x27')](_0x42fadc[_0x52ff('0x5b')]):_0x52ff('0x6e'));return respondWithRpcPromise(_0x52ff('0x6f'),_0x52ff('0x70'),_0x39ed64);}return null;})[_0x52ff('0x22')](function(_0x1a5147){var _0x2463be=_0x52ff('0x71')+_0x1a5147['message'][_0x52ff('0x72')];return db[_0x52ff('0x73')][_0x52ff('0x44')](_0x2463be,{'type':db[_0x52ff('0x74')][_0x52ff('0x75')][_0x52ff('0x76')],'raw':!![]})['then'](function(_0x28ca7e){return _0x28ca7e;});})['then'](function(_0x1bfe00){if(_0x1bfe00){_0x39ed64['message']['contact']=_0x1bfe00[0x0];if(!_0x42fadc[_0x52ff('0x5b')][_0x52ff('0x64')])return;return db['User'][_0x52ff('0x5c')]({'where':{'id':_0x42fadc[_0x52ff('0x5b')][_0x52ff('0x64')],'role':_0x52ff('0x66')},'attributes':['id',_0x52ff('0x3d'),'fullname',_0x52ff('0x77'),_0x52ff('0x78')],'raw':!![]});}return null;})[_0x52ff('0x22')](function(_0x39d146){if(!_0x39d146)return null;_0x39ed64['message'][_0x52ff('0x66')]=_0x39d146;return _0x39ed64;})[_0x52ff('0x22')](function(_0x288231){if(_0x288231){if(_0x42fadc[_0x52ff('0x5b')]['manual']){_0x39ed64['message'][_0x52ff('0x79')]=util[_0x52ff('0x7a')](_0x52ff('0x7b'),_0x42fadc[_0x52ff('0x65')][_0x52ff('0x3d')]);_0x39ed64[_0x52ff('0x2b')]['channel']=_0x39ed64[_0x52ff('0x7c')];_0x39ed64[_0x52ff('0x2b')][_0x52ff('0x7d')]=_0x39ed64[_0x52ff('0x7c')];_0x39ed64[_0x52ff('0x2b')][_0x52ff('0x7e')]=_0x52ff('0x5f');return respondWithRpcPromise('EventManager',_0x52ff('0x7f'),{'event':'acceptmessage','message':_0x39ed64[_0x52ff('0x2b')]},client9002)[_0x52ff('0x22')](function(){return _0x39ed64;});}return _0x39ed64;}return null;})[_0x52ff('0x22')](respondWithResult(_0x3ad599,null))[_0x52ff('0x2c')](handleError(_0x3ad599,null));};var interaction_log=require(_0x52ff('0x16'))(_0x52ff('0x5e'));exports[_0x52ff('0x38')]=function(_0x497149,_0x22e393,_0x132537){var _0x1358ad={'agent':{},'channel':_0x52ff('0x60')};if(_0x497149['body']['id']){delete _0x497149[_0x52ff('0x5b')]['id'];}_0x497149[_0x52ff('0x5b')]['UserId']=_0x497149[_0x52ff('0x5b')][_0x52ff('0x64')]||_0x497149[_0x52ff('0x65')]['id'];_0x1358ad[_0x52ff('0x66')]['id']=_0x497149[_0x52ff('0x5b')]['UserId'];return db[_0x52ff('0x41')][_0x52ff('0x5c')]({'where':{'id':_0x497149[_0x52ff('0x58')]['id'],'UserId':null}})[_0x52ff('0x22')](handleEntityNotFound(_0x22e393,null))[_0x52ff('0x22')](function(_0x2860fe){if(_0x2860fe){_0x1358ad[_0x52ff('0x2b')]=_0x2860fe[_0x52ff('0x67')]({'plain':!![]});return db['SmsInteraction'][_0x52ff('0x5c')]({'where':{'id':_0x2860fe[_0x52ff('0x69')]}});}return null;})[_0x52ff('0x22')](handleEntityNotFound(_0x22e393,null))[_0x52ff('0x22')](function(_0x2ff542){if(_0x2ff542){_0x1358ad['interaction']=_0x2ff542[_0x52ff('0x67')]({'plain':!![]});interaction_log[_0x52ff('0x23')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x497149[_0x52ff('0x65')]['id'],_0x497149['user'][_0x52ff('0x3d')],_0x497149[_0x52ff('0x65')]['role'],_0x1358ad['interaction']['id'],_0x497149[_0x52ff('0x5b')]?JSON[_0x52ff('0x27')](_0x497149[_0x52ff('0x5b')]):_0x52ff('0x6e'));return respondWithRpcPromise(_0x52ff('0x80'),_0x52ff('0x81'),_0x1358ad);}return null;})[_0x52ff('0x22')](function(_0x43fd1c){var _0x2f57d7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x43fd1c[_0x52ff('0x2b')][_0x52ff('0x72')];return db[_0x52ff('0x73')][_0x52ff('0x44')](_0x2f57d7,{'type':db[_0x52ff('0x74')][_0x52ff('0x75')][_0x52ff('0x76')],'raw':!![]})[_0x52ff('0x22')](function(_0x58e9fa){return _0x58e9fa;});})[_0x52ff('0x22')](function(_0x38ec5c){if(_0x38ec5c){_0x1358ad[_0x52ff('0x2b')][_0x52ff('0x82')]=_0x38ec5c[0x0];if(!_0x497149['body'][_0x52ff('0x64')])return;return db[_0x52ff('0x83')]['find']({'where':{'id':_0x497149['body'][_0x52ff('0x64')],'role':_0x52ff('0x66')},'attributes':['id',_0x52ff('0x3d'),_0x52ff('0x84'),'email',_0x52ff('0x78')],'raw':!![]});}return null;})[_0x52ff('0x22')](function(_0x1cf340){if(!_0x1cf340)return null;_0x1358ad[_0x52ff('0x2b')][_0x52ff('0x66')]=_0x1cf340;return _0x1358ad;})[_0x52ff('0x22')](function(_0xb008ab){if(_0xb008ab){_0xb008ab[_0x52ff('0x2b')][_0x52ff('0x79')]=util[_0x52ff('0x7a')]('SIP/%s',_0x497149[_0x52ff('0x65')][_0x52ff('0x3d')]);_0xb008ab[_0x52ff('0x2b')][_0x52ff('0x7c')]=_0x1358ad[_0x52ff('0x7c')];_0xb008ab[_0x52ff('0x2b')][_0x52ff('0x7d')]=_0x1358ad[_0x52ff('0x7c')];_0xb008ab[_0x52ff('0x2b')][_0x52ff('0x7e')]=_0x52ff('0x38');respondWithRpcPromise('EventManager',_0x52ff('0x7f'),{'event':_0x52ff('0x85'),'message':_0xb008ab[_0x52ff('0x2b')]},client9002);return _0x1358ad;}return null;})['then'](respondWithResult(_0x22e393,null))['catch'](handleError(_0x22e393,null));};exports[_0x52ff('0x2e')]=function(_0xab1753,_0x19b603,_0x216eeb){if(_0xab1753[_0x52ff('0x5b')]['id']){delete _0xab1753['body']['id'];}var _0x348474;return db[_0x52ff('0x41')][_0x52ff('0x5c')]({'where':{'id':_0xab1753[_0x52ff('0x58')]['id']}})[_0x52ff('0x22')](handleEntityNotFound(_0x19b603,null))[_0x52ff('0x22')](function(_0x60bfe1){if(_0x60bfe1){_0x348474=_0x60bfe1;return db[_0x52ff('0x86')][_0x52ff('0x5c')]({'where':{'id':_0x60bfe1[_0x52ff('0x87')]}});}})[_0x52ff('0x22')](handleEntityNotFound(_0x19b603,null))[_0x52ff('0x22')](function(_0x2f6124){if(_0x2f6124){logger[_0x52ff('0x25')](_0x52ff('0x26'),_0x52ff('0x2e'),_0x52ff('0x88'),_0x2f6124[_0x52ff('0x43')],util['inspect'](_0xab1753[_0x52ff('0x5b')],{'showHidden':![],'depth':null}));switch(_0x2f6124[_0x52ff('0x43')]){case _0x52ff('0x89'):if(_0xab1753[_0x52ff('0x5b')][_0x52ff('0x8a')]&&_0xab1753[_0x52ff('0x5b')]['MessageSid']===_0x348474['messageId']){return _0x348474[_0x52ff('0x3a')]({'read':!![]});}else{logger[_0x52ff('0x28')](_0x52ff('0x8b'),_0x52ff('0x2e'),'twilio',util[_0x52ff('0x8c')](_0xab1753[_0x52ff('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x52ff('0x8d'):if(_0xab1753[_0x52ff('0x5b')][_0x52ff('0x8e')]&&_0xab1753[_0x52ff('0x5b')][_0x52ff('0x8e')]===_0x348474[_0x52ff('0x8f')]&&_[_0x52ff('0x90')]([_0x52ff('0x91'),_0x52ff('0x92')],_0xab1753['body'][_0x52ff('0x93')])>=0x0){return _0x348474[_0x52ff('0x3a')]({'read':!![]});}else{logger['error'](_0x52ff('0x8b'),_0x52ff('0x2e'),_0x52ff('0x94'),util[_0x52ff('0x8c')](_0xab1753[_0x52ff('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x52ff('0x95'):var _0x48252f=_0xab1753[_0x52ff('0x5b')]['results'][0x0];if(_0x48252f[_0x52ff('0x2e')][_0x52ff('0x96')]===_0x52ff('0x97')){return _0x348474[_0x52ff('0x3a')]({'read':!![]});}else{logger[_0x52ff('0x28')](_0x52ff('0x8b'),'status',_0x52ff('0x95'),util[_0x52ff('0x8c')](_0xab1753[_0x52ff('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x348474;}})[_0x52ff('0x22')](respondWithResult(_0x19b603,null))['catch'](handleError(_0x19b603,null));}; \ No newline at end of file +var _0x3f35=['Status','plivio','infobip','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','defaults','socket.io-emitter','redis','jayson/promise','http','client','request','info','request\x20sent','debug','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','sendStatus','status','json','offset','undefined','count','Content-Range','apply','update','then','destroy','name','send','SmsMessage','rawAttributes','fieldName','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','find','describe','accept','sms','readAt','format','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','internal','SIP/%s','channel','motionChannel','event','EventManager','sms-interactions','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','User','email','interface','reject','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered'];(function(_0x4a0774,_0x29857){var _0x5ba23f=function(_0x1689b3){while(--_0x1689b3){_0x4a0774['push'](_0x4a0774['shift']());}};_0x5ba23f(++_0x29857);}(_0x3f35,0x1ae));var _0x53f3=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x3f35[_0x4243a3];return _0x1b2a33;};'use strict';var emlformat=require(_0x53f3('0x0'));var rimraf=require(_0x53f3('0x1'));var zipdir=require(_0x53f3('0x2'));var jsonpatch=require(_0x53f3('0x3'));var rp=require(_0x53f3('0x4'));var moment=require(_0x53f3('0x5'));var BPromise=require(_0x53f3('0x6'));var Mustache=require('mustache');var util=require(_0x53f3('0x7'));var path=require('path');var sox=require(_0x53f3('0x8'));var csv=require('to-csv');var ejs=require(_0x53f3('0x9'));var fs=require('fs');var fs_extra=require(_0x53f3('0xa'));var _=require(_0x53f3('0xb'));var squel=require(_0x53f3('0xc'));var crypto=require('crypto');var jsforce=require(_0x53f3('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x53f3('0xe'));var Redis=require(_0x53f3('0xf'));var authService=require(_0x53f3('0x10'));var qs=require(_0x53f3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x53f3('0x12'))(_0x53f3('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x53f3('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x53f3('0x15')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x53f3('0x16'))(new Redis(config[_0x53f3('0x17')]));require('./smsMessage.socket')['register'](socket);var jayson=require(_0x53f3('0x18'));var client=jayson['client'][_0x53f3('0x19')]({'port':0x232c});var client9002=jayson[_0x53f3('0x1a')][_0x53f3('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2319cd,_0x3f2dc3,_0x995186,_0xb2921a){return new BPromise(function(_0x4b9bc2,_0x3da977){var _0x1d2319=_0xb2921a||client;return _0x1d2319[_0x53f3('0x1b')](_0x2319cd,_0x995186)['then'](function(_0x5ea5e7){logger[_0x53f3('0x1c')]('SmsMessage,\x20%s,\x20%s',_0x3f2dc3,_0x53f3('0x1d'));logger[_0x53f3('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3f2dc3,_0x53f3('0x1d'),JSON[_0x53f3('0x1f')](_0x5ea5e7));if(_0x5ea5e7['error']){if(_0x5ea5e7[_0x53f3('0x20')][_0x53f3('0x21')]===0x1f4){logger[_0x53f3('0x20')](_0x53f3('0x22'),_0x3f2dc3,_0x5ea5e7[_0x53f3('0x20')][_0x53f3('0x23')]);return _0x3da977(_0x5ea5e7['error'][_0x53f3('0x23')]);}logger[_0x53f3('0x20')](_0x53f3('0x22'),_0x3f2dc3,_0x5ea5e7[_0x53f3('0x20')][_0x53f3('0x23')]);return _0x4b9bc2(_0x5ea5e7['error'][_0x53f3('0x23')]);}else{logger[_0x53f3('0x1c')](_0x53f3('0x22'),_0x3f2dc3,_0x53f3('0x1d'));_0x4b9bc2(_0x5ea5e7[_0x53f3('0x24')][_0x53f3('0x23')]);}})['catch'](function(_0x11bb9d){logger['error']('SmsMessage,\x20%s,\x20%s',_0x3f2dc3,_0x11bb9d);_0x3da977(_0x11bb9d);});});}function respondWithStatusCode(_0x3b0512,_0x51b74b){_0x51b74b=_0x51b74b||0xcc;return function(_0x1772da){if(_0x1772da){return _0x3b0512[_0x53f3('0x25')](_0x51b74b);}return _0x3b0512[_0x53f3('0x26')](_0x51b74b)['end']();};}function respondWithResult(_0x4e68ca,_0x1dcd1d){_0x1dcd1d=_0x1dcd1d||0xc8;return function(_0x1eee2e){if(_0x1eee2e){return _0x4e68ca[_0x53f3('0x26')](_0x1dcd1d)[_0x53f3('0x27')](_0x1eee2e);}};}function respondWithFilteredResult(_0x173bf8,_0x5a4b2f){return function(_0x1b172b){if(_0x1b172b){var _0x1ccd36=typeof _0x5a4b2f[_0x53f3('0x28')]===_0x53f3('0x29')&&typeof _0x5a4b2f['limit']===_0x53f3('0x29');var _0x3d405e=_0x1b172b['count'];var _0x2ebf51=_0x1ccd36?0x0:_0x5a4b2f['offset'];var _0x48f365=_0x1ccd36?_0x1b172b[_0x53f3('0x2a')]:_0x5a4b2f[_0x53f3('0x28')]+_0x5a4b2f['limit'];var _0x5a8232;if(_0x48f365>=_0x3d405e){_0x48f365=_0x3d405e;_0x5a8232=0xc8;}else{_0x5a8232=0xce;}_0x173bf8[_0x53f3('0x26')](_0x5a8232);return _0x173bf8['set'](_0x53f3('0x2b'),_0x2ebf51+'-'+_0x48f365+'/'+_0x3d405e)[_0x53f3('0x27')](_0x1b172b);}return null;};}function patchUpdates(_0x326a61){return function(_0x817046){try{jsonpatch[_0x53f3('0x2c')](_0x817046,_0x326a61,!![]);}catch(_0x2ca08d){return BPromise['reject'](_0x2ca08d);}return _0x817046['save']();};}function saveUpdates(_0x54bad4,_0x11c604){return function(_0x267140){if(_0x267140){return _0x267140[_0x53f3('0x2d')](_0x54bad4)[_0x53f3('0x2e')](function(_0x4a7e8c){return _0x4a7e8c;});}return null;};}function removeEntity(_0x17d1e0,_0x496853){return function(_0x24837a){if(_0x24837a){return _0x24837a[_0x53f3('0x2f')]()[_0x53f3('0x2e')](function(){_0x17d1e0[_0x53f3('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3901d6,_0x500f1e){return function(_0x260ab9){if(!_0x260ab9){_0x3901d6['sendStatus'](0x194);}return _0x260ab9;};}function handleError(_0x5aef09,_0x5f585d){_0x5f585d=_0x5f585d||0x1f4;return function(_0x1d306b){logger[_0x53f3('0x20')](_0x1d306b['stack']);if(_0x1d306b['name']){delete _0x1d306b[_0x53f3('0x30')];}_0x5aef09['status'](_0x5f585d)[_0x53f3('0x31')](_0x1d306b);};}exports['index']=function(_0x54af54,_0x262fee){var _0x4cd96c={},_0x1495f6={},_0x1ed44b={'count':0x0,'rows':[]};var _0x7a72dd=_['map'](db[_0x53f3('0x32')][_0x53f3('0x33')],function(_0x502ff1){return{'name':_0x502ff1[_0x53f3('0x34')],'type':_0x502ff1['type'][_0x53f3('0x35')]};});_0x1495f6[_0x53f3('0x36')]=_[_0x53f3('0x37')](_0x7a72dd,_0x53f3('0x30'));_0x1495f6[_0x53f3('0x38')]=_['keys'](_0x54af54['query']);_0x1495f6[_0x53f3('0x39')]=_['intersection'](_0x1495f6[_0x53f3('0x36')],_0x1495f6[_0x53f3('0x38')]);_0x4cd96c['attributes']=_[_0x53f3('0x3a')](_0x1495f6[_0x53f3('0x36')],qs[_0x53f3('0x3b')](_0x54af54[_0x53f3('0x38')][_0x53f3('0x3b')]));_0x4cd96c[_0x53f3('0x3c')]=_0x4cd96c[_0x53f3('0x3c')]['length']?_0x4cd96c[_0x53f3('0x3c')]:_0x1495f6[_0x53f3('0x36')];if(!_0x54af54[_0x53f3('0x38')][_0x53f3('0x3d')](_0x53f3('0x3e'))){_0x4cd96c['limit']=qs[_0x53f3('0x3f')](_0x54af54[_0x53f3('0x38')][_0x53f3('0x3f')]);_0x4cd96c['offset']=qs['offset'](_0x54af54[_0x53f3('0x38')][_0x53f3('0x28')]);}_0x4cd96c['order']=qs['sort'](_0x54af54[_0x53f3('0x38')]['sort']);_0x4cd96c[_0x53f3('0x40')]=qs[_0x53f3('0x39')](_[_0x53f3('0x41')](_0x54af54[_0x53f3('0x38')],_0x1495f6[_0x53f3('0x39')]),_0x7a72dd);if(_0x54af54[_0x53f3('0x38')][_0x53f3('0x42')]){_0x4cd96c[_0x53f3('0x40')]=_[_0x53f3('0x43')](_0x4cd96c[_0x53f3('0x40')],{'$or':_['map'](_0x7a72dd,function(_0x1fd611){if(_0x1fd611[_0x53f3('0x44')]!==_0x53f3('0x45')){var _0x2737f1={};_0x2737f1[_0x1fd611[_0x53f3('0x30')]]={'$like':'%'+_0x54af54[_0x53f3('0x38')]['filter']+'%'};return _0x2737f1;}})});}_0x4cd96c=_['merge']({},_0x4cd96c,_0x54af54['options']);var _0x5519af={'where':_0x4cd96c[_0x53f3('0x40')]};return db[_0x53f3('0x32')][_0x53f3('0x2a')](_0x5519af)[_0x53f3('0x2e')](function(_0x45380b){_0x1ed44b[_0x53f3('0x2a')]=_0x45380b;if(_0x54af54[_0x53f3('0x38')][_0x53f3('0x46')]){_0x4cd96c[_0x53f3('0x47')]=[{'all':!![]}];}return db[_0x53f3('0x32')][_0x53f3('0x48')](_0x4cd96c);})['then'](function(_0x57b770){_0x1ed44b[_0x53f3('0x49')]=_0x57b770;return _0x1ed44b;})[_0x53f3('0x2e')](respondWithFilteredResult(_0x262fee,_0x4cd96c))[_0x53f3('0x4a')](handleError(_0x262fee,null));};exports[_0x53f3('0x4b')]=function(_0x7b4c08,_0x213f7f){var _0x347ea3={'raw':!![],'where':{'id':_0x7b4c08[_0x53f3('0x4c')]['id']}},_0xee9225={};_0xee9225[_0x53f3('0x36')]=_[_0x53f3('0x4d')](db[_0x53f3('0x32')]['rawAttributes']);_0xee9225[_0x53f3('0x38')]=_[_0x53f3('0x4d')](_0x7b4c08[_0x53f3('0x38')]);_0xee9225['filters']=_[_0x53f3('0x3a')](_0xee9225[_0x53f3('0x36')],_0xee9225[_0x53f3('0x38')]);_0x347ea3['attributes']=_[_0x53f3('0x3a')](_0xee9225[_0x53f3('0x36')],qs[_0x53f3('0x3b')](_0x7b4c08[_0x53f3('0x38')][_0x53f3('0x3b')]));_0x347ea3['attributes']=_0x347ea3[_0x53f3('0x3c')]['length']?_0x347ea3[_0x53f3('0x3c')]:_0xee9225[_0x53f3('0x36')];if(_0x7b4c08[_0x53f3('0x38')][_0x53f3('0x46')]){_0x347ea3[_0x53f3('0x47')]=[{'all':!![]}];}_0x347ea3=_['merge']({},_0x347ea3,_0x7b4c08[_0x53f3('0x4e')]);return db[_0x53f3('0x32')]['find'](_0x347ea3)[_0x53f3('0x2e')](handleEntityNotFound(_0x213f7f,null))[_0x53f3('0x2e')](respondWithResult(_0x213f7f,null))['catch'](handleError(_0x213f7f,null));};exports[_0x53f3('0x4f')]=function(_0x1e8926,_0x45dcee){return db[_0x53f3('0x32')][_0x53f3('0x4f')](_0x1e8926[_0x53f3('0x50')],{})[_0x53f3('0x2e')](respondWithResult(_0x45dcee,0xc9))[_0x53f3('0x4a')](handleError(_0x45dcee,null));};exports['update']=function(_0x7f773e,_0x31a361){if(_0x7f773e[_0x53f3('0x50')]['id']){delete _0x7f773e[_0x53f3('0x50')]['id'];}return db[_0x53f3('0x32')][_0x53f3('0x51')]({'where':{'id':_0x7f773e[_0x53f3('0x4c')]['id']}})[_0x53f3('0x2e')](handleEntityNotFound(_0x31a361,null))[_0x53f3('0x2e')](saveUpdates(_0x7f773e[_0x53f3('0x50')],null))[_0x53f3('0x2e')](respondWithResult(_0x31a361,null))[_0x53f3('0x4a')](handleError(_0x31a361,null));};exports[_0x53f3('0x2f')]=function(_0x2baa6f,_0x17508a){return db[_0x53f3('0x32')][_0x53f3('0x51')]({'where':{'id':_0x2baa6f[_0x53f3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x17508a,null))[_0x53f3('0x2e')](removeEntity(_0x17508a,null))[_0x53f3('0x4a')](handleError(_0x17508a,null));};exports[_0x53f3('0x52')]=function(_0x406dba,_0x3f8568){return db[_0x53f3('0x32')][_0x53f3('0x52')]()['then'](respondWithResult(_0x3f8568,null))[_0x53f3('0x4a')](handleError(_0x3f8568,null));};var interaction_log=require(_0x53f3('0x12'))('sms-interactions');exports[_0x53f3('0x53')]=function(_0x9cead8,_0x14909d,_0x3316ef){var _0x3feb9={'agent':{},'channel':_0x53f3('0x54')};if(_0x9cead8[_0x53f3('0x50')]['id']){delete _0x9cead8['body']['id'];}_0x9cead8[_0x53f3('0x50')]['read']=!![];_0x9cead8[_0x53f3('0x50')][_0x53f3('0x55')]=moment()[_0x53f3('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x9cead8[_0x53f3('0x50')][_0x53f3('0x57')]=_0x9cead8['body'][_0x53f3('0x57')]||_0x9cead8[_0x53f3('0x58')]['id'];_0x3feb9[_0x53f3('0x59')]['id']=_0x9cead8['body']['UserId'];return db[_0x53f3('0x32')][_0x53f3('0x51')]({'where':{'id':_0x9cead8[_0x53f3('0x4c')]['id'],'UserId':null}})[_0x53f3('0x2e')](handleEntityNotFound(_0x14909d,null))[_0x53f3('0x2e')](saveUpdates(_0x9cead8[_0x53f3('0x50')],null))[_0x53f3('0x2e')](function(_0x4d5a6f){if(_0x4d5a6f){_0x3feb9['message']=_0x4d5a6f[_0x53f3('0x5a')]({'plain':!![]});return db[_0x53f3('0x5b')]['find']({'where':{'id':_0x4d5a6f[_0x53f3('0x5c')]}});}return null;})[_0x53f3('0x2e')](handleEntityNotFound(_0x14909d,null))[_0x53f3('0x2e')](function(_0x50d596){if(_0x50d596){return _0x50d596['update']({'UserId':_0x9cead8[_0x53f3('0x50')][_0x53f3('0x57')],'read1stAt':_[_0x53f3('0x5d')](_0x50d596[_0x53f3('0x5e')])?moment()[_0x53f3('0x56')](_0x53f3('0x5f')):undefined});}return null;})[_0x53f3('0x2e')](function(_0x31c399){if(_0x31c399){_0x3feb9[_0x53f3('0x60')]=_0x31c399['get']({'plain':!![]});interaction_log['info'](_0x53f3('0x61'),_0x9cead8[_0x53f3('0x58')]['id'],_0x9cead8['user'][_0x53f3('0x30')],_0x9cead8[_0x53f3('0x58')][_0x53f3('0x62')],_0x3feb9[_0x53f3('0x60')]['id'],_0x9cead8[_0x53f3('0x50')]?JSON[_0x53f3('0x1f')](_0x9cead8[_0x53f3('0x50')]):_0x53f3('0x63'));return respondWithRpcPromise('AcceptMessage',_0x53f3('0x64'),_0x3feb9);}return null;})[_0x53f3('0x2e')](function(_0x19c76d){var _0x2c7526=_0x53f3('0x65')+_0x19c76d[_0x53f3('0x23')][_0x53f3('0x66')];return db[_0x53f3('0x67')][_0x53f3('0x38')](_0x2c7526,{'type':db[_0x53f3('0x68')][_0x53f3('0x69')][_0x53f3('0x6a')],'raw':!![]})[_0x53f3('0x2e')](function(_0x262cf1){return _0x262cf1;});})[_0x53f3('0x2e')](function(_0x48347){if(_0x48347){_0x3feb9[_0x53f3('0x23')][_0x53f3('0x6b')]=_0x48347[0x0];if(!_0x9cead8[_0x53f3('0x50')][_0x53f3('0x57')])return;return db['User'][_0x53f3('0x51')]({'where':{'id':_0x9cead8[_0x53f3('0x50')][_0x53f3('0x57')],'role':_0x53f3('0x59')},'attributes':['id',_0x53f3('0x30'),_0x53f3('0x6c'),'email',_0x53f3('0x6d')],'raw':!![]});}return null;})[_0x53f3('0x2e')](function(_0x52c391){if(!_0x52c391)return null;_0x3feb9[_0x53f3('0x23')][_0x53f3('0x59')]=_0x52c391;return _0x3feb9;})[_0x53f3('0x2e')](function(_0x14557d){if(_0x14557d){if(_0x9cead8['body']['manual']){_0x3feb9[_0x53f3('0x23')]['interface']=util[_0x53f3('0x56')](_0x53f3('0x6e'),_0x9cead8[_0x53f3('0x58')][_0x53f3('0x30')]);_0x3feb9[_0x53f3('0x23')][_0x53f3('0x6f')]=_0x3feb9['channel'];_0x3feb9[_0x53f3('0x23')][_0x53f3('0x70')]=_0x3feb9[_0x53f3('0x6f')];_0x3feb9[_0x53f3('0x23')][_0x53f3('0x71')]='accept';return respondWithRpcPromise(_0x53f3('0x72'),_0x53f3('0x72'),{'event':'acceptmessage','message':_0x3feb9['message']},client9002)['then'](function(){return _0x3feb9;});}return _0x3feb9;}return null;})[_0x53f3('0x2e')](respondWithResult(_0x14909d,null))[_0x53f3('0x4a')](handleError(_0x14909d,null));};var interaction_log=require(_0x53f3('0x12'))(_0x53f3('0x73'));exports['reject']=function(_0x1d30aa,_0x73ec4b,_0x2104b0){var _0x545f3b={'agent':{},'channel':_0x53f3('0x54')};if(_0x1d30aa[_0x53f3('0x50')]['id']){delete _0x1d30aa[_0x53f3('0x50')]['id'];}_0x1d30aa[_0x53f3('0x50')][_0x53f3('0x57')]=_0x1d30aa[_0x53f3('0x50')][_0x53f3('0x57')]||_0x1d30aa[_0x53f3('0x58')]['id'];_0x545f3b[_0x53f3('0x59')]['id']=_0x1d30aa[_0x53f3('0x50')][_0x53f3('0x57')];return db[_0x53f3('0x32')][_0x53f3('0x51')]({'where':{'id':_0x1d30aa[_0x53f3('0x4c')]['id'],'UserId':null}})[_0x53f3('0x2e')](handleEntityNotFound(_0x73ec4b,null))[_0x53f3('0x2e')](function(_0x3bf9b6){if(_0x3bf9b6){_0x545f3b[_0x53f3('0x23')]=_0x3bf9b6[_0x53f3('0x5a')]({'plain':!![]});return db[_0x53f3('0x5b')][_0x53f3('0x51')]({'where':{'id':_0x3bf9b6[_0x53f3('0x5c')]}});}return null;})['then'](handleEntityNotFound(_0x73ec4b,null))[_0x53f3('0x2e')](function(_0x143581){if(_0x143581){_0x545f3b[_0x53f3('0x60')]=_0x143581[_0x53f3('0x5a')]({'plain':!![]});interaction_log[_0x53f3('0x1c')](_0x53f3('0x74'),_0x1d30aa[_0x53f3('0x58')]['id'],_0x1d30aa[_0x53f3('0x58')][_0x53f3('0x30')],_0x1d30aa[_0x53f3('0x58')]['role'],_0x545f3b[_0x53f3('0x60')]['id'],_0x1d30aa[_0x53f3('0x50')]?JSON[_0x53f3('0x1f')](_0x1d30aa['body']):_0x53f3('0x63'));return respondWithRpcPromise(_0x53f3('0x75'),_0x53f3('0x76'),_0x545f3b);}return null;})[_0x53f3('0x2e')](function(_0x2d32de){var _0x3ff7ce=_0x53f3('0x65')+_0x2d32de[_0x53f3('0x23')][_0x53f3('0x66')];return db[_0x53f3('0x67')]['query'](_0x3ff7ce,{'type':db[_0x53f3('0x68')][_0x53f3('0x69')][_0x53f3('0x6a')],'raw':!![]})[_0x53f3('0x2e')](function(_0x49a569){return _0x49a569;});})[_0x53f3('0x2e')](function(_0x18c39f){if(_0x18c39f){_0x545f3b[_0x53f3('0x23')][_0x53f3('0x6b')]=_0x18c39f[0x0];if(!_0x1d30aa[_0x53f3('0x50')]['UserId'])return;return db[_0x53f3('0x77')][_0x53f3('0x51')]({'where':{'id':_0x1d30aa[_0x53f3('0x50')][_0x53f3('0x57')],'role':_0x53f3('0x59')},'attributes':['id',_0x53f3('0x30'),'fullname',_0x53f3('0x78'),_0x53f3('0x6d')],'raw':!![]});}return null;})[_0x53f3('0x2e')](function(_0x2b8792){if(!_0x2b8792)return null;_0x545f3b[_0x53f3('0x23')][_0x53f3('0x59')]=_0x2b8792;return _0x545f3b;})[_0x53f3('0x2e')](function(_0x368503){if(_0x368503){_0x368503[_0x53f3('0x23')][_0x53f3('0x79')]=util[_0x53f3('0x56')]('SIP/%s',_0x1d30aa[_0x53f3('0x58')][_0x53f3('0x30')]);_0x368503[_0x53f3('0x23')][_0x53f3('0x6f')]=_0x545f3b[_0x53f3('0x6f')];_0x368503['message'][_0x53f3('0x70')]=_0x545f3b['channel'];_0x368503['message']['event']=_0x53f3('0x7a');respondWithRpcPromise(_0x53f3('0x72'),'EventManager',{'event':_0x53f3('0x7b'),'message':_0x368503[_0x53f3('0x23')]},client9002);return _0x545f3b;}return null;})[_0x53f3('0x2e')](respondWithResult(_0x73ec4b,null))[_0x53f3('0x4a')](handleError(_0x73ec4b,null));};exports['status']=function(_0x3c1fc6,_0x37c842,_0x1c9102){if(_0x3c1fc6[_0x53f3('0x50')]['id']){delete _0x3c1fc6['body']['id'];}var _0x5ecc6e;return db[_0x53f3('0x32')][_0x53f3('0x51')]({'where':{'id':_0x3c1fc6['params']['id']}})[_0x53f3('0x2e')](handleEntityNotFound(_0x37c842,null))[_0x53f3('0x2e')](function(_0xec9983){if(_0xec9983){_0x5ecc6e=_0xec9983;return db[_0x53f3('0x7c')][_0x53f3('0x51')]({'where':{'id':_0xec9983[_0x53f3('0x7d')]}});}})[_0x53f3('0x2e')](handleEntityNotFound(_0x37c842,null))[_0x53f3('0x2e')](function(_0x61ce2c){if(_0x61ce2c){logger[_0x53f3('0x1e')](_0x53f3('0x7e'),_0x53f3('0x26'),_0x53f3('0x7f'),_0x61ce2c['type'],util[_0x53f3('0x80')](_0x3c1fc6['body'],{'showHidden':![],'depth':null}));switch(_0x61ce2c[_0x53f3('0x44')]){case _0x53f3('0x81'):if(_0x3c1fc6[_0x53f3('0x50')][_0x53f3('0x82')]&&_0x3c1fc6[_0x53f3('0x50')][_0x53f3('0x82')]===_0x5ecc6e[_0x53f3('0x83')]){return _0x5ecc6e['update']({'read':!![]});}else{logger[_0x53f3('0x20')](_0x53f3('0x84'),_0x53f3('0x26'),'twilio',util['inspect'](_0x3c1fc6['body'],{'showHidden':![],'depth':null}));}break;case _0x53f3('0x85'):if(_0x3c1fc6[_0x53f3('0x50')][_0x53f3('0x86')]&&_0x3c1fc6[_0x53f3('0x50')][_0x53f3('0x86')]===_0x5ecc6e[_0x53f3('0x83')]&&_[_0x53f3('0x87')]([_0x53f3('0x88'),_0x53f3('0x89')],_0x3c1fc6['body'][_0x53f3('0x8a')])>=0x0){return _0x5ecc6e[_0x53f3('0x2d')]({'read':!![]});}else{logger['error'](_0x53f3('0x84'),'status',_0x53f3('0x8b'),util[_0x53f3('0x80')](_0x3c1fc6['body'],{'showHidden':![],'depth':null}));}break;case _0x53f3('0x8c'):var _0x1b9246=_0x3c1fc6[_0x53f3('0x50')]['results'][0x0];if(_0x1b9246[_0x53f3('0x26')]['groupName']===_0x53f3('0x8d')){return _0x5ecc6e[_0x53f3('0x2d')]({'read':!![]});}else{logger[_0x53f3('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x53f3('0x26'),_0x53f3('0x8c'),util[_0x53f3('0x80')](_0x3c1fc6[_0x53f3('0x50')],{'showHidden':![],'depth':null}));}break;}return _0x5ecc6e;}})[_0x53f3('0x2e')](respondWithResult(_0x37c842,null))[_0x53f3('0x4a')](handleError(_0x37c842,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 0445741..682a88f 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 _0x86f8=['hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x7f43d2,_0x2e4dfd){var _0x38393e=function(_0x459381){while(--_0x459381){_0x7f43d2['push'](_0x7f43d2['shift']());}};_0x38393e(++_0x2e4dfd);}(_0x86f8,0x1ec));var _0x886f=function(_0x4e697a,_0x56a14b){_0x4e697a=_0x4e697a-0x0;var _0x88850c=_0x86f8[_0x4e697a];return _0x88850c;};'use strict';var EventEmitter=require(_0x886f('0x0'));var SmsMessage=require(_0x886f('0x1'))['db'][_0x886f('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x886f('0x3')](0x0);var events={'afterCreate':_0x886f('0x4'),'afterUpdate':_0x886f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x23a17c){return function(_0x3e9d7b,_0x43f1ed,_0x5ea11a){SmsMessageEvents[_0x886f('0x6')](_0x23a17c+':'+_0x3e9d7b['id'],_0x3e9d7b);SmsMessageEvents['emit'](_0x23a17c,_0x3e9d7b);_0x5ea11a(null);};}for(var e in events){if(events[_0x886f('0x7')](e)){var event=events[e];SmsMessage[_0x886f('0x8')](e,emitEvent(event));}}module[_0x886f('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0xe97c=['exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x993660,_0x2e8e0d){var _0x6a955=function(_0x2d68ba){while(--_0x2d68ba){_0x993660['push'](_0x993660['shift']());}};_0x6a955(++_0x2e8e0d);}(_0xe97c,0x17d));var _0xce97=function(_0x4b3bb9,_0xfd83fe){_0x4b3bb9=_0x4b3bb9-0x0;var _0x3bbd3f=_0xe97c[_0x4b3bb9];return _0x3bbd3f;};'use strict';var EventEmitter=require(_0xce97('0x0'));var SmsMessage=require(_0xce97('0x1'))['db'][_0xce97('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xce97('0x3')](0x0);var events={'afterCreate':_0xce97('0x4'),'afterUpdate':'update','afterDestroy':_0xce97('0x5')};function emitEvent(_0x558235){return function(_0x549892,_0x3952c6,_0x1a1c4d){SmsMessageEvents[_0xce97('0x6')](_0x558235+':'+_0x549892['id'],_0x549892);SmsMessageEvents[_0xce97('0x6')](_0x558235,_0x549892);_0x1a1c4d(null);};}for(var e in events){if(events[_0xce97('0x7')](e)){var event=events[e];SmsMessage[_0xce97('0x8')](e,emitEvent(event));}}module[_0xce97('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index fc1aec7..04f0c32 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 _0x7ee1=['read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','message_id','clickSend','plivo','authId','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','token','application/json','IBSSO\x20','csc','crypto','apiKey','login','timestamp','keys','sort','length','createHash','md5','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','bandwidth','accountId','/messages','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','intelepeer','finally','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','SmsMessage','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','isNil','UserId','findOne','then','update','createdAt','catch','secret','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','sid','error','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport'];(function(_0x26cf86,_0x1348df){var _0x19f919=function(_0x5f4d24){while(--_0x5f4d24){_0x26cf86['push'](_0x26cf86['shift']());}};_0x19f919(++_0x1348df);}(_0x7ee1,0xab));var _0x17ee=function(_0x6f327b,_0x38917c){_0x6f327b=_0x6f327b-0x0;var _0x108732=_0x7ee1[_0x6f327b];return _0x108732;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var logger=require(_0x17ee('0x1'))(_0x17ee('0x2'));var moment=require(_0x17ee('0x3'));var BPromise=require(_0x17ee('0x4'));var rp=require(_0x17ee('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17ee('0x6'));var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module[_0x17ee('0x7')]=function(_0x2e4db0,_0x2efefb){return _0x2e4db0[_0x17ee('0x8')](_0x17ee('0x9'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x17ee('0xa'),'fields':['messageId']},{'name':_0x17ee('0xb'),'fields':[_0x17ee('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xb3aa42,_0x36d73a,_0xa9902e){var _0x3c879d=_0x2e4db0[_0x17ee('0xd')];var _0x352d60=_0xb3aa42[_0x17ee('0xe')]({'plain':!![]});if(_0x352d60[_0x17ee('0xf')][_0x17ee('0x10')]()==='in'||_0x352d60[_0x17ee('0xf')][_0x17ee('0x10')]()===_0x17ee('0x11')&&!_0x352d60['secret']&&!_[_0x17ee('0x12')](_0x352d60[_0x17ee('0x13')])){_0x3c879d['SmsInteraction'][_0x17ee('0x14')]({'where':{'id':_0x352d60['SmsInteractionId']}})[_0x17ee('0x15')](function(_0x27447d){if(_0x27447d){_0x27447d[_0x17ee('0x16')]({'lastMsgAt':_0x352d60[_0x17ee('0x17')],'lastMsgDirection':_0x352d60['direction'][_0x17ee('0x10')]()});}})[_0x17ee('0x18')](function(_0x1b09a3){console['error'](_0x1b09a3);});}if(_0x352d60[_0x17ee('0xf')]===_0x17ee('0x11')&&!_0x352d60[_0x17ee('0x19')]){var _0x384eaa;_0x3c879d[_0x17ee('0x1a')][_0x17ee('0x1b')]({'where':{'id':_0x352d60[_0x17ee('0x1c')]},'raw':!![]})['then'](function(_0x536c75){_0x384eaa=_0x536c75;if(_0x384eaa&&_0x384eaa[_0x17ee('0x1d')]){switch(_0x384eaa[_0x17ee('0x1d')]){case _0x17ee('0x1e'):var _0x2f908f=require('twilio');if(_0x384eaa[_0x17ee('0x1f')]&&_0x384eaa[_0x17ee('0x20')]&&_0x384eaa[_0x17ee('0x21')]){var _0x3ace7f=new _0x2f908f(_0x384eaa['accountSid'],_0x384eaa[_0x17ee('0x20')]);_0x3ace7f[_0x17ee('0x22')][_0x17ee('0x23')]({'body':_0x352d60['body'],'to':_0x352d60[_0x17ee('0x21')],'from':_0x384eaa[_0x17ee('0x21')],'statusCallback':_0x384eaa[_0x17ee('0x24')]+_0x17ee('0x25')+_0x352d60['id']+_0x17ee('0x26')+_0x384eaa['token']})[_0x17ee('0x15')](function(_0xc01da5){if(_0xc01da5[_0x17ee('0x27')]){return _0xb3aa42[_0x17ee('0x16')]({'messageId':_0xc01da5[_0x17ee('0x27')]});}})[_0x17ee('0x18')](function(_0x13e8ff){logger[_0x17ee('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x17ee('0x29'),_0x17ee('0x1e'),util[_0x17ee('0x2a')](_0x13e8ff,{'showHidden':![],'depth':null}));});}else{logger[_0x17ee('0x28')](_0x17ee('0x2b'),_0x17ee('0x29'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x17ee('0x2c'):var _0x400306=_0x17ee('0x2d');if(_0x384eaa['username']&&_0x384eaa[_0x17ee('0x2e')]){var _0x34b003={'recipient':[_0x352d60[_0x17ee('0x21')]],'message':_0x352d60['body'],'message_type':_0x384eaa[_0x17ee('0x2f')]};if(_0x384eaa[_0x17ee('0x2f')]&&_0x384eaa[_0x17ee('0x2f')]!=='SI'){_0x34b003[_0x17ee('0x30')]=_0x384eaa['phone'];}var _0x49e8b7={'url':_0x400306+_0x17ee('0x31')+_0x384eaa[_0x17ee('0x32')]+'&password='+_0x384eaa[_0x17ee('0x2e')],'method':'GET'};rp(_0x49e8b7)[_0x17ee('0x15')](function(_0x1cf8b9){var _0x126f3a=_0x1cf8b9['split'](';');var _0x2356fd={'user_key':_0x126f3a[0x0],'session_key':_0x126f3a[0x1]};_0x49e8b7={'url':_0x400306+'sms','method':_0x17ee('0x33'),'headers':{'user_key':_0x2356fd[_0x17ee('0x34')],'Session_key':_0x2356fd[_0x17ee('0x35')]},'json':!![],'body':_0x34b003};return rp(_0x49e8b7);})[_0x17ee('0x15')](function(_0x514114){if(_0x514114[_0x17ee('0x36')]>=0x1){var _0x27e103={'messageId':_0x514114[_0x17ee('0x37')]};if(_0x384eaa['smsMethod']!=='GP'||!_0x384eaa[_0x17ee('0x38')]){_0x27e103[_0x17ee('0x39')]=!![];}return _0xb3aa42[_0x17ee('0x16')](_0x27e103);}else{return logger['error'](_0x17ee('0x2b'),_0x17ee('0x29'),_0x17ee('0x2c'),util[_0x17ee('0x2a')](_0x514114,{'showHidden':![],'depth':null}));}})[_0x17ee('0x18')](function(_0x423079){return logger[_0x17ee('0x28')](_0x17ee('0x2b'),_0x17ee('0x29'),_0x17ee('0x2c'),util['inspect'](_0x423079,{'showHidden':![],'depth':null}));});}else{logger[_0x17ee('0x28')](_0x17ee('0x2b'),_0x17ee('0x29'),_0x17ee('0x2c'),_0x17ee('0x3a'));}break;case _0x17ee('0x3b'):if(_0x384eaa[_0x17ee('0x20')]){var _0x1c6924={'recipient':_0x352d60[_0x17ee('0x21')],'message':_0x352d60[_0x17ee('0xc')],'sender':_0x384eaa[_0x17ee('0x3c')]||_0x384eaa['phone'],'authorization':_0x384eaa[_0x17ee('0x20')]};var _0x36d73a={'method':'POST','uri':_0x17ee('0x3d'),'body':_0x1c6924,'json':!![]};rp(_0x36d73a)[_0x17ee('0x15')](function(_0x21cdf6){var _0x29e163={'messageId':_0x21cdf6[_0x17ee('0x3e')]};if(!_0x384eaa[_0x17ee('0x38')]){_0x29e163['read']=!![];}return _0xb3aa42['update'](_0x29e163);})[_0x17ee('0x18')](function(_0x20c6e9){logger[_0x17ee('0x28')](_0x17ee('0x2b'),_0x17ee('0x29'),_0x17ee('0x3b'),util['inspect'](_0x20c6e9,{'showHidden':![],'depth':null}));});}else{logger[_0x17ee('0x28')](_0x17ee('0x2b'),'afterCreate',_0x17ee('0x3b'),'Missing\x20parameters:\x20authToken');}break;case _0x17ee('0x3f'):if(_0x384eaa['username']&&_0x384eaa[_0x17ee('0x2e')]){var _0x1c6924={'messages':[{'source':_0x17ee('0x40'),'to':_0x352d60[_0x17ee('0x21')],'body':_0x352d60['body'],'from':_0x384eaa['senderString']||_0x384eaa['phone']}]};var _0x58106c=util[_0x17ee('0x41')](_0x17ee('0x42'),_0x384eaa['username'],_0x384eaa[_0x17ee('0x2e')]);var _0x36d73a={'method':_0x17ee('0x33'),'uri':_0x17ee('0x43'),'body':_0x1c6924,'headers':{'Authorization':util[_0x17ee('0x41')](_0x17ee('0x44'),new Buffer(_0x58106c)[_0x17ee('0x45')](_0x17ee('0x46')))},'json':!![]};rp(_0x36d73a)['then'](function(_0x4664f7){if(_0x4664f7[_0x17ee('0x47')]>=0xc8&&_0x4664f7['http_code']<=0xce){if(_0x4664f7[_0x17ee('0x48')]&&_0x4664f7[_0x17ee('0x48')][_0x17ee('0x49')]>0x0){var _0x55f597=_['head'](_0x4664f7['data'][_0x17ee('0x22')]);var _0x2a8a48={'messageId':_0x55f597[_0x17ee('0x4a')]};if(!_0x384eaa[_0x17ee('0x38')]){_0x2a8a48[_0x17ee('0x39')]=!![];}return _0xb3aa42[_0x17ee('0x16')](_0x2a8a48);}else{logger[_0x17ee('0x28')](_0x17ee('0x2b'),'afterCreate',_0x17ee('0x4b'),util[_0x17ee('0x2a')](_0x4664f7,{'showHidden':![],'depth':null}));}}else{logger[_0x17ee('0x28')](_0x17ee('0x2b'),_0x17ee('0x29'),_0x17ee('0x4b'),util[_0x17ee('0x2a')](_0x4664f7,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3d7ba1){logger[_0x17ee('0x28')](_0x17ee('0x2b'),_0x17ee('0x29'),'clickSend',util[_0x17ee('0x2a')](_0x3d7ba1,{'showHidden':![],'depth':null}));});}else{logger[_0x17ee('0x28')](_0x17ee('0x2b'),_0x17ee('0x29'),'clickSend',_0x17ee('0x3a'));}break;case _0x17ee('0x4c'):if(_0x384eaa[_0x17ee('0x4d')]&&_0x384eaa[_0x17ee('0x20')]){var _0x1c6924={'dst':_0x352d60[_0x17ee('0x21')],'text':_0x352d60[_0x17ee('0xc')],'src':_0x384eaa[_0x17ee('0x3c')]||_0x384eaa['phone'],'url':_0x384eaa['remote']+_0x17ee('0x25')+_0x352d60['id']+_0x17ee('0x26')+_0x384eaa['token']};var _0x58106c=util[_0x17ee('0x41')](_0x17ee('0x42'),_0x384eaa[_0x17ee('0x4d')],_0x384eaa['authToken']);var _0x36d73a={'method':_0x17ee('0x33'),'uri':util[_0x17ee('0x41')]('https://api.plivo.com/v1/Account/%s/Message/',_0x384eaa['authId']),'body':_0x1c6924,'headers':{'Authorization':util[_0x17ee('0x41')]('Basic\x20%s',new Buffer(_0x58106c)[_0x17ee('0x45')]('base64'))},'json':!![]};rp(_0x36d73a)[_0x17ee('0x15')](function(_0x537958){var _0x329c99={'messageId':_0x537958[_0x17ee('0x4e')][0x0]};return _0xb3aa42[_0x17ee('0x16')](_0x329c99);})['catch'](function(_0x151b4d){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x17ee('0x4c'),util[_0x17ee('0x2a')](_0x151b4d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x17ee('0x2b'),_0x17ee('0x29'),_0x17ee('0x4c'),_0x17ee('0x4f'));}break;case _0x17ee('0x50'):if(_0x384eaa['username']&&_0x384eaa[_0x17ee('0x2e')]){if(_0x384eaa[_0x17ee('0x51')]){var _0x54527d={'method':_0x17ee('0x33'),'uri':_0x384eaa['baseUrl']+_0x17ee('0x52'),'body':{'username':_0x384eaa[_0x17ee('0x32')],'password':_0x384eaa['password']},'json':!![]};return rp(_0x54527d)[_0x17ee('0x15')](function(_0x8e7e69){var _0x201c57={'method':_0x17ee('0x33'),'uri':_0x384eaa['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x384eaa['phone'],'destinations':[{'to':_0x352d60[_0x17ee('0x21')]}],'text':_0x352d60['body'],'notifyUrl':_0x384eaa[_0x17ee('0x24')]+_0x17ee('0x25')+_0x352d60['id']+'/status?token='+_0x384eaa[_0x17ee('0x53')],'notifyContentType':_0x17ee('0x54'),'callbackData':_0x384eaa[_0x17ee('0x21')]+';'+_0x352d60['body']}]},'headers':{'Authorization':_0x17ee('0x55')+_0x8e7e69[_0x17ee('0x53')]},'json':!![]};return rp(_0x201c57)['then'](function(_0x1254df){if(_0x1254df[_0x17ee('0x22')]){var _0x155ede={'messageId':_0x1254df[_0x17ee('0x22')][0x0][_0x17ee('0xa')]};if(!_0x384eaa[_0x17ee('0x38')]){_0x155ede['read']=!![];}return _0xb3aa42['update'](_0x155ede);}else{return logger[_0x17ee('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x17ee('0x50'),util[_0x17ee('0x2a')](_0x1254df,{'showHidden':![],'depth':null}));}});})[_0x17ee('0x18')](function(_0x5615e3){return logger['error'](_0x17ee('0x2b'),_0x17ee('0x29'),_0x17ee('0x50'),util[_0x17ee('0x2a')](_0x5615e3,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x17ee('0x29'),'infobip','Missing\x20parameters:\x20base_url');}}else{logger[_0x17ee('0x28')](_0x17ee('0x2b'),'afterCreate',_0x17ee('0x50'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x17ee('0x56'):var _0x26717c=require(_0x17ee('0x57'));if(_0x384eaa[_0x17ee('0x58')]){var _0x5b9a57={};_0x5b9a57[_0x17ee('0x59')]=_0x384eaa[_0x17ee('0x32')];_0x5b9a57[_0x17ee('0x21')]=_0x352d60[_0x17ee('0x21')];_0x5b9a57[_0x17ee('0x30')]=_0x384eaa['phone'];_0x5b9a57['text']=_0x352d60[_0x17ee('0xc')];_0x5b9a57[_0x17ee('0x5a')]=+new Date();var _0xa02147='';var _0x235b4f='';var _0x38f3ec=Object[_0x17ee('0x5b')](_0x5b9a57);_0x38f3ec[_0x17ee('0x5c')]();for(var _0x22002a=0x0;_0x22002a<_0x38f3ec[_0x17ee('0x5d')];_0x22002a++){if(_0xa02147!=''){_0xa02147+='&';}_0xa02147+=_0x38f3ec[_0x22002a]+'='+encodeURIComponent(_0x5b9a57[_0x38f3ec[_0x22002a]]);_0x235b4f+=_0x5b9a57[_0x38f3ec[_0x22002a]];}_0x235b4f+=_0x384eaa[_0x17ee('0x58')];_0x235b4f=_0x26717c[_0x17ee('0x5e')](_0x17ee('0x5f'))[_0x17ee('0x16')](_0x235b4f)['digest'](_0x17ee('0x60'));if(_0xa02147!==''){_0xa02147+='&';}_0xa02147+=_0x17ee('0x61')+_0x235b4f;var _0x49e8b7={'method':'GET','uri':_0x384eaa['baseUrl']+_0x17ee('0x62')+_0xa02147,'json':!![]};return rp(_0x49e8b7)['then'](function(_0x44966b){var _0x1d043e=Object[_0x17ee('0x5b')](_0x44966b);if(_0x44966b[_0x1d043e[0x0]][_0x17ee('0x28')]&&parseInt(_0x44966b[_0x1d043e[0x0]]['error'])===0x0){var _0x56087d={'messageId':_0x44966b[_0x1d043e[0x0]][_0x17ee('0x63')]};if(!_0x384eaa[_0x17ee('0x38')]){_0x56087d['read']=!![];}return _0xb3aa42[_0x17ee('0x16')](_0x56087d);}else{return logger[_0x17ee('0x28')](_0x17ee('0x2b'),'afterCreate',_0x17ee('0x56'),util['inspect'](_0x44966b[_0x17ee('0x28')],{'showHidden':![],'depth':null}));}})[_0x17ee('0x18')](function(_0x522e8e){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x17ee('0x29'),_0x17ee('0x56'),util[_0x17ee('0x2a')](_0x522e8e,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x17ee('0x29'),_0x17ee('0x56'),_0x17ee('0x64'));}break;case _0x17ee('0x65'):if(_0x384eaa['apiKey']){var _0x22d5f2={'method':_0x17ee('0x33'),'uri':_0x17ee('0x66'),'headers':{'Authorization':_0x384eaa[_0x17ee('0x58')]},'body':{'content':_0x352d60[_0x17ee('0xc')],'to':[_0x352d60[_0x17ee('0x21')]],'from':_0x384eaa[_0x17ee('0x21')],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x22d5f2)[_0x17ee('0x15')](function(_0x555302){if(!_0x555302['error']){var _0x497dc7={'messageId':_0x555302['messages'][0x0]['apiMessageId']};if(!_0x384eaa[_0x17ee('0x38')]){_0x497dc7[_0x17ee('0x39')]=!![];}return _0xb3aa42[_0x17ee('0x16')](_0x497dc7);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x17ee('0x29'),'clickatell',util[_0x17ee('0x2a')](_0x555302['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x65e755){return logger[_0x17ee('0x28')](_0x17ee('0x2b'),'afterCreate',_0x17ee('0x65'),util[_0x17ee('0x2a')](_0x65e755,{'showHidden':![],'depth':null}));});}else{logger[_0x17ee('0x28')](_0x17ee('0x2b'),_0x17ee('0x29'),_0x17ee('0x65'),_0x17ee('0x64'));}break;case _0x17ee('0x67'):if(_0x384eaa[_0x17ee('0x32')]&&_0x384eaa[_0x17ee('0x2e')]){var _0x58106c=util[_0x17ee('0x41')]('%s:%s',_0x384eaa['username'],_0x384eaa[_0x17ee('0x2e')]);var _0x36d73a={'method':_0x17ee('0x33'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x384eaa[_0x17ee('0x68')]+_0x17ee('0x69'),'body':{'to':[_0x352d60[_0x17ee('0x21')]],'text':_0x352d60[_0x17ee('0xc')],'from':_0x384eaa[_0x17ee('0x21')],'applicationId':_0x384eaa['applicationId']},'headers':{'Authorization':util[_0x17ee('0x41')]('Basic\x20%s',new Buffer(_0x58106c)[_0x17ee('0x45')](_0x17ee('0x46')))},'json':!![]};rp(_0x36d73a)[_0x17ee('0x15')](function(_0x16c6df){if(_0x16c6df['id']){var _0x176f19={'messageId':_0x16c6df['id']};return _0xb3aa42[_0x17ee('0x16')](_0x176f19);}else{logger[_0x17ee('0x28')](_0x17ee('0x2b'),'afterCreate',_0x17ee('0x67'),util['inspect'](_0x16c6df,{'showHidden':![],'depth':null}));}})[_0x17ee('0x18')](function(_0x1857fa){logger[_0x17ee('0x28')](_0x17ee('0x2b'),'afterCreate',_0x17ee('0x67'),util[_0x17ee('0x2a')](_0x1857fa,{'showHidden':![],'depth':null}));});}else{logger[_0x17ee('0x28')](_0x17ee('0x2b'),_0x17ee('0x29'),_0x17ee('0x67'),_0x17ee('0x3a'));}break;case'intelepeer':if(_0x384eaa[_0x17ee('0x58')]){var _0x36884e={};var _0x49e8b7={'method':_0x17ee('0x33'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x17ee('0x6a')+_0x384eaa['apiKey'],'Content-Type':_0x17ee('0x54')},'body':{'from':_0x384eaa['phone'],'to':_0x352d60[_0x17ee('0x21')],'text':_0x352d60[_0x17ee('0xc')]},'json':!![]};return rp(_0x49e8b7)[_0x17ee('0x15')](function(_0x296303){if(_0x296303[_0x17ee('0x6b')]==0xca){_0x36884e[_0x17ee('0x6c')]=_0x296303;var _0x19b456={'method':_0x17ee('0x33'),'uri':_0x17ee('0x6d'),'headers':{'Authorization':_0x17ee('0x6a')+_0x384eaa[_0x17ee('0x58')],'Content-Type':_0x17ee('0x54')},'body':{'refid':_0x36884e[_0x17ee('0x6c')][_0x17ee('0x6e')]},'json':!![]};return rp(_0x19b456)[_0x17ee('0x15')](function(_0x48ea15){_0x36884e['status']=_0x48ea15;var _0x4a6af4={'messageId':_0x36884e[_0x17ee('0x6c')][_0x17ee('0x6e')],'read':!![]};return _0xb3aa42[_0x17ee('0x16')](_0x4a6af4);});}else{return logger[_0x17ee('0x28')](_0x17ee('0x2b'),'afterCreate','intelepeer',util['inspect'](_0x296303,{'showHidden':![],'depth':null}));}})['catch'](function(_0x20e9c4){return logger[_0x17ee('0x28')](_0x17ee('0x2b'),_0x17ee('0x29'),_0x17ee('0x6f'),util['inspect'](_0x20e9c4,{'showHidden':![],'depth':null}));});}else{return logger[_0x17ee('0x28')](_0x17ee('0x2b'),_0x17ee('0x29'),_0x17ee('0x6f'),'Token\x20not\x20received');}break;}}})[_0x17ee('0x70')](function(){_0xa9902e();});}else{_0xa9902e();}}},'charset':'utf8mb4','collate':_0x17ee('0x71')});}; \ No newline at end of file +var _0xa73a=['Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','find','type','twilio','accountSid','authToken','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','password','smsMethod','sender','phone','login?username=','&password=','split','sms','POST','user_key','session_key','total_sent','internal_order_id','catch','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','username','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','queued_count','head','data','message_id','read','clickSend','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','timestamp','sort','length','createHash','digest','signature=','GET','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send'];(function(_0x127446,_0x748577){var _0x1efa67=function(_0x2aff5a){while(--_0x2aff5a){_0x127446['push'](_0x127446['shift']());}};_0x1efa67(++_0x748577);}(_0xa73a,0x82));var _0xaa73=function(_0x2a2e72,_0x1de962){_0x2a2e72=_0x2a2e72-0x0;var _0x3cfb4a=_0xa73a[_0x2a2e72];return _0x3cfb4a;};'use strict';var _=require('lodash');var util=require(_0xaa73('0x0'));var logger=require(_0xaa73('0x1'))(_0xaa73('0x2'));var moment=require(_0xaa73('0x3'));var BPromise=require(_0xaa73('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaa73('0x5'));var attributes=require(_0xaa73('0x6'));module[_0xaa73('0x7')]=function(_0x15d1c6,_0xf84c2e){return _0x15d1c6[_0xaa73('0x8')](_0xaa73('0x9'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0xaa73('0xa')]},{'name':_0xaa73('0xb'),'fields':[_0xaa73('0xc')],'type':_0xaa73('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x24bd91,_0x33a628,_0x47de56){var _0x526ccf=_0x15d1c6[_0xaa73('0xe')];var _0x4b583b=_0x24bd91[_0xaa73('0xf')]({'plain':!![]});if(_0x4b583b['direction'][_0xaa73('0x10')]()==='in'||_0x4b583b[_0xaa73('0x11')][_0xaa73('0x10')]()===_0xaa73('0x12')&&!_0x4b583b[_0xaa73('0x13')]&&!_[_0xaa73('0x14')](_0x4b583b['UserId'])){_0x526ccf[_0xaa73('0x15')][_0xaa73('0x16')]({'where':{'id':_0x4b583b[_0xaa73('0x17')]}})[_0xaa73('0x18')](function(_0xc4a8e){if(_0xc4a8e){_0xc4a8e[_0xaa73('0x19')]({'lastMsgAt':_0x4b583b[_0xaa73('0x1a')],'lastMsgDirection':_0x4b583b[_0xaa73('0x11')][_0xaa73('0x10')]()});}})['catch'](function(_0x409d07){console['error'](_0x409d07);});}if(_0x4b583b[_0xaa73('0x11')]===_0xaa73('0x12')&&!_0x4b583b[_0xaa73('0x13')]){var _0x4af9df;_0x526ccf['SmsAccount'][_0xaa73('0x1b')]({'where':{'id':_0x4b583b['SmsAccountId']},'raw':!![]})[_0xaa73('0x18')](function(_0x388ded){_0x4af9df=_0x388ded;if(_0x4af9df&&_0x4af9df['type']){switch(_0x4af9df[_0xaa73('0x1c')]){case _0xaa73('0x1d'):var _0x2de907=require(_0xaa73('0x1d'));if(_0x4af9df[_0xaa73('0x1e')]&&_0x4af9df[_0xaa73('0x1f')]&&_0x4af9df['phone']){var _0x551790=new _0x2de907(_0x4af9df['accountSid'],_0x4af9df[_0xaa73('0x1f')]);_0x551790[_0xaa73('0x20')][_0xaa73('0x21')]({'body':_0x4b583b[_0xaa73('0xc')],'to':_0x4b583b['phone'],'from':_0x4af9df['phone'],'statusCallback':_0x4af9df[_0xaa73('0x22')]+_0xaa73('0x23')+_0x4b583b['id']+_0xaa73('0x24')+_0x4af9df[_0xaa73('0x25')]})[_0xaa73('0x18')](function(_0x482795){if(_0x482795[_0xaa73('0x26')]){return _0x24bd91[_0xaa73('0x19')]({'messageId':_0x482795[_0xaa73('0x26')]});}})['catch'](function(_0x3cae16){logger[_0xaa73('0x27')](_0xaa73('0x28'),_0xaa73('0x29'),_0xaa73('0x1d'),util[_0xaa73('0x2a')](_0x3cae16,{'showHidden':![],'depth':null}));});}else{logger[_0xaa73('0x27')](_0xaa73('0x28'),'afterCreate','twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xaa73('0x2b'):var _0x562f01='https://api.skebby.it/API/v1.0/REST/';if(_0x4af9df['username']&&_0x4af9df[_0xaa73('0x2c')]){var _0x344e31={'recipient':[_0x4b583b['phone']],'message':_0x4b583b['body'],'message_type':_0x4af9df['smsMethod']};if(_0x4af9df[_0xaa73('0x2d')]&&_0x4af9df[_0xaa73('0x2d')]!=='SI'){_0x344e31[_0xaa73('0x2e')]=_0x4af9df[_0xaa73('0x2f')];}var _0x33fed3={'url':_0x562f01+_0xaa73('0x30')+_0x4af9df['username']+_0xaa73('0x31')+_0x4af9df['password'],'method':'GET'};rp(_0x33fed3)[_0xaa73('0x18')](function(_0x4e3e15){var _0x71f997=_0x4e3e15[_0xaa73('0x32')](';');var _0x490103={'user_key':_0x71f997[0x0],'session_key':_0x71f997[0x1]};_0x33fed3={'url':_0x562f01+_0xaa73('0x33'),'method':_0xaa73('0x34'),'headers':{'user_key':_0x490103[_0xaa73('0x35')],'Session_key':_0x490103[_0xaa73('0x36')]},'json':!![],'body':_0x344e31};return rp(_0x33fed3);})[_0xaa73('0x18')](function(_0x2bc74b){if(_0x2bc74b[_0xaa73('0x37')]>=0x1){var _0xd24899={'messageId':_0x2bc74b[_0xaa73('0x38')]};if(_0x4af9df['smsMethod']!=='GP'||!_0x4af9df['deliveryReport']){_0xd24899['read']=!![];}return _0x24bd91[_0xaa73('0x19')](_0xd24899);}else{return logger[_0xaa73('0x27')](_0xaa73('0x28'),_0xaa73('0x29'),_0xaa73('0x2b'),util[_0xaa73('0x2a')](_0x2bc74b,{'showHidden':![],'depth':null}));}})[_0xaa73('0x39')](function(_0x3bc667){return logger[_0xaa73('0x27')](_0xaa73('0x28'),'afterCreate','skebby',util[_0xaa73('0x2a')](_0x3bc667,{'showHidden':![],'depth':null}));});}else{logger[_0xaa73('0x27')](_0xaa73('0x28'),_0xaa73('0x29'),_0xaa73('0x2b'),_0xaa73('0x3a'));}break;case _0xaa73('0x3b'):if(_0x4af9df[_0xaa73('0x1f')]){var _0x544630={'recipient':_0x4b583b[_0xaa73('0x2f')],'message':_0x4b583b[_0xaa73('0xc')],'sender':_0x4af9df[_0xaa73('0x3c')]||_0x4af9df[_0xaa73('0x2f')],'authorization':_0x4af9df[_0xaa73('0x1f')]};var _0x33a628={'method':'POST','uri':_0xaa73('0x3d'),'body':_0x544630,'json':!![]};rp(_0x33a628)[_0xaa73('0x18')](function(_0x3127db){var _0x10f145={'messageId':_0x3127db['requestid']};if(!_0x4af9df[_0xaa73('0x3e')]){_0x10f145['read']=!![];}return _0x24bd91['update'](_0x10f145);})[_0xaa73('0x39')](function(_0x309e6c){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','connectel',util[_0xaa73('0x2a')](_0x309e6c,{'showHidden':![],'depth':null}));});}else{logger[_0xaa73('0x27')](_0xaa73('0x28'),_0xaa73('0x29'),'connectel',_0xaa73('0x3f'));}break;case _0xaa73('0x40'):if(_0x4af9df[_0xaa73('0x41')]&&_0x4af9df[_0xaa73('0x2c')]){var _0x544630={'messages':[{'source':'xCALLY\x20Motion','to':_0x4b583b[_0xaa73('0x2f')],'body':_0x4b583b[_0xaa73('0xc')],'from':_0x4af9df[_0xaa73('0x3c')]||_0x4af9df['phone']}]};var _0x6feb66=util[_0xaa73('0x42')](_0xaa73('0x43'),_0x4af9df[_0xaa73('0x41')],_0x4af9df[_0xaa73('0x2c')]);var _0x33a628={'method':_0xaa73('0x34'),'uri':_0xaa73('0x44'),'body':_0x544630,'headers':{'Authorization':util['format'](_0xaa73('0x45'),new Buffer(_0x6feb66)[_0xaa73('0x46')](_0xaa73('0x47')))},'json':!![]};rp(_0x33a628)[_0xaa73('0x18')](function(_0x969489){if(_0x969489[_0xaa73('0x48')]>=0xc8&&_0x969489[_0xaa73('0x48')]<=0xce){if(_0x969489['data']&&_0x969489['data'][_0xaa73('0x49')]>0x0){var _0x30865f=_[_0xaa73('0x4a')](_0x969489[_0xaa73('0x4b')][_0xaa73('0x20')]);var _0x483ec4={'messageId':_0x30865f[_0xaa73('0x4c')]};if(!_0x4af9df[_0xaa73('0x3e')]){_0x483ec4[_0xaa73('0x4d')]=!![];}return _0x24bd91[_0xaa73('0x19')](_0x483ec4);}else{logger[_0xaa73('0x27')](_0xaa73('0x28'),_0xaa73('0x29'),_0xaa73('0x4e'),util['inspect'](_0x969489,{'showHidden':![],'depth':null}));}}else{logger[_0xaa73('0x27')](_0xaa73('0x28'),'afterCreate','clickSend',util[_0xaa73('0x2a')](_0x969489,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2a0c71){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaa73('0x29'),_0xaa73('0x4e'),util[_0xaa73('0x2a')](_0x2a0c71,{'showHidden':![],'depth':null}));});}else{logger[_0xaa73('0x27')](_0xaa73('0x28'),_0xaa73('0x29'),_0xaa73('0x4e'),_0xaa73('0x3a'));}break;case'plivo':if(_0x4af9df[_0xaa73('0x4f')]&&_0x4af9df[_0xaa73('0x1f')]){var _0x544630={'dst':_0x4b583b[_0xaa73('0x2f')],'text':_0x4b583b[_0xaa73('0xc')],'src':_0x4af9df[_0xaa73('0x3c')]||_0x4af9df['phone'],'url':_0x4af9df['remote']+'/api/sms/messages/'+_0x4b583b['id']+_0xaa73('0x24')+_0x4af9df['token']};var _0x6feb66=util[_0xaa73('0x42')]('%s:%s',_0x4af9df[_0xaa73('0x4f')],_0x4af9df['authToken']);var _0x33a628={'method':_0xaa73('0x34'),'uri':util['format'](_0xaa73('0x50'),_0x4af9df[_0xaa73('0x4f')]),'body':_0x544630,'headers':{'Authorization':util[_0xaa73('0x42')](_0xaa73('0x45'),new Buffer(_0x6feb66)['toString'](_0xaa73('0x47')))},'json':!![]};rp(_0x33a628)[_0xaa73('0x18')](function(_0x587bd5){var _0x38f984={'messageId':_0x587bd5[_0xaa73('0x51')][0x0]};return _0x24bd91[_0xaa73('0x19')](_0x38f984);})[_0xaa73('0x39')](function(_0x55e081){logger[_0xaa73('0x27')](_0xaa73('0x28'),'afterCreate','plivo',util[_0xaa73('0x2a')](_0x55e081,{'showHidden':![],'depth':null}));});}else{logger[_0xaa73('0x27')](_0xaa73('0x28'),_0xaa73('0x29'),_0xaa73('0x52'),_0xaa73('0x53'));}break;case _0xaa73('0x54'):if(_0x4af9df[_0xaa73('0x41')]&&_0x4af9df['password']){if(_0x4af9df[_0xaa73('0x55')]){var _0x2beac0={'method':_0xaa73('0x34'),'uri':_0x4af9df[_0xaa73('0x55')]+'/auth/1/session','body':{'username':_0x4af9df['username'],'password':_0x4af9df['password']},'json':!![]};return rp(_0x2beac0)[_0xaa73('0x18')](function(_0x271cb3){var _0x36ee1c={'method':_0xaa73('0x34'),'uri':_0x4af9df['baseUrl']+_0xaa73('0x56'),'body':{'messages':[{'from':_0x4af9df[_0xaa73('0x2f')],'destinations':[{'to':_0x4b583b[_0xaa73('0x2f')]}],'text':_0x4b583b[_0xaa73('0xc')],'notifyUrl':_0x4af9df['remote']+'/api/sms/messages/'+_0x4b583b['id']+_0xaa73('0x24')+_0x4af9df[_0xaa73('0x25')],'notifyContentType':_0xaa73('0x57'),'callbackData':_0x4af9df[_0xaa73('0x2f')]+';'+_0x4b583b['body']}]},'headers':{'Authorization':_0xaa73('0x58')+_0x271cb3[_0xaa73('0x25')]},'json':!![]};return rp(_0x36ee1c)[_0xaa73('0x18')](function(_0x1b4976){if(_0x1b4976[_0xaa73('0x20')]){var _0xca10ba={'messageId':_0x1b4976[_0xaa73('0x20')][0x0][_0xaa73('0xa')]};if(!_0x4af9df[_0xaa73('0x3e')]){_0xca10ba[_0xaa73('0x4d')]=!![];}return _0x24bd91[_0xaa73('0x19')](_0xca10ba);}else{return logger[_0xaa73('0x27')](_0xaa73('0x28'),_0xaa73('0x29'),_0xaa73('0x54'),util[_0xaa73('0x2a')](_0x1b4976,{'showHidden':![],'depth':null}));}});})[_0xaa73('0x39')](function(_0x4fdebf){return logger[_0xaa73('0x27')](_0xaa73('0x28'),_0xaa73('0x29'),'infobip',util[_0xaa73('0x2a')](_0x4fdebf,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaa73('0x29'),'infobip',_0xaa73('0x59'));}}else{logger[_0xaa73('0x27')](_0xaa73('0x28'),'afterCreate',_0xaa73('0x54'),_0xaa73('0x3a'));}break;case _0xaa73('0x5a'):var _0x2f139f=require(_0xaa73('0x5b'));if(_0x4af9df[_0xaa73('0x5c')]){var _0x2529ff={};_0x2529ff[_0xaa73('0x5d')]=_0x4af9df[_0xaa73('0x41')];_0x2529ff[_0xaa73('0x2f')]=_0x4b583b[_0xaa73('0x2f')];_0x2529ff[_0xaa73('0x2e')]=_0x4af9df[_0xaa73('0x2f')];_0x2529ff['text']=_0x4b583b[_0xaa73('0xc')];_0x2529ff[_0xaa73('0x5e')]=+new Date();var _0x1cbb4b='';var _0x2d5b4e='';var _0x1f80ad=Object['keys'](_0x2529ff);_0x1f80ad[_0xaa73('0x5f')]();for(var _0x402c4e=0x0;_0x402c4e<_0x1f80ad[_0xaa73('0x60')];_0x402c4e++){if(_0x1cbb4b!=''){_0x1cbb4b+='&';}_0x1cbb4b+=_0x1f80ad[_0x402c4e]+'='+encodeURIComponent(_0x2529ff[_0x1f80ad[_0x402c4e]]);_0x2d5b4e+=_0x2529ff[_0x1f80ad[_0x402c4e]];}_0x2d5b4e+=_0x4af9df[_0xaa73('0x5c')];_0x2d5b4e=_0x2f139f[_0xaa73('0x61')]('md5')[_0xaa73('0x19')](_0x2d5b4e)[_0xaa73('0x62')]('hex');if(_0x1cbb4b!==''){_0x1cbb4b+='&';}_0x1cbb4b+=_0xaa73('0x63')+_0x2d5b4e;var _0x33fed3={'method':_0xaa73('0x64'),'uri':_0x4af9df[_0xaa73('0x55')]+'/external/get/send.php?'+_0x1cbb4b,'json':!![]};return rp(_0x33fed3)[_0xaa73('0x18')](function(_0x27ecf2){var _0x1cbac6=Object[_0xaa73('0x65')](_0x27ecf2);if(_0x27ecf2[_0x1cbac6[0x0]][_0xaa73('0x27')]&&parseInt(_0x27ecf2[_0x1cbac6[0x0]][_0xaa73('0x27')])===0x0){var _0x54b4ad={'messageId':_0x27ecf2[_0x1cbac6[0x0]][_0xaa73('0x66')]};if(!_0x4af9df[_0xaa73('0x3e')]){_0x54b4ad['read']=!![];}return _0x24bd91['update'](_0x54b4ad);}else{return logger[_0xaa73('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaa73('0x29'),_0xaa73('0x5a'),util[_0xaa73('0x2a')](_0x27ecf2['error'],{'showHidden':![],'depth':null}));}})[_0xaa73('0x39')](function(_0x2400b3){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaa73('0x29'),'csc',util[_0xaa73('0x2a')](_0x2400b3,{'showHidden':![],'depth':null}));});}else{logger[_0xaa73('0x27')](_0xaa73('0x28'),_0xaa73('0x29'),_0xaa73('0x5a'),_0xaa73('0x67'));}break;case _0xaa73('0x68'):if(_0x4af9df[_0xaa73('0x5c')]){var _0x36ad62={'method':_0xaa73('0x34'),'uri':_0xaa73('0x69'),'headers':{'Authorization':_0x4af9df['apiKey']},'body':{'content':_0x4b583b[_0xaa73('0xc')],'to':[_0x4b583b['phone']],'from':_0x4af9df[_0xaa73('0x2f')],'binary':![],'clientMessageId':_0xaa73('0x6a'),'charset':_0xaa73('0x6b')},'json':!![]};rp(_0x36ad62)['then'](function(_0x21f37c){if(!_0x21f37c[_0xaa73('0x27')]){var _0x14e012={'messageId':_0x21f37c[_0xaa73('0x20')][0x0]['apiMessageId']};if(!_0x4af9df['deliveryReport']){_0x14e012['read']=!![];}return _0x24bd91[_0xaa73('0x19')](_0x14e012);}else{return logger[_0xaa73('0x27')](_0xaa73('0x28'),_0xaa73('0x29'),_0xaa73('0x68'),util['inspect'](_0x21f37c[_0xaa73('0x27')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x400394){return logger[_0xaa73('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaa73('0x29'),_0xaa73('0x68'),util[_0xaa73('0x2a')](_0x400394,{'showHidden':![],'depth':null}));});}else{logger[_0xaa73('0x27')](_0xaa73('0x28'),'afterCreate','clickatell',_0xaa73('0x67'));}break;case _0xaa73('0x6c'):if(_0x4af9df['username']&&_0x4af9df[_0xaa73('0x2c')]){var _0x6feb66=util[_0xaa73('0x42')]('%s:%s',_0x4af9df[_0xaa73('0x41')],_0x4af9df[_0xaa73('0x2c')]);var _0x33a628={'method':_0xaa73('0x34'),'uri':_0xaa73('0x6d')+_0x4af9df[_0xaa73('0x6e')]+_0xaa73('0x6f'),'body':{'to':[_0x4b583b[_0xaa73('0x2f')]],'text':_0x4b583b[_0xaa73('0xc')],'from':_0x4af9df[_0xaa73('0x2f')],'applicationId':_0x4af9df['applicationId']},'headers':{'Authorization':util[_0xaa73('0x42')]('Basic\x20%s',new Buffer(_0x6feb66)['toString'](_0xaa73('0x47')))},'json':!![]};rp(_0x33a628)[_0xaa73('0x18')](function(_0x1a437e){if(_0x1a437e['id']){var _0x20efca={'messageId':_0x1a437e['id']};return _0x24bd91[_0xaa73('0x19')](_0x20efca);}else{logger[_0xaa73('0x27')](_0xaa73('0x28'),_0xaa73('0x29'),'bandwidth',util['inspect'](_0x1a437e,{'showHidden':![],'depth':null}));}})[_0xaa73('0x39')](function(_0x5b802a){logger[_0xaa73('0x27')](_0xaa73('0x28'),_0xaa73('0x29'),_0xaa73('0x6c'),util[_0xaa73('0x2a')](_0x5b802a,{'showHidden':![],'depth':null}));});}else{logger[_0xaa73('0x27')](_0xaa73('0x28'),'afterCreate','bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case _0xaa73('0x70'):if(_0x4af9df[_0xaa73('0x5c')]){var _0xe3947a={};var _0x33fed3={'method':'POST','uri':_0xaa73('0x71'),'headers':{'Authorization':_0xaa73('0x72')+_0x4af9df[_0xaa73('0x5c')],'Content-Type':'application/json'},'body':{'from':_0x4af9df[_0xaa73('0x2f')],'to':_0x4b583b[_0xaa73('0x2f')],'text':_0x4b583b[_0xaa73('0xc')]},'json':!![]};return rp(_0x33fed3)[_0xaa73('0x18')](function(_0x4f08cf){if(_0x4f08cf[_0xaa73('0x73')]==0xca){_0xe3947a[_0xaa73('0x74')]=_0x4f08cf;var _0x58463a={'method':_0xaa73('0x34'),'uri':_0xaa73('0x75'),'headers':{'Authorization':_0xaa73('0x72')+_0x4af9df[_0xaa73('0x5c')],'Content-Type':_0xaa73('0x57')},'body':{'refid':_0xe3947a['message'][_0xaa73('0x76')]},'json':!![]};return rp(_0x58463a)['then'](function(_0x4fe413){_0xe3947a['status']=_0x4fe413;var _0x3eb4bc={'messageId':_0xe3947a[_0xaa73('0x74')][_0xaa73('0x76')],'read':!![]};return _0x24bd91[_0xaa73('0x19')](_0x3eb4bc);});}else{return logger[_0xaa73('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xaa73('0x70'),util['inspect'](_0x4f08cf,{'showHidden':![],'depth':null}));}})[_0xaa73('0x39')](function(_0x1a8833){return logger[_0xaa73('0x27')](_0xaa73('0x28'),_0xaa73('0x29'),_0xaa73('0x70'),util['inspect'](_0x1a8833,{'showHidden':![],'depth':null}));});}else{return logger[_0xaa73('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaa73('0x29'),_0xaa73('0x70'),_0xaa73('0x77'));}break;}}})['finally'](function(){_0x47de56();});}else{_0x47de56();}}},'charset':_0xaa73('0x78'),'collate':_0xaa73('0x79')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index e877ed9..26e8bbc 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 _0x7430=['request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register'];(function(_0x231c6f,_0x373368){var _0x126b0d=function(_0x392472){while(--_0x392472){_0x231c6f['push'](_0x231c6f['shift']());}};_0x126b0d(++_0x373368);}(_0x7430,0x129));var _0x0743=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7430[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x0743('0x0'));var util=require(_0x0743('0x1'));var moment=require(_0x0743('0x2'));var BPromise=require(_0x0743('0x3'));var rs=require(_0x0743('0x4'));var fs=require('fs');var Redis=require(_0x0743('0x5'));var db=require(_0x0743('0x6'))['db'];var utils=require(_0x0743('0x7'));var logger=require(_0x0743('0x8'))(_0x0743('0x9'));var config=require(_0x0743('0xa'));var jayson=require(_0x0743('0xb'));var client=jayson['client']['http']({'port':0x232a});config[_0x0743('0xc')]=_[_0x0743('0xd')](config[_0x0743('0xc')],{'host':_0x0743('0xe'),'port':0x18eb});var socket=require(_0x0743('0xf'))(new Redis(config[_0x0743('0xc')]));require(_0x0743('0x10'))[_0x0743('0x11')](socket);function respondWithRpcPromise(_0x22651d,_0x3fb69c,_0x4a1726){return new BPromise(function(_0xcaa2b7,_0x2b6a07){return client[_0x0743('0x12')](_0x22651d,_0x4a1726)[_0x0743('0x13')](function(_0x4570b2){logger[_0x0743('0x14')]('SmsMessage,\x20%s,\x20%s',_0x3fb69c,_0x0743('0x15'));logger[_0x0743('0x16')](_0x0743('0x17'),_0x3fb69c,_0x0743('0x15'),JSON[_0x0743('0x18')](_0x4570b2));if(_0x4570b2[_0x0743('0x19')]){if(_0x4570b2[_0x0743('0x19')]['code']===0x1f4){logger['error'](_0x0743('0x1a'),_0x3fb69c,_0x4570b2[_0x0743('0x19')][_0x0743('0x1b')]);return _0x2b6a07(_0x4570b2[_0x0743('0x19')][_0x0743('0x1b')]);}logger[_0x0743('0x19')](_0x0743('0x1a'),_0x3fb69c,_0x4570b2[_0x0743('0x19')][_0x0743('0x1b')]);return _0xcaa2b7(_0x4570b2['error']['message']);}else{logger['info'](_0x0743('0x1a'),_0x3fb69c,_0x0743('0x15'));_0xcaa2b7(_0x4570b2[_0x0743('0x1c')][_0x0743('0x1b')]);}})[_0x0743('0x1d')](function(_0x3cc844){logger['error']('SmsMessage,\x20%s,\x20%s',_0x3fb69c,_0x3cc844);_0x2b6a07(_0x3cc844);});});}exports[_0x0743('0x1e')]=function(_0x222976){var _0x415c7a=this;return new Promise(function(_0x5e11ab,_0x9e7b33){return db['SmsMessage'][_0x0743('0x1f')](_0x222976[_0x0743('0x20')],{'raw':_0x222976[_0x0743('0x21')]?_0x222976[_0x0743('0x21')][_0x0743('0x22')]===undefined?!![]:![]:!![]})[_0x0743('0x13')](function(_0x1fa1ac){logger['info'](_0x0743('0x1e'),_0x222976);logger[_0x0743('0x16')](_0x0743('0x1e'),_0x222976,JSON[_0x0743('0x18')](_0x1fa1ac));_0x5e11ab(_0x1fa1ac);})['catch'](function(_0x3b1ce9){logger[_0x0743('0x19')](_0x0743('0x1e'),_0x3b1ce9[_0x0743('0x1b')],_0x222976);_0x9e7b33(_0x415c7a[_0x0743('0x19')](0x1f4,_0x3b1ce9[_0x0743('0x1b')]));});});}; \ No newline at end of file +var _0xfdbe=['info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','SmsMessage','create','options','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfdbe,0x16f));var _0xefdb=function(_0x15606a,_0x562872){_0x15606a=_0x15606a-0x0;var _0x16a540=_0xfdbe[_0x15606a];return _0x16a540;};'use strict';var _=require(_0xefdb('0x0'));var util=require(_0xefdb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xefdb('0x2'));var fs=require('fs');var Redis=require(_0xefdb('0x3'));var db=require(_0xefdb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xefdb('0x5'))(_0xefdb('0x6'));var config=require(_0xefdb('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xefdb('0x8')]({'port':0x232a});config['redis']=_[_0xefdb('0x9')](config[_0xefdb('0xa')],{'host':_0xefdb('0xb'),'port':0x18eb});var socket=require(_0xefdb('0xc'))(new Redis(config['redis']));require(_0xefdb('0xd'))[_0xefdb('0xe')](socket);function respondWithRpcPromise(_0x324da2,_0x761335,_0xde86b8){return new BPromise(function(_0x25009f,_0x472f40){return client[_0xefdb('0xf')](_0x324da2,_0xde86b8)[_0xefdb('0x10')](function(_0x3bd7b2){logger[_0xefdb('0x11')]('SmsMessage,\x20%s,\x20%s',_0x761335,_0xefdb('0x12'));logger[_0xefdb('0x13')](_0xefdb('0x14'),_0x761335,_0xefdb('0x12'),JSON[_0xefdb('0x15')](_0x3bd7b2));if(_0x3bd7b2['error']){if(_0x3bd7b2[_0xefdb('0x16')][_0xefdb('0x17')]===0x1f4){logger[_0xefdb('0x16')](_0xefdb('0x18'),_0x761335,_0x3bd7b2['error']['message']);return _0x472f40(_0x3bd7b2[_0xefdb('0x16')]['message']);}logger[_0xefdb('0x16')]('SmsMessage,\x20%s,\x20%s',_0x761335,_0x3bd7b2[_0xefdb('0x16')][_0xefdb('0x19')]);return _0x25009f(_0x3bd7b2[_0xefdb('0x16')][_0xefdb('0x19')]);}else{logger[_0xefdb('0x11')]('SmsMessage,\x20%s,\x20%s',_0x761335,_0xefdb('0x12'));_0x25009f(_0x3bd7b2[_0xefdb('0x1a')][_0xefdb('0x19')]);}})[_0xefdb('0x1b')](function(_0x231e73){logger['error']('SmsMessage,\x20%s,\x20%s',_0x761335,_0x231e73);_0x472f40(_0x231e73);});});}exports[_0xefdb('0x1c')]=function(_0xdeeb8f){var _0x3c835d=this;return new Promise(function(_0x41a37e,_0xe4697d){return db[_0xefdb('0x1d')][_0xefdb('0x1e')](_0xdeeb8f['body'],{'raw':_0xdeeb8f[_0xefdb('0x1f')]?_0xdeeb8f['options']['raw']===undefined?!![]:![]:!![]})[_0xefdb('0x10')](function(_0x492479){logger['info'](_0xefdb('0x1c'),_0xdeeb8f);logger['debug'](_0xefdb('0x1c'),_0xdeeb8f,JSON[_0xefdb('0x15')](_0x492479));_0x41a37e(_0x492479);})['catch'](function(_0x1c1524){logger['error'](_0xefdb('0x1c'),_0x1c1524[_0xefdb('0x19')],_0xdeeb8f);_0xe4697d(_0x3c835d['error'](0x1f4,_0x1c1524['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 245b0cc..b4cd4e2 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 _0x15c5=['smsMessage:','save','update','emit','length'];(function(_0x55adee,_0x4d9108){var _0x5f0455=function(_0x216c59){while(--_0x216c59){_0x55adee['push'](_0x55adee['shift']());}};_0x5f0455(++_0x4d9108);}(_0x15c5,0x155));var _0x515c=function(_0x229128,_0x273558){_0x229128=_0x229128-0x0;var _0x1875b9=_0x15c5[_0x229128];return _0x1875b9;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x515c('0x0'),'remove',_0x515c('0x1')];function createListener(_0x2ef49b,_0x2d857a){return function(_0x1a17c8){_0x2d857a[_0x515c('0x2')](_0x2ef49b,_0x1a17c8);};}function removeListener(_0x18c14,_0x116daf){return function(){SmsMessageEvents['removeListener'](_0x18c14,_0x116daf);};}exports['register']=function(_0x4f1dfb){for(var _0x5e5bc8=0x0,_0x2275d5=events[_0x515c('0x3')];_0x5e5bc8<_0x2275d5;_0x5e5bc8++){var _0x2e05d9=events[_0x5e5bc8];var _0x50f744=createListener(_0x515c('0x4')+_0x2e05d9,_0x4f1dfb);SmsMessageEvents['on'](_0x2e05d9,_0x50f744);}}; \ No newline at end of file +var _0x466c=['removeListener','register','length','smsMessage:','./smsMessage.events','save','remove','emit'];(function(_0x224ea7,_0x4038f2){var _0x2d6412=function(_0x198275){while(--_0x198275){_0x224ea7['push'](_0x224ea7['shift']());}};_0x2d6412(++_0x4038f2);}(_0x466c,0x74));var _0xc466=function(_0x2a1ed3,_0xc9bf54){_0x2a1ed3=_0x2a1ed3-0x0;var _0x17caa2=_0x466c[_0x2a1ed3];return _0x17caa2;};'use strict';var SmsMessageEvents=require(_0xc466('0x0'));var events=[_0xc466('0x1'),_0xc466('0x2'),'update'];function createListener(_0x186e65,_0x1ed069){return function(_0x533313){_0x1ed069[_0xc466('0x3')](_0x186e65,_0x533313);};}function removeListener(_0x555e4c,_0xc5a0ef){return function(){SmsMessageEvents[_0xc466('0x4')](_0x555e4c,_0xc5a0ef);};}exports[_0xc466('0x5')]=function(_0x3028db){for(var _0x24c18a=0x0,_0x12e562=events[_0xc466('0x6')];_0x24c18a<_0x12e562;_0x24c18a++){var _0x264954=events[_0x24c18a];var _0x193f10=createListener(_0xc466('0x7')+_0x264954,_0x3028db);SmsMessageEvents['on'](_0x264954,_0x193f10);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 2e69728..8c7a90a 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 _0x100d=['../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','describe','/:id','show','/:id/members','/:id/teams','/:id/users','getAgents','create','post','addTeams','addAgents','put','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x281e37,_0x516d34){var _0x9dacd8=function(_0xb47d33){while(--_0xb47d33){_0x281e37['push'](_0x281e37['shift']());}};_0x9dacd8(++_0x516d34);}(_0x100d,0x155));var _0xd100=function(_0x5272c8,_0x2164f1){_0x5272c8=_0x5272c8-0x0;var _0x393f17=_0x100d[_0x5272c8];return _0x393f17;};'use strict';var multer=require(_0xd100('0x0'));var util=require(_0xd100('0x1'));var path=require(_0xd100('0x2'));var timeout=require(_0xd100('0x3'));var express=require(_0xd100('0x4'));var router=express[_0xd100('0x5')]();var fs_extra=require(_0xd100('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd100('0x7'));var config=require(_0xd100('0x8'));var controller=require(_0xd100('0x9'));router[_0xd100('0xa')]('/',auth[_0xd100('0xb')](),controller['index']);router[_0xd100('0xa')]('/describe',auth[_0xd100('0xb')](),controller[_0xd100('0xc')]);router['get'](_0xd100('0xd'),auth['isAuthenticated'](),controller[_0xd100('0xe')]);router[_0xd100('0xa')](_0xd100('0xf'),auth[_0xd100('0xb')](),controller['getMembers']);router[_0xd100('0xa')](_0xd100('0x10'),auth[_0xd100('0xb')](),controller['getTeams']);router['get'](_0xd100('0x11'),auth[_0xd100('0xb')](),controller[_0xd100('0x12')]);router['post']('/',auth[_0xd100('0xb')](),controller[_0xd100('0x13')]);router[_0xd100('0x14')](_0xd100('0x10'),auth[_0xd100('0xb')](),controller[_0xd100('0x15')]);router[_0xd100('0x14')](_0xd100('0x11'),auth[_0xd100('0xb')](),controller[_0xd100('0x16')]);router[_0xd100('0x17')](_0xd100('0xd'),auth[_0xd100('0xb')](),controller['update']);router['delete'](_0xd100('0xd'),auth['isAuthenticated'](),controller[_0xd100('0x18')]);router[_0xd100('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xd100('0x1a')]);router[_0xd100('0x19')](_0xd100('0x11'),auth[_0xd100('0xb')](),controller[_0xd100('0x1b')]);module[_0xd100('0x1c')]=router; \ No newline at end of file +var _0x19fb=['/describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','delete','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated'];(function(_0x595139,_0x45d72a){var _0x447964=function(_0xe15d9d){while(--_0xe15d9d){_0x595139['push'](_0x595139['shift']());}};_0x447964(++_0x45d72a);}(_0x19fb,0x16f));var _0xb19f=function(_0x2e3d11,_0x5867a2){_0x2e3d11=_0x2e3d11-0x0;var _0x50636d=_0x19fb[_0x2e3d11];return _0x50636d;};'use strict';var multer=require('multer');var util=require(_0xb19f('0x0'));var path=require(_0xb19f('0x1'));var timeout=require(_0xb19f('0x2'));var express=require(_0xb19f('0x3'));var router=express[_0xb19f('0x4')]();var fs_extra=require(_0xb19f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb19f('0x6'));var config=require(_0xb19f('0x7'));var controller=require(_0xb19f('0x8'));router[_0xb19f('0x9')]('/',auth[_0xb19f('0xa')](),controller['index']);router['get'](_0xb19f('0xb'),auth[_0xb19f('0xa')](),controller['describe']);router['get'](_0xb19f('0xc'),auth[_0xb19f('0xa')](),controller['show']);router[_0xb19f('0x9')](_0xb19f('0xd'),auth['isAuthenticated'](),controller[_0xb19f('0xe')]);router['get'](_0xb19f('0xf'),auth[_0xb19f('0xa')](),controller[_0xb19f('0x10')]);router['get'](_0xb19f('0x11'),auth['isAuthenticated'](),controller[_0xb19f('0x12')]);router[_0xb19f('0x13')]('/',auth['isAuthenticated'](),controller[_0xb19f('0x14')]);router['post'](_0xb19f('0xf'),auth[_0xb19f('0xa')](),controller[_0xb19f('0x15')]);router['post'](_0xb19f('0x11'),auth['isAuthenticated'](),controller['addAgents']);router[_0xb19f('0x16')]('/:id',auth[_0xb19f('0xa')](),controller[_0xb19f('0x17')]);router[_0xb19f('0x18')](_0xb19f('0xc'),auth[_0xb19f('0xa')](),controller['destroy']);router[_0xb19f('0x18')](_0xb19f('0xf'),auth[_0xb19f('0xa')](),controller['removeTeams']);router[_0xb19f('0x18')](_0xb19f('0x11'),auth['isAuthenticated'](),controller[_0xb19f('0x19')]);module[_0xb19f('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index e92b065..e953cdf 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 _0x538d=['sequelize','exports','STRING','INTEGER','rrmemory','beepall','roundrobin'];(function(_0x8caa42,_0x255c66){var _0x40d275=function(_0x487fd7){while(--_0x487fd7){_0x8caa42['push'](_0x8caa42['shift']());}};_0x40d275(++_0x255c66);}(_0x538d,0x16c));var _0xd538=function(_0x3945ca,_0xec7e19){_0x3945ca=_0x3945ca-0x0;var _0x1d17d1=_0x538d[_0x3945ca];return _0x1d17d1;};'use strict';var Sequelize=require(_0xd538('0x0'));module[_0xd538('0x1')]={'name':{'type':Sequelize[_0xd538('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd538('0x2')]},'timeout':{'type':Sequelize[_0xd538('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xd538('0x4'),_0xd538('0x5'),_0xd538('0x6'))}}; \ No newline at end of file +var _0xe4e7=['roundrobin','exports','STRING','name','INTEGER','rrmemory','beepall'];(function(_0xf5541e,_0x53a22f){var _0x3aed8e=function(_0x1ee74c){while(--_0x1ee74c){_0xf5541e['push'](_0xf5541e['shift']());}};_0x3aed8e(++_0x53a22f);}(_0xe4e7,0x119));var _0x7e4e=function(_0x2e6544,_0x168aef){_0x2e6544=_0x2e6544-0x0;var _0x8dceb5=_0xe4e7[_0x2e6544];return _0x8dceb5;};'use strict';var Sequelize=require('sequelize');module[_0x7e4e('0x0')]={'name':{'type':Sequelize[_0x7e4e('0x1')],'unique':_0x7e4e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7e4e('0x1')]},'timeout':{'type':Sequelize[_0x7e4e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x7e4e('0x4'),_0x7e4e('0x5'),_0x7e4e('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 1cdae12..6d3e097 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 _0xbcd2=['offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','SmsQueue','type','key','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find','create','body','role','user','SmsQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserSmsQueue','hasOwnProperty','pick','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','Agents','online','voicePause','interface','sequelize','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','QueryTypes','TeamId','all','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','getAgents','nolimit','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','register','sendStatus','status','end','json'];(function(_0x2b3c82,_0x127b8a){var _0x99a562=function(_0x2b9a3b){while(--_0x2b9a3b){_0x2b3c82['push'](_0x2b3c82['shift']());}};_0x99a562(++_0x127b8a);}(_0xbcd2,0xf0));var _0x2bcd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbcd2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2bcd('0x0'));var rimraf=require(_0x2bcd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2bcd('0x2'));var moment=require(_0x2bcd('0x3'));var BPromise=require(_0x2bcd('0x4'));var Mustache=require(_0x2bcd('0x5'));var util=require('util');var path=require(_0x2bcd('0x6'));var sox=require(_0x2bcd('0x7'));var csv=require(_0x2bcd('0x8'));var ejs=require(_0x2bcd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2bcd('0xa'));var crypto=require('crypto');var jsforce=require(_0x2bcd('0xb'));var deskjs=require(_0x2bcd('0xc'));var toCsv=require(_0x2bcd('0x8'));var querystring=require('querystring');var Papa=require(_0x2bcd('0xd'));var Redis=require(_0x2bcd('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2bcd('0xf'));var as=require(_0x2bcd('0x10'));var hardwareService=require(_0x2bcd('0x11'));var logger=require(_0x2bcd('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2bcd('0x13'));var db=require(_0x2bcd('0x14'))['db'];config[_0x2bcd('0x15')]=_[_0x2bcd('0x16')](config['redis'],{'host':_0x2bcd('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2bcd('0x15')]));require(_0x2bcd('0x18'))[_0x2bcd('0x19')](socket);function respondWithStatusCode(_0xa12f94,_0x4d3f07){_0x4d3f07=_0x4d3f07||0xcc;return function(_0x45c494){if(_0x45c494){return _0xa12f94[_0x2bcd('0x1a')](_0x4d3f07);}return _0xa12f94[_0x2bcd('0x1b')](_0x4d3f07)[_0x2bcd('0x1c')]();};}function respondWithResult(_0x12aca1,_0x1bad6a){_0x1bad6a=_0x1bad6a||0xc8;return function(_0xace6e7){if(_0xace6e7){return _0x12aca1['status'](_0x1bad6a)[_0x2bcd('0x1d')](_0xace6e7);}};}function respondWithFilteredResult(_0x1ff93c,_0x546ac2){return function(_0x287512){if(_0x287512){var _0x5a3444=typeof _0x546ac2[_0x2bcd('0x1e')]==='undefined'&&typeof _0x546ac2['limit']===_0x2bcd('0x1f');var _0x26f308=_0x287512[_0x2bcd('0x20')];var _0x311f71=_0x5a3444?0x0:_0x546ac2[_0x2bcd('0x1e')];var _0x4c1d1d=_0x5a3444?_0x287512['count']:_0x546ac2['offset']+_0x546ac2['limit'];var _0x73a859;if(_0x4c1d1d>=_0x26f308){_0x4c1d1d=_0x26f308;_0x73a859=0xc8;}else{_0x73a859=0xce;}_0x1ff93c['status'](_0x73a859);return _0x1ff93c[_0x2bcd('0x21')](_0x2bcd('0x22'),_0x311f71+'-'+_0x4c1d1d+'/'+_0x26f308)['json'](_0x287512);}return null;};}function patchUpdates(_0x1f8ee7){return function(_0x312924){try{jsonpatch[_0x2bcd('0x23')](_0x312924,_0x1f8ee7,!![]);}catch(_0x2a58b2){return BPromise[_0x2bcd('0x24')](_0x2a58b2);}return _0x312924[_0x2bcd('0x25')]();};}function saveUpdates(_0x3b7daf,_0x56ddc4){return function(_0x33c8eb){if(_0x33c8eb){return _0x33c8eb[_0x2bcd('0x26')](_0x3b7daf)['then'](function(_0x3a2fc8){return _0x3a2fc8;});}return null;};}function removeEntity(_0x3e9313,_0x5023a1){return function(_0x39c262){if(_0x39c262){return _0x39c262[_0x2bcd('0x27')]()[_0x2bcd('0x28')](function(){var _0x3eb22e=_0x39c262[_0x2bcd('0x29')]({'plain':!![]});var _0x175549='SmsQueues';return db[_0x2bcd('0x2a')][_0x2bcd('0x27')]({'where':{'type':_0x175549,'resourceId':_0x3eb22e['id']}})[_0x2bcd('0x28')](function(){return _0x39c262;});})[_0x2bcd('0x28')](function(){_0x3e9313[_0x2bcd('0x1b')](0xcc)[_0x2bcd('0x1c')]();});}};}function handleEntityNotFound(_0x2fd4b0,_0x39f48a){return function(_0x464d54){if(!_0x464d54){_0x2fd4b0[_0x2bcd('0x1a')](0x194);}return _0x464d54;};}function handleError(_0x1708f2,_0x73c3ca){_0x73c3ca=_0x73c3ca||0x1f4;return function(_0x32c900){logger[_0x2bcd('0x2b')](_0x32c900[_0x2bcd('0x2c')]);if(_0x32c900[_0x2bcd('0x2d')]){delete _0x32c900[_0x2bcd('0x2d')];}_0x1708f2[_0x2bcd('0x1b')](_0x73c3ca)[_0x2bcd('0x2e')](_0x32c900);};}exports[_0x2bcd('0x2f')]=function(_0x38441c,_0x90ac55){var _0x5d0a66={},_0x40039f={},_0x423a38={'count':0x0,'rows':[]};var _0x44e93e=_[_0x2bcd('0x30')](db[_0x2bcd('0x31')]['rawAttributes'],function(_0xe0da61){return{'name':_0xe0da61['fieldName'],'type':_0xe0da61[_0x2bcd('0x32')][_0x2bcd('0x33')]};});_0x40039f[_0x2bcd('0x34')]=_[_0x2bcd('0x30')](_0x44e93e,_0x2bcd('0x2d'));_0x40039f[_0x2bcd('0x35')]=_[_0x2bcd('0x36')](_0x38441c[_0x2bcd('0x35')]);_0x40039f[_0x2bcd('0x37')]=_[_0x2bcd('0x38')](_0x40039f[_0x2bcd('0x34')],_0x40039f[_0x2bcd('0x35')]);_0x5d0a66[_0x2bcd('0x39')]=_[_0x2bcd('0x38')](_0x40039f[_0x2bcd('0x34')],qs[_0x2bcd('0x3a')](_0x38441c[_0x2bcd('0x35')][_0x2bcd('0x3a')]));_0x5d0a66[_0x2bcd('0x39')]=_0x5d0a66[_0x2bcd('0x39')][_0x2bcd('0x3b')]?_0x5d0a66[_0x2bcd('0x39')]:_0x40039f[_0x2bcd('0x34')];if(!_0x38441c[_0x2bcd('0x35')]['hasOwnProperty']('nolimit')){_0x5d0a66['limit']=qs[_0x2bcd('0x3c')](_0x38441c['query'][_0x2bcd('0x3c')]);_0x5d0a66[_0x2bcd('0x1e')]=qs['offset'](_0x38441c['query'][_0x2bcd('0x1e')]);}_0x5d0a66[_0x2bcd('0x3d')]=qs[_0x2bcd('0x3e')](_0x38441c[_0x2bcd('0x35')][_0x2bcd('0x3e')]);_0x5d0a66[_0x2bcd('0x3f')]=qs[_0x2bcd('0x37')](_['pick'](_0x38441c[_0x2bcd('0x35')],_0x40039f[_0x2bcd('0x37')]),_0x44e93e);if(_0x38441c[_0x2bcd('0x35')]['filter']){_0x5d0a66[_0x2bcd('0x3f')]=_[_0x2bcd('0x40')](_0x5d0a66['where'],{'$or':_[_0x2bcd('0x30')](_0x44e93e,function(_0x1241b9){if(_0x1241b9[_0x2bcd('0x32')]!==_0x2bcd('0x41')){var _0x2b9ab8={};_0x2b9ab8[_0x1241b9[_0x2bcd('0x2d')]]={'$like':'%'+_0x38441c[_0x2bcd('0x35')][_0x2bcd('0x42')]+'%'};return _0x2b9ab8;}})});}_0x5d0a66=_[_0x2bcd('0x40')]({},_0x5d0a66,_0x38441c[_0x2bcd('0x43')]);var _0x307c87={'where':_0x5d0a66['where']};return db[_0x2bcd('0x31')][_0x2bcd('0x20')](_0x307c87)[_0x2bcd('0x28')](function(_0x5a2946){_0x423a38[_0x2bcd('0x20')]=_0x5a2946;if(_0x38441c[_0x2bcd('0x35')]['includeAll']){_0x5d0a66['include']=[{'all':!![]}];}return db[_0x2bcd('0x31')][_0x2bcd('0x44')](_0x5d0a66);})[_0x2bcd('0x28')](function(_0x308085){_0x423a38[_0x2bcd('0x45')]=_0x308085;return _0x423a38;})[_0x2bcd('0x28')](respondWithFilteredResult(_0x90ac55,_0x5d0a66))[_0x2bcd('0x46')](handleError(_0x90ac55,null));};exports[_0x2bcd('0x47')]=function(_0x913999,_0x5dbee2){var _0x135d7c={'raw':!![],'where':{'id':_0x913999[_0x2bcd('0x48')]['id']}},_0x2b4cce={};_0x2b4cce[_0x2bcd('0x34')]=_['keys'](db['SmsQueue'][_0x2bcd('0x49')]);_0x2b4cce['query']=_[_0x2bcd('0x36')](_0x913999[_0x2bcd('0x35')]);_0x2b4cce[_0x2bcd('0x37')]=_['intersection'](_0x2b4cce[_0x2bcd('0x34')],_0x2b4cce[_0x2bcd('0x35')]);_0x135d7c['attributes']=_['intersection'](_0x2b4cce[_0x2bcd('0x34')],qs['fields'](_0x913999[_0x2bcd('0x35')][_0x2bcd('0x3a')]));_0x135d7c[_0x2bcd('0x39')]=_0x135d7c['attributes'][_0x2bcd('0x3b')]?_0x135d7c[_0x2bcd('0x39')]:_0x2b4cce[_0x2bcd('0x34')];if(_0x913999[_0x2bcd('0x35')][_0x2bcd('0x4a')]){_0x135d7c[_0x2bcd('0x4b')]=[{'all':!![]}];}_0x135d7c=_['merge']({},_0x135d7c,_0x913999[_0x2bcd('0x43')]);return db['SmsQueue'][_0x2bcd('0x4c')](_0x135d7c)[_0x2bcd('0x28')](handleEntityNotFound(_0x5dbee2,null))[_0x2bcd('0x28')](respondWithResult(_0x5dbee2,null))[_0x2bcd('0x46')](handleError(_0x5dbee2,null));};exports[_0x2bcd('0x4d')]=function(_0x5f3ad6,_0x197a17){return db['SmsQueue'][_0x2bcd('0x4d')](_0x5f3ad6[_0x2bcd('0x4e')],{})[_0x2bcd('0x28')](function(_0xa658a8){var _0x37ba76=_0x5f3ad6['user'][_0x2bcd('0x29')]({'plain':!![]});if(!_0x37ba76)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x37ba76[_0x2bcd('0x4f')]===_0x2bcd('0x50')){var _0x9637ec=_0xa658a8[_0x2bcd('0x29')]({'plain':!![]});var _0x2c5e75=_0x2bcd('0x51');return db[_0x2bcd('0x52')][_0x2bcd('0x4c')]({'where':{'name':_0x2c5e75,'userProfileId':_0x37ba76['userProfileId']},'raw':!![]})[_0x2bcd('0x28')](function(_0x22cbb9){if(_0x22cbb9&&_0x22cbb9[_0x2bcd('0x53')]===0x0){return db[_0x2bcd('0x2a')][_0x2bcd('0x4d')]({'name':_0x9637ec['name'],'resourceId':_0x9637ec['id'],'type':_0x22cbb9[_0x2bcd('0x2d')],'sectionId':_0x22cbb9['id']},{})[_0x2bcd('0x28')](function(){return _0xa658a8;});}else{return _0xa658a8;}})[_0x2bcd('0x46')](function(_0x521175){logger[_0x2bcd('0x2b')](_0x2bcd('0x54'),_0x521175);throw _0x521175;});}return _0xa658a8;})[_0x2bcd('0x28')](respondWithResult(_0x197a17,0xc9))[_0x2bcd('0x46')](handleError(_0x197a17,null));};exports[_0x2bcd('0x26')]=function(_0x12d4bd,_0x3c965a){if(_0x12d4bd[_0x2bcd('0x4e')]['id']){delete _0x12d4bd[_0x2bcd('0x4e')]['id'];}return db[_0x2bcd('0x31')][_0x2bcd('0x4c')]({'where':{'id':_0x12d4bd[_0x2bcd('0x48')]['id']}})[_0x2bcd('0x28')](handleEntityNotFound(_0x3c965a,null))[_0x2bcd('0x28')](saveUpdates(_0x12d4bd[_0x2bcd('0x4e')],null))[_0x2bcd('0x28')](respondWithResult(_0x3c965a,null))[_0x2bcd('0x46')](handleError(_0x3c965a,null));};exports[_0x2bcd('0x27')]=function(_0xbd768e,_0x4266b5){return db['SmsQueue'][_0x2bcd('0x4c')]({'where':{'id':_0xbd768e[_0x2bcd('0x48')]['id']}})[_0x2bcd('0x28')](handleEntityNotFound(_0x4266b5,null))[_0x2bcd('0x28')](removeEntity(_0x4266b5,null))[_0x2bcd('0x46')](handleError(_0x4266b5,null));};exports[_0x2bcd('0x55')]=function(_0x150513,_0x2ab972){return db[_0x2bcd('0x31')][_0x2bcd('0x55')]()[_0x2bcd('0x28')](respondWithResult(_0x2ab972,null))['catch'](handleError(_0x2ab972,null));};exports['getMembers']=function(_0x2bcdad,_0xb1aed3,_0xbf1815){var _0x3720ec={'raw':!![],'where':{}},_0x1a0aaa={},_0x13dd3f;return db[_0x2bcd('0x31')][_0x2bcd('0x56')]({'where':{'id':_0x2bcdad[_0x2bcd('0x48')]['id']}})['then'](handleEntityNotFound(_0xb1aed3,null))[_0x2bcd('0x28')](function(_0x2e396a){if(_0x2e396a){_0x13dd3f=_0x2e396a[_0x2bcd('0x29')]({'plain':!![]});_0x1a0aaa[_0x2bcd('0x34')]=_[_0x2bcd('0x36')](db[_0x2bcd('0x57')][_0x2bcd('0x49')]);_0x1a0aaa[_0x2bcd('0x35')]=_[_0x2bcd('0x36')](_0x2bcdad[_0x2bcd('0x35')]);_0x1a0aaa['filters']=_[_0x2bcd('0x38')](_0x1a0aaa['model'],_0x1a0aaa['query']);_0x3720ec[_0x2bcd('0x39')]=_[_0x2bcd('0x38')](_0x1a0aaa['model'],qs['fields'](_0x2bcdad[_0x2bcd('0x35')][_0x2bcd('0x3a')]));_0x3720ec[_0x2bcd('0x39')]=_0x3720ec[_0x2bcd('0x39')]['length']?_0x3720ec[_0x2bcd('0x39')]:_0x1a0aaa[_0x2bcd('0x34')];if(!_0x2bcdad[_0x2bcd('0x35')][_0x2bcd('0x58')]('nolimit')){_0x3720ec[_0x2bcd('0x3c')]=qs[_0x2bcd('0x3c')](_0x2bcdad['query'][_0x2bcd('0x3c')]);_0x3720ec['offset']=qs[_0x2bcd('0x1e')](_0x2bcdad[_0x2bcd('0x35')]['offset']);}_0x3720ec['order']=qs[_0x2bcd('0x3e')](_0x2bcdad[_0x2bcd('0x35')][_0x2bcd('0x3e')]);_0x3720ec[_0x2bcd('0x3f')]=qs[_0x2bcd('0x37')](_[_0x2bcd('0x59')](_0x2bcdad[_0x2bcd('0x35')],_0x1a0aaa[_0x2bcd('0x37')]));_0x3720ec['where'][_0x2bcd('0x5a')]=_0x2e396a['id'];if(_0x2bcdad[_0x2bcd('0x35')][_0x2bcd('0x42')]){_0x3720ec['where']=_['merge'](_0x3720ec[_0x2bcd('0x3f')],{'$or':_[_0x2bcd('0x30')](_0x3720ec[_0x2bcd('0x39')],function(_0x580209){var _0x87d550={};_0x87d550[_0x580209]={'$like':'%'+_0x2bcdad[_0x2bcd('0x35')]['filter']+'%'};return _0x87d550;})});}_0x3720ec=_[_0x2bcd('0x40')]({},_0x3720ec,_0x2bcdad[_0x2bcd('0x43')]);return db[_0x2bcd('0x57')][_0x2bcd('0x44')](_0x3720ec);}})[_0x2bcd('0x28')](function(_0x29c151){if(_0x29c151){return db[_0x2bcd('0x5b')][_0x2bcd('0x5c')]({'where':{'id':_[_0x2bcd('0x30')](_0x29c151,_0x2bcd('0x5d')),'role':_0x2bcd('0x5e')},'attributes':['id',_0x2bcd('0x2d'),_0x2bcd('0x5f'),_0x2bcd('0x60'),'createdAt']});}})[_0x2bcd('0x28')](function(_0x62c5e4){if(_0x62c5e4){return{'count':_0x62c5e4[_0x2bcd('0x20')],'rows':_['map'](_0x62c5e4[_0x2bcd('0x45')],function(_0x54ed58){return{'membername':_0x54ed58['name'],'UserId':_0x54ed58['id'],'queue_name':_0x13dd3f['name'],'SmsQueueId':_0x13dd3f['id'],'interface':util[_0x2bcd('0x61')](_0x2bcd('0x62'),_0x2bcd('0x63'),_0x54ed58['name']),'penalty':0x0,'paused':_0x54ed58[_0x2bcd('0x5f')],'createdAt':_0x54ed58[_0x2bcd('0x64')],'updatedAt':_0x54ed58[_0x2bcd('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2bcd('0x28')](respondWithFilteredResult(_0xb1aed3,_0x3720ec))['catch'](handleError(_0xb1aed3,null));};exports[_0x2bcd('0x65')]=function(_0x5e9b57,_0x196fbf,_0x472b57){var _0xb2744b={};var _0x444dc7={};var _0x1301df;var _0x54805b;return db[_0x2bcd('0x31')][_0x2bcd('0x56')]({'where':{'id':_0x5e9b57[_0x2bcd('0x48')]['id']}})[_0x2bcd('0x28')](handleEntityNotFound(_0x196fbf,null))[_0x2bcd('0x28')](function(_0x158417){if(_0x158417){_0x1301df=_0x158417;_0x444dc7[_0x2bcd('0x34')]=_[_0x2bcd('0x36')](db[_0x2bcd('0x66')][_0x2bcd('0x49')]);_0x444dc7[_0x2bcd('0x35')]=_['keys'](_0x5e9b57[_0x2bcd('0x35')]);_0x444dc7[_0x2bcd('0x37')]=_['intersection'](_0x444dc7[_0x2bcd('0x34')],_0x444dc7[_0x2bcd('0x35')]);_0xb2744b['attributes']=_['intersection'](_0x444dc7['model'],qs[_0x2bcd('0x3a')](_0x5e9b57['query'][_0x2bcd('0x3a')]));_0xb2744b[_0x2bcd('0x39')]=_0xb2744b[_0x2bcd('0x39')][_0x2bcd('0x3b')]?_0xb2744b[_0x2bcd('0x39')]:_0x444dc7[_0x2bcd('0x34')];_0xb2744b[_0x2bcd('0x3d')]=qs[_0x2bcd('0x3e')](_0x5e9b57[_0x2bcd('0x35')]['sort']);_0xb2744b[_0x2bcd('0x3f')]=qs[_0x2bcd('0x37')](_[_0x2bcd('0x59')](_0x5e9b57[_0x2bcd('0x35')],_0x444dc7[_0x2bcd('0x37')]));if(_0x5e9b57[_0x2bcd('0x35')]['filter']){_0xb2744b['where']=_[_0x2bcd('0x40')](_0xb2744b[_0x2bcd('0x3f')],{'$or':_[_0x2bcd('0x30')](_0xb2744b['attributes'],function(_0x364ab8){var _0x2fc00={};_0x2fc00[_0x364ab8]={'$like':'%'+_0x5e9b57['query'][_0x2bcd('0x42')]+'%'};return _0x2fc00;})});}_0xb2744b=_[_0x2bcd('0x40')]({},_0xb2744b,_0x5e9b57[_0x2bcd('0x43')]);return _0x1301df[_0x2bcd('0x65')](_0xb2744b);}})[_0x2bcd('0x28')](function(_0x999dc8){if(_0x999dc8){_0x54805b=_0x999dc8['length'];if(!_0x5e9b57[_0x2bcd('0x35')]['hasOwnProperty']('nolimit')){_0xb2744b[_0x2bcd('0x3c')]=qs[_0x2bcd('0x3c')](_0x5e9b57[_0x2bcd('0x35')][_0x2bcd('0x3c')]);_0xb2744b[_0x2bcd('0x1e')]=qs['offset'](_0x5e9b57[_0x2bcd('0x35')][_0x2bcd('0x1e')]);}return _0x1301df[_0x2bcd('0x65')](_0xb2744b);}})['then'](function(_0x179926){if(_0x179926){return _0x179926?{'count':_0x54805b,'rows':_0x179926}:null;}})['then'](respondWithResult(_0x196fbf,null))['catch'](handleError(_0x196fbf,null));};exports[_0x2bcd('0x67')]=function(_0x35586f,_0x1baabf,_0x5093f7){var _0x2a5b24=_0x35586f['body']['ids'];return db[_0x2bcd('0x66')][_0x2bcd('0x44')]({'where':{'id':_0x2a5b24},'attributes':['id'],'include':[{'model':db[_0x2bcd('0x5b')],'as':_0x2bcd('0x68'),'attributes':['id',_0x2bcd('0x2d'),_0x2bcd('0x69'),_0x2bcd('0x6a'),_0x2bcd('0x6b')],'raw':!![]}]})['then'](function(_0x521627){if(_0x521627){var _0x31e95c=_['flatMap'](_0x521627,function(_0x1c8d32){var _0x5854d8=_0x1c8d32[_0x2bcd('0x29')]({'plain':!![]});return _0x5854d8['Agents'];});return db[_0x2bcd('0x31')][_0x2bcd('0x4c')]({'where':{'id':_0x35586f[_0x2bcd('0x48')]['id']}})['then'](function(_0x6ec3c0){return db[_0x2bcd('0x6c')]['transaction'](function(_0x43ffd4){return _0x6ec3c0['addTeams'](_0x2a5b24,{'transaction':_0x43ffd4})[_0x2bcd('0x28')](function(){return BPromise['each'](_0x31e95c,function(_0x147d76){return db[_0x2bcd('0x57')][_0x2bcd('0x6d')]({'where':{'UserId':_0x147d76['id'],'SmsQueueId':_0x35586f['params']['id']},'transaction':_0x43ffd4});});})[_0x2bcd('0x28')](function(){_0x31e95c[_0x2bcd('0x6e')](function(_0xb3c59e){socket[_0x2bcd('0x6f')](_0x2bcd('0x70'),{'UserId':_0xb3c59e['id'],'SmsQueueId':_0x6ec3c0['id']});});});});});}})['then'](respondWithStatusCode(_0x1baabf,null))[_0x2bcd('0x46')](handleError(_0x1baabf,null));};exports[_0x2bcd('0x71')]=function(_0x5a3322,_0x138b79,_0x330182){return db[_0x2bcd('0x66')][_0x2bcd('0x44')]({'where':{'id':_0x5a3322['query'][_0x2bcd('0x72')]},'attributes':['id'],'include':[{'model':db[_0x2bcd('0x5b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2bcd('0x28')](handleEntityNotFound(_0x138b79,null))[_0x2bcd('0x28')](function(_0x18b6dd){var _0x207afc=_[_0x2bcd('0x30')](_0x18b6dd,'id');var _0x357782=[];var _0x4589a1=[];var _0xd5c2c7=squel[_0x2bcd('0x73')]();_0xd5c2c7[_0x2bcd('0x74')](_0x2bcd('0x75'))[_0x2bcd('0x76')](_0x2bcd('0x77'),'tq')[_0x2bcd('0x78')](_0x2bcd('0x79'),'ut',_0x2bcd('0x7a'))['where']('SmsQueueId\x20=\x20?',_0x5a3322['params']['id']);for(var _0x4a11c8=0x0;_0x4a11c8<_0x18b6dd[_0x2bcd('0x3b')];_0x4a11c8+=0x1){let _0x2339fa=_0x18b6dd[_0x4a11c8];for(var _0x4fcbca=0x0;_0x4fcbca<_0x2339fa[_0x2bcd('0x68')][_0x2bcd('0x3b')];_0x4fcbca+=0x1){let _0x3daeb2=_0x2339fa[_0x2bcd('0x68')][_0x4fcbca];var _0x411ac6=_0xd5c2c7[_0x2bcd('0x7b')]();_0x411ac6['where'](_0x2bcd('0x7c'),_0x3daeb2['id']);_0x4589a1['push'](db[_0x2bcd('0x6c')][_0x2bcd('0x35')](_0x411ac6['toString'](),{'type':db[_0x2bcd('0x6c')][_0x2bcd('0x7d')]['SELECT']})[_0x2bcd('0x28')](function(_0xde7487){if(_0xde7487['length']===0x1){return _0x3daeb2['id'];}else{var _0x261153=_['every'](_[_0x2bcd('0x30')](_0xde7487,_0x2bcd('0x7e')),function(_0x405593){return _['includes'](_0x207afc,_0x405593);});if(_0x261153){return _0x3daeb2['id'];}}}));}}return BPromise[_0x2bcd('0x7f')](_0x4589a1)['then'](function(_0x4573f8){_0x357782=_(_0x357782)['union'](_0x4573f8)['compact']()['value']();return db[_0x2bcd('0x31')][_0x2bcd('0x4c')]({'where':{'id':_0x5a3322[_0x2bcd('0x48')]['id']}})[_0x2bcd('0x28')](function(_0x1d682a){return db[_0x2bcd('0x6c')]['transaction'](function(_0x149acb){return _0x1d682a[_0x2bcd('0x71')](_0x5a3322['query'][_0x2bcd('0x72')],{'transaction':_0x149acb})['then'](function(){if(!_[_0x2bcd('0x80')](_0x357782)){return _0x1d682a[_0x2bcd('0x81')](_0x357782,{'transaction':_0x149acb});}})[_0x2bcd('0x28')](function(){_0x357782[_0x2bcd('0x6e')](function(_0x230945){socket[_0x2bcd('0x6f')](_0x2bcd('0x82'),{'UserId':_0x230945,'SmsQueueId':_0x1d682a['id']});});});});});});})[_0x2bcd('0x28')](respondWithStatusCode(_0x138b79,null))[_0x2bcd('0x46')](handleError(_0x138b79,null));};exports[_0x2bcd('0x83')]=function(_0x33d5b9,_0x2300a4,_0x4ee070){return db[_0x2bcd('0x31')]['find']({'where':{'id':_0x33d5b9[_0x2bcd('0x48')]['id']}})[_0x2bcd('0x28')](handleEntityNotFound(_0x2300a4,null))['then'](function(_0x61a1cb){if(_0x61a1cb){return _0x61a1cb[_0x2bcd('0x83')](_0x33d5b9[_0x2bcd('0x4e')][_0x2bcd('0x72')],_['omit'](_0x33d5b9[_0x2bcd('0x4e')],[_0x2bcd('0x72'),'id'])||{})[_0x2bcd('0x84')](function(_0x3cbc2d){for(var _0x4da04b=0x0;_0x4da04b<_0x33d5b9[_0x2bcd('0x4e')]['ids'][_0x2bcd('0x3b')];_0x4da04b+=0x1){socket[_0x2bcd('0x6f')]('userSmsQueue:save',{'UserId':Number(_0x33d5b9['body'][_0x2bcd('0x72')][_0x4da04b]),'SmsQueueId':Number(_0x33d5b9['params']['id'])});}return _0x3cbc2d;});}})['then'](respondWithResult(_0x2300a4,null))[_0x2bcd('0x46')](handleError(_0x2300a4,null));};exports[_0x2bcd('0x81')]=function(_0xa519bf,_0x2e676d,_0x4bacac){return db['SmsQueue'][_0x2bcd('0x4c')]({'where':{'id':_0xa519bf[_0x2bcd('0x48')]['id']}})[_0x2bcd('0x28')](handleEntityNotFound(_0x2e676d,null))[_0x2bcd('0x28')](function(_0x4cc60f){if(_0x4cc60f){return _0x4cc60f[_0x2bcd('0x81')](_0xa519bf['query'][_0x2bcd('0x72')])[_0x2bcd('0x28')](function(){if(_['isArray'](_0xa519bf['query'][_0x2bcd('0x72')])){for(var _0x374b85=0x0;_0x374b85<_0xa519bf[_0x2bcd('0x35')][_0x2bcd('0x72')]['length'];_0x374b85+=0x1){socket[_0x2bcd('0x6f')]('userSmsQueue:remove',{'UserId':Number(_0xa519bf[_0x2bcd('0x35')][_0x2bcd('0x72')][_0x374b85]),'SmsQueueId':Number(_0xa519bf[_0x2bcd('0x48')]['id'])});}}else{socket[_0x2bcd('0x6f')](_0x2bcd('0x82'),{'UserId':Number(_0xa519bf[_0x2bcd('0x35')]['ids']),'SmsQueueId':Number(_0xa519bf[_0x2bcd('0x48')]['id'])});}});}})[_0x2bcd('0x28')](respondWithStatusCode(_0x2e676d,null))['catch'](handleError(_0x2e676d,null));};exports[_0x2bcd('0x85')]=function(_0x3915ca,_0x572244,_0xee4786){var _0x5e0128={};var _0xb9fbd6={};var _0x560d26;var _0x1231f4;return db[_0x2bcd('0x31')]['findOne']({'where':{'id':_0x3915ca[_0x2bcd('0x48')]['id']}})[_0x2bcd('0x28')](handleEntityNotFound(_0x572244,null))[_0x2bcd('0x28')](function(_0xe99066){if(_0xe99066){_0x560d26=_0xe99066;_0xb9fbd6['model']=_[_0x2bcd('0x36')](db[_0x2bcd('0x5b')][_0x2bcd('0x49')]);_0xb9fbd6[_0x2bcd('0x35')]=_[_0x2bcd('0x36')](_0x3915ca['query']);_0xb9fbd6['filters']=_[_0x2bcd('0x38')](_0xb9fbd6[_0x2bcd('0x34')],_0xb9fbd6[_0x2bcd('0x35')]);_0x5e0128[_0x2bcd('0x39')]=_['intersection'](_0xb9fbd6[_0x2bcd('0x34')],qs['fields'](_0x3915ca['query'][_0x2bcd('0x3a')]));_0x5e0128[_0x2bcd('0x39')]=_0x5e0128['attributes'][_0x2bcd('0x3b')]?_0x5e0128[_0x2bcd('0x39')]:_0xb9fbd6['model'];_0x5e0128[_0x2bcd('0x3d')]=qs[_0x2bcd('0x3e')](_0x3915ca['query']['sort']);_0x5e0128[_0x2bcd('0x3f')]=qs[_0x2bcd('0x37')](_[_0x2bcd('0x59')](_0x3915ca[_0x2bcd('0x35')],_0xb9fbd6[_0x2bcd('0x37')]));if(_0x3915ca[_0x2bcd('0x35')]['filter']){_0x5e0128[_0x2bcd('0x3f')]=_[_0x2bcd('0x40')](_0x5e0128[_0x2bcd('0x3f')],{'$or':_[_0x2bcd('0x30')](_0x5e0128[_0x2bcd('0x39')],function(_0x2508e1){var _0x55350a={};_0x55350a[_0x2508e1]={'$like':'%'+_0x3915ca[_0x2bcd('0x35')][_0x2bcd('0x42')]+'%'};return _0x55350a;})});}_0x5e0128=_[_0x2bcd('0x40')]({},_0x5e0128,_0x3915ca[_0x2bcd('0x43')]);return _0x560d26['getAgents'](_0x5e0128);}})['then'](function(_0x6aa4c0){if(_0x6aa4c0){_0x1231f4=_0x6aa4c0[_0x2bcd('0x3b')];if(!_0x3915ca[_0x2bcd('0x35')][_0x2bcd('0x58')](_0x2bcd('0x86'))){_0x5e0128[_0x2bcd('0x3c')]=qs['limit'](_0x3915ca[_0x2bcd('0x35')][_0x2bcd('0x3c')]);_0x5e0128[_0x2bcd('0x1e')]=qs[_0x2bcd('0x1e')](_0x3915ca[_0x2bcd('0x35')][_0x2bcd('0x1e')]);}return _0x560d26['getAgents'](_0x5e0128);}})[_0x2bcd('0x28')](function(_0x320b44){if(_0x320b44){return _0x320b44?{'count':_0x1231f4,'rows':_0x320b44}:null;}})[_0x2bcd('0x28')](respondWithResult(_0x572244,null))['catch'](handleError(_0x572244,null));}; \ No newline at end of file +var _0xa6b0=['forEach','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','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','redis','defaults','./smsQueue.socket','register','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','reject','save','update','then','destroy','SmsQueues','UserProfileResource','error','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','SmsQueue','include','rows','show','params','includeAll','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','describe','findOne','UserSmsQueue','findAll','User','findAndCountAll','UserId','smsPause','updatedAt','createdAt','count','format','%s/%s','SIP','Team','getTeams','addTeams','ids','Agents','interface','sequelize','transaction','each','findOrCreate'];(function(_0x56608c,_0x29eb74){var _0x3c7fb0=function(_0x154b1c){while(--_0x154b1c){_0x56608c['push'](_0x56608c['shift']());}};_0x3c7fb0(++_0x29eb74);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x3aff05,_0x267404){_0x3aff05=_0x3aff05-0x0;var _0x1f1adc=_0xa6b0[_0x3aff05];return _0x1f1adc;};'use strict';var emlformat=require(_0x0a6b('0x0'));var rimraf=require(_0x0a6b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a6b('0x2'));var moment=require(_0x0a6b('0x3'));var BPromise=require(_0x0a6b('0x4'));var Mustache=require('mustache');var util=require(_0x0a6b('0x5'));var path=require(_0x0a6b('0x6'));var sox=require(_0x0a6b('0x7'));var csv=require(_0x0a6b('0x8'));var ejs=require(_0x0a6b('0x9'));var fs=require('fs');var fs_extra=require(_0x0a6b('0xa'));var _=require(_0x0a6b('0xb'));var squel=require(_0x0a6b('0xc'));var crypto=require(_0x0a6b('0xd'));var jsforce=require(_0x0a6b('0xe'));var deskjs=require(_0x0a6b('0xf'));var toCsv=require(_0x0a6b('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0a6b('0x10'));var authService=require(_0x0a6b('0x11'));var qs=require(_0x0a6b('0x12'));var as=require(_0x0a6b('0x13'));var hardwareService=require(_0x0a6b('0x14'));var logger=require(_0x0a6b('0x15'))(_0x0a6b('0x16'));var utils=require(_0x0a6b('0x17'));var config=require(_0x0a6b('0x18'));var licenseUtil=require(_0x0a6b('0x19'));var db=require(_0x0a6b('0x1a'))['db'];config[_0x0a6b('0x1b')]=_[_0x0a6b('0x1c')](config[_0x0a6b('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a6b('0x1b')]));require(_0x0a6b('0x1d'))[_0x0a6b('0x1e')](socket);function respondWithStatusCode(_0x177e87,_0x8bbc03){_0x8bbc03=_0x8bbc03||0xcc;return function(_0x45fc9f){if(_0x45fc9f){return _0x177e87[_0x0a6b('0x1f')](_0x8bbc03);}return _0x177e87[_0x0a6b('0x20')](_0x8bbc03)[_0x0a6b('0x21')]();};}function respondWithResult(_0x9d7aba,_0x4797d1){_0x4797d1=_0x4797d1||0xc8;return function(_0xa36d75){if(_0xa36d75){return _0x9d7aba[_0x0a6b('0x20')](_0x4797d1)['json'](_0xa36d75);}};}function respondWithFilteredResult(_0x290f7f,_0x4d0e3b){return function(_0xcb412){if(_0xcb412){var _0x31f347=typeof _0x4d0e3b[_0x0a6b('0x22')]===_0x0a6b('0x23')&&typeof _0x4d0e3b['limit']===_0x0a6b('0x23');var _0x296162=_0xcb412['count'];var _0x19848c=_0x31f347?0x0:_0x4d0e3b[_0x0a6b('0x22')];var _0x1feb47=_0x31f347?_0xcb412['count']:_0x4d0e3b[_0x0a6b('0x22')]+_0x4d0e3b[_0x0a6b('0x24')];var _0x4077c6;if(_0x1feb47>=_0x296162){_0x1feb47=_0x296162;_0x4077c6=0xc8;}else{_0x4077c6=0xce;}_0x290f7f['status'](_0x4077c6);return _0x290f7f[_0x0a6b('0x25')](_0x0a6b('0x26'),_0x19848c+'-'+_0x1feb47+'/'+_0x296162)[_0x0a6b('0x27')](_0xcb412);}return null;};}function patchUpdates(_0x5e8206){return function(_0x122c19){try{jsonpatch['apply'](_0x122c19,_0x5e8206,!![]);}catch(_0x1e5065){return BPromise[_0x0a6b('0x28')](_0x1e5065);}return _0x122c19[_0x0a6b('0x29')]();};}function saveUpdates(_0x5c77fb,_0x2bd8b1){return function(_0x2e58fd){if(_0x2e58fd){return _0x2e58fd[_0x0a6b('0x2a')](_0x5c77fb)[_0x0a6b('0x2b')](function(_0x3b12a2){return _0x3b12a2;});}return null;};}function removeEntity(_0x5b2229,_0x3e6a1d){return function(_0x243779){if(_0x243779){return _0x243779[_0x0a6b('0x2c')]()['then'](function(){var _0x3a9092=_0x243779['get']({'plain':!![]});var _0xecbf0c=_0x0a6b('0x2d');return db[_0x0a6b('0x2e')]['destroy']({'where':{'type':_0xecbf0c,'resourceId':_0x3a9092['id']}})['then'](function(){return _0x243779;});})[_0x0a6b('0x2b')](function(){_0x5b2229[_0x0a6b('0x20')](0xcc)[_0x0a6b('0x21')]();});}};}function handleEntityNotFound(_0x3d649e,_0x1935a3){return function(_0x2bbcb1){if(!_0x2bbcb1){_0x3d649e['sendStatus'](0x194);}return _0x2bbcb1;};}function handleError(_0xa7ab7c,_0x439d27){_0x439d27=_0x439d27||0x1f4;return function(_0x5f0b31){logger[_0x0a6b('0x2f')](_0x5f0b31['stack']);if(_0x5f0b31['name']){delete _0x5f0b31[_0x0a6b('0x30')];}_0xa7ab7c[_0x0a6b('0x20')](_0x439d27)[_0x0a6b('0x31')](_0x5f0b31);};}exports[_0x0a6b('0x32')]=function(_0x8d6b8a,_0x55cbd3){var _0x5e12bc={},_0x206fab={},_0xd6b4ad={'count':0x0,'rows':[]};var _0x235cc3=_[_0x0a6b('0x33')](db['SmsQueue'][_0x0a6b('0x34')],function(_0x2159a5){return{'name':_0x2159a5['fieldName'],'type':_0x2159a5['type'][_0x0a6b('0x35')]};});_0x206fab[_0x0a6b('0x36')]=_['map'](_0x235cc3,_0x0a6b('0x30'));_0x206fab[_0x0a6b('0x37')]=_[_0x0a6b('0x38')](_0x8d6b8a[_0x0a6b('0x37')]);_0x206fab[_0x0a6b('0x39')]=_[_0x0a6b('0x3a')](_0x206fab[_0x0a6b('0x36')],_0x206fab[_0x0a6b('0x37')]);_0x5e12bc[_0x0a6b('0x3b')]=_[_0x0a6b('0x3a')](_0x206fab[_0x0a6b('0x36')],qs[_0x0a6b('0x3c')](_0x8d6b8a['query'][_0x0a6b('0x3c')]));_0x5e12bc[_0x0a6b('0x3b')]=_0x5e12bc['attributes'][_0x0a6b('0x3d')]?_0x5e12bc[_0x0a6b('0x3b')]:_0x206fab[_0x0a6b('0x36')];if(!_0x8d6b8a[_0x0a6b('0x37')][_0x0a6b('0x3e')](_0x0a6b('0x3f'))){_0x5e12bc[_0x0a6b('0x24')]=qs[_0x0a6b('0x24')](_0x8d6b8a[_0x0a6b('0x37')]['limit']);_0x5e12bc[_0x0a6b('0x22')]=qs[_0x0a6b('0x22')](_0x8d6b8a[_0x0a6b('0x37')][_0x0a6b('0x22')]);}_0x5e12bc[_0x0a6b('0x40')]=qs[_0x0a6b('0x41')](_0x8d6b8a[_0x0a6b('0x37')][_0x0a6b('0x41')]);_0x5e12bc[_0x0a6b('0x42')]=qs['filters'](_[_0x0a6b('0x43')](_0x8d6b8a[_0x0a6b('0x37')],_0x206fab[_0x0a6b('0x39')]),_0x235cc3);if(_0x8d6b8a[_0x0a6b('0x37')][_0x0a6b('0x44')]){_0x5e12bc[_0x0a6b('0x42')]=_[_0x0a6b('0x45')](_0x5e12bc[_0x0a6b('0x42')],{'$or':_[_0x0a6b('0x33')](_0x235cc3,function(_0x552041){if(_0x552041[_0x0a6b('0x46')]!=='VIRTUAL'){var _0x5a32d6={};_0x5a32d6[_0x552041[_0x0a6b('0x30')]]={'$like':'%'+_0x8d6b8a['query']['filter']+'%'};return _0x5a32d6;}})});}_0x5e12bc=_[_0x0a6b('0x45')]({},_0x5e12bc,_0x8d6b8a[_0x0a6b('0x47')]);var _0x307d4c={'where':_0x5e12bc['where']};return db[_0x0a6b('0x48')]['count'](_0x307d4c)['then'](function(_0x1114f1){_0xd6b4ad['count']=_0x1114f1;if(_0x8d6b8a[_0x0a6b('0x37')]['includeAll']){_0x5e12bc[_0x0a6b('0x49')]=[{'all':!![]}];}return db['SmsQueue']['findAll'](_0x5e12bc);})[_0x0a6b('0x2b')](function(_0x113e49){_0xd6b4ad[_0x0a6b('0x4a')]=_0x113e49;return _0xd6b4ad;})[_0x0a6b('0x2b')](respondWithFilteredResult(_0x55cbd3,_0x5e12bc))['catch'](handleError(_0x55cbd3,null));};exports[_0x0a6b('0x4b')]=function(_0xf92e0f,_0x202748){var _0x15beea={'raw':!![],'where':{'id':_0xf92e0f[_0x0a6b('0x4c')]['id']}},_0xa83e2b={};_0xa83e2b[_0x0a6b('0x36')]=_['keys'](db[_0x0a6b('0x48')][_0x0a6b('0x34')]);_0xa83e2b[_0x0a6b('0x37')]=_[_0x0a6b('0x38')](_0xf92e0f[_0x0a6b('0x37')]);_0xa83e2b[_0x0a6b('0x39')]=_[_0x0a6b('0x3a')](_0xa83e2b[_0x0a6b('0x36')],_0xa83e2b[_0x0a6b('0x37')]);_0x15beea['attributes']=_[_0x0a6b('0x3a')](_0xa83e2b[_0x0a6b('0x36')],qs[_0x0a6b('0x3c')](_0xf92e0f[_0x0a6b('0x37')][_0x0a6b('0x3c')]));_0x15beea[_0x0a6b('0x3b')]=_0x15beea[_0x0a6b('0x3b')]['length']?_0x15beea['attributes']:_0xa83e2b[_0x0a6b('0x36')];if(_0xf92e0f[_0x0a6b('0x37')][_0x0a6b('0x4d')]){_0x15beea[_0x0a6b('0x49')]=[{'all':!![]}];}_0x15beea=_[_0x0a6b('0x45')]({},_0x15beea,_0xf92e0f[_0x0a6b('0x47')]);return db[_0x0a6b('0x48')][_0x0a6b('0x4e')](_0x15beea)[_0x0a6b('0x2b')](handleEntityNotFound(_0x202748,null))['then'](respondWithResult(_0x202748,null))[_0x0a6b('0x4f')](handleError(_0x202748,null));};exports[_0x0a6b('0x50')]=function(_0x46497e,_0x32b40f){return db[_0x0a6b('0x48')]['create'](_0x46497e[_0x0a6b('0x51')],{})[_0x0a6b('0x2b')](function(_0x3aa85f){var _0x5fb0c3=_0x46497e[_0x0a6b('0x52')][_0x0a6b('0x53')]({'plain':!![]});if(!_0x5fb0c3)throw new Error(_0x0a6b('0x54'));if(_0x5fb0c3[_0x0a6b('0x55')]===_0x0a6b('0x52')){var _0x569725=_0x3aa85f['get']({'plain':!![]});var _0x4c81a7=_0x0a6b('0x2d');return db['UserProfileSection'][_0x0a6b('0x4e')]({'where':{'name':_0x4c81a7,'userProfileId':_0x5fb0c3['userProfileId']},'raw':!![]})[_0x0a6b('0x2b')](function(_0x28a343){if(_0x28a343&&_0x28a343[_0x0a6b('0x56')]===0x0){return db['UserProfileResource'][_0x0a6b('0x50')]({'name':_0x569725[_0x0a6b('0x30')],'resourceId':_0x569725['id'],'type':_0x28a343['name'],'sectionId':_0x28a343['id']},{})[_0x0a6b('0x2b')](function(){return _0x3aa85f;});}else{return _0x3aa85f;}})['catch'](function(_0x36545d){logger[_0x0a6b('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36545d);throw _0x36545d;});}return _0x3aa85f;})[_0x0a6b('0x2b')](respondWithResult(_0x32b40f,0xc9))['catch'](handleError(_0x32b40f,null));};exports[_0x0a6b('0x2a')]=function(_0x37957a,_0x1c77b0){if(_0x37957a['body']['id']){delete _0x37957a[_0x0a6b('0x51')]['id'];}return db[_0x0a6b('0x48')][_0x0a6b('0x4e')]({'where':{'id':_0x37957a[_0x0a6b('0x4c')]['id']}})[_0x0a6b('0x2b')](handleEntityNotFound(_0x1c77b0,null))[_0x0a6b('0x2b')](saveUpdates(_0x37957a['body'],null))['then'](respondWithResult(_0x1c77b0,null))['catch'](handleError(_0x1c77b0,null));};exports[_0x0a6b('0x2c')]=function(_0x592f33,_0x3048f1){return db[_0x0a6b('0x48')]['find']({'where':{'id':_0x592f33['params']['id']}})['then'](handleEntityNotFound(_0x3048f1,null))[_0x0a6b('0x2b')](removeEntity(_0x3048f1,null))[_0x0a6b('0x4f')](handleError(_0x3048f1,null));};exports['describe']=function(_0xb84ccf,_0x3e4c4e){return db[_0x0a6b('0x48')][_0x0a6b('0x57')]()[_0x0a6b('0x2b')](respondWithResult(_0x3e4c4e,null))['catch'](handleError(_0x3e4c4e,null));};exports['getMembers']=function(_0x5c8049,_0x40cba9,_0x2fb572){var _0x58d4ce={'raw':!![],'where':{}},_0x385059={},_0x53a7a5;return db[_0x0a6b('0x48')][_0x0a6b('0x58')]({'where':{'id':_0x5c8049[_0x0a6b('0x4c')]['id']}})[_0x0a6b('0x2b')](handleEntityNotFound(_0x40cba9,null))[_0x0a6b('0x2b')](function(_0x5473d3){if(_0x5473d3){_0x53a7a5=_0x5473d3[_0x0a6b('0x53')]({'plain':!![]});_0x385059[_0x0a6b('0x36')]=_[_0x0a6b('0x38')](db[_0x0a6b('0x59')]['rawAttributes']);_0x385059[_0x0a6b('0x37')]=_[_0x0a6b('0x38')](_0x5c8049[_0x0a6b('0x37')]);_0x385059[_0x0a6b('0x39')]=_[_0x0a6b('0x3a')](_0x385059['model'],_0x385059[_0x0a6b('0x37')]);_0x58d4ce[_0x0a6b('0x3b')]=_[_0x0a6b('0x3a')](_0x385059[_0x0a6b('0x36')],qs[_0x0a6b('0x3c')](_0x5c8049[_0x0a6b('0x37')][_0x0a6b('0x3c')]));_0x58d4ce[_0x0a6b('0x3b')]=_0x58d4ce['attributes'][_0x0a6b('0x3d')]?_0x58d4ce[_0x0a6b('0x3b')]:_0x385059[_0x0a6b('0x36')];if(!_0x5c8049[_0x0a6b('0x37')]['hasOwnProperty'](_0x0a6b('0x3f'))){_0x58d4ce[_0x0a6b('0x24')]=qs[_0x0a6b('0x24')](_0x5c8049[_0x0a6b('0x37')][_0x0a6b('0x24')]);_0x58d4ce[_0x0a6b('0x22')]=qs[_0x0a6b('0x22')](_0x5c8049[_0x0a6b('0x37')][_0x0a6b('0x22')]);}_0x58d4ce[_0x0a6b('0x40')]=qs[_0x0a6b('0x41')](_0x5c8049[_0x0a6b('0x37')][_0x0a6b('0x41')]);_0x58d4ce[_0x0a6b('0x42')]=qs[_0x0a6b('0x39')](_['pick'](_0x5c8049['query'],_0x385059[_0x0a6b('0x39')]));_0x58d4ce[_0x0a6b('0x42')]['SmsQueueId']=_0x5473d3['id'];if(_0x5c8049[_0x0a6b('0x37')][_0x0a6b('0x44')]){_0x58d4ce[_0x0a6b('0x42')]=_[_0x0a6b('0x45')](_0x58d4ce[_0x0a6b('0x42')],{'$or':_[_0x0a6b('0x33')](_0x58d4ce[_0x0a6b('0x3b')],function(_0x47d2c7){var _0x16f42f={};_0x16f42f[_0x47d2c7]={'$like':'%'+_0x5c8049[_0x0a6b('0x37')][_0x0a6b('0x44')]+'%'};return _0x16f42f;})});}_0x58d4ce=_['merge']({},_0x58d4ce,_0x5c8049[_0x0a6b('0x47')]);return db['UserSmsQueue'][_0x0a6b('0x5a')](_0x58d4ce);}})[_0x0a6b('0x2b')](function(_0x3c3f50){if(_0x3c3f50){return db[_0x0a6b('0x5b')][_0x0a6b('0x5c')]({'where':{'id':_[_0x0a6b('0x33')](_0x3c3f50,_0x0a6b('0x5d')),'role':'agent'},'attributes':['id',_0x0a6b('0x30'),_0x0a6b('0x5e'),_0x0a6b('0x5f'),_0x0a6b('0x60')]});}})[_0x0a6b('0x2b')](function(_0x56db5d){if(_0x56db5d){return{'count':_0x56db5d[_0x0a6b('0x61')],'rows':_['map'](_0x56db5d['rows'],function(_0xaa13ee){return{'membername':_0xaa13ee[_0x0a6b('0x30')],'UserId':_0xaa13ee['id'],'queue_name':_0x53a7a5[_0x0a6b('0x30')],'SmsQueueId':_0x53a7a5['id'],'interface':util[_0x0a6b('0x62')](_0x0a6b('0x63'),_0x0a6b('0x64'),_0xaa13ee[_0x0a6b('0x30')]),'penalty':0x0,'paused':_0xaa13ee[_0x0a6b('0x5e')],'createdAt':_0xaa13ee[_0x0a6b('0x60')],'updatedAt':_0xaa13ee[_0x0a6b('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0a6b('0x2b')](respondWithFilteredResult(_0x40cba9,_0x58d4ce))[_0x0a6b('0x4f')](handleError(_0x40cba9,null));};exports['getTeams']=function(_0x1388aa,_0x245389,_0x9a112a){var _0x185a59={};var _0x48c704={};var _0x1d28de;var _0x53bedd;return db[_0x0a6b('0x48')][_0x0a6b('0x58')]({'where':{'id':_0x1388aa['params']['id']}})['then'](handleEntityNotFound(_0x245389,null))[_0x0a6b('0x2b')](function(_0x4da8c2){if(_0x4da8c2){_0x1d28de=_0x4da8c2;_0x48c704[_0x0a6b('0x36')]=_['keys'](db[_0x0a6b('0x65')]['rawAttributes']);_0x48c704[_0x0a6b('0x37')]=_[_0x0a6b('0x38')](_0x1388aa['query']);_0x48c704['filters']=_[_0x0a6b('0x3a')](_0x48c704[_0x0a6b('0x36')],_0x48c704[_0x0a6b('0x37')]);_0x185a59[_0x0a6b('0x3b')]=_['intersection'](_0x48c704[_0x0a6b('0x36')],qs['fields'](_0x1388aa[_0x0a6b('0x37')][_0x0a6b('0x3c')]));_0x185a59[_0x0a6b('0x3b')]=_0x185a59[_0x0a6b('0x3b')][_0x0a6b('0x3d')]?_0x185a59[_0x0a6b('0x3b')]:_0x48c704[_0x0a6b('0x36')];_0x185a59[_0x0a6b('0x40')]=qs['sort'](_0x1388aa[_0x0a6b('0x37')]['sort']);_0x185a59[_0x0a6b('0x42')]=qs[_0x0a6b('0x39')](_[_0x0a6b('0x43')](_0x1388aa[_0x0a6b('0x37')],_0x48c704['filters']));if(_0x1388aa[_0x0a6b('0x37')][_0x0a6b('0x44')]){_0x185a59['where']=_[_0x0a6b('0x45')](_0x185a59['where'],{'$or':_[_0x0a6b('0x33')](_0x185a59[_0x0a6b('0x3b')],function(_0x4ef641){var _0x4a3777={};_0x4a3777[_0x4ef641]={'$like':'%'+_0x1388aa[_0x0a6b('0x37')][_0x0a6b('0x44')]+'%'};return _0x4a3777;})});}_0x185a59=_['merge']({},_0x185a59,_0x1388aa[_0x0a6b('0x47')]);return _0x1d28de[_0x0a6b('0x66')](_0x185a59);}})['then'](function(_0x33231d){if(_0x33231d){_0x53bedd=_0x33231d[_0x0a6b('0x3d')];if(!_0x1388aa[_0x0a6b('0x37')]['hasOwnProperty'](_0x0a6b('0x3f'))){_0x185a59[_0x0a6b('0x24')]=qs[_0x0a6b('0x24')](_0x1388aa[_0x0a6b('0x37')]['limit']);_0x185a59[_0x0a6b('0x22')]=qs['offset'](_0x1388aa['query'][_0x0a6b('0x22')]);}return _0x1d28de[_0x0a6b('0x66')](_0x185a59);}})[_0x0a6b('0x2b')](function(_0x2ceb2e){if(_0x2ceb2e){return _0x2ceb2e?{'count':_0x53bedd,'rows':_0x2ceb2e}:null;}})['then'](respondWithResult(_0x245389,null))[_0x0a6b('0x4f')](handleError(_0x245389,null));};exports[_0x0a6b('0x67')]=function(_0x3c7b04,_0x47646d,_0xbb7140){var _0x2cabec=_0x3c7b04[_0x0a6b('0x51')][_0x0a6b('0x68')];return db[_0x0a6b('0x65')][_0x0a6b('0x5a')]({'where':{'id':_0x2cabec},'attributes':['id'],'include':[{'model':db[_0x0a6b('0x5b')],'as':_0x0a6b('0x69'),'attributes':['id',_0x0a6b('0x30'),'online','voicePause',_0x0a6b('0x6a')],'raw':!![]}]})['then'](function(_0x2d73c2){if(_0x2d73c2){var _0xb5e93d=_['flatMap'](_0x2d73c2,function(_0x42e0eb){var _0x689a96=_0x42e0eb[_0x0a6b('0x53')]({'plain':!![]});return _0x689a96[_0x0a6b('0x69')];});return db['SmsQueue'][_0x0a6b('0x4e')]({'where':{'id':_0x3c7b04['params']['id']}})[_0x0a6b('0x2b')](function(_0x2f83f6){return db[_0x0a6b('0x6b')][_0x0a6b('0x6c')](function(_0x948bbb){return _0x2f83f6[_0x0a6b('0x67')](_0x2cabec,{'transaction':_0x948bbb})[_0x0a6b('0x2b')](function(){return BPromise[_0x0a6b('0x6d')](_0xb5e93d,function(_0x1ff5cc){return db[_0x0a6b('0x59')][_0x0a6b('0x6e')]({'where':{'UserId':_0x1ff5cc['id'],'SmsQueueId':_0x3c7b04[_0x0a6b('0x4c')]['id']},'transaction':_0x948bbb});});})[_0x0a6b('0x2b')](function(){_0xb5e93d[_0x0a6b('0x6f')](function(_0x48d5d1){socket[_0x0a6b('0x70')](_0x0a6b('0x71'),{'UserId':_0x48d5d1['id'],'SmsQueueId':_0x2f83f6['id']});});});});});}})['then'](respondWithStatusCode(_0x47646d,null))[_0x0a6b('0x4f')](handleError(_0x47646d,null));};exports[_0x0a6b('0x72')]=function(_0x270dcb,_0x5c4b7e,_0x63e98b){return db[_0x0a6b('0x65')][_0x0a6b('0x5a')]({'where':{'id':_0x270dcb['query'][_0x0a6b('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0a6b('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5c4b7e,null))[_0x0a6b('0x2b')](function(_0xe5279b){var _0x57b5d4=_['map'](_0xe5279b,'id');var _0x5a714f=[];var _0x19320f=[];var _0x385379=squel[_0x0a6b('0x73')]();_0x385379[_0x0a6b('0x74')](_0x0a6b('0x75'))[_0x0a6b('0x76')](_0x0a6b('0x77'),'tq')['join'](_0x0a6b('0x78'),'ut',_0x0a6b('0x79'))['where'](_0x0a6b('0x7a'),_0x270dcb['params']['id']);for(var _0x5b8e37=0x0;_0x5b8e37<_0xe5279b[_0x0a6b('0x3d')];_0x5b8e37+=0x1){let _0x3b1b15=_0xe5279b[_0x5b8e37];for(var _0x566f76=0x0;_0x566f76<_0x3b1b15[_0x0a6b('0x69')][_0x0a6b('0x3d')];_0x566f76+=0x1){let _0x453bda=_0x3b1b15['Agents'][_0x566f76];var _0x150c18=_0x385379[_0x0a6b('0x7b')]();_0x150c18[_0x0a6b('0x42')](_0x0a6b('0x7c'),_0x453bda['id']);_0x19320f[_0x0a6b('0x7d')](db[_0x0a6b('0x6b')]['query'](_0x150c18[_0x0a6b('0x7e')](),{'type':db['sequelize'][_0x0a6b('0x7f')][_0x0a6b('0x80')]})[_0x0a6b('0x2b')](function(_0xb20526){if(_0xb20526['length']===0x1){return _0x453bda['id'];}else{var _0x1cf756=_[_0x0a6b('0x81')](_['map'](_0xb20526,_0x0a6b('0x82')),function(_0x435151){return _[_0x0a6b('0x83')](_0x57b5d4,_0x435151);});if(_0x1cf756){return _0x453bda['id'];}}}));}}return BPromise[_0x0a6b('0x84')](_0x19320f)['then'](function(_0x5c26e5){_0x5a714f=_(_0x5a714f)[_0x0a6b('0x85')](_0x5c26e5)[_0x0a6b('0x86')]()[_0x0a6b('0x87')]();return db['SmsQueue']['find']({'where':{'id':_0x270dcb[_0x0a6b('0x4c')]['id']}})[_0x0a6b('0x2b')](function(_0x1941b7){return db[_0x0a6b('0x6b')][_0x0a6b('0x6c')](function(_0x553cf1){return _0x1941b7['removeTeams'](_0x270dcb[_0x0a6b('0x37')][_0x0a6b('0x68')],{'transaction':_0x553cf1})[_0x0a6b('0x2b')](function(){if(!_[_0x0a6b('0x88')](_0x5a714f)){return _0x1941b7[_0x0a6b('0x89')](_0x5a714f,{'transaction':_0x553cf1});}})[_0x0a6b('0x2b')](function(){_0x5a714f['forEach'](function(_0x1b82bd){socket['emit'](_0x0a6b('0x8a'),{'UserId':_0x1b82bd,'SmsQueueId':_0x1941b7['id']});});});});});});})['then'](respondWithStatusCode(_0x5c4b7e,null))[_0x0a6b('0x4f')](handleError(_0x5c4b7e,null));};exports[_0x0a6b('0x8b')]=function(_0x2144fc,_0x417869,_0x3a87ae){return db['SmsQueue']['find']({'where':{'id':_0x2144fc[_0x0a6b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x417869,null))[_0x0a6b('0x2b')](function(_0x372c1f){if(_0x372c1f){return _0x372c1f[_0x0a6b('0x8b')](_0x2144fc[_0x0a6b('0x51')][_0x0a6b('0x68')],_[_0x0a6b('0x8c')](_0x2144fc[_0x0a6b('0x51')],[_0x0a6b('0x68'),'id'])||{})[_0x0a6b('0x8d')](function(_0x40c56d){for(var _0x5a2029=0x0;_0x5a2029<_0x2144fc['body'][_0x0a6b('0x68')]['length'];_0x5a2029+=0x1){socket[_0x0a6b('0x70')](_0x0a6b('0x71'),{'UserId':Number(_0x2144fc[_0x0a6b('0x51')][_0x0a6b('0x68')][_0x5a2029]),'SmsQueueId':Number(_0x2144fc[_0x0a6b('0x4c')]['id'])});}return _0x40c56d;});}})[_0x0a6b('0x2b')](respondWithResult(_0x417869,null))[_0x0a6b('0x4f')](handleError(_0x417869,null));};exports[_0x0a6b('0x89')]=function(_0x188ee0,_0x390412,_0x38068c){return db[_0x0a6b('0x48')][_0x0a6b('0x4e')]({'where':{'id':_0x188ee0[_0x0a6b('0x4c')]['id']}})[_0x0a6b('0x2b')](handleEntityNotFound(_0x390412,null))[_0x0a6b('0x2b')](function(_0x288c93){if(_0x288c93){return _0x288c93['removeAgents'](_0x188ee0['query'][_0x0a6b('0x68')])[_0x0a6b('0x2b')](function(){if(_['isArray'](_0x188ee0[_0x0a6b('0x37')][_0x0a6b('0x68')])){for(var _0x56c509=0x0;_0x56c509<_0x188ee0[_0x0a6b('0x37')][_0x0a6b('0x68')][_0x0a6b('0x3d')];_0x56c509+=0x1){socket['emit'](_0x0a6b('0x8a'),{'UserId':Number(_0x188ee0[_0x0a6b('0x37')][_0x0a6b('0x68')][_0x56c509]),'SmsQueueId':Number(_0x188ee0[_0x0a6b('0x4c')]['id'])});}}else{socket[_0x0a6b('0x70')](_0x0a6b('0x8a'),{'UserId':Number(_0x188ee0[_0x0a6b('0x37')][_0x0a6b('0x68')]),'SmsQueueId':Number(_0x188ee0[_0x0a6b('0x4c')]['id'])});}});}})[_0x0a6b('0x2b')](respondWithStatusCode(_0x390412,null))[_0x0a6b('0x4f')](handleError(_0x390412,null));};exports[_0x0a6b('0x8e')]=function(_0x38bc68,_0x4dcb2d,_0x2504ab){var _0x51f875={};var _0x586d30={};var _0x43d97;var _0x112490;return db[_0x0a6b('0x48')][_0x0a6b('0x58')]({'where':{'id':_0x38bc68[_0x0a6b('0x4c')]['id']}})[_0x0a6b('0x2b')](handleEntityNotFound(_0x4dcb2d,null))['then'](function(_0x31394d){if(_0x31394d){_0x43d97=_0x31394d;_0x586d30[_0x0a6b('0x36')]=_[_0x0a6b('0x38')](db[_0x0a6b('0x5b')][_0x0a6b('0x34')]);_0x586d30[_0x0a6b('0x37')]=_[_0x0a6b('0x38')](_0x38bc68[_0x0a6b('0x37')]);_0x586d30[_0x0a6b('0x39')]=_[_0x0a6b('0x3a')](_0x586d30['model'],_0x586d30[_0x0a6b('0x37')]);_0x51f875[_0x0a6b('0x3b')]=_[_0x0a6b('0x3a')](_0x586d30[_0x0a6b('0x36')],qs[_0x0a6b('0x3c')](_0x38bc68[_0x0a6b('0x37')]['fields']));_0x51f875[_0x0a6b('0x3b')]=_0x51f875['attributes']['length']?_0x51f875[_0x0a6b('0x3b')]:_0x586d30[_0x0a6b('0x36')];_0x51f875[_0x0a6b('0x40')]=qs[_0x0a6b('0x41')](_0x38bc68[_0x0a6b('0x37')][_0x0a6b('0x41')]);_0x51f875[_0x0a6b('0x42')]=qs['filters'](_[_0x0a6b('0x43')](_0x38bc68[_0x0a6b('0x37')],_0x586d30['filters']));if(_0x38bc68[_0x0a6b('0x37')][_0x0a6b('0x44')]){_0x51f875['where']=_[_0x0a6b('0x45')](_0x51f875[_0x0a6b('0x42')],{'$or':_[_0x0a6b('0x33')](_0x51f875[_0x0a6b('0x3b')],function(_0x50fcaa){var _0xdf2661={};_0xdf2661[_0x50fcaa]={'$like':'%'+_0x38bc68[_0x0a6b('0x37')][_0x0a6b('0x44')]+'%'};return _0xdf2661;})});}_0x51f875=_['merge']({},_0x51f875,_0x38bc68[_0x0a6b('0x47')]);return _0x43d97[_0x0a6b('0x8e')](_0x51f875);}})[_0x0a6b('0x2b')](function(_0xf74204){if(_0xf74204){_0x112490=_0xf74204[_0x0a6b('0x3d')];if(!_0x38bc68['query'][_0x0a6b('0x3e')](_0x0a6b('0x3f'))){_0x51f875[_0x0a6b('0x24')]=qs['limit'](_0x38bc68[_0x0a6b('0x37')]['limit']);_0x51f875['offset']=qs['offset'](_0x38bc68[_0x0a6b('0x37')][_0x0a6b('0x22')]);}return _0x43d97[_0x0a6b('0x8e')](_0x51f875);}})[_0x0a6b('0x2b')](function(_0x5887f4){if(_0x5887f4){return _0x5887f4?{'count':_0x112490,'rows':_0x5887f4}:null;}})[_0x0a6b('0x2b')](respondWithResult(_0x4dcb2d,null))[_0x0a6b('0x4f')](handleError(_0x4dcb2d,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 67eb480..bf6824e 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 _0x7697=['exports','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x305c31,_0x466b17){var _0x17f39f=function(_0x53ae03){while(--_0x53ae03){_0x305c31['push'](_0x305c31['shift']());}};_0x17f39f(++_0x466b17);}(_0x7697,0x8d));var _0x7769=function(_0x16938f,_0x35e57f){_0x16938f=_0x16938f-0x0;var _0x5c66e9=_0x7697[_0x16938f];return _0x5c66e9;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x7769('0x0'))['db'][_0x7769('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x7769('0x2')](0x0);var events={'afterCreate':_0x7769('0x3'),'afterUpdate':_0x7769('0x4'),'afterDestroy':_0x7769('0x5')};function emitEvent(_0x16d5e7){return function(_0x412852,_0x3820c7,_0x113f84){SmsQueueEvents[_0x7769('0x6')](_0x16d5e7+':'+_0x412852['id'],_0x412852);SmsQueueEvents['emit'](_0x16d5e7,_0x412852);_0x113f84(null);};}for(var e in events){if(events[_0x7769('0x7')](e)){var event=events[e];SmsQueue[_0x7769('0x8')](e,emitEvent(event));}}module[_0x7769('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0x9d3d=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0x305b20,_0x5e57e9){var _0x26d64a=function(_0x2e17f0){while(--_0x2e17f0){_0x305b20['push'](_0x305b20['shift']());}};_0x26d64a(++_0x5e57e9);}(_0x9d3d,0xb0));var _0xd9d3=function(_0x941cec,_0x548ed3){_0x941cec=_0x941cec-0x0;var _0x3d551d=_0x9d3d[_0x941cec];return _0x3d551d;};'use strict';var EventEmitter=require(_0xd9d3('0x0'));var SmsQueue=require(_0xd9d3('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xd9d3('0x2')](0x0);var events={'afterCreate':_0xd9d3('0x3'),'afterUpdate':_0xd9d3('0x4'),'afterDestroy':_0xd9d3('0x5')};function emitEvent(_0xb73b8){return function(_0x370875,_0x5b472b,_0x5de190){SmsQueueEvents[_0xd9d3('0x6')](_0xb73b8+':'+_0x370875['id'],_0x370875);SmsQueueEvents[_0xd9d3('0x6')](_0xb73b8,_0x370875);_0x5de190(null);};}for(var e in events){if(events[_0xd9d3('0x7')](e)){var event=events[e];SmsQueue[_0xd9d3('0x8')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 7f5b94f..4990e9d 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 _0xc0f5=['rimraf','./smsQueue.attributes','define','SmsQueue','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x494ed1,_0x4fe2ab){var _0x426046=function(_0x213aad){while(--_0x213aad){_0x494ed1['push'](_0x494ed1['shift']());}};_0x426046(++_0x4fe2ab);}(_0xc0f5,0x1f3));var _0x5c0f=function(_0x236890,_0x1392d6){_0x236890=_0x236890-0x0;var _0x4bb21b=_0xc0f5[_0x236890];return _0x4bb21b;};'use strict';var _=require(_0x5c0f('0x0'));var util=require(_0x5c0f('0x1'));var logger=require(_0x5c0f('0x2'))('api');var moment=require(_0x5c0f('0x3'));var BPromise=require(_0x5c0f('0x4'));var rp=require(_0x5c0f('0x5'));var fs=require('fs');var path=require(_0x5c0f('0x6'));var rimraf=require(_0x5c0f('0x7'));var config=require('../../config/environment');var attributes=require(_0x5c0f('0x8'));module['exports']=function(_0xb421bc,_0x2c3211){return _0xb421bc[_0x5c0f('0x9')](_0x5c0f('0xa'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7758=['define','sms_queues','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./smsQueue.attributes','exports'];(function(_0x474f55,_0x4c2502){var _0x2f379e=function(_0x3cee87){while(--_0x3cee87){_0x474f55['push'](_0x474f55['shift']());}};_0x2f379e(++_0x4c2502);}(_0x7758,0x16d));var _0x8775=function(_0x21906c,_0x3eb792){_0x21906c=_0x21906c-0x0;var _0x22bfd=_0x7758[_0x21906c];return _0x22bfd;};'use strict';var _=require(_0x8775('0x0'));var util=require(_0x8775('0x1'));var logger=require(_0x8775('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8775('0x3'));var rp=require(_0x8775('0x4'));var fs=require('fs');var path=require(_0x8775('0x5'));var rimraf=require('rimraf');var config=require(_0x8775('0x6'));var attributes=require(_0x8775('0x7'));module[_0x8775('0x8')]=function(_0x4b7c10,_0x364901){return _0x4b7c10[_0x8775('0x9')]('SmsQueue',attributes,{'tableName':_0x8775('0xa'),'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 c0ee34a..14df0d3 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 _0xb0f4=['jayson/promise','http','redis','defaults','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetSmsQueue','SmsQueue','findAll','options','where','attributes','limit','include','map','model','catch','ShowSmsQueue','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x58eaaf,_0x4afcad){var _0x5c9c3a=function(_0x5d2d0b){while(--_0x5d2d0b){_0x58eaaf['push'](_0x58eaaf['shift']());}};_0x5c9c3a(++_0x4afcad);}(_0xb0f4,0x14f));var _0x4b0f=function(_0xbc835a,_0x4f2231){_0xbc835a=_0xbc835a-0x0;var _0xc708b6=_0xb0f4[_0xbc835a];return _0xc708b6;};'use strict';var _=require('lodash');var util=require(_0x4b0f('0x0'));var moment=require(_0x4b0f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b0f('0x2'))['db'];var utils=require(_0x4b0f('0x3'));var logger=require(_0x4b0f('0x4'))(_0x4b0f('0x5'));var config=require(_0x4b0f('0x6'));var jayson=require(_0x4b0f('0x7'));var client=jayson['client'][_0x4b0f('0x8')]({'port':0x232a});config[_0x4b0f('0x9')]=_[_0x4b0f('0xa')](config[_0x4b0f('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4b0f('0xb'))(new Redis(config[_0x4b0f('0x9')]));require(_0x4b0f('0xc'))[_0x4b0f('0xd')](socket);function respondWithRpcPromise(_0x5acfd7,_0x5ecad3,_0x544afb){return new BPromise(function(_0x4511bf,_0x2c4280){return client[_0x4b0f('0xe')](_0x5acfd7,_0x544afb)[_0x4b0f('0xf')](function(_0x517123){logger[_0x4b0f('0x10')](_0x4b0f('0x11'),_0x5ecad3,_0x4b0f('0x12'));logger[_0x4b0f('0x13')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x5ecad3,'request\x20sent',JSON[_0x4b0f('0x14')](_0x517123));if(_0x517123['error']){if(_0x517123[_0x4b0f('0x15')][_0x4b0f('0x16')]===0x1f4){logger[_0x4b0f('0x15')](_0x4b0f('0x11'),_0x5ecad3,_0x517123['error'][_0x4b0f('0x17')]);return _0x2c4280(_0x517123[_0x4b0f('0x15')]['message']);}logger[_0x4b0f('0x15')](_0x4b0f('0x11'),_0x5ecad3,_0x517123[_0x4b0f('0x15')][_0x4b0f('0x17')]);return _0x4511bf(_0x517123['error']['message']);}else{logger[_0x4b0f('0x10')](_0x4b0f('0x11'),_0x5ecad3,_0x4b0f('0x12'));_0x4511bf(_0x517123['result']['message']);}})['catch'](function(_0x310dd8){logger[_0x4b0f('0x15')]('SmsQueue,\x20%s,\x20%s',_0x5ecad3,_0x310dd8);_0x2c4280(_0x310dd8);});});}exports[_0x4b0f('0x18')]=function(_0x265e21){var _0x3972fe=this;return new Promise(function(_0x1654c1,_0x59f5fd){return db[_0x4b0f('0x19')][_0x4b0f('0x1a')]({'raw':_0x265e21[_0x4b0f('0x1b')]?_0x265e21['options']['raw']===undefined?!![]:![]:!![],'where':_0x265e21[_0x4b0f('0x1b')]?_0x265e21[_0x4b0f('0x1b')][_0x4b0f('0x1c')]||null:null,'attributes':_0x265e21['options']?_0x265e21[_0x4b0f('0x1b')][_0x4b0f('0x1d')]||null:null,'limit':_0x265e21[_0x4b0f('0x1b')]?_0x265e21[_0x4b0f('0x1b')][_0x4b0f('0x1e')]||null:null,'include':_0x265e21[_0x4b0f('0x1b')]?_0x265e21[_0x4b0f('0x1b')][_0x4b0f('0x1f')]?_[_0x4b0f('0x20')](_0x265e21['options'][_0x4b0f('0x1f')],function(_0x39102c){return{'model':db[_0x39102c[_0x4b0f('0x21')]],'as':_0x39102c['as'],'attributes':_0x39102c[_0x4b0f('0x1d')],'include':_0x39102c[_0x4b0f('0x1f')]?_['map'](_0x39102c['include'],function(_0x107531){return{'model':db[_0x107531[_0x4b0f('0x21')]],'as':_0x107531['as'],'attributes':_0x107531[_0x4b0f('0x1d')],'include':_0x107531[_0x4b0f('0x1f')]?_[_0x4b0f('0x20')](_0x107531['include'],function(_0x471c83){return{'model':db[_0x471c83['model']],'as':_0x471c83['as'],'attributes':_0x471c83[_0x4b0f('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa9869){logger['info'](_0x4b0f('0x18'),_0x265e21);logger[_0x4b0f('0x13')](_0x4b0f('0x18'),_0x265e21,JSON[_0x4b0f('0x14')](_0xa9869));_0x1654c1(_0xa9869);})[_0x4b0f('0x22')](function(_0x27fd07){logger[_0x4b0f('0x15')](_0x4b0f('0x18'),_0x27fd07['message'],_0x265e21);_0x59f5fd(_0x3972fe[_0x4b0f('0x15')](0x1f4,_0x27fd07[_0x4b0f('0x17')]));});});};exports[_0x4b0f('0x23')]=function(_0x13922a){var _0x53d9b3=this;return new Promise(function(_0x2e300f,_0x907d03){return db[_0x4b0f('0x19')][_0x4b0f('0x24')]({'raw':_0x13922a[_0x4b0f('0x1b')]?_0x13922a[_0x4b0f('0x1b')][_0x4b0f('0x25')]===undefined?!![]:![]:!![],'where':_0x13922a[_0x4b0f('0x1b')]?_0x13922a['options']['where']||null:null,'attributes':_0x13922a[_0x4b0f('0x1b')]?_0x13922a['options'][_0x4b0f('0x1d')]||null:null,'include':_0x13922a[_0x4b0f('0x1b')]?_0x13922a[_0x4b0f('0x1b')][_0x4b0f('0x1f')]?_[_0x4b0f('0x20')](_0x13922a[_0x4b0f('0x1b')][_0x4b0f('0x1f')],function(_0x145656){return{'model':db[_0x145656['model']],'as':_0x145656['as'],'attributes':_0x145656['attributes'],'include':_0x145656[_0x4b0f('0x1f')]?_[_0x4b0f('0x20')](_0x145656[_0x4b0f('0x1f')],function(_0x50d844){return{'model':db[_0x50d844[_0x4b0f('0x21')]],'as':_0x50d844['as'],'attributes':_0x50d844[_0x4b0f('0x1d')],'include':_0x50d844['include']?_[_0x4b0f('0x20')](_0x50d844[_0x4b0f('0x1f')],function(_0xb36c23){return{'model':db[_0xb36c23['model']],'as':_0xb36c23['as'],'attributes':_0xb36c23[_0x4b0f('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49eff9){logger[_0x4b0f('0x10')](_0x4b0f('0x23'),_0x13922a);logger[_0x4b0f('0x13')](_0x4b0f('0x23'),_0x13922a,JSON[_0x4b0f('0x14')](_0x49eff9));_0x2e300f(_0x49eff9);})['catch'](function(_0x3d6311){logger[_0x4b0f('0x15')](_0x4b0f('0x23'),_0x3d6311[_0x4b0f('0x17')],_0x13922a);_0x907d03(_0x53d9b3[_0x4b0f('0x15')](0x1f4,_0x3d6311[_0x4b0f('0x17')]));});});}; \ No newline at end of file +var _0x42e0=['raw','where','attributes','include','map','model','GetSmsQueue','ShowSmsQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','SmsQueue,\x20%s,\x20%s','message','result','catch','SmsQueue','findAll','options'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x42e0,0x183));var _0x042e=function(_0x2a2d58,_0x41ea9c){_0x2a2d58=_0x2a2d58-0x0;var _0x1df440=_0x42e0[_0x2a2d58];return _0x1df440;};'use strict';var _=require(_0x042e('0x0'));var util=require(_0x042e('0x1'));var moment=require(_0x042e('0x2'));var BPromise=require(_0x042e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x042e('0x4'));var db=require(_0x042e('0x5'))['db'];var utils=require(_0x042e('0x6'));var logger=require(_0x042e('0x7'))(_0x042e('0x8'));var config=require(_0x042e('0x9'));var jayson=require(_0x042e('0xa'));var client=jayson[_0x042e('0xb')][_0x042e('0xc')]({'port':0x232a});config['redis']=_[_0x042e('0xd')](config[_0x042e('0xe')],{'host':_0x042e('0xf'),'port':0x18eb});var socket=require(_0x042e('0x10'))(new Redis(config[_0x042e('0xe')]));require('./smsQueue.socket')[_0x042e('0x11')](socket);function respondWithRpcPromise(_0x57f2ea,_0x10f3fd,_0x3b09c4){return new BPromise(function(_0x4a85df,_0x42fce5){return client[_0x042e('0x12')](_0x57f2ea,_0x3b09c4)[_0x042e('0x13')](function(_0x2f4892){logger[_0x042e('0x14')]('SmsQueue,\x20%s,\x20%s',_0x10f3fd,_0x042e('0x15'));logger[_0x042e('0x16')](_0x042e('0x17'),_0x10f3fd,_0x042e('0x15'),JSON[_0x042e('0x18')](_0x2f4892));if(_0x2f4892[_0x042e('0x19')]){if(_0x2f4892['error']['code']===0x1f4){logger['error'](_0x042e('0x1a'),_0x10f3fd,_0x2f4892[_0x042e('0x19')][_0x042e('0x1b')]);return _0x42fce5(_0x2f4892[_0x042e('0x19')][_0x042e('0x1b')]);}logger[_0x042e('0x19')](_0x042e('0x1a'),_0x10f3fd,_0x2f4892[_0x042e('0x19')][_0x042e('0x1b')]);return _0x4a85df(_0x2f4892[_0x042e('0x19')][_0x042e('0x1b')]);}else{logger[_0x042e('0x14')](_0x042e('0x1a'),_0x10f3fd,'request\x20sent');_0x4a85df(_0x2f4892[_0x042e('0x1c')]['message']);}})[_0x042e('0x1d')](function(_0x51e2fc){logger[_0x042e('0x19')](_0x042e('0x1a'),_0x10f3fd,_0x51e2fc);_0x42fce5(_0x51e2fc);});});}exports['GetSmsQueue']=function(_0xcadc46){var _0x563f37=this;return new Promise(function(_0x47095a,_0x2b4865){return db[_0x042e('0x1e')][_0x042e('0x1f')]({'raw':_0xcadc46['options']?_0xcadc46[_0x042e('0x20')][_0x042e('0x21')]===undefined?!![]:![]:!![],'where':_0xcadc46['options']?_0xcadc46[_0x042e('0x20')][_0x042e('0x22')]||null:null,'attributes':_0xcadc46['options']?_0xcadc46[_0x042e('0x20')][_0x042e('0x23')]||null:null,'limit':_0xcadc46[_0x042e('0x20')]?_0xcadc46[_0x042e('0x20')]['limit']||null:null,'include':_0xcadc46[_0x042e('0x20')]?_0xcadc46['options'][_0x042e('0x24')]?_[_0x042e('0x25')](_0xcadc46[_0x042e('0x20')][_0x042e('0x24')],function(_0x4fb98f){return{'model':db[_0x4fb98f[_0x042e('0x26')]],'as':_0x4fb98f['as'],'attributes':_0x4fb98f[_0x042e('0x23')],'include':_0x4fb98f[_0x042e('0x24')]?_[_0x042e('0x25')](_0x4fb98f[_0x042e('0x24')],function(_0x330969){return{'model':db[_0x330969['model']],'as':_0x330969['as'],'attributes':_0x330969[_0x042e('0x23')],'include':_0x330969[_0x042e('0x24')]?_[_0x042e('0x25')](_0x330969[_0x042e('0x24')],function(_0x323672){return{'model':db[_0x323672[_0x042e('0x26')]],'as':_0x323672['as'],'attributes':_0x323672[_0x042e('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1338ae){logger[_0x042e('0x14')](_0x042e('0x27'),_0xcadc46);logger[_0x042e('0x16')]('GetSmsQueue',_0xcadc46,JSON[_0x042e('0x18')](_0x1338ae));_0x47095a(_0x1338ae);})[_0x042e('0x1d')](function(_0x5dd3fb){logger[_0x042e('0x19')](_0x042e('0x27'),_0x5dd3fb[_0x042e('0x1b')],_0xcadc46);_0x2b4865(_0x563f37[_0x042e('0x19')](0x1f4,_0x5dd3fb[_0x042e('0x1b')]));});});};exports[_0x042e('0x28')]=function(_0x1780d6){var _0xdac2ae=this;return new Promise(function(_0x528b18,_0x2ae831){return db[_0x042e('0x1e')][_0x042e('0x29')]({'raw':_0x1780d6[_0x042e('0x20')]?_0x1780d6[_0x042e('0x20')][_0x042e('0x21')]===undefined?!![]:![]:!![],'where':_0x1780d6[_0x042e('0x20')]?_0x1780d6[_0x042e('0x20')][_0x042e('0x22')]||null:null,'attributes':_0x1780d6[_0x042e('0x20')]?_0x1780d6[_0x042e('0x20')][_0x042e('0x23')]||null:null,'include':_0x1780d6[_0x042e('0x20')]?_0x1780d6['options'][_0x042e('0x24')]?_[_0x042e('0x25')](_0x1780d6[_0x042e('0x20')]['include'],function(_0x42acbc){return{'model':db[_0x42acbc[_0x042e('0x26')]],'as':_0x42acbc['as'],'attributes':_0x42acbc['attributes'],'include':_0x42acbc['include']?_[_0x042e('0x25')](_0x42acbc[_0x042e('0x24')],function(_0x33ff59){return{'model':db[_0x33ff59[_0x042e('0x26')]],'as':_0x33ff59['as'],'attributes':_0x33ff59[_0x042e('0x23')],'include':_0x33ff59[_0x042e('0x24')]?_['map'](_0x33ff59[_0x042e('0x24')],function(_0xfb6a48){return{'model':db[_0xfb6a48[_0x042e('0x26')]],'as':_0xfb6a48['as'],'attributes':_0xfb6a48[_0x042e('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20c1a2){logger[_0x042e('0x14')](_0x042e('0x28'),_0x1780d6);logger['debug']('ShowSmsQueue',_0x1780d6,JSON[_0x042e('0x18')](_0x20c1a2));_0x528b18(_0x20c1a2);})[_0x042e('0x1d')](function(_0x7e7c11){logger['error']('ShowSmsQueue',_0x7e7c11['message'],_0x1780d6);_0x2ae831(_0xdac2ae['error'](0x1f4,_0x7e7c11[_0x042e('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index e6eacec..9d3f411 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 _0x9139=['update','removeListener','register','length','smsQueue:','save'];(function(_0x67c7f5,_0x167843){var _0x48dc46=function(_0xa91709){while(--_0xa91709){_0x67c7f5['push'](_0x67c7f5['shift']());}};_0x48dc46(++_0x167843);}(_0x9139,0x1b5));var _0x9913=function(_0xe230ca,_0x484f2a){_0xe230ca=_0xe230ca-0x0;var _0x32373e=_0x9139[_0xe230ca];return _0x32373e;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x9913('0x0'),'remove',_0x9913('0x1')];function createListener(_0x449900,_0x1c2afa){return function(_0x10af7e){_0x1c2afa['emit'](_0x449900,_0x10af7e);};}function removeListener(_0x46acd,_0x707619){return function(){SmsQueueEvents[_0x9913('0x2')](_0x46acd,_0x707619);};}exports[_0x9913('0x3')]=function(_0x2761da){for(var _0xadcfed=0x0,_0x31db58=events[_0x9913('0x4')];_0xadcfed<_0x31db58;_0xadcfed++){var _0xc14f37=events[_0xadcfed];var _0x5ba4a4=createListener(_0x9913('0x5')+_0xc14f37,_0x2761da);SmsQueueEvents['on'](_0xc14f37,_0x5ba4a4);}}; \ No newline at end of file +var _0x9f1c=['save','remove','update','emit','removeListener','register','length'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x9f1c,0x1a4));var _0xc9f1=function(_0x5486ef,_0x2fd435){_0x5486ef=_0x5486ef-0x0;var _0xb6be66=_0x9f1c[_0x5486ef];return _0xb6be66;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xc9f1('0x0'),_0xc9f1('0x1'),_0xc9f1('0x2')];function createListener(_0x3f229e,_0x573fcd){return function(_0x12c358){_0x573fcd[_0xc9f1('0x3')](_0x3f229e,_0x12c358);};}function removeListener(_0x261c83,_0x3a09df){return function(){SmsQueueEvents[_0xc9f1('0x4')](_0x261c83,_0x3a09df);};}exports[_0xc9f1('0x5')]=function(_0x4a546f){for(var _0x2ee485=0x0,_0x54001c=events[_0xc9f1('0x6')];_0x2ee485<_0x54001c;_0x2ee485++){var _0x429dfa=events[_0x2ee485];var _0x22aca0=createListener('smsQueue:'+_0x429dfa,_0x4a546f);SmsQueueEvents['on'](_0x429dfa,_0x22aca0);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 90989fd..a46f851 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 _0x6e75=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','multer','util','path','express'];(function(_0x30f781,_0x1ce35d){var _0x461df7=function(_0xaacb71){while(--_0xaacb71){_0x30f781['push'](_0x30f781['shift']());}};_0x461df7(++_0x1ce35d);}(_0x6e75,0xa4));var _0x56e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6e75[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x56e7('0x0'));var util=require(_0x56e7('0x1'));var path=require(_0x56e7('0x2'));var timeout=require('connect-timeout');var express=require(_0x56e7('0x3'));var router=express['Router']();var fs_extra=require(_0x56e7('0x4'));var auth=require(_0x56e7('0x5'));var interaction=require(_0x56e7('0x6'));var config=require(_0x56e7('0x7'));var controller=require(_0x56e7('0x8'));router[_0x56e7('0x9')]('/',auth[_0x56e7('0xa')](),controller[_0x56e7('0xb')]);router[_0x56e7('0x9')](_0x56e7('0xc'),auth[_0x56e7('0xa')](),controller[_0x56e7('0xd')]);router[_0x56e7('0x9')](_0x56e7('0xe'),auth['isAuthenticated'](),controller[_0x56e7('0xf')]);router['post']('/',auth[_0x56e7('0xa')](),controller[_0x56e7('0x10')]);router['put'](_0x56e7('0xe'),auth[_0x56e7('0xa')](),controller[_0x56e7('0x11')]);router[_0x56e7('0x12')]('/:id',auth[_0x56e7('0xa')](),controller[_0x56e7('0x13')]);module[_0x56e7('0x14')]=router; \ No newline at end of file +var _0x6799=['connect-timeout','express','Router','../../components/auth/service','./smsQueueReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','update','delete','destroy','exports'];(function(_0x382602,_0x5e9d2d){var _0x14dda6=function(_0xf65c39){while(--_0xf65c39){_0x382602['push'](_0x382602['shift']());}};_0x14dda6(++_0x5e9d2d);}(_0x6799,0x1ed));var _0x9679=function(_0x26db3a,_0x2e0c19){_0x26db3a=_0x26db3a-0x0;var _0x49a1ed=_0x6799[_0x26db3a];return _0x49a1ed;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x9679('0x0'));var express=require(_0x9679('0x1'));var router=express[_0x9679('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x9679('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9679('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x9679('0x5')]);router[_0x9679('0x6')](_0x9679('0x7'),auth[_0x9679('0x8')](),controller[_0x9679('0x9')]);router['get'](_0x9679('0xa'),auth[_0x9679('0x8')](),controller[_0x9679('0xb')]);router[_0x9679('0xc')]('/',auth[_0x9679('0x8')](),controller['create']);router['put'](_0x9679('0xa'),auth[_0x9679('0x8')](),controller[_0x9679('0xd')]);router[_0x9679('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x9679('0xf')]);module[_0x9679('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index e6a365b..87b840e 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 _0x008e=['sequelize','STRING','DATE','moment'];(function(_0x4cbb3a,_0xb1133a){var _0x29c2da=function(_0xd4618a){while(--_0xd4618a){_0x4cbb3a['push'](_0x4cbb3a['shift']());}};_0x29c2da(++_0xb1133a);}(_0x008e,0x103));var _0xe008=function(_0x4245a4,_0x1bad0e){_0x4245a4=_0x4245a4-0x0;var _0x5644db=_0x008e[_0x4245a4];return _0x5644db;};'use strict';var moment=require(_0xe008('0x0'));var Sequelize=require(_0xe008('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xe008('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xe008('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xe008('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe008('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3d2f=['moment','sequelize','exports','STRING','DATE'];(function(_0x2d36d6,_0x300b3f){var _0x34e651=function(_0x2a4f7e){while(--_0x2a4f7e){_0x2d36d6['push'](_0x2d36d6['shift']());}};_0x34e651(++_0x300b3f);}(_0x3d2f,0x78));var _0xf3d2=function(_0x4f3a6a,_0x3fc1c2){_0x4f3a6a=_0x4f3a6a-0x0;var _0x1d2458=_0x3d2f[_0x4f3a6a];return _0x1d2458;};'use strict';var moment=require(_0xf3d2('0x0'));var Sequelize=require(_0xf3d2('0x1'));module[_0xf3d2('0x2')]={'uniqueid':{'type':Sequelize[_0xf3d2('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xf3d2('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xf3d2('0x4')]},'acceptAt':{'type':Sequelize[_0xf3d2('0x4')]},'exitAt':{'type':Sequelize[_0xf3d2('0x4')]},'reason':{'type':Sequelize[_0xf3d2('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 35177e4..1fd5618 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 _0xbbe2=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','map','VIRTUAL','options','include','findAll','rows','show','params','includeAll','merge','catch','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','end','error','name','send','index','SmsQueueReport'];(function(_0x437b94,_0x5e9e74){var _0x1eedfe=function(_0x382028){while(--_0x382028){_0x437b94['push'](_0x437b94['shift']());}};_0x1eedfe(++_0x5e9e74);}(_0xbbe2,0x1a2));var _0x2bbe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbe2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2bbe('0x0'));var rimraf=require(_0x2bbe('0x1'));var zipdir=require(_0x2bbe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2bbe('0x3'));var moment=require(_0x2bbe('0x4'));var BPromise=require(_0x2bbe('0x5'));var Mustache=require('mustache');var util=require(_0x2bbe('0x6'));var path=require(_0x2bbe('0x7'));var sox=require(_0x2bbe('0x8'));var csv=require(_0x2bbe('0x9'));var ejs=require(_0x2bbe('0xa'));var fs=require('fs');var fs_extra=require(_0x2bbe('0xb'));var _=require(_0x2bbe('0xc'));var squel=require(_0x2bbe('0xd'));var crypto=require(_0x2bbe('0xe'));var jsforce=require(_0x2bbe('0xf'));var deskjs=require(_0x2bbe('0x10'));var toCsv=require(_0x2bbe('0x9'));var querystring=require(_0x2bbe('0x11'));var Papa=require('papaparse');var Redis=require(_0x2bbe('0x12'));var authService=require(_0x2bbe('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2bbe('0x14'));var hardwareService=require(_0x2bbe('0x15'));var logger=require(_0x2bbe('0x16'))(_0x2bbe('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2bbe('0x18'));var db=require(_0x2bbe('0x19'))['db'];function respondWithStatusCode(_0x1f5c38,_0x103603){_0x103603=_0x103603||0xcc;return function(_0x3ef96a){if(_0x3ef96a){return _0x1f5c38['sendStatus'](_0x103603);}return _0x1f5c38[_0x2bbe('0x1a')](_0x103603)['end']();};}function respondWithResult(_0x5da2a1,_0x245123){_0x245123=_0x245123||0xc8;return function(_0x26b3ac){if(_0x26b3ac){return _0x5da2a1['status'](_0x245123)[_0x2bbe('0x1b')](_0x26b3ac);}};}function respondWithFilteredResult(_0x3fb924,_0x24ef19){return function(_0x2308d4){if(_0x2308d4){var _0x2e7080=typeof _0x24ef19[_0x2bbe('0x1c')]===_0x2bbe('0x1d')&&typeof _0x24ef19[_0x2bbe('0x1e')]==='undefined';var _0x5b13fa=_0x2308d4[_0x2bbe('0x1f')];var _0xf9a358=_0x2e7080?0x0:_0x24ef19[_0x2bbe('0x1c')];var _0x4372b5=_0x2e7080?_0x2308d4[_0x2bbe('0x1f')]:_0x24ef19[_0x2bbe('0x1c')]+_0x24ef19[_0x2bbe('0x1e')];var _0x53334c;if(_0x4372b5>=_0x5b13fa){_0x4372b5=_0x5b13fa;_0x53334c=0xc8;}else{_0x53334c=0xce;}_0x3fb924[_0x2bbe('0x1a')](_0x53334c);return _0x3fb924[_0x2bbe('0x20')]('Content-Range',_0xf9a358+'-'+_0x4372b5+'/'+_0x5b13fa)[_0x2bbe('0x1b')](_0x2308d4);}return null;};}function patchUpdates(_0x2e31b6){return function(_0x537159){try{jsonpatch['apply'](_0x537159,_0x2e31b6,!![]);}catch(_0x1aa25c){return BPromise[_0x2bbe('0x21')](_0x1aa25c);}return _0x537159[_0x2bbe('0x22')]();};}function saveUpdates(_0x5b8fe9,_0x247975){return function(_0x4f67e4){if(_0x4f67e4){return _0x4f67e4[_0x2bbe('0x23')](_0x5b8fe9)['then'](function(_0x3470f0){return _0x3470f0;});}return null;};}function removeEntity(_0x3b8953,_0x4fe3b0){return function(_0x496eb5){if(_0x496eb5){return _0x496eb5[_0x2bbe('0x24')]()[_0x2bbe('0x25')](function(){_0x3b8953[_0x2bbe('0x1a')](0xcc)[_0x2bbe('0x26')]();});}};}function handleEntityNotFound(_0x2814ff,_0x54f781){return function(_0x56a65c){if(!_0x56a65c){_0x2814ff['sendStatus'](0x194);}return _0x56a65c;};}function handleError(_0x14c55f,_0x40c86b){_0x40c86b=_0x40c86b||0x1f4;return function(_0x455dd2){logger[_0x2bbe('0x27')](_0x455dd2['stack']);if(_0x455dd2['name']){delete _0x455dd2[_0x2bbe('0x28')];}_0x14c55f[_0x2bbe('0x1a')](_0x40c86b)[_0x2bbe('0x29')](_0x455dd2);};}exports[_0x2bbe('0x2a')]=function(_0x5dc916,_0x5fc1d4){var _0x4c7f3c={},_0x30d4cc={},_0x5cdb63={'count':0x0,'rows':[]};var _0x4c7d73=_['map'](db[_0x2bbe('0x2b')][_0x2bbe('0x2c')],function(_0x9c683a){return{'name':_0x9c683a[_0x2bbe('0x2d')],'type':_0x9c683a[_0x2bbe('0x2e')][_0x2bbe('0x2f')]};});_0x30d4cc[_0x2bbe('0x30')]=_['map'](_0x4c7d73,'name');_0x30d4cc[_0x2bbe('0x31')]=_[_0x2bbe('0x32')](_0x5dc916['query']);_0x30d4cc[_0x2bbe('0x33')]=_[_0x2bbe('0x34')](_0x30d4cc['model'],_0x30d4cc['query']);_0x4c7f3c[_0x2bbe('0x35')]=_[_0x2bbe('0x34')](_0x30d4cc['model'],qs['fields'](_0x5dc916[_0x2bbe('0x31')][_0x2bbe('0x36')]));_0x4c7f3c[_0x2bbe('0x35')]=_0x4c7f3c[_0x2bbe('0x35')][_0x2bbe('0x37')]?_0x4c7f3c['attributes']:_0x30d4cc[_0x2bbe('0x30')];if(!_0x5dc916['query']['hasOwnProperty'](_0x2bbe('0x38'))){_0x4c7f3c[_0x2bbe('0x1e')]=qs[_0x2bbe('0x1e')](_0x5dc916[_0x2bbe('0x31')][_0x2bbe('0x1e')]);_0x4c7f3c[_0x2bbe('0x1c')]=qs['offset'](_0x5dc916[_0x2bbe('0x31')][_0x2bbe('0x1c')]);}_0x4c7f3c[_0x2bbe('0x39')]=qs[_0x2bbe('0x3a')](_0x5dc916[_0x2bbe('0x31')]['sort']);_0x4c7f3c['where']=qs[_0x2bbe('0x33')](_[_0x2bbe('0x3b')](_0x5dc916[_0x2bbe('0x31')],_0x30d4cc['filters']),_0x4c7d73);if(_0x5dc916[_0x2bbe('0x31')][_0x2bbe('0x3c')]){_0x4c7f3c['where']=_['merge'](_0x4c7f3c[_0x2bbe('0x3d')],{'$or':_[_0x2bbe('0x3e')](_0x4c7d73,function(_0x3e29ba){if(_0x3e29ba['type']!==_0x2bbe('0x3f')){var _0x2206dd={};_0x2206dd[_0x3e29ba[_0x2bbe('0x28')]]={'$like':'%'+_0x5dc916[_0x2bbe('0x31')]['filter']+'%'};return _0x2206dd;}})});}_0x4c7f3c=_['merge']({},_0x4c7f3c,_0x5dc916[_0x2bbe('0x40')]);var _0x249075={'where':_0x4c7f3c[_0x2bbe('0x3d')]};return db[_0x2bbe('0x2b')]['count'](_0x249075)['then'](function(_0x179a77){_0x5cdb63[_0x2bbe('0x1f')]=_0x179a77;if(_0x5dc916[_0x2bbe('0x31')]['includeAll']){_0x4c7f3c[_0x2bbe('0x41')]=[{'all':!![]}];}return db[_0x2bbe('0x2b')][_0x2bbe('0x42')](_0x4c7f3c);})[_0x2bbe('0x25')](function(_0x2d7d65){_0x5cdb63[_0x2bbe('0x43')]=_0x2d7d65;return _0x5cdb63;})[_0x2bbe('0x25')](respondWithFilteredResult(_0x5fc1d4,_0x4c7f3c))['catch'](handleError(_0x5fc1d4,null));};exports[_0x2bbe('0x44')]=function(_0x34c226,_0x58db78){var _0x1255b9={'raw':!![],'where':{'id':_0x34c226[_0x2bbe('0x45')]['id']}},_0x22dacb={};_0x22dacb[_0x2bbe('0x30')]=_[_0x2bbe('0x32')](db[_0x2bbe('0x2b')][_0x2bbe('0x2c')]);_0x22dacb[_0x2bbe('0x31')]=_[_0x2bbe('0x32')](_0x34c226[_0x2bbe('0x31')]);_0x22dacb[_0x2bbe('0x33')]=_[_0x2bbe('0x34')](_0x22dacb[_0x2bbe('0x30')],_0x22dacb['query']);_0x1255b9[_0x2bbe('0x35')]=_['intersection'](_0x22dacb[_0x2bbe('0x30')],qs['fields'](_0x34c226[_0x2bbe('0x31')]['fields']));_0x1255b9[_0x2bbe('0x35')]=_0x1255b9[_0x2bbe('0x35')][_0x2bbe('0x37')]?_0x1255b9[_0x2bbe('0x35')]:_0x22dacb[_0x2bbe('0x30')];if(_0x34c226[_0x2bbe('0x31')][_0x2bbe('0x46')]){_0x1255b9[_0x2bbe('0x41')]=[{'all':!![]}];}_0x1255b9=_[_0x2bbe('0x47')]({},_0x1255b9,_0x34c226[_0x2bbe('0x40')]);return db[_0x2bbe('0x2b')]['find'](_0x1255b9)[_0x2bbe('0x25')](handleEntityNotFound(_0x58db78,null))[_0x2bbe('0x25')](respondWithResult(_0x58db78,null))[_0x2bbe('0x48')](handleError(_0x58db78,null));};exports[_0x2bbe('0x49')]=function(_0x4d5948,_0x3d3a4f){return db[_0x2bbe('0x2b')][_0x2bbe('0x49')](_0x4d5948[_0x2bbe('0x4a')],{})[_0x2bbe('0x25')](respondWithResult(_0x3d3a4f,0xc9))[_0x2bbe('0x48')](handleError(_0x3d3a4f,null));};exports['update']=function(_0x46b683,_0x21abf7){if(_0x46b683[_0x2bbe('0x4a')]['id']){delete _0x46b683[_0x2bbe('0x4a')]['id'];}return db[_0x2bbe('0x2b')][_0x2bbe('0x4b')]({'where':{'id':_0x46b683['params']['id']}})[_0x2bbe('0x25')](handleEntityNotFound(_0x21abf7,null))[_0x2bbe('0x25')](saveUpdates(_0x46b683[_0x2bbe('0x4a')],null))[_0x2bbe('0x25')](respondWithResult(_0x21abf7,null))['catch'](handleError(_0x21abf7,null));};exports[_0x2bbe('0x24')]=function(_0x4530da,_0x22d113){return db[_0x2bbe('0x2b')][_0x2bbe('0x4b')]({'where':{'id':_0x4530da[_0x2bbe('0x45')]['id']}})[_0x2bbe('0x25')](handleEntityNotFound(_0x22d113,null))['then'](removeEntity(_0x22d113,null))[_0x2bbe('0x48')](handleError(_0x22d113,null));};exports[_0x2bbe('0x4c')]=function(_0x3a1dc9,_0xdc9859){return db[_0x2bbe('0x2b')]['describe']()[_0x2bbe('0x25')](respondWithResult(_0xdc9859,null))[_0x2bbe('0x48')](handleError(_0xdc9859,null));}; \ No newline at end of file +var _0x9851=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','key','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','describe'];(function(_0x51a9c8,_0x1e0917){var _0x5d8b7f=function(_0x183af6){while(--_0x183af6){_0x51a9c8['push'](_0x51a9c8['shift']());}};_0x5d8b7f(++_0x1e0917);}(_0x9851,0x186));var _0x1985=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9851[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x1985('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1985('0x1'));var jsonpatch=require(_0x1985('0x2'));var rp=require(_0x1985('0x3'));var moment=require(_0x1985('0x4'));var BPromise=require(_0x1985('0x5'));var Mustache=require('mustache');var util=require(_0x1985('0x6'));var path=require('path');var sox=require(_0x1985('0x7'));var csv=require('to-csv');var ejs=require(_0x1985('0x8'));var fs=require('fs');var fs_extra=require(_0x1985('0x9'));var _=require(_0x1985('0xa'));var squel=require(_0x1985('0xb'));var crypto=require('crypto');var jsforce=require(_0x1985('0xc'));var deskjs=require(_0x1985('0xd'));var toCsv=require(_0x1985('0xe'));var querystring=require(_0x1985('0xf'));var Papa=require(_0x1985('0x10'));var Redis=require(_0x1985('0x11'));var authService=require(_0x1985('0x12'));var qs=require(_0x1985('0x13'));var as=require(_0x1985('0x14'));var hardwareService=require(_0x1985('0x15'));var logger=require('../../config/logger')(_0x1985('0x16'));var utils=require('../../config/utils');var config=require(_0x1985('0x17'));var licenseUtil=require(_0x1985('0x18'));var db=require(_0x1985('0x19'))['db'];function respondWithStatusCode(_0x45b9f1,_0x19575e){_0x19575e=_0x19575e||0xcc;return function(_0x6a16ad){if(_0x6a16ad){return _0x45b9f1[_0x1985('0x1a')](_0x19575e);}return _0x45b9f1['status'](_0x19575e)[_0x1985('0x1b')]();};}function respondWithResult(_0x58a88c,_0x3c40b8){_0x3c40b8=_0x3c40b8||0xc8;return function(_0xd8516a){if(_0xd8516a){return _0x58a88c['status'](_0x3c40b8)[_0x1985('0x1c')](_0xd8516a);}};}function respondWithFilteredResult(_0x1e135a,_0x4347e2){return function(_0x241133){if(_0x241133){var _0x7e8c41=typeof _0x4347e2[_0x1985('0x1d')]===_0x1985('0x1e')&&typeof _0x4347e2['limit']===_0x1985('0x1e');var _0x4d98e8=_0x241133['count'];var _0x37aa95=_0x7e8c41?0x0:_0x4347e2[_0x1985('0x1d')];var _0x1b1449=_0x7e8c41?_0x241133[_0x1985('0x1f')]:_0x4347e2[_0x1985('0x1d')]+_0x4347e2[_0x1985('0x20')];var _0x394781;if(_0x1b1449>=_0x4d98e8){_0x1b1449=_0x4d98e8;_0x394781=0xc8;}else{_0x394781=0xce;}_0x1e135a[_0x1985('0x21')](_0x394781);return _0x1e135a['set'](_0x1985('0x22'),_0x37aa95+'-'+_0x1b1449+'/'+_0x4d98e8)[_0x1985('0x1c')](_0x241133);}return null;};}function patchUpdates(_0x118c0d){return function(_0x39af88){try{jsonpatch[_0x1985('0x23')](_0x39af88,_0x118c0d,!![]);}catch(_0x2364cd){return BPromise['reject'](_0x2364cd);}return _0x39af88[_0x1985('0x24')]();};}function saveUpdates(_0x5ce1a8,_0x4556a6){return function(_0x36947e){if(_0x36947e){return _0x36947e[_0x1985('0x25')](_0x5ce1a8)[_0x1985('0x26')](function(_0x374b1b){return _0x374b1b;});}return null;};}function removeEntity(_0x368037,_0x4069d6){return function(_0x5aeaa8){if(_0x5aeaa8){return _0x5aeaa8[_0x1985('0x27')]()[_0x1985('0x26')](function(){_0x368037['status'](0xcc)[_0x1985('0x1b')]();});}};}function handleEntityNotFound(_0x29b9f4,_0x4b9e42){return function(_0x4ba691){if(!_0x4ba691){_0x29b9f4[_0x1985('0x1a')](0x194);}return _0x4ba691;};}function handleError(_0x307556,_0x408494){_0x408494=_0x408494||0x1f4;return function(_0x316a4a){logger[_0x1985('0x28')](_0x316a4a['stack']);if(_0x316a4a[_0x1985('0x29')]){delete _0x316a4a[_0x1985('0x29')];}_0x307556[_0x1985('0x21')](_0x408494)[_0x1985('0x2a')](_0x316a4a);};}exports[_0x1985('0x2b')]=function(_0x58a67c,_0x1cc460){var _0x7250a={},_0x68d6fb={},_0x8aa7a8={'count':0x0,'rows':[]};var _0x4110d7=_[_0x1985('0x2c')](db[_0x1985('0x2d')][_0x1985('0x2e')],function(_0x2cf603){return{'name':_0x2cf603[_0x1985('0x2f')],'type':_0x2cf603['type'][_0x1985('0x30')]};});_0x68d6fb['model']=_[_0x1985('0x2c')](_0x4110d7,'name');_0x68d6fb['query']=_[_0x1985('0x31')](_0x58a67c['query']);_0x68d6fb['filters']=_[_0x1985('0x32')](_0x68d6fb[_0x1985('0x33')],_0x68d6fb[_0x1985('0x34')]);_0x7250a[_0x1985('0x35')]=_[_0x1985('0x32')](_0x68d6fb[_0x1985('0x33')],qs['fields'](_0x58a67c[_0x1985('0x34')][_0x1985('0x36')]));_0x7250a['attributes']=_0x7250a[_0x1985('0x35')][_0x1985('0x37')]?_0x7250a[_0x1985('0x35')]:_0x68d6fb[_0x1985('0x33')];if(!_0x58a67c[_0x1985('0x34')][_0x1985('0x38')](_0x1985('0x39'))){_0x7250a[_0x1985('0x20')]=qs[_0x1985('0x20')](_0x58a67c[_0x1985('0x34')][_0x1985('0x20')]);_0x7250a[_0x1985('0x1d')]=qs[_0x1985('0x1d')](_0x58a67c[_0x1985('0x34')]['offset']);}_0x7250a[_0x1985('0x3a')]=qs['sort'](_0x58a67c['query'][_0x1985('0x3b')]);_0x7250a[_0x1985('0x3c')]=qs['filters'](_[_0x1985('0x3d')](_0x58a67c[_0x1985('0x34')],_0x68d6fb[_0x1985('0x3e')]),_0x4110d7);if(_0x58a67c['query']['filter']){_0x7250a['where']=_[_0x1985('0x3f')](_0x7250a[_0x1985('0x3c')],{'$or':_[_0x1985('0x2c')](_0x4110d7,function(_0x3d062){if(_0x3d062[_0x1985('0x40')]!==_0x1985('0x41')){var _0x2d8efd={};_0x2d8efd[_0x3d062['name']]={'$like':'%'+_0x58a67c[_0x1985('0x34')]['filter']+'%'};return _0x2d8efd;}})});}_0x7250a=_[_0x1985('0x3f')]({},_0x7250a,_0x58a67c['options']);var _0x195b11={'where':_0x7250a['where']};return db[_0x1985('0x2d')][_0x1985('0x1f')](_0x195b11)[_0x1985('0x26')](function(_0x3d3644){_0x8aa7a8['count']=_0x3d3644;if(_0x58a67c[_0x1985('0x34')][_0x1985('0x42')]){_0x7250a[_0x1985('0x43')]=[{'all':!![]}];}return db[_0x1985('0x2d')][_0x1985('0x44')](_0x7250a);})[_0x1985('0x26')](function(_0x28d260){_0x8aa7a8[_0x1985('0x45')]=_0x28d260;return _0x8aa7a8;})[_0x1985('0x26')](respondWithFilteredResult(_0x1cc460,_0x7250a))[_0x1985('0x46')](handleError(_0x1cc460,null));};exports[_0x1985('0x47')]=function(_0x2db8a7,_0x463f1e){var _0x25e190={'raw':!![],'where':{'id':_0x2db8a7[_0x1985('0x48')]['id']}},_0x1c057d={};_0x1c057d[_0x1985('0x33')]=_[_0x1985('0x31')](db[_0x1985('0x2d')][_0x1985('0x2e')]);_0x1c057d[_0x1985('0x34')]=_[_0x1985('0x31')](_0x2db8a7[_0x1985('0x34')]);_0x1c057d[_0x1985('0x3e')]=_[_0x1985('0x32')](_0x1c057d['model'],_0x1c057d[_0x1985('0x34')]);_0x25e190[_0x1985('0x35')]=_['intersection'](_0x1c057d[_0x1985('0x33')],qs[_0x1985('0x36')](_0x2db8a7[_0x1985('0x34')][_0x1985('0x36')]));_0x25e190[_0x1985('0x35')]=_0x25e190[_0x1985('0x35')][_0x1985('0x37')]?_0x25e190[_0x1985('0x35')]:_0x1c057d[_0x1985('0x33')];if(_0x2db8a7[_0x1985('0x34')]['includeAll']){_0x25e190[_0x1985('0x43')]=[{'all':!![]}];}_0x25e190=_[_0x1985('0x3f')]({},_0x25e190,_0x2db8a7[_0x1985('0x49')]);return db[_0x1985('0x2d')]['find'](_0x25e190)[_0x1985('0x26')](handleEntityNotFound(_0x463f1e,null))[_0x1985('0x26')](respondWithResult(_0x463f1e,null))[_0x1985('0x46')](handleError(_0x463f1e,null));};exports[_0x1985('0x4a')]=function(_0x489a71,_0x44d5e7){return db['SmsQueueReport'][_0x1985('0x4a')](_0x489a71['body'],{})[_0x1985('0x26')](respondWithResult(_0x44d5e7,0xc9))[_0x1985('0x46')](handleError(_0x44d5e7,null));};exports[_0x1985('0x25')]=function(_0x3489ae,_0x50adfa){if(_0x3489ae[_0x1985('0x4b')]['id']){delete _0x3489ae[_0x1985('0x4b')]['id'];}return db['SmsQueueReport'][_0x1985('0x4c')]({'where':{'id':_0x3489ae[_0x1985('0x48')]['id']}})[_0x1985('0x26')](handleEntityNotFound(_0x50adfa,null))['then'](saveUpdates(_0x3489ae[_0x1985('0x4b')],null))['then'](respondWithResult(_0x50adfa,null))[_0x1985('0x46')](handleError(_0x50adfa,null));};exports[_0x1985('0x27')]=function(_0x4faacf,_0x22691c){return db[_0x1985('0x2d')][_0x1985('0x4c')]({'where':{'id':_0x4faacf[_0x1985('0x48')]['id']}})['then'](handleEntityNotFound(_0x22691c,null))['then'](removeEntity(_0x22691c,null))['catch'](handleError(_0x22691c,null));};exports[_0x1985('0x4d')]=function(_0xfd2950,_0xa77f85){return db['SmsQueueReport']['describe']()['then'](respondWithResult(_0xa77f85,null))['catch'](handleError(_0xa77f85,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 8f6fede..8203b18 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x5d6c3e,_0x409a3e){var _0x44ecb7=function(_0x936b6a){while(--_0x936b6a){_0x5d6c3e['push'](_0x5d6c3e['shift']());}};_0x44ecb7(++_0x409a3e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x159f8e,_0x258d08){var _0x458e17=function(_0xafee19){while(--_0xafee19){_0x159f8e['push'](_0x159f8e['shift']());}};_0x458e17(++_0x258d08);}(_0xe706,0xa3));var _0x6e70=function(_0x363a2b,_0x2c51a2){_0x363a2b=_0x363a2b-0x0;var _0x2c720e=_0xe706[_0x363a2b];return _0x2c720e;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index abf5dbc..b2fcc85 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 _0x261e=['where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','SmsQueueReport,\x20%s,\x20%s','CreateSmsQueueReport','body','options','stringify','catch','UpdateSmsQueueReport','SmsQueueReport','update'];(function(_0x1e4408,_0x115a35){var _0x425906=function(_0x1d60b3){while(--_0x1d60b3){_0x1e4408['push'](_0x1e4408['shift']());}};_0x425906(++_0x115a35);}(_0x261e,0x195));var _0xe261=function(_0x1bf5c6,_0x181006){_0x1bf5c6=_0x1bf5c6-0x0;var _0x4cb03f=_0x261e[_0x1bf5c6];return _0x4cb03f;};'use strict';var _=require(_0xe261('0x0'));var util=require(_0xe261('0x1'));var moment=require(_0xe261('0x2'));var BPromise=require(_0xe261('0x3'));var rs=require(_0xe261('0x4'));var fs=require('fs');var Redis=require(_0xe261('0x5'));var db=require(_0xe261('0x6'))['db'];var utils=require(_0xe261('0x7'));var logger=require(_0xe261('0x8'))('rpc');var config=require(_0xe261('0x9'));var jayson=require(_0xe261('0xa'));var client=jayson[_0xe261('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf58e07,_0x1d6727,_0x4aaefc){return new BPromise(function(_0x5bdfdb,_0x59ab59){return client[_0xe261('0xc')](_0xf58e07,_0x4aaefc)['then'](function(_0x22c201){logger[_0xe261('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x1d6727,_0xe261('0xe'));logger[_0xe261('0xf')](_0xe261('0x10'),_0x1d6727,_0xe261('0xe'),JSON['stringify'](_0x22c201));if(_0x22c201[_0xe261('0x11')]){if(_0x22c201[_0xe261('0x11')][_0xe261('0x12')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x1d6727,_0x22c201[_0xe261('0x11')][_0xe261('0x13')]);return _0x59ab59(_0x22c201[_0xe261('0x11')][_0xe261('0x13')]);}logger[_0xe261('0x11')](_0xe261('0x14'),_0x1d6727,_0x22c201[_0xe261('0x11')][_0xe261('0x13')]);return _0x5bdfdb(_0x22c201[_0xe261('0x11')][_0xe261('0x13')]);}else{logger[_0xe261('0xd')](_0xe261('0x14'),_0x1d6727,'request\x20sent');_0x5bdfdb(_0x22c201['result'][_0xe261('0x13')]);}})['catch'](function(_0xfd1722){logger[_0xe261('0x11')](_0xe261('0x14'),_0x1d6727,_0xfd1722);_0x59ab59(_0xfd1722);});});}exports[_0xe261('0x15')]=function(_0x5aee5a){var _0x1c3cf4=this;return new Promise(function(_0x5c3b3a,_0xb9a6e4){return db['SmsQueueReport']['create'](_0x5aee5a[_0xe261('0x16')],{'raw':_0x5aee5a[_0xe261('0x17')]?_0x5aee5a['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4a3a5d){logger[_0xe261('0xd')]('CreateSmsQueueReport',_0x5aee5a);logger[_0xe261('0xf')](_0xe261('0x15'),_0x5aee5a,JSON[_0xe261('0x18')](_0x4a3a5d));_0x5c3b3a(_0x4a3a5d);})[_0xe261('0x19')](function(_0x2b87de){logger[_0xe261('0x11')](_0xe261('0x15'),_0x2b87de[_0xe261('0x13')],_0x5aee5a);_0xb9a6e4(_0x1c3cf4[_0xe261('0x11')](0x1f4,_0x2b87de[_0xe261('0x13')]));});});};exports[_0xe261('0x1a')]=function(_0x48144f){var _0x576cac=this;return new Promise(function(_0x59be94,_0x3233ae){return db[_0xe261('0x1b')][_0xe261('0x1c')](_0x48144f[_0xe261('0x16')],{'raw':_0x48144f[_0xe261('0x17')]?_0x48144f[_0xe261('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48144f[_0xe261('0x17')]?_0x48144f[_0xe261('0x17')][_0xe261('0x1d')]||null:null,'attributes':_0x48144f['options']?_0x48144f['options']['attributes']||null:null,'limit':_0x48144f['options']?_0x48144f[_0xe261('0x17')][_0xe261('0x1e')]||null:null})['then'](function(_0xb3bbbe){logger[_0xe261('0xd')]('UpdateSmsQueueReport',_0x48144f);logger[_0xe261('0xf')](_0xe261('0x1a'),_0x48144f,JSON[_0xe261('0x18')](_0xb3bbbe));_0x59be94(_0xb3bbbe);})[_0xe261('0x19')](function(_0x2471a7){logger[_0xe261('0x11')](_0xe261('0x1a'),_0x2471a7[_0xe261('0x13')],_0x48144f);_0x3233ae(_0x576cac['error'](0x1f4,_0x2471a7[_0xe261('0x13')]));});});}; \ No newline at end of file +var _0x01da=['SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport','SmsQueueReport','body','options','raw','update','limit','UpdateSmsQueueReport','stringify','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x3fcffd,_0x2bb971){var _0x42edb0=function(_0x53cc0d){while(--_0x53cc0d){_0x3fcffd['push'](_0x3fcffd['shift']());}};_0x42edb0(++_0x2bb971);}(_0x01da,0xdf));var _0xa01d=function(_0xbaf268,_0x1b6083){_0xbaf268=_0xbaf268-0x0;var _0x383995=_0x01da[_0xbaf268];return _0x383995;};'use strict';var _=require(_0xa01d('0x0'));var util=require('util');var moment=require(_0xa01d('0x1'));var BPromise=require(_0xa01d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa01d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa01d('0x4'));var logger=require(_0xa01d('0x5'))(_0xa01d('0x6'));var config=require(_0xa01d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa01d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ba80c,_0x17cb30,_0x4d1b13){return new BPromise(function(_0x160c42,_0x332de5){return client[_0xa01d('0x9')](_0x1ba80c,_0x4d1b13)[_0xa01d('0xa')](function(_0x3eadec){logger[_0xa01d('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0x17cb30,'request\x20sent');logger[_0xa01d('0xc')](_0xa01d('0xd'),_0x17cb30,_0xa01d('0xe'),JSON['stringify'](_0x3eadec));if(_0x3eadec[_0xa01d('0xf')]){if(_0x3eadec[_0xa01d('0xf')][_0xa01d('0x10')]===0x1f4){logger[_0xa01d('0xf')](_0xa01d('0x11'),_0x17cb30,_0x3eadec[_0xa01d('0xf')][_0xa01d('0x12')]);return _0x332de5(_0x3eadec['error']['message']);}logger['error'](_0xa01d('0x11'),_0x17cb30,_0x3eadec['error'][_0xa01d('0x12')]);return _0x160c42(_0x3eadec[_0xa01d('0xf')][_0xa01d('0x12')]);}else{logger[_0xa01d('0xb')](_0xa01d('0x11'),_0x17cb30,_0xa01d('0xe'));_0x160c42(_0x3eadec[_0xa01d('0x13')][_0xa01d('0x12')]);}})[_0xa01d('0x14')](function(_0x494314){logger[_0xa01d('0xf')](_0xa01d('0x11'),_0x17cb30,_0x494314);_0x332de5(_0x494314);});});}exports[_0xa01d('0x15')]=function(_0x100601){var _0x3bf6de=this;return new Promise(function(_0x36fc63,_0xe7babb){return db[_0xa01d('0x16')]['create'](_0x100601[_0xa01d('0x17')],{'raw':_0x100601[_0xa01d('0x18')]?_0x100601[_0xa01d('0x18')][_0xa01d('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x4c8366){logger[_0xa01d('0xb')](_0xa01d('0x15'),_0x100601);logger[_0xa01d('0xc')](_0xa01d('0x15'),_0x100601,JSON['stringify'](_0x4c8366));_0x36fc63(_0x4c8366);})['catch'](function(_0x484f30){logger[_0xa01d('0xf')](_0xa01d('0x15'),_0x484f30[_0xa01d('0x12')],_0x100601);_0xe7babb(_0x3bf6de[_0xa01d('0xf')](0x1f4,_0x484f30['message']));});});};exports['UpdateSmsQueueReport']=function(_0x4c8e4c){var _0x39c579=this;return new Promise(function(_0x1e3b10,_0x1d075b){return db[_0xa01d('0x16')][_0xa01d('0x1a')](_0x4c8e4c[_0xa01d('0x17')],{'raw':_0x4c8e4c[_0xa01d('0x18')]?_0x4c8e4c[_0xa01d('0x18')][_0xa01d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c8e4c[_0xa01d('0x18')]?_0x4c8e4c[_0xa01d('0x18')]['where']||null:null,'attributes':_0x4c8e4c[_0xa01d('0x18')]?_0x4c8e4c['options']['attributes']||null:null,'limit':_0x4c8e4c[_0xa01d('0x18')]?_0x4c8e4c[_0xa01d('0x18')][_0xa01d('0x1b')]||null:null})['then'](function(_0x56541f){logger[_0xa01d('0xb')](_0xa01d('0x1c'),_0x4c8e4c);logger[_0xa01d('0xc')]('UpdateSmsQueueReport',_0x4c8e4c,JSON[_0xa01d('0x1d')](_0x56541f));_0x1e3b10(_0x56541f);})[_0xa01d('0x14')](function(_0x4ea8fd){logger['error'](_0xa01d('0x1c'),_0x4ea8fd['message'],_0x4c8e4c);_0x1d075b(_0x39c579[_0xa01d('0xf')](0x1f4,_0x4ea8fd[_0xa01d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 89bcf61..20a2e19 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 _0xa0a1=['show','put','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0xffa527,_0x1c8dde){var _0x15a64b=function(_0x1a87af){while(--_0x1a87af){_0xffa527['push'](_0xffa527['shift']());}};_0x15a64b(++_0x1c8dde);}(_0xa0a1,0x15b));var _0x1a0a=function(_0x8b99d6,_0x2b4772){_0x8b99d6=_0x8b99d6-0x0;var _0x145dc4=_0xa0a1[_0x8b99d6];return _0x145dc4;};'use strict';var multer=require(_0x1a0a('0x0'));var util=require('util');var path=require(_0x1a0a('0x1'));var timeout=require(_0x1a0a('0x2'));var express=require(_0x1a0a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1a0a('0x4'));var interaction=require(_0x1a0a('0x5'));var config=require('../../config/environment');var controller=require(_0x1a0a('0x6'));router[_0x1a0a('0x7')]('/',auth['isAuthenticated'](),controller[_0x1a0a('0x8')]);router[_0x1a0a('0x7')](_0x1a0a('0x9'),auth[_0x1a0a('0xa')](),controller[_0x1a0a('0xb')]);router['get'](_0x1a0a('0xc'),auth[_0x1a0a('0xa')](),controller[_0x1a0a('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x1a0a('0xe')](_0x1a0a('0xc'),auth[_0x1a0a('0xa')](),controller['update']);router[_0x1a0a('0xf')]('/:id',auth[_0x1a0a('0xa')](),controller[_0x1a0a('0x10')]);module[_0x1a0a('0x11')]=router; \ No newline at end of file +var _0x0c02=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/:id','show','post','delete','destroy','util','path','express','Router'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x20c0('0x0'));var path=require(_0x20c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x20c0('0x2'));var router=express[_0x20c0('0x3')]();var fs_extra=require(_0x20c0('0x4'));var auth=require(_0x20c0('0x5'));var interaction=require(_0x20c0('0x6'));var config=require(_0x20c0('0x7'));var controller=require(_0x20c0('0x8'));router[_0x20c0('0x9')]('/',auth[_0x20c0('0xa')](),controller[_0x20c0('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x20c0('0x9')](_0x20c0('0xc'),auth[_0x20c0('0xa')](),controller[_0x20c0('0xd')]);router[_0x20c0('0xe')]('/',auth[_0x20c0('0xa')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x20c0('0xf')](_0x20c0('0xc'),auth[_0x20c0('0xa')](),controller[_0x20c0('0x10')]);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 0f0b616..26a38c2 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x5cc533,_0x22f53a){var _0x3b1674=function(_0x2ce2e7){while(--_0x2ce2e7){_0x5cc533['push'](_0x5cc533['shift']());}};_0x3b1674(++_0x22f53a);}(_0x008c,0x188));var _0xc008=function(_0x53f402,_0x326920){_0x53f402=_0x53f402-0x0;var _0x45a76d=_0x008c[_0x53f402];return _0x45a76d;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x3ad7ad,_0x291a8d){var _0x225a60=function(_0xca7354){while(--_0xca7354){_0x3ad7ad['push'](_0x3ad7ad['shift']());}};_0x225a60(++_0x291a8d);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3d8bb2,_0x309899){_0x3d8bb2=_0x3d8bb2-0x0;var _0x3daac5=_0xb43b[_0x3d8bb2];return _0x3daac5;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 341293f..83557ff 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 _0x12b3=['status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','show','params','keys','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x12b3,0x1a4));var _0x312b=function(_0x5f2185,_0x48eeff){_0x5f2185=_0x5f2185-0x0;var _0xfb0626=_0x12b3[_0x5f2185];return _0xfb0626;};'use strict';var emlformat=require(_0x312b('0x0'));var rimraf=require(_0x312b('0x1'));var zipdir=require(_0x312b('0x2'));var jsonpatch=require(_0x312b('0x3'));var rp=require(_0x312b('0x4'));var moment=require('moment');var BPromise=require(_0x312b('0x5'));var Mustache=require(_0x312b('0x6'));var util=require('util');var path=require(_0x312b('0x7'));var sox=require(_0x312b('0x8'));var csv=require(_0x312b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x312b('0xa'));var deskjs=require(_0x312b('0xb'));var toCsv=require(_0x312b('0x9'));var querystring=require(_0x312b('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x312b('0xd'));var as=require(_0x312b('0xe'));var hardwareService=require(_0x312b('0xf'));var logger=require(_0x312b('0x10'))(_0x312b('0x11'));var utils=require(_0x312b('0x12'));var config=require(_0x312b('0x13'));var licenseUtil=require(_0x312b('0x14'));var db=require(_0x312b('0x15'))['db'];function respondWithStatusCode(_0x3b31ad,_0x164557){_0x164557=_0x164557||0xcc;return function(_0x40777d){if(_0x40777d){return _0x3b31ad[_0x312b('0x16')](_0x164557);}return _0x3b31ad['status'](_0x164557)[_0x312b('0x17')]();};}function respondWithResult(_0x169b40,_0x724510){_0x724510=_0x724510||0xc8;return function(_0x255dde){if(_0x255dde){return _0x169b40[_0x312b('0x18')](_0x724510)['json'](_0x255dde);}};}function respondWithFilteredResult(_0x1279b6,_0x5f3741){return function(_0x26c897){if(_0x26c897){var _0x3c6a47=typeof _0x5f3741[_0x312b('0x19')]===_0x312b('0x1a')&&typeof _0x5f3741[_0x312b('0x1b')]===_0x312b('0x1a');var _0x444c2e=_0x26c897[_0x312b('0x1c')];var _0x46bd29=_0x3c6a47?0x0:_0x5f3741[_0x312b('0x19')];var _0x3a89c8=_0x3c6a47?_0x26c897[_0x312b('0x1c')]:_0x5f3741[_0x312b('0x19')]+_0x5f3741[_0x312b('0x1b')];var _0x49bb98;if(_0x3a89c8>=_0x444c2e){_0x3a89c8=_0x444c2e;_0x49bb98=0xc8;}else{_0x49bb98=0xce;}_0x1279b6[_0x312b('0x18')](_0x49bb98);return _0x1279b6[_0x312b('0x1d')](_0x312b('0x1e'),_0x46bd29+'-'+_0x3a89c8+'/'+_0x444c2e)[_0x312b('0x1f')](_0x26c897);}return null;};}function patchUpdates(_0x414c97){return function(_0xd880c9){try{jsonpatch['apply'](_0xd880c9,_0x414c97,!![]);}catch(_0x14d7cd){return BPromise[_0x312b('0x20')](_0x14d7cd);}return _0xd880c9[_0x312b('0x21')]();};}function saveUpdates(_0x8744bc,_0x13bebd){return function(_0x4c78b7){if(_0x4c78b7){return _0x4c78b7[_0x312b('0x22')](_0x8744bc)[_0x312b('0x23')](function(_0x18c356){return _0x18c356;});}return null;};}function removeEntity(_0x2d5b75,_0x343040){return function(_0x467e77){if(_0x467e77){return _0x467e77[_0x312b('0x24')]()[_0x312b('0x23')](function(){_0x2d5b75[_0x312b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c37cd,_0x1c414e){return function(_0x1e3c8d){if(!_0x1e3c8d){_0x4c37cd[_0x312b('0x16')](0x194);}return _0x1e3c8d;};}function handleError(_0x629976,_0x38ec79){_0x38ec79=_0x38ec79||0x1f4;return function(_0x50d7f0){logger[_0x312b('0x25')](_0x50d7f0['stack']);if(_0x50d7f0[_0x312b('0x26')]){delete _0x50d7f0[_0x312b('0x26')];}_0x629976['status'](_0x38ec79)[_0x312b('0x27')](_0x50d7f0);};}exports[_0x312b('0x28')]=function(_0x5a4d74,_0x5c1dfd){var _0x6760d3={},_0x23b59c={},_0x52693f={'count':0x0,'rows':[]};var _0x4758dc=_[_0x312b('0x29')](db[_0x312b('0x2a')][_0x312b('0x2b')],function(_0xda37a9){return{'name':_0xda37a9[_0x312b('0x2c')],'type':_0xda37a9[_0x312b('0x2d')][_0x312b('0x2e')]};});_0x23b59c['model']=_[_0x312b('0x29')](_0x4758dc,_0x312b('0x26'));_0x23b59c['query']=_['keys'](_0x5a4d74[_0x312b('0x2f')]);_0x23b59c[_0x312b('0x30')]=_[_0x312b('0x31')](_0x23b59c[_0x312b('0x32')],_0x23b59c[_0x312b('0x2f')]);_0x6760d3['attributes']=_[_0x312b('0x31')](_0x23b59c[_0x312b('0x32')],qs[_0x312b('0x33')](_0x5a4d74[_0x312b('0x2f')][_0x312b('0x33')]));_0x6760d3['attributes']=_0x6760d3[_0x312b('0x34')][_0x312b('0x35')]?_0x6760d3[_0x312b('0x34')]:_0x23b59c[_0x312b('0x32')];if(!_0x5a4d74[_0x312b('0x2f')][_0x312b('0x36')]('nolimit')){_0x6760d3[_0x312b('0x1b')]=qs[_0x312b('0x1b')](_0x5a4d74[_0x312b('0x2f')][_0x312b('0x1b')]);_0x6760d3[_0x312b('0x19')]=qs[_0x312b('0x19')](_0x5a4d74['query'][_0x312b('0x19')]);}_0x6760d3[_0x312b('0x37')]=qs[_0x312b('0x38')](_0x5a4d74[_0x312b('0x2f')][_0x312b('0x38')]);_0x6760d3[_0x312b('0x39')]=qs['filters'](_[_0x312b('0x3a')](_0x5a4d74[_0x312b('0x2f')],_0x23b59c[_0x312b('0x30')]),_0x4758dc);if(_0x5a4d74[_0x312b('0x2f')][_0x312b('0x3b')]){_0x6760d3[_0x312b('0x39')]=_['merge'](_0x6760d3[_0x312b('0x39')],{'$or':_['map'](_0x4758dc,function(_0x20b776){if(_0x20b776[_0x312b('0x2d')]!==_0x312b('0x3c')){var _0x44c9cc={};_0x44c9cc[_0x20b776[_0x312b('0x26')]]={'$like':'%'+_0x5a4d74[_0x312b('0x2f')]['filter']+'%'};return _0x44c9cc;}})});}_0x6760d3=_[_0x312b('0x3d')]({},_0x6760d3,_0x5a4d74[_0x312b('0x3e')]);var _0x3a7713={'where':_0x6760d3['where']};return db[_0x312b('0x2a')]['count'](_0x3a7713)[_0x312b('0x23')](function(_0xcc2057){_0x52693f[_0x312b('0x1c')]=_0xcc2057;if(_0x5a4d74[_0x312b('0x2f')]['includeAll']){_0x6760d3[_0x312b('0x3f')]=[{'all':!![]}];}return db[_0x312b('0x2a')][_0x312b('0x40')](_0x6760d3);})['then'](function(_0x840afb){_0x52693f['rows']=_0x840afb;return _0x52693f;})['then'](respondWithFilteredResult(_0x5c1dfd,_0x6760d3))[_0x312b('0x41')](handleError(_0x5c1dfd,null));};exports[_0x312b('0x42')]=function(_0x1f0297,_0xfa413c){var _0x2d0d05={'raw':!![],'where':{'id':_0x1f0297[_0x312b('0x43')]['id']}},_0x5a52ec={};_0x5a52ec[_0x312b('0x32')]=_[_0x312b('0x44')](db[_0x312b('0x2a')][_0x312b('0x2b')]);_0x5a52ec[_0x312b('0x2f')]=_[_0x312b('0x44')](_0x1f0297[_0x312b('0x2f')]);_0x5a52ec[_0x312b('0x30')]=_[_0x312b('0x31')](_0x5a52ec['model'],_0x5a52ec[_0x312b('0x2f')]);_0x2d0d05[_0x312b('0x34')]=_[_0x312b('0x31')](_0x5a52ec[_0x312b('0x32')],qs['fields'](_0x1f0297['query'][_0x312b('0x33')]));_0x2d0d05['attributes']=_0x2d0d05['attributes'][_0x312b('0x35')]?_0x2d0d05[_0x312b('0x34')]:_0x5a52ec[_0x312b('0x32')];if(_0x1f0297[_0x312b('0x2f')][_0x312b('0x45')]){_0x2d0d05[_0x312b('0x3f')]=[{'all':!![]}];}_0x2d0d05=_[_0x312b('0x3d')]({},_0x2d0d05,_0x1f0297[_0x312b('0x3e')]);return db[_0x312b('0x2a')][_0x312b('0x46')](_0x2d0d05)[_0x312b('0x23')](handleEntityNotFound(_0xfa413c,null))[_0x312b('0x23')](respondWithResult(_0xfa413c,null))[_0x312b('0x41')](handleError(_0xfa413c,null));};exports[_0x312b('0x47')]=function(_0x7d3688,_0xa9775d){return db[_0x312b('0x2a')]['create'](_0x7d3688['body'],{})[_0x312b('0x23')](respondWithResult(_0xa9775d,0xc9))[_0x312b('0x41')](handleError(_0xa9775d,null));};exports[_0x312b('0x22')]=function(_0x3a994f,_0x90ed){if(_0x3a994f['body']['id']){delete _0x3a994f[_0x312b('0x48')]['id'];}return db[_0x312b('0x2a')][_0x312b('0x46')]({'where':{'id':_0x3a994f['params']['id']}})['then'](handleEntityNotFound(_0x90ed,null))[_0x312b('0x23')](saveUpdates(_0x3a994f['body'],null))[_0x312b('0x23')](respondWithResult(_0x90ed,null))[_0x312b('0x41')](handleError(_0x90ed,null));};exports[_0x312b('0x24')]=function(_0x4f17ad,_0x43f084){return db[_0x312b('0x2a')]['find']({'where':{'id':_0x4f17ad[_0x312b('0x43')]['id']}})['then'](handleEntityNotFound(_0x43f084,null))[_0x312b('0x23')](removeEntity(_0x43f084,null))[_0x312b('0x41')](handleError(_0x43f084,null));};exports[_0x312b('0x49')]=function(_0x916100,_0x468685){return db[_0x312b('0x2a')][_0x312b('0x49')]()[_0x312b('0x23')](respondWithResult(_0x468685,null))[_0x312b('0x41')](handleError(_0x468685,null));}; \ No newline at end of file +var _0xb5ba=['mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','map','SmsTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch','params','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0xb5ba,0x1c2));var _0xab5b=function(_0x1f0724,_0x3a58bf){_0x1f0724=_0x1f0724-0x0;var _0x253ffb=_0xb5ba[_0x1f0724];return _0x253ffb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xab5b('0x0'));var zipdir=require(_0xab5b('0x1'));var jsonpatch=require(_0xab5b('0x2'));var rp=require(_0xab5b('0x3'));var moment=require(_0xab5b('0x4'));var BPromise=require(_0xab5b('0x5'));var Mustache=require(_0xab5b('0x6'));var util=require(_0xab5b('0x7'));var path=require(_0xab5b('0x8'));var sox=require('sox');var csv=require(_0xab5b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xab5b('0xa'));var _=require(_0xab5b('0xb'));var squel=require('squel');var crypto=require(_0xab5b('0xc'));var jsforce=require(_0xab5b('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xab5b('0xe'));var Papa=require(_0xab5b('0xf'));var Redis=require(_0xab5b('0x10'));var authService=require(_0xab5b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xab5b('0x12'));var hardwareService=require(_0xab5b('0x13'));var logger=require(_0xab5b('0x14'))('api');var utils=require(_0xab5b('0x15'));var config=require(_0xab5b('0x16'));var licenseUtil=require(_0xab5b('0x17'));var db=require(_0xab5b('0x18'))['db'];function respondWithStatusCode(_0x3f2ab0,_0x1149d2){_0x1149d2=_0x1149d2||0xcc;return function(_0xcf97c2){if(_0xcf97c2){return _0x3f2ab0['sendStatus'](_0x1149d2);}return _0x3f2ab0['status'](_0x1149d2)['end']();};}function respondWithResult(_0x39e6cb,_0x2db769){_0x2db769=_0x2db769||0xc8;return function(_0x12fb05){if(_0x12fb05){return _0x39e6cb[_0xab5b('0x19')](_0x2db769)[_0xab5b('0x1a')](_0x12fb05);}};}function respondWithFilteredResult(_0x11fca8,_0x1626e4){return function(_0x550c99){if(_0x550c99){var _0x3c8253=typeof _0x1626e4['offset']===_0xab5b('0x1b')&&typeof _0x1626e4[_0xab5b('0x1c')]===_0xab5b('0x1b');var _0x98e985=_0x550c99[_0xab5b('0x1d')];var _0x3c80bd=_0x3c8253?0x0:_0x1626e4[_0xab5b('0x1e')];var _0x53bc39=_0x3c8253?_0x550c99['count']:_0x1626e4[_0xab5b('0x1e')]+_0x1626e4[_0xab5b('0x1c')];var _0x368615;if(_0x53bc39>=_0x98e985){_0x53bc39=_0x98e985;_0x368615=0xc8;}else{_0x368615=0xce;}_0x11fca8[_0xab5b('0x19')](_0x368615);return _0x11fca8[_0xab5b('0x1f')](_0xab5b('0x20'),_0x3c80bd+'-'+_0x53bc39+'/'+_0x98e985)[_0xab5b('0x1a')](_0x550c99);}return null;};}function patchUpdates(_0x315d97){return function(_0xff07ca){try{jsonpatch[_0xab5b('0x21')](_0xff07ca,_0x315d97,!![]);}catch(_0x22c6a5){return BPromise[_0xab5b('0x22')](_0x22c6a5);}return _0xff07ca[_0xab5b('0x23')]();};}function saveUpdates(_0x3c57f4,_0x5a7801){return function(_0x6d650){if(_0x6d650){return _0x6d650[_0xab5b('0x24')](_0x3c57f4)[_0xab5b('0x25')](function(_0x4ed500){return _0x4ed500;});}return null;};}function removeEntity(_0x42ba09,_0x580f81){return function(_0x2bf519){if(_0x2bf519){return _0x2bf519[_0xab5b('0x26')]()['then'](function(){_0x42ba09[_0xab5b('0x19')](0xcc)[_0xab5b('0x27')]();});}};}function handleEntityNotFound(_0x4d7c64,_0x4d06db){return function(_0x49354c){if(!_0x49354c){_0x4d7c64[_0xab5b('0x28')](0x194);}return _0x49354c;};}function handleError(_0x457290,_0x157614){_0x157614=_0x157614||0x1f4;return function(_0x23aaf4){logger[_0xab5b('0x29')](_0x23aaf4['stack']);if(_0x23aaf4[_0xab5b('0x2a')]){delete _0x23aaf4[_0xab5b('0x2a')];}_0x457290[_0xab5b('0x19')](_0x157614)[_0xab5b('0x2b')](_0x23aaf4);};}exports['index']=function(_0x366bc3,_0x579644){var _0x4f181b={},_0x30cb89={},_0x4b08ab={'count':0x0,'rows':[]};var _0x33a7e8=_[_0xab5b('0x2c')](db[_0xab5b('0x2d')][_0xab5b('0x2e')],function(_0x33fad8){return{'name':_0x33fad8[_0xab5b('0x2f')],'type':_0x33fad8[_0xab5b('0x30')]['key']};});_0x30cb89[_0xab5b('0x31')]=_['map'](_0x33a7e8,_0xab5b('0x2a'));_0x30cb89[_0xab5b('0x32')]=_[_0xab5b('0x33')](_0x366bc3['query']);_0x30cb89[_0xab5b('0x34')]=_[_0xab5b('0x35')](_0x30cb89[_0xab5b('0x31')],_0x30cb89[_0xab5b('0x32')]);_0x4f181b['attributes']=_[_0xab5b('0x35')](_0x30cb89['model'],qs[_0xab5b('0x36')](_0x366bc3[_0xab5b('0x32')][_0xab5b('0x36')]));_0x4f181b[_0xab5b('0x37')]=_0x4f181b[_0xab5b('0x37')][_0xab5b('0x38')]?_0x4f181b[_0xab5b('0x37')]:_0x30cb89[_0xab5b('0x31')];if(!_0x366bc3[_0xab5b('0x32')][_0xab5b('0x39')](_0xab5b('0x3a'))){_0x4f181b[_0xab5b('0x1c')]=qs[_0xab5b('0x1c')](_0x366bc3[_0xab5b('0x32')][_0xab5b('0x1c')]);_0x4f181b['offset']=qs[_0xab5b('0x1e')](_0x366bc3[_0xab5b('0x32')]['offset']);}_0x4f181b[_0xab5b('0x3b')]=qs[_0xab5b('0x3c')](_0x366bc3[_0xab5b('0x32')][_0xab5b('0x3c')]);_0x4f181b[_0xab5b('0x3d')]=qs[_0xab5b('0x34')](_[_0xab5b('0x3e')](_0x366bc3[_0xab5b('0x32')],_0x30cb89['filters']),_0x33a7e8);if(_0x366bc3[_0xab5b('0x32')][_0xab5b('0x3f')]){_0x4f181b[_0xab5b('0x3d')]=_['merge'](_0x4f181b[_0xab5b('0x3d')],{'$or':_['map'](_0x33a7e8,function(_0x41f508){if(_0x41f508[_0xab5b('0x30')]!==_0xab5b('0x40')){var _0x58a507={};_0x58a507[_0x41f508[_0xab5b('0x2a')]]={'$like':'%'+_0x366bc3[_0xab5b('0x32')][_0xab5b('0x3f')]+'%'};return _0x58a507;}})});}_0x4f181b=_[_0xab5b('0x41')]({},_0x4f181b,_0x366bc3['options']);var _0x1aac09={'where':_0x4f181b[_0xab5b('0x3d')]};return db[_0xab5b('0x2d')][_0xab5b('0x1d')](_0x1aac09)['then'](function(_0x227841){_0x4b08ab['count']=_0x227841;if(_0x366bc3['query'][_0xab5b('0x42')]){_0x4f181b[_0xab5b('0x43')]=[{'all':!![]}];}return db[_0xab5b('0x2d')][_0xab5b('0x44')](_0x4f181b);})[_0xab5b('0x25')](function(_0x4e9b59){_0x4b08ab['rows']=_0x4e9b59;return _0x4b08ab;})[_0xab5b('0x25')](respondWithFilteredResult(_0x579644,_0x4f181b))[_0xab5b('0x45')](handleError(_0x579644,null));};exports['show']=function(_0x27970b,_0x14e9b3){var _0x2c7960={'raw':!![],'where':{'id':_0x27970b[_0xab5b('0x46')]['id']}},_0x51f476={};_0x51f476['model']=_[_0xab5b('0x33')](db['SmsTransferReport'][_0xab5b('0x2e')]);_0x51f476[_0xab5b('0x32')]=_[_0xab5b('0x33')](_0x27970b['query']);_0x51f476['filters']=_['intersection'](_0x51f476[_0xab5b('0x31')],_0x51f476[_0xab5b('0x32')]);_0x2c7960[_0xab5b('0x37')]=_[_0xab5b('0x35')](_0x51f476[_0xab5b('0x31')],qs[_0xab5b('0x36')](_0x27970b['query'][_0xab5b('0x36')]));_0x2c7960[_0xab5b('0x37')]=_0x2c7960[_0xab5b('0x37')][_0xab5b('0x38')]?_0x2c7960[_0xab5b('0x37')]:_0x51f476[_0xab5b('0x31')];if(_0x27970b[_0xab5b('0x32')][_0xab5b('0x42')]){_0x2c7960['include']=[{'all':!![]}];}_0x2c7960=_[_0xab5b('0x41')]({},_0x2c7960,_0x27970b[_0xab5b('0x47')]);return db[_0xab5b('0x2d')][_0xab5b('0x48')](_0x2c7960)['then'](handleEntityNotFound(_0x14e9b3,null))['then'](respondWithResult(_0x14e9b3,null))[_0xab5b('0x45')](handleError(_0x14e9b3,null));};exports[_0xab5b('0x49')]=function(_0x183ba4,_0xac217b){return db['SmsTransferReport'][_0xab5b('0x49')](_0x183ba4[_0xab5b('0x4a')],{})['then'](respondWithResult(_0xac217b,0xc9))[_0xab5b('0x45')](handleError(_0xac217b,null));};exports[_0xab5b('0x24')]=function(_0x23133b,_0x308d0f){if(_0x23133b['body']['id']){delete _0x23133b[_0xab5b('0x4a')]['id'];}return db[_0xab5b('0x2d')][_0xab5b('0x48')]({'where':{'id':_0x23133b['params']['id']}})[_0xab5b('0x25')](handleEntityNotFound(_0x308d0f,null))[_0xab5b('0x25')](saveUpdates(_0x23133b[_0xab5b('0x4a')],null))[_0xab5b('0x25')](respondWithResult(_0x308d0f,null))[_0xab5b('0x45')](handleError(_0x308d0f,null));};exports['destroy']=function(_0x399a31,_0x22b966){return db['SmsTransferReport']['find']({'where':{'id':_0x399a31[_0xab5b('0x46')]['id']}})[_0xab5b('0x25')](handleEntityNotFound(_0x22b966,null))[_0xab5b('0x25')](removeEntity(_0x22b966,null))[_0xab5b('0x45')](handleError(_0x22b966,null));};exports['describe']=function(_0x2f4a4a,_0x17c1e4){return db[_0xab5b('0x2d')][_0xab5b('0x4b')]()[_0xab5b('0x25')](respondWithResult(_0x17c1e4,null))[_0xab5b('0x45')](handleError(_0x17c1e4,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index e82b97e..9d8172b 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 _0x9e43=['define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./smsTransferReport.attributes'];(function(_0x171995,_0x4b0d0f){var _0x32917f=function(_0x2a71aa){while(--_0x2a71aa){_0x171995['push'](_0x171995['shift']());}};_0x32917f(++_0x4b0d0f);}(_0x9e43,0x18a));var _0x39e4=function(_0x3855f4,_0x16073b){_0x3855f4=_0x3855f4-0x0;var _0x3d4e63=_0x9e43[_0x3855f4];return _0x3d4e63;};'use strict';var _=require(_0x39e4('0x0'));var util=require(_0x39e4('0x1'));var logger=require(_0x39e4('0x2'))(_0x39e4('0x3'));var moment=require(_0x39e4('0x4'));var BPromise=require(_0x39e4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x39e4('0x6'));var rimraf=require('rimraf');var config=require(_0x39e4('0x7'));var attributes=require(_0x39e4('0x8'));module['exports']=function(_0x452528,_0x3d0a58){return _0x452528[_0x39e4('0x9')](_0x39e4('0xa'),attributes,{'tableName':_0x39e4('0xb'),'paranoid':![],'indexes':[{'name':_0x39e4('0xc'),'fields':[_0x39e4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x99cd=['../../config/environment','./smsTransferReport.attributes','exports','uniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x4324a5,_0xdccdc2){var _0x16fa4a=function(_0x103da3){while(--_0x103da3){_0x4324a5['push'](_0x4324a5['shift']());}};_0x16fa4a(++_0xdccdc2);}(_0x99cd,0x194));var _0xd99c=function(_0x141128,_0xe50d80){_0x141128=_0x141128-0x0;var _0x205b35=_0x99cd[_0x141128];return _0x205b35;};'use strict';var _=require(_0xd99c('0x0'));var util=require(_0xd99c('0x1'));var logger=require(_0xd99c('0x2'))(_0xd99c('0x3'));var moment=require(_0xd99c('0x4'));var BPromise=require('bluebird');var rp=require(_0xd99c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd99c('0x6'));var attributes=require(_0xd99c('0x7'));module[_0xd99c('0x8')]=function(_0x11c2f2,_0x23cae2){return _0x11c2f2['define']('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd99c('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index c4046c4..c38282b 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 _0xdedd=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SmsTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x3cf9f5,_0x316df1){var _0x38f98c=function(_0x265359){while(--_0x265359){_0x3cf9f5['push'](_0x3cf9f5['shift']());}};_0x38f98c(++_0x316df1);}(_0xdedd,0x197));var _0xdded=function(_0x8e691b,_0x44e65f){_0x8e691b=_0x8e691b-0x0;var _0x12c161=_0xdedd[_0x8e691b];return _0x12c161;};'use strict';var _=require(_0xdded('0x0'));var util=require(_0xdded('0x1'));var moment=require(_0xdded('0x2'));var BPromise=require(_0xdded('0x3'));var rs=require(_0xdded('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdded('0x5'))['db'];var utils=require(_0xdded('0x6'));var logger=require(_0xdded('0x7'))(_0xdded('0x8'));var config=require(_0xdded('0x9'));var jayson=require(_0xdded('0xa'));var client=jayson[_0xdded('0xb')][_0xdded('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59aa13,_0x5a43e7,_0x558cff){return new BPromise(function(_0x224a4d,_0x4a2516){return client['request'](_0x59aa13,_0x558cff)[_0xdded('0xd')](function(_0x1a183f){logger[_0xdded('0xe')](_0xdded('0xf'),_0x5a43e7,'request\x20sent');logger[_0xdded('0x10')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x5a43e7,_0xdded('0x11'),JSON[_0xdded('0x12')](_0x1a183f));if(_0x1a183f[_0xdded('0x13')]){if(_0x1a183f[_0xdded('0x13')][_0xdded('0x14')]===0x1f4){logger[_0xdded('0x13')](_0xdded('0xf'),_0x5a43e7,_0x1a183f[_0xdded('0x13')][_0xdded('0x15')]);return _0x4a2516(_0x1a183f['error'][_0xdded('0x15')]);}logger[_0xdded('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x5a43e7,_0x1a183f[_0xdded('0x13')]['message']);return _0x224a4d(_0x1a183f[_0xdded('0x13')]['message']);}else{logger[_0xdded('0xe')](_0xdded('0xf'),_0x5a43e7,_0xdded('0x11'));_0x224a4d(_0x1a183f['result'][_0xdded('0x15')]);}})[_0xdded('0x16')](function(_0x2ef523){logger[_0xdded('0x13')](_0xdded('0xf'),_0x5a43e7,_0x2ef523);_0x4a2516(_0x2ef523);});});} \ No newline at end of file +var _0xbe48=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','SmsTransferReport,\x20%s,\x20%s'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0xbe48,0x121));var _0x8be4=function(_0x124d7f,_0x23b6d7){_0x124d7f=_0x124d7f-0x0;var _0x4866b8=_0xbe48[_0x124d7f];return _0x4866b8;};'use strict';var _=require(_0x8be4('0x0'));var util=require(_0x8be4('0x1'));var moment=require(_0x8be4('0x2'));var BPromise=require(_0x8be4('0x3'));var rs=require(_0x8be4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8be4('0x5'));var logger=require(_0x8be4('0x6'))('rpc');var config=require(_0x8be4('0x7'));var jayson=require(_0x8be4('0x8'));var client=jayson[_0x8be4('0x9')][_0x8be4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe82da6,_0x4211b6,_0x35f862){return new BPromise(function(_0x554300,_0x3f87c6){return client[_0x8be4('0xb')](_0xe82da6,_0x35f862)['then'](function(_0x47ba2e){logger[_0x8be4('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x4211b6,'request\x20sent');logger[_0x8be4('0xd')](_0x8be4('0xe'),_0x4211b6,_0x8be4('0xf'),JSON['stringify'](_0x47ba2e));if(_0x47ba2e['error']){if(_0x47ba2e['error'][_0x8be4('0x10')]===0x1f4){logger[_0x8be4('0x11')](_0x8be4('0x12'),_0x4211b6,_0x47ba2e[_0x8be4('0x11')]['message']);return _0x3f87c6(_0x47ba2e['error'][_0x8be4('0x13')]);}logger[_0x8be4('0x11')](_0x8be4('0x12'),_0x4211b6,_0x47ba2e[_0x8be4('0x11')]['message']);return _0x554300(_0x47ba2e[_0x8be4('0x11')]['message']);}else{logger[_0x8be4('0xc')](_0x8be4('0x12'),_0x4211b6,_0x8be4('0xf'));_0x554300(_0x47ba2e[_0x8be4('0x14')][_0x8be4('0x13')]);}})[_0x8be4('0x15')](function(_0x435906){logger[_0x8be4('0x11')](_0x8be4('0x12'),_0x4211b6,_0x435906);_0x3f87c6(_0x435906);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index acd9725..a026bf2 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 _0xa005=['../../components/auth/service','../../config/environment','get','isAuthenticated','diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','extname','single','file','create','/:id','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x2b4448,_0x5bcc69){var _0xb4b465=function(_0x5ac741){while(--_0x5ac741){_0x2b4448['push'](_0x2b4448['shift']());}};_0xb4b465(++_0x5bcc69);}(_0xa005,0x14b));var _0x5a00=function(_0x473738,_0x15ea31){_0x473738=_0x473738-0x0;var _0x1df4ae=_0xa005[_0x473738];return _0x1df4ae;};'use strict';var multer=require(_0x5a00('0x0'));var util=require(_0x5a00('0x1'));var path=require(_0x5a00('0x2'));var timeout=require(_0x5a00('0x3'));var express=require(_0x5a00('0x4'));var router=express[_0x5a00('0x5')]();var fs_extra=require(_0x5a00('0x6'));var auth=require(_0x5a00('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5a00('0x8'));var controller=require('./sound.controller');router[_0x5a00('0x9')]('/',auth[_0x5a00('0xa')](),controller['index']);router['get']('/:id',auth[_0x5a00('0xa')](),controller['show']);router['get']('/:id/download',auth[_0x5a00('0xa')](),controller['download']);var upload=multer({'storage':multer[_0x5a00('0xb')]({'destination':function(_0x379bcc,_0x5072cb,_0x2d730a){_0x2d730a(null,path[_0x5a00('0xc')](config[_0x5a00('0xd')],'server/files/sounds/original/'));},'filename':function(_0x12ae1f,_0x180a6b,_0x1281ee){_0x180a6b[_0x5a00('0xe')]=_0x180a6b[_0x5a00('0xe')][_0x5a00('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1281ee(null,util[_0x5a00('0x10')](_0x5a00('0x11'),path[_0x5a00('0x12')](_0x180a6b['originalname'],path['extname'](_0x180a6b['originalname'])),Date['now'](),path[_0x5a00('0x13')](_0x180a6b[_0x5a00('0xe')])));}})});router['post']('/',upload[_0x5a00('0x14')](_0x5a00('0x15')),controller[_0x5a00('0x16')]);router['put'](_0x5a00('0x17'),auth['isAuthenticated'](),controller[_0x5a00('0x18')]);router[_0x5a00('0x19')](_0x5a00('0x17'),auth[_0x5a00('0xa')](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0x3d67=['isAuthenticated','/:id','show','/:id/download','diskStorage','root','originalname','replace','%s-%s%s','basename','extname','now','post','single','file','create','put','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x214456,_0x159fd0){var _0x299b83=function(_0x4640c7){while(--_0x4640c7){_0x214456['push'](_0x214456['shift']());}};_0x299b83(++_0x159fd0);}(_0x3d67,0xc2));var _0x73d6=function(_0x1199bd,_0x4f77db){_0x1199bd=_0x1199bd-0x0;var _0x1371f0=_0x3d67[_0x1199bd];return _0x1371f0;};'use strict';var multer=require(_0x73d6('0x0'));var util=require(_0x73d6('0x1'));var path=require(_0x73d6('0x2'));var timeout=require(_0x73d6('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x73d6('0x4'));var auth=require(_0x73d6('0x5'));var interaction=require(_0x73d6('0x6'));var config=require(_0x73d6('0x7'));var controller=require('./sound.controller');router[_0x73d6('0x8')]('/',auth[_0x73d6('0x9')](),controller['index']);router['get'](_0x73d6('0xa'),auth[_0x73d6('0x9')](),controller[_0x73d6('0xb')]);router['get'](_0x73d6('0xc'),auth[_0x73d6('0x9')](),controller['download']);var upload=multer({'storage':multer[_0x73d6('0xd')]({'destination':function(_0x3aeaca,_0x4f7ed8,_0x3c7bbe){_0x3c7bbe(null,path['join'](config[_0x73d6('0xe')],'server/files/sounds/original/'));},'filename':function(_0x572c43,_0x448ed8,_0x27a90a){_0x448ed8[_0x73d6('0xf')]=_0x448ed8['originalname'][_0x73d6('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x27a90a(null,util['format'](_0x73d6('0x11'),path[_0x73d6('0x12')](_0x448ed8['originalname'],path[_0x73d6('0x13')](_0x448ed8[_0x73d6('0xf')])),Date[_0x73d6('0x14')](),path['extname'](_0x448ed8[_0x73d6('0xf')])));}})});router[_0x73d6('0x15')]('/',upload[_0x73d6('0x16')](_0x73d6('0x17')),controller[_0x73d6('0x18')]);router[_0x73d6('0x19')](_0x73d6('0xa'),auth[_0x73d6('0x9')](),controller[_0x73d6('0x1a')]);router['delete'](_0x73d6('0xa'),auth[_0x73d6('0x9')](),controller[_0x73d6('0x1b')]);module[_0x73d6('0x1c')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index a128647..755ea95 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 _0x7cfa=['name','BIGINT','INTEGER','FLOAT','sequelize','exports','STRING'];(function(_0x35a6f8,_0x2a19d0){var _0x11d2da=function(_0x83f33e){while(--_0x83f33e){_0x35a6f8['push'](_0x35a6f8['shift']());}};_0x11d2da(++_0x2a19d0);}(_0x7cfa,0x131));var _0xa7cf=function(_0x5ca8c2,_0x24e940){_0x5ca8c2=_0x5ca8c2-0x0;var _0x529f34=_0x7cfa[_0x5ca8c2];return _0x529f34;};'use strict';var Sequelize=require(_0xa7cf('0x0'));module[_0xa7cf('0x1')]={'name':{'type':Sequelize[_0xa7cf('0x2')],'unique':_0xa7cf('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xa7cf('0x2')]},'display_name':{'type':Sequelize[_0xa7cf('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xa7cf('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xa7cf('0x4')]},'original_sampleRate':{'type':Sequelize[_0xa7cf('0x5')]},'converted_format':{'type':Sequelize[_0xa7cf('0x2')]},'converted_duration':{'type':Sequelize[_0xa7cf('0x6')]},'converted_sampleCount':{'type':Sequelize[_0xa7cf('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xa7cf('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xa7cf('0x5')]}}; \ No newline at end of file +var _0xe849=['name','FLOAT','BIGINT','INTEGER','sequelize','exports','STRING'];(function(_0x4e04a8,_0x2f2d6a){var _0x6c3e6f=function(_0x806cf7){while(--_0x806cf7){_0x4e04a8['push'](_0x4e04a8['shift']());}};_0x6c3e6f(++_0x2f2d6a);}(_0xe849,0xa5));var _0x9e84=function(_0x2666b1,_0x5c9850){_0x2666b1=_0x2666b1-0x0;var _0x2efc62=_0xe849[_0x2666b1];return _0x2efc62;};'use strict';var Sequelize=require(_0x9e84('0x0'));module[_0x9e84('0x1')]={'name':{'type':Sequelize[_0x9e84('0x2')],'unique':_0x9e84('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x9e84('0x2')]},'display_name':{'type':Sequelize[_0x9e84('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x9e84('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x9e84('0x4')]},'original_sampleCount':{'type':Sequelize[_0x9e84('0x5')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x9e84('0x6')]},'converted_format':{'type':Sequelize[_0x9e84('0x2')]},'converted_duration':{'type':Sequelize[_0x9e84('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x9e84('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x9e84('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x9e84('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index f85660f..b86b116 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 _0x02f2=['get','Sounds','UserProfileResource','then','end','stack','send','map','Sound','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','include','options','find','params','name','save_name','join','root','server/files/sounds/converted','converted_format','Sequelize','format','%s.%s','create','basename','extname','file','originalname','filename','substring','wav','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','error','unlinkSync','src','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_sampleCount','converted_channelCount','converted_sampleRate','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','start','update','description','server/files/sounds/original','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','limit','count','offset','set','json','apply','reject','save','destroy'];(function(_0x4e6442,_0xfe80a3){var _0x73cded=function(_0x2fc683){while(--_0x2fc683){_0x4e6442['push'](_0x4e6442['shift']());}};_0x73cded(++_0xfe80a3);}(_0x02f2,0x1cd));var _0x202f=function(_0x57d859,_0x3341c2){_0x57d859=_0x57d859-0x0;var _0x2d3d09=_0x02f2[_0x57d859];return _0x2d3d09;};'use strict';var emlformat=require(_0x202f('0x0'));var rimraf=require(_0x202f('0x1'));var zipdir=require(_0x202f('0x2'));var jsonpatch=require(_0x202f('0x3'));var rp=require(_0x202f('0x4'));var moment=require(_0x202f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x202f('0x6'));var util=require(_0x202f('0x7'));var path=require('path');var sox=require(_0x202f('0x8'));var csv=require(_0x202f('0x9'));var ejs=require(_0x202f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x202f('0xb'));var squel=require(_0x202f('0xc'));var crypto=require(_0x202f('0xd'));var jsforce=require(_0x202f('0xe'));var deskjs=require(_0x202f('0xf'));var toCsv=require(_0x202f('0x9'));var querystring=require(_0x202f('0x10'));var Papa=require(_0x202f('0x11'));var Redis=require(_0x202f('0x12'));var authService=require(_0x202f('0x13'));var qs=require(_0x202f('0x14'));var as=require(_0x202f('0x15'));var hardwareService=require(_0x202f('0x16'));var logger=require(_0x202f('0x17'))(_0x202f('0x18'));var utils=require(_0x202f('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x202f('0x1a'));var db=require(_0x202f('0x1b'))['db'];function respondWithStatusCode(_0x3bf90e,_0x5bc5e3){_0x5bc5e3=_0x5bc5e3||0xcc;return function(_0x4d07d0){if(_0x4d07d0){return _0x3bf90e[_0x202f('0x1c')](_0x5bc5e3);}return _0x3bf90e['status'](_0x5bc5e3)['end']();};}function respondWithResult(_0x8cd7f1,_0x437143){_0x437143=_0x437143||0xc8;return function(_0x24e364){if(_0x24e364){return _0x8cd7f1[_0x202f('0x1d')](_0x437143)['json'](_0x24e364);}};}function respondWithFilteredResult(_0xde6bcc,_0x5cef79){return function(_0x53377d){if(_0x53377d){var _0x164f8d=typeof _0x5cef79['offset']==='undefined'&&typeof _0x5cef79[_0x202f('0x1e')]==='undefined';var _0x67e89a=_0x53377d[_0x202f('0x1f')];var _0x2553ea=_0x164f8d?0x0:_0x5cef79[_0x202f('0x20')];var _0x31e179=_0x164f8d?_0x53377d[_0x202f('0x1f')]:_0x5cef79[_0x202f('0x20')]+_0x5cef79[_0x202f('0x1e')];var _0x1cf069;if(_0x31e179>=_0x67e89a){_0x31e179=_0x67e89a;_0x1cf069=0xc8;}else{_0x1cf069=0xce;}_0xde6bcc[_0x202f('0x1d')](_0x1cf069);return _0xde6bcc[_0x202f('0x21')]('Content-Range',_0x2553ea+'-'+_0x31e179+'/'+_0x67e89a)[_0x202f('0x22')](_0x53377d);}return null;};}function patchUpdates(_0x865037){return function(_0x2fec01){try{jsonpatch[_0x202f('0x23')](_0x2fec01,_0x865037,!![]);}catch(_0x3f044f){return BPromise[_0x202f('0x24')](_0x3f044f);}return _0x2fec01[_0x202f('0x25')]();};}function saveUpdates(_0x5ddadb,_0x537da7){return function(_0x154d40){if(_0x154d40){return _0x154d40['update'](_0x5ddadb)['then'](function(_0x5dfc94){return _0x5dfc94;});}return null;};}function removeEntity(_0x3adf42,_0x576eb7){return function(_0x2e511f){if(_0x2e511f){return _0x2e511f[_0x202f('0x26')]()['then'](function(){var _0x5816b6=_0x2e511f[_0x202f('0x27')]({'plain':!![]});var _0x4f9dc6=_0x202f('0x28');return db[_0x202f('0x29')][_0x202f('0x26')]({'where':{'type':_0x4f9dc6,'resourceId':_0x5816b6['id']}})[_0x202f('0x2a')](function(){return _0x2e511f;});})[_0x202f('0x2a')](function(){_0x3adf42[_0x202f('0x1d')](0xcc)[_0x202f('0x2b')]();});}};}function handleEntityNotFound(_0x246961,_0x9c1099){return function(_0x3bfe20){if(!_0x3bfe20){_0x246961['sendStatus'](0x194);}return _0x3bfe20;};}function handleError(_0x3becec,_0xab0e90){_0xab0e90=_0xab0e90||0x1f4;return function(_0x2b394b){logger['error'](_0x2b394b[_0x202f('0x2c')]);if(_0x2b394b['name']){delete _0x2b394b['name'];}_0x3becec[_0x202f('0x1d')](_0xab0e90)[_0x202f('0x2d')](_0x2b394b);};}exports['index']=function(_0x462718,_0x431356){var _0x3143f5={},_0x185205={},_0x163d74={'count':0x0,'rows':[]};var _0x56fc1a=_[_0x202f('0x2e')](db[_0x202f('0x2f')][_0x202f('0x30')],function(_0x47d871){return{'name':_0x47d871['fieldName'],'type':_0x47d871['type'][_0x202f('0x31')]};});_0x185205[_0x202f('0x32')]=_[_0x202f('0x2e')](_0x56fc1a,'name');_0x185205[_0x202f('0x33')]=_[_0x202f('0x34')](_0x462718[_0x202f('0x33')]);_0x185205[_0x202f('0x35')]=_[_0x202f('0x36')](_0x185205[_0x202f('0x32')],_0x185205[_0x202f('0x33')]);_0x3143f5[_0x202f('0x37')]=_['intersection'](_0x185205['model'],qs[_0x202f('0x38')](_0x462718['query'][_0x202f('0x38')]));_0x3143f5[_0x202f('0x37')]=_0x3143f5[_0x202f('0x37')][_0x202f('0x39')]?_0x3143f5[_0x202f('0x37')]:_0x185205['model'];if(!_0x462718['query'][_0x202f('0x3a')](_0x202f('0x3b'))){_0x3143f5['limit']=qs[_0x202f('0x1e')](_0x462718[_0x202f('0x33')][_0x202f('0x1e')]);_0x3143f5[_0x202f('0x20')]=qs[_0x202f('0x20')](_0x462718[_0x202f('0x33')]['offset']);}_0x3143f5[_0x202f('0x3c')]=qs[_0x202f('0x3d')](_0x462718['query'][_0x202f('0x3d')]);_0x3143f5[_0x202f('0x3e')]=qs['filters'](_[_0x202f('0x3f')](_0x462718[_0x202f('0x33')],_0x185205[_0x202f('0x35')]),_0x56fc1a);if(_0x462718['query'][_0x202f('0x40')]){_0x3143f5[_0x202f('0x3e')]=_[_0x202f('0x41')](_0x3143f5['where'],{'$or':_[_0x202f('0x2e')](_0x56fc1a,function(_0x59aa11){if(_0x59aa11[_0x202f('0x42')]!==_0x202f('0x43')){var _0x3c3992={};_0x3c3992[_0x59aa11['name']]={'$like':'%'+_0x462718[_0x202f('0x33')][_0x202f('0x40')]+'%'};return _0x3c3992;}})});}_0x3143f5=_[_0x202f('0x41')]({},_0x3143f5,_0x462718['options']);var _0x4a30f5={'where':_0x3143f5[_0x202f('0x3e')]};return db[_0x202f('0x2f')][_0x202f('0x1f')](_0x4a30f5)[_0x202f('0x2a')](function(_0x2431c2){_0x163d74[_0x202f('0x1f')]=_0x2431c2;if(_0x462718['query'][_0x202f('0x44')]){_0x3143f5['include']=[{'all':!![]}];}return db['Sound'][_0x202f('0x45')](_0x3143f5);})[_0x202f('0x2a')](function(_0xaa55c0){_0x163d74[_0x202f('0x46')]=_0xaa55c0;return _0x163d74;})[_0x202f('0x2a')](respondWithFilteredResult(_0x431356,_0x3143f5))[_0x202f('0x47')](handleError(_0x431356,null));};exports['show']=function(_0x2ff824,_0x68ea56){var _0x5caea9={'raw':!![],'where':{'id':_0x2ff824['params']['id']}},_0x5b645f={};_0x5b645f[_0x202f('0x32')]=_[_0x202f('0x34')](db[_0x202f('0x2f')]['rawAttributes']);_0x5b645f['query']=_[_0x202f('0x34')](_0x2ff824[_0x202f('0x33')]);_0x5b645f['filters']=_['intersection'](_0x5b645f[_0x202f('0x32')],_0x5b645f[_0x202f('0x33')]);_0x5caea9[_0x202f('0x37')]=_[_0x202f('0x36')](_0x5b645f[_0x202f('0x32')],qs[_0x202f('0x38')](_0x2ff824['query']['fields']));_0x5caea9[_0x202f('0x37')]=_0x5caea9[_0x202f('0x37')][_0x202f('0x39')]?_0x5caea9[_0x202f('0x37')]:_0x5b645f[_0x202f('0x32')];if(_0x2ff824[_0x202f('0x33')][_0x202f('0x44')]){_0x5caea9[_0x202f('0x48')]=[{'all':!![]}];}_0x5caea9=_[_0x202f('0x41')]({},_0x5caea9,_0x2ff824[_0x202f('0x49')]);return db[_0x202f('0x2f')][_0x202f('0x4a')](_0x5caea9)['then'](handleEntityNotFound(_0x68ea56,null))[_0x202f('0x2a')](respondWithResult(_0x68ea56,null))[_0x202f('0x47')](handleError(_0x68ea56,null));};exports['download']=function(_0x37cd6e,_0x1bceb7,_0x20169a){return db[_0x202f('0x2f')]['find']({'where':{'id':_0x37cd6e[_0x202f('0x4b')]['id']},'attributes':[_0x202f('0x4c'),_0x202f('0x4d'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x1bceb7,null))[_0x202f('0x2a')](function(_0x58a243){if(_0x58a243){if(!fs['existsSync'](path[_0x202f('0x4e')](config[_0x202f('0x4f')],_0x202f('0x50'),_0x58a243['save_name']+'.'+_0x58a243[_0x202f('0x51')]))){throw new db[(_0x202f('0x52'))]['ValidationError']('Sound\x20not\x20found');}return _0x1bceb7['download'](path['join'](config[_0x202f('0x4f')],_0x202f('0x50'),util[_0x202f('0x53')]('%s.%s',_0x58a243['save_name'],_0x58a243[_0x202f('0x51')])),util[_0x202f('0x53')](_0x202f('0x54'),_0x58a243['name'],_0x58a243[_0x202f('0x51')]));}return null;})['catch'](handleError(_0x1bceb7,null));};exports[_0x202f('0x55')]=function(_0x398c98,_0x358aeb,_0x454452){var _0x482761={'name':path[_0x202f('0x56')](_0x398c98['file']['originalname'],path[_0x202f('0x57')](_0x398c98[_0x202f('0x58')][_0x202f('0x59')])),'save_name':path[_0x202f('0x56')](_0x398c98[_0x202f('0x58')][_0x202f('0x5a')],path[_0x202f('0x57')](_0x398c98[_0x202f('0x58')][_0x202f('0x5a')])),'original_format':path[_0x202f('0x57')](_0x398c98['file'][_0x202f('0x59')])[_0x202f('0x5b')](0x1),'converted_format':_0x202f('0x5c')};var _0x51b6d5=path[_0x202f('0x4e')](config['root'],'server/files/sounds/original',_0x398c98[_0x202f('0x58')][_0x202f('0x5a')]);var _0x41498b=path[_0x202f('0x4e')](config[_0x202f('0x4f')],_0x202f('0x50'),util[_0x202f('0x53')](_0x202f('0x54'),path[_0x202f('0x56')](_0x398c98[_0x202f('0x58')][_0x202f('0x5a')],path['extname'](_0x398c98[_0x202f('0x58')][_0x202f('0x5a')])),_0x482761['converted_format']));logger[_0x202f('0x5d')](_0x202f('0x5e'),_0x51b6d5);logger[_0x202f('0x5d')](_0x202f('0x5f'),_0x41498b);try{fs[_0x202f('0x60')](_0x51b6d5,parseInt(_0x202f('0x61'),0x8));var _0x425099=sox[_0x202f('0x62')](_0x51b6d5,_0x41498b,{'sampleRate':0x1f40,'format':_0x202f('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x425099['on'](_0x202f('0x63'),function(_0x370312){fs[_0x202f('0x64')](_0x51b6d5);_0x358aeb[_0x202f('0x1d')](0x1f4)['send'](_0x370312);});_0x425099['on'](_0x202f('0x65'),function(_0xf7be28){_0x482761['original_duration']=isNaN(_0xf7be28['duration'])?null:_0xf7be28[_0x202f('0x66')]*0x3e8;_0x482761[_0x202f('0x67')]=isNaN(_0xf7be28[_0x202f('0x68')])?null:_0xf7be28[_0x202f('0x68')];_0x482761['original_channelCount']=isNaN(_0xf7be28[_0x202f('0x69')])?null:_0xf7be28[_0x202f('0x69')];_0x482761[_0x202f('0x6a')]=isNaN(_0xf7be28[_0x202f('0x6b')])?null:_0xf7be28[_0x202f('0x6b')];_0x482761[_0x202f('0x6c')]=isNaN(_0xf7be28[_0x202f('0x6d')])?null:_0xf7be28[_0x202f('0x6d')];});_0x425099['on']('dest',function(_0x265348){_0x482761['converted_duration']=isNaN(_0x265348[_0x202f('0x66')])?null:_0x265348[_0x202f('0x66')]*0x3e8;_0x482761[_0x202f('0x6e')]=isNaN(_0x265348[_0x202f('0x68')])?null:_0x265348[_0x202f('0x68')];_0x482761[_0x202f('0x6f')]=isNaN(_0x265348['channelCount'])?null:_0x265348[_0x202f('0x69')];_0x482761['converted_bitRate']=isNaN(_0x265348[_0x202f('0x6b')])?null:_0x265348[_0x202f('0x6b')];_0x482761[_0x202f('0x70')]=isNaN(_0x265348[_0x202f('0x6d')])?null:_0x265348['sampleRate'];});_0x425099['on']('end',function(){fs[_0x202f('0x60')](_0x41498b,parseInt(_0x202f('0x61'),0x8));return db[_0x202f('0x2f')][_0x202f('0x55')](_0x482761)[_0x202f('0x2a')](function(_0x4c93f0){var _0x5ce843={'role':_0x398c98[_0x202f('0x71')]['role'],'userProfileId':_0x398c98[_0x202f('0x71')]['userProfileId']};if(!_0x5ce843)throw new Error(_0x202f('0x72'));if(_0x5ce843[_0x202f('0x73')]===_0x202f('0x74')){var _0x103cf5=_0x4c93f0[_0x202f('0x27')]({'plain':!![]});return db[_0x202f('0x75')]['find']({'where':{'name':_0x202f('0x28'),'userProfileId':_0x5ce843[_0x202f('0x76')]},'raw':!![]})[_0x202f('0x2a')](function(_0x58558f){if(_0x58558f&&_0x58558f[_0x202f('0x77')]===0x0){return db[_0x202f('0x29')][_0x202f('0x55')]({'name':_0x103cf5[_0x202f('0x4c')],'resourceId':_0x103cf5['id'],'type':_0x58558f[_0x202f('0x4c')],'sectionId':_0x58558f['id']},{})['then'](function(){return _0x4c93f0;});}else{return _0x4c93f0;}})['catch'](function(_0x206110){logger[_0x202f('0x63')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x206110);throw _0x206110;});}return _0x4c93f0;})[_0x202f('0x2a')](respondWithResult(_0x358aeb,null))[_0x202f('0x47')](handleError(_0x358aeb,null));});_0x425099[_0x202f('0x78')]();}catch(_0xb2d489){_0x358aeb[_0x202f('0x1d')](0x1f4)[_0x202f('0x2d')](_0xb2d489);}};exports[_0x202f('0x79')]=function(_0x30a48b,_0x43d4c3,_0x1703c1){return db[_0x202f('0x2f')][_0x202f('0x4a')]({'where':{'id':_0x30a48b[_0x202f('0x4b')]['id']}})[_0x202f('0x2a')](handleEntityNotFound(_0x43d4c3,null))[_0x202f('0x2a')](saveUpdates(_[_0x202f('0x3f')](_0x30a48b[_0x202f('0x71')],[_0x202f('0x4c'),_0x202f('0x7a')]),null))['then'](respondWithResult(_0x43d4c3,null))[_0x202f('0x47')](handleError(_0x43d4c3,null));};exports['delete']=function(_0x589ee2,_0x5e8d00,_0x39cada){return db[_0x202f('0x2f')]['find']({'where':{'id':_0x589ee2['params']['id']}})['then'](function(_0x3ae0e4){if(_0x3ae0e4){return _0x3ae0e4[_0x202f('0x26')]();}})['then'](function(_0x3c9eec){var _0x51b401=path[_0x202f('0x4e')](config['root'],_0x202f('0x7b'),util[_0x202f('0x53')](_0x202f('0x54'),_0x3c9eec['save_name'],_0x3c9eec[_0x202f('0x7c')]));var _0x1d87b8=path[_0x202f('0x4e')](config[_0x202f('0x4f')],'server/files/sounds/converted',util['format']('%s.%s',_0x3c9eec['save_name'],_0x3c9eec[_0x202f('0x51')]));fs[_0x202f('0x64')](_0x51b401);fs[_0x202f('0x64')](_0x1d87b8);return _0x3c9eec;})[_0x202f('0x2a')](function(_0x3e0764){if(_0x3e0764){return _0x5e8d00[_0x202f('0x1d')](0xcc)[_0x202f('0x2b')]();}})[_0x202f('0x2a')](handleEntityNotFound(_0x5e8d00,null))[_0x202f('0x47')](handleError(_0x5e8d00,null));}; \ No newline at end of file +var _0xe8fb=['crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','reject','update','then','destroy','get','Sounds','UserProfileResource','error','name','index','map','Sound','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','options','find','save_name','existsSync','join','root','converted_format','Sound\x20not\x20found','download','server/files/sounds/converted','format','%s.%s','basename','originalname','extname','file','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','0777','transcode','unlinkSync','send','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','body','role','userProfileId','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','params','original_format','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash'];(function(_0x5585f5,_0x167771){var _0x3439c9=function(_0x207c3f){while(--_0x207c3f){_0x5585f5['push'](_0x5585f5['shift']());}};_0x3439c9(++_0x167771);}(_0xe8fb,0x68));var _0xbe8f=function(_0x4d3a3d,_0xd43b0a){_0x4d3a3d=_0x4d3a3d-0x0;var _0x14d467=_0xe8fb[_0x4d3a3d];return _0x14d467;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbe8f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbe8f('0x1'));var moment=require('moment');var BPromise=require(_0xbe8f('0x2'));var Mustache=require(_0xbe8f('0x3'));var util=require('util');var path=require(_0xbe8f('0x4'));var sox=require(_0xbe8f('0x5'));var csv=require(_0xbe8f('0x6'));var ejs=require(_0xbe8f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbe8f('0x8'));var squel=require('squel');var crypto=require(_0xbe8f('0x9'));var jsforce=require(_0xbe8f('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xbe8f('0x6'));var querystring=require(_0xbe8f('0xb'));var Papa=require(_0xbe8f('0xc'));var Redis=require(_0xbe8f('0xd'));var authService=require(_0xbe8f('0xe'));var qs=require(_0xbe8f('0xf'));var as=require(_0xbe8f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbe8f('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbe8f('0x12'))['db'];function respondWithStatusCode(_0x64268c,_0x1c3405){_0x1c3405=_0x1c3405||0xcc;return function(_0x41c1cf){if(_0x41c1cf){return _0x64268c[_0xbe8f('0x13')](_0x1c3405);}return _0x64268c[_0xbe8f('0x14')](_0x1c3405)[_0xbe8f('0x15')]();};}function respondWithResult(_0x153a80,_0x542394){_0x542394=_0x542394||0xc8;return function(_0x1fb75f){if(_0x1fb75f){return _0x153a80[_0xbe8f('0x14')](_0x542394)[_0xbe8f('0x16')](_0x1fb75f);}};}function respondWithFilteredResult(_0x593a93,_0x5c1069){return function(_0x1ca862){if(_0x1ca862){var _0x25d9d=typeof _0x5c1069['offset']==='undefined'&&typeof _0x5c1069[_0xbe8f('0x17')]===_0xbe8f('0x18');var _0x5ce088=_0x1ca862[_0xbe8f('0x19')];var _0x4624ed=_0x25d9d?0x0:_0x5c1069[_0xbe8f('0x1a')];var _0x86d262=_0x25d9d?_0x1ca862[_0xbe8f('0x19')]:_0x5c1069[_0xbe8f('0x1a')]+_0x5c1069['limit'];var _0x29ffae;if(_0x86d262>=_0x5ce088){_0x86d262=_0x5ce088;_0x29ffae=0xc8;}else{_0x29ffae=0xce;}_0x593a93['status'](_0x29ffae);return _0x593a93[_0xbe8f('0x1b')]('Content-Range',_0x4624ed+'-'+_0x86d262+'/'+_0x5ce088)[_0xbe8f('0x16')](_0x1ca862);}return null;};}function patchUpdates(_0xbfca99){return function(_0x2d4fee){try{jsonpatch['apply'](_0x2d4fee,_0xbfca99,!![]);}catch(_0x327a81){return BPromise[_0xbe8f('0x1c')](_0x327a81);}return _0x2d4fee['save']();};}function saveUpdates(_0x37c83a,_0x5de422){return function(_0x2e3382){if(_0x2e3382){return _0x2e3382[_0xbe8f('0x1d')](_0x37c83a)[_0xbe8f('0x1e')](function(_0xd485af){return _0xd485af;});}return null;};}function removeEntity(_0x24e8ce,_0x51edeb){return function(_0x3a4c5a){if(_0x3a4c5a){return _0x3a4c5a[_0xbe8f('0x1f')]()['then'](function(){var _0x2700df=_0x3a4c5a[_0xbe8f('0x20')]({'plain':!![]});var _0x2085a7=_0xbe8f('0x21');return db[_0xbe8f('0x22')][_0xbe8f('0x1f')]({'where':{'type':_0x2085a7,'resourceId':_0x2700df['id']}})[_0xbe8f('0x1e')](function(){return _0x3a4c5a;});})['then'](function(){_0x24e8ce[_0xbe8f('0x14')](0xcc)[_0xbe8f('0x15')]();});}};}function handleEntityNotFound(_0x7996c4,_0x3114b4){return function(_0x2ccb76){if(!_0x2ccb76){_0x7996c4[_0xbe8f('0x13')](0x194);}return _0x2ccb76;};}function handleError(_0x2c0266,_0x62b746){_0x62b746=_0x62b746||0x1f4;return function(_0x2e7b04){logger[_0xbe8f('0x23')](_0x2e7b04['stack']);if(_0x2e7b04[_0xbe8f('0x24')]){delete _0x2e7b04[_0xbe8f('0x24')];}_0x2c0266['status'](_0x62b746)['send'](_0x2e7b04);};}exports[_0xbe8f('0x25')]=function(_0x2cc82b,_0x17d840){var _0x2f1579={},_0x2dd8a1={},_0x5c5054={'count':0x0,'rows':[]};var _0x4bf5e6=_[_0xbe8f('0x26')](db[_0xbe8f('0x27')][_0xbe8f('0x28')],function(_0x2c6d62){return{'name':_0x2c6d62['fieldName'],'type':_0x2c6d62[_0xbe8f('0x29')][_0xbe8f('0x2a')]};});_0x2dd8a1[_0xbe8f('0x2b')]=_[_0xbe8f('0x26')](_0x4bf5e6,_0xbe8f('0x24'));_0x2dd8a1['query']=_[_0xbe8f('0x2c')](_0x2cc82b[_0xbe8f('0x2d')]);_0x2dd8a1[_0xbe8f('0x2e')]=_[_0xbe8f('0x2f')](_0x2dd8a1[_0xbe8f('0x2b')],_0x2dd8a1['query']);_0x2f1579['attributes']=_['intersection'](_0x2dd8a1[_0xbe8f('0x2b')],qs[_0xbe8f('0x30')](_0x2cc82b[_0xbe8f('0x2d')][_0xbe8f('0x30')]));_0x2f1579[_0xbe8f('0x31')]=_0x2f1579[_0xbe8f('0x31')][_0xbe8f('0x32')]?_0x2f1579[_0xbe8f('0x31')]:_0x2dd8a1[_0xbe8f('0x2b')];if(!_0x2cc82b[_0xbe8f('0x2d')][_0xbe8f('0x33')](_0xbe8f('0x34'))){_0x2f1579[_0xbe8f('0x17')]=qs[_0xbe8f('0x17')](_0x2cc82b[_0xbe8f('0x2d')]['limit']);_0x2f1579[_0xbe8f('0x1a')]=qs[_0xbe8f('0x1a')](_0x2cc82b['query']['offset']);}_0x2f1579[_0xbe8f('0x35')]=qs[_0xbe8f('0x36')](_0x2cc82b[_0xbe8f('0x2d')][_0xbe8f('0x36')]);_0x2f1579[_0xbe8f('0x37')]=qs[_0xbe8f('0x2e')](_[_0xbe8f('0x38')](_0x2cc82b[_0xbe8f('0x2d')],_0x2dd8a1[_0xbe8f('0x2e')]),_0x4bf5e6);if(_0x2cc82b[_0xbe8f('0x2d')][_0xbe8f('0x39')]){_0x2f1579[_0xbe8f('0x37')]=_[_0xbe8f('0x3a')](_0x2f1579['where'],{'$or':_[_0xbe8f('0x26')](_0x4bf5e6,function(_0x225f5f){if(_0x225f5f[_0xbe8f('0x29')]!==_0xbe8f('0x3b')){var _0x1a84f1={};_0x1a84f1[_0x225f5f[_0xbe8f('0x24')]]={'$like':'%'+_0x2cc82b[_0xbe8f('0x2d')][_0xbe8f('0x39')]+'%'};return _0x1a84f1;}})});}_0x2f1579=_[_0xbe8f('0x3a')]({},_0x2f1579,_0x2cc82b['options']);var _0x486830={'where':_0x2f1579[_0xbe8f('0x37')]};return db[_0xbe8f('0x27')][_0xbe8f('0x19')](_0x486830)[_0xbe8f('0x1e')](function(_0x5aa1ec){_0x5c5054[_0xbe8f('0x19')]=_0x5aa1ec;if(_0x2cc82b[_0xbe8f('0x2d')]['includeAll']){_0x2f1579[_0xbe8f('0x3c')]=[{'all':!![]}];}return db[_0xbe8f('0x27')]['findAll'](_0x2f1579);})['then'](function(_0x20a813){_0x5c5054[_0xbe8f('0x3d')]=_0x20a813;return _0x5c5054;})[_0xbe8f('0x1e')](respondWithFilteredResult(_0x17d840,_0x2f1579))[_0xbe8f('0x3e')](handleError(_0x17d840,null));};exports['show']=function(_0x50f956,_0x2f551a){var _0x2c7dc2={'raw':!![],'where':{'id':_0x50f956['params']['id']}},_0x48a15a={};_0x48a15a[_0xbe8f('0x2b')]=_[_0xbe8f('0x2c')](db[_0xbe8f('0x27')][_0xbe8f('0x28')]);_0x48a15a[_0xbe8f('0x2d')]=_[_0xbe8f('0x2c')](_0x50f956['query']);_0x48a15a['filters']=_[_0xbe8f('0x2f')](_0x48a15a['model'],_0x48a15a[_0xbe8f('0x2d')]);_0x2c7dc2[_0xbe8f('0x31')]=_['intersection'](_0x48a15a['model'],qs['fields'](_0x50f956[_0xbe8f('0x2d')][_0xbe8f('0x30')]));_0x2c7dc2[_0xbe8f('0x31')]=_0x2c7dc2['attributes'][_0xbe8f('0x32')]?_0x2c7dc2[_0xbe8f('0x31')]:_0x48a15a['model'];if(_0x50f956[_0xbe8f('0x2d')]['includeAll']){_0x2c7dc2['include']=[{'all':!![]}];}_0x2c7dc2=_[_0xbe8f('0x3a')]({},_0x2c7dc2,_0x50f956[_0xbe8f('0x3f')]);return db['Sound']['find'](_0x2c7dc2)['then'](handleEntityNotFound(_0x2f551a,null))['then'](respondWithResult(_0x2f551a,null))[_0xbe8f('0x3e')](handleError(_0x2f551a,null));};exports['download']=function(_0x5564c6,_0x17fbe7,_0x577af7){return db[_0xbe8f('0x27')][_0xbe8f('0x40')]({'where':{'id':_0x5564c6['params']['id']},'attributes':['name',_0xbe8f('0x41'),'converted_format'],'raw':!![]})[_0xbe8f('0x1e')](handleEntityNotFound(_0x17fbe7,null))['then'](function(_0x3cf6a2){if(_0x3cf6a2){if(!fs[_0xbe8f('0x42')](path[_0xbe8f('0x43')](config[_0xbe8f('0x44')],'server/files/sounds/converted',_0x3cf6a2[_0xbe8f('0x41')]+'.'+_0x3cf6a2[_0xbe8f('0x45')]))){throw new db['Sequelize']['ValidationError'](_0xbe8f('0x46'));}return _0x17fbe7[_0xbe8f('0x47')](path[_0xbe8f('0x43')](config[_0xbe8f('0x44')],_0xbe8f('0x48'),util[_0xbe8f('0x49')](_0xbe8f('0x4a'),_0x3cf6a2[_0xbe8f('0x41')],_0x3cf6a2[_0xbe8f('0x45')])),util[_0xbe8f('0x49')](_0xbe8f('0x4a'),_0x3cf6a2[_0xbe8f('0x24')],_0x3cf6a2[_0xbe8f('0x45')]));}return null;})[_0xbe8f('0x3e')](handleError(_0x17fbe7,null));};exports['create']=function(_0x69146d,_0x3e8814,_0xf5804c){var _0x52173a={'name':path[_0xbe8f('0x4b')](_0x69146d['file'][_0xbe8f('0x4c')],path[_0xbe8f('0x4d')](_0x69146d[_0xbe8f('0x4e')][_0xbe8f('0x4c')])),'save_name':path[_0xbe8f('0x4b')](_0x69146d[_0xbe8f('0x4e')][_0xbe8f('0x4f')],path[_0xbe8f('0x4d')](_0x69146d['file']['filename'])),'original_format':path[_0xbe8f('0x4d')](_0x69146d[_0xbe8f('0x4e')][_0xbe8f('0x4c')])[_0xbe8f('0x50')](0x1),'converted_format':_0xbe8f('0x51')};var _0x42446e=path[_0xbe8f('0x43')](config[_0xbe8f('0x44')],_0xbe8f('0x52'),_0x69146d[_0xbe8f('0x4e')][_0xbe8f('0x4f')]);var _0xdb8898=path[_0xbe8f('0x43')](config[_0xbe8f('0x44')],'server/files/sounds/converted',util[_0xbe8f('0x49')](_0xbe8f('0x4a'),path[_0xbe8f('0x4b')](_0x69146d[_0xbe8f('0x4e')][_0xbe8f('0x4f')],path['extname'](_0x69146d[_0xbe8f('0x4e')][_0xbe8f('0x4f')])),_0x52173a[_0xbe8f('0x45')]));logger[_0xbe8f('0x53')]('Sound\x20upload\x20filepath:\x20%s',_0x42446e);logger[_0xbe8f('0x53')](_0xbe8f('0x54'),_0xdb8898);try{fs['chmodSync'](_0x42446e,parseInt(_0xbe8f('0x55'),0x8));var _0x469f80=sox[_0xbe8f('0x56')](_0x42446e,_0xdb8898,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x469f80['on'](_0xbe8f('0x23'),function(_0x476f2c){fs[_0xbe8f('0x57')](_0x42446e);_0x3e8814[_0xbe8f('0x14')](0x1f4)[_0xbe8f('0x58')](_0x476f2c);});_0x469f80['on']('src',function(_0x5b351a){_0x52173a[_0xbe8f('0x59')]=isNaN(_0x5b351a[_0xbe8f('0x5a')])?null:_0x5b351a[_0xbe8f('0x5a')]*0x3e8;_0x52173a[_0xbe8f('0x5b')]=isNaN(_0x5b351a[_0xbe8f('0x5c')])?null:_0x5b351a[_0xbe8f('0x5c')];_0x52173a['original_channelCount']=isNaN(_0x5b351a['channelCount'])?null:_0x5b351a[_0xbe8f('0x5d')];_0x52173a[_0xbe8f('0x5e')]=isNaN(_0x5b351a[_0xbe8f('0x5f')])?null:_0x5b351a[_0xbe8f('0x5f')];_0x52173a[_0xbe8f('0x60')]=isNaN(_0x5b351a[_0xbe8f('0x61')])?null:_0x5b351a[_0xbe8f('0x61')];});_0x469f80['on'](_0xbe8f('0x62'),function(_0x1ed54e){_0x52173a[_0xbe8f('0x63')]=isNaN(_0x1ed54e['duration'])?null:_0x1ed54e[_0xbe8f('0x5a')]*0x3e8;_0x52173a[_0xbe8f('0x64')]=isNaN(_0x1ed54e['sampleCount'])?null:_0x1ed54e[_0xbe8f('0x5c')];_0x52173a['converted_channelCount']=isNaN(_0x1ed54e[_0xbe8f('0x5d')])?null:_0x1ed54e[_0xbe8f('0x5d')];_0x52173a['converted_bitRate']=isNaN(_0x1ed54e[_0xbe8f('0x5f')])?null:_0x1ed54e[_0xbe8f('0x5f')];_0x52173a['converted_sampleRate']=isNaN(_0x1ed54e[_0xbe8f('0x61')])?null:_0x1ed54e[_0xbe8f('0x61')];});_0x469f80['on'](_0xbe8f('0x15'),function(){fs['chmodSync'](_0xdb8898,parseInt(_0xbe8f('0x55'),0x8));return db[_0xbe8f('0x27')]['create'](_0x52173a)[_0xbe8f('0x1e')](function(_0x2ff9b9){var _0x21625d={'role':_0x69146d[_0xbe8f('0x65')][_0xbe8f('0x66')],'userProfileId':_0x69146d[_0xbe8f('0x65')][_0xbe8f('0x67')]};if(!_0x21625d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21625d[_0xbe8f('0x66')]===_0xbe8f('0x68')){var _0x3c7416=_0x2ff9b9[_0xbe8f('0x20')]({'plain':!![]});return db[_0xbe8f('0x69')][_0xbe8f('0x40')]({'where':{'name':'Sounds','userProfileId':_0x21625d[_0xbe8f('0x67')]},'raw':!![]})['then'](function(_0x1455b7){if(_0x1455b7&&_0x1455b7[_0xbe8f('0x6a')]===0x0){return db[_0xbe8f('0x22')][_0xbe8f('0x6b')]({'name':_0x3c7416[_0xbe8f('0x24')],'resourceId':_0x3c7416['id'],'type':_0x1455b7[_0xbe8f('0x24')],'sectionId':_0x1455b7['id']},{})[_0xbe8f('0x1e')](function(){return _0x2ff9b9;});}else{return _0x2ff9b9;}})[_0xbe8f('0x3e')](function(_0x5b46a9){logger[_0xbe8f('0x23')](_0xbe8f('0x6c'),_0x5b46a9);throw _0x5b46a9;});}return _0x2ff9b9;})[_0xbe8f('0x1e')](respondWithResult(_0x3e8814,null))['catch'](handleError(_0x3e8814,null));});_0x469f80[_0xbe8f('0x6d')]();}catch(_0x764a9a){_0x3e8814[_0xbe8f('0x14')](0x1f4)[_0xbe8f('0x58')](_0x764a9a);}};exports[_0xbe8f('0x1d')]=function(_0x105bb7,_0x872253,_0x322716){return db[_0xbe8f('0x27')][_0xbe8f('0x40')]({'where':{'id':_0x105bb7['params']['id']}})[_0xbe8f('0x1e')](handleEntityNotFound(_0x872253,null))[_0xbe8f('0x1e')](saveUpdates(_[_0xbe8f('0x38')](_0x105bb7[_0xbe8f('0x65')],[_0xbe8f('0x24'),'description']),null))['then'](respondWithResult(_0x872253,null))[_0xbe8f('0x3e')](handleError(_0x872253,null));};exports[_0xbe8f('0x6e')]=function(_0x3175d2,_0x477c1d,_0x245e6a){return db[_0xbe8f('0x27')][_0xbe8f('0x40')]({'where':{'id':_0x3175d2[_0xbe8f('0x6f')]['id']}})['then'](function(_0x25a616){if(_0x25a616){return _0x25a616['destroy']();}})[_0xbe8f('0x1e')](function(_0x2cd0f3){var _0x297a2d=path[_0xbe8f('0x43')](config[_0xbe8f('0x44')],_0xbe8f('0x52'),util[_0xbe8f('0x49')](_0xbe8f('0x4a'),_0x2cd0f3['save_name'],_0x2cd0f3[_0xbe8f('0x70')]));var _0x3602fe=path['join'](config[_0xbe8f('0x44')],_0xbe8f('0x48'),util[_0xbe8f('0x49')](_0xbe8f('0x4a'),_0x2cd0f3[_0xbe8f('0x41')],_0x2cd0f3['converted_format']));fs['unlinkSync'](_0x297a2d);fs['unlinkSync'](_0x3602fe);return _0x2cd0f3;})[_0xbe8f('0x1e')](function(_0x761bdf){if(_0x761bdf){return _0x477c1d[_0xbe8f('0x14')](0xcc)[_0xbe8f('0x15')]();}})[_0xbe8f('0x1e')](handleEntityNotFound(_0x477c1d,null))[_0xbe8f('0x3e')](handleError(_0x477c1d,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 99d020e..0a46d72 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 _0xe9bc=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds'];(function(_0x5507da,_0x543251){var _0x40da52=function(_0x500f80){while(--_0x500f80){_0x5507da['push'](_0x5507da['shift']());}};_0x40da52(++_0x543251);}(_0xe9bc,0xa9));var _0xce9b=function(_0x4fd31e,_0x2737da){_0x4fd31e=_0x4fd31e-0x0;var _0x34e019=_0xe9bc[_0x4fd31e];return _0x34e019;};'use strict';var _=require('lodash');var util=require(_0xce9b('0x0'));var logger=require('../../config/logger')(_0xce9b('0x1'));var moment=require(_0xce9b('0x2'));var BPromise=require(_0xce9b('0x3'));var rp=require(_0xce9b('0x4'));var fs=require('fs');var path=require(_0xce9b('0x5'));var rimraf=require(_0xce9b('0x6'));var config=require(_0xce9b('0x7'));var attributes=require(_0xce9b('0x8'));module[_0xce9b('0x9')]=function(_0x458f0b,_0x5aef81){return _0x458f0b[_0xce9b('0xa')](_0xce9b('0xb'),attributes,{'tableName':_0xce9b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2897=['bluebird','request-promise','path','./sound.attributes','exports','Sound','../../config/logger','moment'];(function(_0x536f07,_0x1a1a14){var _0xc1ac5b=function(_0x3684ae){while(--_0x3684ae){_0x536f07['push'](_0x536f07['shift']());}};_0xc1ac5b(++_0x1a1a14);}(_0x2897,0x1ce));var _0x7289=function(_0x4983d3,_0x17ea8f){_0x4983d3=_0x4983d3-0x0;var _0x3b705b=_0x2897[_0x4983d3];return _0x3b705b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7289('0x0'))('api');var moment=require(_0x7289('0x1'));var BPromise=require(_0x7289('0x2'));var rp=require(_0x7289('0x3'));var fs=require('fs');var path=require(_0x7289('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7289('0x5'));module[_0x7289('0x6')]=function(_0x299b62,_0xf4717c){return _0x299b62['define'](_0x7289('0x7'),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 53cbb20..aa24581 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 _0xe086=['raw','where','attributes','include','model','map','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','ShowSound','Sound','find','options'];(function(_0x3f4683,_0x4062f9){var _0x1a80aa=function(_0x5dea92){while(--_0x5dea92){_0x3f4683['push'](_0x3f4683['shift']());}};_0x1a80aa(++_0x4062f9);}(_0xe086,0x17a));var _0x6e08=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe086[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6e08('0x0'));var util=require('util');var moment=require(_0x6e08('0x1'));var BPromise=require(_0x6e08('0x2'));var rs=require(_0x6e08('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6e08('0x4'));var logger=require('../../config/logger')(_0x6e08('0x5'));var config=require(_0x6e08('0x6'));var jayson=require(_0x6e08('0x7'));var client=jayson[_0x6e08('0x8')][_0x6e08('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4bec1f,_0x18e3eb,_0x32dd31){return new BPromise(function(_0x8d52b1,_0x3d3274){return client[_0x6e08('0xa')](_0x4bec1f,_0x32dd31)[_0x6e08('0xb')](function(_0xe683ba){logger[_0x6e08('0xc')](_0x6e08('0xd'),_0x18e3eb,_0x6e08('0xe'));logger[_0x6e08('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x18e3eb,_0x6e08('0xe'),JSON[_0x6e08('0x10')](_0xe683ba));if(_0xe683ba[_0x6e08('0x11')]){if(_0xe683ba[_0x6e08('0x11')][_0x6e08('0x12')]===0x1f4){logger['error'](_0x6e08('0xd'),_0x18e3eb,_0xe683ba[_0x6e08('0x11')][_0x6e08('0x13')]);return _0x3d3274(_0xe683ba['error'][_0x6e08('0x13')]);}logger[_0x6e08('0x11')](_0x6e08('0xd'),_0x18e3eb,_0xe683ba[_0x6e08('0x11')][_0x6e08('0x13')]);return _0x8d52b1(_0xe683ba[_0x6e08('0x11')][_0x6e08('0x13')]);}else{logger[_0x6e08('0xc')](_0x6e08('0xd'),_0x18e3eb,_0x6e08('0xe'));_0x8d52b1(_0xe683ba['result'][_0x6e08('0x13')]);}})[_0x6e08('0x14')](function(_0xa6fb4e){logger[_0x6e08('0x11')](_0x6e08('0xd'),_0x18e3eb,_0xa6fb4e);_0x3d3274(_0xa6fb4e);});});}exports[_0x6e08('0x15')]=function(_0x3b4f76){var _0x1f3163=this;return new Promise(function(_0x1972b9,_0x196fdf){return db[_0x6e08('0x16')][_0x6e08('0x17')]({'raw':_0x3b4f76[_0x6e08('0x18')]?_0x3b4f76[_0x6e08('0x18')][_0x6e08('0x19')]===undefined?!![]:![]:!![],'where':_0x3b4f76[_0x6e08('0x18')]?_0x3b4f76['options'][_0x6e08('0x1a')]||null:null,'attributes':_0x3b4f76[_0x6e08('0x18')]?_0x3b4f76['options'][_0x6e08('0x1b')]||null:null,'include':_0x3b4f76[_0x6e08('0x18')]?_0x3b4f76[_0x6e08('0x18')][_0x6e08('0x1c')]?_['map'](_0x3b4f76['options']['include'],function(_0x3c75a3){return{'model':db[_0x3c75a3[_0x6e08('0x1d')]],'as':_0x3c75a3['as'],'attributes':_0x3c75a3['attributes'],'include':_0x3c75a3[_0x6e08('0x1c')]?_[_0x6e08('0x1e')](_0x3c75a3[_0x6e08('0x1c')],function(_0x495422){return{'model':db[_0x495422['model']],'as':_0x495422['as'],'attributes':_0x495422[_0x6e08('0x1b')],'include':_0x495422[_0x6e08('0x1c')]?_[_0x6e08('0x1e')](_0x495422['include'],function(_0x4370fa){return{'model':db[_0x4370fa[_0x6e08('0x1d')]],'as':_0x4370fa['as'],'attributes':_0x4370fa['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f4257){logger[_0x6e08('0xc')](_0x6e08('0x15'),_0x3b4f76);logger[_0x6e08('0xf')]('ShowSound',_0x3b4f76,JSON[_0x6e08('0x10')](_0x1f4257));_0x1972b9(_0x1f4257);})[_0x6e08('0x14')](function(_0x35b5b5){logger[_0x6e08('0x11')]('ShowSound',_0x35b5b5[_0x6e08('0x13')],_0x3b4f76);_0x196fdf(_0x1f3163[_0x6e08('0x11')](0x1f4,_0x35b5b5[_0x6e08('0x13')]));});});}; \ No newline at end of file +var _0x4cc3=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','info','ShowSound','Sound','find','options','where','attributes','include','model','lodash','bluebird'];(function(_0x245307,_0x12cbb9){var _0x4cf712=function(_0x1ee4af){while(--_0x1ee4af){_0x245307['push'](_0x245307['shift']());}};_0x4cf712(++_0x12cbb9);}(_0x4cc3,0x80));var _0x34cc=function(_0x3685f7,_0x7dc558){_0x3685f7=_0x3685f7-0x0;var _0x11356d=_0x4cc3[_0x3685f7];return _0x11356d;};'use strict';var _=require(_0x34cc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x34cc('0x1'));var rs=require(_0x34cc('0x2'));var fs=require('fs');var Redis=require(_0x34cc('0x3'));var db=require(_0x34cc('0x4'))['db'];var utils=require(_0x34cc('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x34cc('0x6'));var jayson=require(_0x34cc('0x7'));var client=jayson['client'][_0x34cc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc86854,_0x5e7104,_0x4a2a4c){return new BPromise(function(_0x3855b3,_0x28b6bb){return client['request'](_0xc86854,_0x4a2a4c)[_0x34cc('0x9')](function(_0x39d5df){logger['info'](_0x34cc('0xa'),_0x5e7104,_0x34cc('0xb'));logger[_0x34cc('0xc')](_0x34cc('0xd'),_0x5e7104,_0x34cc('0xb'),JSON[_0x34cc('0xe')](_0x39d5df));if(_0x39d5df[_0x34cc('0xf')]){if(_0x39d5df[_0x34cc('0xf')]['code']===0x1f4){logger[_0x34cc('0xf')]('Sound,\x20%s,\x20%s',_0x5e7104,_0x39d5df[_0x34cc('0xf')][_0x34cc('0x10')]);return _0x28b6bb(_0x39d5df[_0x34cc('0xf')]['message']);}logger[_0x34cc('0xf')](_0x34cc('0xa'),_0x5e7104,_0x39d5df['error']['message']);return _0x3855b3(_0x39d5df[_0x34cc('0xf')][_0x34cc('0x10')]);}else{logger[_0x34cc('0x11')]('Sound,\x20%s,\x20%s',_0x5e7104,_0x34cc('0xb'));_0x3855b3(_0x39d5df['result']['message']);}})['catch'](function(_0x978425){logger[_0x34cc('0xf')](_0x34cc('0xa'),_0x5e7104,_0x978425);_0x28b6bb(_0x978425);});});}exports[_0x34cc('0x12')]=function(_0x1e19f0){var _0x5ed8fd=this;return new Promise(function(_0x4a53ed,_0x3e81aa){return db[_0x34cc('0x13')][_0x34cc('0x14')]({'raw':_0x1e19f0[_0x34cc('0x15')]?_0x1e19f0[_0x34cc('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1e19f0['options']?_0x1e19f0['options'][_0x34cc('0x16')]||null:null,'attributes':_0x1e19f0[_0x34cc('0x15')]?_0x1e19f0['options'][_0x34cc('0x17')]||null:null,'include':_0x1e19f0[_0x34cc('0x15')]?_0x1e19f0[_0x34cc('0x15')][_0x34cc('0x18')]?_['map'](_0x1e19f0['options']['include'],function(_0x2edcd2){return{'model':db[_0x2edcd2[_0x34cc('0x19')]],'as':_0x2edcd2['as'],'attributes':_0x2edcd2[_0x34cc('0x17')],'include':_0x2edcd2['include']?_['map'](_0x2edcd2['include'],function(_0xec02aa){return{'model':db[_0xec02aa['model']],'as':_0xec02aa['as'],'attributes':_0xec02aa[_0x34cc('0x17')],'include':_0xec02aa[_0x34cc('0x18')]?_['map'](_0xec02aa[_0x34cc('0x18')],function(_0x49fc20){return{'model':db[_0x49fc20[_0x34cc('0x19')]],'as':_0x49fc20['as'],'attributes':_0x49fc20['attributes']};}):[]};}):[]};}):[]:[]})[_0x34cc('0x9')](function(_0x304914){logger['info'](_0x34cc('0x12'),_0x1e19f0);logger[_0x34cc('0xc')](_0x34cc('0x12'),_0x1e19f0,JSON['stringify'](_0x304914));_0x4a53ed(_0x304914);})['catch'](function(_0x434b14){logger[_0x34cc('0xf')](_0x34cc('0x12'),_0x434b14[_0x34cc('0x10')],_0x1e19f0);_0x3e81aa(_0x5ed8fd[_0x34cc('0xf')](0x1f4,_0x434b14[_0x34cc('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 21f4535..2deae71 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 _0x757a=['destroy','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete'];(function(_0x835f85,_0xa30228){var _0xfdc1b=function(_0x4e9c22){while(--_0x4e9c22){_0x835f85['push'](_0x835f85['shift']());}};_0xfdc1b(++_0xa30228);}(_0x757a,0xde));var _0xa757=function(_0x4b1890,_0x303872){_0x4b1890=_0x4b1890-0x0;var _0x26ac80=_0x757a[_0x4b1890];return _0x26ac80;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0xb')]('/',auth[_0xa757('0x9')](),controller[_0xa757('0xc')]);router['put'](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('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(_0x1dd7d8,_0x9ba9c9){var _0x81acc9=function(_0x1373b9){while(--_0x1373b9){_0x1dd7d8['push'](_0x1dd7d8['shift']());}};_0x81acc9(++_0x9ba9c9);}(_0x8603,0x190));var _0x3860=function(_0x2046b6,_0x50c86b){_0x2046b6=_0x2046b6-0x0;var _0x104ce8=_0x8603[_0x2046b6];return _0x104ce8;};'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 46dc40e..c8a2b21 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 _0x1270=['STRING','TEXT','medium','ENUM','out','sequelize','exports'];(function(_0x514229,_0x26bbd6){var _0x59d974=function(_0x580d33){while(--_0x580d33){_0x514229['push'](_0x514229['shift']());}};_0x59d974(++_0x26bbd6);}(_0x1270,0x101));var _0x0127=function(_0x1a7a32,_0x23fe68){_0x1a7a32=_0x1a7a32-0x0;var _0x5afc7c=_0x1270[_0x1a7a32];return _0x5afc7c;};'use strict';var Sequelize=require(_0x0127('0x0'));module[_0x0127('0x1')]={'uniqueid':{'type':Sequelize[_0x0127('0x2')]},'body':{'type':Sequelize[_0x0127('0x3')](_0x0127('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x0127('0x5')]('in',_0x0127('0x6')),'defaultValue':_0x0127('0x6'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x0127('0x3')]}}; \ No newline at end of file +var _0x9e58=['out','sequelize','exports','STRING','TEXT','medium','ENUM'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x9e58,0x197));var _0x89e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9e58[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x89e5('0x0'));module[_0x89e5('0x1')]={'uniqueid':{'type':Sequelize[_0x89e5('0x2')]},'body':{'type':Sequelize[_0x89e5('0x3')](_0x89e5('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x89e5('0x5')]('in',_0x89e5('0x6')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x89e5('0x2')]},'providerResponse':{'type':Sequelize[_0x89e5('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index d702f11..2199c1d 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 _0x1763=['../../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','error','stack','name','send','map','SquareMessage','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x15d1c4,_0x5a032e){var _0x481032=function(_0x19f55e){while(--_0x19f55e){_0x15d1c4['push'](_0x15d1c4['shift']());}};_0x481032(++_0x5a032e);}(_0x1763,0x128));var _0x3176=function(_0x38b744,_0x218c46){_0x38b744=_0x38b744-0x0;var _0x3028d4=_0x1763[_0x38b744];return _0x3028d4;};'use strict';var emlformat=require(_0x3176('0x0'));var rimraf=require(_0x3176('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3176('0x2'));var rp=require(_0x3176('0x3'));var moment=require(_0x3176('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3176('0x5'));var util=require(_0x3176('0x6'));var path=require(_0x3176('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3176('0x8'));var _=require('lodash');var squel=require(_0x3176('0x9'));var crypto=require(_0x3176('0xa'));var jsforce=require(_0x3176('0xb'));var deskjs=require(_0x3176('0xc'));var toCsv=require(_0x3176('0xd'));var querystring=require(_0x3176('0xe'));var Papa=require('papaparse');var Redis=require(_0x3176('0xf'));var authService=require(_0x3176('0x10'));var qs=require(_0x3176('0x11'));var as=require(_0x3176('0x12'));var hardwareService=require(_0x3176('0x13'));var logger=require(_0x3176('0x14'))(_0x3176('0x15'));var utils=require(_0x3176('0x16'));var config=require(_0x3176('0x17'));var licenseUtil=require(_0x3176('0x18'));var db=require(_0x3176('0x19'))['db'];function respondWithStatusCode(_0xb70c8a,_0x59fa58){_0x59fa58=_0x59fa58||0xcc;return function(_0x54d9bf){if(_0x54d9bf){return _0xb70c8a['sendStatus'](_0x59fa58);}return _0xb70c8a[_0x3176('0x1a')](_0x59fa58)[_0x3176('0x1b')]();};}function respondWithResult(_0x2e5472,_0x5d23ad){_0x5d23ad=_0x5d23ad||0xc8;return function(_0x1db016){if(_0x1db016){return _0x2e5472[_0x3176('0x1a')](_0x5d23ad)[_0x3176('0x1c')](_0x1db016);}};}function respondWithFilteredResult(_0x543bcb,_0x1bbb34){return function(_0x56ce53){if(_0x56ce53){var _0x205c77=typeof _0x1bbb34[_0x3176('0x1d')]===_0x3176('0x1e')&&typeof _0x1bbb34[_0x3176('0x1f')]===_0x3176('0x1e');var _0x1d828e=_0x56ce53['count'];var _0x555be6=_0x205c77?0x0:_0x1bbb34['offset'];var _0x2c7e73=_0x205c77?_0x56ce53[_0x3176('0x20')]:_0x1bbb34[_0x3176('0x1d')]+_0x1bbb34[_0x3176('0x1f')];var _0x84cf;if(_0x2c7e73>=_0x1d828e){_0x2c7e73=_0x1d828e;_0x84cf=0xc8;}else{_0x84cf=0xce;}_0x543bcb[_0x3176('0x1a')](_0x84cf);return _0x543bcb[_0x3176('0x21')](_0x3176('0x22'),_0x555be6+'-'+_0x2c7e73+'/'+_0x1d828e)[_0x3176('0x1c')](_0x56ce53);}return null;};}function patchUpdates(_0x4d1e4c){return function(_0x52749d){try{jsonpatch[_0x3176('0x23')](_0x52749d,_0x4d1e4c,!![]);}catch(_0x4cd563){return BPromise[_0x3176('0x24')](_0x4cd563);}return _0x52749d[_0x3176('0x25')]();};}function saveUpdates(_0x1a5bb1,_0x2e4177){return function(_0x44cf2e){if(_0x44cf2e){return _0x44cf2e[_0x3176('0x26')](_0x1a5bb1)[_0x3176('0x27')](function(_0x4f874d){return _0x4f874d;});}return null;};}function removeEntity(_0x27d722,_0x486e8f){return function(_0x4a63d4){if(_0x4a63d4){return _0x4a63d4[_0x3176('0x28')]()[_0x3176('0x27')](function(){_0x27d722[_0x3176('0x1a')](0xcc)[_0x3176('0x1b')]();});}};}function handleEntityNotFound(_0x55d38b,_0x10169d){return function(_0x3660aa){if(!_0x3660aa){_0x55d38b['sendStatus'](0x194);}return _0x3660aa;};}function handleError(_0x280369,_0x4e07fa){_0x4e07fa=_0x4e07fa||0x1f4;return function(_0x9e7496){logger[_0x3176('0x29')](_0x9e7496[_0x3176('0x2a')]);if(_0x9e7496[_0x3176('0x2b')]){delete _0x9e7496[_0x3176('0x2b')];}_0x280369['status'](_0x4e07fa)[_0x3176('0x2c')](_0x9e7496);};}exports['index']=function(_0x5f550f,_0x2c9142){var _0x35a903={},_0x4f00ea={},_0x3ae365={'count':0x0,'rows':[]};var _0x54742b=_[_0x3176('0x2d')](db[_0x3176('0x2e')][_0x3176('0x2f')],function(_0x157425){return{'name':_0x157425[_0x3176('0x30')],'type':_0x157425['type'][_0x3176('0x31')]};});_0x4f00ea[_0x3176('0x32')]=_[_0x3176('0x2d')](_0x54742b,_0x3176('0x2b'));_0x4f00ea[_0x3176('0x33')]=_[_0x3176('0x34')](_0x5f550f[_0x3176('0x33')]);_0x4f00ea['filters']=_[_0x3176('0x35')](_0x4f00ea[_0x3176('0x32')],_0x4f00ea['query']);_0x35a903['attributes']=_[_0x3176('0x35')](_0x4f00ea[_0x3176('0x32')],qs[_0x3176('0x36')](_0x5f550f[_0x3176('0x33')][_0x3176('0x36')]));_0x35a903['attributes']=_0x35a903[_0x3176('0x37')][_0x3176('0x38')]?_0x35a903[_0x3176('0x37')]:_0x4f00ea[_0x3176('0x32')];if(!_0x5f550f['query'][_0x3176('0x39')](_0x3176('0x3a'))){_0x35a903[_0x3176('0x1f')]=qs[_0x3176('0x1f')](_0x5f550f[_0x3176('0x33')][_0x3176('0x1f')]);_0x35a903[_0x3176('0x1d')]=qs[_0x3176('0x1d')](_0x5f550f['query'][_0x3176('0x1d')]);}_0x35a903[_0x3176('0x3b')]=qs['sort'](_0x5f550f[_0x3176('0x33')][_0x3176('0x3c')]);_0x35a903[_0x3176('0x3d')]=qs[_0x3176('0x3e')](_[_0x3176('0x3f')](_0x5f550f[_0x3176('0x33')],_0x4f00ea[_0x3176('0x3e')]),_0x54742b);if(_0x5f550f['query'][_0x3176('0x40')]){_0x35a903[_0x3176('0x3d')]=_[_0x3176('0x41')](_0x35a903[_0x3176('0x3d')],{'$or':_[_0x3176('0x2d')](_0x54742b,function(_0x9948b7){if(_0x9948b7[_0x3176('0x42')]!==_0x3176('0x43')){var _0x1cef27={};_0x1cef27[_0x9948b7[_0x3176('0x2b')]]={'$like':'%'+_0x5f550f[_0x3176('0x33')][_0x3176('0x40')]+'%'};return _0x1cef27;}})});}_0x35a903=_['merge']({},_0x35a903,_0x5f550f[_0x3176('0x44')]);var _0x4d6f98={'where':_0x35a903[_0x3176('0x3d')]};return db[_0x3176('0x2e')][_0x3176('0x20')](_0x4d6f98)[_0x3176('0x27')](function(_0x2be487){_0x3ae365[_0x3176('0x20')]=_0x2be487;if(_0x5f550f[_0x3176('0x33')][_0x3176('0x45')]){_0x35a903[_0x3176('0x46')]=[{'all':!![]}];}return db[_0x3176('0x2e')][_0x3176('0x47')](_0x35a903);})[_0x3176('0x27')](function(_0x4477f8){_0x3ae365[_0x3176('0x48')]=_0x4477f8;return _0x3ae365;})[_0x3176('0x27')](respondWithFilteredResult(_0x2c9142,_0x35a903))[_0x3176('0x49')](handleError(_0x2c9142,null));};exports[_0x3176('0x4a')]=function(_0x862e15,_0x4f82c0){var _0xe2335c={'raw':!![],'where':{'id':_0x862e15[_0x3176('0x4b')]['id']}},_0x304289={};_0x304289['model']=_['keys'](db[_0x3176('0x2e')][_0x3176('0x2f')]);_0x304289[_0x3176('0x33')]=_[_0x3176('0x34')](_0x862e15['query']);_0x304289[_0x3176('0x3e')]=_[_0x3176('0x35')](_0x304289['model'],_0x304289['query']);_0xe2335c[_0x3176('0x37')]=_[_0x3176('0x35')](_0x304289[_0x3176('0x32')],qs[_0x3176('0x36')](_0x862e15[_0x3176('0x33')]['fields']));_0xe2335c[_0x3176('0x37')]=_0xe2335c['attributes'][_0x3176('0x38')]?_0xe2335c[_0x3176('0x37')]:_0x304289[_0x3176('0x32')];if(_0x862e15[_0x3176('0x33')][_0x3176('0x45')]){_0xe2335c[_0x3176('0x46')]=[{'all':!![]}];}_0xe2335c=_['merge']({},_0xe2335c,_0x862e15['options']);return db[_0x3176('0x2e')]['find'](_0xe2335c)[_0x3176('0x27')](handleEntityNotFound(_0x4f82c0,null))['then'](respondWithResult(_0x4f82c0,null))[_0x3176('0x49')](handleError(_0x4f82c0,null));};exports[_0x3176('0x4c')]=function(_0x3bba4d,_0x3fe7ac){return db[_0x3176('0x2e')][_0x3176('0x4c')](_0x3bba4d[_0x3176('0x4d')],{})[_0x3176('0x27')](respondWithResult(_0x3fe7ac,0xc9))['catch'](handleError(_0x3fe7ac,null));};exports['update']=function(_0x325b4f,_0xe8dc84){if(_0x325b4f[_0x3176('0x4d')]['id']){delete _0x325b4f[_0x3176('0x4d')]['id'];}return db[_0x3176('0x2e')]['find']({'where':{'id':_0x325b4f[_0x3176('0x4b')]['id']}})[_0x3176('0x27')](handleEntityNotFound(_0xe8dc84,null))[_0x3176('0x27')](saveUpdates(_0x325b4f['body'],null))[_0x3176('0x27')](respondWithResult(_0xe8dc84,null))[_0x3176('0x49')](handleError(_0xe8dc84,null));};exports['destroy']=function(_0x53cd92,_0x37ecd0){return db[_0x3176('0x2e')][_0x3176('0x4e')]({'where':{'id':_0x53cd92[_0x3176('0x4b')]['id']}})['then'](handleEntityNotFound(_0x37ecd0,null))[_0x3176('0x27')](removeEntity(_0x37ecd0,null))['catch'](handleError(_0x37ecd0,null));}; \ No newline at end of file +var _0x56bd=['merge','options','includeAll','include','rows','catch','params','create','body','update','find','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../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','reject','save','then','destroy','error','stack','send','index','map','SquareMessage','rawAttributes','type','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where'];(function(_0x428caa,_0x1348f8){var _0x5b64dc=function(_0x33de3b){while(--_0x33de3b){_0x428caa['push'](_0x428caa['shift']());}};_0x5b64dc(++_0x1348f8);}(_0x56bd,0xe9));var _0xd56b=function(_0x3bf356,_0x2ce549){_0x3bf356=_0x3bf356-0x0;var _0x440f91=_0x56bd[_0x3bf356];return _0x440f91;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd56b('0x0'));var zipdir=require(_0xd56b('0x1'));var jsonpatch=require(_0xd56b('0x2'));var rp=require('request-promise');var moment=require(_0xd56b('0x3'));var BPromise=require(_0xd56b('0x4'));var Mustache=require(_0xd56b('0x5'));var util=require(_0xd56b('0x6'));var path=require('path');var sox=require(_0xd56b('0x7'));var csv=require(_0xd56b('0x8'));var ejs=require(_0xd56b('0x9'));var fs=require('fs');var fs_extra=require(_0xd56b('0xa'));var _=require(_0xd56b('0xb'));var squel=require(_0xd56b('0xc'));var crypto=require(_0xd56b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd56b('0xe'));var toCsv=require(_0xd56b('0x8'));var querystring=require(_0xd56b('0xf'));var Papa=require(_0xd56b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd56b('0x11'));var as=require(_0xd56b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd56b('0x13'))(_0xd56b('0x14'));var utils=require(_0xd56b('0x15'));var config=require(_0xd56b('0x16'));var licenseUtil=require(_0xd56b('0x17'));var db=require(_0xd56b('0x18'))['db'];function respondWithStatusCode(_0x3fb7dd,_0x35c347){_0x35c347=_0x35c347||0xcc;return function(_0x921afd){if(_0x921afd){return _0x3fb7dd[_0xd56b('0x19')](_0x35c347);}return _0x3fb7dd[_0xd56b('0x1a')](_0x35c347)[_0xd56b('0x1b')]();};}function respondWithResult(_0x286e2b,_0x104dab){_0x104dab=_0x104dab||0xc8;return function(_0x37f528){if(_0x37f528){return _0x286e2b['status'](_0x104dab)[_0xd56b('0x1c')](_0x37f528);}};}function respondWithFilteredResult(_0x5a2886,_0x174413){return function(_0x27aeee){if(_0x27aeee){var _0x3f8775=typeof _0x174413[_0xd56b('0x1d')]===_0xd56b('0x1e')&&typeof _0x174413[_0xd56b('0x1f')]===_0xd56b('0x1e');var _0x207407=_0x27aeee[_0xd56b('0x20')];var _0x180a1d=_0x3f8775?0x0:_0x174413[_0xd56b('0x1d')];var _0x5f3ea8=_0x3f8775?_0x27aeee['count']:_0x174413['offset']+_0x174413[_0xd56b('0x1f')];var _0x309f65;if(_0x5f3ea8>=_0x207407){_0x5f3ea8=_0x207407;_0x309f65=0xc8;}else{_0x309f65=0xce;}_0x5a2886[_0xd56b('0x1a')](_0x309f65);return _0x5a2886[_0xd56b('0x21')](_0xd56b('0x22'),_0x180a1d+'-'+_0x5f3ea8+'/'+_0x207407)[_0xd56b('0x1c')](_0x27aeee);}return null;};}function patchUpdates(_0x477212){return function(_0x547a7a){try{jsonpatch[_0xd56b('0x23')](_0x547a7a,_0x477212,!![]);}catch(_0x3f857e){return BPromise[_0xd56b('0x24')](_0x3f857e);}return _0x547a7a[_0xd56b('0x25')]();};}function saveUpdates(_0x276955,_0x32160b){return function(_0x5498b0){if(_0x5498b0){return _0x5498b0['update'](_0x276955)[_0xd56b('0x26')](function(_0x38d1b6){return _0x38d1b6;});}return null;};}function removeEntity(_0x5bdf89,_0x71b760){return function(_0x5c9cfe){if(_0x5c9cfe){return _0x5c9cfe[_0xd56b('0x27')]()['then'](function(){_0x5bdf89[_0xd56b('0x1a')](0xcc)[_0xd56b('0x1b')]();});}};}function handleEntityNotFound(_0x1fa34b,_0x5ab429){return function(_0x42e907){if(!_0x42e907){_0x1fa34b[_0xd56b('0x19')](0x194);}return _0x42e907;};}function handleError(_0x1e3d6d,_0x6980a8){_0x6980a8=_0x6980a8||0x1f4;return function(_0x34166c){logger[_0xd56b('0x28')](_0x34166c[_0xd56b('0x29')]);if(_0x34166c['name']){delete _0x34166c['name'];}_0x1e3d6d[_0xd56b('0x1a')](_0x6980a8)[_0xd56b('0x2a')](_0x34166c);};}exports[_0xd56b('0x2b')]=function(_0x171ca5,_0x45a45d){var _0x3c76d6={},_0x1cbb85={},_0x18dece={'count':0x0,'rows':[]};var _0x2a35e8=_[_0xd56b('0x2c')](db[_0xd56b('0x2d')][_0xd56b('0x2e')],function(_0x5f3d6c){return{'name':_0x5f3d6c['fieldName'],'type':_0x5f3d6c[_0xd56b('0x2f')]['key']};});_0x1cbb85['model']=_[_0xd56b('0x2c')](_0x2a35e8,_0xd56b('0x30'));_0x1cbb85[_0xd56b('0x31')]=_[_0xd56b('0x32')](_0x171ca5[_0xd56b('0x31')]);_0x1cbb85[_0xd56b('0x33')]=_[_0xd56b('0x34')](_0x1cbb85[_0xd56b('0x35')],_0x1cbb85['query']);_0x3c76d6[_0xd56b('0x36')]=_['intersection'](_0x1cbb85[_0xd56b('0x35')],qs[_0xd56b('0x37')](_0x171ca5[_0xd56b('0x31')][_0xd56b('0x37')]));_0x3c76d6[_0xd56b('0x36')]=_0x3c76d6['attributes'][_0xd56b('0x38')]?_0x3c76d6[_0xd56b('0x36')]:_0x1cbb85['model'];if(!_0x171ca5[_0xd56b('0x31')][_0xd56b('0x39')]('nolimit')){_0x3c76d6['limit']=qs[_0xd56b('0x1f')](_0x171ca5['query'][_0xd56b('0x1f')]);_0x3c76d6[_0xd56b('0x1d')]=qs[_0xd56b('0x1d')](_0x171ca5[_0xd56b('0x31')][_0xd56b('0x1d')]);}_0x3c76d6[_0xd56b('0x3a')]=qs['sort'](_0x171ca5[_0xd56b('0x31')][_0xd56b('0x3b')]);_0x3c76d6['where']=qs[_0xd56b('0x33')](_[_0xd56b('0x3c')](_0x171ca5[_0xd56b('0x31')],_0x1cbb85[_0xd56b('0x33')]),_0x2a35e8);if(_0x171ca5[_0xd56b('0x31')][_0xd56b('0x3d')]){_0x3c76d6[_0xd56b('0x3e')]=_['merge'](_0x3c76d6[_0xd56b('0x3e')],{'$or':_[_0xd56b('0x2c')](_0x2a35e8,function(_0x332e38){if(_0x332e38[_0xd56b('0x2f')]!=='VIRTUAL'){var _0x179bb8={};_0x179bb8[_0x332e38[_0xd56b('0x30')]]={'$like':'%'+_0x171ca5[_0xd56b('0x31')][_0xd56b('0x3d')]+'%'};return _0x179bb8;}})});}_0x3c76d6=_[_0xd56b('0x3f')]({},_0x3c76d6,_0x171ca5[_0xd56b('0x40')]);var _0xbd057={'where':_0x3c76d6[_0xd56b('0x3e')]};return db[_0xd56b('0x2d')][_0xd56b('0x20')](_0xbd057)[_0xd56b('0x26')](function(_0x19fb95){_0x18dece[_0xd56b('0x20')]=_0x19fb95;if(_0x171ca5[_0xd56b('0x31')][_0xd56b('0x41')]){_0x3c76d6[_0xd56b('0x42')]=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x3c76d6);})[_0xd56b('0x26')](function(_0x230bbc){_0x18dece[_0xd56b('0x43')]=_0x230bbc;return _0x18dece;})['then'](respondWithFilteredResult(_0x45a45d,_0x3c76d6))[_0xd56b('0x44')](handleError(_0x45a45d,null));};exports['show']=function(_0x265cad,_0x62ba88){var _0x189df6={'raw':!![],'where':{'id':_0x265cad[_0xd56b('0x45')]['id']}},_0x17e74d={};_0x17e74d['model']=_[_0xd56b('0x32')](db['SquareMessage'][_0xd56b('0x2e')]);_0x17e74d[_0xd56b('0x31')]=_[_0xd56b('0x32')](_0x265cad[_0xd56b('0x31')]);_0x17e74d[_0xd56b('0x33')]=_['intersection'](_0x17e74d[_0xd56b('0x35')],_0x17e74d[_0xd56b('0x31')]);_0x189df6['attributes']=_[_0xd56b('0x34')](_0x17e74d[_0xd56b('0x35')],qs['fields'](_0x265cad[_0xd56b('0x31')][_0xd56b('0x37')]));_0x189df6[_0xd56b('0x36')]=_0x189df6[_0xd56b('0x36')][_0xd56b('0x38')]?_0x189df6[_0xd56b('0x36')]:_0x17e74d[_0xd56b('0x35')];if(_0x265cad[_0xd56b('0x31')][_0xd56b('0x41')]){_0x189df6['include']=[{'all':!![]}];}_0x189df6=_[_0xd56b('0x3f')]({},_0x189df6,_0x265cad[_0xd56b('0x40')]);return db[_0xd56b('0x2d')]['find'](_0x189df6)[_0xd56b('0x26')](handleEntityNotFound(_0x62ba88,null))[_0xd56b('0x26')](respondWithResult(_0x62ba88,null))['catch'](handleError(_0x62ba88,null));};exports[_0xd56b('0x46')]=function(_0x1f1cfd,_0x1b2026){return db[_0xd56b('0x2d')][_0xd56b('0x46')](_0x1f1cfd[_0xd56b('0x47')],{})['then'](respondWithResult(_0x1b2026,0xc9))[_0xd56b('0x44')](handleError(_0x1b2026,null));};exports[_0xd56b('0x48')]=function(_0x2c76ec,_0x5b33f0){if(_0x2c76ec[_0xd56b('0x47')]['id']){delete _0x2c76ec[_0xd56b('0x47')]['id'];}return db[_0xd56b('0x2d')][_0xd56b('0x49')]({'where':{'id':_0x2c76ec[_0xd56b('0x45')]['id']}})['then'](handleEntityNotFound(_0x5b33f0,null))[_0xd56b('0x26')](saveUpdates(_0x2c76ec[_0xd56b('0x47')],null))[_0xd56b('0x26')](respondWithResult(_0x5b33f0,null))[_0xd56b('0x44')](handleError(_0x5b33f0,null));};exports[_0xd56b('0x27')]=function(_0x2d4349,_0x51586e){return db[_0xd56b('0x2d')][_0xd56b('0x49')]({'where':{'id':_0x2d4349[_0xd56b('0x45')]['id']}})['then'](handleEntityNotFound(_0x51586e,null))[_0xd56b('0x26')](removeEntity(_0x51586e,null))[_0xd56b('0x44')](handleError(_0x51586e,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 419a875..2eab2da 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 _0xa273=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareMessage','square_messages','lodash'];(function(_0x6cf622,_0x146e67){var _0x1887fe=function(_0xe16cbd){while(--_0xe16cbd){_0x6cf622['push'](_0x6cf622['shift']());}};_0x1887fe(++_0x146e67);}(_0xa273,0x137));var _0x3a27=function(_0x5b9db4,_0x5deb43){_0x5b9db4=_0x5b9db4-0x0;var _0x424ea8=_0xa273[_0x5b9db4];return _0x424ea8;};'use strict';var _=require(_0x3a27('0x0'));var util=require(_0x3a27('0x1'));var logger=require('../../config/logger')(_0x3a27('0x2'));var moment=require('moment');var BPromise=require(_0x3a27('0x3'));var rp=require(_0x3a27('0x4'));var fs=require('fs');var path=require(_0x3a27('0x5'));var rimraf=require(_0x3a27('0x6'));var config=require(_0x3a27('0x7'));var attributes=require('./squareMessage.attributes');module[_0x3a27('0x8')]=function(_0xa12d99,_0x333370){return _0xa12d99[_0x3a27('0x9')](_0x3a27('0xa'),attributes,{'tableName':_0x3a27('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39cc=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','define','square_messages'];(function(_0x4cb8e7,_0x2e1d22){var _0x3d0188=function(_0x6c6a39){while(--_0x6c6a39){_0x4cb8e7['push'](_0x4cb8e7['shift']());}};_0x3d0188(++_0x2e1d22);}(_0x39cc,0x105));var _0xc39c=function(_0x2c0cb4,_0xb6bcb3){_0x2c0cb4=_0x2c0cb4-0x0;var _0x80b4d5=_0x39cc[_0x2c0cb4];return _0x80b4d5;};'use strict';var _=require(_0xc39c('0x0'));var util=require(_0xc39c('0x1'));var logger=require(_0xc39c('0x2'))(_0xc39c('0x3'));var moment=require(_0xc39c('0x4'));var BPromise=require('bluebird');var rp=require(_0xc39c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc39c('0x6'));var config=require('../../config/environment');var attributes=require('./squareMessage.attributes');module['exports']=function(_0x559e1a,_0x5dc0c0){return _0x559e1a[_0xc39c('0x7')]('SquareMessage',attributes,{'tableName':_0xc39c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 0217654..6d257b3 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 _0x7628=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateSquareMessage','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x54d943,_0x184228){var _0x3c6517=function(_0x282a2e){while(--_0x282a2e){_0x54d943['push'](_0x54d943['shift']());}};_0x3c6517(++_0x184228);}(_0x7628,0x159));var _0x8762=function(_0x84305c,_0x1970cd){_0x84305c=_0x84305c-0x0;var _0x4d700f=_0x7628[_0x84305c];return _0x4d700f;};'use strict';var _=require(_0x8762('0x0'));var util=require(_0x8762('0x1'));var moment=require(_0x8762('0x2'));var BPromise=require(_0x8762('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8762('0x4'));var db=require(_0x8762('0x5'))['db'];var utils=require(_0x8762('0x6'));var logger=require(_0x8762('0x7'))(_0x8762('0x8'));var config=require(_0x8762('0x9'));var jayson=require(_0x8762('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xf4caca,_0x31d018,_0x5e570f){return new BPromise(function(_0xe49f22,_0x12fc7f){return client[_0x8762('0xb')](_0xf4caca,_0x5e570f)[_0x8762('0xc')](function(_0x2a67f1){logger[_0x8762('0xd')](_0x8762('0xe'),_0x31d018,_0x8762('0xf'));logger[_0x8762('0x10')](_0x8762('0x11'),_0x31d018,_0x8762('0xf'),JSON[_0x8762('0x12')](_0x2a67f1));if(_0x2a67f1[_0x8762('0x13')]){if(_0x2a67f1[_0x8762('0x13')]['code']===0x1f4){logger[_0x8762('0x13')](_0x8762('0xe'),_0x31d018,_0x2a67f1[_0x8762('0x13')][_0x8762('0x14')]);return _0x12fc7f(_0x2a67f1[_0x8762('0x13')]['message']);}logger[_0x8762('0x13')](_0x8762('0xe'),_0x31d018,_0x2a67f1[_0x8762('0x13')]['message']);return _0xe49f22(_0x2a67f1[_0x8762('0x13')][_0x8762('0x14')]);}else{logger[_0x8762('0xd')](_0x8762('0xe'),_0x31d018,_0x8762('0xf'));_0xe49f22(_0x2a67f1['result'][_0x8762('0x14')]);}})[_0x8762('0x15')](function(_0x289a1c){logger[_0x8762('0x13')]('SquareMessage,\x20%s,\x20%s',_0x31d018,_0x289a1c);_0x12fc7f(_0x289a1c);});});}exports[_0x8762('0x16')]=function(_0x22bcab){var _0x540fdd=this;return new Promise(function(_0xe85aa8,_0x97983f){return db['SquareMessage'][_0x8762('0x17')](_0x22bcab[_0x8762('0x18')],{'raw':_0x22bcab['options']?_0x22bcab[_0x8762('0x19')][_0x8762('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x248502){logger['info'](_0x8762('0x16'),_0x22bcab);logger['debug'](_0x8762('0x16'),_0x22bcab,JSON[_0x8762('0x12')](_0x248502));_0xe85aa8(_0x248502);})['catch'](function(_0x1aaf4e){logger[_0x8762('0x13')](_0x8762('0x16'),_0x1aaf4e[_0x8762('0x14')],_0x22bcab);_0x97983f(_0x540fdd[_0x8762('0x13')](0x1f4,_0x1aaf4e['message']));});});}; \ No newline at end of file +var _0x5037=['SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','message','SquareMessage','body','options','CreateSquareMessage','stringify','catch','lodash','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x3f0d94,_0x12aec7){var _0x4f927a=function(_0x2af8fe){while(--_0x2af8fe){_0x3f0d94['push'](_0x3f0d94['shift']());}};_0x4f927a(++_0x12aec7);}(_0x5037,0x102));var _0x7503=function(_0x394ccb,_0x25b882){_0x394ccb=_0x394ccb-0x0;var _0x2c9c1b=_0x5037[_0x394ccb];return _0x2c9c1b;};'use strict';var _=require(_0x7503('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7503('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7503('0x2'))(_0x7503('0x3'));var config=require(_0x7503('0x4'));var jayson=require(_0x7503('0x5'));var client=jayson['client'][_0x7503('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2c211f,_0x4b6237,_0x353e84){return new BPromise(function(_0x596219,_0x468750){return client['request'](_0x2c211f,_0x353e84)[_0x7503('0x7')](function(_0x28711a){logger['info'](_0x7503('0x8'),_0x4b6237,'request\x20sent');logger[_0x7503('0x9')](_0x7503('0xa'),_0x4b6237,'request\x20sent',JSON['stringify'](_0x28711a));if(_0x28711a[_0x7503('0xb')]){if(_0x28711a[_0x7503('0xb')]['code']===0x1f4){logger[_0x7503('0xb')](_0x7503('0x8'),_0x4b6237,_0x28711a[_0x7503('0xb')][_0x7503('0xc')]);return _0x468750(_0x28711a[_0x7503('0xb')]['message']);}logger[_0x7503('0xb')](_0x7503('0x8'),_0x4b6237,_0x28711a['error'][_0x7503('0xc')]);return _0x596219(_0x28711a['error'][_0x7503('0xc')]);}else{logger['info'](_0x7503('0x8'),_0x4b6237,'request\x20sent');_0x596219(_0x28711a['result']['message']);}})['catch'](function(_0x5f5d3f){logger[_0x7503('0xb')](_0x7503('0x8'),_0x4b6237,_0x5f5d3f);_0x468750(_0x5f5d3f);});});}exports['CreateSquareMessage']=function(_0x345001){var _0x3dcc10=this;return new Promise(function(_0xbf1508,_0x121328){return db[_0x7503('0xd')]['create'](_0x345001[_0x7503('0xe')],{'raw':_0x345001[_0x7503('0xf')]?_0x345001[_0x7503('0xf')]['raw']===undefined?!![]:![]:!![]})[_0x7503('0x7')](function(_0x3719bb){logger['info'](_0x7503('0x10'),_0x345001);logger[_0x7503('0x9')](_0x7503('0x10'),_0x345001,JSON[_0x7503('0x11')](_0x3719bb));_0xbf1508(_0x3719bb);})[_0x7503('0x12')](function(_0x457757){logger[_0x7503('0xb')](_0x7503('0x10'),_0x457757[_0x7503('0xc')],_0x345001);_0x121328(_0x3dcc10[_0x7503('0xb')](0x1f4,_0x457757[_0x7503('0xc')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index a824c3f..bde3581 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 _0xba46=['create','put','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','./squareOdbc.controller','get','isAuthenticated','/:id','show','/:id/test','15s','test','post'];(function(_0x5d3306,_0x6e1379){var _0x6968f7=function(_0x3f9b44){while(--_0x3f9b44){_0x5d3306['push'](_0x5d3306['shift']());}};_0x6968f7(++_0x6e1379);}(_0xba46,0xb9));var _0x6ba4=function(_0x1a4ca0,_0x50451b){_0x1a4ca0=_0x1a4ca0-0x0;var _0x52d53b=_0xba46[_0x1a4ca0];return _0x52d53b;};'use strict';var multer=require(_0x6ba4('0x0'));var util=require('util');var path=require(_0x6ba4('0x1'));var timeout=require(_0x6ba4('0x2'));var express=require(_0x6ba4('0x3'));var router=express['Router']();var fs_extra=require(_0x6ba4('0x4'));var auth=require(_0x6ba4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6ba4('0x6'));router[_0x6ba4('0x7')]('/',auth[_0x6ba4('0x8')](),controller['index']);router[_0x6ba4('0x7')](_0x6ba4('0x9'),auth[_0x6ba4('0x8')](),controller[_0x6ba4('0xa')]);router['get'](_0x6ba4('0xb'),auth[_0x6ba4('0x8')](),timeout(_0x6ba4('0xc')),controller[_0x6ba4('0xd')]);router[_0x6ba4('0xe')]('/',auth[_0x6ba4('0x8')](),controller[_0x6ba4('0xf')]);router[_0x6ba4('0x10')]('/:id',auth[_0x6ba4('0x8')](),controller[_0x6ba4('0x11')]);router[_0x6ba4('0x12')]('/:id',auth[_0x6ba4('0x8')](),controller['destroy']);module[_0x6ba4('0x13')]=router; \ No newline at end of file +var _0x976c=['create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','15s'];(function(_0x2726f0,_0x3e54eb){var _0x5917a1=function(_0x4bcfd6){while(--_0x4bcfd6){_0x2726f0['push'](_0x2726f0['shift']());}};_0x5917a1(++_0x3e54eb);}(_0x976c,0x1d5));var _0xc976=function(_0x5c866a,_0x2885e4){_0x5c866a=_0x5c866a-0x0;var _0x4b89dd=_0x976c[_0x5c866a];return _0x4b89dd;};'use strict';var multer=require(_0xc976('0x0'));var util=require(_0xc976('0x1'));var path=require(_0xc976('0x2'));var timeout=require('connect-timeout');var express=require(_0xc976('0x3'));var router=express[_0xc976('0x4')]();var fs_extra=require(_0xc976('0x5'));var auth=require(_0xc976('0x6'));var interaction=require(_0xc976('0x7'));var config=require(_0xc976('0x8'));var controller=require('./squareOdbc.controller');router[_0xc976('0x9')]('/',auth[_0xc976('0xa')](),controller[_0xc976('0xb')]);router[_0xc976('0x9')]('/:id',auth[_0xc976('0xa')](),controller[_0xc976('0xc')]);router['get']('/:id/test',auth[_0xc976('0xa')](),timeout(_0xc976('0xd')),controller['test']);router['post']('/',auth[_0xc976('0xa')](),controller[_0xc976('0xe')]);router[_0xc976('0xf')](_0xc976('0x10'),auth[_0xc976('0xa')](),controller[_0xc976('0x11')]);router[_0xc976('0x12')](_0xc976('0x10'),auth['isAuthenticated'](),controller[_0xc976('0x13')]);module[_0xc976('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 5931c4c..38a467c 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 _0x0008=['sequelize','exports','STRING','name'];(function(_0x48e8f1,_0x2b2ee9){var _0x2cd279=function(_0x5eedd6){while(--_0x5eedd6){_0x48e8f1['push'](_0x48e8f1['shift']());}};_0x2cd279(++_0x2b2ee9);}(_0x0008,0x140));var _0x8000=function(_0x4c6f44,_0x413a03){_0x4c6f44=_0x4c6f44-0x0;var _0x5ee4b9=_0x0008[_0x4c6f44];return _0x5ee4b9;};'use strict';var Sequelize=require(_0x8000('0x0'));module[_0x8000('0x1')]={'name':{'type':Sequelize[_0x8000('0x2')],'unique':_0x8000('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8000('0x2')]}}; \ No newline at end of file +var _0x7032=['sequelize','exports','STRING','name'];(function(_0xbae557,_0x42cae0){var _0xfae3e2=function(_0x3faa65){while(--_0x3faa65){_0xbae557['push'](_0xbae557['shift']());}};_0xfae3e2(++_0x42cae0);}(_0x7032,0x114));var _0x2703=function(_0x19fec1,_0x1cc62f){_0x19fec1=_0x19fec1-0x0;var _0x29cd35=_0x7032[_0x19fec1];return _0x29cd35;};'use strict';var Sequelize=require(_0x2703('0x0'));module[_0x2703('0x1')]={'name':{'type':Sequelize[_0x2703('0x2')],'unique':_0x2703('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x2703('0x2')]},'description':{'type':Sequelize[_0x2703('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 77f4c5f..4f6d866 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 _0x7192=['to-csv','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','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','ODBC','UserProfileResource','end','error','stack','name','send','map','SquareOdbc','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','get','UserProfileSection','autoAssociation','test','dsn','odbc','openSync','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x7192,0x9f));var _0x2719=function(_0x3a7f5f,_0x23dd42){_0x3a7f5f=_0x3a7f5f-0x0;var _0x305d29=_0x7192[_0x3a7f5f];return _0x305d29;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2719('0x0'));var zipdir=require(_0x2719('0x1'));var jsonpatch=require(_0x2719('0x2'));var rp=require(_0x2719('0x3'));var moment=require('moment');var BPromise=require(_0x2719('0x4'));var Mustache=require(_0x2719('0x5'));var util=require('util');var path=require(_0x2719('0x6'));var sox=require('sox');var csv=require(_0x2719('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2719('0x8'));var jsforce=require(_0x2719('0x9'));var deskjs=require(_0x2719('0xa'));var toCsv=require(_0x2719('0x7'));var querystring=require(_0x2719('0xb'));var Papa=require(_0x2719('0xc'));var Redis=require(_0x2719('0xd'));var authService=require(_0x2719('0xe'));var qs=require(_0x2719('0xf'));var as=require(_0x2719('0x10'));var hardwareService=require(_0x2719('0x11'));var logger=require(_0x2719('0x12'))('api');var utils=require(_0x2719('0x13'));var config=require(_0x2719('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2719('0x15'))['db'];function respondWithStatusCode(_0x29b072,_0x2ba4f7){_0x2ba4f7=_0x2ba4f7||0xcc;return function(_0x382e1a){if(_0x382e1a){return _0x29b072[_0x2719('0x16')](_0x2ba4f7);}return _0x29b072[_0x2719('0x17')](_0x2ba4f7)['end']();};}function respondWithResult(_0x28e519,_0x146c61){_0x146c61=_0x146c61||0xc8;return function(_0x35179e){if(_0x35179e){return _0x28e519[_0x2719('0x17')](_0x146c61)[_0x2719('0x18')](_0x35179e);}};}function respondWithFilteredResult(_0x1e71c8,_0x1658d0){return function(_0x4360b7){if(_0x4360b7){var _0x5dfec3=typeof _0x1658d0[_0x2719('0x19')]===_0x2719('0x1a')&&typeof _0x1658d0['limit']==='undefined';var _0x5d963a=_0x4360b7['count'];var _0x5e712d=_0x5dfec3?0x0:_0x1658d0[_0x2719('0x19')];var _0x54a795=_0x5dfec3?_0x4360b7[_0x2719('0x1b')]:_0x1658d0['offset']+_0x1658d0[_0x2719('0x1c')];var _0x509880;if(_0x54a795>=_0x5d963a){_0x54a795=_0x5d963a;_0x509880=0xc8;}else{_0x509880=0xce;}_0x1e71c8[_0x2719('0x17')](_0x509880);return _0x1e71c8[_0x2719('0x1d')](_0x2719('0x1e'),_0x5e712d+'-'+_0x54a795+'/'+_0x5d963a)['json'](_0x4360b7);}return null;};}function patchUpdates(_0x5ea9ba){return function(_0x50db49){try{jsonpatch[_0x2719('0x1f')](_0x50db49,_0x5ea9ba,!![]);}catch(_0x1eeaf6){return BPromise[_0x2719('0x20')](_0x1eeaf6);}return _0x50db49['save']();};}function saveUpdates(_0x45f1d7,_0x2704b6){return function(_0x21622b){if(_0x21622b){return _0x21622b[_0x2719('0x21')](_0x45f1d7)[_0x2719('0x22')](function(_0x23ebc4){return _0x23ebc4;});}return null;};}function removeEntity(_0x5dca7f,_0x493dd5){return function(_0x25e68e){if(_0x25e68e){return _0x25e68e['destroy']()[_0x2719('0x22')](function(){var _0x2e140e=_0x25e68e['get']({'plain':!![]});var _0x334378=_0x2719('0x23');return db[_0x2719('0x24')]['destroy']({'where':{'type':_0x334378,'resourceId':_0x2e140e['id']}})['then'](function(){return _0x25e68e;});})[_0x2719('0x22')](function(){_0x5dca7f[_0x2719('0x17')](0xcc)[_0x2719('0x25')]();});}};}function handleEntityNotFound(_0x11a11e,_0xa066b9){return function(_0x561427){if(!_0x561427){_0x11a11e[_0x2719('0x16')](0x194);}return _0x561427;};}function handleError(_0x546d08,_0x51d8a6){_0x51d8a6=_0x51d8a6||0x1f4;return function(_0x1d8bba){logger[_0x2719('0x26')](_0x1d8bba[_0x2719('0x27')]);if(_0x1d8bba[_0x2719('0x28')]){delete _0x1d8bba['name'];}_0x546d08[_0x2719('0x17')](_0x51d8a6)[_0x2719('0x29')](_0x1d8bba);};}exports['index']=function(_0x5b0f76,_0xac8bad){var _0x31a240={},_0x13aafe={},_0x5b47fe={'count':0x0,'rows':[]};var _0x51a9bb=_[_0x2719('0x2a')](db[_0x2719('0x2b')][_0x2719('0x2c')],function(_0x3adcc6){return{'name':_0x3adcc6[_0x2719('0x2d')],'type':_0x3adcc6[_0x2719('0x2e')][_0x2719('0x2f')]};});_0x13aafe[_0x2719('0x30')]=_[_0x2719('0x2a')](_0x51a9bb,_0x2719('0x28'));_0x13aafe['query']=_[_0x2719('0x31')](_0x5b0f76[_0x2719('0x32')]);_0x13aafe[_0x2719('0x33')]=_[_0x2719('0x34')](_0x13aafe[_0x2719('0x30')],_0x13aafe[_0x2719('0x32')]);_0x31a240['attributes']=_['intersection'](_0x13aafe[_0x2719('0x30')],qs[_0x2719('0x35')](_0x5b0f76['query']['fields']));_0x31a240['attributes']=_0x31a240[_0x2719('0x36')][_0x2719('0x37')]?_0x31a240[_0x2719('0x36')]:_0x13aafe[_0x2719('0x30')];if(!_0x5b0f76[_0x2719('0x32')][_0x2719('0x38')](_0x2719('0x39'))){_0x31a240['limit']=qs['limit'](_0x5b0f76[_0x2719('0x32')][_0x2719('0x1c')]);_0x31a240[_0x2719('0x19')]=qs[_0x2719('0x19')](_0x5b0f76[_0x2719('0x32')][_0x2719('0x19')]);}_0x31a240['order']=qs[_0x2719('0x3a')](_0x5b0f76['query'][_0x2719('0x3a')]);_0x31a240['where']=qs[_0x2719('0x33')](_['pick'](_0x5b0f76['query'],_0x13aafe[_0x2719('0x33')]),_0x51a9bb);if(_0x5b0f76[_0x2719('0x32')][_0x2719('0x3b')]){_0x31a240[_0x2719('0x3c')]=_[_0x2719('0x3d')](_0x31a240['where'],{'$or':_['map'](_0x51a9bb,function(_0xb73ab2){if(_0xb73ab2[_0x2719('0x2e')]!==_0x2719('0x3e')){var _0x1271bf={};_0x1271bf[_0xb73ab2[_0x2719('0x28')]]={'$like':'%'+_0x5b0f76['query'][_0x2719('0x3b')]+'%'};return _0x1271bf;}})});}_0x31a240=_[_0x2719('0x3d')]({},_0x31a240,_0x5b0f76[_0x2719('0x3f')]);var _0x253546={'where':_0x31a240[_0x2719('0x3c')]};return db[_0x2719('0x2b')]['count'](_0x253546)['then'](function(_0x288f2c){_0x5b47fe[_0x2719('0x1b')]=_0x288f2c;if(_0x5b0f76[_0x2719('0x32')][_0x2719('0x40')]){_0x31a240[_0x2719('0x41')]=[{'all':!![]}];}return db[_0x2719('0x2b')][_0x2719('0x42')](_0x31a240);})[_0x2719('0x22')](function(_0x131354){_0x5b47fe[_0x2719('0x43')]=_0x131354;return _0x5b47fe;})['then'](respondWithFilteredResult(_0xac8bad,_0x31a240))['catch'](handleError(_0xac8bad,null));};exports[_0x2719('0x44')]=function(_0x5b86fd,_0x549a51){var _0xacfcda={'raw':!![],'where':{'id':_0x5b86fd[_0x2719('0x45')]['id']}},_0x122b75={};_0x122b75[_0x2719('0x30')]=_[_0x2719('0x31')](db[_0x2719('0x2b')][_0x2719('0x2c')]);_0x122b75[_0x2719('0x32')]=_[_0x2719('0x31')](_0x5b86fd[_0x2719('0x32')]);_0x122b75[_0x2719('0x33')]=_[_0x2719('0x34')](_0x122b75[_0x2719('0x30')],_0x122b75[_0x2719('0x32')]);_0xacfcda[_0x2719('0x36')]=_['intersection'](_0x122b75[_0x2719('0x30')],qs['fields'](_0x5b86fd[_0x2719('0x32')]['fields']));_0xacfcda[_0x2719('0x36')]=_0xacfcda[_0x2719('0x36')]['length']?_0xacfcda['attributes']:_0x122b75[_0x2719('0x30')];if(_0x5b86fd[_0x2719('0x32')][_0x2719('0x40')]){_0xacfcda[_0x2719('0x41')]=[{'all':!![]}];}_0xacfcda=_[_0x2719('0x3d')]({},_0xacfcda,_0x5b86fd['options']);return db['SquareOdbc'][_0x2719('0x46')](_0xacfcda)['then'](handleEntityNotFound(_0x549a51,null))[_0x2719('0x22')](respondWithResult(_0x549a51,null))[_0x2719('0x47')](handleError(_0x549a51,null));};exports[_0x2719('0x48')]=function(_0x1f3496,_0x359e70){return db[_0x2719('0x2b')]['create'](_0x1f3496[_0x2719('0x49')],{})['then'](function(_0x152c81){var _0x50da80=_0x1f3496[_0x2719('0x4a')][_0x2719('0x4b')]({'plain':!![]});if(!_0x50da80)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x50da80['role']===_0x2719('0x4a')){var _0x543044=_0x152c81['get']({'plain':!![]});var _0x594d5f=_0x2719('0x23');return db[_0x2719('0x4c')][_0x2719('0x46')]({'where':{'name':_0x594d5f,'userProfileId':_0x50da80['userProfileId']},'raw':!![]})['then'](function(_0x546c57){if(_0x546c57&&_0x546c57[_0x2719('0x4d')]===0x0){return db[_0x2719('0x24')][_0x2719('0x48')]({'name':_0x543044[_0x2719('0x28')],'resourceId':_0x543044['id'],'type':_0x546c57[_0x2719('0x28')],'sectionId':_0x546c57['id']},{})['then'](function(){return _0x152c81;});}else{return _0x152c81;}})[_0x2719('0x47')](function(_0x32d620){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32d620);throw _0x32d620;});}return _0x152c81;})['then'](respondWithResult(_0x359e70,0xc9))['catch'](handleError(_0x359e70,null));};exports[_0x2719('0x21')]=function(_0x8c6b89,_0x19cae5){if(_0x8c6b89[_0x2719('0x49')]['id']){delete _0x8c6b89['body']['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x8c6b89[_0x2719('0x45')]['id']}})[_0x2719('0x22')](handleEntityNotFound(_0x19cae5,null))['then'](saveUpdates(_0x8c6b89['body'],null))[_0x2719('0x22')](respondWithResult(_0x19cae5,null))[_0x2719('0x47')](handleError(_0x19cae5,null));};exports['destroy']=function(_0x8749d6,_0x34a10c){return db[_0x2719('0x2b')][_0x2719('0x46')]({'where':{'id':_0x8749d6[_0x2719('0x45')]['id']}})[_0x2719('0x22')](handleEntityNotFound(_0x34a10c,null))['then'](removeEntity(_0x34a10c,null))[_0x2719('0x47')](handleError(_0x34a10c,null));};exports[_0x2719('0x4e')]=function(_0x4b4c93,_0x19917f,_0x746212){var _0x9060ea;return db['SquareOdbc'][_0x2719('0x46')]({'where':{'id':_0x4b4c93[_0x2719('0x45')]['id']},'attributes':['id',_0x2719('0x4f')]})[_0x2719('0x22')](handleEntityNotFound(_0x19917f,null))[_0x2719('0x22')](function(_0x3d032d){if(_0x3d032d){var _0x2ab303=require(_0x2719('0x50'))();_0x2ab303[_0x2719('0x51')](_0x3d032d[_0x2719('0x4f')]);_0x2ab303[_0x2719('0x52')]();return _0x3d032d;}})['then'](respondWithResult(_0x19917f,null))[_0x2719('0x47')](handleError(_0x19917f,null));}; \ No newline at end of file +var _0x105e=['fieldName','type','key','map','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','where','pick','merge','filter','options','SquareOdbc','includeAll','findAll','rows','show','params','rawAttributes','include','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','odbc','openSync','dsn','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','name','send','index'];(function(_0x5806c3,_0x5105d8){var _0x48ac77=function(_0x4826ec){while(--_0x4826ec){_0x5806c3['push'](_0x5806c3['shift']());}};_0x48ac77(++_0x5105d8);}(_0x105e,0xd8));var _0xe105=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x105e[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe105('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe105('0x1'));var moment=require(_0xe105('0x2'));var BPromise=require(_0xe105('0x3'));var Mustache=require(_0xe105('0x4'));var util=require(_0xe105('0x5'));var path=require(_0xe105('0x6'));var sox=require(_0xe105('0x7'));var csv=require('to-csv');var ejs=require(_0xe105('0x8'));var fs=require('fs');var fs_extra=require(_0xe105('0x9'));var _=require(_0xe105('0xa'));var squel=require(_0xe105('0xb'));var crypto=require(_0xe105('0xc'));var jsforce=require(_0xe105('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe105('0xe'));var querystring=require('querystring');var Papa=require(_0xe105('0xf'));var Redis=require(_0xe105('0x10'));var authService=require(_0xe105('0x11'));var qs=require(_0xe105('0x12'));var as=require(_0xe105('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe105('0x14'))(_0xe105('0x15'));var utils=require('../../config/utils');var config=require(_0xe105('0x16'));var licenseUtil=require(_0xe105('0x17'));var db=require(_0xe105('0x18'))['db'];function respondWithStatusCode(_0x3114ef,_0x16221f){_0x16221f=_0x16221f||0xcc;return function(_0x35bb9a){if(_0x35bb9a){return _0x3114ef[_0xe105('0x19')](_0x16221f);}return _0x3114ef[_0xe105('0x1a')](_0x16221f)[_0xe105('0x1b')]();};}function respondWithResult(_0x6b274b,_0x75f630){_0x75f630=_0x75f630||0xc8;return function(_0x2d66a4){if(_0x2d66a4){return _0x6b274b['status'](_0x75f630)[_0xe105('0x1c')](_0x2d66a4);}};}function respondWithFilteredResult(_0x1e0a22,_0x293b8c){return function(_0x4cf52d){if(_0x4cf52d){var _0x11e210=typeof _0x293b8c[_0xe105('0x1d')]==='undefined'&&typeof _0x293b8c[_0xe105('0x1e')]==='undefined';var _0x3c415c=_0x4cf52d['count'];var _0x29953f=_0x11e210?0x0:_0x293b8c[_0xe105('0x1d')];var _0x423ba5=_0x11e210?_0x4cf52d[_0xe105('0x1f')]:_0x293b8c[_0xe105('0x1d')]+_0x293b8c['limit'];var _0x31afd0;if(_0x423ba5>=_0x3c415c){_0x423ba5=_0x3c415c;_0x31afd0=0xc8;}else{_0x31afd0=0xce;}_0x1e0a22['status'](_0x31afd0);return _0x1e0a22[_0xe105('0x20')]('Content-Range',_0x29953f+'-'+_0x423ba5+'/'+_0x3c415c)[_0xe105('0x1c')](_0x4cf52d);}return null;};}function patchUpdates(_0x2a61b6){return function(_0x5cc547){try{jsonpatch[_0xe105('0x21')](_0x5cc547,_0x2a61b6,!![]);}catch(_0xae1f3d){return BPromise[_0xe105('0x22')](_0xae1f3d);}return _0x5cc547[_0xe105('0x23')]();};}function saveUpdates(_0x450983,_0x577dc9){return function(_0x5e9118){if(_0x5e9118){return _0x5e9118[_0xe105('0x24')](_0x450983)[_0xe105('0x25')](function(_0x2149a0){return _0x2149a0;});}return null;};}function removeEntity(_0x2b9203,_0x527f12){return function(_0x47013e){if(_0x47013e){return _0x47013e[_0xe105('0x26')]()[_0xe105('0x25')](function(){var _0x15ccb0=_0x47013e[_0xe105('0x27')]({'plain':!![]});var _0x14ea5c=_0xe105('0x28');return db[_0xe105('0x29')][_0xe105('0x26')]({'where':{'type':_0x14ea5c,'resourceId':_0x15ccb0['id']}})[_0xe105('0x25')](function(){return _0x47013e;});})[_0xe105('0x25')](function(){_0x2b9203[_0xe105('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x475e09,_0x50fb54){return function(_0x401350){if(!_0x401350){_0x475e09[_0xe105('0x19')](0x194);}return _0x401350;};}function handleError(_0xaa2901,_0x4fc486){_0x4fc486=_0x4fc486||0x1f4;return function(_0x331cad){logger['error'](_0x331cad['stack']);if(_0x331cad[_0xe105('0x2a')]){delete _0x331cad[_0xe105('0x2a')];}_0xaa2901[_0xe105('0x1a')](_0x4fc486)[_0xe105('0x2b')](_0x331cad);};}exports[_0xe105('0x2c')]=function(_0xfc2773,_0x49e0ef){var _0x162dda={},_0x149173={},_0x2f97bb={'count':0x0,'rows':[]};var _0x43e87c=_['map'](db['SquareOdbc']['rawAttributes'],function(_0x9fc897){return{'name':_0x9fc897[_0xe105('0x2d')],'type':_0x9fc897[_0xe105('0x2e')][_0xe105('0x2f')]};});_0x149173['model']=_[_0xe105('0x30')](_0x43e87c,_0xe105('0x2a'));_0x149173[_0xe105('0x31')]=_[_0xe105('0x32')](_0xfc2773[_0xe105('0x31')]);_0x149173[_0xe105('0x33')]=_[_0xe105('0x34')](_0x149173['model'],_0x149173[_0xe105('0x31')]);_0x162dda[_0xe105('0x35')]=_[_0xe105('0x34')](_0x149173['model'],qs[_0xe105('0x36')](_0xfc2773[_0xe105('0x31')][_0xe105('0x36')]));_0x162dda['attributes']=_0x162dda['attributes'][_0xe105('0x37')]?_0x162dda['attributes']:_0x149173[_0xe105('0x38')];if(!_0xfc2773['query'][_0xe105('0x39')](_0xe105('0x3a'))){_0x162dda[_0xe105('0x1e')]=qs[_0xe105('0x1e')](_0xfc2773['query']['limit']);_0x162dda[_0xe105('0x1d')]=qs[_0xe105('0x1d')](_0xfc2773[_0xe105('0x31')][_0xe105('0x1d')]);}_0x162dda[_0xe105('0x3b')]=qs['sort'](_0xfc2773[_0xe105('0x31')]['sort']);_0x162dda[_0xe105('0x3c')]=qs['filters'](_[_0xe105('0x3d')](_0xfc2773[_0xe105('0x31')],_0x149173[_0xe105('0x33')]),_0x43e87c);if(_0xfc2773['query']['filter']){_0x162dda[_0xe105('0x3c')]=_[_0xe105('0x3e')](_0x162dda[_0xe105('0x3c')],{'$or':_[_0xe105('0x30')](_0x43e87c,function(_0x508602){if(_0x508602[_0xe105('0x2e')]!=='VIRTUAL'){var _0x2ae1c5={};_0x2ae1c5[_0x508602[_0xe105('0x2a')]]={'$like':'%'+_0xfc2773[_0xe105('0x31')][_0xe105('0x3f')]+'%'};return _0x2ae1c5;}})});}_0x162dda=_[_0xe105('0x3e')]({},_0x162dda,_0xfc2773[_0xe105('0x40')]);var _0x3d9a5b={'where':_0x162dda[_0xe105('0x3c')]};return db[_0xe105('0x41')][_0xe105('0x1f')](_0x3d9a5b)[_0xe105('0x25')](function(_0x512ead){_0x2f97bb[_0xe105('0x1f')]=_0x512ead;if(_0xfc2773['query'][_0xe105('0x42')]){_0x162dda['include']=[{'all':!![]}];}return db[_0xe105('0x41')][_0xe105('0x43')](_0x162dda);})[_0xe105('0x25')](function(_0x4b0afc){_0x2f97bb[_0xe105('0x44')]=_0x4b0afc;return _0x2f97bb;})[_0xe105('0x25')](respondWithFilteredResult(_0x49e0ef,_0x162dda))['catch'](handleError(_0x49e0ef,null));};exports[_0xe105('0x45')]=function(_0x238a0e,_0x2ecf15){var _0x1893d0={'raw':!![],'where':{'id':_0x238a0e[_0xe105('0x46')]['id']}},_0x2c5488={};_0x2c5488[_0xe105('0x38')]=_[_0xe105('0x32')](db[_0xe105('0x41')][_0xe105('0x47')]);_0x2c5488[_0xe105('0x31')]=_[_0xe105('0x32')](_0x238a0e[_0xe105('0x31')]);_0x2c5488['filters']=_[_0xe105('0x34')](_0x2c5488[_0xe105('0x38')],_0x2c5488[_0xe105('0x31')]);_0x1893d0[_0xe105('0x35')]=_[_0xe105('0x34')](_0x2c5488[_0xe105('0x38')],qs[_0xe105('0x36')](_0x238a0e[_0xe105('0x31')][_0xe105('0x36')]));_0x1893d0[_0xe105('0x35')]=_0x1893d0['attributes']['length']?_0x1893d0['attributes']:_0x2c5488[_0xe105('0x38')];if(_0x238a0e[_0xe105('0x31')][_0xe105('0x42')]){_0x1893d0[_0xe105('0x48')]=[{'all':!![]}];}_0x1893d0=_[_0xe105('0x3e')]({},_0x1893d0,_0x238a0e[_0xe105('0x40')]);return db[_0xe105('0x41')][_0xe105('0x49')](_0x1893d0)[_0xe105('0x25')](handleEntityNotFound(_0x2ecf15,null))[_0xe105('0x25')](respondWithResult(_0x2ecf15,null))['catch'](handleError(_0x2ecf15,null));};exports[_0xe105('0x4a')]=function(_0x21c5ab,_0x34c4c7){return db['SquareOdbc'][_0xe105('0x4a')](_0x21c5ab[_0xe105('0x4b')],{})['then'](function(_0x468853){var _0x3efc4f=_0x21c5ab[_0xe105('0x4c')]['get']({'plain':!![]});if(!_0x3efc4f)throw new Error(_0xe105('0x4d'));if(_0x3efc4f[_0xe105('0x4e')]===_0xe105('0x4c')){var _0x375ff6=_0x468853['get']({'plain':!![]});var _0x3feaa2=_0xe105('0x28');return db[_0xe105('0x4f')][_0xe105('0x49')]({'where':{'name':_0x3feaa2,'userProfileId':_0x3efc4f[_0xe105('0x50')]},'raw':!![]})[_0xe105('0x25')](function(_0x36642d){if(_0x36642d&&_0x36642d[_0xe105('0x51')]===0x0){return db[_0xe105('0x29')]['create']({'name':_0x375ff6[_0xe105('0x2a')],'resourceId':_0x375ff6['id'],'type':_0x36642d[_0xe105('0x2a')],'sectionId':_0x36642d['id']},{})['then'](function(){return _0x468853;});}else{return _0x468853;}})[_0xe105('0x52')](function(_0x226154){logger['error'](_0xe105('0x53'),_0x226154);throw _0x226154;});}return _0x468853;})['then'](respondWithResult(_0x34c4c7,0xc9))[_0xe105('0x52')](handleError(_0x34c4c7,null));};exports[_0xe105('0x24')]=function(_0x2feb6a,_0x3fe2c3){if(_0x2feb6a[_0xe105('0x4b')]['id']){delete _0x2feb6a['body']['id'];}return db[_0xe105('0x41')][_0xe105('0x49')]({'where':{'id':_0x2feb6a[_0xe105('0x46')]['id']}})[_0xe105('0x25')](handleEntityNotFound(_0x3fe2c3,null))[_0xe105('0x25')](saveUpdates(_0x2feb6a[_0xe105('0x4b')],null))['then'](respondWithResult(_0x3fe2c3,null))[_0xe105('0x52')](handleError(_0x3fe2c3,null));};exports[_0xe105('0x26')]=function(_0x3e8aa4,_0xd17ea){return db[_0xe105('0x41')][_0xe105('0x49')]({'where':{'id':_0x3e8aa4[_0xe105('0x46')]['id']}})[_0xe105('0x25')](handleEntityNotFound(_0xd17ea,null))['then'](removeEntity(_0xd17ea,null))['catch'](handleError(_0xd17ea,null));};exports['test']=function(_0x527ba0,_0x5b55cd,_0x467936){var _0x538491;return db[_0xe105('0x41')][_0xe105('0x49')]({'where':{'id':_0x527ba0[_0xe105('0x46')]['id']},'attributes':['id','dsn']})[_0xe105('0x25')](handleEntityNotFound(_0x5b55cd,null))[_0xe105('0x25')](function(_0x159438){if(_0x159438){var _0x5cf9e6=require(_0xe105('0x54'))();_0x5cf9e6[_0xe105('0x55')](_0x159438[_0xe105('0x56')]);_0x5cf9e6['closeSync']();return _0x159438;}})[_0xe105('0x25')](respondWithResult(_0x5b55cd,null))['catch'](handleError(_0x5b55cd,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 5352f51..7d0ae19 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 _0xe698=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareOdbc'];(function(_0x2973f3,_0x27c38e){var _0x532f55=function(_0x105779){while(--_0x105779){_0x2973f3['push'](_0x2973f3['shift']());}};_0x532f55(++_0x27c38e);}(_0xe698,0x1ee));var _0x8e69=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe698[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x8e69('0x0'));var util=require(_0x8e69('0x1'));var logger=require(_0x8e69('0x2'))(_0x8e69('0x3'));var moment=require(_0x8e69('0x4'));var BPromise=require(_0x8e69('0x5'));var rp=require(_0x8e69('0x6'));var fs=require('fs');var path=require(_0x8e69('0x7'));var rimraf=require(_0x8e69('0x8'));var config=require(_0x8e69('0x9'));var attributes=require('./squareOdbc.attributes');module[_0x8e69('0xa')]=function(_0x3da0f3,_0x521f27){return _0x3da0f3[_0x8e69('0xb')](_0x8e69('0xc'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc62a=['rimraf','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x6de8b6,_0x2068f6){var _0xa03da9=function(_0xe1ef2a){while(--_0xe1ef2a){_0x6de8b6['push'](_0x6de8b6['shift']());}};_0xa03da9(++_0x2068f6);}(_0xc62a,0x96));var _0xac62=function(_0x5b1d35,_0x48207e){_0x5b1d35=_0x5b1d35-0x0;var _0x144135=_0xc62a[_0x5b1d35];return _0x144135;};'use strict';var _=require(_0xac62('0x0'));var util=require(_0xac62('0x1'));var logger=require(_0xac62('0x2'))(_0xac62('0x3'));var moment=require('moment');var BPromise=require(_0xac62('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xac62('0x5'));var rimraf=require(_0xac62('0x6'));var config=require('../../config/environment');var attributes=require(_0xac62('0x7'));module[_0xac62('0x8')]=function(_0x5ad7c1,_0x4ebd67){return _0x5ad7c1[_0xac62('0x9')](_0xac62('0xa'),attributes,{'tableName':_0xac62('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 2760e54..ed67465 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 _0x8eab=['request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s'];(function(_0x45ef92,_0x2522aa){var _0x393577=function(_0x22d583){while(--_0x22d583){_0x45ef92['push'](_0x45ef92['shift']());}};_0x393577(++_0x2522aa);}(_0x8eab,0xd3));var _0xb8ea=function(_0x18015b,_0x79db58){_0x18015b=_0x18015b-0x0;var _0x4b0387=_0x8eab[_0x18015b];return _0x4b0387;};'use strict';var _=require(_0xb8ea('0x0'));var util=require('util');var moment=require(_0xb8ea('0x1'));var BPromise=require(_0xb8ea('0x2'));var rs=require(_0xb8ea('0x3'));var fs=require('fs');var Redis=require(_0xb8ea('0x4'));var db=require(_0xb8ea('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb8ea('0x6'));var config=require('../../config/environment');var jayson=require(_0xb8ea('0x7'));var client=jayson[_0xb8ea('0x8')][_0xb8ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44afc0,_0x145a14,_0x140fb4){return new BPromise(function(_0x59ef3d,_0xc099cd){return client['request'](_0x44afc0,_0x140fb4)[_0xb8ea('0xa')](function(_0x3a8477){logger[_0xb8ea('0xb')](_0xb8ea('0xc'),_0x145a14,_0xb8ea('0xd'));logger[_0xb8ea('0xe')](_0xb8ea('0xf'),_0x145a14,_0xb8ea('0xd'),JSON[_0xb8ea('0x10')](_0x3a8477));if(_0x3a8477[_0xb8ea('0x11')]){if(_0x3a8477[_0xb8ea('0x11')][_0xb8ea('0x12')]===0x1f4){logger[_0xb8ea('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x145a14,_0x3a8477[_0xb8ea('0x11')]['message']);return _0xc099cd(_0x3a8477[_0xb8ea('0x11')][_0xb8ea('0x13')]);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x145a14,_0x3a8477[_0xb8ea('0x11')][_0xb8ea('0x13')]);return _0x59ef3d(_0x3a8477['error'][_0xb8ea('0x13')]);}else{logger[_0xb8ea('0xb')](_0xb8ea('0xc'),_0x145a14,'request\x20sent');_0x59ef3d(_0x3a8477[_0xb8ea('0x14')]['message']);}})[_0xb8ea('0x15')](function(_0x8b76f1){logger[_0xb8ea('0x11')](_0xb8ea('0xc'),_0x145a14,_0x8b76f1);_0xc099cd(_0x8b76f1);});});}exports[_0xb8ea('0x16')]=function(_0x3bad01){var _0x40b7da=this;return new Promise(function(_0x2c8c74,_0x28d4fe){return db[_0xb8ea('0x17')][_0xb8ea('0x18')]({'raw':_0x3bad01[_0xb8ea('0x19')]?_0x3bad01[_0xb8ea('0x19')][_0xb8ea('0x1a')]===undefined?!![]:![]:!![],'where':_0x3bad01[_0xb8ea('0x19')]?_0x3bad01['options'][_0xb8ea('0x1b')]||null:null,'attributes':_0x3bad01[_0xb8ea('0x19')]?_0x3bad01[_0xb8ea('0x19')]['attributes']||null:null,'include':_0x3bad01[_0xb8ea('0x19')]?_0x3bad01[_0xb8ea('0x19')][_0xb8ea('0x1c')]?_['map'](_0x3bad01[_0xb8ea('0x19')][_0xb8ea('0x1c')],function(_0x2371cf){return{'model':db[_0x2371cf[_0xb8ea('0x1d')]],'as':_0x2371cf['as'],'attributes':_0x2371cf[_0xb8ea('0x1e')],'include':_0x2371cf[_0xb8ea('0x1c')]?_[_0xb8ea('0x1f')](_0x2371cf[_0xb8ea('0x1c')],function(_0x17bd3d){return{'model':db[_0x17bd3d[_0xb8ea('0x1d')]],'as':_0x17bd3d['as'],'attributes':_0x17bd3d['attributes'],'include':_0x17bd3d[_0xb8ea('0x1c')]?_['map'](_0x17bd3d[_0xb8ea('0x1c')],function(_0xb90502){return{'model':db[_0xb90502[_0xb8ea('0x1d')]],'as':_0xb90502['as'],'attributes':_0xb90502[_0xb8ea('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb8ea('0xa')](function(_0xec730){logger[_0xb8ea('0xb')](_0xb8ea('0x16'),_0x3bad01);logger[_0xb8ea('0xe')](_0xb8ea('0x16'),_0x3bad01,JSON[_0xb8ea('0x10')](_0xec730));_0x2c8c74(_0xec730);})['catch'](function(_0x21c6d8){logger[_0xb8ea('0x11')](_0xb8ea('0x16'),_0x21c6d8[_0xb8ea('0x13')],_0x3bad01);_0x28d4fe(_0x40b7da[_0xb8ea('0x11')](0x1f4,_0x21c6d8[_0xb8ea('0x13')]));});});}; \ No newline at end of file +var _0xfcc1=['model','ShowSquareOdbc','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SquareOdbc','options','raw','attributes','include','map'];(function(_0x1e077c,_0x4c54ca){var _0xcf99ca=function(_0x5455c8){while(--_0x5455c8){_0x1e077c['push'](_0x1e077c['shift']());}};_0xcf99ca(++_0x4c54ca);}(_0xfcc1,0x1c2));var _0x1fcc=function(_0x5a17d6,_0x514820){_0x5a17d6=_0x5a17d6-0x0;var _0x409d71=_0xfcc1[_0x5a17d6];return _0x409d71;};'use strict';var _=require(_0x1fcc('0x0'));var util=require('util');var moment=require(_0x1fcc('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fcc('0x2'));var db=require(_0x1fcc('0x3'))['db'];var utils=require(_0x1fcc('0x4'));var logger=require(_0x1fcc('0x5'))('rpc');var config=require(_0x1fcc('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1fcc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4ed89b,_0x3fcf6b,_0x3ac097){return new BPromise(function(_0x7e78a0,_0x2b822e){return client[_0x1fcc('0x8')](_0x4ed89b,_0x3ac097)[_0x1fcc('0x9')](function(_0x5486b1){logger[_0x1fcc('0xa')](_0x1fcc('0xb'),_0x3fcf6b,_0x1fcc('0xc'));logger[_0x1fcc('0xd')](_0x1fcc('0xe'),_0x3fcf6b,'request\x20sent',JSON[_0x1fcc('0xf')](_0x5486b1));if(_0x5486b1[_0x1fcc('0x10')]){if(_0x5486b1[_0x1fcc('0x10')][_0x1fcc('0x11')]===0x1f4){logger[_0x1fcc('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x3fcf6b,_0x5486b1[_0x1fcc('0x10')][_0x1fcc('0x12')]);return _0x2b822e(_0x5486b1[_0x1fcc('0x10')][_0x1fcc('0x12')]);}logger[_0x1fcc('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x3fcf6b,_0x5486b1['error'][_0x1fcc('0x12')]);return _0x7e78a0(_0x5486b1[_0x1fcc('0x10')]['message']);}else{logger[_0x1fcc('0xa')](_0x1fcc('0xb'),_0x3fcf6b,_0x1fcc('0xc'));_0x7e78a0(_0x5486b1[_0x1fcc('0x13')]['message']);}})['catch'](function(_0x2a992e){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x3fcf6b,_0x2a992e);_0x2b822e(_0x2a992e);});});}exports['ShowSquareOdbc']=function(_0x223585){var _0x26d009=this;return new Promise(function(_0x1f202a,_0x25252f){return db[_0x1fcc('0x14')]['find']({'raw':_0x223585['options']?_0x223585[_0x1fcc('0x15')][_0x1fcc('0x16')]===undefined?!![]:![]:!![],'where':_0x223585[_0x1fcc('0x15')]?_0x223585[_0x1fcc('0x15')]['where']||null:null,'attributes':_0x223585['options']?_0x223585[_0x1fcc('0x15')][_0x1fcc('0x17')]||null:null,'include':_0x223585[_0x1fcc('0x15')]?_0x223585[_0x1fcc('0x15')][_0x1fcc('0x18')]?_[_0x1fcc('0x19')](_0x223585[_0x1fcc('0x15')][_0x1fcc('0x18')],function(_0xba9b80){return{'model':db[_0xba9b80[_0x1fcc('0x1a')]],'as':_0xba9b80['as'],'attributes':_0xba9b80[_0x1fcc('0x17')],'include':_0xba9b80[_0x1fcc('0x18')]?_[_0x1fcc('0x19')](_0xba9b80[_0x1fcc('0x18')],function(_0x142bb7){return{'model':db[_0x142bb7['model']],'as':_0x142bb7['as'],'attributes':_0x142bb7[_0x1fcc('0x17')],'include':_0x142bb7[_0x1fcc('0x18')]?_[_0x1fcc('0x19')](_0x142bb7[_0x1fcc('0x18')],function(_0xa9fff3){return{'model':db[_0xa9fff3['model']],'as':_0xa9fff3['as'],'attributes':_0xa9fff3['attributes']};}):[]};}):[]};}):[]:[]})[_0x1fcc('0x9')](function(_0x129477){logger['info']('ShowSquareOdbc',_0x223585);logger[_0x1fcc('0xd')](_0x1fcc('0x1b'),_0x223585,JSON['stringify'](_0x129477));_0x1f202a(_0x129477);})['catch'](function(_0x506734){logger[_0x1fcc('0x10')](_0x1fcc('0x1b'),_0x506734['message'],_0x223585);_0x25252f(_0x26d009['error'](0x1f4,_0x506734['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 7430191..43da9f8 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 _0x62cf=['getUsers','post','create','/:id/users','addUsers','put','update','destroy','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id'];(function(_0x4ac6e1,_0xea9701){var _0x19b379=function(_0x31db44){while(--_0x31db44){_0x4ac6e1['push'](_0x4ac6e1['shift']());}};_0x19b379(++_0xea9701);}(_0x62cf,0x81));var _0xf62c=function(_0x295978,_0x395f7a){_0x295978=_0x295978-0x0;var _0x1c936b=_0x62cf[_0x295978];return _0x1c936b;};'use strict';var multer=require(_0xf62c('0x0'));var util=require('util');var path=require(_0xf62c('0x1'));var timeout=require('connect-timeout');var express=require(_0xf62c('0x2'));var router=express[_0xf62c('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf62c('0x4'));var config=require(_0xf62c('0x5'));var controller=require(_0xf62c('0x6'));router[_0xf62c('0x7')]('/',auth[_0xf62c('0x8')](),controller[_0xf62c('0x9')]);router[_0xf62c('0x7')](_0xf62c('0xa'),auth[_0xf62c('0x8')](),controller['show']);router[_0xf62c('0x7')]('/:id/users',auth[_0xf62c('0x8')](),controller[_0xf62c('0xb')]);router[_0xf62c('0xc')]('/',auth[_0xf62c('0x8')](),controller[_0xf62c('0xd')]);router[_0xf62c('0xc')](_0xf62c('0xe'),auth[_0xf62c('0x8')](),controller[_0xf62c('0xf')]);router[_0xf62c('0x10')](_0xf62c('0xa'),auth['isAuthenticated'](),controller[_0xf62c('0x11')]);router['delete']('/:id',auth[_0xf62c('0x8')](),controller[_0xf62c('0x12')]);router['delete'](_0xf62c('0xe'),auth[_0xf62c('0x8')](),controller['removeUsers']);module[_0xf62c('0x13')]=router; \ No newline at end of file +var _0xa7b5=['/:id/users','getUsers','create','addUsers','put','update','delete','destroy','removeUsers','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show'];(function(_0x427822,_0xb0c31e){var _0x2d5ad6=function(_0x1a8c94){while(--_0x1a8c94){_0x427822['push'](_0x427822['shift']());}};_0x2d5ad6(++_0xb0c31e);}(_0xa7b5,0x15a));var _0x5a7b=function(_0x1e07d6,_0x3b0df8){_0x1e07d6=_0x1e07d6-0x0;var _0x59e5dc=_0xa7b5[_0x1e07d6];return _0x59e5dc;};'use strict';var multer=require(_0x5a7b('0x0'));var util=require('util');var path=require(_0x5a7b('0x1'));var timeout=require('connect-timeout');var express=require(_0x5a7b('0x2'));var router=express[_0x5a7b('0x3')]();var fs_extra=require(_0x5a7b('0x4'));var auth=require(_0x5a7b('0x5'));var interaction=require(_0x5a7b('0x6'));var config=require(_0x5a7b('0x7'));var controller=require(_0x5a7b('0x8'));router[_0x5a7b('0x9')]('/',auth[_0x5a7b('0xa')](),controller[_0x5a7b('0xb')]);router[_0x5a7b('0x9')](_0x5a7b('0xc'),auth[_0x5a7b('0xa')](),controller[_0x5a7b('0xd')]);router[_0x5a7b('0x9')](_0x5a7b('0xe'),auth[_0x5a7b('0xa')](),controller[_0x5a7b('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5a7b('0x10')]);router['post'](_0x5a7b('0xe'),auth[_0x5a7b('0xa')](),controller[_0x5a7b('0x11')]);router[_0x5a7b('0x12')](_0x5a7b('0xc'),auth[_0x5a7b('0xa')](),controller[_0x5a7b('0x13')]);router[_0x5a7b('0x14')](_0x5a7b('0xc'),auth[_0x5a7b('0xa')](),controller[_0x5a7b('0x15')]);router['delete'](_0x5a7b('0xe'),auth[_0x5a7b('0xa')](),controller[_0x5a7b('0x16')]);module[_0x5a7b('0x17')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 5bb75f0..8b0ce25 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 _0x66d0=['long','getDataValue','preproduction','toString','utf8','production','DATE','STRING','name','BLOB'];(function(_0x46e850,_0x4037f9){var _0x148fcd=function(_0x3795b6){while(--_0x3795b6){_0x46e850['push'](_0x46e850['shift']());}};_0x148fcd(++_0x4037f9);}(_0x66d0,0xb1));var _0x066d=function(_0x1acc2d,_0x597696){_0x1acc2d=_0x1acc2d-0x0;var _0xabfa6d=_0x66d0[_0x1acc2d];return _0xabfa6d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x066d('0x0')],'unique':_0x066d('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x066d('0x0')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x066d('0x2')](_0x066d('0x3')),'get':function(){if(this[_0x066d('0x4')](_0x066d('0x5'))){return this[_0x066d('0x4')](_0x066d('0x5'))[_0x066d('0x6')](_0x066d('0x7'));}}},'production':{'type':Sequelize[_0x066d('0x2')]('long'),'get':function(){if(this[_0x066d('0x4')](_0x066d('0x8'))){return this[_0x066d('0x4')](_0x066d('0x8'))[_0x066d('0x6')](_0x066d('0x7'));}}},'savedAt':{'type':Sequelize[_0x066d('0x9')]},'publishedAt':{'type':Sequelize[_0x066d('0x9')]}}; \ No newline at end of file +var _0xc0b1=['TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize','exports','STRING','name'];(function(_0x22dac7,_0x45d32a){var _0x3e6cfa=function(_0x4c2e9d){while(--_0x4c2e9d){_0x22dac7['push'](_0x22dac7['shift']());}};_0x3e6cfa(++_0x45d32a);}(_0xc0b1,0x127));var _0x1c0b=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xc0b1[_0xae7c2f];return _0x5d7001;};'use strict';var Sequelize=require(_0x1c0b('0x0'));module[_0x1c0b('0x1')]={'name':{'type':Sequelize[_0x1c0b('0x2')],'unique':_0x1c0b('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x1c0b('0x2')]},'notes':{'type':Sequelize[_0x1c0b('0x4')]},'preproduction':{'type':Sequelize[_0x1c0b('0x5')](_0x1c0b('0x6')),'get':function(){if(this[_0x1c0b('0x7')](_0x1c0b('0x8'))){return this[_0x1c0b('0x7')](_0x1c0b('0x8'))[_0x1c0b('0x9')](_0x1c0b('0xa'));}}},'production':{'type':Sequelize[_0x1c0b('0x5')]('long'),'get':function(){if(this[_0x1c0b('0x7')]('production')){return this[_0x1c0b('0x7')](_0x1c0b('0xb'))[_0x1c0b('0x9')](_0x1c0b('0xa'));}}},'savedAt':{'type':Sequelize[_0x1c0b('0xc')]},'publishedAt':{'type':Sequelize[_0x1c0b('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index af7209a..33fa889 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 _0xcd17=['json','apply','reject','save','update','destroy','then','get','SquareProjects','UserProfileResource','end','error','name','index','map','SquareProject','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','emit','userSquareProject:remove','findOne','User','order','getUsers','nolimit','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','undefined','limit','count','offset','set','Content-Range'];(function(_0x3f7cdc,_0x40e6ad){var _0x5b978a=function(_0x5c3501){while(--_0x5c3501){_0x3f7cdc['push'](_0x3f7cdc['shift']());}};_0x5b978a(++_0x40e6ad);}(_0xcd17,0x103));var _0x7cd1=function(_0xa1507e,_0x51cf97){_0xa1507e=_0xa1507e-0x0;var _0x506571=_0xcd17[_0xa1507e];return _0x506571;};'use strict';var emlformat=require(_0x7cd1('0x0'));var rimraf=require(_0x7cd1('0x1'));var zipdir=require(_0x7cd1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7cd1('0x3'));var moment=require(_0x7cd1('0x4'));var BPromise=require(_0x7cd1('0x5'));var Mustache=require(_0x7cd1('0x6'));var util=require('util');var path=require(_0x7cd1('0x7'));var sox=require('sox');var csv=require(_0x7cd1('0x8'));var ejs=require(_0x7cd1('0x9'));var fs=require('fs');var fs_extra=require(_0x7cd1('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7cd1('0xb'));var jsforce=require(_0x7cd1('0xc'));var deskjs=require(_0x7cd1('0xd'));var toCsv=require(_0x7cd1('0x8'));var querystring=require('querystring');var Papa=require(_0x7cd1('0xe'));var Redis=require(_0x7cd1('0xf'));var authService=require(_0x7cd1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7cd1('0x11'));var hardwareService=require(_0x7cd1('0x12'));var logger=require(_0x7cd1('0x13'))(_0x7cd1('0x14'));var utils=require(_0x7cd1('0x15'));var config=require(_0x7cd1('0x16'));var licenseUtil=require(_0x7cd1('0x17'));var db=require(_0x7cd1('0x18'))['db'];config[_0x7cd1('0x19')]=_[_0x7cd1('0x1a')](config[_0x7cd1('0x19')],{'host':_0x7cd1('0x1b'),'port':0x18eb});var socket=require(_0x7cd1('0x1c'))(new Redis(config['redis']));require('./squareProject.socket')[_0x7cd1('0x1d')](socket);function respondWithStatusCode(_0x5b7458,_0x3fc533){_0x3fc533=_0x3fc533||0xcc;return function(_0x4fc555){if(_0x4fc555){return _0x5b7458[_0x7cd1('0x1e')](_0x3fc533);}return _0x5b7458[_0x7cd1('0x1f')](_0x3fc533)['end']();};}function respondWithResult(_0xb46175,_0x58ac57){_0x58ac57=_0x58ac57||0xc8;return function(_0x18536e){if(_0x18536e){return _0xb46175['status'](_0x58ac57)['json'](_0x18536e);}};}function respondWithFilteredResult(_0x49eb84,_0x2e8114){return function(_0x29158e){if(_0x29158e){var _0x5233ae=typeof _0x2e8114['offset']===_0x7cd1('0x20')&&typeof _0x2e8114[_0x7cd1('0x21')]===_0x7cd1('0x20');var _0xf96f79=_0x29158e[_0x7cd1('0x22')];var _0x5bb723=_0x5233ae?0x0:_0x2e8114[_0x7cd1('0x23')];var _0x5d8288=_0x5233ae?_0x29158e['count']:_0x2e8114[_0x7cd1('0x23')]+_0x2e8114['limit'];var _0x5d4eb8;if(_0x5d8288>=_0xf96f79){_0x5d8288=_0xf96f79;_0x5d4eb8=0xc8;}else{_0x5d4eb8=0xce;}_0x49eb84[_0x7cd1('0x1f')](_0x5d4eb8);return _0x49eb84[_0x7cd1('0x24')](_0x7cd1('0x25'),_0x5bb723+'-'+_0x5d8288+'/'+_0xf96f79)[_0x7cd1('0x26')](_0x29158e);}return null;};}function patchUpdates(_0x4feb1c){return function(_0x534e97){try{jsonpatch[_0x7cd1('0x27')](_0x534e97,_0x4feb1c,!![]);}catch(_0x2c8eb9){return BPromise[_0x7cd1('0x28')](_0x2c8eb9);}return _0x534e97[_0x7cd1('0x29')]();};}function saveUpdates(_0x31b1f6,_0x372856){return function(_0x5c541c){if(_0x5c541c){return _0x5c541c[_0x7cd1('0x2a')](_0x31b1f6)['then'](function(_0x108088){return _0x108088;});}return null;};}function removeEntity(_0x4583be,_0x2a0fbf){return function(_0x306a8d){if(_0x306a8d){return _0x306a8d[_0x7cd1('0x2b')]()[_0x7cd1('0x2c')](function(){var _0x33a5b3=_0x306a8d[_0x7cd1('0x2d')]({'plain':!![]});var _0x41ddb5=_0x7cd1('0x2e');return db[_0x7cd1('0x2f')]['destroy']({'where':{'type':_0x41ddb5,'resourceId':_0x33a5b3['id']}})[_0x7cd1('0x2c')](function(){return _0x306a8d;});})[_0x7cd1('0x2c')](function(){_0x4583be[_0x7cd1('0x1f')](0xcc)[_0x7cd1('0x30')]();});}};}function handleEntityNotFound(_0x9dddf0,_0x3d7d2f){return function(_0x316ed1){if(!_0x316ed1){_0x9dddf0[_0x7cd1('0x1e')](0x194);}return _0x316ed1;};}function handleError(_0x3fb910,_0x4d776b){_0x4d776b=_0x4d776b||0x1f4;return function(_0x1ec5bc){logger[_0x7cd1('0x31')](_0x1ec5bc['stack']);if(_0x1ec5bc[_0x7cd1('0x32')]){delete _0x1ec5bc[_0x7cd1('0x32')];}_0x3fb910[_0x7cd1('0x1f')](_0x4d776b)['send'](_0x1ec5bc);};}exports[_0x7cd1('0x33')]=function(_0x2d83e0,_0x3ef065){var _0x2a1fec={},_0x3b2ad6={},_0x150cbe={'count':0x0,'rows':[]};var _0x255997=_[_0x7cd1('0x34')](db[_0x7cd1('0x35')][_0x7cd1('0x36')],function(_0x494327){return{'name':_0x494327[_0x7cd1('0x37')],'type':_0x494327['type'][_0x7cd1('0x38')]};});_0x3b2ad6[_0x7cd1('0x39')]=_[_0x7cd1('0x34')](_0x255997,'name');_0x3b2ad6['query']=_['keys'](_0x2d83e0[_0x7cd1('0x3a')]);_0x3b2ad6[_0x7cd1('0x3b')]=_['intersection'](_0x3b2ad6[_0x7cd1('0x39')],_0x3b2ad6[_0x7cd1('0x3a')]);_0x2a1fec['attributes']=_[_0x7cd1('0x3c')](_0x3b2ad6[_0x7cd1('0x39')],qs[_0x7cd1('0x3d')](_0x2d83e0['query']['fields']));_0x2a1fec[_0x7cd1('0x3e')]=_0x2a1fec['attributes']['length']?_0x2a1fec['attributes']:_0x3b2ad6[_0x7cd1('0x39')];if(!_0x2d83e0['query'][_0x7cd1('0x3f')]('nolimit')){_0x2a1fec[_0x7cd1('0x21')]=qs[_0x7cd1('0x21')](_0x2d83e0['query'][_0x7cd1('0x21')]);_0x2a1fec[_0x7cd1('0x23')]=qs['offset'](_0x2d83e0[_0x7cd1('0x3a')][_0x7cd1('0x23')]);}_0x2a1fec['order']=qs[_0x7cd1('0x40')](_0x2d83e0['query'][_0x7cd1('0x40')]);_0x2a1fec['where']=qs[_0x7cd1('0x3b')](_[_0x7cd1('0x41')](_0x2d83e0[_0x7cd1('0x3a')],_0x3b2ad6[_0x7cd1('0x3b')]),_0x255997);if(_0x2d83e0[_0x7cd1('0x3a')][_0x7cd1('0x42')]){_0x2a1fec[_0x7cd1('0x43')]=_['merge'](_0x2a1fec[_0x7cd1('0x43')],{'$or':_[_0x7cd1('0x34')](_0x255997,function(_0x1e6a28){if(_0x1e6a28[_0x7cd1('0x44')]!==_0x7cd1('0x45')){var _0x1d29ec={};_0x1d29ec[_0x1e6a28['name']]={'$like':'%'+_0x2d83e0[_0x7cd1('0x3a')]['filter']+'%'};return _0x1d29ec;}})});}_0x2a1fec=_[_0x7cd1('0x46')]({},_0x2a1fec,_0x2d83e0[_0x7cd1('0x47')]);var _0x42f8e5={'where':_0x2a1fec[_0x7cd1('0x43')]};return db[_0x7cd1('0x35')][_0x7cd1('0x22')](_0x42f8e5)[_0x7cd1('0x2c')](function(_0xccc148){_0x150cbe['count']=_0xccc148;if(_0x2d83e0[_0x7cd1('0x3a')][_0x7cd1('0x48')]){_0x2a1fec[_0x7cd1('0x49')]=[{'all':!![]}];}return db['SquareProject'][_0x7cd1('0x4a')](_0x2a1fec);})['then'](function(_0xf8e332){_0x150cbe['rows']=_0xf8e332;return _0x150cbe;})[_0x7cd1('0x2c')](respondWithFilteredResult(_0x3ef065,_0x2a1fec))[_0x7cd1('0x4b')](handleError(_0x3ef065,null));};exports[_0x7cd1('0x4c')]=function(_0x4fa874,_0x4d395a){var _0x5e4ca7={'raw':![],'where':{'id':_0x4fa874[_0x7cd1('0x4d')]['id']}},_0x569caf={};_0x569caf[_0x7cd1('0x39')]=_[_0x7cd1('0x4e')](db[_0x7cd1('0x35')][_0x7cd1('0x36')]);_0x569caf['query']=_[_0x7cd1('0x4e')](_0x4fa874['query']);_0x569caf[_0x7cd1('0x3b')]=_[_0x7cd1('0x3c')](_0x569caf[_0x7cd1('0x39')],_0x569caf[_0x7cd1('0x3a')]);_0x5e4ca7['attributes']=_['intersection'](_0x569caf[_0x7cd1('0x39')],qs[_0x7cd1('0x3d')](_0x4fa874[_0x7cd1('0x3a')][_0x7cd1('0x3d')]));_0x5e4ca7[_0x7cd1('0x3e')]=_0x5e4ca7[_0x7cd1('0x3e')][_0x7cd1('0x4f')]?_0x5e4ca7[_0x7cd1('0x3e')]:_0x569caf[_0x7cd1('0x39')];if(_0x4fa874['query']['includeAll']){_0x5e4ca7[_0x7cd1('0x49')]=[{'all':!![]}];}_0x5e4ca7=_['merge']({},_0x5e4ca7,_0x4fa874[_0x7cd1('0x47')]);return db[_0x7cd1('0x35')][_0x7cd1('0x50')](_0x5e4ca7)[_0x7cd1('0x2c')](handleEntityNotFound(_0x4d395a,null))['then'](respondWithResult(_0x4d395a,null))[_0x7cd1('0x4b')](handleError(_0x4d395a,null));};exports[_0x7cd1('0x51')]=function(_0x5d31a4,_0x4d9666){return db[_0x7cd1('0x35')][_0x7cd1('0x51')](_0x5d31a4[_0x7cd1('0x52')],{})['then'](function(_0xb2471f){var _0x1044e8=_0x5d31a4[_0x7cd1('0x53')][_0x7cd1('0x2d')]({'plain':!![]});if(!_0x1044e8)throw new Error(_0x7cd1('0x54'));if(_0x1044e8['role']===_0x7cd1('0x53')){var _0x436f66=_0xb2471f[_0x7cd1('0x2d')]({'plain':!![]});var _0x139a05=_0x7cd1('0x2e');return db[_0x7cd1('0x55')][_0x7cd1('0x50')]({'where':{'name':_0x139a05,'userProfileId':_0x1044e8['userProfileId']},'raw':!![]})[_0x7cd1('0x2c')](function(_0x4966b8){if(_0x4966b8&&_0x4966b8[_0x7cd1('0x56')]===0x0){return db[_0x7cd1('0x2f')]['create']({'name':_0x436f66[_0x7cd1('0x32')],'resourceId':_0x436f66['id'],'type':_0x4966b8['name'],'sectionId':_0x4966b8['id']},{})[_0x7cd1('0x2c')](function(){return _0xb2471f;});}else{return _0xb2471f;}})[_0x7cd1('0x4b')](function(_0xd936c9){logger[_0x7cd1('0x31')](_0x7cd1('0x57'),_0xd936c9);throw _0xd936c9;});}return _0xb2471f;})['then'](respondWithResult(_0x4d9666,0xc9))[_0x7cd1('0x4b')](handleError(_0x4d9666,null));};exports['update']=function(_0x1d6acb,_0x4ac474){if(_0x1d6acb[_0x7cd1('0x52')]['id']){delete _0x1d6acb[_0x7cd1('0x52')]['id'];}return db['SquareProject'][_0x7cd1('0x50')]({'where':{'id':_0x1d6acb[_0x7cd1('0x4d')]['id']}})[_0x7cd1('0x2c')](handleEntityNotFound(_0x4ac474,null))[_0x7cd1('0x2c')](saveUpdates(_0x1d6acb[_0x7cd1('0x52')],null))[_0x7cd1('0x2c')](respondWithResult(_0x4ac474,null))[_0x7cd1('0x4b')](handleError(_0x4ac474,null));};exports[_0x7cd1('0x2b')]=function(_0x9578db,_0x24c0bd){return db[_0x7cd1('0x35')]['find']({'where':{'id':_0x9578db[_0x7cd1('0x4d')]['id']}})[_0x7cd1('0x2c')](handleEntityNotFound(_0x24c0bd,null))[_0x7cd1('0x2c')](removeEntity(_0x24c0bd,null))[_0x7cd1('0x4b')](handleError(_0x24c0bd,null));};exports[_0x7cd1('0x58')]=function(_0x205dab,_0x2f9683,_0x1e2c85){return db[_0x7cd1('0x35')][_0x7cd1('0x50')]({'where':{'id':_0x205dab[_0x7cd1('0x4d')]['id']}})[_0x7cd1('0x2c')](handleEntityNotFound(_0x2f9683,null))[_0x7cd1('0x2c')](function(_0x5d7b7c){if(_0x5d7b7c){return _0x5d7b7c[_0x7cd1('0x58')](_0x205dab[_0x7cd1('0x52')][_0x7cd1('0x59')],_[_0x7cd1('0x5a')](_0x205dab[_0x7cd1('0x52')],[_0x7cd1('0x59'),'id'])||{});}})[_0x7cd1('0x2c')](respondWithResult(_0x2f9683,null))[_0x7cd1('0x4b')](handleError(_0x2f9683,null));};exports[_0x7cd1('0x5b')]=function(_0x4f1ae7,_0xb8fa96,_0xd3e47){return db[_0x7cd1('0x35')][_0x7cd1('0x50')]({'where':{'id':_0x4f1ae7['params']['id']}})[_0x7cd1('0x2c')](handleEntityNotFound(_0xb8fa96,null))[_0x7cd1('0x2c')](function(_0x585542){if(_0x585542){return _0x585542[_0x7cd1('0x5b')](_0x4f1ae7[_0x7cd1('0x3a')]['ids'])[_0x7cd1('0x2c')](function(){if(_['isArray'](_0x4f1ae7[_0x7cd1('0x3a')]['ids'])){for(var _0x2dd267=0x0;_0x2dd267<_0x4f1ae7['query']['ids'][_0x7cd1('0x4f')];_0x2dd267+=0x1){socket[_0x7cd1('0x5c')](_0x7cd1('0x5d'),{'UserId':Number(_0x4f1ae7[_0x7cd1('0x3a')][_0x7cd1('0x59')][_0x2dd267]),'SquareProjectId':Number(_0x4f1ae7[_0x7cd1('0x4d')]['id'])});}}else{socket[_0x7cd1('0x5c')](_0x7cd1('0x5d'),{'UserId':Number(_0x4f1ae7[_0x7cd1('0x3a')]['ids']),'SquareProjectId':Number(_0x4f1ae7[_0x7cd1('0x4d')]['id'])});}});}})[_0x7cd1('0x2c')](respondWithStatusCode(_0xb8fa96,null))[_0x7cd1('0x4b')](handleError(_0xb8fa96,null));};exports['getUsers']=function(_0x2aee8c,_0x55c435,_0xaec031){var _0x1270b1={};var _0x5a51c7={};var _0x280400;var _0x4a3fe3;return db[_0x7cd1('0x35')][_0x7cd1('0x5e')]({'where':{'id':_0x2aee8c['params']['id']}})['then'](handleEntityNotFound(_0x55c435,null))[_0x7cd1('0x2c')](function(_0x234683){if(_0x234683){_0x280400=_0x234683;_0x5a51c7[_0x7cd1('0x39')]=_[_0x7cd1('0x4e')](db[_0x7cd1('0x5f')][_0x7cd1('0x36')]);_0x5a51c7[_0x7cd1('0x3a')]=_['keys'](_0x2aee8c[_0x7cd1('0x3a')]);_0x5a51c7[_0x7cd1('0x3b')]=_['intersection'](_0x5a51c7['model'],_0x5a51c7['query']);_0x1270b1['attributes']=_[_0x7cd1('0x3c')](_0x5a51c7[_0x7cd1('0x39')],qs['fields'](_0x2aee8c['query'][_0x7cd1('0x3d')]));_0x1270b1[_0x7cd1('0x3e')]=_0x1270b1[_0x7cd1('0x3e')][_0x7cd1('0x4f')]?_0x1270b1[_0x7cd1('0x3e')]:_0x5a51c7[_0x7cd1('0x39')];_0x1270b1[_0x7cd1('0x60')]=qs['sort'](_0x2aee8c[_0x7cd1('0x3a')][_0x7cd1('0x40')]);_0x1270b1[_0x7cd1('0x43')]=qs[_0x7cd1('0x3b')](_[_0x7cd1('0x41')](_0x2aee8c[_0x7cd1('0x3a')],_0x5a51c7['filters']));if(_0x2aee8c[_0x7cd1('0x3a')][_0x7cd1('0x42')]){_0x1270b1['where']=_[_0x7cd1('0x46')](_0x1270b1[_0x7cd1('0x43')],{'$or':_['map'](_0x1270b1[_0x7cd1('0x3e')],function(_0x5d3c5f){var _0x49f77b={};_0x49f77b[_0x5d3c5f]={'$like':'%'+_0x2aee8c[_0x7cd1('0x3a')][_0x7cd1('0x42')]+'%'};return _0x49f77b;})});}_0x1270b1=_[_0x7cd1('0x46')]({},_0x1270b1,_0x2aee8c[_0x7cd1('0x47')]);return _0x280400[_0x7cd1('0x61')](_0x1270b1);}})['then'](function(_0x4b0fd8){if(_0x4b0fd8){_0x4a3fe3=_0x4b0fd8[_0x7cd1('0x4f')];if(!_0x2aee8c[_0x7cd1('0x3a')][_0x7cd1('0x3f')](_0x7cd1('0x62'))){_0x1270b1[_0x7cd1('0x21')]=qs[_0x7cd1('0x21')](_0x2aee8c[_0x7cd1('0x3a')][_0x7cd1('0x21')]);_0x1270b1[_0x7cd1('0x23')]=qs[_0x7cd1('0x23')](_0x2aee8c[_0x7cd1('0x3a')][_0x7cd1('0x23')]);}return _0x280400[_0x7cd1('0x61')](_0x1270b1);}})[_0x7cd1('0x2c')](function(_0x1c7403){if(_0x1c7403){return _0x1c7403?{'count':_0x4a3fe3,'rows':_0x1c7403}:null;}})[_0x7cd1('0x2c')](respondWithResult(_0x55c435,null))[_0x7cd1('0x4b')](handleError(_0x55c435,null));}; \ No newline at end of file +var _0x71ac=['set','apply','reject','save','update','destroy','then','SquareProjects','UserProfileResource','sendStatus','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addUsers','ids','length','emit','getUsers','findOne','User','nolimit','rimraf','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./squareProject.socket','end','status','json','offset','undefined','limit','count'];(function(_0x4cab29,_0x455bcf){var _0x2589c9=function(_0x4df1ee){while(--_0x4df1ee){_0x4cab29['push'](_0x4cab29['shift']());}};_0x2589c9(++_0x455bcf);}(_0x71ac,0xef));var _0xc71a=function(_0x5b6cf1,_0x32fdcd){_0x5b6cf1=_0x5b6cf1-0x0;var _0x46278c=_0x71ac[_0x5b6cf1];return _0x46278c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc71a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc71a('0x1'));var Mustache=require(_0xc71a('0x2'));var util=require(_0xc71a('0x3'));var path=require(_0xc71a('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc71a('0x5'));var fs=require('fs');var fs_extra=require(_0xc71a('0x6'));var _=require(_0xc71a('0x7'));var squel=require(_0xc71a('0x8'));var crypto=require(_0xc71a('0x9'));var jsforce=require(_0xc71a('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xc71a('0xb'));var querystring=require(_0xc71a('0xc'));var Papa=require(_0xc71a('0xd'));var Redis=require(_0xc71a('0xe'));var authService=require(_0xc71a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc71a('0x10'));var hardwareService=require(_0xc71a('0x11'));var logger=require(_0xc71a('0x12'))('api');var utils=require(_0xc71a('0x13'));var config=require(_0xc71a('0x14'));var licenseUtil=require(_0xc71a('0x15'));var db=require(_0xc71a('0x16'))['db'];config[_0xc71a('0x17')]=_[_0xc71a('0x18')](config[_0xc71a('0x17')],{'host':_0xc71a('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc71a('0x1a'))['register'](socket);function respondWithStatusCode(_0x56d0ec,_0x12388c){_0x12388c=_0x12388c||0xcc;return function(_0x2103bd){if(_0x2103bd){return _0x56d0ec['sendStatus'](_0x12388c);}return _0x56d0ec['status'](_0x12388c)[_0xc71a('0x1b')]();};}function respondWithResult(_0x11dde1,_0x20e261){_0x20e261=_0x20e261||0xc8;return function(_0x1d721b){if(_0x1d721b){return _0x11dde1[_0xc71a('0x1c')](_0x20e261)[_0xc71a('0x1d')](_0x1d721b);}};}function respondWithFilteredResult(_0x4d2fc5,_0x3c1db1){return function(_0x2a6000){if(_0x2a6000){var _0x4574d4=typeof _0x3c1db1[_0xc71a('0x1e')]===_0xc71a('0x1f')&&typeof _0x3c1db1[_0xc71a('0x20')]==='undefined';var _0xbe4f55=_0x2a6000[_0xc71a('0x21')];var _0x1578b9=_0x4574d4?0x0:_0x3c1db1[_0xc71a('0x1e')];var _0xadc06b=_0x4574d4?_0x2a6000[_0xc71a('0x21')]:_0x3c1db1[_0xc71a('0x1e')]+_0x3c1db1[_0xc71a('0x20')];var _0x5be09b;if(_0xadc06b>=_0xbe4f55){_0xadc06b=_0xbe4f55;_0x5be09b=0xc8;}else{_0x5be09b=0xce;}_0x4d2fc5[_0xc71a('0x1c')](_0x5be09b);return _0x4d2fc5[_0xc71a('0x22')]('Content-Range',_0x1578b9+'-'+_0xadc06b+'/'+_0xbe4f55)[_0xc71a('0x1d')](_0x2a6000);}return null;};}function patchUpdates(_0x45f861){return function(_0x580ab7){try{jsonpatch[_0xc71a('0x23')](_0x580ab7,_0x45f861,!![]);}catch(_0x2a3e00){return BPromise[_0xc71a('0x24')](_0x2a3e00);}return _0x580ab7[_0xc71a('0x25')]();};}function saveUpdates(_0x1dae9c,_0x5ed037){return function(_0x3d6392){if(_0x3d6392){return _0x3d6392[_0xc71a('0x26')](_0x1dae9c)['then'](function(_0x3d27d8){return _0x3d27d8;});}return null;};}function removeEntity(_0x3ee417,_0x482b30){return function(_0x1af2f9){if(_0x1af2f9){return _0x1af2f9[_0xc71a('0x27')]()[_0xc71a('0x28')](function(){var _0x6dcbcf=_0x1af2f9['get']({'plain':!![]});var _0x5fc7ad=_0xc71a('0x29');return db[_0xc71a('0x2a')][_0xc71a('0x27')]({'where':{'type':_0x5fc7ad,'resourceId':_0x6dcbcf['id']}})['then'](function(){return _0x1af2f9;});})[_0xc71a('0x28')](function(){_0x3ee417[_0xc71a('0x1c')](0xcc)[_0xc71a('0x1b')]();});}};}function handleEntityNotFound(_0x4b286c,_0x5c5bb3){return function(_0x89095d){if(!_0x89095d){_0x4b286c[_0xc71a('0x2b')](0x194);}return _0x89095d;};}function handleError(_0x2cc69a,_0x41b1c0){_0x41b1c0=_0x41b1c0||0x1f4;return function(_0x417e64){logger[_0xc71a('0x2c')](_0x417e64[_0xc71a('0x2d')]);if(_0x417e64[_0xc71a('0x2e')]){delete _0x417e64['name'];}_0x2cc69a[_0xc71a('0x1c')](_0x41b1c0)[_0xc71a('0x2f')](_0x417e64);};}exports[_0xc71a('0x30')]=function(_0x2ed7d8,_0x86748c){var _0x1db926={},_0x30f9e5={},_0x517f43={'count':0x0,'rows':[]};var _0x25d3fc=_[_0xc71a('0x31')](db[_0xc71a('0x32')][_0xc71a('0x33')],function(_0x2cdb74){return{'name':_0x2cdb74[_0xc71a('0x34')],'type':_0x2cdb74[_0xc71a('0x35')][_0xc71a('0x36')]};});_0x30f9e5[_0xc71a('0x37')]=_['map'](_0x25d3fc,_0xc71a('0x2e'));_0x30f9e5[_0xc71a('0x38')]=_[_0xc71a('0x39')](_0x2ed7d8[_0xc71a('0x38')]);_0x30f9e5[_0xc71a('0x3a')]=_[_0xc71a('0x3b')](_0x30f9e5[_0xc71a('0x37')],_0x30f9e5['query']);_0x1db926[_0xc71a('0x3c')]=_[_0xc71a('0x3b')](_0x30f9e5[_0xc71a('0x37')],qs[_0xc71a('0x3d')](_0x2ed7d8[_0xc71a('0x38')][_0xc71a('0x3d')]));_0x1db926[_0xc71a('0x3c')]=_0x1db926[_0xc71a('0x3c')]['length']?_0x1db926['attributes']:_0x30f9e5['model'];if(!_0x2ed7d8['query']['hasOwnProperty']('nolimit')){_0x1db926[_0xc71a('0x20')]=qs['limit'](_0x2ed7d8[_0xc71a('0x38')][_0xc71a('0x20')]);_0x1db926[_0xc71a('0x1e')]=qs['offset'](_0x2ed7d8['query'][_0xc71a('0x1e')]);}_0x1db926[_0xc71a('0x3e')]=qs[_0xc71a('0x3f')](_0x2ed7d8['query']['sort']);_0x1db926[_0xc71a('0x40')]=qs['filters'](_[_0xc71a('0x41')](_0x2ed7d8['query'],_0x30f9e5['filters']),_0x25d3fc);if(_0x2ed7d8[_0xc71a('0x38')][_0xc71a('0x42')]){_0x1db926[_0xc71a('0x40')]=_[_0xc71a('0x43')](_0x1db926[_0xc71a('0x40')],{'$or':_['map'](_0x25d3fc,function(_0x3b4d37){if(_0x3b4d37[_0xc71a('0x35')]!=='VIRTUAL'){var _0x4c6ada={};_0x4c6ada[_0x3b4d37[_0xc71a('0x2e')]]={'$like':'%'+_0x2ed7d8[_0xc71a('0x38')][_0xc71a('0x42')]+'%'};return _0x4c6ada;}})});}_0x1db926=_[_0xc71a('0x43')]({},_0x1db926,_0x2ed7d8[_0xc71a('0x44')]);var _0x79232={'where':_0x1db926[_0xc71a('0x40')]};return db[_0xc71a('0x32')][_0xc71a('0x21')](_0x79232)[_0xc71a('0x28')](function(_0x5e78d9){_0x517f43[_0xc71a('0x21')]=_0x5e78d9;if(_0x2ed7d8[_0xc71a('0x38')][_0xc71a('0x45')]){_0x1db926[_0xc71a('0x46')]=[{'all':!![]}];}return db['SquareProject'][_0xc71a('0x47')](_0x1db926);})[_0xc71a('0x28')](function(_0x177e6c){_0x517f43[_0xc71a('0x48')]=_0x177e6c;return _0x517f43;})[_0xc71a('0x28')](respondWithFilteredResult(_0x86748c,_0x1db926))[_0xc71a('0x49')](handleError(_0x86748c,null));};exports['show']=function(_0x82dbcf,_0x4d2b2a){var _0x5647f4={'raw':![],'where':{'id':_0x82dbcf[_0xc71a('0x4a')]['id']}},_0x59ca04={};_0x59ca04[_0xc71a('0x37')]=_['keys'](db[_0xc71a('0x32')][_0xc71a('0x33')]);_0x59ca04[_0xc71a('0x38')]=_[_0xc71a('0x39')](_0x82dbcf[_0xc71a('0x38')]);_0x59ca04[_0xc71a('0x3a')]=_[_0xc71a('0x3b')](_0x59ca04['model'],_0x59ca04[_0xc71a('0x38')]);_0x5647f4[_0xc71a('0x3c')]=_[_0xc71a('0x3b')](_0x59ca04[_0xc71a('0x37')],qs[_0xc71a('0x3d')](_0x82dbcf['query'][_0xc71a('0x3d')]));_0x5647f4[_0xc71a('0x3c')]=_0x5647f4[_0xc71a('0x3c')]['length']?_0x5647f4[_0xc71a('0x3c')]:_0x59ca04['model'];if(_0x82dbcf[_0xc71a('0x38')]['includeAll']){_0x5647f4['include']=[{'all':!![]}];}_0x5647f4=_[_0xc71a('0x43')]({},_0x5647f4,_0x82dbcf['options']);return db[_0xc71a('0x32')][_0xc71a('0x4b')](_0x5647f4)[_0xc71a('0x28')](handleEntityNotFound(_0x4d2b2a,null))['then'](respondWithResult(_0x4d2b2a,null))[_0xc71a('0x49')](handleError(_0x4d2b2a,null));};exports[_0xc71a('0x4c')]=function(_0x1bacd9,_0x474b81){return db[_0xc71a('0x32')][_0xc71a('0x4c')](_0x1bacd9['body'],{})[_0xc71a('0x28')](function(_0x250c47){var _0x49c852=_0x1bacd9['user'][_0xc71a('0x4d')]({'plain':!![]});if(!_0x49c852)throw new Error(_0xc71a('0x4e'));if(_0x49c852[_0xc71a('0x4f')]==='user'){var _0x58b145=_0x250c47[_0xc71a('0x4d')]({'plain':!![]});var _0x4c4882=_0xc71a('0x29');return db['UserProfileSection'][_0xc71a('0x4b')]({'where':{'name':_0x4c4882,'userProfileId':_0x49c852['userProfileId']},'raw':!![]})['then'](function(_0x30dc5a){if(_0x30dc5a&&_0x30dc5a[_0xc71a('0x50')]===0x0){return db[_0xc71a('0x2a')]['create']({'name':_0x58b145['name'],'resourceId':_0x58b145['id'],'type':_0x30dc5a['name'],'sectionId':_0x30dc5a['id']},{})[_0xc71a('0x28')](function(){return _0x250c47;});}else{return _0x250c47;}})['catch'](function(_0x1eb53f){logger[_0xc71a('0x2c')](_0xc71a('0x51'),_0x1eb53f);throw _0x1eb53f;});}return _0x250c47;})[_0xc71a('0x28')](respondWithResult(_0x474b81,0xc9))[_0xc71a('0x49')](handleError(_0x474b81,null));};exports[_0xc71a('0x26')]=function(_0x433907,_0x5dbf93){if(_0x433907['body']['id']){delete _0x433907[_0xc71a('0x52')]['id'];}return db[_0xc71a('0x32')][_0xc71a('0x4b')]({'where':{'id':_0x433907[_0xc71a('0x4a')]['id']}})[_0xc71a('0x28')](handleEntityNotFound(_0x5dbf93,null))[_0xc71a('0x28')](saveUpdates(_0x433907[_0xc71a('0x52')],null))[_0xc71a('0x28')](respondWithResult(_0x5dbf93,null))[_0xc71a('0x49')](handleError(_0x5dbf93,null));};exports[_0xc71a('0x27')]=function(_0x149990,_0x131346){return db[_0xc71a('0x32')][_0xc71a('0x4b')]({'where':{'id':_0x149990[_0xc71a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x131346,null))['then'](removeEntity(_0x131346,null))[_0xc71a('0x49')](handleError(_0x131346,null));};exports[_0xc71a('0x53')]=function(_0x3b018e,_0x52a3f7,_0x51d3ab){return db['SquareProject'][_0xc71a('0x4b')]({'where':{'id':_0x3b018e[_0xc71a('0x4a')]['id']}})[_0xc71a('0x28')](handleEntityNotFound(_0x52a3f7,null))[_0xc71a('0x28')](function(_0x227ed9){if(_0x227ed9){return _0x227ed9[_0xc71a('0x53')](_0x3b018e[_0xc71a('0x52')]['ids'],_['omit'](_0x3b018e[_0xc71a('0x52')],[_0xc71a('0x54'),'id'])||{});}})[_0xc71a('0x28')](respondWithResult(_0x52a3f7,null))['catch'](handleError(_0x52a3f7,null));};exports['removeUsers']=function(_0x386b5e,_0x5644ee,_0x561831){return db[_0xc71a('0x32')][_0xc71a('0x4b')]({'where':{'id':_0x386b5e['params']['id']}})[_0xc71a('0x28')](handleEntityNotFound(_0x5644ee,null))[_0xc71a('0x28')](function(_0x4b049e){if(_0x4b049e){return _0x4b049e['removeUsers'](_0x386b5e['query'][_0xc71a('0x54')])[_0xc71a('0x28')](function(){if(_['isArray'](_0x386b5e[_0xc71a('0x38')]['ids'])){for(var _0x1ff6dc=0x0;_0x1ff6dc<_0x386b5e[_0xc71a('0x38')][_0xc71a('0x54')][_0xc71a('0x55')];_0x1ff6dc+=0x1){socket['emit']('userSquareProject:remove',{'UserId':Number(_0x386b5e[_0xc71a('0x38')][_0xc71a('0x54')][_0x1ff6dc]),'SquareProjectId':Number(_0x386b5e[_0xc71a('0x4a')]['id'])});}}else{socket[_0xc71a('0x56')]('userSquareProject:remove',{'UserId':Number(_0x386b5e[_0xc71a('0x38')][_0xc71a('0x54')]),'SquareProjectId':Number(_0x386b5e[_0xc71a('0x4a')]['id'])});}});}})[_0xc71a('0x28')](respondWithStatusCode(_0x5644ee,null))[_0xc71a('0x49')](handleError(_0x5644ee,null));};exports[_0xc71a('0x57')]=function(_0x3d9e4a,_0x5a7bb8,_0x2e491f){var _0x419508={};var _0x379f18={};var _0xad82be;var _0x4abe88;return db[_0xc71a('0x32')][_0xc71a('0x58')]({'where':{'id':_0x3d9e4a['params']['id']}})[_0xc71a('0x28')](handleEntityNotFound(_0x5a7bb8,null))[_0xc71a('0x28')](function(_0x110d41){if(_0x110d41){_0xad82be=_0x110d41;_0x379f18[_0xc71a('0x37')]=_[_0xc71a('0x39')](db[_0xc71a('0x59')]['rawAttributes']);_0x379f18[_0xc71a('0x38')]=_[_0xc71a('0x39')](_0x3d9e4a[_0xc71a('0x38')]);_0x379f18[_0xc71a('0x3a')]=_['intersection'](_0x379f18[_0xc71a('0x37')],_0x379f18[_0xc71a('0x38')]);_0x419508[_0xc71a('0x3c')]=_[_0xc71a('0x3b')](_0x379f18[_0xc71a('0x37')],qs[_0xc71a('0x3d')](_0x3d9e4a[_0xc71a('0x38')][_0xc71a('0x3d')]));_0x419508['attributes']=_0x419508['attributes']['length']?_0x419508[_0xc71a('0x3c')]:_0x379f18[_0xc71a('0x37')];_0x419508[_0xc71a('0x3e')]=qs[_0xc71a('0x3f')](_0x3d9e4a[_0xc71a('0x38')][_0xc71a('0x3f')]);_0x419508[_0xc71a('0x40')]=qs['filters'](_[_0xc71a('0x41')](_0x3d9e4a['query'],_0x379f18[_0xc71a('0x3a')]));if(_0x3d9e4a['query'][_0xc71a('0x42')]){_0x419508[_0xc71a('0x40')]=_[_0xc71a('0x43')](_0x419508[_0xc71a('0x40')],{'$or':_[_0xc71a('0x31')](_0x419508[_0xc71a('0x3c')],function(_0x29278a){var _0x20bb4c={};_0x20bb4c[_0x29278a]={'$like':'%'+_0x3d9e4a[_0xc71a('0x38')][_0xc71a('0x42')]+'%'};return _0x20bb4c;})});}_0x419508=_[_0xc71a('0x43')]({},_0x419508,_0x3d9e4a['options']);return _0xad82be[_0xc71a('0x57')](_0x419508);}})[_0xc71a('0x28')](function(_0x2b41d5){if(_0x2b41d5){_0x4abe88=_0x2b41d5[_0xc71a('0x55')];if(!_0x3d9e4a[_0xc71a('0x38')]['hasOwnProperty'](_0xc71a('0x5a'))){_0x419508['limit']=qs[_0xc71a('0x20')](_0x3d9e4a[_0xc71a('0x38')][_0xc71a('0x20')]);_0x419508[_0xc71a('0x1e')]=qs[_0xc71a('0x1e')](_0x3d9e4a[_0xc71a('0x38')]['offset']);}return _0xad82be['getUsers'](_0x419508);}})['then'](function(_0x3aefcb){if(_0x3aefcb){return _0x3aefcb?{'count':_0x4abe88,'rows':_0x3aefcb}:null;}})[_0xc71a('0x28')](respondWithResult(_0x5a7bb8,null))['catch'](handleError(_0x5a7bb8,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 1823271..63936c3 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 _0xf413=['update','emit','hasOwnProperty','hook','events','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x592d48,_0x23f1ba){var _0x5d789e=function(_0x156900){while(--_0x156900){_0x592d48['push'](_0x592d48['shift']());}};_0x5d789e(++_0x23f1ba);}(_0xf413,0xcc));var _0x3f41=function(_0x145fa8,_0x4414ad){_0x145fa8=_0x145fa8-0x0;var _0x28eab5=_0xf413[_0x145fa8];return _0x28eab5;};'use strict';var EventEmitter=require(_0x3f41('0x0'));var SquareProject=require(_0x3f41('0x1'))['db'][_0x3f41('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x3f41('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3f41('0x4'),'afterDestroy':'remove'};function emitEvent(_0x605cfa){return function(_0x51214f,_0x4baa3e,_0x1f25c7){SquareProjectEvents[_0x3f41('0x5')](_0x605cfa+':'+_0x51214f['id'],_0x51214f);SquareProjectEvents[_0x3f41('0x5')](_0x605cfa,_0x51214f);_0x1f25c7(null);};}for(var e in events){if(events[_0x3f41('0x6')](e)){var event=events[e];SquareProject[_0x3f41('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x9842=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9842,0x130));var _0x2984=function(_0x427eaf,_0x37dad8){_0x427eaf=_0x427eaf-0x0;var _0x2fa345=_0x9842[_0x427eaf];return _0x2fa345;};'use strict';var EventEmitter=require(_0x2984('0x0'));var SquareProject=require(_0x2984('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x2984('0x2')](0x0);var events={'afterCreate':_0x2984('0x3'),'afterUpdate':_0x2984('0x4'),'afterDestroy':_0x2984('0x5')};function emitEvent(_0x4fab6c){return function(_0x113a6c,_0x595c6f,_0x2ec563){SquareProjectEvents[_0x2984('0x6')](_0x4fab6c+':'+_0x113a6c['id'],_0x113a6c);SquareProjectEvents[_0x2984('0x6')](_0x4fab6c,_0x113a6c);_0x2ec563(null);};}for(var e in events){if(events[_0x2984('0x7')](e)){var event=events[e];SquareProject[_0x2984('0x8')](e,emitEvent(event));}}module[_0x2984('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 2d88da4..6510734 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 _0xf684=['path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','changed','preproduction','savedAt','production','publishedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x102376,_0x16c6a2){var _0x29bc9c=function(_0x5fe5b1){while(--_0x5fe5b1){_0x102376['push'](_0x102376['shift']());}};_0x29bc9c(++_0x16c6a2);}(_0xf684,0xf2));var _0x4f68=function(_0x4b9ea2,_0x169581){_0x4b9ea2=_0x4b9ea2-0x0;var _0x571179=_0xf684[_0x4b9ea2];return _0x571179;};'use strict';var _=require(_0x4f68('0x0'));var util=require('util');var logger=require(_0x4f68('0x1'))(_0x4f68('0x2'));var moment=require('moment');var BPromise=require(_0x4f68('0x3'));var rp=require(_0x4f68('0x4'));var fs=require('fs');var path=require(_0x4f68('0x5'));var rimraf=require(_0x4f68('0x6'));var config=require(_0x4f68('0x7'));var attributes=require(_0x4f68('0x8'));module[_0x4f68('0x9')]=function(_0x257c4b,_0x41cb5e){return _0x257c4b[_0x4f68('0xa')](_0x4f68('0xb'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5b3219,_0xb5bb99,_0x3fbabd){if(_0x5b3219[_0x4f68('0xc')](_0x4f68('0xd'))){_0x5b3219[_0x4f68('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x5b3219[_0x4f68('0xc')](_0x4f68('0xf'))){_0x5b3219[_0x4f68('0x10')]=moment()[_0x4f68('0x11')](_0x4f68('0x12'));}_0x3fbabd(null,_0x5b3219);}}});}; \ No newline at end of file +var _0x3f37=['publishedAt','format','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','production'];(function(_0x2cb87f,_0x317ff3){var _0x28d372=function(_0x197a3b){while(--_0x197a3b){_0x2cb87f['push'](_0x2cb87f['shift']());}};_0x28d372(++_0x317ff3);}(_0x3f37,0x134));var _0x73f3=function(_0x323430,_0x3d2b6d){_0x323430=_0x323430-0x0;var _0x9eecd1=_0x3f37[_0x323430];return _0x9eecd1;};'use strict';var _=require(_0x73f3('0x0'));var util=require(_0x73f3('0x1'));var logger=require(_0x73f3('0x2'))('api');var moment=require('moment');var BPromise=require(_0x73f3('0x3'));var rp=require(_0x73f3('0x4'));var fs=require('fs');var path=require(_0x73f3('0x5'));var rimraf=require(_0x73f3('0x6'));var config=require(_0x73f3('0x7'));var attributes=require(_0x73f3('0x8'));module[_0x73f3('0x9')]=function(_0x47c1ef,_0x4b1601){return _0x47c1ef['define'](_0x73f3('0xa'),attributes,{'tableName':_0x73f3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x16e820,_0x8bfb06,_0x5366b9){if(_0x16e820['changed'](_0x73f3('0xc'))){_0x16e820[_0x73f3('0xd')]=moment()['format'](_0x73f3('0xe'));}if(_0x16e820['changed'](_0x73f3('0xf'))){_0x16e820[_0x73f3('0x10')]=moment()[_0x73f3('0x11')](_0x73f3('0xe'));}_0x5366b9(null,_0x16e820);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index f585f81..90f6fc4 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 _0xcf35=['include','map','model','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then','info','SquareProject,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','ShowSquareProject','options','raw','where','attributes'];(function(_0x29b893,_0x4713bd){var _0x259ff7=function(_0x5af05f){while(--_0x5af05f){_0x29b893['push'](_0x29b893['shift']());}};_0x259ff7(++_0x4713bd);}(_0xcf35,0x179));var _0x5cf3=function(_0x5001b4,_0x362ed5){_0x5001b4=_0x5001b4-0x0;var _0x44ffa7=_0xcf35[_0x5001b4];return _0x44ffa7;};'use strict';var _=require('lodash');var util=require(_0x5cf3('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5cf3('0x1'));var fs=require('fs');var Redis=require(_0x5cf3('0x2'));var db=require(_0x5cf3('0x3'))['db'];var utils=require(_0x5cf3('0x4'));var logger=require(_0x5cf3('0x5'))(_0x5cf3('0x6'));var config=require(_0x5cf3('0x7'));var jayson=require(_0x5cf3('0x8'));var client=jayson['client'][_0x5cf3('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5cf3('0xa')],{'host':_0x5cf3('0xb'),'port':0x18eb});var socket=require(_0x5cf3('0xc'))(new Redis(config['redis']));require('./squareProject.socket')[_0x5cf3('0xd')](socket);function respondWithRpcPromise(_0x30e962,_0x3ba0f6,_0xcd6986){return new BPromise(function(_0x48c4eb,_0x3af41a){return client[_0x5cf3('0xe')](_0x30e962,_0xcd6986)[_0x5cf3('0xf')](function(_0x2a1914){logger[_0x5cf3('0x10')](_0x5cf3('0x11'),_0x3ba0f6,'request\x20sent');logger[_0x5cf3('0x12')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x3ba0f6,_0x5cf3('0x13'),JSON[_0x5cf3('0x14')](_0x2a1914));if(_0x2a1914[_0x5cf3('0x15')]){if(_0x2a1914['error'][_0x5cf3('0x16')]===0x1f4){logger[_0x5cf3('0x15')](_0x5cf3('0x11'),_0x3ba0f6,_0x2a1914['error'][_0x5cf3('0x17')]);return _0x3af41a(_0x2a1914['error']['message']);}logger[_0x5cf3('0x15')](_0x5cf3('0x11'),_0x3ba0f6,_0x2a1914[_0x5cf3('0x15')][_0x5cf3('0x17')]);return _0x48c4eb(_0x2a1914[_0x5cf3('0x15')][_0x5cf3('0x17')]);}else{logger['info'](_0x5cf3('0x11'),_0x3ba0f6,'request\x20sent');_0x48c4eb(_0x2a1914[_0x5cf3('0x18')][_0x5cf3('0x17')]);}})[_0x5cf3('0x19')](function(_0x3ed77b){logger[_0x5cf3('0x15')](_0x5cf3('0x11'),_0x3ba0f6,_0x3ed77b);_0x3af41a(_0x3ed77b);});});}exports[_0x5cf3('0x1a')]=function(_0x326b2f){var _0x545ae2=this;return new Promise(function(_0x1c6d32,_0x2ba255){return db['SquareProject']['find']({'raw':_0x326b2f[_0x5cf3('0x1b')]?_0x326b2f['options'][_0x5cf3('0x1c')]===undefined?!![]:![]:!![],'where':_0x326b2f[_0x5cf3('0x1b')]?_0x326b2f[_0x5cf3('0x1b')][_0x5cf3('0x1d')]||null:null,'attributes':_0x326b2f[_0x5cf3('0x1b')]?_0x326b2f[_0x5cf3('0x1b')][_0x5cf3('0x1e')]||null:null,'include':_0x326b2f[_0x5cf3('0x1b')]?_0x326b2f[_0x5cf3('0x1b')][_0x5cf3('0x1f')]?_[_0x5cf3('0x20')](_0x326b2f[_0x5cf3('0x1b')][_0x5cf3('0x1f')],function(_0x23072a){return{'model':db[_0x23072a[_0x5cf3('0x21')]],'as':_0x23072a['as'],'attributes':_0x23072a[_0x5cf3('0x1e')],'include':_0x23072a[_0x5cf3('0x1f')]?_[_0x5cf3('0x20')](_0x23072a[_0x5cf3('0x1f')],function(_0x36887b){return{'model':db[_0x36887b['model']],'as':_0x36887b['as'],'attributes':_0x36887b[_0x5cf3('0x1e')],'include':_0x36887b[_0x5cf3('0x1f')]?_[_0x5cf3('0x20')](_0x36887b[_0x5cf3('0x1f')],function(_0x314153){return{'model':db[_0x314153[_0x5cf3('0x21')]],'as':_0x314153['as'],'attributes':_0x314153[_0x5cf3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5cf3('0xf')](function(_0x15c0fb){logger[_0x5cf3('0x10')](_0x5cf3('0x1a'),_0x326b2f);logger['debug'](_0x5cf3('0x1a'),_0x326b2f,JSON[_0x5cf3('0x14')](_0x15c0fb));_0x1c6d32(_0x15c0fb);})[_0x5cf3('0x19')](function(_0xc6e328){logger[_0x5cf3('0x15')]('ShowSquareProject',_0xc6e328[_0x5cf3('0x17')],_0x326b2f);_0x2ba255(_0x545ae2[_0x5cf3('0x15')](0x1f4,_0xc6e328[_0x5cf3('0x17')]));});});}; \ No newline at end of file +var _0x9204=['catch','SquareProject','find','options','raw','where','map','include','model','attributes','ShowSquareProject','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x9204,0x1ec));var _0x4920=function(_0x55da0c,_0x23780f){_0x55da0c=_0x55da0c-0x0;var _0x4fc256=_0x9204[_0x55da0c];return _0x4fc256;};'use strict';var _=require(_0x4920('0x0'));var util=require(_0x4920('0x1'));var moment=require(_0x4920('0x2'));var BPromise=require(_0x4920('0x3'));var rs=require(_0x4920('0x4'));var fs=require('fs');var Redis=require(_0x4920('0x5'));var db=require(_0x4920('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4920('0x7'))(_0x4920('0x8'));var config=require(_0x4920('0x9'));var jayson=require(_0x4920('0xa'));var client=jayson[_0x4920('0xb')][_0x4920('0xc')]({'port':0x232a});config[_0x4920('0xd')]=_[_0x4920('0xe')](config[_0x4920('0xd')],{'host':_0x4920('0xf'),'port':0x18eb});var socket=require(_0x4920('0x10'))(new Redis(config[_0x4920('0xd')]));require(_0x4920('0x11'))[_0x4920('0x12')](socket);function respondWithRpcPromise(_0x1482fb,_0x3aaf3a,_0x3487ff){return new BPromise(function(_0x47c418,_0x128cc2){return client['request'](_0x1482fb,_0x3487ff)[_0x4920('0x13')](function(_0x4e5db2){logger[_0x4920('0x14')](_0x4920('0x15'),_0x3aaf3a,_0x4920('0x16'));logger['debug'](_0x4920('0x17'),_0x3aaf3a,_0x4920('0x16'),JSON[_0x4920('0x18')](_0x4e5db2));if(_0x4e5db2[_0x4920('0x19')]){if(_0x4e5db2[_0x4920('0x19')]['code']===0x1f4){logger[_0x4920('0x19')](_0x4920('0x15'),_0x3aaf3a,_0x4e5db2[_0x4920('0x19')][_0x4920('0x1a')]);return _0x128cc2(_0x4e5db2['error'][_0x4920('0x1a')]);}logger[_0x4920('0x19')](_0x4920('0x15'),_0x3aaf3a,_0x4e5db2['error'][_0x4920('0x1a')]);return _0x47c418(_0x4e5db2['error'][_0x4920('0x1a')]);}else{logger[_0x4920('0x14')](_0x4920('0x15'),_0x3aaf3a,_0x4920('0x16'));_0x47c418(_0x4e5db2[_0x4920('0x1b')]['message']);}})[_0x4920('0x1c')](function(_0x1b84be){logger[_0x4920('0x19')](_0x4920('0x15'),_0x3aaf3a,_0x1b84be);_0x128cc2(_0x1b84be);});});}exports['ShowSquareProject']=function(_0x1b0bdc){var _0x562126=this;return new Promise(function(_0x451ce3,_0x4655d4){return db[_0x4920('0x1d')][_0x4920('0x1e')]({'raw':_0x1b0bdc[_0x4920('0x1f')]?_0x1b0bdc['options'][_0x4920('0x20')]===undefined?!![]:![]:!![],'where':_0x1b0bdc[_0x4920('0x1f')]?_0x1b0bdc[_0x4920('0x1f')][_0x4920('0x21')]||null:null,'attributes':_0x1b0bdc[_0x4920('0x1f')]?_0x1b0bdc[_0x4920('0x1f')]['attributes']||null:null,'include':_0x1b0bdc['options']?_0x1b0bdc['options']['include']?_[_0x4920('0x22')](_0x1b0bdc['options'][_0x4920('0x23')],function(_0x10e52f){return{'model':db[_0x10e52f[_0x4920('0x24')]],'as':_0x10e52f['as'],'attributes':_0x10e52f[_0x4920('0x25')],'include':_0x10e52f[_0x4920('0x23')]?_[_0x4920('0x22')](_0x10e52f[_0x4920('0x23')],function(_0x442861){return{'model':db[_0x442861[_0x4920('0x24')]],'as':_0x442861['as'],'attributes':_0x442861[_0x4920('0x25')],'include':_0x442861['include']?_[_0x4920('0x22')](_0x442861['include'],function(_0x1627be){return{'model':db[_0x1627be[_0x4920('0x24')]],'as':_0x1627be['as'],'attributes':_0x1627be['attributes']};}):[]};}):[]};}):[]:[]})[_0x4920('0x13')](function(_0x53ce83){logger['info'](_0x4920('0x26'),_0x1b0bdc);logger[_0x4920('0x27')]('ShowSquareProject',_0x1b0bdc,JSON[_0x4920('0x18')](_0x53ce83));_0x451ce3(_0x53ce83);})[_0x4920('0x1c')](function(_0x18fb80){logger[_0x4920('0x19')](_0x4920('0x26'),_0x18fb80[_0x4920('0x1a')],_0x1b0bdc);_0x4655d4(_0x562126['error'](0x1f4,_0x18fb80[_0x4920('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 71461e1..64e5c26 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 _0xd6d0=['update','emit','removeListener','register','squareProject:','save','remove'];(function(_0x29ceed,_0x4c213a){var _0x1bc0ce=function(_0x34161c){while(--_0x34161c){_0x29ceed['push'](_0x29ceed['shift']());}};_0x1bc0ce(++_0x4c213a);}(_0xd6d0,0xa6));var _0x0d6d=function(_0x4cc016,_0x336d3e){_0x4cc016=_0x4cc016-0x0;var _0x41af76=_0xd6d0[_0x4cc016];return _0x41af76;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x0d6d('0x0'),_0x0d6d('0x1'),_0x0d6d('0x2')];function createListener(_0x2647ca,_0x327650){return function(_0x3d85e1){_0x327650[_0x0d6d('0x3')](_0x2647ca,_0x3d85e1);};}function removeListener(_0x3ba312,_0xd27269){return function(){SquareProjectEvents[_0x0d6d('0x4')](_0x3ba312,_0xd27269);};}exports[_0x0d6d('0x5')]=function(_0x5dc843){for(var _0x1f9d0b=0x0,_0x4edcc9=events['length'];_0x1f9d0b<_0x4edcc9;_0x1f9d0b++){var _0xc2c21c=events[_0x1f9d0b];var _0xc2dfa=createListener(_0x0d6d('0x6')+_0xc2c21c,_0x5dc843);SquareProjectEvents['on'](_0xc2c21c,_0xc2dfa);}}; \ No newline at end of file +var _0xbd6e=['remove','update','emit','removeListener','register','length','squareProject:','./squareProject.events','save'];(function(_0x2ca9f5,_0x1c665d){var _0x3bb424=function(_0x5ac7d2){while(--_0x5ac7d2){_0x2ca9f5['push'](_0x2ca9f5['shift']());}};_0x3bb424(++_0x1c665d);}(_0xbd6e,0xb2));var _0xebd6=function(_0x60e337,_0x466b96){_0x60e337=_0x60e337-0x0;var _0x2ece12=_0xbd6e[_0x60e337];return _0x2ece12;};'use strict';var SquareProjectEvents=require(_0xebd6('0x0'));var events=[_0xebd6('0x1'),_0xebd6('0x2'),_0xebd6('0x3')];function createListener(_0xac6c36,_0x529acc){return function(_0x3db6b4){_0x529acc[_0xebd6('0x4')](_0xac6c36,_0x3db6b4);};}function removeListener(_0x3cf52a,_0x1361a4){return function(){SquareProjectEvents[_0xebd6('0x5')](_0x3cf52a,_0x1361a4);};}exports[_0xebd6('0x6')]=function(_0x1475dd){for(var _0x35e20e=0x0,_0x473d27=events[_0xebd6('0x7')];_0x35e20e<_0x473d27;_0x35e20e++){var _0x231e8f=events[_0x35e20e];var _0x1caf0c=createListener(_0xebd6('0x8')+_0x231e8f,_0x1475dd);SquareProjectEvents['on'](_0x231e8f,_0x1caf0c);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 6d6af37..283f280 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 _0x7a54=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x32bfcd,_0x25e5d2){var _0x39f463=function(_0xc96a56){while(--_0xc96a56){_0x32bfcd['push'](_0x32bfcd['shift']());}};_0x39f463(++_0x25e5d2);}(_0x7a54,0x106));var _0x47a5=function(_0x1ffb2a,_0x25b08e){_0x1ffb2a=_0x1ffb2a-0x0;var _0x5967ce=_0x7a54[_0x1ffb2a];return _0x5967ce;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);module[_0x47a5('0x12')]=router; \ No newline at end of file +var _0x7fbe=['/:id','show','/:id/download','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index'];(function(_0x3dbf56,_0x53311e){var _0x534a8b=function(_0x5178fb){while(--_0x5178fb){_0x3dbf56['push'](_0x3dbf56['shift']());}};_0x534a8b(++_0x53311e);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4cbde1,_0x5785ec){_0x4cbde1=_0x4cbde1-0x0;var _0x37d42=_0x7fbe[_0x4cbde1];return _0x37d42;};'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['download']);router['post']('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x11')]);router[_0xe7fb('0x12')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x13')]);module[_0xe7fb('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 07d665c..d42e68d 100644 --- a/server/api/squareRecording/squareRecording.attributes.js +++ b/server/api/squareRecording/squareRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d17=['getDataValue','savePath','substring','sequelize','exports','STRING','VIRTUAL'];(function(_0x2d4218,_0xccbac3){var _0x317d17=function(_0x5724cf){while(--_0x5724cf){_0x2d4218['push'](_0x2d4218['shift']());}};_0x317d17(++_0xccbac3);}(_0x5d17,0x114));var _0x75d1=function(_0x2f54b6,_0x3cc6cb){_0x2f54b6=_0x2f54b6-0x0;var _0x169f21=_0x5d17[_0x2f54b6];return _0x169f21;};'use strict';var Sequelize=require(_0x75d1('0x0'));module[_0x75d1('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x75d1('0x2')]},'context':{'type':Sequelize[_0x75d1('0x2')]},'extension':{'type':Sequelize[_0x75d1('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x75d1('0x2')]},'dnid':{'type':Sequelize[_0x75d1('0x2')]},'projectName':{'type':Sequelize[_0x75d1('0x2')]},'saveName':{'type':Sequelize[_0x75d1('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x75d1('0x2')]},'format':{'type':Sequelize[_0x75d1('0x3')],'get':function(){var _0x5c957a='';var _0x1ee61b=this[_0x75d1('0x4')](_0x75d1('0x5'));if(_0x1ee61b){_0x5c957a=_0x1ee61b[_0x75d1('0x6')](_0x1ee61b['lastIndexOf']('.'));}return _0x5c957a;}}}; \ No newline at end of file +var _0x3e74=['getDataValue','savePath','substring','sequelize','STRING'];(function(_0x2766f7,_0xf67b94){var _0x5146de=function(_0x590fe9){while(--_0x590fe9){_0x2766f7['push'](_0x2766f7['shift']());}};_0x5146de(++_0xf67b94);}(_0x3e74,0x175));var _0x43e7=function(_0x32c5db,_0x28d9d9){_0x32c5db=_0x32c5db-0x0;var _0x25c38a=_0x3e74[_0x32c5db];return _0x25c38a;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x43e7('0x1')]},'callerid':{'type':Sequelize[_0x43e7('0x1')]},'calleridname':{'type':Sequelize[_0x43e7('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x43e7('0x1')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x43e7('0x1')]},'projectName':{'type':Sequelize[_0x43e7('0x1')]},'saveName':{'type':Sequelize[_0x43e7('0x1')]},'filename':{'type':Sequelize[_0x43e7('0x1')]},'savePath':{'type':Sequelize[_0x43e7('0x1')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x45a0d1='';var _0x3491d6=this[_0x43e7('0x2')](_0x43e7('0x3'));if(_0x3491d6){_0x45a0d1=_0x3491d6[_0x43e7('0x4')](_0x3491d6['lastIndexOf']('.'));}return _0x45a0d1;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 78c40df..ab22c21 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 _0x1c7a=['filename','format','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','existsSync','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','undefined','limit','count','offset','status','set','Content-Range','json','reject','save','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','SquareRecording','include','findAll','catch','show','params','create','update','body','find','download','../../components/encryptor','uniqueid','savePath'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c7a,0x7b));var _0xa1c7=function(_0x21fa42,_0x43910a){_0x21fa42=_0x21fa42-0x0;var _0x452d09=_0x1c7a[_0x21fa42];return _0x452d09;};'use strict';var emlformat=require(_0xa1c7('0x0'));var rimraf=require(_0xa1c7('0x1'));var zipdir=require(_0xa1c7('0x2'));var jsonpatch=require(_0xa1c7('0x3'));var rp=require(_0xa1c7('0x4'));var moment=require(_0xa1c7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa1c7('0x6'));var util=require(_0xa1c7('0x7'));var path=require(_0xa1c7('0x8'));var sox=require(_0xa1c7('0x9'));var csv=require('to-csv');var ejs=require(_0xa1c7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa1c7('0xb'));var squel=require(_0xa1c7('0xc'));var crypto=require(_0xa1c7('0xd'));var jsforce=require(_0xa1c7('0xe'));var deskjs=require(_0xa1c7('0xf'));var toCsv=require(_0xa1c7('0x10'));var querystring=require('querystring');var Papa=require(_0xa1c7('0x11'));var Redis=require(_0xa1c7('0x12'));var authService=require(_0xa1c7('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa1c7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa1c7('0x15'))(_0xa1c7('0x16'));var utils=require(_0xa1c7('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa1c7('0x18'))['db'];function respondWithStatusCode(_0x5a27fc,_0x5c6fe9){_0x5c6fe9=_0x5c6fe9||0xcc;return function(_0x250986){if(_0x250986){return _0x5a27fc[_0xa1c7('0x19')](_0x5c6fe9);}return _0x5a27fc['status'](_0x5c6fe9)['end']();};}function respondWithResult(_0x485a81,_0x4ee800){_0x4ee800=_0x4ee800||0xc8;return function(_0x5398c8){if(_0x5398c8){return _0x485a81['status'](_0x4ee800)['json'](_0x5398c8);}};}function respondWithFilteredResult(_0x3b1fe0,_0x1655ea){return function(_0x5602e2){if(_0x5602e2){var _0x5cd5d7=typeof _0x1655ea['offset']===_0xa1c7('0x1a')&&typeof _0x1655ea[_0xa1c7('0x1b')]==='undefined';var _0x19906b=_0x5602e2[_0xa1c7('0x1c')];var _0x40f056=_0x5cd5d7?0x0:_0x1655ea[_0xa1c7('0x1d')];var _0x1f5c6d=_0x5cd5d7?_0x5602e2[_0xa1c7('0x1c')]:_0x1655ea[_0xa1c7('0x1d')]+_0x1655ea[_0xa1c7('0x1b')];var _0x5a0e06;if(_0x1f5c6d>=_0x19906b){_0x1f5c6d=_0x19906b;_0x5a0e06=0xc8;}else{_0x5a0e06=0xce;}_0x3b1fe0[_0xa1c7('0x1e')](_0x5a0e06);return _0x3b1fe0[_0xa1c7('0x1f')](_0xa1c7('0x20'),_0x40f056+'-'+_0x1f5c6d+'/'+_0x19906b)[_0xa1c7('0x21')](_0x5602e2);}return null;};}function patchUpdates(_0x288e7b){return function(_0x208e5b){try{jsonpatch['apply'](_0x208e5b,_0x288e7b,!![]);}catch(_0x3bf66d){return BPromise[_0xa1c7('0x22')](_0x3bf66d);}return _0x208e5b[_0xa1c7('0x23')]();};}function saveUpdates(_0x3b8aa2,_0x44a2c6){return function(_0x35fc01){if(_0x35fc01){return _0x35fc01['update'](_0x3b8aa2)[_0xa1c7('0x24')](function(_0x39890d){return _0x39890d;});}return null;};}function removeEntity(_0x356c87,_0x1ac727){return function(_0x381cc4){if(_0x381cc4){return _0x381cc4[_0xa1c7('0x25')]()['then'](function(){_0x356c87[_0xa1c7('0x1e')](0xcc)[_0xa1c7('0x26')]();});}};}function handleEntityNotFound(_0x51a22f,_0x5b990a){return function(_0x375f22){if(!_0x375f22){_0x51a22f[_0xa1c7('0x19')](0x194);}return _0x375f22;};}function handleError(_0x2f7b4f,_0x215cc0){_0x215cc0=_0x215cc0||0x1f4;return function(_0x20f74e){logger[_0xa1c7('0x27')](_0x20f74e[_0xa1c7('0x28')]);if(_0x20f74e[_0xa1c7('0x29')]){delete _0x20f74e[_0xa1c7('0x29')];}_0x2f7b4f[_0xa1c7('0x1e')](_0x215cc0)[_0xa1c7('0x2a')](_0x20f74e);};}exports[_0xa1c7('0x2b')]=function(_0x2fcf7f,_0x233e5e){var _0x1e8180={},_0x4a6a0b={},_0x1a0d7d={'count':0x0,'rows':[]};var _0x118386=_[_0xa1c7('0x2c')](db['SquareRecording'][_0xa1c7('0x2d')],function(_0x618c3b){return{'name':_0x618c3b[_0xa1c7('0x2e')],'type':_0x618c3b['type'][_0xa1c7('0x2f')]};});_0x4a6a0b[_0xa1c7('0x30')]=_[_0xa1c7('0x2c')](_0x118386,_0xa1c7('0x29'));_0x4a6a0b[_0xa1c7('0x31')]=_[_0xa1c7('0x32')](_0x2fcf7f[_0xa1c7('0x31')]);_0x4a6a0b[_0xa1c7('0x33')]=_['intersection'](_0x4a6a0b['model'],_0x4a6a0b['query']);_0x1e8180[_0xa1c7('0x34')]=_[_0xa1c7('0x35')](_0x4a6a0b['model'],qs[_0xa1c7('0x36')](_0x2fcf7f[_0xa1c7('0x31')][_0xa1c7('0x36')]));_0x1e8180[_0xa1c7('0x34')]=_0x1e8180[_0xa1c7('0x34')][_0xa1c7('0x37')]?_0x1e8180['attributes']:_0x4a6a0b['model'];if(!_0x2fcf7f[_0xa1c7('0x31')][_0xa1c7('0x38')](_0xa1c7('0x39'))){_0x1e8180[_0xa1c7('0x1b')]=qs[_0xa1c7('0x1b')](_0x2fcf7f[_0xa1c7('0x31')]['limit']);_0x1e8180[_0xa1c7('0x1d')]=qs[_0xa1c7('0x1d')](_0x2fcf7f['query'][_0xa1c7('0x1d')]);}_0x1e8180[_0xa1c7('0x3a')]=qs[_0xa1c7('0x3b')](_0x2fcf7f[_0xa1c7('0x31')]['sort']);_0x1e8180[_0xa1c7('0x3c')]=qs[_0xa1c7('0x33')](_[_0xa1c7('0x3d')](_0x2fcf7f['query'],_0x4a6a0b['filters']),_0x118386);if(_0x2fcf7f[_0xa1c7('0x31')][_0xa1c7('0x3e')]){_0x1e8180['where']=_['merge'](_0x1e8180[_0xa1c7('0x3c')],{'$or':_[_0xa1c7('0x2c')](_0x118386,function(_0x446389){if(_0x446389[_0xa1c7('0x3f')]!==_0xa1c7('0x40')){var _0x1a2869={};_0x1a2869[_0x446389['name']]={'$like':'%'+_0x2fcf7f['query'][_0xa1c7('0x3e')]+'%'};return _0x1a2869;}})});}_0x1e8180=_[_0xa1c7('0x41')]({},_0x1e8180,_0x2fcf7f[_0xa1c7('0x42')]);var _0x32a448={'where':_0x1e8180[_0xa1c7('0x3c')]};return db[_0xa1c7('0x43')][_0xa1c7('0x1c')](_0x32a448)[_0xa1c7('0x24')](function(_0x4dba88){_0x1a0d7d[_0xa1c7('0x1c')]=_0x4dba88;if(_0x2fcf7f[_0xa1c7('0x31')]['includeAll']){_0x1e8180[_0xa1c7('0x44')]=[{'all':!![]}];}return db[_0xa1c7('0x43')][_0xa1c7('0x45')](_0x1e8180);})[_0xa1c7('0x24')](function(_0x5d6f2e){_0x1a0d7d['rows']=_0x5d6f2e;return _0x1a0d7d;})['then'](respondWithFilteredResult(_0x233e5e,_0x1e8180))[_0xa1c7('0x46')](handleError(_0x233e5e,null));};exports[_0xa1c7('0x47')]=function(_0x55fa5a,_0x1cb6cb){var _0x521985={'raw':!![],'where':{'id':_0x55fa5a[_0xa1c7('0x48')]['id']}},_0x4ce993={};_0x4ce993[_0xa1c7('0x30')]=_[_0xa1c7('0x32')](db['SquareRecording'][_0xa1c7('0x2d')]);_0x4ce993[_0xa1c7('0x31')]=_[_0xa1c7('0x32')](_0x55fa5a[_0xa1c7('0x31')]);_0x4ce993[_0xa1c7('0x33')]=_[_0xa1c7('0x35')](_0x4ce993['model'],_0x4ce993[_0xa1c7('0x31')]);_0x521985[_0xa1c7('0x34')]=_['intersection'](_0x4ce993[_0xa1c7('0x30')],qs['fields'](_0x55fa5a[_0xa1c7('0x31')][_0xa1c7('0x36')]));_0x521985['attributes']=_0x521985[_0xa1c7('0x34')][_0xa1c7('0x37')]?_0x521985['attributes']:_0x4ce993[_0xa1c7('0x30')];if(_0x55fa5a[_0xa1c7('0x31')]['includeAll']){_0x521985['include']=[{'all':!![]}];}_0x521985=_['merge']({},_0x521985,_0x55fa5a['options']);return db[_0xa1c7('0x43')]['find'](_0x521985)[_0xa1c7('0x24')](handleEntityNotFound(_0x1cb6cb,null))[_0xa1c7('0x24')](respondWithResult(_0x1cb6cb,null))[_0xa1c7('0x46')](handleError(_0x1cb6cb,null));};exports[_0xa1c7('0x49')]=function(_0x3d1ce5,_0x19dbb9){return db[_0xa1c7('0x43')][_0xa1c7('0x49')](_0x3d1ce5['body'],{})[_0xa1c7('0x24')](respondWithResult(_0x19dbb9,0xc9))[_0xa1c7('0x46')](handleError(_0x19dbb9,null));};exports[_0xa1c7('0x4a')]=function(_0x2b907d,_0x26e56a){if(_0x2b907d[_0xa1c7('0x4b')]['id']){delete _0x2b907d['body']['id'];}return db[_0xa1c7('0x43')][_0xa1c7('0x4c')]({'where':{'id':_0x2b907d['params']['id']}})[_0xa1c7('0x24')](handleEntityNotFound(_0x26e56a,null))[_0xa1c7('0x24')](saveUpdates(_0x2b907d[_0xa1c7('0x4b')],null))[_0xa1c7('0x24')](respondWithResult(_0x26e56a,null))['catch'](handleError(_0x26e56a,null));};exports[_0xa1c7('0x4d')]=function(_0x3ac1de,_0x188a72,_0x15365d){var _0x1e0d91=require(_0xa1c7('0x4e'));var _0xb5a7d7=![];var _0x3a36d4={};if(_0x3ac1de['query']['type']&&_0x3ac1de[_0xa1c7('0x31')]['type']===_0xa1c7('0x4f')){_0x3a36d4[_0xa1c7('0x4f')]=_0x3ac1de[_0xa1c7('0x48')]['id'];}else{_0x3a36d4['id']=_0x3ac1de['params']['id'];}return db[_0xa1c7('0x43')]['find']({'where':_0x3a36d4,'attributes':['id',_0xa1c7('0x50'),_0xa1c7('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x188a72,null))['then'](function(_0x487fe8){if(_0x487fe8){var _0x244ffb=_0x487fe8[_0xa1c7('0x50')];var _0xf5b5f9=util[_0xa1c7('0x52')]('%s.cypher',_0x244ffb);if(fs['existsSync'](_0xf5b5f9)){_0xb5a7d7=!![];return _0x1e0d91[_0xa1c7('0x53')](_0xf5b5f9,_0x244ffb,config[_0xa1c7('0x54')][_0xa1c7('0x55')])[_0xa1c7('0x24')](function(){return _0x487fe8;});}return _0x487fe8;}})[_0xa1c7('0x24')](function(_0x13e717){if(_0x13e717){var _0x4c4ad3=_0x13e717[_0xa1c7('0x50')];if(!fs['existsSync'](_0x4c4ad3)){throw new db[(_0xa1c7('0x56'))][(_0xa1c7('0x57'))](_0xa1c7('0x58'));}if(_0x13e717['filename']){return _0x188a72['download'](_0x4c4ad3,_0x13e717[_0xa1c7('0x51')]+path[_0xa1c7('0x59')](_0x4c4ad3),function(){if(_0xb5a7d7){fs[_0xa1c7('0x5a')](_0x4c4ad3);}});}else{return _0x188a72[_0xa1c7('0x4d')](_0x4c4ad3,function(_0x571fdf){if(_0xb5a7d7){fs[_0xa1c7('0x5a')](_0x4c4ad3);}});}}})[_0xa1c7('0x46')](function(_0x38f919){if(_0x38f919[_0xa1c7('0x5b')]==='SquareRecording\x20not\x20found'){_0x188a72['status'](0x194)[_0xa1c7('0x2a')](_0xa1c7('0x5c'));}else{return handleError(_0x188a72,null);}});};exports[_0xa1c7('0x25')]=function(_0x2975a3,_0x39f52b){return db[_0xa1c7('0x43')][_0xa1c7('0x4c')]({'where':{'id':_0x2975a3['params']['id']}})['then'](function(_0x1a1589){if(_[_0xa1c7('0x5d')](_0x1a1589)){throw new ReferenceError(_0xa1c7('0x5e'));}return _0x1a1589;})['then'](function(_0x39c8ad){var _0x4bd574=_0x39c8ad[_0xa1c7('0x50')];logger[_0xa1c7('0x5f')](_0xa1c7('0x60'),_0x4bd574);if(!_[_0xa1c7('0x5d')](_0x39c8ad[_0xa1c7('0x50')])&&fs[_0xa1c7('0x61')](_0x4bd574)){logger['info'](_0xa1c7('0x62')+_0x4bd574+_0xa1c7('0x63'));fs[_0xa1c7('0x64')](_0x4bd574);}_0x4bd574=_0x4bd574+_0xa1c7('0x65');if(!_[_0xa1c7('0x5d')](_0x39c8ad[_0xa1c7('0x50')])&&fs['existsSync'](_0x4bd574)){logger['info']('File:\x20\x22'+_0x4bd574+_0xa1c7('0x63'));fs[_0xa1c7('0x64')](_0x4bd574);}return _0x39c8ad;})[_0xa1c7('0x24')](function(_0x1c5785){if(!_0x1c5785)throw new InternalError();return _0x1c5785[_0xa1c7('0x25')]();})[_0xa1c7('0x24')](function(){_0x39f52b[_0xa1c7('0x1e')](0xcc)[_0xa1c7('0x26')]();})[_0xa1c7('0x46')](handleError(_0x39f52b,null));}; \ No newline at end of file +var _0x633f=['Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','status','sendStatus','error','name','send','index','SquareRecording','rawAttributes','fieldName','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','find','create','body','update','params','uniqueid','savePath','format','existsSync','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','message'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x633f,0x6b));var _0xf633=function(_0x319cae,_0x23efa1){_0x319cae=_0x319cae-0x0;var _0x44c9d6=_0x633f[_0x319cae];return _0x44c9d6;};'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('moment');var BPromise=require(_0xf633('0x5'));var Mustache=require(_0xf633('0x6'));var util=require('util');var path=require('path');var sox=require(_0xf633('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf633('0x8'));var _=require(_0xf633('0x9'));var squel=require(_0xf633('0xa'));var crypto=require(_0xf633('0xb'));var jsforce=require(_0xf633('0xc'));var deskjs=require(_0xf633('0xd'));var toCsv=require(_0xf633('0xe'));var querystring=require(_0xf633('0xf'));var Papa=require(_0xf633('0x10'));var Redis=require('ioredis');var authService=require(_0xf633('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf633('0x12'));var hardwareService=require(_0xf633('0x13'));var logger=require(_0xf633('0x14'))(_0xf633('0x15'));var utils=require(_0xf633('0x16'));var config=require(_0xf633('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf633('0x18'))['db'];function respondWithStatusCode(_0x3c664f,_0x2dc3db){_0x2dc3db=_0x2dc3db||0xcc;return function(_0x12cbc1){if(_0x12cbc1){return _0x3c664f['sendStatus'](_0x2dc3db);}return _0x3c664f['status'](_0x2dc3db)[_0xf633('0x19')]();};}function respondWithResult(_0x3dce02,_0x1099a6){_0x1099a6=_0x1099a6||0xc8;return function(_0x10a167){if(_0x10a167){return _0x3dce02['status'](_0x1099a6)['json'](_0x10a167);}};}function respondWithFilteredResult(_0x4c4682,_0x27326b){return function(_0xcc40a4){if(_0xcc40a4){var _0x4f6468=typeof _0x27326b[_0xf633('0x1a')]===_0xf633('0x1b')&&typeof _0x27326b['limit']===_0xf633('0x1b');var _0x40f071=_0xcc40a4[_0xf633('0x1c')];var _0x5153f5=_0x4f6468?0x0:_0x27326b['offset'];var _0x2eec0a=_0x4f6468?_0xcc40a4[_0xf633('0x1c')]:_0x27326b['offset']+_0x27326b[_0xf633('0x1d')];var _0x20fef5;if(_0x2eec0a>=_0x40f071){_0x2eec0a=_0x40f071;_0x20fef5=0xc8;}else{_0x20fef5=0xce;}_0x4c4682['status'](_0x20fef5);return _0x4c4682[_0xf633('0x1e')](_0xf633('0x1f'),_0x5153f5+'-'+_0x2eec0a+'/'+_0x40f071)['json'](_0xcc40a4);}return null;};}function patchUpdates(_0x4ebbbd){return function(_0x36855a){try{jsonpatch[_0xf633('0x20')](_0x36855a,_0x4ebbbd,!![]);}catch(_0x38edac){return BPromise[_0xf633('0x21')](_0x38edac);}return _0x36855a['save']();};}function saveUpdates(_0x3b75cd,_0x23fbc0){return function(_0xb007c1){if(_0xb007c1){return _0xb007c1['update'](_0x3b75cd)[_0xf633('0x22')](function(_0x19eb62){return _0x19eb62;});}return null;};}function removeEntity(_0x27f717,_0x475bca){return function(_0x5158c8){if(_0x5158c8){return _0x5158c8[_0xf633('0x23')]()[_0xf633('0x22')](function(){_0x27f717[_0xf633('0x24')](0xcc)[_0xf633('0x19')]();});}};}function handleEntityNotFound(_0x13fc59,_0x5346b7){return function(_0x59dba8){if(!_0x59dba8){_0x13fc59[_0xf633('0x25')](0x194);}return _0x59dba8;};}function handleError(_0xe7ca74,_0x2ed208){_0x2ed208=_0x2ed208||0x1f4;return function(_0x30d9ab){logger[_0xf633('0x26')](_0x30d9ab['stack']);if(_0x30d9ab[_0xf633('0x27')]){delete _0x30d9ab[_0xf633('0x27')];}_0xe7ca74[_0xf633('0x24')](_0x2ed208)[_0xf633('0x28')](_0x30d9ab);};}exports[_0xf633('0x29')]=function(_0x3d2cd1,_0x102f80){var _0x3e9c1a={},_0x83e248={},_0x15c8d8={'count':0x0,'rows':[]};var _0x3eb287=_['map'](db[_0xf633('0x2a')][_0xf633('0x2b')],function(_0x4d007c){return{'name':_0x4d007c[_0xf633('0x2c')],'type':_0x4d007c['type'][_0xf633('0x2d')]};});_0x83e248[_0xf633('0x2e')]=_[_0xf633('0x2f')](_0x3eb287,_0xf633('0x27'));_0x83e248[_0xf633('0x30')]=_[_0xf633('0x31')](_0x3d2cd1[_0xf633('0x30')]);_0x83e248['filters']=_['intersection'](_0x83e248[_0xf633('0x2e')],_0x83e248['query']);_0x3e9c1a[_0xf633('0x32')]=_[_0xf633('0x33')](_0x83e248[_0xf633('0x2e')],qs['fields'](_0x3d2cd1[_0xf633('0x30')][_0xf633('0x34')]));_0x3e9c1a[_0xf633('0x32')]=_0x3e9c1a[_0xf633('0x32')][_0xf633('0x35')]?_0x3e9c1a[_0xf633('0x32')]:_0x83e248[_0xf633('0x2e')];if(!_0x3d2cd1['query'][_0xf633('0x36')](_0xf633('0x37'))){_0x3e9c1a['limit']=qs['limit'](_0x3d2cd1[_0xf633('0x30')][_0xf633('0x1d')]);_0x3e9c1a[_0xf633('0x1a')]=qs[_0xf633('0x1a')](_0x3d2cd1[_0xf633('0x30')][_0xf633('0x1a')]);}_0x3e9c1a[_0xf633('0x38')]=qs[_0xf633('0x39')](_0x3d2cd1['query'][_0xf633('0x39')]);_0x3e9c1a[_0xf633('0x3a')]=qs['filters'](_[_0xf633('0x3b')](_0x3d2cd1[_0xf633('0x30')],_0x83e248[_0xf633('0x3c')]),_0x3eb287);if(_0x3d2cd1[_0xf633('0x30')][_0xf633('0x3d')]){_0x3e9c1a[_0xf633('0x3a')]=_['merge'](_0x3e9c1a[_0xf633('0x3a')],{'$or':_[_0xf633('0x2f')](_0x3eb287,function(_0x2e3f8d){if(_0x2e3f8d[_0xf633('0x3e')]!==_0xf633('0x3f')){var _0x47a501={};_0x47a501[_0x2e3f8d[_0xf633('0x27')]]={'$like':'%'+_0x3d2cd1[_0xf633('0x30')][_0xf633('0x3d')]+'%'};return _0x47a501;}})});}_0x3e9c1a=_[_0xf633('0x40')]({},_0x3e9c1a,_0x3d2cd1[_0xf633('0x41')]);var _0x2fdd18={'where':_0x3e9c1a[_0xf633('0x3a')]};return db[_0xf633('0x2a')][_0xf633('0x1c')](_0x2fdd18)[_0xf633('0x22')](function(_0x553fb2){_0x15c8d8[_0xf633('0x1c')]=_0x553fb2;if(_0x3d2cd1[_0xf633('0x30')][_0xf633('0x42')]){_0x3e9c1a[_0xf633('0x43')]=[{'all':!![]}];}return db[_0xf633('0x2a')][_0xf633('0x44')](_0x3e9c1a);})[_0xf633('0x22')](function(_0x3ccfc2){_0x15c8d8[_0xf633('0x45')]=_0x3ccfc2;return _0x15c8d8;})[_0xf633('0x22')](respondWithFilteredResult(_0x102f80,_0x3e9c1a))[_0xf633('0x46')](handleError(_0x102f80,null));};exports['show']=function(_0x48bf4a,_0x914271){var _0x19b1ca={'raw':!![],'where':{'id':_0x48bf4a['params']['id']}},_0x1a91ff={};_0x1a91ff['model']=_['keys'](db[_0xf633('0x2a')][_0xf633('0x2b')]);_0x1a91ff['query']=_[_0xf633('0x31')](_0x48bf4a[_0xf633('0x30')]);_0x1a91ff['filters']=_[_0xf633('0x33')](_0x1a91ff[_0xf633('0x2e')],_0x1a91ff[_0xf633('0x30')]);_0x19b1ca[_0xf633('0x32')]=_[_0xf633('0x33')](_0x1a91ff['model'],qs[_0xf633('0x34')](_0x48bf4a[_0xf633('0x30')][_0xf633('0x34')]));_0x19b1ca[_0xf633('0x32')]=_0x19b1ca['attributes']['length']?_0x19b1ca[_0xf633('0x32')]:_0x1a91ff[_0xf633('0x2e')];if(_0x48bf4a[_0xf633('0x30')][_0xf633('0x42')]){_0x19b1ca['include']=[{'all':!![]}];}_0x19b1ca=_[_0xf633('0x40')]({},_0x19b1ca,_0x48bf4a[_0xf633('0x41')]);return db[_0xf633('0x2a')][_0xf633('0x47')](_0x19b1ca)[_0xf633('0x22')](handleEntityNotFound(_0x914271,null))[_0xf633('0x22')](respondWithResult(_0x914271,null))[_0xf633('0x46')](handleError(_0x914271,null));};exports[_0xf633('0x48')]=function(_0x2290e8,_0x32059e){return db['SquareRecording'][_0xf633('0x48')](_0x2290e8[_0xf633('0x49')],{})[_0xf633('0x22')](respondWithResult(_0x32059e,0xc9))[_0xf633('0x46')](handleError(_0x32059e,null));};exports[_0xf633('0x4a')]=function(_0x1afa6d,_0x52836d){if(_0x1afa6d[_0xf633('0x49')]['id']){delete _0x1afa6d[_0xf633('0x49')]['id'];}return db[_0xf633('0x2a')][_0xf633('0x47')]({'where':{'id':_0x1afa6d[_0xf633('0x4b')]['id']}})['then'](handleEntityNotFound(_0x52836d,null))['then'](saveUpdates(_0x1afa6d['body'],null))[_0xf633('0x22')](respondWithResult(_0x52836d,null))[_0xf633('0x46')](handleError(_0x52836d,null));};exports['download']=function(_0x3c4d48,_0x2d61f2,_0x5165d7){var _0x15048f=require('../../components/encryptor');var _0x48c7d6=![];var _0x4be15a={};if(_0x3c4d48['query'][_0xf633('0x3e')]&&_0x3c4d48['query'][_0xf633('0x3e')]===_0xf633('0x4c')){_0x4be15a[_0xf633('0x4c')]=_0x3c4d48[_0xf633('0x4b')]['id'];}else{_0x4be15a['id']=_0x3c4d48[_0xf633('0x4b')]['id'];}return db[_0xf633('0x2a')][_0xf633('0x47')]({'where':_0x4be15a,'attributes':['id',_0xf633('0x4d'),'filename'],'raw':!![]})[_0xf633('0x22')](handleEntityNotFound(_0x2d61f2,null))[_0xf633('0x22')](function(_0x19a02c){if(_0x19a02c){var _0x3b0111=_0x19a02c[_0xf633('0x4d')];var _0x78943f=util[_0xf633('0x4e')]('%s.cypher',_0x3b0111);if(fs[_0xf633('0x4f')](_0x78943f)){_0x48c7d6=!![];return _0x15048f['decryptFile'](_0x78943f,_0x3b0111,config[_0xf633('0x50')][_0xf633('0x51')])[_0xf633('0x22')](function(){return _0x19a02c;});}return _0x19a02c;}})['then'](function(_0x2976a5){if(_0x2976a5){var _0x23b12c=_0x2976a5[_0xf633('0x4d')];if(!fs[_0xf633('0x4f')](_0x23b12c)){throw new db[(_0xf633('0x52'))][(_0xf633('0x53'))](_0xf633('0x54'));}if(_0x2976a5[_0xf633('0x55')]){return _0x2d61f2['download'](_0x23b12c,_0x2976a5[_0xf633('0x55')]+path[_0xf633('0x56')](_0x23b12c),function(){if(_0x48c7d6){fs[_0xf633('0x57')](_0x23b12c);}});}else{return _0x2d61f2['download'](_0x23b12c,function(_0x448a42){if(_0x48c7d6){fs[_0xf633('0x57')](_0x23b12c);}});}}})[_0xf633('0x46')](function(_0x52de1a){if(_0x52de1a[_0xf633('0x58')]===_0xf633('0x54')){_0x2d61f2[_0xf633('0x24')](0x194)['send'](_0xf633('0x59'));}else{return handleError(_0x2d61f2,null);}});};exports[_0xf633('0x23')]=function(_0x4e04ed,_0x1f6c1a){return db['SquareRecording'][_0xf633('0x47')]({'where':{'id':_0x4e04ed['params']['id']}})[_0xf633('0x22')](function(_0x3aaccc){if(_[_0xf633('0x5a')](_0x3aaccc)){throw new ReferenceError(_0xf633('0x5b'));}return _0x3aaccc;})[_0xf633('0x22')](function(_0x1daf27){var _0x466ed4=_0x1daf27[_0xf633('0x4d')];logger[_0xf633('0x5c')](_0xf633('0x5d'),_0x466ed4);if(!_[_0xf633('0x5a')](_0x1daf27[_0xf633('0x4d')])&&fs['existsSync'](_0x466ed4)){logger[_0xf633('0x5c')](_0xf633('0x5e')+_0x466ed4+_0xf633('0x5f'));fs[_0xf633('0x60')](_0x466ed4);}_0x466ed4=_0x466ed4+_0xf633('0x61');if(!_[_0xf633('0x5a')](_0x1daf27[_0xf633('0x4d')])&&fs[_0xf633('0x4f')](_0x466ed4)){logger[_0xf633('0x5c')](_0xf633('0x5e')+_0x466ed4+_0xf633('0x5f'));fs[_0xf633('0x60')](_0x466ed4);}return _0x1daf27;})[_0xf633('0x22')](function(_0x3b4029){if(!_0x3b4029)throw new InternalError();return _0x3b4029['destroy']();})[_0xf633('0x22')](function(){_0x1f6c1a[_0xf633('0x24')](0xcc)['end']();})[_0xf633('0x46')](handleError(_0x1f6c1a,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index e9cbcc8..600e45e 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 _0x32f4=['./squareRecording.attributes','exports','SquareRecording','square_recordings','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x32f4,0x154));var _0x432f=function(_0x542c18,_0x454e04){_0x542c18=_0x542c18-0x0;var _0x1116ba=_0x32f4[_0x542c18];return _0x1116ba;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var logger=require(_0x432f('0x2'))(_0x432f('0x3'));var moment=require('moment');var BPromise=require(_0x432f('0x4'));var rp=require(_0x432f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var attributes=require(_0x432f('0x8'));module[_0x432f('0x9')]=function(_0x2f5f03,_0x5d8cc0){return _0x2f5f03['define'](_0x432f('0xa'),attributes,{'tableName':_0x432f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7958=['path','rimraf','../../config/environment','./squareRecording.attributes','define','square_recordings','lodash','util','api','moment','bluebird','request-promise'];(function(_0x14b770,_0xdcdeea){var _0x1747c8=function(_0x1187c3){while(--_0x1187c3){_0x14b770['push'](_0x14b770['shift']());}};_0x1747c8(++_0xdcdeea);}(_0x7958,0x126));var _0x8795=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7958[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8795('0x0'));var util=require(_0x8795('0x1'));var logger=require('../../config/logger')(_0x8795('0x2'));var moment=require(_0x8795('0x3'));var BPromise=require(_0x8795('0x4'));var rp=require(_0x8795('0x5'));var fs=require('fs');var path=require(_0x8795('0x6'));var rimraf=require(_0x8795('0x7'));var config=require(_0x8795('0x8'));var attributes=require(_0x8795('0x9'));module['exports']=function(_0xed1860,_0x456403){return _0xed1860[_0x8795('0xa')]('SquareRecording',attributes,{'tableName':_0x8795('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 3e5286a..a675b4f 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 _0xff18=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateSquareRecording','SquareRecording','create','options','debug','lodash','util','moment'];(function(_0x35152c,_0x6b0a51){var _0x17b32f=function(_0xfa0c74){while(--_0xfa0c74){_0x35152c['push'](_0x35152c['shift']());}};_0x17b32f(++_0x6b0a51);}(_0xff18,0x6d));var _0x8ff1=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0xff18[_0x11a55c];return _0x26c390;};'use strict';var _=require(_0x8ff1('0x0'));var util=require(_0x8ff1('0x1'));var moment=require(_0x8ff1('0x2'));var BPromise=require(_0x8ff1('0x3'));var rs=require(_0x8ff1('0x4'));var fs=require('fs');var Redis=require(_0x8ff1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8ff1('0x6'));var logger=require(_0x8ff1('0x7'))(_0x8ff1('0x8'));var config=require(_0x8ff1('0x9'));var jayson=require(_0x8ff1('0xa'));var client=jayson[_0x8ff1('0xb')][_0x8ff1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3a5378,_0x4a90c9,_0x2b469f){return new BPromise(function(_0xd47664,_0x193c46){return client[_0x8ff1('0xd')](_0x3a5378,_0x2b469f)[_0x8ff1('0xe')](function(_0xbb663d){logger[_0x8ff1('0xf')](_0x8ff1('0x10'),_0x4a90c9,_0x8ff1('0x11'));logger['debug'](_0x8ff1('0x12'),_0x4a90c9,_0x8ff1('0x11'),JSON[_0x8ff1('0x13')](_0xbb663d));if(_0xbb663d['error']){if(_0xbb663d['error']['code']===0x1f4){logger[_0x8ff1('0x14')](_0x8ff1('0x10'),_0x4a90c9,_0xbb663d[_0x8ff1('0x14')][_0x8ff1('0x15')]);return _0x193c46(_0xbb663d[_0x8ff1('0x14')]['message']);}logger[_0x8ff1('0x14')]('SquareRecording,\x20%s,\x20%s',_0x4a90c9,_0xbb663d['error'][_0x8ff1('0x15')]);return _0xd47664(_0xbb663d[_0x8ff1('0x14')][_0x8ff1('0x15')]);}else{logger[_0x8ff1('0xf')](_0x8ff1('0x10'),_0x4a90c9,_0x8ff1('0x11'));_0xd47664(_0xbb663d[_0x8ff1('0x16')][_0x8ff1('0x15')]);}})['catch'](function(_0x2f15fd){logger[_0x8ff1('0x14')](_0x8ff1('0x10'),_0x4a90c9,_0x2f15fd);_0x193c46(_0x2f15fd);});});}exports[_0x8ff1('0x17')]=function(_0x42ad2a){var _0x129eec=this;return new Promise(function(_0x320e9c,_0x2bafbb){return db[_0x8ff1('0x18')][_0x8ff1('0x19')](_0x42ad2a['body'],{'raw':_0x42ad2a[_0x8ff1('0x1a')]?_0x42ad2a[_0x8ff1('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3a8868){logger[_0x8ff1('0xf')](_0x8ff1('0x17'),_0x42ad2a);logger[_0x8ff1('0x1b')](_0x8ff1('0x17'),_0x42ad2a,JSON[_0x8ff1('0x13')](_0x3a8868));_0x320e9c(_0x3a8868);})['catch'](function(_0x14363a){logger['error'](_0x8ff1('0x17'),_0x14363a['message'],_0x42ad2a);_0x2bafbb(_0x129eec['error'](0x1f4,_0x14363a['message']));});});}; \ No newline at end of file +var _0x41f8=['SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','create','body','options','raw','then','CreateSquareRecording','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info'];(function(_0x51c699,_0x38d5f4){var _0x418e9f=function(_0x3344e0){while(--_0x3344e0){_0x51c699['push'](_0x51c699['shift']());}};_0x418e9f(++_0x38d5f4);}(_0x41f8,0x142));var _0x841f=function(_0x412446,_0x29fc75){_0x412446=_0x412446-0x0;var _0x51fb14=_0x41f8[_0x412446];return _0x51fb14;};'use strict';var _=require(_0x841f('0x0'));var util=require(_0x841f('0x1'));var moment=require(_0x841f('0x2'));var BPromise=require(_0x841f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x841f('0x4'));var db=require(_0x841f('0x5'))['db'];var utils=require(_0x841f('0x6'));var logger=require(_0x841f('0x7'))(_0x841f('0x8'));var config=require(_0x841f('0x9'));var jayson=require(_0x841f('0xa'));var client=jayson['client'][_0x841f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ffdcc,_0x43543b,_0x4e6de1){return new BPromise(function(_0x21d458,_0x1ae366){return client[_0x841f('0xc')](_0x2ffdcc,_0x4e6de1)['then'](function(_0x24d859){logger[_0x841f('0xd')](_0x841f('0xe'),_0x43543b,_0x841f('0xf'));logger[_0x841f('0x10')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x43543b,'request\x20sent',JSON[_0x841f('0x11')](_0x24d859));if(_0x24d859[_0x841f('0x12')]){if(_0x24d859[_0x841f('0x12')]['code']===0x1f4){logger['error'](_0x841f('0xe'),_0x43543b,_0x24d859['error']['message']);return _0x1ae366(_0x24d859['error'][_0x841f('0x13')]);}logger[_0x841f('0x12')](_0x841f('0xe'),_0x43543b,_0x24d859[_0x841f('0x12')][_0x841f('0x13')]);return _0x21d458(_0x24d859[_0x841f('0x12')][_0x841f('0x13')]);}else{logger[_0x841f('0xd')](_0x841f('0xe'),_0x43543b,_0x841f('0xf'));_0x21d458(_0x24d859[_0x841f('0x14')][_0x841f('0x13')]);}})['catch'](function(_0x1b05b3){logger['error'](_0x841f('0xe'),_0x43543b,_0x1b05b3);_0x1ae366(_0x1b05b3);});});}exports['CreateSquareRecording']=function(_0x501e19){var _0x3ff392=this;return new Promise(function(_0x18516e,_0x43c4cf){return db['SquareRecording'][_0x841f('0x15')](_0x501e19[_0x841f('0x16')],{'raw':_0x501e19[_0x841f('0x17')]?_0x501e19[_0x841f('0x17')][_0x841f('0x18')]===undefined?!![]:![]:!![]})[_0x841f('0x19')](function(_0x1895c6){logger[_0x841f('0xd')]('CreateSquareRecording',_0x501e19);logger[_0x841f('0x10')](_0x841f('0x1a'),_0x501e19,JSON[_0x841f('0x11')](_0x1895c6));_0x18516e(_0x1895c6);})[_0x841f('0x1b')](function(_0x280ea7){logger[_0x841f('0x12')](_0x841f('0x1a'),_0x280ea7[_0x841f('0x13')],_0x501e19);_0x43c4cf(_0x3ff392[_0x841f('0x12')](0x1f4,_0x280ea7[_0x841f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 9f3cb96..d805bba 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x3061b9,_0x5afcb1){var _0x50a145=function(_0x260253){while(--_0x260253){_0x3061b9['push'](_0x3061b9['shift']());}};_0x50a145(++_0x5afcb1);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x411c4e,_0xcd62ee){var _0x2a2403=function(_0x37c6c8){while(--_0x37c6c8){_0x411c4e['push'](_0x411c4e['shift']());}};_0x2a2403(++_0xcd62ee);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 5fa88d6..0d6338f 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 _0x2a0b=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x179b53,_0x31f6fe){var _0x38a146=function(_0x33f0c2){while(--_0x33f0c2){_0x179b53['push'](_0x179b53['shift']());}};_0x38a146(++_0x31f6fe);}(_0x2a0b,0xcc));var _0xb2a0=function(_0xa638b1,_0x3fb119){_0xa638b1=_0xa638b1-0x0;var _0x195343=_0x2a0b[_0xa638b1];return _0x195343;};'use strict';var Sequelize=require(_0xb2a0('0x0'));module[_0xb2a0('0x1')]={'network':{'type':Sequelize[_0xb2a0('0x2')]},'network_script':{'type':Sequelize[_0xb2a0('0x2')]},'request':{'type':Sequelize[_0xb2a0('0x2')]},'channel':{'type':Sequelize[_0xb2a0('0x2')]},'language':{'type':Sequelize[_0xb2a0('0x2')]},'type':{'type':Sequelize[_0xb2a0('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xb2a0('0x2')]},'callingani2':{'type':Sequelize[_0xb2a0('0x2')]},'callington':{'type':Sequelize[_0xb2a0('0x2')]},'callingtns':{'type':Sequelize[_0xb2a0('0x2')]},'dnid':{'type':Sequelize[_0xb2a0('0x2')]},'rdnis':{'type':Sequelize[_0xb2a0('0x2')]},'context':{'type':Sequelize[_0xb2a0('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb2a0('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb2a0('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xb2a0('0x2')]},'joinAt':{'type':Sequelize[_0xb2a0('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xb2a0('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xfc8d=['exports','STRING','DATE','BOOLEAN'];(function(_0xb26ae3,_0x47f3c3){var _0xa73f74=function(_0x2b9aa2){while(--_0x2b9aa2){_0xb26ae3['push'](_0xb26ae3['shift']());}};_0xa73f74(++_0x47f3c3);}(_0xfc8d,0x10c));var _0xdfc8=function(_0x3ac16c,_0x54c187){_0x3ac16c=_0x3ac16c-0x0;var _0x1204e6=_0xfc8d[_0x3ac16c];return _0x1204e6;};'use strict';var Sequelize=require('sequelize');module[_0xdfc8('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xdfc8('0x1')]},'language':{'type':Sequelize[_0xdfc8('0x1')]},'type':{'type':Sequelize[_0xdfc8('0x1')]},'uniqueid':{'type':Sequelize[_0xdfc8('0x1')]},'version':{'type':Sequelize[_0xdfc8('0x1')]},'callerid':{'type':Sequelize[_0xdfc8('0x1')]},'calleridname':{'type':Sequelize[_0xdfc8('0x1')]},'callingpres':{'type':Sequelize[_0xdfc8('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xdfc8('0x1')]},'dnid':{'type':Sequelize[_0xdfc8('0x1')]},'rdnis':{'type':Sequelize[_0xdfc8('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xdfc8('0x1')]},'priority':{'type':Sequelize[_0xdfc8('0x1')]},'enhanced':{'type':Sequelize[_0xdfc8('0x1')]},'accountcode':{'type':Sequelize[_0xdfc8('0x1')]},'threadid':{'type':Sequelize[_0xdfc8('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xdfc8('0x2')]},'bot':{'type':Sequelize[_0xdfc8('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 349ab05..87ff897 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 _0xbca6=['set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','SquareReport','rawAttributes','fieldName','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','type','includeAll','findAll','catch','show','params','keys','include','options','find','create','body','describe','eml-format','rimraf','moment','mustache','util','path','sox','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','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x32edf5,_0x3426ff){var _0x38efdf=function(_0x5b97a5){while(--_0x5b97a5){_0x32edf5['push'](_0x32edf5['shift']());}};_0x38efdf(++_0x3426ff);}(_0xbca6,0x1a8));var _0x6bca=function(_0xca169a,_0x43e73e){_0xca169a=_0xca169a-0x0;var _0x5c3f9d=_0xbca6[_0xca169a];return _0x5c3f9d;};'use strict';var emlformat=require(_0x6bca('0x0'));var rimraf=require(_0x6bca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6bca('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6bca('0x3'));var util=require(_0x6bca('0x4'));var path=require(_0x6bca('0x5'));var sox=require(_0x6bca('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6bca('0x7'));var squel=require(_0x6bca('0x8'));var crypto=require(_0x6bca('0x9'));var jsforce=require(_0x6bca('0xa'));var deskjs=require(_0x6bca('0xb'));var toCsv=require(_0x6bca('0xc'));var querystring=require(_0x6bca('0xd'));var Papa=require(_0x6bca('0xe'));var Redis=require(_0x6bca('0xf'));var authService=require(_0x6bca('0x10'));var qs=require(_0x6bca('0x11'));var as=require(_0x6bca('0x12'));var hardwareService=require(_0x6bca('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x6bca('0x14'));var config=require(_0x6bca('0x15'));var licenseUtil=require(_0x6bca('0x16'));var db=require(_0x6bca('0x17'))['db'];function respondWithStatusCode(_0x2f559e,_0x367340){_0x367340=_0x367340||0xcc;return function(_0x54324e){if(_0x54324e){return _0x2f559e[_0x6bca('0x18')](_0x367340);}return _0x2f559e[_0x6bca('0x19')](_0x367340)[_0x6bca('0x1a')]();};}function respondWithResult(_0x579453,_0x30ca88){_0x30ca88=_0x30ca88||0xc8;return function(_0xb50042){if(_0xb50042){return _0x579453[_0x6bca('0x19')](_0x30ca88)[_0x6bca('0x1b')](_0xb50042);}};}function respondWithFilteredResult(_0x3ad817,_0x43f4af){return function(_0x46dc7b){if(_0x46dc7b){var _0x1116d0=typeof _0x43f4af[_0x6bca('0x1c')]===_0x6bca('0x1d')&&typeof _0x43f4af[_0x6bca('0x1e')]===_0x6bca('0x1d');var _0x33cef6=_0x46dc7b['count'];var _0x57b583=_0x1116d0?0x0:_0x43f4af[_0x6bca('0x1c')];var _0x3266a1=_0x1116d0?_0x46dc7b[_0x6bca('0x1f')]:_0x43f4af[_0x6bca('0x1c')]+_0x43f4af[_0x6bca('0x1e')];var _0xd9c063;if(_0x3266a1>=_0x33cef6){_0x3266a1=_0x33cef6;_0xd9c063=0xc8;}else{_0xd9c063=0xce;}_0x3ad817['status'](_0xd9c063);return _0x3ad817[_0x6bca('0x20')](_0x6bca('0x21'),_0x57b583+'-'+_0x3266a1+'/'+_0x33cef6)['json'](_0x46dc7b);}return null;};}function patchUpdates(_0x4f8183){return function(_0x19fcec){try{jsonpatch[_0x6bca('0x22')](_0x19fcec,_0x4f8183,!![]);}catch(_0x35f9dd){return BPromise[_0x6bca('0x23')](_0x35f9dd);}return _0x19fcec[_0x6bca('0x24')]();};}function saveUpdates(_0x5defc3,_0x4701c6){return function(_0xec655f){if(_0xec655f){return _0xec655f[_0x6bca('0x25')](_0x5defc3)[_0x6bca('0x26')](function(_0x53b6f4){return _0x53b6f4;});}return null;};}function removeEntity(_0x2da3c8,_0x2fdfb1){return function(_0x50e440){if(_0x50e440){return _0x50e440[_0x6bca('0x27')]()[_0x6bca('0x26')](function(){_0x2da3c8[_0x6bca('0x19')](0xcc)[_0x6bca('0x1a')]();});}};}function handleEntityNotFound(_0xdef7de,_0xeed71b){return function(_0x476cfd){if(!_0x476cfd){_0xdef7de[_0x6bca('0x18')](0x194);}return _0x476cfd;};}function handleError(_0x3a7f3b,_0x171a8e){_0x171a8e=_0x171a8e||0x1f4;return function(_0x549118){logger[_0x6bca('0x28')](_0x549118[_0x6bca('0x29')]);if(_0x549118[_0x6bca('0x2a')]){delete _0x549118[_0x6bca('0x2a')];}_0x3a7f3b['status'](_0x171a8e)[_0x6bca('0x2b')](_0x549118);};}exports[_0x6bca('0x2c')]=function(_0x3f5ee5,_0x351f0f){var _0x21bf79={},_0x2439c0={},_0x53bf5b={'count':0x0,'rows':[]};var _0x4c96fd=_['map'](db[_0x6bca('0x2d')][_0x6bca('0x2e')],function(_0x156ecc){return{'name':_0x156ecc[_0x6bca('0x2f')],'type':_0x156ecc['type'][_0x6bca('0x30')]};});_0x2439c0[_0x6bca('0x31')]=_[_0x6bca('0x32')](_0x4c96fd,_0x6bca('0x2a'));_0x2439c0[_0x6bca('0x33')]=_['keys'](_0x3f5ee5[_0x6bca('0x33')]);_0x2439c0[_0x6bca('0x34')]=_['intersection'](_0x2439c0[_0x6bca('0x31')],_0x2439c0[_0x6bca('0x33')]);_0x21bf79['attributes']=_[_0x6bca('0x35')](_0x2439c0['model'],qs[_0x6bca('0x36')](_0x3f5ee5[_0x6bca('0x33')][_0x6bca('0x36')]));_0x21bf79[_0x6bca('0x37')]=_0x21bf79[_0x6bca('0x37')][_0x6bca('0x38')]?_0x21bf79[_0x6bca('0x37')]:_0x2439c0[_0x6bca('0x31')];if(!_0x3f5ee5[_0x6bca('0x33')][_0x6bca('0x39')]('nolimit')){_0x21bf79[_0x6bca('0x1e')]=qs[_0x6bca('0x1e')](_0x3f5ee5[_0x6bca('0x33')][_0x6bca('0x1e')]);_0x21bf79[_0x6bca('0x1c')]=qs[_0x6bca('0x1c')](_0x3f5ee5[_0x6bca('0x33')][_0x6bca('0x1c')]);}_0x21bf79['order']=qs['sort'](_0x3f5ee5[_0x6bca('0x33')][_0x6bca('0x3a')]);_0x21bf79[_0x6bca('0x3b')]=qs[_0x6bca('0x34')](_[_0x6bca('0x3c')](_0x3f5ee5[_0x6bca('0x33')],_0x2439c0['filters']),_0x4c96fd);if(_0x3f5ee5[_0x6bca('0x33')][_0x6bca('0x3d')]){_0x21bf79[_0x6bca('0x3b')]=_[_0x6bca('0x3e')](_0x21bf79[_0x6bca('0x3b')],{'$or':_[_0x6bca('0x32')](_0x4c96fd,function(_0x3f65de){if(_0x3f65de[_0x6bca('0x3f')]!=='VIRTUAL'){var _0x2fe611={};_0x2fe611[_0x3f65de[_0x6bca('0x2a')]]={'$like':'%'+_0x3f5ee5[_0x6bca('0x33')][_0x6bca('0x3d')]+'%'};return _0x2fe611;}})});}_0x21bf79=_[_0x6bca('0x3e')]({},_0x21bf79,_0x3f5ee5['options']);var _0x52fd2c={'where':_0x21bf79[_0x6bca('0x3b')]};return db[_0x6bca('0x2d')][_0x6bca('0x1f')](_0x52fd2c)['then'](function(_0x827c08){_0x53bf5b['count']=_0x827c08;if(_0x3f5ee5['query'][_0x6bca('0x40')]){_0x21bf79['include']=[{'all':!![]}];}return db[_0x6bca('0x2d')][_0x6bca('0x41')](_0x21bf79);})[_0x6bca('0x26')](function(_0x2ec603){_0x53bf5b['rows']=_0x2ec603;return _0x53bf5b;})[_0x6bca('0x26')](respondWithFilteredResult(_0x351f0f,_0x21bf79))[_0x6bca('0x42')](handleError(_0x351f0f,null));};exports[_0x6bca('0x43')]=function(_0x30846c,_0x551454){var _0x12ef38={'raw':!![],'where':{'id':_0x30846c[_0x6bca('0x44')]['id']}},_0x5d9f9b={};_0x5d9f9b[_0x6bca('0x31')]=_['keys'](db[_0x6bca('0x2d')][_0x6bca('0x2e')]);_0x5d9f9b[_0x6bca('0x33')]=_[_0x6bca('0x45')](_0x30846c[_0x6bca('0x33')]);_0x5d9f9b[_0x6bca('0x34')]=_[_0x6bca('0x35')](_0x5d9f9b[_0x6bca('0x31')],_0x5d9f9b[_0x6bca('0x33')]);_0x12ef38['attributes']=_[_0x6bca('0x35')](_0x5d9f9b[_0x6bca('0x31')],qs[_0x6bca('0x36')](_0x30846c[_0x6bca('0x33')][_0x6bca('0x36')]));_0x12ef38[_0x6bca('0x37')]=_0x12ef38['attributes'][_0x6bca('0x38')]?_0x12ef38[_0x6bca('0x37')]:_0x5d9f9b['model'];if(_0x30846c['query'][_0x6bca('0x40')]){_0x12ef38[_0x6bca('0x46')]=[{'all':!![]}];}_0x12ef38=_['merge']({},_0x12ef38,_0x30846c[_0x6bca('0x47')]);return db['SquareReport'][_0x6bca('0x48')](_0x12ef38)[_0x6bca('0x26')](handleEntityNotFound(_0x551454,null))['then'](respondWithResult(_0x551454,null))[_0x6bca('0x42')](handleError(_0x551454,null));};exports[_0x6bca('0x49')]=function(_0x4bf855,_0x4ec828){return db[_0x6bca('0x2d')][_0x6bca('0x49')](_0x4bf855['body'],{})[_0x6bca('0x26')](respondWithResult(_0x4ec828,0xc9))[_0x6bca('0x42')](handleError(_0x4ec828,null));};exports[_0x6bca('0x25')]=function(_0x15e565,_0x239cea){if(_0x15e565[_0x6bca('0x4a')]['id']){delete _0x15e565[_0x6bca('0x4a')]['id'];}return db[_0x6bca('0x2d')][_0x6bca('0x48')]({'where':{'id':_0x15e565['params']['id']}})[_0x6bca('0x26')](handleEntityNotFound(_0x239cea,null))[_0x6bca('0x26')](saveUpdates(_0x15e565[_0x6bca('0x4a')],null))[_0x6bca('0x26')](respondWithResult(_0x239cea,null))[_0x6bca('0x42')](handleError(_0x239cea,null));};exports[_0x6bca('0x27')]=function(_0x18f460,_0x1890a0){return db[_0x6bca('0x2d')][_0x6bca('0x48')]({'where':{'id':_0x18f460[_0x6bca('0x44')]['id']}})['then'](handleEntityNotFound(_0x1890a0,null))[_0x6bca('0x26')](removeEntity(_0x1890a0,null))[_0x6bca('0x42')](handleError(_0x1890a0,null));};exports['describe']=function(_0x17cf1c,_0x5c2af6){return db[_0x6bca('0x2d')][_0x6bca('0x4b')]()[_0x6bca('0x26')](respondWithResult(_0x5c2af6,null))[_0x6bca('0x42')](handleError(_0x5c2af6,null));}; \ No newline at end of file +var _0x8c37=['find','create','update','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','destroy','then','error','stack','name','send','SquareReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','catch','params','options'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x8c37,0x130));var _0x78c3=function(_0x5de332,_0x4889d0){_0x5de332=_0x5de332-0x0;var _0x52e0e4=_0x8c37[_0x5de332];return _0x52e0e4;};'use strict';var emlformat=require(_0x78c3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x78c3('0x1'));var jsonpatch=require(_0x78c3('0x2'));var rp=require(_0x78c3('0x3'));var moment=require(_0x78c3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x78c3('0x5'));var util=require(_0x78c3('0x6'));var path=require(_0x78c3('0x7'));var sox=require(_0x78c3('0x8'));var csv=require(_0x78c3('0x9'));var ejs=require(_0x78c3('0xa'));var fs=require('fs');var fs_extra=require(_0x78c3('0xb'));var _=require('lodash');var squel=require(_0x78c3('0xc'));var crypto=require('crypto');var jsforce=require(_0x78c3('0xd'));var deskjs=require(_0x78c3('0xe'));var toCsv=require(_0x78c3('0x9'));var querystring=require(_0x78c3('0xf'));var Papa=require(_0x78c3('0x10'));var Redis=require(_0x78c3('0x11'));var authService=require(_0x78c3('0x12'));var qs=require(_0x78c3('0x13'));var as=require(_0x78c3('0x14'));var hardwareService=require(_0x78c3('0x15'));var logger=require(_0x78c3('0x16'))('api');var utils=require(_0x78c3('0x17'));var config=require(_0x78c3('0x18'));var licenseUtil=require(_0x78c3('0x19'));var db=require(_0x78c3('0x1a'))['db'];function respondWithStatusCode(_0x5a3094,_0x1d0fc0){_0x1d0fc0=_0x1d0fc0||0xcc;return function(_0x1dc0e0){if(_0x1dc0e0){return _0x5a3094[_0x78c3('0x1b')](_0x1d0fc0);}return _0x5a3094['status'](_0x1d0fc0)[_0x78c3('0x1c')]();};}function respondWithResult(_0x2f09e0,_0x1f76fc){_0x1f76fc=_0x1f76fc||0xc8;return function(_0x37fd00){if(_0x37fd00){return _0x2f09e0[_0x78c3('0x1d')](_0x1f76fc)[_0x78c3('0x1e')](_0x37fd00);}};}function respondWithFilteredResult(_0x3f2378,_0x59c331){return function(_0x9d2856){if(_0x9d2856){var _0x3a081f=typeof _0x59c331['offset']===_0x78c3('0x1f')&&typeof _0x59c331[_0x78c3('0x20')]===_0x78c3('0x1f');var _0x157f11=_0x9d2856[_0x78c3('0x21')];var _0x44977c=_0x3a081f?0x0:_0x59c331[_0x78c3('0x22')];var _0x8bc494=_0x3a081f?_0x9d2856['count']:_0x59c331[_0x78c3('0x22')]+_0x59c331[_0x78c3('0x20')];var _0x3ac456;if(_0x8bc494>=_0x157f11){_0x8bc494=_0x157f11;_0x3ac456=0xc8;}else{_0x3ac456=0xce;}_0x3f2378[_0x78c3('0x1d')](_0x3ac456);return _0x3f2378[_0x78c3('0x23')](_0x78c3('0x24'),_0x44977c+'-'+_0x8bc494+'/'+_0x157f11)[_0x78c3('0x1e')](_0x9d2856);}return null;};}function patchUpdates(_0x5875da){return function(_0x5d32a3){try{jsonpatch[_0x78c3('0x25')](_0x5d32a3,_0x5875da,!![]);}catch(_0x200d7a){return BPromise[_0x78c3('0x26')](_0x200d7a);}return _0x5d32a3['save']();};}function saveUpdates(_0x2f6efe,_0x3cd998){return function(_0x4c9ba8){if(_0x4c9ba8){return _0x4c9ba8['update'](_0x2f6efe)['then'](function(_0x3da703){return _0x3da703;});}return null;};}function removeEntity(_0xf00fd,_0xcdb3f0){return function(_0x397442){if(_0x397442){return _0x397442[_0x78c3('0x27')]()[_0x78c3('0x28')](function(){_0xf00fd[_0x78c3('0x1d')](0xcc)[_0x78c3('0x1c')]();});}};}function handleEntityNotFound(_0x583fff,_0x2cf790){return function(_0x53ec99){if(!_0x53ec99){_0x583fff[_0x78c3('0x1b')](0x194);}return _0x53ec99;};}function handleError(_0xb7954f,_0x102ed4){_0x102ed4=_0x102ed4||0x1f4;return function(_0x25f2ca){logger[_0x78c3('0x29')](_0x25f2ca[_0x78c3('0x2a')]);if(_0x25f2ca['name']){delete _0x25f2ca[_0x78c3('0x2b')];}_0xb7954f[_0x78c3('0x1d')](_0x102ed4)[_0x78c3('0x2c')](_0x25f2ca);};}exports['index']=function(_0x387bdc,_0x4b5286){var _0x3a458d={},_0x10b02f={},_0x14da05={'count':0x0,'rows':[]};var _0x5ad364=_['map'](db[_0x78c3('0x2d')][_0x78c3('0x2e')],function(_0x41c879){return{'name':_0x41c879['fieldName'],'type':_0x41c879[_0x78c3('0x2f')][_0x78c3('0x30')]};});_0x10b02f[_0x78c3('0x31')]=_[_0x78c3('0x32')](_0x5ad364,_0x78c3('0x2b'));_0x10b02f[_0x78c3('0x33')]=_[_0x78c3('0x34')](_0x387bdc['query']);_0x10b02f[_0x78c3('0x35')]=_[_0x78c3('0x36')](_0x10b02f[_0x78c3('0x31')],_0x10b02f[_0x78c3('0x33')]);_0x3a458d[_0x78c3('0x37')]=_[_0x78c3('0x36')](_0x10b02f[_0x78c3('0x31')],qs[_0x78c3('0x38')](_0x387bdc[_0x78c3('0x33')][_0x78c3('0x38')]));_0x3a458d['attributes']=_0x3a458d[_0x78c3('0x37')][_0x78c3('0x39')]?_0x3a458d['attributes']:_0x10b02f[_0x78c3('0x31')];if(!_0x387bdc['query']['hasOwnProperty'](_0x78c3('0x3a'))){_0x3a458d[_0x78c3('0x20')]=qs[_0x78c3('0x20')](_0x387bdc[_0x78c3('0x33')][_0x78c3('0x20')]);_0x3a458d[_0x78c3('0x22')]=qs[_0x78c3('0x22')](_0x387bdc['query'][_0x78c3('0x22')]);}_0x3a458d[_0x78c3('0x3b')]=qs['sort'](_0x387bdc[_0x78c3('0x33')][_0x78c3('0x3c')]);_0x3a458d[_0x78c3('0x3d')]=qs[_0x78c3('0x35')](_[_0x78c3('0x3e')](_0x387bdc[_0x78c3('0x33')],_0x10b02f[_0x78c3('0x35')]),_0x5ad364);if(_0x387bdc[_0x78c3('0x33')][_0x78c3('0x3f')]){_0x3a458d[_0x78c3('0x3d')]=_['merge'](_0x3a458d[_0x78c3('0x3d')],{'$or':_[_0x78c3('0x32')](_0x5ad364,function(_0xd4ecf8){if(_0xd4ecf8[_0x78c3('0x2f')]!==_0x78c3('0x40')){var _0x51104e={};_0x51104e[_0xd4ecf8['name']]={'$like':'%'+_0x387bdc[_0x78c3('0x33')]['filter']+'%'};return _0x51104e;}})});}_0x3a458d=_[_0x78c3('0x41')]({},_0x3a458d,_0x387bdc['options']);var _0x15e3cd={'where':_0x3a458d[_0x78c3('0x3d')]};return db[_0x78c3('0x2d')][_0x78c3('0x21')](_0x15e3cd)[_0x78c3('0x28')](function(_0xa3306a){_0x14da05[_0x78c3('0x21')]=_0xa3306a;if(_0x387bdc['query'][_0x78c3('0x42')]){_0x3a458d[_0x78c3('0x43')]=[{'all':!![]}];}return db[_0x78c3('0x2d')]['findAll'](_0x3a458d);})[_0x78c3('0x28')](function(_0x5b09a1){_0x14da05['rows']=_0x5b09a1;return _0x14da05;})['then'](respondWithFilteredResult(_0x4b5286,_0x3a458d))[_0x78c3('0x44')](handleError(_0x4b5286,null));};exports['show']=function(_0x344f8f,_0xcf309f){var _0x52cab3={'raw':!![],'where':{'id':_0x344f8f[_0x78c3('0x45')]['id']}},_0x3f7efd={};_0x3f7efd[_0x78c3('0x31')]=_['keys'](db['SquareReport'][_0x78c3('0x2e')]);_0x3f7efd[_0x78c3('0x33')]=_[_0x78c3('0x34')](_0x344f8f[_0x78c3('0x33')]);_0x3f7efd['filters']=_[_0x78c3('0x36')](_0x3f7efd[_0x78c3('0x31')],_0x3f7efd['query']);_0x52cab3[_0x78c3('0x37')]=_[_0x78c3('0x36')](_0x3f7efd[_0x78c3('0x31')],qs['fields'](_0x344f8f[_0x78c3('0x33')][_0x78c3('0x38')]));_0x52cab3[_0x78c3('0x37')]=_0x52cab3[_0x78c3('0x37')][_0x78c3('0x39')]?_0x52cab3[_0x78c3('0x37')]:_0x3f7efd[_0x78c3('0x31')];if(_0x344f8f[_0x78c3('0x33')]['includeAll']){_0x52cab3[_0x78c3('0x43')]=[{'all':!![]}];}_0x52cab3=_['merge']({},_0x52cab3,_0x344f8f[_0x78c3('0x46')]);return db[_0x78c3('0x2d')][_0x78c3('0x47')](_0x52cab3)[_0x78c3('0x28')](handleEntityNotFound(_0xcf309f,null))['then'](respondWithResult(_0xcf309f,null))[_0x78c3('0x44')](handleError(_0xcf309f,null));};exports[_0x78c3('0x48')]=function(_0x103265,_0x3aa54f){return db[_0x78c3('0x2d')]['create'](_0x103265['body'],{})[_0x78c3('0x28')](respondWithResult(_0x3aa54f,0xc9))['catch'](handleError(_0x3aa54f,null));};exports[_0x78c3('0x49')]=function(_0x592439,_0x390267){if(_0x592439[_0x78c3('0x4a')]['id']){delete _0x592439[_0x78c3('0x4a')]['id'];}return db[_0x78c3('0x2d')]['find']({'where':{'id':_0x592439[_0x78c3('0x45')]['id']}})[_0x78c3('0x28')](handleEntityNotFound(_0x390267,null))[_0x78c3('0x28')](saveUpdates(_0x592439['body'],null))[_0x78c3('0x28')](respondWithResult(_0x390267,null))[_0x78c3('0x44')](handleError(_0x390267,null));};exports[_0x78c3('0x27')]=function(_0x426051,_0x34272b){return db['SquareReport'][_0x78c3('0x47')]({'where':{'id':_0x426051[_0x78c3('0x45')]['id']}})[_0x78c3('0x28')](handleEntityNotFound(_0x34272b,null))['then'](removeEntity(_0x34272b,null))['catch'](handleError(_0x34272b,null));};exports['describe']=function(_0x591f83,_0x945418){return db[_0x78c3('0x2d')]['describe']()[_0x78c3('0x28')](respondWithResult(_0x945418,null))[_0x78c3('0x44')](handleError(_0x945418,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 3bfb447..7f591ad 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 _0x1c16=['moment','path','rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api'];(function(_0x283027,_0x2608c0){var _0x52d12a=function(_0x313167){while(--_0x313167){_0x283027['push'](_0x283027['shift']());}};_0x52d12a(++_0x2608c0);}(_0x1c16,0x19c));var _0x61c1=function(_0x32e9e9,_0x3df5aa){_0x32e9e9=_0x32e9e9-0x0;var _0x400b63=_0x1c16[_0x32e9e9];return _0x400b63;};'use strict';var _=require(_0x61c1('0x0'));var util=require(_0x61c1('0x1'));var logger=require(_0x61c1('0x2'))(_0x61c1('0x3'));var moment=require(_0x61c1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x61c1('0x5'));var rimraf=require(_0x61c1('0x6'));var config=require(_0x61c1('0x7'));var attributes=require(_0x61c1('0x8'));module[_0x61c1('0x9')]=function(_0x3862ec,_0x15c795){return _0x3862ec['define'](_0x61c1('0xa'),attributes,{'tableName':_0x61c1('0xb'),'paranoid':![],'indexes':[{'name':_0x61c1('0xc'),'fields':[_0x61c1('0xd'),_0x61c1('0xe')]},{'name':_0x61c1('0xf'),'fields':[_0x61c1('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x02e8=['uid_pname','uniqueid','project_name','leaveAt','lodash','util','api','moment','bluebird','request-promise','../../config/environment','define','report_square'];(function(_0x3f6ece,_0x530c18){var _0x3ecfa2=function(_0x55717e){while(--_0x55717e){_0x3f6ece['push'](_0x3f6ece['shift']());}};_0x3ecfa2(++_0x530c18);}(_0x02e8,0x18a));var _0x802e=function(_0xd9c529,_0x19f8cc){_0xd9c529=_0xd9c529-0x0;var _0x146760=_0x02e8[_0xd9c529];return _0x146760;};'use strict';var _=require(_0x802e('0x0'));var util=require(_0x802e('0x1'));var logger=require('../../config/logger')(_0x802e('0x2'));var moment=require(_0x802e('0x3'));var BPromise=require(_0x802e('0x4'));var rp=require(_0x802e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x802e('0x6'));var attributes=require('./squareReport.attributes');module['exports']=function(_0x1d7a68,_0x3f63f1){return _0x1d7a68[_0x802e('0x7')]('SquareReport',attributes,{'tableName':_0x802e('0x8'),'paranoid':![],'indexes':[{'name':_0x802e('0x9'),'fields':[_0x802e('0xa'),_0x802e('0xb')]},{'name':_0x802e('0xc'),'fields':[_0x802e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index b954e1d..e7d3a8d 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 _0x3355=['../../config/utils','../../config/environment','jayson/promise','info','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','SquareReport,\x20%s,\x20%s','result','catch','SquareReport','create','body','options','CreateSquareReport','UpdateSquareReport','update','raw','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x24f0b8,_0x3ce0ab){var _0x43b0d4=function(_0x19fcfc){while(--_0x19fcfc){_0x24f0b8['push'](_0x24f0b8['shift']());}};_0x43b0d4(++_0x3ce0ab);}(_0x3355,0x94));var _0x5335=function(_0x1517ee,_0xc75bf2){_0x1517ee=_0x1517ee-0x0;var _0x481631=_0x3355[_0x1517ee];return _0x481631;};'use strict';var _=require(_0x5335('0x0'));var util=require(_0x5335('0x1'));var moment=require(_0x5335('0x2'));var BPromise=require(_0x5335('0x3'));var rs=require(_0x5335('0x4'));var fs=require('fs');var Redis=require(_0x5335('0x5'));var db=require(_0x5335('0x6'))['db'];var utils=require(_0x5335('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x5335('0x8'));var jayson=require(_0x5335('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x43bce5,_0x5510b4,_0x424ade){return new BPromise(function(_0x5ea60d,_0x252ed3){return client['request'](_0x43bce5,_0x424ade)['then'](function(_0x299a82){logger[_0x5335('0xa')]('SquareReport,\x20%s,\x20%s',_0x5510b4,'request\x20sent');logger[_0x5335('0xb')](_0x5335('0xc'),_0x5510b4,_0x5335('0xd'),JSON[_0x5335('0xe')](_0x299a82));if(_0x299a82['error']){if(_0x299a82[_0x5335('0xf')]['code']===0x1f4){logger[_0x5335('0xf')]('SquareReport,\x20%s,\x20%s',_0x5510b4,_0x299a82[_0x5335('0xf')][_0x5335('0x10')]);return _0x252ed3(_0x299a82[_0x5335('0xf')][_0x5335('0x10')]);}logger[_0x5335('0xf')](_0x5335('0x11'),_0x5510b4,_0x299a82[_0x5335('0xf')]['message']);return _0x5ea60d(_0x299a82[_0x5335('0xf')][_0x5335('0x10')]);}else{logger[_0x5335('0xa')](_0x5335('0x11'),_0x5510b4,_0x5335('0xd'));_0x5ea60d(_0x299a82[_0x5335('0x12')][_0x5335('0x10')]);}})[_0x5335('0x13')](function(_0x312285){logger[_0x5335('0xf')](_0x5335('0x11'),_0x5510b4,_0x312285);_0x252ed3(_0x312285);});});}exports['CreateSquareReport']=function(_0x11b1de){var _0xae62f5=this;return new Promise(function(_0x3af358,_0x17a86b){return db[_0x5335('0x14')][_0x5335('0x15')](_0x11b1de[_0x5335('0x16')],{'raw':_0x11b1de['options']?_0x11b1de[_0x5335('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5772e8){logger[_0x5335('0xa')](_0x5335('0x18'),_0x11b1de);logger[_0x5335('0xb')](_0x5335('0x18'),_0x11b1de,JSON[_0x5335('0xe')](_0x5772e8));_0x3af358(_0x5772e8);})[_0x5335('0x13')](function(_0x3e4884){logger[_0x5335('0xf')](_0x5335('0x18'),_0x3e4884[_0x5335('0x10')],_0x11b1de);_0x17a86b(_0xae62f5['error'](0x1f4,_0x3e4884[_0x5335('0x10')]));});});};exports[_0x5335('0x19')]=function(_0x3abc41){var _0x4f7a24=this;return new Promise(function(_0xec722,_0x30d01e){return db[_0x5335('0x14')][_0x5335('0x1a')](_0x3abc41[_0x5335('0x16')],{'raw':_0x3abc41[_0x5335('0x17')]?_0x3abc41[_0x5335('0x17')][_0x5335('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3abc41['options']?_0x3abc41[_0x5335('0x17')]['where']||null:null,'attributes':_0x3abc41[_0x5335('0x17')]?_0x3abc41[_0x5335('0x17')][_0x5335('0x1c')]||null:null,'limit':_0x3abc41[_0x5335('0x17')]?_0x3abc41[_0x5335('0x17')][_0x5335('0x1d')]||null:null})[_0x5335('0x1e')](function(_0x12a3bb){logger[_0x5335('0xa')](_0x5335('0x19'),_0x3abc41);logger[_0x5335('0xb')]('UpdateSquareReport',_0x3abc41,JSON['stringify'](_0x12a3bb));_0xec722(_0x12a3bb);})[_0x5335('0x13')](function(_0x26995b){logger[_0x5335('0xf')](_0x5335('0x19'),_0x26995b[_0x5335('0x10')],_0x3abc41);_0x30d01e(_0x4f7a24['error'](0x1f4,_0x26995b[_0x5335('0x10')]));});});}; \ No newline at end of file +var _0x37a9=['rpc','../../config/environment','jayson/promise','http','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','raw','then','stringify','UpdateSquareReport','options','where','attributes','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x34ae48,_0x662ff5){var _0x19b539=function(_0x24a8fe){while(--_0x24a8fe){_0x34ae48['push'](_0x34ae48['shift']());}};_0x19b539(++_0x662ff5);}(_0x37a9,0xd9));var _0x937a=function(_0x5aa89c,_0x1a8089){_0x5aa89c=_0x5aa89c-0x0;var _0x59fd0c=_0x37a9[_0x5aa89c];return _0x59fd0c;};'use strict';var _=require(_0x937a('0x0'));var util=require(_0x937a('0x1'));var moment=require('moment');var BPromise=require(_0x937a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x937a('0x3'));var db=require(_0x937a('0x4'))['db'];var utils=require(_0x937a('0x5'));var logger=require(_0x937a('0x6'))(_0x937a('0x7'));var config=require(_0x937a('0x8'));var jayson=require(_0x937a('0x9'));var client=jayson['client'][_0x937a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47850d,_0x5c66d8,_0x40b730){return new BPromise(function(_0x246d40,_0x82ba0){return client['request'](_0x47850d,_0x40b730)['then'](function(_0x291583){logger[_0x937a('0xb')](_0x937a('0xc'),_0x5c66d8,'request\x20sent');logger[_0x937a('0xd')](_0x937a('0xe'),_0x5c66d8,_0x937a('0xf'),JSON['stringify'](_0x291583));if(_0x291583['error']){if(_0x291583[_0x937a('0x10')][_0x937a('0x11')]===0x1f4){logger['error'](_0x937a('0xc'),_0x5c66d8,_0x291583[_0x937a('0x10')]['message']);return _0x82ba0(_0x291583[_0x937a('0x10')][_0x937a('0x12')]);}logger[_0x937a('0x10')]('SquareReport,\x20%s,\x20%s',_0x5c66d8,_0x291583['error']['message']);return _0x246d40(_0x291583[_0x937a('0x10')][_0x937a('0x12')]);}else{logger[_0x937a('0xb')](_0x937a('0xc'),_0x5c66d8,'request\x20sent');_0x246d40(_0x291583[_0x937a('0x13')][_0x937a('0x12')]);}})[_0x937a('0x14')](function(_0x158574){logger['error']('SquareReport,\x20%s,\x20%s',_0x5c66d8,_0x158574);_0x82ba0(_0x158574);});});}exports[_0x937a('0x15')]=function(_0x16a792){var _0x1439d2=this;return new Promise(function(_0x4c282c,_0x5a6572){return db[_0x937a('0x16')][_0x937a('0x17')](_0x16a792[_0x937a('0x18')],{'raw':_0x16a792['options']?_0x16a792['options'][_0x937a('0x19')]===undefined?!![]:![]:!![]})[_0x937a('0x1a')](function(_0x2d2b84){logger[_0x937a('0xb')]('CreateSquareReport',_0x16a792);logger[_0x937a('0xd')](_0x937a('0x15'),_0x16a792,JSON[_0x937a('0x1b')](_0x2d2b84));_0x4c282c(_0x2d2b84);})[_0x937a('0x14')](function(_0x49f70e){logger[_0x937a('0x10')](_0x937a('0x15'),_0x49f70e[_0x937a('0x12')],_0x16a792);_0x5a6572(_0x1439d2[_0x937a('0x10')](0x1f4,_0x49f70e[_0x937a('0x12')]));});});};exports[_0x937a('0x1c')]=function(_0x386b78){var _0x9f4c8a=this;return new Promise(function(_0x124b6e,_0x10a197){return db[_0x937a('0x16')]['update'](_0x386b78[_0x937a('0x18')],{'raw':_0x386b78[_0x937a('0x1d')]?_0x386b78[_0x937a('0x1d')][_0x937a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x386b78[_0x937a('0x1d')]?_0x386b78['options'][_0x937a('0x1e')]||null:null,'attributes':_0x386b78[_0x937a('0x1d')]?_0x386b78[_0x937a('0x1d')][_0x937a('0x1f')]||null:null,'limit':_0x386b78[_0x937a('0x1d')]?_0x386b78[_0x937a('0x1d')]['limit']||null:null})[_0x937a('0x1a')](function(_0x73a2fb){logger[_0x937a('0xb')](_0x937a('0x1c'),_0x386b78);logger[_0x937a('0xd')](_0x937a('0x1c'),_0x386b78,JSON[_0x937a('0x1b')](_0x73a2fb));_0x124b6e(_0x73a2fb);})[_0x937a('0x14')](function(_0x3e05d2){logger['error'](_0x937a('0x1c'),_0x3e05d2[_0x937a('0x12')],_0x386b78);_0x10a197(_0x9f4c8a[_0x937a('0x10')](0x1f4,_0x3e05d2['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index e126bdd..871e058 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 _0x4b56=['get','index','/describe','isAuthenticated','/:id','post','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x14d26e,_0x8da3fb){var _0x4579f0=function(_0x5eba40){while(--_0x5eba40){_0x14d26e['push'](_0x14d26e['shift']());}};_0x4579f0(++_0x8da3fb);}(_0x4b56,0x108));var _0x64b5=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x4b56[_0x403c20];return _0x2b271a;};'use strict';var multer=require(_0x64b5('0x0'));var util=require('util');var path=require(_0x64b5('0x1'));var timeout=require(_0x64b5('0x2'));var express=require(_0x64b5('0x3'));var router=express[_0x64b5('0x4')]();var fs_extra=require(_0x64b5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x64b5('0x6'));var config=require(_0x64b5('0x7'));var controller=require('./squareReportDetail.controller');router[_0x64b5('0x8')]('/',auth['isAuthenticated'](),controller[_0x64b5('0x9')]);router[_0x64b5('0x8')](_0x64b5('0xa'),auth[_0x64b5('0xb')](),controller['describe']);router[_0x64b5('0x8')](_0x64b5('0xc'),auth[_0x64b5('0xb')](),controller['show']);router[_0x64b5('0xd')]('/',auth[_0x64b5('0xb')](),controller['create']);router['put'](_0x64b5('0xc'),auth['isAuthenticated'](),controller[_0x64b5('0xe')]);router['delete'](_0x64b5('0xc'),auth[_0x64b5('0xb')](),controller[_0x64b5('0xf')]);module[_0x64b5('0x10')]=router; \ No newline at end of file +var _0x9bb4=['delete','exports','multer','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','update'];(function(_0x52599f,_0x7e226a){var _0x186220=function(_0x5726d8){while(--_0x5726d8){_0x52599f['push'](_0x52599f['shift']());}};_0x186220(++_0x7e226a);}(_0x9bb4,0xc8));var _0x49bb=function(_0x4ede96,_0x2fc0e0){_0x4ede96=_0x4ede96-0x0;var _0x9803a3=_0x9bb4[_0x4ede96];return _0x9803a3;};'use strict';var multer=require(_0x49bb('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x49bb('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x49bb('0x2'));var interaction=require(_0x49bb('0x3'));var config=require(_0x49bb('0x4'));var controller=require(_0x49bb('0x5'));router[_0x49bb('0x6')]('/',auth['isAuthenticated'](),controller[_0x49bb('0x7')]);router[_0x49bb('0x6')](_0x49bb('0x8'),auth[_0x49bb('0x9')](),controller[_0x49bb('0xa')]);router[_0x49bb('0x6')](_0x49bb('0xb'),auth[_0x49bb('0x9')](),controller[_0x49bb('0xc')]);router[_0x49bb('0xd')]('/',auth[_0x49bb('0x9')](),controller[_0x49bb('0xe')]);router['put']('/:id',auth[_0x49bb('0x9')](),controller[_0x49bb('0xf')]);router[_0x49bb('0x10')](_0x49bb('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x49bb('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 531be36..87bd92d 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 _0xb501=['STRING','TEXT','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb501,0x14f));var _0x1b50=function(_0xd9b635,_0x12caa2){_0xd9b635=_0xd9b635-0x0;var _0xe330c6=_0xb501[_0xd9b635];return _0xe330c6;};'use strict';var Sequelize=require('sequelize');module[_0x1b50('0x0')]={'uniqueid':{'type':Sequelize[_0x1b50('0x1')]},'node':{'type':Sequelize[_0x1b50('0x1')]},'application':{'type':Sequelize[_0x1b50('0x1')]},'data':{'type':Sequelize[_0x1b50('0x2')]},'project_name':{'type':Sequelize[_0x1b50('0x1')]},'callerid':{'type':Sequelize[_0x1b50('0x1')]}}; \ No newline at end of file +var _0x6765=['STRING','TEXT','sequelize','exports'];(function(_0x321467,_0x33bdec){var _0x68c483=function(_0x2a1171){while(--_0x2a1171){_0x321467['push'](_0x321467['shift']());}};_0x68c483(++_0x33bdec);}(_0x6765,0x12a));var _0x5676=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x6765[_0x387777];return _0x3f84c0;};'use strict';var Sequelize=require(_0x5676('0x0'));module[_0x5676('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x5676('0x2')]},'application':{'type':Sequelize[_0x5676('0x2')]},'data':{'type':Sequelize[_0x5676('0x3')]},'project_name':{'type':Sequelize[_0x5676('0x2')]},'callerid':{'type':Sequelize[_0x5676('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index c5f6a06..71e7f10 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 _0x9cf2=['rawAttributes','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','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','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','save','destroy','then','end','stack','send','SquareDetailsReport','type','key','model','map','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','name','merge','options','includeAll','include','findAll','rows','params'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9cf2,0xf7));var _0x29cf=function(_0x2d22e6,_0x2965b7){_0x2d22e6=_0x2d22e6-0x0;var _0x1e3ad1=_0x9cf2[_0x2d22e6];return _0x1e3ad1;};'use strict';var emlformat=require(_0x29cf('0x0'));var rimraf=require(_0x29cf('0x1'));var zipdir=require(_0x29cf('0x2'));var jsonpatch=require(_0x29cf('0x3'));var rp=require(_0x29cf('0x4'));var moment=require(_0x29cf('0x5'));var BPromise=require(_0x29cf('0x6'));var Mustache=require(_0x29cf('0x7'));var util=require(_0x29cf('0x8'));var path=require(_0x29cf('0x9'));var sox=require(_0x29cf('0xa'));var csv=require(_0x29cf('0xb'));var ejs=require(_0x29cf('0xc'));var fs=require('fs');var fs_extra=require(_0x29cf('0xd'));var _=require(_0x29cf('0xe'));var squel=require(_0x29cf('0xf'));var crypto=require(_0x29cf('0x10'));var jsforce=require(_0x29cf('0x11'));var deskjs=require(_0x29cf('0x12'));var toCsv=require('to-csv');var querystring=require(_0x29cf('0x13'));var Papa=require(_0x29cf('0x14'));var Redis=require(_0x29cf('0x15'));var authService=require(_0x29cf('0x16'));var qs=require(_0x29cf('0x17'));var as=require(_0x29cf('0x18'));var hardwareService=require(_0x29cf('0x19'));var logger=require(_0x29cf('0x1a'))('api');var utils=require(_0x29cf('0x1b'));var config=require(_0x29cf('0x1c'));var licenseUtil=require(_0x29cf('0x1d'));var db=require(_0x29cf('0x1e'))['db'];function respondWithStatusCode(_0x406c98,_0x3a8bd8){_0x3a8bd8=_0x3a8bd8||0xcc;return function(_0x23b157){if(_0x23b157){return _0x406c98[_0x29cf('0x1f')](_0x3a8bd8);}return _0x406c98[_0x29cf('0x20')](_0x3a8bd8)['end']();};}function respondWithResult(_0x8b8c8d,_0x152f64){_0x152f64=_0x152f64||0xc8;return function(_0x4f84e4){if(_0x4f84e4){return _0x8b8c8d['status'](_0x152f64)[_0x29cf('0x21')](_0x4f84e4);}};}function respondWithFilteredResult(_0x3d4be9,_0x49f837){return function(_0x1fa9ef){if(_0x1fa9ef){var _0x3b381f=typeof _0x49f837[_0x29cf('0x22')]==='undefined'&&typeof _0x49f837[_0x29cf('0x23')]===_0x29cf('0x24');var _0x8b221c=_0x1fa9ef[_0x29cf('0x25')];var _0x318f09=_0x3b381f?0x0:_0x49f837[_0x29cf('0x22')];var _0x473449=_0x3b381f?_0x1fa9ef[_0x29cf('0x25')]:_0x49f837[_0x29cf('0x22')]+_0x49f837[_0x29cf('0x23')];var _0x4c2065;if(_0x473449>=_0x8b221c){_0x473449=_0x8b221c;_0x4c2065=0xc8;}else{_0x4c2065=0xce;}_0x3d4be9['status'](_0x4c2065);return _0x3d4be9['set'](_0x29cf('0x26'),_0x318f09+'-'+_0x473449+'/'+_0x8b221c)[_0x29cf('0x21')](_0x1fa9ef);}return null;};}function patchUpdates(_0x3c7e12){return function(_0xc51dba){try{jsonpatch[_0x29cf('0x27')](_0xc51dba,_0x3c7e12,!![]);}catch(_0x2b7e00){return BPromise['reject'](_0x2b7e00);}return _0xc51dba[_0x29cf('0x28')]();};}function saveUpdates(_0x1b70fa,_0x4d5b24){return function(_0x222724){if(_0x222724){return _0x222724['update'](_0x1b70fa)['then'](function(_0x105d36){return _0x105d36;});}return null;};}function removeEntity(_0x28eb03,_0x3b5e2c){return function(_0x5d4bea){if(_0x5d4bea){return _0x5d4bea[_0x29cf('0x29')]()[_0x29cf('0x2a')](function(){_0x28eb03[_0x29cf('0x20')](0xcc)[_0x29cf('0x2b')]();});}};}function handleEntityNotFound(_0x534019,_0x17bfc0){return function(_0x1a3142){if(!_0x1a3142){_0x534019[_0x29cf('0x1f')](0x194);}return _0x1a3142;};}function handleError(_0x278c8b,_0x333588){_0x333588=_0x333588||0x1f4;return function(_0x298281){logger['error'](_0x298281[_0x29cf('0x2c')]);if(_0x298281['name']){delete _0x298281['name'];}_0x278c8b['status'](_0x333588)[_0x29cf('0x2d')](_0x298281);};}exports['index']=function(_0x183eb5,_0x5e25f1){var _0x562092={},_0x20705f={},_0x1a6f6a={'count':0x0,'rows':[]};var _0x49f31d=_['map'](db[_0x29cf('0x2e')]['rawAttributes'],function(_0xc567da){return{'name':_0xc567da['fieldName'],'type':_0xc567da[_0x29cf('0x2f')][_0x29cf('0x30')]};});_0x20705f[_0x29cf('0x31')]=_[_0x29cf('0x32')](_0x49f31d,'name');_0x20705f['query']=_[_0x29cf('0x33')](_0x183eb5['query']);_0x20705f[_0x29cf('0x34')]=_[_0x29cf('0x35')](_0x20705f[_0x29cf('0x31')],_0x20705f['query']);_0x562092[_0x29cf('0x36')]=_[_0x29cf('0x35')](_0x20705f[_0x29cf('0x31')],qs[_0x29cf('0x37')](_0x183eb5[_0x29cf('0x38')][_0x29cf('0x37')]));_0x562092[_0x29cf('0x36')]=_0x562092[_0x29cf('0x36')][_0x29cf('0x39')]?_0x562092[_0x29cf('0x36')]:_0x20705f[_0x29cf('0x31')];if(!_0x183eb5['query'][_0x29cf('0x3a')]('nolimit')){_0x562092['limit']=qs['limit'](_0x183eb5[_0x29cf('0x38')][_0x29cf('0x23')]);_0x562092[_0x29cf('0x22')]=qs[_0x29cf('0x22')](_0x183eb5[_0x29cf('0x38')][_0x29cf('0x22')]);}_0x562092[_0x29cf('0x3b')]=qs[_0x29cf('0x3c')](_0x183eb5[_0x29cf('0x38')][_0x29cf('0x3c')]);_0x562092['where']=qs[_0x29cf('0x34')](_[_0x29cf('0x3d')](_0x183eb5['query'],_0x20705f['filters']),_0x49f31d);if(_0x183eb5[_0x29cf('0x38')][_0x29cf('0x3e')]){_0x562092[_0x29cf('0x3f')]=_['merge'](_0x562092[_0x29cf('0x3f')],{'$or':_[_0x29cf('0x32')](_0x49f31d,function(_0x2443cf){if(_0x2443cf['type']!==_0x29cf('0x40')){var _0xd54dcb={};_0xd54dcb[_0x2443cf[_0x29cf('0x41')]]={'$like':'%'+_0x183eb5[_0x29cf('0x38')][_0x29cf('0x3e')]+'%'};return _0xd54dcb;}})});}_0x562092=_[_0x29cf('0x42')]({},_0x562092,_0x183eb5[_0x29cf('0x43')]);var _0x3fd788={'where':_0x562092[_0x29cf('0x3f')]};return db[_0x29cf('0x2e')]['count'](_0x3fd788)[_0x29cf('0x2a')](function(_0x5490c1){_0x1a6f6a[_0x29cf('0x25')]=_0x5490c1;if(_0x183eb5['query'][_0x29cf('0x44')]){_0x562092[_0x29cf('0x45')]=[{'all':!![]}];}return db[_0x29cf('0x2e')][_0x29cf('0x46')](_0x562092);})['then'](function(_0x3759c5){_0x1a6f6a[_0x29cf('0x47')]=_0x3759c5;return _0x1a6f6a;})[_0x29cf('0x2a')](respondWithFilteredResult(_0x5e25f1,_0x562092))['catch'](handleError(_0x5e25f1,null));};exports['show']=function(_0x2e02e2,_0x44b506){var _0x31b5c5={'raw':!![],'where':{'id':_0x2e02e2[_0x29cf('0x48')]['id']}},_0x3848eb={};_0x3848eb[_0x29cf('0x31')]=_['keys'](db[_0x29cf('0x2e')][_0x29cf('0x49')]);_0x3848eb[_0x29cf('0x38')]=_[_0x29cf('0x33')](_0x2e02e2[_0x29cf('0x38')]);_0x3848eb[_0x29cf('0x34')]=_[_0x29cf('0x35')](_0x3848eb[_0x29cf('0x31')],_0x3848eb[_0x29cf('0x38')]);_0x31b5c5[_0x29cf('0x36')]=_[_0x29cf('0x35')](_0x3848eb[_0x29cf('0x31')],qs[_0x29cf('0x37')](_0x2e02e2[_0x29cf('0x38')][_0x29cf('0x37')]));_0x31b5c5[_0x29cf('0x36')]=_0x31b5c5[_0x29cf('0x36')][_0x29cf('0x39')]?_0x31b5c5[_0x29cf('0x36')]:_0x3848eb[_0x29cf('0x31')];if(_0x2e02e2[_0x29cf('0x38')][_0x29cf('0x44')]){_0x31b5c5[_0x29cf('0x45')]=[{'all':!![]}];}_0x31b5c5=_[_0x29cf('0x42')]({},_0x31b5c5,_0x2e02e2[_0x29cf('0x43')]);return db[_0x29cf('0x2e')][_0x29cf('0x4a')](_0x31b5c5)[_0x29cf('0x2a')](handleEntityNotFound(_0x44b506,null))[_0x29cf('0x2a')](respondWithResult(_0x44b506,null))[_0x29cf('0x4b')](handleError(_0x44b506,null));};exports['create']=function(_0x237435,_0x2ab835){return db[_0x29cf('0x2e')][_0x29cf('0x4c')](_0x237435[_0x29cf('0x4d')],{})[_0x29cf('0x2a')](respondWithResult(_0x2ab835,0xc9))[_0x29cf('0x4b')](handleError(_0x2ab835,null));};exports[_0x29cf('0x4e')]=function(_0x428fd7,_0x49132a){if(_0x428fd7[_0x29cf('0x4d')]['id']){delete _0x428fd7['body']['id'];}return db[_0x29cf('0x2e')][_0x29cf('0x4a')]({'where':{'id':_0x428fd7[_0x29cf('0x48')]['id']}})['then'](handleEntityNotFound(_0x49132a,null))[_0x29cf('0x2a')](saveUpdates(_0x428fd7[_0x29cf('0x4d')],null))[_0x29cf('0x2a')](respondWithResult(_0x49132a,null))['catch'](handleError(_0x49132a,null));};exports[_0x29cf('0x29')]=function(_0x10648f,_0x222aeb){return db['SquareDetailsReport'][_0x29cf('0x4a')]({'where':{'id':_0x10648f['params']['id']}})[_0x29cf('0x2a')](handleEntityNotFound(_0x222aeb,null))[_0x29cf('0x2a')](removeEntity(_0x222aeb,null))[_0x29cf('0x4b')](handleError(_0x222aeb,null));};exports[_0x29cf('0x4f')]=function(_0x3ac75d,_0x55acc5){return db[_0x29cf('0x2e')][_0x29cf('0x4f')]()[_0x29cf('0x2a')](respondWithResult(_0x55acc5,null))[_0x29cf('0x4b')](handleError(_0x55acc5,null));}; \ No newline at end of file +var _0x3741=['rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','merge','options','includeAll','findAll','rows','catch','show','params','keys','length','include','find','create','body','describe','eml-format'];(function(_0x119acd,_0xba5178){var _0x2022b9=function(_0x30bca8){while(--_0x30bca8){_0x119acd['push'](_0x119acd['shift']());}};_0x2022b9(++_0xba5178);}(_0x3741,0xe0));var _0x1374=function(_0x44216d,_0x4938a7){_0x44216d=_0x44216d-0x0;var _0xeca523=_0x3741[_0x44216d];return _0xeca523;};'use strict';var emlformat=require(_0x1374('0x0'));var rimraf=require(_0x1374('0x1'));var zipdir=require(_0x1374('0x2'));var jsonpatch=require(_0x1374('0x3'));var rp=require('request-promise');var moment=require(_0x1374('0x4'));var BPromise=require(_0x1374('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1374('0x6'));var sox=require('sox');var csv=require(_0x1374('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1374('0x8'));var _=require(_0x1374('0x9'));var squel=require(_0x1374('0xa'));var crypto=require('crypto');var jsforce=require(_0x1374('0xb'));var deskjs=require(_0x1374('0xc'));var toCsv=require(_0x1374('0x7'));var querystring=require(_0x1374('0xd'));var Papa=require(_0x1374('0xe'));var Redis=require(_0x1374('0xf'));var authService=require(_0x1374('0x10'));var qs=require(_0x1374('0x11'));var as=require(_0x1374('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1374('0x13'))(_0x1374('0x14'));var utils=require(_0x1374('0x15'));var config=require(_0x1374('0x16'));var licenseUtil=require(_0x1374('0x17'));var db=require(_0x1374('0x18'))['db'];function respondWithStatusCode(_0x4fd4bf,_0x23992d){_0x23992d=_0x23992d||0xcc;return function(_0x3491a2){if(_0x3491a2){return _0x4fd4bf[_0x1374('0x19')](_0x23992d);}return _0x4fd4bf['status'](_0x23992d)[_0x1374('0x1a')]();};}function respondWithResult(_0xd743e8,_0x2dfe68){_0x2dfe68=_0x2dfe68||0xc8;return function(_0x27ff4a){if(_0x27ff4a){return _0xd743e8[_0x1374('0x1b')](_0x2dfe68)[_0x1374('0x1c')](_0x27ff4a);}};}function respondWithFilteredResult(_0x14e3c4,_0x2813b1){return function(_0x52f13b){if(_0x52f13b){var _0x50c0e0=typeof _0x2813b1[_0x1374('0x1d')]==='undefined'&&typeof _0x2813b1['limit']===_0x1374('0x1e');var _0xd69d2b=_0x52f13b[_0x1374('0x1f')];var _0x10f391=_0x50c0e0?0x0:_0x2813b1[_0x1374('0x1d')];var _0x56aa20=_0x50c0e0?_0x52f13b[_0x1374('0x1f')]:_0x2813b1[_0x1374('0x1d')]+_0x2813b1[_0x1374('0x20')];var _0x10c4d3;if(_0x56aa20>=_0xd69d2b){_0x56aa20=_0xd69d2b;_0x10c4d3=0xc8;}else{_0x10c4d3=0xce;}_0x14e3c4[_0x1374('0x1b')](_0x10c4d3);return _0x14e3c4[_0x1374('0x21')](_0x1374('0x22'),_0x10f391+'-'+_0x56aa20+'/'+_0xd69d2b)[_0x1374('0x1c')](_0x52f13b);}return null;};}function patchUpdates(_0xe2c7ce){return function(_0x3b2c50){try{jsonpatch['apply'](_0x3b2c50,_0xe2c7ce,!![]);}catch(_0x4691b2){return BPromise[_0x1374('0x23')](_0x4691b2);}return _0x3b2c50[_0x1374('0x24')]();};}function saveUpdates(_0x517de8,_0x4cabfd){return function(_0x55cd9d){if(_0x55cd9d){return _0x55cd9d[_0x1374('0x25')](_0x517de8)[_0x1374('0x26')](function(_0x3b7f63){return _0x3b7f63;});}return null;};}function removeEntity(_0x317a13,_0x599cf8){return function(_0xc2737f){if(_0xc2737f){return _0xc2737f[_0x1374('0x27')]()['then'](function(){_0x317a13['status'](0xcc)[_0x1374('0x1a')]();});}};}function handleEntityNotFound(_0x323a19,_0x454930){return function(_0xcaf147){if(!_0xcaf147){_0x323a19[_0x1374('0x19')](0x194);}return _0xcaf147;};}function handleError(_0x261c58,_0x491019){_0x491019=_0x491019||0x1f4;return function(_0x33f915){logger[_0x1374('0x28')](_0x33f915['stack']);if(_0x33f915[_0x1374('0x29')]){delete _0x33f915['name'];}_0x261c58[_0x1374('0x1b')](_0x491019)[_0x1374('0x2a')](_0x33f915);};}exports[_0x1374('0x2b')]=function(_0x1e721c,_0x4d8e00){var _0x406846={},_0x3edce5={},_0x41d669={'count':0x0,'rows':[]};var _0x5b8efd=_[_0x1374('0x2c')](db[_0x1374('0x2d')][_0x1374('0x2e')],function(_0xc478e5){return{'name':_0xc478e5[_0x1374('0x2f')],'type':_0xc478e5[_0x1374('0x30')]['key']};});_0x3edce5[_0x1374('0x31')]=_[_0x1374('0x2c')](_0x5b8efd,_0x1374('0x29'));_0x3edce5[_0x1374('0x32')]=_['keys'](_0x1e721c['query']);_0x3edce5['filters']=_[_0x1374('0x33')](_0x3edce5[_0x1374('0x31')],_0x3edce5[_0x1374('0x32')]);_0x406846[_0x1374('0x34')]=_[_0x1374('0x33')](_0x3edce5[_0x1374('0x31')],qs[_0x1374('0x35')](_0x1e721c[_0x1374('0x32')][_0x1374('0x35')]));_0x406846[_0x1374('0x34')]=_0x406846['attributes']['length']?_0x406846[_0x1374('0x34')]:_0x3edce5[_0x1374('0x31')];if(!_0x1e721c[_0x1374('0x32')][_0x1374('0x36')]('nolimit')){_0x406846[_0x1374('0x20')]=qs[_0x1374('0x20')](_0x1e721c[_0x1374('0x32')]['limit']);_0x406846[_0x1374('0x1d')]=qs[_0x1374('0x1d')](_0x1e721c[_0x1374('0x32')]['offset']);}_0x406846[_0x1374('0x37')]=qs[_0x1374('0x38')](_0x1e721c[_0x1374('0x32')][_0x1374('0x38')]);_0x406846[_0x1374('0x39')]=qs[_0x1374('0x3a')](_[_0x1374('0x3b')](_0x1e721c[_0x1374('0x32')],_0x3edce5[_0x1374('0x3a')]),_0x5b8efd);if(_0x1e721c[_0x1374('0x32')]['filter']){_0x406846[_0x1374('0x39')]=_[_0x1374('0x3c')](_0x406846[_0x1374('0x39')],{'$or':_['map'](_0x5b8efd,function(_0x19e5bf){if(_0x19e5bf[_0x1374('0x30')]!=='VIRTUAL'){var _0x16eca6={};_0x16eca6[_0x19e5bf[_0x1374('0x29')]]={'$like':'%'+_0x1e721c[_0x1374('0x32')]['filter']+'%'};return _0x16eca6;}})});}_0x406846=_[_0x1374('0x3c')]({},_0x406846,_0x1e721c[_0x1374('0x3d')]);var _0x221eb4={'where':_0x406846[_0x1374('0x39')]};return db[_0x1374('0x2d')]['count'](_0x221eb4)['then'](function(_0x374c88){_0x41d669[_0x1374('0x1f')]=_0x374c88;if(_0x1e721c[_0x1374('0x32')][_0x1374('0x3e')]){_0x406846['include']=[{'all':!![]}];}return db[_0x1374('0x2d')][_0x1374('0x3f')](_0x406846);})[_0x1374('0x26')](function(_0x565160){_0x41d669[_0x1374('0x40')]=_0x565160;return _0x41d669;})['then'](respondWithFilteredResult(_0x4d8e00,_0x406846))[_0x1374('0x41')](handleError(_0x4d8e00,null));};exports[_0x1374('0x42')]=function(_0x26b7a2,_0x5d3ff4){var _0x12020b={'raw':!![],'where':{'id':_0x26b7a2[_0x1374('0x43')]['id']}},_0x1a09d4={};_0x1a09d4[_0x1374('0x31')]=_[_0x1374('0x44')](db[_0x1374('0x2d')][_0x1374('0x2e')]);_0x1a09d4[_0x1374('0x32')]=_['keys'](_0x26b7a2[_0x1374('0x32')]);_0x1a09d4[_0x1374('0x3a')]=_['intersection'](_0x1a09d4[_0x1374('0x31')],_0x1a09d4[_0x1374('0x32')]);_0x12020b[_0x1374('0x34')]=_[_0x1374('0x33')](_0x1a09d4['model'],qs[_0x1374('0x35')](_0x26b7a2[_0x1374('0x32')][_0x1374('0x35')]));_0x12020b['attributes']=_0x12020b[_0x1374('0x34')][_0x1374('0x45')]?_0x12020b['attributes']:_0x1a09d4[_0x1374('0x31')];if(_0x26b7a2[_0x1374('0x32')][_0x1374('0x3e')]){_0x12020b[_0x1374('0x46')]=[{'all':!![]}];}_0x12020b=_['merge']({},_0x12020b,_0x26b7a2['options']);return db[_0x1374('0x2d')][_0x1374('0x47')](_0x12020b)[_0x1374('0x26')](handleEntityNotFound(_0x5d3ff4,null))[_0x1374('0x26')](respondWithResult(_0x5d3ff4,null))[_0x1374('0x41')](handleError(_0x5d3ff4,null));};exports[_0x1374('0x48')]=function(_0xd0d4fe,_0x416542){return db[_0x1374('0x2d')][_0x1374('0x48')](_0xd0d4fe[_0x1374('0x49')],{})[_0x1374('0x26')](respondWithResult(_0x416542,0xc9))['catch'](handleError(_0x416542,null));};exports[_0x1374('0x25')]=function(_0x5c2879,_0x1387de){if(_0x5c2879[_0x1374('0x49')]['id']){delete _0x5c2879[_0x1374('0x49')]['id'];}return db['SquareDetailsReport'][_0x1374('0x47')]({'where':{'id':_0x5c2879[_0x1374('0x43')]['id']}})[_0x1374('0x26')](handleEntityNotFound(_0x1387de,null))[_0x1374('0x26')](saveUpdates(_0x5c2879[_0x1374('0x49')],null))['then'](respondWithResult(_0x1387de,null))[_0x1374('0x41')](handleError(_0x1387de,null));};exports['destroy']=function(_0x2cdc42,_0x46eaf8){return db['SquareDetailsReport']['find']({'where':{'id':_0x2cdc42[_0x1374('0x43')]['id']}})[_0x1374('0x26')](handleEntityNotFound(_0x46eaf8,null))[_0x1374('0x26')](removeEntity(_0x46eaf8,null))[_0x1374('0x41')](handleError(_0x46eaf8,null));};exports[_0x1374('0x4a')]=function(_0x3a611e,_0xb1705f){return db[_0x1374('0x2d')][_0x1374('0x4a')]()[_0x1374('0x26')](respondWithResult(_0xb1705f,null))[_0x1374('0x41')](handleError(_0xb1705f,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 79c6a72..bfc2e27 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 _0x95ef=['./squareReportDetail.attributes','define','SquareDetailsReport','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x95ef,0x85));var _0xf95e=function(_0x5b0652,_0x518216){_0x5b0652=_0x5b0652-0x0;var _0x43b51c=_0x95ef[_0x5b0652];return _0x43b51c;};'use strict';var _=require('lodash');var util=require(_0xf95e('0x0'));var logger=require(_0xf95e('0x1'))(_0xf95e('0x2'));var moment=require(_0xf95e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf95e('0x4'));var rimraf=require(_0xf95e('0x5'));var config=require(_0xf95e('0x6'));var attributes=require(_0xf95e('0x7'));module['exports']=function(_0x456f3d,_0x18ce27){return _0x456f3d[_0xf95e('0x8')](_0xf95e('0x9'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5bb=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport'];(function(_0x117447,_0x23e296){var _0x5f546d=function(_0x188b88){while(--_0x188b88){_0x117447['push'](_0x117447['shift']());}};_0x5f546d(++_0x23e296);}(_0xa5bb,0x1c8));var _0xba5b=function(_0x363006,_0x1b139e){_0x363006=_0x363006-0x0;var _0x2a1e57=_0xa5bb[_0x363006];return _0x2a1e57;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xba5b('0x0'))(_0xba5b('0x1'));var moment=require(_0xba5b('0x2'));var BPromise=require(_0xba5b('0x3'));var rp=require(_0xba5b('0x4'));var fs=require('fs');var path=require(_0xba5b('0x5'));var rimraf=require(_0xba5b('0x6'));var config=require(_0xba5b('0x7'));var attributes=require(_0xba5b('0x8'));module[_0xba5b('0x9')]=function(_0x342f8b,_0x53085c){return _0x342f8b[_0xba5b('0xa')](_0xba5b('0xb'),attributes,{'tableName':'report_square_details','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 561e425..d9880dd 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 _0x1775=['code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2e244b,_0x334eea){var _0x46a838=function(_0x27c0f9){while(--_0x27c0f9){_0x2e244b['push'](_0x2e244b['shift']());}};_0x46a838(++_0x334eea);}(_0x1775,0x1db));var _0x5177=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1775[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x5177('0x0'));var moment=require(_0x5177('0x1'));var BPromise=require(_0x5177('0x2'));var rs=require(_0x5177('0x3'));var fs=require('fs');var Redis=require(_0x5177('0x4'));var db=require(_0x5177('0x5'))['db'];var utils=require(_0x5177('0x6'));var logger=require(_0x5177('0x7'))(_0x5177('0x8'));var config=require(_0x5177('0x9'));var jayson=require(_0x5177('0xa'));var client=jayson[_0x5177('0xb')][_0x5177('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ac1c6,_0x300b43,_0x245c12){return new BPromise(function(_0x363611,_0x3ce288){return client[_0x5177('0xd')](_0x2ac1c6,_0x245c12)[_0x5177('0xe')](function(_0x2c23d8){logger[_0x5177('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x300b43,'request\x20sent');logger[_0x5177('0x10')](_0x5177('0x11'),_0x300b43,_0x5177('0x12'),JSON[_0x5177('0x13')](_0x2c23d8));if(_0x2c23d8[_0x5177('0x14')]){if(_0x2c23d8['error'][_0x5177('0x15')]===0x1f4){logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);return _0x3ce288(_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);}logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);return _0x363611(_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);}else{logger[_0x5177('0xf')](_0x5177('0x16'),_0x300b43,_0x5177('0x12'));_0x363611(_0x2c23d8[_0x5177('0x18')][_0x5177('0x17')]);}})[_0x5177('0x19')](function(_0x50ce2c){logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x50ce2c);_0x3ce288(_0x50ce2c);});});}exports[_0x5177('0x1a')]=function(_0x1b4102){var _0x5f5bd4=this;return new Promise(function(_0x3e6944,_0x2ebf91){return db[_0x5177('0x1b')]['create'](_0x1b4102[_0x5177('0x1c')],{'raw':_0x1b4102['options']?_0x1b4102[_0x5177('0x1d')][_0x5177('0x1e')]===undefined?!![]:![]:!![]})[_0x5177('0xe')](function(_0x27b732){logger[_0x5177('0xf')](_0x5177('0x1a'),_0x1b4102);logger[_0x5177('0x10')](_0x5177('0x1a'),_0x1b4102,JSON[_0x5177('0x13')](_0x27b732));_0x3e6944(_0x27b732);})[_0x5177('0x19')](function(_0x23dad2){logger[_0x5177('0x14')]('CreateSquareDetailsReport',_0x23dad2[_0x5177('0x17')],_0x1b4102);_0x2ebf91(_0x5f5bd4['error'](0x1f4,_0x23dad2[_0x5177('0x17')]));});});}; \ No newline at end of file +var _0xb62e=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','then','lodash','util'];(function(_0x2bce90,_0x3f9356){var _0x3198ad=function(_0x2757bd){while(--_0x2757bd){_0x2bce90['push'](_0x2bce90['shift']());}};_0x3198ad(++_0x3f9356);}(_0xb62e,0x1de));var _0xeb62=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb62e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var moment=require(_0xeb62('0x2'));var BPromise=require(_0xeb62('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb62('0x4'));var db=require(_0xeb62('0x5'))['db'];var utils=require(_0xeb62('0x6'));var logger=require(_0xeb62('0x7'))(_0xeb62('0x8'));var config=require(_0xeb62('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb62('0xa')][_0xeb62('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31f5ea,_0x5e0dc4,_0x2065a0){return new BPromise(function(_0xab7049,_0x1e10ae){return client[_0xeb62('0xc')](_0x31f5ea,_0x2065a0)['then'](function(_0x5cdef3){logger[_0xeb62('0xd')](_0xeb62('0xe'),_0x5e0dc4,_0xeb62('0xf'));logger[_0xeb62('0x10')](_0xeb62('0x11'),_0x5e0dc4,_0xeb62('0xf'),JSON[_0xeb62('0x12')](_0x5cdef3));if(_0x5cdef3[_0xeb62('0x13')]){if(_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x14')]===0x1f4){logger['error'](_0xeb62('0xe'),_0x5e0dc4,_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x15')]);return _0x1e10ae(_0x5cdef3[_0xeb62('0x13')]['message']);}logger[_0xeb62('0x13')](_0xeb62('0xe'),_0x5e0dc4,_0x5cdef3[_0xeb62('0x13')]['message']);return _0xab7049(_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x15')]);}else{logger[_0xeb62('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x5e0dc4,_0xeb62('0xf'));_0xab7049(_0x5cdef3[_0xeb62('0x16')][_0xeb62('0x15')]);}})[_0xeb62('0x17')](function(_0x3fb280){logger[_0xeb62('0x13')](_0xeb62('0xe'),_0x5e0dc4,_0x3fb280);_0x1e10ae(_0x3fb280);});});}exports[_0xeb62('0x18')]=function(_0x39b138){var _0x27fd84=this;return new Promise(function(_0x27efc8,_0x11d516){return db[_0xeb62('0x19')]['create'](_0x39b138[_0xeb62('0x1a')],{'raw':_0x39b138[_0xeb62('0x1b')]?_0x39b138[_0xeb62('0x1b')][_0xeb62('0x1c')]===undefined?!![]:![]:!![]})[_0xeb62('0x1d')](function(_0x24cbf3){logger[_0xeb62('0xd')]('CreateSquareDetailsReport',_0x39b138);logger['debug'](_0xeb62('0x18'),_0x39b138,JSON[_0xeb62('0x12')](_0x24cbf3));_0x27efc8(_0x24cbf3);})[_0xeb62('0x17')](function(_0x13243f){logger[_0xeb62('0x13')]('CreateSquareDetailsReport',_0x13243f['message'],_0x39b138);_0x11d516(_0x27fd84[_0xeb62('0x13')](0x1f4,_0x13243f[_0xeb62('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 77f9e61..1598931 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 _0x1cc0=['express','Router','./system.controller','get','isAuthenticated','index','/process/:pid/kill','exports'];(function(_0x2b1fdc,_0x3bb6da){var _0x41a285=function(_0x210fd0){while(--_0x210fd0){_0x2b1fdc['push'](_0x2b1fdc['shift']());}};_0x41a285(++_0x3bb6da);}(_0x1cc0,0xd8));var _0x01cc=function(_0x1523dc,_0x10038e){_0x1523dc=_0x1523dc-0x0;var _0x3ecbfc=_0x1cc0[_0x1523dc];return _0x3ecbfc;};'use strict';var express=require(_0x01cc('0x0'));var router=express[_0x01cc('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x01cc('0x2'));router[_0x01cc('0x3')]('/',auth[_0x01cc('0x4')](),controller[_0x01cc('0x5')]);router[_0x01cc('0x3')](_0x01cc('0x6'),auth[_0x01cc('0x4')](),controller['killProcess']);module[_0x01cc('0x7')]=router; \ No newline at end of file +var _0x01a4=['Router','../../components/auth/service','./system.controller','get','/process/:pid/kill','exports','express'];(function(_0xca6b2d,_0x585a58){var _0x468567=function(_0x5d8ca1){while(--_0x5d8ca1){_0xca6b2d['push'](_0xca6b2d['shift']());}};_0x468567(++_0x585a58);}(_0x01a4,0xf4));var _0x401a=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0x01a4[_0x11a220];return _0x20d8fe;};'use strict';var express=require(_0x401a('0x0'));var router=express[_0x401a('0x1')]();var auth=require(_0x401a('0x2'));var controller=require(_0x401a('0x3'));router[_0x401a('0x4')]('/',auth['isAuthenticated'](),controller['index']);router[_0x401a('0x4')](_0x401a('0x5'),auth['isAuthenticated'](),controller['killProcess']);module[_0x401a('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 9edcdf3..de4a1c5 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 _0x6584=['format','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api','util','error','inspect','name','status','index','getAllData','json','catch','killProcess','components/import/cm'];(function(_0x50664d,_0x1b9a71){var _0x3220ef=function(_0x495949){while(--_0x495949){_0x50664d['push'](_0x50664d['shift']());}};_0x3220ef(++_0x1b9a71);}(_0x6584,0x1b3));var _0x4658=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x6584[_0x4e1d03];return _0x362d4b;};'use strict';var info=require(_0x4658('0x0'));var exec=require(_0x4658('0x1'))['exec'];var logger=require(_0x4658('0x2'))(_0x4658('0x3'));var util=require(_0x4658('0x4'));var BPromise=require('bluebird');var _=require('lodash');function handleError(_0x584196,_0x1d4cbf,_0x3ca78c){_0x1d4cbf=_0x1d4cbf||0x1f4;return function(_0x47dd00){logger[_0x4658('0x5')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x3ca78c,_0x1d4cbf,util[_0x4658('0x6')](_0x47dd00,{'showHidden':![],'depth':null}));delete _0x47dd00[_0x4658('0x7')];_0x584196[_0x4658('0x8')](_0x1d4cbf)['send'](_0x47dd00);};}exports[_0x4658('0x9')]=function(_0x1be99c,_0x55c5bc){return info[_0x4658('0xa')]()['then'](function(_0x452b45){return _0x55c5bc['status'](0xc8)[_0x4658('0xb')](_0x452b45);})[_0x4658('0xc')](function(_0x3eea30){return _0x55c5bc['status'](0x1f4)['json'](_0x3eea30);});};exports[_0x4658('0xd')]=function(_0x1d93b5,_0x2bab37){var _0x154aca=[_0x4658('0xe')];return new BPromise(function(_0x115e14,_0x150cf1){return exec(util[_0x4658('0xf')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x1d93b5[_0x4658('0x10')][_0x4658('0x11')]),function(_0x3787d7,_0x559ffd,_0x4b6cef){if(_0x3787d7){return _0x150cf1(_0x3787d7);}return _0x115e14(_0x559ffd);});})['then'](function(_0xce3ac9){var _0x46d4c5=![];var _0x13979e=_0xce3ac9[_0x4658('0x12')](/\n/);for(var _0xb80731=0x0,_0x296621=_0x154aca[_0x4658('0x13')];_0xb80731<_0x296621,_0x46d4c5===![];_0xb80731+=0x1){if(_0xce3ac9[_0x4658('0x14')](_0x154aca[_0xb80731])>=0x0){_0x46d4c5=!![];}}if(!_0x46d4c5){throw new Error(util[_0x4658('0xf')](_0x4658('0x15'),_0x1d93b5[_0x4658('0x10')][_0x4658('0x11')]));}process[_0x4658('0x16')](_0x1d93b5[_0x4658('0x10')][_0x4658('0x11')],_0x4658('0x17'));return _0x2bab37['status'](0xc8)[_0x4658('0xb')]({'message':util[_0x4658('0xf')](_0x4658('0x18'),_0x1d93b5[_0x4658('0x10')][_0x4658('0x11')])});})[_0x4658('0xc')](handleError(_0x2bab37,null,_0x4658('0xd')));}; \ No newline at end of file +var _0xa03d=['lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','send','index','getAllData','json','catch','status','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','then','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT','systeminformation','child_process','exec','api'];(function(_0x2c3be2,_0x43ad4a){var _0x3f5afe=function(_0x4524a5){while(--_0x4524a5){_0x2c3be2['push'](_0x2c3be2['shift']());}};_0x3f5afe(++_0x43ad4a);}(_0xa03d,0x1d0));var _0xda03=function(_0x4d8a43,_0x4bc211){_0x4d8a43=_0x4d8a43-0x0;var _0x3d3213=_0xa03d[_0x4d8a43];return _0x3d3213;};'use strict';var info=require(_0xda03('0x0'));var exec=require(_0xda03('0x1'))[_0xda03('0x2')];var logger=require('../../config/logger')(_0xda03('0x3'));var util=require('util');var BPromise=require('bluebird');var _=require(_0xda03('0x4'));function handleError(_0x14902f,_0x39a5da,_0x38b819){_0x39a5da=_0x39a5da||0x1f4;return function(_0x572d8b){logger[_0xda03('0x5')](_0xda03('0x6'),_0x38b819,_0x39a5da,util['inspect'](_0x572d8b,{'showHidden':![],'depth':null}));delete _0x572d8b[_0xda03('0x7')];_0x14902f['status'](_0x39a5da)[_0xda03('0x8')](_0x572d8b);};}exports[_0xda03('0x9')]=function(_0x4b54c0,_0x14ed74){return info[_0xda03('0xa')]()['then'](function(_0x28818a){return _0x14ed74['status'](0xc8)[_0xda03('0xb')](_0x28818a);})[_0xda03('0xc')](function(_0x399b0c){return _0x14ed74[_0xda03('0xd')](0x1f4)[_0xda03('0xb')](_0x399b0c);});};exports[_0xda03('0xe')]=function(_0x5d9f36,_0x3c84e3){var _0x4654de=[_0xda03('0xf')];return new BPromise(function(_0x1d4bc8,_0x3e1189){return exec(util[_0xda03('0x10')](_0xda03('0x11'),_0x5d9f36['params'][_0xda03('0x12')]),function(_0x26cf3a,_0x333374,_0x499e85){if(_0x26cf3a){return _0x3e1189(_0x26cf3a);}return _0x1d4bc8(_0x333374);});})[_0xda03('0x13')](function(_0x138878){var _0x318357=![];var _0x3e9351=_0x138878[_0xda03('0x14')](/\n/);for(var _0x2b1be0=0x0,_0x335b9c=_0x4654de['length'];_0x2b1be0<_0x335b9c,_0x318357===![];_0x2b1be0+=0x1){if(_0x138878[_0xda03('0x15')](_0x4654de[_0x2b1be0])>=0x0){_0x318357=!![];}}if(!_0x318357){throw new Error(util[_0xda03('0x10')](_0xda03('0x16'),_0x5d9f36[_0xda03('0x17')][_0xda03('0x12')]));}process[_0xda03('0x18')](_0x5d9f36[_0xda03('0x17')]['pid'],_0xda03('0x19'));return _0x3c84e3[_0xda03('0xd')](0xc8)[_0xda03('0xb')]({'message':util[_0xda03('0x10')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x5d9f36[_0xda03('0x17')][_0xda03('0x12')])});})['catch'](handleError(_0x3c84e3,null,_0xda03('0xe')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index a46fe79..f358899 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 _0x046a=['exports','multer','path','connect-timeout','express','Router','./tag.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy'];(function(_0x3c6db8,_0x45006c){var _0x5b83cb=function(_0x4dd2ea){while(--_0x4dd2ea){_0x3c6db8['push'](_0x3c6db8['shift']());}};_0x5b83cb(++_0x45006c);}(_0x046a,0x122));var _0xa046=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x046a[_0x278e3c];return _0x3e2d9b;};'use strict';var multer=require(_0xa046('0x0'));var util=require('util');var path=require(_0xa046('0x1'));var timeout=require(_0xa046('0x2'));var express=require(_0xa046('0x3'));var router=express[_0xa046('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(_0xa046('0x5'));router[_0xa046('0x6')]('/',auth[_0xa046('0x7')](),controller[_0xa046('0x8')]);router['get'](_0xa046('0x9'),auth[_0xa046('0x7')](),controller[_0xa046('0xa')]);router['post']('/',auth[_0xa046('0x7')](),controller[_0xa046('0xb')]);router[_0xa046('0xc')](_0xa046('0x9'),auth['isAuthenticated'](),controller[_0xa046('0xd')]);router[_0xa046('0xe')](_0xa046('0x9'),auth[_0xa046('0x7')](),controller[_0xa046('0xf')]);module[_0xa046('0x10')]=router; \ No newline at end of file +var _0x62a8=['delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update'];(function(_0x120462,_0x1e3663){var _0x51c77a=function(_0x19a43e){while(--_0x19a43e){_0x120462['push'](_0x120462['shift']());}};_0x51c77a(++_0x1e3663);}(_0x62a8,0x16b));var _0x862a=function(_0x29961d,_0x53bec5){_0x29961d=_0x29961d-0x0;var _0x279a27=_0x62a8[_0x29961d];return _0x279a27;};'use strict';var multer=require(_0x862a('0x0'));var util=require(_0x862a('0x1'));var path=require(_0x862a('0x2'));var timeout=require(_0x862a('0x3'));var express=require(_0x862a('0x4'));var router=express['Router']();var fs_extra=require(_0x862a('0x5'));var auth=require(_0x862a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x862a('0x7'));var controller=require('./tag.controller');router[_0x862a('0x8')]('/',auth['isAuthenticated'](),controller[_0x862a('0x9')]);router['get'](_0x862a('0xa'),auth[_0x862a('0xb')](),controller[_0x862a('0xc')]);router[_0x862a('0xd')]('/',auth[_0x862a('0xb')](),controller[_0x862a('0xe')]);router[_0x862a('0xf')](_0x862a('0xa'),auth[_0x862a('0xb')](),controller[_0x862a('0x10')]);router[_0x862a('0x11')](_0x862a('0xa'),auth[_0x862a('0xb')](),controller[_0x862a('0x12')]);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 1ebe4ec..ec84f37 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 _0xbff2=['sequelize','exports','STRING','name','#0091EA'];(function(_0x2bd24a,_0x21e961){var _0x27fa55=function(_0x480a92){while(--_0x480a92){_0x2bd24a['push'](_0x2bd24a['shift']());}};_0x27fa55(++_0x21e961);}(_0xbff2,0x10e));var _0x2bff=function(_0x1754e8,_0x25d5cf){_0x1754e8=_0x1754e8-0x0;var _0x3c2ee3=_0xbff2[_0x1754e8];return _0x3c2ee3;};'use strict';var Sequelize=require(_0x2bff('0x0'));module[_0x2bff('0x1')]={'name':{'type':Sequelize[_0x2bff('0x2')],'unique':_0x2bff('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x2bff('0x2')],'defaultValue':_0x2bff('0x4')},'description':{'type':Sequelize[_0x2bff('0x2')]}}; \ No newline at end of file +var _0x0a48=['exports','name','STRING','#0091EA','sequelize'];(function(_0x209e12,_0x2ce907){var _0x3f5b89=function(_0x39cc7f){while(--_0x39cc7f){_0x209e12['push'](_0x209e12['shift']());}};_0x3f5b89(++_0x2ce907);}(_0x0a48,0x95));var _0x80a4=function(_0x33fe6d,_0x29502f){_0x33fe6d=_0x33fe6d-0x0;var _0x5acfbe=_0x0a48[_0x33fe6d];return _0x5acfbe;};'use strict';var Sequelize=require(_0x80a4('0x0'));module[_0x80a4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x80a4('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x80a4('0x3')],'defaultValue':_0x80a4('0x4')},'description':{'type':Sequelize[_0x80a4('0x3')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 0f50187..1ab822a 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 _0x5ff3=['params','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','keys','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','options','Tag','include','findAll','catch','show','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x5ff3,0x17d));var _0x35ff=function(_0x78d502,_0x3d1afe){_0x78d502=_0x78d502-0x0;var _0x317682=_0x5ff3[_0x78d502];return _0x317682;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x35ff('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35ff('0x1'));var rp=require('request-promise');var moment=require(_0x35ff('0x2'));var BPromise=require(_0x35ff('0x3'));var Mustache=require(_0x35ff('0x4'));var util=require(_0x35ff('0x5'));var path=require('path');var sox=require(_0x35ff('0x6'));var csv=require(_0x35ff('0x7'));var ejs=require(_0x35ff('0x8'));var fs=require('fs');var fs_extra=require(_0x35ff('0x9'));var _=require(_0x35ff('0xa'));var squel=require('squel');var crypto=require(_0x35ff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x35ff('0xc'));var toCsv=require(_0x35ff('0x7'));var querystring=require(_0x35ff('0xd'));var Papa=require('papaparse');var Redis=require(_0x35ff('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x35ff('0xf'));var as=require(_0x35ff('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x35ff('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x35ff('0x12'))['db'];function respondWithStatusCode(_0x3c5f4b,_0x5bda40){_0x5bda40=_0x5bda40||0xcc;return function(_0x842930){if(_0x842930){return _0x3c5f4b['sendStatus'](_0x5bda40);}return _0x3c5f4b[_0x35ff('0x13')](_0x5bda40)[_0x35ff('0x14')]();};}function respondWithResult(_0x3db454,_0x4d1d41){_0x4d1d41=_0x4d1d41||0xc8;return function(_0xff8ac){if(_0xff8ac){return _0x3db454[_0x35ff('0x13')](_0x4d1d41)[_0x35ff('0x15')](_0xff8ac);}};}function respondWithFilteredResult(_0x3e24dd,_0x438199){return function(_0x3dff65){if(_0x3dff65){var _0x2d4a88=typeof _0x438199[_0x35ff('0x16')]===_0x35ff('0x17')&&typeof _0x438199[_0x35ff('0x18')]===_0x35ff('0x17');var _0x3430e2=_0x3dff65[_0x35ff('0x19')];var _0x16c803=_0x2d4a88?0x0:_0x438199[_0x35ff('0x16')];var _0x5f470e=_0x2d4a88?_0x3dff65[_0x35ff('0x19')]:_0x438199[_0x35ff('0x16')]+_0x438199[_0x35ff('0x18')];var _0x1c0d8c;if(_0x5f470e>=_0x3430e2){_0x5f470e=_0x3430e2;_0x1c0d8c=0xc8;}else{_0x1c0d8c=0xce;}_0x3e24dd['status'](_0x1c0d8c);return _0x3e24dd['set'](_0x35ff('0x1a'),_0x16c803+'-'+_0x5f470e+'/'+_0x3430e2)[_0x35ff('0x15')](_0x3dff65);}return null;};}function patchUpdates(_0x4c8dd4){return function(_0x238f65){try{jsonpatch[_0x35ff('0x1b')](_0x238f65,_0x4c8dd4,!![]);}catch(_0x3a87bc){return BPromise[_0x35ff('0x1c')](_0x3a87bc);}return _0x238f65['save']();};}function saveUpdates(_0x3d60b4,_0x55274b){return function(_0x7cc20a){if(_0x7cc20a){return _0x7cc20a[_0x35ff('0x1d')](_0x3d60b4)[_0x35ff('0x1e')](function(_0x16a5a0){return _0x16a5a0;});}return null;};}function removeEntity(_0x396cc2,_0x2b3782){return function(_0x347cec){if(_0x347cec){return _0x347cec['destroy']()[_0x35ff('0x1e')](function(){var _0x2ffcb=_0x347cec['get']({'plain':!![]});var _0x426e4e='Tags';return db['UserProfileResource'][_0x35ff('0x1f')]({'where':{'type':_0x426e4e,'resourceId':_0x2ffcb['id']}})[_0x35ff('0x1e')](function(){return _0x347cec;});})[_0x35ff('0x1e')](function(){_0x396cc2[_0x35ff('0x13')](0xcc)[_0x35ff('0x14')]();});}};}function handleEntityNotFound(_0x546ec0,_0x2bdba4){return function(_0x412873){if(!_0x412873){_0x546ec0[_0x35ff('0x20')](0x194);}return _0x412873;};}function handleError(_0x5e191b,_0x3357a){_0x3357a=_0x3357a||0x1f4;return function(_0x1f51c5){logger[_0x35ff('0x21')](_0x1f51c5[_0x35ff('0x22')]);if(_0x1f51c5[_0x35ff('0x23')]){delete _0x1f51c5[_0x35ff('0x23')];}_0x5e191b[_0x35ff('0x13')](_0x3357a)[_0x35ff('0x24')](_0x1f51c5);};}exports[_0x35ff('0x25')]=function(_0x47d8fa,_0x3f9440){var _0x57339d={},_0x1cb370={},_0x257501={'count':0x0,'rows':[]};var _0x2bc118=_[_0x35ff('0x26')](db['Tag'][_0x35ff('0x27')],function(_0x5de349){return{'name':_0x5de349[_0x35ff('0x28')],'type':_0x5de349[_0x35ff('0x29')]['key']};});_0x1cb370['model']=_[_0x35ff('0x26')](_0x2bc118,_0x35ff('0x23'));_0x1cb370['query']=_[_0x35ff('0x2a')](_0x47d8fa[_0x35ff('0x2b')]);_0x1cb370['filters']=_[_0x35ff('0x2c')](_0x1cb370[_0x35ff('0x2d')],_0x1cb370[_0x35ff('0x2b')]);_0x57339d[_0x35ff('0x2e')]=_[_0x35ff('0x2c')](_0x1cb370[_0x35ff('0x2d')],qs[_0x35ff('0x2f')](_0x47d8fa[_0x35ff('0x2b')][_0x35ff('0x2f')]));_0x57339d[_0x35ff('0x2e')]=_0x57339d[_0x35ff('0x2e')][_0x35ff('0x30')]?_0x57339d[_0x35ff('0x2e')]:_0x1cb370['model'];if(!_0x47d8fa[_0x35ff('0x2b')]['hasOwnProperty'](_0x35ff('0x31'))){_0x57339d[_0x35ff('0x18')]=qs[_0x35ff('0x18')](_0x47d8fa[_0x35ff('0x2b')][_0x35ff('0x18')]);_0x57339d['offset']=qs[_0x35ff('0x16')](_0x47d8fa[_0x35ff('0x2b')][_0x35ff('0x16')]);}_0x57339d[_0x35ff('0x32')]=qs[_0x35ff('0x33')](_0x47d8fa['query'][_0x35ff('0x33')]);_0x57339d[_0x35ff('0x34')]=qs[_0x35ff('0x35')](_['pick'](_0x47d8fa['query'],_0x1cb370[_0x35ff('0x35')]),_0x2bc118);if(_0x47d8fa[_0x35ff('0x2b')][_0x35ff('0x36')]){_0x57339d[_0x35ff('0x34')]=_[_0x35ff('0x37')](_0x57339d[_0x35ff('0x34')],{'$or':_[_0x35ff('0x26')](_0x2bc118,function(_0x368f7c){if(_0x368f7c['type']!=='VIRTUAL'){var _0x550c09={};_0x550c09[_0x368f7c[_0x35ff('0x23')]]={'$like':'%'+_0x47d8fa[_0x35ff('0x2b')][_0x35ff('0x36')]+'%'};return _0x550c09;}})});}_0x57339d=_[_0x35ff('0x37')]({},_0x57339d,_0x47d8fa[_0x35ff('0x38')]);var _0x59c398={'where':_0x57339d[_0x35ff('0x34')]};return db[_0x35ff('0x39')][_0x35ff('0x19')](_0x59c398)[_0x35ff('0x1e')](function(_0x117ee6){_0x257501[_0x35ff('0x19')]=_0x117ee6;if(_0x47d8fa['query']['includeAll']){_0x57339d[_0x35ff('0x3a')]=[{'all':!![]}];}return db[_0x35ff('0x39')][_0x35ff('0x3b')](_0x57339d);})[_0x35ff('0x1e')](function(_0x4b1e3e){_0x257501['rows']=_0x4b1e3e;return _0x257501;})[_0x35ff('0x1e')](respondWithFilteredResult(_0x3f9440,_0x57339d))[_0x35ff('0x3c')](handleError(_0x3f9440,null));};exports[_0x35ff('0x3d')]=function(_0x1cd2c8,_0xb1f6ca){var _0x2ff794={'raw':!![],'where':{'id':_0x1cd2c8['params']['id']}},_0x346758={};_0x346758['model']=_[_0x35ff('0x2a')](db[_0x35ff('0x39')][_0x35ff('0x27')]);_0x346758['query']=_[_0x35ff('0x2a')](_0x1cd2c8[_0x35ff('0x2b')]);_0x346758['filters']=_['intersection'](_0x346758[_0x35ff('0x2d')],_0x346758['query']);_0x2ff794[_0x35ff('0x2e')]=_[_0x35ff('0x2c')](_0x346758['model'],qs[_0x35ff('0x2f')](_0x1cd2c8['query']['fields']));_0x2ff794[_0x35ff('0x2e')]=_0x2ff794[_0x35ff('0x2e')][_0x35ff('0x30')]?_0x2ff794[_0x35ff('0x2e')]:_0x346758[_0x35ff('0x2d')];if(_0x1cd2c8[_0x35ff('0x2b')][_0x35ff('0x3e')]){_0x2ff794[_0x35ff('0x3a')]=[{'all':!![]}];}_0x2ff794=_[_0x35ff('0x37')]({},_0x2ff794,_0x1cd2c8[_0x35ff('0x38')]);return db[_0x35ff('0x39')][_0x35ff('0x3f')](_0x2ff794)['then'](handleEntityNotFound(_0xb1f6ca,null))[_0x35ff('0x1e')](respondWithResult(_0xb1f6ca,null))[_0x35ff('0x3c')](handleError(_0xb1f6ca,null));};exports[_0x35ff('0x40')]=function(_0x2d26e2,_0x506def){return db['Tag'][_0x35ff('0x40')](_0x2d26e2['body'],{})[_0x35ff('0x1e')](function(_0x2caefe){var _0x14aa90=_0x2d26e2[_0x35ff('0x41')][_0x35ff('0x42')]({'plain':!![]});if(!_0x14aa90)throw new Error(_0x35ff('0x43'));if(_0x14aa90[_0x35ff('0x44')]===_0x35ff('0x41')){var _0x3be5fc=_0x2caefe['get']({'plain':!![]});var _0x48e22b=_0x35ff('0x45');return db['UserProfileSection'][_0x35ff('0x3f')]({'where':{'name':_0x48e22b,'userProfileId':_0x14aa90[_0x35ff('0x46')]},'raw':!![]})[_0x35ff('0x1e')](function(_0x255bdc){if(_0x255bdc&&_0x255bdc[_0x35ff('0x47')]===0x0){return db[_0x35ff('0x48')][_0x35ff('0x40')]({'name':_0x3be5fc[_0x35ff('0x23')],'resourceId':_0x3be5fc['id'],'type':_0x255bdc[_0x35ff('0x23')],'sectionId':_0x255bdc['id']},{})['then'](function(){return _0x2caefe;});}else{return _0x2caefe;}})[_0x35ff('0x3c')](function(_0x39b65f){logger[_0x35ff('0x21')](_0x35ff('0x49'),_0x39b65f);throw _0x39b65f;});}return _0x2caefe;})['then'](respondWithResult(_0x506def,0xc9))['catch'](handleError(_0x506def,null));};exports['update']=function(_0x211bb2,_0x5b410d){if(_0x211bb2[_0x35ff('0x4a')]['id']){delete _0x211bb2['body']['id'];}return db[_0x35ff('0x39')]['find']({'where':{'id':_0x211bb2[_0x35ff('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5b410d,null))[_0x35ff('0x1e')](saveUpdates(_0x211bb2[_0x35ff('0x4a')],null))[_0x35ff('0x1e')](respondWithResult(_0x5b410d,null))[_0x35ff('0x3c')](handleError(_0x5b410d,null));};exports['destroy']=function(_0x497b38,_0x2be86b){return db['Tag'][_0x35ff('0x3f')]({'where':{'id':_0x497b38[_0x35ff('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2be86b,null))[_0x35ff('0x1e')](removeEntity(_0x2be86b,null))['catch'](handleError(_0x2be86b,null));}; \ No newline at end of file +var _0xb43b=['rawAttributes','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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','Tags','then','status','sendStatus','error','stack','name','send','index','Tag','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','includeAll','rows','catch','show','params'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb43b,0x1b2));var _0xbb43=function(_0x54b21c,_0x2ae127){_0x54b21c=_0x54b21c-0x0;var _0x4de32f=_0xb43b[_0x54b21c];return _0x4de32f;};'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(){var _0x53f0d5=_0x298ce2['get']({'plain':!![]});var _0x269ca5=_0xbb43('0x25');return db['UserProfileResource'][_0xbb43('0x24')]({'where':{'type':_0x269ca5,'resourceId':_0x53f0d5['id']}})[_0xbb43('0x26')](function(){return _0x298ce2;});})[_0xbb43('0x26')](function(){_0x4dfb7f[_0xbb43('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b5342,_0x27fd7a){return function(_0x42800f){if(!_0x42800f){_0x4b5342[_0xbb43('0x28')](0x194);}return _0x42800f;};}function handleError(_0x8b3205,_0x510b05){_0x510b05=_0x510b05||0x1f4;return function(_0x40b04b){logger[_0xbb43('0x29')](_0x40b04b[_0xbb43('0x2a')]);if(_0x40b04b['name']){delete _0x40b04b[_0xbb43('0x2b')];}_0x8b3205['status'](_0x510b05)[_0xbb43('0x2c')](_0x40b04b);};}exports[_0xbb43('0x2d')]=function(_0x34f5b2,_0x1880cd){var _0x555b99={},_0x157d62={},_0x547a6f={'count':0x0,'rows':[]};var _0x5566cf=_['map'](db[_0xbb43('0x2e')]['rawAttributes'],function(_0xa7e144){return{'name':_0xa7e144[_0xbb43('0x2f')],'type':_0xa7e144[_0xbb43('0x30')]['key']};});_0x157d62[_0xbb43('0x31')]=_[_0xbb43('0x32')](_0x5566cf,_0xbb43('0x2b'));_0x157d62[_0xbb43('0x33')]=_[_0xbb43('0x34')](_0x34f5b2[_0xbb43('0x33')]);_0x157d62[_0xbb43('0x35')]=_[_0xbb43('0x36')](_0x157d62['model'],_0x157d62[_0xbb43('0x33')]);_0x555b99[_0xbb43('0x37')]=_[_0xbb43('0x36')](_0x157d62[_0xbb43('0x31')],qs[_0xbb43('0x38')](_0x34f5b2[_0xbb43('0x33')][_0xbb43('0x38')]));_0x555b99[_0xbb43('0x37')]=_0x555b99[_0xbb43('0x37')][_0xbb43('0x39')]?_0x555b99[_0xbb43('0x37')]:_0x157d62[_0xbb43('0x31')];if(!_0x34f5b2[_0xbb43('0x33')][_0xbb43('0x3a')](_0xbb43('0x3b'))){_0x555b99[_0xbb43('0x1d')]=qs['limit'](_0x34f5b2[_0xbb43('0x33')][_0xbb43('0x1d')]);_0x555b99['offset']=qs[_0xbb43('0x1c')](_0x34f5b2[_0xbb43('0x33')][_0xbb43('0x1c')]);}_0x555b99['order']=qs['sort'](_0x34f5b2['query'][_0xbb43('0x3c')]);_0x555b99[_0xbb43('0x3d')]=qs['filters'](_['pick'](_0x34f5b2[_0xbb43('0x33')],_0x157d62[_0xbb43('0x35')]),_0x5566cf);if(_0x34f5b2[_0xbb43('0x33')][_0xbb43('0x3e')]){_0x555b99[_0xbb43('0x3d')]=_['merge'](_0x555b99[_0xbb43('0x3d')],{'$or':_[_0xbb43('0x32')](_0x5566cf,function(_0x2cd8b8){if(_0x2cd8b8[_0xbb43('0x30')]!==_0xbb43('0x3f')){var _0x531d96={};_0x531d96[_0x2cd8b8[_0xbb43('0x2b')]]={'$like':'%'+_0x34f5b2['query'][_0xbb43('0x3e')]+'%'};return _0x531d96;}})});}_0x555b99=_[_0xbb43('0x40')]({},_0x555b99,_0x34f5b2['options']);var _0x4783fe={'where':_0x555b99['where']};return db[_0xbb43('0x2e')][_0xbb43('0x1b')](_0x4783fe)[_0xbb43('0x26')](function(_0xb84ece){_0x547a6f['count']=_0xb84ece;if(_0x34f5b2[_0xbb43('0x33')][_0xbb43('0x41')]){_0x555b99['include']=[{'all':!![]}];}return db[_0xbb43('0x2e')]['findAll'](_0x555b99);})[_0xbb43('0x26')](function(_0x14285d){_0x547a6f[_0xbb43('0x42')]=_0x14285d;return _0x547a6f;})[_0xbb43('0x26')](respondWithFilteredResult(_0x1880cd,_0x555b99))[_0xbb43('0x43')](handleError(_0x1880cd,null));};exports[_0xbb43('0x44')]=function(_0x4bf8ed,_0x1beb2a){var _0x5686ee={'raw':!![],'where':{'id':_0x4bf8ed[_0xbb43('0x45')]['id']}},_0x307f1e={};_0x307f1e[_0xbb43('0x31')]=_[_0xbb43('0x34')](db['Tag'][_0xbb43('0x46')]);_0x307f1e[_0xbb43('0x33')]=_[_0xbb43('0x34')](_0x4bf8ed[_0xbb43('0x33')]);_0x307f1e[_0xbb43('0x35')]=_[_0xbb43('0x36')](_0x307f1e[_0xbb43('0x31')],_0x307f1e[_0xbb43('0x33')]);_0x5686ee['attributes']=_[_0xbb43('0x36')](_0x307f1e[_0xbb43('0x31')],qs['fields'](_0x4bf8ed[_0xbb43('0x33')]['fields']));_0x5686ee['attributes']=_0x5686ee['attributes']['length']?_0x5686ee[_0xbb43('0x37')]:_0x307f1e['model'];if(_0x4bf8ed[_0xbb43('0x33')]['includeAll']){_0x5686ee[_0xbb43('0x47')]=[{'all':!![]}];}_0x5686ee=_[_0xbb43('0x40')]({},_0x5686ee,_0x4bf8ed[_0xbb43('0x48')]);return db['Tag'][_0xbb43('0x49')](_0x5686ee)['then'](handleEntityNotFound(_0x1beb2a,null))[_0xbb43('0x26')](respondWithResult(_0x1beb2a,null))[_0xbb43('0x43')](handleError(_0x1beb2a,null));};exports[_0xbb43('0x4a')]=function(_0x29840e,_0x417ad9){return db[_0xbb43('0x2e')][_0xbb43('0x4a')](_0x29840e['body'],{})[_0xbb43('0x26')](function(_0x26ea59){var _0x202059=_0x29840e[_0xbb43('0x4b')]['get']({'plain':!![]});if(!_0x202059)throw new Error(_0xbb43('0x4c'));if(_0x202059[_0xbb43('0x4d')]===_0xbb43('0x4b')){var _0xb1883e=_0x26ea59['get']({'plain':!![]});var _0x3206c0=_0xbb43('0x25');return db[_0xbb43('0x4e')]['find']({'where':{'name':_0x3206c0,'userProfileId':_0x202059[_0xbb43('0x4f')]},'raw':!![]})[_0xbb43('0x26')](function(_0x73d4ce){if(_0x73d4ce&&_0x73d4ce[_0xbb43('0x50')]===0x0){return db[_0xbb43('0x51')]['create']({'name':_0xb1883e['name'],'resourceId':_0xb1883e['id'],'type':_0x73d4ce[_0xbb43('0x2b')],'sectionId':_0x73d4ce['id']},{})['then'](function(){return _0x26ea59;});}else{return _0x26ea59;}})[_0xbb43('0x43')](function(_0xe0cdba){logger['error'](_0xbb43('0x52'),_0xe0cdba);throw _0xe0cdba;});}return _0x26ea59;})[_0xbb43('0x26')](respondWithResult(_0x417ad9,0xc9))[_0xbb43('0x43')](handleError(_0x417ad9,null));};exports[_0xbb43('0x23')]=function(_0x1dfbb9,_0x5cb3c6){if(_0x1dfbb9[_0xbb43('0x53')]['id']){delete _0x1dfbb9['body']['id'];}return db['Tag'][_0xbb43('0x49')]({'where':{'id':_0x1dfbb9[_0xbb43('0x45')]['id']}})[_0xbb43('0x26')](handleEntityNotFound(_0x5cb3c6,null))[_0xbb43('0x26')](saveUpdates(_0x1dfbb9[_0xbb43('0x53')],null))['then'](respondWithResult(_0x5cb3c6,null))['catch'](handleError(_0x5cb3c6,null));};exports[_0xbb43('0x24')]=function(_0x157824,_0x3a84ad){return db[_0xbb43('0x2e')][_0xbb43('0x49')]({'where':{'id':_0x157824[_0xbb43('0x45')]['id']}})[_0xbb43('0x26')](handleEntityNotFound(_0x3a84ad,null))[_0xbb43('0x26')](removeEntity(_0x3a84ad,null))[_0xbb43('0x43')](handleError(_0x3a84ad,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 13ad2dc..2c6fb6a 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 _0x6d93=['./tag.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x6d93,0x177));var _0x36d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6d93[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x36d9('0x0'));var util=require(_0x36d9('0x1'));var logger=require(_0x36d9('0x2'))(_0x36d9('0x3'));var moment=require(_0x36d9('0x4'));var BPromise=require(_0x36d9('0x5'));var rp=require(_0x36d9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x36d9('0x7'));var config=require(_0x36d9('0x8'));var attributes=require(_0x36d9('0x9'));module[_0x36d9('0xa')]=function(_0xfa7c15,_0x2b2f4e){return _0xfa7c15[_0x36d9('0xb')]('Tag',attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf73a=['Tag','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define'];(function(_0x4d572e,_0x59ceb7){var _0x43a969=function(_0x2184d1){while(--_0x2184d1){_0x4d572e['push'](_0x4d572e['shift']());}};_0x43a969(++_0x59ceb7);}(_0xf73a,0x115));var _0xaf73=function(_0x430c0b,_0x3a3b8e){_0x430c0b=_0x430c0b-0x0;var _0x3d99ed=_0xf73a[_0x430c0b];return _0x3d99ed;};'use strict';var _=require(_0xaf73('0x0'));var util=require(_0xaf73('0x1'));var logger=require('../../config/logger')(_0xaf73('0x2'));var moment=require('moment');var BPromise=require(_0xaf73('0x3'));var rp=require(_0xaf73('0x4'));var fs=require('fs');var path=require(_0xaf73('0x5'));var rimraf=require(_0xaf73('0x6'));var config=require(_0xaf73('0x7'));var attributes=require(_0xaf73('0x8'));module[_0xaf73('0x9')]=function(_0x9aac6f,_0x8b99c3){return _0x9aac6f[_0xaf73('0xa')](_0xaf73('0xb'),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 808aee0..2bcbd49 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 _0x4fdb=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','Tag,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x42a584,_0x2d9ee3){var _0x56be59=function(_0x5809dd){while(--_0x5809dd){_0x42a584['push'](_0x42a584['shift']());}};_0x56be59(++_0x2d9ee3);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x516ab7,_0x30c96a){_0x516ab7=_0x516ab7-0x0;var _0x57d977=_0x4fdb[_0x516ab7];return _0x57d977;};'use strict';var _=require(_0xb4fd('0x0'));var util=require(_0xb4fd('0x1'));var moment=require(_0xb4fd('0x2'));var BPromise=require(_0xb4fd('0x3'));var rs=require(_0xb4fd('0x4'));var fs=require('fs');var Redis=require(_0xb4fd('0x5'));var db=require(_0xb4fd('0x6'))['db'];var utils=require(_0xb4fd('0x7'));var logger=require(_0xb4fd('0x8'))('rpc');var config=require(_0xb4fd('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb4fd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53273f,_0x299bff,_0x3af8e3){return new BPromise(function(_0x1151b5,_0x52dca2){return client['request'](_0x53273f,_0x3af8e3)[_0xb4fd('0xb')](function(_0x4f9d18){logger[_0xb4fd('0xc')]('Tag,\x20%s,\x20%s',_0x299bff,_0xb4fd('0xd'));logger[_0xb4fd('0xe')](_0xb4fd('0xf'),_0x299bff,_0xb4fd('0xd'),JSON[_0xb4fd('0x10')](_0x4f9d18));if(_0x4f9d18['error']){if(_0x4f9d18[_0xb4fd('0x11')][_0xb4fd('0x12')]===0x1f4){logger[_0xb4fd('0x11')](_0xb4fd('0x13'),_0x299bff,_0x4f9d18['error'][_0xb4fd('0x14')]);return _0x52dca2(_0x4f9d18[_0xb4fd('0x11')][_0xb4fd('0x14')]);}logger['error'](_0xb4fd('0x13'),_0x299bff,_0x4f9d18[_0xb4fd('0x11')][_0xb4fd('0x14')]);return _0x1151b5(_0x4f9d18[_0xb4fd('0x11')][_0xb4fd('0x14')]);}else{logger[_0xb4fd('0xc')](_0xb4fd('0x13'),_0x299bff,'request\x20sent');_0x1151b5(_0x4f9d18[_0xb4fd('0x15')][_0xb4fd('0x14')]);}})[_0xb4fd('0x16')](function(_0x2d4701){logger[_0xb4fd('0x11')](_0xb4fd('0x13'),_0x299bff,_0x2d4701);_0x52dca2(_0x2d4701);});});} \ No newline at end of file +var _0xe198=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Tag,\x20%s,\x20%s','catch','lodash','util','randomstring','ioredis'];(function(_0x2bd7c3,_0x4d0f79){var _0x415639=function(_0xefaa3c){while(--_0xefaa3c){_0x2bd7c3['push'](_0x2bd7c3['shift']());}};_0x415639(++_0x4d0f79);}(_0xe198,0x6f));var _0x8e19=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xe198[_0x279d37];return _0x530173;};'use strict';var _=require(_0x8e19('0x0'));var util=require(_0x8e19('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8e19('0x2'));var fs=require('fs');var Redis=require(_0x8e19('0x3'));var db=require(_0x8e19('0x4'))['db'];var utils=require(_0x8e19('0x5'));var logger=require(_0x8e19('0x6'))('rpc');var config=require(_0x8e19('0x7'));var jayson=require(_0x8e19('0x8'));var client=jayson[_0x8e19('0x9')][_0x8e19('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1175d6,_0x4db35e,_0x1e61ae){return new BPromise(function(_0xfc45e,_0xfc4670){return client[_0x8e19('0xb')](_0x1175d6,_0x1e61ae)[_0x8e19('0xc')](function(_0x41e998){logger[_0x8e19('0xd')]('Tag,\x20%s,\x20%s',_0x4db35e,_0x8e19('0xe'));logger[_0x8e19('0xf')](_0x8e19('0x10'),_0x4db35e,_0x8e19('0xe'),JSON[_0x8e19('0x11')](_0x41e998));if(_0x41e998[_0x8e19('0x12')]){if(_0x41e998[_0x8e19('0x12')][_0x8e19('0x13')]===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0x4db35e,_0x41e998[_0x8e19('0x12')]['message']);return _0xfc4670(_0x41e998['error'][_0x8e19('0x14')]);}logger[_0x8e19('0x12')](_0x8e19('0x15'),_0x4db35e,_0x41e998[_0x8e19('0x12')]['message']);return _0xfc45e(_0x41e998[_0x8e19('0x12')][_0x8e19('0x14')]);}else{logger['info'](_0x8e19('0x15'),_0x4db35e,_0x8e19('0xe'));_0xfc45e(_0x41e998['result'][_0x8e19('0x14')]);}})[_0x8e19('0x16')](function(_0x47680f){logger[_0x8e19('0x12')](_0x8e19('0x15'),_0x4db35e,_0x47680f);_0xfc4670(_0x47680f);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 79e9a3d..331f11d 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 386ce52..a825621 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['name','exports','STRING'];(function(_0x270a54,_0x307ff6){var _0x4d07d0=function(_0x59ac5a){while(--_0x59ac5a){_0x270a54['push'](_0x270a54['shift']());}};_0x4d07d0(++_0x307ff6);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'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 _0xb10b=['name','sequelize','STRING'];(function(_0x38a807,_0x25366b){var _0x1efde2=function(_0xe497f2){while(--_0xe497f2){_0x38a807['push'](_0x38a807['shift']());}};_0x1efde2(++_0x25366b);}(_0xb10b,0x12a));var _0xbb10=function(_0x2ba054,_0x4cfa79){_0x2ba054=_0x2ba054-0x0;var _0x5d2153=_0xb10b[_0x2ba054];return _0x5d2153;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index a56e03e..301a450 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 _0xd244=['SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId','send','getQueues','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','sort','Queues','addQueues','findOne','add','ids','removeQueues','isArray','Chat','Mail','Sms','Openchannel','penalty','QueueId','Voice','TeamVoiceQueue','User','findOrCreate','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','TeamVoicePrefix','addAgents','spread','Fax','Whatsapp','transaction','removeAgents','emit','Queue:remove','getAgents','eml-format','rimraf','zip-dir','moment','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','stack','name','index','map','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','Team','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue'];(function(_0x3feec6,_0x4db012){var _0x56d5e2=function(_0x108629){while(--_0x108629){_0x3feec6['push'](_0x3feec6['shift']());}};_0x56d5e2(++_0x4db012);}(_0xd244,0xd8));var _0x4d24=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0xd244[_0x494d1f];return _0x457b6e;};'use strict';var emlformat=require(_0x4d24('0x0'));var rimraf=require(_0x4d24('0x1'));var zipdir=require(_0x4d24('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4d24('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4d24('0x4'));var util=require('util');var path=require(_0x4d24('0x5'));var sox=require(_0x4d24('0x6'));var csv=require('to-csv');var ejs=require(_0x4d24('0x7'));var fs=require('fs');var fs_extra=require(_0x4d24('0x8'));var _=require(_0x4d24('0x9'));var squel=require('squel');var crypto=require(_0x4d24('0xa'));var jsforce=require(_0x4d24('0xb'));var deskjs=require(_0x4d24('0xc'));var toCsv=require(_0x4d24('0xd'));var querystring=require(_0x4d24('0xe'));var Papa=require('papaparse');var Redis=require(_0x4d24('0xf'));var authService=require(_0x4d24('0x10'));var qs=require(_0x4d24('0x11'));var as=require(_0x4d24('0x12'));var hardwareService=require(_0x4d24('0x13'));var logger=require(_0x4d24('0x14'))('api');var utils=require(_0x4d24('0x15'));var config=require(_0x4d24('0x16'));var licenseUtil=require(_0x4d24('0x17'));var db=require(_0x4d24('0x18'))['db'];config[_0x4d24('0x19')]=_[_0x4d24('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4d24('0x1b'))(new Redis(config[_0x4d24('0x19')]));require(_0x4d24('0x1c'))[_0x4d24('0x1d')](socket);function respondWithStatusCode(_0x370adc,_0x28d1fd){_0x28d1fd=_0x28d1fd||0xcc;return function(_0x2e1fb3){if(_0x2e1fb3){return _0x370adc[_0x4d24('0x1e')](_0x28d1fd);}return _0x370adc[_0x4d24('0x1f')](_0x28d1fd)[_0x4d24('0x20')]();};}function respondWithResult(_0x398594,_0x4c5f42){_0x4c5f42=_0x4c5f42||0xc8;return function(_0x33d908){if(_0x33d908){return _0x398594[_0x4d24('0x1f')](_0x4c5f42)['json'](_0x33d908);}};}function respondWithFilteredResult(_0x497783,_0x4c8ef5){return function(_0x4cfc35){if(_0x4cfc35){var _0x5370e8=typeof _0x4c8ef5[_0x4d24('0x21')]===_0x4d24('0x22')&&typeof _0x4c8ef5[_0x4d24('0x23')]===_0x4d24('0x22');var _0x5f4db3=_0x4cfc35[_0x4d24('0x24')];var _0x5addf0=_0x5370e8?0x0:_0x4c8ef5[_0x4d24('0x21')];var _0x215c86=_0x5370e8?_0x4cfc35['count']:_0x4c8ef5['offset']+_0x4c8ef5[_0x4d24('0x23')];var _0x529928;if(_0x215c86>=_0x5f4db3){_0x215c86=_0x5f4db3;_0x529928=0xc8;}else{_0x529928=0xce;}_0x497783[_0x4d24('0x1f')](_0x529928);return _0x497783[_0x4d24('0x25')](_0x4d24('0x26'),_0x5addf0+'-'+_0x215c86+'/'+_0x5f4db3)[_0x4d24('0x27')](_0x4cfc35);}return null;};}function patchUpdates(_0xd7d9db){return function(_0x40d187){try{jsonpatch[_0x4d24('0x28')](_0x40d187,_0xd7d9db,!![]);}catch(_0x1004c6){return BPromise[_0x4d24('0x29')](_0x1004c6);}return _0x40d187[_0x4d24('0x2a')]();};}function saveUpdates(_0x27ad21,_0x455f91){return function(_0x28a42d){if(_0x28a42d){return _0x28a42d[_0x4d24('0x2b')](_0x27ad21)[_0x4d24('0x2c')](function(_0xe2245){return _0xe2245;});}return null;};}function handleEntityNotFound(_0x377dc1,_0x335cd5){return function(_0x1e7bae){if(!_0x1e7bae){_0x377dc1[_0x4d24('0x1e')](0x194);}return _0x1e7bae;};}function handleError(_0x34fba1,_0x434f10){_0x434f10=_0x434f10||0x1f4;return function(_0x34c60b){logger['error'](_0x34c60b[_0x4d24('0x2d')]);if(_0x34c60b[_0x4d24('0x2e')]){delete _0x34c60b['name'];}_0x34fba1[_0x4d24('0x1f')](_0x434f10)['send'](_0x34c60b);};}exports[_0x4d24('0x2f')]=function(_0x35df22,_0x586003){var _0x545800={},_0x3978c3={},_0x3a3ce6={'count':0x0,'rows':[]};var _0x263224=_['map'](db['Team']['rawAttributes'],function(_0x39ae1c){return{'name':_0x39ae1c['fieldName'],'type':_0x39ae1c['type']['key']};});_0x3978c3['model']=_[_0x4d24('0x30')](_0x263224,'name');_0x3978c3['query']=_[_0x4d24('0x31')](_0x35df22[_0x4d24('0x32')]);_0x3978c3[_0x4d24('0x33')]=_[_0x4d24('0x34')](_0x3978c3['model'],_0x3978c3[_0x4d24('0x32')]);_0x545800[_0x4d24('0x35')]=_[_0x4d24('0x34')](_0x3978c3[_0x4d24('0x36')],qs[_0x4d24('0x37')](_0x35df22[_0x4d24('0x32')][_0x4d24('0x37')]));_0x545800[_0x4d24('0x35')]=_0x545800[_0x4d24('0x35')]['length']?_0x545800[_0x4d24('0x35')]:_0x3978c3[_0x4d24('0x36')];if(!_0x35df22['query'][_0x4d24('0x38')](_0x4d24('0x39'))){_0x545800[_0x4d24('0x23')]=qs[_0x4d24('0x23')](_0x35df22[_0x4d24('0x32')][_0x4d24('0x23')]);_0x545800[_0x4d24('0x21')]=qs['offset'](_0x35df22[_0x4d24('0x32')][_0x4d24('0x21')]);}_0x545800[_0x4d24('0x3a')]=qs['sort'](_0x35df22['query']['sort']);_0x545800[_0x4d24('0x3b')]=qs['filters'](_[_0x4d24('0x3c')](_0x35df22['query'],_0x3978c3[_0x4d24('0x33')]),_0x263224);if(_0x35df22[_0x4d24('0x32')][_0x4d24('0x3d')]){_0x545800[_0x4d24('0x3b')]=_[_0x4d24('0x3e')](_0x545800['where'],{'$or':_[_0x4d24('0x30')](_0x263224,function(_0x87036b){if(_0x87036b[_0x4d24('0x3f')]!==_0x4d24('0x40')){var _0x20e3de={};_0x20e3de[_0x87036b[_0x4d24('0x2e')]]={'$like':'%'+_0x35df22['query'][_0x4d24('0x3d')]+'%'};return _0x20e3de;}})});}_0x545800=_['merge']({},_0x545800,_0x35df22[_0x4d24('0x41')]);var _0x443924={'where':_0x545800[_0x4d24('0x3b')]};return db[_0x4d24('0x42')][_0x4d24('0x24')](_0x443924)[_0x4d24('0x2c')](function(_0x1959b7){_0x3a3ce6[_0x4d24('0x24')]=_0x1959b7;if(_0x35df22['query'][_0x4d24('0x43')]){_0x545800[_0x4d24('0x44')]=[{'all':!![]}];}return db[_0x4d24('0x42')][_0x4d24('0x45')](_0x545800);})[_0x4d24('0x2c')](function(_0x2b3251){_0x3a3ce6[_0x4d24('0x46')]=_0x2b3251;return _0x3a3ce6;})[_0x4d24('0x2c')](respondWithFilteredResult(_0x586003,_0x545800))[_0x4d24('0x47')](handleError(_0x586003,null));};exports[_0x4d24('0x48')]=function(_0xa6bcca,_0xe21ea8){var _0x51632b={'raw':![],'where':{'id':_0xa6bcca[_0x4d24('0x49')]['id']}},_0x2df509={};_0x2df509[_0x4d24('0x36')]=_[_0x4d24('0x31')](db[_0x4d24('0x42')][_0x4d24('0x4a')]);_0x2df509[_0x4d24('0x32')]=_[_0x4d24('0x31')](_0xa6bcca[_0x4d24('0x32')]);_0x2df509[_0x4d24('0x33')]=_[_0x4d24('0x34')](_0x2df509[_0x4d24('0x36')],_0x2df509[_0x4d24('0x32')]);_0x51632b[_0x4d24('0x35')]=_[_0x4d24('0x34')](_0x2df509[_0x4d24('0x36')],qs[_0x4d24('0x37')](_0xa6bcca['query'][_0x4d24('0x37')]));_0x51632b[_0x4d24('0x35')]=_0x51632b['attributes'][_0x4d24('0x4b')]?_0x51632b[_0x4d24('0x35')]:_0x2df509[_0x4d24('0x36')];if(_0xa6bcca[_0x4d24('0x32')][_0x4d24('0x43')]){_0x51632b['include']=[{'all':!![]}];}_0x51632b=_[_0x4d24('0x3e')]({},_0x51632b,_0xa6bcca['options']);return db['Team'][_0x4d24('0x4c')](_0x51632b)['then'](handleEntityNotFound(_0xe21ea8,null))[_0x4d24('0x2c')](respondWithResult(_0xe21ea8,null))[_0x4d24('0x47')](handleError(_0xe21ea8,null));};exports['create']=function(_0x5ce442,_0xd06fdc){return db[_0x4d24('0x42')]['create'](_0x5ce442[_0x4d24('0x4d')],{})[_0x4d24('0x2c')](function(_0x357fa8){var _0xbbc94e=_0x5ce442[_0x4d24('0x4e')][_0x4d24('0x4f')]({'plain':!![]});if(!_0xbbc94e)throw new Error(_0x4d24('0x50'));if(_0xbbc94e[_0x4d24('0x51')]===_0x4d24('0x4e')){var _0x4ea617=_0x357fa8[_0x4d24('0x4f')]({'plain':!![]});var _0x51375e=_0x4d24('0x52');return db[_0x4d24('0x53')][_0x4d24('0x4c')]({'where':{'name':_0x51375e,'userProfileId':_0xbbc94e[_0x4d24('0x54')]},'raw':!![]})['then'](function(_0x18b20e){if(_0x18b20e&&_0x18b20e['autoAssociation']===0x0){return db[_0x4d24('0x55')]['create']({'name':_0x4ea617[_0x4d24('0x2e')],'resourceId':_0x4ea617['id'],'type':_0x18b20e['name'],'sectionId':_0x18b20e['id']},{})['then'](function(){return _0x357fa8;});}else{return _0x357fa8;}})[_0x4d24('0x47')](function(_0x42141b){logger['error'](_0x4d24('0x56'),_0x42141b);throw _0x42141b;});}return _0x357fa8;})[_0x4d24('0x2c')](respondWithResult(_0xd06fdc,0xc9))[_0x4d24('0x47')](handleError(_0xd06fdc,null));};exports[_0x4d24('0x2b')]=function(_0x1bcfd8,_0x5f18a4){if(_0x1bcfd8[_0x4d24('0x4d')]['id']){delete _0x1bcfd8[_0x4d24('0x4d')]['id'];}return db[_0x4d24('0x42')][_0x4d24('0x4c')]({'where':{'id':_0x1bcfd8[_0x4d24('0x49')]['id']}})[_0x4d24('0x2c')](handleEntityNotFound(_0x5f18a4,null))[_0x4d24('0x2c')](saveUpdates(_0x1bcfd8[_0x4d24('0x4d')],null))['then'](respondWithResult(_0x5f18a4,null))['catch'](handleError(_0x5f18a4,null));};exports[_0x4d24('0x57')]=function(_0x54b172,_0x15d292){var _0x713186=_0x54b172[_0x4d24('0x49')]['id'];var _0x3fb910=[];return db['sequelize']['transaction'](function(_0x22a581){var _0x4beda7=_0x4d24('0x58')+_0x713186;return db[_0x4d24('0x59')]['query'](_0x4beda7,{'type':db['Sequelize'][_0x4d24('0x5a')][_0x4d24('0x5b')],'raw':!![],'transaction':_0x22a581})[_0x4d24('0x2c')](function(_0xd29122){_0x3fb910=_[_0x4d24('0x30')](_0xd29122,function(_0x17f126){return Number(_0x17f126['UserId']);});})[_0x4d24('0x2c')](function(){var _0x442c4f=_0x4d24('0x5c')+_0x713186;return db[_0x4d24('0x59')]['query'](_0x442c4f,{'type':db[_0x4d24('0x5d')][_0x4d24('0x5a')][_0x4d24('0x5b')],'raw':!![],'transaction':_0x22a581});})[_0x4d24('0x2c')](function(_0x5234b9){var _0x47ad25=_[_0x4d24('0x30')](_0x5234b9,function(_0x51464e){return Number(_0x51464e[_0x4d24('0x5e')]);});return db[_0x4d24('0x5f')][_0x4d24('0x57')]({'where':{'UserId':{'$in':_0x3fb910},'VoiceQueueId':{'$in':_0x47ad25}},'transaction':_0x22a581});})[_0x4d24('0x2c')](function(){var _0x46d9ea=_0x4d24('0x60')+_0x713186;return db[_0x4d24('0x59')][_0x4d24('0x32')](_0x46d9ea,{'type':db['Sequelize']['QueryTypes'][_0x4d24('0x5b')],'raw':!![],'transaction':_0x22a581});})[_0x4d24('0x2c')](function(_0x1be48c){var _0x3496f6=_[_0x4d24('0x30')](_0x1be48c,function(_0xaa95c7){return Number(_0xaa95c7[_0x4d24('0x61')]);});return db[_0x4d24('0x62')][_0x4d24('0x57')]({'where':{'UserId':{'$in':_0x3fb910},'MailQueueId':{'$in':_0x3496f6}},'transaction':_0x22a581});})[_0x4d24('0x2c')](function(){var _0x5f166d=_0x4d24('0x63')+_0x713186;return db['sequelize']['query'](_0x5f166d,{'type':db[_0x4d24('0x5d')]['QueryTypes'][_0x4d24('0x5b')],'raw':!![],'transaction':_0x22a581});})[_0x4d24('0x2c')](function(_0x3efe0e){var _0x3a93c1=_[_0x4d24('0x30')](_0x3efe0e,function(_0x1552d4){return Number(_0x1552d4[_0x4d24('0x64')]);});return db[_0x4d24('0x65')][_0x4d24('0x57')]({'where':{'UserId':{'$in':_0x3fb910},'SmsQueueId':{'$in':_0x3a93c1}},'transaction':_0x22a581});})[_0x4d24('0x2c')](function(){var _0x86e2b3=_0x4d24('0x66')+_0x713186;return db[_0x4d24('0x59')][_0x4d24('0x32')](_0x86e2b3,{'type':db[_0x4d24('0x5d')]['QueryTypes'][_0x4d24('0x5b')],'raw':!![],'transaction':_0x22a581});})[_0x4d24('0x2c')](function(_0xcf42d1){var _0x4f613c=_['map'](_0xcf42d1,function(_0x43aa45){return Number(_0x43aa45[_0x4d24('0x67')]);});return db[_0x4d24('0x68')][_0x4d24('0x57')]({'where':{'UserId':{'$in':_0x3fb910},'ChatQueueId':{'$in':_0x4f613c}},'transaction':_0x22a581});})[_0x4d24('0x2c')](function(){var _0x70cc53=_0x4d24('0x69')+_0x713186;return db['sequelize'][_0x4d24('0x32')](_0x70cc53,{'type':db[_0x4d24('0x5d')][_0x4d24('0x5a')]['SELECT'],'raw':!![],'transaction':_0x22a581});})['then'](function(_0x3ee80b){var _0x5d11d9=_[_0x4d24('0x30')](_0x3ee80b,function(_0x5a4b93){return Number(_0x5a4b93['FaxQueueId']);});return db[_0x4d24('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x3fb910},'FaxQueueId':{'$in':_0x5d11d9}},'transaction':_0x22a581});})[_0x4d24('0x2c')](function(){var _0x45b58e='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x713186;return db[_0x4d24('0x59')][_0x4d24('0x32')](_0x45b58e,{'type':db[_0x4d24('0x5d')][_0x4d24('0x5a')][_0x4d24('0x5b')],'raw':!![],'transaction':_0x22a581});})['then'](function(_0x3ad931){var _0x151839=_[_0x4d24('0x30')](_0x3ad931,function(_0x2ab93e){return Number(_0x2ab93e['OpenchannelQueueId']);});return db[_0x4d24('0x6b')]['destroy']({'where':{'UserId':{'$in':_0x3fb910},'OpenchannelQueueId':{'$in':_0x151839}},'transaction':_0x22a581});})['then'](function(){var _0x11b7c4=_0x4d24('0x6c')+_0x713186;return db[_0x4d24('0x59')][_0x4d24('0x32')](_0x11b7c4,{'type':db[_0x4d24('0x5d')][_0x4d24('0x5a')][_0x4d24('0x5b')],'raw':!![],'transaction':_0x22a581});})[_0x4d24('0x2c')](function(_0x28fa91){var _0x865c79=_[_0x4d24('0x30')](_0x28fa91,function(_0x4da5c5){return Number(_0x4da5c5['WhatsappQueueId']);});return db[_0x4d24('0x6d')]['destroy']({'where':{'UserId':{'$in':_0x3fb910},'WhatsappQueueId':{'$in':_0x865c79}},'transaction':_0x22a581});})['then'](function(){return db['TeamVoicePrefix']['find']({'where':{'TeamId':_0x713186}});})[_0x4d24('0x2c')](function(_0x362438){if(_0x362438===null){return;}return db[_0x4d24('0x6e')][_0x4d24('0x57')]({'where':{'UserId':{'$in':_0x3fb910},'VoicePrefixId':_0x362438[_0x4d24('0x6f')]},'transaction':_0x22a581});})[_0x4d24('0x2c')](function(){return db['Team'][_0x4d24('0x57')]({'where':{'id':_0x713186},'cascade':!![],'transaction':_0x22a581});})[_0x4d24('0x2c')](function(_0x51290f){if(_0x51290f===0x0){_0x15d292[_0x4d24('0x1e')](0x194);}else{return db[_0x4d24('0x55')][_0x4d24('0x57')]({'where':{'type':_0x4d24('0x52'),'resourceId':_0x713186},'cascade':!![],'transaction':_0x22a581})[_0x4d24('0x2c')](function(){_0x15d292[_0x4d24('0x1f')](0xcc)[_0x4d24('0x20')]();});}})[_0x4d24('0x47')](function(_0x27ad36){_0x15d292[_0x4d24('0x1f')](0x1f4)[_0x4d24('0x70')](_0x27ad36);});});};exports[_0x4d24('0x71')]=function(_0x2532b9,_0x40938d,_0x78ed81){return db[_0x4d24('0x42')]['findOne']({'where':{'id':_0x2532b9['params']['id']}})[_0x4d24('0x2c')](handleEntityNotFound(_0x40938d,null))['then'](function(_0x16116d){if(!_0x2532b9[_0x4d24('0x32')][_0x4d24('0x72')]||!utils[_0x4d24('0x73')](_0x2532b9['query']['channel'])){throw new db[(_0x4d24('0x5d'))][(_0x4d24('0x74'))](_0x4d24('0x75'));}var _0x3e2172={};var _0x4e01d7={};_0x4e01d7[_0x4d24('0x36')]=_[_0x4d24('0x31')](db[_[_0x4d24('0x76')](_0x2532b9[_0x4d24('0x32')]['channel'][_0x4d24('0x77')]())+_0x4d24('0x78')][_0x4d24('0x4a')]);_0x4e01d7[_0x4d24('0x32')]=_['keys'](_0x2532b9['query']);_0x4e01d7[_0x4d24('0x33')]=_[_0x4d24('0x34')](_0x4e01d7['model'],_0x4e01d7[_0x4d24('0x32')]);_0x3e2172[_0x4d24('0x35')]=_[_0x4d24('0x34')](_0x4e01d7[_0x4d24('0x36')],qs['fields'](_0x2532b9[_0x4d24('0x32')][_0x4d24('0x37')]));_0x3e2172['attributes']=_0x3e2172['attributes'][_0x4d24('0x4b')]?_0x3e2172['attributes']:_0x4e01d7[_0x4d24('0x36')];_0x3e2172[_0x4d24('0x23')]=qs[_0x4d24('0x23')](_0x2532b9[_0x4d24('0x32')][_0x4d24('0x23')]);_0x3e2172['offset']=qs['offset'](_0x2532b9[_0x4d24('0x32')][_0x4d24('0x21')]);_0x3e2172[_0x4d24('0x3a')]=qs[_0x4d24('0x79')](_0x2532b9[_0x4d24('0x32')][_0x4d24('0x79')]);_0x3e2172[_0x4d24('0x3b')]=qs[_0x4d24('0x33')](_[_0x4d24('0x3c')](_0x2532b9['query'],_0x4e01d7[_0x4d24('0x33')]));_0x3e2172=_[_0x4d24('0x3e')]({},_0x3e2172,_0x2532b9[_0x4d24('0x41')]);return _0x16116d[_0x4d24('0x4f')+_['capitalize'](_0x2532b9[_0x4d24('0x32')][_0x4d24('0x72')]['toLowerCase']())+_0x4d24('0x7a')](_0x3e2172);})[_0x4d24('0x2c')](respondWithResult(_0x40938d,null))[_0x4d24('0x47')](handleError(_0x40938d,null));};exports[_0x4d24('0x7b')]=function(_0x3c430e,_0x2cbc79,_0x17f1ce){return db[_0x4d24('0x42')][_0x4d24('0x7c')]({'where':{'id':_0x3c430e[_0x4d24('0x49')]['id']}})[_0x4d24('0x2c')](function(_0x228b6e){if(_0x228b6e){if(!_0x3c430e[_0x4d24('0x4d')][_0x4d24('0x72')]||!utils['isValidChannel'](_0x3c430e[_0x4d24('0x4d')][_0x4d24('0x72')])){throw new db[(_0x4d24('0x5d'))][(_0x4d24('0x74'))](_0x4d24('0x75'));}return _0x228b6e[_0x4d24('0x7d')+_['capitalize'](_0x3c430e[_0x4d24('0x4d')][_0x4d24('0x72')][_0x4d24('0x77')]())+'Queues'](_0x3c430e[_0x4d24('0x4d')][_0x4d24('0x7e')]);}return null;})[_0x4d24('0x2c')](handleEntityNotFound(_0x2cbc79,null))[_0x4d24('0x2c')](respondWithStatusCode(_0x2cbc79,null))[_0x4d24('0x47')](handleError(_0x2cbc79,null));};exports[_0x4d24('0x7f')]=function(_0x3a8188,_0x347381,_0x1072be){return db[_0x4d24('0x42')]['findOne']({'where':{'id':_0x3a8188[_0x4d24('0x49')]['id']}})[_0x4d24('0x2c')](function(_0xf716){if(_0xf716){if(!_0x3a8188[_0x4d24('0x32')][_0x4d24('0x72')]||!utils[_0x4d24('0x73')](_0x3a8188[_0x4d24('0x32')][_0x4d24('0x72')])){throw new db[(_0x4d24('0x5d'))][(_0x4d24('0x74'))](_0x4d24('0x75'));}return _0xf716['remove'+_[_0x4d24('0x76')](_0x3a8188[_0x4d24('0x32')][_0x4d24('0x72')][_0x4d24('0x77')]())+_0x4d24('0x7a')](_0x3a8188[_0x4d24('0x32')][_0x4d24('0x7e')]);}return null;})['then'](handleEntityNotFound(_0x347381,null))[_0x4d24('0x2c')](respondWithStatusCode(_0x347381,null))[_0x4d24('0x47')](handleError(_0x347381,null));};exports['addAgents']=function(_0x56fa51,_0xaeadbb){var _0x33c05f=_[_0x4d24('0x80')](_0x56fa51['body'][_0x4d24('0x7e')])?_0x56fa51[_0x4d24('0x4d')]['ids']:[_0x56fa51[_0x4d24('0x4d')]['ids']];var _0xc7f7ff=_0x56fa51['params']['id'];return db[_0x4d24('0x42')]['find']({'where':{'id':_0xc7f7ff}})[_0x4d24('0x2c')](handleEntityNotFound(_0xaeadbb,null))['then'](function(_0x48f60b){if(_0x48f60b){var _0xb20a5c=['Voice',_0x4d24('0x81'),_0x4d24('0x82'),_0x4d24('0x83'),'Fax',_0x4d24('0x84'),'Whatsapp'];return db[_0x4d24('0x59')]['transaction'](function(_0x17fbe5){var _0x6da4f=_[_0x4d24('0x30')](_0xb20a5c,function(_0x5d4844){var _0x23f2e7={'attributes':['id',_0x4d24('0x2e')]};if(_0x5d4844==='Voice'){_0x23f2e7['through']={'attributes':[_0x4d24('0x85')]};}return _0x48f60b['get'+_0x5d4844+_0x4d24('0x7a')](_0x23f2e7)[_0x4d24('0x2c')](function(_0x53a13c){var _0x353505=_[_0x4d24('0x30')](_0x53a13c,function(_0x30cdcd){var _0x4cbf51=_[_0x4d24('0x30')](_0x33c05f,function(_0x413609){var _0x5e641f={'where':{'UserId':_0x413609,[_0x5d4844+_0x4d24('0x86')]:_0x30cdcd['id']},'transaction':_0x17fbe5};if(_0x5d4844===_0x4d24('0x87')){_0x5e641f[_0x4d24('0x1a')]={'penalty':_0x30cdcd[_0x4d24('0x88')]['penalty']};}return db[_0x4d24('0x89')+_0x5d4844+_0x4d24('0x78')][_0x4d24('0x8a')](_0x5e641f)[_0x4d24('0x2c')](function(){socket['emit'](_0x4d24('0x4e')+_0x5d4844+_0x4d24('0x8b'),{'UserId':_0x413609,[_0x5d4844+'QueueId']:_0x30cdcd['id']});if(_0x5d4844!==_0x4d24('0x87')){return;}return db[_0x4d24('0x89')]['findAll']({'where':{'id':_0x33c05f,'online':0x1},'attributes':['id',_0x4d24('0x2e'),_0x4d24('0x8c'),_0x4d24('0x8d'),_0x4d24('0x8e')],'raw':!![]})[_0x4d24('0x2c')](function(_0x4b9567){var _0x3c7ec8=_[_0x4d24('0x30')](_0x4b9567,function(_0x1545b5){return db[_0x4d24('0x8f')][_0x4d24('0x90')]({'membername':_0x1545b5['name'],'UserId':_0x1545b5['id'],'queue_name':_0x30cdcd[_0x4d24('0x2e')],'VoiceQueueId':_0x30cdcd['id'],'interface':_[_0x4d24('0x91')](_0x1545b5[_0x4d24('0x8e')])?util[_0x4d24('0x92')](_0x4d24('0x93'),_0x1545b5[_0x4d24('0x2e')]):_0x1545b5[_0x4d24('0x8e')],'paused':_0x1545b5[_0x4d24('0x8d')]||![],'penalty':_0x30cdcd[_0x4d24('0x88')][_0x4d24('0x85')]},{'transaction':_0x17fbe5});});return Promise[_0x4d24('0x94')](_0x3c7ec8);});});});return Promise[_0x4d24('0x94')](_0x4cbf51);});return Promise['all'](_0x353505);})[_0x4d24('0x2c')](function(){return db[_0x4d24('0x95')]['findOne']({'where':{'teamId':_0xc7f7ff}})[_0x4d24('0x2c')](function(_0x5e06cc){if(_0x5e06cc){var _0x2ba046=_[_0x4d24('0x30')](_0x33c05f,function(_0x8635d6){db[_0x4d24('0x6e')][_0x4d24('0x90')]({'UserId':_0x8635d6,'VoicePrefixId':_0x5e06cc[_0x4d24('0x6f')]});});return Promise[_0x4d24('0x94')](_0x2ba046);}});});});return Promise[_0x4d24('0x94')](_0x6da4f)['then'](function(){return _0x48f60b[_0x4d24('0x96')](_0x33c05f,{'transaction':_0x17fbe5})[_0x4d24('0x97')](function(_0x4ca6f5){return _0x4ca6f5;});});});}})[_0x4d24('0x2c')](respondWithResult(_0xaeadbb,null))[_0x4d24('0x47')](handleError(_0xaeadbb,null));};exports['removeAgents']=function(_0x59c45c,_0x159e02){var _0x30ff7b=_['isArray'](_0x59c45c[_0x4d24('0x32')][_0x4d24('0x7e')])?_0x59c45c['query']['ids']:[_0x59c45c[_0x4d24('0x32')][_0x4d24('0x7e')]];var _0x362182=_0x59c45c[_0x4d24('0x49')]['id'];return db[_0x4d24('0x42')]['find']({'where':{'id':_0x362182}})[_0x4d24('0x2c')](handleEntityNotFound(_0x159e02,null))[_0x4d24('0x2c')](function(_0x2e2901){if(_0x2e2901){var _0x4b6dbc=[_0x4d24('0x87'),_0x4d24('0x81'),_0x4d24('0x82'),'Sms',_0x4d24('0x98'),'Openchannel',_0x4d24('0x99')];return db['sequelize'][_0x4d24('0x9a')](function(_0x52f56b){var _0x902aa9=_[_0x4d24('0x30')](_0x4b6dbc,function(_0x1ae984){var _0x358205={'attributes':['id',_0x4d24('0x2e')]};return _0x2e2901[_0x4d24('0x4f')+_0x1ae984+_0x4d24('0x7a')](_0x358205)['then'](function(_0x3e46b2){var _0x46db24=_[_0x4d24('0x30')](_0x3e46b2,function(_0x398dd2){return _0x398dd2[_0x4d24('0x9b')](_0x30ff7b,{'transaction':_0x52f56b})[_0x4d24('0x2c')](function(){var _0x173a32=_['map'](_0x30ff7b,function(_0x5123a1){socket[_0x4d24('0x9c')](_0x4d24('0x4e')+_0x1ae984+_0x4d24('0x9d'),{'UserId':Number(_0x5123a1),[_0x1ae984+_0x4d24('0x86')]:_0x398dd2['id']});if(_0x1ae984!==_0x4d24('0x87')){return;}return db[_0x4d24('0x8f')][_0x4d24('0x57')]({'where':{'VoiceQueueId':_0x398dd2['id'],'UserId':_0x5123a1},'transaction':_0x52f56b});});return Promise['all'](_0x173a32);});});return Promise[_0x4d24('0x94')](_0x46db24);});});return Promise[_0x4d24('0x94')](_0x902aa9)[_0x4d24('0x2c')](function(){return _0x2e2901[_0x4d24('0x9b')](_0x30ff7b,{'transaction':_0x52f56b});})['then'](function(){return db[_0x4d24('0x95')][_0x4d24('0x7c')]({'where':{'teamId':_0x362182}})['then'](function(_0x43b044){if(_0x43b044){var _0x205b03=_['map'](_0x30ff7b,function(_0x2ee136){db[_0x4d24('0x6e')][_0x4d24('0x57')]({'where':{'UserId':_0x2ee136,'VoicePrefixId':_0x43b044[_0x4d24('0x6f')]}});});return Promise['all'](_0x205b03);}});});});}})[_0x4d24('0x2c')](respondWithStatusCode(_0x159e02,null))[_0x4d24('0x47')](handleError(_0x159e02,null));};exports[_0x4d24('0x9e')]=function(_0x30db65,_0x2e9356,_0x3f1318){var _0x26d53d={};var _0x3b2f33={};var _0x3a372e;var _0x3153ab;return db[_0x4d24('0x42')][_0x4d24('0x7c')]({'where':{'id':_0x30db65[_0x4d24('0x49')]['id']}})['then'](handleEntityNotFound(_0x2e9356,null))[_0x4d24('0x2c')](function(_0x24b9c5){if(_0x24b9c5){_0x3a372e=_0x24b9c5;_0x3b2f33[_0x4d24('0x36')]=_['keys'](db['User'][_0x4d24('0x4a')]);_0x3b2f33[_0x4d24('0x32')]=_[_0x4d24('0x31')](_0x30db65[_0x4d24('0x32')]);_0x3b2f33[_0x4d24('0x33')]=_[_0x4d24('0x34')](_0x3b2f33[_0x4d24('0x36')],_0x3b2f33[_0x4d24('0x32')]);_0x26d53d[_0x4d24('0x35')]=_[_0x4d24('0x34')](_0x3b2f33['model'],qs['fields'](_0x30db65[_0x4d24('0x32')]['fields']));_0x26d53d[_0x4d24('0x35')]=_0x26d53d[_0x4d24('0x35')][_0x4d24('0x4b')]?_0x26d53d[_0x4d24('0x35')]:_0x3b2f33[_0x4d24('0x36')];_0x26d53d[_0x4d24('0x3a')]=qs['sort'](_0x30db65[_0x4d24('0x32')]['sort']);_0x26d53d['where']=qs[_0x4d24('0x33')](_[_0x4d24('0x3c')](_0x30db65[_0x4d24('0x32')],_0x3b2f33['filters']));if(_0x30db65[_0x4d24('0x32')][_0x4d24('0x3d')]){_0x26d53d[_0x4d24('0x3b')]=_['merge'](_0x26d53d[_0x4d24('0x3b')],{'$or':_[_0x4d24('0x30')](_0x26d53d[_0x4d24('0x35')],function(_0x3b5e80){var _0x576504={};_0x576504[_0x3b5e80]={'$like':'%'+_0x30db65[_0x4d24('0x32')][_0x4d24('0x3d')]+'%'};return _0x576504;})});}_0x26d53d=_[_0x4d24('0x3e')]({},_0x26d53d,_0x30db65[_0x4d24('0x41')]);return _0x3a372e[_0x4d24('0x9e')](_0x26d53d);}})['then'](function(_0x317af4){if(_0x317af4){_0x3153ab=_0x317af4[_0x4d24('0x4b')];if(!_0x30db65[_0x4d24('0x32')][_0x4d24('0x38')]('nolimit')){_0x26d53d[_0x4d24('0x23')]=qs[_0x4d24('0x23')](_0x30db65['query']['limit']);_0x26d53d[_0x4d24('0x21')]=qs[_0x4d24('0x21')](_0x30db65[_0x4d24('0x32')][_0x4d24('0x21')]);}return _0x3a372e[_0x4d24('0x9e')](_0x26d53d);}})[_0x4d24('0x2c')](function(_0x224fc1){if(_0x224fc1){return _0x224fc1?{'count':_0x3153ab,'rows':_0x224fc1}:null;}})[_0x4d24('0x2c')](respondWithResult(_0x2e9356,null))[_0x4d24('0x47')](handleError(_0x2e9356,null));}; \ No newline at end of file +var _0x92e1=['mustache','util','sox','to-csv','ejs','fs-extra','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','map','Team','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','show','keys','rawAttributes','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','params','destroy','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','Teams','getQueues','findOne','channel','Unknown\x20channel','capitalize','Queue','pick','toLowerCase','Queues','addQueues','isValidChannel','ValidationError','add','ids','removeQueues','addAgents','isArray','Voice','Chat','Mail','Sms','Openchannel','Whatsapp','through','penalty','QueueId','User','findOrCreate','emit','Queue:save','findAll','voicePause','interface','upsert','isNil','format','SIP/%s','all','Fax','removeAgents','UserVoiceQueueRt','VoicePrefixId','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x2d5e9f,_0x4a6265){var _0x59b7ca=function(_0x110606){while(--_0x110606){_0x2d5e9f['push'](_0x2d5e9f['shift']());}};_0x59b7ca(++_0x4a6265);}(_0x92e1,0x12a));var _0x192e=function(_0x4d67b8,_0x565134){_0x4d67b8=_0x4d67b8-0x0;var _0x55af3b=_0x92e1[_0x4d67b8];return _0x55af3b;};'use strict';var emlformat=require(_0x192e('0x0'));var rimraf=require(_0x192e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x192e('0x2'));var rp=require(_0x192e('0x3'));var moment=require(_0x192e('0x4'));var BPromise=require(_0x192e('0x5'));var Mustache=require(_0x192e('0x6'));var util=require(_0x192e('0x7'));var path=require('path');var sox=require(_0x192e('0x8'));var csv=require(_0x192e('0x9'));var ejs=require(_0x192e('0xa'));var fs=require('fs');var fs_extra=require(_0x192e('0xb'));var _=require(_0x192e('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x192e('0x9'));var querystring=require(_0x192e('0xd'));var Papa=require(_0x192e('0xe'));var Redis=require(_0x192e('0xf'));var authService=require(_0x192e('0x10'));var qs=require(_0x192e('0x11'));var as=require(_0x192e('0x12'));var hardwareService=require(_0x192e('0x13'));var logger=require('../../config/logger')(_0x192e('0x14'));var utils=require(_0x192e('0x15'));var config=require(_0x192e('0x16'));var licenseUtil=require(_0x192e('0x17'));var db=require(_0x192e('0x18'))['db'];config[_0x192e('0x19')]=_[_0x192e('0x1a')](config[_0x192e('0x19')],{'host':_0x192e('0x1b'),'port':0x18eb});var socket=require(_0x192e('0x1c'))(new Redis(config[_0x192e('0x19')]));require(_0x192e('0x1d'))[_0x192e('0x1e')](socket);function respondWithStatusCode(_0x2d476c,_0x19669b){_0x19669b=_0x19669b||0xcc;return function(_0x35a19c){if(_0x35a19c){return _0x2d476c[_0x192e('0x1f')](_0x19669b);}return _0x2d476c[_0x192e('0x20')](_0x19669b)[_0x192e('0x21')]();};}function respondWithResult(_0x383acc,_0x3b8e6a){_0x3b8e6a=_0x3b8e6a||0xc8;return function(_0x499b20){if(_0x499b20){return _0x383acc[_0x192e('0x20')](_0x3b8e6a)[_0x192e('0x22')](_0x499b20);}};}function respondWithFilteredResult(_0x5090b6,_0x1e61db){return function(_0x5a22c5){if(_0x5a22c5){var _0x1ddbad=typeof _0x1e61db[_0x192e('0x23')]===_0x192e('0x24')&&typeof _0x1e61db[_0x192e('0x25')]==='undefined';var _0xab0082=_0x5a22c5['count'];var _0x44f2ae=_0x1ddbad?0x0:_0x1e61db[_0x192e('0x23')];var _0x209961=_0x1ddbad?_0x5a22c5[_0x192e('0x26')]:_0x1e61db['offset']+_0x1e61db[_0x192e('0x25')];var _0x282bb2;if(_0x209961>=_0xab0082){_0x209961=_0xab0082;_0x282bb2=0xc8;}else{_0x282bb2=0xce;}_0x5090b6[_0x192e('0x20')](_0x282bb2);return _0x5090b6[_0x192e('0x27')](_0x192e('0x28'),_0x44f2ae+'-'+_0x209961+'/'+_0xab0082)[_0x192e('0x22')](_0x5a22c5);}return null;};}function patchUpdates(_0x3399b1){return function(_0x2229bd){try{jsonpatch[_0x192e('0x29')](_0x2229bd,_0x3399b1,!![]);}catch(_0x33cef0){return BPromise[_0x192e('0x2a')](_0x33cef0);}return _0x2229bd[_0x192e('0x2b')]();};}function saveUpdates(_0x42c492,_0x3e5d0e){return function(_0x3e6959){if(_0x3e6959){return _0x3e6959['update'](_0x42c492)[_0x192e('0x2c')](function(_0x175bfe){return _0x175bfe;});}return null;};}function handleEntityNotFound(_0x1850ad,_0x22ff0e){return function(_0x643681){if(!_0x643681){_0x1850ad[_0x192e('0x1f')](0x194);}return _0x643681;};}function handleError(_0x854857,_0x14acdc){_0x14acdc=_0x14acdc||0x1f4;return function(_0x292402){logger['error'](_0x292402[_0x192e('0x2d')]);if(_0x292402[_0x192e('0x2e')]){delete _0x292402['name'];}_0x854857[_0x192e('0x20')](_0x14acdc)[_0x192e('0x2f')](_0x292402);};}exports[_0x192e('0x30')]=function(_0xde0892,_0x91bb7f){var _0x657e2f={},_0x5609ac={},_0x1e020e={'count':0x0,'rows':[]};var _0xa64044=_[_0x192e('0x31')](db[_0x192e('0x32')]['rawAttributes'],function(_0x1a2308){return{'name':_0x1a2308[_0x192e('0x33')],'type':_0x1a2308['type'][_0x192e('0x34')]};});_0x5609ac[_0x192e('0x35')]=_[_0x192e('0x31')](_0xa64044,'name');_0x5609ac[_0x192e('0x36')]=_['keys'](_0xde0892[_0x192e('0x36')]);_0x5609ac[_0x192e('0x37')]=_[_0x192e('0x38')](_0x5609ac[_0x192e('0x35')],_0x5609ac[_0x192e('0x36')]);_0x657e2f[_0x192e('0x39')]=_[_0x192e('0x38')](_0x5609ac[_0x192e('0x35')],qs['fields'](_0xde0892[_0x192e('0x36')][_0x192e('0x3a')]));_0x657e2f[_0x192e('0x39')]=_0x657e2f['attributes'][_0x192e('0x3b')]?_0x657e2f[_0x192e('0x39')]:_0x5609ac[_0x192e('0x35')];if(!_0xde0892[_0x192e('0x36')][_0x192e('0x3c')](_0x192e('0x3d'))){_0x657e2f[_0x192e('0x25')]=qs[_0x192e('0x25')](_0xde0892['query'][_0x192e('0x25')]);_0x657e2f['offset']=qs[_0x192e('0x23')](_0xde0892[_0x192e('0x36')][_0x192e('0x23')]);}_0x657e2f[_0x192e('0x3e')]=qs[_0x192e('0x3f')](_0xde0892[_0x192e('0x36')][_0x192e('0x3f')]);_0x657e2f[_0x192e('0x40')]=qs[_0x192e('0x37')](_['pick'](_0xde0892[_0x192e('0x36')],_0x5609ac['filters']),_0xa64044);if(_0xde0892['query'][_0x192e('0x41')]){_0x657e2f[_0x192e('0x40')]=_[_0x192e('0x42')](_0x657e2f['where'],{'$or':_[_0x192e('0x31')](_0xa64044,function(_0x426ab8){if(_0x426ab8['type']!==_0x192e('0x43')){var _0x1dad73={};_0x1dad73[_0x426ab8[_0x192e('0x2e')]]={'$like':'%'+_0xde0892['query'][_0x192e('0x41')]+'%'};return _0x1dad73;}})});}_0x657e2f=_[_0x192e('0x42')]({},_0x657e2f,_0xde0892[_0x192e('0x44')]);var _0x41785f={'where':_0x657e2f[_0x192e('0x40')]};return db[_0x192e('0x32')][_0x192e('0x26')](_0x41785f)[_0x192e('0x2c')](function(_0x41cdb2){_0x1e020e[_0x192e('0x26')]=_0x41cdb2;if(_0xde0892[_0x192e('0x36')][_0x192e('0x45')]){_0x657e2f[_0x192e('0x46')]=[{'all':!![]}];}return db[_0x192e('0x32')]['findAll'](_0x657e2f);})['then'](function(_0x5cd743){_0x1e020e[_0x192e('0x47')]=_0x5cd743;return _0x1e020e;})['then'](respondWithFilteredResult(_0x91bb7f,_0x657e2f))['catch'](handleError(_0x91bb7f,null));};exports[_0x192e('0x48')]=function(_0x1ca003,_0x5657f7){var _0x26417b={'raw':![],'where':{'id':_0x1ca003['params']['id']}},_0x1ccac0={};_0x1ccac0[_0x192e('0x35')]=_[_0x192e('0x49')](db[_0x192e('0x32')][_0x192e('0x4a')]);_0x1ccac0[_0x192e('0x36')]=_['keys'](_0x1ca003[_0x192e('0x36')]);_0x1ccac0[_0x192e('0x37')]=_['intersection'](_0x1ccac0['model'],_0x1ccac0[_0x192e('0x36')]);_0x26417b['attributes']=_[_0x192e('0x38')](_0x1ccac0[_0x192e('0x35')],qs[_0x192e('0x3a')](_0x1ca003[_0x192e('0x36')]['fields']));_0x26417b[_0x192e('0x39')]=_0x26417b[_0x192e('0x39')][_0x192e('0x3b')]?_0x26417b['attributes']:_0x1ccac0[_0x192e('0x35')];if(_0x1ca003[_0x192e('0x36')]['includeAll']){_0x26417b[_0x192e('0x46')]=[{'all':!![]}];}_0x26417b=_[_0x192e('0x42')]({},_0x26417b,_0x1ca003['options']);return db[_0x192e('0x32')]['find'](_0x26417b)[_0x192e('0x2c')](handleEntityNotFound(_0x5657f7,null))[_0x192e('0x2c')](respondWithResult(_0x5657f7,null))[_0x192e('0x4b')](handleError(_0x5657f7,null));};exports[_0x192e('0x4c')]=function(_0xaaa9bc,_0x319909){return db[_0x192e('0x32')][_0x192e('0x4c')](_0xaaa9bc[_0x192e('0x4d')],{})[_0x192e('0x2c')](function(_0x13c3fe){var _0x50ec3b=_0xaaa9bc[_0x192e('0x4e')][_0x192e('0x4f')]({'plain':!![]});if(!_0x50ec3b)throw new Error(_0x192e('0x50'));if(_0x50ec3b[_0x192e('0x51')]===_0x192e('0x4e')){var _0x269195=_0x13c3fe['get']({'plain':!![]});var _0x380813='Teams';return db[_0x192e('0x52')][_0x192e('0x53')]({'where':{'name':_0x380813,'userProfileId':_0x50ec3b[_0x192e('0x54')]},'raw':!![]})[_0x192e('0x2c')](function(_0x44dc6d){if(_0x44dc6d&&_0x44dc6d[_0x192e('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x269195[_0x192e('0x2e')],'resourceId':_0x269195['id'],'type':_0x44dc6d[_0x192e('0x2e')],'sectionId':_0x44dc6d['id']},{})[_0x192e('0x2c')](function(){return _0x13c3fe;});}else{return _0x13c3fe;}})['catch'](function(_0x5eca06){logger[_0x192e('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5eca06);throw _0x5eca06;});}return _0x13c3fe;})[_0x192e('0x2c')](respondWithResult(_0x319909,0xc9))[_0x192e('0x4b')](handleError(_0x319909,null));};exports['update']=function(_0x203128,_0x478563){if(_0x203128['body']['id']){delete _0x203128[_0x192e('0x4d')]['id'];}return db[_0x192e('0x32')]['find']({'where':{'id':_0x203128[_0x192e('0x57')]['id']}})['then'](handleEntityNotFound(_0x478563,null))[_0x192e('0x2c')](saveUpdates(_0x203128[_0x192e('0x4d')],null))[_0x192e('0x2c')](respondWithResult(_0x478563,null))[_0x192e('0x4b')](handleError(_0x478563,null));};exports[_0x192e('0x58')]=function(_0x372662,_0x19a0cc){var _0x544735=_0x372662[_0x192e('0x57')]['id'];var _0x2dd7d6=[];return db['sequelize'][_0x192e('0x59')](function(_0x1a5a6c){var _0x52a2d6=_0x192e('0x5a')+_0x544735;return db[_0x192e('0x5b')]['query'](_0x52a2d6,{'type':db[_0x192e('0x5c')]['QueryTypes'][_0x192e('0x5d')],'raw':!![],'transaction':_0x1a5a6c})['then'](function(_0x73d95e){_0x2dd7d6=_['map'](_0x73d95e,function(_0x5c3e73){return Number(_0x5c3e73[_0x192e('0x5e')]);});})['then'](function(){var _0x32e0f1=_0x192e('0x5f')+_0x544735;return db['sequelize'][_0x192e('0x36')](_0x32e0f1,{'type':db['Sequelize'][_0x192e('0x60')][_0x192e('0x5d')],'raw':!![],'transaction':_0x1a5a6c});})[_0x192e('0x2c')](function(_0x5b39e6){var _0x3b1065=_[_0x192e('0x31')](_0x5b39e6,function(_0x499cb1){return Number(_0x499cb1[_0x192e('0x61')]);});return db[_0x192e('0x62')][_0x192e('0x58')]({'where':{'UserId':{'$in':_0x2dd7d6},'VoiceQueueId':{'$in':_0x3b1065}},'transaction':_0x1a5a6c});})[_0x192e('0x2c')](function(){var _0x158e40=_0x192e('0x63')+_0x544735;return db[_0x192e('0x5b')][_0x192e('0x36')](_0x158e40,{'type':db[_0x192e('0x5c')][_0x192e('0x60')][_0x192e('0x5d')],'raw':!![],'transaction':_0x1a5a6c});})[_0x192e('0x2c')](function(_0x54daf1){var _0xa21cd5=_['map'](_0x54daf1,function(_0x3db8de){return Number(_0x3db8de['MailQueueId']);});return db['UserMailQueue'][_0x192e('0x58')]({'where':{'UserId':{'$in':_0x2dd7d6},'MailQueueId':{'$in':_0xa21cd5}},'transaction':_0x1a5a6c});})[_0x192e('0x2c')](function(){var _0x1dc70a='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x544735;return db[_0x192e('0x5b')][_0x192e('0x36')](_0x1dc70a,{'type':db['Sequelize'][_0x192e('0x60')][_0x192e('0x5d')],'raw':!![],'transaction':_0x1a5a6c});})[_0x192e('0x2c')](function(_0x840eed){var _0xd82b1a=_[_0x192e('0x31')](_0x840eed,function(_0xcb4e17){return Number(_0xcb4e17['SmsQueueId']);});return db['UserSmsQueue'][_0x192e('0x58')]({'where':{'UserId':{'$in':_0x2dd7d6},'SmsQueueId':{'$in':_0xd82b1a}},'transaction':_0x1a5a6c});})['then'](function(){var _0x3883f1='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x544735;return db['sequelize'][_0x192e('0x36')](_0x3883f1,{'type':db['Sequelize']['QueryTypes'][_0x192e('0x5d')],'raw':!![],'transaction':_0x1a5a6c});})[_0x192e('0x2c')](function(_0x5d1c5f){var _0x23aac1=_[_0x192e('0x31')](_0x5d1c5f,function(_0x2c604f){return Number(_0x2c604f[_0x192e('0x64')]);});return db['UserChatQueue'][_0x192e('0x58')]({'where':{'UserId':{'$in':_0x2dd7d6},'ChatQueueId':{'$in':_0x23aac1}},'transaction':_0x1a5a6c});})[_0x192e('0x2c')](function(){var _0x3ee68d=_0x192e('0x65')+_0x544735;return db['sequelize']['query'](_0x3ee68d,{'type':db[_0x192e('0x5c')][_0x192e('0x60')][_0x192e('0x5d')],'raw':!![],'transaction':_0x1a5a6c});})[_0x192e('0x2c')](function(_0x154ae8){var _0x183c84=_[_0x192e('0x31')](_0x154ae8,function(_0x346f35){return Number(_0x346f35['FaxQueueId']);});return db['UserFaxQueue'][_0x192e('0x58')]({'where':{'UserId':{'$in':_0x2dd7d6},'FaxQueueId':{'$in':_0x183c84}},'transaction':_0x1a5a6c});})[_0x192e('0x2c')](function(){var _0x120cc6=_0x192e('0x66')+_0x544735;return db['sequelize'][_0x192e('0x36')](_0x120cc6,{'type':db[_0x192e('0x5c')]['QueryTypes'][_0x192e('0x5d')],'raw':!![],'transaction':_0x1a5a6c});})[_0x192e('0x2c')](function(_0x153ba7){var _0x59f973=_['map'](_0x153ba7,function(_0x3e90f4){return Number(_0x3e90f4[_0x192e('0x67')]);});return db['UserOpenchannelQueue'][_0x192e('0x58')]({'where':{'UserId':{'$in':_0x2dd7d6},'OpenchannelQueueId':{'$in':_0x59f973}},'transaction':_0x1a5a6c});})[_0x192e('0x2c')](function(){var _0x4d42c5=_0x192e('0x68')+_0x544735;return db[_0x192e('0x5b')][_0x192e('0x36')](_0x4d42c5,{'type':db[_0x192e('0x5c')][_0x192e('0x60')][_0x192e('0x5d')],'raw':!![],'transaction':_0x1a5a6c});})[_0x192e('0x2c')](function(_0x50c966){var _0x4e5712=_['map'](_0x50c966,function(_0x40d775){return Number(_0x40d775['WhatsappQueueId']);});return db[_0x192e('0x69')][_0x192e('0x58')]({'where':{'UserId':{'$in':_0x2dd7d6},'WhatsappQueueId':{'$in':_0x4e5712}},'transaction':_0x1a5a6c});})[_0x192e('0x2c')](function(){return db[_0x192e('0x6a')][_0x192e('0x53')]({'where':{'TeamId':_0x544735}});})[_0x192e('0x2c')](function(_0x28c0cf){if(_0x28c0cf===null){return;}return db[_0x192e('0x6b')][_0x192e('0x58')]({'where':{'UserId':{'$in':_0x2dd7d6},'VoicePrefixId':_0x28c0cf['VoicePrefixId']},'transaction':_0x1a5a6c});})[_0x192e('0x2c')](function(){return db[_0x192e('0x32')][_0x192e('0x58')]({'where':{'id':_0x544735},'cascade':!![],'transaction':_0x1a5a6c});})[_0x192e('0x2c')](function(_0x4fcafa){if(_0x4fcafa===0x0){_0x19a0cc[_0x192e('0x1f')](0x194);}else{return db['UserProfileResource'][_0x192e('0x58')]({'where':{'type':_0x192e('0x6c'),'resourceId':_0x544735},'cascade':!![],'transaction':_0x1a5a6c})[_0x192e('0x2c')](function(){_0x19a0cc[_0x192e('0x20')](0xcc)[_0x192e('0x21')]();});}})[_0x192e('0x4b')](function(_0x38f48c){_0x19a0cc[_0x192e('0x20')](0x1f4)['send'](_0x38f48c);});});};exports[_0x192e('0x6d')]=function(_0x563671,_0x4e97f2,_0xbdd50c){return db[_0x192e('0x32')][_0x192e('0x6e')]({'where':{'id':_0x563671['params']['id']}})[_0x192e('0x2c')](handleEntityNotFound(_0x4e97f2,null))[_0x192e('0x2c')](function(_0x4cf5db){if(!_0x563671[_0x192e('0x36')]['channel']||!utils['isValidChannel'](_0x563671[_0x192e('0x36')][_0x192e('0x6f')])){throw new db[(_0x192e('0x5c'))]['ValidationError'](_0x192e('0x70'));}var _0x5e3594={};var _0x407456={};_0x407456[_0x192e('0x35')]=_[_0x192e('0x49')](db[_[_0x192e('0x71')](_0x563671[_0x192e('0x36')][_0x192e('0x6f')]['toLowerCase']())+_0x192e('0x72')][_0x192e('0x4a')]);_0x407456[_0x192e('0x36')]=_[_0x192e('0x49')](_0x563671[_0x192e('0x36')]);_0x407456[_0x192e('0x37')]=_[_0x192e('0x38')](_0x407456[_0x192e('0x35')],_0x407456[_0x192e('0x36')]);_0x5e3594[_0x192e('0x39')]=_[_0x192e('0x38')](_0x407456['model'],qs[_0x192e('0x3a')](_0x563671[_0x192e('0x36')][_0x192e('0x3a')]));_0x5e3594[_0x192e('0x39')]=_0x5e3594[_0x192e('0x39')][_0x192e('0x3b')]?_0x5e3594[_0x192e('0x39')]:_0x407456['model'];_0x5e3594[_0x192e('0x25')]=qs[_0x192e('0x25')](_0x563671[_0x192e('0x36')][_0x192e('0x25')]);_0x5e3594[_0x192e('0x23')]=qs[_0x192e('0x23')](_0x563671['query']['offset']);_0x5e3594['order']=qs[_0x192e('0x3f')](_0x563671[_0x192e('0x36')]['sort']);_0x5e3594['where']=qs[_0x192e('0x37')](_[_0x192e('0x73')](_0x563671[_0x192e('0x36')],_0x407456['filters']));_0x5e3594=_[_0x192e('0x42')]({},_0x5e3594,_0x563671[_0x192e('0x44')]);return _0x4cf5db[_0x192e('0x4f')+_[_0x192e('0x71')](_0x563671[_0x192e('0x36')][_0x192e('0x6f')][_0x192e('0x74')]())+_0x192e('0x75')](_0x5e3594);})[_0x192e('0x2c')](respondWithResult(_0x4e97f2,null))[_0x192e('0x4b')](handleError(_0x4e97f2,null));};exports[_0x192e('0x76')]=function(_0x169bad,_0x487bc0,_0x1ce551){return db['Team'][_0x192e('0x6e')]({'where':{'id':_0x169bad[_0x192e('0x57')]['id']}})['then'](function(_0x2bec6a){if(_0x2bec6a){if(!_0x169bad['body'][_0x192e('0x6f')]||!utils[_0x192e('0x77')](_0x169bad['body']['channel'])){throw new db[(_0x192e('0x5c'))][(_0x192e('0x78'))]('Unknown\x20channel');}return _0x2bec6a[_0x192e('0x79')+_['capitalize'](_0x169bad[_0x192e('0x4d')][_0x192e('0x6f')][_0x192e('0x74')]())+_0x192e('0x75')](_0x169bad[_0x192e('0x4d')][_0x192e('0x7a')]);}return null;})[_0x192e('0x2c')](handleEntityNotFound(_0x487bc0,null))[_0x192e('0x2c')](respondWithStatusCode(_0x487bc0,null))[_0x192e('0x4b')](handleError(_0x487bc0,null));};exports[_0x192e('0x7b')]=function(_0x3d7c22,_0x412295,_0x2d4903){return db[_0x192e('0x32')][_0x192e('0x6e')]({'where':{'id':_0x3d7c22[_0x192e('0x57')]['id']}})[_0x192e('0x2c')](function(_0x415510){if(_0x415510){if(!_0x3d7c22['query'][_0x192e('0x6f')]||!utils[_0x192e('0x77')](_0x3d7c22[_0x192e('0x36')][_0x192e('0x6f')])){throw new db[(_0x192e('0x5c'))][(_0x192e('0x78'))](_0x192e('0x70'));}return _0x415510['remove'+_[_0x192e('0x71')](_0x3d7c22[_0x192e('0x36')][_0x192e('0x6f')][_0x192e('0x74')]())+'Queues'](_0x3d7c22['query']['ids']);}return null;})[_0x192e('0x2c')](handleEntityNotFound(_0x412295,null))[_0x192e('0x2c')](respondWithStatusCode(_0x412295,null))[_0x192e('0x4b')](handleError(_0x412295,null));};exports[_0x192e('0x7c')]=function(_0x2c083d,_0x54578a){var _0x1a3ecb=_[_0x192e('0x7d')](_0x2c083d[_0x192e('0x4d')][_0x192e('0x7a')])?_0x2c083d[_0x192e('0x4d')][_0x192e('0x7a')]:[_0x2c083d['body']['ids']];var _0x23cc69=_0x2c083d['params']['id'];return db[_0x192e('0x32')][_0x192e('0x53')]({'where':{'id':_0x23cc69}})[_0x192e('0x2c')](handleEntityNotFound(_0x54578a,null))[_0x192e('0x2c')](function(_0xb1e0c5){if(_0xb1e0c5){var _0x165dd1=[_0x192e('0x7e'),_0x192e('0x7f'),_0x192e('0x80'),_0x192e('0x81'),'Fax',_0x192e('0x82'),_0x192e('0x83')];return db['sequelize'][_0x192e('0x59')](function(_0x3f0262){var _0x594f18=_[_0x192e('0x31')](_0x165dd1,function(_0x3c45f3){var _0x478cfa={'attributes':['id',_0x192e('0x2e')]};if(_0x3c45f3===_0x192e('0x7e')){_0x478cfa[_0x192e('0x84')]={'attributes':[_0x192e('0x85')]};}return _0xb1e0c5[_0x192e('0x4f')+_0x3c45f3+_0x192e('0x75')](_0x478cfa)[_0x192e('0x2c')](function(_0x38ae78){var _0x15f09b=_['map'](_0x38ae78,function(_0x261f05){var _0x77294f=_[_0x192e('0x31')](_0x1a3ecb,function(_0x4f2b94){var _0xff19a0={'where':{'UserId':_0x4f2b94,[_0x3c45f3+_0x192e('0x86')]:_0x261f05['id']},'transaction':_0x3f0262};if(_0x3c45f3===_0x192e('0x7e')){_0xff19a0[_0x192e('0x1a')]={'penalty':_0x261f05['TeamVoiceQueue'][_0x192e('0x85')]};}return db[_0x192e('0x87')+_0x3c45f3+'Queue'][_0x192e('0x88')](_0xff19a0)[_0x192e('0x2c')](function(){socket[_0x192e('0x89')](_0x192e('0x4e')+_0x3c45f3+_0x192e('0x8a'),{'UserId':_0x4f2b94,[_0x3c45f3+_0x192e('0x86')]:_0x261f05['id']});if(_0x3c45f3!=='Voice'){return;}return db['User'][_0x192e('0x8b')]({'where':{'id':_0x1a3ecb,'online':0x1},'attributes':['id',_0x192e('0x2e'),'online',_0x192e('0x8c'),_0x192e('0x8d')],'raw':!![]})['then'](function(_0x1f59cb){var _0x43bdc0=_['map'](_0x1f59cb,function(_0x161497){return db['UserVoiceQueueRt'][_0x192e('0x8e')]({'membername':_0x161497[_0x192e('0x2e')],'UserId':_0x161497['id'],'queue_name':_0x261f05[_0x192e('0x2e')],'VoiceQueueId':_0x261f05['id'],'interface':_[_0x192e('0x8f')](_0x161497[_0x192e('0x8d')])?util[_0x192e('0x90')](_0x192e('0x91'),_0x161497['name']):_0x161497[_0x192e('0x8d')],'paused':_0x161497[_0x192e('0x8c')]||![],'penalty':_0x261f05['TeamVoiceQueue']['penalty']},{'transaction':_0x3f0262});});return Promise[_0x192e('0x92')](_0x43bdc0);});});});return Promise[_0x192e('0x92')](_0x77294f);});return Promise[_0x192e('0x92')](_0x15f09b);})[_0x192e('0x2c')](function(){return db['TeamVoicePrefix'][_0x192e('0x6e')]({'where':{'teamId':_0x23cc69}})[_0x192e('0x2c')](function(_0x1637a7){if(_0x1637a7){var _0x1a4c7d=_[_0x192e('0x31')](_0x1a3ecb,function(_0x1415e9){db[_0x192e('0x6b')][_0x192e('0x8e')]({'UserId':_0x1415e9,'VoicePrefixId':_0x1637a7['VoicePrefixId']});});return Promise[_0x192e('0x92')](_0x1a4c7d);}});});});return Promise[_0x192e('0x92')](_0x594f18)[_0x192e('0x2c')](function(){return _0xb1e0c5[_0x192e('0x7c')](_0x1a3ecb,{'transaction':_0x3f0262})['spread'](function(_0x4a5f5b){return _0x4a5f5b;});});});}})[_0x192e('0x2c')](respondWithResult(_0x54578a,null))[_0x192e('0x4b')](handleError(_0x54578a,null));};exports['removeAgents']=function(_0x3c7e7f,_0x22112f){var _0x2a3b95=_[_0x192e('0x7d')](_0x3c7e7f['query'][_0x192e('0x7a')])?_0x3c7e7f['query'][_0x192e('0x7a')]:[_0x3c7e7f[_0x192e('0x36')][_0x192e('0x7a')]];var _0x373906=_0x3c7e7f['params']['id'];return db[_0x192e('0x32')][_0x192e('0x53')]({'where':{'id':_0x373906}})['then'](handleEntityNotFound(_0x22112f,null))['then'](function(_0x273b54){if(_0x273b54){var _0x2ecb41=[_0x192e('0x7e'),_0x192e('0x7f'),'Mail',_0x192e('0x81'),_0x192e('0x93'),_0x192e('0x82'),_0x192e('0x83')];return db[_0x192e('0x5b')][_0x192e('0x59')](function(_0x1c02ae){var _0x11d0c2=_[_0x192e('0x31')](_0x2ecb41,function(_0x17b925){var _0x1d6970={'attributes':['id',_0x192e('0x2e')]};return _0x273b54[_0x192e('0x4f')+_0x17b925+'Queues'](_0x1d6970)[_0x192e('0x2c')](function(_0x276d7f){var _0x3e4aab=_[_0x192e('0x31')](_0x276d7f,function(_0x39847a){return _0x39847a[_0x192e('0x94')](_0x2a3b95,{'transaction':_0x1c02ae})['then'](function(){var _0x45f353=_[_0x192e('0x31')](_0x2a3b95,function(_0x45830b){socket['emit']('user'+_0x17b925+'Queue:remove',{'UserId':Number(_0x45830b),[_0x17b925+_0x192e('0x86')]:_0x39847a['id']});if(_0x17b925!==_0x192e('0x7e')){return;}return db[_0x192e('0x95')][_0x192e('0x58')]({'where':{'VoiceQueueId':_0x39847a['id'],'UserId':_0x45830b},'transaction':_0x1c02ae});});return Promise[_0x192e('0x92')](_0x45f353);});});return Promise[_0x192e('0x92')](_0x3e4aab);});});return Promise[_0x192e('0x92')](_0x11d0c2)[_0x192e('0x2c')](function(){return _0x273b54[_0x192e('0x94')](_0x2a3b95,{'transaction':_0x1c02ae});})['then'](function(){return db[_0x192e('0x6a')][_0x192e('0x6e')]({'where':{'teamId':_0x373906}})[_0x192e('0x2c')](function(_0x3fdc3b){if(_0x3fdc3b){var _0xde7be1=_[_0x192e('0x31')](_0x2a3b95,function(_0xfe3eb1){db[_0x192e('0x6b')][_0x192e('0x58')]({'where':{'UserId':_0xfe3eb1,'VoicePrefixId':_0x3fdc3b[_0x192e('0x96')]}});});return Promise[_0x192e('0x92')](_0xde7be1);}});});});}})['then'](respondWithStatusCode(_0x22112f,null))[_0x192e('0x4b')](handleError(_0x22112f,null));};exports[_0x192e('0x97')]=function(_0x16ee60,_0x2067fb,_0x294441){var _0x57d6d6={};var _0x66fbba={};var _0x56b1c7;var _0x568734;return db[_0x192e('0x32')]['findOne']({'where':{'id':_0x16ee60[_0x192e('0x57')]['id']}})[_0x192e('0x2c')](handleEntityNotFound(_0x2067fb,null))[_0x192e('0x2c')](function(_0x51a5df){if(_0x51a5df){_0x56b1c7=_0x51a5df;_0x66fbba[_0x192e('0x35')]=_[_0x192e('0x49')](db[_0x192e('0x87')][_0x192e('0x4a')]);_0x66fbba[_0x192e('0x36')]=_[_0x192e('0x49')](_0x16ee60['query']);_0x66fbba[_0x192e('0x37')]=_['intersection'](_0x66fbba[_0x192e('0x35')],_0x66fbba[_0x192e('0x36')]);_0x57d6d6['attributes']=_['intersection'](_0x66fbba['model'],qs[_0x192e('0x3a')](_0x16ee60[_0x192e('0x36')][_0x192e('0x3a')]));_0x57d6d6[_0x192e('0x39')]=_0x57d6d6['attributes']['length']?_0x57d6d6[_0x192e('0x39')]:_0x66fbba[_0x192e('0x35')];_0x57d6d6[_0x192e('0x3e')]=qs[_0x192e('0x3f')](_0x16ee60[_0x192e('0x36')][_0x192e('0x3f')]);_0x57d6d6[_0x192e('0x40')]=qs[_0x192e('0x37')](_[_0x192e('0x73')](_0x16ee60[_0x192e('0x36')],_0x66fbba[_0x192e('0x37')]));if(_0x16ee60[_0x192e('0x36')][_0x192e('0x41')]){_0x57d6d6['where']=_['merge'](_0x57d6d6[_0x192e('0x40')],{'$or':_[_0x192e('0x31')](_0x57d6d6[_0x192e('0x39')],function(_0x1fa97e){var _0x2bed6b={};_0x2bed6b[_0x1fa97e]={'$like':'%'+_0x16ee60[_0x192e('0x36')][_0x192e('0x41')]+'%'};return _0x2bed6b;})});}_0x57d6d6=_[_0x192e('0x42')]({},_0x57d6d6,_0x16ee60['options']);return _0x56b1c7['getAgents'](_0x57d6d6);}})['then'](function(_0x256eba){if(_0x256eba){_0x568734=_0x256eba[_0x192e('0x3b')];if(!_0x16ee60[_0x192e('0x36')][_0x192e('0x3c')]('nolimit')){_0x57d6d6[_0x192e('0x25')]=qs[_0x192e('0x25')](_0x16ee60[_0x192e('0x36')][_0x192e('0x25')]);_0x57d6d6[_0x192e('0x23')]=qs['offset'](_0x16ee60[_0x192e('0x36')][_0x192e('0x23')]);}return _0x56b1c7[_0x192e('0x97')](_0x57d6d6);}})[_0x192e('0x2c')](function(_0x2c4529){if(_0x2c4529){return _0x2c4529?{'count':_0x568734,'rows':_0x2c4529}:null;}})[_0x192e('0x2c')](respondWithResult(_0x2067fb,null))[_0x192e('0x4b')](handleError(_0x2067fb,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 20c92d2..b560ee7 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 _0x07f2=['save','update','emit','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x4c80ee,_0x39785a){var _0x244e98=function(_0x35380a){while(--_0x35380a){_0x4c80ee['push'](_0x4c80ee['shift']());}};_0x244e98(++_0x39785a);}(_0x07f2,0xde));var _0x207f=function(_0x3a3282,_0x2c7b6a){_0x3a3282=_0x3a3282-0x0;var _0x537702=_0x07f2[_0x3a3282];return _0x537702;};'use strict';var EventEmitter=require('events');var Team=require(_0x207f('0x0'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x207f('0x1')](0x0);var events={'afterCreate':_0x207f('0x2'),'afterUpdate':_0x207f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x972731){return function(_0x4477a9,_0x4b401e,_0x452993){TeamEvents[_0x207f('0x4')](_0x972731+':'+_0x4477a9['id'],_0x4477a9);TeamEvents[_0x207f('0x4')](_0x972731,_0x4477a9);_0x452993(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x207f('0x5')](e,emitEvent(event));}}module[_0x207f('0x6')]=TeamEvents; \ No newline at end of file +var _0xd029=['Team','setMaxListeners','save','exports','events'];(function(_0x6e824d,_0x4ecc8f){var _0x1cd767=function(_0xe8fcc5){while(--_0xe8fcc5){_0x6e824d['push'](_0x6e824d['shift']());}};_0x1cd767(++_0x4ecc8f);}(_0xd029,0xae));var _0x9d02=function(_0x5a4989,_0x4f119f){_0x5a4989=_0x5a4989-0x0;var _0x40a3ac=_0xd029[_0x5a4989];return _0x40a3ac;};'use strict';var EventEmitter=require(_0x9d02('0x0'));var Team=require('../../mysqldb')['db'][_0x9d02('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x9d02('0x2')](0x0);var events={'afterCreate':_0x9d02('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1c76d3){return function(_0xe0a621,_0x578a13,_0x3e7c7e){TeamEvents['emit'](_0x1c76d3+':'+_0xe0a621['id'],_0xe0a621);TeamEvents['emit'](_0x1c76d3,_0xe0a621);_0x3e7c7e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x9d02('0x4')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 6658d82..83fff8b 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 _0xdbca=['path','exports','define','teams','lodash','moment','bluebird','request-promise'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0xdbca,0x164));var _0xadbc=function(_0xf7f60a,_0x15f736){_0xf7f60a=_0xf7f60a-0x0;var _0x2567ad=_0xdbca[_0xf7f60a];return _0x2567ad;};'use strict';var _=require(_0xadbc('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xadbc('0x1'));var BPromise=require(_0xadbc('0x2'));var rp=require(_0xadbc('0x3'));var fs=require('fs');var path=require(_0xadbc('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./team.attributes');module[_0xadbc('0x5')]=function(_0x43f91a,_0x5868a6){return _0x43f91a[_0xadbc('0x6')]('Team',attributes,{'tableName':_0xadbc('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd128=['define','teams','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x1b15a8,_0x202962){var _0x87e23=function(_0x4dcb9){while(--_0x4dcb9){_0x1b15a8['push'](_0x1b15a8['shift']());}};_0x87e23(++_0x202962);}(_0xd128,0x12b));var _0x8d12=function(_0x52d1b3,_0x3f0f4a){_0x52d1b3=_0x52d1b3-0x0;var _0x3ff409=_0xd128[_0x52d1b3];return _0x3ff409;};'use strict';var _=require(_0x8d12('0x0'));var util=require(_0x8d12('0x1'));var logger=require(_0x8d12('0x2'))(_0x8d12('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8d12('0x4'));var fs=require('fs');var path=require(_0x8d12('0x5'));var rimraf=require(_0x8d12('0x6'));var config=require('../../config/environment');var attributes=require('./team.attributes');module['exports']=function(_0x3839a9,_0x18b8df){return _0x3839a9[_0x8d12('0x7')]('Team',attributes,{'tableName':_0x8d12('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index fc24fe3..b0479b0 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 _0x4e27=['client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x18fabc,_0x5c624b){var _0x43f978=function(_0x11ff49){while(--_0x11ff49){_0x18fabc['push'](_0x18fabc['shift']());}};_0x43f978(++_0x5c624b);}(_0x4e27,0x9a));var _0x74e2=function(_0x1cf20a,_0xb780f7){_0x1cf20a=_0x1cf20a-0x0;var _0x46fd43=_0x4e27[_0x1cf20a];return _0x46fd43;};'use strict';var _=require(_0x74e2('0x0'));var util=require('util');var moment=require(_0x74e2('0x1'));var BPromise=require('bluebird');var rs=require(_0x74e2('0x2'));var fs=require('fs');var Redis=require(_0x74e2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x74e2('0x4'));var logger=require(_0x74e2('0x5'))(_0x74e2('0x6'));var config=require(_0x74e2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x74e2('0x8')][_0x74e2('0x9')]({'port':0x232a});config[_0x74e2('0xa')]=_[_0x74e2('0xb')](config[_0x74e2('0xa')],{'host':_0x74e2('0xc'),'port':0x18eb});var socket=require(_0x74e2('0xd'))(new Redis(config[_0x74e2('0xa')]));require(_0x74e2('0xe'))[_0x74e2('0xf')](socket);function respondWithRpcPromise(_0x487591,_0x3c230e,_0x3caf27){return new BPromise(function(_0x2339b9,_0x4fd921){return client['request'](_0x487591,_0x3caf27)['then'](function(_0x562ca0){logger[_0x74e2('0x10')](_0x74e2('0x11'),_0x3c230e,_0x74e2('0x12'));logger[_0x74e2('0x13')](_0x74e2('0x14'),_0x3c230e,'request\x20sent',JSON[_0x74e2('0x15')](_0x562ca0));if(_0x562ca0[_0x74e2('0x16')]){if(_0x562ca0[_0x74e2('0x16')][_0x74e2('0x17')]===0x1f4){logger['error'](_0x74e2('0x11'),_0x3c230e,_0x562ca0[_0x74e2('0x16')][_0x74e2('0x18')]);return _0x4fd921(_0x562ca0[_0x74e2('0x16')][_0x74e2('0x18')]);}logger[_0x74e2('0x16')]('Team,\x20%s,\x20%s',_0x3c230e,_0x562ca0[_0x74e2('0x16')]['message']);return _0x2339b9(_0x562ca0[_0x74e2('0x16')][_0x74e2('0x18')]);}else{logger[_0x74e2('0x10')](_0x74e2('0x11'),_0x3c230e,_0x74e2('0x12'));_0x2339b9(_0x562ca0[_0x74e2('0x19')]['message']);}})[_0x74e2('0x1a')](function(_0x1eb0e5){logger[_0x74e2('0x16')](_0x74e2('0x11'),_0x3c230e,_0x1eb0e5);_0x4fd921(_0x1eb0e5);});});} \ No newline at end of file +var _0xab32=['request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','Team,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','./team.socket','register','request','then','info'];(function(_0x52ee5f,_0x225a02){var _0x2913de=function(_0x423ded){while(--_0x423ded){_0x52ee5f['push'](_0x52ee5f['shift']());}};_0x2913de(++_0x225a02);}(_0xab32,0x105));var _0x2ab3=function(_0x506d2f,_0x5ab76e){_0x506d2f=_0x506d2f-0x0;var _0x101255=_0xab32[_0x506d2f];return _0x101255;};'use strict';var _=require(_0x2ab3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2ab3('0x1'));var rs=require(_0x2ab3('0x2'));var fs=require('fs');var Redis=require(_0x2ab3('0x3'));var db=require(_0x2ab3('0x4'))['db'];var utils=require(_0x2ab3('0x5'));var logger=require(_0x2ab3('0x6'))(_0x2ab3('0x7'));var config=require(_0x2ab3('0x8'));var jayson=require(_0x2ab3('0x9'));var client=jayson[_0x2ab3('0xa')][_0x2ab3('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x2ab3('0xc'),'port':0x18eb});var socket=require(_0x2ab3('0xd'))(new Redis(config['redis']));require(_0x2ab3('0xe'))[_0x2ab3('0xf')](socket);function respondWithRpcPromise(_0x15ba48,_0x5258f7,_0x129a8e){return new BPromise(function(_0x44029d,_0x211ee9){return client[_0x2ab3('0x10')](_0x15ba48,_0x129a8e)[_0x2ab3('0x11')](function(_0x109a32){logger[_0x2ab3('0x12')]('Team,\x20%s,\x20%s',_0x5258f7,_0x2ab3('0x13'));logger[_0x2ab3('0x14')](_0x2ab3('0x15'),_0x5258f7,_0x2ab3('0x13'),JSON['stringify'](_0x109a32));if(_0x109a32['error']){if(_0x109a32[_0x2ab3('0x16')][_0x2ab3('0x17')]===0x1f4){logger[_0x2ab3('0x16')]('Team,\x20%s,\x20%s',_0x5258f7,_0x109a32[_0x2ab3('0x16')][_0x2ab3('0x18')]);return _0x211ee9(_0x109a32[_0x2ab3('0x16')][_0x2ab3('0x18')]);}logger[_0x2ab3('0x16')]('Team,\x20%s,\x20%s',_0x5258f7,_0x109a32[_0x2ab3('0x16')][_0x2ab3('0x18')]);return _0x44029d(_0x109a32[_0x2ab3('0x16')][_0x2ab3('0x18')]);}else{logger[_0x2ab3('0x12')](_0x2ab3('0x19'),_0x5258f7,_0x2ab3('0x13'));_0x44029d(_0x109a32[_0x2ab3('0x1a')][_0x2ab3('0x18')]);}})[_0x2ab3('0x1b')](function(_0x4d5549){logger[_0x2ab3('0x16')]('Team,\x20%s,\x20%s',_0x5258f7,_0x4d5549);_0x211ee9(_0x4d5549);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 6844a98..245ba6e 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 _0x4c48=['update','removeListener','register','length','remove'];(function(_0x53ee52,_0x585eb7){var _0x364b72=function(_0x10fb54){while(--_0x10fb54){_0x53ee52['push'](_0x53ee52['shift']());}};_0x364b72(++_0x585eb7);}(_0x4c48,0x1e4));var _0x84c4=function(_0x5a4b42,_0x2b9c18){_0x5a4b42=_0x5a4b42-0x0;var _0x5e81d6=_0x4c48[_0x5a4b42];return _0x5e81d6;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0x84c4('0x0'),_0x84c4('0x1')];function createListener(_0x35de8a,_0x1cb172){return function(_0x4279a6){_0x1cb172['emit'](_0x35de8a,_0x4279a6);};}function removeListener(_0x5302e8,_0x14b669){return function(){TeamEvents[_0x84c4('0x2')](_0x5302e8,_0x14b669);};}exports[_0x84c4('0x3')]=function(_0x64e9f8){for(var _0x4c5966=0x0,_0x2c8233=events[_0x84c4('0x4')];_0x4c5966<_0x2c8233;_0x4c5966++){var _0x556671=events[_0x4c5966];var _0xe000ec=createListener('team:'+_0x556671,_0x64e9f8);TeamEvents['on'](_0x556671,_0xe000ec);}}; \ No newline at end of file +var _0x21c9=['team:','./team.events','save','emit','removeListener','register','length'];(function(_0x3d8fb8,_0x58b7aa){var _0x23ab1e=function(_0x3b660d){while(--_0x3b660d){_0x3d8fb8['push'](_0x3d8fb8['shift']());}};_0x23ab1e(++_0x58b7aa);}(_0x21c9,0x19e));var _0x921c=function(_0x380590,_0x4c9b06){_0x380590=_0x380590-0x0;var _0x2eb853=_0x21c9[_0x380590];return _0x2eb853;};'use strict';var TeamEvents=require(_0x921c('0x0'));var events=[_0x921c('0x1'),'remove','update'];function createListener(_0x49325a,_0x47de62){return function(_0x44cde8){_0x47de62[_0x921c('0x2')](_0x49325a,_0x44cde8);};}function removeListener(_0x54047b,_0x364b4d){return function(){TeamEvents[_0x921c('0x3')](_0x54047b,_0x364b4d);};}exports[_0x921c('0x4')]=function(_0x21cd81){for(var _0x4f7c16=0x0,_0x1b0c84=events[_0x921c('0x5')];_0x4f7c16<_0x1b0c84;_0x4f7c16++){var _0x496501=events[_0x4f7c16];var _0x3c0630=createListener(_0x921c('0x6')+_0x496501,_0x21cd81);TeamEvents['on'](_0x496501,_0x3c0630);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 49d4f1d..6367db4 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 _0xefe5=['sequelize','INTEGER'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xefe5,0xf6));var _0x5efe=function(_0x4c0db0,_0x50d4d3){_0x4c0db0=_0x4c0db0-0x0;var _0x4b8a21=_0xefe5[_0x4c0db0];return _0x4b8a21;};'use strict';var Sequelize=require(_0x5efe('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x5efe('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x5efe('0x1')]}}; \ No newline at end of file +var _0x4c48=['INTEGER'];(function(_0x55c706,_0x996561){var _0x5d72b8=function(_0x5dae80){while(--_0x5dae80){_0x55c706['push'](_0x55c706['shift']());}};_0x5d72b8(++_0x996561);}(_0x4c48,0x1e4));var _0x84c4=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x4c48[_0x2f3848];return _0x102668;};'use strict';var Sequelize=require('sequelize');module['exports']={'TeamId':{'type':Sequelize[_0x84c4('0x0')]},'VoicePrefixId':{'type':Sequelize[_0x84c4('0x0')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index cdb7094..f14db07 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 _0x0efe=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x10f0fe,_0x37de73){var _0x16e19a=function(_0x250f8c){while(--_0x250f8c){_0x10f0fe['push'](_0x10f0fe['shift']());}};_0x16e19a(++_0x37de73);}(_0x0efe,0x110));var _0xe0ef=function(_0x2c6886,_0x2c3f26){_0x2c6886=_0x2c6886-0x0;var _0x5c4d18=_0x0efe[_0x2c6886];return _0x5c4d18;};'use strict';var _=require(_0xe0ef('0x0'));var util=require(_0xe0ef('0x1'));var logger=require('../../config/logger')(_0xe0ef('0x2'));var moment=require(_0xe0ef('0x3'));var BPromise=require(_0xe0ef('0x4'));var rp=require(_0xe0ef('0x5'));var fs=require('fs');var path=require(_0xe0ef('0x6'));var rimraf=require(_0xe0ef('0x7'));var config=require(_0xe0ef('0x8'));var attributes=require(_0xe0ef('0x9'));module[_0xe0ef('0xa')]=function(_0x35a50e,_0x5e9176){return _0x35a50e['define'](_0xe0ef('0xb'),attributes,{'tableName':_0xe0ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68a5=['define','TeamVoicePrefix','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./teamVoicePrefix.attributes'];(function(_0x3a0c4f,_0x5dd1a3){var _0x247049=function(_0x144695){while(--_0x144695){_0x3a0c4f['push'](_0x3a0c4f['shift']());}};_0x247049(++_0x5dd1a3);}(_0x68a5,0xfc));var _0x568a=function(_0x7aa532,_0x57d60d){_0x7aa532=_0x7aa532-0x0;var _0x45cbc1=_0x68a5[_0x7aa532];return _0x45cbc1;};'use strict';var _=require(_0x568a('0x0'));var util=require('util');var logger=require(_0x568a('0x1'))(_0x568a('0x2'));var moment=require('moment');var BPromise=require(_0x568a('0x3'));var rp=require(_0x568a('0x4'));var fs=require('fs');var path=require(_0x568a('0x5'));var rimraf=require(_0x568a('0x6'));var config=require('../../config/environment');var attributes=require(_0x568a('0x7'));module['exports']=function(_0x26db0e,_0x467a4f){return _0x26db0e[_0x568a('0x8')](_0x568a('0x9'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index f7f2ca1..54afde5 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x86b95c,_0x305673){var _0xfba073=function(_0x4f1f45){while(--_0x4f1f45){_0x86b95c['push'](_0x86b95c['shift']());}};_0xfba073(++_0x305673);}(_0xe706,0xa3));var _0x6e70=function(_0x2bcd1f,_0x4f1972){_0x2bcd1f=_0x2bcd1f-0x0;var _0x2381ca=_0xe706[_0x2bcd1f];return _0x2381ca;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x3576ea,_0x223904){var _0x240783=function(_0x37d896){while(--_0x37d896){_0x3576ea['push'](_0x3576ea['shift']());}};_0x240783(++_0x223904);}(_0xedd9,0xfc));var _0x9edd=function(_0x538494,_0x383b14){_0x538494=_0x538494-0x0;var _0x368b2d=_0xedd9[_0x538494];return _0x368b2d;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 8cf30b9..a53c0f5 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 _0x657f=['INTEGER'];(function(_0x5bba5d,_0x423577){var _0x276f33=function(_0x497241){while(--_0x497241){_0x5bba5d['push'](_0x5bba5d['shift']());}};_0x276f33(++_0x423577);}(_0x657f,0x1d9));var _0xf657=function(_0x4e783c,_0x51a362){_0x4e783c=_0x4e783c-0x0;var _0x2fbd6d=_0x657f[_0x4e783c];return _0x2fbd6d;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xf657('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfcd3=['sequelize','exports','INTEGER'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xfcd3,0x1b3));var _0x3fcd=function(_0x533e4e,_0x4eba54){_0x533e4e=_0x533e4e-0x0;var _0x1f14bb=_0xfcd3[_0x533e4e];return _0x1f14bb;};'use strict';var Sequelize=require(_0x3fcd('0x0'));module[_0x3fcd('0x1')]={'penalty':{'type':Sequelize[_0x3fcd('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 7a8b635..9e33390 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 _0x8a55=['api','moment','bluebird','request-promise','path','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger'];(function(_0x3ac09e,_0x3262f7){var _0x5d817a=function(_0x35c9fd){while(--_0x35c9fd){_0x3ac09e['push'](_0x3ac09e['shift']());}};_0x5d817a(++_0x3262f7);}(_0x8a55,0x185));var _0x58a5=function(_0x284784,_0x4d5801){_0x284784=_0x284784-0x0;var _0x1c3a6b=_0x8a55[_0x284784];return _0x1c3a6b;};'use strict';var _=require(_0x58a5('0x0'));var util=require(_0x58a5('0x1'));var logger=require(_0x58a5('0x2'))(_0x58a5('0x3'));var moment=require(_0x58a5('0x4'));var BPromise=require(_0x58a5('0x5'));var rp=require(_0x58a5('0x6'));var fs=require('fs');var path=require(_0x58a5('0x7'));var rimraf=require('rimraf');var config=require(_0x58a5('0x8'));var attributes=require(_0x58a5('0x9'));module[_0x58a5('0xa')]=function(_0x3edf85,_0x417896){return _0x3edf85[_0x58a5('0xb')](_0x58a5('0xc'),attributes,{'tableName':_0x58a5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01d3=['api','moment','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue','team_has_voice_queues','../../config/logger'];(function(_0x4da572,_0x326408){var _0x378393=function(_0x1357e4){while(--_0x1357e4){_0x4da572['push'](_0x4da572['shift']());}};_0x378393(++_0x326408);}(_0x01d3,0xdb));var _0x301d=function(_0x308b5c,_0x31bf56){_0x308b5c=_0x308b5c-0x0;var _0x2de469=_0x01d3[_0x308b5c];return _0x2de469;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x301d('0x0'))(_0x301d('0x1'));var moment=require(_0x301d('0x2'));var BPromise=require('bluebird');var rp=require(_0x301d('0x3'));var fs=require('fs');var path=require(_0x301d('0x4'));var rimraf=require(_0x301d('0x5'));var config=require(_0x301d('0x6'));var attributes=require(_0x301d('0x7'));module['exports']=function(_0x44f428,_0x3b1992){return _0x44f428[_0x301d('0x8')](_0x301d('0x9'),attributes,{'tableName':_0x301d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 85a8afd..635db0b 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 _0x77a4=['result','lodash','util','moment','ioredis','../../config/logger','rpc','jayson/promise','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x33e120,_0xdb6ca9){var _0x5c14d9=function(_0x5c7497){while(--_0x5c7497){_0x33e120['push'](_0x33e120['shift']());}};_0x5c14d9(++_0xdb6ca9);}(_0x77a4,0x155));var _0x477a=function(_0x3b4b1d,_0x15029e){_0x3b4b1d=_0x3b4b1d-0x0;var _0x488c36=_0x77a4[_0x3b4b1d];return _0x488c36;};'use strict';var _=require(_0x477a('0x0'));var util=require(_0x477a('0x1'));var moment=require(_0x477a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x477a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x477a('0x4'))(_0x477a('0x5'));var config=require('../../config/environment');var jayson=require(_0x477a('0x6'));var client=jayson['client'][_0x477a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x29d2c0,_0x15e6fe,_0x217ce0){return new BPromise(function(_0xbfea2a,_0x68568a){return client[_0x477a('0x8')](_0x29d2c0,_0x217ce0)[_0x477a('0x9')](function(_0x54e662){logger[_0x477a('0xa')](_0x477a('0xb'),_0x15e6fe,'request\x20sent');logger[_0x477a('0xc')](_0x477a('0xd'),_0x15e6fe,_0x477a('0xe'),JSON[_0x477a('0xf')](_0x54e662));if(_0x54e662[_0x477a('0x10')]){if(_0x54e662[_0x477a('0x10')][_0x477a('0x11')]===0x1f4){logger[_0x477a('0x10')](_0x477a('0xb'),_0x15e6fe,_0x54e662[_0x477a('0x10')]['message']);return _0x68568a(_0x54e662[_0x477a('0x10')][_0x477a('0x12')]);}logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x15e6fe,_0x54e662[_0x477a('0x10')][_0x477a('0x12')]);return _0xbfea2a(_0x54e662[_0x477a('0x10')][_0x477a('0x12')]);}else{logger[_0x477a('0xa')](_0x477a('0xb'),_0x15e6fe,_0x477a('0xe'));_0xbfea2a(_0x54e662[_0x477a('0x13')][_0x477a('0x12')]);}})['catch'](function(_0x1fa947){logger[_0x477a('0x10')](_0x477a('0xb'),_0x15e6fe,_0x1fa947);_0x68568a(_0x1fa947);});});} \ No newline at end of file +var _0x0df3=['message','result','catch','lodash','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x0df3,0x12f));var _0x30df=function(_0x1a9e78,_0x180720){_0x1a9e78=_0x1a9e78-0x0;var _0x113e06=_0x0df3[_0x1a9e78];return _0x113e06;};'use strict';var _=require(_0x30df('0x0'));var util=require('util');var moment=require(_0x30df('0x1'));var BPromise=require(_0x30df('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x30df('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x30df('0x4'))(_0x30df('0x5'));var config=require(_0x30df('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x30df('0x7')][_0x30df('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b9e27,_0x530761,_0xfa53b4){return new BPromise(function(_0x4a4156,_0x4666f6){return client[_0x30df('0x9')](_0x5b9e27,_0xfa53b4)[_0x30df('0xa')](function(_0x43241b){logger['info'](_0x30df('0xb'),_0x530761,'request\x20sent');logger[_0x30df('0xc')](_0x30df('0xd'),_0x530761,_0x30df('0xe'),JSON[_0x30df('0xf')](_0x43241b));if(_0x43241b[_0x30df('0x10')]){if(_0x43241b[_0x30df('0x10')]['code']===0x1f4){logger['error'](_0x30df('0xb'),_0x530761,_0x43241b[_0x30df('0x10')][_0x30df('0x11')]);return _0x4666f6(_0x43241b[_0x30df('0x10')][_0x30df('0x11')]);}logger[_0x30df('0x10')](_0x30df('0xb'),_0x530761,_0x43241b[_0x30df('0x10')]['message']);return _0x4a4156(_0x43241b['error'][_0x30df('0x11')]);}else{logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x530761,_0x30df('0xe'));_0x4a4156(_0x43241b[_0x30df('0x12')][_0x30df('0x11')]);}})[_0x30df('0x13')](function(_0x2ed52a){logger[_0x30df('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x530761,_0x2ed52a);_0x4666f6(_0x2ed52a);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index b8293c0..1bdfc78 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 _0x3f2e=['update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./template.controller','isAuthenticated','index','show','post','create'];(function(_0x4c1e98,_0x232737){var _0x54930a=function(_0x135a8b){while(--_0x135a8b){_0x4c1e98['push'](_0x4c1e98['shift']());}};_0x54930a(++_0x232737);}(_0x3f2e,0x9d));var _0xe3f2=function(_0x4d729f,_0x52bf8b){_0x4d729f=_0x4d729f-0x0;var _0x5ce12a=_0x3f2e[_0x4d729f];return _0x5ce12a;};'use strict';var multer=require(_0xe3f2('0x0'));var util=require('util');var path=require(_0xe3f2('0x1'));var timeout=require(_0xe3f2('0x2'));var express=require(_0xe3f2('0x3'));var router=express[_0xe3f2('0x4')]();var fs_extra=require(_0xe3f2('0x5'));var auth=require(_0xe3f2('0x6'));var interaction=require(_0xe3f2('0x7'));var config=require('../../config/environment');var controller=require(_0xe3f2('0x8'));router['get']('/',auth[_0xe3f2('0x9')](),controller[_0xe3f2('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xe3f2('0xb')]);router[_0xe3f2('0xc')]('/',auth[_0xe3f2('0x9')](),controller[_0xe3f2('0xd')]);router['put']('/:id',auth[_0xe3f2('0x9')](),controller[_0xe3f2('0xe')]);router[_0xe3f2('0xf')](_0xe3f2('0x10'),auth[_0xe3f2('0x9')](),controller[_0xe3f2('0x11')]);module[_0xe3f2('0x12')]=router; \ No newline at end of file +var _0x7669=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','/:id','update','destroy','multer','util','path','express','Router'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7669,0xe5));var _0x9766=function(_0x4b4672,_0x237590){_0x4b4672=_0x4b4672-0x0;var _0x2dc10c=_0x7669[_0x4b4672];return _0x2dc10c;};'use strict';var multer=require(_0x9766('0x0'));var util=require(_0x9766('0x1'));var path=require(_0x9766('0x2'));var timeout=require('connect-timeout');var express=require(_0x9766('0x3'));var router=express[_0x9766('0x4')]();var fs_extra=require(_0x9766('0x5'));var auth=require(_0x9766('0x6'));var interaction=require(_0x9766('0x7'));var config=require(_0x9766('0x8'));var controller=require('./template.controller');router[_0x9766('0x9')]('/',auth[_0x9766('0xa')](),controller[_0x9766('0xb')]);router[_0x9766('0x9')]('/:id',auth[_0x9766('0xa')](),controller[_0x9766('0xc')]);router[_0x9766('0xd')]('/',auth[_0x9766('0xa')](),controller[_0x9766('0xe')]);router['put'](_0x9766('0xf'),auth['isAuthenticated'](),controller[_0x9766('0x10')]);router['delete'](_0x9766('0xf'),auth['isAuthenticated'](),controller[_0x9766('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 411f48c..1d76611 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 _0xf802=['STRING','TEXT','exports'];(function(_0x368567,_0x46faba){var _0x2550b8=function(_0x5955f8){while(--_0x5955f8){_0x368567['push'](_0x368567['shift']());}};_0x2550b8(++_0x46faba);}(_0xf802,0x179));var _0x2f80=function(_0x4bc05b,_0x3edfae){_0x4bc05b=_0x4bc05b-0x0;var _0xdbf80a=_0xf802[_0x4bc05b];return _0xdbf80a;};'use strict';var Sequelize=require('sequelize');module[_0x2f80('0x0')]={'name':{'type':Sequelize[_0x2f80('0x1')]},'description':{'type':Sequelize[_0x2f80('0x1')]},'html':{'type':Sequelize[_0x2f80('0x2')]}}; \ No newline at end of file +var _0x8da5=['STRING','sequelize','exports'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x8da5,0xcd));var _0x58da=function(_0x40d476,_0x38eaf7){_0x40d476=_0x40d476-0x0;var _0x131322=_0x8da5[_0x40d476];return _0x131322;};'use strict';var Sequelize=require(_0x58da('0x0'));module[_0x58da('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x58da('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 26d2bd8..d84d8e3 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 _0xf99d=['body','user','role','Templates','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create'];(function(_0x527bdf,_0x20bd3a){var _0x33abdf=function(_0x415366){while(--_0x415366){_0x527bdf['push'](_0x527bdf['shift']());}};_0x33abdf(++_0x20bd3a);}(_0xf99d,0xfb));var _0xdf99=function(_0x1793de,_0x4d7233){_0x1793de=_0x1793de-0x0;var _0x4f0309=_0xf99d[_0x1793de];return _0x4f0309;};'use strict';var emlformat=require(_0xdf99('0x0'));var rimraf=require(_0xdf99('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdf99('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdf99('0x3'));var Mustache=require(_0xdf99('0x4'));var util=require(_0xdf99('0x5'));var path=require('path');var sox=require(_0xdf99('0x6'));var csv=require(_0xdf99('0x7'));var ejs=require(_0xdf99('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdf99('0x9'));var squel=require(_0xdf99('0xa'));var crypto=require(_0xdf99('0xb'));var jsforce=require(_0xdf99('0xc'));var deskjs=require(_0xdf99('0xd'));var toCsv=require(_0xdf99('0x7'));var querystring=require(_0xdf99('0xe'));var Papa=require(_0xdf99('0xf'));var Redis=require('ioredis');var authService=require(_0xdf99('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf99('0x11'));var logger=require('../../config/logger')(_0xdf99('0x12'));var utils=require(_0xdf99('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xdf99('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ac71f,_0x463922){_0x463922=_0x463922||0xcc;return function(_0x1b3b07){if(_0x1b3b07){return _0x2ac71f[_0xdf99('0x15')](_0x463922);}return _0x2ac71f[_0xdf99('0x16')](_0x463922)['end']();};}function respondWithResult(_0x4e8a1c,_0x445e17){_0x445e17=_0x445e17||0xc8;return function(_0x114456){if(_0x114456){return _0x4e8a1c[_0xdf99('0x16')](_0x445e17)[_0xdf99('0x17')](_0x114456);}};}function respondWithFilteredResult(_0x267d71,_0x347b86){return function(_0x11dc96){if(_0x11dc96){var _0x2dafe3=typeof _0x347b86[_0xdf99('0x18')]===_0xdf99('0x19')&&typeof _0x347b86[_0xdf99('0x1a')]==='undefined';var _0x4ae326=_0x11dc96[_0xdf99('0x1b')];var _0x440214=_0x2dafe3?0x0:_0x347b86[_0xdf99('0x18')];var _0x123bdf=_0x2dafe3?_0x11dc96['count']:_0x347b86[_0xdf99('0x18')]+_0x347b86[_0xdf99('0x1a')];var _0x285a09;if(_0x123bdf>=_0x4ae326){_0x123bdf=_0x4ae326;_0x285a09=0xc8;}else{_0x285a09=0xce;}_0x267d71['status'](_0x285a09);return _0x267d71[_0xdf99('0x1c')](_0xdf99('0x1d'),_0x440214+'-'+_0x123bdf+'/'+_0x4ae326)[_0xdf99('0x17')](_0x11dc96);}return null;};}function patchUpdates(_0x457b02){return function(_0x11c18c){try{jsonpatch[_0xdf99('0x1e')](_0x11c18c,_0x457b02,!![]);}catch(_0x2c0878){return BPromise[_0xdf99('0x1f')](_0x2c0878);}return _0x11c18c['save']();};}function saveUpdates(_0xe73443,_0x16c927){return function(_0x4e6a5a){if(_0x4e6a5a){return _0x4e6a5a[_0xdf99('0x20')](_0xe73443)[_0xdf99('0x21')](function(_0x25089d){return _0x25089d;});}return null;};}function removeEntity(_0x465f28,_0x46ceb9){return function(_0x9fc190){if(_0x9fc190){return _0x9fc190[_0xdf99('0x22')]()[_0xdf99('0x21')](function(){var _0x12ca2b=_0x9fc190[_0xdf99('0x23')]({'plain':!![]});var _0x488e50='Templates';return db[_0xdf99('0x24')]['destroy']({'where':{'type':_0x488e50,'resourceId':_0x12ca2b['id']}})[_0xdf99('0x21')](function(){return _0x9fc190;});})[_0xdf99('0x21')](function(){_0x465f28[_0xdf99('0x16')](0xcc)[_0xdf99('0x25')]();});}};}function handleEntityNotFound(_0x4633f1,_0x3698a4){return function(_0x8c6c90){if(!_0x8c6c90){_0x4633f1[_0xdf99('0x15')](0x194);}return _0x8c6c90;};}function handleError(_0x36bc36,_0x17961b){_0x17961b=_0x17961b||0x1f4;return function(_0x2a67fb){logger[_0xdf99('0x26')](_0x2a67fb[_0xdf99('0x27')]);if(_0x2a67fb['name']){delete _0x2a67fb[_0xdf99('0x28')];}_0x36bc36[_0xdf99('0x16')](_0x17961b)[_0xdf99('0x29')](_0x2a67fb);};}exports['index']=function(_0x312b18,_0xf6afb5){var _0x1b2359={},_0x9d16ac={},_0x496636={'count':0x0,'rows':[]};var _0x7109ce=_[_0xdf99('0x2a')](db[_0xdf99('0x2b')][_0xdf99('0x2c')],function(_0x53015d){return{'name':_0x53015d[_0xdf99('0x2d')],'type':_0x53015d[_0xdf99('0x2e')][_0xdf99('0x2f')]};});_0x9d16ac[_0xdf99('0x30')]=_[_0xdf99('0x2a')](_0x7109ce,_0xdf99('0x28'));_0x9d16ac[_0xdf99('0x31')]=_[_0xdf99('0x32')](_0x312b18[_0xdf99('0x31')]);_0x9d16ac[_0xdf99('0x33')]=_[_0xdf99('0x34')](_0x9d16ac[_0xdf99('0x30')],_0x9d16ac[_0xdf99('0x31')]);_0x1b2359[_0xdf99('0x35')]=_[_0xdf99('0x34')](_0x9d16ac[_0xdf99('0x30')],qs[_0xdf99('0x36')](_0x312b18[_0xdf99('0x31')][_0xdf99('0x36')]));_0x1b2359[_0xdf99('0x35')]=_0x1b2359[_0xdf99('0x35')][_0xdf99('0x37')]?_0x1b2359[_0xdf99('0x35')]:_0x9d16ac[_0xdf99('0x30')];if(!_0x312b18[_0xdf99('0x31')]['hasOwnProperty'](_0xdf99('0x38'))){_0x1b2359['limit']=qs[_0xdf99('0x1a')](_0x312b18[_0xdf99('0x31')]['limit']);_0x1b2359['offset']=qs[_0xdf99('0x18')](_0x312b18['query'][_0xdf99('0x18')]);}_0x1b2359['order']=qs[_0xdf99('0x39')](_0x312b18[_0xdf99('0x31')][_0xdf99('0x39')]);_0x1b2359[_0xdf99('0x3a')]=qs[_0xdf99('0x33')](_[_0xdf99('0x3b')](_0x312b18['query'],_0x9d16ac[_0xdf99('0x33')]),_0x7109ce);if(_0x312b18[_0xdf99('0x31')][_0xdf99('0x3c')]){_0x1b2359[_0xdf99('0x3a')]=_[_0xdf99('0x3d')](_0x1b2359[_0xdf99('0x3a')],{'$or':_['map'](_0x7109ce,function(_0x46e11b){if(_0x46e11b[_0xdf99('0x2e')]!==_0xdf99('0x3e')){var _0x301097={};_0x301097[_0x46e11b[_0xdf99('0x28')]]={'$like':'%'+_0x312b18[_0xdf99('0x31')][_0xdf99('0x3c')]+'%'};return _0x301097;}})});}_0x1b2359=_[_0xdf99('0x3d')]({},_0x1b2359,_0x312b18[_0xdf99('0x3f')]);var _0x1b6dd4={'where':_0x1b2359[_0xdf99('0x3a')]};return db['Template'][_0xdf99('0x1b')](_0x1b6dd4)['then'](function(_0x867fd4){_0x496636[_0xdf99('0x1b')]=_0x867fd4;if(_0x312b18[_0xdf99('0x31')]['includeAll']){_0x1b2359[_0xdf99('0x40')]=[{'all':!![]}];}return db['Template'][_0xdf99('0x41')](_0x1b2359);})[_0xdf99('0x21')](function(_0x3dc6a1){_0x496636[_0xdf99('0x42')]=_0x3dc6a1;return _0x496636;})[_0xdf99('0x21')](respondWithFilteredResult(_0xf6afb5,_0x1b2359))[_0xdf99('0x43')](handleError(_0xf6afb5,null));};exports[_0xdf99('0x44')]=function(_0x42f2d4,_0x2c8b78){var _0x50d099={'raw':!![],'where':{'id':_0x42f2d4[_0xdf99('0x45')]['id']}},_0x410ce4={};_0x410ce4[_0xdf99('0x30')]=_[_0xdf99('0x32')](db[_0xdf99('0x2b')][_0xdf99('0x2c')]);_0x410ce4['query']=_['keys'](_0x42f2d4[_0xdf99('0x31')]);_0x410ce4['filters']=_[_0xdf99('0x34')](_0x410ce4[_0xdf99('0x30')],_0x410ce4[_0xdf99('0x31')]);_0x50d099[_0xdf99('0x35')]=_[_0xdf99('0x34')](_0x410ce4['model'],qs[_0xdf99('0x36')](_0x42f2d4[_0xdf99('0x31')][_0xdf99('0x36')]));_0x50d099['attributes']=_0x50d099['attributes'][_0xdf99('0x37')]?_0x50d099[_0xdf99('0x35')]:_0x410ce4['model'];if(_0x42f2d4['query'][_0xdf99('0x46')]){_0x50d099[_0xdf99('0x40')]=[{'all':!![]}];}_0x50d099=_['merge']({},_0x50d099,_0x42f2d4[_0xdf99('0x3f')]);return db[_0xdf99('0x2b')][_0xdf99('0x47')](_0x50d099)['then'](handleEntityNotFound(_0x2c8b78,null))[_0xdf99('0x21')](respondWithResult(_0x2c8b78,null))[_0xdf99('0x43')](handleError(_0x2c8b78,null));};exports[_0xdf99('0x48')]=function(_0x3a33ba,_0x133cf5){return db[_0xdf99('0x2b')]['create'](_0x3a33ba[_0xdf99('0x49')],{})[_0xdf99('0x21')](function(_0x1c747d){var _0x61896=_0x3a33ba[_0xdf99('0x4a')][_0xdf99('0x23')]({'plain':!![]});if(!_0x61896)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x61896[_0xdf99('0x4b')]===_0xdf99('0x4a')){var _0x26cb99=_0x1c747d[_0xdf99('0x23')]({'plain':!![]});var _0x41d771=_0xdf99('0x4c');return db[_0xdf99('0x4d')]['find']({'where':{'name':_0x41d771,'userProfileId':_0x61896[_0xdf99('0x4e')]},'raw':!![]})[_0xdf99('0x21')](function(_0x28cf45){if(_0x28cf45&&_0x28cf45[_0xdf99('0x4f')]===0x0){return db[_0xdf99('0x24')][_0xdf99('0x48')]({'name':_0x26cb99[_0xdf99('0x28')],'resourceId':_0x26cb99['id'],'type':_0x28cf45['name'],'sectionId':_0x28cf45['id']},{})[_0xdf99('0x21')](function(){return _0x1c747d;});}else{return _0x1c747d;}})[_0xdf99('0x43')](function(_0x15c11a){logger[_0xdf99('0x26')](_0xdf99('0x50'),_0x15c11a);throw _0x15c11a;});}return _0x1c747d;})[_0xdf99('0x21')](respondWithResult(_0x133cf5,0xc9))[_0xdf99('0x43')](handleError(_0x133cf5,null));};exports[_0xdf99('0x20')]=function(_0xe2f5f6,_0x3e8fa9){if(_0xe2f5f6['body']['id']){delete _0xe2f5f6[_0xdf99('0x49')]['id'];}return db[_0xdf99('0x2b')][_0xdf99('0x47')]({'where':{'id':_0xe2f5f6[_0xdf99('0x45')]['id']}})[_0xdf99('0x21')](handleEntityNotFound(_0x3e8fa9,null))[_0xdf99('0x21')](saveUpdates(_0xe2f5f6[_0xdf99('0x49')],null))[_0xdf99('0x21')](respondWithResult(_0x3e8fa9,null))[_0xdf99('0x43')](handleError(_0x3e8fa9,null));};exports[_0xdf99('0x22')]=function(_0x18a643,_0x1b39b6){return db[_0xdf99('0x2b')][_0xdf99('0x47')]({'where':{'id':_0x18a643[_0xdf99('0x45')]['id']}})[_0xdf99('0x21')](handleEntityNotFound(_0x1b39b6,null))[_0xdf99('0x21')](removeEntity(_0x1b39b6,null))[_0xdf99('0x43')](handleError(_0x1b39b6,null));}; \ No newline at end of file +var _0xf551=['fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','Template','includeAll','include','findAll','rows','catch','show','params','create','body','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','reject','then','destroy','get','Templates','UserProfileResource','sendStatus','error','stack','name','map','rawAttributes'];(function(_0x1827d,_0x39da98){var _0x38d183=function(_0xfe3de0){while(--_0xfe3de0){_0x1827d['push'](_0x1827d['shift']());}};_0x38d183(++_0x39da98);}(_0xf551,0xc2));var _0x1f55=function(_0x27b0d4,_0x4f32f5){_0x27b0d4=_0x27b0d4-0x0;var _0xf8960b=_0xf551[_0x27b0d4];return _0xf8960b;};'use strict';var emlformat=require(_0x1f55('0x0'));var rimraf=require(_0x1f55('0x1'));var zipdir=require(_0x1f55('0x2'));var jsonpatch=require(_0x1f55('0x3'));var rp=require('request-promise');var moment=require(_0x1f55('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1f55('0x5'));var util=require('util');var path=require('path');var sox=require(_0x1f55('0x6'));var csv=require(_0x1f55('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1f55('0x8'));var _=require(_0x1f55('0x9'));var squel=require('squel');var crypto=require(_0x1f55('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1f55('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1f55('0xc'));var Papa=require(_0x1f55('0xd'));var Redis=require(_0x1f55('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x1f55('0xf'));var as=require(_0x1f55('0x10'));var hardwareService=require(_0x1f55('0x11'));var logger=require('../../config/logger')(_0x1f55('0x12'));var utils=require(_0x1f55('0x13'));var config=require(_0x1f55('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1f55('0x15'))['db'];function respondWithStatusCode(_0x38ef15,_0x503621){_0x503621=_0x503621||0xcc;return function(_0x640e5e){if(_0x640e5e){return _0x38ef15['sendStatus'](_0x503621);}return _0x38ef15[_0x1f55('0x16')](_0x503621)[_0x1f55('0x17')]();};}function respondWithResult(_0x3accbb,_0x240272){_0x240272=_0x240272||0xc8;return function(_0x31a8a2){if(_0x31a8a2){return _0x3accbb[_0x1f55('0x16')](_0x240272)[_0x1f55('0x18')](_0x31a8a2);}};}function respondWithFilteredResult(_0xe48c98,_0x3da8a7){return function(_0x1ffc69){if(_0x1ffc69){var _0x4245c4=typeof _0x3da8a7[_0x1f55('0x19')]==='undefined'&&typeof _0x3da8a7[_0x1f55('0x1a')]==='undefined';var _0x29dd7d=_0x1ffc69[_0x1f55('0x1b')];var _0x3c59f7=_0x4245c4?0x0:_0x3da8a7['offset'];var _0x522b37=_0x4245c4?_0x1ffc69[_0x1f55('0x1b')]:_0x3da8a7[_0x1f55('0x19')]+_0x3da8a7[_0x1f55('0x1a')];var _0x17263c;if(_0x522b37>=_0x29dd7d){_0x522b37=_0x29dd7d;_0x17263c=0xc8;}else{_0x17263c=0xce;}_0xe48c98[_0x1f55('0x16')](_0x17263c);return _0xe48c98[_0x1f55('0x1c')](_0x1f55('0x1d'),_0x3c59f7+'-'+_0x522b37+'/'+_0x29dd7d)[_0x1f55('0x18')](_0x1ffc69);}return null;};}function patchUpdates(_0x477b1e){return function(_0x1d2223){try{jsonpatch[_0x1f55('0x1e')](_0x1d2223,_0x477b1e,!![]);}catch(_0x688c8){return BPromise[_0x1f55('0x1f')](_0x688c8);}return _0x1d2223['save']();};}function saveUpdates(_0x5c9f56,_0x3249c9){return function(_0x4ea5b9){if(_0x4ea5b9){return _0x4ea5b9['update'](_0x5c9f56)[_0x1f55('0x20')](function(_0x21fdbe){return _0x21fdbe;});}return null;};}function removeEntity(_0x3e6e10,_0x49866f){return function(_0x25d53b){if(_0x25d53b){return _0x25d53b[_0x1f55('0x21')]()[_0x1f55('0x20')](function(){var _0x5284d4=_0x25d53b[_0x1f55('0x22')]({'plain':!![]});var _0x2df70d=_0x1f55('0x23');return db[_0x1f55('0x24')][_0x1f55('0x21')]({'where':{'type':_0x2df70d,'resourceId':_0x5284d4['id']}})['then'](function(){return _0x25d53b;});})[_0x1f55('0x20')](function(){_0x3e6e10['status'](0xcc)[_0x1f55('0x17')]();});}};}function handleEntityNotFound(_0x12e6a1,_0x39872c){return function(_0x1d9e2c){if(!_0x1d9e2c){_0x12e6a1[_0x1f55('0x25')](0x194);}return _0x1d9e2c;};}function handleError(_0xc655d3,_0x2170ca){_0x2170ca=_0x2170ca||0x1f4;return function(_0x47524a){logger[_0x1f55('0x26')](_0x47524a[_0x1f55('0x27')]);if(_0x47524a['name']){delete _0x47524a[_0x1f55('0x28')];}_0xc655d3[_0x1f55('0x16')](_0x2170ca)['send'](_0x47524a);};}exports['index']=function(_0x1a8021,_0x409c68){var _0x45f52a={},_0x369c93={},_0x200978={'count':0x0,'rows':[]};var _0x1b6e10=_[_0x1f55('0x29')](db['Template'][_0x1f55('0x2a')],function(_0x2bb6de){return{'name':_0x2bb6de[_0x1f55('0x2b')],'type':_0x2bb6de['type'][_0x1f55('0x2c')]};});_0x369c93['model']=_['map'](_0x1b6e10,_0x1f55('0x28'));_0x369c93[_0x1f55('0x2d')]=_[_0x1f55('0x2e')](_0x1a8021[_0x1f55('0x2d')]);_0x369c93['filters']=_[_0x1f55('0x2f')](_0x369c93[_0x1f55('0x30')],_0x369c93[_0x1f55('0x2d')]);_0x45f52a[_0x1f55('0x31')]=_[_0x1f55('0x2f')](_0x369c93[_0x1f55('0x30')],qs[_0x1f55('0x32')](_0x1a8021[_0x1f55('0x2d')][_0x1f55('0x32')]));_0x45f52a['attributes']=_0x45f52a[_0x1f55('0x31')][_0x1f55('0x33')]?_0x45f52a[_0x1f55('0x31')]:_0x369c93['model'];if(!_0x1a8021['query'][_0x1f55('0x34')]('nolimit')){_0x45f52a['limit']=qs[_0x1f55('0x1a')](_0x1a8021[_0x1f55('0x2d')][_0x1f55('0x1a')]);_0x45f52a[_0x1f55('0x19')]=qs['offset'](_0x1a8021[_0x1f55('0x2d')][_0x1f55('0x19')]);}_0x45f52a[_0x1f55('0x35')]=qs['sort'](_0x1a8021[_0x1f55('0x2d')][_0x1f55('0x36')]);_0x45f52a[_0x1f55('0x37')]=qs[_0x1f55('0x38')](_[_0x1f55('0x39')](_0x1a8021[_0x1f55('0x2d')],_0x369c93['filters']),_0x1b6e10);if(_0x1a8021[_0x1f55('0x2d')]['filter']){_0x45f52a['where']=_[_0x1f55('0x3a')](_0x45f52a[_0x1f55('0x37')],{'$or':_[_0x1f55('0x29')](_0x1b6e10,function(_0x42fe1a){if(_0x42fe1a[_0x1f55('0x3b')]!==_0x1f55('0x3c')){var _0x480a2d={};_0x480a2d[_0x42fe1a[_0x1f55('0x28')]]={'$like':'%'+_0x1a8021[_0x1f55('0x2d')][_0x1f55('0x3d')]+'%'};return _0x480a2d;}})});}_0x45f52a=_['merge']({},_0x45f52a,_0x1a8021[_0x1f55('0x3e')]);var _0x533891={'where':_0x45f52a[_0x1f55('0x37')]};return db[_0x1f55('0x3f')][_0x1f55('0x1b')](_0x533891)[_0x1f55('0x20')](function(_0x25a6d5){_0x200978['count']=_0x25a6d5;if(_0x1a8021[_0x1f55('0x2d')][_0x1f55('0x40')]){_0x45f52a[_0x1f55('0x41')]=[{'all':!![]}];}return db[_0x1f55('0x3f')][_0x1f55('0x42')](_0x45f52a);})[_0x1f55('0x20')](function(_0x2cc438){_0x200978[_0x1f55('0x43')]=_0x2cc438;return _0x200978;})['then'](respondWithFilteredResult(_0x409c68,_0x45f52a))[_0x1f55('0x44')](handleError(_0x409c68,null));};exports[_0x1f55('0x45')]=function(_0x47b7fb,_0xc9bfda){var _0x27ac78={'raw':!![],'where':{'id':_0x47b7fb[_0x1f55('0x46')]['id']}},_0x44f2a9={};_0x44f2a9['model']=_['keys'](db['Template'][_0x1f55('0x2a')]);_0x44f2a9[_0x1f55('0x2d')]=_['keys'](_0x47b7fb[_0x1f55('0x2d')]);_0x44f2a9[_0x1f55('0x38')]=_[_0x1f55('0x2f')](_0x44f2a9[_0x1f55('0x30')],_0x44f2a9['query']);_0x27ac78[_0x1f55('0x31')]=_[_0x1f55('0x2f')](_0x44f2a9[_0x1f55('0x30')],qs[_0x1f55('0x32')](_0x47b7fb[_0x1f55('0x2d')][_0x1f55('0x32')]));_0x27ac78[_0x1f55('0x31')]=_0x27ac78[_0x1f55('0x31')][_0x1f55('0x33')]?_0x27ac78['attributes']:_0x44f2a9[_0x1f55('0x30')];if(_0x47b7fb[_0x1f55('0x2d')]['includeAll']){_0x27ac78[_0x1f55('0x41')]=[{'all':!![]}];}_0x27ac78=_[_0x1f55('0x3a')]({},_0x27ac78,_0x47b7fb['options']);return db[_0x1f55('0x3f')]['find'](_0x27ac78)[_0x1f55('0x20')](handleEntityNotFound(_0xc9bfda,null))[_0x1f55('0x20')](respondWithResult(_0xc9bfda,null))[_0x1f55('0x44')](handleError(_0xc9bfda,null));};exports[_0x1f55('0x47')]=function(_0x57608d,_0x154e2b){return db[_0x1f55('0x3f')]['create'](_0x57608d[_0x1f55('0x48')],{})[_0x1f55('0x20')](function(_0x1d1fed){var _0x255a86=_0x57608d['user'][_0x1f55('0x22')]({'plain':!![]});if(!_0x255a86)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x255a86[_0x1f55('0x49')]===_0x1f55('0x4a')){var _0x42e18c=_0x1d1fed['get']({'plain':!![]});var _0x36933f=_0x1f55('0x23');return db[_0x1f55('0x4b')]['find']({'where':{'name':_0x36933f,'userProfileId':_0x255a86[_0x1f55('0x4c')]},'raw':!![]})[_0x1f55('0x20')](function(_0x49077d){if(_0x49077d&&_0x49077d['autoAssociation']===0x0){return db[_0x1f55('0x24')][_0x1f55('0x47')]({'name':_0x42e18c[_0x1f55('0x28')],'resourceId':_0x42e18c['id'],'type':_0x49077d[_0x1f55('0x28')],'sectionId':_0x49077d['id']},{})[_0x1f55('0x20')](function(){return _0x1d1fed;});}else{return _0x1d1fed;}})[_0x1f55('0x44')](function(_0x1618de){logger['error'](_0x1f55('0x4d'),_0x1618de);throw _0x1618de;});}return _0x1d1fed;})['then'](respondWithResult(_0x154e2b,0xc9))[_0x1f55('0x44')](handleError(_0x154e2b,null));};exports['update']=function(_0x21d09b,_0x53f413){if(_0x21d09b[_0x1f55('0x48')]['id']){delete _0x21d09b[_0x1f55('0x48')]['id'];}return db[_0x1f55('0x3f')]['find']({'where':{'id':_0x21d09b['params']['id']}})[_0x1f55('0x20')](handleEntityNotFound(_0x53f413,null))[_0x1f55('0x20')](saveUpdates(_0x21d09b['body'],null))[_0x1f55('0x20')](respondWithResult(_0x53f413,null))[_0x1f55('0x44')](handleError(_0x53f413,null));};exports[_0x1f55('0x21')]=function(_0x2ec87e,_0xb96b1e){return db[_0x1f55('0x3f')][_0x1f55('0x4e')]({'where':{'id':_0x2ec87e[_0x1f55('0x46')]['id']}})['then'](handleEntityNotFound(_0xb96b1e,null))[_0x1f55('0x20')](removeEntity(_0xb96b1e,null))[_0x1f55('0x44')](handleError(_0xb96b1e,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 4eb50d0..4780a24 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 _0xc93d=['tools_templates','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','Template'];(function(_0x46eb27,_0x57ff9f){var _0x4b3b90=function(_0x53216d){while(--_0x53216d){_0x46eb27['push'](_0x46eb27['shift']());}};_0x4b3b90(++_0x57ff9f);}(_0xc93d,0x1b1));var _0xdc93=function(_0x23c6f2,_0x4e033c){_0x23c6f2=_0x23c6f2-0x0;var _0x4c270b=_0xc93d[_0x23c6f2];return _0x4c270b;};'use strict';var _=require(_0xdc93('0x0'));var util=require(_0xdc93('0x1'));var logger=require('../../config/logger')(_0xdc93('0x2'));var moment=require('moment');var BPromise=require(_0xdc93('0x3'));var rp=require(_0xdc93('0x4'));var fs=require('fs');var path=require(_0xdc93('0x5'));var rimraf=require(_0xdc93('0x6'));var config=require(_0xdc93('0x7'));var attributes=require(_0xdc93('0x8'));module[_0xdc93('0x9')]=function(_0x49d868,_0x5a5336){return _0x49d868['define'](_0xdc93('0xa'),attributes,{'tableName':_0xdc93('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55e1=['path','rimraf','./template.attributes','exports','define','Template','tools_templates','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x55e1,0x1e8));var _0x155e=function(_0x4cd727,_0x37335e){_0x4cd727=_0x4cd727-0x0;var _0x9f3a81=_0x55e1[_0x4cd727];return _0x9f3a81;};'use strict';var _=require(_0x155e('0x0'));var util=require(_0x155e('0x1'));var logger=require(_0x155e('0x2'))(_0x155e('0x3'));var moment=require('moment');var BPromise=require(_0x155e('0x4'));var rp=require(_0x155e('0x5'));var fs=require('fs');var path=require(_0x155e('0x6'));var rimraf=require(_0x155e('0x7'));var config=require('../../config/environment');var attributes=require(_0x155e('0x8'));module[_0x155e('0x9')]=function(_0x5f1653,_0x1ec8d1){return _0x5f1653[_0x155e('0xa')](_0x155e('0xb'),attributes,{'tableName':_0x155e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index de7cf0a..3fa8006 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 _0x93cf=['message','info','result','catch','Template','findAll','options','raw','attributes','limit','map','include','model','GetTemplate','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1688d0,_0x239456){var _0xbcb539=function(_0x3f3fc9){while(--_0x3f3fc9){_0x1688d0['push'](_0x1688d0['shift']());}};_0xbcb539(++_0x239456);}(_0x93cf,0x19b));var _0xf93c=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x93cf[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0xf93c('0x0'));var util=require(_0xf93c('0x1'));var moment=require(_0xf93c('0x2'));var BPromise=require(_0xf93c('0x3'));var rs=require(_0xf93c('0x4'));var fs=require('fs');var Redis=require(_0xf93c('0x5'));var db=require(_0xf93c('0x6'))['db'];var utils=require(_0xf93c('0x7'));var logger=require(_0xf93c('0x8'))(_0xf93c('0x9'));var config=require(_0xf93c('0xa'));var jayson=require(_0xf93c('0xb'));var client=jayson[_0xf93c('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5884eb,_0x3d33e8,_0x5a1b08){return new BPromise(function(_0x2a59f7,_0x40500f){return client[_0xf93c('0xd')](_0x5884eb,_0x5a1b08)[_0xf93c('0xe')](function(_0x55a8e7){logger['info'](_0xf93c('0xf'),_0x3d33e8,_0xf93c('0x10'));logger['debug'](_0xf93c('0x11'),_0x3d33e8,'request\x20sent',JSON[_0xf93c('0x12')](_0x55a8e7));if(_0x55a8e7[_0xf93c('0x13')]){if(_0x55a8e7['error'][_0xf93c('0x14')]===0x1f4){logger[_0xf93c('0x13')](_0xf93c('0xf'),_0x3d33e8,_0x55a8e7[_0xf93c('0x13')]['message']);return _0x40500f(_0x55a8e7['error'][_0xf93c('0x15')]);}logger[_0xf93c('0x13')](_0xf93c('0xf'),_0x3d33e8,_0x55a8e7[_0xf93c('0x13')][_0xf93c('0x15')]);return _0x2a59f7(_0x55a8e7['error'][_0xf93c('0x15')]);}else{logger[_0xf93c('0x16')](_0xf93c('0xf'),_0x3d33e8,_0xf93c('0x10'));_0x2a59f7(_0x55a8e7[_0xf93c('0x17')][_0xf93c('0x15')]);}})[_0xf93c('0x18')](function(_0x25132a){logger[_0xf93c('0x13')](_0xf93c('0xf'),_0x3d33e8,_0x25132a);_0x40500f(_0x25132a);});});}exports['GetTemplate']=function(_0x28deee){var _0x541ff1=this;return new Promise(function(_0x3ca7f6,_0x11cba8){return db[_0xf93c('0x19')][_0xf93c('0x1a')]({'raw':_0x28deee[_0xf93c('0x1b')]?_0x28deee[_0xf93c('0x1b')][_0xf93c('0x1c')]===undefined?!![]:![]:!![],'where':_0x28deee['options']?_0x28deee['options']['where']||null:null,'attributes':_0x28deee[_0xf93c('0x1b')]?_0x28deee['options'][_0xf93c('0x1d')]||null:null,'limit':_0x28deee[_0xf93c('0x1b')]?_0x28deee[_0xf93c('0x1b')][_0xf93c('0x1e')]||null:null,'include':_0x28deee[_0xf93c('0x1b')]?_0x28deee[_0xf93c('0x1b')]['include']?_[_0xf93c('0x1f')](_0x28deee[_0xf93c('0x1b')][_0xf93c('0x20')],function(_0x37ee71){return{'model':db[_0x37ee71[_0xf93c('0x21')]],'as':_0x37ee71['as'],'attributes':_0x37ee71['attributes'],'include':_0x37ee71[_0xf93c('0x20')]?_[_0xf93c('0x1f')](_0x37ee71[_0xf93c('0x20')],function(_0x1d2459){return{'model':db[_0x1d2459['model']],'as':_0x1d2459['as'],'attributes':_0x1d2459[_0xf93c('0x1d')],'include':_0x1d2459[_0xf93c('0x20')]?_[_0xf93c('0x1f')](_0x1d2459['include'],function(_0x4ecd2f){return{'model':db[_0x4ecd2f[_0xf93c('0x21')]],'as':_0x4ecd2f['as'],'attributes':_0x4ecd2f[_0xf93c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf93c('0xe')](function(_0x8f453b){logger[_0xf93c('0x16')](_0xf93c('0x22'),_0x28deee);logger[_0xf93c('0x23')]('GetTemplate',_0x28deee,JSON[_0xf93c('0x12')](_0x8f453b));_0x3ca7f6(_0x8f453b);})[_0xf93c('0x18')](function(_0xe4b7c8){logger[_0xf93c('0x13')](_0xf93c('0x22'),_0xe4b7c8[_0xf93c('0x15')],_0x28deee);_0x11cba8(_0x541ff1['error'](0x1f4,_0xe4b7c8[_0xf93c('0x15')]));});});}; \ No newline at end of file +var _0x5772=['catch','GetTemplate','Template','findAll','options','raw','where','limit','include','map','model','attributes','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x9e5e04,_0x4397a4){var _0x2e8dc=function(_0x1e8f27){while(--_0x1e8f27){_0x9e5e04['push'](_0x9e5e04['shift']());}};_0x2e8dc(++_0x4397a4);}(_0x5772,0xbc));var _0x2577=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5772[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x2577('0x0'));var util=require(_0x2577('0x1'));var moment=require(_0x2577('0x2'));var BPromise=require('bluebird');var rs=require(_0x2577('0x3'));var fs=require('fs');var Redis=require(_0x2577('0x4'));var db=require(_0x2577('0x5'))['db'];var utils=require(_0x2577('0x6'));var logger=require(_0x2577('0x7'))(_0x2577('0x8'));var config=require(_0x2577('0x9'));var jayson=require(_0x2577('0xa'));var client=jayson['client'][_0x2577('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe56387,_0x38e07f,_0x22f325){return new BPromise(function(_0x5ca10a,_0x41bdda){return client[_0x2577('0xc')](_0xe56387,_0x22f325)['then'](function(_0x5c0a55){logger[_0x2577('0xd')](_0x2577('0xe'),_0x38e07f,_0x2577('0xf'));logger[_0x2577('0x10')](_0x2577('0x11'),_0x38e07f,_0x2577('0xf'),JSON[_0x2577('0x12')](_0x5c0a55));if(_0x5c0a55['error']){if(_0x5c0a55['error']['code']===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x38e07f,_0x5c0a55[_0x2577('0x13')][_0x2577('0x14')]);return _0x41bdda(_0x5c0a55['error'][_0x2577('0x14')]);}logger['error'](_0x2577('0xe'),_0x38e07f,_0x5c0a55[_0x2577('0x13')]['message']);return _0x5ca10a(_0x5c0a55['error']['message']);}else{logger[_0x2577('0xd')]('Template,\x20%s,\x20%s',_0x38e07f,_0x2577('0xf'));_0x5ca10a(_0x5c0a55[_0x2577('0x15')][_0x2577('0x14')]);}})[_0x2577('0x16')](function(_0x5154a6){logger[_0x2577('0x13')](_0x2577('0xe'),_0x38e07f,_0x5154a6);_0x41bdda(_0x5154a6);});});}exports[_0x2577('0x17')]=function(_0x2def42){var _0x7510f3=this;return new Promise(function(_0x3f6878,_0x4d34b7){return db[_0x2577('0x18')][_0x2577('0x19')]({'raw':_0x2def42[_0x2577('0x1a')]?_0x2def42[_0x2577('0x1a')][_0x2577('0x1b')]===undefined?!![]:![]:!![],'where':_0x2def42[_0x2577('0x1a')]?_0x2def42['options'][_0x2577('0x1c')]||null:null,'attributes':_0x2def42[_0x2577('0x1a')]?_0x2def42['options']['attributes']||null:null,'limit':_0x2def42[_0x2577('0x1a')]?_0x2def42[_0x2577('0x1a')][_0x2577('0x1d')]||null:null,'include':_0x2def42[_0x2577('0x1a')]?_0x2def42[_0x2577('0x1a')][_0x2577('0x1e')]?_[_0x2577('0x1f')](_0x2def42['options'][_0x2577('0x1e')],function(_0x3ceb53){return{'model':db[_0x3ceb53[_0x2577('0x20')]],'as':_0x3ceb53['as'],'attributes':_0x3ceb53[_0x2577('0x21')],'include':_0x3ceb53[_0x2577('0x1e')]?_['map'](_0x3ceb53['include'],function(_0x562fdc){return{'model':db[_0x562fdc['model']],'as':_0x562fdc['as'],'attributes':_0x562fdc[_0x2577('0x21')],'include':_0x562fdc[_0x2577('0x1e')]?_[_0x2577('0x1f')](_0x562fdc[_0x2577('0x1e')],function(_0x5d53c0){return{'model':db[_0x5d53c0[_0x2577('0x20')]],'as':_0x5d53c0['as'],'attributes':_0x5d53c0[_0x2577('0x21')]};}):[]};}):[]};}):[]:[]})[_0x2577('0x22')](function(_0x2b1e01){logger['info'](_0x2577('0x17'),_0x2def42);logger['debug'](_0x2577('0x17'),_0x2def42,JSON[_0x2577('0x12')](_0x2b1e01));_0x3f6878(_0x2b1e01);})[_0x2577('0x16')](function(_0x58bb01){logger[_0x2577('0x13')]('GetTemplate',_0x58bb01[_0x2577('0x14')],_0x2def42);_0x4d34b7(_0x7510f3[_0x2577('0x13')](0x1f4,_0x58bb01['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index edb394d..d043b39 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 _0x2f75=['getAllConditions','getAnyConditions','get','post','create','addAllCondition','/:id/any_conditions','/:id/actions','addAction','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/:id','/:id/all_conditions'];(function(_0x3a321d,_0x2f2556){var _0x3322af=function(_0x43c7c0){while(--_0x43c7c0){_0x3a321d['push'](_0x3a321d['shift']());}};_0x3322af(++_0x2f2556);}(_0x2f75,0x179));var _0x52f7=function(_0x238e9f,_0x39a1a3){_0x238e9f=_0x238e9f-0x0;var _0x58988b=_0x2f75[_0x238e9f];return _0x58988b;};'use strict';var multer=require(_0x52f7('0x0'));var util=require(_0x52f7('0x1'));var path=require(_0x52f7('0x2'));var timeout=require(_0x52f7('0x3'));var express=require(_0x52f7('0x4'));var router=express[_0x52f7('0x5')]();var fs_extra=require(_0x52f7('0x6'));var auth=require(_0x52f7('0x7'));var interaction=require(_0x52f7('0x8'));var config=require(_0x52f7('0x9'));var controller=require('./trigger.controller');router['get']('/',auth[_0x52f7('0xa')](),controller['index']);router['get'](_0x52f7('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x52f7('0xc'),auth[_0x52f7('0xa')](),controller[_0x52f7('0xd')]);router['get']('/:id/any_conditions',auth[_0x52f7('0xa')](),controller[_0x52f7('0xe')]);router[_0x52f7('0xf')]('/:id/actions',auth[_0x52f7('0xa')](),controller['getActions']);router[_0x52f7('0x10')]('/',auth[_0x52f7('0xa')](),controller[_0x52f7('0x11')]);router[_0x52f7('0x10')](_0x52f7('0xc'),auth[_0x52f7('0xa')](),controller[_0x52f7('0x12')]);router[_0x52f7('0x10')](_0x52f7('0x13'),auth['isAuthenticated'](),controller['addAnyCondition']);router[_0x52f7('0x10')](_0x52f7('0x14'),auth[_0x52f7('0xa')](),controller[_0x52f7('0x15')]);router[_0x52f7('0x16')](_0x52f7('0xb'),auth[_0x52f7('0xa')](),controller['update']);router[_0x52f7('0x17')](_0x52f7('0xb'),auth['isAuthenticated'](),controller[_0x52f7('0x18')]);module[_0x52f7('0x19')]=router; \ No newline at end of file +var _0x3ac7=['delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','show','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','/:id','update'];(function(_0x6dfbaa,_0x31eede){var _0xfbe02=function(_0x4adcaf){while(--_0x4adcaf){_0x6dfbaa['push'](_0x6dfbaa['shift']());}};_0xfbe02(++_0x31eede);}(_0x3ac7,0xcd));var _0x73ac=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x3ac7[_0x1d1779];return _0x2377e9;};'use strict';var multer=require(_0x73ac('0x0'));var util=require('util');var path=require(_0x73ac('0x1'));var timeout=require(_0x73ac('0x2'));var express=require(_0x73ac('0x3'));var router=express[_0x73ac('0x4')]();var fs_extra=require(_0x73ac('0x5'));var auth=require(_0x73ac('0x6'));var interaction=require(_0x73ac('0x7'));var config=require(_0x73ac('0x8'));var controller=require(_0x73ac('0x9'));router[_0x73ac('0xa')]('/',auth[_0x73ac('0xb')](),controller[_0x73ac('0xc')]);router[_0x73ac('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x73ac('0xd')]);router[_0x73ac('0xa')](_0x73ac('0xe'),auth[_0x73ac('0xb')](),controller[_0x73ac('0xf')]);router[_0x73ac('0xa')]('/:id/any_conditions',auth[_0x73ac('0xb')](),controller[_0x73ac('0x10')]);router['get'](_0x73ac('0x11'),auth['isAuthenticated'](),controller[_0x73ac('0x12')]);router[_0x73ac('0x13')]('/',auth['isAuthenticated'](),controller[_0x73ac('0x14')]);router[_0x73ac('0x13')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x73ac('0x15')]);router[_0x73ac('0x13')](_0x73ac('0x16'),auth[_0x73ac('0xb')](),controller[_0x73ac('0x17')]);router['post'](_0x73ac('0x11'),auth[_0x73ac('0xb')](),controller[_0x73ac('0x18')]);router['put'](_0x73ac('0x19'),auth[_0x73ac('0xb')](),controller[_0x73ac('0x1a')]);router[_0x73ac('0x1b')](_0x73ac('0x19'),auth[_0x73ac('0xb')](),controller[_0x73ac('0x1c')]);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 cee181d..c2b3298 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 _0x8284=['STRING','BOOLEAN','sequelize','exports'];(function(_0x202088,_0x176acd){var _0x1d5e1e=function(_0x3957fa){while(--_0x3957fa){_0x202088['push'](_0x202088['shift']());}};_0x1d5e1e(++_0x176acd);}(_0x8284,0x76));var _0x4828=function(_0x292512,_0x4cfb19){_0x292512=_0x292512-0x0;var _0x4b3a67=_0x8284[_0x292512];return _0x4b3a67;};'use strict';var Sequelize=require(_0x4828('0x0'));module[_0x4828('0x1')]={'name':{'type':Sequelize[_0x4828('0x2')]},'channel':{'type':Sequelize[_0x4828('0x2')]},'description':{'type':Sequelize[_0x4828('0x2')]},'status':{'type':Sequelize[_0x4828('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xbd1d=['BOOLEAN','sequelize','STRING'];(function(_0x45a08d,_0x291ab9){var _0x16a97a=function(_0x248b32){while(--_0x248b32){_0x45a08d['push'](_0x45a08d['shift']());}};_0x16a97a(++_0x291ab9);}(_0xbd1d,0x193));var _0xdbd1=function(_0x35cb7b,_0x5a5d77){_0x35cb7b=_0x35cb7b-0x0;var _0x4e8438=_0xbd1d[_0x35cb7b];return _0x4e8438;};'use strict';var Sequelize=require(_0xdbd1('0x0'));module['exports']={'name':{'type':Sequelize[_0xdbd1('0x1')]},'channel':{'type':Sequelize[_0xdbd1('0x1')]},'description':{'type':Sequelize[_0xdbd1('0x1')]},'status':{'type':Sequelize[_0xdbd1('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index f2a4f75..202460b 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 _0x346b=['order','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','create','body','user','role','UserProfileSection','autoAssociation','find','params','addAllCondition','Condition','addAnyCondition','findOne','sort','getAllConditions','getAnyConditions','TriggerId','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','status','apply','reject','then','get','Triggers','destroy','error','stack','name','send','Trigger','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x38f809,_0x4b8d97){var _0x336faa=function(_0x394c5f){while(--_0x394c5f){_0x38f809['push'](_0x38f809['shift']());}};_0x336faa(++_0x4b8d97);}(_0x346b,0x190));var _0xb346=function(_0x5d612e,_0x26a696){_0x5d612e=_0x5d612e-0x0;var _0x44745e=_0x346b[_0x5d612e];return _0x44745e;};'use strict';var emlformat=require(_0xb346('0x0'));var rimraf=require(_0xb346('0x1'));var zipdir=require(_0xb346('0x2'));var jsonpatch=require(_0xb346('0x3'));var rp=require(_0xb346('0x4'));var moment=require(_0xb346('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb346('0x6'));var util=require(_0xb346('0x7'));var path=require(_0xb346('0x8'));var sox=require(_0xb346('0x9'));var csv=require('to-csv');var ejs=require(_0xb346('0xa'));var fs=require('fs');var fs_extra=require(_0xb346('0xb'));var _=require('lodash');var squel=require(_0xb346('0xc'));var crypto=require(_0xb346('0xd'));var jsforce=require(_0xb346('0xe'));var deskjs=require(_0xb346('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb346('0x10'));var Papa=require(_0xb346('0x11'));var Redis=require(_0xb346('0x12'));var authService=require(_0xb346('0x13'));var qs=require(_0xb346('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb346('0x15'));var logger=require(_0xb346('0x16'))(_0xb346('0x17'));var utils=require(_0xb346('0x18'));var config=require(_0xb346('0x19'));var licenseUtil=require(_0xb346('0x1a'));var db=require(_0xb346('0x1b'))['db'];function respondWithStatusCode(_0x2216a1,_0x2c7e0e){_0x2c7e0e=_0x2c7e0e||0xcc;return function(_0x47de72){if(_0x47de72){return _0x2216a1['sendStatus'](_0x2c7e0e);}return _0x2216a1['status'](_0x2c7e0e)[_0xb346('0x1c')]();};}function respondWithResult(_0x209b49,_0x2f6654){_0x2f6654=_0x2f6654||0xc8;return function(_0x4f6c7d){if(_0x4f6c7d){return _0x209b49['status'](_0x2f6654)[_0xb346('0x1d')](_0x4f6c7d);}};}function respondWithFilteredResult(_0x705e54,_0x29e205){return function(_0x1b4461){if(_0x1b4461){var _0x65ea1b=typeof _0x29e205[_0xb346('0x1e')]===_0xb346('0x1f')&&typeof _0x29e205[_0xb346('0x20')]===_0xb346('0x1f');var _0x23b7c0=_0x1b4461['count'];var _0x59fe49=_0x65ea1b?0x0:_0x29e205[_0xb346('0x1e')];var _0x1415c7=_0x65ea1b?_0x1b4461['count']:_0x29e205[_0xb346('0x1e')]+_0x29e205[_0xb346('0x20')];var _0x4321f8;if(_0x1415c7>=_0x23b7c0){_0x1415c7=_0x23b7c0;_0x4321f8=0xc8;}else{_0x4321f8=0xce;}_0x705e54[_0xb346('0x21')](_0x4321f8);return _0x705e54['set']('Content-Range',_0x59fe49+'-'+_0x1415c7+'/'+_0x23b7c0)[_0xb346('0x1d')](_0x1b4461);}return null;};}function patchUpdates(_0x1d36a4){return function(_0x10e650){try{jsonpatch[_0xb346('0x22')](_0x10e650,_0x1d36a4,!![]);}catch(_0x40f17c){return BPromise[_0xb346('0x23')](_0x40f17c);}return _0x10e650['save']();};}function saveUpdates(_0x54a9d8,_0x25642a){return function(_0x111bd1){if(_0x111bd1){return _0x111bd1['update'](_0x54a9d8)[_0xb346('0x24')](function(_0xa03b23){return _0xa03b23;});}return null;};}function removeEntity(_0x456bb3,_0x4db4c7){return function(_0x29f4cf){if(_0x29f4cf){return _0x29f4cf['destroy']()[_0xb346('0x24')](function(){var _0xff0350=_0x29f4cf[_0xb346('0x25')]({'plain':!![]});var _0x58ff20=_0xb346('0x26');return db['UserProfileResource'][_0xb346('0x27')]({'where':{'type':_0x58ff20,'resourceId':_0xff0350['id']}})[_0xb346('0x24')](function(){return _0x29f4cf;});})['then'](function(){_0x456bb3[_0xb346('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38444f,_0x47fbfa){return function(_0x46a977){if(!_0x46a977){_0x38444f['sendStatus'](0x194);}return _0x46a977;};}function handleError(_0x11a657,_0x302d8f){_0x302d8f=_0x302d8f||0x1f4;return function(_0x45a7b9){logger[_0xb346('0x28')](_0x45a7b9[_0xb346('0x29')]);if(_0x45a7b9[_0xb346('0x2a')]){delete _0x45a7b9[_0xb346('0x2a')];}_0x11a657['status'](_0x302d8f)[_0xb346('0x2b')](_0x45a7b9);};}exports['index']=function(_0x354e1f,_0x51788d){var _0x14faf5={},_0x1dfc32={},_0x36564c={'count':0x0,'rows':[]};var _0x1ed637=_['map'](db[_0xb346('0x2c')][_0xb346('0x2d')],function(_0xefa93c){return{'name':_0xefa93c[_0xb346('0x2e')],'type':_0xefa93c[_0xb346('0x2f')][_0xb346('0x30')]};});_0x1dfc32[_0xb346('0x31')]=_[_0xb346('0x32')](_0x1ed637,_0xb346('0x2a'));_0x1dfc32[_0xb346('0x33')]=_[_0xb346('0x34')](_0x354e1f[_0xb346('0x33')]);_0x1dfc32[_0xb346('0x35')]=_[_0xb346('0x36')](_0x1dfc32[_0xb346('0x31')],_0x1dfc32[_0xb346('0x33')]);_0x14faf5[_0xb346('0x37')]=_[_0xb346('0x36')](_0x1dfc32['model'],qs[_0xb346('0x38')](_0x354e1f[_0xb346('0x33')][_0xb346('0x38')]));_0x14faf5[_0xb346('0x37')]=_0x14faf5[_0xb346('0x37')][_0xb346('0x39')]?_0x14faf5[_0xb346('0x37')]:_0x1dfc32[_0xb346('0x31')];if(!_0x354e1f[_0xb346('0x33')][_0xb346('0x3a')](_0xb346('0x3b'))){_0x14faf5[_0xb346('0x20')]=qs[_0xb346('0x20')](_0x354e1f[_0xb346('0x33')][_0xb346('0x20')]);_0x14faf5[_0xb346('0x1e')]=qs[_0xb346('0x1e')](_0x354e1f['query'][_0xb346('0x1e')]);}_0x14faf5[_0xb346('0x3c')]=qs['sort'](_0x354e1f[_0xb346('0x33')]['sort']);_0x14faf5[_0xb346('0x3d')]=qs[_0xb346('0x35')](_[_0xb346('0x3e')](_0x354e1f[_0xb346('0x33')],_0x1dfc32[_0xb346('0x35')]),_0x1ed637);if(_0x354e1f[_0xb346('0x33')][_0xb346('0x3f')]){_0x14faf5[_0xb346('0x3d')]=_['merge'](_0x14faf5[_0xb346('0x3d')],{'$or':_[_0xb346('0x32')](_0x1ed637,function(_0x214d36){if(_0x214d36[_0xb346('0x2f')]!==_0xb346('0x40')){var _0x43e3f3={};_0x43e3f3[_0x214d36['name']]={'$like':'%'+_0x354e1f[_0xb346('0x33')]['filter']+'%'};return _0x43e3f3;}})});}_0x14faf5=_[_0xb346('0x41')]({},_0x14faf5,_0x354e1f[_0xb346('0x42')]);var _0x2d7413={'where':_0x14faf5[_0xb346('0x3d')]};return db['Trigger'][_0xb346('0x43')](_0x2d7413)[_0xb346('0x24')](function(_0x256b69){_0x36564c[_0xb346('0x43')]=_0x256b69;if(_0x354e1f[_0xb346('0x33')][_0xb346('0x44')]){_0x14faf5[_0xb346('0x45')]=[{'all':!![]}];}return db[_0xb346('0x2c')][_0xb346('0x46')](_0x14faf5);})['then'](function(_0x7133e9){_0x36564c[_0xb346('0x47')]=_0x7133e9;return _0x36564c;})[_0xb346('0x24')](respondWithFilteredResult(_0x51788d,_0x14faf5))[_0xb346('0x48')](handleError(_0x51788d,null));};exports[_0xb346('0x49')]=function(_0x3ba456,_0x23b43c){var _0x5eb199={'raw':![],'where':{'id':_0x3ba456['params']['id']}},_0x579043={};_0x579043[_0xb346('0x31')]=_[_0xb346('0x34')](db['Trigger'][_0xb346('0x2d')]);_0x579043[_0xb346('0x33')]=_['keys'](_0x3ba456[_0xb346('0x33')]);_0x579043[_0xb346('0x35')]=_[_0xb346('0x36')](_0x579043[_0xb346('0x31')],_0x579043[_0xb346('0x33')]);_0x5eb199[_0xb346('0x37')]=_['intersection'](_0x579043[_0xb346('0x31')],qs['fields'](_0x3ba456['query'][_0xb346('0x38')]));_0x5eb199[_0xb346('0x37')]=_0x5eb199[_0xb346('0x37')][_0xb346('0x39')]?_0x5eb199[_0xb346('0x37')]:_0x579043['model'];if(_0x3ba456[_0xb346('0x33')][_0xb346('0x44')]){_0x5eb199['include']=[{'all':!![]}];}_0x5eb199=_[_0xb346('0x41')]({},_0x5eb199,_0x3ba456[_0xb346('0x42')]);return db[_0xb346('0x2c')]['find'](_0x5eb199)[_0xb346('0x24')](handleEntityNotFound(_0x23b43c,null))[_0xb346('0x24')](respondWithResult(_0x23b43c,null))[_0xb346('0x48')](handleError(_0x23b43c,null));};exports[_0xb346('0x4a')]=function(_0x53533a,_0x4a9f40){return db['Trigger'][_0xb346('0x4a')](_0x53533a[_0xb346('0x4b')],{})[_0xb346('0x24')](function(_0x22b855){var _0x47ede1=_0x53533a[_0xb346('0x4c')][_0xb346('0x25')]({'plain':!![]});if(!_0x47ede1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47ede1[_0xb346('0x4d')]===_0xb346('0x4c')){var _0x5f18d0=_0x22b855['get']({'plain':!![]});var _0x3c8630='Triggers';return db[_0xb346('0x4e')]['find']({'where':{'name':_0x3c8630,'userProfileId':_0x47ede1['userProfileId']},'raw':!![]})[_0xb346('0x24')](function(_0x344006){if(_0x344006&&_0x344006[_0xb346('0x4f')]===0x0){return db['UserProfileResource'][_0xb346('0x4a')]({'name':_0x5f18d0[_0xb346('0x2a')],'resourceId':_0x5f18d0['id'],'type':_0x344006[_0xb346('0x2a')],'sectionId':_0x344006['id']},{})[_0xb346('0x24')](function(){return _0x22b855;});}else{return _0x22b855;}})[_0xb346('0x48')](function(_0x137381){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x137381);throw _0x137381;});}return _0x22b855;})[_0xb346('0x24')](respondWithResult(_0x4a9f40,0xc9))['catch'](handleError(_0x4a9f40,null));};exports['update']=function(_0x31bd91,_0x283290){if(_0x31bd91['body']['id']){delete _0x31bd91['body']['id'];}return db[_0xb346('0x2c')][_0xb346('0x50')]({'where':{'id':_0x31bd91[_0xb346('0x51')]['id']}})[_0xb346('0x24')](handleEntityNotFound(_0x283290,null))['then'](saveUpdates(_0x31bd91['body'],null))[_0xb346('0x24')](respondWithResult(_0x283290,null))[_0xb346('0x48')](handleError(_0x283290,null));};exports[_0xb346('0x27')]=function(_0x490863,_0x3ec9fa){return db[_0xb346('0x2c')]['find']({'where':{'id':_0x490863['params']['id']}})[_0xb346('0x24')](handleEntityNotFound(_0x3ec9fa,null))[_0xb346('0x24')](removeEntity(_0x3ec9fa,null))['catch'](handleError(_0x3ec9fa,null));};exports[_0xb346('0x52')]=function(_0x3f7f45,_0x598a51,_0x543ef6){if(_0x3f7f45[_0xb346('0x4b')]['id']){delete _0x3f7f45[_0xb346('0x4b')]['id'];}return db['Trigger']['find']({'where':{'id':_0x3f7f45[_0xb346('0x51')]['id']}})['then'](handleEntityNotFound(_0x598a51,null))['then'](function(_0x3e6414){if(_0x3e6414){_0x3f7f45[_0xb346('0x4b')]['TriggerAllId']=_0x3e6414['id'];return db[_0xb346('0x53')][_0xb346('0x4a')](_0x3f7f45[_0xb346('0x4b')]);}})[_0xb346('0x24')](respondWithResult(_0x598a51,null))[_0xb346('0x48')](handleError(_0x598a51,null));};exports[_0xb346('0x54')]=function(_0x4cfeb6,_0xbeaf39,_0x26ced7){if(_0x4cfeb6[_0xb346('0x4b')]['id']){delete _0x4cfeb6[_0xb346('0x4b')]['id'];}return db['Trigger'][_0xb346('0x50')]({'where':{'id':_0x4cfeb6[_0xb346('0x51')]['id']}})[_0xb346('0x24')](handleEntityNotFound(_0xbeaf39,null))[_0xb346('0x24')](function(_0x2abb16){if(_0x2abb16){_0x4cfeb6['body']['TriggerAnyId']=_0x2abb16['id'];return db[_0xb346('0x53')][_0xb346('0x4a')](_0x4cfeb6[_0xb346('0x4b')]);}})[_0xb346('0x24')](respondWithResult(_0xbeaf39,null))[_0xb346('0x48')](handleError(_0xbeaf39,null));};exports['getAllConditions']=function(_0x2afd89,_0x5a324e,_0x1d79be){var _0x3b6600={};var _0x57ca9a={};var _0x5e24d0;var _0x2e12ba;return db[_0xb346('0x2c')][_0xb346('0x55')]({'where':{'id':_0x2afd89['params']['id']}})[_0xb346('0x24')](handleEntityNotFound(_0x5a324e,null))[_0xb346('0x24')](function(_0xb8b853){if(_0xb8b853){_0x5e24d0=_0xb8b853;_0x57ca9a['model']=_[_0xb346('0x34')](db['Condition']['rawAttributes']);_0x57ca9a[_0xb346('0x33')]=_[_0xb346('0x34')](_0x2afd89[_0xb346('0x33')]);_0x57ca9a[_0xb346('0x35')]=_['intersection'](_0x57ca9a['model'],_0x57ca9a[_0xb346('0x33')]);_0x3b6600[_0xb346('0x37')]=_[_0xb346('0x36')](_0x57ca9a[_0xb346('0x31')],qs[_0xb346('0x38')](_0x2afd89[_0xb346('0x33')][_0xb346('0x38')]));_0x3b6600[_0xb346('0x37')]=_0x3b6600[_0xb346('0x37')][_0xb346('0x39')]?_0x3b6600[_0xb346('0x37')]:_0x57ca9a[_0xb346('0x31')];_0x3b6600[_0xb346('0x3c')]=qs[_0xb346('0x56')](_0x2afd89[_0xb346('0x33')][_0xb346('0x56')]);_0x3b6600[_0xb346('0x3d')]=qs[_0xb346('0x35')](_['pick'](_0x2afd89[_0xb346('0x33')],_0x57ca9a['filters']));if(_0x2afd89[_0xb346('0x33')][_0xb346('0x3f')]){_0x3b6600['where']=_[_0xb346('0x41')](_0x3b6600[_0xb346('0x3d')],{'$or':_['map'](_0x3b6600[_0xb346('0x37')],function(_0x2561c4){var _0x2c88e3={};_0x2c88e3[_0x2561c4]={'$like':'%'+_0x2afd89[_0xb346('0x33')]['filter']+'%'};return _0x2c88e3;})});}_0x3b6600=_['merge']({},_0x3b6600,_0x2afd89[_0xb346('0x42')]);return _0x5e24d0[_0xb346('0x57')](_0x3b6600);}})['then'](function(_0x211f81){if(_0x211f81){_0x2e12ba=_0x211f81[_0xb346('0x39')];if(!_0x2afd89[_0xb346('0x33')][_0xb346('0x3a')](_0xb346('0x3b'))){_0x3b6600[_0xb346('0x20')]=qs['limit'](_0x2afd89[_0xb346('0x33')]['limit']);_0x3b6600['offset']=qs['offset'](_0x2afd89[_0xb346('0x33')][_0xb346('0x1e')]);}return _0x5e24d0[_0xb346('0x57')](_0x3b6600);}})['then'](function(_0x55598a){if(_0x55598a){return _0x55598a?{'count':_0x2e12ba,'rows':_0x55598a}:null;}})[_0xb346('0x24')](respondWithResult(_0x5a324e,null))[_0xb346('0x48')](handleError(_0x5a324e,null));};exports[_0xb346('0x58')]=function(_0x44efae,_0x28eae9,_0x3a872c){var _0x49f2cc={};var _0x305ca5={};var _0x1d968d;var _0x3d8212;return db[_0xb346('0x2c')][_0xb346('0x55')]({'where':{'id':_0x44efae[_0xb346('0x51')]['id']}})[_0xb346('0x24')](handleEntityNotFound(_0x28eae9,null))[_0xb346('0x24')](function(_0x41becf){if(_0x41becf){_0x1d968d=_0x41becf;_0x305ca5['model']=_[_0xb346('0x34')](db[_0xb346('0x53')][_0xb346('0x2d')]);_0x305ca5[_0xb346('0x33')]=_[_0xb346('0x34')](_0x44efae[_0xb346('0x33')]);_0x305ca5[_0xb346('0x35')]=_[_0xb346('0x36')](_0x305ca5[_0xb346('0x31')],_0x305ca5[_0xb346('0x33')]);_0x49f2cc[_0xb346('0x37')]=_['intersection'](_0x305ca5[_0xb346('0x31')],qs[_0xb346('0x38')](_0x44efae[_0xb346('0x33')][_0xb346('0x38')]));_0x49f2cc[_0xb346('0x37')]=_0x49f2cc[_0xb346('0x37')][_0xb346('0x39')]?_0x49f2cc[_0xb346('0x37')]:_0x305ca5[_0xb346('0x31')];_0x49f2cc[_0xb346('0x3c')]=qs[_0xb346('0x56')](_0x44efae[_0xb346('0x33')][_0xb346('0x56')]);_0x49f2cc[_0xb346('0x3d')]=qs[_0xb346('0x35')](_[_0xb346('0x3e')](_0x44efae[_0xb346('0x33')],_0x305ca5[_0xb346('0x35')]));if(_0x44efae[_0xb346('0x33')][_0xb346('0x3f')]){_0x49f2cc[_0xb346('0x3d')]=_[_0xb346('0x41')](_0x49f2cc['where'],{'$or':_[_0xb346('0x32')](_0x49f2cc[_0xb346('0x37')],function(_0x368c76){var _0x51b4e6={};_0x51b4e6[_0x368c76]={'$like':'%'+_0x44efae[_0xb346('0x33')]['filter']+'%'};return _0x51b4e6;})});}_0x49f2cc=_[_0xb346('0x41')]({},_0x49f2cc,_0x44efae['options']);return _0x1d968d[_0xb346('0x58')](_0x49f2cc);}})[_0xb346('0x24')](function(_0x154fda){if(_0x154fda){_0x3d8212=_0x154fda[_0xb346('0x39')];if(!_0x44efae[_0xb346('0x33')][_0xb346('0x3a')](_0xb346('0x3b'))){_0x49f2cc[_0xb346('0x20')]=qs[_0xb346('0x20')](_0x44efae[_0xb346('0x33')]['limit']);_0x49f2cc[_0xb346('0x1e')]=qs[_0xb346('0x1e')](_0x44efae[_0xb346('0x33')]['offset']);}return _0x1d968d[_0xb346('0x58')](_0x49f2cc);}})['then'](function(_0x31713c){if(_0x31713c){return _0x31713c?{'count':_0x3d8212,'rows':_0x31713c}:null;}})[_0xb346('0x24')](respondWithResult(_0x28eae9,null))[_0xb346('0x48')](handleError(_0x28eae9,null));};exports['addAction']=function(_0x556822,_0x4379bf,_0x17f0ca){if(_0x556822['body']['id']){delete _0x556822[_0xb346('0x4b')]['id'];}return db[_0xb346('0x2c')][_0xb346('0x50')]({'where':{'id':_0x556822[_0xb346('0x51')]['id']}})[_0xb346('0x24')](handleEntityNotFound(_0x4379bf,null))[_0xb346('0x24')](function(_0x5425e8){if(_0x5425e8){_0x556822[_0xb346('0x4b')][_0xb346('0x59')]=_0x5425e8['id'];return db['Action'][_0xb346('0x4a')](_0x556822[_0xb346('0x4b')]);}})[_0xb346('0x24')](respondWithResult(_0x4379bf,null))[_0xb346('0x48')](handleError(_0x4379bf,null));};exports[_0xb346('0x5a')]=function(_0x428385,_0x552fe4,_0x1886c){var _0x2e388a={};var _0x544dc9={};var _0x2bfd15;var _0x2d43dc;return db[_0xb346('0x2c')]['findOne']({'where':{'id':_0x428385[_0xb346('0x51')]['id']}})['then'](handleEntityNotFound(_0x552fe4,null))[_0xb346('0x24')](function(_0x320529){if(_0x320529){_0x2bfd15=_0x320529;_0x544dc9[_0xb346('0x31')]=_[_0xb346('0x34')](db[_0xb346('0x5b')][_0xb346('0x2d')]);_0x544dc9[_0xb346('0x33')]=_['keys'](_0x428385[_0xb346('0x33')]);_0x544dc9[_0xb346('0x35')]=_[_0xb346('0x36')](_0x544dc9[_0xb346('0x31')],_0x544dc9['query']);_0x2e388a['attributes']=_[_0xb346('0x36')](_0x544dc9[_0xb346('0x31')],qs[_0xb346('0x38')](_0x428385[_0xb346('0x33')][_0xb346('0x38')]));_0x2e388a[_0xb346('0x37')]=_0x2e388a[_0xb346('0x37')]['length']?_0x2e388a['attributes']:_0x544dc9[_0xb346('0x31')];_0x2e388a[_0xb346('0x3c')]=qs[_0xb346('0x56')](_0x428385['query'][_0xb346('0x56')]);_0x2e388a[_0xb346('0x3d')]=qs[_0xb346('0x35')](_[_0xb346('0x3e')](_0x428385['query'],_0x544dc9[_0xb346('0x35')]));if(_0x428385[_0xb346('0x33')]['filter']){_0x2e388a[_0xb346('0x3d')]=_['merge'](_0x2e388a['where'],{'$or':_[_0xb346('0x32')](_0x2e388a['attributes'],function(_0x4d3d83){var _0x150653={};_0x150653[_0x4d3d83]={'$like':'%'+_0x428385[_0xb346('0x33')][_0xb346('0x3f')]+'%'};return _0x150653;})});}_0x2e388a=_[_0xb346('0x41')]({},_0x2e388a,_0x428385['options']);return _0x2bfd15[_0xb346('0x5a')](_0x2e388a);}})[_0xb346('0x24')](function(_0x4d8dac){if(_0x4d8dac){_0x2d43dc=_0x4d8dac[_0xb346('0x39')];if(!_0x428385['query'][_0xb346('0x3a')](_0xb346('0x3b'))){_0x2e388a[_0xb346('0x20')]=qs['limit'](_0x428385[_0xb346('0x33')][_0xb346('0x20')]);_0x2e388a[_0xb346('0x1e')]=qs[_0xb346('0x1e')](_0x428385['query'][_0xb346('0x1e')]);}return _0x2bfd15[_0xb346('0x5a')](_0x2e388a);}})['then'](function(_0x49e6fb){if(_0x49e6fb){return _0x49e6fb?{'count':_0x2d43dc,'rows':_0x49e6fb}:null;}})[_0xb346('0x24')](respondWithResult(_0x552fe4,null))[_0xb346('0x48')](handleError(_0x552fe4,null));}; \ No newline at end of file +var _0x7df4=['moment','mustache','util','path','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Triggers','error','name','index','Trigger','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','role','user','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','filter','getAnyConditions','addAction','TriggerId','Action','options','getActions','eml-format','zip-dir','request-promise'];(function(_0xc3b8b8,_0x278eeb){var _0x19d547=function(_0x3b06e1){while(--_0x3b06e1){_0xc3b8b8['push'](_0xc3b8b8['shift']());}};_0x19d547(++_0x278eeb);}(_0x7df4,0x1bf));var _0x47df=function(_0x40da7f,_0x736a44){_0x40da7f=_0x40da7f-0x0;var _0x3003dc=_0x7df4[_0x40da7f];return _0x3003dc;};'use strict';var emlformat=require(_0x47df('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x47df('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47df('0x2'));var moment=require(_0x47df('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x47df('0x4'));var util=require(_0x47df('0x5'));var path=require(_0x47df('0x6'));var sox=require('sox');var csv=require(_0x47df('0x7'));var ejs=require(_0x47df('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x47df('0x9'));var squel=require('squel');var crypto=require(_0x47df('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x47df('0xb'));var Papa=require(_0x47df('0xc'));var Redis=require(_0x47df('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x47df('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x47df('0xf'))(_0x47df('0x10'));var utils=require(_0x47df('0x11'));var config=require(_0x47df('0x12'));var licenseUtil=require(_0x47df('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a7509,_0x28b92f){_0x28b92f=_0x28b92f||0xcc;return function(_0x3648c0){if(_0x3648c0){return _0x1a7509[_0x47df('0x14')](_0x28b92f);}return _0x1a7509[_0x47df('0x15')](_0x28b92f)[_0x47df('0x16')]();};}function respondWithResult(_0x474007,_0x500b51){_0x500b51=_0x500b51||0xc8;return function(_0x353859){if(_0x353859){return _0x474007['status'](_0x500b51)[_0x47df('0x17')](_0x353859);}};}function respondWithFilteredResult(_0x153b8b,_0x17b983){return function(_0x32478d){if(_0x32478d){var _0x49960f=typeof _0x17b983[_0x47df('0x18')]==='undefined'&&typeof _0x17b983[_0x47df('0x19')]===_0x47df('0x1a');var _0x36e4c9=_0x32478d[_0x47df('0x1b')];var _0x5a0d7c=_0x49960f?0x0:_0x17b983[_0x47df('0x18')];var _0x54ad7d=_0x49960f?_0x32478d[_0x47df('0x1b')]:_0x17b983[_0x47df('0x18')]+_0x17b983[_0x47df('0x19')];var _0x576e2b;if(_0x54ad7d>=_0x36e4c9){_0x54ad7d=_0x36e4c9;_0x576e2b=0xc8;}else{_0x576e2b=0xce;}_0x153b8b[_0x47df('0x15')](_0x576e2b);return _0x153b8b[_0x47df('0x1c')](_0x47df('0x1d'),_0x5a0d7c+'-'+_0x54ad7d+'/'+_0x36e4c9)[_0x47df('0x17')](_0x32478d);}return null;};}function patchUpdates(_0x17a596){return function(_0x434c4c){try{jsonpatch[_0x47df('0x1e')](_0x434c4c,_0x17a596,!![]);}catch(_0x2b139d){return BPromise[_0x47df('0x1f')](_0x2b139d);}return _0x434c4c[_0x47df('0x20')]();};}function saveUpdates(_0x3da3f3,_0x4f9eb6){return function(_0x77e84e){if(_0x77e84e){return _0x77e84e[_0x47df('0x21')](_0x3da3f3)['then'](function(_0x5aebe6){return _0x5aebe6;});}return null;};}function removeEntity(_0x29f4d4,_0x300f22){return function(_0x2ba297){if(_0x2ba297){return _0x2ba297[_0x47df('0x22')]()[_0x47df('0x23')](function(){var _0x6aef3a=_0x2ba297[_0x47df('0x24')]({'plain':!![]});var _0x4ce470=_0x47df('0x25');return db['UserProfileResource'][_0x47df('0x22')]({'where':{'type':_0x4ce470,'resourceId':_0x6aef3a['id']}})[_0x47df('0x23')](function(){return _0x2ba297;});})[_0x47df('0x23')](function(){_0x29f4d4[_0x47df('0x15')](0xcc)[_0x47df('0x16')]();});}};}function handleEntityNotFound(_0x2a77b5,_0x5e03fc){return function(_0x594d6e){if(!_0x594d6e){_0x2a77b5[_0x47df('0x14')](0x194);}return _0x594d6e;};}function handleError(_0xb6b99e,_0x524c07){_0x524c07=_0x524c07||0x1f4;return function(_0x259a1a){logger[_0x47df('0x26')](_0x259a1a['stack']);if(_0x259a1a['name']){delete _0x259a1a[_0x47df('0x27')];}_0xb6b99e['status'](_0x524c07)['send'](_0x259a1a);};}exports[_0x47df('0x28')]=function(_0x6c1ba5,_0x20fab6){var _0x216f8b={},_0x4b31f9={},_0x4c83cf={'count':0x0,'rows':[]};var _0x427fc9=_['map'](db[_0x47df('0x29')][_0x47df('0x2a')],function(_0x1d0764){return{'name':_0x1d0764[_0x47df('0x2b')],'type':_0x1d0764[_0x47df('0x2c')]['key']};});_0x4b31f9[_0x47df('0x2d')]=_[_0x47df('0x2e')](_0x427fc9,_0x47df('0x27'));_0x4b31f9[_0x47df('0x2f')]=_[_0x47df('0x30')](_0x6c1ba5['query']);_0x4b31f9[_0x47df('0x31')]=_[_0x47df('0x32')](_0x4b31f9[_0x47df('0x2d')],_0x4b31f9['query']);_0x216f8b['attributes']=_['intersection'](_0x4b31f9[_0x47df('0x2d')],qs[_0x47df('0x33')](_0x6c1ba5[_0x47df('0x2f')]['fields']));_0x216f8b[_0x47df('0x34')]=_0x216f8b[_0x47df('0x34')][_0x47df('0x35')]?_0x216f8b['attributes']:_0x4b31f9[_0x47df('0x2d')];if(!_0x6c1ba5[_0x47df('0x2f')][_0x47df('0x36')](_0x47df('0x37'))){_0x216f8b[_0x47df('0x19')]=qs[_0x47df('0x19')](_0x6c1ba5[_0x47df('0x2f')][_0x47df('0x19')]);_0x216f8b[_0x47df('0x18')]=qs[_0x47df('0x18')](_0x6c1ba5[_0x47df('0x2f')]['offset']);}_0x216f8b[_0x47df('0x38')]=qs['sort'](_0x6c1ba5['query'][_0x47df('0x39')]);_0x216f8b[_0x47df('0x3a')]=qs[_0x47df('0x31')](_[_0x47df('0x3b')](_0x6c1ba5[_0x47df('0x2f')],_0x4b31f9[_0x47df('0x31')]),_0x427fc9);if(_0x6c1ba5['query']['filter']){_0x216f8b[_0x47df('0x3a')]=_[_0x47df('0x3c')](_0x216f8b[_0x47df('0x3a')],{'$or':_[_0x47df('0x2e')](_0x427fc9,function(_0x5c6dbb){if(_0x5c6dbb[_0x47df('0x2c')]!==_0x47df('0x3d')){var _0x3e5413={};_0x3e5413[_0x5c6dbb['name']]={'$like':'%'+_0x6c1ba5['query']['filter']+'%'};return _0x3e5413;}})});}_0x216f8b=_[_0x47df('0x3c')]({},_0x216f8b,_0x6c1ba5['options']);var _0x339803={'where':_0x216f8b[_0x47df('0x3a')]};return db[_0x47df('0x29')]['count'](_0x339803)[_0x47df('0x23')](function(_0x20d82e){_0x4c83cf['count']=_0x20d82e;if(_0x6c1ba5[_0x47df('0x2f')][_0x47df('0x3e')]){_0x216f8b[_0x47df('0x3f')]=[{'all':!![]}];}return db[_0x47df('0x29')][_0x47df('0x40')](_0x216f8b);})[_0x47df('0x23')](function(_0x266842){_0x4c83cf[_0x47df('0x41')]=_0x266842;return _0x4c83cf;})[_0x47df('0x23')](respondWithFilteredResult(_0x20fab6,_0x216f8b))[_0x47df('0x42')](handleError(_0x20fab6,null));};exports[_0x47df('0x43')]=function(_0x473e7e,_0x178d6c){var _0x2bc8b9={'raw':![],'where':{'id':_0x473e7e[_0x47df('0x44')]['id']}},_0x565b14={};_0x565b14[_0x47df('0x2d')]=_[_0x47df('0x30')](db[_0x47df('0x29')]['rawAttributes']);_0x565b14['query']=_[_0x47df('0x30')](_0x473e7e[_0x47df('0x2f')]);_0x565b14[_0x47df('0x31')]=_[_0x47df('0x32')](_0x565b14['model'],_0x565b14['query']);_0x2bc8b9[_0x47df('0x34')]=_[_0x47df('0x32')](_0x565b14[_0x47df('0x2d')],qs['fields'](_0x473e7e[_0x47df('0x2f')][_0x47df('0x33')]));_0x2bc8b9[_0x47df('0x34')]=_0x2bc8b9['attributes']['length']?_0x2bc8b9['attributes']:_0x565b14[_0x47df('0x2d')];if(_0x473e7e[_0x47df('0x2f')][_0x47df('0x3e')]){_0x2bc8b9[_0x47df('0x3f')]=[{'all':!![]}];}_0x2bc8b9=_[_0x47df('0x3c')]({},_0x2bc8b9,_0x473e7e['options']);return db[_0x47df('0x29')][_0x47df('0x45')](_0x2bc8b9)[_0x47df('0x23')](handleEntityNotFound(_0x178d6c,null))[_0x47df('0x23')](respondWithResult(_0x178d6c,null))['catch'](handleError(_0x178d6c,null));};exports[_0x47df('0x46')]=function(_0x2ebb46,_0x2999d0){return db[_0x47df('0x29')][_0x47df('0x46')](_0x2ebb46['body'],{})['then'](function(_0x133d50){var _0x2af828=_0x2ebb46['user']['get']({'plain':!![]});if(!_0x2af828)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2af828[_0x47df('0x47')]===_0x47df('0x48')){var _0x147e3a=_0x133d50[_0x47df('0x24')]({'plain':!![]});var _0x40b3eb=_0x47df('0x25');return db['UserProfileSection'][_0x47df('0x45')]({'where':{'name':_0x40b3eb,'userProfileId':_0x2af828[_0x47df('0x49')]},'raw':!![]})[_0x47df('0x23')](function(_0xc51d2b){if(_0xc51d2b&&_0xc51d2b['autoAssociation']===0x0){return db[_0x47df('0x4a')][_0x47df('0x46')]({'name':_0x147e3a[_0x47df('0x27')],'resourceId':_0x147e3a['id'],'type':_0xc51d2b[_0x47df('0x27')],'sectionId':_0xc51d2b['id']},{})[_0x47df('0x23')](function(){return _0x133d50;});}else{return _0x133d50;}})[_0x47df('0x42')](function(_0x1ed791){logger[_0x47df('0x26')](_0x47df('0x4b'),_0x1ed791);throw _0x1ed791;});}return _0x133d50;})[_0x47df('0x23')](respondWithResult(_0x2999d0,0xc9))[_0x47df('0x42')](handleError(_0x2999d0,null));};exports[_0x47df('0x21')]=function(_0x40ac4d,_0x3edcac){if(_0x40ac4d['body']['id']){delete _0x40ac4d[_0x47df('0x4c')]['id'];}return db[_0x47df('0x29')]['find']({'where':{'id':_0x40ac4d[_0x47df('0x44')]['id']}})[_0x47df('0x23')](handleEntityNotFound(_0x3edcac,null))[_0x47df('0x23')](saveUpdates(_0x40ac4d[_0x47df('0x4c')],null))[_0x47df('0x23')](respondWithResult(_0x3edcac,null))[_0x47df('0x42')](handleError(_0x3edcac,null));};exports[_0x47df('0x22')]=function(_0x170b3a,_0x56eb0d){return db['Trigger'][_0x47df('0x45')]({'where':{'id':_0x170b3a[_0x47df('0x44')]['id']}})[_0x47df('0x23')](handleEntityNotFound(_0x56eb0d,null))[_0x47df('0x23')](removeEntity(_0x56eb0d,null))[_0x47df('0x42')](handleError(_0x56eb0d,null));};exports[_0x47df('0x4d')]=function(_0x218a7e,_0x18ae81,_0x60a06e){if(_0x218a7e[_0x47df('0x4c')]['id']){delete _0x218a7e[_0x47df('0x4c')]['id'];}return db['Trigger'][_0x47df('0x45')]({'where':{'id':_0x218a7e[_0x47df('0x44')]['id']}})[_0x47df('0x23')](handleEntityNotFound(_0x18ae81,null))['then'](function(_0x45fe59){if(_0x45fe59){_0x218a7e['body']['TriggerAllId']=_0x45fe59['id'];return db[_0x47df('0x4e')][_0x47df('0x46')](_0x218a7e['body']);}})['then'](respondWithResult(_0x18ae81,null))[_0x47df('0x42')](handleError(_0x18ae81,null));};exports[_0x47df('0x4f')]=function(_0x23e6b3,_0x1ba3b7,_0x1e5354){if(_0x23e6b3[_0x47df('0x4c')]['id']){delete _0x23e6b3[_0x47df('0x4c')]['id'];}return db['Trigger'][_0x47df('0x45')]({'where':{'id':_0x23e6b3['params']['id']}})[_0x47df('0x23')](handleEntityNotFound(_0x1ba3b7,null))[_0x47df('0x23')](function(_0x1c5bd6){if(_0x1c5bd6){_0x23e6b3[_0x47df('0x4c')][_0x47df('0x50')]=_0x1c5bd6['id'];return db[_0x47df('0x4e')][_0x47df('0x46')](_0x23e6b3['body']);}})[_0x47df('0x23')](respondWithResult(_0x1ba3b7,null))[_0x47df('0x42')](handleError(_0x1ba3b7,null));};exports[_0x47df('0x51')]=function(_0x446d5f,_0x49f201,_0x5f4a0e){var _0x489ac8={};var _0x33587d={};var _0x2e9113;var _0x2bd74f;return db[_0x47df('0x29')][_0x47df('0x52')]({'where':{'id':_0x446d5f[_0x47df('0x44')]['id']}})['then'](handleEntityNotFound(_0x49f201,null))[_0x47df('0x23')](function(_0x2ca597){if(_0x2ca597){_0x2e9113=_0x2ca597;_0x33587d['model']=_[_0x47df('0x30')](db['Condition'][_0x47df('0x2a')]);_0x33587d[_0x47df('0x2f')]=_['keys'](_0x446d5f[_0x47df('0x2f')]);_0x33587d[_0x47df('0x31')]=_['intersection'](_0x33587d[_0x47df('0x2d')],_0x33587d[_0x47df('0x2f')]);_0x489ac8[_0x47df('0x34')]=_['intersection'](_0x33587d[_0x47df('0x2d')],qs[_0x47df('0x33')](_0x446d5f['query'][_0x47df('0x33')]));_0x489ac8[_0x47df('0x34')]=_0x489ac8[_0x47df('0x34')][_0x47df('0x35')]?_0x489ac8[_0x47df('0x34')]:_0x33587d[_0x47df('0x2d')];_0x489ac8[_0x47df('0x38')]=qs[_0x47df('0x39')](_0x446d5f[_0x47df('0x2f')]['sort']);_0x489ac8[_0x47df('0x3a')]=qs['filters'](_['pick'](_0x446d5f[_0x47df('0x2f')],_0x33587d[_0x47df('0x31')]));if(_0x446d5f[_0x47df('0x2f')][_0x47df('0x53')]){_0x489ac8[_0x47df('0x3a')]=_['merge'](_0x489ac8[_0x47df('0x3a')],{'$or':_[_0x47df('0x2e')](_0x489ac8['attributes'],function(_0x326789){var _0x4e9c42={};_0x4e9c42[_0x326789]={'$like':'%'+_0x446d5f['query']['filter']+'%'};return _0x4e9c42;})});}_0x489ac8=_[_0x47df('0x3c')]({},_0x489ac8,_0x446d5f['options']);return _0x2e9113[_0x47df('0x51')](_0x489ac8);}})[_0x47df('0x23')](function(_0x43158a){if(_0x43158a){_0x2bd74f=_0x43158a['length'];if(!_0x446d5f[_0x47df('0x2f')][_0x47df('0x36')](_0x47df('0x37'))){_0x489ac8['limit']=qs[_0x47df('0x19')](_0x446d5f[_0x47df('0x2f')][_0x47df('0x19')]);_0x489ac8[_0x47df('0x18')]=qs[_0x47df('0x18')](_0x446d5f[_0x47df('0x2f')][_0x47df('0x18')]);}return _0x2e9113[_0x47df('0x51')](_0x489ac8);}})['then'](function(_0x1aa818){if(_0x1aa818){return _0x1aa818?{'count':_0x2bd74f,'rows':_0x1aa818}:null;}})[_0x47df('0x23')](respondWithResult(_0x49f201,null))['catch'](handleError(_0x49f201,null));};exports[_0x47df('0x54')]=function(_0x520964,_0x444595,_0x52af86){var _0x490fba={};var _0x110483={};var _0x4c3317;var _0x383ec7;return db[_0x47df('0x29')]['findOne']({'where':{'id':_0x520964[_0x47df('0x44')]['id']}})[_0x47df('0x23')](handleEntityNotFound(_0x444595,null))[_0x47df('0x23')](function(_0x564bb1){if(_0x564bb1){_0x4c3317=_0x564bb1;_0x110483['model']=_[_0x47df('0x30')](db[_0x47df('0x4e')][_0x47df('0x2a')]);_0x110483[_0x47df('0x2f')]=_[_0x47df('0x30')](_0x520964['query']);_0x110483[_0x47df('0x31')]=_[_0x47df('0x32')](_0x110483[_0x47df('0x2d')],_0x110483[_0x47df('0x2f')]);_0x490fba[_0x47df('0x34')]=_['intersection'](_0x110483[_0x47df('0x2d')],qs[_0x47df('0x33')](_0x520964['query'][_0x47df('0x33')]));_0x490fba[_0x47df('0x34')]=_0x490fba['attributes']['length']?_0x490fba[_0x47df('0x34')]:_0x110483['model'];_0x490fba[_0x47df('0x38')]=qs[_0x47df('0x39')](_0x520964[_0x47df('0x2f')][_0x47df('0x39')]);_0x490fba[_0x47df('0x3a')]=qs[_0x47df('0x31')](_['pick'](_0x520964['query'],_0x110483[_0x47df('0x31')]));if(_0x520964[_0x47df('0x2f')][_0x47df('0x53')]){_0x490fba[_0x47df('0x3a')]=_[_0x47df('0x3c')](_0x490fba[_0x47df('0x3a')],{'$or':_[_0x47df('0x2e')](_0x490fba[_0x47df('0x34')],function(_0x489262){var _0x4b9b7d={};_0x4b9b7d[_0x489262]={'$like':'%'+_0x520964[_0x47df('0x2f')][_0x47df('0x53')]+'%'};return _0x4b9b7d;})});}_0x490fba=_[_0x47df('0x3c')]({},_0x490fba,_0x520964['options']);return _0x4c3317[_0x47df('0x54')](_0x490fba);}})[_0x47df('0x23')](function(_0x4a8256){if(_0x4a8256){_0x383ec7=_0x4a8256[_0x47df('0x35')];if(!_0x520964[_0x47df('0x2f')][_0x47df('0x36')](_0x47df('0x37'))){_0x490fba[_0x47df('0x19')]=qs[_0x47df('0x19')](_0x520964[_0x47df('0x2f')][_0x47df('0x19')]);_0x490fba[_0x47df('0x18')]=qs['offset'](_0x520964[_0x47df('0x2f')][_0x47df('0x18')]);}return _0x4c3317[_0x47df('0x54')](_0x490fba);}})[_0x47df('0x23')](function(_0x20b361){if(_0x20b361){return _0x20b361?{'count':_0x383ec7,'rows':_0x20b361}:null;}})[_0x47df('0x23')](respondWithResult(_0x444595,null))[_0x47df('0x42')](handleError(_0x444595,null));};exports[_0x47df('0x55')]=function(_0x1d9df3,_0x56aa62,_0x50154e){if(_0x1d9df3[_0x47df('0x4c')]['id']){delete _0x1d9df3[_0x47df('0x4c')]['id'];}return db[_0x47df('0x29')]['find']({'where':{'id':_0x1d9df3[_0x47df('0x44')]['id']}})[_0x47df('0x23')](handleEntityNotFound(_0x56aa62,null))[_0x47df('0x23')](function(_0x1a624f){if(_0x1a624f){_0x1d9df3[_0x47df('0x4c')][_0x47df('0x56')]=_0x1a624f['id'];return db[_0x47df('0x57')][_0x47df('0x46')](_0x1d9df3[_0x47df('0x4c')]);}})['then'](respondWithResult(_0x56aa62,null))[_0x47df('0x42')](handleError(_0x56aa62,null));};exports['getActions']=function(_0x146ba1,_0x1bd68b,_0x49013a){var _0x21c939={};var _0x158393={};var _0x5799dc;var _0x1c0cdf;return db[_0x47df('0x29')][_0x47df('0x52')]({'where':{'id':_0x146ba1[_0x47df('0x44')]['id']}})[_0x47df('0x23')](handleEntityNotFound(_0x1bd68b,null))[_0x47df('0x23')](function(_0xb881ec){if(_0xb881ec){_0x5799dc=_0xb881ec;_0x158393['model']=_['keys'](db[_0x47df('0x57')]['rawAttributes']);_0x158393['query']=_[_0x47df('0x30')](_0x146ba1['query']);_0x158393['filters']=_[_0x47df('0x32')](_0x158393[_0x47df('0x2d')],_0x158393[_0x47df('0x2f')]);_0x21c939[_0x47df('0x34')]=_['intersection'](_0x158393['model'],qs[_0x47df('0x33')](_0x146ba1[_0x47df('0x2f')][_0x47df('0x33')]));_0x21c939[_0x47df('0x34')]=_0x21c939[_0x47df('0x34')][_0x47df('0x35')]?_0x21c939['attributes']:_0x158393[_0x47df('0x2d')];_0x21c939[_0x47df('0x38')]=qs[_0x47df('0x39')](_0x146ba1[_0x47df('0x2f')][_0x47df('0x39')]);_0x21c939[_0x47df('0x3a')]=qs[_0x47df('0x31')](_[_0x47df('0x3b')](_0x146ba1[_0x47df('0x2f')],_0x158393[_0x47df('0x31')]));if(_0x146ba1['query'][_0x47df('0x53')]){_0x21c939[_0x47df('0x3a')]=_[_0x47df('0x3c')](_0x21c939['where'],{'$or':_[_0x47df('0x2e')](_0x21c939[_0x47df('0x34')],function(_0xa18474){var _0x379597={};_0x379597[_0xa18474]={'$like':'%'+_0x146ba1['query']['filter']+'%'};return _0x379597;})});}_0x21c939=_[_0x47df('0x3c')]({},_0x21c939,_0x146ba1[_0x47df('0x58')]);return _0x5799dc[_0x47df('0x59')](_0x21c939);}})[_0x47df('0x23')](function(_0x30f38a){if(_0x30f38a){_0x1c0cdf=_0x30f38a['length'];if(!_0x146ba1[_0x47df('0x2f')]['hasOwnProperty'](_0x47df('0x37'))){_0x21c939['limit']=qs[_0x47df('0x19')](_0x146ba1[_0x47df('0x2f')]['limit']);_0x21c939[_0x47df('0x18')]=qs[_0x47df('0x18')](_0x146ba1['query'][_0x47df('0x18')]);}return _0x5799dc[_0x47df('0x59')](_0x21c939);}})[_0x47df('0x23')](function(_0x5eb652){if(_0x5eb652){return _0x5eb652?{'count':_0x1c0cdf,'rows':_0x5eb652}:null;}})[_0x47df('0x23')](respondWithResult(_0x1bd68b,null))[_0x47df('0x42')](handleError(_0x1bd68b,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 36d28d1..c9ca80d 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 _0xf874=['path','../../config/environment','./trigger.attributes','exports','define','tools_triggers','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xf874,0xed));var _0x4f87=function(_0x224005,_0x5bcded){_0x224005=_0x224005-0x0;var _0x331a0e=_0xf874[_0x224005];return _0x331a0e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4f87('0x0'))(_0x4f87('0x1'));var moment=require(_0x4f87('0x2'));var BPromise=require(_0x4f87('0x3'));var rp=require(_0x4f87('0x4'));var fs=require('fs');var path=require(_0x4f87('0x5'));var rimraf=require('rimraf');var config=require(_0x4f87('0x6'));var attributes=require(_0x4f87('0x7'));module[_0x4f87('0x8')]=function(_0xf0ffb3,_0x104682){return _0xf0ffb3[_0x4f87('0x9')]('Trigger',attributes,{'tableName':_0x4f87('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf430=['../../config/environment','./trigger.attributes','define','tools_triggers','lodash','util','../../config/logger','moment','bluebird','rimraf'];(function(_0x1accf6,_0x4a9854){var _0x24e446=function(_0x487f51){while(--_0x487f51){_0x1accf6['push'](_0x1accf6['shift']());}};_0x24e446(++_0x4a9854);}(_0xf430,0x1e4));var _0x0f43=function(_0x4a8bad,_0x4bfb2f){_0x4a8bad=_0x4a8bad-0x0;var _0x30cf32=_0xf430[_0x4a8bad];return _0x30cf32;};'use strict';var _=require(_0x0f43('0x0'));var util=require(_0x0f43('0x1'));var logger=require(_0x0f43('0x2'))('api');var moment=require(_0x0f43('0x3'));var BPromise=require(_0x0f43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0f43('0x5'));var config=require(_0x0f43('0x6'));var attributes=require(_0x0f43('0x7'));module['exports']=function(_0x5edfba,_0x31f752){return _0x5edfba[_0x0f43('0x8')]('Trigger',attributes,{'tableName':_0x0f43('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 1caa51b..19bcc80 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 _0x3771=['Trigger,\x20%s,\x20%s','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','GetTrigger','options','raw','where','attributes','include','map','model','debug','catch','find','ShowTrigger','stringify','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x5093e9,_0x5154d0){var _0x4c9a22=function(_0x15176d){while(--_0x15176d){_0x5093e9['push'](_0x5093e9['shift']());}};_0x4c9a22(++_0x5154d0);}(_0x3771,0x1f4));var _0x1377=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x3771[_0x9df060];return _0x338dfe;};'use strict';var _=require('lodash');var util=require(_0x1377('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1377('0x1'));var fs=require('fs');var Redis=require(_0x1377('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1377('0x3'));var logger=require(_0x1377('0x4'))(_0x1377('0x5'));var config=require(_0x1377('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1377('0x7')][_0x1377('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33062a,_0x3faf34,_0x4eae17){return new BPromise(function(_0x143f32,_0x230620){return client[_0x1377('0x9')](_0x33062a,_0x4eae17)[_0x1377('0xa')](function(_0xfb94ab){logger[_0x1377('0xb')](_0x1377('0xc'),_0x3faf34,'request\x20sent');logger['debug'](_0x1377('0xd'),_0x3faf34,'request\x20sent',JSON['stringify'](_0xfb94ab));if(_0xfb94ab['error']){if(_0xfb94ab[_0x1377('0xe')][_0x1377('0xf')]===0x1f4){logger['error'](_0x1377('0xc'),_0x3faf34,_0xfb94ab[_0x1377('0xe')]['message']);return _0x230620(_0xfb94ab[_0x1377('0xe')][_0x1377('0x10')]);}logger[_0x1377('0xe')](_0x1377('0xc'),_0x3faf34,_0xfb94ab[_0x1377('0xe')]['message']);return _0x143f32(_0xfb94ab[_0x1377('0xe')][_0x1377('0x10')]);}else{logger[_0x1377('0xb')](_0x1377('0xc'),_0x3faf34,_0x1377('0x11'));_0x143f32(_0xfb94ab[_0x1377('0x12')]['message']);}})['catch'](function(_0x24f6b1){logger[_0x1377('0xe')](_0x1377('0xc'),_0x3faf34,_0x24f6b1);_0x230620(_0x24f6b1);});});}exports[_0x1377('0x13')]=function(_0x4f67e7){var _0x55aa32=this;return new Promise(function(_0x3c626a,_0x3f33e3){return db['Trigger']['findAll']({'raw':_0x4f67e7[_0x1377('0x14')]?_0x4f67e7[_0x1377('0x14')][_0x1377('0x15')]===undefined?!![]:![]:!![],'where':_0x4f67e7[_0x1377('0x14')]?_0x4f67e7[_0x1377('0x14')][_0x1377('0x16')]||null:null,'attributes':_0x4f67e7['options']?_0x4f67e7['options'][_0x1377('0x17')]||null:null,'limit':_0x4f67e7[_0x1377('0x14')]?_0x4f67e7[_0x1377('0x14')]['limit']||null:null,'include':_0x4f67e7[_0x1377('0x14')]?_0x4f67e7[_0x1377('0x14')][_0x1377('0x18')]?_[_0x1377('0x19')](_0x4f67e7[_0x1377('0x14')]['include'],function(_0x2e3c40){return{'model':db[_0x2e3c40[_0x1377('0x1a')]],'as':_0x2e3c40['as'],'attributes':_0x2e3c40[_0x1377('0x17')],'include':_0x2e3c40[_0x1377('0x18')]?_[_0x1377('0x19')](_0x2e3c40[_0x1377('0x18')],function(_0x10b9b3){return{'model':db[_0x10b9b3['model']],'as':_0x10b9b3['as'],'attributes':_0x10b9b3[_0x1377('0x17')],'include':_0x10b9b3[_0x1377('0x18')]?_[_0x1377('0x19')](_0x10b9b3['include'],function(_0x5dcd04){return{'model':db[_0x5dcd04[_0x1377('0x1a')]],'as':_0x5dcd04['as'],'attributes':_0x5dcd04[_0x1377('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x442d01){logger[_0x1377('0xb')](_0x1377('0x13'),_0x4f67e7);logger[_0x1377('0x1b')]('GetTrigger',_0x4f67e7,JSON['stringify'](_0x442d01));_0x3c626a(_0x442d01);})[_0x1377('0x1c')](function(_0x1dabd3){logger['error'](_0x1377('0x13'),_0x1dabd3[_0x1377('0x10')],_0x4f67e7);_0x3f33e3(_0x55aa32[_0x1377('0xe')](0x1f4,_0x1dabd3[_0x1377('0x10')]));});});};exports['ShowTrigger']=function(_0x2e5bb6){var _0x320ecf=this;return new Promise(function(_0x45a68d,_0x480be2){return db['Trigger'][_0x1377('0x1d')]({'raw':_0x2e5bb6[_0x1377('0x14')]?_0x2e5bb6[_0x1377('0x14')][_0x1377('0x15')]===undefined?!![]:![]:!![],'where':_0x2e5bb6[_0x1377('0x14')]?_0x2e5bb6['options']['where']||null:null,'attributes':_0x2e5bb6[_0x1377('0x14')]?_0x2e5bb6['options'][_0x1377('0x17')]||null:null,'include':_0x2e5bb6['options']?_0x2e5bb6[_0x1377('0x14')]['include']?_[_0x1377('0x19')](_0x2e5bb6[_0x1377('0x14')][_0x1377('0x18')],function(_0xfc9008){return{'model':db[_0xfc9008['model']],'as':_0xfc9008['as'],'attributes':_0xfc9008[_0x1377('0x17')],'include':_0xfc9008[_0x1377('0x18')]?_['map'](_0xfc9008[_0x1377('0x18')],function(_0x5cacbf){return{'model':db[_0x5cacbf['model']],'as':_0x5cacbf['as'],'attributes':_0x5cacbf['attributes'],'include':_0x5cacbf[_0x1377('0x18')]?_[_0x1377('0x19')](_0x5cacbf['include'],function(_0x326bca){return{'model':db[_0x326bca[_0x1377('0x1a')]],'as':_0x326bca['as'],'attributes':_0x326bca[_0x1377('0x17')]};}):[]};}):[]};}):[]:[]})[_0x1377('0xa')](function(_0x87f049){logger['info'](_0x1377('0x1e'),_0x2e5bb6);logger['debug'](_0x1377('0x1e'),_0x2e5bb6,JSON[_0x1377('0x1f')](_0x87f049));_0x45a68d(_0x87f049);})['catch'](function(_0x561925){logger[_0x1377('0xe')](_0x1377('0x1e'),_0x561925['message'],_0x2e5bb6);_0x480be2(_0x320ecf[_0x1377('0xe')](0x1f4,_0x561925['message']));});});}; \ No newline at end of file +var _0xdbce=['find','where','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/environment','client','http','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','Trigger','options','raw','attributes','limit','include','map','model','GetTrigger','ShowTrigger'];(function(_0x251502,_0x242aed){var _0x48a94a=function(_0x247ec5){while(--_0x247ec5){_0x251502['push'](_0x251502['shift']());}};_0x48a94a(++_0x242aed);}(_0xdbce,0x9e));var _0xedbc=function(_0x1d09b6,_0x1ac12c){_0x1d09b6=_0x1d09b6-0x0;var _0x2f1a26=_0xdbce[_0x1d09b6];return _0x2f1a26;};'use strict';var _=require(_0xedbc('0x0'));var util=require(_0xedbc('0x1'));var moment=require(_0xedbc('0x2'));var BPromise=require(_0xedbc('0x3'));var rs=require(_0xedbc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedbc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xedbc('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xedbc('0x7')][_0xedbc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x286366,_0xd04aca,_0x5654f3){return new BPromise(function(_0x2150f0,_0x134c9f){return client['request'](_0x286366,_0x5654f3)['then'](function(_0x3bb852){logger[_0xedbc('0x9')](_0xedbc('0xa'),_0xd04aca,_0xedbc('0xb'));logger['debug'](_0xedbc('0xc'),_0xd04aca,_0xedbc('0xb'),JSON[_0xedbc('0xd')](_0x3bb852));if(_0x3bb852['error']){if(_0x3bb852[_0xedbc('0xe')][_0xedbc('0xf')]===0x1f4){logger[_0xedbc('0xe')](_0xedbc('0xa'),_0xd04aca,_0x3bb852[_0xedbc('0xe')][_0xedbc('0x10')]);return _0x134c9f(_0x3bb852[_0xedbc('0xe')][_0xedbc('0x10')]);}logger[_0xedbc('0xe')](_0xedbc('0xa'),_0xd04aca,_0x3bb852[_0xedbc('0xe')][_0xedbc('0x10')]);return _0x2150f0(_0x3bb852[_0xedbc('0xe')][_0xedbc('0x10')]);}else{logger[_0xedbc('0x9')](_0xedbc('0xa'),_0xd04aca,_0xedbc('0xb'));_0x2150f0(_0x3bb852['result'][_0xedbc('0x10')]);}})[_0xedbc('0x11')](function(_0x55c201){logger[_0xedbc('0xe')](_0xedbc('0xa'),_0xd04aca,_0x55c201);_0x134c9f(_0x55c201);});});}exports['GetTrigger']=function(_0x23d973){var _0x1e8048=this;return new Promise(function(_0x4dfb08,_0x3a9e59){return db[_0xedbc('0x12')]['findAll']({'raw':_0x23d973['options']?_0x23d973[_0xedbc('0x13')][_0xedbc('0x14')]===undefined?!![]:![]:!![],'where':_0x23d973['options']?_0x23d973[_0xedbc('0x13')]['where']||null:null,'attributes':_0x23d973[_0xedbc('0x13')]?_0x23d973[_0xedbc('0x13')][_0xedbc('0x15')]||null:null,'limit':_0x23d973['options']?_0x23d973[_0xedbc('0x13')][_0xedbc('0x16')]||null:null,'include':_0x23d973['options']?_0x23d973['options'][_0xedbc('0x17')]?_[_0xedbc('0x18')](_0x23d973[_0xedbc('0x13')][_0xedbc('0x17')],function(_0x454c4a){return{'model':db[_0x454c4a[_0xedbc('0x19')]],'as':_0x454c4a['as'],'attributes':_0x454c4a['attributes'],'include':_0x454c4a[_0xedbc('0x17')]?_['map'](_0x454c4a[_0xedbc('0x17')],function(_0x269453){return{'model':db[_0x269453[_0xedbc('0x19')]],'as':_0x269453['as'],'attributes':_0x269453[_0xedbc('0x15')],'include':_0x269453['include']?_[_0xedbc('0x18')](_0x269453[_0xedbc('0x17')],function(_0x3d3767){return{'model':db[_0x3d3767[_0xedbc('0x19')]],'as':_0x3d3767['as'],'attributes':_0x3d3767[_0xedbc('0x15')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xbafe05){logger[_0xedbc('0x9')](_0xedbc('0x1a'),_0x23d973);logger['debug'](_0xedbc('0x1a'),_0x23d973,JSON[_0xedbc('0xd')](_0xbafe05));_0x4dfb08(_0xbafe05);})[_0xedbc('0x11')](function(_0x4d2f97){logger[_0xedbc('0xe')](_0xedbc('0x1a'),_0x4d2f97['message'],_0x23d973);_0x3a9e59(_0x1e8048[_0xedbc('0xe')](0x1f4,_0x4d2f97[_0xedbc('0x10')]));});});};exports[_0xedbc('0x1b')]=function(_0x28047a){var _0x994540=this;return new Promise(function(_0xf3c813,_0x88bc27){return db[_0xedbc('0x12')][_0xedbc('0x1c')]({'raw':_0x28047a[_0xedbc('0x13')]?_0x28047a[_0xedbc('0x13')][_0xedbc('0x14')]===undefined?!![]:![]:!![],'where':_0x28047a[_0xedbc('0x13')]?_0x28047a[_0xedbc('0x13')][_0xedbc('0x1d')]||null:null,'attributes':_0x28047a[_0xedbc('0x13')]?_0x28047a[_0xedbc('0x13')][_0xedbc('0x15')]||null:null,'include':_0x28047a[_0xedbc('0x13')]?_0x28047a['options']['include']?_[_0xedbc('0x18')](_0x28047a[_0xedbc('0x13')][_0xedbc('0x17')],function(_0xd6844){return{'model':db[_0xd6844[_0xedbc('0x19')]],'as':_0xd6844['as'],'attributes':_0xd6844['attributes'],'include':_0xd6844[_0xedbc('0x17')]?_[_0xedbc('0x18')](_0xd6844[_0xedbc('0x17')],function(_0x245a44){return{'model':db[_0x245a44[_0xedbc('0x19')]],'as':_0x245a44['as'],'attributes':_0x245a44['attributes'],'include':_0x245a44[_0xedbc('0x17')]?_[_0xedbc('0x18')](_0x245a44[_0xedbc('0x17')],function(_0x421180){return{'model':db[_0x421180['model']],'as':_0x421180['as'],'attributes':_0x421180['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x229881){logger[_0xedbc('0x9')](_0xedbc('0x1b'),_0x28047a);logger[_0xedbc('0x1e')]('ShowTrigger',_0x28047a,JSON[_0xedbc('0xd')](_0x229881));_0xf3c813(_0x229881);})[_0xedbc('0x11')](function(_0x217d55){logger[_0xedbc('0xe')]('ShowTrigger',_0x217d55[_0xedbc('0x10')],_0x28047a);_0x88bc27(_0x994540[_0xedbc('0xe')](0x1f4,_0x217d55[_0xedbc('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 0d012d3..30c5e37 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 _0x16ee=['isAuthenticated','index','get','/:id','show','/:id/clone','clone','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller'];(function(_0x454d01,_0x41e6f3){var _0x3f9b10=function(_0x455fcf){while(--_0x455fcf){_0x454d01['push'](_0x454d01['shift']());}};_0x3f9b10(++_0x41e6f3);}(_0x16ee,0x69));var _0xe16e=function(_0x4bed75,_0x211cc7){_0x4bed75=_0x4bed75-0x0;var _0x2dd8e8=_0x16ee[_0x4bed75];return _0x2dd8e8;};'use strict';var multer=require(_0xe16e('0x0'));var util=require('util');var path=require(_0xe16e('0x1'));var timeout=require(_0xe16e('0x2'));var express=require(_0xe16e('0x3'));var router=express[_0xe16e('0x4')]();var fs_extra=require(_0xe16e('0x5'));var auth=require(_0xe16e('0x6'));var interaction=require(_0xe16e('0x7'));var config=require(_0xe16e('0x8'));var controller=require(_0xe16e('0x9'));router['get']('/',auth[_0xe16e('0xa')](),controller[_0xe16e('0xb')]);router[_0xe16e('0xc')](_0xe16e('0xd'),auth[_0xe16e('0xa')](),controller[_0xe16e('0xe')]);router['post'](_0xe16e('0xf'),auth[_0xe16e('0xa')](),controller[_0xe16e('0x10')]);router[_0xe16e('0x11')]('/',auth[_0xe16e('0xa')](),controller[_0xe16e('0x12')]);router['put'](_0xe16e('0xd'),auth[_0xe16e('0xa')](),controller[_0xe16e('0x13')]);router[_0xe16e('0x14')](_0xe16e('0xd'),auth[_0xe16e('0xa')](),controller[_0xe16e('0x15')]);module[_0xe16e('0x16')]=router; \ No newline at end of file +var _0x1e92=['./trunk.controller','get','/:id','post','isAuthenticated','create','put','update','delete','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x1e92,0x16f));var _0x21e9=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x1e92[_0x2d34d6];return _0x1d3d12;};'use strict';var multer=require(_0x21e9('0x0'));var util=require('util');var path=require(_0x21e9('0x1'));var timeout=require(_0x21e9('0x2'));var express=require(_0x21e9('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x21e9('0x4'));var interaction=require(_0x21e9('0x5'));var config=require(_0x21e9('0x6'));var controller=require(_0x21e9('0x7'));router[_0x21e9('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x21e9('0x8')](_0x21e9('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x21e9('0xa')]('/:id/clone',auth[_0x21e9('0xb')](),controller['clone']);router[_0x21e9('0xa')]('/',auth[_0x21e9('0xb')](),controller[_0x21e9('0xc')]);router[_0x21e9('0xd')](_0x21e9('0x9'),auth[_0x21e9('0xb')](),controller[_0x21e9('0xe')]);router[_0x21e9('0xf')](_0x21e9('0x9'),auth['isAuthenticated'](),controller[_0x21e9('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index b465ab8..abf372a 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 _0xc998=['PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','nonat','update','force_rport,comedia','setDataValue','join','nat','split','all','allow','ulaw;alaw;gsm','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','exports','STRING','name','ENUM','friend','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED'];(function(_0x11b3c2,_0x49be61){var _0x3c2081=function(_0x3d96d9){while(--_0x3d96d9){_0x11b3c2['push'](_0x11b3c2['shift']());}};_0x3c2081(++_0x49be61);}(_0xc998,0x18f));var _0x8c99=function(_0x58c54d,_0x529682){_0x58c54d=_0x58c54d-0x0;var _0x112eaa=_0xc998[_0x58c54d];return _0x112eaa;};'use strict';var Sequelize=require('sequelize');module[_0x8c99('0x0')]={'name':{'type':Sequelize[_0x8c99('0x1')],'allowNull':![],'unique':_0x8c99('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8c99('0x3')]('friend','user','peer'),'allowNull':![],'defaultValue':_0x8c99('0x4')},'context':{'type':Sequelize[_0x8c99('0x1')],'allowNull':![],'defaultValue':_0x8c99('0x5')},'callingpres':{'type':Sequelize[_0x8c99('0x3')]('ALLOWED_NOT_SCREENED',_0x8c99('0x6'),'ALLOWED_FAILED_SCREEN',_0x8c99('0x7'),_0x8c99('0x8'),_0x8c99('0x9'),_0x8c99('0xa'),_0x8c99('0xb'))},'deny':{'type':Sequelize[_0x8c99('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x8c99('0x1')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x8c99('0x1')],'defaultValue':_0x8c99('0xc'),'set':function(_0x2c5b24){this['setDataValue'](_0x8c99('0xd'),_0x2c5b24?_0x2c5b24['join'](','):null);},'get':function(){return this[_0x8c99('0xe')](_0x8c99('0xd'))?this[_0x8c99('0xe')](_0x8c99('0xd'))['split'](','):null;},'comment':_0x8c99('0xf')},'dtmfmode':{'type':Sequelize[_0x8c99('0x3')](_0x8c99('0x10'),'info',_0x8c99('0x11'),_0x8c99('0x12'),_0x8c99('0x13')),'defaultValue':_0x8c99('0x10')},'directmedia':{'type':Sequelize[_0x8c99('0x3')](_0x8c99('0x14'),'no',_0x8c99('0x15'),_0x8c99('0x16'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x8c99('0x14'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x8c99('0x1')]},'directmediadeny':{'type':Sequelize[_0x8c99('0x1')]},'nat':{'type':Sequelize[_0x8c99('0x1')],'defaultValue':_0x8c99('0x17'),'set':function(_0x36612f){this[_0x8c99('0x18')]('nat',_0x36612f?_0x36612f[_0x8c99('0x19')](','):null);},'get':function(){return this['getDataValue']('nat')?this['getDataValue'](_0x8c99('0x1a'))[_0x8c99('0x1b')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x8c99('0x1')]},'pickupgroup':{'type':Sequelize[_0x8c99('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x8c99('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x8c99('0x1c')},'allow':{'type':Sequelize[_0x8c99('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x352e4a){this[_0x8c99('0x18')](_0x8c99('0x1d'),_0x352e4a?_0x352e4a[_0x8c99('0x19')](';'):_0x8c99('0x1e'));},'get':function(){return this[_0x8c99('0xe')]('allow')?this[_0x8c99('0xe')](_0x8c99('0x1d'))[_0x8c99('0x1b')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x8c99('0x3')](_0x8c99('0x14'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x8c99('0x1f'),'set':function(_0x2e6f66){this['setDataValue'](_0x8c99('0x20'),_0x2e6f66?_0x2e6f66['join'](','):null);},'get':function(){return this[_0x8c99('0xe')](_0x8c99('0x20'))?this[_0x8c99('0xe')](_0x8c99('0x20'))[_0x8c99('0x1b')](','):null;},'comment':_0x8c99('0x21')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x8c99('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x8c99('0x3')](_0x8c99('0x14'),'no',_0x8c99('0x22'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0x8c99('0x14'),'no')},'accountcode':{'type':Sequelize[_0x8c99('0x23')](0xb)},'setvar':{'type':Sequelize[_0x8c99('0x1')]},'callerid':{'type':Sequelize[_0x8c99('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x8c99('0x1')]},'callcounter':{'type':Sequelize[_0x8c99('0x3')](_0x8c99('0x14'),'no'),'defaultValue':_0x8c99('0x14')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x8c99('0x3')](_0x8c99('0x14'),'no')},'allowsubscribe':{'type':Sequelize[_0x8c99('0x3')](_0x8c99('0x14'),'no')},'allowtransfer':{'type':Sequelize[_0x8c99('0x3')](_0x8c99('0x14'),'no')},'ignoresdpversion':{'type':Sequelize[_0x8c99('0x3')](_0x8c99('0x14'),'no')},'subscribecontext':{'type':Sequelize[_0x8c99('0x1')]},'template':{'type':Sequelize[_0x8c99('0x1')]},'videosupport':{'type':Sequelize[_0x8c99('0x3')](_0x8c99('0x14'),'no',_0x8c99('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x8c99('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x8c99('0x14'),'no')},'mailbox':{'type':Sequelize[_0x8c99('0x1')]},'session_timers':{'type':Sequelize[_0x8c99('0x3')](_0x8c99('0x25'),_0x8c99('0x26'),_0x8c99('0x27'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x8c99('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0x8c99('0x3')](_0x8c99('0x28'),'uas'),'defaultValue':_0x8c99('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0x8c99('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x8c99('0x23')](0x5)},'qualify':{'type':Sequelize[_0x8c99('0x3')]('yes','no'),'defaultValue':_0x8c99('0x14')},'keepalive':{'type':Sequelize[_0x8c99('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x8c99('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x8c99('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x8c99('0x3')](_0x8c99('0x14'),'no',_0x8c99('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x8c99('0x1')]},'callbackextension':{'type':Sequelize[_0x8c99('0x1')]},'timert1':{'type':Sequelize[_0x8c99('0x23')](0xb)},'timerb':{'type':Sequelize[_0x8c99('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x8c99('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x8c99('0x1')]},'contactdeny':{'type':Sequelize[_0x8c99('0x1')]},'contactacl':{'type':Sequelize[_0x8c99('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x8c99('0x1')]},'use_q850_reason':{'type':Sequelize[_0x8c99('0x1')]},'maxforwards':{'type':Sequelize[_0x8c99('0x23')](0xb)},'encryption':{'type':Sequelize[_0x8c99('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x8c99('0x3')](_0x8c99('0x14'),'no')},'force_avp':{'type':Sequelize[_0x8c99('0x3')]('yes','no')},'icesupport':{'type':Sequelize[_0x8c99('0x3')](_0x8c99('0x14'),'no')},'dtlsenable':{'type':Sequelize[_0x8c99('0x3')](_0x8c99('0x14'),'no')},'dtlsverify':{'type':Sequelize[_0x8c99('0x3')](_0x8c99('0x14'),'no',_0x8c99('0x2b'),_0x8c99('0x2c'))},'dtlsrekey':{'type':Sequelize[_0x8c99('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0x8c99('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x8c99('0x1')]},'dtlscapath':{'type':Sequelize[_0x8c99('0x1')]},'dtlssetup':{'type':Sequelize[_0x8c99('0x3')](_0x8c99('0x2d'),_0x8c99('0x2e'),_0x8c99('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x8c99('0x1')]},'usereqphone':{'type':Sequelize[_0x8c99('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x8c99('0x1')]},'call_limit':{'type':Sequelize[_0x8c99('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x8c99('0x14'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x8c99('0x14'),'no')},'vmexten':{'type':Sequelize[_0x8c99('0x1')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x8c99('0x1')]},'description':{'type':Sequelize[_0x8c99('0x1')]},'host':{'type':Sequelize[_0x8c99('0x1')],'defaultValue':_0x8c99('0x30')},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0x8c99('0x15'),'update',_0x8c99('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x8c99('0x1')]},'otherFields':{'type':Sequelize[_0x8c99('0x1')]},'active':{'type':Sequelize[_0x8c99('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x13b5=['STRING','ENUM','friend','user','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB','udp','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','nonat','update','outgoing','nat','join','all','ulaw;alaw;gsm','setDataValue','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','accept','refuse','uas','fingerprint','certificate','active','passive','actpass','sequelize','exports'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0x13b5,0x1b6));var _0x513b=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x13b5[_0x36c5b0];return _0xf19333;};'use strict';var Sequelize=require(_0x513b('0x0'));module[_0x513b('0x1')]={'name':{'type':Sequelize[_0x513b('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x513b('0x3')](_0x513b('0x4'),_0x513b('0x5'),'peer'),'allowNull':![],'defaultValue':_0x513b('0x4')},'context':{'type':Sequelize[_0x513b('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x513b('0x3')](_0x513b('0x6'),_0x513b('0x7'),'ALLOWED_FAILED_SCREEN',_0x513b('0x8'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0x513b('0x9'))},'deny':{'type':Sequelize[_0x513b('0x2')]},'permit':{'type':Sequelize[_0x513b('0x2')]},'secret':{'type':Sequelize[_0x513b('0x2')]},'md5secret':{'type':Sequelize[_0x513b('0x2')]},'remotesecret':{'type':Sequelize[_0x513b('0x2')]},'transport':{'type':Sequelize[_0x513b('0x2')],'defaultValue':_0x513b('0xa'),'set':function(_0x1362bb){this['setDataValue'](_0x513b('0xb'),_0x1362bb?_0x1362bb['join'](','):null);},'get':function(){return this['getDataValue'](_0x513b('0xb'))?this[_0x513b('0xc')](_0x513b('0xb'))[_0x513b('0xd')](','):null;},'comment':_0x513b('0xe')},'dtmfmode':{'type':Sequelize[_0x513b('0x3')](_0x513b('0xf'),_0x513b('0x10'),_0x513b('0x11'),_0x513b('0x12'),'auto'),'defaultValue':_0x513b('0xf')},'directmedia':{'type':Sequelize[_0x513b('0x3')](_0x513b('0x13'),'no',_0x513b('0x14'),_0x513b('0x15'),_0x513b('0x16')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x513b('0x3')](_0x513b('0x13'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x513b('0x2')]},'nat':{'type':Sequelize[_0x513b('0x2')],'defaultValue':'force_rport,comedia','set':function(_0x4d87a9){this['setDataValue'](_0x513b('0x17'),_0x4d87a9?_0x4d87a9[_0x513b('0x18')](','):null);},'get':function(){return this[_0x513b('0xc')](_0x513b('0x17'))?this[_0x513b('0xc')]('nat')[_0x513b('0xd')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x513b('0x2')]},'namedcallgroup':{'type':Sequelize[_0x513b('0x2')]},'pickupgroup':{'type':Sequelize[_0x513b('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x513b('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x513b('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x513b('0x2')],'defaultValue':_0x513b('0x19')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x513b('0x1a'),'set':function(_0x38178f){this[_0x513b('0x1b')](_0x513b('0x1c'),_0x38178f?_0x38178f[_0x513b('0x18')](';'):_0x513b('0x1a'));},'get':function(){return this[_0x513b('0xc')](_0x513b('0x1c'))?this['getDataValue'](_0x513b('0x1c'))[_0x513b('0xd')](';'):null;},'comment':_0x513b('0x1d')},'autoframing':{'type':Sequelize[_0x513b('0x3')](_0x513b('0x13'),'no')},'insecure':{'type':Sequelize[_0x513b('0x2')],'defaultValue':_0x513b('0x1e'),'set':function(_0x44989c){this['setDataValue'](_0x513b('0x1f'),_0x44989c?_0x44989c[_0x513b('0x18')](','):null);},'get':function(){return this[_0x513b('0xc')](_0x513b('0x1f'))?this[_0x513b('0xc')](_0x513b('0x1f'))[_0x513b('0xd')](','):null;},'comment':_0x513b('0x20')},'trustrpid':{'type':Sequelize[_0x513b('0x3')](_0x513b('0x13'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x513b('0x3')](_0x513b('0x13'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x513b('0x3')](_0x513b('0x13'),'no',_0x513b('0x21'))},'promiscredir':{'type':Sequelize[_0x513b('0x3')]('yes','no')},'useclientcode':{'type':Sequelize[_0x513b('0x3')](_0x513b('0x13'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x513b('0x2')]},'callerid':{'type':Sequelize[_0x513b('0x2')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x513b('0x3')](_0x513b('0x13'),'no'),'defaultValue':_0x513b('0x13')},'busylevel':{'type':Sequelize[_0x513b('0x22')](0xb)},'allowoverlap':{'type':Sequelize[_0x513b('0x3')](_0x513b('0x13'),'no')},'allowsubscribe':{'type':Sequelize[_0x513b('0x3')](_0x513b('0x13'),'no')},'allowtransfer':{'type':Sequelize[_0x513b('0x3')](_0x513b('0x13'),'no')},'ignoresdpversion':{'type':Sequelize[_0x513b('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x513b('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x513b('0x3')](_0x513b('0x13'),'no',_0x513b('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x513b('0x3')](_0x513b('0x13'),'no')},'mailbox':{'type':Sequelize[_0x513b('0x2')]},'session_timers':{'type':Sequelize[_0x513b('0x3')](_0x513b('0x24'),_0x513b('0x25'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x513b('0x22')](0xb)},'session_refresher':{'type':Sequelize[_0x513b('0x3')]('uac',_0x513b('0x26')),'defaultValue':_0x513b('0x26')},'t38pt_usertpsource':{'type':Sequelize[_0x513b('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x513b('0x2')]},'fromuser':{'type':Sequelize[_0x513b('0x2')]},'port':{'type':Sequelize[_0x513b('0x22')](0x5)},'qualify':{'type':Sequelize[_0x513b('0x3')](_0x513b('0x13'),'no'),'defaultValue':_0x513b('0x13')},'keepalive':{'type':Sequelize[_0x513b('0x22')](0xb)},'defaultip':{'type':Sequelize[_0x513b('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x513b('0x22')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x513b('0x22')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x513b('0x13'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x513b('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x513b('0x22')](0xb)},'timerb':{'type':Sequelize[_0x513b('0x22')](0xb)},'qualifyfreq':{'type':Sequelize[_0x513b('0x22')](0xb)},'contactpermit':{'type':Sequelize[_0x513b('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x513b('0x2')]},'use_q850_reason':{'type':Sequelize[_0x513b('0x2')]},'maxforwards':{'type':Sequelize[_0x513b('0x22')](0xb)},'encryption':{'type':Sequelize[_0x513b('0x3')](_0x513b('0x13'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x513b('0x3')]('yes','no')},'force_avp':{'type':Sequelize['ENUM']('yes','no')},'icesupport':{'type':Sequelize[_0x513b('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x513b('0x3')](_0x513b('0x13'),'no')},'dtlsverify':{'type':Sequelize[_0x513b('0x3')](_0x513b('0x13'),'no',_0x513b('0x27'),_0x513b('0x28'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x513b('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x513b('0x2')]},'dtlscafile':{'type':Sequelize[_0x513b('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize['ENUM'](_0x513b('0x29'),_0x513b('0x2a'),_0x513b('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x513b('0x2')]},'usereqphone':{'type':Sequelize[_0x513b('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x513b('0x2')]},'recordofffeature':{'type':Sequelize[_0x513b('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x513b('0x3')](_0x513b('0x13'),'no')},'subscribemwi':{'type':Sequelize[_0x513b('0x3')](_0x513b('0x13'),'no')},'vmexten':{'type':Sequelize[_0x513b('0x2')]},'mohinterpret':{'type':Sequelize[_0x513b('0x2')]},'mohsuggest':{'type':Sequelize[_0x513b('0x2')]},'parkinglot':{'type':Sequelize[_0x513b('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x513b('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x513b('0x3')](_0x513b('0x13'),'no','nonat',_0x513b('0x15'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x513b('0x2')]},'otherFields':{'type':Sequelize[_0x513b('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 367fda7..55fffad 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 _0x6f0d=['server/files/templates/registry.ejs','utf8','render','writeFileSync','registry','Reload','chan_sip.so','user','UserProfileSection','autoAssociation','/etc/asterisk/sip_xcally_trunks.conf','/etc/asterisk/sip_xcally_registers.conf','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','get','Trunks','UserProfileResource','end','stack','name','send','index','map','Trunk','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','clone','rawAttributes','find','updatedAt','body','omit','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','server/files/templates/trunk.ejs','join'];(function(_0x5d71ad,_0x3da0e3){var _0x201da3=function(_0x432225){while(--_0x432225){_0x5d71ad['push'](_0x5d71ad['shift']());}};_0x201da3(++_0x3da0e3);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x1b300d,_0x510f37){_0x1b300d=_0x1b300d-0x0;var _0xa77f2e=_0x6f0d[_0x1b300d];return _0xa77f2e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd6f0('0x0'));var zipdir=require(_0xd6f0('0x1'));var jsonpatch=require(_0xd6f0('0x2'));var rp=require(_0xd6f0('0x3'));var moment=require('moment');var BPromise=require(_0xd6f0('0x4'));var Mustache=require(_0xd6f0('0x5'));var util=require(_0xd6f0('0x6'));var path=require(_0xd6f0('0x7'));var sox=require(_0xd6f0('0x8'));var csv=require('to-csv');var ejs=require(_0xd6f0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd6f0('0xa'));var squel=require(_0xd6f0('0xb'));var crypto=require(_0xd6f0('0xc'));var jsforce=require(_0xd6f0('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd6f0('0xe'));var Papa=require(_0xd6f0('0xf'));var Redis=require(_0xd6f0('0x10'));var authService=require(_0xd6f0('0x11'));var qs=require(_0xd6f0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6f0('0x13'));var logger=require(_0xd6f0('0x14'))(_0xd6f0('0x15'));var utils=require(_0xd6f0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd6f0('0x17'));var db=require(_0xd6f0('0x18'))['db'];var jayson=require(_0xd6f0('0x19'));var client=jayson[_0xd6f0('0x1a')][_0xd6f0('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x409549,_0x2bf5b8,_0x250999,_0x246dad){return new BPromise(function(_0x4ab979,_0x2b3f32){var _0x354846=_0x246dad||client;return _0x354846['request'](_0x409549,_0x250999)[_0xd6f0('0x1c')](function(_0x593abe){logger[_0xd6f0('0x1d')](_0xd6f0('0x1e'),_0x2bf5b8,_0xd6f0('0x1f'));logger[_0xd6f0('0x20')](_0xd6f0('0x21'),_0x2bf5b8,_0xd6f0('0x1f'),JSON[_0xd6f0('0x22')](_0x593abe));if(_0x593abe[_0xd6f0('0x23')]){if(_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x24')]===0x1f4){logger[_0xd6f0('0x23')](_0xd6f0('0x1e'),_0x2bf5b8,_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);return _0x2b3f32(_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x2bf5b8,_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);return _0x4ab979(_0x593abe[_0xd6f0('0x23')]['message']);}else{logger[_0xd6f0('0x1d')](_0xd6f0('0x1e'),_0x2bf5b8,'request\x20sent');_0x4ab979(_0x593abe[_0xd6f0('0x26')]['message']);}})[_0xd6f0('0x27')](function(_0x1c9d90){logger['error'](_0xd6f0('0x1e'),_0x2bf5b8,_0x1c9d90);_0x2b3f32(_0x1c9d90);});});}function respondWithStatusCode(_0x45e99c,_0x5ea2dd){_0x5ea2dd=_0x5ea2dd||0xcc;return function(_0x3dbdc3){if(_0x3dbdc3){return _0x45e99c[_0xd6f0('0x28')](_0x5ea2dd);}return _0x45e99c[_0xd6f0('0x29')](_0x5ea2dd)['end']();};}function respondWithResult(_0x2ca8bb,_0x3dc166){_0x3dc166=_0x3dc166||0xc8;return function(_0x5ecb16){if(_0x5ecb16){return _0x2ca8bb[_0xd6f0('0x29')](_0x3dc166)['json'](_0x5ecb16);}};}function respondWithFilteredResult(_0x2042d5,_0x3fb5c3){return function(_0x1630dc){if(_0x1630dc){var _0x3c1bff=typeof _0x3fb5c3[_0xd6f0('0x2a')]===_0xd6f0('0x2b')&&typeof _0x3fb5c3[_0xd6f0('0x2c')]===_0xd6f0('0x2b');var _0x48975d=_0x1630dc[_0xd6f0('0x2d')];var _0x1982d3=_0x3c1bff?0x0:_0x3fb5c3['offset'];var _0x38a3e9=_0x3c1bff?_0x1630dc[_0xd6f0('0x2d')]:_0x3fb5c3[_0xd6f0('0x2a')]+_0x3fb5c3[_0xd6f0('0x2c')];var _0x1a3967;if(_0x38a3e9>=_0x48975d){_0x38a3e9=_0x48975d;_0x1a3967=0xc8;}else{_0x1a3967=0xce;}_0x2042d5[_0xd6f0('0x29')](_0x1a3967);return _0x2042d5[_0xd6f0('0x2e')](_0xd6f0('0x2f'),_0x1982d3+'-'+_0x38a3e9+'/'+_0x48975d)[_0xd6f0('0x30')](_0x1630dc);}return null;};}function patchUpdates(_0x43f72f){return function(_0x1dff9b){try{jsonpatch[_0xd6f0('0x31')](_0x1dff9b,_0x43f72f,!![]);}catch(_0x348529){return BPromise[_0xd6f0('0x32')](_0x348529);}return _0x1dff9b[_0xd6f0('0x33')]();};}function saveUpdates(_0x2d7c90,_0x31c493){return function(_0x376890){if(_0x376890){return _0x376890[_0xd6f0('0x34')](_0x2d7c90)[_0xd6f0('0x1c')](function(_0x3906ca){return _0x3906ca;});}return null;};}function removeEntity(_0x26ab29,_0x4a8ebe){return function(_0x11124c){if(_0x11124c){return _0x11124c['destroy']()['then'](function(){var _0x43d588=_0x11124c[_0xd6f0('0x35')]({'plain':!![]});var _0x12a6fa=_0xd6f0('0x36');return db[_0xd6f0('0x37')]['destroy']({'where':{'type':_0x12a6fa,'resourceId':_0x43d588['id']}})[_0xd6f0('0x1c')](function(){return _0x11124c;});})['then'](function(){_0x26ab29[_0xd6f0('0x29')](0xcc)[_0xd6f0('0x38')]();});}};}function handleEntityNotFound(_0x42c01a,_0x1eecf0){return function(_0x518751){if(!_0x518751){_0x42c01a['sendStatus'](0x194);}return _0x518751;};}function handleError(_0x47b33d,_0x3b6463){_0x3b6463=_0x3b6463||0x1f4;return function(_0xe2958d){logger['error'](_0xe2958d[_0xd6f0('0x39')]);if(_0xe2958d['name']){delete _0xe2958d[_0xd6f0('0x3a')];}_0x47b33d[_0xd6f0('0x29')](_0x3b6463)[_0xd6f0('0x3b')](_0xe2958d);};}exports[_0xd6f0('0x3c')]=function(_0x451834,_0x3d1280){var _0x6b44fa={},_0x4fd4db={},_0x52203d={'count':0x0,'rows':[]};var _0x162537=_[_0xd6f0('0x3d')](db[_0xd6f0('0x3e')]['rawAttributes'],function(_0x59f905){return{'name':_0x59f905[_0xd6f0('0x3f')],'type':_0x59f905[_0xd6f0('0x40')][_0xd6f0('0x41')]};});_0x4fd4db[_0xd6f0('0x42')]=_[_0xd6f0('0x3d')](_0x162537,_0xd6f0('0x3a'));_0x4fd4db[_0xd6f0('0x43')]=_[_0xd6f0('0x44')](_0x451834['query']);_0x4fd4db[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0x4fd4db[_0xd6f0('0x42')],_0x4fd4db[_0xd6f0('0x43')]);_0x6b44fa['attributes']=_[_0xd6f0('0x46')](_0x4fd4db[_0xd6f0('0x42')],qs[_0xd6f0('0x47')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x6b44fa['attributes']=_0x6b44fa[_0xd6f0('0x48')][_0xd6f0('0x49')]?_0x6b44fa[_0xd6f0('0x48')]:_0x4fd4db['model'];if(!_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4a')]('nolimit')){_0x6b44fa['limit']=qs[_0xd6f0('0x2c')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x2c')]);_0x6b44fa['offset']=qs[_0xd6f0('0x2a')](_0x451834[_0xd6f0('0x43')]['offset']);}_0x6b44fa[_0xd6f0('0x4b')]=qs[_0xd6f0('0x4c')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4c')]);_0x6b44fa['where']=qs[_0xd6f0('0x45')](_[_0xd6f0('0x4d')](_0x451834[_0xd6f0('0x43')],_0x4fd4db[_0xd6f0('0x45')]),_0x162537);if(_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4e')]){_0x6b44fa[_0xd6f0('0x4f')]=_[_0xd6f0('0x50')](_0x6b44fa['where'],{'$or':_[_0xd6f0('0x3d')](_0x162537,function(_0x3d42ca){if(_0x3d42ca['type']!==_0xd6f0('0x51')){var _0x39ca69={};_0x39ca69[_0x3d42ca[_0xd6f0('0x3a')]]={'$like':'%'+_0x451834[_0xd6f0('0x43')]['filter']+'%'};return _0x39ca69;}})});}_0x6b44fa=_[_0xd6f0('0x50')]({},_0x6b44fa,_0x451834[_0xd6f0('0x52')]);var _0x494542={'where':_0x6b44fa['where']};return db[_0xd6f0('0x3e')]['count'](_0x494542)[_0xd6f0('0x1c')](function(_0x61b354){_0x52203d[_0xd6f0('0x2d')]=_0x61b354;if(_0x451834['query'][_0xd6f0('0x53')]){_0x6b44fa[_0xd6f0('0x54')]=[{'all':!![]}];}return db[_0xd6f0('0x3e')][_0xd6f0('0x55')](_0x6b44fa);})[_0xd6f0('0x1c')](function(_0x4c42ce){_0x52203d[_0xd6f0('0x56')]=_0x4c42ce;return _0x52203d;})['then'](respondWithFilteredResult(_0x3d1280,_0x6b44fa))[_0xd6f0('0x27')](handleError(_0x3d1280,null));};exports[_0xd6f0('0x57')]=function(_0x2eb338,_0x1dc320){var _0x554e37={'raw':![],'where':{'id':_0x2eb338[_0xd6f0('0x58')]['id']}},_0x5ceb6b={};_0x5ceb6b[_0xd6f0('0x42')]=_['keys'](db[_0xd6f0('0x3e')]['rawAttributes']);_0x5ceb6b[_0xd6f0('0x43')]=_[_0xd6f0('0x44')](_0x2eb338[_0xd6f0('0x43')]);_0x5ceb6b[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0x5ceb6b['model'],_0x5ceb6b[_0xd6f0('0x43')]);_0x554e37[_0xd6f0('0x48')]=_[_0xd6f0('0x46')](_0x5ceb6b[_0xd6f0('0x42')],qs[_0xd6f0('0x47')](_0x2eb338[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x554e37[_0xd6f0('0x48')]=_0x554e37['attributes'][_0xd6f0('0x49')]?_0x554e37[_0xd6f0('0x48')]:_0x5ceb6b[_0xd6f0('0x42')];if(_0x2eb338[_0xd6f0('0x43')][_0xd6f0('0x53')]){_0x554e37[_0xd6f0('0x54')]=[{'all':!![]}];}_0x554e37=_[_0xd6f0('0x50')]({},_0x554e37,_0x2eb338[_0xd6f0('0x52')]);return db[_0xd6f0('0x3e')]['find'](_0x554e37)[_0xd6f0('0x1c')](handleEntityNotFound(_0x1dc320,null))['then'](respondWithResult(_0x1dc320,null))['catch'](handleError(_0x1dc320,null));};exports[_0xd6f0('0x59')]=function(_0x55fd25,_0x539ef1){var _0x28c3c4={'where':{'id':_0x55fd25[_0xd6f0('0x58')]['id']}},_0x2d39a2={};_0x2d39a2['model']=_[_0xd6f0('0x44')](db[_0xd6f0('0x3e')][_0xd6f0('0x5a')]);_0x28c3c4['attributes']=_[_0xd6f0('0x46')](_0x2d39a2[_0xd6f0('0x42')],qs['fields'](_0x55fd25[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x28c3c4['attributes']=_0x28c3c4[_0xd6f0('0x48')][_0xd6f0('0x49')]?_0x28c3c4[_0xd6f0('0x48')]:_0x2d39a2[_0xd6f0('0x42')];if(_0x55fd25[_0xd6f0('0x43')]['includeAll']){_0x28c3c4[_0xd6f0('0x54')]=[{'all':!![]}];}_0x28c3c4=_[_0xd6f0('0x50')]({},_0x28c3c4,_0x55fd25['options']);return db[_0xd6f0('0x3e')][_0xd6f0('0x5b')](_0x28c3c4)[_0xd6f0('0x1c')](handleEntityNotFound(_0x539ef1,null))['then'](function(_0x229f19){if(_0x229f19){var _0x5d75fa=_0x229f19['get']({'plain':!![]});_0x5d75fa=qs['omit'](_0x5d75fa,['id','createdAt',_0xd6f0('0x5c')]);_0x55fd25[_0xd6f0('0x5d')]=_[_0xd6f0('0x5e')](_0x55fd25[_0xd6f0('0x5d')],['id','createdAt',_0xd6f0('0x5c')]);return db['Trunk'][_0xd6f0('0x5f')](_[_0xd6f0('0x50')](_0x5d75fa,_0x55fd25[_0xd6f0('0x5d')]),{'include':_0x55fd25['query'][_0xd6f0('0x53')]?[{'all':!![]}]:undefined})[_0xd6f0('0x1c')](function(_0x269dd7){var _0x705eb=_0x55fd25['user'][_0xd6f0('0x35')]({'plain':!![]});if(!_0x705eb)throw new Error(_0xd6f0('0x60'));if(_0x705eb[_0xd6f0('0x61')]==='user'){var _0x5bc4e7=_0x269dd7[_0xd6f0('0x35')]({'plain':!![]});var _0x1fee47=_0xd6f0('0x36');return db['UserProfileSection'][_0xd6f0('0x5b')]({'where':{'name':_0x1fee47,'userProfileId':_0x705eb[_0xd6f0('0x62')]},'raw':!![]})[_0xd6f0('0x1c')](function(_0x282e9b){if(_0x282e9b&&_0x282e9b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5bc4e7['name'],'resourceId':_0x5bc4e7['id'],'type':_0x282e9b[_0xd6f0('0x3a')],'sectionId':_0x282e9b['id']},{})[_0xd6f0('0x1c')](function(){return _0x269dd7;});}else{return _0x269dd7;}})[_0xd6f0('0x27')](function(_0x30cd81){logger[_0xd6f0('0x23')](_0xd6f0('0x63'),_0x30cd81);throw _0x30cd81;});}return _0x269dd7;});}})[_0xd6f0('0x1c')](respondWithResult(_0x539ef1,0xc9))[_0xd6f0('0x27')](handleError(_0x539ef1,null));};exports[_0xd6f0('0x5f')]=function(_0x5ad146,_0x55f96e,_0x1b9728){var _0x5af4f6;return db[_0xd6f0('0x3e')][_0xd6f0('0x5f')](_0x5ad146[_0xd6f0('0x5d')],{'raw':!![]})[_0xd6f0('0x1c')](function(_0x14384f){_0x5af4f6=_0x14384f;return db[_0xd6f0('0x3e')][_0xd6f0('0x55')]({'raw':!![]});})['then'](function(_0x3c8a3e){var _0x318a68=fs[_0xd6f0('0x64')](path['join'](config[_0xd6f0('0x65')],_0xd6f0('0x66')),'utf8');var _0xad50ac=fs[_0xd6f0('0x64')](path[_0xd6f0('0x67')](config[_0xd6f0('0x65')],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0x1c6140=ejs[_0xd6f0('0x6a')](_0x318a68,{'trunks':_0x3c8a3e||[]});fs[_0xd6f0('0x6b')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1c6140);if(_0x5af4f6[_0xd6f0('0x6c')]){var _0x205b6a=ejs[_0xd6f0('0x6a')](_0xad50ac,{'trunks':_0x3c8a3e||[]});fs[_0xd6f0('0x6b')]('/etc/asterisk/sip_xcally_registers.conf',_0x205b6a);}})[_0xd6f0('0x1c')](function(){return respondWithRpcPromise(_0xd6f0('0x6d'),_0xd6f0('0x5f'),{'module':_0xd6f0('0x6e')});})[_0xd6f0('0x1c')](function(){var _0x12e0e5=_0x5ad146[_0xd6f0('0x6f')][_0xd6f0('0x35')]({'plain':!![]});if(!_0x12e0e5)throw new Error(_0xd6f0('0x60'));if(_0x12e0e5[_0xd6f0('0x61')]==='user'){var _0x440d5c=_0x5af4f6[_0xd6f0('0x35')]({'plain':!![]});return db[_0xd6f0('0x70')]['find']({'where':{'name':_0xd6f0('0x36'),'userProfileId':_0x12e0e5[_0xd6f0('0x62')]},'raw':!![]})[_0xd6f0('0x1c')](function(_0x406bc7){if(_0x406bc7&&_0x406bc7[_0xd6f0('0x71')]===0x0){return db[_0xd6f0('0x37')][_0xd6f0('0x5f')]({'name':_0x440d5c[_0xd6f0('0x3a')],'resourceId':_0x440d5c['id'],'type':_0x406bc7[_0xd6f0('0x3a')],'sectionId':_0x406bc7['id']},{})[_0xd6f0('0x1c')](function(){return _0x5af4f6;});}else{return _0x5af4f6;}})[_0xd6f0('0x27')](function(_0x5b3155){logger['error'](_0xd6f0('0x63'),_0x5b3155);throw _0x5b3155;});}return _0x5af4f6;})[_0xd6f0('0x1c')](respondWithResult(_0x55f96e,0xc9))[_0xd6f0('0x27')](handleError(_0x55f96e,null));};exports[_0xd6f0('0x34')]=function(_0x1da442,_0x5a781b,_0x15143a){var _0x2d38e6;return db['Trunk'][_0xd6f0('0x5b')]({'where':{'id':_0x1da442['params']['id']}})[_0xd6f0('0x1c')](handleEntityNotFound(_0x5a781b,null))[_0xd6f0('0x1c')](saveUpdates(_0x1da442[_0xd6f0('0x5d')],null))[_0xd6f0('0x1c')](function(_0x391c2a){if(_0x391c2a){_0x2d38e6=_0x391c2a;return db['Trunk']['findAll']({'raw':!![]});}})[_0xd6f0('0x1c')](function(_0x17b320){if(_0x17b320){var _0x484124=fs[_0xd6f0('0x64')](path['join'](config['root'],_0xd6f0('0x66')),'utf8');var _0x5dc1c7=fs['readFileSync'](path['join'](config[_0xd6f0('0x65')],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0xcfed18=ejs[_0xd6f0('0x6a')](_0x484124,{'trunks':_0x17b320||[]});fs[_0xd6f0('0x6b')](_0xd6f0('0x72'),_0xcfed18);var _0x381f88=ejs[_0xd6f0('0x6a')](_0x5dc1c7,{'trunks':_0x17b320||[]});fs['writeFileSync'](_0xd6f0('0x73'),_0x381f88);return respondWithRpcPromise('Reload','update',{'module':_0xd6f0('0x6e')});}return null;})[_0xd6f0('0x1c')](function(_0x397f2c){if(_0x397f2c){return _0x2d38e6;}})['then'](respondWithResult(_0x5a781b,null))[_0xd6f0('0x27')](handleError(_0x5a781b,null));};exports[_0xd6f0('0x74')]=function(_0xc0585c,_0xf7ade1,_0x41e738){var _0x202e37;return db[_0xd6f0('0x3e')][_0xd6f0('0x5b')]({'where':{'id':_0xc0585c['params']['id']}})[_0xd6f0('0x1c')](handleEntityNotFound(_0xf7ade1,null))[_0xd6f0('0x1c')](removeEntity(_0xf7ade1,null))['then'](function(){return db[_0xd6f0('0x3e')][_0xd6f0('0x55')]({'raw':!![]});})[_0xd6f0('0x1c')](function(_0x175ba6){var _0x403698=fs[_0xd6f0('0x64')](path[_0xd6f0('0x67')](config['root'],_0xd6f0('0x66')),_0xd6f0('0x69'));var _0x5c3659=fs['readFileSync'](path['join'](config['root'],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0x2fdd59=ejs[_0xd6f0('0x6a')](_0x403698,{'trunks':_0x175ba6});var _0x427b95=ejs[_0xd6f0('0x6a')](_0x5c3659,{'trunks':_0x175ba6});fs['writeFileSync'](_0xd6f0('0x72'),_0x2fdd59);fs[_0xd6f0('0x6b')](_0xd6f0('0x73'),_0x427b95);return respondWithRpcPromise(_0xd6f0('0x6d'),'destroy',{'module':_0xd6f0('0x6e')});})['catch'](handleError(_0xf7ade1,null));}; \ No newline at end of file +var _0x98a8=['../../mysqldb','jayson/promise','client','request','Trunk,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','Trunks','UserProfileResource','stack','name','map','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Trunk','include','show','params','keys','rawAttributes','includeAll','clone','find','createdAt','updatedAt','body','omit','create','user','role','UserProfileSection','userProfileId','autoAssociation','findAll','readFileSync','root','server/files/templates/trunk.ejs','join','server/files/templates/registry.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x27adf1,_0x217f7f){var _0x292327=function(_0x2a3755){while(--_0x2a3755){_0x27adf1['push'](_0x27adf1['shift']());}};_0x292327(++_0x217f7f);}(_0x98a8,0x12c));var _0x898a=function(_0x20ec60,_0x1b2710){_0x20ec60=_0x20ec60-0x0;var _0x105ec1=_0x98a8[_0x20ec60];return _0x105ec1;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];var jayson=require(_0x898a('0x19'));var client=jayson[_0x898a('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bfded,_0x5b5c9c,_0x373d53,_0x1f5be4){return new BPromise(function(_0xb24335,_0x116fbe){var _0x1873e9=_0x1f5be4||client;return _0x1873e9[_0x898a('0x1b')](_0x5bfded,_0x373d53)['then'](function(_0x47033c){logger['info'](_0x898a('0x1c'),_0x5b5c9c,'request\x20sent');logger[_0x898a('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x5b5c9c,_0x898a('0x1e'),JSON['stringify'](_0x47033c));if(_0x47033c[_0x898a('0x1f')]){if(_0x47033c[_0x898a('0x1f')][_0x898a('0x20')]===0x1f4){logger['error'](_0x898a('0x1c'),_0x5b5c9c,_0x47033c['error']['message']);return _0x116fbe(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5b5c9c,_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);return _0xb24335(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}else{logger[_0x898a('0x22')](_0x898a('0x1c'),_0x5b5c9c,_0x898a('0x1e'));_0xb24335(_0x47033c['result'][_0x898a('0x21')]);}})[_0x898a('0x23')](function(_0x11cae2){logger[_0x898a('0x1f')](_0x898a('0x1c'),_0x5b5c9c,_0x11cae2);_0x116fbe(_0x11cae2);});});}function respondWithStatusCode(_0x310bfa,_0x4e254d){_0x4e254d=_0x4e254d||0xcc;return function(_0x274cdf){if(_0x274cdf){return _0x310bfa[_0x898a('0x24')](_0x4e254d);}return _0x310bfa[_0x898a('0x25')](_0x4e254d)[_0x898a('0x26')]();};}function respondWithResult(_0x3901ab,_0x1426e3){_0x1426e3=_0x1426e3||0xc8;return function(_0x5b7719){if(_0x5b7719){return _0x3901ab[_0x898a('0x25')](_0x1426e3)['json'](_0x5b7719);}};}function respondWithFilteredResult(_0x513c6b,_0x53ddb2){return function(_0x3678be){if(_0x3678be){var _0x1f4d86=typeof _0x53ddb2[_0x898a('0x27')]===_0x898a('0x28')&&typeof _0x53ddb2[_0x898a('0x29')]===_0x898a('0x28');var _0x398e98=_0x3678be[_0x898a('0x2a')];var _0xd31922=_0x1f4d86?0x0:_0x53ddb2['offset'];var _0x4b3e68=_0x1f4d86?_0x3678be['count']:_0x53ddb2[_0x898a('0x27')]+_0x53ddb2[_0x898a('0x29')];var _0x3b7704;if(_0x4b3e68>=_0x398e98){_0x4b3e68=_0x398e98;_0x3b7704=0xc8;}else{_0x3b7704=0xce;}_0x513c6b[_0x898a('0x25')](_0x3b7704);return _0x513c6b[_0x898a('0x2b')](_0x898a('0x2c'),_0xd31922+'-'+_0x4b3e68+'/'+_0x398e98)[_0x898a('0x2d')](_0x3678be);}return null;};}function patchUpdates(_0xf74645){return function(_0x18773a){try{jsonpatch[_0x898a('0x2e')](_0x18773a,_0xf74645,!![]);}catch(_0x44c5d2){return BPromise[_0x898a('0x2f')](_0x44c5d2);}return _0x18773a['save']();};}function saveUpdates(_0x7a1eb5,_0x17a5f3){return function(_0x26eead){if(_0x26eead){return _0x26eead[_0x898a('0x30')](_0x7a1eb5)[_0x898a('0x31')](function(_0x47af5b){return _0x47af5b;});}return null;};}function removeEntity(_0x48cefb,_0x20a3fe){return function(_0x1e2fd4){if(_0x1e2fd4){return _0x1e2fd4[_0x898a('0x32')]()['then'](function(){var _0x105477=_0x1e2fd4[_0x898a('0x33')]({'plain':!![]});var _0x5eafc7=_0x898a('0x34');return db[_0x898a('0x35')][_0x898a('0x32')]({'where':{'type':_0x5eafc7,'resourceId':_0x105477['id']}})[_0x898a('0x31')](function(){return _0x1e2fd4;});})[_0x898a('0x31')](function(){_0x48cefb['status'](0xcc)[_0x898a('0x26')]();});}};}function handleEntityNotFound(_0x5baf5b,_0x573eb3){return function(_0x14e2dc){if(!_0x14e2dc){_0x5baf5b['sendStatus'](0x194);}return _0x14e2dc;};}function handleError(_0x3c9588,_0x4b3aac){_0x4b3aac=_0x4b3aac||0x1f4;return function(_0x37cb11){logger['error'](_0x37cb11[_0x898a('0x36')]);if(_0x37cb11[_0x898a('0x37')]){delete _0x37cb11[_0x898a('0x37')];}_0x3c9588['status'](_0x4b3aac)['send'](_0x37cb11);};}exports['index']=function(_0x1575d2,_0x429c32){var _0x5a228f={},_0xdd019d={},_0x3d3463={'count':0x0,'rows':[]};var _0xe84f7e=_[_0x898a('0x38')](db['Trunk']['rawAttributes'],function(_0x3aed01){return{'name':_0x3aed01[_0x898a('0x39')],'type':_0x3aed01['type']['key']};});_0xdd019d[_0x898a('0x3a')]=_[_0x898a('0x38')](_0xe84f7e,_0x898a('0x37'));_0xdd019d[_0x898a('0x3b')]=_['keys'](_0x1575d2[_0x898a('0x3b')]);_0xdd019d[_0x898a('0x3c')]=_['intersection'](_0xdd019d['model'],_0xdd019d['query']);_0x5a228f[_0x898a('0x3d')]=_[_0x898a('0x3e')](_0xdd019d[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x3f')]));_0x5a228f[_0x898a('0x3d')]=_0x5a228f[_0x898a('0x3d')][_0x898a('0x40')]?_0x5a228f[_0x898a('0x3d')]:_0xdd019d[_0x898a('0x3a')];if(!_0x1575d2[_0x898a('0x3b')][_0x898a('0x41')](_0x898a('0x42'))){_0x5a228f[_0x898a('0x29')]=qs['limit'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x29')]);_0x5a228f[_0x898a('0x27')]=qs['offset'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x27')]);}_0x5a228f[_0x898a('0x43')]=qs[_0x898a('0x44')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x44')]);_0x5a228f[_0x898a('0x45')]=qs[_0x898a('0x3c')](_['pick'](_0x1575d2[_0x898a('0x3b')],_0xdd019d[_0x898a('0x3c')]),_0xe84f7e);if(_0x1575d2[_0x898a('0x3b')][_0x898a('0x46')]){_0x5a228f['where']=_[_0x898a('0x47')](_0x5a228f[_0x898a('0x45')],{'$or':_['map'](_0xe84f7e,function(_0x241677){if(_0x241677['type']!==_0x898a('0x48')){var _0x5137c4={};_0x5137c4[_0x241677['name']]={'$like':'%'+_0x1575d2[_0x898a('0x3b')]['filter']+'%'};return _0x5137c4;}})});}_0x5a228f=_[_0x898a('0x47')]({},_0x5a228f,_0x1575d2[_0x898a('0x49')]);var _0x4d6ac0={'where':_0x5a228f[_0x898a('0x45')]};return db[_0x898a('0x4a')]['count'](_0x4d6ac0)[_0x898a('0x31')](function(_0x199437){_0x3d3463[_0x898a('0x2a')]=_0x199437;if(_0x1575d2[_0x898a('0x3b')]['includeAll']){_0x5a228f[_0x898a('0x4b')]=[{'all':!![]}];}return db[_0x898a('0x4a')]['findAll'](_0x5a228f);})[_0x898a('0x31')](function(_0x1d8c16){_0x3d3463['rows']=_0x1d8c16;return _0x3d3463;})[_0x898a('0x31')](respondWithFilteredResult(_0x429c32,_0x5a228f))['catch'](handleError(_0x429c32,null));};exports[_0x898a('0x4c')]=function(_0x41f291,_0x32ccb9){var _0x50f9e3={'raw':![],'where':{'id':_0x41f291[_0x898a('0x4d')]['id']}},_0x2f6cb3={};_0x2f6cb3[_0x898a('0x3a')]=_[_0x898a('0x4e')](db['Trunk'][_0x898a('0x4f')]);_0x2f6cb3['query']=_[_0x898a('0x4e')](_0x41f291[_0x898a('0x3b')]);_0x2f6cb3[_0x898a('0x3c')]=_['intersection'](_0x2f6cb3[_0x898a('0x3a')],_0x2f6cb3[_0x898a('0x3b')]);_0x50f9e3[_0x898a('0x3d')]=_['intersection'](_0x2f6cb3['model'],qs[_0x898a('0x3f')](_0x41f291[_0x898a('0x3b')][_0x898a('0x3f')]));_0x50f9e3[_0x898a('0x3d')]=_0x50f9e3[_0x898a('0x3d')][_0x898a('0x40')]?_0x50f9e3[_0x898a('0x3d')]:_0x2f6cb3[_0x898a('0x3a')];if(_0x41f291[_0x898a('0x3b')][_0x898a('0x50')]){_0x50f9e3[_0x898a('0x4b')]=[{'all':!![]}];}_0x50f9e3=_['merge']({},_0x50f9e3,_0x41f291[_0x898a('0x49')]);return db[_0x898a('0x4a')]['find'](_0x50f9e3)[_0x898a('0x31')](handleEntityNotFound(_0x32ccb9,null))['then'](respondWithResult(_0x32ccb9,null))['catch'](handleError(_0x32ccb9,null));};exports[_0x898a('0x51')]=function(_0x124f9b,_0x209529){var _0x5bfd61={'where':{'id':_0x124f9b[_0x898a('0x4d')]['id']}},_0x556fd8={};_0x556fd8[_0x898a('0x3a')]=_['keys'](db[_0x898a('0x4a')][_0x898a('0x4f')]);_0x5bfd61['attributes']=_[_0x898a('0x3e')](_0x556fd8[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x124f9b['query'][_0x898a('0x3f')]));_0x5bfd61[_0x898a('0x3d')]=_0x5bfd61[_0x898a('0x3d')][_0x898a('0x40')]?_0x5bfd61[_0x898a('0x3d')]:_0x556fd8[_0x898a('0x3a')];if(_0x124f9b['query'][_0x898a('0x50')]){_0x5bfd61['include']=[{'all':!![]}];}_0x5bfd61=_[_0x898a('0x47')]({},_0x5bfd61,_0x124f9b[_0x898a('0x49')]);return db[_0x898a('0x4a')][_0x898a('0x52')](_0x5bfd61)[_0x898a('0x31')](handleEntityNotFound(_0x209529,null))[_0x898a('0x31')](function(_0x2486a5){if(_0x2486a5){var _0x75ff57=_0x2486a5[_0x898a('0x33')]({'plain':!![]});_0x75ff57=qs['omit'](_0x75ff57,['id',_0x898a('0x53'),_0x898a('0x54')]);_0x124f9b[_0x898a('0x55')]=_[_0x898a('0x56')](_0x124f9b[_0x898a('0x55')],['id',_0x898a('0x53'),_0x898a('0x54')]);return db[_0x898a('0x4a')][_0x898a('0x57')](_[_0x898a('0x47')](_0x75ff57,_0x124f9b[_0x898a('0x55')]),{'include':_0x124f9b[_0x898a('0x3b')][_0x898a('0x50')]?[{'all':!![]}]:undefined})[_0x898a('0x31')](function(_0x22f9ba){var _0x5f42ae=_0x124f9b[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x5f42ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f42ae[_0x898a('0x59')]===_0x898a('0x58')){var _0x5f0944=_0x22f9ba[_0x898a('0x33')]({'plain':!![]});var _0x1daecd=_0x898a('0x34');return db[_0x898a('0x5a')]['find']({'where':{'name':_0x1daecd,'userProfileId':_0x5f42ae[_0x898a('0x5b')]},'raw':!![]})[_0x898a('0x31')](function(_0x137935){if(_0x137935&&_0x137935[_0x898a('0x5c')]===0x0){return db['UserProfileResource'][_0x898a('0x57')]({'name':_0x5f0944[_0x898a('0x37')],'resourceId':_0x5f0944['id'],'type':_0x137935['name'],'sectionId':_0x137935['id']},{})[_0x898a('0x31')](function(){return _0x22f9ba;});}else{return _0x22f9ba;}})[_0x898a('0x23')](function(_0x5b7019){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b7019);throw _0x5b7019;});}return _0x22f9ba;});}})[_0x898a('0x31')](respondWithResult(_0x209529,0xc9))['catch'](handleError(_0x209529,null));};exports['create']=function(_0x5ed35e,_0xfdd6d8,_0x473f5c){var _0x3909c5;return db[_0x898a('0x4a')]['create'](_0x5ed35e['body'],{'raw':!![]})[_0x898a('0x31')](function(_0x232be0){_0x3909c5=_0x232be0;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x41cf94){var _0x30051d=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x42fda8=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),_0x898a('0x63'));var _0x3bcc3d=ejs[_0x898a('0x64')](_0x30051d,{'trunks':_0x41cf94||[]});fs[_0x898a('0x65')](_0x898a('0x66'),_0x3bcc3d);if(_0x3909c5[_0x898a('0x67')]){var _0x307849=ejs[_0x898a('0x64')](_0x42fda8,{'trunks':_0x41cf94||[]});fs['writeFileSync'](_0x898a('0x68'),_0x307849);}})['then'](function(){return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x57'),{'module':_0x898a('0x6a')});})['then'](function(){var _0x31102d=_0x5ed35e[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x31102d)throw new Error(_0x898a('0x6b'));if(_0x31102d[_0x898a('0x59')]==='user'){var _0x4b9487=_0x3909c5[_0x898a('0x33')]({'plain':!![]});return db[_0x898a('0x5a')][_0x898a('0x52')]({'where':{'name':_0x898a('0x34'),'userProfileId':_0x31102d['userProfileId']},'raw':!![]})[_0x898a('0x31')](function(_0x3d3451){if(_0x3d3451&&_0x3d3451[_0x898a('0x5c')]===0x0){return db[_0x898a('0x35')][_0x898a('0x57')]({'name':_0x4b9487[_0x898a('0x37')],'resourceId':_0x4b9487['id'],'type':_0x3d3451[_0x898a('0x37')],'sectionId':_0x3d3451['id']},{})[_0x898a('0x31')](function(){return _0x3909c5;});}else{return _0x3909c5;}})['catch'](function(_0x32a207){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32a207);throw _0x32a207;});}return _0x3909c5;})[_0x898a('0x31')](respondWithResult(_0xfdd6d8,0xc9))['catch'](handleError(_0xfdd6d8,null));};exports[_0x898a('0x30')]=function(_0x4b2575,_0x2471d8,_0x387f2c){var _0x3b07dc;return db[_0x898a('0x4a')][_0x898a('0x52')]({'where':{'id':_0x4b2575[_0x898a('0x4d')]['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x2471d8,null))[_0x898a('0x31')](saveUpdates(_0x4b2575[_0x898a('0x55')],null))['then'](function(_0x3fe54b){if(_0x3fe54b){_0x3b07dc=_0x3fe54b;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});}})[_0x898a('0x31')](function(_0x290972){if(_0x290972){var _0x1d594b=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x4fad03=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config['root'],'server/files/templates/registry.ejs'),_0x898a('0x63'));var _0x4a79a4=ejs[_0x898a('0x64')](_0x1d594b,{'trunks':_0x290972||[]});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4a79a4);var _0x3f6815=ejs[_0x898a('0x64')](_0x4fad03,{'trunks':_0x290972||[]});fs[_0x898a('0x65')](_0x898a('0x68'),_0x3f6815);return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x30'),{'module':_0x898a('0x6a')});}return null;})['then'](function(_0x3237e8){if(_0x3237e8){return _0x3b07dc;}})[_0x898a('0x31')](respondWithResult(_0x2471d8,null))[_0x898a('0x23')](handleError(_0x2471d8,null));};exports['destroy']=function(_0x27560f,_0x61247c,_0x5c6247){var _0x39e917;return db['Trunk']['find']({'where':{'id':_0x27560f['params']['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x61247c,null))[_0x898a('0x31')](removeEntity(_0x61247c,null))[_0x898a('0x31')](function(){return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x12e54b){var _0x50dd52=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x24670c=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),'utf8');var _0x5847cb=ejs['render'](_0x50dd52,{'trunks':_0x12e54b});var _0x3b8fb5=ejs[_0x898a('0x64')](_0x24670c,{'trunks':_0x12e54b});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5847cb);fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_registers.conf',_0x3b8fb5);return respondWithRpcPromise('Reload',_0x898a('0x32'),{'module':_0x898a('0x6a')});})[_0x898a('0x23')](handleError(_0x61247c,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 6f9d82a..5fb2b3c 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 _0xa90f=['define','Trunk','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports'];(function(_0x2a48c7,_0x16baf9){var _0x71c179=function(_0x5de0dc){while(--_0x5de0dc){_0x2a48c7['push'](_0x2a48c7['shift']());}};_0x71c179(++_0x16baf9);}(_0xa90f,0xb8));var _0xfa90=function(_0x515408,_0x27993d){_0x515408=_0x515408-0x0;var _0x374b70=_0xa90f[_0x515408];return _0x374b70;};'use strict';var _=require(_0xfa90('0x0'));var util=require(_0xfa90('0x1'));var logger=require(_0xfa90('0x2'))(_0xfa90('0x3'));var moment=require(_0xfa90('0x4'));var BPromise=require(_0xfa90('0x5'));var rp=require(_0xfa90('0x6'));var fs=require('fs');var path=require(_0xfa90('0x7'));var rimraf=require(_0xfa90('0x8'));var config=require(_0xfa90('0x9'));var attributes=require(_0xfa90('0xa'));module[_0xfa90('0xb')]=function(_0x411db0,_0x562cf6){return _0x411db0[_0xfa90('0xc')](_0xfa90('0xd'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda78=['Trunk','tools_trunks','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./trunk.attributes','exports'];(function(_0x1376e7,_0x9d7337){var _0x4edb1e=function(_0x43ea89){while(--_0x43ea89){_0x1376e7['push'](_0x1376e7['shift']());}};_0x4edb1e(++_0x9d7337);}(_0xda78,0x15e));var _0x8da7=function(_0x708cfa,_0x413d56){_0x708cfa=_0x708cfa-0x0;var _0x2418ca=_0xda78[_0x708cfa];return _0x2418ca;};'use strict';var _=require(_0x8da7('0x0'));var util=require(_0x8da7('0x1'));var logger=require('../../config/logger')(_0x8da7('0x2'));var moment=require(_0x8da7('0x3'));var BPromise=require(_0x8da7('0x4'));var rp=require(_0x8da7('0x5'));var fs=require('fs');var path=require(_0x8da7('0x6'));var rimraf=require('rimraf');var config=require(_0x8da7('0x7'));var attributes=require(_0x8da7('0x8'));module[_0x8da7('0x9')]=function(_0x12d9c4,_0x22ad5e){return _0x12d9c4['define'](_0x8da7('0xa'),attributes,{'tableName':_0x8da7('0xb'),'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 f522809..f73cb25 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 _0x3dba=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','code','error','message','GetTrunk','Trunk','options','raw','where','attributes','limit','include','map','model','then','stringify','ShowTrunk','find','catch'];(function(_0x471212,_0x575808){var _0x3764d0=function(_0x5d211e){while(--_0x5d211e){_0x471212['push'](_0x471212['shift']());}};_0x3764d0(++_0x575808);}(_0x3dba,0x84));var _0xa3db=function(_0x4e8022,_0x53229d){_0x4e8022=_0x4e8022-0x0;var _0xf5e73f=_0x3dba[_0x4e8022];return _0xf5e73f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa3db('0x0'));var fs=require('fs');var Redis=require(_0xa3db('0x1'));var db=require(_0xa3db('0x2'))['db'];var utils=require(_0xa3db('0x3'));var logger=require(_0xa3db('0x4'))('rpc');var config=require(_0xa3db('0x5'));var jayson=require(_0xa3db('0x6'));var client=jayson[_0xa3db('0x7')][_0xa3db('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x15da8d,_0xf7bbd7,_0x4f9976){return new BPromise(function(_0x544237,_0x16721b){return client[_0xa3db('0x9')](_0x15da8d,_0x4f9976)['then'](function(_0x284c5c){logger[_0xa3db('0xa')](_0xa3db('0xb'),_0xf7bbd7,_0xa3db('0xc'));logger[_0xa3db('0xd')](_0xa3db('0xe'),_0xf7bbd7,_0xa3db('0xc'),JSON['stringify'](_0x284c5c));if(_0x284c5c['error']){if(_0x284c5c['error'][_0xa3db('0xf')]===0x1f4){logger[_0xa3db('0x10')]('Trunk,\x20%s,\x20%s',_0xf7bbd7,_0x284c5c['error'][_0xa3db('0x11')]);return _0x16721b(_0x284c5c['error'][_0xa3db('0x11')]);}logger[_0xa3db('0x10')](_0xa3db('0xb'),_0xf7bbd7,_0x284c5c[_0xa3db('0x10')]['message']);return _0x544237(_0x284c5c[_0xa3db('0x10')][_0xa3db('0x11')]);}else{logger[_0xa3db('0xa')](_0xa3db('0xb'),_0xf7bbd7,_0xa3db('0xc'));_0x544237(_0x284c5c['result'][_0xa3db('0x11')]);}})['catch'](function(_0x32d25c){logger[_0xa3db('0x10')](_0xa3db('0xb'),_0xf7bbd7,_0x32d25c);_0x16721b(_0x32d25c);});});}exports[_0xa3db('0x12')]=function(_0x121a4f){var _0x23db66=this;return new Promise(function(_0x312ca8,_0x22e15b){return db[_0xa3db('0x13')]['findAll']({'raw':_0x121a4f[_0xa3db('0x14')]?_0x121a4f[_0xa3db('0x14')][_0xa3db('0x15')]===undefined?!![]:![]:!![],'where':_0x121a4f[_0xa3db('0x14')]?_0x121a4f[_0xa3db('0x14')][_0xa3db('0x16')]||null:null,'attributes':_0x121a4f[_0xa3db('0x14')]?_0x121a4f[_0xa3db('0x14')][_0xa3db('0x17')]||null:null,'limit':_0x121a4f[_0xa3db('0x14')]?_0x121a4f[_0xa3db('0x14')][_0xa3db('0x18')]||null:null,'include':_0x121a4f['options']?_0x121a4f[_0xa3db('0x14')][_0xa3db('0x19')]?_[_0xa3db('0x1a')](_0x121a4f[_0xa3db('0x14')][_0xa3db('0x19')],function(_0x121d1f){return{'model':db[_0x121d1f[_0xa3db('0x1b')]],'as':_0x121d1f['as'],'attributes':_0x121d1f[_0xa3db('0x17')],'include':_0x121d1f[_0xa3db('0x19')]?_[_0xa3db('0x1a')](_0x121d1f[_0xa3db('0x19')],function(_0x9243f8){return{'model':db[_0x9243f8[_0xa3db('0x1b')]],'as':_0x9243f8['as'],'attributes':_0x9243f8[_0xa3db('0x17')],'include':_0x9243f8['include']?_[_0xa3db('0x1a')](_0x9243f8[_0xa3db('0x19')],function(_0x19e7d6){return{'model':db[_0x19e7d6['model']],'as':_0x19e7d6['as'],'attributes':_0x19e7d6[_0xa3db('0x17')]};}):[]};}):[]};}):[]:[]})[_0xa3db('0x1c')](function(_0x403e02){logger[_0xa3db('0xa')](_0xa3db('0x12'),_0x121a4f);logger['debug'](_0xa3db('0x12'),_0x121a4f,JSON[_0xa3db('0x1d')](_0x403e02));_0x312ca8(_0x403e02);})['catch'](function(_0x2a4484){logger[_0xa3db('0x10')](_0xa3db('0x12'),_0x2a4484[_0xa3db('0x11')],_0x121a4f);_0x22e15b(_0x23db66[_0xa3db('0x10')](0x1f4,_0x2a4484[_0xa3db('0x11')]));});});};exports[_0xa3db('0x1e')]=function(_0x4f64b6){var _0x4e58f7=this;return new Promise(function(_0xbf4529,_0x46080a){return db[_0xa3db('0x13')][_0xa3db('0x1f')]({'raw':_0x4f64b6['options']?_0x4f64b6['options'][_0xa3db('0x15')]===undefined?!![]:![]:!![],'where':_0x4f64b6[_0xa3db('0x14')]?_0x4f64b6['options'][_0xa3db('0x16')]||null:null,'attributes':_0x4f64b6['options']?_0x4f64b6[_0xa3db('0x14')][_0xa3db('0x17')]||null:null,'include':_0x4f64b6[_0xa3db('0x14')]?_0x4f64b6[_0xa3db('0x14')]['include']?_[_0xa3db('0x1a')](_0x4f64b6[_0xa3db('0x14')][_0xa3db('0x19')],function(_0x3f511a){return{'model':db[_0x3f511a[_0xa3db('0x1b')]],'as':_0x3f511a['as'],'attributes':_0x3f511a[_0xa3db('0x17')],'include':_0x3f511a['include']?_[_0xa3db('0x1a')](_0x3f511a[_0xa3db('0x19')],function(_0x1688dd){return{'model':db[_0x1688dd[_0xa3db('0x1b')]],'as':_0x1688dd['as'],'attributes':_0x1688dd['attributes'],'include':_0x1688dd['include']?_[_0xa3db('0x1a')](_0x1688dd[_0xa3db('0x19')],function(_0x4f6580){return{'model':db[_0x4f6580['model']],'as':_0x4f6580['as'],'attributes':_0x4f6580[_0xa3db('0x17')]};}):[]};}):[]};}):[]:[]})[_0xa3db('0x1c')](function(_0x200bdd){logger[_0xa3db('0xa')](_0xa3db('0x1e'),_0x4f64b6);logger['debug'](_0xa3db('0x1e'),_0x4f64b6,JSON[_0xa3db('0x1d')](_0x200bdd));_0xbf4529(_0x200bdd);})[_0xa3db('0x20')](function(_0x5c3e5c){logger['error'](_0xa3db('0x1e'),_0x5c3e5c[_0xa3db('0x11')],_0x4f64b6);_0x46080a(_0x4e58f7[_0xa3db('0x10')](0x1f4,_0x5c3e5c[_0xa3db('0x11')]));});});}; \ No newline at end of file +var _0x7d76=['Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','GetTrunk','Trunk','options','raw','where','attributes','limit','include','map','model','ShowTrunk','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0x7d76,0x9d));var _0x67d7=function(_0x370a5b,_0x77c06f){_0x370a5b=_0x370a5b-0x0;var _0x516bb3=_0x7d76[_0x370a5b];return _0x516bb3;};'use strict';var _=require(_0x67d7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x67d7('0x1'));var rs=require(_0x67d7('0x2'));var fs=require('fs');var Redis=require(_0x67d7('0x3'));var db=require(_0x67d7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x67d7('0x5'))(_0x67d7('0x6'));var config=require(_0x67d7('0x7'));var jayson=require(_0x67d7('0x8'));var client=jayson['client'][_0x67d7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15e070,_0x44c25f,_0x21138e){return new BPromise(function(_0x15d4c2,_0x1c1b76){return client[_0x67d7('0xa')](_0x15e070,_0x21138e)[_0x67d7('0xb')](function(_0x535e89){logger[_0x67d7('0xc')](_0x67d7('0xd'),_0x44c25f,'request\x20sent');logger[_0x67d7('0xe')](_0x67d7('0xf'),_0x44c25f,'request\x20sent',JSON[_0x67d7('0x10')](_0x535e89));if(_0x535e89[_0x67d7('0x11')]){if(_0x535e89[_0x67d7('0x11')][_0x67d7('0x12')]===0x1f4){logger[_0x67d7('0x11')](_0x67d7('0xd'),_0x44c25f,_0x535e89[_0x67d7('0x11')]['message']);return _0x1c1b76(_0x535e89[_0x67d7('0x11')][_0x67d7('0x13')]);}logger[_0x67d7('0x11')](_0x67d7('0xd'),_0x44c25f,_0x535e89[_0x67d7('0x11')][_0x67d7('0x13')]);return _0x15d4c2(_0x535e89['error'][_0x67d7('0x13')]);}else{logger[_0x67d7('0xc')](_0x67d7('0xd'),_0x44c25f,_0x67d7('0x14'));_0x15d4c2(_0x535e89['result'][_0x67d7('0x13')]);}})[_0x67d7('0x15')](function(_0x87a1c0){logger['error'](_0x67d7('0xd'),_0x44c25f,_0x87a1c0);_0x1c1b76(_0x87a1c0);});});}exports[_0x67d7('0x16')]=function(_0x25d6ab){var _0x45e09d=this;return new Promise(function(_0x3a5b8b,_0x9c7e44){return db[_0x67d7('0x17')]['findAll']({'raw':_0x25d6ab[_0x67d7('0x18')]?_0x25d6ab[_0x67d7('0x18')][_0x67d7('0x19')]===undefined?!![]:![]:!![],'where':_0x25d6ab['options']?_0x25d6ab['options'][_0x67d7('0x1a')]||null:null,'attributes':_0x25d6ab['options']?_0x25d6ab['options'][_0x67d7('0x1b')]||null:null,'limit':_0x25d6ab[_0x67d7('0x18')]?_0x25d6ab['options'][_0x67d7('0x1c')]||null:null,'include':_0x25d6ab[_0x67d7('0x18')]?_0x25d6ab[_0x67d7('0x18')][_0x67d7('0x1d')]?_[_0x67d7('0x1e')](_0x25d6ab['options'][_0x67d7('0x1d')],function(_0x2ac2ec){return{'model':db[_0x2ac2ec[_0x67d7('0x1f')]],'as':_0x2ac2ec['as'],'attributes':_0x2ac2ec[_0x67d7('0x1b')],'include':_0x2ac2ec['include']?_[_0x67d7('0x1e')](_0x2ac2ec[_0x67d7('0x1d')],function(_0x37e04a){return{'model':db[_0x37e04a[_0x67d7('0x1f')]],'as':_0x37e04a['as'],'attributes':_0x37e04a['attributes'],'include':_0x37e04a[_0x67d7('0x1d')]?_[_0x67d7('0x1e')](_0x37e04a['include'],function(_0x15de66){return{'model':db[_0x15de66[_0x67d7('0x1f')]],'as':_0x15de66['as'],'attributes':_0x15de66[_0x67d7('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x67d7('0xb')](function(_0x485336){logger[_0x67d7('0xc')](_0x67d7('0x16'),_0x25d6ab);logger[_0x67d7('0xe')]('GetTrunk',_0x25d6ab,JSON[_0x67d7('0x10')](_0x485336));_0x3a5b8b(_0x485336);})[_0x67d7('0x15')](function(_0x35b289){logger['error']('GetTrunk',_0x35b289[_0x67d7('0x13')],_0x25d6ab);_0x9c7e44(_0x45e09d['error'](0x1f4,_0x35b289['message']));});});};exports[_0x67d7('0x20')]=function(_0x180d76){var _0x2368e7=this;return new Promise(function(_0x3e1e3e,_0x22fa11){return db['Trunk'][_0x67d7('0x21')]({'raw':_0x180d76[_0x67d7('0x18')]?_0x180d76[_0x67d7('0x18')][_0x67d7('0x19')]===undefined?!![]:![]:!![],'where':_0x180d76[_0x67d7('0x18')]?_0x180d76[_0x67d7('0x18')][_0x67d7('0x1a')]||null:null,'attributes':_0x180d76['options']?_0x180d76[_0x67d7('0x18')][_0x67d7('0x1b')]||null:null,'include':_0x180d76[_0x67d7('0x18')]?_0x180d76[_0x67d7('0x18')][_0x67d7('0x1d')]?_[_0x67d7('0x1e')](_0x180d76['options'][_0x67d7('0x1d')],function(_0x4a7079){return{'model':db[_0x4a7079[_0x67d7('0x1f')]],'as':_0x4a7079['as'],'attributes':_0x4a7079[_0x67d7('0x1b')],'include':_0x4a7079[_0x67d7('0x1d')]?_[_0x67d7('0x1e')](_0x4a7079['include'],function(_0x3b9115){return{'model':db[_0x3b9115[_0x67d7('0x1f')]],'as':_0x3b9115['as'],'attributes':_0x3b9115[_0x67d7('0x1b')],'include':_0x3b9115[_0x67d7('0x1d')]?_[_0x67d7('0x1e')](_0x3b9115[_0x67d7('0x1d')],function(_0x34b5f5){return{'model':db[_0x34b5f5[_0x67d7('0x1f')]],'as':_0x34b5f5['as'],'attributes':_0x34b5f5[_0x67d7('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x67d7('0xb')](function(_0x3cdeae){logger['info'](_0x67d7('0x20'),_0x180d76);logger[_0x67d7('0xe')]('ShowTrunk',_0x180d76,JSON[_0x67d7('0x10')](_0x3cdeae));_0x3e1e3e(_0x3cdeae);})[_0x67d7('0x15')](function(_0x1e6707){logger[_0x67d7('0x11')](_0x67d7('0x20'),_0x1e6707[_0x67d7('0x13')],_0x180d76);_0x22fa11(_0x2368e7[_0x67d7('0x11')](0x1f4,_0x1e6707[_0x67d7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 4cfe0e2..1e687bb 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 _0xa8d2=['getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','addContacts','create','/create_many','bulkCreate','/:id/queues','addQueues','diskStorage','join','server/files/images/','%s-%s','now','originalname','/:id/avatar','single','file','addAvatar','logout','pause','/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addWhatsappAccounts','addSquareProjects','createApiKey','update','put','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','/:id/chat_websites','removeChatWebsites','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./user.controller','isAuthenticated','index','/describe','describe','get','/whoami','whoami','getPresence','/:id','show','getAvatar','getOpenTabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/lists','getLists','/:id/agents','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts'];(function(_0x49119a,_0x2fe2be){var _0x1fe250=function(_0x1c47b8){while(--_0x1c47b8){_0x49119a['push'](_0x49119a['shift']());}};_0x1fe250(++_0x2fe2be);}(_0xa8d2,0x134));var _0x2a8d=function(_0x34486d,_0x186b7b){_0x34486d=_0x34486d-0x0;var _0x220d8d=_0xa8d2[_0x34486d];return _0x220d8d;};'use strict';var multer=require(_0x2a8d('0x0'));var util=require(_0x2a8d('0x1'));var path=require(_0x2a8d('0x2'));var timeout=require(_0x2a8d('0x3'));var express=require(_0x2a8d('0x4'));var router=express[_0x2a8d('0x5')]();var fs_extra=require(_0x2a8d('0x6'));var auth=require(_0x2a8d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2a8d('0x8'));var controller=require(_0x2a8d('0x9'));router['get']('/',auth[_0x2a8d('0xa')](),controller[_0x2a8d('0xb')]);router['get'](_0x2a8d('0xc'),auth['isAuthenticated'](),controller[_0x2a8d('0xd')]);router[_0x2a8d('0xe')](_0x2a8d('0xf'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x10')]);router['get']('/presence',auth['isAuthenticated'](),controller[_0x2a8d('0x11')]);router[_0x2a8d('0xe')](_0x2a8d('0x12'),auth['isAuthenticated'](),controller[_0x2a8d('0x13')]);router[_0x2a8d('0xe')]('/:id/avatar',controller[_0x2a8d('0x14')]);router[_0x2a8d('0xe')]('/:id/open_tabs',auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x15')]);router[_0x2a8d('0xe')](_0x2a8d('0x16'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x17')]);router['get']('/:id/queues',auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x18')]);router[_0x2a8d('0xe')](_0x2a8d('0x19'),auth['isAuthenticated'](),controller[_0x2a8d('0x1a')]);router[_0x2a8d('0xe')](_0x2a8d('0x1b'),auth['isAuthenticated'](),controller[_0x2a8d('0x1c')]);router[_0x2a8d('0xe')](_0x2a8d('0x1d'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x1e')]);router['get'](_0x2a8d('0x1f'),auth['isAuthenticated'](),controller[_0x2a8d('0x20')]);router[_0x2a8d('0xe')](_0x2a8d('0x21'),auth['isAuthenticated'](),controller[_0x2a8d('0x22')]);router[_0x2a8d('0xe')]('/:id/openchannel/interactions',auth[_0x2a8d('0xa')](),controller['getOpenchannelInteractions']);router[_0x2a8d('0xe')](_0x2a8d('0x23'),auth[_0x2a8d('0xa')](),controller['getMailInteractions']);router['get'](_0x2a8d('0x24'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x25')]);router['get'](_0x2a8d('0x26'),auth[_0x2a8d('0xa')](),controller['getFaxInteractions']);router[_0x2a8d('0xe')](_0x2a8d('0x27'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x28')]);router[_0x2a8d('0xe')]('/:id/teams',auth[_0x2a8d('0xa')](),controller['getTeams']);router[_0x2a8d('0xe')](_0x2a8d('0x29'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x2a')]);router['get'](_0x2a8d('0x2b'),auth['isAuthenticated'](),controller['getAgents']);router['get']('/:id/prefixes',auth['isAuthenticated'](),controller['getVoicePrefixes']);router[_0x2a8d('0xe')](_0x2a8d('0x2c'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x2d')]);router['get'](_0x2a8d('0x2e'),auth[_0x2a8d('0xa')](),controller['getMailAccounts']);router[_0x2a8d('0xe')](_0x2a8d('0x2f'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x30')]);router[_0x2a8d('0xe')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x2a8d('0x31')]);router[_0x2a8d('0xe')]('/:id/chat_websites',auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x32')]);router[_0x2a8d('0xe')](_0x2a8d('0x33'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x34')]);router[_0x2a8d('0xe')](_0x2a8d('0x35'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x36')]);router['get'](_0x2a8d('0x37'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x38')]);router[_0x2a8d('0xe')](_0x2a8d('0x39'),auth[_0x2a8d('0xa')](),controller['getApiKey']);router[_0x2a8d('0x3a')](_0x2a8d('0x16'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x3b')]);router['post']('/',auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x3c')]);router[_0x2a8d('0x3a')](_0x2a8d('0x3d'),auth['isAuthenticated'](),controller[_0x2a8d('0x3e')]);router[_0x2a8d('0x3a')](_0x2a8d('0x3f'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x40')]);var upload=multer({'storage':multer[_0x2a8d('0x41')]({'destination':function(_0xe29002,_0x38f1c8,_0x1ccbe4){_0x1ccbe4(null,path[_0x2a8d('0x42')](config['root'],_0x2a8d('0x43')));},'filename':function(_0x1679f9,_0x18b51b,_0x6d7974){_0x6d7974(null,util['format'](_0x2a8d('0x44'),Date[_0x2a8d('0x45')](),_0x18b51b[_0x2a8d('0x46')]));}})});router['post'](_0x2a8d('0x47'),upload[_0x2a8d('0x48')](_0x2a8d('0x49')),controller[_0x2a8d('0x4a')]);router[_0x2a8d('0x3a')]('/:id/login',auth['isAuthenticated'](),controller['login']);router[_0x2a8d('0x3a')]('/:id/logout',auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x4b')]);router[_0x2a8d('0x3a')]('/:id/pause',auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x4c')]);router['post'](_0x2a8d('0x4d'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x4e')]);router[_0x2a8d('0x3a')](_0x2a8d('0x4f'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x50')]);router['post'](_0x2a8d('0x51'),auth['isAuthenticated'](),controller[_0x2a8d('0x52')]);router[_0x2a8d('0x3a')](_0x2a8d('0x53'),auth[_0x2a8d('0xa')](),controller['addMailInteractions']);router['post'](_0x2a8d('0x54'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x55')]);router['post']('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x2a8d('0x56')]);router[_0x2a8d('0x3a')](_0x2a8d('0x57'),auth[_0x2a8d('0xa')](),controller['addOpenchannelInteractions']);router[_0x2a8d('0x3a')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0x2a8d('0x58')]);router['post'](_0x2a8d('0x2c'),auth['isAuthenticated'](),controller[_0x2a8d('0x59')]);router[_0x2a8d('0x3a')](_0x2a8d('0x2e'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x5a')]);router[_0x2a8d('0x3a')]('/:id/openchannel_accounts',auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x5b')]);router[_0x2a8d('0x3a')](_0x2a8d('0x5c'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x5d')]);router[_0x2a8d('0x3a')]('/:id/chat_websites',auth[_0x2a8d('0xa')](),controller['addChatWebsites']);router[_0x2a8d('0x3a')](_0x2a8d('0x33'),auth['isAuthenticated'](),controller[_0x2a8d('0x5e')]);router[_0x2a8d('0x3a')](_0x2a8d('0x35'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x5f')]);router[_0x2a8d('0x3a')](_0x2a8d('0x39'),auth['isAuthenticated'](),controller[_0x2a8d('0x60')]);router['put'](_0x2a8d('0x12'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x61')]);router[_0x2a8d('0x62')](_0x2a8d('0x63'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x64')]);router[_0x2a8d('0x65')](_0x2a8d('0x3f'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x66')]);router[_0x2a8d('0x65')](_0x2a8d('0x4f'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x67')]);router[_0x2a8d('0x65')](_0x2a8d('0x12'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x68')]);router['delete'](_0x2a8d('0x51'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x69')]);router[_0x2a8d('0x65')](_0x2a8d('0x53'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x6a')]);router[_0x2a8d('0x65')](_0x2a8d('0x54'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x6b')]);router['delete'](_0x2a8d('0x6c'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x6d')]);router[_0x2a8d('0x65')](_0x2a8d('0x57'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x6e')]);router['delete'](_0x2a8d('0x6f'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x70')]);router[_0x2a8d('0x65')](_0x2a8d('0x2c'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x71')]);router[_0x2a8d('0x65')](_0x2a8d('0x2e'),auth[_0x2a8d('0xa')](),controller['removeMailAccounts']);router[_0x2a8d('0x65')](_0x2a8d('0x2f'),auth[_0x2a8d('0xa')](),controller['removeOpenchannelAccounts']);router[_0x2a8d('0x65')](_0x2a8d('0x5c'),auth[_0x2a8d('0xa')](),controller['removeSmsAccounts']);router[_0x2a8d('0x65')](_0x2a8d('0x72'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x73')]);router[_0x2a8d('0x65')](_0x2a8d('0x33'),auth[_0x2a8d('0xa')](),controller['removeWhatsappAccounts']);router[_0x2a8d('0x65')](_0x2a8d('0x35'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x74')]);router[_0x2a8d('0x65')](_0x2a8d('0x39'),auth[_0x2a8d('0xa')](),controller[_0x2a8d('0x75')]);module[_0x2a8d('0x76')]=router; \ No newline at end of file +var _0xbe8f=['single','file','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','/:id/square_projects','addSquareProjects','createApiKey','put','/:id/password','changePassword','removeQueues','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeSquareProjects','exports','multer','util','path','fs-extra','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','getLists','getVoicePrefixes','/:id/fax_accounts','getMailAccounts','/:id/openchannel_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','addContacts','create','/create_many','bulkCreate','/:id/queues','diskStorage','join','root','%s-%s','now','originalname'];(function(_0x57081b,_0x4e9645){var _0x3f126e=function(_0x380431){while(--_0x380431){_0x57081b['push'](_0x57081b['shift']());}};_0x3f126e(++_0x4e9645);}(_0xbe8f,0xa4));var _0xfbe8=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xbe8f[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require(_0xfbe8('0x0'));var util=require(_0xfbe8('0x1'));var path=require(_0xfbe8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfbe8('0x3'));var auth=require(_0xfbe8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfbe8('0x5'));var controller=require(_0xfbe8('0x6'));router[_0xfbe8('0x7')]('/',auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x9')]);router[_0xfbe8('0x7')](_0xfbe8('0xa'),auth['isAuthenticated'](),controller[_0xfbe8('0xb')]);router[_0xfbe8('0x7')](_0xfbe8('0xc'),auth['isAuthenticated'](),controller['whoami']);router[_0xfbe8('0x7')](_0xfbe8('0xd'),auth[_0xfbe8('0x8')](),controller[_0xfbe8('0xe')]);router[_0xfbe8('0x7')](_0xfbe8('0xf'),auth['isAuthenticated'](),controller[_0xfbe8('0x10')]);router['get'](_0xfbe8('0x11'),controller[_0xfbe8('0x12')]);router['get']('/:id/open_tabs',auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x13')]);router[_0xfbe8('0x7')](_0xfbe8('0x14'),auth['isAuthenticated'](),controller[_0xfbe8('0x15')]);router[_0xfbe8('0x7')]('/:id/queues',auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x16')]);router[_0xfbe8('0x7')](_0xfbe8('0x17'),auth['isAuthenticated'](),controller[_0xfbe8('0x18')]);router[_0xfbe8('0x7')](_0xfbe8('0x19'),auth[_0xfbe8('0x8')](),controller['getGroups']);router[_0xfbe8('0x7')](_0xfbe8('0x1a'),auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x1b')]);router['get'](_0xfbe8('0x1c'),auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x1d')]);router['get']('/:id/chat/interactions',auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x1e')]);router['get'](_0xfbe8('0x1f'),auth[_0xfbe8('0x8')](),controller['getOpenchannelInteractions']);router['get'](_0xfbe8('0x20'),auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x21')]);router[_0xfbe8('0x7')](_0xfbe8('0x22'),auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x23')]);router[_0xfbe8('0x7')](_0xfbe8('0x24'),auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x25')]);router[_0xfbe8('0x7')]('/:id/whatsapp/interactions',auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x26')]);router[_0xfbe8('0x7')](_0xfbe8('0x27'),auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x28')]);router[_0xfbe8('0x7')]('/:id/lists',auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x29')]);router[_0xfbe8('0x7')]('/:id/agents',auth[_0xfbe8('0x8')](),controller['getAgents']);router['get']('/:id/prefixes',auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x2a')]);router[_0xfbe8('0x7')](_0xfbe8('0x2b'),auth[_0xfbe8('0x8')](),controller['getFaxAccounts']);router[_0xfbe8('0x7')]('/:id/mail_accounts',auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x2c')]);router[_0xfbe8('0x7')](_0xfbe8('0x2d'),auth[_0xfbe8('0x8')](),controller['getOpenchannelAccounts']);router[_0xfbe8('0x7')]('/:id/sms_accounts',auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x2e')]);router[_0xfbe8('0x7')](_0xfbe8('0x2f'),auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x30')]);router[_0xfbe8('0x7')]('/:id/whatsapp_accounts',auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x31')]);router[_0xfbe8('0x7')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0xfbe8('0x32')]);router['get'](_0xfbe8('0x33'),auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x34')]);router['get'](_0xfbe8('0x35'),auth['isAuthenticated'](),controller['getApiKey']);router[_0xfbe8('0x36')](_0xfbe8('0x14'),auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x37')]);router['post']('/',auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x38')]);router[_0xfbe8('0x36')](_0xfbe8('0x39'),auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x3a')]);router['post'](_0xfbe8('0x3b'),auth[_0xfbe8('0x8')](),controller['addQueues']);var upload=multer({'storage':multer[_0xfbe8('0x3c')]({'destination':function(_0x200146,_0x2c1d3c,_0x9aa6af){_0x9aa6af(null,path[_0xfbe8('0x3d')](config[_0xfbe8('0x3e')],'server/files/images/'));},'filename':function(_0x4937fb,_0x49da76,_0x178b6e){_0x178b6e(null,util['format'](_0xfbe8('0x3f'),Date[_0xfbe8('0x40')](),_0x49da76[_0xfbe8('0x41')]));}})});router[_0xfbe8('0x36')](_0xfbe8('0x11'),upload[_0xfbe8('0x42')](_0xfbe8('0x43')),controller['addAvatar']);router[_0xfbe8('0x36')](_0xfbe8('0x44'),auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x45')]);router[_0xfbe8('0x36')](_0xfbe8('0x46'),auth['isAuthenticated'](),controller[_0xfbe8('0x47')]);router[_0xfbe8('0x36')](_0xfbe8('0x48'),auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x49')]);router[_0xfbe8('0x36')](_0xfbe8('0x4a'),auth[_0xfbe8('0x8')](),controller['unpause']);router[_0xfbe8('0x36')](_0xfbe8('0x27'),auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x4b')]);router['post'](_0xfbe8('0x4c'),auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x4d')]);router['post'](_0xfbe8('0x4e'),auth[_0xfbe8('0x8')](),controller['addMailInteractions']);router['post']('/:id/fax_interactions',auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x4f')]);router['post'](_0xfbe8('0x50'),auth['isAuthenticated'](),controller['addSmsInteractions']);router[_0xfbe8('0x36')](_0xfbe8('0x51'),auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x52')]);router[_0xfbe8('0x36')](_0xfbe8('0x53'),auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x54')]);router['post'](_0xfbe8('0x2b'),auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x55')]);router[_0xfbe8('0x36')](_0xfbe8('0x56'),auth['isAuthenticated'](),controller[_0xfbe8('0x57')]);router[_0xfbe8('0x36')](_0xfbe8('0x2d'),auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x58')]);router[_0xfbe8('0x36')](_0xfbe8('0x59'),auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x5a')]);router[_0xfbe8('0x36')]('/:id/chat_websites',auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x5b')]);router['post'](_0xfbe8('0x5c'),auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x5d')]);router[_0xfbe8('0x36')](_0xfbe8('0x5e'),auth['isAuthenticated'](),controller[_0xfbe8('0x5f')]);router[_0xfbe8('0x36')]('/:id/api_key',auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x60')]);router[_0xfbe8('0x61')]('/:id',auth[_0xfbe8('0x8')](),controller['update']);router['put'](_0xfbe8('0x62'),auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x63')]);router['delete'](_0xfbe8('0x3b'),auth['isAuthenticated'](),controller[_0xfbe8('0x64')]);router[_0xfbe8('0x65')]('/:id/teams',auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x66')]);router[_0xfbe8('0x65')](_0xfbe8('0xf'),auth['isAuthenticated'](),controller[_0xfbe8('0x67')]);router[_0xfbe8('0x65')](_0xfbe8('0x4c'),auth['isAuthenticated'](),controller[_0xfbe8('0x68')]);router[_0xfbe8('0x65')]('/:id/mail_interactions',auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x69')]);router[_0xfbe8('0x65')](_0xfbe8('0x6a'),auth['isAuthenticated'](),controller[_0xfbe8('0x6b')]);router[_0xfbe8('0x65')]('/:id/sms_interactions',auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x6c')]);router[_0xfbe8('0x65')](_0xfbe8('0x51'),auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x6d')]);router[_0xfbe8('0x65')](_0xfbe8('0x53'),auth[_0xfbe8('0x8')](),controller['removeWhatsappInteractions']);router[_0xfbe8('0x65')](_0xfbe8('0x2b'),auth['isAuthenticated'](),controller[_0xfbe8('0x6e')]);router[_0xfbe8('0x65')](_0xfbe8('0x56'),auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x6f')]);router[_0xfbe8('0x65')](_0xfbe8('0x2d'),auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0xfbe8('0x65')]('/:id/sms_accounts',auth[_0xfbe8('0x8')](),controller[_0xfbe8('0x70')]);router[_0xfbe8('0x65')](_0xfbe8('0x2f'),auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0xfbe8('0x65')](_0xfbe8('0x5c'),auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router[_0xfbe8('0x65')](_0xfbe8('0x5e'),auth['isAuthenticated'](),controller[_0xfbe8('0x71')]);router[_0xfbe8('0x65')]('/:id/api_key',auth[_0xfbe8('0x8')](),controller['removeApiKey']);module[_0xfbe8('0x72')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 90ed8ec..7ec4c21 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 _0x00f0=['PROHIB','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','yes','outgoing','nat','join','all','ulaw;alaw;gsm','allow','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','nonat','update,nonat','DATE','showWebBar','get','isArray','encryption','avpf','icesupport','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','force_avp','dtlsenable','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','name','setDataValue','defaultuser','STRING','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','toLowerCase','ENUM','agent','telephone','local','INTEGER','BOOLEAN','DEFAULT\x20PAUSE','dynamic','user','peer','friend','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN'];(function(_0x1655bb,_0x5a82ae){var _0x5e2020=function(_0x1ccfb4){while(--_0x1ccfb4){_0x1655bb['push'](_0x1655bb['shift']());}};_0x5e2020(++_0x5a82ae);}(_0x00f0,0xec));var _0x000f=function(_0x5f0757,_0x49d0f0){_0x5f0757=_0x5f0757-0x0;var _0x4a8072=_0x00f0[_0x5f0757];return _0x4a8072;};'use strict';var Sequelize=require(_0x000f('0x0'));var moment=require(_0x000f('0x1'));var util=require(_0x000f('0x2'));var _=require(_0x000f('0x3'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x000f('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4c8ce1){this[_0x000f('0x5')]('name',_0x4c8ce1);this[_0x000f('0x5')](_0x000f('0x6'),_0x4c8ce1);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x000f('0x7')],'allowNull':![],'set':function(_0x3c54d0){this[_0x000f('0x5')](_0x000f('0x8'),_0x3c54d0);this[_0x000f('0x5')](_0x000f('0x9'),util[_0x000f('0xa')](_0x000f('0xb'),_0x3c54d0,this[_0x000f('0xc')](_0x000f('0xd'))));}},'alias':{'type':Sequelize[_0x000f('0x7')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x1a8ebf){if(_0x1a8ebf){this[_0x000f('0x5')]('email',_0x1a8ebf[_0x000f('0xe')]());}}},'role':{'type':Sequelize[_0x000f('0xf')]('admin','user',_0x000f('0x10'),_0x000f('0x11')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x000f('0x12')},'internal':{'type':Sequelize[_0x000f('0x13')](0xb),'allowNull':![],'unique':_0x000f('0xd'),'set':function(_0x2f1002){this['setDataValue'](_0x000f('0xd'),_0x2f1002);this['setDataValue']('accountcode',_0x2f1002);this[_0x000f('0x5')]('callerid',util[_0x000f('0xa')](_0x000f('0xb'),this[_0x000f('0xc')](_0x000f('0x8')),_0x2f1002));}},'salt':{'type':Sequelize[_0x000f('0x7')]},'phone':{'type':Sequelize[_0x000f('0x7')]},'mobile':{'type':Sequelize[_0x000f('0x7')]},'address':{'type':Sequelize[_0x000f('0x7')]},'zipcode':{'type':Sequelize[_0x000f('0x7')]},'userpic':{'type':Sequelize[_0x000f('0x7')]},'city':{'type':Sequelize[_0x000f('0x7')]},'country':{'type':Sequelize[_0x000f('0x7')]},'online':{'type':Sequelize[_0x000f('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x000f('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x000f('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x000f('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x000f('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x000f('0x7')],'defaultValue':_0x000f('0x15')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x000f('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x000f('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x000f('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x000f('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x000f('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x000f('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x000f('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x000f('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x000f('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x000f('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![]},'host':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![],'defaultValue':_0x000f('0x16')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x000f('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x000f('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x000f('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x000f('0xf')]('friend',_0x000f('0x17'),_0x000f('0x18')),'allowNull':!![],'defaultValue':_0x000f('0x19')},'context':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x000f('0xf')]('ALLOWED_NOT_SCREENED',_0x000f('0x1a'),_0x000f('0x1b'),_0x000f('0x1c'),_0x000f('0x1d'),_0x000f('0x1e'),'PROHIB_FAILED_SCREEN',_0x000f('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![]},'transport':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![],'defaultValue':_0x000f('0x20'),'set':function(_0x45ff70){this[_0x000f('0x5')](_0x000f('0x21'),_0x45ff70?_0x45ff70['join'](','):null);},'get':function(){return this[_0x000f('0xc')]('transport')?this['getDataValue'](_0x000f('0x21'))[_0x000f('0x22')](','):null;},'comment':_0x000f('0x23')},'dtmfmode':{'type':Sequelize[_0x000f('0xf')](_0x000f('0x24'),_0x000f('0x25'),'shortinfo',_0x000f('0x26'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x000f('0xf')](_0x000f('0x27'),'no','nonat','update',_0x000f('0x28')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![]},'nat':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x529f8d){this[_0x000f('0x5')](_0x000f('0x29'),_0x529f8d?_0x529f8d[_0x000f('0x2a')](','):null);},'get':function(){return this[_0x000f('0xc')]('nat')?this['getDataValue'](_0x000f('0x29'))[_0x000f('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x000f('0x7')]},'pickupgroup':{'type':Sequelize[_0x000f('0x7')]},'namedpickupgroup':{'type':Sequelize[_0x000f('0x7')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x000f('0x2b')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x000f('0x2c'),'set':function(_0x275904){this[_0x000f('0x5')](_0x000f('0x2d'),_0x275904?_0x275904[_0x000f('0x2a')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x000f('0x2d'))?this[_0x000f('0xc')]('allow')[_0x000f('0x22')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![],'set':function(_0x6d56a1){this[_0x000f('0x5')](_0x000f('0x2e'),_0x6d56a1?_0x6d56a1[_0x000f('0x2a')](','):null);},'get':function(){return this[_0x000f('0xc')](_0x000f('0x2e'))?this['getDataValue']('insecure')[_0x000f('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x000f('0xf')](_0x000f('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x000f('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x000f('0xf')]('yes','no',_0x000f('0x2f')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x000f('0xf')](_0x000f('0x27'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x000f('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x000f('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![],'defaultValue':_0x000f('0x30')},'amaflags':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x000f('0xf')](_0x000f('0x27'),'no'),'allowNull':!![],'defaultValue':_0x000f('0x27')},'busylevel':{'type':Sequelize[_0x000f('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x000f('0xf')](_0x000f('0x27'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x000f('0xf')](_0x000f('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x000f('0xf')](_0x000f('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![]},'template':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x000f('0xf')](_0x000f('0x27'),'no',_0x000f('0x31')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x000f('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x000f('0xf')](_0x000f('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x000f('0xf')](_0x000f('0x32'),_0x000f('0x33'),_0x000f('0x34')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x000f('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x000f('0xf')](_0x000f('0x35'),_0x000f('0x36')),'allowNull':!![],'defaultValue':_0x000f('0x36')},'t38pt_usertpsource':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x000f('0xf')](_0x000f('0x27'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x000f('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x000f('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x000f('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x000f('0xf')](_0x000f('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x000f('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x000f('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x000f('0xf')](_0x000f('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x000f('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x000f('0xf')](_0x000f('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x000f('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x000f('0x27'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x000f('0x27'),'no',_0x000f('0x37'),_0x000f('0x38')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x000f('0x39'),_0x000f('0x3a'),_0x000f('0x3b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x000f('0xf')](_0x000f('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x000f('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x000f('0xf')](_0x000f('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x000f('0xf')](_0x000f('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x000f('0x7')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x000f('0xf')](_0x000f('0x27'),'no',_0x000f('0x3c'),'update',_0x000f('0x3d')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x000f('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x000f('0x7')]},'resetPasswordExpires':{'type':Sequelize[_0x000f('0x3e')]},'passwordResetAt':{'type':Sequelize[_0x000f('0x3e')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x000f('0x13')],'defaultValue':0x0,'set':function(_0x2769d3){this[_0x000f('0x5')](_0x000f('0x3f'),_0x2769d3);var _0x463ef6=this[_0x000f('0x40')]({'plain':!![]});switch(_0x2769d3){case 0x0:case 0x1:var _0xa84689=_0x463ef6[_0x000f('0x21')]?_[_0x000f('0x41')](_0x463ef6[_0x000f('0x21')])?_0x463ef6[_0x000f('0x21')][_0x000f('0x2a')]():_0x463ef6['transport']:_0x000f('0x20');if(_0xa84689==='wss'){_0xa84689=_0x000f('0x20');}this[_0x000f('0x5')](_0x000f('0x21'),_0xa84689);this[_0x000f('0x5')](_0x000f('0x42'),'no');this['setDataValue'](_0x000f('0x43'),null);this[_0x000f('0x5')]('force_avp',null);this[_0x000f('0x5')](_0x000f('0x44'),null);this['setDataValue']('dtlsenable',null);this['setDataValue'](_0x000f('0x45'),null);this[_0x000f('0x5')](_0x000f('0x46'),null);this['setDataValue'](_0x000f('0x47'),null);this[_0x000f('0x5')](_0x000f('0x48'),null);this[_0x000f('0x5')](_0x000f('0x49'),'no');break;case 0x2:this[_0x000f('0x5')]('transport',_0x000f('0x4a'));this[_0x000f('0x5')](_0x000f('0x42'),'yes');this[_0x000f('0x5')]('avpf','yes');this[_0x000f('0x5')](_0x000f('0x4b'),_0x000f('0x27'));this['setDataValue'](_0x000f('0x44'),'yes');this['setDataValue'](_0x000f('0x4c'),_0x000f('0x27'));this['setDataValue']('dtlsverify','no');this['setDataValue'](_0x000f('0x46'),_0x000f('0x3b'));this['setDataValue'](_0x000f('0x47'),_0x463ef6[_0x000f('0x47')]||_0x000f('0x4d'));this[_0x000f('0x5')](_0x000f('0x48'),_0x463ef6[_0x000f('0x48')]||_0x000f('0x4e'));this[_0x000f('0x5')](_0x000f('0x49'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x000f('0x4f')],'set':function(_0x3b7374){this[_0x000f('0x5')](_0x000f('0x50'),_0x3b7374?_0x3b7374[_0x000f('0x2a')](','):[]);},'get':function(){return this[_0x000f('0xc')](_0x000f('0x50'))?_['map'](this[_0x000f('0xc')](_0x000f('0x50'))['split'](','),function(_0x144b50){return parseInt(_0x144b50,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x000f('0x7')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x000f('0x7')]},'phoneBarBusyNumber':{'type':Sequelize[_0x000f('0x7')]},'phoneBarUnconditional':{'type':Sequelize[_0x000f('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x000f('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x000f('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x000f('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x000f('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x000f('0x7')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x000f('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x000f('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x000f('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x000f('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x000f('0x51')],'get':function(){return this[_0x000f('0xc')](_0x000f('0x52'))?this[_0x000f('0xc')](_0x000f('0x52')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x000f('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x000f('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x000f('0x7')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x000f('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x000f('0x14')],'defaultValue':![],'set':function(_0x58b051){if(typeof _0x58b051===_0x000f('0x53')){var _0x2ecd6b=_0x58b051==='1'?!![]:_0x58b051==='0'?![]:_0x58b051==='true'?!![]:_0x58b051==='false'?![]:![];this[_0x000f('0x5')](_0x000f('0x54'),_0x2ecd6b);}else{this[_0x000f('0x5')](_0x000f('0x54'),_0x58b051);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x551471){this['setDataValue'](_0x000f('0x55'),_0x551471);if(_0x551471===!![]){this[_0x000f('0x5')](_0x000f('0x56'),moment());this['setDataValue'](_0x000f('0x57'),0x0);}else{this[_0x000f('0x5')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x000f('0x3e')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x000f('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x000f('0x13')](0x5)[_0x000f('0x58')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x000f('0x14')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x000f('0x14')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x000f('0x14')],'defaultValue':!![]}}; \ No newline at end of file +var _0x9261=['update','update,nonat','TEXT','isArray','wss','encryption','avpf','icesupport','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','force_avp','dtlsenable','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','true','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','sequelize','moment','lodash','exports','STRING','setDataValue','name','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','local','INTEGER','BOOLEAN','DATE','DEFAULT\x20PAUSE','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_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]','info','auto','yes','nonat','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','never','\x22\x22\x20<>','accept','refuse','uac','uas','fingerprint','certificate','active','passive'];(function(_0x330e03,_0x2f8432){var _0x5884b5=function(_0x10837b){while(--_0x10837b){_0x330e03['push'](_0x330e03['shift']());}};_0x5884b5(++_0x2f8432);}(_0x9261,0x1de));var _0x1926=function(_0x416468,_0x2e7a72){_0x416468=_0x416468-0x0;var _0x2ee9b7=_0x9261[_0x416468];return _0x2ee9b7;};'use strict';var Sequelize=require(_0x1926('0x0'));var moment=require(_0x1926('0x1'));var util=require('util');var _=require(_0x1926('0x2'));module[_0x1926('0x3')]={'name':{'type':Sequelize[_0x1926('0x4')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1b2b33){this[_0x1926('0x5')](_0x1926('0x6'),_0x1b2b33);this[_0x1926('0x5')](_0x1926('0x7'),_0x1b2b33);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x1926('0x4')],'allowNull':![],'set':function(_0x4cf00b){this[_0x1926('0x5')](_0x1926('0x8'),_0x4cf00b);this['setDataValue'](_0x1926('0x9'),util[_0x1926('0xa')](_0x1926('0xb'),_0x4cf00b,this[_0x1926('0xc')](_0x1926('0xd'))));}},'alias':{'type':Sequelize[_0x1926('0x4')]},'email':{'type':Sequelize[_0x1926('0x4')],'allowNull':![],'unique':_0x1926('0xe'),'validate':{'isEmail':!![]},'set':function(_0x284dd6){if(_0x284dd6){this[_0x1926('0x5')](_0x1926('0xe'),_0x284dd6[_0x1926('0xf')]());}}},'role':{'type':Sequelize[_0x1926('0x10')](_0x1926('0x11'),_0x1926('0x12'),_0x1926('0x13'),_0x1926('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0x1926('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1926('0x4')],'defaultValue':_0x1926('0x15')},'internal':{'type':Sequelize[_0x1926('0x16')](0xb),'allowNull':![],'unique':_0x1926('0xd'),'set':function(_0x2ed996){this[_0x1926('0x5')](_0x1926('0xd'),_0x2ed996);this[_0x1926('0x5')]('accountcode',_0x2ed996);this[_0x1926('0x5')](_0x1926('0x9'),util[_0x1926('0xa')]('\x22%s\x22\x20<%s>',this[_0x1926('0xc')](_0x1926('0x8')),_0x2ed996));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x1926('0x4')]},'mobile':{'type':Sequelize[_0x1926('0x4')]},'address':{'type':Sequelize[_0x1926('0x4')]},'zipcode':{'type':Sequelize[_0x1926('0x4')]},'userpic':{'type':Sequelize[_0x1926('0x4')]},'city':{'type':Sequelize[_0x1926('0x4')]},'country':{'type':Sequelize[_0x1926('0x4')]},'online':{'type':Sequelize[_0x1926('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x1926('0x18')]},'voicePause':{'type':Sequelize[_0x1926('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1926('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1926('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x1926('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x1926('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1926('0x4')],'defaultValue':_0x1926('0x19')},'lastPauseAt':{'type':Sequelize[_0x1926('0x18')]},'chatCapacity':{'type':Sequelize[_0x1926('0x16')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1926('0x16')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1926('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1926('0x16')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1926('0x16')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1926('0x16')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1926('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1926('0x16')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1926('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1926('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1926('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x1926('0x16')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x1926('0x16')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1926('0x10')](_0x1926('0x1a'),_0x1926('0x12'),_0x1926('0x1b')),'allowNull':!![],'defaultValue':_0x1926('0x1a')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1926('0x1c')},'callingpres':{'type':Sequelize[_0x1926('0x10')](_0x1926('0x1d'),_0x1926('0x1e'),'ALLOWED_FAILED_SCREEN',_0x1926('0x1f'),_0x1926('0x20'),_0x1926('0x21'),_0x1926('0x22'),_0x1926('0x23')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![],'defaultValue':_0x1926('0x24'),'set':function(_0x56f7a8){this[_0x1926('0x5')](_0x1926('0x25'),_0x56f7a8?_0x56f7a8[_0x1926('0x26')](','):null);},'get':function(){return this['getDataValue'](_0x1926('0x25'))?this[_0x1926('0xc')](_0x1926('0x25'))[_0x1926('0x27')](','):null;},'comment':_0x1926('0x28')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x1926('0x29'),'shortinfo','inband',_0x1926('0x2a')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x1926('0x10')](_0x1926('0x2b'),'no',_0x1926('0x2c'),'update',_0x1926('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1926('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![],'defaultValue':_0x1926('0x2e'),'set':function(_0x1de98d){this[_0x1926('0x5')]('nat',_0x1de98d?_0x1de98d[_0x1926('0x26')](','):null);},'get':function(){return this[_0x1926('0xc')](_0x1926('0x2f'))?this['getDataValue'](_0x1926('0x2f'))[_0x1926('0x27')](','):null;},'comment':_0x1926('0x30')},'callgroup':{'type':Sequelize[_0x1926('0x4')]},'namedcallgroup':{'type':Sequelize[_0x1926('0x4')]},'pickupgroup':{'type':Sequelize[_0x1926('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x1926('0x4')]},'language':{'type':Sequelize[_0x1926('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1926('0x4')]},'disallow':{'type':Sequelize[_0x1926('0x4')],'allowNull':![],'defaultValue':_0x1926('0x31')},'allow':{'type':Sequelize[_0x1926('0x4')],'allowNull':![],'defaultValue':_0x1926('0x32'),'set':function(_0x372204){this[_0x1926('0x5')](_0x1926('0x33'),_0x372204?_0x372204[_0x1926('0x26')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x1926('0xc')](_0x1926('0x33'))?this['getDataValue'](_0x1926('0x33'))[_0x1926('0x27')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x1926('0x10')](_0x1926('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![],'set':function(_0x1a1762){this[_0x1926('0x5')]('insecure',_0x1a1762?_0x1a1762[_0x1926('0x26')](','):null);},'get':function(){return this[_0x1926('0xc')]('insecure')?this[_0x1926('0xc')]('insecure')[_0x1926('0x27')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x1926('0x10')](_0x1926('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1926('0x10')](_0x1926('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x1926('0x10')]('yes','no',_0x1926('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1926('0x10')](_0x1926('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1926('0x10')](_0x1926('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x1926('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![],'defaultValue':_0x1926('0x35')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x1926('0x2b'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x1926('0x16')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x1926('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1926('0x10')](_0x1926('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1926('0x10')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1926('0x10')](_0x1926('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1926('0x10')](_0x1926('0x2b'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1926('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x1926('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x1926('0x10')](_0x1926('0x36'),_0x1926('0x37'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x1926('0x16')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1926('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1926('0x10')](_0x1926('0x38'),_0x1926('0x39')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x1926('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x1926('0x2b')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x1926('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1926('0x16')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1926('0x10')](_0x1926('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1926('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1926('0x16')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1926('0x16')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1926('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x1926('0x10')](_0x1926('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1926('0x10')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1926('0x10')](_0x1926('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1926('0x10')](_0x1926('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1926('0x10')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x1926('0x2b'),'no',_0x1926('0x3a'),_0x1926('0x3b')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1926('0x10')](_0x1926('0x3c'),_0x1926('0x3d'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1926('0x10')](_0x1926('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x1926('0x10')](_0x1926('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1926('0x10')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x1926('0x10')](_0x1926('0x2b'),'no',_0x1926('0x2c'),_0x1926('0x3e'),_0x1926('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1926('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x1926('0x18')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x1926('0x40')]},'showWebBar':{'type':Sequelize[_0x1926('0x16')],'defaultValue':0x0,'set':function(_0x2ea73e){this[_0x1926('0x5')]('showWebBar',_0x2ea73e);var _0x5f44b0=this['get']({'plain':!![]});switch(_0x2ea73e){case 0x0:case 0x1:var _0x23c99f=_0x5f44b0[_0x1926('0x25')]?_[_0x1926('0x41')](_0x5f44b0[_0x1926('0x25')])?_0x5f44b0['transport'][_0x1926('0x26')]():_0x5f44b0[_0x1926('0x25')]:'udp';if(_0x23c99f===_0x1926('0x42')){_0x23c99f=_0x1926('0x24');}this['setDataValue'](_0x1926('0x25'),_0x23c99f);this[_0x1926('0x5')](_0x1926('0x43'),'no');this[_0x1926('0x5')](_0x1926('0x44'),null);this[_0x1926('0x5')]('force_avp',null);this[_0x1926('0x5')](_0x1926('0x45'),null);this[_0x1926('0x5')]('dtlsenable',null);this[_0x1926('0x5')](_0x1926('0x46'),null);this['setDataValue'](_0x1926('0x47'),null);this['setDataValue'](_0x1926('0x48'),null);this[_0x1926('0x5')](_0x1926('0x49'),null);this[_0x1926('0x5')](_0x1926('0x4a'),'no');break;case 0x2:this['setDataValue'](_0x1926('0x25'),_0x1926('0x42'));this[_0x1926('0x5')](_0x1926('0x43'),_0x1926('0x2b'));this[_0x1926('0x5')](_0x1926('0x44'),_0x1926('0x2b'));this[_0x1926('0x5')](_0x1926('0x4b'),'yes');this[_0x1926('0x5')](_0x1926('0x45'),_0x1926('0x2b'));this[_0x1926('0x5')](_0x1926('0x4c'),'yes');this[_0x1926('0x5')]('dtlsverify','no');this[_0x1926('0x5')](_0x1926('0x47'),_0x1926('0x4d'));this[_0x1926('0x5')](_0x1926('0x48'),_0x5f44b0[_0x1926('0x48')]||_0x1926('0x4e'));this[_0x1926('0x5')](_0x1926('0x49'),_0x5f44b0[_0x1926('0x49')]||_0x1926('0x4f'));this['setDataValue'](_0x1926('0x4a'),_0x1926('0x2b'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x102423){this[_0x1926('0x5')]('permissions',_0x102423?_0x102423[_0x1926('0x26')](','):[]);},'get':function(){return this['getDataValue'](_0x1926('0x50'))?_[_0x1926('0x51')](this[_0x1926('0xc')](_0x1926('0x50'))['split'](','),function(_0x2e9ff2){return parseInt(_0x2e9ff2,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1926('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1926('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1926('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x1926('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1926('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1926('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x1926('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x1926('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1926('0x16')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1926('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x1926('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1926('0x10')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x1926('0x4')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1926('0x52')],'get':function(){return this[_0x1926('0xc')]('phoneBarEnableScreenRecordingByAgent')?this['getDataValue']('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1926('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1926('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x1926('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1926('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x1926('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1926('0x17')],'defaultValue':![],'set':function(_0x11a1f7){if(typeof _0x11a1f7==='string'){var _0x20cba7=_0x11a1f7==='1'?!![]:_0x11a1f7==='0'?![]:_0x11a1f7===_0x1926('0x53')?!![]:_0x11a1f7===_0x1926('0x54')?![]:![];this[_0x1926('0x5')](_0x1926('0x55'),_0x20cba7);}else{this[_0x1926('0x5')](_0x1926('0x55'),_0x11a1f7);}}},'blocked':{'type':Sequelize[_0x1926('0x17')],'defaultValue':![],'set':function(_0x4ecb59){this[_0x1926('0x5')](_0x1926('0x56'),_0x4ecb59);if(_0x4ecb59===!![]){this[_0x1926('0x5')]('blockedAt',moment());this[_0x1926('0x5')](_0x1926('0x57'),0x0);}else{this[_0x1926('0x5')](_0x1926('0x58'),null);}}},'blockedAt':{'type':Sequelize[_0x1926('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x1926('0x16')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1926('0x16')](0x5)[_0x1926('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x1926('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1926('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1926('0x17')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 359d8fd..b859422 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 _0x1261=['intersection','fields','merge','true','all','body','find','describe','addContacts','ids','omit','findById','max','internal','isNil','min_internal','sequelize','QueryTypes','SELECT','from','VoiceMail','email','permissions','101','102','103','113','104','106','107','109','100','114','115','user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','settingsEnabled','userProfileId','create','Telephones','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','some','isEmpty','changePassword','oldPassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','ValidationError','Setting','securePassword','enforcePasswordHistory','validatePasswordPattern','previousPasswords','passwordHistoryLimit','updatePasswordsHistory','channel','online','loginInPause','voicePause','interface','isValidChannel','add','capitalize','toLowerCase','penalty','spread','QueueId','emit','Queue:save','get','voice','format','SIP/%s','upsert','Queues','isArray','Queue:remove','UserVoiceQueueRt','addAvatar','userpic','file','filename','getAvatar','join','server/files/images/logos/default_profile.png','download','existsSync','root','getOpenTabs','mail','ChatOpenTabs','FaxOpenTabs','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','order','sort','pick','getContacts','hasOwnProperty','Tag','Tags','color','tag','nolimit','getQueues','findOne','Unknown\x20channel','options','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getFaxInteractions','WhatsappInteraction','getWhatsappInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','MemberReport','concat','LOGININPAUSE','isMiddleware','resolve','logout','pause','QueuePause','updateAttributes','type','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','smsPause','whatsapppause','lastPauseAt','manual','%s%s','Pause','getTeams','Team','addTeams','setDataValue','getChatQueues','Chat','getMailQueues','Mail','getSmsQueues','Sms','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','flatten','transaction','addAgent','getDataValue','TeamVoicePrefix','VoicePrefixId','removeTeams','Voice','getWhatsappQueues','Openchannel','removeAgent','UserVoicePrefix','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','getSquareProjects','SquareProject','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$lt','$lte','$ne','$eq','$not','$in','$like','$notLike','$iLike','$notILike','$overlap','firstName','lastName','CmContact','Contact','VoiceQueue','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','teams','queues','inbound','lower','toString','asc','desc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','http','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','idle','unavailable','busy','slice','charAt','toUpperCase','select','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','bluebird','util','path','lodash','squel','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','socket.io-emitter','redis','./user.socket','register','localhost','client','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','update','admin','Users','Agents','agent','telephone','filter','ignore','value','includes','role','name','UserProfileResource','destroy','stack','send','index','User','rawAttributes','map','fieldName','key','password','salt','getOptions','where','query','includeAll','include','attributes','findAll','rows','openTabs','length','chat','dataValues','sms','fax','openchannel','push','whatsapp','show','params','model','differenceBy','keys','filters'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1261,0x144));var _0x1126=function(_0x56fbaa,_0x3bc5a6){_0x56fbaa=_0x56fbaa-0x0;var _0x49fbc1=_0x1261[_0x56fbaa];return _0x49fbc1;};'use strict';var moment=require('moment');var BPromise=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var path=require(_0x1126('0x2'));var fs=require('fs');var _=require(_0x1126('0x3'));var squel=require(_0x1126('0x4'));var jayson=require(_0x1126('0x5'));var Redis=require(_0x1126('0x6'));var authService=require(_0x1126('0x7'));var qs=require(_0x1126('0x8'));var logger=require(_0x1126('0x9'))('api');var utils=require('../../config/utils');var config=require(_0x1126('0xa'));var licenseUtil=require(_0x1126('0xb'));var db=require('../../mysqldb')['db'];var socket=require(_0x1126('0xc'))(new Redis(config[_0x1126('0xd')]));require(_0x1126('0xe'))[_0x1126('0xf')](socket);config[_0x1126('0xd')]=_['defaults'](config[_0x1126('0xd')],{'host':_0x1126('0x10'),'port':0x18eb});var client=jayson[_0x1126('0x11')]['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x34571c,_0x5d581b,_0x52ef15,_0x15c071){return new BPromise(function(_0x561b93,_0x15e89b){var _0x1b364a=_0x15c071||client;return _0x1b364a[_0x1126('0x12')](_0x34571c,_0x52ef15)[_0x1126('0x13')](function(_0xca0355){logger[_0x1126('0x14')](_0x1126('0x15'),_0x5d581b,_0x1126('0x16'));logger[_0x1126('0x17')]('User,\x20%s,\x20%s,\x20%s',_0x5d581b,'request\x20sent',JSON[_0x1126('0x18')](_0xca0355));if(_0xca0355[_0x1126('0x19')]){if(_0xca0355[_0x1126('0x19')]['code']===0x1f4){logger[_0x1126('0x19')]('User,\x20%s,\x20%s',_0x5d581b,_0xca0355[_0x1126('0x19')][_0x1126('0x1a')]);return _0x15e89b(_0xca0355[_0x1126('0x19')]['message']);}logger[_0x1126('0x19')](_0x1126('0x15'),_0x5d581b,_0xca0355['error']['message']);return _0x561b93(_0xca0355[_0x1126('0x19')][_0x1126('0x1a')]);}else{logger['info']('User,\x20%s,\x20%s',_0x5d581b,_0x1126('0x16'));_0x561b93(_0xca0355['result'][_0x1126('0x1a')]);}})[_0x1126('0x1b')](function(_0x2f70ac){logger['error'](_0x1126('0x15'),_0x5d581b,_0x2f70ac);_0x15e89b(_0x2f70ac);});});}function respondWithStatusCode(_0x49d209,_0x56efeb){_0x56efeb=_0x56efeb||0xcc;return function(_0x30f6b3){if(_0x30f6b3){return _0x49d209[_0x1126('0x1c')](_0x56efeb);}return _0x49d209[_0x1126('0x1d')](_0x56efeb)[_0x1126('0x1e')]();};}function respondWithResult(_0x526ca1,_0x29ab60){_0x29ab60=_0x29ab60||0xc8;return function(_0x477e6a){if(_0x477e6a){return _0x526ca1['status'](_0x29ab60)[_0x1126('0x1f')](_0x477e6a);}};}function respondWithFilteredResult(_0x59cd8e,_0x529dd9){return function(_0x4b57ab){if(_0x4b57ab){var _0x2199d9=typeof _0x529dd9[_0x1126('0x20')]===_0x1126('0x21')&&typeof _0x529dd9[_0x1126('0x22')]===_0x1126('0x21');var _0x1b07a7=_0x4b57ab[_0x1126('0x23')];var _0x38119d=_0x2199d9?0x0:_0x529dd9['offset'];var _0x35eec3=_0x2199d9?_0x4b57ab[_0x1126('0x23')]:_0x529dd9[_0x1126('0x20')]+_0x529dd9['limit'];var _0x541bc9;if(_0x35eec3>=_0x1b07a7){_0x35eec3=_0x1b07a7;_0x541bc9=0xc8;}else{_0x541bc9=0xce;}_0x59cd8e[_0x1126('0x1d')](_0x541bc9);return _0x59cd8e[_0x1126('0x24')]('Content-Range',_0x38119d+'-'+_0x35eec3+'/'+_0x1b07a7)[_0x1126('0x1f')](_0x4b57ab);}return null;};}function saveUpdates(_0x23d2bc){return function(_0x4a334a){if(_0x4a334a){return _0x4a334a[_0x1126('0x25')](_0x23d2bc)['then'](function(_0xc62460){return _0xc62460;});}return null;};}function removeEntity(_0x4bd50b){return function(_0x771bb8){if(_0x771bb8){return _0x771bb8['destroy']()[_0x1126('0x13')](function(){var _0x5f2611=_0x771bb8['get']({'plain':!![]});if(_0x5f2611['role']===_0x1126('0x26'))return;var _0xa8906d=[{'name':_0x1126('0x27'),'value':'user','ignore':!![]},{'name':_0x1126('0x28'),'value':_0x1126('0x29'),'ignore':![]},{'name':'Telephones','value':_0x1126('0x2a'),'ignore':![]}];var _0x1e80aa=_(_0xa8906d)[_0x1126('0x2b')](_0x1126('0x2c'))['map']('value')[_0x1126('0x2d')]();if(_[_0x1126('0x2e')](_0x1e80aa,_0x5f2611[_0x1126('0x2f')])){return;}var _0x2c67eb=_['find'](_0xa8906d,[_0x1126('0x2d'),_0x5f2611[_0x1126('0x2f')]])[_0x1126('0x30')];return db[_0x1126('0x31')][_0x1126('0x32')]({'where':{'type':_0x2c67eb,'resourceId':_0x5f2611['id']}})['then'](function(){return _0x771bb8;});})[_0x1126('0x13')](function(){_0x4bd50b[_0x1126('0x1d')](0xcc)[_0x1126('0x1e')]();});}};}function handleEntityNotFound(_0x42e773){return function(_0x5c019d){if(!_0x5c019d){_0x42e773['sendStatus'](0x194);}return _0x5c019d;};}function handleError(_0x22827a,_0x31d07c){_0x31d07c=_0x31d07c||0x1f4;return function(_0x511e6b){logger[_0x1126('0x19')](_0x511e6b[_0x1126('0x33')]);if(_0x511e6b[_0x1126('0x30')]){delete _0x511e6b['name'];}_0x22827a['status'](_0x31d07c)[_0x1126('0x34')](_0x511e6b);};}exports[_0x1126('0x35')]=function(_0x3aa08f,_0x156554){var _0x4a202e={},_0x428d3d={'count':0x0,'rows':[]};var _0x4965d0=_(db[_0x1126('0x36')][_0x1126('0x37')])[_0x1126('0x38')](function(_0x1ea702){return{'name':_0x1ea702[_0x1126('0x39')],'type':_0x1ea702['type'][_0x1126('0x3a')]};})[_0x1126('0x2b')](function(_0x2939a9){return!_[_0x1126('0x2e')]([_0x1126('0x3b'),_0x1126('0x3c')],_0x2939a9[_0x1126('0x30')]);})['value']();_0x4a202e=qs[_0x1126('0x3d')](_0x4965d0,_0x3aa08f);var _0x154c28={'where':_0x4a202e[_0x1126('0x3e')]};return db[_0x1126('0x36')][_0x1126('0x23')](_0x154c28)['then'](function(_0x5bdf1a){_0x428d3d[_0x1126('0x23')]=_0x5bdf1a;if(_0x3aa08f[_0x1126('0x3f')][_0x1126('0x40')]){_0x4a202e[_0x1126('0x41')]=[{'all':!![]}];}if(!_[_0x1126('0x2e')](_0x4a202e[_0x1126('0x42')],'id')){_0x4a202e['attributes']['push']('id');}return db['User'][_0x1126('0x43')](_0x4a202e);})['then'](function(_0xf84005){_0x428d3d[_0x1126('0x44')]=_0xf84005;if(_0x3aa08f[_0x1126('0x3f')][_0x1126('0x45')]==='true'){var _0x4c94bb=[];for(var _0x353042=0x0;_0x353042<_0x428d3d[_0x1126('0x44')][_0x1126('0x46')];_0x353042++){_0x4c94bb['push'](get_open_tabs(_0x1126('0x47'),_0x428d3d['rows'][_0x353042][_0x1126('0x48')]));_0x4c94bb['push'](get_open_tabs(_0x1126('0x49'),_0x428d3d[_0x1126('0x44')][_0x353042][_0x1126('0x48')]));_0x4c94bb['push'](get_open_tabs(_0x1126('0x4a'),_0x428d3d[_0x1126('0x44')][_0x353042][_0x1126('0x48')]));_0x4c94bb['push'](get_open_tabs('mail',_0x428d3d['rows'][_0x353042][_0x1126('0x48')]));_0x4c94bb['push'](get_open_tabs(_0x1126('0x4b'),_0x428d3d['rows'][_0x353042][_0x1126('0x48')]));_0x4c94bb[_0x1126('0x4c')](get_open_tabs(_0x1126('0x4d'),_0x428d3d[_0x1126('0x44')][_0x353042][_0x1126('0x48')]));}return BPromise['all'](_0x4c94bb)[_0x1126('0x13')](function(_0x512f60){return _0x428d3d;});}else{return _0x428d3d;}})['then'](respondWithFilteredResult(_0x156554,_0x4a202e))[_0x1126('0x1b')](handleError(_0x156554,null));};exports[_0x1126('0x4e')]=function(_0x575f79,_0x5f6d73){var _0x1ffa2b={'raw':![],'where':{'id':_0x575f79[_0x1126('0x4f')]['id']}},_0x518e0a={};_0x518e0a[_0x1126('0x50')]=_[_0x1126('0x51')](_['keys'](db[_0x1126('0x36')][_0x1126('0x37')]),[_0x1126('0x3b'),_0x1126('0x3c')]);_0x518e0a[_0x1126('0x3f')]=_[_0x1126('0x52')](_0x575f79[_0x1126('0x3f')]);_0x518e0a[_0x1126('0x53')]=_['intersection'](_0x518e0a[_0x1126('0x50')],_0x518e0a['query']);_0x1ffa2b[_0x1126('0x42')]=_[_0x1126('0x54')](_0x518e0a['model'],qs['fields'](_0x575f79[_0x1126('0x3f')][_0x1126('0x55')]));_0x1ffa2b[_0x1126('0x42')]=_0x1ffa2b['attributes'][_0x1126('0x46')]?_0x1ffa2b[_0x1126('0x42')]:_0x518e0a[_0x1126('0x50')];if(_0x575f79[_0x1126('0x3f')]['includeAll']){_0x1ffa2b[_0x1126('0x41')]=[{'all':!![]}];}_0x1ffa2b=_[_0x1126('0x56')]({},_0x1ffa2b,_0x575f79['options']);if(!_['includes'](_0x1ffa2b['attributes'],'id')){_0x1ffa2b['attributes'][_0x1126('0x4c')]('id');}return db[_0x1126('0x36')]['find'](_0x1ffa2b)[_0x1126('0x13')](handleEntityNotFound(_0x5f6d73,null))[_0x1126('0x13')](function(_0x38093e){var _0x38f521=[];values=_0x38093e;if(_0x575f79[_0x1126('0x3f')]['openTabs']===_0x1126('0x57')){_0x38f521[_0x1126('0x4c')](get_open_tabs('chat',_0x38093e[_0x1126('0x48')]));_0x38f521[_0x1126('0x4c')](get_open_tabs(_0x1126('0x49'),_0x38093e[_0x1126('0x48')]));_0x38f521[_0x1126('0x4c')](get_open_tabs('openchannel',_0x38093e[_0x1126('0x48')]));_0x38f521['push'](get_open_tabs(_0x1126('0x4d'),_0x38093e[_0x1126('0x48')]));_0x38f521[_0x1126('0x4c')](get_open_tabs('fax',_0x38093e[_0x1126('0x48')]));_0x38f521[_0x1126('0x4c')](get_open_tabs('mail',_0x38093e[_0x1126('0x48')]));return BPromise[_0x1126('0x58')](_0x38f521);}else{return values;}})[_0x1126('0x13')](function(_0x5a5340){return values;})[_0x1126('0x13')](respondWithResult(_0x5f6d73,null))[_0x1126('0x1b')](handleError(_0x5f6d73,null));};exports[_0x1126('0x25')]=function(_0x308ee4,_0x128c94){if(_0x308ee4[_0x1126('0x59')]['id']){delete _0x308ee4[_0x1126('0x59')]['id'];}delete _0x308ee4[_0x1126('0x59')]['role'];return db[_0x1126('0x36')][_0x1126('0x5a')]({'where':{'id':_0x308ee4[_0x1126('0x4f')]['id']}})[_0x1126('0x13')](handleEntityNotFound(_0x128c94,null))[_0x1126('0x13')](saveUpdates(_0x308ee4['body'],null))[_0x1126('0x13')](respondWithResult(_0x128c94,null))[_0x1126('0x1b')](handleError(_0x128c94,null));};exports['describe']=function(_0x3767e4,_0x5246aa){return db[_0x1126('0x36')][_0x1126('0x5b')]()['then'](respondWithResult(_0x5246aa,null))[_0x1126('0x1b')](handleError(_0x5246aa,null));};exports[_0x1126('0x5c')]=function(_0x375b76,_0x592960){return db[_0x1126('0x36')]['find']({'where':{'id':_0x375b76['params']['id']}})[_0x1126('0x13')](handleEntityNotFound(_0x592960,null))[_0x1126('0x13')](function(_0x130f26){if(_0x130f26){return _0x130f26[_0x1126('0x5c')](_0x375b76[_0x1126('0x59')][_0x1126('0x5d')],_[_0x1126('0x5e')](_0x375b76['body'],[_0x1126('0x5d'),'id'])||{});}})[_0x1126('0x13')](respondWithResult(_0x592960,null))[_0x1126('0x1b')](handleError(_0x592960,null));};function validateUser(_0xc39c36){return new BPromise(function(_0x3f87aa,_0x3cd788){if(_0xc39c36['internal'])return _0x3f87aa(_0xc39c36);return db['Setting'][_0x1126('0x5f')](0x1)[_0x1126('0x13')](function(_0x4bf2b3){if(_0x4bf2b3['securePassword'])authService['validatePasswordPattern'](_0xc39c36['password']);db[_0x1126('0x36')][_0x1126('0x60')](_0x1126('0x61'))['then'](function(_0x30e32f){if(_[_0x1126('0x62')](_0x30e32f)){_0xc39c36[_0x1126('0x61')]=_0x4bf2b3[_0x1126('0x63')]||0x1;return;}if(_[_0x1126('0x62')](_0x4bf2b3[_0x1126('0x63')])||_0x4bf2b3[_0x1126('0x63')]===_0x30e32f){_0xc39c36['internal']=_0x30e32f+0x1;return;}if(_0x4bf2b3[_0x1126('0x63')]>_0x30e32f){_0xc39c36[_0x1126('0x61')]=_0x4bf2b3[_0x1126('0x63')];return;}return db[_0x1126('0x64')][_0x1126('0x3f')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db['sequelize'][_0x1126('0x65')][_0x1126('0x66')]})['then'](function(_0x3bf25d){if(_0x3bf25d&&_0x3bf25d[_0x1126('0x46')]){for(var _0x366675=0x0,_0x6a41c0=_0x3bf25d[_0x1126('0x46')];_0x366675<_0x6a41c0&&_[_0x1126('0x62')](_0xc39c36[_0x1126('0x61')]);_0x366675++){if(_0x4bf2b3[_0x1126('0x63')]<=_0x3bf25d[_0x366675][_0x1126('0x67')]){_0xc39c36[_0x1126('0x61')]=_0x3bf25d[_0x366675][_0x1126('0x67')];}else if(_0x4bf2b3[_0x1126('0x63')]>_0x3bf25d[_0x366675][_0x1126('0x67')]&&_0x4bf2b3['min_internal']<=_0x3bf25d[_0x366675]['to']){_0xc39c36[_0x1126('0x61')]=_0x4bf2b3[_0x1126('0x63')];}}}if(_[_0x1126('0x62')](_0xc39c36['internal'])){_0xc39c36['internal']=_0x30e32f+0x1;}return _0x3f87aa(_0xc39c36);});});})[_0x1126('0x1b')](function(_0xa4e8d4){_0x3cd788(_0xa4e8d4);});});}function updateUser(_0x1998f2){return new BPromise(function(_0x3bfeb8,_0x51929e){try{if(_0x1998f2['voicemail']){_0x1998f2['mailbox']=_0x1998f2[_0x1126('0x61')];_0x1998f2[_0x1126('0x68')]={'mailbox':_0x1998f2[_0x1126('0x61')],'password':_0x1998f2[_0x1126('0x3b')],'fullname':_0x1998f2['fullname'],'email':_0x1998f2[_0x1126('0x69')]};}if(_0x1998f2['role']===_0x1126('0x29')){if(!_0x1998f2[_0x1126('0x6a')])_0x1998f2[_0x1126('0x6a')]=[_0x1126('0x6b'),_0x1126('0x6c'),_0x1126('0x6d'),_0x1126('0x6e'),'110',_0x1126('0x6f'),'105',_0x1126('0x70'),_0x1126('0x71'),'108',_0x1126('0x72'),_0x1126('0x73'),'111',_0x1126('0x74'),_0x1126('0x75')];}_0x3bfeb8(_0x1998f2);}catch(_0x4b1d04){_0x51929e(_0x4b1d04);}});}exports['create']=function(_0xb21659,_0xa27290){if(_0xb21659[_0x1126('0x76')]['role']==='agent')throw new Error('Unauthorized');if(_0xb21659[_0x1126('0x59')]['role']==='user'&&_0xb21659[_0x1126('0x76')]['role']!==_0x1126('0x26')){throw new Error(_0x1126('0x77'));}if(_0xb21659['body'][_0x1126('0x2f')]===_0x1126('0x26')&&_0xb21659[_0x1126('0x76')][_0x1126('0x2f')]!==_0x1126('0x26')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x1126('0x78')]([_0xb21659[_0x1126('0x59')]])['then'](function(){return validateUser(_0xb21659[_0x1126('0x59')]);})[_0x1126('0x13')](function(_0x2c0908){return updateUser(_0x2c0908)[_0x1126('0x13')](function(_0x2598a7){if(_0x2598a7[_0x1126('0x2f')]===_0x1126('0x26')){_0x2598a7[_0x1126('0x79')]=_0xb21659[_0x1126('0x76')][_0x1126('0x79')];delete _0x2598a7[_0x1126('0x7a')];}return _0x2598a7;});})[_0x1126('0x13')](function(_0x2010a9){return db[_0x1126('0x36')][_0x1126('0x7b')](_0x2010a9,{'include':[{'model':db[_0x1126('0x68')],'as':'VoiceMail'}]});})[_0x1126('0x13')](function(_0x20c91f){if(_0xb21659[_0x1126('0x59')][_0x1126('0x2f')]===_0x1126('0x76'))return _0x20c91f;if(_0xb21659['user'][_0x1126('0x2f')]!=='user')return _0x20c91f;return db['UserProfileSection'][_0x1126('0x5a')]({'where':{'name':_0x20c91f[_0x1126('0x2f')]==='agent'?'Agents':_0x1126('0x7c'),'userProfileId':_0xb21659[_0x1126('0x76')][_0x1126('0x7a')]},'raw':!![]})[_0x1126('0x13')](function(_0x1a60b9){if(!_0x1a60b9||_0x1a60b9[_0x1126('0x7d')]!=0x0)return _0x20c91f;return db[_0x1126('0x31')][_0x1126('0x7b')]({'name':_0x20c91f[_0x1126('0x30')],'resourceId':_0x20c91f['id'],'type':_0x1a60b9['name'],'sectionId':_0x1a60b9['id']},{})[_0x1126('0x13')](function(){return _0x20c91f;});})[_0x1126('0x1b')](function(_0x3178f5){logger[_0x1126('0x19')](_0x1126('0x7e'),_0x3178f5);throw _0x3178f5;});})[_0x1126('0x13')](respondWithResult(_0xa27290,0xc9))['catch'](handleError(_0xa27290,null));};exports[_0x1126('0x7f')]=function(_0x2cc4c8,_0x194b3c){var _0x37c8bb=_0x2cc4c8[_0x1126('0x59')];var _0x1796eb=[];if(_0x2cc4c8[_0x1126('0x76')][_0x1126('0x2f')]===_0x1126('0x29'))throw new Error(_0x1126('0x80'));if(_['some'](_0x37c8bb,['role',_0x1126('0x76')])&&_0x2cc4c8['user'][_0x1126('0x2f')]!=='admin'){throw new Error(_0x1126('0x77'));}if(_['some'](_0x37c8bb,[_0x1126('0x2f'),'admin'])&&_0x2cc4c8['user']['role']!==_0x1126('0x26')){throw new Error(_0x1126('0x81'));}return licenseUtil['checkUserLimits'](_0x37c8bb)['then'](function(){return validateUser(_0x37c8bb[0x0]);})[_0x1126('0x13')](function(){for(var _0xe2f82d=0x1;_0xe2f82d<_0x37c8bb[_0x1126('0x46')];_0xe2f82d++){var _0x5dfb8f=_0x37c8bb[_0xe2f82d-0x1]['internal'];if(!_0x37c8bb[_0xe2f82d][_0x1126('0x61')])_0x37c8bb[_0xe2f82d]['internal']=_0x5dfb8f+0x1;_0x1796eb[_0x1126('0x4c')](validateUser(_0x37c8bb[_0xe2f82d]));}return BPromise[_0x1126('0x58')](_0x1796eb);})[_0x1126('0x13')](function(){_0x1796eb=[];for(var _0x29922a=0x0;_0x29922a<_0x37c8bb[_0x1126('0x46')];_0x29922a++){_0x1796eb['push'](updateUser(_0x37c8bb[_0x29922a]));}return BPromise['all'](_0x1796eb);})[_0x1126('0x13')](function(){return BPromise[_0x1126('0x82')](_0x37c8bb,function(_0xfc9fb4){return db[_0x1126('0x36')][_0x1126('0x7b')](_0xfc9fb4,{'include':[{'model':db[_0x1126('0x68')],'as':_0x1126('0x68')}]})[_0x1126('0x13')](function(_0x324a37){_0xfc9fb4['id']=_0x324a37['id'];return _0xfc9fb4;});});})[_0x1126('0x13')](function(_0x1a6641){if(_0x2cc4c8['body'][_0x1126('0x2f')]==='user')return _0x1a6641;if(_0x2cc4c8[_0x1126('0x76')]['role']!==_0x1126('0x76'))return _0x1a6641;var _0x25a678=_[_0x1126('0x83')](_0x1a6641,function(_0x300253){return _0x300253['role']===_0x1126('0x29')||_0x300253[_0x1126('0x2f')]==='telephone';});if(!_0x25a678)return _0x1a6641;return db['UserProfileSection'][_0x1126('0x43')]({'where':{'name':{'$or':[_0x1126('0x28'),_0x1126('0x7c')]},'userProfileId':_0x2cc4c8['user'][_0x1126('0x7a')]},'raw':!![]})['then'](function(_0x144cb4){if(_[_0x1126('0x84')](_0x144cb4)||!_['some'](_0x144cb4,[_0x1126('0x7d'),0x0]))return _0x1a6641;_0x1796eb=[];var _0x315192=_(_0x144cb4)[_0x1126('0x38')](function(_0x34df7d){if(_0x34df7d[_0x1126('0x7d')]===0x1)return;return _0x34df7d['name']===_0x1126('0x28')?_0x1126('0x29'):_0x1126('0x2a');})['compact']()['value']();for(var _0x55b45e=0x0;_0x55b45e<_0x1a6641[_0x1126('0x46')];_0x55b45e++){if(!_[_0x1126('0x2e')](_0x315192,_0x1a6641[_0x55b45e][_0x1126('0x2f')]))return;var _0x2a1b22=_0x1a6641[_0x55b45e]['role']===_0x1126('0x29')?_0x1126('0x28'):_0x1126('0x7c');_0x1796eb[_0x1126('0x4c')](db[_0x1126('0x31')]['create']({'name':_0x1a6641[_0x55b45e][_0x1126('0x30')],'resourceId':_0x1a6641[_0x55b45e]['id'],'type':_0x2a1b22,'sectionId':_[_0x1126('0x5a')](_0x144cb4,['name',_0x2a1b22])['id']},{}));}return BPromise[_0x1126('0x58')](_0x1796eb);});})['then'](respondWithResult(_0x194b3c,0xc9))['catch'](handleError(_0x194b3c,null));};exports[_0x1126('0x85')]=function(_0x5e106e,_0x1e763){if(_0x5e106e[_0x1126('0x59')]['id']){delete _0x5e106e[_0x1126('0x59')]['id'];}return db[_0x1126('0x36')][_0x1126('0x5a')]({'where':{'id':_0x5e106e[_0x1126('0x4f')]['id']}})[_0x1126('0x13')](function(_0xdc07fc){if(!_0xdc07fc)return null;if(_0xdc07fc['id']===_0x5e106e[_0x1126('0x76')]['id']){if(!_0x5e106e['body'][_0x1126('0x86')]||!_0x5e106e[_0x1126('0x59')][_0x1126('0x87')]){throw new db[(_0x1126('0x88'))]['ValidationError'](_0x1126('0x89'));}if(!_0xdc07fc[_0x1126('0x8a')](_0x5e106e[_0x1126('0x59')][_0x1126('0x86')])){throw new db['Sequelize']['ValidationError']('Wrong\x20credentials');}if(_0x5e106e[_0x1126('0x59')]['oldPassword']===_0x5e106e[_0x1126('0x59')][_0x1126('0x87')]){throw new db['Sequelize']['ValidationError'](_0x1126('0x8b'));}}else if(_0x5e106e[_0x1126('0x76')]['role']===_0x1126('0x26')){if(!_0x5e106e[_0x1126('0x59')]['newPassword']){throw new db[(_0x1126('0x88'))]['ValidationError'](_0x1126('0x8c'));}}else if(_0x5e106e[_0x1126('0x76')][_0x1126('0x2f')]==='user'){if(!_0x5e106e[_0x1126('0x59')][_0x1126('0x87')]){throw new db[(_0x1126('0x88'))][(_0x1126('0x8d'))](_0x1126('0x8c'));}if(_0xdc07fc[_0x1126('0x2f')]!==_0x1126('0x29')){throw new db[(_0x1126('0x88'))][(_0x1126('0x8d'))](_0x1126('0x80'));}}else{throw new db[(_0x1126('0x88'))][(_0x1126('0x8d'))](_0x1126('0x80'));}return _0xdc07fc;})[_0x1126('0x13')](handleEntityNotFound(_0x1e763,null))[_0x1126('0x13')](function(_0xc4cc17){return db[_0x1126('0x8e')]['findOne']({'attributes':['id',_0x1126('0x8f'),_0x1126('0x90'),'passwordHistoryLimit']})['then'](function(_0xd6de57){if(_0xd6de57[_0x1126('0x8f')])authService[_0x1126('0x91')](_0x5e106e[_0x1126('0x59')]['newPassword']);if(!_0xd6de57[_0x1126('0x90')]||!_0xc4cc17[_0x1126('0x92')])return _0xc4cc17;authService['validatePasswordHistory'](_0x5e106e[_0x1126('0x59')]['newPassword'],_0xc4cc17[_0x1126('0x92')],_0xd6de57[_0x1126('0x93')]);return _0xc4cc17;})['then'](saveUpdates({'password':_0x5e106e['body'][_0x1126('0x87')],'passwordResetAt':_0x5e106e['user']['id']==_0x5e106e['params']['id']?moment():null,'previousPasswords':authService[_0x1126('0x94')](_0x5e106e[_0x1126('0x59')][_0x1126('0x87')],_0xc4cc17[_0x1126('0x92')])},null));})['then'](respondWithResult(_0x1e763,null))['catch'](handleError(_0x1e763,null));};exports['addQueues']=function(_0x207b77,_0x183bf8){var _0x52487b=_0x207b77[_0x1126('0x59')][_0x1126('0x95')];return db[_0x1126('0x36')][_0x1126('0x5a')]({'where':{'id':_0x207b77[_0x1126('0x4f')]['id']},'attributes':['id',_0x1126('0x30'),_0x1126('0x2f'),_0x1126('0x96'),_0x1126('0x97'),_0x1126('0x98'),_0x1126('0x99')]})['then'](handleEntityNotFound(_0x183bf8,null))[_0x1126('0x13')](function(_0x559430){if(_0x559430){if(!utils[_0x1126('0x9a')](_0x52487b)){throw new db[(_0x1126('0x88'))][(_0x1126('0x8d'))]('Unknown\x20channel');}return _0x559430[_0x1126('0x9b')+_[_0x1126('0x9c')](_0x52487b[_0x1126('0x9d')]())+'Queues'](_0x207b77[_0x1126('0x59')][_0x1126('0x5d')],{'penalty':_0x207b77[_0x1126('0x59')][_0x1126('0x9e')]||0x0})[_0x1126('0x9f')](function(_0x589d0c){for(var _0x520371=0x0;_0x520371<_0x207b77[_0x1126('0x59')][_0x1126('0x5d')][_0x1126('0x46')];_0x520371+=0x1){var _0x2a7f87={'UserId':Number(_0x207b77[_0x1126('0x4f')]['id'])};_0x2a7f87[_[_0x1126('0x9c')](_0x52487b[_0x1126('0x9d')]())+_0x1126('0xa0')]=Number(_0x207b77[_0x1126('0x59')][_0x1126('0x5d')][_0x520371]);socket[_0x1126('0xa1')]('user'+_['capitalize'](_0x52487b[_0x1126('0x9d')]())+_0x1126('0xa2'),_0x2a7f87);}return _0x589d0c;})[_0x1126('0x13')](function(){if(_0x52487b==='voice'){return db['VoiceQueue'][_0x1126('0x43')]({'where':{'id':_0x207b77[_0x1126('0x59')][_0x1126('0x5d')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x1126('0x13')](function(_0x1cbd6c){var _0x5a28f9=_0x559430[_0x1126('0xa3')]({'plain':!![]});var _0x4411dc=[];if(_0x52487b===_0x1126('0xa4')&&_0x5a28f9[_0x1126('0x2f')]===_0x1126('0x29')&&_0x5a28f9['online']){for(var _0x346c68=0x0;_0x346c68<_0x1cbd6c[_0x1126('0x46')];_0x346c68+=0x1){_0x4411dc['push']({'membername':_0x5a28f9['name'],'UserId':_0x5a28f9['id'],'queue_name':_0x1cbd6c[_0x346c68]['name'],'VoiceQueueId':_0x1cbd6c[_0x346c68]['id'],'interface':_[_0x1126('0x62')](_0x5a28f9[_0x1126('0x99')])?util[_0x1126('0xa5')](_0x1126('0xa6'),_0x5a28f9[_0x1126('0x30')]):_0x5a28f9['interface'],'paused':_0x5a28f9[_0x1126('0x98')]||![],'penalty':_0x207b77['body'][_0x1126('0x9e')]||0x0});}return BPromise[_0x1126('0x82')](_0x4411dc,function(_0x4e4915){return db['UserVoiceQueueRt'][_0x1126('0xa7')](_0x4e4915);});}return _0x559430;});}})[_0x1126('0x13')](respondWithStatusCode(_0x183bf8,null))['catch'](handleError(_0x183bf8,null));};exports['removeQueues']=function(_0x8bd0dc,_0x278a51){var _0x19cd9d;return db[_0x1126('0x36')][_0x1126('0x5a')]({'where':{'id':_0x8bd0dc[_0x1126('0x4f')]['id']},'attributes':['id',_0x1126('0x30'),_0x1126('0x2f')]})[_0x1126('0x13')](handleEntityNotFound(_0x278a51,null))[_0x1126('0x13')](function(_0x47ab6e){if(_0x47ab6e){_0x19cd9d=_0x47ab6e;if(!_0x8bd0dc['query'][_0x1126('0x95')]||!utils[_0x1126('0x9a')](_0x8bd0dc[_0x1126('0x3f')][_0x1126('0x95')])){throw new db[(_0x1126('0x88'))][(_0x1126('0x8d'))]('Unknown\x20channel');}return _0x47ab6e['remove'+_[_0x1126('0x9c')](_0x8bd0dc['query']['channel'][_0x1126('0x9d')]())+_0x1126('0xa8')](_0x8bd0dc['query'][_0x1126('0x5d')]);}})[_0x1126('0x13')](function(_0x29c95f){if(_[_0x1126('0xa9')](_0x8bd0dc['query'][_0x1126('0x5d')])){for(var _0x2ea320=0x0;_0x2ea320<_0x8bd0dc[_0x1126('0x3f')][_0x1126('0x5d')][_0x1126('0x46')];_0x2ea320+=0x1){var _0x232529={'UserId':Number(_0x8bd0dc[_0x1126('0x4f')]['id'])};_0x232529[_['capitalize'](_0x8bd0dc[_0x1126('0x3f')][_0x1126('0x95')][_0x1126('0x9d')]())+_0x1126('0xa0')]=Number(_0x8bd0dc['query'][_0x1126('0x5d')][_0x2ea320]);socket[_0x1126('0xa1')]('user'+_[_0x1126('0x9c')](_0x8bd0dc[_0x1126('0x3f')][_0x1126('0x95')]['toLowerCase']())+_0x1126('0xaa'),_0x232529);}}else{var _0x232529={'UserId':Number(_0x8bd0dc[_0x1126('0x4f')]['id'])};_0x232529[_[_0x1126('0x9c')](_0x8bd0dc[_0x1126('0x3f')][_0x1126('0x95')]['toLowerCase']())+_0x1126('0xa0')]=Number(_0x8bd0dc[_0x1126('0x3f')]['ids']);socket[_0x1126('0xa1')](_0x1126('0x76')+_[_0x1126('0x9c')](_0x8bd0dc[_0x1126('0x3f')][_0x1126('0x95')][_0x1126('0x9d')]())+'Queue:remove',_0x232529);}return _0x29c95f;})['then'](function(){if(_0x8bd0dc[_0x1126('0x3f')][_0x1126('0x95')]===_0x1126('0xa4')){return db[_0x1126('0xab')][_0x1126('0x32')]({'where':{'UserId':_0x8bd0dc[_0x1126('0x4f')]['id'],'VoiceQueueId':_0x8bd0dc[_0x1126('0x3f')][_0x1126('0x5d')]},'individualHooks':!![]})[_0x1126('0x13')](function(){return _0x19cd9d;});}return _0x19cd9d;})[_0x1126('0x13')](respondWithStatusCode(_0x278a51,null))[_0x1126('0x1b')](handleError(_0x278a51,null));};exports[_0x1126('0xac')]=function(_0x13fdfd,_0x3aa4d5){_0x13fdfd[_0x1126('0x59')][_0x1126('0xad')]=_0x13fdfd[_0x1126('0xae')][_0x1126('0xaf')];return db[_0x1126('0x36')][_0x1126('0x5a')]({'where':{'id':_0x13fdfd[_0x1126('0x4f')]['id']}})[_0x1126('0x13')](handleEntityNotFound(_0x3aa4d5,null))[_0x1126('0x13')](saveUpdates(_0x13fdfd[_0x1126('0x59')],null))[_0x1126('0x13')](respondWithResult(_0x3aa4d5,null))['catch'](handleError(_0x3aa4d5,null));};exports[_0x1126('0xb0')]=function(_0x593386,_0x30f4d5){var _0x442f1c=path[_0x1126('0xb1')](config['root'],_0x1126('0xb2'));return db['User'][_0x1126('0x5a')]({'where':{'id':_0x593386[_0x1126('0x4f')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x1126('0x13')](handleEntityNotFound(_0x30f4d5,null))[_0x1126('0x13')](function(_0x2bea69){if(_0x2bea69){if(_[_0x1126('0x62')](_0x2bea69[_0x1126('0xad')])){return _0x30f4d5[_0x1126('0xb3')](_0x442f1c);}else{if(!fs[_0x1126('0xb4')](path[_0x1126('0xb1')](config[_0x1126('0xb5')],'server/files/images/',_0x2bea69[_0x1126('0xad')]))){return _0x30f4d5[_0x1126('0xb3')](_0x442f1c);}return _0x30f4d5[_0x1126('0xb3')](path[_0x1126('0xb1')](config['root'],'server/files/images/',_0x2bea69['userpic']));}}})['catch'](handleError(_0x30f4d5,null));};exports[_0x1126('0xb6')]=function(_0x4f62a1,_0x2fe211){return db[_0x1126('0x36')][_0x1126('0x5a')]({'where':{'id':_0x4f62a1[_0x1126('0x4f')]['id']},'attributes':['id']})[_0x1126('0x13')](handleEntityNotFound(_0x2fe211,null))[_0x1126('0x13')](function(_0x53b685){var _0x3f2e98=[];values=_0x53b685['dataValues'];_0x3f2e98[_0x1126('0x4c')](get_open_tabs(_0x1126('0x47'),_0x53b685[_0x1126('0x48')]));_0x3f2e98[_0x1126('0x4c')](get_open_tabs(_0x1126('0x49'),_0x53b685[_0x1126('0x48')]));_0x3f2e98[_0x1126('0x4c')](get_open_tabs(_0x1126('0x4b'),_0x53b685[_0x1126('0x48')]));_0x3f2e98[_0x1126('0x4c')](get_open_tabs(_0x1126('0x4d'),_0x53b685['dataValues']));_0x3f2e98[_0x1126('0x4c')](get_open_tabs(_0x1126('0x4a'),_0x53b685[_0x1126('0x48')]));_0x3f2e98[_0x1126('0x4c')](get_open_tabs(_0x1126('0xb7'),_0x53b685[_0x1126('0x48')]));return BPromise[_0x1126('0x58')](_0x3f2e98);})['then'](function(_0x54a11c){var _0x5d7a22=[];if(_0x54a11c){for(var _0x1b77c0=0x0;_0x1b77c0=_0x3496c3){_0x558fd2=_0x3496c3;_0x439173=0xc8;}else{_0x439173=0xce;}_0x4093a4[_0x3d94('0x19')](_0x439173);return _0x4093a4[_0x3d94('0x1f')](_0x3d94('0x20'),_0x5b3b31+'-'+_0x558fd2+'/'+_0x3496c3)['json'](_0x27f978);}return null;};}function saveUpdates(_0x584c4a){return function(_0x362642){if(_0x362642){return _0x362642['update'](_0x584c4a)['then'](function(_0x23d20d){return _0x23d20d;});}return null;};}function removeEntity(_0x58c0d0){return function(_0x19bfd4){if(_0x19bfd4){return _0x19bfd4[_0x3d94('0x21')]()[_0x3d94('0x22')](function(){var _0x4cef9c=_0x19bfd4[_0x3d94('0x23')]({'plain':!![]});if(_0x4cef9c['role']===_0x3d94('0x24'))return;var _0x53db78=[{'name':_0x3d94('0x25'),'value':_0x3d94('0x26'),'ignore':!![]},{'name':_0x3d94('0x27'),'value':_0x3d94('0x28'),'ignore':![]},{'name':'Telephones','value':_0x3d94('0x29'),'ignore':![]}];var _0x51f634=_(_0x53db78)[_0x3d94('0x2a')](_0x3d94('0x2b'))['map']('value')[_0x3d94('0x2c')]();if(_[_0x3d94('0x2d')](_0x51f634,_0x4cef9c[_0x3d94('0x2e')])){return;}var _0x5cdb2e=_[_0x3d94('0x2f')](_0x53db78,[_0x3d94('0x2c'),_0x4cef9c['role']])[_0x3d94('0x30')];return db[_0x3d94('0x31')][_0x3d94('0x21')]({'where':{'type':_0x5cdb2e,'resourceId':_0x4cef9c['id']}})[_0x3d94('0x22')](function(){return _0x19bfd4;});})[_0x3d94('0x22')](function(){_0x58c0d0['status'](0xcc)[_0x3d94('0x32')]();});}};}function handleEntityNotFound(_0x42b742){return function(_0x41579e){if(!_0x41579e){_0x42b742[_0x3d94('0x18')](0x194);}return _0x41579e;};}function handleError(_0xb493f1,_0x441523){_0x441523=_0x441523||0x1f4;return function(_0x546658){logger['error'](_0x546658[_0x3d94('0x33')]);if(_0x546658[_0x3d94('0x30')]){delete _0x546658[_0x3d94('0x30')];}_0xb493f1[_0x3d94('0x19')](_0x441523)[_0x3d94('0x34')](_0x546658);};}exports[_0x3d94('0x35')]=function(_0x2ef743,_0x12c01a){var _0x2e7b97={},_0x2235f9={'count':0x0,'rows':[]};var _0x4e2244=_(db[_0x3d94('0x36')][_0x3d94('0x37')])[_0x3d94('0x38')](function(_0xcc289a){return{'name':_0xcc289a['fieldName'],'type':_0xcc289a[_0x3d94('0x39')][_0x3d94('0x3a')]};})[_0x3d94('0x2a')](function(_0x29eaa4){return!_[_0x3d94('0x2d')](['password',_0x3d94('0x3b')],_0x29eaa4[_0x3d94('0x30')]);})[_0x3d94('0x2c')]();_0x2e7b97=qs['getOptions'](_0x4e2244,_0x2ef743);var _0x4eee4d={'where':_0x2e7b97['where']};return db['User'][_0x3d94('0x1e')](_0x4eee4d)[_0x3d94('0x22')](function(_0x2ebcb1){_0x2235f9[_0x3d94('0x1e')]=_0x2ebcb1;if(_0x2ef743[_0x3d94('0x3c')][_0x3d94('0x3d')]){_0x2e7b97[_0x3d94('0x3e')]=[{'all':!![]}];}if(!_['includes'](_0x2e7b97['attributes'],'id')){_0x2e7b97[_0x3d94('0x3f')][_0x3d94('0x40')]('id');}return db['User'][_0x3d94('0x41')](_0x2e7b97);})['then'](function(_0x1361fb){_0x2235f9[_0x3d94('0x42')]=_0x1361fb;if(_0x2ef743[_0x3d94('0x3c')][_0x3d94('0x43')]===_0x3d94('0x44')){var _0x5a9263=[];for(var _0x3e0da8=0x0;_0x3e0da8<_0x2235f9[_0x3d94('0x42')][_0x3d94('0x45')];_0x3e0da8++){_0x5a9263['push'](get_open_tabs(_0x3d94('0x46'),_0x2235f9['rows'][_0x3e0da8]['dataValues']));_0x5a9263[_0x3d94('0x40')](get_open_tabs(_0x3d94('0x47'),_0x2235f9[_0x3d94('0x42')][_0x3e0da8][_0x3d94('0x48')]));_0x5a9263['push'](get_open_tabs(_0x3d94('0x49'),_0x2235f9['rows'][_0x3e0da8][_0x3d94('0x48')]));_0x5a9263[_0x3d94('0x40')](get_open_tabs(_0x3d94('0x4a'),_0x2235f9[_0x3d94('0x42')][_0x3e0da8][_0x3d94('0x48')]));_0x5a9263[_0x3d94('0x40')](get_open_tabs(_0x3d94('0x4b'),_0x2235f9['rows'][_0x3e0da8][_0x3d94('0x48')]));_0x5a9263[_0x3d94('0x40')](get_open_tabs('whatsapp',_0x2235f9['rows'][_0x3e0da8][_0x3d94('0x48')]));}return BPromise[_0x3d94('0x4c')](_0x5a9263)['then'](function(_0x3c8571){return _0x2235f9;});}else{return _0x2235f9;}})[_0x3d94('0x22')](respondWithFilteredResult(_0x12c01a,_0x2e7b97))[_0x3d94('0x17')](handleError(_0x12c01a,null));};exports[_0x3d94('0x4d')]=function(_0x30ce31,_0x237056){var _0x197243={'raw':![],'where':{'id':_0x30ce31[_0x3d94('0x4e')]['id']}},_0x12babd={};_0x12babd[_0x3d94('0x4f')]=_[_0x3d94('0x50')](_[_0x3d94('0x51')](db[_0x3d94('0x36')][_0x3d94('0x37')]),[_0x3d94('0x52'),'salt']);_0x12babd[_0x3d94('0x3c')]=_[_0x3d94('0x51')](_0x30ce31[_0x3d94('0x3c')]);_0x12babd[_0x3d94('0x53')]=_[_0x3d94('0x54')](_0x12babd[_0x3d94('0x4f')],_0x12babd[_0x3d94('0x3c')]);_0x197243[_0x3d94('0x3f')]=_[_0x3d94('0x54')](_0x12babd['model'],qs[_0x3d94('0x55')](_0x30ce31['query'][_0x3d94('0x55')]));_0x197243[_0x3d94('0x3f')]=_0x197243['attributes'][_0x3d94('0x45')]?_0x197243['attributes']:_0x12babd['model'];if(_0x30ce31[_0x3d94('0x3c')]['includeAll']){_0x197243[_0x3d94('0x3e')]=[{'all':!![]}];}_0x197243=_[_0x3d94('0x56')]({},_0x197243,_0x30ce31['options']);if(!_[_0x3d94('0x2d')](_0x197243['attributes'],'id')){_0x197243['attributes'][_0x3d94('0x40')]('id');}return db[_0x3d94('0x36')][_0x3d94('0x2f')](_0x197243)[_0x3d94('0x22')](handleEntityNotFound(_0x237056,null))[_0x3d94('0x22')](function(_0x3e49f5){var _0x137052=[];values=_0x3e49f5;if(_0x30ce31[_0x3d94('0x3c')][_0x3d94('0x43')]==='true'){_0x137052[_0x3d94('0x40')](get_open_tabs(_0x3d94('0x46'),_0x3e49f5[_0x3d94('0x48')]));_0x137052[_0x3d94('0x40')](get_open_tabs(_0x3d94('0x47'),_0x3e49f5[_0x3d94('0x48')]));_0x137052[_0x3d94('0x40')](get_open_tabs(_0x3d94('0x4b'),_0x3e49f5[_0x3d94('0x48')]));_0x137052[_0x3d94('0x40')](get_open_tabs(_0x3d94('0x57'),_0x3e49f5['dataValues']));_0x137052[_0x3d94('0x40')](get_open_tabs('fax',_0x3e49f5[_0x3d94('0x48')]));_0x137052[_0x3d94('0x40')](get_open_tabs(_0x3d94('0x4a'),_0x3e49f5[_0x3d94('0x48')]));return BPromise[_0x3d94('0x4c')](_0x137052);}else{return values;}})[_0x3d94('0x22')](function(_0x1c503d){return values;})[_0x3d94('0x22')](respondWithResult(_0x237056,null))[_0x3d94('0x17')](handleError(_0x237056,null));};exports['update']=function(_0x519ada,_0x46bff3){if(_0x519ada['body']['id']){delete _0x519ada[_0x3d94('0x58')]['id'];}delete _0x519ada[_0x3d94('0x58')]['role'];return db[_0x3d94('0x36')][_0x3d94('0x2f')]({'where':{'id':_0x519ada[_0x3d94('0x4e')]['id']}})[_0x3d94('0x22')](handleEntityNotFound(_0x46bff3,null))[_0x3d94('0x22')](saveUpdates(_0x519ada[_0x3d94('0x58')],null))[_0x3d94('0x22')](respondWithResult(_0x46bff3,null))['catch'](handleError(_0x46bff3,null));};exports[_0x3d94('0x59')]=function(_0x351ea6,_0x368581){return db['User'][_0x3d94('0x59')]()[_0x3d94('0x22')](respondWithResult(_0x368581,null))[_0x3d94('0x17')](handleError(_0x368581,null));};exports[_0x3d94('0x5a')]=function(_0x5cdfb0,_0x5292cc){return db[_0x3d94('0x36')][_0x3d94('0x2f')]({'where':{'id':_0x5cdfb0[_0x3d94('0x4e')]['id']}})[_0x3d94('0x22')](handleEntityNotFound(_0x5292cc,null))['then'](function(_0x1c12da){if(_0x1c12da){return _0x1c12da[_0x3d94('0x5a')](_0x5cdfb0['body'][_0x3d94('0x5b')],_[_0x3d94('0x5c')](_0x5cdfb0[_0x3d94('0x58')],['ids','id'])||{});}})[_0x3d94('0x22')](respondWithResult(_0x5292cc,null))[_0x3d94('0x17')](handleError(_0x5292cc,null));};function validateUser(_0x585531){return new BPromise(function(_0x5747a8,_0x11eeaa){if(_0x585531[_0x3d94('0x5d')])return _0x5747a8(_0x585531);return db['Setting']['findById'](0x1)['then'](function(_0x3ac9ea){if(_0x3ac9ea[_0x3d94('0x5e')])authService[_0x3d94('0x5f')](_0x585531[_0x3d94('0x52')]);db[_0x3d94('0x36')]['max'](_0x3d94('0x5d'))[_0x3d94('0x22')](function(_0x170d06){if(_[_0x3d94('0x60')](_0x170d06)){_0x585531[_0x3d94('0x5d')]=_0x3ac9ea[_0x3d94('0x61')]||0x1;return;}if(_['isNil'](_0x3ac9ea[_0x3d94('0x61')])||_0x3ac9ea['min_internal']===_0x170d06){_0x585531[_0x3d94('0x5d')]=_0x170d06+0x1;return;}if(_0x3ac9ea[_0x3d94('0x61')]>_0x170d06){_0x585531[_0x3d94('0x5d')]=_0x3ac9ea[_0x3d94('0x61')];return;}return db[_0x3d94('0x62')][_0x3d94('0x3c')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db['sequelize'][_0x3d94('0x63')]['SELECT']})['then'](function(_0x5c5fb2){if(_0x5c5fb2&&_0x5c5fb2[_0x3d94('0x45')]){for(var _0x262a6a=0x0,_0x222963=_0x5c5fb2[_0x3d94('0x45')];_0x262a6a<_0x222963&&_[_0x3d94('0x60')](_0x585531[_0x3d94('0x5d')]);_0x262a6a++){if(_0x3ac9ea[_0x3d94('0x61')]<=_0x5c5fb2[_0x262a6a][_0x3d94('0x64')]){_0x585531['internal']=_0x5c5fb2[_0x262a6a][_0x3d94('0x64')];}else if(_0x3ac9ea['min_internal']>_0x5c5fb2[_0x262a6a][_0x3d94('0x64')]&&_0x3ac9ea[_0x3d94('0x61')]<=_0x5c5fb2[_0x262a6a]['to']){_0x585531[_0x3d94('0x5d')]=_0x3ac9ea['min_internal'];}}}if(_['isNil'](_0x585531['internal'])){_0x585531[_0x3d94('0x5d')]=_0x170d06+0x1;}return _0x5747a8(_0x585531);});});})[_0x3d94('0x17')](function(_0x2c9c83){_0x11eeaa(_0x2c9c83);});});}function updateUser(_0x1c7ea5){return new BPromise(function(_0x2382df,_0x51b90e){try{if(_0x1c7ea5['voicemail']){_0x1c7ea5[_0x3d94('0x65')]=_0x1c7ea5[_0x3d94('0x5d')];_0x1c7ea5[_0x3d94('0x66')]={'mailbox':_0x1c7ea5['internal'],'password':_0x1c7ea5[_0x3d94('0x52')],'fullname':_0x1c7ea5['fullname'],'email':_0x1c7ea5[_0x3d94('0x67')]};}if(_0x1c7ea5[_0x3d94('0x2e')]===_0x3d94('0x28')){if(!_0x1c7ea5[_0x3d94('0x68')])_0x1c7ea5[_0x3d94('0x68')]=[_0x3d94('0x69'),_0x3d94('0x6a'),_0x3d94('0x6b'),_0x3d94('0x6c'),_0x3d94('0x6d'),_0x3d94('0x6e'),_0x3d94('0x6f'),_0x3d94('0x70'),'107',_0x3d94('0x71'),_0x3d94('0x72'),_0x3d94('0x73'),_0x3d94('0x74'),'114',_0x3d94('0x75')];}_0x2382df(_0x1c7ea5);}catch(_0x5e03b0){_0x51b90e(_0x5e03b0);}});}exports['create']=function(_0x307dda,_0x55fed9){if(_0x307dda[_0x3d94('0x26')][_0x3d94('0x2e')]==='agent')throw new Error(_0x3d94('0x76'));if(_0x307dda['body'][_0x3d94('0x2e')]===_0x3d94('0x26')&&_0x307dda['user']['role']!=='admin'){throw new Error(_0x3d94('0x77'));}if(_0x307dda['body']['role']===_0x3d94('0x24')&&_0x307dda[_0x3d94('0x26')][_0x3d94('0x2e')]!==_0x3d94('0x24')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x3d94('0x78')]([_0x307dda[_0x3d94('0x58')]])[_0x3d94('0x22')](function(){return validateUser(_0x307dda[_0x3d94('0x58')]);})[_0x3d94('0x22')](function(_0x200cc2){return updateUser(_0x200cc2)['then'](function(_0x467ccb){if(_0x467ccb[_0x3d94('0x2e')]===_0x3d94('0x24')){_0x467ccb[_0x3d94('0x79')]=_0x307dda[_0x3d94('0x26')][_0x3d94('0x79')];delete _0x467ccb[_0x3d94('0x7a')];}return _0x467ccb;});})[_0x3d94('0x22')](function(_0x4b3ed5){return db['User'][_0x3d94('0x7b')](_0x4b3ed5,{'include':[{'model':db[_0x3d94('0x66')],'as':_0x3d94('0x66')}]});})['then'](function(_0x43a00e){if(_0x307dda[_0x3d94('0x58')][_0x3d94('0x2e')]===_0x3d94('0x26'))return _0x43a00e;if(_0x307dda[_0x3d94('0x26')]['role']!=='user')return _0x43a00e;return db[_0x3d94('0x7c')][_0x3d94('0x2f')]({'where':{'name':_0x43a00e[_0x3d94('0x2e')]===_0x3d94('0x28')?_0x3d94('0x27'):_0x3d94('0x7d'),'userProfileId':_0x307dda[_0x3d94('0x26')][_0x3d94('0x7a')]},'raw':!![]})[_0x3d94('0x22')](function(_0x35caf5){if(!_0x35caf5||_0x35caf5[_0x3d94('0x7e')]!=0x0)return _0x43a00e;return db[_0x3d94('0x31')][_0x3d94('0x7b')]({'name':_0x43a00e['name'],'resourceId':_0x43a00e['id'],'type':_0x35caf5[_0x3d94('0x30')],'sectionId':_0x35caf5['id']},{})[_0x3d94('0x22')](function(){return _0x43a00e;});})['catch'](function(_0x5d3d6e){logger[_0x3d94('0x14')](_0x3d94('0x7f'),_0x5d3d6e);throw _0x5d3d6e;});})[_0x3d94('0x22')](respondWithResult(_0x55fed9,0xc9))[_0x3d94('0x17')](handleError(_0x55fed9,null));};exports['bulkCreate']=function(_0x482e99,_0x1f3171){var _0x2ec7d9=_0x482e99[_0x3d94('0x58')];var _0x22283d=[];if(_0x482e99[_0x3d94('0x26')]['role']===_0x3d94('0x28'))throw new Error('Unauthorized');if(_[_0x3d94('0x80')](_0x2ec7d9,[_0x3d94('0x2e'),_0x3d94('0x26')])&&_0x482e99['user'][_0x3d94('0x2e')]!==_0x3d94('0x24')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x3d94('0x80')](_0x2ec7d9,['role',_0x3d94('0x24')])&&_0x482e99[_0x3d94('0x26')][_0x3d94('0x2e')]!=='admin'){throw new Error(_0x3d94('0x81'));}return licenseUtil[_0x3d94('0x78')](_0x2ec7d9)[_0x3d94('0x22')](function(){return validateUser(_0x2ec7d9[0x0]);})['then'](function(){for(var _0x3e091a=0x1;_0x3e091a<_0x2ec7d9[_0x3d94('0x45')];_0x3e091a++){var _0x259484=_0x2ec7d9[_0x3e091a-0x1][_0x3d94('0x5d')];if(!_0x2ec7d9[_0x3e091a][_0x3d94('0x5d')])_0x2ec7d9[_0x3e091a][_0x3d94('0x5d')]=_0x259484+0x1;_0x22283d[_0x3d94('0x40')](validateUser(_0x2ec7d9[_0x3e091a]));}return BPromise[_0x3d94('0x4c')](_0x22283d);})['then'](function(){_0x22283d=[];for(var _0x217564=0x0;_0x217564<_0x2ec7d9[_0x3d94('0x45')];_0x217564++){_0x22283d[_0x3d94('0x40')](updateUser(_0x2ec7d9[_0x217564]));}return BPromise[_0x3d94('0x4c')](_0x22283d);})[_0x3d94('0x22')](function(){return BPromise[_0x3d94('0x82')](_0x2ec7d9,function(_0x5716fd){return db[_0x3d94('0x36')][_0x3d94('0x7b')](_0x5716fd,{'include':[{'model':db[_0x3d94('0x66')],'as':'VoiceMail'}]})[_0x3d94('0x22')](function(_0x4c6c49){_0x5716fd['id']=_0x4c6c49['id'];return _0x5716fd;});});})[_0x3d94('0x22')](function(_0x3ed74f){if(_0x482e99['body'][_0x3d94('0x2e')]===_0x3d94('0x26'))return _0x3ed74f;if(_0x482e99['user']['role']!==_0x3d94('0x26'))return _0x3ed74f;var _0x36e87c=_['some'](_0x3ed74f,function(_0x5007ef){return _0x5007ef['role']===_0x3d94('0x28')||_0x5007ef[_0x3d94('0x2e')]===_0x3d94('0x29');});if(!_0x36e87c)return _0x3ed74f;return db[_0x3d94('0x7c')][_0x3d94('0x41')]({'where':{'name':{'$or':['Agents',_0x3d94('0x7d')]},'userProfileId':_0x482e99[_0x3d94('0x26')][_0x3d94('0x7a')]},'raw':!![]})['then'](function(_0x2f90c4){if(_['isEmpty'](_0x2f90c4)||!_[_0x3d94('0x80')](_0x2f90c4,[_0x3d94('0x7e'),0x0]))return _0x3ed74f;_0x22283d=[];var _0x25015e=_(_0x2f90c4)[_0x3d94('0x38')](function(_0x4527e1){if(_0x4527e1['autoAssociation']===0x1)return;return _0x4527e1['name']===_0x3d94('0x27')?_0x3d94('0x28'):'telephone';})[_0x3d94('0x83')]()['value']();for(var _0x34f1ce=0x0;_0x34f1ce<_0x3ed74f[_0x3d94('0x45')];_0x34f1ce++){if(!_[_0x3d94('0x2d')](_0x25015e,_0x3ed74f[_0x34f1ce]['role']))return;var _0x406528=_0x3ed74f[_0x34f1ce]['role']===_0x3d94('0x28')?_0x3d94('0x27'):_0x3d94('0x7d');_0x22283d[_0x3d94('0x40')](db['UserProfileResource']['create']({'name':_0x3ed74f[_0x34f1ce][_0x3d94('0x30')],'resourceId':_0x3ed74f[_0x34f1ce]['id'],'type':_0x406528,'sectionId':_[_0x3d94('0x2f')](_0x2f90c4,[_0x3d94('0x30'),_0x406528])['id']},{}));}return BPromise[_0x3d94('0x4c')](_0x22283d);});})['then'](respondWithResult(_0x1f3171,0xc9))[_0x3d94('0x17')](handleError(_0x1f3171,null));};exports['changePassword']=function(_0x49c674,_0x543b1a){if(_0x49c674[_0x3d94('0x58')]['id']){delete _0x49c674[_0x3d94('0x58')]['id'];}return db[_0x3d94('0x36')][_0x3d94('0x2f')]({'where':{'id':_0x49c674[_0x3d94('0x4e')]['id']}})[_0x3d94('0x22')](function(_0x33af12){if(!_0x33af12)return null;if(_0x33af12['id']===_0x49c674[_0x3d94('0x26')]['id']){if(!_0x49c674[_0x3d94('0x58')][_0x3d94('0x84')]||!_0x49c674[_0x3d94('0x58')][_0x3d94('0x85')]){throw new db[(_0x3d94('0x86'))][(_0x3d94('0x87'))](_0x3d94('0x88'));}if(!_0x33af12['authenticate'](_0x49c674['body'][_0x3d94('0x84')])){throw new db[(_0x3d94('0x86'))][(_0x3d94('0x87'))](_0x3d94('0x89'));}if(_0x49c674[_0x3d94('0x58')][_0x3d94('0x84')]===_0x49c674[_0x3d94('0x58')]['newPassword']){throw new db[(_0x3d94('0x86'))][(_0x3d94('0x87'))](_0x3d94('0x8a'));}}else if(_0x49c674[_0x3d94('0x26')][_0x3d94('0x2e')]===_0x3d94('0x24')){if(!_0x49c674['body']['newPassword']){throw new db[(_0x3d94('0x86'))]['ValidationError'](_0x3d94('0x8b'));}}else if(_0x49c674[_0x3d94('0x26')][_0x3d94('0x2e')]===_0x3d94('0x26')){if(!_0x49c674[_0x3d94('0x58')][_0x3d94('0x85')]){throw new db[(_0x3d94('0x86'))][(_0x3d94('0x87'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x33af12[_0x3d94('0x2e')]!==_0x3d94('0x28')){throw new db[(_0x3d94('0x86'))][(_0x3d94('0x87'))](_0x3d94('0x76'));}}else{throw new db[(_0x3d94('0x86'))][(_0x3d94('0x87'))](_0x3d94('0x76'));}return _0x33af12;})[_0x3d94('0x22')](handleEntityNotFound(_0x543b1a,null))[_0x3d94('0x22')](function(_0x285a35){return db[_0x3d94('0x8c')][_0x3d94('0x8d')]({'attributes':['id',_0x3d94('0x5e'),_0x3d94('0x8e'),_0x3d94('0x8f')]})[_0x3d94('0x22')](function(_0x252c96){if(_0x252c96[_0x3d94('0x5e')])authService[_0x3d94('0x5f')](_0x49c674[_0x3d94('0x58')]['newPassword']);if(!_0x252c96[_0x3d94('0x8e')]||!_0x285a35[_0x3d94('0x90')])return _0x285a35;authService[_0x3d94('0x91')](_0x49c674[_0x3d94('0x58')][_0x3d94('0x85')],_0x285a35[_0x3d94('0x90')],_0x252c96['passwordHistoryLimit']);return _0x285a35;})[_0x3d94('0x22')](saveUpdates({'password':_0x49c674[_0x3d94('0x58')][_0x3d94('0x85')],'passwordResetAt':_0x49c674[_0x3d94('0x26')]['id']==_0x49c674[_0x3d94('0x4e')]['id']?moment():null,'previousPasswords':authService[_0x3d94('0x92')](_0x49c674['body'][_0x3d94('0x85')],_0x285a35[_0x3d94('0x90')])},null));})['then'](respondWithResult(_0x543b1a,null))['catch'](handleError(_0x543b1a,null));};exports['addQueues']=function(_0x3e1139,_0x77b79d){var _0x20b52d=_0x3e1139[_0x3d94('0x58')][_0x3d94('0x93')];return db['User'][_0x3d94('0x2f')]({'where':{'id':_0x3e1139[_0x3d94('0x4e')]['id']},'attributes':['id',_0x3d94('0x30'),_0x3d94('0x2e'),_0x3d94('0x94'),_0x3d94('0x95'),'voicePause',_0x3d94('0x96')]})['then'](handleEntityNotFound(_0x77b79d,null))[_0x3d94('0x22')](function(_0xb970e1){if(_0xb970e1){if(!utils[_0x3d94('0x97')](_0x20b52d)){throw new db[(_0x3d94('0x86'))]['ValidationError'](_0x3d94('0x98'));}return _0xb970e1[_0x3d94('0x99')+_[_0x3d94('0x9a')](_0x20b52d[_0x3d94('0x9b')]())+'Queues'](_0x3e1139['body'][_0x3d94('0x5b')],{'penalty':_0x3e1139[_0x3d94('0x58')][_0x3d94('0x9c')]||0x0})['spread'](function(_0x2fac35){for(var _0x5ac055=0x0;_0x5ac055<_0x3e1139['body'][_0x3d94('0x5b')][_0x3d94('0x45')];_0x5ac055+=0x1){var _0x4ae177={'UserId':Number(_0x3e1139[_0x3d94('0x4e')]['id'])};_0x4ae177[_[_0x3d94('0x9a')](_0x20b52d[_0x3d94('0x9b')]())+'QueueId']=Number(_0x3e1139[_0x3d94('0x58')][_0x3d94('0x5b')][_0x5ac055]);socket['emit']('user'+_[_0x3d94('0x9a')](_0x20b52d[_0x3d94('0x9b')]())+_0x3d94('0x9d'),_0x4ae177);}return _0x2fac35;})[_0x3d94('0x22')](function(){if(_0x20b52d===_0x3d94('0x9e')){return db[_0x3d94('0x9f')]['findAll']({'where':{'id':_0x3e1139['body']['ids']||[]},'raw':!![],'attributes':['id','name']});}})[_0x3d94('0x22')](function(_0x3950d1){var _0xe2f687=_0xb970e1[_0x3d94('0x23')]({'plain':!![]});var _0x283705=[];if(_0x20b52d===_0x3d94('0x9e')&&_0xe2f687[_0x3d94('0x2e')]===_0x3d94('0x28')&&_0xe2f687[_0x3d94('0x94')]){for(var _0x414b82=0x0;_0x414b82<_0x3950d1[_0x3d94('0x45')];_0x414b82+=0x1){_0x283705['push']({'membername':_0xe2f687[_0x3d94('0x30')],'UserId':_0xe2f687['id'],'queue_name':_0x3950d1[_0x414b82]['name'],'VoiceQueueId':_0x3950d1[_0x414b82]['id'],'interface':_[_0x3d94('0x60')](_0xe2f687[_0x3d94('0x96')])?util[_0x3d94('0xa0')](_0x3d94('0xa1'),_0xe2f687[_0x3d94('0x30')]):_0xe2f687[_0x3d94('0x96')],'paused':_0xe2f687[_0x3d94('0xa2')]||![],'penalty':_0x3e1139[_0x3d94('0x58')]['penalty']||0x0});}return BPromise[_0x3d94('0x82')](_0x283705,function(_0x11ae22){return db[_0x3d94('0xa3')][_0x3d94('0xa4')](_0x11ae22);});}return _0xb970e1;});}})[_0x3d94('0x22')](respondWithStatusCode(_0x77b79d,null))[_0x3d94('0x17')](handleError(_0x77b79d,null));};exports[_0x3d94('0xa5')]=function(_0x1b7ad4,_0x483e7a){var _0x2f82cb;return db[_0x3d94('0x36')][_0x3d94('0x2f')]({'where':{'id':_0x1b7ad4[_0x3d94('0x4e')]['id']},'attributes':['id',_0x3d94('0x30'),_0x3d94('0x2e')]})[_0x3d94('0x22')](handleEntityNotFound(_0x483e7a,null))[_0x3d94('0x22')](function(_0x5ace4e){if(_0x5ace4e){_0x2f82cb=_0x5ace4e;if(!_0x1b7ad4[_0x3d94('0x3c')][_0x3d94('0x93')]||!utils['isValidChannel'](_0x1b7ad4[_0x3d94('0x3c')][_0x3d94('0x93')])){throw new db[(_0x3d94('0x86'))][(_0x3d94('0x87'))](_0x3d94('0x98'));}return _0x5ace4e[_0x3d94('0xa6')+_[_0x3d94('0x9a')](_0x1b7ad4[_0x3d94('0x3c')][_0x3d94('0x93')][_0x3d94('0x9b')]())+_0x3d94('0xa7')](_0x1b7ad4[_0x3d94('0x3c')][_0x3d94('0x5b')]);}})[_0x3d94('0x22')](function(_0x186c79){if(_[_0x3d94('0xa8')](_0x1b7ad4[_0x3d94('0x3c')][_0x3d94('0x5b')])){for(var _0x2f6440=0x0;_0x2f6440<_0x1b7ad4[_0x3d94('0x3c')][_0x3d94('0x5b')][_0x3d94('0x45')];_0x2f6440+=0x1){var _0x41fd2c={'UserId':Number(_0x1b7ad4[_0x3d94('0x4e')]['id'])};_0x41fd2c[_[_0x3d94('0x9a')](_0x1b7ad4['query']['channel'][_0x3d94('0x9b')]())+'QueueId']=Number(_0x1b7ad4['query'][_0x3d94('0x5b')][_0x2f6440]);socket[_0x3d94('0xa9')](_0x3d94('0x26')+_[_0x3d94('0x9a')](_0x1b7ad4[_0x3d94('0x3c')]['channel'][_0x3d94('0x9b')]())+'Queue:remove',_0x41fd2c);}}else{var _0x41fd2c={'UserId':Number(_0x1b7ad4[_0x3d94('0x4e')]['id'])};_0x41fd2c[_[_0x3d94('0x9a')](_0x1b7ad4[_0x3d94('0x3c')][_0x3d94('0x93')][_0x3d94('0x9b')]())+_0x3d94('0xaa')]=Number(_0x1b7ad4[_0x3d94('0x3c')][_0x3d94('0x5b')]);socket[_0x3d94('0xa9')](_0x3d94('0x26')+_[_0x3d94('0x9a')](_0x1b7ad4[_0x3d94('0x3c')][_0x3d94('0x93')][_0x3d94('0x9b')]())+'Queue:remove',_0x41fd2c);}return _0x186c79;})['then'](function(){if(_0x1b7ad4['query'][_0x3d94('0x93')]===_0x3d94('0x9e')){return db['UserVoiceQueueRt'][_0x3d94('0x21')]({'where':{'UserId':_0x1b7ad4[_0x3d94('0x4e')]['id'],'VoiceQueueId':_0x1b7ad4['query'][_0x3d94('0x5b')]},'individualHooks':!![]})[_0x3d94('0x22')](function(){return _0x2f82cb;});}return _0x2f82cb;})[_0x3d94('0x22')](respondWithStatusCode(_0x483e7a,null))[_0x3d94('0x17')](handleError(_0x483e7a,null));};exports[_0x3d94('0xab')]=function(_0x478f09,_0x36df43){_0x478f09[_0x3d94('0x58')][_0x3d94('0xac')]=_0x478f09[_0x3d94('0xad')][_0x3d94('0xae')];return db[_0x3d94('0x36')][_0x3d94('0x2f')]({'where':{'id':_0x478f09[_0x3d94('0x4e')]['id']}})[_0x3d94('0x22')](handleEntityNotFound(_0x36df43,null))['then'](saveUpdates(_0x478f09[_0x3d94('0x58')],null))[_0x3d94('0x22')](respondWithResult(_0x36df43,null))[_0x3d94('0x17')](handleError(_0x36df43,null));};exports[_0x3d94('0xaf')]=function(_0x258a63,_0x359d07){var _0x4bb2f8=path['join'](config[_0x3d94('0xb0')],_0x3d94('0xb1'));return db['User'][_0x3d94('0x2f')]({'where':{'id':_0x258a63[_0x3d94('0x4e')]['id']},'attributes':['id',_0x3d94('0xac')],'raw':!![]})[_0x3d94('0x22')](handleEntityNotFound(_0x359d07,null))[_0x3d94('0x22')](function(_0x5c192c){if(_0x5c192c){if(_[_0x3d94('0x60')](_0x5c192c['userpic'])){return _0x359d07[_0x3d94('0xb2')](_0x4bb2f8);}else{if(!fs['existsSync'](path['join'](config[_0x3d94('0xb0')],_0x3d94('0xb3'),_0x5c192c[_0x3d94('0xac')]))){return _0x359d07[_0x3d94('0xb2')](_0x4bb2f8);}return _0x359d07[_0x3d94('0xb2')](path['join'](config[_0x3d94('0xb0')],'server/files/images/',_0x5c192c['userpic']));}}})['catch'](handleError(_0x359d07,null));};exports[_0x3d94('0xb4')]=function(_0x5dcf61,_0x67afd6){return db[_0x3d94('0x36')][_0x3d94('0x2f')]({'where':{'id':_0x5dcf61[_0x3d94('0x4e')]['id']},'attributes':['id']})[_0x3d94('0x22')](handleEntityNotFound(_0x67afd6,null))['then'](function(_0x1067f1){var _0x3956f9=[];values=_0x1067f1[_0x3d94('0x48')];_0x3956f9[_0x3d94('0x40')](get_open_tabs(_0x3d94('0x46'),_0x1067f1[_0x3d94('0x48')]));_0x3956f9['push'](get_open_tabs(_0x3d94('0x47'),_0x1067f1['dataValues']));_0x3956f9['push'](get_open_tabs(_0x3d94('0x4b'),_0x1067f1['dataValues']));_0x3956f9[_0x3d94('0x40')](get_open_tabs(_0x3d94('0x57'),_0x1067f1[_0x3d94('0x48')]));_0x3956f9['push'](get_open_tabs('fax',_0x1067f1[_0x3d94('0x48')]));_0x3956f9['push'](get_open_tabs(_0x3d94('0x4a'),_0x1067f1[_0x3d94('0x48')]));return BPromise['all'](_0x3956f9);})[_0x3d94('0x22')](function(_0x927882){var _0x302510=[];if(_0x927882){for(var _0x2f0128=0x0;_0x2f0128=_0x5981fd[_0x7a57('0x54')]){throw new Error(_0x7a57('0x55'));}})['then'](function(){if(_0x2afc04){return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x2afc04[_0x7a57('0x29')]},'individualHooks':!![]});}})[_0x7a57('0x10')](function(){if(_0x2afc04){return _0x2afc04['getVoiceQueues']({'raw':!![]});}})[_0x7a57('0x10')](function(_0x3687e5){if(_0x2afc04){if(_0x3687e5){var _0x4afb9b=[];_0x25d7a5=_0x3687e5;if(_0x25d7a5['length']){for(var _0x818bc2=0x0;_0x818bc2<_0x25d7a5[_0x7a57('0x30')];_0x818bc2++){_0x4afb9b['push'](db[_0x7a57('0x2d')][_0x7a57('0x56')]({'membername':_0x2afc04[_0x7a57('0x29')],'UserId':_0x2afc04['id'],'queue_name':_0x25d7a5[_0x818bc2][_0x7a57('0x29')],'VoiceQueueId':_0x25d7a5[_0x818bc2]['id'],'interface':_0x659679,'paused':_0x2afc04[_0x7a57('0x4f')]||![],'penalty':_0x25d7a5[_0x818bc2][_0x7a57('0x57')]||0x0}));}return BPromise['all'](_0x4afb9b);}}}})[_0x7a57('0x10')](function(){if(_0x2afc04){return db[_0x7a57('0x3a')]['findAll']({'where':{'membername':_0x2afc04[_0x7a57('0x29')],'exitAt':null}});}})['then'](function(_0x2d0865){if(_0x2afc04){if(_0x2d0865&&_0x2d0865[_0x7a57('0x30')]){var _0x3e7f8e=[];_0x2d0865[_0x7a57('0x49')](function(_0x5a5889){_0x3e7f8e[_0x7a57('0x33')](_0x5a5889['update']({'exitAt':moment()[_0x7a57('0x31')](_0x7a57('0x36'))}));});return BPromise[_0x7a57('0x4a')](_0x3e7f8e);}}})[_0x7a57('0x10')](function(_0x3f39d6){if(_0x2afc04){var _0x535746=[];var _0x48a4b5=[];var _0x285552=utils['getChannels']();var _0x6145fb={'membername':_0x2afc04['name'],'interface':_0x659679,'enterAt':moment()[_0x7a57('0x31')](_0x7a57('0x36')),'role':_0x2afc04['role'],'internal':_0x2afc04[_0x7a57('0x2b')]};_0x285552[_0x7a57('0x49')](function(_0x4a0321){_0x535746[_0x7a57('0x33')](_[_0x7a57('0x58')]({'channel':_0x4a0321,'type':_0x7a57('0x59'),'data1':'callysquare','data2':_0x659679},_0x6145fb));if(_0x2afc04[_0x7a57('0x4f')]){_0x48a4b5[_0x7a57('0x33')](_['merge']({'channel':_0x4a0321,'type':_0x7a57('0x2f'),'data1':_0x7a57('0x5a')},_0x6145fb));}});return db[_0x7a57('0x3a')][_0x7a57('0x3b')](_0x535746[_0x7a57('0x5b')](_0x48a4b5),{'individualHooks':!![]});}})['then'](function(){if(_0x2afc04){return _0x2afc04[_0x7a57('0x2e')]({'online':!![],'lastLoginAt':moment()['format'](_0x7a57('0x36')),'voicePause':_0x2afc04[_0x7a57('0x4f')]||![],'mailPause':_0x2afc04[_0x7a57('0x4f')]||![],'chatPause':_0x2afc04[_0x7a57('0x4f')]||![],'faxPause':_0x2afc04[_0x7a57('0x4f')]||![],'smsPause':_0x2afc04[_0x7a57('0x4f')]||![],'openchannelPause':_0x2afc04['loginInPause']||![],'pauseType':_0x2afc04[_0x7a57('0x4f')]?_0x7a57('0x5a'):null,'lastPauseAt':moment()[_0x7a57('0x31')](_0x7a57('0x36')),'interface':_0x659679});}})['then'](function(_0x5c2ea4){_0x28938d(_0x5c2ea4);})[_0x7a57('0x23')](function(_0x4f1495){_0x13a083(_0x2268ec[_0x7a57('0x16')](0x1f4,_0x4f1495[_0x7a57('0x18')]));});});}; \ No newline at end of file +var _0xa410=['lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','stringify','error','message','User,\x20%s,\x20%s','result','GetUser','User','findAll','options','where','attributes','limit','include','map','model','catch','find','raw','ShowUser','PauseUser','name','role','UserVoiceQueueRt','update','MemberReport','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','push','isNil','interface','PAUSE','body','type','internal','bulkCreate','DEFAULT\x20PAUSE','UnpauseUser','findOne','channel','system','chat','fax','sms','openchannel','%s%s','LogoutUser','destroy','forEach','all','LoginUser','mobile','phone','loginInPause','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE'];(function(_0x368bba,_0x1f625b){var _0x409f8f=function(_0x463373){while(--_0x463373){_0x368bba['push'](_0x368bba['shift']());}};_0x409f8f(++_0x1f625b);}(_0xa410,0x154));var _0x0a41=function(_0x2fc200,_0x8090f3){_0x2fc200=_0x2fc200-0x0;var _0x2964ac=_0xa410[_0x2fc200];return _0x2964ac;};'use strict';var _=require(_0x0a41('0x0'));var util=require('util');var moment=require(_0x0a41('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a41('0x2'))['db'];var utils=require(_0x0a41('0x3'));var logger=require(_0x0a41('0x4'))(_0x0a41('0x5'));var config=require(_0x0a41('0x6'));var jayson=require(_0x0a41('0x7'));var client=jayson[_0x0a41('0x8')][_0x0a41('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x0a41('0xa')],{'host':_0x0a41('0xb'),'port':0x18eb});var socket=require(_0x0a41('0xc'))(new Redis(config['redis']));require('./user.socket')[_0x0a41('0xd')](socket);function respondWithRpcPromise(_0x10d613,_0x2ce6d0,_0x45d2ed){return new BPromise(function(_0x2fe21b,_0xa2fb9f){return client[_0x0a41('0xe')](_0x10d613,_0x45d2ed)[_0x0a41('0xf')](function(_0x1aa7fa){logger[_0x0a41('0x10')]('User,\x20%s,\x20%s',_0x2ce6d0,_0x0a41('0x11'));logger[_0x0a41('0x12')]('User,\x20%s,\x20%s,\x20%s',_0x2ce6d0,'request\x20sent',JSON[_0x0a41('0x13')](_0x1aa7fa));if(_0x1aa7fa[_0x0a41('0x14')]){if(_0x1aa7fa[_0x0a41('0x14')]['code']===0x1f4){logger[_0x0a41('0x14')]('User,\x20%s,\x20%s',_0x2ce6d0,_0x1aa7fa[_0x0a41('0x14')][_0x0a41('0x15')]);return _0xa2fb9f(_0x1aa7fa['error'][_0x0a41('0x15')]);}logger[_0x0a41('0x14')](_0x0a41('0x16'),_0x2ce6d0,_0x1aa7fa[_0x0a41('0x14')][_0x0a41('0x15')]);return _0x2fe21b(_0x1aa7fa[_0x0a41('0x14')]['message']);}else{logger[_0x0a41('0x10')](_0x0a41('0x16'),_0x2ce6d0,'request\x20sent');_0x2fe21b(_0x1aa7fa[_0x0a41('0x17')]['message']);}})['catch'](function(_0x5b427e){logger['error'](_0x0a41('0x16'),_0x2ce6d0,_0x5b427e);_0xa2fb9f(_0x5b427e);});});}exports[_0x0a41('0x18')]=function(_0x567661){var _0x104f0e=this;return new Promise(function(_0x435b29,_0x2c684a){return db[_0x0a41('0x19')][_0x0a41('0x1a')]({'raw':_0x567661['options']?_0x567661['options']['raw']===undefined?!![]:![]:!![],'where':_0x567661[_0x0a41('0x1b')]?_0x567661[_0x0a41('0x1b')][_0x0a41('0x1c')]||null:null,'attributes':_0x567661['options']?_0x567661[_0x0a41('0x1b')][_0x0a41('0x1d')]||null:null,'limit':_0x567661[_0x0a41('0x1b')]?_0x567661[_0x0a41('0x1b')][_0x0a41('0x1e')]||null:null,'include':_0x567661['options']?_0x567661[_0x0a41('0x1b')][_0x0a41('0x1f')]?_[_0x0a41('0x20')](_0x567661[_0x0a41('0x1b')][_0x0a41('0x1f')],function(_0x5d11f7){return{'model':db[_0x5d11f7[_0x0a41('0x21')]],'as':_0x5d11f7['as'],'attributes':_0x5d11f7[_0x0a41('0x1d')],'include':_0x5d11f7['include']?_['map'](_0x5d11f7['include'],function(_0x25c6ba){return{'model':db[_0x25c6ba[_0x0a41('0x21')]],'as':_0x25c6ba['as'],'attributes':_0x25c6ba[_0x0a41('0x1d')],'include':_0x25c6ba[_0x0a41('0x1f')]?_['map'](_0x25c6ba[_0x0a41('0x1f')],function(_0x37e517){return{'model':db[_0x37e517['model']],'as':_0x37e517['as'],'attributes':_0x37e517[_0x0a41('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x322589){logger[_0x0a41('0x10')](_0x0a41('0x18'),_0x567661);logger[_0x0a41('0x12')](_0x0a41('0x18'),_0x567661,JSON[_0x0a41('0x13')](_0x322589));_0x435b29(_0x322589);})[_0x0a41('0x22')](function(_0xf6405d){logger[_0x0a41('0x14')]('GetUser',_0xf6405d[_0x0a41('0x15')],_0x567661);_0x2c684a(_0x104f0e[_0x0a41('0x14')](0x1f4,_0xf6405d[_0x0a41('0x15')]));});});};exports['ShowUser']=function(_0x4e8f53){var _0x3121cf=this;return new Promise(function(_0x1fc6f7,_0x5d9d5e){return db['User'][_0x0a41('0x23')]({'raw':_0x4e8f53[_0x0a41('0x1b')]?_0x4e8f53[_0x0a41('0x1b')][_0x0a41('0x24')]===undefined?!![]:![]:!![],'where':_0x4e8f53[_0x0a41('0x1b')]?_0x4e8f53[_0x0a41('0x1b')][_0x0a41('0x1c')]||null:null,'attributes':_0x4e8f53[_0x0a41('0x1b')]?_0x4e8f53[_0x0a41('0x1b')][_0x0a41('0x1d')]||null:null,'include':_0x4e8f53[_0x0a41('0x1b')]?_0x4e8f53[_0x0a41('0x1b')]['include']?_[_0x0a41('0x20')](_0x4e8f53[_0x0a41('0x1b')][_0x0a41('0x1f')],function(_0x441a64){return{'model':db[_0x441a64[_0x0a41('0x21')]],'as':_0x441a64['as'],'attributes':_0x441a64[_0x0a41('0x1d')],'include':_0x441a64[_0x0a41('0x1f')]?_['map'](_0x441a64[_0x0a41('0x1f')],function(_0x50b54c){return{'model':db[_0x50b54c[_0x0a41('0x21')]],'as':_0x50b54c['as'],'attributes':_0x50b54c[_0x0a41('0x1d')],'include':_0x50b54c['include']?_[_0x0a41('0x20')](_0x50b54c[_0x0a41('0x1f')],function(_0x1f1772){return{'model':db[_0x1f1772[_0x0a41('0x21')]],'as':_0x1f1772['as'],'attributes':_0x1f1772[_0x0a41('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0a41('0xf')](function(_0x166833){logger[_0x0a41('0x10')]('ShowUser',_0x4e8f53);logger[_0x0a41('0x12')](_0x0a41('0x25'),_0x4e8f53,JSON[_0x0a41('0x13')](_0x166833));_0x1fc6f7(_0x166833);})[_0x0a41('0x22')](function(_0x2d81f7){logger[_0x0a41('0x14')](_0x0a41('0x25'),_0x2d81f7[_0x0a41('0x15')],_0x4e8f53);_0x5d9d5e(_0x3121cf[_0x0a41('0x14')](0x1f4,_0x2d81f7[_0x0a41('0x15')]));});});};exports[_0x0a41('0x26')]=function(_0x12fb29){var _0x45c739=this;return new Promise(function(_0x63370f,_0x735360){var _0xb265a6;return db['User'][_0x0a41('0x23')]({'where':_0x12fb29['options'][_0x0a41('0x1c')]||{},'attributes':['id',_0x0a41('0x27'),_0x0a41('0x28'),'internal','interface']})[_0x0a41('0xf')](function(_0x325de2){if(_0x325de2){_0xb265a6=_0x325de2;return db[_0x0a41('0x29')][_0x0a41('0x2a')]({'paused':0x1},{'where':{'UserId':_0xb265a6['id']},'individualHooks':!![]});}})[_0x0a41('0xf')](function(){if(_0xb265a6){return db[_0x0a41('0x2b')][_0x0a41('0x1a')]({'where':{'membername':_0xb265a6[_0x0a41('0x27')],'type':'PAUSE','exitAt':null}});}})[_0x0a41('0xf')](function(_0x55f51f){if(_0xb265a6){if(_0x55f51f&&_0x55f51f[_0x0a41('0x2c')]){var _0x33888f=moment()[_0x0a41('0x2d')](_0x0a41('0x2e'));for(var _0x2f203a=0x0,_0x5ba7cd=_0x55f51f[_0x0a41('0x2c')];_0x2f203a<_0x5ba7cd;_0x2f203a++){_0x55f51f[_0x2f203a][_0x0a41('0x2f')]({'exitAt':_0x33888f});}}}})[_0x0a41('0xf')](function(){if(_0xb265a6){var _0x4270b3=[];var _0x4b974b=utils[_0x0a41('0x30')]();_0x4b974b['forEach'](function(_0x2dc78f){_0x4270b3[_0x0a41('0x31')]({'channel':_0x2dc78f,'membername':_0xb265a6[_0x0a41('0x27')],'interface':_[_0x0a41('0x32')](_0xb265a6[_0x0a41('0x33')])?util['format']('SIP/%s',_0xb265a6[_0x0a41('0x27')]):_0xb265a6[_0x0a41('0x33')],'type':_0x0a41('0x34'),'enterAt':moment()[_0x0a41('0x2d')](_0x0a41('0x2e')),'data1':_0x12fb29[_0x0a41('0x35')][_0x0a41('0x36')]||'DEFAULT\x20PAUSE','role':_0xb265a6[_0x0a41('0x28')],'internal':_0xb265a6[_0x0a41('0x37')],'uniqueid':_0x12fb29[_0x0a41('0x35')]['uniqueid']||null});});return db[_0x0a41('0x2b')][_0x0a41('0x38')](_0x4270b3,{'individualHooks':!![]});}})[_0x0a41('0xf')](function(){if(_0xb265a6){return _0xb265a6[_0x0a41('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x12fb29[_0x0a41('0x35')][_0x0a41('0x36')]||_0x0a41('0x39'),'lastPauseAt':moment()[_0x0a41('0x2d')](_0x0a41('0x2e'))});}})['then'](function(_0x366c5d){_0x63370f(_0x366c5d);})[_0x0a41('0x22')](function(_0x32bb9d){_0x735360(_0x45c739[_0x0a41('0x14')](0x1f4,_0x32bb9d[_0x0a41('0x15')]));});});};exports[_0x0a41('0x3a')]=function(_0x2e1516){var _0x18343d=this;return new Promise(function(_0x487712,_0x1439b3){var _0x241c9c;return db[_0x0a41('0x19')][_0x0a41('0x3b')]({'where':_0x2e1516[_0x0a41('0x1b')][_0x0a41('0x1c')]||{},'attributes':['id',_0x0a41('0x27')]})['then'](function(_0x410565){if(_0x410565){_0x241c9c=_0x410565;if(_0x2e1516[_0x0a41('0x35')][_0x0a41('0x3c')]&&!utils['isValidChannel'](_0x2e1516[_0x0a41('0x35')][_0x0a41('0x3c')])){throw new Error('Unknown\x20channel');}switch(_0x2e1516[_0x0a41('0x35')][_0x0a41('0x3c')]){case'voice':return db[_0x0a41('0x29')][_0x0a41('0x2a')]({'paused':0x0},{'where':{'UserId':_0x241c9c['id']}})[_0x0a41('0xf')](function(){return db[_0x0a41('0x2b')]['find']({'where':{'channel':_0x2e1516[_0x0a41('0x35')][_0x0a41('0x3c')],'membername':_0x241c9c['name'],'type':'PAUSE','exitAt':null}});})[_0x0a41('0xf')](function(_0x288a35){if(_0x288a35){return _0x288a35[_0x0a41('0x2a')]({'exitAt':moment()[_0x0a41('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x0a41('0x3d')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x241c9c[_0x0a41('0x2a')]({'voicePause':![]});});case'mail':case _0x0a41('0x3e'):case _0x0a41('0x3f'):case _0x0a41('0x40'):case _0x0a41('0x41'):case'whatsapp':return db['MemberReport'][_0x0a41('0x23')]({'where':{'channel':_0x2e1516[_0x0a41('0x35')]['channel'],'membername':_0x241c9c[_0x0a41('0x27')],'type':_0x0a41('0x34'),'exitAt':null}})['then'](function(_0x1935a7){return _0x1935a7[_0x0a41('0x2a')]({'exitAt':moment()['format'](_0x0a41('0x2e')),'data2':_0x0a41('0x3d')},{'individualHooks':!![]});})['then'](function(){var _0x1396af={};_['set'](_0x1396af,util[_0x0a41('0x2d')](_0x0a41('0x42'),_0x2e1516[_0x0a41('0x35')][_0x0a41('0x3c')],'Pause'),![]);return _0x241c9c[_0x0a41('0x2a')](_0x1396af);});default:return db[_0x0a41('0x29')][_0x0a41('0x2a')]({'paused':0x0},{'where':{'UserId':_0x241c9c['id']}})[_0x0a41('0xf')](function(){return db[_0x0a41('0x2b')][_0x0a41('0x1a')]({'where':{'membername':_0x241c9c['name'],'type':_0x0a41('0x34'),'exitAt':null}});})[_0x0a41('0xf')](function(_0x28c259){var _0x4176c6=[];_0x28c259['forEach'](function(_0x2e1de0){_0x4176c6['push'](_0x2e1de0[_0x0a41('0x2a')]({'exitAt':moment()['format'](_0x0a41('0x2e')),'data2':_0x0a41('0x3d')}));});return BPromise['all'](_0x4176c6);})[_0x0a41('0xf')](function(){return _0x241c9c['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x0a41('0xf')](function(_0x1fe8f1){_0x487712(_0x1fe8f1);})['catch'](function(_0x3ba76e){_0x1439b3(_0x18343d[_0x0a41('0x14')](0x1f4,_0x3ba76e['message']));});});};exports[_0x0a41('0x43')]=function(_0x2c113a){var _0x58e1cd=this;return new Promise(function(_0x65e541,_0x1eb9fc){var _0x5b1582;return db[_0x0a41('0x19')][_0x0a41('0x3b')]({'where':_0x2c113a[_0x0a41('0x1b')][_0x0a41('0x1c')]||{},'attributes':['id',_0x0a41('0x27')]})['then'](function(_0x218e5e){if(_0x218e5e){_0x5b1582=_0x218e5e;return db[_0x0a41('0x29')][_0x0a41('0x44')]({'where':{'membername':_0x5b1582[_0x0a41('0x27')]},'individualHooks':!![]});}})[_0x0a41('0xf')](function(){if(_0x5b1582){return db[_0x0a41('0x2b')]['findAll']({'where':{'membername':_0x5b1582[_0x0a41('0x27')],'exitAt':null}});}})[_0x0a41('0xf')](function(_0x17e3dc){if(_0x5b1582){if(_0x17e3dc&&_0x17e3dc[_0x0a41('0x2c')]){var _0x3b9c0b=[];_0x17e3dc[_0x0a41('0x45')](function(_0x527105){_0x3b9c0b[_0x0a41('0x31')](_0x527105[_0x0a41('0x2a')]({'exitAt':moment()[_0x0a41('0x2d')](_0x0a41('0x2e'))}));});return BPromise[_0x0a41('0x46')](_0x3b9c0b);}}})[_0x0a41('0xf')](function(){if(_0x5b1582){return _0x5b1582[_0x0a41('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x0a41('0xf')](function(_0x3969ca){_0x65e541(_0x3969ca);})[_0x0a41('0x22')](function(_0x7b8cf1){_0x1eb9fc(_0x58e1cd[_0x0a41('0x14')](0x1f4,_0x7b8cf1[_0x0a41('0x15')]));});});};exports[_0x0a41('0x47')]=function(_0x3bd531){var _0x3b3627=this;return new Promise(function(_0x34234b,_0xddb48b){var _0x13821a;var _0x342b96;var _0x4e3539;var _0x35dc1e;return db[_0x0a41('0x19')][_0x0a41('0x3b')]({'where':_0x3bd531[_0x0a41('0x1b')][_0x0a41('0x1c')]||{},'attributes':['id','name',_0x0a41('0x28'),_0x0a41('0x48'),_0x0a41('0x49'),'internal',_0x0a41('0x4a'),_0x0a41('0x33')]})[_0x0a41('0xf')](function(_0x3effdc){if(_0x3effdc){_0x13821a=_0x3effdc;_0x35dc1e=_0x3bd531[_0x0a41('0x35')]['interface']?_0x3bd531['body'][_0x0a41('0x33')]:util[_0x0a41('0x2d')]('SIP/%s',_0x13821a[_0x0a41('0x27')]);return db['User']['count']({'where':{'role':_0x0a41('0x4b'),'online':!![],'id':{'$ne':_0x13821a['id']}}});}})['then'](function(_0x7e7359){if(_0x7e7359){_0x4e3539=_0x7e7359;return require(_0x0a41('0x4c'))[_0x0a41('0x4d')]();}})[_0x0a41('0xf')](function(_0x12dee9){if(_0x12dee9&&_0x12dee9[_0x0a41('0x4e')]&&_0x4e3539>=_0x12dee9[_0x0a41('0x4e')]){throw new Error(_0x0a41('0x4f'));}})[_0x0a41('0xf')](function(){if(_0x13821a){return db[_0x0a41('0x29')][_0x0a41('0x44')]({'where':{'membername':_0x13821a['name']},'individualHooks':!![]});}})[_0x0a41('0xf')](function(){if(_0x13821a){return _0x13821a['getVoiceQueues']({'raw':!![]});}})[_0x0a41('0xf')](function(_0x2a727a){if(_0x13821a){if(_0x2a727a){var _0x4ebdd=[];_0x342b96=_0x2a727a;if(_0x342b96[_0x0a41('0x2c')]){for(var _0x2d6982=0x0;_0x2d6982<_0x342b96[_0x0a41('0x2c')];_0x2d6982++){_0x4ebdd[_0x0a41('0x31')](db[_0x0a41('0x29')]['upsert']({'membername':_0x13821a['name'],'UserId':_0x13821a['id'],'queue_name':_0x342b96[_0x2d6982][_0x0a41('0x27')],'VoiceQueueId':_0x342b96[_0x2d6982]['id'],'interface':_0x35dc1e,'paused':_0x13821a['loginInPause']||![],'penalty':_0x342b96[_0x2d6982][_0x0a41('0x50')]||0x0}));}return BPromise[_0x0a41('0x46')](_0x4ebdd);}}}})[_0x0a41('0xf')](function(){if(_0x13821a){return db[_0x0a41('0x2b')]['findAll']({'where':{'membername':_0x13821a[_0x0a41('0x27')],'exitAt':null}});}})[_0x0a41('0xf')](function(_0x3924cb){if(_0x13821a){if(_0x3924cb&&_0x3924cb['length']){var _0x20d242=[];_0x3924cb['forEach'](function(_0x5cdb85){_0x20d242[_0x0a41('0x31')](_0x5cdb85[_0x0a41('0x2a')]({'exitAt':moment()[_0x0a41('0x2d')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x0a41('0x46')](_0x20d242);}}})['then'](function(_0x295bf6){if(_0x13821a){var _0x3b1faf=[];var _0x587fc6=[];var _0x515d62=utils[_0x0a41('0x30')]();var _0x2ca8d4={'membername':_0x13821a['name'],'interface':_0x35dc1e,'enterAt':moment()[_0x0a41('0x2d')](_0x0a41('0x2e')),'role':_0x13821a[_0x0a41('0x28')],'internal':_0x13821a[_0x0a41('0x37')]};_0x515d62[_0x0a41('0x45')](function(_0x2ca3c7){_0x3b1faf['push'](_[_0x0a41('0x51')]({'channel':_0x2ca3c7,'type':_0x0a41('0x52'),'data1':_0x0a41('0x53'),'data2':_0x35dc1e},_0x2ca8d4));if(_0x13821a[_0x0a41('0x4a')]){_0x587fc6['push'](_[_0x0a41('0x51')]({'channel':_0x2ca3c7,'type':_0x0a41('0x34'),'data1':_0x0a41('0x54')},_0x2ca8d4));}});return db[_0x0a41('0x2b')]['bulkCreate'](_0x3b1faf['concat'](_0x587fc6),{'individualHooks':!![]});}})[_0x0a41('0xf')](function(){if(_0x13821a){return _0x13821a[_0x0a41('0x2a')]({'online':!![],'lastLoginAt':moment()[_0x0a41('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x13821a[_0x0a41('0x4a')]||![],'mailPause':_0x13821a[_0x0a41('0x4a')]||![],'chatPause':_0x13821a['loginInPause']||![],'faxPause':_0x13821a[_0x0a41('0x4a')]||![],'smsPause':_0x13821a[_0x0a41('0x4a')]||![],'openchannelPause':_0x13821a['loginInPause']||![],'pauseType':_0x13821a[_0x0a41('0x4a')]?_0x0a41('0x54'):null,'lastPauseAt':moment()['format'](_0x0a41('0x2e')),'interface':_0x35dc1e});}})[_0x0a41('0xf')](function(_0x506440){_0x34234b(_0x506440);})[_0x0a41('0x22')](function(_0xa38e4f){_0xddb48b(_0x3b3627[_0x0a41('0x14')](0x1f4,_0xa38e4f[_0x0a41('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index fb96679..e6f5c0d 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 _0xeb89=['user:','save','remove','update','emit','removeListener','register'];(function(_0x33d305,_0x45a94f){var _0x2bec21=function(_0x4b12e6){while(--_0x4b12e6){_0x33d305['push'](_0x33d305['shift']());}};_0x2bec21(++_0x45a94f);}(_0xeb89,0xef));var _0x9eb8=function(_0x3c3f5a,_0x3c1804){_0x3c3f5a=_0x3c3f5a-0x0;var _0x3016ab=_0xeb89[_0x3c3f5a];return _0x3016ab;};'use strict';var UserEvents=require('./user.events');var events=[_0x9eb8('0x0'),_0x9eb8('0x1'),_0x9eb8('0x2')];function createListener(_0x3c6d06,_0x5078a3){return function(_0x3f3247){_0x5078a3[_0x9eb8('0x3')](_0x3c6d06,_0x3f3247);};}function removeListener(_0x591464,_0x161cf9){return function(){UserEvents[_0x9eb8('0x4')](_0x591464,_0x161cf9);};}exports[_0x9eb8('0x5')]=function(_0x2b3c9e){for(var _0x5d36d7=0x0,_0x194b2c=events['length'];_0x5d36d7<_0x194b2c;_0x5d36d7++){var _0x34098c=events[_0x5d36d7];var _0x231648=createListener(_0x9eb8('0x6')+_0x34098c,_0x2b3c9e);UserEvents['on'](_0x34098c,_0x231648);}}; \ No newline at end of file +var _0xe44d=['update','emit','removeListener','length','user:','./user.events','save','remove'];(function(_0x370779,_0x5c98f6){var _0x31c875=function(_0x4d44b3){while(--_0x4d44b3){_0x370779['push'](_0x370779['shift']());}};_0x31c875(++_0x5c98f6);}(_0xe44d,0x1bd));var _0xde44=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xe44d[_0x24f31b];return _0x488401;};'use strict';var UserEvents=require(_0xde44('0x0'));var events=[_0xde44('0x1'),_0xde44('0x2'),_0xde44('0x3')];function createListener(_0x307683,_0x9d6f7a){return function(_0x4bc957){_0x9d6f7a[_0xde44('0x4')](_0x307683,_0x4bc957);};}function removeListener(_0x1bfb83,_0x23b678){return function(){UserEvents[_0xde44('0x5')](_0x1bfb83,_0x23b678);};}exports['register']=function(_0x5a8a63){for(var _0x1cecd5=0x0,_0x3ab920=events[_0xde44('0x6')];_0x1cecd5<_0x3ab920;_0x1cecd5++){var _0x3636e6=events[_0x1cecd5];var _0x572c3f=createListener(_0xde44('0x7')+_0x3636e6,_0x5a8a63);UserEvents['on'](_0x3636e6,_0x572c3f);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index cd9d283..b5830bb 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x145a34,_0x5c0104){var _0x3d5ca9=function(_0x47b887){while(--_0x47b887){_0x145a34['push'](_0x145a34['shift']());}};_0x3d5ca9(++_0x5c0104);}(_0xe706,0xa3));var _0x6e70=function(_0x25ffd4,_0x16b31d){_0x25ffd4=_0x25ffd4-0x0;var _0x414452=_0xe706[_0x25ffd4];return _0x414452;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x299784,_0xb0918f){var _0x5ab008=function(_0x49c1f5){while(--_0x49c1f5){_0x299784['push'](_0x299784['shift']());}};_0x5ab008(++_0xb0918f);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 53a7002..da1627c 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 _0x8112=['sequelize','exports'];(function(_0x4211bb,_0x424082){var _0x36d8e8=function(_0x8665dc){while(--_0x8665dc){_0x4211bb['push'](_0x4211bb['shift']());}};_0x36d8e8(++_0x424082);}(_0x8112,0xc8));var _0x2811=function(_0x579f36,_0x2ff881){_0x579f36=_0x579f36-0x0;var _0x47a643=_0x8112[_0x579f36];return _0x47a643;};'use strict';var Sequelize=require(_0x2811('0x0'));module[_0x2811('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x94cf=['exports','INTEGER'];(function(_0x40911a,_0x55ec99){var _0x27e8e3=function(_0x2ba910){while(--_0x2ba910){_0x40911a['push'](_0x40911a['shift']());}};_0x27e8e3(++_0x55ec99);}(_0x94cf,0xc2));var _0xf94c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94cf[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xf94c('0x0')]={'penalty':{'type':Sequelize[_0xf94c('0x1')],'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 b7f04e5..8240e3f 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 _0x6445=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./userChatQueue.attributes','exports','UserChatQueue','lodash','util'];(function(_0x2340f6,_0x4a7658){var _0x7d4be9=function(_0x314dff){while(--_0x314dff){_0x2340f6['push'](_0x2340f6['shift']());}};_0x7d4be9(++_0x4a7658);}(_0x6445,0x132));var _0x5644=function(_0x25de8c,_0x2c0c73){_0x25de8c=_0x25de8c-0x0;var _0x52127d=_0x6445[_0x25de8c];return _0x52127d;};'use strict';var _=require(_0x5644('0x0'));var util=require(_0x5644('0x1'));var logger=require(_0x5644('0x2'))(_0x5644('0x3'));var moment=require(_0x5644('0x4'));var BPromise=require(_0x5644('0x5'));var rp=require(_0x5644('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5644('0x7'));var config=require('../../config/environment');var attributes=require(_0x5644('0x8'));module[_0x5644('0x9')]=function(_0x2c4689,_0x267221){return _0x2c4689['define'](_0x5644('0xa'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde55=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','user_has_chat_queues','lodash','util','../../config/logger','api'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xde55,0xf8));var _0x5de5=function(_0x1cfb33,_0x269009){_0x1cfb33=_0x1cfb33-0x0;var _0x165129=_0xde55[_0x1cfb33];return _0x165129;};'use strict';var _=require(_0x5de5('0x0'));var util=require(_0x5de5('0x1'));var logger=require(_0x5de5('0x2'))(_0x5de5('0x3'));var moment=require(_0x5de5('0x4'));var BPromise=require(_0x5de5('0x5'));var rp=require(_0x5de5('0x6'));var fs=require('fs');var path=require(_0x5de5('0x7'));var rimraf=require(_0x5de5('0x8'));var config=require(_0x5de5('0x9'));var attributes=require(_0x5de5('0xa'));module[_0x5de5('0xb')]=function(_0x3fbe0a,_0x19b59c){return _0x3fbe0a[_0x5de5('0xc')]('UserChatQueue',attributes,{'tableName':_0x5de5('0xd'),'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 cd221e9..dbf48f8 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 _0x9366=['client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x553bce,_0x1a0ecf){var _0x4717f0=function(_0x1f5d33){while(--_0x1f5d33){_0x553bce['push'](_0x553bce['shift']());}};_0x4717f0(++_0x1a0ecf);}(_0x9366,0x1b0));var _0x6936=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9366[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6936('0x0'));var util=require(_0x6936('0x1'));var moment=require('moment');var BPromise=require(_0x6936('0x2'));var rs=require(_0x6936('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6936('0x4'))['db'];var utils=require(_0x6936('0x5'));var logger=require(_0x6936('0x6'))('rpc');var config=require(_0x6936('0x7'));var jayson=require(_0x6936('0x8'));var client=jayson[_0x6936('0x9')][_0x6936('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x530833,_0x4875b2,_0x16d70b){return new BPromise(function(_0x4799b0,_0x4f4187){return client[_0x6936('0xb')](_0x530833,_0x16d70b)[_0x6936('0xc')](function(_0x3969ed){logger[_0x6936('0xd')](_0x6936('0xe'),_0x4875b2,_0x6936('0xf'));logger['debug'](_0x6936('0x10'),_0x4875b2,_0x6936('0xf'),JSON[_0x6936('0x11')](_0x3969ed));if(_0x3969ed[_0x6936('0x12')]){if(_0x3969ed[_0x6936('0x12')]['code']===0x1f4){logger[_0x6936('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x4875b2,_0x3969ed[_0x6936('0x12')][_0x6936('0x13')]);return _0x4f4187(_0x3969ed[_0x6936('0x12')][_0x6936('0x13')]);}logger[_0x6936('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x4875b2,_0x3969ed[_0x6936('0x12')]['message']);return _0x4799b0(_0x3969ed['error']['message']);}else{logger[_0x6936('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x4875b2,_0x6936('0xf'));_0x4799b0(_0x3969ed[_0x6936('0x14')][_0x6936('0x13')]);}})['catch'](function(_0x572408){logger['error'](_0x6936('0xe'),_0x4875b2,_0x572408);_0x4f4187(_0x572408);});});} \ No newline at end of file +var _0xd760=['http','info','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x27a11d,_0xab149c){var _0x348d7a=function(_0x4388ae){while(--_0x4388ae){_0x27a11d['push'](_0x27a11d['shift']());}};_0x348d7a(++_0xab149c);}(_0xd760,0x1d8));var _0x0d76=function(_0x4af5a4,_0x4ef8af){_0x4af5a4=_0x4af5a4-0x0;var _0x5136ef=_0xd760[_0x4af5a4];return _0x5136ef;};'use strict';var _=require(_0x0d76('0x0'));var util=require(_0x0d76('0x1'));var moment=require('moment');var BPromise=require(_0x0d76('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d76('0x3'));var db=require(_0x0d76('0x4'))['db'];var utils=require(_0x0d76('0x5'));var logger=require(_0x0d76('0x6'))(_0x0d76('0x7'));var config=require(_0x0d76('0x8'));var jayson=require(_0x0d76('0x9'));var client=jayson[_0x0d76('0xa')][_0x0d76('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3fa965,_0x648755,_0x3bd15b){return new BPromise(function(_0x25d460,_0x11a0ff){return client['request'](_0x3fa965,_0x3bd15b)['then'](function(_0x3a6f77){logger[_0x0d76('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x648755,'request\x20sent');logger[_0x0d76('0xd')](_0x0d76('0xe'),_0x648755,'request\x20sent',JSON[_0x0d76('0xf')](_0x3a6f77));if(_0x3a6f77[_0x0d76('0x10')]){if(_0x3a6f77[_0x0d76('0x10')][_0x0d76('0x11')]===0x1f4){logger[_0x0d76('0x10')](_0x0d76('0x12'),_0x648755,_0x3a6f77[_0x0d76('0x10')][_0x0d76('0x13')]);return _0x11a0ff(_0x3a6f77[_0x0d76('0x10')][_0x0d76('0x13')]);}logger['error'](_0x0d76('0x12'),_0x648755,_0x3a6f77[_0x0d76('0x10')]['message']);return _0x25d460(_0x3a6f77['error'][_0x0d76('0x13')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x648755,_0x0d76('0x14'));_0x25d460(_0x3a6f77[_0x0d76('0x15')][_0x0d76('0x13')]);}})[_0x0d76('0x16')](function(_0x1dfbee){logger[_0x0d76('0x10')](_0x0d76('0x12'),_0x648755,_0x1dfbee);_0x11a0ff(_0x1dfbee);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 1ccb8f7..b1b11af 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x42d9df,_0x388e92){var _0x3c7ac1=function(_0x274105){while(--_0x274105){_0x42d9df['push'](_0x42d9df['shift']());}};_0x3c7ac1(++_0x388e92);}(_0xedd9,0xfc));var _0x9edd=function(_0x12392c,_0x2f004f){_0x12392c=_0x12392c-0x0;var _0x2875f3=_0xedd9[_0x12392c];return _0x2875f3;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x20445f,_0x450914){var _0xf83d82=function(_0x4ff8ed){while(--_0x4ff8ed){_0x20445f['push'](_0x20445f['shift']());}};_0xf83d82(++_0x450914);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5b7788,_0x309ae5){_0x5b7788=_0x5b7788-0x0;var _0x573871=_0xcb91[_0x5b7788];return _0x573871;};'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 7494a8a..84e5f78 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 _0x64e4=['sequelize','INTEGER','STRING'];(function(_0x2f7f21,_0x1e9612){var _0x5c0ff7=function(_0x4a3cf0){while(--_0x4a3cf0){_0x2f7f21['push'](_0x2f7f21['shift']());}};_0x5c0ff7(++_0x1e9612);}(_0x64e4,0x11d));var _0x464e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x64e4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x464e('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x464e('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x464e('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x464e('0x2')]}}; \ No newline at end of file +var _0xc30e=['exports','INTEGER','sequelize'];(function(_0x52cc40,_0x54180d){var _0x72f97b=function(_0x28ec2c){while(--_0x28ec2c){_0x52cc40['push'](_0x52cc40['shift']());}};_0x72f97b(++_0x54180d);}(_0xc30e,0x176));var _0xec30=function(_0x19032a,_0x1ee31b){_0x19032a=_0x19032a-0x0;var _0x4b0bdf=_0xc30e[_0x19032a];return _0x4b0bdf;};'use strict';var Sequelize=require(_0xec30('0x0'));module[_0xec30('0x1')]={'penalty':{'type':Sequelize[_0xec30('0x2')],'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 26f1567..64219cd 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 _0xbd90=['api','moment','bluebird','request-promise','path','rimraf','./userFaxQueue.attributes','exports','define','UserFaxQueue','lodash','util','../../config/logger'];(function(_0x5a4b42,_0x2b9c18){var _0x5e81d6=function(_0x595077){while(--_0x595077){_0x5a4b42['push'](_0x5a4b42['shift']());}};_0x5e81d6(++_0x2b9c18);}(_0xbd90,0xb3));var _0x0bd9=function(_0x21a191,_0x5f2222){_0x21a191=_0x21a191-0x0;var _0x33dec6=_0xbd90[_0x21a191];return _0x33dec6;};'use strict';var _=require(_0x0bd9('0x0'));var util=require(_0x0bd9('0x1'));var logger=require(_0x0bd9('0x2'))(_0x0bd9('0x3'));var moment=require(_0x0bd9('0x4'));var BPromise=require(_0x0bd9('0x5'));var rp=require(_0x0bd9('0x6'));var fs=require('fs');var path=require(_0x0bd9('0x7'));var rimraf=require(_0x0bd9('0x8'));var config=require('../../config/environment');var attributes=require(_0x0bd9('0x9'));module[_0x0bd9('0xa')]=function(_0x36a8be,_0x5e0db7){return _0x36a8be[_0x0bd9('0xb')](_0x0bd9('0xc'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb54=['../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x4b33d1,_0x2414e1){var _0x9e7221=function(_0x476ecc){while(--_0x476ecc){_0x4b33d1['push'](_0x4b33d1['shift']());}};_0x9e7221(++_0x2414e1);}(_0xbb54,0x1a6));var _0x4bb5=function(_0x48cb1f,_0x5ca68d){_0x48cb1f=_0x48cb1f-0x0;var _0x172c4d=_0xbb54[_0x48cb1f];return _0x172c4d;};'use strict';var _=require(_0x4bb5('0x0'));var util=require('util');var logger=require(_0x4bb5('0x1'))(_0x4bb5('0x2'));var moment=require('moment');var BPromise=require(_0x4bb5('0x3'));var rp=require(_0x4bb5('0x4'));var fs=require('fs');var path=require(_0x4bb5('0x5'));var rimraf=require(_0x4bb5('0x6'));var config=require(_0x4bb5('0x7'));var attributes=require(_0x4bb5('0x8'));module[_0x4bb5('0x9')]=function(_0x5514cd,_0x136860){return _0x5514cd[_0x4bb5('0xa')](_0x4bb5('0xb'),attributes,{'tableName':_0x4bb5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 19aebb1..301307d 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 _0xac5f=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x5e4fdb,_0x2a9605){var _0x2f198c=function(_0x571503){while(--_0x571503){_0x5e4fdb['push'](_0x5e4fdb['shift']());}};_0x2f198c(++_0x2a9605);}(_0xac5f,0x1e4));var _0xfac5=function(_0x14f8c3,_0x348791){_0x14f8c3=_0x14f8c3-0x0;var _0x64edac=_0xac5f[_0x14f8c3];return _0x64edac;};'use strict';var _=require(_0xfac5('0x0'));var util=require(_0xfac5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfac5('0x2'));var fs=require('fs');var Redis=require(_0xfac5('0x3'));var db=require(_0xfac5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfac5('0x5'))(_0xfac5('0x6'));var config=require('../../config/environment');var jayson=require(_0xfac5('0x7'));var client=jayson['client'][_0xfac5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x330839,_0x185970,_0x15b0e5){return new BPromise(function(_0x15ac93,_0xa78521){return client[_0xfac5('0x9')](_0x330839,_0x15b0e5)[_0xfac5('0xa')](function(_0x32f05b){logger[_0xfac5('0xb')](_0xfac5('0xc'),_0x185970,_0xfac5('0xd'));logger[_0xfac5('0xe')](_0xfac5('0xf'),_0x185970,_0xfac5('0xd'),JSON[_0xfac5('0x10')](_0x32f05b));if(_0x32f05b[_0xfac5('0x11')]){if(_0x32f05b['error'][_0xfac5('0x12')]===0x1f4){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x185970,_0x32f05b[_0xfac5('0x11')][_0xfac5('0x13')]);return _0xa78521(_0x32f05b[_0xfac5('0x11')]['message']);}logger[_0xfac5('0x11')](_0xfac5('0xc'),_0x185970,_0x32f05b[_0xfac5('0x11')][_0xfac5('0x13')]);return _0x15ac93(_0x32f05b[_0xfac5('0x11')][_0xfac5('0x13')]);}else{logger[_0xfac5('0xb')](_0xfac5('0xc'),_0x185970,'request\x20sent');_0x15ac93(_0x32f05b[_0xfac5('0x14')][_0xfac5('0x13')]);}})[_0xfac5('0x15')](function(_0xfbce97){logger[_0xfac5('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x185970,_0xfbce97);_0xa78521(_0xfbce97);});});} \ No newline at end of file +var _0xb6d4=['then','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request'];(function(_0x12997,_0x936200){var _0x2af58e=function(_0x4a4e25){while(--_0x4a4e25){_0x12997['push'](_0x12997['shift']());}};_0x2af58e(++_0x936200);}(_0xb6d4,0xa6));var _0x4b6d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb6d4[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x4b6d('0x0'));var util=require('util');var moment=require(_0x4b6d('0x1'));var BPromise=require('bluebird');var rs=require(_0x4b6d('0x2'));var fs=require('fs');var Redis=require(_0x4b6d('0x3'));var db=require(_0x4b6d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4b6d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4b6d('0x6'));var client=jayson[_0x4b6d('0x7')][_0x4b6d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e9d22,_0x22aecc,_0x2682a1){return new BPromise(function(_0x548984,_0x48a467){return client[_0x4b6d('0x9')](_0x1e9d22,_0x2682a1)[_0x4b6d('0xa')](function(_0x261b4a){logger[_0x4b6d('0xb')](_0x4b6d('0xc'),_0x22aecc,'request\x20sent');logger[_0x4b6d('0xd')](_0x4b6d('0xe'),_0x22aecc,'request\x20sent',JSON[_0x4b6d('0xf')](_0x261b4a));if(_0x261b4a[_0x4b6d('0x10')]){if(_0x261b4a[_0x4b6d('0x10')][_0x4b6d('0x11')]===0x1f4){logger[_0x4b6d('0x10')](_0x4b6d('0xc'),_0x22aecc,_0x261b4a['error'][_0x4b6d('0x12')]);return _0x48a467(_0x261b4a['error']['message']);}logger[_0x4b6d('0x10')](_0x4b6d('0xc'),_0x22aecc,_0x261b4a[_0x4b6d('0x10')]['message']);return _0x548984(_0x261b4a[_0x4b6d('0x10')][_0x4b6d('0x12')]);}else{logger[_0x4b6d('0xb')](_0x4b6d('0xc'),_0x22aecc,_0x4b6d('0x13'));_0x548984(_0x261b4a[_0x4b6d('0x14')]['message']);}})[_0x4b6d('0x15')](function(_0x59fbb8){logger[_0x4b6d('0x10')](_0x4b6d('0xc'),_0x22aecc,_0x59fbb8);_0x48a467(_0x59fbb8);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 2cfd056..c31f9b3 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xb16f97,_0x226ee4){var _0x26df76=function(_0xf9b68e){while(--_0xf9b68e){_0xb16f97['push'](_0xb16f97['shift']());}};_0x26df76(++_0x226ee4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index ba1c840..8359ccd 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 _0xb833=['sequelize','exports','INTEGER'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xb833,0x105));var _0x3b83=function(_0x3cf8f8,_0x192905){_0x3cf8f8=_0x3cf8f8-0x0;var _0x5a72e0=_0xb833[_0x3cf8f8];return _0x5a72e0;};'use strict';var Sequelize=require(_0x3b83('0x0'));module[_0x3b83('0x1')]={'penalty':{'type':Sequelize[_0x3b83('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4efd=['sequelize','INTEGER'];(function(_0x537d5f,_0x53ba22){var _0x1b10fc=function(_0x48dc14){while(--_0x48dc14){_0x537d5f['push'](_0x537d5f['shift']());}};_0x1b10fc(++_0x53ba22);}(_0x4efd,0xd8));var _0xd4ef=function(_0xce93c,_0x555be5){_0xce93c=_0xce93c-0x0;var _0x230720=_0x4efd[_0xce93c];return _0x230720;};'use strict';var Sequelize=require(_0xd4ef('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xd4ef('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index d886bb9..a6fcd91 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 _0xd765=['bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger'];(function(_0x3716c7,_0x18b4ab){var _0xd1dc35=function(_0x2d25ce){while(--_0x2d25ce){_0x3716c7['push'](_0x3716c7['shift']());}};_0xd1dc35(++_0x18b4ab);}(_0xd765,0x1a1));var _0x5d76=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xd765[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x5d76('0x0'));var util=require(_0x5d76('0x1'));var logger=require(_0x5d76('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5d76('0x3'));var rp=require(_0x5d76('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5d76('0x5'));var config=require(_0x5d76('0x6'));var attributes=require(_0x5d76('0x7'));module[_0x5d76('0x8')]=function(_0x238005,_0x41391f){return _0x238005[_0x5d76('0x9')](_0x5d76('0xa'),attributes,{'tableName':_0x5d76('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a00=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','util'];(function(_0x54e00d,_0x25afb1){var _0x3ea16d=function(_0x75134f){while(--_0x75134f){_0x54e00d['push'](_0x54e00d['shift']());}};_0x3ea16d(++_0x25afb1);}(_0x3a00,0x1ae));var _0x03a0=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0x3a00[_0x264b9b];return _0x4c7a0e;};'use strict';var _=require(_0x03a0('0x0'));var util=require(_0x03a0('0x1'));var logger=require(_0x03a0('0x2'))('api');var moment=require(_0x03a0('0x3'));var BPromise=require(_0x03a0('0x4'));var rp=require(_0x03a0('0x5'));var fs=require('fs');var path=require(_0x03a0('0x6'));var rimraf=require('rimraf');var config=require(_0x03a0('0x7'));var attributes=require(_0x03a0('0x8'));module[_0x03a0('0x9')]=function(_0x438aeb,_0x4d79ad){return _0x438aeb[_0x03a0('0xa')]('UserMailQueue',attributes,{'tableName':_0x03a0('0xb'),'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 47c7023..f8c39c8 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 _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','UserMailQueue,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x5c052f,_0x444416){var _0x16b73d=function(_0x2cffb2){while(--_0x2cffb2){_0x5c052f['push'](_0x5c052f['shift']());}};_0x16b73d(++_0x444416);}(_0x3e74,0x175));var _0x43e7=function(_0x3bf808,_0x4991d4){_0x3bf808=_0x3bf808-0x0;var _0x45cbc2=_0x3e74[_0x3bf808];return _0x45cbc2;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file +var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x27f8c9,_0x4bc2c0){var _0x2b5a48=function(_0x340e46){while(--_0x340e46){_0x27f8c9['push'](_0x27f8c9['shift']());}};_0x2b5a48(++_0x4bc2c0);}(_0xe14b,0x93));var _0xbe14=function(_0x543c29,_0x5611c5){_0x543c29=_0x543c29-0x0;var _0x396aa3=_0xe14b[_0x543c29];return _0x396aa3;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index c846c4f..37c8cf0 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 _0xf0fe=['isAuthenticated','sendUserNotification','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','./userNotification.controller'];(function(_0x5e5c25,_0x2ee5d4){var _0xcd8e34=function(_0x3c5fdc){while(--_0x3c5fdc){_0x5e5c25['push'](_0x5e5c25['shift']());}};_0xcd8e34(++_0x2ee5d4);}(_0xf0fe,0x77));var _0xef0f=function(_0x578b23,_0x24285a){_0x578b23=_0x578b23-0x0;var _0x327e65=_0xf0fe[_0x578b23];return _0x327e65;};'use strict';var multer=require(_0xef0f('0x0'));var util=require(_0xef0f('0x1'));var path=require(_0xef0f('0x2'));var timeout=require(_0xef0f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xef0f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xef0f('0x5'));var config=require('../../config/environment');var controller=require(_0xef0f('0x6'));router['post']('/',auth[_0xef0f('0x7')](),controller[_0xef0f('0x8')]);module['exports']=router; \ No newline at end of file +var _0xed6d=['../../components/interaction/service','../../config/environment','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','fs-extra'];(function(_0x3c5e65,_0x5eda23){var _0x3b3061=function(_0x2cd41e){while(--_0x2cd41e){_0x3c5e65['push'](_0x3c5e65['shift']());}};_0x3b3061(++_0x5eda23);}(_0xed6d,0xb9));var _0xded6=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xed6d[_0x1969a7];return _0x3d665f;};'use strict';var multer=require(_0xded6('0x0'));var util=require(_0xded6('0x1'));var path=require(_0xded6('0x2'));var timeout=require(_0xded6('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xded6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xded6('0x5'));var config=require(_0xded6('0x6'));var controller=require('./userNotification.controller');router['post']('/',auth[_0xded6('0x7')](),controller[_0xded6('0x8')]);module[_0xded6('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 41515c6..b262e43 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 _0x95c8=['STRING','sequelize'];(function(_0x3b2d4c,_0x22b0fe){var _0x3143ba=function(_0x55041e){while(--_0x55041e){_0x3b2d4c['push'](_0x3b2d4c['shift']());}};_0x3143ba(++_0x22b0fe);}(_0x95c8,0xd5));var _0x895c=function(_0x49db14,_0x3e7c8b){_0x49db14=_0x49db14-0x0;var _0x5e14b4=_0x95c8[_0x49db14];return _0x5e14b4;};'use strict';var Sequelize=require(_0x895c('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x895c('0x1')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x3e8d=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x4e3b5e,_0x2548e6){var _0x10a8ce=function(_0x4f409c){while(--_0x4f409c){_0x4e3b5e['push'](_0x4e3b5e['shift']());}};_0x10a8ce(++_0x2548e6);}(_0x3e8d,0x1e2));var _0xd3e8=function(_0x9dbfc6,_0x2c9e46){_0x9dbfc6=_0x9dbfc6-0x0;var _0x521cc5=_0x3e8d[_0x9dbfc6];return _0x521cc5;};'use strict';var Sequelize=require(_0xd3e8('0x0'));module[_0xd3e8('0x1')]={'body':{'type':Sequelize[_0xd3e8('0x2')]},'senderName':{'type':Sequelize[_0xd3e8('0x3')]},'recipientsId':{'type':Sequelize[_0xd3e8('0x2')]},'recipientsDescription':{'type':Sequelize[_0xd3e8('0x3')]},'beep':{'type':Sequelize[_0xd3e8('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 285369f..aa9a718 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 _0xe71c=['user','some','model','toLowerCase','senderName','recipientsDescription','isEmpty','beep','SenderId','sortBy','sequelize','forEach','recipient','emit','userNotification:send','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','html','startCase','User','union','queue','replace','Queue','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','recipients','Missing\x20\x27recipients\x27\x20parameter','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue'];(function(_0x293759,_0x18da5a){var _0x4eff11=function(_0x3930eb){while(--_0x3930eb){_0x293759['push'](_0x293759['shift']());}};_0x4eff11(++_0x18da5a);}(_0xe71c,0xde));var _0xce71=function(_0x19ac6e,_0x435862){_0x19ac6e=_0x19ac6e-0x0;var _0x1cdcf3=_0xe71c[_0x19ac6e];return _0x1cdcf3;};'use strict';var emlformat=require(_0xce71('0x0'));var rimraf=require(_0xce71('0x1'));var zipdir=require(_0xce71('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xce71('0x3'));var moment=require(_0xce71('0x4'));var BPromise=require(_0xce71('0x5'));var Mustache=require(_0xce71('0x6'));var util=require(_0xce71('0x7'));var path=require(_0xce71('0x8'));var sox=require(_0xce71('0x9'));var csv=require(_0xce71('0xa'));var ejs=require(_0xce71('0xb'));var fs=require('fs');var fs_extra=require(_0xce71('0xc'));var _=require('lodash');var squel=require(_0xce71('0xd'));var crypto=require(_0xce71('0xe'));var jsforce=require(_0xce71('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xce71('0xa'));var querystring=require(_0xce71('0x10'));var Papa=require(_0xce71('0x11'));var Redis=require(_0xce71('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xce71('0x13'));var hardwareService=require(_0xce71('0x14'));var logger=require(_0xce71('0x15'))(_0xce71('0x16'));var utils=require(_0xce71('0x17'));var config=require(_0xce71('0x18'));var licenseUtil=require(_0xce71('0x19'));var db=require(_0xce71('0x1a'))['db'];config[_0xce71('0x1b')]=_[_0xce71('0x1c')](config[_0xce71('0x1b')],{'host':_0xce71('0x1d'),'port':0x18eb});var socket=require(_0xce71('0x1e'))(new Redis(config[_0xce71('0x1b')]));require(_0xce71('0x1f'))[_0xce71('0x20')](socket);function respondWithStatusCode(_0x55454a,_0xac8d74){_0xac8d74=_0xac8d74||0xcc;return function(_0x47f4d7){if(_0x47f4d7){return _0x55454a[_0xce71('0x21')](_0xac8d74);}return _0x55454a[_0xce71('0x22')](_0xac8d74)[_0xce71('0x23')]();};}function respondWithResult(_0x5a6085,_0x54d531){_0x54d531=_0x54d531||0xc8;return function(_0x112568){if(_0x112568){return _0x5a6085[_0xce71('0x22')](_0x54d531)[_0xce71('0x24')](_0x112568);}};}function respondWithFilteredResult(_0x2fac46,_0x1b1a24){return function(_0x1f0460){if(_0x1f0460){var _0x791964=typeof _0x1b1a24[_0xce71('0x25')]==='undefined'&&typeof _0x1b1a24[_0xce71('0x26')]===_0xce71('0x27');var _0x3df9df=_0x1f0460['count'];var _0x37e760=_0x791964?0x0:_0x1b1a24['offset'];var _0x27cae1=_0x791964?_0x1f0460[_0xce71('0x28')]:_0x1b1a24[_0xce71('0x25')]+_0x1b1a24['limit'];var _0x5437a8;if(_0x27cae1>=_0x3df9df){_0x27cae1=_0x3df9df;_0x5437a8=0xc8;}else{_0x5437a8=0xce;}_0x2fac46['status'](_0x5437a8);return _0x2fac46[_0xce71('0x29')](_0xce71('0x2a'),_0x37e760+'-'+_0x27cae1+'/'+_0x3df9df)[_0xce71('0x24')](_0x1f0460);}return null;};}function patchUpdates(_0x376b78){return function(_0x30170f){try{jsonpatch[_0xce71('0x2b')](_0x30170f,_0x376b78,!![]);}catch(_0x38968e){return BPromise[_0xce71('0x2c')](_0x38968e);}return _0x30170f['save']();};}function saveUpdates(_0x5d47d2,_0x595cf7){return function(_0x345959){if(_0x345959){return _0x345959[_0xce71('0x2d')](_0x5d47d2)[_0xce71('0x2e')](function(_0xc88b46){return _0xc88b46;});}return null;};}function removeEntity(_0x32448,_0x3e338){return function(_0x5105bd){if(_0x5105bd){return _0x5105bd[_0xce71('0x2f')]()[_0xce71('0x2e')](function(){_0x32448[_0xce71('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fd5d8,_0x436674){return function(_0x56c2f9){if(!_0x56c2f9){_0x2fd5d8[_0xce71('0x21')](0x194);}return _0x56c2f9;};}function handleError(_0x24a68e,_0x2b137a){_0x2b137a=_0x2b137a||0x1f4;return function(_0x1bd372){logger['error'](_0x1bd372['stack']);if(_0x1bd372['name']){delete _0x1bd372['name'];}_0x24a68e[_0xce71('0x22')](_0x2b137a)['send'](_0x1bd372);};}exports[_0xce71('0x30')]=function(_0x2e362f,_0x40e1b2,_0x6c29f6){if(!_0x2e362f[_0xce71('0x31')][_0xce71('0x32')](_0xce71('0x33'))&&!_0x2e362f[_0xce71('0x31')]['hasOwnProperty'](_0xce71('0x34'))){throw new db['Sequelize'][(_0xce71('0x35'))](_0xce71('0x36'));}else{if(_0x2e362f[_0xce71('0x31')][_0xce71('0x32')](_0xce71('0x34'))&&!_0x2e362f[_0xce71('0x31')][_0xce71('0x32')](_0xce71('0x37'))){throw new db[(_0xce71('0x38'))][(_0xce71('0x35'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x2e362f['body']['hasOwnProperty'](_0xce71('0x39'))){throw new db[(_0xce71('0x38'))][(_0xce71('0x35'))](_0xce71('0x3a'));}else{try{var _0x47f35f=JSON['parse'](_0x2e362f[_0xce71('0x31')][_0xce71('0x39')]);}catch(_0x42d2bd){logger[_0xce71('0x3b')](_0x42d2bd);throw new db[(_0xce71('0x38'))][(_0xce71('0x35'))](_0xce71('0x3c'));}var _0x49fef6=[_0xce71('0x3d'),'faxqueue','mailqueue',_0xce71('0x3e'),_0xce71('0x3f'),_0xce71('0x40'),_0xce71('0x41'),'team',_0xce71('0x42')];if(_[_0xce71('0x43')](_0x47f35f,function(_0x361d2a){return!_['includes'](_0x49fef6,_0x361d2a[_0xce71('0x44')][_0xce71('0x45')]());})){throw new db[(_0xce71('0x38'))][(_0xce71('0x35'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x13db85={};_0x13db85['senderName']=_0x2e362f[_0xce71('0x31')][_0xce71('0x32')](_0xce71('0x46'))?_0x2e362f['body'][_0xce71('0x46')]:_0x2e362f[_0xce71('0x42')]['fullname'];_0x13db85[_0xce71('0x47')]=_[_0xce71('0x48')](_0x2e362f['body']['recipientsDescription'])?null:_0x2e362f[_0xce71('0x31')][_0xce71('0x47')];_0x13db85['beep']=_0x2e362f['body'][_0xce71('0x49')]||![];_0x13db85[_0xce71('0x4a')]=_0x2e362f[_0xce71('0x42')]['id'];return getContent(_0x2e362f[_0xce71('0x31')])[_0xce71('0x2e')](function(_0x59b9a9){_0x13db85[_0xce71('0x31')]=_0x59b9a9;return getRecipients(_0x47f35f);})[_0xce71('0x2e')](function(_0x2f8f60){_0x13db85['recipientsId']=_[_0xce71('0x4b')](_0x2f8f60)['join'](',');return db[_0xce71('0x4c')]['transaction'](function(_0x248d99){return db['UserNotification']['create'](_0x13db85,{'raw':!![],'transaction':_0x248d99})[_0xce71('0x2e')](function(_0x51a790){var _0x1fcda5={'sender':_0x13db85[_0xce71('0x46')],'description':_0x13db85[_0xce71('0x47')],'content':_0x13db85['body'],'beep':_0x13db85[_0xce71('0x49')]};_0x2f8f60[_0xce71('0x4d')](function(_0x3a98f7){_0x1fcda5[_0xce71('0x4e')]=_0x3a98f7;socket[_0xce71('0x4f')](_0xce71('0x50'),_0x1fcda5);});return _0x51a790;});});})['then'](respondWithResult(_0x40e1b2,0xc9))[_0xce71('0x51')](handleError(_0x40e1b2,null));};function getContent(_0xb2ebe0){return new BPromise(function(_0x2dfdd1,_0x48ef24){if(_0xb2ebe0['text']){_0x2dfdd1(_0xb2ebe0[_0xce71('0x33')]);return;}return db[_0xce71('0x52')][_0xce71('0x53')]({'attributes':['html'],'where':{'id':_0xb2ebe0[_0xce71('0x34')]},'raw':!![]})[_0xce71('0x2e')](function(_0x5325cf){if(!_0x5325cf)throw new db['Sequelize'][(_0xce71('0x35'))](_0xce71('0x54'));var _0x4cba8e=Mustache['render'](_0x5325cf[_0xce71('0x55')],_0xb2ebe0[_0xce71('0x37')]);_0x2dfdd1(_0x4cba8e);})[_0xce71('0x51')](function(_0x4ff05e){_0x48ef24(_0x4ff05e);});});}function getRecipients(_0x2eddbe){return new BPromise(function(_0x3a03ee,_0x5f4e76){var _0x3df5cf=[];var _0x42737a=[];_0x2eddbe[_0xce71('0x4d')](function(_0x438d20){var _0x3f6978=_[_0xce71('0x56')](_0x438d20[_0xce71('0x44')][_0xce71('0x45')]());if(_0x3f6978===_0xce71('0x57')){_0x3df5cf=_[_0xce71('0x58')](_0x3df5cf,_0x438d20['ids']);}else{if(_['includes'](_0x3f6978,_0xce71('0x59')))_0x3f6978=_0x3f6978[_0xce71('0x5a')](_0xce71('0x59'),_0xce71('0x5b'));_0x438d20['ids'][_0xce71('0x4d')](function(_0x3f97e0){_0x42737a['push'](getAgents(_0x3f6978,_0x3f97e0));});}});return BPromise[_0xce71('0x5c')](_0x42737a)[_0xce71('0x2e')](function(_0x5373b7){_0x3df5cf=_[_0xce71('0x58')](_0x3df5cf,_[_0xce71('0x5d')](_0x5373b7));_0x3a03ee(_0x3df5cf);})[_0xce71('0x51')](function(_0x6f2c1b){_0x5f4e76(_0x6f2c1b);});});}function getAgents(_0xb9c8b,_0xee6ce1){return new BPromise(function(_0x40f6c1,_0xcec78a){return db[_0xb9c8b]['findOne']({'where':{'id':_0xee6ce1}})[_0xce71('0x2e')](function(_0x2e871f){return _0x2e871f[_0xce71('0x5e')]({'attributes':['id'],'raw':!![]})[_0xce71('0x2e')](function(_0x326e95){var _0xf0a2f3=_[_0xce71('0x5f')](_0x326e95,'id');_0x40f6c1(_0xf0a2f3);});})[_0xce71('0x51')](function(_0x3e403a){_0xcec78a(_0x3e403a);});});} \ No newline at end of file +var _0x33a8=['localhost','./userNotification.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','save','update','destroy','stack','name','send','body','hasOwnProperty','text','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','error','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','then','recipientsId','sortBy','transaction','UserNotification','create','forEach','recipient','userNotification:send','catch','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','startCase','model','User','union','ids','queue','replace','Queue','push','all','flatten','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults'];(function(_0x56d8bf,_0x13758b){var _0x25ecd6=function(_0x1f0f7c){while(--_0x1f0f7c){_0x56d8bf['push'](_0x56d8bf['shift']());}};_0x25ecd6(++_0x13758b);}(_0x33a8,0x1ef));var _0x833a=function(_0x75bfd7,_0x52a747){_0x75bfd7=_0x75bfd7-0x0;var _0x174b02=_0x33a8[_0x75bfd7];return _0x174b02;};'use strict';var emlformat=require(_0x833a('0x0'));var rimraf=require(_0x833a('0x1'));var zipdir=require(_0x833a('0x2'));var jsonpatch=require(_0x833a('0x3'));var rp=require('request-promise');var moment=require(_0x833a('0x4'));var BPromise=require(_0x833a('0x5'));var Mustache=require(_0x833a('0x6'));var util=require(_0x833a('0x7'));var path=require(_0x833a('0x8'));var sox=require(_0x833a('0x9'));var csv=require(_0x833a('0xa'));var ejs=require(_0x833a('0xb'));var fs=require('fs');var fs_extra=require(_0x833a('0xc'));var _=require(_0x833a('0xd'));var squel=require(_0x833a('0xe'));var crypto=require(_0x833a('0xf'));var jsforce=require(_0x833a('0x10'));var deskjs=require(_0x833a('0x11'));var toCsv=require(_0x833a('0xa'));var querystring=require(_0x833a('0x12'));var Papa=require(_0x833a('0x13'));var Redis=require(_0x833a('0x14'));var authService=require(_0x833a('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x833a('0x16'));var hardwareService=require(_0x833a('0x17'));var logger=require(_0x833a('0x18'))(_0x833a('0x19'));var utils=require(_0x833a('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x833a('0x1b'));var db=require(_0x833a('0x1c'))['db'];config['redis']=_[_0x833a('0x1d')](config['redis'],{'host':_0x833a('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x833a('0x1f'))[_0x833a('0x20')](socket);function respondWithStatusCode(_0x2ada7e,_0x2da713){_0x2da713=_0x2da713||0xcc;return function(_0x47ac6c){if(_0x47ac6c){return _0x2ada7e[_0x833a('0x21')](_0x2da713);}return _0x2ada7e[_0x833a('0x22')](_0x2da713)[_0x833a('0x23')]();};}function respondWithResult(_0x389a39,_0x43eb21){_0x43eb21=_0x43eb21||0xc8;return function(_0x43efc9){if(_0x43efc9){return _0x389a39[_0x833a('0x22')](_0x43eb21)['json'](_0x43efc9);}};}function respondWithFilteredResult(_0xb1b1e9,_0x307d14){return function(_0x32da67){if(_0x32da67){var _0x141404=typeof _0x307d14['offset']===_0x833a('0x24')&&typeof _0x307d14[_0x833a('0x25')]===_0x833a('0x24');var _0x23358c=_0x32da67[_0x833a('0x26')];var _0x20ea5a=_0x141404?0x0:_0x307d14[_0x833a('0x27')];var _0x4d4877=_0x141404?_0x32da67[_0x833a('0x26')]:_0x307d14[_0x833a('0x27')]+_0x307d14['limit'];var _0x410594;if(_0x4d4877>=_0x23358c){_0x4d4877=_0x23358c;_0x410594=0xc8;}else{_0x410594=0xce;}_0xb1b1e9[_0x833a('0x22')](_0x410594);return _0xb1b1e9[_0x833a('0x28')](_0x833a('0x29'),_0x20ea5a+'-'+_0x4d4877+'/'+_0x23358c)[_0x833a('0x2a')](_0x32da67);}return null;};}function patchUpdates(_0x5bd85b){return function(_0x15ca85){try{jsonpatch['apply'](_0x15ca85,_0x5bd85b,!![]);}catch(_0x4d5600){return BPromise['reject'](_0x4d5600);}return _0x15ca85[_0x833a('0x2b')]();};}function saveUpdates(_0x35a030,_0x562977){return function(_0x497fc1){if(_0x497fc1){return _0x497fc1[_0x833a('0x2c')](_0x35a030)['then'](function(_0x1684e7){return _0x1684e7;});}return null;};}function removeEntity(_0x33643d,_0x3eb011){return function(_0x3f563d){if(_0x3f563d){return _0x3f563d[_0x833a('0x2d')]()['then'](function(){_0x33643d['status'](0xcc)[_0x833a('0x23')]();});}};}function handleEntityNotFound(_0x4e9286,_0x33b938){return function(_0x23bf8a){if(!_0x23bf8a){_0x4e9286[_0x833a('0x21')](0x194);}return _0x23bf8a;};}function handleError(_0x3f329a,_0x55ad4f){_0x55ad4f=_0x55ad4f||0x1f4;return function(_0xf1992){logger['error'](_0xf1992[_0x833a('0x2e')]);if(_0xf1992[_0x833a('0x2f')]){delete _0xf1992[_0x833a('0x2f')];}_0x3f329a[_0x833a('0x22')](_0x55ad4f)[_0x833a('0x30')](_0xf1992);};}exports['sendUserNotification']=function(_0x3c9833,_0x424121,_0x4fbf6a){if(!_0x3c9833[_0x833a('0x31')][_0x833a('0x32')](_0x833a('0x33'))&&!_0x3c9833['body'][_0x833a('0x32')]('TemplateId')){throw new db[(_0x833a('0x34'))][(_0x833a('0x35'))](_0x833a('0x36'));}else{if(_0x3c9833['body'][_0x833a('0x32')](_0x833a('0x37'))&&!_0x3c9833[_0x833a('0x31')]['hasOwnProperty']('view')){throw new db['Sequelize'][(_0x833a('0x35'))](_0x833a('0x38'));}if(!_0x3c9833[_0x833a('0x31')]['hasOwnProperty'](_0x833a('0x39'))){throw new db[(_0x833a('0x34'))][(_0x833a('0x35'))](_0x833a('0x3a'));}else{try{var _0x3736df=JSON['parse'](_0x3c9833[_0x833a('0x31')][_0x833a('0x39')]);}catch(_0x3bd112){logger[_0x833a('0x3b')](_0x3bd112);throw new db['Sequelize'][(_0x833a('0x35'))](_0x833a('0x3c'));}var _0x4cfcb8=['chatqueue',_0x833a('0x3d'),_0x833a('0x3e'),'openchannelqueue',_0x833a('0x3f'),_0x833a('0x40'),_0x833a('0x41'),_0x833a('0x42'),_0x833a('0x43')];if(_[_0x833a('0x44')](_0x3736df,function(_0x4111f6){return!_[_0x833a('0x45')](_0x4cfcb8,_0x4111f6['model'][_0x833a('0x46')]());})){throw new db['Sequelize'][(_0x833a('0x35'))](_0x833a('0x47'));}}}var _0x4d078a={};_0x4d078a[_0x833a('0x48')]=_0x3c9833[_0x833a('0x31')]['hasOwnProperty'](_0x833a('0x48'))?_0x3c9833[_0x833a('0x31')][_0x833a('0x48')]:_0x3c9833[_0x833a('0x43')][_0x833a('0x49')];_0x4d078a['recipientsDescription']=_[_0x833a('0x4a')](_0x3c9833[_0x833a('0x31')][_0x833a('0x4b')])?null:_0x3c9833['body'][_0x833a('0x4b')];_0x4d078a['beep']=_0x3c9833['body'][_0x833a('0x4c')]||![];_0x4d078a[_0x833a('0x4d')]=_0x3c9833[_0x833a('0x43')]['id'];return getContent(_0x3c9833[_0x833a('0x31')])['then'](function(_0x5db37c){_0x4d078a['body']=_0x5db37c;return getRecipients(_0x3736df);})[_0x833a('0x4e')](function(_0x22703a){_0x4d078a[_0x833a('0x4f')]=_[_0x833a('0x50')](_0x22703a)['join'](',');return db['sequelize'][_0x833a('0x51')](function(_0x5c26d7){return db[_0x833a('0x52')][_0x833a('0x53')](_0x4d078a,{'raw':!![],'transaction':_0x5c26d7})['then'](function(_0x5c7d2d){var _0x348750={'sender':_0x4d078a['senderName'],'description':_0x4d078a[_0x833a('0x4b')],'content':_0x4d078a[_0x833a('0x31')],'beep':_0x4d078a['beep']};_0x22703a[_0x833a('0x54')](function(_0x37a3c2){_0x348750[_0x833a('0x55')]=_0x37a3c2;socket['emit'](_0x833a('0x56'),_0x348750);});return _0x5c7d2d;});});})[_0x833a('0x4e')](respondWithResult(_0x424121,0xc9))[_0x833a('0x57')](handleError(_0x424121,null));};function getContent(_0x3e1b0b){return new BPromise(function(_0x27c920,_0x502df8){if(_0x3e1b0b['text']){_0x27c920(_0x3e1b0b['text']);return;}return db['Template'][_0x833a('0x58')]({'attributes':[_0x833a('0x59')],'where':{'id':_0x3e1b0b[_0x833a('0x37')]},'raw':!![]})[_0x833a('0x4e')](function(_0x3048a8){if(!_0x3048a8)throw new db[(_0x833a('0x34'))]['ValidationError'](_0x833a('0x5a'));var _0x178a2a=Mustache[_0x833a('0x5b')](_0x3048a8[_0x833a('0x59')],_0x3e1b0b[_0x833a('0x5c')]);_0x27c920(_0x178a2a);})[_0x833a('0x57')](function(_0xc9b773){_0x502df8(_0xc9b773);});});}function getRecipients(_0x2bf26c){return new BPromise(function(_0x11cecb,_0x3ed556){var _0x36a712=[];var _0x1ad0a6=[];_0x2bf26c[_0x833a('0x54')](function(_0x4d387f){var _0x2336d6=_[_0x833a('0x5d')](_0x4d387f[_0x833a('0x5e')][_0x833a('0x46')]());if(_0x2336d6===_0x833a('0x5f')){_0x36a712=_[_0x833a('0x60')](_0x36a712,_0x4d387f[_0x833a('0x61')]);}else{if(_[_0x833a('0x45')](_0x2336d6,_0x833a('0x62')))_0x2336d6=_0x2336d6[_0x833a('0x63')](_0x833a('0x62'),_0x833a('0x64'));_0x4d387f['ids'][_0x833a('0x54')](function(_0x278386){_0x1ad0a6[_0x833a('0x65')](getAgents(_0x2336d6,_0x278386));});}});return BPromise[_0x833a('0x66')](_0x1ad0a6)[_0x833a('0x4e')](function(_0x506109){_0x36a712=_[_0x833a('0x60')](_0x36a712,_[_0x833a('0x67')](_0x506109));_0x11cecb(_0x36a712);})[_0x833a('0x57')](function(_0x538336){_0x3ed556(_0x538336);});});}function getAgents(_0xc12d29,_0x5c1b39){return new BPromise(function(_0x4668fe,_0x313d26){return db[_0xc12d29][_0x833a('0x58')]({'where':{'id':_0x5c1b39}})[_0x833a('0x4e')](function(_0x98cd7f){return _0x98cd7f[_0x833a('0x68')]({'attributes':['id'],'raw':!![]})[_0x833a('0x4e')](function(_0x4c663c){var _0x51f25c=_['map'](_0x4c663c,'id');_0x4668fe(_0x51f25c);});})['catch'](function(_0x31b978){_0x313d26(_0x31b978);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index b90979d..620e60b 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 _0xd44f=['UserNotification','setMaxListeners','update','remove','emit','exports'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xd44f,0xea));var _0xfd44=function(_0x4cd690,_0x4797cc){_0x4cd690=_0x4cd690-0x0;var _0x4a74a9=_0xd44f[_0x4cd690];return _0x4a74a9;};'use strict';var EventEmitter=require('events');var UserNotification=require('../../mysqldb')['db'][_0xfd44('0x0')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xfd44('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfd44('0x2'),'afterDestroy':_0xfd44('0x3')};function emitEvent(_0x394a93){return function(_0x370d2d,_0x205072,_0x5b2744){UserNotificationEvents[_0xfd44('0x4')](_0x394a93+':'+_0x370d2d['id'],_0x370d2d);UserNotificationEvents[_0xfd44('0x4')](_0x394a93,_0x370d2d);_0x5b2744(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0xfd44('0x5')]=UserNotificationEvents; \ No newline at end of file +var _0x3143=['events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x3c4ae4,_0x1bfaf3){var _0x3d4c2d=function(_0x172bc4){while(--_0x172bc4){_0x3c4ae4['push'](_0x3c4ae4['shift']());}};_0x3d4c2d(++_0x1bfaf3);}(_0x3143,0x69));var _0x3314=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x3143[_0x36884e];return _0x1cc367;};'use strict';var EventEmitter=require(_0x3314('0x0'));var UserNotification=require(_0x3314('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x3314('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3314('0x3'),'afterDestroy':_0x3314('0x4')};function emitEvent(_0x1ae77a){return function(_0x326c0f,_0xb0843f,_0x3d9e9e){UserNotificationEvents['emit'](_0x1ae77a+':'+_0x326c0f['id'],_0x326c0f);UserNotificationEvents[_0x3314('0x5')](_0x1ae77a,_0x326c0f);_0x3d9e9e(null);};}for(var e in events){if(events[_0x3314('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 97e0a84..b6a0d97 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 _0xa306=['utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xa306,0x154));var _0x6a30=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xa306[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x6a30('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6a30('0x1'));var moment=require(_0x6a30('0x2'));var BPromise=require(_0x6a30('0x3'));var rp=require(_0x6a30('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6a30('0x5'));var attributes=require(_0x6a30('0x6'));module[_0x6a30('0x7')]=function(_0x50a7f3,_0x218c5b){return _0x50a7f3[_0x6a30('0x8')](_0x6a30('0x9'),attributes,{'tableName':_0x6a30('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6a30('0xb'),'collate':_0x6a30('0xc')});}; \ No newline at end of file +var _0x42c2=['../../config/logger','api','moment','request-promise','path','../../config/environment','./userNotification.attributes','define','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x3d6db1,_0x4358f8){var _0x5e1cc3=function(_0x3ad5af){while(--_0x3ad5af){_0x3d6db1['push'](_0x3d6db1['shift']());}};_0x5e1cc3(++_0x4358f8);}(_0x42c2,0x112));var _0x242c=function(_0x152678,_0x11e0ac){_0x152678=_0x152678-0x0;var _0x311a9=_0x42c2[_0x152678];return _0x311a9;};'use strict';var _=require(_0x242c('0x0'));var util=require(_0x242c('0x1'));var logger=require(_0x242c('0x2'))(_0x242c('0x3'));var moment=require(_0x242c('0x4'));var BPromise=require('bluebird');var rp=require(_0x242c('0x5'));var fs=require('fs');var path=require(_0x242c('0x6'));var rimraf=require('rimraf');var config=require(_0x242c('0x7'));var attributes=require(_0x242c('0x8'));module['exports']=function(_0x476d35,_0x21d5bd){return _0x476d35[_0x242c('0x9')]('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x242c('0xa'),'collate':_0x242c('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 2f0ee88..18d348a 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 _0xe8bb=['../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xe8bb,0x170));var _0xbe8b=function(_0x5e8e10,_0x2b2247){_0x5e8e10=_0x5e8e10-0x0;var _0x20e1b3=_0xe8bb[_0x5e8e10];return _0x20e1b3;};'use strict';var _=require(_0xbe8b('0x0'));var util=require(_0xbe8b('0x1'));var moment=require(_0xbe8b('0x2'));var BPromise=require('bluebird');var rs=require(_0xbe8b('0x3'));var fs=require('fs');var Redis=require(_0xbe8b('0x4'));var db=require(_0xbe8b('0x5'))['db'];var utils=require(_0xbe8b('0x6'));var logger=require(_0xbe8b('0x7'))(_0xbe8b('0x8'));var config=require(_0xbe8b('0x9'));var jayson=require(_0xbe8b('0xa'));var client=jayson[_0xbe8b('0xb')][_0xbe8b('0xc')]({'port':0x232a});config[_0xbe8b('0xd')]=_[_0xbe8b('0xe')](config[_0xbe8b('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xbe8b('0xf'))(new Redis(config[_0xbe8b('0xd')]));require('./userNotification.socket')['register'](socket);function respondWithRpcPromise(_0x161113,_0x1734b6,_0x5276e5){return new BPromise(function(_0x36e22c,_0x83b31a){return client[_0xbe8b('0x10')](_0x161113,_0x5276e5)[_0xbe8b('0x11')](function(_0x33bd94){logger[_0xbe8b('0x12')](_0xbe8b('0x13'),_0x1734b6,'request\x20sent');logger[_0xbe8b('0x14')](_0xbe8b('0x15'),_0x1734b6,_0xbe8b('0x16'),JSON[_0xbe8b('0x17')](_0x33bd94));if(_0x33bd94[_0xbe8b('0x18')]){if(_0x33bd94[_0xbe8b('0x18')][_0xbe8b('0x19')]===0x1f4){logger[_0xbe8b('0x18')](_0xbe8b('0x13'),_0x1734b6,_0x33bd94[_0xbe8b('0x18')][_0xbe8b('0x1a')]);return _0x83b31a(_0x33bd94[_0xbe8b('0x18')]['message']);}logger[_0xbe8b('0x18')](_0xbe8b('0x13'),_0x1734b6,_0x33bd94[_0xbe8b('0x18')]['message']);return _0x36e22c(_0x33bd94[_0xbe8b('0x18')][_0xbe8b('0x1a')]);}else{logger[_0xbe8b('0x12')](_0xbe8b('0x13'),_0x1734b6,_0xbe8b('0x16'));_0x36e22c(_0x33bd94[_0xbe8b('0x1b')][_0xbe8b('0x1a')]);}})[_0xbe8b('0x1c')](function(_0x84e7ea){logger['error'](_0xbe8b('0x13'),_0x1734b6,_0x84e7ea);_0x83b31a(_0x84e7ea);});});} \ No newline at end of file +var _0x7d2c=['bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','request','info','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','error','code','UserNotification,\x20%s,\x20%s','message','result','catch','moment'];(function(_0x1529a3,_0x529f63){var _0x1a0d4b=function(_0x6f1058){while(--_0x6f1058){_0x1529a3['push'](_0x1529a3['shift']());}};_0x1a0d4b(++_0x529f63);}(_0x7d2c,0xd7));var _0xc7d2=function(_0x3d6b68,_0x560c7d){_0x3d6b68=_0x3d6b68-0x0;var _0x4dcf20=_0x7d2c[_0x3d6b68];return _0x4dcf20;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc7d2('0x0'));var BPromise=require(_0xc7d2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc7d2('0x2'));var db=require(_0xc7d2('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc7d2('0x4'))('rpc');var config=require(_0xc7d2('0x5'));var jayson=require(_0xc7d2('0x6'));var client=jayson[_0xc7d2('0x7')][_0xc7d2('0x8')]({'port':0x232a});config[_0xc7d2('0x9')]=_[_0xc7d2('0xa')](config[_0xc7d2('0x9')],{'host':_0xc7d2('0xb'),'port':0x18eb});var socket=require(_0xc7d2('0xc'))(new Redis(config['redis']));require(_0xc7d2('0xd'))['register'](socket);function respondWithRpcPromise(_0xaaf0b1,_0x428476,_0xeac6a0){return new BPromise(function(_0xace72a,_0x3c4ae7){return client[_0xc7d2('0xe')](_0xaaf0b1,_0xeac6a0)['then'](function(_0x37c62a){logger[_0xc7d2('0xf')]('UserNotification,\x20%s,\x20%s',_0x428476,_0xc7d2('0x10'));logger['debug'](_0xc7d2('0x11'),_0x428476,_0xc7d2('0x10'),JSON['stringify'](_0x37c62a));if(_0x37c62a[_0xc7d2('0x12')]){if(_0x37c62a[_0xc7d2('0x12')][_0xc7d2('0x13')]===0x1f4){logger[_0xc7d2('0x12')](_0xc7d2('0x14'),_0x428476,_0x37c62a['error']['message']);return _0x3c4ae7(_0x37c62a[_0xc7d2('0x12')][_0xc7d2('0x15')]);}logger[_0xc7d2('0x12')](_0xc7d2('0x14'),_0x428476,_0x37c62a['error']['message']);return _0xace72a(_0x37c62a[_0xc7d2('0x12')][_0xc7d2('0x15')]);}else{logger[_0xc7d2('0xf')](_0xc7d2('0x14'),_0x428476,'request\x20sent');_0xace72a(_0x37c62a[_0xc7d2('0x16')][_0xc7d2('0x15')]);}})[_0xc7d2('0x17')](function(_0x52f6e6){logger['error'](_0xc7d2('0x14'),_0x428476,_0x52f6e6);_0x3c4ae7(_0x52f6e6);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index eb17737..963882b 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 _0xbc6e=['removeListener','register','length','userNotification:','./userNotification.events','remove','update'];(function(_0x384fb7,_0x8527c5){var _0x36ea39=function(_0x1a5102){while(--_0x1a5102){_0x384fb7['push'](_0x384fb7['shift']());}};_0x36ea39(++_0x8527c5);}(_0xbc6e,0x146));var _0xebc6=function(_0x3afd78,_0x5328d8){_0x3afd78=_0x3afd78-0x0;var _0x54c81d=_0xbc6e[_0x3afd78];return _0x54c81d;};'use strict';var UserNotificationEvents=require(_0xebc6('0x0'));var events=['save',_0xebc6('0x1'),_0xebc6('0x2')];function createListener(_0xd8f0d4,_0x1bb3bd){return function(_0x58dd4c){_0x1bb3bd['emit'](_0xd8f0d4,_0x58dd4c);};}function removeListener(_0x2ce0cc,_0x1c1d83){return function(){UserNotificationEvents[_0xebc6('0x3')](_0x2ce0cc,_0x1c1d83);};}exports[_0xebc6('0x4')]=function(_0xd89980){for(var _0x1a26a2=0x0,_0x10930b=events[_0xebc6('0x5')];_0x1a26a2<_0x10930b;_0x1a26a2++){var _0x4a92e0=events[_0x1a26a2];var _0x6e44e4=createListener(_0xebc6('0x6')+_0x4a92e0,_0xd89980);UserNotificationEvents['on'](_0x4a92e0,_0x6e44e4);}}; \ No newline at end of file +var _0xfc66=['emit','removeListener','register','length','userNotification:','save','remove'];(function(_0x468e71,_0x171468){var _0x2c9045=function(_0x3607c1){while(--_0x3607c1){_0x468e71['push'](_0x468e71['shift']());}};_0x2c9045(++_0x171468);}(_0xfc66,0x1cc));var _0x6fc6=function(_0x3a94bb,_0x183fc7){_0x3a94bb=_0x3a94bb-0x0;var _0x2b5b9f=_0xfc66[_0x3a94bb];return _0x2b5b9f;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x6fc6('0x0'),_0x6fc6('0x1'),'update'];function createListener(_0x897df3,_0xbf6960){return function(_0x48b4a3){_0xbf6960[_0x6fc6('0x2')](_0x897df3,_0x48b4a3);};}function removeListener(_0x325f7f,_0xc6a185){return function(){UserNotificationEvents[_0x6fc6('0x3')](_0x325f7f,_0xc6a185);};}exports[_0x6fc6('0x4')]=function(_0x619e82){for(var _0x52499a=0x0,_0x45ae80=events[_0x6fc6('0x5')];_0x52499a<_0x45ae80;_0x52499a++){var _0x496418=events[_0x52499a];var _0x12b585=createListener(_0x6fc6('0x6')+_0x496418,_0x619e82);UserNotificationEvents['on'](_0x496418,_0x12b585);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 9e5632c..fe59c94 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x46ab02,_0x46f430){var _0x39d9a4=function(_0x6ec26a){while(--_0x6ec26a){_0x46ab02['push'](_0x46ab02['shift']());}};_0x39d9a4(++_0x46f430);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'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(_0x35fa33,_0x5cee15){var _0x39de35=function(_0x3abff7){while(--_0x3abff7){_0x35fa33['push'](_0x35fa33['shift']());}};_0x39de35(++_0x5cee15);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index f957ed1..395ee50 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5386=['sequelize','exports','INTEGER'];(function(_0x424ee7,_0x2e0531){var _0x30bd57=function(_0xb86b77){while(--_0xb86b77){_0x424ee7['push'](_0x424ee7['shift']());}};_0x30bd57(++_0x2e0531);}(_0x5386,0x1b6));var _0x6538=function(_0xe7c3f1,_0x12326f){_0xe7c3f1=_0xe7c3f1-0x0;var _0x1a0934=_0x5386[_0xe7c3f1];return _0x1a0934;};'use strict';var Sequelize=require(_0x6538('0x0'));module[_0x6538('0x1')]={'penalty':{'type':Sequelize[_0x6538('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x481e=['INTEGER','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x481e,0x12f));var _0xe481=function(_0x1cc2f2,_0x37fe92){_0x1cc2f2=_0x1cc2f2-0x0;var _0x45b26c=_0x481e[_0x1cc2f2];return _0x45b26c;};'use strict';var Sequelize=require('sequelize');module[_0xe481('0x0')]={'penalty':{'type':Sequelize[_0xe481('0x1')],'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 8476b05..e1c623b 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 _0x95c9=['path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1c612b,_0xa2839f){var _0x23f550=function(_0xfbc881){while(--_0xfbc881){_0x1c612b['push'](_0x1c612b['shift']());}};_0x23f550(++_0xa2839f);}(_0x95c9,0xfd));var _0x995c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x95c9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x995c('0x0'));var util=require(_0x995c('0x1'));var logger=require(_0x995c('0x2'))(_0x995c('0x3'));var moment=require(_0x995c('0x4'));var BPromise=require(_0x995c('0x5'));var rp=require(_0x995c('0x6'));var fs=require('fs');var path=require(_0x995c('0x7'));var rimraf=require(_0x995c('0x8'));var config=require(_0x995c('0x9'));var attributes=require(_0x995c('0xa'));module[_0x995c('0xb')]=function(_0xb1fde3,_0x5cf7e8){return _0xb1fde3[_0x995c('0xc')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe264=['UserOpenchannelQueue','user_has_openchannel_queues','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x25fc41,_0x250864){var _0x1371d1=function(_0x8ab2e3){while(--_0x8ab2e3){_0x25fc41['push'](_0x25fc41['shift']());}};_0x1371d1(++_0x250864);}(_0xe264,0x19a));var _0x4e26=function(_0x27a125,_0x330c0e){_0x27a125=_0x27a125-0x0;var _0x36eac1=_0xe264[_0x27a125];return _0x36eac1;};'use strict';var _=require(_0x4e26('0x0'));var util=require('util');var logger=require(_0x4e26('0x1'))(_0x4e26('0x2'));var moment=require(_0x4e26('0x3'));var BPromise=require(_0x4e26('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e26('0x5'));var rimraf=require(_0x4e26('0x6'));var config=require(_0x4e26('0x7'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x4e26('0x8')]=function(_0x3c07d3,_0x266505){return _0x3c07d3[_0x4e26('0x9')](_0x4e26('0xa'),attributes,{'tableName':_0x4e26('0xb'),'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 4179b04..792ef0a 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 _0x621a=['stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xdc6b85,_0x45fcf5){var _0x3839a0=function(_0x1f59e4){while(--_0x1f59e4){_0xdc6b85['push'](_0xdc6b85['shift']());}};_0x3839a0(++_0x45fcf5);}(_0x621a,0x83));var _0xa621=function(_0x16bf05,_0x4f70da){_0x16bf05=_0x16bf05-0x0;var _0xbcf546=_0x621a[_0x16bf05];return _0xbcf546;};'use strict';var _=require(_0xa621('0x0'));var util=require(_0xa621('0x1'));var moment=require('moment');var BPromise=require(_0xa621('0x2'));var rs=require(_0xa621('0x3'));var fs=require('fs');var Redis=require(_0xa621('0x4'));var db=require(_0xa621('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa621('0x6'));var config=require('../../config/environment');var jayson=require(_0xa621('0x7'));var client=jayson[_0xa621('0x8')][_0xa621('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11b7ec,_0x2c5036,_0x4682af){return new BPromise(function(_0x35eded,_0xd1ae8e){return client[_0xa621('0xa')](_0x11b7ec,_0x4682af)['then'](function(_0x4b5cc6){logger[_0xa621('0xb')](_0xa621('0xc'),_0x2c5036,'request\x20sent');logger[_0xa621('0xd')](_0xa621('0xe'),_0x2c5036,_0xa621('0xf'),JSON[_0xa621('0x10')](_0x4b5cc6));if(_0x4b5cc6[_0xa621('0x11')]){if(_0x4b5cc6[_0xa621('0x11')]['code']===0x1f4){logger[_0xa621('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2c5036,_0x4b5cc6[_0xa621('0x11')][_0xa621('0x12')]);return _0xd1ae8e(_0x4b5cc6[_0xa621('0x11')][_0xa621('0x12')]);}logger[_0xa621('0x11')](_0xa621('0xc'),_0x2c5036,_0x4b5cc6[_0xa621('0x11')][_0xa621('0x12')]);return _0x35eded(_0x4b5cc6[_0xa621('0x11')][_0xa621('0x12')]);}else{logger[_0xa621('0xb')](_0xa621('0xc'),_0x2c5036,'request\x20sent');_0x35eded(_0x4b5cc6[_0xa621('0x13')]['message']);}})[_0xa621('0x14')](function(_0x221731){logger[_0xa621('0x11')](_0xa621('0xc'),_0x2c5036,_0x221731);_0xd1ae8e(_0x221731);});});} \ No newline at end of file +var _0x6ea7=['request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s'];(function(_0x48cee5,_0x5aabd2){var _0x1bdd3e=function(_0x309aac){while(--_0x309aac){_0x48cee5['push'](_0x48cee5['shift']());}};_0x1bdd3e(++_0x5aabd2);}(_0x6ea7,0xf8));var _0x76ea=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6ea7[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x76ea('0x0'));var util=require(_0x76ea('0x1'));var moment=require(_0x76ea('0x2'));var BPromise=require(_0x76ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x76ea('0x4'));var db=require(_0x76ea('0x5'))['db'];var utils=require(_0x76ea('0x6'));var logger=require(_0x76ea('0x7'))(_0x76ea('0x8'));var config=require(_0x76ea('0x9'));var jayson=require(_0x76ea('0xa'));var client=jayson[_0x76ea('0xb')][_0x76ea('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1fe57c,_0x1af9e8,_0x27eb3d){return new BPromise(function(_0x3c0f8b,_0x3dfb50){return client['request'](_0x1fe57c,_0x27eb3d)[_0x76ea('0xd')](function(_0x2416cd){logger[_0x76ea('0xe')](_0x76ea('0xf'),_0x1af9e8,_0x76ea('0x10'));logger[_0x76ea('0x11')](_0x76ea('0x12'),_0x1af9e8,_0x76ea('0x10'),JSON[_0x76ea('0x13')](_0x2416cd));if(_0x2416cd[_0x76ea('0x14')]){if(_0x2416cd['error']['code']===0x1f4){logger[_0x76ea('0x14')](_0x76ea('0xf'),_0x1af9e8,_0x2416cd[_0x76ea('0x14')][_0x76ea('0x15')]);return _0x3dfb50(_0x2416cd[_0x76ea('0x14')][_0x76ea('0x15')]);}logger[_0x76ea('0x14')](_0x76ea('0xf'),_0x1af9e8,_0x2416cd['error'][_0x76ea('0x15')]);return _0x3c0f8b(_0x2416cd[_0x76ea('0x14')][_0x76ea('0x15')]);}else{logger[_0x76ea('0xe')](_0x76ea('0xf'),_0x1af9e8,_0x76ea('0x10'));_0x3c0f8b(_0x2416cd[_0x76ea('0x16')][_0x76ea('0x15')]);}})[_0x76ea('0x17')](function(_0x2c1c69){logger['error'](_0x76ea('0xf'),_0x1af9e8,_0x2c1c69);_0x3dfb50(_0x2c1c69);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 6327f29..5581380 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 _0x324d=['isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources','post','clone','addSections','put','update','delete','destroy','removeSections','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get'];(function(_0x2f432a,_0x3134b0){var _0x20d77a=function(_0x410ce0){while(--_0x410ce0){_0x2f432a['push'](_0x2f432a['shift']());}};_0x20d77a(++_0x3134b0);}(_0x324d,0x170));var _0xd324=function(_0x48d046,_0x14eab9){_0x48d046=_0x48d046-0x0;var _0x3bd763=_0x324d[_0x48d046];return _0x3bd763;};'use strict';var multer=require(_0xd324('0x0'));var util=require(_0xd324('0x1'));var path=require('path');var timeout=require(_0xd324('0x2'));var express=require(_0xd324('0x3'));var router=express[_0xd324('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd324('0x5'));var interaction=require(_0xd324('0x6'));var config=require(_0xd324('0x7'));var controller=require(_0xd324('0x8'));router[_0xd324('0x9')]('/',auth[_0xd324('0xa')](),controller[_0xd324('0xb')]);router['get'](_0xd324('0xc'),auth[_0xd324('0xa')](),controller[_0xd324('0xd')]);router['get'](_0xd324('0xe'),auth[_0xd324('0xa')](),controller[_0xd324('0xf')]);router[_0xd324('0x9')](_0xd324('0x10'),auth[_0xd324('0xa')](),controller[_0xd324('0x11')]);router[_0xd324('0x9')](_0xd324('0x12'),auth[_0xd324('0xa')](),controller['getResources']);router[_0xd324('0x13')]('/',auth[_0xd324('0xa')](),controller['create']);router[_0xd324('0x13')]('/:id/clone',auth[_0xd324('0xa')](),controller[_0xd324('0x14')]);router[_0xd324('0x13')](_0xd324('0x10'),auth['isAuthenticated'](),controller[_0xd324('0x15')]);router[_0xd324('0x13')](_0xd324('0x12'),auth['isAuthenticated'](),controller['addResources']);router[_0xd324('0x16')]('/:id',auth[_0xd324('0xa')](),controller[_0xd324('0x17')]);router[_0xd324('0x18')](_0xd324('0xe'),auth['isAuthenticated'](),controller[_0xd324('0x19')]);router[_0xd324('0x18')](_0xd324('0x10'),auth[_0xd324('0xa')](),controller[_0xd324('0x1a')]);router[_0xd324('0x18')](_0xd324('0x12'),auth[_0xd324('0xa')](),controller['removeResources']);module['exports']=router; \ No newline at end of file +var _0x68dd=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index','get','/describe','describe','show','/:id/sections','getResources','create','post','addSections','/:id/resources','addResources','put','/:id','destroy','delete','removeResources','exports','multer','util'];(function(_0x2ef1a5,_0x316aac){var _0x268769=function(_0x28d1c5){while(--_0x28d1c5){_0x2ef1a5['push'](_0x2ef1a5['shift']());}};_0x268769(++_0x316aac);}(_0x68dd,0x85));var _0xd68d=function(_0x2706da,_0x3856f5){_0x2706da=_0x2706da-0x0;var _0x3ba87e=_0x68dd[_0x2706da];return _0x3ba87e;};'use strict';var multer=require(_0xd68d('0x0'));var util=require(_0xd68d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd68d('0x2'));var router=express[_0xd68d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd68d('0x4'));var interaction=require(_0xd68d('0x5'));var config=require(_0xd68d('0x6'));var controller=require(_0xd68d('0x7'));router['get']('/',auth[_0xd68d('0x8')](),controller[_0xd68d('0x9')]);router[_0xd68d('0xa')](_0xd68d('0xb'),auth[_0xd68d('0x8')](),controller[_0xd68d('0xc')]);router['get']('/:id',auth[_0xd68d('0x8')](),controller[_0xd68d('0xd')]);router['get'](_0xd68d('0xe'),auth[_0xd68d('0x8')](),controller['getSections']);router[_0xd68d('0xa')]('/:id/resources',auth[_0xd68d('0x8')](),controller[_0xd68d('0xf')]);router['post']('/',auth[_0xd68d('0x8')](),controller[_0xd68d('0x10')]);router[_0xd68d('0x11')]('/:id/clone',auth[_0xd68d('0x8')](),controller['clone']);router[_0xd68d('0x11')](_0xd68d('0xe'),auth[_0xd68d('0x8')](),controller[_0xd68d('0x12')]);router[_0xd68d('0x11')](_0xd68d('0x13'),auth[_0xd68d('0x8')](),controller[_0xd68d('0x14')]);router[_0xd68d('0x15')](_0xd68d('0x16'),auth[_0xd68d('0x8')](),controller['update']);router['delete']('/:id',auth[_0xd68d('0x8')](),controller[_0xd68d('0x17')]);router[_0xd68d('0x18')]('/:id/sections',auth[_0xd68d('0x8')](),controller['removeSections']);router[_0xd68d('0x18')](_0xd68d('0x13'),auth[_0xd68d('0x8')](),controller[_0xd68d('0x19')]);module[_0xd68d('0x1a')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 61376e9..52f40a5 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 _0x11d9=['crudPermissions','join','getDataValue','split','BOOLEAN','name','STRING','setDataValue'];(function(_0x739b4b,_0x638749){var _0x119cee=function(_0x28b43d){while(--_0x28b43d){_0x739b4b['push'](_0x739b4b['shift']());}};_0x119cee(++_0x638749);}(_0x11d9,0x1b5));var _0x911d=function(_0x25baf2,_0x21788c){_0x25baf2=_0x25baf2-0x0;var _0x2c8280=_0x11d9[_0x25baf2];return _0x2c8280;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x911d('0x0')},'crudPermissions':{'type':Sequelize[_0x911d('0x1')],'set':function(_0x2ab615){this[_0x911d('0x2')](_0x911d('0x3'),_0x2ab615?_0x2ab615[_0x911d('0x4')](''):[]);},'get':function(){return this[_0x911d('0x5')](_0x911d('0x3'))?this[_0x911d('0x5')]('crudPermissions')[_0x911d('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x911d('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x911d('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x911d('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x911d('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x911d('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x911d('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x911d('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x80cf=['crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','name','STRING','setDataValue'];(function(_0x29af0e,_0x35f669){var _0x349e39=function(_0x251fba){while(--_0x251fba){_0x29af0e['push'](_0x29af0e['shift']());}};_0x349e39(++_0x35f669);}(_0x80cf,0x1d0));var _0xf80c=function(_0x6ead94,_0x17a36b){_0x6ead94=_0x6ead94-0x0;var _0x5584f7=_0x80cf[_0x6ead94];return _0x5584f7;};'use strict';var Sequelize=require(_0xf80c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf80c('0x1')},'crudPermissions':{'type':Sequelize[_0xf80c('0x2')],'set':function(_0x5d0cab){this[_0xf80c('0x3')](_0xf80c('0x4'),_0x5d0cab?_0x5d0cab[_0xf80c('0x5')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0xf80c('0x6')](_0xf80c('0x4'))[_0xf80c('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xf80c('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xf80c('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xf80c('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xf80c('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xf80c('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 50ba258..63e9c40 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 _0xdaa8=['forEach','resourceId','Plugin','addResources','userProfileId','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','status','end','json','offset','undefined','limit','set','reject','save','update','destroy','then','error','stack','name','send','index','map','UserProfile','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','order','where','pick','VIRTUAL','count','includeAll','include','findAll','rows','show','params','length','merge','find','catch','create','body','clone','options','get','updatedAt','crudPermissions','omit','createdAt','sequelize','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','Resources','describe','addSections','push','ids','getSections','filter','isEmpty','subsections','enabled','includes','Dashboard'];(function(_0x148d34,_0x4c14a7){var _0x9266b4=function(_0x4085d5){while(--_0x4085d5){_0x148d34['push'](_0x148d34['shift']());}};_0x9266b4(++_0x4c14a7);}(_0xdaa8,0xe4));var _0x8daa=function(_0x2c04a0,_0x3e2d5e){_0x2c04a0=_0x2c04a0-0x0;var _0x546a55=_0xdaa8[_0x2c04a0];return _0x546a55;};'use strict';var emlformat=require(_0x8daa('0x0'));var rimraf=require(_0x8daa('0x1'));var zipdir=require(_0x8daa('0x2'));var jsonpatch=require(_0x8daa('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8daa('0x4'));var csv=require(_0x8daa('0x5'));var ejs=require(_0x8daa('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8daa('0x7'));var crypto=require('crypto');var jsforce=require(_0x8daa('0x8'));var deskjs=require(_0x8daa('0x9'));var toCsv=require(_0x8daa('0x5'));var querystring=require(_0x8daa('0xa'));var Papa=require(_0x8daa('0xb'));var Redis=require('ioredis');var authService=require(_0x8daa('0xc'));var qs=require(_0x8daa('0xd'));var as=require(_0x8daa('0xe'));var hardwareService=require(_0x8daa('0xf'));var logger=require(_0x8daa('0x10'))(_0x8daa('0x11'));var utils=require(_0x8daa('0x12'));var config=require(_0x8daa('0x13'));var licenseUtil=require(_0x8daa('0x14'));var db=require(_0x8daa('0x15'))['db'];config[_0x8daa('0x16')]=_['defaults'](config[_0x8daa('0x16')],{'host':_0x8daa('0x17'),'port':0x18eb});var socket=require(_0x8daa('0x18'))(new Redis(config['redis']));require(_0x8daa('0x19'))['register'](socket);function respondWithStatusCode(_0x28900d,_0x336132){_0x336132=_0x336132||0xcc;return function(_0x37ab36){if(_0x37ab36){return _0x28900d['sendStatus'](_0x336132);}return _0x28900d[_0x8daa('0x1a')](_0x336132)[_0x8daa('0x1b')]();};}function respondWithResult(_0x55bf66,_0x4bfdfb){_0x4bfdfb=_0x4bfdfb||0xc8;return function(_0x442d09){if(_0x442d09){return _0x55bf66[_0x8daa('0x1a')](_0x4bfdfb)[_0x8daa('0x1c')](_0x442d09);}};}function respondWithFilteredResult(_0x2fd793,_0x151dc1){return function(_0x1bca53){if(_0x1bca53){var _0x87f873=typeof _0x151dc1[_0x8daa('0x1d')]===_0x8daa('0x1e')&&typeof _0x151dc1[_0x8daa('0x1f')]==='undefined';var _0x490d91=_0x1bca53['count'];var _0x3cf4d5=_0x87f873?0x0:_0x151dc1[_0x8daa('0x1d')];var _0x1de203=_0x87f873?_0x1bca53['count']:_0x151dc1[_0x8daa('0x1d')]+_0x151dc1['limit'];var _0x33994a;if(_0x1de203>=_0x490d91){_0x1de203=_0x490d91;_0x33994a=0xc8;}else{_0x33994a=0xce;}_0x2fd793[_0x8daa('0x1a')](_0x33994a);return _0x2fd793[_0x8daa('0x20')]('Content-Range',_0x3cf4d5+'-'+_0x1de203+'/'+_0x490d91)[_0x8daa('0x1c')](_0x1bca53);}return null;};}function patchUpdates(_0x4db25d){return function(_0x92b96){try{jsonpatch['apply'](_0x92b96,_0x4db25d,!![]);}catch(_0x580214){return BPromise[_0x8daa('0x21')](_0x580214);}return _0x92b96[_0x8daa('0x22')]();};}function saveUpdates(_0x221d96,_0x58af34){return function(_0x6fe15){if(_0x6fe15){return _0x6fe15[_0x8daa('0x23')](_0x221d96)['then'](function(_0x35dbc1){return _0x35dbc1;});}return null;};}function removeEntity(_0x413c09,_0xe82111){return function(_0x3a7223){if(_0x3a7223){return _0x3a7223[_0x8daa('0x24')]()[_0x8daa('0x25')](function(){_0x413c09[_0x8daa('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41862b,_0x5f1609){return function(_0x41e96a){if(!_0x41e96a){_0x41862b['sendStatus'](0x194);}return _0x41e96a;};}function handleError(_0xb78435,_0x54cfc1){_0x54cfc1=_0x54cfc1||0x1f4;return function(_0x446304){logger[_0x8daa('0x26')](_0x446304[_0x8daa('0x27')]);if(_0x446304[_0x8daa('0x28')]){delete _0x446304['name'];}_0xb78435[_0x8daa('0x1a')](_0x54cfc1)[_0x8daa('0x29')](_0x446304);};}exports[_0x8daa('0x2a')]=function(_0xb469db,_0x5a995b){var _0x5da841={},_0x503e67={},_0x233f10={'count':0x0,'rows':[]};var _0x519289=_[_0x8daa('0x2b')](db[_0x8daa('0x2c')][_0x8daa('0x2d')],function(_0x4016da){return{'name':_0x4016da['fieldName'],'type':_0x4016da[_0x8daa('0x2e')]['key']};});_0x503e67['model']=_[_0x8daa('0x2b')](_0x519289,_0x8daa('0x28'));_0x503e67[_0x8daa('0x2f')]=_[_0x8daa('0x30')](_0xb469db[_0x8daa('0x2f')]);_0x503e67[_0x8daa('0x31')]=_[_0x8daa('0x32')](_0x503e67[_0x8daa('0x33')],_0x503e67['query']);_0x5da841[_0x8daa('0x34')]=_[_0x8daa('0x32')](_0x503e67['model'],qs[_0x8daa('0x35')](_0xb469db[_0x8daa('0x2f')][_0x8daa('0x35')]));_0x5da841[_0x8daa('0x34')]=_0x5da841[_0x8daa('0x34')]['length']?_0x5da841[_0x8daa('0x34')]:_0x503e67[_0x8daa('0x33')];if(!_0xb469db['query']['hasOwnProperty']('nolimit')){_0x5da841[_0x8daa('0x1f')]=qs[_0x8daa('0x1f')](_0xb469db[_0x8daa('0x2f')][_0x8daa('0x1f')]);_0x5da841[_0x8daa('0x1d')]=qs[_0x8daa('0x1d')](_0xb469db['query']['offset']);}_0x5da841[_0x8daa('0x36')]=qs['sort'](_0xb469db[_0x8daa('0x2f')]['sort']);_0x5da841[_0x8daa('0x37')]=qs[_0x8daa('0x31')](_[_0x8daa('0x38')](_0xb469db['query'],_0x503e67[_0x8daa('0x31')]),_0x519289);if(_0xb469db[_0x8daa('0x2f')]['filter']){_0x5da841[_0x8daa('0x37')]=_['merge'](_0x5da841['where'],{'$or':_[_0x8daa('0x2b')](_0x519289,function(_0x5cc76f){if(_0x5cc76f[_0x8daa('0x2e')]!==_0x8daa('0x39')){var _0x1f8db2={};_0x1f8db2[_0x5cc76f[_0x8daa('0x28')]]={'$like':'%'+_0xb469db['query']['filter']+'%'};return _0x1f8db2;}})});}_0x5da841=_['merge']({},_0x5da841,_0xb469db['options']);var _0x5ae4a5={'where':_0x5da841[_0x8daa('0x37')]};return db['UserProfile'][_0x8daa('0x3a')](_0x5ae4a5)[_0x8daa('0x25')](function(_0x124206){_0x233f10['count']=_0x124206;if(_0xb469db['query'][_0x8daa('0x3b')]){_0x5da841[_0x8daa('0x3c')]=[{'all':!![]}];}return db[_0x8daa('0x2c')][_0x8daa('0x3d')](_0x5da841);})[_0x8daa('0x25')](function(_0x4a9adc){_0x233f10[_0x8daa('0x3e')]=_0x4a9adc;return _0x233f10;})[_0x8daa('0x25')](respondWithFilteredResult(_0x5a995b,_0x5da841))['catch'](handleError(_0x5a995b,null));};exports[_0x8daa('0x3f')]=function(_0x23d94d,_0xf1ad1d){var _0x521f77={'raw':![],'where':{'id':_0x23d94d[_0x8daa('0x40')]['id']}},_0x1f0db9={};_0x1f0db9['model']=_['keys'](db[_0x8daa('0x2c')]['rawAttributes']);_0x1f0db9['query']=_[_0x8daa('0x30')](_0x23d94d[_0x8daa('0x2f')]);_0x1f0db9[_0x8daa('0x31')]=_['intersection'](_0x1f0db9['model'],_0x1f0db9[_0x8daa('0x2f')]);_0x521f77[_0x8daa('0x34')]=_[_0x8daa('0x32')](_0x1f0db9[_0x8daa('0x33')],qs['fields'](_0x23d94d[_0x8daa('0x2f')][_0x8daa('0x35')]));_0x521f77[_0x8daa('0x34')]=_0x521f77['attributes'][_0x8daa('0x41')]?_0x521f77[_0x8daa('0x34')]:_0x1f0db9[_0x8daa('0x33')];if(_0x23d94d[_0x8daa('0x2f')][_0x8daa('0x3b')]){_0x521f77[_0x8daa('0x3c')]=[{'all':!![]}];}_0x521f77=_[_0x8daa('0x42')]({},_0x521f77,_0x23d94d['options']);return db['UserProfile'][_0x8daa('0x43')](_0x521f77)['then'](handleEntityNotFound(_0xf1ad1d,null))[_0x8daa('0x25')](respondWithResult(_0xf1ad1d,null))[_0x8daa('0x44')](handleError(_0xf1ad1d,null));};exports['create']=function(_0x16544b,_0x2669d5){return db[_0x8daa('0x2c')][_0x8daa('0x45')](_0x16544b[_0x8daa('0x46')],{})['then'](respondWithResult(_0x2669d5,0xc9))[_0x8daa('0x44')](handleError(_0x2669d5,null));};exports[_0x8daa('0x47')]=function(_0x5b3ad5,_0x5d4066){var _0x218162={'where':{'id':_0x5b3ad5['params']['id']}},_0x2791da={};_0x2791da[_0x8daa('0x33')]=_[_0x8daa('0x30')](db[_0x8daa('0x2c')][_0x8daa('0x2d')]);_0x218162['attributes']=_[_0x8daa('0x32')](_0x2791da[_0x8daa('0x33')],qs['fields'](_0x5b3ad5[_0x8daa('0x2f')]['fields']));_0x218162[_0x8daa('0x34')]=_0x218162[_0x8daa('0x34')]['length']?_0x218162['attributes']:_0x2791da[_0x8daa('0x33')];if(_0x5b3ad5[_0x8daa('0x2f')][_0x8daa('0x3b')]){_0x218162[_0x8daa('0x3c')]=[{'all':!![]}];}_0x218162=_[_0x8daa('0x42')]({},_0x218162,_0x5b3ad5[_0x8daa('0x48')]);return db[_0x8daa('0x2c')][_0x8daa('0x43')](_0x218162)[_0x8daa('0x25')](handleEntityNotFound(_0x5d4066,null))[_0x8daa('0x25')](function(_0x4f5890){if(_0x4f5890){var _0x135059=_0x4f5890[_0x8daa('0x49')]({'plain':!![]});_0x135059=qs['omit'](_0x135059,['id','createdAt',_0x8daa('0x4a'),_0x8daa('0x4b')]);_0x5b3ad5[_0x8daa('0x46')]=_[_0x8daa('0x4c')](_0x5b3ad5['body'],['id',_0x8daa('0x4d'),'updatedAt']);return db[_0x8daa('0x4e')]['transaction'](function(_0x4765ff){return db['UserProfile'][_0x8daa('0x45')](_[_0x8daa('0x42')](_0x135059,_0x5b3ad5[_0x8daa('0x46')]),{'include':_0x5b3ad5[_0x8daa('0x2f')][_0x8daa('0x3b')]?[{'all':!![]}]:undefined,'transaction':_0x4765ff})[_0x8daa('0x25')](function(_0xd7b5fb){var _0x711de1=_0xd7b5fb[_0x8daa('0x49')]({'plain':!![]});return db[_0x8daa('0x4f')][_0x8daa('0x3d')]({'where':{'userProfileId':_0x5b3ad5['params']['id']},'raw':!![]})[_0x8daa('0x25')](function(_0x14ccd5){if(_0x14ccd5){return BPromise[_0x8daa('0x50')](_0x14ccd5,function(_0x224339){return new BPromise(function(_0x22d2bd,_0x3ab378){if(_0x224339['autoAssociation']===null||_0x224339[_0x8daa('0x51')]===0x1)_0x22d2bd(null);return db[_0x8daa('0x52')]['findAll']({'where':{'sectionId':_0x224339['id']},'raw':!![]})[_0x8daa('0x25')](function(_0xd91600){var _0x31cca0=_[_0x8daa('0x2b')](_0xd91600,function(_0x4ab975){return qs[_0x8daa('0x4c')](_0x4ab975,['id',_0x8daa('0x4d'),'updatedAt',_0x8daa('0x53')]);});_0x22d2bd(_0x31cca0);})[_0x8daa('0x44')](function(_0xc8aaf0){_0x3ab378(_0xc8aaf0);});})[_0x8daa('0x25')](function(_0x1c46d8){var _0x4abf50=qs[_0x8daa('0x4c')](_0x224339,['id',_0x8daa('0x4d'),_0x8daa('0x4a')]);_0x4abf50['userProfileId']=_0x711de1['id'];if(_0x1c46d8)_0x4abf50[_0x8daa('0x54')]=_0x1c46d8;return _0x4abf50;})['then'](function(_0x63bc08){return db['UserProfileSection'][_0x8daa('0x45')](_0x63bc08,{'include':[{'model':db[_0x8daa('0x52')],'as':_0x8daa('0x54')}],'raw':!![],'transaction':_0x4765ff});});})[_0x8daa('0x25')](function(){return _0x711de1;});}});});});}})[_0x8daa('0x25')](respondWithResult(_0x5d4066,0xc9))[_0x8daa('0x44')](handleError(_0x5d4066,null));};exports['update']=function(_0x39dc81,_0x27449c){if(_0x39dc81[_0x8daa('0x46')]['id']){delete _0x39dc81['body']['id'];}return db[_0x8daa('0x2c')][_0x8daa('0x43')]({'where':{'id':_0x39dc81[_0x8daa('0x40')]['id']}})[_0x8daa('0x25')](handleEntityNotFound(_0x27449c,null))[_0x8daa('0x25')](saveUpdates(_0x39dc81['body'],null))[_0x8daa('0x25')](respondWithResult(_0x27449c,null))[_0x8daa('0x44')](handleError(_0x27449c,null));};exports[_0x8daa('0x24')]=function(_0x35db66,_0x214f29){return db[_0x8daa('0x2c')]['find']({'where':{'id':_0x35db66[_0x8daa('0x40')]['id']}})['then'](handleEntityNotFound(_0x214f29,null))[_0x8daa('0x25')](removeEntity(_0x214f29,null))['catch'](handleError(_0x214f29,null));};exports[_0x8daa('0x55')]=function(_0x6c28fd,_0x46fdcb){return db['UserProfile']['describe']()[_0x8daa('0x25')](respondWithResult(_0x46fdcb,null))['catch'](handleError(_0x46fdcb,null));};exports[_0x8daa('0x56')]=function(_0x3ff558,_0xd35665){var _0x38debc=_0x3ff558[_0x8daa('0x46')];return db[_0x8daa('0x2c')][_0x8daa('0x43')]({'where':{'id':_0x3ff558[_0x8daa('0x40')]['id']}})[_0x8daa('0x25')](handleEntityNotFound(_0xd35665,null))['then'](function(_0x5f4c3f){if(_0x5f4c3f){return db[_0x8daa('0x4e')]['transaction'](function(_0x4e4742){return db['UserProfileSection'][_0x8daa('0x24')]({'where':{'userProfileId':_0x3ff558[_0x8daa('0x40')]['id'],'sectionId':_[_0x8daa('0x2b')](_0x38debc,function(_0x5d9af1){return _0x5d9af1['sectionId'];})},'transaction':_0x4e4742})[_0x8daa('0x25')](function(){var _0x5daf65=_['map'](_0x38debc,function(_0x1fcc01){_0x1fcc01['userProfileId']=_0x3ff558[_0x8daa('0x40')]['id'];return _0x1fcc01;});var _0x20aed7=[];return BPromise[_0x8daa('0x50')](_0x5daf65,function(_0x256d9b){return db[_0x8daa('0x4f')][_0x8daa('0x45')](_0x256d9b,{'include':[{'model':db[_0x8daa('0x52')],'as':_0x8daa('0x54')}],'raw':!![],'transaction':_0x4e4742})[_0x8daa('0x25')](function(_0x267b78){_0x20aed7[_0x8daa('0x57')](_0x267b78['get']({'plain':!![]}));});})[_0x8daa('0x25')](function(){return _0x20aed7;});});});}})[_0x8daa('0x25')](function(_0x53cb13){return _0x53cb13;})[_0x8daa('0x25')](respondWithResult(_0xd35665,null))['catch'](handleError(_0xd35665,null));};exports['removeSections']=function(_0x173daf,_0x183a6b){var _0x1de5e5;return db[_0x8daa('0x2c')][_0x8daa('0x43')]({'where':{'id':_0x173daf['params']['id']},'attributes':['id',_0x8daa('0x28')]})[_0x8daa('0x25')](handleEntityNotFound(_0x183a6b,null))[_0x8daa('0x25')](function(_0x182e2c){if(_0x182e2c){_0x1de5e5=_0x182e2c;return db[_0x8daa('0x4f')][_0x8daa('0x24')]({'where':{'userProfileId':_0x173daf[_0x8daa('0x40')]['id'],'sectionId':_0x173daf[_0x8daa('0x2f')][_0x8daa('0x58')]}});}})[_0x8daa('0x25')](function(){return _0x1de5e5;})[_0x8daa('0x25')](respondWithStatusCode(_0x183a6b,null))['catch'](handleError(_0x183a6b,null));};exports[_0x8daa('0x59')]=function(_0x1414b4,_0x5b25bc){var _0x997551=[];var _0x1f404b=[];return db[_0x8daa('0x4f')][_0x8daa('0x3d')]({'where':{'userProfileId':_0x1414b4[_0x8daa('0x40')]['id']},'raw':!![]})[_0x8daa('0x25')](function(_0x2e5c0b){_0x997551=_[_0x8daa('0x5a')](_0x2e5c0b,function(_0x32b793){return _0x32b793['enabled']===0x1||_['includes']([0x3eb,0x709],_0x32b793['sectionId']);});if(!_[_0x8daa('0x5b')](_0x997551)){return _[_0x8daa('0x2b')](_0x997551,function(_0x5b140a){return _0x5b140a['sectionId'];});}else{return;}})[_0x8daa('0x25')](function(_0x4df32f){if(_0x4df32f)_0x1f404b=_0x4df32f;if(_['includes'](_0x1f404b,0x64)){var _0x1b89b3=_[_0x8daa('0x43')](_0x997551,{'sectionId':0x64});return hasDefaultDashboard(_0x1b89b3)['then'](function(_0x2a8a7b){return _['map'](_0x997551,function(_0x4b7d86){if(_0x4b7d86[_0x8daa('0x53')]===0x64){_0x4b7d86[_0x8daa('0x5c')]=_0x2a8a7b;}return _0x4b7d86;});});}else{return;}})[_0x8daa('0x25')](function(_0x9efc14){if(_0x9efc14)_0x997551=_0x9efc14;if(_['includes'](_0x1f404b,0x3eb)){var _0xa6c4c0=_[_0x8daa('0x43')](_0x997551,{'sectionId':0x3eb});return getCustomDashboards(_0xa6c4c0)['then'](function(_0x4bf167){return _['map'](_0x997551,function(_0xba8174){if(_0xa6c4c0[_0x8daa('0x5d')]){if(_0xba8174[_0x8daa('0x53')]===0x3eb){_0xba8174[_0x8daa('0x5c')]=_0x4bf167;}}else{if(_0xba8174[_0x8daa('0x53')]===0x64){_0xba8174[_0x8daa('0x5c')]=_0x4bf167;}}return _0xba8174;});});}else{return;}})[_0x8daa('0x25')](function(_0x2c64bd){if(_0x2c64bd)_0x997551=_0x2c64bd;if(_[_0x8daa('0x5e')](_0x1f404b,0x709)){var _0x5c49d6=_[_0x8daa('0x43')](_0x997551,{'sectionId':0x709});return getPlugins(_0x5c49d6)[_0x8daa('0x25')](function(_0x56b2c0){if(_0x5c49d6[_0x8daa('0x5d')]){return _[_0x8daa('0x2b')](_0x997551,function(_0x4c0300){if(_0x4c0300['sectionId']===0x709){_0x4c0300[_0x8daa('0x5c')]=_0x56b2c0;}return _0x4c0300;});}else{var _0x595294={'sectionId':0x76c,'enabled':0x1,'subsections':_0x56b2c0};var _0x2ed42c=_[_0x8daa('0x2b')](_0x997551);_0x2ed42c[_0x8daa('0x57')](_0x595294);return _0x2ed42c;}});}else{return;}})[_0x8daa('0x25')](function(_0x50877f){if(_0x50877f)_0x997551=_0x50877f;return _[_0x8daa('0x5a')](_0x997551,[_0x8daa('0x5d'),0x1]);})['then'](respondWithResult(_0x5b25bc,null))['catch'](handleError(_0x5b25bc,null));};function hasDefaultDashboard(_0x57c5de){var _0x5a9cbf=[0x65];return new BPromise(function(_0x401394,_0x402636){try{if(_0x57c5de[_0x8daa('0x51')]){_0x401394(_0x5a9cbf);}else{return db[_0x8daa('0x52')]['findOne']({'where':{'sectionId':_0x57c5de['id']},'raw':!![]})['then'](function(_0xffc19b){_0xffc19b?_0x401394(_0x5a9cbf):_0x401394();});}}catch(_0x2526b6){_0x402636(_0x2526b6);}});}function getCustomDashboards(_0x4a323b){var _0x4cc89d=[];return new BPromise(function(_0x365993,_0x3b2e6d){try{if(_0x4a323b[_0x8daa('0x51')]){return db[_0x8daa('0x5f')][_0x8daa('0x3d')]({'raw':!![]})[_0x8daa('0x25')](function(_0x128736){_0x128736[_0x8daa('0x60')](function(_0x1172f3){_0x4cc89d[_0x8daa('0x57')](_0x1172f3['id']+0x1869f);});_0x365993(_0x4cc89d);});}else{return db[_0x8daa('0x52')][_0x8daa('0x3d')]({'where':{'sectionId':_0x4a323b['id']},'raw':!![]})[_0x8daa('0x25')](function(_0x1ca467){_0x1ca467[_0x8daa('0x60')](function(_0x35c2a1){_0x4cc89d[_0x8daa('0x57')](_0x35c2a1[_0x8daa('0x61')]+0x1869f);});_0x365993(_0x4cc89d);});}}catch(_0x258d43){_0x3b2e6d(_0x258d43);}});}function getPlugins(_0x3d7f06){var _0x305a23=[];return new BPromise(function(_0x425927,_0x3ba4c4){try{if(_0x3d7f06[_0x8daa('0x51')]){return db[_0x8daa('0x62')][_0x8daa('0x3d')]({'raw':!![]})['then'](function(_0x39cf59){_0x39cf59[_0x8daa('0x60')](function(_0xa94cd){_0x305a23[_0x8daa('0x57')](_0xa94cd['id']+0x15b38);});_0x425927(_0x305a23);});}else{return db['UserProfileResource'][_0x8daa('0x3d')]({'where':{'sectionId':_0x3d7f06['id']},'raw':!![]})[_0x8daa('0x25')](function(_0x49db0b){_0x49db0b[_0x8daa('0x60')](function(_0x49e6ea){_0x305a23[_0x8daa('0x57')](_0x49e6ea[_0x8daa('0x61')]+0x15b38);});_0x425927(_0x305a23);});}}catch(_0x1af420){_0x3ba4c4(_0x1af420);}});}exports[_0x8daa('0x63')]=function(_0x845b6,_0x1e2d35){return db[_0x8daa('0x2c')]['find']({'where':{'id':_0x845b6['params']['id']}})[_0x8daa('0x25')](handleEntityNotFound(_0x1e2d35,null))['then'](function(_0x4a0f59){if(_0x4a0f59){return db['sequelize']['transaction'](function(_0xb5c5){return db[_0x8daa('0x4f')][_0x8daa('0x3d')]({'where':{'userProfileId':_0x845b6[_0x8daa('0x40')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x555935){if(_0x555935){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x845b6['params']['id'],'id':_['map'](_0x555935,function(_0x43df03){return _0x43df03['id'];})},'transaction':_0xb5c5});}})[_0x8daa('0x25')](function(_0x53695d){var _0x44a855=_[_0x8daa('0x2b')](_0x845b6[_0x8daa('0x46')],function(_0x4ee6e2){_0x4ee6e2[_0x8daa('0x64')]=_0x845b6[_0x8daa('0x40')]['id'];return _0x4ee6e2;});return db[_0x8daa('0x4f')][_0x8daa('0x65')](_0x44a855,{'raw':!![],'transaction':_0xb5c5});})[_0x8daa('0x25')](function(_0xcb8f66){var _0x269be3=_[_0x8daa('0x5a')](_['map'](_0xcb8f66,function(_0x4a5e05){return _0x4a5e05[_0x8daa('0x49')]({'plain':!![]});}),{'includeAll':![]});if(_0x269be3){return db[_0x8daa('0x4f')][_0x8daa('0x3d')]({'where':{'userProfileId':_0x845b6[_0x8daa('0x40')]['id'],'sectionId':_['map'](_0x269be3,function(_0x2cc324){return _0x2cc324['sectionId'];})},'attributes':['id',_0x8daa('0x53')],'raw':!![]})[_0x8daa('0x25')](function(_0x2aae20){var _0x1e5f48=_['map'](_0x845b6[_0x8daa('0x46')],function(_0x220ed5){_0x220ed5[_0x8daa('0x64')]=_0x845b6[_0x8daa('0x40')]['id'];return _0x220ed5;});return db['UserProfileResource'][_0x8daa('0x65')](_0x1e5f48,{'raw':!![],'transaction':_0xb5c5});});}})[_0x8daa('0x44')](handleError(_0x1e2d35,null));});}})['then'](function(_0x16f860){var _0x530bf7=_['map'](_0x16f860,function(_0x2bdd03){return _0x2bdd03[_0x8daa('0x49')]({'plain':!![]});});})[_0x8daa('0x25')](respondWithResult(_0x1e2d35,null))['catch'](handleError(_0x1e2d35,null));};exports[_0x8daa('0x66')]=function(_0x1b492f,_0x5b23f3,_0x21bf38){return db[_0x8daa('0x2c')][_0x8daa('0x43')]({'where':{'id':_0x1b492f[_0x8daa('0x40')]['id']}})[_0x8daa('0x25')](handleEntityNotFound(_0x5b23f3,null))[_0x8daa('0x25')](function(_0x2f452f){if(_0x2f452f){return _0x2f452f[_0x8daa('0x66')](_0x1b492f[_0x8daa('0x2f')][_0x8daa('0x58')]);}})[_0x8daa('0x25')](respondWithStatusCode(_0x5b23f3,null))[_0x8daa('0x44')](handleError(_0x5b23f3,null));};exports[_0x8daa('0x67')]=function(_0x4f7c9d,_0x211774){var _0x5e064e={};if(!_0x4f7c9d[_0x8daa('0x2f')][_0x8daa('0x68')])throw new Error(_0x8daa('0x69'));if(!_0x4f7c9d[_0x8daa('0x2f')][_0x8daa('0x6a')]('nolimit')){_0x5e064e[_0x8daa('0x1f')]=qs[_0x8daa('0x1f')](_0x4f7c9d[_0x8daa('0x2f')]['limit']);_0x5e064e[_0x8daa('0x1d')]=qs[_0x8daa('0x1d')](_0x4f7c9d[_0x8daa('0x2f')]['offset']);}return db[_0x8daa('0x2c')][_0x8daa('0x43')]({'where':{'id':_0x4f7c9d[_0x8daa('0x40')]['id']}})['then'](function(_0x549881){if(!_0x549881)throw new Error(_0x8daa('0x6b')+_0x4f7c9d[_0x8daa('0x40')]['id']);return db['UserProfile'][_0x8daa('0x67')](_0x4f7c9d);})['then'](respondWithFilteredResult(_0x211774,_0x5e064e))[_0x8daa('0x44')](handleError(_0x211774,null));}; \ No newline at end of file +var _0x0c71=['params','find','create','body','clone','options','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','Resources','addSections','userProfileId','push','ids','getSections','enabled','includes','subsections','findOne','forEach','resourceId','addResources','bulkCreate','removeResources','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userProfile.socket','register','status','end','json','offset','undefined','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','filter','where','merge','map','VIRTUAL','count','includeAll','include','findAll','rows','catch'];(function(_0x3d385d,_0x3fc556){var _0x2954e0=function(_0x19c1e3){while(--_0x19c1e3){_0x3d385d['push'](_0x3d385d['shift']());}};_0x2954e0(++_0x3fc556);}(_0x0c71,0xfb));var _0x10c7=function(_0x42c3ea,_0x54da9e){_0x42c3ea=_0x42c3ea-0x0;var _0x2dad54=_0x0c71[_0x42c3ea];return _0x2dad54;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x10c7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x10c7('0x1'));var rp=require(_0x10c7('0x2'));var moment=require(_0x10c7('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x10c7('0x4'));var path=require('path');var sox=require(_0x10c7('0x5'));var csv=require(_0x10c7('0x6'));var ejs=require(_0x10c7('0x7'));var fs=require('fs');var fs_extra=require(_0x10c7('0x8'));var _=require(_0x10c7('0x9'));var squel=require(_0x10c7('0xa'));var crypto=require('crypto');var jsforce=require(_0x10c7('0xb'));var deskjs=require(_0x10c7('0xc'));var toCsv=require('to-csv');var querystring=require(_0x10c7('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x10c7('0xe'));var qs=require(_0x10c7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x10c7('0x10'));var logger=require(_0x10c7('0x11'))(_0x10c7('0x12'));var utils=require(_0x10c7('0x13'));var config=require(_0x10c7('0x14'));var licenseUtil=require(_0x10c7('0x15'));var db=require(_0x10c7('0x16'))['db'];config[_0x10c7('0x17')]=_[_0x10c7('0x18')](config[_0x10c7('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x10c7('0x19'))(new Redis(config[_0x10c7('0x17')]));require(_0x10c7('0x1a'))[_0x10c7('0x1b')](socket);function respondWithStatusCode(_0x45568c,_0x37bc65){_0x37bc65=_0x37bc65||0xcc;return function(_0x13d9ae){if(_0x13d9ae){return _0x45568c['sendStatus'](_0x37bc65);}return _0x45568c[_0x10c7('0x1c')](_0x37bc65)[_0x10c7('0x1d')]();};}function respondWithResult(_0x53aaae,_0x439fd6){_0x439fd6=_0x439fd6||0xc8;return function(_0x2e0a1c){if(_0x2e0a1c){return _0x53aaae[_0x10c7('0x1c')](_0x439fd6)[_0x10c7('0x1e')](_0x2e0a1c);}};}function respondWithFilteredResult(_0x2f4966,_0x18d247){return function(_0x3168e1){if(_0x3168e1){var _0x1bd968=typeof _0x18d247[_0x10c7('0x1f')]==='undefined'&&typeof _0x18d247['limit']===_0x10c7('0x20');var _0x28c0bd=_0x3168e1['count'];var _0x28e6fe=_0x1bd968?0x0:_0x18d247[_0x10c7('0x1f')];var _0xe1133a=_0x1bd968?_0x3168e1['count']:_0x18d247[_0x10c7('0x1f')]+_0x18d247['limit'];var _0x3bc5e0;if(_0xe1133a>=_0x28c0bd){_0xe1133a=_0x28c0bd;_0x3bc5e0=0xc8;}else{_0x3bc5e0=0xce;}_0x2f4966[_0x10c7('0x1c')](_0x3bc5e0);return _0x2f4966[_0x10c7('0x21')]('Content-Range',_0x28e6fe+'-'+_0xe1133a+'/'+_0x28c0bd)[_0x10c7('0x1e')](_0x3168e1);}return null;};}function patchUpdates(_0xc4dc9e){return function(_0x186d94){try{jsonpatch[_0x10c7('0x22')](_0x186d94,_0xc4dc9e,!![]);}catch(_0x1450f3){return BPromise[_0x10c7('0x23')](_0x1450f3);}return _0x186d94[_0x10c7('0x24')]();};}function saveUpdates(_0x308e3a,_0x33b697){return function(_0x3cd18a){if(_0x3cd18a){return _0x3cd18a[_0x10c7('0x25')](_0x308e3a)[_0x10c7('0x26')](function(_0x3bc016){return _0x3bc016;});}return null;};}function removeEntity(_0xe53724,_0x3c40c3){return function(_0x3c9665){if(_0x3c9665){return _0x3c9665[_0x10c7('0x27')]()[_0x10c7('0x26')](function(){_0xe53724[_0x10c7('0x1c')](0xcc)[_0x10c7('0x1d')]();});}};}function handleEntityNotFound(_0x5626cd,_0x4c89c7){return function(_0x4c331f){if(!_0x4c331f){_0x5626cd[_0x10c7('0x28')](0x194);}return _0x4c331f;};}function handleError(_0x460e28,_0x45aa1c){_0x45aa1c=_0x45aa1c||0x1f4;return function(_0x206e1d){logger[_0x10c7('0x29')](_0x206e1d[_0x10c7('0x2a')]);if(_0x206e1d['name']){delete _0x206e1d[_0x10c7('0x2b')];}_0x460e28['status'](_0x45aa1c)[_0x10c7('0x2c')](_0x206e1d);};}exports['index']=function(_0x3731a1,_0x14efa1){var _0x5da008={},_0x3ce65e={},_0x897e95={'count':0x0,'rows':[]};var _0x2d4782=_['map'](db[_0x10c7('0x2d')][_0x10c7('0x2e')],function(_0x9ac3c2){return{'name':_0x9ac3c2[_0x10c7('0x2f')],'type':_0x9ac3c2[_0x10c7('0x30')][_0x10c7('0x31')]};});_0x3ce65e[_0x10c7('0x32')]=_['map'](_0x2d4782,'name');_0x3ce65e[_0x10c7('0x33')]=_[_0x10c7('0x34')](_0x3731a1[_0x10c7('0x33')]);_0x3ce65e[_0x10c7('0x35')]=_[_0x10c7('0x36')](_0x3ce65e[_0x10c7('0x32')],_0x3ce65e[_0x10c7('0x33')]);_0x5da008[_0x10c7('0x37')]=_[_0x10c7('0x36')](_0x3ce65e[_0x10c7('0x32')],qs[_0x10c7('0x38')](_0x3731a1[_0x10c7('0x33')][_0x10c7('0x38')]));_0x5da008[_0x10c7('0x37')]=_0x5da008['attributes'][_0x10c7('0x39')]?_0x5da008[_0x10c7('0x37')]:_0x3ce65e[_0x10c7('0x32')];if(!_0x3731a1[_0x10c7('0x33')]['hasOwnProperty'](_0x10c7('0x3a'))){_0x5da008[_0x10c7('0x3b')]=qs[_0x10c7('0x3b')](_0x3731a1[_0x10c7('0x33')][_0x10c7('0x3b')]);_0x5da008[_0x10c7('0x1f')]=qs[_0x10c7('0x1f')](_0x3731a1[_0x10c7('0x33')][_0x10c7('0x1f')]);}_0x5da008[_0x10c7('0x3c')]=qs['sort'](_0x3731a1[_0x10c7('0x33')][_0x10c7('0x3d')]);_0x5da008['where']=qs[_0x10c7('0x35')](_['pick'](_0x3731a1[_0x10c7('0x33')],_0x3ce65e[_0x10c7('0x35')]),_0x2d4782);if(_0x3731a1[_0x10c7('0x33')][_0x10c7('0x3e')]){_0x5da008[_0x10c7('0x3f')]=_[_0x10c7('0x40')](_0x5da008[_0x10c7('0x3f')],{'$or':_[_0x10c7('0x41')](_0x2d4782,function(_0x2e121a){if(_0x2e121a[_0x10c7('0x30')]!==_0x10c7('0x42')){var _0x5b1d2d={};_0x5b1d2d[_0x2e121a[_0x10c7('0x2b')]]={'$like':'%'+_0x3731a1[_0x10c7('0x33')][_0x10c7('0x3e')]+'%'};return _0x5b1d2d;}})});}_0x5da008=_[_0x10c7('0x40')]({},_0x5da008,_0x3731a1['options']);var _0x4008f4={'where':_0x5da008['where']};return db['UserProfile'][_0x10c7('0x43')](_0x4008f4)['then'](function(_0xe022ce){_0x897e95[_0x10c7('0x43')]=_0xe022ce;if(_0x3731a1[_0x10c7('0x33')][_0x10c7('0x44')]){_0x5da008[_0x10c7('0x45')]=[{'all':!![]}];}return db[_0x10c7('0x2d')][_0x10c7('0x46')](_0x5da008);})[_0x10c7('0x26')](function(_0x5b73d2){_0x897e95[_0x10c7('0x47')]=_0x5b73d2;return _0x897e95;})[_0x10c7('0x26')](respondWithFilteredResult(_0x14efa1,_0x5da008))[_0x10c7('0x48')](handleError(_0x14efa1,null));};exports['show']=function(_0x406285,_0x702752){var _0x4dd5b4={'raw':![],'where':{'id':_0x406285[_0x10c7('0x49')]['id']}},_0x2d882d={};_0x2d882d[_0x10c7('0x32')]=_[_0x10c7('0x34')](db[_0x10c7('0x2d')][_0x10c7('0x2e')]);_0x2d882d['query']=_[_0x10c7('0x34')](_0x406285['query']);_0x2d882d['filters']=_['intersection'](_0x2d882d[_0x10c7('0x32')],_0x2d882d['query']);_0x4dd5b4['attributes']=_['intersection'](_0x2d882d[_0x10c7('0x32')],qs[_0x10c7('0x38')](_0x406285[_0x10c7('0x33')][_0x10c7('0x38')]));_0x4dd5b4[_0x10c7('0x37')]=_0x4dd5b4[_0x10c7('0x37')]['length']?_0x4dd5b4[_0x10c7('0x37')]:_0x2d882d[_0x10c7('0x32')];if(_0x406285['query'][_0x10c7('0x44')]){_0x4dd5b4[_0x10c7('0x45')]=[{'all':!![]}];}_0x4dd5b4=_[_0x10c7('0x40')]({},_0x4dd5b4,_0x406285['options']);return db[_0x10c7('0x2d')][_0x10c7('0x4a')](_0x4dd5b4)[_0x10c7('0x26')](handleEntityNotFound(_0x702752,null))[_0x10c7('0x26')](respondWithResult(_0x702752,null))[_0x10c7('0x48')](handleError(_0x702752,null));};exports[_0x10c7('0x4b')]=function(_0x2c204f,_0xeb2c86){return db[_0x10c7('0x2d')][_0x10c7('0x4b')](_0x2c204f[_0x10c7('0x4c')],{})['then'](respondWithResult(_0xeb2c86,0xc9))[_0x10c7('0x48')](handleError(_0xeb2c86,null));};exports[_0x10c7('0x4d')]=function(_0x5765c8,_0x289869){var _0x175a42={'where':{'id':_0x5765c8[_0x10c7('0x49')]['id']}},_0x353acd={};_0x353acd['model']=_[_0x10c7('0x34')](db[_0x10c7('0x2d')][_0x10c7('0x2e')]);_0x175a42[_0x10c7('0x37')]=_[_0x10c7('0x36')](_0x353acd['model'],qs['fields'](_0x5765c8[_0x10c7('0x33')]['fields']));_0x175a42[_0x10c7('0x37')]=_0x175a42[_0x10c7('0x37')][_0x10c7('0x39')]?_0x175a42[_0x10c7('0x37')]:_0x353acd[_0x10c7('0x32')];if(_0x5765c8[_0x10c7('0x33')][_0x10c7('0x44')]){_0x175a42[_0x10c7('0x45')]=[{'all':!![]}];}_0x175a42=_[_0x10c7('0x40')]({},_0x175a42,_0x5765c8[_0x10c7('0x4e')]);return db[_0x10c7('0x2d')]['find'](_0x175a42)[_0x10c7('0x26')](handleEntityNotFound(_0x289869,null))[_0x10c7('0x26')](function(_0x590cd2){if(_0x590cd2){var _0x298a4d=_0x590cd2[_0x10c7('0x4f')]({'plain':!![]});_0x298a4d=qs[_0x10c7('0x50')](_0x298a4d,['id',_0x10c7('0x51'),_0x10c7('0x52'),_0x10c7('0x53')]);_0x5765c8[_0x10c7('0x4c')]=_[_0x10c7('0x50')](_0x5765c8[_0x10c7('0x4c')],['id',_0x10c7('0x51'),_0x10c7('0x52')]);return db[_0x10c7('0x54')][_0x10c7('0x55')](function(_0x5a31ed){return db['UserProfile']['create'](_['merge'](_0x298a4d,_0x5765c8[_0x10c7('0x4c')]),{'include':_0x5765c8[_0x10c7('0x33')][_0x10c7('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x5a31ed})[_0x10c7('0x26')](function(_0x5e3342){var _0x177c9b=_0x5e3342[_0x10c7('0x4f')]({'plain':!![]});return db[_0x10c7('0x56')][_0x10c7('0x46')]({'where':{'userProfileId':_0x5765c8['params']['id']},'raw':!![]})[_0x10c7('0x26')](function(_0x4ce9c4){if(_0x4ce9c4){return BPromise[_0x10c7('0x57')](_0x4ce9c4,function(_0x2f92cf){return new BPromise(function(_0x1033d9,_0xaa9a09){if(_0x2f92cf[_0x10c7('0x58')]===null||_0x2f92cf['autoAssociation']===0x1)_0x1033d9(null);return db[_0x10c7('0x59')][_0x10c7('0x46')]({'where':{'sectionId':_0x2f92cf['id']},'raw':!![]})[_0x10c7('0x26')](function(_0x4b199d){var _0x791074=_[_0x10c7('0x41')](_0x4b199d,function(_0x45c1b4){return qs[_0x10c7('0x50')](_0x45c1b4,['id','createdAt',_0x10c7('0x52'),_0x10c7('0x5a')]);});_0x1033d9(_0x791074);})[_0x10c7('0x48')](function(_0x112112){_0xaa9a09(_0x112112);});})[_0x10c7('0x26')](function(_0x25356b){var _0x381429=qs[_0x10c7('0x50')](_0x2f92cf,['id',_0x10c7('0x51'),_0x10c7('0x52')]);_0x381429['userProfileId']=_0x177c9b['id'];if(_0x25356b)_0x381429[_0x10c7('0x5b')]=_0x25356b;return _0x381429;})[_0x10c7('0x26')](function(_0x22f8c7){return db[_0x10c7('0x56')]['create'](_0x22f8c7,{'include':[{'model':db[_0x10c7('0x59')],'as':_0x10c7('0x5b')}],'raw':!![],'transaction':_0x5a31ed});});})[_0x10c7('0x26')](function(){return _0x177c9b;});}});});});}})[_0x10c7('0x26')](respondWithResult(_0x289869,0xc9))[_0x10c7('0x48')](handleError(_0x289869,null));};exports[_0x10c7('0x25')]=function(_0x191464,_0x32b40d){if(_0x191464[_0x10c7('0x4c')]['id']){delete _0x191464[_0x10c7('0x4c')]['id'];}return db[_0x10c7('0x2d')][_0x10c7('0x4a')]({'where':{'id':_0x191464['params']['id']}})[_0x10c7('0x26')](handleEntityNotFound(_0x32b40d,null))[_0x10c7('0x26')](saveUpdates(_0x191464['body'],null))[_0x10c7('0x26')](respondWithResult(_0x32b40d,null))[_0x10c7('0x48')](handleError(_0x32b40d,null));};exports['destroy']=function(_0x657cc1,_0x23c386){return db['UserProfile'][_0x10c7('0x4a')]({'where':{'id':_0x657cc1['params']['id']}})[_0x10c7('0x26')](handleEntityNotFound(_0x23c386,null))[_0x10c7('0x26')](removeEntity(_0x23c386,null))[_0x10c7('0x48')](handleError(_0x23c386,null));};exports['describe']=function(_0x7be526,_0x34037a){return db['UserProfile']['describe']()['then'](respondWithResult(_0x34037a,null))[_0x10c7('0x48')](handleError(_0x34037a,null));};exports[_0x10c7('0x5c')]=function(_0x3ff971,_0x2b3a5e){var _0x43b022=_0x3ff971[_0x10c7('0x4c')];return db[_0x10c7('0x2d')][_0x10c7('0x4a')]({'where':{'id':_0x3ff971['params']['id']}})[_0x10c7('0x26')](handleEntityNotFound(_0x2b3a5e,null))[_0x10c7('0x26')](function(_0x37eb98){if(_0x37eb98){return db[_0x10c7('0x54')][_0x10c7('0x55')](function(_0x354f9a){return db[_0x10c7('0x56')][_0x10c7('0x27')]({'where':{'userProfileId':_0x3ff971['params']['id'],'sectionId':_[_0x10c7('0x41')](_0x43b022,function(_0x5a3a6e){return _0x5a3a6e[_0x10c7('0x5a')];})},'transaction':_0x354f9a})[_0x10c7('0x26')](function(){var _0xd3a275=_['map'](_0x43b022,function(_0xd5a3e1){_0xd5a3e1[_0x10c7('0x5d')]=_0x3ff971[_0x10c7('0x49')]['id'];return _0xd5a3e1;});var _0x2528ea=[];return BPromise['each'](_0xd3a275,function(_0x452eb1){return db[_0x10c7('0x56')][_0x10c7('0x4b')](_0x452eb1,{'include':[{'model':db[_0x10c7('0x59')],'as':_0x10c7('0x5b')}],'raw':!![],'transaction':_0x354f9a})[_0x10c7('0x26')](function(_0x36f99d){_0x2528ea[_0x10c7('0x5e')](_0x36f99d[_0x10c7('0x4f')]({'plain':!![]}));});})[_0x10c7('0x26')](function(){return _0x2528ea;});});});}})[_0x10c7('0x26')](function(_0x1134ec){return _0x1134ec;})[_0x10c7('0x26')](respondWithResult(_0x2b3a5e,null))[_0x10c7('0x48')](handleError(_0x2b3a5e,null));};exports['removeSections']=function(_0x4dce04,_0x5ddb98){var _0x425591;return db[_0x10c7('0x2d')]['find']({'where':{'id':_0x4dce04[_0x10c7('0x49')]['id']},'attributes':['id','name']})[_0x10c7('0x26')](handleEntityNotFound(_0x5ddb98,null))[_0x10c7('0x26')](function(_0x191834){if(_0x191834){_0x425591=_0x191834;return db['UserProfileSection'][_0x10c7('0x27')]({'where':{'userProfileId':_0x4dce04[_0x10c7('0x49')]['id'],'sectionId':_0x4dce04[_0x10c7('0x33')][_0x10c7('0x5f')]}});}})[_0x10c7('0x26')](function(){return _0x425591;})[_0x10c7('0x26')](respondWithStatusCode(_0x5ddb98,null))[_0x10c7('0x48')](handleError(_0x5ddb98,null));};exports[_0x10c7('0x60')]=function(_0x4ec87c,_0x1b0a6c){var _0x52f1b3=[];var _0x114dd3=[];return db[_0x10c7('0x56')][_0x10c7('0x46')]({'where':{'userProfileId':_0x4ec87c['params']['id']},'raw':!![]})[_0x10c7('0x26')](function(_0x1caf13){_0x52f1b3=_[_0x10c7('0x3e')](_0x1caf13,function(_0x2f6ff7){return _0x2f6ff7[_0x10c7('0x61')]===0x1||_[_0x10c7('0x62')]([0x3eb,0x709],_0x2f6ff7[_0x10c7('0x5a')]);});if(!_['isEmpty'](_0x52f1b3)){return _[_0x10c7('0x41')](_0x52f1b3,function(_0x233877){return _0x233877[_0x10c7('0x5a')];});}else{return;}})['then'](function(_0x32f473){if(_0x32f473)_0x114dd3=_0x32f473;if(_[_0x10c7('0x62')](_0x114dd3,0x64)){var _0x8a9164=_[_0x10c7('0x4a')](_0x52f1b3,{'sectionId':0x64});return hasDefaultDashboard(_0x8a9164)['then'](function(_0x39aa62){return _[_0x10c7('0x41')](_0x52f1b3,function(_0x45aea3){if(_0x45aea3[_0x10c7('0x5a')]===0x64){_0x45aea3[_0x10c7('0x63')]=_0x39aa62;}return _0x45aea3;});});}else{return;}})['then'](function(_0x34a9cc){if(_0x34a9cc)_0x52f1b3=_0x34a9cc;if(_[_0x10c7('0x62')](_0x114dd3,0x3eb)){var _0x3b6aa4=_[_0x10c7('0x4a')](_0x52f1b3,{'sectionId':0x3eb});return getCustomDashboards(_0x3b6aa4)['then'](function(_0x4dd7bc){return _[_0x10c7('0x41')](_0x52f1b3,function(_0xe98b6e){if(_0x3b6aa4['enabled']){if(_0xe98b6e['sectionId']===0x3eb){_0xe98b6e[_0x10c7('0x63')]=_0x4dd7bc;}}else{if(_0xe98b6e[_0x10c7('0x5a')]===0x64){_0xe98b6e[_0x10c7('0x63')]=_0x4dd7bc;}}return _0xe98b6e;});});}else{return;}})['then'](function(_0x570c7f){if(_0x570c7f)_0x52f1b3=_0x570c7f;if(_[_0x10c7('0x62')](_0x114dd3,0x709)){var _0x3d9ef7=_['find'](_0x52f1b3,{'sectionId':0x709});return getPlugins(_0x3d9ef7)['then'](function(_0x4e3abd){if(_0x3d9ef7[_0x10c7('0x61')]){return _[_0x10c7('0x41')](_0x52f1b3,function(_0x44cec8){if(_0x44cec8[_0x10c7('0x5a')]===0x709){_0x44cec8[_0x10c7('0x63')]=_0x4e3abd;}return _0x44cec8;});}else{var _0x1415b2={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4e3abd};var _0x3e2c9e=_[_0x10c7('0x41')](_0x52f1b3);_0x3e2c9e[_0x10c7('0x5e')](_0x1415b2);return _0x3e2c9e;}});}else{return;}})['then'](function(_0x5c5445){if(_0x5c5445)_0x52f1b3=_0x5c5445;return _[_0x10c7('0x3e')](_0x52f1b3,['enabled',0x1]);})['then'](respondWithResult(_0x1b0a6c,null))[_0x10c7('0x48')](handleError(_0x1b0a6c,null));};function hasDefaultDashboard(_0xc1af4){var _0x426a40=[0x65];return new BPromise(function(_0x221d18,_0x33e152){try{if(_0xc1af4[_0x10c7('0x58')]){_0x221d18(_0x426a40);}else{return db[_0x10c7('0x59')][_0x10c7('0x64')]({'where':{'sectionId':_0xc1af4['id']},'raw':!![]})[_0x10c7('0x26')](function(_0x17287e){_0x17287e?_0x221d18(_0x426a40):_0x221d18();});}}catch(_0x138eee){_0x33e152(_0x138eee);}});}function getCustomDashboards(_0x3fc20b){var _0xb6a17e=[];return new BPromise(function(_0x10a36e,_0x406fec){try{if(_0x3fc20b[_0x10c7('0x58')]){return db['Dashboard'][_0x10c7('0x46')]({'raw':!![]})[_0x10c7('0x26')](function(_0x157cc0){_0x157cc0[_0x10c7('0x65')](function(_0x4da574){_0xb6a17e[_0x10c7('0x5e')](_0x4da574['id']+0x1869f);});_0x10a36e(_0xb6a17e);});}else{return db[_0x10c7('0x59')][_0x10c7('0x46')]({'where':{'sectionId':_0x3fc20b['id']},'raw':!![]})[_0x10c7('0x26')](function(_0x2cd7cf){_0x2cd7cf['forEach'](function(_0x4f7333){_0xb6a17e[_0x10c7('0x5e')](_0x4f7333['resourceId']+0x1869f);});_0x10a36e(_0xb6a17e);});}}catch(_0x3a3fdd){_0x406fec(_0x3a3fdd);}});}function getPlugins(_0x4123dc){var _0x57273c=[];return new BPromise(function(_0x21a0a8,_0x572009){try{if(_0x4123dc[_0x10c7('0x58')]){return db['Plugin'][_0x10c7('0x46')]({'raw':!![]})[_0x10c7('0x26')](function(_0x51a008){_0x51a008['forEach'](function(_0x38d7a1){_0x57273c['push'](_0x38d7a1['id']+0x15b38);});_0x21a0a8(_0x57273c);});}else{return db[_0x10c7('0x59')][_0x10c7('0x46')]({'where':{'sectionId':_0x4123dc['id']},'raw':!![]})[_0x10c7('0x26')](function(_0x52c949){_0x52c949[_0x10c7('0x65')](function(_0x4f26df){_0x57273c[_0x10c7('0x5e')](_0x4f26df[_0x10c7('0x66')]+0x15b38);});_0x21a0a8(_0x57273c);});}}catch(_0x258f65){_0x572009(_0x258f65);}});}exports[_0x10c7('0x67')]=function(_0x144adc,_0x4f77a1){return db['UserProfile']['find']({'where':{'id':_0x144adc['params']['id']}})['then'](handleEntityNotFound(_0x4f77a1,null))[_0x10c7('0x26')](function(_0x47b6c8){if(_0x47b6c8){return db[_0x10c7('0x54')][_0x10c7('0x55')](function(_0x54a39b){return db[_0x10c7('0x56')][_0x10c7('0x46')]({'where':{'userProfileId':_0x144adc[_0x10c7('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0x10c7('0x26')](function(_0x5cfbc1){if(_0x5cfbc1){return db[_0x10c7('0x56')][_0x10c7('0x27')]({'where':{'userProfileId':_0x144adc['params']['id'],'id':_[_0x10c7('0x41')](_0x5cfbc1,function(_0x486120){return _0x486120['id'];})},'transaction':_0x54a39b});}})[_0x10c7('0x26')](function(_0x4bbc3e){var _0x1cbf2a=_[_0x10c7('0x41')](_0x144adc[_0x10c7('0x4c')],function(_0x4fec96){_0x4fec96[_0x10c7('0x5d')]=_0x144adc['params']['id'];return _0x4fec96;});return db[_0x10c7('0x56')][_0x10c7('0x68')](_0x1cbf2a,{'raw':!![],'transaction':_0x54a39b});})[_0x10c7('0x26')](function(_0xc0241a){var _0x9ffc16=_[_0x10c7('0x3e')](_[_0x10c7('0x41')](_0xc0241a,function(_0x44eaf5){return _0x44eaf5[_0x10c7('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x9ffc16){return db[_0x10c7('0x56')][_0x10c7('0x46')]({'where':{'userProfileId':_0x144adc[_0x10c7('0x49')]['id'],'sectionId':_[_0x10c7('0x41')](_0x9ffc16,function(_0x44c9a3){return _0x44c9a3['sectionId'];})},'attributes':['id',_0x10c7('0x5a')],'raw':!![]})[_0x10c7('0x26')](function(_0x392e0f){var _0x17b1df=_[_0x10c7('0x41')](_0x144adc[_0x10c7('0x4c')],function(_0x34b378){_0x34b378[_0x10c7('0x5d')]=_0x144adc['params']['id'];return _0x34b378;});return db[_0x10c7('0x59')][_0x10c7('0x68')](_0x17b1df,{'raw':!![],'transaction':_0x54a39b});});}})[_0x10c7('0x48')](handleError(_0x4f77a1,null));});}})[_0x10c7('0x26')](function(_0x5e1481){var _0x20b5f7=_[_0x10c7('0x41')](_0x5e1481,function(_0x1e8deb){return _0x1e8deb['get']({'plain':!![]});});})[_0x10c7('0x26')](respondWithResult(_0x4f77a1,null))['catch'](handleError(_0x4f77a1,null));};exports[_0x10c7('0x69')]=function(_0x27ea41,_0x1f3a9b,_0x27a560){return db[_0x10c7('0x2d')]['find']({'where':{'id':_0x27ea41[_0x10c7('0x49')]['id']}})['then'](handleEntityNotFound(_0x1f3a9b,null))[_0x10c7('0x26')](function(_0x41a278){if(_0x41a278){return _0x41a278[_0x10c7('0x69')](_0x27ea41['query'][_0x10c7('0x5f')]);}})[_0x10c7('0x26')](respondWithStatusCode(_0x1f3a9b,null))['catch'](handleError(_0x1f3a9b,null));};exports['getResources']=function(_0x3acf0f,_0x1f0f2e){var _0x2f7acf={};if(!_0x3acf0f[_0x10c7('0x33')]['section'])throw new Error('Missing\x20section\x20parameter');if(!_0x3acf0f[_0x10c7('0x33')][_0x10c7('0x6a')](_0x10c7('0x3a'))){_0x2f7acf[_0x10c7('0x3b')]=qs[_0x10c7('0x3b')](_0x3acf0f[_0x10c7('0x33')]['limit']);_0x2f7acf[_0x10c7('0x1f')]=qs[_0x10c7('0x1f')](_0x3acf0f[_0x10c7('0x33')]['offset']);}return db['UserProfile'][_0x10c7('0x4a')]({'where':{'id':_0x3acf0f[_0x10c7('0x49')]['id']}})[_0x10c7('0x26')](function(_0x28b342){if(!_0x28b342)throw new Error(_0x10c7('0x6b')+_0x3acf0f[_0x10c7('0x49')]['id']);return db[_0x10c7('0x2d')]['getResources'](_0x3acf0f);})['then'](respondWithFilteredResult(_0x1f0f2e,_0x2f7acf))[_0x10c7('0x48')](handleError(_0x1f0f2e,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index afde6fd..0000686 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 _0x9e8a=['remove','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x9e8a,0x112));var _0xa9e8=function(_0xfe306c,_0x370e1e){_0xfe306c=_0xfe306c-0x0;var _0x55e030=_0x9e8a[_0xfe306c];return _0x55e030;};'use strict';var EventEmitter=require(_0xa9e8('0x0'));var UserProfile=require(_0xa9e8('0x1'))['db'][_0xa9e8('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xa9e8('0x3')](0x0);var events={'afterCreate':_0xa9e8('0x4'),'afterUpdate':_0xa9e8('0x5'),'afterDestroy':_0xa9e8('0x6')};function emitEvent(_0x337024){return function(_0xe3b2c8,_0x57736c,_0x4f9ddb){UserProfileEvents['emit'](_0x337024+':'+_0xe3b2c8['id'],_0xe3b2c8);UserProfileEvents['emit'](_0x337024,_0xe3b2c8);_0x4f9ddb(null);};}for(var e in events){if(events[_0xa9e8('0x7')](e)){var event=events[e];UserProfile[_0xa9e8('0x8')](e,emitEvent(event));}}module[_0xa9e8('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x202a=['update','hasOwnProperty','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x202a,0xc0));var _0xa202=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x202a[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xa202('0x0'))['db'][_0xa202('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xa202('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa202('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4878f5){return function(_0x595945,_0x32f8b7,_0x1ce932){UserProfileEvents['emit'](_0x4878f5+':'+_0x595945['id'],_0x595945);UserProfileEvents['emit'](_0x4878f5,_0x595945);_0x1ce932(null);};}for(var e in events){if(events[_0xa202('0x4')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 3ecb705..90498fb 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 _0x5496=['parentSections','SquareProjects','name','projectName','projects','contacts','CmContact','Lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceChanSpy','voiceprefixes','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','telephones','Users','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','reportId','metrics','charAt','toUpperCase','Sequelize','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','union','ignore','autoAssociation','model','all','keys','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','filters','pick','merge','key','VIRTUAL','foreignKey','forEach','options','reportType','DefaultReports','CustomReports','count','rows','includeAll','Tags','color','tag','ThroughTags','include','openTabs','true','dataValues','sms','fax','mail','openchannel','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','filter','field','value','then','associatedResources','map','catch','findAll','resolve','resourceId','type','squareprojects','childModel','odbc','SquareOdbc','SquareRecording'];(function(_0xb7b55d,_0x43288e){var _0x555d19=function(_0x6cf754){while(--_0x6cf754){_0xb7b55d['push'](_0xb7b55d['shift']());}};_0x555d19(++_0x43288e);}(_0x5496,0x175));var _0x6549=function(_0x42506d,_0x560fc4){_0x42506d=_0x42506d-0x0;var _0x283ef9=_0x5496[_0x42506d];return _0x283ef9;};'use strict';var _=require(_0x6549('0x0'));var attributes=require(_0x6549('0x1'));var qs=require(_0x6549('0x2'));var squel=require(_0x6549('0x3'));module[_0x6549('0x4')]=function(_0x4b616a){var _0x21585c=_0x4b616a['models'];function _0x2d2155(_0x8112c5,_0x3750cc){return new Promise(function(_0x4d0473,_0x5a4658){if(!_0x3750cc)return _0x4d0473(null);var _0x43cb17=_0x3750cc[_0x6549('0x5')]?{[_0x3750cc['filter'][_0x6549('0x6')]]:_0x3750cc[_0x6549('0x5')][_0x6549('0x7')]}:undefined;return _0x21585c[_0x8112c5]['findAll']({'where':_0x43cb17,'raw':!![]})[_0x6549('0x8')](function(_0x35d008){_0x3750cc[_0x6549('0x9')]=_[_0x6549('0xa')](_0x35d008,'id');_0x4d0473(_0x3750cc);})[_0x6549('0xb')](function(_0x3e08a6){_0x5a4658(_0x3e08a6);});});}function _0x50fa35(_0x551133,_0x1e27d4){return new Promise(function(_0xac828c,_0x3c5f9b){var _0x216620=_0x551133[_0x6549('0x5')]?{[_0x551133['filter']['field']]:_0x551133[_0x6549('0x5')][_0x6549('0x7')]}:undefined;return _0x21585c[_0x551133['model']][_0x6549('0xc')]({'where':_0x216620,'raw':!![]})[_0x6549('0x8')](function(_0x195d25){_0x1e27d4[_0x6549('0x9')]=_[_0x6549('0xa')](_0x195d25,function(_0x86ae9d){return _0x86ae9d['name'];});_0xac828c(_0x1e27d4);})['catch'](function(_0x384f75){_0x3c5f9b(_0x384f75);});});}function _0x25da29(_0x47a81a,_0x238a04,_0x67acc0){if(!_0x238a04)return Promise[_0x6549('0xd')](null);return new Promise(function(_0x387e60,_0xffc8b9){return _0x21585c['UserProfileResource']['findAll']({'where':{'sectionId':_0x238a04['id']},'raw':!![]})[_0x6549('0x8')](function(_0x48f037){if(_0x47a81a['field']&&_0x47a81a[_0x6549('0x6')]!=='id'){_0x238a04[_0x6549('0x9')]=_[_0x6549('0xa')](_0x48f037,function(_0xfca192){return _0xfca192[_0x47a81a[_0x6549('0x6')]];});}else{if(_0x67acc0==='AnalyticExtractedReport'){_0x238a04[_0x6549('0x9')]=_['map'](_0x48f037,function(_0x125096){return{'id':_0x125096[_0x6549('0xe')],'type':_0x125096[_0x6549('0xf')]};});}else{_0x238a04[_0x6549('0x9')]=_[_0x6549('0xa')](_0x48f037,function(_0x12d547){return _0x12d547[_0x6549('0xe')];});}}_0x387e60(_0x238a04);})[_0x6549('0xb')](function(_0x2be467){_0xffc8b9(_0x2be467);});});}function _0x6ae00c(_0x40d3f9,_0x1fbfa4){var _0x23c0ba={'parentSections':[]};switch(_0x40d3f9['toLowerCase']()){case _0x6549('0x10'):_0x23c0ba[_0x6549('0x11')]='SquareProject';break;case _0x6549('0x12'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x13');break;case'squarerecordings':_0x23c0ba[_0x6549('0x11')]=_0x6549('0x14');_0x23c0ba[_0x6549('0x15')]=[{'name':_0x6549('0x16'),'field':_0x6549('0x17'),'foreignKey':_0x6549('0x18')}];break;case _0x6549('0x19'):_0x23c0ba[_0x6549('0x11')]='JscriptyProject';break;case _0x6549('0x1a'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x1b');_0x23c0ba['parentSections']=[{'name':_0x6549('0x1c'),'field':'id','foreignKey':'ListId'}];break;case'lists':_0x23c0ba['childModel']=_0x6549('0x1d');break;case _0x6549('0x1e'):_0x23c0ba['childModel']=_0x6549('0x1f');break;case _0x6549('0x20'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x21');break;case _0x6549('0x22'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x23');break;case'chatwebsites':_0x23c0ba[_0x6549('0x11')]=_0x6549('0x24');break;case _0x6549('0x25'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x26');break;case _0x6549('0x27'):_0x23c0ba['childModel']=_0x6549('0x28');break;case'inboundroutes':case _0x6549('0x29'):case'outboundroutes':_0x23c0ba[_0x6549('0x11')]=_0x6549('0x2a');break;case _0x6549('0x2b'):_0x23c0ba['childModel']=_0x6549('0x2c');break;case _0x6549('0x2d'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x2e');break;case'voicerecordings':_0x23c0ba['childModel']='VoiceRecording';_0x23c0ba[_0x6549('0x15')]=[{'name':_0x6549('0x2f'),'field':'name','foreignKey':_0x6549('0x30'),'model':_0x6549('0x31'),'filter':{'field':_0x6549('0x32'),'value':[_0x6549('0x33')]}},{'name':_0x6549('0x34'),'field':'name','foreignKey':'membername','model':_0x6549('0x31'),'filter':{'field':_0x6549('0x32'),'value':[_0x6549('0x35')]}},{'name':_0x6549('0x36'),'field':_0x6549('0x17'),'foreignKey':_0x6549('0x37'),'model':_0x6549('0x38'),'filter':{'field':_0x6549('0xf'),'value':[_0x6549('0x39')]}},{'name':_0x6549('0x3a'),'field':'name','foreignKey':_0x6549('0x37'),'model':_0x6549('0x38'),'filter':{'field':_0x6549('0xf'),'value':[_0x6549('0x3b')]}}];break;case _0x6549('0x3c'):_0x23c0ba['childModel']='VoiceMusicOnHold';break;case'chanspies':_0x23c0ba[_0x6549('0x11')]=_0x6549('0x3d');break;case _0x6549('0x3e'):_0x23c0ba[_0x6549('0x11')]='VoicePrefix';break;case'ivrcampaigns':_0x23c0ba[_0x6549('0x11')]=_0x6549('0x3f');break;case _0x6549('0x40'):_0x23c0ba['childModel']=_0x6549('0x41');break;case'mailaccounts':_0x23c0ba[_0x6549('0x11')]=_0x6549('0x42');break;case _0x6549('0x43'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x44');break;case _0x6549('0x45'):_0x23c0ba[_0x6549('0x11')]='OpenchannelQueue';break;case _0x6549('0x46'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x47');break;case _0x6549('0x48'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x49');break;case _0x6549('0x4a'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x4b');break;case _0x6549('0x4c'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x4d');break;case _0x6549('0x4e'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x4f');break;case _0x6549('0x50'):_0x23c0ba['childModel']=_0x6549('0x51');break;case _0x6549('0x52'):case _0x6549('0x53'):_0x23c0ba[_0x6549('0x11')]='VoiceQueue';if(_0x1fbfa4){_0x23c0ba[_0x6549('0x15')]=[{'name':'VoiceQueues'},{'name':_0x6549('0x3a')}];}break;case _0x6549('0x54'):case'agents':case _0x6549('0x55'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x31');if(_0x1fbfa4){_0x23c0ba[_0x6549('0x15')]=[{'name':_0x6549('0x56'),'filter':{'field':'role','value':['admin',_0x6549('0x57')]},'ignore':!![]},{'name':_0x6549('0x2f')},{'name':_0x6549('0x34')}];}break;case _0x6549('0x58'):_0x23c0ba[_0x6549('0x11')]='ZendeskAccount';break;case _0x6549('0x59'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x5a');break;case _0x6549('0x5b'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x5c');break;case _0x6549('0x5d'):_0x23c0ba[_0x6549('0x11')]='SugarcrmAccount';break;case _0x6549('0x5e'):_0x23c0ba['childModel']=_0x6549('0x5f');break;case _0x6549('0x60'):_0x23c0ba[_0x6549('0x11')]='ZohoAccount';break;case _0x6549('0x61'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x31');break;case'cannedanswers':_0x23c0ba[_0x6549('0x11')]=_0x6549('0x62');break;case _0x6549('0x63'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x64');break;case _0x6549('0x65'):_0x23c0ba['childModel']=_0x6549('0x66');break;case'intervals':_0x23c0ba[_0x6549('0x11')]=_0x6549('0x67');break;case _0x6549('0x68'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x69');break;case _0x6549('0x6a'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x6b');break;case _0x6549('0x6c'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x6d');break;case _0x6549('0x6e'):_0x23c0ba['childModel']=_0x6549('0x6f');break;case _0x6549('0x70'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x71');break;case _0x6549('0x72'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x73');break;case _0x6549('0x74'):_0x23c0ba['childModel']=_0x6549('0x75');break;case _0x6549('0x76'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x77');break;case _0x6549('0x78'):_0x23c0ba[_0x6549('0x11')]=_0x6549('0x79');break;case _0x6549('0x7a'):_0x23c0ba['childModel']=_0x6549('0x7b');_0x23c0ba[_0x6549('0x15')]=[{'name':_0x6549('0x7c'),'field':'id','foreignKey':_0x6549('0x7d')}];break;case _0x6549('0x7e'):_0x23c0ba[_0x6549('0x11')]='AnalyticMetric';break;}return _0x23c0ba;}function _0x2ca517(_0xe0a696,_0x4bf996){var _0x38bce4=_0xe0a696[_0x6549('0x7f')](0x0)[_0x6549('0x80')]()+_0xe0a696['slice'](0x1);var _0x4640c8={'type':_0x21585c[_0x6549('0x81')]['QueryTypes'][_0x6549('0x82')],'raw':!![]};return new Promise(function(_0x509f69,_0x3dc12c){var _0x522cd3=squel[_0x6549('0x83')]()[_0x6549('0x6')](_0x6549('0x84')+_0x38bce4+_0x6549('0x85'),'id')[_0x6549('0x6')](_0x6549('0x86'))[_0x6549('0x87')](_0x6549('0x88')+_0xe0a696+_0x6549('0x89'),'ui')[_0x6549('0x8a')](_0x6549('0x8b'),_0x4bf996['id']);return _0x21585c[_0x6549('0x8c')][_0x6549('0x8d')](_0x522cd3[_0x6549('0x8e')](),_0x4640c8)['then'](function(_0x2bff46){_0x4bf996[_0x38bce4+_0x6549('0x8f')]=_0x2bff46;_0x509f69(_0x2bff46);})['catch'](function(_0xfb11e1){_0x3dc12c(_0xfb11e1);});});}return _0x4b616a[_0x6549('0x90')](_0x6549('0x91'),attributes,{'tableName':_0x6549('0x92'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4fbc75){var _0x6ff64d={'raw':![],'where':{}};var _0x28ff2e={};var _0x19c9bd={'count':0x0,'rows':[]};var _0x20e39b=_0x4fbc75['query'][_0x6549('0x93')];var _0x5372f4=_0x4fbc75[_0x6549('0x8d')][_0x6549('0x94')]||![];var _0x101221=_0x6ae00c(_0x20e39b,_0x5372f4);if(!_0x101221[_0x6549('0x11')])throw new Error(_0x6549('0x95')+_0x20e39b+'\x27');var _0x23f067=[{'name':_0x20e39b}];if(!_[_0x6549('0x96')](_0x101221[_0x6549('0x15')]))_0x23f067=_0x101221[_0x6549('0x15')];var _0x1cd528=[];for(var _0x49427f=0x0;_0x49427f<_0x23f067[_0x6549('0x97')];_0x49427f++){_0x1cd528[_0x6549('0x98')](_0x21585c[_0x6549('0x99')][_0x6549('0x9a')]({'where':{'userProfileId':_0x4fbc75[_0x6549('0x9b')]['id'],'name':_0x23f067[_0x49427f][_0x6549('0x17')]},'raw':!![]}));}return Promise['all'](_0x1cd528)['then'](function(_0x368298){var _0x11886e=_[_0x6549('0x5')](_0x368298,function(_0x4e8333){return _0x4e8333?_0x4e8333:undefined;});var _0x1be12c=_[_0x6549('0x5')](_0x23f067,['ignore',!![]]);var _0x312299=_[_0x6549('0x96')](_0x11886e)&&_[_0x6549('0x96')](_0x1be12c)?null:_[_0x6549('0x9c')](_0x1be12c,_0x11886e);if(!_0x312299)return null;var _0x2ea46d=[];for(var _0x3c1768=0x0;_0x3c1768<_0x312299[_0x6549('0x97')];_0x3c1768++){var _0x402c26=_['find'](_0x23f067,function(_0x43c667){return _0x312299[_0x3c1768]?_0x43c667['name']===_0x312299[_0x3c1768][_0x6549('0x17')]:null;});if(_0x402c26){if(_0x312299[_0x3c1768][_0x6549('0x9d')]){_0x2ea46d['push'](_0x2d2155(_0x101221[_0x6549('0x11')],_0x312299[_0x3c1768]));}else{if(!_0x312299[_0x3c1768][_0x6549('0x9e')]){_0x2ea46d[_0x6549('0x98')](_0x25da29(_0x402c26,_0x312299[_0x3c1768],_0x101221['childModel']));}else{if(_0x402c26[_0x6549('0x9f')]){_0x2ea46d[_0x6549('0x98')](_0x50fa35(_0x402c26,_0x312299[_0x3c1768]));}}}}}return Promise[_0x6549('0xa0')](_0x2ea46d);})[_0x6549('0x8')](function(_0x15b906){var _0x34c5f9=_0x15b906;var _0x500bd9=null;if(_0x34c5f9){_0x500bd9=_0x34c5f9[_0x6549('0x97')]===0x1?_0x34c5f9[0x0]:null;}if(!_0x500bd9&&!_0x34c5f9)return _0x19c9bd;var _0x1cad48=_0x21585c[_0x101221[_0x6549('0x11')]]['rawAttributes'];_0x28ff2e['model']=_['keys'](_0x1cad48);_0x28ff2e[_0x6549('0x8d')]=_[_0x6549('0xa1')](_0x4fbc75[_0x6549('0x8d')]);_0x28ff2e['filters']=_['intersection'](_0x28ff2e[_0x6549('0x9f')],_0x28ff2e['query']);_0x6ff64d[_0x6549('0xa2')]=_[_0x6549('0xa3')](_0x28ff2e[_0x6549('0x9f')],qs[_0x6549('0xa4')](_0x4fbc75[_0x6549('0x8d')][_0x6549('0xa4')]));_0x6ff64d[_0x6549('0xa2')]=_0x6ff64d['attributes'][_0x6549('0x97')]?_0x6ff64d[_0x6549('0xa2')]:_0x28ff2e[_0x6549('0x9f')];if(!_0x4fbc75['query'][_0x6549('0xa5')](_0x6549('0xa6'))){_0x6ff64d[_0x6549('0xa7')]=qs[_0x6549('0xa7')](_0x4fbc75[_0x6549('0x8d')][_0x6549('0xa7')]);_0x6ff64d[_0x6549('0xa8')]=qs['offset'](_0x4fbc75[_0x6549('0x8d')]['offset']);}_0x6ff64d[_0x6549('0xa9')]=qs[_0x6549('0xaa')](_0x4fbc75[_0x6549('0x8d')][_0x6549('0xaa')]);_0x6ff64d[_0x6549('0x8a')]=qs[_0x6549('0xab')](_[_0x6549('0xac')](_0x4fbc75[_0x6549('0x8d')],_0x28ff2e['filters']));if(_0x4fbc75[_0x6549('0x8d')][_0x6549('0x5')]){_0x6ff64d[_0x6549('0x8a')]=_[_0x6549('0xad')](_0x6ff64d[_0x6549('0x8a')],{'$or':_[_0x6549('0xa')](_0x1cad48,function(_0xc8645b){if(_0xc8645b[_0x6549('0xf')][_0x6549('0xae')]!==_0x6549('0xaf')){var _0x51f479={};_0x51f479[_0xc8645b[_0x6549('0x6')]]={'$like':'%'+_0x4fbc75[_0x6549('0x8d')][_0x6549('0x5')]+'%'};return _0x51f479;}})});}var _0x45dc56=[];var _0x416657=null;var _0xd80e41={};if(_0x500bd9){_0x416657=_[_0x6549('0x9a')](_0x23f067,[_0x6549('0x17'),_0x500bd9[_0x6549('0x17')]]);if(_0x416657[_0x6549('0x6')]){_0xd80e41={};if(_0x101221[_0x6549('0x11')]===_0x6549('0x7b')){_0xd80e41[_0x416657[_0x6549('0xb0')]]=_[_0x6549('0xa')](_0x500bd9[_0x6549('0x9')],'id');}else{_0xd80e41[_0x416657[_0x6549('0xb0')]]=_0x500bd9[_0x6549('0x9')];}_0x45dc56[_0x6549('0x98')](_0xd80e41);}else{_0x6ff64d['where']['id']=_0x500bd9[_0x6549('0x9')];}}else{for(var _0x401eb0=0x0;_0x401eb0<_0x34c5f9[_0x6549('0x97')];_0x401eb0++){_0x416657=_[_0x6549('0x9a')](_0x23f067,[_0x6549('0x17'),_0x34c5f9[_0x401eb0][_0x6549('0x17')]]);if(_0x416657[_0x6549('0x6')]){_0xd80e41={};_0xd80e41[_0x416657[_0x6549('0xb0')]]=_0x34c5f9[_0x401eb0][_0x6549('0x9')];_0x45dc56[_0x6549('0x98')](_0xd80e41);}else{if(!_0x6ff64d[_0x6549('0x8a')]['id'])_0x6ff64d[_0x6549('0x8a')]['id']=[];_0x34c5f9[_0x401eb0][_0x6549('0x9')][_0x6549('0xb1')](function(_0x38df70){_0x6ff64d[_0x6549('0x8a')]['id'][_0x6549('0x98')](_0x38df70);});}}}if(!_['isEmpty'](_0x45dc56)){_0x6ff64d[_0x6549('0x8a')]=_[_0x6549('0xad')](_0x6ff64d[_0x6549('0x8a')],{'$and':{'$or':_0x45dc56}});}_0x6ff64d=_[_0x6549('0xad')]({},_0x6ff64d,_0x4fbc75[_0x6549('0xb2')]);if(_0x500bd9&&!_0x500bd9[_0x6549('0x9e')]&&_0x101221[_0x6549('0x11')]==='AnalyticExtractedReport'){if(_0x4fbc75[_0x6549('0x8d')]['includeAll']){_0x6ff64d['include']=[{'all':!![]}];}return _0x21585c[_0x101221[_0x6549('0x11')]]['findAll'](_0x6ff64d)[_0x6549('0x8')](function(_0x1f3230){var _0x30083b=[];_0x1f3230[_0x6549('0xb1')](function(_0x419fdb){var _0x5ac35c;switch(_0x419fdb[_0x6549('0xb3')]){case'default':_0x5ac35c=_[_0x6549('0x9a')](_0x500bd9[_0x6549('0x9')],function(_0x4528fd){return _0x4528fd['id']===_0x419fdb['reportId']&&_0x4528fd[_0x6549('0xf')]===_0x6549('0xb4');});break;case'custom':_0x5ac35c=_['find'](_0x500bd9[_0x6549('0x9')],function(_0x154346){return _0x154346['id']===_0x419fdb[_0x6549('0x7d')]&&_0x154346[_0x6549('0xf')]===_0x6549('0xb5');});break;}if(_0x5ac35c)_0x30083b[_0x6549('0x98')](_0x419fdb);});_0x19c9bd[_0x6549('0xb6')]=_0x30083b[_0x6549('0x97')];_0x19c9bd[_0x6549('0xb7')]=_0x30083b;return _0x19c9bd;});}else{return _0x21585c[_0x101221[_0x6549('0x11')]][_0x6549('0xb6')]({'where':_0x6ff64d[_0x6549('0x8a')]})[_0x6549('0x8')](function(_0x4746bb){_0x19c9bd[_0x6549('0xb6')]=_0x4746bb;if(_0x4fbc75[_0x6549('0x8d')][_0x6549('0xb8')]){if(_0x101221[_0x6549('0x11')]===_0x6549('0x1b')){_0x6ff64d['include']=[{'model':_0x21585c['Tag'],'as':_0x6549('0xb9'),'attributes':['id',_0x6549('0x17'),_0x6549('0xba')],'required':_0x4fbc75[_0x6549('0x8d')][_0x6549('0xbb')]?!![]:![]},{'model':_0x21585c[_0x6549('0x6f')],'as':_0x6549('0xbc'),'attributes':['id',_0x6549('0x17'),_0x6549('0xba')],'through':_0x4fbc75[_0x6549('0x8d')]['tag']?{'attributes':[],'where':{'TagId':_0x4fbc75['query']['tag']||undefined}}:{},'required':_0x4fbc75[_0x6549('0x8d')][_0x6549('0xbb')]?!![]:![]}];}else{_0x6ff64d[_0x6549('0xbd')]=[{'all':!![]}];}}return _0x21585c[_0x101221[_0x6549('0x11')]][_0x6549('0xc')](_0x6ff64d);})['then'](function(_0x100c37){_0x19c9bd[_0x6549('0xb7')]=_0x100c37;if(_0x20e39b===_0x6549('0x2f')&&_0x4fbc75[_0x6549('0x8d')][_0x6549('0xbe')]===_0x6549('0xbf')){var _0xaf1a80=[];for(var _0x1dd688=0x0;_0x1dd688<_0x19c9bd[_0x6549('0xb7')][_0x6549('0x97')];_0x1dd688++){_0xaf1a80[_0x6549('0x98')](_0x2ca517('chat',_0x19c9bd[_0x6549('0xb7')][_0x1dd688][_0x6549('0xc0')]));_0xaf1a80[_0x6549('0x98')](_0x2ca517(_0x6549('0xc1'),_0x19c9bd['rows'][_0x1dd688][_0x6549('0xc0')]));_0xaf1a80[_0x6549('0x98')](_0x2ca517(_0x6549('0xc2'),_0x19c9bd[_0x6549('0xb7')][_0x1dd688][_0x6549('0xc0')]));_0xaf1a80[_0x6549('0x98')](_0x2ca517(_0x6549('0xc3'),_0x19c9bd[_0x6549('0xb7')][_0x1dd688][_0x6549('0xc0')]));_0xaf1a80['push'](_0x2ca517(_0x6549('0xc4'),_0x19c9bd[_0x6549('0xb7')][_0x1dd688][_0x6549('0xc0')]));_0xaf1a80[_0x6549('0x98')](_0x2ca517('whatsapp',_0x19c9bd['rows'][_0x1dd688]['dataValues']));}return Promise[_0x6549('0xa0')](_0xaf1a80)['then'](function(){return _0x19c9bd;});}return _0x19c9bd;});}});}}});}; \ No newline at end of file +var _0x11e5=['contexts','VoiceRecording','Agents','User','role','agent','membername','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappaccounts','WhatsappAccount','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','pauses','Pause','sounds','Sound','tags','templates','Template','triggers','Trigger','trunks','variables','plugins','Plugin','extractedreports','Reports','reportId','slice','QueryTypes','SELECT','select','ui.createdAt','ui.UserId\x20=\x20?','query','OpenTabs','define','UserProfile','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','length','UserProfileSection','params','all','ignore','isEmpty','union','find','push','rawAttributes','keys','intersection','fields','attributes','nolimit','limit','offset','order','sort','pick','filters','where','merge','key','VIRTUAL','foreignKey','forEach','options','autoAssociation','includeAll','include','reportType','default','DefaultReports','custom','rows','count','Tag','Tags','color','ThroughTags','tag','openTabs','chat','dataValues','sms','mail','openchannel','whatsapp','lodash','../../components/parsers/qs','squel','models','filter','value','findAll','then','associatedResources','map','catch','field','model','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','childModel','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','name','projectName','projects','contacts','CmContact','Lists','lists','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension'];(function(_0x59a2d7,_0x5b9fac){var _0x342b45=function(_0x21e9ae){while(--_0x21e9ae){_0x59a2d7['push'](_0x59a2d7['shift']());}};_0x342b45(++_0x5b9fac);}(_0x11e5,0x8b));var _0x511e=function(_0x17cdcc,_0x29d5de){_0x17cdcc=_0x17cdcc-0x0;var _0x38f5f6=_0x11e5[_0x17cdcc];return _0x38f5f6;};'use strict';var _=require(_0x511e('0x0'));var attributes=require('./userProfile.attributes');var qs=require(_0x511e('0x1'));var squel=require(_0x511e('0x2'));module['exports']=function(_0x2947e4){var _0x30fb24=_0x2947e4[_0x511e('0x3')];function _0x5cab33(_0x249e4d,_0x4fbd4f){return new Promise(function(_0x5923a7,_0x342539){if(!_0x4fbd4f)return _0x5923a7(null);var _0x323f8c=_0x4fbd4f[_0x511e('0x4')]?{[_0x4fbd4f['filter']['field']]:_0x4fbd4f[_0x511e('0x4')][_0x511e('0x5')]}:undefined;return _0x30fb24[_0x249e4d][_0x511e('0x6')]({'where':_0x323f8c,'raw':!![]})[_0x511e('0x7')](function(_0x4449c4){_0x4fbd4f[_0x511e('0x8')]=_[_0x511e('0x9')](_0x4449c4,'id');_0x5923a7(_0x4fbd4f);})[_0x511e('0xa')](function(_0x2f547a){_0x342539(_0x2f547a);});});}function _0x1c6def(_0x464085,_0x57f4f5){return new Promise(function(_0x7e50db,_0x5dd510){var _0x4d041f=_0x464085[_0x511e('0x4')]?{[_0x464085[_0x511e('0x4')][_0x511e('0xb')]]:_0x464085[_0x511e('0x4')][_0x511e('0x5')]}:undefined;return _0x30fb24[_0x464085[_0x511e('0xc')]]['findAll']({'where':_0x4d041f,'raw':!![]})[_0x511e('0x7')](function(_0x33fd64){_0x57f4f5['associatedResources']=_[_0x511e('0x9')](_0x33fd64,function(_0x43a329){return _0x43a329['name'];});_0x7e50db(_0x57f4f5);})[_0x511e('0xa')](function(_0x162c91){_0x5dd510(_0x162c91);});});}function _0x3b990b(_0x17fd4a,_0x5b6cd6,_0x3e0415){if(!_0x5b6cd6)return Promise[_0x511e('0xd')](null);return new Promise(function(_0x2e66b6,_0x577616){return _0x30fb24[_0x511e('0xe')]['findAll']({'where':{'sectionId':_0x5b6cd6['id']},'raw':!![]})[_0x511e('0x7')](function(_0x492c9f){if(_0x17fd4a['field']&&_0x17fd4a[_0x511e('0xb')]!=='id'){_0x5b6cd6['associatedResources']=_[_0x511e('0x9')](_0x492c9f,function(_0x325278){return _0x325278[_0x17fd4a[_0x511e('0xb')]];});}else{if(_0x3e0415===_0x511e('0xf')){_0x5b6cd6[_0x511e('0x8')]=_[_0x511e('0x9')](_0x492c9f,function(_0x3723ff){return{'id':_0x3723ff[_0x511e('0x10')],'type':_0x3723ff['type']};});}else{_0x5b6cd6[_0x511e('0x8')]=_[_0x511e('0x9')](_0x492c9f,function(_0x2ebf30){return _0x2ebf30[_0x511e('0x10')];});}}_0x2e66b6(_0x5b6cd6);})[_0x511e('0xa')](function(_0x18807b){_0x577616(_0x18807b);});});}function _0x886b6(_0x2f28fc,_0x211b90){var _0x26618d={'parentSections':[]};switch(_0x2f28fc['toLowerCase']()){case'squareprojects':_0x26618d[_0x511e('0x11')]='SquareProject';break;case _0x511e('0x12'):_0x26618d['childModel']=_0x511e('0x13');break;case _0x511e('0x14'):_0x26618d[_0x511e('0x11')]=_0x511e('0x15');_0x26618d[_0x511e('0x16')]=[{'name':_0x511e('0x17'),'field':_0x511e('0x18'),'foreignKey':_0x511e('0x19')}];break;case _0x511e('0x1a'):_0x26618d[_0x511e('0x11')]='JscriptyProject';break;case _0x511e('0x1b'):_0x26618d[_0x511e('0x11')]=_0x511e('0x1c');_0x26618d[_0x511e('0x16')]=[{'name':_0x511e('0x1d'),'field':'id','foreignKey':'ListId'}];break;case _0x511e('0x1e'):_0x26618d['childModel']='CmList';break;case _0x511e('0x1f'):_0x26618d[_0x511e('0x11')]=_0x511e('0x20');break;case _0x511e('0x21'):_0x26618d[_0x511e('0x11')]='CmCustomField';break;case _0x511e('0x22'):_0x26618d[_0x511e('0x11')]=_0x511e('0x23');break;case _0x511e('0x24'):_0x26618d[_0x511e('0x11')]='ChatWebsite';break;case _0x511e('0x25'):_0x26618d[_0x511e('0x11')]=_0x511e('0x26');break;case _0x511e('0x27'):_0x26618d[_0x511e('0x11')]=_0x511e('0x28');break;case _0x511e('0x29'):case _0x511e('0x2a'):case'outboundroutes':_0x26618d[_0x511e('0x11')]=_0x511e('0x2b');break;case _0x511e('0x2c'):_0x26618d[_0x511e('0x11')]='VoiceContext';break;case'voicemails':_0x26618d[_0x511e('0x11')]='VoiceMail';break;case'voicerecordings':_0x26618d[_0x511e('0x11')]=_0x511e('0x2d');_0x26618d[_0x511e('0x16')]=[{'name':_0x511e('0x2e'),'field':_0x511e('0x18'),'foreignKey':'membername','model':_0x511e('0x2f'),'filter':{'field':_0x511e('0x30'),'value':[_0x511e('0x31')]}},{'name':'Telephones','field':_0x511e('0x18'),'foreignKey':_0x511e('0x32'),'model':_0x511e('0x2f'),'filter':{'field':'role','value':[_0x511e('0x33')]}},{'name':_0x511e('0x34'),'field':'name','foreignKey':_0x511e('0x35'),'model':_0x511e('0x36'),'filter':{'field':_0x511e('0x37'),'value':[_0x511e('0x38')]}},{'name':_0x511e('0x39'),'field':_0x511e('0x18'),'foreignKey':_0x511e('0x35'),'model':_0x511e('0x36'),'filter':{'field':_0x511e('0x37'),'value':[_0x511e('0x3a')]}}];break;case _0x511e('0x3b'):_0x26618d['childModel']=_0x511e('0x3c');break;case'chanspies':_0x26618d['childModel']=_0x511e('0x3d');break;case'voiceprefixes':_0x26618d['childModel']=_0x511e('0x3e');break;case _0x511e('0x3f'):_0x26618d[_0x511e('0x11')]=_0x511e('0x40');break;case _0x511e('0x41'):_0x26618d[_0x511e('0x11')]=_0x511e('0x42');break;case _0x511e('0x43'):_0x26618d[_0x511e('0x11')]=_0x511e('0x44');break;case _0x511e('0x45'):_0x26618d[_0x511e('0x11')]=_0x511e('0x46');break;case _0x511e('0x47'):_0x26618d['childModel']='OpenchannelQueue';break;case _0x511e('0x48'):_0x26618d[_0x511e('0x11')]=_0x511e('0x49');break;case _0x511e('0x4a'):_0x26618d[_0x511e('0x11')]='SmsQueue';break;case _0x511e('0x4b'):_0x26618d[_0x511e('0x11')]=_0x511e('0x4c');break;case'whatsappqueues':_0x26618d['childModel']='WhatsappQueue';break;case _0x511e('0x4d'):_0x26618d[_0x511e('0x11')]=_0x511e('0x4e');break;case'teams':_0x26618d['childModel']='Team';break;case _0x511e('0x4f'):case _0x511e('0x50'):_0x26618d[_0x511e('0x11')]=_0x511e('0x36');if(_0x211b90){_0x26618d[_0x511e('0x16')]=[{'name':_0x511e('0x34')},{'name':_0x511e('0x39')}];}break;case _0x511e('0x51'):case _0x511e('0x52'):case _0x511e('0x53'):_0x26618d[_0x511e('0x11')]=_0x511e('0x2f');if(_0x211b90){_0x26618d[_0x511e('0x16')]=[{'name':_0x511e('0x54'),'filter':{'field':_0x511e('0x30'),'value':[_0x511e('0x55'),_0x511e('0x56')]},'ignore':!![]},{'name':_0x511e('0x2e')},{'name':_0x511e('0x57')}];}break;case _0x511e('0x58'):_0x26618d[_0x511e('0x11')]=_0x511e('0x59');break;case _0x511e('0x5a'):_0x26618d[_0x511e('0x11')]=_0x511e('0x5b');break;case _0x511e('0x5c'):_0x26618d[_0x511e('0x11')]=_0x511e('0x5d');break;case _0x511e('0x5e'):_0x26618d[_0x511e('0x11')]=_0x511e('0x5f');break;case'deskaccounts':_0x26618d[_0x511e('0x11')]='DeskAccount';break;case _0x511e('0x60'):_0x26618d[_0x511e('0x11')]=_0x511e('0x61');break;case'vtigeraccounts':_0x26618d[_0x511e('0x11')]=_0x511e('0x2f');break;case _0x511e('0x62'):_0x26618d['childModel']=_0x511e('0x63');break;case _0x511e('0x64'):_0x26618d['childModel']=_0x511e('0x65');break;case _0x511e('0x66'):_0x26618d[_0x511e('0x11')]=_0x511e('0x67');break;case'intervals':_0x26618d[_0x511e('0x11')]='Interval';break;case _0x511e('0x68'):_0x26618d[_0x511e('0x11')]=_0x511e('0x69');break;case'scheduler':_0x26618d[_0x511e('0x11')]='Schedule';break;case _0x511e('0x6a'):_0x26618d[_0x511e('0x11')]=_0x511e('0x6b');break;case _0x511e('0x6c'):_0x26618d[_0x511e('0x11')]='Tag';break;case _0x511e('0x6d'):_0x26618d[_0x511e('0x11')]=_0x511e('0x6e');break;case _0x511e('0x6f'):_0x26618d[_0x511e('0x11')]=_0x511e('0x70');break;case _0x511e('0x71'):_0x26618d[_0x511e('0x11')]='Trunk';break;case _0x511e('0x72'):_0x26618d[_0x511e('0x11')]='Variable';break;case _0x511e('0x73'):_0x26618d[_0x511e('0x11')]=_0x511e('0x74');break;case _0x511e('0x75'):_0x26618d[_0x511e('0x11')]=_0x511e('0xf');_0x26618d['parentSections']=[{'name':_0x511e('0x76'),'field':'id','foreignKey':_0x511e('0x77')}];break;case'metrics':_0x26618d[_0x511e('0x11')]='AnalyticMetric';break;}return _0x26618d;}function _0x22d48b(_0x4773f4,_0x59075b){var _0x58f1e4=_0x4773f4['charAt'](0x0)['toUpperCase']()+_0x4773f4[_0x511e('0x78')](0x1);var _0x49ddf0={'type':_0x30fb24['Sequelize'][_0x511e('0x79')][_0x511e('0x7a')],'raw':!![]};return new Promise(function(_0x4cbf27,_0x1f1afe){var _0x5a4581=squel[_0x511e('0x7b')]()['field']('ui.'+_0x58f1e4+'InteractionId','id')[_0x511e('0xb')](_0x511e('0x7c'))['from']('user_has_'+_0x4773f4+'_interactions','ui')['where'](_0x511e('0x7d'),_0x59075b['id']);return _0x30fb24['sequelize'][_0x511e('0x7e')](_0x5a4581['toString'](),_0x49ddf0)[_0x511e('0x7')](function(_0x14c2df){_0x59075b[_0x58f1e4+_0x511e('0x7f')]=_0x14c2df;_0x4cbf27(_0x14c2df);})[_0x511e('0xa')](function(_0x479cfb){_0x1f1afe(_0x479cfb);});});}return _0x2947e4[_0x511e('0x80')](_0x511e('0x81'),attributes,{'tableName':_0x511e('0x82'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2b493f){var _0x318a31={'raw':![],'where':{}};var _0x584c81={};var _0x4eaec0={'count':0x0,'rows':[]};var _0x45a7b2=_0x2b493f[_0x511e('0x7e')][_0x511e('0x83')];var _0x537df4=_0x2b493f[_0x511e('0x7e')][_0x511e('0x84')]||![];var _0x1f962a=_0x886b6(_0x45a7b2,_0x537df4);if(!_0x1f962a[_0x511e('0x11')])throw new Error(_0x511e('0x85')+_0x45a7b2+'\x27');var _0x135ecb=[{'name':_0x45a7b2}];if(!_['isEmpty'](_0x1f962a['parentSections']))_0x135ecb=_0x1f962a['parentSections'];var _0x86f362=[];for(var _0x5525ed=0x0;_0x5525ed<_0x135ecb[_0x511e('0x86')];_0x5525ed++){_0x86f362['push'](_0x30fb24[_0x511e('0x87')]['find']({'where':{'userProfileId':_0x2b493f[_0x511e('0x88')]['id'],'name':_0x135ecb[_0x5525ed][_0x511e('0x18')]},'raw':!![]}));}return Promise[_0x511e('0x89')](_0x86f362)[_0x511e('0x7')](function(_0x9afcc4){var _0x52f3d9=_[_0x511e('0x4')](_0x9afcc4,function(_0x5d1433){return _0x5d1433?_0x5d1433:undefined;});var _0x435b2a=_[_0x511e('0x4')](_0x135ecb,[_0x511e('0x8a'),!![]]);var _0x515644=_[_0x511e('0x8b')](_0x52f3d9)&&_[_0x511e('0x8b')](_0x435b2a)?null:_[_0x511e('0x8c')](_0x435b2a,_0x52f3d9);if(!_0x515644)return null;var _0x15f360=[];for(var _0x50b93d=0x0;_0x50b93d<_0x515644['length'];_0x50b93d++){var _0x2fe9de=_[_0x511e('0x8d')](_0x135ecb,function(_0x5b1ba8){return _0x515644[_0x50b93d]?_0x5b1ba8[_0x511e('0x18')]===_0x515644[_0x50b93d]['name']:null;});if(_0x2fe9de){if(_0x515644[_0x50b93d][_0x511e('0x8a')]){_0x15f360[_0x511e('0x8e')](_0x5cab33(_0x1f962a['childModel'],_0x515644[_0x50b93d]));}else{if(!_0x515644[_0x50b93d]['autoAssociation']){_0x15f360[_0x511e('0x8e')](_0x3b990b(_0x2fe9de,_0x515644[_0x50b93d],_0x1f962a[_0x511e('0x11')]));}else{if(_0x2fe9de[_0x511e('0xc')]){_0x15f360['push'](_0x1c6def(_0x2fe9de,_0x515644[_0x50b93d]));}}}}}return Promise[_0x511e('0x89')](_0x15f360);})[_0x511e('0x7')](function(_0x28dede){var _0x3de67f=_0x28dede;var _0x13b95a=null;if(_0x3de67f){_0x13b95a=_0x3de67f[_0x511e('0x86')]===0x1?_0x3de67f[0x0]:null;}if(!_0x13b95a&&!_0x3de67f)return _0x4eaec0;var _0x3df2d1=_0x30fb24[_0x1f962a['childModel']][_0x511e('0x8f')];_0x584c81[_0x511e('0xc')]=_['keys'](_0x3df2d1);_0x584c81['query']=_[_0x511e('0x90')](_0x2b493f[_0x511e('0x7e')]);_0x584c81['filters']=_[_0x511e('0x91')](_0x584c81['model'],_0x584c81[_0x511e('0x7e')]);_0x318a31['attributes']=_['intersection'](_0x584c81[_0x511e('0xc')],qs[_0x511e('0x92')](_0x2b493f[_0x511e('0x7e')][_0x511e('0x92')]));_0x318a31[_0x511e('0x93')]=_0x318a31['attributes']['length']?_0x318a31[_0x511e('0x93')]:_0x584c81[_0x511e('0xc')];if(!_0x2b493f[_0x511e('0x7e')]['hasOwnProperty'](_0x511e('0x94'))){_0x318a31[_0x511e('0x95')]=qs['limit'](_0x2b493f['query'][_0x511e('0x95')]);_0x318a31[_0x511e('0x96')]=qs[_0x511e('0x96')](_0x2b493f[_0x511e('0x7e')][_0x511e('0x96')]);}_0x318a31[_0x511e('0x97')]=qs['sort'](_0x2b493f[_0x511e('0x7e')][_0x511e('0x98')]);_0x318a31['where']=qs['filters'](_[_0x511e('0x99')](_0x2b493f['query'],_0x584c81[_0x511e('0x9a')]));if(_0x2b493f['query']['filter']){_0x318a31[_0x511e('0x9b')]=_[_0x511e('0x9c')](_0x318a31[_0x511e('0x9b')],{'$or':_[_0x511e('0x9')](_0x3df2d1,function(_0x3b497b){if(_0x3b497b[_0x511e('0x37')][_0x511e('0x9d')]!==_0x511e('0x9e')){var _0x325df2={};_0x325df2[_0x3b497b[_0x511e('0xb')]]={'$like':'%'+_0x2b493f[_0x511e('0x7e')][_0x511e('0x4')]+'%'};return _0x325df2;}})});}var _0x3b4712=[];var _0x2f35cc=null;var _0x34325f={};if(_0x13b95a){_0x2f35cc=_[_0x511e('0x8d')](_0x135ecb,['name',_0x13b95a[_0x511e('0x18')]]);if(_0x2f35cc[_0x511e('0xb')]){_0x34325f={};if(_0x1f962a[_0x511e('0x11')]===_0x511e('0xf')){_0x34325f[_0x2f35cc[_0x511e('0x9f')]]=_[_0x511e('0x9')](_0x13b95a[_0x511e('0x8')],'id');}else{_0x34325f[_0x2f35cc[_0x511e('0x9f')]]=_0x13b95a[_0x511e('0x8')];}_0x3b4712[_0x511e('0x8e')](_0x34325f);}else{_0x318a31[_0x511e('0x9b')]['id']=_0x13b95a['associatedResources'];}}else{for(var _0x200470=0x0;_0x200470<_0x3de67f[_0x511e('0x86')];_0x200470++){_0x2f35cc=_[_0x511e('0x8d')](_0x135ecb,[_0x511e('0x18'),_0x3de67f[_0x200470]['name']]);if(_0x2f35cc[_0x511e('0xb')]){_0x34325f={};_0x34325f[_0x2f35cc[_0x511e('0x9f')]]=_0x3de67f[_0x200470][_0x511e('0x8')];_0x3b4712[_0x511e('0x8e')](_0x34325f);}else{if(!_0x318a31[_0x511e('0x9b')]['id'])_0x318a31[_0x511e('0x9b')]['id']=[];_0x3de67f[_0x200470][_0x511e('0x8')][_0x511e('0xa0')](function(_0x25e8cb){_0x318a31[_0x511e('0x9b')]['id']['push'](_0x25e8cb);});}}}if(!_[_0x511e('0x8b')](_0x3b4712)){_0x318a31[_0x511e('0x9b')]=_[_0x511e('0x9c')](_0x318a31[_0x511e('0x9b')],{'$and':{'$or':_0x3b4712}});}_0x318a31=_[_0x511e('0x9c')]({},_0x318a31,_0x2b493f[_0x511e('0xa1')]);if(_0x13b95a&&!_0x13b95a[_0x511e('0xa2')]&&_0x1f962a['childModel']==='AnalyticExtractedReport'){if(_0x2b493f[_0x511e('0x7e')][_0x511e('0xa3')]){_0x318a31[_0x511e('0xa4')]=[{'all':!![]}];}return _0x30fb24[_0x1f962a[_0x511e('0x11')]][_0x511e('0x6')](_0x318a31)[_0x511e('0x7')](function(_0x122d49){var _0x9e256b=[];_0x122d49[_0x511e('0xa0')](function(_0x1d39bb){var _0x55e8cc;switch(_0x1d39bb[_0x511e('0xa5')]){case _0x511e('0xa6'):_0x55e8cc=_[_0x511e('0x8d')](_0x13b95a[_0x511e('0x8')],function(_0x3d7e04){return _0x3d7e04['id']===_0x1d39bb['reportId']&&_0x3d7e04['type']===_0x511e('0xa7');});break;case _0x511e('0xa8'):_0x55e8cc=_[_0x511e('0x8d')](_0x13b95a[_0x511e('0x8')],function(_0x53f348){return _0x53f348['id']===_0x1d39bb[_0x511e('0x77')]&&_0x53f348[_0x511e('0x37')]==='CustomReports';});break;}if(_0x55e8cc)_0x9e256b[_0x511e('0x8e')](_0x1d39bb);});_0x4eaec0['count']=_0x9e256b[_0x511e('0x86')];_0x4eaec0[_0x511e('0xa9')]=_0x9e256b;return _0x4eaec0;});}else{return _0x30fb24[_0x1f962a[_0x511e('0x11')]][_0x511e('0xaa')]({'where':_0x318a31[_0x511e('0x9b')]})[_0x511e('0x7')](function(_0x9b2e83){_0x4eaec0[_0x511e('0xaa')]=_0x9b2e83;if(_0x2b493f[_0x511e('0x7e')][_0x511e('0xa3')]){if(_0x1f962a[_0x511e('0x11')]===_0x511e('0x1c')){_0x318a31[_0x511e('0xa4')]=[{'model':_0x30fb24[_0x511e('0xab')],'as':_0x511e('0xac'),'attributes':['id',_0x511e('0x18'),_0x511e('0xad')],'required':_0x2b493f[_0x511e('0x7e')]['tag']?!![]:![]},{'model':_0x30fb24[_0x511e('0xab')],'as':_0x511e('0xae'),'attributes':['id',_0x511e('0x18'),_0x511e('0xad')],'through':_0x2b493f[_0x511e('0x7e')]['tag']?{'attributes':[],'where':{'TagId':_0x2b493f[_0x511e('0x7e')][_0x511e('0xaf')]||undefined}}:{},'required':_0x2b493f[_0x511e('0x7e')]['tag']?!![]:![]}];}else{_0x318a31[_0x511e('0xa4')]=[{'all':!![]}];}}return _0x30fb24[_0x1f962a[_0x511e('0x11')]][_0x511e('0x6')](_0x318a31);})[_0x511e('0x7')](function(_0x513c38){_0x4eaec0['rows']=_0x513c38;if(_0x45a7b2==='Agents'&&_0x2b493f[_0x511e('0x7e')][_0x511e('0xb0')]==='true'){var _0x137568=[];for(var _0x49e3c7=0x0;_0x49e3c7<_0x4eaec0[_0x511e('0xa9')]['length'];_0x49e3c7++){_0x137568[_0x511e('0x8e')](_0x22d48b(_0x511e('0xb1'),_0x4eaec0['rows'][_0x49e3c7][_0x511e('0xb2')]));_0x137568[_0x511e('0x8e')](_0x22d48b(_0x511e('0xb3'),_0x4eaec0[_0x511e('0xa9')][_0x49e3c7][_0x511e('0xb2')]));_0x137568['push'](_0x22d48b('fax',_0x4eaec0['rows'][_0x49e3c7]['dataValues']));_0x137568['push'](_0x22d48b(_0x511e('0xb4'),_0x4eaec0[_0x511e('0xa9')][_0x49e3c7][_0x511e('0xb2')]));_0x137568['push'](_0x22d48b(_0x511e('0xb5'),_0x4eaec0[_0x511e('0xa9')][_0x49e3c7][_0x511e('0xb2')]));_0x137568[_0x511e('0x8e')](_0x22d48b(_0x511e('0xb6'),_0x4eaec0[_0x511e('0xa9')][_0x49e3c7][_0x511e('0xb2')]));}return Promise['all'](_0x137568)[_0x511e('0x7')](function(){return _0x4eaec0;});}return _0x4eaec0;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index f3082fa..d0f4520 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 _0x8f9d=['request','then','info','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register'];(function(_0xa7010f,_0x734798){var _0x3f4f92=function(_0x20fc42){while(--_0x20fc42){_0xa7010f['push'](_0xa7010f['shift']());}};_0x3f4f92(++_0x734798);}(_0x8f9d,0x93));var _0xd8f9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8f9d[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xd8f9('0x0'));var util=require('util');var moment=require(_0xd8f9('0x1'));var BPromise=require('bluebird');var rs=require(_0xd8f9('0x2'));var fs=require('fs');var Redis=require(_0xd8f9('0x3'));var db=require(_0xd8f9('0x4'))['db'];var utils=require(_0xd8f9('0x5'));var logger=require(_0xd8f9('0x6'))(_0xd8f9('0x7'));var config=require(_0xd8f9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd8f9('0x9')][_0xd8f9('0xa')]({'port':0x232a});config[_0xd8f9('0xb')]=_[_0xd8f9('0xc')](config[_0xd8f9('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd8f9('0xd'))(new Redis(config[_0xd8f9('0xb')]));require('./userProfile.socket')[_0xd8f9('0xe')](socket);function respondWithRpcPromise(_0x4ac0ea,_0x5caee9,_0x421aca){return new BPromise(function(_0x3d0bea,_0x32b880){return client[_0xd8f9('0xf')](_0x4ac0ea,_0x421aca)[_0xd8f9('0x10')](function(_0x3a1db8){logger[_0xd8f9('0x11')]('UserProfile,\x20%s,\x20%s',_0x5caee9,_0xd8f9('0x12'));logger['debug'](_0xd8f9('0x13'),_0x5caee9,_0xd8f9('0x12'),JSON[_0xd8f9('0x14')](_0x3a1db8));if(_0x3a1db8['error']){if(_0x3a1db8[_0xd8f9('0x15')][_0xd8f9('0x16')]===0x1f4){logger[_0xd8f9('0x15')](_0xd8f9('0x17'),_0x5caee9,_0x3a1db8['error'][_0xd8f9('0x18')]);return _0x32b880(_0x3a1db8[_0xd8f9('0x15')][_0xd8f9('0x18')]);}logger[_0xd8f9('0x15')](_0xd8f9('0x17'),_0x5caee9,_0x3a1db8[_0xd8f9('0x15')][_0xd8f9('0x18')]);return _0x3d0bea(_0x3a1db8['error']['message']);}else{logger[_0xd8f9('0x11')](_0xd8f9('0x17'),_0x5caee9,'request\x20sent');_0x3d0bea(_0x3a1db8[_0xd8f9('0x19')]['message']);}})[_0xd8f9('0x1a')](function(_0x49f2e7){logger['error']('UserProfile,\x20%s,\x20%s',_0x5caee9,_0x49f2e7);_0x32b880(_0x49f2e7);});});} \ No newline at end of file +var _0x9ab8=['defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis'];(function(_0x8a7e38,_0x473a5d){var _0x228609=function(_0x5dcb5c){while(--_0x5dcb5c){_0x8a7e38['push'](_0x8a7e38['shift']());}};_0x228609(++_0x473a5d);}(_0x9ab8,0x81));var _0x89ab=function(_0x1af2bc,_0x324a8c){_0x1af2bc=_0x1af2bc-0x0;var _0x4fb632=_0x9ab8[_0x1af2bc];return _0x4fb632;};'use strict';var _=require(_0x89ab('0x0'));var util=require(_0x89ab('0x1'));var moment=require(_0x89ab('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89ab('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x89ab('0x4'));var logger=require(_0x89ab('0x5'))('rpc');var config=require(_0x89ab('0x6'));var jayson=require(_0x89ab('0x7'));var client=jayson[_0x89ab('0x8')][_0x89ab('0x9')]({'port':0x232a});config[_0x89ab('0xa')]=_[_0x89ab('0xb')](config[_0x89ab('0xa')],{'host':_0x89ab('0xc'),'port':0x18eb});var socket=require(_0x89ab('0xd'))(new Redis(config[_0x89ab('0xa')]));require(_0x89ab('0xe'))[_0x89ab('0xf')](socket);function respondWithRpcPromise(_0x4c1dcc,_0x539391,_0x4f0d68){return new BPromise(function(_0x551f06,_0x4ef4a8){return client[_0x89ab('0x10')](_0x4c1dcc,_0x4f0d68)[_0x89ab('0x11')](function(_0x6b8ccb){logger[_0x89ab('0x12')](_0x89ab('0x13'),_0x539391,_0x89ab('0x14'));logger[_0x89ab('0x15')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x539391,_0x89ab('0x14'),JSON[_0x89ab('0x16')](_0x6b8ccb));if(_0x6b8ccb[_0x89ab('0x17')]){if(_0x6b8ccb[_0x89ab('0x17')][_0x89ab('0x18')]===0x1f4){logger['error'](_0x89ab('0x13'),_0x539391,_0x6b8ccb[_0x89ab('0x17')]['message']);return _0x4ef4a8(_0x6b8ccb['error']['message']);}logger['error']('UserProfile,\x20%s,\x20%s',_0x539391,_0x6b8ccb['error'][_0x89ab('0x19')]);return _0x551f06(_0x6b8ccb[_0x89ab('0x17')][_0x89ab('0x19')]);}else{logger[_0x89ab('0x12')](_0x89ab('0x13'),_0x539391,_0x89ab('0x14'));_0x551f06(_0x6b8ccb[_0x89ab('0x1a')][_0x89ab('0x19')]);}})[_0x89ab('0x1b')](function(_0x5736f7){logger[_0x89ab('0x17')](_0x89ab('0x13'),_0x539391,_0x5736f7);_0x4ef4a8(_0x5736f7);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index dea11d9..b0f5c82 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 _0xd628=['remove','update','emit','register','length','save'];(function(_0x4de586,_0x183427){var _0x46baf5=function(_0x1157f0){while(--_0x1157f0){_0x4de586['push'](_0x4de586['shift']());}};_0x46baf5(++_0x183427);}(_0xd628,0x1bb));var _0x8d62=function(_0x4542d2,_0x52d61e){_0x4542d2=_0x4542d2-0x0;var _0x1efe2b=_0xd628[_0x4542d2];return _0x1efe2b;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x8d62('0x0'),_0x8d62('0x1'),_0x8d62('0x2')];function createListener(_0x39a3aa,_0x3e6e7d){return function(_0x31d678){_0x3e6e7d[_0x8d62('0x3')](_0x39a3aa,_0x31d678);};}function removeListener(_0x183754,_0x4cf56e){return function(){UserProfileEvents['removeListener'](_0x183754,_0x4cf56e);};}exports[_0x8d62('0x4')]=function(_0x50879a){for(var _0x58c692=0x0,_0x1c6020=events[_0x8d62('0x5')];_0x58c692<_0x1c6020;_0x58c692++){var _0x1fa6af=events[_0x58c692];var _0xc82271=createListener('userProfile:'+_0x1fa6af,_0x50879a);UserProfileEvents['on'](_0x1fa6af,_0xc82271);}}; \ No newline at end of file +var _0x7d9f=['userProfile:','./userProfile.events','save','remove','update','emit','removeListener','register'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7d9f,0x1d1));var _0xf7d9=function(_0x50bca7,_0xb23979){_0x50bca7=_0x50bca7-0x0;var _0x40e5ee=_0x7d9f[_0x50bca7];return _0x40e5ee;};'use strict';var UserProfileEvents=require(_0xf7d9('0x0'));var events=[_0xf7d9('0x1'),_0xf7d9('0x2'),_0xf7d9('0x3')];function createListener(_0x1ace52,_0x4595cf){return function(_0x1ac884){_0x4595cf[_0xf7d9('0x4')](_0x1ace52,_0x1ac884);};}function removeListener(_0x1b88b6,_0x79b81){return function(){UserProfileEvents[_0xf7d9('0x5')](_0x1b88b6,_0x79b81);};}exports[_0xf7d9('0x6')]=function(_0x166e22){for(var _0x2ecb72=0x0,_0x210582=events['length'];_0x2ecb72<_0x210582;_0x2ecb72++){var _0x10fb75=events[_0x2ecb72];var _0x31bf88=createListener(_0xf7d9('0x7')+_0x10fb75,_0x166e22);UserProfileEvents['on'](_0x10fb75,_0x31bf88);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 3216ec3..19de34b 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 _0x6efe=['../../components/interaction/service','../../config/environment','/describe','describe','get','show','post','isAuthenticated','create','/:id','update','delete','destroy','util','connect-timeout','express','Router'];(function(_0x1f866b,_0x49068d){var _0x6458c0=function(_0x9fb752){while(--_0x9fb752){_0x1f866b['push'](_0x1f866b['shift']());}};_0x6458c0(++_0x49068d);}(_0x6efe,0x1a5));var _0xe6ef=function(_0x4972e1,_0x4ce3a1){_0x4972e1=_0x4972e1-0x0;var _0x21d7ca=_0x6efe[_0x4972e1];return _0x21d7ca;};'use strict';var multer=require('multer');var util=require(_0xe6ef('0x0'));var path=require('path');var timeout=require(_0xe6ef('0x1'));var express=require(_0xe6ef('0x2'));var router=express[_0xe6ef('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe6ef('0x4'));var config=require(_0xe6ef('0x5'));var controller=require('./userProfileResource.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe6ef('0x6'),auth['isAuthenticated'](),controller[_0xe6ef('0x7')]);router[_0xe6ef('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xe6ef('0x9')]);router[_0xe6ef('0xa')]('/',auth[_0xe6ef('0xb')](),controller[_0xe6ef('0xc')]);router['put'](_0xe6ef('0xd'),auth[_0xe6ef('0xb')](),controller[_0xe6ef('0xe')]);router[_0xe6ef('0xf')]('/:id',auth[_0xe6ef('0xb')](),controller[_0xe6ef('0x10')]);module['exports']=router; \ No newline at end of file +var _0x9dce=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update'];(function(_0x31c74a,_0x1522e4){var _0x260cde=function(_0x3e627f){while(--_0x3e627f){_0x31c74a['push'](_0x31c74a['shift']());}};_0x260cde(++_0x1522e4);}(_0x9dce,0x153));var _0xe9dc=function(_0x1411ab,_0x52545b){_0x1411ab=_0x1411ab-0x0;var _0x3516f3=_0x9dce[_0x1411ab];return _0x3516f3;};'use strict';var multer=require(_0xe9dc('0x0'));var util=require(_0xe9dc('0x1'));var path=require(_0xe9dc('0x2'));var timeout=require(_0xe9dc('0x3'));var express=require(_0xe9dc('0x4'));var router=express[_0xe9dc('0x5')]();var fs_extra=require(_0xe9dc('0x6'));var auth=require(_0xe9dc('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe9dc('0x8'));var controller=require(_0xe9dc('0x9'));router[_0xe9dc('0xa')]('/',auth[_0xe9dc('0xb')](),controller[_0xe9dc('0xc')]);router['get'](_0xe9dc('0xd'),auth[_0xe9dc('0xb')](),controller[_0xe9dc('0xe')]);router[_0xe9dc('0xa')](_0xe9dc('0xf'),auth[_0xe9dc('0xb')](),controller[_0xe9dc('0x10')]);router[_0xe9dc('0x11')]('/',auth[_0xe9dc('0xb')](),controller[_0xe9dc('0x12')]);router[_0xe9dc('0x13')](_0xe9dc('0xf'),auth[_0xe9dc('0xb')](),controller[_0xe9dc('0x14')]);router[_0xe9dc('0x15')]('/:id',auth[_0xe9dc('0xb')](),controller[_0xe9dc('0x16')]);module[_0xe9dc('0x17')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 9227e30..7d76e22 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 _0xe400=['STRING','INTEGER','sequelize'];(function(_0xeb31d6,_0x36dda8){var _0x2f7189=function(_0x5dd436){while(--_0x5dd436){_0xeb31d6['push'](_0xeb31d6['shift']());}};_0x2f7189(++_0x36dda8);}(_0xe400,0x6e));var _0x0e40=function(_0x1a36de,_0x35b4cf){_0x1a36de=_0x1a36de-0x0;var _0x567c24=_0xe400[_0x1a36de];return _0x567c24;};'use strict';var Sequelize=require(_0x0e40('0x0'));module['exports']={'name':{'type':Sequelize[_0x0e40('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x0e40('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xe174=['sequelize','STRING','INTEGER'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0xe174,0x162));var _0x4e17=function(_0x3a8b69,_0x5c9fe2){_0x3a8b69=_0x3a8b69-0x0;var _0x17897c=_0xe174[_0x3a8b69];return _0x17897c;};'use strict';var Sequelize=require(_0x4e17('0x0'));module['exports']={'name':{'type':Sequelize[_0x4e17('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x4e17('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 1be3e49..5aab9cf 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 _0xba34=['../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','UserProfileResource','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x3f6b1b,_0x58d3d6){var _0x4a3d2b=function(_0x5648f0){while(--_0x5648f0){_0x3f6b1b['push'](_0x3f6b1b['shift']());}};_0x4a3d2b(++_0x58d3d6);}(_0xba34,0x119));var _0x4ba3=function(_0x47400d,_0x5d54c9){_0x47400d=_0x47400d-0x0;var _0x2282aa=_0xba34[_0x47400d];return _0x2282aa;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1073d4,_0x52f55c){_0x52f55c=_0x52f55c||0xcc;return function(_0x256f02){if(_0x256f02){return _0x1073d4[_0x4ba3('0x19')](_0x52f55c);}return _0x1073d4[_0x4ba3('0x1a')](_0x52f55c)[_0x4ba3('0x1b')]();};}function respondWithResult(_0x2bc796,_0x3d2ace){_0x3d2ace=_0x3d2ace||0xc8;return function(_0x3a74f7){if(_0x3a74f7){return _0x2bc796[_0x4ba3('0x1a')](_0x3d2ace)[_0x4ba3('0x1c')](_0x3a74f7);}};}function respondWithFilteredResult(_0x401366,_0x36638b){return function(_0x301359){if(_0x301359){var _0x29a9d1=typeof _0x36638b[_0x4ba3('0x1d')]===_0x4ba3('0x1e')&&typeof _0x36638b[_0x4ba3('0x1f')]==='undefined';var _0x382fd0=_0x301359[_0x4ba3('0x20')];var _0x5ff7ce=_0x29a9d1?0x0:_0x36638b[_0x4ba3('0x1d')];var _0x556290=_0x29a9d1?_0x301359[_0x4ba3('0x20')]:_0x36638b[_0x4ba3('0x1d')]+_0x36638b[_0x4ba3('0x1f')];var _0x1e2ce5;if(_0x556290>=_0x382fd0){_0x556290=_0x382fd0;_0x1e2ce5=0xc8;}else{_0x1e2ce5=0xce;}_0x401366[_0x4ba3('0x1a')](_0x1e2ce5);return _0x401366[_0x4ba3('0x21')]('Content-Range',_0x5ff7ce+'-'+_0x556290+'/'+_0x382fd0)['json'](_0x301359);}return null;};}function patchUpdates(_0x2278b0){return function(_0x579d9f){try{jsonpatch[_0x4ba3('0x22')](_0x579d9f,_0x2278b0,!![]);}catch(_0x163967){return BPromise[_0x4ba3('0x23')](_0x163967);}return _0x579d9f[_0x4ba3('0x24')]();};}function saveUpdates(_0x46f1f5,_0x278a23){return function(_0x4a0823){if(_0x4a0823){return _0x4a0823[_0x4ba3('0x25')](_0x46f1f5)[_0x4ba3('0x26')](function(_0x5c28f9){return _0x5c28f9;});}return null;};}function removeEntity(_0x28bb3d,_0x4ffe39){return function(_0x1ae4de){if(_0x1ae4de){return _0x1ae4de[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){_0x28bb3d[_0x4ba3('0x1a')](0xcc)[_0x4ba3('0x1b')]();});}};}function handleEntityNotFound(_0xe29a49,_0x159596){return function(_0xe1f7d2){if(!_0xe1f7d2){_0xe29a49[_0x4ba3('0x19')](0x194);}return _0xe1f7d2;};}function handleError(_0x2e67a0,_0x50c729){_0x50c729=_0x50c729||0x1f4;return function(_0x252f37){logger[_0x4ba3('0x28')](_0x252f37[_0x4ba3('0x29')]);if(_0x252f37['name']){delete _0x252f37[_0x4ba3('0x2a')];}_0x2e67a0[_0x4ba3('0x1a')](_0x50c729)[_0x4ba3('0x2b')](_0x252f37);};}exports['index']=function(_0x10cae6,_0x843276){var _0x34ecb4={},_0x22394d={},_0x4a339e={'count':0x0,'rows':[]};var _0x590108=_[_0x4ba3('0x2c')](db[_0x4ba3('0x2d')][_0x4ba3('0x2e')],function(_0x19f039){return{'name':_0x19f039[_0x4ba3('0x2f')],'type':_0x19f039[_0x4ba3('0x30')]['key']};});_0x22394d[_0x4ba3('0x31')]=_[_0x4ba3('0x2c')](_0x590108,_0x4ba3('0x2a'));_0x22394d[_0x4ba3('0x32')]=_[_0x4ba3('0x33')](_0x10cae6[_0x4ba3('0x32')]);_0x22394d[_0x4ba3('0x34')]=_[_0x4ba3('0x35')](_0x22394d[_0x4ba3('0x31')],_0x22394d[_0x4ba3('0x32')]);_0x34ecb4['attributes']=_['intersection'](_0x22394d['model'],qs[_0x4ba3('0x36')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x36')]));_0x34ecb4[_0x4ba3('0x37')]=_0x34ecb4[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x34ecb4[_0x4ba3('0x37')]:_0x22394d[_0x4ba3('0x31')];if(!_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x39')](_0x4ba3('0x3a'))){_0x34ecb4[_0x4ba3('0x1f')]=qs['limit'](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x1f')]);_0x34ecb4[_0x4ba3('0x1d')]=qs['offset'](_0x10cae6[_0x4ba3('0x32')]['offset']);}_0x34ecb4[_0x4ba3('0x3b')]=qs[_0x4ba3('0x3c')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x3c')]);_0x34ecb4[_0x4ba3('0x3d')]=qs[_0x4ba3('0x34')](_['pick'](_0x10cae6[_0x4ba3('0x32')],_0x22394d[_0x4ba3('0x34')]),_0x590108);if(_0x10cae6[_0x4ba3('0x32')]['filter']){_0x34ecb4[_0x4ba3('0x3d')]=_[_0x4ba3('0x3e')](_0x34ecb4['where'],{'$or':_[_0x4ba3('0x2c')](_0x590108,function(_0x503777){if(_0x503777['type']!==_0x4ba3('0x3f')){var _0x1acc74={};_0x1acc74[_0x503777[_0x4ba3('0x2a')]]={'$like':'%'+_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x40')]+'%'};return _0x1acc74;}})});}_0x34ecb4=_['merge']({},_0x34ecb4,_0x10cae6[_0x4ba3('0x41')]);var _0x10e4b5={'where':_0x34ecb4[_0x4ba3('0x3d')]};return db[_0x4ba3('0x2d')][_0x4ba3('0x20')](_0x10e4b5)[_0x4ba3('0x26')](function(_0x349af4){_0x4a339e[_0x4ba3('0x20')]=_0x349af4;if(_0x10cae6['query'][_0x4ba3('0x42')]){_0x34ecb4[_0x4ba3('0x43')]=[{'all':!![]}];}return db[_0x4ba3('0x2d')][_0x4ba3('0x44')](_0x34ecb4);})[_0x4ba3('0x26')](function(_0x25b2c9){_0x4a339e[_0x4ba3('0x45')]=_0x25b2c9;return _0x4a339e;})[_0x4ba3('0x26')](respondWithFilteredResult(_0x843276,_0x34ecb4))[_0x4ba3('0x46')](handleError(_0x843276,null));};exports[_0x4ba3('0x47')]=function(_0x3b9a0a,_0x1c58d2){var _0x1d031b={'raw':![],'where':{'id':_0x3b9a0a['params']['id']}},_0x28b649={};_0x28b649['model']=_['keys'](db['UserProfileResource']['rawAttributes']);_0x28b649[_0x4ba3('0x32')]=_['keys'](_0x3b9a0a[_0x4ba3('0x32')]);_0x28b649['filters']=_[_0x4ba3('0x35')](_0x28b649[_0x4ba3('0x31')],_0x28b649[_0x4ba3('0x32')]);_0x1d031b[_0x4ba3('0x37')]=_[_0x4ba3('0x35')](_0x28b649['model'],qs[_0x4ba3('0x36')](_0x3b9a0a['query'][_0x4ba3('0x36')]));_0x1d031b['attributes']=_0x1d031b[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x1d031b[_0x4ba3('0x37')]:_0x28b649[_0x4ba3('0x31')];if(_0x3b9a0a[_0x4ba3('0x32')][_0x4ba3('0x42')]){_0x1d031b[_0x4ba3('0x43')]=[{'all':!![]}];}_0x1d031b=_['merge']({},_0x1d031b,_0x3b9a0a[_0x4ba3('0x41')]);return db[_0x4ba3('0x2d')][_0x4ba3('0x48')](_0x1d031b)[_0x4ba3('0x26')](handleEntityNotFound(_0x1c58d2,null))[_0x4ba3('0x26')](respondWithResult(_0x1c58d2,null))['catch'](handleError(_0x1c58d2,null));};exports['create']=function(_0xa4bbb2,_0x1fe115){return db[_0x4ba3('0x2d')]['create'](_0xa4bbb2[_0x4ba3('0x49')],{})[_0x4ba3('0x26')](respondWithResult(_0x1fe115,0xc9))[_0x4ba3('0x46')](handleError(_0x1fe115,null));};exports['update']=function(_0x47f588,_0x34dc04){if(_0x47f588['body']['id']){delete _0x47f588[_0x4ba3('0x49')]['id'];}return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x47f588[_0x4ba3('0x4a')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x34dc04,null))[_0x4ba3('0x26')](saveUpdates(_0x47f588['body'],null))[_0x4ba3('0x26')](respondWithResult(_0x34dc04,null))[_0x4ba3('0x46')](handleError(_0x34dc04,null));};exports['destroy']=function(_0x325475,_0x12ae6f){return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x325475[_0x4ba3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12ae6f,null))[_0x4ba3('0x26')](removeEntity(_0x12ae6f,null))[_0x4ba3('0x46')](handleError(_0x12ae6f,null));};exports['describe']=function(_0x43f820,_0x19d70f){return db[_0x4ba3('0x2d')][_0x4ba3('0x4b')]()[_0x4ba3('0x26')](respondWithResult(_0x19d70f,null))[_0x4ba3('0x46')](handleError(_0x19d70f,null));}; \ No newline at end of file +var _0x9f0e=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','end','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f0e,0x116));var _0xe9f0=function(_0x4d5d15,_0x1c2a15){_0x4d5d15=_0x4d5d15-0x0;var _0x2a22f2=_0x9f0e[_0x4d5d15];return _0x2a22f2;};'use strict';var emlformat=require(_0xe9f0('0x0'));var rimraf=require(_0xe9f0('0x1'));var zipdir=require(_0xe9f0('0x2'));var jsonpatch=require(_0xe9f0('0x3'));var rp=require(_0xe9f0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9f0('0x5'));var util=require(_0xe9f0('0x6'));var path=require(_0xe9f0('0x7'));var sox=require(_0xe9f0('0x8'));var csv=require(_0xe9f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0x9'));var querystring=require(_0xe9f0('0xe'));var Papa=require(_0xe9f0('0xf'));var Redis=require(_0xe9f0('0x10'));var authService=require(_0xe9f0('0x11'));var qs=require(_0xe9f0('0x12'));var as=require(_0xe9f0('0x13'));var hardwareService=require(_0xe9f0('0x14'));var logger=require('../../config/logger')(_0xe9f0('0x15'));var utils=require(_0xe9f0('0x16'));var config=require(_0xe9f0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9f0('0x18'))['db'];function respondWithStatusCode(_0x586763,_0x367545){_0x367545=_0x367545||0xcc;return function(_0xd82420){if(_0xd82420){return _0x586763[_0xe9f0('0x19')](_0x367545);}return _0x586763[_0xe9f0('0x1a')](_0x367545)['end']();};}function respondWithResult(_0x2cf75d,_0x5a10c6){_0x5a10c6=_0x5a10c6||0xc8;return function(_0x1e3ba8){if(_0x1e3ba8){return _0x2cf75d[_0xe9f0('0x1a')](_0x5a10c6)[_0xe9f0('0x1b')](_0x1e3ba8);}};}function respondWithFilteredResult(_0x59320d,_0x28bfac){return function(_0x33e9e4){if(_0x33e9e4){var _0x2e68ef=typeof _0x28bfac['offset']===_0xe9f0('0x1c')&&typeof _0x28bfac[_0xe9f0('0x1d')]===_0xe9f0('0x1c');var _0xd71ac8=_0x33e9e4[_0xe9f0('0x1e')];var _0x2ab12b=_0x2e68ef?0x0:_0x28bfac[_0xe9f0('0x1f')];var _0x59bf5a=_0x2e68ef?_0x33e9e4[_0xe9f0('0x1e')]:_0x28bfac[_0xe9f0('0x1f')]+_0x28bfac[_0xe9f0('0x1d')];var _0x5c4182;if(_0x59bf5a>=_0xd71ac8){_0x59bf5a=_0xd71ac8;_0x5c4182=0xc8;}else{_0x5c4182=0xce;}_0x59320d[_0xe9f0('0x1a')](_0x5c4182);return _0x59320d[_0xe9f0('0x20')](_0xe9f0('0x21'),_0x2ab12b+'-'+_0x59bf5a+'/'+_0xd71ac8)[_0xe9f0('0x1b')](_0x33e9e4);}return null;};}function patchUpdates(_0x5ba788){return function(_0x33f143){try{jsonpatch[_0xe9f0('0x22')](_0x33f143,_0x5ba788,!![]);}catch(_0x583687){return BPromise['reject'](_0x583687);}return _0x33f143['save']();};}function saveUpdates(_0x12fe9f,_0xa1ddc){return function(_0x1211ae){if(_0x1211ae){return _0x1211ae[_0xe9f0('0x23')](_0x12fe9f)[_0xe9f0('0x24')](function(_0x4a5c27){return _0x4a5c27;});}return null;};}function removeEntity(_0x229fe0,_0x38b7ee){return function(_0x437d43){if(_0x437d43){return _0x437d43[_0xe9f0('0x25')]()[_0xe9f0('0x24')](function(){_0x229fe0[_0xe9f0('0x1a')](0xcc)[_0xe9f0('0x26')]();});}};}function handleEntityNotFound(_0x1321bb,_0x3c4ba9){return function(_0x3fce54){if(!_0x3fce54){_0x1321bb['sendStatus'](0x194);}return _0x3fce54;};}function handleError(_0x371095,_0x27541f){_0x27541f=_0x27541f||0x1f4;return function(_0x2ddfba){logger[_0xe9f0('0x27')](_0x2ddfba['stack']);if(_0x2ddfba[_0xe9f0('0x28')]){delete _0x2ddfba[_0xe9f0('0x28')];}_0x371095[_0xe9f0('0x1a')](_0x27541f)[_0xe9f0('0x29')](_0x2ddfba);};}exports[_0xe9f0('0x2a')]=function(_0x5457f6,_0x130f96){var _0xdc16bc={},_0x44fb5b={},_0xab3d81={'count':0x0,'rows':[]};var _0xa27c84=_[_0xe9f0('0x2b')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')],function(_0x2b6503){return{'name':_0x2b6503[_0xe9f0('0x2e')],'type':_0x2b6503[_0xe9f0('0x2f')][_0xe9f0('0x30')]};});_0x44fb5b[_0xe9f0('0x31')]=_[_0xe9f0('0x2b')](_0xa27c84,_0xe9f0('0x28'));_0x44fb5b[_0xe9f0('0x32')]=_[_0xe9f0('0x33')](_0x5457f6[_0xe9f0('0x32')]);_0x44fb5b[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x44fb5b[_0xe9f0('0x31')],_0x44fb5b[_0xe9f0('0x32')]);_0xdc16bc[_0xe9f0('0x36')]=_[_0xe9f0('0x35')](_0x44fb5b['model'],qs['fields'](_0x5457f6['query'][_0xe9f0('0x37')]));_0xdc16bc['attributes']=_0xdc16bc[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0xdc16bc['attributes']:_0x44fb5b[_0xe9f0('0x31')];if(!_0x5457f6['query']['hasOwnProperty']('nolimit')){_0xdc16bc[_0xe9f0('0x1d')]=qs[_0xe9f0('0x1d')](_0x5457f6['query'][_0xe9f0('0x1d')]);_0xdc16bc[_0xe9f0('0x1f')]=qs[_0xe9f0('0x1f')](_0x5457f6['query']['offset']);}_0xdc16bc[_0xe9f0('0x39')]=qs[_0xe9f0('0x3a')](_0x5457f6[_0xe9f0('0x32')]['sort']);_0xdc16bc[_0xe9f0('0x3b')]=qs[_0xe9f0('0x34')](_[_0xe9f0('0x3c')](_0x5457f6[_0xe9f0('0x32')],_0x44fb5b[_0xe9f0('0x34')]),_0xa27c84);if(_0x5457f6['query'][_0xe9f0('0x3d')]){_0xdc16bc[_0xe9f0('0x3b')]=_[_0xe9f0('0x3e')](_0xdc16bc['where'],{'$or':_[_0xe9f0('0x2b')](_0xa27c84,function(_0xbec11f){if(_0xbec11f['type']!==_0xe9f0('0x3f')){var _0x5154c3={};_0x5154c3[_0xbec11f[_0xe9f0('0x28')]]={'$like':'%'+_0x5457f6['query']['filter']+'%'};return _0x5154c3;}})});}_0xdc16bc=_['merge']({},_0xdc16bc,_0x5457f6['options']);var _0x5165f7={'where':_0xdc16bc[_0xe9f0('0x3b')]};return db[_0xe9f0('0x2c')][_0xe9f0('0x1e')](_0x5165f7)[_0xe9f0('0x24')](function(_0x2560c6){_0xab3d81[_0xe9f0('0x1e')]=_0x2560c6;if(_0x5457f6[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0xdc16bc[_0xe9f0('0x41')]=[{'all':!![]}];}return db['UserProfileResource'][_0xe9f0('0x42')](_0xdc16bc);})[_0xe9f0('0x24')](function(_0x36b00a){_0xab3d81['rows']=_0x36b00a;return _0xab3d81;})['then'](respondWithFilteredResult(_0x130f96,_0xdc16bc))[_0xe9f0('0x43')](handleError(_0x130f96,null));};exports['show']=function(_0x297689,_0x52613a){var _0x314f0e={'raw':![],'where':{'id':_0x297689['params']['id']}},_0x42d9d2={};_0x42d9d2[_0xe9f0('0x31')]=_[_0xe9f0('0x33')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')]);_0x42d9d2[_0xe9f0('0x32')]=_['keys'](_0x297689[_0xe9f0('0x32')]);_0x42d9d2[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x42d9d2[_0xe9f0('0x31')],_0x42d9d2[_0xe9f0('0x32')]);_0x314f0e['attributes']=_[_0xe9f0('0x35')](_0x42d9d2['model'],qs['fields'](_0x297689[_0xe9f0('0x32')][_0xe9f0('0x37')]));_0x314f0e['attributes']=_0x314f0e[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0x314f0e[_0xe9f0('0x36')]:_0x42d9d2[_0xe9f0('0x31')];if(_0x297689[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0x314f0e[_0xe9f0('0x41')]=[{'all':!![]}];}_0x314f0e=_['merge']({},_0x314f0e,_0x297689[_0xe9f0('0x44')]);return db['UserProfileResource'][_0xe9f0('0x45')](_0x314f0e)['then'](handleEntityNotFound(_0x52613a,null))[_0xe9f0('0x24')](respondWithResult(_0x52613a,null))['catch'](handleError(_0x52613a,null));};exports[_0xe9f0('0x46')]=function(_0x2023b4,_0x422324){return db['UserProfileResource'][_0xe9f0('0x46')](_0x2023b4[_0xe9f0('0x47')],{})[_0xe9f0('0x24')](respondWithResult(_0x422324,0xc9))[_0xe9f0('0x43')](handleError(_0x422324,null));};exports[_0xe9f0('0x23')]=function(_0x135175,_0x6ece3f){if(_0x135175[_0xe9f0('0x47')]['id']){delete _0x135175[_0xe9f0('0x47')]['id'];}return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x135175[_0xe9f0('0x48')]['id']}})['then'](handleEntityNotFound(_0x6ece3f,null))['then'](saveUpdates(_0x135175[_0xe9f0('0x47')],null))[_0xe9f0('0x24')](respondWithResult(_0x6ece3f,null))[_0xe9f0('0x43')](handleError(_0x6ece3f,null));};exports['destroy']=function(_0x1ac381,_0x4d8b2e){return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x1ac381[_0xe9f0('0x48')]['id']}})[_0xe9f0('0x24')](handleEntityNotFound(_0x4d8b2e,null))['then'](removeEntity(_0x4d8b2e,null))[_0xe9f0('0x43')](handleError(_0x4d8b2e,null));};exports[_0xe9f0('0x49')]=function(_0x5163ea,_0x2bf65c){return db[_0xe9f0('0x2c')][_0xe9f0('0x49')]()[_0xe9f0('0x24')](respondWithResult(_0x2bf65c,null))['catch'](handleError(_0x2bf65c,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 8725876..6b70fe5 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 _0x1b16=['path','../../config/environment','define','user_profile_has_resources','compositeIndex','lodash','../../config/logger','api','moment','bluebird'];(function(_0x42a975,_0x121d9e){var _0x58a08c=function(_0x1163f2){while(--_0x1163f2){_0x42a975['push'](_0x42a975['shift']());}};_0x58a08c(++_0x121d9e);}(_0x1b16,0x1a9));var _0x61b1=function(_0xdecdd5,_0x90a4e3){_0xdecdd5=_0xdecdd5-0x0;var _0x28ddad=_0x1b16[_0xdecdd5];return _0x28ddad;};'use strict';var _=require(_0x61b1('0x0'));var util=require('util');var logger=require(_0x61b1('0x1'))(_0x61b1('0x2'));var moment=require(_0x61b1('0x3'));var BPromise=require(_0x61b1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x61b1('0x5'));var rimraf=require('rimraf');var config=require(_0x61b1('0x6'));var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x4fd10c,_0x1970cf){return _0x4fd10c[_0x61b1('0x7')]('UserProfileResource',attributes,{'tableName':_0x61b1('0x8'),'paranoid':![],'indexes':[{'name':_0x61b1('0x9'),'fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9117=['moment','bluebird','path','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','api'];(function(_0x3996af,_0x2753e6){var _0x38900d=function(_0x474269){while(--_0x474269){_0x3996af['push'](_0x3996af['shift']());}};_0x38900d(++_0x2753e6);}(_0x9117,0xf9));var _0x7911=function(_0x133968,_0x5ca58b){_0x133968=_0x133968-0x0;var _0x14a75a=_0x9117[_0x133968];return _0x14a75a;};'use strict';var _=require(_0x7911('0x0'));var util=require(_0x7911('0x1'));var logger=require('../../config/logger')(_0x7911('0x2'));var moment=require(_0x7911('0x3'));var BPromise=require(_0x7911('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7911('0x5'));var rimraf=require('rimraf');var config=require(_0x7911('0x6'));var attributes=require(_0x7911('0x7'));module[_0x7911('0x8')]=function(_0x4951db,_0xc494c0){return _0x4951db['define'](_0x7911('0x9'),attributes,{'tableName':_0x7911('0xa'),'paranoid':![],'indexes':[{'name':_0x7911('0xb'),'fields':[_0x7911('0xc'),_0x7911('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 9e787cb..6d29f78 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 _0xd40e=['UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info'];(function(_0x208671,_0xfc8e5c){var _0x16df54=function(_0x88120d){while(--_0x88120d){_0x208671['push'](_0x208671['shift']());}};_0x16df54(++_0xfc8e5c);}(_0xd40e,0x16d));var _0xed40=function(_0xda99d6,_0x5d0efa){_0xda99d6=_0xda99d6-0x0;var _0x4d8540=_0xd40e[_0xda99d6];return _0x4d8540;};'use strict';var _=require(_0xed40('0x0'));var util=require(_0xed40('0x1'));var moment=require(_0xed40('0x2'));var BPromise=require(_0xed40('0x3'));var rs=require(_0xed40('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xed40('0x5'))['db'];var utils=require(_0xed40('0x6'));var logger=require(_0xed40('0x7'))('rpc');var config=require(_0xed40('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xed40('0x9')][_0xed40('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x269504,_0x2f5894,_0x4ef114){return new BPromise(function(_0xf43b8e,_0x378199){return client[_0xed40('0xb')](_0x269504,_0x4ef114)['then'](function(_0xc51ecb){logger[_0xed40('0xc')](_0xed40('0xd'),_0x2f5894,_0xed40('0xe'));logger[_0xed40('0xf')](_0xed40('0x10'),_0x2f5894,_0xed40('0xe'),JSON['stringify'](_0xc51ecb));if(_0xc51ecb[_0xed40('0x11')]){if(_0xc51ecb['error'][_0xed40('0x12')]===0x1f4){logger[_0xed40('0x11')](_0xed40('0xd'),_0x2f5894,_0xc51ecb['error']['message']);return _0x378199(_0xc51ecb[_0xed40('0x11')]['message']);}logger[_0xed40('0x11')](_0xed40('0xd'),_0x2f5894,_0xc51ecb[_0xed40('0x11')][_0xed40('0x13')]);return _0xf43b8e(_0xc51ecb[_0xed40('0x11')][_0xed40('0x13')]);}else{logger[_0xed40('0xc')](_0xed40('0xd'),_0x2f5894,_0xed40('0xe'));_0xf43b8e(_0xc51ecb['result']['message']);}})[_0xed40('0x14')](function(_0x17cc31){logger['error'](_0xed40('0xd'),_0x2f5894,_0x17cc31);_0x378199(_0x17cc31);});});} \ No newline at end of file +var _0x0a0c=['rpc','../../config/environment','jayson/promise','client','http','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/logger'];(function(_0x32802c,_0x41d88b){var _0x1329b8=function(_0x59f139){while(--_0x59f139){_0x32802c['push'](_0x32802c['shift']());}};_0x1329b8(++_0x41d88b);}(_0x0a0c,0xd7));var _0xc0a0=function(_0x271a4d,_0x3514ca){_0x271a4d=_0x271a4d-0x0;var _0x161c55=_0x0a0c[_0x271a4d];return _0x161c55;};'use strict';var _=require(_0xc0a0('0x0'));var util=require('util');var moment=require(_0xc0a0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc0a0('0x2'));var db=require(_0xc0a0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc0a0('0x4'))(_0xc0a0('0x5'));var config=require(_0xc0a0('0x6'));var jayson=require(_0xc0a0('0x7'));var client=jayson[_0xc0a0('0x8')][_0xc0a0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c22c6,_0x2df805,_0x220a98){return new BPromise(function(_0x254ff2,_0x593257){return client['request'](_0x5c22c6,_0x220a98)[_0xc0a0('0xa')](function(_0x5c6d8e){logger['info'](_0xc0a0('0xb'),_0x2df805,_0xc0a0('0xc'));logger[_0xc0a0('0xd')](_0xc0a0('0xe'),_0x2df805,_0xc0a0('0xc'),JSON[_0xc0a0('0xf')](_0x5c6d8e));if(_0x5c6d8e[_0xc0a0('0x10')]){if(_0x5c6d8e[_0xc0a0('0x10')][_0xc0a0('0x11')]===0x1f4){logger[_0xc0a0('0x10')](_0xc0a0('0xb'),_0x2df805,_0x5c6d8e[_0xc0a0('0x10')][_0xc0a0('0x12')]);return _0x593257(_0x5c6d8e['error']['message']);}logger['error']('UserProfileResource,\x20%s,\x20%s',_0x2df805,_0x5c6d8e[_0xc0a0('0x10')][_0xc0a0('0x12')]);return _0x254ff2(_0x5c6d8e['error']['message']);}else{logger[_0xc0a0('0x13')](_0xc0a0('0xb'),_0x2df805,_0xc0a0('0xc'));_0x254ff2(_0x5c6d8e[_0xc0a0('0x14')][_0xc0a0('0x12')]);}})[_0xc0a0('0x15')](function(_0x3f92df){logger[_0xc0a0('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x2df805,_0x3f92df);_0x593257(_0x3f92df);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index a68d959..87fe400 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 _0x5651=['/describe','describe','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x484647,_0x33b0db){var _0x416a42=function(_0x5ccb06){while(--_0x5ccb06){_0x484647['push'](_0x484647['shift']());}};_0x416a42(++_0x33b0db);}(_0x5651,0xa2));var _0x1565=function(_0x237da8,_0x37b77a){_0x237da8=_0x237da8-0x0;var _0x558825=_0x5651[_0x237da8];return _0x558825;};'use strict';var multer=require('multer');var util=require(_0x1565('0x0'));var path=require(_0x1565('0x1'));var timeout=require(_0x1565('0x2'));var express=require('express');var router=express[_0x1565('0x3')]();var fs_extra=require(_0x1565('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1565('0x5'));var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0x1565('0x6')]('/',auth[_0x1565('0x7')](),controller[_0x1565('0x8')]);router[_0x1565('0x6')](_0x1565('0x9'),auth[_0x1565('0x7')](),controller[_0x1565('0xa')]);router['get'](_0x1565('0xb'),auth[_0x1565('0x7')](),controller[_0x1565('0xc')]);router[_0x1565('0xd')]('/',auth['isAuthenticated'](),controller[_0x1565('0xe')]);router[_0x1565('0xf')]('/:id',auth[_0x1565('0x7')](),controller['update']);router[_0x1565('0x10')](_0x1565('0xb'),auth['isAuthenticated'](),controller[_0x1565('0x11')]);module[_0x1565('0x12')]=router; \ No newline at end of file +var _0x679b=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','multer'];(function(_0x96461c,_0x26c1bd){var _0x1bcb9d=function(_0x44fd26){while(--_0x44fd26){_0x96461c['push'](_0x96461c['shift']());}};_0x1bcb9d(++_0x26c1bd);}(_0x679b,0xa7));var _0xb679=function(_0x4c8f75,_0x2a881b){_0x4c8f75=_0x4c8f75-0x0;var _0x19598a=_0x679b[_0x4c8f75];return _0x19598a;};'use strict';var multer=require(_0xb679('0x0'));var util=require(_0xb679('0x1'));var path=require('path');var timeout=require(_0xb679('0x2'));var express=require('express');var router=express[_0xb679('0x3')]();var fs_extra=require(_0xb679('0x4'));var auth=require(_0xb679('0x5'));var interaction=require(_0xb679('0x6'));var config=require(_0xb679('0x7'));var controller=require(_0xb679('0x8'));router[_0xb679('0x9')]('/',auth[_0xb679('0xa')](),controller[_0xb679('0xb')]);router[_0xb679('0x9')](_0xb679('0xc'),auth[_0xb679('0xa')](),controller[_0xb679('0xd')]);router['get'](_0xb679('0xe'),auth[_0xb679('0xa')](),controller[_0xb679('0xf')]);router[_0xb679('0x10')]('/',auth[_0xb679('0xa')](),controller[_0xb679('0x11')]);router[_0xb679('0x12')]('/:id',auth[_0xb679('0xa')](),controller[_0xb679('0x13')]);router[_0xb679('0x14')](_0xb679('0xe'),auth[_0xb679('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 66e5259..51aa314 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(_0x384231,_0x50be41){var _0x2480bf=function(_0x1c4838){while(--_0x1c4838){_0x384231['push'](_0x384231['shift']());}};_0x2480bf(++_0x50be41);}(_0x4e81,0x1bc));var _0x14e8=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0x4e81[_0x2f45ea];return _0x485a84;};'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 _0xd4a2=['join','getDataValue','split','sequelize','STRING','BOOLEAN','setDataValue','crudPermissions'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0xd4a2,0x173));var _0x2d4a=function(_0x1b6879,_0x3fab33){_0x1b6879=_0x1b6879-0x0;var _0x4f4a25=_0xd4a2[_0x1b6879];return _0x4f4a25;};'use strict';var Sequelize=require(_0x2d4a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x2d4a('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x2d4a('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x2d4a('0x1')],'set':function(_0x5d435a){this[_0x2d4a('0x3')](_0x2d4a('0x4'),_0x5d435a?_0x5d435a[_0x2d4a('0x5')](''):[]);},'get':function(){return this[_0x2d4a('0x6')](_0x2d4a('0x4'))?this['getDataValue'](_0x2d4a('0x4'))[_0x2d4a('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 6802131..14ec425 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 _0x9012=['stack','name','index','UserProfileSection','rawAttributes','fieldName','type','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','error'];(function(_0x358bf3,_0x40ec1f){var _0x248106=function(_0x2eb1f3){while(--_0x2eb1f3){_0x358bf3['push'](_0x358bf3['shift']());}};_0x248106(++_0x40ec1f);}(_0x9012,0x17b));var _0x2901=function(_0x1283d4,_0x36b6f1){_0x1283d4=_0x1283d4-0x0;var _0x433643=_0x9012[_0x1283d4];return _0x433643;};'use strict';var emlformat=require(_0x2901('0x0'));var rimraf=require(_0x2901('0x1'));var zipdir=require(_0x2901('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2901('0x3'));var moment=require(_0x2901('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2901('0x5'));var csv=require(_0x2901('0x6'));var ejs=require(_0x2901('0x7'));var fs=require('fs');var fs_extra=require(_0x2901('0x8'));var _=require(_0x2901('0x9'));var squel=require(_0x2901('0xa'));var crypto=require(_0x2901('0xb'));var jsforce=require(_0x2901('0xc'));var deskjs=require(_0x2901('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2901('0xe'));var Papa=require('papaparse');var Redis=require(_0x2901('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2901('0x10'));var as=require(_0x2901('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2901('0x12'))(_0x2901('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2901('0x14'))['db'];function respondWithStatusCode(_0x2206cb,_0x2f2d89){_0x2f2d89=_0x2f2d89||0xcc;return function(_0x1af76f){if(_0x1af76f){return _0x2206cb[_0x2901('0x15')](_0x2f2d89);}return _0x2206cb[_0x2901('0x16')](_0x2f2d89)[_0x2901('0x17')]();};}function respondWithResult(_0x300278,_0x59dc63){_0x59dc63=_0x59dc63||0xc8;return function(_0x5941c9){if(_0x5941c9){return _0x300278[_0x2901('0x16')](_0x59dc63)['json'](_0x5941c9);}};}function respondWithFilteredResult(_0xa6650f,_0x5d87d2){return function(_0x2cd939){if(_0x2cd939){var _0x1352ad=typeof _0x5d87d2[_0x2901('0x18')]==='undefined'&&typeof _0x5d87d2[_0x2901('0x19')]===_0x2901('0x1a');var _0x534197=_0x2cd939['count'];var _0x5b88a1=_0x1352ad?0x0:_0x5d87d2[_0x2901('0x18')];var _0x1ff737=_0x1352ad?_0x2cd939[_0x2901('0x1b')]:_0x5d87d2['offset']+_0x5d87d2[_0x2901('0x19')];var _0x5dc240;if(_0x1ff737>=_0x534197){_0x1ff737=_0x534197;_0x5dc240=0xc8;}else{_0x5dc240=0xce;}_0xa6650f['status'](_0x5dc240);return _0xa6650f[_0x2901('0x1c')](_0x2901('0x1d'),_0x5b88a1+'-'+_0x1ff737+'/'+_0x534197)['json'](_0x2cd939);}return null;};}function patchUpdates(_0x223c6e){return function(_0x524a53){try{jsonpatch['apply'](_0x524a53,_0x223c6e,!![]);}catch(_0x1eb281){return BPromise[_0x2901('0x1e')](_0x1eb281);}return _0x524a53['save']();};}function saveUpdates(_0x1ac32c,_0x17cd21){return function(_0x5b5d9e){if(_0x5b5d9e){return _0x5b5d9e[_0x2901('0x1f')](_0x1ac32c)[_0x2901('0x20')](function(_0x5b45bd){return _0x5b45bd;});}return null;};}function removeEntity(_0x304221,_0x181a02){return function(_0x5415a5){if(_0x5415a5){return _0x5415a5[_0x2901('0x21')]()[_0x2901('0x20')](function(){_0x304221['status'](0xcc)[_0x2901('0x17')]();});}};}function handleEntityNotFound(_0x911966,_0x54220e){return function(_0x4b85b1){if(!_0x4b85b1){_0x911966['sendStatus'](0x194);}return _0x4b85b1;};}function handleError(_0x131940,_0x2941ce){_0x2941ce=_0x2941ce||0x1f4;return function(_0x193d1a){logger[_0x2901('0x22')](_0x193d1a[_0x2901('0x23')]);if(_0x193d1a[_0x2901('0x24')]){delete _0x193d1a[_0x2901('0x24')];}_0x131940[_0x2901('0x16')](_0x2941ce)['send'](_0x193d1a);};}exports[_0x2901('0x25')]=function(_0x43cbd1,_0x199738){var _0x45d305={},_0x4c0e61={},_0x47e742={'count':0x0,'rows':[]};var _0x238030=_['map'](db[_0x2901('0x26')][_0x2901('0x27')],function(_0x5e35d7){return{'name':_0x5e35d7[_0x2901('0x28')],'type':_0x5e35d7[_0x2901('0x29')]['key']};});_0x4c0e61[_0x2901('0x2a')]=_[_0x2901('0x2b')](_0x238030,'name');_0x4c0e61['query']=_[_0x2901('0x2c')](_0x43cbd1[_0x2901('0x2d')]);_0x4c0e61[_0x2901('0x2e')]=_['intersection'](_0x4c0e61[_0x2901('0x2a')],_0x4c0e61[_0x2901('0x2d')]);_0x45d305[_0x2901('0x2f')]=_[_0x2901('0x30')](_0x4c0e61['model'],qs[_0x2901('0x31')](_0x43cbd1['query'][_0x2901('0x31')]));_0x45d305[_0x2901('0x2f')]=_0x45d305[_0x2901('0x2f')][_0x2901('0x32')]?_0x45d305[_0x2901('0x2f')]:_0x4c0e61[_0x2901('0x2a')];if(!_0x43cbd1[_0x2901('0x2d')][_0x2901('0x33')](_0x2901('0x34'))){_0x45d305[_0x2901('0x19')]=qs[_0x2901('0x19')](_0x43cbd1[_0x2901('0x2d')][_0x2901('0x19')]);_0x45d305['offset']=qs[_0x2901('0x18')](_0x43cbd1['query'][_0x2901('0x18')]);}_0x45d305[_0x2901('0x35')]=qs['sort'](_0x43cbd1[_0x2901('0x2d')][_0x2901('0x36')]);_0x45d305[_0x2901('0x37')]=qs[_0x2901('0x2e')](_[_0x2901('0x38')](_0x43cbd1['query'],_0x4c0e61[_0x2901('0x2e')]),_0x238030);if(_0x43cbd1[_0x2901('0x2d')][_0x2901('0x39')]){_0x45d305[_0x2901('0x37')]=_['merge'](_0x45d305['where'],{'$or':_[_0x2901('0x2b')](_0x238030,function(_0x1bff04){if(_0x1bff04[_0x2901('0x29')]!=='VIRTUAL'){var _0x1ea4fb={};_0x1ea4fb[_0x1bff04[_0x2901('0x24')]]={'$like':'%'+_0x43cbd1['query'][_0x2901('0x39')]+'%'};return _0x1ea4fb;}})});}_0x45d305=_['merge']({},_0x45d305,_0x43cbd1[_0x2901('0x3a')]);var _0x99d46={'where':_0x45d305['where']};return db[_0x2901('0x26')][_0x2901('0x1b')](_0x99d46)[_0x2901('0x20')](function(_0x12078e){_0x47e742[_0x2901('0x1b')]=_0x12078e;if(_0x43cbd1[_0x2901('0x2d')][_0x2901('0x3b')]){_0x45d305[_0x2901('0x3c')]=[{'all':!![]}];}return db[_0x2901('0x26')][_0x2901('0x3d')](_0x45d305);})[_0x2901('0x20')](function(_0x5434a0){_0x47e742[_0x2901('0x3e')]=_0x5434a0;return _0x47e742;})['then'](respondWithFilteredResult(_0x199738,_0x45d305))[_0x2901('0x3f')](handleError(_0x199738,null));};exports['show']=function(_0x26a5a5,_0x14157f){var _0x4551e9={'raw':![],'where':{'id':_0x26a5a5[_0x2901('0x40')]['id']}},_0x4e4e81={};_0x4e4e81[_0x2901('0x2a')]=_[_0x2901('0x2c')](db[_0x2901('0x26')][_0x2901('0x27')]);_0x4e4e81['query']=_[_0x2901('0x2c')](_0x26a5a5['query']);_0x4e4e81[_0x2901('0x2e')]=_[_0x2901('0x30')](_0x4e4e81[_0x2901('0x2a')],_0x4e4e81['query']);_0x4551e9['attributes']=_[_0x2901('0x30')](_0x4e4e81['model'],qs[_0x2901('0x31')](_0x26a5a5[_0x2901('0x2d')][_0x2901('0x31')]));_0x4551e9[_0x2901('0x2f')]=_0x4551e9[_0x2901('0x2f')][_0x2901('0x32')]?_0x4551e9[_0x2901('0x2f')]:_0x4e4e81[_0x2901('0x2a')];if(_0x26a5a5[_0x2901('0x2d')][_0x2901('0x3b')]){_0x4551e9[_0x2901('0x3c')]=[{'all':!![]}];}_0x4551e9=_['merge']({},_0x4551e9,_0x26a5a5[_0x2901('0x3a')]);return db[_0x2901('0x26')][_0x2901('0x41')](_0x4551e9)[_0x2901('0x20')](handleEntityNotFound(_0x14157f,null))[_0x2901('0x20')](respondWithResult(_0x14157f,null))['catch'](handleError(_0x14157f,null));};exports[_0x2901('0x42')]=function(_0x50b9a8,_0x353d96){return db[_0x2901('0x26')][_0x2901('0x42')](_0x50b9a8[_0x2901('0x43')],{})[_0x2901('0x20')](respondWithResult(_0x353d96,0xc9))['catch'](handleError(_0x353d96,null));};exports[_0x2901('0x1f')]=function(_0x5dd20f,_0x2ed8dd){if(_0x5dd20f[_0x2901('0x43')]['id']){delete _0x5dd20f[_0x2901('0x43')]['id'];}return db[_0x2901('0x26')]['find']({'where':{'id':_0x5dd20f[_0x2901('0x40')]['id']}})['then'](handleEntityNotFound(_0x2ed8dd,null))[_0x2901('0x20')](saveUpdates(_0x5dd20f[_0x2901('0x43')],null))[_0x2901('0x20')](respondWithResult(_0x2ed8dd,null))[_0x2901('0x3f')](handleError(_0x2ed8dd,null));};exports[_0x2901('0x21')]=function(_0x43f172,_0x641114){return db[_0x2901('0x26')][_0x2901('0x41')]({'where':{'id':_0x43f172['params']['id']}})[_0x2901('0x20')](handleEntityNotFound(_0x641114,null))[_0x2901('0x20')](removeEntity(_0x641114,null))[_0x2901('0x3f')](handleError(_0x641114,null));};exports[_0x2901('0x44')]=function(_0x4b304a,_0x4d852a){return db[_0x2901('0x26')]['describe']()['then'](respondWithResult(_0x4d852a,null))[_0x2901('0x3f')](handleError(_0x4d852a,null));}; \ No newline at end of file +var _0x5996=['save','update','then','destroy','end','error','stack','name','send','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','pick','filter','where','merge','options','includeAll','include','rows','show','find','create','body','catch','params','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','apply','reject'];(function(_0x12e898,_0x1ef073){var _0x190631=function(_0x1f193d){while(--_0x1f193d){_0x12e898['push'](_0x12e898['shift']());}};_0x190631(++_0x1ef073);}(_0x5996,0x6f));var _0x6599=function(_0x198862,_0x3750fd){_0x198862=_0x198862-0x0;var _0x1f1e54=_0x5996[_0x198862];return _0x1f1e54;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6599('0x0'));var zipdir=require(_0x6599('0x1'));var jsonpatch=require(_0x6599('0x2'));var rp=require('request-promise');var moment=require(_0x6599('0x3'));var BPromise=require(_0x6599('0x4'));var Mustache=require(_0x6599('0x5'));var util=require(_0x6599('0x6'));var path=require('path');var sox=require(_0x6599('0x7'));var csv=require('to-csv');var ejs=require(_0x6599('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6599('0x9'));var squel=require(_0x6599('0xa'));var crypto=require('crypto');var jsforce=require(_0x6599('0xb'));var deskjs=require(_0x6599('0xc'));var toCsv=require(_0x6599('0xd'));var querystring=require('querystring');var Papa=require(_0x6599('0xe'));var Redis=require('ioredis');var authService=require(_0x6599('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6599('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6599('0x11'))(_0x6599('0x12'));var utils=require(_0x6599('0x13'));var config=require(_0x6599('0x14'));var licenseUtil=require(_0x6599('0x15'));var db=require(_0x6599('0x16'))['db'];function respondWithStatusCode(_0x500d22,_0x5122b6){_0x5122b6=_0x5122b6||0xcc;return function(_0x417b59){if(_0x417b59){return _0x500d22[_0x6599('0x17')](_0x5122b6);}return _0x500d22['status'](_0x5122b6)['end']();};}function respondWithResult(_0x179401,_0x47b7ae){_0x47b7ae=_0x47b7ae||0xc8;return function(_0x5519ea){if(_0x5519ea){return _0x179401['status'](_0x47b7ae)[_0x6599('0x18')](_0x5519ea);}};}function respondWithFilteredResult(_0x3cb08f,_0x5eaa94){return function(_0x57916e){if(_0x57916e){var _0x21315a=typeof _0x5eaa94[_0x6599('0x19')]==='undefined'&&typeof _0x5eaa94[_0x6599('0x1a')]===_0x6599('0x1b');var _0x3580c0=_0x57916e[_0x6599('0x1c')];var _0x3398ba=_0x21315a?0x0:_0x5eaa94['offset'];var _0x4a7f9e=_0x21315a?_0x57916e[_0x6599('0x1c')]:_0x5eaa94[_0x6599('0x19')]+_0x5eaa94['limit'];var _0x22d869;if(_0x4a7f9e>=_0x3580c0){_0x4a7f9e=_0x3580c0;_0x22d869=0xc8;}else{_0x22d869=0xce;}_0x3cb08f[_0x6599('0x1d')](_0x22d869);return _0x3cb08f[_0x6599('0x1e')]('Content-Range',_0x3398ba+'-'+_0x4a7f9e+'/'+_0x3580c0)[_0x6599('0x18')](_0x57916e);}return null;};}function patchUpdates(_0x89268a){return function(_0x1ad734){try{jsonpatch[_0x6599('0x1f')](_0x1ad734,_0x89268a,!![]);}catch(_0x5ad2ba){return BPromise[_0x6599('0x20')](_0x5ad2ba);}return _0x1ad734[_0x6599('0x21')]();};}function saveUpdates(_0x48142b,_0x24eaf8){return function(_0x5de225){if(_0x5de225){return _0x5de225[_0x6599('0x22')](_0x48142b)[_0x6599('0x23')](function(_0x41a0d0){return _0x41a0d0;});}return null;};}function removeEntity(_0x452f0c,_0x46b4e1){return function(_0x42418d){if(_0x42418d){return _0x42418d[_0x6599('0x24')]()['then'](function(){_0x452f0c[_0x6599('0x1d')](0xcc)[_0x6599('0x25')]();});}};}function handleEntityNotFound(_0x177b3d,_0x56ba8b){return function(_0x5476d0){if(!_0x5476d0){_0x177b3d[_0x6599('0x17')](0x194);}return _0x5476d0;};}function handleError(_0x37f39b,_0xf86e67){_0xf86e67=_0xf86e67||0x1f4;return function(_0x37a795){logger[_0x6599('0x26')](_0x37a795[_0x6599('0x27')]);if(_0x37a795[_0x6599('0x28')]){delete _0x37a795['name'];}_0x37f39b['status'](_0xf86e67)[_0x6599('0x29')](_0x37a795);};}exports['index']=function(_0x4a65da,_0x2f344f){var _0x1d1ea8={},_0x245ef5={},_0x445507={'count':0x0,'rows':[]};var _0x3e3df6=_[_0x6599('0x2a')](db[_0x6599('0x2b')][_0x6599('0x2c')],function(_0x1268af){return{'name':_0x1268af[_0x6599('0x2d')],'type':_0x1268af[_0x6599('0x2e')][_0x6599('0x2f')]};});_0x245ef5[_0x6599('0x30')]=_[_0x6599('0x2a')](_0x3e3df6,'name');_0x245ef5[_0x6599('0x31')]=_[_0x6599('0x32')](_0x4a65da[_0x6599('0x31')]);_0x245ef5[_0x6599('0x33')]=_[_0x6599('0x34')](_0x245ef5[_0x6599('0x30')],_0x245ef5[_0x6599('0x31')]);_0x1d1ea8['attributes']=_[_0x6599('0x34')](_0x245ef5[_0x6599('0x30')],qs[_0x6599('0x35')](_0x4a65da['query']['fields']));_0x1d1ea8['attributes']=_0x1d1ea8[_0x6599('0x36')][_0x6599('0x37')]?_0x1d1ea8[_0x6599('0x36')]:_0x245ef5[_0x6599('0x30')];if(!_0x4a65da[_0x6599('0x31')]['hasOwnProperty']('nolimit')){_0x1d1ea8['limit']=qs[_0x6599('0x1a')](_0x4a65da['query'][_0x6599('0x1a')]);_0x1d1ea8[_0x6599('0x19')]=qs[_0x6599('0x19')](_0x4a65da['query'][_0x6599('0x19')]);}_0x1d1ea8[_0x6599('0x38')]=qs[_0x6599('0x39')](_0x4a65da['query'][_0x6599('0x39')]);_0x1d1ea8['where']=qs[_0x6599('0x33')](_[_0x6599('0x3a')](_0x4a65da[_0x6599('0x31')],_0x245ef5['filters']),_0x3e3df6);if(_0x4a65da['query'][_0x6599('0x3b')]){_0x1d1ea8[_0x6599('0x3c')]=_[_0x6599('0x3d')](_0x1d1ea8[_0x6599('0x3c')],{'$or':_['map'](_0x3e3df6,function(_0x47029f){if(_0x47029f['type']!=='VIRTUAL'){var _0x3725e7={};_0x3725e7[_0x47029f['name']]={'$like':'%'+_0x4a65da[_0x6599('0x31')][_0x6599('0x3b')]+'%'};return _0x3725e7;}})});}_0x1d1ea8=_[_0x6599('0x3d')]({},_0x1d1ea8,_0x4a65da[_0x6599('0x3e')]);var _0x36fea3={'where':_0x1d1ea8[_0x6599('0x3c')]};return db[_0x6599('0x2b')][_0x6599('0x1c')](_0x36fea3)[_0x6599('0x23')](function(_0x5511ab){_0x445507[_0x6599('0x1c')]=_0x5511ab;if(_0x4a65da[_0x6599('0x31')][_0x6599('0x3f')]){_0x1d1ea8[_0x6599('0x40')]=[{'all':!![]}];}return db[_0x6599('0x2b')]['findAll'](_0x1d1ea8);})[_0x6599('0x23')](function(_0x31bc42){_0x445507[_0x6599('0x41')]=_0x31bc42;return _0x445507;})[_0x6599('0x23')](respondWithFilteredResult(_0x2f344f,_0x1d1ea8))['catch'](handleError(_0x2f344f,null));};exports[_0x6599('0x42')]=function(_0x4c6354,_0x3f55f6){var _0x44ae20={'raw':![],'where':{'id':_0x4c6354['params']['id']}},_0x18aab8={};_0x18aab8[_0x6599('0x30')]=_['keys'](db[_0x6599('0x2b')][_0x6599('0x2c')]);_0x18aab8[_0x6599('0x31')]=_[_0x6599('0x32')](_0x4c6354['query']);_0x18aab8[_0x6599('0x33')]=_['intersection'](_0x18aab8[_0x6599('0x30')],_0x18aab8[_0x6599('0x31')]);_0x44ae20[_0x6599('0x36')]=_[_0x6599('0x34')](_0x18aab8['model'],qs[_0x6599('0x35')](_0x4c6354[_0x6599('0x31')][_0x6599('0x35')]));_0x44ae20['attributes']=_0x44ae20['attributes'][_0x6599('0x37')]?_0x44ae20[_0x6599('0x36')]:_0x18aab8[_0x6599('0x30')];if(_0x4c6354[_0x6599('0x31')]['includeAll']){_0x44ae20[_0x6599('0x40')]=[{'all':!![]}];}_0x44ae20=_[_0x6599('0x3d')]({},_0x44ae20,_0x4c6354[_0x6599('0x3e')]);return db[_0x6599('0x2b')][_0x6599('0x43')](_0x44ae20)[_0x6599('0x23')](handleEntityNotFound(_0x3f55f6,null))[_0x6599('0x23')](respondWithResult(_0x3f55f6,null))['catch'](handleError(_0x3f55f6,null));};exports[_0x6599('0x44')]=function(_0x345061,_0x2314ba){return db[_0x6599('0x2b')][_0x6599('0x44')](_0x345061[_0x6599('0x45')],{})['then'](respondWithResult(_0x2314ba,0xc9))[_0x6599('0x46')](handleError(_0x2314ba,null));};exports[_0x6599('0x22')]=function(_0x2c6b0e,_0x3e4efe){if(_0x2c6b0e[_0x6599('0x45')]['id']){delete _0x2c6b0e['body']['id'];}return db[_0x6599('0x2b')][_0x6599('0x43')]({'where':{'id':_0x2c6b0e[_0x6599('0x47')]['id']}})[_0x6599('0x23')](handleEntityNotFound(_0x3e4efe,null))[_0x6599('0x23')](saveUpdates(_0x2c6b0e[_0x6599('0x45')],null))['then'](respondWithResult(_0x3e4efe,null))['catch'](handleError(_0x3e4efe,null));};exports[_0x6599('0x24')]=function(_0x2b82c1,_0x4c1fd6){return db['UserProfileSection']['find']({'where':{'id':_0x2b82c1[_0x6599('0x47')]['id']}})[_0x6599('0x23')](handleEntityNotFound(_0x4c1fd6,null))['then'](removeEntity(_0x4c1fd6,null))[_0x6599('0x46')](handleError(_0x4c1fd6,null));};exports['describe']=function(_0x131ba5,_0x11c880){return db[_0x6599('0x2b')]['describe']()['then'](respondWithResult(_0x11c880,null))['catch'](handleError(_0x11c880,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 9587dd7..3ae927c 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 _0xc9d7=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','user_profile_has_sections','compositeIndex','sectionId','lodash'];(function(_0x28c8c6,_0x2d3eff){var _0x489589=function(_0x22ffc4){while(--_0x22ffc4){_0x28c8c6['push'](_0x28c8c6['shift']());}};_0x489589(++_0x2d3eff);}(_0xc9d7,0x149));var _0x7c9d=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0xc9d7[_0x2272b5];return _0x110156;};'use strict';var _=require(_0x7c9d('0x0'));var util=require(_0x7c9d('0x1'));var logger=require(_0x7c9d('0x2'))(_0x7c9d('0x3'));var moment=require(_0x7c9d('0x4'));var BPromise=require(_0x7c9d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c9d('0x6'));var rimraf=require(_0x7c9d('0x7'));var config=require(_0x7c9d('0x8'));var attributes=require(_0x7c9d('0x9'));module[_0x7c9d('0xa')]=function(_0x22c204,_0x18b838){return _0x22c204[_0x7c9d('0xb')]('UserProfileSection',attributes,{'tableName':_0x7c9d('0xc'),'paranoid':![],'indexes':[{'name':_0x7c9d('0xd'),'fields':[_0x7c9d('0xe'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x44a0=['path','rimraf','./userProfileSection.attributes','exports','user_profile_has_sections','compositeIndex','sectionId','lodash','util','../../config/logger','api','moment'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x44a0,0x103));var _0x044a=function(_0x2b6ec6,_0x55384e){_0x2b6ec6=_0x2b6ec6-0x0;var _0x3e80f2=_0x44a0[_0x2b6ec6];return _0x3e80f2;};'use strict';var _=require(_0x044a('0x0'));var util=require(_0x044a('0x1'));var logger=require(_0x044a('0x2'))(_0x044a('0x3'));var moment=require(_0x044a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x044a('0x5'));var rimraf=require(_0x044a('0x6'));var config=require('../../config/environment');var attributes=require(_0x044a('0x7'));module[_0x044a('0x8')]=function(_0x44a6ea,_0x523b0c){return _0x44a6ea['define']('UserProfileSection',attributes,{'tableName':_0x044a('0x9'),'paranoid':![],'indexes':[{'name':_0x044a('0xa'),'fields':[_0x044a('0xb'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 0eb1eb4..ca83766 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 _0x98af=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x631c32,_0x202aed){var _0x285804=function(_0xa71a5a){while(--_0xa71a5a){_0x631c32['push'](_0x631c32['shift']());}};_0x285804(++_0x202aed);}(_0x98af,0x131));var _0xf98a=function(_0x401ecb,_0x506ab7){_0x401ecb=_0x401ecb-0x0;var _0x543363=_0x98af[_0x401ecb];return _0x543363;};'use strict';var _=require(_0xf98a('0x0'));var util=require('util');var moment=require(_0xf98a('0x1'));var BPromise=require(_0xf98a('0x2'));var rs=require(_0xf98a('0x3'));var fs=require('fs');var Redis=require(_0xf98a('0x4'));var db=require(_0xf98a('0x5'))['db'];var utils=require(_0xf98a('0x6'));var logger=require(_0xf98a('0x7'))(_0xf98a('0x8'));var config=require(_0xf98a('0x9'));var jayson=require(_0xf98a('0xa'));var client=jayson[_0xf98a('0xb')][_0xf98a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x483ee3,_0x3d4115,_0x594142){return new BPromise(function(_0x3ab73d,_0x2a12f9){return client[_0xf98a('0xd')](_0x483ee3,_0x594142)[_0xf98a('0xe')](function(_0x13a61f){logger[_0xf98a('0xf')](_0xf98a('0x10'),_0x3d4115,_0xf98a('0x11'));logger[_0xf98a('0x12')](_0xf98a('0x13'),_0x3d4115,'request\x20sent',JSON['stringify'](_0x13a61f));if(_0x13a61f[_0xf98a('0x14')]){if(_0x13a61f['error'][_0xf98a('0x15')]===0x1f4){logger['error'](_0xf98a('0x10'),_0x3d4115,_0x13a61f[_0xf98a('0x14')][_0xf98a('0x16')]);return _0x2a12f9(_0x13a61f[_0xf98a('0x14')][_0xf98a('0x16')]);}logger['error']('UserProfileSection,\x20%s,\x20%s',_0x3d4115,_0x13a61f[_0xf98a('0x14')][_0xf98a('0x16')]);return _0x3ab73d(_0x13a61f[_0xf98a('0x14')][_0xf98a('0x16')]);}else{logger['info'](_0xf98a('0x10'),_0x3d4115,'request\x20sent');_0x3ab73d(_0x13a61f[_0xf98a('0x17')]['message']);}})['catch'](function(_0x4d44d7){logger['error'](_0xf98a('0x10'),_0x3d4115,_0x4d44d7);_0x2a12f9(_0x4d44d7);});});} \ No newline at end of file +var _0xe980=['request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xe980,0x74));var _0x0e98=function(_0x32748c,_0x4d48ef){_0x32748c=_0x32748c-0x0;var _0x1d9728=_0xe980[_0x32748c];return _0x1d9728;};'use strict';var _=require(_0x0e98('0x0'));var util=require(_0x0e98('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0e98('0x2'));var fs=require('fs');var Redis=require(_0x0e98('0x3'));var db=require(_0x0e98('0x4'))['db'];var utils=require(_0x0e98('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0e98('0x6'));var jayson=require(_0x0e98('0x7'));var client=jayson[_0x0e98('0x8')][_0x0e98('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcb703f,_0x549fac,_0x528fca){return new BPromise(function(_0x3c7267,_0x4e15af){return client[_0x0e98('0xa')](_0xcb703f,_0x528fca)['then'](function(_0x79c65a){logger[_0x0e98('0xb')](_0x0e98('0xc'),_0x549fac,_0x0e98('0xd'));logger[_0x0e98('0xe')](_0x0e98('0xf'),_0x549fac,'request\x20sent',JSON[_0x0e98('0x10')](_0x79c65a));if(_0x79c65a[_0x0e98('0x11')]){if(_0x79c65a[_0x0e98('0x11')][_0x0e98('0x12')]===0x1f4){logger[_0x0e98('0x11')](_0x0e98('0xc'),_0x549fac,_0x79c65a[_0x0e98('0x11')]['message']);return _0x4e15af(_0x79c65a[_0x0e98('0x11')][_0x0e98('0x13')]);}logger['error'](_0x0e98('0xc'),_0x549fac,_0x79c65a[_0x0e98('0x11')]['message']);return _0x3c7267(_0x79c65a['error'][_0x0e98('0x13')]);}else{logger['info'](_0x0e98('0xc'),_0x549fac,'request\x20sent');_0x3c7267(_0x79c65a[_0x0e98('0x14')][_0x0e98('0x13')]);}})['catch'](function(_0x23cb92){logger[_0x0e98('0x11')](_0x0e98('0xc'),_0x549fac,_0x23cb92);_0x4e15af(_0x23cb92);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 19201f7..d5e8083 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x24f9c9,_0x4d7183){var _0x5e0b55=function(_0x210a7b){while(--_0x210a7b){_0x24f9c9['push'](_0x24f9c9['shift']());}};_0x5e0b55(++_0x4d7183);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4f9b18,_0x2eaad3){var _0x337828=function(_0xc4840e){while(--_0xc4840e){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x337828(++_0x2eaad3);}(_0xe706,0xa3));var _0x6e70=function(_0x5c908c,_0x4bcfab){_0x5c908c=_0x5c908c-0x0;var _0x39325f=_0xe706[_0x5c908c];return _0x39325f;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index cf6679f..81368a8 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 _0x1060=['INTEGER','sequelize'];(function(_0x4b1665,_0xb0c095){var _0x5850c0=function(_0x44b7a4){while(--_0x44b7a4){_0x4b1665['push'](_0x4b1665['shift']());}};_0x5850c0(++_0xb0c095);}(_0x1060,0xc1));var _0x0106=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x1060[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0x0106('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x0106('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3516=['INTEGER'];(function(_0x336ccb,_0x5d76b5){var _0x324d07=function(_0x31d33b){while(--_0x31d33b){_0x336ccb['push'](_0x336ccb['shift']());}};_0x324d07(++_0x5d76b5);}(_0x3516,0x192));var _0x6351=function(_0x4f4e49,_0x4739e6){_0x4f4e49=_0x4f4e49-0x0;var _0x72a02c=_0x3516[_0x4f4e49];return _0x72a02c;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x6351('0x0')],'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 1a438bc..4cf0e40 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 _0xa46e=['api','moment','bluebird','path','../../config/environment','exports','define','user_has_sms_queues','lodash','util'];(function(_0xc69f39,_0x2ce0cf){var _0x93be41=function(_0xd66056){while(--_0xd66056){_0xc69f39['push'](_0xc69f39['shift']());}};_0x93be41(++_0x2ce0cf);}(_0xa46e,0x8a));var _0xea46=function(_0x1d7300,_0x17f109){_0x1d7300=_0x1d7300-0x0;var _0x46ee98=_0xa46e[_0x1d7300];return _0x46ee98;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var logger=require('../../config/logger')(_0xea46('0x2'));var moment=require(_0xea46('0x3'));var BPromise=require(_0xea46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea46('0x5'));var rimraf=require('rimraf');var config=require(_0xea46('0x6'));var attributes=require('./userSmsQueue.attributes');module[_0xea46('0x7')]=function(_0x528404,_0x10bee5){return _0x528404[_0xea46('0x8')]('UserSmsQueue',attributes,{'tableName':_0xea46('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x323f=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues'];(function(_0x40b1f2,_0x4cbe04){var _0x136c98=function(_0x5a440e){while(--_0x5a440e){_0x40b1f2['push'](_0x40b1f2['shift']());}};_0x136c98(++_0x4cbe04);}(_0x323f,0x1ee));var _0xf323=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x323f[_0x56482c];return _0x5aae7a;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var logger=require('../../config/logger')(_0xf323('0x1'));var moment=require(_0xf323('0x2'));var BPromise=require(_0xf323('0x3'));var rp=require(_0xf323('0x4'));var fs=require('fs');var path=require(_0xf323('0x5'));var rimraf=require(_0xf323('0x6'));var config=require(_0xf323('0x7'));var attributes=require(_0xf323('0x8'));module[_0xf323('0x9')]=function(_0x371707,_0x5d7d60){return _0x371707[_0xf323('0xa')](_0xf323('0xb'),attributes,{'tableName':_0xf323('0xc'),'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 e13df0c..a857127 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 _0x2df9=['rpc','../../config/environment','jayson/promise','http','request','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1b6201,_0x3602a6){var _0x355e8d=function(_0x14ecc0){while(--_0x14ecc0){_0x1b6201['push'](_0x1b6201['shift']());}};_0x355e8d(++_0x3602a6);}(_0x2df9,0xf5));var _0x92df=function(_0x5f1b1a,_0xcaba6d){_0x5f1b1a=_0x5f1b1a-0x0;var _0x197d87=_0x2df9[_0x5f1b1a];return _0x197d87;};'use strict';var _=require('lodash');var util=require(_0x92df('0x0'));var moment=require(_0x92df('0x1'));var BPromise=require(_0x92df('0x2'));var rs=require(_0x92df('0x3'));var fs=require('fs');var Redis=require(_0x92df('0x4'));var db=require(_0x92df('0x5'))['db'];var utils=require(_0x92df('0x6'));var logger=require(_0x92df('0x7'))(_0x92df('0x8'));var config=require(_0x92df('0x9'));var jayson=require(_0x92df('0xa'));var client=jayson['client'][_0x92df('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54498a,_0x29661a,_0x4b6d36){return new BPromise(function(_0x39b699,_0xa91304){return client[_0x92df('0xc')](_0x54498a,_0x4b6d36)[_0x92df('0xd')](function(_0x39521c){logger['info'](_0x92df('0xe'),_0x29661a,_0x92df('0xf'));logger[_0x92df('0x10')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x29661a,'request\x20sent',JSON['stringify'](_0x39521c));if(_0x39521c[_0x92df('0x11')]){if(_0x39521c[_0x92df('0x11')][_0x92df('0x12')]===0x1f4){logger['error'](_0x92df('0xe'),_0x29661a,_0x39521c[_0x92df('0x11')][_0x92df('0x13')]);return _0xa91304(_0x39521c[_0x92df('0x11')]['message']);}logger[_0x92df('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x29661a,_0x39521c[_0x92df('0x11')][_0x92df('0x13')]);return _0x39b699(_0x39521c[_0x92df('0x11')][_0x92df('0x13')]);}else{logger[_0x92df('0x14')](_0x92df('0xe'),_0x29661a,'request\x20sent');_0x39b699(_0x39521c[_0x92df('0x15')][_0x92df('0x13')]);}})[_0x92df('0x16')](function(_0x5271ae){logger['error'](_0x92df('0xe'),_0x29661a,_0x5271ae);_0xa91304(_0x5271ae);});});} \ No newline at end of file +var _0x2c3c=['stringify','error','code','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s'];(function(_0x231ede,_0x4856bb){var _0x3fdd8a=function(_0x4e622c){while(--_0x4e622c){_0x231ede['push'](_0x231ede['shift']());}};_0x3fdd8a(++_0x4856bb);}(_0x2c3c,0x155));var _0xc2c3=function(_0x30123b,_0x2b155d){_0x30123b=_0x30123b-0x0;var _0x24eb6f=_0x2c3c[_0x30123b];return _0x24eb6f;};'use strict';var _=require('lodash');var util=require(_0xc2c3('0x0'));var moment=require(_0xc2c3('0x1'));var BPromise=require(_0xc2c3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc2c3('0x3'));var db=require(_0xc2c3('0x4'))['db'];var utils=require(_0xc2c3('0x5'));var logger=require('../../config/logger')(_0xc2c3('0x6'));var config=require(_0xc2c3('0x7'));var jayson=require(_0xc2c3('0x8'));var client=jayson[_0xc2c3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21bd59,_0x425092,_0x4ef259){return new BPromise(function(_0x1f5a22,_0x3cd155){return client['request'](_0x21bd59,_0x4ef259)[_0xc2c3('0xa')](function(_0x494303){logger[_0xc2c3('0xb')](_0xc2c3('0xc'),_0x425092,_0xc2c3('0xd'));logger[_0xc2c3('0xe')](_0xc2c3('0xf'),_0x425092,_0xc2c3('0xd'),JSON[_0xc2c3('0x10')](_0x494303));if(_0x494303[_0xc2c3('0x11')]){if(_0x494303[_0xc2c3('0x11')][_0xc2c3('0x12')]===0x1f4){logger['error'](_0xc2c3('0xc'),_0x425092,_0x494303[_0xc2c3('0x11')][_0xc2c3('0x13')]);return _0x3cd155(_0x494303[_0xc2c3('0x11')]['message']);}logger[_0xc2c3('0x11')](_0xc2c3('0xc'),_0x425092,_0x494303[_0xc2c3('0x11')][_0xc2c3('0x13')]);return _0x1f5a22(_0x494303[_0xc2c3('0x11')][_0xc2c3('0x13')]);}else{logger[_0xc2c3('0xb')](_0xc2c3('0xc'),_0x425092,_0xc2c3('0xd'));_0x1f5a22(_0x494303['result'][_0xc2c3('0x13')]);}})[_0xc2c3('0x14')](function(_0x332e71){logger[_0xc2c3('0x11')](_0xc2c3('0xc'),_0x425092,_0x332e71);_0x3cd155(_0x332e71);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index d305ab1..3b389f7 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 _0x7fec=['exports','INTEGER'];(function(_0xcf2eb,_0x2136bb){var _0x3bc8f0=function(_0x5136c1){while(--_0x5136c1){_0xcf2eb['push'](_0xcf2eb['shift']());}};_0x3bc8f0(++_0x2136bb);}(_0x7fec,0xe6));var _0xc7fe=function(_0x382ccd,_0x4e13c0){_0x382ccd=_0x382ccd-0x0;var _0x33bc4d=_0x7fec[_0x382ccd];return _0x33bc4d;};'use strict';var Sequelize=require('sequelize');module[_0xc7fe('0x0')]={'UserId':{'type':Sequelize[_0xc7fe('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xc7fe('0x1')]}}; \ No newline at end of file +var _0x85d6=['INTEGER','sequelize','exports'];(function(_0x3dae0a,_0x22addc){var _0x5006ca=function(_0x16df67){while(--_0x16df67){_0x3dae0a['push'](_0x3dae0a['shift']());}};_0x5006ca(++_0x22addc);}(_0x85d6,0x166));var _0x685d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x85d6[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x685d('0x0'));module[_0x685d('0x1')]={'UserId':{'type':Sequelize[_0x685d('0x2')]},'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 82f8214..1b6c597 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(_0x3596ba,_0x4a374d){var _0x2deb54=function(_0x415858){while(--_0x415858){_0x3596ba['push'](_0x3596ba['shift']());}};_0x2deb54(++_0x4a374d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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(_0x370efa,_0x190c32){var _0x1fc5f9=function(_0x4bc9a3){while(--_0x4bc9a3){_0x370efa['push'](_0x370efa['shift']());}};_0x1fc5f9(++_0x190c32);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 ae08e7c..7b02cd7 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x54d1e2,_0x5c61c8){var _0x4ccf33=function(_0x4373b5){while(--_0x4373b5){_0x54d1e2['push'](_0x54d1e2['shift']());}};_0x4ccf33(++_0x5c61c8);}(_0xe706,0xa3));var _0x6e70=function(_0x1c289a,_0x277fe7){_0x1c289a=_0x1c289a-0x0;var _0x28d68e=_0xe706[_0x1c289a];return _0x28d68e;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xd7ee87,_0x79737e){var _0x2ccdc8=function(_0x3b28ac){while(--_0x3b28ac){_0xd7ee87['push'](_0xd7ee87['shift']());}};_0x2ccdc8(++_0x79737e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 1326939..988eac6 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 _0x8bd7=['sequelize','exports','INTEGER'];(function(_0x50b327,_0x4e3c8b){var _0x281820=function(_0x98dc08){while(--_0x98dc08){_0x50b327['push'](_0x50b327['shift']());}};_0x281820(++_0x4e3c8b);}(_0x8bd7,0x1a1));var _0x78bd=function(_0x508d7a,_0x38d2d8){_0x508d7a=_0x508d7a-0x0;var _0x5b1737=_0x8bd7[_0x508d7a];return _0x5b1737;};'use strict';var Sequelize=require(_0x78bd('0x0'));module[_0x78bd('0x1')]={'penalty':{'type':Sequelize[_0x78bd('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x687d=['sequelize','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x687d,0x194));var _0xd687=function(_0x522c1a,_0x1299ed){_0x522c1a=_0x522c1a-0x0;var _0x5807ee=_0x687d[_0x522c1a];return _0x5807ee;};'use strict';var Sequelize=require(_0xd687('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xd687('0x1')],'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 95c61f9..2dffebc 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 _0x1ca0=['bluebird','request-promise','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','lodash','util','../../config/logger','api','moment'];(function(_0x29aefc,_0x4dcf53){var _0x11be36=function(_0x3d472a){while(--_0x3d472a){_0x29aefc['push'](_0x29aefc['shift']());}};_0x11be36(++_0x4dcf53);}(_0x1ca0,0x16f));var _0x01ca=function(_0x36f102,_0x212728){_0x36f102=_0x36f102-0x0;var _0x3d860c=_0x1ca0[_0x36f102];return _0x3d860c;};'use strict';var _=require(_0x01ca('0x0'));var util=require(_0x01ca('0x1'));var logger=require(_0x01ca('0x2'))(_0x01ca('0x3'));var moment=require(_0x01ca('0x4'));var BPromise=require(_0x01ca('0x5'));var rp=require(_0x01ca('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x01ca('0x7'));var attributes=require(_0x01ca('0x8'));module[_0x01ca('0x9')]=function(_0x5e960c,_0x206691){return _0x5e960c[_0x01ca('0xa')](_0x01ca('0xb'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a39=['api','moment','request-promise','rimraf','exports','UserVoiceQueue','user_has_voice_queues','lodash'];(function(_0x4f485f,_0x1db0f7){var _0x1e998e=function(_0x14066c){while(--_0x14066c){_0x4f485f['push'](_0x4f485f['shift']());}};_0x1e998e(++_0x1db0f7);}(_0x2a39,0x1af));var _0x92a3=function(_0x37d4ac,_0x4e47d6){_0x37d4ac=_0x37d4ac-0x0;var _0x5e727a=_0x2a39[_0x37d4ac];return _0x5e727a;};'use strict';var _=require(_0x92a3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x92a3('0x1'));var moment=require(_0x92a3('0x2'));var BPromise=require('bluebird');var rp=require(_0x92a3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x92a3('0x4'));var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module[_0x92a3('0x5')]=function(_0x4a3705,_0x593c17){return _0x4a3705['define'](_0x92a3('0x6'),attributes,{'tableName':_0x92a3('0x7'),'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 fe4a7f0..b3d9c11 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 _0x1d59=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1d59,0x1b4));var _0x91d5=function(_0x159590,_0x4b2055){_0x159590=_0x159590-0x0;var _0x55e9cd=_0x1d59[_0x159590];return _0x55e9cd;};'use strict';var _=require('lodash');var util=require(_0x91d5('0x0'));var moment=require(_0x91d5('0x1'));var BPromise=require(_0x91d5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x91d5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x91d5('0x4'));var logger=require(_0x91d5('0x5'))(_0x91d5('0x6'));var config=require(_0x91d5('0x7'));var jayson=require(_0x91d5('0x8'));var client=jayson[_0x91d5('0x9')][_0x91d5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a2440,_0x5e9fc5,_0x2a4d08){return new BPromise(function(_0x229c07,_0x3c2214){return client[_0x91d5('0xb')](_0x2a2440,_0x2a4d08)['then'](function(_0x210471){logger[_0x91d5('0xc')](_0x91d5('0xd'),_0x5e9fc5,_0x91d5('0xe'));logger[_0x91d5('0xf')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x5e9fc5,'request\x20sent',JSON[_0x91d5('0x10')](_0x210471));if(_0x210471[_0x91d5('0x11')]){if(_0x210471['error']['code']===0x1f4){logger['error'](_0x91d5('0xd'),_0x5e9fc5,_0x210471[_0x91d5('0x11')][_0x91d5('0x12')]);return _0x3c2214(_0x210471[_0x91d5('0x11')]['message']);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x5e9fc5,_0x210471[_0x91d5('0x11')][_0x91d5('0x12')]);return _0x229c07(_0x210471[_0x91d5('0x11')][_0x91d5('0x12')]);}else{logger[_0x91d5('0xc')](_0x91d5('0xd'),_0x5e9fc5,'request\x20sent');_0x229c07(_0x210471[_0x91d5('0x13')][_0x91d5('0x12')]);}})[_0x91d5('0x14')](function(_0x2b4dbb){logger[_0x91d5('0x11')](_0x91d5('0xd'),_0x5e9fc5,_0x2b4dbb);_0x3c2214(_0x2b4dbb);});});} \ No newline at end of file +var _0xdae6=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x1df497,_0x42d99a){var _0x138786=function(_0x228e87){while(--_0x228e87){_0x1df497['push'](_0x1df497['shift']());}};_0x138786(++_0x42d99a);}(_0xdae6,0x1ac));var _0x6dae=function(_0x20b845,_0x132ec8){_0x20b845=_0x20b845-0x0;var _0x2c0ec4=_0xdae6[_0x20b845];return _0x2c0ec4;};'use strict';var _=require(_0x6dae('0x0'));var util=require(_0x6dae('0x1'));var moment=require(_0x6dae('0x2'));var BPromise=require(_0x6dae('0x3'));var rs=require(_0x6dae('0x4'));var fs=require('fs');var Redis=require(_0x6dae('0x5'));var db=require(_0x6dae('0x6'))['db'];var utils=require(_0x6dae('0x7'));var logger=require(_0x6dae('0x8'))(_0x6dae('0x9'));var config=require(_0x6dae('0xa'));var jayson=require(_0x6dae('0xb'));var client=jayson[_0x6dae('0xc')][_0x6dae('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2c395e,_0x5c5cbe,_0x16e123){return new BPromise(function(_0x24b16f,_0x4cfdaa){return client[_0x6dae('0xe')](_0x2c395e,_0x16e123)[_0x6dae('0xf')](function(_0x28280f){logger[_0x6dae('0x10')](_0x6dae('0x11'),_0x5c5cbe,_0x6dae('0x12'));logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x5c5cbe,_0x6dae('0x12'),JSON[_0x6dae('0x13')](_0x28280f));if(_0x28280f[_0x6dae('0x14')]){if(_0x28280f[_0x6dae('0x14')][_0x6dae('0x15')]===0x1f4){logger['error'](_0x6dae('0x11'),_0x5c5cbe,_0x28280f[_0x6dae('0x14')][_0x6dae('0x16')]);return _0x4cfdaa(_0x28280f[_0x6dae('0x14')][_0x6dae('0x16')]);}logger[_0x6dae('0x14')]('UserVoiceQueue,\x20%s,\x20%s',_0x5c5cbe,_0x28280f[_0x6dae('0x14')][_0x6dae('0x16')]);return _0x24b16f(_0x28280f[_0x6dae('0x14')][_0x6dae('0x16')]);}else{logger[_0x6dae('0x10')](_0x6dae('0x11'),_0x5c5cbe,_0x6dae('0x12'));_0x24b16f(_0x28280f[_0x6dae('0x17')][_0x6dae('0x16')]);}})[_0x6dae('0x18')](function(_0x34e475){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x5c5cbe,_0x34e475);_0x4cfdaa(_0x34e475);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index f541ae0..f236ccf 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1a002f,_0x48039c){var _0x2591cb=function(_0x57f055){while(--_0x57f055){_0x1a002f['push'](_0x1a002f['shift']());}};_0x2591cb(++_0x48039c);}(_0xe706,0xa3));var _0x6e70=function(_0x303c30,_0x16edcb){_0x303c30=_0x303c30-0x0;var _0x43161b=_0xe706[_0x303c30];return _0x43161b;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3653ab,_0x418bd6){var _0x2a79ea=function(_0x4d9e68){while(--_0x4d9e68){_0x3653ab['push'](_0x3653ab['shift']());}};_0x2a79ea(++_0x418bd6);}(_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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index fa1466a..9246495 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 _0x6363=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0x6363,0x13a));var _0x3636=function(_0x10c364,_0x58a3ca){_0x10c364=_0x10c364-0x0;var _0x2b1095=_0x6363[_0x10c364];return _0x2b1095;};'use strict';var Sequelize=require(_0x3636('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x3636('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x3636('0x2')},'membername':{'type':Sequelize[_0x3636('0x3')],'allowNull':![],'comment':_0x3636('0x2')},'UserId':{'type':Sequelize[_0x3636('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x3636('0x3')],'allowNull':![],'unique':_0x3636('0x4'),'comment':_0x3636('0x2')},'VoiceQueueId':{'type':Sequelize[_0x3636('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x3636('0x3')],'allowNull':![],'unique':_0x3636('0x4'),'comment':_0x3636('0x2')},'penalty':{'type':Sequelize[_0x3636('0x1')](0xb),'defaultValue':0x0,'comment':_0x3636('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x3636('0x2')}}; \ No newline at end of file +var _0x83b4=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x27f0ed,_0xa0a04a){var _0x575a02=function(_0x324c1e){while(--_0x324c1e){_0x27f0ed['push'](_0x27f0ed['shift']());}};_0x575a02(++_0xa0a04a);}(_0x83b4,0xc4));var _0x483b=function(_0x3980bc,_0x3f0c85){_0x3980bc=_0x3980bc-0x0;var _0x57a396=_0x83b4[_0x3980bc];return _0x57a396;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x483b('0x0')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x483b('0x1')},'membername':{'type':Sequelize[_0x483b('0x2')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x483b('0x3'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x483b('0x0')],'allowNull':![]},'interface':{'type':Sequelize[_0x483b('0x2')],'allowNull':![],'unique':_0x483b('0x3'),'comment':_0x483b('0x1')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x483b('0x1')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x483b('0x1')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index d3e21f3..c873f6f 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 _0xa737=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa737,0x13a));var _0x7a73=function(_0x2ff238,_0x1811d2){_0x2ff238=_0x2ff238-0x0;var _0x204a56=_0xa737[_0x2ff238];return _0x204a56;};'use strict';var EventEmitter=require(_0x7a73('0x0'));var UserVoiceQueueRt=require(_0x7a73('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x7a73('0x2')](0x0);var events={'afterCreate':_0x7a73('0x3'),'afterUpdate':_0x7a73('0x4'),'afterDestroy':_0x7a73('0x5')};function emitEvent(_0x4e7dc7){return function(_0x331829,_0x3d133d,_0x43cff3){UserVoiceQueueRtEvents[_0x7a73('0x6')](_0x4e7dc7+':'+_0x331829['id'],_0x331829);UserVoiceQueueRtEvents[_0x7a73('0x6')](_0x4e7dc7,_0x331829);_0x43cff3(null);};}for(var e in events){if(events[_0x7a73('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x7a73('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x7c5c=['hasOwnProperty','hook','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','emit'];(function(_0x1bc426,_0x39900d){var _0x1b30c5=function(_0x27a6e2){while(--_0x27a6e2){_0x1bc426['push'](_0x1bc426['shift']());}};_0x1b30c5(++_0x39900d);}(_0x7c5c,0xd2));var _0xc7c5=function(_0x449d22,_0x426e32){_0x449d22=_0x449d22-0x0;var _0x1e62a6=_0x7c5c[_0x449d22];return _0x1e62a6;};'use strict';var EventEmitter=require(_0xc7c5('0x0'));var UserVoiceQueueRt=require(_0xc7c5('0x1'))['db'][_0xc7c5('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xc7c5('0x3')](0x0);var events={'afterCreate':_0xc7c5('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x14a577){return function(_0x672423,_0x481fe3,_0x2f818a){UserVoiceQueueRtEvents['emit'](_0x14a577+':'+_0x672423['id'],_0x672423);UserVoiceQueueRtEvents[_0xc7c5('0x5')](_0x14a577,_0x672423);_0x2f818a(null);};}for(var e in events){if(events[_0xc7c5('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xc7c5('0x7')](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 e8383ec..db96497 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 _0xa650=['moment','bluebird','./userVoiceQueueRt.attributes','exports','lodash','util','../../config/logger','api'];(function(_0x2becba,_0x4ea656){var _0x90b5dd=function(_0x26ae2b){while(--_0x26ae2b){_0x2becba['push'](_0x2becba['shift']());}};_0x90b5dd(++_0x4ea656);}(_0xa650,0x1ec));var _0x0a65=function(_0x7d7b8e,_0x385edb){_0x7d7b8e=_0x7d7b8e-0x0;var _0xd37570=_0xa650[_0x7d7b8e];return _0xd37570;};'use strict';var _=require(_0x0a65('0x0'));var util=require(_0x0a65('0x1'));var logger=require(_0x0a65('0x2'))(_0x0a65('0x3'));var moment=require(_0x0a65('0x4'));var BPromise=require(_0x0a65('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0a65('0x6'));module[_0x0a65('0x7')]=function(_0x5ecc20,_0x30dee4){return _0x5ecc20['define']('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b0d=['bluebird','request-promise','../../config/environment','./userVoiceQueueRt.attributes','exports','define','lodash','util','api','moment'];(function(_0x3c71a6,_0x1ce820){var _0xd22e0d=function(_0x204631){while(--_0x204631){_0x3c71a6['push'](_0x3c71a6['shift']());}};_0xd22e0d(++_0x1ce820);}(_0x9b0d,0x9c));var _0xd9b0=function(_0x42a9dc,_0x27818b){_0x42a9dc=_0x42a9dc-0x0;var _0x40f0cf=_0x9b0d[_0x42a9dc];return _0x40f0cf;};'use strict';var _=require(_0xd9b0('0x0'));var util=require(_0xd9b0('0x1'));var logger=require('../../config/logger')(_0xd9b0('0x2'));var moment=require(_0xd9b0('0x3'));var BPromise=require(_0xd9b0('0x4'));var rp=require(_0xd9b0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd9b0('0x6'));var attributes=require(_0xd9b0('0x7'));module[_0xd9b0('0x8')]=function(_0x19881e,_0xe25aad){return _0x19881e[_0xd9b0('0x9')]('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index cbd319f..0bf3752 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 _0x202f=['request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','outboundQueuePauses','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register'];(function(_0x34656e,_0x44e278){var _0x536e85=function(_0x3d4bab){while(--_0x3d4bab){_0x34656e['push'](_0x34656e['shift']());}};_0x536e85(++_0x44e278);}(_0x202f,0xad));var _0xf202=function(_0x1608ea,_0x551d0e){_0x1608ea=_0x1608ea-0x0;var _0x3b9bff=_0x202f[_0x1608ea];return _0x3b9bff;};'use strict';var _=require(_0xf202('0x0'));var util=require(_0xf202('0x1'));var moment=require(_0xf202('0x2'));var BPromise=require(_0xf202('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf202('0x4'));var db=require(_0xf202('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf202('0x6'))(_0xf202('0x7'));var config=require(_0xf202('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf202('0x9')][_0xf202('0xa')]({'port':0x232a});config['redis']=_[_0xf202('0xb')](config[_0xf202('0xc')],{'host':_0xf202('0xd'),'port':0x18eb});var socket=require(_0xf202('0xe'))(new Redis(config[_0xf202('0xc')]));require(_0xf202('0xf'))[_0xf202('0x10')](socket);function respondWithRpcPromise(_0x4b59a7,_0x4a0544,_0x17ca07){return new BPromise(function(_0x4bce03,_0x4338e7){return client[_0xf202('0x11')](_0x4b59a7,_0x17ca07)[_0xf202('0x12')](function(_0x44e3d5){logger['info'](_0xf202('0x13'),_0x4a0544,_0xf202('0x14'));logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x4a0544,'request\x20sent',JSON[_0xf202('0x15')](_0x44e3d5));if(_0x44e3d5['error']){if(_0x44e3d5[_0xf202('0x16')][_0xf202('0x17')]===0x1f4){logger[_0xf202('0x16')](_0xf202('0x13'),_0x4a0544,_0x44e3d5[_0xf202('0x16')]['message']);return _0x4338e7(_0x44e3d5[_0xf202('0x16')][_0xf202('0x18')]);}logger[_0xf202('0x16')](_0xf202('0x13'),_0x4a0544,_0x44e3d5[_0xf202('0x16')]['message']);return _0x4bce03(_0x44e3d5['error']['message']);}else{logger[_0xf202('0x19')](_0xf202('0x13'),_0x4a0544,_0xf202('0x14'));_0x4bce03(_0x44e3d5[_0xf202('0x1a')][_0xf202('0x18')]);}})['catch'](function(_0x176d17){logger[_0xf202('0x16')](_0xf202('0x13'),_0x4a0544,_0x176d17);_0x4338e7(_0x176d17);});});}exports[_0xf202('0x1b')]=function(_0x47ad6c){var _0x38eeb1=this;return new Promise(function(_0x2ab40a,_0x47dbb2){return db[_0xf202('0x1c')][_0xf202('0x1d')]({'raw':_0x47ad6c[_0xf202('0x1e')]?_0x47ad6c[_0xf202('0x1e')][_0xf202('0x1f')]===undefined?!![]:![]:!![],'where':_0x47ad6c[_0xf202('0x1e')]?_0x47ad6c[_0xf202('0x1e')][_0xf202('0x20')]||null:null,'attributes':[[db[_0xf202('0x21')]['fn'](_0xf202('0x22'),db['sequelize']['fn']('IF',db[_0xf202('0x21')][_0xf202('0x23')]('`paused`\x20=\x201,\x201,\x20null'))),_0xf202('0x24')]]})['then'](function(_0x2c853){logger[_0xf202('0x19')]('GetVoiceQueueRtPauses',_0x47ad6c);logger['debug'](_0xf202('0x1b'),_0x47ad6c,JSON[_0xf202('0x15')](_0x2c853));_0x2ab40a(_0x2c853);})[_0xf202('0x25')](function(_0x3b8dde){logger[_0xf202('0x16')](_0xf202('0x1b'),_0x3b8dde[_0xf202('0x18')],_0x47ad6c);_0x47dbb2(_0x38eeb1[_0xf202('0x16')](0x1f4,_0x3b8dde[_0xf202('0x18')]));});});}; \ No newline at end of file +var _0x6f2c=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','UserVoiceQueueRt,\x20%s,\x20%s','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','info','lodash','util'];(function(_0x15b380,_0x1a3c5f){var _0x232c5c=function(_0x12f8e0){while(--_0x12f8e0){_0x15b380['push'](_0x15b380['shift']());}};_0x232c5c(++_0x1a3c5f);}(_0x6f2c,0x1ea));var _0xc6f2=function(_0x5489b0,_0x2007ef){_0x5489b0=_0x5489b0-0x0;var _0x46a0b6=_0x6f2c[_0x5489b0];return _0x46a0b6;};'use strict';var _=require(_0xc6f2('0x0'));var util=require(_0xc6f2('0x1'));var moment=require(_0xc6f2('0x2'));var BPromise=require(_0xc6f2('0x3'));var rs=require(_0xc6f2('0x4'));var fs=require('fs');var Redis=require(_0xc6f2('0x5'));var db=require(_0xc6f2('0x6'))['db'];var utils=require(_0xc6f2('0x7'));var logger=require(_0xc6f2('0x8'))(_0xc6f2('0x9'));var config=require(_0xc6f2('0xa'));var jayson=require(_0xc6f2('0xb'));var client=jayson[_0xc6f2('0xc')][_0xc6f2('0xd')]({'port':0x232a});config[_0xc6f2('0xe')]=_['defaults'](config[_0xc6f2('0xe')],{'host':_0xc6f2('0xf'),'port':0x18eb});var socket=require(_0xc6f2('0x10'))(new Redis(config[_0xc6f2('0xe')]));require(_0xc6f2('0x11'))[_0xc6f2('0x12')](socket);function respondWithRpcPromise(_0x56aacf,_0x3563a1,_0x560be7){return new BPromise(function(_0x2c4fa7,_0x10cbee){return client[_0xc6f2('0x13')](_0x56aacf,_0x560be7)['then'](function(_0x1f2fad){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x3563a1,_0xc6f2('0x14'));logger[_0xc6f2('0x15')](_0xc6f2('0x16'),_0x3563a1,'request\x20sent',JSON[_0xc6f2('0x17')](_0x1f2fad));if(_0x1f2fad[_0xc6f2('0x18')]){if(_0x1f2fad[_0xc6f2('0x18')]['code']===0x1f4){logger[_0xc6f2('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3563a1,_0x1f2fad[_0xc6f2('0x18')]['message']);return _0x10cbee(_0x1f2fad[_0xc6f2('0x18')][_0xc6f2('0x19')]);}logger[_0xc6f2('0x18')](_0xc6f2('0x1a'),_0x3563a1,_0x1f2fad[_0xc6f2('0x18')][_0xc6f2('0x19')]);return _0x2c4fa7(_0x1f2fad[_0xc6f2('0x18')][_0xc6f2('0x19')]);}else{logger['info'](_0xc6f2('0x1a'),_0x3563a1,_0xc6f2('0x14'));_0x2c4fa7(_0x1f2fad[_0xc6f2('0x1b')][_0xc6f2('0x19')]);}})[_0xc6f2('0x1c')](function(_0x1fa99c){logger[_0xc6f2('0x18')](_0xc6f2('0x1a'),_0x3563a1,_0x1fa99c);_0x10cbee(_0x1fa99c);});});}exports[_0xc6f2('0x1d')]=function(_0x57c30b){var _0x19f67a=this;return new Promise(function(_0x980e50,_0x33f150){return db[_0xc6f2('0x1e')][_0xc6f2('0x1f')]({'raw':_0x57c30b[_0xc6f2('0x20')]?_0x57c30b[_0xc6f2('0x20')][_0xc6f2('0x21')]===undefined?!![]:![]:!![],'where':_0x57c30b[_0xc6f2('0x20')]?_0x57c30b[_0xc6f2('0x20')][_0xc6f2('0x22')]||null:null,'attributes':[[db[_0xc6f2('0x23')]['fn']('COUNT',db[_0xc6f2('0x23')]['fn']('IF',db[_0xc6f2('0x23')][_0xc6f2('0x24')](_0xc6f2('0x25')))),_0xc6f2('0x26')]]})[_0xc6f2('0x27')](function(_0x42185b){logger[_0xc6f2('0x28')](_0xc6f2('0x1d'),_0x57c30b);logger[_0xc6f2('0x15')](_0xc6f2('0x1d'),_0x57c30b,JSON[_0xc6f2('0x17')](_0x42185b));_0x980e50(_0x42185b);})['catch'](function(_0x1b39cb){logger[_0xc6f2('0x18')](_0xc6f2('0x1d'),_0x1b39cb[_0xc6f2('0x19')],_0x57c30b);_0x33f150(_0x19f67a[_0xc6f2('0x18')](0x1f4,_0x1b39cb['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 7e73e95..cb8b2ac 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 _0x06bf=['./userVoiceQueueRt.events','save','remove','update','emit','removeListener','register','length','userVoiceQueueRt:'];(function(_0x1cb02e,_0x8c4089){var _0x2ab269=function(_0x20554b){while(--_0x20554b){_0x1cb02e['push'](_0x1cb02e['shift']());}};_0x2ab269(++_0x8c4089);}(_0x06bf,0x105));var _0xf06b=function(_0x35d0df,_0x1208e5){_0x35d0df=_0x35d0df-0x0;var _0x50bb6c=_0x06bf[_0x35d0df];return _0x50bb6c;};'use strict';var UserVoiceQueueRtEvents=require(_0xf06b('0x0'));var events=[_0xf06b('0x1'),_0xf06b('0x2'),_0xf06b('0x3')];function createListener(_0x38cc26,_0x27110f){return function(_0x445729){_0x27110f[_0xf06b('0x4')](_0x38cc26,_0x445729);};}function removeListener(_0x50768d,_0x7ddc88){return function(){UserVoiceQueueRtEvents[_0xf06b('0x5')](_0x50768d,_0x7ddc88);};}exports[_0xf06b('0x6')]=function(_0x502d7f){for(var _0x2f1d0e=0x0,_0xb69d30=events[_0xf06b('0x7')];_0x2f1d0e<_0xb69d30;_0x2f1d0e++){var _0x7a4950=events[_0x2f1d0e];var _0x5196ed=createListener(_0xf06b('0x8')+_0x7a4950,_0x502d7f);UserVoiceQueueRtEvents['on'](_0x7a4950,_0x5196ed);}}; \ No newline at end of file +var _0x9b2c=['register','length','userVoiceQueueRt:','save','remove','removeListener'];(function(_0x106db6,_0xd6decc){var _0x4dc175=function(_0x14c433){while(--_0x14c433){_0x106db6['push'](_0x106db6['shift']());}};_0x4dc175(++_0xd6decc);}(_0x9b2c,0x189));var _0xc9b2=function(_0x44268d,_0xad8443){_0x44268d=_0x44268d-0x0;var _0x4be92d=_0x9b2c[_0x44268d];return _0x4be92d;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xc9b2('0x0'),_0xc9b2('0x1'),'update'];function createListener(_0x140704,_0x54dbb1){return function(_0x102cd6){_0x54dbb1['emit'](_0x140704,_0x102cd6);};}function removeListener(_0xdbbe00,_0x26a747){return function(){UserVoiceQueueRtEvents[_0xc9b2('0x2')](_0xdbbe00,_0x26a747);};}exports[_0xc9b2('0x3')]=function(_0x15be55){for(var _0x3e6343=0x0,_0x3ab6d0=events[_0xc9b2('0x4')];_0x3e6343<_0x3ab6d0;_0x3e6343++){var _0x440a3f=events[_0x3e6343];var _0x224ce6=createListener(_0xc9b2('0x5')+_0x440a3f,_0x15be55);UserVoiceQueueRtEvents['on'](_0x440a3f,_0x224ce6);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 9604e1b..5f46367 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x483a60,_0x3e3716){var _0x14181f=function(_0x1c2c0e){while(--_0x1c2c0e){_0x483a60['push'](_0x483a60['shift']());}};_0x14181f(++_0x3e3716);}(_0xedd9,0xfc));var _0x9edd=function(_0x3ca1f8,_0x4afa33){_0x3ca1f8=_0x3ca1f8-0x0;var _0x94fb6b=_0xedd9[_0x3ca1f8];return _0x94fb6b;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x53a514,_0x3e9d36){var _0x4c17d4=function(_0x4a296b){while(--_0x4a296b){_0x53a514['push'](_0x53a514['shift']());}};_0x4c17d4(++_0x3e9d36);}(_0x70e0,0x17b));var _0x070e=function(_0x5c39c2,_0x4ae8cf){_0x5c39c2=_0x5c39c2-0x0;var _0xf12b4e=_0x70e0[_0x5c39c2];return _0xf12b4e;};'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 1233ffa..5dd3214 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 _0x0504=['INTEGER','exports'];(function(_0x1c34ff,_0x3da343){var _0x4a03c2=function(_0x413881){while(--_0x413881){_0x1c34ff['push'](_0x1c34ff['shift']());}};_0x4a03c2(++_0x3da343);}(_0x0504,0x147));var _0x4050=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0504[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require('sequelize');module[_0x4050('0x0')]={'penalty':{'type':Sequelize[_0x4050('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8bda=['exports','INTEGER','sequelize'];(function(_0x52482f,_0x5150f5){var _0x4f0f5f=function(_0x484a10){while(--_0x484a10){_0x52482f['push'](_0x52482f['shift']());}};_0x4f0f5f(++_0x5150f5);}(_0x8bda,0x104));var _0xa8bd=function(_0x5e3701,_0x596265){_0x5e3701=_0x5e3701-0x0;var _0x345dcf=_0x8bda[_0x5e3701];return _0x345dcf;};'use strict';var Sequelize=require(_0xa8bd('0x0'));module[_0xa8bd('0x1')]={'penalty':{'type':Sequelize[_0xa8bd('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 9d99637..71030ed 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 _0xb66a=['moment','request-promise','path','rimraf','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','lodash','util'];(function(_0x3c1a5b,_0x118338){var _0x538aa8=function(_0x182f09){while(--_0x182f09){_0x3c1a5b['push'](_0x3c1a5b['shift']());}};_0x538aa8(++_0x118338);}(_0xb66a,0x15c));var _0xab66=function(_0x1ca6c3,_0x301879){_0x1ca6c3=_0x1ca6c3-0x0;var _0x4a34e9=_0xb66a[_0x1ca6c3];return _0x4a34e9;};'use strict';var _=require(_0xab66('0x0'));var util=require(_0xab66('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xab66('0x2'));var BPromise=require('bluebird');var rp=require(_0xab66('0x3'));var fs=require('fs');var path=require(_0xab66('0x4'));var rimraf=require(_0xab66('0x5'));var config=require('../../config/environment');var attributes=require(_0xab66('0x6'));module[_0xab66('0x7')]=function(_0x5d600f,_0xb45fcb){return _0x5d600f[_0xab66('0x8')]('UserWhatsappQueue',attributes,{'tableName':_0xab66('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd502=['user_has_whatsapp_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xd502,0x12c));var _0x2d50=function(_0x64bfd5,_0x26eed5){_0x64bfd5=_0x64bfd5-0x0;var _0x4f191e=_0xd502[_0x64bfd5];return _0x4f191e;};'use strict';var _=require('lodash');var util=require(_0x2d50('0x0'));var logger=require(_0x2d50('0x1'))(_0x2d50('0x2'));var moment=require(_0x2d50('0x3'));var BPromise=require(_0x2d50('0x4'));var rp=require(_0x2d50('0x5'));var fs=require('fs');var path=require(_0x2d50('0x6'));var rimraf=require(_0x2d50('0x7'));var config=require('../../config/environment');var attributes=require(_0x2d50('0x8'));module[_0x2d50('0x9')]=function(_0x1715ef,_0x566caf){return _0x1715ef[_0x2d50('0xa')](_0x2d50('0xb'),attributes,{'tableName':_0x2d50('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 1d06c3d..df8236d 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 _0x7e6f=['../../config/environment','jayson/promise','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','util','bluebird','randomstring','../../config/logger'];(function(_0x59fcd0,_0x2c55b0){var _0x4fe0b7=function(_0x276b71){while(--_0x276b71){_0x59fcd0['push'](_0x59fcd0['shift']());}};_0x4fe0b7(++_0x2c55b0);}(_0x7e6f,0xea));var _0xf7e6=function(_0x21c766,_0x9c4309){_0x21c766=_0x21c766-0x0;var _0x3ef300=_0x7e6f[_0x21c766];return _0x3ef300;};'use strict';var _=require('lodash');var util=require(_0xf7e6('0x0'));var moment=require('moment');var BPromise=require(_0xf7e6('0x1'));var rs=require(_0xf7e6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf7e6('0x3'))('rpc');var config=require(_0xf7e6('0x4'));var jayson=require(_0xf7e6('0x5'));var client=jayson['client'][_0xf7e6('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x518f2b,_0x19d314,_0x37391d){return new BPromise(function(_0x988ccf,_0x594177){return client[_0xf7e6('0x7')](_0x518f2b,_0x37391d)[_0xf7e6('0x8')](function(_0x506ed9){logger[_0xf7e6('0x9')](_0xf7e6('0xa'),_0x19d314,'request\x20sent');logger['debug'](_0xf7e6('0xb'),_0x19d314,_0xf7e6('0xc'),JSON[_0xf7e6('0xd')](_0x506ed9));if(_0x506ed9[_0xf7e6('0xe')]){if(_0x506ed9['error']['code']===0x1f4){logger[_0xf7e6('0xe')](_0xf7e6('0xa'),_0x19d314,_0x506ed9[_0xf7e6('0xe')][_0xf7e6('0xf')]);return _0x594177(_0x506ed9['error'][_0xf7e6('0xf')]);}logger[_0xf7e6('0xe')](_0xf7e6('0xa'),_0x19d314,_0x506ed9[_0xf7e6('0xe')][_0xf7e6('0xf')]);return _0x988ccf(_0x506ed9[_0xf7e6('0xe')][_0xf7e6('0xf')]);}else{logger[_0xf7e6('0x9')]('UserWhatsappQueue,\x20%s,\x20%s',_0x19d314,_0xf7e6('0xc'));_0x988ccf(_0x506ed9['result']['message']);}})[_0xf7e6('0x10')](function(_0x290dc5){logger['error'](_0xf7e6('0xa'),_0x19d314,_0x290dc5);_0x594177(_0x290dc5);});});} \ No newline at end of file +var _0x8b4f=['rpc','../../config/environment','http','then','info','request\x20sent','debug','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x163ecf,_0x5ba049){var _0x91c7af=function(_0xf443c3){while(--_0xf443c3){_0x163ecf['push'](_0x163ecf['shift']());}};_0x91c7af(++_0x5ba049);}(_0x8b4f,0x77));var _0xf8b4=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x8b4f[_0x49b207];return _0x2dc8fa;};'use strict';var _=require('lodash');var util=require(_0xf8b4('0x0'));var moment=require(_0xf8b4('0x1'));var BPromise=require(_0xf8b4('0x2'));var rs=require(_0xf8b4('0x3'));var fs=require('fs');var Redis=require(_0xf8b4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf8b4('0x5'));var logger=require(_0xf8b4('0x6'))(_0xf8b4('0x7'));var config=require(_0xf8b4('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf8b4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x83f79e,_0x28d18c,_0x16c9e1){return new BPromise(function(_0x54bce7,_0x3825ec){return client['request'](_0x83f79e,_0x16c9e1)[_0xf8b4('0xa')](function(_0x2b34a9){logger[_0xf8b4('0xb')]('UserWhatsappQueue,\x20%s,\x20%s',_0x28d18c,_0xf8b4('0xc'));logger[_0xf8b4('0xd')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x28d18c,_0xf8b4('0xc'),JSON[_0xf8b4('0xe')](_0x2b34a9));if(_0x2b34a9[_0xf8b4('0xf')]){if(_0x2b34a9['error'][_0xf8b4('0x10')]===0x1f4){logger[_0xf8b4('0xf')](_0xf8b4('0x11'),_0x28d18c,_0x2b34a9[_0xf8b4('0xf')][_0xf8b4('0x12')]);return _0x3825ec(_0x2b34a9[_0xf8b4('0xf')]['message']);}logger[_0xf8b4('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0x28d18c,_0x2b34a9[_0xf8b4('0xf')][_0xf8b4('0x12')]);return _0x54bce7(_0x2b34a9[_0xf8b4('0xf')][_0xf8b4('0x12')]);}else{logger['info'](_0xf8b4('0x11'),_0x28d18c,_0xf8b4('0xc'));_0x54bce7(_0x2b34a9[_0xf8b4('0x13')]['message']);}})[_0xf8b4('0x14')](function(_0x23e1a8){logger[_0xf8b4('0xf')](_0xf8b4('0x11'),_0x28d18c,_0x23e1a8);_0x3825ec(_0x23e1a8);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 6e00d6d..17f2df7 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 _0x544a=['./variable.controller','get','isAuthenticated','index','post','put','/:id','update','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5b5d9e,_0x6029da){var _0x2ba0c3=function(_0x22ecdf){while(--_0x22ecdf){_0x5b5d9e['push'](_0x5b5d9e['shift']());}};_0x2ba0c3(++_0x6029da);}(_0x544a,0xbd));var _0xa544=function(_0x5b9000,_0x51721a){_0x5b9000=_0x5b9000-0x0;var _0x7eebdd=_0x544a[_0x5b9000];return _0x7eebdd;};'use strict';var multer=require(_0xa544('0x0'));var util=require(_0xa544('0x1'));var path=require(_0xa544('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa544('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa544('0x4'));var interaction=require(_0xa544('0x5'));var config=require('../../config/environment');var controller=require(_0xa544('0x6'));router[_0xa544('0x7')]('/',auth[_0xa544('0x8')](),controller[_0xa544('0x9')]);router[_0xa544('0x7')]('/:id',auth[_0xa544('0x8')](),controller['show']);router[_0xa544('0xa')]('/',auth[_0xa544('0x8')](),controller['create']);router[_0xa544('0xb')](_0xa544('0xc'),auth[_0xa544('0x8')](),controller[_0xa544('0xd')]);router['delete'](_0xa544('0xc'),auth[_0xa544('0x8')](),controller['destroy']);module[_0xa544('0xe')]=router; \ No newline at end of file +var _0xca66=['delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update'];(function(_0x2b9839,_0x32ce9a){var _0x39d934=function(_0x171e1a){while(--_0x171e1a){_0x2b9839['push'](_0x2b9839['shift']());}};_0x39d934(++_0x32ce9a);}(_0xca66,0x8b));var _0x6ca6=function(_0x53373f,_0x2855d1){_0x53373f=_0x53373f-0x0;var _0x62c801=_0xca66[_0x53373f];return _0x62c801;};'use strict';var multer=require(_0x6ca6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6ca6('0x1'));var express=require(_0x6ca6('0x2'));var router=express[_0x6ca6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6ca6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6ca6('0x5'));var controller=require('./variable.controller');router[_0x6ca6('0x6')]('/',auth[_0x6ca6('0x7')](),controller[_0x6ca6('0x8')]);router[_0x6ca6('0x6')](_0x6ca6('0x9'),auth[_0x6ca6('0x7')](),controller[_0x6ca6('0xa')]);router['post']('/',auth[_0x6ca6('0x7')](),controller[_0x6ca6('0xb')]);router[_0x6ca6('0xc')](_0x6ca6('0x9'),auth[_0x6ca6('0x7')](),controller[_0x6ca6('0xd')]);router[_0x6ca6('0xe')]('/:id',auth[_0x6ca6('0x7')](),controller[_0x6ca6('0xf')]);module[_0x6ca6('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 35bcf24..5f919a2 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 _0xf6d0=['STRING','sequelize','name'];(function(_0x992bae,_0x490c8f){var _0x4153c1=function(_0x23f89d){while(--_0x23f89d){_0x992bae['push'](_0x992bae['shift']());}};_0x4153c1(++_0x490c8f);}(_0xf6d0,0x163));var _0x0f6d=function(_0x34e2b9,_0x1bda07){_0x34e2b9=_0x34e2b9-0x0;var _0x28448f=_0xf6d0[_0x34e2b9];return _0x28448f;};'use strict';var Sequelize=require(_0x0f6d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x0f6d('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0f6d('0x2')]}}; \ No newline at end of file +var _0xd9a7=['exports','STRING'];(function(_0x39bfb1,_0x5ac08e){var _0x16c525=function(_0x4ffaf5){while(--_0x4ffaf5){_0x39bfb1['push'](_0x39bfb1['shift']());}};_0x16c525(++_0x5ac08e);}(_0xd9a7,0x12c));var _0x7d9a=function(_0x3276f7,_0x3045c7){_0x3276f7=_0x3276f7-0x0;var _0x5acdfe=_0xd9a7[_0x3276f7];return _0x5acdfe;};'use strict';var Sequelize=require('sequelize');module[_0x7d9a('0x0')]={'name':{'type':Sequelize[_0x7d9a('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7d9a('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 09b5f68..54c46d0 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 _0xb9a8=['then','destroy','Variables','stack','name','send','index','fieldName','type','model','map','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','Variable','include','findAll','rows','catch','show','keys','rawAttributes','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update'];(function(_0x2b7fd3,_0x17556d){var _0x1bd260=function(_0x5d82dd){while(--_0x5d82dd){_0x2b7fd3['push'](_0x2b7fd3['shift']());}};_0x1bd260(++_0x17556d);}(_0xb9a8,0x87));var _0x8b9a=function(_0x5e38b0,_0x5094e7){_0x5e38b0=_0x5e38b0-0x0;var _0x456b18=_0xb9a8[_0x5e38b0];return _0x456b18;};'use strict';var emlformat=require(_0x8b9a('0x0'));var rimraf=require(_0x8b9a('0x1'));var zipdir=require(_0x8b9a('0x2'));var jsonpatch=require(_0x8b9a('0x3'));var rp=require(_0x8b9a('0x4'));var moment=require('moment');var BPromise=require(_0x8b9a('0x5'));var Mustache=require(_0x8b9a('0x6'));var util=require(_0x8b9a('0x7'));var path=require(_0x8b9a('0x8'));var sox=require('sox');var csv=require(_0x8b9a('0x9'));var ejs=require(_0x8b9a('0xa'));var fs=require('fs');var fs_extra=require(_0x8b9a('0xb'));var _=require(_0x8b9a('0xc'));var squel=require(_0x8b9a('0xd'));var crypto=require(_0x8b9a('0xe'));var jsforce=require(_0x8b9a('0xf'));var deskjs=require(_0x8b9a('0x10'));var toCsv=require(_0x8b9a('0x9'));var querystring=require(_0x8b9a('0x11'));var Papa=require(_0x8b9a('0x12'));var Redis=require(_0x8b9a('0x13'));var authService=require(_0x8b9a('0x14'));var qs=require(_0x8b9a('0x15'));var as=require(_0x8b9a('0x16'));var hardwareService=require(_0x8b9a('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x8b9a('0x18'));var config=require(_0x8b9a('0x19'));var licenseUtil=require(_0x8b9a('0x1a'));var db=require(_0x8b9a('0x1b'))['db'];function respondWithStatusCode(_0x142256,_0x1d43ef){_0x1d43ef=_0x1d43ef||0xcc;return function(_0x5d320c){if(_0x5d320c){return _0x142256[_0x8b9a('0x1c')](_0x1d43ef);}return _0x142256[_0x8b9a('0x1d')](_0x1d43ef)[_0x8b9a('0x1e')]();};}function respondWithResult(_0x2d909b,_0x5e85ac){_0x5e85ac=_0x5e85ac||0xc8;return function(_0x1d763c){if(_0x1d763c){return _0x2d909b[_0x8b9a('0x1d')](_0x5e85ac)[_0x8b9a('0x1f')](_0x1d763c);}};}function respondWithFilteredResult(_0x151441,_0x38ef79){return function(_0x26673c){if(_0x26673c){var _0x570609=typeof _0x38ef79[_0x8b9a('0x20')]===_0x8b9a('0x21')&&typeof _0x38ef79[_0x8b9a('0x22')]===_0x8b9a('0x21');var _0x3a166c=_0x26673c[_0x8b9a('0x23')];var _0x4d0083=_0x570609?0x0:_0x38ef79['offset'];var _0x4ac972=_0x570609?_0x26673c[_0x8b9a('0x23')]:_0x38ef79[_0x8b9a('0x20')]+_0x38ef79[_0x8b9a('0x22')];var _0x4afaad;if(_0x4ac972>=_0x3a166c){_0x4ac972=_0x3a166c;_0x4afaad=0xc8;}else{_0x4afaad=0xce;}_0x151441['status'](_0x4afaad);return _0x151441['set'](_0x8b9a('0x24'),_0x4d0083+'-'+_0x4ac972+'/'+_0x3a166c)['json'](_0x26673c);}return null;};}function patchUpdates(_0x43f91c){return function(_0x5a6821){try{jsonpatch[_0x8b9a('0x25')](_0x5a6821,_0x43f91c,!![]);}catch(_0x214247){return BPromise[_0x8b9a('0x26')](_0x214247);}return _0x5a6821[_0x8b9a('0x27')]();};}function saveUpdates(_0x1e2a06,_0x405f20){return function(_0x471451){if(_0x471451){return _0x471451[_0x8b9a('0x28')](_0x1e2a06)[_0x8b9a('0x29')](function(_0x2ac2cb){return _0x2ac2cb;});}return null;};}function removeEntity(_0x19b646,_0x23f50c){return function(_0x45399e){if(_0x45399e){return _0x45399e[_0x8b9a('0x2a')]()[_0x8b9a('0x29')](function(){var _0x229063=_0x45399e['get']({'plain':!![]});var _0x333c9f=_0x8b9a('0x2b');return db['UserProfileResource'][_0x8b9a('0x2a')]({'where':{'type':_0x333c9f,'resourceId':_0x229063['id']}})[_0x8b9a('0x29')](function(){return _0x45399e;});})[_0x8b9a('0x29')](function(){_0x19b646[_0x8b9a('0x1d')](0xcc)[_0x8b9a('0x1e')]();});}};}function handleEntityNotFound(_0x216831,_0x8ab167){return function(_0x2bf5b3){if(!_0x2bf5b3){_0x216831[_0x8b9a('0x1c')](0x194);}return _0x2bf5b3;};}function handleError(_0x493635,_0x599d26){_0x599d26=_0x599d26||0x1f4;return function(_0x24fb51){logger['error'](_0x24fb51[_0x8b9a('0x2c')]);if(_0x24fb51[_0x8b9a('0x2d')]){delete _0x24fb51['name'];}_0x493635[_0x8b9a('0x1d')](_0x599d26)[_0x8b9a('0x2e')](_0x24fb51);};}exports[_0x8b9a('0x2f')]=function(_0x16527e,_0x4eb580){var _0x48622a={},_0x37f37f={},_0x7e7c2c={'count':0x0,'rows':[]};var _0x253073=_['map'](db['Variable']['rawAttributes'],function(_0x1b980d){return{'name':_0x1b980d[_0x8b9a('0x30')],'type':_0x1b980d[_0x8b9a('0x31')]['key']};});_0x37f37f[_0x8b9a('0x32')]=_[_0x8b9a('0x33')](_0x253073,_0x8b9a('0x2d'));_0x37f37f[_0x8b9a('0x34')]=_['keys'](_0x16527e[_0x8b9a('0x34')]);_0x37f37f['filters']=_[_0x8b9a('0x35')](_0x37f37f[_0x8b9a('0x32')],_0x37f37f[_0x8b9a('0x34')]);_0x48622a[_0x8b9a('0x36')]=_[_0x8b9a('0x35')](_0x37f37f['model'],qs[_0x8b9a('0x37')](_0x16527e[_0x8b9a('0x34')][_0x8b9a('0x37')]));_0x48622a[_0x8b9a('0x36')]=_0x48622a[_0x8b9a('0x36')][_0x8b9a('0x38')]?_0x48622a[_0x8b9a('0x36')]:_0x37f37f['model'];if(!_0x16527e[_0x8b9a('0x34')][_0x8b9a('0x39')]('nolimit')){_0x48622a[_0x8b9a('0x22')]=qs['limit'](_0x16527e[_0x8b9a('0x34')][_0x8b9a('0x22')]);_0x48622a[_0x8b9a('0x20')]=qs['offset'](_0x16527e[_0x8b9a('0x34')][_0x8b9a('0x20')]);}_0x48622a[_0x8b9a('0x3a')]=qs[_0x8b9a('0x3b')](_0x16527e[_0x8b9a('0x34')]['sort']);_0x48622a[_0x8b9a('0x3c')]=qs[_0x8b9a('0x3d')](_[_0x8b9a('0x3e')](_0x16527e[_0x8b9a('0x34')],_0x37f37f[_0x8b9a('0x3d')]),_0x253073);if(_0x16527e[_0x8b9a('0x34')][_0x8b9a('0x3f')]){_0x48622a[_0x8b9a('0x3c')]=_['merge'](_0x48622a['where'],{'$or':_[_0x8b9a('0x33')](_0x253073,function(_0x46b345){if(_0x46b345[_0x8b9a('0x31')]!==_0x8b9a('0x40')){var _0xcdd4af={};_0xcdd4af[_0x46b345[_0x8b9a('0x2d')]]={'$like':'%'+_0x16527e['query']['filter']+'%'};return _0xcdd4af;}})});}_0x48622a=_[_0x8b9a('0x41')]({},_0x48622a,_0x16527e[_0x8b9a('0x42')]);var _0x4f1e0f={'where':_0x48622a[_0x8b9a('0x3c')]};return db[_0x8b9a('0x43')][_0x8b9a('0x23')](_0x4f1e0f)[_0x8b9a('0x29')](function(_0x4dc7e0){_0x7e7c2c[_0x8b9a('0x23')]=_0x4dc7e0;if(_0x16527e[_0x8b9a('0x34')]['includeAll']){_0x48622a[_0x8b9a('0x44')]=[{'all':!![]}];}return db[_0x8b9a('0x43')][_0x8b9a('0x45')](_0x48622a);})[_0x8b9a('0x29')](function(_0x1661e0){_0x7e7c2c[_0x8b9a('0x46')]=_0x1661e0;return _0x7e7c2c;})[_0x8b9a('0x29')](respondWithFilteredResult(_0x4eb580,_0x48622a))[_0x8b9a('0x47')](handleError(_0x4eb580,null));};exports[_0x8b9a('0x48')]=function(_0x110e28,_0x1c9516){var _0x1c432f={'raw':!![],'where':{'id':_0x110e28['params']['id']}},_0x2e9045={};_0x2e9045[_0x8b9a('0x32')]=_[_0x8b9a('0x49')](db[_0x8b9a('0x43')][_0x8b9a('0x4a')]);_0x2e9045[_0x8b9a('0x34')]=_[_0x8b9a('0x49')](_0x110e28[_0x8b9a('0x34')]);_0x2e9045[_0x8b9a('0x3d')]=_[_0x8b9a('0x35')](_0x2e9045[_0x8b9a('0x32')],_0x2e9045[_0x8b9a('0x34')]);_0x1c432f[_0x8b9a('0x36')]=_[_0x8b9a('0x35')](_0x2e9045[_0x8b9a('0x32')],qs[_0x8b9a('0x37')](_0x110e28[_0x8b9a('0x34')][_0x8b9a('0x37')]));_0x1c432f['attributes']=_0x1c432f[_0x8b9a('0x36')]['length']?_0x1c432f[_0x8b9a('0x36')]:_0x2e9045[_0x8b9a('0x32')];if(_0x110e28['query']['includeAll']){_0x1c432f[_0x8b9a('0x44')]=[{'all':!![]}];}_0x1c432f=_[_0x8b9a('0x41')]({},_0x1c432f,_0x110e28[_0x8b9a('0x42')]);return db[_0x8b9a('0x43')][_0x8b9a('0x4b')](_0x1c432f)[_0x8b9a('0x29')](handleEntityNotFound(_0x1c9516,null))[_0x8b9a('0x29')](respondWithResult(_0x1c9516,null))[_0x8b9a('0x47')](handleError(_0x1c9516,null));};exports[_0x8b9a('0x4c')]=function(_0x33cfca,_0xf68fe5){return db['Variable'][_0x8b9a('0x4c')](_0x33cfca['body'],{})[_0x8b9a('0x29')](function(_0x19da9a){var _0x38f86a=_0x33cfca[_0x8b9a('0x4d')][_0x8b9a('0x4e')]({'plain':!![]});if(!_0x38f86a)throw new Error(_0x8b9a('0x4f'));if(_0x38f86a[_0x8b9a('0x50')]==='user'){var _0x26db5e=_0x19da9a[_0x8b9a('0x4e')]({'plain':!![]});var _0x2b4612=_0x8b9a('0x2b');return db[_0x8b9a('0x51')]['find']({'where':{'name':_0x2b4612,'userProfileId':_0x38f86a[_0x8b9a('0x52')]},'raw':!![]})[_0x8b9a('0x29')](function(_0x2e5c8b){if(_0x2e5c8b&&_0x2e5c8b['autoAssociation']===0x0){return db[_0x8b9a('0x53')][_0x8b9a('0x4c')]({'name':_0x26db5e[_0x8b9a('0x2d')],'resourceId':_0x26db5e['id'],'type':_0x2e5c8b['name'],'sectionId':_0x2e5c8b['id']},{})[_0x8b9a('0x29')](function(){return _0x19da9a;});}else{return _0x19da9a;}})[_0x8b9a('0x47')](function(_0x3bad6b){logger[_0x8b9a('0x54')](_0x8b9a('0x55'),_0x3bad6b);throw _0x3bad6b;});}return _0x19da9a;})['then'](respondWithResult(_0xf68fe5,0xc9))[_0x8b9a('0x47')](handleError(_0xf68fe5,null));};exports[_0x8b9a('0x28')]=function(_0x1b8579,_0x1597fc){if(_0x1b8579['body']['id']){delete _0x1b8579[_0x8b9a('0x56')]['id'];}return db[_0x8b9a('0x43')][_0x8b9a('0x4b')]({'where':{'id':_0x1b8579['params']['id']}})[_0x8b9a('0x29')](handleEntityNotFound(_0x1597fc,null))[_0x8b9a('0x29')](saveUpdates(_0x1b8579['body'],null))[_0x8b9a('0x29')](respondWithResult(_0x1597fc,null))['catch'](handleError(_0x1597fc,null));};exports[_0x8b9a('0x2a')]=function(_0x3b0b98,_0x3d4304){return db[_0x8b9a('0x43')][_0x8b9a('0x4b')]({'where':{'id':_0x3b0b98[_0x8b9a('0x57')]['id']}})[_0x8b9a('0x29')](handleEntityNotFound(_0x3d4304,null))[_0x8b9a('0x29')](removeEntity(_0x3d4304,null))[_0x8b9a('0x47')](handleError(_0x3d4304,null));}; \ No newline at end of file +var _0x8bde=['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','../../config/license/util','../../mysqldb','end','json','limit','undefined','count','offset','status','set','Content-Range','save','update','then','destroy','get','Variables','UserProfileResource','sendStatus','name','send','index','map','Variable','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','merge','include','findAll','rows','catch','show','params','length','includeAll','options','find','create','body','user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox'];(function(_0x1db0d2,_0x2c0712){var _0x2a442b=function(_0x28130e){while(--_0x28130e){_0x1db0d2['push'](_0x1db0d2['shift']());}};_0x2a442b(++_0x2c0712);}(_0x8bde,0x9b));var _0xe8bd=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x8bde[_0xc0a3d3];return _0x3386e8;};'use strict';var emlformat=require(_0xe8bd('0x0'));var rimraf=require(_0xe8bd('0x1'));var zipdir=require(_0xe8bd('0x2'));var jsonpatch=require(_0xe8bd('0x3'));var rp=require(_0xe8bd('0x4'));var moment=require(_0xe8bd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe8bd('0x6'));var util=require(_0xe8bd('0x7'));var path=require('path');var sox=require(_0xe8bd('0x8'));var csv=require(_0xe8bd('0x9'));var ejs=require(_0xe8bd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe8bd('0xb'));var squel=require(_0xe8bd('0xc'));var crypto=require(_0xe8bd('0xd'));var jsforce=require(_0xe8bd('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe8bd('0xf'));var Papa=require(_0xe8bd('0x10'));var Redis=require(_0xe8bd('0x11'));var authService=require(_0xe8bd('0x12'));var qs=require(_0xe8bd('0x13'));var as=require(_0xe8bd('0x14'));var hardwareService=require(_0xe8bd('0x15'));var logger=require(_0xe8bd('0x16'))(_0xe8bd('0x17'));var utils=require(_0xe8bd('0x18'));var config=require(_0xe8bd('0x19'));var licenseUtil=require(_0xe8bd('0x1a'));var db=require(_0xe8bd('0x1b'))['db'];function respondWithStatusCode(_0x8d5433,_0x445d76){_0x445d76=_0x445d76||0xcc;return function(_0x3d2fed){if(_0x3d2fed){return _0x8d5433['sendStatus'](_0x445d76);}return _0x8d5433['status'](_0x445d76)[_0xe8bd('0x1c')]();};}function respondWithResult(_0x3186d5,_0x5ae929){_0x5ae929=_0x5ae929||0xc8;return function(_0x4a0789){if(_0x4a0789){return _0x3186d5['status'](_0x5ae929)[_0xe8bd('0x1d')](_0x4a0789);}};}function respondWithFilteredResult(_0x30fb27,_0x3682c4){return function(_0x538569){if(_0x538569){var _0xf504b4=typeof _0x3682c4['offset']==='undefined'&&typeof _0x3682c4[_0xe8bd('0x1e')]===_0xe8bd('0x1f');var _0x253397=_0x538569[_0xe8bd('0x20')];var _0x3f1972=_0xf504b4?0x0:_0x3682c4[_0xe8bd('0x21')];var _0x153c5d=_0xf504b4?_0x538569[_0xe8bd('0x20')]:_0x3682c4[_0xe8bd('0x21')]+_0x3682c4[_0xe8bd('0x1e')];var _0x28f89a;if(_0x153c5d>=_0x253397){_0x153c5d=_0x253397;_0x28f89a=0xc8;}else{_0x28f89a=0xce;}_0x30fb27[_0xe8bd('0x22')](_0x28f89a);return _0x30fb27[_0xe8bd('0x23')](_0xe8bd('0x24'),_0x3f1972+'-'+_0x153c5d+'/'+_0x253397)[_0xe8bd('0x1d')](_0x538569);}return null;};}function patchUpdates(_0x45f596){return function(_0x41c030){try{jsonpatch['apply'](_0x41c030,_0x45f596,!![]);}catch(_0x5afae2){return BPromise['reject'](_0x5afae2);}return _0x41c030[_0xe8bd('0x25')]();};}function saveUpdates(_0x57a279,_0x2e48d4){return function(_0xba07a0){if(_0xba07a0){return _0xba07a0[_0xe8bd('0x26')](_0x57a279)[_0xe8bd('0x27')](function(_0x57caa0){return _0x57caa0;});}return null;};}function removeEntity(_0x536401,_0x34621d){return function(_0x51d659){if(_0x51d659){return _0x51d659[_0xe8bd('0x28')]()[_0xe8bd('0x27')](function(){var _0x53fc9e=_0x51d659[_0xe8bd('0x29')]({'plain':!![]});var _0x454e6a=_0xe8bd('0x2a');return db[_0xe8bd('0x2b')][_0xe8bd('0x28')]({'where':{'type':_0x454e6a,'resourceId':_0x53fc9e['id']}})[_0xe8bd('0x27')](function(){return _0x51d659;});})['then'](function(){_0x536401[_0xe8bd('0x22')](0xcc)[_0xe8bd('0x1c')]();});}};}function handleEntityNotFound(_0x558863,_0x4e8ef6){return function(_0x448edf){if(!_0x448edf){_0x558863[_0xe8bd('0x2c')](0x194);}return _0x448edf;};}function handleError(_0x36767a,_0x52f12f){_0x52f12f=_0x52f12f||0x1f4;return function(_0x4777a5){logger['error'](_0x4777a5['stack']);if(_0x4777a5[_0xe8bd('0x2d')]){delete _0x4777a5['name'];}_0x36767a[_0xe8bd('0x22')](_0x52f12f)[_0xe8bd('0x2e')](_0x4777a5);};}exports[_0xe8bd('0x2f')]=function(_0x3495e2,_0x4bc9ff){var _0xc71ec4={},_0x58545c={},_0x4b448b={'count':0x0,'rows':[]};var _0x59275a=_[_0xe8bd('0x30')](db[_0xe8bd('0x31')]['rawAttributes'],function(_0x22f551){return{'name':_0x22f551[_0xe8bd('0x32')],'type':_0x22f551['type'][_0xe8bd('0x33')]};});_0x58545c[_0xe8bd('0x34')]=_[_0xe8bd('0x30')](_0x59275a,_0xe8bd('0x2d'));_0x58545c[_0xe8bd('0x35')]=_[_0xe8bd('0x36')](_0x3495e2[_0xe8bd('0x35')]);_0x58545c['filters']=_[_0xe8bd('0x37')](_0x58545c[_0xe8bd('0x34')],_0x58545c[_0xe8bd('0x35')]);_0xc71ec4[_0xe8bd('0x38')]=_[_0xe8bd('0x37')](_0x58545c['model'],qs['fields'](_0x3495e2['query'][_0xe8bd('0x39')]));_0xc71ec4[_0xe8bd('0x38')]=_0xc71ec4[_0xe8bd('0x38')]['length']?_0xc71ec4['attributes']:_0x58545c['model'];if(!_0x3495e2[_0xe8bd('0x35')][_0xe8bd('0x3a')](_0xe8bd('0x3b'))){_0xc71ec4['limit']=qs[_0xe8bd('0x1e')](_0x3495e2[_0xe8bd('0x35')][_0xe8bd('0x1e')]);_0xc71ec4['offset']=qs[_0xe8bd('0x21')](_0x3495e2[_0xe8bd('0x35')]['offset']);}_0xc71ec4['order']=qs['sort'](_0x3495e2['query'][_0xe8bd('0x3c')]);_0xc71ec4[_0xe8bd('0x3d')]=qs[_0xe8bd('0x3e')](_[_0xe8bd('0x3f')](_0x3495e2['query'],_0x58545c[_0xe8bd('0x3e')]),_0x59275a);if(_0x3495e2['query']['filter']){_0xc71ec4['where']=_['merge'](_0xc71ec4[_0xe8bd('0x3d')],{'$or':_[_0xe8bd('0x30')](_0x59275a,function(_0x2f55f1){if(_0x2f55f1['type']!=='VIRTUAL'){var _0x588d79={};_0x588d79[_0x2f55f1[_0xe8bd('0x2d')]]={'$like':'%'+_0x3495e2['query']['filter']+'%'};return _0x588d79;}})});}_0xc71ec4=_[_0xe8bd('0x40')]({},_0xc71ec4,_0x3495e2['options']);var _0x299578={'where':_0xc71ec4[_0xe8bd('0x3d')]};return db[_0xe8bd('0x31')]['count'](_0x299578)[_0xe8bd('0x27')](function(_0x27a043){_0x4b448b['count']=_0x27a043;if(_0x3495e2[_0xe8bd('0x35')]['includeAll']){_0xc71ec4[_0xe8bd('0x41')]=[{'all':!![]}];}return db[_0xe8bd('0x31')][_0xe8bd('0x42')](_0xc71ec4);})['then'](function(_0x357cd5){_0x4b448b[_0xe8bd('0x43')]=_0x357cd5;return _0x4b448b;})[_0xe8bd('0x27')](respondWithFilteredResult(_0x4bc9ff,_0xc71ec4))[_0xe8bd('0x44')](handleError(_0x4bc9ff,null));};exports[_0xe8bd('0x45')]=function(_0x2f7d71,_0x272862){var _0x373be1={'raw':!![],'where':{'id':_0x2f7d71[_0xe8bd('0x46')]['id']}},_0x43a797={};_0x43a797[_0xe8bd('0x34')]=_[_0xe8bd('0x36')](db[_0xe8bd('0x31')]['rawAttributes']);_0x43a797[_0xe8bd('0x35')]=_[_0xe8bd('0x36')](_0x2f7d71[_0xe8bd('0x35')]);_0x43a797[_0xe8bd('0x3e')]=_[_0xe8bd('0x37')](_0x43a797['model'],_0x43a797[_0xe8bd('0x35')]);_0x373be1[_0xe8bd('0x38')]=_['intersection'](_0x43a797[_0xe8bd('0x34')],qs[_0xe8bd('0x39')](_0x2f7d71[_0xe8bd('0x35')][_0xe8bd('0x39')]));_0x373be1[_0xe8bd('0x38')]=_0x373be1[_0xe8bd('0x38')][_0xe8bd('0x47')]?_0x373be1[_0xe8bd('0x38')]:_0x43a797[_0xe8bd('0x34')];if(_0x2f7d71[_0xe8bd('0x35')][_0xe8bd('0x48')]){_0x373be1[_0xe8bd('0x41')]=[{'all':!![]}];}_0x373be1=_[_0xe8bd('0x40')]({},_0x373be1,_0x2f7d71[_0xe8bd('0x49')]);return db[_0xe8bd('0x31')][_0xe8bd('0x4a')](_0x373be1)[_0xe8bd('0x27')](handleEntityNotFound(_0x272862,null))['then'](respondWithResult(_0x272862,null))[_0xe8bd('0x44')](handleError(_0x272862,null));};exports['create']=function(_0x3c86f3,_0x254c00){return db[_0xe8bd('0x31')][_0xe8bd('0x4b')](_0x3c86f3[_0xe8bd('0x4c')],{})['then'](function(_0x46272f){var _0x584fe4=_0x3c86f3[_0xe8bd('0x4d')]['get']({'plain':!![]});if(!_0x584fe4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x584fe4[_0xe8bd('0x4e')]===_0xe8bd('0x4d')){var _0x56695a=_0x46272f[_0xe8bd('0x29')]({'plain':!![]});var _0x4f0294=_0xe8bd('0x2a');return db['UserProfileSection'][_0xe8bd('0x4a')]({'where':{'name':_0x4f0294,'userProfileId':_0x584fe4['userProfileId']},'raw':!![]})[_0xe8bd('0x27')](function(_0x27c1f0){if(_0x27c1f0&&_0x27c1f0[_0xe8bd('0x4f')]===0x0){return db[_0xe8bd('0x2b')]['create']({'name':_0x56695a[_0xe8bd('0x2d')],'resourceId':_0x56695a['id'],'type':_0x27c1f0[_0xe8bd('0x2d')],'sectionId':_0x27c1f0['id']},{})[_0xe8bd('0x27')](function(){return _0x46272f;});}else{return _0x46272f;}})[_0xe8bd('0x44')](function(_0xe0fd){logger[_0xe8bd('0x50')](_0xe8bd('0x51'),_0xe0fd);throw _0xe0fd;});}return _0x46272f;})['then'](respondWithResult(_0x254c00,0xc9))[_0xe8bd('0x44')](handleError(_0x254c00,null));};exports[_0xe8bd('0x26')]=function(_0x33dd23,_0x123ea9){if(_0x33dd23[_0xe8bd('0x4c')]['id']){delete _0x33dd23[_0xe8bd('0x4c')]['id'];}return db[_0xe8bd('0x31')][_0xe8bd('0x4a')]({'where':{'id':_0x33dd23['params']['id']}})[_0xe8bd('0x27')](handleEntityNotFound(_0x123ea9,null))[_0xe8bd('0x27')](saveUpdates(_0x33dd23['body'],null))[_0xe8bd('0x27')](respondWithResult(_0x123ea9,null))[_0xe8bd('0x44')](handleError(_0x123ea9,null));};exports[_0xe8bd('0x28')]=function(_0x5b09d6,_0x474a73){return db[_0xe8bd('0x31')][_0xe8bd('0x4a')]({'where':{'id':_0x5b09d6['params']['id']}})[_0xe8bd('0x27')](handleEntityNotFound(_0x474a73,null))['then'](removeEntity(_0x474a73,null))['catch'](handleError(_0x474a73,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index a8f34ba..b218cf4 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 _0x2fd3=['lodash','util','api','moment','path','rimraf','./variable.attributes','exports','tools_variables'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0x2fd3,0x183));var _0x32fd=function(_0x324ad2,_0x31404e){_0x324ad2=_0x324ad2-0x0;var _0xc129df=_0x2fd3[_0x324ad2];return _0xc129df;};'use strict';var _=require(_0x32fd('0x0'));var util=require(_0x32fd('0x1'));var logger=require('../../config/logger')(_0x32fd('0x2'));var moment=require(_0x32fd('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x32fd('0x4'));var rimraf=require(_0x32fd('0x5'));var config=require('../../config/environment');var attributes=require(_0x32fd('0x6'));module[_0x32fd('0x7')]=function(_0x202e2b,_0x5d4fb9){return _0x202e2b['define']('Variable',attributes,{'tableName':_0x32fd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe87c=['rimraf','../../config/environment','./variable.attributes','exports','tools_variables','util','moment','bluebird','request-promise','path'];(function(_0x5dc200,_0x47e76f){var _0x56ea0d=function(_0xe39a7b){while(--_0xe39a7b){_0x5dc200['push'](_0x5dc200['shift']());}};_0x56ea0d(++_0x47e76f);}(_0xe87c,0x195));var _0xce87=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0xe87c[_0x4a7631];return _0x1a5a6f;};'use strict';var _=require('lodash');var util=require(_0xce87('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xce87('0x1'));var BPromise=require(_0xce87('0x2'));var rp=require(_0xce87('0x3'));var fs=require('fs');var path=require(_0xce87('0x4'));var rimraf=require(_0xce87('0x5'));var config=require(_0xce87('0x6'));var attributes=require(_0xce87('0x7'));module[_0xce87('0x8')]=function(_0x3d6413,_0x367bee){return _0x3d6413['define']('Variable',attributes,{'tableName':_0xce87('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index e811fda..a97e2a9 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 _0xabce=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','attributes','map','include','model','catch','lodash','util'];(function(_0x3706d9,_0x5823a1){var _0x3ebc13=function(_0x1db6e3){while(--_0x1db6e3){_0x3706d9['push'](_0x3706d9['shift']());}};_0x3ebc13(++_0x5823a1);}(_0xabce,0x103));var _0xeabc=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xabce[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Variable,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}exports[_0xeabc('0x14')]=function(_0x58a3c0){var _0x16f08b=this;return new Promise(function(_0x31dd53,_0x31f52a){return db[_0xeabc('0x15')][_0xeabc('0x16')]({'raw':_0x58a3c0['options']?_0x58a3c0[_0xeabc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['where']||null:null,'attributes':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x18')]||null:null,'include':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['include']?_[_0xeabc('0x19')](_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x1a')],function(_0x5bdd57){return{'model':db[_0x5bdd57[_0xeabc('0x1b')]],'as':_0x5bdd57['as'],'attributes':_0x5bdd57[_0xeabc('0x18')],'include':_0x5bdd57[_0xeabc('0x1a')]?_[_0xeabc('0x19')](_0x5bdd57['include'],function(_0x109e1d){return{'model':db[_0x109e1d['model']],'as':_0x109e1d['as'],'attributes':_0x109e1d[_0xeabc('0x18')],'include':_0x109e1d['include']?_[_0xeabc('0x19')](_0x109e1d[_0xeabc('0x1a')],function(_0x269621){return{'model':db[_0x269621[_0xeabc('0x1b')]],'as':_0x269621['as'],'attributes':_0x269621[_0xeabc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeabc('0x9')](function(_0x131722){logger['info']('ShowVariable',_0x58a3c0);logger[_0xeabc('0xd')]('ShowVariable',_0x58a3c0,JSON[_0xeabc('0xf')](_0x131722));_0x31dd53(_0x131722);})[_0xeabc('0x1c')](function(_0x48fb52){logger[_0xeabc('0x10')](_0xeabc('0x14'),_0x48fb52[_0xeabc('0x12')],_0x58a3c0);_0x31f52a(_0x16f08b[_0xeabc('0x10')](0x1f4,_0x48fb52[_0xeabc('0x12')]));});});}; \ No newline at end of file +var _0xa41a=['debug','Variable,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowVariable','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0xa41a,0x6b));var _0xaa41=function(_0x330c67,_0x5dbdaf){_0x330c67=_0x330c67-0x0;var _0x8d4850=_0xa41a[_0x330c67];return _0x8d4850;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});}exports[_0xaa41('0x17')]=function(_0xd20ddf){var _0x29efe5=this;return new Promise(function(_0x46e6d3,_0x150ddf){return db['Variable']['find']({'raw':_0xd20ddf[_0xaa41('0x18')]?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x19')]===undefined?!![]:![]:!![],'where':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1a')]||null:null,'attributes':_0xd20ddf['options']?_0xd20ddf['options'][_0xaa41('0x1b')]||null:null,'include':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')],function(_0x4eb01f){return{'model':db[_0x4eb01f[_0xaa41('0x1e')]],'as':_0x4eb01f['as'],'attributes':_0x4eb01f[_0xaa41('0x1b')],'include':_0x4eb01f[_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0x4eb01f[_0xaa41('0x1c')],function(_0xa1f024){return{'model':db[_0xa1f024['model']],'as':_0xa1f024['as'],'attributes':_0xa1f024['attributes'],'include':_0xa1f024[_0xaa41('0x1c')]?_['map'](_0xa1f024['include'],function(_0x12e362){return{'model':db[_0x12e362['model']],'as':_0x12e362['as'],'attributes':_0x12e362['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa41('0xd')](function(_0x9c8c21){logger[_0xaa41('0xe')](_0xaa41('0x17'),_0xd20ddf);logger[_0xaa41('0x11')](_0xaa41('0x17'),_0xd20ddf,JSON['stringify'](_0x9c8c21));_0x46e6d3(_0x9c8c21);})[_0xaa41('0x16')](function(_0x1f0275){logger[_0xaa41('0x13')](_0xaa41('0x17'),_0x1f0275[_0xaa41('0x14')],_0xd20ddf);_0x150ddf(_0x29efe5[_0xaa41('0x13')](0x1f4,_0x1f0275[_0xaa41('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index ef111c1..a2235a2 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 _0x4c04=['/restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','/reset','reset','/pull'];(function(_0x3f2375,_0x592da7){var _0x540804=function(_0x3890cb){while(--_0x3890cb){_0x3f2375['push'](_0x3f2375['shift']());}};_0x540804(++_0x592da7);}(_0x4c04,0x134));var _0x44c0=function(_0x433af3,_0xc26acd){_0x433af3=_0x433af3-0x0;var _0x2ad959=_0x4c04[_0x433af3];return _0x2ad959;};'use strict';var express=require(_0x44c0('0x0'));var router=express[_0x44c0('0x1')]();var auth=require(_0x44c0('0x2'));var controller=require(_0x44c0('0x3'));router[_0x44c0('0x4')]('/',controller[_0x44c0('0x5')]);router['get'](_0x44c0('0x6'),auth[_0x44c0('0x7')](),auth[_0x44c0('0x8')](),controller['fetch']);router[_0x44c0('0x4')](_0x44c0('0x9'),auth[_0x44c0('0x7')](),auth['canUpdate'](),controller[_0x44c0('0xa')]);router[_0x44c0('0x4')](_0x44c0('0xb'),auth[_0x44c0('0x7')](),auth[_0x44c0('0x8')](),controller['pull']);router[_0x44c0('0x4')](_0x44c0('0xc'),auth[_0x44c0('0x7')](),controller['restart']);router[_0x44c0('0x4')](_0x44c0('0xd'),controller[_0x44c0('0xe')]);module[_0x44c0('0xf')]=router; \ No newline at end of file +var _0xa9d2=['canUpdate','fetch','/reset','reset','pull','/restart','migrations','exports','../../components/auth/service','./version.controller','get','/fetch','isAuthenticated'];(function(_0x312014,_0x2f93d8){var _0x2a8d17=function(_0x372f9b){while(--_0x372f9b){_0x312014['push'](_0x312014['shift']());}};_0x2a8d17(++_0x2f93d8);}(_0xa9d2,0xcb));var _0x2a9d=function(_0x223da7,_0x1933b0){_0x223da7=_0x223da7-0x0;var _0x4f8203=_0xa9d2[_0x223da7];return _0x4f8203;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x2a9d('0x0'));var controller=require(_0x2a9d('0x1'));router[_0x2a9d('0x2')]('/',controller['index']);router['get'](_0x2a9d('0x3'),auth[_0x2a9d('0x4')](),auth[_0x2a9d('0x5')](),controller[_0x2a9d('0x6')]);router['get'](_0x2a9d('0x7'),auth['isAuthenticated'](),auth[_0x2a9d('0x5')](),controller[_0x2a9d('0x8')]);router['get']('/pull',auth[_0x2a9d('0x4')](),auth[_0x2a9d('0x5')](),controller[_0x2a9d('0x9')]);router['get'](_0x2a9d('0xa'),auth['isAuthenticated'](),controller['restart']);router[_0x2a9d('0x2')]('/migrations',controller[_0x2a9d('0xb')]);module[_0x2a9d('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 38a9dcc..e27055e 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 _0x127b=['git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','join','server','length','.js','push','sort','sequelize','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','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','version','compare-versions','child_process','exec','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','tags','2.0.0','status','json','origin','master','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD'];(function(_0x2f10b8,_0x3b00bf){var _0x213b09=function(_0x347776){while(--_0x347776){_0x2f10b8['push'](_0x2f10b8['shift']());}};_0x213b09(++_0x3b00bf);}(_0x127b,0x1e9));var _0xb127=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x127b[_0x4a9fb1];return _0x348672;};'use strict';var Umzug=require(_0xb127('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xb127('0x1'));var pkginfo=require(_0xb127('0x2'))(module,_0xb127('0x3'));var compareVersions=require(_0xb127('0x4'));var exec=require(_0xb127('0x5'))[_0xb127('0x6')];var db=require('../../mysqldb')['db'];var config=require(_0xb127('0x7'));var pm2=require(_0xb127('0x8'));var logger=require(_0xb127('0x9'))(_0xb127('0xa'));var git=require(_0xb127('0xb'))(config[_0xb127('0xc')]);exports[_0xb127('0xd')]=function(_0x4e3fe0,_0x4521c7){var _0xa68109={'current':module[_0xb127('0xe')][_0xb127('0x3')],'phonebar':0x2};if(_0x4e3fe0[_0xb127('0xf')]&&_0x4e3fe0[_0xb127('0xf')][_0xb127('0x10')]){return git[_0xb127('0x11')]()[_0xb127('0x12')](function(_0x3acb58,_0x4f1e4b){_0xa68109[_0xb127('0x10')]=(_0x3acb58?module[_0xb127('0xe')]['version']:_0x4f1e4b[_0xb127('0x10')])||_0xb127('0x13');return _0x4521c7[_0xb127('0x14')](0xc8)[_0xb127('0x15')](_0xa68109);});}else{return _0x4521c7['status'](0xc8)['json'](_0xa68109);}};exports[_0xb127('0x11')]=function(_0x35bc2d,_0x1192ce){return git[_0xb127('0x11')]([_0xb127('0x16'),_0xb127('0x17')],function(_0x613532){if(_0x613532){logger['error'](_0x613532);return _0x1192ce[_0xb127('0x14')](0x1f4)[_0xb127('0x15')](_0x613532);}logger[_0xb127('0x18')]('git\x20fetch');return _0x1192ce[_0xb127('0x14')](0xc8)[_0xb127('0x15')]({'output':_0xb127('0x19')});});};exports[_0xb127('0x1a')]=function(_0x4ef9d7,_0x163775){return git['reset']([_0xb127('0x1b'),_0xb127('0x1c')],function(_0x14cfcc){if(_0x14cfcc){logger[_0xb127('0x1d')](_0x14cfcc);return _0x163775['status'](0x1f4)[_0xb127('0x15')](_0x14cfcc);}logger[_0xb127('0x18')](_0xb127('0x1e'));return _0x163775['status'](0xc8)[_0xb127('0x15')]({'output':_0xb127('0x1f')});});};exports[_0xb127('0x20')]=function(_0xc25e4d,_0x3570ee){exec('npm\x20install\x20--production',function(_0x1f8b8e,_0x21a122,_0x557d4f){logger['info'](_0x21a122);logger[_0xb127('0x18')](_0x557d4f);if(_0x1f8b8e){logger[_0xb127('0x1d')](_0x1f8b8e);return _0x3570ee['status'](0x1f4)[_0xb127('0x15')](_0x1f8b8e);}return _0x3570ee[_0xb127('0x14')](0xc8)['json']({'output':_0x21a122});});};exports[_0xb127('0x21')]=function(_0x52025b,_0x1d3a16){return pm2[_0xb127('0x21')](_0xb127('0x22'))[_0xb127('0x23')](function(_0xacb9e3){logger['info'](_0xb127('0x24'),_0xacb9e3);return _0x1d3a16['status'](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xb127('0x25')](function(_0x393a3d){logger['error'](_0x393a3d);return _0x1d3a16['status'](0x1f4)[_0xb127('0x15')](_0x393a3d);});};exports[_0xb127('0x26')]=function(_0x587d99,_0x458df7){var _0x3e5b7c=fs[_0xb127('0x27')](path[_0xb127('0x28')](config['root'],_0xb127('0x29'),_0xb127('0x26')));var _0x4940e3=[];for(var _0x3f1f99=0x0;_0x3f1f99<_0x3e5b7c[_0xb127('0x2a')];_0x3f1f99++){var _0x16d82d=_0x3e5b7c[_0x3f1f99]['replace'](_0xb127('0x2b'),'');if(compareVersions(module[_0xb127('0xe')][_0xb127('0x3')],_0x16d82d)===-0x1){_0x4940e3[_0xb127('0x2c')](_0x16d82d);}}if(_0x4940e3[_0xb127('0x2a')]){var _0x2b67bb=_0x4940e3[_0xb127('0x2d')](compareVersions);var _0xf6e9d5=new Umzug({'storage':_0xb127('0x2e'),'storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':_0xb127('0x3')},'migrations':{'params':[db[_0xb127('0x2e')]['getQueryInterface'](),db[_0xb127('0x2e')][_0xb127('0x2f')],function(){throw new Error(_0xb127('0x30'));}],'path':path[_0xb127('0x28')](config['root'],_0xb127('0x29'),_0xb127('0x26')),'pattern':/\.js$/}});_0xf6e9d5['up']({'migrations':_[_0xb127('0x31')](_0x2b67bb,function(_0x26c20d){return _0x26c20d+_0xb127('0x2b');})})['then'](function(){return _0x458df7[_0xb127('0x14')](0xc8)['json']({'output':_0xb127('0x32')+module[_0xb127('0xe')][_0xb127('0x3')]+'\x20to\x20'+_['last'](_0x2b67bb),'migrations':_[_0xb127('0x28')](_0x2b67bb)});})['catch'](function(_0x52cd9a){if(_0x52cd9a instanceof db[_0xb127('0x2e')]['UniqueConstraintError']){return _0x458df7[_0xb127('0x14')](0xc8)[_0xb127('0x15')]({'output':_0xb127('0x33')});}else{return _0x458df7['status'](0x1f4)[_0xb127('0x15')](_0x52cd9a);}});}else{return _0x458df7['status'](0xc8)[_0xb127('0x15')]({'output':_0xb127('0x33')});}}; \ No newline at end of file +var _0x1465=['path','lodash','pkginfo','version','compare-versions','exec','../../mysqldb','../../config/environment','../../config/logger','update','simple-git','index','exports','query','latest','fetch','tags','2.0.0','status','json','origin','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','server','replace','.js','push','length','sort','sequelize','Migration','getQueryInterface','constructor','map','Database\x20migrated\x20successfully\x20from\x20version\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug'];(function(_0x52dd52,_0x113eb8){var _0x518c34=function(_0x32960d){while(--_0x32960d){_0x52dd52['push'](_0x52dd52['shift']());}};_0x518c34(++_0x113eb8);}(_0x1465,0x14f));var _0x5146=function(_0x1b64dd,_0x2cf769){_0x1b64dd=_0x1b64dd-0x0;var _0xeb464c=_0x1465[_0x1b64dd];return _0xeb464c;};'use strict';var Umzug=require(_0x5146('0x0'));var path=require(_0x5146('0x1'));var fs=require('fs');var _=require(_0x5146('0x2'));var pkginfo=require(_0x5146('0x3'))(module,_0x5146('0x4'));var compareVersions=require(_0x5146('0x5'));var exec=require('child_process')[_0x5146('0x6')];var db=require(_0x5146('0x7'))['db'];var config=require(_0x5146('0x8'));var pm2=require('../../config/pm2');var logger=require(_0x5146('0x9'))(_0x5146('0xa'));var git=require(_0x5146('0xb'))(config['root']);exports[_0x5146('0xc')]=function(_0x20eb2f,_0x4f14f2){var _0x1c5a1f={'current':module[_0x5146('0xd')][_0x5146('0x4')],'phonebar':0x2};if(_0x20eb2f[_0x5146('0xe')]&&_0x20eb2f[_0x5146('0xe')][_0x5146('0xf')]){return git[_0x5146('0x10')]()[_0x5146('0x11')](function(_0x436ff8,_0x41ff4f){_0x1c5a1f[_0x5146('0xf')]=(_0x436ff8?module['exports'][_0x5146('0x4')]:_0x41ff4f[_0x5146('0xf')])||_0x5146('0x12');return _0x4f14f2[_0x5146('0x13')](0xc8)[_0x5146('0x14')](_0x1c5a1f);});}else{return _0x4f14f2[_0x5146('0x13')](0xc8)[_0x5146('0x14')](_0x1c5a1f);}};exports['fetch']=function(_0x377b59,_0x3a1722){return git[_0x5146('0x10')]([_0x5146('0x15'),_0x5146('0x16')],function(_0xac3326){if(_0xac3326){logger['error'](_0xac3326);return _0x3a1722[_0x5146('0x13')](0x1f4)[_0x5146('0x14')](_0xac3326);}logger[_0x5146('0x17')](_0x5146('0x18'));return _0x3a1722[_0x5146('0x13')](0xc8)['json']({'output':_0x5146('0x19')});});};exports['reset']=function(_0x194bab,_0xb435d){return git[_0x5146('0x1a')]([_0x5146('0x1b'),_0x5146('0x1c')],function(_0x182591){if(_0x182591){logger[_0x5146('0x1d')](_0x182591);return _0xb435d['status'](0x1f4)['json'](_0x182591);}logger[_0x5146('0x17')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0xb435d['status'](0xc8)[_0x5146('0x14')]({'output':'git\x20reset\x20--hard'});});};exports[_0x5146('0x1e')]=function(_0x5b75cb,_0x142b4a){exec(_0x5146('0x1f'),function(_0x109c10,_0x461dd3,_0x20825c){logger['info'](_0x461dd3);logger['info'](_0x20825c);if(_0x109c10){logger[_0x5146('0x1d')](_0x109c10);return _0x142b4a['status'](0x1f4)[_0x5146('0x14')](_0x109c10);}return _0x142b4a[_0x5146('0x13')](0xc8)[_0x5146('0x14')]({'output':_0x461dd3});});};exports['restart']=function(_0x16527f,_0x579b3a){return pm2[_0x5146('0x20')](_0x5146('0x21'))[_0x5146('0x22')](function(_0x199bf1){logger[_0x5146('0x17')](_0x5146('0x23'),_0x199bf1);return _0x579b3a[_0x5146('0x13')](0xc8)[_0x5146('0x14')]({'output':_0x5146('0x24')});})[_0x5146('0x25')](function(_0x21b01f){logger['error'](_0x21b01f);return _0x579b3a['status'](0x1f4)[_0x5146('0x14')](_0x21b01f);});};exports[_0x5146('0x26')]=function(_0x590096,_0x33d0b2){var _0x15cd84=fs[_0x5146('0x27')](path[_0x5146('0x28')](config[_0x5146('0x29')],_0x5146('0x2a'),_0x5146('0x26')));var _0x295d65=[];for(var _0x37394d=0x0;_0x37394d<_0x15cd84['length'];_0x37394d++){var _0x5473c6=_0x15cd84[_0x37394d][_0x5146('0x2b')](_0x5146('0x2c'),'');if(compareVersions(module[_0x5146('0xd')]['version'],_0x5473c6)===-0x1){_0x295d65[_0x5146('0x2d')](_0x5473c6);}}if(_0x295d65[_0x5146('0x2e')]){var _0x30a407=_0x295d65[_0x5146('0x2f')](compareVersions);var _0x1e48f8=new Umzug({'storage':_0x5146('0x30'),'storageOptions':{'model':db[_0x5146('0x31')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db[_0x5146('0x30')][_0x5146('0x32')](),db[_0x5146('0x30')][_0x5146('0x33')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path['join'](config[_0x5146('0x29')],'server',_0x5146('0x26')),'pattern':/\.js$/}});_0x1e48f8['up']({'migrations':_[_0x5146('0x34')](_0x30a407,function(_0x5aff45){return _0x5aff45+_0x5146('0x2c');})})[_0x5146('0x22')](function(){return _0x33d0b2['status'](0xc8)[_0x5146('0x14')]({'output':_0x5146('0x35')+module[_0x5146('0xd')][_0x5146('0x4')]+'\x20to\x20'+_['last'](_0x30a407),'migrations':_[_0x5146('0x28')](_0x30a407)});})['catch'](function(_0x37002c){if(_0x37002c instanceof db[_0x5146('0x30')][_0x5146('0x36')]){return _0x33d0b2[_0x5146('0x13')](0xc8)[_0x5146('0x14')]({'output':_0x5146('0x37')});}else{return _0x33d0b2['status'](0x1f4)['json'](_0x37002c);}});}else{return _0x33d0b2['status'](0xc8)[_0x5146('0x14')]({'output':_0x5146('0x37')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index b27e95b..0718e48 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 _0xc01a=['connect-timeout','Router','./voiceAgentReport.controller','get','index','isAuthenticated','/:id','create','delete','destroy','exports','multer','path'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xc01a,0x102));var _0xac01=function(_0x3c9bf1,_0x5bf115){_0x3c9bf1=_0x3c9bf1-0x0;var _0x50598c=_0xc01a[_0x3c9bf1];return _0x50598c;};'use strict';var multer=require(_0xac01('0x0'));var util=require('util');var path=require(_0xac01('0x1'));var timeout=require(_0xac01('0x2'));var express=require('express');var router=express[_0xac01('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(_0xac01('0x4'));router[_0xac01('0x5')]('/',auth['isAuthenticated'](),controller[_0xac01('0x6')]);router[_0xac01('0x5')]('/describe',auth[_0xac01('0x7')](),controller['describe']);router[_0xac01('0x5')](_0xac01('0x8'),auth[_0xac01('0x7')](),controller['show']);router['post']('/',auth[_0xac01('0x7')](),controller[_0xac01('0x9')]);router['put'](_0xac01('0x8'),auth[_0xac01('0x7')](),controller['update']);router[_0xac01('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xac01('0xb')]);module[_0xac01('0xc')]=router; \ No newline at end of file +var _0x7a77=['express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','connect-timeout'];(function(_0x129de7,_0x1358ce){var _0x4baf2e=function(_0x2c5cdc){while(--_0x2c5cdc){_0x129de7['push'](_0x129de7['shift']());}};_0x4baf2e(++_0x1358ce);}(_0x7a77,0xaa));var _0x77a7=function(_0x4c94f5,_0x5bb6df){_0x4c94f5=_0x4c94f5-0x0;var _0x49cf1a=_0x7a77[_0x4c94f5];return _0x49cf1a;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x77a7('0x0'));var express=require(_0x77a7('0x1'));var router=express['Router']();var fs_extra=require(_0x77a7('0x2'));var auth=require(_0x77a7('0x3'));var interaction=require(_0x77a7('0x4'));var config=require('../../config/environment');var controller=require(_0x77a7('0x5'));router[_0x77a7('0x6')]('/',auth[_0x77a7('0x7')](),controller[_0x77a7('0x8')]);router[_0x77a7('0x6')]('/describe',auth[_0x77a7('0x7')](),controller[_0x77a7('0x9')]);router[_0x77a7('0x6')](_0x77a7('0xa'),auth[_0x77a7('0x7')](),controller[_0x77a7('0xb')]);router[_0x77a7('0xc')]('/',auth[_0x77a7('0x7')](),controller[_0x77a7('0xd')]);router[_0x77a7('0xe')](_0x77a7('0xa'),auth[_0x77a7('0x7')](),controller[_0x77a7('0xf')]);router[_0x77a7('0x10')](_0x77a7('0xa'),auth['isAuthenticated'](),controller[_0x77a7('0x11')]);module[_0x77a7('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 91632bd..cf1dffa 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 _0xf567=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf567,0x118));var _0x7f56=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf567[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x7f56('0x0'));module[_0x7f56('0x1')]={'type':{'type':Sequelize[_0x7f56('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7f56('0x2')]},'calleridname':{'type':Sequelize[_0x7f56('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x7f56('0x2')]},'membername':{'type':Sequelize[_0x7f56('0x2')]},'agentcalledAt':{'type':Sequelize[_0x7f56('0x3')]},'agentconnectAt':{'type':Sequelize[_0x7f56('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x7f56('0x3')]},'agentdumpAt':{'type':Sequelize[_0x7f56('0x3')]},'holdtime':{'type':Sequelize[_0x7f56('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x7f56('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x7f56('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x7f56('0x4')]},'agentacw':{'type':Sequelize[_0x7f56('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7f56('0x4')]},'reason':{'type':Sequelize[_0x7f56('0x2')]},'lastevent':{'type':Sequelize[_0x7f56('0x2')]},'channel':{'type':Sequelize[_0x7f56('0x2')]},'channelstate':{'type':Sequelize[_0x7f56('0x4')]},'channelstatedesc':{'type':Sequelize[_0x7f56('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7f56('0x2')]},'connectedlinename':{'type':Sequelize[_0x7f56('0x2')]},'language':{'type':Sequelize[_0x7f56('0x2')]},'accountcode':{'type':Sequelize[_0x7f56('0x2')]},'context':{'type':Sequelize[_0x7f56('0x2')]},'exten':{'type':Sequelize[_0x7f56('0x2')]},'priority':{'type':Sequelize[_0x7f56('0x2')]},'destchannel':{'type':Sequelize[_0x7f56('0x2')]},'destchannelstate':{'type':Sequelize[_0x7f56('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x7f56('0x2')]},'destcalleridnum':{'type':Sequelize[_0x7f56('0x2')]},'destcalleridname':{'type':Sequelize[_0x7f56('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x7f56('0x2')]},'destlanguage':{'type':Sequelize[_0x7f56('0x2')]},'destaccountcode':{'type':Sequelize[_0x7f56('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x7f56('0x2')]},'destpriority':{'type':Sequelize[_0x7f56('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x7f56('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x7f56('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x7f56('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x7f56('0x2')]},'agententerreason':{'type':Sequelize[_0x7f56('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6f3e=['STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x2a68a9,_0x5b967a){var _0xb0ff98=function(_0x5bd155){while(--_0x5bd155){_0x2a68a9['push'](_0x2a68a9['shift']());}};_0xb0ff98(++_0x5b967a);}(_0x6f3e,0x9f));var _0xe6f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f3e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe6f3('0x0'));module[_0xe6f3('0x1')]={'type':{'type':Sequelize[_0xe6f3('0x2')]},'uniqueid':{'type':Sequelize[_0xe6f3('0x2')]},'calleridnum':{'type':Sequelize[_0xe6f3('0x2')]},'calleridname':{'type':Sequelize[_0xe6f3('0x2')]},'queue':{'type':Sequelize[_0xe6f3('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xe6f3('0x2')]},'agentcalledAt':{'type':Sequelize[_0xe6f3('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xe6f3('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xe6f3('0x3')]},'agentdumpAt':{'type':Sequelize[_0xe6f3('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xe6f3('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xe6f3('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xe6f3('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xe6f3('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xe6f3('0x2')]},'lastevent':{'type':Sequelize[_0xe6f3('0x2')]},'channel':{'type':Sequelize[_0xe6f3('0x2')]},'channelstate':{'type':Sequelize[_0xe6f3('0x5')]},'channelstatedesc':{'type':Sequelize[_0xe6f3('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe6f3('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe6f3('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xe6f3('0x2')]},'exten':{'type':Sequelize[_0xe6f3('0x2')]},'priority':{'type':Sequelize[_0xe6f3('0x2')]},'destchannel':{'type':Sequelize[_0xe6f3('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xe6f3('0x2')]},'destcalleridnum':{'type':Sequelize[_0xe6f3('0x2')]},'destcalleridname':{'type':Sequelize[_0xe6f3('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xe6f3('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xe6f3('0x2')]},'destlanguage':{'type':Sequelize[_0xe6f3('0x2')]},'destaccountcode':{'type':Sequelize[_0xe6f3('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xe6f3('0x2')]},'destpriority':{'type':Sequelize[_0xe6f3('0x2')]},'destuniqueid':{'type':Sequelize[_0xe6f3('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xe6f3('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xe6f3('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xe6f3('0x6')},'transferexten':{'type':Sequelize[_0xe6f3('0x2')]},'transferuniqueid':{'type':Sequelize[_0xe6f3('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index e24d4be..0261b92 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(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 0ceb4ad..99ae6e5 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 _0x394e=['destuniqueid','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid'];(function(_0x42a206,_0x2b1612){var _0x35eb3b=function(_0x3e5c46){while(--_0x3e5c46){_0x42a206['push'](_0x42a206['shift']());}};_0x35eb3b(++_0x2b1612);}(_0x394e,0x88));var _0xe394=function(_0x2ea1d4,_0x34f914){_0x2ea1d4=_0x2ea1d4-0x0;var _0x53ddb7=_0x394e[_0x2ea1d4];return _0x53ddb7;};'use strict';var _=require(_0xe394('0x0'));var util=require(_0xe394('0x1'));var logger=require('../../config/logger')(_0xe394('0x2'));var moment=require(_0xe394('0x3'));var BPromise=require(_0xe394('0x4'));var rp=require(_0xe394('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe394('0x6'));var config=require(_0xe394('0x7'));var attributes=require(_0xe394('0x8'));module[_0xe394('0x9')]=function(_0x2a4db6,_0x272c30){return _0x2a4db6[_0xe394('0xa')](_0xe394('0xb'),attributes,{'tableName':_0xe394('0xc'),'paranoid':![],'indexes':[{'fields':[_0xe394('0xd'),_0xe394('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x56e7=['define','VoiceAgentReport','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes'];(function(_0x155c79,_0x3de3ae){var _0x1bf740=function(_0x217646){while(--_0x217646){_0x155c79['push'](_0x155c79['shift']());}};_0x1bf740(++_0x3de3ae);}(_0x56e7,0x7b));var _0x756e=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0x56e7[_0x3e6d5d];return _0x238923;};'use strict';var _=require('lodash');var util=require(_0x756e('0x0'));var logger=require(_0x756e('0x1'))('api');var moment=require(_0x756e('0x2'));var BPromise=require(_0x756e('0x3'));var rp=require(_0x756e('0x4'));var fs=require('fs');var path=require(_0x756e('0x5'));var rimraf=require(_0x756e('0x6'));var config=require(_0x756e('0x7'));var attributes=require(_0x756e('0x8'));module['exports']=function(_0x3b3b8f,_0x404189){return _0x3b3b8f[_0x756e('0x9')](_0x756e('0xa'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x756e('0xb'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 0d7a0fb..a36a79b 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 _0x9637=['catch','VoiceAgentReport','update','attributes','limit','UpdateVoiceAgentReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateVoiceAgentReport','create','body','options','then'];(function(_0xa60414,_0x6a9a43){var _0xd983d5=function(_0x5a8d7e){while(--_0x5a8d7e){_0xa60414['push'](_0xa60414['shift']());}};_0xd983d5(++_0x6a9a43);}(_0x9637,0x166));var _0x7963=function(_0x2e4996,_0xc75eb6){_0x2e4996=_0x2e4996-0x0;var _0x1f7d20=_0x9637[_0x2e4996];return _0x1f7d20;};'use strict';var _=require(_0x7963('0x0'));var util=require(_0x7963('0x1'));var moment=require('moment');var BPromise=require(_0x7963('0x2'));var rs=require(_0x7963('0x3'));var fs=require('fs');var Redis=require(_0x7963('0x4'));var db=require(_0x7963('0x5'))['db'];var utils=require(_0x7963('0x6'));var logger=require('../../config/logger')(_0x7963('0x7'));var config=require('../../config/environment');var jayson=require(_0x7963('0x8'));var client=jayson[_0x7963('0x9')][_0x7963('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xce32c4,_0x3a9e60,_0x189843){return new BPromise(function(_0xdc239b,_0x47fb6d){return client[_0x7963('0xb')](_0xce32c4,_0x189843)['then'](function(_0x2fd08e){logger[_0x7963('0xc')](_0x7963('0xd'),_0x3a9e60,_0x7963('0xe'));logger[_0x7963('0xf')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x3a9e60,_0x7963('0xe'),JSON[_0x7963('0x10')](_0x2fd08e));if(_0x2fd08e[_0x7963('0x11')]){if(_0x2fd08e[_0x7963('0x11')][_0x7963('0x12')]===0x1f4){logger[_0x7963('0x11')](_0x7963('0xd'),_0x3a9e60,_0x2fd08e[_0x7963('0x11')]['message']);return _0x47fb6d(_0x2fd08e[_0x7963('0x11')][_0x7963('0x13')]);}logger['error'](_0x7963('0xd'),_0x3a9e60,_0x2fd08e[_0x7963('0x11')][_0x7963('0x13')]);return _0xdc239b(_0x2fd08e[_0x7963('0x11')][_0x7963('0x13')]);}else{logger[_0x7963('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x3a9e60,_0x7963('0xe'));_0xdc239b(_0x2fd08e[_0x7963('0x14')][_0x7963('0x13')]);}})['catch'](function(_0x10e36a){logger['error'](_0x7963('0xd'),_0x3a9e60,_0x10e36a);_0x47fb6d(_0x10e36a);});});}exports[_0x7963('0x15')]=function(_0x3fd598){var _0x4d24b3=this;return new Promise(function(_0x2e638a,_0x2dbc8a){return db['VoiceAgentReport'][_0x7963('0x16')](_0x3fd598[_0x7963('0x17')],{'raw':_0x3fd598[_0x7963('0x18')]?_0x3fd598[_0x7963('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x7963('0x19')](function(_0x586de3){logger[_0x7963('0xc')](_0x7963('0x15'),_0x3fd598);logger[_0x7963('0xf')](_0x7963('0x15'),_0x3fd598,JSON['stringify'](_0x586de3));_0x2e638a(_0x586de3);})[_0x7963('0x1a')](function(_0x395826){logger[_0x7963('0x11')](_0x7963('0x15'),_0x395826['message'],_0x3fd598);_0x2dbc8a(_0x4d24b3[_0x7963('0x11')](0x1f4,_0x395826['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x2a1f12){var _0x5af13a=this;return new Promise(function(_0x253a7f,_0x4d684d){return db[_0x7963('0x1b')][_0x7963('0x1c')](_0x2a1f12[_0x7963('0x17')],{'raw':_0x2a1f12[_0x7963('0x18')]?_0x2a1f12[_0x7963('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a1f12[_0x7963('0x18')]?_0x2a1f12[_0x7963('0x18')]['where']||null:null,'attributes':_0x2a1f12[_0x7963('0x18')]?_0x2a1f12[_0x7963('0x18')][_0x7963('0x1d')]||null:null,'limit':_0x2a1f12[_0x7963('0x18')]?_0x2a1f12[_0x7963('0x18')][_0x7963('0x1e')]||null:null})[_0x7963('0x19')](function(_0x53b3b2){logger['info'](_0x7963('0x1f'),_0x2a1f12);logger['debug'](_0x7963('0x1f'),_0x2a1f12,JSON['stringify'](_0x53b3b2));_0x253a7f(_0x53b3b2);})[_0x7963('0x1a')](function(_0x242fe7){logger['error'](_0x7963('0x1f'),_0x242fe7[_0x7963('0x13')],_0x2a1f12);_0x4d684d(_0x5af13a[_0x7963('0x11')](0x1f4,_0x242fe7[_0x7963('0x13')]));});});}; \ No newline at end of file +var _0x52a6=['rpc','jayson/promise','client','request','then','info','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceAgentReport,\x20%s,\x20%s','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','debug','where','limit','UpdateVoiceAgentReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2866c7,_0x197fdd){var _0x3c5db2=function(_0x5f40db){while(--_0x5f40db){_0x2866c7['push'](_0x2866c7['shift']());}};_0x3c5db2(++_0x197fdd);}(_0x52a6,0x1ab));var _0x652a=function(_0x59bd5d,_0xf5eb10){_0x59bd5d=_0x59bd5d-0x0;var _0x132e17=_0x52a6[_0x59bd5d];return _0x132e17;};'use strict';var _=require(_0x652a('0x0'));var util=require(_0x652a('0x1'));var moment=require('moment');var BPromise=require(_0x652a('0x2'));var rs=require(_0x652a('0x3'));var fs=require('fs');var Redis=require(_0x652a('0x4'));var db=require(_0x652a('0x5'))['db'];var utils=require(_0x652a('0x6'));var logger=require('../../config/logger')(_0x652a('0x7'));var config=require('../../config/environment');var jayson=require(_0x652a('0x8'));var client=jayson[_0x652a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x402b97,_0x512cdd,_0x3e39c8){return new BPromise(function(_0x3e5548,_0x4636c1){return client[_0x652a('0xa')](_0x402b97,_0x3e39c8)[_0x652a('0xb')](function(_0x463081){logger[_0x652a('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x512cdd,_0x652a('0xd'));logger['debug'](_0x652a('0xe'),_0x512cdd,'request\x20sent',JSON[_0x652a('0xf')](_0x463081));if(_0x463081[_0x652a('0x10')]){if(_0x463081[_0x652a('0x10')][_0x652a('0x11')]===0x1f4){logger[_0x652a('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x512cdd,_0x463081['error'][_0x652a('0x12')]);return _0x4636c1(_0x463081[_0x652a('0x10')][_0x652a('0x12')]);}logger[_0x652a('0x10')](_0x652a('0x13'),_0x512cdd,_0x463081[_0x652a('0x10')][_0x652a('0x12')]);return _0x3e5548(_0x463081[_0x652a('0x10')][_0x652a('0x12')]);}else{logger['info'](_0x652a('0x13'),_0x512cdd,'request\x20sent');_0x3e5548(_0x463081[_0x652a('0x14')]['message']);}})[_0x652a('0x15')](function(_0x39e427){logger[_0x652a('0x10')](_0x652a('0x13'),_0x512cdd,_0x39e427);_0x4636c1(_0x39e427);});});}exports[_0x652a('0x16')]=function(_0x5600bd){var _0x528f83=this;return new Promise(function(_0x25dcb7,_0x13312b){return db[_0x652a('0x17')][_0x652a('0x18')](_0x5600bd['body'],{'raw':_0x5600bd[_0x652a('0x19')]?_0x5600bd[_0x652a('0x19')][_0x652a('0x1a')]===undefined?!![]:![]:!![]})[_0x652a('0xb')](function(_0x4814f1){logger['info']('CreateVoiceAgentReport',_0x5600bd);logger[_0x652a('0x1b')](_0x652a('0x16'),_0x5600bd,JSON[_0x652a('0xf')](_0x4814f1));_0x25dcb7(_0x4814f1);})['catch'](function(_0x5b23b8){logger[_0x652a('0x10')](_0x652a('0x16'),_0x5b23b8[_0x652a('0x12')],_0x5600bd);_0x13312b(_0x528f83[_0x652a('0x10')](0x1f4,_0x5b23b8[_0x652a('0x12')]));});});};exports['UpdateVoiceAgentReport']=function(_0x2e3d3d){var _0x1f1c7d=this;return new Promise(function(_0x4086ac,_0xfff9ec){return db[_0x652a('0x17')]['update'](_0x2e3d3d['body'],{'raw':_0x2e3d3d[_0x652a('0x19')]?_0x2e3d3d[_0x652a('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e3d3d[_0x652a('0x19')]?_0x2e3d3d[_0x652a('0x19')][_0x652a('0x1c')]||null:null,'attributes':_0x2e3d3d[_0x652a('0x19')]?_0x2e3d3d['options']['attributes']||null:null,'limit':_0x2e3d3d['options']?_0x2e3d3d[_0x652a('0x19')][_0x652a('0x1d')]||null:null})[_0x652a('0xb')](function(_0x116033){logger[_0x652a('0xc')](_0x652a('0x1e'),_0x2e3d3d);logger[_0x652a('0x1b')](_0x652a('0x1e'),_0x2e3d3d,JSON[_0x652a('0xf')](_0x116033));_0x4086ac(_0x116033);})[_0x652a('0x15')](function(_0x3716bb){logger[_0x652a('0x10')]('UpdateVoiceAgentReport',_0x3716bb['message'],_0x2e3d3d);_0xfff9ec(_0x1f1c7d[_0x652a('0x10')](0x1f4,_0x3716bb[_0x652a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index c0da801..d511e69 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 _0x425d=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x36782c,_0x38c321){var _0xd4e417=function(_0x105817){while(--_0x105817){_0x36782c['push'](_0x36782c['shift']());}};_0xd4e417(++_0x38c321);}(_0x425d,0x1e0));var _0xd425=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x425d[_0x173441];return _0x2423a8;};'use strict';var multer=require(_0xd425('0x0'));var util=require('util');var path=require(_0xd425('0x1'));var timeout=require(_0xd425('0x2'));var express=require(_0xd425('0x3'));var router=express[_0xd425('0x4')]();var fs_extra=require(_0xd425('0x5'));var auth=require(_0xd425('0x6'));var interaction=require(_0xd425('0x7'));var config=require('../../config/environment');var controller=require(_0xd425('0x8'));router[_0xd425('0x9')]('/',auth[_0xd425('0xa')](),controller[_0xd425('0xb')]);router[_0xd425('0x9')](_0xd425('0xc'),auth['isAuthenticated'](),controller[_0xd425('0xd')]);router[_0xd425('0x9')](_0xd425('0xe'),auth[_0xd425('0xa')](),controller[_0xd425('0xf')]);router[_0xd425('0x10')]('/',auth[_0xd425('0xa')](),controller[_0xd425('0x11')]);router[_0xd425('0x12')](_0xd425('0xe'),auth[_0xd425('0xa')](),controller[_0xd425('0x13')]);router[_0xd425('0x14')](_0xd425('0xe'),auth[_0xd425('0xa')](),controller[_0xd425('0x15')]);module[_0xd425('0x16')]=router; \ No newline at end of file +var _0x6b8f=['destroy','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put'];(function(_0x1b2255,_0x3de34f){var _0x33e57d=function(_0x2f9cce){while(--_0x2f9cce){_0x1b2255['push'](_0x1b2255['shift']());}};_0x33e57d(++_0x3de34f);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x35ad45,_0x231027){_0x35ad45=_0x35ad45-0x0;var _0x57008a=_0x6b8f[_0x35ad45];return _0x57008a;};'use strict';var multer=require('multer');var util=require(_0xf6b8('0x0'));var path=require('path');var timeout=require(_0xf6b8('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf6b8('0x2'));var auth=require(_0xf6b8('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf6b8('0x4'));var controller=require(_0xf6b8('0x5'));router[_0xf6b8('0x6')]('/',auth['isAuthenticated'](),controller[_0xf6b8('0x7')]);router[_0xf6b8('0x6')](_0xf6b8('0x8'),auth[_0xf6b8('0x9')](),controller['describe']);router['get'](_0xf6b8('0xa'),auth['isAuthenticated'](),controller[_0xf6b8('0xb')]);router[_0xf6b8('0xc')]('/',auth[_0xf6b8('0x9')](),controller[_0xf6b8('0xd')]);router[_0xf6b8('0xe')](_0xf6b8('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xf6b8('0xa'),auth[_0xf6b8('0x9')](),controller[_0xf6b8('0xf')]);module[_0xf6b8('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index df0e1c7..2e41079 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 _0xd94d=['dialer','TEXT','DATE','INTEGER','exports','STRING','ENUM','internal','outbound','inbound-fax','outbound-fax'];(function(_0x15d401,_0xb72df8){var _0x5b6d81=function(_0x3ffa02){while(--_0x3ffa02){_0x15d401['push'](_0x15d401['shift']());}};_0x5b6d81(++_0xb72df8);}(_0xd94d,0x16f));var _0xdd94=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd94d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xdd94('0x0')]={'uniqueid':{'type':Sequelize[_0xdd94('0x1')]},'type':{'type':Sequelize[_0xdd94('0x2')]('inbound',_0xdd94('0x3'),_0xdd94('0x4'),_0xdd94('0x5'),_0xdd94('0x6'),_0xdd94('0x7'))},'tag':{'type':Sequelize[_0xdd94('0x1')]},'accountcode':{'type':Sequelize[_0xdd94('0x1')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xdd94('0x1')]},'destinationcontext':{'type':Sequelize[_0xdd94('0x1')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xdd94('0x1')]},'destinationchannel':{'type':Sequelize[_0xdd94('0x1')]},'lastapplication':{'type':Sequelize[_0xdd94('0x1')]},'lastdata':{'type':Sequelize[_0xdd94('0x8')]},'starttime':{'type':Sequelize[_0xdd94('0x9')]},'systemanswertime':{'type':Sequelize[_0xdd94('0x9')]},'answertime':{'type':Sequelize[_0xdd94('0x9')]},'endtime':{'type':Sequelize[_0xdd94('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xdd94('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xdd94('0x1')]},'userfield':{'type':Sequelize[_0xdd94('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xdd94('0x1')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0xdd94('0xa')]},'sipcallid':{'type':Sequelize[_0xdd94('0x1')]}}; \ No newline at end of file +var _0x27de=['ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','TEXT','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x2ac7ca,_0x17acc2){var _0x117fc4=function(_0xebafe7){while(--_0xebafe7){_0x2ac7ca['push'](_0x2ac7ca['shift']());}};_0x117fc4(++_0x17acc2);}(_0x27de,0x111));var _0xe27d=function(_0x4af2ad,_0x53ca39){_0x4af2ad=_0x4af2ad-0x0;var _0x1a55f8=_0x27de[_0x4af2ad];return _0x1a55f8;};'use strict';var Sequelize=require(_0xe27d('0x0'));module[_0xe27d('0x1')]={'uniqueid':{'type':Sequelize[_0xe27d('0x2')]},'type':{'type':Sequelize[_0xe27d('0x3')](_0xe27d('0x4'),_0xe27d('0x5'),_0xe27d('0x6'),_0xe27d('0x7'),_0xe27d('0x8'),'dialer')},'tag':{'type':Sequelize[_0xe27d('0x2')]},'accountcode':{'type':Sequelize[_0xe27d('0x2')]},'source':{'type':Sequelize[_0xe27d('0x2')]},'destination':{'type':Sequelize[_0xe27d('0x2')]},'destinationcontext':{'type':Sequelize[_0xe27d('0x2')]},'callerid':{'type':Sequelize[_0xe27d('0x2')]},'channel':{'type':Sequelize[_0xe27d('0x2')]},'destinationchannel':{'type':Sequelize[_0xe27d('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xe27d('0x9')]},'starttime':{'type':Sequelize[_0xe27d('0xa')]},'systemanswertime':{'type':Sequelize[_0xe27d('0xa')]},'answertime':{'type':Sequelize[_0xe27d('0xa')]},'endtime':{'type':Sequelize[_0xe27d('0xa')]},'duration':{'type':Sequelize[_0xe27d('0xb')]},'billableseconds':{'type':Sequelize[_0xe27d('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe27d('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xe27d('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xe27d('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xe27d('0x2')]},'note':{'type':Sequelize[_0xe27d('0x2')]},'prefix':{'type':Sequelize[_0xe27d('0x2')]},'routeid':{'type':Sequelize[_0xe27d('0xb')]},'sipcallid':{'type':Sequelize[_0xe27d('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index f6469b8..6050ea8 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x12ca5f,_0x223d98){var _0xfc3ae9=function(_0x1928fb){while(--_0x1928fb){_0x12ca5f['push'](_0x12ca5f['shift']());}};_0xfc3ae9(++_0x223d98);}(_0x2ef3,0xba));var _0x32ef=function(_0x8d6f1a,_0x231d16){_0x8d6f1a=_0x8d6f1a-0x0;var _0x3e82cc=_0x2ef3[_0x8d6f1a];return _0x3e82cc;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file +var _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x239b31,_0x44a64d){var _0x41c8be=function(_0x27f031){while(--_0x27f031){_0x239b31['push'](_0x239b31['shift']());}};_0x41c8be(++_0x44a64d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x27367a,_0x326089){_0x27367a=_0x27367a-0x0;var _0x417ddb=_0x5f2f[_0x27367a];return _0x417ddb;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index a7416f9..1ed7e19 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 _0x3f62=['VoiceCallReport','report_call','uniqueid','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports'];(function(_0x589589,_0x484d80){var _0x1ae411=function(_0x193408){while(--_0x193408){_0x589589['push'](_0x589589['shift']());}};_0x1ae411(++_0x484d80);}(_0x3f62,0x177));var _0x23f6=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x3f62[_0x29b609];return _0x54c952;};'use strict';var _=require(_0x23f6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x23f6('0x1'));var moment=require(_0x23f6('0x2'));var BPromise=require('bluebird');var rp=require(_0x23f6('0x3'));var fs=require('fs');var path=require(_0x23f6('0x4'));var rimraf=require(_0x23f6('0x5'));var config=require(_0x23f6('0x6'));var attributes=require(_0x23f6('0x7'));module[_0x23f6('0x8')]=function(_0x3e8c70,_0x12ebc0){return _0x3e8c70['define'](_0x23f6('0x9'),attributes,{'tableName':_0x23f6('0xa'),'paranoid':![],'indexes':[{'fields':[_0x23f6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0d9f=['report_call','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define'];(function(_0xb6e5d6,_0x42cee4){var _0x1fc9bb=function(_0x192127){while(--_0x192127){_0xb6e5d6['push'](_0xb6e5d6['shift']());}};_0x1fc9bb(++_0x42cee4);}(_0x0d9f,0x136));var _0xf0d9=function(_0x27c068,_0x342981){_0x27c068=_0x27c068-0x0;var _0xe5a67f=_0x0d9f[_0x27c068];return _0xe5a67f;};'use strict';var _=require(_0xf0d9('0x0'));var util=require(_0xf0d9('0x1'));var logger=require(_0xf0d9('0x2'))('api');var moment=require(_0xf0d9('0x3'));var BPromise=require(_0xf0d9('0x4'));var rp=require(_0xf0d9('0x5'));var fs=require('fs');var path=require(_0xf0d9('0x6'));var rimraf=require(_0xf0d9('0x7'));var config=require(_0xf0d9('0x8'));var attributes=require(_0xf0d9('0x9'));module[_0xf0d9('0xa')]=function(_0x33331d,_0x36a132){return _0x33331d[_0xf0d9('0xb')]('VoiceCallReport',attributes,{'tableName':_0xf0d9('0xc'),'paranoid':![],'indexes':[{'fields':[_0xf0d9('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 6064aee..2c9fbfc 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 _0xea24=['options','raw','where','attributes','map','include','model','CreateVoiceCallReport','VoiceCallReport','create','body','UpdateVoiceCallReport','update','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceCallReport'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xea24,0x176));var _0x4ea2=function(_0x13857a,_0x5db248){_0x13857a=_0x13857a-0x0;var _0x367b9a=_0xea24[_0x13857a];return _0x367b9a;};'use strict';var _=require(_0x4ea2('0x0'));var util=require(_0x4ea2('0x1'));var moment=require('moment');var BPromise=require(_0x4ea2('0x2'));var rs=require(_0x4ea2('0x3'));var fs=require('fs');var Redis=require(_0x4ea2('0x4'));var db=require(_0x4ea2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4ea2('0x6'))(_0x4ea2('0x7'));var config=require(_0x4ea2('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4ea2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d7826,_0x5929f7,_0x2b95b1){return new BPromise(function(_0x1441ae,_0x497204){return client['request'](_0x3d7826,_0x2b95b1)[_0x4ea2('0xa')](function(_0x2e6cb5){logger[_0x4ea2('0xb')](_0x4ea2('0xc'),_0x5929f7,_0x4ea2('0xd'));logger[_0x4ea2('0xe')](_0x4ea2('0xf'),_0x5929f7,_0x4ea2('0xd'),JSON[_0x4ea2('0x10')](_0x2e6cb5));if(_0x2e6cb5[_0x4ea2('0x11')]){if(_0x2e6cb5['error'][_0x4ea2('0x12')]===0x1f4){logger['error'](_0x4ea2('0xc'),_0x5929f7,_0x2e6cb5[_0x4ea2('0x11')]['message']);return _0x497204(_0x2e6cb5[_0x4ea2('0x11')][_0x4ea2('0x13')]);}logger[_0x4ea2('0x11')](_0x4ea2('0xc'),_0x5929f7,_0x2e6cb5[_0x4ea2('0x11')]['message']);return _0x1441ae(_0x2e6cb5[_0x4ea2('0x11')]['message']);}else{logger[_0x4ea2('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x5929f7,_0x4ea2('0xd'));_0x1441ae(_0x2e6cb5['result'][_0x4ea2('0x13')]);}})[_0x4ea2('0x14')](function(_0xeb1b3a){logger[_0x4ea2('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x5929f7,_0xeb1b3a);_0x497204(_0xeb1b3a);});});}exports[_0x4ea2('0x15')]=function(_0x22cb8f){var _0x9ef92c=this;return new Promise(function(_0x4b2be0,_0x1dad65){return db['VoiceCallReport']['findAll']({'raw':_0x22cb8f[_0x4ea2('0x16')]?_0x22cb8f['options'][_0x4ea2('0x17')]===undefined?!![]:![]:!![],'where':_0x22cb8f['options']?_0x22cb8f['options'][_0x4ea2('0x18')]||null:null,'attributes':_0x22cb8f[_0x4ea2('0x16')]?_0x22cb8f['options'][_0x4ea2('0x19')]||null:null,'limit':_0x22cb8f[_0x4ea2('0x16')]?_0x22cb8f[_0x4ea2('0x16')]['limit']||null:null,'include':_0x22cb8f[_0x4ea2('0x16')]?_0x22cb8f[_0x4ea2('0x16')]['include']?_[_0x4ea2('0x1a')](_0x22cb8f[_0x4ea2('0x16')][_0x4ea2('0x1b')],function(_0x368621){return{'model':db[_0x368621[_0x4ea2('0x1c')]],'as':_0x368621['as'],'attributes':_0x368621[_0x4ea2('0x19')],'include':_0x368621['include']?_[_0x4ea2('0x1a')](_0x368621['include'],function(_0x3b3b0e){return{'model':db[_0x3b3b0e[_0x4ea2('0x1c')]],'as':_0x3b3b0e['as'],'attributes':_0x3b3b0e[_0x4ea2('0x19')],'include':_0x3b3b0e[_0x4ea2('0x1b')]?_[_0x4ea2('0x1a')](_0x3b3b0e[_0x4ea2('0x1b')],function(_0x11082d){return{'model':db[_0x11082d[_0x4ea2('0x1c')]],'as':_0x11082d['as'],'attributes':_0x11082d[_0x4ea2('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4ea2('0xa')](function(_0x33ca59){logger[_0x4ea2('0xb')]('GetVoiceCallReport',_0x22cb8f);logger[_0x4ea2('0xe')](_0x4ea2('0x15'),_0x22cb8f,JSON[_0x4ea2('0x10')](_0x33ca59));_0x4b2be0(_0x33ca59);})[_0x4ea2('0x14')](function(_0x23f1f9){logger[_0x4ea2('0x11')](_0x4ea2('0x15'),_0x23f1f9[_0x4ea2('0x13')],_0x22cb8f);_0x1dad65(_0x9ef92c[_0x4ea2('0x11')](0x1f4,_0x23f1f9[_0x4ea2('0x13')]));});});};exports[_0x4ea2('0x1d')]=function(_0x42f434){var _0x1b3e54=this;return new Promise(function(_0x2b33ba,_0x199d6c){return db[_0x4ea2('0x1e')][_0x4ea2('0x1f')](_0x42f434[_0x4ea2('0x20')],{'raw':_0x42f434['options']?_0x42f434['options'][_0x4ea2('0x17')]===undefined?!![]:![]:!![]})[_0x4ea2('0xa')](function(_0x5c71cb){logger['info']('CreateVoiceCallReport',_0x42f434);logger[_0x4ea2('0xe')](_0x4ea2('0x1d'),_0x42f434,JSON[_0x4ea2('0x10')](_0x5c71cb));_0x2b33ba(_0x5c71cb);})['catch'](function(_0x140188){logger['error'](_0x4ea2('0x1d'),_0x140188[_0x4ea2('0x13')],_0x42f434);_0x199d6c(_0x1b3e54[_0x4ea2('0x11')](0x1f4,_0x140188[_0x4ea2('0x13')]));});});};exports[_0x4ea2('0x21')]=function(_0x1e9a99){var _0x2639b6=this;return new Promise(function(_0x5de164,_0x1720b1){return db[_0x4ea2('0x1e')][_0x4ea2('0x22')](_0x1e9a99[_0x4ea2('0x20')],{'raw':_0x1e9a99[_0x4ea2('0x16')]?_0x1e9a99['options'][_0x4ea2('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e9a99[_0x4ea2('0x16')]?_0x1e9a99[_0x4ea2('0x16')]['where']||null:null,'attributes':_0x1e9a99[_0x4ea2('0x16')]?_0x1e9a99['options'][_0x4ea2('0x19')]||null:null,'limit':_0x1e9a99['options']?_0x1e9a99[_0x4ea2('0x16')][_0x4ea2('0x23')]||null:null})['then'](function(_0x45edf2){logger[_0x4ea2('0xb')](_0x4ea2('0x21'),_0x1e9a99);logger['debug'](_0x4ea2('0x21'),_0x1e9a99,JSON['stringify'](_0x45edf2));_0x5de164(_0x45edf2);})[_0x4ea2('0x14')](function(_0x5c5263){logger[_0x4ea2('0x11')](_0x4ea2('0x21'),_0x5c5263[_0x4ea2('0x13')],_0x1e9a99);_0x1720b1(_0x2639b6[_0x4ea2('0x11')](0x1f4,_0x5c5263[_0x4ea2('0x13')]));});});}; \ No newline at end of file +var _0xfde9=['message','result','catch','VoiceCallReport','findAll','options','where','attributes','limit','model','include','map','GetVoiceCallReport','debug','CreateVoiceCallReport','create','body','raw','update','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceCallReport,\x20%s,\x20%s'];(function(_0x20bc10,_0x35bed9){var _0x3bd5ce=function(_0x8d1e4c){while(--_0x8d1e4c){_0x20bc10['push'](_0x20bc10['shift']());}};_0x3bd5ce(++_0x35bed9);}(_0xfde9,0x66));var _0x9fde=function(_0x153e7d,_0x10a35f){_0x153e7d=_0x153e7d-0x0;var _0x3c22dd=_0xfde9[_0x153e7d];return _0x3c22dd;};'use strict';var _=require(_0x9fde('0x0'));var util=require(_0x9fde('0x1'));var moment=require(_0x9fde('0x2'));var BPromise=require(_0x9fde('0x3'));var rs=require(_0x9fde('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9fde('0x5'))['db'];var utils=require(_0x9fde('0x6'));var logger=require('../../config/logger')(_0x9fde('0x7'));var config=require(_0x9fde('0x8'));var jayson=require(_0x9fde('0x9'));var client=jayson[_0x9fde('0xa')][_0x9fde('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26f710,_0x41d637,_0x138672){return new BPromise(function(_0x230ca0,_0x1297b2){return client[_0x9fde('0xc')](_0x26f710,_0x138672)[_0x9fde('0xd')](function(_0x50e26){logger[_0x9fde('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x41d637,'request\x20sent');logger['debug'](_0x9fde('0xf'),_0x41d637,_0x9fde('0x10'),JSON[_0x9fde('0x11')](_0x50e26));if(_0x50e26['error']){if(_0x50e26[_0x9fde('0x12')][_0x9fde('0x13')]===0x1f4){logger[_0x9fde('0x12')](_0x9fde('0x14'),_0x41d637,_0x50e26[_0x9fde('0x12')][_0x9fde('0x15')]);return _0x1297b2(_0x50e26[_0x9fde('0x12')][_0x9fde('0x15')]);}logger[_0x9fde('0x12')](_0x9fde('0x14'),_0x41d637,_0x50e26[_0x9fde('0x12')][_0x9fde('0x15')]);return _0x230ca0(_0x50e26[_0x9fde('0x12')][_0x9fde('0x15')]);}else{logger[_0x9fde('0xe')](_0x9fde('0x14'),_0x41d637,_0x9fde('0x10'));_0x230ca0(_0x50e26[_0x9fde('0x16')]['message']);}})[_0x9fde('0x17')](function(_0x25de77){logger[_0x9fde('0x12')](_0x9fde('0x14'),_0x41d637,_0x25de77);_0x1297b2(_0x25de77);});});}exports['GetVoiceCallReport']=function(_0x77ed79){var _0x43be1b=this;return new Promise(function(_0xc7434d,_0x6f647a){return db[_0x9fde('0x18')][_0x9fde('0x19')]({'raw':_0x77ed79[_0x9fde('0x1a')]?_0x77ed79['options']['raw']===undefined?!![]:![]:!![],'where':_0x77ed79['options']?_0x77ed79[_0x9fde('0x1a')][_0x9fde('0x1b')]||null:null,'attributes':_0x77ed79[_0x9fde('0x1a')]?_0x77ed79['options'][_0x9fde('0x1c')]||null:null,'limit':_0x77ed79[_0x9fde('0x1a')]?_0x77ed79[_0x9fde('0x1a')][_0x9fde('0x1d')]||null:null,'include':_0x77ed79[_0x9fde('0x1a')]?_0x77ed79[_0x9fde('0x1a')]['include']?_['map'](_0x77ed79[_0x9fde('0x1a')]['include'],function(_0x26a131){return{'model':db[_0x26a131[_0x9fde('0x1e')]],'as':_0x26a131['as'],'attributes':_0x26a131[_0x9fde('0x1c')],'include':_0x26a131[_0x9fde('0x1f')]?_[_0x9fde('0x20')](_0x26a131[_0x9fde('0x1f')],function(_0xa97db0){return{'model':db[_0xa97db0[_0x9fde('0x1e')]],'as':_0xa97db0['as'],'attributes':_0xa97db0[_0x9fde('0x1c')],'include':_0xa97db0[_0x9fde('0x1f')]?_[_0x9fde('0x20')](_0xa97db0[_0x9fde('0x1f')],function(_0x5c9eb1){return{'model':db[_0x5c9eb1['model']],'as':_0x5c9eb1['as'],'attributes':_0x5c9eb1['attributes']};}):[]};}):[]};}):[]:[]})[_0x9fde('0xd')](function(_0x536364){logger[_0x9fde('0xe')](_0x9fde('0x21'),_0x77ed79);logger[_0x9fde('0x22')](_0x9fde('0x21'),_0x77ed79,JSON[_0x9fde('0x11')](_0x536364));_0xc7434d(_0x536364);})[_0x9fde('0x17')](function(_0x25e9b5){logger['error']('GetVoiceCallReport',_0x25e9b5[_0x9fde('0x15')],_0x77ed79);_0x6f647a(_0x43be1b[_0x9fde('0x12')](0x1f4,_0x25e9b5[_0x9fde('0x15')]));});});};exports[_0x9fde('0x23')]=function(_0x428f92){var _0x3cdec9=this;return new Promise(function(_0x7ef0a8,_0x4447b0){return db[_0x9fde('0x18')][_0x9fde('0x24')](_0x428f92[_0x9fde('0x25')],{'raw':_0x428f92[_0x9fde('0x1a')]?_0x428f92[_0x9fde('0x1a')][_0x9fde('0x26')]===undefined?!![]:![]:!![]})[_0x9fde('0xd')](function(_0x39d7e1){logger[_0x9fde('0xe')](_0x9fde('0x23'),_0x428f92);logger['debug'](_0x9fde('0x23'),_0x428f92,JSON[_0x9fde('0x11')](_0x39d7e1));_0x7ef0a8(_0x39d7e1);})[_0x9fde('0x17')](function(_0x1e7f80){logger['error'](_0x9fde('0x23'),_0x1e7f80[_0x9fde('0x15')],_0x428f92);_0x4447b0(_0x3cdec9[_0x9fde('0x12')](0x1f4,_0x1e7f80[_0x9fde('0x15')]));});});};exports['UpdateVoiceCallReport']=function(_0x17e8d7){var _0xdb96ee=this;return new Promise(function(_0x37a3fc,_0x1693d6){return db[_0x9fde('0x18')][_0x9fde('0x27')](_0x17e8d7['body'],{'raw':_0x17e8d7[_0x9fde('0x1a')]?_0x17e8d7[_0x9fde('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17e8d7[_0x9fde('0x1a')]?_0x17e8d7[_0x9fde('0x1a')]['where']||null:null,'attributes':_0x17e8d7['options']?_0x17e8d7[_0x9fde('0x1a')][_0x9fde('0x1c')]||null:null,'limit':_0x17e8d7['options']?_0x17e8d7[_0x9fde('0x1a')]['limit']||null:null})[_0x9fde('0xd')](function(_0x4af5c0){logger[_0x9fde('0xe')](_0x9fde('0x28'),_0x17e8d7);logger['debug'](_0x9fde('0x28'),_0x17e8d7,JSON[_0x9fde('0x11')](_0x4af5c0));_0x37a3fc(_0x4af5c0);})[_0x9fde('0x17')](function(_0x1e9a1e){logger[_0x9fde('0x12')](_0x9fde('0x28'),_0x1e9a1e[_0x9fde('0x15')],_0x17e8d7);_0x1693d6(_0xdb96ee['error'](0x1f4,_0x1e9a1e[_0x9fde('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index b52f04f..2d79e54 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 _0x2699=['get','isAuthenticated','index','/:id','show','post','create','update','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2699,0x6f));var _0x9269=function(_0x55a440,_0x5dacbc){_0x55a440=_0x55a440-0x0;var _0x1561b9=_0x2699[_0x55a440];return _0x1561b9;};'use strict';var multer=require('multer');var util=require(_0x9269('0x0'));var path=require(_0x9269('0x1'));var timeout=require(_0x9269('0x2'));var express=require('express');var router=express[_0x9269('0x3')]();var fs_extra=require(_0x9269('0x4'));var auth=require(_0x9269('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9269('0x6'));var controller=require(_0x9269('0x7'));router[_0x9269('0x8')]('/',auth[_0x9269('0x9')](),controller[_0x9269('0xa')]);router['get'](_0x9269('0xb'),auth[_0x9269('0x9')](),controller[_0x9269('0xc')]);router[_0x9269('0xd')]('/',auth[_0x9269('0x9')](),controller[_0x9269('0xe')]);router['put'](_0x9269('0xb'),auth[_0x9269('0x9')](),controller[_0x9269('0xf')]);router['delete'](_0x9269('0xb'),auth['isAuthenticated'](),controller[_0x9269('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8cce=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','update','exports','multer','util'];(function(_0x50ffbb,_0x21a925){var _0x576a1c=function(_0x8e27e6){while(--_0x8e27e6){_0x50ffbb['push'](_0x50ffbb['shift']());}};_0x576a1c(++_0x21a925);}(_0x8cce,0x18d));var _0xe8cc=function(_0x58fe40,_0x210896){_0x58fe40=_0x58fe40-0x0;var _0x28ae2c=_0x8cce[_0x58fe40];return _0x28ae2c;};'use strict';var multer=require(_0xe8cc('0x0'));var util=require(_0xe8cc('0x1'));var path=require(_0xe8cc('0x2'));var timeout=require('connect-timeout');var express=require(_0xe8cc('0x3'));var router=express[_0xe8cc('0x4')]();var fs_extra=require(_0xe8cc('0x5'));var auth=require(_0xe8cc('0x6'));var interaction=require(_0xe8cc('0x7'));var config=require(_0xe8cc('0x8'));var controller=require(_0xe8cc('0x9'));router[_0xe8cc('0xa')]('/',auth[_0xe8cc('0xb')](),controller[_0xe8cc('0xc')]);router[_0xe8cc('0xa')](_0xe8cc('0xd'),auth[_0xe8cc('0xb')](),controller[_0xe8cc('0xe')]);router[_0xe8cc('0xf')]('/',auth[_0xe8cc('0xb')](),controller[_0xe8cc('0x10')]);router['put'](_0xe8cc('0xd'),auth['isAuthenticated'](),controller[_0xe8cc('0x11')]);router['delete']('/:id',auth[_0xe8cc('0xb')](),controller['destroy']);module[_0xe8cc('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 1d20803..5423367 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 _0xf8f5=['name','setDataValue','options','join','getDataValue','BOOLEAN','exports','STRING'];(function(_0x40ac47,_0x323d1b){var _0x5b8651=function(_0x5c94a9){while(--_0x5c94a9){_0x40ac47['push'](_0x40ac47['shift']());}};_0x5b8651(++_0x323d1b);}(_0xf8f5,0xa6));var _0x5f8f=function(_0x149462,_0x17522a){_0x149462=_0x149462-0x0;var _0x355323=_0xf8f5[_0x149462];return _0x355323;};'use strict';var Sequelize=require('sequelize');module[_0x5f8f('0x0')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x5f8f('0x1')],'unique':_0x5f8f('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x5f8f('0x1')],'set':function(_0x4812b9){this[_0x5f8f('0x3')](_0x5f8f('0x4'),_0x4812b9?_0x4812b9[_0x5f8f('0x5')](''):[]);},'get':function(){return this[_0x5f8f('0x6')](_0x5f8f('0x4'))?this['getDataValue'](_0x5f8f('0x4'))['split'](''):[];}},'auth':{'type':Sequelize[_0x5f8f('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x5f8f('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x5f8f('0x1')]},'description':{'type':Sequelize[_0x5f8f('0x1')]}}; \ No newline at end of file +var _0x797e=['sequelize','exports','STRING','setDataValue','options','join','getDataValue','split','BOOLEAN'];(function(_0x45681a,_0x22c8f1){var _0x20052f=function(_0x51bce1){while(--_0x51bce1){_0x45681a['push'](_0x45681a['shift']());}};_0x20052f(++_0x22c8f1);}(_0x797e,0xa2));var _0xe797=function(_0x24b7be,_0x49fdbd){_0x24b7be=_0x24b7be-0x0;var _0x5d2779=_0x797e[_0x24b7be];return _0x5d2779;};'use strict';var Sequelize=require(_0xe797('0x0'));module[_0xe797('0x1')]={'name':{'type':Sequelize[_0xe797('0x2')]},'prefix':{'type':Sequelize[_0xe797('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xe797('0x2')],'set':function(_0x4b17f8){this[_0xe797('0x3')](_0xe797('0x4'),_0x4b17f8?_0x4b17f8[_0xe797('0x5')](''):[]);},'get':function(){return this[_0xe797('0x6')](_0xe797('0x4'))?this[_0xe797('0x6')](_0xe797('0x4'))[_0xe797('0x7')](''):[];}},'auth':{'type':Sequelize[_0xe797('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xe797('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe797('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 793343a..589f5c2 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 _0x74b1=['merge','options','VoiceChanSpy','includeAll','include','show','params','find','catch','create','body','user','role','ChanSpies','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','squel','crypto','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','get','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','type','VIRTUAL'];(function(_0x396429,_0xcdd37e){var _0x3bf594=function(_0x39576a){while(--_0x39576a){_0x396429['push'](_0x396429['shift']());}};_0x3bf594(++_0xcdd37e);}(_0x74b1,0xb5));var _0x174b=function(_0x1af98d,_0x3c608e){_0x1af98d=_0x1af98d-0x0;var _0x3553ea=_0x74b1[_0x1af98d];return _0x3553ea;};'use strict';var emlformat=require(_0x174b('0x0'));var rimraf=require(_0x174b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x174b('0x2'));var rp=require(_0x174b('0x3'));var moment=require('moment');var BPromise=require(_0x174b('0x4'));var Mustache=require(_0x174b('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x174b('0x6'));var ejs=require(_0x174b('0x7'));var fs=require('fs');var fs_extra=require(_0x174b('0x8'));var _=require('lodash');var squel=require(_0x174b('0x9'));var crypto=require(_0x174b('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x174b('0x6'));var querystring=require('querystring');var Papa=require(_0x174b('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x174b('0xc'));var as=require(_0x174b('0xd'));var hardwareService=require(_0x174b('0xe'));var logger=require(_0x174b('0xf'))(_0x174b('0x10'));var utils=require(_0x174b('0x11'));var config=require(_0x174b('0x12'));var licenseUtil=require(_0x174b('0x13'));var db=require(_0x174b('0x14'))['db'];function respondWithStatusCode(_0x4ea947,_0x70fa85){_0x70fa85=_0x70fa85||0xcc;return function(_0xc996e){if(_0xc996e){return _0x4ea947[_0x174b('0x15')](_0x70fa85);}return _0x4ea947[_0x174b('0x16')](_0x70fa85)[_0x174b('0x17')]();};}function respondWithResult(_0x44b778,_0xe9c224){_0xe9c224=_0xe9c224||0xc8;return function(_0x43143b){if(_0x43143b){return _0x44b778[_0x174b('0x16')](_0xe9c224)['json'](_0x43143b);}};}function respondWithFilteredResult(_0x1c5579,_0xde8235){return function(_0x210a3c){if(_0x210a3c){var _0x4a7aeb=typeof _0xde8235['offset']===_0x174b('0x18')&&typeof _0xde8235[_0x174b('0x19')]===_0x174b('0x18');var _0x209dd4=_0x210a3c[_0x174b('0x1a')];var _0x31f801=_0x4a7aeb?0x0:_0xde8235['offset'];var _0x1049dc=_0x4a7aeb?_0x210a3c[_0x174b('0x1a')]:_0xde8235[_0x174b('0x1b')]+_0xde8235[_0x174b('0x19')];var _0x2bef75;if(_0x1049dc>=_0x209dd4){_0x1049dc=_0x209dd4;_0x2bef75=0xc8;}else{_0x2bef75=0xce;}_0x1c5579[_0x174b('0x16')](_0x2bef75);return _0x1c5579[_0x174b('0x1c')](_0x174b('0x1d'),_0x31f801+'-'+_0x1049dc+'/'+_0x209dd4)[_0x174b('0x1e')](_0x210a3c);}return null;};}function patchUpdates(_0x1458a1){return function(_0x4e58f0){try{jsonpatch[_0x174b('0x1f')](_0x4e58f0,_0x1458a1,!![]);}catch(_0x49d32e){return BPromise['reject'](_0x49d32e);}return _0x4e58f0[_0x174b('0x20')]();};}function saveUpdates(_0x568b3f,_0x537ac3){return function(_0x2c09ad){if(_0x2c09ad){return _0x2c09ad[_0x174b('0x21')](_0x568b3f)[_0x174b('0x22')](function(_0x55f2ac){return _0x55f2ac;});}return null;};}function removeEntity(_0x150304,_0x4da1da){return function(_0x3b57c5){if(_0x3b57c5){return _0x3b57c5[_0x174b('0x23')]()[_0x174b('0x22')](function(){var _0x294aac=_0x3b57c5[_0x174b('0x24')]({'plain':!![]});var _0x242295='ChanSpies';return db['UserProfileResource'][_0x174b('0x23')]({'where':{'type':_0x242295,'resourceId':_0x294aac['id']}})[_0x174b('0x22')](function(){return _0x3b57c5;});})[_0x174b('0x22')](function(){_0x150304[_0x174b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x276384,_0x3215bd){return function(_0x583b0c){if(!_0x583b0c){_0x276384[_0x174b('0x15')](0x194);}return _0x583b0c;};}function handleError(_0x2eb1cb,_0x17a237){_0x17a237=_0x17a237||0x1f4;return function(_0x50f947){logger[_0x174b('0x25')](_0x50f947[_0x174b('0x26')]);if(_0x50f947['name']){delete _0x50f947[_0x174b('0x27')];}_0x2eb1cb['status'](_0x17a237)[_0x174b('0x28')](_0x50f947);};}exports[_0x174b('0x29')]=function(_0x220206,_0x3e6fb0){var _0x2a7ec2={},_0x580731={},_0x22bf34={'count':0x0,'rows':[]};var _0x3a72a9=_[_0x174b('0x2a')](db['VoiceChanSpy'][_0x174b('0x2b')],function(_0x146a08){return{'name':_0x146a08[_0x174b('0x2c')],'type':_0x146a08['type'][_0x174b('0x2d')]};});_0x580731['model']=_['map'](_0x3a72a9,_0x174b('0x27'));_0x580731[_0x174b('0x2e')]=_[_0x174b('0x2f')](_0x220206[_0x174b('0x2e')]);_0x580731['filters']=_[_0x174b('0x30')](_0x580731[_0x174b('0x31')],_0x580731[_0x174b('0x2e')]);_0x2a7ec2[_0x174b('0x32')]=_[_0x174b('0x30')](_0x580731[_0x174b('0x31')],qs[_0x174b('0x33')](_0x220206['query'][_0x174b('0x33')]));_0x2a7ec2['attributes']=_0x2a7ec2['attributes'][_0x174b('0x34')]?_0x2a7ec2[_0x174b('0x32')]:_0x580731[_0x174b('0x31')];if(!_0x220206[_0x174b('0x2e')][_0x174b('0x35')]('nolimit')){_0x2a7ec2[_0x174b('0x19')]=qs[_0x174b('0x19')](_0x220206[_0x174b('0x2e')][_0x174b('0x19')]);_0x2a7ec2[_0x174b('0x1b')]=qs[_0x174b('0x1b')](_0x220206[_0x174b('0x2e')][_0x174b('0x1b')]);}_0x2a7ec2[_0x174b('0x36')]=qs['sort'](_0x220206['query'][_0x174b('0x37')]);_0x2a7ec2[_0x174b('0x38')]=qs[_0x174b('0x39')](_[_0x174b('0x3a')](_0x220206[_0x174b('0x2e')],_0x580731['filters']),_0x3a72a9);if(_0x220206['query'][_0x174b('0x3b')]){_0x2a7ec2[_0x174b('0x38')]=_['merge'](_0x2a7ec2[_0x174b('0x38')],{'$or':_[_0x174b('0x2a')](_0x3a72a9,function(_0x1cdefc){if(_0x1cdefc[_0x174b('0x3c')]!==_0x174b('0x3d')){var _0xcbae0f={};_0xcbae0f[_0x1cdefc['name']]={'$like':'%'+_0x220206['query'][_0x174b('0x3b')]+'%'};return _0xcbae0f;}})});}_0x2a7ec2=_[_0x174b('0x3e')]({},_0x2a7ec2,_0x220206[_0x174b('0x3f')]);var _0x5015ce={'where':_0x2a7ec2[_0x174b('0x38')]};return db[_0x174b('0x40')][_0x174b('0x1a')](_0x5015ce)[_0x174b('0x22')](function(_0x1d1d2b){_0x22bf34[_0x174b('0x1a')]=_0x1d1d2b;if(_0x220206[_0x174b('0x2e')][_0x174b('0x41')]){_0x2a7ec2[_0x174b('0x42')]=[{'all':!![]}];}return db[_0x174b('0x40')]['findAll'](_0x2a7ec2);})[_0x174b('0x22')](function(_0xf9dd00){_0x22bf34['rows']=_0xf9dd00;return _0x22bf34;})[_0x174b('0x22')](respondWithFilteredResult(_0x3e6fb0,_0x2a7ec2))['catch'](handleError(_0x3e6fb0,null));};exports[_0x174b('0x43')]=function(_0x6fbdc4,_0x468059){var _0x4c9cb4={'raw':![],'where':{'id':_0x6fbdc4[_0x174b('0x44')]['id']}},_0x1fa140={};_0x1fa140['model']=_['keys'](db[_0x174b('0x40')][_0x174b('0x2b')]);_0x1fa140['query']=_['keys'](_0x6fbdc4[_0x174b('0x2e')]);_0x1fa140[_0x174b('0x39')]=_[_0x174b('0x30')](_0x1fa140[_0x174b('0x31')],_0x1fa140['query']);_0x4c9cb4[_0x174b('0x32')]=_['intersection'](_0x1fa140['model'],qs[_0x174b('0x33')](_0x6fbdc4[_0x174b('0x2e')][_0x174b('0x33')]));_0x4c9cb4['attributes']=_0x4c9cb4[_0x174b('0x32')]['length']?_0x4c9cb4['attributes']:_0x1fa140[_0x174b('0x31')];if(_0x6fbdc4[_0x174b('0x2e')]['includeAll']){_0x4c9cb4[_0x174b('0x42')]=[{'all':!![]}];}_0x4c9cb4=_[_0x174b('0x3e')]({},_0x4c9cb4,_0x6fbdc4[_0x174b('0x3f')]);return db[_0x174b('0x40')][_0x174b('0x45')](_0x4c9cb4)[_0x174b('0x22')](handleEntityNotFound(_0x468059,null))[_0x174b('0x22')](respondWithResult(_0x468059,null))[_0x174b('0x46')](handleError(_0x468059,null));};exports[_0x174b('0x47')]=function(_0x565ad0,_0x4cd165){return db['VoiceChanSpy'][_0x174b('0x47')](_0x565ad0[_0x174b('0x48')],{})[_0x174b('0x22')](function(_0x12ae01){var _0x38cb5e=_0x565ad0[_0x174b('0x49')]['get']({'plain':!![]});if(!_0x38cb5e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38cb5e[_0x174b('0x4a')]===_0x174b('0x49')){var _0x41d309=_0x12ae01[_0x174b('0x24')]({'plain':!![]});var _0xd27c7d=_0x174b('0x4b');return db[_0x174b('0x4c')][_0x174b('0x45')]({'where':{'name':_0xd27c7d,'userProfileId':_0x38cb5e[_0x174b('0x4d')]},'raw':!![]})['then'](function(_0x306b23){if(_0x306b23&&_0x306b23[_0x174b('0x4e')]===0x0){return db[_0x174b('0x4f')][_0x174b('0x47')]({'name':_0x41d309[_0x174b('0x27')],'resourceId':_0x41d309['id'],'type':_0x306b23[_0x174b('0x27')],'sectionId':_0x306b23['id']},{})[_0x174b('0x22')](function(){return _0x12ae01;});}else{return _0x12ae01;}})[_0x174b('0x46')](function(_0x39dd9d){logger['error'](_0x174b('0x50'),_0x39dd9d);throw _0x39dd9d;});}return _0x12ae01;})['then'](respondWithResult(_0x4cd165,0xc9))['catch'](handleError(_0x4cd165,null));};exports[_0x174b('0x21')]=function(_0x50f3e3,_0x55bc56){if(_0x50f3e3[_0x174b('0x48')]['id']){delete _0x50f3e3[_0x174b('0x48')]['id'];}return db[_0x174b('0x40')][_0x174b('0x45')]({'where':{'id':_0x50f3e3[_0x174b('0x44')]['id']}})[_0x174b('0x22')](handleEntityNotFound(_0x55bc56,null))['then'](saveUpdates(_0x50f3e3[_0x174b('0x48')],null))[_0x174b('0x22')](respondWithResult(_0x55bc56,null))['catch'](handleError(_0x55bc56,null));};exports[_0x174b('0x23')]=function(_0x256d6e,_0x201869){return db['VoiceChanSpy']['find']({'where':{'id':_0x256d6e[_0x174b('0x44')]['id']}})['then'](handleEntityNotFound(_0x201869,null))['then'](removeEntity(_0x201869,null))[_0x174b('0x46')](handleError(_0x201869,null));}; \ No newline at end of file +var _0x4517=['nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','VoiceChanSpy','include','rows','catch','show','params','includeAll','find','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','body','rimraf','zip-dir','request-promise','moment','bluebird','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/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply','reject','update','then','destroy','get','ChanSpies','UserProfileResource','error','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x227b64,_0x1c6f72){var _0xc84cb5=function(_0x12e690){while(--_0x12e690){_0x227b64['push'](_0x227b64['shift']());}};_0xc84cb5(++_0x1c6f72);}(_0x4517,0x112));var _0x7451=function(_0xd738b3,_0x2c1a5f){_0xd738b3=_0xd738b3-0x0;var _0x42b6c5=_0x4517[_0xd738b3];return _0x42b6c5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7451('0x0'));var zipdir=require(_0x7451('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7451('0x2'));var moment=require(_0x7451('0x3'));var BPromise=require(_0x7451('0x4'));var Mustache=require(_0x7451('0x5'));var util=require(_0x7451('0x6'));var path=require(_0x7451('0x7'));var sox=require(_0x7451('0x8'));var csv=require(_0x7451('0x9'));var ejs=require(_0x7451('0xa'));var fs=require('fs');var fs_extra=require(_0x7451('0xb'));var _=require(_0x7451('0xc'));var squel=require(_0x7451('0xd'));var crypto=require(_0x7451('0xe'));var jsforce=require(_0x7451('0xf'));var deskjs=require(_0x7451('0x10'));var toCsv=require(_0x7451('0x9'));var querystring=require(_0x7451('0x11'));var Papa=require('papaparse');var Redis=require(_0x7451('0x12'));var authService=require(_0x7451('0x13'));var qs=require(_0x7451('0x14'));var as=require(_0x7451('0x15'));var hardwareService=require(_0x7451('0x16'));var logger=require(_0x7451('0x17'))(_0x7451('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7451('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x450463,_0x2cb40b){_0x2cb40b=_0x2cb40b||0xcc;return function(_0x4a14dc){if(_0x4a14dc){return _0x450463[_0x7451('0x1a')](_0x2cb40b);}return _0x450463[_0x7451('0x1b')](_0x2cb40b)['end']();};}function respondWithResult(_0x46811e,_0x282128){_0x282128=_0x282128||0xc8;return function(_0x110ed6){if(_0x110ed6){return _0x46811e[_0x7451('0x1b')](_0x282128)['json'](_0x110ed6);}};}function respondWithFilteredResult(_0x357ea9,_0x313385){return function(_0x408336){if(_0x408336){var _0x58c0cd=typeof _0x313385['offset']===_0x7451('0x1c')&&typeof _0x313385[_0x7451('0x1d')]===_0x7451('0x1c');var _0xa8a121=_0x408336[_0x7451('0x1e')];var _0xd47ee4=_0x58c0cd?0x0:_0x313385[_0x7451('0x1f')];var _0x1120b1=_0x58c0cd?_0x408336[_0x7451('0x1e')]:_0x313385['offset']+_0x313385[_0x7451('0x1d')];var _0x32e250;if(_0x1120b1>=_0xa8a121){_0x1120b1=_0xa8a121;_0x32e250=0xc8;}else{_0x32e250=0xce;}_0x357ea9[_0x7451('0x1b')](_0x32e250);return _0x357ea9['set'](_0x7451('0x20'),_0xd47ee4+'-'+_0x1120b1+'/'+_0xa8a121)[_0x7451('0x21')](_0x408336);}return null;};}function patchUpdates(_0x3ffb08){return function(_0x3b5d59){try{jsonpatch[_0x7451('0x22')](_0x3b5d59,_0x3ffb08,!![]);}catch(_0x293e29){return BPromise[_0x7451('0x23')](_0x293e29);}return _0x3b5d59['save']();};}function saveUpdates(_0x3a0c1e,_0x309be0){return function(_0x561e12){if(_0x561e12){return _0x561e12[_0x7451('0x24')](_0x3a0c1e)[_0x7451('0x25')](function(_0x2962f8){return _0x2962f8;});}return null;};}function removeEntity(_0x57cc15,_0x19e33b){return function(_0x21dd67){if(_0x21dd67){return _0x21dd67[_0x7451('0x26')]()[_0x7451('0x25')](function(){var _0x37bc47=_0x21dd67[_0x7451('0x27')]({'plain':!![]});var _0x3c56f1=_0x7451('0x28');return db[_0x7451('0x29')]['destroy']({'where':{'type':_0x3c56f1,'resourceId':_0x37bc47['id']}})[_0x7451('0x25')](function(){return _0x21dd67;});})[_0x7451('0x25')](function(){_0x57cc15['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xcc793e,_0x1edcf2){return function(_0x248d83){if(!_0x248d83){_0xcc793e[_0x7451('0x1a')](0x194);}return _0x248d83;};}function handleError(_0x30ef36,_0x19547e){_0x19547e=_0x19547e||0x1f4;return function(_0x4b5b26){logger[_0x7451('0x2a')](_0x4b5b26['stack']);if(_0x4b5b26[_0x7451('0x2b')]){delete _0x4b5b26[_0x7451('0x2b')];}_0x30ef36['status'](_0x19547e)[_0x7451('0x2c')](_0x4b5b26);};}exports[_0x7451('0x2d')]=function(_0x40b6c3,_0x3a397e){var _0x17d52c={},_0x4e24f7={},_0x2071e5={'count':0x0,'rows':[]};var _0x43d305=_[_0x7451('0x2e')](db['VoiceChanSpy'][_0x7451('0x2f')],function(_0x4654e7){return{'name':_0x4654e7['fieldName'],'type':_0x4654e7['type'][_0x7451('0x30')]};});_0x4e24f7[_0x7451('0x31')]=_['map'](_0x43d305,'name');_0x4e24f7[_0x7451('0x32')]=_[_0x7451('0x33')](_0x40b6c3[_0x7451('0x32')]);_0x4e24f7[_0x7451('0x34')]=_[_0x7451('0x35')](_0x4e24f7[_0x7451('0x31')],_0x4e24f7[_0x7451('0x32')]);_0x17d52c[_0x7451('0x36')]=_['intersection'](_0x4e24f7[_0x7451('0x31')],qs[_0x7451('0x37')](_0x40b6c3['query'][_0x7451('0x37')]));_0x17d52c[_0x7451('0x36')]=_0x17d52c[_0x7451('0x36')][_0x7451('0x38')]?_0x17d52c[_0x7451('0x36')]:_0x4e24f7[_0x7451('0x31')];if(!_0x40b6c3['query'][_0x7451('0x39')](_0x7451('0x3a'))){_0x17d52c['limit']=qs[_0x7451('0x1d')](_0x40b6c3[_0x7451('0x32')]['limit']);_0x17d52c['offset']=qs['offset'](_0x40b6c3['query']['offset']);}_0x17d52c[_0x7451('0x3b')]=qs[_0x7451('0x3c')](_0x40b6c3[_0x7451('0x32')][_0x7451('0x3c')]);_0x17d52c[_0x7451('0x3d')]=qs['filters'](_['pick'](_0x40b6c3['query'],_0x4e24f7['filters']),_0x43d305);if(_0x40b6c3['query'][_0x7451('0x3e')]){_0x17d52c[_0x7451('0x3d')]=_[_0x7451('0x3f')](_0x17d52c[_0x7451('0x3d')],{'$or':_[_0x7451('0x2e')](_0x43d305,function(_0xfa0b5a){if(_0xfa0b5a[_0x7451('0x40')]!==_0x7451('0x41')){var _0x201d96={};_0x201d96[_0xfa0b5a[_0x7451('0x2b')]]={'$like':'%'+_0x40b6c3[_0x7451('0x32')]['filter']+'%'};return _0x201d96;}})});}_0x17d52c=_['merge']({},_0x17d52c,_0x40b6c3[_0x7451('0x42')]);var _0x57f1b2={'where':_0x17d52c[_0x7451('0x3d')]};return db[_0x7451('0x43')]['count'](_0x57f1b2)['then'](function(_0x1f5bf3){_0x2071e5['count']=_0x1f5bf3;if(_0x40b6c3[_0x7451('0x32')]['includeAll']){_0x17d52c[_0x7451('0x44')]=[{'all':!![]}];}return db[_0x7451('0x43')]['findAll'](_0x17d52c);})[_0x7451('0x25')](function(_0x4c326d){_0x2071e5[_0x7451('0x45')]=_0x4c326d;return _0x2071e5;})[_0x7451('0x25')](respondWithFilteredResult(_0x3a397e,_0x17d52c))[_0x7451('0x46')](handleError(_0x3a397e,null));};exports[_0x7451('0x47')]=function(_0x44e636,_0x1d2b1e){var _0x387279={'raw':![],'where':{'id':_0x44e636[_0x7451('0x48')]['id']}},_0x1fcae7={};_0x1fcae7[_0x7451('0x31')]=_[_0x7451('0x33')](db[_0x7451('0x43')][_0x7451('0x2f')]);_0x1fcae7[_0x7451('0x32')]=_['keys'](_0x44e636[_0x7451('0x32')]);_0x1fcae7[_0x7451('0x34')]=_[_0x7451('0x35')](_0x1fcae7[_0x7451('0x31')],_0x1fcae7['query']);_0x387279[_0x7451('0x36')]=_['intersection'](_0x1fcae7['model'],qs['fields'](_0x44e636['query']['fields']));_0x387279[_0x7451('0x36')]=_0x387279[_0x7451('0x36')][_0x7451('0x38')]?_0x387279['attributes']:_0x1fcae7[_0x7451('0x31')];if(_0x44e636[_0x7451('0x32')][_0x7451('0x49')]){_0x387279[_0x7451('0x44')]=[{'all':!![]}];}_0x387279=_[_0x7451('0x3f')]({},_0x387279,_0x44e636[_0x7451('0x42')]);return db[_0x7451('0x43')][_0x7451('0x4a')](_0x387279)[_0x7451('0x25')](handleEntityNotFound(_0x1d2b1e,null))['then'](respondWithResult(_0x1d2b1e,null))['catch'](handleError(_0x1d2b1e,null));};exports['create']=function(_0xd26beb,_0x3acf1d){return db[_0x7451('0x43')]['create'](_0xd26beb['body'],{})['then'](function(_0x7c23ad){var _0x55761d=_0xd26beb['user'][_0x7451('0x27')]({'plain':!![]});if(!_0x55761d)throw new Error(_0x7451('0x4b'));if(_0x55761d[_0x7451('0x4c')]===_0x7451('0x4d')){var _0x24e028=_0x7c23ad['get']({'plain':!![]});var _0x2d39f0='ChanSpies';return db[_0x7451('0x4e')][_0x7451('0x4a')]({'where':{'name':_0x2d39f0,'userProfileId':_0x55761d[_0x7451('0x4f')]},'raw':!![]})[_0x7451('0x25')](function(_0x123d8f){if(_0x123d8f&&_0x123d8f[_0x7451('0x50')]===0x0){return db[_0x7451('0x29')][_0x7451('0x51')]({'name':_0x24e028[_0x7451('0x2b')],'resourceId':_0x24e028['id'],'type':_0x123d8f['name'],'sectionId':_0x123d8f['id']},{})['then'](function(){return _0x7c23ad;});}else{return _0x7c23ad;}})[_0x7451('0x46')](function(_0x94f802){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x94f802);throw _0x94f802;});}return _0x7c23ad;})['then'](respondWithResult(_0x3acf1d,0xc9))[_0x7451('0x46')](handleError(_0x3acf1d,null));};exports[_0x7451('0x24')]=function(_0x454a88,_0x22c4db){if(_0x454a88[_0x7451('0x52')]['id']){delete _0x454a88[_0x7451('0x52')]['id'];}return db['VoiceChanSpy'][_0x7451('0x4a')]({'where':{'id':_0x454a88['params']['id']}})['then'](handleEntityNotFound(_0x22c4db,null))['then'](saveUpdates(_0x454a88[_0x7451('0x52')],null))[_0x7451('0x25')](respondWithResult(_0x22c4db,null))[_0x7451('0x46')](handleError(_0x22c4db,null));};exports[_0x7451('0x26')]=function(_0x68fc70,_0x3aa92f){return db[_0x7451('0x43')]['find']({'where':{'id':_0x68fc70[_0x7451('0x48')]['id']}})[_0x7451('0x25')](handleEntityNotFound(_0x3aa92f,null))[_0x7451('0x25')](removeEntity(_0x3aa92f,null))[_0x7451('0x46')](handleError(_0x3aa92f,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index dfd728f..7e71c10 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 _0x48df=['internal','concat','User','agent','catch','exports','models','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','destroy','lodash','util','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','merge','Set','CDR(type)=%s','chanspy','push','auth','password','SIP/%s,%s','name','options','record','StopMixMonitor','length'];(function(_0x172250,_0x2c2937){var _0x104328=function(_0xe455e4){while(--_0xe455e4){_0x172250['push'](_0x172250['shift']());}};_0x104328(++_0x2c2937);}(_0x48df,0x73));var _0xf48d=function(_0xa45395,_0x5579e6){_0xa45395=_0xa45395-0x0;var _0x3c83d2=_0x48df[_0xa45395];return _0x3c83d2;};'use strict';var _=require(_0xf48d('0x0'));var util=require(_0xf48d('0x1'));var BPromise=require('bluebird');var attributes=require(_0xf48d('0x2'));var getUserApplications=function(_0x274c9d,_0x5d58d7,_0x518fd9){var _0x3a3676=0x1;var _0x2dd8bf=[];var _0x2bf2aa={'context':_0x5d58d7[_0xf48d('0x3')]||_0xf48d('0x4'),'exten':util[_0xf48d('0x5')](_0xf48d('0x6'),_0x274c9d[_0xf48d('0x7')],_0x518fd9),'type':'system','isApp':![],'ChanSpyId':_0x274c9d['id'],'UserId':_0x5d58d7['id']};_0x2dd8bf['push'](_[_0xf48d('0x8')]({'app':_0xf48d('0x9'),'appdata':util['format'](_0xf48d('0xa'),_0xf48d('0xb')),'priority':_0x3a3676++},_0x2bf2aa));if(_0x274c9d['record']){_0x2dd8bf[_0xf48d('0xc')](_['merge']({'app':'MixMonitor','appdata':util[_0xf48d('0x5')]('${UNIQUEID}.%s,a',_0x274c9d['recordingFormat']),'priority':_0x3a3676++},_0x2bf2aa));}if(_0x274c9d[_0xf48d('0xd')]){_0x2dd8bf[_0xf48d('0xc')](_['merge']({'app':'Authenticate','appdata':_0x274c9d[_0xf48d('0xe')],'priority':_0x3a3676++},_0x2bf2aa));}_0x2dd8bf[_0xf48d('0xc')](_[_0xf48d('0x8')]({'app':'ChanSpy','appdata':util[_0xf48d('0x5')](_0xf48d('0xf'),_0x5d58d7[_0xf48d('0x10')],_0x274c9d[_0xf48d('0x11')]?_0x274c9d['options']['join'](''):''),'priority':_0x3a3676++},_0x2bf2aa));if(_0x274c9d[_0xf48d('0x12')]){_0x2dd8bf[_0xf48d('0xc')](_[_0xf48d('0x8')]({'app':_0xf48d('0x13'),'priority':_0x3a3676++},_0x2bf2aa));}return _0x2dd8bf;};var getChanSpyApplications=function(_0xe1dc16,_0x558ece){var _0x4ba5fc=[];for(var _0x2c28cb=0x0,_0x30a2c6=0x1;_0x2c28cb<_0x558ece[_0xf48d('0x14')];_0x2c28cb++,_0x30a2c6=0x1){_0x4ba5fc=_0x4ba5fc['concat'](getUserApplications(_0xe1dc16,_0x558ece[_0x2c28cb],_0x558ece[_0x2c28cb][_0xf48d('0x15')]));if(_0x558ece[_0x2c28cb]['internal']!=_0x558ece[_0x2c28cb][_0xf48d('0x10')]){_0x4ba5fc=_0x4ba5fc[_0xf48d('0x16')](getUserApplications(_0xe1dc16,_0x558ece[_0x2c28cb],_0x558ece[_0x2c28cb]['name']));}}return _0x4ba5fc;};var getChanSpyPromise=function(_0x479d42,_0x5dc3da){return new BPromise(function(_0xf1b21,_0x3c0abf){return _0x479d42[_0xf48d('0x17')]['findAll']({'attributes':['id',_0xf48d('0x10'),_0xf48d('0x15')],'where':{'role':_0xf48d('0x18'),'chanspy':!![]},'raw':!![]})['then'](function(_0x26859d){if(_0x26859d){return _0xf1b21(getChanSpyApplications(_0x5dc3da,_0x26859d));}return _0xf1b21([]);})[_0xf48d('0x19')](function(_0x1beef7){_0x3c0abf(_0x1beef7);});});};module[_0xf48d('0x1a')]=function(_0x13c9aa,_0x37a774){var _0x451fff=_0x13c9aa[_0xf48d('0x1b')];return _0x13c9aa[_0xf48d('0x1c')](_0xf48d('0x1d'),attributes,{'tableName':_0xf48d('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1a58e6,_0x4c9215,_0x4a9046){return getChanSpyPromise(_0x451fff,_0x1a58e6)[_0xf48d('0x1f')](function(_0x2e7183){if(_0x2e7183&&_0x2e7183[_0xf48d('0x14')]){return _0x451fff[_0xf48d('0x20')]['bulkCreate'](_0x2e7183);}})[_0xf48d('0x1f')](function(){_0x4a9046();})[_0xf48d('0x19')](function(_0x39d602){_0x4a9046(_0x39d602);});},'afterUpdate':function(_0x53b8ea,_0x4f0b4c,_0x24a3dd){return _0x451fff[_0xf48d('0x20')][_0xf48d('0x21')]({'where':{'ChanSpyId':_0x53b8ea['id']}})[_0xf48d('0x1f')](function(){return getChanSpyPromise(_0x451fff,_0x53b8ea);})[_0xf48d('0x1f')](function(_0x4bfdcb){if(_0x4bfdcb&&_0x4bfdcb[_0xf48d('0x14')]){return _0x451fff[_0xf48d('0x20')]['bulkCreate'](_0x4bfdcb);}})[_0xf48d('0x1f')](function(){_0x24a3dd();})['catch'](function(_0x574b22){_0x24a3dd(_0x574b22);});},'afterDestroy':function(_0x29a827,_0x5c8e10,_0x22c50e){return _0x451fff[_0xf48d('0x20')][_0xf48d('0x21')]({'where':{'ChanSpyId':_0x29a827['id']}})[_0xf48d('0x1f')](function(){_0x22c50e();})['catch'](function(_0x533ec5){_0x22c50e(_0x533ec5);});}}});}; \ No newline at end of file +var _0xd38d=['./voiceChanSpy.attributes','context','%s%s','prefix','system','push','merge','Set','format','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','auth','password','SIP/%s,%s','name','length','concat','User','internal','agent','catch','exports','models','define','VoiceChanSpy','VoiceExtension','bulkCreate','destroy','then','bluebird'];(function(_0x3464e8,_0x4a208a){var _0x4e3dbb=function(_0x441989){while(--_0x441989){_0x3464e8['push'](_0x3464e8['shift']());}};_0x4e3dbb(++_0x4a208a);}(_0xd38d,0x107));var _0xdd38=function(_0x27beea,_0x3bc9f4){_0x27beea=_0x27beea-0x0;var _0x122645=_0xd38d[_0x27beea];return _0x122645;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0xdd38('0x0'));var attributes=require(_0xdd38('0x1'));var getUserApplications=function(_0x455d8c,_0x1f9706,_0x4d2c64){var _0x8293ee=0x1;var _0x1c7a09=[];var _0x66a7aa={'context':_0x1f9706[_0xdd38('0x2')]||'from-sip','exten':util['format'](_0xdd38('0x3'),_0x455d8c[_0xdd38('0x4')],_0x4d2c64),'type':_0xdd38('0x5'),'isApp':![],'ChanSpyId':_0x455d8c['id'],'UserId':_0x1f9706['id']};_0x1c7a09[_0xdd38('0x6')](_[_0xdd38('0x7')]({'app':_0xdd38('0x8'),'appdata':util[_0xdd38('0x9')](_0xdd38('0xa'),_0xdd38('0xb')),'priority':_0x8293ee++},_0x66a7aa));if(_0x455d8c[_0xdd38('0xc')]){_0x1c7a09[_0xdd38('0x6')](_[_0xdd38('0x7')]({'app':_0xdd38('0xd'),'appdata':util[_0xdd38('0x9')](_0xdd38('0xe'),_0x455d8c['recordingFormat']),'priority':_0x8293ee++},_0x66a7aa));}if(_0x455d8c[_0xdd38('0xf')]){_0x1c7a09[_0xdd38('0x6')](_[_0xdd38('0x7')]({'app':'Authenticate','appdata':_0x455d8c[_0xdd38('0x10')],'priority':_0x8293ee++},_0x66a7aa));}_0x1c7a09['push'](_['merge']({'app':'ChanSpy','appdata':util[_0xdd38('0x9')](_0xdd38('0x11'),_0x1f9706[_0xdd38('0x12')],_0x455d8c['options']?_0x455d8c['options']['join'](''):''),'priority':_0x8293ee++},_0x66a7aa));if(_0x455d8c[_0xdd38('0xc')]){_0x1c7a09['push'](_['merge']({'app':'StopMixMonitor','priority':_0x8293ee++},_0x66a7aa));}return _0x1c7a09;};var getChanSpyApplications=function(_0xed5af4,_0x4322af){var _0x360ce3=[];for(var _0x153a26=0x0,_0xaf8ad0=0x1;_0x153a26<_0x4322af[_0xdd38('0x13')];_0x153a26++,_0xaf8ad0=0x1){_0x360ce3=_0x360ce3['concat'](getUserApplications(_0xed5af4,_0x4322af[_0x153a26],_0x4322af[_0x153a26]['internal']));if(_0x4322af[_0x153a26]['internal']!=_0x4322af[_0x153a26]['name']){_0x360ce3=_0x360ce3[_0xdd38('0x14')](getUserApplications(_0xed5af4,_0x4322af[_0x153a26],_0x4322af[_0x153a26][_0xdd38('0x12')]));}}return _0x360ce3;};var getChanSpyPromise=function(_0x33fe38,_0x1c3c80){return new BPromise(function(_0x5836a0,_0x5aac4e){return _0x33fe38[_0xdd38('0x15')]['findAll']({'attributes':['id',_0xdd38('0x12'),_0xdd38('0x16')],'where':{'role':_0xdd38('0x17'),'chanspy':!![]},'raw':!![]})['then'](function(_0x12816c){if(_0x12816c){return _0x5836a0(getChanSpyApplications(_0x1c3c80,_0x12816c));}return _0x5836a0([]);})[_0xdd38('0x18')](function(_0x2790fe){_0x5aac4e(_0x2790fe);});});};module[_0xdd38('0x19')]=function(_0x538322,_0x1013f0){var _0x4190be=_0x538322[_0xdd38('0x1a')];return _0x538322[_0xdd38('0x1b')](_0xdd38('0x1c'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xd53eb6,_0x5692b7,_0x4c0e37){return getChanSpyPromise(_0x4190be,_0xd53eb6)['then'](function(_0xa7f19c){if(_0xa7f19c&&_0xa7f19c[_0xdd38('0x13')]){return _0x4190be[_0xdd38('0x1d')][_0xdd38('0x1e')](_0xa7f19c);}})['then'](function(){_0x4c0e37();})[_0xdd38('0x18')](function(_0x2bc77f){_0x4c0e37(_0x2bc77f);});},'afterUpdate':function(_0x147f69,_0x38ceb1,_0x17c310){return _0x4190be[_0xdd38('0x1d')][_0xdd38('0x1f')]({'where':{'ChanSpyId':_0x147f69['id']}})[_0xdd38('0x20')](function(){return getChanSpyPromise(_0x4190be,_0x147f69);})[_0xdd38('0x20')](function(_0x26b080){if(_0x26b080&&_0x26b080['length']){return _0x4190be[_0xdd38('0x1d')][_0xdd38('0x1e')](_0x26b080);}})[_0xdd38('0x20')](function(){_0x17c310();})[_0xdd38('0x18')](function(_0x2f9e80){_0x17c310(_0x2f9e80);});},'afterDestroy':function(_0x2bdc9b,_0x4161d3,_0xc2be96){return _0x4190be[_0xdd38('0x1d')][_0xdd38('0x1f')]({'where':{'ChanSpyId':_0x2bdc9b['id']}})['then'](function(){_0xc2be96();})['catch'](function(_0x1365ed){_0xc2be96(_0x1365ed);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 38bce1d..1a36583 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 _0x7980=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3538de,_0x44757b){var _0xd78dfd=function(_0x4fbbaa){while(--_0x4fbbaa){_0x3538de['push'](_0x3538de['shift']());}};_0xd78dfd(++_0x44757b);}(_0x7980,0xab));var _0x0798=function(_0x43d892,_0x3d7d2a){_0x43d892=_0x43d892-0x0;var _0x1a93d8=_0x7980[_0x43d892];return _0x1a93d8;};'use strict';var _=require(_0x0798('0x0'));var util=require(_0x0798('0x1'));var moment=require(_0x0798('0x2'));var BPromise=require(_0x0798('0x3'));var rs=require(_0x0798('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0798('0x5'))['db'];var utils=require(_0x0798('0x6'));var logger=require(_0x0798('0x7'))(_0x0798('0x8'));var config=require(_0x0798('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0798('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e534f,_0x34f808,_0x467859){return new BPromise(function(_0x54da10,_0x5151b3){return client[_0x0798('0xb')](_0x1e534f,_0x467859)[_0x0798('0xc')](function(_0x301a55){logger[_0x0798('0xd')](_0x0798('0xe'),_0x34f808,_0x0798('0xf'));logger[_0x0798('0x10')](_0x0798('0x11'),_0x34f808,_0x0798('0xf'),JSON[_0x0798('0x12')](_0x301a55));if(_0x301a55['error']){if(_0x301a55[_0x0798('0x13')][_0x0798('0x14')]===0x1f4){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x34f808,_0x301a55[_0x0798('0x13')][_0x0798('0x15')]);return _0x5151b3(_0x301a55[_0x0798('0x13')][_0x0798('0x15')]);}logger[_0x0798('0x13')](_0x0798('0xe'),_0x34f808,_0x301a55[_0x0798('0x13')]['message']);return _0x54da10(_0x301a55['error'][_0x0798('0x15')]);}else{logger[_0x0798('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x34f808,'request\x20sent');_0x54da10(_0x301a55[_0x0798('0x16')][_0x0798('0x15')]);}})[_0x0798('0x17')](function(_0x5dc617){logger['error'](_0x0798('0xe'),_0x34f808,_0x5dc617);_0x5151b3(_0x5dc617);});});} \ No newline at end of file +var _0x6f7a=['http','request','then','info','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x418ad2,_0xeae93b){var _0x4f4fe5=function(_0x424e28){while(--_0x424e28){_0x418ad2['push'](_0x418ad2['shift']());}};_0x4f4fe5(++_0xeae93b);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x3954a2,_0x1f502d){_0x3954a2=_0x3954a2-0x0;var _0x3859cd=_0x6f7a[_0x3954a2];return _0x3859cd;};'use strict';var _=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var moment=require(_0xa6f7('0x2'));var BPromise=require(_0xa6f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa6f7('0x4'));var db=require(_0xa6f7('0x5'))['db'];var utils=require(_0xa6f7('0x6'));var logger=require(_0xa6f7('0x7'))(_0xa6f7('0x8'));var config=require(_0xa6f7('0x9'));var jayson=require(_0xa6f7('0xa'));var client=jayson[_0xa6f7('0xb')][_0xa6f7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x335aaa,_0x1a06d1,_0x481a8c){return new BPromise(function(_0x4b4f9e,_0x30f2a7){return client[_0xa6f7('0xd')](_0x335aaa,_0x481a8c)[_0xa6f7('0xe')](function(_0x362404){logger[_0xa6f7('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x1a06d1,'request\x20sent');logger[_0xa6f7('0x10')](_0xa6f7('0x11'),_0x1a06d1,'request\x20sent',JSON[_0xa6f7('0x12')](_0x362404));if(_0x362404['error']){if(_0x362404[_0xa6f7('0x13')][_0xa6f7('0x14')]===0x1f4){logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x362404['error'][_0xa6f7('0x16')]);return _0x30f2a7(_0x362404['error'][_0xa6f7('0x16')]);}logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x362404['error'][_0xa6f7('0x16')]);return _0x4b4f9e(_0x362404['error'][_0xa6f7('0x16')]);}else{logger['info'](_0xa6f7('0x15'),_0x1a06d1,_0xa6f7('0x17'));_0x4b4f9e(_0x362404[_0xa6f7('0x18')]['message']);}})[_0xa6f7('0x19')](function(_0x22635e){logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x22635e);_0x30f2a7(_0x22635e);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 57167f9..ef9bd39 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 _0xbd84=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','isAuthenticated','index','/:id','post','put','destroy','exports','multer','util','path'];(function(_0x274a81,_0x4b348e){var _0x3adb6c=function(_0x425410){while(--_0x425410){_0x274a81['push'](_0x274a81['shift']());}};_0x3adb6c(++_0x4b348e);}(_0xbd84,0xda));var _0x4bd8=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xbd84[_0x243b2f];return _0xcb3c2d;};'use strict';var multer=require(_0x4bd8('0x0'));var util=require(_0x4bd8('0x1'));var path=require(_0x4bd8('0x2'));var timeout=require('connect-timeout');var express=require(_0x4bd8('0x3'));var router=express[_0x4bd8('0x4')]();var fs_extra=require(_0x4bd8('0x5'));var auth=require(_0x4bd8('0x6'));var interaction=require(_0x4bd8('0x7'));var config=require('../../config/environment');var controller=require(_0x4bd8('0x8'));router[_0x4bd8('0x9')]('/',auth[_0x4bd8('0xa')](),controller[_0x4bd8('0xb')]);router[_0x4bd8('0x9')](_0x4bd8('0xc'),auth[_0x4bd8('0xa')](),controller['show']);router[_0x4bd8('0xd')]('/',auth[_0x4bd8('0xa')](),controller['create']);router[_0x4bd8('0xe')]('/:id',auth[_0x4bd8('0xa')](),controller['update']);router['delete'](_0x4bd8('0xc'),auth[_0x4bd8('0xa')](),controller[_0x4bd8('0xf')]);module[_0x4bd8('0x10')]=router; \ No newline at end of file +var _0x913c=['put','/:id','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','isAuthenticated','post','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x913c,0xe4));var _0xc913=function(_0x294268,_0x2c660c){_0x294268=_0x294268-0x0;var _0xabc737=_0x913c[_0x294268];return _0xabc737;};'use strict';var multer=require(_0xc913('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc913('0x1'));var express=require(_0xc913('0x2'));var router=express[_0xc913('0x3')]();var fs_extra=require(_0xc913('0x4'));var auth=require(_0xc913('0x5'));var interaction=require(_0xc913('0x6'));var config=require('../../config/environment');var controller=require(_0xc913('0x7'));router[_0xc913('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc913('0x8')]('/:id',auth[_0xc913('0x9')](),controller['show']);router[_0xc913('0xa')]('/',auth[_0xc913('0x9')](),controller[_0xc913('0xb')]);router[_0xc913('0xc')](_0xc913('0xd'),auth[_0xc913('0x9')](),controller['update']);router['delete'](_0xc913('0xd'),auth[_0xc913('0x9')](),controller['destroy']);module[_0xc913('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index cc16043..1256135 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 _0x3dea=['name','BOOLEAN','sequelize','STRING'];(function(_0x133fe4,_0x1f473b){var _0x4c4017=function(_0x3c1fb1){while(--_0x3c1fb1){_0x133fe4['push'](_0x133fe4['shift']());}};_0x4c4017(++_0x1f473b);}(_0x3dea,0x112));var _0xa3de=function(_0x4e1ef1,_0x581039){_0x4e1ef1=_0x4e1ef1-0x0;var _0x29c952=_0x3dea[_0x4e1ef1];return _0x29c952;};'use strict';var Sequelize=require(_0xa3de('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3de('0x1')],'unique':_0xa3de('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xa3de('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf972=['sequelize','STRING','name'];(function(_0x44baa8,_0x33ce82){var _0x13b5f2=function(_0x4ffb49){while(--_0x4ffb49){_0x44baa8['push'](_0x44baa8['shift']());}};_0x13b5f2(++_0x33ce82);}(_0xf972,0x171));var _0x2f97=function(_0x4f68d9,_0x245139){_0x4f68d9=_0x4f68d9-0x0;var _0x12835e=_0xf972[_0x4f68d9];return _0x12835e;};'use strict';var Sequelize=require(_0x2f97('0x0'));module['exports']={'name':{'type':Sequelize[_0x2f97('0x1')],'unique':_0x2f97('0x2')},'description':{'type':Sequelize[_0x2f97('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index cc54b68..7edd34e 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 _0x89f3=['model','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','create','readFileSync','join','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','update','root','server/files/templates/context.ejs','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','Contexts','UserProfileResource','sendStatus','stack','name','send','map','VoiceContext','fieldName','type','key','query','keys','filters'];(function(_0x328375,_0x3cdfe9){var _0x3f5f90=function(_0x5a5ddb){while(--_0x5a5ddb){_0x328375['push'](_0x328375['shift']());}};_0x3f5f90(++_0x3cdfe9);}(_0x89f3,0x8f));var _0x389f=function(_0x2019f2,_0x226a01){_0x2019f2=_0x2019f2-0x0;var _0x24b386=_0x89f3[_0x2019f2];return _0x24b386;};'use strict';var emlformat=require(_0x389f('0x0'));var rimraf=require(_0x389f('0x1'));var zipdir=require(_0x389f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x389f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x389f('0x4'));var util=require(_0x389f('0x5'));var path=require(_0x389f('0x6'));var sox=require(_0x389f('0x7'));var csv=require('to-csv');var ejs=require(_0x389f('0x8'));var fs=require('fs');var fs_extra=require(_0x389f('0x9'));var _=require(_0x389f('0xa'));var squel=require(_0x389f('0xb'));var crypto=require('crypto');var jsforce=require(_0x389f('0xc'));var deskjs=require(_0x389f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x389f('0xe'));var Papa=require('papaparse');var Redis=require(_0x389f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x389f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x389f('0x11'));var logger=require(_0x389f('0x12'))(_0x389f('0x13'));var utils=require(_0x389f('0x14'));var config=require(_0x389f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x389f('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x389f('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf4bb08,_0x70b586,_0x54528c,_0x14b79d){return new BPromise(function(_0x37b728,_0x471f30){var _0x54ed89=_0x14b79d||client;return _0x54ed89[_0x389f('0x18')](_0xf4bb08,_0x54528c)[_0x389f('0x19')](function(_0x3619b8){logger[_0x389f('0x1a')](_0x389f('0x1b'),_0x70b586,_0x389f('0x1c'));logger[_0x389f('0x1d')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x70b586,_0x389f('0x1c'),JSON['stringify'](_0x3619b8));if(_0x3619b8[_0x389f('0x1e')]){if(_0x3619b8['error'][_0x389f('0x1f')]===0x1f4){logger[_0x389f('0x1e')](_0x389f('0x1b'),_0x70b586,_0x3619b8['error'][_0x389f('0x20')]);return _0x471f30(_0x3619b8[_0x389f('0x1e')]['message']);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x70b586,_0x3619b8[_0x389f('0x1e')][_0x389f('0x20')]);return _0x37b728(_0x3619b8['error']['message']);}else{logger[_0x389f('0x1a')](_0x389f('0x1b'),_0x70b586,_0x389f('0x1c'));_0x37b728(_0x3619b8[_0x389f('0x21')][_0x389f('0x20')]);}})[_0x389f('0x22')](function(_0x22a89e){logger[_0x389f('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x70b586,_0x22a89e);_0x471f30(_0x22a89e);});});}function respondWithStatusCode(_0x4dbf5c,_0x2918d4){_0x2918d4=_0x2918d4||0xcc;return function(_0x447c72){if(_0x447c72){return _0x4dbf5c['sendStatus'](_0x2918d4);}return _0x4dbf5c[_0x389f('0x23')](_0x2918d4)[_0x389f('0x24')]();};}function respondWithResult(_0x4b59d9,_0x2a5616){_0x2a5616=_0x2a5616||0xc8;return function(_0x50cb0b){if(_0x50cb0b){return _0x4b59d9[_0x389f('0x23')](_0x2a5616)[_0x389f('0x25')](_0x50cb0b);}};}function respondWithFilteredResult(_0x405b09,_0xef07af){return function(_0x1a081a){if(_0x1a081a){var _0x2acb28=typeof _0xef07af[_0x389f('0x26')]===_0x389f('0x27')&&typeof _0xef07af[_0x389f('0x28')]===_0x389f('0x27');var _0x276d83=_0x1a081a[_0x389f('0x29')];var _0x789965=_0x2acb28?0x0:_0xef07af[_0x389f('0x26')];var _0x2db4f3=_0x2acb28?_0x1a081a['count']:_0xef07af[_0x389f('0x26')]+_0xef07af[_0x389f('0x28')];var _0x4711af;if(_0x2db4f3>=_0x276d83){_0x2db4f3=_0x276d83;_0x4711af=0xc8;}else{_0x4711af=0xce;}_0x405b09[_0x389f('0x23')](_0x4711af);return _0x405b09[_0x389f('0x2a')](_0x389f('0x2b'),_0x789965+'-'+_0x2db4f3+'/'+_0x276d83)[_0x389f('0x25')](_0x1a081a);}return null;};}function patchUpdates(_0xdb684f){return function(_0x5612c9){try{jsonpatch[_0x389f('0x2c')](_0x5612c9,_0xdb684f,!![]);}catch(_0x4a1c36){return BPromise[_0x389f('0x2d')](_0x4a1c36);}return _0x5612c9['save']();};}function saveUpdates(_0x48fbf0,_0x3ea5f0){return function(_0x175ecc){if(_0x175ecc){return _0x175ecc['update'](_0x48fbf0)['then'](function(_0x1d7b8b){return _0x1d7b8b;});}return null;};}function removeEntity(_0x57fcdd,_0x15fe81){return function(_0x2ef8e9){if(_0x2ef8e9){return _0x2ef8e9[_0x389f('0x2e')]()['then'](function(){var _0xfa4fc1=_0x2ef8e9['get']({'plain':!![]});var _0x4df672=_0x389f('0x2f');return db[_0x389f('0x30')]['destroy']({'where':{'type':_0x4df672,'resourceId':_0xfa4fc1['id']}})[_0x389f('0x19')](function(){return _0x2ef8e9;});})['then'](function(){_0x57fcdd['status'](0xcc)[_0x389f('0x24')]();});}};}function handleEntityNotFound(_0x320a59,_0x3840df){return function(_0x36dbe0){if(!_0x36dbe0){_0x320a59[_0x389f('0x31')](0x194);}return _0x36dbe0;};}function handleError(_0x339e0d,_0x32f413){_0x32f413=_0x32f413||0x1f4;return function(_0x4a6822){logger[_0x389f('0x1e')](_0x4a6822[_0x389f('0x32')]);if(_0x4a6822[_0x389f('0x33')]){delete _0x4a6822['name'];}_0x339e0d[_0x389f('0x23')](_0x32f413)[_0x389f('0x34')](_0x4a6822);};}exports['index']=function(_0x528315,_0x4cf70d){var _0x584413={},_0x36cb8c={},_0x25dfe6={'count':0x0,'rows':[]};var _0x471cfd=_[_0x389f('0x35')](db[_0x389f('0x36')]['rawAttributes'],function(_0x8e34f){return{'name':_0x8e34f[_0x389f('0x37')],'type':_0x8e34f[_0x389f('0x38')][_0x389f('0x39')]};});_0x36cb8c['model']=_[_0x389f('0x35')](_0x471cfd,_0x389f('0x33'));_0x36cb8c[_0x389f('0x3a')]=_[_0x389f('0x3b')](_0x528315[_0x389f('0x3a')]);_0x36cb8c[_0x389f('0x3c')]=_['intersection'](_0x36cb8c[_0x389f('0x3d')],_0x36cb8c[_0x389f('0x3a')]);_0x584413[_0x389f('0x3e')]=_[_0x389f('0x3f')](_0x36cb8c[_0x389f('0x3d')],qs[_0x389f('0x40')](_0x528315[_0x389f('0x3a')][_0x389f('0x40')]));_0x584413[_0x389f('0x3e')]=_0x584413['attributes']['length']?_0x584413['attributes']:_0x36cb8c[_0x389f('0x3d')];if(!_0x528315[_0x389f('0x3a')]['hasOwnProperty'](_0x389f('0x41'))){_0x584413['limit']=qs[_0x389f('0x28')](_0x528315['query'][_0x389f('0x28')]);_0x584413[_0x389f('0x26')]=qs[_0x389f('0x26')](_0x528315[_0x389f('0x3a')][_0x389f('0x26')]);}_0x584413[_0x389f('0x42')]=qs[_0x389f('0x43')](_0x528315['query'][_0x389f('0x43')]);_0x584413[_0x389f('0x44')]=qs[_0x389f('0x3c')](_[_0x389f('0x45')](_0x528315['query'],_0x36cb8c[_0x389f('0x3c')]),_0x471cfd);if(_0x528315[_0x389f('0x3a')][_0x389f('0x46')]){_0x584413[_0x389f('0x44')]=_[_0x389f('0x47')](_0x584413[_0x389f('0x44')],{'$or':_['map'](_0x471cfd,function(_0x56286e){if(_0x56286e['type']!==_0x389f('0x48')){var _0x438d2f={};_0x438d2f[_0x56286e[_0x389f('0x33')]]={'$like':'%'+_0x528315[_0x389f('0x3a')]['filter']+'%'};return _0x438d2f;}})});}_0x584413=_[_0x389f('0x47')]({},_0x584413,_0x528315[_0x389f('0x49')]);var _0x363e78={'where':_0x584413['where']};return db[_0x389f('0x36')]['count'](_0x363e78)[_0x389f('0x19')](function(_0xa2bce4){_0x25dfe6[_0x389f('0x29')]=_0xa2bce4;if(_0x528315['query'][_0x389f('0x4a')]){_0x584413[_0x389f('0x4b')]=[{'all':!![]}];}return db['VoiceContext'][_0x389f('0x4c')](_0x584413);})[_0x389f('0x19')](function(_0x467aa6){_0x25dfe6[_0x389f('0x4d')]=_0x467aa6;return _0x25dfe6;})[_0x389f('0x19')](respondWithFilteredResult(_0x4cf70d,_0x584413))[_0x389f('0x22')](handleError(_0x4cf70d,null));};exports[_0x389f('0x4e')]=function(_0x36065d,_0x49ce4f){var _0x13c172={'raw':![],'where':{'id':_0x36065d[_0x389f('0x4f')]['id']}},_0x36bab8={};_0x36bab8[_0x389f('0x3d')]=_[_0x389f('0x3b')](db[_0x389f('0x36')][_0x389f('0x50')]);_0x36bab8[_0x389f('0x3a')]=_[_0x389f('0x3b')](_0x36065d[_0x389f('0x3a')]);_0x36bab8[_0x389f('0x3c')]=_[_0x389f('0x3f')](_0x36bab8[_0x389f('0x3d')],_0x36bab8[_0x389f('0x3a')]);_0x13c172[_0x389f('0x3e')]=_[_0x389f('0x3f')](_0x36bab8[_0x389f('0x3d')],qs[_0x389f('0x40')](_0x36065d[_0x389f('0x3a')][_0x389f('0x40')]));_0x13c172[_0x389f('0x3e')]=_0x13c172['attributes'][_0x389f('0x51')]?_0x13c172['attributes']:_0x36bab8[_0x389f('0x3d')];if(_0x36065d[_0x389f('0x3a')][_0x389f('0x4a')]){_0x13c172[_0x389f('0x4b')]=[{'all':!![]}];}_0x13c172=_[_0x389f('0x47')]({},_0x13c172,_0x36065d[_0x389f('0x49')]);return db[_0x389f('0x36')][_0x389f('0x52')](_0x13c172)[_0x389f('0x19')](handleEntityNotFound(_0x49ce4f,null))['then'](respondWithResult(_0x49ce4f,null))['catch'](handleError(_0x49ce4f,null));};exports[_0x389f('0x53')]=function(_0x123786,_0x5ac341,_0x39c017){var _0x509719;return db['VoiceContext'][_0x389f('0x53')](_0x123786['body'],{'raw':!![]})[_0x389f('0x19')](function(_0x26f588){_0x509719=_0x26f588;return db['VoiceContext']['findAll']({'raw':!![]});})[_0x389f('0x19')](function(_0x1bf604){var _0x2da77e=fs[_0x389f('0x54')](path[_0x389f('0x55')](config['root'],'server/files/templates/context.ejs'),_0x389f('0x56'));var _0x545296=ejs[_0x389f('0x57')](_0x2da77e,{'contexts':_0x1bf604||[]});fs[_0x389f('0x58')](_0x389f('0x59'),_0x545296);})[_0x389f('0x19')](function(){return respondWithRpcPromise(_0x389f('0x5a'),_0x389f('0x53'),{'module':_0x389f('0x5b')});})['then'](function(){var _0x59de2c=_0x123786[_0x389f('0x5c')]['get']({'plain':!![]});if(!_0x59de2c)throw new Error(_0x389f('0x5d'));if(_0x59de2c[_0x389f('0x5e')]===_0x389f('0x5c')){var _0x1eb9e=_0x509719[_0x389f('0x5f')]({'plain':!![]});return db[_0x389f('0x60')][_0x389f('0x52')]({'where':{'name':_0x389f('0x2f'),'userProfileId':_0x59de2c[_0x389f('0x61')]},'raw':!![]})[_0x389f('0x19')](function(_0xaeba55){if(_0xaeba55&&_0xaeba55[_0x389f('0x62')]===0x0){return db[_0x389f('0x30')][_0x389f('0x53')]({'name':_0x1eb9e['name'],'resourceId':_0x1eb9e['id'],'type':_0xaeba55[_0x389f('0x33')],'sectionId':_0xaeba55['id']},{})[_0x389f('0x19')](function(){return _0x509719;});}else{return _0x509719;}})['catch'](function(_0x5a5dfb){logger[_0x389f('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a5dfb);throw _0x5a5dfb;});}return _0x509719;})[_0x389f('0x19')](respondWithResult(_0x5ac341,0xc9))[_0x389f('0x22')](handleError(_0x5ac341,null));};exports[_0x389f('0x63')]=function(_0x57ef62,_0x104ee2,_0x4aadfb){var _0x26296a;return db[_0x389f('0x36')][_0x389f('0x52')]({'where':{'id':_0x57ef62[_0x389f('0x4f')]['id']}})[_0x389f('0x19')](handleEntityNotFound(_0x104ee2,null))['then'](saveUpdates(_0x57ef62['body'],null))['then'](function(_0x3fa088){if(_0x3fa088){_0x26296a=_0x3fa088;return db[_0x389f('0x36')][_0x389f('0x4c')]({'raw':!![]});}})['then'](function(_0x27e5e3){var _0x46caa1=fs['readFileSync'](path['join'](config[_0x389f('0x64')],'server/files/templates/context.ejs'),_0x389f('0x56'));var _0x2f1167=ejs[_0x389f('0x57')](_0x46caa1,{'contexts':_0x27e5e3||[]});fs[_0x389f('0x58')](_0x389f('0x59'),_0x2f1167);})[_0x389f('0x19')](function(){return respondWithRpcPromise(_0x389f('0x5a'),_0x389f('0x63'),{'module':_0x389f('0x5b')});})[_0x389f('0x19')](function(){return _0x26296a;})[_0x389f('0x19')](respondWithResult(_0x104ee2,null))['catch'](handleError(_0x104ee2,null));};exports[_0x389f('0x2e')]=function(_0x491467,_0x565298,_0x1acb08){var _0x3178a9;return db['VoiceContext'][_0x389f('0x52')]({'where':{'id':_0x491467[_0x389f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x565298,null))[_0x389f('0x19')](removeEntity(_0x565298,null))[_0x389f('0x19')](function(){return db['VoiceContext'][_0x389f('0x4c')]({'raw':!![]});})['then'](function(_0x305275){var _0x5c4050=fs[_0x389f('0x54')](path[_0x389f('0x55')](config[_0x389f('0x64')],_0x389f('0x65')),_0x389f('0x56'));var _0x20aaed=ejs['render'](_0x5c4050,{'contexts':_0x305275});fs[_0x389f('0x58')](_0x389f('0x59'),_0x20aaed);return respondWithRpcPromise(_0x389f('0x5a'),_0x389f('0x2e'),{'module':_0x389f('0x5b')});})[_0x389f('0x22')](handleError(_0x565298,null));}; \ No newline at end of file +var _0xa2fc=['server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','info','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','Contexts','sendStatus','stack','name','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','show','includeAll','create','body','readFileSync','join','root'];(function(_0x4cf776,_0xa3f0fc){var _0x2cdf00=function(_0x31e747){while(--_0x31e747){_0x4cf776['push'](_0x4cf776['shift']());}};_0x2cdf00(++_0xa3f0fc);}(_0xa2fc,0xec));var _0xca2f=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xa2fc[_0x500419];return _0x241c1a;};'use strict';var emlformat=require(_0xca2f('0x0'));var rimraf=require(_0xca2f('0x1'));var zipdir=require(_0xca2f('0x2'));var jsonpatch=require(_0xca2f('0x3'));var rp=require(_0xca2f('0x4'));var moment=require(_0xca2f('0x5'));var BPromise=require(_0xca2f('0x6'));var Mustache=require(_0xca2f('0x7'));var util=require(_0xca2f('0x8'));var path=require(_0xca2f('0x9'));var sox=require(_0xca2f('0xa'));var csv=require(_0xca2f('0xb'));var ejs=require(_0xca2f('0xc'));var fs=require('fs');var fs_extra=require(_0xca2f('0xd'));var _=require(_0xca2f('0xe'));var squel=require('squel');var crypto=require(_0xca2f('0xf'));var jsforce=require(_0xca2f('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xca2f('0xb'));var querystring=require(_0xca2f('0x11'));var Papa=require(_0xca2f('0x12'));var Redis=require(_0xca2f('0x13'));var authService=require(_0xca2f('0x14'));var qs=require(_0xca2f('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xca2f('0x16'));var logger=require(_0xca2f('0x17'))(_0xca2f('0x18'));var utils=require(_0xca2f('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xca2f('0x1a'))['db'];var jayson=require(_0xca2f('0x1b'));var client=jayson[_0xca2f('0x1c')][_0xca2f('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x57dae2,_0x1a2f10,_0x4568f4,_0x3fc4d7){return new BPromise(function(_0x50c9a5,_0x10b708){var _0x194009=_0x3fc4d7||client;return _0x194009[_0xca2f('0x1e')](_0x57dae2,_0x4568f4)[_0xca2f('0x1f')](function(_0x114711){logger[_0xca2f('0x20')]('VoiceContext,\x20%s,\x20%s',_0x1a2f10,'request\x20sent');logger[_0xca2f('0x21')](_0xca2f('0x22'),_0x1a2f10,_0xca2f('0x23'),JSON[_0xca2f('0x24')](_0x114711));if(_0x114711[_0xca2f('0x25')]){if(_0x114711[_0xca2f('0x25')][_0xca2f('0x26')]===0x1f4){logger[_0xca2f('0x25')](_0xca2f('0x27'),_0x1a2f10,_0x114711[_0xca2f('0x25')][_0xca2f('0x28')]);return _0x10b708(_0x114711['error']['message']);}logger[_0xca2f('0x25')](_0xca2f('0x27'),_0x1a2f10,_0x114711[_0xca2f('0x25')]['message']);return _0x50c9a5(_0x114711['error'][_0xca2f('0x28')]);}else{logger['info'](_0xca2f('0x27'),_0x1a2f10,'request\x20sent');_0x50c9a5(_0x114711[_0xca2f('0x29')][_0xca2f('0x28')]);}})[_0xca2f('0x2a')](function(_0x39cc6c){logger['error'](_0xca2f('0x27'),_0x1a2f10,_0x39cc6c);_0x10b708(_0x39cc6c);});});}function respondWithStatusCode(_0x4bf37a,_0x512bff){_0x512bff=_0x512bff||0xcc;return function(_0x4cb7b3){if(_0x4cb7b3){return _0x4bf37a['sendStatus'](_0x512bff);}return _0x4bf37a[_0xca2f('0x2b')](_0x512bff)[_0xca2f('0x2c')]();};}function respondWithResult(_0x4fe661,_0x25ca5b){_0x25ca5b=_0x25ca5b||0xc8;return function(_0xd94967){if(_0xd94967){return _0x4fe661[_0xca2f('0x2b')](_0x25ca5b)[_0xca2f('0x2d')](_0xd94967);}};}function respondWithFilteredResult(_0x5e96b2,_0x568305){return function(_0x532209){if(_0x532209){var _0x56617e=typeof _0x568305[_0xca2f('0x2e')]===_0xca2f('0x2f')&&typeof _0x568305[_0xca2f('0x30')]===_0xca2f('0x2f');var _0x9b4def=_0x532209[_0xca2f('0x31')];var _0x5be913=_0x56617e?0x0:_0x568305[_0xca2f('0x2e')];var _0x523c5a=_0x56617e?_0x532209['count']:_0x568305[_0xca2f('0x2e')]+_0x568305[_0xca2f('0x30')];var _0x218bfd;if(_0x523c5a>=_0x9b4def){_0x523c5a=_0x9b4def;_0x218bfd=0xc8;}else{_0x218bfd=0xce;}_0x5e96b2[_0xca2f('0x2b')](_0x218bfd);return _0x5e96b2[_0xca2f('0x32')](_0xca2f('0x33'),_0x5be913+'-'+_0x523c5a+'/'+_0x9b4def)[_0xca2f('0x2d')](_0x532209);}return null;};}function patchUpdates(_0x912563){return function(_0x20a4f4){try{jsonpatch[_0xca2f('0x34')](_0x20a4f4,_0x912563,!![]);}catch(_0x153b9a){return BPromise[_0xca2f('0x35')](_0x153b9a);}return _0x20a4f4[_0xca2f('0x36')]();};}function saveUpdates(_0x350693,_0x4fa491){return function(_0x306122){if(_0x306122){return _0x306122[_0xca2f('0x37')](_0x350693)[_0xca2f('0x1f')](function(_0x2cd2b7){return _0x2cd2b7;});}return null;};}function removeEntity(_0x243054,_0xf47761){return function(_0xe05d8c){if(_0xe05d8c){return _0xe05d8c[_0xca2f('0x38')]()[_0xca2f('0x1f')](function(){var _0x2bfa27=_0xe05d8c['get']({'plain':!![]});var _0x5222a8=_0xca2f('0x39');return db['UserProfileResource'][_0xca2f('0x38')]({'where':{'type':_0x5222a8,'resourceId':_0x2bfa27['id']}})[_0xca2f('0x1f')](function(){return _0xe05d8c;});})[_0xca2f('0x1f')](function(){_0x243054['status'](0xcc)[_0xca2f('0x2c')]();});}};}function handleEntityNotFound(_0x257a7d,_0x109e82){return function(_0x1b9c46){if(!_0x1b9c46){_0x257a7d[_0xca2f('0x3a')](0x194);}return _0x1b9c46;};}function handleError(_0x303370,_0xa88239){_0xa88239=_0xa88239||0x1f4;return function(_0x4bddfd){logger[_0xca2f('0x25')](_0x4bddfd[_0xca2f('0x3b')]);if(_0x4bddfd['name']){delete _0x4bddfd[_0xca2f('0x3c')];}_0x303370[_0xca2f('0x2b')](_0xa88239)['send'](_0x4bddfd);};}exports['index']=function(_0x27fd99,_0x5589ba){var _0x47161a={},_0x5b78df={},_0x178810={'count':0x0,'rows':[]};var _0x1a8729=_[_0xca2f('0x3d')](db[_0xca2f('0x3e')][_0xca2f('0x3f')],function(_0x156830){return{'name':_0x156830[_0xca2f('0x40')],'type':_0x156830[_0xca2f('0x41')][_0xca2f('0x42')]};});_0x5b78df[_0xca2f('0x43')]=_[_0xca2f('0x3d')](_0x1a8729,_0xca2f('0x3c'));_0x5b78df[_0xca2f('0x44')]=_[_0xca2f('0x45')](_0x27fd99[_0xca2f('0x44')]);_0x5b78df['filters']=_[_0xca2f('0x46')](_0x5b78df[_0xca2f('0x43')],_0x5b78df[_0xca2f('0x44')]);_0x47161a[_0xca2f('0x47')]=_[_0xca2f('0x46')](_0x5b78df[_0xca2f('0x43')],qs['fields'](_0x27fd99[_0xca2f('0x44')][_0xca2f('0x48')]));_0x47161a[_0xca2f('0x47')]=_0x47161a[_0xca2f('0x47')][_0xca2f('0x49')]?_0x47161a[_0xca2f('0x47')]:_0x5b78df[_0xca2f('0x43')];if(!_0x27fd99['query'][_0xca2f('0x4a')](_0xca2f('0x4b'))){_0x47161a[_0xca2f('0x30')]=qs[_0xca2f('0x30')](_0x27fd99[_0xca2f('0x44')][_0xca2f('0x30')]);_0x47161a[_0xca2f('0x2e')]=qs[_0xca2f('0x2e')](_0x27fd99[_0xca2f('0x44')][_0xca2f('0x2e')]);}_0x47161a[_0xca2f('0x4c')]=qs[_0xca2f('0x4d')](_0x27fd99['query'][_0xca2f('0x4d')]);_0x47161a[_0xca2f('0x4e')]=qs[_0xca2f('0x4f')](_[_0xca2f('0x50')](_0x27fd99['query'],_0x5b78df['filters']),_0x1a8729);if(_0x27fd99[_0xca2f('0x44')]['filter']){_0x47161a[_0xca2f('0x4e')]=_['merge'](_0x47161a['where'],{'$or':_[_0xca2f('0x3d')](_0x1a8729,function(_0x1837aa){if(_0x1837aa[_0xca2f('0x41')]!=='VIRTUAL'){var _0x2aeaa4={};_0x2aeaa4[_0x1837aa['name']]={'$like':'%'+_0x27fd99[_0xca2f('0x44')][_0xca2f('0x51')]+'%'};return _0x2aeaa4;}})});}_0x47161a=_[_0xca2f('0x52')]({},_0x47161a,_0x27fd99[_0xca2f('0x53')]);var _0x4ba5c4={'where':_0x47161a[_0xca2f('0x4e')]};return db['VoiceContext'][_0xca2f('0x31')](_0x4ba5c4)[_0xca2f('0x1f')](function(_0x12f286){_0x178810['count']=_0x12f286;if(_0x27fd99[_0xca2f('0x44')]['includeAll']){_0x47161a[_0xca2f('0x54')]=[{'all':!![]}];}return db[_0xca2f('0x3e')][_0xca2f('0x55')](_0x47161a);})['then'](function(_0x4d480e){_0x178810[_0xca2f('0x56')]=_0x4d480e;return _0x178810;})[_0xca2f('0x1f')](respondWithFilteredResult(_0x5589ba,_0x47161a))['catch'](handleError(_0x5589ba,null));};exports[_0xca2f('0x57')]=function(_0xcf75b1,_0x14f524){var _0x5f3d60={'raw':![],'where':{'id':_0xcf75b1['params']['id']}},_0x3e30c3={};_0x3e30c3[_0xca2f('0x43')]=_[_0xca2f('0x45')](db[_0xca2f('0x3e')]['rawAttributes']);_0x3e30c3[_0xca2f('0x44')]=_['keys'](_0xcf75b1[_0xca2f('0x44')]);_0x3e30c3[_0xca2f('0x4f')]=_[_0xca2f('0x46')](_0x3e30c3['model'],_0x3e30c3[_0xca2f('0x44')]);_0x5f3d60[_0xca2f('0x47')]=_[_0xca2f('0x46')](_0x3e30c3[_0xca2f('0x43')],qs[_0xca2f('0x48')](_0xcf75b1[_0xca2f('0x44')][_0xca2f('0x48')]));_0x5f3d60['attributes']=_0x5f3d60[_0xca2f('0x47')]['length']?_0x5f3d60[_0xca2f('0x47')]:_0x3e30c3[_0xca2f('0x43')];if(_0xcf75b1[_0xca2f('0x44')][_0xca2f('0x58')]){_0x5f3d60[_0xca2f('0x54')]=[{'all':!![]}];}_0x5f3d60=_[_0xca2f('0x52')]({},_0x5f3d60,_0xcf75b1[_0xca2f('0x53')]);return db['VoiceContext']['find'](_0x5f3d60)[_0xca2f('0x1f')](handleEntityNotFound(_0x14f524,null))[_0xca2f('0x1f')](respondWithResult(_0x14f524,null))[_0xca2f('0x2a')](handleError(_0x14f524,null));};exports[_0xca2f('0x59')]=function(_0x3f8a2c,_0x2550de,_0x1da279){var _0x3d3485;return db[_0xca2f('0x3e')][_0xca2f('0x59')](_0x3f8a2c[_0xca2f('0x5a')],{'raw':!![]})[_0xca2f('0x1f')](function(_0x181dac){_0x3d3485=_0x181dac;return db['VoiceContext'][_0xca2f('0x55')]({'raw':!![]});})['then'](function(_0x34c255){var _0x18826f=fs[_0xca2f('0x5b')](path[_0xca2f('0x5c')](config[_0xca2f('0x5d')],_0xca2f('0x5e')),_0xca2f('0x5f'));var _0xa2919=ejs[_0xca2f('0x60')](_0x18826f,{'contexts':_0x34c255||[]});fs[_0xca2f('0x61')](_0xca2f('0x62'),_0xa2919);})[_0xca2f('0x1f')](function(){return respondWithRpcPromise(_0xca2f('0x63'),_0xca2f('0x59'),{'module':_0xca2f('0x64')});})[_0xca2f('0x1f')](function(){var _0x4483b9=_0x3f8a2c[_0xca2f('0x65')][_0xca2f('0x66')]({'plain':!![]});if(!_0x4483b9)throw new Error(_0xca2f('0x67'));if(_0x4483b9[_0xca2f('0x68')]==='user'){var _0x5f2c06=_0x3d3485['get']({'plain':!![]});return db[_0xca2f('0x69')]['find']({'where':{'name':_0xca2f('0x39'),'userProfileId':_0x4483b9['userProfileId']},'raw':!![]})['then'](function(_0x14f5a7){if(_0x14f5a7&&_0x14f5a7[_0xca2f('0x6a')]===0x0){return db[_0xca2f('0x6b')][_0xca2f('0x59')]({'name':_0x5f2c06[_0xca2f('0x3c')],'resourceId':_0x5f2c06['id'],'type':_0x14f5a7[_0xca2f('0x3c')],'sectionId':_0x14f5a7['id']},{})[_0xca2f('0x1f')](function(){return _0x3d3485;});}else{return _0x3d3485;}})['catch'](function(_0x4406e6){logger[_0xca2f('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4406e6);throw _0x4406e6;});}return _0x3d3485;})[_0xca2f('0x1f')](respondWithResult(_0x2550de,0xc9))['catch'](handleError(_0x2550de,null));};exports[_0xca2f('0x37')]=function(_0xa22833,_0x19cfa7,_0x3dfbb9){var _0x765e4b;return db[_0xca2f('0x3e')][_0xca2f('0x6c')]({'where':{'id':_0xa22833[_0xca2f('0x6d')]['id']}})['then'](handleEntityNotFound(_0x19cfa7,null))['then'](saveUpdates(_0xa22833[_0xca2f('0x5a')],null))[_0xca2f('0x1f')](function(_0x528a2f){if(_0x528a2f){_0x765e4b=_0x528a2f;return db['VoiceContext'][_0xca2f('0x55')]({'raw':!![]});}})[_0xca2f('0x1f')](function(_0x17b380){var _0x294a3f=fs[_0xca2f('0x5b')](path[_0xca2f('0x5c')](config[_0xca2f('0x5d')],_0xca2f('0x5e')),_0xca2f('0x5f'));var _0x4e5679=ejs['render'](_0x294a3f,{'contexts':_0x17b380||[]});fs[_0xca2f('0x61')](_0xca2f('0x62'),_0x4e5679);})['then'](function(){return respondWithRpcPromise('Reload',_0xca2f('0x37'),{'module':_0xca2f('0x64')});})[_0xca2f('0x1f')](function(){return _0x765e4b;})['then'](respondWithResult(_0x19cfa7,null))[_0xca2f('0x2a')](handleError(_0x19cfa7,null));};exports[_0xca2f('0x38')]=function(_0x12a7f8,_0x5c9978,_0x28ac9e){var _0x5924ab;return db[_0xca2f('0x3e')][_0xca2f('0x6c')]({'where':{'id':_0x12a7f8[_0xca2f('0x6d')]['id']}})[_0xca2f('0x1f')](handleEntityNotFound(_0x5c9978,null))[_0xca2f('0x1f')](removeEntity(_0x5c9978,null))['then'](function(){return db[_0xca2f('0x3e')][_0xca2f('0x55')]({'raw':!![]});})[_0xca2f('0x1f')](function(_0x4e029a){var _0x1801ad=fs[_0xca2f('0x5b')](path[_0xca2f('0x5c')](config['root'],_0xca2f('0x5e')),'utf8');var _0x40f5fa=ejs[_0xca2f('0x60')](_0x1801ad,{'contexts':_0x4e029a});fs[_0xca2f('0x61')](_0xca2f('0x62'),_0x40f5fa);return respondWithRpcPromise('Reload',_0xca2f('0x38'),{'module':_0xca2f('0x64')});})[_0xca2f('0x2a')](handleError(_0x5c9978,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 3de8e8c..dc29247 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 _0xfb2f=['path','../../config/environment','exports','VoiceContext','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xfb2f,0x112));var _0xffb2=function(_0x1f83a7,_0x202444){_0x1f83a7=_0x1f83a7-0x0;var _0x5a1e5e=_0xfb2f[_0x1f83a7];return _0x5a1e5e;};'use strict';var _=require(_0xffb2('0x0'));var util=require('util');var logger=require(_0xffb2('0x1'))('api');var moment=require(_0xffb2('0x2'));var BPromise=require(_0xffb2('0x3'));var rp=require(_0xffb2('0x4'));var fs=require('fs');var path=require(_0xffb2('0x5'));var rimraf=require('rimraf');var config=require(_0xffb2('0x6'));var attributes=require('./voiceContext.attributes');module[_0xffb2('0x7')]=function(_0x5e8670,_0x3c5eff){return _0x5e8670['define'](_0xffb2('0x8'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1079=['bluebird','request-promise','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','lodash','util','../../config/logger','api','moment'];(function(_0x54813d,_0x101c1f){var _0x561eea=function(_0x1faa0a){while(--_0x1faa0a){_0x54813d['push'](_0x54813d['shift']());}};_0x561eea(++_0x101c1f);}(_0x1079,0x126));var _0x9107=function(_0x5b5b5f,_0x1d88f8){_0x5b5b5f=_0x5b5b5f-0x0;var _0x380741=_0x1079[_0x5b5b5f];return _0x380741;};'use strict';var _=require(_0x9107('0x0'));var util=require(_0x9107('0x1'));var logger=require(_0x9107('0x2'))(_0x9107('0x3'));var moment=require(_0x9107('0x4'));var BPromise=require(_0x9107('0x5'));var rp=require(_0x9107('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9107('0x7'));var config=require(_0x9107('0x8'));var attributes=require(_0x9107('0x9'));module[_0x9107('0xa')]=function(_0x540a9f,_0x27679f){return _0x540a9f[_0x9107('0xb')](_0x9107('0xc'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 277ba74..7e8b1f9 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 _0x3d70=['../../config/environment','client','http','request','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x5dc1cb,_0x1dd487){var _0x5df13f=function(_0x20a271){while(--_0x20a271){_0x5dc1cb['push'](_0x5dc1cb['shift']());}};_0x5df13f(++_0x1dd487);}(_0x3d70,0xf6));var _0x03d7=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x3d70[_0x1b828b];return _0x98da1a;};'use strict';var _=require('lodash');var util=require(_0x03d7('0x0'));var moment=require(_0x03d7('0x1'));var BPromise=require(_0x03d7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x03d7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x03d7('0x4'));var logger=require(_0x03d7('0x5'))('rpc');var config=require(_0x03d7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x03d7('0x7')][_0x03d7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x176150,_0x30761a,_0x4f3302){return new BPromise(function(_0x233035,_0x34bc56){return client[_0x03d7('0x9')](_0x176150,_0x4f3302)['then'](function(_0x1f10ae){logger[_0x03d7('0xa')]('VoiceContext,\x20%s,\x20%s',_0x30761a,_0x03d7('0xb'));logger[_0x03d7('0xc')](_0x03d7('0xd'),_0x30761a,_0x03d7('0xb'),JSON[_0x03d7('0xe')](_0x1f10ae));if(_0x1f10ae[_0x03d7('0xf')]){if(_0x1f10ae[_0x03d7('0xf')][_0x03d7('0x10')]===0x1f4){logger[_0x03d7('0xf')]('VoiceContext,\x20%s,\x20%s',_0x30761a,_0x1f10ae['error'][_0x03d7('0x11')]);return _0x34bc56(_0x1f10ae[_0x03d7('0xf')][_0x03d7('0x11')]);}logger[_0x03d7('0xf')](_0x03d7('0x12'),_0x30761a,_0x1f10ae[_0x03d7('0xf')][_0x03d7('0x11')]);return _0x233035(_0x1f10ae[_0x03d7('0xf')][_0x03d7('0x11')]);}else{logger[_0x03d7('0xa')]('VoiceContext,\x20%s,\x20%s',_0x30761a,'request\x20sent');_0x233035(_0x1f10ae[_0x03d7('0x13')][_0x03d7('0x11')]);}})[_0x03d7('0x14')](function(_0x2d7d43){logger[_0x03d7('0xf')](_0x03d7('0x12'),_0x30761a,_0x2d7d43);_0x34bc56(_0x2d7d43);});});} \ No newline at end of file +var _0xe235=['bluebird','../../mysqldb','../../config/utils','../../config/logger','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','lodash','util','moment'];(function(_0x58bf72,_0x270672){var _0x5ac3aa=function(_0x5b6191){while(--_0x5b6191){_0x58bf72['push'](_0x58bf72['shift']());}};_0x5ac3aa(++_0x270672);}(_0xe235,0xe4));var _0x5e23=function(_0x4f26e7,_0x35de07){_0x4f26e7=_0x4f26e7-0x0;var _0x5e501c=_0xe235[_0x4f26e7];return _0x5e501c;};'use strict';var _=require(_0x5e23('0x0'));var util=require(_0x5e23('0x1'));var moment=require(_0x5e23('0x2'));var BPromise=require(_0x5e23('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5e23('0x4'))['db'];var utils=require(_0x5e23('0x5'));var logger=require(_0x5e23('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5e23('0x7'));var client=jayson[_0x5e23('0x8')][_0x5e23('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c9b2b,_0x16454c,_0xd7f262){return new BPromise(function(_0x1f0008,_0x92ae38){return client[_0x5e23('0xa')](_0x1c9b2b,_0xd7f262)[_0x5e23('0xb')](function(_0x3bd7d5){logger[_0x5e23('0xc')](_0x5e23('0xd'),_0x16454c,_0x5e23('0xe'));logger['debug'](_0x5e23('0xf'),_0x16454c,_0x5e23('0xe'),JSON[_0x5e23('0x10')](_0x3bd7d5));if(_0x3bd7d5['error']){if(_0x3bd7d5[_0x5e23('0x11')]['code']===0x1f4){logger[_0x5e23('0x11')](_0x5e23('0xd'),_0x16454c,_0x3bd7d5['error'][_0x5e23('0x12')]);return _0x92ae38(_0x3bd7d5[_0x5e23('0x11')][_0x5e23('0x12')]);}logger[_0x5e23('0x11')]('VoiceContext,\x20%s,\x20%s',_0x16454c,_0x3bd7d5['error'][_0x5e23('0x12')]);return _0x1f0008(_0x3bd7d5[_0x5e23('0x11')][_0x5e23('0x12')]);}else{logger[_0x5e23('0xc')](_0x5e23('0xd'),_0x16454c,_0x5e23('0xe'));_0x1f0008(_0x3bd7d5[_0x5e23('0x13')][_0x5e23('0x12')]);}})[_0x5e23('0x14')](function(_0x149a3f){logger[_0x5e23('0x11')](_0x5e23('0xd'),_0x16454c,_0x149a3f);_0x92ae38(_0x149a3f);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 38e8e5f..77f053f 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 _0x58df=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','describe','show','post','create','put','/:id','update','destroy','exports','multer','path'];(function(_0x3ba9c0,_0x2db2d8){var _0x543daa=function(_0x51e436){while(--_0x51e436){_0x3ba9c0['push'](_0x3ba9c0['shift']());}};_0x543daa(++_0x2db2d8);}(_0x58df,0xb2));var _0xf58d=function(_0x5751ff,_0x26b23e){_0x5751ff=_0x5751ff-0x0;var _0x321d4f=_0x58df[_0x5751ff];return _0x321d4f;};'use strict';var multer=require(_0xf58d('0x0'));var util=require('util');var path=require(_0xf58d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf58d('0x2')]();var fs_extra=require(_0xf58d('0x3'));var auth=require(_0xf58d('0x4'));var interaction=require(_0xf58d('0x5'));var config=require(_0xf58d('0x6'));var controller=require(_0xf58d('0x7'));router[_0xf58d('0x8')]('/',auth[_0xf58d('0x9')](),controller[_0xf58d('0xa')]);router['get']('/describe',auth[_0xf58d('0x9')](),controller[_0xf58d('0xb')]);router[_0xf58d('0x8')]('/:id',auth[_0xf58d('0x9')](),controller[_0xf58d('0xc')]);router[_0xf58d('0xd')]('/',auth['isAuthenticated'](),controller[_0xf58d('0xe')]);router[_0xf58d('0xf')](_0xf58d('0x10'),auth[_0xf58d('0x9')](),controller[_0xf58d('0x11')]);router['delete'](_0xf58d('0x10'),auth[_0xf58d('0x9')](),controller[_0xf58d('0x12')]);module[_0xf58d('0x13')]=router; \ No newline at end of file +var _0x54b5=['./voiceDialReport.controller','get','isAuthenticated','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4451d3,_0x57ebde){var _0x2706b0=function(_0x5dc3ff){while(--_0x5dc3ff){_0x4451d3['push'](_0x4451d3['shift']());}};_0x2706b0(++_0x57ebde);}(_0x54b5,0x13b));var _0x554b=function(_0xe8b463,_0x129158){_0xe8b463=_0xe8b463-0x0;var _0x24141b=_0x54b5[_0xe8b463];return _0x24141b;};'use strict';var multer=require('multer');var util=require(_0x554b('0x0'));var path=require(_0x554b('0x1'));var timeout=require(_0x554b('0x2'));var express=require(_0x554b('0x3'));var router=express[_0x554b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x554b('0x5'));var interaction=require(_0x554b('0x6'));var config=require(_0x554b('0x7'));var controller=require(_0x554b('0x8'));router[_0x554b('0x9')]('/',auth[_0x554b('0xa')](),controller['index']);router[_0x554b('0x9')]('/describe',auth[_0x554b('0xa')](),controller['describe']);router[_0x554b('0x9')]('/:id',auth[_0x554b('0xa')](),controller['show']);router[_0x554b('0xb')]('/',auth[_0x554b('0xa')](),controller[_0x554b('0xc')]);router[_0x554b('0xd')](_0x554b('0xe'),auth['isAuthenticated'](),controller[_0x554b('0xf')]);router[_0x554b('0x10')](_0x554b('0xe'),auth[_0x554b('0xa')](),controller[_0x554b('0x11')]);module[_0x554b('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 0fb5822..a88ec93 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 _0xbec5=['called,connect,complete','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x559fb9,_0x4d0921){var _0x10708f=function(_0x58e1b8){while(--_0x58e1b8){_0x559fb9['push'](_0x559fb9['shift']());}};_0x10708f(++_0x4d0921);}(_0xbec5,0xe5));var _0x5bec=function(_0x56ba92,_0xb3c986){_0x56ba92=_0x56ba92-0x0;var _0x8fe94d=_0xbec5[_0x56ba92];return _0x8fe94d;};'use strict';var Sequelize=require(_0x5bec('0x0'));module[_0x5bec('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5bec('0x2')]},'channelstate':{'type':Sequelize[_0x5bec('0x3')]},'channelstatedesc':{'type':Sequelize[_0x5bec('0x2')]},'calleridnum':{'type':Sequelize[_0x5bec('0x2')]},'calleridname':{'type':Sequelize[_0x5bec('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x5bec('0x2')]},'language':{'type':Sequelize[_0x5bec('0x2')]},'accountcode':{'type':Sequelize[_0x5bec('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5bec('0x2')]},'priority':{'type':Sequelize[_0x5bec('0x3')]},'uniqueid':{'type':Sequelize[_0x5bec('0x2')]},'linkedid':{'type':Sequelize[_0x5bec('0x2')]},'destchannel':{'type':Sequelize[_0x5bec('0x2')]},'destchannelstate':{'type':Sequelize[_0x5bec('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x5bec('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5bec('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x5bec('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x5bec('0x2')]},'destaccountcode':{'type':Sequelize[_0x5bec('0x2')]},'destcontext':{'type':Sequelize[_0x5bec('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x5bec('0x3')]},'destuniqueid':{'type':Sequelize[_0x5bec('0x2')]},'destlinkedid':{'type':Sequelize[_0x5bec('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x5bec('0x2')]},'starttime':{'type':Sequelize[_0x5bec('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x5bec('0x4')]},'lastevent':{'type':Sequelize[_0x5bec('0x2')],'comment':_0x5bec('0x5')},'routeId':{'type':Sequelize[_0x5bec('0x3')]},'duration':{'type':Sequelize[_0x5bec('0x3')]},'holdtime':{'type':Sequelize[_0x5bec('0x3')]},'billableseconds':{'type':Sequelize[_0x5bec('0x3')]}}; \ No newline at end of file +var _0x8d0e=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x2cebe3,_0x4636e9){var _0x57010b=function(_0x3a8865){while(--_0x3a8865){_0x2cebe3['push'](_0x2cebe3['shift']());}};_0x57010b(++_0x4636e9);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x27ea43,_0x404214){_0x27ea43=_0x27ea43-0x0;var _0x415aa9=_0x8d0e[_0x27ea43];return _0x415aa9;};'use strict';var Sequelize=require(_0xe8d0('0x0'));module[_0xe8d0('0x1')]={'privilege':{'type':Sequelize[_0xe8d0('0x2')]},'channel':{'type':Sequelize[_0xe8d0('0x2')]},'channelstate':{'type':Sequelize[_0xe8d0('0x3')]},'channelstatedesc':{'type':Sequelize[_0xe8d0('0x2')]},'calleridnum':{'type':Sequelize[_0xe8d0('0x2')]},'calleridname':{'type':Sequelize[_0xe8d0('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe8d0('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe8d0('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xe8d0('0x2')]},'priority':{'type':Sequelize[_0xe8d0('0x3')]},'uniqueid':{'type':Sequelize[_0xe8d0('0x2')]},'linkedid':{'type':Sequelize[_0xe8d0('0x2')]},'destchannel':{'type':Sequelize[_0xe8d0('0x2')]},'destchannelstate':{'type':Sequelize[_0xe8d0('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xe8d0('0x2')]},'destcalleridnum':{'type':Sequelize[_0xe8d0('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xe8d0('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xe8d0('0x2')]},'destlanguage':{'type':Sequelize[_0xe8d0('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xe8d0('0x2')]},'destpriority':{'type':Sequelize[_0xe8d0('0x3')]},'destuniqueid':{'type':Sequelize[_0xe8d0('0x2')]},'destlinkedid':{'type':Sequelize[_0xe8d0('0x2')]},'dialstring':{'type':Sequelize[_0xe8d0('0x2')]},'dialstatus':{'type':Sequelize[_0xe8d0('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe8d0('0x4')]},'endtime':{'type':Sequelize[_0xe8d0('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xe8d0('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xe8d0('0x3')]},'billableseconds':{'type':Sequelize[_0xe8d0('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 4e1de71..87a5f88 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 _0xda85=['body','describe','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','then','destroy','error','name','send','map','VoiceDialReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xda85,0x90));var _0x5da8=function(_0x191cc5,_0x1e59cc){_0x191cc5=_0x191cc5-0x0;var _0x5a9f5e=_0xda85[_0x191cc5];return _0x5a9f5e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5da8('0x0'));var jsonpatch=require(_0x5da8('0x1'));var rp=require('request-promise');var moment=require(_0x5da8('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5da8('0x3'));var util=require(_0x5da8('0x4'));var path=require(_0x5da8('0x5'));var sox=require('sox');var csv=require(_0x5da8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5da8('0x7'));var _=require('lodash');var squel=require(_0x5da8('0x8'));var crypto=require(_0x5da8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x5da8('0xa'));var toCsv=require(_0x5da8('0x6'));var querystring=require(_0x5da8('0xb'));var Papa=require(_0x5da8('0xc'));var Redis=require(_0x5da8('0xd'));var authService=require(_0x5da8('0xe'));var qs=require(_0x5da8('0xf'));var as=require(_0x5da8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5da8('0x11'))(_0x5da8('0x12'));var utils=require('../../config/utils');var config=require(_0x5da8('0x13'));var licenseUtil=require(_0x5da8('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53f50d,_0x3cc3d5){_0x3cc3d5=_0x3cc3d5||0xcc;return function(_0x526ac1){if(_0x526ac1){return _0x53f50d[_0x5da8('0x15')](_0x3cc3d5);}return _0x53f50d[_0x5da8('0x16')](_0x3cc3d5)[_0x5da8('0x17')]();};}function respondWithResult(_0x5f4fec,_0x492358){_0x492358=_0x492358||0xc8;return function(_0x458753){if(_0x458753){return _0x5f4fec['status'](_0x492358)[_0x5da8('0x18')](_0x458753);}};}function respondWithFilteredResult(_0x530670,_0x55f83d){return function(_0x5ae4cb){if(_0x5ae4cb){var _0x5bc6f2=typeof _0x55f83d[_0x5da8('0x19')]===_0x5da8('0x1a')&&typeof _0x55f83d[_0x5da8('0x1b')]==='undefined';var _0x5d120d=_0x5ae4cb[_0x5da8('0x1c')];var _0x5319b8=_0x5bc6f2?0x0:_0x55f83d[_0x5da8('0x19')];var _0x478e13=_0x5bc6f2?_0x5ae4cb['count']:_0x55f83d[_0x5da8('0x19')]+_0x55f83d[_0x5da8('0x1b')];var _0x46fdec;if(_0x478e13>=_0x5d120d){_0x478e13=_0x5d120d;_0x46fdec=0xc8;}else{_0x46fdec=0xce;}_0x530670[_0x5da8('0x16')](_0x46fdec);return _0x530670['set']('Content-Range',_0x5319b8+'-'+_0x478e13+'/'+_0x5d120d)[_0x5da8('0x18')](_0x5ae4cb);}return null;};}function patchUpdates(_0x58aaf1){return function(_0x1e446b){try{jsonpatch[_0x5da8('0x1d')](_0x1e446b,_0x58aaf1,!![]);}catch(_0x1a9f41){return BPromise[_0x5da8('0x1e')](_0x1a9f41);}return _0x1e446b['save']();};}function saveUpdates(_0x1730ff,_0x43b03d){return function(_0x9a254c){if(_0x9a254c){return _0x9a254c[_0x5da8('0x1f')](_0x1730ff)[_0x5da8('0x20')](function(_0x3a5e33){return _0x3a5e33;});}return null;};}function removeEntity(_0x163db4,_0x19976f){return function(_0x121eb7){if(_0x121eb7){return _0x121eb7[_0x5da8('0x21')]()[_0x5da8('0x20')](function(){_0x163db4[_0x5da8('0x16')](0xcc)[_0x5da8('0x17')]();});}};}function handleEntityNotFound(_0x24ea57,_0x41d053){return function(_0x20c655){if(!_0x20c655){_0x24ea57['sendStatus'](0x194);}return _0x20c655;};}function handleError(_0x2805b2,_0x668860){_0x668860=_0x668860||0x1f4;return function(_0xf24766){logger[_0x5da8('0x22')](_0xf24766['stack']);if(_0xf24766[_0x5da8('0x23')]){delete _0xf24766[_0x5da8('0x23')];}_0x2805b2[_0x5da8('0x16')](_0x668860)[_0x5da8('0x24')](_0xf24766);};}exports['index']=function(_0x172770,_0x198d24){var _0x26ff0f={},_0x5c418a={},_0x212d19={'count':0x0,'rows':[]};var _0x2dc5b4=_[_0x5da8('0x25')](db[_0x5da8('0x26')][_0x5da8('0x27')],function(_0xac413a){return{'name':_0xac413a[_0x5da8('0x28')],'type':_0xac413a['type'][_0x5da8('0x29')]};});_0x5c418a[_0x5da8('0x2a')]=_[_0x5da8('0x25')](_0x2dc5b4,_0x5da8('0x23'));_0x5c418a[_0x5da8('0x2b')]=_[_0x5da8('0x2c')](_0x172770['query']);_0x5c418a[_0x5da8('0x2d')]=_[_0x5da8('0x2e')](_0x5c418a['model'],_0x5c418a[_0x5da8('0x2b')]);_0x26ff0f[_0x5da8('0x2f')]=_[_0x5da8('0x2e')](_0x5c418a[_0x5da8('0x2a')],qs[_0x5da8('0x30')](_0x172770[_0x5da8('0x2b')][_0x5da8('0x30')]));_0x26ff0f[_0x5da8('0x2f')]=_0x26ff0f[_0x5da8('0x2f')][_0x5da8('0x31')]?_0x26ff0f[_0x5da8('0x2f')]:_0x5c418a[_0x5da8('0x2a')];if(!_0x172770['query'][_0x5da8('0x32')](_0x5da8('0x33'))){_0x26ff0f[_0x5da8('0x1b')]=qs[_0x5da8('0x1b')](_0x172770[_0x5da8('0x2b')][_0x5da8('0x1b')]);_0x26ff0f[_0x5da8('0x19')]=qs[_0x5da8('0x19')](_0x172770[_0x5da8('0x2b')][_0x5da8('0x19')]);}_0x26ff0f[_0x5da8('0x34')]=qs[_0x5da8('0x35')](_0x172770[_0x5da8('0x2b')]['sort']);_0x26ff0f[_0x5da8('0x36')]=qs[_0x5da8('0x2d')](_[_0x5da8('0x37')](_0x172770['query'],_0x5c418a[_0x5da8('0x2d')]),_0x2dc5b4);if(_0x172770[_0x5da8('0x2b')][_0x5da8('0x38')]){_0x26ff0f[_0x5da8('0x36')]=_[_0x5da8('0x39')](_0x26ff0f[_0x5da8('0x36')],{'$or':_[_0x5da8('0x25')](_0x2dc5b4,function(_0xd86335){if(_0xd86335[_0x5da8('0x3a')]!==_0x5da8('0x3b')){var _0x86e54e={};_0x86e54e[_0xd86335[_0x5da8('0x23')]]={'$like':'%'+_0x172770[_0x5da8('0x2b')][_0x5da8('0x38')]+'%'};return _0x86e54e;}})});}_0x26ff0f=_[_0x5da8('0x39')]({},_0x26ff0f,_0x172770['options']);var _0x4035f9={'where':_0x26ff0f[_0x5da8('0x36')]};return db[_0x5da8('0x26')][_0x5da8('0x1c')](_0x4035f9)[_0x5da8('0x20')](function(_0x1210dc){_0x212d19['count']=_0x1210dc;if(_0x172770[_0x5da8('0x2b')][_0x5da8('0x3c')]){_0x26ff0f[_0x5da8('0x3d')]=[{'all':!![]}];}return db[_0x5da8('0x26')][_0x5da8('0x3e')](_0x26ff0f);})['then'](function(_0x20d2e3){_0x212d19[_0x5da8('0x3f')]=_0x20d2e3;return _0x212d19;})['then'](respondWithFilteredResult(_0x198d24,_0x26ff0f))[_0x5da8('0x40')](handleError(_0x198d24,null));};exports[_0x5da8('0x41')]=function(_0x36944b,_0x51fc17){var _0x248ed6={'raw':!![],'where':{'id':_0x36944b[_0x5da8('0x42')]['id']}},_0x3be8f2={};_0x3be8f2[_0x5da8('0x2a')]=_[_0x5da8('0x2c')](db[_0x5da8('0x26')][_0x5da8('0x27')]);_0x3be8f2[_0x5da8('0x2b')]=_[_0x5da8('0x2c')](_0x36944b[_0x5da8('0x2b')]);_0x3be8f2[_0x5da8('0x2d')]=_[_0x5da8('0x2e')](_0x3be8f2[_0x5da8('0x2a')],_0x3be8f2[_0x5da8('0x2b')]);_0x248ed6['attributes']=_[_0x5da8('0x2e')](_0x3be8f2[_0x5da8('0x2a')],qs[_0x5da8('0x30')](_0x36944b[_0x5da8('0x2b')][_0x5da8('0x30')]));_0x248ed6['attributes']=_0x248ed6['attributes'][_0x5da8('0x31')]?_0x248ed6['attributes']:_0x3be8f2['model'];if(_0x36944b['query'][_0x5da8('0x3c')]){_0x248ed6[_0x5da8('0x3d')]=[{'all':!![]}];}_0x248ed6=_['merge']({},_0x248ed6,_0x36944b['options']);return db[_0x5da8('0x26')][_0x5da8('0x43')](_0x248ed6)[_0x5da8('0x20')](handleEntityNotFound(_0x51fc17,null))['then'](respondWithResult(_0x51fc17,null))[_0x5da8('0x40')](handleError(_0x51fc17,null));};exports[_0x5da8('0x44')]=function(_0x33db5a,_0x579bf5){return db['VoiceDialReport'][_0x5da8('0x44')](_0x33db5a[_0x5da8('0x45')],{})['then'](respondWithResult(_0x579bf5,0xc9))[_0x5da8('0x40')](handleError(_0x579bf5,null));};exports['update']=function(_0x44701e,_0x459e95){if(_0x44701e[_0x5da8('0x45')]['id']){delete _0x44701e['body']['id'];}return db[_0x5da8('0x26')]['find']({'where':{'id':_0x44701e['params']['id']}})['then'](handleEntityNotFound(_0x459e95,null))[_0x5da8('0x20')](saveUpdates(_0x44701e[_0x5da8('0x45')],null))[_0x5da8('0x20')](respondWithResult(_0x459e95,null))[_0x5da8('0x40')](handleError(_0x459e95,null));};exports[_0x5da8('0x21')]=function(_0x160035,_0x3aaae4){return db[_0x5da8('0x26')]['find']({'where':{'id':_0x160035[_0x5da8('0x42')]['id']}})[_0x5da8('0x20')](handleEntityNotFound(_0x3aaae4,null))['then'](removeEntity(_0x3aaae4,null))[_0x5da8('0x40')](handleError(_0x3aaae4,null));};exports[_0x5da8('0x46')]=function(_0x557109,_0x83b975){return db['VoiceDialReport'][_0x5da8('0x46')]()['then'](respondWithResult(_0x83b975,null))[_0x5da8('0x40')](handleError(_0x83b975,null));}; \ No newline at end of file +var _0xab58=['end','json','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','fieldName','type','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','options','VoiceDialReport','includeAll','include','findAll','rows','show','rawAttributes','intersection','length','find','catch','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xab58,0x7c));var _0x8ab5=function(_0x43a0e1,_0x49e043){_0x43a0e1=_0x43a0e1-0x0;var _0x4e4c54=_0xab58[_0x43a0e1];return _0x4e4c54;};'use strict';var emlformat=require(_0x8ab5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8ab5('0x1'));var jsonpatch=require(_0x8ab5('0x2'));var rp=require(_0x8ab5('0x3'));var moment=require('moment');var BPromise=require(_0x8ab5('0x4'));var Mustache=require('mustache');var util=require(_0x8ab5('0x5'));var path=require(_0x8ab5('0x6'));var sox=require(_0x8ab5('0x7'));var csv=require(_0x8ab5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ab5('0x9'));var _=require(_0x8ab5('0xa'));var squel=require(_0x8ab5('0xb'));var crypto=require(_0x8ab5('0xc'));var jsforce=require(_0x8ab5('0xd'));var deskjs=require(_0x8ab5('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8ab5('0xf'));var Redis=require(_0x8ab5('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8ab5('0x11'));var hardwareService=require(_0x8ab5('0x12'));var logger=require('../../config/logger')(_0x8ab5('0x13'));var utils=require(_0x8ab5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8ab5('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42101d,_0x120d67){_0x120d67=_0x120d67||0xcc;return function(_0x3414a4){if(_0x3414a4){return _0x42101d[_0x8ab5('0x16')](_0x120d67);}return _0x42101d[_0x8ab5('0x17')](_0x120d67)[_0x8ab5('0x18')]();};}function respondWithResult(_0x3cfff1,_0x1029bc){_0x1029bc=_0x1029bc||0xc8;return function(_0xd21c9d){if(_0xd21c9d){return _0x3cfff1[_0x8ab5('0x17')](_0x1029bc)[_0x8ab5('0x19')](_0xd21c9d);}};}function respondWithFilteredResult(_0x4e378b,_0x99d5a4){return function(_0x210cc1){if(_0x210cc1){var _0x53a45e=typeof _0x99d5a4['offset']===_0x8ab5('0x1a')&&typeof _0x99d5a4['limit']==='undefined';var _0x569fca=_0x210cc1[_0x8ab5('0x1b')];var _0x308710=_0x53a45e?0x0:_0x99d5a4['offset'];var _0x5edd96=_0x53a45e?_0x210cc1[_0x8ab5('0x1b')]:_0x99d5a4['offset']+_0x99d5a4[_0x8ab5('0x1c')];var _0x553d88;if(_0x5edd96>=_0x569fca){_0x5edd96=_0x569fca;_0x553d88=0xc8;}else{_0x553d88=0xce;}_0x4e378b[_0x8ab5('0x17')](_0x553d88);return _0x4e378b[_0x8ab5('0x1d')]('Content-Range',_0x308710+'-'+_0x5edd96+'/'+_0x569fca)[_0x8ab5('0x19')](_0x210cc1);}return null;};}function patchUpdates(_0x4381bf){return function(_0x341797){try{jsonpatch[_0x8ab5('0x1e')](_0x341797,_0x4381bf,!![]);}catch(_0x2ca7fd){return BPromise[_0x8ab5('0x1f')](_0x2ca7fd);}return _0x341797[_0x8ab5('0x20')]();};}function saveUpdates(_0x2ad397,_0x4ac28b){return function(_0x57477b){if(_0x57477b){return _0x57477b[_0x8ab5('0x21')](_0x2ad397)[_0x8ab5('0x22')](function(_0x2f2c82){return _0x2f2c82;});}return null;};}function removeEntity(_0x2a6d50,_0x4e38b4){return function(_0x1332ed){if(_0x1332ed){return _0x1332ed[_0x8ab5('0x23')]()['then'](function(){_0x2a6d50[_0x8ab5('0x17')](0xcc)[_0x8ab5('0x18')]();});}};}function handleEntityNotFound(_0x5798d0,_0xcf21d0){return function(_0x2e52b4){if(!_0x2e52b4){_0x5798d0[_0x8ab5('0x16')](0x194);}return _0x2e52b4;};}function handleError(_0xb7fded,_0x5b85f7){_0x5b85f7=_0x5b85f7||0x1f4;return function(_0x104a0f){logger[_0x8ab5('0x24')](_0x104a0f[_0x8ab5('0x25')]);if(_0x104a0f[_0x8ab5('0x26')]){delete _0x104a0f[_0x8ab5('0x26')];}_0xb7fded[_0x8ab5('0x17')](_0x5b85f7)['send'](_0x104a0f);};}exports[_0x8ab5('0x27')]=function(_0x1781d8,_0x2eea99){var _0x128847={},_0x633901={},_0x25f1bd={'count':0x0,'rows':[]};var _0x1acc5e=_[_0x8ab5('0x28')](db['VoiceDialReport']['rawAttributes'],function(_0x881602){return{'name':_0x881602[_0x8ab5('0x29')],'type':_0x881602[_0x8ab5('0x2a')]['key']};});_0x633901[_0x8ab5('0x2b')]=_[_0x8ab5('0x28')](_0x1acc5e,'name');_0x633901[_0x8ab5('0x2c')]=_[_0x8ab5('0x2d')](_0x1781d8[_0x8ab5('0x2c')]);_0x633901[_0x8ab5('0x2e')]=_['intersection'](_0x633901[_0x8ab5('0x2b')],_0x633901[_0x8ab5('0x2c')]);_0x128847[_0x8ab5('0x2f')]=_['intersection'](_0x633901[_0x8ab5('0x2b')],qs[_0x8ab5('0x30')](_0x1781d8[_0x8ab5('0x2c')][_0x8ab5('0x30')]));_0x128847['attributes']=_0x128847['attributes']['length']?_0x128847[_0x8ab5('0x2f')]:_0x633901[_0x8ab5('0x2b')];if(!_0x1781d8[_0x8ab5('0x2c')][_0x8ab5('0x31')](_0x8ab5('0x32'))){_0x128847[_0x8ab5('0x1c')]=qs['limit'](_0x1781d8['query'][_0x8ab5('0x1c')]);_0x128847['offset']=qs[_0x8ab5('0x33')](_0x1781d8[_0x8ab5('0x2c')]['offset']);}_0x128847[_0x8ab5('0x34')]=qs[_0x8ab5('0x35')](_0x1781d8['query'][_0x8ab5('0x35')]);_0x128847['where']=qs[_0x8ab5('0x2e')](_[_0x8ab5('0x36')](_0x1781d8[_0x8ab5('0x2c')],_0x633901['filters']),_0x1acc5e);if(_0x1781d8['query'][_0x8ab5('0x37')]){_0x128847[_0x8ab5('0x38')]=_[_0x8ab5('0x39')](_0x128847[_0x8ab5('0x38')],{'$or':_['map'](_0x1acc5e,function(_0x1a735b){if(_0x1a735b[_0x8ab5('0x2a')]!=='VIRTUAL'){var _0x563d4c={};_0x563d4c[_0x1a735b[_0x8ab5('0x26')]]={'$like':'%'+_0x1781d8[_0x8ab5('0x2c')][_0x8ab5('0x37')]+'%'};return _0x563d4c;}})});}_0x128847=_[_0x8ab5('0x39')]({},_0x128847,_0x1781d8[_0x8ab5('0x3a')]);var _0x22fd82={'where':_0x128847['where']};return db[_0x8ab5('0x3b')]['count'](_0x22fd82)[_0x8ab5('0x22')](function(_0x3ecba6){_0x25f1bd[_0x8ab5('0x1b')]=_0x3ecba6;if(_0x1781d8[_0x8ab5('0x2c')][_0x8ab5('0x3c')]){_0x128847[_0x8ab5('0x3d')]=[{'all':!![]}];}return db[_0x8ab5('0x3b')][_0x8ab5('0x3e')](_0x128847);})[_0x8ab5('0x22')](function(_0x11d3f5){_0x25f1bd[_0x8ab5('0x3f')]=_0x11d3f5;return _0x25f1bd;})[_0x8ab5('0x22')](respondWithFilteredResult(_0x2eea99,_0x128847))['catch'](handleError(_0x2eea99,null));};exports[_0x8ab5('0x40')]=function(_0x10e106,_0x3fe91e){var _0x1fba33={'raw':!![],'where':{'id':_0x10e106['params']['id']}},_0x1b1860={};_0x1b1860['model']=_[_0x8ab5('0x2d')](db[_0x8ab5('0x3b')][_0x8ab5('0x41')]);_0x1b1860[_0x8ab5('0x2c')]=_['keys'](_0x10e106[_0x8ab5('0x2c')]);_0x1b1860[_0x8ab5('0x2e')]=_[_0x8ab5('0x42')](_0x1b1860[_0x8ab5('0x2b')],_0x1b1860[_0x8ab5('0x2c')]);_0x1fba33[_0x8ab5('0x2f')]=_[_0x8ab5('0x42')](_0x1b1860[_0x8ab5('0x2b')],qs[_0x8ab5('0x30')](_0x10e106['query'][_0x8ab5('0x30')]));_0x1fba33[_0x8ab5('0x2f')]=_0x1fba33[_0x8ab5('0x2f')][_0x8ab5('0x43')]?_0x1fba33['attributes']:_0x1b1860[_0x8ab5('0x2b')];if(_0x10e106[_0x8ab5('0x2c')][_0x8ab5('0x3c')]){_0x1fba33[_0x8ab5('0x3d')]=[{'all':!![]}];}_0x1fba33=_['merge']({},_0x1fba33,_0x10e106[_0x8ab5('0x3a')]);return db[_0x8ab5('0x3b')][_0x8ab5('0x44')](_0x1fba33)[_0x8ab5('0x22')](handleEntityNotFound(_0x3fe91e,null))['then'](respondWithResult(_0x3fe91e,null))[_0x8ab5('0x45')](handleError(_0x3fe91e,null));};exports[_0x8ab5('0x46')]=function(_0x570881,_0x175443){return db[_0x8ab5('0x3b')][_0x8ab5('0x46')](_0x570881[_0x8ab5('0x47')],{})[_0x8ab5('0x22')](respondWithResult(_0x175443,0xc9))[_0x8ab5('0x45')](handleError(_0x175443,null));};exports[_0x8ab5('0x21')]=function(_0x513df0,_0x17efc9){if(_0x513df0[_0x8ab5('0x47')]['id']){delete _0x513df0['body']['id'];}return db[_0x8ab5('0x3b')][_0x8ab5('0x44')]({'where':{'id':_0x513df0[_0x8ab5('0x48')]['id']}})[_0x8ab5('0x22')](handleEntityNotFound(_0x17efc9,null))[_0x8ab5('0x22')](saveUpdates(_0x513df0[_0x8ab5('0x47')],null))[_0x8ab5('0x22')](respondWithResult(_0x17efc9,null))[_0x8ab5('0x45')](handleError(_0x17efc9,null));};exports[_0x8ab5('0x23')]=function(_0x44da80,_0x40187b){return db[_0x8ab5('0x3b')][_0x8ab5('0x44')]({'where':{'id':_0x44da80['params']['id']}})[_0x8ab5('0x22')](handleEntityNotFound(_0x40187b,null))[_0x8ab5('0x22')](removeEntity(_0x40187b,null))[_0x8ab5('0x45')](handleError(_0x40187b,null));};exports[_0x8ab5('0x49')]=function(_0x25095a,_0x3f382a){return db[_0x8ab5('0x3b')][_0x8ab5('0x49')]()[_0x8ab5('0x22')](respondWithResult(_0x3f382a,null))[_0x8ab5('0x45')](handleError(_0x3f382a,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 112e5b3..4017087 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 _0x1952=['define','VoiceDialReport','util','../../config/logger','moment','request-promise','../../config/environment','./voiceDialReport.attributes'];(function(_0x1f9fcb,_0x77e96c){var _0x128025=function(_0x18bb3e){while(--_0x18bb3e){_0x1f9fcb['push'](_0x1f9fcb['shift']());}};_0x128025(++_0x77e96c);}(_0x1952,0x92));var _0x2195=function(_0x50bf29,_0x5e6515){_0x50bf29=_0x50bf29-0x0;var _0x5218ff=_0x1952[_0x50bf29];return _0x5218ff;};'use strict';var _=require('lodash');var util=require(_0x2195('0x0'));var logger=require(_0x2195('0x1'))('api');var moment=require(_0x2195('0x2'));var BPromise=require('bluebird');var rp=require(_0x2195('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2195('0x4'));var attributes=require(_0x2195('0x5'));module['exports']=function(_0x140263,_0xfdb1ac){return _0x140263[_0x2195('0x6')](_0x2195('0x7'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa459=['define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x206e79,_0x5e5cf2){var _0x89597c=function(_0x581ea1){while(--_0x581ea1){_0x206e79['push'](_0x206e79['shift']());}};_0x89597c(++_0x5e5cf2);}(_0xa459,0x1d8));var _0x9a45=function(_0x2b8f2b,_0x3e41ac){_0x2b8f2b=_0x2b8f2b-0x0;var _0x12b3ff=_0xa459[_0x2b8f2b];return _0x12b3ff;};'use strict';var _=require(_0x9a45('0x0'));var util=require(_0x9a45('0x1'));var logger=require(_0x9a45('0x2'))(_0x9a45('0x3'));var moment=require(_0x9a45('0x4'));var BPromise=require(_0x9a45('0x5'));var rp=require(_0x9a45('0x6'));var fs=require('fs');var path=require(_0x9a45('0x7'));var rimraf=require(_0x9a45('0x8'));var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x257f0a,_0x5bab55){return _0x257f0a[_0x9a45('0x9')](_0x9a45('0xa'),attributes,{'tableName':_0x9a45('0xb'),'paranoid':![],'indexes':[{'fields':[_0x9a45('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 0c47fe5..620155d 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 _0xb5df=['update','where','attributes','limit','debug','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport'];(function(_0x23e3fd,_0x23013c){var _0x9d32d8=function(_0x6937c){while(--_0x6937c){_0x23e3fd['push'](_0x23e3fd['shift']());}};_0x9d32d8(++_0x23013c);}(_0xb5df,0xc5));var _0xfb5d=function(_0x3c2a08,_0x154187){_0x3c2a08=_0x3c2a08-0x0;var _0xf16592=_0xb5df[_0x3c2a08];return _0xf16592;};'use strict';var _=require('lodash');var util=require(_0xfb5d('0x0'));var moment=require('moment');var BPromise=require(_0xfb5d('0x1'));var rs=require(_0xfb5d('0x2'));var fs=require('fs');var Redis=require(_0xfb5d('0x3'));var db=require(_0xfb5d('0x4'))['db'];var utils=require(_0xfb5d('0x5'));var logger=require(_0xfb5d('0x6'))('rpc');var config=require(_0xfb5d('0x7'));var jayson=require(_0xfb5d('0x8'));var client=jayson[_0xfb5d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55d3f8,_0x26f894,_0x5a5b22){return new BPromise(function(_0x8a129a,_0x50bb2b){return client['request'](_0x55d3f8,_0x5a5b22)[_0xfb5d('0xa')](function(_0x692179){logger[_0xfb5d('0xb')](_0xfb5d('0xc'),_0x26f894,_0xfb5d('0xd'));logger['debug'](_0xfb5d('0xe'),_0x26f894,_0xfb5d('0xd'),JSON[_0xfb5d('0xf')](_0x692179));if(_0x692179[_0xfb5d('0x10')]){if(_0x692179['error'][_0xfb5d('0x11')]===0x1f4){logger[_0xfb5d('0x10')](_0xfb5d('0xc'),_0x26f894,_0x692179[_0xfb5d('0x10')][_0xfb5d('0x12')]);return _0x50bb2b(_0x692179[_0xfb5d('0x10')]['message']);}logger[_0xfb5d('0x10')](_0xfb5d('0xc'),_0x26f894,_0x692179['error'][_0xfb5d('0x12')]);return _0x8a129a(_0x692179['error'][_0xfb5d('0x12')]);}else{logger[_0xfb5d('0xb')](_0xfb5d('0xc'),_0x26f894,_0xfb5d('0xd'));_0x8a129a(_0x692179['result']['message']);}})[_0xfb5d('0x13')](function(_0xc2881){logger[_0xfb5d('0x10')](_0xfb5d('0xc'),_0x26f894,_0xc2881);_0x50bb2b(_0xc2881);});});}exports[_0xfb5d('0x14')]=function(_0x48f97f){var _0x2b2bdf=this;return new Promise(function(_0xecf34a,_0x36e5a7){return db[_0xfb5d('0x15')][_0xfb5d('0x16')](_0x48f97f[_0xfb5d('0x17')],{'raw':_0x48f97f[_0xfb5d('0x18')]?_0x48f97f[_0xfb5d('0x18')][_0xfb5d('0x19')]===undefined?!![]:![]:!![]})[_0xfb5d('0xa')](function(_0x18333d){logger[_0xfb5d('0xb')](_0xfb5d('0x14'),_0x48f97f);logger['debug'](_0xfb5d('0x14'),_0x48f97f,JSON['stringify'](_0x18333d));_0xecf34a(_0x18333d);})[_0xfb5d('0x13')](function(_0x301bb6){logger[_0xfb5d('0x10')](_0xfb5d('0x14'),_0x301bb6[_0xfb5d('0x12')],_0x48f97f);_0x36e5a7(_0x2b2bdf['error'](0x1f4,_0x301bb6[_0xfb5d('0x12')]));});});};exports[_0xfb5d('0x1a')]=function(_0x3d9d40){var _0x374237=this;return new Promise(function(_0x342900,_0x37994b){return db['VoiceDialReport'][_0xfb5d('0x1b')](_0x3d9d40['body'],{'raw':_0x3d9d40[_0xfb5d('0x18')]?_0x3d9d40[_0xfb5d('0x18')][_0xfb5d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d9d40[_0xfb5d('0x18')]?_0x3d9d40['options'][_0xfb5d('0x1c')]||null:null,'attributes':_0x3d9d40[_0xfb5d('0x18')]?_0x3d9d40[_0xfb5d('0x18')][_0xfb5d('0x1d')]||null:null,'limit':_0x3d9d40['options']?_0x3d9d40['options'][_0xfb5d('0x1e')]||null:null})[_0xfb5d('0xa')](function(_0xb3dd7e){logger[_0xfb5d('0xb')](_0xfb5d('0x1a'),_0x3d9d40);logger[_0xfb5d('0x1f')]('UpdateVoiceDialReport',_0x3d9d40,JSON[_0xfb5d('0xf')](_0xb3dd7e));_0x342900(_0xb3dd7e);})[_0xfb5d('0x13')](function(_0x4a69b6){logger[_0xfb5d('0x10')](_0xfb5d('0x1a'),_0x4a69b6['message'],_0x3d9d40);_0x37994b(_0x374237[_0xfb5d('0x10')](0x1f4,_0x4a69b6[_0xfb5d('0x12')]));});});}; \ No newline at end of file +var _0xedbf=['update','limit','UpdateVoiceDialReport','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','VoiceDialReport','options','raw','then','CreateVoiceDialReport','catch'];(function(_0x1dd84a,_0xf655b7){var _0x5760fb=function(_0x27c599){while(--_0x27c599){_0x1dd84a['push'](_0x1dd84a['shift']());}};_0x5760fb(++_0xf655b7);}(_0xedbf,0x1de));var _0xfedb=function(_0x144503,_0x3924a7){_0x144503=_0x144503-0x0;var _0x32ac61=_0xedbf[_0x144503];return _0x32ac61;};'use strict';var _=require(_0xfedb('0x0'));var util=require(_0xfedb('0x1'));var moment=require(_0xfedb('0x2'));var BPromise=require('bluebird');var rs=require(_0xfedb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfedb('0x4'));var logger=require(_0xfedb('0x5'))(_0xfedb('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x37f42a,_0x56be11,_0xdaf434){return new BPromise(function(_0x1d0a1d,_0x4b0777){return client['request'](_0x37f42a,_0xdaf434)['then'](function(_0x558204){logger[_0xfedb('0x7')](_0xfedb('0x8'),_0x56be11,_0xfedb('0x9'));logger[_0xfedb('0xa')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x56be11,_0xfedb('0x9'),JSON[_0xfedb('0xb')](_0x558204));if(_0x558204[_0xfedb('0xc')]){if(_0x558204['error'][_0xfedb('0xd')]===0x1f4){logger['error'](_0xfedb('0x8'),_0x56be11,_0x558204[_0xfedb('0xc')][_0xfedb('0xe')]);return _0x4b0777(_0x558204[_0xfedb('0xc')][_0xfedb('0xe')]);}logger[_0xfedb('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x56be11,_0x558204[_0xfedb('0xc')]['message']);return _0x1d0a1d(_0x558204[_0xfedb('0xc')][_0xfedb('0xe')]);}else{logger[_0xfedb('0x7')](_0xfedb('0x8'),_0x56be11,_0xfedb('0x9'));_0x1d0a1d(_0x558204[_0xfedb('0xf')][_0xfedb('0xe')]);}})['catch'](function(_0x4eaf5e){logger[_0xfedb('0xc')](_0xfedb('0x8'),_0x56be11,_0x4eaf5e);_0x4b0777(_0x4eaf5e);});});}exports['CreateVoiceDialReport']=function(_0x1ef8e2){var _0x5f8ad=this;return new Promise(function(_0x4c561d,_0x47e09e){return db[_0xfedb('0x10')]['create'](_0x1ef8e2['body'],{'raw':_0x1ef8e2[_0xfedb('0x11')]?_0x1ef8e2[_0xfedb('0x11')][_0xfedb('0x12')]===undefined?!![]:![]:!![]})[_0xfedb('0x13')](function(_0x1daee7){logger[_0xfedb('0x7')](_0xfedb('0x14'),_0x1ef8e2);logger[_0xfedb('0xa')](_0xfedb('0x14'),_0x1ef8e2,JSON['stringify'](_0x1daee7));_0x4c561d(_0x1daee7);})[_0xfedb('0x15')](function(_0x3a7625){logger[_0xfedb('0xc')](_0xfedb('0x14'),_0x3a7625[_0xfedb('0xe')],_0x1ef8e2);_0x47e09e(_0x5f8ad['error'](0x1f4,_0x3a7625[_0xfedb('0xe')]));});});};exports['UpdateVoiceDialReport']=function(_0x1df85b){var _0x4c371f=this;return new Promise(function(_0x59e055,_0x59fa69){return db[_0xfedb('0x10')][_0xfedb('0x16')](_0x1df85b['body'],{'raw':_0x1df85b['options']?_0x1df85b[_0xfedb('0x11')][_0xfedb('0x12')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1df85b[_0xfedb('0x11')]?_0x1df85b[_0xfedb('0x11')]['where']||null:null,'attributes':_0x1df85b[_0xfedb('0x11')]?_0x1df85b[_0xfedb('0x11')]['attributes']||null:null,'limit':_0x1df85b['options']?_0x1df85b[_0xfedb('0x11')][_0xfedb('0x17')]||null:null})[_0xfedb('0x13')](function(_0x501dea){logger[_0xfedb('0x7')](_0xfedb('0x18'),_0x1df85b);logger['debug'](_0xfedb('0x18'),_0x1df85b,JSON[_0xfedb('0xb')](_0x501dea));_0x59e055(_0x501dea);})[_0xfedb('0x15')](function(_0x42beee){logger[_0xfedb('0xc')]('UpdateVoiceDialReport',_0x42beee[_0xfedb('0xe')],_0x1df85b);_0x59fa69(_0x4c371f['error'](0x1f4,_0x42beee[_0xfedb('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index fba864c..f7e532d 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 _0xf52e=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','/:id/applications','addApplications','put','update','destroy','exports','multer'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0xf52e,0xf1));var _0xef52=function(_0x218e4e,_0x3614f3){_0x218e4e=_0x218e4e-0x0;var _0xdc0710=_0xf52e[_0x218e4e];return _0xdc0710;};'use strict';var multer=require(_0xef52('0x0'));var util=require(_0xef52('0x1'));var path=require(_0xef52('0x2'));var timeout=require(_0xef52('0x3'));var express=require(_0xef52('0x4'));var router=express[_0xef52('0x5')]();var fs_extra=require(_0xef52('0x6'));var auth=require(_0xef52('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xef52('0x8'));var controller=require(_0xef52('0x9'));router[_0xef52('0xa')]('/',auth[_0xef52('0xb')](),controller[_0xef52('0xc')]);router['get'](_0xef52('0xd'),auth[_0xef52('0xb')](),controller[_0xef52('0xe')]);router[_0xef52('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xef52('0x10'),auth['isAuthenticated'](),controller[_0xef52('0x11')]);router[_0xef52('0x12')](_0xef52('0xd'),auth[_0xef52('0xb')](),controller[_0xef52('0x13')]);router['delete'](_0xef52('0xd'),auth[_0xef52('0xb')](),controller[_0xef52('0x14')]);module[_0xef52('0x15')]=router; \ No newline at end of file +var _0x60de=['addApplications','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','get','/:id','show','post','create','/:id/applications'];(function(_0x29d335,_0x4de1d9){var _0x409c22=function(_0x54f7d7){while(--_0x54f7d7){_0x29d335['push'](_0x29d335['shift']());}};_0x409c22(++_0x4de1d9);}(_0x60de,0x103));var _0xe60d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x60de[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xe60d('0x0'));var util=require(_0xe60d('0x1'));var path=require(_0xe60d('0x2'));var timeout=require(_0xe60d('0x3'));var express=require(_0xe60d('0x4'));var router=express['Router']();var fs_extra=require(_0xe60d('0x5'));var auth=require(_0xe60d('0x6'));var interaction=require(_0xe60d('0x7'));var config=require(_0xe60d('0x8'));var controller=require(_0xe60d('0x9'));router['get']('/',auth[_0xe60d('0xa')](),controller['index']);router[_0xe60d('0xb')](_0xe60d('0xc'),auth[_0xe60d('0xa')](),controller[_0xe60d('0xd')]);router[_0xe60d('0xe')]('/',auth[_0xe60d('0xa')](),controller[_0xe60d('0xf')]);router[_0xe60d('0xe')](_0xe60d('0x10'),auth[_0xe60d('0xa')](),controller[_0xe60d('0x11')]);router[_0xe60d('0x12')]('/:id',auth[_0xe60d('0xa')](),controller[_0xe60d('0x13')]);router[_0xe60d('0x14')](_0xe60d('0xc'),auth[_0xe60d('0xa')](),controller[_0xe60d('0x15')]);module[_0xe60d('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 1ade3d5..f1ae21b 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 _0x1a94=['inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM'];(function(_0x61159c,_0x48e7b3){var _0x518387=function(_0x39e4ec){while(--_0x39e4ec){_0x61159c['push'](_0x61159c['shift']());}};_0x518387(++_0x48e7b3);}(_0x1a94,0x1c6));var _0x41a9=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x1a94[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0x41a9('0x0'));module[_0x41a9('0x1')]={'context':{'type':Sequelize[_0x41a9('0x2')],'allowNull':![],'unique':_0x41a9('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x41a9('0x2')],'allowNull':![],'unique':_0x41a9('0x3')},'priority':{'type':Sequelize[_0x41a9('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x41a9('0x2')],'allowNull':![],'defaultValue':_0x41a9('0x4')},'appdata':{'type':Sequelize[_0x41a9('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x41a9('0x5')](_0x41a9('0x6'),_0x41a9('0x7'),_0x41a9('0x8'),_0x41a9('0x9'),_0x41a9('0xa'),_0x41a9('0xb'),_0x41a9('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0x41a9('0x2')]},'interval':{'type':Sequelize[_0x41a9('0x2')],'allowNull':![],'defaultValue':_0x41a9('0xd')},'IntervalId':{'type':Sequelize[_0x41a9('0xe')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x41a9('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x41a9('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x41a9('0xf')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x41a9('0xe')]},'recordingFormat':{'type':Sequelize[_0x41a9('0x2')],'defaultValue':_0x41a9('0x10')},'answer':{'type':Sequelize[_0x41a9('0xf')],'defaultValue':!![]},'name':{'type':Sequelize[_0x41a9('0x11')],'get':function(_0x5c45d6){return this[_0x41a9('0x12')](_0x41a9('0x13'));}},'alias':{'type':Sequelize[_0x41a9('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x54dc=['exports','compositeIndex','STRING','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','BOOLEAN','INTEGER','wav','VIRTUAL','sequelize'];(function(_0x551d55,_0x16862f){var _0x358b2d=function(_0x523e3a){while(--_0x523e3a){_0x551d55['push'](_0x551d55['shift']());}};_0x358b2d(++_0x16862f);}(_0x54dc,0xa1));var _0xc54d=function(_0x3d4ef1,_0x5a957c){_0x3d4ef1=_0x3d4ef1-0x0;var _0x409423=_0x54dc[_0x3d4ef1];return _0x409423;};'use strict';var Sequelize=require(_0xc54d('0x0'));module[_0xc54d('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc54d('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xc54d('0x3')],'allowNull':![],'unique':_0xc54d('0x2')},'priority':{'type':Sequelize[_0xc54d('0x3')],'allowNull':![],'defaultValue':'1','unique':_0xc54d('0x2')},'tag':{'type':Sequelize[_0xc54d('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xc54d('0x3')],'allowNull':![],'defaultValue':_0xc54d('0x4')},'appdata':{'type':Sequelize[_0xc54d('0x3')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xc54d('0x5')](_0xc54d('0x6'),_0xc54d('0x7'),_0xc54d('0x8'),_0xc54d('0x9'),_0xc54d('0xa'),_0xc54d('0xb'),_0xc54d('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0xc54d('0x3')]},'interval':{'type':Sequelize[_0xc54d('0x3')],'allowNull':![],'defaultValue':_0xc54d('0xd')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xc54d('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xc54d('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0xc54d('0x3')],'allowNull':!![]},'record':{'type':Sequelize[_0xc54d('0xe')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xc54d('0xf')]},'recordingFormat':{'type':Sequelize[_0xc54d('0x3')],'defaultValue':_0xc54d('0x10')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0xc54d('0x11')],'get':function(_0x23b7f5){return this['getDataValue']('exten');}},'alias':{'type':Sequelize[_0xc54d('0x3')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index f3c0d94..ac6b9eb 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 _0xa25b=['LOG\x20~\x20.then\x20~\x20routing','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','status','end','offset','undefined','count','limit','Content-Range','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','find','type','name','destroy','sendStatus','error','stack','send','index','rawAttributes','fieldName','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','options','VoiceExtension','includeAll','findAll','show','include','catch','params','create','startsWith','body','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','update','context','description','recordingFormat','cutdigits','alias','addApplications','findOne','sequelize','VoiceExtensionId','isApp','createRouting','log'];(function(_0x73d5cd,_0x45e8dd){var _0x396e4f=function(_0x3a3a76){while(--_0x3a3a76){_0x73d5cd['push'](_0x73d5cd['shift']());}};_0x396e4f(++_0x45e8dd);}(_0xa25b,0x170));var _0xba25=function(_0x949b08,_0x49faa1){_0x949b08=_0x949b08-0x0;var _0x4d276d=_0xa25b[_0x949b08];return _0x4d276d;};'use strict';var _=require(_0xba25('0x0'));var Redis=require(_0xba25('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xba25('0x2'))('api');var config=require(_0xba25('0x3'));var db=require(_0xba25('0x4'))['db'];config[_0xba25('0x5')]=_[_0xba25('0x6')](config['redis'],{'host':_0xba25('0x7'),'port':0x18eb});var socket=require(_0xba25('0x8'))(new Redis(config['redis']));require(_0xba25('0x9'))[_0xba25('0xa')](socket);function respondWithStatusCode(_0x10e250,_0x2a1ff5){_0x2a1ff5=_0x2a1ff5||0xcc;return function(_0x5b6d01){if(_0x5b6d01){return _0x10e250['sendStatus'](_0x2a1ff5);}return _0x10e250[_0xba25('0xb')](_0x2a1ff5)[_0xba25('0xc')]();};}function respondWithResult(_0x4a9b10,_0x584787){_0x584787=_0x584787||0xc8;return function(_0x2a40a4){if(_0x2a40a4){return _0x4a9b10[_0xba25('0xb')](_0x584787)['json'](_0x2a40a4);}};}function respondWithFilteredResult(_0xe6b440,_0x338050){return function(_0x2036fd){if(_0x2036fd){var _0x4482cc=typeof _0x338050[_0xba25('0xd')]===_0xba25('0xe')&&typeof _0x338050['limit']===_0xba25('0xe');var _0x1b24e2=_0x2036fd[_0xba25('0xf')];var _0x3d242f=_0x4482cc?0x0:_0x338050[_0xba25('0xd')];var _0x410e8b=_0x4482cc?_0x2036fd[_0xba25('0xf')]:_0x338050[_0xba25('0xd')]+_0x338050[_0xba25('0x10')];var _0x11e227;if(_0x410e8b>=_0x1b24e2){_0x410e8b=_0x1b24e2;_0x11e227=0xc8;}else{_0x11e227=0xce;}_0xe6b440[_0xba25('0xb')](_0x11e227);return _0xe6b440['set'](_0xba25('0x11'),_0x3d242f+'-'+_0x410e8b+'/'+_0x1b24e2)['json'](_0x2036fd);}return null;};}function removeEntity(_0x1b0a2e){return function(_0x5d0bc9){if(_0x5d0bc9){return _0x5d0bc9['destroy']()[_0xba25('0x12')](function(){var _0x4aca2f=_0x5d0bc9[_0xba25('0x13')]({'plain':!![]});var _0x12fb86=[{'name':_0xba25('0x14'),'value':_0xba25('0x15'),'ignore':![]},{'name':_0xba25('0x16'),'value':_0xba25('0x17'),'ignore':![]},{'name':_0xba25('0x18'),'value':_0xba25('0x19'),'ignore':![]}];var _0x13503b=_(_0x12fb86)[_0xba25('0x1a')](_0xba25('0x1b'))[_0xba25('0x1c')](_0xba25('0x1d'))[_0xba25('0x1d')]();if(_['includes'](_0x13503b,_0x4aca2f['type'])){return;}var _0x2df31c=_[_0xba25('0x1e')](_0x12fb86,['value',_0x4aca2f[_0xba25('0x1f')]])[_0xba25('0x20')];return db['UserProfileResource'][_0xba25('0x21')]({'where':{'type':_0x2df31c,'resourceId':_0x4aca2f['id']}})[_0xba25('0x12')](function(){return _0x5d0bc9;});})[_0xba25('0x12')](function(){_0x1b0a2e[_0xba25('0xb')](0xcc)[_0xba25('0xc')]();});}};}function handleEntityNotFound(_0x30e4a3){return function(_0x26598b){if(!_0x26598b){_0x30e4a3[_0xba25('0x22')](0x194);}return _0x26598b;};}function handleError(_0x40e1ee,_0x54814f){_0x54814f=_0x54814f||0x1f4;return function(_0x279669){logger[_0xba25('0x23')](_0x279669[_0xba25('0x24')]);if(_0x279669[_0xba25('0x20')]){delete _0x279669[_0xba25('0x20')];}_0x40e1ee[_0xba25('0xb')](_0x54814f)[_0xba25('0x25')](_0x279669);};}exports[_0xba25('0x26')]=function(_0x240e71,_0x244c26){var _0x59043f={},_0x337cc3={},_0x48b34b={'count':0x0,'rows':[]};var _0x1f2614=_[_0xba25('0x1c')](db['VoiceExtension'][_0xba25('0x27')],function(_0x41737e){return{'name':_0x41737e[_0xba25('0x28')],'type':_0x41737e[_0xba25('0x1f')][_0xba25('0x29')]};});_0x337cc3['model']=_[_0xba25('0x1c')](_0x1f2614,'name');_0x337cc3[_0xba25('0x2a')]=_[_0xba25('0x2b')](_0x240e71['query']);_0x337cc3['filters']=_['intersection'](_0x337cc3[_0xba25('0x2c')],_0x337cc3['query']);_0x59043f[_0xba25('0x2d')]=_[_0xba25('0x2e')](_0x337cc3[_0xba25('0x2c')],qs[_0xba25('0x2f')](_0x240e71['query']['fields']));_0x59043f[_0xba25('0x2d')]=_0x59043f[_0xba25('0x2d')][_0xba25('0x30')]?_0x59043f[_0xba25('0x2d')]:_0x337cc3[_0xba25('0x2c')];if(!_0x240e71[_0xba25('0x2a')][_0xba25('0x31')](_0xba25('0x32'))){_0x59043f[_0xba25('0x10')]=qs[_0xba25('0x10')](_0x240e71[_0xba25('0x2a')][_0xba25('0x10')]);_0x59043f[_0xba25('0xd')]=qs[_0xba25('0xd')](_0x240e71[_0xba25('0x2a')]['offset']);}_0x59043f[_0xba25('0x33')]=qs[_0xba25('0x34')](_0x240e71[_0xba25('0x2a')][_0xba25('0x34')]);_0x59043f[_0xba25('0x35')]=qs[_0xba25('0x36')](_['pick'](_0x240e71[_0xba25('0x2a')],_0x337cc3[_0xba25('0x36')]),_0x1f2614);if(_0x240e71[_0xba25('0x2a')][_0xba25('0x1a')]){_0x59043f['where']=_[_0xba25('0x37')](_0x59043f['where'],{'$or':_['map'](_0x1f2614,function(_0x30748b){if(_0x30748b[_0xba25('0x1f')]!==_0xba25('0x38')){var _0x735c14={};_0x735c14[_0x30748b['name']]={'$like':'%'+_0x240e71['query'][_0xba25('0x1a')]+'%'};return _0x735c14;}})});}_0x59043f=_[_0xba25('0x37')]({},_0x59043f,_0x240e71[_0xba25('0x39')]);var _0x2c5872={'where':_0x59043f[_0xba25('0x35')]};return db[_0xba25('0x3a')][_0xba25('0xf')](_0x2c5872)['then'](function(_0x59ae30){_0x48b34b[_0xba25('0xf')]=_0x59ae30;if(_0x240e71[_0xba25('0x2a')][_0xba25('0x3b')]){_0x59043f['include']=[{'all':!![]}];}return db[_0xba25('0x3a')][_0xba25('0x3c')](_0x59043f);})[_0xba25('0x12')](function(_0x7d724d){_0x48b34b['rows']=_0x7d724d;return _0x48b34b;})['then'](respondWithFilteredResult(_0x244c26,_0x59043f))['catch'](handleError(_0x244c26,null));};exports[_0xba25('0x3d')]=function(_0x4804d6,_0x32d2ba){var _0x5d4dd0={'raw':![],'where':{'id':_0x4804d6['params']['id']}},_0x30d751={};_0x30d751['model']=_[_0xba25('0x2b')](db[_0xba25('0x3a')][_0xba25('0x27')]);_0x30d751[_0xba25('0x2a')]=_['keys'](_0x4804d6[_0xba25('0x2a')]);_0x30d751[_0xba25('0x36')]=_[_0xba25('0x2e')](_0x30d751[_0xba25('0x2c')],_0x30d751[_0xba25('0x2a')]);_0x5d4dd0[_0xba25('0x2d')]=_[_0xba25('0x2e')](_0x30d751[_0xba25('0x2c')],qs[_0xba25('0x2f')](_0x4804d6[_0xba25('0x2a')][_0xba25('0x2f')]));_0x5d4dd0[_0xba25('0x2d')]=_0x5d4dd0[_0xba25('0x2d')][_0xba25('0x30')]?_0x5d4dd0[_0xba25('0x2d')]:_0x30d751['model'];if(_0x4804d6[_0xba25('0x2a')]['includeAll']){_0x5d4dd0[_0xba25('0x3e')]=[{'all':!![]}];}_0x5d4dd0=_[_0xba25('0x37')]({},_0x5d4dd0,_0x4804d6[_0xba25('0x39')]);return db[_0xba25('0x3a')][_0xba25('0x1e')](_0x5d4dd0)[_0xba25('0x12')](handleEntityNotFound(_0x32d2ba,null))['then'](respondWithResult(_0x32d2ba,null))[_0xba25('0x3f')](handleError(_0x32d2ba,null));};exports[_0xba25('0x21')]=function(_0xd97fb8,_0x236d0c){return db['VoiceExtension'][_0xba25('0x1e')]({'where':{'id':_0xd97fb8[_0xba25('0x40')]['id']}})[_0xba25('0x12')](handleEntityNotFound(_0x236d0c,null))[_0xba25('0x12')](removeEntity(_0x236d0c,null))['catch'](handleError(_0x236d0c,null));};exports[_0xba25('0x41')]=function(_0x3193b3,_0x601c1e){if(_0x3193b3['body'][_0xba25('0x1f')]==='outbound'&&!_[_0xba25('0x42')](_0x3193b3[_0xba25('0x43')][_0xba25('0x44')],'_')){_0x3193b3['body'][_0xba25('0x44')]='_'[_0xba25('0x45')](_0x3193b3[_0xba25('0x43')][_0xba25('0x44')]);}return db['VoiceExtension']['create'](_0x3193b3[_0xba25('0x43')],{'raw':![]})['then'](function(_0x3da49d){var _0x5600fe=_0x3193b3['user'][_0xba25('0x13')]({'plain':!![]});if(!_0x5600fe)throw new Error(_0xba25('0x46'));if(_0x5600fe[_0xba25('0x47')]==='user'){var _0x2e5aa2=_0x3da49d[_0xba25('0x13')]({'plain':!![]});var _0x2212ab=[{'name':_0xba25('0x14'),'value':_0xba25('0x15')},{'name':_0xba25('0x16'),'value':_0xba25('0x17')},{'name':'InternalRoutes','value':_0xba25('0x19')}];var _0x35659c=_[_0xba25('0x1e')](_0x2212ab,[_0xba25('0x1d'),_0x2e5aa2[_0xba25('0x1f')]])[_0xba25('0x20')];return db['UserProfileSection'][_0xba25('0x1e')]({'where':{'name':_0x35659c,'userProfileId':_0x5600fe[_0xba25('0x48')]},'raw':!![]})[_0xba25('0x12')](function(_0x10c1ff){if(_0x10c1ff&&_0x10c1ff['autoAssociation']===0x0){return db[_0xba25('0x49')][_0xba25('0x41')]({'name':_0x2e5aa2[_0xba25('0x20')],'resourceId':_0x2e5aa2['id'],'type':_0x10c1ff[_0xba25('0x20')],'sectionId':_0x10c1ff['id']},{})[_0xba25('0x12')](function(){return _0x3da49d;});}else{return _0x3da49d;}})[_0xba25('0x3f')](function(_0x165067){logger[_0xba25('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x165067);throw _0x165067;});}return _0x3da49d;})['then'](respondWithResult(_0x601c1e,0xc9))[_0xba25('0x3f')](handleError(_0x601c1e,null));};exports['update']=function(_0x5028f1,_0x5eef4b){if(_0x5028f1[_0xba25('0x43')]['id']){delete _0x5028f1[_0xba25('0x43')]['id'];}return db[_0xba25('0x3a')][_0xba25('0x1e')]({'where':{'id':_0x5028f1[_0xba25('0x40')]['id']}})[_0xba25('0x12')](handleEntityNotFound(_0x5eef4b,null))[_0xba25('0x12')](function(_0x3ad188){if(_0x3ad188){return db['VoiceExtension'][_0xba25('0x4a')](_['pick'](_0x5028f1['body'],[_0xba25('0x44'),_0xba25('0x4b'),_0xba25('0x4c'),_0xba25('0x4d'),_0xba25('0x4e'),'mandatoryDisposition',_0xba25('0x4f')]),{'where':{'context':_0x3ad188[_0xba25('0x4b')],'exten':_0x3ad188[_0xba25('0x44')]},'individualHooks':!![]})[_0xba25('0x12')](function(_0x539712){return _0x539712;});}return null;})['then'](respondWithStatusCode(_0x5eef4b,null))['catch'](handleError(_0x5eef4b,null));};exports[_0xba25('0x50')]=function(_0xe4980f,_0x43f140){return db[_0xba25('0x3a')][_0xba25('0x51')]({'where':{'id':_0xe4980f[_0xba25('0x40')]['id']}})[_0xba25('0x12')](function(_0x18b442){if(_0x18b442){return db[_0xba25('0x52')]['transaction'](function(_0xfb0c2){return db[_0xba25('0x3a')][_0xba25('0x21')]({'where':{'VoiceExtensionId':_0xe4980f[_0xba25('0x40')]['id']},'transaction':_0xfb0c2})[_0xba25('0x12')](function(){var _0x556ab9=_[_0xba25('0x1c')](_0xe4980f[_0xba25('0x43')],function(_0x40abc4){_0x40abc4[_0xba25('0x53')]=_0xe4980f[_0xba25('0x40')]['id'];_0x40abc4[_0xba25('0x54')]=!![];return _0x40abc4;});return _0x18b442[_0xba25('0x55')](_0x556ab9);})[_0xba25('0x12')](function(_0xd3e0e2){console[_0xba25('0x56')](_0xba25('0x57'),_0xd3e0e2);return db[_0xba25('0x3a')][_0xba25('0x58')](_0xd3e0e2,{'transaction':_0xfb0c2});});})[_0xba25('0x12')](function(){return db['VoiceExtension'][_0xba25('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0xe4980f[_0xba25('0x40')]['id']},'order':_0xba25('0x5a')});});}})[_0xba25('0x12')](respondWithResult(_0x43f140,null))[_0xba25('0x3f')](handleError(_0x43f140,null));}; \ No newline at end of file +var _0x3f73=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','pick','exten','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','findOne','transaction','isApp','createRouting','LOG\x20~\x20.then\x20~\x20routing','bulkCreate','findAndCountAll','lodash','ioredis','api','../../mysqldb','defaults','redis','localhost','./voiceExtension.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','internal','filter','ignore','map','value','type','find','name','UserProfileResource','destroy','error','stack','VoiceExtension','rawAttributes','fieldName','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','includeAll','findAll','rows','filters','include','catch','create','body','startsWith','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','InternalRoutes','UserProfileSection','userProfileId','autoAssociation'];(function(_0x8e2d4d,_0x310930){var _0x5e3047=function(_0x4665e4){while(--_0x4665e4){_0x8e2d4d['push'](_0x8e2d4d['shift']());}};_0x5e3047(++_0x310930);}(_0x3f73,0xc3));var _0x33f7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3f73[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x33f7('0x0'));var Redis=require(_0x33f7('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x33f7('0x2'));var config=require('../../config/environment');var db=require(_0x33f7('0x3'))['db'];config['redis']=_[_0x33f7('0x4')](config[_0x33f7('0x5')],{'host':_0x33f7('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x33f7('0x5')]));require(_0x33f7('0x7'))[_0x33f7('0x8')](socket);function respondWithStatusCode(_0x4b3ea1,_0x9ce9ce){_0x9ce9ce=_0x9ce9ce||0xcc;return function(_0x52855b){if(_0x52855b){return _0x4b3ea1[_0x33f7('0x9')](_0x9ce9ce);}return _0x4b3ea1['status'](_0x9ce9ce)[_0x33f7('0xa')]();};}function respondWithResult(_0x37cb20,_0x28ab8a){_0x28ab8a=_0x28ab8a||0xc8;return function(_0x56b335){if(_0x56b335){return _0x37cb20[_0x33f7('0xb')](_0x28ab8a)[_0x33f7('0xc')](_0x56b335);}};}function respondWithFilteredResult(_0x105832,_0x4b13c2){return function(_0x50e709){if(_0x50e709){var _0x34331b=typeof _0x4b13c2[_0x33f7('0xd')]===_0x33f7('0xe')&&typeof _0x4b13c2[_0x33f7('0xf')]===_0x33f7('0xe');var _0x4a6d31=_0x50e709['count'];var _0x1d6b6f=_0x34331b?0x0:_0x4b13c2[_0x33f7('0xd')];var _0x5d4f0f=_0x34331b?_0x50e709[_0x33f7('0x10')]:_0x4b13c2[_0x33f7('0xd')]+_0x4b13c2[_0x33f7('0xf')];var _0xd0065c;if(_0x5d4f0f>=_0x4a6d31){_0x5d4f0f=_0x4a6d31;_0xd0065c=0xc8;}else{_0xd0065c=0xce;}_0x105832[_0x33f7('0xb')](_0xd0065c);return _0x105832['set'](_0x33f7('0x11'),_0x1d6b6f+'-'+_0x5d4f0f+'/'+_0x4a6d31)['json'](_0x50e709);}return null;};}function removeEntity(_0x16f45e){return function(_0xa49bfb){if(_0xa49bfb){return _0xa49bfb['destroy']()[_0x33f7('0x12')](function(){var _0xcafe45=_0xa49bfb[_0x33f7('0x13')]({'plain':!![]});var _0x51173f=[{'name':_0x33f7('0x14'),'value':_0x33f7('0x15'),'ignore':![]},{'name':_0x33f7('0x16'),'value':_0x33f7('0x17'),'ignore':![]},{'name':'InternalRoutes','value':_0x33f7('0x18'),'ignore':![]}];var _0x2c6451=_(_0x51173f)[_0x33f7('0x19')](_0x33f7('0x1a'))[_0x33f7('0x1b')](_0x33f7('0x1c'))['value']();if(_['includes'](_0x2c6451,_0xcafe45[_0x33f7('0x1d')])){return;}var _0x7a16b1=_[_0x33f7('0x1e')](_0x51173f,[_0x33f7('0x1c'),_0xcafe45[_0x33f7('0x1d')]])[_0x33f7('0x1f')];return db[_0x33f7('0x20')][_0x33f7('0x21')]({'where':{'type':_0x7a16b1,'resourceId':_0xcafe45['id']}})['then'](function(){return _0xa49bfb;});})[_0x33f7('0x12')](function(){_0x16f45e[_0x33f7('0xb')](0xcc)[_0x33f7('0xa')]();});}};}function handleEntityNotFound(_0x598db5){return function(_0x4d6443){if(!_0x4d6443){_0x598db5[_0x33f7('0x9')](0x194);}return _0x4d6443;};}function handleError(_0xf0d1ea,_0x5310f9){_0x5310f9=_0x5310f9||0x1f4;return function(_0x19744c){logger[_0x33f7('0x22')](_0x19744c[_0x33f7('0x23')]);if(_0x19744c[_0x33f7('0x1f')]){delete _0x19744c[_0x33f7('0x1f')];}_0xf0d1ea[_0x33f7('0xb')](_0x5310f9)['send'](_0x19744c);};}exports['index']=function(_0x517cd7,_0x35d9c7){var _0x18c527={},_0xe3af3c={},_0x144f77={'count':0x0,'rows':[]};var _0x3106f9=_[_0x33f7('0x1b')](db[_0x33f7('0x24')][_0x33f7('0x25')],function(_0x596f78){return{'name':_0x596f78[_0x33f7('0x26')],'type':_0x596f78[_0x33f7('0x1d')]['key']};});_0xe3af3c[_0x33f7('0x27')]=_[_0x33f7('0x1b')](_0x3106f9,_0x33f7('0x1f'));_0xe3af3c['query']=_[_0x33f7('0x28')](_0x517cd7[_0x33f7('0x29')]);_0xe3af3c['filters']=_['intersection'](_0xe3af3c[_0x33f7('0x27')],_0xe3af3c[_0x33f7('0x29')]);_0x18c527[_0x33f7('0x2a')]=_[_0x33f7('0x2b')](_0xe3af3c[_0x33f7('0x27')],qs[_0x33f7('0x2c')](_0x517cd7['query'][_0x33f7('0x2c')]));_0x18c527[_0x33f7('0x2a')]=_0x18c527[_0x33f7('0x2a')]['length']?_0x18c527['attributes']:_0xe3af3c[_0x33f7('0x27')];if(!_0x517cd7[_0x33f7('0x29')][_0x33f7('0x2d')](_0x33f7('0x2e'))){_0x18c527[_0x33f7('0xf')]=qs[_0x33f7('0xf')](_0x517cd7[_0x33f7('0x29')][_0x33f7('0xf')]);_0x18c527[_0x33f7('0xd')]=qs[_0x33f7('0xd')](_0x517cd7[_0x33f7('0x29')]['offset']);}_0x18c527[_0x33f7('0x2f')]=qs[_0x33f7('0x30')](_0x517cd7[_0x33f7('0x29')][_0x33f7('0x30')]);_0x18c527['where']=qs['filters'](_['pick'](_0x517cd7[_0x33f7('0x29')],_0xe3af3c['filters']),_0x3106f9);if(_0x517cd7[_0x33f7('0x29')][_0x33f7('0x19')]){_0x18c527[_0x33f7('0x31')]=_['merge'](_0x18c527[_0x33f7('0x31')],{'$or':_[_0x33f7('0x1b')](_0x3106f9,function(_0x4fbf10){if(_0x4fbf10[_0x33f7('0x1d')]!==_0x33f7('0x32')){var _0x8f0cbd={};_0x8f0cbd[_0x4fbf10['name']]={'$like':'%'+_0x517cd7[_0x33f7('0x29')][_0x33f7('0x19')]+'%'};return _0x8f0cbd;}})});}_0x18c527=_[_0x33f7('0x33')]({},_0x18c527,_0x517cd7['options']);var _0x3d667e={'where':_0x18c527[_0x33f7('0x31')]};return db[_0x33f7('0x24')][_0x33f7('0x10')](_0x3d667e)['then'](function(_0x2c6c6b){_0x144f77[_0x33f7('0x10')]=_0x2c6c6b;if(_0x517cd7[_0x33f7('0x29')][_0x33f7('0x34')]){_0x18c527['include']=[{'all':!![]}];}return db[_0x33f7('0x24')][_0x33f7('0x35')](_0x18c527);})[_0x33f7('0x12')](function(_0x50b0a6){_0x144f77[_0x33f7('0x36')]=_0x50b0a6;return _0x144f77;})[_0x33f7('0x12')](respondWithFilteredResult(_0x35d9c7,_0x18c527))['catch'](handleError(_0x35d9c7,null));};exports['show']=function(_0x5732aa,_0x1fc0f0){var _0x4feac8={'raw':![],'where':{'id':_0x5732aa['params']['id']}},_0x2cd862={};_0x2cd862[_0x33f7('0x27')]=_[_0x33f7('0x28')](db[_0x33f7('0x24')]['rawAttributes']);_0x2cd862['query']=_['keys'](_0x5732aa[_0x33f7('0x29')]);_0x2cd862[_0x33f7('0x37')]=_[_0x33f7('0x2b')](_0x2cd862[_0x33f7('0x27')],_0x2cd862[_0x33f7('0x29')]);_0x4feac8['attributes']=_['intersection'](_0x2cd862['model'],qs[_0x33f7('0x2c')](_0x5732aa[_0x33f7('0x29')][_0x33f7('0x2c')]));_0x4feac8[_0x33f7('0x2a')]=_0x4feac8[_0x33f7('0x2a')]['length']?_0x4feac8[_0x33f7('0x2a')]:_0x2cd862[_0x33f7('0x27')];if(_0x5732aa[_0x33f7('0x29')][_0x33f7('0x34')]){_0x4feac8[_0x33f7('0x38')]=[{'all':!![]}];}_0x4feac8=_[_0x33f7('0x33')]({},_0x4feac8,_0x5732aa['options']);return db[_0x33f7('0x24')][_0x33f7('0x1e')](_0x4feac8)[_0x33f7('0x12')](handleEntityNotFound(_0x1fc0f0,null))['then'](respondWithResult(_0x1fc0f0,null))['catch'](handleError(_0x1fc0f0,null));};exports[_0x33f7('0x21')]=function(_0x3a4c41,_0x1d3b71){return db[_0x33f7('0x24')][_0x33f7('0x1e')]({'where':{'id':_0x3a4c41['params']['id']}})[_0x33f7('0x12')](handleEntityNotFound(_0x1d3b71,null))[_0x33f7('0x12')](removeEntity(_0x1d3b71,null))[_0x33f7('0x39')](handleError(_0x1d3b71,null));};exports[_0x33f7('0x3a')]=function(_0x104277,_0x562898){if(_0x104277[_0x33f7('0x3b')]['type']==='outbound'&&!_[_0x33f7('0x3c')](_0x104277[_0x33f7('0x3b')]['exten'],'_')){_0x104277[_0x33f7('0x3b')]['exten']='_'[_0x33f7('0x3d')](_0x104277[_0x33f7('0x3b')]['exten']);}return db[_0x33f7('0x24')]['create'](_0x104277[_0x33f7('0x3b')],{'raw':![]})[_0x33f7('0x12')](function(_0xa6fd15){var _0x522c40=_0x104277['user'][_0x33f7('0x13')]({'plain':!![]});if(!_0x522c40)throw new Error(_0x33f7('0x3e'));if(_0x522c40[_0x33f7('0x3f')]===_0x33f7('0x40')){var _0x42c8b9=_0xa6fd15[_0x33f7('0x13')]({'plain':!![]});var _0x3ee659=[{'name':'InboundRoutes','value':_0x33f7('0x15')},{'name':_0x33f7('0x16'),'value':_0x33f7('0x17')},{'name':_0x33f7('0x41'),'value':'internal'}];var _0x4f6da9=_[_0x33f7('0x1e')](_0x3ee659,[_0x33f7('0x1c'),_0x42c8b9[_0x33f7('0x1d')]])['name'];return db[_0x33f7('0x42')][_0x33f7('0x1e')]({'where':{'name':_0x4f6da9,'userProfileId':_0x522c40[_0x33f7('0x43')]},'raw':!![]})[_0x33f7('0x12')](function(_0x3d6df5){if(_0x3d6df5&&_0x3d6df5[_0x33f7('0x44')]===0x0){return db[_0x33f7('0x20')][_0x33f7('0x3a')]({'name':_0x42c8b9['name'],'resourceId':_0x42c8b9['id'],'type':_0x3d6df5[_0x33f7('0x1f')],'sectionId':_0x3d6df5['id']},{})['then'](function(){return _0xa6fd15;});}else{return _0xa6fd15;}})[_0x33f7('0x39')](function(_0x1e5627){logger[_0x33f7('0x22')](_0x33f7('0x45'),_0x1e5627);throw _0x1e5627;});}return _0xa6fd15;})[_0x33f7('0x12')](respondWithResult(_0x562898,0xc9))[_0x33f7('0x39')](handleError(_0x562898,null));};exports[_0x33f7('0x46')]=function(_0x4894f8,_0xcc938b){if(_0x4894f8['body']['id']){delete _0x4894f8[_0x33f7('0x3b')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x4894f8[_0x33f7('0x47')]['id']}})[_0x33f7('0x12')](handleEntityNotFound(_0xcc938b,null))[_0x33f7('0x12')](function(_0x5677ae){if(_0x5677ae){return db['VoiceExtension']['update'](_[_0x33f7('0x48')](_0x4894f8[_0x33f7('0x3b')],[_0x33f7('0x49'),_0x33f7('0x4a'),_0x33f7('0x4b'),_0x33f7('0x4c'),_0x33f7('0x4d'),_0x33f7('0x4e'),_0x33f7('0x4f')]),{'where':{'context':_0x5677ae['context'],'exten':_0x5677ae[_0x33f7('0x49')]},'individualHooks':!![]})[_0x33f7('0x12')](function(_0x585d30){return _0x585d30;});}return null;})['then'](respondWithStatusCode(_0xcc938b,null))[_0x33f7('0x39')](handleError(_0xcc938b,null));};exports[_0x33f7('0x50')]=function(_0x5edc96,_0xf9fd2e){return db['VoiceExtension'][_0x33f7('0x51')]({'where':{'id':_0x5edc96[_0x33f7('0x47')]['id']}})[_0x33f7('0x12')](function(_0x38dbda){if(_0x38dbda){return db['sequelize'][_0x33f7('0x52')](function(_0x36d474){return db[_0x33f7('0x24')]['destroy']({'where':{'VoiceExtensionId':_0x5edc96[_0x33f7('0x47')]['id']},'transaction':_0x36d474})[_0x33f7('0x12')](function(){var _0x4757b5=_['map'](_0x5edc96[_0x33f7('0x3b')],function(_0x1c5bb5){_0x1c5bb5['VoiceExtensionId']=_0x5edc96[_0x33f7('0x47')]['id'];_0x1c5bb5[_0x33f7('0x53')]=!![];return _0x1c5bb5;});return _0x38dbda[_0x33f7('0x54')](_0x4757b5);})[_0x33f7('0x12')](function(_0x1f4adc){console['log'](_0x33f7('0x55'),_0x1f4adc);return db['VoiceExtension'][_0x33f7('0x56')](_0x1f4adc,{'transaction':_0x36d474});});})[_0x33f7('0x12')](function(){return db[_0x33f7('0x24')][_0x33f7('0x57')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5edc96[_0x33f7('0x47')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0x33f7('0x12')](respondWithResult(_0xf9fd2e,null))['catch'](handleError(_0xf9fd2e,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index c2162d8..3a7d255 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 _0x6844=['events','../../mysqldb','VoiceExtension','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x52d81c,_0x7a2c57){var _0x59f8c5=function(_0x527c21){while(--_0x527c21){_0x52d81c['push'](_0x52d81c['shift']());}};_0x59f8c5(++_0x7a2c57);}(_0x6844,0xfc));var _0x4684=function(_0x1b8efc,_0x1543a1){_0x1b8efc=_0x1b8efc-0x0;var _0x10496a=_0x6844[_0x1b8efc];return _0x10496a;};'use strict';var EventEmitter=require(_0x4684('0x0'));var VoiceExtension=require(_0x4684('0x1'))['db'][_0x4684('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x4684('0x3')](0x0);var events={'afterCreate':_0x4684('0x4'),'afterUpdate':'update','afterDestroy':_0x4684('0x5')};function emitEvent(_0x11c1c8){return function(_0x3f4c89,_0x54a6df,_0x453692){VoiceExtensionEvents[_0x4684('0x6')](_0x11c1c8+':'+_0x3f4c89['id'],_0x3f4c89);VoiceExtensionEvents[_0x4684('0x6')](_0x11c1c8,_0x3f4c89);_0x453692(null);};}for(var e in events){if(events[_0x4684('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x4684('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0xaa35=['setMaxListeners','save','emit','hasOwnProperty','../../mysqldb','VoiceExtension'];(function(_0x1894e7,_0x1253e6){var _0x5e857f=function(_0x1b47c3){while(--_0x1b47c3){_0x1894e7['push'](_0x1894e7['shift']());}};_0x5e857f(++_0x1253e6);}(_0xaa35,0x70));var _0x5aa3=function(_0x4bd67a,_0x4f9725){_0x4bd67a=_0x4bd67a-0x0;var _0x2be5fb=_0xaa35[_0x4bd67a];return _0x2be5fb;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x5aa3('0x0'))['db'][_0x5aa3('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x5aa3('0x2')](0x0);var events={'afterCreate':_0x5aa3('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4c9e53){return function(_0xec613e,_0x1ef433,_0x246803){VoiceExtensionEvents[_0x5aa3('0x4')](_0x4c9e53+':'+_0xec613e['id'],_0xec613e);VoiceExtensionEvents[_0x5aa3('0x4')](_0x4c9e53,_0xec613e);_0x246803(null);};}for(var e in events){if(events[_0x5aa3('0x5')](e)){var event=events[e];VoiceExtension['hook'](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 cda2abf..889ab01 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 _0x22d3=['tag','toLowerCase','CDR(tag)=','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','last','priority','concat','define','VoiceExtension','./voiceExtension.attributes','models','type','Set','context','exten','NoOp','alias','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','url','split','param','phone','prefix','${EXTEN}','SIP','join','options','none','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','IntervalId','then','intervals','filter','hasOwnProperty'];(function(_0x3a0e0b,_0x30bbbc){var _0x32272e=function(_0x1cd4f7){while(--_0x1cd4f7){_0x3a0e0b['push'](_0x3a0e0b['shift']());}};_0x32272e(++_0x30bbbc);}(_0x22d3,0x66));var _0x322d=function(_0x40ddc0,_0x41c082){_0x40ddc0=_0x40ddc0-0x0;var _0x1aebf1=_0x22d3[_0x40ddc0];return _0x1aebf1;};'use strict';var _=require('lodash');var attributes=require(_0x322d('0x0'));module['exports']=function(_0x523cdd){var _0x37b7e8=_0x523cdd[_0x322d('0x1')];function _0x1800d9(_0x968e70){var _0x3b88aa=0x2;var _0x59f26f=[{'type':_0x968e70[_0x322d('0x2')],'app':_0x322d('0x3'),'appdata':'CDR(type)='+_0x968e70[_0x322d('0x2')],'context':_0x968e70[_0x322d('0x4')],'exten':_0x968e70[_0x322d('0x5')],'priority':_0x3b88aa++,'VoiceExtensionId':_0x968e70['id']},{'type':_0x968e70[_0x322d('0x2')],'app':_0x968e70['alias']?_0x322d('0x3'):_0x322d('0x6'),'appdata':_0x968e70[_0x322d('0x7')]?_0x322d('0x8')+_0x968e70[_0x322d('0x7')]:_0x322d('0x9'),'context':_0x968e70[_0x322d('0x4')],'exten':_0x968e70[_0x322d('0x5')],'priority':_0x3b88aa++,'VoiceExtensionId':_0x968e70['id']}];if(_0x968e70[_0x322d('0x2')]===_0x322d('0xa')){_0x59f26f['push']({'type':'inbound','app':_0x322d('0x3'),'appdata':'CDR(routeid)='+_0x968e70['id'],'context':_0x968e70[_0x322d('0x4')],'exten':_0x968e70['exten'],'priority':_0x3b88aa++,'VoiceExtensionId':_0x968e70['id']});}_0x59f26f[_0x322d('0xb')]({'type':_0x968e70[_0x322d('0x2')],'app':_0x322d('0x3'),'appdata':_0x322d('0xc'),'context':_0x968e70[_0x322d('0x4')],'exten':_0x968e70['exten'],'priority':_0x3b88aa++,'VoiceExtensionId':_0x968e70['id']},{'type':_0x968e70[_0x322d('0x2')],'app':'Set','appdata':_0x322d('0xd'),'context':_0x968e70['context'],'exten':_0x968e70['exten'],'priority':_0x3b88aa++,'VoiceExtensionId':_0x968e70['id']},{'type':_0x968e70[_0x322d('0x2')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x968e70[_0x322d('0x4')],'exten':_0x968e70[_0x322d('0x5')],'priority':_0x3b88aa++,'VoiceExtensionId':_0x968e70['id']});return _0x59f26f;}function _0x22db3f(_0xedd9f1){var _0x3f211a=0x2;var _0x596357=[{'type':_0x322d('0xe'),'app':_0x322d('0x3'),'appdata':_0x322d('0xf'),'context':_0xedd9f1[_0x322d('0x4')],'exten':_0xedd9f1['exten'],'priority':_0x3f211a++,'VoiceExtensionId':_0xedd9f1['id']},{'type':_0x322d('0xe'),'app':_0xedd9f1[_0x322d('0x7')]?_0x322d('0x3'):_0x322d('0x6'),'appdata':_0xedd9f1[_0x322d('0x7')]?_0x322d('0x8')+_0xedd9f1['alias']:'No\x20alias\x20set','context':_0xedd9f1[_0x322d('0x4')],'exten':_0xedd9f1[_0x322d('0x5')],'priority':_0x3f211a++,'VoiceExtensionId':_0xedd9f1['id']},{'type':'outbound','app':_0x322d('0x3'),'appdata':_0x322d('0x10')+(_0xedd9f1[_0x322d('0x11')]?_0x322d('0x12')+_0xedd9f1[_0x322d('0x11')]+'}':'${EXTEN}'),'context':_0xedd9f1[_0x322d('0x4')],'exten':_0xedd9f1[_0x322d('0x5')],'priority':_0x3f211a++,'VoiceExtensionId':_0xedd9f1['id']},{'type':_0x322d('0xe'),'app':_0x322d('0x3'),'appdata':_0x322d('0x13')+_0xedd9f1['id'],'context':_0xedd9f1[_0x322d('0x4')],'exten':_0xedd9f1[_0x322d('0x5')],'priority':_0x3f211a++,'VoiceExtensionId':_0xedd9f1['id']},{'type':_0x322d('0xe'),'app':_0x322d('0x14'),'appdata':_0x322d('0x15')+(_0x3f211a+0x2)+'):Goto('+(_0x3f211a+0x1)+')','context':_0xedd9f1[_0x322d('0x4')],'exten':_0xedd9f1[_0x322d('0x5')],'priority':_0x3f211a++,'VoiceExtensionId':_0xedd9f1['id']},{'type':_0x322d('0xe'),'app':'Set','appdata':_0xedd9f1[_0x322d('0x11')]?_0x322d('0x16')+_0xedd9f1['cutdigits']+'}':_0x322d('0x17'),'context':_0xedd9f1['context'],'exten':_0xedd9f1[_0x322d('0x5')],'priority':_0x3f211a++,'VoiceExtensionId':_0xedd9f1['id']},{'type':'outbound','app':_0x322d('0x3'),'appdata':_0x322d('0xc'),'context':_0xedd9f1[_0x322d('0x4')],'exten':_0xedd9f1[_0x322d('0x5')],'priority':_0x3f211a++,'VoiceExtensionId':_0xedd9f1['id']},{'type':'outbound','app':_0x322d('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0xedd9f1[_0x322d('0x4')],'exten':_0xedd9f1[_0x322d('0x5')],'priority':_0x3f211a++,'VoiceExtensionId':_0xedd9f1['id']},{'type':_0x322d('0xe'),'app':_0x322d('0x3'),'appdata':_0x322d('0x18'),'context':_0xedd9f1[_0x322d('0x4')],'exten':_0xedd9f1[_0x322d('0x5')],'priority':_0x3f211a++,'VoiceExtensionId':_0xedd9f1['id']},{'type':_0x322d('0xe'),'app':'Set','appdata':'outboundrouteid='+_0xedd9f1['id'],'context':_0xedd9f1['context'],'exten':_0xedd9f1['exten'],'priority':_0x3f211a++,'VoiceExtensionId':_0xedd9f1['id']}];if(_0xedd9f1['hasOwnProperty'](_0x322d('0x19'))&&_0xedd9f1[_0x322d('0x19')]!=='none'){_0x596357[_0x322d('0xb')]({'type':'outbound','app':_0x322d('0x3'),'appdata':_0x322d('0x1a'),'context':_0xedd9f1[_0x322d('0x4')],'exten':_0xedd9f1['exten'],'priority':_0x3f211a++,'VoiceExtensionId':_0xedd9f1['id']},{'type':_0x322d('0xe'),'app':_0x322d('0x3'),'appdata':_0x322d('0x1b')+_0xedd9f1[_0x322d('0x19')]||'wav','context':_0xedd9f1['context'],'exten':_0xedd9f1[_0x322d('0x5')],'priority':_0x3f211a++,'VoiceExtensionId':_0xedd9f1['id']});}return _0x596357;}function _0xa7eb83(_0x18ccbf,_0x3b5809){var _0x275c7c=[{'name':_0x322d('0x1c'),'param':0x0},{'name':_0x322d('0x1d'),'param':0x1},{'name':'options','param':0x2},{'name':_0x322d('0x1e'),'param':0x3}];var _0x5dba92={};var _0x50a7e6=_0x3b5809[_0x322d('0x1f')](',');var _0x4a4de1=[];for(var _0x225127=0x0;_0x225127<_0x275c7c['length'];_0x225127++){switch(_0x275c7c[_0x225127]['name']){case'trunk':_0x5dba92[_0x322d('0x1c')]=_0x50a7e6[_0x275c7c[_0x225127][_0x322d('0x20')]]['split']('/')[0x1];_0x5dba92[_0x322d('0x21')]=_0x50a7e6[_0x275c7c[_0x225127][_0x322d('0x20')]][_0x322d('0x1f')]('/')[0x2];_0x5dba92[_0x322d('0x22')]=_0x5dba92['phone']?_0x5dba92['phone'][_0x322d('0x1f')]('$')[0x0]:undefined;_0x5dba92[_0x322d('0x21')]=_0x18ccbf['cutdigits']?(_0x5dba92[_0x322d('0x22')]||'')+_0x322d('0x12')+_0x18ccbf[_0x322d('0x11')]+'}':(_0x5dba92[_0x322d('0x22')]||'')+_0x322d('0x23');_0x4a4de1[_0x275c7c[_0x225127][_0x322d('0x20')]]=[_0x322d('0x24'),_0x5dba92[_0x322d('0x1c')],_0x5dba92[_0x322d('0x21')]][_0x322d('0x25')]('/');break;case'options':_0x5dba92[_0x322d('0x26')]=_0x50a7e6[_0x275c7c[_0x225127][_0x322d('0x20')]];if(_0x18ccbf[_0x322d('0x19')]!==_0x322d('0x27')){if(_0x5dba92[_0x322d('0x26')]['indexOf'](_0x322d('0x28'))<0x0){_0x5dba92[_0x322d('0x26')]+=_0x322d('0x28');}}else{_0x5dba92[_0x322d('0x26')]=_0x5dba92[_0x322d('0x26')][_0x322d('0x29')](_0x322d('0x28'),'');}_0x4a4de1[_0x275c7c[_0x225127][_0x322d('0x20')]]=_0x5dba92['options'];break;default:_0x4a4de1[_0x275c7c[_0x225127][_0x322d('0x20')]]=_0x50a7e6[_0x275c7c[_0x225127][_0x322d('0x20')]];}}return _0x4a4de1[_0x322d('0x25')](',');}function _0x703ae7(_0x323a34,_0x367dfd,_0x20b48e){return new Promise(function(_0x574388,_0x224e7f){var _0x3abe28=[];if(_[_0x322d('0x2a')](_0x367dfd))return _0x574388(_0x3abe28);_0x37b7e8['Interval'][_0x322d('0x2b')]({'attributes':['id',_0x322d('0x2c'),_0x322d('0x2d')],'raw':!![]})[_0x322d('0x2e')](function(_0xe0d238){for(var _0x75a182=0x0,_0x17b5f5=0x0;_0x75a182<_0x367dfd['length'];_0x75a182++,_0x17b5f5=0x0){var _0x52d5c2=_0x367dfd[_0x75a182];var _0x554e0e=[];var _0x26b31b=[];delete _0x52d5c2['id'];if(_0x52d5c2[_0x322d('0x2c')]!=='*,*,*,*'){_0x52d5c2[_0x322d('0x2f')]=[_0x52d5c2['interval']];}else{_0x52d5c2[_0x322d('0x2f')]=_0x52d5c2[_0x322d('0x2d')]?_['map'](_[_0x322d('0x30')](_0xe0d238,{'IntervalId':_0x52d5c2['IntervalId']}),_0x322d('0x2c')):[];}_0x52d5c2[_0x322d('0x4')]=_0x323a34['context'];_0x52d5c2[_0x322d('0x5')]=_0x323a34[_0x322d('0x5')];if(_0x52d5c2[_0x322d('0x2')])_0x52d5c2['type']=_0x52d5c2[_0x322d('0x2')]['toLowerCase']();if(_0x323a34[_0x322d('0x2')]===_0x322d('0xe')){if(_0x52d5c2[_0x322d('0x31')](_0x322d('0x32'))&&_0x52d5c2[_0x322d('0x32')]&&_0x52d5c2['tag']!=='--'){_0x554e0e[_0x322d('0xb')]({'type':_0x52d5c2[_0x322d('0x2')][_0x322d('0x33')](),'app':'Set','appdata':_0x322d('0x34')+_0x52d5c2['tag'],'context':_0x323a34[_0x322d('0x4')],'exten':_0x323a34['exten'],'priority':_0x52d5c2['intervals'][_0x322d('0x35')]+_0x20b48e+_0x17b5f5++,'VoiceExtensionId':_0x323a34['id']});}_0x554e0e[_0x322d('0xb')]({'type':_0x52d5c2[_0x322d('0x2')][_0x322d('0x33')](),'app':_0x322d('0x14'),'appdata':_0x322d('0x36')+(_0x52d5c2['callerID']?'Set(CALLERID(all)='+_0x52d5c2['callerID']+')':_0x322d('0x37')),'context':_0x323a34['context'],'exten':_0x323a34['exten'],'priority':_0x52d5c2[_0x322d('0x2f')]['length']+_0x20b48e+_0x17b5f5++,'VoiceExtensionId':_0x323a34['id']});}else{if(_0x52d5c2[_0x322d('0x31')](_0x322d('0x38'))){if([_0x322d('0x39'),_0x322d('0x3a')][_0x322d('0x3b')](_0x52d5c2[_0x322d('0x3c')][_0x322d('0x33')]())&&_0x52d5c2[_0x322d('0x3d')]!==_0x322d('0x3e')){if(_0x52d5c2[_0x322d('0x38')]){_0x554e0e[_0x322d('0xb')]({'type':_0x52d5c2[_0x322d('0x2')][_0x322d('0x33')](),'app':_0x322d('0x14'),'appdata':_0x322d('0x3f'),'context':_0x323a34[_0x322d('0x4')],'exten':_0x323a34[_0x322d('0x5')],'priority':_0x52d5c2[_0x322d('0x2f')][_0x322d('0x35')]+_0x20b48e+_0x17b5f5++,'VoiceExtensionId':_0x323a34['id']});_0x554e0e[_0x322d('0xb')]({'type':_0x52d5c2['type'][_0x322d('0x33')](),'app':_0x322d('0x3'),'appdata':_0x322d('0x40'),'context':_0x323a34[_0x322d('0x4')],'exten':_0x323a34[_0x322d('0x5')],'priority':_0x52d5c2[_0x322d('0x2f')]['length']+_0x20b48e+_0x17b5f5++,'VoiceExtensionId':_0x323a34['id']});}else{_0x554e0e[_0x322d('0xb')]({'type':_0x52d5c2[_0x322d('0x2')][_0x322d('0x33')](),'app':_0x322d('0x14'),'appdata':_0x322d('0x41'),'context':_0x323a34[_0x322d('0x4')],'exten':_0x323a34[_0x322d('0x5')],'priority':_0x52d5c2['intervals'][_0x322d('0x35')]+_0x20b48e+_0x17b5f5++,'VoiceExtensionId':_0x323a34['id']});_0x554e0e[_0x322d('0xb')]({'type':_0x52d5c2[_0x322d('0x2')][_0x322d('0x33')](),'app':_0x322d('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x323a34[_0x322d('0x4')],'exten':_0x323a34[_0x322d('0x5')],'priority':_0x52d5c2[_0x322d('0x2f')]['length']+_0x20b48e+_0x17b5f5++,'VoiceExtensionId':_0x323a34['id']});}}}}for(var _0x211b8c=0x0;_0x211b8c<_0x52d5c2[_0x322d('0x2f')][_0x322d('0x35')];_0x211b8c++){var _0x4a4b75=_0x20b48e+_0x52d5c2[_0x322d('0x2f')][_0x322d('0x35')];var _0x248e67=_0x211b8c===_0x52d5c2[_0x322d('0x2f')][_0x322d('0x35')]-0x1?_0x20b48e+_0x554e0e[_0x322d('0x35')]+_0x26b31b[_0x322d('0x35')]+0x2:_0x20b48e+_0x211b8c+0x1;_0x554e0e[_0x322d('0x42')](_0x211b8c,0x0,{'type':_0x323a34[_0x322d('0x2')],'app':_0x322d('0x43'),'appdata':_0x52d5c2[_0x322d('0x2f')][_0x211b8c]+'?'+_0x323a34['context']+_0x322d('0x44')+_0x4a4b75+':'+_0x323a34['context']+_0x322d('0x44')+_0x248e67,'exten':_0x323a34['exten'],'context':_0x323a34['context'],'priority':_0x20b48e+_0x211b8c,'VoiceExtensionId':_0x323a34['id']});}if(_0x52d5c2[_0x322d('0x3d')]===_0x322d('0x45'))_0x52d5c2[_0x322d('0x46')]=_0xa7eb83(_0x323a34,_0x52d5c2[_0x322d('0x46')]);_0x52d5c2['priority']=_0x554e0e[_0x322d('0x35')]?_[_0x322d('0x47')](_0x554e0e)[_0x322d('0x48')]+0x1:_0x20b48e;_0x3abe28=_[_0x322d('0x49')](_0x3abe28,_0x554e0e,[_0x52d5c2],_0x26b31b);_0x20b48e=_[_0x322d('0x47')](_0x3abe28)[_0x322d('0x48')]+0x1;}return _0x574388(_0x3abe28);})['catch'](function(_0x1ee4d0){_0x224e7f(_0x1ee4d0);});});}return _0x523cdd[_0x322d('0x4a')](_0x322d('0x4b'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1df403){var _0x3c72e7=this['get']({'plain':!![]});var _0x64a095=_0x3c72e7[_0x322d('0x2')]===_0x322d('0xe')?_0x22db3f(_0x3c72e7):_0x1800d9(_0x3c72e7);return _0x703ae7(_0x3c72e7,_0x1df403,_['last'](_0x64a095)[_0x322d('0x48')]+0x1)[_0x322d('0x2e')](function(_0x5df0a7){var _0x1c05a4=_[_0x322d('0x49')](_0x64a095,_0x5df0a7);_0x1c05a4[_0x322d('0xb')]({'type':_0x3c72e7[_0x322d('0x2')],'app':'Hangup','exten':_0x3c72e7[_0x322d('0x5')],'context':_0x3c72e7[_0x322d('0x4')],'priority':_[_0x322d('0x47')](_0x1c05a4)['priority']+0x1,'VoiceExtensionId':_0x3c72e7['id']});return _0x1c05a4;});}}});}; \ No newline at end of file +var _0xf185=['$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','exports','models','type','Set','CDR(type)=','context','exten','alias','NoOp','No\x20alias\x20set','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','options','url','split','length','name','trunk','param','phone','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','map','toLowerCase','tag','intervals'];(function(_0x3b3b00,_0x4917c0){var _0x2d68ad=function(_0x177072){while(--_0x177072){_0x3b3b00['push'](_0x3b3b00['shift']());}};_0x2d68ad(++_0x4917c0);}(_0xf185,0x1be));var _0x5f18=function(_0x3f9929,_0x3f49e6){_0x3f9929=_0x3f9929-0x0;var _0x207410=_0xf185[_0x3f9929];return _0x207410;};'use strict';var _=require(_0x5f18('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x5f18('0x1')]=function(_0x34335b){var _0x26ab30=_0x34335b[_0x5f18('0x2')];function _0x40e868(_0x12abae){var _0x529b25=0x2;var _0x33d44f=[{'type':_0x12abae[_0x5f18('0x3')],'app':_0x5f18('0x4'),'appdata':_0x5f18('0x5')+_0x12abae['type'],'context':_0x12abae[_0x5f18('0x6')],'exten':_0x12abae[_0x5f18('0x7')],'priority':_0x529b25++,'VoiceExtensionId':_0x12abae['id']},{'type':_0x12abae['type'],'app':_0x12abae[_0x5f18('0x8')]?'Set':_0x5f18('0x9'),'appdata':_0x12abae[_0x5f18('0x8')]?'CDR(routeAlias)='+_0x12abae[_0x5f18('0x8')]:_0x5f18('0xa'),'context':_0x12abae['context'],'exten':_0x12abae[_0x5f18('0x7')],'priority':_0x529b25++,'VoiceExtensionId':_0x12abae['id']}];if(_0x12abae[_0x5f18('0x3')]==='inbound'){_0x33d44f['push']({'type':_0x5f18('0xb'),'app':_0x5f18('0x4'),'appdata':_0x5f18('0xc')+_0x12abae['id'],'context':_0x12abae['context'],'exten':_0x12abae[_0x5f18('0x7')],'priority':_0x529b25++,'VoiceExtensionId':_0x12abae['id']});}_0x33d44f[_0x5f18('0xd')]({'type':_0x12abae[_0x5f18('0x3')],'app':_0x5f18('0x4'),'appdata':_0x5f18('0xe'),'context':_0x12abae[_0x5f18('0x6')],'exten':_0x12abae[_0x5f18('0x7')],'priority':_0x529b25++,'VoiceExtensionId':_0x12abae['id']},{'type':_0x12abae[_0x5f18('0x3')],'app':_0x5f18('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x12abae[_0x5f18('0x6')],'exten':_0x12abae['exten'],'priority':_0x529b25++,'VoiceExtensionId':_0x12abae['id']},{'type':_0x12abae['type'],'app':_0x5f18('0x4'),'appdata':_0x5f18('0xf'),'context':_0x12abae[_0x5f18('0x6')],'exten':_0x12abae[_0x5f18('0x7')],'priority':_0x529b25++,'VoiceExtensionId':_0x12abae['id']});return _0x33d44f;}function _0x337ec1(_0x506f4e){var _0x3d61bf=0x2;var _0x45cc93=[{'type':_0x5f18('0x10'),'app':_0x5f18('0x4'),'appdata':_0x5f18('0x11'),'context':_0x506f4e['context'],'exten':_0x506f4e[_0x5f18('0x7')],'priority':_0x3d61bf++,'VoiceExtensionId':_0x506f4e['id']},{'type':_0x5f18('0x10'),'app':_0x506f4e[_0x5f18('0x8')]?'Set':_0x5f18('0x9'),'appdata':_0x506f4e[_0x5f18('0x8')]?'CDR(routeAlias)='+_0x506f4e['alias']:_0x5f18('0xa'),'context':_0x506f4e[_0x5f18('0x6')],'exten':_0x506f4e[_0x5f18('0x7')],'priority':_0x3d61bf++,'VoiceExtensionId':_0x506f4e['id']},{'type':_0x5f18('0x10'),'app':_0x5f18('0x4'),'appdata':_0x5f18('0x12')+(_0x506f4e['cutdigits']?'${EXTEN:'+_0x506f4e[_0x5f18('0x13')]+'}':_0x5f18('0x14')),'context':_0x506f4e['context'],'exten':_0x506f4e[_0x5f18('0x7')],'priority':_0x3d61bf++,'VoiceExtensionId':_0x506f4e['id']},{'type':'outbound','app':_0x5f18('0x4'),'appdata':'CDR(routeid)='+_0x506f4e['id'],'context':_0x506f4e['context'],'exten':_0x506f4e[_0x5f18('0x7')],'priority':_0x3d61bf++,'VoiceExtensionId':_0x506f4e['id']},{'type':'outbound','app':_0x5f18('0x15'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3d61bf+0x2)+_0x5f18('0x16')+(_0x3d61bf+0x1)+')','context':_0x506f4e[_0x5f18('0x6')],'exten':_0x506f4e[_0x5f18('0x7')],'priority':_0x3d61bf++,'VoiceExtensionId':_0x506f4e['id']},{'type':_0x5f18('0x10'),'app':'Set','appdata':_0x506f4e[_0x5f18('0x13')]?_0x5f18('0x17')+_0x506f4e[_0x5f18('0x13')]+'}':_0x5f18('0x18'),'context':_0x506f4e[_0x5f18('0x6')],'exten':_0x506f4e[_0x5f18('0x7')],'priority':_0x3d61bf++,'VoiceExtensionId':_0x506f4e['id']},{'type':_0x5f18('0x10'),'app':_0x5f18('0x4'),'appdata':_0x5f18('0xe'),'context':_0x506f4e['context'],'exten':_0x506f4e[_0x5f18('0x7')],'priority':_0x3d61bf++,'VoiceExtensionId':_0x506f4e['id']},{'type':'outbound','app':'Set','appdata':_0x5f18('0x19'),'context':_0x506f4e[_0x5f18('0x6')],'exten':_0x506f4e[_0x5f18('0x7')],'priority':_0x3d61bf++,'VoiceExtensionId':_0x506f4e['id']},{'type':'outbound','app':'Set','appdata':_0x5f18('0xf'),'context':_0x506f4e[_0x5f18('0x6')],'exten':_0x506f4e[_0x5f18('0x7')],'priority':_0x3d61bf++,'VoiceExtensionId':_0x506f4e['id']},{'type':'outbound','app':_0x5f18('0x4'),'appdata':_0x5f18('0x1a')+_0x506f4e['id'],'context':_0x506f4e[_0x5f18('0x6')],'exten':_0x506f4e['exten'],'priority':_0x3d61bf++,'VoiceExtensionId':_0x506f4e['id']}];if(_0x506f4e[_0x5f18('0x1b')](_0x5f18('0x1c'))&&_0x506f4e[_0x5f18('0x1c')]!==_0x5f18('0x1d')){_0x45cc93['push']({'type':_0x5f18('0x10'),'app':'Set','appdata':_0x5f18('0x1e'),'context':_0x506f4e[_0x5f18('0x6')],'exten':_0x506f4e[_0x5f18('0x7')],'priority':_0x3d61bf++,'VoiceExtensionId':_0x506f4e['id']},{'type':_0x5f18('0x10'),'app':_0x5f18('0x4'),'appdata':_0x5f18('0x1f')+_0x506f4e[_0x5f18('0x1c')]||_0x5f18('0x20'),'context':_0x506f4e['context'],'exten':_0x506f4e[_0x5f18('0x7')],'priority':_0x3d61bf++,'VoiceExtensionId':_0x506f4e['id']});}return _0x45cc93;}function _0x548e79(_0x186e65,_0x28cfe2){var _0x224b45=[{'name':'trunk','param':0x0},{'name':'timeout','param':0x1},{'name':_0x5f18('0x21'),'param':0x2},{'name':_0x5f18('0x22'),'param':0x3}];var _0x24fa0f={};var _0x34a15b=_0x28cfe2[_0x5f18('0x23')](',');var _0x2fd94a=[];for(var _0x483217=0x0;_0x483217<_0x224b45[_0x5f18('0x24')];_0x483217++){switch(_0x224b45[_0x483217][_0x5f18('0x25')]){case _0x5f18('0x26'):_0x24fa0f['trunk']=_0x34a15b[_0x224b45[_0x483217][_0x5f18('0x27')]]['split']('/')[0x1];_0x24fa0f['phone']=_0x34a15b[_0x224b45[_0x483217][_0x5f18('0x27')]][_0x5f18('0x23')]('/')[0x2];_0x24fa0f['prefix']=_0x24fa0f[_0x5f18('0x28')]?_0x24fa0f['phone'][_0x5f18('0x23')]('$')[0x0]:undefined;_0x24fa0f[_0x5f18('0x28')]=_0x186e65[_0x5f18('0x13')]?(_0x24fa0f[_0x5f18('0x29')]||'')+'${EXTEN:'+_0x186e65[_0x5f18('0x13')]+'}':(_0x24fa0f[_0x5f18('0x29')]||'')+_0x5f18('0x14');_0x2fd94a[_0x224b45[_0x483217]['param']]=[_0x5f18('0x2a'),_0x24fa0f[_0x5f18('0x26')],_0x24fa0f[_0x5f18('0x28')]][_0x5f18('0x2b')]('/');break;case'options':_0x24fa0f[_0x5f18('0x21')]=_0x34a15b[_0x224b45[_0x483217][_0x5f18('0x27')]];if(_0x186e65[_0x5f18('0x1c')]!=='none'){if(_0x24fa0f['options'][_0x5f18('0x2c')](_0x5f18('0x2d'))<0x0){_0x24fa0f[_0x5f18('0x21')]+=_0x5f18('0x2d');}}else{_0x24fa0f[_0x5f18('0x21')]=_0x24fa0f['options'][_0x5f18('0x2e')](_0x5f18('0x2d'),'');}_0x2fd94a[_0x224b45[_0x483217][_0x5f18('0x27')]]=_0x24fa0f[_0x5f18('0x21')];break;default:_0x2fd94a[_0x224b45[_0x483217]['param']]=_0x34a15b[_0x224b45[_0x483217][_0x5f18('0x27')]];}}return _0x2fd94a[_0x5f18('0x2b')](',');}function _0x4a0c33(_0xec2527,_0x61fe1c,_0xdaf299){return new Promise(function(_0x4bd555,_0xf468cf){var _0x41685b=[];if(_[_0x5f18('0x2f')](_0x61fe1c))return _0x4bd555(_0x41685b);_0x26ab30[_0x5f18('0x30')][_0x5f18('0x31')]({'attributes':['id',_0x5f18('0x32'),_0x5f18('0x33')],'raw':!![]})[_0x5f18('0x34')](function(_0x443910){for(var _0x364455=0x0,_0x1a7098=0x0;_0x364455<_0x61fe1c['length'];_0x364455++,_0x1a7098=0x0){var _0x51695f=_0x61fe1c[_0x364455];var _0x3771b0=[];var _0x267357=[];delete _0x51695f['id'];if(_0x51695f[_0x5f18('0x32')]!==_0x5f18('0x35')){_0x51695f['intervals']=[_0x51695f[_0x5f18('0x32')]];}else{_0x51695f['intervals']=_0x51695f[_0x5f18('0x33')]?_[_0x5f18('0x36')](_['filter'](_0x443910,{'IntervalId':_0x51695f[_0x5f18('0x33')]}),_0x5f18('0x32')):[];}_0x51695f[_0x5f18('0x6')]=_0xec2527[_0x5f18('0x6')];_0x51695f[_0x5f18('0x7')]=_0xec2527[_0x5f18('0x7')];if(_0x51695f[_0x5f18('0x3')])_0x51695f['type']=_0x51695f[_0x5f18('0x3')][_0x5f18('0x37')]();if(_0xec2527[_0x5f18('0x3')]===_0x5f18('0x10')){if(_0x51695f[_0x5f18('0x1b')](_0x5f18('0x38'))&&_0x51695f['tag']&&_0x51695f['tag']!=='--'){_0x3771b0[_0x5f18('0xd')]({'type':_0x51695f[_0x5f18('0x3')][_0x5f18('0x37')](),'app':_0x5f18('0x4'),'appdata':'CDR(tag)='+_0x51695f[_0x5f18('0x38')],'context':_0xec2527[_0x5f18('0x6')],'exten':_0xec2527[_0x5f18('0x7')],'priority':_0x51695f[_0x5f18('0x39')][_0x5f18('0x24')]+_0xdaf299+_0x1a7098++,'VoiceExtensionId':_0xec2527['id']});}_0x3771b0[_0x5f18('0xd')]({'type':_0x51695f[_0x5f18('0x3')][_0x5f18('0x37')](),'app':_0x5f18('0x15'),'appdata':_0x5f18('0x3a')+(_0x51695f['callerID']?_0x5f18('0x3b')+_0x51695f[_0x5f18('0x3c')]+')':_0x5f18('0x3d')),'context':_0xec2527['context'],'exten':_0xec2527[_0x5f18('0x7')],'priority':_0x51695f['intervals'][_0x5f18('0x24')]+_0xdaf299+_0x1a7098++,'VoiceExtensionId':_0xec2527['id']});}else{if(_0x51695f[_0x5f18('0x1b')]('answer')){if([_0x5f18('0x3e'),_0x5f18('0x3f')][_0x5f18('0x40')](_0x51695f[_0x5f18('0x41')][_0x5f18('0x37')]())&&_0x51695f[_0x5f18('0x42')]!==_0x5f18('0x43')){if(_0x51695f['answer']){_0x3771b0['push']({'type':_0x51695f[_0x5f18('0x3')][_0x5f18('0x37')](),'app':_0x5f18('0x15'),'appdata':_0x5f18('0x44'),'context':_0xec2527['context'],'exten':_0xec2527[_0x5f18('0x7')],'priority':_0x51695f[_0x5f18('0x39')][_0x5f18('0x24')]+_0xdaf299+_0x1a7098++,'VoiceExtensionId':_0xec2527['id']});_0x3771b0[_0x5f18('0xd')]({'type':_0x51695f[_0x5f18('0x3')]['toLowerCase'](),'app':_0x5f18('0x4'),'appdata':_0x5f18('0x45'),'context':_0xec2527['context'],'exten':_0xec2527[_0x5f18('0x7')],'priority':_0x51695f[_0x5f18('0x39')][_0x5f18('0x24')]+_0xdaf299+_0x1a7098++,'VoiceExtensionId':_0xec2527['id']});}else{_0x3771b0[_0x5f18('0xd')]({'type':_0x51695f[_0x5f18('0x3')][_0x5f18('0x37')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0xec2527['context'],'exten':_0xec2527['exten'],'priority':_0x51695f['intervals'][_0x5f18('0x24')]+_0xdaf299+_0x1a7098++,'VoiceExtensionId':_0xec2527['id']});_0x3771b0[_0x5f18('0xd')]({'type':_0x51695f[_0x5f18('0x3')][_0x5f18('0x37')](),'app':_0x5f18('0x4'),'appdata':_0x5f18('0x46'),'context':_0xec2527[_0x5f18('0x6')],'exten':_0xec2527[_0x5f18('0x7')],'priority':_0x51695f[_0x5f18('0x39')][_0x5f18('0x24')]+_0xdaf299+_0x1a7098++,'VoiceExtensionId':_0xec2527['id']});}}}}for(var _0x34d8a8=0x0;_0x34d8a8<_0x51695f[_0x5f18('0x39')][_0x5f18('0x24')];_0x34d8a8++){var _0x591101=_0xdaf299+_0x51695f[_0x5f18('0x39')][_0x5f18('0x24')];var _0x13effa=_0x34d8a8===_0x51695f[_0x5f18('0x39')][_0x5f18('0x24')]-0x1?_0xdaf299+_0x3771b0[_0x5f18('0x24')]+_0x267357[_0x5f18('0x24')]+0x2:_0xdaf299+_0x34d8a8+0x1;_0x3771b0[_0x5f18('0x47')](_0x34d8a8,0x0,{'type':_0xec2527[_0x5f18('0x3')],'app':'GotoIfTime','appdata':_0x51695f[_0x5f18('0x39')][_0x34d8a8]+'?'+_0xec2527[_0x5f18('0x6')]+_0x5f18('0x48')+_0x591101+':'+_0xec2527['context']+_0x5f18('0x48')+_0x13effa,'exten':_0xec2527[_0x5f18('0x7')],'context':_0xec2527['context'],'priority':_0xdaf299+_0x34d8a8,'VoiceExtensionId':_0xec2527['id']});}if(_0x51695f[_0x5f18('0x42')]===_0x5f18('0x49'))_0x51695f[_0x5f18('0x4a')]=_0x548e79(_0xec2527,_0x51695f[_0x5f18('0x4a')]);_0x51695f[_0x5f18('0x4b')]=_0x3771b0[_0x5f18('0x24')]?_[_0x5f18('0x4c')](_0x3771b0)[_0x5f18('0x4b')]+0x1:_0xdaf299;_0x41685b=_[_0x5f18('0x4d')](_0x41685b,_0x3771b0,[_0x51695f],_0x267357);_0xdaf299=_[_0x5f18('0x4c')](_0x41685b)[_0x5f18('0x4b')]+0x1;}return _0x4bd555(_0x41685b);})[_0x5f18('0x4e')](function(_0x22e9e7){_0xf468cf(_0x22e9e7);});});}return _0x34335b[_0x5f18('0x4f')](_0x5f18('0x50'),attributes,{'tableName':_0x5f18('0x51'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4f8e6e){var _0x48536b=this[_0x5f18('0x52')]({'plain':!![]});var _0x3eac7c=_0x48536b['type']===_0x5f18('0x10')?_0x337ec1(_0x48536b):_0x40e868(_0x48536b);return _0x4a0c33(_0x48536b,_0x4f8e6e,_['last'](_0x3eac7c)['priority']+0x1)[_0x5f18('0x34')](function(_0x5b8591){var _0x5b1580=_[_0x5f18('0x4d')](_0x3eac7c,_0x5b8591);_0x5b1580[_0x5f18('0xd')]({'type':_0x48536b[_0x5f18('0x3')],'app':_0x5f18('0x53'),'exten':_0x48536b[_0x5f18('0x7')],'context':_0x48536b[_0x5f18('0x6')],'priority':_['last'](_0x5b1580)[_0x5f18('0x4b')]+0x1,'VoiceExtensionId':_0x48536b['id']});return _0x5b1580;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index d20932f..bace3f1 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 _0xd8af=['redis','defaults','localhost','./voiceExtension.socket','register','request','then','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','VoiceExtension,\x20%s,\x20%s','message','info','request\x20sent','result','catch','GetVoiceExtension','findAll','options','raw','where','limit','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x230076,_0x4ec21f){var _0x46ff80=function(_0x1ccf91){while(--_0x1ccf91){_0x230076['push'](_0x230076['shift']());}};_0x46ff80(++_0x4ec21f);}(_0xd8af,0x18d));var _0xfd8a=function(_0x504d16,_0x24c1bd){_0x504d16=_0x504d16-0x0;var _0x410dd2=_0xd8af[_0x504d16];return _0x410dd2;};'use strict';var _=require(_0xfd8a('0x0'));var util=require(_0xfd8a('0x1'));var moment=require(_0xfd8a('0x2'));var BPromise=require(_0xfd8a('0x3'));var rs=require(_0xfd8a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd8a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfd8a('0x6'))(_0xfd8a('0x7'));var config=require(_0xfd8a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfd8a('0x9')]['http']({'port':0x232a});config[_0xfd8a('0xa')]=_[_0xfd8a('0xb')](config[_0xfd8a('0xa')],{'host':_0xfd8a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfd8a('0xa')]));require(_0xfd8a('0xd'))[_0xfd8a('0xe')](socket);function respondWithRpcPromise(_0x25cab2,_0x203e62,_0xc2a4c7){return new BPromise(function(_0x5cc95e,_0x57a1a4){return client[_0xfd8a('0xf')](_0x25cab2,_0xc2a4c7)[_0xfd8a('0x10')](function(_0x456b2e){logger['info']('VoiceExtension,\x20%s,\x20%s',_0x203e62,'request\x20sent');logger[_0xfd8a('0x11')](_0xfd8a('0x12'),_0x203e62,'request\x20sent',JSON['stringify'](_0x456b2e));if(_0x456b2e[_0xfd8a('0x13')]){if(_0x456b2e[_0xfd8a('0x13')][_0xfd8a('0x14')]===0x1f4){logger[_0xfd8a('0x13')](_0xfd8a('0x15'),_0x203e62,_0x456b2e[_0xfd8a('0x13')][_0xfd8a('0x16')]);return _0x57a1a4(_0x456b2e[_0xfd8a('0x13')][_0xfd8a('0x16')]);}logger[_0xfd8a('0x13')](_0xfd8a('0x15'),_0x203e62,_0x456b2e[_0xfd8a('0x13')][_0xfd8a('0x16')]);return _0x5cc95e(_0x456b2e[_0xfd8a('0x13')][_0xfd8a('0x16')]);}else{logger[_0xfd8a('0x17')](_0xfd8a('0x15'),_0x203e62,_0xfd8a('0x18'));_0x5cc95e(_0x456b2e[_0xfd8a('0x19')][_0xfd8a('0x16')]);}})[_0xfd8a('0x1a')](function(_0x19e7ed){logger[_0xfd8a('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x203e62,_0x19e7ed);_0x57a1a4(_0x19e7ed);});});}exports[_0xfd8a('0x1b')]=function(_0x9eade2){var _0x29c8e5=this;return new Promise(function(_0x53eb71,_0x34ff05){return db['VoiceExtension'][_0xfd8a('0x1c')]({'raw':_0x9eade2['options']?_0x9eade2[_0xfd8a('0x1d')][_0xfd8a('0x1e')]===undefined?!![]:![]:!![],'where':_0x9eade2[_0xfd8a('0x1d')]?_0x9eade2[_0xfd8a('0x1d')][_0xfd8a('0x1f')]||null:null,'attributes':_0x9eade2[_0xfd8a('0x1d')]?_0x9eade2[_0xfd8a('0x1d')]['attributes']||null:null,'limit':_0x9eade2[_0xfd8a('0x1d')]?_0x9eade2[_0xfd8a('0x1d')][_0xfd8a('0x20')]||null:null,'include':_0x9eade2[_0xfd8a('0x1d')]?_0x9eade2[_0xfd8a('0x1d')][_0xfd8a('0x21')]?_[_0xfd8a('0x22')](_0x9eade2[_0xfd8a('0x1d')][_0xfd8a('0x21')],function(_0x5e101e){return{'model':db[_0x5e101e[_0xfd8a('0x23')]],'as':_0x5e101e['as'],'attributes':_0x5e101e['attributes'],'include':_0x5e101e[_0xfd8a('0x21')]?_[_0xfd8a('0x22')](_0x5e101e[_0xfd8a('0x21')],function(_0x25d5d4){return{'model':db[_0x25d5d4[_0xfd8a('0x23')]],'as':_0x25d5d4['as'],'attributes':_0x25d5d4[_0xfd8a('0x24')],'include':_0x25d5d4[_0xfd8a('0x21')]?_[_0xfd8a('0x22')](_0x25d5d4[_0xfd8a('0x21')],function(_0x4a5926){return{'model':db[_0x4a5926[_0xfd8a('0x23')]],'as':_0x4a5926['as'],'attributes':_0x4a5926[_0xfd8a('0x24')]};}):[]};}):[]};}):[]:[]})[_0xfd8a('0x10')](function(_0x556db1){logger[_0xfd8a('0x17')](_0xfd8a('0x1b'),_0x9eade2);logger[_0xfd8a('0x11')](_0xfd8a('0x1b'),_0x9eade2,JSON['stringify'](_0x556db1));_0x53eb71(_0x556db1);})['catch'](function(_0x592e7c){logger[_0xfd8a('0x13')](_0xfd8a('0x1b'),_0x592e7c[_0xfd8a('0x16')],_0x9eade2);_0x34ff05(_0x29c8e5['error'](0x1f4,_0x592e7c[_0xfd8a('0x16')]));});});}; \ No newline at end of file +var _0x3ca4=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','model','map','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x36115d,_0x4071a1){var _0x58cd1f=function(_0x43c7bd){while(--_0x43c7bd){_0x36115d['push'](_0x36115d['shift']());}};_0x58cd1f(++_0x4071a1);}(_0x3ca4,0x17d));var _0x43ca=function(_0x1e0869,_0x32393e){_0x1e0869=_0x1e0869-0x0;var _0x503fb4=_0x3ca4[_0x1e0869];return _0x503fb4;};'use strict';var _=require(_0x43ca('0x0'));var util=require(_0x43ca('0x1'));var moment=require(_0x43ca('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43ca('0x3'));var db=require(_0x43ca('0x4'))['db'];var utils=require(_0x43ca('0x5'));var logger=require(_0x43ca('0x6'))(_0x43ca('0x7'));var config=require(_0x43ca('0x8'));var jayson=require(_0x43ca('0x9'));var client=jayson['client'][_0x43ca('0xa')]({'port':0x232a});config[_0x43ca('0xb')]=_[_0x43ca('0xc')](config[_0x43ca('0xb')],{'host':_0x43ca('0xd'),'port':0x18eb});var socket=require(_0x43ca('0xe'))(new Redis(config[_0x43ca('0xb')]));require(_0x43ca('0xf'))['register'](socket);function respondWithRpcPromise(_0x5b61dd,_0x1dcd17,_0x134855){return new BPromise(function(_0x4d5516,_0x2facc9){return client['request'](_0x5b61dd,_0x134855)[_0x43ca('0x10')](function(_0x411a00){logger[_0x43ca('0x11')](_0x43ca('0x12'),_0x1dcd17,_0x43ca('0x13'));logger[_0x43ca('0x14')](_0x43ca('0x15'),_0x1dcd17,_0x43ca('0x13'),JSON[_0x43ca('0x16')](_0x411a00));if(_0x411a00['error']){if(_0x411a00[_0x43ca('0x17')][_0x43ca('0x18')]===0x1f4){logger['error'](_0x43ca('0x12'),_0x1dcd17,_0x411a00['error'][_0x43ca('0x19')]);return _0x2facc9(_0x411a00['error'][_0x43ca('0x19')]);}logger[_0x43ca('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x1dcd17,_0x411a00[_0x43ca('0x17')][_0x43ca('0x19')]);return _0x4d5516(_0x411a00[_0x43ca('0x17')]['message']);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x1dcd17,'request\x20sent');_0x4d5516(_0x411a00[_0x43ca('0x1a')][_0x43ca('0x19')]);}})[_0x43ca('0x1b')](function(_0x5296b9){logger[_0x43ca('0x17')](_0x43ca('0x12'),_0x1dcd17,_0x5296b9);_0x2facc9(_0x5296b9);});});}exports[_0x43ca('0x1c')]=function(_0x4a07cd){var _0x23ee82=this;return new Promise(function(_0x51cb85,_0x106d07){return db[_0x43ca('0x1d')][_0x43ca('0x1e')]({'raw':_0x4a07cd['options']?_0x4a07cd[_0x43ca('0x1f')][_0x43ca('0x20')]===undefined?!![]:![]:!![],'where':_0x4a07cd[_0x43ca('0x1f')]?_0x4a07cd[_0x43ca('0x1f')][_0x43ca('0x21')]||null:null,'attributes':_0x4a07cd['options']?_0x4a07cd[_0x43ca('0x1f')][_0x43ca('0x22')]||null:null,'limit':_0x4a07cd['options']?_0x4a07cd[_0x43ca('0x1f')][_0x43ca('0x23')]||null:null,'include':_0x4a07cd[_0x43ca('0x1f')]?_0x4a07cd[_0x43ca('0x1f')][_0x43ca('0x24')]?_['map'](_0x4a07cd[_0x43ca('0x1f')][_0x43ca('0x24')],function(_0x29f2ee){return{'model':db[_0x29f2ee[_0x43ca('0x25')]],'as':_0x29f2ee['as'],'attributes':_0x29f2ee[_0x43ca('0x22')],'include':_0x29f2ee[_0x43ca('0x24')]?_[_0x43ca('0x26')](_0x29f2ee[_0x43ca('0x24')],function(_0x5aa57c){return{'model':db[_0x5aa57c['model']],'as':_0x5aa57c['as'],'attributes':_0x5aa57c['attributes'],'include':_0x5aa57c[_0x43ca('0x24')]?_[_0x43ca('0x26')](_0x5aa57c[_0x43ca('0x24')],function(_0x9d09b9){return{'model':db[_0x9d09b9[_0x43ca('0x25')]],'as':_0x9d09b9['as'],'attributes':_0x9d09b9[_0x43ca('0x22')]};}):[]};}):[]};}):[]:[]})[_0x43ca('0x10')](function(_0x3f0b2b){logger['info'](_0x43ca('0x1c'),_0x4a07cd);logger['debug']('GetVoiceExtension',_0x4a07cd,JSON[_0x43ca('0x16')](_0x3f0b2b));_0x51cb85(_0x3f0b2b);})[_0x43ca('0x1b')](function(_0x313518){logger[_0x43ca('0x17')](_0x43ca('0x1c'),_0x313518['message'],_0x4a07cd);_0x106d07(_0x23ee82[_0x43ca('0x17')](0x1f4,_0x313518['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 887d0f1..da9f2f0 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 _0x53ec=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x54975b,_0x43db57){var _0x3851a3=function(_0x243eb0){while(--_0x243eb0){_0x54975b['push'](_0x54975b['shift']());}};_0x3851a3(++_0x43db57);}(_0x53ec,0x192));var _0xc53e=function(_0x147003,_0x36e2e3){_0x147003=_0x147003-0x0;var _0x5167b2=_0x53ec[_0x147003];return _0x5167b2;};'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 +var _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x58af1c,_0x45103d){var _0x44e83c=function(_0x33f6dc){while(--_0x33f6dc){_0x58af1c['push'](_0x58af1c['shift']());}};_0x44e83c(++_0x45103d);}(_0x1261,0x144));var _0x1126=function(_0x1c73ee,_0x49a9c9){_0x1c73ee=_0x1c73ee-0x0;var _0x154f05=_0x1261[_0x1c73ee];return _0x154f05;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){VoiceExtensionEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);VoiceExtensionEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 016f334..9879b5f 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 _0xfcf0=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','put'];(function(_0x31fb49,_0x3102b1){var _0xb92c74=function(_0x29201d){while(--_0x29201d){_0x31fb49['push'](_0x31fb49['shift']());}};_0xb92c74(++_0x3102b1);}(_0xfcf0,0x138));var _0x0fcf=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xfcf0[_0xbd08b4];return _0x314f1e;};'use strict';var multer=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var path=require('path');var timeout=require(_0x0fcf('0x2'));var express=require(_0x0fcf('0x3'));var router=express[_0x0fcf('0x4')]();var fs_extra=require(_0x0fcf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var controller=require(_0x0fcf('0x8'));router[_0x0fcf('0x9')]('/',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0xb')]);router[_0x0fcf('0x9')](_0x0fcf('0xc'),auth['isAuthenticated'](),controller[_0x0fcf('0xd')]);router[_0x0fcf('0x9')](_0x0fcf('0xe'),auth['isAuthenticated'](),controller[_0x0fcf('0xf')]);router[_0x0fcf('0x10')]('/',auth[_0x0fcf('0xa')](),controller['create']);router[_0x0fcf('0x11')]('/:id',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x12')]);router[_0x0fcf('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x0fcf('0x14')]);module[_0x0fcf('0x15')]=router; \ No newline at end of file +var _0xfcf0=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','put'];(function(_0x894906,_0xbad9fd){var _0x1d9575=function(_0x379b5e){while(--_0x379b5e){_0x894906['push'](_0x894906['shift']());}};_0x1d9575(++_0xbad9fd);}(_0xfcf0,0x138));var _0x0fcf=function(_0x3ebb69,_0x3e612e){_0x3ebb69=_0x3ebb69-0x0;var _0x421e59=_0xfcf0[_0x3ebb69];return _0x421e59;};'use strict';var multer=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var path=require('path');var timeout=require(_0x0fcf('0x2'));var express=require(_0x0fcf('0x3'));var router=express[_0x0fcf('0x4')]();var fs_extra=require(_0x0fcf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var controller=require(_0x0fcf('0x8'));router[_0x0fcf('0x9')]('/',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0xb')]);router[_0x0fcf('0x9')](_0x0fcf('0xc'),auth['isAuthenticated'](),controller[_0x0fcf('0xd')]);router[_0x0fcf('0x9')](_0x0fcf('0xe'),auth['isAuthenticated'](),controller[_0x0fcf('0xf')]);router[_0x0fcf('0x10')]('/',auth[_0x0fcf('0xa')](),controller['create']);router[_0x0fcf('0x11')]('/:id',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x12')]);router[_0x0fcf('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x0fcf('0x14')]);module[_0x0fcf('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 3b3ccb9..f715d73 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 _0xcaa0=['TINYINT(4)','INTEGER','\x20-\x20','getDataValue','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','email','string','trim','central','yes','ENUM'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xcaa0,0x145));var _0x0caa=function(_0xee18e4,_0x1835eb){_0xee18e4=_0xee18e4-0x0;var _0x5993a8=_0xcaa0[_0xee18e4];return _0x5993a8;};'use strict';var Sequelize=require(_0x0caa('0x0'));module[_0x0caa('0x1')]={'customer_id':{'type':Sequelize[_0x0caa('0x2')]},'context':{'type':Sequelize[_0x0caa('0x2')],'defaultValue':_0x0caa('0x3'),'unique':_0x0caa('0x4')},'mailbox':{'type':Sequelize[_0x0caa('0x2')],'defaultValue':'','allowNull':![],'unique':_0x0caa('0x4')},'password':{'type':Sequelize[_0x0caa('0x2')]},'fullname':{'type':Sequelize[_0x0caa('0x2')]},'email':{'type':Sequelize[_0x0caa('0x2')],'validate':{'isEmail':!![]},'set':function(_0x1edb13){this['setDataValue'](_0x0caa('0x5'),typeof _0x1edb13===_0x0caa('0x6')&&_0x1edb13[_0x0caa('0x7')]()?_0x1edb13[_0x0caa('0x7')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x0caa('0x2')],'defaultValue':_0x0caa('0x8')},'attach':{'type':Sequelize['ENUM'](_0x0caa('0x9'),'no'),'defaultValue':_0x0caa('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x0caa('0xa')]('yes','no'),'defaultValue':_0x0caa('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x0caa('0x2')]},'callback':{'type':Sequelize[_0x0caa('0x2')]},'review':{'type':Sequelize[_0x0caa('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x0caa('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0caa('0xa')](_0x0caa('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x0caa('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x0caa('0xa')](_0x0caa('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x0caa('0xa')](_0x0caa('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0caa('0xa')](_0x0caa('0x9'),'no'),'defaultValue':_0x0caa('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x0caa('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x0caa('0xa')](_0x0caa('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x0caa('0xa')](_0x0caa('0x9'),'no'),'defaultValue':_0x0caa('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x0caa('0x2')]},'emailbody':{'type':Sequelize[_0x0caa('0x2')]},'maxsecs':{'type':Sequelize[_0x0caa('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x0caa('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('fullname')+_0x0caa('0xd')+this[_0x0caa('0xe')](_0x0caa('0xf'));}}}; \ No newline at end of file +var _0x03ef=['TIMESTAMP','INTEGER','VIRTUAL','getDataValue','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','email','string','trim','yes','ENUM','TINYINT(4)'];(function(_0x17de24,_0x3c6c3c){var _0x4a7763=function(_0x56abe0){while(--_0x56abe0){_0x17de24['push'](_0x17de24['shift']());}};_0x4a7763(++_0x3c6c3c);}(_0x03ef,0x1a5));var _0xf03e=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x03ef[_0x11005e];return _0x29338f;};'use strict';var Sequelize=require(_0xf03e('0x0'));module[_0xf03e('0x1')]={'customer_id':{'type':Sequelize[_0xf03e('0x2')]},'context':{'type':Sequelize[_0xf03e('0x2')],'defaultValue':_0xf03e('0x3'),'unique':_0xf03e('0x4')},'mailbox':{'type':Sequelize[_0xf03e('0x2')],'defaultValue':'','allowNull':![],'unique':_0xf03e('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0xf03e('0x2')]},'email':{'type':Sequelize[_0xf03e('0x2')],'validate':{'isEmail':!![]},'set':function(_0x36be16){this['setDataValue'](_0xf03e('0x5'),typeof _0x36be16===_0xf03e('0x6')&&_0x36be16[_0xf03e('0x7')]()?_0x36be16['trim']():null);}},'pager':{'type':Sequelize[_0xf03e('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xf03e('0x8'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xf03e('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0xf03e('0x2')]},'callback':{'type':Sequelize[_0xf03e('0x2')]},'review':{'type':Sequelize[_0xf03e('0x9')](_0xf03e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xf03e('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xf03e('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xf03e('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xf03e('0x8'),'no'),'defaultValue':_0xf03e('0x8'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0xf03e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xf03e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xf03e('0x9')](_0xf03e('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xf03e('0xb')},'emailsubject':{'type':Sequelize[_0xf03e('0x2')]},'emailbody':{'type':Sequelize[_0xf03e('0x2')]},'maxsecs':{'type':Sequelize[_0xf03e('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xf03e('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xf03e('0xd')],'get':function(){return this['getDataValue']('fullname')+'\x20-\x20'+this[_0xf03e('0xe')](_0xf03e('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index e61f542..0aa0104 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 _0x2e54=['keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','findOne','VoiceMailMessage','hasOwnProperty','pick','mailbox','findAndCountAll','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','get','Voicemails','stack','name','send','index','map','rawAttributes','fieldName','type','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','VoiceMail','includeAll','include','findAll','rows','catch','show','params'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x2e54,0x1dd));var _0x42e5=function(_0xe0e29,_0x52dd59){_0xe0e29=_0xe0e29-0x0;var _0x36e4fa=_0x2e54[_0xe0e29];return _0x36e4fa;};'use strict';var emlformat=require(_0x42e5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x42e5('0x1'));var rp=require(_0x42e5('0x2'));var moment=require(_0x42e5('0x3'));var BPromise=require(_0x42e5('0x4'));var Mustache=require(_0x42e5('0x5'));var util=require(_0x42e5('0x6'));var path=require(_0x42e5('0x7'));var sox=require('sox');var csv=require(_0x42e5('0x8'));var ejs=require(_0x42e5('0x9'));var fs=require('fs');var fs_extra=require(_0x42e5('0xa'));var _=require('lodash');var squel=require(_0x42e5('0xb'));var crypto=require('crypto');var jsforce=require(_0x42e5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x42e5('0x8'));var querystring=require(_0x42e5('0xd'));var Papa=require(_0x42e5('0xe'));var Redis=require(_0x42e5('0xf'));var authService=require(_0x42e5('0x10'));var qs=require(_0x42e5('0x11'));var as=require(_0x42e5('0x12'));var hardwareService=require(_0x42e5('0x13'));var logger=require(_0x42e5('0x14'))('api');var utils=require(_0x42e5('0x15'));var config=require(_0x42e5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x42e5('0x17'))['db'];function respondWithStatusCode(_0x12385d,_0x4530ba){_0x4530ba=_0x4530ba||0xcc;return function(_0x41598d){if(_0x41598d){return _0x12385d[_0x42e5('0x18')](_0x4530ba);}return _0x12385d[_0x42e5('0x19')](_0x4530ba)[_0x42e5('0x1a')]();};}function respondWithResult(_0x96fae2,_0x447648){_0x447648=_0x447648||0xc8;return function(_0x23957f){if(_0x23957f){return _0x96fae2['status'](_0x447648)[_0x42e5('0x1b')](_0x23957f);}};}function respondWithFilteredResult(_0x1d8e52,_0x4034bd){return function(_0x388300){if(_0x388300){var _0x2f4999=typeof _0x4034bd[_0x42e5('0x1c')]===_0x42e5('0x1d')&&typeof _0x4034bd[_0x42e5('0x1e')]===_0x42e5('0x1d');var _0x3c7b79=_0x388300[_0x42e5('0x1f')];var _0x38282d=_0x2f4999?0x0:_0x4034bd[_0x42e5('0x1c')];var _0x23fe09=_0x2f4999?_0x388300['count']:_0x4034bd[_0x42e5('0x1c')]+_0x4034bd['limit'];var _0x5f4428;if(_0x23fe09>=_0x3c7b79){_0x23fe09=_0x3c7b79;_0x5f4428=0xc8;}else{_0x5f4428=0xce;}_0x1d8e52[_0x42e5('0x19')](_0x5f4428);return _0x1d8e52[_0x42e5('0x20')]('Content-Range',_0x38282d+'-'+_0x23fe09+'/'+_0x3c7b79)[_0x42e5('0x1b')](_0x388300);}return null;};}function patchUpdates(_0x39a3e2){return function(_0x1c2169){try{jsonpatch[_0x42e5('0x21')](_0x1c2169,_0x39a3e2,!![]);}catch(_0x1150f4){return BPromise[_0x42e5('0x22')](_0x1150f4);}return _0x1c2169[_0x42e5('0x23')]();};}function saveUpdates(_0x58eee5,_0x4da508){return function(_0x283d44){if(_0x283d44){return _0x283d44['update'](_0x58eee5)[_0x42e5('0x24')](function(_0x2e9574){return _0x2e9574;});}return null;};}function removeEntity(_0x37d10e,_0x49490f){return function(_0x32380f){if(_0x32380f){return _0x32380f['destroy']()[_0x42e5('0x24')](function(){var _0xf29221=_0x32380f[_0x42e5('0x25')]({'plain':!![]});var _0x275c80=_0x42e5('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x275c80,'resourceId':_0xf29221['id']}})[_0x42e5('0x24')](function(){return _0x32380f;});})['then'](function(){_0x37d10e['status'](0xcc)[_0x42e5('0x1a')]();});}};}function handleEntityNotFound(_0x5b1727,_0x392c6b){return function(_0x2d9e65){if(!_0x2d9e65){_0x5b1727[_0x42e5('0x18')](0x194);}return _0x2d9e65;};}function handleError(_0x1c8ee4,_0x27ae27){_0x27ae27=_0x27ae27||0x1f4;return function(_0x2f1edc){logger['error'](_0x2f1edc[_0x42e5('0x27')]);if(_0x2f1edc[_0x42e5('0x28')]){delete _0x2f1edc[_0x42e5('0x28')];}_0x1c8ee4[_0x42e5('0x19')](_0x27ae27)[_0x42e5('0x29')](_0x2f1edc);};}exports[_0x42e5('0x2a')]=function(_0x383e97,_0x282cbf){var _0x5a4930={},_0x2ba9ef={},_0x2c7542={'count':0x0,'rows':[]};var _0x3d9e8b=_[_0x42e5('0x2b')](db['VoiceMail'][_0x42e5('0x2c')],function(_0xf5a3dc){return{'name':_0xf5a3dc[_0x42e5('0x2d')],'type':_0xf5a3dc[_0x42e5('0x2e')]['key']};});_0x2ba9ef['model']=_[_0x42e5('0x2b')](_0x3d9e8b,'name');_0x2ba9ef[_0x42e5('0x2f')]=_['keys'](_0x383e97[_0x42e5('0x2f')]);_0x2ba9ef[_0x42e5('0x30')]=_[_0x42e5('0x31')](_0x2ba9ef['model'],_0x2ba9ef[_0x42e5('0x2f')]);_0x5a4930[_0x42e5('0x32')]=_['intersection'](_0x2ba9ef[_0x42e5('0x33')],qs['fields'](_0x383e97[_0x42e5('0x2f')][_0x42e5('0x34')]));_0x5a4930[_0x42e5('0x32')]=_0x5a4930[_0x42e5('0x32')][_0x42e5('0x35')]?_0x5a4930[_0x42e5('0x32')]:_0x2ba9ef[_0x42e5('0x33')];if(!_0x383e97['query']['hasOwnProperty'](_0x42e5('0x36'))){_0x5a4930[_0x42e5('0x1e')]=qs[_0x42e5('0x1e')](_0x383e97['query']['limit']);_0x5a4930['offset']=qs['offset'](_0x383e97[_0x42e5('0x2f')][_0x42e5('0x1c')]);}_0x5a4930[_0x42e5('0x37')]=qs[_0x42e5('0x38')](_0x383e97[_0x42e5('0x2f')][_0x42e5('0x38')]);_0x5a4930[_0x42e5('0x39')]=qs[_0x42e5('0x30')](_['pick'](_0x383e97[_0x42e5('0x2f')],_0x2ba9ef['filters']),_0x3d9e8b);if(_0x383e97[_0x42e5('0x2f')][_0x42e5('0x3a')]){_0x5a4930[_0x42e5('0x39')]=_[_0x42e5('0x3b')](_0x5a4930[_0x42e5('0x39')],{'$or':_[_0x42e5('0x2b')](_0x3d9e8b,function(_0xd5e7f5){if(_0xd5e7f5['type']!==_0x42e5('0x3c')){var _0x356ff6={};_0x356ff6[_0xd5e7f5['name']]={'$like':'%'+_0x383e97[_0x42e5('0x2f')]['filter']+'%'};return _0x356ff6;}})});}_0x5a4930=_['merge']({},_0x5a4930,_0x383e97['options']);var _0x1105ea={'where':_0x5a4930[_0x42e5('0x39')]};return db[_0x42e5('0x3d')][_0x42e5('0x1f')](_0x1105ea)[_0x42e5('0x24')](function(_0x77aa22){_0x2c7542[_0x42e5('0x1f')]=_0x77aa22;if(_0x383e97['query'][_0x42e5('0x3e')]){_0x5a4930[_0x42e5('0x3f')]=[{'all':!![]}];}return db['VoiceMail'][_0x42e5('0x40')](_0x5a4930);})[_0x42e5('0x24')](function(_0x5db771){_0x2c7542[_0x42e5('0x41')]=_0x5db771;return _0x2c7542;})[_0x42e5('0x24')](respondWithFilteredResult(_0x282cbf,_0x5a4930))[_0x42e5('0x42')](handleError(_0x282cbf,null));};exports[_0x42e5('0x43')]=function(_0x424304,_0x4d32f4){var _0x41e1fd={'raw':!![],'where':{'id':_0x424304[_0x42e5('0x44')]['id']}},_0xc34e51={};_0xc34e51[_0x42e5('0x33')]=_['keys'](db[_0x42e5('0x3d')][_0x42e5('0x2c')]);_0xc34e51[_0x42e5('0x2f')]=_[_0x42e5('0x45')](_0x424304[_0x42e5('0x2f')]);_0xc34e51[_0x42e5('0x30')]=_[_0x42e5('0x31')](_0xc34e51[_0x42e5('0x33')],_0xc34e51['query']);_0x41e1fd[_0x42e5('0x32')]=_['intersection'](_0xc34e51['model'],qs[_0x42e5('0x34')](_0x424304[_0x42e5('0x2f')][_0x42e5('0x34')]));_0x41e1fd[_0x42e5('0x32')]=_0x41e1fd[_0x42e5('0x32')][_0x42e5('0x35')]?_0x41e1fd[_0x42e5('0x32')]:_0xc34e51['model'];if(_0x424304[_0x42e5('0x2f')][_0x42e5('0x3e')]){_0x41e1fd[_0x42e5('0x3f')]=[{'all':!![]}];}_0x41e1fd=_[_0x42e5('0x3b')]({},_0x41e1fd,_0x424304[_0x42e5('0x46')]);return db[_0x42e5('0x3d')][_0x42e5('0x47')](_0x41e1fd)[_0x42e5('0x24')](handleEntityNotFound(_0x4d32f4,null))['then'](respondWithResult(_0x4d32f4,null))[_0x42e5('0x42')](handleError(_0x4d32f4,null));};exports[_0x42e5('0x48')]=function(_0x3616f4,_0x48757e){return db[_0x42e5('0x3d')][_0x42e5('0x48')](_0x3616f4[_0x42e5('0x49')],{})[_0x42e5('0x24')](function(_0x2586b0){var _0x528ddd=_0x3616f4[_0x42e5('0x4a')]['get']({'plain':!![]});if(!_0x528ddd)throw new Error(_0x42e5('0x4b'));if(_0x528ddd[_0x42e5('0x4c')]===_0x42e5('0x4a')){var _0x48b63b=_0x2586b0['get']({'plain':!![]});var _0x4f0639=_0x42e5('0x26');return db[_0x42e5('0x4d')][_0x42e5('0x47')]({'where':{'name':_0x4f0639,'userProfileId':_0x528ddd[_0x42e5('0x4e')]},'raw':!![]})['then'](function(_0x3ae9de){if(_0x3ae9de&&_0x3ae9de[_0x42e5('0x4f')]===0x0){return db[_0x42e5('0x50')]['create']({'name':_0x48b63b[_0x42e5('0x28')],'resourceId':_0x48b63b['id'],'type':_0x3ae9de['name'],'sectionId':_0x3ae9de['id']},{})[_0x42e5('0x24')](function(){return _0x2586b0;});}else{return _0x2586b0;}})[_0x42e5('0x42')](function(_0x53e29b){logger[_0x42e5('0x51')](_0x42e5('0x52'),_0x53e29b);throw _0x53e29b;});}return _0x2586b0;})[_0x42e5('0x24')](respondWithResult(_0x48757e,0xc9))[_0x42e5('0x42')](handleError(_0x48757e,null));};exports[_0x42e5('0x53')]=function(_0x3f043f,_0x41c1dc){if(_0x3f043f[_0x42e5('0x49')]['id']){delete _0x3f043f[_0x42e5('0x49')]['id'];}return db[_0x42e5('0x3d')]['find']({'where':{'id':_0x3f043f[_0x42e5('0x44')]['id']}})[_0x42e5('0x24')](handleEntityNotFound(_0x41c1dc,null))[_0x42e5('0x24')](saveUpdates(_0x3f043f[_0x42e5('0x49')],null))[_0x42e5('0x24')](respondWithResult(_0x41c1dc,null))['catch'](handleError(_0x41c1dc,null));};exports[_0x42e5('0x54')]=function(_0x2b226f,_0x40b633){return db[_0x42e5('0x3d')]['find']({'where':{'id':_0x2b226f['params']['id']}})['then'](handleEntityNotFound(_0x40b633,null))[_0x42e5('0x24')](removeEntity(_0x40b633,null))[_0x42e5('0x42')](handleError(_0x40b633,null));};exports['getMessages']=function(_0x42094e,_0xb73aa8,_0x10346e){return db[_0x42e5('0x3d')][_0x42e5('0x55')]({'where':{'id':_0x42094e[_0x42e5('0x44')]['id']}})[_0x42e5('0x24')](handleEntityNotFound(_0xb73aa8,null))[_0x42e5('0x24')](function(_0x3692fc){var _0x5688a4;var _0x2911e0={},_0x517d03={};_0x517d03[_0x42e5('0x33')]=_[_0x42e5('0x45')](db[_0x42e5('0x56')][_0x42e5('0x2c')]);_0x517d03[_0x42e5('0x2f')]=_[_0x42e5('0x45')](_0x42094e[_0x42e5('0x2f')]);_0x517d03[_0x42e5('0x30')]=_[_0x42e5('0x31')](_0x517d03[_0x42e5('0x33')],_0x517d03[_0x42e5('0x2f')]);_0x2911e0['attributes']=_[_0x42e5('0x31')](_0x517d03['model'],qs[_0x42e5('0x34')](_0x42094e['query'][_0x42e5('0x34')]));_0x2911e0[_0x42e5('0x32')]=_0x2911e0['attributes'][_0x42e5('0x35')]?_0x2911e0[_0x42e5('0x32')]:_0x517d03['model'];if(!_0x42094e[_0x42e5('0x2f')][_0x42e5('0x57')]('nolimit')){_0x2911e0[_0x42e5('0x1e')]=qs[_0x42e5('0x1e')](_0x42094e[_0x42e5('0x2f')]['limit']);_0x2911e0[_0x42e5('0x1c')]=qs[_0x42e5('0x1c')](_0x42094e[_0x42e5('0x2f')][_0x42e5('0x1c')]);}_0x2911e0['order']=qs[_0x42e5('0x38')](_0x42094e['query'][_0x42e5('0x38')]);_0x2911e0[_0x42e5('0x39')]=qs[_0x42e5('0x30')](_[_0x42e5('0x58')](_0x42094e[_0x42e5('0x2f')],_0x517d03[_0x42e5('0x30')]));if(_0x42094e[_0x42e5('0x2f')]['filter']){_0x2911e0[_0x42e5('0x39')]=_[_0x42e5('0x3b')](_0x2911e0[_0x42e5('0x39')],{'$or':_[_0x42e5('0x2b')](_0x2911e0[_0x42e5('0x32')],function(_0x8c4a77){var _0xfef629={};_0xfef629[_0x8c4a77]={'$like':'%'+_0x42094e[_0x42e5('0x2f')][_0x42e5('0x3a')]+'%'};return _0xfef629;})});}_0x2911e0['where']=_[_0x42e5('0x3b')](_0x2911e0[_0x42e5('0x39')],{'mailboxuser':_0x3692fc[_0x42e5('0x59')]});_0x2911e0=_[_0x42e5('0x3b')]({},_0x2911e0,_0x42094e['options']);return db[_0x42e5('0x56')][_0x42e5('0x5a')](_0x2911e0)[_0x42e5('0x24')](respondWithFilteredResult(_0xb73aa8,_0x2911e0));})[_0x42e5('0x42')](handleError(_0xb73aa8,null));}; \ No newline at end of file +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(_0x1ffbf7,_0x5424c5){var _0x320460=function(_0x42011a){while(--_0x42011a){_0x1ffbf7['push'](_0x1ffbf7['shift']());}};_0x320460(++_0x5424c5);}(_0x2f68,0x9a));var _0x82f6=function(_0x159aa6,_0x5e1c49){_0x159aa6=_0x159aa6-0x0;var _0x20f934=_0x2f68[_0x159aa6];return _0x20f934;};'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 diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 1902891..870442f 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 _0x069f=['path','rimraf','../../config/environment','./voiceMail.attributes','exports','voice_voicemail','mailbox_context','mailbox','context','lodash','util','api','moment','bluebird','request-promise'];(function(_0x488e6b,_0x26e34b){var _0x450733=function(_0x53a2db){while(--_0x53a2db){_0x488e6b['push'](_0x488e6b['shift']());}};_0x450733(++_0x26e34b);}(_0x069f,0x19e));var _0xf069=function(_0x36f99f,_0x10dfa2){_0x36f99f=_0x36f99f-0x0;var _0x85cb3b=_0x069f[_0x36f99f];return _0x85cb3b;};'use strict';var _=require(_0xf069('0x0'));var util=require(_0xf069('0x1'));var logger=require('../../config/logger')(_0xf069('0x2'));var moment=require(_0xf069('0x3'));var BPromise=require(_0xf069('0x4'));var rp=require(_0xf069('0x5'));var fs=require('fs');var path=require(_0xf069('0x6'));var rimraf=require(_0xf069('0x7'));var config=require(_0xf069('0x8'));var attributes=require(_0xf069('0x9'));module[_0xf069('0xa')]=function(_0x3f50ac,_0x257059){return _0x3f50ac['define']('VoiceMail',attributes,{'tableName':_0xf069('0xb'),'paranoid':![],'indexes':[{'name':_0xf069('0xc'),'fields':[_0xf069('0xd'),_0xf069('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa009=['mailbox','context','util','../../config/logger','moment','bluebird','path','rimraf','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0xa009,0xf0));var _0x9a00=function(_0x3878ed,_0x3ed27e){_0x3878ed=_0x3878ed-0x0;var _0xba9b7e=_0xa009[_0x3878ed];return _0xba9b7e;};'use strict';var _=require('lodash');var util=require(_0x9a00('0x0'));var logger=require(_0x9a00('0x1'))('api');var moment=require(_0x9a00('0x2'));var BPromise=require(_0x9a00('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9a00('0x4'));var rimraf=require(_0x9a00('0x5'));var config=require('../../config/environment');var attributes=require(_0x9a00('0x6'));module[_0x9a00('0x7')]=function(_0x2b47c9,_0x37cd8b){return _0x2b47c9[_0x9a00('0x8')](_0x9a00('0x9'),attributes,{'tableName':_0x9a00('0xa'),'paranoid':![],'indexes':[{'name':_0x9a00('0xb'),'fields':[_0x9a00('0xc'),_0x9a00('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 1e0bf41..e83aa66 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 _0xd62e=['VoiceMail,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info'];(function(_0x3f14ed,_0x26d504){var _0x1294f3=function(_0x44a3f6){while(--_0x44a3f6){_0x3f14ed['push'](_0x3f14ed['shift']());}};_0x1294f3(++_0x26d504);}(_0xd62e,0xf0));var _0xed62=function(_0x5f40c2,_0xa4b23e){_0x5f40c2=_0x5f40c2-0x0;var _0x504336=_0xd62e[_0x5f40c2];return _0x504336;};'use strict';var _=require('lodash');var util=require(_0xed62('0x0'));var moment=require('moment');var BPromise=require(_0xed62('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed62('0x2'));var db=require(_0xed62('0x3'))['db'];var utils=require(_0xed62('0x4'));var logger=require(_0xed62('0x5'))(_0xed62('0x6'));var config=require('../../config/environment');var jayson=require(_0xed62('0x7'));var client=jayson[_0xed62('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f9110,_0x413893,_0x2f61c5){return new BPromise(function(_0xbe6083,_0x1c3941){return client[_0xed62('0x9')](_0x2f9110,_0x2f61c5)[_0xed62('0xa')](function(_0x1442a0){logger[_0xed62('0xb')](_0xed62('0xc'),_0x413893,'request\x20sent');logger[_0xed62('0xd')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x413893,_0xed62('0xe'),JSON[_0xed62('0xf')](_0x1442a0));if(_0x1442a0[_0xed62('0x10')]){if(_0x1442a0['error'][_0xed62('0x11')]===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x413893,_0x1442a0['error'][_0xed62('0x12')]);return _0x1c3941(_0x1442a0[_0xed62('0x10')][_0xed62('0x12')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x413893,_0x1442a0['error'][_0xed62('0x12')]);return _0xbe6083(_0x1442a0[_0xed62('0x10')][_0xed62('0x12')]);}else{logger['info'](_0xed62('0xc'),_0x413893,_0xed62('0xe'));_0xbe6083(_0x1442a0[_0xed62('0x13')][_0xed62('0x12')]);}})[_0xed62('0x14')](function(_0x2dc0c9){logger['error']('VoiceMail,\x20%s,\x20%s',_0x413893,_0x2dc0c9);_0x1c3941(_0x2dc0c9);});});} \ No newline at end of file +var _0x7c81=['http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','client'];(function(_0x3c9e4e,_0x16b640){var _0x365d8c=function(_0x2605c0){while(--_0x2605c0){_0x3c9e4e['push'](_0x3c9e4e['shift']());}};_0x365d8c(++_0x16b640);}(_0x7c81,0x1ee));var _0x17c8=function(_0x2fbcf6,_0x2e7155){_0x2fbcf6=_0x2fbcf6-0x0;var _0x3e7265=_0x7c81[_0x2fbcf6];return _0x3e7265;};'use strict';var _=require(_0x17c8('0x0'));var util=require(_0x17c8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x17c8('0x2'));var fs=require('fs');var Redis=require(_0x17c8('0x3'));var db=require(_0x17c8('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x17c8('0x5')][_0x17c8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x18c32c,_0x3b9d15,_0x288855){return new BPromise(function(_0x471359,_0x4213c0){return client[_0x17c8('0x7')](_0x18c32c,_0x288855)[_0x17c8('0x8')](function(_0x2943b1){logger[_0x17c8('0x9')](_0x17c8('0xa'),_0x3b9d15,_0x17c8('0xb'));logger[_0x17c8('0xc')](_0x17c8('0xd'),_0x3b9d15,_0x17c8('0xb'),JSON[_0x17c8('0xe')](_0x2943b1));if(_0x2943b1[_0x17c8('0xf')]){if(_0x2943b1[_0x17c8('0xf')][_0x17c8('0x10')]===0x1f4){logger[_0x17c8('0xf')](_0x17c8('0xa'),_0x3b9d15,_0x2943b1['error']['message']);return _0x4213c0(_0x2943b1[_0x17c8('0xf')][_0x17c8('0x11')]);}logger[_0x17c8('0xf')](_0x17c8('0xa'),_0x3b9d15,_0x2943b1['error'][_0x17c8('0x11')]);return _0x471359(_0x2943b1[_0x17c8('0xf')][_0x17c8('0x11')]);}else{logger[_0x17c8('0x9')](_0x17c8('0xa'),_0x3b9d15,_0x17c8('0xb'));_0x471359(_0x2943b1[_0x17c8('0x12')][_0x17c8('0x11')]);}})[_0x17c8('0x13')](function(_0x10030c){logger[_0x17c8('0xf')](_0x17c8('0xa'),_0x3b9d15,_0x10030c);_0x4213c0(_0x10030c);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 76652cf..d840ef0 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 _0xdd44=['post','create','put','delete','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','isAuthenticated','index','/:id','get','/:id/download','download'];(function(_0xb4c5d2,_0x4d362b){var _0x11d58e=function(_0x18f210){while(--_0x18f210){_0xb4c5d2['push'](_0xb4c5d2['shift']());}};_0x11d58e(++_0x4d362b);}(_0xdd44,0xca));var _0x4dd4=function(_0x4be8ba,_0x5d10ba){_0x4be8ba=_0x4be8ba-0x0;var _0x1af822=_0xdd44[_0x4be8ba];return _0x1af822;};'use strict';var multer=require('multer');var util=require(_0x4dd4('0x0'));var path=require(_0x4dd4('0x1'));var timeout=require(_0x4dd4('0x2'));var express=require(_0x4dd4('0x3'));var router=express['Router']();var fs_extra=require(_0x4dd4('0x4'));var auth=require(_0x4dd4('0x5'));var interaction=require(_0x4dd4('0x6'));var config=require('../../config/environment');var controller=require(_0x4dd4('0x7'));router['get']('/',auth[_0x4dd4('0x8')](),controller[_0x4dd4('0x9')]);router['get'](_0x4dd4('0xa'),auth[_0x4dd4('0x8')](),controller['show']);router[_0x4dd4('0xb')](_0x4dd4('0xc'),auth[_0x4dd4('0x8')](),controller[_0x4dd4('0xd')]);router[_0x4dd4('0xe')]('/',auth[_0x4dd4('0x8')](),controller[_0x4dd4('0xf')]);router[_0x4dd4('0x10')](_0x4dd4('0xa'),auth[_0x4dd4('0x8')](),controller['update']);router[_0x4dd4('0x11')](_0x4dd4('0xa'),auth[_0x4dd4('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1bc4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','multer','util','path','Router','fs-extra'];(function(_0x409ad2,_0x5129c1){var _0x595b5f=function(_0x592974){while(--_0x592974){_0x409ad2['push'](_0x409ad2['shift']());}};_0x595b5f(++_0x5129c1);}(_0x1bc4,0x1c9));var _0x41bc=function(_0x3fc450,_0x2d13f4){_0x3fc450=_0x3fc450-0x0;var _0x13e8f4=_0x1bc4[_0x3fc450];return _0x13e8f4;};'use strict';var multer=require(_0x41bc('0x0'));var util=require(_0x41bc('0x1'));var path=require(_0x41bc('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x41bc('0x3')]();var fs_extra=require(_0x41bc('0x4'));var auth=require(_0x41bc('0x5'));var interaction=require(_0x41bc('0x6'));var config=require(_0x41bc('0x7'));var controller=require(_0x41bc('0x8'));router[_0x41bc('0x9')]('/',auth[_0x41bc('0xa')](),controller[_0x41bc('0xb')]);router[_0x41bc('0x9')](_0x41bc('0xc'),auth[_0x41bc('0xa')](),controller[_0x41bc('0xd')]);router['get'](_0x41bc('0xe'),auth[_0x41bc('0xa')](),controller[_0x41bc('0xf')]);router[_0x41bc('0x10')]('/',auth[_0x41bc('0xa')](),controller[_0x41bc('0x11')]);router[_0x41bc('0x12')](_0x41bc('0xc'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x13')]);router[_0x41bc('0x14')]('/:id',auth[_0x41bc('0xa')](),controller[_0x41bc('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 34789e9..b48e924 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 _0x698e=['exports','getDataValue','INTEGER','STRING','BLOB','long','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x4d9bb2,_0x3db50d){var _0x3179fe=function(_0x5272f3){while(--_0x5272f3){_0x4d9bb2['push'](_0x4d9bb2['shift']());}};_0x3179fe(++_0x3db50d);}(_0x698e,0x88));var _0xe698=function(_0x575d0a,_0x19dbcf){_0x575d0a=_0x575d0a-0x0;var _0x25eca9=_0x698e[_0x575d0a];return _0x25eca9;};'use strict';var Sequelize=require('sequelize');module[_0xe698('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2a5f01){return this[_0xe698('0x1')]('id');}},'msgnum':{'type':Sequelize[_0xe698('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xe698('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xe698('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xe698('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xe698('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xe698('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xe698('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xe698('0x4')](_0xe698('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xe698('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xe698('0x3')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xe698('0x6')](_0xe698('0x7'))}}; \ No newline at end of file +var _0x6fb6=['VIRTUAL','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports'];(function(_0x18d5d1,_0xbb2704){var _0x52467=function(_0x39c312){while(--_0x39c312){_0x18d5d1['push'](_0x18d5d1['shift']());}};_0x52467(++_0xbb2704);}(_0x6fb6,0x1b6));var _0x66fb=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x6fb6[_0x32d457];return _0x338386;};'use strict';var Sequelize=require(_0x66fb('0x0'));module[_0x66fb('0x1')]={'name':{'type':Sequelize[_0x66fb('0x2')],'get':function(_0x5e1360){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x66fb('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x66fb('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x66fb('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x66fb('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x66fb('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x66fb('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x66fb('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x66fb('0x5')](_0x66fb('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x66fb('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x66fb('0x4')],'defaultValue':''},'stamp':{'type':_0x66fb('0x7'),'defaultValue':Sequelize[_0x66fb('0x8')](_0x66fb('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 271bb68..35139b7 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 _0xac51=['keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','where','filter','merge','options','includeAll','include','findAll','rows','show','length','find','create','body','catch','update','params','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','VoiceMailMessage','rawAttributes','fieldName','type','key','differenceBy','query'];(function(_0x15b7a6,_0x3a19bb){var _0x1d4596=function(_0x1c33e2){while(--_0x1c33e2){_0x15b7a6['push'](_0x15b7a6['shift']());}};_0x1d4596(++_0x3a19bb);}(_0xac51,0x122));var _0x1ac5=function(_0x50ff97,_0x3a86de){_0x50ff97=_0x50ff97-0x0;var _0x3dff58=_0xac51[_0x50ff97];return _0x3dff58;};'use strict';var emlformat=require(_0x1ac5('0x0'));var rimraf=require(_0x1ac5('0x1'));var zipdir=require(_0x1ac5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1ac5('0x3'));var moment=require(_0x1ac5('0x4'));var BPromise=require(_0x1ac5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1ac5('0x6'));var sox=require(_0x1ac5('0x7'));var csv=require(_0x1ac5('0x8'));var ejs=require(_0x1ac5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1ac5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1ac5('0xb'));var toCsv=require(_0x1ac5('0x8'));var querystring=require('querystring');var Papa=require(_0x1ac5('0xc'));var Redis=require(_0x1ac5('0xd'));var authService=require(_0x1ac5('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ac5('0xf'));var logger=require(_0x1ac5('0x10'))(_0x1ac5('0x11'));var utils=require(_0x1ac5('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x1ac5('0x13'));var db=require(_0x1ac5('0x14'))['db'];function respondWithStatusCode(_0x2c157d,_0x50932f){_0x50932f=_0x50932f||0xcc;return function(_0x4703aa){if(_0x4703aa){return _0x2c157d['sendStatus'](_0x50932f);}return _0x2c157d[_0x1ac5('0x15')](_0x50932f)[_0x1ac5('0x16')]();};}function respondWithResult(_0x3c2380,_0x1cf035){_0x1cf035=_0x1cf035||0xc8;return function(_0x1fd131){if(_0x1fd131){return _0x3c2380[_0x1ac5('0x15')](_0x1cf035)[_0x1ac5('0x17')](_0x1fd131);}};}function respondWithFilteredResult(_0x4a83ab,_0x59e9fe){return function(_0x57df1e){if(_0x57df1e){var _0x4ec1c7=typeof _0x59e9fe[_0x1ac5('0x18')]===_0x1ac5('0x19')&&typeof _0x59e9fe[_0x1ac5('0x1a')]===_0x1ac5('0x19');var _0x20c3bb=_0x57df1e[_0x1ac5('0x1b')];var _0xc1d2e7=_0x4ec1c7?0x0:_0x59e9fe['offset'];var _0xe296bd=_0x4ec1c7?_0x57df1e[_0x1ac5('0x1b')]:_0x59e9fe[_0x1ac5('0x18')]+_0x59e9fe[_0x1ac5('0x1a')];var _0x9e440c;if(_0xe296bd>=_0x20c3bb){_0xe296bd=_0x20c3bb;_0x9e440c=0xc8;}else{_0x9e440c=0xce;}_0x4a83ab[_0x1ac5('0x15')](_0x9e440c);return _0x4a83ab['set'](_0x1ac5('0x1c'),_0xc1d2e7+'-'+_0xe296bd+'/'+_0x20c3bb)[_0x1ac5('0x17')](_0x57df1e);}return null;};}function patchUpdates(_0x1883d3){return function(_0xbe87ee){try{jsonpatch[_0x1ac5('0x1d')](_0xbe87ee,_0x1883d3,!![]);}catch(_0x17cc2f){return BPromise[_0x1ac5('0x1e')](_0x17cc2f);}return _0xbe87ee[_0x1ac5('0x1f')]();};}function saveUpdates(_0x13cb06,_0x4bbf55){return function(_0x568a0f){if(_0x568a0f){return _0x568a0f['update'](_0x13cb06)[_0x1ac5('0x20')](function(_0x41336c){return _0x41336c;});}return null;};}function removeEntity(_0xa6ba5d,_0x2f3906){return function(_0x29074f){if(_0x29074f){return _0x29074f[_0x1ac5('0x21')]()[_0x1ac5('0x20')](function(){_0xa6ba5d[_0x1ac5('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5eb1d8,_0x361094){return function(_0x591327){if(!_0x591327){_0x5eb1d8['sendStatus'](0x194);}return _0x591327;};}function handleError(_0x11d41a,_0x2f83ca){_0x2f83ca=_0x2f83ca||0x1f4;return function(_0x91c868){logger[_0x1ac5('0x22')](_0x91c868[_0x1ac5('0x23')]);if(_0x91c868[_0x1ac5('0x24')]){delete _0x91c868[_0x1ac5('0x24')];}_0x11d41a[_0x1ac5('0x15')](_0x2f83ca)[_0x1ac5('0x25')](_0x91c868);};}exports['index']=function(_0x37ba68,_0x16b2bf){var _0x46079c={},_0x335ebd={},_0x59083d={'count':0x0,'rows':[]};var _0x21233d=_[_0x1ac5('0x26')](db[_0x1ac5('0x27')][_0x1ac5('0x28')],function(_0xf8b3c4){return{'name':_0xf8b3c4[_0x1ac5('0x29')],'type':_0xf8b3c4[_0x1ac5('0x2a')][_0x1ac5('0x2b')]};});_0x335ebd['model']=_[_0x1ac5('0x2c')](_[_0x1ac5('0x26')](_0x21233d,'name'),[_0x1ac5('0x24')]);_0x335ebd[_0x1ac5('0x2d')]=_[_0x1ac5('0x2e')](_0x37ba68['query']);_0x335ebd[_0x1ac5('0x2f')]=_['intersection'](_0x335ebd[_0x1ac5('0x30')],_0x335ebd[_0x1ac5('0x2d')]);_0x46079c[_0x1ac5('0x31')]=_[_0x1ac5('0x32')](_0x335ebd[_0x1ac5('0x30')],qs[_0x1ac5('0x33')](_0x37ba68[_0x1ac5('0x2d')][_0x1ac5('0x33')]));_0x46079c['attributes']=_0x46079c[_0x1ac5('0x31')]['length']?_0x46079c[_0x1ac5('0x31')]:_0x335ebd[_0x1ac5('0x30')];if(!_0x37ba68[_0x1ac5('0x2d')][_0x1ac5('0x34')](_0x1ac5('0x35'))){_0x46079c[_0x1ac5('0x1a')]=qs[_0x1ac5('0x1a')](_0x37ba68[_0x1ac5('0x2d')][_0x1ac5('0x1a')]);_0x46079c['offset']=qs[_0x1ac5('0x18')](_0x37ba68[_0x1ac5('0x2d')][_0x1ac5('0x18')]);}_0x46079c[_0x1ac5('0x36')]=qs[_0x1ac5('0x37')](_0x37ba68[_0x1ac5('0x2d')][_0x1ac5('0x37')]);_0x46079c['where']=qs[_0x1ac5('0x2f')](_[_0x1ac5('0x38')](_0x37ba68[_0x1ac5('0x2d')],_0x335ebd[_0x1ac5('0x2f')]),_0x21233d);if(_0x37ba68[_0x1ac5('0x2d')]['filter']){_0x46079c[_0x1ac5('0x39')]=_['merge'](_0x46079c[_0x1ac5('0x39')],{'$or':_[_0x1ac5('0x26')](_0x21233d,function(_0x8ef5a3){if(_0x8ef5a3[_0x1ac5('0x2a')]!=='VIRTUAL'){var _0x4eeca1={};_0x4eeca1[_0x8ef5a3['name']]={'$like':'%'+_0x37ba68[_0x1ac5('0x2d')][_0x1ac5('0x3a')]+'%'};return _0x4eeca1;}})});}_0x46079c=_[_0x1ac5('0x3b')]({},_0x46079c,_0x37ba68[_0x1ac5('0x3c')]);var _0x1c4c32={'where':_0x46079c[_0x1ac5('0x39')]};return db[_0x1ac5('0x27')][_0x1ac5('0x1b')](_0x1c4c32)[_0x1ac5('0x20')](function(_0x5884f8){_0x59083d[_0x1ac5('0x1b')]=_0x5884f8;if(_0x37ba68[_0x1ac5('0x2d')][_0x1ac5('0x3d')]){_0x46079c[_0x1ac5('0x3e')]=[{'all':!![]}];}return db[_0x1ac5('0x27')][_0x1ac5('0x3f')](_0x46079c);})[_0x1ac5('0x20')](function(_0x85e6ab){_0x59083d[_0x1ac5('0x40')]=_0x85e6ab;return _0x59083d;})[_0x1ac5('0x20')](respondWithFilteredResult(_0x16b2bf,_0x46079c))['catch'](handleError(_0x16b2bf,null));};exports[_0x1ac5('0x41')]=function(_0x5ad15a,_0x57c72f){var _0x20d023={'raw':!![],'where':{'id':_0x5ad15a['params']['id']}},_0x1c8bbc={};_0x1c8bbc[_0x1ac5('0x30')]=_[_0x1ac5('0x2e')](db['VoiceMailMessage'][_0x1ac5('0x28')]);_0x1c8bbc[_0x1ac5('0x2d')]=_[_0x1ac5('0x2e')](_0x5ad15a[_0x1ac5('0x2d')]);_0x1c8bbc['filters']=_['intersection'](_0x1c8bbc[_0x1ac5('0x30')],_0x1c8bbc[_0x1ac5('0x2d')]);_0x20d023[_0x1ac5('0x31')]=_[_0x1ac5('0x32')](_0x1c8bbc['model'],qs[_0x1ac5('0x33')](_0x5ad15a[_0x1ac5('0x2d')][_0x1ac5('0x33')]));_0x20d023[_0x1ac5('0x31')]=_0x20d023[_0x1ac5('0x31')][_0x1ac5('0x42')]?_0x20d023[_0x1ac5('0x31')]:_0x1c8bbc[_0x1ac5('0x30')];if(_0x5ad15a['query'][_0x1ac5('0x3d')]){_0x20d023[_0x1ac5('0x3e')]=[{'all':!![]}];}_0x20d023=_[_0x1ac5('0x3b')]({},_0x20d023,_0x5ad15a[_0x1ac5('0x3c')]);return db['VoiceMailMessage'][_0x1ac5('0x43')](_0x20d023)[_0x1ac5('0x20')](handleEntityNotFound(_0x57c72f,null))[_0x1ac5('0x20')](respondWithResult(_0x57c72f,null))['catch'](handleError(_0x57c72f,null));};exports[_0x1ac5('0x44')]=function(_0x84888f,_0x1802d0){return db[_0x1ac5('0x27')][_0x1ac5('0x44')](_0x84888f[_0x1ac5('0x45')],{})[_0x1ac5('0x20')](respondWithResult(_0x1802d0,0xc9))[_0x1ac5('0x46')](handleError(_0x1802d0,null));};exports[_0x1ac5('0x47')]=function(_0x35595f,_0x132e9b){if(_0x35595f[_0x1ac5('0x45')]['id']){delete _0x35595f['body']['id'];}return db[_0x1ac5('0x27')][_0x1ac5('0x43')]({'where':{'id':_0x35595f[_0x1ac5('0x48')]['id']}})[_0x1ac5('0x20')](handleEntityNotFound(_0x132e9b,null))[_0x1ac5('0x20')](saveUpdates(_0x35595f['body'],null))['then'](respondWithResult(_0x132e9b,null))['catch'](handleError(_0x132e9b,null));};exports[_0x1ac5('0x21')]=function(_0x96c958,_0x17e035){return db['VoiceMailMessage'][_0x1ac5('0x43')]({'where':{'id':_0x96c958[_0x1ac5('0x48')]['id']}})[_0x1ac5('0x20')](handleEntityNotFound(_0x17e035,null))['then'](removeEntity(_0x17e035,null))[_0x1ac5('0x46')](handleError(_0x17e035,null));};exports['download']=function(_0x1f3bbb,_0xa6cdcf,_0x429213){return db[_0x1ac5('0x27')][_0x1ac5('0x43')]({'where':{'id':_0x1f3bbb['params']['id']},'attributes':['id',_0x1ac5('0x49'),_0x1ac5('0x4a')]})[_0x1ac5('0x20')](handleEntityNotFound(_0xa6cdcf,null))['then'](function(_0x1881dc){if(_0x1881dc){if(!_0x1881dc[_0x1ac5('0x49')]){throw new db[(_0x1ac5('0x4b'))][(_0x1ac5('0x4c'))](_0x1ac5('0x4d'));}var _0x1c1298={'Content-Type':_0x1ac5('0x4e'),'Content-Disposition':_0x1ac5('0x4f')};if(_0x1881dc[_0x1ac5('0x4a')]){_0x1c1298[_0x1ac5('0x50')]=_0x1ac5('0x51')+_0x1881dc['msg_id']+_0x1ac5('0x52');}_0xa6cdcf[_0x1ac5('0x53')](_0x1c1298);return _0xa6cdcf[_0x1ac5('0x25')](new Buffer(_0x1881dc['recording']));}})['catch'](handleError(_0xa6cdcf,null));}; \ No newline at end of file +var _0x65fb=['fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','send','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs'];(function(_0x27a45e,_0x556bb4){var _0x1fca64=function(_0x19fa4f){while(--_0x19fa4f){_0x27a45e['push'](_0x27a45e['shift']());}};_0x1fca64(++_0x556bb4);}(_0x65fb,0x14f));var _0xb65f=function(_0x111311,_0x1e2f69){_0x111311=_0x111311-0x0;var _0x4cef39=_0x65fb[_0x111311];return _0x4cef39;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb65f('0x0'));var zipdir=require(_0xb65f('0x1'));var jsonpatch=require(_0xb65f('0x2'));var rp=require(_0xb65f('0x3'));var moment=require(_0xb65f('0x4'));var BPromise=require(_0xb65f('0x5'));var Mustache=require(_0xb65f('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xb65f('0x7'));var ejs=require(_0xb65f('0x8'));var fs=require('fs');var fs_extra=require(_0xb65f('0x9'));var _=require(_0xb65f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb65f('0xb'));var deskjs=require(_0xb65f('0xc'));var toCsv=require(_0xb65f('0x7'));var querystring=require(_0xb65f('0xd'));var Papa=require(_0xb65f('0xe'));var Redis=require(_0xb65f('0xf'));var authService=require(_0xb65f('0x10'));var qs=require(_0xb65f('0x11'));var as=require(_0xb65f('0x12'));var hardwareService=require(_0xb65f('0x13'));var logger=require(_0xb65f('0x14'))('api');var utils=require(_0xb65f('0x15'));var config=require(_0xb65f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb65f('0x17'))['db'];function respondWithStatusCode(_0x388114,_0x21df7f){_0x21df7f=_0x21df7f||0xcc;return function(_0x1a7c89){if(_0x1a7c89){return _0x388114['sendStatus'](_0x21df7f);}return _0x388114['status'](_0x21df7f)[_0xb65f('0x18')]();};}function respondWithResult(_0x1834ab,_0x37c4b3){_0x37c4b3=_0x37c4b3||0xc8;return function(_0x4ad5c8){if(_0x4ad5c8){return _0x1834ab[_0xb65f('0x19')](_0x37c4b3)[_0xb65f('0x1a')](_0x4ad5c8);}};}function respondWithFilteredResult(_0x5036e5,_0x3d06f9){return function(_0x6d72a4){if(_0x6d72a4){var _0x4e8ba5=typeof _0x3d06f9['offset']===_0xb65f('0x1b')&&typeof _0x3d06f9['limit']===_0xb65f('0x1b');var _0x2e3a48=_0x6d72a4[_0xb65f('0x1c')];var _0xec8079=_0x4e8ba5?0x0:_0x3d06f9[_0xb65f('0x1d')];var _0x1ccfe1=_0x4e8ba5?_0x6d72a4['count']:_0x3d06f9[_0xb65f('0x1d')]+_0x3d06f9[_0xb65f('0x1e')];var _0x28694d;if(_0x1ccfe1>=_0x2e3a48){_0x1ccfe1=_0x2e3a48;_0x28694d=0xc8;}else{_0x28694d=0xce;}_0x5036e5[_0xb65f('0x19')](_0x28694d);return _0x5036e5[_0xb65f('0x1f')](_0xb65f('0x20'),_0xec8079+'-'+_0x1ccfe1+'/'+_0x2e3a48)['json'](_0x6d72a4);}return null;};}function patchUpdates(_0x453322){return function(_0x26870e){try{jsonpatch[_0xb65f('0x21')](_0x26870e,_0x453322,!![]);}catch(_0x184a02){return BPromise[_0xb65f('0x22')](_0x184a02);}return _0x26870e['save']();};}function saveUpdates(_0x4b3838,_0x2b7851){return function(_0x1e4835){if(_0x1e4835){return _0x1e4835[_0xb65f('0x23')](_0x4b3838)[_0xb65f('0x24')](function(_0x4dd4a1){return _0x4dd4a1;});}return null;};}function removeEntity(_0x4ba521,_0x10bfaa){return function(_0x1ef14d){if(_0x1ef14d){return _0x1ef14d[_0xb65f('0x25')]()[_0xb65f('0x24')](function(){_0x4ba521[_0xb65f('0x19')](0xcc)[_0xb65f('0x18')]();});}};}function handleEntityNotFound(_0x3a0cfb,_0x34cf2f){return function(_0xccfcbe){if(!_0xccfcbe){_0x3a0cfb[_0xb65f('0x26')](0x194);}return _0xccfcbe;};}function handleError(_0x3731c6,_0x3f2e56){_0x3f2e56=_0x3f2e56||0x1f4;return function(_0x5cdc1c){logger[_0xb65f('0x27')](_0x5cdc1c[_0xb65f('0x28')]);if(_0x5cdc1c[_0xb65f('0x29')]){delete _0x5cdc1c[_0xb65f('0x29')];}_0x3731c6[_0xb65f('0x19')](_0x3f2e56)['send'](_0x5cdc1c);};}exports['index']=function(_0x51fbf4,_0xe0107d){var _0x32ad8e={},_0x2896f3={},_0x3fc0bd={'count':0x0,'rows':[]};var _0x3a12c0=_[_0xb65f('0x2a')](db[_0xb65f('0x2b')][_0xb65f('0x2c')],function(_0x4ff459){return{'name':_0x4ff459[_0xb65f('0x2d')],'type':_0x4ff459[_0xb65f('0x2e')][_0xb65f('0x2f')]};});_0x2896f3[_0xb65f('0x30')]=_['differenceBy'](_[_0xb65f('0x2a')](_0x3a12c0,'name'),[_0xb65f('0x29')]);_0x2896f3[_0xb65f('0x31')]=_[_0xb65f('0x32')](_0x51fbf4['query']);_0x2896f3[_0xb65f('0x33')]=_[_0xb65f('0x34')](_0x2896f3['model'],_0x2896f3[_0xb65f('0x31')]);_0x32ad8e[_0xb65f('0x35')]=_[_0xb65f('0x34')](_0x2896f3[_0xb65f('0x30')],qs['fields'](_0x51fbf4[_0xb65f('0x31')][_0xb65f('0x36')]));_0x32ad8e[_0xb65f('0x35')]=_0x32ad8e[_0xb65f('0x35')]['length']?_0x32ad8e[_0xb65f('0x35')]:_0x2896f3[_0xb65f('0x30')];if(!_0x51fbf4[_0xb65f('0x31')][_0xb65f('0x37')](_0xb65f('0x38'))){_0x32ad8e[_0xb65f('0x1e')]=qs[_0xb65f('0x1e')](_0x51fbf4[_0xb65f('0x31')][_0xb65f('0x1e')]);_0x32ad8e['offset']=qs['offset'](_0x51fbf4[_0xb65f('0x31')]['offset']);}_0x32ad8e[_0xb65f('0x39')]=qs[_0xb65f('0x3a')](_0x51fbf4[_0xb65f('0x31')][_0xb65f('0x3a')]);_0x32ad8e['where']=qs[_0xb65f('0x33')](_[_0xb65f('0x3b')](_0x51fbf4[_0xb65f('0x31')],_0x2896f3[_0xb65f('0x33')]),_0x3a12c0);if(_0x51fbf4[_0xb65f('0x31')]['filter']){_0x32ad8e[_0xb65f('0x3c')]=_[_0xb65f('0x3d')](_0x32ad8e[_0xb65f('0x3c')],{'$or':_[_0xb65f('0x2a')](_0x3a12c0,function(_0x2168de){if(_0x2168de[_0xb65f('0x2e')]!==_0xb65f('0x3e')){var _0x42f562={};_0x42f562[_0x2168de['name']]={'$like':'%'+_0x51fbf4[_0xb65f('0x31')][_0xb65f('0x3f')]+'%'};return _0x42f562;}})});}_0x32ad8e=_[_0xb65f('0x3d')]({},_0x32ad8e,_0x51fbf4['options']);var _0x45249f={'where':_0x32ad8e['where']};return db[_0xb65f('0x2b')]['count'](_0x45249f)['then'](function(_0x575f5b){_0x3fc0bd[_0xb65f('0x1c')]=_0x575f5b;if(_0x51fbf4[_0xb65f('0x31')][_0xb65f('0x40')]){_0x32ad8e[_0xb65f('0x41')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0xb65f('0x42')](_0x32ad8e);})[_0xb65f('0x24')](function(_0x4fb7dc){_0x3fc0bd[_0xb65f('0x43')]=_0x4fb7dc;return _0x3fc0bd;})['then'](respondWithFilteredResult(_0xe0107d,_0x32ad8e))['catch'](handleError(_0xe0107d,null));};exports[_0xb65f('0x44')]=function(_0x4dfc6c,_0x4cee69){var _0x37f12c={'raw':!![],'where':{'id':_0x4dfc6c[_0xb65f('0x45')]['id']}},_0x5e9631={};_0x5e9631[_0xb65f('0x30')]=_[_0xb65f('0x32')](db['VoiceMailMessage'][_0xb65f('0x2c')]);_0x5e9631['query']=_[_0xb65f('0x32')](_0x4dfc6c['query']);_0x5e9631[_0xb65f('0x33')]=_[_0xb65f('0x34')](_0x5e9631[_0xb65f('0x30')],_0x5e9631[_0xb65f('0x31')]);_0x37f12c[_0xb65f('0x35')]=_[_0xb65f('0x34')](_0x5e9631['model'],qs[_0xb65f('0x36')](_0x4dfc6c[_0xb65f('0x31')]['fields']));_0x37f12c[_0xb65f('0x35')]=_0x37f12c[_0xb65f('0x35')][_0xb65f('0x46')]?_0x37f12c[_0xb65f('0x35')]:_0x5e9631[_0xb65f('0x30')];if(_0x4dfc6c['query'][_0xb65f('0x40')]){_0x37f12c[_0xb65f('0x41')]=[{'all':!![]}];}_0x37f12c=_[_0xb65f('0x3d')]({},_0x37f12c,_0x4dfc6c['options']);return db[_0xb65f('0x2b')][_0xb65f('0x47')](_0x37f12c)[_0xb65f('0x24')](handleEntityNotFound(_0x4cee69,null))[_0xb65f('0x24')](respondWithResult(_0x4cee69,null))[_0xb65f('0x48')](handleError(_0x4cee69,null));};exports['create']=function(_0x15ae0c,_0x39cbfc){return db['VoiceMailMessage'][_0xb65f('0x49')](_0x15ae0c[_0xb65f('0x4a')],{})['then'](respondWithResult(_0x39cbfc,0xc9))['catch'](handleError(_0x39cbfc,null));};exports[_0xb65f('0x23')]=function(_0x47080c,_0x2e395d){if(_0x47080c[_0xb65f('0x4a')]['id']){delete _0x47080c[_0xb65f('0x4a')]['id'];}return db[_0xb65f('0x2b')][_0xb65f('0x47')]({'where':{'id':_0x47080c[_0xb65f('0x45')]['id']}})[_0xb65f('0x24')](handleEntityNotFound(_0x2e395d,null))[_0xb65f('0x24')](saveUpdates(_0x47080c[_0xb65f('0x4a')],null))['then'](respondWithResult(_0x2e395d,null))['catch'](handleError(_0x2e395d,null));};exports[_0xb65f('0x25')]=function(_0x4fd0ca,_0x701e3d){return db[_0xb65f('0x2b')][_0xb65f('0x47')]({'where':{'id':_0x4fd0ca['params']['id']}})[_0xb65f('0x24')](handleEntityNotFound(_0x701e3d,null))[_0xb65f('0x24')](removeEntity(_0x701e3d,null))[_0xb65f('0x48')](handleError(_0x701e3d,null));};exports[_0xb65f('0x4b')]=function(_0x296657,_0x348eac,_0x5c1fb6){return db[_0xb65f('0x2b')]['find']({'where':{'id':_0x296657['params']['id']},'attributes':['id',_0xb65f('0x4c'),_0xb65f('0x4d')]})['then'](handleEntityNotFound(_0x348eac,null))[_0xb65f('0x24')](function(_0x99c374){if(_0x99c374){if(!_0x99c374[_0xb65f('0x4c')]){throw new db[(_0xb65f('0x4e'))][(_0xb65f('0x4f'))](_0xb65f('0x50'));}var _0x1f7ed3={'Content-Type':_0xb65f('0x51'),'Content-Disposition':'attachment'};if(_0x99c374[_0xb65f('0x4d')]){_0x1f7ed3[_0xb65f('0x52')]=_0xb65f('0x53')+_0x99c374[_0xb65f('0x4d')]+_0xb65f('0x54');}_0x348eac['set'](_0x1f7ed3);return _0x348eac[_0xb65f('0x55')](new Buffer(_0x99c374['recording']));}})[_0xb65f('0x48')](handleError(_0x348eac,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 166d4bb..0361925 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 _0xd761=['../../config/environment','exports','define','voice_voicemail_messages','dir','../../config/logger','api','moment','bluebird','path'];(function(_0x5dacee,_0x1b253e){var _0x567d15=function(_0x137461){while(--_0x137461){_0x5dacee['push'](_0x5dacee['shift']());}};_0x567d15(++_0x1b253e);}(_0xd761,0x181));var _0x1d76=function(_0x4f1da5,_0x4ced17){_0x4f1da5=_0x4f1da5-0x0;var _0xe972a8=_0xd761[_0x4f1da5];return _0xe972a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1d76('0x0'))(_0x1d76('0x1'));var moment=require(_0x1d76('0x2'));var BPromise=require(_0x1d76('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1d76('0x4'));var rimraf=require('rimraf');var config=require(_0x1d76('0x5'));var attributes=require('./voiceMailMessage.attributes');module[_0x1d76('0x6')]=function(_0x2e3f6c,_0x11772b){return _0x2e3f6c[_0x1d76('0x7')]('VoiceMailMessage',attributes,{'tableName':_0x1d76('0x8'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x1d76('0x9')]}],'timestamps':![]});}; \ No newline at end of file +var _0x2348=['moment','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','api'];(function(_0xfd7f30,_0x19dfb2){var _0x5984da=function(_0x187031){while(--_0x187031){_0xfd7f30['push'](_0xfd7f30['shift']());}};_0x5984da(++_0x19dfb2);}(_0x2348,0x73));var _0x8234=function(_0x3a7bdf,_0x58bdd8){_0x3a7bdf=_0x3a7bdf-0x0;var _0x35a9a8=_0x2348[_0x3a7bdf];return _0x35a9a8;};'use strict';var _=require(_0x8234('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8234('0x1'));var moment=require(_0x8234('0x2'));var BPromise=require('bluebird');var rp=require(_0x8234('0x3'));var fs=require('fs');var path=require(_0x8234('0x4'));var rimraf=require(_0x8234('0x5'));var config=require(_0x8234('0x6'));var attributes=require(_0x8234('0x7'));module[_0x8234('0x8')]=function(_0x39e881,_0x11032b){return _0x39e881[_0x8234('0x9')](_0x8234('0xa'),attributes,{'tableName':_0x8234('0xb'),'paranoid':![],'indexes':[{'name':_0x8234('0xc'),'fields':[_0x8234('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index d380552..abf34d8 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 _0x7818=['message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x1073ad,_0x44bf0b){var _0x528474=function(_0x3450f7){while(--_0x3450f7){_0x1073ad['push'](_0x1073ad['shift']());}};_0x528474(++_0x44bf0b);}(_0x7818,0xde));var _0x8781=function(_0x1fdeea,_0xf38973){_0x1fdeea=_0x1fdeea-0x0;var _0x5c51ca=_0x7818[_0x1fdeea];return _0x5c51ca;};'use strict';var _=require(_0x8781('0x0'));var util=require(_0x8781('0x1'));var moment=require(_0x8781('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8781('0x3'));var db=require(_0x8781('0x4'))['db'];var utils=require(_0x8781('0x5'));var logger=require(_0x8781('0x6'))(_0x8781('0x7'));var config=require(_0x8781('0x8'));var jayson=require(_0x8781('0x9'));var client=jayson[_0x8781('0xa')][_0x8781('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f43f8,_0x3ec6e0,_0x2fe15f){return new BPromise(function(_0x1217fb,_0x3070c4){return client[_0x8781('0xc')](_0x5f43f8,_0x2fe15f)['then'](function(_0x51e8ba){logger[_0x8781('0xd')](_0x8781('0xe'),_0x3ec6e0,_0x8781('0xf'));logger[_0x8781('0x10')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x3ec6e0,_0x8781('0xf'),JSON[_0x8781('0x11')](_0x51e8ba));if(_0x51e8ba[_0x8781('0x12')]){if(_0x51e8ba[_0x8781('0x12')][_0x8781('0x13')]===0x1f4){logger[_0x8781('0x12')](_0x8781('0xe'),_0x3ec6e0,_0x51e8ba[_0x8781('0x12')][_0x8781('0x14')]);return _0x3070c4(_0x51e8ba[_0x8781('0x12')][_0x8781('0x14')]);}logger[_0x8781('0x12')](_0x8781('0xe'),_0x3ec6e0,_0x51e8ba['error'][_0x8781('0x14')]);return _0x1217fb(_0x51e8ba[_0x8781('0x12')][_0x8781('0x14')]);}else{logger['info'](_0x8781('0xe'),_0x3ec6e0,'request\x20sent');_0x1217fb(_0x51e8ba[_0x8781('0x15')]['message']);}})['catch'](function(_0x2bba51){logger[_0x8781('0x12')](_0x8781('0xe'),_0x3ec6e0,_0x2bba51);_0x3070c4(_0x2bba51);});});} \ No newline at end of file +var _0xca31=['error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x123bb6,_0x3ee79c){var _0x307649=function(_0x2ace54){while(--_0x2ace54){_0x123bb6['push'](_0x123bb6['shift']());}};_0x307649(++_0x3ee79c);}(_0xca31,0x14b));var _0x1ca3=function(_0x47e7d0,_0x36c59d){_0x47e7d0=_0x47e7d0-0x0;var _0x24995f=_0xca31[_0x47e7d0];return _0x24995f;};'use strict';var _=require('lodash');var util=require(_0x1ca3('0x0'));var moment=require(_0x1ca3('0x1'));var BPromise=require(_0x1ca3('0x2'));var rs=require(_0x1ca3('0x3'));var fs=require('fs');var Redis=require(_0x1ca3('0x4'));var db=require(_0x1ca3('0x5'))['db'];var utils=require(_0x1ca3('0x6'));var logger=require(_0x1ca3('0x7'))(_0x1ca3('0x8'));var config=require(_0x1ca3('0x9'));var jayson=require(_0x1ca3('0xa'));var client=jayson[_0x1ca3('0xb')][_0x1ca3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x43d852,_0x4f9fbd,_0x592d01){return new BPromise(function(_0x54e78b,_0x539954){return client[_0x1ca3('0xd')](_0x43d852,_0x592d01)[_0x1ca3('0xe')](function(_0x457db5){logger['info'](_0x1ca3('0xf'),_0x4f9fbd,_0x1ca3('0x10'));logger['debug'](_0x1ca3('0x11'),_0x4f9fbd,'request\x20sent',JSON[_0x1ca3('0x12')](_0x457db5));if(_0x457db5['error']){if(_0x457db5[_0x1ca3('0x13')][_0x1ca3('0x14')]===0x1f4){logger[_0x1ca3('0x13')](_0x1ca3('0xf'),_0x4f9fbd,_0x457db5[_0x1ca3('0x13')][_0x1ca3('0x15')]);return _0x539954(_0x457db5[_0x1ca3('0x13')]['message']);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x4f9fbd,_0x457db5[_0x1ca3('0x13')][_0x1ca3('0x15')]);return _0x54e78b(_0x457db5[_0x1ca3('0x13')][_0x1ca3('0x15')]);}else{logger[_0x1ca3('0x16')]('VoiceMailMessage,\x20%s,\x20%s',_0x4f9fbd,_0x1ca3('0x10'));_0x54e78b(_0x457db5[_0x1ca3('0x17')][_0x1ca3('0x15')]);}})[_0x1ca3('0x18')](function(_0x4aac54){logger['error'](_0x1ca3('0xf'),_0x4f9fbd,_0x4aac54);_0x539954(_0x4aac54);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 23504ca..029e3e4 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 _0x6fe8=['index','/:id','isAuthenticated','show','/:id/sounds','getSounds','post','put','update','delete','/:id/sounds/:id2','removeSound','exports','util','connect-timeout','Router','../../components/auth/service','get'];(function(_0x506711,_0x3c6037){var _0x1860c3=function(_0x1730e0){while(--_0x1730e0){_0x506711['push'](_0x506711['shift']());}};_0x1860c3(++_0x3c6037);}(_0x6fe8,0x12d));var _0x86fe=function(_0x3181cc,_0x28447f){_0x3181cc=_0x3181cc-0x0;var _0x547a4a=_0x6fe8[_0x3181cc];return _0x547a4a;};'use strict';var multer=require('multer');var util=require(_0x86fe('0x0'));var path=require('path');var timeout=require(_0x86fe('0x1'));var express=require('express');var router=express[_0x86fe('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x86fe('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router[_0x86fe('0x4')]('/',auth['isAuthenticated'](),controller[_0x86fe('0x5')]);router[_0x86fe('0x4')](_0x86fe('0x6'),auth[_0x86fe('0x7')](),controller[_0x86fe('0x8')]);router['get'](_0x86fe('0x9'),auth[_0x86fe('0x7')](),controller[_0x86fe('0xa')]);router['post']('/',auth[_0x86fe('0x7')](),controller['create']);router[_0x86fe('0xb')]('/:id/sounds',auth[_0x86fe('0x7')](),controller['addSound']);router[_0x86fe('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x86fe('0xd')]);router['delete'](_0x86fe('0x6'),auth[_0x86fe('0x7')](),controller['destroy']);router[_0x86fe('0xe')](_0x86fe('0xf'),auth[_0x86fe('0x7')](),controller[_0x86fe('0x10')]);module[_0x86fe('0x11')]=router; \ No newline at end of file +var _0x2998=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','show','/:id/sounds','post','create','put','update','delete','/:id/sounds/:id2','removeSound'];(function(_0x5a4ee2,_0x36cdab){var _0x445c17=function(_0x206614){while(--_0x206614){_0x5a4ee2['push'](_0x5a4ee2['shift']());}};_0x445c17(++_0x36cdab);}(_0x2998,0x141));var _0x8299=function(_0x2dc655,_0x3beadd){_0x2dc655=_0x2dc655-0x0;var _0x196dd6=_0x2998[_0x2dc655];return _0x196dd6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8299('0x0'));var timeout=require(_0x8299('0x1'));var express=require(_0x8299('0x2'));var router=express[_0x8299('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8299('0x4'));var interaction=require(_0x8299('0x5'));var config=require('../../config/environment');var controller=require(_0x8299('0x6'));router[_0x8299('0x7')]('/',auth[_0x8299('0x8')](),controller['index']);router['get'](_0x8299('0x9'),auth[_0x8299('0x8')](),controller[_0x8299('0xa')]);router[_0x8299('0x7')](_0x8299('0xb'),auth[_0x8299('0x8')](),controller['getSounds']);router[_0x8299('0xc')]('/',auth['isAuthenticated'](),controller[_0x8299('0xd')]);router[_0x8299('0xc')](_0x8299('0xb'),auth['isAuthenticated'](),controller['addSound']);router[_0x8299('0xe')](_0x8299('0x9'),auth[_0x8299('0x8')](),controller[_0x8299('0xf')]);router[_0x8299('0x10')](_0x8299('0x9'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x8299('0x11'),auth['isAuthenticated'](),controller[_0x8299('0x12')]);module[_0x8299('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 941e009..804eddc 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 _0xb200=['files','quietmp3nb','STRING','alpha','TIMESTAMP','sequelize','exports','name','ENUM','custom'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xb200,0x113));var _0x0b20=function(_0x150599,_0x3bdfb0){_0x150599=_0x150599-0x0;var _0x12c65f=_0xb200[_0x150599];return _0x12c65f;};'use strict';var Sequelize=require(_0x0b20('0x0'));module[_0x0b20('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0b20('0x2')},'mode':{'type':Sequelize[_0x0b20('0x3')](_0x0b20('0x4'),_0x0b20('0x5'),'mp3nb',_0x0b20('0x6'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':_0x0b20('0x5')},'directory':{'type':Sequelize[_0x0b20('0x7')],'allowNull':!![]},'application':{'type':Sequelize[_0x0b20('0x7')],'allowNull':!![]},'digit':{'type':Sequelize[_0x0b20('0x7')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x0b20('0x8')},'format':{'type':Sequelize[_0x0b20('0x7')],'allowNull':!![]},'stamp':{'type':_0x0b20('0x9')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x996a=['quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','custom','files','mp3nb'];(function(_0x441dc9,_0x15b612){var _0x24b173=function(_0x423791){while(--_0x423791){_0x441dc9['push'](_0x441dc9['shift']());}};_0x24b173(++_0x15b612);}(_0x996a,0x192));var _0xa996=function(_0x85794,_0x571db4){_0x85794=_0x85794-0x0;var _0x4a8818=_0x996a[_0x85794];return _0x4a8818;};'use strict';var Sequelize=require(_0xa996('0x0'));module[_0xa996('0x1')]={'name':{'type':Sequelize[_0xa996('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM'](_0xa996('0x3'),_0xa996('0x4'),_0xa996('0x5'),_0xa996('0x6'),_0xa996('0x7'),_0xa996('0x8')),'allowNull':!![],'defaultValue':_0xa996('0x4')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xa996('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xa996('0x2')],'allowNull':!![],'defaultValue':_0xa996('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0xa996('0xa')},'defaultEntry':{'type':Sequelize[_0xa996('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 a51c74f..9332bfa 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 _0x4e47=['map','options','count','include','rows','params','rawAttributes','model','includeAll','find','catch','body','create','sequelize','transaction','mode','files','join','root','server/files/moh','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','directory','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','extname','removeSound','id2','Sound','getSounds','eml-format','rimraf','request-promise','moment','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','api','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','destroy','MusicOnHolds','UserProfileResource','then','sendStatus','stack','name','send','index','VoiceMusicOnHold','type','key','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4e47,0x1ed));var _0x74e4=function(_0x37ec7b,_0x5313b9){_0x37ec7b=_0x37ec7b-0x0;var _0x5e5fb2=_0x4e47[_0x37ec7b];return _0x5e5fb2;};'use strict';var emlformat=require(_0x74e4('0x0'));var rimraf=require(_0x74e4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x74e4('0x2'));var moment=require(_0x74e4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x74e4('0x4'));var util=require(_0x74e4('0x5'));var path=require(_0x74e4('0x6'));var sox=require(_0x74e4('0x7'));var csv=require(_0x74e4('0x8'));var ejs=require(_0x74e4('0x9'));var fs=require('fs');var fs_extra=require(_0x74e4('0xa'));var _=require(_0x74e4('0xb'));var squel=require(_0x74e4('0xc'));var crypto=require(_0x74e4('0xd'));var jsforce=require(_0x74e4('0xe'));var deskjs=require(_0x74e4('0xf'));var toCsv=require(_0x74e4('0x8'));var querystring=require(_0x74e4('0x10'));var Papa=require('papaparse');var Redis=require(_0x74e4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x74e4('0x12'));var as=require(_0x74e4('0x13'));var hardwareService=require(_0x74e4('0x14'));var logger=require(_0x74e4('0x15'))(_0x74e4('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x74e4('0x17'))['db'];function respondWithStatusCode(_0x1ebdc3,_0x63cc22){_0x63cc22=_0x63cc22||0xcc;return function(_0x1b81f8){if(_0x1b81f8){return _0x1ebdc3['sendStatus'](_0x63cc22);}return _0x1ebdc3[_0x74e4('0x18')](_0x63cc22)[_0x74e4('0x19')]();};}function respondWithResult(_0x3b193f,_0x4c5158){_0x4c5158=_0x4c5158||0xc8;return function(_0x4b535d){if(_0x4b535d){return _0x3b193f[_0x74e4('0x18')](_0x4c5158)[_0x74e4('0x1a')](_0x4b535d);}};}function respondWithFilteredResult(_0x222831,_0x1d15d0){return function(_0x165686){if(_0x165686){var _0xa9bf99=typeof _0x1d15d0[_0x74e4('0x1b')]===_0x74e4('0x1c')&&typeof _0x1d15d0[_0x74e4('0x1d')]===_0x74e4('0x1c');var _0x28c353=_0x165686['count'];var _0x161204=_0xa9bf99?0x0:_0x1d15d0['offset'];var _0x5a4cc0=_0xa9bf99?_0x165686['count']:_0x1d15d0['offset']+_0x1d15d0['limit'];var _0x2fd0de;if(_0x5a4cc0>=_0x28c353){_0x5a4cc0=_0x28c353;_0x2fd0de=0xc8;}else{_0x2fd0de=0xce;}_0x222831['status'](_0x2fd0de);return _0x222831[_0x74e4('0x1e')](_0x74e4('0x1f'),_0x161204+'-'+_0x5a4cc0+'/'+_0x28c353)[_0x74e4('0x1a')](_0x165686);}return null;};}function patchUpdates(_0x23f1db){return function(_0x598306){try{jsonpatch['apply'](_0x598306,_0x23f1db,!![]);}catch(_0x23128b){return BPromise[_0x74e4('0x20')](_0x23128b);}return _0x598306[_0x74e4('0x21')]();};}function saveUpdates(_0x1785fb,_0x51a25f){return function(_0x46782b){if(_0x46782b){return _0x46782b[_0x74e4('0x22')](_0x1785fb)['then'](function(_0x1caea7){return _0x1caea7;});}return null;};}function removeEntity(_0xa4cd0b,_0x58f472){return function(_0x2380c3){if(_0x2380c3){return _0x2380c3[_0x74e4('0x23')]()['then'](function(){var _0x330ad2=_0x2380c3['get']({'plain':!![]});var _0x4ed76d=_0x74e4('0x24');return db[_0x74e4('0x25')][_0x74e4('0x23')]({'where':{'type':_0x4ed76d,'resourceId':_0x330ad2['id']}})[_0x74e4('0x26')](function(){return _0x2380c3;});})[_0x74e4('0x26')](function(){_0xa4cd0b['status'](0xcc)[_0x74e4('0x19')]();});}};}function handleEntityNotFound(_0xcf24ce,_0x1b02e3){return function(_0x1de4d9){if(!_0x1de4d9){_0xcf24ce[_0x74e4('0x27')](0x194);}return _0x1de4d9;};}function handleError(_0x912a47,_0x17942e){_0x17942e=_0x17942e||0x1f4;return function(_0x51f9b4){logger['error'](_0x51f9b4[_0x74e4('0x28')]);if(_0x51f9b4[_0x74e4('0x29')]){delete _0x51f9b4[_0x74e4('0x29')];}_0x912a47[_0x74e4('0x18')](_0x17942e)[_0x74e4('0x2a')](_0x51f9b4);};}exports[_0x74e4('0x2b')]=function(_0x57db9a,_0x28fb55){var _0x268f34={},_0x300204={},_0x1cd6c9={'count':0x0,'rows':[]};var _0xc85656=_['map'](db[_0x74e4('0x2c')]['rawAttributes'],function(_0xb01f7){return{'name':_0xb01f7['fieldName'],'type':_0xb01f7[_0x74e4('0x2d')][_0x74e4('0x2e')]};});_0x300204['model']=_['map'](_0xc85656,'name');_0x300204[_0x74e4('0x2f')]=_[_0x74e4('0x30')](_0x57db9a[_0x74e4('0x2f')]);_0x300204[_0x74e4('0x31')]=_[_0x74e4('0x32')](_0x300204['model'],_0x300204[_0x74e4('0x2f')]);_0x268f34['attributes']=_[_0x74e4('0x32')](_0x300204['model'],qs[_0x74e4('0x33')](_0x57db9a[_0x74e4('0x2f')][_0x74e4('0x33')]));_0x268f34[_0x74e4('0x34')]=_0x268f34[_0x74e4('0x34')][_0x74e4('0x35')]?_0x268f34[_0x74e4('0x34')]:_0x300204['model'];if(!_0x57db9a['query'][_0x74e4('0x36')](_0x74e4('0x37'))){_0x268f34[_0x74e4('0x1d')]=qs['limit'](_0x57db9a[_0x74e4('0x2f')]['limit']);_0x268f34['offset']=qs[_0x74e4('0x1b')](_0x57db9a['query'][_0x74e4('0x1b')]);}_0x268f34[_0x74e4('0x38')]=qs[_0x74e4('0x39')](_0x57db9a[_0x74e4('0x2f')][_0x74e4('0x39')]);delete _0x57db9a[_0x74e4('0x2f')][_0x74e4('0x39')];_0x268f34[_0x74e4('0x3a')]=qs[_0x74e4('0x31')](_[_0x74e4('0x3b')](_0x57db9a['query'],_0x300204[_0x74e4('0x31')]),_0xc85656);if(_0x57db9a[_0x74e4('0x2f')][_0x74e4('0x3c')]){_0x268f34[_0x74e4('0x3a')]=_[_0x74e4('0x3d')](_0x268f34[_0x74e4('0x3a')],{'$or':_[_0x74e4('0x3e')](_0xc85656,function(_0x3c0474){if(_0x3c0474[_0x74e4('0x2d')]!=='VIRTUAL'){var _0x107153={};_0x107153[_0x3c0474[_0x74e4('0x29')]]={'$like':'%'+_0x57db9a['query'][_0x74e4('0x3c')]+'%'};return _0x107153;}})});}_0x268f34=_[_0x74e4('0x3d')]({},_0x268f34,_0x57db9a[_0x74e4('0x3f')]);var _0xbc7d2={'where':_0x268f34[_0x74e4('0x3a')]};return db[_0x74e4('0x2c')][_0x74e4('0x40')](_0xbc7d2)[_0x74e4('0x26')](function(_0x487d8f){_0x1cd6c9[_0x74e4('0x40')]=_0x487d8f;if(_0x57db9a[_0x74e4('0x2f')]['includeAll']){_0x268f34[_0x74e4('0x41')]=[{'all':!![]}];}return db[_0x74e4('0x2c')]['findAll'](_0x268f34);})[_0x74e4('0x26')](function(_0x24fd38){_0x1cd6c9[_0x74e4('0x42')]=_0x24fd38;return _0x1cd6c9;})[_0x74e4('0x26')](respondWithFilteredResult(_0x28fb55,_0x268f34))['catch'](handleError(_0x28fb55,null));};exports['show']=function(_0x118f03,_0x4945bc){var _0x262ed0={'raw':![],'where':{'id':_0x118f03[_0x74e4('0x43')]['id']}},_0x44b14e={};_0x44b14e['model']=_[_0x74e4('0x30')](db[_0x74e4('0x2c')][_0x74e4('0x44')]);_0x44b14e['query']=_[_0x74e4('0x30')](_0x118f03[_0x74e4('0x2f')]);_0x44b14e[_0x74e4('0x31')]=_[_0x74e4('0x32')](_0x44b14e[_0x74e4('0x45')],_0x44b14e[_0x74e4('0x2f')]);_0x262ed0['attributes']=_[_0x74e4('0x32')](_0x44b14e[_0x74e4('0x45')],qs['fields'](_0x118f03[_0x74e4('0x2f')]['fields']));_0x262ed0[_0x74e4('0x34')]=_0x262ed0[_0x74e4('0x34')][_0x74e4('0x35')]?_0x262ed0[_0x74e4('0x34')]:_0x44b14e[_0x74e4('0x45')];if(_0x118f03['query'][_0x74e4('0x46')]){_0x262ed0[_0x74e4('0x41')]=[{'all':!![]}];}_0x262ed0=_[_0x74e4('0x3d')]({},_0x262ed0,_0x118f03[_0x74e4('0x3f')]);return db[_0x74e4('0x2c')][_0x74e4('0x47')](_0x262ed0)[_0x74e4('0x26')](handleEntityNotFound(_0x4945bc,null))[_0x74e4('0x26')](respondWithResult(_0x4945bc,null))[_0x74e4('0x48')](handleError(_0x4945bc,null));};exports[_0x74e4('0x22')]=function(_0x12cb4a,_0x1d6b90){if(_0x12cb4a[_0x74e4('0x49')]['id']){delete _0x12cb4a['body']['id'];}return db[_0x74e4('0x2c')][_0x74e4('0x47')]({'where':{'id':_0x12cb4a[_0x74e4('0x43')]['id']}})['then'](handleEntityNotFound(_0x1d6b90,null))[_0x74e4('0x26')](saveUpdates(_0x12cb4a[_0x74e4('0x49')],null))[_0x74e4('0x26')](respondWithResult(_0x1d6b90,null))[_0x74e4('0x48')](handleError(_0x1d6b90,null));};exports[_0x74e4('0x4a')]=function(_0x59a297,_0x2aa595,_0x1efd25){return db[_0x74e4('0x4b')][_0x74e4('0x4c')](function(_0x5391a5){if(_0x59a297[_0x74e4('0x49')][_0x74e4('0x4d')]===_0x74e4('0x4e')){_0x59a297[_0x74e4('0x49')]['directory']=path[_0x74e4('0x4f')](config[_0x74e4('0x50')],_0x74e4('0x51'),_0x59a297[_0x74e4('0x49')][_0x74e4('0x29')]);}return db['VoiceMusicOnHold'][_0x74e4('0x4a')](_0x59a297[_0x74e4('0x49')],{'transaction':_0x5391a5})['then'](function(_0x40eceb){if(_0x59a297[_0x74e4('0x49')]['mode']===_0x74e4('0x4e')){fs['mkdirSync'](_0x40eceb['directory'],parseInt(_0x74e4('0x52'),0x8));}var _0x31feac=_0x59a297[_0x74e4('0x53')][_0x74e4('0x54')]({'plain':!![]});if(!_0x31feac)throw new Error(_0x74e4('0x55'));if(_0x31feac[_0x74e4('0x56')]==='user'){var _0xca9c69=_0x40eceb[_0x74e4('0x54')]({'plain':!![]});return db[_0x74e4('0x57')][_0x74e4('0x47')]({'where':{'name':_0x74e4('0x24'),'userProfileId':_0x31feac[_0x74e4('0x58')]},'raw':!![]})['then'](function(_0x3458ce){if(_0x3458ce&&_0x3458ce[_0x74e4('0x59')]===0x0){return db[_0x74e4('0x25')][_0x74e4('0x4a')]({'name':_0xca9c69[_0x74e4('0x29')],'resourceId':_0xca9c69['id'],'type':_0x3458ce['name'],'sectionId':_0x3458ce['id']},{})[_0x74e4('0x26')](function(){return _0x40eceb;});}else{return _0x40eceb;}})[_0x74e4('0x48')](function(_0x2855c0){logger['error'](_0x74e4('0x5a'),_0x2855c0);});}return _0x40eceb;});})[_0x74e4('0x26')](respondWithResult(_0x2aa595,0xc9))[_0x74e4('0x48')](handleError(_0x2aa595,null));};exports[_0x74e4('0x23')]=function(_0x343dbf,_0x51ed99,_0x16d6c8){var _0x47ac83;return db[_0x74e4('0x2c')][_0x74e4('0x47')]({'where':{'id':_0x343dbf[_0x74e4('0x43')]['id']}})[_0x74e4('0x26')](function(_0x3ea930){if(_0x3ea930){return db[_0x74e4('0x4b')][_0x74e4('0x4c')](function(_0xba70bf){return _0x3ea930[_0x74e4('0x23')]({'transaction':_0xba70bf,'raw':!![]})[_0x74e4('0x26')](function(_0x12f0fd){if(_0x12f0fd[_0x74e4('0x5b')]){fs['readdirSync'](_0x12f0fd[_0x74e4('0x5b')])[_0x74e4('0x5c')](function(_0x3090ee){fs[_0x74e4('0x5d')](path[_0x74e4('0x4f')](_0x12f0fd[_0x74e4('0x5b')],_0x3090ee));});fs[_0x74e4('0x5e')](_0x12f0fd[_0x74e4('0x5b')]);}return _0x12f0fd;});})['catch'](function(_0x248949){throw new db[(_0x74e4('0x5f'))][(_0x74e4('0x60'))](_0x248949[_0x74e4('0x61')]);});}})[_0x74e4('0x26')](handleEntityNotFound(_0x51ed99,null))['then'](removeEntity(_0x51ed99,null))[_0x74e4('0x48')](handleError(_0x51ed99,null));};exports[_0x74e4('0x62')]=function(_0x5385cf,_0x12ffac,_0x35e4f2){return db[_0x74e4('0x4b')][_0x74e4('0x4c')](function(_0x44afa8){var _0x552e35;return db[_0x74e4('0x2c')]['find']({'where':{'id':_0x5385cf[_0x74e4('0x43')]['id']}})[_0x74e4('0x26')](function(_0x3df207){if(_0x3df207){_0x552e35=_0x3df207;return _0x3df207[_0x74e4('0x62')](_0x5385cf[_0x74e4('0x49')]['id'],{'transaction':_0x44afa8});}})['then'](function(_0x1a65b6){if(_0x1a65b6){return db['Sound'][_0x74e4('0x63')]({'where':{'id':_0x5385cf[_0x74e4('0x49')]['id']},'attributes':['id','name',_0x74e4('0x64'),_0x74e4('0x65'),_0x74e4('0x66')],'raw':!![]});}})[_0x74e4('0x26')](function(_0x3e64bf){if(_0x3e64bf){var _0x3e73cd=path[_0x74e4('0x4f')](config[_0x74e4('0x50')],_0x74e4('0x67'),util[_0x74e4('0x68')](_0x74e4('0x69'),path['basename'](_0x3e64bf['save_name'],path[_0x74e4('0x6a')](_0x3e64bf[_0x74e4('0x64')])),_0x3e64bf[_0x74e4('0x65')]));var _0xd93698=path[_0x74e4('0x4f')](config[_0x74e4('0x50')],'server/files/moh',_0x552e35[_0x74e4('0x29')],util['format']('%s.%s',_0x3e64bf[_0x74e4('0x29')],_0x3e64bf[_0x74e4('0x65')]));fs['symlinkSync'](_0x3e73cd,_0xd93698);return _0x3e64bf;}})['catch'](function(_0x33e790){throw new db['Sequelize']['ValidationError'](_0x33e790['message']);});})[_0x74e4('0x26')](handleEntityNotFound(_0x12ffac,null))[_0x74e4('0x26')](respondWithResult(_0x12ffac,0xc9))[_0x74e4('0x48')](handleError(_0x12ffac,null));};exports[_0x74e4('0x6b')]=function(_0x2a3a66,_0x2552e4,_0x66163b){return db[_0x74e4('0x4b')][_0x74e4('0x4c')](function(_0x388a81){var _0x140c94;return db[_0x74e4('0x2c')]['findOne']({'where':{'id':_0x2a3a66[_0x74e4('0x43')]['id']}})['then'](handleEntityNotFound(_0x2552e4,null))[_0x74e4('0x26')](function(_0x4e24cb){if(_0x4e24cb){_0x140c94=_0x4e24cb;return _0x4e24cb['removeSound'](_0x2a3a66[_0x74e4('0x43')][_0x74e4('0x6c')]);}})[_0x74e4('0x26')](function(_0x158b43){if(_0x158b43){return db[_0x74e4('0x6d')]['findOne']({'where':{'id':_0x2a3a66[_0x74e4('0x43')][_0x74e4('0x6c')]},'attributes':['id',_0x74e4('0x29'),_0x74e4('0x64'),_0x74e4('0x65'),'createdAt'],'raw':!![]});}})[_0x74e4('0x26')](function(_0x579d86){if(_0x579d86){fs[_0x74e4('0x5d')](path['join'](_0x140c94[_0x74e4('0x5b')],util['format']('%s.%s',_0x579d86[_0x74e4('0x29')],_0x579d86['converted_format'])));return _0x579d86;}})[_0x74e4('0x48')](function(_0x495aeb){throw new db['Sequelize']['ValidationError'](_0x495aeb[_0x74e4('0x61')]);});})['then'](handleEntityNotFound(_0x2552e4,null))[_0x74e4('0x26')](respondWithStatusCode(_0x2552e4,0xcc))[_0x74e4('0x48')](handleError(_0x2552e4,null));};exports[_0x74e4('0x6e')]=function(_0x422842,_0x2e6733,_0x126518){var _0x43d451={};var _0x5cf855={};var _0x223a58;var _0x52bea6;return db[_0x74e4('0x2c')][_0x74e4('0x63')]({'where':{'id':_0x422842[_0x74e4('0x43')]['id']}})['then'](handleEntityNotFound(_0x2e6733,null))[_0x74e4('0x26')](function(_0x39d0cc){if(_0x39d0cc){_0x223a58=_0x39d0cc;_0x5cf855[_0x74e4('0x45')]=_[_0x74e4('0x30')](db[_0x74e4('0x6d')]['rawAttributes']);_0x5cf855['query']=_[_0x74e4('0x30')](_0x422842[_0x74e4('0x2f')]);_0x5cf855[_0x74e4('0x31')]=_[_0x74e4('0x32')](_0x5cf855[_0x74e4('0x45')],_0x5cf855['query']);_0x43d451['attributes']=_[_0x74e4('0x32')](_0x5cf855[_0x74e4('0x45')],qs[_0x74e4('0x33')](_0x422842[_0x74e4('0x2f')][_0x74e4('0x33')]));_0x43d451[_0x74e4('0x34')]=_0x43d451[_0x74e4('0x34')][_0x74e4('0x35')]?_0x43d451[_0x74e4('0x34')]:_0x5cf855[_0x74e4('0x45')];_0x43d451[_0x74e4('0x38')]=qs[_0x74e4('0x39')](_0x422842[_0x74e4('0x2f')]['sort']);_0x43d451[_0x74e4('0x3a')]=qs[_0x74e4('0x31')](_[_0x74e4('0x3b')](_0x422842['query'],_0x5cf855[_0x74e4('0x31')]));if(_0x422842['query']['filter']){_0x43d451[_0x74e4('0x3a')]=_[_0x74e4('0x3d')](_0x43d451[_0x74e4('0x3a')],{'$or':_[_0x74e4('0x3e')](_0x43d451[_0x74e4('0x34')],function(_0x289cd8){var _0x52eaaf={};_0x52eaaf[_0x289cd8]={'$like':'%'+_0x422842['query'][_0x74e4('0x3c')]+'%'};return _0x52eaaf;})});}_0x43d451=_[_0x74e4('0x3d')]({},_0x43d451,_0x422842[_0x74e4('0x3f')]);return _0x223a58[_0x74e4('0x6e')](_0x43d451);}})[_0x74e4('0x26')](function(_0x28b5b5){if(_0x28b5b5){_0x52bea6=_0x28b5b5[_0x74e4('0x35')];if(!_0x422842[_0x74e4('0x2f')][_0x74e4('0x36')](_0x74e4('0x37'))){_0x43d451[_0x74e4('0x1d')]=qs[_0x74e4('0x1d')](_0x422842[_0x74e4('0x2f')][_0x74e4('0x1d')]);_0x43d451['offset']=qs[_0x74e4('0x1b')](_0x422842[_0x74e4('0x2f')]['offset']);}return _0x223a58[_0x74e4('0x6e')](_0x43d451);}})[_0x74e4('0x26')](function(_0x37efeb){if(_0x37efeb){return _0x37efeb?{'count':_0x52bea6,'rows':_0x37efeb}:null;}})[_0x74e4('0x26')](respondWithResult(_0x2e6733,null))[_0x74e4('0x48')](handleError(_0x2e6733,null));}; \ No newline at end of file +var _0xc988=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','sendStatus','error','stack','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','body','create','sequelize','mode','files','join','root','mkdirSync','directory','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','MusicOnHolds','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','createdAt','server/files/sounds/converted','format','basename','converted_format','server/files/moh','%s.%s','symlinkSync','removeSound','id2','getSounds','nolimit','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end'];(function(_0x1d3404,_0x3b51c0){var _0x5d1a6e=function(_0x19c393){while(--_0x19c393){_0x1d3404['push'](_0x1d3404['shift']());}};_0x5d1a6e(++_0x3b51c0);}(_0xc988,0x142));var _0x8c98=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xc988[_0x4fbfd9];return _0x31dc94;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c98('0x0'));var zipdir=require(_0x8c98('0x1'));var jsonpatch=require(_0x8c98('0x2'));var rp=require('request-promise');var moment=require(_0x8c98('0x3'));var BPromise=require(_0x8c98('0x4'));var Mustache=require(_0x8c98('0x5'));var util=require(_0x8c98('0x6'));var path=require(_0x8c98('0x7'));var sox=require(_0x8c98('0x8'));var csv=require(_0x8c98('0x9'));var ejs=require(_0x8c98('0xa'));var fs=require('fs');var fs_extra=require(_0x8c98('0xb'));var _=require(_0x8c98('0xc'));var squel=require('squel');var crypto=require(_0x8c98('0xd'));var jsforce=require(_0x8c98('0xe'));var deskjs=require(_0x8c98('0xf'));var toCsv=require(_0x8c98('0x9'));var querystring=require('querystring');var Papa=require(_0x8c98('0x10'));var Redis=require('ioredis');var authService=require(_0x8c98('0x11'));var qs=require(_0x8c98('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c98('0x13'));var logger=require('../../config/logger')(_0x8c98('0x14'));var utils=require(_0x8c98('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8c98('0x16'));var db=require(_0x8c98('0x17'))['db'];function respondWithStatusCode(_0x666dc8,_0x4c06a7){_0x4c06a7=_0x4c06a7||0xcc;return function(_0x2fc422){if(_0x2fc422){return _0x666dc8['sendStatus'](_0x4c06a7);}return _0x666dc8[_0x8c98('0x18')](_0x4c06a7)[_0x8c98('0x19')]();};}function respondWithResult(_0x512a48,_0x125d4d){_0x125d4d=_0x125d4d||0xc8;return function(_0x12f5e7){if(_0x12f5e7){return _0x512a48[_0x8c98('0x18')](_0x125d4d)[_0x8c98('0x1a')](_0x12f5e7);}};}function respondWithFilteredResult(_0x699cac,_0x3f131a){return function(_0x436b97){if(_0x436b97){var _0x328325=typeof _0x3f131a[_0x8c98('0x1b')]===_0x8c98('0x1c')&&typeof _0x3f131a[_0x8c98('0x1d')]===_0x8c98('0x1c');var _0x318ea5=_0x436b97[_0x8c98('0x1e')];var _0x35a972=_0x328325?0x0:_0x3f131a[_0x8c98('0x1b')];var _0x2dbefd=_0x328325?_0x436b97[_0x8c98('0x1e')]:_0x3f131a['offset']+_0x3f131a[_0x8c98('0x1d')];var _0x5cf549;if(_0x2dbefd>=_0x318ea5){_0x2dbefd=_0x318ea5;_0x5cf549=0xc8;}else{_0x5cf549=0xce;}_0x699cac['status'](_0x5cf549);return _0x699cac[_0x8c98('0x1f')](_0x8c98('0x20'),_0x35a972+'-'+_0x2dbefd+'/'+_0x318ea5)[_0x8c98('0x1a')](_0x436b97);}return null;};}function patchUpdates(_0x12ab91){return function(_0x1cdfa6){try{jsonpatch[_0x8c98('0x21')](_0x1cdfa6,_0x12ab91,!![]);}catch(_0x5765ca){return BPromise[_0x8c98('0x22')](_0x5765ca);}return _0x1cdfa6[_0x8c98('0x23')]();};}function saveUpdates(_0x5e861e,_0x51d891){return function(_0x25bbf5){if(_0x25bbf5){return _0x25bbf5['update'](_0x5e861e)[_0x8c98('0x24')](function(_0x1ef3c0){return _0x1ef3c0;});}return null;};}function removeEntity(_0x262f59,_0x14c1bd){return function(_0x1f5dab){if(_0x1f5dab){return _0x1f5dab[_0x8c98('0x25')]()[_0x8c98('0x24')](function(){var _0x205be0=_0x1f5dab[_0x8c98('0x26')]({'plain':!![]});var _0x2f4c58='MusicOnHolds';return db['UserProfileResource'][_0x8c98('0x25')]({'where':{'type':_0x2f4c58,'resourceId':_0x205be0['id']}})[_0x8c98('0x24')](function(){return _0x1f5dab;});})[_0x8c98('0x24')](function(){_0x262f59[_0x8c98('0x18')](0xcc)[_0x8c98('0x19')]();});}};}function handleEntityNotFound(_0x1428a0,_0x4ea333){return function(_0x498a3c){if(!_0x498a3c){_0x1428a0[_0x8c98('0x27')](0x194);}return _0x498a3c;};}function handleError(_0x1800ad,_0xf34547){_0xf34547=_0xf34547||0x1f4;return function(_0x370add){logger[_0x8c98('0x28')](_0x370add[_0x8c98('0x29')]);if(_0x370add['name']){delete _0x370add['name'];}_0x1800ad[_0x8c98('0x18')](_0xf34547)[_0x8c98('0x2a')](_0x370add);};}exports[_0x8c98('0x2b')]=function(_0x3a6b1c,_0x2ed918){var _0x450c66={},_0x55a181={},_0x5d90fd={'count':0x0,'rows':[]};var _0x297176=_[_0x8c98('0x2c')](db[_0x8c98('0x2d')][_0x8c98('0x2e')],function(_0xa636d8){return{'name':_0xa636d8[_0x8c98('0x2f')],'type':_0xa636d8[_0x8c98('0x30')][_0x8c98('0x31')]};});_0x55a181[_0x8c98('0x32')]=_['map'](_0x297176,_0x8c98('0x33'));_0x55a181['query']=_[_0x8c98('0x34')](_0x3a6b1c[_0x8c98('0x35')]);_0x55a181['filters']=_[_0x8c98('0x36')](_0x55a181[_0x8c98('0x32')],_0x55a181['query']);_0x450c66[_0x8c98('0x37')]=_[_0x8c98('0x36')](_0x55a181[_0x8c98('0x32')],qs[_0x8c98('0x38')](_0x3a6b1c['query']['fields']));_0x450c66['attributes']=_0x450c66[_0x8c98('0x37')][_0x8c98('0x39')]?_0x450c66[_0x8c98('0x37')]:_0x55a181[_0x8c98('0x32')];if(!_0x3a6b1c[_0x8c98('0x35')][_0x8c98('0x3a')]('nolimit')){_0x450c66[_0x8c98('0x1d')]=qs[_0x8c98('0x1d')](_0x3a6b1c['query'][_0x8c98('0x1d')]);_0x450c66['offset']=qs[_0x8c98('0x1b')](_0x3a6b1c['query'][_0x8c98('0x1b')]);}_0x450c66[_0x8c98('0x3b')]=qs['sort'](_0x3a6b1c[_0x8c98('0x35')]['sort']);delete _0x3a6b1c[_0x8c98('0x35')][_0x8c98('0x3c')];_0x450c66['where']=qs[_0x8c98('0x3d')](_['pick'](_0x3a6b1c[_0x8c98('0x35')],_0x55a181[_0x8c98('0x3d')]),_0x297176);if(_0x3a6b1c[_0x8c98('0x35')][_0x8c98('0x3e')]){_0x450c66['where']=_[_0x8c98('0x3f')](_0x450c66[_0x8c98('0x40')],{'$or':_['map'](_0x297176,function(_0x14cae5){if(_0x14cae5[_0x8c98('0x30')]!==_0x8c98('0x41')){var _0x4b8393={};_0x4b8393[_0x14cae5[_0x8c98('0x33')]]={'$like':'%'+_0x3a6b1c['query'][_0x8c98('0x3e')]+'%'};return _0x4b8393;}})});}_0x450c66=_[_0x8c98('0x3f')]({},_0x450c66,_0x3a6b1c[_0x8c98('0x42')]);var _0x400128={'where':_0x450c66[_0x8c98('0x40')]};return db[_0x8c98('0x2d')][_0x8c98('0x1e')](_0x400128)[_0x8c98('0x24')](function(_0x46a022){_0x5d90fd[_0x8c98('0x1e')]=_0x46a022;if(_0x3a6b1c[_0x8c98('0x35')][_0x8c98('0x43')]){_0x450c66[_0x8c98('0x44')]=[{'all':!![]}];}return db[_0x8c98('0x2d')][_0x8c98('0x45')](_0x450c66);})[_0x8c98('0x24')](function(_0x4a2c1a){_0x5d90fd[_0x8c98('0x46')]=_0x4a2c1a;return _0x5d90fd;})['then'](respondWithFilteredResult(_0x2ed918,_0x450c66))[_0x8c98('0x47')](handleError(_0x2ed918,null));};exports[_0x8c98('0x48')]=function(_0x47954a,_0x1c5b49){var _0x111dd6={'raw':![],'where':{'id':_0x47954a[_0x8c98('0x49')]['id']}},_0x13c8ec={};_0x13c8ec['model']=_[_0x8c98('0x34')](db['VoiceMusicOnHold']['rawAttributes']);_0x13c8ec[_0x8c98('0x35')]=_['keys'](_0x47954a[_0x8c98('0x35')]);_0x13c8ec[_0x8c98('0x3d')]=_[_0x8c98('0x36')](_0x13c8ec['model'],_0x13c8ec[_0x8c98('0x35')]);_0x111dd6[_0x8c98('0x37')]=_[_0x8c98('0x36')](_0x13c8ec[_0x8c98('0x32')],qs['fields'](_0x47954a[_0x8c98('0x35')]['fields']));_0x111dd6['attributes']=_0x111dd6[_0x8c98('0x37')]['length']?_0x111dd6[_0x8c98('0x37')]:_0x13c8ec['model'];if(_0x47954a['query'][_0x8c98('0x43')]){_0x111dd6[_0x8c98('0x44')]=[{'all':!![]}];}_0x111dd6=_[_0x8c98('0x3f')]({},_0x111dd6,_0x47954a[_0x8c98('0x42')]);return db[_0x8c98('0x2d')]['find'](_0x111dd6)[_0x8c98('0x24')](handleEntityNotFound(_0x1c5b49,null))[_0x8c98('0x24')](respondWithResult(_0x1c5b49,null))[_0x8c98('0x47')](handleError(_0x1c5b49,null));};exports['update']=function(_0xec1e7e,_0x53ab95){if(_0xec1e7e[_0x8c98('0x4a')]['id']){delete _0xec1e7e[_0x8c98('0x4a')]['id'];}return db[_0x8c98('0x2d')]['find']({'where':{'id':_0xec1e7e[_0x8c98('0x49')]['id']}})[_0x8c98('0x24')](handleEntityNotFound(_0x53ab95,null))[_0x8c98('0x24')](saveUpdates(_0xec1e7e[_0x8c98('0x4a')],null))[_0x8c98('0x24')](respondWithResult(_0x53ab95,null))[_0x8c98('0x47')](handleError(_0x53ab95,null));};exports[_0x8c98('0x4b')]=function(_0x19d39f,_0x3c8bea,_0x44bd87){return db[_0x8c98('0x4c')]['transaction'](function(_0x52f496){if(_0x19d39f['body'][_0x8c98('0x4d')]===_0x8c98('0x4e')){_0x19d39f[_0x8c98('0x4a')]['directory']=path[_0x8c98('0x4f')](config[_0x8c98('0x50')],'server/files/moh',_0x19d39f['body'][_0x8c98('0x33')]);}return db[_0x8c98('0x2d')][_0x8c98('0x4b')](_0x19d39f[_0x8c98('0x4a')],{'transaction':_0x52f496})[_0x8c98('0x24')](function(_0x264a86){if(_0x19d39f['body'][_0x8c98('0x4d')]==='files'){fs[_0x8c98('0x51')](_0x264a86[_0x8c98('0x52')],parseInt('0777',0x8));}var _0x2f5b44=_0x19d39f['user']['get']({'plain':!![]});if(!_0x2f5b44)throw new Error(_0x8c98('0x53'));if(_0x2f5b44[_0x8c98('0x54')]==='user'){var _0x2683c5=_0x264a86[_0x8c98('0x26')]({'plain':!![]});return db[_0x8c98('0x55')][_0x8c98('0x56')]({'where':{'name':_0x8c98('0x57'),'userProfileId':_0x2f5b44[_0x8c98('0x58')]},'raw':!![]})['then'](function(_0x2f5235){if(_0x2f5235&&_0x2f5235[_0x8c98('0x59')]===0x0){return db[_0x8c98('0x5a')]['create']({'name':_0x2683c5[_0x8c98('0x33')],'resourceId':_0x2683c5['id'],'type':_0x2f5235['name'],'sectionId':_0x2f5235['id']},{})['then'](function(){return _0x264a86;});}else{return _0x264a86;}})[_0x8c98('0x47')](function(_0x5a8e56){logger[_0x8c98('0x28')](_0x8c98('0x5b'),_0x5a8e56);});}return _0x264a86;});})[_0x8c98('0x24')](respondWithResult(_0x3c8bea,0xc9))['catch'](handleError(_0x3c8bea,null));};exports[_0x8c98('0x25')]=function(_0x4c3b35,_0x2857ef,_0xf1b4fc){var _0x5e50b8;return db[_0x8c98('0x2d')][_0x8c98('0x56')]({'where':{'id':_0x4c3b35[_0x8c98('0x49')]['id']}})[_0x8c98('0x24')](function(_0x64ded9){if(_0x64ded9){return db['sequelize'][_0x8c98('0x5c')](function(_0x3e159f){return _0x64ded9[_0x8c98('0x25')]({'transaction':_0x3e159f,'raw':!![]})['then'](function(_0x494b94){if(_0x494b94[_0x8c98('0x52')]){fs[_0x8c98('0x5d')](_0x494b94['directory'])[_0x8c98('0x5e')](function(_0x388fad){fs[_0x8c98('0x5f')](path[_0x8c98('0x4f')](_0x494b94['directory'],_0x388fad));});fs[_0x8c98('0x60')](_0x494b94[_0x8c98('0x52')]);}return _0x494b94;});})['catch'](function(_0xbdae66){throw new db[(_0x8c98('0x61'))][(_0x8c98('0x62'))](_0xbdae66[_0x8c98('0x63')]);});}})[_0x8c98('0x24')](handleEntityNotFound(_0x2857ef,null))[_0x8c98('0x24')](removeEntity(_0x2857ef,null))[_0x8c98('0x47')](handleError(_0x2857ef,null));};exports['addSound']=function(_0x33f2ab,_0x506b0d,_0x2b912d){return db['sequelize'][_0x8c98('0x5c')](function(_0x5b34ec){var _0x41778e;return db[_0x8c98('0x2d')][_0x8c98('0x56')]({'where':{'id':_0x33f2ab[_0x8c98('0x49')]['id']}})['then'](function(_0x524b6c){if(_0x524b6c){_0x41778e=_0x524b6c;return _0x524b6c[_0x8c98('0x64')](_0x33f2ab[_0x8c98('0x4a')]['id'],{'transaction':_0x5b34ec});}})[_0x8c98('0x24')](function(_0x5591de){if(_0x5591de){return db[_0x8c98('0x65')][_0x8c98('0x66')]({'where':{'id':_0x33f2ab[_0x8c98('0x4a')]['id']},'attributes':['id',_0x8c98('0x33'),_0x8c98('0x67'),'converted_format',_0x8c98('0x68')],'raw':!![]});}})[_0x8c98('0x24')](function(_0x48d7c3){if(_0x48d7c3){var _0x5e5f2d=path[_0x8c98('0x4f')](config[_0x8c98('0x50')],_0x8c98('0x69'),util[_0x8c98('0x6a')]('%s.%s',path[_0x8c98('0x6b')](_0x48d7c3[_0x8c98('0x67')],path['extname'](_0x48d7c3[_0x8c98('0x67')])),_0x48d7c3[_0x8c98('0x6c')]));var _0x512daa=path['join'](config[_0x8c98('0x50')],_0x8c98('0x6d'),_0x41778e['name'],util[_0x8c98('0x6a')](_0x8c98('0x6e'),_0x48d7c3['name'],_0x48d7c3[_0x8c98('0x6c')]));fs[_0x8c98('0x6f')](_0x5e5f2d,_0x512daa);return _0x48d7c3;}})[_0x8c98('0x47')](function(_0x522f6a){throw new db[(_0x8c98('0x61'))][(_0x8c98('0x62'))](_0x522f6a[_0x8c98('0x63')]);});})['then'](handleEntityNotFound(_0x506b0d,null))[_0x8c98('0x24')](respondWithResult(_0x506b0d,0xc9))[_0x8c98('0x47')](handleError(_0x506b0d,null));};exports[_0x8c98('0x70')]=function(_0x158d16,_0x2d041b,_0xa703d9){return db[_0x8c98('0x4c')]['transaction'](function(_0x31a4d3){var _0x507382;return db[_0x8c98('0x2d')]['findOne']({'where':{'id':_0x158d16[_0x8c98('0x49')]['id']}})[_0x8c98('0x24')](handleEntityNotFound(_0x2d041b,null))[_0x8c98('0x24')](function(_0x4cbcb1){if(_0x4cbcb1){_0x507382=_0x4cbcb1;return _0x4cbcb1[_0x8c98('0x70')](_0x158d16['params'][_0x8c98('0x71')]);}})[_0x8c98('0x24')](function(_0x214a3d){if(_0x214a3d){return db[_0x8c98('0x65')][_0x8c98('0x66')]({'where':{'id':_0x158d16[_0x8c98('0x49')]['id2']},'attributes':['id',_0x8c98('0x33'),'save_name',_0x8c98('0x6c'),_0x8c98('0x68')],'raw':!![]});}})[_0x8c98('0x24')](function(_0x3be97a){if(_0x3be97a){fs[_0x8c98('0x5f')](path['join'](_0x507382[_0x8c98('0x52')],util[_0x8c98('0x6a')]('%s.%s',_0x3be97a[_0x8c98('0x33')],_0x3be97a[_0x8c98('0x6c')])));return _0x3be97a;}})[_0x8c98('0x47')](function(_0x3fedcd){throw new db['Sequelize'][(_0x8c98('0x62'))](_0x3fedcd['message']);});})['then'](handleEntityNotFound(_0x2d041b,null))[_0x8c98('0x24')](respondWithStatusCode(_0x2d041b,0xcc))['catch'](handleError(_0x2d041b,null));};exports[_0x8c98('0x72')]=function(_0x56a376,_0x26e820,_0x45ec18){var _0x479aea={};var _0x51242a={};var _0x18145d;var _0x168612;return db[_0x8c98('0x2d')][_0x8c98('0x66')]({'where':{'id':_0x56a376[_0x8c98('0x49')]['id']}})['then'](handleEntityNotFound(_0x26e820,null))[_0x8c98('0x24')](function(_0x5c474d){if(_0x5c474d){_0x18145d=_0x5c474d;_0x51242a[_0x8c98('0x32')]=_[_0x8c98('0x34')](db[_0x8c98('0x65')]['rawAttributes']);_0x51242a['query']=_[_0x8c98('0x34')](_0x56a376[_0x8c98('0x35')]);_0x51242a[_0x8c98('0x3d')]=_[_0x8c98('0x36')](_0x51242a[_0x8c98('0x32')],_0x51242a[_0x8c98('0x35')]);_0x479aea[_0x8c98('0x37')]=_['intersection'](_0x51242a[_0x8c98('0x32')],qs[_0x8c98('0x38')](_0x56a376[_0x8c98('0x35')][_0x8c98('0x38')]));_0x479aea[_0x8c98('0x37')]=_0x479aea[_0x8c98('0x37')][_0x8c98('0x39')]?_0x479aea[_0x8c98('0x37')]:_0x51242a[_0x8c98('0x32')];_0x479aea[_0x8c98('0x3b')]=qs[_0x8c98('0x3c')](_0x56a376[_0x8c98('0x35')]['sort']);_0x479aea['where']=qs[_0x8c98('0x3d')](_['pick'](_0x56a376[_0x8c98('0x35')],_0x51242a[_0x8c98('0x3d')]));if(_0x56a376['query'][_0x8c98('0x3e')]){_0x479aea['where']=_['merge'](_0x479aea['where'],{'$or':_[_0x8c98('0x2c')](_0x479aea[_0x8c98('0x37')],function(_0xa14cf8){var _0x56c806={};_0x56c806[_0xa14cf8]={'$like':'%'+_0x56a376[_0x8c98('0x35')][_0x8c98('0x3e')]+'%'};return _0x56c806;})});}_0x479aea=_[_0x8c98('0x3f')]({},_0x479aea,_0x56a376[_0x8c98('0x42')]);return _0x18145d[_0x8c98('0x72')](_0x479aea);}})['then'](function(_0x69db47){if(_0x69db47){_0x168612=_0x69db47['length'];if(!_0x56a376[_0x8c98('0x35')][_0x8c98('0x3a')](_0x8c98('0x73'))){_0x479aea[_0x8c98('0x1d')]=qs[_0x8c98('0x1d')](_0x56a376['query'][_0x8c98('0x1d')]);_0x479aea[_0x8c98('0x1b')]=qs['offset'](_0x56a376[_0x8c98('0x35')][_0x8c98('0x1b')]);}return _0x18145d[_0x8c98('0x72')](_0x479aea);}})[_0x8c98('0x24')](function(_0x20d67a){if(_0x20d67a){return _0x20d67a?{'count':_0x168612,'rows':_0x20d67a}:null;}})[_0x8c98('0x24')](respondWithResult(_0x26e820,null))[_0x8c98('0x47')](handleError(_0x26e820,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index fc8820b..e93dac8 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 _0xf034=['lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold'];(function(_0x5b95e8,_0x8673f1){var _0x291701=function(_0x56a9d8){while(--_0x56a9d8){_0x5b95e8['push'](_0x5b95e8['shift']());}};_0x291701(++_0x8673f1);}(_0xf034,0xb4));var _0x4f03=function(_0x12a91f,_0xb43ebf){_0x12a91f=_0x12a91f-0x0;var _0x4372a0=_0xf034[_0x12a91f];return _0x4372a0;};'use strict';var _=require(_0x4f03('0x0'));var util=require(_0x4f03('0x1'));var logger=require(_0x4f03('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4f03('0x3'));var rp=require(_0x4f03('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4f03('0x5'));var config=require(_0x4f03('0x6'));var attributes=require(_0x4f03('0x7'));module[_0x4f03('0x8')]=function(_0x38007e,_0x417ce8){return _0x38007e['define'](_0x4f03('0x9'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6502=['path','rimraf','../../config/environment','exports','VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x459dad,_0x402d74){var _0x174356=function(_0x56a1a5){while(--_0x56a1a5){_0x459dad['push'](_0x459dad['shift']());}};_0x174356(++_0x402d74);}(_0x6502,0xf6));var _0x2650=function(_0x2b4d7f,_0x45f7aa){_0x2b4d7f=_0x2b4d7f-0x0;var _0x3fceaa=_0x6502[_0x2b4d7f];return _0x3fceaa;};'use strict';var _=require('lodash');var util=require(_0x2650('0x0'));var logger=require(_0x2650('0x1'))(_0x2650('0x2'));var moment=require(_0x2650('0x3'));var BPromise=require(_0x2650('0x4'));var rp=require(_0x2650('0x5'));var fs=require('fs');var path=require(_0x2650('0x6'));var rimraf=require(_0x2650('0x7'));var config=require(_0x2650('0x8'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x2650('0x9')]=function(_0x1f7ff1,_0x287bf4){return _0x1f7ff1['define'](_0x2650('0xa'),attributes,{'tableName':_0x2650('0xb'),'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 2b9adbc..7d347ca 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4aa659,_0x4990ed){var _0x657618=function(_0x4eb281){while(--_0x4eb281){_0x4aa659['push'](_0x4aa659['shift']());}};_0x657618(++_0x4990ed);}(_0x70e0,0x17b));var _0x070e=function(_0x236131,_0x357a3e){_0x236131=_0x236131-0x0;var _0x279145=_0x70e0[_0x236131];return _0x279145;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2c34d0,_0x1c30d1){var _0x3647d2=function(_0x5ce389){while(--_0x5ce389){_0x2c34d0['push'](_0x2c34d0['shift']());}};_0x3647d2(++_0x1c30d1);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index b0df4f3..b469d80 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 _0x1ef8=['getAgents','/:id/teams','getTeams','post','create','/:id/users','addAgents','addTeams','update','delete','destroy','removeAgents','removeTeams','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','/:id','show'];(function(_0x365be9,_0x3c88b9){var _0x185c12=function(_0xbadbbf){while(--_0xbadbbf){_0x365be9['push'](_0x365be9['shift']());}};_0x185c12(++_0x3c88b9);}(_0x1ef8,0xd5));var _0x81ef=function(_0x5813b7,_0x18b107){_0x5813b7=_0x5813b7-0x0;var _0x51bd57=_0x1ef8[_0x5813b7];return _0x51bd57;};'use strict';var multer=require(_0x81ef('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x81ef('0x1')]();var fs_extra=require(_0x81ef('0x2'));var auth=require(_0x81ef('0x3'));var interaction=require(_0x81ef('0x4'));var config=require(_0x81ef('0x5'));var controller=require('./voicePrefix.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x81ef('0x6')]);router[_0x81ef('0x7')](_0x81ef('0x8'),auth[_0x81ef('0x9')](),controller['describe']);router[_0x81ef('0x7')](_0x81ef('0xa'),auth[_0x81ef('0x9')](),controller[_0x81ef('0xb')]);router[_0x81ef('0x7')]('/:id/users',auth[_0x81ef('0x9')](),controller[_0x81ef('0xc')]);router['get'](_0x81ef('0xd'),auth[_0x81ef('0x9')](),controller[_0x81ef('0xe')]);router[_0x81ef('0xf')]('/',auth[_0x81ef('0x9')](),controller[_0x81ef('0x10')]);router[_0x81ef('0xf')](_0x81ef('0x11'),auth[_0x81ef('0x9')](),controller[_0x81ef('0x12')]);router[_0x81ef('0xf')](_0x81ef('0xd'),auth[_0x81ef('0x9')](),controller[_0x81ef('0x13')]);router['put'](_0x81ef('0xa'),auth[_0x81ef('0x9')](),controller[_0x81ef('0x14')]);router[_0x81ef('0x15')](_0x81ef('0xa'),auth[_0x81ef('0x9')](),controller[_0x81ef('0x16')]);router[_0x81ef('0x15')](_0x81ef('0x11'),auth['isAuthenticated'](),controller[_0x81ef('0x17')]);router['delete']('/:id/teams',auth[_0x81ef('0x9')](),controller[_0x81ef('0x18')]);module['exports']=router; \ No newline at end of file +var _0x94b1=['get','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put','update','delete','destroy','removeAgents','removeTeams','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','/describe','describe'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x94b1,0x102));var _0x194b=function(_0x44e04f,_0x31968c){_0x44e04f=_0x44e04f-0x0;var _0x479aca=_0x94b1[_0x44e04f];return _0x479aca;};'use strict';var multer=require('multer');var util=require(_0x194b('0x0'));var path=require('path');var timeout=require(_0x194b('0x1'));var express=require(_0x194b('0x2'));var router=express[_0x194b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x194b('0x4'));var interaction=require(_0x194b('0x5'));var config=require(_0x194b('0x6'));var controller=require(_0x194b('0x7'));router['get']('/',auth[_0x194b('0x8')](),controller[_0x194b('0x9')]);router['get'](_0x194b('0xa'),auth[_0x194b('0x8')](),controller[_0x194b('0xb')]);router[_0x194b('0xc')](_0x194b('0xd'),auth[_0x194b('0x8')](),controller[_0x194b('0xe')]);router[_0x194b('0xc')](_0x194b('0xf'),auth['isAuthenticated'](),controller[_0x194b('0x10')]);router[_0x194b('0xc')](_0x194b('0x11'),auth['isAuthenticated'](),controller[_0x194b('0x12')]);router[_0x194b('0x13')]('/',auth[_0x194b('0x8')](),controller[_0x194b('0x14')]);router[_0x194b('0x13')](_0x194b('0xf'),auth[_0x194b('0x8')](),controller[_0x194b('0x15')]);router[_0x194b('0x13')](_0x194b('0x11'),auth[_0x194b('0x8')](),controller[_0x194b('0x16')]);router[_0x194b('0x17')](_0x194b('0xd'),auth[_0x194b('0x8')](),controller[_0x194b('0x18')]);router[_0x194b('0x19')](_0x194b('0xd'),auth[_0x194b('0x8')](),controller[_0x194b('0x1a')]);router[_0x194b('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0x194b('0x1b')]);router[_0x194b('0x19')](_0x194b('0x11'),auth[_0x194b('0x8')](),controller[_0x194b('0x1c')]);module[_0x194b('0x1d')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 182f706..105a4a8 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 _0x7764=['name','VIRTUAL','system-','getDataValue','INTEGER','sequelize','exports','STRING'];(function(_0x33d9c5,_0x2c159d){var _0x28f547=function(_0x61fc92){while(--_0x61fc92){_0x33d9c5['push'](_0x33d9c5['shift']());}};_0x28f547(++_0x2c159d);}(_0x7764,0x8d));var _0x4776=function(_0xd2d54,_0x5329f7){_0xd2d54=_0xd2d54-0x0;var _0x78b113=_0x7764[_0xd2d54];return _0x78b113;};'use strict';var Sequelize=require(_0x4776('0x0'));module[_0x4776('0x1')]={'name':{'type':Sequelize[_0x4776('0x2')],'allowNull':![],'unique':_0x4776('0x3')},'prefix':{'type':Sequelize[_0x4776('0x4')],'get':function(_0xae9529){return _0x4776('0x5')+this[_0x4776('0x6')](_0x4776('0x3'))+'-';}},'description':{'type':Sequelize[_0x4776('0x2')]},'callerIdAll':{'type':Sequelize[_0x4776('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x4776('0x7')]}}; \ No newline at end of file +var _0xc6ce=['name','VIRTUAL','system-','getDataValue','sequelize','STRING'];(function(_0x19941a,_0x4dab4f){var _0x447206=function(_0x91d191){while(--_0x91d191){_0x19941a['push'](_0x19941a['shift']());}};_0x447206(++_0x4dab4f);}(_0xc6ce,0x196));var _0xec6c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc6ce[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0xec6c('0x0'));module['exports']={'name':{'type':Sequelize[_0xec6c('0x1')],'allowNull':![],'unique':_0xec6c('0x2')},'prefix':{'type':Sequelize[_0xec6c('0x3')],'get':function(_0x3c52fa){return _0xec6c('0x4')+this[_0xec6c('0x5')](_0xec6c('0x2'))+'-';}},'description':{'type':Sequelize[_0xec6c('0x1')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 4653b7e..5f62397 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 _0xfff0=['moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./voicePrefix.socket','register','status','json','offset','undefined','limit','set','apply','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','end','sendStatus','error','stack','name','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','include','findAll','rows','show','params','includeAll','options','find','catch','describe','create','sequelize','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','system-','transaction','findById','addAgents','ids','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','findOne','User','getAgents','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','each','upsert','UserVoicePrefix','findOrCreate','select','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','all','value','removeTeams','isEmpty','rimraf','zip-dir','fast-json-patch'];(function(_0x2853dd,_0x36df3b){var _0x420394=function(_0x53dbe0){while(--_0x53dbe0){_0x2853dd['push'](_0x2853dd['shift']());}};_0x420394(++_0x36df3b);}(_0xfff0,0x139));var _0x0fff=function(_0x49d42b,_0x2f07b8){_0x49d42b=_0x49d42b-0x0;var _0x3e2275=_0xfff0[_0x49d42b];return _0x3e2275;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fff('0x0'));var zipdir=require(_0x0fff('0x1'));var jsonpatch=require(_0x0fff('0x2'));var rp=require('request-promise');var moment=require(_0x0fff('0x3'));var BPromise=require(_0x0fff('0x4'));var Mustache=require(_0x0fff('0x5'));var util=require('util');var path=require(_0x0fff('0x6'));var sox=require(_0x0fff('0x7'));var csv=require('to-csv');var ejs=require(_0x0fff('0x8'));var fs=require('fs');var fs_extra=require(_0x0fff('0x9'));var _=require(_0x0fff('0xa'));var squel=require('squel');var crypto=require(_0x0fff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0fff('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0fff('0xd'));var Papa=require(_0x0fff('0xe'));var Redis=require('ioredis');var authService=require(_0x0fff('0xf'));var qs=require(_0x0fff('0x10'));var as=require(_0x0fff('0x11'));var hardwareService=require(_0x0fff('0x12'));var logger=require(_0x0fff('0x13'))(_0x0fff('0x14'));var utils=require(_0x0fff('0x15'));var config=require(_0x0fff('0x16'));var licenseUtil=require(_0x0fff('0x17'));var db=require(_0x0fff('0x18'))['db'];config[_0x0fff('0x19')]=_['defaults'](config[_0x0fff('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x0fff('0x1a'))(new Redis(config[_0x0fff('0x19')]));require(_0x0fff('0x1b'))[_0x0fff('0x1c')](socket);function respondWithStatusCode(_0x55e5fa,_0x53bde9){_0x53bde9=_0x53bde9||0xcc;return function(_0x1daf30){if(_0x1daf30){return _0x55e5fa['sendStatus'](_0x53bde9);}return _0x55e5fa['status'](_0x53bde9)['end']();};}function respondWithResult(_0x1fb430,_0x41e2e7){_0x41e2e7=_0x41e2e7||0xc8;return function(_0x5eab2e){if(_0x5eab2e){return _0x1fb430[_0x0fff('0x1d')](_0x41e2e7)[_0x0fff('0x1e')](_0x5eab2e);}};}function respondWithFilteredResult(_0x540a67,_0x528071){return function(_0x48f36d){if(_0x48f36d){var _0x2337f=typeof _0x528071[_0x0fff('0x1f')]===_0x0fff('0x20')&&typeof _0x528071[_0x0fff('0x21')]===_0x0fff('0x20');var _0xe89b4a=_0x48f36d['count'];var _0x44a54a=_0x2337f?0x0:_0x528071[_0x0fff('0x1f')];var _0x48e6f9=_0x2337f?_0x48f36d['count']:_0x528071['offset']+_0x528071[_0x0fff('0x21')];var _0x330e29;if(_0x48e6f9>=_0xe89b4a){_0x48e6f9=_0xe89b4a;_0x330e29=0xc8;}else{_0x330e29=0xce;}_0x540a67[_0x0fff('0x1d')](_0x330e29);return _0x540a67[_0x0fff('0x22')]('Content-Range',_0x44a54a+'-'+_0x48e6f9+'/'+_0xe89b4a)[_0x0fff('0x1e')](_0x48f36d);}return null;};}function patchUpdates(_0x2f8665){return function(_0x29d703){try{jsonpatch[_0x0fff('0x23')](_0x29d703,_0x2f8665,!![]);}catch(_0x16e7f4){return BPromise[_0x0fff('0x24')](_0x16e7f4);}return _0x29d703['save']();};}function saveUpdates(_0x6a116c,_0x29f702){return function(_0x37e090){if(_0x37e090){return _0x37e090[_0x0fff('0x25')](_0x6a116c)[_0x0fff('0x26')](function(_0x23d9f8){return _0x23d9f8;});}return null;};}function removeEntity(_0x482e1e,_0x2c9725){return function(_0x87b3a6){if(_0x87b3a6){return _0x87b3a6[_0x0fff('0x27')]()[_0x0fff('0x26')](function(){var _0x36d268=_0x87b3a6[_0x0fff('0x28')]({'plain':!![]});var _0x27bd76=_0x0fff('0x29');return db[_0x0fff('0x2a')][_0x0fff('0x27')]({'where':{'type':_0x27bd76,'resourceId':_0x36d268['id']}})[_0x0fff('0x26')](function(){return _0x87b3a6;});})[_0x0fff('0x26')](function(){_0x482e1e['status'](0xcc)[_0x0fff('0x2b')]();});}};}function handleEntityNotFound(_0x2d1800,_0x17ab6f){return function(_0x42441e){if(!_0x42441e){_0x2d1800[_0x0fff('0x2c')](0x194);}return _0x42441e;};}function handleError(_0x125844,_0x47dde0){_0x47dde0=_0x47dde0||0x1f4;return function(_0x31f9a4){logger[_0x0fff('0x2d')](_0x31f9a4[_0x0fff('0x2e')]);if(_0x31f9a4['name']){delete _0x31f9a4[_0x0fff('0x2f')];}_0x125844[_0x0fff('0x1d')](_0x47dde0)['send'](_0x31f9a4);};}exports[_0x0fff('0x30')]=function(_0x433de6,_0x15bb46){var _0x15ae24={},_0x25ab2a={},_0x263e9e={'count':0x0,'rows':[]};var _0x1da352=_[_0x0fff('0x31')](db[_0x0fff('0x32')][_0x0fff('0x33')],function(_0x58469b){return{'name':_0x58469b[_0x0fff('0x34')],'type':_0x58469b[_0x0fff('0x35')][_0x0fff('0x36')]};});_0x25ab2a[_0x0fff('0x37')]=_[_0x0fff('0x31')](_0x1da352,'name');_0x25ab2a['query']=_[_0x0fff('0x38')](_0x433de6[_0x0fff('0x39')]);_0x25ab2a[_0x0fff('0x3a')]=_[_0x0fff('0x3b')](_0x25ab2a['model'],_0x25ab2a[_0x0fff('0x39')]);_0x15ae24[_0x0fff('0x3c')]=_[_0x0fff('0x3b')](_0x25ab2a[_0x0fff('0x37')],qs['fields'](_0x433de6[_0x0fff('0x39')][_0x0fff('0x3d')]));_0x15ae24[_0x0fff('0x3c')]=_0x15ae24[_0x0fff('0x3c')][_0x0fff('0x3e')]?_0x15ae24[_0x0fff('0x3c')]:_0x25ab2a[_0x0fff('0x37')];if(!_0x433de6[_0x0fff('0x39')][_0x0fff('0x3f')](_0x0fff('0x40'))){_0x15ae24[_0x0fff('0x21')]=qs[_0x0fff('0x21')](_0x433de6['query'][_0x0fff('0x21')]);_0x15ae24[_0x0fff('0x1f')]=qs[_0x0fff('0x1f')](_0x433de6[_0x0fff('0x39')][_0x0fff('0x1f')]);}_0x15ae24[_0x0fff('0x41')]=qs['sort'](_0x433de6[_0x0fff('0x39')][_0x0fff('0x42')]);_0x15ae24[_0x0fff('0x43')]=qs[_0x0fff('0x3a')](_[_0x0fff('0x44')](_0x433de6[_0x0fff('0x39')],_0x25ab2a[_0x0fff('0x3a')]),_0x1da352);if(_0x433de6[_0x0fff('0x39')][_0x0fff('0x45')]){_0x15ae24['where']=_[_0x0fff('0x46')](_0x15ae24['where'],{'$or':_[_0x0fff('0x31')](_0x1da352,function(_0x30f329){if(_0x30f329[_0x0fff('0x35')]!=='VIRTUAL'){var _0x5d4c24={};_0x5d4c24[_0x30f329[_0x0fff('0x2f')]]={'$like':'%'+_0x433de6[_0x0fff('0x39')][_0x0fff('0x45')]+'%'};return _0x5d4c24;}})});}_0x15ae24=_['merge']({},_0x15ae24,_0x433de6['options']);var _0x4668b3={'where':_0x15ae24['where']};return db[_0x0fff('0x32')][_0x0fff('0x47')](_0x4668b3)[_0x0fff('0x26')](function(_0x309d75){_0x263e9e[_0x0fff('0x47')]=_0x309d75;if(_0x433de6[_0x0fff('0x39')]['includeAll']){_0x15ae24[_0x0fff('0x48')]=[{'all':!![]}];}return db[_0x0fff('0x32')][_0x0fff('0x49')](_0x15ae24);})[_0x0fff('0x26')](function(_0x7157e5){_0x263e9e[_0x0fff('0x4a')]=_0x7157e5;return _0x263e9e;})[_0x0fff('0x26')](respondWithFilteredResult(_0x15bb46,_0x15ae24))['catch'](handleError(_0x15bb46,null));};exports[_0x0fff('0x4b')]=function(_0x244a27,_0x101b3a){var _0x56a121={'raw':![],'where':{'id':_0x244a27[_0x0fff('0x4c')]['id']}},_0x2de540={};_0x2de540[_0x0fff('0x37')]=_[_0x0fff('0x38')](db[_0x0fff('0x32')][_0x0fff('0x33')]);_0x2de540[_0x0fff('0x39')]=_[_0x0fff('0x38')](_0x244a27[_0x0fff('0x39')]);_0x2de540[_0x0fff('0x3a')]=_[_0x0fff('0x3b')](_0x2de540['model'],_0x2de540[_0x0fff('0x39')]);_0x56a121[_0x0fff('0x3c')]=_['intersection'](_0x2de540[_0x0fff('0x37')],qs[_0x0fff('0x3d')](_0x244a27[_0x0fff('0x39')]['fields']));_0x56a121['attributes']=_0x56a121[_0x0fff('0x3c')]['length']?_0x56a121['attributes']:_0x2de540[_0x0fff('0x37')];if(_0x244a27[_0x0fff('0x39')][_0x0fff('0x4d')]){_0x56a121[_0x0fff('0x48')]=[{'all':!![]}];}_0x56a121=_[_0x0fff('0x46')]({},_0x56a121,_0x244a27[_0x0fff('0x4e')]);return db['VoicePrefix'][_0x0fff('0x4f')](_0x56a121)[_0x0fff('0x26')](handleEntityNotFound(_0x101b3a,null))[_0x0fff('0x26')](respondWithResult(_0x101b3a,null))[_0x0fff('0x50')](handleError(_0x101b3a,null));};exports[_0x0fff('0x27')]=function(_0x2c725c,_0x5d1739){return db[_0x0fff('0x32')][_0x0fff('0x4f')]({'where':{'id':_0x2c725c['params']['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x5d1739,null))['then'](removeEntity(_0x5d1739,null))['catch'](handleError(_0x5d1739,null));};exports['describe']=function(_0x218e1c,_0x30967c){return db[_0x0fff('0x32')][_0x0fff('0x51')]()[_0x0fff('0x26')](respondWithResult(_0x30967c,null))['catch'](handleError(_0x30967c,null));};exports[_0x0fff('0x52')]=function(_0x2c765f,_0x2cbe43){var _0x3b6c98;return db[_0x0fff('0x53')]['transaction'](function(_0x3b401c){return db[_0x0fff('0x32')][_0x0fff('0x52')](_0x2c765f[_0x0fff('0x54')],{'transaction':_0x3b401c})[_0x0fff('0x26')](function(_0x2e8242){_0x3b6c98=_0x2e8242[_0x0fff('0x28')]({'plain':!![]});return db[_0x0fff('0x55')][_0x0fff('0x4f')]({'where':{'id':_0x3b6c98[_0x0fff('0x56')]},'raw':!![]})[_0x0fff('0x26')](function(_0x38168e){return createVoicePrefixExtensions(_0x3b6c98,_0x38168e,_0x3b401c);});});})[_0x0fff('0x26')](function(){var _0x2608be=_0x2c765f[_0x0fff('0x57')][_0x0fff('0x28')]({'plain':!![]});if(!_0x2608be)throw new Error(_0x0fff('0x58'));if(_0x2608be[_0x0fff('0x59')]===_0x0fff('0x57')){var _0x398513=_0x3b6c98;return db[_0x0fff('0x5a')]['find']({'where':{'name':_0x0fff('0x29'),'userProfileId':_0x2608be[_0x0fff('0x5b')]},'raw':!![]})[_0x0fff('0x26')](function(_0x2744b4){if(_0x2744b4&&_0x2744b4['autoAssociation']===0x0){return db[_0x0fff('0x2a')]['create']({'name':_0x398513[_0x0fff('0x2f')],'resourceId':_0x398513['id'],'type':_0x2744b4[_0x0fff('0x2f')],'sectionId':_0x2744b4['id']},{})[_0x0fff('0x26')](function(){return _0x3b6c98;});}else{return _0x3b6c98;}})[_0x0fff('0x50')](function(_0x4bf865){logger[_0x0fff('0x2d')](_0x0fff('0x5c'),_0x4bf865);throw _0x4bf865;});}return _0x3b6c98;})[_0x0fff('0x26')](respondWithResult(_0x2cbe43,null))[_0x0fff('0x50')](handleError(_0x2cbe43,null));};function Extension(_0x4cf619,_0x5ba7e7,_0x449da4,_0x40b8f0){this[_0x0fff('0x5d')]=_0x0fff('0x5e');this[_0x0fff('0x5f')]=_0x4cf619;this[_0x0fff('0x60')]=_0x449da4;this['type']='system';this[_0x0fff('0x61')]=_0x0fff('0x62');this[_0x0fff('0x63')]=_0x5ba7e7;this[_0x0fff('0x64')]=_0x40b8f0;}function createVoicePrefixExtensions(_0x28403f,_0x6a37c9,_0x33eb07){return new BPromise(function(_0x40e5ec,_0x5f2fcc){var _0x12fe95=new Extension(formatPrefixName(_0x28403f['prefix']),0x1,_0x0fff('0x65'),_0x0fff('0x66'));_0x12fe95[_0x0fff('0x67')]=_0x28403f['id'];return db['VoiceExtension']['create'](_0x12fe95,{'transaction':_0x33eb07})[_0x0fff('0x26')](function(_0x504212){var _0x140a35=_0x504212[_0x0fff('0x28')]({'plain':!![]});var _0x452160=_[_0x0fff('0x31')](addVoicePrefixExtensions(_0x28403f,_0x6a37c9),function(_0x4e3a31){_0x4e3a31[_0x0fff('0x56')]=_0x140a35['id'];_0x4e3a31[_0x0fff('0x67')]=_0x28403f['id'];return _0x4e3a31;});return db['VoiceExtension'][_0x0fff('0x68')](_0x452160,{'transaction':_0x33eb07})[_0x0fff('0x26')](function(_0x1111c8){if(!_0x1111c8){return _0x5f2fcc('Extensions\x20creation\x20failed');}else{return _0x40e5ec(_0x1111c8);}})[_0x0fff('0x50')](function(_0x1dc3d6){return _0x5f2fcc(_0x1dc3d6);});});;});};function addVoicePrefixExtensions(_0x1414af,_0x383d78){var _0x3bb183=[];var _0xf4fb1e=formatPrefixName(_0x1414af[_0x0fff('0x69')]);_0x3bb183[_0x0fff('0x6a')](new Extension(_0xf4fb1e,0x2,_0x0fff('0x6b'),_0x0fff('0x6c')+_0x1414af[_0x0fff('0x2f')]));if(_0x1414af[_0x0fff('0x6d')]){_0x3bb183['push'](new Extension(_0xf4fb1e,0x3,'Set',_0x0fff('0x6e')+_0x1414af['callerIdAll']));}else{_0x3bb183['push'](new Extension(_0xf4fb1e,0x3,_0x0fff('0x65'),_0x0fff('0x6f')));}_0x3bb183[_0x0fff('0x6a')](new Extension(_0xf4fb1e,0x4,'goto',_0x383d78['context']+','+_0x0fff('0x70')+(0x8+_0x1414af[_0x0fff('0x2f')][_0x0fff('0x3e')])+'}'+','+0x1));return _0x3bb183;}function formatPrefixName(_0x2586c6){var _0x5af278='_';for(var _0x2f865a=0x0;_0x2f865a<_0x2586c6[_0x0fff('0x3e')];_0x2f865a++){if(_0x2586c6[_0x0fff('0x71')](_0x2f865a)=='-'){_0x5af278+=_0x2586c6[_0x0fff('0x71')](_0x2f865a);}else{_0x5af278+='['+_0x2586c6['charAt'](_0x2f865a)+']';}}_0x5af278+='.';return _0x5af278;}exports[_0x0fff('0x25')]=function(_0x1858fb,_0x4c08c3,_0x51fbf5){var _0x33ed23=_0x1858fb[_0x0fff('0x54')];_0x33ed23[_0x0fff('0x69')]=_0x0fff('0x72')+_0x33ed23[_0x0fff('0x2f')]+'-';return db['sequelize'][_0x0fff('0x73')](function(_0x7b040){return db[_0x0fff('0x32')][_0x0fff('0x25')](_0x33ed23,{'where':{'id':_0x33ed23['id']},'transaction':_0x7b040})[_0x0fff('0x26')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x33ed23['id']},'transaction':_0x7b040})[_0x0fff('0x26')](function(){return db['VoiceExtension'][_0x0fff('0x4f')]({'where':{'id':_0x33ed23[_0x0fff('0x56')]},'raw':!![]})[_0x0fff('0x26')](function(_0x712db4){return createVoicePrefixExtensions(_0x33ed23,_0x712db4,_0x7b040);});});});})[_0x0fff('0x26')](function(){return db['VoicePrefix'][_0x0fff('0x74')](_0x33ed23['id']);})[_0x0fff('0x26')](respondWithResult(_0x4c08c3,null))[_0x0fff('0x50')](handleError(_0x4c08c3,null));};exports[_0x0fff('0x75')]=function(_0x31ff4e,_0x15ab8e,_0x38e2e9){return db[_0x0fff('0x32')][_0x0fff('0x4f')]({'where':{'id':_0x31ff4e[_0x0fff('0x4c')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x15ab8e,null))['then'](function(_0x134012){if(_0x134012){return _0x134012[_0x0fff('0x75')](_0x31ff4e['body'][_0x0fff('0x76')],_['omit'](_0x31ff4e[_0x0fff('0x54')],[_0x0fff('0x76'),'id'])||{})[_0x0fff('0x77')](function(_0x8799c2){for(var _0x13d90e=0x0;_0x13d90e<_0x31ff4e['body'][_0x0fff('0x76')][_0x0fff('0x3e')];_0x13d90e+=0x1){socket['emit'](_0x0fff('0x78'),{'UserId':Number(_0x31ff4e[_0x0fff('0x54')][_0x0fff('0x76')][_0x13d90e]),'VoicePrefixId':Number(_0x31ff4e['params']['id'])});}return _0x8799c2;});}})[_0x0fff('0x26')](respondWithResult(_0x15ab8e,null))[_0x0fff('0x50')](handleError(_0x15ab8e,null));};exports['removeAgents']=function(_0x567544,_0x404b97,_0x49711a){return db['VoicePrefix'][_0x0fff('0x4f')]({'where':{'id':_0x567544[_0x0fff('0x4c')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x404b97,null))['then'](function(_0x4f7282){if(_0x4f7282){return _0x4f7282[_0x0fff('0x79')](_0x567544['query'][_0x0fff('0x76')])[_0x0fff('0x26')](function(){if(_[_0x0fff('0x7a')](_0x567544[_0x0fff('0x39')][_0x0fff('0x76')])){for(var _0x1e940c=0x0;_0x1e940c<_0x567544[_0x0fff('0x39')]['ids'][_0x0fff('0x3e')];_0x1e940c+=0x1){socket[_0x0fff('0x7b')](_0x0fff('0x7c'),{'UserId':Number(_0x567544[_0x0fff('0x39')][_0x0fff('0x76')][_0x1e940c]),'VoicePrefixId':Number(_0x567544[_0x0fff('0x4c')]['id'])});}}else{socket['emit'](_0x0fff('0x7c'),{'UserId':Number(_0x567544['query'][_0x0fff('0x76')]),'VoicePrefixId':Number(_0x567544[_0x0fff('0x4c')]['id'])});}});}})[_0x0fff('0x26')](respondWithStatusCode(_0x404b97,null))[_0x0fff('0x50')](handleError(_0x404b97,null));};exports['getAgents']=function(_0x4fc7c7,_0x34dd99,_0x5baf7f){var _0x3d820e={};var _0x125b12={};var _0x5093fc;var _0x5b04f2;return db[_0x0fff('0x32')][_0x0fff('0x7d')]({'where':{'id':_0x4fc7c7[_0x0fff('0x4c')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x34dd99,null))['then'](function(_0x407f0a){if(_0x407f0a){_0x5093fc=_0x407f0a;_0x125b12['model']=_[_0x0fff('0x38')](db[_0x0fff('0x7e')][_0x0fff('0x33')]);_0x125b12['query']=_['keys'](_0x4fc7c7['query']);_0x125b12[_0x0fff('0x3a')]=_['intersection'](_0x125b12[_0x0fff('0x37')],_0x125b12[_0x0fff('0x39')]);_0x3d820e[_0x0fff('0x3c')]=_[_0x0fff('0x3b')](_0x125b12[_0x0fff('0x37')],qs[_0x0fff('0x3d')](_0x4fc7c7[_0x0fff('0x39')][_0x0fff('0x3d')]));_0x3d820e[_0x0fff('0x3c')]=_0x3d820e[_0x0fff('0x3c')][_0x0fff('0x3e')]?_0x3d820e['attributes']:_0x125b12[_0x0fff('0x37')];_0x3d820e[_0x0fff('0x41')]=qs[_0x0fff('0x42')](_0x4fc7c7[_0x0fff('0x39')][_0x0fff('0x42')]);_0x3d820e['where']=qs[_0x0fff('0x3a')](_[_0x0fff('0x44')](_0x4fc7c7['query'],_0x125b12[_0x0fff('0x3a')]));if(_0x4fc7c7[_0x0fff('0x39')][_0x0fff('0x45')]){_0x3d820e[_0x0fff('0x43')]=_[_0x0fff('0x46')](_0x3d820e[_0x0fff('0x43')],{'$or':_[_0x0fff('0x31')](_0x3d820e[_0x0fff('0x3c')],function(_0x40c4f3){var _0x1c059b={};_0x1c059b[_0x40c4f3]={'$like':'%'+_0x4fc7c7['query'][_0x0fff('0x45')]+'%'};return _0x1c059b;})});}_0x3d820e=_[_0x0fff('0x46')]({},_0x3d820e,_0x4fc7c7[_0x0fff('0x4e')]);return _0x5093fc[_0x0fff('0x7f')](_0x3d820e);}})[_0x0fff('0x26')](function(_0x2fdf96){if(_0x2fdf96){_0x5b04f2=_0x2fdf96[_0x0fff('0x3e')];if(!_0x4fc7c7['query'][_0x0fff('0x3f')]('nolimit')){_0x3d820e[_0x0fff('0x21')]=qs[_0x0fff('0x21')](_0x4fc7c7[_0x0fff('0x39')][_0x0fff('0x21')]);_0x3d820e[_0x0fff('0x1f')]=qs['offset'](_0x4fc7c7[_0x0fff('0x39')]['offset']);}return _0x5093fc['getAgents'](_0x3d820e);}})[_0x0fff('0x26')](function(_0x173b44){if(_0x173b44){return _0x173b44?{'count':_0x5b04f2,'rows':_0x173b44}:null;}})[_0x0fff('0x26')](respondWithResult(_0x34dd99,null))[_0x0fff('0x50')](handleError(_0x34dd99,null));};exports[_0x0fff('0x80')]=function(_0x3995b9,_0x5bc4e1,_0x50f95c){var _0x5b637e={};var _0x1bd02a={};var _0x41b755;var _0x4012aa;return db[_0x0fff('0x32')][_0x0fff('0x7d')]({'where':{'id':_0x3995b9[_0x0fff('0x4c')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x5bc4e1,null))[_0x0fff('0x26')](function(_0xed7e93){if(_0xed7e93){_0x41b755=_0xed7e93;_0x1bd02a[_0x0fff('0x37')]=_[_0x0fff('0x38')](db[_0x0fff('0x81')][_0x0fff('0x33')]);_0x1bd02a[_0x0fff('0x39')]=_[_0x0fff('0x38')](_0x3995b9[_0x0fff('0x39')]);_0x1bd02a[_0x0fff('0x3a')]=_['intersection'](_0x1bd02a[_0x0fff('0x37')],_0x1bd02a[_0x0fff('0x39')]);_0x5b637e[_0x0fff('0x3c')]=_[_0x0fff('0x3b')](_0x1bd02a[_0x0fff('0x37')],qs[_0x0fff('0x3d')](_0x3995b9[_0x0fff('0x39')]['fields']));_0x5b637e[_0x0fff('0x3c')]=_0x5b637e[_0x0fff('0x3c')]['length']?_0x5b637e[_0x0fff('0x3c')]:_0x1bd02a['model'];_0x5b637e[_0x0fff('0x41')]=qs[_0x0fff('0x42')](_0x3995b9['query']['sort']);_0x5b637e['where']=qs[_0x0fff('0x3a')](_['pick'](_0x3995b9['query'],_0x1bd02a['filters']));if(_0x3995b9['query'][_0x0fff('0x45')]){_0x5b637e['where']=_[_0x0fff('0x46')](_0x5b637e['where'],{'$or':_[_0x0fff('0x31')](_0x5b637e['attributes'],function(_0x465dde){var _0x9ca531={};_0x9ca531[_0x465dde]={'$like':'%'+_0x3995b9['query']['filter']+'%'};return _0x9ca531;})});}_0x5b637e=_[_0x0fff('0x46')]({},_0x5b637e,_0x3995b9[_0x0fff('0x4e')]);return _0x41b755[_0x0fff('0x80')](_0x5b637e);}})[_0x0fff('0x26')](function(_0x675250){if(_0x675250){_0x4012aa=_0x675250[_0x0fff('0x3e')];if(!_0x3995b9[_0x0fff('0x39')]['hasOwnProperty'](_0x0fff('0x40'))){_0x5b637e[_0x0fff('0x21')]=qs[_0x0fff('0x21')](_0x3995b9[_0x0fff('0x39')]['limit']);_0x5b637e[_0x0fff('0x1f')]=qs[_0x0fff('0x1f')](_0x3995b9[_0x0fff('0x39')]['offset']);}return _0x41b755['getTeams'](_0x5b637e);}})[_0x0fff('0x26')](function(_0x37b5b4){if(_0x37b5b4){return _0x37b5b4?{'count':_0x4012aa,'rows':_0x37b5b4}:null;}})['then'](respondWithResult(_0x5bc4e1,null))[_0x0fff('0x50')](handleError(_0x5bc4e1,null));};exports[_0x0fff('0x82')]=function(_0x4ab665,_0x2ab827,_0x2a2af9){var _0x2ca40b=_0x4ab665['body']['ids'];var _0x2eeee9;return db[_0x0fff('0x81')]['findAll']({'where':{'id':_0x2ca40b},'attributes':['id'],'include':[{'model':db[_0x0fff('0x7e')],'as':_0x0fff('0x83'),'attributes':['id',_0x0fff('0x2f'),_0x0fff('0x84'),_0x0fff('0x85'),_0x0fff('0x86')],'raw':!![]}]})[_0x0fff('0x26')](function(_0x1b500a){if(_0x1b500a){_0x2eeee9=_0x1b500a;var _0x327b5=_[_0x0fff('0x87')](_0x1b500a,function(_0x10aa61){var _0xc99224=_0x10aa61['get']({'plain':!![]});return _0xc99224[_0x0fff('0x83')];});return db['VoicePrefix'][_0x0fff('0x4f')]({'where':{'id':_0x4ab665['params']['id']}})[_0x0fff('0x26')](function(_0x5336){return db[_0x0fff('0x53')][_0x0fff('0x73')](function(_0x42fbff){return _0x5336[_0x0fff('0x82')](_0x2ca40b,{'transaction':_0x42fbff})['then'](function(){return BPromise[_0x0fff('0x88')](_0x2eeee9,function(_0x39565f){return db['TeamVoicePrefix'][_0x0fff('0x89')]({'TeamId':_0x39565f['id'],'VoicePrefixId':_0x4ab665['params']['id']},{'transaction':_0x42fbff});});})['then'](function(){return BPromise[_0x0fff('0x88')](_0x327b5,function(_0x2e38c3){return db[_0x0fff('0x8a')][_0x0fff('0x8b')]({'where':{'UserId':_0x2e38c3['id'],'VoicePrefixId':_0x4ab665[_0x0fff('0x4c')]['id']},'transaction':_0x42fbff});});})[_0x0fff('0x26')](function(){_0x327b5['forEach'](function(_0xe02ca6){socket[_0x0fff('0x7b')](_0x0fff('0x78'),{'UserId':_0xe02ca6['id'],'VoicePrefixId':_0x5336['id']});});});});});}})[_0x0fff('0x26')](respondWithStatusCode(_0x2ab827,null))[_0x0fff('0x50')](handleError(_0x2ab827,null));};exports['removeTeams']=function(_0x25e9f2,_0xf73eb6,_0x87df03){return db[_0x0fff('0x81')][_0x0fff('0x49')]({'where':{'id':_0x25e9f2[_0x0fff('0x39')][_0x0fff('0x76')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0fff('0x26')](handleEntityNotFound(_0xf73eb6,null))['then'](function(_0x2d206c){var _0x5ed120=_['map'](_0x2d206c,'id');var _0x592341=[];var _0x2e1625=[];var _0x128fe1=squel[_0x0fff('0x8c')]();_0x128fe1[_0x0fff('0x8d')](_0x0fff('0x8e'))['from'](_0x0fff('0x8f'),'tq')[_0x0fff('0x90')](_0x0fff('0x91'),'ut',_0x0fff('0x92'))[_0x0fff('0x43')](_0x0fff('0x93'),_0x25e9f2[_0x0fff('0x4c')]['id']);for(var _0x115445=0x0;_0x115445<_0x2d206c['length'];_0x115445+=0x1){let _0x596074=_0x2d206c[_0x115445];for(var _0x1f1946=0x0;_0x1f1946<_0x596074[_0x0fff('0x83')][_0x0fff('0x3e')];_0x1f1946+=0x1){let _0x47ff09=_0x596074[_0x0fff('0x83')][_0x1f1946];var _0x2ae986=_0x128fe1[_0x0fff('0x94')]();_0x2ae986['where'](_0x0fff('0x95'),_0x47ff09['id']);_0x2e1625[_0x0fff('0x6a')](db[_0x0fff('0x53')][_0x0fff('0x39')](_0x2ae986[_0x0fff('0x96')](),{'type':db[_0x0fff('0x53')][_0x0fff('0x97')]['SELECT']})['then'](function(_0x4a70ee){if(_0x4a70ee[_0x0fff('0x3e')]===0x1){return _0x47ff09['id'];}else{var _0x425412=_[_0x0fff('0x98')](_[_0x0fff('0x31')](_0x4a70ee,_0x0fff('0x99')),function(_0x41afce){return _['includes'](_0x5ed120,_0x41afce);});if(_0x425412){return _0x47ff09['id'];}}}));}}return BPromise[_0x0fff('0x9a')](_0x2e1625)[_0x0fff('0x26')](function(_0x7928f7){_0x592341=_(_0x592341)['union'](_0x7928f7)['compact']()[_0x0fff('0x9b')]();return db['VoicePrefix'][_0x0fff('0x4f')]({'where':{'id':_0x25e9f2[_0x0fff('0x4c')]['id']}})['then'](function(_0x1bf39f){return db[_0x0fff('0x53')]['transaction'](function(_0xb6faf){return _0x1bf39f[_0x0fff('0x9c')](_0x25e9f2[_0x0fff('0x39')][_0x0fff('0x76')],{'transaction':_0xb6faf})[_0x0fff('0x26')](function(){if(!_[_0x0fff('0x9d')](_0x592341)){return _0x1bf39f['removeAgents'](_0x592341,{'transaction':_0xb6faf});}})[_0x0fff('0x26')](function(){_0x592341['forEach'](function(_0xf72b2b){socket['emit'](_0x0fff('0x7c'),{'UserId':_0xf72b2b,'VoicePrefixId':_0x1bf39f['id']});});});});});});})['then'](respondWithStatusCode(_0xf73eb6,null))[_0x0fff('0x50')](handleError(_0xf73eb6,null));}; \ No newline at end of file +var _0x7916=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','undefined','limit','count','offset','Content-Range','json','reject','then','destroy','get','UserProfileResource','end','error','name','send','index','map','VoicePrefix','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','show','params','keys','rawAttributes','length','find','catch','describe','create','sequelize','body','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','description','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','charAt','update','system-','transaction','findById','addAgents','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getTeams','Team','findAll','Agents','online','interface','flatMap','upsert','each','UserVoicePrefix','findOrCreate','forEach','removeTeams','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','querystring','papaparse'];(function(_0x82f5dd,_0x432de6){var _0x2d16ac=function(_0x25b4e9){while(--_0x25b4e9){_0x82f5dd['push'](_0x82f5dd['shift']());}};_0x2d16ac(++_0x432de6);}(_0x7916,0x128));var _0x6791=function(_0x39fc48,_0x450a80){_0x39fc48=_0x39fc48-0x0;var _0x22f878=_0x7916[_0x39fc48];return _0x22f878;};'use strict';var emlformat=require(_0x6791('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6791('0x1'));var jsonpatch=require(_0x6791('0x2'));var rp=require('request-promise');var moment=require(_0x6791('0x3'));var BPromise=require(_0x6791('0x4'));var Mustache=require(_0x6791('0x5'));var util=require(_0x6791('0x6'));var path=require('path');var sox=require(_0x6791('0x7'));var csv=require('to-csv');var ejs=require(_0x6791('0x8'));var fs=require('fs');var fs_extra=require(_0x6791('0x9'));var _=require('lodash');var squel=require(_0x6791('0xa'));var crypto=require('crypto');var jsforce=require(_0x6791('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6791('0xc'));var Papa=require(_0x6791('0xd'));var Redis=require('ioredis');var authService=require(_0x6791('0xe'));var qs=require(_0x6791('0xf'));var as=require(_0x6791('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6791('0x11'))(_0x6791('0x12'));var utils=require(_0x6791('0x13'));var config=require(_0x6791('0x14'));var licenseUtil=require(_0x6791('0x15'));var db=require(_0x6791('0x16'))['db'];config[_0x6791('0x17')]=_[_0x6791('0x18')](config[_0x6791('0x17')],{'host':_0x6791('0x19'),'port':0x18eb});var socket=require(_0x6791('0x1a'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x6791('0x1b')](socket);function respondWithStatusCode(_0x5122f9,_0x2a9151){_0x2a9151=_0x2a9151||0xcc;return function(_0x4c32a1){if(_0x4c32a1){return _0x5122f9[_0x6791('0x1c')](_0x2a9151);}return _0x5122f9[_0x6791('0x1d')](_0x2a9151)['end']();};}function respondWithResult(_0x3e4792,_0x4b80ed){_0x4b80ed=_0x4b80ed||0xc8;return function(_0x3856ac){if(_0x3856ac){return _0x3e4792[_0x6791('0x1d')](_0x4b80ed)['json'](_0x3856ac);}};}function respondWithFilteredResult(_0xbc35d,_0x36d7a1){return function(_0x5bec14){if(_0x5bec14){var _0x1872f5=typeof _0x36d7a1['offset']===_0x6791('0x1e')&&typeof _0x36d7a1[_0x6791('0x1f')]===_0x6791('0x1e');var _0x3a72ce=_0x5bec14[_0x6791('0x20')];var _0x2bc0ab=_0x1872f5?0x0:_0x36d7a1[_0x6791('0x21')];var _0x581d51=_0x1872f5?_0x5bec14[_0x6791('0x20')]:_0x36d7a1[_0x6791('0x21')]+_0x36d7a1['limit'];var _0x21ef16;if(_0x581d51>=_0x3a72ce){_0x581d51=_0x3a72ce;_0x21ef16=0xc8;}else{_0x21ef16=0xce;}_0xbc35d[_0x6791('0x1d')](_0x21ef16);return _0xbc35d['set'](_0x6791('0x22'),_0x2bc0ab+'-'+_0x581d51+'/'+_0x3a72ce)[_0x6791('0x23')](_0x5bec14);}return null;};}function patchUpdates(_0x15b9ab){return function(_0x12d83b){try{jsonpatch['apply'](_0x12d83b,_0x15b9ab,!![]);}catch(_0x3e17b3){return BPromise[_0x6791('0x24')](_0x3e17b3);}return _0x12d83b['save']();};}function saveUpdates(_0x53bb44,_0x4b23bc){return function(_0x372dae){if(_0x372dae){return _0x372dae['update'](_0x53bb44)[_0x6791('0x25')](function(_0x5409f1){return _0x5409f1;});}return null;};}function removeEntity(_0x54a092,_0x496273){return function(_0x5cadc){if(_0x5cadc){return _0x5cadc[_0x6791('0x26')]()[_0x6791('0x25')](function(){var _0x56a74e=_0x5cadc[_0x6791('0x27')]({'plain':!![]});var _0x30cc17='VoicePrefixes';return db[_0x6791('0x28')]['destroy']({'where':{'type':_0x30cc17,'resourceId':_0x56a74e['id']}})[_0x6791('0x25')](function(){return _0x5cadc;});})['then'](function(){_0x54a092['status'](0xcc)[_0x6791('0x29')]();});}};}function handleEntityNotFound(_0x551718,_0x2f56a2){return function(_0x34b006){if(!_0x34b006){_0x551718['sendStatus'](0x194);}return _0x34b006;};}function handleError(_0x240a9f,_0x273f79){_0x273f79=_0x273f79||0x1f4;return function(_0x234c5e){logger[_0x6791('0x2a')](_0x234c5e['stack']);if(_0x234c5e['name']){delete _0x234c5e[_0x6791('0x2b')];}_0x240a9f['status'](_0x273f79)[_0x6791('0x2c')](_0x234c5e);};}exports[_0x6791('0x2d')]=function(_0x30397e,_0x2b98b8){var _0x1d551b={},_0x127bfa={},_0x8e2101={'count':0x0,'rows':[]};var _0x14307e=_[_0x6791('0x2e')](db[_0x6791('0x2f')]['rawAttributes'],function(_0x28b3d4){return{'name':_0x28b3d4[_0x6791('0x30')],'type':_0x28b3d4[_0x6791('0x31')][_0x6791('0x32')]};});_0x127bfa[_0x6791('0x33')]=_[_0x6791('0x2e')](_0x14307e,'name');_0x127bfa['query']=_['keys'](_0x30397e[_0x6791('0x34')]);_0x127bfa[_0x6791('0x35')]=_[_0x6791('0x36')](_0x127bfa['model'],_0x127bfa['query']);_0x1d551b[_0x6791('0x37')]=_[_0x6791('0x36')](_0x127bfa[_0x6791('0x33')],qs[_0x6791('0x38')](_0x30397e['query'][_0x6791('0x38')]));_0x1d551b[_0x6791('0x37')]=_0x1d551b[_0x6791('0x37')]['length']?_0x1d551b[_0x6791('0x37')]:_0x127bfa['model'];if(!_0x30397e['query'][_0x6791('0x39')](_0x6791('0x3a'))){_0x1d551b['limit']=qs[_0x6791('0x1f')](_0x30397e[_0x6791('0x34')][_0x6791('0x1f')]);_0x1d551b[_0x6791('0x21')]=qs[_0x6791('0x21')](_0x30397e['query'][_0x6791('0x21')]);}_0x1d551b[_0x6791('0x3b')]=qs[_0x6791('0x3c')](_0x30397e['query'][_0x6791('0x3c')]);_0x1d551b[_0x6791('0x3d')]=qs[_0x6791('0x35')](_['pick'](_0x30397e[_0x6791('0x34')],_0x127bfa[_0x6791('0x35')]),_0x14307e);if(_0x30397e[_0x6791('0x34')][_0x6791('0x3e')]){_0x1d551b['where']=_[_0x6791('0x3f')](_0x1d551b[_0x6791('0x3d')],{'$or':_[_0x6791('0x2e')](_0x14307e,function(_0xd0f1c){if(_0xd0f1c[_0x6791('0x31')]!==_0x6791('0x40')){var _0x2688a9={};_0x2688a9[_0xd0f1c[_0x6791('0x2b')]]={'$like':'%'+_0x30397e[_0x6791('0x34')]['filter']+'%'};return _0x2688a9;}})});}_0x1d551b=_['merge']({},_0x1d551b,_0x30397e[_0x6791('0x41')]);var _0xe11675={'where':_0x1d551b['where']};return db[_0x6791('0x2f')][_0x6791('0x20')](_0xe11675)[_0x6791('0x25')](function(_0x3edb86){_0x8e2101[_0x6791('0x20')]=_0x3edb86;if(_0x30397e[_0x6791('0x34')][_0x6791('0x42')]){_0x1d551b['include']=[{'all':!![]}];}return db[_0x6791('0x2f')]['findAll'](_0x1d551b);})[_0x6791('0x25')](function(_0xfc170e){_0x8e2101[_0x6791('0x43')]=_0xfc170e;return _0x8e2101;})[_0x6791('0x25')](respondWithFilteredResult(_0x2b98b8,_0x1d551b))['catch'](handleError(_0x2b98b8,null));};exports[_0x6791('0x44')]=function(_0x4f0e2d,_0xeb9d45){var _0x3251e9={'raw':![],'where':{'id':_0x4f0e2d[_0x6791('0x45')]['id']}},_0x5a7fb6={};_0x5a7fb6[_0x6791('0x33')]=_[_0x6791('0x46')](db['VoicePrefix'][_0x6791('0x47')]);_0x5a7fb6[_0x6791('0x34')]=_[_0x6791('0x46')](_0x4f0e2d[_0x6791('0x34')]);_0x5a7fb6['filters']=_[_0x6791('0x36')](_0x5a7fb6[_0x6791('0x33')],_0x5a7fb6['query']);_0x3251e9[_0x6791('0x37')]=_['intersection'](_0x5a7fb6[_0x6791('0x33')],qs[_0x6791('0x38')](_0x4f0e2d[_0x6791('0x34')][_0x6791('0x38')]));_0x3251e9[_0x6791('0x37')]=_0x3251e9[_0x6791('0x37')][_0x6791('0x48')]?_0x3251e9[_0x6791('0x37')]:_0x5a7fb6[_0x6791('0x33')];if(_0x4f0e2d['query'][_0x6791('0x42')]){_0x3251e9['include']=[{'all':!![]}];}_0x3251e9=_[_0x6791('0x3f')]({},_0x3251e9,_0x4f0e2d[_0x6791('0x41')]);return db[_0x6791('0x2f')][_0x6791('0x49')](_0x3251e9)[_0x6791('0x25')](handleEntityNotFound(_0xeb9d45,null))['then'](respondWithResult(_0xeb9d45,null))[_0x6791('0x4a')](handleError(_0xeb9d45,null));};exports[_0x6791('0x26')]=function(_0x235b56,_0x3d22f3){return db[_0x6791('0x2f')]['find']({'where':{'id':_0x235b56[_0x6791('0x45')]['id']}})[_0x6791('0x25')](handleEntityNotFound(_0x3d22f3,null))['then'](removeEntity(_0x3d22f3,null))[_0x6791('0x4a')](handleError(_0x3d22f3,null));};exports['describe']=function(_0x3d4b7e,_0x22a4d3){return db[_0x6791('0x2f')][_0x6791('0x4b')]()['then'](respondWithResult(_0x22a4d3,null))[_0x6791('0x4a')](handleError(_0x22a4d3,null));};exports[_0x6791('0x4c')]=function(_0x5655c8,_0x189b22){var _0x4370ab;return db[_0x6791('0x4d')]['transaction'](function(_0x355e97){return db[_0x6791('0x2f')]['create'](_0x5655c8[_0x6791('0x4e')],{'transaction':_0x355e97})[_0x6791('0x25')](function(_0x49d583){_0x4370ab=_0x49d583[_0x6791('0x27')]({'plain':!![]});return db[_0x6791('0x4f')][_0x6791('0x49')]({'where':{'id':_0x4370ab[_0x6791('0x50')]},'raw':!![]})['then'](function(_0x3c1076){return createVoicePrefixExtensions(_0x4370ab,_0x3c1076,_0x355e97);});});})[_0x6791('0x25')](function(){var _0x32f36b=_0x5655c8['user']['get']({'plain':!![]});if(!_0x32f36b)throw new Error(_0x6791('0x51'));if(_0x32f36b[_0x6791('0x52')]===_0x6791('0x53')){var _0x45756f=_0x4370ab;return db[_0x6791('0x54')]['find']({'where':{'name':'VoicePrefixes','userProfileId':_0x32f36b[_0x6791('0x55')]},'raw':!![]})['then'](function(_0x51f071){if(_0x51f071&&_0x51f071[_0x6791('0x56')]===0x0){return db[_0x6791('0x28')][_0x6791('0x4c')]({'name':_0x45756f[_0x6791('0x2b')],'resourceId':_0x45756f['id'],'type':_0x51f071[_0x6791('0x2b')],'sectionId':_0x51f071['id']},{})[_0x6791('0x25')](function(){return _0x4370ab;});}else{return _0x4370ab;}})['catch'](function(_0x5a30f3){logger[_0x6791('0x2a')](_0x6791('0x57'),_0x5a30f3);throw _0x5a30f3;});}return _0x4370ab;})['then'](respondWithResult(_0x189b22,null))[_0x6791('0x4a')](handleError(_0x189b22,null));};function Extension(_0x535ecf,_0x473443,_0x15fb6c,_0x50cf85){this[_0x6791('0x58')]=_0x6791('0x59');this[_0x6791('0x5a')]=_0x535ecf;this['app']=_0x15fb6c;this[_0x6791('0x31')]=_0x6791('0x5b');this[_0x6791('0x5c')]=_0x6791('0x5d');this[_0x6791('0x5e')]=_0x473443;this['appdata']=_0x50cf85;}function createVoicePrefixExtensions(_0x54d0ba,_0x1a9acd,_0x13430e){return new BPromise(function(_0x5d2668,_0x329fc0){var _0x466a64=new Extension(formatPrefixName(_0x54d0ba[_0x6791('0x5f')]),0x1,_0x6791('0x60'),_0x6791('0x61'));_0x466a64[_0x6791('0x62')]=_0x54d0ba['id'];return db[_0x6791('0x4f')][_0x6791('0x4c')](_0x466a64,{'transaction':_0x13430e})['then'](function(_0x2c5f12){var _0x3b46bf=_0x2c5f12[_0x6791('0x27')]({'plain':!![]});var _0x1a9a2e=_['map'](addVoicePrefixExtensions(_0x54d0ba,_0x1a9acd),function(_0x16dff7){_0x16dff7[_0x6791('0x50')]=_0x3b46bf['id'];_0x16dff7[_0x6791('0x62')]=_0x54d0ba['id'];return _0x16dff7;});return db['VoiceExtension'][_0x6791('0x63')](_0x1a9a2e,{'transaction':_0x13430e})[_0x6791('0x25')](function(_0x99d4ee){if(!_0x99d4ee){return _0x329fc0(_0x6791('0x64'));}else{return _0x5d2668(_0x99d4ee);}})['catch'](function(_0x2c834f){return _0x329fc0(_0x2c834f);});});;});};function addVoicePrefixExtensions(_0x2843fb,_0x5522db){var _0x1114d4=[];var _0x901cc1=formatPrefixName(_0x2843fb[_0x6791('0x5f')]);_0x1114d4[_0x6791('0x65')](new Extension(_0x901cc1,0x2,_0x6791('0x66'),_0x6791('0x67')+_0x2843fb['name']));if(_0x2843fb[_0x6791('0x68')]){_0x1114d4[_0x6791('0x65')](new Extension(_0x901cc1,0x3,_0x6791('0x66'),'PREFIX-CALLERIDALL='+_0x2843fb[_0x6791('0x68')]));}else{_0x1114d4['push'](new Extension(_0x901cc1,0x3,_0x6791('0x60'),_0x6791('0x69')));}_0x1114d4[_0x6791('0x65')](new Extension(_0x901cc1,0x4,_0x6791('0x6a'),_0x5522db[_0x6791('0x58')]+','+'${EXTEN:'+(0x8+_0x2843fb[_0x6791('0x2b')][_0x6791('0x48')])+'}'+','+0x1));return _0x1114d4;}function formatPrefixName(_0x375062){var _0x2accfa='_';for(var _0x5f158f=0x0;_0x5f158f<_0x375062[_0x6791('0x48')];_0x5f158f++){if(_0x375062[_0x6791('0x6b')](_0x5f158f)=='-'){_0x2accfa+=_0x375062['charAt'](_0x5f158f);}else{_0x2accfa+='['+_0x375062[_0x6791('0x6b')](_0x5f158f)+']';}}_0x2accfa+='.';return _0x2accfa;}exports[_0x6791('0x6c')]=function(_0x567302,_0x201465,_0x23b9b4){var _0x113d9f=_0x567302[_0x6791('0x4e')];_0x113d9f['prefix']=_0x6791('0x6d')+_0x113d9f[_0x6791('0x2b')]+'-';return db['sequelize'][_0x6791('0x6e')](function(_0x26c2aa){return db[_0x6791('0x2f')][_0x6791('0x6c')](_0x113d9f,{'where':{'id':_0x113d9f['id']},'transaction':_0x26c2aa})[_0x6791('0x25')](function(){return db['VoiceExtension'][_0x6791('0x26')]({'where':{'VoicePrefixId':_0x113d9f['id']},'transaction':_0x26c2aa})[_0x6791('0x25')](function(){return db['VoiceExtension'][_0x6791('0x49')]({'where':{'id':_0x113d9f[_0x6791('0x50')]},'raw':!![]})[_0x6791('0x25')](function(_0x4bbf2d){return createVoicePrefixExtensions(_0x113d9f,_0x4bbf2d,_0x26c2aa);});});});})[_0x6791('0x25')](function(){return db[_0x6791('0x2f')][_0x6791('0x6f')](_0x113d9f['id']);})[_0x6791('0x25')](respondWithResult(_0x201465,null))[_0x6791('0x4a')](handleError(_0x201465,null));};exports[_0x6791('0x70')]=function(_0x367dc9,_0x30b3e6,_0x4cca28){return db[_0x6791('0x2f')][_0x6791('0x49')]({'where':{'id':_0x367dc9['params']['id']}})[_0x6791('0x25')](handleEntityNotFound(_0x30b3e6,null))[_0x6791('0x25')](function(_0x410a66){if(_0x410a66){return _0x410a66['addAgents'](_0x367dc9[_0x6791('0x4e')]['ids'],_[_0x6791('0x71')](_0x367dc9[_0x6791('0x4e')],[_0x6791('0x72'),'id'])||{})[_0x6791('0x73')](function(_0x3a964a){for(var _0x2d15b5=0x0;_0x2d15b5<_0x367dc9[_0x6791('0x4e')][_0x6791('0x72')][_0x6791('0x48')];_0x2d15b5+=0x1){socket[_0x6791('0x74')](_0x6791('0x75'),{'UserId':Number(_0x367dc9[_0x6791('0x4e')][_0x6791('0x72')][_0x2d15b5]),'VoicePrefixId':Number(_0x367dc9[_0x6791('0x45')]['id'])});}return _0x3a964a;});}})[_0x6791('0x25')](respondWithResult(_0x30b3e6,null))[_0x6791('0x4a')](handleError(_0x30b3e6,null));};exports[_0x6791('0x76')]=function(_0x386bc7,_0xc6c959,_0x5cf7d7){return db['VoicePrefix']['find']({'where':{'id':_0x386bc7[_0x6791('0x45')]['id']}})[_0x6791('0x25')](handleEntityNotFound(_0xc6c959,null))[_0x6791('0x25')](function(_0x194a0b){if(_0x194a0b){return _0x194a0b[_0x6791('0x76')](_0x386bc7[_0x6791('0x34')][_0x6791('0x72')])[_0x6791('0x25')](function(){if(_[_0x6791('0x77')](_0x386bc7[_0x6791('0x34')][_0x6791('0x72')])){for(var _0x37ae6b=0x0;_0x37ae6b<_0x386bc7[_0x6791('0x34')][_0x6791('0x72')][_0x6791('0x48')];_0x37ae6b+=0x1){socket[_0x6791('0x74')](_0x6791('0x78'),{'UserId':Number(_0x386bc7[_0x6791('0x34')][_0x6791('0x72')][_0x37ae6b]),'VoicePrefixId':Number(_0x386bc7[_0x6791('0x45')]['id'])});}}else{socket[_0x6791('0x74')](_0x6791('0x78'),{'UserId':Number(_0x386bc7[_0x6791('0x34')][_0x6791('0x72')]),'VoicePrefixId':Number(_0x386bc7[_0x6791('0x45')]['id'])});}});}})['then'](respondWithStatusCode(_0xc6c959,null))[_0x6791('0x4a')](handleError(_0xc6c959,null));};exports['getAgents']=function(_0x8d9556,_0x11eb22,_0x4b262c){var _0x1c2864={};var _0x503041={};var _0x27e3bd;var _0x26e77c;return db['VoicePrefix'][_0x6791('0x79')]({'where':{'id':_0x8d9556[_0x6791('0x45')]['id']}})[_0x6791('0x25')](handleEntityNotFound(_0x11eb22,null))['then'](function(_0x41fcf4){if(_0x41fcf4){_0x27e3bd=_0x41fcf4;_0x503041[_0x6791('0x33')]=_[_0x6791('0x46')](db[_0x6791('0x7a')][_0x6791('0x47')]);_0x503041[_0x6791('0x34')]=_['keys'](_0x8d9556[_0x6791('0x34')]);_0x503041[_0x6791('0x35')]=_[_0x6791('0x36')](_0x503041[_0x6791('0x33')],_0x503041[_0x6791('0x34')]);_0x1c2864[_0x6791('0x37')]=_[_0x6791('0x36')](_0x503041['model'],qs[_0x6791('0x38')](_0x8d9556['query'][_0x6791('0x38')]));_0x1c2864['attributes']=_0x1c2864[_0x6791('0x37')][_0x6791('0x48')]?_0x1c2864[_0x6791('0x37')]:_0x503041[_0x6791('0x33')];_0x1c2864[_0x6791('0x3b')]=qs[_0x6791('0x3c')](_0x8d9556['query'][_0x6791('0x3c')]);_0x1c2864['where']=qs[_0x6791('0x35')](_['pick'](_0x8d9556['query'],_0x503041['filters']));if(_0x8d9556[_0x6791('0x34')][_0x6791('0x3e')]){_0x1c2864['where']=_[_0x6791('0x3f')](_0x1c2864['where'],{'$or':_[_0x6791('0x2e')](_0x1c2864[_0x6791('0x37')],function(_0x4f52c2){var _0x494435={};_0x494435[_0x4f52c2]={'$like':'%'+_0x8d9556['query'][_0x6791('0x3e')]+'%'};return _0x494435;})});}_0x1c2864=_[_0x6791('0x3f')]({},_0x1c2864,_0x8d9556[_0x6791('0x41')]);return _0x27e3bd['getAgents'](_0x1c2864);}})[_0x6791('0x25')](function(_0x20ded4){if(_0x20ded4){_0x26e77c=_0x20ded4[_0x6791('0x48')];if(!_0x8d9556[_0x6791('0x34')][_0x6791('0x39')]('nolimit')){_0x1c2864[_0x6791('0x1f')]=qs[_0x6791('0x1f')](_0x8d9556[_0x6791('0x34')][_0x6791('0x1f')]);_0x1c2864[_0x6791('0x21')]=qs['offset'](_0x8d9556[_0x6791('0x34')][_0x6791('0x21')]);}return _0x27e3bd['getAgents'](_0x1c2864);}})[_0x6791('0x25')](function(_0x46aea7){if(_0x46aea7){return _0x46aea7?{'count':_0x26e77c,'rows':_0x46aea7}:null;}})[_0x6791('0x25')](respondWithResult(_0x11eb22,null))[_0x6791('0x4a')](handleError(_0x11eb22,null));};exports['getTeams']=function(_0x29e2a0,_0x1092d4,_0x370da4){var _0xdf1dd4={};var _0xa5eb83={};var _0x145814;var _0x5dcaab;return db[_0x6791('0x2f')]['findOne']({'where':{'id':_0x29e2a0['params']['id']}})[_0x6791('0x25')](handleEntityNotFound(_0x1092d4,null))[_0x6791('0x25')](function(_0x313d5d){if(_0x313d5d){_0x145814=_0x313d5d;_0xa5eb83['model']=_[_0x6791('0x46')](db['Team'][_0x6791('0x47')]);_0xa5eb83[_0x6791('0x34')]=_['keys'](_0x29e2a0[_0x6791('0x34')]);_0xa5eb83[_0x6791('0x35')]=_[_0x6791('0x36')](_0xa5eb83[_0x6791('0x33')],_0xa5eb83[_0x6791('0x34')]);_0xdf1dd4['attributes']=_[_0x6791('0x36')](_0xa5eb83[_0x6791('0x33')],qs[_0x6791('0x38')](_0x29e2a0['query']['fields']));_0xdf1dd4[_0x6791('0x37')]=_0xdf1dd4[_0x6791('0x37')]['length']?_0xdf1dd4[_0x6791('0x37')]:_0xa5eb83[_0x6791('0x33')];_0xdf1dd4[_0x6791('0x3b')]=qs['sort'](_0x29e2a0[_0x6791('0x34')]['sort']);_0xdf1dd4['where']=qs[_0x6791('0x35')](_['pick'](_0x29e2a0[_0x6791('0x34')],_0xa5eb83[_0x6791('0x35')]));if(_0x29e2a0[_0x6791('0x34')][_0x6791('0x3e')]){_0xdf1dd4[_0x6791('0x3d')]=_[_0x6791('0x3f')](_0xdf1dd4['where'],{'$or':_[_0x6791('0x2e')](_0xdf1dd4['attributes'],function(_0x221fad){var _0x4d6641={};_0x4d6641[_0x221fad]={'$like':'%'+_0x29e2a0['query'][_0x6791('0x3e')]+'%'};return _0x4d6641;})});}_0xdf1dd4=_[_0x6791('0x3f')]({},_0xdf1dd4,_0x29e2a0[_0x6791('0x41')]);return _0x145814[_0x6791('0x7b')](_0xdf1dd4);}})[_0x6791('0x25')](function(_0x11089f){if(_0x11089f){_0x5dcaab=_0x11089f[_0x6791('0x48')];if(!_0x29e2a0[_0x6791('0x34')][_0x6791('0x39')](_0x6791('0x3a'))){_0xdf1dd4[_0x6791('0x1f')]=qs[_0x6791('0x1f')](_0x29e2a0[_0x6791('0x34')][_0x6791('0x1f')]);_0xdf1dd4[_0x6791('0x21')]=qs[_0x6791('0x21')](_0x29e2a0[_0x6791('0x34')][_0x6791('0x21')]);}return _0x145814[_0x6791('0x7b')](_0xdf1dd4);}})['then'](function(_0xfef30e){if(_0xfef30e){return _0xfef30e?{'count':_0x5dcaab,'rows':_0xfef30e}:null;}})[_0x6791('0x25')](respondWithResult(_0x1092d4,null))[_0x6791('0x4a')](handleError(_0x1092d4,null));};exports['addTeams']=function(_0x4c6eb1,_0x4bce1d,_0x42d7fb){var _0x257efa=_0x4c6eb1['body'][_0x6791('0x72')];var _0x17c93e;return db[_0x6791('0x7c')][_0x6791('0x7d')]({'where':{'id':_0x257efa},'attributes':['id'],'include':[{'model':db[_0x6791('0x7a')],'as':_0x6791('0x7e'),'attributes':['id',_0x6791('0x2b'),_0x6791('0x7f'),'voicePause',_0x6791('0x80')],'raw':!![]}]})['then'](function(_0xd61243){if(_0xd61243){_0x17c93e=_0xd61243;var _0x123627=_[_0x6791('0x81')](_0xd61243,function(_0x5d5963){var _0x4d36de=_0x5d5963['get']({'plain':!![]});return _0x4d36de[_0x6791('0x7e')];});return db[_0x6791('0x2f')][_0x6791('0x49')]({'where':{'id':_0x4c6eb1[_0x6791('0x45')]['id']}})['then'](function(_0x3b487a){return db[_0x6791('0x4d')][_0x6791('0x6e')](function(_0x3b0d8f){return _0x3b487a['addTeams'](_0x257efa,{'transaction':_0x3b0d8f})['then'](function(){return BPromise['each'](_0x17c93e,function(_0x3a7711){return db['TeamVoicePrefix'][_0x6791('0x82')]({'TeamId':_0x3a7711['id'],'VoicePrefixId':_0x4c6eb1[_0x6791('0x45')]['id']},{'transaction':_0x3b0d8f});});})[_0x6791('0x25')](function(){return BPromise[_0x6791('0x83')](_0x123627,function(_0x15a95b){return db[_0x6791('0x84')][_0x6791('0x85')]({'where':{'UserId':_0x15a95b['id'],'VoicePrefixId':_0x4c6eb1[_0x6791('0x45')]['id']},'transaction':_0x3b0d8f});});})['then'](function(){_0x123627[_0x6791('0x86')](function(_0x300c8b){socket['emit'](_0x6791('0x75'),{'UserId':_0x300c8b['id'],'VoicePrefixId':_0x3b487a['id']});});});});});}})[_0x6791('0x25')](respondWithStatusCode(_0x4bce1d,null))[_0x6791('0x4a')](handleError(_0x4bce1d,null));};exports[_0x6791('0x87')]=function(_0x4f88e4,_0x447ea6,_0x31a2c8){return db[_0x6791('0x7c')][_0x6791('0x7d')]({'where':{'id':_0x4f88e4[_0x6791('0x34')][_0x6791('0x72')]},'attributes':['id'],'include':[{'model':db[_0x6791('0x7a')],'as':_0x6791('0x7e'),'attributes':['id'],'raw':!![]}]})[_0x6791('0x25')](handleEntityNotFound(_0x447ea6,null))['then'](function(_0x150a13){var _0x211721=_[_0x6791('0x2e')](_0x150a13,'id');var _0xb7986d=[];var _0x19cb72=[];var _0x5aad37=squel['select']();_0x5aad37[_0x6791('0x88')](_0x6791('0x89'))['from'](_0x6791('0x8a'),'tq')[_0x6791('0x8b')](_0x6791('0x8c'),'ut',_0x6791('0x8d'))[_0x6791('0x3d')](_0x6791('0x8e'),_0x4f88e4[_0x6791('0x45')]['id']);for(var _0x21a12c=0x0;_0x21a12c<_0x150a13[_0x6791('0x48')];_0x21a12c+=0x1){let _0x54a34f=_0x150a13[_0x21a12c];for(var _0x405e1c=0x0;_0x405e1c<_0x54a34f[_0x6791('0x7e')]['length'];_0x405e1c+=0x1){let _0x303ba8=_0x54a34f['Agents'][_0x405e1c];var _0x23bed3=_0x5aad37[_0x6791('0x8f')]();_0x23bed3[_0x6791('0x3d')](_0x6791('0x90'),_0x303ba8['id']);_0x19cb72[_0x6791('0x65')](db[_0x6791('0x4d')][_0x6791('0x34')](_0x23bed3[_0x6791('0x91')](),{'type':db[_0x6791('0x4d')][_0x6791('0x92')][_0x6791('0x93')]})[_0x6791('0x25')](function(_0x1f06d8){if(_0x1f06d8[_0x6791('0x48')]===0x1){return _0x303ba8['id'];}else{var _0x46d6ff=_[_0x6791('0x94')](_[_0x6791('0x2e')](_0x1f06d8,_0x6791('0x95')),function(_0x462e03){return _['includes'](_0x211721,_0x462e03);});if(_0x46d6ff){return _0x303ba8['id'];}}}));}}return BPromise[_0x6791('0x96')](_0x19cb72)['then'](function(_0x41385c){_0xb7986d=_(_0xb7986d)[_0x6791('0x97')](_0x41385c)[_0x6791('0x98')]()[_0x6791('0x99')]();return db[_0x6791('0x2f')][_0x6791('0x49')]({'where':{'id':_0x4f88e4[_0x6791('0x45')]['id']}})[_0x6791('0x25')](function(_0x546bf7){return db[_0x6791('0x4d')]['transaction'](function(_0x54cf28){return _0x546bf7[_0x6791('0x87')](_0x4f88e4[_0x6791('0x34')][_0x6791('0x72')],{'transaction':_0x54cf28})[_0x6791('0x25')](function(){if(!_[_0x6791('0x9a')](_0xb7986d)){return _0x546bf7[_0x6791('0x76')](_0xb7986d,{'transaction':_0x54cf28});}})[_0x6791('0x25')](function(){_0xb7986d['forEach'](function(_0x3b7b0f){socket[_0x6791('0x74')](_0x6791('0x78'),{'UserId':_0x3b7b0f,'VoicePrefixId':_0x546bf7['id']});});});});});});})[_0x6791('0x25')](respondWithStatusCode(_0x447ea6,null))[_0x6791('0x4a')](handleError(_0x447ea6,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index d0ca78d..702f2d1 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 _0x10e7=['save','remove','emit','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x10e7,0x101));var _0x710e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x10e7[_0x297fd3];return _0x2af381;};'use strict';var EventEmitter=require(_0x710e('0x0'));var VoicePrefix=require(_0x710e('0x1'))['db'][_0x710e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x710e('0x3')](0x0);var events={'afterCreate':_0x710e('0x4'),'afterUpdate':'update','afterDestroy':_0x710e('0x5')};function emitEvent(_0x2cbabd){return function(_0x5d1a5b,_0x5f838,_0x56a6af){VoicePrefixEvents[_0x710e('0x6')](_0x2cbabd+':'+_0x5d1a5b['id'],_0x5d1a5b);VoicePrefixEvents[_0x710e('0x6')](_0x2cbabd,_0x5d1a5b);_0x56a6af(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x710e('0x7')](e,emitEvent(event));}}module[_0x710e('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0xe50c=['remove','emit','hook','exports','../../mysqldb','VoicePrefix','save','update'];(function(_0x36987b,_0x49a49f){var _0x38f317=function(_0x6239c9){while(--_0x6239c9){_0x36987b['push'](_0x36987b['shift']());}};_0x38f317(++_0x49a49f);}(_0xe50c,0xec));var _0xce50=function(_0x4b2783,_0x4198c4){_0x4b2783=_0x4b2783-0x0;var _0x3918a9=_0xe50c[_0x4b2783];return _0x3918a9;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xce50('0x0'))['db'][_0xce50('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xce50('0x2'),'afterUpdate':_0xce50('0x3'),'afterDestroy':_0xce50('0x4')};function emitEvent(_0x2857ab){return function(_0x27ea75,_0x1b6fba,_0xf69691){VoicePrefixEvents['emit'](_0x2857ab+':'+_0x27ea75['id'],_0x27ea75);VoicePrefixEvents[_0xce50('0x5')](_0x2857ab,_0x27ea75);_0xf69691(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xce50('0x6')](e,emitEvent(event));}}module[_0xce50('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 218001d..a1e8c06 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 _0x0981=['lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./voicePrefix.attributes','exports','VoicePrefix','voice_prefixes'];(function(_0x2d1116,_0x31bcae){var _0x309068=function(_0x14739e){while(--_0x14739e){_0x2d1116['push'](_0x2d1116['shift']());}};_0x309068(++_0x31bcae);}(_0x0981,0x181));var _0x1098=function(_0x3f8d4f,_0x35eac3){_0x3f8d4f=_0x3f8d4f-0x0;var _0x59bbd2=_0x0981[_0x3f8d4f];return _0x59bbd2;};'use strict';var _=require(_0x1098('0x0'));var util=require('util');var logger=require(_0x1098('0x1'))(_0x1098('0x2'));var moment=require(_0x1098('0x3'));var BPromise=require('bluebird');var rp=require(_0x1098('0x4'));var fs=require('fs');var path=require(_0x1098('0x5'));var rimraf=require('rimraf');var config=require(_0x1098('0x6'));var attributes=require(_0x1098('0x7'));module[_0x1098('0x8')]=function(_0x2d63f1,_0x59dbd0){return _0x2d63f1['define'](_0x1098('0x9'),attributes,{'tableName':_0x1098('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a80=['lodash','util','../../config/logger','bluebird','path','rimraf','./voicePrefix.attributes','define','voice_prefixes'];(function(_0x184029,_0x3eb00d){var _0x3c3106=function(_0x5200d9){while(--_0x5200d9){_0x184029['push'](_0x184029['shift']());}};_0x3c3106(++_0x3eb00d);}(_0x4a80,0xb4));var _0x04a8=function(_0x23c059,_0x4105cd){_0x23c059=_0x23c059-0x0;var _0x5b96b2=_0x4a80[_0x23c059];return _0x5b96b2;};'use strict';var _=require(_0x04a8('0x0'));var util=require(_0x04a8('0x1'));var logger=require(_0x04a8('0x2'))('api');var moment=require('moment');var BPromise=require(_0x04a8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x04a8('0x4'));var rimraf=require(_0x04a8('0x5'));var config=require('../../config/environment');var attributes=require(_0x04a8('0x6'));module['exports']=function(_0x17bcc6,_0x56053a){return _0x17bcc6[_0x04a8('0x7')]('VoicePrefix',attributes,{'tableName':_0x04a8('0x8'),'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 46cf18a..21e5b0f 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 _0x4744=['defaults','localhost','socket.io-emitter','register','request','request\x20sent','debug','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis'];(function(_0x2683eb,_0x4b597a){var _0x54544f=function(_0x198076){while(--_0x198076){_0x2683eb['push'](_0x2683eb['shift']());}};_0x54544f(++_0x4b597a);}(_0x4744,0x107));var _0x4474=function(_0x44d52d,_0x13db38){_0x44d52d=_0x44d52d-0x0;var _0x11ee68=_0x4744[_0x44d52d];return _0x11ee68;};'use strict';var _=require(_0x4474('0x0'));var util=require(_0x4474('0x1'));var moment=require('moment');var BPromise=require(_0x4474('0x2'));var rs=require(_0x4474('0x3'));var fs=require('fs');var Redis=require(_0x4474('0x4'));var db=require(_0x4474('0x5'))['db'];var utils=require(_0x4474('0x6'));var logger=require(_0x4474('0x7'))(_0x4474('0x8'));var config=require(_0x4474('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4474('0xa')]({'port':0x232a});config[_0x4474('0xb')]=_[_0x4474('0xc')](config[_0x4474('0xb')],{'host':_0x4474('0xd'),'port':0x18eb});var socket=require(_0x4474('0xe'))(new Redis(config[_0x4474('0xb')]));require('./voicePrefix.socket')[_0x4474('0xf')](socket);function respondWithRpcPromise(_0x191634,_0x34bbd3,_0x2cefd3){return new BPromise(function(_0x1e14ad,_0x3aab8f){return client[_0x4474('0x10')](_0x191634,_0x2cefd3)['then'](function(_0x4f880c){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x34bbd3,_0x4474('0x11'));logger[_0x4474('0x12')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x34bbd3,_0x4474('0x11'),JSON['stringify'](_0x4f880c));if(_0x4f880c[_0x4474('0x13')]){if(_0x4f880c[_0x4474('0x13')][_0x4474('0x14')]===0x1f4){logger[_0x4474('0x13')](_0x4474('0x15'),_0x34bbd3,_0x4f880c[_0x4474('0x13')][_0x4474('0x16')]);return _0x3aab8f(_0x4f880c[_0x4474('0x13')][_0x4474('0x16')]);}logger['error'](_0x4474('0x15'),_0x34bbd3,_0x4f880c['error']['message']);return _0x1e14ad(_0x4f880c[_0x4474('0x13')][_0x4474('0x16')]);}else{logger['info'](_0x4474('0x15'),_0x34bbd3,_0x4474('0x11'));_0x1e14ad(_0x4f880c[_0x4474('0x17')][_0x4474('0x16')]);}})[_0x4474('0x18')](function(_0x249ae0){logger['error'](_0x4474('0x15'),_0x34bbd3,_0x249ae0);_0x3aab8f(_0x249ae0);});});} \ No newline at end of file +var _0x720b=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','request','then','info','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring'];(function(_0x31a37b,_0x826249){var _0x49ae16=function(_0x2e8d52){while(--_0x2e8d52){_0x31a37b['push'](_0x31a37b['shift']());}};_0x49ae16(++_0x826249);}(_0x720b,0x1d8));var _0xb720=function(_0x3c66d0,_0x3d0794){_0x3c66d0=_0x3c66d0-0x0;var _0x968243=_0x720b[_0x3c66d0];return _0x968243;};'use strict';var _=require(_0xb720('0x0'));var util=require(_0xb720('0x1'));var moment=require(_0xb720('0x2'));var BPromise=require('bluebird');var rs=require(_0xb720('0x3'));var fs=require('fs');var Redis=require(_0xb720('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb720('0x5'));var logger=require(_0xb720('0x6'))(_0xb720('0x7'));var config=require('../../config/environment');var jayson=require(_0xb720('0x8'));var client=jayson[_0xb720('0x9')][_0xb720('0xa')]({'port':0x232a});config[_0xb720('0xb')]=_[_0xb720('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb720('0xd'))(new Redis(config[_0xb720('0xb')]));require(_0xb720('0xe'))[_0xb720('0xf')](socket);function respondWithRpcPromise(_0x4351eb,_0x141d72,_0x2b66ef){return new BPromise(function(_0x2922c7,_0x4e7422){return client[_0xb720('0x10')](_0x4351eb,_0x2b66ef)[_0xb720('0x11')](function(_0x5384e6){logger[_0xb720('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x141d72,_0xb720('0x13'));logger['debug'](_0xb720('0x14'),_0x141d72,_0xb720('0x13'),JSON[_0xb720('0x15')](_0x5384e6));if(_0x5384e6[_0xb720('0x16')]){if(_0x5384e6[_0xb720('0x16')][_0xb720('0x17')]===0x1f4){logger[_0xb720('0x16')](_0xb720('0x18'),_0x141d72,_0x5384e6['error'][_0xb720('0x19')]);return _0x4e7422(_0x5384e6[_0xb720('0x16')][_0xb720('0x19')]);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x141d72,_0x5384e6[_0xb720('0x16')][_0xb720('0x19')]);return _0x2922c7(_0x5384e6[_0xb720('0x16')]['message']);}else{logger[_0xb720('0x12')](_0xb720('0x18'),_0x141d72,_0xb720('0x13'));_0x2922c7(_0x5384e6[_0xb720('0x1a')][_0xb720('0x19')]);}})[_0xb720('0x1b')](function(_0x4203ce){logger[_0xb720('0x16')](_0xb720('0x18'),_0x141d72,_0x4203ce);_0x4e7422(_0x4203ce);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 864bec6..dbad76b 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 _0xc788=['./voicePrefix.events','save','remove','emit','register','length','voicePrefix:'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xc788,0xc4));var _0x8c78=function(_0x150599,_0x3bdfb0){_0x150599=_0x150599-0x0;var _0x12c65f=_0xc788[_0x150599];return _0x12c65f;};'use strict';var VoicePrefixEvents=require(_0x8c78('0x0'));var events=[_0x8c78('0x1'),_0x8c78('0x2'),'update'];function createListener(_0x4ce125,_0x1c7ff3){return function(_0x1af8e2){_0x1c7ff3[_0x8c78('0x3')](_0x4ce125,_0x1af8e2);};}function removeListener(_0x1d0670,_0x386f0a){return function(){VoicePrefixEvents['removeListener'](_0x1d0670,_0x386f0a);};}exports[_0x8c78('0x4')]=function(_0x4555da){for(var _0x329152=0x0,_0x1ac27f=events[_0x8c78('0x5')];_0x329152<_0x1ac27f;_0x329152++){var _0x4d54a5=events[_0x329152];var _0x247188=createListener(_0x8c78('0x6')+_0x4d54a5,_0x4555da);VoicePrefixEvents['on'](_0x4d54a5,_0x247188);}}; \ No newline at end of file +var _0x138d=['./voicePrefix.events','save','update','emit','removeListener','register','length'];(function(_0x272cd3,_0x4b9a03){var _0x356a60=function(_0x4a1aa6){while(--_0x4a1aa6){_0x272cd3['push'](_0x272cd3['shift']());}};_0x356a60(++_0x4b9a03);}(_0x138d,0x1ab));var _0xd138=function(_0x172133,_0x10246b){_0x172133=_0x172133-0x0;var _0x2460e5=_0x138d[_0x172133];return _0x2460e5;};'use strict';var VoicePrefixEvents=require(_0xd138('0x0'));var events=[_0xd138('0x1'),'remove',_0xd138('0x2')];function createListener(_0x34325b,_0x427b74){return function(_0x1882b8){_0x427b74[_0xd138('0x3')](_0x34325b,_0x1882b8);};}function removeListener(_0x2d49a0,_0x53042d){return function(){VoicePrefixEvents[_0xd138('0x4')](_0x2d49a0,_0x53042d);};}exports[_0xd138('0x5')]=function(_0x343962){for(var _0x54f02e=0x0,_0x19869d=events[_0xd138('0x6')];_0x54f02e<_0x19869d;_0x54f02e++){var _0x117c23=events[_0x54f02e];var _0x5790ff=createListener('voicePrefix:'+_0x117c23,_0x343962);VoicePrefixEvents['on'](_0x117c23,_0x5790ff);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index baa549c..1b95db4 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 _0x2ffd=['isAuthenticated','index','get','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/members','getMembers','getLists','getBlackLists','create','post','clone','addTeams','/:id/lists','addLists','addBlackLists','put','/:id','update','delete','destroy','/:id/users','removeLists','removeBlackLists','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller'];(function(_0x302f4a,_0x337226){var _0x3a9a52=function(_0xbbe65b){while(--_0xbbe65b){_0x302f4a['push'](_0x302f4a['shift']());}};_0x3a9a52(++_0x337226);}(_0x2ffd,0x1e8));var _0xd2ff=function(_0x371d6e,_0x47c636){_0x371d6e=_0x371d6e-0x0;var _0x3294ba=_0x2ffd[_0x371d6e];return _0x3294ba;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd2ff('0x0'));var timeout=require(_0xd2ff('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd2ff('0x2'));var interaction=require(_0xd2ff('0x3'));var config=require(_0xd2ff('0x4'));var controller=require(_0xd2ff('0x5'));router['get']('/',auth[_0xd2ff('0x6')](),controller[_0xd2ff('0x7')]);router[_0xd2ff('0x8')]('/:id',auth[_0xd2ff('0x6')](),controller['show']);router[_0xd2ff('0x8')](_0xd2ff('0x9'),auth['isAuthenticated'](),controller[_0xd2ff('0xa')]);router[_0xd2ff('0x8')](_0xd2ff('0xb'),auth[_0xd2ff('0x6')](),controller[_0xd2ff('0xc')]);router[_0xd2ff('0x8')](_0xd2ff('0xd'),auth[_0xd2ff('0x6')](),controller[_0xd2ff('0xe')]);router['get'](_0xd2ff('0xf'),auth[_0xd2ff('0x6')](),controller[_0xd2ff('0x10')]);router[_0xd2ff('0x8')](_0xd2ff('0x11'),auth['isAuthenticated'](),controller[_0xd2ff('0x12')]);router[_0xd2ff('0x8')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xd2ff('0x8')](_0xd2ff('0x13'),auth[_0xd2ff('0x6')](),controller[_0xd2ff('0x14')]);router[_0xd2ff('0x8')]('/:id/lists',auth[_0xd2ff('0x6')](),controller[_0xd2ff('0x15')]);router[_0xd2ff('0x8')]('/:id/blacklists',auth[_0xd2ff('0x6')](),controller[_0xd2ff('0x16')]);router['post']('/',auth[_0xd2ff('0x6')](),controller[_0xd2ff('0x17')]);router[_0xd2ff('0x18')]('/:id/clone',auth[_0xd2ff('0x6')](),controller[_0xd2ff('0x19')]);router[_0xd2ff('0x18')]('/:id/teams',auth[_0xd2ff('0x6')](),controller[_0xd2ff('0x1a')]);router[_0xd2ff('0x18')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0xd2ff('0x18')](_0xd2ff('0x1b'),auth['isAuthenticated'](),controller[_0xd2ff('0x1c')]);router[_0xd2ff('0x18')]('/:id/blacklists',auth[_0xd2ff('0x6')](),controller[_0xd2ff('0x1d')]);router[_0xd2ff('0x1e')](_0xd2ff('0x1f'),auth[_0xd2ff('0x6')](),controller[_0xd2ff('0x20')]);router[_0xd2ff('0x21')](_0xd2ff('0x1f'),auth[_0xd2ff('0x6')](),controller[_0xd2ff('0x22')]);router['delete'](_0xd2ff('0x11'),auth[_0xd2ff('0x6')](),controller['removeTeams']);router['delete'](_0xd2ff('0x23'),auth['isAuthenticated'](),controller['removeAgents']);router[_0xd2ff('0x21')]('/:id/lists',auth['isAuthenticated'](),controller[_0xd2ff('0x24')]);router['delete']('/:id/blacklists',auth[_0xd2ff('0x6')](),controller[_0xd2ff('0x25')]);module['exports']=router; \ No newline at end of file +var _0x2381=['getMembers','/:id/lists','getLists','/:id/blacklists','getBlackLists','create','clone','addTeams','post','/:id/users','addAgents','addLists','put','update','delete','removeTeams','removeAgents','removeBlackLists','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','isAuthenticated','/:id','show','get','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','getAgents','/:id/members'];(function(_0x201201,_0x666d93){var _0x512341=function(_0x521f34){while(--_0x521f34){_0x201201['push'](_0x201201['shift']());}};_0x512341(++_0x666d93);}(_0x2381,0x147));var _0x1238=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x2381[_0x2b5eae];return _0x5f3ac9;};'use strict';var multer=require(_0x1238('0x0'));var util=require(_0x1238('0x1'));var path=require(_0x1238('0x2'));var timeout=require(_0x1238('0x3'));var express=require(_0x1238('0x4'));var router=express['Router']();var fs_extra=require(_0x1238('0x5'));var auth=require(_0x1238('0x6'));var interaction=require(_0x1238('0x7'));var config=require(_0x1238('0x8'));var controller=require(_0x1238('0x9'));router['get']('/',auth[_0x1238('0xa')](),controller['index']);router['get'](_0x1238('0xb'),auth['isAuthenticated'](),controller[_0x1238('0xc')]);router[_0x1238('0xd')](_0x1238('0xe'),auth[_0x1238('0xa')](),controller[_0x1238('0xf')]);router['get']('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0x1238('0x10')]);router['get'](_0x1238('0x11'),auth[_0x1238('0xa')](),controller[_0x1238('0x12')]);router[_0x1238('0xd')](_0x1238('0x13'),auth[_0x1238('0xa')](),controller[_0x1238('0x14')]);router[_0x1238('0xd')](_0x1238('0x15'),auth[_0x1238('0xa')](),controller[_0x1238('0x16')]);router['get']('/:id/users',auth[_0x1238('0xa')](),controller[_0x1238('0x17')]);router[_0x1238('0xd')](_0x1238('0x18'),auth['isAuthenticated'](),controller[_0x1238('0x19')]);router['get'](_0x1238('0x1a'),auth[_0x1238('0xa')](),controller[_0x1238('0x1b')]);router[_0x1238('0xd')](_0x1238('0x1c'),auth[_0x1238('0xa')](),controller[_0x1238('0x1d')]);router['post']('/',auth[_0x1238('0xa')](),controller[_0x1238('0x1e')]);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0x1238('0x1f')]);router['post'](_0x1238('0x15'),auth[_0x1238('0xa')](),controller[_0x1238('0x20')]);router[_0x1238('0x21')](_0x1238('0x22'),auth[_0x1238('0xa')](),controller[_0x1238('0x23')]);router[_0x1238('0x21')](_0x1238('0x1a'),auth[_0x1238('0xa')](),controller[_0x1238('0x24')]);router[_0x1238('0x21')]('/:id/blacklists',auth[_0x1238('0xa')](),controller['addBlackLists']);router[_0x1238('0x25')](_0x1238('0xb'),auth['isAuthenticated'](),controller[_0x1238('0x26')]);router[_0x1238('0x27')]('/:id',auth[_0x1238('0xa')](),controller['destroy']);router['delete'](_0x1238('0x15'),auth['isAuthenticated'](),controller[_0x1238('0x28')]);router[_0x1238('0x27')](_0x1238('0x22'),auth[_0x1238('0xa')](),controller[_0x1238('0x29')]);router[_0x1238('0x27')](_0x1238('0x1a'),auth[_0x1238('0xa')](),controller['removeLists']);router['delete']('/:id/blacklists',auth[_0x1238('0xa')](),controller[_0x1238('0x2a')]);module[_0x1238('0x2b')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 360d14a..bc32789 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 _0x1da9=['dialMethod','booked','roundrobin','predictive','INTEGER','yes','all','once','TEXT','periodic_announce','split','joinempty','leavewhenempty','join','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','progressive','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.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\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)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','linear','wrandom','rrordered','setDataValue','strategy','rrmemory','getDataValue','type'];(function(_0x51e601,_0x2d843d){var _0x46f47e=function(_0x4d2c1d){while(--_0x4d2c1d){_0x51e601['push'](_0x51e601['shift']());}};_0x46f47e(++_0x2d843d);}(_0x1da9,0x141));var _0x91da=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x1da9[_0xa1e3e3];return _0xc980e9;};'use strict';var Sequelize=require(_0x91da('0x0'));module[_0x91da('0x1')]={'name':{'type':Sequelize[_0x91da('0x2')],'allowNull':![],'unique':_0x91da('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x91da('0x4')](_0x91da('0x5'),_0x91da('0x6')),'allowNull':![],'defaultValue':_0x91da('0x5')},'musiconhold':{'type':Sequelize[_0x91da('0x2')],'defaultValue':_0x91da('0x7')},'announce':{'type':Sequelize[_0x91da('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x91da('0x4')]('rr',_0x91da('0x8'),_0x91da('0x9'),_0x91da('0xa'),'random','rrmemory',_0x91da('0xb'),_0x91da('0xc'),_0x91da('0xd')),'allowNull':![],'defaultValue':'ringall','set':function(_0x2464ab){this[_0x91da('0xe')](_0x91da('0xf'),_0x2464ab?_0x2464ab:_0x91da('0x10'));},'get':function(){var _0x4e32b7=this[_0x91da('0x11')](_0x91da('0x12'));var _0x5c9ff4=this[_0x91da('0x11')](_0x91da('0x13'));var _0x4065cf=this[_0x91da('0x11')](_0x91da('0xf'));if(_0x4e32b7===_0x91da('0x5')){return _0x4065cf;}if(_0x5c9ff4===_0x91da('0x14')&&_0x4065cf===_0x91da('0x10')||_0x5c9ff4===_0x91da('0x14')&&_0x4065cf===_0x91da('0x15')){return _0x4065cf;}if(_0x5c9ff4==='progressive'||_0x5c9ff4===_0x91da('0x16')||_0x5c9ff4==='power'){return _0x4065cf;}return null;}},'servicelevel':{'type':Sequelize[_0x91da('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x91da('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x91da('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x91da('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x91da('0x2')]},'weight':{'type':Sequelize[_0x91da('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x91da('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x91da('0x4')](_0x91da('0x18'),'no'),'defaultValue':_0x91da('0x18')},'autopause':{'type':Sequelize[_0x91da('0x4')](_0x91da('0x18'),'no',_0x91da('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x91da('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0x91da('0x4')](_0x91da('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x91da('0x4')](_0x91da('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x91da('0x4')](_0x91da('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x91da('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x91da('0x4')](_0x91da('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x91da('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x91da('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x91da('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x91da('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x91da('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x91da('0x4')](_0x91da('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x91da('0x4')](_0x91da('0x18'),'no'),'defaultValue':_0x91da('0x18')},'announce_holdtime':{'type':Sequelize[_0x91da('0x4')](_0x91da('0x18'),'no',_0x91da('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x91da('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x91da('0x4')](_0x91da('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0x91da('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x91da('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x91da('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x91da('0x2')]},'queue_youarenext':{'type':Sequelize[_0x91da('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x91da('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x91da('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x91da('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x91da('0x2')]},'queue_quantity1':{'type':Sequelize[_0x91da('0x2')]},'queue_quantity2':{'type':Sequelize[_0x91da('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x91da('0x2')]},'periodic_announce':{'type':Sequelize[_0x91da('0x1b')],'set':function(_0x3c86ac){this[_0x91da('0xe')](_0x91da('0x1c'),_0x3c86ac?_0x3c86ac['join'](','):[]);},'get':function(){return this['getDataValue'](_0x91da('0x1c'))?this[_0x91da('0x11')](_0x91da('0x1c'))[_0x91da('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0x91da('0x2')],'defaultValue':'yes','set':function(_0x42d99a){this[_0x91da('0xe')](_0x91da('0x1e'),_0x42d99a?_0x42d99a['join'](','):undefined);},'get':function(){return this[_0x91da('0x11')](_0x91da('0x1e'))?this['getDataValue']('joinempty')[_0x91da('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x91da('0x2')],'defaultValue':'no','set':function(_0x41a0a5){this[_0x91da('0xe')](_0x91da('0x1f'),_0x41a0a5?_0x41a0a5[_0x91da('0x20')](','):undefined);},'get':function(){return this['getDataValue'](_0x91da('0x1f'))?this[_0x91da('0x11')](_0x91da('0x1f'))[_0x91da('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x91da('0x4')](_0x91da('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x91da('0x4')](_0x91da('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x91da('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x91da('0x4')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x91da('0x2')]},'description':{'type':Sequelize[_0x91da('0x2')]},'acw':{'type':Sequelize[_0x91da('0x21')],'defaultValue':0x0,'set':function(_0x2f41c5){this[_0x91da('0xe')](_0x91da('0x22'),_0x2f41c5);if(_0x2f41c5){if(this['getDataValue']('wrapuptime')<0x2){this[_0x91da('0xe')](_0x91da('0x23'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x91da('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x91da('0x21')],'defaultValue':0x0,'comment':_0x91da('0x24')},'dialMethod':{'type':Sequelize['ENUM'](_0x91da('0x25'),_0x91da('0x26'),_0x91da('0x27'),_0x91da('0x16'),_0x91da('0x14')),'defaultValue':_0x91da('0x26'),'comment':_0x91da('0x28')},'dialLimitChannel':{'type':Sequelize[_0x91da('0x17')](0x4)[_0x91da('0x29')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x91da('0x2a')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x91da('0x2b')},'dialPowerLevel':{'type':Sequelize[_0x91da('0x2c')](0x2)[_0x91da('0x29')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x91da('0x2d')},'dialPredictiveOptimization':{'type':Sequelize[_0x91da('0x4')](_0x91da('0x2e'),_0x91da('0x2f')),'defaultValue':'dropRate','comment':_0x91da('0x30')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x91da('0x2c')](0x2)[_0x91da('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x91da('0x17')](0x3)[_0x91da('0x29')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x91da('0x31')},'dialOriginateCallerIdName':{'type':Sequelize[_0x91da('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x91da('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x91da('0x17')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x91da('0x32')},'dialQueueOptions':{'type':Sequelize[_0x91da('0x2')],'defaultValue':_0x91da('0x33'),'comment':_0x91da('0x34')},'dialQueueTimeout':{'type':Sequelize[_0x91da('0x17')](0x3)[_0x91da('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x91da('0x2')],'comment':_0x91da('0x35')},'dialCongestionMaxRetry':{'type':Sequelize[_0x91da('0x17')](0x3)[_0x91da('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x91da('0x36')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x91da('0x17')](0x3)[_0x91da('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x91da('0x37')},'dialBusyRetryFrequency':{'type':Sequelize[_0x91da('0x17')](0x5)[_0x91da('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x91da('0x38')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x91da('0x17')](0x3)[_0x91da('0x29')],'defaultValue':0x3,'comment':_0x91da('0x39')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x91da('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x91da('0x3a')},'dialGlobalMaxRetry':{'type':Sequelize[_0x91da('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x91da('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x91da('0x2')],'defaultValue':_0x91da('0x3b')},'dialPrefix':{'type':Sequelize[_0x91da('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x91da('0x4')]('always',_0x91da('0x3c'),_0x91da('0x3d')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x91da('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x91da('0x17')](0x9)[_0x91da('0x29')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x91da('0x3e')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x91da('0x29')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x91da('0x3f')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x91da('0x17')](0x9)[_0x91da('0x29')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x91da('0x17')](0x9)[_0x91da('0x29')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x91da('0x29')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x91da('0x40')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x91da('0x17')](0x9)[_0x91da('0x29')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x91da('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x91da('0x17')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x91da('0x42')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x91da('0x17')](0x5)[_0x91da('0x29')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x91da('0x17')](0x9)[_0x91da('0x29')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x91da('0x17')](0x5)[_0x91da('0x29')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x91da('0x43')},'dialRecallInQueue':{'type':Sequelize[_0x91da('0x21')],'defaultValue':0x0,'comment':_0x91da('0x44')},'dialOrderByScheduledAt':{'type':Sequelize[_0x91da('0x4')](_0x91da('0x45'),'ASC'),'defaultValue':_0x91da('0x45')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x91da('0x35')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x91da('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x91da('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x91da('0x17')](0x3)[_0x91da('0x29')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x91da('0x46')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x91da('0x47')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x91da('0x17')](0x3)[_0x91da('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x91da('0x48')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x91da('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x91da('0x49')},'dialDropMaxRetry':{'type':Sequelize[_0x91da('0x17')](0x3)[_0x91da('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x91da('0x4a')},'dialDropRetryFrequency':{'type':Sequelize[_0x91da('0x17')](0x5)[_0x91da('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x91da('0x4b')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x91da('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x91da('0x4c')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x91da('0x4d')},'dialMachineMaxRetry':{'type':Sequelize[_0x91da('0x17')](0x3)[_0x91da('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x91da('0x4e')},'dialMachineRetryFrequency':{'type':Sequelize[_0x91da('0x17')](0x5)[_0x91da('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x91da('0x4f')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x91da('0x17')](0x3)[_0x91da('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x91da('0x50')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x91da('0x17')](0x5)[_0x91da('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x91da('0x51')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x91da('0x17')],'allowNull':!![],'comment':_0x91da('0x52')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x91da('0x53'),'set':function(_0xcc828b){if(!_0xcc828b)this[_0x91da('0xe')](_0x91da('0x54'),null);this['setDataValue']('mandatoryDisposition',_0xcc828b);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x91da('0x29')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0x723e=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','exports','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','booked','predictive','power','INTEGER','yes','all','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x5c37eb,_0x5becfe){var _0x43fee2=function(_0x476231){while(--_0x476231){_0x5c37eb['push'](_0x5c37eb['shift']());}};_0x43fee2(++_0x5becfe);}(_0x723e,0x179));var _0xe723=function(_0x3cc563,_0x1598d3){_0x3cc563=_0x3cc563-0x0;var _0x11c044=_0x723e[_0x3cc563];return _0x11c044;};'use strict';var Sequelize=require('sequelize');module[_0xe723('0x0')]={'name':{'type':Sequelize[_0xe723('0x1')],'allowNull':![],'unique':_0xe723('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xe723('0x3')](_0xe723('0x4'),_0xe723('0x5')),'allowNull':![],'defaultValue':_0xe723('0x4')},'musiconhold':{'type':Sequelize[_0xe723('0x1')],'defaultValue':_0xe723('0x6')},'announce':{'type':Sequelize[_0xe723('0x1')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xe723('0x7'),_0xe723('0x8'),_0xe723('0x9'),_0xe723('0xa'),_0xe723('0xb'),_0xe723('0xc'),_0xe723('0xd'),_0xe723('0xe')),'allowNull':![],'defaultValue':'ringall','set':function(_0x380444){this[_0xe723('0xf')](_0xe723('0x10'),_0x380444?_0x380444:'rrmemory');},'get':function(){var _0x24eef1=this[_0xe723('0x11')](_0xe723('0x12'));var _0x583291=this[_0xe723('0x11')](_0xe723('0x13'));var _0x2a3474=this[_0xe723('0x11')](_0xe723('0x10'));if(_0x24eef1==='inbound'){return _0x2a3474;}if(_0x583291===_0xe723('0x14')&&_0x2a3474==='rrmemory'||_0x583291==='booked'&&_0x2a3474==='roundrobin'){return _0x2a3474;}if(_0x583291==='progressive'||_0x583291===_0xe723('0x15')||_0x583291===_0xe723('0x16')){return _0x2a3474;}return null;}},'servicelevel':{'type':Sequelize[_0xe723('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xe723('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xe723('0x17')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xe723('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xe723('0x1')]},'weight':{'type':Sequelize[_0xe723('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xe723('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xe723('0x3')](_0xe723('0x18'),'no'),'defaultValue':_0xe723('0x18')},'autopause':{'type':Sequelize[_0xe723('0x3')](_0xe723('0x18'),'no',_0xe723('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xe723('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0xe723('0x3')](_0xe723('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xe723('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xe723('0x3')](_0xe723('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0xe723('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xe723('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xe723('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xe723('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xe723('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xe723('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xe723('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xe723('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xe723('0x3')](_0xe723('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xe723('0x3')](_0xe723('0x18'),'no'),'defaultValue':_0xe723('0x18')},'announce_holdtime':{'type':Sequelize[_0xe723('0x3')](_0xe723('0x18'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xe723('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xe723('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0xe723('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xe723('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xe723('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xe723('0x1')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xe723('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xe723('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xe723('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xe723('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xe723('0x1')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xe723('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0xe723('0x1')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xe723('0x1a')],'set':function(_0x5594f7){this['setDataValue'](_0xe723('0x1b'),_0x5594f7?_0x5594f7[_0xe723('0x1c')](','):[]);},'get':function(){return this[_0xe723('0x11')](_0xe723('0x1b'))?this['getDataValue']('periodic_announce')[_0xe723('0x1d')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0xe723('0x18'),'set':function(_0x318f7f){this[_0xe723('0xf')](_0xe723('0x1e'),_0x318f7f?_0x318f7f[_0xe723('0x1c')](','):undefined);},'get':function(){return this[_0xe723('0x11')](_0xe723('0x1e'))?this[_0xe723('0x11')](_0xe723('0x1e'))[_0xe723('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xe723('0x1')],'defaultValue':'no','set':function(_0x208925){this[_0xe723('0xf')](_0xe723('0x1f'),_0x208925?_0x208925['join'](','):undefined);},'get':function(){return this[_0xe723('0x11')]('leavewhenempty')?this[_0xe723('0x11')](_0xe723('0x1f'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0xe723('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xe723('0x3')](_0xe723('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xe723('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xe723('0x3')](_0xe723('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe723('0x1')]},'acw':{'type':Sequelize[_0xe723('0x20')],'defaultValue':0x0,'set':function(_0x1dc86f){this[_0xe723('0xf')](_0xe723('0x21'),_0x1dc86f);if(_0x1dc86f){if(this[_0xe723('0x11')](_0xe723('0x22'))<0x2){this[_0xe723('0xf')](_0xe723('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xe723('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xe723('0x20')],'defaultValue':0x0,'comment':_0xe723('0x23')},'dialMethod':{'type':Sequelize[_0xe723('0x3')](_0xe723('0x24'),_0xe723('0x25'),_0xe723('0x16'),'predictive',_0xe723('0x14')),'defaultValue':_0xe723('0x25'),'comment':_0xe723('0x26')},'dialLimitChannel':{'type':Sequelize[_0xe723('0x17')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xe723('0x17')](0x4)[_0xe723('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xe723('0x28')},'dialPowerLevel':{'type':Sequelize[_0xe723('0x29')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0xe723('0x3')](_0xe723('0x2a'),_0xe723('0x2b')),'defaultValue':_0xe723('0x2b'),'comment':_0xe723('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xe723('0x29')](0x2)[_0xe723('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xe723('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0xe723('0x17')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xe723('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xe723('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0xe723('0x1')],'defaultValue':_0xe723('0x2e'),'comment':_0xe723('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0xe723('0x17')](0x3)[_0xe723('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe723('0x30')},'dialQueueProject':{'type':Sequelize[_0xe723('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe723('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xe723('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe723('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0xe723('0x17')](0x3)[_0xe723('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe723('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0xe723('0x17')](0x5)[_0xe723('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe723('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xe723('0x17')](0x3)[_0xe723('0x27')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xe723('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe723('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0xe723('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xe723('0x1')],'defaultValue':_0xe723('0x35')},'dialPrefix':{'type':Sequelize[_0xe723('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xe723('0x36'),_0xe723('0x37'),_0xe723('0x38')),'defaultValue':_0xe723('0x36')},'dialAMDActive':{'type':Sequelize[_0xe723('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xe723('0x17')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xe723('0x39')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xe723('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xe723('0x17')](0x9)[_0xe723('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xe723('0x17')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe723('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0xe723('0x17')](0x9)[_0xe723('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xe723('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xe723('0x17')](0x9)[_0xe723('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xe723('0x3d')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xe723('0x17')](0x9)[_0xe723('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xe723('0x17')](0x5)[_0xe723('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xe723('0x17')](0x9)[_0xe723('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xe723('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0xe723('0x20')],'defaultValue':0x0,'comment':_0xe723('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize[_0xe723('0x3')](_0xe723('0x3f'),_0xe723('0x40')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xe723('0x1')],'comment':_0xe723('0x41')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xe723('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xe723('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xe723('0x17')](0x3)[_0xe723('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe723('0x42')},'dialCutDigit':{'type':Sequelize[_0xe723('0x17')](0x3)[_0xe723('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe723('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe723('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe723('0x44')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xe723('0x17')](0x5)[_0xe723('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xe723('0x17')](0x3)[_0xe723('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xe723('0x17')](0x5)[_0xe723('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe723('0x45')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xe723('0x17')](0x3)[_0xe723('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe723('0x46')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xe723('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe723('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xe723('0x17')](0x5)[_0xe723('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe723('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xe723('0x17')](0x3)[_0xe723('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xe723('0x17')](0x5)[_0xe723('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe723('0x48')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xe723('0x20')],'defaultValue':![],'comment':_0xe723('0x49'),'set':function(_0x2aabbc){if(!_0x2aabbc)this['setDataValue'](_0xe723('0x4a'),null);this[_0xe723('0xf')]('mandatoryDisposition',_0x2aabbc);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xe723('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xe723('0x17')](0x3)[_0xe723('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index ad2f088..2fc0a57 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 _0xe422=['moment','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/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','get','VoiceQueues','filter','ignore','map','value','includes','type','find','name','UserProfileResource','error','stack','send','index','key','model','keys','filters','intersection','attributes','query','fields','hasOwnProperty','order','sort','where','pick','merge','options','VoiceQueue','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','create','body','user','role','inbound','outbound','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','getHoppers','findOne','CmHopper','VoiceQueueId','getHopperHistories','nolimit','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','User','Agents','online','voicePause','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','interface','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','push','toString','QueryTypes','TeamId','compact','isEmpty','userVoiceQueue:remove','addAgents','isNil','all','getAgents','getMembers','getLists','addLists','spread','dialCheckDuplicateType','always','insert','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','phone\x20IS\x20NOT\x20NULL','into','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','fast-json-patch','request-promise'];(function(_0x1f9d2a,_0x1d2c5c){var _0x4fd76e=function(_0x31e5f4){while(--_0x31e5f4){_0x1f9d2a['push'](_0x1f9d2a['shift']());}};_0x4fd76e(++_0x1d2c5c);}(_0xe422,0x16c));var _0x2e42=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xe422[_0x5a9c0c];return _0x53c77d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2e42('0x0'));var rp=require(_0x2e42('0x1'));var moment=require(_0x2e42('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2e42('0x3'));var util=require(_0x2e42('0x4'));var path=require(_0x2e42('0x5'));var sox=require(_0x2e42('0x6'));var csv=require(_0x2e42('0x7'));var ejs=require(_0x2e42('0x8'));var fs=require('fs');var fs_extra=require(_0x2e42('0x9'));var _=require(_0x2e42('0xa'));var squel=require(_0x2e42('0xb'));var crypto=require(_0x2e42('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2e42('0xd'));var toCsv=require(_0x2e42('0x7'));var querystring=require(_0x2e42('0xe'));var Papa=require(_0x2e42('0xf'));var Redis=require(_0x2e42('0x10'));var authService=require(_0x2e42('0x11'));var qs=require(_0x2e42('0x12'));var as=require(_0x2e42('0x13'));var hardwareService=require(_0x2e42('0x14'));var logger=require(_0x2e42('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x2e42('0x16'));var licenseUtil=require(_0x2e42('0x17'));var db=require(_0x2e42('0x18'))['db'];config[_0x2e42('0x19')]=_[_0x2e42('0x1a')](config[_0x2e42('0x19')],{'host':_0x2e42('0x1b'),'port':0x18eb});var socket=require(_0x2e42('0x1c'))(new Redis(config[_0x2e42('0x19')]));require(_0x2e42('0x1d'))[_0x2e42('0x1e')](socket);function respondWithStatusCode(_0x3b046e,_0x4f187a){_0x4f187a=_0x4f187a||0xcc;return function(_0x575bcf){if(_0x575bcf){return _0x3b046e[_0x2e42('0x1f')](_0x4f187a);}return _0x3b046e[_0x2e42('0x20')](_0x4f187a)[_0x2e42('0x21')]();};}function respondWithResult(_0x20286a,_0x4869a6){_0x4869a6=_0x4869a6||0xc8;return function(_0x32b849){if(_0x32b849){return _0x20286a[_0x2e42('0x20')](_0x4869a6)['json'](_0x32b849);}};}function respondWithFilteredResult(_0x3a1f99,_0x3526d3){return function(_0x451628){if(_0x451628){var _0x501078=typeof _0x3526d3['offset']===_0x2e42('0x22')&&typeof _0x3526d3[_0x2e42('0x23')]==='undefined';var _0x3460b1=_0x451628[_0x2e42('0x24')];var _0x6a85ab=_0x501078?0x0:_0x3526d3[_0x2e42('0x25')];var _0x305a7f=_0x501078?_0x451628[_0x2e42('0x24')]:_0x3526d3['offset']+_0x3526d3[_0x2e42('0x23')];var _0x1655ba;if(_0x305a7f>=_0x3460b1){_0x305a7f=_0x3460b1;_0x1655ba=0xc8;}else{_0x1655ba=0xce;}_0x3a1f99[_0x2e42('0x20')](_0x1655ba);return _0x3a1f99[_0x2e42('0x26')](_0x2e42('0x27'),_0x6a85ab+'-'+_0x305a7f+'/'+_0x3460b1)[_0x2e42('0x28')](_0x451628);}return null;};}function patchUpdates(_0x2af7e9){return function(_0x562b0b){try{jsonpatch[_0x2e42('0x29')](_0x562b0b,_0x2af7e9,!![]);}catch(_0x50eb53){return BPromise[_0x2e42('0x2a')](_0x50eb53);}return _0x562b0b[_0x2e42('0x2b')]();};}function saveUpdates(_0x1343ac,_0x3c19fd){return function(_0x3da315){if(_0x3da315){return _0x3da315['update'](_0x1343ac)[_0x2e42('0x2c')](function(_0x2d1b4f){return _0x2d1b4f;});}return null;};}function removeEntity(_0x44ce61,_0x12ce83){return function(_0x53a65b){if(_0x53a65b){return _0x53a65b[_0x2e42('0x2d')]()['then'](function(){var _0x40a0f0=_0x53a65b[_0x2e42('0x2e')]({'plain':!![]});var _0x434faf=[{'name':_0x2e42('0x2f'),'value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x1e1c5f=_(_0x434faf)[_0x2e42('0x30')](_0x2e42('0x31'))[_0x2e42('0x32')](_0x2e42('0x33'))[_0x2e42('0x33')]();if(_[_0x2e42('0x34')](_0x1e1c5f,_0x40a0f0[_0x2e42('0x35')])){return;}var _0x4dc443=_[_0x2e42('0x36')](_0x434faf,[_0x2e42('0x33'),_0x40a0f0[_0x2e42('0x35')]])[_0x2e42('0x37')];return db[_0x2e42('0x38')][_0x2e42('0x2d')]({'where':{'type':_0x4dc443,'resourceId':_0x40a0f0['id']}})[_0x2e42('0x2c')](function(){return _0x53a65b;});})[_0x2e42('0x2c')](function(){_0x44ce61[_0x2e42('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e92c1,_0x1c37a5){return function(_0x591bd1){if(!_0x591bd1){_0x2e92c1[_0x2e42('0x1f')](0x194);}return _0x591bd1;};}function handleError(_0x55fde7,_0x18bd8e){_0x18bd8e=_0x18bd8e||0x1f4;return function(_0x3ee576){logger[_0x2e42('0x39')](_0x3ee576[_0x2e42('0x3a')]);if(_0x3ee576[_0x2e42('0x37')]){delete _0x3ee576[_0x2e42('0x37')];}_0x55fde7[_0x2e42('0x20')](_0x18bd8e)[_0x2e42('0x3b')](_0x3ee576);};}exports[_0x2e42('0x3c')]=function(_0x455a1f,_0x50c681){var _0x2bd6dd={},_0x36377a={},_0x52be59={'count':0x0,'rows':[]};var _0x32d251=_[_0x2e42('0x32')](db['VoiceQueue']['rawAttributes'],function(_0x436714){return{'name':_0x436714['fieldName'],'type':_0x436714[_0x2e42('0x35')][_0x2e42('0x3d')]};});_0x36377a[_0x2e42('0x3e')]=_[_0x2e42('0x32')](_0x32d251,_0x2e42('0x37'));_0x36377a['query']=_[_0x2e42('0x3f')](_0x455a1f['query']);_0x36377a[_0x2e42('0x40')]=_[_0x2e42('0x41')](_0x36377a[_0x2e42('0x3e')],_0x36377a['query']);_0x2bd6dd[_0x2e42('0x42')]=_[_0x2e42('0x41')](_0x36377a['model'],qs['fields'](_0x455a1f[_0x2e42('0x43')][_0x2e42('0x44')]));_0x2bd6dd[_0x2e42('0x42')]=_0x2bd6dd[_0x2e42('0x42')]['length']?_0x2bd6dd[_0x2e42('0x42')]:_0x36377a[_0x2e42('0x3e')];if(!_0x455a1f[_0x2e42('0x43')][_0x2e42('0x45')]('nolimit')){_0x2bd6dd['limit']=qs[_0x2e42('0x23')](_0x455a1f[_0x2e42('0x43')][_0x2e42('0x23')]);_0x2bd6dd[_0x2e42('0x25')]=qs['offset'](_0x455a1f['query'][_0x2e42('0x25')]);}_0x2bd6dd[_0x2e42('0x46')]=qs[_0x2e42('0x47')](_0x455a1f[_0x2e42('0x43')][_0x2e42('0x47')]);_0x2bd6dd[_0x2e42('0x48')]=qs['filters'](_[_0x2e42('0x49')](_0x455a1f[_0x2e42('0x43')],_0x36377a[_0x2e42('0x40')]),_0x32d251);if(_0x455a1f[_0x2e42('0x43')]['filter']){_0x2bd6dd[_0x2e42('0x48')]=_[_0x2e42('0x4a')](_0x2bd6dd['where'],{'$or':_[_0x2e42('0x32')](_0x32d251,function(_0x4b8c4b){if(_0x4b8c4b[_0x2e42('0x35')]!=='VIRTUAL'){var _0x19f0ea={};_0x19f0ea[_0x4b8c4b['name']]={'$like':'%'+_0x455a1f[_0x2e42('0x43')][_0x2e42('0x30')]+'%'};return _0x19f0ea;}})});}_0x2bd6dd=_['merge']({},_0x2bd6dd,_0x455a1f[_0x2e42('0x4b')]);var _0x5b31f6={'where':_0x2bd6dd['where']};return db[_0x2e42('0x4c')][_0x2e42('0x24')](_0x5b31f6)[_0x2e42('0x2c')](function(_0x322efa){_0x52be59[_0x2e42('0x24')]=_0x322efa;if(_0x455a1f[_0x2e42('0x43')][_0x2e42('0x4d')]){_0x2bd6dd[_0x2e42('0x4e')]=[{'all':!![]}];}return db[_0x2e42('0x4c')][_0x2e42('0x4f')](_0x2bd6dd);})[_0x2e42('0x2c')](function(_0x151378){_0x52be59[_0x2e42('0x50')]=_0x151378;return _0x52be59;})[_0x2e42('0x2c')](respondWithFilteredResult(_0x50c681,_0x2bd6dd))[_0x2e42('0x51')](handleError(_0x50c681,null));};exports[_0x2e42('0x52')]=function(_0x52868f,_0x1a5934){var _0x5843a9={'raw':![],'where':{'id':_0x52868f[_0x2e42('0x53')]['id']}},_0x5d639f={};_0x5d639f[_0x2e42('0x3e')]=_['keys'](db[_0x2e42('0x4c')][_0x2e42('0x54')]);_0x5d639f[_0x2e42('0x43')]=_[_0x2e42('0x3f')](_0x52868f[_0x2e42('0x43')]);_0x5d639f[_0x2e42('0x40')]=_['intersection'](_0x5d639f[_0x2e42('0x3e')],_0x5d639f['query']);_0x5843a9[_0x2e42('0x42')]=_[_0x2e42('0x41')](_0x5d639f[_0x2e42('0x3e')],qs[_0x2e42('0x44')](_0x52868f[_0x2e42('0x43')][_0x2e42('0x44')]));_0x5843a9[_0x2e42('0x42')]=_0x5843a9[_0x2e42('0x42')][_0x2e42('0x55')]?_0x5843a9[_0x2e42('0x42')]:_0x5d639f[_0x2e42('0x3e')];if(_0x52868f['query'][_0x2e42('0x4d')]){_0x5843a9['include']=[{'all':!![]}];}_0x5843a9=_[_0x2e42('0x4a')]({},_0x5843a9,_0x52868f['options']);return db[_0x2e42('0x4c')][_0x2e42('0x36')](_0x5843a9)[_0x2e42('0x2c')](handleEntityNotFound(_0x1a5934,null))['then'](respondWithResult(_0x1a5934,null))['catch'](handleError(_0x1a5934,null));};exports[_0x2e42('0x56')]=function(_0x32029d,_0x521046){return db[_0x2e42('0x4c')][_0x2e42('0x56')](_0x32029d[_0x2e42('0x57')],{})['then'](function(_0x1f1701){var _0xa3d044=_0x32029d[_0x2e42('0x58')][_0x2e42('0x2e')]({'plain':!![]});if(!_0xa3d044)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa3d044[_0x2e42('0x59')]===_0x2e42('0x58')){var _0x4616de=_0x1f1701[_0x2e42('0x2e')]({'plain':!![]});var _0x42ff06=[{'name':_0x2e42('0x2f'),'value':_0x2e42('0x5a')},{'name':'QueueCampaigns','value':_0x2e42('0x5b')}];var _0xb75232=_[_0x2e42('0x36')](_0x42ff06,[_0x2e42('0x33'),_0x4616de[_0x2e42('0x35')]])[_0x2e42('0x37')];return db['UserProfileSection']['find']({'where':{'name':_0xb75232,'userProfileId':_0xa3d044['userProfileId']},'raw':!![]})[_0x2e42('0x2c')](function(_0x4b2bd0){if(_0x4b2bd0&&_0x4b2bd0[_0x2e42('0x5c')]===0x0){return db[_0x2e42('0x38')][_0x2e42('0x56')]({'name':_0x4616de['name'],'resourceId':_0x4616de['id'],'type':_0x4b2bd0[_0x2e42('0x37')],'sectionId':_0x4b2bd0['id']},{})[_0x2e42('0x2c')](function(){return _0x1f1701;});}else{return _0x1f1701;}})[_0x2e42('0x51')](function(_0x15e540){logger[_0x2e42('0x39')](_0x2e42('0x5d'),_0x15e540);throw _0x15e540;});}return _0x1f1701;})['then'](respondWithResult(_0x521046,0xc9))[_0x2e42('0x51')](handleError(_0x521046,null));};exports[_0x2e42('0x5e')]=function(_0x3b2465,_0x489dc0){var _0x7038c0={'where':{'id':_0x3b2465[_0x2e42('0x53')]['id']}},_0x59633b={};_0x59633b['model']=_[_0x2e42('0x3f')](db[_0x2e42('0x4c')]['rawAttributes']);_0x7038c0[_0x2e42('0x42')]=_[_0x2e42('0x41')](_0x59633b[_0x2e42('0x3e')],qs[_0x2e42('0x44')](_0x3b2465[_0x2e42('0x43')]['fields']));_0x7038c0['attributes']=_0x7038c0[_0x2e42('0x42')]['length']?_0x7038c0['attributes']:_0x59633b[_0x2e42('0x3e')];if(_0x3b2465[_0x2e42('0x43')][_0x2e42('0x4d')]){_0x7038c0[_0x2e42('0x4e')]=[{'all':!![]}];}_0x7038c0=_[_0x2e42('0x4a')]({},_0x7038c0,_0x3b2465[_0x2e42('0x4b')]);return db['VoiceQueue'][_0x2e42('0x36')](_0x7038c0)[_0x2e42('0x2c')](handleEntityNotFound(_0x489dc0,null))['then'](function(_0x181efb){if(_0x181efb){var _0x1be4d2=_0x181efb[_0x2e42('0x2e')]({'plain':!![]});_0x1be4d2=qs['omit'](_0x1be4d2,['id','createdAt','updatedAt']);_0x3b2465['body']=_[_0x2e42('0x5f')](_0x3b2465['body'],['id',_0x2e42('0x60'),_0x2e42('0x61')]);return db[_0x2e42('0x4c')]['create'](_[_0x2e42('0x4a')](_0x1be4d2,_0x3b2465[_0x2e42('0x57')]),{'include':_0x3b2465[_0x2e42('0x43')][_0x2e42('0x4d')]?[{'all':!![]}]:undefined})[_0x2e42('0x2c')](function(_0x1269b6){var _0x1232f0=_0x3b2465['user'][_0x2e42('0x2e')]({'plain':!![]});if(!_0x1232f0)throw new Error(_0x2e42('0x62'));if(_0x1232f0[_0x2e42('0x59')]===_0x2e42('0x58')){var _0x2720c6=_0x1269b6[_0x2e42('0x2e')]({'plain':!![]});var _0x35f38b=[{'name':_0x2e42('0x2f'),'value':_0x2e42('0x5a')},{'name':'QueueCampaigns','value':_0x2e42('0x5b')}];var _0x435d0e=_[_0x2e42('0x36')](_0x35f38b,[_0x2e42('0x33'),_0x2720c6[_0x2e42('0x35')]])[_0x2e42('0x37')];return db[_0x2e42('0x63')][_0x2e42('0x36')]({'where':{'name':_0x435d0e,'userProfileId':_0x1232f0[_0x2e42('0x64')]},'raw':!![]})[_0x2e42('0x2c')](function(_0xde3cfc){if(_0xde3cfc&&_0xde3cfc[_0x2e42('0x5c')]===0x0){return db[_0x2e42('0x38')][_0x2e42('0x56')]({'name':_0x2720c6[_0x2e42('0x37')],'resourceId':_0x2720c6['id'],'type':_0xde3cfc['name'],'sectionId':_0xde3cfc['id']},{})[_0x2e42('0x2c')](function(){return _0x1269b6;});}else{return _0x1269b6;}})[_0x2e42('0x51')](function(_0x2d0105){logger[_0x2e42('0x39')](_0x2e42('0x5d'),_0x2d0105);throw _0x2d0105;});}return _0x1269b6;});}})['then'](respondWithResult(_0x489dc0,0xc9))[_0x2e42('0x51')](handleError(_0x489dc0,null));};exports['update']=function(_0x41a48f,_0x25b287){if(_0x41a48f[_0x2e42('0x57')]['id']){delete _0x41a48f[_0x2e42('0x57')]['id'];}return db[_0x2e42('0x4c')][_0x2e42('0x36')]({'where':{'id':_0x41a48f[_0x2e42('0x53')]['id']}})['then'](handleEntityNotFound(_0x25b287,null))[_0x2e42('0x2c')](saveUpdates(_0x41a48f[_0x2e42('0x57')],null))[_0x2e42('0x2c')](respondWithResult(_0x25b287,null))[_0x2e42('0x51')](handleError(_0x25b287,null));};exports['destroy']=function(_0x33351e,_0x56decf){return db[_0x2e42('0x4c')][_0x2e42('0x36')]({'where':{'id':_0x33351e['params']['id']}})['then'](handleEntityNotFound(_0x56decf,null))[_0x2e42('0x2c')](removeEntity(_0x56decf,null))[_0x2e42('0x51')](handleError(_0x56decf,null));};exports[_0x2e42('0x65')]=function(_0x4f3bba,_0x5563a4,_0x18161c){var _0x2bf72d={'raw':![],'where':{}};var _0x24733d={};var _0x1d21ee={'count':0x0,'rows':[]};return db[_0x2e42('0x4c')][_0x2e42('0x66')]({'where':{'id':_0x4f3bba[_0x2e42('0x53')]['id']}})[_0x2e42('0x2c')](handleEntityNotFound(_0x5563a4,null))['then'](function(_0x3f08ec){if(_0x3f08ec){_0x24733d['model']=_[_0x2e42('0x3f')](db[_0x2e42('0x67')][_0x2e42('0x54')]);_0x24733d[_0x2e42('0x43')]=_[_0x2e42('0x3f')](_0x4f3bba[_0x2e42('0x43')]);_0x24733d['filters']=_['intersection'](_0x24733d[_0x2e42('0x3e')],_0x24733d['query']);_0x2bf72d[_0x2e42('0x42')]=_[_0x2e42('0x41')](_0x24733d[_0x2e42('0x3e')],qs['fields'](_0x4f3bba[_0x2e42('0x43')]['fields']));_0x2bf72d[_0x2e42('0x42')]=_0x2bf72d[_0x2e42('0x42')][_0x2e42('0x55')]?_0x2bf72d[_0x2e42('0x42')]:_0x24733d[_0x2e42('0x3e')];if(!_0x4f3bba[_0x2e42('0x43')]['hasOwnProperty']('nolimit')){_0x2bf72d[_0x2e42('0x23')]=qs['limit'](_0x4f3bba['query'][_0x2e42('0x23')]);_0x2bf72d['offset']=qs[_0x2e42('0x25')](_0x4f3bba['query']['offset']);}_0x2bf72d[_0x2e42('0x46')]=qs['sort'](_0x4f3bba[_0x2e42('0x43')][_0x2e42('0x47')]);_0x2bf72d[_0x2e42('0x48')]=qs[_0x2e42('0x40')](_[_0x2e42('0x49')](_0x4f3bba['query'],_0x24733d[_0x2e42('0x40')]));_0x2bf72d[_0x2e42('0x48')][_0x2e42('0x68')]=_0x3f08ec['id'];if(_0x4f3bba[_0x2e42('0x43')][_0x2e42('0x30')]){_0x2bf72d[_0x2e42('0x48')]=_[_0x2e42('0x4a')](_0x2bf72d[_0x2e42('0x48')],{'$or':_[_0x2e42('0x32')](_0x2bf72d[_0x2e42('0x42')],function(_0x1cbbda){var _0x52e5a9={};_0x52e5a9[_0x1cbbda]={'$like':'%'+_0x4f3bba[_0x2e42('0x43')]['filter']+'%'};return _0x52e5a9;})});}_0x2bf72d=_[_0x2e42('0x4a')]({},_0x2bf72d,_0x4f3bba['options']);return db[_0x2e42('0x67')]['count']({'where':_0x2bf72d['where']})[_0x2e42('0x2c')](function(_0x58f524){_0x1d21ee[_0x2e42('0x24')]=_0x58f524;if(_0x4f3bba[_0x2e42('0x43')][_0x2e42('0x4d')]){_0x2bf72d['include']=[{'all':!![]}];}return db[_0x2e42('0x67')]['findAll'](_0x2bf72d);})['then'](function(_0x14852c){_0x1d21ee[_0x2e42('0x50')]=_0x14852c;return _0x1d21ee;});}})[_0x2e42('0x2c')](respondWithFilteredResult(_0x5563a4,_0x2bf72d))[_0x2e42('0x51')](handleError(_0x5563a4,null));};exports[_0x2e42('0x69')]=function(_0x36f17f,_0x2d25cc,_0x4a7234){var _0x24c098={'raw':!![],'where':{}};var _0x6e05fc={};var _0x141396={'count':0x0,'rows':[]};return db[_0x2e42('0x4c')]['findOne']({'where':{'id':_0x36f17f[_0x2e42('0x53')]['id']}})[_0x2e42('0x2c')](handleEntityNotFound(_0x2d25cc,null))['then'](function(_0x2638ef){if(_0x2638ef){_0x6e05fc['model']=_[_0x2e42('0x3f')](db['CmHopperHistory'][_0x2e42('0x54')]);_0x6e05fc[_0x2e42('0x43')]=_['keys'](_0x36f17f[_0x2e42('0x43')]);_0x6e05fc[_0x2e42('0x40')]=_[_0x2e42('0x41')](_0x6e05fc[_0x2e42('0x3e')],_0x6e05fc[_0x2e42('0x43')]);_0x24c098[_0x2e42('0x42')]=_[_0x2e42('0x41')](_0x6e05fc[_0x2e42('0x3e')],qs[_0x2e42('0x44')](_0x36f17f[_0x2e42('0x43')]['fields']));_0x24c098[_0x2e42('0x42')]=_0x24c098['attributes'][_0x2e42('0x55')]?_0x24c098[_0x2e42('0x42')]:_0x6e05fc['model'];if(!_0x36f17f[_0x2e42('0x43')]['hasOwnProperty'](_0x2e42('0x6a'))){_0x24c098[_0x2e42('0x23')]=qs[_0x2e42('0x23')](_0x36f17f['query']['limit']);_0x24c098['offset']=qs[_0x2e42('0x25')](_0x36f17f[_0x2e42('0x43')]['offset']);}_0x24c098[_0x2e42('0x46')]=qs[_0x2e42('0x47')](_0x36f17f[_0x2e42('0x43')]['sort']);_0x24c098[_0x2e42('0x48')]=qs[_0x2e42('0x40')](_[_0x2e42('0x49')](_0x36f17f[_0x2e42('0x43')],_0x6e05fc[_0x2e42('0x40')]));_0x24c098['where'][_0x2e42('0x68')]=_0x2638ef['id'];if(_0x36f17f[_0x2e42('0x43')][_0x2e42('0x30')]){_0x24c098[_0x2e42('0x48')]=_[_0x2e42('0x4a')](_0x24c098[_0x2e42('0x48')],{'$or':_[_0x2e42('0x32')](_0x24c098[_0x2e42('0x42')],function(_0x9c1d4b){var _0x58680c={};_0x58680c[_0x9c1d4b]={'$like':'%'+_0x36f17f['query'][_0x2e42('0x30')]+'%'};return _0x58680c;})});}_0x24c098=_[_0x2e42('0x4a')]({},_0x24c098,_0x36f17f['options']);return db[_0x2e42('0x6b')][_0x2e42('0x24')]({'where':_0x24c098[_0x2e42('0x48')]})[_0x2e42('0x2c')](function(_0x13480c){_0x141396[_0x2e42('0x24')]=_0x13480c;if(_0x36f17f[_0x2e42('0x43')][_0x2e42('0x4d')]){_0x24c098[_0x2e42('0x4e')]=[{'all':!![]}];}return db[_0x2e42('0x6b')][_0x2e42('0x4f')](_0x24c098);})['then'](function(_0x411132){_0x141396[_0x2e42('0x50')]=_0x411132;return _0x141396;});}})[_0x2e42('0x2c')](respondWithFilteredResult(_0x2d25cc,_0x24c098))[_0x2e42('0x51')](handleError(_0x2d25cc,null));};exports[_0x2e42('0x6c')]=function(_0xb4cb1f,_0x4df73c,_0x463286){var _0xab522b={'raw':!![],'where':{}};var _0x4dcd2e={};var _0x32e103={'count':0x0,'rows':[]};return db[_0x2e42('0x4c')]['findOne']({'where':{'id':_0xb4cb1f['params']['id']}})[_0x2e42('0x2c')](handleEntityNotFound(_0x4df73c,null))[_0x2e42('0x2c')](function(_0x2ec909){if(_0x2ec909){_0x4dcd2e[_0x2e42('0x3e')]=_[_0x2e42('0x3f')](db[_0x2e42('0x6d')][_0x2e42('0x54')]);_0x4dcd2e[_0x2e42('0x43')]=_[_0x2e42('0x3f')](_0xb4cb1f[_0x2e42('0x43')]);_0x4dcd2e[_0x2e42('0x40')]=_[_0x2e42('0x41')](_0x4dcd2e[_0x2e42('0x3e')],_0x4dcd2e[_0x2e42('0x43')]);_0xab522b[_0x2e42('0x42')]=_['intersection'](_0x4dcd2e[_0x2e42('0x3e')],qs[_0x2e42('0x44')](_0xb4cb1f['query'][_0x2e42('0x44')]));_0xab522b[_0x2e42('0x42')]=_0xab522b[_0x2e42('0x42')][_0x2e42('0x55')]?_0xab522b['attributes']:_0x4dcd2e['model'];if(!_0xb4cb1f[_0x2e42('0x43')]['hasOwnProperty'](_0x2e42('0x6a'))){_0xab522b[_0x2e42('0x23')]=qs[_0x2e42('0x23')](_0xb4cb1f['query']['limit']);_0xab522b['offset']=qs['offset'](_0xb4cb1f[_0x2e42('0x43')]['offset']);}_0xab522b[_0x2e42('0x46')]=qs['sort'](_0xb4cb1f['query'][_0x2e42('0x47')]);_0xab522b['where']=qs[_0x2e42('0x40')](_[_0x2e42('0x49')](_0xb4cb1f['query'],_0x4dcd2e[_0x2e42('0x40')]));_0xab522b[_0x2e42('0x48')][_0x2e42('0x68')]=_0x2ec909['id'];if(_0xb4cb1f[_0x2e42('0x43')][_0x2e42('0x30')]){_0xab522b[_0x2e42('0x48')]=_['merge'](_0xab522b['where'],{'$or':_[_0x2e42('0x32')](_0xab522b['attributes'],function(_0x5b40af){var _0x268f7b={};_0x268f7b[_0x5b40af]={'$like':'%'+_0xb4cb1f[_0x2e42('0x43')][_0x2e42('0x30')]+'%'};return _0x268f7b;})});}_0xab522b=_[_0x2e42('0x4a')]({},_0xab522b,_0xb4cb1f['options']);return db[_0x2e42('0x6d')][_0x2e42('0x24')]({'where':_0xab522b[_0x2e42('0x48')]})[_0x2e42('0x2c')](function(_0x3bae8f){_0x32e103['count']=_0x3bae8f;if(_0xb4cb1f[_0x2e42('0x43')][_0x2e42('0x4d')]){_0xab522b['include']=[{'all':!![]}];}return db[_0x2e42('0x6d')][_0x2e42('0x4f')](_0xab522b);})['then'](function(_0x3088d5){_0x32e103[_0x2e42('0x50')]=_0x3088d5;return _0x32e103;});}})[_0x2e42('0x2c')](respondWithFilteredResult(_0x4df73c,_0xab522b))['catch'](handleError(_0x4df73c,null));};exports[_0x2e42('0x6e')]=function(_0x480d6f,_0x15fa14,_0x20aaab){var _0x4e471e={'raw':!![],'where':{}};var _0xc3a04b={};var _0xe23345={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x2e42('0x66')]({'where':{'id':_0x480d6f[_0x2e42('0x53')]['id']}})[_0x2e42('0x2c')](handleEntityNotFound(_0x15fa14,null))['then'](function(_0x4287bf){if(_0x4287bf){_0xc3a04b[_0x2e42('0x3e')]=_[_0x2e42('0x3f')](db[_0x2e42('0x6f')][_0x2e42('0x54')]);_0xc3a04b[_0x2e42('0x43')]=_[_0x2e42('0x3f')](_0x480d6f[_0x2e42('0x43')]);_0xc3a04b[_0x2e42('0x40')]=_[_0x2e42('0x41')](_0xc3a04b[_0x2e42('0x3e')],_0xc3a04b['query']);_0x4e471e[_0x2e42('0x42')]=_['intersection'](_0xc3a04b[_0x2e42('0x3e')],qs[_0x2e42('0x44')](_0x480d6f[_0x2e42('0x43')]['fields']));_0x4e471e[_0x2e42('0x42')]=_0x4e471e['attributes'][_0x2e42('0x55')]?_0x4e471e['attributes']:_0xc3a04b[_0x2e42('0x3e')];if(!_0x480d6f[_0x2e42('0x43')][_0x2e42('0x45')](_0x2e42('0x6a'))){_0x4e471e[_0x2e42('0x23')]=qs['limit'](_0x480d6f[_0x2e42('0x43')][_0x2e42('0x23')]);_0x4e471e[_0x2e42('0x25')]=qs[_0x2e42('0x25')](_0x480d6f['query']['offset']);}_0x4e471e[_0x2e42('0x46')]=qs['sort'](_0x480d6f[_0x2e42('0x43')]['sort']);_0x4e471e[_0x2e42('0x48')]=qs[_0x2e42('0x40')](_[_0x2e42('0x49')](_0x480d6f[_0x2e42('0x43')],_0xc3a04b['filters']));_0x4e471e['where'][_0x2e42('0x68')]=_0x4287bf['id'];if(_0x480d6f[_0x2e42('0x43')]['filter']){_0x4e471e[_0x2e42('0x48')]=_[_0x2e42('0x4a')](_0x4e471e[_0x2e42('0x48')],{'$or':_[_0x2e42('0x32')](_0x4e471e[_0x2e42('0x42')],function(_0xf438c8){var _0x4f0109={};_0x4f0109[_0xf438c8]={'$like':'%'+_0x480d6f[_0x2e42('0x43')][_0x2e42('0x30')]+'%'};return _0x4f0109;})});}_0x4e471e=_[_0x2e42('0x4a')]({},_0x4e471e,_0x480d6f[_0x2e42('0x4b')]);return db[_0x2e42('0x6f')][_0x2e42('0x24')]({'where':_0x4e471e[_0x2e42('0x48')]})[_0x2e42('0x2c')](function(_0xec11ec){_0xe23345['count']=_0xec11ec;if(_0x480d6f[_0x2e42('0x43')][_0x2e42('0x4d')]){_0x4e471e[_0x2e42('0x4e')]=[{'all':!![]}];}return db[_0x2e42('0x6f')][_0x2e42('0x4f')](_0x4e471e);})[_0x2e42('0x2c')](function(_0xec6674){_0xe23345[_0x2e42('0x50')]=_0xec6674;return _0xe23345;});}})[_0x2e42('0x2c')](respondWithFilteredResult(_0x15fa14,_0x4e471e))[_0x2e42('0x51')](handleError(_0x15fa14,null));};exports[_0x2e42('0x70')]=function(_0x38d4f6,_0x572500,_0x84ab0f){var _0x2c717f={};var _0x2f90ec={};var _0x124f2f;var _0x587d1b;return db[_0x2e42('0x4c')][_0x2e42('0x66')]({'where':{'id':_0x38d4f6[_0x2e42('0x53')]['id']}})[_0x2e42('0x2c')](handleEntityNotFound(_0x572500,null))['then'](function(_0x455b40){if(_0x455b40){_0x124f2f=_0x455b40;_0x2f90ec[_0x2e42('0x3e')]=_[_0x2e42('0x3f')](db[_0x2e42('0x71')]['rawAttributes']);_0x2f90ec[_0x2e42('0x43')]=_[_0x2e42('0x3f')](_0x38d4f6[_0x2e42('0x43')]);_0x2f90ec['filters']=_[_0x2e42('0x41')](_0x2f90ec[_0x2e42('0x3e')],_0x2f90ec['query']);_0x2c717f[_0x2e42('0x42')]=_[_0x2e42('0x41')](_0x2f90ec[_0x2e42('0x3e')],qs[_0x2e42('0x44')](_0x38d4f6[_0x2e42('0x43')][_0x2e42('0x44')]));_0x2c717f[_0x2e42('0x42')]=_0x2c717f['attributes'][_0x2e42('0x55')]?_0x2c717f[_0x2e42('0x42')]:_0x2f90ec[_0x2e42('0x3e')];_0x2c717f['order']=qs['sort'](_0x38d4f6[_0x2e42('0x43')]['sort']);_0x2c717f[_0x2e42('0x48')]=qs['filters'](_[_0x2e42('0x49')](_0x38d4f6[_0x2e42('0x43')],_0x2f90ec[_0x2e42('0x40')]));if(_0x38d4f6['query']['filter']){_0x2c717f['where']=_['merge'](_0x2c717f[_0x2e42('0x48')],{'$or':_[_0x2e42('0x32')](_0x2c717f[_0x2e42('0x42')],function(_0xbc3573){var _0x2edf3e={};_0x2edf3e[_0xbc3573]={'$like':'%'+_0x38d4f6[_0x2e42('0x43')]['filter']+'%'};return _0x2edf3e;})});}_0x2c717f=_[_0x2e42('0x4a')]({},_0x2c717f,_0x38d4f6['options']);return _0x124f2f[_0x2e42('0x70')](_0x2c717f);}})['then'](function(_0x1416c5){if(_0x1416c5){_0x587d1b=_0x1416c5[_0x2e42('0x55')];if(!_0x38d4f6[_0x2e42('0x43')][_0x2e42('0x45')](_0x2e42('0x6a'))){_0x2c717f['limit']=qs[_0x2e42('0x23')](_0x38d4f6[_0x2e42('0x43')][_0x2e42('0x23')]);_0x2c717f[_0x2e42('0x25')]=qs['offset'](_0x38d4f6[_0x2e42('0x43')][_0x2e42('0x25')]);}return _0x124f2f[_0x2e42('0x70')](_0x2c717f);}})[_0x2e42('0x2c')](function(_0x1ceef6){if(_0x1ceef6){return _0x1ceef6?{'count':_0x587d1b,'rows':_0x1ceef6}:null;}})[_0x2e42('0x2c')](respondWithResult(_0x572500,null))[_0x2e42('0x51')](handleError(_0x572500,null));};exports['addTeams']=function(_0x3b3b4e,_0x28aa8d,_0x5b4358){var _0x226ce8=_0x3b3b4e['body']['teams'];var _0x3404f9=_[_0x2e42('0x32')](_0x226ce8,'id');return db[_0x2e42('0x71')][_0x2e42('0x4f')]({'where':{'id':_0x3404f9},'attributes':['id'],'include':[{'model':db[_0x2e42('0x72')],'as':_0x2e42('0x73'),'attributes':['id',_0x2e42('0x37'),_0x2e42('0x74'),_0x2e42('0x75'),'interface'],'raw':!![]}]})[_0x2e42('0x2c')](function(_0x167b36){if(_0x167b36){var _0x39f99e=_['flatMap'](_0x167b36,function(_0x322ce5){var _0x3bbf7c=_0x322ce5[_0x2e42('0x2e')]({'plain':!![]});_0x3bbf7c[_0x2e42('0x73')][_0x2e42('0x76')](function(_0x5be98a){_0x5be98a[_0x2e42('0x77')]=_[_0x2e42('0x36')](_0x226ce8,{'id':_0x3bbf7c['id']})['penalty'];});return _0x3bbf7c[_0x2e42('0x73')];});return db[_0x2e42('0x4c')][_0x2e42('0x36')]({'where':{'id':_0x3b3b4e[_0x2e42('0x53')]['id']}})[_0x2e42('0x2c')](function(_0xb23c36){return db[_0x2e42('0x78')][_0x2e42('0x79')](function(_0x55f0c3){return _0xb23c36['addTeams'](_0x3404f9,{'transaction':_0x55f0c3})[_0x2e42('0x2c')](function(){return BPromise[_0x2e42('0x7a')](_0x226ce8,function(_0x29eabb){return db[_0x2e42('0x7b')][_0x2e42('0x7c')]({'TeamId':_0x29eabb['id'],'VoiceQueueId':_0x3b3b4e[_0x2e42('0x53')]['id'],'penalty':_0x29eabb[_0x2e42('0x77')]},{'transaction':_0x55f0c3});});})[_0x2e42('0x2c')](function(){return BPromise[_0x2e42('0x7a')](_0x39f99e,function(_0x2e0f1f){return db[_0x2e42('0x7d')]['findOrCreate']({'where':{'UserId':_0x2e0f1f['id'],'VoiceQueueId':_0x3b3b4e['params']['id']},'defaults':{'penalty':_0x2e0f1f[_0x2e42('0x77')]},'transaction':_0x55f0c3});});})[_0x2e42('0x2c')](function(){return BPromise[_0x2e42('0x7a')](_[_0x2e42('0x30')](_0x39f99e,{'online':!![]}),function(_0x528b43){return db[_0x2e42('0x7e')][_0x2e42('0x7c')]({'membername':_0x528b43[_0x2e42('0x37')],'UserId':_0x528b43['id'],'queue_name':_0xb23c36[_0x2e42('0x37')],'VoiceQueueId':_0xb23c36['id'],'interface':_['isNil'](_0x528b43[_0x2e42('0x7f')])?util[_0x2e42('0x80')](_0x2e42('0x81'),_0x528b43[_0x2e42('0x37')]):_0x528b43[_0x2e42('0x7f')],'paused':_0x528b43['voicePause']||![],'penalty':_0x528b43[_0x2e42('0x77')]},{'transaction':_0x55f0c3});});})[_0x2e42('0x2c')](function(){_0x39f99e[_0x2e42('0x76')](function(_0x201d16){socket[_0x2e42('0x82')](_0x2e42('0x83'),{'UserId':_0x201d16['id'],'VoiceQueueId':_0xb23c36['id']});});});});});}})[_0x2e42('0x2c')](respondWithStatusCode(_0x28aa8d,null))['catch'](handleError(_0x28aa8d,null));};exports[_0x2e42('0x84')]=function(_0x4fb0ca,_0x3544a3,_0x805515){return db[_0x2e42('0x71')][_0x2e42('0x4f')]({'where':{'id':_0x4fb0ca[_0x2e42('0x43')][_0x2e42('0x85')]},'attributes':['id'],'include':[{'model':db[_0x2e42('0x72')],'as':_0x2e42('0x73'),'attributes':['id'],'raw':!![]}]})[_0x2e42('0x2c')](handleEntityNotFound(_0x3544a3,null))[_0x2e42('0x2c')](function(_0x144169){var _0x3aa95d=_[_0x2e42('0x32')](_0x144169,'id');var _0x26ce62=[];var _0x118bbe=[];var _0x88e3f6=squel[_0x2e42('0x86')]();_0x88e3f6[_0x2e42('0x87')](_0x2e42('0x88'))['from'](_0x2e42('0x89'),'tq')[_0x2e42('0x8a')](_0x2e42('0x8b'),'ut',_0x2e42('0x8c'))['where'](_0x2e42('0x8d'),_0x4fb0ca[_0x2e42('0x53')]['id']);for(var _0x92107a=0x0;_0x92107a<_0x144169[_0x2e42('0x55')];_0x92107a+=0x1){let _0x1e9f58=_0x144169[_0x92107a];for(var _0xd90395=0x0;_0xd90395<_0x1e9f58[_0x2e42('0x73')][_0x2e42('0x55')];_0xd90395+=0x1){let _0x4bbbd8=_0x1e9f58[_0x2e42('0x73')][_0xd90395];var _0x364f0a=_0x88e3f6[_0x2e42('0x5e')]();_0x364f0a[_0x2e42('0x48')]('ut.UserId\x20=\x20?',_0x4bbbd8['id']);_0x118bbe[_0x2e42('0x8e')](db[_0x2e42('0x78')]['query'](_0x364f0a[_0x2e42('0x8f')](),{'type':db[_0x2e42('0x78')][_0x2e42('0x90')]['SELECT']})[_0x2e42('0x2c')](function(_0x5a337c){if(_0x5a337c['length']===0x1){return _0x4bbbd8['id'];}else{var _0x34f4a1=_['every'](_['map'](_0x5a337c,_0x2e42('0x91')),function(_0x5907d5){return _[_0x2e42('0x34')](_0x3aa95d,_0x5907d5);});if(_0x34f4a1){return _0x4bbbd8['id'];}}}));}}return BPromise['all'](_0x118bbe)[_0x2e42('0x2c')](function(_0x3c97d5){_0x26ce62=_(_0x26ce62)['union'](_0x3c97d5)[_0x2e42('0x92')]()[_0x2e42('0x33')]();return db['VoiceQueue'][_0x2e42('0x36')]({'where':{'id':_0x4fb0ca[_0x2e42('0x53')]['id']}})[_0x2e42('0x2c')](function(_0x24caa5){return db[_0x2e42('0x78')][_0x2e42('0x79')](function(_0x2b4299){return _0x24caa5[_0x2e42('0x84')](_0x4fb0ca[_0x2e42('0x43')][_0x2e42('0x85')],{'transaction':_0x2b4299})['then'](function(){if(!_[_0x2e42('0x93')](_0x26ce62)){return _0x24caa5['removeAgents'](_0x26ce62,{'transaction':_0x2b4299})[_0x2e42('0x2c')](function(){return db[_0x2e42('0x7e')][_0x2e42('0x2d')]({'where':{'VoiceQueueId':_0x4fb0ca['params']['id'],'UserId':_0x26ce62},'transaction':_0x2b4299});});}})[_0x2e42('0x2c')](function(){_0x26ce62[_0x2e42('0x76')](function(_0x384de6){socket[_0x2e42('0x82')](_0x2e42('0x94'),{'UserId':_0x384de6,'VoiceQueueId':_0x24caa5['id']});});});});});});})['then'](respondWithStatusCode(_0x3544a3,null))[_0x2e42('0x51')](handleError(_0x3544a3,null));};exports['addAgents']=function(_0x38011e,_0x3994d2,_0x27a0bc){var _0x5e3d97,_0x5cdb9f;return db[_0x2e42('0x4c')][_0x2e42('0x36')]({'where':{'id':_0x38011e[_0x2e42('0x53')]['id']}})[_0x2e42('0x2c')](handleEntityNotFound(_0x3994d2,null))[_0x2e42('0x2c')](function(_0x1386fd){if(_0x1386fd){_0x5cdb9f=_0x1386fd;return _0x1386fd[_0x2e42('0x95')](_0x38011e[_0x2e42('0x57')][_0x2e42('0x85')],_[_0x2e42('0x5f')](_0x38011e[_0x2e42('0x57')],['ids','id'])||{})['spread'](function(_0x1f3ac9){for(var _0x4f0060=0x0;_0x4f0060<_0x38011e['body'][_0x2e42('0x85')][_0x2e42('0x55')];_0x4f0060+=0x1){socket[_0x2e42('0x82')](_0x2e42('0x83'),{'UserId':Number(_0x38011e[_0x2e42('0x57')][_0x2e42('0x85')][_0x4f0060]),'VoiceQueueId':Number(_0x38011e[_0x2e42('0x53')]['id'])});}return _0x1f3ac9;});}})[_0x2e42('0x2c')](function(_0x2dc046){_0x5e3d97=_0x2dc046||[];if(_0x5cdb9f){return db[_0x2e42('0x72')]['findAll']({'where':{'id':_0x38011e['body'][_0x2e42('0x85')]},'attributes':['id',_0x2e42('0x37'),_0x2e42('0x74'),_0x2e42('0x75'),'interface'],'raw':!![]});}})[_0x2e42('0x2c')](function(_0x178f78){if(!_[_0x2e42('0x93')](_0x178f78)){var _0x5d804a=[];for(var _0x26e65d=0x0;_0x26e65d<_0x178f78[_0x2e42('0x55')];_0x26e65d++){if(_0x178f78[_0x26e65d][_0x2e42('0x74')]){_0x5d804a[_0x2e42('0x8e')](db['UserVoiceQueueRt']['upsert']({'membername':_0x178f78[_0x26e65d][_0x2e42('0x37')],'UserId':_0x178f78[_0x26e65d]['id'],'queue_name':_0x5cdb9f[_0x2e42('0x37')],'VoiceQueueId':_0x5cdb9f['id'],'interface':_[_0x2e42('0x96')](_0x178f78[_0x26e65d][_0x2e42('0x7f')])?util['format'](_0x2e42('0x81'),_0x178f78[_0x26e65d][_0x2e42('0x37')]):_0x178f78[_0x26e65d][_0x2e42('0x7f')],'paused':_0x178f78[_0x26e65d]['voicePause']||![],'penalty':_0x38011e[_0x2e42('0x57')]['penalty']||0x0}));}}return BPromise[_0x2e42('0x97')](_0x5d804a);}})['then'](function(){return _0x5e3d97;})['then'](respondWithResult(_0x3994d2,null))[_0x2e42('0x51')](handleError(_0x3994d2,null));};exports['removeAgents']=function(_0x476faa,_0x29fac2,_0x5bfed6){return db[_0x2e42('0x4c')][_0x2e42('0x36')]({'where':{'id':_0x476faa[_0x2e42('0x53')]['id']}})['then'](handleEntityNotFound(_0x29fac2,null))[_0x2e42('0x2c')](function(_0x1b966d){if(_0x1b966d){return _0x1b966d['removeAgents'](_0x476faa['query'][_0x2e42('0x85')])['then'](function(){if(_['isArray'](_0x476faa['query'][_0x2e42('0x85')])){for(var _0x5b1a79=0x0;_0x5b1a79<_0x476faa[_0x2e42('0x43')][_0x2e42('0x85')]['length'];_0x5b1a79+=0x1){socket[_0x2e42('0x82')](_0x2e42('0x94'),{'UserId':Number(_0x476faa[_0x2e42('0x43')]['ids'][_0x5b1a79]),'VoiceQueueId':Number(_0x476faa[_0x2e42('0x53')]['id'])});}}else{socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x476faa[_0x2e42('0x43')][_0x2e42('0x85')]),'VoiceQueueId':Number(_0x476faa[_0x2e42('0x53')]['id'])});}});}})['then'](function(_0x5658b2){return db[_0x2e42('0x7e')][_0x2e42('0x2d')]({'where':{'VoiceQueueId':_0x476faa['params']['id'],'UserId':_0x476faa[_0x2e42('0x43')]['ids']}})[_0x2e42('0x2c')](function(){return _0x5658b2;});})[_0x2e42('0x2c')](respondWithStatusCode(_0x29fac2,null))['catch'](handleError(_0x29fac2,null));};exports[_0x2e42('0x98')]=function(_0x29c465,_0x4c2a48,_0x2a3093){var _0x11b332={};var _0x51a4c9={};var _0x1f90b6;var _0x3ef6ea;return db[_0x2e42('0x4c')][_0x2e42('0x66')]({'where':{'id':_0x29c465[_0x2e42('0x53')]['id']}})[_0x2e42('0x2c')](handleEntityNotFound(_0x4c2a48,null))[_0x2e42('0x2c')](function(_0x15cb84){if(_0x15cb84){_0x1f90b6=_0x15cb84;_0x51a4c9[_0x2e42('0x3e')]=_[_0x2e42('0x3f')](db[_0x2e42('0x72')][_0x2e42('0x54')]);_0x51a4c9[_0x2e42('0x43')]=_[_0x2e42('0x3f')](_0x29c465['query']);_0x51a4c9[_0x2e42('0x40')]=_[_0x2e42('0x41')](_0x51a4c9[_0x2e42('0x3e')],_0x51a4c9[_0x2e42('0x43')]);_0x11b332[_0x2e42('0x42')]=_['intersection'](_0x51a4c9[_0x2e42('0x3e')],qs[_0x2e42('0x44')](_0x29c465[_0x2e42('0x43')][_0x2e42('0x44')]));_0x11b332['attributes']=_0x11b332[_0x2e42('0x42')][_0x2e42('0x55')]?_0x11b332[_0x2e42('0x42')]:_0x51a4c9['model'];_0x11b332['order']=qs[_0x2e42('0x47')](_0x29c465[_0x2e42('0x43')][_0x2e42('0x47')]);_0x11b332[_0x2e42('0x48')]=qs[_0x2e42('0x40')](_[_0x2e42('0x49')](_0x29c465[_0x2e42('0x43')],_0x51a4c9[_0x2e42('0x40')]));if(_0x29c465[_0x2e42('0x43')]['filter']){_0x11b332['where']=_[_0x2e42('0x4a')](_0x11b332[_0x2e42('0x48')],{'$or':_['map'](_0x11b332[_0x2e42('0x42')],function(_0x56e695){var _0xf4478b={};_0xf4478b[_0x56e695]={'$like':'%'+_0x29c465[_0x2e42('0x43')][_0x2e42('0x30')]+'%'};return _0xf4478b;})});}_0x11b332=_[_0x2e42('0x4a')]({},_0x11b332,_0x29c465['options']);return _0x1f90b6['getAgents'](_0x11b332);}})[_0x2e42('0x2c')](function(_0x1c79a4){if(_0x1c79a4){_0x3ef6ea=_0x1c79a4[_0x2e42('0x55')];if(!_0x29c465['query'][_0x2e42('0x45')]('nolimit')){_0x11b332[_0x2e42('0x23')]=qs[_0x2e42('0x23')](_0x29c465[_0x2e42('0x43')][_0x2e42('0x23')]);_0x11b332[_0x2e42('0x25')]=qs[_0x2e42('0x25')](_0x29c465[_0x2e42('0x43')][_0x2e42('0x25')]);}return _0x1f90b6['getAgents'](_0x11b332);}})[_0x2e42('0x2c')](function(_0x50d66e){if(_0x50d66e){return _0x50d66e?{'count':_0x3ef6ea,'rows':_0x50d66e}:null;}})[_0x2e42('0x2c')](respondWithResult(_0x4c2a48,null))['catch'](handleError(_0x4c2a48,null));};exports[_0x2e42('0x99')]=function(_0x35a7e0,_0xef5fa6,_0x1c9c3f){var _0x1aa72b={};var _0x288399={};var _0x56759c;var _0x357631;return db['VoiceQueue'][_0x2e42('0x66')]({'where':{'id':_0x35a7e0['params']['id']}})[_0x2e42('0x2c')](handleEntityNotFound(_0xef5fa6,null))[_0x2e42('0x2c')](function(_0x15c0a8){if(_0x15c0a8){_0x56759c=_0x15c0a8;_0x288399[_0x2e42('0x3e')]=_[_0x2e42('0x3f')](db[_0x2e42('0x7e')][_0x2e42('0x54')]);_0x288399['query']=_[_0x2e42('0x3f')](_0x35a7e0[_0x2e42('0x43')]);_0x288399[_0x2e42('0x40')]=_[_0x2e42('0x41')](_0x288399['model'],_0x288399[_0x2e42('0x43')]);_0x1aa72b[_0x2e42('0x42')]=_[_0x2e42('0x41')](_0x288399[_0x2e42('0x3e')],qs[_0x2e42('0x44')](_0x35a7e0[_0x2e42('0x43')][_0x2e42('0x44')]));_0x1aa72b[_0x2e42('0x42')]=_0x1aa72b[_0x2e42('0x42')]['length']?_0x1aa72b['attributes']:_0x288399[_0x2e42('0x3e')];_0x1aa72b[_0x2e42('0x46')]=qs['sort'](_0x35a7e0[_0x2e42('0x43')][_0x2e42('0x47')]);_0x1aa72b['where']=qs['filters'](_['pick'](_0x35a7e0[_0x2e42('0x43')],_0x288399[_0x2e42('0x40')]));if(_0x35a7e0['query'][_0x2e42('0x30')]){_0x1aa72b['where']=_[_0x2e42('0x4a')](_0x1aa72b[_0x2e42('0x48')],{'$or':_[_0x2e42('0x32')](_0x1aa72b['attributes'],function(_0x1720e4){var _0x433169={};_0x433169[_0x1720e4]={'$like':'%'+_0x35a7e0[_0x2e42('0x43')][_0x2e42('0x30')]+'%'};return _0x433169;})});}_0x1aa72b=_[_0x2e42('0x4a')]({},_0x1aa72b,_0x35a7e0[_0x2e42('0x4b')]);return _0x56759c['getMembers'](_0x1aa72b);}})[_0x2e42('0x2c')](function(_0x5d7671){if(_0x5d7671){_0x357631=_0x5d7671[_0x2e42('0x55')];if(!_0x35a7e0[_0x2e42('0x43')][_0x2e42('0x45')]('nolimit')){_0x1aa72b[_0x2e42('0x23')]=qs[_0x2e42('0x23')](_0x35a7e0['query'][_0x2e42('0x23')]);_0x1aa72b[_0x2e42('0x25')]=qs['offset'](_0x35a7e0[_0x2e42('0x43')][_0x2e42('0x25')]);}return _0x56759c[_0x2e42('0x99')](_0x1aa72b);}})[_0x2e42('0x2c')](function(_0xb1b88b){return _0xb1b88b?{'count':_0x357631,'rows':_0xb1b88b}:null;})['then'](respondWithResult(_0xef5fa6,null))[_0x2e42('0x51')](handleError(_0xef5fa6,null));};exports[_0x2e42('0x9a')]=function(_0x2ee52b,_0x28a425,_0x44a2cc){var _0x463212={};var _0x2e0aa4={};var _0x4a40ae;var _0x10cbd3;return db[_0x2e42('0x4c')]['findOne']({'where':{'id':_0x2ee52b[_0x2e42('0x53')]['id']}})[_0x2e42('0x2c')](handleEntityNotFound(_0x28a425,null))['then'](function(_0x32953f){if(_0x32953f){_0x4a40ae=_0x32953f;_0x2e0aa4[_0x2e42('0x3e')]=_[_0x2e42('0x3f')](db['CmList'][_0x2e42('0x54')]);_0x2e0aa4[_0x2e42('0x43')]=_[_0x2e42('0x3f')](_0x2ee52b['query']);_0x2e0aa4[_0x2e42('0x40')]=_['intersection'](_0x2e0aa4['model'],_0x2e0aa4[_0x2e42('0x43')]);_0x463212[_0x2e42('0x42')]=_[_0x2e42('0x41')](_0x2e0aa4[_0x2e42('0x3e')],qs[_0x2e42('0x44')](_0x2ee52b[_0x2e42('0x43')][_0x2e42('0x44')]));_0x463212[_0x2e42('0x42')]=_0x463212[_0x2e42('0x42')]['length']?_0x463212[_0x2e42('0x42')]:_0x2e0aa4[_0x2e42('0x3e')];_0x463212[_0x2e42('0x46')]=qs[_0x2e42('0x47')](_0x2ee52b[_0x2e42('0x43')][_0x2e42('0x47')]);_0x463212[_0x2e42('0x48')]=qs['filters'](_['pick'](_0x2ee52b[_0x2e42('0x43')],_0x2e0aa4['filters']));if(_0x2ee52b[_0x2e42('0x43')][_0x2e42('0x30')]){_0x463212[_0x2e42('0x48')]=_[_0x2e42('0x4a')](_0x463212['where'],{'$or':_['map'](_0x463212['attributes'],function(_0x59e3ba){var _0x4c8df0={};_0x4c8df0[_0x59e3ba]={'$like':'%'+_0x2ee52b[_0x2e42('0x43')][_0x2e42('0x30')]+'%'};return _0x4c8df0;})});}_0x463212=_[_0x2e42('0x4a')]({},_0x463212,_0x2ee52b[_0x2e42('0x4b')]);return _0x4a40ae['getLists'](_0x463212);}})[_0x2e42('0x2c')](function(_0x3aa6b4){if(_0x3aa6b4){_0x10cbd3=_0x3aa6b4[_0x2e42('0x55')];if(!_0x2ee52b[_0x2e42('0x43')][_0x2e42('0x45')](_0x2e42('0x6a'))){_0x463212['limit']=qs[_0x2e42('0x23')](_0x2ee52b[_0x2e42('0x43')]['limit']);_0x463212['offset']=qs['offset'](_0x2ee52b[_0x2e42('0x43')]['offset']);}return _0x4a40ae[_0x2e42('0x9a')](_0x463212);}})['then'](function(_0x6867a){if(_0x6867a){return _0x6867a?{'count':_0x10cbd3,'rows':_0x6867a}:null;}})[_0x2e42('0x2c')](respondWithResult(_0x28a425,null))[_0x2e42('0x51')](handleError(_0x28a425,null));};exports[_0x2e42('0x9b')]=function(_0x438630,_0x2feb72,_0x390a0a){var _0x540a3,_0x2b7206;return db['VoiceQueue']['find']({'where':{'id':_0x438630[_0x2e42('0x53')]['id']}})[_0x2e42('0x2c')](handleEntityNotFound(_0x2feb72,null))[_0x2e42('0x2c')](function(_0x3e89af){if(_0x3e89af){_0x2b7206=_0x3e89af;return _0x3e89af['addLists'](_0x438630[_0x2e42('0x57')][_0x2e42('0x85')],_[_0x2e42('0x5f')](_0x438630['body'],['ids','id'])||{});}return null;})[_0x2e42('0x9c')](function(_0x22aba2){var _0x45a827;_0x540a3=_0x22aba2||[];var _0xcc915f=[];if(_0x22aba2){for(var _0x589bfd=0x0;_0x589bfd<_0x22aba2['length'];_0x589bfd+=0x1){var _0x27cd00=_0x22aba2[_0x589bfd]['get']({'plain':!![]});_0x2b7206[_0x2e42('0x9d')]=_0x438630[_0x2e42('0x57')]['dialCheckDuplicateType']?_0x438630[_0x2e42('0x57')][_0x2e42('0x9d')]:_0x2b7206[_0x2e42('0x9d')];switch(_0x2b7206[_0x2e42('0x9d')]){case _0x2e42('0x9e'):_0x45a827=squel[_0x2e42('0x9f')]()['into']('cm_hopper')[_0x2e42('0xa0')]([_0x2e42('0xa1'),_0x2e42('0xa2'),_0x2e42('0xa3'),_0x2e42('0xa4'),'VoiceQueueId','createdAt',_0x2e42('0x61')],squel[_0x2e42('0x86')]()[_0x2e42('0x87')](_0x2e42('0xa1'),_0x2e42('0xa1'))['field']('NOW()',_0x2e42('0xa2'))[_0x2e42('0x87')]('id',_0x2e42('0xa3'))['field'](_0x27cd00['CmListId'][_0x2e42('0x8f')](),'ListId')[_0x2e42('0x87')](_0x438630['params']['id']['toString'](),_0x2e42('0x68'))[_0x2e42('0x87')](_0x2e42('0xa5'),_0x2e42('0x60'))[_0x2e42('0x87')](_0x2e42('0xa5'),_0x2e42('0x61'))[_0x2e42('0xa6')](_0x2e42('0xa7'))['where'](_0x2e42('0xa8'))[_0x2e42('0x48')](_0x2e42('0xa9'),_0x27cd00[_0x2e42('0xaa')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL')[_0x2e42('0x48')](_0x2e42('0xab'),squel[_0x2e42('0x86')]()[_0x2e42('0x87')]('COALESCE(calleridnum,\x27\x27)')[_0x2e42('0xa6')](_0x2e42('0xac'))[_0x2e42('0x48')]('VoiceQueueId\x20=\x20?',_0x438630[_0x2e42('0x53')]['id'][_0x2e42('0x8f')]()))[_0x2e42('0x48')](_0x2e42('0xab'),squel['select']()[_0x2e42('0x87')](_0x2e42('0xad'))[_0x2e42('0xa6')](_0x2e42('0xae'))[_0x2e42('0x48')]('VoiceQueueId\x20=\x20?',_0x438630['params']['id'][_0x2e42('0x8f')]())))[_0x2e42('0x8f')]();break;case _0x2e42('0xaf'):_0x45a827=squel[_0x2e42('0x9f')]()['into'](_0x2e42('0xae'))[_0x2e42('0xa0')]([_0x2e42('0xa1'),_0x2e42('0xa2'),'ContactId','ListId','VoiceQueueId','createdAt','updatedAt'],squel['select']()[_0x2e42('0x87')](_0x2e42('0xa1'),_0x2e42('0xa1'))[_0x2e42('0x87')](_0x2e42('0xa5'),_0x2e42('0xa2'))[_0x2e42('0x87')]('id',_0x2e42('0xa3'))['field'](_0x27cd00[_0x2e42('0xaa')][_0x2e42('0x8f')](),_0x2e42('0xa4'))[_0x2e42('0x87')](_0x438630[_0x2e42('0x53')]['id'][_0x2e42('0x8f')](),_0x2e42('0x68'))[_0x2e42('0x87')](_0x2e42('0xa5'),_0x2e42('0x60'))[_0x2e42('0x87')](_0x2e42('0xa5'),_0x2e42('0x61'))[_0x2e42('0xa6')]('cm_contacts')[_0x2e42('0x48')](_0x2e42('0xa8'))[_0x2e42('0x48')](_0x2e42('0xa9'),_0x27cd00[_0x2e42('0xaa')][_0x2e42('0x8f')]())[_0x2e42('0x48')](_0x2e42('0xb0'))[_0x2e42('0x48')](_0x2e42('0xab'),squel[_0x2e42('0x86')]()[_0x2e42('0x87')](_0x2e42('0xad'))[_0x2e42('0xa6')](_0x2e42('0xae'))[_0x2e42('0x48')]('VoiceQueueId\x20=\x20?',_0x438630[_0x2e42('0x53')]['id'][_0x2e42('0x8f')]())))['toString']();break;default:_0x45a827=squel['insert']()[_0x2e42('0xb1')]('cm_hopper')[_0x2e42('0xa0')]([_0x2e42('0xa1'),'scheduledAt',_0x2e42('0xa3'),'ListId','VoiceQueueId',_0x2e42('0x60'),_0x2e42('0x61')],squel[_0x2e42('0x86')]()[_0x2e42('0x87')](_0x2e42('0xa1'),'phone')['field'](_0x2e42('0xa5'),_0x2e42('0xa2'))['field']('id',_0x2e42('0xa3'))['field'](_0x27cd00[_0x2e42('0xaa')][_0x2e42('0x8f')](),_0x2e42('0xa4'))[_0x2e42('0x87')](_0x438630['params']['id'][_0x2e42('0x8f')](),_0x2e42('0x68'))['field'](_0x2e42('0xa5'),_0x2e42('0x60'))[_0x2e42('0x87')]('NOW()',_0x2e42('0x61'))['from'](_0x2e42('0xa7'))[_0x2e42('0x48')]('deletedAt\x20IS\x20NULL')[_0x2e42('0x48')](_0x2e42('0xa9'),_0x27cd00['CmListId']['toString']())[_0x2e42('0x48')](_0x2e42('0xb0')))[_0x2e42('0x8f')]();}_0xcc915f[_0x2e42('0x8e')](db[_0x2e42('0x78')][_0x2e42('0x43')](_0x45a827));}return BPromise[_0x2e42('0x97')](_0xcc915f);}})['then'](function(){return _0x540a3;})['then'](respondWithResult(_0x2feb72,null))[_0x2e42('0x51')](handleError(_0x2feb72,null));};exports[_0x2e42('0xb2')]=function(_0x3feafd,_0x180f30,_0x5af866){return db['VoiceQueue'][_0x2e42('0x36')]({'where':{'id':_0x3feafd[_0x2e42('0x53')]['id']}})[_0x2e42('0x2c')](handleEntityNotFound(_0x180f30,null))['then'](function(_0x468da2){if(_0x468da2){return _0x468da2['removeLists'](_0x3feafd[_0x2e42('0x43')][_0x2e42('0x85')]);}})[_0x2e42('0x2c')](function(_0x99d7fd){if(_0x99d7fd){return db[_0x2e42('0x67')][_0x2e42('0x2d')]({'where':{'ListId':_0x3feafd['query'][_0x2e42('0x85')],'VoiceQueueId':_0x3feafd[_0x2e42('0x53')]['id']}})['then'](function(){return _0x99d7fd;});}})[_0x2e42('0x2c')](respondWithStatusCode(_0x180f30,null))[_0x2e42('0x51')](handleError(_0x180f30,null));};exports[_0x2e42('0xb3')]=function(_0x90ebb6,_0xd5b626,_0x5082ee){var _0x1b43b4={};var _0x5dddd2={};var _0x31f0d1;var _0x3b5961;return db['VoiceQueue'][_0x2e42('0x66')]({'where':{'id':_0x90ebb6['params']['id']}})['then'](handleEntityNotFound(_0xd5b626,null))[_0x2e42('0x2c')](function(_0x5ce56d){if(_0x5ce56d){_0x31f0d1=_0x5ce56d;_0x5dddd2[_0x2e42('0x3e')]=_['keys'](db['CmList'][_0x2e42('0x54')]);_0x5dddd2['query']=_['keys'](_0x90ebb6[_0x2e42('0x43')]);_0x5dddd2[_0x2e42('0x40')]=_[_0x2e42('0x41')](_0x5dddd2[_0x2e42('0x3e')],_0x5dddd2[_0x2e42('0x43')]);_0x1b43b4[_0x2e42('0x42')]=_[_0x2e42('0x41')](_0x5dddd2[_0x2e42('0x3e')],qs[_0x2e42('0x44')](_0x90ebb6[_0x2e42('0x43')][_0x2e42('0x44')]));_0x1b43b4[_0x2e42('0x42')]=_0x1b43b4[_0x2e42('0x42')]['length']?_0x1b43b4[_0x2e42('0x42')]:_0x5dddd2[_0x2e42('0x3e')];_0x1b43b4[_0x2e42('0x46')]=qs[_0x2e42('0x47')](_0x90ebb6[_0x2e42('0x43')][_0x2e42('0x47')]);_0x1b43b4[_0x2e42('0x48')]=qs[_0x2e42('0x40')](_[_0x2e42('0x49')](_0x90ebb6[_0x2e42('0x43')],_0x5dddd2[_0x2e42('0x40')]));if(_0x90ebb6[_0x2e42('0x43')]['filter']){_0x1b43b4[_0x2e42('0x48')]=_[_0x2e42('0x4a')](_0x1b43b4[_0x2e42('0x48')],{'$or':_[_0x2e42('0x32')](_0x1b43b4['attributes'],function(_0x443cfc){var _0x1d5a94={};_0x1d5a94[_0x443cfc]={'$like':'%'+_0x90ebb6[_0x2e42('0x43')][_0x2e42('0x30')]+'%'};return _0x1d5a94;})});}_0x1b43b4=_[_0x2e42('0x4a')]({},_0x1b43b4,_0x90ebb6['options']);return _0x31f0d1[_0x2e42('0xb3')](_0x1b43b4);}})[_0x2e42('0x2c')](function(_0x140252){if(_0x140252){_0x3b5961=_0x140252[_0x2e42('0x55')];if(!_0x90ebb6[_0x2e42('0x43')]['hasOwnProperty']('nolimit')){_0x1b43b4['limit']=qs['limit'](_0x90ebb6[_0x2e42('0x43')][_0x2e42('0x23')]);_0x1b43b4[_0x2e42('0x25')]=qs[_0x2e42('0x25')](_0x90ebb6[_0x2e42('0x43')]['offset']);}return _0x31f0d1[_0x2e42('0xb3')](_0x1b43b4);}})[_0x2e42('0x2c')](function(_0x1811bf){if(_0x1811bf){return _0x1811bf?{'count':_0x3b5961,'rows':_0x1811bf}:null;}})[_0x2e42('0x2c')](respondWithResult(_0xd5b626,null))['catch'](handleError(_0xd5b626,null));};exports['addBlackLists']=function(_0x33f6f3,_0x5343c6,_0x23db23){var _0x315cc8,_0x1fdbb5;return db[_0x2e42('0x4c')][_0x2e42('0x36')]({'where':{'id':_0x33f6f3[_0x2e42('0x53')]['id']}})[_0x2e42('0x2c')](handleEntityNotFound(_0x5343c6,null))[_0x2e42('0x2c')](function(_0x142c1d){if(_0x142c1d){_0x1fdbb5=_0x142c1d;return _0x142c1d[_0x2e42('0xb4')](_0x33f6f3[_0x2e42('0x57')]['ids'],_[_0x2e42('0x5f')](_0x33f6f3[_0x2e42('0x57')],[_0x2e42('0x85'),'id'])||{});}return null;})['spread'](function(_0x433ff3){var _0x3c7d90;_0x315cc8=_0x433ff3||[];var _0x559d5c=[];if(_0x433ff3){for(var _0x8698f3=0x0;_0x8698f3<_0x433ff3[_0x2e42('0x55')];_0x8698f3+=0x1){var _0x4974cf=_0x433ff3[_0x8698f3][_0x2e42('0x2e')]({'plain':!![]});_0x3c7d90=squel['insert']()[_0x2e42('0xb1')](_0x2e42('0xb5'))['fromQuery']([_0x2e42('0xa1'),_0x2e42('0xa3'),_0x2e42('0xa4'),_0x2e42('0x68'),_0x2e42('0x60'),_0x2e42('0x61')],squel[_0x2e42('0x86')]()[_0x2e42('0x87')](_0x2e42('0xa1'),'phone')[_0x2e42('0x87')]('id',_0x2e42('0xa3'))[_0x2e42('0x87')](_0x4974cf[_0x2e42('0xaa')][_0x2e42('0x8f')](),'ListId')[_0x2e42('0x87')](_0x33f6f3[_0x2e42('0x53')]['id'][_0x2e42('0x8f')](),_0x2e42('0x68'))[_0x2e42('0x87')]('NOW()','createdAt')['field'](_0x2e42('0xa5'),_0x2e42('0x61'))[_0x2e42('0xa6')](_0x2e42('0xa7'))[_0x2e42('0x48')](_0x2e42('0xa8'))[_0x2e42('0x48')](_0x2e42('0xa9'),_0x4974cf['CmListId']['toString']())[_0x2e42('0x48')](_0x2e42('0xb0')))[_0x2e42('0x8f')]();_0x559d5c[_0x2e42('0x8e')](db['sequelize']['query'](_0x3c7d90));}return BPromise[_0x2e42('0x97')](_0x559d5c);}})[_0x2e42('0x2c')](function(){return _0x315cc8;})[_0x2e42('0x2c')](respondWithResult(_0x5343c6,null))['catch'](handleError(_0x5343c6,null));};exports[_0x2e42('0xb6')]=function(_0x2cc9f6,_0xebcba,_0x5696d0){return db[_0x2e42('0x4c')][_0x2e42('0x36')]({'where':{'id':_0x2cc9f6[_0x2e42('0x53')]['id']}})[_0x2e42('0x2c')](handleEntityNotFound(_0xebcba,null))['then'](function(_0x31e290){if(_0x31e290){return _0x31e290[_0x2e42('0xb6')](_0x2cc9f6['query'][_0x2e42('0x85')]);}})[_0x2e42('0x2c')](function(_0x469e8f){if(_0x469e8f){return db['CmHopperBlack'][_0x2e42('0x2d')]({'where':{'ListId':_0x2cc9f6['query'][_0x2e42('0x85')],'VoiceQueueId':_0x2cc9f6[_0x2e42('0x53')]['id']}})[_0x2e42('0x2c')](function(){return _0x469e8f;});}})[_0x2e42('0x2c')](respondWithStatusCode(_0xebcba,null))[_0x2e42('0x51')](handleError(_0xebcba,null));}; \ No newline at end of file +var _0x8ab9=['CmHopper','CmHopperHistory','order','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','User','Agents','online','voicePause','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','interface','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','all','union','compact','isEmpty','removeAgents','addAgents','spread','isArray','userVoiceQueue:remove','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','CmListId','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','insert','ListId','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','name','UserProfileResource','end','error','send','index','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','VoiceQueue','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','omit','updatedAt','autoAssociation','getHoppers','findOne','VoiceQueueId'];(function(_0x5b4287,_0x34af8a){var _0x139806=function(_0x50249c){while(--_0x50249c){_0x5b4287['push'](_0x5b4287['shift']());}};_0x139806(++_0x34af8a);}(_0x8ab9,0xfa));var _0x98ab=function(_0x104119,_0x2e9f28){_0x104119=_0x104119-0x0;var _0x901609=_0x8ab9[_0x104119];return _0x901609;};'use strict';var emlformat=require(_0x98ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x98ab('0x1'));var jsonpatch=require(_0x98ab('0x2'));var rp=require('request-promise');var moment=require(_0x98ab('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x98ab('0x4'));var csv=require(_0x98ab('0x5'));var ejs=require(_0x98ab('0x6'));var fs=require('fs');var fs_extra=require(_0x98ab('0x7'));var _=require(_0x98ab('0x8'));var squel=require(_0x98ab('0x9'));var crypto=require(_0x98ab('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x98ab('0xb'));var toCsv=require(_0x98ab('0x5'));var querystring=require('querystring');var Papa=require(_0x98ab('0xc'));var Redis=require(_0x98ab('0xd'));var authService=require(_0x98ab('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98ab('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x98ab('0x10'));var config=require(_0x98ab('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x98ab('0x12'))['db'];config[_0x98ab('0x13')]=_[_0x98ab('0x14')](config[_0x98ab('0x13')],{'host':_0x98ab('0x15'),'port':0x18eb});var socket=require(_0x98ab('0x16'))(new Redis(config[_0x98ab('0x13')]));require(_0x98ab('0x17'))['register'](socket);function respondWithStatusCode(_0x509a2d,_0x58c81f){_0x58c81f=_0x58c81f||0xcc;return function(_0x244697){if(_0x244697){return _0x509a2d[_0x98ab('0x18')](_0x58c81f);}return _0x509a2d[_0x98ab('0x19')](_0x58c81f)['end']();};}function respondWithResult(_0x4a5116,_0xc00f76){_0xc00f76=_0xc00f76||0xc8;return function(_0x524946){if(_0x524946){return _0x4a5116['status'](_0xc00f76)[_0x98ab('0x1a')](_0x524946);}};}function respondWithFilteredResult(_0x2c1574,_0x21fc5b){return function(_0x202f97){if(_0x202f97){var _0x1bce5d=typeof _0x21fc5b[_0x98ab('0x1b')]==='undefined'&&typeof _0x21fc5b[_0x98ab('0x1c')]==='undefined';var _0x26a419=_0x202f97[_0x98ab('0x1d')];var _0x49a34c=_0x1bce5d?0x0:_0x21fc5b[_0x98ab('0x1b')];var _0x187a71=_0x1bce5d?_0x202f97[_0x98ab('0x1d')]:_0x21fc5b[_0x98ab('0x1b')]+_0x21fc5b[_0x98ab('0x1c')];var _0x63a684;if(_0x187a71>=_0x26a419){_0x187a71=_0x26a419;_0x63a684=0xc8;}else{_0x63a684=0xce;}_0x2c1574[_0x98ab('0x19')](_0x63a684);return _0x2c1574[_0x98ab('0x1e')](_0x98ab('0x1f'),_0x49a34c+'-'+_0x187a71+'/'+_0x26a419)[_0x98ab('0x1a')](_0x202f97);}return null;};}function patchUpdates(_0x5dc8c5){return function(_0x3152e3){try{jsonpatch[_0x98ab('0x20')](_0x3152e3,_0x5dc8c5,!![]);}catch(_0x53445f){return BPromise['reject'](_0x53445f);}return _0x3152e3[_0x98ab('0x21')]();};}function saveUpdates(_0x502506,_0x230009){return function(_0x124d3b){if(_0x124d3b){return _0x124d3b[_0x98ab('0x22')](_0x502506)[_0x98ab('0x23')](function(_0xef3169){return _0xef3169;});}return null;};}function removeEntity(_0x2faa18,_0x6de10f){return function(_0x51046f){if(_0x51046f){return _0x51046f[_0x98ab('0x24')]()['then'](function(){var _0x540634=_0x51046f[_0x98ab('0x25')]({'plain':!![]});var _0x3ef702=[{'name':_0x98ab('0x26'),'value':_0x98ab('0x27'),'ignore':![]},{'name':_0x98ab('0x28'),'value':_0x98ab('0x29'),'ignore':![]}];var _0x21326d=_(_0x3ef702)[_0x98ab('0x2a')](_0x98ab('0x2b'))[_0x98ab('0x2c')]('value')[_0x98ab('0x2d')]();if(_[_0x98ab('0x2e')](_0x21326d,_0x540634[_0x98ab('0x2f')])){return;}var _0x22db87=_['find'](_0x3ef702,[_0x98ab('0x2d'),_0x540634[_0x98ab('0x2f')]])[_0x98ab('0x30')];return db[_0x98ab('0x31')][_0x98ab('0x24')]({'where':{'type':_0x22db87,'resourceId':_0x540634['id']}})[_0x98ab('0x23')](function(){return _0x51046f;});})[_0x98ab('0x23')](function(){_0x2faa18[_0x98ab('0x19')](0xcc)[_0x98ab('0x32')]();});}};}function handleEntityNotFound(_0x5c586e,_0x2c186f){return function(_0x4a3daf){if(!_0x4a3daf){_0x5c586e[_0x98ab('0x18')](0x194);}return _0x4a3daf;};}function handleError(_0x73b0a6,_0x108b34){_0x108b34=_0x108b34||0x1f4;return function(_0x549c47){logger[_0x98ab('0x33')](_0x549c47['stack']);if(_0x549c47[_0x98ab('0x30')]){delete _0x549c47[_0x98ab('0x30')];}_0x73b0a6[_0x98ab('0x19')](_0x108b34)[_0x98ab('0x34')](_0x549c47);};}exports[_0x98ab('0x35')]=function(_0x1a3665,_0x211199){var _0x461340={},_0x32e6e2={},_0x1fcfdd={'count':0x0,'rows':[]};var _0x31aa46=_[_0x98ab('0x2c')](db['VoiceQueue']['rawAttributes'],function(_0x329c4e){return{'name':_0x329c4e['fieldName'],'type':_0x329c4e[_0x98ab('0x2f')][_0x98ab('0x36')]};});_0x32e6e2['model']=_[_0x98ab('0x2c')](_0x31aa46,_0x98ab('0x30'));_0x32e6e2[_0x98ab('0x37')]=_['keys'](_0x1a3665[_0x98ab('0x37')]);_0x32e6e2[_0x98ab('0x38')]=_[_0x98ab('0x39')](_0x32e6e2[_0x98ab('0x3a')],_0x32e6e2[_0x98ab('0x37')]);_0x461340['attributes']=_[_0x98ab('0x39')](_0x32e6e2[_0x98ab('0x3a')],qs[_0x98ab('0x3b')](_0x1a3665['query'][_0x98ab('0x3b')]));_0x461340['attributes']=_0x461340[_0x98ab('0x3c')][_0x98ab('0x3d')]?_0x461340['attributes']:_0x32e6e2[_0x98ab('0x3a')];if(!_0x1a3665['query'][_0x98ab('0x3e')](_0x98ab('0x3f'))){_0x461340[_0x98ab('0x1c')]=qs[_0x98ab('0x1c')](_0x1a3665['query'][_0x98ab('0x1c')]);_0x461340['offset']=qs['offset'](_0x1a3665[_0x98ab('0x37')]['offset']);}_0x461340['order']=qs[_0x98ab('0x40')](_0x1a3665[_0x98ab('0x37')][_0x98ab('0x40')]);_0x461340[_0x98ab('0x41')]=qs[_0x98ab('0x38')](_[_0x98ab('0x42')](_0x1a3665[_0x98ab('0x37')],_0x32e6e2[_0x98ab('0x38')]),_0x31aa46);if(_0x1a3665[_0x98ab('0x37')][_0x98ab('0x2a')]){_0x461340[_0x98ab('0x41')]=_[_0x98ab('0x43')](_0x461340[_0x98ab('0x41')],{'$or':_['map'](_0x31aa46,function(_0x31da26){if(_0x31da26[_0x98ab('0x2f')]!==_0x98ab('0x44')){var _0x2bb022={};_0x2bb022[_0x31da26[_0x98ab('0x30')]]={'$like':'%'+_0x1a3665[_0x98ab('0x37')][_0x98ab('0x2a')]+'%'};return _0x2bb022;}})});}_0x461340=_[_0x98ab('0x43')]({},_0x461340,_0x1a3665[_0x98ab('0x45')]);var _0x40a393={'where':_0x461340[_0x98ab('0x41')]};return db[_0x98ab('0x46')][_0x98ab('0x1d')](_0x40a393)[_0x98ab('0x23')](function(_0x1b136a){_0x1fcfdd[_0x98ab('0x1d')]=_0x1b136a;if(_0x1a3665[_0x98ab('0x37')][_0x98ab('0x47')]){_0x461340[_0x98ab('0x48')]=[{'all':!![]}];}return db[_0x98ab('0x46')][_0x98ab('0x49')](_0x461340);})[_0x98ab('0x23')](function(_0x1c6e92){_0x1fcfdd[_0x98ab('0x4a')]=_0x1c6e92;return _0x1fcfdd;})['then'](respondWithFilteredResult(_0x211199,_0x461340))[_0x98ab('0x4b')](handleError(_0x211199,null));};exports['show']=function(_0x4f170a,_0x139667){var _0x5dccff={'raw':![],'where':{'id':_0x4f170a[_0x98ab('0x4c')]['id']}},_0x303d42={};_0x303d42[_0x98ab('0x3a')]=_[_0x98ab('0x4d')](db[_0x98ab('0x46')][_0x98ab('0x4e')]);_0x303d42['query']=_[_0x98ab('0x4d')](_0x4f170a[_0x98ab('0x37')]);_0x303d42['filters']=_[_0x98ab('0x39')](_0x303d42[_0x98ab('0x3a')],_0x303d42[_0x98ab('0x37')]);_0x5dccff['attributes']=_[_0x98ab('0x39')](_0x303d42[_0x98ab('0x3a')],qs[_0x98ab('0x3b')](_0x4f170a[_0x98ab('0x37')][_0x98ab('0x3b')]));_0x5dccff[_0x98ab('0x3c')]=_0x5dccff['attributes'][_0x98ab('0x3d')]?_0x5dccff['attributes']:_0x303d42['model'];if(_0x4f170a[_0x98ab('0x37')]['includeAll']){_0x5dccff[_0x98ab('0x48')]=[{'all':!![]}];}_0x5dccff=_[_0x98ab('0x43')]({},_0x5dccff,_0x4f170a[_0x98ab('0x45')]);return db[_0x98ab('0x46')][_0x98ab('0x4f')](_0x5dccff)[_0x98ab('0x23')](handleEntityNotFound(_0x139667,null))[_0x98ab('0x23')](respondWithResult(_0x139667,null))[_0x98ab('0x4b')](handleError(_0x139667,null));};exports[_0x98ab('0x50')]=function(_0x3d3c31,_0x3516d6){return db[_0x98ab('0x46')][_0x98ab('0x50')](_0x3d3c31[_0x98ab('0x51')],{})[_0x98ab('0x23')](function(_0x1f0b05){var _0x1ed4ef=_0x3d3c31[_0x98ab('0x52')][_0x98ab('0x25')]({'plain':!![]});if(!_0x1ed4ef)throw new Error(_0x98ab('0x53'));if(_0x1ed4ef[_0x98ab('0x54')]===_0x98ab('0x52')){var _0x330b7d=_0x1f0b05[_0x98ab('0x25')]({'plain':!![]});var _0x1042c2=[{'name':_0x98ab('0x26'),'value':_0x98ab('0x27')},{'name':_0x98ab('0x28'),'value':'outbound'}];var _0x4703ae=_[_0x98ab('0x4f')](_0x1042c2,[_0x98ab('0x2d'),_0x330b7d[_0x98ab('0x2f')]])[_0x98ab('0x30')];return db[_0x98ab('0x55')][_0x98ab('0x4f')]({'where':{'name':_0x4703ae,'userProfileId':_0x1ed4ef[_0x98ab('0x56')]},'raw':!![]})['then'](function(_0x4db53b){if(_0x4db53b&&_0x4db53b['autoAssociation']===0x0){return db['UserProfileResource'][_0x98ab('0x50')]({'name':_0x330b7d[_0x98ab('0x30')],'resourceId':_0x330b7d['id'],'type':_0x4db53b[_0x98ab('0x30')],'sectionId':_0x4db53b['id']},{})[_0x98ab('0x23')](function(){return _0x1f0b05;});}else{return _0x1f0b05;}})['catch'](function(_0x5b1128){logger[_0x98ab('0x33')](_0x98ab('0x57'),_0x5b1128);throw _0x5b1128;});}return _0x1f0b05;})['then'](respondWithResult(_0x3516d6,0xc9))['catch'](handleError(_0x3516d6,null));};exports[_0x98ab('0x58')]=function(_0x2d2416,_0x478aa8){var _0x3dbde7={'where':{'id':_0x2d2416[_0x98ab('0x4c')]['id']}},_0x412436={};_0x412436['model']=_['keys'](db[_0x98ab('0x46')][_0x98ab('0x4e')]);_0x3dbde7['attributes']=_['intersection'](_0x412436[_0x98ab('0x3a')],qs[_0x98ab('0x3b')](_0x2d2416['query'][_0x98ab('0x3b')]));_0x3dbde7[_0x98ab('0x3c')]=_0x3dbde7[_0x98ab('0x3c')][_0x98ab('0x3d')]?_0x3dbde7['attributes']:_0x412436[_0x98ab('0x3a')];if(_0x2d2416['query'][_0x98ab('0x47')]){_0x3dbde7[_0x98ab('0x48')]=[{'all':!![]}];}_0x3dbde7=_[_0x98ab('0x43')]({},_0x3dbde7,_0x2d2416[_0x98ab('0x45')]);return db[_0x98ab('0x46')][_0x98ab('0x4f')](_0x3dbde7)['then'](handleEntityNotFound(_0x478aa8,null))[_0x98ab('0x23')](function(_0x5d05b2){if(_0x5d05b2){var _0x15929d=_0x5d05b2['get']({'plain':!![]});_0x15929d=qs['omit'](_0x15929d,['id',_0x98ab('0x59'),'updatedAt']);_0x2d2416[_0x98ab('0x51')]=_[_0x98ab('0x5a')](_0x2d2416[_0x98ab('0x51')],['id',_0x98ab('0x59'),_0x98ab('0x5b')]);return db[_0x98ab('0x46')]['create'](_['merge'](_0x15929d,_0x2d2416['body']),{'include':_0x2d2416[_0x98ab('0x37')][_0x98ab('0x47')]?[{'all':!![]}]:undefined})[_0x98ab('0x23')](function(_0x289343){var _0x1aee63=_0x2d2416['user'][_0x98ab('0x25')]({'plain':!![]});if(!_0x1aee63)throw new Error(_0x98ab('0x53'));if(_0x1aee63['role']===_0x98ab('0x52')){var _0x346b07=_0x289343[_0x98ab('0x25')]({'plain':!![]});var _0x30892d=[{'name':'VoiceQueues','value':_0x98ab('0x27')},{'name':_0x98ab('0x28'),'value':_0x98ab('0x29')}];var _0x22e2bd=_[_0x98ab('0x4f')](_0x30892d,['value',_0x346b07[_0x98ab('0x2f')]])[_0x98ab('0x30')];return db[_0x98ab('0x55')]['find']({'where':{'name':_0x22e2bd,'userProfileId':_0x1aee63[_0x98ab('0x56')]},'raw':!![]})['then'](function(_0x51de83){if(_0x51de83&&_0x51de83[_0x98ab('0x5c')]===0x0){return db[_0x98ab('0x31')]['create']({'name':_0x346b07[_0x98ab('0x30')],'resourceId':_0x346b07['id'],'type':_0x51de83[_0x98ab('0x30')],'sectionId':_0x51de83['id']},{})[_0x98ab('0x23')](function(){return _0x289343;});}else{return _0x289343;}})[_0x98ab('0x4b')](function(_0x134002){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x134002);throw _0x134002;});}return _0x289343;});}})[_0x98ab('0x23')](respondWithResult(_0x478aa8,0xc9))[_0x98ab('0x4b')](handleError(_0x478aa8,null));};exports[_0x98ab('0x22')]=function(_0x3ba7c6,_0x2eaeb0){if(_0x3ba7c6[_0x98ab('0x51')]['id']){delete _0x3ba7c6[_0x98ab('0x51')]['id'];}return db[_0x98ab('0x46')]['find']({'where':{'id':_0x3ba7c6[_0x98ab('0x4c')]['id']}})[_0x98ab('0x23')](handleEntityNotFound(_0x2eaeb0,null))[_0x98ab('0x23')](saveUpdates(_0x3ba7c6['body'],null))[_0x98ab('0x23')](respondWithResult(_0x2eaeb0,null))[_0x98ab('0x4b')](handleError(_0x2eaeb0,null));};exports[_0x98ab('0x24')]=function(_0x1f7b98,_0x386b5e){return db[_0x98ab('0x46')][_0x98ab('0x4f')]({'where':{'id':_0x1f7b98['params']['id']}})[_0x98ab('0x23')](handleEntityNotFound(_0x386b5e,null))[_0x98ab('0x23')](removeEntity(_0x386b5e,null))[_0x98ab('0x4b')](handleError(_0x386b5e,null));};exports[_0x98ab('0x5d')]=function(_0x5cc90b,_0x1f3f35,_0x265a83){var _0xa85ad7={'raw':![],'where':{}};var _0x173856={};var _0x34c72b={'count':0x0,'rows':[]};return db[_0x98ab('0x46')][_0x98ab('0x5e')]({'where':{'id':_0x5cc90b['params']['id']}})['then'](handleEntityNotFound(_0x1f3f35,null))[_0x98ab('0x23')](function(_0x520258){if(_0x520258){_0x173856[_0x98ab('0x3a')]=_[_0x98ab('0x4d')](db['CmHopper'][_0x98ab('0x4e')]);_0x173856[_0x98ab('0x37')]=_[_0x98ab('0x4d')](_0x5cc90b[_0x98ab('0x37')]);_0x173856['filters']=_[_0x98ab('0x39')](_0x173856['model'],_0x173856['query']);_0xa85ad7[_0x98ab('0x3c')]=_[_0x98ab('0x39')](_0x173856['model'],qs['fields'](_0x5cc90b['query'][_0x98ab('0x3b')]));_0xa85ad7[_0x98ab('0x3c')]=_0xa85ad7[_0x98ab('0x3c')]['length']?_0xa85ad7[_0x98ab('0x3c')]:_0x173856['model'];if(!_0x5cc90b[_0x98ab('0x37')][_0x98ab('0x3e')](_0x98ab('0x3f'))){_0xa85ad7[_0x98ab('0x1c')]=qs[_0x98ab('0x1c')](_0x5cc90b[_0x98ab('0x37')][_0x98ab('0x1c')]);_0xa85ad7[_0x98ab('0x1b')]=qs[_0x98ab('0x1b')](_0x5cc90b[_0x98ab('0x37')][_0x98ab('0x1b')]);}_0xa85ad7['order']=qs[_0x98ab('0x40')](_0x5cc90b[_0x98ab('0x37')][_0x98ab('0x40')]);_0xa85ad7[_0x98ab('0x41')]=qs['filters'](_[_0x98ab('0x42')](_0x5cc90b['query'],_0x173856['filters']));_0xa85ad7[_0x98ab('0x41')][_0x98ab('0x5f')]=_0x520258['id'];if(_0x5cc90b[_0x98ab('0x37')][_0x98ab('0x2a')]){_0xa85ad7[_0x98ab('0x41')]=_[_0x98ab('0x43')](_0xa85ad7['where'],{'$or':_[_0x98ab('0x2c')](_0xa85ad7['attributes'],function(_0x5bf7ad){var _0x416e3e={};_0x416e3e[_0x5bf7ad]={'$like':'%'+_0x5cc90b[_0x98ab('0x37')][_0x98ab('0x2a')]+'%'};return _0x416e3e;})});}_0xa85ad7=_[_0x98ab('0x43')]({},_0xa85ad7,_0x5cc90b['options']);return db['CmHopper'][_0x98ab('0x1d')]({'where':_0xa85ad7[_0x98ab('0x41')]})[_0x98ab('0x23')](function(_0x1b2e7e){_0x34c72b[_0x98ab('0x1d')]=_0x1b2e7e;if(_0x5cc90b[_0x98ab('0x37')]['includeAll']){_0xa85ad7[_0x98ab('0x48')]=[{'all':!![]}];}return db[_0x98ab('0x60')]['findAll'](_0xa85ad7);})[_0x98ab('0x23')](function(_0xe575d0){_0x34c72b['rows']=_0xe575d0;return _0x34c72b;});}})['then'](respondWithFilteredResult(_0x1f3f35,_0xa85ad7))['catch'](handleError(_0x1f3f35,null));};exports['getHopperHistories']=function(_0x37075e,_0x547584,_0x5319d4){var _0x3f86b8={'raw':!![],'where':{}};var _0x162773={};var _0x1a712b={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x98ab('0x5e')]({'where':{'id':_0x37075e[_0x98ab('0x4c')]['id']}})[_0x98ab('0x23')](handleEntityNotFound(_0x547584,null))[_0x98ab('0x23')](function(_0x34dc7b){if(_0x34dc7b){_0x162773[_0x98ab('0x3a')]=_['keys'](db[_0x98ab('0x61')][_0x98ab('0x4e')]);_0x162773[_0x98ab('0x37')]=_[_0x98ab('0x4d')](_0x37075e['query']);_0x162773['filters']=_['intersection'](_0x162773[_0x98ab('0x3a')],_0x162773['query']);_0x3f86b8[_0x98ab('0x3c')]=_['intersection'](_0x162773['model'],qs[_0x98ab('0x3b')](_0x37075e[_0x98ab('0x37')][_0x98ab('0x3b')]));_0x3f86b8[_0x98ab('0x3c')]=_0x3f86b8[_0x98ab('0x3c')][_0x98ab('0x3d')]?_0x3f86b8['attributes']:_0x162773['model'];if(!_0x37075e[_0x98ab('0x37')][_0x98ab('0x3e')]('nolimit')){_0x3f86b8[_0x98ab('0x1c')]=qs['limit'](_0x37075e[_0x98ab('0x37')][_0x98ab('0x1c')]);_0x3f86b8[_0x98ab('0x1b')]=qs[_0x98ab('0x1b')](_0x37075e[_0x98ab('0x37')]['offset']);}_0x3f86b8[_0x98ab('0x62')]=qs[_0x98ab('0x40')](_0x37075e[_0x98ab('0x37')][_0x98ab('0x40')]);_0x3f86b8[_0x98ab('0x41')]=qs[_0x98ab('0x38')](_[_0x98ab('0x42')](_0x37075e[_0x98ab('0x37')],_0x162773[_0x98ab('0x38')]));_0x3f86b8[_0x98ab('0x41')][_0x98ab('0x5f')]=_0x34dc7b['id'];if(_0x37075e[_0x98ab('0x37')][_0x98ab('0x2a')]){_0x3f86b8[_0x98ab('0x41')]=_[_0x98ab('0x43')](_0x3f86b8[_0x98ab('0x41')],{'$or':_[_0x98ab('0x2c')](_0x3f86b8[_0x98ab('0x3c')],function(_0x18ce77){var _0x2721b7={};_0x2721b7[_0x18ce77]={'$like':'%'+_0x37075e['query'][_0x98ab('0x2a')]+'%'};return _0x2721b7;})});}_0x3f86b8=_['merge']({},_0x3f86b8,_0x37075e[_0x98ab('0x45')]);return db['CmHopperHistory'][_0x98ab('0x1d')]({'where':_0x3f86b8[_0x98ab('0x41')]})[_0x98ab('0x23')](function(_0x5807a4){_0x1a712b[_0x98ab('0x1d')]=_0x5807a4;if(_0x37075e[_0x98ab('0x37')]['includeAll']){_0x3f86b8[_0x98ab('0x48')]=[{'all':!![]}];}return db[_0x98ab('0x61')]['findAll'](_0x3f86b8);})['then'](function(_0x57802e){_0x1a712b['rows']=_0x57802e;return _0x1a712b;});}})['then'](respondWithFilteredResult(_0x547584,_0x3f86b8))[_0x98ab('0x4b')](handleError(_0x547584,null));};exports['getHopperFinals']=function(_0x29df5e,_0x501861,_0x2a4e93){var _0x2ae843={'raw':!![],'where':{}};var _0x175f7f={};var _0x5263c3={'count':0x0,'rows':[]};return db[_0x98ab('0x46')][_0x98ab('0x5e')]({'where':{'id':_0x29df5e[_0x98ab('0x4c')]['id']}})[_0x98ab('0x23')](handleEntityNotFound(_0x501861,null))[_0x98ab('0x23')](function(_0x41e5de){if(_0x41e5de){_0x175f7f[_0x98ab('0x3a')]=_['keys'](db[_0x98ab('0x63')][_0x98ab('0x4e')]);_0x175f7f[_0x98ab('0x37')]=_[_0x98ab('0x4d')](_0x29df5e[_0x98ab('0x37')]);_0x175f7f[_0x98ab('0x38')]=_[_0x98ab('0x39')](_0x175f7f[_0x98ab('0x3a')],_0x175f7f[_0x98ab('0x37')]);_0x2ae843[_0x98ab('0x3c')]=_[_0x98ab('0x39')](_0x175f7f[_0x98ab('0x3a')],qs[_0x98ab('0x3b')](_0x29df5e['query']['fields']));_0x2ae843['attributes']=_0x2ae843[_0x98ab('0x3c')][_0x98ab('0x3d')]?_0x2ae843['attributes']:_0x175f7f[_0x98ab('0x3a')];if(!_0x29df5e[_0x98ab('0x37')][_0x98ab('0x3e')](_0x98ab('0x3f'))){_0x2ae843['limit']=qs[_0x98ab('0x1c')](_0x29df5e[_0x98ab('0x37')][_0x98ab('0x1c')]);_0x2ae843[_0x98ab('0x1b')]=qs[_0x98ab('0x1b')](_0x29df5e[_0x98ab('0x37')][_0x98ab('0x1b')]);}_0x2ae843['order']=qs['sort'](_0x29df5e['query']['sort']);_0x2ae843['where']=qs[_0x98ab('0x38')](_['pick'](_0x29df5e['query'],_0x175f7f[_0x98ab('0x38')]));_0x2ae843[_0x98ab('0x41')][_0x98ab('0x5f')]=_0x41e5de['id'];if(_0x29df5e[_0x98ab('0x37')][_0x98ab('0x2a')]){_0x2ae843[_0x98ab('0x41')]=_[_0x98ab('0x43')](_0x2ae843['where'],{'$or':_[_0x98ab('0x2c')](_0x2ae843[_0x98ab('0x3c')],function(_0x5dd3d3){var _0x49fa02={};_0x49fa02[_0x5dd3d3]={'$like':'%'+_0x29df5e['query'][_0x98ab('0x2a')]+'%'};return _0x49fa02;})});}_0x2ae843=_['merge']({},_0x2ae843,_0x29df5e[_0x98ab('0x45')]);return db[_0x98ab('0x63')][_0x98ab('0x1d')]({'where':_0x2ae843['where']})[_0x98ab('0x23')](function(_0x31829c){_0x5263c3[_0x98ab('0x1d')]=_0x31829c;if(_0x29df5e[_0x98ab('0x37')][_0x98ab('0x47')]){_0x2ae843[_0x98ab('0x48')]=[{'all':!![]}];}return db[_0x98ab('0x63')]['findAll'](_0x2ae843);})[_0x98ab('0x23')](function(_0x52f7a8){_0x5263c3[_0x98ab('0x4a')]=_0x52f7a8;return _0x5263c3;});}})['then'](respondWithFilteredResult(_0x501861,_0x2ae843))[_0x98ab('0x4b')](handleError(_0x501861,null));};exports[_0x98ab('0x64')]=function(_0x5dc211,_0x58b453,_0x5cfcad){var _0x2ecdf8={'raw':!![],'where':{}};var _0x303637={};var _0x40d52e={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x98ab('0x5e')]({'where':{'id':_0x5dc211['params']['id']}})['then'](handleEntityNotFound(_0x58b453,null))[_0x98ab('0x23')](function(_0x5490a3){if(_0x5490a3){_0x303637[_0x98ab('0x3a')]=_[_0x98ab('0x4d')](db['CmHopperBlack'][_0x98ab('0x4e')]);_0x303637['query']=_[_0x98ab('0x4d')](_0x5dc211[_0x98ab('0x37')]);_0x303637['filters']=_['intersection'](_0x303637[_0x98ab('0x3a')],_0x303637[_0x98ab('0x37')]);_0x2ecdf8[_0x98ab('0x3c')]=_[_0x98ab('0x39')](_0x303637[_0x98ab('0x3a')],qs[_0x98ab('0x3b')](_0x5dc211[_0x98ab('0x37')]['fields']));_0x2ecdf8['attributes']=_0x2ecdf8[_0x98ab('0x3c')][_0x98ab('0x3d')]?_0x2ecdf8['attributes']:_0x303637[_0x98ab('0x3a')];if(!_0x5dc211[_0x98ab('0x37')]['hasOwnProperty']('nolimit')){_0x2ecdf8[_0x98ab('0x1c')]=qs[_0x98ab('0x1c')](_0x5dc211[_0x98ab('0x37')][_0x98ab('0x1c')]);_0x2ecdf8[_0x98ab('0x1b')]=qs[_0x98ab('0x1b')](_0x5dc211[_0x98ab('0x37')][_0x98ab('0x1b')]);}_0x2ecdf8[_0x98ab('0x62')]=qs[_0x98ab('0x40')](_0x5dc211[_0x98ab('0x37')][_0x98ab('0x40')]);_0x2ecdf8['where']=qs[_0x98ab('0x38')](_[_0x98ab('0x42')](_0x5dc211[_0x98ab('0x37')],_0x303637[_0x98ab('0x38')]));_0x2ecdf8[_0x98ab('0x41')][_0x98ab('0x5f')]=_0x5490a3['id'];if(_0x5dc211['query'][_0x98ab('0x2a')]){_0x2ecdf8['where']=_[_0x98ab('0x43')](_0x2ecdf8[_0x98ab('0x41')],{'$or':_[_0x98ab('0x2c')](_0x2ecdf8[_0x98ab('0x3c')],function(_0x47d8ab){var _0x57e0ae={};_0x57e0ae[_0x47d8ab]={'$like':'%'+_0x5dc211[_0x98ab('0x37')][_0x98ab('0x2a')]+'%'};return _0x57e0ae;})});}_0x2ecdf8=_[_0x98ab('0x43')]({},_0x2ecdf8,_0x5dc211[_0x98ab('0x45')]);return db['CmHopperBlack'][_0x98ab('0x1d')]({'where':_0x2ecdf8[_0x98ab('0x41')]})[_0x98ab('0x23')](function(_0x37bd0b){_0x40d52e[_0x98ab('0x1d')]=_0x37bd0b;if(_0x5dc211[_0x98ab('0x37')][_0x98ab('0x47')]){_0x2ecdf8[_0x98ab('0x48')]=[{'all':!![]}];}return db[_0x98ab('0x65')][_0x98ab('0x49')](_0x2ecdf8);})[_0x98ab('0x23')](function(_0x3900d5){_0x40d52e[_0x98ab('0x4a')]=_0x3900d5;return _0x40d52e;});}})[_0x98ab('0x23')](respondWithFilteredResult(_0x58b453,_0x2ecdf8))['catch'](handleError(_0x58b453,null));};exports[_0x98ab('0x66')]=function(_0x172604,_0x2cfe61,_0x5a962f){var _0x5f50b2={};var _0x1d3c92={};var _0x404d3f;var _0x41dcb8;return db[_0x98ab('0x46')][_0x98ab('0x5e')]({'where':{'id':_0x172604[_0x98ab('0x4c')]['id']}})[_0x98ab('0x23')](handleEntityNotFound(_0x2cfe61,null))['then'](function(_0xe631ab){if(_0xe631ab){_0x404d3f=_0xe631ab;_0x1d3c92['model']=_[_0x98ab('0x4d')](db['Team'][_0x98ab('0x4e')]);_0x1d3c92['query']=_[_0x98ab('0x4d')](_0x172604['query']);_0x1d3c92[_0x98ab('0x38')]=_[_0x98ab('0x39')](_0x1d3c92[_0x98ab('0x3a')],_0x1d3c92[_0x98ab('0x37')]);_0x5f50b2[_0x98ab('0x3c')]=_[_0x98ab('0x39')](_0x1d3c92['model'],qs[_0x98ab('0x3b')](_0x172604[_0x98ab('0x37')][_0x98ab('0x3b')]));_0x5f50b2[_0x98ab('0x3c')]=_0x5f50b2[_0x98ab('0x3c')][_0x98ab('0x3d')]?_0x5f50b2[_0x98ab('0x3c')]:_0x1d3c92[_0x98ab('0x3a')];_0x5f50b2[_0x98ab('0x62')]=qs['sort'](_0x172604[_0x98ab('0x37')][_0x98ab('0x40')]);_0x5f50b2['where']=qs['filters'](_['pick'](_0x172604[_0x98ab('0x37')],_0x1d3c92[_0x98ab('0x38')]));if(_0x172604['query'][_0x98ab('0x2a')]){_0x5f50b2[_0x98ab('0x41')]=_['merge'](_0x5f50b2[_0x98ab('0x41')],{'$or':_['map'](_0x5f50b2[_0x98ab('0x3c')],function(_0x46f8bc){var _0x1e25f6={};_0x1e25f6[_0x46f8bc]={'$like':'%'+_0x172604[_0x98ab('0x37')][_0x98ab('0x2a')]+'%'};return _0x1e25f6;})});}_0x5f50b2=_['merge']({},_0x5f50b2,_0x172604[_0x98ab('0x45')]);return _0x404d3f[_0x98ab('0x66')](_0x5f50b2);}})[_0x98ab('0x23')](function(_0x58afe5){if(_0x58afe5){_0x41dcb8=_0x58afe5['length'];if(!_0x172604['query'][_0x98ab('0x3e')](_0x98ab('0x3f'))){_0x5f50b2[_0x98ab('0x1c')]=qs['limit'](_0x172604['query'][_0x98ab('0x1c')]);_0x5f50b2['offset']=qs[_0x98ab('0x1b')](_0x172604[_0x98ab('0x37')][_0x98ab('0x1b')]);}return _0x404d3f[_0x98ab('0x66')](_0x5f50b2);}})[_0x98ab('0x23')](function(_0x4ca84b){if(_0x4ca84b){return _0x4ca84b?{'count':_0x41dcb8,'rows':_0x4ca84b}:null;}})[_0x98ab('0x23')](respondWithResult(_0x2cfe61,null))[_0x98ab('0x4b')](handleError(_0x2cfe61,null));};exports[_0x98ab('0x67')]=function(_0x2b1ef4,_0x5079ee,_0x534e21){var _0x5b251d=_0x2b1ef4[_0x98ab('0x51')][_0x98ab('0x68')];var _0x22672f=_[_0x98ab('0x2c')](_0x5b251d,'id');return db['Team'][_0x98ab('0x49')]({'where':{'id':_0x22672f},'attributes':['id'],'include':[{'model':db[_0x98ab('0x69')],'as':_0x98ab('0x6a'),'attributes':['id','name',_0x98ab('0x6b'),_0x98ab('0x6c'),'interface'],'raw':!![]}]})[_0x98ab('0x23')](function(_0x5d44a3){if(_0x5d44a3){var _0x46bc38=_['flatMap'](_0x5d44a3,function(_0x63ccde){var _0x49e6b2=_0x63ccde[_0x98ab('0x25')]({'plain':!![]});_0x49e6b2[_0x98ab('0x6a')][_0x98ab('0x6d')](function(_0x4d67e3){_0x4d67e3[_0x98ab('0x6e')]=_[_0x98ab('0x4f')](_0x5b251d,{'id':_0x49e6b2['id']})['penalty'];});return _0x49e6b2[_0x98ab('0x6a')];});return db[_0x98ab('0x46')][_0x98ab('0x4f')]({'where':{'id':_0x2b1ef4[_0x98ab('0x4c')]['id']}})[_0x98ab('0x23')](function(_0xa6ba21){return db[_0x98ab('0x6f')][_0x98ab('0x70')](function(_0x5c18a8){return _0xa6ba21['addTeams'](_0x22672f,{'transaction':_0x5c18a8})[_0x98ab('0x23')](function(){return BPromise[_0x98ab('0x71')](_0x5b251d,function(_0x22aa71){return db[_0x98ab('0x72')][_0x98ab('0x73')]({'TeamId':_0x22aa71['id'],'VoiceQueueId':_0x2b1ef4[_0x98ab('0x4c')]['id'],'penalty':_0x22aa71[_0x98ab('0x6e')]},{'transaction':_0x5c18a8});});})[_0x98ab('0x23')](function(){return BPromise[_0x98ab('0x71')](_0x46bc38,function(_0x168176){return db[_0x98ab('0x74')]['findOrCreate']({'where':{'UserId':_0x168176['id'],'VoiceQueueId':_0x2b1ef4[_0x98ab('0x4c')]['id']},'defaults':{'penalty':_0x168176['penalty']},'transaction':_0x5c18a8});});})[_0x98ab('0x23')](function(){return BPromise[_0x98ab('0x71')](_[_0x98ab('0x2a')](_0x46bc38,{'online':!![]}),function(_0x2dac07){return db[_0x98ab('0x75')]['upsert']({'membername':_0x2dac07['name'],'UserId':_0x2dac07['id'],'queue_name':_0xa6ba21[_0x98ab('0x30')],'VoiceQueueId':_0xa6ba21['id'],'interface':_['isNil'](_0x2dac07[_0x98ab('0x76')])?util[_0x98ab('0x77')](_0x98ab('0x78'),_0x2dac07['name']):_0x2dac07[_0x98ab('0x76')],'paused':_0x2dac07[_0x98ab('0x6c')]||![],'penalty':_0x2dac07[_0x98ab('0x6e')]},{'transaction':_0x5c18a8});});})['then'](function(){_0x46bc38[_0x98ab('0x6d')](function(_0x48c0c6){socket[_0x98ab('0x79')](_0x98ab('0x7a'),{'UserId':_0x48c0c6['id'],'VoiceQueueId':_0xa6ba21['id']});});});});});}})[_0x98ab('0x23')](respondWithStatusCode(_0x5079ee,null))[_0x98ab('0x4b')](handleError(_0x5079ee,null));};exports[_0x98ab('0x7b')]=function(_0x1c4ffd,_0x5d647b,_0x417275){return db['Team'][_0x98ab('0x49')]({'where':{'id':_0x1c4ffd[_0x98ab('0x37')][_0x98ab('0x7c')]},'attributes':['id'],'include':[{'model':db[_0x98ab('0x69')],'as':_0x98ab('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x98ab('0x23')](handleEntityNotFound(_0x5d647b,null))[_0x98ab('0x23')](function(_0x34248f){var _0x165a50=_[_0x98ab('0x2c')](_0x34248f,'id');var _0x36aa51=[];var _0x3f3840=[];var _0x49fe7e=squel[_0x98ab('0x7d')]();_0x49fe7e[_0x98ab('0x7e')](_0x98ab('0x7f'))[_0x98ab('0x80')]('team_has_voice_queues','tq')['join']('user_has_teams','ut',_0x98ab('0x81'))['where'](_0x98ab('0x82'),_0x1c4ffd[_0x98ab('0x4c')]['id']);for(var _0x1e5255=0x0;_0x1e5255<_0x34248f[_0x98ab('0x3d')];_0x1e5255+=0x1){let _0x3c353e=_0x34248f[_0x1e5255];for(var _0x38ea12=0x0;_0x38ea12<_0x3c353e[_0x98ab('0x6a')][_0x98ab('0x3d')];_0x38ea12+=0x1){let _0x2fa791=_0x3c353e[_0x98ab('0x6a')][_0x38ea12];var _0x4769f4=_0x49fe7e[_0x98ab('0x58')]();_0x4769f4[_0x98ab('0x41')](_0x98ab('0x83'),_0x2fa791['id']);_0x3f3840[_0x98ab('0x84')](db[_0x98ab('0x6f')][_0x98ab('0x37')](_0x4769f4[_0x98ab('0x85')](),{'type':db[_0x98ab('0x6f')][_0x98ab('0x86')]['SELECT']})[_0x98ab('0x23')](function(_0xdf1283){if(_0xdf1283[_0x98ab('0x3d')]===0x1){return _0x2fa791['id'];}else{var _0x3e536e=_[_0x98ab('0x87')](_[_0x98ab('0x2c')](_0xdf1283,_0x98ab('0x88')),function(_0x3aa65d){return _[_0x98ab('0x2e')](_0x165a50,_0x3aa65d);});if(_0x3e536e){return _0x2fa791['id'];}}}));}}return BPromise[_0x98ab('0x89')](_0x3f3840)[_0x98ab('0x23')](function(_0x24c8ea){_0x36aa51=_(_0x36aa51)[_0x98ab('0x8a')](_0x24c8ea)[_0x98ab('0x8b')]()[_0x98ab('0x2d')]();return db[_0x98ab('0x46')][_0x98ab('0x4f')]({'where':{'id':_0x1c4ffd[_0x98ab('0x4c')]['id']}})['then'](function(_0x5a1b24){return db['sequelize'][_0x98ab('0x70')](function(_0x4a2ee8){return _0x5a1b24['removeTeams'](_0x1c4ffd[_0x98ab('0x37')][_0x98ab('0x7c')],{'transaction':_0x4a2ee8})['then'](function(){if(!_[_0x98ab('0x8c')](_0x36aa51)){return _0x5a1b24[_0x98ab('0x8d')](_0x36aa51,{'transaction':_0x4a2ee8})['then'](function(){return db[_0x98ab('0x75')][_0x98ab('0x24')]({'where':{'VoiceQueueId':_0x1c4ffd[_0x98ab('0x4c')]['id'],'UserId':_0x36aa51},'transaction':_0x4a2ee8});});}})[_0x98ab('0x23')](function(){_0x36aa51['forEach'](function(_0x1c6164){socket[_0x98ab('0x79')]('userVoiceQueue:remove',{'UserId':_0x1c6164,'VoiceQueueId':_0x5a1b24['id']});});});});});});})['then'](respondWithStatusCode(_0x5d647b,null))[_0x98ab('0x4b')](handleError(_0x5d647b,null));};exports[_0x98ab('0x8e')]=function(_0x2d44fc,_0x195664,_0x296559){var _0x5e5530,_0x278ee6;return db[_0x98ab('0x46')][_0x98ab('0x4f')]({'where':{'id':_0x2d44fc[_0x98ab('0x4c')]['id']}})[_0x98ab('0x23')](handleEntityNotFound(_0x195664,null))[_0x98ab('0x23')](function(_0x370932){if(_0x370932){_0x278ee6=_0x370932;return _0x370932[_0x98ab('0x8e')](_0x2d44fc[_0x98ab('0x51')][_0x98ab('0x7c')],_['omit'](_0x2d44fc[_0x98ab('0x51')],[_0x98ab('0x7c'),'id'])||{})[_0x98ab('0x8f')](function(_0x4a5fa4){for(var _0x4b8011=0x0;_0x4b8011<_0x2d44fc['body'][_0x98ab('0x7c')][_0x98ab('0x3d')];_0x4b8011+=0x1){socket[_0x98ab('0x79')](_0x98ab('0x7a'),{'UserId':Number(_0x2d44fc['body']['ids'][_0x4b8011]),'VoiceQueueId':Number(_0x2d44fc[_0x98ab('0x4c')]['id'])});}return _0x4a5fa4;});}})['then'](function(_0x9f0a9f){_0x5e5530=_0x9f0a9f||[];if(_0x278ee6){return db[_0x98ab('0x69')][_0x98ab('0x49')]({'where':{'id':_0x2d44fc[_0x98ab('0x51')][_0x98ab('0x7c')]},'attributes':['id','name',_0x98ab('0x6b'),_0x98ab('0x6c'),_0x98ab('0x76')],'raw':!![]});}})[_0x98ab('0x23')](function(_0x59b1a6){if(!_[_0x98ab('0x8c')](_0x59b1a6)){var _0xcb4f2c=[];for(var _0x274fb0=0x0;_0x274fb0<_0x59b1a6[_0x98ab('0x3d')];_0x274fb0++){if(_0x59b1a6[_0x274fb0][_0x98ab('0x6b')]){_0xcb4f2c[_0x98ab('0x84')](db['UserVoiceQueueRt'][_0x98ab('0x73')]({'membername':_0x59b1a6[_0x274fb0]['name'],'UserId':_0x59b1a6[_0x274fb0]['id'],'queue_name':_0x278ee6[_0x98ab('0x30')],'VoiceQueueId':_0x278ee6['id'],'interface':_['isNil'](_0x59b1a6[_0x274fb0][_0x98ab('0x76')])?util[_0x98ab('0x77')]('SIP/%s',_0x59b1a6[_0x274fb0]['name']):_0x59b1a6[_0x274fb0][_0x98ab('0x76')],'paused':_0x59b1a6[_0x274fb0][_0x98ab('0x6c')]||![],'penalty':_0x2d44fc[_0x98ab('0x51')]['penalty']||0x0}));}}return BPromise['all'](_0xcb4f2c);}})[_0x98ab('0x23')](function(){return _0x5e5530;})['then'](respondWithResult(_0x195664,null))[_0x98ab('0x4b')](handleError(_0x195664,null));};exports[_0x98ab('0x8d')]=function(_0x13b722,_0x30cb81,_0x31fab2){return db[_0x98ab('0x46')][_0x98ab('0x4f')]({'where':{'id':_0x13b722[_0x98ab('0x4c')]['id']}})[_0x98ab('0x23')](handleEntityNotFound(_0x30cb81,null))['then'](function(_0x42efe5){if(_0x42efe5){return _0x42efe5['removeAgents'](_0x13b722[_0x98ab('0x37')]['ids'])[_0x98ab('0x23')](function(){if(_[_0x98ab('0x90')](_0x13b722[_0x98ab('0x37')][_0x98ab('0x7c')])){for(var _0x25247f=0x0;_0x25247f<_0x13b722[_0x98ab('0x37')][_0x98ab('0x7c')][_0x98ab('0x3d')];_0x25247f+=0x1){socket[_0x98ab('0x79')](_0x98ab('0x91'),{'UserId':Number(_0x13b722[_0x98ab('0x37')][_0x98ab('0x7c')][_0x25247f]),'VoiceQueueId':Number(_0x13b722[_0x98ab('0x4c')]['id'])});}}else{socket['emit'](_0x98ab('0x91'),{'UserId':Number(_0x13b722['query'][_0x98ab('0x7c')]),'VoiceQueueId':Number(_0x13b722['params']['id'])});}});}})[_0x98ab('0x23')](function(_0x53312d){return db[_0x98ab('0x75')][_0x98ab('0x24')]({'where':{'VoiceQueueId':_0x13b722[_0x98ab('0x4c')]['id'],'UserId':_0x13b722[_0x98ab('0x37')]['ids']}})[_0x98ab('0x23')](function(){return _0x53312d;});})['then'](respondWithStatusCode(_0x30cb81,null))[_0x98ab('0x4b')](handleError(_0x30cb81,null));};exports[_0x98ab('0x92')]=function(_0x966d8,_0x32ca09,_0xd15884){var _0x391b51={};var _0x4489f7={};var _0x21cc8a;var _0x537a3d;return db[_0x98ab('0x46')][_0x98ab('0x5e')]({'where':{'id':_0x966d8['params']['id']}})['then'](handleEntityNotFound(_0x32ca09,null))['then'](function(_0x15c943){if(_0x15c943){_0x21cc8a=_0x15c943;_0x4489f7[_0x98ab('0x3a')]=_[_0x98ab('0x4d')](db[_0x98ab('0x69')][_0x98ab('0x4e')]);_0x4489f7[_0x98ab('0x37')]=_[_0x98ab('0x4d')](_0x966d8[_0x98ab('0x37')]);_0x4489f7[_0x98ab('0x38')]=_[_0x98ab('0x39')](_0x4489f7[_0x98ab('0x3a')],_0x4489f7[_0x98ab('0x37')]);_0x391b51[_0x98ab('0x3c')]=_[_0x98ab('0x39')](_0x4489f7[_0x98ab('0x3a')],qs['fields'](_0x966d8[_0x98ab('0x37')][_0x98ab('0x3b')]));_0x391b51['attributes']=_0x391b51[_0x98ab('0x3c')][_0x98ab('0x3d')]?_0x391b51[_0x98ab('0x3c')]:_0x4489f7[_0x98ab('0x3a')];_0x391b51['order']=qs[_0x98ab('0x40')](_0x966d8[_0x98ab('0x37')]['sort']);_0x391b51[_0x98ab('0x41')]=qs[_0x98ab('0x38')](_['pick'](_0x966d8[_0x98ab('0x37')],_0x4489f7[_0x98ab('0x38')]));if(_0x966d8[_0x98ab('0x37')]['filter']){_0x391b51['where']=_[_0x98ab('0x43')](_0x391b51[_0x98ab('0x41')],{'$or':_[_0x98ab('0x2c')](_0x391b51['attributes'],function(_0x14d0ad){var _0x3c1453={};_0x3c1453[_0x14d0ad]={'$like':'%'+_0x966d8['query']['filter']+'%'};return _0x3c1453;})});}_0x391b51=_[_0x98ab('0x43')]({},_0x391b51,_0x966d8[_0x98ab('0x45')]);return _0x21cc8a[_0x98ab('0x92')](_0x391b51);}})[_0x98ab('0x23')](function(_0xfbcbcc){if(_0xfbcbcc){_0x537a3d=_0xfbcbcc['length'];if(!_0x966d8[_0x98ab('0x37')][_0x98ab('0x3e')](_0x98ab('0x3f'))){_0x391b51[_0x98ab('0x1c')]=qs[_0x98ab('0x1c')](_0x966d8[_0x98ab('0x37')]['limit']);_0x391b51[_0x98ab('0x1b')]=qs['offset'](_0x966d8[_0x98ab('0x37')][_0x98ab('0x1b')]);}return _0x21cc8a[_0x98ab('0x92')](_0x391b51);}})[_0x98ab('0x23')](function(_0x23de93){if(_0x23de93){return _0x23de93?{'count':_0x537a3d,'rows':_0x23de93}:null;}})['then'](respondWithResult(_0x32ca09,null))[_0x98ab('0x4b')](handleError(_0x32ca09,null));};exports['getMembers']=function(_0x5f1571,_0x9eaebd,_0x162a30){var _0x421cdd={};var _0x4e3537={};var _0x166100;var _0x16d842;return db[_0x98ab('0x46')][_0x98ab('0x5e')]({'where':{'id':_0x5f1571[_0x98ab('0x4c')]['id']}})[_0x98ab('0x23')](handleEntityNotFound(_0x9eaebd,null))[_0x98ab('0x23')](function(_0x564c7a){if(_0x564c7a){_0x166100=_0x564c7a;_0x4e3537[_0x98ab('0x3a')]=_[_0x98ab('0x4d')](db[_0x98ab('0x75')]['rawAttributes']);_0x4e3537['query']=_[_0x98ab('0x4d')](_0x5f1571['query']);_0x4e3537[_0x98ab('0x38')]=_[_0x98ab('0x39')](_0x4e3537[_0x98ab('0x3a')],_0x4e3537[_0x98ab('0x37')]);_0x421cdd[_0x98ab('0x3c')]=_[_0x98ab('0x39')](_0x4e3537[_0x98ab('0x3a')],qs[_0x98ab('0x3b')](_0x5f1571['query'][_0x98ab('0x3b')]));_0x421cdd[_0x98ab('0x3c')]=_0x421cdd[_0x98ab('0x3c')][_0x98ab('0x3d')]?_0x421cdd[_0x98ab('0x3c')]:_0x4e3537[_0x98ab('0x3a')];_0x421cdd[_0x98ab('0x62')]=qs[_0x98ab('0x40')](_0x5f1571[_0x98ab('0x37')][_0x98ab('0x40')]);_0x421cdd[_0x98ab('0x41')]=qs[_0x98ab('0x38')](_['pick'](_0x5f1571[_0x98ab('0x37')],_0x4e3537[_0x98ab('0x38')]));if(_0x5f1571['query'][_0x98ab('0x2a')]){_0x421cdd[_0x98ab('0x41')]=_[_0x98ab('0x43')](_0x421cdd[_0x98ab('0x41')],{'$or':_[_0x98ab('0x2c')](_0x421cdd[_0x98ab('0x3c')],function(_0x11b06f){var _0x288d5b={};_0x288d5b[_0x11b06f]={'$like':'%'+_0x5f1571[_0x98ab('0x37')]['filter']+'%'};return _0x288d5b;})});}_0x421cdd=_[_0x98ab('0x43')]({},_0x421cdd,_0x5f1571['options']);return _0x166100[_0x98ab('0x93')](_0x421cdd);}})[_0x98ab('0x23')](function(_0x1148e1){if(_0x1148e1){_0x16d842=_0x1148e1[_0x98ab('0x3d')];if(!_0x5f1571[_0x98ab('0x37')][_0x98ab('0x3e')](_0x98ab('0x3f'))){_0x421cdd['limit']=qs[_0x98ab('0x1c')](_0x5f1571[_0x98ab('0x37')]['limit']);_0x421cdd[_0x98ab('0x1b')]=qs['offset'](_0x5f1571[_0x98ab('0x37')][_0x98ab('0x1b')]);}return _0x166100[_0x98ab('0x93')](_0x421cdd);}})[_0x98ab('0x23')](function(_0x362f53){return _0x362f53?{'count':_0x16d842,'rows':_0x362f53}:null;})[_0x98ab('0x23')](respondWithResult(_0x9eaebd,null))['catch'](handleError(_0x9eaebd,null));};exports['getLists']=function(_0x52a541,_0x3664c0,_0x3f55f4){var _0x33772a={};var _0x3d5ff7={};var _0x143494;var _0x547f55;return db[_0x98ab('0x46')]['findOne']({'where':{'id':_0x52a541['params']['id']}})[_0x98ab('0x23')](handleEntityNotFound(_0x3664c0,null))['then'](function(_0x2f50c0){if(_0x2f50c0){_0x143494=_0x2f50c0;_0x3d5ff7['model']=_['keys'](db[_0x98ab('0x94')][_0x98ab('0x4e')]);_0x3d5ff7[_0x98ab('0x37')]=_['keys'](_0x52a541[_0x98ab('0x37')]);_0x3d5ff7['filters']=_[_0x98ab('0x39')](_0x3d5ff7[_0x98ab('0x3a')],_0x3d5ff7[_0x98ab('0x37')]);_0x33772a[_0x98ab('0x3c')]=_[_0x98ab('0x39')](_0x3d5ff7[_0x98ab('0x3a')],qs[_0x98ab('0x3b')](_0x52a541[_0x98ab('0x37')][_0x98ab('0x3b')]));_0x33772a['attributes']=_0x33772a[_0x98ab('0x3c')]['length']?_0x33772a[_0x98ab('0x3c')]:_0x3d5ff7['model'];_0x33772a[_0x98ab('0x62')]=qs[_0x98ab('0x40')](_0x52a541[_0x98ab('0x37')][_0x98ab('0x40')]);_0x33772a[_0x98ab('0x41')]=qs[_0x98ab('0x38')](_[_0x98ab('0x42')](_0x52a541[_0x98ab('0x37')],_0x3d5ff7[_0x98ab('0x38')]));if(_0x52a541[_0x98ab('0x37')]['filter']){_0x33772a['where']=_[_0x98ab('0x43')](_0x33772a[_0x98ab('0x41')],{'$or':_['map'](_0x33772a[_0x98ab('0x3c')],function(_0x481c7e){var _0x527b78={};_0x527b78[_0x481c7e]={'$like':'%'+_0x52a541[_0x98ab('0x37')][_0x98ab('0x2a')]+'%'};return _0x527b78;})});}_0x33772a=_[_0x98ab('0x43')]({},_0x33772a,_0x52a541[_0x98ab('0x45')]);return _0x143494[_0x98ab('0x95')](_0x33772a);}})[_0x98ab('0x23')](function(_0x2fd8ba){if(_0x2fd8ba){_0x547f55=_0x2fd8ba[_0x98ab('0x3d')];if(!_0x52a541[_0x98ab('0x37')]['hasOwnProperty'](_0x98ab('0x3f'))){_0x33772a[_0x98ab('0x1c')]=qs[_0x98ab('0x1c')](_0x52a541[_0x98ab('0x37')][_0x98ab('0x1c')]);_0x33772a[_0x98ab('0x1b')]=qs['offset'](_0x52a541[_0x98ab('0x37')][_0x98ab('0x1b')]);}return _0x143494['getLists'](_0x33772a);}})[_0x98ab('0x23')](function(_0xda90a6){if(_0xda90a6){return _0xda90a6?{'count':_0x547f55,'rows':_0xda90a6}:null;}})[_0x98ab('0x23')](respondWithResult(_0x3664c0,null))[_0x98ab('0x4b')](handleError(_0x3664c0,null));};exports[_0x98ab('0x96')]=function(_0x52db09,_0x18e164,_0x5a83c8){var _0x256379,_0x44ac6f;return db[_0x98ab('0x46')]['find']({'where':{'id':_0x52db09[_0x98ab('0x4c')]['id']}})['then'](handleEntityNotFound(_0x18e164,null))[_0x98ab('0x23')](function(_0x289297){if(_0x289297){_0x44ac6f=_0x289297;return _0x289297['addLists'](_0x52db09[_0x98ab('0x51')][_0x98ab('0x7c')],_[_0x98ab('0x5a')](_0x52db09[_0x98ab('0x51')],[_0x98ab('0x7c'),'id'])||{});}return null;})[_0x98ab('0x8f')](function(_0x1ac101){var _0x30d786;_0x256379=_0x1ac101||[];var _0x3db56a=[];if(_0x1ac101){for(var _0x32b2dd=0x0;_0x32b2dd<_0x1ac101[_0x98ab('0x3d')];_0x32b2dd+=0x1){var _0x5bb163=_0x1ac101[_0x32b2dd][_0x98ab('0x25')]({'plain':!![]});_0x44ac6f[_0x98ab('0x97')]=_0x52db09[_0x98ab('0x51')]['dialCheckDuplicateType']?_0x52db09[_0x98ab('0x51')]['dialCheckDuplicateType']:_0x44ac6f['dialCheckDuplicateType'];switch(_0x44ac6f['dialCheckDuplicateType']){case'always':_0x30d786=squel['insert']()[_0x98ab('0x98')](_0x98ab('0x99'))[_0x98ab('0x9a')]([_0x98ab('0x9b'),_0x98ab('0x9c'),'ContactId','ListId',_0x98ab('0x5f'),_0x98ab('0x59'),_0x98ab('0x5b')],squel['select']()[_0x98ab('0x7e')](_0x98ab('0x9b'),_0x98ab('0x9b'))[_0x98ab('0x7e')]('NOW()','scheduledAt')['field']('id',_0x98ab('0x9d'))[_0x98ab('0x7e')](_0x5bb163[_0x98ab('0x9e')][_0x98ab('0x85')](),'ListId')[_0x98ab('0x7e')](_0x52db09[_0x98ab('0x4c')]['id'][_0x98ab('0x85')](),_0x98ab('0x5f'))[_0x98ab('0x7e')](_0x98ab('0x9f'),_0x98ab('0x59'))['field'](_0x98ab('0x9f'),_0x98ab('0x5b'))[_0x98ab('0x80')](_0x98ab('0xa0'))[_0x98ab('0x41')](_0x98ab('0xa1'))[_0x98ab('0x41')](_0x98ab('0xa2'),_0x5bb163[_0x98ab('0x9e')][_0x98ab('0x85')]())['where'](_0x98ab('0xa3'))[_0x98ab('0x41')](_0x98ab('0xa4'),squel[_0x98ab('0x7d')]()['field'](_0x98ab('0xa5'))['from']('cm_hopper_final')[_0x98ab('0x41')](_0x98ab('0x82'),_0x52db09[_0x98ab('0x4c')]['id']['toString']()))[_0x98ab('0x41')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0x98ab('0x80')](_0x98ab('0x99'))['where'](_0x98ab('0x82'),_0x52db09[_0x98ab('0x4c')]['id']['toString']())))['toString']();break;case'onlyIfOpen':_0x30d786=squel[_0x98ab('0xa6')]()['into']('cm_hopper')[_0x98ab('0x9a')]([_0x98ab('0x9b'),_0x98ab('0x9c'),_0x98ab('0x9d'),_0x98ab('0xa7'),_0x98ab('0x5f'),_0x98ab('0x59'),_0x98ab('0x5b')],squel[_0x98ab('0x7d')]()[_0x98ab('0x7e')](_0x98ab('0x9b'),_0x98ab('0x9b'))['field'](_0x98ab('0x9f'),_0x98ab('0x9c'))[_0x98ab('0x7e')]('id',_0x98ab('0x9d'))['field'](_0x5bb163[_0x98ab('0x9e')][_0x98ab('0x85')](),'ListId')[_0x98ab('0x7e')](_0x52db09[_0x98ab('0x4c')]['id'][_0x98ab('0x85')](),_0x98ab('0x5f'))[_0x98ab('0x7e')](_0x98ab('0x9f'),_0x98ab('0x59'))[_0x98ab('0x7e')]('NOW()',_0x98ab('0x5b'))[_0x98ab('0x80')](_0x98ab('0xa0'))[_0x98ab('0x41')](_0x98ab('0xa1'))[_0x98ab('0x41')](_0x98ab('0xa2'),_0x5bb163[_0x98ab('0x9e')][_0x98ab('0x85')]())[_0x98ab('0x41')]('phone\x20IS\x20NOT\x20NULL')[_0x98ab('0x41')](_0x98ab('0xa4'),squel[_0x98ab('0x7d')]()[_0x98ab('0x7e')](_0x98ab('0xa8'))[_0x98ab('0x80')](_0x98ab('0x99'))[_0x98ab('0x41')](_0x98ab('0x82'),_0x52db09[_0x98ab('0x4c')]['id'][_0x98ab('0x85')]())))[_0x98ab('0x85')]();break;default:_0x30d786=squel[_0x98ab('0xa6')]()[_0x98ab('0x98')](_0x98ab('0x99'))['fromQuery']([_0x98ab('0x9b'),_0x98ab('0x9c'),_0x98ab('0x9d'),_0x98ab('0xa7'),_0x98ab('0x5f'),_0x98ab('0x59'),'updatedAt'],squel[_0x98ab('0x7d')]()[_0x98ab('0x7e')](_0x98ab('0x9b'),_0x98ab('0x9b'))[_0x98ab('0x7e')]('NOW()',_0x98ab('0x9c'))[_0x98ab('0x7e')]('id',_0x98ab('0x9d'))[_0x98ab('0x7e')](_0x5bb163[_0x98ab('0x9e')][_0x98ab('0x85')](),_0x98ab('0xa7'))[_0x98ab('0x7e')](_0x52db09[_0x98ab('0x4c')]['id'][_0x98ab('0x85')](),'VoiceQueueId')[_0x98ab('0x7e')]('NOW()',_0x98ab('0x59'))[_0x98ab('0x7e')](_0x98ab('0x9f'),_0x98ab('0x5b'))[_0x98ab('0x80')](_0x98ab('0xa0'))[_0x98ab('0x41')]('deletedAt\x20IS\x20NULL')[_0x98ab('0x41')](_0x98ab('0xa2'),_0x5bb163['CmListId'][_0x98ab('0x85')]())['where'](_0x98ab('0xa3')))['toString']();}_0x3db56a[_0x98ab('0x84')](db[_0x98ab('0x6f')]['query'](_0x30d786));}return BPromise['all'](_0x3db56a);}})[_0x98ab('0x23')](function(){return _0x256379;})['then'](respondWithResult(_0x18e164,null))[_0x98ab('0x4b')](handleError(_0x18e164,null));};exports[_0x98ab('0xa9')]=function(_0x4a513f,_0x50c51f,_0x180db0){return db[_0x98ab('0x46')]['find']({'where':{'id':_0x4a513f['params']['id']}})[_0x98ab('0x23')](handleEntityNotFound(_0x50c51f,null))['then'](function(_0x22562b){if(_0x22562b){return _0x22562b[_0x98ab('0xa9')](_0x4a513f[_0x98ab('0x37')][_0x98ab('0x7c')]);}})[_0x98ab('0x23')](function(_0x5249ac){if(_0x5249ac){return db['CmHopper'][_0x98ab('0x24')]({'where':{'ListId':_0x4a513f[_0x98ab('0x37')][_0x98ab('0x7c')],'VoiceQueueId':_0x4a513f[_0x98ab('0x4c')]['id']}})['then'](function(){return _0x5249ac;});}})['then'](respondWithStatusCode(_0x50c51f,null))[_0x98ab('0x4b')](handleError(_0x50c51f,null));};exports[_0x98ab('0xaa')]=function(_0x41aa34,_0x179835,_0x14f5ef){var _0x1ee694={};var _0x50044c={};var _0x5ccb8c;var _0x3aefc8;return db[_0x98ab('0x46')][_0x98ab('0x5e')]({'where':{'id':_0x41aa34[_0x98ab('0x4c')]['id']}})['then'](handleEntityNotFound(_0x179835,null))[_0x98ab('0x23')](function(_0x505326){if(_0x505326){_0x5ccb8c=_0x505326;_0x50044c[_0x98ab('0x3a')]=_['keys'](db[_0x98ab('0x94')]['rawAttributes']);_0x50044c[_0x98ab('0x37')]=_[_0x98ab('0x4d')](_0x41aa34[_0x98ab('0x37')]);_0x50044c[_0x98ab('0x38')]=_[_0x98ab('0x39')](_0x50044c[_0x98ab('0x3a')],_0x50044c[_0x98ab('0x37')]);_0x1ee694[_0x98ab('0x3c')]=_[_0x98ab('0x39')](_0x50044c['model'],qs['fields'](_0x41aa34[_0x98ab('0x37')][_0x98ab('0x3b')]));_0x1ee694[_0x98ab('0x3c')]=_0x1ee694['attributes'][_0x98ab('0x3d')]?_0x1ee694[_0x98ab('0x3c')]:_0x50044c[_0x98ab('0x3a')];_0x1ee694[_0x98ab('0x62')]=qs[_0x98ab('0x40')](_0x41aa34[_0x98ab('0x37')]['sort']);_0x1ee694[_0x98ab('0x41')]=qs['filters'](_['pick'](_0x41aa34[_0x98ab('0x37')],_0x50044c[_0x98ab('0x38')]));if(_0x41aa34[_0x98ab('0x37')]['filter']){_0x1ee694[_0x98ab('0x41')]=_[_0x98ab('0x43')](_0x1ee694[_0x98ab('0x41')],{'$or':_[_0x98ab('0x2c')](_0x1ee694['attributes'],function(_0x524399){var _0x5a74ef={};_0x5a74ef[_0x524399]={'$like':'%'+_0x41aa34[_0x98ab('0x37')][_0x98ab('0x2a')]+'%'};return _0x5a74ef;})});}_0x1ee694=_['merge']({},_0x1ee694,_0x41aa34[_0x98ab('0x45')]);return _0x5ccb8c[_0x98ab('0xaa')](_0x1ee694);}})['then'](function(_0x454639){if(_0x454639){_0x3aefc8=_0x454639['length'];if(!_0x41aa34[_0x98ab('0x37')][_0x98ab('0x3e')](_0x98ab('0x3f'))){_0x1ee694[_0x98ab('0x1c')]=qs['limit'](_0x41aa34[_0x98ab('0x37')]['limit']);_0x1ee694['offset']=qs[_0x98ab('0x1b')](_0x41aa34[_0x98ab('0x37')]['offset']);}return _0x5ccb8c[_0x98ab('0xaa')](_0x1ee694);}})[_0x98ab('0x23')](function(_0x34f293){if(_0x34f293){return _0x34f293?{'count':_0x3aefc8,'rows':_0x34f293}:null;}})[_0x98ab('0x23')](respondWithResult(_0x179835,null))['catch'](handleError(_0x179835,null));};exports['addBlackLists']=function(_0x2dd3ee,_0x12f15b,_0x2bdcb7){var _0x4f5659,_0x1f8e96;return db['VoiceQueue']['find']({'where':{'id':_0x2dd3ee[_0x98ab('0x4c')]['id']}})[_0x98ab('0x23')](handleEntityNotFound(_0x12f15b,null))[_0x98ab('0x23')](function(_0x372aa1){if(_0x372aa1){_0x1f8e96=_0x372aa1;return _0x372aa1[_0x98ab('0xab')](_0x2dd3ee[_0x98ab('0x51')][_0x98ab('0x7c')],_['omit'](_0x2dd3ee['body'],['ids','id'])||{});}return null;})[_0x98ab('0x8f')](function(_0x1e0ef4){var _0x39d71d;_0x4f5659=_0x1e0ef4||[];var _0x207fcb=[];if(_0x1e0ef4){for(var _0x21379e=0x0;_0x21379e<_0x1e0ef4[_0x98ab('0x3d')];_0x21379e+=0x1){var _0x40c5f2=_0x1e0ef4[_0x21379e][_0x98ab('0x25')]({'plain':!![]});_0x39d71d=squel[_0x98ab('0xa6')]()[_0x98ab('0x98')]('cm_hopper_black')[_0x98ab('0x9a')]([_0x98ab('0x9b'),'ContactId',_0x98ab('0xa7'),_0x98ab('0x5f'),'createdAt',_0x98ab('0x5b')],squel[_0x98ab('0x7d')]()['field'](_0x98ab('0x9b'),_0x98ab('0x9b'))[_0x98ab('0x7e')]('id',_0x98ab('0x9d'))[_0x98ab('0x7e')](_0x40c5f2[_0x98ab('0x9e')][_0x98ab('0x85')](),_0x98ab('0xa7'))[_0x98ab('0x7e')](_0x2dd3ee[_0x98ab('0x4c')]['id'][_0x98ab('0x85')](),'VoiceQueueId')[_0x98ab('0x7e')](_0x98ab('0x9f'),_0x98ab('0x59'))[_0x98ab('0x7e')](_0x98ab('0x9f'),_0x98ab('0x5b'))[_0x98ab('0x80')](_0x98ab('0xa0'))[_0x98ab('0x41')](_0x98ab('0xa1'))['where'](_0x98ab('0xa2'),_0x40c5f2['CmListId'][_0x98ab('0x85')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x98ab('0x85')]();_0x207fcb['push'](db[_0x98ab('0x6f')][_0x98ab('0x37')](_0x39d71d));}return BPromise[_0x98ab('0x89')](_0x207fcb);}})['then'](function(){return _0x4f5659;})[_0x98ab('0x23')](respondWithResult(_0x12f15b,null))[_0x98ab('0x4b')](handleError(_0x12f15b,null));};exports[_0x98ab('0xac')]=function(_0x1421f5,_0x44f87d,_0x27a84e){return db['VoiceQueue']['find']({'where':{'id':_0x1421f5[_0x98ab('0x4c')]['id']}})['then'](handleEntityNotFound(_0x44f87d,null))['then'](function(_0x1daa63){if(_0x1daa63){return _0x1daa63[_0x98ab('0xac')](_0x1421f5[_0x98ab('0x37')]['ids']);}})[_0x98ab('0x23')](function(_0x18e527){if(_0x18e527){return db[_0x98ab('0x65')]['destroy']({'where':{'ListId':_0x1421f5[_0x98ab('0x37')][_0x98ab('0x7c')],'VoiceQueueId':_0x1421f5[_0x98ab('0x4c')]['id']}})[_0x98ab('0x23')](function(){return _0x18e527;});}})[_0x98ab('0x23')](respondWithStatusCode(_0x44f87d,null))[_0x98ab('0x4b')](handleError(_0x44f87d,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 2ad97a1..ff1ee9c 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 _0x1ba5=['hasOwnProperty','hook','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit'];(function(_0x275cad,_0x21ea86){var _0x37b7d3=function(_0x4ca9c0){while(--_0x4ca9c0){_0x275cad['push'](_0x275cad['shift']());}};_0x37b7d3(++_0x21ea86);}(_0x1ba5,0xb6));var _0x51ba=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x1ba5[_0x16b9ed];return _0x66b1f8;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x51ba('0x0'))['db'][_0x51ba('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x51ba('0x2')](0x0);var events={'afterCreate':_0x51ba('0x3'),'afterUpdate':_0x51ba('0x4'),'afterDestroy':_0x51ba('0x5')};function emitEvent(_0xec4396){return function(_0x3d22fb,_0x55a697,_0x3aead7){VoiceQueueEvents[_0x51ba('0x6')](_0xec4396+':'+_0x3d22fb['id'],_0x3d22fb);VoiceQueueEvents[_0x51ba('0x6')](_0xec4396,_0x3d22fb);_0x3aead7(null);};}for(var e in events){if(events[_0x51ba('0x7')](e)){var event=events[e];VoiceQueue[_0x51ba('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x44e5=['update','emit','hasOwnProperty','hook','exports','events','VoiceQueue','setMaxListeners','save'];(function(_0x8f7ac0,_0x1c6d04){var _0x1e5422=function(_0x3f214b){while(--_0x3f214b){_0x8f7ac0['push'](_0x8f7ac0['shift']());}};_0x1e5422(++_0x1c6d04);}(_0x44e5,0x1f4));var _0x544e=function(_0x1daaa9,_0x220393){_0x1daaa9=_0x1daaa9-0x0;var _0x1dd221=_0x44e5[_0x1daaa9];return _0x1dd221;};'use strict';var EventEmitter=require(_0x544e('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x544e('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x544e('0x2')](0x0);var events={'afterCreate':_0x544e('0x3'),'afterUpdate':_0x544e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x44872d){return function(_0x3a6b9b,_0x343fde,_0x2fc9a3){VoiceQueueEvents[_0x544e('0x5')](_0x44872d+':'+_0x3a6b9b['id'],_0x3a6b9b);VoiceQueueEvents[_0x544e('0x5')](_0x44872d,_0x3a6b9b);_0x2fc9a3(null);};}for(var e in events){if(events[_0x544e('0x6')](e)){var event=events[e];VoiceQueue[_0x544e('0x7')](e,emitEvent(event));}}module[_0x544e('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index b31e1fb..81f5d36 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 _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x5e7fe0,_0x48f825){var _0x4a38d6=function(_0x1d5a28){while(--_0x1d5a28){_0x5e7fe0['push'](_0x5e7fe0['shift']());}};_0x4a38d6(++_0x48f825);}(_0x70e0,0x17b));var _0x070e=function(_0x4dffc2,_0x26a982){_0x4dffc2=_0x4dffc2-0x0;var _0x9d2acb=_0x70e0[_0x4dffc2];return _0x9d2acb;};'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']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x1d029e,_0x312098){var _0x582436=function(_0x263b9f){while(--_0x263b9f){_0x1d029e['push'](_0x1d029e['shift']());}};_0x582436(++_0x312098);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 3735009..ae5d4f4 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 _0xeb50=['redis','socket.io-emitter','./voiceQueue.socket','then','info','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','include','model','map','debug','catch','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x1d426f,_0x37e919){var _0x17f71a=function(_0x3bf60c){while(--_0x3bf60c){_0x1d426f['push'](_0x1d426f['shift']());}};_0x17f71a(++_0x37e919);}(_0xeb50,0x1c9));var _0x0eb5=function(_0x2fec51,_0x480819){_0x2fec51=_0x2fec51-0x0;var _0x4d2f6f=_0xeb50[_0x2fec51];return _0x4d2f6f;};'use strict';var _=require(_0x0eb5('0x0'));var util=require(_0x0eb5('0x1'));var moment=require(_0x0eb5('0x2'));var BPromise=require(_0x0eb5('0x3'));var rs=require(_0x0eb5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0eb5('0x5'))['db'];var utils=require(_0x0eb5('0x6'));var logger=require(_0x0eb5('0x7'))('rpc');var config=require(_0x0eb5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0eb5('0x9')][_0x0eb5('0xa')]({'port':0x232a});config[_0x0eb5('0xb')]=_['defaults'](config[_0x0eb5('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x0eb5('0xc'))(new Redis(config[_0x0eb5('0xb')]));require(_0x0eb5('0xd'))['register'](socket);function respondWithRpcPromise(_0x5a4e15,_0x22ccf3,_0x4ace1c){return new BPromise(function(_0x3e0099,_0x1828a0){return client['request'](_0x5a4e15,_0x4ace1c)[_0x0eb5('0xe')](function(_0xd5b806){logger[_0x0eb5('0xf')](_0x0eb5('0x10'),_0x22ccf3,'request\x20sent');logger['debug'](_0x0eb5('0x11'),_0x22ccf3,_0x0eb5('0x12'),JSON[_0x0eb5('0x13')](_0xd5b806));if(_0xd5b806[_0x0eb5('0x14')]){if(_0xd5b806[_0x0eb5('0x14')][_0x0eb5('0x15')]===0x1f4){logger['error'](_0x0eb5('0x10'),_0x22ccf3,_0xd5b806[_0x0eb5('0x14')][_0x0eb5('0x16')]);return _0x1828a0(_0xd5b806[_0x0eb5('0x14')][_0x0eb5('0x16')]);}logger[_0x0eb5('0x14')](_0x0eb5('0x10'),_0x22ccf3,_0xd5b806['error']['message']);return _0x3e0099(_0xd5b806[_0x0eb5('0x14')][_0x0eb5('0x16')]);}else{logger['info'](_0x0eb5('0x10'),_0x22ccf3,_0x0eb5('0x12'));_0x3e0099(_0xd5b806['result']['message']);}})['catch'](function(_0x24e6ab){logger[_0x0eb5('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x22ccf3,_0x24e6ab);_0x1828a0(_0x24e6ab);});});}exports[_0x0eb5('0x17')]=function(_0x138d1a){var _0x4d95d2=this;return new Promise(function(_0x353a09,_0x1b1de8){return db[_0x0eb5('0x18')][_0x0eb5('0x19')]({'raw':_0x138d1a['options']?_0x138d1a[_0x0eb5('0x1a')][_0x0eb5('0x1b')]===undefined?!![]:![]:!![],'where':_0x138d1a['options']?_0x138d1a[_0x0eb5('0x1a')][_0x0eb5('0x1c')]||null:null,'attributes':_0x138d1a[_0x0eb5('0x1a')]?_0x138d1a[_0x0eb5('0x1a')][_0x0eb5('0x1d')]||null:null,'limit':_0x138d1a[_0x0eb5('0x1a')]?_0x138d1a[_0x0eb5('0x1a')]['limit']||null:null,'include':_0x138d1a[_0x0eb5('0x1a')]?_0x138d1a[_0x0eb5('0x1a')][_0x0eb5('0x1e')]?_['map'](_0x138d1a[_0x0eb5('0x1a')][_0x0eb5('0x1e')],function(_0x5cec96){return{'model':db[_0x5cec96[_0x0eb5('0x1f')]],'as':_0x5cec96['as'],'attributes':_0x5cec96[_0x0eb5('0x1d')],'include':_0x5cec96[_0x0eb5('0x1e')]?_[_0x0eb5('0x20')](_0x5cec96[_0x0eb5('0x1e')],function(_0x34282f){return{'model':db[_0x34282f[_0x0eb5('0x1f')]],'as':_0x34282f['as'],'attributes':_0x34282f[_0x0eb5('0x1d')],'include':_0x34282f['include']?_['map'](_0x34282f[_0x0eb5('0x1e')],function(_0x894a36){return{'model':db[_0x894a36[_0x0eb5('0x1f')]],'as':_0x894a36['as'],'attributes':_0x894a36['attributes']};}):[]};}):[]};}):[]:[]})[_0x0eb5('0xe')](function(_0x3cdcd9){logger[_0x0eb5('0xf')]('GetVoiceQueue',_0x138d1a);logger[_0x0eb5('0x21')]('GetVoiceQueue',_0x138d1a,JSON[_0x0eb5('0x13')](_0x3cdcd9));_0x353a09(_0x3cdcd9);})[_0x0eb5('0x22')](function(_0x97eeb){logger['error'](_0x0eb5('0x17'),_0x97eeb['message'],_0x138d1a);_0x1b1de8(_0x4d95d2[_0x0eb5('0x14')](0x1f4,_0x97eeb['message']));});});};exports['ShowVoiceQueue']=function(_0x22d96d){var _0x29d46f=this;return new Promise(function(_0x5cf0e2,_0x52251b){return db[_0x0eb5('0x18')]['find']({'raw':_0x22d96d['options']?_0x22d96d['options'][_0x0eb5('0x1b')]===undefined?!![]:![]:!![],'where':_0x22d96d[_0x0eb5('0x1a')]?_0x22d96d[_0x0eb5('0x1a')][_0x0eb5('0x1c')]||null:null,'attributes':_0x22d96d['options']?_0x22d96d['options'][_0x0eb5('0x1d')]||null:null,'include':_0x22d96d['options']?_0x22d96d[_0x0eb5('0x1a')][_0x0eb5('0x1e')]?_['map'](_0x22d96d[_0x0eb5('0x1a')][_0x0eb5('0x1e')],function(_0x2d0fc7){return{'model':db[_0x2d0fc7[_0x0eb5('0x1f')]],'as':_0x2d0fc7['as'],'attributes':_0x2d0fc7[_0x0eb5('0x1d')],'include':_0x2d0fc7[_0x0eb5('0x1e')]?_[_0x0eb5('0x20')](_0x2d0fc7[_0x0eb5('0x1e')],function(_0x4cb2d9){return{'model':db[_0x4cb2d9[_0x0eb5('0x1f')]],'as':_0x4cb2d9['as'],'attributes':_0x4cb2d9[_0x0eb5('0x1d')],'include':_0x4cb2d9[_0x0eb5('0x1e')]?_[_0x0eb5('0x20')](_0x4cb2d9[_0x0eb5('0x1e')],function(_0x3c0393){return{'model':db[_0x3c0393['model']],'as':_0x3c0393['as'],'attributes':_0x3c0393[_0x0eb5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0eb5('0xe')](function(_0x4e8c53){logger['info'](_0x0eb5('0x23'),_0x22d96d);logger[_0x0eb5('0x21')](_0x0eb5('0x23'),_0x22d96d,JSON[_0x0eb5('0x13')](_0x4e8c53));_0x5cf0e2(_0x4e8c53);})[_0x0eb5('0x22')](function(_0x35fcd9){logger[_0x0eb5('0x14')](_0x0eb5('0x23'),_0x35fcd9['message'],_0x22d96d);_0x52251b(_0x29d46f[_0x0eb5('0x14')](0x1f4,_0x35fcd9['message']));});});}; \ No newline at end of file +var _0xa173=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','where','attributes','limit','include','map','model','ShowVoiceQueue','find','raw','lodash','util','moment','ioredis'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xa173,0x144));var _0x3a17=function(_0x4fd91b,_0x1a7eb1){_0x4fd91b=_0x4fd91b-0x0;var _0xc0923f=_0xa173[_0x4fd91b];return _0xc0923f;};'use strict';var _=require(_0x3a17('0x0'));var util=require(_0x3a17('0x1'));var moment=require(_0x3a17('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3a17('0x3'));var db=require(_0x3a17('0x4'))['db'];var utils=require(_0x3a17('0x5'));var logger=require('../../config/logger')(_0x3a17('0x6'));var config=require(_0x3a17('0x7'));var jayson=require(_0x3a17('0x8'));var client=jayson[_0x3a17('0x9')][_0x3a17('0xa')]({'port':0x232a});config[_0x3a17('0xb')]=_[_0x3a17('0xc')](config[_0x3a17('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3a17('0xd'))(new Redis(config['redis']));require(_0x3a17('0xe'))[_0x3a17('0xf')](socket);function respondWithRpcPromise(_0xcf8284,_0x1968a1,_0x2d1953){return new BPromise(function(_0x1a5927,_0x49d2b2){return client[_0x3a17('0x10')](_0xcf8284,_0x2d1953)[_0x3a17('0x11')](function(_0x1c5d23){logger['info'](_0x3a17('0x12'),_0x1968a1,_0x3a17('0x13'));logger[_0x3a17('0x14')](_0x3a17('0x15'),_0x1968a1,_0x3a17('0x13'),JSON[_0x3a17('0x16')](_0x1c5d23));if(_0x1c5d23[_0x3a17('0x17')]){if(_0x1c5d23[_0x3a17('0x17')]['code']===0x1f4){logger[_0x3a17('0x17')](_0x3a17('0x12'),_0x1968a1,_0x1c5d23[_0x3a17('0x17')]['message']);return _0x49d2b2(_0x1c5d23[_0x3a17('0x17')][_0x3a17('0x18')]);}logger[_0x3a17('0x17')](_0x3a17('0x12'),_0x1968a1,_0x1c5d23['error'][_0x3a17('0x18')]);return _0x1a5927(_0x1c5d23[_0x3a17('0x17')][_0x3a17('0x18')]);}else{logger[_0x3a17('0x19')]('VoiceQueue,\x20%s,\x20%s',_0x1968a1,_0x3a17('0x13'));_0x1a5927(_0x1c5d23[_0x3a17('0x1a')][_0x3a17('0x18')]);}})[_0x3a17('0x1b')](function(_0x460c83){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x1968a1,_0x460c83);_0x49d2b2(_0x460c83);});});}exports[_0x3a17('0x1c')]=function(_0xed20be){var _0x462702=this;return new Promise(function(_0x48e85c,_0x165f26){return db[_0x3a17('0x1d')][_0x3a17('0x1e')]({'raw':_0xed20be['options']?_0xed20be[_0x3a17('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0xed20be[_0x3a17('0x1f')]?_0xed20be[_0x3a17('0x1f')][_0x3a17('0x20')]||null:null,'attributes':_0xed20be[_0x3a17('0x1f')]?_0xed20be['options'][_0x3a17('0x21')]||null:null,'limit':_0xed20be['options']?_0xed20be['options'][_0x3a17('0x22')]||null:null,'include':_0xed20be[_0x3a17('0x1f')]?_0xed20be[_0x3a17('0x1f')][_0x3a17('0x23')]?_[_0x3a17('0x24')](_0xed20be[_0x3a17('0x1f')][_0x3a17('0x23')],function(_0x471e5a){return{'model':db[_0x471e5a['model']],'as':_0x471e5a['as'],'attributes':_0x471e5a[_0x3a17('0x21')],'include':_0x471e5a['include']?_[_0x3a17('0x24')](_0x471e5a[_0x3a17('0x23')],function(_0xb697c9){return{'model':db[_0xb697c9['model']],'as':_0xb697c9['as'],'attributes':_0xb697c9[_0x3a17('0x21')],'include':_0xb697c9['include']?_[_0x3a17('0x24')](_0xb697c9[_0x3a17('0x23')],function(_0x741476){return{'model':db[_0x741476[_0x3a17('0x25')]],'as':_0x741476['as'],'attributes':_0x741476[_0x3a17('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3a17('0x11')](function(_0x5b4ba9){logger['info'](_0x3a17('0x1c'),_0xed20be);logger['debug']('GetVoiceQueue',_0xed20be,JSON[_0x3a17('0x16')](_0x5b4ba9));_0x48e85c(_0x5b4ba9);})[_0x3a17('0x1b')](function(_0x3bdc66){logger['error']('GetVoiceQueue',_0x3bdc66['message'],_0xed20be);_0x165f26(_0x462702[_0x3a17('0x17')](0x1f4,_0x3bdc66[_0x3a17('0x18')]));});});};exports[_0x3a17('0x26')]=function(_0x167777){var _0xcc0c3f=this;return new Promise(function(_0x16dc2c,_0x6aeefb){return db[_0x3a17('0x1d')][_0x3a17('0x27')]({'raw':_0x167777[_0x3a17('0x1f')]?_0x167777[_0x3a17('0x1f')][_0x3a17('0x28')]===undefined?!![]:![]:!![],'where':_0x167777[_0x3a17('0x1f')]?_0x167777[_0x3a17('0x1f')]['where']||null:null,'attributes':_0x167777[_0x3a17('0x1f')]?_0x167777[_0x3a17('0x1f')]['attributes']||null:null,'include':_0x167777['options']?_0x167777[_0x3a17('0x1f')][_0x3a17('0x23')]?_['map'](_0x167777[_0x3a17('0x1f')][_0x3a17('0x23')],function(_0x403525){return{'model':db[_0x403525['model']],'as':_0x403525['as'],'attributes':_0x403525[_0x3a17('0x21')],'include':_0x403525[_0x3a17('0x23')]?_['map'](_0x403525[_0x3a17('0x23')],function(_0x33999d){return{'model':db[_0x33999d[_0x3a17('0x25')]],'as':_0x33999d['as'],'attributes':_0x33999d[_0x3a17('0x21')],'include':_0x33999d[_0x3a17('0x23')]?_[_0x3a17('0x24')](_0x33999d[_0x3a17('0x23')],function(_0x3fce15){return{'model':db[_0x3fce15[_0x3a17('0x25')]],'as':_0x3fce15['as'],'attributes':_0x3fce15['attributes']};}):[]};}):[]};}):[]:[]})[_0x3a17('0x11')](function(_0x3aa450){logger[_0x3a17('0x19')]('ShowVoiceQueue',_0x167777);logger[_0x3a17('0x14')](_0x3a17('0x26'),_0x167777,JSON[_0x3a17('0x16')](_0x3aa450));_0x16dc2c(_0x3aa450);})[_0x3a17('0x1b')](function(_0x1dea10){logger[_0x3a17('0x17')](_0x3a17('0x26'),_0x1dea10[_0x3a17('0x18')],_0x167777);_0x6aeefb(_0xcc0c3f['error'](0x1f4,_0x1dea10[_0x3a17('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index a71bd23..6138684 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 _0xfaf7=['emit','removeListener','register','length','voiceQueue:','./voiceQueue.events','save','update'];(function(_0x212d35,_0x389471){var _0x33681c=function(_0x42570b){while(--_0x42570b){_0x212d35['push'](_0x212d35['shift']());}};_0x33681c(++_0x389471);}(_0xfaf7,0x1ad));var _0x7faf=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xfaf7[_0x176329];return _0x31997c;};'use strict';var VoiceQueueEvents=require(_0x7faf('0x0'));var events=[_0x7faf('0x1'),'remove',_0x7faf('0x2')];function createListener(_0x1424e1,_0x15bb43){return function(_0x1229c0){_0x15bb43[_0x7faf('0x3')](_0x1424e1,_0x1229c0);};}function removeListener(_0x377708,_0x40a9bc){return function(){VoiceQueueEvents[_0x7faf('0x4')](_0x377708,_0x40a9bc);};}exports[_0x7faf('0x5')]=function(_0x1ee667){for(var _0x59e886=0x0,_0x59331=events[_0x7faf('0x6')];_0x59e886<_0x59331;_0x59e886++){var _0x465d19=events[_0x59e886];var _0x37c7d1=createListener(_0x7faf('0x7')+_0x465d19,_0x1ee667);VoiceQueueEvents['on'](_0x465d19,_0x37c7d1);}}; \ No newline at end of file +var _0x6e4d=['./voiceQueue.events','save','update','emit','length','voiceQueue:'];(function(_0x4acdc0,_0x1e6253){var _0x54ce4b=function(_0x2eff6b){while(--_0x2eff6b){_0x4acdc0['push'](_0x4acdc0['shift']());}};_0x54ce4b(++_0x1e6253);}(_0x6e4d,0xde));var _0xd6e4=function(_0x1ab33b,_0x22036b){_0x1ab33b=_0x1ab33b-0x0;var _0x3aa539=_0x6e4d[_0x1ab33b];return _0x3aa539;};'use strict';var VoiceQueueEvents=require(_0xd6e4('0x0'));var events=[_0xd6e4('0x1'),'remove',_0xd6e4('0x2')];function createListener(_0x4051f6,_0x4f49a6){return function(_0x54167d){_0x4f49a6[_0xd6e4('0x3')](_0x4051f6,_0x54167d);};}function removeListener(_0x1044c1,_0x27307b){return function(){VoiceQueueEvents['removeListener'](_0x1044c1,_0x27307b);};}exports['register']=function(_0x5d0fbf){for(var _0x53bdfa=0x0,_0x3e9422=events[_0xd6e4('0x4')];_0x53bdfa<_0x3e9422;_0x53bdfa++){var _0x336325=events[_0x53bdfa];var _0x44005b=createListener(_0xd6e4('0x5')+_0x336325,_0x5d0fbf);VoiceQueueEvents['on'](_0x336325,_0x44005b);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 8680c19..066655d 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 _0x4b00=['/describe','isAuthenticated','describe','getVoiceQueuesReport','/:id','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','index'];(function(_0x16d44d,_0xad946d){var _0x4d859c=function(_0x7c7d0e){while(--_0x7c7d0e){_0x16d44d['push'](_0x16d44d['shift']());}};_0x4d859c(++_0xad946d);}(_0x4b00,0x6c));var _0x04b0=function(_0x452c3a,_0xd8155b){_0x452c3a=_0x452c3a-0x0;var _0x54e03f=_0x4b00[_0x452c3a];return _0x54e03f;};'use strict';var multer=require(_0x04b0('0x0'));var util=require('util');var path=require(_0x04b0('0x1'));var timeout=require(_0x04b0('0x2'));var express=require(_0x04b0('0x3'));var router=express[_0x04b0('0x4')]();var fs_extra=require(_0x04b0('0x5'));var auth=require(_0x04b0('0x6'));var interaction=require(_0x04b0('0x7'));var config=require(_0x04b0('0x8'));var controller=require(_0x04b0('0x9'));router[_0x04b0('0xa')]('/',auth['isAuthenticated'](),controller[_0x04b0('0xb')]);router[_0x04b0('0xa')](_0x04b0('0xc'),auth[_0x04b0('0xd')](),controller[_0x04b0('0xe')]);router[_0x04b0('0xa')]('/index',auth[_0x04b0('0xd')](),controller[_0x04b0('0xf')]);router[_0x04b0('0xa')](_0x04b0('0x10'),auth[_0x04b0('0xd')](),controller[_0x04b0('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x04b0('0x12')]);router[_0x04b0('0x13')](_0x04b0('0x10'),auth['isAuthenticated'](),controller[_0x04b0('0x14')]);router[_0x04b0('0x15')](_0x04b0('0x10'),auth[_0x04b0('0xd')](),controller[_0x04b0('0x16')]);module[_0x04b0('0x17')]=router; \ No newline at end of file +var _0x9d1e=['show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','getVoiceQueuesReport','/:id'];(function(_0x20a753,_0x4a1e38){var _0x4f8a13=function(_0x35d720){while(--_0x35d720){_0x20a753['push'](_0x20a753['shift']());}};_0x4f8a13(++_0x4a1e38);}(_0x9d1e,0x75));var _0xe9d1=function(_0x559561,_0x2f42f1){_0x559561=_0x559561-0x0;var _0xa3add3=_0x9d1e[_0x559561];return _0xa3add3;};'use strict';var multer=require(_0xe9d1('0x0'));var util=require(_0xe9d1('0x1'));var path=require('path');var timeout=require(_0xe9d1('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe9d1('0x3'));var auth=require(_0xe9d1('0x4'));var interaction=require(_0xe9d1('0x5'));var config=require(_0xe9d1('0x6'));var controller=require(_0xe9d1('0x7'));router[_0xe9d1('0x8')]('/',auth[_0xe9d1('0x9')](),controller[_0xe9d1('0xa')]);router[_0xe9d1('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xe9d1('0xb')]);router[_0xe9d1('0x8')](_0xe9d1('0xc'),auth[_0xe9d1('0x9')](),controller[_0xe9d1('0xd')]);router[_0xe9d1('0x8')](_0xe9d1('0xe'),auth[_0xe9d1('0x9')](),controller[_0xe9d1('0xf')]);router[_0xe9d1('0x10')]('/',auth[_0xe9d1('0x9')](),controller[_0xe9d1('0x11')]);router[_0xe9d1('0x12')](_0xe9d1('0xe'),auth[_0xe9d1('0x9')](),controller['update']);router[_0xe9d1('0x13')](_0xe9d1('0xe'),auth['isAuthenticated'](),controller[_0xe9d1('0x14')]);module[_0xe9d1('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 185671e..0b30252 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 _0x6d4a=['seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','moment','exports','STRING','DATE','queuecallerjoinAt','format','diff'];(function(_0x23ef81,_0x10dff1){var _0x475fd0=function(_0x4bb894){while(--_0x4bb894){_0x23ef81['push'](_0x23ef81['shift']());}};_0x475fd0(++_0x10dff1);}(_0x6d4a,0x1da));var _0xa6d4=function(_0x357dda,_0x1b4332){_0x357dda=_0x357dda-0x0;var _0x3237d2=_0x6d4a[_0x357dda];return _0x3237d2;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa6d4('0x0'));module[_0xa6d4('0x1')]={'type':{'type':Sequelize[_0xa6d4('0x2')]},'uniqueid':{'type':Sequelize[_0xa6d4('0x2')]},'calleridnum':{'type':Sequelize[_0xa6d4('0x2')]},'calleridname':{'type':Sequelize[_0xa6d4('0x2')]},'queue':{'type':Sequelize[_0xa6d4('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0xa6d4('0x3')],'set':function(_0x2904a3){var _0x687f01=moment(_0x2904a3);var _0xf6c580=moment(this['getDataValue'](_0xa6d4('0x4')))[_0xa6d4('0x5')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1199ca=_0x687f01[_0xa6d4('0x6')](_0xf6c580,_0xa6d4('0x7'));this[_0xa6d4('0x8')](_0xa6d4('0x9'),_0x2904a3);this[_0xa6d4('0x8')](_0xa6d4('0xa'),_0x1199ca||null);}},'position':{'type':Sequelize[_0xa6d4('0xb')]},'count':{'type':Sequelize[_0xa6d4('0xb')]},'queuecallerabandon':{'type':Sequelize[_0xa6d4('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xa6d4('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xa6d4('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xa6d4('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xa6d4('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xa6d4('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xa6d4('0xb')]},'channel':{'type':Sequelize[_0xa6d4('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xa6d4('0x2')]},'exten':{'type':Sequelize[_0xa6d4('0x2')]},'priority':{'type':Sequelize[_0xa6d4('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xa6d4('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xa6d4('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xa6d4('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa6d4('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xa6d4('0x2')]},'transferuniqueid':{'type':Sequelize[_0xa6d4('0x2')]},'disposition':{'type':Sequelize[_0xa6d4('0x2')]},'secondDisposition':{'type':Sequelize[_0xa6d4('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0xa6d4('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5055=['STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports'];(function(_0x14c729,_0x57a204){var _0x518da3=function(_0x166744){while(--_0x166744){_0x14c729['push'](_0x14c729['shift']());}};_0x518da3(++_0x57a204);}(_0x5055,0xb1));var _0x5505=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5055[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5505('0x0'));var moment=require(_0x5505('0x1'));module[_0x5505('0x2')]={'type':{'type':Sequelize[_0x5505('0x3')]},'uniqueid':{'type':Sequelize[_0x5505('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5505('0x3')]},'queue':{'type':Sequelize[_0x5505('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x5505('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x5505('0x4')],'set':function(_0x325c8f){var _0x4a17b7=moment(_0x325c8f);var _0x5ea0e1=moment(this[_0x5505('0x5')](_0x5505('0x6')))[_0x5505('0x7')](_0x5505('0x8'));var _0x134e7a=_0x4a17b7[_0x5505('0x9')](_0x5ea0e1,_0x5505('0xa'));this[_0x5505('0xb')](_0x5505('0xc'),_0x325c8f);this[_0x5505('0xb')](_0x5505('0xd'),_0x134e7a||null);}},'position':{'type':Sequelize[_0x5505('0xe')]},'count':{'type':Sequelize[_0x5505('0xe')]},'queuecallerabandon':{'type':Sequelize[_0x5505('0xf')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x5505('0xf')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x5505('0xf')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x5505('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x5505('0x3')],'comment':_0x5505('0x10')},'originalposition':{'type':Sequelize[_0x5505('0xe')]},'channel':{'type':Sequelize[_0x5505('0x3')]},'connectedlinenum':{'type':Sequelize[_0x5505('0x3')]},'connectedlinename':{'type':Sequelize[_0x5505('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x5505('0x3')]},'exten':{'type':Sequelize[_0x5505('0x3')]},'priority':{'type':Sequelize[_0x5505('0x3')]},'holdtime':{'type':Sequelize[_0x5505('0xe')]},'mohtime':{'type':Sequelize[_0x5505('0xe')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5505('0xf')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x5505('0xf')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5505('0x3')],'comment':_0x5505('0x11')},'transferexten':{'type':Sequelize[_0x5505('0x3')]},'transferuniqueid':{'type':Sequelize[_0x5505('0x3')]},'disposition':{'type':Sequelize[_0x5505('0x3')]},'secondDisposition':{'type':Sequelize[_0x5505('0x3')]},'thirdDisposition':{'type':Sequelize[_0x5505('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x5505('0xe')],'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 52f96a9..f5c1c9f 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 _0xb4c7=['findAll','then','catch','show','params','find','create','body','describe','getVoiceQueuesReport','includeAll','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','type','VIRTUAL','merge','options','include'];(function(_0x2dd91b,_0x1b0665){var _0x460826=function(_0x405f22){while(--_0x405f22){_0x2dd91b['push'](_0x2dd91b['shift']());}};_0x460826(++_0x1b0665);}(_0xb4c7,0xb8));var _0x7b4c=function(_0x4a9be6,_0xa5f8f5){_0x4a9be6=_0x4a9be6-0x0;var _0x2aea95=_0xb4c7[_0x4a9be6];return _0x2aea95;};'use strict';var emlformat=require(_0x7b4c('0x0'));var rimraf=require(_0x7b4c('0x1'));var zipdir=require(_0x7b4c('0x2'));var jsonpatch=require(_0x7b4c('0x3'));var rp=require(_0x7b4c('0x4'));var moment=require(_0x7b4c('0x5'));var BPromise=require(_0x7b4c('0x6'));var Mustache=require('mustache');var util=require(_0x7b4c('0x7'));var path=require(_0x7b4c('0x8'));var sox=require('sox');var csv=require(_0x7b4c('0x9'));var ejs=require(_0x7b4c('0xa'));var fs=require('fs');var fs_extra=require(_0x7b4c('0xb'));var _=require(_0x7b4c('0xc'));var squel=require(_0x7b4c('0xd'));var crypto=require('crypto');var jsforce=require(_0x7b4c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7b4c('0x9'));var querystring=require(_0x7b4c('0xf'));var Papa=require(_0x7b4c('0x10'));var Redis=require('ioredis');var authService=require(_0x7b4c('0x11'));var qs=require(_0x7b4c('0x12'));var as=require(_0x7b4c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b4c('0x14'))(_0x7b4c('0x15'));var utils=require('../../config/utils');var config=require(_0x7b4c('0x16'));var licenseUtil=require(_0x7b4c('0x17'));var db=require(_0x7b4c('0x18'))['db'];config[_0x7b4c('0x19')]=_[_0x7b4c('0x1a')](config[_0x7b4c('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x7b4c('0x1b'))(new Redis(config[_0x7b4c('0x19')]));require(_0x7b4c('0x1c'))['register'](socket);function respondWithStatusCode(_0x1708b4,_0x40b0b7){_0x40b0b7=_0x40b0b7||0xcc;return function(_0x288918){if(_0x288918){return _0x1708b4[_0x7b4c('0x1d')](_0x40b0b7);}return _0x1708b4[_0x7b4c('0x1e')](_0x40b0b7)['end']();};}function respondWithResult(_0x466bbe,_0x42e90a){_0x42e90a=_0x42e90a||0xc8;return function(_0x89d483){if(_0x89d483){return _0x466bbe[_0x7b4c('0x1e')](_0x42e90a)[_0x7b4c('0x1f')](_0x89d483);}};}function respondWithFilteredResult(_0x2566ec,_0x3b9bc3){return function(_0xf7523e){if(_0xf7523e){var _0x49da55=typeof _0x3b9bc3[_0x7b4c('0x20')]===_0x7b4c('0x21')&&typeof _0x3b9bc3[_0x7b4c('0x22')]==='undefined';var _0x5e20c6=_0xf7523e[_0x7b4c('0x23')];var _0x10d479=_0x49da55?0x0:_0x3b9bc3[_0x7b4c('0x20')];var _0x226d01=_0x49da55?_0xf7523e[_0x7b4c('0x23')]:_0x3b9bc3[_0x7b4c('0x20')]+_0x3b9bc3[_0x7b4c('0x22')];var _0x14b7e1;if(_0x226d01>=_0x5e20c6){_0x226d01=_0x5e20c6;_0x14b7e1=0xc8;}else{_0x14b7e1=0xce;}_0x2566ec[_0x7b4c('0x1e')](_0x14b7e1);return _0x2566ec[_0x7b4c('0x24')](_0x7b4c('0x25'),_0x10d479+'-'+_0x226d01+'/'+_0x5e20c6)[_0x7b4c('0x1f')](_0xf7523e);}return null;};}function patchUpdates(_0x1f5a8d){return function(_0x31ae30){try{jsonpatch[_0x7b4c('0x26')](_0x31ae30,_0x1f5a8d,!![]);}catch(_0x585cf2){return BPromise[_0x7b4c('0x27')](_0x585cf2);}return _0x31ae30[_0x7b4c('0x28')]();};}function saveUpdates(_0x79c7b3,_0x30b23a){return function(_0x582cf1){if(_0x582cf1){return _0x582cf1[_0x7b4c('0x29')](_0x79c7b3)['then'](function(_0x596c2f){return _0x596c2f;});}return null;};}function removeEntity(_0x5ebad6,_0x55556c){return function(_0x49b8d0){if(_0x49b8d0){return _0x49b8d0[_0x7b4c('0x2a')]()['then'](function(){_0x5ebad6['status'](0xcc)[_0x7b4c('0x2b')]();});}};}function handleEntityNotFound(_0x5b7898,_0x5a3110){return function(_0x544a2f){if(!_0x544a2f){_0x5b7898['sendStatus'](0x194);}return _0x544a2f;};}function handleError(_0x3eb6c4,_0x134dba){_0x134dba=_0x134dba||0x1f4;return function(_0x4fa40a){logger[_0x7b4c('0x2c')](_0x4fa40a[_0x7b4c('0x2d')]);if(_0x4fa40a[_0x7b4c('0x2e')]){delete _0x4fa40a['name'];}_0x3eb6c4[_0x7b4c('0x1e')](_0x134dba)[_0x7b4c('0x2f')](_0x4fa40a);};}exports[_0x7b4c('0x30')]=function(_0x102c09,_0x540cd7){var _0x46c29e={},_0x14eaca={},_0x31612c={'count':0x0,'rows':[]};var _0x2b47df=_[_0x7b4c('0x31')](db[_0x7b4c('0x32')][_0x7b4c('0x33')],function(_0x446098){return{'name':_0x446098[_0x7b4c('0x34')],'type':_0x446098['type'][_0x7b4c('0x35')]};});_0x14eaca[_0x7b4c('0x36')]=_[_0x7b4c('0x31')](_0x2b47df,_0x7b4c('0x2e'));_0x14eaca['query']=_[_0x7b4c('0x37')](_0x102c09[_0x7b4c('0x38')]);_0x14eaca['filters']=_[_0x7b4c('0x39')](_0x14eaca[_0x7b4c('0x36')],_0x14eaca[_0x7b4c('0x38')]);_0x46c29e[_0x7b4c('0x3a')]=_['intersection'](_0x14eaca['model'],qs[_0x7b4c('0x3b')](_0x102c09[_0x7b4c('0x38')][_0x7b4c('0x3b')]));_0x46c29e[_0x7b4c('0x3a')]=_0x46c29e['attributes'][_0x7b4c('0x3c')]?_0x46c29e[_0x7b4c('0x3a')]:_0x14eaca[_0x7b4c('0x36')];if(!_0x102c09['query'][_0x7b4c('0x3d')](_0x7b4c('0x3e'))){_0x46c29e['limit']=qs[_0x7b4c('0x22')](_0x102c09[_0x7b4c('0x38')][_0x7b4c('0x22')]);_0x46c29e[_0x7b4c('0x20')]=qs[_0x7b4c('0x20')](_0x102c09['query'][_0x7b4c('0x20')]);}_0x46c29e[_0x7b4c('0x3f')]=qs['sort'](_0x102c09[_0x7b4c('0x38')][_0x7b4c('0x40')]);_0x46c29e[_0x7b4c('0x41')]=qs['filters'](_[_0x7b4c('0x42')](_0x102c09[_0x7b4c('0x38')],_0x14eaca[_0x7b4c('0x43')]),_0x2b47df);if(_0x102c09[_0x7b4c('0x38')][_0x7b4c('0x44')]){_0x46c29e[_0x7b4c('0x41')]=_['merge'](_0x46c29e[_0x7b4c('0x41')],{'$or':_[_0x7b4c('0x31')](_0x2b47df,function(_0x4f2dad){if(_0x4f2dad[_0x7b4c('0x45')]!==_0x7b4c('0x46')){var _0x99ec61={};_0x99ec61[_0x4f2dad['name']]={'$like':'%'+_0x102c09[_0x7b4c('0x38')]['filter']+'%'};return _0x99ec61;}})});}_0x46c29e=_[_0x7b4c('0x47')]({},_0x46c29e,_0x102c09[_0x7b4c('0x48')]);var _0x521235={'where':_0x46c29e['where']};return db['VoiceQueueReport'][_0x7b4c('0x23')](_0x521235)['then'](function(_0x368da0){_0x31612c[_0x7b4c('0x23')]=_0x368da0;if(_0x102c09[_0x7b4c('0x38')]['includeAll']){_0x46c29e[_0x7b4c('0x49')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x7b4c('0x4a')](_0x46c29e);})[_0x7b4c('0x4b')](function(_0x18e623){_0x31612c['rows']=_0x18e623;return _0x31612c;})[_0x7b4c('0x4b')](respondWithFilteredResult(_0x540cd7,_0x46c29e))[_0x7b4c('0x4c')](handleError(_0x540cd7,null));};exports[_0x7b4c('0x4d')]=function(_0x1fcb76,_0x1081a4){var _0x18693a={'raw':![],'where':{'id':_0x1fcb76[_0x7b4c('0x4e')]['id']}},_0x46eefb={};_0x46eefb['model']=_['keys'](db['VoiceQueueReport'][_0x7b4c('0x33')]);_0x46eefb['query']=_['keys'](_0x1fcb76[_0x7b4c('0x38')]);_0x46eefb['filters']=_[_0x7b4c('0x39')](_0x46eefb['model'],_0x46eefb[_0x7b4c('0x38')]);_0x18693a[_0x7b4c('0x3a')]=_[_0x7b4c('0x39')](_0x46eefb[_0x7b4c('0x36')],qs[_0x7b4c('0x3b')](_0x1fcb76['query']['fields']));_0x18693a[_0x7b4c('0x3a')]=_0x18693a[_0x7b4c('0x3a')][_0x7b4c('0x3c')]?_0x18693a['attributes']:_0x46eefb[_0x7b4c('0x36')];if(_0x1fcb76['query']['includeAll']){_0x18693a[_0x7b4c('0x49')]=[{'all':!![]}];}_0x18693a=_[_0x7b4c('0x47')]({},_0x18693a,_0x1fcb76[_0x7b4c('0x48')]);return db[_0x7b4c('0x32')][_0x7b4c('0x4f')](_0x18693a)['then'](handleEntityNotFound(_0x1081a4,null))[_0x7b4c('0x4b')](respondWithResult(_0x1081a4,null))[_0x7b4c('0x4c')](handleError(_0x1081a4,null));};exports[_0x7b4c('0x50')]=function(_0x4bd3c5,_0x19db8a){return db[_0x7b4c('0x32')][_0x7b4c('0x50')](_0x4bd3c5[_0x7b4c('0x51')],{})['then'](respondWithResult(_0x19db8a,0xc9))[_0x7b4c('0x4c')](handleError(_0x19db8a,null));};exports[_0x7b4c('0x29')]=function(_0x3baed4,_0x3f9334){if(_0x3baed4['body']['id']){delete _0x3baed4[_0x7b4c('0x51')]['id'];}return db['VoiceQueueReport'][_0x7b4c('0x4f')]({'where':{'id':_0x3baed4[_0x7b4c('0x4e')]['id']}})[_0x7b4c('0x4b')](handleEntityNotFound(_0x3f9334,null))[_0x7b4c('0x4b')](saveUpdates(_0x3baed4['body'],null))['then'](respondWithResult(_0x3f9334,null))[_0x7b4c('0x4c')](handleError(_0x3f9334,null));};exports[_0x7b4c('0x2a')]=function(_0x360bfe,_0x1ebb23){return db[_0x7b4c('0x32')][_0x7b4c('0x4f')]({'where':{'id':_0x360bfe[_0x7b4c('0x4e')]['id']}})[_0x7b4c('0x4b')](handleEntityNotFound(_0x1ebb23,null))[_0x7b4c('0x4b')](removeEntity(_0x1ebb23,null))[_0x7b4c('0x4c')](handleError(_0x1ebb23,null));};exports[_0x7b4c('0x52')]=function(_0x113f62,_0x3bb8a6){return db[_0x7b4c('0x32')]['describe']()[_0x7b4c('0x4b')](respondWithResult(_0x3bb8a6,null))[_0x7b4c('0x4c')](handleError(_0x3bb8a6,null));};exports[_0x7b4c('0x53')]=function(_0x229cd4,_0x367913){var _0x226393={},_0x24047f={},_0x46b9e7={'count':0x0,'rows':[]};_0x24047f['model']=_[_0x7b4c('0x37')](db[_0x7b4c('0x32')]['rawAttributes']);_0x24047f[_0x7b4c('0x38')]=_[_0x7b4c('0x37')](_0x229cd4[_0x7b4c('0x38')]);_0x24047f[_0x7b4c('0x43')]=_['intersection'](_0x24047f[_0x7b4c('0x36')],_0x24047f[_0x7b4c('0x38')]);_0x226393[_0x7b4c('0x3a')]=_[_0x7b4c('0x39')](_0x24047f[_0x7b4c('0x36')],qs[_0x7b4c('0x3b')](_0x229cd4[_0x7b4c('0x38')]['fields']));_0x226393[_0x7b4c('0x3a')]=_0x226393['attributes'][_0x7b4c('0x3c')]?_0x226393['attributes']:_0x24047f[_0x7b4c('0x36')];if(!_0x229cd4['query']['hasOwnProperty']('nolimit')){_0x226393[_0x7b4c('0x22')]=qs[_0x7b4c('0x22')](_0x229cd4[_0x7b4c('0x38')][_0x7b4c('0x22')]);_0x226393[_0x7b4c('0x20')]=qs[_0x7b4c('0x20')](_0x229cd4[_0x7b4c('0x38')][_0x7b4c('0x20')]);}_0x226393[_0x7b4c('0x3f')]=qs['sort'](_0x229cd4['query']['sort']);_0x226393[_0x7b4c('0x41')]=qs[_0x7b4c('0x43')](_[_0x7b4c('0x42')](_0x229cd4[_0x7b4c('0x38')],_0x24047f['filters']));if(_0x229cd4[_0x7b4c('0x38')][_0x7b4c('0x44')]){_0x226393[_0x7b4c('0x41')]=_[_0x7b4c('0x47')](_0x226393[_0x7b4c('0x41')],{'$or':_[_0x7b4c('0x31')](_0x226393[_0x7b4c('0x3a')],function(_0x428c91){var _0x5eba63={};_0x5eba63[_0x428c91]={'$like':'%'+_0x229cd4[_0x7b4c('0x38')][_0x7b4c('0x44')]+'%'};return _0x5eba63;})});}_0x226393=_[_0x7b4c('0x47')]({},_0x226393,_0x229cd4[_0x7b4c('0x48')]);var _0x2b636c={'where':_0x226393[_0x7b4c('0x41')]};return db[_0x7b4c('0x32')][_0x7b4c('0x23')](_0x2b636c)[_0x7b4c('0x4b')](function(_0x4faf1d){_0x46b9e7['count']=_0x4faf1d;if(_0x229cd4[_0x7b4c('0x38')][_0x7b4c('0x54')]){_0x226393[_0x7b4c('0x49')]=[{'all':!![]}];}return db[_0x7b4c('0x32')][_0x7b4c('0x4a')](_0x226393);})[_0x7b4c('0x4b')](function(_0x38a2c5){_0x46b9e7[_0x7b4c('0x55')]=_0x38a2c5;return _0x46b9e7;})[_0x7b4c('0x4b')](respondWithFilteredResult(_0x367913,_0x226393,_0x7b4c('0x53')))[_0x7b4c('0x4c')](handleError(_0x367913,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0xa05d=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./voiceQueueReport.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','name','send','map','VoiceQueueReport','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','show','params','include','find','catch','create','body','destroy','describe','getVoiceQueuesReport','intersection','findAll','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xa05d,0xe5));var _0xda05=function(_0x549444,_0x41c180){_0x549444=_0x549444-0x0;var _0x2348d2=_0xa05d[_0x549444];return _0x2348d2;};'use strict';var emlformat=require(_0xda05('0x0'));var rimraf=require(_0xda05('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda05('0x2'));var rp=require(_0xda05('0x3'));var moment=require(_0xda05('0x4'));var BPromise=require(_0xda05('0x5'));var Mustache=require(_0xda05('0x6'));var util=require(_0xda05('0x7'));var path=require(_0xda05('0x8'));var sox=require(_0xda05('0x9'));var csv=require(_0xda05('0xa'));var ejs=require(_0xda05('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xda05('0xc'));var squel=require(_0xda05('0xd'));var crypto=require('crypto');var jsforce=require(_0xda05('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xda05('0xf'));var Papa=require(_0xda05('0x10'));var Redis=require(_0xda05('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xda05('0x12'));var as=require(_0xda05('0x13'));var hardwareService=require(_0xda05('0x14'));var logger=require('../../config/logger')(_0xda05('0x15'));var utils=require(_0xda05('0x16'));var config=require(_0xda05('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xda05('0x18'))['db'];config[_0xda05('0x19')]=_['defaults'](config['redis'],{'host':_0xda05('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xda05('0x19')]));require(_0xda05('0x1b'))['register'](socket);function respondWithStatusCode(_0x5c4c37,_0x381bd6){_0x381bd6=_0x381bd6||0xcc;return function(_0x1556c0){if(_0x1556c0){return _0x5c4c37[_0xda05('0x1c')](_0x381bd6);}return _0x5c4c37[_0xda05('0x1d')](_0x381bd6)[_0xda05('0x1e')]();};}function respondWithResult(_0x24b8dc,_0x2a5e25){_0x2a5e25=_0x2a5e25||0xc8;return function(_0x3a6c79){if(_0x3a6c79){return _0x24b8dc[_0xda05('0x1d')](_0x2a5e25)[_0xda05('0x1f')](_0x3a6c79);}};}function respondWithFilteredResult(_0x27af15,_0x3c85e7){return function(_0x1c5b91){if(_0x1c5b91){var _0x265468=typeof _0x3c85e7[_0xda05('0x20')]===_0xda05('0x21')&&typeof _0x3c85e7[_0xda05('0x22')]===_0xda05('0x21');var _0x4237c3=_0x1c5b91[_0xda05('0x23')];var _0x53874f=_0x265468?0x0:_0x3c85e7[_0xda05('0x20')];var _0x2dcbab=_0x265468?_0x1c5b91[_0xda05('0x23')]:_0x3c85e7['offset']+_0x3c85e7[_0xda05('0x22')];var _0x3f9d80;if(_0x2dcbab>=_0x4237c3){_0x2dcbab=_0x4237c3;_0x3f9d80=0xc8;}else{_0x3f9d80=0xce;}_0x27af15['status'](_0x3f9d80);return _0x27af15[_0xda05('0x24')]('Content-Range',_0x53874f+'-'+_0x2dcbab+'/'+_0x4237c3)[_0xda05('0x1f')](_0x1c5b91);}return null;};}function patchUpdates(_0x495d02){return function(_0x124349){try{jsonpatch[_0xda05('0x25')](_0x124349,_0x495d02,!![]);}catch(_0x434d38){return BPromise['reject'](_0x434d38);}return _0x124349[_0xda05('0x26')]();};}function saveUpdates(_0x30e28,_0x476291){return function(_0x122fc8){if(_0x122fc8){return _0x122fc8[_0xda05('0x27')](_0x30e28)[_0xda05('0x28')](function(_0x5a5554){return _0x5a5554;});}return null;};}function removeEntity(_0x3b8e1a,_0x55c0ef){return function(_0x3347f4){if(_0x3347f4){return _0x3347f4['destroy']()['then'](function(){_0x3b8e1a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ca978,_0x53fc32){return function(_0x3e3d61){if(!_0x3e3d61){_0x4ca978[_0xda05('0x1c')](0x194);}return _0x3e3d61;};}function handleError(_0x7428,_0x44b5ab){_0x44b5ab=_0x44b5ab||0x1f4;return function(_0x5b4bf7){logger['error'](_0x5b4bf7['stack']);if(_0x5b4bf7['name']){delete _0x5b4bf7[_0xda05('0x29')];}_0x7428['status'](_0x44b5ab)[_0xda05('0x2a')](_0x5b4bf7);};}exports['index']=function(_0x417bd5,_0x1d4686){var _0x2b36d4={},_0x20a669={},_0x3c1840={'count':0x0,'rows':[]};var _0x298561=_[_0xda05('0x2b')](db[_0xda05('0x2c')][_0xda05('0x2d')],function(_0x20f9a7){return{'name':_0x20f9a7[_0xda05('0x2e')],'type':_0x20f9a7['type']['key']};});_0x20a669[_0xda05('0x2f')]=_[_0xda05('0x2b')](_0x298561,_0xda05('0x29'));_0x20a669[_0xda05('0x30')]=_[_0xda05('0x31')](_0x417bd5[_0xda05('0x30')]);_0x20a669[_0xda05('0x32')]=_['intersection'](_0x20a669[_0xda05('0x2f')],_0x20a669[_0xda05('0x30')]);_0x2b36d4[_0xda05('0x33')]=_['intersection'](_0x20a669[_0xda05('0x2f')],qs[_0xda05('0x34')](_0x417bd5[_0xda05('0x30')][_0xda05('0x34')]));_0x2b36d4[_0xda05('0x33')]=_0x2b36d4[_0xda05('0x33')][_0xda05('0x35')]?_0x2b36d4[_0xda05('0x33')]:_0x20a669[_0xda05('0x2f')];if(!_0x417bd5[_0xda05('0x30')][_0xda05('0x36')]('nolimit')){_0x2b36d4[_0xda05('0x22')]=qs[_0xda05('0x22')](_0x417bd5[_0xda05('0x30')][_0xda05('0x22')]);_0x2b36d4[_0xda05('0x20')]=qs[_0xda05('0x20')](_0x417bd5[_0xda05('0x30')][_0xda05('0x20')]);}_0x2b36d4[_0xda05('0x37')]=qs[_0xda05('0x38')](_0x417bd5['query']['sort']);_0x2b36d4[_0xda05('0x39')]=qs['filters'](_[_0xda05('0x3a')](_0x417bd5[_0xda05('0x30')],_0x20a669[_0xda05('0x32')]),_0x298561);if(_0x417bd5[_0xda05('0x30')][_0xda05('0x3b')]){_0x2b36d4[_0xda05('0x39')]=_[_0xda05('0x3c')](_0x2b36d4[_0xda05('0x39')],{'$or':_[_0xda05('0x2b')](_0x298561,function(_0x52d501){if(_0x52d501[_0xda05('0x3d')]!==_0xda05('0x3e')){var _0x397ca6={};_0x397ca6[_0x52d501[_0xda05('0x29')]]={'$like':'%'+_0x417bd5[_0xda05('0x30')][_0xda05('0x3b')]+'%'};return _0x397ca6;}})});}_0x2b36d4=_[_0xda05('0x3c')]({},_0x2b36d4,_0x417bd5[_0xda05('0x3f')]);var _0x377dca={'where':_0x2b36d4[_0xda05('0x39')]};return db[_0xda05('0x2c')][_0xda05('0x23')](_0x377dca)[_0xda05('0x28')](function(_0x17ef6a){_0x3c1840[_0xda05('0x23')]=_0x17ef6a;if(_0x417bd5[_0xda05('0x30')][_0xda05('0x40')]){_0x2b36d4['include']=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x2b36d4);})[_0xda05('0x28')](function(_0x59d34e){_0x3c1840[_0xda05('0x41')]=_0x59d34e;return _0x3c1840;})[_0xda05('0x28')](respondWithFilteredResult(_0x1d4686,_0x2b36d4))['catch'](handleError(_0x1d4686,null));};exports[_0xda05('0x42')]=function(_0x5842d8,_0x1c92ce){var _0x1651a8={'raw':![],'where':{'id':_0x5842d8[_0xda05('0x43')]['id']}},_0x49c2fa={};_0x49c2fa[_0xda05('0x2f')]=_[_0xda05('0x31')](db['VoiceQueueReport'][_0xda05('0x2d')]);_0x49c2fa[_0xda05('0x30')]=_[_0xda05('0x31')](_0x5842d8[_0xda05('0x30')]);_0x49c2fa['filters']=_['intersection'](_0x49c2fa[_0xda05('0x2f')],_0x49c2fa['query']);_0x1651a8[_0xda05('0x33')]=_['intersection'](_0x49c2fa[_0xda05('0x2f')],qs[_0xda05('0x34')](_0x5842d8[_0xda05('0x30')][_0xda05('0x34')]));_0x1651a8[_0xda05('0x33')]=_0x1651a8[_0xda05('0x33')][_0xda05('0x35')]?_0x1651a8[_0xda05('0x33')]:_0x49c2fa[_0xda05('0x2f')];if(_0x5842d8['query'][_0xda05('0x40')]){_0x1651a8[_0xda05('0x44')]=[{'all':!![]}];}_0x1651a8=_[_0xda05('0x3c')]({},_0x1651a8,_0x5842d8['options']);return db[_0xda05('0x2c')][_0xda05('0x45')](_0x1651a8)[_0xda05('0x28')](handleEntityNotFound(_0x1c92ce,null))[_0xda05('0x28')](respondWithResult(_0x1c92ce,null))[_0xda05('0x46')](handleError(_0x1c92ce,null));};exports[_0xda05('0x47')]=function(_0x22c988,_0x142d35){return db[_0xda05('0x2c')]['create'](_0x22c988[_0xda05('0x48')],{})[_0xda05('0x28')](respondWithResult(_0x142d35,0xc9))[_0xda05('0x46')](handleError(_0x142d35,null));};exports[_0xda05('0x27')]=function(_0x2f8ea4,_0x3cce98){if(_0x2f8ea4[_0xda05('0x48')]['id']){delete _0x2f8ea4[_0xda05('0x48')]['id'];}return db['VoiceQueueReport'][_0xda05('0x45')]({'where':{'id':_0x2f8ea4[_0xda05('0x43')]['id']}})[_0xda05('0x28')](handleEntityNotFound(_0x3cce98,null))['then'](saveUpdates(_0x2f8ea4['body'],null))['then'](respondWithResult(_0x3cce98,null))[_0xda05('0x46')](handleError(_0x3cce98,null));};exports[_0xda05('0x49')]=function(_0x2e7ae7,_0x462304){return db[_0xda05('0x2c')][_0xda05('0x45')]({'where':{'id':_0x2e7ae7[_0xda05('0x43')]['id']}})['then'](handleEntityNotFound(_0x462304,null))['then'](removeEntity(_0x462304,null))['catch'](handleError(_0x462304,null));};exports[_0xda05('0x4a')]=function(_0x197e3c,_0x4ba672){return db[_0xda05('0x2c')][_0xda05('0x4a')]()['then'](respondWithResult(_0x4ba672,null))[_0xda05('0x46')](handleError(_0x4ba672,null));};exports[_0xda05('0x4b')]=function(_0x766228,_0x1cbe83){var _0x209e31={},_0x502272={},_0x3c82a7={'count':0x0,'rows':[]};_0x502272[_0xda05('0x2f')]=_[_0xda05('0x31')](db[_0xda05('0x2c')]['rawAttributes']);_0x502272[_0xda05('0x30')]=_[_0xda05('0x31')](_0x766228[_0xda05('0x30')]);_0x502272[_0xda05('0x32')]=_[_0xda05('0x4c')](_0x502272['model'],_0x502272['query']);_0x209e31[_0xda05('0x33')]=_[_0xda05('0x4c')](_0x502272[_0xda05('0x2f')],qs[_0xda05('0x34')](_0x766228[_0xda05('0x30')][_0xda05('0x34')]));_0x209e31['attributes']=_0x209e31[_0xda05('0x33')][_0xda05('0x35')]?_0x209e31[_0xda05('0x33')]:_0x502272[_0xda05('0x2f')];if(!_0x766228[_0xda05('0x30')][_0xda05('0x36')]('nolimit')){_0x209e31['limit']=qs[_0xda05('0x22')](_0x766228[_0xda05('0x30')][_0xda05('0x22')]);_0x209e31['offset']=qs[_0xda05('0x20')](_0x766228[_0xda05('0x30')]['offset']);}_0x209e31[_0xda05('0x37')]=qs[_0xda05('0x38')](_0x766228[_0xda05('0x30')][_0xda05('0x38')]);_0x209e31[_0xda05('0x39')]=qs['filters'](_['pick'](_0x766228['query'],_0x502272['filters']));if(_0x766228[_0xda05('0x30')][_0xda05('0x3b')]){_0x209e31[_0xda05('0x39')]=_[_0xda05('0x3c')](_0x209e31[_0xda05('0x39')],{'$or':_['map'](_0x209e31[_0xda05('0x33')],function(_0xfe55f7){var _0x69211e={};_0x69211e[_0xfe55f7]={'$like':'%'+_0x766228['query'][_0xda05('0x3b')]+'%'};return _0x69211e;})});}_0x209e31=_[_0xda05('0x3c')]({},_0x209e31,_0x766228[_0xda05('0x3f')]);var _0x18649d={'where':_0x209e31[_0xda05('0x39')]};return db['VoiceQueueReport']['count'](_0x18649d)[_0xda05('0x28')](function(_0x374ede){_0x3c82a7['count']=_0x374ede;if(_0x766228[_0xda05('0x30')][_0xda05('0x40')]){_0x209e31['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0xda05('0x4d')](_0x209e31);})[_0xda05('0x28')](function(_0x1658d2){_0x3c82a7[_0xda05('0x41')]=_0x1658d2;return _0x3c82a7;})['then'](respondWithFilteredResult(_0x1cbe83,_0x209e31,_0xda05('0x4b')))[_0xda05('0x46')](handleError(_0x1cbe83,null,_0xda05('0x4b')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 868fa62..afa9aac 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 _0x1c34=['update','remove','emit','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners'];(function(_0x2484c6,_0x17dbbd){var _0x3d09a6=function(_0x4fa0a1){while(--_0x4fa0a1){_0x2484c6['push'](_0x2484c6['shift']());}};_0x3d09a6(++_0x17dbbd);}(_0x1c34,0x1d9));var _0x41c3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c34[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x41c3('0x0'));var VoiceQueueReport=require(_0x41c3('0x1'))['db'][_0x41c3('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x41c3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x41c3('0x4'),'afterDestroy':_0x41c3('0x5')};function emitEvent(_0x5b391c){return function(_0x50f82a,_0x41cba9,_0x4fcf38){VoiceQueueReportEvents[_0x41c3('0x6')](_0x5b391c+':'+_0x50f82a['id'],_0x50f82a);VoiceQueueReportEvents[_0x41c3('0x6')](_0x5b391c,_0x50f82a);_0x4fcf38(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x41c3('0x7')](e,emitEvent(event));}}module[_0x41c3('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x4a8d=['exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x436e28,_0x215b26){var _0x364206=function(_0x2ccb3d){while(--_0x2ccb3d){_0x436e28['push'](_0x436e28['shift']());}};_0x364206(++_0x215b26);}(_0x4a8d,0x119));var _0xd4a8=function(_0x1a8f3f,_0x5b5ae4){_0x1a8f3f=_0x1a8f3f-0x0;var _0x4ef636=_0x4a8d[_0x1a8f3f];return _0x4ef636;};'use strict';var EventEmitter=require(_0xd4a8('0x0'));var VoiceQueueReport=require(_0xd4a8('0x1'))['db'][_0xd4a8('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xd4a8('0x3')](0x0);var events={'afterCreate':_0xd4a8('0x4'),'afterUpdate':_0xd4a8('0x5'),'afterDestroy':'remove'};function emitEvent(_0x9bf43d){return function(_0x3c3a4b,_0x225214,_0x51a203){VoiceQueueReportEvents[_0xd4a8('0x6')](_0x9bf43d+':'+_0x3c3a4b['id'],_0x3c3a4b);VoiceQueueReportEvents[_0xd4a8('0x6')](_0x9bf43d,_0x3c3a4b);_0x51a203(null);};}for(var e in events){if(events[_0xd4a8('0x7')](e)){var event=events[e];VoiceQueueReport[_0xd4a8('0x8')](e,emitEvent(event));}}module[_0xd4a8('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 537b089..f1353f2 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 _0xecfd=['define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','bluebird','../../config/environment','exports'];(function(_0x2fcd82,_0x3cf7d6){var _0x23cdf8=function(_0x458883){while(--_0x458883){_0x2fcd82['push'](_0x2fcd82['shift']());}};_0x23cdf8(++_0x3cf7d6);}(_0xecfd,0x13d));var _0xdecf=function(_0x3137c1,_0x535382){_0x3137c1=_0x3137c1-0x0;var _0x195276=_0xecfd[_0x3137c1];return _0x195276;};'use strict';var _=require(_0xdecf('0x0'));var util=require(_0xdecf('0x1'));var logger=require(_0xdecf('0x2'))(_0xdecf('0x3'));var moment=require('moment');var BPromise=require(_0xdecf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdecf('0x5'));var attributes=require('./voiceQueueReport.attributes');module[_0xdecf('0x6')]=function(_0x29de9,_0x504347){return _0x29de9[_0xdecf('0x7')](_0xdecf('0x8'),attributes,{'tableName':_0xdecf('0x9'),'paranoid':![],'indexes':[{'fields':[_0xdecf('0xa')]},{'fields':[_0xdecf('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9ce0=['./voiceQueueReport.attributes','exports','define','VoiceQueueReport','calleridnum','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xfc2d09,_0x3feea7){var _0x386827=function(_0x4a1bd9){while(--_0x4a1bd9){_0xfc2d09['push'](_0xfc2d09['shift']());}};_0x386827(++_0x3feea7);}(_0x9ce0,0x65));var _0x09ce=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9ce0[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x09ce('0x0'));var util=require(_0x09ce('0x1'));var logger=require(_0x09ce('0x2'))('api');var moment=require('moment');var BPromise=require(_0x09ce('0x3'));var rp=require(_0x09ce('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x09ce('0x5'));var config=require(_0x09ce('0x6'));var attributes=require(_0x09ce('0x7'));module[_0x09ce('0x8')]=function(_0x527cfa,_0x9c5c7b){return _0x527cfa[_0x09ce('0x9')](_0x09ce('0xa'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x09ce('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index fb3a0f5..19957ea 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 _0x9cc6=['update','body','limit','lodash','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','./voiceQueueReport.socket','register','request','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','VoiceQueueReport,\x20%s,\x20%s','message','result','catch','GetVoiceQueueReport','findAll','options','raw','where','attributes','include','map','model','stringify','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','VoiceQueueReport'];(function(_0x43090f,_0x16904e){var _0x4a9572=function(_0x1b9d62){while(--_0x1b9d62){_0x43090f['push'](_0x43090f['shift']());}};_0x4a9572(++_0x16904e);}(_0x9cc6,0xd0));var _0x69cc=function(_0x33155c,_0x3fdde1){_0x33155c=_0x33155c-0x0;var _0x5becf7=_0x9cc6[_0x33155c];return _0x5becf7;};'use strict';var _=require(_0x69cc('0x0'));var util=require('util');var moment=require(_0x69cc('0x1'));var BPromise=require('bluebird');var rs=require(_0x69cc('0x2'));var fs=require('fs');var Redis=require(_0x69cc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x69cc('0x4'));var logger=require('../../config/logger')(_0x69cc('0x5'));var config=require('../../config/environment');var jayson=require(_0x69cc('0x6'));var client=jayson[_0x69cc('0x7')][_0x69cc('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x69cc('0x9')],{'host':_0x69cc('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x69cc('0x9')]));require(_0x69cc('0xb'))[_0x69cc('0xc')](socket);function respondWithRpcPromise(_0x2f4ef1,_0x584525,_0x1e1b86){return new BPromise(function(_0x14a18e,_0x189cae){return client[_0x69cc('0xd')](_0x2f4ef1,_0x1e1b86)[_0x69cc('0xe')](function(_0x312874){logger[_0x69cc('0xf')]('VoiceQueueReport,\x20%s,\x20%s',_0x584525,_0x69cc('0x10'));logger[_0x69cc('0x11')](_0x69cc('0x12'),_0x584525,_0x69cc('0x10'),JSON['stringify'](_0x312874));if(_0x312874[_0x69cc('0x13')]){if(_0x312874[_0x69cc('0x13')]['code']===0x1f4){logger[_0x69cc('0x13')](_0x69cc('0x14'),_0x584525,_0x312874[_0x69cc('0x13')][_0x69cc('0x15')]);return _0x189cae(_0x312874[_0x69cc('0x13')][_0x69cc('0x15')]);}logger[_0x69cc('0x13')](_0x69cc('0x14'),_0x584525,_0x312874[_0x69cc('0x13')]['message']);return _0x14a18e(_0x312874[_0x69cc('0x13')][_0x69cc('0x15')]);}else{logger['info'](_0x69cc('0x14'),_0x584525,'request\x20sent');_0x14a18e(_0x312874[_0x69cc('0x16')][_0x69cc('0x15')]);}})[_0x69cc('0x17')](function(_0x1ee9ca){logger[_0x69cc('0x13')](_0x69cc('0x14'),_0x584525,_0x1ee9ca);_0x189cae(_0x1ee9ca);});});}exports[_0x69cc('0x18')]=function(_0x4e95c8){var _0x49d6c0=this;return new Promise(function(_0xed35b6,_0x30991f){return db['VoiceQueueReport'][_0x69cc('0x19')]({'raw':_0x4e95c8['options']?_0x4e95c8[_0x69cc('0x1a')][_0x69cc('0x1b')]===undefined?!![]:![]:!![],'where':_0x4e95c8['options']?_0x4e95c8['options'][_0x69cc('0x1c')]||null:null,'attributes':_0x4e95c8[_0x69cc('0x1a')]?_0x4e95c8[_0x69cc('0x1a')][_0x69cc('0x1d')]||null:null,'limit':_0x4e95c8[_0x69cc('0x1a')]?_0x4e95c8['options']['limit']||null:null,'include':_0x4e95c8[_0x69cc('0x1a')]?_0x4e95c8[_0x69cc('0x1a')][_0x69cc('0x1e')]?_[_0x69cc('0x1f')](_0x4e95c8[_0x69cc('0x1a')]['include'],function(_0xe6fe8b){return{'model':db[_0xe6fe8b['model']],'as':_0xe6fe8b['as'],'attributes':_0xe6fe8b[_0x69cc('0x1d')],'include':_0xe6fe8b[_0x69cc('0x1e')]?_[_0x69cc('0x1f')](_0xe6fe8b[_0x69cc('0x1e')],function(_0x326700){return{'model':db[_0x326700[_0x69cc('0x20')]],'as':_0x326700['as'],'attributes':_0x326700['attributes'],'include':_0x326700[_0x69cc('0x1e')]?_[_0x69cc('0x1f')](_0x326700[_0x69cc('0x1e')],function(_0x56a873){return{'model':db[_0x56a873[_0x69cc('0x20')]],'as':_0x56a873['as'],'attributes':_0x56a873['attributes']};}):[]};}):[]};}):[]:[]})[_0x69cc('0xe')](function(_0x4d7c55){logger[_0x69cc('0xf')](_0x69cc('0x18'),_0x4e95c8);logger[_0x69cc('0x11')]('GetVoiceQueueReport',_0x4e95c8,JSON[_0x69cc('0x21')](_0x4d7c55));_0xed35b6(_0x4d7c55);})[_0x69cc('0x17')](function(_0xfd42b4){logger[_0x69cc('0x13')](_0x69cc('0x18'),_0xfd42b4[_0x69cc('0x15')],_0x4e95c8);_0x30991f(_0x49d6c0[_0x69cc('0x13')](0x1f4,_0xfd42b4[_0x69cc('0x15')]));});});};exports[_0x69cc('0x22')]=function(_0x48a2dd){var _0xa9acce=this;return new Promise(function(_0xe519c5,_0xc2935f){return db['VoiceQueueReport'][_0x69cc('0x23')](_0x48a2dd['body'],{'raw':_0x48a2dd[_0x69cc('0x1a')]?_0x48a2dd[_0x69cc('0x1a')][_0x69cc('0x1b')]===undefined?!![]:![]:!![]})[_0x69cc('0xe')](function(_0x455ba9){logger[_0x69cc('0xf')](_0x69cc('0x22'),_0x48a2dd);logger['debug'](_0x69cc('0x22'),_0x48a2dd,JSON[_0x69cc('0x21')](_0x455ba9));_0xe519c5(_0x455ba9);})[_0x69cc('0x17')](function(_0x5c2fdf){logger[_0x69cc('0x13')](_0x69cc('0x22'),_0x5c2fdf['message'],_0x48a2dd);_0xc2935f(_0xa9acce[_0x69cc('0x13')](0x1f4,_0x5c2fdf[_0x69cc('0x15')]));});});};exports[_0x69cc('0x24')]=function(_0x5468f4){var _0x5b0323=this;return new Promise(function(_0x393c7e,_0x3c88d8){return db[_0x69cc('0x25')][_0x69cc('0x26')](_0x5468f4[_0x69cc('0x27')],{'raw':_0x5468f4['options']?_0x5468f4['options'][_0x69cc('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5468f4[_0x69cc('0x1a')]?_0x5468f4[_0x69cc('0x1a')][_0x69cc('0x1c')]||null:null,'attributes':_0x5468f4[_0x69cc('0x1a')]?_0x5468f4[_0x69cc('0x1a')]['attributes']||null:null,'limit':_0x5468f4['options']?_0x5468f4['options'][_0x69cc('0x28')]||null:null})['then'](function(_0x3e9765){logger[_0x69cc('0xf')](_0x69cc('0x24'),_0x5468f4);logger[_0x69cc('0x11')](_0x69cc('0x24'),_0x5468f4,JSON['stringify'](_0x3e9765));_0x393c7e(_0x3e9765);})[_0x69cc('0x17')](function(_0x12a432){logger['error'](_0x69cc('0x24'),_0x12a432[_0x69cc('0x15')],_0x5468f4);_0x3c88d8(_0x5b0323['error'](0x1f4,_0x12a432[_0x69cc('0x15')]));});});}; \ No newline at end of file +var _0x4cda=['then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','map','model','include','catch','CreateVoiceQueueReport','body','limit','UpdateVoiceQueueReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','defaults','redis','localhost','./voiceQueueReport.socket','request'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x4cda,0x110));var _0xa4cd=function(_0x4fbb86,_0x374ed0){_0x4fbb86=_0x4fbb86-0x0;var _0xb141fe=_0x4cda[_0x4fbb86];return _0xb141fe;};'use strict';var _=require(_0xa4cd('0x0'));var util=require(_0xa4cd('0x1'));var moment=require('moment');var BPromise=require(_0xa4cd('0x2'));var rs=require(_0xa4cd('0x3'));var fs=require('fs');var Redis=require(_0xa4cd('0x4'));var db=require(_0xa4cd('0x5'))['db'];var utils=require(_0xa4cd('0x6'));var logger=require(_0xa4cd('0x7'))('rpc');var config=require(_0xa4cd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa4cd('0x9')]['http']({'port':0x232a});config['redis']=_[_0xa4cd('0xa')](config[_0xa4cd('0xb')],{'host':_0xa4cd('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa4cd('0xb')]));require(_0xa4cd('0xd'))['register'](socket);function respondWithRpcPromise(_0x417d5c,_0xdd7403,_0x170ac4){return new BPromise(function(_0x425740,_0x610d3f){return client[_0xa4cd('0xe')](_0x417d5c,_0x170ac4)[_0xa4cd('0xf')](function(_0x14a280){logger[_0xa4cd('0x10')](_0xa4cd('0x11'),_0xdd7403,_0xa4cd('0x12'));logger[_0xa4cd('0x13')](_0xa4cd('0x14'),_0xdd7403,_0xa4cd('0x12'),JSON[_0xa4cd('0x15')](_0x14a280));if(_0x14a280[_0xa4cd('0x16')]){if(_0x14a280[_0xa4cd('0x16')][_0xa4cd('0x17')]===0x1f4){logger[_0xa4cd('0x16')](_0xa4cd('0x11'),_0xdd7403,_0x14a280[_0xa4cd('0x16')][_0xa4cd('0x18')]);return _0x610d3f(_0x14a280[_0xa4cd('0x16')]['message']);}logger[_0xa4cd('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0xdd7403,_0x14a280[_0xa4cd('0x16')][_0xa4cd('0x18')]);return _0x425740(_0x14a280[_0xa4cd('0x16')][_0xa4cd('0x18')]);}else{logger[_0xa4cd('0x10')](_0xa4cd('0x11'),_0xdd7403,_0xa4cd('0x12'));_0x425740(_0x14a280[_0xa4cd('0x19')][_0xa4cd('0x18')]);}})['catch'](function(_0x232587){logger[_0xa4cd('0x16')](_0xa4cd('0x11'),_0xdd7403,_0x232587);_0x610d3f(_0x232587);});});}exports[_0xa4cd('0x1a')]=function(_0x447076){var _0x2f6e15=this;return new Promise(function(_0x5dd851,_0x22f5c7){return db[_0xa4cd('0x1b')][_0xa4cd('0x1c')]({'raw':_0x447076[_0xa4cd('0x1d')]?_0x447076[_0xa4cd('0x1d')][_0xa4cd('0x1e')]===undefined?!![]:![]:!![],'where':_0x447076[_0xa4cd('0x1d')]?_0x447076[_0xa4cd('0x1d')][_0xa4cd('0x1f')]||null:null,'attributes':_0x447076[_0xa4cd('0x1d')]?_0x447076['options'][_0xa4cd('0x20')]||null:null,'limit':_0x447076[_0xa4cd('0x1d')]?_0x447076[_0xa4cd('0x1d')]['limit']||null:null,'include':_0x447076[_0xa4cd('0x1d')]?_0x447076[_0xa4cd('0x1d')]['include']?_[_0xa4cd('0x21')](_0x447076['options']['include'],function(_0x703283){return{'model':db[_0x703283[_0xa4cd('0x22')]],'as':_0x703283['as'],'attributes':_0x703283['attributes'],'include':_0x703283['include']?_[_0xa4cd('0x21')](_0x703283['include'],function(_0x4555a2){return{'model':db[_0x4555a2[_0xa4cd('0x22')]],'as':_0x4555a2['as'],'attributes':_0x4555a2[_0xa4cd('0x20')],'include':_0x4555a2[_0xa4cd('0x23')]?_[_0xa4cd('0x21')](_0x4555a2[_0xa4cd('0x23')],function(_0x41b9e4){return{'model':db[_0x41b9e4[_0xa4cd('0x22')]],'as':_0x41b9e4['as'],'attributes':_0x41b9e4[_0xa4cd('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46cf31){logger[_0xa4cd('0x10')](_0xa4cd('0x1a'),_0x447076);logger[_0xa4cd('0x13')]('GetVoiceQueueReport',_0x447076,JSON[_0xa4cd('0x15')](_0x46cf31));_0x5dd851(_0x46cf31);})[_0xa4cd('0x24')](function(_0x57ab2b){logger['error'](_0xa4cd('0x1a'),_0x57ab2b[_0xa4cd('0x18')],_0x447076);_0x22f5c7(_0x2f6e15[_0xa4cd('0x16')](0x1f4,_0x57ab2b[_0xa4cd('0x18')]));});});};exports[_0xa4cd('0x25')]=function(_0x4defce){var _0x2fe20a=this;return new Promise(function(_0x4ce997,_0x1039b6){return db[_0xa4cd('0x1b')]['create'](_0x4defce[_0xa4cd('0x26')],{'raw':_0x4defce[_0xa4cd('0x1d')]?_0x4defce[_0xa4cd('0x1d')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x19632e){logger['info']('CreateVoiceQueueReport',_0x4defce);logger[_0xa4cd('0x13')]('CreateVoiceQueueReport',_0x4defce,JSON[_0xa4cd('0x15')](_0x19632e));_0x4ce997(_0x19632e);})['catch'](function(_0x4bb258){logger[_0xa4cd('0x16')](_0xa4cd('0x25'),_0x4bb258['message'],_0x4defce);_0x1039b6(_0x2fe20a[_0xa4cd('0x16')](0x1f4,_0x4bb258[_0xa4cd('0x18')]));});});};exports['UpdateVoiceQueueReport']=function(_0x53dfa2){var _0x154451=this;return new Promise(function(_0x5d8706,_0x3b50d2){return db[_0xa4cd('0x1b')]['update'](_0x53dfa2['body'],{'raw':_0x53dfa2['options']?_0x53dfa2['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53dfa2[_0xa4cd('0x1d')]?_0x53dfa2[_0xa4cd('0x1d')]['where']||null:null,'attributes':_0x53dfa2[_0xa4cd('0x1d')]?_0x53dfa2['options'][_0xa4cd('0x20')]||null:null,'limit':_0x53dfa2['options']?_0x53dfa2[_0xa4cd('0x1d')][_0xa4cd('0x27')]||null:null})[_0xa4cd('0xf')](function(_0x99f85f){logger[_0xa4cd('0x10')]('UpdateVoiceQueueReport',_0x53dfa2);logger[_0xa4cd('0x13')](_0xa4cd('0x28'),_0x53dfa2,JSON[_0xa4cd('0x15')](_0x99f85f));_0x5d8706(_0x99f85f);})[_0xa4cd('0x24')](function(_0x4ab83b){logger[_0xa4cd('0x16')]('UpdateVoiceQueueReport',_0x4ab83b[_0xa4cd('0x18')],_0x53dfa2);_0x3b50d2(_0x154451['error'](0x1f4,_0x4ab83b[_0xa4cd('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index c177b00..6ffb7fd 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 _0x1da9=['voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit','removeListener','register'];(function(_0x8e144b,_0x36ffc0){var _0x3e4c93=function(_0x4b303a){while(--_0x4b303a){_0x8e144b['push'](_0x8e144b['shift']());}};_0x3e4c93(++_0x36ffc0);}(_0x1da9,0x141));var _0x91da=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x1da9[_0x56482c];return _0x5aae7a;};'use strict';var VoiceQueueReportEvents=require(_0x91da('0x0'));var events=[_0x91da('0x1'),_0x91da('0x2'),_0x91da('0x3')];function createListener(_0x18bb47,_0x3bb4f8){return function(_0x2526ae){_0x3bb4f8[_0x91da('0x4')](_0x18bb47,_0x2526ae);};}function removeListener(_0x2f6adf,_0x3bfd6d){return function(){VoiceQueueReportEvents[_0x91da('0x5')](_0x2f6adf,_0x3bfd6d);};}exports[_0x91da('0x6')]=function(_0x396335){for(var _0x23a881=0x0,_0x463ad9=events['length'];_0x23a881<_0x463ad9;_0x23a881++){var _0x5e8bab=events[_0x23a881];var _0x1fd3b9=createListener(_0x91da('0x7')+_0x5e8bab,_0x396335);VoiceQueueReportEvents['on'](_0x5e8bab,_0x1fd3b9);}}; \ No newline at end of file +var _0xdca7=['removeListener','voiceQueueReport:','./voiceQueueReport.events','remove','update','emit'];(function(_0x3c0f9b,_0x45d05d){var _0x121159=function(_0x5be028){while(--_0x5be028){_0x3c0f9b['push'](_0x3c0f9b['shift']());}};_0x121159(++_0x45d05d);}(_0xdca7,0xe6));var _0x7dca=function(_0x395ea6,_0xafee43){_0x395ea6=_0x395ea6-0x0;var _0x1294ec=_0xdca7[_0x395ea6];return _0x1294ec;};'use strict';var VoiceQueueReportEvents=require(_0x7dca('0x0'));var events=['save',_0x7dca('0x1'),_0x7dca('0x2')];function createListener(_0x189505,_0x5e5ed4){return function(_0x3eca32){_0x5e5ed4[_0x7dca('0x3')](_0x189505,_0x3eca32);};}function removeListener(_0x4adb53,_0x52623e){return function(){VoiceQueueReportEvents[_0x7dca('0x4')](_0x4adb53,_0x52623e);};}exports['register']=function(_0x51d88b){for(var _0x514d8d=0x0,_0xbc4387=events['length'];_0x514d8d<_0xbc4387;_0x514d8d++){var _0x5a27cc=events[_0x514d8d];var _0x38cb81=createListener(_0x7dca('0x5')+_0x5a27cc,_0x51d88b);VoiceQueueReportEvents['on'](_0x5a27cc,_0x38cb81);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 086f210..5fe196e 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 _0x83f1=['update','delete','destroy','util','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','put'];(function(_0x3592ba,_0x150f4b){var _0x2227c6=function(_0x217752){while(--_0x217752){_0x3592ba['push'](_0x3592ba['shift']());}};_0x2227c6(++_0x150f4b);}(_0x83f1,0xa8));var _0x183f=function(_0x3737f9,_0x3ab5d7){_0x3737f9=_0x3737f9-0x0;var _0x43ef9a=_0x83f1[_0x3737f9];return _0x43ef9a;};'use strict';var multer=require('multer');var util=require(_0x183f('0x0'));var path=require('path');var timeout=require(_0x183f('0x1'));var express=require(_0x183f('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x183f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x183f('0x4'));var controller=require(_0x183f('0x5'));router[_0x183f('0x6')]('/',auth[_0x183f('0x7')](),controller[_0x183f('0x8')]);router['get'](_0x183f('0x9'),auth['isAuthenticated'](),controller[_0x183f('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x183f('0xb')](_0x183f('0x9'),auth[_0x183f('0x7')](),controller[_0x183f('0xc')]);router[_0x183f('0xd')](_0x183f('0x9'),auth['isAuthenticated'](),controller[_0x183f('0xe')]);module['exports']=router; \ No newline at end of file +var _0x23f2=['create','update','delete','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','post'];(function(_0x31b60f,_0x4edb24){var _0x2dc74e=function(_0x1c3943){while(--_0x1c3943){_0x31b60f['push'](_0x31b60f['shift']());}};_0x2dc74e(++_0x4edb24);}(_0x23f2,0x1ce));var _0x223f=function(_0x47b873,_0x997d98){_0x47b873=_0x47b873-0x0;var _0x193f5a=_0x23f2[_0x47b873];return _0x193f5a;};'use strict';var multer=require('multer');var util=require(_0x223f('0x0'));var path=require(_0x223f('0x1'));var timeout=require(_0x223f('0x2'));var express=require(_0x223f('0x3'));var router=express['Router']();var fs_extra=require(_0x223f('0x4'));var auth=require(_0x223f('0x5'));var interaction=require(_0x223f('0x6'));var config=require(_0x223f('0x7'));var controller=require(_0x223f('0x8'));router[_0x223f('0x9')]('/',auth[_0x223f('0xa')](),controller[_0x223f('0xb')]);router['get'](_0x223f('0xc'),auth[_0x223f('0xa')](),controller['show']);router[_0x223f('0xd')]('/',auth['isAuthenticated'](),controller[_0x223f('0xe')]);router['put'](_0x223f('0xc'),auth[_0x223f('0xa')](),controller[_0x223f('0xf')]);router[_0x223f('0x10')](_0x223f('0xc'),auth[_0x223f('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 91bfad1..95614cc 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 _0x3457=['STRING','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4dc334,_0x564017){var _0x16d060=function(_0x239273){while(--_0x239273){_0x4dc334['push'](_0x4dc334['shift']());}};_0x16d060(++_0x564017);}(_0x3457,0x93));var _0x7345=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3457[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x7345('0x0')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x7345('0x0')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x7345('0x0')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x7345('0x0')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x7345('0x0')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x7345('0x0')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x7345('0x0')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x7345('0x1')](_0x7345('0x2'))}}; \ No newline at end of file +var _0x4ffa=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment'];(function(_0x3fcbc9,_0x506bca){var _0x5bf577=function(_0x40b244){while(--_0x40b244){_0x3fcbc9['push'](_0x3fcbc9['shift']());}};_0x5bf577(++_0x506bca);}(_0x4ffa,0x130));var _0xa4ff=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x4ffa[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0xa4ff('0x0'));var moment=require(_0xa4ff('0x1'));module['exports']={'time':{'type':Sequelize[_0xa4ff('0x2')]},'callid':{'type':Sequelize[_0xa4ff('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xa4ff('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa4ff('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xa4ff('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa4ff('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xa4ff('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa4ff('0x3')],'allowNull':![],'defaultValue':moment()[_0xa4ff('0x4')](_0xa4ff('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 97f4ba4..b945938 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 _0xcf94=['squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','nolimit','order','where','filters','VIRTUAL','filter','merge','include','findAll','rows','catch','params','includeAll','options','find','create','body','eml-format','rimraf','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash'];(function(_0xea3d6b,_0x39ef34){var _0x2fb5c1=function(_0x3c0954){while(--_0x3c0954){_0xea3d6b['push'](_0xea3d6b['shift']());}};_0x2fb5c1(++_0x39ef34);}(_0xcf94,0x88));var _0x4cf9=function(_0x3df4d6,_0x38ffce){_0x3df4d6=_0x3df4d6-0x0;var _0x1bbc20=_0xcf94[_0x3df4d6];return _0x1bbc20;};'use strict';var emlformat=require(_0x4cf9('0x0'));var rimraf=require(_0x4cf9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4cf9('0x2'));var moment=require(_0x4cf9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4cf9('0x4'));var util=require('util');var path=require(_0x4cf9('0x5'));var sox=require(_0x4cf9('0x6'));var csv=require('to-csv');var ejs=require(_0x4cf9('0x7'));var fs=require('fs');var fs_extra=require(_0x4cf9('0x8'));var _=require(_0x4cf9('0x9'));var squel=require(_0x4cf9('0xa'));var crypto=require(_0x4cf9('0xb'));var jsforce=require(_0x4cf9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4cf9('0xd'));var querystring=require('querystring');var Papa=require(_0x4cf9('0xe'));var Redis=require(_0x4cf9('0xf'));var authService=require(_0x4cf9('0x10'));var qs=require(_0x4cf9('0x11'));var as=require(_0x4cf9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4cf9('0x13'));var utils=require(_0x4cf9('0x14'));var config=require(_0x4cf9('0x15'));var licenseUtil=require(_0x4cf9('0x16'));var db=require(_0x4cf9('0x17'))['db'];function respondWithStatusCode(_0x39a770,_0x1da7d0){_0x1da7d0=_0x1da7d0||0xcc;return function(_0x4f5934){if(_0x4f5934){return _0x39a770[_0x4cf9('0x18')](_0x1da7d0);}return _0x39a770['status'](_0x1da7d0)['end']();};}function respondWithResult(_0x1325c5,_0x589fc9){_0x589fc9=_0x589fc9||0xc8;return function(_0x27b140){if(_0x27b140){return _0x1325c5[_0x4cf9('0x19')](_0x589fc9)['json'](_0x27b140);}};}function respondWithFilteredResult(_0x552434,_0x4a2834){return function(_0x2f95a6){if(_0x2f95a6){var _0x3a075b=typeof _0x4a2834[_0x4cf9('0x1a')]===_0x4cf9('0x1b')&&typeof _0x4a2834[_0x4cf9('0x1c')]===_0x4cf9('0x1b');var _0x6c0a8d=_0x2f95a6['count'];var _0x4f5d36=_0x3a075b?0x0:_0x4a2834['offset'];var _0x2f6697=_0x3a075b?_0x2f95a6[_0x4cf9('0x1d')]:_0x4a2834['offset']+_0x4a2834[_0x4cf9('0x1c')];var _0x52432a;if(_0x2f6697>=_0x6c0a8d){_0x2f6697=_0x6c0a8d;_0x52432a=0xc8;}else{_0x52432a=0xce;}_0x552434['status'](_0x52432a);return _0x552434[_0x4cf9('0x1e')](_0x4cf9('0x1f'),_0x4f5d36+'-'+_0x2f6697+'/'+_0x6c0a8d)['json'](_0x2f95a6);}return null;};}function patchUpdates(_0x5c7d61){return function(_0x22034d){try{jsonpatch[_0x4cf9('0x20')](_0x22034d,_0x5c7d61,!![]);}catch(_0x47e2f7){return BPromise[_0x4cf9('0x21')](_0x47e2f7);}return _0x22034d[_0x4cf9('0x22')]();};}function saveUpdates(_0x404c13,_0x5cb775){return function(_0x2dff90){if(_0x2dff90){return _0x2dff90[_0x4cf9('0x23')](_0x404c13)[_0x4cf9('0x24')](function(_0x344fac){return _0x344fac;});}return null;};}function removeEntity(_0x3d574f,_0x2856b5){return function(_0x3c930f){if(_0x3c930f){return _0x3c930f[_0x4cf9('0x25')]()[_0x4cf9('0x24')](function(){_0x3d574f[_0x4cf9('0x19')](0xcc)[_0x4cf9('0x26')]();});}};}function handleEntityNotFound(_0x1d0864,_0x4ced5c){return function(_0x38878b){if(!_0x38878b){_0x1d0864[_0x4cf9('0x18')](0x194);}return _0x38878b;};}function handleError(_0x6eea7,_0x1b922d){_0x1b922d=_0x1b922d||0x1f4;return function(_0x8168e3){logger['error'](_0x8168e3[_0x4cf9('0x27')]);if(_0x8168e3[_0x4cf9('0x28')]){delete _0x8168e3[_0x4cf9('0x28')];}_0x6eea7[_0x4cf9('0x19')](_0x1b922d)[_0x4cf9('0x29')](_0x8168e3);};}exports[_0x4cf9('0x2a')]=function(_0xa3ae4b,_0x1c2d0e){var _0x9a9a67={},_0x18c310={},_0xa9ce35={'count':0x0,'rows':[]};var _0x22ab22=_['map'](db[_0x4cf9('0x2b')][_0x4cf9('0x2c')],function(_0x13fb92){return{'name':_0x13fb92[_0x4cf9('0x2d')],'type':_0x13fb92[_0x4cf9('0x2e')][_0x4cf9('0x2f')]};});_0x18c310[_0x4cf9('0x30')]=_[_0x4cf9('0x31')](_0x22ab22,_0x4cf9('0x28'));_0x18c310[_0x4cf9('0x32')]=_[_0x4cf9('0x33')](_0xa3ae4b[_0x4cf9('0x32')]);_0x18c310['filters']=_['intersection'](_0x18c310[_0x4cf9('0x30')],_0x18c310[_0x4cf9('0x32')]);_0x9a9a67[_0x4cf9('0x34')]=_[_0x4cf9('0x35')](_0x18c310[_0x4cf9('0x30')],qs[_0x4cf9('0x36')](_0xa3ae4b[_0x4cf9('0x32')][_0x4cf9('0x36')]));_0x9a9a67[_0x4cf9('0x34')]=_0x9a9a67[_0x4cf9('0x34')][_0x4cf9('0x37')]?_0x9a9a67[_0x4cf9('0x34')]:_0x18c310[_0x4cf9('0x30')];if(!_0xa3ae4b[_0x4cf9('0x32')]['hasOwnProperty'](_0x4cf9('0x38'))){_0x9a9a67[_0x4cf9('0x1c')]=qs['limit'](_0xa3ae4b['query'][_0x4cf9('0x1c')]);_0x9a9a67[_0x4cf9('0x1a')]=qs[_0x4cf9('0x1a')](_0xa3ae4b[_0x4cf9('0x32')][_0x4cf9('0x1a')]);}_0x9a9a67[_0x4cf9('0x39')]=qs['sort'](_0xa3ae4b[_0x4cf9('0x32')]['sort']);_0x9a9a67[_0x4cf9('0x3a')]=qs[_0x4cf9('0x3b')](_['pick'](_0xa3ae4b[_0x4cf9('0x32')],_0x18c310[_0x4cf9('0x3b')]),_0x22ab22);if(_0xa3ae4b[_0x4cf9('0x32')]['filter']){_0x9a9a67[_0x4cf9('0x3a')]=_['merge'](_0x9a9a67[_0x4cf9('0x3a')],{'$or':_[_0x4cf9('0x31')](_0x22ab22,function(_0x39c848){if(_0x39c848[_0x4cf9('0x2e')]!==_0x4cf9('0x3c')){var _0x5befd9={};_0x5befd9[_0x39c848[_0x4cf9('0x28')]]={'$like':'%'+_0xa3ae4b[_0x4cf9('0x32')][_0x4cf9('0x3d')]+'%'};return _0x5befd9;}})});}_0x9a9a67=_[_0x4cf9('0x3e')]({},_0x9a9a67,_0xa3ae4b['options']);var _0x194c99={'where':_0x9a9a67[_0x4cf9('0x3a')]};return db[_0x4cf9('0x2b')][_0x4cf9('0x1d')](_0x194c99)[_0x4cf9('0x24')](function(_0x4a58fa){_0xa9ce35['count']=_0x4a58fa;if(_0xa3ae4b[_0x4cf9('0x32')]['includeAll']){_0x9a9a67[_0x4cf9('0x3f')]=[{'all':!![]}];}return db[_0x4cf9('0x2b')][_0x4cf9('0x40')](_0x9a9a67);})['then'](function(_0x408708){_0xa9ce35[_0x4cf9('0x41')]=_0x408708;return _0xa9ce35;})[_0x4cf9('0x24')](respondWithFilteredResult(_0x1c2d0e,_0x9a9a67))[_0x4cf9('0x42')](handleError(_0x1c2d0e,null));};exports['show']=function(_0x404aba,_0x5886ba){var _0x5dc341={'raw':!![],'where':{'id':_0x404aba[_0x4cf9('0x43')]['id']}},_0x46aae0={};_0x46aae0[_0x4cf9('0x30')]=_[_0x4cf9('0x33')](db[_0x4cf9('0x2b')]['rawAttributes']);_0x46aae0[_0x4cf9('0x32')]=_[_0x4cf9('0x33')](_0x404aba[_0x4cf9('0x32')]);_0x46aae0[_0x4cf9('0x3b')]=_['intersection'](_0x46aae0['model'],_0x46aae0[_0x4cf9('0x32')]);_0x5dc341[_0x4cf9('0x34')]=_[_0x4cf9('0x35')](_0x46aae0[_0x4cf9('0x30')],qs[_0x4cf9('0x36')](_0x404aba[_0x4cf9('0x32')][_0x4cf9('0x36')]));_0x5dc341[_0x4cf9('0x34')]=_0x5dc341[_0x4cf9('0x34')]['length']?_0x5dc341[_0x4cf9('0x34')]:_0x46aae0[_0x4cf9('0x30')];if(_0x404aba[_0x4cf9('0x32')][_0x4cf9('0x44')]){_0x5dc341[_0x4cf9('0x3f')]=[{'all':!![]}];}_0x5dc341=_[_0x4cf9('0x3e')]({},_0x5dc341,_0x404aba[_0x4cf9('0x45')]);return db[_0x4cf9('0x2b')][_0x4cf9('0x46')](_0x5dc341)['then'](handleEntityNotFound(_0x5886ba,null))[_0x4cf9('0x24')](respondWithResult(_0x5886ba,null))['catch'](handleError(_0x5886ba,null));};exports[_0x4cf9('0x47')]=function(_0x28a444,_0x264ed8){return db[_0x4cf9('0x2b')][_0x4cf9('0x47')](_0x28a444['body'],{})[_0x4cf9('0x24')](respondWithResult(_0x264ed8,0xc9))[_0x4cf9('0x42')](handleError(_0x264ed8,null));};exports[_0x4cf9('0x23')]=function(_0x276897,_0xdfa0b2){if(_0x276897[_0x4cf9('0x48')]['id']){delete _0x276897[_0x4cf9('0x48')]['id'];}return db[_0x4cf9('0x2b')]['find']({'where':{'id':_0x276897['params']['id']}})[_0x4cf9('0x24')](handleEntityNotFound(_0xdfa0b2,null))['then'](saveUpdates(_0x276897[_0x4cf9('0x48')],null))[_0x4cf9('0x24')](respondWithResult(_0xdfa0b2,null))['catch'](handleError(_0xdfa0b2,null));};exports[_0x4cf9('0x25')]=function(_0x37de45,_0x2bb52a){return db[_0x4cf9('0x2b')]['find']({'where':{'id':_0x37de45[_0x4cf9('0x43')]['id']}})[_0x4cf9('0x24')](handleEntityNotFound(_0x2bb52a,null))[_0x4cf9('0x24')](removeEntity(_0x2bb52a,null))['catch'](handleError(_0x2bb52a,null));}; \ No newline at end of file +var _0x3615=['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','end','status','json','offset','limit','count','Content-Range','apply','update','destroy','then','error','stack','name','send','VoiceQueuesLog','rawAttributes','fieldName','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','options','includeAll','include','catch','params','keys','find','body','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x3f16ca,_0x3af7b2){var _0x52c3e9=function(_0x2b59a9){while(--_0x2b59a9){_0x3f16ca['push'](_0x3f16ca['shift']());}};_0x52c3e9(++_0x3af7b2);}(_0x3615,0x14c));var _0x5361=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x3615[_0x21549c];return _0x426cbd;};'use strict';var emlformat=require(_0x5361('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5361('0x1'));var jsonpatch=require(_0x5361('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5361('0x3'));var Mustache=require(_0x5361('0x4'));var util=require(_0x5361('0x5'));var path=require(_0x5361('0x6'));var sox=require(_0x5361('0x7'));var csv=require(_0x5361('0x8'));var ejs=require(_0x5361('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5361('0xa'));var squel=require(_0x5361('0xb'));var crypto=require(_0x5361('0xc'));var jsforce=require(_0x5361('0xd'));var deskjs=require(_0x5361('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5361('0xf'));var Papa=require(_0x5361('0x10'));var Redis=require(_0x5361('0x11'));var authService=require(_0x5361('0x12'));var qs=require(_0x5361('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5361('0x14'));var logger=require(_0x5361('0x15'))('api');var utils=require(_0x5361('0x16'));var config=require(_0x5361('0x17'));var licenseUtil=require(_0x5361('0x18'));var db=require(_0x5361('0x19'))['db'];function respondWithStatusCode(_0x5abee3,_0x259d9b){_0x259d9b=_0x259d9b||0xcc;return function(_0x4a66a2){if(_0x4a66a2){return _0x5abee3[_0x5361('0x1a')](_0x259d9b);}return _0x5abee3['status'](_0x259d9b)[_0x5361('0x1b')]();};}function respondWithResult(_0x14a4eb,_0x24fe80){_0x24fe80=_0x24fe80||0xc8;return function(_0x35ee9f){if(_0x35ee9f){return _0x14a4eb[_0x5361('0x1c')](_0x24fe80)[_0x5361('0x1d')](_0x35ee9f);}};}function respondWithFilteredResult(_0x1fe643,_0xf9c747){return function(_0x285e9c){if(_0x285e9c){var _0x27316c=typeof _0xf9c747[_0x5361('0x1e')]==='undefined'&&typeof _0xf9c747[_0x5361('0x1f')]==='undefined';var _0x5ef65e=_0x285e9c[_0x5361('0x20')];var _0x12701e=_0x27316c?0x0:_0xf9c747[_0x5361('0x1e')];var _0x1a250d=_0x27316c?_0x285e9c[_0x5361('0x20')]:_0xf9c747[_0x5361('0x1e')]+_0xf9c747[_0x5361('0x1f')];var _0x36ee43;if(_0x1a250d>=_0x5ef65e){_0x1a250d=_0x5ef65e;_0x36ee43=0xc8;}else{_0x36ee43=0xce;}_0x1fe643[_0x5361('0x1c')](_0x36ee43);return _0x1fe643['set'](_0x5361('0x21'),_0x12701e+'-'+_0x1a250d+'/'+_0x5ef65e)[_0x5361('0x1d')](_0x285e9c);}return null;};}function patchUpdates(_0x4dc74f){return function(_0x30dcae){try{jsonpatch[_0x5361('0x22')](_0x30dcae,_0x4dc74f,!![]);}catch(_0x2dd16e){return BPromise['reject'](_0x2dd16e);}return _0x30dcae['save']();};}function saveUpdates(_0xc48a9e,_0x39a050){return function(_0x3803b6){if(_0x3803b6){return _0x3803b6[_0x5361('0x23')](_0xc48a9e)['then'](function(_0x36fb12){return _0x36fb12;});}return null;};}function removeEntity(_0x419e81,_0x27f33c){return function(_0x986d9b){if(_0x986d9b){return _0x986d9b[_0x5361('0x24')]()[_0x5361('0x25')](function(){_0x419e81[_0x5361('0x1c')](0xcc)[_0x5361('0x1b')]();});}};}function handleEntityNotFound(_0x2c907f,_0x51dc7f){return function(_0x3ff260){if(!_0x3ff260){_0x2c907f['sendStatus'](0x194);}return _0x3ff260;};}function handleError(_0x16ccf0,_0x47a1a4){_0x47a1a4=_0x47a1a4||0x1f4;return function(_0x22b764){logger[_0x5361('0x26')](_0x22b764[_0x5361('0x27')]);if(_0x22b764[_0x5361('0x28')]){delete _0x22b764[_0x5361('0x28')];}_0x16ccf0['status'](_0x47a1a4)[_0x5361('0x29')](_0x22b764);};}exports['index']=function(_0x32b91d,_0x2f5ccc){var _0x594515={},_0x21eace={},_0x58e231={'count':0x0,'rows':[]};var _0x41f590=_['map'](db[_0x5361('0x2a')][_0x5361('0x2b')],function(_0x1089d1){return{'name':_0x1089d1[_0x5361('0x2c')],'type':_0x1089d1['type'][_0x5361('0x2d')]};});_0x21eace['model']=_[_0x5361('0x2e')](_0x41f590,_0x5361('0x28'));_0x21eace[_0x5361('0x2f')]=_['keys'](_0x32b91d['query']);_0x21eace[_0x5361('0x30')]=_[_0x5361('0x31')](_0x21eace[_0x5361('0x32')],_0x21eace[_0x5361('0x2f')]);_0x594515[_0x5361('0x33')]=_[_0x5361('0x31')](_0x21eace[_0x5361('0x32')],qs[_0x5361('0x34')](_0x32b91d[_0x5361('0x2f')]['fields']));_0x594515[_0x5361('0x33')]=_0x594515[_0x5361('0x33')][_0x5361('0x35')]?_0x594515[_0x5361('0x33')]:_0x21eace[_0x5361('0x32')];if(!_0x32b91d[_0x5361('0x2f')][_0x5361('0x36')]('nolimit')){_0x594515[_0x5361('0x1f')]=qs[_0x5361('0x1f')](_0x32b91d[_0x5361('0x2f')][_0x5361('0x1f')]);_0x594515['offset']=qs[_0x5361('0x1e')](_0x32b91d['query']['offset']);}_0x594515[_0x5361('0x37')]=qs[_0x5361('0x38')](_0x32b91d[_0x5361('0x2f')][_0x5361('0x38')]);_0x594515[_0x5361('0x39')]=qs[_0x5361('0x30')](_['pick'](_0x32b91d[_0x5361('0x2f')],_0x21eace['filters']),_0x41f590);if(_0x32b91d['query'][_0x5361('0x3a')]){_0x594515['where']=_[_0x5361('0x3b')](_0x594515['where'],{'$or':_[_0x5361('0x2e')](_0x41f590,function(_0x491f71){if(_0x491f71[_0x5361('0x3c')]!=='VIRTUAL'){var _0x166619={};_0x166619[_0x491f71['name']]={'$like':'%'+_0x32b91d['query']['filter']+'%'};return _0x166619;}})});}_0x594515=_['merge']({},_0x594515,_0x32b91d[_0x5361('0x3d')]);var _0x420039={'where':_0x594515['where']};return db['VoiceQueuesLog'][_0x5361('0x20')](_0x420039)[_0x5361('0x25')](function(_0x1d02fa){_0x58e231[_0x5361('0x20')]=_0x1d02fa;if(_0x32b91d['query'][_0x5361('0x3e')]){_0x594515[_0x5361('0x3f')]=[{'all':!![]}];}return db[_0x5361('0x2a')]['findAll'](_0x594515);})['then'](function(_0x180cf6){_0x58e231['rows']=_0x180cf6;return _0x58e231;})['then'](respondWithFilteredResult(_0x2f5ccc,_0x594515))[_0x5361('0x40')](handleError(_0x2f5ccc,null));};exports['show']=function(_0xa17d84,_0x3a4c01){var _0x5c8e75={'raw':!![],'where':{'id':_0xa17d84[_0x5361('0x41')]['id']}},_0x2e2b2c={};_0x2e2b2c[_0x5361('0x32')]=_[_0x5361('0x42')](db[_0x5361('0x2a')]['rawAttributes']);_0x2e2b2c['query']=_[_0x5361('0x42')](_0xa17d84['query']);_0x2e2b2c[_0x5361('0x30')]=_[_0x5361('0x31')](_0x2e2b2c[_0x5361('0x32')],_0x2e2b2c[_0x5361('0x2f')]);_0x5c8e75['attributes']=_['intersection'](_0x2e2b2c[_0x5361('0x32')],qs[_0x5361('0x34')](_0xa17d84[_0x5361('0x2f')]['fields']));_0x5c8e75['attributes']=_0x5c8e75['attributes']['length']?_0x5c8e75['attributes']:_0x2e2b2c[_0x5361('0x32')];if(_0xa17d84[_0x5361('0x2f')][_0x5361('0x3e')]){_0x5c8e75[_0x5361('0x3f')]=[{'all':!![]}];}_0x5c8e75=_[_0x5361('0x3b')]({},_0x5c8e75,_0xa17d84[_0x5361('0x3d')]);return db[_0x5361('0x2a')][_0x5361('0x43')](_0x5c8e75)['then'](handleEntityNotFound(_0x3a4c01,null))['then'](respondWithResult(_0x3a4c01,null))['catch'](handleError(_0x3a4c01,null));};exports['create']=function(_0x260b74,_0xd97c20){return db['VoiceQueuesLog']['create'](_0x260b74[_0x5361('0x44')],{})[_0x5361('0x25')](respondWithResult(_0xd97c20,0xc9))[_0x5361('0x40')](handleError(_0xd97c20,null));};exports['update']=function(_0x32d68d,_0x4cdc3b){if(_0x32d68d[_0x5361('0x44')]['id']){delete _0x32d68d[_0x5361('0x44')]['id'];}return db[_0x5361('0x2a')]['find']({'where':{'id':_0x32d68d['params']['id']}})[_0x5361('0x25')](handleEntityNotFound(_0x4cdc3b,null))[_0x5361('0x25')](saveUpdates(_0x32d68d[_0x5361('0x44')],null))['then'](respondWithResult(_0x4cdc3b,null))[_0x5361('0x40')](handleError(_0x4cdc3b,null));};exports[_0x5361('0x24')]=function(_0x524862,_0x2bb5a7){return db[_0x5361('0x2a')][_0x5361('0x43')]({'where':{'id':_0x524862[_0x5361('0x41')]['id']}})[_0x5361('0x25')](handleEntityNotFound(_0x2bb5a7,null))[_0x5361('0x25')](removeEntity(_0x2bb5a7,null))[_0x5361('0x40')](handleError(_0x2bb5a7,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index a585840..1d711c1 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 _0x564a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api'];(function(_0x49947f,_0x99b50c){var _0x4d8de1=function(_0x2a08ca){while(--_0x2a08ca){_0x49947f['push'](_0x49947f['shift']());}};_0x4d8de1(++_0x99b50c);}(_0x564a,0x183));var _0xa564=function(_0x36a245,_0x404a91){_0x36a245=_0x36a245-0x0;var _0x5535b5=_0x564a[_0x36a245];return _0x5535b5;};'use strict';var _=require(_0xa564('0x0'));var util=require(_0xa564('0x1'));var logger=require(_0xa564('0x2'))(_0xa564('0x3'));var moment=require(_0xa564('0x4'));var BPromise=require(_0xa564('0x5'));var rp=require(_0xa564('0x6'));var fs=require('fs');var path=require(_0xa564('0x7'));var rimraf=require(_0xa564('0x8'));var config=require(_0xa564('0x9'));var attributes=require('./voiceQueuesLog.attributes');module[_0xa564('0xa')]=function(_0x1f1f37,_0x3e9efd){return _0x1f1f37[_0xa564('0xb')](_0xa564('0xc'),attributes,{'tableName':_0xa564('0xd'),'paranoid':![],'indexes':[{'name':_0xa564('0xe'),'fields':[_0xa564('0xf'),_0xa564('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x2d0d=['moment','bluebird','request-promise','path','rimraf','./voiceQueuesLog.attributes','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','util','../../config/logger','api'];(function(_0x8a6043,_0x1205f4){var _0x571dfd=function(_0x50703a){while(--_0x50703a){_0x8a6043['push'](_0x8a6043['shift']());}};_0x571dfd(++_0x1205f4);}(_0x2d0d,0xa5));var _0xd2d0=function(_0x37fdd0,_0x5d522d){_0x37fdd0=_0x37fdd0-0x0;var _0x1c927c=_0x2d0d[_0x37fdd0];return _0x1c927c;};'use strict';var _=require('lodash');var util=require(_0xd2d0('0x0'));var logger=require(_0xd2d0('0x1'))(_0xd2d0('0x2'));var moment=require(_0xd2d0('0x3'));var BPromise=require(_0xd2d0('0x4'));var rp=require(_0xd2d0('0x5'));var fs=require('fs');var path=require(_0xd2d0('0x6'));var rimraf=require(_0xd2d0('0x7'));var config=require('../../config/environment');var attributes=require(_0xd2d0('0x8'));module['exports']=function(_0x39afb2,_0x1651da){return _0x39afb2['define'](_0xd2d0('0x9'),attributes,{'tableName':_0xd2d0('0xa'),'paranoid':![],'indexes':[{'name':_0xd2d0('0xb'),'fields':[_0xd2d0('0xc'),_0xd2d0('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 0f3d46b..9543f04 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 _0x507f=['message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../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'];(function(_0x1b0689,_0x44afe6){var _0x5ca941=function(_0x59caaf){while(--_0x59caaf){_0x1b0689['push'](_0x1b0689['shift']());}};_0x5ca941(++_0x44afe6);}(_0x507f,0x1c4));var _0xf507=function(_0x50d5ae,_0x22a349){_0x50d5ae=_0x50d5ae-0x0;var _0x1e8d74=_0x507f[_0x50d5ae];return _0x1e8d74;};'use strict';var _=require(_0xf507('0x0'));var util=require('util');var moment=require(_0xf507('0x1'));var BPromise=require(_0xf507('0x2'));var rs=require(_0xf507('0x3'));var fs=require('fs');var Redis=require(_0xf507('0x4'));var db=require(_0xf507('0x5'))['db'];var utils=require(_0xf507('0x6'));var logger=require(_0xf507('0x7'))(_0xf507('0x8'));var config=require(_0xf507('0x9'));var jayson=require(_0xf507('0xa'));var client=jayson[_0xf507('0xb')][_0xf507('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x312e7a,_0x2163d2,_0x1266a8){return new BPromise(function(_0x3ba6cd,_0x54152f){return client[_0xf507('0xd')](_0x312e7a,_0x1266a8)[_0xf507('0xe')](function(_0x3ede8e){logger[_0xf507('0xf')](_0xf507('0x10'),_0x2163d2,_0xf507('0x11'));logger[_0xf507('0x12')](_0xf507('0x13'),_0x2163d2,_0xf507('0x11'),JSON[_0xf507('0x14')](_0x3ede8e));if(_0x3ede8e[_0xf507('0x15')]){if(_0x3ede8e[_0xf507('0x15')][_0xf507('0x16')]===0x1f4){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x2163d2,_0x3ede8e[_0xf507('0x15')][_0xf507('0x17')]);return _0x54152f(_0x3ede8e['error'][_0xf507('0x17')]);}logger[_0xf507('0x15')](_0xf507('0x10'),_0x2163d2,_0x3ede8e[_0xf507('0x15')][_0xf507('0x17')]);return _0x3ba6cd(_0x3ede8e[_0xf507('0x15')][_0xf507('0x17')]);}else{logger['info'](_0xf507('0x10'),_0x2163d2,'request\x20sent');_0x3ba6cd(_0x3ede8e['result'][_0xf507('0x17')]);}})[_0xf507('0x18')](function(_0x52be08){logger[_0xf507('0x15')](_0xf507('0x10'),_0x2163d2,_0x52be08);_0x54152f(_0x52be08);});});} \ No newline at end of file +var _0x573e=['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','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x7303c,_0x2d7803){var _0x367cc7=function(_0x333990){while(--_0x333990){_0x7303c['push'](_0x7303c['shift']());}};_0x367cc7(++_0x2d7803);}(_0x573e,0x134));var _0xe573=function(_0x1a3eae,_0x2481bb){_0x1a3eae=_0x1a3eae-0x0;var _0x1b101a=_0x573e[_0x1a3eae];return _0x1b101a;};'use strict';var _=require('lodash');var util=require(_0xe573('0x0'));var moment=require(_0xe573('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe573('0x2'))['db'];var utils=require(_0xe573('0x3'));var logger=require(_0xe573('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe573('0x5'));var client=jayson[_0xe573('0x6')][_0xe573('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x39c924,_0x502534,_0x247240){return new BPromise(function(_0xbaaec,_0x23e1cc){return client[_0xe573('0x8')](_0x39c924,_0x247240)[_0xe573('0x9')](function(_0x2ad4a9){logger[_0xe573('0xa')](_0xe573('0xb'),_0x502534,_0xe573('0xc'));logger[_0xe573('0xd')](_0xe573('0xe'),_0x502534,_0xe573('0xc'),JSON[_0xe573('0xf')](_0x2ad4a9));if(_0x2ad4a9[_0xe573('0x10')]){if(_0x2ad4a9[_0xe573('0x10')][_0xe573('0x11')]===0x1f4){logger[_0xe573('0x10')](_0xe573('0xb'),_0x502534,_0x2ad4a9[_0xe573('0x10')][_0xe573('0x12')]);return _0x23e1cc(_0x2ad4a9[_0xe573('0x10')][_0xe573('0x12')]);}logger[_0xe573('0x10')](_0xe573('0xb'),_0x502534,_0x2ad4a9[_0xe573('0x10')][_0xe573('0x12')]);return _0xbaaec(_0x2ad4a9[_0xe573('0x10')][_0xe573('0x12')]);}else{logger[_0xe573('0xa')](_0xe573('0xb'),_0x502534,'request\x20sent');_0xbaaec(_0x2ad4a9[_0xe573('0x13')]['message']);}})[_0xe573('0x14')](function(_0x2c45df){logger[_0xe573('0x10')](_0xe573('0xb'),_0x502534,_0x2c45df);_0x23e1cc(_0x2c45df);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index c79b49b..d1e4f69 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 _0xce9b=['download','downloads','/:id/transcribe','post','create','runTranscribe','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/download'];(function(_0x50ddff,_0xdb8090){var _0x1a7a12=function(_0x274894){while(--_0x274894){_0x50ddff['push'](_0x50ddff['shift']());}};_0x1a7a12(++_0xdb8090);}(_0xce9b,0x80));var _0xbce9=function(_0x133fb2,_0x48cd50){_0x133fb2=_0x133fb2-0x0;var _0x430dda=_0xce9b[_0x133fb2];return _0x430dda;};'use strict';var multer=require(_0xbce9('0x0'));var util=require(_0xbce9('0x1'));var path=require(_0xbce9('0x2'));var timeout=require(_0xbce9('0x3'));var express=require('express');var router=express[_0xbce9('0x4')]();var fs_extra=require(_0xbce9('0x5'));var auth=require(_0xbce9('0x6'));var interaction=require(_0xbce9('0x7'));var config=require(_0xbce9('0x8'));var controller=require('./voiceRecording.controller');router[_0xbce9('0x9')]('/',auth[_0xbce9('0xa')](),controller['index']);router[_0xbce9('0x9')](_0xbce9('0xb'),auth[_0xbce9('0xa')](),controller[_0xbce9('0xc')]);router['get'](_0xbce9('0xd'),auth[_0xbce9('0xa')](),controller[_0xbce9('0xe')]);router[_0xbce9('0x9')](_0xbce9('0xf'),auth['isAuthenticated'](),controller[_0xbce9('0x10')]);router[_0xbce9('0x9')]('/:id/downloads',controller[_0xbce9('0x11')]);router[_0xbce9('0x9')](_0xbce9('0x12'),auth[_0xbce9('0xa')](),controller['downloadTranscribe']);router[_0xbce9('0x13')]('/',auth[_0xbce9('0xa')](),controller[_0xbce9('0x14')]);router[_0xbce9('0x13')](_0xbce9('0x12'),auth[_0xbce9('0xa')](),controller[_0xbce9('0x15')]);router['put'](_0xbce9('0xd'),auth[_0xbce9('0xa')](),controller[_0xbce9('0x16')]);router[_0xbce9('0x17')]('/:id',auth[_0xbce9('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x48c0=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','/:id/download','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3fd1d9,_0x5dd237){var _0x481a6d=function(_0x339f6c){while(--_0x339f6c){_0x3fd1d9['push'](_0x3fd1d9['shift']());}};_0x481a6d(++_0x5dd237);}(_0x48c0,0x14a));var _0x048c=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0x48c0[_0xa60623];return _0x4a6487;};'use strict';var multer=require(_0x048c('0x0'));var util=require(_0x048c('0x1'));var path=require(_0x048c('0x2'));var timeout=require(_0x048c('0x3'));var express=require(_0x048c('0x4'));var router=express[_0x048c('0x5')]();var fs_extra=require(_0x048c('0x6'));var auth=require(_0x048c('0x7'));var interaction=require(_0x048c('0x8'));var config=require(_0x048c('0x9'));var controller=require('./voiceRecording.controller');router['get']('/',auth[_0x048c('0xa')](),controller[_0x048c('0xb')]);router[_0x048c('0xc')](_0x048c('0xd'),auth[_0x048c('0xa')](),controller[_0x048c('0xe')]);router[_0x048c('0xc')]('/:id',auth[_0x048c('0xa')](),controller[_0x048c('0xf')]);router[_0x048c('0xc')](_0x048c('0x10'),auth[_0x048c('0xa')](),controller['download']);router['get']('/:id/downloads',controller[_0x048c('0x11')]);router[_0x048c('0xc')](_0x048c('0x12'),auth[_0x048c('0xa')](),controller[_0x048c('0x13')]);router[_0x048c('0x14')]('/',auth[_0x048c('0xa')](),controller['create']);router[_0x048c('0x14')](_0x048c('0x12'),auth['isAuthenticated'](),controller[_0x048c('0x15')]);router['put'](_0x048c('0x16'),auth[_0x048c('0xa')](),controller['update']);router[_0x048c('0x17')](_0x048c('0x16'),auth[_0x048c('0xa')](),controller[_0x048c('0x18')]);module[_0x048c('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 22f270b..6c57fd4 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(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 51d4b32..8f60c9f 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 _0xe16f=['IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','uuid/v4','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','error','stack','name','send','index','map','fieldName','type','differenceBy','format','keys','query','filters','intersection','model','fields','attributes','length','nolimit','sort','where','merge','options','VoiceRecording','includeAll','findAll','rows','show','rawAttributes','include','find','catch','create','body','params','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','existsSync','recording','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','transcribeAccountId','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested'];(function(_0x3c4d08,_0x41f8dc){var _0x571cf1=function(_0x548360){while(--_0x548360){_0x3c4d08['push'](_0x3c4d08['shift']());}};_0x571cf1(++_0x41f8dc);}(_0xe16f,0x9a));var _0xfe16=function(_0x1326a2,_0x13475a){_0x1326a2=_0x1326a2-0x0;var _0x4aeb79=_0xe16f[_0x1326a2];return _0x4aeb79;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfe16('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfe16('0x1'));var rp=require(_0xfe16('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfe16('0x3'));var util=require(_0xfe16('0x4'));var path=require(_0xfe16('0x5'));var sox=require(_0xfe16('0x6'));var csv=require('to-csv');var ejs=require(_0xfe16('0x7'));var fs=require('fs');var fs_extra=require(_0xfe16('0x8'));var _=require(_0xfe16('0x9'));var squel=require('squel');var crypto=require(_0xfe16('0xa'));var jsforce=require(_0xfe16('0xb'));var deskjs=require(_0xfe16('0xc'));var toCsv=require(_0xfe16('0xd'));var querystring=require(_0xfe16('0xe'));var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require(_0xfe16('0xf'));var Redis=require('ioredis');var authService=require(_0xfe16('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xfe16('0x11'));var hardwareService=require(_0xfe16('0x12'));var logger=require(_0xfe16('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xfe16('0x14'));var licenseUtil=require(_0xfe16('0x15'));var db=require(_0xfe16('0x16'))['db'];function respondWithStatusCode(_0x4df6de,_0x3bf650){_0x3bf650=_0x3bf650||0xcc;return function(_0x39a715){if(_0x39a715){return _0x4df6de[_0xfe16('0x17')](_0x3bf650);}return _0x4df6de['status'](_0x3bf650)['end']();};}function respondWithResult(_0x2f5692,_0x5c21cb){_0x5c21cb=_0x5c21cb||0xc8;return function(_0x114c95){if(_0x114c95){return _0x2f5692[_0xfe16('0x18')](_0x5c21cb)['json'](_0x114c95);}};}function respondWithFilteredResult(_0x5b5e8d,_0x484f9e){return function(_0x43308a){if(_0x43308a){var _0x428fea=typeof _0x484f9e[_0xfe16('0x19')]===_0xfe16('0x1a')&&typeof _0x484f9e[_0xfe16('0x1b')]===_0xfe16('0x1a');var _0x4ef8dc=_0x43308a[_0xfe16('0x1c')];var _0x51b697=_0x428fea?0x0:_0x484f9e[_0xfe16('0x19')];var _0x11d3ae=_0x428fea?_0x43308a['count']:_0x484f9e['offset']+_0x484f9e[_0xfe16('0x1b')];var _0x59d36c;if(_0x11d3ae>=_0x4ef8dc){_0x11d3ae=_0x4ef8dc;_0x59d36c=0xc8;}else{_0x59d36c=0xce;}_0x5b5e8d[_0xfe16('0x18')](_0x59d36c);return _0x5b5e8d[_0xfe16('0x1d')](_0xfe16('0x1e'),_0x51b697+'-'+_0x11d3ae+'/'+_0x4ef8dc)[_0xfe16('0x1f')](_0x43308a);}return null;};}function patchUpdates(_0x441113){return function(_0x5d3d90){try{jsonpatch[_0xfe16('0x20')](_0x5d3d90,_0x441113,!![]);}catch(_0x1f1dc4){return BPromise[_0xfe16('0x21')](_0x1f1dc4);}return _0x5d3d90['save']();};}function saveUpdates(_0x43acb7,_0x5aa33e){return function(_0x2af394){if(_0x2af394){return _0x2af394[_0xfe16('0x22')](_0x43acb7)['then'](function(_0x17c968){return _0x17c968;});}return null;};}function removeEntity(_0x21655f,_0x54bc2a){return function(_0x145368){if(_0x145368){return _0x145368['destroy']()[_0xfe16('0x23')](function(){_0x21655f[_0xfe16('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b581d,_0x52ce98){return function(_0x553402){if(!_0x553402){_0x5b581d['sendStatus'](0x194);}return _0x553402;};}function handleError(_0x3964ab,_0x285dca){_0x285dca=_0x285dca||0x1f4;return function(_0x305b40){logger[_0xfe16('0x24')](_0x305b40[_0xfe16('0x25')]);if(_0x305b40[_0xfe16('0x26')]){delete _0x305b40['name'];}_0x3964ab['status'](_0x285dca)[_0xfe16('0x27')](_0x305b40);};}exports[_0xfe16('0x28')]=function(_0x318460,_0x1f7efe){var _0x34c45a={},_0x306c78={},_0x40d151={'count':0x0,'rows':[]};var _0x4e53aa=_[_0xfe16('0x29')](db['VoiceRecording']['rawAttributes'],function(_0x576e9a){return{'name':_0x576e9a[_0xfe16('0x2a')],'type':_0x576e9a[_0xfe16('0x2b')]['key']};});_0x306c78['model']=_[_0xfe16('0x2c')](_['map'](_0x4e53aa,_0xfe16('0x26')),[_0xfe16('0x2d')]);_0x306c78['query']=_[_0xfe16('0x2e')](_0x318460[_0xfe16('0x2f')]);_0x306c78[_0xfe16('0x30')]=_[_0xfe16('0x31')](_0x306c78['model'],_0x306c78[_0xfe16('0x2f')]);_0x34c45a['attributes']=_['intersection'](_0x306c78[_0xfe16('0x32')],qs[_0xfe16('0x33')](_0x318460[_0xfe16('0x2f')][_0xfe16('0x33')]));_0x34c45a[_0xfe16('0x34')]=_0x34c45a['attributes'][_0xfe16('0x35')]?_0x34c45a[_0xfe16('0x34')]:_0x306c78[_0xfe16('0x32')];if(!_0x318460[_0xfe16('0x2f')]['hasOwnProperty'](_0xfe16('0x36'))){_0x34c45a[_0xfe16('0x1b')]=qs[_0xfe16('0x1b')](_0x318460[_0xfe16('0x2f')][_0xfe16('0x1b')]);_0x34c45a[_0xfe16('0x19')]=qs[_0xfe16('0x19')](_0x318460[_0xfe16('0x2f')][_0xfe16('0x19')]);}_0x34c45a['order']=qs[_0xfe16('0x37')](_0x318460[_0xfe16('0x2f')]['sort']);_0x34c45a[_0xfe16('0x38')]=qs[_0xfe16('0x30')](_['pick'](_0x318460[_0xfe16('0x2f')],_0x306c78[_0xfe16('0x30')]),_0x4e53aa);if(_0x318460[_0xfe16('0x2f')]['filter']){_0x34c45a[_0xfe16('0x38')]=_['merge'](_0x34c45a[_0xfe16('0x38')],{'$or':_[_0xfe16('0x29')](_0x4e53aa,function(_0x28d85d){if(_0x28d85d[_0xfe16('0x2b')]!=='VIRTUAL'){var _0x352ca8={};_0x352ca8[_0x28d85d[_0xfe16('0x26')]]={'$like':'%'+_0x318460[_0xfe16('0x2f')]['filter']+'%'};return _0x352ca8;}})});}_0x34c45a=_[_0xfe16('0x39')]({},_0x34c45a,_0x318460[_0xfe16('0x3a')]);var _0x2e375b={'where':_0x34c45a['where']};return db[_0xfe16('0x3b')]['count'](_0x2e375b)[_0xfe16('0x23')](function(_0x1cee54){_0x40d151[_0xfe16('0x1c')]=_0x1cee54;if(_0x318460[_0xfe16('0x2f')][_0xfe16('0x3c')]){_0x34c45a['include']=[{'all':!![]}];}return db[_0xfe16('0x3b')][_0xfe16('0x3d')](_0x34c45a);})[_0xfe16('0x23')](function(_0x4b986b){_0x40d151[_0xfe16('0x3e')]=_0x4b986b;return _0x40d151;})[_0xfe16('0x23')](respondWithFilteredResult(_0x1f7efe,_0x34c45a))['catch'](handleError(_0x1f7efe,null));};exports[_0xfe16('0x3f')]=function(_0x38e233,_0x4ec940){var _0x480fd3={'raw':![],'where':{'id':_0x38e233['params']['id']}},_0x31f369={};_0x31f369['model']=_[_0xfe16('0x2e')](db[_0xfe16('0x3b')][_0xfe16('0x40')]);_0x31f369['query']=_[_0xfe16('0x2e')](_0x38e233['query']);_0x31f369['filters']=_['intersection'](_0x31f369[_0xfe16('0x32')],_0x31f369[_0xfe16('0x2f')]);_0x480fd3[_0xfe16('0x34')]=_[_0xfe16('0x31')](_0x31f369['model'],qs[_0xfe16('0x33')](_0x38e233[_0xfe16('0x2f')][_0xfe16('0x33')]));_0x480fd3[_0xfe16('0x34')]=_0x480fd3[_0xfe16('0x34')][_0xfe16('0x35')]?_0x480fd3[_0xfe16('0x34')]:_0x31f369[_0xfe16('0x32')];if(_0x38e233[_0xfe16('0x2f')]['includeAll']){_0x480fd3[_0xfe16('0x41')]=[{'all':!![]}];}_0x480fd3=_[_0xfe16('0x39')]({},_0x480fd3,_0x38e233[_0xfe16('0x3a')]);return db[_0xfe16('0x3b')][_0xfe16('0x42')](_0x480fd3)[_0xfe16('0x23')](handleEntityNotFound(_0x4ec940,null))[_0xfe16('0x23')](respondWithResult(_0x4ec940,null))[_0xfe16('0x43')](handleError(_0x4ec940,null));};exports[_0xfe16('0x44')]=function(_0x4e87e9,_0x24cbe0){return db['VoiceRecording'][_0xfe16('0x44')](_0x4e87e9['body'],{})[_0xfe16('0x23')](respondWithResult(_0x24cbe0,0xc9))[_0xfe16('0x43')](handleError(_0x24cbe0,null));};exports['update']=function(_0x63abba,_0x2e829b){if(_0x63abba[_0xfe16('0x45')]['id']){delete _0x63abba['body']['id'];}return db[_0xfe16('0x3b')]['find']({'where':{'id':_0x63abba[_0xfe16('0x46')]['id']}})[_0xfe16('0x23')](handleEntityNotFound(_0x2e829b,null))[_0xfe16('0x23')](saveUpdates(_0x63abba[_0xfe16('0x45')],null))[_0xfe16('0x23')](respondWithResult(_0x2e829b,null))['catch'](handleError(_0x2e829b,null));};exports['describe']=function(_0xe03806,_0x178be6){return db[_0xfe16('0x3b')][_0xfe16('0x47')]()['then'](respondWithResult(_0x178be6,null))[_0xfe16('0x43')](handleError(_0x178be6,null));};exports[_0xfe16('0x48')]=function(_0x35f8c1,_0x570cb0,_0x17797c){var _0x2677ae=require(_0xfe16('0x49'));var _0x46547f=![];var _0x4dde5b={};if(_0x35f8c1['query'][_0xfe16('0x2b')]&&_0x35f8c1[_0xfe16('0x2f')][_0xfe16('0x2b')]===_0xfe16('0x4a')){_0x4dde5b[_0xfe16('0x4a')]=_0x35f8c1[_0xfe16('0x46')]['id'];}else{_0x4dde5b['id']=_0x35f8c1[_0xfe16('0x46')]['id'];}return db[_0xfe16('0x3b')]['find']({'where':_0x4dde5b,'attributes':['id',_0xfe16('0x4b')],'raw':!![]})[_0xfe16('0x23')](handleEntityNotFound(_0x570cb0,null))[_0xfe16('0x23')](function(_0x325daa){if(_0x325daa){var _0x225f58=_0x325daa[_0xfe16('0x4b')];var _0x48570d=util[_0xfe16('0x2d')](_0xfe16('0x4c'),_0x225f58);if(fs['existsSync'](_0x48570d)){_0x46547f=!![];return _0x2677ae[_0xfe16('0x4d')](_0x48570d,_0x225f58,config[_0xfe16('0x4e')]['recording'])[_0xfe16('0x23')](function(){return _0x325daa;});}return _0x325daa;}})[_0xfe16('0x23')](function(_0x39170a){if(_0x39170a){var _0x1305d0=_0x39170a[_0xfe16('0x4b')];if(!fs['existsSync'](_0x1305d0)){throw new db[(_0xfe16('0x4f'))][(_0xfe16('0x50'))](_0xfe16('0x51'));}if(_0x39170a[_0xfe16('0x52')]){return _0x570cb0['download'](_0x1305d0,_0x39170a[_0xfe16('0x52')]+path[_0xfe16('0x53')](_0x1305d0),function(){if(_0x46547f){fs[_0xfe16('0x54')](_0x1305d0);}});}else{return _0x570cb0['download'](_0x1305d0,function(_0x313146){if(_0x46547f){fs['unlink'](_0x1305d0);}});}}})[_0xfe16('0x43')](function(_0x25ec8d){if(_0x25ec8d[_0xfe16('0x55')]===_0xfe16('0x51')){_0x570cb0[_0xfe16('0x18')](0x194)[_0xfe16('0x27')](_0xfe16('0x56'));}else{return handleError(_0x570cb0,null);}});};exports[_0xfe16('0x57')]=function(_0x5cf991,_0x3ee506,_0x4435d3){var _0x214bca=require(_0xfe16('0x49'));var _0x48e916=![];var _0x7049b8={'$and':[db[_0xfe16('0x58')][_0xfe16('0x38')](db[_0xfe16('0x58')]['fn'](_0xfe16('0x59'),db[_0xfe16('0x58')][_0xfe16('0x5a')](_0xfe16('0x4a'))),_0x5cf991[_0xfe16('0x2f')][_0xfe16('0x5b')])]};if(_0x5cf991[_0xfe16('0x2f')][_0xfe16('0x2b')]&&_0x5cf991['query'][_0xfe16('0x2b')]==='uniqueid'){_0x7049b8['$and']['push']({'uniqueid':_0x5cf991[_0xfe16('0x46')]['id']});}else{_0x7049b8[_0xfe16('0x5c')]['push']({'id':_0x5cf991[_0xfe16('0x46')]['id']});}return db[_0xfe16('0x3b')][_0xfe16('0x42')]({'where':_0x7049b8,'attributes':['id',_0xfe16('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x3ee506,null))['then'](function(_0x5288d7){if(_0x5288d7){var _0x4ce0b1=util[_0xfe16('0x2d')]('%s.cypher',_0x5288d7[_0xfe16('0x4b')]);if(fs[_0xfe16('0x5d')](_0x4ce0b1)){_0x48e916=!![];return _0x214bca[_0xfe16('0x4d')](_0x4ce0b1,_0x5288d7[_0xfe16('0x4b')],config[_0xfe16('0x4e')][_0xfe16('0x5e')])[_0xfe16('0x23')](function(){return _0x5288d7;});}return _0x5288d7;}})['then'](function(_0x3fdb89){if(_0x3fdb89){if(!fs[_0xfe16('0x5d')](_0x3fdb89[_0xfe16('0x4b')])){throw new db['Sequelize']['ValidationError'](_0xfe16('0x51'));}if(_0x3fdb89[_0xfe16('0x52')]){return _0x3ee506[_0xfe16('0x48')](_0x3fdb89[_0xfe16('0x4b')],_0x3fdb89[_0xfe16('0x52')]+path[_0xfe16('0x53')](_0x3fdb89[_0xfe16('0x4b')]),function(){if(_0x48e916){fs[_0xfe16('0x54')](_0x3fdb89[_0xfe16('0x4b')]);}});}else{return _0x3ee506[_0xfe16('0x48')](_0x3fdb89[_0xfe16('0x4b')],function(_0x4cd569){if(_0x48e916){fs[_0xfe16('0x54')](_0x3fdb89['value']);}});}}})[_0xfe16('0x43')](handleError(_0x3ee506,null));};exports[_0xfe16('0x5f')]=function(_0x2ca7dd,_0x323f8c){return db['VoiceRecording'][_0xfe16('0x42')]({'where':{'id':_0x2ca7dd[_0xfe16('0x46')]['id']}})[_0xfe16('0x23')](function(_0x1aafff){if(_[_0xfe16('0x60')](_0x1aafff)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1aafff;})[_0xfe16('0x23')](function(_0x29ed97){var _0x2a1967=_0x29ed97[_0xfe16('0x4b')];logger[_0xfe16('0x61')](_0xfe16('0x62'),_0x2a1967);if(!_[_0xfe16('0x60')](_0x29ed97['value'])&&fs[_0xfe16('0x5d')](_0x2a1967)){logger[_0xfe16('0x61')](_0xfe16('0x63')+_0x2a1967+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x2a1967);}_0x2a1967=_0x2a1967+_0xfe16('0x64');if(!_[_0xfe16('0x60')](_0x29ed97[_0xfe16('0x4b')])&&fs[_0xfe16('0x5d')](_0x2a1967)){logger[_0xfe16('0x61')](_0xfe16('0x63')+_0x2a1967+_0xfe16('0x65'));fs[_0xfe16('0x66')](_0x2a1967);}return _0x29ed97;})[_0xfe16('0x23')](function(_0x1d4e2b){if(!_0x1d4e2b)throw new InternalError();return _0x1d4e2b['destroy']();})[_0xfe16('0x23')](function(){_0x323f8c[_0xfe16('0x18')](0xcc)['end']();})[_0xfe16('0x43')](handleError(_0x323f8c,null));};function getBucketslist(_0x36b188,_0x138f01,_0x3b80a1){return new Promise(function(_0x3c6a28,_0xe86647){var _0x1d1353=new AWS['S3']({'accessKeyId':_0x138f01,'secretAccessKey':_0x36b188,'region':_0x3b80a1});_0x1d1353[_0xfe16('0x67')]({},function(_0x38fac9,_0x149ed6){if(_0x38fac9){return _0xe86647(_0x38fac9);}else{return _0x3c6a28(_0x149ed6);}});});}function createBucket(_0x49d952,_0x4db0d4,_0x28dc01,_0x25bfa8){return new Promise(function(_0x126827,_0x319352){var _0x472c1b=new AWS['S3']({'accessKeyId':_0x4db0d4,'secretAccessKey':_0x49d952,'region':_0x28dc01});_0x472c1b['createBucket']({'Bucket':_0x25bfa8},function(_0x1d3be0,_0x174e2a){if(_0x1d3be0){return _0x319352(_0x1d3be0);}else{return _0x126827(_0x174e2a);}});});}function uploadFile(_0x1fc931,_0x59e185,_0x22c331,_0x24bba2,_0x1428c2,_0x4df538){return new Promise(function(_0x2f11ea,_0x4aafcd){var _0x597132=new AWS['S3']({'accessKeyId':_0x59e185,'secretAccessKey':_0x1fc931,'region':_0x22c331});_0x597132['upload']({'Bucket':_0x24bba2,'Key':_0x1428c2,'Body':_0x4df538},function(_0x1b68df,_0x6a5c73){if(_0x1b68df){return _0x4aafcd(_0x1b68df);}else{return _0x2f11ea(_0x6a5c73);}});});}function startTranscribe(_0x4b03f2,_0x489cc9,_0x3a116b,_0x28e803,_0x2120b1,_0x3b8bc3){return new Promise(function(_0x240c70,_0xb603cb){var _0x27ab41=new AWS[(_0xfe16('0x68'))]({'accessKeyId':_0x489cc9,'secretAccessKey':_0x4b03f2,'region':_0x3a116b});_0x27ab41[_0xfe16('0x69')]({'TranscriptionJobName':_0x28e803,'LanguageCode':_0x2120b1,'Media':{'MediaFileUri':_0x3b8bc3}},function(_0xe73407,_0x575e22){if(_0xe73407){return _0xb603cb(_0xe73407);}else{return _0x240c70(_0x575e22);}});});}function transcribe(_0x1a5d5f,_0x3a46f0,_0x1b2af8,_0x2b9e02,_0xbaad41,_0x130c6e,_0x2a3f8d){return new Promise(function(_0x3c94ea,_0x188c46){var _0x3fa4a4={};logger[_0xfe16('0x61')](util['format'](_0xfe16('0x6a'),_0x1a5d5f,_0xbaad41));return uploadFile(_0x3a46f0,_0x1b2af8,_0x2b9e02,_0xbaad41,path[_0xfe16('0x6b')](_0x130c6e),fs[_0xfe16('0x6c')](_0x130c6e))[_0xfe16('0x23')](function(_0x3d7e3f){logger[_0xfe16('0x61')](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x1a5d5f,_0xbaad41,_0x3d7e3f[_0xfe16('0x6d')]));_0x3fa4a4[_0xfe16('0x6e')]=_0x3d7e3f[_0xfe16('0x6f')];_0x3fa4a4[_0xfe16('0x70')]=_0x3d7e3f[_0xfe16('0x6d')];logger[_0xfe16('0x61')](util[_0xfe16('0x2d')](_0xfe16('0x71'),_0x1a5d5f));return startTranscribe(_0x3a46f0,_0x1b2af8,_0x2b9e02,uuidv4(),_0x2a3f8d,_0x3d7e3f['Location']);})[_0xfe16('0x23')](function(_0x31a405){logger[_0xfe16('0x61')](util[_0xfe16('0x2d')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x1a5d5f,_0x31a405[_0xfe16('0x72')]['TranscriptionJobName']));_0x3fa4a4['transcribeName']=_0x31a405[_0xfe16('0x72')][_0xfe16('0x73')];_0x3fa4a4[_0xfe16('0x74')]=_0x31a405['TranscriptionJob']['TranscriptionJobStatus'];return _0x3c94ea(_0x3fa4a4);})['catch'](function(_0x34ff9c){return _0x188c46(_0x34ff9c);});});}exports['runTranscribe']=function(_0x496903,_0xc4bb02,_0x2ac15e){var _0x15b836;var _0x2a235e;var _0x5bb87a;var _0x350c9e=require('../../components/encryptor');return db[_0xfe16('0x3b')][_0xfe16('0x75')]({'where':{'id':_0x496903[_0xfe16('0x46')]['id']}})[_0xfe16('0x23')](function(_0xcc6e74){if(_0xcc6e74){var _0x5041df=util['format']('%s.cypher',_0xcc6e74[_0xfe16('0x4b')]);if(fs[_0xfe16('0x5d')](_0x5041df)){cypher=!![];return _0x350c9e[_0xfe16('0x4d')](_0x5041df,_0xcc6e74['value'],config[_0xfe16('0x4e')][_0xfe16('0x5e')])[_0xfe16('0x23')](function(){return _0xcc6e74;});}return _0xcc6e74;}})[_0xfe16('0x23')](function(_0xcadd7d){if(!_0xcadd7d){throw new db[(_0xfe16('0x4f'))][(_0xfe16('0x50'))](_0xfe16('0x76'));}_0x2a235e=_0xcadd7d;return db[_0xfe16('0x77')][_0xfe16('0x75')]({'where':{'id':0x1}});})[_0xfe16('0x23')](handleEntityNotFound(_0xc4bb02,null))[_0xfe16('0x23')](function(_0xfe6c41){if(_0xfe6c41){_0x15b836=_0xfe6c41;if(!_0x15b836['transcribe']||!_0x15b836['transcribeAccountId']||!_0x15b836[_0xfe16('0x78')]||!_0x15b836[_0xfe16('0x79')]||!_0x15b836['bucket']){throw new db['Sequelize']['ValidationError'](_0xfe16('0x7a'));}if(_0x496903[_0xfe16('0x45')]['runSentiment']&&(!_0x15b836[_0xfe16('0x7b')]||!_0x15b836['sentimentAccountId']||!_0x15b836[_0xfe16('0x7c')]||!_0x15b836['language']||!_0x15b836[_0xfe16('0x6e')])){throw new db[(_0xfe16('0x4f'))][(_0xfe16('0x50'))](_0xfe16('0x7d'));}return db['CloudProvider'][_0xfe16('0x75')]({'where':{'id':_0x15b836[_0xfe16('0x7e')]}});}})[_0xfe16('0x23')](function(_0x5dcb9b){if(!_0x5dcb9b){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x5dcb9b[_0xfe16('0x7f')]||!_0x5dcb9b[_0xfe16('0x80')]){throw new db[(_0xfe16('0x4f'))][(_0xfe16('0x50'))](_0xfe16('0x81'));}_0x5bb87a=_0x5dcb9b;return getBucketslist(_0x5bb87a[_0xfe16('0x7f')],_0x5bb87a[_0xfe16('0x80')],_0x15b836[_0xfe16('0x78')]);})[_0xfe16('0x23')](function(_0x569a2d){if(_0x569a2d&&_0x569a2d['Buckets']){var _0x2a4eb5=_[_0xfe16('0x42')](_0x569a2d[_0xfe16('0x82')],function(_0x305b1e){return _0x305b1e[_0xfe16('0x83')]===_0x15b836[_0xfe16('0x6e')];});if(!_0x2a4eb5){logger['info'](util['format'](_0xfe16('0x84'),_0x496903[_0xfe16('0x46')]['id'],_0x15b836[_0xfe16('0x6e')]));return createBucket(_0x5bb87a[_0xfe16('0x7f')],_0x5bb87a['data2'],_0x15b836[_0xfe16('0x78')],_0x15b836[_0xfe16('0x6e')]);}logger[_0xfe16('0x61')](util[_0xfe16('0x2d')](_0xfe16('0x85'),_0x496903[_0xfe16('0x46')]['id'],_0x15b836[_0xfe16('0x6e')]));return;}})[_0xfe16('0x23')](function(_0x193f2c){if(_0x2a235e[_0xfe16('0x74')]===_0xfe16('0x86')){return transcribe(_0x496903[_0xfe16('0x46')]['id'],_0x5bb87a['data1'],_0x5bb87a[_0xfe16('0x80')],_0x15b836['transcribeRegion'],_0x15b836['bucket'],_0x2a235e[_0xfe16('0x4b')],_0x15b836[_0xfe16('0x79')]);}else{logger['info'](util[_0xfe16('0x2d')](_0xfe16('0x87'),_0x496903[_0xfe16('0x46')]['id']));return{'transcribeStatus':_0xfe16('0x88')};}})[_0xfe16('0x23')](function(_0x14a1c7){if(_0x14a1c7){_0x14a1c7[_0xfe16('0x89')]=_0x496903[_0xfe16('0x45')][_0xfe16('0x8a')];return _0x2a235e[_0xfe16('0x8b')](_0x14a1c7);}})[_0xfe16('0x23')](respondWithResult(_0xc4bb02,null))[_0xfe16('0x43')](handleError(_0xc4bb02,null));};function writeFile(_0x181739,_0x9fad13){return new Promise(function(_0x1e977d,_0x4e88fb){fs['writeFile'](_0x9fad13,_0x181739,function(_0x39e750,_0x55408a){if(_0x39e750){return _0x4e88fb(_0x39e750);}else{return _0x1e977d(_0x55408a);}});});}exports[_0xfe16('0x8c')]=function(_0x2d732f,_0x595c91,_0x100bf2){return db['VoiceRecording']['findOne']({'where':{'id':_0x2d732f['params']['id']}})[_0xfe16('0x23')](handleEntityNotFound(_0x595c91))['then'](function(_0x22aaf6){if(_0x22aaf6&&_0x22aaf6[_0xfe16('0x8d')]){var _0x3a11ca=_0x22aaf6['fileText'];var _0x3795bd=config[_0xfe16('0x8e')]+_0xfe16('0x8f')+_0x22aaf6['id']+'.txt';if(fs['existsSync'](_0x3795bd)){return _0x3795bd;}return writeFile(_0x3a11ca,_0x3795bd)['then'](function(){return _0x3795bd;});}else{throw new db[(_0xfe16('0x4f'))][(_0xfe16('0x50'))](_0xfe16('0x90'));}})[_0xfe16('0x23')](function(_0x1b8ae5){return _0x595c91[_0xfe16('0x48')](_0x1b8ae5);})[_0xfe16('0x43')](handleError(_0x595c91));}; \ No newline at end of file +var _0xf45b=['Transcript\x20not\x20available','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','offset','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','map','VoiceRecording','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','download','../../components/encryptor','uniqueid','value','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','downloads','sequelize','MD5','col','push','$and','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','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','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt'];(function(_0x184319,_0x563b57){var _0x96c3c3=function(_0x4f4256){while(--_0x4f4256){_0x184319['push'](_0x184319['shift']());}};_0x96c3c3(++_0x563b57);}(_0xf45b,0x1db));var _0xbf45=function(_0x46d4f6,_0x1247b2){_0x46d4f6=_0x46d4f6-0x0;var _0x1900b5=_0xf45b[_0x46d4f6];return _0x1900b5;};'use strict';var emlformat=require(_0xbf45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbf45('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf45('0x2'));var moment=require(_0xbf45('0x3'));var BPromise=require(_0xbf45('0x4'));var Mustache=require(_0xbf45('0x5'));var util=require(_0xbf45('0x6'));var path=require(_0xbf45('0x7'));var sox=require(_0xbf45('0x8'));var csv=require(_0xbf45('0x9'));var ejs=require(_0xbf45('0xa'));var fs=require('fs');var fs_extra=require(_0xbf45('0xb'));var _=require(_0xbf45('0xc'));var squel=require(_0xbf45('0xd'));var crypto=require(_0xbf45('0xe'));var jsforce=require(_0xbf45('0xf'));var deskjs=require(_0xbf45('0x10'));var toCsv=require(_0xbf45('0x9'));var querystring=require(_0xbf45('0x11'));var Papa=require(_0xbf45('0x12'));var AWS=require(_0xbf45('0x13'));var uuidv4=require('uuid/v4');var Redis=require(_0xbf45('0x14'));var authService=require(_0xbf45('0x15'));var qs=require(_0xbf45('0x16'));var as=require(_0xbf45('0x17'));var hardwareService=require(_0xbf45('0x18'));var logger=require(_0xbf45('0x19'))('api');var utils=require(_0xbf45('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbf45('0x1b'))['db'];function respondWithStatusCode(_0x28ea3b,_0x18c879){_0x18c879=_0x18c879||0xcc;return function(_0x595ede){if(_0x595ede){return _0x28ea3b[_0xbf45('0x1c')](_0x18c879);}return _0x28ea3b['status'](_0x18c879)['end']();};}function respondWithResult(_0x98bf89,_0x54fcb7){_0x54fcb7=_0x54fcb7||0xc8;return function(_0x27b84f){if(_0x27b84f){return _0x98bf89[_0xbf45('0x1d')](_0x54fcb7)[_0xbf45('0x1e')](_0x27b84f);}};}function respondWithFilteredResult(_0x43bc42,_0x7a19c9){return function(_0x139bac){if(_0x139bac){var _0x135353=typeof _0x7a19c9['offset']===_0xbf45('0x1f')&&typeof _0x7a19c9['limit']===_0xbf45('0x1f');var _0x2283a7=_0x139bac['count'];var _0xb0cc8a=_0x135353?0x0:_0x7a19c9[_0xbf45('0x20')];var _0x3993d1=_0x135353?_0x139bac[_0xbf45('0x21')]:_0x7a19c9[_0xbf45('0x20')]+_0x7a19c9['limit'];var _0x279829;if(_0x3993d1>=_0x2283a7){_0x3993d1=_0x2283a7;_0x279829=0xc8;}else{_0x279829=0xce;}_0x43bc42[_0xbf45('0x1d')](_0x279829);return _0x43bc42[_0xbf45('0x22')](_0xbf45('0x23'),_0xb0cc8a+'-'+_0x3993d1+'/'+_0x2283a7)['json'](_0x139bac);}return null;};}function patchUpdates(_0x3aedf7){return function(_0x3256dc){try{jsonpatch[_0xbf45('0x24')](_0x3256dc,_0x3aedf7,!![]);}catch(_0x2ac8e9){return BPromise['reject'](_0x2ac8e9);}return _0x3256dc[_0xbf45('0x25')]();};}function saveUpdates(_0x43b691,_0x3ecbb8){return function(_0x3be45d){if(_0x3be45d){return _0x3be45d[_0xbf45('0x26')](_0x43b691)[_0xbf45('0x27')](function(_0x53d439){return _0x53d439;});}return null;};}function removeEntity(_0x59e196,_0x1595ae){return function(_0x4879aa){if(_0x4879aa){return _0x4879aa[_0xbf45('0x28')]()['then'](function(){_0x59e196[_0xbf45('0x1d')](0xcc)[_0xbf45('0x29')]();});}};}function handleEntityNotFound(_0x3a6171,_0x6a894e){return function(_0x5c5a36){if(!_0x5c5a36){_0x3a6171['sendStatus'](0x194);}return _0x5c5a36;};}function handleError(_0x48ddec,_0x4f4518){_0x4f4518=_0x4f4518||0x1f4;return function(_0x139d73){logger[_0xbf45('0x2a')](_0x139d73[_0xbf45('0x2b')]);if(_0x139d73[_0xbf45('0x2c')]){delete _0x139d73['name'];}_0x48ddec[_0xbf45('0x1d')](_0x4f4518)[_0xbf45('0x2d')](_0x139d73);};}exports['index']=function(_0x5b4775,_0x285734){var _0x5f03e5={},_0x536c23={},_0x5e6b45={'count':0x0,'rows':[]};var _0x12a50e=_[_0xbf45('0x2e')](db[_0xbf45('0x2f')][_0xbf45('0x30')],function(_0x507180){return{'name':_0x507180[_0xbf45('0x31')],'type':_0x507180[_0xbf45('0x32')]['key']};});_0x536c23[_0xbf45('0x33')]=_['differenceBy'](_[_0xbf45('0x2e')](_0x12a50e,'name'),['format']);_0x536c23[_0xbf45('0x34')]=_[_0xbf45('0x35')](_0x5b4775[_0xbf45('0x34')]);_0x536c23[_0xbf45('0x36')]=_[_0xbf45('0x37')](_0x536c23['model'],_0x536c23[_0xbf45('0x34')]);_0x5f03e5[_0xbf45('0x38')]=_[_0xbf45('0x37')](_0x536c23[_0xbf45('0x33')],qs['fields'](_0x5b4775[_0xbf45('0x34')][_0xbf45('0x39')]));_0x5f03e5[_0xbf45('0x38')]=_0x5f03e5[_0xbf45('0x38')][_0xbf45('0x3a')]?_0x5f03e5[_0xbf45('0x38')]:_0x536c23[_0xbf45('0x33')];if(!_0x5b4775[_0xbf45('0x34')][_0xbf45('0x3b')]('nolimit')){_0x5f03e5[_0xbf45('0x3c')]=qs['limit'](_0x5b4775['query'][_0xbf45('0x3c')]);_0x5f03e5[_0xbf45('0x20')]=qs[_0xbf45('0x20')](_0x5b4775[_0xbf45('0x34')][_0xbf45('0x20')]);}_0x5f03e5['order']=qs[_0xbf45('0x3d')](_0x5b4775[_0xbf45('0x34')]['sort']);_0x5f03e5['where']=qs['filters'](_[_0xbf45('0x3e')](_0x5b4775[_0xbf45('0x34')],_0x536c23[_0xbf45('0x36')]),_0x12a50e);if(_0x5b4775[_0xbf45('0x34')][_0xbf45('0x3f')]){_0x5f03e5['where']=_[_0xbf45('0x40')](_0x5f03e5['where'],{'$or':_[_0xbf45('0x2e')](_0x12a50e,function(_0x26ba7b){if(_0x26ba7b[_0xbf45('0x32')]!==_0xbf45('0x41')){var _0x49b932={};_0x49b932[_0x26ba7b[_0xbf45('0x2c')]]={'$like':'%'+_0x5b4775['query'][_0xbf45('0x3f')]+'%'};return _0x49b932;}})});}_0x5f03e5=_['merge']({},_0x5f03e5,_0x5b4775[_0xbf45('0x42')]);var _0x234c73={'where':_0x5f03e5[_0xbf45('0x43')]};return db['VoiceRecording']['count'](_0x234c73)[_0xbf45('0x27')](function(_0x415a65){_0x5e6b45['count']=_0x415a65;if(_0x5b4775[_0xbf45('0x34')][_0xbf45('0x44')]){_0x5f03e5[_0xbf45('0x45')]=[{'all':!![]}];}return db[_0xbf45('0x2f')][_0xbf45('0x46')](_0x5f03e5);})[_0xbf45('0x27')](function(_0x1ccb33){_0x5e6b45[_0xbf45('0x47')]=_0x1ccb33;return _0x5e6b45;})[_0xbf45('0x27')](respondWithFilteredResult(_0x285734,_0x5f03e5))[_0xbf45('0x48')](handleError(_0x285734,null));};exports[_0xbf45('0x49')]=function(_0x291dd3,_0x1b7450){var _0x4d7fa6={'raw':![],'where':{'id':_0x291dd3[_0xbf45('0x4a')]['id']}},_0x2f7fa1={};_0x2f7fa1[_0xbf45('0x33')]=_[_0xbf45('0x35')](db[_0xbf45('0x2f')][_0xbf45('0x30')]);_0x2f7fa1[_0xbf45('0x34')]=_[_0xbf45('0x35')](_0x291dd3[_0xbf45('0x34')]);_0x2f7fa1[_0xbf45('0x36')]=_['intersection'](_0x2f7fa1[_0xbf45('0x33')],_0x2f7fa1[_0xbf45('0x34')]);_0x4d7fa6[_0xbf45('0x38')]=_[_0xbf45('0x37')](_0x2f7fa1[_0xbf45('0x33')],qs[_0xbf45('0x39')](_0x291dd3['query'][_0xbf45('0x39')]));_0x4d7fa6['attributes']=_0x4d7fa6[_0xbf45('0x38')]['length']?_0x4d7fa6[_0xbf45('0x38')]:_0x2f7fa1[_0xbf45('0x33')];if(_0x291dd3[_0xbf45('0x34')][_0xbf45('0x44')]){_0x4d7fa6['include']=[{'all':!![]}];}_0x4d7fa6=_[_0xbf45('0x40')]({},_0x4d7fa6,_0x291dd3[_0xbf45('0x42')]);return db['VoiceRecording']['find'](_0x4d7fa6)['then'](handleEntityNotFound(_0x1b7450,null))[_0xbf45('0x27')](respondWithResult(_0x1b7450,null))['catch'](handleError(_0x1b7450,null));};exports[_0xbf45('0x4b')]=function(_0x5d45e3,_0x373322){return db[_0xbf45('0x2f')]['create'](_0x5d45e3['body'],{})[_0xbf45('0x27')](respondWithResult(_0x373322,0xc9))[_0xbf45('0x48')](handleError(_0x373322,null));};exports['update']=function(_0x2bf1c7,_0x48246b){if(_0x2bf1c7[_0xbf45('0x4c')]['id']){delete _0x2bf1c7[_0xbf45('0x4c')]['id'];}return db[_0xbf45('0x2f')][_0xbf45('0x4d')]({'where':{'id':_0x2bf1c7[_0xbf45('0x4a')]['id']}})[_0xbf45('0x27')](handleEntityNotFound(_0x48246b,null))[_0xbf45('0x27')](saveUpdates(_0x2bf1c7['body'],null))['then'](respondWithResult(_0x48246b,null))[_0xbf45('0x48')](handleError(_0x48246b,null));};exports[_0xbf45('0x4e')]=function(_0xa01074,_0x40f51a){return db[_0xbf45('0x2f')]['describe']()[_0xbf45('0x27')](respondWithResult(_0x40f51a,null))[_0xbf45('0x48')](handleError(_0x40f51a,null));};exports[_0xbf45('0x4f')]=function(_0x4504b5,_0x22f496,_0x9d34d){var _0x1d6958=require(_0xbf45('0x50'));var _0x3834c5=![];var _0x480b16={};if(_0x4504b5[_0xbf45('0x34')][_0xbf45('0x32')]&&_0x4504b5['query']['type']===_0xbf45('0x51')){_0x480b16[_0xbf45('0x51')]=_0x4504b5[_0xbf45('0x4a')]['id'];}else{_0x480b16['id']=_0x4504b5[_0xbf45('0x4a')]['id'];}return db[_0xbf45('0x2f')]['find']({'where':_0x480b16,'attributes':['id',_0xbf45('0x52')],'raw':!![]})[_0xbf45('0x27')](handleEntityNotFound(_0x22f496,null))['then'](function(_0x3bc111){if(_0x3bc111){var _0x212c0a=_0x3bc111[_0xbf45('0x52')];var _0x18f119=util[_0xbf45('0x53')](_0xbf45('0x54'),_0x212c0a);if(fs[_0xbf45('0x55')](_0x18f119)){_0x3834c5=!![];return _0x1d6958[_0xbf45('0x56')](_0x18f119,_0x212c0a,config[_0xbf45('0x57')][_0xbf45('0x58')])[_0xbf45('0x27')](function(){return _0x3bc111;});}return _0x3bc111;}})[_0xbf45('0x27')](function(_0x19bef6){if(_0x19bef6){var _0x3b691d=_0x19bef6[_0xbf45('0x52')];if(!fs[_0xbf45('0x55')](_0x3b691d)){throw new db[(_0xbf45('0x59'))][(_0xbf45('0x5a'))](_0xbf45('0x5b'));}if(_0x19bef6[_0xbf45('0x5c')]){return _0x22f496['download'](_0x3b691d,_0x19bef6[_0xbf45('0x5c')]+path['extname'](_0x3b691d),function(){if(_0x3834c5){fs[_0xbf45('0x5d')](_0x3b691d);}});}else{return _0x22f496[_0xbf45('0x4f')](_0x3b691d,function(_0x5a73ca){if(_0x3834c5){fs['unlink'](_0x3b691d);}});}}})[_0xbf45('0x48')](function(_0x2fbdf0){if(_0x2fbdf0[_0xbf45('0x5e')]===_0xbf45('0x5b')){_0x22f496[_0xbf45('0x1d')](0x194)['send']('Not\x20found');}else{return handleError(_0x22f496,null);}});};exports[_0xbf45('0x5f')]=function(_0x5c27f1,_0x55db59,_0x38b6a8){var _0x47c470=require('../../components/encryptor');var _0x4fb070=![];var _0x25381e={'$and':[db['sequelize'][_0xbf45('0x43')](db[_0xbf45('0x60')]['fn'](_0xbf45('0x61'),db[_0xbf45('0x60')][_0xbf45('0x62')](_0xbf45('0x51'))),_0x5c27f1[_0xbf45('0x34')]['token'])]};if(_0x5c27f1[_0xbf45('0x34')][_0xbf45('0x32')]&&_0x5c27f1[_0xbf45('0x34')][_0xbf45('0x32')]===_0xbf45('0x51')){_0x25381e['$and'][_0xbf45('0x63')]({'uniqueid':_0x5c27f1[_0xbf45('0x4a')]['id']});}else{_0x25381e[_0xbf45('0x64')][_0xbf45('0x63')]({'id':_0x5c27f1['params']['id']});}return db[_0xbf45('0x2f')]['find']({'where':_0x25381e,'attributes':['id','value'],'raw':!![]})[_0xbf45('0x27')](handleEntityNotFound(_0x55db59,null))[_0xbf45('0x27')](function(_0x4ae079){if(_0x4ae079){var _0x2f0065=util[_0xbf45('0x53')]('%s.cypher',_0x4ae079[_0xbf45('0x52')]);if(fs[_0xbf45('0x55')](_0x2f0065)){_0x4fb070=!![];return _0x47c470[_0xbf45('0x56')](_0x2f0065,_0x4ae079[_0xbf45('0x52')],config[_0xbf45('0x57')][_0xbf45('0x58')])[_0xbf45('0x27')](function(){return _0x4ae079;});}return _0x4ae079;}})[_0xbf45('0x27')](function(_0x112e45){if(_0x112e45){if(!fs[_0xbf45('0x55')](_0x112e45[_0xbf45('0x52')])){throw new db[(_0xbf45('0x59'))][(_0xbf45('0x5a'))](_0xbf45('0x5b'));}if(_0x112e45['filename']){return _0x55db59[_0xbf45('0x4f')](_0x112e45[_0xbf45('0x52')],_0x112e45['filename']+path['extname'](_0x112e45[_0xbf45('0x52')]),function(){if(_0x4fb070){fs['unlink'](_0x112e45[_0xbf45('0x52')]);}});}else{return _0x55db59[_0xbf45('0x4f')](_0x112e45[_0xbf45('0x52')],function(_0x9efa63){if(_0x4fb070){fs[_0xbf45('0x5d')](_0x112e45['value']);}});}}})['catch'](handleError(_0x55db59,null));};exports['destroy']=function(_0x1ba167,_0x16c674){return db[_0xbf45('0x2f')][_0xbf45('0x4d')]({'where':{'id':_0x1ba167[_0xbf45('0x4a')]['id']}})[_0xbf45('0x27')](function(_0x83a32a){if(_[_0xbf45('0x65')](_0x83a32a)){throw new ReferenceError(_0xbf45('0x66'));}return _0x83a32a;})[_0xbf45('0x27')](function(_0x4f7ea6){var _0x5baec0=_0x4f7ea6[_0xbf45('0x52')];logger['info'](_0xbf45('0x67'),_0x5baec0);if(!_['isNil'](_0x4f7ea6[_0xbf45('0x52')])&&fs['existsSync'](_0x5baec0)){logger[_0xbf45('0x68')](_0xbf45('0x69')+_0x5baec0+_0xbf45('0x6a'));fs[_0xbf45('0x6b')](_0x5baec0);}_0x5baec0=_0x5baec0+_0xbf45('0x6c');if(!_[_0xbf45('0x65')](_0x4f7ea6['value'])&&fs[_0xbf45('0x55')](_0x5baec0)){logger[_0xbf45('0x68')](_0xbf45('0x69')+_0x5baec0+_0xbf45('0x6a'));fs[_0xbf45('0x6b')](_0x5baec0);}return _0x4f7ea6;})[_0xbf45('0x27')](function(_0x208793){if(!_0x208793)throw new InternalError();return _0x208793[_0xbf45('0x28')]();})[_0xbf45('0x27')](function(){_0x16c674[_0xbf45('0x1d')](0xcc)[_0xbf45('0x29')]();})[_0xbf45('0x48')](handleError(_0x16c674,null));};function getBucketslist(_0xef4c0b,_0x4da81a,_0xc5ef13){return new Promise(function(_0x66ed62,_0x247005){var _0x4b06ad=new AWS['S3']({'accessKeyId':_0x4da81a,'secretAccessKey':_0xef4c0b,'region':_0xc5ef13});_0x4b06ad[_0xbf45('0x6d')]({},function(_0x344e3b,_0x338422){if(_0x344e3b){return _0x247005(_0x344e3b);}else{return _0x66ed62(_0x338422);}});});}function createBucket(_0x1c8018,_0x326e4c,_0x39047d,_0x3c77bc){return new Promise(function(_0x4dfbad,_0x62594c){var _0x595b56=new AWS['S3']({'accessKeyId':_0x326e4c,'secretAccessKey':_0x1c8018,'region':_0x39047d});_0x595b56[_0xbf45('0x6e')]({'Bucket':_0x3c77bc},function(_0x49bc74,_0x433fd2){if(_0x49bc74){return _0x62594c(_0x49bc74);}else{return _0x4dfbad(_0x433fd2);}});});}function uploadFile(_0x14f75f,_0x1c66b5,_0x22bae2,_0x6c4854,_0x4f25b9,_0x45032b){return new Promise(function(_0x3e2745,_0x28f37f){var _0x149705=new AWS['S3']({'accessKeyId':_0x1c66b5,'secretAccessKey':_0x14f75f,'region':_0x22bae2});_0x149705[_0xbf45('0x6f')]({'Bucket':_0x6c4854,'Key':_0x4f25b9,'Body':_0x45032b},function(_0xbeb963,_0xaf7bb0){if(_0xbeb963){return _0x28f37f(_0xbeb963);}else{return _0x3e2745(_0xaf7bb0);}});});}function startTranscribe(_0x41791d,_0x59baec,_0x3d5009,_0x51db35,_0x1467c8,_0x44d46f){return new Promise(function(_0x6beac5,_0x59269a){var _0x38f3ce=new AWS[(_0xbf45('0x70'))]({'accessKeyId':_0x59baec,'secretAccessKey':_0x41791d,'region':_0x3d5009});_0x38f3ce[_0xbf45('0x71')]({'TranscriptionJobName':_0x51db35,'LanguageCode':_0x1467c8,'Media':{'MediaFileUri':_0x44d46f}},function(_0xbbb305,_0x376d0a){if(_0xbbb305){return _0x59269a(_0xbbb305);}else{return _0x6beac5(_0x376d0a);}});});}function transcribe(_0x5bec3f,_0xc88a35,_0x75ec9e,_0xcaa02,_0x38e9fd,_0x3cfc83,_0x2dcdb7){return new Promise(function(_0x3e84fd,_0x53b4cf){var _0x589885={};logger[_0xbf45('0x68')](util[_0xbf45('0x53')](_0xbf45('0x72'),_0x5bec3f,_0x38e9fd));return uploadFile(_0xc88a35,_0x75ec9e,_0xcaa02,_0x38e9fd,path[_0xbf45('0x73')](_0x3cfc83),fs[_0xbf45('0x74')](_0x3cfc83))[_0xbf45('0x27')](function(_0x5822a8){logger[_0xbf45('0x68')](util['format'](_0xbf45('0x75'),_0x5bec3f,_0x38e9fd,_0x5822a8[_0xbf45('0x76')]));_0x589885[_0xbf45('0x77')]=_0x5822a8['Bucket'];_0x589885['location']=_0x5822a8['Location'];logger[_0xbf45('0x68')](util[_0xbf45('0x53')](_0xbf45('0x78'),_0x5bec3f));return startTranscribe(_0xc88a35,_0x75ec9e,_0xcaa02,uuidv4(),_0x2dcdb7,_0x5822a8[_0xbf45('0x76')]);})['then'](function(_0x54149f){logger[_0xbf45('0x68')](util['format'](_0xbf45('0x79'),_0x5bec3f,_0x54149f[_0xbf45('0x7a')][_0xbf45('0x7b')]));_0x589885[_0xbf45('0x7c')]=_0x54149f[_0xbf45('0x7a')]['TranscriptionJobName'];_0x589885[_0xbf45('0x7d')]=_0x54149f[_0xbf45('0x7a')]['TranscriptionJobStatus'];return _0x3e84fd(_0x589885);})[_0xbf45('0x48')](function(_0x128e25){return _0x53b4cf(_0x128e25);});});}exports[_0xbf45('0x7e')]=function(_0x21dcac,_0x20b2db,_0x4b5d40){var _0x85b041;var _0x2f892b;var _0x400bbd;var _0x5c1e3a=require(_0xbf45('0x50'));return db[_0xbf45('0x2f')][_0xbf45('0x7f')]({'where':{'id':_0x21dcac[_0xbf45('0x4a')]['id']}})['then'](function(_0xffc546){if(_0xffc546){var _0x36ec1e=util[_0xbf45('0x53')](_0xbf45('0x54'),_0xffc546['value']);if(fs[_0xbf45('0x55')](_0x36ec1e)){cypher=!![];return _0x5c1e3a[_0xbf45('0x56')](_0x36ec1e,_0xffc546['value'],config[_0xbf45('0x57')][_0xbf45('0x58')])[_0xbf45('0x27')](function(){return _0xffc546;});}return _0xffc546;}})[_0xbf45('0x27')](function(_0x5c1d6c){if(!_0x5c1d6c){throw new db['Sequelize']['ValidationError'](_0xbf45('0x80'));}_0x2f892b=_0x5c1d6c;return db[_0xbf45('0x81')][_0xbf45('0x7f')]({'where':{'id':0x1}});})[_0xbf45('0x27')](handleEntityNotFound(_0x20b2db,null))['then'](function(_0x5dcba4){if(_0x5dcba4){_0x85b041=_0x5dcba4;if(!_0x85b041[_0xbf45('0x82')]||!_0x85b041[_0xbf45('0x83')]||!_0x85b041[_0xbf45('0x84')]||!_0x85b041[_0xbf45('0x85')]||!_0x85b041[_0xbf45('0x77')]){throw new db[(_0xbf45('0x59'))][(_0xbf45('0x5a'))](_0xbf45('0x86'));}if(_0x21dcac[_0xbf45('0x4c')][_0xbf45('0x87')]&&(!_0x85b041[_0xbf45('0x88')]||!_0x85b041['sentimentAccountId']||!_0x85b041[_0xbf45('0x89')]||!_0x85b041[_0xbf45('0x85')]||!_0x85b041[_0xbf45('0x77')])){throw new db[(_0xbf45('0x59'))][(_0xbf45('0x5a'))](_0xbf45('0x8a'));}return db['CloudProvider'][_0xbf45('0x7f')]({'where':{'id':_0x85b041['transcribeAccountId']}});}})[_0xbf45('0x27')](function(_0xf53bf5){if(!_0xf53bf5){throw new db['Sequelize'][(_0xbf45('0x5a'))](_0xbf45('0x8b'));}if(!_0xf53bf5[_0xbf45('0x8c')]||!_0xf53bf5[_0xbf45('0x8d')]){throw new db[(_0xbf45('0x59'))][(_0xbf45('0x5a'))](_0xbf45('0x8e'));}_0x400bbd=_0xf53bf5;return getBucketslist(_0x400bbd[_0xbf45('0x8c')],_0x400bbd[_0xbf45('0x8d')],_0x85b041['transcribeRegion']);})[_0xbf45('0x27')](function(_0x35f3d1){if(_0x35f3d1&&_0x35f3d1[_0xbf45('0x8f')]){var _0x14118b=_['find'](_0x35f3d1[_0xbf45('0x8f')],function(_0x106beb){return _0x106beb[_0xbf45('0x90')]===_0x85b041[_0xbf45('0x77')];});if(!_0x14118b){logger[_0xbf45('0x68')](util[_0xbf45('0x53')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x21dcac['params']['id'],_0x85b041[_0xbf45('0x77')]));return createBucket(_0x400bbd[_0xbf45('0x8c')],_0x400bbd[_0xbf45('0x8d')],_0x85b041[_0xbf45('0x84')],_0x85b041['bucket']);}logger[_0xbf45('0x68')](util[_0xbf45('0x53')](_0xbf45('0x91'),_0x21dcac[_0xbf45('0x4a')]['id'],_0x85b041[_0xbf45('0x77')]));return;}})[_0xbf45('0x27')](function(_0x403912){if(_0x2f892b['transcribeStatus']===_0xbf45('0x92')){return transcribe(_0x21dcac[_0xbf45('0x4a')]['id'],_0x400bbd[_0xbf45('0x8c')],_0x400bbd['data2'],_0x85b041['transcribeRegion'],_0x85b041[_0xbf45('0x77')],_0x2f892b[_0xbf45('0x52')],_0x85b041['language']);}else{logger[_0xbf45('0x68')](util[_0xbf45('0x53')](_0xbf45('0x93'),_0x21dcac[_0xbf45('0x4a')]['id']));return{'transcribeStatus':_0xbf45('0x94')};}})[_0xbf45('0x27')](function(_0x24818c){if(_0x24818c){_0x24818c[_0xbf45('0x95')]=_0x21dcac[_0xbf45('0x4c')]['runSentiment'];return _0x2f892b[_0xbf45('0x96')](_0x24818c);}})[_0xbf45('0x27')](respondWithResult(_0x20b2db,null))[_0xbf45('0x48')](handleError(_0x20b2db,null));};function writeFile(_0x7f8745,_0x20e216){return new Promise(function(_0x1a8b20,_0x397213){fs[_0xbf45('0x97')](_0x20e216,_0x7f8745,function(_0xa20ec1,_0x1299be){if(_0xa20ec1){return _0x397213(_0xa20ec1);}else{return _0x1a8b20(_0x1299be);}});});}exports[_0xbf45('0x98')]=function(_0x559f08,_0x18a467,_0x4a5409){return db[_0xbf45('0x2f')]['findOne']({'where':{'id':_0x559f08[_0xbf45('0x4a')]['id']}})['then'](handleEntityNotFound(_0x18a467))['then'](function(_0x5a4c2b){if(_0x5a4c2b&&_0x5a4c2b[_0xbf45('0x99')]){var _0x2d2af1=_0x5a4c2b[_0xbf45('0x99')];var _0x5d77c4=config[_0xbf45('0x9a')]+_0xbf45('0x9b')+_0x5a4c2b['id']+_0xbf45('0x9c');if(fs[_0xbf45('0x55')](_0x5d77c4)){return _0x5d77c4;}return writeFile(_0x2d2af1,_0x5d77c4)[_0xbf45('0x27')](function(){return _0x5d77c4;});}else{throw new db[(_0xbf45('0x59'))]['ValidationError'](_0xbf45('0x9d'));}})['then'](function(_0x4b7bec){return _0x18a467[_0xbf45('0x4f')](_0x4b7bec);})[_0xbf45('0x48')](handleError(_0x18a467));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index eecb380..0e140fb 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 _0x6bf1=['request-promise','path','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','lodash','api','moment','bluebird'];(function(_0x29adc8,_0x57bb81){var _0x511005=function(_0x10dc59){while(--_0x10dc59){_0x29adc8['push'](_0x29adc8['shift']());}};_0x511005(++_0x57bb81);}(_0x6bf1,0x71));var _0x16bf=function(_0x59aecc,_0x255014){_0x59aecc=_0x59aecc-0x0;var _0x46b112=_0x6bf1[_0x59aecc];return _0x46b112;};'use strict';var _=require(_0x16bf('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x16bf('0x1'));var moment=require(_0x16bf('0x2'));var BPromise=require(_0x16bf('0x3'));var rp=require(_0x16bf('0x4'));var fs=require('fs');var path=require(_0x16bf('0x5'));var rimraf=require('rimraf');var config=require(_0x16bf('0x6'));var attributes=require(_0x16bf('0x7'));module[_0x16bf('0x8')]=function(_0x58ec19,_0x5690e3){return _0x58ec19[_0x16bf('0x9')](_0x16bf('0xa'),attributes,{'tableName':_0x16bf('0xb'),'paranoid':![],'indexes':[{'name':_0x16bf('0xc'),'fields':[_0x16bf('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x309b=['moment','path','rimraf','exports','define','VoiceRecording','voice_recordings','uniqueid','util','../../config/logger'];(function(_0x479b99,_0x1e5bec){var _0x1e7eb7=function(_0x52ac6c){while(--_0x52ac6c){_0x479b99['push'](_0x479b99['shift']());}};_0x1e7eb7(++_0x1e5bec);}(_0x309b,0x10c));var _0xb309=function(_0xf84186,_0x4dbffe){_0xf84186=_0xf84186-0x0;var _0x4e397c=_0x309b[_0xf84186];return _0x4e397c;};'use strict';var _=require('lodash');var util=require(_0xb309('0x0'));var logger=require(_0xb309('0x1'))('api');var moment=require(_0xb309('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb309('0x3'));var rimraf=require(_0xb309('0x4'));var config=require('../../config/environment');var attributes=require('./voiceRecording.attributes');module[_0xb309('0x5')]=function(_0x104d64,_0x180dd9){return _0x104d64[_0xb309('0x6')](_0xb309('0x7'),attributes,{'tableName':_0xb309('0x8'),'paranoid':![],'indexes':[{'name':_0xb309('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 11f74d6..eedaba6 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 _0xf61e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateVoiceRecording','update','body','options','raw','where','then','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','VoiceRecording','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird'];(function(_0x334972,_0x41ba13){var _0x41236d=function(_0x38633c){while(--_0x38633c){_0x334972['push'](_0x334972['shift']());}};_0x41236d(++_0x41ba13);}(_0xf61e,0x191));var _0xef61=function(_0x2b0b19,_0x1f8569){_0x2b0b19=_0x2b0b19-0x0;var _0x14ee60=_0xf61e[_0x2b0b19];return _0x14ee60;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var moment=require(_0xef61('0x2'));var BPromise=require(_0xef61('0x3'));var rs=require(_0xef61('0x4'));var fs=require('fs');var Redis=require(_0xef61('0x5'));var db=require(_0xef61('0x6'))['db'];var utils=require(_0xef61('0x7'));var logger=require(_0xef61('0x8'))(_0xef61('0x9'));var config=require(_0xef61('0xa'));var jayson=require(_0xef61('0xb'));var client=jayson['client'][_0xef61('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e2f79,_0x4f0cc5,_0x2242a7){return new BPromise(function(_0x277fa1,_0x106e7f){return client['request'](_0x3e2f79,_0x2242a7)['then'](function(_0x188894){logger[_0xef61('0xd')](_0xef61('0xe'),_0x4f0cc5,_0xef61('0xf'));logger[_0xef61('0x10')](_0xef61('0x11'),_0x4f0cc5,_0xef61('0xf'),JSON[_0xef61('0x12')](_0x188894));if(_0x188894[_0xef61('0x13')]){if(_0x188894[_0xef61('0x13')][_0xef61('0x14')]===0x1f4){logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x188894[_0xef61('0x13')]['message']);return _0x106e7f(_0x188894[_0xef61('0x13')]['message']);}logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x188894[_0xef61('0x13')][_0xef61('0x15')]);return _0x277fa1(_0x188894['error'][_0xef61('0x15')]);}else{logger[_0xef61('0xd')](_0xef61('0xe'),_0x4f0cc5,_0xef61('0xf'));_0x277fa1(_0x188894['result'][_0xef61('0x15')]);}})[_0xef61('0x16')](function(_0x4f7a62){logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x4f7a62);_0x106e7f(_0x4f7a62);});});}exports[_0xef61('0x17')]=function(_0x22dc1b){var _0xfc36d6=this;return new Promise(function(_0x28315a,_0xdd5e38){return db['VoiceRecording'][_0xef61('0x18')](_0x22dc1b[_0xef61('0x19')],{'raw':_0x22dc1b['options']?_0x22dc1b[_0xef61('0x1a')][_0xef61('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22dc1b[_0xef61('0x1a')]?_0x22dc1b[_0xef61('0x1a')][_0xef61('0x1c')]||null:null,'attributes':_0x22dc1b[_0xef61('0x1a')]?_0x22dc1b[_0xef61('0x1a')]['attributes']||null:null,'limit':_0x22dc1b['options']?_0x22dc1b[_0xef61('0x1a')]['limit']||null:null})[_0xef61('0x1d')](function(_0x5ae7a2){logger['info'](_0xef61('0x17'),_0x22dc1b);logger['debug']('UpdateVoiceRecording',_0x22dc1b,JSON[_0xef61('0x12')](_0x5ae7a2));_0x28315a(_0x5ae7a2);})[_0xef61('0x16')](function(_0x3ceb14){logger[_0xef61('0x13')]('UpdateVoiceRecording',_0x3ceb14[_0xef61('0x15')],_0x22dc1b);_0xdd5e38(_0xfc36d6['error'](0x1f4,_0x3ceb14[_0xef61('0x15')]));});});};exports[_0xef61('0x1e')]=function(_0x2419a9){var _0xf4c7c9=this;return new Promise(function(_0x2155f1,_0x45ece2){var _0x258b5a=require(_0xef61('0x1f'));var _0x297df7;return db[_0xef61('0x20')][_0xef61('0x21')]({'attributes':['id',_0xef61('0x22')],'where':{'id':0x1},'raw':!![]})[_0xef61('0x1d')](function(_0x63edd4){_0x297df7=_0x63edd4;return db[_0xef61('0x23')][_0xef61('0x24')](_0x2419a9[_0xef61('0x19')]);})[_0xef61('0x1d')](function(_0x587e26){if(_0x297df7[_0xef61('0x22')]&&fs[_0xef61('0x25')](_0x587e26[_0xef61('0x26')])){var _0x4f35ad=util['format'](_0xef61('0x27'),_0x587e26[_0xef61('0x26')]);return _0x258b5a[_0xef61('0x28')](_0x587e26['value'],_0x4f35ad,config[_0xef61('0x29')][_0xef61('0x2a')])['then'](function(){fs[_0xef61('0x2b')](_0x587e26['value']);logger['info'](_0xef61('0x2c'));return _0x587e26;});}return _0x587e26;})['then'](function(_0x8ed629){logger['info'](_0xef61('0x1e'),_0x2419a9);logger[_0xef61('0x10')](_0xef61('0x1e'),_0x2419a9,JSON[_0xef61('0x12')](_0x8ed629));_0x2155f1(_0x8ed629);})[_0xef61('0x16')](function(_0x1bdcb9){logger[_0xef61('0x13')](_0xef61('0x1e'),_0x1bdcb9[_0xef61('0x15')],_0x2419a9);_0x45ece2(_0xf4c7c9[_0xef61('0x13')](0x1f4,_0x1bdcb9['message']));});});}; \ No newline at end of file +var _0x82c4=['value','format','%s.cypher','encryptFile','secrets','recording','unlink','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateVoiceRecording','update','options','raw','where','attributes','CreateVoiceRecording','../../components/encryptor','findOne','create','body','callRecordingEncryption','existsSync'];(function(_0x5e5d6f,_0x34b81b){var _0x2527cf=function(_0x363541){while(--_0x363541){_0x5e5d6f['push'](_0x5e5d6f['shift']());}};_0x2527cf(++_0x34b81b);}(_0x82c4,0x1ca));var _0x482c=function(_0x5f3b0a,_0x442f2f){_0x5f3b0a=_0x5f3b0a-0x0;var _0x81e1f3=_0x82c4[_0x5f3b0a];return _0x81e1f3;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var moment=require(_0x482c('0x2'));var BPromise=require(_0x482c('0x3'));var rs=require(_0x482c('0x4'));var fs=require('fs');var Redis=require(_0x482c('0x5'));var db=require(_0x482c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x482c('0x7'))('rpc');var config=require(_0x482c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x482c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfdb92,_0x32a503,_0x35cdab){return new BPromise(function(_0x1c10f2,_0x3846d8){return client['request'](_0xfdb92,_0x35cdab)[_0x482c('0xa')](function(_0x135cc1){logger[_0x482c('0xb')](_0x482c('0xc'),_0x32a503,_0x482c('0xd'));logger[_0x482c('0xe')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x32a503,_0x482c('0xd'),JSON[_0x482c('0xf')](_0x135cc1));if(_0x135cc1[_0x482c('0x10')]){if(_0x135cc1['error'][_0x482c('0x11')]===0x1f4){logger[_0x482c('0x10')](_0x482c('0xc'),_0x32a503,_0x135cc1['error']['message']);return _0x3846d8(_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);}logger['error']('VoiceRecording,\x20%s,\x20%s',_0x32a503,_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);return _0x1c10f2(_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);}else{logger[_0x482c('0xb')](_0x482c('0xc'),_0x32a503,_0x482c('0xd'));_0x1c10f2(_0x135cc1[_0x482c('0x13')][_0x482c('0x12')]);}})[_0x482c('0x14')](function(_0x363403){logger[_0x482c('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x32a503,_0x363403);_0x3846d8(_0x363403);});});}exports[_0x482c('0x15')]=function(_0x5b6f7e){var _0x3aed45=this;return new Promise(function(_0x258148,_0x4af05a){return db['VoiceRecording'][_0x482c('0x16')](_0x5b6f7e['body'],{'raw':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e[_0x482c('0x17')][_0x482c('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e['options'][_0x482c('0x19')]||null:null,'attributes':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e[_0x482c('0x17')][_0x482c('0x1a')]||null:null,'limit':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e['options']['limit']||null:null})[_0x482c('0xa')](function(_0x147d05){logger[_0x482c('0xb')]('UpdateVoiceRecording',_0x5b6f7e);logger[_0x482c('0xe')]('UpdateVoiceRecording',_0x5b6f7e,JSON[_0x482c('0xf')](_0x147d05));_0x258148(_0x147d05);})[_0x482c('0x14')](function(_0x4f1108){logger[_0x482c('0x10')]('UpdateVoiceRecording',_0x4f1108['message'],_0x5b6f7e);_0x4af05a(_0x3aed45[_0x482c('0x10')](0x1f4,_0x4f1108[_0x482c('0x12')]));});});};exports[_0x482c('0x1b')]=function(_0x1f4501){var _0x3bd5bb=this;return new Promise(function(_0x215826,_0x2981d2){var _0x5ad788=require(_0x482c('0x1c'));var _0x255417;return db['Setting'][_0x482c('0x1d')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})['then'](function(_0x207441){_0x255417=_0x207441;return db['VoiceRecording'][_0x482c('0x1e')](_0x1f4501[_0x482c('0x1f')]);})[_0x482c('0xa')](function(_0x11fa65){if(_0x255417[_0x482c('0x20')]&&fs[_0x482c('0x21')](_0x11fa65[_0x482c('0x22')])){var _0x3e9b22=util[_0x482c('0x23')](_0x482c('0x24'),_0x11fa65[_0x482c('0x22')]);return _0x5ad788[_0x482c('0x25')](_0x11fa65[_0x482c('0x22')],_0x3e9b22,config[_0x482c('0x26')][_0x482c('0x27')])[_0x482c('0xa')](function(){fs[_0x482c('0x28')](_0x11fa65[_0x482c('0x22')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x11fa65;});}return _0x11fa65;})['then'](function(_0x2fd9d0){logger[_0x482c('0xb')](_0x482c('0x1b'),_0x1f4501);logger[_0x482c('0xe')]('CreateVoiceRecording',_0x1f4501,JSON[_0x482c('0xf')](_0x2fd9d0));_0x215826(_0x2fd9d0);})['catch'](function(_0x31428c){logger[_0x482c('0x10')](_0x482c('0x1b'),_0x31428c[_0x482c('0x12')],_0x1f4501);_0x2981d2(_0x3bd5bb[_0x482c('0x10')](0x1f4,_0x31428c[_0x482c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 88b692c..d0ca9be 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 _0xccd8=['isAuthenticated','describe','/:id','show','post','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceTransferReport.controller','get'];(function(_0x213aac,_0x30117f){var _0x20bc6f=function(_0x2b1baf){while(--_0x2b1baf){_0x213aac['push'](_0x213aac['shift']());}};_0x20bc6f(++_0x30117f);}(_0xccd8,0x17f));var _0x8ccd=function(_0x15a634,_0x4feb86){_0x15a634=_0x15a634-0x0;var _0xf4f7a0=_0xccd8[_0x15a634];return _0xf4f7a0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8ccd('0x0'));var timeout=require(_0x8ccd('0x1'));var express=require(_0x8ccd('0x2'));var router=express[_0x8ccd('0x3')]();var fs_extra=require(_0x8ccd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8ccd('0x5'));var config=require('../../config/environment');var controller=require(_0x8ccd('0x6'));router[_0x8ccd('0x7')]('/',auth[_0x8ccd('0x8')](),controller['index']);router[_0x8ccd('0x7')]('/describe',auth[_0x8ccd('0x8')](),controller[_0x8ccd('0x9')]);router[_0x8ccd('0x7')](_0x8ccd('0xa'),auth[_0x8ccd('0x8')](),controller[_0x8ccd('0xb')]);router[_0x8ccd('0xc')]('/',auth[_0x8ccd('0x8')](),controller['create']);router['put'](_0x8ccd('0xa'),auth['isAuthenticated'](),controller[_0x8ccd('0xd')]);router[_0x8ccd('0xe')](_0x8ccd('0xa'),auth[_0x8ccd('0x8')](),controller[_0x8ccd('0xf')]);module[_0x8ccd('0x10')]=router; \ No newline at end of file +var _0xed7b=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','show','post','put','/:id','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x50c95f,_0x934e58){var _0x5bbbc2=function(_0x52a2f){while(--_0x52a2f){_0x50c95f['push'](_0x50c95f['shift']());}};_0x5bbbc2(++_0x934e58);}(_0xed7b,0x82));var _0xbed7=function(_0x78463c,_0x2d868a){_0x78463c=_0x78463c-0x0;var _0x3b21f6=_0xed7b[_0x78463c];return _0x3b21f6;};'use strict';var multer=require(_0xbed7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbed7('0x1'));var express=require(_0xbed7('0x2'));var router=express['Router']();var fs_extra=require(_0xbed7('0x3'));var auth=require(_0xbed7('0x4'));var interaction=require(_0xbed7('0x5'));var config=require(_0xbed7('0x6'));var controller=require(_0xbed7('0x7'));router[_0xbed7('0x8')]('/',auth[_0xbed7('0x9')](),controller[_0xbed7('0xa')]);router[_0xbed7('0x8')](_0xbed7('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xbed7('0x8')]('/:id',auth[_0xbed7('0x9')](),controller[_0xbed7('0xc')]);router[_0xbed7('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbed7('0xe')](_0xbed7('0xf'),auth[_0xbed7('0x9')](),controller['update']);router[_0xbed7('0x10')](_0xbed7('0xf'),auth[_0xbed7('0x9')](),controller[_0xbed7('0x11')]);module[_0xbed7('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 9e1382c..cc64873 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 _0xb51d=['sequelize','exports','ENUM','STRING'];(function(_0x4b06c1,_0x3faaf1){var _0x30cfa7=function(_0x5b625a){while(--_0x5b625a){_0x4b06c1['push'](_0x4b06c1['shift']());}};_0x30cfa7(++_0x3faaf1);}(_0xb51d,0x90));var _0xdb51=function(_0x470371,_0x3ceec4){_0x470371=_0x470371-0x0;var _0xc626d8=_0xb51d[_0x470371];return _0xc626d8;};'use strict';var Sequelize=require(_0xdb51('0x0'));var moment=require('moment');module[_0xdb51('0x1')]={'type':{'type':Sequelize[_0xdb51('0x2')]('blind','attended')},'result':{'type':Sequelize[_0xdb51('0x3')]},'transfererchannel':{'type':Sequelize[_0xdb51('0x3')]},'transferercalleridnum':{'type':Sequelize[_0xdb51('0x3')]},'transferercalleridname':{'type':Sequelize[_0xdb51('0x3')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xdb51('0x3')]},'transfereraccountcode':{'type':Sequelize[_0xdb51('0x3')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xdb51('0x3')]},'transfererlinkedid':{'type':Sequelize[_0xdb51('0x3')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xdb51('0x3')]},'transfereecalleridname':{'type':Sequelize[_0xdb51('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xdb51('0x3')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xdb51('0x3')]},'transfereecontext':{'type':Sequelize[_0xdb51('0x3')]},'transfereeexten':{'type':Sequelize[_0xdb51('0x3')]},'transfereelinkedid':{'type':Sequelize[_0xdb51('0x3')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xdb51('0x3')]}}; \ No newline at end of file +var _0x7b1e=['Yes','sequelize','exports','blind','attended','STRING','ENUM'];(function(_0x11315d,_0x9f8893){var _0x14cc59=function(_0x3c7767){while(--_0x3c7767){_0x11315d['push'](_0x11315d['shift']());}};_0x14cc59(++_0x9f8893);}(_0x7b1e,0x12e));var _0xe7b1=function(_0x16db8b,_0xca7d28){_0x16db8b=_0x16db8b-0x0;var _0x5ba017=_0x7b1e[_0x16db8b];return _0x5ba017;};'use strict';var Sequelize=require(_0xe7b1('0x0'));var moment=require('moment');module[_0xe7b1('0x1')]={'type':{'type':Sequelize['ENUM'](_0xe7b1('0x2'),_0xe7b1('0x3'))},'result':{'type':Sequelize[_0xe7b1('0x4')]},'transfererchannel':{'type':Sequelize[_0xe7b1('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xe7b1('0x4')]},'transferercalleridname':{'type':Sequelize[_0xe7b1('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xe7b1('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xe7b1('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xe7b1('0x4')]},'transfereechannel':{'type':Sequelize[_0xe7b1('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xe7b1('0x4')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xe7b1('0x4')]},'transfereelinkedid':{'type':Sequelize[_0xe7b1('0x4')]},'isexternal':{'type':Sequelize[_0xe7b1('0x5')](_0xe7b1('0x6'),'No')},'context':{'type':Sequelize[_0xe7b1('0x4')]},'extension':{'type':Sequelize[_0xe7b1('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 5e37d24..463b920 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 _0x78b8=['stack','name','send','index','VoiceTransferReport','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','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/utils','../../config/environment','../../config/license/util','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error'];(function(_0xd45615,_0x4e79b0){var _0x58ef91=function(_0x31988c){while(--_0x31988c){_0xd45615['push'](_0xd45615['shift']());}};_0x58ef91(++_0x4e79b0);}(_0x78b8,0x166));var _0x878b=function(_0x3ddefb,_0xf36fea){_0x3ddefb=_0x3ddefb-0x0;var _0x411399=_0x78b8[_0x3ddefb];return _0x411399;};'use strict';var emlformat=require(_0x878b('0x0'));var rimraf=require(_0x878b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x878b('0x2'));var rp=require('request-promise');var moment=require(_0x878b('0x3'));var BPromise=require(_0x878b('0x4'));var Mustache=require('mustache');var util=require(_0x878b('0x5'));var path=require(_0x878b('0x6'));var sox=require(_0x878b('0x7'));var csv=require(_0x878b('0x8'));var ejs=require(_0x878b('0x9'));var fs=require('fs');var fs_extra=require(_0x878b('0xa'));var _=require(_0x878b('0xb'));var squel=require(_0x878b('0xc'));var crypto=require(_0x878b('0xd'));var jsforce=require(_0x878b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x878b('0x8'));var querystring=require(_0x878b('0xf'));var Papa=require(_0x878b('0x10'));var Redis=require(_0x878b('0x11'));var authService=require(_0x878b('0x12'));var qs=require(_0x878b('0x13'));var as=require(_0x878b('0x14'));var hardwareService=require(_0x878b('0x15'));var logger=require(_0x878b('0x16'))(_0x878b('0x17'));var utils=require(_0x878b('0x18'));var config=require(_0x878b('0x19'));var licenseUtil=require(_0x878b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15e4fd,_0xd4edc7){_0xd4edc7=_0xd4edc7||0xcc;return function(_0x32a564){if(_0x32a564){return _0x15e4fd['sendStatus'](_0xd4edc7);}return _0x15e4fd['status'](_0xd4edc7)[_0x878b('0x1b')]();};}function respondWithResult(_0x281a01,_0x159e85){_0x159e85=_0x159e85||0xc8;return function(_0x4e08d8){if(_0x4e08d8){return _0x281a01[_0x878b('0x1c')](_0x159e85)['json'](_0x4e08d8);}};}function respondWithFilteredResult(_0x2fa7ba,_0x40e1dc){return function(_0x41b254){if(_0x41b254){var _0x400de4=typeof _0x40e1dc[_0x878b('0x1d')]===_0x878b('0x1e')&&typeof _0x40e1dc[_0x878b('0x1f')]===_0x878b('0x1e');var _0x5cc940=_0x41b254[_0x878b('0x20')];var _0x3a62f7=_0x400de4?0x0:_0x40e1dc[_0x878b('0x1d')];var _0x726ce9=_0x400de4?_0x41b254[_0x878b('0x20')]:_0x40e1dc[_0x878b('0x1d')]+_0x40e1dc[_0x878b('0x1f')];var _0x52f407;if(_0x726ce9>=_0x5cc940){_0x726ce9=_0x5cc940;_0x52f407=0xc8;}else{_0x52f407=0xce;}_0x2fa7ba[_0x878b('0x1c')](_0x52f407);return _0x2fa7ba['set'](_0x878b('0x21'),_0x3a62f7+'-'+_0x726ce9+'/'+_0x5cc940)[_0x878b('0x22')](_0x41b254);}return null;};}function patchUpdates(_0x5800b8){return function(_0x6c8360){try{jsonpatch[_0x878b('0x23')](_0x6c8360,_0x5800b8,!![]);}catch(_0x3e8f9a){return BPromise[_0x878b('0x24')](_0x3e8f9a);}return _0x6c8360['save']();};}function saveUpdates(_0x343fb7,_0x3777a7){return function(_0x559cfc){if(_0x559cfc){return _0x559cfc[_0x878b('0x25')](_0x343fb7)[_0x878b('0x26')](function(_0x3d888f){return _0x3d888f;});}return null;};}function removeEntity(_0x3cd169,_0x466cda){return function(_0x412b2f){if(_0x412b2f){return _0x412b2f[_0x878b('0x27')]()[_0x878b('0x26')](function(){_0x3cd169[_0x878b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xddbda6,_0xbe402f){return function(_0x272797){if(!_0x272797){_0xddbda6[_0x878b('0x28')](0x194);}return _0x272797;};}function handleError(_0x5d98e6,_0x1be8c8){_0x1be8c8=_0x1be8c8||0x1f4;return function(_0x1bb97b){logger[_0x878b('0x29')](_0x1bb97b[_0x878b('0x2a')]);if(_0x1bb97b[_0x878b('0x2b')]){delete _0x1bb97b[_0x878b('0x2b')];}_0x5d98e6['status'](_0x1be8c8)[_0x878b('0x2c')](_0x1bb97b);};}exports[_0x878b('0x2d')]=function(_0x228930,_0x34acd2){var _0x2e84a2={},_0x2733d5={},_0x5ee696={'count':0x0,'rows':[]};var _0x19f6fb=_['map'](db[_0x878b('0x2e')]['rawAttributes'],function(_0x1f22ef){return{'name':_0x1f22ef[_0x878b('0x2f')],'type':_0x1f22ef['type'][_0x878b('0x30')]};});_0x2733d5['model']=_[_0x878b('0x31')](_0x19f6fb,_0x878b('0x2b'));_0x2733d5[_0x878b('0x32')]=_[_0x878b('0x33')](_0x228930['query']);_0x2733d5[_0x878b('0x34')]=_[_0x878b('0x35')](_0x2733d5[_0x878b('0x36')],_0x2733d5[_0x878b('0x32')]);_0x2e84a2[_0x878b('0x37')]=_[_0x878b('0x35')](_0x2733d5['model'],qs[_0x878b('0x38')](_0x228930[_0x878b('0x32')][_0x878b('0x38')]));_0x2e84a2[_0x878b('0x37')]=_0x2e84a2[_0x878b('0x37')][_0x878b('0x39')]?_0x2e84a2[_0x878b('0x37')]:_0x2733d5[_0x878b('0x36')];if(!_0x228930['query'][_0x878b('0x3a')](_0x878b('0x3b'))){_0x2e84a2[_0x878b('0x1f')]=qs[_0x878b('0x1f')](_0x228930['query'][_0x878b('0x1f')]);_0x2e84a2['offset']=qs[_0x878b('0x1d')](_0x228930[_0x878b('0x32')][_0x878b('0x1d')]);}_0x2e84a2[_0x878b('0x3c')]=qs[_0x878b('0x3d')](_0x228930[_0x878b('0x32')]['sort']);_0x2e84a2[_0x878b('0x3e')]=qs[_0x878b('0x34')](_[_0x878b('0x3f')](_0x228930[_0x878b('0x32')],_0x2733d5[_0x878b('0x34')]),_0x19f6fb);if(_0x228930[_0x878b('0x32')][_0x878b('0x40')]){_0x2e84a2[_0x878b('0x3e')]=_['merge'](_0x2e84a2[_0x878b('0x3e')],{'$or':_[_0x878b('0x31')](_0x19f6fb,function(_0x13dc66){if(_0x13dc66[_0x878b('0x41')]!==_0x878b('0x42')){var _0x2b9277={};_0x2b9277[_0x13dc66['name']]={'$like':'%'+_0x228930[_0x878b('0x32')]['filter']+'%'};return _0x2b9277;}})});}_0x2e84a2=_[_0x878b('0x43')]({},_0x2e84a2,_0x228930[_0x878b('0x44')]);var _0x7a1635={'where':_0x2e84a2[_0x878b('0x3e')]};return db[_0x878b('0x2e')][_0x878b('0x20')](_0x7a1635)[_0x878b('0x26')](function(_0x133d9f){_0x5ee696[_0x878b('0x20')]=_0x133d9f;if(_0x228930['query'][_0x878b('0x45')]){_0x2e84a2[_0x878b('0x46')]=[{'all':!![]}];}return db[_0x878b('0x2e')][_0x878b('0x47')](_0x2e84a2);})[_0x878b('0x26')](function(_0x3d17b5){_0x5ee696[_0x878b('0x48')]=_0x3d17b5;return _0x5ee696;})[_0x878b('0x26')](respondWithFilteredResult(_0x34acd2,_0x2e84a2))[_0x878b('0x49')](handleError(_0x34acd2,null));};exports[_0x878b('0x4a')]=function(_0x18e89c,_0x31b1da){var _0x238d83={'raw':!![],'where':{'id':_0x18e89c[_0x878b('0x4b')]['id']}},_0x1db3d4={};_0x1db3d4[_0x878b('0x36')]=_[_0x878b('0x33')](db[_0x878b('0x2e')]['rawAttributes']);_0x1db3d4[_0x878b('0x32')]=_[_0x878b('0x33')](_0x18e89c[_0x878b('0x32')]);_0x1db3d4['filters']=_['intersection'](_0x1db3d4['model'],_0x1db3d4[_0x878b('0x32')]);_0x238d83[_0x878b('0x37')]=_[_0x878b('0x35')](_0x1db3d4[_0x878b('0x36')],qs['fields'](_0x18e89c[_0x878b('0x32')][_0x878b('0x38')]));_0x238d83['attributes']=_0x238d83['attributes'][_0x878b('0x39')]?_0x238d83['attributes']:_0x1db3d4['model'];if(_0x18e89c[_0x878b('0x32')][_0x878b('0x45')]){_0x238d83[_0x878b('0x46')]=[{'all':!![]}];}_0x238d83=_[_0x878b('0x43')]({},_0x238d83,_0x18e89c[_0x878b('0x44')]);return db[_0x878b('0x2e')][_0x878b('0x4c')](_0x238d83)[_0x878b('0x26')](handleEntityNotFound(_0x31b1da,null))[_0x878b('0x26')](respondWithResult(_0x31b1da,null))[_0x878b('0x49')](handleError(_0x31b1da,null));};exports['create']=function(_0xb80012,_0x3c8ba0){return db['VoiceTransferReport'][_0x878b('0x4d')](_0xb80012[_0x878b('0x4e')],{})[_0x878b('0x26')](respondWithResult(_0x3c8ba0,0xc9))[_0x878b('0x49')](handleError(_0x3c8ba0,null));};exports[_0x878b('0x25')]=function(_0x23f0d1,_0x2627c6){if(_0x23f0d1[_0x878b('0x4e')]['id']){delete _0x23f0d1['body']['id'];}return db[_0x878b('0x2e')][_0x878b('0x4c')]({'where':{'id':_0x23f0d1[_0x878b('0x4b')]['id']}})[_0x878b('0x26')](handleEntityNotFound(_0x2627c6,null))[_0x878b('0x26')](saveUpdates(_0x23f0d1[_0x878b('0x4e')],null))[_0x878b('0x26')](respondWithResult(_0x2627c6,null))[_0x878b('0x49')](handleError(_0x2627c6,null));};exports[_0x878b('0x27')]=function(_0x3c7b5a,_0x137797){return db[_0x878b('0x2e')][_0x878b('0x4c')]({'where':{'id':_0x3c7b5a[_0x878b('0x4b')]['id']}})[_0x878b('0x26')](handleEntityNotFound(_0x137797,null))[_0x878b('0x26')](removeEntity(_0x137797,null))[_0x878b('0x49')](handleError(_0x137797,null));};exports[_0x878b('0x4f')]=function(_0x749638,_0x631a73){return db[_0x878b('0x2e')][_0x878b('0x4f')]()['then'](respondWithResult(_0x631a73,null))['catch'](handleError(_0x631a73,null));}; \ No newline at end of file +var _0x25a1=['limit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','error','name','send','index','VoiceTransferReport','fieldName','type','key','model','map','query','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x25a1,0x156));var _0x125a=function(_0x4a5776,_0x2a469d){_0x4a5776=_0x4a5776-0x0;var _0x55992a=_0x25a1[_0x4a5776];return _0x55992a;};'use strict';var emlformat=require(_0x125a('0x0'));var rimraf=require(_0x125a('0x1'));var zipdir=require(_0x125a('0x2'));var jsonpatch=require(_0x125a('0x3'));var rp=require(_0x125a('0x4'));var moment=require(_0x125a('0x5'));var BPromise=require(_0x125a('0x6'));var Mustache=require('mustache');var util=require(_0x125a('0x7'));var path=require(_0x125a('0x8'));var sox=require(_0x125a('0x9'));var csv=require(_0x125a('0xa'));var ejs=require(_0x125a('0xb'));var fs=require('fs');var fs_extra=require(_0x125a('0xc'));var _=require(_0x125a('0xd'));var squel=require('squel');var crypto=require(_0x125a('0xe'));var jsforce=require(_0x125a('0xf'));var deskjs=require(_0x125a('0x10'));var toCsv=require(_0x125a('0xa'));var querystring=require(_0x125a('0x11'));var Papa=require(_0x125a('0x12'));var Redis=require(_0x125a('0x13'));var authService=require(_0x125a('0x14'));var qs=require(_0x125a('0x15'));var as=require(_0x125a('0x16'));var hardwareService=require(_0x125a('0x17'));var logger=require(_0x125a('0x18'))(_0x125a('0x19'));var utils=require('../../config/utils');var config=require(_0x125a('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x125a('0x1b'))['db'];function respondWithStatusCode(_0x588bf2,_0x32e812){_0x32e812=_0x32e812||0xcc;return function(_0x158db6){if(_0x158db6){return _0x588bf2[_0x125a('0x1c')](_0x32e812);}return _0x588bf2[_0x125a('0x1d')](_0x32e812)[_0x125a('0x1e')]();};}function respondWithResult(_0x310a28,_0x2afcd9){_0x2afcd9=_0x2afcd9||0xc8;return function(_0x2e4526){if(_0x2e4526){return _0x310a28[_0x125a('0x1d')](_0x2afcd9)[_0x125a('0x1f')](_0x2e4526);}};}function respondWithFilteredResult(_0x33c2b6,_0x4298f3){return function(_0x573463){if(_0x573463){var _0x4a5f1f=typeof _0x4298f3[_0x125a('0x20')]===_0x125a('0x21')&&typeof _0x4298f3['limit']===_0x125a('0x21');var _0x1e3730=_0x573463[_0x125a('0x22')];var _0x3fe07b=_0x4a5f1f?0x0:_0x4298f3[_0x125a('0x20')];var _0x367d95=_0x4a5f1f?_0x573463[_0x125a('0x22')]:_0x4298f3[_0x125a('0x20')]+_0x4298f3['limit'];var _0x3cf73a;if(_0x367d95>=_0x1e3730){_0x367d95=_0x1e3730;_0x3cf73a=0xc8;}else{_0x3cf73a=0xce;}_0x33c2b6[_0x125a('0x1d')](_0x3cf73a);return _0x33c2b6[_0x125a('0x23')]('Content-Range',_0x3fe07b+'-'+_0x367d95+'/'+_0x1e3730)[_0x125a('0x1f')](_0x573463);}return null;};}function patchUpdates(_0x2ba72f){return function(_0x597c9a){try{jsonpatch[_0x125a('0x24')](_0x597c9a,_0x2ba72f,!![]);}catch(_0x3a5e89){return BPromise[_0x125a('0x25')](_0x3a5e89);}return _0x597c9a[_0x125a('0x26')]();};}function saveUpdates(_0x490163,_0xd46340){return function(_0x536d83){if(_0x536d83){return _0x536d83[_0x125a('0x27')](_0x490163)[_0x125a('0x28')](function(_0x3c6ce2){return _0x3c6ce2;});}return null;};}function removeEntity(_0x4c0cd6,_0x2c2263){return function(_0x1a9fc0){if(_0x1a9fc0){return _0x1a9fc0[_0x125a('0x29')]()[_0x125a('0x28')](function(){_0x4c0cd6[_0x125a('0x1d')](0xcc)[_0x125a('0x1e')]();});}};}function handleEntityNotFound(_0x4bbedd,_0x1357de){return function(_0xc294a){if(!_0xc294a){_0x4bbedd[_0x125a('0x1c')](0x194);}return _0xc294a;};}function handleError(_0x22607d,_0x3efdba){_0x3efdba=_0x3efdba||0x1f4;return function(_0x47407a){logger[_0x125a('0x2a')](_0x47407a['stack']);if(_0x47407a[_0x125a('0x2b')]){delete _0x47407a['name'];}_0x22607d[_0x125a('0x1d')](_0x3efdba)[_0x125a('0x2c')](_0x47407a);};}exports[_0x125a('0x2d')]=function(_0x1dacfe,_0x585397){var _0x3fcfc5={},_0x3ee9f5={},_0x4277b1={'count':0x0,'rows':[]};var _0x38a936=_['map'](db[_0x125a('0x2e')]['rawAttributes'],function(_0x43e6f6){return{'name':_0x43e6f6[_0x125a('0x2f')],'type':_0x43e6f6[_0x125a('0x30')][_0x125a('0x31')]};});_0x3ee9f5[_0x125a('0x32')]=_[_0x125a('0x33')](_0x38a936,_0x125a('0x2b'));_0x3ee9f5[_0x125a('0x34')]=_['keys'](_0x1dacfe[_0x125a('0x34')]);_0x3ee9f5['filters']=_['intersection'](_0x3ee9f5[_0x125a('0x32')],_0x3ee9f5[_0x125a('0x34')]);_0x3fcfc5[_0x125a('0x35')]=_[_0x125a('0x36')](_0x3ee9f5['model'],qs['fields'](_0x1dacfe[_0x125a('0x34')][_0x125a('0x37')]));_0x3fcfc5['attributes']=_0x3fcfc5[_0x125a('0x35')][_0x125a('0x38')]?_0x3fcfc5[_0x125a('0x35')]:_0x3ee9f5[_0x125a('0x32')];if(!_0x1dacfe[_0x125a('0x34')][_0x125a('0x39')]('nolimit')){_0x3fcfc5[_0x125a('0x3a')]=qs[_0x125a('0x3a')](_0x1dacfe[_0x125a('0x34')][_0x125a('0x3a')]);_0x3fcfc5[_0x125a('0x20')]=qs[_0x125a('0x20')](_0x1dacfe[_0x125a('0x34')]['offset']);}_0x3fcfc5[_0x125a('0x3b')]=qs[_0x125a('0x3c')](_0x1dacfe[_0x125a('0x34')][_0x125a('0x3c')]);_0x3fcfc5[_0x125a('0x3d')]=qs[_0x125a('0x3e')](_[_0x125a('0x3f')](_0x1dacfe[_0x125a('0x34')],_0x3ee9f5[_0x125a('0x3e')]),_0x38a936);if(_0x1dacfe['query']['filter']){_0x3fcfc5[_0x125a('0x3d')]=_[_0x125a('0x40')](_0x3fcfc5[_0x125a('0x3d')],{'$or':_['map'](_0x38a936,function(_0x2552e8){if(_0x2552e8[_0x125a('0x30')]!=='VIRTUAL'){var _0x1e521a={};_0x1e521a[_0x2552e8[_0x125a('0x2b')]]={'$like':'%'+_0x1dacfe[_0x125a('0x34')][_0x125a('0x41')]+'%'};return _0x1e521a;}})});}_0x3fcfc5=_[_0x125a('0x40')]({},_0x3fcfc5,_0x1dacfe[_0x125a('0x42')]);var _0xdcb136={'where':_0x3fcfc5[_0x125a('0x3d')]};return db[_0x125a('0x2e')][_0x125a('0x22')](_0xdcb136)[_0x125a('0x28')](function(_0x4f053f){_0x4277b1['count']=_0x4f053f;if(_0x1dacfe['query'][_0x125a('0x43')]){_0x3fcfc5[_0x125a('0x44')]=[{'all':!![]}];}return db[_0x125a('0x2e')][_0x125a('0x45')](_0x3fcfc5);})['then'](function(_0x454896){_0x4277b1[_0x125a('0x46')]=_0x454896;return _0x4277b1;})[_0x125a('0x28')](respondWithFilteredResult(_0x585397,_0x3fcfc5))[_0x125a('0x47')](handleError(_0x585397,null));};exports[_0x125a('0x48')]=function(_0x313690,_0x3c227f){var _0x1b036d={'raw':!![],'where':{'id':_0x313690['params']['id']}},_0x14cc27={};_0x14cc27[_0x125a('0x32')]=_[_0x125a('0x49')](db[_0x125a('0x2e')][_0x125a('0x4a')]);_0x14cc27[_0x125a('0x34')]=_['keys'](_0x313690[_0x125a('0x34')]);_0x14cc27[_0x125a('0x3e')]=_[_0x125a('0x36')](_0x14cc27[_0x125a('0x32')],_0x14cc27[_0x125a('0x34')]);_0x1b036d[_0x125a('0x35')]=_[_0x125a('0x36')](_0x14cc27[_0x125a('0x32')],qs['fields'](_0x313690[_0x125a('0x34')][_0x125a('0x37')]));_0x1b036d['attributes']=_0x1b036d['attributes'][_0x125a('0x38')]?_0x1b036d[_0x125a('0x35')]:_0x14cc27['model'];if(_0x313690[_0x125a('0x34')][_0x125a('0x43')]){_0x1b036d[_0x125a('0x44')]=[{'all':!![]}];}_0x1b036d=_[_0x125a('0x40')]({},_0x1b036d,_0x313690[_0x125a('0x42')]);return db[_0x125a('0x2e')][_0x125a('0x4b')](_0x1b036d)[_0x125a('0x28')](handleEntityNotFound(_0x3c227f,null))[_0x125a('0x28')](respondWithResult(_0x3c227f,null))[_0x125a('0x47')](handleError(_0x3c227f,null));};exports['create']=function(_0x385c43,_0x48d1d6){return db[_0x125a('0x2e')][_0x125a('0x4c')](_0x385c43[_0x125a('0x4d')],{})['then'](respondWithResult(_0x48d1d6,0xc9))['catch'](handleError(_0x48d1d6,null));};exports[_0x125a('0x27')]=function(_0xaa92b6,_0xd2c5e8){if(_0xaa92b6['body']['id']){delete _0xaa92b6[_0x125a('0x4d')]['id'];}return db[_0x125a('0x2e')]['find']({'where':{'id':_0xaa92b6[_0x125a('0x4e')]['id']}})[_0x125a('0x28')](handleEntityNotFound(_0xd2c5e8,null))[_0x125a('0x28')](saveUpdates(_0xaa92b6['body'],null))['then'](respondWithResult(_0xd2c5e8,null))[_0x125a('0x47')](handleError(_0xd2c5e8,null));};exports['destroy']=function(_0x352c55,_0x4cf5b1){return db[_0x125a('0x2e')]['find']({'where':{'id':_0x352c55[_0x125a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4cf5b1,null))[_0x125a('0x28')](removeEntity(_0x4cf5b1,null))[_0x125a('0x47')](handleError(_0x4cf5b1,null));};exports[_0x125a('0x4f')]=function(_0x4fb2f2,_0x499d91){return db['VoiceTransferReport'][_0x125a('0x4f')]()['then'](respondWithResult(_0x499d91,null))['catch'](handleError(_0x499d91,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index fc826de..72d1149 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 _0x2559=['rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x38df99,_0x20bf54){var _0x35705b=function(_0x4feb68){while(--_0x4feb68){_0x38df99['push'](_0x38df99['shift']());}};_0x35705b(++_0x20bf54);}(_0x2559,0x19d));var _0x9255=function(_0x672d0c,_0x1a1667){_0x672d0c=_0x672d0c-0x0;var _0x540ed1=_0x2559[_0x672d0c];return _0x540ed1;};'use strict';var _=require(_0x9255('0x0'));var util=require(_0x9255('0x1'));var logger=require(_0x9255('0x2'))(_0x9255('0x3'));var moment=require(_0x9255('0x4'));var BPromise=require(_0x9255('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9255('0x6'));var rimraf=require(_0x9255('0x7'));var config=require(_0x9255('0x8'));var attributes=require(_0x9255('0x9'));module[_0x9255('0xa')]=function(_0x1ce7c9,_0x5947f1){return _0x1ce7c9[_0x9255('0xb')]('VoiceTransferReport',attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb11f=['../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x3135ec,_0x44624b){var _0x5cc468=function(_0xbc2cc4){while(--_0xbc2cc4){_0x3135ec['push'](_0x3135ec['shift']());}};_0x5cc468(++_0x44624b);}(_0xb11f,0x10c));var _0xfb11=function(_0x987434,_0x12fc58){_0x987434=_0x987434-0x0;var _0x39c377=_0xb11f[_0x987434];return _0x39c377;};'use strict';var _=require(_0xfb11('0x0'));var util=require(_0xfb11('0x1'));var logger=require(_0xfb11('0x2'))(_0xfb11('0x3'));var moment=require(_0xfb11('0x4'));var BPromise=require('bluebird');var rp=require(_0xfb11('0x5'));var fs=require('fs');var path=require(_0xfb11('0x6'));var rimraf=require('rimraf');var config=require(_0xfb11('0x7'));var attributes=require(_0xfb11('0x8'));module['exports']=function(_0x1bafa9,_0x3e376f){return _0x1bafa9[_0xfb11('0x9')](_0xfb11('0xa'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 58dd372..fe16676 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 _0x4fef=['catch','CreateVoiceTransferReport','create','body','options','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x389b63,_0x2b0f1e){var _0x29b683=function(_0x2ef568){while(--_0x2ef568){_0x389b63['push'](_0x389b63['shift']());}};_0x29b683(++_0x2b0f1e);}(_0x4fef,0x1d1));var _0xf4fe=function(_0x177540,_0x5da81d){_0x177540=_0x177540-0x0;var _0x3a0bde=_0x4fef[_0x177540];return _0x3a0bde;};'use strict';var _=require(_0xf4fe('0x0'));var util=require(_0xf4fe('0x1'));var moment=require(_0xf4fe('0x2'));var BPromise=require('bluebird');var rs=require(_0xf4fe('0x3'));var fs=require('fs');var Redis=require(_0xf4fe('0x4'));var db=require(_0xf4fe('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf4fe('0x6'))(_0xf4fe('0x7'));var config=require(_0xf4fe('0x8'));var jayson=require(_0xf4fe('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x401997,_0x1708b1,_0xadb635){return new BPromise(function(_0x100494,_0x1d6eb2){return client[_0xf4fe('0xa')](_0x401997,_0xadb635)[_0xf4fe('0xb')](function(_0x417862){logger['info'](_0xf4fe('0xc'),_0x1708b1,_0xf4fe('0xd'));logger[_0xf4fe('0xe')](_0xf4fe('0xf'),_0x1708b1,_0xf4fe('0xd'),JSON[_0xf4fe('0x10')](_0x417862));if(_0x417862[_0xf4fe('0x11')]){if(_0x417862[_0xf4fe('0x11')][_0xf4fe('0x12')]===0x1f4){logger[_0xf4fe('0x11')](_0xf4fe('0xc'),_0x1708b1,_0x417862[_0xf4fe('0x11')][_0xf4fe('0x13')]);return _0x1d6eb2(_0x417862['error']['message']);}logger[_0xf4fe('0x11')](_0xf4fe('0xc'),_0x1708b1,_0x417862[_0xf4fe('0x11')][_0xf4fe('0x13')]);return _0x100494(_0x417862['error'][_0xf4fe('0x13')]);}else{logger[_0xf4fe('0x14')](_0xf4fe('0xc'),_0x1708b1,_0xf4fe('0xd'));_0x100494(_0x417862['result']['message']);}})[_0xf4fe('0x15')](function(_0x5d0dcb){logger[_0xf4fe('0x11')](_0xf4fe('0xc'),_0x1708b1,_0x5d0dcb);_0x1d6eb2(_0x5d0dcb);});});}exports[_0xf4fe('0x16')]=function(_0x1f3753){var _0x540d6d=this;return new Promise(function(_0x48ff0d,_0x4d7794){return db['VoiceTransferReport'][_0xf4fe('0x17')](_0x1f3753[_0xf4fe('0x18')],{'raw':_0x1f3753[_0xf4fe('0x19')]?_0x1f3753[_0xf4fe('0x19')][_0xf4fe('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x39abe5){logger['info'](_0xf4fe('0x16'),_0x1f3753);logger[_0xf4fe('0xe')](_0xf4fe('0x16'),_0x1f3753,JSON[_0xf4fe('0x10')](_0x39abe5));_0x48ff0d(_0x39abe5);})[_0xf4fe('0x15')](function(_0x24c037){logger[_0xf4fe('0x11')]('CreateVoiceTransferReport',_0x24c037['message'],_0x1f3753);_0x4d7794(_0x540d6d[_0xf4fe('0x11')](0x1f4,_0x24c037['message']));});});}; \ No newline at end of file +var _0xc021=['catch','VoiceTransferReport','create','body','options','raw','then','CreateVoiceTransferReport','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','VoiceTransferReport,\x20%s,\x20%s','error','message','result'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0xc021,0x7c));var _0x1c02=function(_0x3a9f6a,_0x3e83ad){_0x3a9f6a=_0x3a9f6a-0x0;var _0x746ad7=_0xc021[_0x3a9f6a];return _0x746ad7;};'use strict';var _=require(_0x1c02('0x0'));var util=require(_0x1c02('0x1'));var moment=require('moment');var BPromise=require(_0x1c02('0x2'));var rs=require(_0x1c02('0x3'));var fs=require('fs');var Redis=require(_0x1c02('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1c02('0x5'));var logger=require(_0x1c02('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1c02('0x7'));var client=jayson[_0x1c02('0x8')][_0x1c02('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54ae52,_0x31d90c,_0x5ed8bb){return new BPromise(function(_0x24b0e8,_0x3ac35c){return client[_0x1c02('0xa')](_0x54ae52,_0x5ed8bb)['then'](function(_0x281f47){logger[_0x1c02('0xb')]('VoiceTransferReport,\x20%s,\x20%s',_0x31d90c,_0x1c02('0xc'));logger[_0x1c02('0xd')](_0x1c02('0xe'),_0x31d90c,_0x1c02('0xc'),JSON[_0x1c02('0xf')](_0x281f47));if(_0x281f47['error']){if(_0x281f47['error'][_0x1c02('0x10')]===0x1f4){logger['error'](_0x1c02('0x11'),_0x31d90c,_0x281f47[_0x1c02('0x12')][_0x1c02('0x13')]);return _0x3ac35c(_0x281f47[_0x1c02('0x12')]['message']);}logger[_0x1c02('0x12')](_0x1c02('0x11'),_0x31d90c,_0x281f47[_0x1c02('0x12')][_0x1c02('0x13')]);return _0x24b0e8(_0x281f47[_0x1c02('0x12')]['message']);}else{logger[_0x1c02('0xb')](_0x1c02('0x11'),_0x31d90c,_0x1c02('0xc'));_0x24b0e8(_0x281f47[_0x1c02('0x14')][_0x1c02('0x13')]);}})[_0x1c02('0x15')](function(_0x64b425){logger[_0x1c02('0x12')](_0x1c02('0x11'),_0x31d90c,_0x64b425);_0x3ac35c(_0x64b425);});});}exports['CreateVoiceTransferReport']=function(_0x31b3ef){var _0x696434=this;return new Promise(function(_0x29131b,_0x456de4){return db[_0x1c02('0x16')][_0x1c02('0x17')](_0x31b3ef[_0x1c02('0x18')],{'raw':_0x31b3ef[_0x1c02('0x19')]?_0x31b3ef[_0x1c02('0x19')][_0x1c02('0x1a')]===undefined?!![]:![]:!![]})[_0x1c02('0x1b')](function(_0x4de4c1){logger['info']('CreateVoiceTransferReport',_0x31b3ef);logger[_0x1c02('0xd')]('CreateVoiceTransferReport',_0x31b3ef,JSON['stringify'](_0x4de4c1));_0x29131b(_0x4de4c1);})[_0x1c02('0x15')](function(_0x69cc21){logger[_0x1c02('0x12')](_0x1c02('0x1c'),_0x69cc21[_0x1c02('0x13')],_0x31b3ef);_0x456de4(_0x696434['error'](0x1f4,_0x69cc21['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 2d742b2..6560082 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 _0x0873=['/unhold','unhold','/calls','/transfer','transfer','exports','express','../../components/auth/service','./webbar.controller','post','/originate','canUpdate','originate','/hangup','isAuthenticated','hangup','/answer','answer','/hold','hold'];(function(_0x104a84,_0x285970){var _0x4973ff=function(_0x5064e7){while(--_0x5064e7){_0x104a84['push'](_0x104a84['shift']());}};_0x4973ff(++_0x285970);}(_0x0873,0x1d2));var _0x3087=function(_0x806812,_0x43184d){_0x806812=_0x806812-0x0;var _0x263201=_0x0873[_0x806812];return _0x263201;};'use strict';var express=require(_0x3087('0x0'));var router=express['Router']();var auth=require(_0x3087('0x1'));var controller=require(_0x3087('0x2'));router[_0x3087('0x3')](_0x3087('0x4'),auth['isAuthenticated'](),auth[_0x3087('0x5')](),controller[_0x3087('0x6')]);router[_0x3087('0x3')](_0x3087('0x7'),auth[_0x3087('0x8')](),auth[_0x3087('0x5')](),controller[_0x3087('0x9')]);router[_0x3087('0x3')](_0x3087('0xa'),auth[_0x3087('0x8')](),auth[_0x3087('0x5')](),controller[_0x3087('0xb')]);router[_0x3087('0x3')](_0x3087('0xc'),auth['isAuthenticated'](),auth[_0x3087('0x5')](),controller[_0x3087('0xd')]);router[_0x3087('0x3')](_0x3087('0xe'),auth[_0x3087('0x8')](),auth[_0x3087('0x5')](),controller[_0x3087('0xf')]);router[_0x3087('0x3')](_0x3087('0x10'),auth['isAuthenticated'](),auth[_0x3087('0x5')](),controller['calls']);router[_0x3087('0x3')](_0x3087('0x11'),auth[_0x3087('0x8')](),auth[_0x3087('0x5')](),controller[_0x3087('0x12')]);module[_0x3087('0x13')]=router; \ No newline at end of file +var _0x2216=['./webbar.controller','isAuthenticated','canUpdate','originate','/hangup','hangup','post','/answer','answer','/hold','hold','/unhold','unhold','/calls','transfer','exports','express','Router','../../components/auth/service'];(function(_0x44a64f,_0x38475c){var _0x52024b=function(_0x2cd055){while(--_0x2cd055){_0x44a64f['push'](_0x44a64f['shift']());}};_0x52024b(++_0x38475c);}(_0x2216,0x166));var _0x6221=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x2216[_0x376b45];return _0x2341b3;};'use strict';var express=require(_0x6221('0x0'));var router=express[_0x6221('0x1')]();var auth=require(_0x6221('0x2'));var controller=require(_0x6221('0x3'));router['post']('/originate',auth[_0x6221('0x4')](),auth[_0x6221('0x5')](),controller[_0x6221('0x6')]);router['post'](_0x6221('0x7'),auth['isAuthenticated'](),auth[_0x6221('0x5')](),controller[_0x6221('0x8')]);router[_0x6221('0x9')](_0x6221('0xa'),auth[_0x6221('0x4')](),auth[_0x6221('0x5')](),controller[_0x6221('0xb')]);router[_0x6221('0x9')](_0x6221('0xc'),auth[_0x6221('0x4')](),auth[_0x6221('0x5')](),controller[_0x6221('0xd')]);router[_0x6221('0x9')](_0x6221('0xe'),auth[_0x6221('0x4')](),auth['canUpdate'](),controller[_0x6221('0xf')]);router[_0x6221('0x9')](_0x6221('0x10'),auth[_0x6221('0x4')](),auth[_0x6221('0x5')](),controller['calls']);router[_0x6221('0x9')]('/transfer',auth['isAuthenticated'](),auth[_0x6221('0x5')](),controller[_0x6221('0x11')]);module[_0x6221('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index ae5455b..792ac49 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 _0xa588=['client','http','../../config/logger','ioredis','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','emit','handleError:','error','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','info','originate\x20fired:','body','json','userId','callNumber','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','answer','answer\x20fired:','webbar:answer','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','transfer','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise'];(function(_0xc20f22,_0x49698f){var _0x1535d5=function(_0x5ce3f3){while(--_0x5ce3f3){_0xc20f22['push'](_0xc20f22['shift']());}};_0x1535d5(++_0x49698f);}(_0xa588,0xe1));var _0x8a58=function(_0xd0448e,_0x2d3d92){_0xd0448e=_0xd0448e-0x0;var _0x3563cb=_0xa588[_0xd0448e];return _0x3563cb;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x8a58('0x0'));var db=require(_0x8a58('0x1'))['db'];var config=require(_0x8a58('0x2'));var util=require(_0x8a58('0x3'));var BPromise=require(_0x8a58('0x4'));var jayson=require(_0x8a58('0x5'));var amiClient=jayson[_0x8a58('0x6')][_0x8a58('0x7')]({'port':0x232a});var logger=require(_0x8a58('0x8'))('webbarapi');var Redis=require(_0x8a58('0x9'));config[_0x8a58('0xa')]=_[_0x8a58('0xb')](config[_0x8a58('0xa')],{'host':_0x8a58('0xc'),'port':0x18eb});var io=require(_0x8a58('0xd'))(new Redis(config[_0x8a58('0xa')]));var Schema=require(_0x8a58('0xe'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8a58('0xf')]},'callNumber':{'type':_0x8a58('0x10'),'required':[!![],_0x8a58('0x11')]},'callerId':{'type':_0x8a58('0x10')},'callbackUrl':{'type':_0x8a58('0x10')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8a58('0xf')]},'sessionId':{'type':_0x8a58('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8a58('0xf')]},'sessionId':{'type':'string','required':[!![],_0x8a58('0x13')]},'transferNumber':{'type':_0x8a58('0x10'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]}});function emit(_0x26e3a8,_0xd967db,_0xddfaae){logger['info'](_0x26e3a8,_0xd967db,JSON['stringify'](_0xddfaae));io['to'](_0x26e3a8)[_0x8a58('0x14')](_0xd967db,_0xddfaae);}function handleError(_0x107e0a){return function(_0x18a14d){console['log'](_0x8a58('0x15'),_0x18a14d,_0x18a14d instanceof RangeError);logger[_0x8a58('0x16')](_0x18a14d['stack']);if(_0x18a14d instanceof RangeError){if(_0x18a14d[_0x8a58('0x17')]){delete _0x18a14d[_0x8a58('0x17')];}_0x107e0a[_0x8a58('0x18')](0x194)[_0x8a58('0x19')](_0x18a14d);}else{if(_0x18a14d[_0x8a58('0x17')]){delete _0x18a14d[_0x8a58('0x17')];}_0x107e0a[_0x8a58('0x18')](0x1f4)[_0x8a58('0x19')](_0x18a14d);}};}function checkError(){return function(_0x92951){if(!_0x92951){throw new RangeError(_0x8a58('0x1a'));}return _0x92951;};}function respondWithRpcPromise(_0xb20cfe,_0x844b58){return new BPromise(function(_0x3758fa,_0x34adb8){var _0x561a9a=amiClient;return _0x561a9a[_0x8a58('0x1b')](_0xb20cfe,_0x844b58)[_0x8a58('0x1c')](function(_0x20a6c5){if(_0x20a6c5[_0x8a58('0x16')]){if(_0x20a6c5[_0x8a58('0x16')][_0x8a58('0x1d')]===0x1f4){return _0x34adb8(_0x20a6c5[_0x8a58('0x16')]['message']);}return _0x3758fa(_0x20a6c5[_0x8a58('0x16')][_0x8a58('0x1e')]);}else{_0x3758fa(_0x20a6c5[_0x8a58('0x1f')]);}})[_0x8a58('0x20')](function(_0x4fb0fb){_0x34adb8(_0x4fb0fb);});});}function getAgent(_0x1e9c3b){return db[_0x8a58('0x21')][_0x8a58('0x22')]({'where':{'id':_0x1e9c3b,'role':'agent'}})[_0x8a58('0x1c')](checkError());}function getAgentCheckSession(_0x31abcc,_0x4426ff){return new BPromise(function(_0x27d7c8,_0x367aec){var _0x3e317f=respondWithRpcPromise(_0x8a58('0x23'));var _0x4d5041=getAgent(_0x31abcc);Promise[_0x8a58('0x24')]([_0x3e317f,_0x4d5041])['then'](function(_0x501aa1){var _0x5e7265=_0x501aa1[0x0];var _0x4cfc96=_0x501aa1[0x1];var _0x5a9c53=_[_0x8a58('0x25')](_0x5e7265[_0x8a58('0x26')],function(_0x1b2d9e){return _0x1b2d9e[_0x8a58('0x27')]==_0x4cfc96['id']&&_0x1b2d9e[_0x8a58('0x28')]==_0x4426ff;});if(_0x5a9c53[_0x8a58('0x29')]==0x1){_0x27d7c8(_0x4cfc96);}else{_0x367aec(new RangeError(_0x8a58('0x2a')+_0x4426ff+_0x8a58('0x2b')));}});});}exports[_0x8a58('0x2c')]=function(_0x3d9e3a,_0x8ab99c){logger[_0x8a58('0x2d')](_0x8a58('0x2e'),_0x3d9e3a['body']);var _0x330e8a=originateValidation[_0x8a58('0xe')](_0x3d9e3a[_0x8a58('0x2f')]);if(_0x330e8a[_0x8a58('0x29')]>0x0){return _0x8ab99c[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x330e8a);}var _0x50c73d=_0x3d9e3a[_0x8a58('0x2f')][_0x8a58('0x31')];var _0x25ecd6=_0x3d9e3a[_0x8a58('0x2f')][_0x8a58('0x32')];var _0x264cc7=_0x3d9e3a[_0x8a58('0x2f')]['callerId'];var _0x3d1fb0=_0x3d9e3a[_0x8a58('0x2f')][_0x8a58('0x33')];return getAgent(_0x50c73d)['then'](function(_0x5ecfea){logger['info'](_0x8a58('0x34'),_0x5ecfea[_0x8a58('0x17')]);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x5ecfea['name']),_0x8a58('0x37'),{'callNumber':_0x25ecd6,'callerId':_0x264cc7,'callbackUrl':_0x3d1fb0});return _0x8ab99c[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':_0x8a58('0x38')});})['catch'](handleError(_0x8ab99c));};exports[_0x8a58('0x39')]=function(_0x2a7c70,_0x5aad83){logger[_0x8a58('0x2d')](_0x8a58('0x3a'),_0x2a7c70[_0x8a58('0x2f')]);var _0x35d930=hangupValidation[_0x8a58('0xe')](_0x2a7c70[_0x8a58('0x2f')]);if(_0x35d930['length']>0x0){return _0x5aad83['status'](0x190)[_0x8a58('0x30')](_0x35d930);}var _0x31b8fe=_0x2a7c70['body'][_0x8a58('0x31')];var _0x2e1d71=_0x2a7c70[_0x8a58('0x2f')][_0x8a58('0x28')];return getAgent(_0x31b8fe)[_0x8a58('0x1c')](function(_0x4e9e04){logger[_0x8a58('0x2d')]('entityFound:',_0x4e9e04[_0x8a58('0x17')]);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x4e9e04[_0x8a58('0x17')]),_0x8a58('0x3b'),{'sessionId':_0x2e1d71});return _0x5aad83[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x5aad83));};exports[_0x8a58('0x3c')]=function(_0x54e454,_0x53fd19){logger[_0x8a58('0x2d')](_0x8a58('0x3d'),_0x54e454[_0x8a58('0x2f')]);var _0x573cd3=answerValidation['validate'](_0x54e454[_0x8a58('0x2f')]);if(_0x573cd3['length']>0x0){return _0x53fd19[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x573cd3);}var _0x3feec0=_0x54e454[_0x8a58('0x2f')]['userId'];var _0x417951=_0x54e454[_0x8a58('0x2f')]['sessionId'];return getAgent(_0x3feec0)[_0x8a58('0x1c')](function(_0xba52de){logger[_0x8a58('0x2d')](_0x8a58('0x34'),_0xba52de['name']);emit(util[_0x8a58('0x35')]('user:%s',_0xba52de[_0x8a58('0x17')]),_0x8a58('0x3e'),{'sessionId':_0x417951});return _0x53fd19['status'](0xc8)[_0x8a58('0x30')]({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0x53fd19));};exports[_0x8a58('0x3f')]=function(_0x417b08,_0x177ba9){logger[_0x8a58('0x2d')](_0x8a58('0x40'),_0x417b08[_0x8a58('0x2f')]);var _0x507423=holdValidation['validate'](_0x417b08[_0x8a58('0x2f')]);if(_0x507423[_0x8a58('0x29')]>0x0){return _0x177ba9[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x507423);}var _0x1ec51b=_0x417b08[_0x8a58('0x2f')][_0x8a58('0x31')];var _0x903c85=_0x417b08[_0x8a58('0x2f')][_0x8a58('0x28')];return getAgent(_0x1ec51b)[_0x8a58('0x1c')](function(_0x392c32){logger[_0x8a58('0x2d')](_0x8a58('0x34'),_0x392c32['name']);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x392c32[_0x8a58('0x17')]),_0x8a58('0x41'),{'sessionId':_0x903c85});return _0x177ba9[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':_0x8a58('0x42')});})['catch'](handleError(_0x177ba9));};exports['unhold']=function(_0x5ab682,_0x31e12a){logger[_0x8a58('0x2d')](_0x8a58('0x43'),_0x5ab682['body']);var _0x3883ee=unholdValidation[_0x8a58('0xe')](_0x5ab682[_0x8a58('0x2f')]);if(_0x3883ee[_0x8a58('0x29')]>0x0){return _0x31e12a[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x3883ee);}var _0x22f5aa=_0x5ab682[_0x8a58('0x2f')][_0x8a58('0x31')];var _0x2f48ef=_0x5ab682[_0x8a58('0x2f')][_0x8a58('0x28')];return getAgent(_0x22f5aa)['then'](function(_0xf44eaa){logger[_0x8a58('0x2d')]('entityFound:',_0xf44eaa[_0x8a58('0x17')]);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0xf44eaa['name']),_0x8a58('0x44'),{'sessionId':_0x2f48ef});return _0x31e12a['status'](0xc8)[_0x8a58('0x30')]({'error':![],'message':_0x8a58('0x45')});})[_0x8a58('0x20')](handleError(_0x31e12a));};exports[_0x8a58('0x46')]=function(_0x3c7225,_0xfd0229){logger[_0x8a58('0x2d')](_0x8a58('0x47'),_0xfd0229[_0x8a58('0x2f')]);var _0x53fbde=callsValidation[_0x8a58('0xe')](_0x3c7225[_0x8a58('0x2f')]);if(_0x53fbde[_0x8a58('0x29')]>0x0){return _0xfd0229[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x53fbde);}var _0x57adf4=_0x3c7225[_0x8a58('0x2f')][_0x8a58('0x31')];var _0xa01a37=respondWithRpcPromise(_0x8a58('0x23'));var _0x1022d5=getAgent(_0x57adf4);return Promise[_0x8a58('0x24')]([_0xa01a37,_0x1022d5])[_0x8a58('0x1c')](function(_0x38e435){var _0x515f26=_0x38e435[0x0];var _0x415dea=_0x38e435[0x1];var _0xbf6332=_[_0x8a58('0x25')](_0x515f26['rows'],function(_0x229e68){return _0x229e68['UserId']==_0x415dea['id'];});return _0xfd0229[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'count':_0xbf6332[_0x8a58('0x29')],'rows':_0xbf6332});})[_0x8a58('0x20')](handleError(_0xfd0229));};exports[_0x8a58('0x48')]=function(_0x2f653d,_0x1b8292){logger[_0x8a58('0x2d')]('conference\x20fired:',_0x2f653d['body']);var _0x455aeb=conferenceValidation[_0x8a58('0xe')](_0x2f653d[_0x8a58('0x2f')]);if(_0x455aeb[_0x8a58('0x29')]>0x0){return _0x1b8292[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x455aeb);}var _0x1b4f68=_0x2f653d['body'][_0x8a58('0x31')];return getAgent(_0x1b4f68)[_0x8a58('0x1c')](function(_0x493ccd){logger[_0x8a58('0x2d')](_0x8a58('0x34'),_0x493ccd[_0x8a58('0x17')]);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x493ccd[_0x8a58('0x17')]),'webbar:conference');return _0x1b8292[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':'conference\x20executed!'});})[_0x8a58('0x20')](handleError(_0x1b8292));};exports[_0x8a58('0x49')]=function(_0x19e256,_0x26b333){logger['info']('transfer\x20fired:',_0x19e256[_0x8a58('0x2f')]);var _0x5ce699=transferValidation[_0x8a58('0xe')](_0x19e256[_0x8a58('0x2f')]);if(_0x5ce699[_0x8a58('0x29')]>0x0){return _0x26b333[_0x8a58('0x18')](0x190)['json'](_0x5ce699);}var _0xb0b5da=_0x19e256[_0x8a58('0x2f')][_0x8a58('0x31')];var _0x371930=_0x19e256[_0x8a58('0x2f')][_0x8a58('0x28')];var _0x9046f1=_0x19e256[_0x8a58('0x2f')][_0x8a58('0x4a')];return getAgent(_0xb0b5da)[_0x8a58('0x1c')](function(_0x318acd){logger[_0x8a58('0x2d')](_0x8a58('0x34'),_0x318acd['name']);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x318acd[_0x8a58('0x17')]),_0x8a58('0x4b'),{'sessionId':_0x371930,'transferNumber':_0x9046f1});return _0x26b333[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':_0x8a58('0x4c')});})[_0x8a58('0x20')](handleError(_0x26b333));}; \ No newline at end of file +var _0x131e=['error','stack','name','status','send','NotFound','request','then','code','message','User','findOne','VoiceChannels','all','rows','UserId','length','\x20not\x20found!','originate','originate\x20fired:','body','validate','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','webbar:originate','originate\x20executed!','catch','user:%s','hangup\x20executed!','answer','answer\x20fired:','sessionId','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','filter','conference','conference\x20fired:','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','../../config/environment','util','bluebird','jayson/promise','client','http','webbarapi','ioredis','redis','defaults','number','userId\x20is\x20required','callNumber\x20is\x20required','string','transferNumber\x20is\x20required','info','stringify','log','handleError:'];(function(_0x17fac9,_0x4c638b){var _0x3648ed=function(_0x4f30a5){while(--_0x4f30a5){_0x17fac9['push'](_0x17fac9['shift']());}};_0x3648ed(++_0x4c638b);}(_0x131e,0x1ec));var _0xe131=function(_0x2a23f2,_0xf2ac5b){_0x2a23f2=_0x2a23f2-0x0;var _0x3d4f63=_0x131e[_0x2a23f2];return _0x3d4f63;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require(_0xe131('0x0'));var util=require(_0xe131('0x1'));var BPromise=require(_0xe131('0x2'));var jayson=require(_0xe131('0x3'));var amiClient=jayson[_0xe131('0x4')][_0xe131('0x5')]({'port':0x232a});var logger=require('../../config/logger')(_0xe131('0x6'));var Redis=require(_0xe131('0x7'));config[_0xe131('0x8')]=_[_0xe131('0x9')](config[_0xe131('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xe131('0xa'),'required':[!![],_0xe131('0xb')]},'callNumber':{'type':'string','required':[!![],_0xe131('0xc')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xe131('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0xe131('0xa'),'required':[!![],_0xe131('0xb')]},'sessionId':{'type':_0xe131('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xe131('0xa'),'required':[!![],_0xe131('0xb')]},'sessionId':{'type':_0xe131('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xe131('0xd'),'required':[!![],_0xe131('0xe')]}});var holdValidation=new Schema({'userId':{'type':_0xe131('0xa'),'required':[!![],_0xe131('0xb')]},'sessionId':{'type':_0xe131('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xe131('0xa'),'required':[!![],_0xe131('0xb')]},'sessionId':{'type':_0xe131('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xe131('0xa'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0x5a6ca9,_0x4987dc,_0x2628e7){logger[_0xe131('0xf')](_0x5a6ca9,_0x4987dc,JSON[_0xe131('0x10')](_0x2628e7));io['to'](_0x5a6ca9)['emit'](_0x4987dc,_0x2628e7);}function handleError(_0x503e86){return function(_0x400f6b){console[_0xe131('0x11')](_0xe131('0x12'),_0x400f6b,_0x400f6b instanceof RangeError);logger[_0xe131('0x13')](_0x400f6b[_0xe131('0x14')]);if(_0x400f6b instanceof RangeError){if(_0x400f6b[_0xe131('0x15')]){delete _0x400f6b['name'];}_0x503e86[_0xe131('0x16')](0x194)[_0xe131('0x17')](_0x400f6b);}else{if(_0x400f6b[_0xe131('0x15')]){delete _0x400f6b[_0xe131('0x15')];}_0x503e86[_0xe131('0x16')](0x1f4)['send'](_0x400f6b);}};}function checkError(){return function(_0x4c24e5){if(!_0x4c24e5){throw new RangeError(_0xe131('0x18'));}return _0x4c24e5;};}function respondWithRpcPromise(_0x41c4e1,_0x5207c6){return new BPromise(function(_0x42df0a,_0x55b0c5){var _0x49f304=amiClient;return _0x49f304[_0xe131('0x19')](_0x41c4e1,_0x5207c6)[_0xe131('0x1a')](function(_0x473bb4){if(_0x473bb4[_0xe131('0x13')]){if(_0x473bb4[_0xe131('0x13')][_0xe131('0x1b')]===0x1f4){return _0x55b0c5(_0x473bb4[_0xe131('0x13')]['message']);}return _0x42df0a(_0x473bb4[_0xe131('0x13')][_0xe131('0x1c')]);}else{_0x42df0a(_0x473bb4['result']);}})['catch'](function(_0x330638){_0x55b0c5(_0x330638);});});}function getAgent(_0x5b2f47){return db[_0xe131('0x1d')][_0xe131('0x1e')]({'where':{'id':_0x5b2f47,'role':'agent'}})[_0xe131('0x1a')](checkError());}function getAgentCheckSession(_0x3959ac,_0x41a3e9){return new BPromise(function(_0x499ca8,_0x29243d){var _0x442279=respondWithRpcPromise(_0xe131('0x1f'));var _0x10d504=getAgent(_0x3959ac);Promise[_0xe131('0x20')]([_0x442279,_0x10d504])[_0xe131('0x1a')](function(_0x1ff557){var _0x3414f1=_0x1ff557[0x0];var _0x9f8c66=_0x1ff557[0x1];var _0x341294=_['filter'](_0x3414f1[_0xe131('0x21')],function(_0x554b62){return _0x554b62[_0xe131('0x22')]==_0x9f8c66['id']&&_0x554b62['sessionId']==_0x41a3e9;});if(_0x341294[_0xe131('0x23')]==0x1){_0x499ca8(_0x9f8c66);}else{_0x29243d(new RangeError('sessionId\x20'+_0x41a3e9+_0xe131('0x24')));}});});}exports[_0xe131('0x25')]=function(_0x306082,_0x481e50){logger['info'](_0xe131('0x26'),_0x306082[_0xe131('0x27')]);var _0x11f163=originateValidation[_0xe131('0x28')](_0x306082[_0xe131('0x27')]);if(_0x11f163[_0xe131('0x23')]>0x0){return _0x481e50[_0xe131('0x16')](0x190)[_0xe131('0x29')](_0x11f163);}var _0x5347ee=_0x306082['body'][_0xe131('0x2a')];var _0x6c7586=_0x306082[_0xe131('0x27')][_0xe131('0x2b')];var _0x2c17f6=_0x306082[_0xe131('0x27')][_0xe131('0x2c')];var _0x4d2327=_0x306082['body'][_0xe131('0x2d')];return getAgent(_0x5347ee)['then'](function(_0x26bf39){logger['info'](_0xe131('0x2e'),_0x26bf39['name']);emit(util[_0xe131('0x2f')]('user:%s',_0x26bf39[_0xe131('0x15')]),_0xe131('0x30'),{'callNumber':_0x6c7586,'callerId':_0x2c17f6,'callbackUrl':_0x4d2327});return _0x481e50[_0xe131('0x16')](0xc8)[_0xe131('0x29')]({'error':![],'message':_0xe131('0x31')});})[_0xe131('0x32')](handleError(_0x481e50));};exports['hangup']=function(_0x2ecc0c,_0x4dafaf){logger[_0xe131('0xf')]('hangup\x20fired:',_0x2ecc0c[_0xe131('0x27')]);var _0x26a679=hangupValidation[_0xe131('0x28')](_0x2ecc0c[_0xe131('0x27')]);if(_0x26a679[_0xe131('0x23')]>0x0){return _0x4dafaf[_0xe131('0x16')](0x190)[_0xe131('0x29')](_0x26a679);}var _0x5a5498=_0x2ecc0c[_0xe131('0x27')]['userId'];var _0x1103fc=_0x2ecc0c[_0xe131('0x27')]['sessionId'];return getAgent(_0x5a5498)['then'](function(_0x205fa2){logger['info']('entityFound:',_0x205fa2[_0xe131('0x15')]);emit(util['format'](_0xe131('0x33'),_0x205fa2[_0xe131('0x15')]),'webbar:hangup',{'sessionId':_0x1103fc});return _0x4dafaf[_0xe131('0x16')](0xc8)[_0xe131('0x29')]({'error':![],'message':_0xe131('0x34')});})[_0xe131('0x32')](handleError(_0x4dafaf));};exports[_0xe131('0x35')]=function(_0x4985d9,_0x512409){logger[_0xe131('0xf')](_0xe131('0x36'),_0x4985d9[_0xe131('0x27')]);var _0x58fe5c=answerValidation[_0xe131('0x28')](_0x4985d9[_0xe131('0x27')]);if(_0x58fe5c[_0xe131('0x23')]>0x0){return _0x512409['status'](0x190)[_0xe131('0x29')](_0x58fe5c);}var _0x1c9c6d=_0x4985d9[_0xe131('0x27')]['userId'];var _0x1da932=_0x4985d9[_0xe131('0x27')][_0xe131('0x37')];return getAgent(_0x1c9c6d)['then'](function(_0x1663a9){logger[_0xe131('0xf')](_0xe131('0x2e'),_0x1663a9[_0xe131('0x15')]);emit(util[_0xe131('0x2f')](_0xe131('0x33'),_0x1663a9[_0xe131('0x15')]),'webbar:answer',{'sessionId':_0x1da932});return _0x512409['status'](0xc8)[_0xe131('0x29')]({'error':![],'message':_0xe131('0x38')});})[_0xe131('0x32')](handleError(_0x512409));};exports[_0xe131('0x39')]=function(_0xb1c607,_0x402767){logger['info'](_0xe131('0x3a'),_0xb1c607[_0xe131('0x27')]);var _0x268cc6=holdValidation[_0xe131('0x28')](_0xb1c607[_0xe131('0x27')]);if(_0x268cc6[_0xe131('0x23')]>0x0){return _0x402767['status'](0x190)[_0xe131('0x29')](_0x268cc6);}var _0x1ce9b7=_0xb1c607[_0xe131('0x27')][_0xe131('0x2a')];var _0x1a9e5c=_0xb1c607[_0xe131('0x27')][_0xe131('0x37')];return getAgent(_0x1ce9b7)[_0xe131('0x1a')](function(_0x3d7ae8){logger[_0xe131('0xf')](_0xe131('0x2e'),_0x3d7ae8['name']);emit(util[_0xe131('0x2f')]('user:%s',_0x3d7ae8['name']),_0xe131('0x3b'),{'sessionId':_0x1a9e5c});return _0x402767[_0xe131('0x16')](0xc8)[_0xe131('0x29')]({'error':![],'message':_0xe131('0x3c')});})[_0xe131('0x32')](handleError(_0x402767));};exports[_0xe131('0x3d')]=function(_0xf4dbe4,_0x398c39){logger[_0xe131('0xf')](_0xe131('0x3e'),_0xf4dbe4[_0xe131('0x27')]);var _0x509992=unholdValidation['validate'](_0xf4dbe4[_0xe131('0x27')]);if(_0x509992[_0xe131('0x23')]>0x0){return _0x398c39['status'](0x190)['json'](_0x509992);}var _0x2b934b=_0xf4dbe4['body']['userId'];var _0xe0d786=_0xf4dbe4[_0xe131('0x27')][_0xe131('0x37')];return getAgent(_0x2b934b)[_0xe131('0x1a')](function(_0x3d6f45){logger[_0xe131('0xf')]('entityFound:',_0x3d6f45['name']);emit(util[_0xe131('0x2f')](_0xe131('0x33'),_0x3d6f45['name']),_0xe131('0x3f'),{'sessionId':_0xe0d786});return _0x398c39[_0xe131('0x16')](0xc8)[_0xe131('0x29')]({'error':![],'message':_0xe131('0x40')});})[_0xe131('0x32')](handleError(_0x398c39));};exports[_0xe131('0x41')]=function(_0x4a9ad6,_0x23d880){logger['info']('calls\x20fired:',_0x23d880[_0xe131('0x27')]);var _0x3ff68b=callsValidation['validate'](_0x4a9ad6['body']);if(_0x3ff68b[_0xe131('0x23')]>0x0){return _0x23d880[_0xe131('0x16')](0x190)[_0xe131('0x29')](_0x3ff68b);}var _0x51628f=_0x4a9ad6[_0xe131('0x27')][_0xe131('0x2a')];var _0x45d00d=respondWithRpcPromise(_0xe131('0x1f'));var _0x2a65fd=getAgent(_0x51628f);return Promise['all']([_0x45d00d,_0x2a65fd])[_0xe131('0x1a')](function(_0x5185dd){var _0x4347f0=_0x5185dd[0x0];var _0x45ac9c=_0x5185dd[0x1];var _0xc398e5=_[_0xe131('0x42')](_0x4347f0['rows'],function(_0x498fe0){return _0x498fe0['UserId']==_0x45ac9c['id'];});return _0x23d880[_0xe131('0x16')](0xc8)['json']({'count':_0xc398e5[_0xe131('0x23')],'rows':_0xc398e5});})[_0xe131('0x32')](handleError(_0x23d880));};exports[_0xe131('0x43')]=function(_0x160f60,_0x61ea25){logger[_0xe131('0xf')](_0xe131('0x44'),_0x160f60[_0xe131('0x27')]);var _0x1e388e=conferenceValidation[_0xe131('0x28')](_0x160f60['body']);if(_0x1e388e['length']>0x0){return _0x61ea25['status'](0x190)[_0xe131('0x29')](_0x1e388e);}var _0x41932a=_0x160f60[_0xe131('0x27')][_0xe131('0x2a')];return getAgent(_0x41932a)['then'](function(_0x11e2c9){logger[_0xe131('0xf')](_0xe131('0x2e'),_0x11e2c9[_0xe131('0x15')]);emit(util[_0xe131('0x2f')](_0xe131('0x33'),_0x11e2c9['name']),'webbar:conference');return _0x61ea25[_0xe131('0x16')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x61ea25));};exports[_0xe131('0x45')]=function(_0x4edb0f,_0x2e6f99){logger['info'](_0xe131('0x46'),_0x4edb0f[_0xe131('0x27')]);var _0x2b6cdc=transferValidation[_0xe131('0x28')](_0x4edb0f['body']);if(_0x2b6cdc[_0xe131('0x23')]>0x0){return _0x2e6f99[_0xe131('0x16')](0x190)[_0xe131('0x29')](_0x2b6cdc);}var _0x3c1fe4=_0x4edb0f[_0xe131('0x27')][_0xe131('0x2a')];var _0x497b76=_0x4edb0f[_0xe131('0x27')][_0xe131('0x37')];var _0x4f3b0d=_0x4edb0f[_0xe131('0x27')]['transferNumber'];return getAgent(_0x3c1fe4)['then'](function(_0x6794a){logger['info'](_0xe131('0x2e'),_0x6794a[_0xe131('0x15')]);emit(util[_0xe131('0x2f')]('user:%s',_0x6794a[_0xe131('0x15')]),_0xe131('0x47'),{'sessionId':_0x497b76,'transferNumber':_0x4f3b0d});return _0x2e6f99[_0xe131('0x16')](0xc8)[_0xe131('0x29')]({'error':![],'message':_0xe131('0x48')});})[_0xe131('0x32')](handleError(_0x2e6f99));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index d1068b4..eb7ebd8 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 _0x0295=['addDisposition','/:id/canned_answers','addAnswer','/:id/users','addAgents','/:id/applications','addApplications','/:id/notify','notify','put','/:id','update','delete','removeDispositions','removeAnswers','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','getDispositions','getAnswers','getAgents','post','create','/:id/dispositions'];(function(_0x28a7fd,_0x4e94c9){var _0x391b73=function(_0x34bc39){while(--_0x34bc39){_0x28a7fd['push'](_0x28a7fd['shift']());}};_0x391b73(++_0x4e94c9);}(_0x0295,0x1f0));var _0x5029=function(_0x52ae40,_0x23c2bf){_0x52ae40=_0x52ae40-0x0;var _0xab6ed1=_0x0295[_0x52ae40];return _0xab6ed1;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5029('0x2'));var auth=require(_0x5029('0x3'));var interaction=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var controller=require(_0x5029('0x6'));router[_0x5029('0x7')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0x9')]);router[_0x5029('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x5029('0x7')]('/:id',auth[_0x5029('0x8')](),controller['show']);router[_0x5029('0x7')]('/:id/dispositions',auth[_0x5029('0x8')](),controller[_0x5029('0xa')]);router[_0x5029('0x7')]('/:id/canned_answers',auth[_0x5029('0x8')](),controller[_0x5029('0xb')]);router[_0x5029('0x7')]('/:id/users',auth[_0x5029('0x8')](),controller[_0x5029('0xc')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0x5029('0xd')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0xe')]);router[_0x5029('0xd')](_0x5029('0xf'),auth[_0x5029('0x8')](),controller[_0x5029('0x10')]);router[_0x5029('0xd')](_0x5029('0x11'),auth[_0x5029('0x8')](),controller[_0x5029('0x12')]);router[_0x5029('0xd')](_0x5029('0x13'),auth[_0x5029('0x8')](),controller[_0x5029('0x14')]);router['post'](_0x5029('0x15'),auth[_0x5029('0x8')](),controller[_0x5029('0x16')]);router[_0x5029('0xd')](_0x5029('0x17'),controller[_0x5029('0x18')]);router[_0x5029('0xd')]('/:id/send',auth[_0x5029('0x8')](),controller['send']);router[_0x5029('0x19')](_0x5029('0x1a'),auth[_0x5029('0x8')](),controller[_0x5029('0x1b')]);router['delete']('/:id',auth[_0x5029('0x8')](),controller['destroy']);router[_0x5029('0x1c')](_0x5029('0xf'),auth[_0x5029('0x8')](),controller[_0x5029('0x1d')]);router[_0x5029('0x1c')](_0x5029('0x11'),auth[_0x5029('0x8')](),controller[_0x5029('0x1e')]);router[_0x5029('0x1c')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x5029('0x1f')]=router; \ No newline at end of file +var _0xe3da=['/:id/send','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','/:id/canned_answers','addAnswer','addAgents','/:id/notify','notify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe3da,0x1cd));var _0xae3d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe3da[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var path=require(_0xae3d('0x2'));var timeout=require(_0xae3d('0x3'));var express=require(_0xae3d('0x4'));var router=express[_0xae3d('0x5')]();var fs_extra=require(_0xae3d('0x6'));var auth=require(_0xae3d('0x7'));var interaction=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var controller=require(_0xae3d('0xa'));router[_0xae3d('0xb')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0xd')]);router[_0xae3d('0xb')](_0xae3d('0xe'),auth['isAuthenticated'](),controller[_0xae3d('0xf')]);router[_0xae3d('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xae3d('0x10')]);router[_0xae3d('0xb')](_0xae3d('0x11'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x12')]);router[_0xae3d('0xb')]('/:id/canned_answers',auth[_0xae3d('0xc')](),controller['getAnswers']);router[_0xae3d('0xb')](_0xae3d('0x13'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x14')]);router['get'](_0xae3d('0x15'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x16')]);router[_0xae3d('0x17')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0x18')]);router[_0xae3d('0x17')]('/:id/dispositions',auth[_0xae3d('0xc')](),controller[_0xae3d('0x19')]);router[_0xae3d('0x17')](_0xae3d('0x1a'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x1b')]);router['post'](_0xae3d('0x13'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x1c')]);router['post'](_0xae3d('0x15'),auth[_0xae3d('0xc')](),controller['addApplications']);router['post'](_0xae3d('0x1d'),controller[_0xae3d('0x1e')]);router[_0xae3d('0x17')](_0xae3d('0x1f'),auth[_0xae3d('0xc')](),controller['send']);router[_0xae3d('0x20')]('/:id',auth[_0xae3d('0xc')](),controller[_0xae3d('0x21')]);router[_0xae3d('0x22')](_0xae3d('0x23'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x24')]);router[_0xae3d('0x22')](_0xae3d('0x11'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x25')]);router[_0xae3d('0x22')](_0xae3d('0x1a'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x26')]);router[_0xae3d('0x22')](_0xae3d('0x13'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x27')]);module[_0xae3d('0x28')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 657a6ad..66d31df 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 _0x6d18=['setDataValue','mandatoryDisposition','sequelize','exports','name','STRING','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x391080,_0x3a24d7){var _0x35e1e5=function(_0x5b4262){while(--_0x5b4262){_0x391080['push'](_0x391080['shift']());}};_0x35e1e5(++_0x3a24d7);}(_0x6d18,0x1b4));var _0x86d1=function(_0x14cc05,_0x553ac1){_0x14cc05=_0x14cc05-0x0;var _0x124490=_0x6d18[_0x14cc05];return _0x124490;};'use strict';var Sequelize=require(_0x86d1('0x0'));var rs=require('randomstring');module[_0x86d1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x86d1('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x86d1('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x86d1('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x86d1('0x4')]();}},'phone':{'type':Sequelize[_0x86d1('0x3')]},'type':{'type':Sequelize[_0x86d1('0x5')](_0x86d1('0x6'))},'accountSid':{'type':Sequelize[_0x86d1('0x3')]},'authToken':{'type':Sequelize[_0x86d1('0x3')]},'notificationTemplate':{'type':Sequelize[_0x86d1('0x7')],'defaultValue':function(){return _0x86d1('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x86d1('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x86d1('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x86d1('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x86d1('0xa')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x86d1('0xb'),'set':function(_0x362489){if(!_0x362489){this[_0x86d1('0xc')]('mandatoryDispositionPauseId',null);}this[_0x86d1('0xc')](_0x86d1('0xd'),_0x362489);}},'description':{'type':Sequelize[_0x86d1('0x3')]}}; \ No newline at end of file +var _0xaf51=['twilio','BOOLEAN','INTEGER','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','name'];(function(_0x84f070,_0xe63399){var _0x1b0294=function(_0x2c70f6){while(--_0x2c70f6){_0x84f070['push'](_0x84f070['shift']());}};_0x1b0294(++_0xe63399);}(_0xaf51,0x15b));var _0x1af5=function(_0x58414b,_0x53ef3d){_0x58414b=_0x58414b-0x0;var _0x3f8cc5=_0xaf51[_0x58414b];return _0x3f8cc5;};'use strict';var Sequelize=require(_0x1af5('0x0'));var rs=require('randomstring');module[_0x1af5('0x1')]={'name':{'type':Sequelize[_0x1af5('0x2')],'unique':_0x1af5('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x1af5('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x1af5('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x1af5('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x1af5('0x2')]},'type':{'type':Sequelize['ENUM'](_0x1af5('0x4'))},'accountSid':{'type':Sequelize[_0x1af5('0x2')]},'authToken':{'type':Sequelize[_0x1af5('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x1af5('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1af5('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1af5('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1af5('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1af5('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1af5('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1af5('0x6')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x1af5('0x5')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x740bda){if(!_0x740bda){this[_0x1af5('0x7')](_0x1af5('0x8'),null);}this[_0x1af5('0x7')]('mandatoryDisposition',_0x740bda);}},'description':{'type':Sequelize[_0x1af5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index d0fe282..248bb25 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 _0x41ca=['from','From','replace','whatsapp:','messageId','MessageSid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','DESC','list','Contacts','WhatsappInteraction','interaction','created','autoclose','push','unmanaged','AttachmentId','UserId','unshift','agent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','debug','twilio','Content-Type','\x0a','to\x20is\x20mandatory','CmList','List','out','WhatsappMessage','Messages','dataValues','eml-format','request-promise','moment','mustache','util','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','client','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','name','send','index','Pause','WhatsappAccount','rawAttributes','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','show','params','mandatoryDispositionPause','includeAll','body','user','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','find','describe','WhatsappAccountId','Disposition','create','getDispositions','findOne','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId'];(function(_0x7538c5,_0xa5d8ac){var _0x8b56be=function(_0x2036c0){while(--_0x2036c0){_0x7538c5['push'](_0x7538c5['shift']());}};_0x8b56be(++_0xa5d8ac);}(_0x41ca,0xe2));var _0xa41c=function(_0x5c3a51,_0x306e53){_0x5c3a51=_0x5c3a51-0x0;var _0x44e374=_0x41ca[_0x5c3a51];return _0x44e374;};'use strict';var emlformat=require(_0xa41c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa41c('0x1'));var moment=require(_0xa41c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xa41c('0x3'));var util=require(_0xa41c('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xa41c('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa41c('0x6'));var squel=require('squel');var crypto=require(_0xa41c('0x7'));var jsforce=require(_0xa41c('0x8'));var deskjs=require(_0xa41c('0x9'));var toCsv=require(_0xa41c('0x5'));var querystring=require(_0xa41c('0xa'));var Papa=require('papaparse');var Redis=require(_0xa41c('0xb'));var authService=require(_0xa41c('0xc'));var qs=require(_0xa41c('0xd'));var as=require(_0xa41c('0xe'));var hardwareService=require(_0xa41c('0xf'));var logger=require(_0xa41c('0x10'))(_0xa41c('0x11'));var utils=require(_0xa41c('0x12'));var config=require(_0xa41c('0x13'));var licenseUtil=require(_0xa41c('0x14'));var db=require(_0xa41c('0x15'))['db'];config[_0xa41c('0x16')]=_[_0xa41c('0x17')](config[_0xa41c('0x16')],{'host':_0xa41c('0x18'),'port':0x18eb});var socket=require(_0xa41c('0x19'))(new Redis(config[_0xa41c('0x16')]));require(_0xa41c('0x1a'))[_0xa41c('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa41c('0x1c')][_0xa41c('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x3c7605,_0x44c7de,_0x3f4411,_0x964d78){return new BPromise(function(_0x5b24cd,_0x3fe421){var _0x2fc5e1=_0x964d78||client;return _0x2fc5e1[_0xa41c('0x1e')](_0x3c7605,_0x3f4411)['then'](function(_0x2e54a1){logger[_0xa41c('0x1f')](_0xa41c('0x20'),_0x44c7de,_0xa41c('0x21'));logger['debug'](_0xa41c('0x22'),_0x44c7de,_0xa41c('0x21'),JSON[_0xa41c('0x23')](_0x2e54a1));if(_0x2e54a1[_0xa41c('0x24')]){if(_0x2e54a1[_0xa41c('0x24')][_0xa41c('0x25')]===0x1f4){logger[_0xa41c('0x24')](_0xa41c('0x20'),_0x44c7de,_0x2e54a1[_0xa41c('0x24')][_0xa41c('0x26')]);return _0x3fe421(_0x2e54a1[_0xa41c('0x24')][_0xa41c('0x26')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x44c7de,_0x2e54a1[_0xa41c('0x24')][_0xa41c('0x26')]);return _0x5b24cd(_0x2e54a1[_0xa41c('0x24')]['message']);}else{logger['info'](_0xa41c('0x20'),_0x44c7de,'request\x20sent');_0x5b24cd(_0x2e54a1[_0xa41c('0x27')][_0xa41c('0x26')]);}})[_0xa41c('0x28')](function(_0xc076c1){logger['error'](_0xa41c('0x20'),_0x44c7de,_0xc076c1);_0x3fe421(_0xc076c1);});});}function respondWithStatusCode(_0x4912d2,_0x380d8f){_0x380d8f=_0x380d8f||0xcc;return function(_0x536163){if(_0x536163){return _0x4912d2[_0xa41c('0x29')](_0x380d8f);}return _0x4912d2[_0xa41c('0x2a')](_0x380d8f)[_0xa41c('0x2b')]();};}function respondWithResult(_0x4ec172,_0x469975){_0x469975=_0x469975||0xc8;return function(_0x39ef64){if(_0x39ef64){return _0x4ec172[_0xa41c('0x2a')](_0x469975)[_0xa41c('0x2c')](_0x39ef64);}};}function respondWithFilteredResult(_0x1cfb4c,_0x48cfc2){return function(_0x175135){if(_0x175135){var _0x368e1a=typeof _0x48cfc2[_0xa41c('0x2d')]==='undefined'&&typeof _0x48cfc2[_0xa41c('0x2e')]===_0xa41c('0x2f');var _0x326e9d=_0x175135[_0xa41c('0x30')];var _0x38d53f=_0x368e1a?0x0:_0x48cfc2[_0xa41c('0x2d')];var _0x1845d6=_0x368e1a?_0x175135[_0xa41c('0x30')]:_0x48cfc2['offset']+_0x48cfc2['limit'];var _0x4f04f7;if(_0x1845d6>=_0x326e9d){_0x1845d6=_0x326e9d;_0x4f04f7=0xc8;}else{_0x4f04f7=0xce;}_0x1cfb4c[_0xa41c('0x2a')](_0x4f04f7);return _0x1cfb4c[_0xa41c('0x31')](_0xa41c('0x32'),_0x38d53f+'-'+_0x1845d6+'/'+_0x326e9d)['json'](_0x175135);}return null;};}function patchUpdates(_0x5958a0){return function(_0x509d4e){try{jsonpatch['apply'](_0x509d4e,_0x5958a0,!![]);}catch(_0x333e43){return BPromise[_0xa41c('0x33')](_0x333e43);}return _0x509d4e[_0xa41c('0x34')]();};}function saveUpdates(_0x41bf93,_0x526998){return function(_0x4182c8){if(_0x4182c8){return _0x4182c8[_0xa41c('0x35')](_0x41bf93)[_0xa41c('0x36')](function(_0x5a4535){return _0x5a4535;});}return null;};}function removeEntity(_0x1e0968,_0x14436f){return function(_0xa6d1d8){if(_0xa6d1d8){return _0xa6d1d8[_0xa41c('0x37')]()['then'](function(){var _0x6c8c5c=_0xa6d1d8[_0xa41c('0x38')]({'plain':!![]});var _0x567bd2='WhatsappAccounts';return db['UserProfileResource'][_0xa41c('0x37')]({'where':{'type':_0x567bd2,'resourceId':_0x6c8c5c['id']}})[_0xa41c('0x36')](function(){return _0xa6d1d8;});})[_0xa41c('0x36')](function(){_0x1e0968[_0xa41c('0x2a')](0xcc)[_0xa41c('0x2b')]();});}};}function handleEntityNotFound(_0x293fd7,_0x4c23f6){return function(_0x36fa2a){if(!_0x36fa2a){_0x293fd7[_0xa41c('0x29')](0x194);}return _0x36fa2a;};}function handleError(_0x39d68a,_0x28f569){_0x28f569=_0x28f569||0x1f4;return function(_0x436eab){logger[_0xa41c('0x24')](_0x436eab['stack']);if(_0x436eab['name']){delete _0x436eab[_0xa41c('0x39')];}_0x39d68a[_0xa41c('0x2a')](_0x28f569)[_0xa41c('0x3a')](_0x436eab);};}exports[_0xa41c('0x3b')]=function(_0x3b4d3f,_0x53187d){var _0x494fc7={'include':[{'model':db[_0xa41c('0x3c')],'as':'mandatoryDispositionPause'}]},_0x54c3d4={},_0x1860ef={'count':0x0,'rows':[]};var _0x29a445=_['map'](db[_0xa41c('0x3d')][_0xa41c('0x3e')],function(_0x8df5db){return{'name':_0x8df5db[_0xa41c('0x3f')],'type':_0x8df5db[_0xa41c('0x40')][_0xa41c('0x41')]};});_0x54c3d4['model']=_['map'](_0x29a445,_0xa41c('0x39'));_0x54c3d4[_0xa41c('0x42')]=_[_0xa41c('0x43')](_0x3b4d3f[_0xa41c('0x42')]);_0x54c3d4[_0xa41c('0x44')]=_[_0xa41c('0x45')](_0x54c3d4[_0xa41c('0x46')],_0x54c3d4['query']);_0x494fc7[_0xa41c('0x47')]=_[_0xa41c('0x45')](_0x54c3d4[_0xa41c('0x46')],qs[_0xa41c('0x48')](_0x3b4d3f[_0xa41c('0x42')]['fields']));_0x494fc7[_0xa41c('0x47')]=_0x494fc7['attributes'][_0xa41c('0x49')]?_0x494fc7[_0xa41c('0x47')]:_0x54c3d4[_0xa41c('0x46')];if(!_0x3b4d3f['query'][_0xa41c('0x4a')](_0xa41c('0x4b'))){_0x494fc7['limit']=qs[_0xa41c('0x2e')](_0x3b4d3f[_0xa41c('0x42')][_0xa41c('0x2e')]);_0x494fc7[_0xa41c('0x2d')]=qs[_0xa41c('0x2d')](_0x3b4d3f['query'][_0xa41c('0x2d')]);}_0x494fc7[_0xa41c('0x4c')]=qs[_0xa41c('0x4d')](_0x3b4d3f[_0xa41c('0x42')][_0xa41c('0x4d')]);_0x494fc7[_0xa41c('0x4e')]=qs[_0xa41c('0x44')](_[_0xa41c('0x4f')](_0x3b4d3f['query'],_0x54c3d4[_0xa41c('0x44')]),_0x29a445);if(_0x3b4d3f['query'][_0xa41c('0x50')]){_0x494fc7[_0xa41c('0x4e')]=_[_0xa41c('0x51')](_0x494fc7[_0xa41c('0x4e')],{'$or':_[_0xa41c('0x52')](_0x29a445,function(_0x39abf1){if(_0x39abf1[_0xa41c('0x40')]!==_0xa41c('0x53')){var _0x2b76be={};_0x2b76be[_0x39abf1[_0xa41c('0x39')]]={'$like':'%'+_0x3b4d3f[_0xa41c('0x42')][_0xa41c('0x50')]+'%'};return _0x2b76be;}})});}_0x494fc7=_['merge']({},_0x494fc7,_0x3b4d3f[_0xa41c('0x54')]);var _0x2359e4={'where':_0x494fc7[_0xa41c('0x4e')]};return db['WhatsappAccount'][_0xa41c('0x30')](_0x2359e4)[_0xa41c('0x36')](function(_0x19a2e9){_0x1860ef['count']=_0x19a2e9;if(_0x3b4d3f[_0xa41c('0x42')]['includeAll']){_0x494fc7[_0xa41c('0x55')]=[{'all':!![]}];}return db['WhatsappAccount'][_0xa41c('0x56')](_0x494fc7);})[_0xa41c('0x36')](function(_0x1bee2b){_0x1860ef[_0xa41c('0x57')]=_0x1bee2b;return _0x1860ef;})[_0xa41c('0x36')](respondWithFilteredResult(_0x53187d,_0x494fc7))[_0xa41c('0x28')](handleError(_0x53187d,null));};exports[_0xa41c('0x58')]=function(_0x3a14c0,_0x128fb5){var _0x10b21f={'raw':![],'where':{'id':_0x3a14c0[_0xa41c('0x59')]['id']},'include':[{'model':db[_0xa41c('0x3c')],'as':_0xa41c('0x5a')}]},_0x2a67aa={};_0x2a67aa[_0xa41c('0x46')]=_['keys'](db[_0xa41c('0x3d')][_0xa41c('0x3e')]);_0x2a67aa['query']=_[_0xa41c('0x43')](_0x3a14c0['query']);_0x2a67aa[_0xa41c('0x44')]=_[_0xa41c('0x45')](_0x2a67aa[_0xa41c('0x46')],_0x2a67aa[_0xa41c('0x42')]);_0x10b21f[_0xa41c('0x47')]=_[_0xa41c('0x45')](_0x2a67aa['model'],qs['fields'](_0x3a14c0[_0xa41c('0x42')]['fields']));_0x10b21f['attributes']=_0x10b21f['attributes'][_0xa41c('0x49')]?_0x10b21f[_0xa41c('0x47')]:_0x2a67aa['model'];if(_0x3a14c0[_0xa41c('0x42')][_0xa41c('0x5b')]){_0x10b21f[_0xa41c('0x55')]=[{'all':!![]}];}_0x10b21f=_['merge']({},_0x10b21f,_0x3a14c0[_0xa41c('0x54')]);return db[_0xa41c('0x3d')]['find'](_0x10b21f)['then'](handleEntityNotFound(_0x128fb5,null))[_0xa41c('0x36')](respondWithResult(_0x128fb5,null))[_0xa41c('0x28')](handleError(_0x128fb5,null));};exports['create']=function(_0x553341,_0x5bd7dd){return db['WhatsappAccount']['create'](_0x553341[_0xa41c('0x5c')],{})['then'](function(_0x5cbbe2){var _0x1d4936=_0x553341['user'][_0xa41c('0x38')]({'plain':!![]});if(!_0x1d4936)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d4936['role']===_0xa41c('0x5d')){var _0x49bcc1=_0x5cbbe2['get']({'plain':!![]});var _0x5ced4f=_0xa41c('0x5e');return db[_0xa41c('0x5f')]['find']({'where':{'name':_0x5ced4f,'userProfileId':_0x1d4936[_0xa41c('0x60')]},'raw':!![]})[_0xa41c('0x36')](function(_0x357ae6){if(_0x357ae6&&_0x357ae6[_0xa41c('0x61')]===0x0){return db[_0xa41c('0x62')]['create']({'name':_0x49bcc1[_0xa41c('0x39')],'resourceId':_0x49bcc1['id'],'type':_0x357ae6['name'],'sectionId':_0x357ae6['id']},{})[_0xa41c('0x36')](function(){return _0x5cbbe2;});}else{return _0x5cbbe2;}})[_0xa41c('0x28')](function(_0x44b00a){logger[_0xa41c('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44b00a);throw _0x44b00a;});}return _0x5cbbe2;})[_0xa41c('0x36')](respondWithResult(_0x5bd7dd,0xc9))[_0xa41c('0x28')](handleError(_0x5bd7dd,null));};exports[_0xa41c('0x35')]=function(_0x5a7954,_0x90654c){if(_0x5a7954['body']['id']){delete _0x5a7954[_0xa41c('0x5c')]['id'];}return db[_0xa41c('0x3d')]['find']({'where':{'id':_0x5a7954[_0xa41c('0x59')]['id']},'include':[{'model':db[_0xa41c('0x3c')],'as':_0xa41c('0x5a')}]})[_0xa41c('0x36')](handleEntityNotFound(_0x90654c,null))[_0xa41c('0x36')](saveUpdates(_0x5a7954[_0xa41c('0x5c')],null))['then'](respondWithResult(_0x90654c,null))[_0xa41c('0x28')](handleError(_0x90654c,null));};exports['destroy']=function(_0x45fc60,_0x23ed21){return db[_0xa41c('0x3d')][_0xa41c('0x63')]({'where':{'id':_0x45fc60[_0xa41c('0x59')]['id']}})[_0xa41c('0x36')](handleEntityNotFound(_0x23ed21,null))[_0xa41c('0x36')](removeEntity(_0x23ed21,null))[_0xa41c('0x28')](handleError(_0x23ed21,null));};exports[_0xa41c('0x64')]=function(_0x1d47fa,_0x1f01cb){return db[_0xa41c('0x3d')][_0xa41c('0x64')]()[_0xa41c('0x36')](respondWithResult(_0x1f01cb,null))[_0xa41c('0x28')](handleError(_0x1f01cb,null));};exports['addDisposition']=function(_0x4979c9,_0x842e51,_0x5b8e35){if(_0x4979c9['body']['id']){delete _0x4979c9['body']['id'];}return db[_0xa41c('0x3d')][_0xa41c('0x63')]({'where':{'id':_0x4979c9[_0xa41c('0x59')]['id']}})[_0xa41c('0x36')](handleEntityNotFound(_0x842e51,null))[_0xa41c('0x36')](function(_0x3d40b9){if(_0x3d40b9){_0x4979c9[_0xa41c('0x5c')][_0xa41c('0x65')]=_0x3d40b9['id'];return db[_0xa41c('0x66')][_0xa41c('0x67')](_0x4979c9['body']);}})[_0xa41c('0x36')](respondWithResult(_0x842e51,null))[_0xa41c('0x28')](handleError(_0x842e51,null));};exports[_0xa41c('0x68')]=function(_0x253385,_0x58bcfd,_0x2a3916){var _0x8bc305={'raw':![],'where':{}};var _0x58214d={};var _0x36e828={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xa41c('0x69')]({'where':{'id':_0x253385['params']['id']}})['then'](handleEntityNotFound(_0x58bcfd,null))[_0xa41c('0x36')](function(_0x5c768a){if(_0x5c768a){_0x58214d[_0xa41c('0x46')]=_[_0xa41c('0x43')](db[_0xa41c('0x66')][_0xa41c('0x3e')]);_0x58214d[_0xa41c('0x42')]=_[_0xa41c('0x43')](_0x253385[_0xa41c('0x42')]);_0x58214d['filters']=_[_0xa41c('0x45')](_0x58214d['model'],_0x58214d[_0xa41c('0x42')]);_0x8bc305['attributes']=_[_0xa41c('0x45')](_0x58214d[_0xa41c('0x46')],qs[_0xa41c('0x48')](_0x253385[_0xa41c('0x42')]['fields']));_0x8bc305[_0xa41c('0x47')]=_0x8bc305[_0xa41c('0x47')][_0xa41c('0x49')]?_0x8bc305['attributes']:_0x58214d['model'];if(!_0x253385[_0xa41c('0x42')][_0xa41c('0x4a')](_0xa41c('0x4b'))){_0x8bc305[_0xa41c('0x2e')]=qs[_0xa41c('0x2e')](_0x253385[_0xa41c('0x42')][_0xa41c('0x2e')]);_0x8bc305[_0xa41c('0x2d')]=qs[_0xa41c('0x2d')](_0x253385[_0xa41c('0x42')][_0xa41c('0x2d')]);}_0x8bc305['order']=qs[_0xa41c('0x4d')](_0x253385[_0xa41c('0x42')]['sort']);_0x8bc305['where']=qs[_0xa41c('0x44')](_[_0xa41c('0x4f')](_0x253385[_0xa41c('0x42')],_0x58214d[_0xa41c('0x44')]));_0x8bc305[_0xa41c('0x4e')][_0xa41c('0x65')]=_0x5c768a['id'];if(_0x253385[_0xa41c('0x42')]['filter']){_0x8bc305[_0xa41c('0x4e')]=_[_0xa41c('0x51')](_0x8bc305['where'],{'$or':_['map'](_0x8bc305[_0xa41c('0x47')],function(_0xfdbf33){var _0x4db64c={};_0x4db64c[_0xfdbf33]={'$like':'%'+_0x253385[_0xa41c('0x42')][_0xa41c('0x50')]+'%'};return _0x4db64c;})});}_0x8bc305=_[_0xa41c('0x51')]({},_0x8bc305,_0x253385[_0xa41c('0x54')]);return db['Disposition'][_0xa41c('0x30')]({'where':_0x8bc305[_0xa41c('0x4e')]})[_0xa41c('0x36')](function(_0x5a7d0f){_0x36e828['count']=_0x5a7d0f;if(_0x253385['query'][_0xa41c('0x5b')]){_0x8bc305[_0xa41c('0x55')]=[{'all':!![]}];}return db[_0xa41c('0x66')][_0xa41c('0x56')](_0x8bc305);})[_0xa41c('0x36')](function(_0x510575){_0x36e828[_0xa41c('0x57')]=_0x510575;return _0x36e828;});}})[_0xa41c('0x36')](respondWithFilteredResult(_0x58bcfd,_0x8bc305))['catch'](handleError(_0x58bcfd,null));};exports[_0xa41c('0x6a')]=function(_0x5640be,_0x727713,_0x1503ff){return db[_0xa41c('0x3d')][_0xa41c('0x63')]({'where':{'id':_0x5640be[_0xa41c('0x59')]['id']}})['then'](handleEntityNotFound(_0x727713,null))[_0xa41c('0x36')](function(_0x180675){if(_0x180675){return _0x180675['removeDispositions'](_0x5640be[_0xa41c('0x42')][_0xa41c('0x6b')]);}})['then'](respondWithStatusCode(_0x727713,null))[_0xa41c('0x28')](handleError(_0x727713,null));};exports[_0xa41c('0x6c')]=function(_0x506316,_0xfe07c6,_0x1e79a3){if(_0x506316[_0xa41c('0x5c')]['id']){delete _0x506316[_0xa41c('0x5c')]['id'];}return db[_0xa41c('0x3d')][_0xa41c('0x63')]({'where':{'id':_0x506316[_0xa41c('0x59')]['id']}})[_0xa41c('0x36')](handleEntityNotFound(_0xfe07c6,null))['then'](function(_0x36a9da){if(_0x36a9da){_0x506316[_0xa41c('0x5c')][_0xa41c('0x65')]=_0x36a9da['id'];return db['CannedAnswer'][_0xa41c('0x67')](_0x506316[_0xa41c('0x5c')]);}})[_0xa41c('0x36')](respondWithResult(_0xfe07c6,null))[_0xa41c('0x28')](handleError(_0xfe07c6,null));};exports[_0xa41c('0x6d')]=function(_0x4e55e4,_0x3f8400,_0x3b1a78){var _0x2d73f8={'raw':![],'where':{}};var _0xb339b={};var _0x55ba13={'count':0x0,'rows':[]};return db[_0xa41c('0x3d')][_0xa41c('0x69')]({'where':{'id':_0x4e55e4[_0xa41c('0x59')]['id']}})[_0xa41c('0x36')](handleEntityNotFound(_0x3f8400,null))['then'](function(_0x16f1f5){if(_0x16f1f5){_0xb339b[_0xa41c('0x46')]=_[_0xa41c('0x43')](db['CannedAnswer']['rawAttributes']);_0xb339b['query']=_[_0xa41c('0x43')](_0x4e55e4[_0xa41c('0x42')]);_0xb339b[_0xa41c('0x44')]=_[_0xa41c('0x45')](_0xb339b['model'],_0xb339b[_0xa41c('0x42')]);_0x2d73f8[_0xa41c('0x47')]=_[_0xa41c('0x45')](_0xb339b[_0xa41c('0x46')],qs[_0xa41c('0x48')](_0x4e55e4[_0xa41c('0x42')][_0xa41c('0x48')]));_0x2d73f8[_0xa41c('0x47')]=_0x2d73f8[_0xa41c('0x47')][_0xa41c('0x49')]?_0x2d73f8[_0xa41c('0x47')]:_0xb339b['model'];if(!_0x4e55e4[_0xa41c('0x42')][_0xa41c('0x4a')](_0xa41c('0x4b'))){_0x2d73f8[_0xa41c('0x2e')]=qs[_0xa41c('0x2e')](_0x4e55e4[_0xa41c('0x42')]['limit']);_0x2d73f8[_0xa41c('0x2d')]=qs[_0xa41c('0x2d')](_0x4e55e4[_0xa41c('0x42')][_0xa41c('0x2d')]);}_0x2d73f8[_0xa41c('0x4c')]=qs[_0xa41c('0x4d')](_0x4e55e4[_0xa41c('0x42')][_0xa41c('0x4d')]);_0x2d73f8['where']=qs[_0xa41c('0x44')](_[_0xa41c('0x4f')](_0x4e55e4[_0xa41c('0x42')],_0xb339b[_0xa41c('0x44')]));_0x2d73f8['where']['WhatsappAccountId']=_0x16f1f5['id'];if(_0x4e55e4[_0xa41c('0x42')][_0xa41c('0x50')]){_0x2d73f8[_0xa41c('0x4e')]=_[_0xa41c('0x51')](_0x2d73f8[_0xa41c('0x4e')],{'$or':_[_0xa41c('0x52')](_0x2d73f8['attributes'],function(_0x3da928){var _0x5c38b6={};_0x5c38b6[_0x3da928]={'$like':'%'+_0x4e55e4[_0xa41c('0x42')][_0xa41c('0x50')]+'%'};return _0x5c38b6;})});}_0x2d73f8=_[_0xa41c('0x51')]({},_0x2d73f8,_0x4e55e4[_0xa41c('0x54')]);return db[_0xa41c('0x6e')][_0xa41c('0x30')]({'where':_0x2d73f8[_0xa41c('0x4e')]})[_0xa41c('0x36')](function(_0x55fd4c){_0x55ba13[_0xa41c('0x30')]=_0x55fd4c;if(_0x4e55e4[_0xa41c('0x42')][_0xa41c('0x5b')]){_0x2d73f8[_0xa41c('0x55')]=[{'all':!![]}];}return db[_0xa41c('0x6e')][_0xa41c('0x56')](_0x2d73f8);})[_0xa41c('0x36')](function(_0x4647f4){_0x55ba13['rows']=_0x4647f4;return _0x55ba13;});}})[_0xa41c('0x36')](respondWithFilteredResult(_0x3f8400,_0x2d73f8))[_0xa41c('0x28')](handleError(_0x3f8400,null));};exports[_0xa41c('0x6f')]=function(_0x2f85f0,_0x1c52e5,_0x2af549){return db[_0xa41c('0x3d')][_0xa41c('0x63')]({'where':{'id':_0x2f85f0[_0xa41c('0x59')]['id']}})[_0xa41c('0x36')](handleEntityNotFound(_0x1c52e5,null))[_0xa41c('0x36')](function(_0x35bb2b){if(_0x35bb2b){return _0x35bb2b[_0xa41c('0x6f')](_0x2f85f0[_0xa41c('0x42')][_0xa41c('0x6b')]);}})[_0xa41c('0x36')](respondWithStatusCode(_0x1c52e5,null))[_0xa41c('0x28')](handleError(_0x1c52e5,null));};exports[_0xa41c('0x70')]=function(_0x5ecf0e,_0x469de6,_0x58c946){return db['WhatsappAccount']['find']({'where':{'id':_0x5ecf0e['params']['id']}})[_0xa41c('0x36')](handleEntityNotFound(_0x469de6,null))[_0xa41c('0x36')](function(_0x3d8574){if(_0x3d8574){return _0x3d8574[_0xa41c('0x70')](_0x5ecf0e[_0xa41c('0x5c')][_0xa41c('0x6b')],_[_0xa41c('0x71')](_0x5ecf0e[_0xa41c('0x5c')],['ids','id'])||{})[_0xa41c('0x72')](function(_0x6acf51){for(var _0x1a12ec=0x0;_0x1a12ec<_0x5ecf0e[_0xa41c('0x5c')][_0xa41c('0x6b')]['length'];_0x1a12ec+=0x1){socket[_0xa41c('0x73')](_0xa41c('0x74'),{'UserId':Number(_0x5ecf0e[_0xa41c('0x5c')][_0xa41c('0x6b')][_0x1a12ec]),'WhatsappAccountId':Number(_0x5ecf0e[_0xa41c('0x59')]['id'])});}return _0x6acf51;});}})[_0xa41c('0x36')](respondWithResult(_0x469de6,null))['catch'](handleError(_0x469de6,null));};exports['removeAgents']=function(_0x411e8d,_0x14d61c,_0x279c06){return db[_0xa41c('0x3d')][_0xa41c('0x63')]({'where':{'id':_0x411e8d[_0xa41c('0x59')]['id']}})['then'](handleEntityNotFound(_0x14d61c,null))['then'](function(_0x2cf1a7){if(_0x2cf1a7){return _0x2cf1a7['removeAgents'](_0x411e8d['query'][_0xa41c('0x6b')])[_0xa41c('0x36')](function(){if(_[_0xa41c('0x75')](_0x411e8d[_0xa41c('0x42')]['ids'])){for(var _0x147161=0x0;_0x147161<_0x411e8d['query']['ids'][_0xa41c('0x49')];_0x147161+=0x1){socket['emit'](_0xa41c('0x76'),{'UserId':Number(_0x411e8d[_0xa41c('0x42')][_0xa41c('0x6b')][_0x147161]),'WhatsappAccountId':Number(_0x411e8d['params']['id'])});}}else{socket[_0xa41c('0x73')](_0xa41c('0x76'),{'UserId':Number(_0x411e8d[_0xa41c('0x42')][_0xa41c('0x6b')]),'WhatsappAccountId':Number(_0x411e8d['params']['id'])});}});}})[_0xa41c('0x36')](respondWithStatusCode(_0x14d61c,null))[_0xa41c('0x28')](handleError(_0x14d61c,null));};exports[_0xa41c('0x77')]=function(_0x507485,_0x30f0b9,_0x5c9101){var _0x26115f={};var _0x3ab167={};var _0x3bef81;var _0x42a859;return db[_0xa41c('0x3d')][_0xa41c('0x69')]({'where':{'id':_0x507485['params']['id']}})[_0xa41c('0x36')](handleEntityNotFound(_0x30f0b9,null))['then'](function(_0x576365){if(_0x576365){_0x3bef81=_0x576365;_0x3ab167['model']=_[_0xa41c('0x43')](db[_0xa41c('0x78')][_0xa41c('0x3e')]);_0x3ab167['query']=_[_0xa41c('0x43')](_0x507485[_0xa41c('0x42')]);_0x3ab167['filters']=_[_0xa41c('0x45')](_0x3ab167[_0xa41c('0x46')],_0x3ab167[_0xa41c('0x42')]);_0x26115f[_0xa41c('0x47')]=_[_0xa41c('0x45')](_0x3ab167[_0xa41c('0x46')],qs[_0xa41c('0x48')](_0x507485[_0xa41c('0x42')][_0xa41c('0x48')]));_0x26115f['attributes']=_0x26115f[_0xa41c('0x47')][_0xa41c('0x49')]?_0x26115f[_0xa41c('0x47')]:_0x3ab167[_0xa41c('0x46')];_0x26115f['order']=qs['sort'](_0x507485[_0xa41c('0x42')][_0xa41c('0x4d')]);_0x26115f['where']=qs[_0xa41c('0x44')](_[_0xa41c('0x4f')](_0x507485['query'],_0x3ab167[_0xa41c('0x44')]));if(_0x507485[_0xa41c('0x42')][_0xa41c('0x50')]){_0x26115f[_0xa41c('0x4e')]=_[_0xa41c('0x51')](_0x26115f[_0xa41c('0x4e')],{'$or':_[_0xa41c('0x52')](_0x26115f[_0xa41c('0x47')],function(_0x37c4eb){var _0x473273={};_0x473273[_0x37c4eb]={'$like':'%'+_0x507485[_0xa41c('0x42')][_0xa41c('0x50')]+'%'};return _0x473273;})});}_0x26115f=_[_0xa41c('0x51')]({},_0x26115f,_0x507485[_0xa41c('0x54')]);return _0x3bef81[_0xa41c('0x77')](_0x26115f);}})[_0xa41c('0x36')](function(_0xb377d0){if(_0xb377d0){_0x42a859=_0xb377d0['length'];if(!_0x507485[_0xa41c('0x42')]['hasOwnProperty'](_0xa41c('0x4b'))){_0x26115f[_0xa41c('0x2e')]=qs[_0xa41c('0x2e')](_0x507485['query'][_0xa41c('0x2e')]);_0x26115f[_0xa41c('0x2d')]=qs[_0xa41c('0x2d')](_0x507485[_0xa41c('0x42')]['offset']);}return _0x3bef81['getAgents'](_0x26115f);}})[_0xa41c('0x36')](function(_0xe6fd6f){if(_0xe6fd6f){return _0xe6fd6f?{'count':_0x42a859,'rows':_0xe6fd6f}:null;}})['then'](respondWithResult(_0x30f0b9,null))[_0xa41c('0x28')](handleError(_0x30f0b9,null));};exports[_0xa41c('0x79')]=function(_0x5032e8,_0x583837,_0x276142){return db['WhatsappAccount'][_0xa41c('0x69')]({'where':{'id':_0x5032e8['params']['id']}})['then'](handleEntityNotFound(_0x583837,null))[_0xa41c('0x36')](function(_0x101780){if(_0x101780){return db[_0xa41c('0x7a')][_0xa41c('0x7b')](function(_0x462c97){return db[_0xa41c('0x7c')][_0xa41c('0x37')]({'where':{'WhatsappAccountId':_0x5032e8['params']['id']},'transaction':_0x462c97})[_0xa41c('0x36')](function(_0x49eb08){var _0xea5fb0=_[_0xa41c('0x52')](_0x5032e8[_0xa41c('0x5c')],function(_0x367c4c){_0x367c4c['WhatsappAccountId']=_0x5032e8[_0xa41c('0x59')]['id'];return _0x367c4c;});return db[_0xa41c('0x7c')][_0xa41c('0x7d')](_0xea5fb0,{'transaction':_0x462c97});});})[_0xa41c('0x36')](function(){return db['WhatsappApplication'][_0xa41c('0x7e')]({'where':{'WhatsappAccountId':_0x5032e8[_0xa41c('0x59')]['id']},'order':'priority'});});}})[_0xa41c('0x36')](respondWithResult(_0x583837,null))[_0xa41c('0x28')](handleError(_0x583837,null));};exports[_0xa41c('0x7f')]=function(_0x4c6da5,_0x362283,_0x2efacc){var _0x211238={};var _0x5118c5={};var _0x15052f;var _0x409e59;return db[_0xa41c('0x3d')][_0xa41c('0x69')]({'where':{'id':_0x4c6da5[_0xa41c('0x59')]['id']}})['then'](handleEntityNotFound(_0x362283,null))['then'](function(_0x216986){if(_0x216986){_0x15052f=_0x216986;_0x5118c5['model']=_[_0xa41c('0x43')](db[_0xa41c('0x7c')][_0xa41c('0x3e')]);_0x5118c5[_0xa41c('0x42')]=_[_0xa41c('0x43')](_0x4c6da5['query']);_0x5118c5[_0xa41c('0x44')]=_['intersection'](_0x5118c5[_0xa41c('0x46')],_0x5118c5['query']);_0x211238[_0xa41c('0x47')]=_['intersection'](_0x5118c5['model'],qs[_0xa41c('0x48')](_0x4c6da5[_0xa41c('0x42')][_0xa41c('0x48')]));_0x211238[_0xa41c('0x47')]=_0x211238[_0xa41c('0x47')][_0xa41c('0x49')]?_0x211238[_0xa41c('0x47')]:_0x5118c5[_0xa41c('0x46')];_0x211238[_0xa41c('0x4c')]=qs[_0xa41c('0x4d')](_0x4c6da5['query'][_0xa41c('0x4d')]);_0x211238[_0xa41c('0x4e')]=qs[_0xa41c('0x44')](_['pick'](_0x4c6da5[_0xa41c('0x42')],_0x5118c5[_0xa41c('0x44')]));if(_0x4c6da5['query'][_0xa41c('0x50')]){_0x211238[_0xa41c('0x4e')]=_['merge'](_0x211238[_0xa41c('0x4e')],{'$or':_[_0xa41c('0x52')](_0x211238['attributes'],function(_0x5cede8){var _0x18bf93={};_0x18bf93[_0x5cede8]={'$like':'%'+_0x4c6da5['query'][_0xa41c('0x50')]+'%'};return _0x18bf93;})});}_0x211238=_[_0xa41c('0x51')]({},_0x211238,_0x4c6da5[_0xa41c('0x54')]);return _0x15052f['getApplications'](_0x211238);}})[_0xa41c('0x36')](function(_0x31be61){if(_0x31be61){_0x409e59=_0x31be61['length'];if(!_0x4c6da5[_0xa41c('0x42')][_0xa41c('0x4a')](_0xa41c('0x4b'))){_0x211238[_0xa41c('0x2e')]=qs[_0xa41c('0x2e')](_0x4c6da5['query']['limit']);_0x211238[_0xa41c('0x2d')]=qs[_0xa41c('0x2d')](_0x4c6da5[_0xa41c('0x42')]['offset']);}return _0x15052f['getApplications'](_0x211238);}})[_0xa41c('0x36')](function(_0x5381a0){if(_0x5381a0){return _0x5381a0?{'count':_0x409e59,'rows':_0x5381a0}:null;}})[_0xa41c('0x36')](respondWithResult(_0x362283,null))[_0xa41c('0x28')](handleError(_0x362283,null));};exports['notify']=function(_0x403040,_0x4df575,_0x57c96c){var _0x2e0c01={'channel':'whatsapp'};var _0x3303cf=[];var _0x7f3444=[];var _0x4c0d56={};return db[_0xa41c('0x3d')][_0xa41c('0x63')]({'where':{'id':_0x403040[_0xa41c('0x59')]['id']},'include':[{'model':db[_0xa41c('0x7c')],'as':_0xa41c('0x80')}]})['then'](handleEntityNotFound(_0x4df575,null))[_0xa41c('0x36')](function(_0x32f981){_0x2e0c01[_0xa41c('0x81')]=_0x32f981;_0x2e0c01[_0xa41c('0x82')]=_[_0xa41c('0x83')](_0x32f981[_0xa41c('0x80')],[_0xa41c('0x84')],[_0xa41c('0x85')]);if(_0x2e0c01[_0xa41c('0x81')][_0xa41c('0x80')]){delete _0x2e0c01[_0xa41c('0x81')][_0xa41c('0x80')];}return db[_0xa41c('0x86')][_0xa41c('0x64')]();})['then'](function(_0x251083){if(!_0x251083){throw new db[(_0xa41c('0x87'))][(_0xa41c('0x88'))]('no\x20available\x20attributes');}_0x3303cf=_[_0xa41c('0x89')](_[_0xa41c('0x43')](_0x251083),[_0xa41c('0x8a'),_0xa41c('0x8b')]);_0x7f3444=_[_0xa41c('0x89')](_[_0xa41c('0x43')](_0x251083),['createdAt',_0xa41c('0x8b'),_0xa41c('0x8c'),_0xa41c('0x8d')]);_0x2e0c01[_0xa41c('0x5c')]={'mapKey':'mobile'};if(_0x2e0c01['account'][_0xa41c('0x40')]&&_0x2e0c01[_0xa41c('0x81')]['type']==='twilio'){_0x2e0c01[_0xa41c('0x5c')][_0xa41c('0x8e')]=_0x403040['body'][_0xa41c('0x8f')][_0xa41c('0x90')](_0xa41c('0x91'),'');_0x2e0c01[_0xa41c('0x5c')][_0xa41c('0x5c')]=_0x403040[_0xa41c('0x5c')]['Body'];_0x2e0c01['body'][_0xa41c('0x92')]=_0x403040[_0xa41c('0x5c')][_0xa41c('0x93')];}if(_0x2e0c01[_0xa41c('0x5c')]['id']){delete _0x2e0c01[_0xa41c('0x5c')]['id'];}if(_[_0xa41c('0x94')](_0x2e0c01[_0xa41c('0x5c')][_0xa41c('0x8e')])){throw new db['Sequelize']['ValidationError'](_0xa41c('0x95'));}if(_[_0xa41c('0x94')](_0x2e0c01[_0xa41c('0x5c')][_0xa41c('0x5c')])||_0x2e0c01[_0xa41c('0x5c')]['body']===''){throw new db[(_0xa41c('0x87'))]['ValidationError'](_0xa41c('0x96'));}if(_[_0xa41c('0x94')](_0x2e0c01[_0xa41c('0x5c')]['mapKey'])){throw new db[(_0xa41c('0x87'))][(_0xa41c('0x88'))](_0xa41c('0x97')+_0x7f3444);}if(!_[_0xa41c('0x98')](_0x7f3444,_0x2e0c01[_0xa41c('0x5c')][_0xa41c('0x99')])){throw new db[(_0xa41c('0x87'))][(_0xa41c('0x88'))](_0xa41c('0x9a')+_0x7f3444);}_0x4c0d56[_0x2e0c01[_0xa41c('0x5c')][_0xa41c('0x99')]]=_0x2e0c01['body'][_0xa41c('0x8e')];return db['CmList'][_0xa41c('0x63')]({'where':{'id':_0x2e0c01[_0xa41c('0x81')][_0xa41c('0x8d')]},'include':[{'model':db[_0xa41c('0x86')],'as':'Contacts','where':_0x4c0d56,'limit':0x1,'order':[[_0xa41c('0x8b'),_0xa41c('0x9b')]]}]});})[_0xa41c('0x36')](handleEntityNotFound(_0x4df575,null))[_0xa41c('0x36')](function(_0x207aa9){if(_0x207aa9){_0x2e0c01[_0xa41c('0x9c')]=_[_0xa41c('0x71')](_0x207aa9,['Contacts']);if(_0x207aa9[_0xa41c('0x9d')][_0xa41c('0x49')]){return _0x207aa9[_0xa41c('0x9d')][0x0];}var _0x2bf0e2=_[_0xa41c('0x17')](_0x2e0c01['body'],{'firstName':_0x2e0c01[_0xa41c('0x5c')][_0xa41c('0x8e')],'ListId':_0x207aa9['id']});_0x2bf0e2[_0x2e0c01['body']['mapKey']]=_0x2e0c01[_0xa41c('0x5c')][_0xa41c('0x8e')];return db[_0xa41c('0x86')][_0xa41c('0x67')](_0x2bf0e2,{'fields':_0x3303cf,'raw':!![]});}})[_0xa41c('0x36')](handleEntityNotFound(_0x4df575,null))['then'](function(_0x2fa1dd){if(_0x2fa1dd){_0x2e0c01['contact']=_0x2fa1dd;var _0x3ce2cf={'ContactId':_0x2fa1dd['id'],'phone':_0x2e0c01[_0xa41c('0x5c')][_0xa41c('0x8e')],'WhatsappAccountId':_0x403040[_0xa41c('0x59')]['id']};var _0x1e081f={'ContactId':_0x2fa1dd['id'],'WhatsappAccountId':_0x403040[_0xa41c('0x59')]['id'],'closed':![]};return db[_0xa41c('0x9e')][_0xa41c('0x63')]({'where':_0x1e081f})[_0xa41c('0x36')](function(_0x458029){if(_0x458029){return[_0x458029,![]];}return db[_0xa41c('0x9e')][_0xa41c('0x67')](_0x3ce2cf)[_0xa41c('0x36')](function(_0x293bbd){return[_0x293bbd,!![]];});});}})[_0xa41c('0x72')](function(_0x19cb60,_0x5f14db){_0x2e0c01[_0xa41c('0x9f')]=_0x19cb60[_0xa41c('0x38')]({'plain':!![]});_0x2e0c01['interaction'][_0xa41c('0xa0')]=![];if(_0x5f14db){if(_0x2e0c01[_0xa41c('0x81')][_0xa41c('0xa1')]){_0x2e0c01[_0xa41c('0x82')][_0xa41c('0xa2')]({'id':0x0,'priority':_0x2e0c01[_0xa41c('0x82')][_0xa41c('0x49')]+0x1,'app':'close','appdata':_0xa41c('0xa3'),'interval':'*,*,*,*'});}_0x2e0c01[_0xa41c('0x9f')][_0xa41c('0xa0')]=!![];}return db['WhatsappMessage']['create']({'phone':_0x2e0c01[_0xa41c('0x5c')]['from'],'messageId':_0x2e0c01[_0xa41c('0x5c')][_0xa41c('0x92')],'body':_0x2e0c01[_0xa41c('0x5c')]['body'],'WhatsappAccountId':_0x403040[_0xa41c('0x59')]['id'],'WhatsappInteractionId':_0x19cb60['id'],'direction':'in','ContactId':_0x19cb60['ContactId'],'AttachmentId':_0x2e0c01[_0xa41c('0x5c')][_0xa41c('0xa4')]});})[_0xa41c('0x36')](function(_0x24aac1){_0x2e0c01[_0xa41c('0x26')]=_0x24aac1;if(_0x2e0c01[_0xa41c('0x9f')][_0xa41c('0xa5')]){return db['User'][_0xa41c('0x63')]({'attributes':['id',_0xa41c('0x39')],'where':{'id':_0x2e0c01[_0xa41c('0x9f')]['UserId']}})['then'](function(_0x459060){if(_0x459060){_0x2e0c01[_0xa41c('0x82')][_0xa41c('0xa6')]({'id':0x0,'priority':0x0,'app':_0xa41c('0xa7'),'appdata':_0x459060[_0xa41c('0x39')]+','+(_0x2e0c01[_0xa41c('0x81')]['waitForTheAssignedAgent']||0xa),'interval':_0xa41c('0xa8')});}return respondWithRpcPromise(_0xa41c('0xa9'),_0xa41c('0xaa'),_0x2e0c01);});}return respondWithRpcPromise(_0xa41c('0xa9'),_0xa41c('0xaa'),_0x2e0c01);})[_0xa41c('0x36')](function(_0x4a42b3){if(_0x4a42b3){var _0x527c6d=0xc8;var _0x190fe8=_0xa41c('0xab');logger[_0xa41c('0x1f')](_0xa41c('0x22'),_0x190fe8,_0x527c6d,_0xa41c('0xac'));logger[_0xa41c('0xad')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x190fe8,_0x527c6d,'entity\x20found',JSON[_0xa41c('0x23')](_0x4a42b3));if(_0x2e0c01[_0xa41c('0x81')][_0xa41c('0x40')]===_0xa41c('0xae')){return _0x4df575[_0xa41c('0x2a')](_0x527c6d)[_0xa41c('0x31')](_0xa41c('0xaf'),'text/xml')[_0xa41c('0x3a')](_0xa41c('0xb0'));}else{return _0x4df575['status'](_0x527c6d)[_0xa41c('0x2c')](_0x4a42b3);}}})[_0xa41c('0x28')](handleError(_0x4df575,null));};exports['send']=function(_0x1b257a,_0x2e84fa,_0x2eb561){var _0x95fe29,_0x287ad5,_0x2a9a4d;if(_[_0xa41c('0x94')](_0x1b257a[_0xa41c('0x5c')][_0xa41c('0x5c')])||_0x1b257a['body'][_0xa41c('0x5c')]===''){throw new db['Sequelize'][(_0xa41c('0x88'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa41c('0x94')](_0x1b257a[_0xa41c('0x5c')]['to'])){throw new db[(_0xa41c('0x87'))][(_0xa41c('0x88'))](_0xa41c('0xb1'));}_0x95fe29=_0x1b257a[_0xa41c('0x5c')]['to'];return db[_0xa41c('0x3d')]['find']({'where':{'id':_0x1b257a[_0xa41c('0x59')]['id']},'include':[{'model':db[_0xa41c('0xb2')],'as':_0xa41c('0xb3'),'include':[{'model':db[_0xa41c('0x86')],'as':_0xa41c('0x9d'),'where':{'mobile':_0x95fe29},'limit':0x1,'order':[['updatedAt',_0xa41c('0x9b')]]}]}]})[_0xa41c('0x36')](handleEntityNotFound(_0x2e84fa,null))[_0xa41c('0x36')](function(_0x46b183){if(_0x46b183&&_0x46b183['List']){_0x287ad5=_0x46b183[_0xa41c('0x38')]({'plain':!![]});if(_0x287ad5['List']&&_0x287ad5['List'][_0xa41c('0x9d')][_0xa41c('0x49')]){return _0x287ad5[_0xa41c('0xb3')][_0xa41c('0x9d')][0x0];}return db[_0xa41c('0x86')][_0xa41c('0x67')](_[_0xa41c('0x17')](_0x1b257a[_0xa41c('0x5c')],{'firstName':_0x95fe29,'mobile':_0x95fe29,'phone':_0x95fe29,'ListId':_0x287ad5[_0xa41c('0x8d')]}));}})[_0xa41c('0x36')](handleEntityNotFound(_0x2e84fa,null))['then'](function(_0x40b792){if(_0x40b792){_0x2a9a4d=_0x40b792;return db['WhatsappInteraction'][_0xa41c('0x63')]({'where':{'ContactId':_0x2a9a4d['id'],'closed':![],'WhatsappAccountId':_0x287ad5['id']}})[_0xa41c('0x36')](function(_0x306f82){if(_0x306f82){return[_0x306f82,![]];}return db[_0xa41c('0x9e')]['create']({'UserId':_0x1b257a[_0xa41c('0x5d')]['id'],'ContactId':_0x2a9a4d['id'],'WhatsappAccountId':_0x287ad5['id'],'phone':_0x95fe29,'firstMsgDirection':_0xa41c('0xb4'),'Messages':[_[_0xa41c('0x51')](_0x1b257a[_0xa41c('0x5c')],{'read':![],'body':_0x1b257a[_0xa41c('0x5c')]['body'],'phone':_0x95fe29,'WhatsappAccountId':_0x287ad5['id'],'UserId':_0x1b257a[_0xa41c('0x5d')]['id'],'ContactId':_0x2a9a4d['id']})]},{'include':[{'model':db[_0xa41c('0xb5')],'as':_0xa41c('0xb6')}]})['then'](function(_0x4d90d3){return[_0x4d90d3,!![]];});});}})[_0xa41c('0x72')](function(_0x185c99,_0x59c047){if(_0x59c047){return _0x185c99;}return db[_0xa41c('0xb5')]['create'](_[_0xa41c('0x51')](_0x1b257a['body'],{'read':![],'body':_0x1b257a[_0xa41c('0x5c')][_0xa41c('0x5c')],'phone':_0x95fe29,'WhatsappAccountId':_0x287ad5['id'],'WhatsappInteractionId':_0x185c99['id'],'UserId':_0x1b257a[_0xa41c('0x5d')]['id'],'ContactId':_0x2a9a4d['id']}))[_0xa41c('0x36')](function(_0x1703da){_0x185c99[_0xa41c('0xb7')][_0xa41c('0xb6')]=[];_0x185c99[_0xa41c('0xb7')]['Messages'][_0xa41c('0xa2')](_0x1703da[_0xa41c('0xb7')]);return _0x185c99;});})['then'](respondWithResult(_0x2e84fa,null))[_0xa41c('0x28')](handleError(_0x2e84fa,null));}; \ No newline at end of file +var _0x1123=['WhatsappAccounts','UserProfileResource','destroy','end','stack','name','send','index','Pause','map','WhatsappAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','options','count','includeAll','include','findAll','show','params','mandatoryDispositionPause','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','describe','Disposition','findOne','order','WhatsappAccountId','filter','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','account','asc','Applications','CmContact','difference','createdAt','updatedAt','mobile','twilio','from','From','replace','whatsapp:','Body','MessageSid','isNil','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','applications','close','*,*,*,*','WhatsappMessage','messageId','ContactId','AttachmentId','UserId','unshift','agent','startRouting','Start','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','List','out','Messages','push','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','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','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','limit','offset','json','apply','reject','update'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x1123,0x13e));var _0x3112=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x1123[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0x3112('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3112('0x1'));var jsonpatch=require(_0x3112('0x2'));var rp=require(_0x3112('0x3'));var moment=require(_0x3112('0x4'));var BPromise=require(_0x3112('0x5'));var Mustache=require(_0x3112('0x6'));var util=require(_0x3112('0x7'));var path=require('path');var sox=require(_0x3112('0x8'));var csv=require(_0x3112('0x9'));var ejs=require(_0x3112('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3112('0xb'));var crypto=require(_0x3112('0xc'));var jsforce=require(_0x3112('0xd'));var deskjs=require(_0x3112('0xe'));var toCsv=require(_0x3112('0x9'));var querystring=require(_0x3112('0xf'));var Papa=require(_0x3112('0x10'));var Redis=require(_0x3112('0x11'));var authService=require(_0x3112('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3112('0x13'));var hardwareService=require(_0x3112('0x14'));var logger=require(_0x3112('0x15'))(_0x3112('0x16'));var utils=require(_0x3112('0x17'));var config=require(_0x3112('0x18'));var licenseUtil=require(_0x3112('0x19'));var db=require(_0x3112('0x1a'))['db'];config[_0x3112('0x1b')]=_[_0x3112('0x1c')](config[_0x3112('0x1b')],{'host':_0x3112('0x1d'),'port':0x18eb});var socket=require(_0x3112('0x1e'))(new Redis(config[_0x3112('0x1b')]));require(_0x3112('0x1f'))[_0x3112('0x20')](socket);var jayson=require(_0x3112('0x21'));var client=jayson[_0x3112('0x22')][_0x3112('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x16e378,_0x509d97,_0x9e0226,_0x3a1a2a){return new BPromise(function(_0x2cdbb2,_0x33243b){var _0xf36538=_0x3a1a2a||client;return _0xf36538[_0x3112('0x24')](_0x16e378,_0x9e0226)[_0x3112('0x25')](function(_0x4c681f){logger[_0x3112('0x26')](_0x3112('0x27'),_0x509d97,'request\x20sent');logger[_0x3112('0x28')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x509d97,_0x3112('0x29'),JSON[_0x3112('0x2a')](_0x4c681f));if(_0x4c681f[_0x3112('0x2b')]){if(_0x4c681f[_0x3112('0x2b')][_0x3112('0x2c')]===0x1f4){logger[_0x3112('0x2b')](_0x3112('0x27'),_0x509d97,_0x4c681f[_0x3112('0x2b')]['message']);return _0x33243b(_0x4c681f[_0x3112('0x2b')][_0x3112('0x2d')]);}logger[_0x3112('0x2b')]('WhatsappAccount,\x20%s,\x20%s',_0x509d97,_0x4c681f['error'][_0x3112('0x2d')]);return _0x2cdbb2(_0x4c681f['error'][_0x3112('0x2d')]);}else{logger[_0x3112('0x26')](_0x3112('0x27'),_0x509d97,_0x3112('0x29'));_0x2cdbb2(_0x4c681f[_0x3112('0x2e')][_0x3112('0x2d')]);}})[_0x3112('0x2f')](function(_0x1f2fc0){logger[_0x3112('0x2b')](_0x3112('0x27'),_0x509d97,_0x1f2fc0);_0x33243b(_0x1f2fc0);});});}function respondWithStatusCode(_0x60110d,_0x1bcd25){_0x1bcd25=_0x1bcd25||0xcc;return function(_0xd0d9b3){if(_0xd0d9b3){return _0x60110d[_0x3112('0x30')](_0x1bcd25);}return _0x60110d[_0x3112('0x31')](_0x1bcd25)['end']();};}function respondWithResult(_0x20d8ec,_0x9b977a){_0x9b977a=_0x9b977a||0xc8;return function(_0x47640d){if(_0x47640d){return _0x20d8ec['status'](_0x9b977a)['json'](_0x47640d);}};}function respondWithFilteredResult(_0x3e69fc,_0x3f2821){return function(_0x2e76c0){if(_0x2e76c0){var _0x2c13ac=typeof _0x3f2821['offset']==='undefined'&&typeof _0x3f2821[_0x3112('0x32')]==='undefined';var _0x1f971e=_0x2e76c0['count'];var _0x3840bb=_0x2c13ac?0x0:_0x3f2821[_0x3112('0x33')];var _0x3b68ef=_0x2c13ac?_0x2e76c0['count']:_0x3f2821[_0x3112('0x33')]+_0x3f2821[_0x3112('0x32')];var _0x28ef82;if(_0x3b68ef>=_0x1f971e){_0x3b68ef=_0x1f971e;_0x28ef82=0xc8;}else{_0x28ef82=0xce;}_0x3e69fc['status'](_0x28ef82);return _0x3e69fc['set']('Content-Range',_0x3840bb+'-'+_0x3b68ef+'/'+_0x1f971e)[_0x3112('0x34')](_0x2e76c0);}return null;};}function patchUpdates(_0x11d1f1){return function(_0xe36b4f){try{jsonpatch[_0x3112('0x35')](_0xe36b4f,_0x11d1f1,!![]);}catch(_0x57c8a7){return BPromise[_0x3112('0x36')](_0x57c8a7);}return _0xe36b4f['save']();};}function saveUpdates(_0x37be7f,_0x326461){return function(_0x54121d){if(_0x54121d){return _0x54121d[_0x3112('0x37')](_0x37be7f)[_0x3112('0x25')](function(_0x808567){return _0x808567;});}return null;};}function removeEntity(_0x4d05f8,_0x1177db){return function(_0x49a305){if(_0x49a305){return _0x49a305['destroy']()['then'](function(){var _0x13ad5d=_0x49a305['get']({'plain':!![]});var _0x138d97=_0x3112('0x38');return db[_0x3112('0x39')][_0x3112('0x3a')]({'where':{'type':_0x138d97,'resourceId':_0x13ad5d['id']}})[_0x3112('0x25')](function(){return _0x49a305;});})['then'](function(){_0x4d05f8[_0x3112('0x31')](0xcc)[_0x3112('0x3b')]();});}};}function handleEntityNotFound(_0x55afe7,_0x390018){return function(_0x544778){if(!_0x544778){_0x55afe7[_0x3112('0x30')](0x194);}return _0x544778;};}function handleError(_0x1be275,_0xfdacc0){_0xfdacc0=_0xfdacc0||0x1f4;return function(_0x219659){logger['error'](_0x219659[_0x3112('0x3c')]);if(_0x219659[_0x3112('0x3d')]){delete _0x219659[_0x3112('0x3d')];}_0x1be275[_0x3112('0x31')](_0xfdacc0)[_0x3112('0x3e')](_0x219659);};}exports[_0x3112('0x3f')]=function(_0x4e6563,_0x32f69d){var _0x409f3a={'include':[{'model':db[_0x3112('0x40')],'as':'mandatoryDispositionPause'}]},_0xd64a52={},_0x5a13f4={'count':0x0,'rows':[]};var _0x2ed366=_[_0x3112('0x41')](db[_0x3112('0x42')][_0x3112('0x43')],function(_0x528572){return{'name':_0x528572['fieldName'],'type':_0x528572[_0x3112('0x44')][_0x3112('0x45')]};});_0xd64a52[_0x3112('0x46')]=_['map'](_0x2ed366,_0x3112('0x3d'));_0xd64a52[_0x3112('0x47')]=_[_0x3112('0x48')](_0x4e6563[_0x3112('0x47')]);_0xd64a52[_0x3112('0x49')]=_[_0x3112('0x4a')](_0xd64a52[_0x3112('0x46')],_0xd64a52[_0x3112('0x47')]);_0x409f3a[_0x3112('0x4b')]=_[_0x3112('0x4a')](_0xd64a52[_0x3112('0x46')],qs[_0x3112('0x4c')](_0x4e6563[_0x3112('0x47')][_0x3112('0x4c')]));_0x409f3a[_0x3112('0x4b')]=_0x409f3a[_0x3112('0x4b')][_0x3112('0x4d')]?_0x409f3a['attributes']:_0xd64a52[_0x3112('0x46')];if(!_0x4e6563[_0x3112('0x47')][_0x3112('0x4e')](_0x3112('0x4f'))){_0x409f3a[_0x3112('0x32')]=qs[_0x3112('0x32')](_0x4e6563['query'][_0x3112('0x32')]);_0x409f3a[_0x3112('0x33')]=qs[_0x3112('0x33')](_0x4e6563['query']['offset']);}_0x409f3a['order']=qs[_0x3112('0x50')](_0x4e6563[_0x3112('0x47')][_0x3112('0x50')]);_0x409f3a[_0x3112('0x51')]=qs['filters'](_[_0x3112('0x52')](_0x4e6563['query'],_0xd64a52[_0x3112('0x49')]),_0x2ed366);if(_0x4e6563[_0x3112('0x47')]['filter']){_0x409f3a['where']=_[_0x3112('0x53')](_0x409f3a[_0x3112('0x51')],{'$or':_[_0x3112('0x41')](_0x2ed366,function(_0x289ddc){if(_0x289ddc[_0x3112('0x44')]!=='VIRTUAL'){var _0x2b8e71={};_0x2b8e71[_0x289ddc[_0x3112('0x3d')]]={'$like':'%'+_0x4e6563['query']['filter']+'%'};return _0x2b8e71;}})});}_0x409f3a=_[_0x3112('0x53')]({},_0x409f3a,_0x4e6563[_0x3112('0x54')]);var _0x3ae7f8={'where':_0x409f3a['where']};return db[_0x3112('0x42')][_0x3112('0x55')](_0x3ae7f8)[_0x3112('0x25')](function(_0x1822af){_0x5a13f4[_0x3112('0x55')]=_0x1822af;if(_0x4e6563[_0x3112('0x47')][_0x3112('0x56')]){_0x409f3a[_0x3112('0x57')]=[{'all':!![]}];}return db[_0x3112('0x42')][_0x3112('0x58')](_0x409f3a);})[_0x3112('0x25')](function(_0x1ad0a7){_0x5a13f4['rows']=_0x1ad0a7;return _0x5a13f4;})['then'](respondWithFilteredResult(_0x32f69d,_0x409f3a))['catch'](handleError(_0x32f69d,null));};exports[_0x3112('0x59')]=function(_0x972d34,_0x208930){var _0x2e4053={'raw':![],'where':{'id':_0x972d34[_0x3112('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x3112('0x5b')}]},_0x391022={};_0x391022[_0x3112('0x46')]=_[_0x3112('0x48')](db[_0x3112('0x42')][_0x3112('0x43')]);_0x391022[_0x3112('0x47')]=_[_0x3112('0x48')](_0x972d34['query']);_0x391022[_0x3112('0x49')]=_[_0x3112('0x4a')](_0x391022[_0x3112('0x46')],_0x391022[_0x3112('0x47')]);_0x2e4053['attributes']=_[_0x3112('0x4a')](_0x391022[_0x3112('0x46')],qs[_0x3112('0x4c')](_0x972d34[_0x3112('0x47')][_0x3112('0x4c')]));_0x2e4053['attributes']=_0x2e4053['attributes'][_0x3112('0x4d')]?_0x2e4053[_0x3112('0x4b')]:_0x391022['model'];if(_0x972d34[_0x3112('0x47')]['includeAll']){_0x2e4053['include']=[{'all':!![]}];}_0x2e4053=_[_0x3112('0x53')]({},_0x2e4053,_0x972d34['options']);return db[_0x3112('0x42')][_0x3112('0x5c')](_0x2e4053)[_0x3112('0x25')](handleEntityNotFound(_0x208930,null))[_0x3112('0x25')](respondWithResult(_0x208930,null))[_0x3112('0x2f')](handleError(_0x208930,null));};exports['create']=function(_0x81bf7c,_0x1fd003){return db[_0x3112('0x42')][_0x3112('0x5d')](_0x81bf7c[_0x3112('0x5e')],{})[_0x3112('0x25')](function(_0x20d751){var _0x3a2616=_0x81bf7c['user'][_0x3112('0x5f')]({'plain':!![]});if(!_0x3a2616)throw new Error(_0x3112('0x60'));if(_0x3a2616[_0x3112('0x61')]===_0x3112('0x62')){var _0x26063c=_0x20d751[_0x3112('0x5f')]({'plain':!![]});var _0x57e685=_0x3112('0x38');return db[_0x3112('0x63')][_0x3112('0x5c')]({'where':{'name':_0x57e685,'userProfileId':_0x3a2616['userProfileId']},'raw':!![]})[_0x3112('0x25')](function(_0x2d885d){if(_0x2d885d&&_0x2d885d[_0x3112('0x64')]===0x0){return db[_0x3112('0x39')][_0x3112('0x5d')]({'name':_0x26063c[_0x3112('0x3d')],'resourceId':_0x26063c['id'],'type':_0x2d885d[_0x3112('0x3d')],'sectionId':_0x2d885d['id']},{})[_0x3112('0x25')](function(){return _0x20d751;});}else{return _0x20d751;}})[_0x3112('0x2f')](function(_0xb86a4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb86a4);throw _0xb86a4;});}return _0x20d751;})['then'](respondWithResult(_0x1fd003,0xc9))[_0x3112('0x2f')](handleError(_0x1fd003,null));};exports[_0x3112('0x37')]=function(_0x14606c,_0x25bd82){if(_0x14606c[_0x3112('0x5e')]['id']){delete _0x14606c['body']['id'];}return db['WhatsappAccount'][_0x3112('0x5c')]({'where':{'id':_0x14606c[_0x3112('0x5a')]['id']},'include':[{'model':db[_0x3112('0x40')],'as':_0x3112('0x5b')}]})[_0x3112('0x25')](handleEntityNotFound(_0x25bd82,null))[_0x3112('0x25')](saveUpdates(_0x14606c[_0x3112('0x5e')],null))[_0x3112('0x25')](respondWithResult(_0x25bd82,null))[_0x3112('0x2f')](handleError(_0x25bd82,null));};exports[_0x3112('0x3a')]=function(_0x230665,_0x59f27a){return db[_0x3112('0x42')][_0x3112('0x5c')]({'where':{'id':_0x230665[_0x3112('0x5a')]['id']}})[_0x3112('0x25')](handleEntityNotFound(_0x59f27a,null))[_0x3112('0x25')](removeEntity(_0x59f27a,null))['catch'](handleError(_0x59f27a,null));};exports[_0x3112('0x65')]=function(_0x2b54d4,_0x431b0f){return db[_0x3112('0x42')][_0x3112('0x65')]()[_0x3112('0x25')](respondWithResult(_0x431b0f,null))[_0x3112('0x2f')](handleError(_0x431b0f,null));};exports['addDisposition']=function(_0x2a9330,_0x1d36ad,_0x46e8e2){if(_0x2a9330[_0x3112('0x5e')]['id']){delete _0x2a9330[_0x3112('0x5e')]['id'];}return db[_0x3112('0x42')]['find']({'where':{'id':_0x2a9330['params']['id']}})[_0x3112('0x25')](handleEntityNotFound(_0x1d36ad,null))[_0x3112('0x25')](function(_0x1f620e){if(_0x1f620e){_0x2a9330[_0x3112('0x5e')]['WhatsappAccountId']=_0x1f620e['id'];return db[_0x3112('0x66')]['create'](_0x2a9330[_0x3112('0x5e')]);}})[_0x3112('0x25')](respondWithResult(_0x1d36ad,null))['catch'](handleError(_0x1d36ad,null));};exports['getDispositions']=function(_0x31d05c,_0x443dd8,_0x2df7f1){var _0x5d93dd={'raw':![],'where':{}};var _0x5c678c={};var _0x2cf040={'count':0x0,'rows':[]};return db[_0x3112('0x42')][_0x3112('0x67')]({'where':{'id':_0x31d05c[_0x3112('0x5a')]['id']}})[_0x3112('0x25')](handleEntityNotFound(_0x443dd8,null))[_0x3112('0x25')](function(_0x5c1571){if(_0x5c1571){_0x5c678c[_0x3112('0x46')]=_[_0x3112('0x48')](db['Disposition'][_0x3112('0x43')]);_0x5c678c[_0x3112('0x47')]=_[_0x3112('0x48')](_0x31d05c[_0x3112('0x47')]);_0x5c678c[_0x3112('0x49')]=_[_0x3112('0x4a')](_0x5c678c[_0x3112('0x46')],_0x5c678c['query']);_0x5d93dd['attributes']=_[_0x3112('0x4a')](_0x5c678c[_0x3112('0x46')],qs[_0x3112('0x4c')](_0x31d05c[_0x3112('0x47')][_0x3112('0x4c')]));_0x5d93dd[_0x3112('0x4b')]=_0x5d93dd[_0x3112('0x4b')][_0x3112('0x4d')]?_0x5d93dd[_0x3112('0x4b')]:_0x5c678c[_0x3112('0x46')];if(!_0x31d05c['query'][_0x3112('0x4e')](_0x3112('0x4f'))){_0x5d93dd[_0x3112('0x32')]=qs[_0x3112('0x32')](_0x31d05c['query'][_0x3112('0x32')]);_0x5d93dd['offset']=qs[_0x3112('0x33')](_0x31d05c[_0x3112('0x47')][_0x3112('0x33')]);}_0x5d93dd[_0x3112('0x68')]=qs[_0x3112('0x50')](_0x31d05c[_0x3112('0x47')][_0x3112('0x50')]);_0x5d93dd[_0x3112('0x51')]=qs[_0x3112('0x49')](_[_0x3112('0x52')](_0x31d05c[_0x3112('0x47')],_0x5c678c['filters']));_0x5d93dd[_0x3112('0x51')][_0x3112('0x69')]=_0x5c1571['id'];if(_0x31d05c['query'][_0x3112('0x6a')]){_0x5d93dd[_0x3112('0x51')]=_[_0x3112('0x53')](_0x5d93dd[_0x3112('0x51')],{'$or':_[_0x3112('0x41')](_0x5d93dd['attributes'],function(_0x191708){var _0x303b48={};_0x303b48[_0x191708]={'$like':'%'+_0x31d05c[_0x3112('0x47')][_0x3112('0x6a')]+'%'};return _0x303b48;})});}_0x5d93dd=_[_0x3112('0x53')]({},_0x5d93dd,_0x31d05c[_0x3112('0x54')]);return db['Disposition']['count']({'where':_0x5d93dd[_0x3112('0x51')]})[_0x3112('0x25')](function(_0x1551cc){_0x2cf040[_0x3112('0x55')]=_0x1551cc;if(_0x31d05c[_0x3112('0x47')][_0x3112('0x56')]){_0x5d93dd[_0x3112('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x3112('0x58')](_0x5d93dd);})[_0x3112('0x25')](function(_0x2ae4dc){_0x2cf040[_0x3112('0x6b')]=_0x2ae4dc;return _0x2cf040;});}})['then'](respondWithFilteredResult(_0x443dd8,_0x5d93dd))[_0x3112('0x2f')](handleError(_0x443dd8,null));};exports[_0x3112('0x6c')]=function(_0x40cb50,_0x35b8ff,_0x3e4596){return db[_0x3112('0x42')][_0x3112('0x5c')]({'where':{'id':_0x40cb50['params']['id']}})[_0x3112('0x25')](handleEntityNotFound(_0x35b8ff,null))[_0x3112('0x25')](function(_0x19a26e){if(_0x19a26e){return _0x19a26e['removeDispositions'](_0x40cb50[_0x3112('0x47')][_0x3112('0x6d')]);}})[_0x3112('0x25')](respondWithStatusCode(_0x35b8ff,null))[_0x3112('0x2f')](handleError(_0x35b8ff,null));};exports[_0x3112('0x6e')]=function(_0x5aee5e,_0x5ce6e6,_0x4b8017){if(_0x5aee5e['body']['id']){delete _0x5aee5e['body']['id'];}return db[_0x3112('0x42')][_0x3112('0x5c')]({'where':{'id':_0x5aee5e[_0x3112('0x5a')]['id']}})[_0x3112('0x25')](handleEntityNotFound(_0x5ce6e6,null))['then'](function(_0x1c8619){if(_0x1c8619){_0x5aee5e[_0x3112('0x5e')]['WhatsappAccountId']=_0x1c8619['id'];return db[_0x3112('0x6f')][_0x3112('0x5d')](_0x5aee5e[_0x3112('0x5e')]);}})[_0x3112('0x25')](respondWithResult(_0x5ce6e6,null))[_0x3112('0x2f')](handleError(_0x5ce6e6,null));};exports['getAnswers']=function(_0xca44e7,_0x6e928b,_0x1dca9e){var _0x27a614={'raw':![],'where':{}};var _0x1dda66={};var _0x1502e7={'count':0x0,'rows':[]};return db[_0x3112('0x42')][_0x3112('0x67')]({'where':{'id':_0xca44e7[_0x3112('0x5a')]['id']}})[_0x3112('0x25')](handleEntityNotFound(_0x6e928b,null))['then'](function(_0x57cdba){if(_0x57cdba){_0x1dda66['model']=_[_0x3112('0x48')](db[_0x3112('0x6f')][_0x3112('0x43')]);_0x1dda66['query']=_[_0x3112('0x48')](_0xca44e7[_0x3112('0x47')]);_0x1dda66[_0x3112('0x49')]=_['intersection'](_0x1dda66[_0x3112('0x46')],_0x1dda66['query']);_0x27a614[_0x3112('0x4b')]=_[_0x3112('0x4a')](_0x1dda66[_0x3112('0x46')],qs[_0x3112('0x4c')](_0xca44e7[_0x3112('0x47')][_0x3112('0x4c')]));_0x27a614[_0x3112('0x4b')]=_0x27a614[_0x3112('0x4b')]['length']?_0x27a614[_0x3112('0x4b')]:_0x1dda66[_0x3112('0x46')];if(!_0xca44e7[_0x3112('0x47')][_0x3112('0x4e')](_0x3112('0x4f'))){_0x27a614[_0x3112('0x32')]=qs[_0x3112('0x32')](_0xca44e7[_0x3112('0x47')]['limit']);_0x27a614[_0x3112('0x33')]=qs[_0x3112('0x33')](_0xca44e7[_0x3112('0x47')][_0x3112('0x33')]);}_0x27a614[_0x3112('0x68')]=qs['sort'](_0xca44e7['query']['sort']);_0x27a614[_0x3112('0x51')]=qs['filters'](_[_0x3112('0x52')](_0xca44e7['query'],_0x1dda66[_0x3112('0x49')]));_0x27a614[_0x3112('0x51')][_0x3112('0x69')]=_0x57cdba['id'];if(_0xca44e7[_0x3112('0x47')][_0x3112('0x6a')]){_0x27a614[_0x3112('0x51')]=_[_0x3112('0x53')](_0x27a614[_0x3112('0x51')],{'$or':_[_0x3112('0x41')](_0x27a614[_0x3112('0x4b')],function(_0x320ea1){var _0x4786f6={};_0x4786f6[_0x320ea1]={'$like':'%'+_0xca44e7['query'][_0x3112('0x6a')]+'%'};return _0x4786f6;})});}_0x27a614=_[_0x3112('0x53')]({},_0x27a614,_0xca44e7[_0x3112('0x54')]);return db[_0x3112('0x6f')][_0x3112('0x55')]({'where':_0x27a614[_0x3112('0x51')]})[_0x3112('0x25')](function(_0x268a75){_0x1502e7['count']=_0x268a75;if(_0xca44e7[_0x3112('0x47')][_0x3112('0x56')]){_0x27a614[_0x3112('0x57')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x27a614);})[_0x3112('0x25')](function(_0x453403){_0x1502e7['rows']=_0x453403;return _0x1502e7;});}})[_0x3112('0x25')](respondWithFilteredResult(_0x6e928b,_0x27a614))[_0x3112('0x2f')](handleError(_0x6e928b,null));};exports[_0x3112('0x70')]=function(_0x294efc,_0x369257,_0x46f648){return db[_0x3112('0x42')][_0x3112('0x5c')]({'where':{'id':_0x294efc[_0x3112('0x5a')]['id']}})['then'](handleEntityNotFound(_0x369257,null))['then'](function(_0xc0a748){if(_0xc0a748){return _0xc0a748[_0x3112('0x70')](_0x294efc[_0x3112('0x47')][_0x3112('0x6d')]);}})[_0x3112('0x25')](respondWithStatusCode(_0x369257,null))[_0x3112('0x2f')](handleError(_0x369257,null));};exports[_0x3112('0x71')]=function(_0x58f25c,_0x44fe21,_0x5ba2f6){return db['WhatsappAccount'][_0x3112('0x5c')]({'where':{'id':_0x58f25c[_0x3112('0x5a')]['id']}})[_0x3112('0x25')](handleEntityNotFound(_0x44fe21,null))[_0x3112('0x25')](function(_0x43e3b8){if(_0x43e3b8){return _0x43e3b8[_0x3112('0x71')](_0x58f25c[_0x3112('0x5e')][_0x3112('0x6d')],_[_0x3112('0x72')](_0x58f25c[_0x3112('0x5e')],['ids','id'])||{})[_0x3112('0x73')](function(_0x594579){for(var _0x3b6a24=0x0;_0x3b6a24<_0x58f25c[_0x3112('0x5e')][_0x3112('0x6d')][_0x3112('0x4d')];_0x3b6a24+=0x1){socket[_0x3112('0x74')](_0x3112('0x75'),{'UserId':Number(_0x58f25c['body']['ids'][_0x3b6a24]),'WhatsappAccountId':Number(_0x58f25c[_0x3112('0x5a')]['id'])});}return _0x594579;});}})[_0x3112('0x25')](respondWithResult(_0x44fe21,null))[_0x3112('0x2f')](handleError(_0x44fe21,null));};exports[_0x3112('0x76')]=function(_0x290be3,_0x14fe3d,_0x5ac14a){return db[_0x3112('0x42')][_0x3112('0x5c')]({'where':{'id':_0x290be3[_0x3112('0x5a')]['id']}})[_0x3112('0x25')](handleEntityNotFound(_0x14fe3d,null))['then'](function(_0x4f278a){if(_0x4f278a){return _0x4f278a[_0x3112('0x76')](_0x290be3[_0x3112('0x47')][_0x3112('0x6d')])[_0x3112('0x25')](function(){if(_[_0x3112('0x77')](_0x290be3[_0x3112('0x47')][_0x3112('0x6d')])){for(var _0x279c56=0x0;_0x279c56<_0x290be3[_0x3112('0x47')]['ids'][_0x3112('0x4d')];_0x279c56+=0x1){socket[_0x3112('0x74')](_0x3112('0x78'),{'UserId':Number(_0x290be3[_0x3112('0x47')][_0x3112('0x6d')][_0x279c56]),'WhatsappAccountId':Number(_0x290be3['params']['id'])});}}else{socket['emit'](_0x3112('0x78'),{'UserId':Number(_0x290be3[_0x3112('0x47')]['ids']),'WhatsappAccountId':Number(_0x290be3[_0x3112('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x14fe3d,null))[_0x3112('0x2f')](handleError(_0x14fe3d,null));};exports['getAgents']=function(_0x2b6669,_0x306d71,_0xd173eb){var _0x2afa8e={};var _0x3e081e={};var _0x9366e4;var _0x106e7a;return db[_0x3112('0x42')][_0x3112('0x67')]({'where':{'id':_0x2b6669[_0x3112('0x5a')]['id']}})['then'](handleEntityNotFound(_0x306d71,null))['then'](function(_0x5451c4){if(_0x5451c4){_0x9366e4=_0x5451c4;_0x3e081e[_0x3112('0x46')]=_[_0x3112('0x48')](db[_0x3112('0x79')][_0x3112('0x43')]);_0x3e081e[_0x3112('0x47')]=_['keys'](_0x2b6669[_0x3112('0x47')]);_0x3e081e[_0x3112('0x49')]=_['intersection'](_0x3e081e[_0x3112('0x46')],_0x3e081e['query']);_0x2afa8e[_0x3112('0x4b')]=_[_0x3112('0x4a')](_0x3e081e['model'],qs['fields'](_0x2b6669[_0x3112('0x47')][_0x3112('0x4c')]));_0x2afa8e[_0x3112('0x4b')]=_0x2afa8e[_0x3112('0x4b')][_0x3112('0x4d')]?_0x2afa8e[_0x3112('0x4b')]:_0x3e081e[_0x3112('0x46')];_0x2afa8e[_0x3112('0x68')]=qs[_0x3112('0x50')](_0x2b6669[_0x3112('0x47')][_0x3112('0x50')]);_0x2afa8e[_0x3112('0x51')]=qs['filters'](_[_0x3112('0x52')](_0x2b6669['query'],_0x3e081e[_0x3112('0x49')]));if(_0x2b6669[_0x3112('0x47')][_0x3112('0x6a')]){_0x2afa8e[_0x3112('0x51')]=_[_0x3112('0x53')](_0x2afa8e[_0x3112('0x51')],{'$or':_[_0x3112('0x41')](_0x2afa8e[_0x3112('0x4b')],function(_0x5f2c6a){var _0x5c0329={};_0x5c0329[_0x5f2c6a]={'$like':'%'+_0x2b6669[_0x3112('0x47')][_0x3112('0x6a')]+'%'};return _0x5c0329;})});}_0x2afa8e=_[_0x3112('0x53')]({},_0x2afa8e,_0x2b6669['options']);return _0x9366e4[_0x3112('0x7a')](_0x2afa8e);}})['then'](function(_0x2226a6){if(_0x2226a6){_0x106e7a=_0x2226a6[_0x3112('0x4d')];if(!_0x2b6669[_0x3112('0x47')][_0x3112('0x4e')]('nolimit')){_0x2afa8e[_0x3112('0x32')]=qs[_0x3112('0x32')](_0x2b6669['query'][_0x3112('0x32')]);_0x2afa8e[_0x3112('0x33')]=qs[_0x3112('0x33')](_0x2b6669[_0x3112('0x47')][_0x3112('0x33')]);}return _0x9366e4[_0x3112('0x7a')](_0x2afa8e);}})['then'](function(_0x3b25e9){if(_0x3b25e9){return _0x3b25e9?{'count':_0x106e7a,'rows':_0x3b25e9}:null;}})['then'](respondWithResult(_0x306d71,null))['catch'](handleError(_0x306d71,null));};exports[_0x3112('0x7b')]=function(_0x25c5d3,_0x1e16b8,_0x36b7bf){return db[_0x3112('0x42')][_0x3112('0x67')]({'where':{'id':_0x25c5d3[_0x3112('0x5a')]['id']}})[_0x3112('0x25')](handleEntityNotFound(_0x1e16b8,null))['then'](function(_0x2f5447){if(_0x2f5447){return db[_0x3112('0x7c')][_0x3112('0x7d')](function(_0x46a3cb){return db[_0x3112('0x7e')][_0x3112('0x3a')]({'where':{'WhatsappAccountId':_0x25c5d3[_0x3112('0x5a')]['id']},'transaction':_0x46a3cb})[_0x3112('0x25')](function(_0x176c00){var _0x265aac=_['map'](_0x25c5d3['body'],function(_0x505937){_0x505937['WhatsappAccountId']=_0x25c5d3[_0x3112('0x5a')]['id'];return _0x505937;});return db['WhatsappApplication'][_0x3112('0x7f')](_0x265aac,{'transaction':_0x46a3cb});});})['then'](function(){return db[_0x3112('0x7e')][_0x3112('0x80')]({'where':{'WhatsappAccountId':_0x25c5d3['params']['id']},'order':_0x3112('0x81')});});}})['then'](respondWithResult(_0x1e16b8,null))[_0x3112('0x2f')](handleError(_0x1e16b8,null));};exports[_0x3112('0x82')]=function(_0x279656,_0x1c6d5a,_0x48c573){var _0x20662d={};var _0x21785c={};var _0xa42bf3;var _0x43cd9a;return db[_0x3112('0x42')][_0x3112('0x67')]({'where':{'id':_0x279656[_0x3112('0x5a')]['id']}})[_0x3112('0x25')](handleEntityNotFound(_0x1c6d5a,null))[_0x3112('0x25')](function(_0x1ff03d){if(_0x1ff03d){_0xa42bf3=_0x1ff03d;_0x21785c[_0x3112('0x46')]=_[_0x3112('0x48')](db[_0x3112('0x7e')][_0x3112('0x43')]);_0x21785c[_0x3112('0x47')]=_[_0x3112('0x48')](_0x279656[_0x3112('0x47')]);_0x21785c[_0x3112('0x49')]=_['intersection'](_0x21785c[_0x3112('0x46')],_0x21785c[_0x3112('0x47')]);_0x20662d[_0x3112('0x4b')]=_[_0x3112('0x4a')](_0x21785c['model'],qs[_0x3112('0x4c')](_0x279656[_0x3112('0x47')][_0x3112('0x4c')]));_0x20662d['attributes']=_0x20662d['attributes'][_0x3112('0x4d')]?_0x20662d[_0x3112('0x4b')]:_0x21785c['model'];_0x20662d[_0x3112('0x68')]=qs[_0x3112('0x50')](_0x279656['query'][_0x3112('0x50')]);_0x20662d[_0x3112('0x51')]=qs['filters'](_[_0x3112('0x52')](_0x279656[_0x3112('0x47')],_0x21785c[_0x3112('0x49')]));if(_0x279656[_0x3112('0x47')][_0x3112('0x6a')]){_0x20662d[_0x3112('0x51')]=_[_0x3112('0x53')](_0x20662d[_0x3112('0x51')],{'$or':_[_0x3112('0x41')](_0x20662d[_0x3112('0x4b')],function(_0x27c357){var _0x1fe82f={};_0x1fe82f[_0x27c357]={'$like':'%'+_0x279656['query'][_0x3112('0x6a')]+'%'};return _0x1fe82f;})});}_0x20662d=_[_0x3112('0x53')]({},_0x20662d,_0x279656[_0x3112('0x54')]);return _0xa42bf3[_0x3112('0x82')](_0x20662d);}})['then'](function(_0x3ca850){if(_0x3ca850){_0x43cd9a=_0x3ca850['length'];if(!_0x279656['query'][_0x3112('0x4e')](_0x3112('0x4f'))){_0x20662d[_0x3112('0x32')]=qs['limit'](_0x279656[_0x3112('0x47')][_0x3112('0x32')]);_0x20662d['offset']=qs['offset'](_0x279656[_0x3112('0x47')][_0x3112('0x33')]);}return _0xa42bf3[_0x3112('0x82')](_0x20662d);}})[_0x3112('0x25')](function(_0x5fa066){if(_0x5fa066){return _0x5fa066?{'count':_0x43cd9a,'rows':_0x5fa066}:null;}})[_0x3112('0x25')](respondWithResult(_0x1c6d5a,null))[_0x3112('0x2f')](handleError(_0x1c6d5a,null));};exports['notify']=function(_0x4b9e86,_0x21f14b,_0x2ed5d2){var _0x36c62d={'channel':'whatsapp'};var _0x4a5f5a=[];var _0x5d4e86=[];var _0x1c8718={};return db[_0x3112('0x42')][_0x3112('0x5c')]({'where':{'id':_0x4b9e86[_0x3112('0x5a')]['id']},'include':[{'model':db[_0x3112('0x7e')],'as':'Applications'}]})[_0x3112('0x25')](handleEntityNotFound(_0x21f14b,null))['then'](function(_0x5d8efb){_0x36c62d[_0x3112('0x83')]=_0x5d8efb;_0x36c62d['applications']=_['orderBy'](_0x5d8efb['Applications'],[_0x3112('0x81')],[_0x3112('0x84')]);if(_0x36c62d[_0x3112('0x83')][_0x3112('0x85')]){delete _0x36c62d[_0x3112('0x83')][_0x3112('0x85')];}return db[_0x3112('0x86')][_0x3112('0x65')]();})[_0x3112('0x25')](function(_0x4deeb4){if(!_0x4deeb4){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x4a5f5a=_[_0x3112('0x87')](_[_0x3112('0x48')](_0x4deeb4),[_0x3112('0x88'),'updatedAt']);_0x5d4e86=_[_0x3112('0x87')](_[_0x3112('0x48')](_0x4deeb4),[_0x3112('0x88'),_0x3112('0x89'),'CompanyId','ListId']);_0x36c62d['body']={'mapKey':_0x3112('0x8a')};if(_0x36c62d[_0x3112('0x83')][_0x3112('0x44')]&&_0x36c62d['account'][_0x3112('0x44')]===_0x3112('0x8b')){_0x36c62d[_0x3112('0x5e')][_0x3112('0x8c')]=_0x4b9e86[_0x3112('0x5e')][_0x3112('0x8d')][_0x3112('0x8e')](_0x3112('0x8f'),'');_0x36c62d[_0x3112('0x5e')]['body']=_0x4b9e86[_0x3112('0x5e')][_0x3112('0x90')];_0x36c62d[_0x3112('0x5e')]['messageId']=_0x4b9e86[_0x3112('0x5e')][_0x3112('0x91')];}if(_0x36c62d[_0x3112('0x5e')]['id']){delete _0x36c62d[_0x3112('0x5e')]['id'];}if(_[_0x3112('0x92')](_0x36c62d['body'][_0x3112('0x8c')])){throw new db[(_0x3112('0x93'))][(_0x3112('0x94'))](_0x3112('0x95'));}if(_[_0x3112('0x92')](_0x36c62d['body']['body'])||_0x36c62d[_0x3112('0x5e')][_0x3112('0x5e')]===''){throw new db[(_0x3112('0x93'))][(_0x3112('0x94'))](_0x3112('0x96'));}if(_[_0x3112('0x92')](_0x36c62d[_0x3112('0x5e')][_0x3112('0x97')])){throw new db[(_0x3112('0x93'))][(_0x3112('0x94'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5d4e86);}if(!_['includes'](_0x5d4e86,_0x36c62d[_0x3112('0x5e')][_0x3112('0x97')])){throw new db[(_0x3112('0x93'))][(_0x3112('0x94'))](_0x3112('0x98')+_0x5d4e86);}_0x1c8718[_0x36c62d[_0x3112('0x5e')][_0x3112('0x97')]]=_0x36c62d[_0x3112('0x5e')][_0x3112('0x8c')];return db[_0x3112('0x99')][_0x3112('0x5c')]({'where':{'id':_0x36c62d[_0x3112('0x83')][_0x3112('0x9a')]},'include':[{'model':db[_0x3112('0x86')],'as':_0x3112('0x9b'),'where':_0x1c8718,'limit':0x1,'order':[[_0x3112('0x89'),_0x3112('0x9c')]]}]});})[_0x3112('0x25')](handleEntityNotFound(_0x21f14b,null))['then'](function(_0x4eb53e){if(_0x4eb53e){_0x36c62d[_0x3112('0x9d')]=_[_0x3112('0x72')](_0x4eb53e,[_0x3112('0x9b')]);if(_0x4eb53e[_0x3112('0x9b')]['length']){return _0x4eb53e[_0x3112('0x9b')][0x0];}var _0x265da1=_[_0x3112('0x1c')](_0x36c62d[_0x3112('0x5e')],{'firstName':_0x36c62d['body'][_0x3112('0x8c')],'ListId':_0x4eb53e['id']});_0x265da1[_0x36c62d[_0x3112('0x5e')]['mapKey']]=_0x36c62d['body'][_0x3112('0x8c')];return db['CmContact'][_0x3112('0x5d')](_0x265da1,{'fields':_0x4a5f5a,'raw':!![]});}})[_0x3112('0x25')](handleEntityNotFound(_0x21f14b,null))['then'](function(_0x3710ba){if(_0x3710ba){_0x36c62d[_0x3112('0x9e')]=_0x3710ba;var _0x54d38e={'ContactId':_0x3710ba['id'],'phone':_0x36c62d[_0x3112('0x5e')][_0x3112('0x8c')],'WhatsappAccountId':_0x4b9e86[_0x3112('0x5a')]['id']};var _0x45d251={'ContactId':_0x3710ba['id'],'WhatsappAccountId':_0x4b9e86[_0x3112('0x5a')]['id'],'closed':![]};return db[_0x3112('0x9f')]['find']({'where':_0x45d251})['then'](function(_0x36f35c){if(_0x36f35c){return[_0x36f35c,![]];}return db[_0x3112('0x9f')]['create'](_0x54d38e)[_0x3112('0x25')](function(_0x25cac0){return[_0x25cac0,!![]];});});}})['spread'](function(_0x505ac4,_0x17bbcf){_0x36c62d['interaction']=_0x505ac4[_0x3112('0x5f')]({'plain':!![]});_0x36c62d[_0x3112('0xa0')][_0x3112('0xa1')]=![];if(_0x17bbcf){if(_0x36c62d['account'][_0x3112('0xa2')]){_0x36c62d[_0x3112('0xa3')]['push']({'id':0x0,'priority':_0x36c62d[_0x3112('0xa3')][_0x3112('0x4d')]+0x1,'app':_0x3112('0xa4'),'appdata':'unmanaged','interval':_0x3112('0xa5')});}_0x36c62d[_0x3112('0xa0')][_0x3112('0xa1')]=!![];}return db[_0x3112('0xa6')][_0x3112('0x5d')]({'phone':_0x36c62d[_0x3112('0x5e')][_0x3112('0x8c')],'messageId':_0x36c62d[_0x3112('0x5e')][_0x3112('0xa7')],'body':_0x36c62d[_0x3112('0x5e')][_0x3112('0x5e')],'WhatsappAccountId':_0x4b9e86[_0x3112('0x5a')]['id'],'WhatsappInteractionId':_0x505ac4['id'],'direction':'in','ContactId':_0x505ac4[_0x3112('0xa8')],'AttachmentId':_0x36c62d[_0x3112('0x5e')][_0x3112('0xa9')]});})[_0x3112('0x25')](function(_0xca58fb){_0x36c62d[_0x3112('0x2d')]=_0xca58fb;if(_0x36c62d[_0x3112('0xa0')][_0x3112('0xaa')]){return db['User'][_0x3112('0x5c')]({'attributes':['id',_0x3112('0x3d')],'where':{'id':_0x36c62d[_0x3112('0xa0')][_0x3112('0xaa')]}})[_0x3112('0x25')](function(_0x25fafd){if(_0x25fafd){_0x36c62d[_0x3112('0xa3')][_0x3112('0xab')]({'id':0x0,'priority':0x0,'app':_0x3112('0xac'),'appdata':_0x25fafd[_0x3112('0x3d')]+','+(_0x36c62d[_0x3112('0x83')]['waitForTheAssignedAgent']||0xa),'interval':_0x3112('0xa5')});}return respondWithRpcPromise('Start',_0x3112('0xad'),_0x36c62d);});}return respondWithRpcPromise(_0x3112('0xae'),_0x3112('0xad'),_0x36c62d);})[_0x3112('0x25')](function(_0x31ffaf){if(_0x31ffaf){var _0x19d7e7=0xc8;var _0x3501e8=_0x3112('0xaf');logger[_0x3112('0x26')](_0x3112('0xb0'),_0x3501e8,_0x19d7e7,_0x3112('0xb1'));logger[_0x3112('0x28')](_0x3112('0xb2'),_0x3501e8,_0x19d7e7,_0x3112('0xb1'),JSON[_0x3112('0x2a')](_0x31ffaf));if(_0x36c62d[_0x3112('0x83')][_0x3112('0x44')]===_0x3112('0x8b')){return _0x21f14b[_0x3112('0x31')](_0x19d7e7)[_0x3112('0xb3')](_0x3112('0xb4'),_0x3112('0xb5'))[_0x3112('0x3e')]('\x0a');}else{return _0x21f14b['status'](_0x19d7e7)[_0x3112('0x34')](_0x31ffaf);}}})[_0x3112('0x2f')](handleError(_0x21f14b,null));};exports[_0x3112('0x3e')]=function(_0x45f24d,_0x5cf236,_0x1d068d){var _0x429d5a,_0xd0bc9c,_0x2eeccd;if(_[_0x3112('0x92')](_0x45f24d[_0x3112('0x5e')][_0x3112('0x5e')])||_0x45f24d[_0x3112('0x5e')]['body']===''){throw new db[(_0x3112('0x93'))][(_0x3112('0x94'))](_0x3112('0x96'));}if(_[_0x3112('0x92')](_0x45f24d[_0x3112('0x5e')]['to'])){throw new db['Sequelize'][(_0x3112('0x94'))]('to\x20is\x20mandatory');}_0x429d5a=_0x45f24d[_0x3112('0x5e')]['to'];return db[_0x3112('0x42')][_0x3112('0x5c')]({'where':{'id':_0x45f24d['params']['id']},'include':[{'model':db[_0x3112('0x99')],'as':_0x3112('0xb6'),'include':[{'model':db[_0x3112('0x86')],'as':_0x3112('0x9b'),'where':{'mobile':_0x429d5a},'limit':0x1,'order':[[_0x3112('0x89'),_0x3112('0x9c')]]}]}]})[_0x3112('0x25')](handleEntityNotFound(_0x5cf236,null))['then'](function(_0x358ce1){if(_0x358ce1&&_0x358ce1['List']){_0xd0bc9c=_0x358ce1['get']({'plain':!![]});if(_0xd0bc9c[_0x3112('0xb6')]&&_0xd0bc9c['List'][_0x3112('0x9b')]['length']){return _0xd0bc9c[_0x3112('0xb6')][_0x3112('0x9b')][0x0];}return db[_0x3112('0x86')]['create'](_[_0x3112('0x1c')](_0x45f24d[_0x3112('0x5e')],{'firstName':_0x429d5a,'mobile':_0x429d5a,'phone':_0x429d5a,'ListId':_0xd0bc9c['ListId']}));}})['then'](handleEntityNotFound(_0x5cf236,null))[_0x3112('0x25')](function(_0x3220c4){if(_0x3220c4){_0x2eeccd=_0x3220c4;return db['WhatsappInteraction'][_0x3112('0x5c')]({'where':{'ContactId':_0x2eeccd['id'],'closed':![],'WhatsappAccountId':_0xd0bc9c['id']}})[_0x3112('0x25')](function(_0xbf4589){if(_0xbf4589){return[_0xbf4589,![]];}return db[_0x3112('0x9f')][_0x3112('0x5d')]({'UserId':_0x45f24d['user']['id'],'ContactId':_0x2eeccd['id'],'WhatsappAccountId':_0xd0bc9c['id'],'phone':_0x429d5a,'firstMsgDirection':_0x3112('0xb7'),'Messages':[_[_0x3112('0x53')](_0x45f24d[_0x3112('0x5e')],{'read':![],'body':_0x45f24d[_0x3112('0x5e')]['body'],'phone':_0x429d5a,'WhatsappAccountId':_0xd0bc9c['id'],'UserId':_0x45f24d[_0x3112('0x62')]['id'],'ContactId':_0x2eeccd['id']})]},{'include':[{'model':db[_0x3112('0xa6')],'as':_0x3112('0xb8')}]})[_0x3112('0x25')](function(_0x749232){return[_0x749232,!![]];});});}})[_0x3112('0x73')](function(_0x1cdd6f,_0x266cae){if(_0x266cae){return _0x1cdd6f;}return db[_0x3112('0xa6')]['create'](_[_0x3112('0x53')](_0x45f24d['body'],{'read':![],'body':_0x45f24d[_0x3112('0x5e')][_0x3112('0x5e')],'phone':_0x429d5a,'WhatsappAccountId':_0xd0bc9c['id'],'WhatsappInteractionId':_0x1cdd6f['id'],'UserId':_0x45f24d['user']['id'],'ContactId':_0x2eeccd['id']}))['then'](function(_0x437f32){_0x1cdd6f['dataValues'][_0x3112('0xb8')]=[];_0x1cdd6f['dataValues'][_0x3112('0xb8')][_0x3112('0xb9')](_0x437f32[_0x3112('0xba')]);return _0x1cdd6f;});})[_0x3112('0x25')](respondWithResult(_0x5cf236,null))[_0x3112('0x2f')](handleError(_0x5cf236,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 766b41b..42efdc8 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 _0xf863=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x3534c1,_0x340e63){var _0x28d9a7=function(_0x555343){while(--_0x555343){_0x3534c1['push'](_0x3534c1['shift']());}};_0x28d9a7(++_0x340e63);}(_0xf863,0x9d));var _0x3f86=function(_0x28a9a7,_0x50c927){_0x28a9a7=_0x28a9a7-0x0;var _0x5f2481=_0xf863[_0x28a9a7];return _0x5f2481;};'use strict';var EventEmitter=require(_0x3f86('0x0'));var WhatsappAccount=require(_0x3f86('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x3f86('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3f86('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4dfb62){return function(_0xf581bb,_0x4da233,_0x30fd20){WhatsappAccountEvents['emit'](_0x4dfb62+':'+_0xf581bb['id'],_0xf581bb);WhatsappAccountEvents[_0x3f86('0x4')](_0x4dfb62,_0xf581bb);_0x30fd20(null);};}for(var e in events){if(events[_0x3f86('0x5')](e)){var event=events[e];WhatsappAccount[_0x3f86('0x6')](e,emitEvent(event));}}module[_0x3f86('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0x42a3=['hasOwnProperty','hook','exports','events','update','remove','emit'];(function(_0xd9abb2,_0x2449d1){var _0x3c9237=function(_0x40fde6){while(--_0x40fde6){_0xd9abb2['push'](_0xd9abb2['shift']());}};_0x3c9237(++_0x2449d1);}(_0x42a3,0x10d));var _0x342a=function(_0x2e22d5,_0x31af85){_0x2e22d5=_0x2e22d5-0x0;var _0x2962b7=_0x42a3[_0x2e22d5];return _0x2962b7;};'use strict';var EventEmitter=require(_0x342a('0x0'));var WhatsappAccount=require('../../mysqldb')['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x342a('0x1'),'afterDestroy':_0x342a('0x2')};function emitEvent(_0x5421ef){return function(_0x330d45,_0x23dd13,_0xe9fbee){WhatsappAccountEvents[_0x342a('0x3')](_0x5421ef+':'+_0x330d45['id'],_0x330d45);WhatsappAccountEvents[_0x342a('0x3')](_0x5421ef,_0x330d45);_0xe9fbee(null);};}for(var e in events){if(events[_0x342a('0x4')](e)){var event=events[e];WhatsappAccount[_0x342a('0x5')](e,emitEvent(event));}}module[_0x342a('0x6')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 48aec7d..3632d74 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 _0x720d=['../../config/logger','bluebird','request-promise','path','rimraf','WhatsappAccount','whatsapp_accounts','util'];(function(_0xb11a0b,_0x12c31b){var _0x308402=function(_0x25168f){while(--_0x25168f){_0xb11a0b['push'](_0xb11a0b['shift']());}};_0x308402(++_0x12c31b);}(_0x720d,0x1df));var _0xd720=function(_0x2f2466,_0x27e7d3){_0x2f2466=_0x2f2466-0x0;var _0x1fb1cd=_0x720d[_0x2f2466];return _0x1fb1cd;};'use strict';var _=require('lodash');var util=require(_0xd720('0x0'));var logger=require(_0xd720('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd720('0x2'));var rp=require(_0xd720('0x3'));var fs=require('fs');var path=require(_0xd720('0x4'));var rimraf=require(_0xd720('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module['exports']=function(_0x5c6c15,_0x507964){return _0x5c6c15['define'](_0xd720('0x6'),attributes,{'tableName':_0xd720('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf59=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','../../config/logger'];(function(_0x2fe6e6,_0x577d0a){var _0x494e96=function(_0x18e59a){while(--_0x18e59a){_0x2fe6e6['push'](_0x2fe6e6['shift']());}};_0x494e96(++_0x577d0a);}(_0xdf59,0x16a));var _0x9df5=function(_0x56cc16,_0x2b2607){_0x56cc16=_0x56cc16-0x0;var _0x31b48e=_0xdf59[_0x56cc16];return _0x31b48e;};'use strict';var _=require(_0x9df5('0x0'));var util=require('util');var logger=require(_0x9df5('0x1'))(_0x9df5('0x2'));var moment=require(_0x9df5('0x3'));var BPromise=require(_0x9df5('0x4'));var rp=require(_0x9df5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9df5('0x6'));var config=require(_0x9df5('0x7'));var attributes=require(_0x9df5('0x8'));module[_0x9df5('0x9')]=function(_0x2c2e0b,_0x7636c6){return _0x2c2e0b[_0x9df5('0xa')](_0x9df5('0xb'),attributes,{'tableName':_0x9df5('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 7e28050..513b2cb 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 _0x74ae=['WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','options','attributes','include','map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappAccount.socket','register','request','then','info'];(function(_0x29106c,_0x44029d){var _0x317ce9=function(_0x1822ce){while(--_0x1822ce){_0x29106c['push'](_0x29106c['shift']());}};_0x317ce9(++_0x44029d);}(_0x74ae,0x7c));var _0xe74a=function(_0x5d351c,_0x5ccac8){_0x5d351c=_0x5d351c-0x0;var _0x526cf1=_0x74ae[_0x5d351c];return _0x526cf1;};'use strict';var _=require('lodash');var util=require(_0xe74a('0x0'));var moment=require(_0xe74a('0x1'));var BPromise=require(_0xe74a('0x2'));var rs=require(_0xe74a('0x3'));var fs=require('fs');var Redis=require(_0xe74a('0x4'));var db=require(_0xe74a('0x5'))['db'];var utils=require(_0xe74a('0x6'));var logger=require(_0xe74a('0x7'))('rpc');var config=require(_0xe74a('0x8'));var jayson=require(_0xe74a('0x9'));var client=jayson[_0xe74a('0xa')][_0xe74a('0xb')]({'port':0x232a});config[_0xe74a('0xc')]=_[_0xe74a('0xd')](config[_0xe74a('0xc')],{'host':_0xe74a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe74a('0xc')]));require(_0xe74a('0xf'))[_0xe74a('0x10')](socket);function respondWithRpcPromise(_0x35298a,_0x21c12b,_0x3897cb){return new BPromise(function(_0x5e6e83,_0x136822){return client[_0xe74a('0x11')](_0x35298a,_0x3897cb)[_0xe74a('0x12')](function(_0x1a98ec){logger[_0xe74a('0x13')](_0xe74a('0x14'),_0x21c12b,_0xe74a('0x15'));logger[_0xe74a('0x16')](_0xe74a('0x17'),_0x21c12b,'request\x20sent',JSON[_0xe74a('0x18')](_0x1a98ec));if(_0x1a98ec[_0xe74a('0x19')]){if(_0x1a98ec[_0xe74a('0x19')][_0xe74a('0x1a')]===0x1f4){logger[_0xe74a('0x19')](_0xe74a('0x14'),_0x21c12b,_0x1a98ec['error'][_0xe74a('0x1b')]);return _0x136822(_0x1a98ec[_0xe74a('0x19')][_0xe74a('0x1b')]);}logger[_0xe74a('0x19')]('WhatsappAccount,\x20%s,\x20%s',_0x21c12b,_0x1a98ec[_0xe74a('0x19')][_0xe74a('0x1b')]);return _0x5e6e83(_0x1a98ec[_0xe74a('0x19')]['message']);}else{logger[_0xe74a('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x21c12b,_0xe74a('0x15'));_0x5e6e83(_0x1a98ec[_0xe74a('0x1c')]['message']);}})[_0xe74a('0x1d')](function(_0x1b6fcb){logger[_0xe74a('0x19')](_0xe74a('0x14'),_0x21c12b,_0x1b6fcb);_0x136822(_0x1b6fcb);});});}exports[_0xe74a('0x1e')]=function(_0x195e29){var _0x14d491=this;return new Promise(function(_0x1f54fd,_0x1d13e9){return db['WhatsappAccount']['find']({'raw':_0x195e29[_0xe74a('0x1f')]?_0x195e29[_0xe74a('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x195e29[_0xe74a('0x1f')]?_0x195e29[_0xe74a('0x1f')]['where']||null:null,'attributes':_0x195e29['options']?_0x195e29[_0xe74a('0x1f')][_0xe74a('0x20')]||null:null,'include':_0x195e29[_0xe74a('0x1f')]?_0x195e29[_0xe74a('0x1f')][_0xe74a('0x21')]?_[_0xe74a('0x22')](_0x195e29[_0xe74a('0x1f')]['include'],function(_0x5e6947){return{'model':db[_0x5e6947[_0xe74a('0x23')]],'as':_0x5e6947['as'],'attributes':_0x5e6947[_0xe74a('0x20')],'include':_0x5e6947[_0xe74a('0x21')]?_[_0xe74a('0x22')](_0x5e6947[_0xe74a('0x21')],function(_0x1d8240){return{'model':db[_0x1d8240['model']],'as':_0x1d8240['as'],'attributes':_0x1d8240[_0xe74a('0x20')],'include':_0x1d8240[_0xe74a('0x21')]?_[_0xe74a('0x22')](_0x1d8240[_0xe74a('0x21')],function(_0x43164e){return{'model':db[_0x43164e[_0xe74a('0x23')]],'as':_0x43164e['as'],'attributes':_0x43164e[_0xe74a('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe74a('0x12')](function(_0x2cce12){logger[_0xe74a('0x13')]('ShowWhatsappAccount',_0x195e29);logger['debug']('ShowWhatsappAccount',_0x195e29,JSON[_0xe74a('0x18')](_0x2cce12));_0x1f54fd(_0x2cce12);})[_0xe74a('0x1d')](function(_0x54942b){logger[_0xe74a('0x19')](_0xe74a('0x1e'),_0x54942b[_0xe74a('0x1b')],_0x195e29);_0x1d13e9(_0x14d491[_0xe74a('0x19')](0x1f4,_0x54942b[_0xe74a('0x1b')]));});});}; \ No newline at end of file +var _0xa9fc=['../../mysqldb','../../config/logger','rpc','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','result','message','catch','WhatsappAccount','options','raw','attributes','include','map','then','ShowWhatsappAccount','lodash','util','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9fc,0x19f));var _0xca9f=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xa9fc[_0xc8a931];return _0x28bd27;};'use strict';var _=require(_0xca9f('0x0'));var util=require(_0xca9f('0x1'));var moment=require(_0xca9f('0x2'));var BPromise=require(_0xca9f('0x3'));var rs=require(_0xca9f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca9f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xca9f('0x6'))(_0xca9f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xca9f('0x8')]({'port':0x232a});config['redis']=_[_0xca9f('0x9')](config[_0xca9f('0xa')],{'host':_0xca9f('0xb'),'port':0x18eb});var socket=require(_0xca9f('0xc'))(new Redis(config[_0xca9f('0xa')]));require(_0xca9f('0xd'))[_0xca9f('0xe')](socket);function respondWithRpcPromise(_0x5ae48c,_0x5cd1db,_0x2bdf62){return new BPromise(function(_0x4326a5,_0x2f0af9){return client[_0xca9f('0xf')](_0x5ae48c,_0x2bdf62)['then'](function(_0x41bca1){logger[_0xca9f('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x5cd1db,_0xca9f('0x11'));logger[_0xca9f('0x12')](_0xca9f('0x13'),_0x5cd1db,_0xca9f('0x11'),JSON[_0xca9f('0x14')](_0x41bca1));if(_0x41bca1[_0xca9f('0x15')]){if(_0x41bca1[_0xca9f('0x15')][_0xca9f('0x16')]===0x1f4){logger[_0xca9f('0x15')](_0xca9f('0x17'),_0x5cd1db,_0x41bca1['error']['message']);return _0x2f0af9(_0x41bca1[_0xca9f('0x15')]['message']);}logger['error'](_0xca9f('0x17'),_0x5cd1db,_0x41bca1[_0xca9f('0x15')]['message']);return _0x4326a5(_0x41bca1[_0xca9f('0x15')]['message']);}else{logger[_0xca9f('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x5cd1db,_0xca9f('0x11'));_0x4326a5(_0x41bca1[_0xca9f('0x18')][_0xca9f('0x19')]);}})[_0xca9f('0x1a')](function(_0x25008f){logger['error'](_0xca9f('0x17'),_0x5cd1db,_0x25008f);_0x2f0af9(_0x25008f);});});}exports['ShowWhatsappAccount']=function(_0x14a7c3){var _0x1ad141=this;return new Promise(function(_0x42fe2f,_0x2799e8){return db[_0xca9f('0x1b')]['find']({'raw':_0x14a7c3[_0xca9f('0x1c')]?_0x14a7c3[_0xca9f('0x1c')][_0xca9f('0x1d')]===undefined?!![]:![]:!![],'where':_0x14a7c3[_0xca9f('0x1c')]?_0x14a7c3[_0xca9f('0x1c')]['where']||null:null,'attributes':_0x14a7c3['options']?_0x14a7c3[_0xca9f('0x1c')][_0xca9f('0x1e')]||null:null,'include':_0x14a7c3[_0xca9f('0x1c')]?_0x14a7c3[_0xca9f('0x1c')][_0xca9f('0x1f')]?_['map'](_0x14a7c3[_0xca9f('0x1c')][_0xca9f('0x1f')],function(_0x46a0e8){return{'model':db[_0x46a0e8['model']],'as':_0x46a0e8['as'],'attributes':_0x46a0e8[_0xca9f('0x1e')],'include':_0x46a0e8[_0xca9f('0x1f')]?_[_0xca9f('0x20')](_0x46a0e8[_0xca9f('0x1f')],function(_0x88025b){return{'model':db[_0x88025b['model']],'as':_0x88025b['as'],'attributes':_0x88025b[_0xca9f('0x1e')],'include':_0x88025b[_0xca9f('0x1f')]?_[_0xca9f('0x20')](_0x88025b[_0xca9f('0x1f')],function(_0x399d1a){return{'model':db[_0x399d1a['model']],'as':_0x399d1a['as'],'attributes':_0x399d1a['attributes']};}):[]};}):[]};}):[]:[]})[_0xca9f('0x21')](function(_0x5dfa6f){logger[_0xca9f('0x10')](_0xca9f('0x22'),_0x14a7c3);logger[_0xca9f('0x12')](_0xca9f('0x22'),_0x14a7c3,JSON['stringify'](_0x5dfa6f));_0x42fe2f(_0x5dfa6f);})['catch'](function(_0xf153c8){logger['error'](_0xca9f('0x22'),_0xf153c8['message'],_0x14a7c3);_0x2799e8(_0x1ad141[_0xca9f('0x15')](0x1f4,_0xf153c8[_0xca9f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 022fdec..4aa5177 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 _0x09e7=['whatsappAccount:','./whatsappAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x4a8ab9,_0x8328c6){var _0x1a693c=function(_0x5c23db){while(--_0x5c23db){_0x4a8ab9['push'](_0x4a8ab9['shift']());}};_0x1a693c(++_0x8328c6);}(_0x09e7,0x159));var _0x709e=function(_0x4c8a8f,_0x997ef){_0x4c8a8f=_0x4c8a8f-0x0;var _0x404500=_0x09e7[_0x4c8a8f];return _0x404500;};'use strict';var WhatsappAccountEvents=require(_0x709e('0x0'));var events=[_0x709e('0x1'),_0x709e('0x2'),_0x709e('0x3')];function createListener(_0x2753ab,_0x2fc665){return function(_0x16b93f){_0x2fc665[_0x709e('0x4')](_0x2753ab,_0x16b93f);};}function removeListener(_0x3bd436,_0x4bb365){return function(){WhatsappAccountEvents[_0x709e('0x5')](_0x3bd436,_0x4bb365);};}exports[_0x709e('0x6')]=function(_0x13c409){for(var _0x1f5d42=0x0,_0x112b2d=events['length'];_0x1f5d42<_0x112b2d;_0x1f5d42++){var _0x1b2474=events[_0x1f5d42];var _0xac5127=createListener(_0x709e('0x7')+_0x1b2474,_0x13c409);WhatsappAccountEvents['on'](_0x1b2474,_0xac5127);}}; \ No newline at end of file +var _0xd79f=['whatsappAccount:','remove','update','emit','removeListener','register','length'];(function(_0x47a62a,_0x5c2671){var _0x51f5e0=function(_0x3624d6){while(--_0x3624d6){_0x47a62a['push'](_0x47a62a['shift']());}};_0x51f5e0(++_0x5c2671);}(_0xd79f,0x1c8));var _0xfd79=function(_0x56a80b,_0x361c5c){_0x56a80b=_0x56a80b-0x0;var _0x3cf87b=_0xd79f[_0x56a80b];return _0x3cf87b;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save',_0xfd79('0x0'),_0xfd79('0x1')];function createListener(_0x193502,_0x5102bc){return function(_0x1ac576){_0x5102bc[_0xfd79('0x2')](_0x193502,_0x1ac576);};}function removeListener(_0x29745b,_0x25b4ff){return function(){WhatsappAccountEvents[_0xfd79('0x3')](_0x29745b,_0x25b4ff);};}exports[_0xfd79('0x4')]=function(_0x1d8e5c){for(var _0x15fcbc=0x0,_0x39915e=events[_0xfd79('0x5')];_0x15fcbc<_0x39915e;_0x15fcbc++){var _0x1efe4f=events[_0x15fcbc];var _0xc22542=createListener(_0xfd79('0x6')+_0x1efe4f,_0x1d8e5c);WhatsappAccountEvents['on'](_0x1efe4f,_0xc22542);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index cbab674..bf25490 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 _0xf477=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x495fa4,_0x2743ae){var _0x32664f=function(_0x422f5f){while(--_0x422f5f){_0x495fa4['push'](_0x495fa4['shift']());}};_0x32664f(++_0x2743ae);}(_0xf477,0x1b2));var _0x7f47=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xf477[_0x160c73];return _0xd9302;};'use strict';var multer=require(_0x7f47('0x0'));var util=require(_0x7f47('0x1'));var path=require(_0x7f47('0x2'));var timeout=require(_0x7f47('0x3'));var express=require('express');var router=express[_0x7f47('0x4')]();var fs_extra=require(_0x7f47('0x5'));var auth=require(_0x7f47('0x6'));var interaction=require(_0x7f47('0x7'));var config=require(_0x7f47('0x8'));var controller=require(_0x7f47('0x9'));router[_0x7f47('0xa')]('/',auth[_0x7f47('0xb')](),controller[_0x7f47('0xc')]);router[_0x7f47('0xa')](_0x7f47('0xd'),auth[_0x7f47('0xb')](),controller[_0x7f47('0xe')]);router[_0x7f47('0xf')]('/',auth[_0x7f47('0xb')](),controller['create']);router[_0x7f47('0x10')](_0x7f47('0xd'),auth[_0x7f47('0xb')](),controller[_0x7f47('0x11')]);router[_0x7f47('0x12')](_0x7f47('0xd'),auth['isAuthenticated'](),controller[_0x7f47('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0b8a=['delete','destroy','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','post','put','/:id','update'];(function(_0x53118e,_0x5d2280){var _0xd5e01f=function(_0x45151d){while(--_0x45151d){_0x53118e['push'](_0x53118e['shift']());}};_0xd5e01f(++_0x5d2280);}(_0x0b8a,0x162));var _0xa0b8=function(_0x7fa6f7,_0x5082a1){_0x7fa6f7=_0x7fa6f7-0x0;var _0x16f746=_0x0b8a[_0x7fa6f7];return _0x16f746;};'use strict';var multer=require(_0xa0b8('0x0'));var util=require(_0xa0b8('0x1'));var path=require('path');var timeout=require(_0xa0b8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa0b8('0x3'));var auth=require(_0xa0b8('0x4'));var interaction=require(_0xa0b8('0x5'));var config=require(_0xa0b8('0x6'));var controller=require(_0xa0b8('0x7'));router[_0xa0b8('0x8')]('/',auth[_0xa0b8('0x9')](),controller['index']);router[_0xa0b8('0x8')]('/:id',auth[_0xa0b8('0x9')](),controller['show']);router[_0xa0b8('0xa')]('/',auth[_0xa0b8('0x9')](),controller['create']);router[_0xa0b8('0xb')](_0xa0b8('0xc'),auth[_0xa0b8('0x9')](),controller[_0xa0b8('0xd')]);router[_0xa0b8('0xe')](_0xa0b8('0xc'),auth[_0xa0b8('0x9')](),controller[_0xa0b8('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 825f731..5d6cf48 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 _0x67dd=['*,*,*,*','sequelize','STRING','noop','TEXT'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x67dd,0x1b9));var _0xd67d=function(_0x30adff,_0x52e255){_0x30adff=_0x30adff-0x0;var _0x4667b4=_0x67dd[_0x30adff];return _0x4667b4;};'use strict';var Sequelize=require(_0xd67d('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd67d('0x1')],'allowNull':![],'defaultValue':_0xd67d('0x2')},'appdata':{'type':Sequelize[_0xd67d('0x3')]()},'description':{'type':Sequelize[_0xd67d('0x1')]},'interval':{'type':Sequelize[_0xd67d('0x1')],'defaultValue':_0xd67d('0x4')}}; \ No newline at end of file +var _0x71ec=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x17a5fa,_0x2097aa){var _0x584613=function(_0x1c9868){while(--_0x1c9868){_0x17a5fa['push'](_0x17a5fa['shift']());}};_0x584613(++_0x2097aa);}(_0x71ec,0x1bf));var _0xc71e=function(_0x1bba6c,_0x1f94cf){_0x1bba6c=_0x1bba6c-0x0;var _0x415735=_0x71ec[_0x1bba6c];return _0x415735;};'use strict';var Sequelize=require(_0xc71e('0x0'));module[_0xc71e('0x1')]={'priority':{'type':Sequelize[_0xc71e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc71e('0x3')],'allowNull':![],'defaultValue':_0xc71e('0x4')},'appdata':{'type':Sequelize[_0xc71e('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xc71e('0x3')],'defaultValue':_0xc71e('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index a0d4bcb..e2f6622 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 _0xc113=['fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','update','then','sendStatus','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','catch','show','params','length','includeAll','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc113,0x1ab));var _0x3c11=function(_0x4d7cd2,_0xa025a9){_0x4d7cd2=_0x4d7cd2-0x0;var _0xc153b=_0xc113[_0x4d7cd2];return _0xc153b;};'use strict';var emlformat=require(_0x3c11('0x0'));var rimraf=require(_0x3c11('0x1'));var zipdir=require(_0x3c11('0x2'));var jsonpatch=require(_0x3c11('0x3'));var rp=require(_0x3c11('0x4'));var moment=require(_0x3c11('0x5'));var BPromise=require(_0x3c11('0x6'));var Mustache=require(_0x3c11('0x7'));var util=require(_0x3c11('0x8'));var path=require('path');var sox=require(_0x3c11('0x9'));var csv=require(_0x3c11('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3c11('0xb'));var _=require(_0x3c11('0xc'));var squel=require(_0x3c11('0xd'));var crypto=require('crypto');var jsforce=require(_0x3c11('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3c11('0xf'));var Redis=require(_0x3c11('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3c11('0x11'));var as=require(_0x3c11('0x12'));var hardwareService=require(_0x3c11('0x13'));var logger=require('../../config/logger')(_0x3c11('0x14'));var utils=require(_0x3c11('0x15'));var config=require(_0x3c11('0x16'));var licenseUtil=require(_0x3c11('0x17'));var db=require(_0x3c11('0x18'))['db'];function respondWithStatusCode(_0x58c7c8,_0x28daef){_0x28daef=_0x28daef||0xcc;return function(_0x2d997c){if(_0x2d997c){return _0x58c7c8['sendStatus'](_0x28daef);}return _0x58c7c8[_0x3c11('0x19')](_0x28daef)[_0x3c11('0x1a')]();};}function respondWithResult(_0x1c0b32,_0x822ef3){_0x822ef3=_0x822ef3||0xc8;return function(_0x30b11b){if(_0x30b11b){return _0x1c0b32['status'](_0x822ef3)[_0x3c11('0x1b')](_0x30b11b);}};}function respondWithFilteredResult(_0x2ba437,_0x2259f7){return function(_0x14c05d){if(_0x14c05d){var _0x1d05f2=typeof _0x2259f7['offset']==='undefined'&&typeof _0x2259f7['limit']===_0x3c11('0x1c');var _0x3a0626=_0x14c05d[_0x3c11('0x1d')];var _0x42db8d=_0x1d05f2?0x0:_0x2259f7[_0x3c11('0x1e')];var _0x35d32f=_0x1d05f2?_0x14c05d[_0x3c11('0x1d')]:_0x2259f7[_0x3c11('0x1e')]+_0x2259f7[_0x3c11('0x1f')];var _0x539ee1;if(_0x35d32f>=_0x3a0626){_0x35d32f=_0x3a0626;_0x539ee1=0xc8;}else{_0x539ee1=0xce;}_0x2ba437['status'](_0x539ee1);return _0x2ba437[_0x3c11('0x20')]('Content-Range',_0x42db8d+'-'+_0x35d32f+'/'+_0x3a0626)[_0x3c11('0x1b')](_0x14c05d);}return null;};}function patchUpdates(_0x5540b7){return function(_0x3ab7af){try{jsonpatch['apply'](_0x3ab7af,_0x5540b7,!![]);}catch(_0xe243c){return BPromise['reject'](_0xe243c);}return _0x3ab7af['save']();};}function saveUpdates(_0x160831,_0x49b827){return function(_0x189ba9){if(_0x189ba9){return _0x189ba9[_0x3c11('0x21')](_0x160831)[_0x3c11('0x22')](function(_0x2a7687){return _0x2a7687;});}return null;};}function removeEntity(_0x1a8fd4,_0x4e456a){return function(_0x36bb91){if(_0x36bb91){return _0x36bb91['destroy']()[_0x3c11('0x22')](function(){_0x1a8fd4[_0x3c11('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29f3cd,_0x20ec9b){return function(_0x2ff8bc){if(!_0x2ff8bc){_0x29f3cd[_0x3c11('0x23')](0x194);}return _0x2ff8bc;};}function handleError(_0xd42228,_0x243659){_0x243659=_0x243659||0x1f4;return function(_0x1af1fb){logger[_0x3c11('0x24')](_0x1af1fb[_0x3c11('0x25')]);if(_0x1af1fb[_0x3c11('0x26')]){delete _0x1af1fb['name'];}_0xd42228[_0x3c11('0x19')](_0x243659)[_0x3c11('0x27')](_0x1af1fb);};}exports[_0x3c11('0x28')]=function(_0x9cc373,_0x50aec6){var _0x25b25d={},_0x21401c={},_0x5151b0={'count':0x0,'rows':[]};var _0x1078b8=_[_0x3c11('0x29')](db[_0x3c11('0x2a')][_0x3c11('0x2b')],function(_0x36a5b4){return{'name':_0x36a5b4[_0x3c11('0x2c')],'type':_0x36a5b4[_0x3c11('0x2d')][_0x3c11('0x2e')]};});_0x21401c['model']=_[_0x3c11('0x29')](_0x1078b8,_0x3c11('0x26'));_0x21401c[_0x3c11('0x2f')]=_[_0x3c11('0x30')](_0x9cc373[_0x3c11('0x2f')]);_0x21401c[_0x3c11('0x31')]=_[_0x3c11('0x32')](_0x21401c['model'],_0x21401c[_0x3c11('0x2f')]);_0x25b25d[_0x3c11('0x33')]=_[_0x3c11('0x32')](_0x21401c[_0x3c11('0x34')],qs[_0x3c11('0x35')](_0x9cc373[_0x3c11('0x2f')]['fields']));_0x25b25d[_0x3c11('0x33')]=_0x25b25d['attributes']['length']?_0x25b25d[_0x3c11('0x33')]:_0x21401c[_0x3c11('0x34')];if(!_0x9cc373['query'][_0x3c11('0x36')](_0x3c11('0x37'))){_0x25b25d[_0x3c11('0x1f')]=qs['limit'](_0x9cc373[_0x3c11('0x2f')][_0x3c11('0x1f')]);_0x25b25d[_0x3c11('0x1e')]=qs[_0x3c11('0x1e')](_0x9cc373['query'][_0x3c11('0x1e')]);}_0x25b25d[_0x3c11('0x38')]=qs['sort'](_0x9cc373[_0x3c11('0x2f')][_0x3c11('0x39')]);_0x25b25d[_0x3c11('0x3a')]=qs['filters'](_[_0x3c11('0x3b')](_0x9cc373['query'],_0x21401c[_0x3c11('0x31')]),_0x1078b8);if(_0x9cc373['query']['filter']){_0x25b25d[_0x3c11('0x3a')]=_['merge'](_0x25b25d[_0x3c11('0x3a')],{'$or':_['map'](_0x1078b8,function(_0x32766e){if(_0x32766e[_0x3c11('0x2d')]!=='VIRTUAL'){var _0x20bf47={};_0x20bf47[_0x32766e['name']]={'$like':'%'+_0x9cc373[_0x3c11('0x2f')][_0x3c11('0x3c')]+'%'};return _0x20bf47;}})});}_0x25b25d=_[_0x3c11('0x3d')]({},_0x25b25d,_0x9cc373['options']);var _0x3e1ec3={'where':_0x25b25d[_0x3c11('0x3a')]};return db[_0x3c11('0x2a')][_0x3c11('0x1d')](_0x3e1ec3)[_0x3c11('0x22')](function(_0x2ccc27){_0x5151b0[_0x3c11('0x1d')]=_0x2ccc27;if(_0x9cc373[_0x3c11('0x2f')]['includeAll']){_0x25b25d[_0x3c11('0x3e')]=[{'all':!![]}];}return db[_0x3c11('0x2a')][_0x3c11('0x3f')](_0x25b25d);})['then'](function(_0x4ed063){_0x5151b0['rows']=_0x4ed063;return _0x5151b0;})[_0x3c11('0x22')](respondWithFilteredResult(_0x50aec6,_0x25b25d))[_0x3c11('0x40')](handleError(_0x50aec6,null));};exports[_0x3c11('0x41')]=function(_0x5eef87,_0x533cb8){var _0x3eea03={'raw':!![],'where':{'id':_0x5eef87[_0x3c11('0x42')]['id']}},_0x39b0ed={};_0x39b0ed[_0x3c11('0x34')]=_[_0x3c11('0x30')](db[_0x3c11('0x2a')][_0x3c11('0x2b')]);_0x39b0ed[_0x3c11('0x2f')]=_[_0x3c11('0x30')](_0x5eef87['query']);_0x39b0ed[_0x3c11('0x31')]=_[_0x3c11('0x32')](_0x39b0ed[_0x3c11('0x34')],_0x39b0ed[_0x3c11('0x2f')]);_0x3eea03[_0x3c11('0x33')]=_[_0x3c11('0x32')](_0x39b0ed[_0x3c11('0x34')],qs[_0x3c11('0x35')](_0x5eef87[_0x3c11('0x2f')][_0x3c11('0x35')]));_0x3eea03['attributes']=_0x3eea03[_0x3c11('0x33')][_0x3c11('0x43')]?_0x3eea03[_0x3c11('0x33')]:_0x39b0ed['model'];if(_0x5eef87[_0x3c11('0x2f')][_0x3c11('0x44')]){_0x3eea03[_0x3c11('0x3e')]=[{'all':!![]}];}_0x3eea03=_[_0x3c11('0x3d')]({},_0x3eea03,_0x5eef87['options']);return db['WhatsappApplication'][_0x3c11('0x45')](_0x3eea03)[_0x3c11('0x22')](handleEntityNotFound(_0x533cb8,null))['then'](respondWithResult(_0x533cb8,null))[_0x3c11('0x40')](handleError(_0x533cb8,null));};exports[_0x3c11('0x46')]=function(_0x2e2398,_0x2b3224){return db['WhatsappApplication']['create'](_0x2e2398[_0x3c11('0x47')],{})[_0x3c11('0x22')](respondWithResult(_0x2b3224,0xc9))[_0x3c11('0x40')](handleError(_0x2b3224,null));};exports[_0x3c11('0x21')]=function(_0x4da7b4,_0x1846b2){if(_0x4da7b4[_0x3c11('0x47')]['id']){delete _0x4da7b4[_0x3c11('0x47')]['id'];}return db[_0x3c11('0x2a')][_0x3c11('0x45')]({'where':{'id':_0x4da7b4[_0x3c11('0x42')]['id']}})['then'](handleEntityNotFound(_0x1846b2,null))['then'](saveUpdates(_0x4da7b4['body'],null))['then'](respondWithResult(_0x1846b2,null))['catch'](handleError(_0x1846b2,null));};exports[_0x3c11('0x48')]=function(_0x559f54,_0x5a7efe){return db[_0x3c11('0x2a')][_0x3c11('0x45')]({'where':{'id':_0x559f54['params']['id']}})[_0x3c11('0x22')](handleEntityNotFound(_0x5a7efe,null))['then'](removeEntity(_0x5a7efe,null))[_0x3c11('0x40')](handleError(_0x5a7efe,null));}; \ No newline at end of file +var _0xb90a=['intersection','model','fields','attributes','length','nolimit','limit','sort','where','pick','filter','type','VIRTUAL','options','findAll','rows','catch','params','include','merge','find','body','eml-format','rimraf','fast-json-patch','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','WhatsappApplication','rawAttributes','key','query','keys','filters'];(function(_0x4a52ba,_0x469709){var _0x46b1df=function(_0x3f1240){while(--_0x3f1240){_0x4a52ba['push'](_0x4a52ba['shift']());}};_0x46b1df(++_0x469709);}(_0xb90a,0x12a));var _0xab90=function(_0x53c1a1,_0x1f401c){_0x53c1a1=_0x53c1a1-0x0;var _0x4f2ddf=_0xb90a[_0x53c1a1];return _0x4f2ddf;};'use strict';var emlformat=require(_0xab90('0x0'));var rimraf=require(_0xab90('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xab90('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xab90('0x3'));var sox=require(_0xab90('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xab90('0x5'));var _=require(_0xab90('0x6'));var squel=require(_0xab90('0x7'));var crypto=require('crypto');var jsforce=require(_0xab90('0x8'));var deskjs=require(_0xab90('0x9'));var toCsv=require(_0xab90('0xa'));var querystring=require(_0xab90('0xb'));var Papa=require(_0xab90('0xc'));var Redis=require(_0xab90('0xd'));var authService=require(_0xab90('0xe'));var qs=require(_0xab90('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab90('0x10'));var logger=require(_0xab90('0x11'))(_0xab90('0x12'));var utils=require(_0xab90('0x13'));var config=require(_0xab90('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xab90('0x15'))['db'];function respondWithStatusCode(_0x97ab00,_0x35346a){_0x35346a=_0x35346a||0xcc;return function(_0x34d615){if(_0x34d615){return _0x97ab00[_0xab90('0x16')](_0x35346a);}return _0x97ab00[_0xab90('0x17')](_0x35346a)[_0xab90('0x18')]();};}function respondWithResult(_0x11e95a,_0xd485f5){_0xd485f5=_0xd485f5||0xc8;return function(_0x3dc022){if(_0x3dc022){return _0x11e95a[_0xab90('0x17')](_0xd485f5)[_0xab90('0x19')](_0x3dc022);}};}function respondWithFilteredResult(_0x1c3d44,_0x556828){return function(_0x282723){if(_0x282723){var _0x5b68bd=typeof _0x556828[_0xab90('0x1a')]===_0xab90('0x1b')&&typeof _0x556828['limit']===_0xab90('0x1b');var _0x2e0cf0=_0x282723[_0xab90('0x1c')];var _0x58cc79=_0x5b68bd?0x0:_0x556828[_0xab90('0x1a')];var _0x18323a=_0x5b68bd?_0x282723[_0xab90('0x1c')]:_0x556828[_0xab90('0x1a')]+_0x556828['limit'];var _0x2f6904;if(_0x18323a>=_0x2e0cf0){_0x18323a=_0x2e0cf0;_0x2f6904=0xc8;}else{_0x2f6904=0xce;}_0x1c3d44['status'](_0x2f6904);return _0x1c3d44[_0xab90('0x1d')]('Content-Range',_0x58cc79+'-'+_0x18323a+'/'+_0x2e0cf0)[_0xab90('0x19')](_0x282723);}return null;};}function patchUpdates(_0x143d54){return function(_0x2e8255){try{jsonpatch[_0xab90('0x1e')](_0x2e8255,_0x143d54,!![]);}catch(_0x5d5c1c){return BPromise[_0xab90('0x1f')](_0x5d5c1c);}return _0x2e8255[_0xab90('0x20')]();};}function saveUpdates(_0x2fa268,_0x3b1244){return function(_0x2195cc){if(_0x2195cc){return _0x2195cc[_0xab90('0x21')](_0x2fa268)[_0xab90('0x22')](function(_0x210b5e){return _0x210b5e;});}return null;};}function removeEntity(_0x84eb68,_0x2cdc7f){return function(_0x4757ba){if(_0x4757ba){return _0x4757ba[_0xab90('0x23')]()[_0xab90('0x22')](function(){_0x84eb68[_0xab90('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7e141c,_0x39e8a5){return function(_0x167f84){if(!_0x167f84){_0x7e141c[_0xab90('0x16')](0x194);}return _0x167f84;};}function handleError(_0x4a37de,_0x205b63){_0x205b63=_0x205b63||0x1f4;return function(_0x2cad38){logger[_0xab90('0x24')](_0x2cad38[_0xab90('0x25')]);if(_0x2cad38['name']){delete _0x2cad38[_0xab90('0x26')];}_0x4a37de[_0xab90('0x17')](_0x205b63)['send'](_0x2cad38);};}exports[_0xab90('0x27')]=function(_0x16be33,_0x146cf7){var _0x2f81e2={},_0x24e562={},_0x209807={'count':0x0,'rows':[]};var _0x44a7a0=_[_0xab90('0x28')](db[_0xab90('0x29')][_0xab90('0x2a')],function(_0x581cc6){return{'name':_0x581cc6['fieldName'],'type':_0x581cc6['type'][_0xab90('0x2b')]};});_0x24e562['model']=_[_0xab90('0x28')](_0x44a7a0,_0xab90('0x26'));_0x24e562[_0xab90('0x2c')]=_[_0xab90('0x2d')](_0x16be33['query']);_0x24e562[_0xab90('0x2e')]=_[_0xab90('0x2f')](_0x24e562[_0xab90('0x30')],_0x24e562['query']);_0x2f81e2['attributes']=_[_0xab90('0x2f')](_0x24e562[_0xab90('0x30')],qs[_0xab90('0x31')](_0x16be33[_0xab90('0x2c')][_0xab90('0x31')]));_0x2f81e2[_0xab90('0x32')]=_0x2f81e2[_0xab90('0x32')][_0xab90('0x33')]?_0x2f81e2[_0xab90('0x32')]:_0x24e562[_0xab90('0x30')];if(!_0x16be33[_0xab90('0x2c')]['hasOwnProperty'](_0xab90('0x34'))){_0x2f81e2[_0xab90('0x35')]=qs[_0xab90('0x35')](_0x16be33[_0xab90('0x2c')][_0xab90('0x35')]);_0x2f81e2['offset']=qs[_0xab90('0x1a')](_0x16be33[_0xab90('0x2c')][_0xab90('0x1a')]);}_0x2f81e2['order']=qs[_0xab90('0x36')](_0x16be33[_0xab90('0x2c')][_0xab90('0x36')]);_0x2f81e2[_0xab90('0x37')]=qs[_0xab90('0x2e')](_[_0xab90('0x38')](_0x16be33['query'],_0x24e562[_0xab90('0x2e')]),_0x44a7a0);if(_0x16be33['query'][_0xab90('0x39')]){_0x2f81e2[_0xab90('0x37')]=_['merge'](_0x2f81e2[_0xab90('0x37')],{'$or':_['map'](_0x44a7a0,function(_0x43a828){if(_0x43a828[_0xab90('0x3a')]!==_0xab90('0x3b')){var _0x196de2={};_0x196de2[_0x43a828[_0xab90('0x26')]]={'$like':'%'+_0x16be33['query'][_0xab90('0x39')]+'%'};return _0x196de2;}})});}_0x2f81e2=_['merge']({},_0x2f81e2,_0x16be33[_0xab90('0x3c')]);var _0x1fadc9={'where':_0x2f81e2['where']};return db[_0xab90('0x29')][_0xab90('0x1c')](_0x1fadc9)[_0xab90('0x22')](function(_0x5557a4){_0x209807[_0xab90('0x1c')]=_0x5557a4;if(_0x16be33[_0xab90('0x2c')]['includeAll']){_0x2f81e2['include']=[{'all':!![]}];}return db[_0xab90('0x29')][_0xab90('0x3d')](_0x2f81e2);})[_0xab90('0x22')](function(_0x1c3328){_0x209807[_0xab90('0x3e')]=_0x1c3328;return _0x209807;})[_0xab90('0x22')](respondWithFilteredResult(_0x146cf7,_0x2f81e2))[_0xab90('0x3f')](handleError(_0x146cf7,null));};exports['show']=function(_0x291b47,_0x5563eb){var _0x1f7ef9={'raw':!![],'where':{'id':_0x291b47[_0xab90('0x40')]['id']}},_0x5f0491={};_0x5f0491[_0xab90('0x30')]=_[_0xab90('0x2d')](db[_0xab90('0x29')][_0xab90('0x2a')]);_0x5f0491[_0xab90('0x2c')]=_[_0xab90('0x2d')](_0x291b47[_0xab90('0x2c')]);_0x5f0491['filters']=_['intersection'](_0x5f0491['model'],_0x5f0491['query']);_0x1f7ef9[_0xab90('0x32')]=_['intersection'](_0x5f0491[_0xab90('0x30')],qs[_0xab90('0x31')](_0x291b47[_0xab90('0x2c')][_0xab90('0x31')]));_0x1f7ef9[_0xab90('0x32')]=_0x1f7ef9['attributes'][_0xab90('0x33')]?_0x1f7ef9['attributes']:_0x5f0491[_0xab90('0x30')];if(_0x291b47[_0xab90('0x2c')]['includeAll']){_0x1f7ef9[_0xab90('0x41')]=[{'all':!![]}];}_0x1f7ef9=_[_0xab90('0x42')]({},_0x1f7ef9,_0x291b47[_0xab90('0x3c')]);return db[_0xab90('0x29')][_0xab90('0x43')](_0x1f7ef9)[_0xab90('0x22')](handleEntityNotFound(_0x5563eb,null))['then'](respondWithResult(_0x5563eb,null))[_0xab90('0x3f')](handleError(_0x5563eb,null));};exports['create']=function(_0x1b7e3a,_0x488666){return db[_0xab90('0x29')]['create'](_0x1b7e3a[_0xab90('0x44')],{})['then'](respondWithResult(_0x488666,0xc9))['catch'](handleError(_0x488666,null));};exports['update']=function(_0x1bd4bd,_0x1bb19f){if(_0x1bd4bd[_0xab90('0x44')]['id']){delete _0x1bd4bd[_0xab90('0x44')]['id'];}return db[_0xab90('0x29')][_0xab90('0x43')]({'where':{'id':_0x1bd4bd[_0xab90('0x40')]['id']}})[_0xab90('0x22')](handleEntityNotFound(_0x1bb19f,null))[_0xab90('0x22')](saveUpdates(_0x1bd4bd['body'],null))[_0xab90('0x22')](respondWithResult(_0x1bb19f,null))[_0xab90('0x3f')](handleError(_0x1bb19f,null));};exports[_0xab90('0x23')]=function(_0x592ea4,_0x4b9cbc){return db[_0xab90('0x29')][_0xab90('0x43')]({'where':{'id':_0x592ea4[_0xab90('0x40')]['id']}})['then'](handleEntityNotFound(_0x4b9cbc,null))[_0xab90('0x22')](removeEntity(_0x4b9cbc,null))[_0xab90('0x3f')](handleError(_0x4b9cbc,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 7a00f83..2a4f649 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 _0xeb0d=['../../config/environment','./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4','lodash','moment','bluebird','path','rimraf'];(function(_0x420f2a,_0x2cc58d){var _0x28f802=function(_0x3329cc){while(--_0x3329cc){_0x420f2a['push'](_0x420f2a['shift']());}};_0x28f802(++_0x2cc58d);}(_0xeb0d,0xe2));var _0xdeb0=function(_0x44f73f,_0x104bad){_0x44f73f=_0x44f73f-0x0;var _0x322a78=_0xeb0d[_0x44f73f];return _0x322a78;};'use strict';var _=require(_0xdeb0('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xdeb0('0x1'));var BPromise=require(_0xdeb0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdeb0('0x3'));var rimraf=require(_0xdeb0('0x4'));var config=require(_0xdeb0('0x5'));var attributes=require(_0xdeb0('0x6'));module[_0xdeb0('0x7')]=function(_0x13d486,_0xc48108){return _0x13d486[_0xdeb0('0x8')]('WhatsappApplication',attributes,{'tableName':_0xdeb0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdeb0('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xae79=['whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define'];(function(_0x3818c0,_0x542521){var _0x55ec33=function(_0x2be9ea){while(--_0x2be9ea){_0x3818c0['push'](_0x3818c0['shift']());}};_0x55ec33(++_0x542521);}(_0xae79,0x1d3));var _0x9ae7=function(_0x3c98e5,_0x345f9d){_0x3c98e5=_0x3c98e5-0x0;var _0x4f8ed0=_0xae79[_0x3c98e5];return _0x4f8ed0;};'use strict';var _=require(_0x9ae7('0x0'));var util=require(_0x9ae7('0x1'));var logger=require(_0x9ae7('0x2'))(_0x9ae7('0x3'));var moment=require(_0x9ae7('0x4'));var BPromise=require(_0x9ae7('0x5'));var rp=require(_0x9ae7('0x6'));var fs=require('fs');var path=require(_0x9ae7('0x7'));var rimraf=require(_0x9ae7('0x8'));var config=require(_0x9ae7('0x9'));var attributes=require(_0x9ae7('0xa'));module[_0x9ae7('0xb')]=function(_0x3e98cf,_0x396863){return _0x3e98cf[_0x9ae7('0xc')]('WhatsappApplication',attributes,{'tableName':_0x9ae7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9ae7('0xe'),'collate':_0x9ae7('0xf')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 7955a13..f260c3f 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 _0xe14d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x34b4d5,_0x55e994){var _0x483f5d=function(_0x52529d){while(--_0x52529d){_0x34b4d5['push'](_0x34b4d5['shift']());}};_0x483f5d(++_0x55e994);}(_0xe14d,0x1ee));var _0xde14=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xe14d[_0x1e7b16];return _0x37fadc;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1f6b,_0x5a1344,_0x1bd49d){return new BPromise(function(_0x115b7d,_0x2b0e7c){return client[_0xde14('0xc')](_0x4b1f6b,_0x1bd49d)[_0xde14('0xd')](function(_0x176909){logger[_0xde14('0xe')](_0xde14('0xf'),_0x5a1344,'request\x20sent');logger[_0xde14('0x10')](_0xde14('0x11'),_0x5a1344,_0xde14('0x12'),JSON[_0xde14('0x13')](_0x176909));if(_0x176909[_0xde14('0x14')]){if(_0x176909[_0xde14('0x14')][_0xde14('0x15')]===0x1f4){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909[_0xde14('0x14')][_0xde14('0x16')]);return _0x2b0e7c(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909['error']['message']);return _0x115b7d(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}else{logger[_0xde14('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x5a1344,_0xde14('0x12'));_0x115b7d(_0x176909[_0xde14('0x17')][_0xde14('0x16')]);}})[_0xde14('0x18')](function(_0x3de959){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x3de959);_0x2b0e7c(_0x3de959);});});} \ No newline at end of file +var _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','WhatsappApplication,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x229c76,_0x3b9a48){var _0x57a9fd=function(_0x5c4249){while(--_0x5c4249){_0x229c76['push'](_0x229c76['shift']());}};_0x57a9fd(++_0x3b9a48);}(_0x3e74,0x175));var _0x43e7=function(_0x37903f,_0x2247b1){_0x37903f=_0x37903f-0x0;var _0x561729=_0x3e74[_0x37903f];return _0x561729;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 97e7951..dde75fc 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 _0x7ee1=['whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','exports','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','isAuthenticated','/:id','/:id/download','download','post','/:id/messages','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x7ee1,0x8d));var _0x17ee=function(_0x5e7c64,_0x31a899){_0x5e7c64=_0x5e7c64-0x0;var _0x36f339=_0x7ee1[_0x5e7c64];return _0x36f339;};'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['get']('/:id/messages',auth[_0x17ee('0x9')](),controller['getMessages']);router[_0x17ee('0x7')](_0x17ee('0xb'),auth[_0x17ee('0x9')](),controller[_0x17ee('0xc')]);router['post']('/',auth[_0x17ee('0x9')](),controller['create']);router[_0x17ee('0xd')](_0x17ee('0xe'),auth[_0x17ee('0x9')](),controller[_0x17ee('0xf')]);router[_0x17ee('0xd')](_0x17ee('0x10'),auth[_0x17ee('0x9')](),interaction[_0x17ee('0x11')](_0x17ee('0x12'),_0x17ee('0x13')),controller[_0x17ee('0x14')]);router['put']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x17ee('0x12'),_0x17ee('0x15')),controller[_0x17ee('0x16')]);router[_0x17ee('0x17')](_0x17ee('0xa'),auth[_0x17ee('0x9')](),interaction[_0x17ee('0x11')]('whatsapp',_0x17ee('0x18')),controller[_0x17ee('0x19')]);router[_0x17ee('0x17')](_0x17ee('0x10'),auth[_0x17ee('0x9')](),controller['removeTags']);module[_0x17ee('0x1a')]=router; \ No newline at end of file +var _0xcd59=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags'];(function(_0x10584c,_0x403e92){var _0x3e752f=function(_0x24e9a0){while(--_0x24e9a0){_0x10584c['push'](_0x10584c['shift']());}};_0x3e752f(++_0x403e92);}(_0xcd59,0x14b));var _0x9cd5=function(_0x3f3f06,_0x581e5b){_0x3f3f06=_0x3f3f06-0x0;var _0x140feb=_0xcd59[_0x3f3f06];return _0x140feb;};'use strict';var multer=require(_0x9cd5('0x0'));var util=require(_0x9cd5('0x1'));var path=require(_0x9cd5('0x2'));var timeout=require(_0x9cd5('0x3'));var express=require(_0x9cd5('0x4'));var router=express[_0x9cd5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9cd5('0x6'));var interaction=require(_0x9cd5('0x7'));var config=require(_0x9cd5('0x8'));var controller=require(_0x9cd5('0x9'));router[_0x9cd5('0xa')]('/',auth[_0x9cd5('0xb')](),controller[_0x9cd5('0xc')]);router[_0x9cd5('0xa')](_0x9cd5('0xd'),auth[_0x9cd5('0xb')](),controller['describe']);router[_0x9cd5('0xa')](_0x9cd5('0xe'),auth[_0x9cd5('0xb')](),controller[_0x9cd5('0xf')]);router[_0x9cd5('0xa')](_0x9cd5('0x10'),auth[_0x9cd5('0xb')](),controller[_0x9cd5('0x11')]);router['get'](_0x9cd5('0x12'),auth[_0x9cd5('0xb')](),controller[_0x9cd5('0x13')]);router[_0x9cd5('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9cd5('0x14')](_0x9cd5('0x10'),auth[_0x9cd5('0xb')](),controller[_0x9cd5('0x15')]);router[_0x9cd5('0x14')](_0x9cd5('0x16'),auth['isAuthenticated'](),interaction[_0x9cd5('0x17')](_0x9cd5('0x18'),_0x9cd5('0x19')),controller['addTags']);router['put']('/:id',auth[_0x9cd5('0xb')](),interaction[_0x9cd5('0x17')]('whatsapp',_0x9cd5('0x1a')),controller[_0x9cd5('0x1b')]);router[_0x9cd5('0x1c')]('/:id',auth[_0x9cd5('0xb')](),interaction[_0x9cd5('0x17')](_0x9cd5('0x18'),_0x9cd5('0x1d')),controller[_0x9cd5('0x1e')]);router[_0x9cd5('0x1c')]('/:id/tags',auth[_0x9cd5('0xb')](),controller[_0x9cd5('0x1f')]);module[_0x9cd5('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index fa25c7f..d7a79f8 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 _0x1a8f=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x49b647,_0x5403e5){var _0x3cf01b=function(_0x3b8cd8){while(--_0x3b8cd8){_0x49b647['push'](_0x49b647['shift']());}};_0x3cf01b(++_0x5403e5);}(_0x1a8f,0x87));var _0xf1a8=function(_0x3fd455,_0x1f7c5b){_0x3fd455=_0x3fd455-0x0;var _0x1c259f=_0x1a8f[_0x3fd455];return _0x1c259f;};'use strict';var Sequelize=require(_0xf1a8('0x0'));var moment=require('moment');module[_0xf1a8('0x1')]={'closed':{'type':Sequelize[_0xf1a8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf1a8('0x3')]},'disposition':{'type':Sequelize[_0xf1a8('0x4')]},'secondDisposition':{'type':Sequelize[_0xf1a8('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xf1a8('0x5')]('in',_0xf1a8('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf1a8('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xf1a8('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0c75=['DATE','STRING','ENUM','out','moment','BOOLEAN'];(function(_0x22d483,_0x57bbd1){var _0x58ad39=function(_0x206cbb){while(--_0x206cbb){_0x22d483['push'](_0x22d483['shift']());}};_0x58ad39(++_0x57bbd1);}(_0x0c75,0x6a));var _0x50c7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0c75[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x50c7('0x0'));module['exports']={'closed':{'type':Sequelize[_0x50c7('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x50c7('0x2')]},'disposition':{'type':Sequelize[_0x50c7('0x3')]},'secondDisposition':{'type':Sequelize[_0x50c7('0x3')]},'thirdDisposition':{'type':Sequelize[_0x50c7('0x3')]},'note':{'type':Sequelize[_0x50c7('0x3')]},'phone':{'type':Sequelize[_0x50c7('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x50c7('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x50c7('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x50c7('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x50c7('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index e0d72d3..a282cf7 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 _0x2f72=['CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','t.id\x20IN\x20?','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','getWhatsappAccounts','agent','sequelize','toString','merge','WhatsappInteraction','a.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','all','rows','show','params','includeAll','include','create','describe','addMessage','WhatsappMessage','ids','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','omit','spread','emit','whatsappInteractionTags:save','removeTags','download','join','root','files','tmp','server','transcript-%d-%s.zip','CmContact','lastName','Attachment','direction','WhatsappAccount','Account','get','mkdirSync','Whatsapp','Owner','N.A.','closed','closedAt','disposition','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','System','firstName','secret','renderFile','views','downloadInteraction.ejs','.pdf','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','Users','fullname','TagIds','split','forEach','Tags','push','catch','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','u.id','u.fullname','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User'];(function(_0x4ec35e,_0x34d4e6){var _0x5e7af9=function(_0x181477){while(--_0x181477){_0x4ec35e['push'](_0x4ec35e['shift']());}};_0x5e7af9(++_0x34d4e6);}(_0x2f72,0x166));var _0x22f7=function(_0x3b29ad,_0x1db470){_0x3b29ad=_0x3b29ad-0x0;var _0x4d8d60=_0x2f72[_0x3b29ad];return _0x4d8d60;};'use strict';var emlformat=require(_0x22f7('0x0'));var rimraf=require(_0x22f7('0x1'));var zipdir=require(_0x22f7('0x2'));var jsonpatch=require(_0x22f7('0x3'));var rp=require(_0x22f7('0x4'));var moment=require(_0x22f7('0x5'));var BPromise=require(_0x22f7('0x6'));var Mustache=require(_0x22f7('0x7'));var util=require('util');var path=require(_0x22f7('0x8'));var sox=require(_0x22f7('0x9'));var csv=require(_0x22f7('0xa'));var ejs=require(_0x22f7('0xb'));var fs=require('fs');var fs_extra=require(_0x22f7('0xc'));var _=require(_0x22f7('0xd'));var squel=require(_0x22f7('0xe'));var crypto=require(_0x22f7('0xf'));var jsforce=require(_0x22f7('0x10'));var deskjs=require(_0x22f7('0x11'));var toCsv=require(_0x22f7('0xa'));var querystring=require(_0x22f7('0x12'));var Papa=require(_0x22f7('0x13'));var Redis=require(_0x22f7('0x14'));var authService=require(_0x22f7('0x15'));var qs=require(_0x22f7('0x16'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x22f7('0x17'));var hardwareService=require(_0x22f7('0x18'));var logger=require('../../config/logger')(_0x22f7('0x19'));var utils=require(_0x22f7('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x22f7('0x1b'));var db=require('../../mysqldb')['db'];config[_0x22f7('0x1c')]=_[_0x22f7('0x1d')](config['redis'],{'host':_0x22f7('0x1e'),'port':0x18eb});var socket=require(_0x22f7('0x1f'))(new Redis(config[_0x22f7('0x1c')]));require(_0x22f7('0x20'))[_0x22f7('0x21')](socket);function respondWithStatusCode(_0x40ddf3,_0x31a446){_0x31a446=_0x31a446||0xcc;return function(_0x2e91d3){if(_0x2e91d3){return _0x40ddf3[_0x22f7('0x22')](_0x31a446);}return _0x40ddf3[_0x22f7('0x23')](_0x31a446)[_0x22f7('0x24')]();};}function respondWithResult(_0x24a356,_0xdae3e3){_0xdae3e3=_0xdae3e3||0xc8;return function(_0x3b2861){if(_0x3b2861){return _0x24a356[_0x22f7('0x23')](_0xdae3e3)['json'](_0x3b2861);}};}function respondWithFilteredResult(_0x4e71f5,_0x3894f4){return function(_0x1c3971){if(_0x1c3971){var _0x3f15b8=typeof _0x3894f4[_0x22f7('0x25')]===_0x22f7('0x26')&&typeof _0x3894f4[_0x22f7('0x27')]===_0x22f7('0x26');var _0xe025fa=_0x1c3971['count'];var _0x53e472=_0x3f15b8?0x0:_0x3894f4[_0x22f7('0x25')];var _0x1f363d=_0x3f15b8?_0x1c3971[_0x22f7('0x28')]:_0x3894f4['offset']+_0x3894f4[_0x22f7('0x27')];var _0x3db7ed;if(_0x1f363d>=_0xe025fa){_0x1f363d=_0xe025fa;_0x3db7ed=0xc8;}else{_0x3db7ed=0xce;}_0x4e71f5[_0x22f7('0x23')](_0x3db7ed);return _0x4e71f5[_0x22f7('0x29')](_0x22f7('0x2a'),_0x53e472+'-'+_0x1f363d+'/'+_0xe025fa)['json'](_0x1c3971);}return null;};}function patchUpdates(_0x48e352){return function(_0x18fcfa){try{jsonpatch['apply'](_0x18fcfa,_0x48e352,!![]);}catch(_0x320dc1){return BPromise[_0x22f7('0x2b')](_0x320dc1);}return _0x18fcfa[_0x22f7('0x2c')]();};}function saveUpdates(_0x3bb24e,_0x10adc7){return function(_0x177ff1){if(_0x177ff1){return _0x177ff1['update'](_0x3bb24e)[_0x22f7('0x2d')](function(_0x48c489){return _0x48c489;});}return null;};}function removeEntity(_0x580245,_0x18ad43){return function(_0x3cee67){if(_0x3cee67){return _0x3cee67[_0x22f7('0x2e')]()['then'](function(){_0x580245[_0x22f7('0x23')](0xcc)[_0x22f7('0x24')]();});}};}function handleEntityNotFound(_0x5a5360,_0x1748e3){return function(_0x2e9ba8){if(!_0x2e9ba8){_0x5a5360['sendStatus'](0x194);}return _0x2e9ba8;};}function handleError(_0x6cdd51,_0x5c4282){_0x5c4282=_0x5c4282||0x1f4;return function(_0xa3346f){logger[_0x22f7('0x2f')](_0xa3346f[_0x22f7('0x30')]);if(_0xa3346f['name']){delete _0xa3346f[_0x22f7('0x31')];}_0x6cdd51[_0x22f7('0x23')](_0x5c4282)[_0x22f7('0x32')](_0xa3346f);};}function getInteractionUsers(_0x5cd8f7,_0x47ce76){return new BPromise(function(_0x2c7d6c,_0xec422e){try{if(_0x47ce76[_0x5cd8f7['id']]){_0x5cd8f7[_0x22f7('0x33')]=_['map'](_0x47ce76[_0x5cd8f7['id']],function(_0x11e51f){return{'id':_0x11e51f['id'],'fullname':_0x11e51f[_0x22f7('0x34')]};});}}catch(_0x28451f){_0xec422e(_0x28451f);}_0x2c7d6c(_0x5cd8f7);});}function getInteractionTags(_0xb49ec7,_0x5b6991){return new BPromise(function(_0x23f6c8,_0x200935){try{if(_0xb49ec7[_0x22f7('0x35')]){_0xb49ec7['Tags']=[];_0xb49ec7[_0x22f7('0x35')][_0x22f7('0x36')](',')[_0x22f7('0x37')](function(_0x3655b0){_0xb49ec7[_0x22f7('0x38')][_0x22f7('0x39')](_0x5b6991[_0x3655b0]);});}delete _0xb49ec7[_0x22f7('0x35')];}catch(_0x265d5d){_0x200935(_0x265d5d);}_0x23f6c8(_0xb49ec7);});}function updateWhatsappInteraction(_0x26f0d5,_0x5e1f75,_0x398dde){return new BPromise(function(_0x2b63e2,_0x399627){return getInteractionUsers(_0x26f0d5,_0x398dde)[_0x22f7('0x2d')](function(_0xa8be9f){return getInteractionTags(_0xa8be9f,_0x5e1f75);})[_0x22f7('0x2d')](function(_0x3014c0){_0x2b63e2(_0x3014c0);})[_0x22f7('0x3a')](function(_0x1ac785){_0x399627(_0x1ac785);});});}exports[_0x22f7('0x3b')]=function(_0x10e1db,_0x2e43c2){var _0x22371e={},_0x3b55b1={},_0x33848e={'count':0x0,'rows':[]};var _0x520f8b=_[_0x22f7('0x3c')](db['WhatsappInteraction'][_0x22f7('0x3d')],function(_0x1fc93f){return{'name':_0x1fc93f[_0x22f7('0x3e')],'type':_0x1fc93f[_0x22f7('0x3f')]['key']};});_0x3b55b1[_0x22f7('0x40')]=_[_0x22f7('0x3c')](_0x520f8b,'name');_0x3b55b1[_0x22f7('0x41')]=_[_0x22f7('0x42')](_0x10e1db[_0x22f7('0x41')]);_0x3b55b1[_0x22f7('0x43')]=_[_0x22f7('0x44')](_0x3b55b1[_0x22f7('0x40')],_0x3b55b1[_0x22f7('0x41')]);_0x22371e[_0x22f7('0x45')]=_[_0x22f7('0x44')](_0x3b55b1[_0x22f7('0x40')],qs['fields'](_0x10e1db[_0x22f7('0x41')][_0x22f7('0x46')]));_0x22371e[_0x22f7('0x45')]=_0x22371e['attributes'][_0x22f7('0x47')]?_0x22371e['attributes']:_0x3b55b1[_0x22f7('0x40')];if(!_0x10e1db['query'][_0x22f7('0x48')](_0x22f7('0x49'))){_0x22371e[_0x22f7('0x27')]=qs[_0x22f7('0x27')](_0x10e1db[_0x22f7('0x41')][_0x22f7('0x27')]);_0x22371e[_0x22f7('0x25')]=qs['offset'](_0x10e1db[_0x22f7('0x41')][_0x22f7('0x25')]);}_0x22371e['order']=qs[_0x22f7('0x4a')](_0x10e1db['query'][_0x22f7('0x4a')]);_0x22371e[_0x22f7('0x4b')]=qs['filters'](_[_0x22f7('0x4c')](_0x10e1db[_0x22f7('0x41')],_0x3b55b1['filters']),_0x520f8b);var _0x54a46d=[];var _0x84055f=squel[_0x22f7('0x4d')]()[_0x22f7('0x4e')]('id')[_0x22f7('0x4e')]('name')[_0x22f7('0x4e')](_0x22f7('0x4f'))[_0x22f7('0x50')]('tools_tags');var _0x5a6f55=squel['select']()[_0x22f7('0x4e')](_0x22f7('0x51'))[_0x22f7('0x4e')](_0x22f7('0x52'))[_0x22f7('0x4e')]('ui.WhatsappInteractionId')[_0x22f7('0x50')](_0x22f7('0x53'),'ui')[_0x22f7('0x54')](_0x22f7('0x55'),'u',_0x22f7('0x56'));var _0x7c8460=squel['select']()[_0x22f7('0x50')](_0x22f7('0x57'),'i')['left_join'](_0x22f7('0x58'),'c',_0x22f7('0x59'))['left_join'](_0x22f7('0x55'),'o',_0x22f7('0x5a'))[_0x22f7('0x54')](_0x22f7('0x5b'),'a',_0x22f7('0x5c'))[_0x22f7('0x54')](_0x22f7('0x5d'),'me',_0x22f7('0x5e'))[_0x22f7('0x54')]('whatsapp_interaction_has_tags','it',_0x22f7('0x5f'))[_0x22f7('0x54')](_0x22f7('0x60'),'t',_0x22f7('0x61'));var _0xad1e57=squel[_0x22f7('0x62')]();var _0x3868b9=[];var _0x47c1c9=squel[_0x22f7('0x62')]();var _0x11308a;if(_0x10e1db[_0x22f7('0x41')][_0x22f7('0x63')]){_0x11308a=as[_0x22f7('0x64')](_0x10e1db[_0x22f7('0x41')][_0x22f7('0x63')]);var _0x1b7347=_0x11308a[_0x22f7('0x65')];for(var _0x329111=0x0;_0x329111<_0x11308a['conditions'][_0x22f7('0x47')];_0x329111++){var _0x2ca246=_0x11308a[_0x22f7('0x66')][_0x329111];var _0x52b3e6='i';var _0x21b1b1=_[_0x22f7('0x67')](_0x520f8b,[_0x22f7('0x31'),_0x2ca246[_0x22f7('0x4e')]]);if(!_0x21b1b1){switch(_0x2ca246[_0x22f7('0x4e')]){case _0x22f7('0x68'):if(_0x2ca246[_0x22f7('0x69')]==0x1){_0x7c8460['having']('`'+_0x2ca246[_0x22f7('0x4e')]+'`\x20=\x200');}else{_0x7c8460[_0x22f7('0x6a')]('`'+_0x2ca246[_0x22f7('0x4e')]+_0x22f7('0x6b'));}break;case _0x22f7('0x6c'):if(_0x2ca246[_0x22f7('0x6d')]===_0x22f7('0x6e')){if(_0x2ca246[_0x22f7('0x69')][_0x22f7('0x36')]('\x20')[_0x22f7('0x47')]>0x1){_0xad1e57[_0x1b7347](_0x22f7('0x6f'),qs[_0x22f7('0x70')](_0x2ca246[_0x22f7('0x69')]),null);}else{var _0x28ed1b='%'+_0x2ca246['value']+'%';_0xad1e57[_0x1b7347](_0x22f7('0x71'),_0x28ed1b,_0x28ed1b,_0x28ed1b);}}else{_0x21b1b1=_[_0x22f7('0x67')](_0x520f8b,[_0x22f7('0x31'),_0x22f7('0x72')]);_0x2ca246[_0x22f7('0x4e')]=_0x22f7('0x72');_0x2cb65e=as[_0x22f7('0x73')](_0x52b3e6,_0x21b1b1['type'],_0x2ca246);_0xad1e57[_0x1b7347](_0x2cb65e[_0x22f7('0x74')],_0x2cb65e['value'][_0x22f7('0x75')],_0x2cb65e[_0x22f7('0x69')][_0x22f7('0x24')]);}break;case _0x22f7('0x76'):var _0x5907d1=_0x2ca246[_0x22f7('0x69')][_0x22f7('0x36')](',')[_0x22f7('0x3c')](function(_0x53daaa){return Number(_0x53daaa);});_0x5907d1[_0x22f7('0x37')](function(_0x5f1e86){_0x47c1c9['or'](_0x22f7('0x77'),'%,'+_0x5f1e86+',%');});_0x3868b9=_[_0x22f7('0x78')](_0x3868b9,_0x5907d1);break;case _0x22f7('0x79'):if(_0x2ca246[_0x22f7('0x6d')]===_0x22f7('0x6e')){_0xad1e57[_0x1b7347](_0x22f7('0x7a'),'%'+_0x2ca246[_0x22f7('0x69')]+'%',null);}else{_0x21b1b1=_[_0x22f7('0x67')](_0x520f8b,[_0x22f7('0x31'),_0x22f7('0x7b')]);_0x2ca246[_0x22f7('0x4e')]='UserId';_0x2cb65e=as['buildExpression'](_0x52b3e6,_0x21b1b1[_0x22f7('0x3f')],_0x2ca246);_0xad1e57[_0x1b7347](_0x2cb65e[_0x22f7('0x74')],_0x2cb65e[_0x22f7('0x69')]['start'],_0x2cb65e[_0x22f7('0x69')][_0x22f7('0x24')]);}break;case _0x22f7('0x7c'):_0x2cb65e=as[_0x22f7('0x73')]('me',null,_0x2ca246);_0xad1e57[_0x1b7347](_0x2cb65e[_0x22f7('0x74')],_0x2cb65e[_0x22f7('0x69')][_0x22f7('0x75')],_0x2cb65e[_0x22f7('0x69')][_0x22f7('0x24')]);break;}}else{var _0x2cb65e=as[_0x22f7('0x73')](_0x52b3e6,_0x21b1b1[_0x22f7('0x3f')],_0x2ca246);_0xad1e57[_0x1b7347](_0x2cb65e[_0x22f7('0x74')],_0x2cb65e[_0x22f7('0x69')][_0x22f7('0x75')],_0x2cb65e['value'][_0x22f7('0x24')]);}}}else{var _0x327a31=_(_0x10e1db[_0x22f7('0x41')])[_0x22f7('0x42')]()[_0x22f7('0x3c')](function(_0x3edebf){return _[_0x22f7('0x7d')](_0x520f8b,[_0x22f7('0x31'),_0x3edebf])?_0x3edebf:undefined;})[_0x22f7('0x7e')]()[_0x22f7('0x69')]();if(!_[_0x22f7('0x7f')](_0x327a31)){_0x327a31[_0x22f7('0x37')](function(_0x24199d){if(_0x24199d===_0x22f7('0x80')){_0x7c8460[_0x22f7('0x4b')](_0x22f7('0x81'),[][_0x22f7('0x82')](_0x10e1db[_0x22f7('0x41')][_0x24199d]));}else if(_0x24199d===_0x22f7('0x83')){var _0x58e605=JSON['parse'](_0x10e1db['query'][_0x24199d])[_0x22f7('0x84')];var _0x3345b1=JSON['parse'](_0x10e1db['query'][_0x24199d])[_0x22f7('0x85')];_0x7c8460['where'](_0x22f7('0x86'),_0x58e605,_0x3345b1);}else{if(_0x10e1db[_0x22f7('0x41')][_0x24199d]===_0x22f7('0x87')){_0x7c8460['where']('i.'+_0x24199d+_0x22f7('0x88'));}else{_0x7c8460['where']('i.'+_0x24199d+_0x22f7('0x89'),_0x10e1db['query'][_0x24199d]);}}});}if(_0x10e1db[_0x22f7('0x41')][_0x22f7('0x8a')]){if(_0x10e1db[_0x22f7('0x41')][_0x22f7('0x8a')]==0x1){_0x7c8460['having']('`unreadMessages`\x20=\x200');}else{_0x7c8460[_0x22f7('0x6a')](_0x22f7('0x8b'));}}if(_0x10e1db[_0x22f7('0x41')]['tag']){_0x3868b9=_[_0x22f7('0x8c')](_0x10e1db[_0x22f7('0x41')][_0x22f7('0x8d')])?_0x10e1db['query']['tag']:new Array(_0x10e1db[_0x22f7('0x41')][_0x22f7('0x8d')]);_0x3868b9[_0x22f7('0x37')](function(_0x3fd9ac){_0x47c1c9['or'](_0x22f7('0x77'),'%,'+_0x3fd9ac+',%');});}if(_0x10e1db[_0x22f7('0x41')][_0x22f7('0x8e')]){var _0x392395=_0x10e1db[_0x22f7('0x41')]['filter']['replace']('\x5c','\x5c\x5c')[_0x22f7('0x8f')](/'/g,'\x27\x27');if(qs[_0x22f7('0x90')](_0x392395)){_0xad1e57['or'](_0x22f7('0x91'),_0x392395+'%')['or'](_0x22f7('0x92'),_0x392395+'%');}else{_0xad1e57['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x392395))['or'](_0x22f7('0x93'),_0x392395+'%');}}}_0x7c8460['where'](_0xad1e57);_0x7c8460[_0x22f7('0x94')]('i.id');var _0x429ae0={'type':db['Sequelize'][_0x22f7('0x95')][_0x22f7('0x96')],'raw':!![]};var _0x713ca1=_0x7c8460[_0x22f7('0x97')]();_0x713ca1[_0x22f7('0x4e')]('i.id');_0x713ca1[_0x22f7('0x4e')](_0x22f7('0x98'),'unreadMessages');if(_0x22371e[_0x22f7('0x99')]){_0x22371e[_0x22f7('0x99')][_0x22f7('0x37')](function(_0x517725){var _0x4c4a07=_0x517725[0x0]===_0x22f7('0x9a')?_0x517725[0x0]:'i.'+_0x517725[0x0];_0x7c8460[_0x22f7('0x99')](_0x4c4a07,_0x517725[0x1]==='DESC'?![]:!![]);});}if(!_[_0x22f7('0x7f')](_0x3868b9)){_0x7c8460[_0x22f7('0x6a')](_0x47c1c9);_0x713ca1['where'](_0x22f7('0x9b'),_0x3868b9);}BPromise['resolve']()[_0x22f7('0x2d')](function(){if(!_0x11308a){if(_0x10e1db[_0x22f7('0x41')]['WhatsappAccountId'])return;_0x713ca1[_0x22f7('0x4b')](_0x22f7('0x9c'));_0x7c8460['where'](_0x22f7('0x9c'));return;}if(_0x10e1db[_0x22f7('0x9d')][_0x22f7('0x9e')]!=='agent')return;return _0x10e1db[_0x22f7('0x9d')][_0x22f7('0x9f')]({'attributes':['id'],'raw':!![]})[_0x22f7('0x2d')](function(_0x443321){if(_[_0x22f7('0x7f')](_0x443321)){_0x713ca1[_0x22f7('0x4b')]('i.WhatsappAccountId\x20IS\x20NULL');_0x7c8460[_0x22f7('0x4b')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x713ca1[_0x22f7('0x4b')](_0x22f7('0x81'),_[_0x22f7('0x3c')](_0x443321,'id'));_0x7c8460[_0x22f7('0x4b')](_0x22f7('0x81'),_[_0x22f7('0x3c')](_0x443321,'id'));}});})[_0x22f7('0x2d')](function(){if(_0x10e1db['user'][_0x22f7('0x9e')]===_0x22f7('0xa0')&&!_0x11308a&&!_0x10e1db[_0x22f7('0x41')][_0x22f7('0x80')])return[];return db[_0x22f7('0xa1')][_0x22f7('0x41')](_0x713ca1[_0x22f7('0xa2')](),_0x429ae0);})[_0x22f7('0x2d')](function(_0x417dca){_0x33848e[_0x22f7('0x28')]=_0x417dca[_0x22f7('0x47')];if(_0x33848e[_0x22f7('0x28')]===0x0)return[];return db[_0x22f7('0xa1')][_0x22f7('0x41')](_0x84055f[_0x22f7('0xa2')](),_0x429ae0)['then'](function(_0x4f4208){_0x54a46d=_['keyBy'](_0x4f4208,'id');_0x429ae0=_[_0x22f7('0xa3')](_0x429ae0,{'model':db[_0x22f7('0xa4')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x10e1db['query'][_0x22f7('0x46')]){_0x22371e[_0x22f7('0x45')][_0x22f7('0x37')](function(_0x44607b){_0x7c8460['field']('i.'+_0x44607b);});}else{_0x7c8460[_0x22f7('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x22f7('0x68'));_0x7c8460[_0x22f7('0x4e')](_0x22f7('0xa5'),'Account.key');_0x7c8460[_0x22f7('0x4e')]('a.mandatoryDisposition',_0x22f7('0xa6'));_0x7c8460['field'](_0x22f7('0xa7'),'contactName');_0x7c8460[_0x22f7('0x4e')](_0x22f7('0xa8'));_0x7c8460[_0x22f7('0x4e')](_0x22f7('0xa9'),_0x22f7('0xaa'));_0x7c8460[_0x22f7('0x4e')]('c.lastName',_0x22f7('0xab'));_0x7c8460[_0x22f7('0x4e')]('c.email',_0x22f7('0xac'));_0x7c8460[_0x22f7('0x4e')](_0x22f7('0xad'),_0x22f7('0xae'));_0x7c8460[_0x22f7('0x4e')](_0x22f7('0xaf'),_0x22f7('0xb0'));_0x7c8460[_0x22f7('0x4e')](_0x22f7('0xb1'),'Contact.fax');_0x7c8460['field']('o.fullname','Owner.fullname');_0x7c8460[_0x22f7('0x4e')]('o.internal',_0x22f7('0xb2'));_0x7c8460[_0x22f7('0x4e')](_0x22f7('0xb3'),_0x22f7('0x35'));}if(_0x22371e['limit'])_0x7c8460['limit'](_0x22371e[_0x22f7('0x27')]);if(_0x22371e[_0x22f7('0x25')])_0x7c8460[_0x22f7('0x25')](_0x22371e['offset']);return db[_0x22f7('0xa1')][_0x22f7('0x41')](_0x7c8460['toString'](),_0x429ae0);})[_0x22f7('0x2d')](function(_0x42d5d0){if(_0x42d5d0[_0x22f7('0x47')]>0x0)_0x5a6f55['where'](_0x22f7('0xb4'),_[_0x22f7('0x3c')](_0x42d5d0,'id'));return db[_0x22f7('0xa1')][_0x22f7('0x41')](_0x5a6f55['toString'](),_0x429ae0)[_0x22f7('0x2d')](function(_0x54cb75){var _0x2804d4=_['groupBy'](_0x54cb75,_0x22f7('0xb5'));var _0x38dafe=[];_0x42d5d0[_0x22f7('0x37')](function(_0x4e6394){_0x38dafe[_0x22f7('0x39')](updateWhatsappInteraction(_0x4e6394,_0x54a46d,_0x2804d4));});return BPromise[_0x22f7('0xb6')](_0x38dafe);});});})['then'](function(_0x2bc3de){_0x33848e[_0x22f7('0xb7')]=_0x2bc3de;return _0x33848e;})[_0x22f7('0x2d')](respondWithFilteredResult(_0x2e43c2,_0x22371e))[_0x22f7('0x3a')](handleError(_0x2e43c2,null));};exports[_0x22f7('0xb8')]=function(_0x3b6436,_0x1f31c6){var _0x10e286={'raw':![],'where':{'id':_0x3b6436[_0x22f7('0xb9')]['id']}},_0x2e15e8={};_0x2e15e8['model']=_['keys'](db[_0x22f7('0xa4')][_0x22f7('0x3d')]);_0x2e15e8[_0x22f7('0x41')]=_[_0x22f7('0x42')](_0x3b6436['query']);_0x2e15e8[_0x22f7('0x43')]=_[_0x22f7('0x44')](_0x2e15e8[_0x22f7('0x40')],_0x2e15e8[_0x22f7('0x41')]);_0x10e286[_0x22f7('0x45')]=_['intersection'](_0x2e15e8[_0x22f7('0x40')],qs[_0x22f7('0x46')](_0x3b6436['query'][_0x22f7('0x46')]));_0x10e286['attributes']=_0x10e286[_0x22f7('0x45')][_0x22f7('0x47')]?_0x10e286[_0x22f7('0x45')]:_0x2e15e8['model'];if(_0x3b6436[_0x22f7('0x41')][_0x22f7('0xba')]){_0x10e286[_0x22f7('0xbb')]=[{'all':!![]}];}_0x10e286=_[_0x22f7('0xa3')]({},_0x10e286,_0x3b6436['options']);return db['WhatsappInteraction']['find'](_0x10e286)[_0x22f7('0x2d')](handleEntityNotFound(_0x1f31c6,null))[_0x22f7('0x2d')](respondWithResult(_0x1f31c6,null))[_0x22f7('0x3a')](handleError(_0x1f31c6,null));};exports[_0x22f7('0xbc')]=function(_0x4335e4,_0x8af80f){return db[_0x22f7('0xa4')][_0x22f7('0xbc')](_0x4335e4[_0x22f7('0x7c')],{})[_0x22f7('0x2d')](respondWithResult(_0x8af80f,0xc9))['catch'](handleError(_0x8af80f,null));};exports['update']=function(_0x693a12,_0x1240df){if(_0x693a12[_0x22f7('0x7c')]['id']){delete _0x693a12['body']['id'];}return db['WhatsappInteraction']['find']({'where':{'id':_0x693a12[_0x22f7('0xb9')]['id']}})['then'](handleEntityNotFound(_0x1240df,null))[_0x22f7('0x2d')](saveUpdates(_0x693a12[_0x22f7('0x7c')],null))['then'](respondWithResult(_0x1240df,null))[_0x22f7('0x3a')](handleError(_0x1240df,null));};exports['destroy']=function(_0x1c13a1,_0x541bb5){return db['WhatsappInteraction']['find']({'where':{'id':_0x1c13a1[_0x22f7('0xb9')]['id']}})[_0x22f7('0x2d')](handleEntityNotFound(_0x541bb5,null))[_0x22f7('0x2d')](removeEntity(_0x541bb5,null))[_0x22f7('0x3a')](handleError(_0x541bb5,null));};exports[_0x22f7('0xbd')]=function(_0x1c6642,_0x30b679){return db[_0x22f7('0xa4')][_0x22f7('0xbd')]()[_0x22f7('0x2d')](respondWithResult(_0x30b679,null))[_0x22f7('0x3a')](handleError(_0x30b679,null));};exports[_0x22f7('0xbe')]=function(_0x7b1f5d,_0xcf3565,_0x1a3e19){return db[_0x22f7('0xbf')][_0x22f7('0x67')]({'where':{'id':_0x7b1f5d['params']['id']}})[_0x22f7('0x2d')](handleEntityNotFound(_0xcf3565,null))[_0x22f7('0x2d')](function(_0x408f7f){if(_0x408f7f){return _0x408f7f[_0x22f7('0xbe')](_0x7b1f5d[_0x22f7('0x7c')]['ids'],_['omit'](_0x7b1f5d[_0x22f7('0x7c')],[_0x22f7('0xc0'),'id'])||{});}})[_0x22f7('0x2d')](respondWithResult(_0xcf3565,null))[_0x22f7('0x3a')](handleError(_0xcf3565,null));};exports[_0x22f7('0xc1')]=function(_0x6d499e,_0x4d5376,_0x2c3f79){var _0x5aaf93={'raw':![],'where':{}};var _0x251f1f={};var _0x458a28={'count':0x0,'rows':[]};return db[_0x22f7('0xa4')]['findOne']({'where':{'id':_0x6d499e[_0x22f7('0xb9')]['id']}})[_0x22f7('0x2d')](handleEntityNotFound(_0x4d5376,null))[_0x22f7('0x2d')](function(_0x5bdbaf){if(_0x5bdbaf){_0x251f1f[_0x22f7('0x40')]=_['keys'](db[_0x22f7('0xbf')][_0x22f7('0x3d')]);_0x251f1f['query']=_['keys'](_0x6d499e[_0x22f7('0x41')]);_0x251f1f[_0x22f7('0x43')]=_['intersection'](_0x251f1f[_0x22f7('0x40')],_0x251f1f[_0x22f7('0x41')]);_0x5aaf93['attributes']=_['intersection'](_0x251f1f[_0x22f7('0x40')],qs['fields'](_0x6d499e['query'][_0x22f7('0x46')]));_0x5aaf93[_0x22f7('0x45')]=_0x5aaf93[_0x22f7('0x45')][_0x22f7('0x47')]?_0x5aaf93[_0x22f7('0x45')]:_0x251f1f[_0x22f7('0x40')];if(!_0x6d499e[_0x22f7('0x41')]['hasOwnProperty'](_0x22f7('0x49'))){_0x5aaf93['limit']=qs['limit'](_0x6d499e[_0x22f7('0x41')]['limit']);_0x5aaf93[_0x22f7('0x25')]=qs[_0x22f7('0x25')](_0x6d499e[_0x22f7('0x41')][_0x22f7('0x25')]);}_0x5aaf93['order']=qs['sort'](_0x6d499e['query']['sort']);_0x5aaf93['where']=qs['filters'](_[_0x22f7('0x4c')](_0x6d499e[_0x22f7('0x41')],_0x251f1f[_0x22f7('0x43')]));_0x5aaf93[_0x22f7('0x4b')]['WhatsappInteractionId']=_0x5bdbaf['id'];if(_0x6d499e['query'][_0x22f7('0x8e')]){_0x5aaf93['where']=_[_0x22f7('0xa3')](_0x5aaf93['where'],{'$or':_[_0x22f7('0x3c')](_0x5aaf93['attributes'],function(_0x6f53b4){var _0x25d951={};_0x25d951[_0x6f53b4]={'$like':'%'+_0x6d499e['query'][_0x22f7('0x8e')]+'%'};return _0x25d951;})});}if(_0x6d499e[_0x22f7('0x41')][_0x22f7('0x84')]){var _0x5b405f=_0x6d499e[_0x22f7('0x41')][_0x22f7('0x84')][_0x22f7('0x36')](',');var _0x1c6191={};_0x1c6191[_0x5b405f[0x0]]={'$gte':moment(_0x5b405f[0x1])[_0x22f7('0xc2')](_0x22f7('0xc3'))};_0x5aaf93[_0x22f7('0x4b')]=_['merge'](_0x5aaf93[_0x22f7('0x4b')],_0x1c6191);}_0x5aaf93=_[_0x22f7('0xa3')]({},_0x5aaf93,_0x6d499e[_0x22f7('0xc4')]);return db['WhatsappMessage'][_0x22f7('0x28')]({'where':_0x5aaf93[_0x22f7('0x4b')]})[_0x22f7('0x2d')](function(_0x5360fc){_0x458a28[_0x22f7('0x28')]=_0x5360fc;if(_0x6d499e[_0x22f7('0x41')]['includeAll']){_0x5aaf93[_0x22f7('0xbb')]=[{'all':!![]}];}return db[_0x22f7('0xbf')][_0x22f7('0xc5')](_0x5aaf93);})[_0x22f7('0x2d')](function(_0x2139c4){_0x458a28[_0x22f7('0xb7')]=_0x2139c4;return _0x458a28;});}})[_0x22f7('0x2d')](respondWithFilteredResult(_0x4d5376,_0x5aaf93))[_0x22f7('0x3a')](handleError(_0x4d5376,null));};exports[_0x22f7('0xc6')]=function(_0x3db20e,_0x361a7a,_0x2ad40e){return db[_0x22f7('0xa4')][_0x22f7('0x67')]({'where':{'id':_0x3db20e[_0x22f7('0xb9')]['id']}})[_0x22f7('0x2d')](handleEntityNotFound(_0x361a7a,null))[_0x22f7('0x2d')](function(_0x1486b3){if(_0x1486b3){return _0x1486b3[_0x22f7('0xc7')](_0x3db20e[_0x22f7('0x7c')][_0x22f7('0xc0')],_[_0x22f7('0xc8')](_0x3db20e[_0x22f7('0x7c')],[_0x22f7('0xc0'),'id'])||{})[_0x22f7('0xc9')](function(){return db[_0x22f7('0x76')][_0x22f7('0xc5')]({'attributes':['id',_0x22f7('0x31'),_0x22f7('0x4f')],'where':{'id':_0x3db20e[_0x22f7('0x7c')][_0x22f7('0xc0')]}});})[_0x22f7('0x2d')](function(_0x3dcc42){socket[_0x22f7('0xca')](_0x22f7('0xcb'),{'id':Number(_0x3db20e[_0x22f7('0xb9')]['id']),'tags':_0x3dcc42||[]});return{'id':Number(_0x3db20e[_0x22f7('0xb9')]['id']),'tags':_0x3dcc42||[]};});}})['then'](respondWithResult(_0x361a7a,null))[_0x22f7('0x3a')](handleError(_0x361a7a,null));};exports[_0x22f7('0xcc')]=function(_0x277155,_0x4f05c9,_0x2906fa){return db[_0x22f7('0xa4')][_0x22f7('0x67')]({'where':{'id':_0x277155['params']['id']}})['then'](handleEntityNotFound(_0x4f05c9,null))[_0x22f7('0x2d')](function(_0x579df2){if(_0x579df2){return _0x579df2[_0x22f7('0xcc')](_0x277155['query'][_0x22f7('0xc0')]);}})[_0x22f7('0x2d')](respondWithStatusCode(_0x4f05c9,null))[_0x22f7('0x3a')](handleError(_0x4f05c9,null));};exports[_0x22f7('0xcd')]=function(_0x39d4e5,_0x14c7f2){var _0x5857f5=moment()['unix']()['toString']();var _0x4eaa02=path[_0x22f7('0xce')](config[_0x22f7('0xcf')],'server',_0x22f7('0xd0'),_0x22f7('0xd1'));var _0x56d33d=path['join'](config[_0x22f7('0xcf')],_0x22f7('0xd2'),_0x22f7('0xd0'),'attachments');var _0x204a1e=path[_0x22f7('0xce')](_0x4eaa02,_0x5857f5);var _0x5dc780=util['format'](_0x22f7('0xd3'),_0x39d4e5[_0x22f7('0xb9')]['id'],_0x5857f5);var _0x17f544=path[_0x22f7('0xce')](_0x4eaa02,_0x5dc780);var _0x17d49c=[];_0x17d49c[_0x22f7('0x39')]({'model':db[_0x22f7('0x79')],'as':_0x22f7('0x79'),'attributes':['id','fullname'],'raw':!![]});_0x17d49c[_0x22f7('0x39')]({'model':db[_0x22f7('0xd4')],'as':_0x22f7('0x6c'),'attributes':['id','firstName',_0x22f7('0xd5')],'raw':!![]});if(_0x39d4e5[_0x22f7('0x41')]['attachments']){_0x17d49c[_0x22f7('0x39')]({'model':db[_0x22f7('0xd6')],'as':_0x22f7('0xd6'),'raw':!![]});}var _0x3348d3=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id','body',_0x22f7('0x83'),_0x22f7('0xd7'),'secret',_0x22f7('0x8a')],'include':_0x17d49c}];_0x3348d3[_0x22f7('0x39')]({'model':db[_0x22f7('0xd8')],'as':_0x22f7('0xd9'),'attributes':['id',_0x22f7('0x31')]});_0x3348d3[_0x22f7('0x39')]({'model':db[_0x22f7('0x79')],'as':'Owner','attributes':['id',_0x22f7('0x34')]});return db[_0x22f7('0xa4')]['find']({'where':{'id':_0x39d4e5[_0x22f7('0xb9')]['id']},'include':_0x3348d3})[_0x22f7('0x2d')](handleEntityNotFound(_0x14c7f2,null))[_0x22f7('0x2d')](function(_0x308936){if(_0x308936){var _0x1db21d=_0x308936[_0x22f7('0xda')]({'plain':!![]});fs[_0x22f7('0xdb')](_0x204a1e);var _0x1e861b={'channel':_0x22f7('0xdc'),'account':_0x1db21d['Account'][_0x22f7('0x31')],'agent':_0x1db21d[_0x22f7('0xdd')]?_0x1db21d[_0x22f7('0xdd')][_0x22f7('0x34')]:_0x22f7('0xde'),'createdAt':moment(_0x1db21d[_0x22f7('0x83')])[_0x22f7('0xc2')](_0x22f7('0xc3'))[_0x22f7('0xa2')](),'closedAt':_0x1db21d[_0x22f7('0xdf')]?moment(_0x1db21d[_0x22f7('0xe0')])[_0x22f7('0xc2')](_0x22f7('0xc3'))[_0x22f7('0xa2')]():'','disposition':_0x1db21d[_0x22f7('0xe1')],'messages':_(_0x1db21d[_0x22f7('0xe2')])[_0x22f7('0x8e')]({'secret':![]})[_0x22f7('0x3c')](function(_0xf578fe){if(_0xf578fe[_0x22f7('0xd6')]){var _0x4a1d97=path['join'](_0x56d33d,_0xf578fe[_0x22f7('0xd6')][_0x22f7('0xe3')]);if(fs[_0x22f7('0xe4')](_0x4a1d97)){fs[_0x22f7('0xe5')](_0x4a1d97)[_0x22f7('0xe6')](fs[_0x22f7('0xe7')](path[_0x22f7('0xce')](_0x204a1e,_0xf578fe[_0x22f7('0xd6')][_0x22f7('0xe3')])));}}return{'date':moment(_0xf578fe[_0x22f7('0x83')])[_0x22f7('0xc2')](_0x22f7('0xc3'))[_0x22f7('0xa2')](),'sender':_0xf578fe[_0x22f7('0xd7')]==='out'?_0xf578fe[_0x22f7('0x79')]?_0xf578fe[_0x22f7('0x79')][_0x22f7('0x34')]:_0x22f7('0xe8'):_0xf578fe['Contact'][_0x22f7('0xe9')]+(_0xf578fe[_0x22f7('0x6c')][_0x22f7('0xd5')]?'\x20'+_0xf578fe[_0x22f7('0x6c')][_0x22f7('0xd5')]:''),'body':_0xf578fe[_0x22f7('0xd6')]?_0xf578fe['Attachment']['basename']:_0xf578fe[_0x22f7('0x7c')],'direction':_0xf578fe[_0x22f7('0xd7')]==='out'?'A':'C','secret':_0xf578fe[_0x22f7('0xea')],'read':_0xf578fe['read'],'attachment':_0xf578fe['Attachment']};})[_0x22f7('0x69')]()};return ejs[_0x22f7('0xeb')](path[_0x22f7('0xce')](config['root'],_0x22f7('0xd2'),_0x22f7('0xec'),_0x22f7('0xed')),{'interaction':_0x1e861b})['then'](function(_0xc82db){var _0x2cfff6=path[_0x22f7('0xce')](_0x204a1e,'transcript-'+_0x1db21d['id']+'-'+_0x5857f5+_0x22f7('0xee'));var _0x4c5efd={'path':_0x2cfff6,'channel':_0x22f7('0xdc'),'interactionId':_0x1db21d['id']};return pdf['createPdfFromHTML'](_0xc82db,_0x4c5efd);})[_0x22f7('0x2d')](function(){return new BPromise(function(_0x2d6c41,_0x576c2b){zipdir(_0x204a1e,{'saveTo':_0x17f544},function(_0x910fbc,_0x12ceb6){if(_0x910fbc)return _0x576c2b(_0x910fbc);return _0x2d6c41(_0x12ceb6);});})[_0x22f7('0x2d')](function(){return new BPromise(function(_0x63be84,_0x1df9a3){rimraf(_0x204a1e,function(_0x54e5fa){if(_0x54e5fa)_0x1df9a3(_0x54e5fa);return _0x63be84();});});})[_0x22f7('0x2d')](function(){return _0x14c7f2[_0x22f7('0xcd')](_0x17f544,_0x5dc780,function(_0x3b1d23){if(_0x3b1d23){console['log'](_0x22f7('0xef'),_0x3b1d23);}else{fs['unlinkSync'](_0x17f544);}});});});}else{return _0x14c7f2[_0x22f7('0x22')](0xc8);}})['catch'](handleError(_0x14c7f2,null));}; \ No newline at end of file +var _0x1e69=['having','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','start','end','body','some','compact','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','isEmpty','sequelize','toString','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','WhatsappInteractionId','all','rows','show','params','include','options','create','describe','addMessage','WhatsappMessage','omit','ids','findOne','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','findAll','emit','whatsappInteractionTags:save','removeTags','unix','join','root','server','files','attachments','push','fullname','firstName','lastName','Attachment','secret','Account','Owner','get','Whatsapp','closed','basename','existsSync','createReadStream','direction','out','System','renderFile','downloadInteraction.ejs','.pdf','createPdfFromHTML','download','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','Users','TagIds','Tags','split','forEach','catch','index','map','WhatsappInteraction','rawAttributes','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200'];(function(_0xc201bf,_0x492030){var _0x4b3c38=function(_0x19e42e){while(--_0x19e42e){_0xc201bf['push'](_0xc201bf['shift']());}};_0x4b3c38(++_0x492030);}(_0x1e69,0x85));var _0x91e6=function(_0x4b8438,_0x2d281b){_0x4b8438=_0x4b8438-0x0;var _0x22ab4b=_0x1e69[_0x4b8438];return _0x22ab4b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x91e6('0x0'));var zipdir=require(_0x91e6('0x1'));var jsonpatch=require(_0x91e6('0x2'));var rp=require(_0x91e6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x91e6('0x4'));var util=require(_0x91e6('0x5'));var path=require(_0x91e6('0x6'));var sox=require(_0x91e6('0x7'));var csv=require(_0x91e6('0x8'));var ejs=require(_0x91e6('0x9'));var fs=require('fs');var fs_extra=require(_0x91e6('0xa'));var _=require(_0x91e6('0xb'));var squel=require(_0x91e6('0xc'));var crypto=require(_0x91e6('0xd'));var jsforce=require(_0x91e6('0xe'));var deskjs=require(_0x91e6('0xf'));var toCsv=require(_0x91e6('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x91e6('0x10'));var authService=require(_0x91e6('0x11'));var qs=require(_0x91e6('0x12'));var as=require(_0x91e6('0x13'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x91e6('0x14'));var logger=require(_0x91e6('0x15'))(_0x91e6('0x16'));var utils=require(_0x91e6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x91e6('0x18'));var db=require(_0x91e6('0x19'))['db'];config[_0x91e6('0x1a')]=_[_0x91e6('0x1b')](config[_0x91e6('0x1a')],{'host':_0x91e6('0x1c'),'port':0x18eb});var socket=require(_0x91e6('0x1d'))(new Redis(config['redis']));require(_0x91e6('0x1e'))[_0x91e6('0x1f')](socket);function respondWithStatusCode(_0x332a26,_0x1af659){_0x1af659=_0x1af659||0xcc;return function(_0x5df579){if(_0x5df579){return _0x332a26[_0x91e6('0x20')](_0x1af659);}return _0x332a26[_0x91e6('0x21')](_0x1af659)['end']();};}function respondWithResult(_0xf214f9,_0x4a7219){_0x4a7219=_0x4a7219||0xc8;return function(_0x57d30d){if(_0x57d30d){return _0xf214f9['status'](_0x4a7219)['json'](_0x57d30d);}};}function respondWithFilteredResult(_0x38ff1a,_0xdc9327){return function(_0x4b53b0){if(_0x4b53b0){var _0x5bda45=typeof _0xdc9327[_0x91e6('0x22')]===_0x91e6('0x23')&&typeof _0xdc9327[_0x91e6('0x24')]===_0x91e6('0x23');var _0x1c78e9=_0x4b53b0[_0x91e6('0x25')];var _0x163e9a=_0x5bda45?0x0:_0xdc9327[_0x91e6('0x22')];var _0x604e03=_0x5bda45?_0x4b53b0[_0x91e6('0x25')]:_0xdc9327['offset']+_0xdc9327[_0x91e6('0x24')];var _0x330073;if(_0x604e03>=_0x1c78e9){_0x604e03=_0x1c78e9;_0x330073=0xc8;}else{_0x330073=0xce;}_0x38ff1a[_0x91e6('0x21')](_0x330073);return _0x38ff1a[_0x91e6('0x26')](_0x91e6('0x27'),_0x163e9a+'-'+_0x604e03+'/'+_0x1c78e9)[_0x91e6('0x28')](_0x4b53b0);}return null;};}function patchUpdates(_0x4bdfe8){return function(_0x500f1f){try{jsonpatch[_0x91e6('0x29')](_0x500f1f,_0x4bdfe8,!![]);}catch(_0xc1333b){return BPromise[_0x91e6('0x2a')](_0xc1333b);}return _0x500f1f[_0x91e6('0x2b')]();};}function saveUpdates(_0x5e2d8d,_0x125880){return function(_0x19ab19){if(_0x19ab19){return _0x19ab19[_0x91e6('0x2c')](_0x5e2d8d)[_0x91e6('0x2d')](function(_0x3f46f7){return _0x3f46f7;});}return null;};}function removeEntity(_0x3f9c9f,_0x296ce9){return function(_0x21f642){if(_0x21f642){return _0x21f642[_0x91e6('0x2e')]()[_0x91e6('0x2d')](function(){_0x3f9c9f[_0x91e6('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x64644e,_0x360f21){return function(_0x3c0f65){if(!_0x3c0f65){_0x64644e[_0x91e6('0x20')](0x194);}return _0x3c0f65;};}function handleError(_0x3dcb03,_0x5e2d0d){_0x5e2d0d=_0x5e2d0d||0x1f4;return function(_0x468e67){logger[_0x91e6('0x2f')](_0x468e67['stack']);if(_0x468e67[_0x91e6('0x30')]){delete _0x468e67[_0x91e6('0x30')];}_0x3dcb03[_0x91e6('0x21')](_0x5e2d0d)['send'](_0x468e67);};}function getInteractionUsers(_0x2a08e0,_0xb9098c){return new BPromise(function(_0x5cb4ce,_0x315b4e){try{if(_0xb9098c[_0x2a08e0['id']]){_0x2a08e0[_0x91e6('0x31')]=_['map'](_0xb9098c[_0x2a08e0['id']],function(_0x3e699f){return{'id':_0x3e699f['id'],'fullname':_0x3e699f['fullname']};});}}catch(_0x3f074a){_0x315b4e(_0x3f074a);}_0x5cb4ce(_0x2a08e0);});}function getInteractionTags(_0x11f94a,_0x4aec86){return new BPromise(function(_0x24414f,_0x4b534c){try{if(_0x11f94a[_0x91e6('0x32')]){_0x11f94a[_0x91e6('0x33')]=[];_0x11f94a[_0x91e6('0x32')][_0x91e6('0x34')](',')[_0x91e6('0x35')](function(_0x17c57d){_0x11f94a[_0x91e6('0x33')]['push'](_0x4aec86[_0x17c57d]);});}delete _0x11f94a[_0x91e6('0x32')];}catch(_0x5e7814){_0x4b534c(_0x5e7814);}_0x24414f(_0x11f94a);});}function updateWhatsappInteraction(_0x1d3dc5,_0x2762a7,_0x469b43){return new BPromise(function(_0x390297,_0x23f263){return getInteractionUsers(_0x1d3dc5,_0x469b43)['then'](function(_0xa22bf8){return getInteractionTags(_0xa22bf8,_0x2762a7);})[_0x91e6('0x2d')](function(_0x5bbc13){_0x390297(_0x5bbc13);})[_0x91e6('0x36')](function(_0x5f3a3f){_0x23f263(_0x5f3a3f);});});}exports[_0x91e6('0x37')]=function(_0x4a80cb,_0x2358dc){var _0x47a129={},_0x543a65={},_0x5976cc={'count':0x0,'rows':[]};var _0x308ea7=_[_0x91e6('0x38')](db[_0x91e6('0x39')][_0x91e6('0x3a')],function(_0x323918){return{'name':_0x323918['fieldName'],'type':_0x323918['type'][_0x91e6('0x3b')]};});_0x543a65[_0x91e6('0x3c')]=_[_0x91e6('0x38')](_0x308ea7,_0x91e6('0x30'));_0x543a65['query']=_[_0x91e6('0x3d')](_0x4a80cb[_0x91e6('0x3e')]);_0x543a65['filters']=_['intersection'](_0x543a65[_0x91e6('0x3c')],_0x543a65[_0x91e6('0x3e')]);_0x47a129['attributes']=_[_0x91e6('0x3f')](_0x543a65[_0x91e6('0x3c')],qs[_0x91e6('0x40')](_0x4a80cb[_0x91e6('0x3e')][_0x91e6('0x40')]));_0x47a129[_0x91e6('0x41')]=_0x47a129[_0x91e6('0x41')][_0x91e6('0x42')]?_0x47a129[_0x91e6('0x41')]:_0x543a65[_0x91e6('0x3c')];if(!_0x4a80cb['query'][_0x91e6('0x43')](_0x91e6('0x44'))){_0x47a129[_0x91e6('0x24')]=qs[_0x91e6('0x24')](_0x4a80cb[_0x91e6('0x3e')][_0x91e6('0x24')]);_0x47a129['offset']=qs[_0x91e6('0x22')](_0x4a80cb[_0x91e6('0x3e')]['offset']);}_0x47a129[_0x91e6('0x45')]=qs['sort'](_0x4a80cb[_0x91e6('0x3e')][_0x91e6('0x46')]);_0x47a129[_0x91e6('0x47')]=qs[_0x91e6('0x48')](_[_0x91e6('0x49')](_0x4a80cb['query'],_0x543a65[_0x91e6('0x48')]),_0x308ea7);var _0x58896f=[];var _0x3fa8a2=squel[_0x91e6('0x4a')]()[_0x91e6('0x4b')]('id')[_0x91e6('0x4b')](_0x91e6('0x30'))[_0x91e6('0x4b')](_0x91e6('0x4c'))[_0x91e6('0x4d')]('tools_tags');var _0x30d708=squel[_0x91e6('0x4a')]()[_0x91e6('0x4b')](_0x91e6('0x4e'))[_0x91e6('0x4b')](_0x91e6('0x4f'))[_0x91e6('0x4b')](_0x91e6('0x50'))['from'](_0x91e6('0x51'),'ui')[_0x91e6('0x52')](_0x91e6('0x53'),'u','u.id\x20=\x20ui.UserId');var _0x55efd8=squel['select']()['from'](_0x91e6('0x54'),'i')[_0x91e6('0x52')](_0x91e6('0x55'),'c',_0x91e6('0x56'))[_0x91e6('0x52')](_0x91e6('0x53'),'o',_0x91e6('0x57'))[_0x91e6('0x52')]('whatsapp_accounts','a',_0x91e6('0x58'))[_0x91e6('0x52')](_0x91e6('0x59'),'me',_0x91e6('0x5a'))[_0x91e6('0x52')](_0x91e6('0x5b'),'it',_0x91e6('0x5c'))[_0x91e6('0x52')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x405254=squel[_0x91e6('0x5d')]();var _0x559d10=[];var _0x1f3b6a=squel[_0x91e6('0x5d')]();var _0x526ffc;if(_0x4a80cb[_0x91e6('0x3e')][_0x91e6('0x5e')]){_0x526ffc=as[_0x91e6('0x5f')](_0x4a80cb['query'][_0x91e6('0x5e')]);var _0x5d41bd=_0x526ffc[_0x91e6('0x60')];for(var _0x754836=0x0;_0x754836<_0x526ffc[_0x91e6('0x61')][_0x91e6('0x42')];_0x754836++){var _0x21eab7=_0x526ffc[_0x91e6('0x61')][_0x754836];var _0x40c26a='i';var _0xcc4efc=_[_0x91e6('0x62')](_0x308ea7,['name',_0x21eab7[_0x91e6('0x4b')]]);if(!_0xcc4efc){switch(_0x21eab7['field']){case _0x91e6('0x63'):if(_0x21eab7[_0x91e6('0x64')]==0x1){_0x55efd8['having']('`'+_0x21eab7['field']+_0x91e6('0x65'));}else{_0x55efd8[_0x91e6('0x66')]('`'+_0x21eab7[_0x91e6('0x4b')]+_0x91e6('0x67'));}break;case _0x91e6('0x68'):if(_0x21eab7[_0x91e6('0x69')]===_0x91e6('0x6a')){if(_0x21eab7[_0x91e6('0x64')][_0x91e6('0x34')]('\x20')['length']>0x1){_0x405254[_0x5d41bd]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x91e6('0x6b')](_0x21eab7[_0x91e6('0x64')]),null);}else{var _0x2707dc='%'+_0x21eab7['value']+'%';_0x405254[_0x5d41bd](_0x91e6('0x6c'),_0x2707dc,_0x2707dc,_0x2707dc);}}else{_0xcc4efc=_[_0x91e6('0x62')](_0x308ea7,['name',_0x91e6('0x6d')]);_0x21eab7[_0x91e6('0x4b')]='ContactId';_0xce2fe0=as[_0x91e6('0x6e')](_0x40c26a,_0xcc4efc[_0x91e6('0x6f')],_0x21eab7);_0x405254[_0x5d41bd](_0xce2fe0['text'],_0xce2fe0[_0x91e6('0x64')]['start'],_0xce2fe0[_0x91e6('0x64')]['end']);}break;case _0x91e6('0x70'):var _0xbfce4e=_0x21eab7[_0x91e6('0x64')]['split'](',')[_0x91e6('0x38')](function(_0x145e8f){return Number(_0x145e8f);});_0xbfce4e['forEach'](function(_0x3bc789){_0x1f3b6a['or'](_0x91e6('0x71'),'%,'+_0x3bc789+',%');});_0x559d10=_[_0x91e6('0x72')](_0x559d10,_0xbfce4e);break;case _0x91e6('0x73'):if(_0x21eab7[_0x91e6('0x69')]===_0x91e6('0x6a')){_0x405254[_0x5d41bd](_0x91e6('0x74'),'%'+_0x21eab7[_0x91e6('0x64')]+'%',null);}else{_0xcc4efc=_[_0x91e6('0x62')](_0x308ea7,['name','UserId']);_0x21eab7['field']=_0x91e6('0x75');_0xce2fe0=as[_0x91e6('0x6e')](_0x40c26a,_0xcc4efc[_0x91e6('0x6f')],_0x21eab7);_0x405254[_0x5d41bd](_0xce2fe0[_0x91e6('0x76')],_0xce2fe0[_0x91e6('0x64')][_0x91e6('0x77')],_0xce2fe0[_0x91e6('0x64')][_0x91e6('0x78')]);}break;case _0x91e6('0x79'):_0xce2fe0=as[_0x91e6('0x6e')]('me',null,_0x21eab7);_0x405254[_0x5d41bd](_0xce2fe0['text'],_0xce2fe0[_0x91e6('0x64')][_0x91e6('0x77')],_0xce2fe0[_0x91e6('0x64')][_0x91e6('0x78')]);break;}}else{var _0xce2fe0=as['buildExpression'](_0x40c26a,_0xcc4efc['type'],_0x21eab7);_0x405254[_0x5d41bd](_0xce2fe0[_0x91e6('0x76')],_0xce2fe0['value'][_0x91e6('0x77')],_0xce2fe0[_0x91e6('0x64')]['end']);}}}else{var _0x597bc2=_(_0x4a80cb['query'])[_0x91e6('0x3d')]()[_0x91e6('0x38')](function(_0xd1ba39){return _[_0x91e6('0x7a')](_0x308ea7,[_0x91e6('0x30'),_0xd1ba39])?_0xd1ba39:undefined;})[_0x91e6('0x7b')]()[_0x91e6('0x64')]();if(!_['isEmpty'](_0x597bc2)){_0x597bc2[_0x91e6('0x35')](function(_0x4f85fe){if(_0x4f85fe===_0x91e6('0x7c')){_0x55efd8[_0x91e6('0x47')](_0x91e6('0x7d'),[][_0x91e6('0x7e')](_0x4a80cb[_0x91e6('0x3e')][_0x4f85fe]));}else if(_0x4f85fe===_0x91e6('0x7f')){var _0x17515a=JSON[_0x91e6('0x80')](_0x4a80cb[_0x91e6('0x3e')][_0x4f85fe])[_0x91e6('0x81')];var _0x314b69=JSON[_0x91e6('0x80')](_0x4a80cb[_0x91e6('0x3e')][_0x4f85fe])[_0x91e6('0x82')];_0x55efd8[_0x91e6('0x47')](_0x91e6('0x83'),_0x17515a,_0x314b69);}else{if(_0x4a80cb[_0x91e6('0x3e')][_0x4f85fe]===_0x91e6('0x84')){_0x55efd8[_0x91e6('0x47')]('i.'+_0x4f85fe+_0x91e6('0x85'));}else{_0x55efd8[_0x91e6('0x47')]('i.'+_0x4f85fe+_0x91e6('0x86'),_0x4a80cb['query'][_0x4f85fe]);}}});}if(_0x4a80cb[_0x91e6('0x3e')][_0x91e6('0x87')]){if(_0x4a80cb[_0x91e6('0x3e')][_0x91e6('0x87')]==0x1){_0x55efd8[_0x91e6('0x66')]('`unreadMessages`\x20=\x200');}else{_0x55efd8[_0x91e6('0x66')](_0x91e6('0x88'));}}if(_0x4a80cb['query'][_0x91e6('0x89')]){_0x559d10=_[_0x91e6('0x8a')](_0x4a80cb['query'][_0x91e6('0x89')])?_0x4a80cb[_0x91e6('0x3e')]['tag']:new Array(_0x4a80cb['query'][_0x91e6('0x89')]);_0x559d10[_0x91e6('0x35')](function(_0x3f2b0e){_0x1f3b6a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3f2b0e+',%');});}if(_0x4a80cb[_0x91e6('0x3e')][_0x91e6('0x8b')]){var _0x5d4098=_0x4a80cb['query']['filter'][_0x91e6('0x8c')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5d4098)){_0x405254['or'](_0x91e6('0x8d'),_0x5d4098+'%')['or']('i.phone\x20LIKE\x20?',_0x5d4098+'%');}else{_0x405254['or'](_0x91e6('0x8e'),qs[_0x91e6('0x6b')](_0x5d4098))['or'](_0x91e6('0x8f'),_0x5d4098+'%');}}}_0x55efd8[_0x91e6('0x47')](_0x405254);_0x55efd8[_0x91e6('0x90')]('i.id');var _0x204dc9={'type':db[_0x91e6('0x91')][_0x91e6('0x92')]['SELECT'],'raw':!![]};var _0x7a32b9=_0x55efd8[_0x91e6('0x93')]();_0x7a32b9[_0x91e6('0x4b')](_0x91e6('0x94'));_0x7a32b9[_0x91e6('0x4b')](_0x91e6('0x95'),_0x91e6('0x63'));if(_0x47a129[_0x91e6('0x45')]){_0x47a129['order'][_0x91e6('0x35')](function(_0x1fcb23){var _0x1d4ce3=_0x1fcb23[0x0]===_0x91e6('0x96')?_0x1fcb23[0x0]:'i.'+_0x1fcb23[0x0];_0x55efd8[_0x91e6('0x45')](_0x1d4ce3,_0x1fcb23[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x559d10)){_0x55efd8['having'](_0x1f3b6a);_0x7a32b9[_0x91e6('0x47')](_0x91e6('0x97'),_0x559d10);}BPromise[_0x91e6('0x98')]()[_0x91e6('0x2d')](function(){if(!_0x526ffc){if(_0x4a80cb[_0x91e6('0x3e')][_0x91e6('0x7c')])return;_0x7a32b9[_0x91e6('0x47')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x55efd8[_0x91e6('0x47')](_0x91e6('0x99'));return;}if(_0x4a80cb[_0x91e6('0x9a')][_0x91e6('0x9b')]!==_0x91e6('0x9c'))return;return _0x4a80cb[_0x91e6('0x9a')][_0x91e6('0x9d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2ff2e0){if(_[_0x91e6('0x9e')](_0x2ff2e0)){_0x7a32b9[_0x91e6('0x47')]('i.WhatsappAccountId\x20IS\x20NULL');_0x55efd8[_0x91e6('0x47')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x7a32b9[_0x91e6('0x47')](_0x91e6('0x7d'),_[_0x91e6('0x38')](_0x2ff2e0,'id'));_0x55efd8[_0x91e6('0x47')](_0x91e6('0x7d'),_[_0x91e6('0x38')](_0x2ff2e0,'id'));}});})[_0x91e6('0x2d')](function(){if(_0x4a80cb[_0x91e6('0x9a')][_0x91e6('0x9b')]===_0x91e6('0x9c')&&!_0x526ffc&&!_0x4a80cb['query'][_0x91e6('0x7c')])return[];return db[_0x91e6('0x9f')][_0x91e6('0x3e')](_0x7a32b9[_0x91e6('0xa0')](),_0x204dc9);})[_0x91e6('0x2d')](function(_0x9d9bdb){_0x5976cc['count']=_0x9d9bdb[_0x91e6('0x42')];if(_0x5976cc[_0x91e6('0x25')]===0x0)return[];return db[_0x91e6('0x9f')][_0x91e6('0x3e')](_0x3fa8a2[_0x91e6('0xa0')](),_0x204dc9)[_0x91e6('0x2d')](function(_0x4a6d65){_0x58896f=_['keyBy'](_0x4a6d65,'id');_0x204dc9=_[_0x91e6('0xa1')](_0x204dc9,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4a80cb[_0x91e6('0x3e')]['fields']){_0x47a129['attributes'][_0x91e6('0x35')](function(_0x3e0b4b){_0x55efd8[_0x91e6('0x4b')]('i.'+_0x3e0b4b);});}else{_0x55efd8[_0x91e6('0x4b')](_0x91e6('0x95'),_0x91e6('0x63'));_0x55efd8[_0x91e6('0x4b')](_0x91e6('0xa2'),_0x91e6('0xa3'));_0x55efd8[_0x91e6('0x4b')](_0x91e6('0xa4'),'Account.mandatoryDisposition');_0x55efd8[_0x91e6('0x4b')](_0x91e6('0xa5'),'contactName');_0x55efd8[_0x91e6('0x4b')](_0x91e6('0xa6'));_0x55efd8[_0x91e6('0x4b')](_0x91e6('0xa7'),_0x91e6('0xa8'));_0x55efd8['field'](_0x91e6('0xa9'),_0x91e6('0xaa'));_0x55efd8[_0x91e6('0x4b')](_0x91e6('0xab'),_0x91e6('0xac'));_0x55efd8[_0x91e6('0x4b')](_0x91e6('0xad'),'Contact.phone');_0x55efd8[_0x91e6('0x4b')](_0x91e6('0xae'),_0x91e6('0xaf'));_0x55efd8[_0x91e6('0x4b')]('c.fax',_0x91e6('0xb0'));_0x55efd8[_0x91e6('0x4b')](_0x91e6('0xb1'),'Owner.fullname');_0x55efd8[_0x91e6('0x4b')]('o.internal',_0x91e6('0xb2'));_0x55efd8[_0x91e6('0x4b')](_0x91e6('0xb3'),_0x91e6('0x32'));}if(_0x47a129[_0x91e6('0x24')])_0x55efd8[_0x91e6('0x24')](_0x47a129['limit']);if(_0x47a129[_0x91e6('0x22')])_0x55efd8[_0x91e6('0x22')](_0x47a129['offset']);return db['sequelize']['query'](_0x55efd8[_0x91e6('0xa0')](),_0x204dc9);})[_0x91e6('0x2d')](function(_0x239bb5){if(_0x239bb5[_0x91e6('0x42')]>0x0)_0x30d708[_0x91e6('0x47')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0x91e6('0x38')](_0x239bb5,'id'));return db[_0x91e6('0x9f')]['query'](_0x30d708[_0x91e6('0xa0')](),_0x204dc9)[_0x91e6('0x2d')](function(_0x3e55f1){var _0x211cde=_[_0x91e6('0xb4')](_0x3e55f1,_0x91e6('0xb5'));var _0x4873ec=[];_0x239bb5[_0x91e6('0x35')](function(_0x5e12ef){_0x4873ec['push'](updateWhatsappInteraction(_0x5e12ef,_0x58896f,_0x211cde));});return BPromise[_0x91e6('0xb6')](_0x4873ec);});});})['then'](function(_0x4f780c){_0x5976cc[_0x91e6('0xb7')]=_0x4f780c;return _0x5976cc;})[_0x91e6('0x2d')](respondWithFilteredResult(_0x2358dc,_0x47a129))['catch'](handleError(_0x2358dc,null));};exports[_0x91e6('0xb8')]=function(_0x4d91f9,_0x3c258d){var _0x4565f8={'raw':![],'where':{'id':_0x4d91f9[_0x91e6('0xb9')]['id']}},_0x2b734f={};_0x2b734f['model']=_[_0x91e6('0x3d')](db[_0x91e6('0x39')][_0x91e6('0x3a')]);_0x2b734f[_0x91e6('0x3e')]=_['keys'](_0x4d91f9[_0x91e6('0x3e')]);_0x2b734f[_0x91e6('0x48')]=_['intersection'](_0x2b734f['model'],_0x2b734f[_0x91e6('0x3e')]);_0x4565f8['attributes']=_['intersection'](_0x2b734f[_0x91e6('0x3c')],qs['fields'](_0x4d91f9[_0x91e6('0x3e')][_0x91e6('0x40')]));_0x4565f8[_0x91e6('0x41')]=_0x4565f8[_0x91e6('0x41')][_0x91e6('0x42')]?_0x4565f8[_0x91e6('0x41')]:_0x2b734f[_0x91e6('0x3c')];if(_0x4d91f9[_0x91e6('0x3e')]['includeAll']){_0x4565f8[_0x91e6('0xba')]=[{'all':!![]}];}_0x4565f8=_[_0x91e6('0xa1')]({},_0x4565f8,_0x4d91f9[_0x91e6('0xbb')]);return db[_0x91e6('0x39')][_0x91e6('0x62')](_0x4565f8)[_0x91e6('0x2d')](handleEntityNotFound(_0x3c258d,null))[_0x91e6('0x2d')](respondWithResult(_0x3c258d,null))[_0x91e6('0x36')](handleError(_0x3c258d,null));};exports[_0x91e6('0xbc')]=function(_0x2ca989,_0x353faf){return db[_0x91e6('0x39')][_0x91e6('0xbc')](_0x2ca989[_0x91e6('0x79')],{})[_0x91e6('0x2d')](respondWithResult(_0x353faf,0xc9))['catch'](handleError(_0x353faf,null));};exports['update']=function(_0x51b6f9,_0x5491f8){if(_0x51b6f9[_0x91e6('0x79')]['id']){delete _0x51b6f9[_0x91e6('0x79')]['id'];}return db[_0x91e6('0x39')][_0x91e6('0x62')]({'where':{'id':_0x51b6f9[_0x91e6('0xb9')]['id']}})[_0x91e6('0x2d')](handleEntityNotFound(_0x5491f8,null))[_0x91e6('0x2d')](saveUpdates(_0x51b6f9[_0x91e6('0x79')],null))[_0x91e6('0x2d')](respondWithResult(_0x5491f8,null))[_0x91e6('0x36')](handleError(_0x5491f8,null));};exports[_0x91e6('0x2e')]=function(_0x3a1c6b,_0x5ae6c2){return db[_0x91e6('0x39')][_0x91e6('0x62')]({'where':{'id':_0x3a1c6b[_0x91e6('0xb9')]['id']}})[_0x91e6('0x2d')](handleEntityNotFound(_0x5ae6c2,null))['then'](removeEntity(_0x5ae6c2,null))['catch'](handleError(_0x5ae6c2,null));};exports['describe']=function(_0x55e744,_0xba8e11){return db[_0x91e6('0x39')][_0x91e6('0xbd')]()['then'](respondWithResult(_0xba8e11,null))[_0x91e6('0x36')](handleError(_0xba8e11,null));};exports[_0x91e6('0xbe')]=function(_0x316db6,_0x3dac20,_0x35ec1e){return db[_0x91e6('0xbf')][_0x91e6('0x62')]({'where':{'id':_0x316db6[_0x91e6('0xb9')]['id']}})['then'](handleEntityNotFound(_0x3dac20,null))[_0x91e6('0x2d')](function(_0x5ab858){if(_0x5ab858){return _0x5ab858['addMessage'](_0x316db6['body']['ids'],_[_0x91e6('0xc0')](_0x316db6[_0x91e6('0x79')],[_0x91e6('0xc1'),'id'])||{});}})[_0x91e6('0x2d')](respondWithResult(_0x3dac20,null))['catch'](handleError(_0x3dac20,null));};exports['getMessages']=function(_0x5dcb40,_0x12af90,_0x32a742){var _0x2f0379={'raw':![],'where':{}};var _0x49e1fc={};var _0x19541b={'count':0x0,'rows':[]};return db[_0x91e6('0x39')][_0x91e6('0xc2')]({'where':{'id':_0x5dcb40[_0x91e6('0xb9')]['id']}})[_0x91e6('0x2d')](handleEntityNotFound(_0x12af90,null))[_0x91e6('0x2d')](function(_0x524c1c){if(_0x524c1c){_0x49e1fc[_0x91e6('0x3c')]=_[_0x91e6('0x3d')](db[_0x91e6('0xbf')][_0x91e6('0x3a')]);_0x49e1fc['query']=_[_0x91e6('0x3d')](_0x5dcb40['query']);_0x49e1fc[_0x91e6('0x48')]=_['intersection'](_0x49e1fc[_0x91e6('0x3c')],_0x49e1fc['query']);_0x2f0379[_0x91e6('0x41')]=_[_0x91e6('0x3f')](_0x49e1fc[_0x91e6('0x3c')],qs[_0x91e6('0x40')](_0x5dcb40[_0x91e6('0x3e')][_0x91e6('0x40')]));_0x2f0379[_0x91e6('0x41')]=_0x2f0379[_0x91e6('0x41')][_0x91e6('0x42')]?_0x2f0379['attributes']:_0x49e1fc[_0x91e6('0x3c')];if(!_0x5dcb40['query'][_0x91e6('0x43')](_0x91e6('0x44'))){_0x2f0379[_0x91e6('0x24')]=qs[_0x91e6('0x24')](_0x5dcb40[_0x91e6('0x3e')][_0x91e6('0x24')]);_0x2f0379[_0x91e6('0x22')]=qs[_0x91e6('0x22')](_0x5dcb40['query'][_0x91e6('0x22')]);}_0x2f0379[_0x91e6('0x45')]=qs[_0x91e6('0x46')](_0x5dcb40[_0x91e6('0x3e')][_0x91e6('0x46')]);_0x2f0379['where']=qs[_0x91e6('0x48')](_[_0x91e6('0x49')](_0x5dcb40[_0x91e6('0x3e')],_0x49e1fc[_0x91e6('0x48')]));_0x2f0379[_0x91e6('0x47')]['WhatsappInteractionId']=_0x524c1c['id'];if(_0x5dcb40[_0x91e6('0x3e')][_0x91e6('0x8b')]){_0x2f0379[_0x91e6('0x47')]=_['merge'](_0x2f0379[_0x91e6('0x47')],{'$or':_['map'](_0x2f0379['attributes'],function(_0x3f8c00){var _0x4aefe2={};_0x4aefe2[_0x3f8c00]={'$like':'%'+_0x5dcb40[_0x91e6('0x3e')][_0x91e6('0x8b')]+'%'};return _0x4aefe2;})});}if(_0x5dcb40[_0x91e6('0x3e')][_0x91e6('0x81')]){var _0x3dcd51=_0x5dcb40[_0x91e6('0x3e')][_0x91e6('0x81')][_0x91e6('0x34')](',');var _0x230c21={};_0x230c21[_0x3dcd51[0x0]]={'$gte':moment(_0x3dcd51[0x1])[_0x91e6('0xc3')](_0x91e6('0xc4'))};_0x2f0379[_0x91e6('0x47')]=_['merge'](_0x2f0379[_0x91e6('0x47')],_0x230c21);}_0x2f0379=_[_0x91e6('0xa1')]({},_0x2f0379,_0x5dcb40[_0x91e6('0xbb')]);return db[_0x91e6('0xbf')][_0x91e6('0x25')]({'where':_0x2f0379[_0x91e6('0x47')]})[_0x91e6('0x2d')](function(_0x12c674){_0x19541b[_0x91e6('0x25')]=_0x12c674;if(_0x5dcb40['query']['includeAll']){_0x2f0379[_0x91e6('0xba')]=[{'all':!![]}];}return db[_0x91e6('0xbf')]['findAll'](_0x2f0379);})[_0x91e6('0x2d')](function(_0x5d43d9){_0x19541b[_0x91e6('0xb7')]=_0x5d43d9;return _0x19541b;});}})[_0x91e6('0x2d')](respondWithFilteredResult(_0x12af90,_0x2f0379))[_0x91e6('0x36')](handleError(_0x12af90,null));};exports[_0x91e6('0xc5')]=function(_0x581476,_0x7c4b35,_0x512fd7){return db[_0x91e6('0x39')]['find']({'where':{'id':_0x581476['params']['id']}})[_0x91e6('0x2d')](handleEntityNotFound(_0x7c4b35,null))[_0x91e6('0x2d')](function(_0x5eca38){if(_0x5eca38){return _0x5eca38[_0x91e6('0xc6')](_0x581476['body'][_0x91e6('0xc1')],_[_0x91e6('0xc0')](_0x581476[_0x91e6('0x79')],[_0x91e6('0xc1'),'id'])||{})[_0x91e6('0xc7')](function(){return db['Tag'][_0x91e6('0xc8')]({'attributes':['id',_0x91e6('0x30'),_0x91e6('0x4c')],'where':{'id':_0x581476[_0x91e6('0x79')][_0x91e6('0xc1')]}});})[_0x91e6('0x2d')](function(_0xa5ded3){socket[_0x91e6('0xc9')](_0x91e6('0xca'),{'id':Number(_0x581476[_0x91e6('0xb9')]['id']),'tags':_0xa5ded3||[]});return{'id':Number(_0x581476[_0x91e6('0xb9')]['id']),'tags':_0xa5ded3||[]};});}})['then'](respondWithResult(_0x7c4b35,null))[_0x91e6('0x36')](handleError(_0x7c4b35,null));};exports['removeTags']=function(_0x103e73,_0x363d57,_0x34e2f1){return db[_0x91e6('0x39')][_0x91e6('0x62')]({'where':{'id':_0x103e73['params']['id']}})[_0x91e6('0x2d')](handleEntityNotFound(_0x363d57,null))[_0x91e6('0x2d')](function(_0xd50e0b){if(_0xd50e0b){return _0xd50e0b[_0x91e6('0xcb')](_0x103e73[_0x91e6('0x3e')][_0x91e6('0xc1')]);}})[_0x91e6('0x2d')](respondWithStatusCode(_0x363d57,null))['catch'](handleError(_0x363d57,null));};exports['download']=function(_0x148cbb,_0x521c13){var _0x56bfe0=moment()[_0x91e6('0xcc')]()[_0x91e6('0xa0')]();var _0x57799d=path[_0x91e6('0xcd')](config[_0x91e6('0xce')],_0x91e6('0xcf'),_0x91e6('0xd0'),'tmp');var _0x496314=path['join'](config[_0x91e6('0xce')],_0x91e6('0xcf'),_0x91e6('0xd0'),_0x91e6('0xd1'));var _0x11ee7d=path[_0x91e6('0xcd')](_0x57799d,_0x56bfe0);var _0x1ea676=util['format']('transcript-%d-%s.zip',_0x148cbb['params']['id'],_0x56bfe0);var _0x2cba96=path[_0x91e6('0xcd')](_0x57799d,_0x1ea676);var _0x35c16f=[];_0x35c16f[_0x91e6('0xd2')]({'model':db[_0x91e6('0x73')],'as':_0x91e6('0x73'),'attributes':['id',_0x91e6('0xd3')],'raw':!![]});_0x35c16f[_0x91e6('0xd2')]({'model':db['CmContact'],'as':_0x91e6('0x68'),'attributes':['id',_0x91e6('0xd4'),_0x91e6('0xd5')],'raw':!![]});if(_0x148cbb[_0x91e6('0x3e')]['attachments']){_0x35c16f[_0x91e6('0xd2')]({'model':db['Attachment'],'as':_0x91e6('0xd6'),'raw':!![]});}var _0x3771d5=[{'model':db[_0x91e6('0xbf')],'as':'Messages','attributes':['id',_0x91e6('0x79'),_0x91e6('0x7f'),'direction',_0x91e6('0xd7'),_0x91e6('0x87')],'include':_0x35c16f}];_0x3771d5[_0x91e6('0xd2')]({'model':db['WhatsappAccount'],'as':_0x91e6('0xd8'),'attributes':['id',_0x91e6('0x30')]});_0x3771d5['push']({'model':db[_0x91e6('0x73')],'as':_0x91e6('0xd9'),'attributes':['id',_0x91e6('0xd3')]});return db[_0x91e6('0x39')]['find']({'where':{'id':_0x148cbb[_0x91e6('0xb9')]['id']},'include':_0x3771d5})[_0x91e6('0x2d')](handleEntityNotFound(_0x521c13,null))[_0x91e6('0x2d')](function(_0x5a82cc){if(_0x5a82cc){var _0x3d45fd=_0x5a82cc[_0x91e6('0xda')]({'plain':!![]});fs['mkdirSync'](_0x11ee7d);var _0x59e651={'channel':_0x91e6('0xdb'),'account':_0x3d45fd[_0x91e6('0xd8')][_0x91e6('0x30')],'agent':_0x3d45fd[_0x91e6('0xd9')]?_0x3d45fd[_0x91e6('0xd9')][_0x91e6('0xd3')]:'N.A.','createdAt':moment(_0x3d45fd[_0x91e6('0x7f')])['format'](_0x91e6('0xc4'))['toString'](),'closedAt':_0x3d45fd[_0x91e6('0xdc')]?moment(_0x3d45fd['closedAt'])[_0x91e6('0xc3')](_0x91e6('0xc4'))['toString']():'','disposition':_0x3d45fd['disposition'],'messages':_(_0x3d45fd['Messages'])[_0x91e6('0x8b')]({'secret':![]})['map'](function(_0x36484e){if(_0x36484e[_0x91e6('0xd6')]){var _0x4cb1de=path[_0x91e6('0xcd')](_0x496314,_0x36484e[_0x91e6('0xd6')][_0x91e6('0xdd')]);if(fs[_0x91e6('0xde')](_0x4cb1de)){fs[_0x91e6('0xdf')](_0x4cb1de)['pipe'](fs['createWriteStream'](path[_0x91e6('0xcd')](_0x11ee7d,_0x36484e[_0x91e6('0xd6')][_0x91e6('0xdd')])));}}return{'date':moment(_0x36484e[_0x91e6('0x7f')])[_0x91e6('0xc3')](_0x91e6('0xc4'))['toString'](),'sender':_0x36484e[_0x91e6('0xe0')]===_0x91e6('0xe1')?_0x36484e[_0x91e6('0x73')]?_0x36484e['User'][_0x91e6('0xd3')]:_0x91e6('0xe2'):_0x36484e[_0x91e6('0x68')][_0x91e6('0xd4')]+(_0x36484e[_0x91e6('0x68')][_0x91e6('0xd5')]?'\x20'+_0x36484e[_0x91e6('0x68')][_0x91e6('0xd5')]:''),'body':_0x36484e['Attachment']?_0x36484e[_0x91e6('0xd6')][_0x91e6('0xdd')]:_0x36484e[_0x91e6('0x79')],'direction':_0x36484e['direction']===_0x91e6('0xe1')?'A':'C','secret':_0x36484e[_0x91e6('0xd7')],'read':_0x36484e['read'],'attachment':_0x36484e[_0x91e6('0xd6')]};})[_0x91e6('0x64')]()};return ejs[_0x91e6('0xe3')](path[_0x91e6('0xcd')](config[_0x91e6('0xce')],_0x91e6('0xcf'),'views',_0x91e6('0xe4')),{'interaction':_0x59e651})[_0x91e6('0x2d')](function(_0x2e8bb2){var _0x5c0b1f=path['join'](_0x11ee7d,'transcript-'+_0x3d45fd['id']+'-'+_0x56bfe0+_0x91e6('0xe5'));var _0x595f9e={'path':_0x5c0b1f,'channel':'Whatsapp','interactionId':_0x3d45fd['id']};return pdf[_0x91e6('0xe6')](_0x2e8bb2,_0x595f9e);})[_0x91e6('0x2d')](function(){return new BPromise(function(_0x5cbb88,_0x2a9694){zipdir(_0x11ee7d,{'saveTo':_0x2cba96},function(_0x504d7f,_0x3799f0){if(_0x504d7f)return _0x2a9694(_0x504d7f);return _0x5cbb88(_0x3799f0);});})[_0x91e6('0x2d')](function(){return new BPromise(function(_0x7183b6,_0x65b01e){rimraf(_0x11ee7d,function(_0x5521e3){if(_0x5521e3)_0x65b01e(_0x5521e3);return _0x7183b6();});});})[_0x91e6('0x2d')](function(){return _0x521c13[_0x91e6('0xe7')](_0x2cba96,_0x1ea676,function(_0x148cb4){if(_0x148cb4){console[_0x91e6('0xe8')](_0x91e6('0xe9'),_0x148cb4);}else{fs[_0x91e6('0xea')](_0x2cba96);}});});});}else{return _0x521c13['sendStatus'](0xc8);}})['catch'](handleError(_0x521c13,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 81f1b95..bcbcefa 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 _0x4a47=['length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','save','remove','getUsers','Users','findAll','then','unreadMessages'];(function(_0x2422ab,_0x10726d){var _0x346d71=function(_0xd548ce){while(--_0xd548ce){_0x2422ab['push'](_0x2422ab['shift']());}};_0x346d71(++_0x10726d);}(_0x4a47,0xb5));var _0x74a4=function(_0x57e18a,_0x199383){_0x57e18a=_0x57e18a-0x0;var _0x1181c7=_0x4a47[_0x57e18a];return _0x1181c7;};'use strict';var EventEmitter=require(_0x74a4('0x0'));var WhatsappInteraction=require(_0x74a4('0x1'))['db'][_0x74a4('0x2')];var WhatsappMessage=require(_0x74a4('0x1'))['db'][_0x74a4('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x74a4('0x4'),'afterUpdate':'update','afterDestroy':_0x74a4('0x5')};function emitEvent(_0x450c10){return function(_0x5af655,_0x43080b,_0x3c6344){_0x5af655[_0x74a4('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x41ef5a){_0x5af655['setDataValue'](_0x74a4('0x7'),_0x41ef5a['map'](function(_0x39bbb4){return{'id':_0x39bbb4['id']};}));return WhatsappMessage[_0x74a4('0x8')]({'where':{'WhatsappInteractionId':_0x5af655['id'],'direction':'in','read':![]},'raw':!![]});})[_0x74a4('0x9')](function(_0x17c01f){_0x5af655['setDataValue'](_0x74a4('0xa'),_0x17c01f[_0x74a4('0xb')]);WhatsappInteractionEvents[_0x74a4('0xc')](_0x450c10+':'+_0x5af655['id'],_0x5af655);WhatsappInteractionEvents[_0x74a4('0xc')](_0x450c10,_0x5af655);_0x3c6344(null);})['catch'](_0x3c6344(null));};}for(var e in events){if(events[_0x74a4('0xd')](e)){var event=events[e];WhatsappInteraction[_0x74a4('0xe')](e,emitEvent(event));}}module[_0x74a4('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xa478=['unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','findAll'];(function(_0x3714c1,_0x47cf2b){var _0x26f4fa=function(_0xcce39a){while(--_0xcce39a){_0x3714c1['push'](_0x3714c1['shift']());}};_0x26f4fa(++_0x47cf2b);}(_0xa478,0x136));var _0x8a47=function(_0x827d61,_0x127d23){_0x827d61=_0x827d61-0x0;var _0x3d2398=_0xa478[_0x827d61];return _0x3d2398;};'use strict';var EventEmitter=require(_0x8a47('0x0'));var WhatsappInteraction=require(_0x8a47('0x1'))['db'][_0x8a47('0x2')];var WhatsappMessage=require(_0x8a47('0x1'))['db'][_0x8a47('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x8a47('0x4')](0x0);var events={'afterCreate':_0x8a47('0x5'),'afterUpdate':_0x8a47('0x6'),'afterDestroy':_0x8a47('0x7')};function emitEvent(_0x256550){return function(_0x6e2ab5,_0x46a4cd,_0x50226a){_0x6e2ab5[_0x8a47('0x8')]({'attributes':['id'],'raw':!![]})[_0x8a47('0x9')](function(_0x3de815){_0x6e2ab5[_0x8a47('0xa')]('Users',_0x3de815[_0x8a47('0xb')](function(_0x547fe7){return{'id':_0x547fe7['id']};}));return WhatsappMessage[_0x8a47('0xc')]({'where':{'WhatsappInteractionId':_0x6e2ab5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8a47('0x9')](function(_0x3a6cc4){_0x6e2ab5['setDataValue'](_0x8a47('0xd'),_0x3a6cc4[_0x8a47('0xe')]);WhatsappInteractionEvents['emit'](_0x256550+':'+_0x6e2ab5['id'],_0x6e2ab5);WhatsappInteractionEvents[_0x8a47('0xf')](_0x256550,_0x6e2ab5);_0x50226a(null);})['catch'](_0x50226a(null));};}for(var e in events){if(events[_0x8a47('0x10')](e)){var event=events[e];WhatsappInteraction[_0x8a47('0x11')](e,emitEvent(event));}}module[_0x8a47('0x12')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 8e87f2e..0c110b6 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 _0xd6aa=['path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','bluebird','request-promise'];(function(_0x30cf8d,_0x286354){var _0x92e924=function(_0x5ce89b){while(--_0x5ce89b){_0x30cf8d['push'](_0x30cf8d['shift']());}};_0x92e924(++_0x286354);}(_0xd6aa,0x182));var _0xad6a=function(_0x28e69f,_0x3ce461){_0x28e69f=_0x28e69f-0x0;var _0x1beff1=_0xd6aa[_0x28e69f];return _0x1beff1;};'use strict';var _=require(_0xad6a('0x0'));var util=require(_0xad6a('0x1'));var logger=require('../../config/logger')(_0xad6a('0x2'));var moment=require('moment');var BPromise=require(_0xad6a('0x3'));var rp=require(_0xad6a('0x4'));var fs=require('fs');var path=require(_0xad6a('0x5'));var rimraf=require(_0xad6a('0x6'));var config=require(_0xad6a('0x7'));var attributes=require(_0xad6a('0x8'));module[_0xad6a('0x9')]=function(_0x1dd43f,_0x29b5e2){return _0x1dd43f[_0xad6a('0xa')]('WhatsappInteraction',attributes,{'tableName':_0xad6a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x59ada9,_0x3d56d2,_0x55ae42){if(_0x59ada9[_0xad6a('0xc')](_0xad6a('0xd'))){_0x59ada9[_0xad6a('0xe')]=moment()[_0xad6a('0xf')](_0xad6a('0x10'));}_0x55ae42(null,_0x59ada9);}}});}; \ No newline at end of file +var _0x0655=['closed','closedAt','format','lodash','util','moment','bluebird','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','changed'];(function(_0x339ce5,_0x4ada6f){var _0x4980f5=function(_0x3a95a9){while(--_0x3a95a9){_0x339ce5['push'](_0x339ce5['shift']());}};_0x4980f5(++_0x4ada6f);}(_0x0655,0x81));var _0x5065=function(_0x39efbf,_0x118364){_0x39efbf=_0x39efbf-0x0;var _0xcbd510=_0x0655[_0x39efbf];return _0xcbd510;};'use strict';var _=require(_0x5065('0x0'));var util=require(_0x5065('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5065('0x2'));var BPromise=require(_0x5065('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5065('0x4'));var config=require(_0x5065('0x5'));var attributes=require(_0x5065('0x6'));module[_0x5065('0x7')]=function(_0xafb104,_0x34c4a0){return _0xafb104['define'](_0x5065('0x8'),attributes,{'tableName':_0x5065('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1d229a,_0x492401,_0x1dbaff){if(_0x1d229a[_0x5065('0xa')](_0x5065('0xb'))){_0x1d229a[_0x5065('0xc')]=moment()[_0x5065('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1dbaff(null,_0x1d229a);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 0986fe5..4347738 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 _0xf280=['info','WhatsappInteraction,\x20%s,\x20%s','debug','request\x20sent','error','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','options','attributes','limit','stringify','catch','find','where','addTags','body','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then'];(function(_0x1e048c,_0x132d80){var _0x4256b7=function(_0x17809b){while(--_0x17809b){_0x1e048c['push'](_0x1e048c['shift']());}};_0x4256b7(++_0x132d80);}(_0xf280,0x113));var _0x0f28=function(_0x4fd109,_0x33c503){_0x4fd109=_0x4fd109-0x0;var _0x30f0a6=_0xf280[_0x4fd109];return _0x30f0a6;};'use strict';var _=require(_0x0f28('0x0'));var util=require('util');var moment=require(_0x0f28('0x1'));var BPromise=require(_0x0f28('0x2'));var rs=require(_0x0f28('0x3'));var fs=require('fs');var Redis=require(_0x0f28('0x4'));var db=require(_0x0f28('0x5'))['db'];var utils=require(_0x0f28('0x6'));var logger=require('../../config/logger')(_0x0f28('0x7'));var config=require(_0x0f28('0x8'));var jayson=require(_0x0f28('0x9'));var client=jayson[_0x0f28('0xa')][_0x0f28('0xb')]({'port':0x232a});config[_0x0f28('0xc')]=_[_0x0f28('0xd')](config[_0x0f28('0xc')],{'host':_0x0f28('0xe'),'port':0x18eb});var socket=require(_0x0f28('0xf'))(new Redis(config[_0x0f28('0xc')]));require('./whatsappInteraction.socket')[_0x0f28('0x10')](socket);function respondWithRpcPromise(_0xf760cd,_0x1fbd0d,_0x3badba){return new BPromise(function(_0x91821c,_0x5246cb){return client[_0x0f28('0x11')](_0xf760cd,_0x3badba)[_0x0f28('0x12')](function(_0x1ffeab){logger[_0x0f28('0x13')](_0x0f28('0x14'),_0x1fbd0d,'request\x20sent');logger[_0x0f28('0x15')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x1fbd0d,_0x0f28('0x16'),JSON['stringify'](_0x1ffeab));if(_0x1ffeab[_0x0f28('0x17')]){if(_0x1ffeab['error']['code']===0x1f4){logger['error'](_0x0f28('0x14'),_0x1fbd0d,_0x1ffeab[_0x0f28('0x17')]['message']);return _0x5246cb(_0x1ffeab['error'][_0x0f28('0x18')]);}logger[_0x0f28('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x1fbd0d,_0x1ffeab[_0x0f28('0x17')][_0x0f28('0x18')]);return _0x91821c(_0x1ffeab['error'][_0x0f28('0x18')]);}else{logger[_0x0f28('0x13')](_0x0f28('0x14'),_0x1fbd0d,_0x0f28('0x16'));_0x91821c(_0x1ffeab[_0x0f28('0x19')][_0x0f28('0x18')]);}})['catch'](function(_0x24b4d0){logger['error'](_0x0f28('0x14'),_0x1fbd0d,_0x24b4d0);_0x5246cb(_0x24b4d0);});});}exports[_0x0f28('0x1a')]=function(_0x3c234e){var _0x28f243=this;return new Promise(function(_0x4888e9,_0x2cace8){return db[_0x0f28('0x1b')][_0x0f28('0x1c')](_0x3c234e['body'],{'raw':_0x3c234e[_0x0f28('0x1d')]?_0x3c234e[_0x0f28('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c234e[_0x0f28('0x1d')]?_0x3c234e['options']['where']||null:null,'attributes':_0x3c234e['options']?_0x3c234e[_0x0f28('0x1d')][_0x0f28('0x1e')]||null:null,'limit':_0x3c234e[_0x0f28('0x1d')]?_0x3c234e[_0x0f28('0x1d')][_0x0f28('0x1f')]||null:null})[_0x0f28('0x12')](function(_0x12b831){logger[_0x0f28('0x13')](_0x0f28('0x1a'),_0x3c234e);logger[_0x0f28('0x15')](_0x0f28('0x1a'),_0x3c234e,JSON[_0x0f28('0x20')](_0x12b831));_0x4888e9(_0x12b831);})[_0x0f28('0x21')](function(_0x284a8a){logger[_0x0f28('0x17')](_0x0f28('0x1a'),_0x284a8a[_0x0f28('0x18')],_0x3c234e);_0x2cace8(_0x28f243[_0x0f28('0x17')](0x1f4,_0x284a8a['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x23bbd4){return new Promise(function(_0x40dc35,_0x5048a0){return db[_0x0f28('0x1b')][_0x0f28('0x22')]({'where':_0x23bbd4['options']?_0x23bbd4['options'][_0x0f28('0x23')]||null:null})['then'](function(_0x3e9d3e){if(_0x3e9d3e){return _0x3e9d3e[_0x0f28('0x24')](_0x23bbd4[_0x0f28('0x25')][_0x0f28('0x26')],_[_0x0f28('0x27')](_0x23bbd4[_0x0f28('0x25')],[_0x0f28('0x26'),'id'])||{});}})[_0x0f28('0x28')](function(_0xf5b94c){logger['info']('AddTags',_0x23bbd4);logger[_0x0f28('0x15')](_0x0f28('0x29'),_0x23bbd4,JSON[_0x0f28('0x20')](_0xf5b94c));_0x40dc35(_0xf5b94c);})[_0x0f28('0x21')](function(_0x2bc2ba){logger['error'](_0x0f28('0x29'),_0x2bc2ba[_0x0f28('0x18')],_0x23bbd4);_0x5048a0(_this[_0x0f28('0x17')](0x1f4,_0x2bc2ba[_0x0f28('0x18')]));});});}; \ No newline at end of file +var _0x1990=['message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','debug','find','addTags','ids','omit','spread','AddTags','util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','redis','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1990,0xb7));var _0x0199=function(_0x13b6d4,_0x57c343){_0x13b6d4=_0x13b6d4-0x0;var _0xd9f5dd=_0x1990[_0x13b6d4];return _0xd9f5dd;};'use strict';var _=require('lodash');var util=require(_0x0199('0x0'));var moment=require(_0x0199('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0199('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0199('0x3'));var logger=require(_0x0199('0x4'))(_0x0199('0x5'));var config=require('../../config/environment');var jayson=require(_0x0199('0x6'));var client=jayson[_0x0199('0x7')][_0x0199('0x8')]({'port':0x232a});config['redis']=_[_0x0199('0x9')](config['redis'],{'host':_0x0199('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0199('0xb')]));require(_0x0199('0xc'))[_0x0199('0xd')](socket);function respondWithRpcPromise(_0x582279,_0x20e54b,_0x4b5559){return new BPromise(function(_0x1c8b4f,_0x3ca044){return client[_0x0199('0xe')](_0x582279,_0x4b5559)[_0x0199('0xf')](function(_0xf31c86){logger[_0x0199('0x10')](_0x0199('0x11'),_0x20e54b,_0x0199('0x12'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x20e54b,_0x0199('0x12'),JSON[_0x0199('0x13')](_0xf31c86));if(_0xf31c86[_0x0199('0x14')]){if(_0xf31c86[_0x0199('0x14')][_0x0199('0x15')]===0x1f4){logger['error'](_0x0199('0x11'),_0x20e54b,_0xf31c86[_0x0199('0x14')]['message']);return _0x3ca044(_0xf31c86['error'][_0x0199('0x16')]);}logger[_0x0199('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x20e54b,_0xf31c86[_0x0199('0x14')][_0x0199('0x16')]);return _0x1c8b4f(_0xf31c86[_0x0199('0x14')]['message']);}else{logger[_0x0199('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x20e54b,_0x0199('0x12'));_0x1c8b4f(_0xf31c86[_0x0199('0x17')]['message']);}})[_0x0199('0x18')](function(_0x175da8){logger['error'](_0x0199('0x11'),_0x20e54b,_0x175da8);_0x3ca044(_0x175da8);});});}exports[_0x0199('0x19')]=function(_0x34f788){var _0x46666a=this;return new Promise(function(_0x471a42,_0x458208){return db[_0x0199('0x1a')][_0x0199('0x1b')](_0x34f788[_0x0199('0x1c')],{'raw':_0x34f788[_0x0199('0x1d')]?_0x34f788[_0x0199('0x1d')][_0x0199('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34f788[_0x0199('0x1d')]?_0x34f788[_0x0199('0x1d')][_0x0199('0x1f')]||null:null,'attributes':_0x34f788[_0x0199('0x1d')]?_0x34f788['options'][_0x0199('0x20')]||null:null,'limit':_0x34f788[_0x0199('0x1d')]?_0x34f788[_0x0199('0x1d')][_0x0199('0x21')]||null:null})['then'](function(_0x465c6d){logger['info'](_0x0199('0x19'),_0x34f788);logger[_0x0199('0x22')]('UpdateWhatsappInteraction',_0x34f788,JSON[_0x0199('0x13')](_0x465c6d));_0x471a42(_0x465c6d);})[_0x0199('0x18')](function(_0xb28fe1){logger['error'](_0x0199('0x19'),_0xb28fe1[_0x0199('0x16')],_0x34f788);_0x458208(_0x46666a[_0x0199('0x14')](0x1f4,_0xb28fe1[_0x0199('0x16')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x20bf54){return new Promise(function(_0x57a736,_0x40fe99){return db['WhatsappInteraction'][_0x0199('0x23')]({'where':_0x20bf54[_0x0199('0x1d')]?_0x20bf54[_0x0199('0x1d')]['where']||null:null})[_0x0199('0xf')](function(_0x5ed9fc){if(_0x5ed9fc){return _0x5ed9fc[_0x0199('0x24')](_0x20bf54['body'][_0x0199('0x25')],_[_0x0199('0x26')](_0x20bf54[_0x0199('0x1c')],[_0x0199('0x25'),'id'])||{});}})[_0x0199('0x27')](function(_0x54ea88){logger['info'](_0x0199('0x28'),_0x20bf54);logger[_0x0199('0x22')](_0x0199('0x28'),_0x20bf54,JSON['stringify'](_0x54ea88));_0x57a736(_0x54ea88);})[_0x0199('0x18')](function(_0x2472f9){logger['error'](_0x0199('0x28'),_0x2472f9[_0x0199('0x16')],_0x20bf54);_0x40fe99(_this['error'](0x1f4,_0x2472f9[_0x0199('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index b69711f..036d7d8 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 _0xe893=['emit','removeListener','length','./whatsappInteraction.events','save','remove'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xe893,0x17d));var _0x3e89=function(_0x2dac5e,_0x50d131){_0x2dac5e=_0x2dac5e-0x0;var _0x2b27a3=_0xe893[_0x2dac5e];return _0x2b27a3;};'use strict';var WhatsappInteractionEvents=require(_0x3e89('0x0'));var events=[_0x3e89('0x1'),_0x3e89('0x2'),'update'];function createListener(_0x1701e3,_0x27ff0e){return function(_0xc090e6){_0x27ff0e[_0x3e89('0x3')](_0x1701e3,_0xc090e6);};}function removeListener(_0xddb248,_0x3b94fd){return function(){WhatsappInteractionEvents[_0x3e89('0x4')](_0xddb248,_0x3b94fd);};}exports['register']=function(_0x568018){for(var _0x3d386a=0x0,_0x38f283=events[_0x3e89('0x5')];_0x3d386a<_0x38f283;_0x3d386a++){var _0xa52696=events[_0x3d386a];var _0x41fea7=createListener('whatsappInteraction:'+_0xa52696,_0x568018);WhatsappInteractionEvents['on'](_0xa52696,_0x41fea7);}}; \ No newline at end of file +var _0x519f=['update','emit','register','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x51d8f8,_0x5b2c78){var _0x4227bd=function(_0x17d27a){while(--_0x17d27a){_0x51d8f8['push'](_0x51d8f8['shift']());}};_0x4227bd(++_0x5b2c78);}(_0x519f,0x158));var _0xf519=function(_0x2567f1,_0x35cb11){_0x2567f1=_0x2567f1-0x0;var _0x4bdd=_0x519f[_0x2567f1];return _0x4bdd;};'use strict';var WhatsappInteractionEvents=require(_0xf519('0x0'));var events=['save','remove',_0xf519('0x1')];function createListener(_0x184ee8,_0x4b3f2f){return function(_0x456b9a){_0x4b3f2f[_0xf519('0x2')](_0x184ee8,_0x456b9a);};}function removeListener(_0x2b7770,_0x54e748){return function(){WhatsappInteractionEvents['removeListener'](_0x2b7770,_0x54e748);};}exports[_0xf519('0x3')]=function(_0x6d6410){for(var _0x2a9cc7=0x0,_0x599959=events['length'];_0x2a9cc7<_0x599959;_0x2a9cc7++){var _0xa66dff=events[_0x2a9cc7];var _0x1d41f9=createListener(_0xf519('0x4')+_0xa66dff,_0x6d6410);WhatsappInteractionEvents['on'](_0xa66dff,_0x1d41f9);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 742e5fe..c445cbc 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 _0xf9a2=['post','tracked','create','/:id/status','put','update','/:id/accept','/:id/reject','destroy','exports','multer','util','connect-timeout','express','../../config/environment','./whatsappMessage.controller','isAuthenticated','index','get','/describe','/:id'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf9a2,0x73));var _0x2f9a=function(_0x2b4862,_0xf2341c){_0x2b4862=_0x2b4862-0x0;var _0x4d7686=_0xf9a2[_0x2b4862];return _0x4d7686;};'use strict';var multer=require(_0x2f9a('0x0'));var util=require(_0x2f9a('0x1'));var path=require('path');var timeout=require(_0x2f9a('0x2'));var express=require(_0x2f9a('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(_0x2f9a('0x4'));var controller=require(_0x2f9a('0x5'));router['get']('/',auth[_0x2f9a('0x6')](),controller[_0x2f9a('0x7')]);router[_0x2f9a('0x8')](_0x2f9a('0x9'),auth[_0x2f9a('0x6')](),controller['describe']);router[_0x2f9a('0x8')](_0x2f9a('0xa'),auth[_0x2f9a('0x6')](),controller['show']);router[_0x2f9a('0xb')]('/',auth['isAuthenticated'](),interaction[_0x2f9a('0xc')]('whatsapp','whatsappmessage:create'),controller[_0x2f9a('0xd')]);router[_0x2f9a('0xb')](_0x2f9a('0xe'),controller['status']);router[_0x2f9a('0xf')](_0x2f9a('0xa'),auth[_0x2f9a('0x6')](),controller[_0x2f9a('0x10')]);router[_0x2f9a('0xf')](_0x2f9a('0x11'),auth[_0x2f9a('0x6')](),controller['accept']);router[_0x2f9a('0xf')](_0x2f9a('0x12'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x2f9a('0xa'),auth['isAuthenticated'](),controller[_0x2f9a('0x13')]);module[_0x2f9a('0x14')]=router; \ No newline at end of file +var _0xe480=['isAuthenticated','show','post','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','index','describe','/:id'];(function(_0x189d3c,_0x5efebf){var _0x485959=function(_0x1161da){while(--_0x1161da){_0x189d3c['push'](_0x189d3c['shift']());}};_0x485959(++_0x5efebf);}(_0xe480,0x12d));var _0x0e48=function(_0x59e8cf,_0x7d197e){_0x59e8cf=_0x59e8cf-0x0;var _0x2b408d=_0xe480[_0x59e8cf];return _0x2b408d;};'use strict';var multer=require('multer');var util=require(_0x0e48('0x0'));var path=require('path');var timeout=require(_0x0e48('0x1'));var express=require('express');var router=express[_0x0e48('0x2')]();var fs_extra=require(_0x0e48('0x3'));var auth=require(_0x0e48('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0e48('0x5'));var controller=require(_0x0e48('0x6'));router[_0x0e48('0x7')]('/',auth['isAuthenticated'](),controller[_0x0e48('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x0e48('0x9')]);router[_0x0e48('0x7')](_0x0e48('0xa'),auth[_0x0e48('0xb')](),controller[_0x0e48('0xc')]);router[_0x0e48('0xd')]('/',auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0x0e48('0xe')),controller[_0x0e48('0xf')]);router[_0x0e48('0xd')](_0x0e48('0x10'),controller[_0x0e48('0x11')]);router[_0x0e48('0x12')](_0x0e48('0xa'),auth[_0x0e48('0xb')](),controller[_0x0e48('0x13')]);router[_0x0e48('0x12')](_0x0e48('0x14'),auth[_0x0e48('0xb')](),controller[_0x0e48('0x15')]);router['put'](_0x0e48('0x16'),auth['isAuthenticated'](),controller[_0x0e48('0x17')]);router[_0x0e48('0x18')](_0x0e48('0xa'),auth['isAuthenticated'](),controller[_0x0e48('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 51dddb9..ac739c4 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 _0x8b3b=['BOOLEAN','ENUM','out','STRING','DATE','TEXT','exports','medium'];(function(_0x4241fb,_0x3c4d22){var _0x3d817a=function(_0x1ed7de){while(--_0x1ed7de){_0x4241fb['push'](_0x4241fb['shift']());}};_0x3d817a(++_0x3c4d22);}(_0x8b3b,0x6e));var _0xb8b3=function(_0x1af1e1,_0x37bc24){_0x1af1e1=_0x1af1e1-0x0;var _0x5f3450=_0x8b3b[_0x1af1e1];return _0x5f3450;};'use strict';var Sequelize=require('sequelize');module[_0xb8b3('0x0')]={'body':{'type':Sequelize['TEXT'](_0xb8b3('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xb8b3('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb8b3('0x3')]('in',_0xb8b3('0x4')),'defaultValue':_0xb8b3('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb8b3('0x5')](0xbe)},'phone':{'type':Sequelize[_0xb8b3('0x5')]},'readAt':{'type':Sequelize[_0xb8b3('0x6')]},'secret':{'type':Sequelize[_0xb8b3('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xb8b3('0x7')]}}; \ No newline at end of file +var _0xcb6e=['STRING','BOOLEAN','sequelize','exports','TEXT','medium','ENUM','out'];(function(_0x2eb57e,_0x1a638e){var _0x284e5d=function(_0x52ff9a){while(--_0x52ff9a){_0x2eb57e['push'](_0x2eb57e['shift']());}};_0x284e5d(++_0x1a638e);}(_0xcb6e,0x102));var _0xecb6=function(_0x54c0cf,_0x2f6929){_0x54c0cf=_0x54c0cf-0x0;var _0x26ace7=_0xcb6e[_0x54c0cf];return _0x26ace7;};'use strict';var Sequelize=require(_0xecb6('0x0'));module[_0xecb6('0x1')]={'body':{'type':Sequelize[_0xecb6('0x2')](_0xecb6('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xecb6('0x4')]('in','out'),'defaultValue':_0xecb6('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xecb6('0x6')](0xbe)},'phone':{'type':Sequelize[_0xecb6('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xecb6('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xecb6('0x6')]},'providerResponse':{'type':Sequelize[_0xecb6('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index ee31ae3..46818aa 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 _0x28a0=['request-promise','bluebird','sox','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/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','http','client','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','rows','show','params','find','create','body','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','WhatsappInteraction','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','ContactId','SELECT','contact','User','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','get','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','fullname','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','type','inspect','MessageSid','messageId','MessageStatus','twilio','eml-format','zip-dir','fast-json-patch'];(function(_0x3d80c2,_0xe454ae){var _0x4df19b=function(_0x249f46){while(--_0x249f46){_0x3d80c2['push'](_0x3d80c2['shift']());}};_0x4df19b(++_0xe454ae);}(_0x28a0,0x8a));var _0x028a=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x28a0[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x028a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x028a('0x1'));var jsonpatch=require(_0x028a('0x2'));var rp=require(_0x028a('0x3'));var moment=require('moment');var BPromise=require(_0x028a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x028a('0x5'));var csv=require('to-csv');var ejs=require(_0x028a('0x6'));var fs=require('fs');var fs_extra=require(_0x028a('0x7'));var _=require(_0x028a('0x8'));var squel=require(_0x028a('0x9'));var crypto=require(_0x028a('0xa'));var jsforce=require(_0x028a('0xb'));var deskjs=require(_0x028a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x028a('0xd'));var Papa=require(_0x028a('0xe'));var Redis=require(_0x028a('0xf'));var authService=require(_0x028a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x028a('0x11'));var hardwareService=require(_0x028a('0x12'));var logger=require(_0x028a('0x13'))(_0x028a('0x14'));var utils=require('../../config/utils');var config=require(_0x028a('0x15'));var licenseUtil=require(_0x028a('0x16'));var db=require(_0x028a('0x17'))['db'];config[_0x028a('0x18')]=_[_0x028a('0x19')](config[_0x028a('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x028a('0x1a'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0x028a('0x1b')](socket);var jayson=require(_0x028a('0x1c'));var client=jayson['client'][_0x028a('0x1d')]({'port':0x232c});var client9002=jayson[_0x028a('0x1e')][_0x028a('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5f2456,_0x56e61c,_0x4e7340,_0x301769){return new BPromise(function(_0x44cf0a,_0x280744){var _0xe72ee1=_0x301769||client;return _0xe72ee1[_0x028a('0x1f')](_0x5f2456,_0x4e7340)[_0x028a('0x20')](function(_0x295157){logger[_0x028a('0x21')](_0x028a('0x22'),_0x56e61c,_0x028a('0x23'));logger['debug'](_0x028a('0x24'),_0x56e61c,_0x028a('0x23'),JSON[_0x028a('0x25')](_0x295157));if(_0x295157['error']){if(_0x295157['error'][_0x028a('0x26')]===0x1f4){logger[_0x028a('0x27')](_0x028a('0x22'),_0x56e61c,_0x295157[_0x028a('0x27')]['message']);return _0x280744(_0x295157[_0x028a('0x27')][_0x028a('0x28')]);}logger[_0x028a('0x27')](_0x028a('0x22'),_0x56e61c,_0x295157['error']['message']);return _0x44cf0a(_0x295157['error']['message']);}else{logger[_0x028a('0x21')](_0x028a('0x22'),_0x56e61c,'request\x20sent');_0x44cf0a(_0x295157[_0x028a('0x29')][_0x028a('0x28')]);}})[_0x028a('0x2a')](function(_0x1f7aea){logger[_0x028a('0x27')](_0x028a('0x22'),_0x56e61c,_0x1f7aea);_0x280744(_0x1f7aea);});});}function respondWithStatusCode(_0x8e22d6,_0x1e187a){_0x1e187a=_0x1e187a||0xcc;return function(_0x5ea646){if(_0x5ea646){return _0x8e22d6[_0x028a('0x2b')](_0x1e187a);}return _0x8e22d6[_0x028a('0x2c')](_0x1e187a)[_0x028a('0x2d')]();};}function respondWithResult(_0x56a92b,_0x40c0fd){_0x40c0fd=_0x40c0fd||0xc8;return function(_0x36a06e){if(_0x36a06e){return _0x56a92b[_0x028a('0x2c')](_0x40c0fd)[_0x028a('0x2e')](_0x36a06e);}};}function respondWithFilteredResult(_0x1cb348,_0x5be0a8){return function(_0x20e12d){if(_0x20e12d){var _0x35acca=typeof _0x5be0a8[_0x028a('0x2f')]===_0x028a('0x30')&&typeof _0x5be0a8[_0x028a('0x31')]===_0x028a('0x30');var _0x5f0b49=_0x20e12d[_0x028a('0x32')];var _0x1aa231=_0x35acca?0x0:_0x5be0a8[_0x028a('0x2f')];var _0x80c0a8=_0x35acca?_0x20e12d[_0x028a('0x32')]:_0x5be0a8[_0x028a('0x2f')]+_0x5be0a8[_0x028a('0x31')];var _0x4f4c4f;if(_0x80c0a8>=_0x5f0b49){_0x80c0a8=_0x5f0b49;_0x4f4c4f=0xc8;}else{_0x4f4c4f=0xce;}_0x1cb348['status'](_0x4f4c4f);return _0x1cb348[_0x028a('0x33')](_0x028a('0x34'),_0x1aa231+'-'+_0x80c0a8+'/'+_0x5f0b49)['json'](_0x20e12d);}return null;};}function patchUpdates(_0x4b5984){return function(_0x495ef1){try{jsonpatch[_0x028a('0x35')](_0x495ef1,_0x4b5984,!![]);}catch(_0x56f9c2){return BPromise[_0x028a('0x36')](_0x56f9c2);}return _0x495ef1[_0x028a('0x37')]();};}function saveUpdates(_0xc62862,_0x483af9){return function(_0x5305bb){if(_0x5305bb){return _0x5305bb[_0x028a('0x38')](_0xc62862)[_0x028a('0x20')](function(_0x404e1b){return _0x404e1b;});}return null;};}function removeEntity(_0x33e1d2,_0xf3782d){return function(_0x2278bc){if(_0x2278bc){return _0x2278bc[_0x028a('0x39')]()[_0x028a('0x20')](function(){_0x33e1d2[_0x028a('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ace62,_0xd862d4){return function(_0x228c3e){if(!_0x228c3e){_0x5ace62['sendStatus'](0x194);}return _0x228c3e;};}function handleError(_0x394899,_0x4515ad){_0x4515ad=_0x4515ad||0x1f4;return function(_0x18cc7a){logger['error'](_0x18cc7a[_0x028a('0x3a')]);if(_0x18cc7a[_0x028a('0x3b')]){delete _0x18cc7a[_0x028a('0x3b')];}_0x394899['status'](_0x4515ad)[_0x028a('0x3c')](_0x18cc7a);};}exports[_0x028a('0x3d')]=function(_0x7f1706,_0x5e0ac3){var _0x5200b6={},_0x479f6d={},_0x34a738={'count':0x0,'rows':[]};var _0x53ee13=_[_0x028a('0x3e')](db[_0x028a('0x3f')][_0x028a('0x40')],function(_0x3060e0){return{'name':_0x3060e0[_0x028a('0x41')],'type':_0x3060e0['type']['key']};});_0x479f6d[_0x028a('0x42')]=_['map'](_0x53ee13,_0x028a('0x3b'));_0x479f6d[_0x028a('0x43')]=_[_0x028a('0x44')](_0x7f1706[_0x028a('0x43')]);_0x479f6d[_0x028a('0x45')]=_[_0x028a('0x46')](_0x479f6d[_0x028a('0x42')],_0x479f6d[_0x028a('0x43')]);_0x5200b6[_0x028a('0x47')]=_['intersection'](_0x479f6d['model'],qs['fields'](_0x7f1706[_0x028a('0x43')][_0x028a('0x48')]));_0x5200b6['attributes']=_0x5200b6[_0x028a('0x47')][_0x028a('0x49')]?_0x5200b6['attributes']:_0x479f6d[_0x028a('0x42')];if(!_0x7f1706[_0x028a('0x43')][_0x028a('0x4a')](_0x028a('0x4b'))){_0x5200b6[_0x028a('0x31')]=qs['limit'](_0x7f1706[_0x028a('0x43')]['limit']);_0x5200b6['offset']=qs[_0x028a('0x2f')](_0x7f1706['query'][_0x028a('0x2f')]);}_0x5200b6[_0x028a('0x4c')]=qs['sort'](_0x7f1706[_0x028a('0x43')][_0x028a('0x4d')]);_0x5200b6[_0x028a('0x4e')]=qs[_0x028a('0x45')](_[_0x028a('0x4f')](_0x7f1706[_0x028a('0x43')],_0x479f6d[_0x028a('0x45')]),_0x53ee13);if(_0x7f1706[_0x028a('0x43')][_0x028a('0x50')]){_0x5200b6[_0x028a('0x4e')]=_['merge'](_0x5200b6[_0x028a('0x4e')],{'$or':_[_0x028a('0x3e')](_0x53ee13,function(_0x3bc316){if(_0x3bc316['type']!==_0x028a('0x51')){var _0x220d04={};_0x220d04[_0x3bc316['name']]={'$like':'%'+_0x7f1706[_0x028a('0x43')]['filter']+'%'};return _0x220d04;}})});}_0x5200b6=_[_0x028a('0x52')]({},_0x5200b6,_0x7f1706['options']);var _0xa92dd7={'where':_0x5200b6['where']};return db[_0x028a('0x3f')]['count'](_0xa92dd7)[_0x028a('0x20')](function(_0x24bc9c){_0x34a738['count']=_0x24bc9c;if(_0x7f1706['query'][_0x028a('0x53')]){_0x5200b6[_0x028a('0x54')]=[{'all':!![]}];}return db[_0x028a('0x3f')]['findAll'](_0x5200b6);})[_0x028a('0x20')](function(_0x929c0){_0x34a738[_0x028a('0x55')]=_0x929c0;return _0x34a738;})[_0x028a('0x20')](respondWithFilteredResult(_0x5e0ac3,_0x5200b6))['catch'](handleError(_0x5e0ac3,null));};exports[_0x028a('0x56')]=function(_0x1f103f,_0x307936){var _0x19c976={'raw':!![],'where':{'id':_0x1f103f[_0x028a('0x57')]['id']}},_0x4ed10a={};_0x4ed10a['model']=_[_0x028a('0x44')](db[_0x028a('0x3f')][_0x028a('0x40')]);_0x4ed10a[_0x028a('0x43')]=_[_0x028a('0x44')](_0x1f103f[_0x028a('0x43')]);_0x4ed10a[_0x028a('0x45')]=_[_0x028a('0x46')](_0x4ed10a[_0x028a('0x42')],_0x4ed10a[_0x028a('0x43')]);_0x19c976['attributes']=_[_0x028a('0x46')](_0x4ed10a['model'],qs[_0x028a('0x48')](_0x1f103f['query'][_0x028a('0x48')]));_0x19c976[_0x028a('0x47')]=_0x19c976[_0x028a('0x47')][_0x028a('0x49')]?_0x19c976[_0x028a('0x47')]:_0x4ed10a['model'];if(_0x1f103f[_0x028a('0x43')][_0x028a('0x53')]){_0x19c976[_0x028a('0x54')]=[{'all':!![]}];}_0x19c976=_[_0x028a('0x52')]({},_0x19c976,_0x1f103f['options']);return db['WhatsappMessage'][_0x028a('0x58')](_0x19c976)[_0x028a('0x20')](handleEntityNotFound(_0x307936,null))[_0x028a('0x20')](respondWithResult(_0x307936,null))['catch'](handleError(_0x307936,null));};exports[_0x028a('0x59')]=function(_0x2401d1,_0x13da60){return db[_0x028a('0x3f')][_0x028a('0x59')](_0x2401d1[_0x028a('0x5a')],{})[_0x028a('0x20')](respondWithResult(_0x13da60,0xc9))[_0x028a('0x2a')](handleError(_0x13da60,null));};exports[_0x028a('0x38')]=function(_0x1ea238,_0x332f6c){if(_0x1ea238[_0x028a('0x5a')]['id']){delete _0x1ea238[_0x028a('0x5a')]['id'];}return db[_0x028a('0x3f')][_0x028a('0x58')]({'where':{'id':_0x1ea238[_0x028a('0x57')]['id']}})['then'](handleEntityNotFound(_0x332f6c,null))[_0x028a('0x20')](saveUpdates(_0x1ea238['body'],null))['then'](respondWithResult(_0x332f6c,null))['catch'](handleError(_0x332f6c,null));};exports[_0x028a('0x39')]=function(_0x1ac724,_0x311c43){return db['WhatsappMessage'][_0x028a('0x58')]({'where':{'id':_0x1ac724[_0x028a('0x57')]['id']}})[_0x028a('0x20')](handleEntityNotFound(_0x311c43,null))[_0x028a('0x20')](removeEntity(_0x311c43,null))[_0x028a('0x2a')](handleError(_0x311c43,null));};exports['describe']=function(_0xc033d4,_0x484140){return db[_0x028a('0x3f')][_0x028a('0x5b')]()[_0x028a('0x20')](respondWithResult(_0x484140,null))[_0x028a('0x2a')](handleError(_0x484140,null));};var interaction_log=require('../../config/logger')(_0x028a('0x5c'));exports[_0x028a('0x5d')]=function(_0x52992c,_0x525f0c,_0x15e556){var _0x1d6da9={'agent':{},'channel':_0x028a('0x5e')};if(_0x52992c[_0x028a('0x5a')]['id']){delete _0x52992c[_0x028a('0x5a')]['id'];}_0x52992c[_0x028a('0x5a')][_0x028a('0x5f')]=!![];_0x52992c[_0x028a('0x5a')][_0x028a('0x60')]=moment()[_0x028a('0x61')](_0x028a('0x62'));_0x52992c[_0x028a('0x5a')]['UserId']=_0x52992c[_0x028a('0x5a')][_0x028a('0x63')]||_0x52992c['user']['id'];_0x1d6da9[_0x028a('0x64')]['id']=_0x52992c[_0x028a('0x5a')]['UserId'];return db[_0x028a('0x3f')][_0x028a('0x58')]({'where':{'id':_0x52992c['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x525f0c,null))[_0x028a('0x20')](saveUpdates(_0x52992c[_0x028a('0x5a')],null))['then'](function(_0x186ed2){if(_0x186ed2){_0x1d6da9[_0x028a('0x28')]=_0x186ed2['get']({'plain':!![]});return db[_0x028a('0x65')][_0x028a('0x58')]({'where':{'id':_0x186ed2['WhatsappInteractionId']}});}return null;})[_0x028a('0x20')](handleEntityNotFound(_0x525f0c,null))[_0x028a('0x20')](function(_0x4f3209){if(_0x4f3209){return _0x4f3209[_0x028a('0x38')]({'UserId':_0x52992c[_0x028a('0x5a')][_0x028a('0x63')],'read1stAt':_[_0x028a('0x66')](_0x4f3209[_0x028a('0x67')])?moment()['format'](_0x028a('0x62')):undefined});}return null;})['then'](function(_0x53d081){if(_0x53d081){_0x1d6da9[_0x028a('0x68')]=_0x53d081['get']({'plain':!![]});interaction_log[_0x028a('0x21')](_0x028a('0x69'),_0x52992c[_0x028a('0x6a')]['id'],_0x52992c[_0x028a('0x6a')][_0x028a('0x3b')],_0x52992c[_0x028a('0x6a')][_0x028a('0x6b')],_0x1d6da9['interaction']['id'],_0x52992c[_0x028a('0x5a')]?JSON['stringify'](_0x52992c[_0x028a('0x5a')]):_0x028a('0x6c'));return respondWithRpcPromise(_0x028a('0x6d'),_0x028a('0x6e'),_0x1d6da9);}return null;})[_0x028a('0x20')](function(_0x4c41cb){var _0x9bd372='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4c41cb[_0x028a('0x28')][_0x028a('0x6f')];return db['sequelize'][_0x028a('0x43')](_0x9bd372,{'type':db['Sequelize']['QueryTypes'][_0x028a('0x70')],'raw':!![]})[_0x028a('0x20')](function(_0x47213f){return _0x47213f;});})[_0x028a('0x20')](function(_0x5b8b8d){if(_0x5b8b8d){_0x1d6da9['message'][_0x028a('0x71')]=_0x5b8b8d[0x0];if(!_0x52992c[_0x028a('0x5a')][_0x028a('0x63')])return;return db[_0x028a('0x72')]['find']({'where':{'id':_0x52992c[_0x028a('0x5a')]['UserId'],'role':_0x028a('0x64')},'attributes':['id',_0x028a('0x3b'),'fullname','email',_0x028a('0x73')],'raw':!![]});}return null;})[_0x028a('0x20')](function(_0x38c861){if(!_0x38c861)return null;_0x1d6da9[_0x028a('0x28')][_0x028a('0x64')]=_0x38c861;return _0x1d6da9;})[_0x028a('0x20')](function(_0x1dac3d){if(_0x1dac3d){if(_0x52992c[_0x028a('0x5a')][_0x028a('0x74')]){_0x1d6da9['message'][_0x028a('0x75')]=util['format'](_0x028a('0x76'),_0x52992c[_0x028a('0x6a')][_0x028a('0x3b')]);_0x1d6da9[_0x028a('0x28')][_0x028a('0x77')]=_0x1d6da9[_0x028a('0x77')];_0x1d6da9[_0x028a('0x28')][_0x028a('0x78')]=_0x1d6da9['channel'];_0x1d6da9[_0x028a('0x28')]['event']=_0x028a('0x5d');return respondWithRpcPromise(_0x028a('0x79'),_0x028a('0x79'),{'event':'acceptmessage','message':_0x1d6da9['message']},client9002)[_0x028a('0x20')](function(){return _0x1d6da9;});}return _0x1d6da9;}return null;})[_0x028a('0x20')](respondWithResult(_0x525f0c,null))[_0x028a('0x2a')](handleError(_0x525f0c,null));};var interaction_log=require('../../config/logger')(_0x028a('0x5c'));exports['reject']=function(_0x5f462b,_0x14d8ac,_0xec0a9a){var _0x38d484={'agent':{},'channel':'whatsapp'};if(_0x5f462b[_0x028a('0x5a')]['id']){delete _0x5f462b[_0x028a('0x5a')]['id'];}_0x5f462b['body'][_0x028a('0x63')]=_0x5f462b[_0x028a('0x5a')][_0x028a('0x63')]||_0x5f462b[_0x028a('0x6a')]['id'];_0x38d484[_0x028a('0x64')]['id']=_0x5f462b[_0x028a('0x5a')]['UserId'];return db[_0x028a('0x3f')][_0x028a('0x58')]({'where':{'id':_0x5f462b[_0x028a('0x57')]['id'],'UserId':null}})[_0x028a('0x20')](handleEntityNotFound(_0x14d8ac,null))['then'](function(_0x4f8c0e){if(_0x4f8c0e){_0x38d484[_0x028a('0x28')]=_0x4f8c0e[_0x028a('0x7a')]({'plain':!![]});return db[_0x028a('0x65')][_0x028a('0x58')]({'where':{'id':_0x4f8c0e[_0x028a('0x7b')]}});}return null;})['then'](handleEntityNotFound(_0x14d8ac,null))['then'](function(_0xa86c33){if(_0xa86c33){_0x38d484[_0x028a('0x68')]=_0xa86c33[_0x028a('0x7a')]({'plain':!![]});interaction_log[_0x028a('0x21')](_0x028a('0x7c'),_0x5f462b[_0x028a('0x6a')]['id'],_0x5f462b[_0x028a('0x6a')][_0x028a('0x3b')],_0x5f462b[_0x028a('0x6a')][_0x028a('0x6b')],_0x38d484[_0x028a('0x68')]['id'],_0x5f462b[_0x028a('0x5a')]?JSON[_0x028a('0x25')](_0x5f462b[_0x028a('0x5a')]):_0x028a('0x6c'));return respondWithRpcPromise(_0x028a('0x7d'),_0x028a('0x7e'),_0x38d484);}return null;})[_0x028a('0x20')](function(_0x23df01){var _0x358361=_0x028a('0x7f')+_0x23df01[_0x028a('0x28')][_0x028a('0x6f')];return db['sequelize']['query'](_0x358361,{'type':db[_0x028a('0x80')][_0x028a('0x81')]['SELECT'],'raw':!![]})[_0x028a('0x20')](function(_0x335380){return _0x335380;});})['then'](function(_0x38aadf){if(_0x38aadf){_0x38d484[_0x028a('0x28')][_0x028a('0x71')]=_0x38aadf[0x0];if(!_0x5f462b[_0x028a('0x5a')][_0x028a('0x63')])return;return db[_0x028a('0x72')][_0x028a('0x58')]({'where':{'id':_0x5f462b[_0x028a('0x5a')][_0x028a('0x63')],'role':_0x028a('0x64')},'attributes':['id',_0x028a('0x3b'),_0x028a('0x82'),'email',_0x028a('0x73')],'raw':!![]});}return null;})['then'](function(_0x10f18d){if(!_0x10f18d)return null;_0x38d484['message'][_0x028a('0x64')]=_0x10f18d;return _0x38d484;})[_0x028a('0x20')](function(_0xfb5ad2){if(_0xfb5ad2){_0xfb5ad2[_0x028a('0x28')]['interface']=util['format']('SIP/%s',_0x5f462b[_0x028a('0x6a')]['name']);_0xfb5ad2[_0x028a('0x28')][_0x028a('0x77')]=_0x38d484[_0x028a('0x77')];_0xfb5ad2[_0x028a('0x28')][_0x028a('0x78')]=_0x38d484[_0x028a('0x77')];_0xfb5ad2['message']['event']=_0x028a('0x36');respondWithRpcPromise('EventManager',_0x028a('0x79'),{'event':'rejectmessage','message':_0xfb5ad2['message']},client9002);return _0x38d484;}return null;})['then'](respondWithResult(_0x14d8ac,null))[_0x028a('0x2a')](handleError(_0x14d8ac,null));};exports['status']=function(_0xfd4b3b,_0x277e03,_0x19e0e7){if(_0xfd4b3b[_0x028a('0x5a')]['id']){delete _0xfd4b3b[_0x028a('0x5a')]['id'];}var _0x1695a3;return db[_0x028a('0x3f')]['find']({'where':{'id':_0xfd4b3b[_0x028a('0x57')]['id']}})[_0x028a('0x20')](handleEntityNotFound(_0x277e03,null))[_0x028a('0x20')](function(_0x132763){if(_0x132763){_0x1695a3=_0x132763;return db['WhatsappAccount'][_0x028a('0x58')]({'where':{'id':_0x132763[_0x028a('0x83')]}});}})[_0x028a('0x20')](handleEntityNotFound(_0x277e03,null))[_0x028a('0x20')](function(_0x6b108a){if(_0x6b108a){logger[_0x028a('0x84')](_0x028a('0x85'),_0x028a('0x2c'),_0x028a('0x86'),_0x6b108a[_0x028a('0x87')],util[_0x028a('0x88')](_0xfd4b3b[_0x028a('0x5a')],{'showHidden':![],'depth':null}));switch(_0x6b108a['type']){case'twilio':if(_0xfd4b3b[_0x028a('0x5a')][_0x028a('0x89')]&&_0xfd4b3b[_0x028a('0x5a')][_0x028a('0x89')]===_0x1695a3[_0x028a('0x8a')]&&_0xfd4b3b['body'][_0x028a('0x8b')]&&_0xfd4b3b['body'][_0x028a('0x8b')]===_0x028a('0x5f')){return _0x1695a3[_0x028a('0x38')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x028a('0x2c'),_0x028a('0x8c'),util[_0x028a('0x88')](_0xfd4b3b['body'],{'showHidden':![],'depth':null}));}break;}return _0x1695a3;}})[_0x028a('0x20')](respondWithResult(_0x277e03,null))[_0x028a('0x2a')](handleError(_0x277e03,null));}; \ No newline at end of file +var _0x478e=['destroy','end','sendStatus','stack','send','index','map','WhatsappMessage','rawAttributes','type','key','name','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','length','create','body','find','describe','whatsapp-interactions','accept','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','isNil','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','agent','fullname','email','internal','manual','SIP/%s','motionChannel','channel','event','EventManager','WhatsappInteraction','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','User','interface','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','papaparse','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','redis','./whatsappMessage.socket','register','jayson/promise','http','client','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','status','json','undefined','limit','count','offset','set','apply','reject','save','update'];(function(_0x3c66da,_0x384966){var _0x48847f=function(_0x192913){while(--_0x192913){_0x3c66da['push'](_0x3c66da['shift']());}};_0x48847f(++_0x384966);}(_0x478e,0x1e9));var _0xe478=function(_0x5617e2,_0x1ffcd7){_0x5617e2=_0x5617e2-0x0;var _0x27b60d=_0x478e[_0x5617e2];return _0x27b60d;};'use strict';var emlformat=require(_0xe478('0x0'));var rimraf=require(_0xe478('0x1'));var zipdir=require(_0xe478('0x2'));var jsonpatch=require(_0xe478('0x3'));var rp=require(_0xe478('0x4'));var moment=require(_0xe478('0x5'));var BPromise=require(_0xe478('0x6'));var Mustache=require(_0xe478('0x7'));var util=require('util');var path=require(_0xe478('0x8'));var sox=require(_0xe478('0x9'));var csv=require(_0xe478('0xa'));var ejs=require(_0xe478('0xb'));var fs=require('fs');var fs_extra=require(_0xe478('0xc'));var _=require(_0xe478('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe478('0xa'));var querystring=require('querystring');var Papa=require(_0xe478('0xe'));var Redis=require('ioredis');var authService=require(_0xe478('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe478('0x10'))('api');var utils=require(_0xe478('0x11'));var config=require(_0xe478('0x12'));var licenseUtil=require(_0xe478('0x13'));var db=require(_0xe478('0x14'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xe478('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe478('0x16')]));require(_0xe478('0x17'))[_0xe478('0x18')](socket);var jayson=require(_0xe478('0x19'));var client=jayson['client'][_0xe478('0x1a')]({'port':0x232c});var client9002=jayson[_0xe478('0x1b')][_0xe478('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1297be,_0x226998,_0x514a25,_0x6de0de){return new BPromise(function(_0x4343a3,_0x2554af){var _0x1386f1=_0x6de0de||client;return _0x1386f1['request'](_0x1297be,_0x514a25)[_0xe478('0x1c')](function(_0x31001e){logger[_0xe478('0x1d')](_0xe478('0x1e'),_0x226998,'request\x20sent');logger[_0xe478('0x1f')](_0xe478('0x20'),_0x226998,'request\x20sent',JSON[_0xe478('0x21')](_0x31001e));if(_0x31001e[_0xe478('0x22')]){if(_0x31001e[_0xe478('0x22')][_0xe478('0x23')]===0x1f4){logger[_0xe478('0x22')](_0xe478('0x1e'),_0x226998,_0x31001e[_0xe478('0x22')][_0xe478('0x24')]);return _0x2554af(_0x31001e[_0xe478('0x22')][_0xe478('0x24')]);}logger['error'](_0xe478('0x1e'),_0x226998,_0x31001e[_0xe478('0x22')][_0xe478('0x24')]);return _0x4343a3(_0x31001e[_0xe478('0x22')][_0xe478('0x24')]);}else{logger[_0xe478('0x1d')]('WhatsappMessage,\x20%s,\x20%s',_0x226998,_0xe478('0x25'));_0x4343a3(_0x31001e[_0xe478('0x26')]['message']);}})[_0xe478('0x27')](function(_0x5aab2d){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x226998,_0x5aab2d);_0x2554af(_0x5aab2d);});});}function respondWithStatusCode(_0x40a017,_0xad4874){_0xad4874=_0xad4874||0xcc;return function(_0x427708){if(_0x427708){return _0x40a017['sendStatus'](_0xad4874);}return _0x40a017[_0xe478('0x28')](_0xad4874)['end']();};}function respondWithResult(_0xaf99fc,_0x531d4a){_0x531d4a=_0x531d4a||0xc8;return function(_0x1c5355){if(_0x1c5355){return _0xaf99fc[_0xe478('0x28')](_0x531d4a)[_0xe478('0x29')](_0x1c5355);}};}function respondWithFilteredResult(_0x43e52c,_0x4b1435){return function(_0x5fe35c){if(_0x5fe35c){var _0x43d93f=typeof _0x4b1435['offset']===_0xe478('0x2a')&&typeof _0x4b1435[_0xe478('0x2b')]===_0xe478('0x2a');var _0x3a2572=_0x5fe35c[_0xe478('0x2c')];var _0x4ceecb=_0x43d93f?0x0:_0x4b1435['offset'];var _0x193e9d=_0x43d93f?_0x5fe35c['count']:_0x4b1435[_0xe478('0x2d')]+_0x4b1435[_0xe478('0x2b')];var _0x5771e2;if(_0x193e9d>=_0x3a2572){_0x193e9d=_0x3a2572;_0x5771e2=0xc8;}else{_0x5771e2=0xce;}_0x43e52c[_0xe478('0x28')](_0x5771e2);return _0x43e52c[_0xe478('0x2e')]('Content-Range',_0x4ceecb+'-'+_0x193e9d+'/'+_0x3a2572)['json'](_0x5fe35c);}return null;};}function patchUpdates(_0x9b22e){return function(_0x688586){try{jsonpatch[_0xe478('0x2f')](_0x688586,_0x9b22e,!![]);}catch(_0xd9814e){return BPromise[_0xe478('0x30')](_0xd9814e);}return _0x688586[_0xe478('0x31')]();};}function saveUpdates(_0x427300,_0x495ec1){return function(_0x4be75b){if(_0x4be75b){return _0x4be75b[_0xe478('0x32')](_0x427300)[_0xe478('0x1c')](function(_0x1eb573){return _0x1eb573;});}return null;};}function removeEntity(_0x5a31b4,_0x288412){return function(_0x1cebb4){if(_0x1cebb4){return _0x1cebb4[_0xe478('0x33')]()['then'](function(){_0x5a31b4['status'](0xcc)[_0xe478('0x34')]();});}};}function handleEntityNotFound(_0x12c086,_0x42ae0c){return function(_0x3f360a){if(!_0x3f360a){_0x12c086[_0xe478('0x35')](0x194);}return _0x3f360a;};}function handleError(_0x170e40,_0x3ca664){_0x3ca664=_0x3ca664||0x1f4;return function(_0x4d0250){logger[_0xe478('0x22')](_0x4d0250[_0xe478('0x36')]);if(_0x4d0250['name']){delete _0x4d0250['name'];}_0x170e40[_0xe478('0x28')](_0x3ca664)[_0xe478('0x37')](_0x4d0250);};}exports[_0xe478('0x38')]=function(_0x314923,_0x356285){var _0x22051e={},_0x31f508={},_0x3d8cc8={'count':0x0,'rows':[]};var _0x55f4ba=_[_0xe478('0x39')](db[_0xe478('0x3a')][_0xe478('0x3b')],function(_0x353b49){return{'name':_0x353b49['fieldName'],'type':_0x353b49[_0xe478('0x3c')][_0xe478('0x3d')]};});_0x31f508['model']=_[_0xe478('0x39')](_0x55f4ba,_0xe478('0x3e'));_0x31f508[_0xe478('0x3f')]=_[_0xe478('0x40')](_0x314923[_0xe478('0x3f')]);_0x31f508[_0xe478('0x41')]=_['intersection'](_0x31f508[_0xe478('0x42')],_0x31f508['query']);_0x22051e['attributes']=_[_0xe478('0x43')](_0x31f508['model'],qs[_0xe478('0x44')](_0x314923[_0xe478('0x3f')][_0xe478('0x44')]));_0x22051e[_0xe478('0x45')]=_0x22051e[_0xe478('0x45')]['length']?_0x22051e['attributes']:_0x31f508[_0xe478('0x42')];if(!_0x314923[_0xe478('0x3f')][_0xe478('0x46')](_0xe478('0x47'))){_0x22051e[_0xe478('0x2b')]=qs[_0xe478('0x2b')](_0x314923[_0xe478('0x3f')][_0xe478('0x2b')]);_0x22051e['offset']=qs[_0xe478('0x2d')](_0x314923[_0xe478('0x3f')]['offset']);}_0x22051e['order']=qs[_0xe478('0x48')](_0x314923[_0xe478('0x3f')]['sort']);_0x22051e[_0xe478('0x49')]=qs[_0xe478('0x41')](_['pick'](_0x314923[_0xe478('0x3f')],_0x31f508[_0xe478('0x41')]),_0x55f4ba);if(_0x314923['query'][_0xe478('0x4a')]){_0x22051e[_0xe478('0x49')]=_[_0xe478('0x4b')](_0x22051e['where'],{'$or':_['map'](_0x55f4ba,function(_0x24de51){if(_0x24de51[_0xe478('0x3c')]!==_0xe478('0x4c')){var _0x235b9e={};_0x235b9e[_0x24de51[_0xe478('0x3e')]]={'$like':'%'+_0x314923['query'][_0xe478('0x4a')]+'%'};return _0x235b9e;}})});}_0x22051e=_[_0xe478('0x4b')]({},_0x22051e,_0x314923[_0xe478('0x4d')]);var _0x43fb39={'where':_0x22051e['where']};return db[_0xe478('0x3a')]['count'](_0x43fb39)[_0xe478('0x1c')](function(_0x407ec4){_0x3d8cc8[_0xe478('0x2c')]=_0x407ec4;if(_0x314923[_0xe478('0x3f')][_0xe478('0x4e')]){_0x22051e[_0xe478('0x4f')]=[{'all':!![]}];}return db[_0xe478('0x3a')][_0xe478('0x50')](_0x22051e);})[_0xe478('0x1c')](function(_0x355499){_0x3d8cc8['rows']=_0x355499;return _0x3d8cc8;})[_0xe478('0x1c')](respondWithFilteredResult(_0x356285,_0x22051e))['catch'](handleError(_0x356285,null));};exports['show']=function(_0x468285,_0x55b621){var _0x5bed7f={'raw':!![],'where':{'id':_0x468285[_0xe478('0x51')]['id']}},_0x513de2={};_0x513de2['model']=_[_0xe478('0x40')](db[_0xe478('0x3a')][_0xe478('0x3b')]);_0x513de2['query']=_[_0xe478('0x40')](_0x468285[_0xe478('0x3f')]);_0x513de2[_0xe478('0x41')]=_[_0xe478('0x43')](_0x513de2[_0xe478('0x42')],_0x513de2[_0xe478('0x3f')]);_0x5bed7f[_0xe478('0x45')]=_['intersection'](_0x513de2['model'],qs[_0xe478('0x44')](_0x468285[_0xe478('0x3f')][_0xe478('0x44')]));_0x5bed7f[_0xe478('0x45')]=_0x5bed7f['attributes'][_0xe478('0x52')]?_0x5bed7f['attributes']:_0x513de2[_0xe478('0x42')];if(_0x468285['query'][_0xe478('0x4e')]){_0x5bed7f[_0xe478('0x4f')]=[{'all':!![]}];}_0x5bed7f=_[_0xe478('0x4b')]({},_0x5bed7f,_0x468285[_0xe478('0x4d')]);return db[_0xe478('0x3a')]['find'](_0x5bed7f)[_0xe478('0x1c')](handleEntityNotFound(_0x55b621,null))[_0xe478('0x1c')](respondWithResult(_0x55b621,null))[_0xe478('0x27')](handleError(_0x55b621,null));};exports[_0xe478('0x53')]=function(_0x262d47,_0x18dc3a){return db[_0xe478('0x3a')][_0xe478('0x53')](_0x262d47[_0xe478('0x54')],{})[_0xe478('0x1c')](respondWithResult(_0x18dc3a,0xc9))[_0xe478('0x27')](handleError(_0x18dc3a,null));};exports[_0xe478('0x32')]=function(_0x175904,_0x558c6d){if(_0x175904[_0xe478('0x54')]['id']){delete _0x175904['body']['id'];}return db[_0xe478('0x3a')][_0xe478('0x55')]({'where':{'id':_0x175904[_0xe478('0x51')]['id']}})[_0xe478('0x1c')](handleEntityNotFound(_0x558c6d,null))[_0xe478('0x1c')](saveUpdates(_0x175904[_0xe478('0x54')],null))['then'](respondWithResult(_0x558c6d,null))[_0xe478('0x27')](handleError(_0x558c6d,null));};exports[_0xe478('0x33')]=function(_0x5d47ff,_0x58740b){return db['WhatsappMessage'][_0xe478('0x55')]({'where':{'id':_0x5d47ff['params']['id']}})[_0xe478('0x1c')](handleEntityNotFound(_0x58740b,null))[_0xe478('0x1c')](removeEntity(_0x58740b,null))[_0xe478('0x27')](handleError(_0x58740b,null));};exports[_0xe478('0x56')]=function(_0x4788fb,_0xd16b6c){return db[_0xe478('0x3a')][_0xe478('0x56')]()[_0xe478('0x1c')](respondWithResult(_0xd16b6c,null))[_0xe478('0x27')](handleError(_0xd16b6c,null));};var interaction_log=require(_0xe478('0x10'))(_0xe478('0x57'));exports[_0xe478('0x58')]=function(_0x57ba5b,_0x22594f,_0x35b6f8){var _0x8377b3={'agent':{},'channel':_0xe478('0x59')};if(_0x57ba5b[_0xe478('0x54')]['id']){delete _0x57ba5b[_0xe478('0x54')]['id'];}_0x57ba5b[_0xe478('0x54')][_0xe478('0x5a')]=!![];_0x57ba5b[_0xe478('0x54')]['readAt']=moment()[_0xe478('0x5b')](_0xe478('0x5c'));_0x57ba5b[_0xe478('0x54')][_0xe478('0x5d')]=_0x57ba5b['body'][_0xe478('0x5d')]||_0x57ba5b[_0xe478('0x5e')]['id'];_0x8377b3['agent']['id']=_0x57ba5b[_0xe478('0x54')][_0xe478('0x5d')];return db[_0xe478('0x3a')][_0xe478('0x55')]({'where':{'id':_0x57ba5b[_0xe478('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x22594f,null))[_0xe478('0x1c')](saveUpdates(_0x57ba5b[_0xe478('0x54')],null))[_0xe478('0x1c')](function(_0xd49272){if(_0xd49272){_0x8377b3[_0xe478('0x24')]=_0xd49272[_0xe478('0x5f')]({'plain':!![]});return db['WhatsappInteraction'][_0xe478('0x55')]({'where':{'id':_0xd49272['WhatsappInteractionId']}});}return null;})[_0xe478('0x1c')](handleEntityNotFound(_0x22594f,null))[_0xe478('0x1c')](function(_0x1eacb9){if(_0x1eacb9){return _0x1eacb9['update']({'UserId':_0x57ba5b[_0xe478('0x54')][_0xe478('0x5d')],'read1stAt':_[_0xe478('0x60')](_0x1eacb9['read1stAt'])?moment()[_0xe478('0x5b')](_0xe478('0x5c')):undefined});}return null;})[_0xe478('0x1c')](function(_0x514d4d){if(_0x514d4d){_0x8377b3[_0xe478('0x61')]=_0x514d4d[_0xe478('0x5f')]({'plain':!![]});interaction_log['info'](_0xe478('0x62'),_0x57ba5b[_0xe478('0x5e')]['id'],_0x57ba5b[_0xe478('0x5e')][_0xe478('0x3e')],_0x57ba5b['user'][_0xe478('0x63')],_0x8377b3[_0xe478('0x61')]['id'],_0x57ba5b[_0xe478('0x54')]?JSON[_0xe478('0x21')](_0x57ba5b[_0xe478('0x54')]):_0xe478('0x64'));return respondWithRpcPromise(_0xe478('0x65'),'acceptMessage',_0x8377b3);}return null;})[_0xe478('0x1c')](function(_0x5be355){var _0x87c273=_0xe478('0x66')+_0x5be355['message'][_0xe478('0x67')];return db['sequelize'][_0xe478('0x3f')](_0x87c273,{'type':db[_0xe478('0x68')][_0xe478('0x69')][_0xe478('0x6a')],'raw':!![]})[_0xe478('0x1c')](function(_0x2c1803){return _0x2c1803;});})['then'](function(_0x407682){if(_0x407682){_0x8377b3[_0xe478('0x24')][_0xe478('0x6b')]=_0x407682[0x0];if(!_0x57ba5b[_0xe478('0x54')][_0xe478('0x5d')])return;return db['User'][_0xe478('0x55')]({'where':{'id':_0x57ba5b[_0xe478('0x54')]['UserId'],'role':_0xe478('0x6c')},'attributes':['id','name',_0xe478('0x6d'),_0xe478('0x6e'),_0xe478('0x6f')],'raw':!![]});}return null;})[_0xe478('0x1c')](function(_0x3552d3){if(!_0x3552d3)return null;_0x8377b3[_0xe478('0x24')][_0xe478('0x6c')]=_0x3552d3;return _0x8377b3;})[_0xe478('0x1c')](function(_0x2b1cc9){if(_0x2b1cc9){if(_0x57ba5b['body'][_0xe478('0x70')]){_0x8377b3[_0xe478('0x24')]['interface']=util[_0xe478('0x5b')](_0xe478('0x71'),_0x57ba5b[_0xe478('0x5e')]['name']);_0x8377b3[_0xe478('0x24')]['channel']=_0x8377b3['channel'];_0x8377b3[_0xe478('0x24')][_0xe478('0x72')]=_0x8377b3[_0xe478('0x73')];_0x8377b3['message'][_0xe478('0x74')]=_0xe478('0x58');return respondWithRpcPromise(_0xe478('0x75'),_0xe478('0x75'),{'event':'acceptmessage','message':_0x8377b3[_0xe478('0x24')]},client9002)[_0xe478('0x1c')](function(){return _0x8377b3;});}return _0x8377b3;}return null;})[_0xe478('0x1c')](respondWithResult(_0x22594f,null))[_0xe478('0x27')](handleError(_0x22594f,null));};var interaction_log=require(_0xe478('0x10'))(_0xe478('0x57'));exports[_0xe478('0x30')]=function(_0x5f57ff,_0x484db9,_0x2ea6d1){var _0xf07c07={'agent':{},'channel':_0xe478('0x59')};if(_0x5f57ff[_0xe478('0x54')]['id']){delete _0x5f57ff[_0xe478('0x54')]['id'];}_0x5f57ff[_0xe478('0x54')][_0xe478('0x5d')]=_0x5f57ff[_0xe478('0x54')]['UserId']||_0x5f57ff[_0xe478('0x5e')]['id'];_0xf07c07[_0xe478('0x6c')]['id']=_0x5f57ff['body'][_0xe478('0x5d')];return db[_0xe478('0x3a')][_0xe478('0x55')]({'where':{'id':_0x5f57ff[_0xe478('0x51')]['id'],'UserId':null}})[_0xe478('0x1c')](handleEntityNotFound(_0x484db9,null))[_0xe478('0x1c')](function(_0x2a4296){if(_0x2a4296){_0xf07c07[_0xe478('0x24')]=_0x2a4296['get']({'plain':!![]});return db[_0xe478('0x76')][_0xe478('0x55')]({'where':{'id':_0x2a4296[_0xe478('0x77')]}});}return null;})[_0xe478('0x1c')](handleEntityNotFound(_0x484db9,null))[_0xe478('0x1c')](function(_0x4f8bde){if(_0x4f8bde){_0xf07c07['interaction']=_0x4f8bde[_0xe478('0x5f')]({'plain':!![]});interaction_log[_0xe478('0x1d')](_0xe478('0x78'),_0x5f57ff[_0xe478('0x5e')]['id'],_0x5f57ff[_0xe478('0x5e')][_0xe478('0x3e')],_0x5f57ff['user']['role'],_0xf07c07[_0xe478('0x61')]['id'],_0x5f57ff['body']?JSON[_0xe478('0x21')](_0x5f57ff['body']):'null');return respondWithRpcPromise(_0xe478('0x79'),_0xe478('0x7a'),_0xf07c07);}return null;})[_0xe478('0x1c')](function(_0x4be4a9){var _0x42c11b=_0xe478('0x66')+_0x4be4a9[_0xe478('0x24')][_0xe478('0x67')];return db[_0xe478('0x7b')]['query'](_0x42c11b,{'type':db[_0xe478('0x68')]['QueryTypes']['SELECT'],'raw':!![]})[_0xe478('0x1c')](function(_0x5facea){return _0x5facea;});})[_0xe478('0x1c')](function(_0x2e5f37){if(_0x2e5f37){_0xf07c07[_0xe478('0x24')][_0xe478('0x6b')]=_0x2e5f37[0x0];if(!_0x5f57ff[_0xe478('0x54')]['UserId'])return;return db[_0xe478('0x7c')][_0xe478('0x55')]({'where':{'id':_0x5f57ff[_0xe478('0x54')][_0xe478('0x5d')],'role':_0xe478('0x6c')},'attributes':['id',_0xe478('0x3e'),_0xe478('0x6d'),_0xe478('0x6e'),_0xe478('0x6f')],'raw':!![]});}return null;})['then'](function(_0x192c31){if(!_0x192c31)return null;_0xf07c07[_0xe478('0x24')][_0xe478('0x6c')]=_0x192c31;return _0xf07c07;})['then'](function(_0x1766c4){if(_0x1766c4){_0x1766c4['message'][_0xe478('0x7d')]=util[_0xe478('0x5b')](_0xe478('0x71'),_0x5f57ff[_0xe478('0x5e')][_0xe478('0x3e')]);_0x1766c4[_0xe478('0x24')][_0xe478('0x73')]=_0xf07c07[_0xe478('0x73')];_0x1766c4[_0xe478('0x24')]['motionChannel']=_0xf07c07[_0xe478('0x73')];_0x1766c4[_0xe478('0x24')]['event']='reject';respondWithRpcPromise(_0xe478('0x75'),_0xe478('0x75'),{'event':_0xe478('0x7e'),'message':_0x1766c4[_0xe478('0x24')]},client9002);return _0xf07c07;}return null;})[_0xe478('0x1c')](respondWithResult(_0x484db9,null))['catch'](handleError(_0x484db9,null));};exports[_0xe478('0x28')]=function(_0x50f894,_0x4a3d76,_0x1267f0){if(_0x50f894['body']['id']){delete _0x50f894['body']['id'];}var _0xe18f1e;return db['WhatsappMessage'][_0xe478('0x55')]({'where':{'id':_0x50f894[_0xe478('0x51')]['id']}})[_0xe478('0x1c')](handleEntityNotFound(_0x4a3d76,null))[_0xe478('0x1c')](function(_0x19718e){if(_0x19718e){_0xe18f1e=_0x19718e;return db[_0xe478('0x7f')]['find']({'where':{'id':_0x19718e[_0xe478('0x80')]}});}})['then'](handleEntityNotFound(_0x4a3d76,null))[_0xe478('0x1c')](function(_0x23b8c4){if(_0x23b8c4){logger[_0xe478('0x1f')](_0xe478('0x81'),_0xe478('0x28'),'received\x20delivery\x20report\x20from',_0x23b8c4[_0xe478('0x3c')],util[_0xe478('0x82')](_0x50f894[_0xe478('0x54')],{'showHidden':![],'depth':null}));switch(_0x23b8c4['type']){case _0xe478('0x83'):if(_0x50f894[_0xe478('0x54')][_0xe478('0x84')]&&_0x50f894[_0xe478('0x54')][_0xe478('0x84')]===_0xe18f1e[_0xe478('0x85')]&&_0x50f894['body'][_0xe478('0x86')]&&_0x50f894[_0xe478('0x54')][_0xe478('0x86')]===_0xe478('0x5a')){return _0xe18f1e[_0xe478('0x32')]({'read':!![]});}else{logger[_0xe478('0x22')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0xe478('0x83'),util['inspect'](_0x50f894[_0xe478('0x54')],{'showHidden':![],'depth':null}));}break;}return _0xe18f1e;}})[_0xe478('0x1c')](respondWithResult(_0x4a3d76,null))[_0xe478('0x27')](handleError(_0x4a3d76,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index f9ed78a..cff08b6 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 _0xc36d=['../../mysqldb','WhatsappMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x20f71f,_0x400188){var _0x32f58f=function(_0x49cdc9){while(--_0x49cdc9){_0x20f71f['push'](_0x20f71f['shift']());}};_0x32f58f(++_0x400188);}(_0xc36d,0x7d));var _0xdc36=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0xc36d[_0x4394b6];return _0x360244;};'use strict';var EventEmitter=require(_0xdc36('0x0'));var WhatsappMessage=require(_0xdc36('0x1'))['db'][_0xdc36('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xdc36('0x3')](0x0);var events={'afterCreate':_0xdc36('0x4'),'afterUpdate':_0xdc36('0x5'),'afterDestroy':'remove'};function emitEvent(_0x42522b){return function(_0x3431f9,_0x53ac17,_0x18c8fe){WhatsappMessageEvents[_0xdc36('0x6')](_0x42522b+':'+_0x3431f9['id'],_0x3431f9);WhatsappMessageEvents[_0xdc36('0x6')](_0x42522b,_0x3431f9);_0x18c8fe(null);};}for(var e in events){if(events[_0xdc36('0x7')](e)){var event=events[e];WhatsappMessage[_0xdc36('0x8')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x94d2=['setMaxListeners','save','update','remove','emit','hasOwnProperty','WhatsappMessage'];(function(_0x17a33d,_0x3cc5ba){var _0x3296a1=function(_0x3b1213){while(--_0x3b1213){_0x17a33d['push'](_0x17a33d['shift']());}};_0x3296a1(++_0x3cc5ba);}(_0x94d2,0x1cd));var _0x294d=function(_0x367361,_0x311488){_0x367361=_0x367361-0x0;var _0x195d2d=_0x94d2[_0x367361];return _0x195d2d;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db'][_0x294d('0x0')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x294d('0x1')](0x0);var events={'afterCreate':_0x294d('0x2'),'afterUpdate':_0x294d('0x3'),'afterDestroy':_0x294d('0x4')};function emitEvent(_0x5c1993){return function(_0x541332,_0x2f2fc8,_0x393430){WhatsappMessageEvents[_0x294d('0x5')](_0x5c1993+':'+_0x541332['id'],_0x541332);WhatsappMessageEvents[_0x294d('0x5')](_0x5c1993,_0x541332);_0x393430(null);};}for(var e in events){if(events[_0x294d('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index fee9750..57caa61 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 _0x33e1=['phone','authToken','messages','create','whatsapp:','/api/whatsapp/messages/','/status?token=','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','error','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid'];(function(_0x13cf7a,_0x479809){var _0x5cb678=function(_0x267d4a){while(--_0x267d4a){_0x13cf7a['push'](_0x13cf7a['shift']());}};_0x5cb678(++_0x479809);}(_0x33e1,0x142));var _0x133e=function(_0xc3156d,_0x37d363){_0xc3156d=_0xc3156d-0x0;var _0x289622=_0x33e1[_0xc3156d];return _0x289622;};'use strict';var _=require(_0x133e('0x0'));var util=require(_0x133e('0x1'));var logger=require(_0x133e('0x2'))(_0x133e('0x3'));var moment=require(_0x133e('0x4'));var BPromise=require('bluebird');var rp=require(_0x133e('0x5'));var fs=require('fs');var path=require(_0x133e('0x6'));var rimraf=require(_0x133e('0x7'));var config=require(_0x133e('0x8'));var attributes=require(_0x133e('0x9'));module['exports']=function(_0x47ba68,_0x4c0286){return _0x47ba68[_0x133e('0xa')](_0x133e('0xb'),attributes,{'tableName':_0x133e('0xc'),'paranoid':![],'indexes':[{'name':_0x133e('0xd'),'fields':[_0x133e('0xd')]},{'name':_0x133e('0xe'),'fields':[_0x133e('0xf')],'type':_0x133e('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x581133,_0x509efe,_0x51a1a6){var _0x4d1514=_0x47ba68[_0x133e('0x11')];var _0x873705=_0x581133[_0x133e('0x12')]({'plain':!![]});if(_0x873705[_0x133e('0x13')][_0x133e('0x14')]()==='in'||_0x873705[_0x133e('0x13')][_0x133e('0x14')]()===_0x133e('0x15')&&!_0x873705[_0x133e('0x16')]&&!_[_0x133e('0x17')](_0x873705['UserId'])){_0x4d1514[_0x133e('0x18')][_0x133e('0x19')]({'where':{'id':_0x873705[_0x133e('0x1a')]}})[_0x133e('0x1b')](function(_0x1fd2d8){if(_0x1fd2d8){_0x1fd2d8[_0x133e('0x1c')]({'lastMsgAt':_0x873705['createdAt'],'lastMsgDirection':_0x873705['direction'][_0x133e('0x14')]()});}})['catch'](function(_0xd593e4){console['error'](_0xd593e4);});}if(_0x873705[_0x133e('0x13')]==='out'&&!_0x873705['secret']){var _0x4aca5f;_0x4d1514[_0x133e('0x1d')][_0x133e('0x1e')]({'where':{'id':_0x873705[_0x133e('0x1f')]},'raw':!![]})['then'](function(_0x2c2024){_0x4aca5f=_0x2c2024;if(_0x4aca5f&&_0x4aca5f[_0x133e('0x20')]){switch(_0x4aca5f[_0x133e('0x20')]){case _0x133e('0x21'):var _0x3c0eec=require(_0x133e('0x21'));if(_0x4aca5f[_0x133e('0x22')]&&_0x4aca5f['authToken']&&_0x4aca5f[_0x133e('0x23')]){var _0xf4d9f9=new _0x3c0eec(_0x4aca5f[_0x133e('0x22')],_0x4aca5f[_0x133e('0x24')]);_0xf4d9f9[_0x133e('0x25')][_0x133e('0x26')]({'body':_0x873705['body'],'to':_0x133e('0x27')+_0x873705[_0x133e('0x23')],'from':_0x133e('0x27')+_0x4aca5f[_0x133e('0x23')],'statusCallback':_0x4aca5f['remote']+_0x133e('0x28')+_0x873705['id']+_0x133e('0x29')+_0x4aca5f['token']})[_0x133e('0x1b')](function(_0x1a89a4){if(_0x1a89a4[_0x133e('0x2a')]){return _0x581133[_0x133e('0x1c')]({'messageId':_0x1a89a4[_0x133e('0x2a')]});}})[_0x133e('0x2b')](function(_0x34e802){logger['error'](_0x133e('0x2c'),_0x133e('0x2d'),_0x133e('0x21'),util['inspect'](_0x34e802,{'showHidden':![],'depth':null}));});}else{logger[_0x133e('0x2e')](_0x133e('0x2c'),_0x133e('0x2d'),_0x133e('0x21'),_0x133e('0x2f'));}break;}}})[_0x133e('0x30')](function(){_0x51a1a6();});}else{_0x51a1a6();}}},'charset':_0x133e('0x31'),'collate':_0x133e('0x32')});}; \ No newline at end of file +var _0x1a41=['WhatsappInteractionId','then','update','catch','error','WhatsappAccount','find','type','twilio','accountSid','authToken','phone','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','utf8mb4','utf8mb4_unicode_ci','util','api','moment','request-promise','path','rimraf','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','body','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1a41,0x126));var _0x11a4=function(_0x265711,_0x3ad01b){_0x265711=_0x265711-0x0;var _0x51c4bd=_0x1a41[_0x265711];return _0x51c4bd;};'use strict';var _=require('lodash');var util=require(_0x11a4('0x0'));var logger=require('../../config/logger')(_0x11a4('0x1'));var moment=require(_0x11a4('0x2'));var BPromise=require('bluebird');var rp=require(_0x11a4('0x3'));var fs=require('fs');var path=require(_0x11a4('0x4'));var rimraf=require(_0x11a4('0x5'));var config=require('../../config/environment');var attributes=require(_0x11a4('0x6'));module[_0x11a4('0x7')]=function(_0x5f019c,_0x3fef3b){return _0x5f019c[_0x11a4('0x8')](_0x11a4('0x9'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x11a4('0xa')]},{'name':_0x11a4('0xb'),'fields':[_0x11a4('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d148f,_0x46d15d,_0x5781ee){var _0x3bc0bf=_0x5f019c['models'];var _0x1c0a6e=_0x5d148f['get']({'plain':!![]});if(_0x1c0a6e[_0x11a4('0xd')][_0x11a4('0xe')]()==='in'||_0x1c0a6e[_0x11a4('0xd')][_0x11a4('0xe')]()===_0x11a4('0xf')&&!_0x1c0a6e[_0x11a4('0x10')]&&!_[_0x11a4('0x11')](_0x1c0a6e[_0x11a4('0x12')])){_0x3bc0bf[_0x11a4('0x13')][_0x11a4('0x14')]({'where':{'id':_0x1c0a6e[_0x11a4('0x15')]}})[_0x11a4('0x16')](function(_0x17b402){if(_0x17b402){_0x17b402[_0x11a4('0x17')]({'lastMsgAt':_0x1c0a6e['createdAt'],'lastMsgDirection':_0x1c0a6e[_0x11a4('0xd')][_0x11a4('0xe')]()});}})[_0x11a4('0x18')](function(_0x15684b){console[_0x11a4('0x19')](_0x15684b);});}if(_0x1c0a6e[_0x11a4('0xd')]===_0x11a4('0xf')&&!_0x1c0a6e[_0x11a4('0x10')]){var _0x23f832;_0x3bc0bf[_0x11a4('0x1a')][_0x11a4('0x1b')]({'where':{'id':_0x1c0a6e['WhatsappAccountId']},'raw':!![]})[_0x11a4('0x16')](function(_0x365e48){_0x23f832=_0x365e48;if(_0x23f832&&_0x23f832[_0x11a4('0x1c')]){switch(_0x23f832[_0x11a4('0x1c')]){case _0x11a4('0x1d'):var _0x12cd37=require(_0x11a4('0x1d'));if(_0x23f832[_0x11a4('0x1e')]&&_0x23f832[_0x11a4('0x1f')]&&_0x23f832[_0x11a4('0x20')]){var _0x26ea18=new _0x12cd37(_0x23f832['accountSid'],_0x23f832[_0x11a4('0x1f')]);_0x26ea18['messages']['create']({'body':_0x1c0a6e[_0x11a4('0xc')],'to':_0x11a4('0x21')+_0x1c0a6e['phone'],'from':_0x11a4('0x21')+_0x23f832['phone'],'statusCallback':_0x23f832[_0x11a4('0x22')]+_0x11a4('0x23')+_0x1c0a6e['id']+_0x11a4('0x24')+_0x23f832[_0x11a4('0x25')]})[_0x11a4('0x16')](function(_0x18afa6){if(_0x18afa6[_0x11a4('0x26')]){return _0x5d148f[_0x11a4('0x17')]({'messageId':_0x18afa6[_0x11a4('0x26')]});}})[_0x11a4('0x18')](function(_0x494243){logger[_0x11a4('0x19')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x11a4('0x27'),_0x11a4('0x1d'),util[_0x11a4('0x28')](_0x494243,{'showHidden':![],'depth':null}));});}else{logger[_0x11a4('0x19')](_0x11a4('0x29'),_0x11a4('0x27'),_0x11a4('0x1d'),_0x11a4('0x2a'));}break;}}})['finally'](function(){_0x5781ee();});}else{_0x5781ee();}}},'charset':_0x11a4('0x2b'),'collate':_0x11a4('0x2c')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 918b0de..8b2c1d4 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 _0x3637=['../../config/utils','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','request\x20sent','debug','code','error','WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring'];(function(_0x1b5a83,_0x5a9cba){var _0x5df771=function(_0x496fbe){while(--_0x496fbe){_0x1b5a83['push'](_0x1b5a83['shift']());}};_0x5df771(++_0x5a9cba);}(_0x3637,0x19b));var _0x7363=function(_0x2d0d9f,_0x22c0d8){_0x2d0d9f=_0x2d0d9f-0x0;var _0x30243d=_0x3637[_0x2d0d9f];return _0x30243d;};'use strict';var _=require(_0x7363('0x0'));var util=require(_0x7363('0x1'));var moment=require(_0x7363('0x2'));var BPromise=require(_0x7363('0x3'));var rs=require(_0x7363('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7363('0x5'));var logger=require('../../config/logger')(_0x7363('0x6'));var config=require('../../config/environment');var jayson=require(_0x7363('0x7'));var client=jayson['client'][_0x7363('0x8')]({'port':0x232a});config[_0x7363('0x9')]=_[_0x7363('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7363('0xb'))(new Redis(config[_0x7363('0x9')]));require(_0x7363('0xc'))[_0x7363('0xd')](socket);function respondWithRpcPromise(_0xb790a3,_0x588409,_0x2fd0f0){return new BPromise(function(_0x196cea,_0x1ea3f0){return client[_0x7363('0xe')](_0xb790a3,_0x2fd0f0)[_0x7363('0xf')](function(_0x499440){logger[_0x7363('0x10')]('WhatsappMessage,\x20%s,\x20%s',_0x588409,_0x7363('0x11'));logger[_0x7363('0x12')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x588409,_0x7363('0x11'),JSON['stringify'](_0x499440));if(_0x499440['error']){if(_0x499440['error'][_0x7363('0x13')]===0x1f4){logger[_0x7363('0x14')](_0x7363('0x15'),_0x588409,_0x499440[_0x7363('0x14')][_0x7363('0x16')]);return _0x1ea3f0(_0x499440['error'][_0x7363('0x16')]);}logger[_0x7363('0x14')](_0x7363('0x15'),_0x588409,_0x499440[_0x7363('0x14')][_0x7363('0x16')]);return _0x196cea(_0x499440[_0x7363('0x14')][_0x7363('0x16')]);}else{logger[_0x7363('0x10')]('WhatsappMessage,\x20%s,\x20%s',_0x588409,_0x7363('0x11'));_0x196cea(_0x499440[_0x7363('0x17')][_0x7363('0x16')]);}})[_0x7363('0x18')](function(_0xcdc050){logger[_0x7363('0x14')](_0x7363('0x15'),_0x588409,_0xcdc050);_0x1ea3f0(_0xcdc050);});});}exports[_0x7363('0x19')]=function(_0x4b5c5f){var _0x5ca50f=this;return new Promise(function(_0x4b4054,_0x9d4b39){return db[_0x7363('0x1a')][_0x7363('0x1b')](_0x4b5c5f[_0x7363('0x1c')],{'raw':_0x4b5c5f[_0x7363('0x1d')]?_0x4b5c5f[_0x7363('0x1d')][_0x7363('0x1e')]===undefined?!![]:![]:!![]})[_0x7363('0xf')](function(_0x2dff1b){logger['info']('CreateWhatsappMessage',_0x4b5c5f);logger[_0x7363('0x12')]('CreateWhatsappMessage',_0x4b5c5f,JSON[_0x7363('0x1f')](_0x2dff1b));_0x4b4054(_0x2dff1b);})[_0x7363('0x18')](function(_0x518614){logger[_0x7363('0x14')](_0x7363('0x19'),_0x518614[_0x7363('0x16')],_0x4b5c5f);_0x9d4b39(_0x5ca50f[_0x7363('0x14')](0x1f4,_0x518614[_0x7363('0x16')]));});});}; \ No newline at end of file +var _0xda49=['moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateWhatsappMessage','WhatsappMessage','options','raw','then','lodash'];(function(_0x2cbc82,_0x30d15a){var _0x222f31=function(_0x51bc14){while(--_0x51bc14){_0x2cbc82['push'](_0x2cbc82['shift']());}};_0x222f31(++_0x30d15a);}(_0xda49,0x9a));var _0x9da4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xda49[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0x9da4('0x0'));var util=require('util');var moment=require(_0x9da4('0x1'));var BPromise=require(_0x9da4('0x2'));var rs=require(_0x9da4('0x3'));var fs=require('fs');var Redis=require(_0x9da4('0x4'));var db=require(_0x9da4('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9da4('0x6'));var config=require(_0x9da4('0x7'));var jayson=require(_0x9da4('0x8'));var client=jayson[_0x9da4('0x9')][_0x9da4('0xa')]({'port':0x232a});config[_0x9da4('0xb')]=_[_0x9da4('0xc')](config[_0x9da4('0xb')],{'host':_0x9da4('0xd'),'port':0x18eb});var socket=require(_0x9da4('0xe'))(new Redis(config['redis']));require(_0x9da4('0xf'))[_0x9da4('0x10')](socket);function respondWithRpcPromise(_0x2c0d6a,_0x59fde2,_0x4e5f19){return new BPromise(function(_0x37034,_0x3e2b8e){return client['request'](_0x2c0d6a,_0x4e5f19)['then'](function(_0x3bcb43){logger[_0x9da4('0x11')](_0x9da4('0x12'),_0x59fde2,_0x9da4('0x13'));logger[_0x9da4('0x14')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x59fde2,_0x9da4('0x13'),JSON[_0x9da4('0x15')](_0x3bcb43));if(_0x3bcb43[_0x9da4('0x16')]){if(_0x3bcb43[_0x9da4('0x16')][_0x9da4('0x17')]===0x1f4){logger[_0x9da4('0x16')](_0x9da4('0x12'),_0x59fde2,_0x3bcb43[_0x9da4('0x16')][_0x9da4('0x18')]);return _0x3e2b8e(_0x3bcb43['error']['message']);}logger[_0x9da4('0x16')](_0x9da4('0x12'),_0x59fde2,_0x3bcb43[_0x9da4('0x16')][_0x9da4('0x18')]);return _0x37034(_0x3bcb43[_0x9da4('0x16')][_0x9da4('0x18')]);}else{logger[_0x9da4('0x11')](_0x9da4('0x12'),_0x59fde2,_0x9da4('0x13'));_0x37034(_0x3bcb43[_0x9da4('0x19')]['message']);}})['catch'](function(_0x3c1af4){logger[_0x9da4('0x16')](_0x9da4('0x12'),_0x59fde2,_0x3c1af4);_0x3e2b8e(_0x3c1af4);});});}exports[_0x9da4('0x1a')]=function(_0x4a548e){var _0x16d1eb=this;return new Promise(function(_0x28bb87,_0x122ebf){return db[_0x9da4('0x1b')]['create'](_0x4a548e['body'],{'raw':_0x4a548e[_0x9da4('0x1c')]?_0x4a548e[_0x9da4('0x1c')][_0x9da4('0x1d')]===undefined?!![]:![]:!![]})[_0x9da4('0x1e')](function(_0x45b19a){logger[_0x9da4('0x11')](_0x9da4('0x1a'),_0x4a548e);logger['debug'](_0x9da4('0x1a'),_0x4a548e,JSON['stringify'](_0x45b19a));_0x28bb87(_0x45b19a);})['catch'](function(_0x2df4af){logger[_0x9da4('0x16')](_0x9da4('0x1a'),_0x2df4af['message'],_0x4a548e);_0x122ebf(_0x16d1eb['error'](0x1f4,_0x2df4af[_0x9da4('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 9a6dd13..185889d 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 _0x2454=['save','remove','update','emit','removeListener','register','length'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x2454,0x17a));var _0x4245=function(_0x120e48,_0x475421){_0x120e48=_0x120e48-0x0;var _0x585722=_0x2454[_0x120e48];return _0x585722;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x4245('0x0'),_0x4245('0x1'),_0x4245('0x2')];function createListener(_0x84e4a7,_0x166555){return function(_0x11fd3f){_0x166555[_0x4245('0x3')](_0x84e4a7,_0x11fd3f);};}function removeListener(_0xc60de3,_0x532482){return function(){WhatsappMessageEvents[_0x4245('0x4')](_0xc60de3,_0x532482);};}exports[_0x4245('0x5')]=function(_0x2b3f62){for(var _0xa9e45d=0x0,_0x5bbc94=events[_0x4245('0x6')];_0xa9e45d<_0x5bbc94;_0xa9e45d++){var _0x28c91f=events[_0xa9e45d];var _0x26235b=createListener('whatsappMessage:'+_0x28c91f,_0x2b3f62);WhatsappMessageEvents['on'](_0x28c91f,_0x26235b);}}; \ No newline at end of file +var _0x047d=['emit','register','./whatsappMessage.events','update'];(function(_0x85d3f2,_0x287256){var _0x15299f=function(_0x43c68f){while(--_0x43c68f){_0x85d3f2['push'](_0x85d3f2['shift']());}};_0x15299f(++_0x287256);}(_0x047d,0x132));var _0xd047=function(_0x174a1d,_0x580ab8){_0x174a1d=_0x174a1d-0x0;var _0x269f8b=_0x047d[_0x174a1d];return _0x269f8b;};'use strict';var WhatsappMessageEvents=require(_0xd047('0x0'));var events=['save','remove',_0xd047('0x1')];function createListener(_0xd8d828,_0x187d8c){return function(_0x13b33a){_0x187d8c[_0xd047('0x2')](_0xd8d828,_0x13b33a);};}function removeListener(_0x11d2f3,_0x95b131){return function(){WhatsappMessageEvents['removeListener'](_0x11d2f3,_0x95b131);};}exports[_0xd047('0x3')]=function(_0x3e8ee6){for(var _0x39b35d=0x0,_0x21c78d=events['length'];_0x39b35d<_0x21c78d;_0x39b35d++){var _0x1c1db1=events[_0x39b35d];var _0x128bd3=createListener('whatsappMessage:'+_0x1c1db1,_0x3e8ee6);WhatsappMessageEvents['on'](_0x1c1db1,_0x128bd3);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index f08a66a..08b5035 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 _0xa66f=['post','addTeams','addAgents','update','destroy','delete','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','describe','/:id','isAuthenticated','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0xa66f,0xde));var _0xfa66=function(_0x44747e,_0x5a5a71){_0x44747e=_0x44747e-0x0;var _0x1ad15c=_0xa66f[_0x44747e];return _0x1ad15c;};'use strict';var multer=require('multer');var util=require(_0xfa66('0x0'));var path=require(_0xfa66('0x1'));var timeout=require('connect-timeout');var express=require(_0xfa66('0x2'));var router=express[_0xfa66('0x3')]();var fs_extra=require(_0xfa66('0x4'));var auth=require(_0xfa66('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfa66('0x6'));var controller=require('./whatsappQueue.controller');router[_0xfa66('0x7')]('/',auth['isAuthenticated'](),controller[_0xfa66('0x8')]);router[_0xfa66('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xfa66('0x9')]);router['get'](_0xfa66('0xa'),auth[_0xfa66('0xb')](),controller[_0xfa66('0xc')]);router[_0xfa66('0x7')](_0xfa66('0xd'),auth[_0xfa66('0xb')](),controller[_0xfa66('0xe')]);router[_0xfa66('0x7')](_0xfa66('0xf'),auth[_0xfa66('0xb')](),controller['getTeams']);router[_0xfa66('0x7')](_0xfa66('0x10'),auth[_0xfa66('0xb')](),controller[_0xfa66('0x11')]);router['post']('/',auth[_0xfa66('0xb')](),controller['create']);router[_0xfa66('0x12')](_0xfa66('0xf'),auth[_0xfa66('0xb')](),controller[_0xfa66('0x13')]);router[_0xfa66('0x12')](_0xfa66('0x10'),auth[_0xfa66('0xb')](),controller[_0xfa66('0x14')]);router['put'](_0xfa66('0xa'),auth[_0xfa66('0xb')](),controller[_0xfa66('0x15')]);router['delete'](_0xfa66('0xa'),auth[_0xfa66('0xb')](),controller[_0xfa66('0x16')]);router[_0xfa66('0x17')](_0xfa66('0xf'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xfa66('0x17')](_0xfa66('0x10'),auth[_0xfa66('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x0876=['removeTeams','exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','getTeams','getAgents','post','create','/:id/teams','addTeams','/:id/users','addAgents','put','update','delete'];(function(_0x3ca871,_0x4984eb){var _0x2e95b9=function(_0x242473){while(--_0x242473){_0x3ca871['push'](_0x3ca871['shift']());}};_0x2e95b9(++_0x4984eb);}(_0x0876,0xc6));var _0x6087=function(_0x94731a,_0x5df419){_0x94731a=_0x94731a-0x0;var _0x5e6586=_0x0876[_0x94731a];return _0x5e6586;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6087('0x0'));var timeout=require('connect-timeout');var express=require(_0x6087('0x1'));var router=express['Router']();var fs_extra=require(_0x6087('0x2'));var auth=require(_0x6087('0x3'));var interaction=require(_0x6087('0x4'));var config=require(_0x6087('0x5'));var controller=require(_0x6087('0x6'));router[_0x6087('0x7')]('/',auth[_0x6087('0x8')](),controller[_0x6087('0x9')]);router[_0x6087('0x7')](_0x6087('0xa'),auth[_0x6087('0x8')](),controller['describe']);router[_0x6087('0x7')](_0x6087('0xb'),auth[_0x6087('0x8')](),controller[_0x6087('0xc')]);router[_0x6087('0x7')](_0x6087('0xd'),auth[_0x6087('0x8')](),controller[_0x6087('0xe')]);router[_0x6087('0x7')]('/:id/teams',auth[_0x6087('0x8')](),controller[_0x6087('0xf')]);router[_0x6087('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0x6087('0x10')]);router[_0x6087('0x11')]('/',auth[_0x6087('0x8')](),controller[_0x6087('0x12')]);router['post'](_0x6087('0x13'),auth['isAuthenticated'](),controller[_0x6087('0x14')]);router[_0x6087('0x11')](_0x6087('0x15'),auth[_0x6087('0x8')](),controller[_0x6087('0x16')]);router[_0x6087('0x17')](_0x6087('0xb'),auth[_0x6087('0x8')](),controller[_0x6087('0x18')]);router[_0x6087('0x19')]('/:id',auth[_0x6087('0x8')](),controller['destroy']);router[_0x6087('0x19')](_0x6087('0x13'),auth[_0x6087('0x8')](),controller[_0x6087('0x1a')]);router[_0x6087('0x19')]('/:id/users',auth[_0x6087('0x8')](),controller['removeAgents']);module[_0x6087('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 5bf7fb8..60f844d 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 _0x1ddc=['rrmemory','roundrobin','exports','STRING','name','ENUM'];(function(_0x19c64a,_0x482f68){var _0x78194a=function(_0x4043b6){while(--_0x4043b6){_0x19c64a['push'](_0x19c64a['shift']());}};_0x78194a(++_0x482f68);}(_0x1ddc,0x6e));var _0xc1dd=function(_0x3cd3f7,_0x45888c){_0x3cd3f7=_0x3cd3f7-0x0;var _0x21acd8=_0x1ddc[_0x3cd3f7];return _0x21acd8;};'use strict';var Sequelize=require('sequelize');module[_0xc1dd('0x0')]={'name':{'type':Sequelize[_0xc1dd('0x1')],'unique':_0xc1dd('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc1dd('0x3')](_0xc1dd('0x4'),'beepall',_0xc1dd('0x5'))},'description':{'type':Sequelize[_0xc1dd('0x1')]}}; \ No newline at end of file +var _0x0e9f=['INTEGER','beepall','sequelize','exports'];(function(_0x2240f4,_0x1fab91){var _0x52d0fc=function(_0x618831){while(--_0x618831){_0x2240f4['push'](_0x2240f4['shift']());}};_0x52d0fc(++_0x1fab91);}(_0x0e9f,0x116));var _0xf0e9=function(_0x49af2e,_0x55f373){_0x49af2e=_0x49af2e-0x0;var _0x8329b0=_0x0e9f[_0x49af2e];return _0x8329b0;};'use strict';var Sequelize=require(_0xf0e9('0x0'));module[_0xf0e9('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xf0e9('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xf0e9('0x3'),'roundrobin')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index c5947ac..77f2e13 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 _0x2678=['request-promise','mustache','path','sox','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','WhatsappQueues','UserProfileResource','name','send','index','map','WhatsappQueue','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserWhatsappQueue','WhatsappQueueId','findAll','UserId','whatsappPause','createdAt','format','%s/%s','SIP','getTeams','findOne','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','Team','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','transaction','removeTeams','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','emit','userWhatsappQueue:save','removeAgents','getAgents','eml-format','rimraf','zip-dir'];(function(_0x3fb256,_0xa066af){var _0x1ca90f=function(_0x3d717a){while(--_0x3d717a){_0x3fb256['push'](_0x3fb256['shift']());}};_0x1ca90f(++_0xa066af);}(_0x2678,0x87));var _0x8267=function(_0x4870fa,_0x37c587){_0x4870fa=_0x4870fa-0x0;var _0x1eba39=_0x2678[_0x4870fa];return _0x1eba39;};'use strict';var emlformat=require(_0x8267('0x0'));var rimraf=require(_0x8267('0x1'));var zipdir=require(_0x8267('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8267('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8267('0x4'));var util=require('util');var path=require(_0x8267('0x5'));var sox=require(_0x8267('0x6'));var csv=require('to-csv');var ejs=require(_0x8267('0x7'));var fs=require('fs');var fs_extra=require(_0x8267('0x8'));var _=require('lodash');var squel=require(_0x8267('0x9'));var crypto=require('crypto');var jsforce=require(_0x8267('0xa'));var deskjs=require(_0x8267('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8267('0xc'));var Redis=require(_0x8267('0xd'));var authService=require(_0x8267('0xe'));var qs=require(_0x8267('0xf'));var as=require(_0x8267('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8267('0x11'))(_0x8267('0x12'));var utils=require(_0x8267('0x13'));var config=require(_0x8267('0x14'));var licenseUtil=require(_0x8267('0x15'));var db=require(_0x8267('0x16'))['db'];config['redis']=_[_0x8267('0x17')](config[_0x8267('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x8267('0x19'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x8267('0x1a')](socket);function respondWithStatusCode(_0x20c294,_0x321510){_0x321510=_0x321510||0xcc;return function(_0x165db0){if(_0x165db0){return _0x20c294[_0x8267('0x1b')](_0x321510);}return _0x20c294[_0x8267('0x1c')](_0x321510)[_0x8267('0x1d')]();};}function respondWithResult(_0x171389,_0x1897d0){_0x1897d0=_0x1897d0||0xc8;return function(_0x5123a8){if(_0x5123a8){return _0x171389['status'](_0x1897d0)[_0x8267('0x1e')](_0x5123a8);}};}function respondWithFilteredResult(_0x8159a8,_0x5682fd){return function(_0x315ac5){if(_0x315ac5){var _0x119874=typeof _0x5682fd[_0x8267('0x1f')]==='undefined'&&typeof _0x5682fd['limit']===_0x8267('0x20');var _0x52424a=_0x315ac5['count'];var _0x3a7ded=_0x119874?0x0:_0x5682fd['offset'];var _0x4c7ed9=_0x119874?_0x315ac5[_0x8267('0x21')]:_0x5682fd[_0x8267('0x1f')]+_0x5682fd[_0x8267('0x22')];var _0x532b40;if(_0x4c7ed9>=_0x52424a){_0x4c7ed9=_0x52424a;_0x532b40=0xc8;}else{_0x532b40=0xce;}_0x8159a8[_0x8267('0x1c')](_0x532b40);return _0x8159a8['set'](_0x8267('0x23'),_0x3a7ded+'-'+_0x4c7ed9+'/'+_0x52424a)['json'](_0x315ac5);}return null;};}function patchUpdates(_0x356ab3){return function(_0x327f64){try{jsonpatch[_0x8267('0x24')](_0x327f64,_0x356ab3,!![]);}catch(_0x3e9603){return BPromise[_0x8267('0x25')](_0x3e9603);}return _0x327f64[_0x8267('0x26')]();};}function saveUpdates(_0xbd722c,_0x4fe74e){return function(_0x4b6531){if(_0x4b6531){return _0x4b6531[_0x8267('0x27')](_0xbd722c)['then'](function(_0x320cc4){return _0x320cc4;});}return null;};}function removeEntity(_0x372011,_0x2d9eb1){return function(_0x5e0bab){if(_0x5e0bab){return _0x5e0bab[_0x8267('0x28')]()[_0x8267('0x29')](function(){var _0x18e990=_0x5e0bab['get']({'plain':!![]});var _0x49cc03=_0x8267('0x2a');return db[_0x8267('0x2b')][_0x8267('0x28')]({'where':{'type':_0x49cc03,'resourceId':_0x18e990['id']}})[_0x8267('0x29')](function(){return _0x5e0bab;});})[_0x8267('0x29')](function(){_0x372011['status'](0xcc)[_0x8267('0x1d')]();});}};}function handleEntityNotFound(_0x43bf59,_0x284255){return function(_0x3cb588){if(!_0x3cb588){_0x43bf59[_0x8267('0x1b')](0x194);}return _0x3cb588;};}function handleError(_0x3f9c86,_0x5c42af){_0x5c42af=_0x5c42af||0x1f4;return function(_0x493a5d){logger['error'](_0x493a5d['stack']);if(_0x493a5d['name']){delete _0x493a5d[_0x8267('0x2c')];}_0x3f9c86[_0x8267('0x1c')](_0x5c42af)[_0x8267('0x2d')](_0x493a5d);};}exports[_0x8267('0x2e')]=function(_0x3053aa,_0x5f1305){var _0x322ccf={},_0x1fc447={},_0x18c45d={'count':0x0,'rows':[]};var _0x406f52=_[_0x8267('0x2f')](db[_0x8267('0x30')][_0x8267('0x31')],function(_0x46b3cc){return{'name':_0x46b3cc['fieldName'],'type':_0x46b3cc['type'][_0x8267('0x32')]};});_0x1fc447[_0x8267('0x33')]=_[_0x8267('0x2f')](_0x406f52,_0x8267('0x2c'));_0x1fc447[_0x8267('0x34')]=_[_0x8267('0x35')](_0x3053aa[_0x8267('0x34')]);_0x1fc447[_0x8267('0x36')]=_[_0x8267('0x37')](_0x1fc447['model'],_0x1fc447[_0x8267('0x34')]);_0x322ccf[_0x8267('0x38')]=_['intersection'](_0x1fc447[_0x8267('0x33')],qs[_0x8267('0x39')](_0x3053aa[_0x8267('0x34')][_0x8267('0x39')]));_0x322ccf[_0x8267('0x38')]=_0x322ccf[_0x8267('0x38')][_0x8267('0x3a')]?_0x322ccf[_0x8267('0x38')]:_0x1fc447['model'];if(!_0x3053aa[_0x8267('0x34')][_0x8267('0x3b')](_0x8267('0x3c'))){_0x322ccf[_0x8267('0x22')]=qs['limit'](_0x3053aa[_0x8267('0x34')]['limit']);_0x322ccf[_0x8267('0x1f')]=qs[_0x8267('0x1f')](_0x3053aa[_0x8267('0x34')]['offset']);}_0x322ccf[_0x8267('0x3d')]=qs[_0x8267('0x3e')](_0x3053aa[_0x8267('0x34')][_0x8267('0x3e')]);_0x322ccf[_0x8267('0x3f')]=qs[_0x8267('0x36')](_[_0x8267('0x40')](_0x3053aa[_0x8267('0x34')],_0x1fc447[_0x8267('0x36')]),_0x406f52);if(_0x3053aa[_0x8267('0x34')]['filter']){_0x322ccf[_0x8267('0x3f')]=_[_0x8267('0x41')](_0x322ccf[_0x8267('0x3f')],{'$or':_['map'](_0x406f52,function(_0x2ccb84){if(_0x2ccb84[_0x8267('0x42')]!==_0x8267('0x43')){var _0xb5efda={};_0xb5efda[_0x2ccb84[_0x8267('0x2c')]]={'$like':'%'+_0x3053aa['query'][_0x8267('0x44')]+'%'};return _0xb5efda;}})});}_0x322ccf=_[_0x8267('0x41')]({},_0x322ccf,_0x3053aa['options']);var _0x3efc82={'where':_0x322ccf[_0x8267('0x3f')]};return db[_0x8267('0x30')][_0x8267('0x21')](_0x3efc82)[_0x8267('0x29')](function(_0x512181){_0x18c45d[_0x8267('0x21')]=_0x512181;if(_0x3053aa[_0x8267('0x34')][_0x8267('0x45')]){_0x322ccf['include']=[{'all':!![]}];}return db['WhatsappQueue']['findAll'](_0x322ccf);})[_0x8267('0x29')](function(_0x9ad138){_0x18c45d[_0x8267('0x46')]=_0x9ad138;return _0x18c45d;})[_0x8267('0x29')](respondWithFilteredResult(_0x5f1305,_0x322ccf))[_0x8267('0x47')](handleError(_0x5f1305,null));};exports[_0x8267('0x48')]=function(_0x2dfcb2,_0x20a676){var _0x2b7b41={'raw':!![],'where':{'id':_0x2dfcb2[_0x8267('0x49')]['id']}},_0x465e04={};_0x465e04[_0x8267('0x33')]=_[_0x8267('0x35')](db[_0x8267('0x30')]['rawAttributes']);_0x465e04[_0x8267('0x34')]=_['keys'](_0x2dfcb2[_0x8267('0x34')]);_0x465e04[_0x8267('0x36')]=_[_0x8267('0x37')](_0x465e04['model'],_0x465e04[_0x8267('0x34')]);_0x2b7b41[_0x8267('0x38')]=_[_0x8267('0x37')](_0x465e04[_0x8267('0x33')],qs['fields'](_0x2dfcb2['query']['fields']));_0x2b7b41[_0x8267('0x38')]=_0x2b7b41['attributes'][_0x8267('0x3a')]?_0x2b7b41['attributes']:_0x465e04[_0x8267('0x33')];if(_0x2dfcb2[_0x8267('0x34')][_0x8267('0x45')]){_0x2b7b41['include']=[{'all':!![]}];}_0x2b7b41=_[_0x8267('0x41')]({},_0x2b7b41,_0x2dfcb2[_0x8267('0x4a')]);return db[_0x8267('0x30')][_0x8267('0x4b')](_0x2b7b41)[_0x8267('0x29')](handleEntityNotFound(_0x20a676,null))[_0x8267('0x29')](respondWithResult(_0x20a676,null))['catch'](handleError(_0x20a676,null));};exports[_0x8267('0x4c')]=function(_0x4746d1,_0x340887){return db[_0x8267('0x30')][_0x8267('0x4c')](_0x4746d1[_0x8267('0x4d')],{})[_0x8267('0x29')](function(_0x2cda01){var _0x2b0fb0=_0x4746d1[_0x8267('0x4e')]['get']({'plain':!![]});if(!_0x2b0fb0)throw new Error(_0x8267('0x4f'));if(_0x2b0fb0[_0x8267('0x50')]===_0x8267('0x4e')){var _0x5df5bd=_0x2cda01[_0x8267('0x51')]({'plain':!![]});var _0x2af944=_0x8267('0x2a');return db[_0x8267('0x52')][_0x8267('0x4b')]({'where':{'name':_0x2af944,'userProfileId':_0x2b0fb0['userProfileId']},'raw':!![]})[_0x8267('0x29')](function(_0x580da8){if(_0x580da8&&_0x580da8[_0x8267('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x5df5bd[_0x8267('0x2c')],'resourceId':_0x5df5bd['id'],'type':_0x580da8['name'],'sectionId':_0x580da8['id']},{})[_0x8267('0x29')](function(){return _0x2cda01;});}else{return _0x2cda01;}})[_0x8267('0x47')](function(_0x1ade7e){logger['error'](_0x8267('0x54'),_0x1ade7e);throw _0x1ade7e;});}return _0x2cda01;})[_0x8267('0x29')](respondWithResult(_0x340887,0xc9))[_0x8267('0x47')](handleError(_0x340887,null));};exports[_0x8267('0x27')]=function(_0x3145b1,_0x552038){if(_0x3145b1['body']['id']){delete _0x3145b1[_0x8267('0x4d')]['id'];}return db[_0x8267('0x30')][_0x8267('0x4b')]({'where':{'id':_0x3145b1[_0x8267('0x49')]['id']}})['then'](handleEntityNotFound(_0x552038,null))[_0x8267('0x29')](saveUpdates(_0x3145b1['body'],null))[_0x8267('0x29')](respondWithResult(_0x552038,null))[_0x8267('0x47')](handleError(_0x552038,null));};exports[_0x8267('0x28')]=function(_0x505ed,_0x41479b){return db[_0x8267('0x30')][_0x8267('0x4b')]({'where':{'id':_0x505ed[_0x8267('0x49')]['id']}})[_0x8267('0x29')](handleEntityNotFound(_0x41479b,null))[_0x8267('0x29')](removeEntity(_0x41479b,null))['catch'](handleError(_0x41479b,null));};exports[_0x8267('0x55')]=function(_0x3f6654,_0x43be3b){return db[_0x8267('0x30')][_0x8267('0x55')]()[_0x8267('0x29')](respondWithResult(_0x43be3b,null))[_0x8267('0x47')](handleError(_0x43be3b,null));};exports['getMembers']=function(_0x25ff47,_0x4f8af7,_0x233b1e){var _0x1a70c0={'raw':!![],'where':{}},_0x2f9993={},_0x2ffe64;return db[_0x8267('0x30')]['findOne']({'where':{'id':_0x25ff47[_0x8267('0x49')]['id']}})[_0x8267('0x29')](handleEntityNotFound(_0x4f8af7,null))['then'](function(_0xe12290){if(_0xe12290){_0x2ffe64=_0xe12290['get']({'plain':!![]});_0x2f9993[_0x8267('0x33')]=_[_0x8267('0x35')](db[_0x8267('0x56')][_0x8267('0x31')]);_0x2f9993[_0x8267('0x34')]=_[_0x8267('0x35')](_0x25ff47[_0x8267('0x34')]);_0x2f9993[_0x8267('0x36')]=_[_0x8267('0x37')](_0x2f9993[_0x8267('0x33')],_0x2f9993[_0x8267('0x34')]);_0x1a70c0[_0x8267('0x38')]=_['intersection'](_0x2f9993[_0x8267('0x33')],qs[_0x8267('0x39')](_0x25ff47[_0x8267('0x34')][_0x8267('0x39')]));_0x1a70c0[_0x8267('0x38')]=_0x1a70c0[_0x8267('0x38')][_0x8267('0x3a')]?_0x1a70c0['attributes']:_0x2f9993[_0x8267('0x33')];if(!_0x25ff47[_0x8267('0x34')]['hasOwnProperty'](_0x8267('0x3c'))){_0x1a70c0['limit']=qs[_0x8267('0x22')](_0x25ff47[_0x8267('0x34')][_0x8267('0x22')]);_0x1a70c0[_0x8267('0x1f')]=qs[_0x8267('0x1f')](_0x25ff47[_0x8267('0x34')][_0x8267('0x1f')]);}_0x1a70c0[_0x8267('0x3d')]=qs[_0x8267('0x3e')](_0x25ff47[_0x8267('0x34')][_0x8267('0x3e')]);_0x1a70c0[_0x8267('0x3f')]=qs['filters'](_[_0x8267('0x40')](_0x25ff47['query'],_0x2f9993[_0x8267('0x36')]));_0x1a70c0[_0x8267('0x3f')][_0x8267('0x57')]=_0xe12290['id'];if(_0x25ff47[_0x8267('0x34')][_0x8267('0x44')]){_0x1a70c0[_0x8267('0x3f')]=_[_0x8267('0x41')](_0x1a70c0[_0x8267('0x3f')],{'$or':_['map'](_0x1a70c0[_0x8267('0x38')],function(_0x217363){var _0x282e07={};_0x282e07[_0x217363]={'$like':'%'+_0x25ff47[_0x8267('0x34')]['filter']+'%'};return _0x282e07;})});}_0x1a70c0=_[_0x8267('0x41')]({},_0x1a70c0,_0x25ff47[_0x8267('0x4a')]);return db[_0x8267('0x56')][_0x8267('0x58')](_0x1a70c0);}})[_0x8267('0x29')](function(_0x365c80){if(_0x365c80){return db['User']['findAndCountAll']({'where':{'id':_[_0x8267('0x2f')](_0x365c80,_0x8267('0x59')),'role':'agent'},'attributes':['id',_0x8267('0x2c'),_0x8267('0x5a'),'updatedAt',_0x8267('0x5b')]});}})[_0x8267('0x29')](function(_0x5eaad6){if(_0x5eaad6){return{'count':_0x5eaad6['count'],'rows':_[_0x8267('0x2f')](_0x5eaad6[_0x8267('0x46')],function(_0x494a6e){return{'membername':_0x494a6e['name'],'UserId':_0x494a6e['id'],'queue_name':_0x2ffe64[_0x8267('0x2c')],'WhatsappQueueId':_0x2ffe64['id'],'interface':util[_0x8267('0x5c')](_0x8267('0x5d'),_0x8267('0x5e'),_0x494a6e[_0x8267('0x2c')]),'penalty':0x0,'paused':_0x494a6e[_0x8267('0x5a')],'createdAt':_0x494a6e[_0x8267('0x5b')],'updatedAt':_0x494a6e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4f8af7,_0x1a70c0))['catch'](handleError(_0x4f8af7,null));};exports[_0x8267('0x5f')]=function(_0x51e9c6,_0x57cbd1,_0x44c54f){var _0x46c75d={};var _0x3d50d0={};var _0x44076c;var _0x5078a5;return db['WhatsappQueue'][_0x8267('0x60')]({'where':{'id':_0x51e9c6[_0x8267('0x49')]['id']}})[_0x8267('0x29')](handleEntityNotFound(_0x57cbd1,null))['then'](function(_0x40bc69){if(_0x40bc69){_0x44076c=_0x40bc69;_0x3d50d0['model']=_['keys'](db['Team']['rawAttributes']);_0x3d50d0[_0x8267('0x34')]=_[_0x8267('0x35')](_0x51e9c6['query']);_0x3d50d0['filters']=_[_0x8267('0x37')](_0x3d50d0[_0x8267('0x33')],_0x3d50d0['query']);_0x46c75d[_0x8267('0x38')]=_[_0x8267('0x37')](_0x3d50d0[_0x8267('0x33')],qs['fields'](_0x51e9c6[_0x8267('0x34')][_0x8267('0x39')]));_0x46c75d[_0x8267('0x38')]=_0x46c75d['attributes']['length']?_0x46c75d['attributes']:_0x3d50d0['model'];_0x46c75d['order']=qs[_0x8267('0x3e')](_0x51e9c6[_0x8267('0x34')][_0x8267('0x3e')]);_0x46c75d['where']=qs[_0x8267('0x36')](_[_0x8267('0x40')](_0x51e9c6[_0x8267('0x34')],_0x3d50d0[_0x8267('0x36')]));if(_0x51e9c6[_0x8267('0x34')][_0x8267('0x44')]){_0x46c75d[_0x8267('0x3f')]=_['merge'](_0x46c75d[_0x8267('0x3f')],{'$or':_['map'](_0x46c75d[_0x8267('0x38')],function(_0x331548){var _0x289908={};_0x289908[_0x331548]={'$like':'%'+_0x51e9c6[_0x8267('0x34')]['filter']+'%'};return _0x289908;})});}_0x46c75d=_['merge']({},_0x46c75d,_0x51e9c6[_0x8267('0x4a')]);return _0x44076c[_0x8267('0x5f')](_0x46c75d);}})[_0x8267('0x29')](function(_0x563a66){if(_0x563a66){_0x5078a5=_0x563a66['length'];if(!_0x51e9c6['query'][_0x8267('0x3b')](_0x8267('0x3c'))){_0x46c75d[_0x8267('0x22')]=qs[_0x8267('0x22')](_0x51e9c6['query'][_0x8267('0x22')]);_0x46c75d['offset']=qs[_0x8267('0x1f')](_0x51e9c6['query'][_0x8267('0x1f')]);}return _0x44076c[_0x8267('0x5f')](_0x46c75d);}})[_0x8267('0x29')](function(_0x3c23f0){if(_0x3c23f0){return _0x3c23f0?{'count':_0x5078a5,'rows':_0x3c23f0}:null;}})['then'](respondWithResult(_0x57cbd1,null))[_0x8267('0x47')](handleError(_0x57cbd1,null));};exports[_0x8267('0x61')]=function(_0x281322,_0x86aa20,_0x5b686d){var _0x1c9439=_0x281322[_0x8267('0x4d')][_0x8267('0x62')];return db['Team'][_0x8267('0x58')]({'where':{'id':_0x1c9439},'attributes':['id'],'include':[{'model':db[_0x8267('0x63')],'as':_0x8267('0x64'),'attributes':['id',_0x8267('0x2c'),_0x8267('0x65'),_0x8267('0x66'),_0x8267('0x67')],'raw':!![]}]})['then'](function(_0x3bb7b3){if(_0x3bb7b3){var _0x1ae16e=_[_0x8267('0x68')](_0x3bb7b3,function(_0x5d0d56){var _0x4b8ac3=_0x5d0d56['get']({'plain':!![]});return _0x4b8ac3['Agents'];});return db[_0x8267('0x30')][_0x8267('0x4b')]({'where':{'id':_0x281322[_0x8267('0x49')]['id']}})[_0x8267('0x29')](function(_0x296b8f){return db[_0x8267('0x69')]['transaction'](function(_0x2d04af){return _0x296b8f[_0x8267('0x61')](_0x1c9439,{'transaction':_0x2d04af})[_0x8267('0x29')](function(){return BPromise[_0x8267('0x6a')](_0x1ae16e,function(_0x51ccde){return db[_0x8267('0x56')][_0x8267('0x6b')]({'where':{'UserId':_0x51ccde['id'],'WhatsappQueueId':_0x281322[_0x8267('0x49')]['id']},'transaction':_0x2d04af});});})[_0x8267('0x29')](function(){_0x1ae16e['forEach'](function(_0x5cc64f){socket['emit']('userWhatsappQueue:save',{'UserId':_0x5cc64f['id'],'WhatsappQueueId':_0x296b8f['id']});});});});});}})[_0x8267('0x29')](respondWithStatusCode(_0x86aa20,null))[_0x8267('0x47')](handleError(_0x86aa20,null));};exports['removeTeams']=function(_0x5c2743,_0x4346fe,_0x3be18d){return db[_0x8267('0x6c')][_0x8267('0x58')]({'where':{'id':_0x5c2743[_0x8267('0x34')]['ids']},'attributes':['id'],'include':[{'model':db[_0x8267('0x63')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x8267('0x29')](handleEntityNotFound(_0x4346fe,null))[_0x8267('0x29')](function(_0x20c2cf){var _0x181465=_[_0x8267('0x2f')](_0x20c2cf,'id');var _0x181714=[];var _0x1231f0=[];var _0x9b3ce7=squel[_0x8267('0x6d')]();_0x9b3ce7[_0x8267('0x6e')](_0x8267('0x6f'))[_0x8267('0x70')](_0x8267('0x71'),'tq')[_0x8267('0x72')]('user_has_teams','ut',_0x8267('0x73'))[_0x8267('0x3f')](_0x8267('0x74'),_0x5c2743[_0x8267('0x49')]['id']);for(var _0x5bf5c4=0x0;_0x5bf5c4<_0x20c2cf[_0x8267('0x3a')];_0x5bf5c4+=0x1){let _0x4539cd=_0x20c2cf[_0x5bf5c4];for(var _0x156e2c=0x0;_0x156e2c<_0x4539cd[_0x8267('0x64')][_0x8267('0x3a')];_0x156e2c+=0x1){let _0x2971e5=_0x4539cd[_0x8267('0x64')][_0x156e2c];var _0xc8b4de=_0x9b3ce7['clone']();_0xc8b4de[_0x8267('0x3f')](_0x8267('0x75'),_0x2971e5['id']);_0x1231f0['push'](db[_0x8267('0x69')]['query'](_0xc8b4de[_0x8267('0x76')](),{'type':db[_0x8267('0x69')][_0x8267('0x77')][_0x8267('0x78')]})[_0x8267('0x29')](function(_0x49be38){if(_0x49be38['length']===0x1){return _0x2971e5['id'];}else{var _0x3082be=_['every'](_[_0x8267('0x2f')](_0x49be38,_0x8267('0x79')),function(_0x31a15d){return _[_0x8267('0x7a')](_0x181465,_0x31a15d);});if(_0x3082be){return _0x2971e5['id'];}}}));}}return BPromise[_0x8267('0x7b')](_0x1231f0)[_0x8267('0x29')](function(_0x43df8f){_0x181714=_(_0x181714)[_0x8267('0x7c')](_0x43df8f)[_0x8267('0x7d')]()[_0x8267('0x7e')]();return db[_0x8267('0x30')][_0x8267('0x4b')]({'where':{'id':_0x5c2743['params']['id']}})[_0x8267('0x29')](function(_0x2f3b03){return db[_0x8267('0x69')][_0x8267('0x7f')](function(_0x2f764b){return _0x2f3b03[_0x8267('0x80')](_0x5c2743[_0x8267('0x34')]['ids'],{'transaction':_0x2f764b})['then'](function(){if(!_[_0x8267('0x81')](_0x181714)){return _0x2f3b03['removeAgents'](_0x181714,{'transaction':_0x2f764b});}})[_0x8267('0x29')](function(){_0x181714['forEach'](function(_0x220e30){socket['emit'](_0x8267('0x82'),{'UserId':_0x220e30,'WhatsappQueueId':_0x2f3b03['id']});});});});});});})[_0x8267('0x29')](respondWithStatusCode(_0x4346fe,null))[_0x8267('0x47')](handleError(_0x4346fe,null));};exports[_0x8267('0x83')]=function(_0x210d38,_0x56af58,_0x43c893){return db['WhatsappQueue'][_0x8267('0x4b')]({'where':{'id':_0x210d38['params']['id']}})[_0x8267('0x29')](handleEntityNotFound(_0x56af58,null))['then'](function(_0x39a7bf){if(_0x39a7bf){return _0x39a7bf['addAgents'](_0x210d38['body']['ids'],_[_0x8267('0x84')](_0x210d38[_0x8267('0x4d')],[_0x8267('0x62'),'id'])||{})[_0x8267('0x85')](function(_0x86fd53){for(var _0x50b436=0x0;_0x50b436<_0x210d38[_0x8267('0x4d')][_0x8267('0x62')][_0x8267('0x3a')];_0x50b436+=0x1){socket[_0x8267('0x86')](_0x8267('0x87'),{'UserId':Number(_0x210d38[_0x8267('0x4d')][_0x8267('0x62')][_0x50b436]),'WhatsappQueueId':Number(_0x210d38['params']['id'])});}return _0x86fd53;});}})['then'](respondWithResult(_0x56af58,null))[_0x8267('0x47')](handleError(_0x56af58,null));};exports[_0x8267('0x88')]=function(_0x2e615e,_0x46138f,_0x21d666){return db[_0x8267('0x30')][_0x8267('0x4b')]({'where':{'id':_0x2e615e[_0x8267('0x49')]['id']}})[_0x8267('0x29')](handleEntityNotFound(_0x46138f,null))['then'](function(_0x341e4b){if(_0x341e4b){return _0x341e4b[_0x8267('0x88')](_0x2e615e[_0x8267('0x34')][_0x8267('0x62')])[_0x8267('0x29')](function(){if(_['isArray'](_0x2e615e[_0x8267('0x34')][_0x8267('0x62')])){for(var _0x5d4ff0=0x0;_0x5d4ff0<_0x2e615e[_0x8267('0x34')]['ids'][_0x8267('0x3a')];_0x5d4ff0+=0x1){socket[_0x8267('0x86')](_0x8267('0x82'),{'UserId':Number(_0x2e615e['query']['ids'][_0x5d4ff0]),'WhatsappQueueId':Number(_0x2e615e[_0x8267('0x49')]['id'])});}}else{socket[_0x8267('0x86')](_0x8267('0x82'),{'UserId':Number(_0x2e615e[_0x8267('0x34')]['ids']),'WhatsappQueueId':Number(_0x2e615e[_0x8267('0x49')]['id'])});}});}})[_0x8267('0x29')](respondWithStatusCode(_0x46138f,null))[_0x8267('0x47')](handleError(_0x46138f,null));};exports[_0x8267('0x89')]=function(_0x4c3c6d,_0x2304e9,_0x336f15){var _0x1d1df1={};var _0x151daa={};var _0x18e62b;var _0x13981f;return db['WhatsappQueue'][_0x8267('0x60')]({'where':{'id':_0x4c3c6d[_0x8267('0x49')]['id']}})[_0x8267('0x29')](handleEntityNotFound(_0x2304e9,null))[_0x8267('0x29')](function(_0x2ef25f){if(_0x2ef25f){_0x18e62b=_0x2ef25f;_0x151daa[_0x8267('0x33')]=_[_0x8267('0x35')](db['User'][_0x8267('0x31')]);_0x151daa[_0x8267('0x34')]=_[_0x8267('0x35')](_0x4c3c6d[_0x8267('0x34')]);_0x151daa[_0x8267('0x36')]=_[_0x8267('0x37')](_0x151daa[_0x8267('0x33')],_0x151daa['query']);_0x1d1df1[_0x8267('0x38')]=_[_0x8267('0x37')](_0x151daa[_0x8267('0x33')],qs['fields'](_0x4c3c6d[_0x8267('0x34')][_0x8267('0x39')]));_0x1d1df1[_0x8267('0x38')]=_0x1d1df1[_0x8267('0x38')][_0x8267('0x3a')]?_0x1d1df1[_0x8267('0x38')]:_0x151daa[_0x8267('0x33')];_0x1d1df1[_0x8267('0x3d')]=qs['sort'](_0x4c3c6d[_0x8267('0x34')]['sort']);_0x1d1df1[_0x8267('0x3f')]=qs[_0x8267('0x36')](_[_0x8267('0x40')](_0x4c3c6d[_0x8267('0x34')],_0x151daa[_0x8267('0x36')]));if(_0x4c3c6d['query'][_0x8267('0x44')]){_0x1d1df1['where']=_['merge'](_0x1d1df1[_0x8267('0x3f')],{'$or':_[_0x8267('0x2f')](_0x1d1df1[_0x8267('0x38')],function(_0x28a434){var _0x319e1a={};_0x319e1a[_0x28a434]={'$like':'%'+_0x4c3c6d[_0x8267('0x34')][_0x8267('0x44')]+'%'};return _0x319e1a;})});}_0x1d1df1=_[_0x8267('0x41')]({},_0x1d1df1,_0x4c3c6d['options']);return _0x18e62b[_0x8267('0x89')](_0x1d1df1);}})[_0x8267('0x29')](function(_0x1b9407){if(_0x1b9407){_0x13981f=_0x1b9407[_0x8267('0x3a')];if(!_0x4c3c6d[_0x8267('0x34')][_0x8267('0x3b')](_0x8267('0x3c'))){_0x1d1df1[_0x8267('0x22')]=qs[_0x8267('0x22')](_0x4c3c6d[_0x8267('0x34')]['limit']);_0x1d1df1[_0x8267('0x1f')]=qs[_0x8267('0x1f')](_0x4c3c6d[_0x8267('0x34')][_0x8267('0x1f')]);}return _0x18e62b['getAgents'](_0x1d1df1);}})[_0x8267('0x29')](function(_0x1a7cd3){if(_0x1a7cd3){return _0x1a7cd3?{'count':_0x13981f,'rows':_0x1a7cd3}:null;}})[_0x8267('0x29')](respondWithResult(_0x2304e9,null))[_0x8267('0x47')](handleError(_0x2304e9,null));}; \ No newline at end of file +var _0x8095=['offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','catch','params','keys','rawAttributes','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','order','sort','UserId','updatedAt','format','%s/%s','SIP','whatsappPause','createdAt','Team','getTeams','addTeams','ids','User','Agents','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','userWhatsappQueue:save','field','tq.TeamId','from','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','removeTeams','isEmpty','removeAgents','emit','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','end','json'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x8095,0x191));var _0x5809=function(_0x1833bb,_0x5d5b03){_0x1833bb=_0x1833bb-0x0;var _0x170826=_0x8095[_0x1833bb];return _0x170826;};'use strict';var emlformat=require(_0x5809('0x0'));var rimraf=require(_0x5809('0x1'));var zipdir=require(_0x5809('0x2'));var jsonpatch=require(_0x5809('0x3'));var rp=require(_0x5809('0x4'));var moment=require(_0x5809('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5809('0x6'));var path=require(_0x5809('0x7'));var sox=require('sox');var csv=require(_0x5809('0x8'));var ejs=require(_0x5809('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5809('0xa'));var squel=require(_0x5809('0xb'));var crypto=require(_0x5809('0xc'));var jsforce=require(_0x5809('0xd'));var deskjs=require(_0x5809('0xe'));var toCsv=require(_0x5809('0x8'));var querystring=require(_0x5809('0xf'));var Papa=require(_0x5809('0x10'));var Redis=require(_0x5809('0x11'));var authService=require(_0x5809('0x12'));var qs=require(_0x5809('0x13'));var as=require(_0x5809('0x14'));var hardwareService=require(_0x5809('0x15'));var logger=require(_0x5809('0x16'))('api');var utils=require(_0x5809('0x17'));var config=require(_0x5809('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5809('0x19'))['db'];config[_0x5809('0x1a')]=_[_0x5809('0x1b')](config[_0x5809('0x1a')],{'host':_0x5809('0x1c'),'port':0x18eb});var socket=require(_0x5809('0x1d'))(new Redis(config[_0x5809('0x1a')]));require(_0x5809('0x1e'))['register'](socket);function respondWithStatusCode(_0x5eda23,_0x2f91bc){_0x2f91bc=_0x2f91bc||0xcc;return function(_0x491824){if(_0x491824){return _0x5eda23[_0x5809('0x1f')](_0x2f91bc);}return _0x5eda23['status'](_0x2f91bc)[_0x5809('0x20')]();};}function respondWithResult(_0x3710d5,_0x2d0588){_0x2d0588=_0x2d0588||0xc8;return function(_0x1ee341){if(_0x1ee341){return _0x3710d5['status'](_0x2d0588)[_0x5809('0x21')](_0x1ee341);}};}function respondWithFilteredResult(_0x3bad43,_0x33ab3b){return function(_0x3c13b5){if(_0x3c13b5){var _0x46794b=typeof _0x33ab3b[_0x5809('0x22')]===_0x5809('0x23')&&typeof _0x33ab3b[_0x5809('0x24')]===_0x5809('0x23');var _0xb5f94c=_0x3c13b5[_0x5809('0x25')];var _0x4f843d=_0x46794b?0x0:_0x33ab3b[_0x5809('0x22')];var _0x3d8039=_0x46794b?_0x3c13b5[_0x5809('0x25')]:_0x33ab3b['offset']+_0x33ab3b[_0x5809('0x24')];var _0x423a85;if(_0x3d8039>=_0xb5f94c){_0x3d8039=_0xb5f94c;_0x423a85=0xc8;}else{_0x423a85=0xce;}_0x3bad43[_0x5809('0x26')](_0x423a85);return _0x3bad43[_0x5809('0x27')](_0x5809('0x28'),_0x4f843d+'-'+_0x3d8039+'/'+_0xb5f94c)[_0x5809('0x21')](_0x3c13b5);}return null;};}function patchUpdates(_0x3d304c){return function(_0x3664c0){try{jsonpatch['apply'](_0x3664c0,_0x3d304c,!![]);}catch(_0x410236){return BPromise[_0x5809('0x29')](_0x410236);}return _0x3664c0[_0x5809('0x2a')]();};}function saveUpdates(_0x2a939d,_0x12d26e){return function(_0x20394e){if(_0x20394e){return _0x20394e[_0x5809('0x2b')](_0x2a939d)[_0x5809('0x2c')](function(_0x4e0f31){return _0x4e0f31;});}return null;};}function removeEntity(_0x346371,_0x1ed375){return function(_0x2579c9){if(_0x2579c9){return _0x2579c9[_0x5809('0x2d')]()[_0x5809('0x2c')](function(){var _0x291167=_0x2579c9[_0x5809('0x2e')]({'plain':!![]});var _0x57c2df='WhatsappQueues';return db[_0x5809('0x2f')][_0x5809('0x2d')]({'where':{'type':_0x57c2df,'resourceId':_0x291167['id']}})[_0x5809('0x2c')](function(){return _0x2579c9;});})[_0x5809('0x2c')](function(){_0x346371['status'](0xcc)[_0x5809('0x20')]();});}};}function handleEntityNotFound(_0x16c3cf,_0x50357a){return function(_0x36a137){if(!_0x36a137){_0x16c3cf[_0x5809('0x1f')](0x194);}return _0x36a137;};}function handleError(_0x4cd296,_0x110a18){_0x110a18=_0x110a18||0x1f4;return function(_0xa7e4){logger[_0x5809('0x30')](_0xa7e4[_0x5809('0x31')]);if(_0xa7e4[_0x5809('0x32')]){delete _0xa7e4[_0x5809('0x32')];}_0x4cd296[_0x5809('0x26')](_0x110a18)[_0x5809('0x33')](_0xa7e4);};}exports[_0x5809('0x34')]=function(_0x750770,_0x56537e){var _0x535338={},_0x3f5b4e={},_0x21d83a={'count':0x0,'rows':[]};var _0x840864=_[_0x5809('0x35')](db[_0x5809('0x36')]['rawAttributes'],function(_0x366712){return{'name':_0x366712[_0x5809('0x37')],'type':_0x366712['type'][_0x5809('0x38')]};});_0x3f5b4e[_0x5809('0x39')]=_['map'](_0x840864,_0x5809('0x32'));_0x3f5b4e['query']=_['keys'](_0x750770[_0x5809('0x3a')]);_0x3f5b4e[_0x5809('0x3b')]=_[_0x5809('0x3c')](_0x3f5b4e[_0x5809('0x39')],_0x3f5b4e[_0x5809('0x3a')]);_0x535338[_0x5809('0x3d')]=_['intersection'](_0x3f5b4e[_0x5809('0x39')],qs[_0x5809('0x3e')](_0x750770[_0x5809('0x3a')][_0x5809('0x3e')]));_0x535338[_0x5809('0x3d')]=_0x535338[_0x5809('0x3d')][_0x5809('0x3f')]?_0x535338[_0x5809('0x3d')]:_0x3f5b4e[_0x5809('0x39')];if(!_0x750770['query'][_0x5809('0x40')](_0x5809('0x41'))){_0x535338[_0x5809('0x24')]=qs['limit'](_0x750770[_0x5809('0x3a')]['limit']);_0x535338[_0x5809('0x22')]=qs[_0x5809('0x22')](_0x750770[_0x5809('0x3a')][_0x5809('0x22')]);}_0x535338['order']=qs['sort'](_0x750770['query']['sort']);_0x535338[_0x5809('0x42')]=qs[_0x5809('0x3b')](_[_0x5809('0x43')](_0x750770[_0x5809('0x3a')],_0x3f5b4e[_0x5809('0x3b')]),_0x840864);if(_0x750770[_0x5809('0x3a')][_0x5809('0x44')]){_0x535338['where']=_[_0x5809('0x45')](_0x535338['where'],{'$or':_[_0x5809('0x35')](_0x840864,function(_0x461db6){if(_0x461db6[_0x5809('0x46')]!==_0x5809('0x47')){var _0x37a711={};_0x37a711[_0x461db6[_0x5809('0x32')]]={'$like':'%'+_0x750770['query'][_0x5809('0x44')]+'%'};return _0x37a711;}})});}_0x535338=_[_0x5809('0x45')]({},_0x535338,_0x750770['options']);var _0x1a93e7={'where':_0x535338['where']};return db[_0x5809('0x36')][_0x5809('0x25')](_0x1a93e7)[_0x5809('0x2c')](function(_0x9b0e6d){_0x21d83a['count']=_0x9b0e6d;if(_0x750770[_0x5809('0x3a')]['includeAll']){_0x535338[_0x5809('0x48')]=[{'all':!![]}];}return db[_0x5809('0x36')][_0x5809('0x49')](_0x535338);})[_0x5809('0x2c')](function(_0x942dd2){_0x21d83a[_0x5809('0x4a')]=_0x942dd2;return _0x21d83a;})['then'](respondWithFilteredResult(_0x56537e,_0x535338))[_0x5809('0x4b')](handleError(_0x56537e,null));};exports['show']=function(_0x16658a,_0x4233a2){var _0x387149={'raw':!![],'where':{'id':_0x16658a[_0x5809('0x4c')]['id']}},_0x10c88b={};_0x10c88b[_0x5809('0x39')]=_[_0x5809('0x4d')](db[_0x5809('0x36')][_0x5809('0x4e')]);_0x10c88b['query']=_[_0x5809('0x4d')](_0x16658a[_0x5809('0x3a')]);_0x10c88b['filters']=_[_0x5809('0x3c')](_0x10c88b[_0x5809('0x39')],_0x10c88b[_0x5809('0x3a')]);_0x387149[_0x5809('0x3d')]=_['intersection'](_0x10c88b['model'],qs[_0x5809('0x3e')](_0x16658a['query']['fields']));_0x387149['attributes']=_0x387149[_0x5809('0x3d')]['length']?_0x387149['attributes']:_0x10c88b['model'];if(_0x16658a[_0x5809('0x3a')][_0x5809('0x4f')]){_0x387149['include']=[{'all':!![]}];}_0x387149=_[_0x5809('0x45')]({},_0x387149,_0x16658a[_0x5809('0x50')]);return db['WhatsappQueue'][_0x5809('0x51')](_0x387149)[_0x5809('0x2c')](handleEntityNotFound(_0x4233a2,null))[_0x5809('0x2c')](respondWithResult(_0x4233a2,null))[_0x5809('0x4b')](handleError(_0x4233a2,null));};exports[_0x5809('0x52')]=function(_0x38210e,_0x2fae62){return db[_0x5809('0x36')][_0x5809('0x52')](_0x38210e[_0x5809('0x53')],{})[_0x5809('0x2c')](function(_0x3126d5){var _0x54c1a1=_0x38210e[_0x5809('0x54')]['get']({'plain':!![]});if(!_0x54c1a1)throw new Error(_0x5809('0x55'));if(_0x54c1a1[_0x5809('0x56')]===_0x5809('0x54')){var _0xb349e6=_0x3126d5[_0x5809('0x2e')]({'plain':!![]});var _0x215373='WhatsappQueues';return db[_0x5809('0x57')][_0x5809('0x51')]({'where':{'name':_0x215373,'userProfileId':_0x54c1a1[_0x5809('0x58')]},'raw':!![]})['then'](function(_0x30b903){if(_0x30b903&&_0x30b903[_0x5809('0x59')]===0x0){return db[_0x5809('0x2f')]['create']({'name':_0xb349e6[_0x5809('0x32')],'resourceId':_0xb349e6['id'],'type':_0x30b903[_0x5809('0x32')],'sectionId':_0x30b903['id']},{})[_0x5809('0x2c')](function(){return _0x3126d5;});}else{return _0x3126d5;}})[_0x5809('0x4b')](function(_0x1f7896){logger['error'](_0x5809('0x5a'),_0x1f7896);throw _0x1f7896;});}return _0x3126d5;})[_0x5809('0x2c')](respondWithResult(_0x2fae62,0xc9))[_0x5809('0x4b')](handleError(_0x2fae62,null));};exports[_0x5809('0x2b')]=function(_0x1589ff,_0x38d523){if(_0x1589ff['body']['id']){delete _0x1589ff[_0x5809('0x53')]['id'];}return db['WhatsappQueue'][_0x5809('0x51')]({'where':{'id':_0x1589ff[_0x5809('0x4c')]['id']}})[_0x5809('0x2c')](handleEntityNotFound(_0x38d523,null))[_0x5809('0x2c')](saveUpdates(_0x1589ff[_0x5809('0x53')],null))['then'](respondWithResult(_0x38d523,null))[_0x5809('0x4b')](handleError(_0x38d523,null));};exports[_0x5809('0x2d')]=function(_0x1c227a,_0x15c09a){return db[_0x5809('0x36')][_0x5809('0x51')]({'where':{'id':_0x1c227a[_0x5809('0x4c')]['id']}})[_0x5809('0x2c')](handleEntityNotFound(_0x15c09a,null))[_0x5809('0x2c')](removeEntity(_0x15c09a,null))[_0x5809('0x4b')](handleError(_0x15c09a,null));};exports[_0x5809('0x5b')]=function(_0x3ab84b,_0x320421){return db[_0x5809('0x36')]['describe']()['then'](respondWithResult(_0x320421,null))[_0x5809('0x4b')](handleError(_0x320421,null));};exports[_0x5809('0x5c')]=function(_0x4ffb08,_0xc816a2,_0xf33797){var _0x1e818f={'raw':!![],'where':{}},_0x50a2a6={},_0x2330ac;return db[_0x5809('0x36')][_0x5809('0x5d')]({'where':{'id':_0x4ffb08['params']['id']}})[_0x5809('0x2c')](handleEntityNotFound(_0xc816a2,null))['then'](function(_0x1468d5){if(_0x1468d5){_0x2330ac=_0x1468d5[_0x5809('0x2e')]({'plain':!![]});_0x50a2a6[_0x5809('0x39')]=_[_0x5809('0x4d')](db[_0x5809('0x5e')][_0x5809('0x4e')]);_0x50a2a6[_0x5809('0x3a')]=_['keys'](_0x4ffb08['query']);_0x50a2a6[_0x5809('0x3b')]=_[_0x5809('0x3c')](_0x50a2a6[_0x5809('0x39')],_0x50a2a6[_0x5809('0x3a')]);_0x1e818f[_0x5809('0x3d')]=_[_0x5809('0x3c')](_0x50a2a6[_0x5809('0x39')],qs['fields'](_0x4ffb08[_0x5809('0x3a')][_0x5809('0x3e')]));_0x1e818f['attributes']=_0x1e818f[_0x5809('0x3d')][_0x5809('0x3f')]?_0x1e818f[_0x5809('0x3d')]:_0x50a2a6['model'];if(!_0x4ffb08[_0x5809('0x3a')][_0x5809('0x40')](_0x5809('0x41'))){_0x1e818f[_0x5809('0x24')]=qs[_0x5809('0x24')](_0x4ffb08[_0x5809('0x3a')][_0x5809('0x24')]);_0x1e818f[_0x5809('0x22')]=qs['offset'](_0x4ffb08[_0x5809('0x3a')]['offset']);}_0x1e818f[_0x5809('0x5f')]=qs[_0x5809('0x60')](_0x4ffb08[_0x5809('0x3a')][_0x5809('0x60')]);_0x1e818f[_0x5809('0x42')]=qs[_0x5809('0x3b')](_['pick'](_0x4ffb08['query'],_0x50a2a6[_0x5809('0x3b')]));_0x1e818f[_0x5809('0x42')]['WhatsappQueueId']=_0x1468d5['id'];if(_0x4ffb08[_0x5809('0x3a')][_0x5809('0x44')]){_0x1e818f[_0x5809('0x42')]=_[_0x5809('0x45')](_0x1e818f[_0x5809('0x42')],{'$or':_[_0x5809('0x35')](_0x1e818f[_0x5809('0x3d')],function(_0x51f303){var _0x187f7d={};_0x187f7d[_0x51f303]={'$like':'%'+_0x4ffb08['query'][_0x5809('0x44')]+'%'};return _0x187f7d;})});}_0x1e818f=_[_0x5809('0x45')]({},_0x1e818f,_0x4ffb08['options']);return db[_0x5809('0x5e')][_0x5809('0x49')](_0x1e818f);}})[_0x5809('0x2c')](function(_0x311875){if(_0x311875){return db['User']['findAndCountAll']({'where':{'id':_[_0x5809('0x35')](_0x311875,_0x5809('0x61')),'role':'agent'},'attributes':['id','name','whatsappPause',_0x5809('0x62'),'createdAt']});}})[_0x5809('0x2c')](function(_0x36ccd2){if(_0x36ccd2){return{'count':_0x36ccd2[_0x5809('0x25')],'rows':_[_0x5809('0x35')](_0x36ccd2[_0x5809('0x4a')],function(_0x1a8be8){return{'membername':_0x1a8be8[_0x5809('0x32')],'UserId':_0x1a8be8['id'],'queue_name':_0x2330ac[_0x5809('0x32')],'WhatsappQueueId':_0x2330ac['id'],'interface':util[_0x5809('0x63')](_0x5809('0x64'),_0x5809('0x65'),_0x1a8be8['name']),'penalty':0x0,'paused':_0x1a8be8[_0x5809('0x66')],'createdAt':_0x1a8be8[_0x5809('0x67')],'updatedAt':_0x1a8be8[_0x5809('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5809('0x2c')](respondWithFilteredResult(_0xc816a2,_0x1e818f))[_0x5809('0x4b')](handleError(_0xc816a2,null));};exports['getTeams']=function(_0x179fa0,_0x36ac40,_0x4d056b){var _0x521959={};var _0x5a8e95={};var _0xd4184a;var _0x3cca45;return db[_0x5809('0x36')][_0x5809('0x5d')]({'where':{'id':_0x179fa0[_0x5809('0x4c')]['id']}})[_0x5809('0x2c')](handleEntityNotFound(_0x36ac40,null))[_0x5809('0x2c')](function(_0x4387ad){if(_0x4387ad){_0xd4184a=_0x4387ad;_0x5a8e95[_0x5809('0x39')]=_[_0x5809('0x4d')](db[_0x5809('0x68')][_0x5809('0x4e')]);_0x5a8e95['query']=_[_0x5809('0x4d')](_0x179fa0[_0x5809('0x3a')]);_0x5a8e95[_0x5809('0x3b')]=_[_0x5809('0x3c')](_0x5a8e95['model'],_0x5a8e95[_0x5809('0x3a')]);_0x521959['attributes']=_['intersection'](_0x5a8e95[_0x5809('0x39')],qs[_0x5809('0x3e')](_0x179fa0['query'][_0x5809('0x3e')]));_0x521959[_0x5809('0x3d')]=_0x521959[_0x5809('0x3d')][_0x5809('0x3f')]?_0x521959[_0x5809('0x3d')]:_0x5a8e95[_0x5809('0x39')];_0x521959[_0x5809('0x5f')]=qs[_0x5809('0x60')](_0x179fa0['query'][_0x5809('0x60')]);_0x521959[_0x5809('0x42')]=qs['filters'](_['pick'](_0x179fa0[_0x5809('0x3a')],_0x5a8e95[_0x5809('0x3b')]));if(_0x179fa0['query'][_0x5809('0x44')]){_0x521959[_0x5809('0x42')]=_[_0x5809('0x45')](_0x521959[_0x5809('0x42')],{'$or':_[_0x5809('0x35')](_0x521959[_0x5809('0x3d')],function(_0x57ee8c){var _0x28440b={};_0x28440b[_0x57ee8c]={'$like':'%'+_0x179fa0[_0x5809('0x3a')]['filter']+'%'};return _0x28440b;})});}_0x521959=_[_0x5809('0x45')]({},_0x521959,_0x179fa0[_0x5809('0x50')]);return _0xd4184a[_0x5809('0x69')](_0x521959);}})['then'](function(_0x4748de){if(_0x4748de){_0x3cca45=_0x4748de['length'];if(!_0x179fa0['query'][_0x5809('0x40')](_0x5809('0x41'))){_0x521959[_0x5809('0x24')]=qs[_0x5809('0x24')](_0x179fa0[_0x5809('0x3a')][_0x5809('0x24')]);_0x521959[_0x5809('0x22')]=qs[_0x5809('0x22')](_0x179fa0[_0x5809('0x3a')]['offset']);}return _0xd4184a[_0x5809('0x69')](_0x521959);}})[_0x5809('0x2c')](function(_0x2a5056){if(_0x2a5056){return _0x2a5056?{'count':_0x3cca45,'rows':_0x2a5056}:null;}})[_0x5809('0x2c')](respondWithResult(_0x36ac40,null))[_0x5809('0x4b')](handleError(_0x36ac40,null));};exports[_0x5809('0x6a')]=function(_0x31b1f0,_0x35a340,_0x3fbf18){var _0x4e3e31=_0x31b1f0['body'][_0x5809('0x6b')];return db[_0x5809('0x68')][_0x5809('0x49')]({'where':{'id':_0x4e3e31},'attributes':['id'],'include':[{'model':db[_0x5809('0x6c')],'as':_0x5809('0x6d'),'attributes':['id',_0x5809('0x32'),'online',_0x5809('0x6e'),_0x5809('0x6f')],'raw':!![]}]})[_0x5809('0x2c')](function(_0xee6dea){if(_0xee6dea){var _0x18216d=_[_0x5809('0x70')](_0xee6dea,function(_0xf40cfd){var _0xf7b666=_0xf40cfd[_0x5809('0x2e')]({'plain':!![]});return _0xf7b666[_0x5809('0x6d')];});return db[_0x5809('0x36')][_0x5809('0x51')]({'where':{'id':_0x31b1f0[_0x5809('0x4c')]['id']}})[_0x5809('0x2c')](function(_0x52f421){return db[_0x5809('0x71')]['transaction'](function(_0x2c8476){return _0x52f421[_0x5809('0x6a')](_0x4e3e31,{'transaction':_0x2c8476})[_0x5809('0x2c')](function(){return BPromise[_0x5809('0x72')](_0x18216d,function(_0x1fe398){return db[_0x5809('0x5e')][_0x5809('0x73')]({'where':{'UserId':_0x1fe398['id'],'WhatsappQueueId':_0x31b1f0[_0x5809('0x4c')]['id']},'transaction':_0x2c8476});});})[_0x5809('0x2c')](function(){_0x18216d[_0x5809('0x74')](function(_0x36536c){socket['emit'](_0x5809('0x75'),{'UserId':_0x36536c['id'],'WhatsappQueueId':_0x52f421['id']});});});});});}})[_0x5809('0x2c')](respondWithStatusCode(_0x35a340,null))[_0x5809('0x4b')](handleError(_0x35a340,null));};exports['removeTeams']=function(_0x635ebe,_0x275280,_0x3187c5){return db[_0x5809('0x68')][_0x5809('0x49')]({'where':{'id':_0x635ebe[_0x5809('0x3a')][_0x5809('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x5809('0x6c')],'as':_0x5809('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x5809('0x2c')](handleEntityNotFound(_0x275280,null))['then'](function(_0x273cdb){var _0x861dd9=_['map'](_0x273cdb,'id');var _0x455d0c=[];var _0x4c133c=[];var _0x4d118c=squel['select']();_0x4d118c[_0x5809('0x76')](_0x5809('0x77'))[_0x5809('0x78')]('team_has_whatsapp_queues','tq')[_0x5809('0x79')](_0x5809('0x7a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x5809('0x42')](_0x5809('0x7b'),_0x635ebe[_0x5809('0x4c')]['id']);for(var _0x59a346=0x0;_0x59a346<_0x273cdb[_0x5809('0x3f')];_0x59a346+=0x1){let _0x24fd7d=_0x273cdb[_0x59a346];for(var _0x467e4a=0x0;_0x467e4a<_0x24fd7d[_0x5809('0x6d')][_0x5809('0x3f')];_0x467e4a+=0x1){let _0x10f1a2=_0x24fd7d[_0x5809('0x6d')][_0x467e4a];var _0x9a549f=_0x4d118c[_0x5809('0x7c')]();_0x9a549f[_0x5809('0x42')](_0x5809('0x7d'),_0x10f1a2['id']);_0x4c133c[_0x5809('0x7e')](db[_0x5809('0x71')]['query'](_0x9a549f[_0x5809('0x7f')](),{'type':db[_0x5809('0x71')][_0x5809('0x80')][_0x5809('0x81')]})[_0x5809('0x2c')](function(_0x500b0b){if(_0x500b0b[_0x5809('0x3f')]===0x1){return _0x10f1a2['id'];}else{var _0x449885=_[_0x5809('0x82')](_['map'](_0x500b0b,_0x5809('0x83')),function(_0x3a1c0a){return _[_0x5809('0x84')](_0x861dd9,_0x3a1c0a);});if(_0x449885){return _0x10f1a2['id'];}}}));}}return BPromise['all'](_0x4c133c)['then'](function(_0x1cb464){_0x455d0c=_(_0x455d0c)[_0x5809('0x85')](_0x1cb464)[_0x5809('0x86')]()[_0x5809('0x87')]();return db['WhatsappQueue'][_0x5809('0x51')]({'where':{'id':_0x635ebe[_0x5809('0x4c')]['id']}})[_0x5809('0x2c')](function(_0x1615ca){return db[_0x5809('0x71')]['transaction'](function(_0x49aba6){return _0x1615ca[_0x5809('0x88')](_0x635ebe[_0x5809('0x3a')]['ids'],{'transaction':_0x49aba6})[_0x5809('0x2c')](function(){if(!_[_0x5809('0x89')](_0x455d0c)){return _0x1615ca[_0x5809('0x8a')](_0x455d0c,{'transaction':_0x49aba6});}})['then'](function(){_0x455d0c['forEach'](function(_0x38d8e6){socket[_0x5809('0x8b')](_0x5809('0x8c'),{'UserId':_0x38d8e6,'WhatsappQueueId':_0x1615ca['id']});});});});});});})[_0x5809('0x2c')](respondWithStatusCode(_0x275280,null))[_0x5809('0x4b')](handleError(_0x275280,null));};exports[_0x5809('0x8d')]=function(_0x38fcc7,_0xd62e78,_0x383fb0){return db['WhatsappQueue']['find']({'where':{'id':_0x38fcc7[_0x5809('0x4c')]['id']}})[_0x5809('0x2c')](handleEntityNotFound(_0xd62e78,null))[_0x5809('0x2c')](function(_0x1250d8){if(_0x1250d8){return _0x1250d8[_0x5809('0x8d')](_0x38fcc7[_0x5809('0x53')][_0x5809('0x6b')],_[_0x5809('0x8e')](_0x38fcc7[_0x5809('0x53')],[_0x5809('0x6b'),'id'])||{})['spread'](function(_0x305967){for(var _0x4f23b=0x0;_0x4f23b<_0x38fcc7[_0x5809('0x53')][_0x5809('0x6b')][_0x5809('0x3f')];_0x4f23b+=0x1){socket[_0x5809('0x8b')]('userWhatsappQueue:save',{'UserId':Number(_0x38fcc7[_0x5809('0x53')][_0x5809('0x6b')][_0x4f23b]),'WhatsappQueueId':Number(_0x38fcc7[_0x5809('0x4c')]['id'])});}return _0x305967;});}})['then'](respondWithResult(_0xd62e78,null))[_0x5809('0x4b')](handleError(_0xd62e78,null));};exports[_0x5809('0x8a')]=function(_0x362c14,_0x5de40c,_0x13e566){return db['WhatsappQueue']['find']({'where':{'id':_0x362c14[_0x5809('0x4c')]['id']}})[_0x5809('0x2c')](handleEntityNotFound(_0x5de40c,null))[_0x5809('0x2c')](function(_0x32b520){if(_0x32b520){return _0x32b520[_0x5809('0x8a')](_0x362c14[_0x5809('0x3a')][_0x5809('0x6b')])[_0x5809('0x2c')](function(){if(_[_0x5809('0x8f')](_0x362c14['query'][_0x5809('0x6b')])){for(var _0x28714d=0x0;_0x28714d<_0x362c14['query']['ids'][_0x5809('0x3f')];_0x28714d+=0x1){socket[_0x5809('0x8b')](_0x5809('0x8c'),{'UserId':Number(_0x362c14[_0x5809('0x3a')][_0x5809('0x6b')][_0x28714d]),'WhatsappQueueId':Number(_0x362c14['params']['id'])});}}else{socket[_0x5809('0x8b')](_0x5809('0x8c'),{'UserId':Number(_0x362c14[_0x5809('0x3a')][_0x5809('0x6b')]),'WhatsappQueueId':Number(_0x362c14[_0x5809('0x4c')]['id'])});}});}})[_0x5809('0x2c')](respondWithStatusCode(_0x5de40c,null))['catch'](handleError(_0x5de40c,null));};exports[_0x5809('0x90')]=function(_0x44ad0e,_0x1f8e1d,_0x2b5856){var _0x1acefe={};var _0x57800d={};var _0x406a6c;var _0xd94b06;return db[_0x5809('0x36')]['findOne']({'where':{'id':_0x44ad0e[_0x5809('0x4c')]['id']}})[_0x5809('0x2c')](handleEntityNotFound(_0x1f8e1d,null))[_0x5809('0x2c')](function(_0x1f7b97){if(_0x1f7b97){_0x406a6c=_0x1f7b97;_0x57800d[_0x5809('0x39')]=_[_0x5809('0x4d')](db[_0x5809('0x6c')]['rawAttributes']);_0x57800d['query']=_[_0x5809('0x4d')](_0x44ad0e[_0x5809('0x3a')]);_0x57800d['filters']=_[_0x5809('0x3c')](_0x57800d[_0x5809('0x39')],_0x57800d[_0x5809('0x3a')]);_0x1acefe[_0x5809('0x3d')]=_['intersection'](_0x57800d['model'],qs[_0x5809('0x3e')](_0x44ad0e[_0x5809('0x3a')]['fields']));_0x1acefe['attributes']=_0x1acefe[_0x5809('0x3d')]['length']?_0x1acefe[_0x5809('0x3d')]:_0x57800d[_0x5809('0x39')];_0x1acefe['order']=qs[_0x5809('0x60')](_0x44ad0e[_0x5809('0x3a')]['sort']);_0x1acefe[_0x5809('0x42')]=qs[_0x5809('0x3b')](_[_0x5809('0x43')](_0x44ad0e['query'],_0x57800d[_0x5809('0x3b')]));if(_0x44ad0e['query']['filter']){_0x1acefe[_0x5809('0x42')]=_['merge'](_0x1acefe[_0x5809('0x42')],{'$or':_[_0x5809('0x35')](_0x1acefe[_0x5809('0x3d')],function(_0x23b0a2){var _0x2ffdbd={};_0x2ffdbd[_0x23b0a2]={'$like':'%'+_0x44ad0e['query']['filter']+'%'};return _0x2ffdbd;})});}_0x1acefe=_[_0x5809('0x45')]({},_0x1acefe,_0x44ad0e[_0x5809('0x50')]);return _0x406a6c[_0x5809('0x90')](_0x1acefe);}})[_0x5809('0x2c')](function(_0x466147){if(_0x466147){_0xd94b06=_0x466147['length'];if(!_0x44ad0e[_0x5809('0x3a')][_0x5809('0x40')](_0x5809('0x41'))){_0x1acefe[_0x5809('0x24')]=qs[_0x5809('0x24')](_0x44ad0e['query'][_0x5809('0x24')]);_0x1acefe[_0x5809('0x22')]=qs[_0x5809('0x22')](_0x44ad0e[_0x5809('0x3a')][_0x5809('0x22')]);}return _0x406a6c[_0x5809('0x90')](_0x1acefe);}})[_0x5809('0x2c')](function(_0x456899){if(_0x456899){return _0x456899?{'count':_0xd94b06,'rows':_0x456899}:null;}})[_0x5809('0x2c')](respondWithResult(_0x1f8e1d,null))[_0x5809('0x4b')](handleError(_0x1f8e1d,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 11c0a42..afb8c95 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 _0x1d8e=['save','update','emit','hasOwnProperty','exports','events','WhatsappQueue'];(function(_0x372e71,_0x2d51f4){var _0x39ebcf=function(_0xcb645f){while(--_0xcb645f){_0x372e71['push'](_0x372e71['shift']());}};_0x39ebcf(++_0x2d51f4);}(_0x1d8e,0x147));var _0xe1d8=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x1d8e[_0x45d3f0];return _0x314b79;};'use strict';var EventEmitter=require(_0xe1d8('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0xe1d8('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe1d8('0x2'),'afterUpdate':_0xe1d8('0x3'),'afterDestroy':'remove'};function emitEvent(_0x213975){return function(_0x200965,_0x4194dc,_0xe43bba){WhatsappQueueEvents[_0xe1d8('0x4')](_0x213975+':'+_0x200965['id'],_0x200965);WhatsappQueueEvents['emit'](_0x213975,_0x200965);_0xe43bba(null);};}for(var e in events){if(events[_0xe1d8('0x5')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xe1d8('0x6')]=WhatsappQueueEvents; \ No newline at end of file +var _0x49cd=['hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x53a409,_0x5e4af9){var _0x11c277=function(_0x102c37){while(--_0x102c37){_0x53a409['push'](_0x53a409['shift']());}};_0x11c277(++_0x5e4af9);}(_0x49cd,0xc8));var _0xd49c=function(_0x1f83a5,_0x59843f){_0x1f83a5=_0x1f83a5-0x0;var _0x45edf0=_0x49cd[_0x1f83a5];return _0x45edf0;};'use strict';var EventEmitter=require(_0xd49c('0x0'));var WhatsappQueue=require(_0xd49c('0x1'))['db'][_0xd49c('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xd49c('0x3')](0x0);var events={'afterCreate':_0xd49c('0x4'),'afterUpdate':_0xd49c('0x5'),'afterDestroy':_0xd49c('0x6')};function emitEvent(_0x331945){return function(_0x3ce26c,_0x3e7371,_0x2f5c33){WhatsappQueueEvents['emit'](_0x331945+':'+_0x3ce26c['id'],_0x3ce26c);WhatsappQueueEvents[_0xd49c('0x7')](_0x331945,_0x3ce26c);_0x2f5c33(null);};}for(var e in events){if(events[_0xd49c('0x8')](e)){var event=events[e];WhatsappQueue[_0xd49c('0x9')](e,emitEvent(event));}}module[_0xd49c('0xa')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index b5c58b3..20af272 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 _0x8020=['WhatsappQueue','lodash','../../config/logger','moment','request-promise','path','rimraf','./whatsappQueue.attributes','define'];(function(_0x5811f0,_0x100089){var _0x20bb7b=function(_0x2b1fc0){while(--_0x2b1fc0){_0x5811f0['push'](_0x5811f0['shift']());}};_0x20bb7b(++_0x100089);}(_0x8020,0xbe));var _0x0802=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x8020[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x0802('0x0'));var util=require('util');var logger=require(_0x0802('0x1'))('api');var moment=require(_0x0802('0x2'));var BPromise=require('bluebird');var rp=require(_0x0802('0x3'));var fs=require('fs');var path=require(_0x0802('0x4'));var rimraf=require(_0x0802('0x5'));var config=require('../../config/environment');var attributes=require(_0x0802('0x6'));module['exports']=function(_0x53fe69,_0x29a2ba){return _0x53fe69[_0x0802('0x7')](_0x0802('0x8'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f96=['request-promise','path','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','lodash','util','../../config/logger','moment','bluebird'];(function(_0x45b71b,_0x45ede1){var _0x4ba105=function(_0x6aebd){while(--_0x6aebd){_0x45b71b['push'](_0x45b71b['shift']());}};_0x4ba105(++_0x45ede1);}(_0x9f96,0x133));var _0x69f9=function(_0x3a894f,_0x33b6e4){_0x3a894f=_0x3a894f-0x0;var _0x966974=_0x9f96[_0x3a894f];return _0x966974;};'use strict';var _=require(_0x69f9('0x0'));var util=require(_0x69f9('0x1'));var logger=require(_0x69f9('0x2'))('api');var moment=require(_0x69f9('0x3'));var BPromise=require(_0x69f9('0x4'));var rp=require(_0x69f9('0x5'));var fs=require('fs');var path=require(_0x69f9('0x6'));var rimraf=require('rimraf');var config=require(_0x69f9('0x7'));var attributes=require(_0x69f9('0x8'));module[_0x69f9('0x9')]=function(_0x2b7f2b,_0x3cc718){return _0x2b7f2b[_0x69f9('0xa')](_0x69f9('0xb'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index df0cf1e..c1589a7 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 _0xb70c=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappQueue.socket','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowWhatsappQueue','find','catch','lodash','moment'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xb70c,0xa2));var _0xcb70=function(_0x2afb44,_0x249a57){_0x2afb44=_0x2afb44-0x0;var _0x15ccc2=_0xb70c[_0x2afb44];return _0x15ccc2;};'use strict';var _=require(_0xcb70('0x0'));var util=require('util');var moment=require(_0xcb70('0x1'));var BPromise=require(_0xcb70('0x2'));var rs=require(_0xcb70('0x3'));var fs=require('fs');var Redis=require(_0xcb70('0x4'));var db=require(_0xcb70('0x5'))['db'];var utils=require(_0xcb70('0x6'));var logger=require('../../config/logger')(_0xcb70('0x7'));var config=require(_0xcb70('0x8'));var jayson=require(_0xcb70('0x9'));var client=jayson[_0xcb70('0xa')]['http']({'port':0x232a});config[_0xcb70('0xb')]=_['defaults'](config[_0xcb70('0xb')],{'host':_0xcb70('0xc'),'port':0x18eb});var socket=require(_0xcb70('0xd'))(new Redis(config[_0xcb70('0xb')]));require(_0xcb70('0xe'))['register'](socket);function respondWithRpcPromise(_0x59021d,_0x373850,_0x44b637){return new BPromise(function(_0x47afdb,_0x51a708){return client[_0xcb70('0xf')](_0x59021d,_0x44b637)[_0xcb70('0x10')](function(_0x4f4f97){logger[_0xcb70('0x11')](_0xcb70('0x12'),_0x373850,_0xcb70('0x13'));logger[_0xcb70('0x14')](_0xcb70('0x15'),_0x373850,'request\x20sent',JSON[_0xcb70('0x16')](_0x4f4f97));if(_0x4f4f97[_0xcb70('0x17')]){if(_0x4f4f97[_0xcb70('0x17')][_0xcb70('0x18')]===0x1f4){logger['error'](_0xcb70('0x12'),_0x373850,_0x4f4f97[_0xcb70('0x17')]['message']);return _0x51a708(_0x4f4f97[_0xcb70('0x17')]['message']);}logger[_0xcb70('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x373850,_0x4f4f97[_0xcb70('0x17')]['message']);return _0x47afdb(_0x4f4f97['error'][_0xcb70('0x19')]);}else{logger[_0xcb70('0x11')](_0xcb70('0x12'),_0x373850,_0xcb70('0x13'));_0x47afdb(_0x4f4f97[_0xcb70('0x1a')][_0xcb70('0x19')]);}})['catch'](function(_0x559086){logger[_0xcb70('0x17')](_0xcb70('0x12'),_0x373850,_0x559086);_0x51a708(_0x559086);});});}exports[_0xcb70('0x1b')]=function(_0x5002cb){var _0x24952f=this;return new Promise(function(_0x51be5c,_0x387fed){return db[_0xcb70('0x1c')][_0xcb70('0x1d')]({'raw':_0x5002cb['options']?_0x5002cb[_0xcb70('0x1e')][_0xcb70('0x1f')]===undefined?!![]:![]:!![],'where':_0x5002cb['options']?_0x5002cb['options'][_0xcb70('0x20')]||null:null,'attributes':_0x5002cb['options']?_0x5002cb[_0xcb70('0x1e')][_0xcb70('0x21')]||null:null,'limit':_0x5002cb[_0xcb70('0x1e')]?_0x5002cb[_0xcb70('0x1e')][_0xcb70('0x22')]||null:null,'include':_0x5002cb['options']?_0x5002cb[_0xcb70('0x1e')][_0xcb70('0x23')]?_['map'](_0x5002cb['options']['include'],function(_0x4d1a6d){return{'model':db[_0x4d1a6d['model']],'as':_0x4d1a6d['as'],'attributes':_0x4d1a6d[_0xcb70('0x21')],'include':_0x4d1a6d[_0xcb70('0x23')]?_[_0xcb70('0x24')](_0x4d1a6d['include'],function(_0x33e622){return{'model':db[_0x33e622[_0xcb70('0x25')]],'as':_0x33e622['as'],'attributes':_0x33e622[_0xcb70('0x21')],'include':_0x33e622[_0xcb70('0x23')]?_[_0xcb70('0x24')](_0x33e622[_0xcb70('0x23')],function(_0x3c0761){return{'model':db[_0x3c0761[_0xcb70('0x25')]],'as':_0x3c0761['as'],'attributes':_0x3c0761[_0xcb70('0x21')]};}):[]};}):[]};}):[]:[]})[_0xcb70('0x10')](function(_0x3f970d){logger[_0xcb70('0x11')](_0xcb70('0x1b'),_0x5002cb);logger[_0xcb70('0x14')](_0xcb70('0x1b'),_0x5002cb,JSON[_0xcb70('0x16')](_0x3f970d));_0x51be5c(_0x3f970d);})['catch'](function(_0x4dffd3){logger[_0xcb70('0x17')](_0xcb70('0x1b'),_0x4dffd3[_0xcb70('0x19')],_0x5002cb);_0x387fed(_0x24952f[_0xcb70('0x17')](0x1f4,_0x4dffd3[_0xcb70('0x19')]));});});};exports[_0xcb70('0x26')]=function(_0x52376f){var _0x280497=this;return new Promise(function(_0x46e02f,_0x4822b2){return db[_0xcb70('0x1c')][_0xcb70('0x27')]({'raw':_0x52376f[_0xcb70('0x1e')]?_0x52376f['options']['raw']===undefined?!![]:![]:!![],'where':_0x52376f[_0xcb70('0x1e')]?_0x52376f['options'][_0xcb70('0x20')]||null:null,'attributes':_0x52376f['options']?_0x52376f[_0xcb70('0x1e')]['attributes']||null:null,'include':_0x52376f[_0xcb70('0x1e')]?_0x52376f[_0xcb70('0x1e')][_0xcb70('0x23')]?_[_0xcb70('0x24')](_0x52376f[_0xcb70('0x1e')][_0xcb70('0x23')],function(_0xfa40b0){return{'model':db[_0xfa40b0['model']],'as':_0xfa40b0['as'],'attributes':_0xfa40b0[_0xcb70('0x21')],'include':_0xfa40b0[_0xcb70('0x23')]?_[_0xcb70('0x24')](_0xfa40b0[_0xcb70('0x23')],function(_0x31c422){return{'model':db[_0x31c422[_0xcb70('0x25')]],'as':_0x31c422['as'],'attributes':_0x31c422[_0xcb70('0x21')],'include':_0x31c422[_0xcb70('0x23')]?_[_0xcb70('0x24')](_0x31c422[_0xcb70('0x23')],function(_0x9125fe){return{'model':db[_0x9125fe['model']],'as':_0x9125fe['as'],'attributes':_0x9125fe[_0xcb70('0x21')]};}):[]};}):[]};}):[]:[]})[_0xcb70('0x10')](function(_0x3680e1){logger[_0xcb70('0x11')]('ShowWhatsappQueue',_0x52376f);logger[_0xcb70('0x14')](_0xcb70('0x26'),_0x52376f,JSON[_0xcb70('0x16')](_0x3680e1));_0x46e02f(_0x3680e1);})[_0xcb70('0x28')](function(_0x19090a){logger[_0xcb70('0x17')](_0xcb70('0x26'),_0x19090a[_0xcb70('0x19')],_0x52376f);_0x4822b2(_0x280497[_0xcb70('0x17')](0x1f4,_0x19090a[_0xcb70('0x19')]));});});}; \ No newline at end of file +var _0xa62b=['../../mysqldb','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','where','limit','include','map','attributes','then','ShowWhatsappQueue','find','model','lodash','util','moment','randomstring','ioredis'];(function(_0x182a0b,_0x4d1ca2){var _0x58a4c2=function(_0x1fca3f){while(--_0x1fca3f){_0x182a0b['push'](_0x182a0b['shift']());}};_0x58a4c2(++_0x4d1ca2);}(_0xa62b,0x97));var _0xba62=function(_0x44ea77,_0x9b74){_0x44ea77=_0x44ea77-0x0;var _0x5f82c8=_0xa62b[_0x44ea77];return _0x5f82c8;};'use strict';var _=require(_0xba62('0x0'));var util=require(_0xba62('0x1'));var moment=require(_0xba62('0x2'));var BPromise=require('bluebird');var rs=require(_0xba62('0x3'));var fs=require('fs');var Redis=require(_0xba62('0x4'));var db=require(_0xba62('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xba62('0x6'));var jayson=require(_0xba62('0x7'));var client=jayson[_0xba62('0x8')][_0xba62('0x9')]({'port':0x232a});config[_0xba62('0xa')]=_[_0xba62('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xba62('0xc'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0xba62('0xd')](socket);function respondWithRpcPromise(_0x781479,_0x6c3fd1,_0x532706){return new BPromise(function(_0x1da174,_0x3b36c8){return client[_0xba62('0xe')](_0x781479,_0x532706)['then'](function(_0x31e8e9){logger[_0xba62('0xf')]('WhatsappQueue,\x20%s,\x20%s',_0x6c3fd1,_0xba62('0x10'));logger[_0xba62('0x11')](_0xba62('0x12'),_0x6c3fd1,'request\x20sent',JSON[_0xba62('0x13')](_0x31e8e9));if(_0x31e8e9[_0xba62('0x14')]){if(_0x31e8e9[_0xba62('0x14')][_0xba62('0x15')]===0x1f4){logger[_0xba62('0x14')](_0xba62('0x16'),_0x6c3fd1,_0x31e8e9[_0xba62('0x14')][_0xba62('0x17')]);return _0x3b36c8(_0x31e8e9['error'][_0xba62('0x17')]);}logger[_0xba62('0x14')](_0xba62('0x16'),_0x6c3fd1,_0x31e8e9[_0xba62('0x14')][_0xba62('0x17')]);return _0x1da174(_0x31e8e9[_0xba62('0x14')][_0xba62('0x17')]);}else{logger[_0xba62('0xf')]('WhatsappQueue,\x20%s,\x20%s',_0x6c3fd1,'request\x20sent');_0x1da174(_0x31e8e9[_0xba62('0x18')][_0xba62('0x17')]);}})[_0xba62('0x19')](function(_0x288726){logger[_0xba62('0x14')](_0xba62('0x16'),_0x6c3fd1,_0x288726);_0x3b36c8(_0x288726);});});}exports[_0xba62('0x1a')]=function(_0x5c6ffc){var _0x17d4e0=this;return new Promise(function(_0x2e2fc3,_0x2b96da){return db[_0xba62('0x1b')][_0xba62('0x1c')]({'raw':_0x5c6ffc[_0xba62('0x1d')]?_0x5c6ffc[_0xba62('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5c6ffc[_0xba62('0x1d')]?_0x5c6ffc[_0xba62('0x1d')][_0xba62('0x1e')]||null:null,'attributes':_0x5c6ffc[_0xba62('0x1d')]?_0x5c6ffc[_0xba62('0x1d')]['attributes']||null:null,'limit':_0x5c6ffc['options']?_0x5c6ffc[_0xba62('0x1d')][_0xba62('0x1f')]||null:null,'include':_0x5c6ffc[_0xba62('0x1d')]?_0x5c6ffc[_0xba62('0x1d')][_0xba62('0x20')]?_[_0xba62('0x21')](_0x5c6ffc[_0xba62('0x1d')]['include'],function(_0x324058){return{'model':db[_0x324058['model']],'as':_0x324058['as'],'attributes':_0x324058['attributes'],'include':_0x324058[_0xba62('0x20')]?_[_0xba62('0x21')](_0x324058[_0xba62('0x20')],function(_0x4e8f09){return{'model':db[_0x4e8f09['model']],'as':_0x4e8f09['as'],'attributes':_0x4e8f09[_0xba62('0x22')],'include':_0x4e8f09[_0xba62('0x20')]?_['map'](_0x4e8f09[_0xba62('0x20')],function(_0x55a1b6){return{'model':db[_0x55a1b6['model']],'as':_0x55a1b6['as'],'attributes':_0x55a1b6[_0xba62('0x22')]};}):[]};}):[]};}):[]:[]})[_0xba62('0x23')](function(_0x53a72d){logger[_0xba62('0xf')](_0xba62('0x1a'),_0x5c6ffc);logger[_0xba62('0x11')]('GetWhatsappQueue',_0x5c6ffc,JSON[_0xba62('0x13')](_0x53a72d));_0x2e2fc3(_0x53a72d);})[_0xba62('0x19')](function(_0x5e4717){logger[_0xba62('0x14')]('GetWhatsappQueue',_0x5e4717['message'],_0x5c6ffc);_0x2b96da(_0x17d4e0[_0xba62('0x14')](0x1f4,_0x5e4717['message']));});});};exports[_0xba62('0x24')]=function(_0x589606){var _0x49b153=this;return new Promise(function(_0x46dd08,_0x128db2){return db[_0xba62('0x1b')][_0xba62('0x25')]({'raw':_0x589606['options']?_0x589606['options']['raw']===undefined?!![]:![]:!![],'where':_0x589606[_0xba62('0x1d')]?_0x589606[_0xba62('0x1d')]['where']||null:null,'attributes':_0x589606[_0xba62('0x1d')]?_0x589606[_0xba62('0x1d')][_0xba62('0x22')]||null:null,'include':_0x589606['options']?_0x589606['options'][_0xba62('0x20')]?_['map'](_0x589606['options']['include'],function(_0x1c5d9e){return{'model':db[_0x1c5d9e[_0xba62('0x26')]],'as':_0x1c5d9e['as'],'attributes':_0x1c5d9e[_0xba62('0x22')],'include':_0x1c5d9e[_0xba62('0x20')]?_[_0xba62('0x21')](_0x1c5d9e[_0xba62('0x20')],function(_0x4a93e9){return{'model':db[_0x4a93e9[_0xba62('0x26')]],'as':_0x4a93e9['as'],'attributes':_0x4a93e9[_0xba62('0x22')],'include':_0x4a93e9[_0xba62('0x20')]?_[_0xba62('0x21')](_0x4a93e9['include'],function(_0x2bd776){return{'model':db[_0x2bd776['model']],'as':_0x2bd776['as'],'attributes':_0x2bd776[_0xba62('0x22')]};}):[]};}):[]};}):[]:[]})[_0xba62('0x23')](function(_0x5c49a8){logger[_0xba62('0xf')](_0xba62('0x24'),_0x589606);logger[_0xba62('0x11')](_0xba62('0x24'),_0x589606,JSON['stringify'](_0x5c49a8));_0x46dd08(_0x5c49a8);})[_0xba62('0x19')](function(_0x1a50f2){logger['error'](_0xba62('0x24'),_0x1a50f2[_0xba62('0x17')],_0x589606);_0x128db2(_0x49b153['error'](0x1f4,_0x1a50f2['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 482fef8..21a7559 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 _0xa060=['./whatsappQueue.events','update','emit','removeListener','length','whatsappQueue:'];(function(_0x1fefb2,_0x5d2a04){var _0xbe88e4=function(_0x37a192){while(--_0x37a192){_0x1fefb2['push'](_0x1fefb2['shift']());}};_0xbe88e4(++_0x5d2a04);}(_0xa060,0x150));var _0x0a06=function(_0x4b9435,_0x46709c){_0x4b9435=_0x4b9435-0x0;var _0x3fa2d1=_0xa060[_0x4b9435];return _0x3fa2d1;};'use strict';var WhatsappQueueEvents=require(_0x0a06('0x0'));var events=['save','remove',_0x0a06('0x1')];function createListener(_0x327255,_0x14095a){return function(_0x4a8cd2){_0x14095a[_0x0a06('0x2')](_0x327255,_0x4a8cd2);};}function removeListener(_0x26354e,_0x30a615){return function(){WhatsappQueueEvents[_0x0a06('0x3')](_0x26354e,_0x30a615);};}exports['register']=function(_0xb90a04){for(var _0x102fce=0x0,_0x3deba9=events[_0x0a06('0x4')];_0x102fce<_0x3deba9;_0x102fce++){var _0x473d4e=events[_0x102fce];var _0x1a3cf3=createListener(_0x0a06('0x5')+_0x473d4e,_0xb90a04);WhatsappQueueEvents['on'](_0x473d4e,_0x1a3cf3);}}; \ No newline at end of file +var _0xd3b3=['removeListener','register','length','whatsappQueue:','./whatsappQueue.events','remove','update','emit'];(function(_0x550812,_0x3ad80e){var _0x20ef24=function(_0x438142){while(--_0x438142){_0x550812['push'](_0x550812['shift']());}};_0x20ef24(++_0x3ad80e);}(_0xd3b3,0x1e4));var _0x3d3b=function(_0x58cf07,_0x2e3858){_0x58cf07=_0x58cf07-0x0;var _0x42afe0=_0xd3b3[_0x58cf07];return _0x42afe0;};'use strict';var WhatsappQueueEvents=require(_0x3d3b('0x0'));var events=['save',_0x3d3b('0x1'),_0x3d3b('0x2')];function createListener(_0x138072,_0x19a8e4){return function(_0x4edc8c){_0x19a8e4[_0x3d3b('0x3')](_0x138072,_0x4edc8c);};}function removeListener(_0x3bd7cd,_0x3273a3){return function(){WhatsappQueueEvents[_0x3d3b('0x4')](_0x3bd7cd,_0x3273a3);};}exports[_0x3d3b('0x5')]=function(_0x3d0234){for(var _0x2533c9=0x0,_0x416118=events[_0x3d3b('0x6')];_0x2533c9<_0x416118;_0x2533c9++){var _0x459de9=events[_0x2533c9];var _0x584002=createListener(_0x3d3b('0x7')+_0x459de9,_0x3d0234);WhatsappQueueEvents['on'](_0x459de9,_0x584002);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index b394cf1..e8b3667 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 _0x15d3=['isAuthenticated','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','index','get','/describe','describe','/:id'];(function(_0x5120fa,_0x162040){var _0x2c3432=function(_0x271ce2){while(--_0x271ce2){_0x5120fa['push'](_0x5120fa['shift']());}};_0x2c3432(++_0x162040);}(_0x15d3,0x1e2));var _0x315d=function(_0x1aa1c2,_0x2f92a2){_0x1aa1c2=_0x1aa1c2-0x0;var _0x103c66=_0x15d3[_0x1aa1c2];return _0x103c66;};'use strict';var multer=require(_0x315d('0x0'));var util=require(_0x315d('0x1'));var path=require(_0x315d('0x2'));var timeout=require(_0x315d('0x3'));var express=require(_0x315d('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x315d('0x5'));var interaction=require(_0x315d('0x6'));var config=require('../../config/environment');var controller=require('./whatsappQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x315d('0x7')]);router[_0x315d('0x8')](_0x315d('0x9'),auth['isAuthenticated'](),controller[_0x315d('0xa')]);router['get'](_0x315d('0xb'),auth[_0x315d('0xc')](),controller[_0x315d('0xd')]);router[_0x315d('0xe')]('/',auth[_0x315d('0xc')](),controller['create']);router[_0x315d('0xf')](_0x315d('0xb'),auth[_0x315d('0xc')](),controller[_0x315d('0x10')]);router['delete'](_0x315d('0xb'),auth[_0x315d('0xc')](),controller[_0x315d('0x11')]);module[_0x315d('0x12')]=router; \ No newline at end of file +var _0x087b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','express','fs-extra'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x087b,0x11a));var _0xb087=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x087b[_0x2112d4];return _0x434972;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var fs_extra=require(_0xb087('0x3'));var auth=require(_0xb087('0x4'));var interaction=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var controller=require(_0xb087('0x7'));router[_0xb087('0x8')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0x8')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0xc')]);router[_0xb087('0x8')](_0xb087('0xd'),auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0xf')]('/',auth['isAuthenticated'](),controller[_0xb087('0x10')]);router[_0xb087('0x11')](_0xb087('0xd'),auth[_0xb087('0x9')](),controller[_0xb087('0x12')]);router[_0xb087('0x13')](_0xb087('0xd'),auth['isAuthenticated'](),controller[_0xb087('0x14')]);module[_0xb087('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index dc2623e..d79c9a7 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(_0x5df801,_0x27ba60){var _0x3bd5dd=function(_0x498483){while(--_0x498483){_0x5df801['push'](_0x5df801['shift']());}};_0x3bd5dd(++_0x27ba60);}(_0x7a54,0x106));var _0x47a5=function(_0x329136,_0x520409){_0x329136=_0x329136-0x0;var _0x520db6=_0x7a54[_0x329136];return _0x520db6;};'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(_0x571179,_0x1f1c23){var _0xef056a=function(_0x3c236b){while(--_0x3c236b){_0x571179['push'](_0x571179['shift']());}};_0xef056a(++_0x1f1c23);}(_0x7a54,0x106));var _0x47a5=function(_0xa12116,_0x202166){_0xa12116=_0xa12116-0x0;var _0x3eb9b6=_0x7a54[_0xa12116];return _0x3eb9b6;};'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 649f63b..9c278c2 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 _0x373d=['order','sort','pick','filter','where','VIRTUAL','merge','include','findAll','rows','show','rawAttributes','includeAll','options','catch','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','WhatsappQueueReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x13aba5,_0x3ebd46){var _0x144145=function(_0x1cb9f2){while(--_0x1cb9f2){_0x13aba5['push'](_0x13aba5['shift']());}};_0x144145(++_0x3ebd46);}(_0x373d,0x1e2));var _0xd373=function(_0x42a5e4,_0x2ccfb6){_0x42a5e4=_0x42a5e4-0x0;var _0xd56657=_0x373d[_0x42a5e4];return _0xd56657;};'use strict';var emlformat=require(_0xd373('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd373('0x1'));var jsonpatch=require(_0xd373('0x2'));var rp=require(_0xd373('0x3'));var moment=require(_0xd373('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd373('0x5'));var util=require(_0xd373('0x6'));var path=require(_0xd373('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd373('0x8'));var fs=require('fs');var fs_extra=require(_0xd373('0x9'));var _=require(_0xd373('0xa'));var squel=require(_0xd373('0xb'));var crypto=require('crypto');var jsforce=require(_0xd373('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd373('0xd'));var Redis=require(_0xd373('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd373('0xf'));var as=require(_0xd373('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd373('0x11'));var utils=require(_0xd373('0x12'));var config=require(_0xd373('0x13'));var licenseUtil=require(_0xd373('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c7f91,_0x5ab89c){_0x5ab89c=_0x5ab89c||0xcc;return function(_0xcd9b8c){if(_0xcd9b8c){return _0x4c7f91[_0xd373('0x15')](_0x5ab89c);}return _0x4c7f91['status'](_0x5ab89c)[_0xd373('0x16')]();};}function respondWithResult(_0x129475,_0x27c161){_0x27c161=_0x27c161||0xc8;return function(_0x23ed86){if(_0x23ed86){return _0x129475[_0xd373('0x17')](_0x27c161)[_0xd373('0x18')](_0x23ed86);}};}function respondWithFilteredResult(_0x20aca5,_0x2eacb1){return function(_0x5a286a){if(_0x5a286a){var _0x2c5854=typeof _0x2eacb1[_0xd373('0x19')]===_0xd373('0x1a')&&typeof _0x2eacb1[_0xd373('0x1b')]==='undefined';var _0x1e26cf=_0x5a286a['count'];var _0x460259=_0x2c5854?0x0:_0x2eacb1[_0xd373('0x19')];var _0x55c5c7=_0x2c5854?_0x5a286a[_0xd373('0x1c')]:_0x2eacb1['offset']+_0x2eacb1['limit'];var _0x23fada;if(_0x55c5c7>=_0x1e26cf){_0x55c5c7=_0x1e26cf;_0x23fada=0xc8;}else{_0x23fada=0xce;}_0x20aca5[_0xd373('0x17')](_0x23fada);return _0x20aca5[_0xd373('0x1d')](_0xd373('0x1e'),_0x460259+'-'+_0x55c5c7+'/'+_0x1e26cf)[_0xd373('0x18')](_0x5a286a);}return null;};}function patchUpdates(_0x181eb2){return function(_0x4ba510){try{jsonpatch[_0xd373('0x1f')](_0x4ba510,_0x181eb2,!![]);}catch(_0xd808f8){return BPromise[_0xd373('0x20')](_0xd808f8);}return _0x4ba510[_0xd373('0x21')]();};}function saveUpdates(_0x165e21,_0x3aa1c5){return function(_0x4f64bd){if(_0x4f64bd){return _0x4f64bd[_0xd373('0x22')](_0x165e21)[_0xd373('0x23')](function(_0x157f81){return _0x157f81;});}return null;};}function removeEntity(_0x209ca7,_0x217ee7){return function(_0x238ffd){if(_0x238ffd){return _0x238ffd[_0xd373('0x24')]()[_0xd373('0x23')](function(){_0x209ca7[_0xd373('0x17')](0xcc)[_0xd373('0x16')]();});}};}function handleEntityNotFound(_0x437110,_0x34f05a){return function(_0x388182){if(!_0x388182){_0x437110[_0xd373('0x15')](0x194);}return _0x388182;};}function handleError(_0x18d7ab,_0x38ba50){_0x38ba50=_0x38ba50||0x1f4;return function(_0x50b987){logger[_0xd373('0x25')](_0x50b987[_0xd373('0x26')]);if(_0x50b987[_0xd373('0x27')]){delete _0x50b987[_0xd373('0x27')];}_0x18d7ab[_0xd373('0x17')](_0x38ba50)[_0xd373('0x28')](_0x50b987);};}exports[_0xd373('0x29')]=function(_0xf85ca8,_0x2869e5){var _0x158825={},_0xbc420b={},_0x2ee37c={'count':0x0,'rows':[]};var _0x7dad3e=_['map'](db[_0xd373('0x2a')]['rawAttributes'],function(_0x498aaa){return{'name':_0x498aaa[_0xd373('0x2b')],'type':_0x498aaa[_0xd373('0x2c')][_0xd373('0x2d')]};});_0xbc420b[_0xd373('0x2e')]=_[_0xd373('0x2f')](_0x7dad3e,'name');_0xbc420b[_0xd373('0x30')]=_[_0xd373('0x31')](_0xf85ca8['query']);_0xbc420b[_0xd373('0x32')]=_[_0xd373('0x33')](_0xbc420b[_0xd373('0x2e')],_0xbc420b[_0xd373('0x30')]);_0x158825[_0xd373('0x34')]=_[_0xd373('0x33')](_0xbc420b[_0xd373('0x2e')],qs[_0xd373('0x35')](_0xf85ca8[_0xd373('0x30')]['fields']));_0x158825[_0xd373('0x34')]=_0x158825[_0xd373('0x34')][_0xd373('0x36')]?_0x158825[_0xd373('0x34')]:_0xbc420b[_0xd373('0x2e')];if(!_0xf85ca8[_0xd373('0x30')][_0xd373('0x37')](_0xd373('0x38'))){_0x158825[_0xd373('0x1b')]=qs[_0xd373('0x1b')](_0xf85ca8[_0xd373('0x30')][_0xd373('0x1b')]);_0x158825[_0xd373('0x19')]=qs[_0xd373('0x19')](_0xf85ca8[_0xd373('0x30')]['offset']);}_0x158825[_0xd373('0x39')]=qs[_0xd373('0x3a')](_0xf85ca8[_0xd373('0x30')][_0xd373('0x3a')]);_0x158825['where']=qs[_0xd373('0x32')](_[_0xd373('0x3b')](_0xf85ca8[_0xd373('0x30')],_0xbc420b[_0xd373('0x32')]),_0x7dad3e);if(_0xf85ca8[_0xd373('0x30')][_0xd373('0x3c')]){_0x158825['where']=_['merge'](_0x158825[_0xd373('0x3d')],{'$or':_['map'](_0x7dad3e,function(_0x37c97e){if(_0x37c97e[_0xd373('0x2c')]!==_0xd373('0x3e')){var _0x51ba69={};_0x51ba69[_0x37c97e[_0xd373('0x27')]]={'$like':'%'+_0xf85ca8[_0xd373('0x30')][_0xd373('0x3c')]+'%'};return _0x51ba69;}})});}_0x158825=_[_0xd373('0x3f')]({},_0x158825,_0xf85ca8['options']);var _0x513038={'where':_0x158825['where']};return db[_0xd373('0x2a')]['count'](_0x513038)[_0xd373('0x23')](function(_0x2fa6c4){_0x2ee37c['count']=_0x2fa6c4;if(_0xf85ca8['query']['includeAll']){_0x158825[_0xd373('0x40')]=[{'all':!![]}];}return db[_0xd373('0x2a')][_0xd373('0x41')](_0x158825);})['then'](function(_0x5c3b22){_0x2ee37c[_0xd373('0x42')]=_0x5c3b22;return _0x2ee37c;})[_0xd373('0x23')](respondWithFilteredResult(_0x2869e5,_0x158825))['catch'](handleError(_0x2869e5,null));};exports[_0xd373('0x43')]=function(_0x2ee75f,_0x1e3de1){var _0x9989e4={'raw':!![],'where':{'id':_0x2ee75f['params']['id']}},_0x2d8c7d={};_0x2d8c7d['model']=_[_0xd373('0x31')](db[_0xd373('0x2a')][_0xd373('0x44')]);_0x2d8c7d[_0xd373('0x30')]=_['keys'](_0x2ee75f[_0xd373('0x30')]);_0x2d8c7d['filters']=_[_0xd373('0x33')](_0x2d8c7d[_0xd373('0x2e')],_0x2d8c7d[_0xd373('0x30')]);_0x9989e4[_0xd373('0x34')]=_[_0xd373('0x33')](_0x2d8c7d['model'],qs[_0xd373('0x35')](_0x2ee75f[_0xd373('0x30')]['fields']));_0x9989e4[_0xd373('0x34')]=_0x9989e4[_0xd373('0x34')][_0xd373('0x36')]?_0x9989e4[_0xd373('0x34')]:_0x2d8c7d[_0xd373('0x2e')];if(_0x2ee75f[_0xd373('0x30')][_0xd373('0x45')]){_0x9989e4[_0xd373('0x40')]=[{'all':!![]}];}_0x9989e4=_[_0xd373('0x3f')]({},_0x9989e4,_0x2ee75f[_0xd373('0x46')]);return db['WhatsappQueueReport']['find'](_0x9989e4)[_0xd373('0x23')](handleEntityNotFound(_0x1e3de1,null))['then'](respondWithResult(_0x1e3de1,null))[_0xd373('0x47')](handleError(_0x1e3de1,null));};exports['create']=function(_0x5e5279,_0x5cbc16){return db[_0xd373('0x2a')][_0xd373('0x48')](_0x5e5279[_0xd373('0x49')],{})[_0xd373('0x23')](respondWithResult(_0x5cbc16,0xc9))[_0xd373('0x47')](handleError(_0x5cbc16,null));};exports[_0xd373('0x22')]=function(_0x1855aa,_0x4d1088){if(_0x1855aa[_0xd373('0x49')]['id']){delete _0x1855aa['body']['id'];}return db[_0xd373('0x2a')][_0xd373('0x4a')]({'where':{'id':_0x1855aa['params']['id']}})[_0xd373('0x23')](handleEntityNotFound(_0x4d1088,null))['then'](saveUpdates(_0x1855aa[_0xd373('0x49')],null))[_0xd373('0x23')](respondWithResult(_0x4d1088,null))[_0xd373('0x47')](handleError(_0x4d1088,null));};exports[_0xd373('0x24')]=function(_0xe22cbd,_0x4bc631){return db['WhatsappQueueReport']['find']({'where':{'id':_0xe22cbd[_0xd373('0x4b')]['id']}})[_0xd373('0x23')](handleEntityNotFound(_0x4bc631,null))['then'](removeEntity(_0x4bc631,null))[_0xd373('0x47')](handleError(_0x4bc631,null));};exports[_0xd373('0x4c')]=function(_0x4d7020,_0xae7067){return db[_0xd373('0x2a')][_0xd373('0x4c')]()[_0xd373('0x23')](respondWithResult(_0xae7067,null))[_0xd373('0x47')](handleError(_0xae7067,null));}; \ No newline at end of file +var _0x0713=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','params','keys','find','catch','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox'];(function(_0x529ec4,_0xc3fccb){var _0x4be7e3=function(_0x1d08b6){while(--_0x1d08b6){_0x529ec4['push'](_0x529ec4['shift']());}};_0x4be7e3(++_0xc3fccb);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={},_0x292205={},_0x254fc8={'count':0x0,'rows':[]};var _0x5aba96=_['map'](db[_0x3071('0x2d')][_0x3071('0x2e')],function(_0x6ddf96){return{'name':_0x6ddf96[_0x3071('0x2f')],'type':_0x6ddf96[_0x3071('0x30')][_0x3071('0x31')]};});_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x5aba96,'name');_0x292205['query']=_['keys'](_0x177b5f[_0x3071('0x34')]);_0x292205[_0x3071('0x35')]=_['intersection'](_0x292205[_0x3071('0x32')],_0x292205[_0x3071('0x34')]);_0x32f1b4[_0x3071('0x36')]=_[_0x3071('0x37')](_0x292205['model'],qs[_0x3071('0x38')](_0x177b5f[_0x3071('0x34')][_0x3071('0x38')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x39')]?_0x32f1b4[_0x3071('0x36')]:_0x292205[_0x3071('0x32')];if(!_0x177b5f['query'][_0x3071('0x3a')]('nolimit')){_0x32f1b4['limit']=qs[_0x3071('0x20')](_0x177b5f[_0x3071('0x34')]['limit']);_0x32f1b4[_0x3071('0x1e')]=qs[_0x3071('0x1e')](_0x177b5f[_0x3071('0x34')][_0x3071('0x1e')]);}_0x32f1b4[_0x3071('0x3b')]=qs[_0x3071('0x3c')](_0x177b5f['query'][_0x3071('0x3c')]);_0x32f1b4[_0x3071('0x3d')]=qs['filters'](_[_0x3071('0x3e')](_0x177b5f['query'],_0x292205[_0x3071('0x35')]),_0x5aba96);if(_0x177b5f[_0x3071('0x34')]['filter']){_0x32f1b4['where']=_[_0x3071('0x3f')](_0x32f1b4[_0x3071('0x3d')],{'$or':_[_0x3071('0x33')](_0x5aba96,function(_0x55afa6){if(_0x55afa6[_0x3071('0x30')]!=='VIRTUAL'){var _0x1ac90a={};_0x1ac90a[_0x55afa6['name']]={'$like':'%'+_0x177b5f[_0x3071('0x34')][_0x3071('0x40')]+'%'};return _0x1ac90a;}})});}_0x32f1b4=_[_0x3071('0x3f')]({},_0x32f1b4,_0x177b5f[_0x3071('0x41')]);var _0x30ab68={'where':_0x32f1b4['where']};return db['WhatsappQueueReport'][_0x3071('0x21')](_0x30ab68)[_0x3071('0x27')](function(_0x1455be){_0x254fc8[_0x3071('0x21')]=_0x1455be;if(_0x177b5f['query'][_0x3071('0x42')]){_0x32f1b4[_0x3071('0x43')]=[{'all':!![]}];}return db[_0x3071('0x2d')][_0x3071('0x44')](_0x32f1b4);})[_0x3071('0x27')](function(_0xb9a4b8){_0x254fc8['rows']=_0xb9a4b8;return _0x254fc8;})[_0x3071('0x27')](respondWithFilteredResult(_0x3921a1,_0x32f1b4))['catch'](handleError(_0x3921a1,null));};exports['show']=function(_0x4dc9d1,_0x47ceaf){var _0x2992e6={'raw':!![],'where':{'id':_0x4dc9d1[_0x3071('0x45')]['id']}},_0x1be8b6={};_0x1be8b6[_0x3071('0x32')]=_[_0x3071('0x46')](db[_0x3071('0x2d')][_0x3071('0x2e')]);_0x1be8b6[_0x3071('0x34')]=_['keys'](_0x4dc9d1[_0x3071('0x34')]);_0x1be8b6[_0x3071('0x35')]=_[_0x3071('0x37')](_0x1be8b6[_0x3071('0x32')],_0x1be8b6[_0x3071('0x34')]);_0x2992e6['attributes']=_['intersection'](_0x1be8b6[_0x3071('0x32')],qs[_0x3071('0x38')](_0x4dc9d1[_0x3071('0x34')][_0x3071('0x38')]));_0x2992e6[_0x3071('0x36')]=_0x2992e6['attributes'][_0x3071('0x39')]?_0x2992e6['attributes']:_0x1be8b6[_0x3071('0x32')];if(_0x4dc9d1['query']['includeAll']){_0x2992e6[_0x3071('0x43')]=[{'all':!![]}];}_0x2992e6=_['merge']({},_0x2992e6,_0x4dc9d1[_0x3071('0x41')]);return db['WhatsappQueueReport'][_0x3071('0x47')](_0x2992e6)[_0x3071('0x27')](handleEntityNotFound(_0x47ceaf,null))[_0x3071('0x27')](respondWithResult(_0x47ceaf,null))[_0x3071('0x48')](handleError(_0x47ceaf,null));};exports['create']=function(_0x2d70bf,_0x575c12){return db[_0x3071('0x2d')]['create'](_0x2d70bf[_0x3071('0x49')],{})[_0x3071('0x27')](respondWithResult(_0x575c12,0xc9))['catch'](handleError(_0x575c12,null));};exports[_0x3071('0x26')]=function(_0x117e73,_0x224a70){if(_0x117e73[_0x3071('0x49')]['id']){delete _0x117e73[_0x3071('0x49')]['id'];}return db[_0x3071('0x2d')][_0x3071('0x47')]({'where':{'id':_0x117e73['params']['id']}})[_0x3071('0x27')](handleEntityNotFound(_0x224a70,null))[_0x3071('0x27')](saveUpdates(_0x117e73[_0x3071('0x49')],null))[_0x3071('0x27')](respondWithResult(_0x224a70,null))['catch'](handleError(_0x224a70,null));};exports[_0x3071('0x28')]=function(_0x2aea37,_0x1b832e){return db[_0x3071('0x2d')][_0x3071('0x47')]({'where':{'id':_0x2aea37[_0x3071('0x45')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0x1b832e,null))[_0x3071('0x27')](removeEntity(_0x1b832e,null))[_0x3071('0x48')](handleError(_0x1b832e,null));};exports[_0x3071('0x4a')]=function(_0x4371e7,_0x111115){return db[_0x3071('0x2d')][_0x3071('0x4a')]()[_0x3071('0x27')](respondWithResult(_0x111115,null))[_0x3071('0x48')](handleError(_0x111115,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index af20deb..49ffdeb 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 _0x6e18=['./whatsappQueueReport.attributes','exports','define','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1d2bbb,_0x202267){var _0x38082b=function(_0x27d153){while(--_0x27d153){_0x1d2bbb['push'](_0x1d2bbb['shift']());}};_0x38082b(++_0x202267);}(_0x6e18,0x19c));var _0x86e1=function(_0x5dde37,_0x23d0d5){_0x5dde37=_0x5dde37-0x0;var _0x374e2b=_0x6e18[_0x5dde37];return _0x374e2b;};'use strict';var _=require(_0x86e1('0x0'));var util=require('util');var logger=require(_0x86e1('0x1'))(_0x86e1('0x2'));var moment=require(_0x86e1('0x3'));var BPromise=require(_0x86e1('0x4'));var rp=require(_0x86e1('0x5'));var fs=require('fs');var path=require(_0x86e1('0x6'));var rimraf=require('rimraf');var config=require(_0x86e1('0x7'));var attributes=require(_0x86e1('0x8'));module[_0x86e1('0x9')]=function(_0x841121,_0x4bea06){return _0x841121[_0x86e1('0xa')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x86e1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x03f0=['./whatsappQueueReport.attributes','exports','define','uniqueid','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1ebe2f,_0x523227){var _0xdeb06f=function(_0x2a6051){while(--_0x2a6051){_0x1ebe2f['push'](_0x1ebe2f['shift']());}};_0xdeb06f(++_0x523227);}(_0x03f0,0x10c));var _0x003f=function(_0x49e78a,_0x21bc8a){_0x49e78a=_0x49e78a-0x0;var _0x1fdf59=_0x03f0[_0x49e78a];return _0x1fdf59;};'use strict';var _=require(_0x003f('0x0'));var util=require(_0x003f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x003f('0x2'));var BPromise=require(_0x003f('0x3'));var rp=require(_0x003f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x003f('0x5'));var config=require(_0x003f('0x6'));var attributes=require(_0x003f('0x7'));module[_0x003f('0x8')]=function(_0x59a1e7,_0x4f32c7){return _0x59a1e7[_0x003f('0x9')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x003f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 3774bd0..133581c 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 _0xece4=['../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','UpdateWhatsappQueueReport','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xece4,0x128));var _0x4ece=function(_0x52aabd,_0x22583c){_0x52aabd=_0x52aabd-0x0;var _0x2b6190=_0xece4[_0x52aabd];return _0x2b6190;};'use strict';var _=require(_0x4ece('0x0'));var util=require(_0x4ece('0x1'));var moment=require(_0x4ece('0x2'));var BPromise=require(_0x4ece('0x3'));var rs=require(_0x4ece('0x4'));var fs=require('fs');var Redis=require(_0x4ece('0x5'));var db=require(_0x4ece('0x6'))['db'];var utils=require(_0x4ece('0x7'));var logger=require(_0x4ece('0x8'))(_0x4ece('0x9'));var config=require(_0x4ece('0xa'));var jayson=require(_0x4ece('0xb'));var client=jayson[_0x4ece('0xc')][_0x4ece('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x112e15,_0x28a6b1,_0x51b23c){return new BPromise(function(_0x435603,_0x3a8e44){return client[_0x4ece('0xe')](_0x112e15,_0x51b23c)[_0x4ece('0xf')](function(_0x5da302){logger[_0x4ece('0x10')](_0x4ece('0x11'),_0x28a6b1,_0x4ece('0x12'));logger[_0x4ece('0x13')](_0x4ece('0x14'),_0x28a6b1,_0x4ece('0x12'),JSON[_0x4ece('0x15')](_0x5da302));if(_0x5da302[_0x4ece('0x16')]){if(_0x5da302[_0x4ece('0x16')]['code']===0x1f4){logger[_0x4ece('0x16')](_0x4ece('0x11'),_0x28a6b1,_0x5da302['error'][_0x4ece('0x17')]);return _0x3a8e44(_0x5da302['error'][_0x4ece('0x17')]);}logger[_0x4ece('0x16')]('WhatsappQueueReport,\x20%s,\x20%s',_0x28a6b1,_0x5da302[_0x4ece('0x16')][_0x4ece('0x17')]);return _0x435603(_0x5da302[_0x4ece('0x16')][_0x4ece('0x17')]);}else{logger[_0x4ece('0x10')](_0x4ece('0x11'),_0x28a6b1,_0x4ece('0x12'));_0x435603(_0x5da302[_0x4ece('0x18')][_0x4ece('0x17')]);}})[_0x4ece('0x19')](function(_0x89fe5f){logger[_0x4ece('0x16')]('WhatsappQueueReport,\x20%s,\x20%s',_0x28a6b1,_0x89fe5f);_0x3a8e44(_0x89fe5f);});});}exports[_0x4ece('0x1a')]=function(_0x401682){var _0x3c2722=this;return new Promise(function(_0x53851c,_0x2b427a){return db[_0x4ece('0x1b')][_0x4ece('0x1c')](_0x401682['body'],{'raw':_0x401682['options']?_0x401682[_0x4ece('0x1d')][_0x4ece('0x1e')]===undefined?!![]:![]:!![]})[_0x4ece('0xf')](function(_0xcc8e96){logger[_0x4ece('0x10')]('CreateWhatsappQueueReport',_0x401682);logger[_0x4ece('0x13')](_0x4ece('0x1a'),_0x401682,JSON[_0x4ece('0x15')](_0xcc8e96));_0x53851c(_0xcc8e96);})[_0x4ece('0x19')](function(_0x490262){logger[_0x4ece('0x16')](_0x4ece('0x1a'),_0x490262[_0x4ece('0x17')],_0x401682);_0x2b427a(_0x3c2722['error'](0x1f4,_0x490262['message']));});});};exports[_0x4ece('0x1f')]=function(_0x59b786){var _0x3cb2ee=this;return new Promise(function(_0x2baf0f,_0x105bd2){return db[_0x4ece('0x1b')]['update'](_0x59b786['body'],{'raw':_0x59b786[_0x4ece('0x1d')]?_0x59b786[_0x4ece('0x1d')][_0x4ece('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59b786[_0x4ece('0x1d')]?_0x59b786[_0x4ece('0x1d')][_0x4ece('0x20')]||null:null,'attributes':_0x59b786[_0x4ece('0x1d')]?_0x59b786[_0x4ece('0x1d')]['attributes']||null:null,'limit':_0x59b786[_0x4ece('0x1d')]?_0x59b786[_0x4ece('0x1d')][_0x4ece('0x21')]||null:null})['then'](function(_0x358387){logger['info'](_0x4ece('0x1f'),_0x59b786);logger[_0x4ece('0x13')](_0x4ece('0x1f'),_0x59b786,JSON[_0x4ece('0x15')](_0x358387));_0x2baf0f(_0x358387);})['catch'](function(_0x159901){logger[_0x4ece('0x16')](_0x4ece('0x1f'),_0x159901[_0x4ece('0x17')],_0x59b786);_0x105bd2(_0x3cb2ee[_0x4ece('0x16')](0x1f4,_0x159901[_0x4ece('0x17')]));});});}; \ No newline at end of file +var _0x54d9=['WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','update','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport'];(function(_0x3da612,_0x332456){var _0x1a9d1d=function(_0x5ca0d0){while(--_0x5ca0d0){_0x3da612['push'](_0x3da612['shift']());}};_0x1a9d1d(++_0x332456);}(_0x54d9,0xa8));var _0x954d=function(_0x1ae246,_0x2e98f0){_0x1ae246=_0x1ae246-0x0;var _0x55abc0=_0x54d9[_0x1ae246];return _0x55abc0;};'use strict';var _=require(_0x954d('0x0'));var util=require('util');var moment=require(_0x954d('0x1'));var BPromise=require(_0x954d('0x2'));var rs=require(_0x954d('0x3'));var fs=require('fs');var Redis=require(_0x954d('0x4'));var db=require(_0x954d('0x5'))['db'];var utils=require(_0x954d('0x6'));var logger=require('../../config/logger')(_0x954d('0x7'));var config=require(_0x954d('0x8'));var jayson=require(_0x954d('0x9'));var client=jayson[_0x954d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a206b,_0x42946e,_0x5d9d08){return new BPromise(function(_0x2ef570,_0x42d68c){return client['request'](_0x4a206b,_0x5d9d08)[_0x954d('0xb')](function(_0x2ec203){logger[_0x954d('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x42946e,_0x954d('0xd'));logger[_0x954d('0xe')](_0x954d('0xf'),_0x42946e,'request\x20sent',JSON[_0x954d('0x10')](_0x2ec203));if(_0x2ec203['error']){if(_0x2ec203[_0x954d('0x11')][_0x954d('0x12')]===0x1f4){logger['error'](_0x954d('0x13'),_0x42946e,_0x2ec203['error'][_0x954d('0x14')]);return _0x42d68c(_0x2ec203['error'][_0x954d('0x14')]);}logger[_0x954d('0x11')](_0x954d('0x13'),_0x42946e,_0x2ec203['error']['message']);return _0x2ef570(_0x2ec203['error']['message']);}else{logger['info'](_0x954d('0x13'),_0x42946e,_0x954d('0xd'));_0x2ef570(_0x2ec203[_0x954d('0x15')][_0x954d('0x14')]);}})[_0x954d('0x16')](function(_0x2ddb28){logger[_0x954d('0x11')](_0x954d('0x13'),_0x42946e,_0x2ddb28);_0x42d68c(_0x2ddb28);});});}exports[_0x954d('0x17')]=function(_0x42f457){var _0x2bcbb0=this;return new Promise(function(_0x4abf69,_0x4f8703){return db[_0x954d('0x18')][_0x954d('0x19')](_0x42f457[_0x954d('0x1a')],{'raw':_0x42f457['options']?_0x42f457[_0x954d('0x1b')][_0x954d('0x1c')]===undefined?!![]:![]:!![]})[_0x954d('0xb')](function(_0x41c776){logger[_0x954d('0xc')](_0x954d('0x17'),_0x42f457);logger[_0x954d('0xe')](_0x954d('0x17'),_0x42f457,JSON[_0x954d('0x10')](_0x41c776));_0x4abf69(_0x41c776);})[_0x954d('0x16')](function(_0x10116a){logger[_0x954d('0x11')](_0x954d('0x17'),_0x10116a[_0x954d('0x14')],_0x42f457);_0x4f8703(_0x2bcbb0[_0x954d('0x11')](0x1f4,_0x10116a[_0x954d('0x14')]));});});};exports[_0x954d('0x1d')]=function(_0xdb356b){var _0x118b7f=this;return new Promise(function(_0x3d0ec0,_0x45c8eb){return db['WhatsappQueueReport'][_0x954d('0x1e')](_0xdb356b[_0x954d('0x1a')],{'raw':_0xdb356b[_0x954d('0x1b')]?_0xdb356b[_0x954d('0x1b')][_0x954d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xdb356b[_0x954d('0x1b')]?_0xdb356b[_0x954d('0x1b')]['where']||null:null,'attributes':_0xdb356b[_0x954d('0x1b')]?_0xdb356b[_0x954d('0x1b')]['attributes']||null:null,'limit':_0xdb356b[_0x954d('0x1b')]?_0xdb356b[_0x954d('0x1b')][_0x954d('0x1f')]||null:null})[_0x954d('0xb')](function(_0x18673a){logger[_0x954d('0xc')]('UpdateWhatsappQueueReport',_0xdb356b);logger[_0x954d('0xe')]('UpdateWhatsappQueueReport',_0xdb356b,JSON['stringify'](_0x18673a));_0x3d0ec0(_0x18673a);})[_0x954d('0x16')](function(_0x25fd24){logger[_0x954d('0x11')](_0x954d('0x1d'),_0x25fd24[_0x954d('0x14')],_0xdb356b);_0x45c8eb(_0x118b7f[_0x954d('0x11')](0x1f4,_0x25fd24[_0x954d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index baaaa0d..8a52176 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 _0xf7ca=['/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','show','create','put'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0xf7ca,0xe1));var _0xaf7c=function(_0x42a0b9,_0x174096){_0x42a0b9=_0x42a0b9-0x0;var _0x503755=_0xf7ca[_0x42a0b9];return _0x503755;};'use strict';var multer=require(_0xaf7c('0x0'));var util=require('util');var path=require(_0xaf7c('0x1'));var timeout=require(_0xaf7c('0x2'));var express=require(_0xaf7c('0x3'));var router=express[_0xaf7c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xaf7c('0x5'));var interaction=require(_0xaf7c('0x6'));var config=require('../../config/environment');var controller=require(_0xaf7c('0x7'));router[_0xaf7c('0x8')]('/',auth['isAuthenticated'](),controller[_0xaf7c('0x9')]);router['get'](_0xaf7c('0xa'),auth[_0xaf7c('0xb')](),controller['describe']);router['get']('/:id',auth[_0xaf7c('0xb')](),controller[_0xaf7c('0xc')]);router['post']('/',auth[_0xaf7c('0xb')](),controller[_0xaf7c('0xd')]);router[_0xaf7c('0xe')](_0xaf7c('0xf'),auth['isAuthenticated'](),controller[_0xaf7c('0x10')]);router[_0xaf7c('0x11')](_0xaf7c('0xf'),auth[_0xaf7c('0xb')](),controller[_0xaf7c('0x12')]);module[_0xaf7c('0x13')]=router; \ No newline at end of file +var _0x00de=['util','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','post','put','delete','/:id','exports'];(function(_0x5bb3ae,_0x222ee5){var _0x193e88=function(_0x4dbb7f){while(--_0x4dbb7f){_0x5bb3ae['push'](_0x5bb3ae['shift']());}};_0x193e88(++_0x222ee5);}(_0x00de,0x1a0));var _0xe00d=function(_0x283127,_0x54d4d5){_0x283127=_0x283127-0x0;var _0x43da5d=_0x00de[_0x283127];return _0x43da5d;};'use strict';var multer=require('multer');var util=require(_0xe00d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe00d('0x1'));var router=express['Router']();var fs_extra=require(_0xe00d('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xe00d('0x3'));var config=require(_0xe00d('0x4'));var controller=require(_0xe00d('0x5'));router[_0xe00d('0x6')]('/',auth['isAuthenticated'](),controller[_0xe00d('0x7')]);router[_0xe00d('0x6')](_0xe00d('0x8'),auth[_0xe00d('0x9')](),controller[_0xe00d('0xa')]);router[_0xe00d('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xe00d('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe00d('0xc')]('/:id',auth[_0xe00d('0x9')](),controller['update']);router[_0xe00d('0xd')](_0xe00d('0xe'),auth[_0xe00d('0x9')](),controller['destroy']);module[_0xe00d('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 4f48273..5029739 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 _0xa988=['account','queue','DATE','sequelize','exports','STRING','ENUM'];(function(_0x4f815,_0x36075e){var _0x1d1fef=function(_0x4fc630){while(--_0x4fc630){_0x4f815['push'](_0x4f815['shift']());}};_0x1d1fef(++_0x36075e);}(_0xa988,0x1a7));var _0x8a98=function(_0x5e3442,_0x5a1d90){_0x5e3442=_0x5e3442-0x0;var _0x3590bd=_0xa988[_0x5e3442];return _0x3590bd;};'use strict';var Sequelize=require(_0x8a98('0x0'));module[_0x8a98('0x1')]={'uniqueid':{'type':Sequelize[_0x8a98('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8a98('0x3')](_0x8a98('0x4'),'agent',_0x8a98('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x8a98('0x6')]}}; \ No newline at end of file +var _0x438a=['agent','queue','DATE','sequelize','exports','STRING','ENUM','account'];(function(_0x168d94,_0x4f900a){var _0x2dc741=function(_0x134dd9){while(--_0x134dd9){_0x168d94['push'](_0x168d94['shift']());}};_0x2dc741(++_0x4f900a);}(_0x438a,0x18b));var _0xa438=function(_0x366812,_0x4f1d4e){_0x366812=_0x366812-0x0;var _0x329c77=_0x438a[_0x366812];return _0x329c77;};'use strict';var Sequelize=require(_0xa438('0x0'));module[_0xa438('0x1')]={'uniqueid':{'type':Sequelize[_0xa438('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa438('0x3')](_0xa438('0x4'),_0xa438('0x5'),_0xa438('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xa438('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 70162d1..c3164d7 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 _0x7cd6=['include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','to-csv','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll'];(function(_0x5a7297,_0xcf7ca6){var _0x37fa46=function(_0x3f3742){while(--_0x3f3742){_0x5a7297['push'](_0x5a7297['shift']());}};_0x37fa46(++_0xcf7ca6);}(_0x7cd6,0x1f4));var _0x67cd=function(_0x3cc187,_0x3bf8a1){_0x3cc187=_0x3cc187-0x0;var _0x45c6bb=_0x7cd6[_0x3cc187];return _0x45c6bb;};'use strict';var emlformat=require(_0x67cd('0x0'));var rimraf=require(_0x67cd('0x1'));var zipdir=require(_0x67cd('0x2'));var jsonpatch=require(_0x67cd('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x67cd('0x4'));var Mustache=require(_0x67cd('0x5'));var util=require(_0x67cd('0x6'));var path=require('path');var sox=require(_0x67cd('0x7'));var csv=require('to-csv');var ejs=require(_0x67cd('0x8'));var fs=require('fs');var fs_extra=require(_0x67cd('0x9'));var _=require(_0x67cd('0xa'));var squel=require(_0x67cd('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x67cd('0xc'));var querystring=require(_0x67cd('0xd'));var Papa=require('papaparse');var Redis=require(_0x67cd('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x67cd('0xf'));var logger=require(_0x67cd('0x10'))(_0x67cd('0x11'));var utils=require(_0x67cd('0x12'));var config=require(_0x67cd('0x13'));var licenseUtil=require(_0x67cd('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0a05,_0x39c6ca){_0x39c6ca=_0x39c6ca||0xcc;return function(_0x1693d7){if(_0x1693d7){return _0x2a0a05[_0x67cd('0x15')](_0x39c6ca);}return _0x2a0a05[_0x67cd('0x16')](_0x39c6ca)[_0x67cd('0x17')]();};}function respondWithResult(_0x158bf0,_0x2d5aca){_0x2d5aca=_0x2d5aca||0xc8;return function(_0x15da7d){if(_0x15da7d){return _0x158bf0[_0x67cd('0x16')](_0x2d5aca)[_0x67cd('0x18')](_0x15da7d);}};}function respondWithFilteredResult(_0xc3fb41,_0x4c5b6d){return function(_0x3fdccf){if(_0x3fdccf){var _0x465590=typeof _0x4c5b6d[_0x67cd('0x19')]===_0x67cd('0x1a')&&typeof _0x4c5b6d[_0x67cd('0x1b')]==='undefined';var _0xb147d8=_0x3fdccf['count'];var _0x30cb35=_0x465590?0x0:_0x4c5b6d['offset'];var _0x5596e0=_0x465590?_0x3fdccf['count']:_0x4c5b6d[_0x67cd('0x19')]+_0x4c5b6d[_0x67cd('0x1b')];var _0x4370e0;if(_0x5596e0>=_0xb147d8){_0x5596e0=_0xb147d8;_0x4370e0=0xc8;}else{_0x4370e0=0xce;}_0xc3fb41[_0x67cd('0x16')](_0x4370e0);return _0xc3fb41[_0x67cd('0x1c')](_0x67cd('0x1d'),_0x30cb35+'-'+_0x5596e0+'/'+_0xb147d8)[_0x67cd('0x18')](_0x3fdccf);}return null;};}function patchUpdates(_0x2011e5){return function(_0x1fff15){try{jsonpatch[_0x67cd('0x1e')](_0x1fff15,_0x2011e5,!![]);}catch(_0x591019){return BPromise[_0x67cd('0x1f')](_0x591019);}return _0x1fff15[_0x67cd('0x20')]();};}function saveUpdates(_0x1003b6,_0x22b153){return function(_0x512760){if(_0x512760){return _0x512760['update'](_0x1003b6)[_0x67cd('0x21')](function(_0x35ba2f){return _0x35ba2f;});}return null;};}function removeEntity(_0x21d5f1,_0x5f042c){return function(_0x2230c1){if(_0x2230c1){return _0x2230c1[_0x67cd('0x22')]()['then'](function(){_0x21d5f1[_0x67cd('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6b9e7,_0x3958bc){return function(_0xbd0ca7){if(!_0xbd0ca7){_0x6b9e7[_0x67cd('0x15')](0x194);}return _0xbd0ca7;};}function handleError(_0x128a7f,_0x4d6ee1){_0x4d6ee1=_0x4d6ee1||0x1f4;return function(_0x9c9b8a){logger['error'](_0x9c9b8a[_0x67cd('0x23')]);if(_0x9c9b8a[_0x67cd('0x24')]){delete _0x9c9b8a[_0x67cd('0x24')];}_0x128a7f[_0x67cd('0x16')](_0x4d6ee1)['send'](_0x9c9b8a);};}exports['index']=function(_0x1f252d,_0x185308){var _0x1b905e={},_0x5461c7={},_0x56ff0a={'count':0x0,'rows':[]};var _0x21b9e2=_[_0x67cd('0x25')](db[_0x67cd('0x26')][_0x67cd('0x27')],function(_0x49e1e2){return{'name':_0x49e1e2[_0x67cd('0x28')],'type':_0x49e1e2[_0x67cd('0x29')][_0x67cd('0x2a')]};});_0x5461c7['model']=_['map'](_0x21b9e2,_0x67cd('0x24'));_0x5461c7[_0x67cd('0x2b')]=_['keys'](_0x1f252d[_0x67cd('0x2b')]);_0x5461c7[_0x67cd('0x2c')]=_[_0x67cd('0x2d')](_0x5461c7[_0x67cd('0x2e')],_0x5461c7['query']);_0x1b905e[_0x67cd('0x2f')]=_[_0x67cd('0x2d')](_0x5461c7[_0x67cd('0x2e')],qs[_0x67cd('0x30')](_0x1f252d[_0x67cd('0x2b')][_0x67cd('0x30')]));_0x1b905e[_0x67cd('0x2f')]=_0x1b905e[_0x67cd('0x2f')][_0x67cd('0x31')]?_0x1b905e[_0x67cd('0x2f')]:_0x5461c7['model'];if(!_0x1f252d['query'][_0x67cd('0x32')]('nolimit')){_0x1b905e[_0x67cd('0x1b')]=qs[_0x67cd('0x1b')](_0x1f252d[_0x67cd('0x2b')]['limit']);_0x1b905e[_0x67cd('0x19')]=qs[_0x67cd('0x19')](_0x1f252d['query'][_0x67cd('0x19')]);}_0x1b905e['order']=qs[_0x67cd('0x33')](_0x1f252d[_0x67cd('0x2b')]['sort']);_0x1b905e[_0x67cd('0x34')]=qs[_0x67cd('0x2c')](_[_0x67cd('0x35')](_0x1f252d[_0x67cd('0x2b')],_0x5461c7[_0x67cd('0x2c')]),_0x21b9e2);if(_0x1f252d[_0x67cd('0x2b')][_0x67cd('0x36')]){_0x1b905e[_0x67cd('0x34')]=_['merge'](_0x1b905e[_0x67cd('0x34')],{'$or':_[_0x67cd('0x25')](_0x21b9e2,function(_0x303108){if(_0x303108[_0x67cd('0x29')]!==_0x67cd('0x37')){var _0x5f2b10={};_0x5f2b10[_0x303108['name']]={'$like':'%'+_0x1f252d[_0x67cd('0x2b')][_0x67cd('0x36')]+'%'};return _0x5f2b10;}})});}_0x1b905e=_[_0x67cd('0x38')]({},_0x1b905e,_0x1f252d[_0x67cd('0x39')]);var _0x54f485={'where':_0x1b905e['where']};return db[_0x67cd('0x26')][_0x67cd('0x3a')](_0x54f485)[_0x67cd('0x21')](function(_0x1b007e){_0x56ff0a[_0x67cd('0x3a')]=_0x1b007e;if(_0x1f252d['query'][_0x67cd('0x3b')]){_0x1b905e[_0x67cd('0x3c')]=[{'all':!![]}];}return db[_0x67cd('0x26')][_0x67cd('0x3d')](_0x1b905e);})['then'](function(_0x2bccd4){_0x56ff0a[_0x67cd('0x3e')]=_0x2bccd4;return _0x56ff0a;})[_0x67cd('0x21')](respondWithFilteredResult(_0x185308,_0x1b905e))[_0x67cd('0x3f')](handleError(_0x185308,null));};exports[_0x67cd('0x40')]=function(_0xfc8404,_0x36a50a){var _0x28f078={'raw':!![],'where':{'id':_0xfc8404[_0x67cd('0x41')]['id']}},_0x9ab74f={};_0x9ab74f['model']=_[_0x67cd('0x42')](db['WhatsappTransferReport'][_0x67cd('0x27')]);_0x9ab74f['query']=_[_0x67cd('0x42')](_0xfc8404[_0x67cd('0x2b')]);_0x9ab74f[_0x67cd('0x2c')]=_[_0x67cd('0x2d')](_0x9ab74f[_0x67cd('0x2e')],_0x9ab74f[_0x67cd('0x2b')]);_0x28f078[_0x67cd('0x2f')]=_[_0x67cd('0x2d')](_0x9ab74f[_0x67cd('0x2e')],qs[_0x67cd('0x30')](_0xfc8404[_0x67cd('0x2b')][_0x67cd('0x30')]));_0x28f078[_0x67cd('0x2f')]=_0x28f078[_0x67cd('0x2f')][_0x67cd('0x31')]?_0x28f078['attributes']:_0x9ab74f[_0x67cd('0x2e')];if(_0xfc8404[_0x67cd('0x2b')][_0x67cd('0x3b')]){_0x28f078['include']=[{'all':!![]}];}_0x28f078=_[_0x67cd('0x38')]({},_0x28f078,_0xfc8404['options']);return db[_0x67cd('0x26')][_0x67cd('0x43')](_0x28f078)['then'](handleEntityNotFound(_0x36a50a,null))[_0x67cd('0x21')](respondWithResult(_0x36a50a,null))[_0x67cd('0x3f')](handleError(_0x36a50a,null));};exports[_0x67cd('0x44')]=function(_0x424ae5,_0x2184c5){return db[_0x67cd('0x26')][_0x67cd('0x44')](_0x424ae5[_0x67cd('0x45')],{})[_0x67cd('0x21')](respondWithResult(_0x2184c5,0xc9))[_0x67cd('0x3f')](handleError(_0x2184c5,null));};exports['update']=function(_0x227278,_0x591450){if(_0x227278[_0x67cd('0x45')]['id']){delete _0x227278[_0x67cd('0x45')]['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0x227278['params']['id']}})[_0x67cd('0x21')](handleEntityNotFound(_0x591450,null))['then'](saveUpdates(_0x227278['body'],null))[_0x67cd('0x21')](respondWithResult(_0x591450,null))[_0x67cd('0x3f')](handleError(_0x591450,null));};exports['destroy']=function(_0x5bdafb,_0x3cff64){return db[_0x67cd('0x26')]['find']({'where':{'id':_0x5bdafb[_0x67cd('0x41')]['id']}})[_0x67cd('0x21')](handleEntityNotFound(_0x3cff64,null))[_0x67cd('0x21')](removeEntity(_0x3cff64,null))[_0x67cd('0x3f')](handleError(_0x3cff64,null));};exports['describe']=function(_0x368b6e,_0x4b99f7){return db['WhatsappTransferReport']['describe']()[_0x67cd('0x21')](respondWithResult(_0x4b99f7,null))[_0x67cd('0x3f')](handleError(_0x4b99f7,null));}; \ No newline at end of file +var _0xca7e=['eml-format','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','find','describe'];(function(_0x40ebff,_0x1dd15e){var _0x40122a=function(_0xae6174){while(--_0xae6174){_0x40ebff['push'](_0x40ebff['shift']());}};_0x40122a(++_0x1dd15e);}(_0xca7e,0xde));var _0xeca7=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xca7e[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0xeca7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeca7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeca7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeca7('0x3'));var util=require(_0xeca7('0x4'));var path=require(_0xeca7('0x5'));var sox=require(_0xeca7('0x6'));var csv=require(_0xeca7('0x7'));var ejs=require(_0xeca7('0x8'));var fs=require('fs');var fs_extra=require(_0xeca7('0x9'));var _=require('lodash');var squel=require(_0xeca7('0xa'));var crypto=require(_0xeca7('0xb'));var jsforce=require(_0xeca7('0xc'));var deskjs=require(_0xeca7('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeca7('0xe'));var authService=require(_0xeca7('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xeca7('0x10'));var hardwareService=require(_0xeca7('0x11'));var logger=require(_0xeca7('0x12'))('api');var utils=require(_0xeca7('0x13'));var config=require(_0xeca7('0x14'));var licenseUtil=require(_0xeca7('0x15'));var db=require(_0xeca7('0x16'))['db'];function respondWithStatusCode(_0x57cfc5,_0x3ff56f){_0x3ff56f=_0x3ff56f||0xcc;return function(_0x3f72db){if(_0x3f72db){return _0x57cfc5[_0xeca7('0x17')](_0x3ff56f);}return _0x57cfc5[_0xeca7('0x18')](_0x3ff56f)['end']();};}function respondWithResult(_0x45907b,_0x32a799){_0x32a799=_0x32a799||0xc8;return function(_0x5bcead){if(_0x5bcead){return _0x45907b['status'](_0x32a799)[_0xeca7('0x19')](_0x5bcead);}};}function respondWithFilteredResult(_0x55e471,_0x4358d6){return function(_0x47c86c){if(_0x47c86c){var _0x107077=typeof _0x4358d6[_0xeca7('0x1a')]===_0xeca7('0x1b')&&typeof _0x4358d6[_0xeca7('0x1c')]===_0xeca7('0x1b');var _0x42f09d=_0x47c86c['count'];var _0x48bdfa=_0x107077?0x0:_0x4358d6[_0xeca7('0x1a')];var _0x155ad0=_0x107077?_0x47c86c[_0xeca7('0x1d')]:_0x4358d6['offset']+_0x4358d6[_0xeca7('0x1c')];var _0x2cf503;if(_0x155ad0>=_0x42f09d){_0x155ad0=_0x42f09d;_0x2cf503=0xc8;}else{_0x2cf503=0xce;}_0x55e471['status'](_0x2cf503);return _0x55e471[_0xeca7('0x1e')](_0xeca7('0x1f'),_0x48bdfa+'-'+_0x155ad0+'/'+_0x42f09d)[_0xeca7('0x19')](_0x47c86c);}return null;};}function patchUpdates(_0x2e9cd6){return function(_0x4d0dc7){try{jsonpatch[_0xeca7('0x20')](_0x4d0dc7,_0x2e9cd6,!![]);}catch(_0xe2961e){return BPromise[_0xeca7('0x21')](_0xe2961e);}return _0x4d0dc7['save']();};}function saveUpdates(_0x3b76cd,_0x4b77f2){return function(_0x1b3ac2){if(_0x1b3ac2){return _0x1b3ac2[_0xeca7('0x22')](_0x3b76cd)[_0xeca7('0x23')](function(_0x2c4202){return _0x2c4202;});}return null;};}function removeEntity(_0x391d90,_0x5c9795){return function(_0x59db5a){if(_0x59db5a){return _0x59db5a[_0xeca7('0x24')]()['then'](function(){_0x391d90[_0xeca7('0x18')](0xcc)[_0xeca7('0x25')]();});}};}function handleEntityNotFound(_0x195fed,_0x319aa6){return function(_0x294800){if(!_0x294800){_0x195fed[_0xeca7('0x17')](0x194);}return _0x294800;};}function handleError(_0x1aee41,_0x472ef2){_0x472ef2=_0x472ef2||0x1f4;return function(_0x328abf){logger[_0xeca7('0x26')](_0x328abf[_0xeca7('0x27')]);if(_0x328abf[_0xeca7('0x28')]){delete _0x328abf[_0xeca7('0x28')];}_0x1aee41['status'](_0x472ef2)['send'](_0x328abf);};}exports[_0xeca7('0x29')]=function(_0x205157,_0x582a04){var _0x490eb0={},_0x1e0acf={},_0x573e29={'count':0x0,'rows':[]};var _0x53e519=_[_0xeca7('0x2a')](db[_0xeca7('0x2b')][_0xeca7('0x2c')],function(_0x3e78d0){return{'name':_0x3e78d0[_0xeca7('0x2d')],'type':_0x3e78d0[_0xeca7('0x2e')][_0xeca7('0x2f')]};});_0x1e0acf[_0xeca7('0x30')]=_[_0xeca7('0x2a')](_0x53e519,_0xeca7('0x28'));_0x1e0acf[_0xeca7('0x31')]=_[_0xeca7('0x32')](_0x205157[_0xeca7('0x31')]);_0x1e0acf['filters']=_[_0xeca7('0x33')](_0x1e0acf[_0xeca7('0x30')],_0x1e0acf[_0xeca7('0x31')]);_0x490eb0['attributes']=_[_0xeca7('0x33')](_0x1e0acf[_0xeca7('0x30')],qs[_0xeca7('0x34')](_0x205157[_0xeca7('0x31')][_0xeca7('0x34')]));_0x490eb0[_0xeca7('0x35')]=_0x490eb0[_0xeca7('0x35')][_0xeca7('0x36')]?_0x490eb0[_0xeca7('0x35')]:_0x1e0acf[_0xeca7('0x30')];if(!_0x205157['query'][_0xeca7('0x37')]('nolimit')){_0x490eb0[_0xeca7('0x1c')]=qs['limit'](_0x205157['query'][_0xeca7('0x1c')]);_0x490eb0[_0xeca7('0x1a')]=qs['offset'](_0x205157[_0xeca7('0x31')]['offset']);}_0x490eb0[_0xeca7('0x38')]=qs[_0xeca7('0x39')](_0x205157[_0xeca7('0x31')][_0xeca7('0x39')]);_0x490eb0[_0xeca7('0x3a')]=qs[_0xeca7('0x3b')](_[_0xeca7('0x3c')](_0x205157[_0xeca7('0x31')],_0x1e0acf[_0xeca7('0x3b')]),_0x53e519);if(_0x205157[_0xeca7('0x31')]['filter']){_0x490eb0[_0xeca7('0x3a')]=_[_0xeca7('0x3d')](_0x490eb0[_0xeca7('0x3a')],{'$or':_[_0xeca7('0x2a')](_0x53e519,function(_0x162600){if(_0x162600[_0xeca7('0x2e')]!==_0xeca7('0x3e')){var _0x1703a9={};_0x1703a9[_0x162600['name']]={'$like':'%'+_0x205157[_0xeca7('0x31')]['filter']+'%'};return _0x1703a9;}})});}_0x490eb0=_['merge']({},_0x490eb0,_0x205157[_0xeca7('0x3f')]);var _0x512692={'where':_0x490eb0[_0xeca7('0x3a')]};return db[_0xeca7('0x2b')][_0xeca7('0x1d')](_0x512692)[_0xeca7('0x23')](function(_0x1d9381){_0x573e29[_0xeca7('0x1d')]=_0x1d9381;if(_0x205157['query'][_0xeca7('0x40')]){_0x490eb0[_0xeca7('0x41')]=[{'all':!![]}];}return db[_0xeca7('0x2b')][_0xeca7('0x42')](_0x490eb0);})['then'](function(_0x16c6e8){_0x573e29[_0xeca7('0x43')]=_0x16c6e8;return _0x573e29;})[_0xeca7('0x23')](respondWithFilteredResult(_0x582a04,_0x490eb0))[_0xeca7('0x44')](handleError(_0x582a04,null));};exports['show']=function(_0x42c3a6,_0x2b6822){var _0x4044f9={'raw':!![],'where':{'id':_0x42c3a6[_0xeca7('0x45')]['id']}},_0x1ecf35={};_0x1ecf35[_0xeca7('0x30')]=_[_0xeca7('0x32')](db[_0xeca7('0x2b')][_0xeca7('0x2c')]);_0x1ecf35[_0xeca7('0x31')]=_['keys'](_0x42c3a6[_0xeca7('0x31')]);_0x1ecf35[_0xeca7('0x3b')]=_[_0xeca7('0x33')](_0x1ecf35[_0xeca7('0x30')],_0x1ecf35[_0xeca7('0x31')]);_0x4044f9['attributes']=_['intersection'](_0x1ecf35[_0xeca7('0x30')],qs[_0xeca7('0x34')](_0x42c3a6['query'][_0xeca7('0x34')]));_0x4044f9[_0xeca7('0x35')]=_0x4044f9[_0xeca7('0x35')][_0xeca7('0x36')]?_0x4044f9[_0xeca7('0x35')]:_0x1ecf35[_0xeca7('0x30')];if(_0x42c3a6['query'][_0xeca7('0x40')]){_0x4044f9[_0xeca7('0x41')]=[{'all':!![]}];}_0x4044f9=_[_0xeca7('0x3d')]({},_0x4044f9,_0x42c3a6['options']);return db['WhatsappTransferReport']['find'](_0x4044f9)[_0xeca7('0x23')](handleEntityNotFound(_0x2b6822,null))[_0xeca7('0x23')](respondWithResult(_0x2b6822,null))[_0xeca7('0x44')](handleError(_0x2b6822,null));};exports[_0xeca7('0x46')]=function(_0x1c48b3,_0x1a4a7f){return db[_0xeca7('0x2b')][_0xeca7('0x46')](_0x1c48b3['body'],{})[_0xeca7('0x23')](respondWithResult(_0x1a4a7f,0xc9))[_0xeca7('0x44')](handleError(_0x1a4a7f,null));};exports[_0xeca7('0x22')]=function(_0x2a8936,_0x19fd37){if(_0x2a8936[_0xeca7('0x47')]['id']){delete _0x2a8936['body']['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0x2a8936[_0xeca7('0x45')]['id']}})[_0xeca7('0x23')](handleEntityNotFound(_0x19fd37,null))['then'](saveUpdates(_0x2a8936['body'],null))[_0xeca7('0x23')](respondWithResult(_0x19fd37,null))[_0xeca7('0x44')](handleError(_0x19fd37,null));};exports[_0xeca7('0x24')]=function(_0x248bf4,_0x2a6d3e){return db['WhatsappTransferReport'][_0xeca7('0x48')]({'where':{'id':_0x248bf4[_0xeca7('0x45')]['id']}})[_0xeca7('0x23')](handleEntityNotFound(_0x2a6d3e,null))[_0xeca7('0x23')](removeEntity(_0x2a6d3e,null))[_0xeca7('0x44')](handleError(_0x2a6d3e,null));};exports['describe']=function(_0x4269c2,_0x33d96c){return db['WhatsappTransferReport'][_0xeca7('0x49')]()['then'](respondWithResult(_0x33d96c,null))[_0xeca7('0x44')](handleError(_0x33d96c,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 21b6cf5..4a664ad 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 _0xb543=['util','api','moment','request-promise','path','rimraf','exports','define','WhatsappTransferReport','report_whatsapp_transfer','lodash'];(function(_0x397b01,_0x536ac1){var _0x37a5fe=function(_0x1d9a0a){while(--_0x1d9a0a){_0x397b01['push'](_0x397b01['shift']());}};_0x37a5fe(++_0x536ac1);}(_0xb543,0xaf));var _0x3b54=function(_0x5fb4f9,_0x429bb3){_0x5fb4f9=_0x5fb4f9-0x0;var _0x2aff96=_0xb543[_0x5fb4f9];return _0x2aff96;};'use strict';var _=require(_0x3b54('0x0'));var util=require(_0x3b54('0x1'));var logger=require('../../config/logger')(_0x3b54('0x2'));var moment=require(_0x3b54('0x3'));var BPromise=require('bluebird');var rp=require(_0x3b54('0x4'));var fs=require('fs');var path=require(_0x3b54('0x5'));var rimraf=require(_0x3b54('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module[_0x3b54('0x7')]=function(_0x32495b,_0x3f3c8b){return _0x32495b[_0x3b54('0x8')](_0x3b54('0x9'),attributes,{'tableName':_0x3b54('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe5bf=['uniqueid','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xe5bf,0x15f));var _0xfe5b=function(_0x4bc51f,_0x34ab17){_0x4bc51f=_0x4bc51f-0x0;var _0xcd0eaf=_0xe5bf[_0x4bc51f];return _0xcd0eaf;};'use strict';var _=require('lodash');var util=require(_0xfe5b('0x0'));var logger=require(_0xfe5b('0x1'))(_0xfe5b('0x2'));var moment=require(_0xfe5b('0x3'));var BPromise=require('bluebird');var rp=require(_0xfe5b('0x4'));var fs=require('fs');var path=require(_0xfe5b('0x5'));var rimraf=require(_0xfe5b('0x6'));var config=require(_0xfe5b('0x7'));var attributes=require(_0xfe5b('0x8'));module[_0xfe5b('0x9')]=function(_0x2023f1,_0xbe34c2){return _0x2023f1[_0xfe5b('0xa')](_0xfe5b('0xb'),attributes,{'tableName':_0xfe5b('0xc'),'paranoid':![],'indexes':[{'name':_0xfe5b('0xd'),'fields':[_0xfe5b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 7b01a5a..bd17675 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 _0x5851=['message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x33b5f5,_0x2b5eef){var _0x292efb=function(_0x37f098){while(--_0x37f098){_0x33b5f5['push'](_0x33b5f5['shift']());}};_0x292efb(++_0x2b5eef);}(_0x5851,0xde));var _0x1585=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5851[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1585('0x0'));var util=require('util');var moment=require(_0x1585('0x1'));var BPromise=require('bluebird');var rs=require(_0x1585('0x2'));var fs=require('fs');var Redis=require(_0x1585('0x3'));var db=require(_0x1585('0x4'))['db'];var utils=require(_0x1585('0x5'));var logger=require('../../config/logger')(_0x1585('0x6'));var config=require('../../config/environment');var jayson=require(_0x1585('0x7'));var client=jayson[_0x1585('0x8')][_0x1585('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x400493,_0x20bdb9,_0x3515aa){return new BPromise(function(_0x5c6439,_0x2db4e7){return client[_0x1585('0xa')](_0x400493,_0x3515aa)[_0x1585('0xb')](function(_0x5ab725){logger[_0x1585('0xc')](_0x1585('0xd'),_0x20bdb9,_0x1585('0xe'));logger[_0x1585('0xf')](_0x1585('0x10'),_0x20bdb9,'request\x20sent',JSON[_0x1585('0x11')](_0x5ab725));if(_0x5ab725[_0x1585('0x12')]){if(_0x5ab725[_0x1585('0x12')][_0x1585('0x13')]===0x1f4){logger[_0x1585('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x20bdb9,_0x5ab725[_0x1585('0x12')][_0x1585('0x14')]);return _0x2db4e7(_0x5ab725['error'][_0x1585('0x14')]);}logger[_0x1585('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x20bdb9,_0x5ab725[_0x1585('0x12')]['message']);return _0x5c6439(_0x5ab725['error']['message']);}else{logger[_0x1585('0xc')](_0x1585('0xd'),_0x20bdb9,_0x1585('0xe'));_0x5c6439(_0x5ab725[_0x1585('0x15')][_0x1585('0x14')]);}})['catch'](function(_0x333011){logger[_0x1585('0x12')](_0x1585('0xd'),_0x20bdb9,_0x333011);_0x2db4e7(_0x333011);});});} \ No newline at end of file +var _0xffb5=['WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x15ca1a,_0x33fde3){var _0x36d76=function(_0x62cd4a){while(--_0x62cd4a){_0x15ca1a['push'](_0x15ca1a['shift']());}};_0x36d76(++_0x33fde3);}(_0xffb5,0x1d1));var _0x5ffb=function(_0x56d577,_0x55bbe4){_0x56d577=_0x56d577-0x0;var _0x56503b=_0xffb5[_0x56d577];return _0x56503b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5ffb('0x0'));var rs=require(_0x5ffb('0x1'));var fs=require('fs');var Redis=require(_0x5ffb('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5ffb('0x3'))(_0x5ffb('0x4'));var config=require('../../config/environment');var jayson=require(_0x5ffb('0x5'));var client=jayson[_0x5ffb('0x6')][_0x5ffb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1d1c57,_0x1eaf36,_0x4bf76c){return new BPromise(function(_0x46ec63,_0x466802){return client[_0x5ffb('0x8')](_0x1d1c57,_0x4bf76c)[_0x5ffb('0x9')](function(_0x2e2bf4){logger[_0x5ffb('0xa')](_0x5ffb('0xb'),_0x1eaf36,_0x5ffb('0xc'));logger['debug'](_0x5ffb('0xd'),_0x1eaf36,_0x5ffb('0xc'),JSON['stringify'](_0x2e2bf4));if(_0x2e2bf4[_0x5ffb('0xe')]){if(_0x2e2bf4['error'][_0x5ffb('0xf')]===0x1f4){logger[_0x5ffb('0xe')](_0x5ffb('0xb'),_0x1eaf36,_0x2e2bf4[_0x5ffb('0xe')][_0x5ffb('0x10')]);return _0x466802(_0x2e2bf4[_0x5ffb('0xe')][_0x5ffb('0x10')]);}logger[_0x5ffb('0xe')](_0x5ffb('0xb'),_0x1eaf36,_0x2e2bf4[_0x5ffb('0xe')][_0x5ffb('0x10')]);return _0x46ec63(_0x2e2bf4[_0x5ffb('0xe')][_0x5ffb('0x10')]);}else{logger[_0x5ffb('0xa')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1eaf36,_0x5ffb('0xc'));_0x46ec63(_0x2e2bf4['result'][_0x5ffb('0x10')]);}})['catch'](function(_0x1fe0b8){logger[_0x5ffb('0xe')](_0x5ffb('0xb'),_0x1eaf36,_0x1fe0b8);_0x466802(_0x1fe0b8);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 41dce42..4e9cdc0 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf2f=['start','Online\x20apps:','filter','online','join','Offline\x20apps:','map','status','name','None','seedDB','./config/license','default','catch','error','lodash','./mysqldb','./rpc','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','listen','info'];(function(_0xc2597b,_0x389b1d){var _0x16d754=function(_0x2ecfaf){while(--_0x2ecfaf){_0xc2597b['push'](_0xc2597b['shift']());}};_0x16d754(++_0x389b1d);}(_0xaf2f,0xc9));var _0xfaf2=function(_0xd78252,_0x1e3a92){_0xd78252=_0xd78252-0x0;var _0x190120=_0xaf2f[_0xd78252];return _0x190120;};'use strict';var _=require(_0xfaf2('0x0'));var mysqldb=require(_0xfaf2('0x1'));var rpc=require(_0xfaf2('0x2'));var config=require(_0xfaf2('0x3'));var logger=require('./config/logger')(_0xfaf2('0x4'));var pm2=require(_0xfaf2('0x5'));var pm2Config=require(_0xfaf2('0x6'));var schedule=require(_0xfaf2('0x7'));var chat=require(_0xfaf2('0x8'));var whatsapp=require(_0xfaf2('0x9'));var transcribe=require(_0xfaf2('0xa'));function main(){return mysqldb['db'][_0xfaf2('0xb')][_0xfaf2('0xc')]()[_0xfaf2('0xd')](function(){return rpc[_0xfaf2('0xe')]();})[_0xfaf2('0xd')](function(_0x66986c){logger[_0xfaf2('0xf')](_0x66986c);return chat['start']();})['then'](function(){return whatsapp[_0xfaf2('0x10')]();})[_0xfaf2('0xd')](function(){return schedule[_0xfaf2('0x10')]();})[_0xfaf2('0xd')](function(){return transcribe['start']();})['then'](function(_0x54dc7c){logger[_0xfaf2('0xf')](_0x54dc7c);return pm2['start'](pm2Config);})['then'](function(_0x12d52f){logger[_0xfaf2('0xf')](_0xfaf2('0x11'),_['map'](_[_0xfaf2('0x12')](_0x12d52f,{'status':_0xfaf2('0x13')}),'name')[_0xfaf2('0x14')]());logger['info'](_0xfaf2('0x15'),_[_0xfaf2('0x16')](_[_0xfaf2('0x12')](_0x12d52f,function(_0x5c86bf){return _0x5c86bf[_0xfaf2('0x17')]!==_0xfaf2('0x13');}),_0xfaf2('0x18'))[_0xfaf2('0x14')]()||_0xfaf2('0x19'));config[_0xfaf2('0x1a')]&&require('./config/seedDB')['default']();require(_0xfaf2('0x1b'))[_0xfaf2('0x1c')]();})[_0xfaf2('0x1d')](function(_0x44df4f){logger[_0xfaf2('0x1e')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x44df4f);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x32da=['./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','info','start','Online\x20apps:','map','filter','online','name','join','Offline\x20apps:','status','seedDB','default','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./rpc','./config/logger','app'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x32da,0x113));var _0xa32d=function(_0x1fad0d,_0x3d947a){_0x1fad0d=_0x1fad0d-0x0;var _0x298629=_0x32da[_0x1fad0d];return _0x298629;};'use strict';var _=require(_0xa32d('0x0'));var mysqldb=require(_0xa32d('0x1'));var rpc=require(_0xa32d('0x2'));var config=require('./config/environment');var logger=require(_0xa32d('0x3'))(_0xa32d('0x4'));var pm2=require(_0xa32d('0x5'));var pm2Config=require(_0xa32d('0x6'));var schedule=require(_0xa32d('0x7'));var chat=require(_0xa32d('0x8'));var whatsapp=require(_0xa32d('0x9'));var transcribe=require(_0xa32d('0xa'));function main(){return mysqldb['db'][_0xa32d('0xb')][_0xa32d('0xc')]()[_0xa32d('0xd')](function(){return rpc['listen']();})[_0xa32d('0xd')](function(_0x4fa716){logger[_0xa32d('0xe')](_0x4fa716);return chat[_0xa32d('0xf')]();})[_0xa32d('0xd')](function(){return whatsapp[_0xa32d('0xf')]();})[_0xa32d('0xd')](function(){return schedule[_0xa32d('0xf')]();})[_0xa32d('0xd')](function(){return transcribe[_0xa32d('0xf')]();})[_0xa32d('0xd')](function(_0x48a7ee){logger[_0xa32d('0xe')](_0x48a7ee);return pm2['start'](pm2Config);})[_0xa32d('0xd')](function(_0x1c19cd){logger[_0xa32d('0xe')](_0xa32d('0x10'),_[_0xa32d('0x11')](_[_0xa32d('0x12')](_0x1c19cd,{'status':_0xa32d('0x13')}),_0xa32d('0x14'))[_0xa32d('0x15')]());logger[_0xa32d('0xe')](_0xa32d('0x16'),_[_0xa32d('0x11')](_[_0xa32d('0x12')](_0x1c19cd,function(_0x4a3f8b){return _0x4a3f8b[_0xa32d('0x17')]!=='online';}),_0xa32d('0x14'))[_0xa32d('0x15')]()||'None');config[_0xa32d('0x18')]&&require('./config/seedDB')[_0xa32d('0x19')]();require('./config/license')['default']();})[_0xa32d('0x1a')](function(_0xc93329){logger['error'](_0xa32d('0x1b'),_0xc93329);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 9ab839a..3ed5fd9 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 _0x44cd=['closed','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','startsWith','authorization','User','find','name','authenticate','pass','Wrong\x20credentials.','user','Bearer','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','query','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','sign','secret','options','verify','session','randomBytes','hex','now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','util','secrets','role','fullname','internal','email','userpic','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','isAuthenticated','use','ChatInteraction','findOne','params'];(function(_0x11314c,_0x2ca8d7){var _0x12cb4a=function(_0x5e7ddc){while(--_0x5e7ddc){_0x11314c['push'](_0x11314c['shift']());}};_0x12cb4a(++_0x2ca8d7);}(_0x44cd,0x1ce));var _0xd44c=function(_0x7ad123,_0xeeeef3){_0x7ad123=_0x7ad123-0x0;var _0x37d073=_0x44cd[_0x7ad123];return _0x37d073;};'use strict';var db=require(_0xd44c('0x0'))['db'];var config=require(_0xd44c('0x1'));var hardwareConf=require(_0xd44c('0x2'));var licenseUtil=require(_0xd44c('0x3'));var encryptor=require(_0xd44c('0x4'));var _=require(_0xd44c('0x5'));var jwt=require(_0xd44c('0x6'));var expressJwt=require('express-jwt');var compose=require(_0xd44c('0x7'));var basicAuth=require(_0xd44c('0x8'));var crypto=require(_0xd44c('0x9'));var BPromise=require(_0xd44c('0xa'));var util=require(_0xd44c('0xb'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xd44c('0xc')]['session']});var userAttributes=['id',_0xd44c('0xd'),_0xd44c('0xe'),'name',_0xd44c('0xf'),_0xd44c('0x10'),_0xd44c('0x11'),'permissions',_0xd44c('0x12'),_0xd44c('0x13'),_0xd44c('0x14'),_0xd44c('0x15'),_0xd44c('0x16'),_0xd44c('0x17'),_0xd44c('0x18'),_0xd44c('0x19'),_0xd44c('0x1a'),_0xd44c('0x1b'),_0xd44c('0x1c'),_0xd44c('0x1d'),_0xd44c('0x1e'),_0xd44c('0x1f'),_0xd44c('0x20'),'phoneBarAutoAnswer',_0xd44c('0x21'),_0xd44c('0x22'),_0xd44c('0x23'),_0xd44c('0x24'),_0xd44c('0x25'),'phoneBarExpires',_0xd44c('0x26'),_0xd44c('0x27'),'phoneBarRemoteControlPort','hotdesk','interface',_0xd44c('0x28'),_0xd44c('0x29'),_0xd44c('0x2a'),_0xd44c('0x2b'),_0xd44c('0x2c'),'downloadOmnichannelInteractions','downloadAttachments'];exports['isChatInteractionAuthorized']=function(){return this[_0xd44c('0x2d')](!![])[_0xd44c('0x2e')](function(_0x54286f,_0x11fba2,_0x43a4a0){if(_0x54286f['user']){_0x43a4a0();}else{return db[_0xd44c('0x2f')][_0xd44c('0x30')]({'where':{'id':_0x54286f[_0xd44c('0x31')]['id']},'attributes':['id',_0xd44c('0x32'),_0xd44c('0x33')],'raw':!![]})[_0xd44c('0x34')](function(_0x248da7){if(_0x248da7&&_0x248da7[_0xd44c('0x32')]){return _0x11fba2[_0xd44c('0x35')](_0x248da7[_0xd44c('0x33')]===_0xd44c('0x36')?0x195:0x193)[_0xd44c('0x37')]({'message':_0x248da7[_0xd44c('0x33')]===_0xd44c('0x36')?_0xd44c('0x38'):_0xd44c('0x39')});}else{_0x43a4a0();}})[_0xd44c('0x3a')](function(_0x5f5871){_0x43a4a0(_0x5f5871);});}});};exports[_0xd44c('0x2d')]=function isAuthenticated(_0xb864b7){return compose()[_0xd44c('0x2e')](function(_0x670ad9,_0x4e156d,_0x108c67){var _0x1f5384;if(_0x670ad9[_0xd44c('0x3b')]['authorization']){if(_[_0xd44c('0x3c')](_0x670ad9[_0xd44c('0x3b')][_0xd44c('0x3d')],'Basic')){var _0x4ac956=basicAuth(_0x670ad9);db[_0xd44c('0x3e')][_0xd44c('0x3f')]({'where':{'name':_0x4ac956[_0xd44c('0x40')]}})[_0xd44c('0x34')](function(_0x532e85){if(!_0x532e85||!_0x532e85[_0xd44c('0x41')](_0x4ac956[_0xd44c('0x42')])){return _0x4e156d['status'](0x191)[_0xd44c('0x37')]({'message':_0xd44c('0x43')});}_0x670ad9[_0xd44c('0x44')]={'id':_0x532e85['id']};_0x108c67();})[_0xd44c('0x3a')](function(_0x593c85){_0x108c67(_0x593c85);});}else if(_[_0xd44c('0x3c')](_0x670ad9[_0xd44c('0x3b')][_0xd44c('0x3d')],_0xd44c('0x45'))){validateJwt(_0x670ad9,_0x4e156d,_0x108c67);}else{if(_0xb864b7){_0x108c67();}else{return _0x4e156d[_0xd44c('0x35')](0x193)[_0xd44c('0x37')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x670ad9['query'][_0xd44c('0x46')]){try{var _0x5ebe7a={'audience':hardwareConf[_0xd44c('0x47')](),'issuer':hardwareConf[_0xd44c('0x47')]()};verifyJwt(_0x670ad9['query']['apikey'],_0x5ebe7a)['then'](function(_0x4d7803){return db[_0xd44c('0x3e')][_0xd44c('0x3f')]({'where':{'id':_0x4d7803[_0xd44c('0x48')]}})['then'](function(_0x5b2db2){_0x1f5384=_0x5b2db2;return db[_0xd44c('0x49')][_0xd44c('0x30')]({'where':{'id':0x1},'attributes':[_0xd44c('0x4a'),_0xd44c('0x4b')],'raw':!![]});})[_0xd44c('0x34')](function(_0x23e73f){if(!_0x1f5384||!_[_0xd44c('0x4c')](_0x1f5384[_0xd44c('0x4d')],_0x4d7803['nonce'])){return _0x4e156d[_0xd44c('0x35')](0x191)['json']({'message':_0xd44c('0x4e')});}if(_0x1f5384[_0xd44c('0x4f')]){return _0x4e156d[_0xd44c('0x35')](0x191)['json']({'message':_0xd44c('0x50')});}if(_0x1f5384[_0xd44c('0x51')]){if(_0x23e73f[_0xd44c('0x4b')]>0x0){if(moment(_0x1f5384['blockedAt'])['add'](_0x23e73f[_0xd44c('0x4b')],'minutes')>moment()){return _0x4e156d[_0xd44c('0x35')](0x191)[_0xd44c('0x37')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x4e156d[_0xd44c('0x35')](0x191)[_0xd44c('0x37')]({'message':_0xd44c('0x50')});}}_0x670ad9[_0xd44c('0x44')]={'id':_0x1f5384['id']};_0x108c67();});})[_0xd44c('0x3a')](function(){return _0x4e156d[_0xd44c('0x35')](0x191)['json']({'message':_0xd44c('0x50')});});}catch(_0x320e39){_0x108c67(_0x320e39);}}else if(_0xb864b7){_0x108c67();}else{return _0x4e156d[_0xd44c('0x35')](0x193)['json']({'message':_0xd44c('0x52')});}})['use'](function(_0x52274d,_0x551e9d,_0x1b806e){if(_0x52274d[_0xd44c('0x44')]){db[_0xd44c('0x3e')][_0xd44c('0x3f')]({'where':{'id':_0x52274d[_0xd44c('0x44')]['id']},'attributes':userAttributes})[_0xd44c('0x34')](function(_0x524b1d){if(!_0x524b1d){return _0x551e9d[_0xd44c('0x35')](0x194)[_0xd44c('0x37')]({'message':_0xd44c('0x53')});}_0x52274d['user']=_0x524b1d;_0x1b806e();})['catch'](function(_0x3cb5df){_0x1b806e(_0x3cb5df);});}else if(_0xb864b7){_0x1b806e();}else{return _0x551e9d[_0xd44c('0x35')](0x194)[_0xd44c('0x37')]({'message':_0xd44c('0x54')});}});};exports[_0xd44c('0x55')]=function canUpdate(){return compose()[_0xd44c('0x2e')](function(_0x48502b,_0x5e9c70,_0x3448f6){return licenseUtil[_0xd44c('0x56')]()[_0xd44c('0x34')](function(_0x5a0d83){if(_0x5a0d83[_0xd44c('0x57')]){_0x3448f6();}else{return _0x5e9c70[_0xd44c('0x35')](0x193)[_0xd44c('0x37')]({'message':_0xd44c('0x58')});}})['catch'](function(_0x4c99e0){_0x3448f6(_0x4c99e0);});});};exports['isMiddleware']=function(_0xe95ddb,_0x1a3ae8,_0x1c06e3){_0xe95ddb['isMiddleware']=!![];return _0x1c06e3();};exports['signToken']=function signToken(_0x4a375b){return signJwt(_0x4a375b);};exports[_0xd44c('0x59')]=function(_0x7abe90,_0x1d8bb8){if(!_0x7abe90[_0xd44c('0x44')]){return _0x1d8bb8[_0xd44c('0x35')](0x194)['json']({'message':_0xd44c('0x5a')});}var _0x424cfc={'payload':{'id':_0x7abe90[_0xd44c('0x44')]['id'],'role':_0x7abe90[_0xd44c('0x44')][_0xd44c('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x424cfc)[_0xd44c('0x34')](function(_0x1f6729){_0x1d8bb8['cookie'](_0xd44c('0x5b'),_0x1f6729);_0x1d8bb8[_0xd44c('0x5c')](_0xd44c('0x5d'));})[_0xd44c('0x3a')](function(_0x3caeb4){return _0x1d8bb8[_0xd44c('0x35')](0x1f4)['send'](_0x3caeb4);});};exports[_0xd44c('0x5e')]=function(_0x4152fd){if(_[_0xd44c('0x5f')](_0x4152fd['apiKeyNonce'])||_[_0xd44c('0x5f')](_0x4152fd[_0xd44c('0x60')])){return null;}else{return createJwt(_0x4152fd);}};exports['generateApiKey']=function(_0x416248){_0x416248['apiKeyNonce']=generateNonce();_0x416248[_0xd44c('0x60')]=generateIssuedAt();return createJwt(_0x416248);};exports[_0xd44c('0x61')]=function(_0x49247a,_0x4a5b09){var _0x351beb=_0x49247a[_0xd44c('0x62')][_0xd44c('0x46')];if(_0x351beb){var _0x4f2e07={'nonce':_0x4a5b09['apiKeyNonce'],'iat':_0x4a5b09[_0xd44c('0x60')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xd44c('0x47')]()};return verifyJwt(_0x351beb,_0x4f2e07)['then'](function(){return generateApiKey(_0x4a5b09);});}else{throw{'message':_0xd44c('0x63')};}};exports[_0xd44c('0x64')]=function(_0x325d2f){var _0x5d6725=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5d6725[_0xd44c('0x65')](_0x325d2f))throw new db[(_0xd44c('0x66'))][(_0xd44c('0x67'))](_0xd44c('0x68'));return;};exports[_0xd44c('0x69')]=function(_0xbe2e18,_0x2bbce6,_0x4dbe52){var _0x37e515=encryptor[_0xd44c('0x6a')](_0x2bbce6)[_0xd44c('0x6b')](',');for(var _0x458195=0x0;_0x458195<_0x4dbe52;_0x458195++){if(!_0x37e515[_0x458195])break;if(_0xbe2e18[_0xd44c('0x6c')]()===_0x37e515[_0x458195][_0xd44c('0x6c')]()){var _0x290d39=util[_0xd44c('0x6d')](_0xd44c('0x6e'),_0x4dbe52);if(_0x4dbe52===0x1){_0x290d39='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xd44c('0x66'))]['ValidationError'](_0x290d39);}}return;};exports[_0xd44c('0x6f')]=function(_0x1722f8,_0x243163){var _0x2ca265=_0x243163?encryptor[_0xd44c('0x6a')](_0x243163)[_0xd44c('0x6b')](','):[];if(_0x2ca265[_0xd44c('0x70')]===0x5){_0x2ca265[_0xd44c('0x71')](-0x1,0x1);}_0x2ca265[_0xd44c('0x72')](_0x1722f8);return encryptor[_0xd44c('0x73')](_0x2ca265[_0xd44c('0x74')](','));};function signJwt(_0x4b9952){var _0x2b8d25=BPromise[_0xd44c('0x75')](jwt[_0xd44c('0x76')],{'context':jwt});var _0x352ed0=_0x4b9952[_0xd44c('0x77')]||config[_0xd44c('0xc')]['session'];return new BPromise(function(_0x2739c5,_0x17547a){_0x2b8d25(_0x4b9952['payload'],_0x352ed0,_0x4b9952[_0xd44c('0x78')])[_0xd44c('0x34')](function(_0x4c11ee){_0x2739c5(_0x4c11ee);})[_0xd44c('0x3a')](function(_0x31a969){_0x17547a(_0x31a969);});});}function verifyJwt(_0x4d0af8,_0x4b21d6,_0x41d43c){var _0x25c532=BPromise[_0xd44c('0x75')](jwt[_0xd44c('0x79')],{'context':jwt});var _0x552936=_0x41d43c||config[_0xd44c('0xc')][_0xd44c('0x7a')];return new BPromise(function(_0x79e5bd,_0xbeaebc){_0x25c532(_0x4d0af8,_0x552936,_0x4b21d6)['then'](function(_0x1690de){_0x79e5bd(_0x1690de);})[_0xd44c('0x3a')](function(_0x113b0e){_0xbeaebc(_0x113b0e);});});}function generateNonce(){return crypto[_0xd44c('0x7b')](0x10)['toString'](_0xd44c('0x7c'));}function generateIssuedAt(){return Math['floor'](Date[_0xd44c('0x7d')]()/0x3e8)[_0xd44c('0x7e')]();}function createJwt(_0x5a9144){var _0x40e745={'payload':{'iat':_0x5a9144[_0xd44c('0x60')],'nonce':_0x5a9144[_0xd44c('0x4d')]},'options':{'algorithm':_0xd44c('0x7f'),'subject':_0x5a9144['id']['toString'](),'issuer':hardwareConf[_0xd44c('0x47')](),'audience':hardwareConf[_0xd44c('0x47')]()}};return signJwt(_0x40e745)[_0xd44c('0x34')](function(_0x5284ad){return{'iat':_0x5a9144[_0xd44c('0x60')],'nonce':_0x5a9144[_0xd44c('0x4d')],'token':_0x5284ad};});} \ No newline at end of file +var _0x1a04=['session','role','fullname','name','internal','userpic','permissions','md5secret','mailPause','smsPause','openchannelPause','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','ChatInteraction','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','use','authorization','startsWith','headers','Basic','find','authenticate','pass','Wrong\x20credentials.','user','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','findOne','allowedLoginAttempts','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','minutes','User\x20object\x20not\x20found.','getLicense','Forbidden','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','generateApiKey','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','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.','Sequelize','updatePasswordsHistory','decryptString','length','splice','unshift','encryptString','promisify','sign','secret','options','toString','floor','now','HS512','../../mysqldb','../encryptor','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets'];(function(_0x180807,_0x10b19c){var _0x26fc79=function(_0x166418){while(--_0x166418){_0x180807['push'](_0x180807['shift']());}};_0x26fc79(++_0x10b19c);}(_0x1a04,0xdf));var _0x41a0=function(_0x31ddf7,_0x4a7230){_0x31ddf7=_0x31ddf7-0x0;var _0x55a3d9=_0x1a04[_0x31ddf7];return _0x55a3d9;};'use strict';var db=require(_0x41a0('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require(_0x41a0('0x1'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0x41a0('0x2'));var compose=require(_0x41a0('0x3'));var basicAuth=require(_0x41a0('0x4'));var crypto=require(_0x41a0('0x5'));var BPromise=require(_0x41a0('0x6'));var util=require('util');var moment=require(_0x41a0('0x7'));var validateJwt=expressJwt({'secret':config[_0x41a0('0x8')][_0x41a0('0x9')]});var userAttributes=['id',_0x41a0('0xa'),_0x41a0('0xb'),_0x41a0('0xc'),_0x41a0('0xd'),'email',_0x41a0('0xe'),_0x41a0('0xf'),_0x41a0('0x10'),'voicePause','chatPause',_0x41a0('0x11'),'faxPause',_0x41a0('0x12'),_0x41a0('0x13'),'pauseType','showWebBar','lastLoginAt',_0x41a0('0x14'),_0x41a0('0x15'),_0x41a0('0x16'),'passwordResetAt','alias',_0x41a0('0x17'),'phoneBarAutoAnswerDelay',_0x41a0('0x18'),'phoneBarEnableRecording',_0x41a0('0x19'),_0x41a0('0x1a'),_0x41a0('0x1b'),_0x41a0('0x1c'),'phoneBarRemoteControl',_0x41a0('0x1d'),_0x41a0('0x1e'),_0x41a0('0x1f'),_0x41a0('0x20'),_0x41a0('0x21'),_0x41a0('0x22'),_0x41a0('0x23'),_0x41a0('0x24'),'downloadOmnichannelInteractions',_0x41a0('0x25')];exports[_0x41a0('0x26')]=function(){return this[_0x41a0('0x27')](!![])['use'](function(_0x58bf3f,_0x2f2b05,_0xdf05fb){if(_0x58bf3f['user']){_0xdf05fb();}else{return db[_0x41a0('0x28')]['findOne']({'where':{'id':_0x58bf3f[_0x41a0('0x29')]['id']},'attributes':['id',_0x41a0('0x2a'),_0x41a0('0x2b')],'raw':!![]})[_0x41a0('0x2c')](function(_0x1481ae){if(_0x1481ae&&_0x1481ae['closed']){return _0x2f2b05[_0x41a0('0x2d')](_0x1481ae['disposition']===_0x41a0('0x2e')?0x195:0x193)[_0x41a0('0x2f')]({'message':_0x1481ae[_0x41a0('0x2b')]==='unmanaged'?_0x41a0('0x30'):_0x41a0('0x31')});}else{_0xdf05fb();}})['catch'](function(_0x562c36){_0xdf05fb(_0x562c36);});}});};exports['isAuthenticated']=function isAuthenticated(_0x1e27c9){return compose()[_0x41a0('0x32')](function(_0x3f1f1e,_0x7fc1a0,_0x55bcc8){var _0x3d05ea;if(_0x3f1f1e['headers'][_0x41a0('0x33')]){if(_[_0x41a0('0x34')](_0x3f1f1e[_0x41a0('0x35')][_0x41a0('0x33')],_0x41a0('0x36'))){var _0x1d30b8=basicAuth(_0x3f1f1e);db['User'][_0x41a0('0x37')]({'where':{'name':_0x1d30b8[_0x41a0('0xc')]}})[_0x41a0('0x2c')](function(_0x5f4938){if(!_0x5f4938||!_0x5f4938[_0x41a0('0x38')](_0x1d30b8[_0x41a0('0x39')])){return _0x7fc1a0['status'](0x191)[_0x41a0('0x2f')]({'message':_0x41a0('0x3a')});}_0x3f1f1e[_0x41a0('0x3b')]={'id':_0x5f4938['id']};_0x55bcc8();})[_0x41a0('0x3c')](function(_0x4595c0){_0x55bcc8(_0x4595c0);});}else if(_['startsWith'](_0x3f1f1e[_0x41a0('0x35')][_0x41a0('0x33')],_0x41a0('0x3d'))){validateJwt(_0x3f1f1e,_0x7fc1a0,_0x55bcc8);}else{if(_0x1e27c9){_0x55bcc8();}else{return _0x7fc1a0[_0x41a0('0x2d')](0x193)['json']({'message':_0x41a0('0x3e')});}}}else if(_0x3f1f1e[_0x41a0('0x3f')][_0x41a0('0x40')]){try{var _0x59307d={'audience':hardwareConf[_0x41a0('0x41')](),'issuer':hardwareConf[_0x41a0('0x41')]()};verifyJwt(_0x3f1f1e[_0x41a0('0x3f')][_0x41a0('0x40')],_0x59307d)[_0x41a0('0x2c')](function(_0x2e8735){return db[_0x41a0('0x42')][_0x41a0('0x37')]({'where':{'id':_0x2e8735['sub']}})['then'](function(_0x19ae3a){_0x3d05ea=_0x19ae3a;return db['Setting'][_0x41a0('0x43')]({'where':{'id':0x1},'attributes':[_0x41a0('0x44'),'blockDuration'],'raw':!![]});})[_0x41a0('0x2c')](function(_0x23dfa0){if(!_0x3d05ea||!_['isEqual'](_0x3d05ea[_0x41a0('0x45')],_0x2e8735[_0x41a0('0x46')])){return _0x7fc1a0['status'](0x191)[_0x41a0('0x2f')]({'message':_0x41a0('0x47')});}if(_0x3d05ea[_0x41a0('0x48')]){return _0x7fc1a0['status'](0x191)[_0x41a0('0x2f')]({'message':_0x41a0('0x49')});}if(_0x3d05ea[_0x41a0('0x4a')]){if(_0x23dfa0[_0x41a0('0x4b')]>0x0){if(moment(_0x3d05ea[_0x41a0('0x4c')])['add'](_0x23dfa0['blockDuration'],_0x41a0('0x4d'))>moment()){return _0x7fc1a0[_0x41a0('0x2d')](0x191)[_0x41a0('0x2f')]({'message':_0x41a0('0x49')});}}else{return _0x7fc1a0[_0x41a0('0x2d')](0x191)[_0x41a0('0x2f')]({'message':_0x41a0('0x49')});}}_0x3f1f1e[_0x41a0('0x3b')]={'id':_0x3d05ea['id']};_0x55bcc8();});})[_0x41a0('0x3c')](function(){return _0x7fc1a0[_0x41a0('0x2d')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x3571b0){_0x55bcc8(_0x3571b0);}}else if(_0x1e27c9){_0x55bcc8();}else{return _0x7fc1a0[_0x41a0('0x2d')](0x193)[_0x41a0('0x2f')]({'message':'Unknown\x20authorization\x20format'});}})[_0x41a0('0x32')](function(_0x1a66f2,_0x1dc1b1,_0x2b76bd){if(_0x1a66f2[_0x41a0('0x3b')]){db[_0x41a0('0x42')][_0x41a0('0x37')]({'where':{'id':_0x1a66f2['user']['id']},'attributes':userAttributes})[_0x41a0('0x2c')](function(_0xc0dda7){if(!_0xc0dda7){return _0x1dc1b1[_0x41a0('0x2d')](0x194)[_0x41a0('0x2f')]({'message':'User\x20not\x20found.'});}_0x1a66f2[_0x41a0('0x3b')]=_0xc0dda7;_0x2b76bd();})[_0x41a0('0x3c')](function(_0xce565a){_0x2b76bd(_0xce565a);});}else if(_0x1e27c9){_0x2b76bd();}else{return _0x1dc1b1[_0x41a0('0x2d')](0x194)['json']({'message':_0x41a0('0x4e')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x41a0('0x32')](function(_0x56989a,_0xfab894,_0x14983d){return licenseUtil[_0x41a0('0x4f')]()[_0x41a0('0x2c')](function(_0x399ab7){if(_0x399ab7['update']){_0x14983d();}else{return _0xfab894[_0x41a0('0x2d')](0x193)[_0x41a0('0x2f')]({'message':_0x41a0('0x50')});}})[_0x41a0('0x3c')](function(_0x2f0ddf){_0x14983d(_0x2f0ddf);});});};exports['isMiddleware']=function(_0x36bc26,_0x3ba571,_0x6baef6){_0x36bc26['isMiddleware']=!![];return _0x6baef6();};exports[_0x41a0('0x51')]=function signToken(_0x1fd844){return signJwt(_0x1fd844);};exports[_0x41a0('0x52')]=function(_0x273aef,_0x1b1d74){if(!_0x273aef[_0x41a0('0x3b')]){return _0x1b1d74['status'](0x194)[_0x41a0('0x2f')]({'message':_0x41a0('0x53')});}var _0x3292ef={'payload':{'id':_0x273aef[_0x41a0('0x3b')]['id'],'role':_0x273aef['user'][_0x41a0('0xa')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3292ef)[_0x41a0('0x2c')](function(_0x24cf83){_0x1b1d74[_0x41a0('0x54')](_0x41a0('0x55'),_0x24cf83);_0x1b1d74[_0x41a0('0x56')](_0x41a0('0x57'));})['catch'](function(_0x4031b0){return _0x1b1d74[_0x41a0('0x2d')](0x1f4)['send'](_0x4031b0);});};exports['retrieveApiKey']=function(_0x4f256a){if(_['isNil'](_0x4f256a[_0x41a0('0x45')])||_['isNil'](_0x4f256a['apiKeyIat'])){return null;}else{return createJwt(_0x4f256a);}};exports[_0x41a0('0x58')]=function(_0x92795){_0x92795[_0x41a0('0x45')]=generateNonce();_0x92795[_0x41a0('0x59')]=generateIssuedAt();return createJwt(_0x92795);};exports['regenerateApiKey']=function(_0xbd896c,_0x2579ed){var _0x2c0b5a=_0xbd896c[_0x41a0('0x3f')][_0x41a0('0x40')];if(_0x2c0b5a){var _0x847151={'nonce':_0x2579ed[_0x41a0('0x45')],'iat':_0x2579ed['apiKeyIat'],'audience':hardwareConf[_0x41a0('0x41')](),'issuer':hardwareConf[_0x41a0('0x41')]()};return verifyJwt(_0x2c0b5a,_0x847151)[_0x41a0('0x2c')](function(){return generateApiKey(_0x2579ed);});}else{throw{'message':_0x41a0('0x5a')};}};exports[_0x41a0('0x5b')]=function(_0x166fe2){var _0x5d1679=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5d1679[_0x41a0('0x5c')](_0x166fe2))throw new db['Sequelize'][(_0x41a0('0x5d'))](_0x41a0('0x5e'));return;};exports[_0x41a0('0x5f')]=function(_0x55013e,_0x44cc4e,_0x4bc2c5){var _0x3ad000=encryptor['decryptString'](_0x44cc4e)[_0x41a0('0x60')](',');for(var _0x33b2da=0x0;_0x33b2da<_0x4bc2c5;_0x33b2da++){if(!_0x3ad000[_0x33b2da])break;if(_0x55013e[_0x41a0('0x61')]()===_0x3ad000[_0x33b2da][_0x41a0('0x61')]()){var _0x1ad227=util[_0x41a0('0x62')](_0x41a0('0x63'),_0x4bc2c5);if(_0x4bc2c5===0x1){_0x1ad227=_0x41a0('0x64');}throw new db[(_0x41a0('0x65'))][(_0x41a0('0x5d'))](_0x1ad227);}}return;};exports[_0x41a0('0x66')]=function(_0x38c5fc,_0x4be981){var _0x53cdc6=_0x4be981?encryptor[_0x41a0('0x67')](_0x4be981)['split'](','):[];if(_0x53cdc6[_0x41a0('0x68')]===0x5){_0x53cdc6[_0x41a0('0x69')](-0x1,0x1);}_0x53cdc6[_0x41a0('0x6a')](_0x38c5fc);return encryptor[_0x41a0('0x6b')](_0x53cdc6['join'](','));};function signJwt(_0x1ffab5){var _0x1a1f78=BPromise[_0x41a0('0x6c')](jwt[_0x41a0('0x6d')],{'context':jwt});var _0x3d79ad=_0x1ffab5[_0x41a0('0x6e')]||config['secrets'][_0x41a0('0x9')];return new BPromise(function(_0x56156f,_0x6f5d81){_0x1a1f78(_0x1ffab5['payload'],_0x3d79ad,_0x1ffab5[_0x41a0('0x6f')])[_0x41a0('0x2c')](function(_0x5e0d0b){_0x56156f(_0x5e0d0b);})[_0x41a0('0x3c')](function(_0x2403c8){_0x6f5d81(_0x2403c8);});});}function verifyJwt(_0x1d21b5,_0x51db85,_0x2b8070){var _0x44e70e=BPromise[_0x41a0('0x6c')](jwt['verify'],{'context':jwt});var _0x252085=_0x2b8070||config[_0x41a0('0x8')][_0x41a0('0x9')];return new BPromise(function(_0x4b3c67,_0x429a58){_0x44e70e(_0x1d21b5,_0x252085,_0x51db85)[_0x41a0('0x2c')](function(_0x155bf2){_0x4b3c67(_0x155bf2);})['catch'](function(_0xa61b71){_0x429a58(_0xa61b71);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x41a0('0x70')]('hex');}function generateIssuedAt(){return Math[_0x41a0('0x71')](Date[_0x41a0('0x72')]()/0x3e8)[_0x41a0('0x70')]();}function createJwt(_0x246a9a){var _0x65b1f4={'payload':{'iat':_0x246a9a[_0x41a0('0x59')],'nonce':_0x246a9a['apiKeyNonce']},'options':{'algorithm':_0x41a0('0x73'),'subject':_0x246a9a['id'][_0x41a0('0x70')](),'issuer':hardwareConf[_0x41a0('0x41')](),'audience':hardwareConf[_0x41a0('0x41')]()}};return signJwt(_0x65b1f4)['then'](function(_0x4cdf10){return{'iat':_0x246a9a[_0x41a0('0x59')],'nonce':_0x246a9a[_0x41a0('0x45')],'token':_0x4cdf10};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index e3fd696..70c4ca5 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 _0x8e81=['crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','binary','end','final','close','unlink','decryptFile','write','secret','utf8','base64','decryptString','createDecipher','update'];(function(_0x1bee8d,_0x457977){var _0x30ac2a=function(_0x22cee4){while(--_0x22cee4){_0x1bee8d['push'](_0x1bee8d['shift']());}};_0x30ac2a(++_0x457977);}(_0x8e81,0x1ba));var _0x18e8=function(_0x37fdb3,_0x815d3){_0x37fdb3=_0x37fdb3-0x0;var _0x5e1240=_0x8e81[_0x37fdb3];return _0x5e1240;};'use strict';var crypto=require(_0x18e8('0x0'));var fs=require('fs');var BPromise=require(_0x18e8('0x1'));var _=require(_0x18e8('0x2'));var config=require(_0x18e8('0x3'));var logger=require(_0x18e8('0x4'))(_0x18e8('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x18e8('0x6')][_0x18e8('0x7')],'algorithm':_0x18e8('0x8')};const fileOptions={'algorithm':'aes192'};if(config[_0x18e8('0x9')]&&config[_0x18e8('0x9')][_0x18e8('0xa')]){var isSupported=isAlgorithmSupported(config[_0x18e8('0x9')][_0x18e8('0xa')]);if(isSupported){fileOptions[_0x18e8('0xa')]=config['encrypt'][_0x18e8('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x18e8('0xb')](config[_0x18e8('0x9')][_0x18e8('0xa')],_0x18e8('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x199840){return AES_SUPPORTED_RX['test'](_0x199840);}function getSupportedCiphers(){return crypto[_0x18e8('0xd')]()[_0x18e8('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x41aa91){return getSupportedCiphers()[_0x18e8('0xf')](_0x41aa91)>-0x1;}function combineOptions(_0x4a4d59){var _0x2ebb03={};for(var _0x8aa85b in fileOptions){if(fileOptions[_0x18e8('0x10')](_0x8aa85b)){_0x2ebb03[_0x8aa85b]=fileOptions[_0x8aa85b];}}if(_0x4a4d59){for(var _0x533898 in _0x4a4d59){if(_0x4a4d59[_0x18e8('0x10')](_0x533898)){_0x2ebb03[_0x533898]=_0x4a4d59[_0x533898];}}}return _0x2ebb03;}exports[_0x18e8('0x11')]=function(_0x3d05cf,_0x263a9a,_0x19e1ee,_0x402324){return new BPromise(function(_0x3f256c,_0x59e02e){_0x402324=combineOptions(_0x402324);var _0x4f17c6=new Buffer(_0x19e1ee);var _0x222fc6=fs[_0x18e8('0x12')](_0x3d05cf);var _0x1ca540=fs[_0x18e8('0x13')](_0x263a9a);var _0x6dde0c=crypto[_0x18e8('0x14')](_0x402324['algorithm'],_0x4f17c6);_0x222fc6['on']('data',function(_0x53e540){var _0x168129=new Buffer(_0x6dde0c['update'](_0x53e540),_0x18e8('0x15'));_0x1ca540['write'](_0x168129);});_0x222fc6['on'](_0x18e8('0x16'),function(){try{var _0xacae6b=new Buffer(_0x6dde0c[_0x18e8('0x17')](_0x18e8('0x15')),_0x18e8('0x15'));_0x1ca540['write'](_0xacae6b);_0x1ca540[_0x18e8('0x16')]();_0x1ca540['on'](_0x18e8('0x18'),function(){return _0x3f256c(_0x263a9a);});}catch(_0x3d6563){fs[_0x18e8('0x19')](_0x263a9a);return _0x59e02e(_0x3d6563);}});});};exports[_0x18e8('0x1a')]=function(_0x5e66ed,_0xaa35ea,_0x1aed9e,_0x73a2f5){return new BPromise(function(_0x40c5e5,_0x27ef5e){_0x73a2f5=combineOptions(_0x73a2f5);var _0x4984f8=new Buffer(_0x1aed9e);var _0x42cad4=fs[_0x18e8('0x12')](_0x5e66ed);var _0x5e52ca=fs['createWriteStream'](_0xaa35ea);var _0x5503b0=crypto['createDecipher'](_0x73a2f5[_0x18e8('0xa')],_0x4984f8);_0x42cad4['on']('data',function(_0x35e208){var _0x2a5297=new Buffer(_0x5503b0['update'](_0x35e208),_0x18e8('0x15'));_0x5e52ca[_0x18e8('0x1b')](_0x2a5297);});_0x42cad4['on'](_0x18e8('0x16'),function(){try{var _0x4e185d=new Buffer(_0x5503b0[_0x18e8('0x17')](_0x18e8('0x15')),_0x18e8('0x15'));_0x5e52ca['write'](_0x4e185d);_0x5e52ca['end']();_0x5e52ca['on']('close',function(){return _0x40c5e5(_0xaa35ea);});}catch(_0x2fd56f){fs[_0x18e8('0x19')](_0xaa35ea);return _0x27ef5e(_0x2fd56f);}});});};exports['encryptString']=function(_0x5b59e9,_0x34e04d,_0x571895){var _0x1d1f9f=_0x571895||stringOptions['algorithm'];var _0x50a97d=_0x34e04d||stringOptions[_0x18e8('0x1c')];var _0x2a5070=crypto[_0x18e8('0x14')](_0x1d1f9f,_0x50a97d);var _0xef24ee=_0x2a5070['update'](_0x5b59e9,_0x18e8('0x1d'),_0x18e8('0x1e'));_0xef24ee+=_0x2a5070[_0x18e8('0x17')](_0x18e8('0x1e'));return _0xef24ee;};exports[_0x18e8('0x1f')]=function(_0x12f7ad,_0x30bcb8,_0x47d426){var _0x5a13fa=_0x47d426||stringOptions[_0x18e8('0xa')];var _0x2ef8ae=_0x30bcb8||stringOptions[_0x18e8('0x1c')];var _0xc8eef4=crypto[_0x18e8('0x20')](_0x5a13fa,_0x2ef8ae);var _0x2e2144=_0xc8eef4[_0x18e8('0x21')](_0x12f7ad,_0x18e8('0x1e'),_0x18e8('0x1d'));_0x2e2144+=_0xc8eef4['final'](_0x18e8('0x1d'));return _0x2e2144;}; \ No newline at end of file +var _0x5d1e=['write','end','final','decryptFile','createDecipher','binary','close','unlink','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','session','aes-256-ctr','aes192','algorithm','encrypt','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update'];(function(_0x5ec2c9,_0xf3346f){var _0xbbad07=function(_0x2d0dae){while(--_0x2d0dae){_0x5ec2c9['push'](_0x5ec2c9['shift']());}};_0xbbad07(++_0xf3346f);}(_0x5d1e,0x148));var _0xe5d1=function(_0x2c5b46,_0x267ef5){_0x2c5b46=_0x2c5b46-0x0;var _0x1401d9=_0x5d1e[_0x2c5b46];return _0x1401d9;};'use strict';var crypto=require(_0xe5d1('0x0'));var fs=require('fs');var BPromise=require(_0xe5d1('0x1'));var _=require(_0xe5d1('0x2'));var config=require(_0xe5d1('0x3'));var logger=require(_0xe5d1('0x4'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0xe5d1('0x5')],'algorithm':_0xe5d1('0x6')};const fileOptions={'algorithm':_0xe5d1('0x7')};if(config['encrypt']&&config['encrypt'][_0xe5d1('0x8')]){var isSupported=isAlgorithmSupported(config[_0xe5d1('0x9')]['algorithm']);if(isSupported){fileOptions['algorithm']=config[_0xe5d1('0x9')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xe5d1('0xa')](',\x20');logger[_0xe5d1('0xb')](config[_0xe5d1('0x9')]['algorithm'],_0xe5d1('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x193f00){return AES_SUPPORTED_RX['test'](_0x193f00);}function getSupportedCiphers(){return crypto[_0xe5d1('0xd')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x13ad3b){return getSupportedCiphers()[_0xe5d1('0xe')](_0x13ad3b)>-0x1;}function combineOptions(_0x415cf7){var _0x21d035={};for(var _0xed8ebc in fileOptions){if(fileOptions[_0xe5d1('0xf')](_0xed8ebc)){_0x21d035[_0xed8ebc]=fileOptions[_0xed8ebc];}}if(_0x415cf7){for(var _0x32910b in _0x415cf7){if(_0x415cf7[_0xe5d1('0xf')](_0x32910b)){_0x21d035[_0x32910b]=_0x415cf7[_0x32910b];}}}return _0x21d035;}exports[_0xe5d1('0x10')]=function(_0x49c513,_0x303c64,_0x4edb4a,_0x56d7f8){return new BPromise(function(_0x1add88,_0x393678){_0x56d7f8=combineOptions(_0x56d7f8);var _0x2a6112=new Buffer(_0x4edb4a);var _0x346bea=fs[_0xe5d1('0x11')](_0x49c513);var _0x17b0a2=fs[_0xe5d1('0x12')](_0x303c64);var _0x269a96=crypto[_0xe5d1('0x13')](_0x56d7f8[_0xe5d1('0x8')],_0x2a6112);_0x346bea['on'](_0xe5d1('0x14'),function(_0x3d173e){var _0x1e8838=new Buffer(_0x269a96[_0xe5d1('0x15')](_0x3d173e),'binary');_0x17b0a2[_0xe5d1('0x16')](_0x1e8838);});_0x346bea['on'](_0xe5d1('0x17'),function(){try{var _0x3612a2=new Buffer(_0x269a96[_0xe5d1('0x18')]('binary'),'binary');_0x17b0a2['write'](_0x3612a2);_0x17b0a2['end']();_0x17b0a2['on']('close',function(){return _0x1add88(_0x303c64);});}catch(_0x424362){fs['unlink'](_0x303c64);return _0x393678(_0x424362);}});});};exports[_0xe5d1('0x19')]=function(_0x5bc729,_0x3668fd,_0x5ecef9,_0x55aff9){return new BPromise(function(_0xd64078,_0x597c1e){_0x55aff9=combineOptions(_0x55aff9);var _0x581d0a=new Buffer(_0x5ecef9);var _0x122004=fs['createReadStream'](_0x5bc729);var _0x296c86=fs[_0xe5d1('0x12')](_0x3668fd);var _0x38bda9=crypto[_0xe5d1('0x1a')](_0x55aff9[_0xe5d1('0x8')],_0x581d0a);_0x122004['on'](_0xe5d1('0x14'),function(_0x2034fa){var _0x35fadf=new Buffer(_0x38bda9[_0xe5d1('0x15')](_0x2034fa),_0xe5d1('0x1b'));_0x296c86[_0xe5d1('0x16')](_0x35fadf);});_0x122004['on'](_0xe5d1('0x17'),function(){try{var _0x54b71a=new Buffer(_0x38bda9['final'](_0xe5d1('0x1b')),_0xe5d1('0x1b'));_0x296c86[_0xe5d1('0x16')](_0x54b71a);_0x296c86[_0xe5d1('0x17')]();_0x296c86['on'](_0xe5d1('0x1c'),function(){return _0xd64078(_0x3668fd);});}catch(_0x53442a){fs[_0xe5d1('0x1d')](_0x3668fd);return _0x597c1e(_0x53442a);}});});};exports[_0xe5d1('0x1e')]=function(_0x59dd74,_0x26d731,_0x125247){var _0x1c3d36=_0x125247||stringOptions[_0xe5d1('0x8')];var _0x596dfb=_0x26d731||stringOptions[_0xe5d1('0x1f')];var _0x2c67bb=crypto[_0xe5d1('0x13')](_0x1c3d36,_0x596dfb);var _0x41917a=_0x2c67bb[_0xe5d1('0x15')](_0x59dd74,_0xe5d1('0x20'),_0xe5d1('0x21'));_0x41917a+=_0x2c67bb[_0xe5d1('0x18')]('base64');return _0x41917a;};exports[_0xe5d1('0x22')]=function(_0x433f4c,_0x44799a,_0x1bb8cd){var _0x20b244=_0x1bb8cd||stringOptions['algorithm'];var _0x20163f=_0x44799a||stringOptions[_0xe5d1('0x1f')];var _0x854f81=crypto['createDecipher'](_0x20b244,_0x20163f);var _0x2020e5=_0x854f81[_0xe5d1('0x15')](_0x433f4c,_0xe5d1('0x21'),_0xe5d1('0x20'));_0x2020e5+=_0x854f81[_0xe5d1('0x18')](_0xe5d1('0x20'));return _0x2020e5;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 07cbc73..b6edffb 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 _0xdc78=['then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','Empty','length','range','num','isInteger','forEach','push','dirname','existsSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','inspect','Failed','finally','exit','util','path','to-csv','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','info','format','CSV','Setting','find','split','splitSizeCsv'];(function(_0x90bdff,_0x4cf8b7){var _0x1519ad=function(_0x1ff907){while(--_0x1ff907){_0x90bdff['push'](_0x90bdff['shift']());}};_0x1519ad(++_0x4cf8b7);}(_0xdc78,0x78));var _0x8dc7=function(_0x1c97c8,_0x28d564){_0x1c97c8=_0x1c97c8-0x0;var _0x2c096d=_0xdc78[_0x1c97c8];return _0x2c096d;};'use strict';var util=require(_0x8dc7('0x0'));var path=require(_0x8dc7('0x1'));var _=require('lodash');var csv=require(_0x8dc7('0x2'));var fs=require('fs');var BPromise=require(_0x8dc7('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x8dc7('0x4'));var db=require(_0x8dc7('0x5'))['db'];var dbH=require('../../mysqldb')[_0x8dc7('0x6')];var logger=require(_0x8dc7('0x7'))(_0x8dc7('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x8dc7('0x9')][0x3];var PATH=process[_0x8dc7('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x34280e,_0x23dc25){var _0x12f7c8={'status':_0x34280e};var _0x1c6546={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x23dc25){_0x12f7c8[_0x8dc7('0xa')]=_0x23dc25;}return db['AnalyticExtractedReport']['update'](_0x12f7c8,_0x1c6546);}function main(){var _0x447d1e=0x1388;var _0xd9303a;logger[_0x8dc7('0xb')](util[_0x8dc7('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x8dc7('0xd')));return db[_0x8dc7('0xe')][_0x8dc7('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8dc7('0x10'),_0x8dc7('0x11')]})[_0x8dc7('0x12')](function(_0x16b84a){if(_0x16b84a){_0xd9303a=_0x16b84a;_0x447d1e=_0xd9303a[_0x8dc7('0x11')]||0x1388;}})[_0x8dc7('0x12')](function(){return dbH['sequelize'][_0x8dc7('0x13')](util[_0x8dc7('0xc')](_0x8dc7('0x14'),QUERY),{'type':dbH[_0x8dc7('0x15')][_0x8dc7('0x16')][_0x8dc7('0x17')]});})[_0x8dc7('0x12')](function(_0x125824){if(!_0x125824[0x0]['num']){return analyticExtractedReport(_0x8dc7('0x18'));}var _0x204385=[];var _0x16ede9=0x0;if(_0xd9303a[_0x8dc7('0x10')]){if(_0x125824&&_0x125824[_0x8dc7('0x19')]){var _0x27611b=_[_0x8dc7('0x1a')](_0x125824[0x0][_0x8dc7('0x1b')]/_0x447d1e);var _0x1fa5bc=Number[_0x8dc7('0x1c')](_0x125824[0x0][_0x8dc7('0x1b')]/_0x447d1e)?_0x125824[0x0][_0x8dc7('0x1b')]%_0x447d1e:0x0;_0x27611b[_0x8dc7('0x1d')](function(_0x45f28d){if(_0x45f28d>0x0){_0x16ede9+=_0x447d1e;}_0x204385[_0x8dc7('0x1e')](dbH[_0x8dc7('0x15')][_0x8dc7('0x13')](util[_0x8dc7('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x447d1e,_0x16ede9),{'type':dbH[_0x8dc7('0x15')][_0x8dc7('0x16')][_0x8dc7('0x17')]}));});if(_0x1fa5bc>0x0){_0x16ede9+=_0x447d1e;_0x204385[_0x8dc7('0x1e')](dbH['sequelize'][_0x8dc7('0x13')](util[_0x8dc7('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1fa5bc,_0x16ede9),{'type':dbH[_0x8dc7('0x15')]['QueryTypes'][_0x8dc7('0x17')]}));}}}else{_0x204385[_0x8dc7('0x1e')](dbH[_0x8dc7('0x15')][_0x8dc7('0x13')](QUERY,{'type':dbH[_0x8dc7('0x15')][_0x8dc7('0x16')][_0x8dc7('0x17')]}));}var _0x33b5b3=path[_0x8dc7('0x1f')](PATH);var _0xed5222=path['basename'](PATH,'.csv');var _0x9da673=_0xd9303a[_0x8dc7('0x10')]&&_0x204385[_0x8dc7('0x19')]>0x1;var _0x769828=[];if(!fs[_0x8dc7('0x20')](path['join'](_0x33b5b3,_0xed5222))&&_0x9da673){fs['mkdirSync'](path[_0x8dc7('0x21')](_0x33b5b3,_0xed5222));}return BPromise[_0x8dc7('0x22')](_0x204385,function(_0x34b913){_0x769828[_0x8dc7('0x1e')](_0x34b913);})[_0x8dc7('0x12')](function(){for(var _0x4a86f5=0x0;_0x4a86f5<_0x769828[_0x8dc7('0x19')];_0x4a86f5+=0x1){var _0x5d7f54;var _0x5afa98=_0x769828[_0x4a86f5];if(_0x9da673){_0x5d7f54=path[_0x8dc7('0x21')](_0x33b5b3,_0xed5222,util[_0x8dc7('0xc')](_0x8dc7('0x23'),_0xed5222,_0x4a86f5,_0x8dc7('0x24')));}else{_0x5d7f54=path['join'](_0x33b5b3,util[_0x8dc7('0xc')](_0x8dc7('0x25'),_0xed5222,'csv'));}fs[_0x8dc7('0x26')](_0x5d7f54,csv(_0x5afa98));}})[_0x8dc7('0x12')](function(){if(_0x9da673){return new Promise(function(_0x4db1e6){zipdir(path[_0x8dc7('0x21')](_0x33b5b3,_0xed5222),{'saveTo':path[_0x8dc7('0x21')](_0x33b5b3,util['format'](_0x8dc7('0x25'),_0xed5222,_0x8dc7('0x27')))},function(_0x404e14,_0x5787ac){rimraf(path[_0x8dc7('0x21')](_0x33b5b3,_0xed5222),function(){});_0x4db1e6(_0x8dc7('0x28'));});});}})['then'](function(){logger[_0x8dc7('0xb')](util[_0x8dc7('0xc')](_0x8dc7('0x29'),EXTRACTED_REPORT_ID,_0x8dc7('0xd')));return analyticExtractedReport('Completed',_0x9da673?util[_0x8dc7('0xc')](_0x8dc7('0x25'),_0xed5222,_0x9da673?_0x8dc7('0x27'):_0x8dc7('0x24')):null);});})['catch'](function(_0xc301af){logger['info'](util[_0x8dc7('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x8dc7('0xd')),util[_0x8dc7('0x2a')](_0xc301af,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8dc7('0x2b'));})[_0x8dc7('0x2c')](function(){process[_0x8dc7('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x501a=['length','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','existsSync','join','each','csv','writeFileSync','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','inspect','Failed','finally','lodash','to-csv','zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','then','splitSizeCsv','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x501a,0x6c));var _0xa501=function(_0xd46333,_0x1b05c1){_0xd46333=_0xd46333-0x0;var _0x336108=_0x501a[_0xd46333];return _0x336108;};'use strict';var util=require('util');var path=require('path');var _=require(_0xa501('0x0'));var csv=require(_0xa501('0x1'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xa501('0x2'));var rimraf=require('rimraf');var db=require(_0xa501('0x3'))['db'];var dbH=require('../../mysqldb')[_0xa501('0x4')];var logger=require(_0xa501('0x5'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xa501('0x6')][0x2]);var QUERY=process[_0xa501('0x6')][0x3];var PATH=process[_0xa501('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xe55ff2,_0x397da2){var _0xd7d5f8={'status':_0xe55ff2};var _0xe3589b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x397da2){_0xd7d5f8[_0xa501('0x7')]=_0x397da2;}return db[_0xa501('0x8')]['update'](_0xd7d5f8,_0xe3589b);}function main(){var _0x284cea=0x1388;var _0x4c7605;logger[_0xa501('0x9')](util[_0xa501('0xa')](_0xa501('0xb'),EXTRACTED_REPORT_ID,_0xa501('0xc')));return db['Setting'][_0xa501('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa501('0xe'),'splitSizeCsv']})[_0xa501('0xf')](function(_0x3daf4a){if(_0x3daf4a){_0x4c7605=_0x3daf4a;_0x284cea=_0x4c7605[_0xa501('0x10')]||0x1388;}})[_0xa501('0xf')](function(){return dbH[_0xa501('0x11')][_0xa501('0x12')](util['format'](_0xa501('0x13'),QUERY),{'type':dbH[_0xa501('0x11')][_0xa501('0x14')][_0xa501('0x15')]});})[_0xa501('0xf')](function(_0x2d3ef7){if(!_0x2d3ef7[0x0][_0xa501('0x16')]){return analyticExtractedReport(_0xa501('0x17'));}var _0x4825b2=[];var _0x2aefaf=0x0;if(_0x4c7605[_0xa501('0xe')]){if(_0x2d3ef7&&_0x2d3ef7[_0xa501('0x18')]){var _0x397488=_['range'](_0x2d3ef7[0x0][_0xa501('0x16')]/_0x284cea);var _0x362f74=Number[_0xa501('0x19')](_0x2d3ef7[0x0][_0xa501('0x16')]/_0x284cea)?_0x2d3ef7[0x0][_0xa501('0x16')]%_0x284cea:0x0;_0x397488[_0xa501('0x1a')](function(_0x4869d7){if(_0x4869d7>0x0){_0x2aefaf+=_0x284cea;}_0x4825b2[_0xa501('0x1b')](dbH['sequelize'][_0xa501('0x12')](util[_0xa501('0xa')](_0xa501('0x1c'),QUERY,_0x284cea,_0x2aefaf),{'type':dbH[_0xa501('0x11')][_0xa501('0x14')][_0xa501('0x15')]}));});if(_0x362f74>0x0){_0x2aefaf+=_0x284cea;_0x4825b2[_0xa501('0x1b')](dbH[_0xa501('0x11')]['query'](util[_0xa501('0xa')](_0xa501('0x1c'),QUERY,_0x362f74,_0x2aefaf),{'type':dbH['sequelize']['QueryTypes'][_0xa501('0x15')]}));}}}else{_0x4825b2[_0xa501('0x1b')](dbH[_0xa501('0x11')]['query'](QUERY,{'type':dbH[_0xa501('0x11')][_0xa501('0x14')][_0xa501('0x15')]}));}var _0x55f2bd=path[_0xa501('0x1d')](PATH);var _0xf127c2=path[_0xa501('0x1e')](PATH,'.csv');var _0x1da059=_0x4c7605['split']&&_0x4825b2['length']>0x1;var _0x872913=[];if(!fs[_0xa501('0x1f')](path['join'](_0x55f2bd,_0xf127c2))&&_0x1da059){fs['mkdirSync'](path[_0xa501('0x20')](_0x55f2bd,_0xf127c2));}return BPromise[_0xa501('0x21')](_0x4825b2,function(_0x236642){_0x872913['push'](_0x236642);})[_0xa501('0xf')](function(){for(var _0x4450de=0x0;_0x4450de<_0x872913[_0xa501('0x18')];_0x4450de+=0x1){var _0x4d9155;var _0x3aa427=_0x872913[_0x4450de];if(_0x1da059){_0x4d9155=path[_0xa501('0x20')](_0x55f2bd,_0xf127c2,util['format']('%s%d.%s',_0xf127c2,_0x4450de,_0xa501('0x22')));}else{_0x4d9155=path['join'](_0x55f2bd,util['format']('%s.%s',_0xf127c2,'csv'));}fs[_0xa501('0x23')](_0x4d9155,csv(_0x3aa427));}})[_0xa501('0xf')](function(){if(_0x1da059){return new Promise(function(_0x1bd3a0){zipdir(path[_0xa501('0x20')](_0x55f2bd,_0xf127c2),{'saveTo':path[_0xa501('0x20')](_0x55f2bd,util[_0xa501('0xa')](_0xa501('0x24'),_0xf127c2,_0xa501('0x25')))},function(_0x12bb3b,_0x2f8896){rimraf(path['join'](_0x55f2bd,_0xf127c2),function(){});_0x1bd3a0(_0xa501('0x26'));});});}})[_0xa501('0xf')](function(){logger[_0xa501('0x9')](util[_0xa501('0xa')](_0xa501('0x27'),EXTRACTED_REPORT_ID,_0xa501('0xc')));return analyticExtractedReport(_0xa501('0x28'),_0x1da059?util[_0xa501('0xa')](_0xa501('0x24'),_0xf127c2,_0x1da059?_0xa501('0x25'):_0xa501('0x22')):null);});})['catch'](function(_0x4559a9){logger[_0xa501('0x9')](util[_0xa501('0xa')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa501('0xc')),util[_0xa501('0x29')](_0x4559a9,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa501('0x2a'));})[_0xa501('0x2b')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 1c39a21..8a0eb5e 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 _0x918e=['pdf','%s.%s','all','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','inspect','Failed','finally','exit','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','center','Interaction\x20Transcript','pipe','createWriteStream','finish','error','end','createPdfFromHTML','createPdfKitDocument','path','util','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','pick','value','fill','auto','push','body','chunk','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','format','length','header','pageBreak','before','margin','toString','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','sequelize','query','SELECT','QueryTypes','dirname','basename','.pdf','existsSync','mkdirSync','join','flatten','%s%d.%s'];(function(_0x4a8935,_0x159d0f){var _0x3516fb=function(_0x31640a){while(--_0x31640a){_0x4a8935['push'](_0x4a8935['shift']());}};_0x3516fb(++_0x159d0f);}(_0x918e,0x1d9));var _0xe918=function(_0x45ee47,_0x361da8){_0x45ee47=_0x45ee47-0x0;var _0x67c3e9=_0x918e[_0x45ee47];return _0x67c3e9;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0xe918('0x0'));var path=require('path');var moment=require(_0xe918('0x1'));var htmlToPdfmake=require(_0xe918('0x2'));var PdfPrinter=require(_0xe918('0x3'));var zipdir=require(_0xe918('0x4'));var rimraf=require(_0xe918('0x5'));var JSDOM=require(_0xe918('0x6'))[_0xe918('0x7')];var window=new JSDOM('')['window'];var BPromise=require(_0xe918('0x8'));var db=require(_0xe918('0x9'))['db'];var dbH=require(_0xe918('0x9'))['dbH'];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xe918('0xa')][0x2]);var QUERY=process[_0xe918('0xa')][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xe918('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5eb72c,_0x4bebfe){var _0x268f1f={'status':_0x5eb72c};var _0x44fa91={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4bebfe){_0x268f1f[_0xe918('0xc')]=_0x4bebfe;}return db[_0xe918('0xd')]['update'](_0x268f1f,_0x44fa91);}function getHeaders(_0x2831f0){return _[_0xe918('0xe')](_0x2831f0,function(_0x2900d7){return{'text':_0x2900d7,'style':_0xe918('0xf')};});}function getRows(_0x3778b5,_0x4aefa2){return _['map'](_0x4aefa2,function(_0x272a5d){return _(_0x272a5d)[_0xe918('0x10')](_0x3778b5)[_0xe918('0xe')](function(_0x466578){return _0x466578?_['toString'](_0x466578):'';})[_0xe918('0x11')]();});}function createTable(_0x6fe83a,_0x1c6978){var _0x51be34={'widths':_[_0xe918('0x12')](Array(_0x6fe83a['length']),0x91),'heights':function(_0x4ffb5b){return _0x4ffb5b===0x0?_0xe918('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x23ec32=getHeaders(_0x6fe83a);_0x51be34['body'][_0xe918('0x14')](_0x23ec32);var _0x584d99=getRows(_0x6fe83a,_0x1c6978);_0x51be34[_0xe918('0x15')]=_0x51be34[_0xe918('0x15')]['concat'](_0x584d99);return _0x51be34;}function createTables(_0x4d6c68){var _0x34e073=[];var _0x2e68ea=_[_0xe918('0x16')](Object[_0xe918('0x17')](_0x4d6c68[0x0]),0x5);_0x2e68ea[_0xe918('0x18')](function(_0x529510){_0x34e073[_0xe918('0x14')](createTable(_0x529510,_0x4d6c68));});return _0x34e073;}function getPDFDocDefinition(_0x1129c9){var _0x3b1834=util['format'](_0xe918('0x19'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xe918('0x1a')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0xe918('0x1b')])[_0xe918('0x1c')](FORMAT));var _0x43d34f=[];for(var _0x4376c5=0x0;_0x4376c5<_0x1129c9[_0xe918('0x1d')];_0x4376c5++){var _0x3c64bf=[];if(_0x4376c5===0x0){_0x3c64bf[_0xe918('0x14')]({'text':_0x3b1834,'style':_0xe918('0x1e')});}var _0x55de85={'table':_0x1129c9[_0x4376c5]};if(_0x4376c5>0x0){_0x55de85[_0xe918('0x1f')]=_0xe918('0x20');_0x55de85[_0xe918('0x21')]=[0x0,0x46,0x0,0x0];}_0x3c64bf['push'](_0x55de85);_0x43d34f[_0xe918('0x14')](_0x3c64bf);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x43d34f,'footer':function(_0x3ce9e4,_0xfc3f9d){return{'text':_0x3ce9e4[_0xe918('0x22')]()+_0xe918('0x23')+_0xfc3f9d,'style':_0xe918('0x24')};},'defaultStyle':{'font':_0xe918('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xe918('0x26')},'footer':{'alignment':_0xe918('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x247581){var _0x44c1d9=0x1388;var _0x3c7b03;if(!_0x247581[0x0][_0xe918('0x28')]){return analyticExtractedReport(_0xe918('0x29'));}return db[_0xe918('0x2a')][_0xe918('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe918('0x2c'),_0xe918('0x2d')]})[_0xe918('0x2e')](function(_0x465301){if(_0x465301){_0x3c7b03=_0x465301;_0x44c1d9=_0x3c7b03[_0xe918('0x2d')]||0x3e8;}})[_0xe918('0x2e')](function(){var _0x4fa2a8=[];var _0x561af3=0x0;if(_0x3c7b03[_0xe918('0x2c')]){if(_0x247581&&_0x247581['length']){var _0xba06e=_[_0xe918('0x2f')](_0x247581[0x0][_0xe918('0x28')]/_0x44c1d9);var _0x5d5c03=Number[_0xe918('0x30')](_0x247581[0x0][_0xe918('0x28')]/_0x44c1d9)?_0x247581[0x0]['num']%_0x44c1d9:0x0;_0xba06e[_0xe918('0x18')](function(_0x1925ca){if(_0x1925ca>0x0){_0x561af3+=_0x44c1d9;}_0x4fa2a8[_0xe918('0x14')](dbH[_0xe918('0x31')][_0xe918('0x32')](util[_0xe918('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x44c1d9,_0x561af3),{'type':dbH[_0xe918('0x31')]['QueryTypes'][_0xe918('0x33')]}));});if(_0x5d5c03>0x0){_0x561af3+=_0x44c1d9;_0x4fa2a8[_0xe918('0x14')](dbH['sequelize']['query'](util[_0xe918('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5d5c03,_0x561af3),{'type':dbH[_0xe918('0x31')][_0xe918('0x34')][_0xe918('0x33')]}));}}}else{_0x4fa2a8[_0xe918('0x14')](dbH[_0xe918('0x31')][_0xe918('0x32')](QUERY,{'type':dbH['sequelize'][_0xe918('0x34')][_0xe918('0x33')]}));}var _0x3b4cd5=path[_0xe918('0x35')](PATH);var _0x5a6a43=path[_0xe918('0x36')](PATH,_0xe918('0x37'));var _0xce689b=_0x3c7b03[_0xe918('0x2c')]&&_0x4fa2a8[_0xe918('0x1d')]>0x1;var _0x288cb4=[];if(!fs[_0xe918('0x38')](path['join'](_0x3b4cd5,_0x5a6a43))&&_0xce689b){fs[_0xe918('0x39')](path[_0xe918('0x3a')](_0x3b4cd5,_0x5a6a43));}return BPromise['each'](_0x4fa2a8,function(_0x52f246){_0x288cb4[_0xe918('0x14')](_0x52f246);})['then'](function(){var _0x359c57=[];for(var _0x392c5c=0x0;_0x392c5c<_0x288cb4[_0xe918('0x1d')];_0x392c5c+=0x1){var _0x29ccdc=_0x288cb4[_0x392c5c];var _0xb3208f=createTables(_[_0xe918('0x3b')](_0x29ccdc));var _0x3fbeca;var _0x3511df=getPDFDocDefinition(_0xb3208f);var _0x266635=getPDFPrinter();var _0x2cd062=_0x266635['createPdfKitDocument'](_0x3511df);if(_0xce689b){_0x3fbeca=path['join'](_0x3b4cd5,_0x5a6a43,util[_0xe918('0x1c')](_0xe918('0x3c'),_0x5a6a43,_0x392c5c,_0xe918('0x3d')));}else{_0x3fbeca=path['join'](_0x3b4cd5,util[_0xe918('0x1c')](_0xe918('0x3e'),_0x5a6a43,_0xe918('0x3d')));}_0x359c57[_0xe918('0x14')](writePDFDocument(_0x2cd062,_0x3fbeca));}return Promise[_0xe918('0x3f')](_0x359c57);})[_0xe918('0x2e')](function(){if(_0xce689b){return new Promise(function(_0x37e68e){zipdir(path[_0xe918('0x3a')](_0x3b4cd5,_0x5a6a43),{'saveTo':path[_0xe918('0x3a')](_0x3b4cd5,util[_0xe918('0x1c')](_0xe918('0x3e'),_0x5a6a43,'zip'))},function(){rimraf(path[_0xe918('0x3a')](_0x3b4cd5,_0x5a6a43),function(){});_0x37e68e(_0xe918('0x40'));});});}})[_0xe918('0x2e')](function(){if(!_0xce689b)return;rimraf(path['join'](_0x3b4cd5,_0x5a6a43),function(){});})[_0xe918('0x2e')](function(){logger[_0xe918('0x41')](util[_0xe918('0x1c')](_0xe918('0x42'),EXTRACTED_REPORT_ID,_0xe918('0x43')));return analyticExtractedReport(_0xe918('0x44'),_0xce689b?util['format'](_0xe918('0x3e'),_0x5a6a43,_0xce689b?'zip':_0xe918('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xe918('0x41')](util['format'](_0xe918('0x45'),EXTRACTED_REPORT_ID,'PDF'));return db[_0xe918('0xd')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xe918('0x2e')](function(_0x3327f8){EXTRACTED_REPORT=_0x3327f8;return dbH[_0xe918('0x31')][_0xe918('0x32')](util[_0xe918('0x1c')](_0xe918('0x46'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xe918('0x33')]});})[_0xe918('0x2e')](extractReport)['catch'](function(_0x36fb1f){logger[_0xe918('0x41')](util[_0xe918('0x1c')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'),util[_0xe918('0x47')](_0x36fb1f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe918('0x48'));})[_0xe918('0x49')](function(){process[_0xe918('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3df2c5=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xe918('0x4b'),'bolditalics':__dirname+_0xe918('0x4c')}});return _0x3df2c5;}function getPDFDocDefinitionFromHTML(_0x5d765d,_0x446ae0){var _0x3e45ae=util[_0xe918('0x1c')]('%s\x20#%d',_0x446ae0[_0xe918('0x4d')],_0x446ae0[_0xe918('0x4e')]);var _0x1e193d=moment()[_0xe918('0x1c')]('YYYY-MM-DD')[_0xe918('0x22')]();var _0x235933=htmlToPdfmake(_0x5d765d,{'window':window,'tableAutoSize':!![]});return{'content':[_0x235933],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xe918('0x4f'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xe918('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xe918('0x4f')}},'header':function(){return[{'text':_0xe918('0x50'),'style':_0xe918('0x1e')}];},'footer':function(_0x555ce9,_0x2117c7){return[{'text':util[_0xe918('0x1c')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x3e45ae,_0x555ce9,_0x2117c7,_0x1e193d),'style':'footer'}];}};}function writePDFDocument(_0x45d5d5,_0x1fd84a){return new Promise(function(_0x321599,_0x1f0bff){var _0x528898=_0x45d5d5[_0xe918('0x51')](fs[_0xe918('0x52')](_0x1fd84a));_0x528898['on'](_0xe918('0x53'),function(){_0x321599(_0xe918('0x53'));});_0x528898['on'](_0xe918('0x54'),function(_0x4cd5c1){_0x1f0bff(_0x4cd5c1);});_0x45d5d5[_0xe918('0x55')]();});}exports[_0xe918('0x56')]=function(_0x24a2d6,_0x5f3d1a){var _0x4a0c8f=getPDFPrinter();var _0x56014f=getPDFDocDefinitionFromHTML(_0x24a2d6,_0x5f3d1a);var _0x11298b=_0x4a0c8f[_0xe918('0x57')](_0x56014f);return writePDFDocument(_0x11298b,_0x5f3d1a[_0xe918('0x58')])['catch'](function(_0x58a134){throw _0x58a134;});}; \ No newline at end of file +var _0xdb99=['map','tableHeader','fill','length','auto','body','push','concat','chunk','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','split','splitSizePdf','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','basename','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','toString','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','end','lodash','path','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','window','bluebird','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xdb99,0x1b7));var _0x9db9=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xdb99[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x9db9('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x9db9('0x1'));var moment=require('moment');var htmlToPdfmake=require(_0x9db9('0x2'));var PdfPrinter=require(_0x9db9('0x3'));var zipdir=require(_0x9db9('0x4'));var rimraf=require(_0x9db9('0x5'));var JSDOM=require(_0x9db9('0x6'))['JSDOM'];var window=new JSDOM('')[_0x9db9('0x7')];var BPromise=require(_0x9db9('0x8'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x9db9('0x9')];var logger=require(_0x9db9('0xa'))(_0x9db9('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0x9db9('0xc')][0x2]);var QUERY=process[_0x9db9('0xc')][0x3];var PATH=process[_0x9db9('0xc')][0x4];var NAME=process['argv'][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2d5ca4,_0x169f9d){var _0x3278bb={'status':_0x2d5ca4};var _0xfd86dc={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x169f9d){_0x3278bb[_0x9db9('0xd')]=_0x169f9d;}return db[_0x9db9('0xe')][_0x9db9('0xf')](_0x3278bb,_0xfd86dc);}function getHeaders(_0x190fda){return _[_0x9db9('0x10')](_0x190fda,function(_0x514a90){return{'text':_0x514a90,'style':_0x9db9('0x11')};});}function getRows(_0x2701ee,_0x1aca54){return _[_0x9db9('0x10')](_0x1aca54,function(_0x48dfb6){return _(_0x48dfb6)['pick'](_0x2701ee)['map'](function(_0x4e4408){return _0x4e4408?_['toString'](_0x4e4408):'';})['value']();});}function createTable(_0x1bc047,_0x32149e){var _0x2de9dd={'widths':_[_0x9db9('0x12')](Array(_0x1bc047[_0x9db9('0x13')]),0x91),'heights':function(_0x24d3e8){return _0x24d3e8===0x0?_0x9db9('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x71b3fd=getHeaders(_0x1bc047);_0x2de9dd[_0x9db9('0x15')][_0x9db9('0x16')](_0x71b3fd);var _0x12316b=getRows(_0x1bc047,_0x32149e);_0x2de9dd[_0x9db9('0x15')]=_0x2de9dd[_0x9db9('0x15')][_0x9db9('0x17')](_0x12316b);return _0x2de9dd;}function createTables(_0x3d9bda){var _0x4cd15b=[];var _0x369659=_[_0x9db9('0x18')](Object['keys'](_0x3d9bda[0x0]),0x5);_0x369659[_0x9db9('0x19')](function(_0x310430){_0x4cd15b[_0x9db9('0x16')](createTable(_0x310430,_0x3d9bda));});return _0x4cd15b;}function getPDFDocDefinition(_0x3d9887){var _0x30a549=util[_0x9db9('0x1a')](_0x9db9('0x1b'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x9db9('0x1c')])[_0x9db9('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0x9db9('0x1d')])['format'](FORMAT));var _0xe945e8=[];for(var _0x5c4402=0x0;_0x5c4402<_0x3d9887[_0x9db9('0x13')];_0x5c4402++){var _0x11392a=[];if(_0x5c4402===0x0){_0x11392a[_0x9db9('0x16')]({'text':_0x30a549,'style':_0x9db9('0x1e')});}var _0x39b0cf={'table':_0x3d9887[_0x5c4402]};if(_0x5c4402>0x0){_0x39b0cf[_0x9db9('0x1f')]=_0x9db9('0x20');_0x39b0cf[_0x9db9('0x21')]=[0x0,0x46,0x0,0x0];}_0x11392a['push'](_0x39b0cf);_0xe945e8[_0x9db9('0x16')](_0x11392a);}return{'pageSize':'A4','pageOrientation':_0x9db9('0x22'),'content':_0xe945e8,'footer':function(_0x980ebf,_0x4f5f75){return{'text':_0x980ebf['toString']()+_0x9db9('0x23')+_0x4f5f75,'style':_0x9db9('0x24')};},'defaultStyle':{'font':_0x9db9('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x9db9('0x26')},'footer':{'alignment':_0x9db9('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3d9ccd){var _0x196673=0x1388;var _0x3ca796;if(!_0x3d9ccd[0x0][_0x9db9('0x28')]){return analyticExtractedReport(_0x9db9('0x29'));}return db[_0x9db9('0x2a')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9db9('0x2b'),_0x9db9('0x2c')]})[_0x9db9('0x2d')](function(_0x4414aa){if(_0x4414aa){_0x3ca796=_0x4414aa;_0x196673=_0x3ca796[_0x9db9('0x2c')]||0x3e8;}})[_0x9db9('0x2d')](function(){var _0x1eeec7=[];var _0x19fa2a=0x0;if(_0x3ca796[_0x9db9('0x2b')]){if(_0x3d9ccd&&_0x3d9ccd['length']){var _0x1759d6=_[_0x9db9('0x2e')](_0x3d9ccd[0x0][_0x9db9('0x28')]/_0x196673);var _0xeb74eb=Number[_0x9db9('0x2f')](_0x3d9ccd[0x0]['num']/_0x196673)?_0x3d9ccd[0x0]['num']%_0x196673:0x0;_0x1759d6[_0x9db9('0x19')](function(_0x3823a7){if(_0x3823a7>0x0){_0x19fa2a+=_0x196673;}_0x1eeec7[_0x9db9('0x16')](dbH[_0x9db9('0x30')][_0x9db9('0x31')](util[_0x9db9('0x1a')](_0x9db9('0x32'),QUERY,_0x196673,_0x19fa2a),{'type':dbH['sequelize'][_0x9db9('0x33')][_0x9db9('0x34')]}));});if(_0xeb74eb>0x0){_0x19fa2a+=_0x196673;_0x1eeec7[_0x9db9('0x16')](dbH['sequelize'][_0x9db9('0x31')](util[_0x9db9('0x1a')](_0x9db9('0x32'),QUERY,_0xeb74eb,_0x19fa2a),{'type':dbH['sequelize'][_0x9db9('0x33')][_0x9db9('0x34')]}));}}}else{_0x1eeec7[_0x9db9('0x16')](dbH['sequelize'][_0x9db9('0x31')](QUERY,{'type':dbH[_0x9db9('0x30')]['QueryTypes']['SELECT']}));}var _0x21bbc5=path['dirname'](PATH);var _0x3c193f=path[_0x9db9('0x35')](PATH,_0x9db9('0x36'));var _0xc3d3e9=_0x3ca796['split']&&_0x1eeec7[_0x9db9('0x13')]>0x1;var _0x2a29af=[];if(!fs[_0x9db9('0x37')](path[_0x9db9('0x38')](_0x21bbc5,_0x3c193f))&&_0xc3d3e9){fs[_0x9db9('0x39')](path[_0x9db9('0x38')](_0x21bbc5,_0x3c193f));}return BPromise[_0x9db9('0x3a')](_0x1eeec7,function(_0x1678af){_0x2a29af[_0x9db9('0x16')](_0x1678af);})[_0x9db9('0x2d')](function(){var _0x107282=[];for(var _0x1c4225=0x0;_0x1c4225<_0x2a29af[_0x9db9('0x13')];_0x1c4225+=0x1){var _0x3bba39=_0x2a29af[_0x1c4225];var _0xf8b05c=createTables(_[_0x9db9('0x3b')](_0x3bba39));var _0x2eb97d;var _0xc29f7e=getPDFDocDefinition(_0xf8b05c);var _0x2ea6cb=getPDFPrinter();var _0x5ba68f=_0x2ea6cb[_0x9db9('0x3c')](_0xc29f7e);if(_0xc3d3e9){_0x2eb97d=path[_0x9db9('0x38')](_0x21bbc5,_0x3c193f,util['format'](_0x9db9('0x3d'),_0x3c193f,_0x1c4225,_0x9db9('0x3e')));}else{_0x2eb97d=path[_0x9db9('0x38')](_0x21bbc5,util[_0x9db9('0x1a')](_0x9db9('0x3f'),_0x3c193f,_0x9db9('0x3e')));}_0x107282[_0x9db9('0x16')](writePDFDocument(_0x5ba68f,_0x2eb97d));}return Promise['all'](_0x107282);})[_0x9db9('0x2d')](function(){if(_0xc3d3e9){return new Promise(function(_0x2c5b16){zipdir(path['join'](_0x21bbc5,_0x3c193f),{'saveTo':path[_0x9db9('0x38')](_0x21bbc5,util[_0x9db9('0x1a')](_0x9db9('0x3f'),_0x3c193f,_0x9db9('0x40')))},function(){rimraf(path[_0x9db9('0x38')](_0x21bbc5,_0x3c193f),function(){});_0x2c5b16(_0x9db9('0x41'));});});}})[_0x9db9('0x2d')](function(){if(!_0xc3d3e9)return;rimraf(path[_0x9db9('0x38')](_0x21bbc5,_0x3c193f),function(){});})[_0x9db9('0x2d')](function(){logger[_0x9db9('0x42')](util['format'](_0x9db9('0x43'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x9db9('0x44'),_0xc3d3e9?util[_0x9db9('0x1a')]('%s.%s',_0x3c193f,_0xc3d3e9?_0x9db9('0x40'):_0x9db9('0x3e')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x9db9('0x42')](util[_0x9db9('0x1a')](_0x9db9('0x45'),EXTRACTED_REPORT_ID,_0x9db9('0x46')));return db[_0x9db9('0xe')][_0x9db9('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x9db9('0x2d')](function(_0x1c4ede){EXTRACTED_REPORT=_0x1c4ede;return dbH['sequelize'][_0x9db9('0x31')](util[_0x9db9('0x1a')](_0x9db9('0x48'),QUERY),{'type':dbH[_0x9db9('0x30')]['QueryTypes'][_0x9db9('0x34')]});})[_0x9db9('0x2d')](extractReport)['catch'](function(_0x25ae97){logger[_0x9db9('0x42')](util[_0x9db9('0x1a')](_0x9db9('0x49'),EXTRACTED_REPORT_ID,'PDF'),util[_0x9db9('0x4a')](_0x25ae97,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x9db9('0x4b')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x7bb71=new PdfPrinter({'Arial':{'normal':__dirname+_0x9db9('0x4c'),'bold':__dirname+_0x9db9('0x4d'),'italics':__dirname+_0x9db9('0x4e'),'bolditalics':__dirname+_0x9db9('0x4f')}});return _0x7bb71;}function getPDFDocDefinitionFromHTML(_0x5a4ff3,_0x5a42ad){var _0x50700b=util[_0x9db9('0x1a')](_0x9db9('0x50'),_0x5a42ad[_0x9db9('0x51')],_0x5a42ad[_0x9db9('0x52')]);var _0x1918d0=moment()['format']('YYYY-MM-DD')[_0x9db9('0x53')]();var _0x2d8902=htmlToPdfmake(_0x5a4ff3,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2d8902],'defaultStyle':{'font':_0x9db9('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x9db9('0x54'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x9db9('0x54')}},'header':function(){return[{'text':_0x9db9('0x55'),'style':'header'}];},'footer':function(_0x279761,_0x1893cd){return[{'text':util[_0x9db9('0x1a')](_0x9db9('0x56'),_0x50700b,_0x279761,_0x1893cd,_0x1918d0),'style':'footer'}];}};}function writePDFDocument(_0x3318f0,_0x107648){return new Promise(function(_0x139743,_0x2edf5e){var _0x443512=_0x3318f0[_0x9db9('0x57')](fs[_0x9db9('0x58')](_0x107648));_0x443512['on'](_0x9db9('0x59'),function(){_0x139743('finish');});_0x443512['on']('error',function(_0x1282d1){_0x2edf5e(_0x1282d1);});_0x3318f0[_0x9db9('0x5a')]();});}exports['createPdfFromHTML']=function(_0x3ff24d,_0x3f8966){var _0xa729b3=getPDFPrinter();var _0x86adba=getPDFDocDefinitionFromHTML(_0x3ff24d,_0x3f8966);var _0x1a0f4c=_0xa729b3[_0x9db9('0x3c')](_0x86adba);return writePDFDocument(_0x1a0f4c,_0x3f8966['path'])['catch'](function(_0x1263b6){throw _0x1263b6;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 5e3c92b..422d723 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 _0xf609=['sequelize','QueryTypes','SELECT','Empty','length','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','mkdirSync','join','each','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','zip\x20finished','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','lodash','json2xls','bluebird','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeXlsx','then','query'];(function(_0x5abe5a,_0x5747c0){var _0x5abba2=function(_0x36c001){while(--_0x36c001){_0x5abe5a['push'](_0x5abe5a['shift']());}};_0x5abba2(++_0x5747c0);}(_0xf609,0x18b));var _0x9f60=function(_0x4e55f4,_0x1e9724){_0x4e55f4=_0x4e55f4-0x0;var _0x40ee3c=_0xf609[_0x4e55f4];return _0x40ee3c;};'use strict';var util=require('util');var path=require(_0x9f60('0x0'));var _=require(_0x9f60('0x1'));var fs=require('fs');var json2xls=require(_0x9f60('0x2'));var BPromise=require(_0x9f60('0x3'));var zipdir=require(_0x9f60('0x4'));var rimraf=require(_0x9f60('0x5'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x9f60('0x6')];var logger=require(_0x9f60('0x7'))(_0x9f60('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x9f60('0x9')][0x2]);var QUERY=process[_0x9f60('0x9')][0x3];var PATH=process[_0x9f60('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x8fb51c,_0x12d850){var _0x169b6c={'status':_0x8fb51c};var _0x21ee61={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x12d850){_0x169b6c[_0x9f60('0xa')]=_0x12d850;}return db[_0x9f60('0xb')]['update'](_0x169b6c,_0x21ee61);}function main(){var _0x73f842=0x1388;var _0x267efc;logger[_0x9f60('0xc')](util[_0x9f60('0xd')](_0x9f60('0xe'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x9f60('0xf')][_0x9f60('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9f60('0x11'),_0x9f60('0x12')]})['then'](function(_0x4de0f8){if(_0x4de0f8){_0x267efc=_0x4de0f8;_0x73f842=_0x267efc['splitSizeXlsx']||0x1388;}})[_0x9f60('0x13')](function(){return dbH['sequelize'][_0x9f60('0x14')](util[_0x9f60('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x9f60('0x15')][_0x9f60('0x16')][_0x9f60('0x17')]});})['then'](function(_0x2e53f6){if(!_0x2e53f6[0x0]['num']){return analyticExtractedReport(_0x9f60('0x18'));}var _0x295513=[];var _0x2f0b26=0x0;if(_0x267efc[_0x9f60('0x11')]){if(_0x2e53f6&&_0x2e53f6[_0x9f60('0x19')]){var _0x52dbdb=_['range'](_0x2e53f6[0x0][_0x9f60('0x1a')]/_0x73f842);var _0x57a14f=Number[_0x9f60('0x1b')](_0x2e53f6[0x0][_0x9f60('0x1a')]/_0x73f842)?_0x2e53f6[0x0][_0x9f60('0x1a')]%_0x73f842:0x0;_0x52dbdb[_0x9f60('0x1c')](function(_0x583cb5){if(_0x583cb5>0x0){_0x2f0b26+=_0x73f842;}_0x295513[_0x9f60('0x1d')](dbH[_0x9f60('0x15')]['query'](util[_0x9f60('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x73f842,_0x2f0b26),{'type':dbH[_0x9f60('0x15')][_0x9f60('0x16')]['SELECT']}));});if(_0x57a14f>0x0){_0x2f0b26+=_0x73f842;_0x295513[_0x9f60('0x1d')](dbH[_0x9f60('0x15')][_0x9f60('0x14')](util['format'](_0x9f60('0x1e'),QUERY,_0x57a14f,_0x2f0b26),{'type':dbH[_0x9f60('0x15')][_0x9f60('0x16')][_0x9f60('0x17')]}));}}}else{_0x295513['push'](dbH[_0x9f60('0x15')][_0x9f60('0x14')](QUERY,{'type':dbH[_0x9f60('0x15')][_0x9f60('0x16')]['SELECT']}));}var _0x27d484=path[_0x9f60('0x1f')](PATH);var _0x579080=path[_0x9f60('0x20')](PATH,_0x9f60('0x21'));var _0x441f1d=_0x267efc[_0x9f60('0x11')]&&_0x295513['length']>0x1;var _0x1674b4=[];if(!fs['existsSync'](path['join'](_0x27d484,_0x579080))&&_0x441f1d){fs[_0x9f60('0x22')](path[_0x9f60('0x23')](_0x27d484,_0x579080));}return BPromise[_0x9f60('0x24')](_0x295513,function(_0x278d5e){_0x1674b4['push'](_0x278d5e);})[_0x9f60('0x13')](function(){for(var _0x4106a3=0x0;_0x4106a3<_0x1674b4['length'];_0x4106a3+=0x1){var _0x46ba35;var _0x27b360=_0x1674b4[_0x4106a3];if(_0x441f1d){_0x46ba35=path[_0x9f60('0x23')](_0x27d484,_0x579080,util[_0x9f60('0xd')](_0x9f60('0x25'),_0x579080,_0x4106a3,_0x9f60('0x26')));}else{_0x46ba35=path[_0x9f60('0x23')](_0x27d484,util[_0x9f60('0xd')]('%s.%s',_0x579080,_0x9f60('0x26')));}fs[_0x9f60('0x27')](_0x46ba35,json2xls(_0x27b360),_0x9f60('0x28'));}})['then'](function(){if(_0x441f1d){return new Promise(function(_0x1a23af){zipdir(path['join'](_0x27d484,_0x579080),{'saveTo':path[_0x9f60('0x23')](_0x27d484,util['format'](_0x9f60('0x29'),_0x579080,_0x9f60('0x2a')))},function(_0x2641f3,_0x1b424b){rimraf(path['join'](_0x27d484,_0x579080),function(){});_0x1a23af(_0x9f60('0x2b'));});});}})[_0x9f60('0x13')](function(){logger[_0x9f60('0xc')](util[_0x9f60('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x9f60('0x2c')));return analyticExtractedReport(_0x9f60('0x2d'),_0x441f1d?util[_0x9f60('0xd')]('%s.%s',_0x579080,_0x441f1d?_0x9f60('0x2a'):_0x9f60('0x26')):null);});})[_0x9f60('0x2e')](function(_0x146acd){logger[_0x9f60('0xc')](util[_0x9f60('0xd')](_0x9f60('0x2f'),EXTRACTED_REPORT_ID,_0x9f60('0x2c')),util[_0x9f60('0x30')](_0x146acd,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9f60('0x31'));})[_0x9f60('0x32')](function(){process[_0x9f60('0x33')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x41d5=['Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','range','num','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','.xlsx','existsSync','join','each','xlsx','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x41d5,0x7e));var _0x541d=function(_0x115b19,_0x237560){_0x115b19=_0x115b19-0x0;var _0x526743=_0x41d5[_0x115b19];return _0x526743;};'use strict';var util=require('util');var path=require('path');var _=require(_0x541d('0x0'));var fs=require('fs');var json2xls=require(_0x541d('0x1'));var BPromise=require(_0x541d('0x2'));var zipdir=require(_0x541d('0x3'));var rimraf=require(_0x541d('0x4'));var db=require(_0x541d('0x5'))['db'];var dbH=require(_0x541d('0x5'))[_0x541d('0x6')];var logger=require(_0x541d('0x7'))(_0x541d('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x541d('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x541d('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x477d5f,_0x29bde5){var _0x3b1105={'status':_0x477d5f};var _0x2f8e2a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x29bde5){_0x3b1105[_0x541d('0xa')]=_0x29bde5;}return db[_0x541d('0xb')][_0x541d('0xc')](_0x3b1105,_0x2f8e2a);}function main(){var _0x43b6ae=0x1388;var _0x115774;logger[_0x541d('0xd')](util[_0x541d('0xe')](_0x541d('0xf'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x541d('0x10')][_0x541d('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x541d('0x12'),'splitSizeXlsx']})[_0x541d('0x13')](function(_0x45e862){if(_0x45e862){_0x115774=_0x45e862;_0x43b6ae=_0x115774['splitSizeXlsx']||0x1388;}})[_0x541d('0x13')](function(){return dbH[_0x541d('0x14')][_0x541d('0x15')](util[_0x541d('0xe')](_0x541d('0x16'),QUERY),{'type':dbH[_0x541d('0x14')][_0x541d('0x17')][_0x541d('0x18')]});})[_0x541d('0x13')](function(_0x1b9e2b){if(!_0x1b9e2b[0x0]['num']){return analyticExtractedReport(_0x541d('0x19'));}var _0x1e05b7=[];var _0x5bca82=0x0;if(_0x115774[_0x541d('0x12')]){if(_0x1b9e2b&&_0x1b9e2b[_0x541d('0x1a')]){var _0x38e4ed=_[_0x541d('0x1b')](_0x1b9e2b[0x0][_0x541d('0x1c')]/_0x43b6ae);var _0x282789=Number['isInteger'](_0x1b9e2b[0x0]['num']/_0x43b6ae)?_0x1b9e2b[0x0][_0x541d('0x1c')]%_0x43b6ae:0x0;_0x38e4ed[_0x541d('0x1d')](function(_0xf536c5){if(_0xf536c5>0x0){_0x5bca82+=_0x43b6ae;}_0x1e05b7[_0x541d('0x1e')](dbH[_0x541d('0x14')][_0x541d('0x15')](util[_0x541d('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x43b6ae,_0x5bca82),{'type':dbH[_0x541d('0x14')][_0x541d('0x17')]['SELECT']}));});if(_0x282789>0x0){_0x5bca82+=_0x43b6ae;_0x1e05b7['push'](dbH[_0x541d('0x14')][_0x541d('0x15')](util[_0x541d('0xe')](_0x541d('0x1f'),QUERY,_0x282789,_0x5bca82),{'type':dbH['sequelize']['QueryTypes'][_0x541d('0x18')]}));}}}else{_0x1e05b7['push'](dbH[_0x541d('0x14')]['query'](QUERY,{'type':dbH[_0x541d('0x14')][_0x541d('0x17')][_0x541d('0x18')]}));}var _0x3c3881=path['dirname'](PATH);var _0x33c471=path['basename'](PATH,_0x541d('0x20'));var _0x16a11e=_0x115774[_0x541d('0x12')]&&_0x1e05b7['length']>0x1;var _0x2d9a7c=[];if(!fs[_0x541d('0x21')](path[_0x541d('0x22')](_0x3c3881,_0x33c471))&&_0x16a11e){fs['mkdirSync'](path[_0x541d('0x22')](_0x3c3881,_0x33c471));}return BPromise[_0x541d('0x23')](_0x1e05b7,function(_0x208c20){_0x2d9a7c[_0x541d('0x1e')](_0x208c20);})[_0x541d('0x13')](function(){for(var _0x266865=0x0;_0x266865<_0x2d9a7c[_0x541d('0x1a')];_0x266865+=0x1){var _0xdd030c;var _0x2edfe6=_0x2d9a7c[_0x266865];if(_0x16a11e){_0xdd030c=path[_0x541d('0x22')](_0x3c3881,_0x33c471,util[_0x541d('0xe')]('%s%d.%s',_0x33c471,_0x266865,_0x541d('0x24')));}else{_0xdd030c=path[_0x541d('0x22')](_0x3c3881,util[_0x541d('0xe')](_0x541d('0x25'),_0x33c471,_0x541d('0x24')));}fs[_0x541d('0x26')](_0xdd030c,json2xls(_0x2edfe6),'binary');}})['then'](function(){if(_0x16a11e){return new Promise(function(_0x1906ce){zipdir(path['join'](_0x3c3881,_0x33c471),{'saveTo':path['join'](_0x3c3881,util['format']('%s.%s',_0x33c471,'zip'))},function(_0x474f3a,_0x5267bb){rimraf(path[_0x541d('0x22')](_0x3c3881,_0x33c471),function(){});_0x1906ce('zip\x20finished');});});}})[_0x541d('0x13')](function(){logger[_0x541d('0xd')](util[_0x541d('0xe')](_0x541d('0x27'),EXTRACTED_REPORT_ID,_0x541d('0x28')));return analyticExtractedReport('Completed',_0x16a11e?util[_0x541d('0xe')](_0x541d('0x25'),_0x33c471,_0x16a11e?_0x541d('0x29'):_0x541d('0x24')):null);});})[_0x541d('0x2a')](function(_0x13b8fa){logger['info'](util['format'](_0x541d('0x2b'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x541d('0x2c')](_0x13b8fa,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x541d('0x2d'));})['finally'](function(){process[_0x541d('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index dc87388..5a62e0c 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 _0x0aa8=['inbound','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','*,*,*,*','interval','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','transaction','destroy','catch','error','rewrite','lodash','models','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','type','Set','context','VoiceExtensionId'];(function(_0x694540,_0x2a89c9){var _0x110c34=function(_0x3697ee){while(--_0x3697ee){_0x694540['push'](_0x694540['shift']());}};_0x110c34(++_0x2a89c9);}(_0x0aa8,0x6b));var _0x80aa=function(_0x5a187b,_0x1f64fe){_0x5a187b=_0x5a187b-0x0;var _0x14d601=_0x0aa8[_0x5a187b];return _0x14d601;};'use strict';var _=require(_0x80aa('0x0'));var util=require('util');function rewrite(_0x4d18d6,_0x4b25ae){var _0x43aeba=this;return _0x4d18d6[_0x80aa('0x1')]['Interval'][_0x80aa('0x2')]({'raw':!![]})[_0x80aa('0x3')](function(_0x16ddbe){_0x43aeba[_0x80aa('0x4')]=_0x16ddbe;return _0x4d18d6[_0x80aa('0x1')][_0x80aa('0x5')][_0x80aa('0x2')]({'where':{'IntervalId':_0x4b25ae[_0x80aa('0x6')]},'raw':!![]});})[_0x80aa('0x3')](function(_0x3b7a48){return _0x4d18d6[_0x80aa('0x1')][_0x80aa('0x5')]['findAll']({'where':{'exten':{'$in':_[_0x80aa('0x7')](_[_0x80aa('0x8')](_0x3b7a48,_0x80aa('0x9')))}},'order':[{'raw':_0x80aa('0xa')}],'raw':!![]});})[_0x80aa('0x3')](function(_0x5ef31a){var _0x1978d0=_[_0x80aa('0xb')](_0x5ef31a,{'priority':'1'});var _0x3a0e97=_[_0x80aa('0xb')](_0x5ef31a,{'isApp':0x1});var _0x30ed69=_[_0x80aa('0xc')](_0x3a0e97,_0x80aa('0x9'));var _0x29fe94=[_0x80aa('0xd'),_0x80aa('0xe')];var _0x1ea2b0=[];var _0x3ddaae=[];for(var _0x10de31 in _0x30ed69){if(_0x30ed69[_0x80aa('0xf')](_0x10de31)){_0x43aeba[_0x80aa('0x10')]=0x2;_0x43aeba[_0x80aa('0x11')]=[];_0x43aeba[_0x80aa('0x12')]=_[_0x80aa('0x13')](_0x1978d0,{'exten':_0x30ed69[_0x10de31][0x0][_0x80aa('0x9')]});_0x43aeba[_0x80aa('0x11')][_0x80aa('0x14')]({'type':_0x30ed69[_0x10de31][0x0][_0x80aa('0x15')],'app':_0x80aa('0x16'),'appdata':util['format']('CDR(type)=%s',_0x30ed69[_0x10de31][0x0]['type']),'context':_0x30ed69[_0x10de31][0x0][_0x80aa('0x17')],'exten':_0x30ed69[_0x10de31][0x0][_0x80aa('0x9')],'priority':_0x43aeba['priority']++,'VoiceExtensionId':_0x30ed69[_0x10de31][0x0][_0x80aa('0x18')]});if(_0x30ed69[_0x10de31][0x0][_0x80aa('0x15')]===_0x80aa('0x19')){_0x43aeba[_0x80aa('0x11')][_0x80aa('0x14')]({'type':_0x30ed69[_0x10de31][0x0][_0x80aa('0x15')],'app':_0x80aa('0x16'),'appdata':_0x80aa('0x1a')+_0x30ed69[_0x10de31][0x0]['VoiceExtensionId'],'context':_0x30ed69[_0x10de31][0x0][_0x80aa('0x17')],'exten':_0x30ed69[_0x10de31][0x0][_0x80aa('0x9')],'priority':_0x43aeba['priority']++,'VoiceExtensionId':_0x30ed69[_0x10de31][0x0][_0x80aa('0x18')]});}else if(_0x30ed69[_0x10de31][0x0]['type']===_0x80aa('0x1b')){if(_0x43aeba[_0x80aa('0x12')]){_0x43aeba[_0x80aa('0x11')][_0x80aa('0x14')]({'type':_0x30ed69[_0x10de31][0x0][_0x80aa('0x15')],'app':'Set','appdata':_0x80aa('0x1c')+(_0x43aeba['extension'][_0x80aa('0x1d')]?'${EXTEN:'+_0x43aeba[_0x80aa('0x12')][_0x80aa('0x1d')]+'}':'${EXTEN}'),'context':_0x30ed69[_0x10de31][0x0][_0x80aa('0x17')],'exten':_0x30ed69[_0x10de31][0x0][_0x80aa('0x9')],'priority':_0x43aeba[_0x80aa('0x10')]++,'VoiceExtensionId':_0x30ed69[_0x10de31][0x0]['VoiceExtensionId']});}_0x43aeba['extensions'][_0x80aa('0x14')]({'type':_0x30ed69[_0x10de31][0x0][_0x80aa('0x15')],'app':_0x80aa('0x16'),'appdata':_0x80aa('0x1a')+_0x30ed69[_0x10de31][0x0][_0x80aa('0x18')],'context':_0x30ed69[_0x10de31][0x0][_0x80aa('0x17')],'exten':_0x30ed69[_0x10de31][0x0][_0x80aa('0x9')],'priority':_0x43aeba[_0x80aa('0x10')]++,'VoiceExtensionId':_0x30ed69[_0x10de31][0x0]['VoiceExtensionId']});var _0x14e446=_0x43aeba['priority']++;_0x43aeba[_0x80aa('0x11')][_0x80aa('0x14')]({'type':_0x30ed69[_0x10de31][0x0][_0x80aa('0x15')],'app':_0x80aa('0x1e'),'appdata':_0x80aa('0x1f')+(_0x14e446+0x2)+_0x80aa('0x20')+(_0x14e446+0x1)+')','context':_0x30ed69[_0x10de31][0x0][_0x80aa('0x17')],'exten':_0x30ed69[_0x10de31][0x0][_0x80aa('0x9')],'priority':_0x14e446,'VoiceExtensionId':_0x30ed69[_0x10de31][0x0][_0x80aa('0x18')]});if(_0x43aeba[_0x80aa('0x12')]){_0x43aeba[_0x80aa('0x11')][_0x80aa('0x14')]({'type':_0x30ed69[_0x10de31][0x0][_0x80aa('0x15')],'app':_0x80aa('0x16'),'appdata':_0x43aeba[_0x80aa('0x12')][_0x80aa('0x1d')]?_0x80aa('0x21')+_0x43aeba[_0x80aa('0x12')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x30ed69[_0x10de31][0x0][_0x80aa('0x17')],'exten':_0x30ed69[_0x10de31][0x0][_0x80aa('0x9')],'priority':_0x43aeba[_0x80aa('0x10')]++,'VoiceExtensionId':_0x30ed69[_0x10de31][0x0][_0x80aa('0x18')]});}_0x43aeba[_0x80aa('0x11')][_0x80aa('0x14')]({'type':_0x30ed69[_0x10de31][0x0][_0x80aa('0x15')],'app':_0x80aa('0x16'),'appdata':_0x80aa('0x22')+_0x30ed69[_0x10de31][0x0][_0x80aa('0x18')],'context':_0x30ed69[_0x10de31][0x0][_0x80aa('0x17')],'exten':_0x30ed69[_0x10de31][0x0][_0x80aa('0x9')],'priority':_0x43aeba[_0x80aa('0x10')]++,'VoiceExtensionId':_0x30ed69[_0x10de31][0x0][_0x80aa('0x18')]});if(_0x43aeba['extension']&&_0x43aeba['extension']['hasOwnProperty'](_0x80aa('0x23'))&&_0x43aeba['extension']['recordingFormat']!==_0x80aa('0x24')){_0x43aeba[_0x80aa('0x11')][_0x80aa('0x14')]({'type':_0x30ed69[_0x10de31][0x0][_0x80aa('0x15')],'app':_0x80aa('0x16'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x30ed69[_0x10de31][0x0]['context'],'exten':_0x30ed69[_0x10de31][0x0]['exten'],'priority':_0x43aeba['priority']++,'VoiceExtensionId':_0x30ed69[_0x10de31][0x0][_0x80aa('0x18')]});_0x43aeba[_0x80aa('0x11')][_0x80aa('0x14')]({'type':_0x30ed69[_0x10de31][0x0][_0x80aa('0x15')],'app':_0x80aa('0x16'),'appdata':_0x80aa('0x25')+_0x43aeba[_0x80aa('0x12')][_0x80aa('0x23')]||'wav','context':_0x30ed69[_0x10de31][0x0]['context'],'exten':_0x30ed69[_0x10de31][0x0][_0x80aa('0x9')],'priority':_0x43aeba[_0x80aa('0x10')]++,'VoiceExtensionId':_0x30ed69[_0x10de31][0x0][_0x80aa('0x18')]});}}_0x43aeba[_0x80aa('0x11')]['push']({'type':_0x30ed69[_0x10de31][0x0][_0x80aa('0x15')],'app':_0x80aa('0x16'),'appdata':_0x80aa('0x26'),'context':_0x30ed69[_0x10de31][0x0][_0x80aa('0x17')],'exten':_0x30ed69[_0x10de31][0x0]['exten'],'priority':_0x43aeba[_0x80aa('0x10')]++,'VoiceExtensionId':_0x30ed69[_0x10de31][0x0]['VoiceExtensionId']});_0x43aeba[_0x80aa('0x11')][_0x80aa('0x14')]({'type':_0x30ed69[_0x10de31][0x0]['type'],'app':'Set','appdata':_0x80aa('0x27'),'context':_0x30ed69[_0x10de31][0x0][_0x80aa('0x17')],'exten':_0x30ed69[_0x10de31][0x0]['exten'],'priority':_0x43aeba[_0x80aa('0x10')]++,'VoiceExtensionId':_0x30ed69[_0x10de31][0x0][_0x80aa('0x18')]});_0x43aeba[_0x80aa('0x11')][_0x80aa('0x14')]({'type':_0x30ed69[_0x10de31][0x0][_0x80aa('0x15')],'app':_0x80aa('0x16'),'appdata':_0x80aa('0x28'),'context':_0x30ed69[_0x10de31][0x0][_0x80aa('0x17')],'exten':_0x30ed69[_0x10de31][0x0][_0x80aa('0x9')],'priority':_0x43aeba[_0x80aa('0x10')]++,'VoiceExtensionId':_0x30ed69[_0x10de31][0x0][_0x80aa('0x18')]});for(var _0x5ef5b0=0x0,_0x296ac5=0x0;_0x5ef5b0<_0x30ed69[_0x10de31][_0x80aa('0x29')];_0x5ef5b0+=0x1,_0x296ac5=0x0){var _0x3787e6=_0x30ed69[_0x10de31][_0x5ef5b0];if(_0x3787e6[_0x80aa('0x15')]){_0x3787e6['type']=_0x3787e6[_0x80aa('0x15')][_0x80aa('0x2a')]();}var _0x229558=[];var _0x26ea29=[];delete _0x3787e6['id'];delete _0x3787e6['createdAt'];delete _0x3787e6[_0x80aa('0x2b')];var _0x2fadef=_0x3787e6['interval']!==_0x80aa('0x2c')?[_0x3787e6[_0x80aa('0x2d')]]:_0x3787e6[_0x80aa('0x6')]?_[_0x80aa('0x8')](_[_0x80aa('0xb')](_0x43aeba[_0x80aa('0x4')],{'IntervalId':_0x3787e6[_0x80aa('0x6')]}),'interval'):[];if(_0x3787e6[_0x80aa('0xf')]('tag')){if(_0x3787e6[_0x80aa('0x2e')]&&_0x3787e6['tag']!=='--'){_0x229558[_0x80aa('0x14')]({'type':_0x3787e6[_0x80aa('0x15')],'app':'Set','appdata':_0x80aa('0x2f')+_0x3787e6['tag'],'context':_0x3787e6[_0x80aa('0x17')],'exten':_0x3787e6[_0x80aa('0x9')],'priority':_0x2fadef['length']+_0x43aeba[_0x80aa('0x10')]+_0x296ac5++,'VoiceExtensionId':_0x3787e6[_0x80aa('0x18')]});}}if(_0x3787e6[_0x80aa('0x15')]===_0x80aa('0x1b')&&_0x3787e6[_0x80aa('0xf')]('callerID')){if(_0x3787e6['callerID']){_0x229558['push']({'type':_0x3787e6[_0x80aa('0x15')],'app':_0x80aa('0x1e'),'appdata':_0x80aa('0x30')+_0x3787e6[_0x80aa('0x31')]+')','context':_0x3787e6[_0x80aa('0x17')],'exten':_0x3787e6[_0x80aa('0x9')],'priority':_0x2fadef[_0x80aa('0x29')]+_0x43aeba[_0x80aa('0x10')]+_0x296ac5++,'VoiceExtensionId':_0x3787e6['VoiceExtensionId']});}else{_0x229558[_0x80aa('0x14')]({'type':_0x3787e6['type'],'app':'ExecIf','appdata':_0x80aa('0x32'),'context':_0x3787e6['context'],'exten':_0x3787e6[_0x80aa('0x9')],'priority':_0x2fadef[_0x80aa('0x29')]+_0x43aeba[_0x80aa('0x10')]+_0x296ac5++,'VoiceExtensionId':_0x3787e6[_0x80aa('0x18')]});}}if(_0x3787e6[_0x80aa('0xf')](_0x80aa('0x33'))){if(_0x29fe94[_0x80aa('0x34')](_0x3787e6['app']['toLowerCase']())>=0x0&&_0x3787e6['appType']!==_0x80aa('0x35')){if(_0x3787e6[_0x80aa('0x33')]){_0x229558[_0x80aa('0x14')]({'type':_0x3787e6[_0x80aa('0x15')],'app':_0x80aa('0x1e'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x3787e6['context'],'exten':_0x3787e6[_0x80aa('0x9')],'priority':_0x2fadef[_0x80aa('0x29')]+_0x43aeba['priority']+_0x296ac5++,'VoiceExtensionId':_0x3787e6[_0x80aa('0x18')]});_0x229558[_0x80aa('0x14')]({'type':_0x3787e6['type'],'app':_0x80aa('0x16'),'appdata':_0x80aa('0x36'),'context':_0x3787e6[_0x80aa('0x17')],'exten':_0x3787e6[_0x80aa('0x9')],'priority':_0x2fadef[_0x80aa('0x29')]+_0x43aeba[_0x80aa('0x10')]+_0x296ac5++,'VoiceExtensionId':_0x3787e6[_0x80aa('0x18')]});}else{_0x229558[_0x80aa('0x14')]({'type':_0x3787e6[_0x80aa('0x15')],'app':'ExecIf','appdata':_0x80aa('0x37'),'context':_0x3787e6[_0x80aa('0x17')],'exten':_0x3787e6[_0x80aa('0x9')],'priority':_0x2fadef[_0x80aa('0x29')]+_0x43aeba['priority']+_0x296ac5++,'VoiceExtensionId':_0x3787e6[_0x80aa('0x18')]});_0x229558[_0x80aa('0x14')]({'type':_0x3787e6[_0x80aa('0x15')],'app':'Set','appdata':_0x80aa('0x38'),'context':_0x3787e6[_0x80aa('0x17')],'exten':_0x3787e6[_0x80aa('0x9')],'priority':_0x2fadef[_0x80aa('0x29')]+_0x43aeba['priority']+_0x296ac5++,'VoiceExtensionId':_0x3787e6[_0x80aa('0x18')]});}}}for(var _0x91b75a=0x0;_0x91b75a<_0x2fadef['length'];_0x91b75a+=0x1){var _0x5b932a=_0x43aeba['priority']+_0x2fadef[_0x80aa('0x29')];var _0x235366=_0x91b75a===_0x2fadef[_0x80aa('0x29')]-0x1?_0x43aeba[_0x80aa('0x10')]+_0x229558[_0x80aa('0x29')]+_0x26ea29[_0x80aa('0x29')]+0x2:_0x43aeba[_0x80aa('0x10')]+_0x91b75a+0x1;_0x229558[_0x80aa('0x39')](_0x91b75a,0x0,{'type':_0x3787e6['type'],'app':'GotoIfTime','appdata':_0x2fadef[_0x91b75a]+'?'+_0x3787e6[_0x80aa('0x17')]+',${EXTEN},'+_0x5b932a+':'+_0x3787e6[_0x80aa('0x17')]+_0x80aa('0x3a')+_0x235366,'exten':_0x3787e6[_0x80aa('0x9')],'context':_0x3787e6['context'],'priority':_0x43aeba[_0x80aa('0x10')]+_0x91b75a,'VoiceExtensionId':_0x30ed69[_0x10de31][0x0]['VoiceExtensionId']});}_0x3787e6[_0x80aa('0x10')]=_0x229558[_0x80aa('0x29')]?_[_0x80aa('0x3b')](_0x229558)[_0x80aa('0x10')]+0x1:_0x43aeba[_0x80aa('0x10')];_0x43aeba[_0x80aa('0x10')]=(_0x26ea29[_0x80aa('0x29')]?_['last'](_0x26ea29)[_0x80aa('0x10')]:_0x3787e6['priority'])+0x1;_0x43aeba[_0x80aa('0x11')]=_['concat'](_0x43aeba[_0x80aa('0x11')],_0x229558,[_0x3787e6],_0x26ea29);}_0x43aeba[_0x80aa('0x11')][_0x80aa('0x14')]({'type':_0x30ed69[_0x10de31][0x0][_0x80aa('0x15')],'app':'Hangup','exten':_0x30ed69[_0x10de31][0x0]['exten'],'context':_0x30ed69[_0x10de31][0x0][_0x80aa('0x17')],'priority':_0x43aeba[_0x80aa('0x10')],'VoiceExtensionId':_0x30ed69[_0x10de31][0x0][_0x80aa('0x18')]});_0x1ea2b0[_0x80aa('0x14')](_0x30ed69[_0x10de31][0x0][_0x80aa('0x18')]);_0x3ddaae=_[_0x80aa('0x3c')](_0x3ddaae,_0x43aeba[_0x80aa('0x11')]);}}return _0x4d18d6[_0x80aa('0x3d')](function(_0x456a31){return _0x4d18d6[_0x80aa('0x1')][_0x80aa('0x5')][_0x80aa('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x1ea2b0}},'transaction':_0x456a31})[_0x80aa('0x3')](function(_0x4f1ebf){return _0x4d18d6[_0x80aa('0x1')][_0x80aa('0x5')]['bulkCreate'](_['sortBy'](_0x3ddaae,_0x80aa('0x10')),{'transaction':_0x456a31});});});})[_0x80aa('0x3f')](function(_0x1145df){console[_0x80aa('0x40')](_0x1145df);});}exports[_0x80aa('0x41')]=rewrite; \ No newline at end of file +var _0xfa58=['queue','playback','priority','extensions','extension','find','push','type','Set','context','inbound','CDR(routeid)=','VoiceExtensionId','outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','intervals','tag','CDR(tag)=','callerID','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','error','lodash','util','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten'];(function(_0x2a1b7e,_0x21dafa){var _0x2974d5=function(_0x285100){while(--_0x285100){_0x2a1b7e['push'](_0x2a1b7e['shift']());}};_0x2974d5(++_0x21dafa);}(_0xfa58,0x1cf));var _0x8fa5=function(_0x4dda69,_0x2a0fe4){_0x4dda69=_0x4dda69-0x0;var _0x9014a9=_0xfa58[_0x4dda69];return _0x9014a9;};'use strict';var _=require(_0x8fa5('0x0'));var util=require(_0x8fa5('0x1'));function rewrite(_0x26e3af,_0x4840c7){var _0x4329f7=this;return _0x26e3af[_0x8fa5('0x2')][_0x8fa5('0x3')][_0x8fa5('0x4')]({'raw':!![]})[_0x8fa5('0x5')](function(_0x2fc31f){_0x4329f7['intervals']=_0x2fc31f;return _0x26e3af[_0x8fa5('0x2')][_0x8fa5('0x6')][_0x8fa5('0x4')]({'where':{'IntervalId':_0x4840c7[_0x8fa5('0x7')]},'raw':!![]});})[_0x8fa5('0x5')](function(_0x5c7d54){return _0x26e3af[_0x8fa5('0x2')]['VoiceExtension'][_0x8fa5('0x4')]({'where':{'exten':{'$in':_[_0x8fa5('0x8')](_['map'](_0x5c7d54,'exten'))}},'order':[{'raw':_0x8fa5('0x9')}],'raw':!![]});})[_0x8fa5('0x5')](function(_0xc85aa3){var _0xe5e585=_[_0x8fa5('0xa')](_0xc85aa3,{'priority':'1'});var _0x4fcfb8=_[_0x8fa5('0xa')](_0xc85aa3,{'isApp':0x1});var _0x4ba0f2=_[_0x8fa5('0xb')](_0x4fcfb8,_0x8fa5('0xc'));var _0x164019=[_0x8fa5('0xd'),_0x8fa5('0xe')];var _0x37603d=[];var _0x57192e=[];for(var _0x5f95ce in _0x4ba0f2){if(_0x4ba0f2['hasOwnProperty'](_0x5f95ce)){_0x4329f7[_0x8fa5('0xf')]=0x2;_0x4329f7[_0x8fa5('0x10')]=[];_0x4329f7[_0x8fa5('0x11')]=_[_0x8fa5('0x12')](_0xe5e585,{'exten':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0xc')]});_0x4329f7[_0x8fa5('0x10')][_0x8fa5('0x13')]({'type':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x14')],'app':_0x8fa5('0x15'),'appdata':util['format']('CDR(type)=%s',_0x4ba0f2[_0x5f95ce][0x0]['type']),'context':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x16')],'exten':_0x4ba0f2[_0x5f95ce][0x0]['exten'],'priority':_0x4329f7[_0x8fa5('0xf')]++,'VoiceExtensionId':_0x4ba0f2[_0x5f95ce][0x0]['VoiceExtensionId']});if(_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x14')]===_0x8fa5('0x17')){_0x4329f7[_0x8fa5('0x10')][_0x8fa5('0x13')]({'type':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x14')],'app':'Set','appdata':_0x8fa5('0x18')+_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x19')],'context':_0x4ba0f2[_0x5f95ce][0x0]['context'],'exten':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0xc')],'priority':_0x4329f7[_0x8fa5('0xf')]++,'VoiceExtensionId':_0x4ba0f2[_0x5f95ce][0x0]['VoiceExtensionId']});}else if(_0x4ba0f2[_0x5f95ce][0x0]['type']===_0x8fa5('0x1a')){if(_0x4329f7[_0x8fa5('0x11')]){_0x4329f7['extensions'][_0x8fa5('0x13')]({'type':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x14')],'app':_0x8fa5('0x15'),'appdata':_0x8fa5('0x1b')+(_0x4329f7[_0x8fa5('0x11')]['cutdigits']?_0x8fa5('0x1c')+_0x4329f7[_0x8fa5('0x11')][_0x8fa5('0x1d')]+'}':_0x8fa5('0x1e')),'context':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x16')],'exten':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0xc')],'priority':_0x4329f7[_0x8fa5('0xf')]++,'VoiceExtensionId':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x19')]});}_0x4329f7[_0x8fa5('0x10')][_0x8fa5('0x13')]({'type':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x14')],'app':_0x8fa5('0x15'),'appdata':_0x8fa5('0x18')+_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x19')],'context':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x16')],'exten':_0x4ba0f2[_0x5f95ce][0x0]['exten'],'priority':_0x4329f7[_0x8fa5('0xf')]++,'VoiceExtensionId':_0x4ba0f2[_0x5f95ce][0x0]['VoiceExtensionId']});var _0x2c5c8f=_0x4329f7['priority']++;_0x4329f7[_0x8fa5('0x10')]['push']({'type':_0x4ba0f2[_0x5f95ce][0x0]['type'],'app':_0x8fa5('0x1f'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x2c5c8f+0x2)+_0x8fa5('0x20')+(_0x2c5c8f+0x1)+')','context':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x16')],'exten':_0x4ba0f2[_0x5f95ce][0x0]['exten'],'priority':_0x2c5c8f,'VoiceExtensionId':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x19')]});if(_0x4329f7[_0x8fa5('0x11')]){_0x4329f7[_0x8fa5('0x10')][_0x8fa5('0x13')]({'type':_0x4ba0f2[_0x5f95ce][0x0]['type'],'app':_0x8fa5('0x15'),'appdata':_0x4329f7[_0x8fa5('0x11')][_0x8fa5('0x1d')]?_0x8fa5('0x21')+_0x4329f7[_0x8fa5('0x11')][_0x8fa5('0x1d')]+'}':_0x8fa5('0x22'),'context':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x16')],'exten':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0xc')],'priority':_0x4329f7[_0x8fa5('0xf')]++,'VoiceExtensionId':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x19')]});}_0x4329f7['extensions'][_0x8fa5('0x13')]({'type':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x14')],'app':_0x8fa5('0x15'),'appdata':'outboundrouteid='+_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x19')],'context':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x16')],'exten':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0xc')],'priority':_0x4329f7[_0x8fa5('0xf')]++,'VoiceExtensionId':_0x4ba0f2[_0x5f95ce][0x0]['VoiceExtensionId']});if(_0x4329f7[_0x8fa5('0x11')]&&_0x4329f7[_0x8fa5('0x11')][_0x8fa5('0x23')](_0x8fa5('0x24'))&&_0x4329f7[_0x8fa5('0x11')][_0x8fa5('0x24')]!=='none'){_0x4329f7[_0x8fa5('0x10')][_0x8fa5('0x13')]({'type':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x14')],'app':_0x8fa5('0x15'),'appdata':_0x8fa5('0x25'),'context':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x16')],'exten':_0x4ba0f2[_0x5f95ce][0x0]['exten'],'priority':_0x4329f7[_0x8fa5('0xf')]++,'VoiceExtensionId':_0x4ba0f2[_0x5f95ce][0x0]['VoiceExtensionId']});_0x4329f7['extensions']['push']({'type':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x14')],'app':_0x8fa5('0x15'),'appdata':_0x8fa5('0x26')+_0x4329f7['extension']['recordingFormat']||_0x8fa5('0x27'),'context':_0x4ba0f2[_0x5f95ce][0x0]['context'],'exten':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0xc')],'priority':_0x4329f7[_0x8fa5('0xf')]++,'VoiceExtensionId':_0x4ba0f2[_0x5f95ce][0x0]['VoiceExtensionId']});}}_0x4329f7[_0x8fa5('0x10')][_0x8fa5('0x13')]({'type':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x14')],'app':'Set','appdata':_0x8fa5('0x28'),'context':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x16')],'exten':_0x4ba0f2[_0x5f95ce][0x0]['exten'],'priority':_0x4329f7[_0x8fa5('0xf')]++,'VoiceExtensionId':_0x4ba0f2[_0x5f95ce][0x0]['VoiceExtensionId']});_0x4329f7[_0x8fa5('0x10')][_0x8fa5('0x13')]({'type':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x14')],'app':'Set','appdata':_0x8fa5('0x29'),'context':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x16')],'exten':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0xc')],'priority':_0x4329f7[_0x8fa5('0xf')]++,'VoiceExtensionId':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x19')]});_0x4329f7[_0x8fa5('0x10')]['push']({'type':_0x4ba0f2[_0x5f95ce][0x0]['type'],'app':_0x8fa5('0x15'),'appdata':_0x8fa5('0x2a'),'context':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x16')],'exten':_0x4ba0f2[_0x5f95ce][0x0]['exten'],'priority':_0x4329f7['priority']++,'VoiceExtensionId':_0x4ba0f2[_0x5f95ce][0x0]['VoiceExtensionId']});for(var _0x705bbb=0x0,_0x53033b=0x0;_0x705bbb<_0x4ba0f2[_0x5f95ce]['length'];_0x705bbb+=0x1,_0x53033b=0x0){var _0x2b2052=_0x4ba0f2[_0x5f95ce][_0x705bbb];if(_0x2b2052[_0x8fa5('0x14')]){_0x2b2052[_0x8fa5('0x14')]=_0x2b2052[_0x8fa5('0x14')][_0x8fa5('0x2b')]();}var _0x4070e6=[];var _0x1b8e94=[];delete _0x2b2052['id'];delete _0x2b2052[_0x8fa5('0x2c')];delete _0x2b2052[_0x8fa5('0x2d')];var _0x874ab3=_0x2b2052[_0x8fa5('0x2e')]!=='*,*,*,*'?[_0x2b2052['interval']]:_0x2b2052[_0x8fa5('0x7')]?_['map'](_[_0x8fa5('0xa')](_0x4329f7[_0x8fa5('0x2f')],{'IntervalId':_0x2b2052[_0x8fa5('0x7')]}),_0x8fa5('0x2e')):[];if(_0x2b2052[_0x8fa5('0x23')]('tag')){if(_0x2b2052[_0x8fa5('0x30')]&&_0x2b2052[_0x8fa5('0x30')]!=='--'){_0x4070e6[_0x8fa5('0x13')]({'type':_0x2b2052['type'],'app':_0x8fa5('0x15'),'appdata':_0x8fa5('0x31')+_0x2b2052[_0x8fa5('0x30')],'context':_0x2b2052['context'],'exten':_0x2b2052['exten'],'priority':_0x874ab3['length']+_0x4329f7['priority']+_0x53033b++,'VoiceExtensionId':_0x2b2052[_0x8fa5('0x19')]});}}if(_0x2b2052['type']===_0x8fa5('0x1a')&&_0x2b2052[_0x8fa5('0x23')]('callerID')){if(_0x2b2052['callerID']){_0x4070e6['push']({'type':_0x2b2052[_0x8fa5('0x14')],'app':_0x8fa5('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x2b2052[_0x8fa5('0x32')]+')','context':_0x2b2052[_0x8fa5('0x16')],'exten':_0x2b2052[_0x8fa5('0xc')],'priority':_0x874ab3[_0x8fa5('0x33')]+_0x4329f7[_0x8fa5('0xf')]+_0x53033b++,'VoiceExtensionId':_0x2b2052['VoiceExtensionId']});}else{_0x4070e6[_0x8fa5('0x13')]({'type':_0x2b2052['type'],'app':_0x8fa5('0x1f'),'appdata':_0x8fa5('0x34'),'context':_0x2b2052[_0x8fa5('0x16')],'exten':_0x2b2052[_0x8fa5('0xc')],'priority':_0x874ab3['length']+_0x4329f7[_0x8fa5('0xf')]+_0x53033b++,'VoiceExtensionId':_0x2b2052[_0x8fa5('0x19')]});}}if(_0x2b2052['hasOwnProperty'](_0x8fa5('0x35'))){if(_0x164019[_0x8fa5('0x36')](_0x2b2052['app']['toLowerCase']())>=0x0&&_0x2b2052[_0x8fa5('0x37')]!==_0x8fa5('0x38')){if(_0x2b2052[_0x8fa5('0x35')]){_0x4070e6[_0x8fa5('0x13')]({'type':_0x2b2052['type'],'app':_0x8fa5('0x1f'),'appdata':_0x8fa5('0x39'),'context':_0x2b2052[_0x8fa5('0x16')],'exten':_0x2b2052[_0x8fa5('0xc')],'priority':_0x874ab3['length']+_0x4329f7[_0x8fa5('0xf')]+_0x53033b++,'VoiceExtensionId':_0x2b2052['VoiceExtensionId']});_0x4070e6[_0x8fa5('0x13')]({'type':_0x2b2052[_0x8fa5('0x14')],'app':'Set','appdata':_0x8fa5('0x3a'),'context':_0x2b2052[_0x8fa5('0x16')],'exten':_0x2b2052[_0x8fa5('0xc')],'priority':_0x874ab3[_0x8fa5('0x33')]+_0x4329f7['priority']+_0x53033b++,'VoiceExtensionId':_0x2b2052[_0x8fa5('0x19')]});}else{_0x4070e6[_0x8fa5('0x13')]({'type':_0x2b2052[_0x8fa5('0x14')],'app':_0x8fa5('0x1f'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x2b2052[_0x8fa5('0x16')],'exten':_0x2b2052[_0x8fa5('0xc')],'priority':_0x874ab3[_0x8fa5('0x33')]+_0x4329f7[_0x8fa5('0xf')]+_0x53033b++,'VoiceExtensionId':_0x2b2052['VoiceExtensionId']});_0x4070e6[_0x8fa5('0x13')]({'type':_0x2b2052['type'],'app':_0x8fa5('0x15'),'appdata':_0x8fa5('0x3b'),'context':_0x2b2052[_0x8fa5('0x16')],'exten':_0x2b2052[_0x8fa5('0xc')],'priority':_0x874ab3['length']+_0x4329f7['priority']+_0x53033b++,'VoiceExtensionId':_0x2b2052[_0x8fa5('0x19')]});}}}for(var _0x2c3886=0x0;_0x2c3886<_0x874ab3[_0x8fa5('0x33')];_0x2c3886+=0x1){var _0xeb5782=_0x4329f7['priority']+_0x874ab3[_0x8fa5('0x33')];var _0x453c6c=_0x2c3886===_0x874ab3[_0x8fa5('0x33')]-0x1?_0x4329f7[_0x8fa5('0xf')]+_0x4070e6[_0x8fa5('0x33')]+_0x1b8e94['length']+0x2:_0x4329f7[_0x8fa5('0xf')]+_0x2c3886+0x1;_0x4070e6[_0x8fa5('0x3c')](_0x2c3886,0x0,{'type':_0x2b2052[_0x8fa5('0x14')],'app':_0x8fa5('0x3d'),'appdata':_0x874ab3[_0x2c3886]+'?'+_0x2b2052[_0x8fa5('0x16')]+_0x8fa5('0x3e')+_0xeb5782+':'+_0x2b2052[_0x8fa5('0x16')]+_0x8fa5('0x3e')+_0x453c6c,'exten':_0x2b2052[_0x8fa5('0xc')],'context':_0x2b2052['context'],'priority':_0x4329f7[_0x8fa5('0xf')]+_0x2c3886,'VoiceExtensionId':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x19')]});}_0x2b2052[_0x8fa5('0xf')]=_0x4070e6[_0x8fa5('0x33')]?_[_0x8fa5('0x3f')](_0x4070e6)[_0x8fa5('0xf')]+0x1:_0x4329f7[_0x8fa5('0xf')];_0x4329f7[_0x8fa5('0xf')]=(_0x1b8e94[_0x8fa5('0x33')]?_[_0x8fa5('0x3f')](_0x1b8e94)[_0x8fa5('0xf')]:_0x2b2052['priority'])+0x1;_0x4329f7['extensions']=_[_0x8fa5('0x40')](_0x4329f7[_0x8fa5('0x10')],_0x4070e6,[_0x2b2052],_0x1b8e94);}_0x4329f7[_0x8fa5('0x10')][_0x8fa5('0x13')]({'type':_0x4ba0f2[_0x5f95ce][0x0]['type'],'app':_0x8fa5('0x41'),'exten':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0xc')],'context':_0x4ba0f2[_0x5f95ce][0x0]['context'],'priority':_0x4329f7[_0x8fa5('0xf')],'VoiceExtensionId':_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x19')]});_0x37603d['push'](_0x4ba0f2[_0x5f95ce][0x0][_0x8fa5('0x19')]);_0x57192e=_[_0x8fa5('0x40')](_0x57192e,_0x4329f7[_0x8fa5('0x10')]);}}return _0x26e3af[_0x8fa5('0x42')](function(_0x5269ba){return _0x26e3af[_0x8fa5('0x2')][_0x8fa5('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x37603d}},'transaction':_0x5269ba})[_0x8fa5('0x5')](function(_0x1cbb17){return _0x26e3af[_0x8fa5('0x2')]['VoiceExtension']['bulkCreate'](_['sortBy'](_0x57192e,'priority'),{'transaction':_0x5269ba});});});})['catch'](function(_0x4211fb){console[_0x8fa5('0x43')](_0x4211fb);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 1f38288..7635ed6 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 _0xa24b=['Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','join','data','firstName','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','Duplicate\x20Contact','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','insert','fromQuery','select','field','NOW()','scheduledAt','ContactId','toString','updatedAt','from','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','into','createdAt','deletedAt\x20IS\x20NULL','str','cm_hopper_final','\x20=\x20?','id\x20IN\x20?','VoiceQueue','findAll','outbound','CmList','Lists','dialCheckDuplicateType','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','CampaignId','Campaign','cmContact,\x20%s,\x20%s','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','CmContact','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','../../../api/cmContact/cmContact.socket','undefined','argv'];(function(_0x1ea3b9,_0x3c6b2c){var _0x206d41=function(_0x55ef0c){while(--_0x55ef0c){_0x1ea3b9['push'](_0x1ea3b9['shift']());}};_0x206d41(++_0x3c6b2c);}(_0xa24b,0x130));var _0xba24=function(_0x4a6ed9,_0x201b72){_0x4a6ed9=_0x4a6ed9-0x0;var _0x26ec01=_0xa24b[_0x4a6ed9];return _0x26ec01;};'use strict';var BPromise=require(_0xba24('0x0'));var util=require(_0xba24('0x1'));var _=require(_0xba24('0x2'));var fs=require('fs');var squel=require(_0xba24('0x3'));var Papa=require(_0xba24('0x4'));var Redis=require(_0xba24('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0xba24('0x6'));var logger=require('../../../config/logger')('api');config['redis']=_[_0xba24('0x7')](config['redis'],{'host':_0xba24('0x8'),'port':0x18eb});var socket=require(_0xba24('0x9'))(new Redis(config[_0xba24('0xa')]));require(_0xba24('0xb'))['register'](socket);try{if(!process['argv'][0x2]||process['argv'][0x2]===_0xba24('0xc')||process[_0xba24('0xd')][0x2]==='null'){throw new Error(_0xba24('0xe'));}var FILEPATH=process['argv'][0x2];if(!process[_0xba24('0xd')][0x3]||process[_0xba24('0xd')][0x3]===_0xba24('0xc')||process['argv'][0x3]===_0xba24('0xf')||!process[_0xba24('0xd')][0x4]||process[_0xba24('0xd')][0x4]===_0xba24('0xc')||process['argv'][0x4]==='null'){throw new Error(_0xba24('0x10'));}var FIELDS=_[_0xba24('0x11')](process[_0xba24('0xd')][0x3][_0xba24('0x12')](','),process[_0xba24('0xd')][0x4][_0xba24('0x12')](','));if(!process[_0xba24('0xd')][0x5]||process[_0xba24('0xd')][0x5]===_0xba24('0xc')||process[_0xba24('0xd')][0x5]===_0xba24('0xf')){throw new Error(_0xba24('0x13'));}var LISTID=process[_0xba24('0xd')][0x5];var COMPANYID=process[_0xba24('0xd')][0x6]&&process[_0xba24('0xd')][0x6]!==_0xba24('0xc')&&process[_0xba24('0xd')][0x6]!==_0xba24('0xf')?process[_0xba24('0xd')][0x6]:null;var DUPLICATES=process[_0xba24('0xd')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0xba24('0xd')][0x7]!=='null'?process[_0xba24('0xd')][0x7]:null;if(!process[_0xba24('0xd')][0x8]||process['argv'][0x8]===_0xba24('0xc')||process[_0xba24('0xd')][0x8]==='null'){throw new Error(_0xba24('0x14'));}var SOCKET_TIMESTAMP=process[_0xba24('0xd')][0x8];}catch(_0x5060ab){logger[_0xba24('0x15')](_0x5060ab);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(_0x46fce3,_0x4c96a4,_0xb8b2fc,_0x454be8){var _0x18ffe3={'message':_0x4c96a4};_0x18ffe3[_0x46fce3]=!![];if(_0xb8b2fc){_0x18ffe3['contact']=_0xb8b2fc;}if(_0x454be8){_0x18ffe3[_0xba24('0x16')]=_0x454be8;}return _0x18ffe3;}function isEmail(_0x2297c9){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))*$/[_0xba24('0x17')](_0x2297c9);}function checkRow(_0x4def2a,_0x1af45b,_0x312624){return new BPromise(function(_0x5e4033,_0x5bdd49){if(_[_0xba24('0x18')](_0x4def2a)){return _0x5bdd49(handleCheckRowError(_0xba24('0x15'),_0xba24('0x19'),null,_0x312624));}if(_0x4def2a[_0xba24('0x1a')]&&_0x4def2a[_0xba24('0x1a')]['length']){var _0x3e3c83=_[_0xba24('0x1b')](_0x4def2a['errors'],_0xba24('0x1c'))[_0xba24('0x1d')](';');return _0x5bdd49(handleCheckRowError(_0xba24('0x15'),_0x3e3c83,null,_0x312624));}var _0x14be05={};for(var _0x2c115e in FIELDS){if(FIELDS['hasOwnProperty'](_0x2c115e)&&FIELDS[_0x2c115e]){_0x14be05[_0x2c115e]=_0x4def2a[_0xba24('0x1e')][0x0][FIELDS[_0x2c115e]]||_0x4def2a[_0xba24('0x1e')][0x0]['\ufeff'+FIELDS[_0x2c115e]];}}if(!_0x14be05[_0xba24('0x1f')]){return _0x5bdd49(handleCheckRowError(_0xba24('0x15'),_0xba24('0x20'),null,_0x312624));}if(!_0x14be05[_0xba24('0x21')]){return _0x5bdd49(handleCheckRowError(_0xba24('0x15'),'phone\x20not\x20specified!',null,_0x312624));}if(_0x14be05[_0xba24('0x22')]){var _0x1dc37a=moment(_0x14be05[_0xba24('0x22')],_0xba24('0x23'));if(!_0x1dc37a[_0xba24('0x24')]()){return _0x5bdd49(handleCheckRowError(_0xba24('0x15'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x312624));}}if(_0x14be05[_0xba24('0x25')]){if(!isEmail(_0x14be05[_0xba24('0x25')])){return _0x5bdd49(handleCheckRowError('error',_0xba24('0x26'),null,_0x312624));}}_0x14be05[_0xba24('0x27')]=LISTID;_0x14be05[_0xba24('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xba24('0x29')]&&_0x1af45b){var _0x218373={};for(var _0x5055d7=0x0,_0x1b1106=DUPLICATES[_0xba24('0x29')];_0x5055d7<_0x1b1106;_0x5055d7+=0x1){_0x218373[DUPLICATES[_0x5055d7]]=_0x14be05[DUPLICATES[_0x5055d7]];}var _0x30167a=_[_0xba24('0x2a')](_0x1af45b,_0x218373);if(_0x30167a){return _0x5bdd49(handleCheckRowError('duplicate',_0xba24('0x2b'),_0x30167a,_0x312624));}}return db['CmContact']['create'](_0x14be05,{'raw':!![],'hooks':![],'fields':_['keys'](_0x14be05)})[_0xba24('0x2c')](function(_0x3cabe1){if(DUPLICATES&&DUPLICATES[_0xba24('0x29')]&&_0x1af45b){_0x1af45b[_0xba24('0x2d')](_[_0xba24('0x2e')](_0x14be05,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3cabe1['id'];return _0x5e4033();})[_0xba24('0x2f')](function(_0x2ddad9){return _0x5bdd49(handleCheckRowError('error',_0xba24('0x30')+(_0x2ddad9[_0xba24('0x1c')]||JSON[_0xba24('0x31')](_0x2ddad9)),null,_0x312624));});});}function checkHopper(){function _0x247467(){return function(_0x264892){logger['error'](_0xba24('0x32'),_0xba24('0x33'),util['inspect'](_0x264892,{'showHidden':![],'depth':null}));};}var _0x5305fc=function(_0x113f1e,_0x28daaa){var _0x30f262=squel[_0xba24('0x34')]()['into']('cm_hopper')[_0xba24('0x35')](['phone','scheduledAt','ContactId','ListId',_0x28daaa,'createdAt','updatedAt'],squel[_0xba24('0x36')]()[_0xba24('0x37')]('phone',_0xba24('0x21'))[_0xba24('0x37')](_0xba24('0x38'),_0xba24('0x39'))[_0xba24('0x37')]('id',_0xba24('0x3a'))['field'](LISTID[_0xba24('0x3b')](),'ListId')[_0xba24('0x37')](_0x113f1e['id']['toString'](),_0x28daaa)[_0xba24('0x37')]('NOW()','createdAt')['field']('NOW()',_0xba24('0x3c'))[_0xba24('0x3d')](_0xba24('0x3e'))[_0xba24('0x3f')]('deletedAt\x20IS\x20NULL')['where'](_0xba24('0x40'),LISTID[_0xba24('0x3b')]())[_0xba24('0x3f')](_0xba24('0x41'))['where'](_0xba24('0x42'),squel[_0xba24('0x36')]()[_0xba24('0x37')](_0xba24('0x21'))[_0xba24('0x3d')](_0xba24('0x43'))[_0xba24('0x3f')](_0x28daaa+'\x20=\x20?',_0x113f1e['id'][_0xba24('0x3b')]())))[_0xba24('0x3b')]();return _0x30f262;};var _0x5a33f9=function(_0x3cc308,_0x31af92){var _0x125826=squel[_0xba24('0x34')]()[_0xba24('0x44')](_0xba24('0x43'))[_0xba24('0x35')]([_0xba24('0x21'),_0xba24('0x39'),_0xba24('0x3a'),_0xba24('0x27'),_0x31af92,_0xba24('0x45'),'updatedAt'],squel['select']()[_0xba24('0x37')](_0xba24('0x21'),_0xba24('0x21'))[_0xba24('0x37')](_0xba24('0x38'),'scheduledAt')[_0xba24('0x37')]('id',_0xba24('0x3a'))[_0xba24('0x37')](LISTID[_0xba24('0x3b')](),'ListId')[_0xba24('0x37')](_0x3cc308['id']['toString'](),_0x31af92)[_0xba24('0x37')](_0xba24('0x38'),_0xba24('0x45'))[_0xba24('0x37')](_0xba24('0x38'),_0xba24('0x3c'))[_0xba24('0x3d')](_0xba24('0x3e'))[_0xba24('0x3f')](_0xba24('0x46'))['where']('ListId\x20=\x20?',LISTID[_0xba24('0x3b')]())['where']('id\x20IN\x20?',squel[_0xba24('0x47')](hopperContacts))['where'](_0xba24('0x41'))[_0xba24('0x3f')](_0xba24('0x42'),squel['select']()['field']('calleridnum')[_0xba24('0x3d')](_0xba24('0x48'))[_0xba24('0x3f')](_0x31af92+_0xba24('0x49'),_0x3cc308['id'][_0xba24('0x3b')]()))[_0xba24('0x3f')](_0xba24('0x42'),squel[_0xba24('0x36')]()[_0xba24('0x37')]('phone')[_0xba24('0x3d')](_0xba24('0x43'))['where'](_0x31af92+_0xba24('0x49'),_0x3cc308['id'][_0xba24('0x3b')]())))['toString']();return _0x125826;};function _0x24fc51(_0xf17c29,_0x38155b){var _0x4f6cee=squel[_0xba24('0x34')]()['into']('cm_hopper')['fromQuery']([_0xba24('0x21'),_0xba24('0x39'),_0xba24('0x3a'),_0xba24('0x27'),_0x38155b,_0xba24('0x45'),_0xba24('0x3c')],squel['select']()[_0xba24('0x37')](_0xba24('0x21'),_0xba24('0x21'))[_0xba24('0x37')]('NOW()',_0xba24('0x39'))['field']('id',_0xba24('0x3a'))[_0xba24('0x37')](LISTID[_0xba24('0x3b')](),_0xba24('0x27'))[_0xba24('0x37')](_0xf17c29['id']['toString'](),_0x38155b)[_0xba24('0x37')](_0xba24('0x38'),'createdAt')[_0xba24('0x37')]('NOW()',_0xba24('0x3c'))[_0xba24('0x3d')](_0xba24('0x3e'))[_0xba24('0x3f')]('deletedAt\x20IS\x20NULL')['where'](_0xba24('0x40'),LISTID[_0xba24('0x3b')]())[_0xba24('0x3f')](_0xba24('0x4a'),squel[_0xba24('0x47')](hopperContacts))[_0xba24('0x3f')](_0xba24('0x41')))[_0xba24('0x3b')]();return _0x4f6cee;}function _0x82ce36(_0x3168ba,_0x25ec1f){var _0x278a3f=squel[_0xba24('0x34')]()['into']('cm_hopper_black')['fromQuery']([_0xba24('0x21'),'ContactId',_0xba24('0x27'),_0x25ec1f,_0xba24('0x45'),_0xba24('0x3c')],squel[_0xba24('0x36')]()[_0xba24('0x37')](_0xba24('0x21'),_0xba24('0x21'))[_0xba24('0x37')]('id',_0xba24('0x3a'))[_0xba24('0x37')](LISTID['toString'](),_0xba24('0x27'))[_0xba24('0x37')](_0x3168ba['id'][_0xba24('0x3b')](),_0x25ec1f)[_0xba24('0x37')](_0xba24('0x38'),'createdAt')['field']('NOW()',_0xba24('0x3c'))['from']('cm_contacts')['where'](_0xba24('0x46'))[_0xba24('0x3f')](_0xba24('0x40'),LISTID[_0xba24('0x3b')]())[_0xba24('0x3f')]('id\x20IN\x20?',squel[_0xba24('0x47')](hopperContacts))[_0xba24('0x3f')](_0xba24('0x41')))[_0xba24('0x3b')]();return _0x278a3f;}return db[_0xba24('0x4b')][_0xba24('0x4c')]({'where':{'type':_0xba24('0x4d')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xba24('0x4e')],'as':_0xba24('0x4f'),'where':{'id':LISTID}}]})[_0xba24('0x2c')](function(_0x4e55c2){var _0x41188=[];if(_0x4e55c2){var _0x586ed7;for(var _0x47f3ae=0x0,_0x264ddf;_0x47f3ae<_0x4e55c2['length'];_0x47f3ae+=0x1){_0x264ddf=_0x4e55c2[_0x47f3ae]['get']({'plain':!![]});switch(_0x264ddf[_0xba24('0x50')]){case _0xba24('0x51'):_0x41188[_0xba24('0x2d')](db['sequelize'][_0xba24('0x52')](_0x5a33f9(_0x264ddf,_0xba24('0x53')))[_0xba24('0x2c')](function(){})['catch'](_0x247467()));break;case _0xba24('0x54'):_0x41188[_0xba24('0x2d')](db[_0xba24('0x55')]['query'](_0x5305fc(_0x264ddf,'VoiceQueueId'))[_0xba24('0x2c')](function(){})[_0xba24('0x2f')](_0x247467()));break;default:_0x41188[_0xba24('0x2d')](db[_0xba24('0x55')][_0xba24('0x52')](_0x24fc51(_0x264ddf,_0xba24('0x53')))['then'](function(){})['catch'](_0x247467()));}}}return _0x41188;})[_0xba24('0x56')]()[_0xba24('0x2c')](function(){return db['VoiceQueue'][_0xba24('0x4c')]({'where':{'type':_0xba24('0x4d')},'attributes':['id'],'include':[{'model':db[_0xba24('0x4e')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xba24('0x2c')](function(_0x1bb456){var _0x38719=[];if(_0x1bb456){var _0x421270;for(var _0x59f5b4=0x0,_0x2b48b9;_0x59f5b4<_0x1bb456[_0xba24('0x29')];_0x59f5b4+=0x1){_0x2b48b9=_0x1bb456[_0x59f5b4]['get']({'plain':!![]});_0x38719[_0xba24('0x2d')](db[_0xba24('0x55')][_0xba24('0x52')](_0x82ce36(_0x2b48b9,_0xba24('0x53')))[_0xba24('0x2c')](function(){})[_0xba24('0x2f')](_0x247467()));}}return _0x38719;})['all']();})[_0xba24('0x2c')](function(){return db['Campaign'][_0xba24('0x4c')]({'attributes':['id',_0xba24('0x50')],'include':[{'model':db[_0xba24('0x4e')],'as':_0xba24('0x4f'),'where':{'id':LISTID}}]})[_0xba24('0x2c')](function(_0x46fa62){var _0x3ee91a=[];if(_0x46fa62){for(var _0x4836b3=0x0,_0x4e6055;_0x4836b3<_0x46fa62['length'];_0x4836b3+=0x1){_0x4e6055=_0x46fa62[_0x4836b3]['get']({'plain':!![]});switch(_0x4e6055[_0xba24('0x50')]){case _0xba24('0x51'):_0x3ee91a[_0xba24('0x2d')](db[_0xba24('0x55')]['query'](_0x5a33f9(_0x4e6055,_0xba24('0x57')))['then'](function(){})[_0xba24('0x2f')](_0x247467()));break;case _0xba24('0x54'):_0x3ee91a[_0xba24('0x2d')](db[_0xba24('0x55')][_0xba24('0x52')](_0x5305fc(_0x4e6055,_0xba24('0x57')))[_0xba24('0x2c')](function(){})['catch'](_0x247467()));break;default:_0x3ee91a[_0xba24('0x2d')](db[_0xba24('0x55')][_0xba24('0x52')](_0x24fc51(_0x4e6055,_0xba24('0x57')))[_0xba24('0x2c')](function(){})['catch'](_0x247467()));}}}return _0x3ee91a;})['all']();})['then'](function(){return db[_0xba24('0x58')]['findAll']({'attributes':['id'],'include':[{'model':db[_0xba24('0x4e')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xba24('0x2c')](function(_0x2e40ef){var _0x1d4014=[];if(_0x2e40ef){for(var _0x17ac0b=0x0,_0x278860;_0x17ac0b<_0x2e40ef[_0xba24('0x29')];_0x17ac0b+=0x1){_0x278860=_0x2e40ef[_0x17ac0b]['get']({'plain':!![]});_0x1d4014[_0xba24('0x2d')](db[_0xba24('0x55')]['query'](_0x82ce36(_0x278860,'CampaignId'))[_0xba24('0x2c')](function(){})[_0xba24('0x2f')](_0x247467()));}}return _0x1d4014;})[_0xba24('0x56')]();})[_0xba24('0x2f')](function(_0x277aee){logger[_0xba24('0x15')](_0xba24('0x59'),'generalCheckHopper',_0x277aee['message']);});}var processPromises=function(_0xeb3ad5){return BPromise[_0xba24('0x56')](promises)[_0xba24('0x2c')](function(_0x30dfc4){})[_0xba24('0x2f')](function(_0x8585ed){logger[_0xba24('0x15')]('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x8585ed));})[_0xba24('0x5a')](function(){socket[_0xba24('0x5b')](_0xba24('0x5c')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0xeb3ad5){return _0xeb3ad5[_0xba24('0x5d')]();}});};var endCsv=function(){return BPromise[_0xba24('0x5e')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xba24('0x2c')](function(){socket[_0xba24('0x5b')](_0xba24('0x5c')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xba24('0x5f')](FILEPATH);}catch(_0x3d094b){logger[_0xba24('0x15')](_0xba24('0x60'),JSON[_0xba24('0x31')](_0x3d094b));}finally{process['exit'](0x0);}});};process['on'](_0xba24('0x61'),function(){logger[_0xba24('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0xba24('0x2c')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xba24('0x12')](',');return db[_0xba24('0x63')][_0xba24('0x4c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x1b7c85){var _0x1a030a=fs[_0xba24('0x64')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xba24('0x65')](_0x1a030a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x107b55,_0x30c6ba){total+=0x1;var _0x104bb9=total;promises[_0xba24('0x2d')](checkRow(_0x107b55,_0x1b7c85,_0x104bb9)[_0xba24('0x2c')](function(){success+=0x1;})['catch'](function(_0x2805c2){if(_0x2805c2['error']){errors+=0x1;delete _0x2805c2[_0xba24('0x15')];}else if(_0x2805c2[_0xba24('0x66')]){duplicates+=0x1;delete _0x2805c2[_0xba24('0x66')];}rows[_0xba24('0x2d')](_0x2805c2);}));if(total%0xc8===0x0){_0x30c6ba[_0xba24('0x67')]();return processPromises(_0x30c6ba);}},'complete':function(){return processPromises()[_0xba24('0x2c')](function(){logger[_0xba24('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0xe09db6,_0x552e86){logger[_0xba24('0x62')](_0xba24('0x68'),JSON[_0xba24('0x31')](_0xe09db6));endCsv();}});})['catch'](function(_0x2f7ed8){logger[_0xba24('0x15')](_0xba24('0x69'),JSON['stringify'](_0x2f7ed8));});}main(); \ No newline at end of file +var _0x7ca7=['toString','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','select','from','\x20=\x20?','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','query','VoiceQueueId','catch','onlyIfOpen','all','findAll','BlackLists','CampaignId','Campaign','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../mysqldb','api','redis','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','join','data','firstName','firstName\x20not\x20specified!','phone','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','length','find','duplicate','CmContact','then','push','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','into','cm_hopper','fromQuery','ContactId','createdAt','updatedAt','field','NOW()','scheduledAt'];(function(_0x15fb0b,_0x44b92d){var _0x423f50=function(_0x32b8c5){while(--_0x32b8c5){_0x15fb0b['push'](_0x15fb0b['shift']());}};_0x423f50(++_0x44b92d);}(_0x7ca7,0xfe));var _0x77ca=function(_0x1e1965,_0x55785c){_0x1e1965=_0x1e1965-0x0;var _0x1a2e96=_0x7ca7[_0x1e1965];return _0x1a2e96;};'use strict';var BPromise=require(_0x77ca('0x0'));var util=require(_0x77ca('0x1'));var _=require(_0x77ca('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x77ca('0x3'));var db=require(_0x77ca('0x4'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x77ca('0x5'));config[_0x77ca('0x6')]=_['defaults'](config[_0x77ca('0x6')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x77ca('0x6')]));require(_0x77ca('0x7'))[_0x77ca('0x8')](socket);try{if(!process[_0x77ca('0x9')][0x2]||process[_0x77ca('0x9')][0x2]===_0x77ca('0xa')||process[_0x77ca('0x9')][0x2]===_0x77ca('0xb')){throw new Error(_0x77ca('0xc'));}var FILEPATH=process[_0x77ca('0x9')][0x2];if(!process['argv'][0x3]||process[_0x77ca('0x9')][0x3]===_0x77ca('0xa')||process[_0x77ca('0x9')][0x3]==='null'||!process[_0x77ca('0x9')][0x4]||process[_0x77ca('0x9')][0x4]===_0x77ca('0xa')||process[_0x77ca('0x9')][0x4]===_0x77ca('0xb')){throw new Error(_0x77ca('0xd'));}var FIELDS=_['zipObject'](process[_0x77ca('0x9')][0x3]['split'](','),process[_0x77ca('0x9')][0x4][_0x77ca('0xe')](','));if(!process[_0x77ca('0x9')][0x5]||process[_0x77ca('0x9')][0x5]===_0x77ca('0xa')||process[_0x77ca('0x9')][0x5]==='null'){throw new Error(_0x77ca('0xf'));}var LISTID=process[_0x77ca('0x9')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x77ca('0x9')][0x6]!==_0x77ca('0xa')&&process[_0x77ca('0x9')][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process[_0x77ca('0x9')][0x7]&&process[_0x77ca('0x9')][0x7]!==_0x77ca('0xa')&&process[_0x77ca('0x9')][0x7]!=='null'?process[_0x77ca('0x9')][0x7]:null;if(!process['argv'][0x8]||process['argv'][0x8]===_0x77ca('0xa')||process[_0x77ca('0x9')][0x8]==='null'){throw new Error(_0x77ca('0x10'));}var SOCKET_TIMESTAMP=process[_0x77ca('0x9')][0x8];}catch(_0x42c31b){logger['error'](_0x42c31b);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(_0x2bf5cc,_0x5b12e6,_0x14e110,_0x15d508){var _0x4d584e={'message':_0x5b12e6};_0x4d584e[_0x2bf5cc]=!![];if(_0x14e110){_0x4d584e['contact']=_0x14e110;}if(_0x15d508){_0x4d584e[_0x77ca('0x11')]=_0x15d508;}return _0x4d584e;}function isEmail(_0x93d445){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))*$/[_0x77ca('0x12')](_0x93d445);}function checkRow(_0x20ba00,_0x5afead,_0x4392f6){return new BPromise(function(_0x52828e,_0x27615c){if(_[_0x77ca('0x13')](_0x20ba00)){return _0x27615c(handleCheckRowError(_0x77ca('0x14'),_0x77ca('0x15'),null,_0x4392f6));}if(_0x20ba00[_0x77ca('0x16')]&&_0x20ba00['errors']['length']){var _0x854616=_[_0x77ca('0x17')](_0x20ba00[_0x77ca('0x16')],_0x77ca('0x18'))[_0x77ca('0x19')](';');return _0x27615c(handleCheckRowError(_0x77ca('0x14'),_0x854616,null,_0x4392f6));}var _0x155e93={};for(var _0x3957a2 in FIELDS){if(FIELDS['hasOwnProperty'](_0x3957a2)&&FIELDS[_0x3957a2]){_0x155e93[_0x3957a2]=_0x20ba00[_0x77ca('0x1a')][0x0][FIELDS[_0x3957a2]]||_0x20ba00[_0x77ca('0x1a')][0x0]['\ufeff'+FIELDS[_0x3957a2]];}}if(!_0x155e93[_0x77ca('0x1b')]){return _0x27615c(handleCheckRowError(_0x77ca('0x14'),_0x77ca('0x1c'),null,_0x4392f6));}if(!_0x155e93[_0x77ca('0x1d')]){return _0x27615c(handleCheckRowError(_0x77ca('0x14'),'phone\x20not\x20specified!',null,_0x4392f6));}if(_0x155e93[_0x77ca('0x1e')]){var _0x5e2bf1=moment(_0x155e93['birthDate'],'YYYY-MM-DD');if(!_0x5e2bf1[_0x77ca('0x1f')]()){return _0x27615c(handleCheckRowError(_0x77ca('0x14'),_0x77ca('0x20'),null,_0x4392f6));}}if(_0x155e93[_0x77ca('0x21')]){if(!isEmail(_0x155e93[_0x77ca('0x21')])){return _0x27615c(handleCheckRowError(_0x77ca('0x14'),'email\x20format\x20is\x20not\x20valid!',null,_0x4392f6));}}_0x155e93[_0x77ca('0x22')]=LISTID;_0x155e93['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x77ca('0x23')]&&_0x5afead){var _0x172735={};for(var _0x36a24b=0x0,_0x5b8a9d=DUPLICATES[_0x77ca('0x23')];_0x36a24b<_0x5b8a9d;_0x36a24b+=0x1){_0x172735[DUPLICATES[_0x36a24b]]=_0x155e93[DUPLICATES[_0x36a24b]];}var _0x23b3ef=_[_0x77ca('0x24')](_0x5afead,_0x172735);if(_0x23b3ef){return _0x27615c(handleCheckRowError(_0x77ca('0x25'),'Duplicate\x20Contact',_0x23b3ef,_0x4392f6));}}return db[_0x77ca('0x26')]['create'](_0x155e93,{'raw':!![],'hooks':![],'fields':_['keys'](_0x155e93)})[_0x77ca('0x27')](function(_0x5e3d28){if(DUPLICATES&&DUPLICATES['length']&&_0x5afead){_0x5afead[_0x77ca('0x28')](_['pick'](_0x155e93,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5e3d28['id'];return _0x52828e();})['catch'](function(_0x2a3d02){return _0x27615c(handleCheckRowError('error',_0x77ca('0x29')+(_0x2a3d02[_0x77ca('0x18')]||JSON[_0x77ca('0x2a')](_0x2a3d02)),null,_0x4392f6));});});}function checkHopper(){function _0x6edd94(){return function(_0x30599b){logger[_0x77ca('0x14')]('cmContact',_0x77ca('0x2b'),util[_0x77ca('0x2c')](_0x30599b,{'showHidden':![],'depth':null}));};}var _0x212279=function(_0x36b2fe,_0x46c63e){var _0x1e4c19=squel[_0x77ca('0x2d')]()[_0x77ca('0x2e')](_0x77ca('0x2f'))[_0x77ca('0x30')]([_0x77ca('0x1d'),'scheduledAt',_0x77ca('0x31'),_0x77ca('0x22'),_0x46c63e,_0x77ca('0x32'),_0x77ca('0x33')],squel['select']()[_0x77ca('0x34')](_0x77ca('0x1d'),_0x77ca('0x1d'))['field'](_0x77ca('0x35'),_0x77ca('0x36'))['field']('id',_0x77ca('0x31'))['field'](LISTID['toString'](),'ListId')[_0x77ca('0x34')](_0x36b2fe['id'][_0x77ca('0x37')](),_0x46c63e)[_0x77ca('0x34')](_0x77ca('0x35'),'createdAt')[_0x77ca('0x34')](_0x77ca('0x35'),_0x77ca('0x33'))['from'](_0x77ca('0x38'))[_0x77ca('0x39')](_0x77ca('0x3a'))['where'](_0x77ca('0x3b'),LISTID['toString']())[_0x77ca('0x39')](_0x77ca('0x3c'))[_0x77ca('0x39')]('phone\x20NOT\x20IN\x20(?)',squel[_0x77ca('0x3d')]()[_0x77ca('0x34')](_0x77ca('0x1d'))[_0x77ca('0x3e')](_0x77ca('0x2f'))[_0x77ca('0x39')](_0x46c63e+_0x77ca('0x3f'),_0x36b2fe['id']['toString']())))['toString']();return _0x1e4c19;};var _0x3dc7e2=function(_0x5de7e0,_0x50fe3d){var _0x3d88ca=squel[_0x77ca('0x2d')]()['into'](_0x77ca('0x2f'))[_0x77ca('0x30')]([_0x77ca('0x1d'),_0x77ca('0x36'),_0x77ca('0x31'),'ListId',_0x50fe3d,'createdAt','updatedAt'],squel[_0x77ca('0x3d')]()[_0x77ca('0x34')](_0x77ca('0x1d'),'phone')[_0x77ca('0x34')](_0x77ca('0x35'),_0x77ca('0x36'))[_0x77ca('0x34')]('id','ContactId')['field'](LISTID['toString'](),_0x77ca('0x22'))[_0x77ca('0x34')](_0x5de7e0['id'][_0x77ca('0x37')](),_0x50fe3d)[_0x77ca('0x34')](_0x77ca('0x35'),_0x77ca('0x32'))[_0x77ca('0x34')](_0x77ca('0x35'),'updatedAt')[_0x77ca('0x3e')](_0x77ca('0x38'))[_0x77ca('0x39')]('deletedAt\x20IS\x20NULL')[_0x77ca('0x39')]('ListId\x20=\x20?',LISTID[_0x77ca('0x37')]())[_0x77ca('0x39')](_0x77ca('0x40'),squel[_0x77ca('0x41')](hopperContacts))[_0x77ca('0x39')](_0x77ca('0x3c'))[_0x77ca('0x39')](_0x77ca('0x42'),squel[_0x77ca('0x3d')]()[_0x77ca('0x34')](_0x77ca('0x43'))[_0x77ca('0x3e')](_0x77ca('0x44'))['where'](_0x50fe3d+'\x20=\x20?',_0x5de7e0['id'][_0x77ca('0x37')]()))[_0x77ca('0x39')](_0x77ca('0x42'),squel[_0x77ca('0x3d')]()[_0x77ca('0x34')](_0x77ca('0x1d'))['from'](_0x77ca('0x2f'))[_0x77ca('0x39')](_0x50fe3d+_0x77ca('0x3f'),_0x5de7e0['id'][_0x77ca('0x37')]())))[_0x77ca('0x37')]();return _0x3d88ca;};function _0x42215f(_0x3a37d4,_0x29c1b4){var _0x38fae7=squel['insert']()[_0x77ca('0x2e')](_0x77ca('0x2f'))[_0x77ca('0x30')]([_0x77ca('0x1d'),'scheduledAt',_0x77ca('0x31'),_0x77ca('0x22'),_0x29c1b4,_0x77ca('0x32'),_0x77ca('0x33')],squel[_0x77ca('0x3d')]()[_0x77ca('0x34')](_0x77ca('0x1d'),_0x77ca('0x1d'))['field']('NOW()','scheduledAt')['field']('id',_0x77ca('0x31'))[_0x77ca('0x34')](LISTID[_0x77ca('0x37')](),_0x77ca('0x22'))[_0x77ca('0x34')](_0x3a37d4['id'][_0x77ca('0x37')](),_0x29c1b4)[_0x77ca('0x34')](_0x77ca('0x35'),_0x77ca('0x32'))[_0x77ca('0x34')](_0x77ca('0x35'),_0x77ca('0x33'))[_0x77ca('0x3e')](_0x77ca('0x38'))[_0x77ca('0x39')](_0x77ca('0x3a'))['where'](_0x77ca('0x3b'),LISTID['toString']())[_0x77ca('0x39')]('id\x20IN\x20?',squel[_0x77ca('0x41')](hopperContacts))[_0x77ca('0x39')](_0x77ca('0x3c')))[_0x77ca('0x37')]();return _0x38fae7;}function _0xc1f3a4(_0x4eb2d3,_0x18dbd6){var _0x10cfe4=squel[_0x77ca('0x2d')]()[_0x77ca('0x2e')]('cm_hopper_black')[_0x77ca('0x30')](['phone',_0x77ca('0x31'),_0x77ca('0x22'),_0x18dbd6,_0x77ca('0x32'),_0x77ca('0x33')],squel[_0x77ca('0x3d')]()[_0x77ca('0x34')]('phone',_0x77ca('0x1d'))[_0x77ca('0x34')]('id','ContactId')[_0x77ca('0x34')](LISTID[_0x77ca('0x37')](),_0x77ca('0x22'))[_0x77ca('0x34')](_0x4eb2d3['id'][_0x77ca('0x37')](),_0x18dbd6)[_0x77ca('0x34')](_0x77ca('0x35'),_0x77ca('0x32'))[_0x77ca('0x34')]('NOW()','updatedAt')[_0x77ca('0x3e')](_0x77ca('0x38'))[_0x77ca('0x39')](_0x77ca('0x3a'))[_0x77ca('0x39')](_0x77ca('0x3b'),LISTID[_0x77ca('0x37')]())[_0x77ca('0x39')](_0x77ca('0x40'),squel[_0x77ca('0x41')](hopperContacts))[_0x77ca('0x39')]('phone\x20IS\x20NOT\x20NULL'))[_0x77ca('0x37')]();return _0x10cfe4;}return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id',_0x77ca('0x45')],'include':[{'model':db[_0x77ca('0x46')],'as':_0x77ca('0x47'),'where':{'id':LISTID}}]})[_0x77ca('0x27')](function(_0x2c9222){var _0x3d4716=[];if(_0x2c9222){var _0x375c4c;for(var _0x183e4a=0x0,_0x285271;_0x183e4a<_0x2c9222['length'];_0x183e4a+=0x1){_0x285271=_0x2c9222[_0x183e4a][_0x77ca('0x48')]({'plain':!![]});switch(_0x285271[_0x77ca('0x45')]){case _0x77ca('0x49'):_0x3d4716[_0x77ca('0x28')](db[_0x77ca('0x4a')][_0x77ca('0x4b')](_0x3dc7e2(_0x285271,_0x77ca('0x4c')))[_0x77ca('0x27')](function(){})[_0x77ca('0x4d')](_0x6edd94()));break;case _0x77ca('0x4e'):_0x3d4716['push'](db['sequelize']['query'](_0x212279(_0x285271,_0x77ca('0x4c')))[_0x77ca('0x27')](function(){})[_0x77ca('0x4d')](_0x6edd94()));break;default:_0x3d4716[_0x77ca('0x28')](db[_0x77ca('0x4a')]['query'](_0x42215f(_0x285271,_0x77ca('0x4c')))[_0x77ca('0x27')](function(){})[_0x77ca('0x4d')](_0x6edd94()));}}}return _0x3d4716;})[_0x77ca('0x4f')]()[_0x77ca('0x27')](function(){return db['VoiceQueue'][_0x77ca('0x50')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x77ca('0x51'),'where':{'id':LISTID}}]})[_0x77ca('0x27')](function(_0x3a892d){var _0x2dd930=[];if(_0x3a892d){var _0x5b5875;for(var _0x145ed0=0x0,_0x39a861;_0x145ed0<_0x3a892d[_0x77ca('0x23')];_0x145ed0+=0x1){_0x39a861=_0x3a892d[_0x145ed0][_0x77ca('0x48')]({'plain':!![]});_0x2dd930[_0x77ca('0x28')](db[_0x77ca('0x4a')]['query'](_0xc1f3a4(_0x39a861,'VoiceQueueId'))['then'](function(){})['catch'](_0x6edd94()));}}return _0x2dd930;})[_0x77ca('0x4f')]();})[_0x77ca('0x27')](function(){return db['Campaign']['findAll']({'attributes':['id',_0x77ca('0x45')],'include':[{'model':db[_0x77ca('0x46')],'as':'Lists','where':{'id':LISTID}}]})[_0x77ca('0x27')](function(_0x4b19ca){var _0x4ed15f=[];if(_0x4b19ca){for(var _0x158bab=0x0,_0x45723c;_0x158bab<_0x4b19ca[_0x77ca('0x23')];_0x158bab+=0x1){_0x45723c=_0x4b19ca[_0x158bab]['get']({'plain':!![]});switch(_0x45723c[_0x77ca('0x45')]){case _0x77ca('0x49'):_0x4ed15f[_0x77ca('0x28')](db['sequelize'][_0x77ca('0x4b')](_0x3dc7e2(_0x45723c,_0x77ca('0x52')))[_0x77ca('0x27')](function(){})['catch'](_0x6edd94()));break;case'onlyIfOpen':_0x4ed15f['push'](db[_0x77ca('0x4a')][_0x77ca('0x4b')](_0x212279(_0x45723c,_0x77ca('0x52')))[_0x77ca('0x27')](function(){})['catch'](_0x6edd94()));break;default:_0x4ed15f[_0x77ca('0x28')](db['sequelize']['query'](_0x42215f(_0x45723c,_0x77ca('0x52')))[_0x77ca('0x27')](function(){})[_0x77ca('0x4d')](_0x6edd94()));}}}return _0x4ed15f;})['all']();})[_0x77ca('0x27')](function(){return db[_0x77ca('0x53')][_0x77ca('0x50')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x77ca('0x51'),'where':{'id':LISTID}}]})[_0x77ca('0x27')](function(_0x18c130){var _0x5cfcc6=[];if(_0x18c130){for(var _0x208f5a=0x0,_0x3503d8;_0x208f5a<_0x18c130['length'];_0x208f5a+=0x1){_0x3503d8=_0x18c130[_0x208f5a][_0x77ca('0x48')]({'plain':!![]});_0x5cfcc6[_0x77ca('0x28')](db[_0x77ca('0x4a')][_0x77ca('0x4b')](_0xc1f3a4(_0x3503d8,_0x77ca('0x52')))['then'](function(){})['catch'](_0x6edd94()));}}return _0x5cfcc6;})[_0x77ca('0x4f')]();})['catch'](function(_0x28dc88){logger[_0x77ca('0x14')](_0x77ca('0x54'),_0x77ca('0x55'),_0x28dc88[_0x77ca('0x18')]);});}var processPromises=function(_0x501390){return BPromise[_0x77ca('0x4f')](promises)[_0x77ca('0x27')](function(_0x5cc51f){})[_0x77ca('0x4d')](function(_0x3727a1){logger[_0x77ca('0x14')](_0x77ca('0x56'),JSON[_0x77ca('0x2a')](_0x3727a1));})[_0x77ca('0x57')](function(){socket[_0x77ca('0x58')](_0x77ca('0x59')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x501390){return _0x501390[_0x77ca('0x5a')]();}});};var endCsv=function(){return BPromise[_0x77ca('0x5b')]()[_0x77ca('0x27')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x77ca('0x58')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x77ca('0x5c')](FILEPATH);}catch(_0x34643d){logger['error']('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x77ca('0x2a')](_0x34643d));}finally{process[_0x77ca('0x5d')](0x0);}});};process['on'](_0x77ca('0x5e'),function(){logger[_0x77ca('0x5f')](_0x77ca('0x60'));endCsv();});function main(){return BPromise[_0x77ca('0x5b')]()[_0x77ca('0x27')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db['CmContact'][_0x77ca('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x77ca('0x27')](function(_0x40da8e){var _0x56dcbd=fs[_0x77ca('0x61')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x77ca('0x62')](_0x56dcbd,{'header':!![],'skipEmptyLines':!![],'step':function(_0x367c46,_0x14a4ec){total+=0x1;var _0x51b81f=total;promises['push'](checkRow(_0x367c46,_0x40da8e,_0x51b81f)['then'](function(){success+=0x1;})['catch'](function(_0x5cb19f){if(_0x5cb19f[_0x77ca('0x14')]){errors+=0x1;delete _0x5cb19f[_0x77ca('0x14')];}else if(_0x5cb19f[_0x77ca('0x25')]){duplicates+=0x1;delete _0x5cb19f[_0x77ca('0x25')];}rows[_0x77ca('0x28')](_0x5cb19f);}));if(total%0xc8===0x0){_0x14a4ec[_0x77ca('0x63')]();return processPromises(_0x14a4ec);}},'complete':function(){return processPromises()[_0x77ca('0x27')](function(){logger['info'](_0x77ca('0x64'));endCsv();});},'error':function(_0xf93c70,_0x3cca66){logger[_0x77ca('0x5f')](_0x77ca('0x65'),JSON[_0x77ca('0x2a')](_0xf93c70));endCsv();}});})['catch'](function(_0x5cb4b6){logger[_0x77ca('0x14')](_0x77ca('0x66'),JSON[_0x77ca('0x2a')](_0x5cb4b6));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 4c87db8..eed9e5b 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 _0xd17f=['SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId','isNil',',\x20scheduledAt\x20=\x20NOW()','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','VoiceQueueId','CampaignId','campaigns_has_cm_blacklists','campaigns','each','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','bluebird','squel','ioredis','../../../config/environment','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','UserId','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_hopper_black','cm_contacts.createdAt\x20=\x20?','select','keys',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','message','exit','errors','push','code','sequelize','query','spread','catch','error','main','stringify','send','start','binding','root','server/files/tmp','header','writeFileSync','parse','length','rows','data','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified'];(function(_0xf35bc1,_0x510803){var _0xa6b162=function(_0x1e5cc8){while(--_0x1e5cc8){_0xf35bc1['push'](_0xf35bc1['shift']());}};_0xa6b162(++_0x510803);}(_0xd17f,0xb1));var _0xfd17=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd17f[_0x14add3];return _0x4a174f;};'use strict';var fs=require('fs');var path=require(_0xfd17('0x0'));var _=require(_0xfd17('0x1'));var Papa=require(_0xfd17('0x2'));var util=require(_0xfd17('0x3'));var BPromise=require(_0xfd17('0x4'));var moment=require('moment');var squel=require(_0xfd17('0x5'));var Redis=require(_0xfd17('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0xfd17('0x7'));var logger=require('../../../config/logger')(_0xfd17('0x8'));config[_0xfd17('0x9')]=_[_0xfd17('0xa')](config[_0xfd17('0x9')],{'host':_0xfd17('0xb'),'port':0x18eb});var socket=require(_0xfd17('0xc'))(new Redis(config[_0xfd17('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xfd17('0xd')](_0xfd17('0xe'));function isEmail(_0x31855c){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))*$/[_0xfd17('0xf')](_0x31855c);}function selectNotIn(_0x2d5d68,_0x78b25f,_0x397052,_0x22d48e,_0x528b9c){return squel['select']()[_0xfd17('0x10')](_0xfd17('0x11'))['from'](_0x22d48e)[_0xfd17('0x12')](_0x78b25f,null,_0x78b25f+_0xfd17('0x13')+_0x22d48e+'.'+_0x397052)['where'](_0x22d48e+'.'+_0x397052+_0xfd17('0x14')+_0x2d5d68+'.'+_0x397052)[_0xfd17('0x15')](_0x78b25f+_0xfd17('0x16')+_0x528b9c['join']()+')');}function insertCmHopper(_0x4c604f,_0x4d08fa,_0x462aee,_0x24636f,_0x3a6bc1){var _0x39335c=[_0xfd17('0x17'),_0xfd17('0x18'),_0xfd17('0x19'),_0xfd17('0x1a'),_0x4d08fa+'.'+_0x24636f,_0xfd17('0x1b'),_0xfd17('0x1c'),_0xfd17('0x1d'),'cm_contacts.UserId','\x22'+_0x3a6bc1+'\x22'];return squel[_0xfd17('0x1e')]()[_0xfd17('0x1f')](_0xfd17('0x20'))[_0xfd17('0x21')](['phone',_0xfd17('0x22'),_0xfd17('0x23'),_0xfd17('0x24'),_0x24636f,_0xfd17('0x25'),_0xfd17('0x26'),'priority',_0xfd17('0x27'),_0xfd17('0x28')],squel['select']()[_0xfd17('0x29')](_0x39335c)[_0xfd17('0x2a')](_0x4d08fa)['join'](_0xfd17('0x2b'),null,_0xfd17('0x2c')+_0x4d08fa+_0xfd17('0x2d'))['join'](_0x462aee,null,_0x462aee+_0xfd17('0x13')+_0x4d08fa+'.'+_0x24636f)[_0xfd17('0x15')](_0x4d08fa+_0xfd17('0x2e'),_0x4c604f)[_0xfd17('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xfd17('0x2f'),selectNotIn(_0x4d08fa,_0x462aee,_0x24636f,_0xfd17('0x20'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0xfd17('0x15')](_0xfd17('0x2f'),selectNotIn(_0x4d08fa,_0x462aee,_0x24636f,_0xfd17('0x20'),[_0xfd17('0x30')])))[_0xfd17('0x31')]();}function insertCmHopperBlack(_0x1bb298,_0x24ac3b,_0xfeb40,_0x90ca37){var _0x34591b=[_0xfd17('0x17'),'cm_contacts.id',_0xfd17('0x1a'),_0x24ac3b+'.'+_0x90ca37,_0xfd17('0x1b'),_0xfd17('0x1c')];return squel['insert']()[_0xfd17('0x1f')](_0xfd17('0x32'))[_0xfd17('0x21')](['phone','ContactId','ListId',_0x90ca37,_0xfd17('0x25'),_0xfd17('0x26')],squel['select']()['fields'](_0x34591b)['from'](_0x24ac3b)[_0xfd17('0x12')](_0xfd17('0x2b'),null,_0xfd17('0x2c')+_0x24ac3b+_0xfd17('0x2d'))[_0xfd17('0x12')](_0xfeb40,null,_0xfeb40+_0xfd17('0x13')+_0x24ac3b+'.'+_0x90ca37)['where'](_0x24ac3b+_0xfd17('0x2e'),_0x1bb298)[_0xfd17('0x15')](_0xfd17('0x33'),NOW)[_0xfd17('0x15')](_0xfd17('0x2f'),squel[_0xfd17('0x34')]()[_0xfd17('0x10')](_0xfd17('0x11'))[_0xfd17('0x2a')](_0xfd17('0x32'))['where']('ListId\x20=\x20?',_0x1bb298)['where'](_0x90ca37+'\x20=\x20?',_0x24ac3b+'.'+_0x90ca37)))['toString']();}function insertCmContact(_0x411933,_0x274538,_0x331341,_0x1f1753){var _0x2ccbd6=_['concat'](_[_0xfd17('0x35')](_0x1f1753),[_0xfd17('0x24'),'CompanyId',_0xfd17('0x25'),_0xfd17('0x26')]);return squel[_0xfd17('0x1e')]()[_0xfd17('0x1f')](_0xfd17('0x2b'))[_0xfd17('0x21')](_0x2ccbd6,squel[_0xfd17('0x34')]()[_0xfd17('0x29')](_0x2ccbd6)['from'](_0x274538)[_0xfd17('0x15')]('('+_0x331341[_0xfd17('0x12')](',')+_0xfd17('0x36'),squel[_0xfd17('0x34')]()[_0xfd17('0x29')](_0x331341)[_0xfd17('0x2a')]('cm_contacts')[_0xfd17('0x15')](_0xfd17('0x37'),_0x411933)[_0xfd17('0x15')]('deletedAt\x20IS\x20NULL'))[_0xfd17('0x15')]('id\x20IN\x20?',squel[_0xfd17('0x34')]()[_0xfd17('0x10')](_0xfd17('0x38'),_0xfd17('0x39'))[_0xfd17('0x2a')](_0x274538)[_0xfd17('0x3a')](_0x331341[_0xfd17('0x12')](','))))[_0xfd17('0x31')]();}function handleStop(){logger[_0xfd17('0x3b')](_0xfd17('0x3c'));stopped=!![];}function handleUncaughtException(_0x2f24c9){logger['error'](_0x2f24c9[_0xfd17('0x3d')]);process[_0xfd17('0x3e')](0x1);}function handleError(_0x146c25,_0x51abe5){stats[_0xfd17('0x3f')][_0xfd17('0x40')]({'name':_0x51abe5[_0xfd17('0x41')],'message':_0x51abe5[_0xfd17('0x3d')],'row':_0x146c25});}function handleQuery(_0x33b3c0){logger[_0xfd17('0x3b')](_0x33b3c0);return db[_0xfd17('0x42')][_0xfd17('0x43')](_0x33b3c0)[_0xfd17('0x44')](function(_0x424dc2){results[_0xfd17('0x40')](_0x424dc2);})[_0xfd17('0x45')](function(_0x57883b){logger[_0xfd17('0x46')](_0x57883b[_0xfd17('0x3d')]);});}function main(_0x4f146a,_0x33e2f6,_0x25bd7d,_0x1abd43){logger[_0xfd17('0x3b')](_0xfd17('0x47'),_0x4f146a,JSON[_0xfd17('0x48')](_0x33e2f6));process[_0xfd17('0x49')](_0xfd17('0x4a'));var _0x4d071b=_0x33e2f6[_0xfd17('0x4b')];var _0x5833f4=_0x33e2f6['socket_timestamp'];var _0x24aef2=path['join'](config[_0xfd17('0x4c')],_0xfd17('0x4d'),_0x5833f4+'.csv');var _0x5b5edc=_[_0xfd17('0x35')](_0x4d071b)[_0xfd17('0x12')]();logger[_0xfd17('0x3b')](_0xfd17('0x4e'),_0x5b5edc);fs[_0xfd17('0x4f')](_0x24aef2,_0x5b5edc+'\x0a');Papa[_0xfd17('0x50')](fs['createReadStream'](_0x4f146a),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4edfde,_0x37ddd5){try{for(var _0x204ea2=0x0,_0x50944c=[];_0x204ea2<_0x4edfde['data'][_0xfd17('0x51')];_0x204ea2++){stats[_0xfd17('0x52')]+=0x1;if(_0x4edfde['errors'][_0x204ea2]){handleError(_0x4edfde[_0xfd17('0x53')][_0x204ea2],_0x4edfde[_0xfd17('0x3f')][_0x204ea2]);}else{var _0x20bb5e=[];for(var _0x48aa7f in _0x4d071b){if(_0x4d071b[_0xfd17('0x54')](_0x48aa7f)){if(_0x4edfde[_0xfd17('0x53')][_0x204ea2][_0x4d071b[_0x48aa7f]]){var _0x5b78bb=_[_0xfd17('0x55')](_0x4edfde[_0xfd17('0x53')][_0x204ea2][_0x4d071b[_0x48aa7f]][_0xfd17('0x56')](/"/g,'\x27'));switch(_0x48aa7f){case'scheduledat':var _0x47311b=moment(_0x5b78bb,_0xfd17('0xe'),!![]);if(_0x47311b['isValid']()){_0x50944c[_0xfd17('0x40')]('\x22'+_0x5b78bb+'\x22');}else{_0x20bb5e[_0xfd17('0x40')](_0xfd17('0x57'));}break;case _0xfd17('0x58'):var _0x7e2886=parseInt(_0x5b78bb);_0x5b78bb=_['isNaN'](_0x7e2886)||_0x7e2886<0x0||_0x7e2886>0x4?_0x1abd43?0x3:0x2:_0x7e2886;_0x50944c[_0xfd17('0x40')]('\x22'+_0x5b78bb+'\x22');break;case _0xfd17('0x27'):var _0x239cca=parseInt(_0x5b78bb);if(_['isNumber'](_0x239cca)&&_[_0xfd17('0x59')](_0x25bd7d,_0x239cca)){_0x50944c['push']('\x22'+_0x239cca+'\x22');}else{_0x20bb5e[_0xfd17('0x40')](_0xfd17('0x5a'));}break;case _0xfd17('0x5b'):if(isEmail(_0x5b78bb)){_0x50944c[_0xfd17('0x40')]('\x22'+_0x5b78bb+'\x22');}else{_0x20bb5e[_0xfd17('0x40')](_0xfd17('0x5c'));}break;case _0xfd17('0x5d'):var _0x4b960e=moment(_0x5b78bb,_0xfd17('0x5e'),!![]);if(_0x4b960e[_0xfd17('0x5f')]()){_0x50944c[_0xfd17('0x40')]('\x22'+_0x5b78bb+'\x22');}else{_0x20bb5e[_0xfd17('0x40')](_0xfd17('0x60'));}break;default:_0x50944c[_0xfd17('0x40')]('\x22'+_0x5b78bb+'\x22');}}else{switch(_0x48aa7f){case _0xfd17('0x61'):case _0xfd17('0x11'):_0x20bb5e[_0xfd17('0x40')](_0x48aa7f+_0xfd17('0x62'));break;default:_0x50944c[_0xfd17('0x40')]('\x22\x22');}}}}if(_0x20bb5e[_0xfd17('0x51')]){handleError(_0x4edfde['data'][_0x204ea2],{'code':_0xfd17('0x63'),'message':_0x20bb5e[_0xfd17('0x12')]()});}else{fs[_0xfd17('0x64')](_0x24aef2,_0x50944c[_0xfd17('0x12')]()+'\x0a');}_0x50944c=[];}if(!(stats[_0xfd17('0x52')]%0xc8)){socket[_0xfd17('0x65')](_0xfd17('0x66')+_0x5833f4,stats);stats[_0xfd17('0x3f')]=[];}}if(stopped){logger[_0xfd17('0x3b')](_0xfd17('0x67'));_0x37ddd5[_0xfd17('0x68')]();}}catch(_0x4ccf11){handleError(_0x4edfde[_0xfd17('0x53')][_0x204ea2],{'code':_0xfd17('0x69'),'message':_0x4ccf11[_0xfd17('0x3d')]});logger['error']('step',_0x4ccf11[_0xfd17('0x3d')]);}},'complete':function(){try{var _0x10d485=[];var _0x3588cc='cm_contacts';if(_0x33e2f6[_0xfd17('0x6a')]&&_0x33e2f6[_0xfd17('0x6a')][_0xfd17('0x51')]){_0x3588cc=_0xfd17('0x6b')+_0x5833f4;_0x10d485['push'](_0xfd17('0x6c')+_0x3588cc+_0xfd17('0x6d'));}var _0x5bc59f=util['format'](_0xfd17('0x6e'),_0x24aef2,_0x3588cc,_0x5b5edc,_0x33e2f6[_0xfd17('0x24')],_0x33e2f6[_0xfd17('0x6f')]||null,NOW,NOW);if(_[_0xfd17('0x70')](_0x4d071b[_0xfd17('0x22')])){_0x5bc59f+=_0xfd17('0x71');}_0x10d485[_0xfd17('0x40')](_0x5bc59f);if(_0x33e2f6['duplicates']&&_0x33e2f6[_0xfd17('0x6a')][_0xfd17('0x51')]){_0x10d485[_0xfd17('0x40')](insertCmContact(_0x33e2f6[_0xfd17('0x24')],_0x3588cc,_0x33e2f6['duplicates'],_0x4d071b));_0x10d485[_0xfd17('0x40')]('DROP\x20TABLE\x20'+_0x3588cc+';');}_0x10d485[_0xfd17('0x40')](insertCmHopper(_0x33e2f6[_0xfd17('0x24')],_0xfd17('0x72'),_0xfd17('0x73'),'VoiceQueueId',_0x1abd43));_0x10d485[_0xfd17('0x40')](insertCmHopperBlack(_0x33e2f6[_0xfd17('0x24')],_0xfd17('0x74'),_0xfd17('0x73'),_0xfd17('0x75')));_0x10d485[_0xfd17('0x40')](insertCmHopper(_0x33e2f6[_0xfd17('0x24')],'campaigns_has_cm_lists','campaigns',_0xfd17('0x76'),_0x1abd43));_0x10d485['push'](insertCmHopperBlack(_0x33e2f6[_0xfd17('0x24')],_0xfd17('0x77'),_0xfd17('0x78'),_0xfd17('0x76')));BPromise[_0xfd17('0x79')](_0x10d485,handleQuery)['then'](function(_0x2404a6){stats[_0xfd17('0x7a')]=!![];stats[_0xfd17('0x7b')]=_0x33e2f6[_0xfd17('0x6a')]&&_0x33e2f6[_0xfd17('0x6a')]['length']?results[0x2][_0xfd17('0x7b')]:results[0x0]['affectedRows'];socket[_0xfd17('0x65')](_0xfd17('0x66')+_0x5833f4,stats);fs[_0xfd17('0x7c')](_0x4f146a);fs[_0xfd17('0x7c')](_0x24aef2);process[_0xfd17('0x3e')](0x0);})[_0xfd17('0x45')](function(_0x36c9ec){logger['error'](_0x36c9ec[_0xfd17('0x3d')]);process[_0xfd17('0x3e')](0x1);});}catch(_0x50ea0d){logger[_0xfd17('0x46')](_0xfd17('0x7d'),_0x50ea0d[_0xfd17('0x3d')]);process[_0xfd17('0x3e')](0x1);}},'error':function(_0x1a50d7,_0x3147a0,_0x5a6b0b,_0x27f9e1){throw new Error(_0x27f9e1);}});}function validate(){if(process[_0xfd17('0x7e')]&&process[_0xfd17('0x7e')]['length']<0x4){throw new Error(_0xfd17('0x7f'));}var _0x52e49a=path['join'](config[_0xfd17('0x4c')],'server/files/tmp',process['argv'][0x2]);if(!fs[_0xfd17('0x80')](_0x52e49a)){throw new Error(_0xfd17('0x81'));}var _0x35b544={};try{_0x35b544=JSON[_0xfd17('0x50')](process[_0xfd17('0x7e')][0x3]);if(!_0x35b544[_0xfd17('0x4b')]){throw new Error(_0xfd17('0x82'));}if(!_0x35b544[_0xfd17('0x4b')][_0xfd17('0x11')]){throw new Error(_0xfd17('0x83'));}if(!_0x35b544[_0xfd17('0x4b')][_0xfd17('0x61')]){throw new Error(_0xfd17('0x84'));}var _0x3b7a50=0x0;if(_0x35b544[_0xfd17('0x4b')]['UserId']){_0x3b7a50=0x1;}if(!_0x35b544[_0xfd17('0x24')]){throw new Error(_0xfd17('0x85'));}}catch(_0x4bedf5){throw new Error(_0xfd17('0x86'));}var _0x5a5c0b=[];try{_0x5a5c0b=_[_0xfd17('0x87')](JSON[_0xfd17('0x50')](process[_0xfd17('0x7e')][0x4]),'id');}catch(_0x156a31){logger[_0xfd17('0x3b')](_0xfd17('0x88'));}main(_0x52e49a,_0x35b544,_0x5a5c0b,_0x3b7a50);}validate();process['on']('SIGINT',handleStop);process['on'](_0xfd17('0x89'),handleUncaughtException); \ No newline at end of file +var _0xb6d8=['dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','\x20LIKE\x20cm_contacts;','isNil','scheduledat','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','parse','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','redis','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','where','\x20=\x20','join','cm_contacts.phone','cm_contacts.id','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.ListId','cm_contacts.createdAt','cm_hopper_black','fromQuery','fields','ListId\x20=\x20?','\x20=\x20?','toString','concat',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','exit','errors','code','message','sequelize','spread','push','catch','stringify','send','socket_timestamp','server/files/tmp','.csv','keys','header','writeFileSync','createReadStream','length','rows','data','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD'];(function(_0xf2682d,_0x48f012){var _0x53dea0=function(_0x47235e){while(--_0x47235e){_0xf2682d['push'](_0xf2682d['shift']());}};_0x53dea0(++_0x48f012);}(_0xb6d8,0x1c1));var _0x8b6d=function(_0x5b359a,_0x330307){_0x5b359a=_0x5b359a-0x0;var _0x566170=_0xb6d8[_0x5b359a];return _0x566170;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0x8b6d('0x0'));var util=require(_0x8b6d('0x1'));var BPromise=require(_0x8b6d('0x2'));var moment=require(_0x8b6d('0x3'));var squel=require(_0x8b6d('0x4'));var Redis=require('ioredis');var db=require(_0x8b6d('0x5'))['db'];var config=require(_0x8b6d('0x6'));var logger=require(_0x8b6d('0x7'))(_0x8b6d('0x8'));config['redis']=_[_0x8b6d('0x9')](config[_0x8b6d('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8b6d('0xb'))(new Redis(config[_0x8b6d('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x8b6d('0xc')](_0x8b6d('0xd'));function isEmail(_0x71ec28){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))*$/[_0x8b6d('0xe')](_0x71ec28);}function selectNotIn(_0x323e7a,_0x26c9f7,_0x166188,_0x1abc12,_0xa6a8c0){return squel[_0x8b6d('0xf')]()[_0x8b6d('0x10')](_0x8b6d('0x11'))[_0x8b6d('0x12')](_0x1abc12)['join'](_0x26c9f7,null,_0x26c9f7+'.id\x20=\x20'+_0x1abc12+'.'+_0x166188)[_0x8b6d('0x13')](_0x1abc12+'.'+_0x166188+_0x8b6d('0x14')+_0x323e7a+'.'+_0x166188)['where'](_0x26c9f7+'.dialCheckDuplicateType\x20IN\x20('+_0xa6a8c0[_0x8b6d('0x15')]()+')');}function insertCmHopper(_0x4fc66b,_0x28d7b4,_0x267bc3,_0x39ba42,_0x1d1def){var _0x44c2c7=[_0x8b6d('0x16'),'cm_contacts.scheduledat',_0x8b6d('0x17'),'cm_contacts.ListId',_0x28d7b4+'.'+_0x39ba42,'cm_contacts.createdAt',_0x8b6d('0x18'),_0x8b6d('0x19'),_0x8b6d('0x1a'),'\x22'+_0x1d1def+'\x22'];return squel[_0x8b6d('0x1b')]()[_0x8b6d('0x1c')](_0x8b6d('0x1d'))['fromQuery']([_0x8b6d('0x11'),'scheduledat',_0x8b6d('0x1e'),_0x8b6d('0x1f'),_0x39ba42,_0x8b6d('0x20'),_0x8b6d('0x21'),_0x8b6d('0x22'),_0x8b6d('0x23'),_0x8b6d('0x24')],squel['select']()['fields'](_0x44c2c7)['from'](_0x28d7b4)[_0x8b6d('0x15')](_0x8b6d('0x25'),null,_0x8b6d('0x26')+_0x28d7b4+_0x8b6d('0x27'))[_0x8b6d('0x15')](_0x267bc3,null,_0x267bc3+_0x8b6d('0x28')+_0x28d7b4+'.'+_0x39ba42)['where'](_0x28d7b4+_0x8b6d('0x29'),_0x4fc66b)['where'](_0x8b6d('0x2a'),NOW)[_0x8b6d('0x13')](_0x8b6d('0x2b'),selectNotIn(_0x28d7b4,_0x267bc3,_0x39ba42,'cm_hopper',[_0x8b6d('0x2c'),_0x8b6d('0x2d')]))[_0x8b6d('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x28d7b4,_0x267bc3,_0x39ba42,_0x8b6d('0x1d'),[_0x8b6d('0x2c')])))['toString']();}function insertCmHopperBlack(_0x415b0d,_0x3d5e8e,_0x1b7bfd,_0x2e809a){var _0x5ddbc3=[_0x8b6d('0x16'),_0x8b6d('0x17'),_0x8b6d('0x2e'),_0x3d5e8e+'.'+_0x2e809a,_0x8b6d('0x2f'),_0x8b6d('0x18')];return squel[_0x8b6d('0x1b')]()[_0x8b6d('0x1c')](_0x8b6d('0x30'))[_0x8b6d('0x31')]([_0x8b6d('0x11'),'ContactId',_0x8b6d('0x1f'),_0x2e809a,'createdAt','updatedAt'],squel['select']()[_0x8b6d('0x32')](_0x5ddbc3)[_0x8b6d('0x12')](_0x3d5e8e)[_0x8b6d('0x15')](_0x8b6d('0x25'),null,_0x8b6d('0x26')+_0x3d5e8e+_0x8b6d('0x27'))['join'](_0x1b7bfd,null,_0x1b7bfd+_0x8b6d('0x28')+_0x3d5e8e+'.'+_0x2e809a)[_0x8b6d('0x13')](_0x3d5e8e+_0x8b6d('0x29'),_0x415b0d)[_0x8b6d('0x13')](_0x8b6d('0x2a'),NOW)[_0x8b6d('0x13')](_0x8b6d('0x2b'),squel[_0x8b6d('0xf')]()[_0x8b6d('0x10')](_0x8b6d('0x11'))['from']('cm_hopper_black')[_0x8b6d('0x13')](_0x8b6d('0x33'),_0x415b0d)[_0x8b6d('0x13')](_0x2e809a+_0x8b6d('0x34'),_0x3d5e8e+'.'+_0x2e809a)))[_0x8b6d('0x35')]();}function insertCmContact(_0x3109b0,_0x529811,_0x3f4513,_0x4cf0ce){var _0x3a3fd0=_[_0x8b6d('0x36')](_['keys'](_0x4cf0ce),[_0x8b6d('0x1f'),'CompanyId',_0x8b6d('0x20'),'updatedAt']);return squel[_0x8b6d('0x1b')]()[_0x8b6d('0x1c')](_0x8b6d('0x25'))[_0x8b6d('0x31')](_0x3a3fd0,squel[_0x8b6d('0xf')]()[_0x8b6d('0x32')](_0x3a3fd0)[_0x8b6d('0x12')](_0x529811)[_0x8b6d('0x13')]('('+_0x3f4513['join'](',')+_0x8b6d('0x37'),squel[_0x8b6d('0xf')]()['fields'](_0x3f4513)[_0x8b6d('0x12')](_0x8b6d('0x25'))['where']('ListId\x20=\x20?',_0x3109b0)['where'](_0x8b6d('0x38')))[_0x8b6d('0x13')](_0x8b6d('0x39'),squel['select']()[_0x8b6d('0x10')](_0x8b6d('0x3a'),_0x8b6d('0x3b'))[_0x8b6d('0x12')](_0x529811)[_0x8b6d('0x3c')](_0x3f4513[_0x8b6d('0x15')](','))))['toString']();}function handleStop(){logger[_0x8b6d('0x3d')](_0x8b6d('0x3e'));stopped=!![];}function handleUncaughtException(_0x273109){logger[_0x8b6d('0x3f')](_0x273109['message']);process[_0x8b6d('0x40')](0x1);}function handleError(_0x41a001,_0x23301e){stats[_0x8b6d('0x41')]['push']({'name':_0x23301e[_0x8b6d('0x42')],'message':_0x23301e[_0x8b6d('0x43')],'row':_0x41a001});}function handleQuery(_0x898be){logger[_0x8b6d('0x3d')](_0x898be);return db[_0x8b6d('0x44')]['query'](_0x898be)[_0x8b6d('0x45')](function(_0xb9825c){results[_0x8b6d('0x46')](_0xb9825c);})[_0x8b6d('0x47')](function(_0x66341f){logger['error'](_0x66341f[_0x8b6d('0x43')]);});}function main(_0x5c60e8,_0x1ced64,_0x54edea,_0x3c5f18){logger[_0x8b6d('0x3d')]('main',_0x5c60e8,JSON[_0x8b6d('0x48')](_0x1ced64));process[_0x8b6d('0x49')]('start');var _0x3d2557=_0x1ced64['binding'];var _0x1e2a72=_0x1ced64[_0x8b6d('0x4a')];var _0x214e50=path[_0x8b6d('0x15')](config['root'],_0x8b6d('0x4b'),_0x1e2a72+_0x8b6d('0x4c'));var _0x55a5f5=_[_0x8b6d('0x4d')](_0x3d2557)[_0x8b6d('0x15')]();logger[_0x8b6d('0x3d')](_0x8b6d('0x4e'),_0x55a5f5);fs[_0x8b6d('0x4f')](_0x214e50,_0x55a5f5+'\x0a');Papa['parse'](fs[_0x8b6d('0x50')](_0x5c60e8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x382893,_0x1ddf86){try{for(var _0x3ce31a=0x0,_0x82fb57=[];_0x3ce31a<_0x382893['data'][_0x8b6d('0x51')];_0x3ce31a++){stats[_0x8b6d('0x52')]+=0x1;if(_0x382893[_0x8b6d('0x41')][_0x3ce31a]){handleError(_0x382893[_0x8b6d('0x53')][_0x3ce31a],_0x382893[_0x8b6d('0x41')][_0x3ce31a]);}else{var _0xffbb5c=[];for(var _0x5e870b in _0x3d2557){if(_0x3d2557[_0x8b6d('0x54')](_0x5e870b)){if(_0x382893[_0x8b6d('0x53')][_0x3ce31a][_0x3d2557[_0x5e870b]]){var _0x2750a3=_['trim'](_0x382893[_0x8b6d('0x53')][_0x3ce31a][_0x3d2557[_0x5e870b]][_0x8b6d('0x55')](/"/g,'\x27'));switch(_0x5e870b){case'scheduledat':var _0x45dbb7=moment(_0x2750a3,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x45dbb7[_0x8b6d('0x56')]()){_0x82fb57['push']('\x22'+_0x2750a3+'\x22');}else{_0xffbb5c[_0x8b6d('0x46')](_0x8b6d('0x57'));}break;case'priority':var _0x5ba601=parseInt(_0x2750a3);_0x2750a3=_['isNaN'](_0x5ba601)||_0x5ba601<0x0||_0x5ba601>0x4?_0x3c5f18?0x3:0x2:_0x5ba601;_0x82fb57[_0x8b6d('0x46')]('\x22'+_0x2750a3+'\x22');break;case _0x8b6d('0x23'):var _0x198820=parseInt(_0x2750a3);if(_[_0x8b6d('0x58')](_0x198820)&&_[_0x8b6d('0x59')](_0x54edea,_0x198820)){_0x82fb57[_0x8b6d('0x46')]('\x22'+_0x198820+'\x22');}else{_0xffbb5c[_0x8b6d('0x46')](_0x8b6d('0x5a'));}break;case _0x8b6d('0x5b'):if(isEmail(_0x2750a3)){_0x82fb57[_0x8b6d('0x46')]('\x22'+_0x2750a3+'\x22');}else{_0xffbb5c[_0x8b6d('0x46')](_0x8b6d('0x5c'));}break;case _0x8b6d('0x5d'):var _0x58b1cf=moment(_0x2750a3,_0x8b6d('0x5e'),!![]);if(_0x58b1cf[_0x8b6d('0x56')]()){_0x82fb57[_0x8b6d('0x46')]('\x22'+_0x2750a3+'\x22');}else{_0xffbb5c[_0x8b6d('0x46')](_0x8b6d('0x5f'));}break;default:_0x82fb57[_0x8b6d('0x46')]('\x22'+_0x2750a3+'\x22');}}else{switch(_0x5e870b){case _0x8b6d('0x60'):case _0x8b6d('0x11'):_0xffbb5c['push'](_0x5e870b+'\x20not\x20specified');break;default:_0x82fb57[_0x8b6d('0x46')]('\x22\x22');}}}}if(_0xffbb5c[_0x8b6d('0x51')]){handleError(_0x382893[_0x8b6d('0x53')][_0x3ce31a],{'code':_0x8b6d('0x61'),'message':_0xffbb5c['join']()});}else{fs[_0x8b6d('0x62')](_0x214e50,_0x82fb57['join']()+'\x0a');}_0x82fb57=[];}if(!(stats[_0x8b6d('0x52')]%0xc8)){socket[_0x8b6d('0x63')](_0x8b6d('0x64')+_0x1e2a72,stats);stats[_0x8b6d('0x41')]=[];}}if(stopped){logger[_0x8b6d('0x3d')](_0x8b6d('0x65'));_0x1ddf86[_0x8b6d('0x66')]();}}catch(_0x160d2d){handleError(_0x382893[_0x8b6d('0x53')][_0x3ce31a],{'code':_0x8b6d('0x67'),'message':_0x160d2d[_0x8b6d('0x43')]});logger['error'](_0x8b6d('0x68'),_0x160d2d['message']);}},'complete':function(){try{var _0x1585e6=[];var _0x1cfc6d='cm_contacts';if(_0x1ced64[_0x8b6d('0x69')]&&_0x1ced64['duplicates'][_0x8b6d('0x51')]){_0x1cfc6d='cm_contacts_'+_0x1e2a72;_0x1585e6[_0x8b6d('0x46')]('CREATE\x20TABLE\x20'+_0x1cfc6d+_0x8b6d('0x6a'));}var _0x17d76e=util[_0x8b6d('0xc')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x214e50,_0x1cfc6d,_0x55a5f5,_0x1ced64['ListId'],_0x1ced64['CompanyId']||null,NOW,NOW);if(_[_0x8b6d('0x6b')](_0x3d2557[_0x8b6d('0x6c')])){_0x17d76e+=',\x20scheduledAt\x20=\x20NOW()';}_0x1585e6['push'](_0x17d76e);if(_0x1ced64['duplicates']&&_0x1ced64['duplicates']['length']){_0x1585e6[_0x8b6d('0x46')](insertCmContact(_0x1ced64[_0x8b6d('0x1f')],_0x1cfc6d,_0x1ced64[_0x8b6d('0x69')],_0x3d2557));_0x1585e6[_0x8b6d('0x46')]('DROP\x20TABLE\x20'+_0x1cfc6d+';');}_0x1585e6[_0x8b6d('0x46')](insertCmHopper(_0x1ced64[_0x8b6d('0x1f')],_0x8b6d('0x6d'),_0x8b6d('0x6e'),_0x8b6d('0x6f'),_0x3c5f18));_0x1585e6[_0x8b6d('0x46')](insertCmHopperBlack(_0x1ced64[_0x8b6d('0x1f')],'voice_queues_has_cm_blacklists',_0x8b6d('0x6e'),_0x8b6d('0x6f')));_0x1585e6[_0x8b6d('0x46')](insertCmHopper(_0x1ced64[_0x8b6d('0x1f')],_0x8b6d('0x70'),_0x8b6d('0x71'),_0x8b6d('0x72'),_0x3c5f18));_0x1585e6['push'](insertCmHopperBlack(_0x1ced64['ListId'],_0x8b6d('0x73'),'campaigns',_0x8b6d('0x72')));BPromise[_0x8b6d('0x74')](_0x1585e6,handleQuery)[_0x8b6d('0x75')](function(_0x31dc98){stats[_0x8b6d('0x76')]=!![];stats[_0x8b6d('0x77')]=_0x1ced64['duplicates']&&_0x1ced64[_0x8b6d('0x69')][_0x8b6d('0x51')]?results[0x2][_0x8b6d('0x77')]:results[0x0][_0x8b6d('0x77')];socket[_0x8b6d('0x63')](_0x8b6d('0x64')+_0x1e2a72,stats);fs['unlink'](_0x5c60e8);fs['unlink'](_0x214e50);process['exit'](0x0);})[_0x8b6d('0x47')](function(_0x145777){logger['error'](_0x145777[_0x8b6d('0x43')]);process[_0x8b6d('0x40')](0x1);});}catch(_0x33cc90){logger[_0x8b6d('0x3f')](_0x8b6d('0x78'),_0x33cc90[_0x8b6d('0x43')]);process[_0x8b6d('0x40')](0x1);}},'error':function(_0x83955a,_0x245774,_0x2fe7d6,_0xa3d6fc){throw new Error(_0xa3d6fc);}});}function validate(){if(process[_0x8b6d('0x79')]&&process[_0x8b6d('0x79')][_0x8b6d('0x51')]<0x4){throw new Error(_0x8b6d('0x7a'));}var _0x463ddb=path[_0x8b6d('0x15')](config[_0x8b6d('0x7b')],'server/files/tmp',process[_0x8b6d('0x79')][0x2]);if(!fs[_0x8b6d('0x7c')](_0x463ddb)){throw new Error(_0x8b6d('0x7d'));}var _0x2007bf={};try{_0x2007bf=JSON[_0x8b6d('0x7e')](process[_0x8b6d('0x79')][0x3]);if(!_0x2007bf[_0x8b6d('0x7f')]){throw new Error(_0x8b6d('0x80'));}if(!_0x2007bf[_0x8b6d('0x7f')][_0x8b6d('0x11')]){throw new Error(_0x8b6d('0x81'));}if(!_0x2007bf[_0x8b6d('0x7f')]['firstName']){throw new Error(_0x8b6d('0x82'));}var _0x40337e=0x0;if(_0x2007bf['binding'][_0x8b6d('0x23')]){_0x40337e=0x1;}if(!_0x2007bf[_0x8b6d('0x1f')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x383353){throw new Error(_0x8b6d('0x83'));}var _0x436c7e=[];try{_0x436c7e=_[_0x8b6d('0x84')](JSON[_0x8b6d('0x7e')](process[_0x8b6d('0x79')][0x4]),'id');}catch(_0xf70634){logger[_0x8b6d('0x3d')](_0x8b6d('0x85'));}main(_0x463ddb,_0x2007bf,_0x436c7e,_0x40337e);}validate();process['on'](_0x8b6d('0x86'),handleStop);process['on'](_0x8b6d('0x87'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index d121917..bf1eb7d 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 _0xde41=['[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','outbound','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridnum','Caller\x20Name','calleridname','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','starttime','***\x20Time\x20Info\x20***','Answer\x20Time','answertime','Complete\x20Time','endtime','Billable\x20Time','billableseconds','getSubjects','string'];(function(_0x3ab77c,_0x57f557){var _0x35e4f3=function(_0xb9a8d0){while(--_0xb9a8d0){_0x3ab77c['push'](_0x3ab77c['shift']());}};_0x35e4f3(++_0x57f557);}(_0xde41,0x139));var _0x1de4=function(_0x407473,_0x445697){_0x407473=_0x407473-0x0;var _0x1a2c53=_0xde41[_0x407473];return _0x1a2c53;};'use strict';exports[_0x1de4('0x0')]=function(_0x2c293f,_0x2f80ec){var _0x5c8486=[{'type':_0x1de4('0x1'),'content':_0x1de4('0x2'),'variableName':null}];switch(_0x2c293f[_0x1de4('0x3')]()){case _0x1de4('0x4'):switch(_0x2f80ec['toLowerCase']()){case _0x1de4('0x5'):_0x5c8486[_0x1de4('0x6')]({'type':_0x1de4('0x7'),'content':'','variableName':_0x1de4('0x8')});_0x5c8486[_0x1de4('0x6')]({'type':_0x1de4('0x7'),'content':'','variableName':'calleridnum'});break;case _0x1de4('0x9'):_0x5c8486[_0x1de4('0x6')]({'type':_0x1de4('0x1'),'content':'Outbound\x20Call','variableName':null});_0x5c8486['push']({'type':_0x1de4('0x7'),'content':'','variableName':_0x1de4('0xa')});break;}}return _0x5c8486;};exports[_0x1de4('0xb')]=function(_0x511f3e,_0x2e2903){var _0x22f5c1=[];switch(_0x511f3e[_0x1de4('0x3')]()){case _0x1de4('0x4'):switch(_0x2e2903['toLowerCase']()){case _0x1de4('0x5'):_0x22f5c1=[{'type':_0x1de4('0x1'),'content':_0x1de4('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x1de4('0xd'),'content':'','key':_0x1de4('0xe'),'keyType':_0x1de4('0x7'),'variableName':_0x1de4('0xf')},{'type':_0x1de4('0xd'),'content':'','key':_0x1de4('0x10'),'keyType':_0x1de4('0x7'),'variableName':_0x1de4('0x11')},{'type':_0x1de4('0xd'),'content':'','key':'Call\x20To','keyType':_0x1de4('0x7'),'variableName':_0x1de4('0x12')},{'type':_0x1de4('0xd'),'content':'','key':_0x1de4('0x13'),'keyType':_0x1de4('0x7'),'variableName':'queue'},{'type':_0x1de4('0xd'),'content':'','key':_0x1de4('0x14'),'keyType':_0x1de4('0x7'),'variableName':_0x1de4('0x15')},{'type':_0x1de4('0xd'),'content':'','key':_0x1de4('0x16'),'keyType':_0x1de4('0x7'),'variableName':_0x1de4('0x17')},{'type':_0x1de4('0x1'),'content':_0x1de4('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x1de4('0xd'),'content':'','key':_0x1de4('0x19'),'keyType':_0x1de4('0x7'),'variableName':_0x1de4('0x1a')},{'type':_0x1de4('0xd'),'content':'','key':'Agent\x20Number','keyType':'variable','variableName':_0x1de4('0xa')},{'type':'string','content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x1de4('0x1b'),'keyType':_0x1de4('0x7'),'variableName':_0x1de4('0x17')},{'type':'keyValue','content':'','key':_0x1de4('0x1c'),'keyType':_0x1de4('0x7'),'variableName':_0x1de4('0x1d')},{'type':_0x1de4('0xd'),'content':'','key':_0x1de4('0x1e'),'keyType':_0x1de4('0x7'),'variableName':_0x1de4('0x1f')},{'type':_0x1de4('0xd'),'content':'','key':'Hold\x20Time','keyType':_0x1de4('0x7'),'variableName':_0x1de4('0x20')},{'type':_0x1de4('0xd'),'content':'','key':_0x1de4('0x21'),'keyType':'variable','variableName':_0x1de4('0x22')}];break;case'outbound':_0x22f5c1=[{'type':_0x1de4('0x1'),'content':_0x1de4('0xc'),'variableName':null},{'type':_0x1de4('0xd'),'content':'','key':_0x1de4('0x23'),'keyType':'variable','keyContent':'','variableName':_0x1de4('0xa')},{'type':'keyValue','content':'','key':_0x1de4('0x24'),'keyType':_0x1de4('0x7'),'keyContent':'','variableName':'membername'},{'type':_0x1de4('0xd'),'content':'','key':'UniqueId','keyType':'variable','keyContent':'','variableName':_0x1de4('0x15')},{'type':_0x1de4('0xd'),'content':'','key':_0x1de4('0x16'),'keyType':_0x1de4('0x7'),'keyContent':'','variableName':_0x1de4('0x25')},{'type':_0x1de4('0x1'),'content':_0x1de4('0x26')},{'type':_0x1de4('0xd'),'content':'','key':_0x1de4('0x27'),'keyType':_0x1de4('0x7'),'keyContent':'','variableName':_0x1de4('0x28')},{'type':'keyValue','content':'','key':_0x1de4('0x29'),'keyType':_0x1de4('0x7'),'keyContent':'','variableName':_0x1de4('0x2a')},{'type':'keyValue','content':'','key':'Duration','keyType':_0x1de4('0x7'),'keyContent':'','variableName':'duration'},{'type':_0x1de4('0xd'),'content':'','key':_0x1de4('0x2b'),'keyType':'variable','keyContent':'','variableName':_0x1de4('0x2c')}];break;}}return _0x22f5c1;}; \ No newline at end of file +var _0xee8d=['toLowerCase','inbound','push','variable','queue','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','string','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','Date','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','Agent\x20Ring','agentcalledAt','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','Called\x20Number','Member\x20Name','UniqueId','uniqueid','starttime','***\x20Time\x20Info\x20***','Answer\x20Time','endtime','duration','billableseconds','getSubjects','[xCALLY\x20Ticket]','voice'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xee8d,0x192));var _0xdee8=function(_0x519619,_0x27480a){_0x519619=_0x519619-0x0;var _0xc3a308=_0xee8d[_0x519619];return _0xc3a308;};'use strict';exports[_0xdee8('0x0')]=function(_0xa9edb4,_0xdc53ee){var _0x4df887=[{'type':'string','content':_0xdee8('0x1'),'variableName':null}];switch(_0xa9edb4['toLowerCase']()){case _0xdee8('0x2'):switch(_0xdc53ee[_0xdee8('0x3')]()){case _0xdee8('0x4'):_0x4df887[_0xdee8('0x5')]({'type':_0xdee8('0x6'),'content':'','variableName':_0xdee8('0x7')});_0x4df887[_0xdee8('0x5')]({'type':_0xdee8('0x6'),'content':'','variableName':'calleridnum'});break;case _0xdee8('0x8'):_0x4df887[_0xdee8('0x5')]({'type':'string','content':_0xdee8('0x9'),'variableName':null});_0x4df887[_0xdee8('0x5')]({'type':'variable','content':'','variableName':_0xdee8('0xa')});break;}}return _0x4df887;};exports[_0xdee8('0xb')]=function(_0x3b2f8f,_0x340622){var _0x3373ff=[];switch(_0x3b2f8f[_0xdee8('0x3')]()){case'voice':switch(_0x340622[_0xdee8('0x3')]()){case'inbound':_0x3373ff=[{'type':_0xdee8('0xc'),'content':_0xdee8('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0xdee8('0xe'),'content':'','key':_0xdee8('0xf'),'keyType':_0xdee8('0x6'),'variableName':'calleridnum'},{'type':_0xdee8('0xe'),'content':'','key':_0xdee8('0x10'),'keyType':_0xdee8('0x6'),'variableName':_0xdee8('0x11')},{'type':_0xdee8('0xe'),'content':'','key':_0xdee8('0x12'),'keyType':'variable','variableName':_0xdee8('0x13')},{'type':_0xdee8('0xe'),'content':'','key':_0xdee8('0x14'),'keyType':_0xdee8('0x6'),'variableName':_0xdee8('0x7')},{'type':_0xdee8('0xe'),'content':'','key':'UniqueId','keyType':_0xdee8('0x6'),'variableName':'uniqueid'},{'type':_0xdee8('0xe'),'content':'','key':_0xdee8('0x15'),'keyType':_0xdee8('0x6'),'variableName':'agentcalledAt'},{'type':'string','content':_0xdee8('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0xdee8('0xe'),'content':'','key':_0xdee8('0x17'),'keyType':_0xdee8('0x6'),'variableName':_0xdee8('0x18')},{'type':_0xdee8('0xe'),'content':'','key':_0xdee8('0x19'),'keyType':'variable','variableName':_0xdee8('0xa')},{'type':_0xdee8('0xc'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xdee8('0xe'),'content':'','key':_0xdee8('0x1a'),'keyType':'variable','variableName':_0xdee8('0x1b')},{'type':_0xdee8('0xe'),'content':'','key':_0xdee8('0x1c'),'keyType':'variable','variableName':_0xdee8('0x1d')},{'type':_0xdee8('0xe'),'content':'','key':_0xdee8('0x1e'),'keyType':_0xdee8('0x6'),'variableName':_0xdee8('0x1f')},{'type':'keyValue','content':'','key':_0xdee8('0x20'),'keyType':_0xdee8('0x6'),'variableName':_0xdee8('0x21')},{'type':'keyValue','content':'','key':_0xdee8('0x22'),'keyType':_0xdee8('0x6'),'variableName':'talktime'}];break;case _0xdee8('0x8'):_0x3373ff=[{'type':_0xdee8('0xc'),'content':_0xdee8('0xd'),'variableName':null},{'type':_0xdee8('0xe'),'content':'','key':_0xdee8('0x23'),'keyType':_0xdee8('0x6'),'keyContent':'','variableName':'destcalleridnum'},{'type':'keyValue','content':'','key':_0xdee8('0x24'),'keyType':_0xdee8('0x6'),'keyContent':'','variableName':'membername'},{'type':'keyValue','content':'','key':_0xdee8('0x25'),'keyType':'variable','keyContent':'','variableName':_0xdee8('0x26')},{'type':_0xdee8('0xe'),'content':'','key':_0xdee8('0x15'),'keyType':'variable','keyContent':'','variableName':_0xdee8('0x27')},{'type':_0xdee8('0xc'),'content':_0xdee8('0x28')},{'type':'keyValue','content':'','key':_0xdee8('0x29'),'keyType':'variable','keyContent':'','variableName':'answertime'},{'type':_0xdee8('0xe'),'content':'','key':'Complete\x20Time','keyType':'variable','keyContent':'','variableName':_0xdee8('0x2a')},{'type':'keyValue','content':'','key':'Duration','keyType':_0xdee8('0x6'),'keyContent':'','variableName':_0xdee8('0x2b')},{'type':'keyValue','content':'','key':'Billable\x20Time','keyType':_0xdee8('0x6'),'keyContent':'','variableName':_0xdee8('0x2c')}];break;}}return _0x3373ff;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 9307fd1..264e264 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 _0x2c06=['phone','fax','mobile','lodash','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','null','then','update','info','catch','error','tracked','query','clone','body','omit'];(function(_0x4b9604,_0x1f5a6f){var _0xde6b89=function(_0xb6422f){while(--_0xb6422f){_0x4b9604['push'](_0x4b9604['shift']());}};_0xde6b89(++_0x1f5a6f);}(_0x2c06,0xb1));var _0x62c0=function(_0x43ab71,_0x24e9f3){_0x43ab71=_0x43ab71-0x0;var _0x353b2c=_0x2c06[_0x43ab71];return _0x353b2c;};'use strict';var _=require(_0x62c0('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x62c0('0x1'))(_0x62c0('0x2')),'mail':require('../../config/logger')(_0x62c0('0x3')),'fax':require(_0x62c0('0x1'))(_0x62c0('0x4')),'sms':require(_0x62c0('0x1'))(_0x62c0('0x5')),'chat':require(_0x62c0('0x1'))(_0x62c0('0x6')),'whatsapp':require(_0x62c0('0x1'))(_0x62c0('0x7'))};function getInteractionId(_0x159d4a,_0x36380b,_0x237924){if(_0x159d4a&&_0x159d4a[_[_0x62c0('0x8')](_0x237924)+_0x62c0('0x9')]){return _0x159d4a[_['upperFirst'](_0x237924)+_0x62c0('0x9')];}else if(_0x159d4a&&_0x159d4a['id']){return _0x159d4a['id'];}else if(_0x36380b&&_0x36380b['id']){return _0x36380b['id'];}else{return _0x62c0('0xa');}}function log(_0x1b7053,_0x531c63,_0x152fb8,_0x15a391,_0xecee26,_0x503bfe){loggers[_0xecee26[_0x62c0('0xb')]()][_0x1b7053](_0x62c0('0xc'),_0x503bfe[_0x62c0('0xd')](),_0x531c63?_0x531c63['id']:null,_0x531c63?_0x531c63['name']:null,_0x531c63?_0x531c63[_0x62c0('0xe')]:null,getInteractionId(_0x152fb8,_0x15a391,_0xecee26),_0x152fb8?JSON['stringify'](_0x152fb8):_0x62c0('0xf'));}function updateUser(_0xac92a,_0x50ce1a,_0x5baf35,_0x516d9b,_0x3c4202){db[_['upperFirst'](_0x516d9b)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x50ce1a,_0x5baf35,_0x516d9b)}})[_0x62c0('0x10')](function(_0x424d47){if(_0x424d47){return _0x424d47[_0x62c0('0x11')]({'UserId':_0xac92a?_0xac92a['id']:null});}})[_0x62c0('0x10')](function(_0x4ff05){if(_0x4ff05){log(_0x62c0('0x12'),_0xac92a,_0x50ce1a,_0x5baf35,_0x516d9b,_0x3c4202);}})[_0x62c0('0x13')](function(){log(_0x62c0('0x14'),_0xac92a,_0x50ce1a,_0x5baf35,_0x516d9b,_0x3c4202);});}exports[_0x62c0('0x15')]=function(_0x363807,_0x4cfb38){return function(_0x2992b1,_0x1c9078,_0x41c06e){var _0x35c482=_0x2992b1['user'];var _0x7d048f={};var _0x4f3b63=_0x2992b1[_0x62c0('0x16')];if(_0x7d048f){_0x7d048f=_[_0x62c0('0x17')](_0x2992b1[_0x62c0('0x18')]);_0x7d048f=_[_0x62c0('0x19')](_0x7d048f,['body','html',_0x62c0('0x1a'),_0x62c0('0x1b'),_0x62c0('0x1c')]);}updateUser(_0x35c482,_0x7d048f,_0x4f3b63,_0x363807,_0x4cfb38);_0x41c06e(null);};}; \ No newline at end of file +var _0x922a=['update','info','catch','error','tracked','user','clone','body','omit','lodash','../../mysqldb','openchannel-interactions','../../config/logger','upperFirst','InteractionId','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','Interaction','then'];(function(_0x4067e6,_0x542b51){var _0x35c1db=function(_0x1c8241){while(--_0x1c8241){_0x4067e6['push'](_0x4067e6['shift']());}};_0x35c1db(++_0x542b51);}(_0x922a,0x179));var _0xa922=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x922a[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0xa922('0x0'));var db=require(_0xa922('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0xa922('0x2')),'mail':require(_0xa922('0x3'))('mail-interactions'),'fax':require(_0xa922('0x3'))('fax-interactions'),'sms':require(_0xa922('0x3'))('sms-interactions'),'chat':require(_0xa922('0x3'))('chat-interactions'),'whatsapp':require(_0xa922('0x3'))('whatsapp-interactions')};function getInteractionId(_0x582b90,_0x5fa963,_0x58e447){if(_0x582b90&&_0x582b90[_[_0xa922('0x4')](_0x58e447)+_0xa922('0x5')]){return _0x582b90[_[_0xa922('0x4')](_0x58e447)+_0xa922('0x5')];}else if(_0x582b90&&_0x582b90['id']){return _0x582b90['id'];}else if(_0x5fa963&&_0x5fa963['id']){return _0x5fa963['id'];}else{return _0xa922('0x6');}}function log(_0x34367f,_0x45bfbe,_0x4aa164,_0x1b1dbe,_0x2dac2a,_0x5dd892){loggers[_0x2dac2a['toLowerCase']()][_0x34367f](_0xa922('0x7'),_0x5dd892[_0xa922('0x8')](),_0x45bfbe?_0x45bfbe['id']:null,_0x45bfbe?_0x45bfbe[_0xa922('0x9')]:null,_0x45bfbe?_0x45bfbe[_0xa922('0xa')]:null,getInteractionId(_0x4aa164,_0x1b1dbe,_0x2dac2a),_0x4aa164?JSON[_0xa922('0xb')](_0x4aa164):'null');}function updateUser(_0x1c8fbc,_0x2fa8d1,_0x5d7631,_0x47f53e,_0x37a38b){db[_[_0xa922('0x4')](_0x47f53e)+_0xa922('0xc')]['findOne']({'where':{'id':getInteractionId(_0x2fa8d1,_0x5d7631,_0x47f53e)}})[_0xa922('0xd')](function(_0x5b0d88){if(_0x5b0d88){return _0x5b0d88[_0xa922('0xe')]({'UserId':_0x1c8fbc?_0x1c8fbc['id']:null});}})['then'](function(_0xa66fdd){if(_0xa66fdd){log(_0xa922('0xf'),_0x1c8fbc,_0x2fa8d1,_0x5d7631,_0x47f53e,_0x37a38b);}})[_0xa922('0x10')](function(){log(_0xa922('0x11'),_0x1c8fbc,_0x2fa8d1,_0x5d7631,_0x47f53e,_0x37a38b);});}exports[_0xa922('0x12')]=function(_0x1d60cf,_0x396bc1){return function(_0x176c52,_0x4112d7,_0x34fd38){var _0xd255b=_0x176c52[_0xa922('0x13')];var _0x120ebe={};var _0x429837=_0x176c52['query'];if(_0x120ebe){_0x120ebe=_[_0xa922('0x14')](_0x176c52[_0xa922('0x15')]);_0x120ebe=_[_0xa922('0x16')](_0x120ebe,[_0xa922('0x15'),'html','phone','fax','mobile']);}updateUser(_0xd255b,_0x120ebe,_0x429837,_0x1d60cf,_0x396bc1);_0x34fd38(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 577a75f..1743376 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 _0x0ebf=['../../mysqldb','../../config/environment','data1','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','parse','hasOwnProperty','use','License','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','user','isUserLimit','crypto'];(function(_0x24e2a3,_0x534875){var _0x3e82f4=function(_0x48a8ee){while(--_0x48a8ee){_0x24e2a3['push'](_0x24e2a3['shift']());}};_0x3e82f4(++_0x534875);}(_0x0ebf,0x14f));var _0xf0eb=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0x0ebf[_0x3430aa];return _0x2ac5c;};'use strict';var crypto=require(_0xf0eb('0x0'));var util=require('util');var compose=require('composable-middleware');var db=require(_0xf0eb('0x1'))['db'];var config=require(_0xf0eb('0x2'));function getValueFromLicense(_0x3d790b,_0x1b72f5){if(_0x3d790b&&_0x1b72f5){if(_0x1b72f5['data1']&&_0x1b72f5['license']){var _0x1413cb=_0x1b72f5[_0xf0eb('0x3')];var _0x37f7c0=_0x1b72f5['license'];var _0x3c4fbe=_0x1413cb['split']('-')[0x4];var _0x5aa5fb=_0x1413cb[_0xf0eb('0x4')]('-')[0x0];var _0x482bf4=crypto['createDecipher'](_0xf0eb('0x5'),util[_0xf0eb('0x6')](_0xf0eb('0x7'),_0x3c4fbe,_0x1413cb,_0x5aa5fb));var _0x5ef94e=_0x482bf4[_0xf0eb('0x8')](_0x37f7c0,_0xf0eb('0x9'),_0xf0eb('0xa'));_0x5ef94e+=_0x482bf4['final'](_0xf0eb('0xa'));var _0x4ec098=JSON[_0xf0eb('0xb')](_0x5ef94e);return _0x4ec098[_0xf0eb('0xc')](_0x3d790b)?_0x4ec098[_0x3d790b]:null;}}return null;}function isLimit(_0x47cda7,_0x107ea5,_0x5a927d,_0xed95cb){var _0x2b4c06=_0x107ea5;return compose()[_0xf0eb('0xd')](function(_0x335c89,_0x32b4dc,_0x14952d){return db[_0xf0eb('0xe')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x467160){var _0x19ceaa=getValueFromLicense(_0x47cda7,_0x467160);return _0x19ceaa?_0x19ceaa:_0x2b4c06;})[_0xf0eb('0xf')](function(_0xde1e52){_0x2b4c06=_0xde1e52;return _0x5a927d[_0xf0eb('0x10')](_0xed95cb);})[_0xf0eb('0xf')](function(_0xf5d4dc){if(_0xf5d4dc>=_0x2b4c06){return _0x32b4dc[_0xf0eb('0x11')](0x193)['json']({'message':util[_0xf0eb('0x6')](_0xf0eb('0x12'),_0x47cda7)});}_0x14952d();})[_0xf0eb('0x13')](function(_0x1db427){_0x14952d(_0x1db427);});});}function isUserLimit(){return isLimit(_0xf0eb('0x14'),0x1,db['User'],{'where':{'$or':[{'role':_0xf0eb('0x15')},{'role':_0xf0eb('0x16')}]}});}exports[_0xf0eb('0x17')]=isUserLimit; \ No newline at end of file +var _0x5c99=['status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','format','update','base64','utf8','use','License','then'];(function(_0x1191b3,_0x4da0c7){var _0x3fb66e=function(_0x499f9c){while(--_0x499f9c){_0x1191b3['push'](_0x1191b3['shift']());}};_0x3fb66e(++_0x4da0c7);}(_0x5c99,0x190));var _0x95c9=function(_0x27669b,_0x306a2c){_0x27669b=_0x27669b-0x0;var _0x31ed6e=_0x5c99[_0x27669b];return _0x31ed6e;};'use strict';var crypto=require('crypto');var util=require(_0x95c9('0x0'));var compose=require(_0x95c9('0x1'));var db=require(_0x95c9('0x2'))['db'];var config=require(_0x95c9('0x3'));function getValueFromLicense(_0x26c56d,_0x10e5e9){if(_0x26c56d&&_0x10e5e9){if(_0x10e5e9[_0x95c9('0x4')]&&_0x10e5e9[_0x95c9('0x5')]){var _0x4efe47=_0x10e5e9[_0x95c9('0x4')];var _0x5e112e=_0x10e5e9[_0x95c9('0x5')];var _0x560f8a=_0x4efe47[_0x95c9('0x6')]('-')[0x4];var _0x107218=_0x4efe47['split']('-')[0x0];var _0x2fa525=crypto['createDecipher']('aes-256-ctr',util[_0x95c9('0x7')]('%s:%s:%s',_0x560f8a,_0x4efe47,_0x107218));var _0x36df8d=_0x2fa525[_0x95c9('0x8')](_0x5e112e,_0x95c9('0x9'),_0x95c9('0xa'));_0x36df8d+=_0x2fa525['final'](_0x95c9('0xa'));var _0x145da0=JSON['parse'](_0x36df8d);return _0x145da0['hasOwnProperty'](_0x26c56d)?_0x145da0[_0x26c56d]:null;}}return null;}function isLimit(_0x55a349,_0x1f878d,_0x3408d9,_0x2b2578){var _0x579907=_0x1f878d;return compose()[_0x95c9('0xb')](function(_0x719dfb,_0xc92c33,_0x233beb){return db[_0x95c9('0xc')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x95c9('0xd')](function(_0x732639){var _0x4cca9e=getValueFromLicense(_0x55a349,_0x732639);return _0x4cca9e?_0x4cca9e:_0x579907;})[_0x95c9('0xd')](function(_0x36305b){_0x579907=_0x36305b;return _0x3408d9['count'](_0x2b2578);})[_0x95c9('0xd')](function(_0x5ea946){if(_0x5ea946>=_0x579907){return _0xc92c33[_0x95c9('0xe')](0x193)[_0x95c9('0xf')]({'message':util[_0x95c9('0x7')](_0x95c9('0x10'),_0x55a349)});}_0x233beb();})[_0x95c9('0x11')](function(_0x1d8747){_0x233beb(_0x1d8747);});});}function isUserLimit(){return isLimit(_0x95c9('0x12'),0x1,db[_0x95c9('0x13')],{'where':{'$or':[{'role':_0x95c9('0x14')},{'role':_0x95c9('0x15')}]}});}exports[_0x95c9('0x16')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 78bc46d..68c3f01 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 _0xb4cc=['minutes','seconds','lodash','sqlOperator','startsWith','replace','[$and]','[$or]','split','slice','forEach','filter','indexOf','map','conditions','DATE','operator','$eq','$between','value','includes','$gt','$lte','days','format','YYYY-MM-DD','castTo','text','CAST(','\x20AS\x20','field','$in','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','$ne','$substring','$startsWith','$endsWith','$lt','>\x20?','<=\x20?','$gte','>=\x20?','start','pop','utcOffset','add'];(function(_0x675ec9,_0x574ece){var _0x5ebe43=function(_0x4bbfe8){while(--_0x4bbfe8){_0x675ec9['push'](_0x675ec9['shift']());}};_0x5ebe43(++_0x574ece);}(_0xb4cc,0x95));var _0xcb4c=function(_0x2714ec,_0x36daa4){_0x2714ec=_0x2714ec-0x0;var _0x2608e5=_0xb4cc[_0x2714ec];return _0x2608e5;};'use strict';var _=require(_0xcb4c('0x0'));var moment=require('moment');exports['parseSearch']=function(_0x2d7f03){var _0x46e8b1={'conditions':[]};_0x46e8b1[_0xcb4c('0x1')]=_[_0xcb4c('0x2')](_0x2d7f03,'[$or]')?'or':'and';var _0x201975=_0x2d7f03[_0xcb4c('0x3')](_0xcb4c('0x4'),'')['replace'](_0xcb4c('0x5'),'')['split']('||');for(var _0x1ed694=0x0;_0x1ed694<_0x201975['length'];_0x1ed694++){var _0x50365e=_0x201975[_0x1ed694][_0xcb4c('0x6')](':=');var _0x298d0e=_0x50365e[0x0];var _0x34311a=_0x50365e[_0xcb4c('0x7')](0x1);_0x34311a[_0xcb4c('0x8')](function(_0x5c2cd8){var _0x44d58b=_0x5c2cd8[_0xcb4c('0x6')]('[')['shift']();var _0x3bbe35=_0x5c2cd8['match'](/\[(.*?)\]/g);_0x3bbe35[_0xcb4c('0x8')](function(_0x54cb95){var _0x2dd4d9=_0x54cb95[_0xcb4c('0x6')]('[')[_0xcb4c('0x9')](function(_0x4d7f5a){return _0x4d7f5a[_0xcb4c('0xa')](']')>-0x1;})[_0xcb4c('0xb')](function(_0x1f81a7){return _0x1f81a7[_0xcb4c('0x6')](']')[0x0];})[0x0];_0x46e8b1[_0xcb4c('0xc')]['push']({'field':_0x298d0e,'operator':_0x44d58b,'value':_0x2dd4d9});});});}return _0x46e8b1;};exports['buildExpression']=function(_0x30dfbc,_0x2a9a58,_0x276da0){var _0xbda4d0={};if(_0x2a9a58===_0xcb4c('0xd')){if(_0x276da0[_0xcb4c('0xe')]===_0xcb4c('0xf')){_0x276da0['operator']=_0xcb4c('0x10');_0x276da0['value']+=','+_0x276da0[_0xcb4c('0x11')];}else if(_[_0xcb4c('0x12')]([_0xcb4c('0x13'),_0xcb4c('0x14')],_0x276da0['operator'])){_0x276da0[_0xcb4c('0x11')]=moment(_0x276da0[_0xcb4c('0x11')])['add'](0x1,_0xcb4c('0x15'))[_0xcb4c('0x16')](_0xcb4c('0x17'));}}if(_0x276da0[_0xcb4c('0x18')]){_0x2a9a58=_0x276da0[_0xcb4c('0x18')];_0xbda4d0[_0xcb4c('0x19')]=_0xcb4c('0x1a')+_0x30dfbc+'.'+_0x276da0['field']+_0xcb4c('0x1b')+_0x276da0[_0xcb4c('0x18')]+')\x20'+parseOperator(_0x276da0[_0xcb4c('0xe')]);}else{_0xbda4d0[_0xcb4c('0x19')]=_0x30dfbc+'.'+_0x276da0['field']+'\x20'+parseOperator(_0x276da0[_0xcb4c('0xe')]);}if(_[_0xcb4c('0x12')](['$ne','$notIn'],_0x276da0[_0xcb4c('0xe')]))_0xbda4d0[_0xcb4c('0x19')]='('+_0xbda4d0[_0xcb4c('0x19')]+'\x20OR\x20'+_0x30dfbc+'.'+_0x276da0[_0xcb4c('0x1c')]+'\x20IS\x20NULL)';_0xbda4d0[_0xcb4c('0x11')]=parseValue(_0x2a9a58,_0x276da0[_0xcb4c('0xe')],_0x276da0[_0xcb4c('0x11')]);return _0xbda4d0;};function parseOperator(_0x101323){var _0x4a5f95;switch(_0x101323){case _0xcb4c('0x1d'):_0x4a5f95=_0xcb4c('0x1e');break;case _0xcb4c('0x1f'):_0x4a5f95=_0xcb4c('0x20');break;case _0xcb4c('0xf'):_0x4a5f95=_0xcb4c('0x21');break;case _0xcb4c('0x22'):_0x4a5f95='<>\x20?';break;case _0xcb4c('0x23'):case _0xcb4c('0x24'):case _0xcb4c('0x25'):_0x4a5f95='LIKE\x20?';break;case _0xcb4c('0x26'):_0x4a5f95='<\x20?';break;case _0xcb4c('0x13'):_0x4a5f95=_0xcb4c('0x27');break;case _0xcb4c('0x14'):_0x4a5f95=_0xcb4c('0x28');break;case _0xcb4c('0x29'):_0x4a5f95=_0xcb4c('0x2a');break;case'$between':_0x4a5f95='BETWEEN\x20?\x20AND\x20?';break;}return _0x4a5f95;}function parseValue(_0x51496d,_0x3b0bbc,_0x4435c){var _0x8ccce2={'start':undefined,'end':undefined};switch(_0x3b0bbc){case _0xcb4c('0x1d'):case _0xcb4c('0x1f'):_0x8ccce2[_0xcb4c('0x2b')]=_0x4435c[_0xcb4c('0x6')](',');break;case _0xcb4c('0x23'):_0x8ccce2[_0xcb4c('0x2b')]='%'+_0x4435c+'%';break;case _0xcb4c('0x24'):_0x8ccce2['start']=_0x4435c+'%';break;case _0xcb4c('0x25'):_0x8ccce2['start']='%'+_0x4435c;break;case _0xcb4c('0x10'):var _0x172a64=_0x4435c[_0xcb4c('0x6')](',');var _0x4435c=_0x172a64['shift']();var _0x6fc89c=_0x172a64[_0xcb4c('0x2c')]();if(_0x51496d==='DATE'){_0x4435c=moment(_0x4435c)['utcOffset'](0x0,!![])[_0xcb4c('0x16')]();_0x6fc89c=moment(_0x6fc89c)[_0xcb4c('0x2d')](0x0,!![])[_0xcb4c('0x2e')](0x17,'hours')[_0xcb4c('0x2e')](0x3b,_0xcb4c('0x2f'))['add'](0x3b,_0xcb4c('0x30'))[_0xcb4c('0x16')]();}_0x8ccce2={'start':_0x4435c,'end':_0x6fc89c};break;default:_0x8ccce2[_0xcb4c('0x2b')]=_0x4435c;break;}return _0x8ccce2;} \ No newline at end of file +var _0x5879=['moment','parseSearch','and','[$and]','replace','[$or]','split','slice','shift','match','forEach','filter','map','conditions','push','buildExpression','operator','$eq','$between','value','includes','$lte','days','castTo','text','CAST(','field','\x20AS\x20','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','$ne','<>\x20?','$startsWith','$endsWith','LIKE\x20?','$lt','>\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$substring','pop','DATE','utcOffset','format','minutes','add','lodash'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x5879,0x1ca));var _0x9587=function(_0x45d970,_0x3eab2f){_0x45d970=_0x45d970-0x0;var _0x478bee=_0x5879[_0x45d970];return _0x478bee;};'use strict';var _=require(_0x9587('0x0'));var moment=require(_0x9587('0x1'));exports[_0x9587('0x2')]=function(_0x5a4793){var _0x8e539b={'conditions':[]};_0x8e539b['sqlOperator']=_['startsWith'](_0x5a4793,'[$or]')?'or':_0x9587('0x3');var _0x525958=_0x5a4793['replace'](_0x9587('0x4'),'')[_0x9587('0x5')](_0x9587('0x6'),'')[_0x9587('0x7')]('||');for(var _0x4ae2aa=0x0;_0x4ae2aa<_0x525958['length'];_0x4ae2aa++){var _0x28a914=_0x525958[_0x4ae2aa][_0x9587('0x7')](':=');var _0x5b7834=_0x28a914[0x0];var _0x5a4221=_0x28a914[_0x9587('0x8')](0x1);_0x5a4221['forEach'](function(_0x55e248){var _0x444348=_0x55e248[_0x9587('0x7')]('[')[_0x9587('0x9')]();var _0x4d9c4a=_0x55e248[_0x9587('0xa')](/\[(.*?)\]/g);_0x4d9c4a[_0x9587('0xb')](function(_0x197d8e){var _0x559f17=_0x197d8e[_0x9587('0x7')]('[')[_0x9587('0xc')](function(_0xa303f2){return _0xa303f2['indexOf'](']')>-0x1;})[_0x9587('0xd')](function(_0x51b4db){return _0x51b4db['split'](']')[0x0];})[0x0];_0x8e539b[_0x9587('0xe')][_0x9587('0xf')]({'field':_0x5b7834,'operator':_0x444348,'value':_0x559f17});});});}return _0x8e539b;};exports[_0x9587('0x10')]=function(_0x543d4b,_0x1673fe,_0x52da41){var _0x3c8bea={};if(_0x1673fe==='DATE'){if(_0x52da41[_0x9587('0x11')]===_0x9587('0x12')){_0x52da41[_0x9587('0x11')]=_0x9587('0x13');_0x52da41[_0x9587('0x14')]+=','+_0x52da41['value'];}else if(_[_0x9587('0x15')](['$gt',_0x9587('0x16')],_0x52da41['operator'])){_0x52da41[_0x9587('0x14')]=moment(_0x52da41[_0x9587('0x14')])['add'](0x1,_0x9587('0x17'))['format']('YYYY-MM-DD');}}if(_0x52da41['castTo']){_0x1673fe=_0x52da41[_0x9587('0x18')];_0x3c8bea[_0x9587('0x19')]=_0x9587('0x1a')+_0x543d4b+'.'+_0x52da41[_0x9587('0x1b')]+_0x9587('0x1c')+_0x52da41['castTo']+')\x20'+parseOperator(_0x52da41['operator']);}else{_0x3c8bea[_0x9587('0x19')]=_0x543d4b+'.'+_0x52da41['field']+'\x20'+parseOperator(_0x52da41[_0x9587('0x11')]);}if(_[_0x9587('0x15')](['$ne',_0x9587('0x1d')],_0x52da41[_0x9587('0x11')]))_0x3c8bea[_0x9587('0x19')]='('+_0x3c8bea[_0x9587('0x19')]+_0x9587('0x1e')+_0x543d4b+'.'+_0x52da41[_0x9587('0x1b')]+_0x9587('0x1f');_0x3c8bea['value']=parseValue(_0x1673fe,_0x52da41[_0x9587('0x11')],_0x52da41[_0x9587('0x14')]);return _0x3c8bea;};function parseOperator(_0x1f3cfa){var _0x1a8895;switch(_0x1f3cfa){case _0x9587('0x20'):_0x1a8895='IN\x20?';break;case _0x9587('0x1d'):_0x1a8895=_0x9587('0x21');break;case _0x9587('0x12'):_0x1a8895='=\x20?';break;case _0x9587('0x22'):_0x1a8895=_0x9587('0x23');break;case'$substring':case _0x9587('0x24'):case _0x9587('0x25'):_0x1a8895=_0x9587('0x26');break;case _0x9587('0x27'):_0x1a8895='<\x20?';break;case'$gt':_0x1a8895=_0x9587('0x28');break;case _0x9587('0x16'):_0x1a8895='<=\x20?';break;case'$gte':_0x1a8895=_0x9587('0x29');break;case _0x9587('0x13'):_0x1a8895=_0x9587('0x2a');break;}return _0x1a8895;}function parseValue(_0x342619,_0xaa9622,_0x44f767){var _0xf778cf={'start':undefined,'end':undefined};switch(_0xaa9622){case'$in':case _0x9587('0x1d'):_0xf778cf[_0x9587('0x2b')]=_0x44f767[_0x9587('0x7')](',');break;case _0x9587('0x2c'):_0xf778cf[_0x9587('0x2b')]='%'+_0x44f767+'%';break;case'$startsWith':_0xf778cf[_0x9587('0x2b')]=_0x44f767+'%';break;case _0x9587('0x25'):_0xf778cf['start']='%'+_0x44f767;break;case'$between':var _0x3f75e1=_0x44f767['split'](',');var _0x44f767=_0x3f75e1[_0x9587('0x9')]();var _0x466378=_0x3f75e1[_0x9587('0x2d')]();if(_0x342619===_0x9587('0x2e')){_0x44f767=moment(_0x44f767)[_0x9587('0x2f')](0x0,!![])[_0x9587('0x30')]();_0x466378=moment(_0x466378)[_0x9587('0x2f')](0x0,!![])['add'](0x17,'hours')['add'](0x3b,_0x9587('0x31'))[_0x9587('0x32')](0x3b,'seconds')[_0x9587('0x30')]();}_0xf778cf={'start':_0x44f767,'end':_0x466378};break;default:_0xf778cf[_0x9587('0x2b')]=_0x44f767;break;}return _0xf778cf;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 65820cb..ca48837 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 _0xd760=['indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','isObject','isString','length','unset','hasOwnProperty','isNumeric','isEmail','match','getFullTextValue','forEach','replace','push','join','getOptions','query','$id','attributes','intersection','model','nolimit','order','where','pick','filter','merge','VIRTUAL','lower','options','lodash','sequelize','moment','keys','includes','parse','fields','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','split','limit','offset','sort','map'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xd760,0x125));var _0x0d76=function(_0x2e2bc0,_0x4f5ef5){_0x2e2bc0=_0x2e2bc0-0x0;var _0x29eff5=_0xd760[_0x2e2bc0];return _0x29eff5;};'use strict';var _=require(_0x0d76('0x0'));var sequelize=require(_0x0d76('0x1'));var moment=require(_0x0d76('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x371395){var _0x4ff413=['ne'];try{var _0x85f58=JSON['parse'](_0x371395);var _0x1fd666=Object[_0x0d76('0x3')](_0x85f58)[0x0];return _0x4ff413[_0x0d76('0x4')](_0x1fd666);}catch(_0x458459){return![];}}function getOperatorValue(_0x31f4f1){var _0x1fa837=JSON[_0x0d76('0x5')](_0x31f4f1);var _0x9264d4=Object['keys'](_0x1fa837)[0x0];var _0x4bae37=_0x1fa837[_0x9264d4];return{['$'+_0x9264d4]:_0x4bae37};}exports[_0x0d76('0x6')]=function(_0x4ce167){var _0x59adb6=null;if(_0x4ce167){_0x59adb6=_0x4ce167['split'](',');}return _0x59adb6;};exports[_0x0d76('0x7')]=function(_0x3438ab,_0x13f8a4){var _0x427bbd={};if(!_[_0x0d76('0x8')](_0x3438ab)){_[_0x0d76('0x9')](_0x3438ab,function(_0x523587,_0x2c3654){try{if(_0x13f8a4){var _0x139cff=_[_0x0d76('0xa')](_0x13f8a4,{'name':_0x2c3654})||{};if(hasSequelizeOperator(_0x523587)){_0x427bbd[_0x2c3654]=getOperatorValue(_0x523587);}else if(_0x139cff[_0x0d76('0xb')]===_0x0d76('0xc')&&_[_0x0d76('0xd')](_0x523587)){var _0x92e20=JSON['parse'](_0x523587);var _0x50e6db={'$gte':moment(moment(_0x92e20['$gte'])[_0x0d76('0xe')](_0x0d76('0xf')))[_0x0d76('0x10')]()[_0x0d76('0xe')](),'$lte':moment(moment(_0x92e20[_0x0d76('0x11')])[_0x0d76('0xe')](_0x0d76('0xf')))['utc']()[_0x0d76('0x12')](0x1,'s')['format']()};_0x427bbd[_0x2c3654]=_0x50e6db;}else if(_0x139cff[_0x0d76('0x13')]===_0x0d76('0x14')){_0x427bbd[_0x2c3654]=_0x523587;}else{_0x427bbd[_0x2c3654]=_[_0x0d76('0x15')](_0x523587)?_0x523587:JSON[_0x0d76('0x5')](_0x523587);}}else{_0x427bbd[_0x2c3654]=_[_0x0d76('0x15')](_0x523587)?_0x523587:JSON[_0x0d76('0x5')](_0x523587);}}catch(_0xf158c2){_0x427bbd[_0x2c3654]=_0x523587[_0x0d76('0x16')](',');}});}return _0x427bbd;};exports[_0x0d76('0x17')]=function(_0x8458ee){_0x8458ee=parseInt(_0x8458ee,0xa);if(!_0x8458ee||_0x8458ee<0x0){_0x8458ee=LIMIT_VALUE;}return _0x8458ee;};exports[_0x0d76('0x18')]=function(_0x1896ea){_0x1896ea=parseInt(_0x1896ea,0xa);if(!_0x1896ea||_0x1896ea<0x0){_0x1896ea=0x0;}return _0x1896ea;};exports[_0x0d76('0x19')]=function(_0x4391e7){var _0x9b0284,_0x29265f=null;if(_0x4391e7){_0x9b0284=_0x4391e7['split'](',');_0x29265f=_[_0x0d76('0x1a')](_0x9b0284,function(_0x3e9c4f){if(_0x3e9c4f[_0x0d76('0x1b')]('-')===0x0){return[_0x3e9c4f===_0x0d76('0x1c')?sequelize[_0x0d76('0x1d')](sequelize[_0x0d76('0x1e')](_0x0d76('0x1c')),_0x0d76('0x1f')):_0x3e9c4f[_0x0d76('0x20')](0x1),_0x0d76('0x21')];}else{return[_0x3e9c4f===_0x0d76('0x1c')?sequelize['cast'](sequelize[_0x0d76('0x1e')]('priority'),_0x0d76('0x1f')):_0x3e9c4f,_0x0d76('0x22')];}});}return _0x29265f;};exports[_0x0d76('0x23')]=function(_0x31b380,_0x3a5ec5){if(_[_0x0d76('0x8')](_0x31b380)){return _0x31b380;}if(_[_0x0d76('0x15')](_0x31b380)){for(var _0x2e3323=0x0;_0x2e3323<_0x31b380['length'];_0x2e3323+=0x1){_0x31b380[_0x2e3323]=this[_0x0d76('0x23')](_0x31b380[_0x2e3323],_0x3a5ec5);}return _0x31b380;}if(!_[_0x0d76('0x24')](_0x31b380)){return _0x31b380;}if(_[_0x0d76('0x25')](_0x3a5ec5)){_0x3a5ec5=[_0x3a5ec5];}if(!_['isArray'](_0x3a5ec5)){return _0x31b380;}for(var _0x24c2d7=0x0;_0x24c2d7<_0x3a5ec5[_0x0d76('0x26')];_0x24c2d7+=0x1){_[_0x0d76('0x27')](_0x31b380,_0x3a5ec5[_0x24c2d7]);}for(var _0x245d7c in _0x31b380){if(_0x31b380[_0x0d76('0x28')](_0x245d7c)){_0x31b380[_0x245d7c]=this[_0x0d76('0x23')](_0x31b380[_0x245d7c],_0x3a5ec5);}}return _0x31b380;};exports[_0x0d76('0x29')]=function(_0xbf73f8){return _0xbf73f8['match'](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x0d76('0x2a')]=function(_0x5704ba){return _0x5704ba[_0x0d76('0x2b')](/^\S+@\S+$/)?!![]:![];};exports[_0x0d76('0x2c')]=function(_0x48d2aa){var _0x9a5e19=[];_0x48d2aa[_0x0d76('0x16')](/[ ,]+/)[_0x0d76('0x2d')](function(_0x367c96){_0x367c96=_0x367c96[_0x0d76('0x2e')](/([^:]")"+/g,'$1');_0x367c96='+'+_0x367c96+'*';if(_0x367c96['includes']('@'))_0x367c96='\x22'+_0x367c96+'\x22';_0x9a5e19[_0x0d76('0x2f')](_0x367c96);});return _0x9a5e19[_0x0d76('0x30')]('\x20');};exports[_0x0d76('0x31')]=function(_0x4f9a5d,_0x15f7e7,_0x542849){var _0x3f03f5={},_0x157dea={};if(_0x15f7e7[_0x0d76('0x32')][_0x0d76('0x33')]){_0x15f7e7[_0x0d76('0x32')]['id']=_0x15f7e7[_0x0d76('0x32')][_0x0d76('0x33')];delete _0x15f7e7['query'][_0x0d76('0x33')];}_0x3f03f5['model']=_[_0x0d76('0x1a')](_0x4f9a5d,'name');_0x3f03f5[_0x0d76('0x32')]=_[_0x0d76('0x3')](_0x15f7e7[_0x0d76('0x32')]);_0x3f03f5[_0x0d76('0x7')]=_['intersection'](_0x3f03f5['model'],_0x3f03f5[_0x0d76('0x32')]);_0x157dea[_0x0d76('0x34')]=_[_0x0d76('0x35')](_0x3f03f5['model'],this[_0x0d76('0x6')](_0x15f7e7[_0x0d76('0x32')]['fields']));_0x157dea[_0x0d76('0x34')]=_0x157dea['attributes'][_0x0d76('0x26')]?_0x157dea[_0x0d76('0x34')]:_0x3f03f5[_0x0d76('0x36')];if(!_0x15f7e7['query'][_0x0d76('0x28')](_0x0d76('0x37'))){_0x157dea[_0x0d76('0x17')]=this[_0x0d76('0x17')](_0x15f7e7[_0x0d76('0x32')][_0x0d76('0x17')]);_0x157dea[_0x0d76('0x18')]=this['offset'](_0x15f7e7[_0x0d76('0x32')]['offset']);}_0x157dea[_0x0d76('0x38')]=this['sort'](_0x15f7e7['query'][_0x0d76('0x19')]);_0x157dea[_0x0d76('0x39')]=this[_0x0d76('0x7')](_[_0x0d76('0x3a')](_0x15f7e7[_0x0d76('0x32')],_0x3f03f5[_0x0d76('0x7')]),_0x4f9a5d);if(_0x15f7e7['query'][_0x0d76('0x3b')]){_0x157dea[_0x0d76('0x39')]=_[_0x0d76('0x3c')](_0x157dea[_0x0d76('0x39')],{'$or':_['map'](_0x4f9a5d,function(_0x36a435){if(_0x36a435['type']!==_0x0d76('0x3d')){if(_0x542849){return sequelize[_0x0d76('0x39')](sequelize['fn'](_0x0d76('0x3e'),sequelize['col'](_0x36a435['name'])),{'$like':sequelize['fn'](_0x0d76('0x3e'),'%'+_0x15f7e7[_0x0d76('0x32')][_0x0d76('0x3b')]+'%')});}else{var _0x54ba8c={};_0x54ba8c[_0x36a435[_0x0d76('0x13')]]={'$like':'%'+_0x15f7e7['query']['filter']+'%'};return _0x54ba8c;}}})});}_0x157dea=_[_0x0d76('0x3c')]({},_0x157dea,_0x15f7e7[_0x0d76('0x3f')]);return _0x157dea;}; \ No newline at end of file +var _0xc9ea=['attributes','hasOwnProperty','nolimit','where','pick','merge','VIRTUAL','lower','filter','options','lodash','moment','includes','parse','fields','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','limit','offset','sort','map','indexOf','cast','col','unsigned','substr','priority','ASC','omit','isString','length','unset','match','^[+]?[0-9]*$','isEmail','replace','push','join','getOptions','$id','query','model','intersection'];(function(_0x1a43ff,_0x478309){var _0x5c0962=function(_0x2a0c06){while(--_0x2a0c06){_0x1a43ff['push'](_0x1a43ff['shift']());}};_0x5c0962(++_0x478309);}(_0xc9ea,0x1d2));var _0xac9e=function(_0x8e040d,_0x186b0a){_0x8e040d=_0x8e040d-0x0;var _0x402d16=_0xc9ea[_0x8e040d];return _0x402d16;};'use strict';var _=require(_0xac9e('0x0'));var sequelize=require('sequelize');var moment=require(_0xac9e('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4420d1){var _0x29cdfe=['ne'];try{var _0x477337=JSON['parse'](_0x4420d1);var _0x37029d=Object['keys'](_0x477337)[0x0];return _0x29cdfe[_0xac9e('0x2')](_0x37029d);}catch(_0x461ed4){return![];}}function getOperatorValue(_0x3a9c63){var _0x2217b5=JSON[_0xac9e('0x3')](_0x3a9c63);var _0x27ed91=Object['keys'](_0x2217b5)[0x0];var _0x5cfb1c=_0x2217b5[_0x27ed91];return{['$'+_0x27ed91]:_0x5cfb1c};}exports[_0xac9e('0x4')]=function(_0x43cead){var _0x351fff=null;if(_0x43cead){_0x351fff=_0x43cead[_0xac9e('0x5')](',');}return _0x351fff;};exports[_0xac9e('0x6')]=function(_0x3d4d1a,_0x27571c){var _0x33c139={};if(!_[_0xac9e('0x7')](_0x3d4d1a)){_[_0xac9e('0x8')](_0x3d4d1a,function(_0x8ed5c6,_0x139fb4){try{if(_0x27571c){var _0xe9a83e=_[_0xac9e('0x9')](_0x27571c,{'name':_0x139fb4})||{};if(hasSequelizeOperator(_0x8ed5c6)){_0x33c139[_0x139fb4]=getOperatorValue(_0x8ed5c6);}else if(_0xe9a83e[_0xac9e('0xa')]===_0xac9e('0xb')&&_[_0xac9e('0xc')](_0x8ed5c6)){var _0x588259=JSON['parse'](_0x8ed5c6);var _0x3eb686={'$gte':moment(moment(_0x588259['$gte'])[_0xac9e('0xd')](_0xac9e('0xe')))[_0xac9e('0xf')]()[_0xac9e('0xd')](),'$lte':moment(moment(_0x588259[_0xac9e('0x10')])[_0xac9e('0xd')]('YYYY-MM-DD'))[_0xac9e('0xf')]()[_0xac9e('0x11')](0x1,'s')[_0xac9e('0xd')]()};_0x33c139[_0x139fb4]=_0x3eb686;}else if(_0xe9a83e[_0xac9e('0x12')]===_0xac9e('0x13')){_0x33c139[_0x139fb4]=_0x8ed5c6;}else{_0x33c139[_0x139fb4]=_['isArray'](_0x8ed5c6)?_0x8ed5c6:JSON[_0xac9e('0x3')](_0x8ed5c6);}}else{_0x33c139[_0x139fb4]=_[_0xac9e('0x14')](_0x8ed5c6)?_0x8ed5c6:JSON[_0xac9e('0x3')](_0x8ed5c6);}}catch(_0x37d463){_0x33c139[_0x139fb4]=_0x8ed5c6[_0xac9e('0x5')](',');}});}return _0x33c139;};exports[_0xac9e('0x15')]=function(_0x1e8a31){_0x1e8a31=parseInt(_0x1e8a31,0xa);if(!_0x1e8a31||_0x1e8a31<0x0){_0x1e8a31=LIMIT_VALUE;}return _0x1e8a31;};exports[_0xac9e('0x16')]=function(_0x28b98e){_0x28b98e=parseInt(_0x28b98e,0xa);if(!_0x28b98e||_0x28b98e<0x0){_0x28b98e=0x0;}return _0x28b98e;};exports[_0xac9e('0x17')]=function(_0x1a66d7){var _0x1a361c,_0x47a336=null;if(_0x1a66d7){_0x1a361c=_0x1a66d7[_0xac9e('0x5')](',');_0x47a336=_[_0xac9e('0x18')](_0x1a361c,function(_0x138146){if(_0x138146[_0xac9e('0x19')]('-')===0x0){return[_0x138146==='priority'?sequelize[_0xac9e('0x1a')](sequelize[_0xac9e('0x1b')]('priority'),_0xac9e('0x1c')):_0x138146[_0xac9e('0x1d')](0x1),'DESC'];}else{return[_0x138146===_0xac9e('0x1e')?sequelize['cast'](sequelize[_0xac9e('0x1b')]('priority'),'unsigned'):_0x138146,_0xac9e('0x1f')];}});}return _0x47a336;};exports['omit']=function(_0xac14a,_0x48e496){if(_[_0xac9e('0x7')](_0xac14a)){return _0xac14a;}if(_[_0xac9e('0x14')](_0xac14a)){for(var _0x1bfb2e=0x0;_0x1bfb2e<_0xac14a['length'];_0x1bfb2e+=0x1){_0xac14a[_0x1bfb2e]=this[_0xac9e('0x20')](_0xac14a[_0x1bfb2e],_0x48e496);}return _0xac14a;}if(!_['isObject'](_0xac14a)){return _0xac14a;}if(_[_0xac9e('0x21')](_0x48e496)){_0x48e496=[_0x48e496];}if(!_['isArray'](_0x48e496)){return _0xac14a;}for(var _0x32c14b=0x0;_0x32c14b<_0x48e496[_0xac9e('0x22')];_0x32c14b+=0x1){_[_0xac9e('0x23')](_0xac14a,_0x48e496[_0x32c14b]);}for(var _0x1269f4 in _0xac14a){if(_0xac14a['hasOwnProperty'](_0x1269f4)){_0xac14a[_0x1269f4]=this[_0xac9e('0x20')](_0xac14a[_0x1269f4],_0x48e496);}}return _0xac14a;};exports['isNumeric']=function(_0x406830){return _0x406830[_0xac9e('0x24')](RegExp(_0xac9e('0x25')))?!![]:![];};exports[_0xac9e('0x26')]=function(_0x34a67a){return _0x34a67a[_0xac9e('0x24')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x4e6ebc){var _0x3e06ef=[];_0x4e6ebc['split'](/[ ,]+/)['forEach'](function(_0x48a1a8){_0x48a1a8=_0x48a1a8[_0xac9e('0x27')](/([^:]")"+/g,'$1');_0x48a1a8='+'+_0x48a1a8+'*';if(_0x48a1a8[_0xac9e('0x2')]('@'))_0x48a1a8='\x22'+_0x48a1a8+'\x22';_0x3e06ef[_0xac9e('0x28')](_0x48a1a8);});return _0x3e06ef[_0xac9e('0x29')]('\x20');};exports[_0xac9e('0x2a')]=function(_0x4299f0,_0x367e2b,_0x363e02){var _0x420134={},_0x201d52={};if(_0x367e2b['query'][_0xac9e('0x2b')]){_0x367e2b[_0xac9e('0x2c')]['id']=_0x367e2b['query']['$id'];delete _0x367e2b[_0xac9e('0x2c')][_0xac9e('0x2b')];}_0x420134[_0xac9e('0x2d')]=_[_0xac9e('0x18')](_0x4299f0,_0xac9e('0x12'));_0x420134[_0xac9e('0x2c')]=_['keys'](_0x367e2b['query']);_0x420134[_0xac9e('0x6')]=_[_0xac9e('0x2e')](_0x420134[_0xac9e('0x2d')],_0x420134[_0xac9e('0x2c')]);_0x201d52[_0xac9e('0x2f')]=_[_0xac9e('0x2e')](_0x420134['model'],this[_0xac9e('0x4')](_0x367e2b[_0xac9e('0x2c')][_0xac9e('0x4')]));_0x201d52['attributes']=_0x201d52[_0xac9e('0x2f')][_0xac9e('0x22')]?_0x201d52['attributes']:_0x420134[_0xac9e('0x2d')];if(!_0x367e2b[_0xac9e('0x2c')][_0xac9e('0x30')](_0xac9e('0x31'))){_0x201d52[_0xac9e('0x15')]=this[_0xac9e('0x15')](_0x367e2b[_0xac9e('0x2c')]['limit']);_0x201d52[_0xac9e('0x16')]=this[_0xac9e('0x16')](_0x367e2b['query'][_0xac9e('0x16')]);}_0x201d52['order']=this[_0xac9e('0x17')](_0x367e2b[_0xac9e('0x2c')]['sort']);_0x201d52[_0xac9e('0x32')]=this[_0xac9e('0x6')](_[_0xac9e('0x33')](_0x367e2b['query'],_0x420134['filters']),_0x4299f0);if(_0x367e2b['query']['filter']){_0x201d52[_0xac9e('0x32')]=_[_0xac9e('0x34')](_0x201d52['where'],{'$or':_[_0xac9e('0x18')](_0x4299f0,function(_0x51a856){if(_0x51a856[_0xac9e('0xa')]!==_0xac9e('0x35')){if(_0x363e02){return sequelize['where'](sequelize['fn'](_0xac9e('0x36'),sequelize[_0xac9e('0x1b')](_0x51a856[_0xac9e('0x12')])),{'$like':sequelize['fn'](_0xac9e('0x36'),'%'+_0x367e2b[_0xac9e('0x2c')][_0xac9e('0x37')]+'%')});}else{var _0x27759b={};_0x27759b[_0x51a856[_0xac9e('0x12')]]={'$like':'%'+_0x367e2b[_0xac9e('0x2c')][_0xac9e('0x37')]+'%'};return _0x27759b;}}})});}_0x201d52=_[_0xac9e('0x34')]({},_0x201d52,_0x367e2b[_0xac9e('0x38')]);return _0x201d52;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 0f6a656..aae697b 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3369=['test','use','toISOString','split','static','views','/server/views','engine','html','ejs','view\x20engine','urlencoded','50mb','initialize','express','body-parser','method-override','errorhandler','path','passport','moment','default','get','env','production','set','appPath','join','root','public','development'];(function(_0x5cac79,_0x5f272d){var _0x4dba8c=function(_0x66543f){while(--_0x66543f){_0x5cac79['push'](_0x5cac79['shift']());}};_0x4dba8c(++_0x5f272d);}(_0x3369,0xc8));var _0x9336=function(_0x2cd933,_0x14816e){_0x2cd933=_0x2cd933-0x0;var _0x178d9e=_0x3369[_0x2cd933];return _0x178d9e;};'use strict';var express=require(_0x9336('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0x9336('0x1'));var methodOverride=require(_0x9336('0x2'));var cookieParser=require('cookie-parser');var errorHandler=require(_0x9336('0x3'));var path=require(_0x9336('0x4'));var passport=require(_0x9336('0x5'));var cors=require('cors');var moment=require(_0x9336('0x6'));var config=require('./environment');var db=require('../mysqldb')['db'];exports[_0x9336('0x7')]=function(_0x353aae){var _0x16ad91=_0x353aae[_0x9336('0x8')](_0x9336('0x9'));if(_0x16ad91===_0x9336('0xa')){_0x353aae[_0x9336('0xb')](_0x9336('0xc'),path[_0x9336('0xd')](config[_0x9336('0xe')],_0x9336('0xf')));}if(_0x16ad91===_0x9336('0x10')||_0x16ad91===_0x9336('0x11')){_0x353aae[_0x9336('0xb')](_0x9336('0xc'),path[_0x9336('0xd')](config[_0x9336('0xe')],'client'));_0x353aae[_0x9336('0x12')](errorHandler());}_0x353aae[_0x9336('0xb')]('json\x20replacer',function(_0x40d21b,_0x41b49f){if(this[_0x40d21b]instanceof Date){_0x41b49f=this[_0x40d21b][_0x9336('0x13')]()[_0x9336('0x14')]('.')[0x0]+'Z';}return _0x41b49f;});_0x353aae[_0x9336('0x12')](express[_0x9336('0x15')](_0x353aae[_0x9336('0x8')](_0x9336('0xc'))));_0x353aae[_0x9336('0xb')](_0x9336('0x16'),config[_0x9336('0xe')]+_0x9336('0x17'));_0x353aae[_0x9336('0x18')](_0x9336('0x19'),require(_0x9336('0x1a'))['renderFile']);_0x353aae['set'](_0x9336('0x1b'),_0x9336('0x19'));_0x353aae[_0x9336('0x12')](bodyParser[_0x9336('0x1c')]({'limit':_0x9336('0x1d'),'extended':!![]}));_0x353aae['use'](bodyParser['json']({'limit':_0x9336('0x1d')}));_0x353aae[_0x9336('0x12')](cors());_0x353aae[_0x9336('0x12')](methodOverride());_0x353aae['use'](cookieParser());_0x353aae[_0x9336('0x12')](passport[_0x9336('0x1e')]());}; \ No newline at end of file +var _0x6045=['env','set','appPath','join','root','test','use','json\x20replacer','split','static','/server/views','engine','html','ejs','view\x20engine','json','express','serve-favicon','method-override','cookie-parser','errorhandler','path','cors','./environment','../mysqldb','default','get'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x6045,0xcd));var _0x5604=function(_0x41f3f2,_0x51544e){_0x41f3f2=_0x41f3f2-0x0;var _0x55b6c2=_0x6045[_0x41f3f2];return _0x55b6c2;};'use strict';var express=require(_0x5604('0x0'));var favicon=require(_0x5604('0x1'));var bodyParser=require('body-parser');var methodOverride=require(_0x5604('0x2'));var cookieParser=require(_0x5604('0x3'));var errorHandler=require(_0x5604('0x4'));var path=require(_0x5604('0x5'));var passport=require('passport');var cors=require(_0x5604('0x6'));var moment=require('moment');var config=require(_0x5604('0x7'));var db=require(_0x5604('0x8'))['db'];exports[_0x5604('0x9')]=function(_0x4270fc){var _0x202a9c=_0x4270fc[_0x5604('0xa')](_0x5604('0xb'));if(_0x202a9c==='production'){_0x4270fc[_0x5604('0xc')](_0x5604('0xd'),path[_0x5604('0xe')](config[_0x5604('0xf')],'public'));}if(_0x202a9c==='development'||_0x202a9c===_0x5604('0x10')){_0x4270fc[_0x5604('0xc')]('appPath',path[_0x5604('0xe')](config[_0x5604('0xf')],'client'));_0x4270fc[_0x5604('0x11')](errorHandler());}_0x4270fc['set'](_0x5604('0x12'),function(_0xde2cf9,_0x1b2412){if(this[_0xde2cf9]instanceof Date){_0x1b2412=this[_0xde2cf9]['toISOString']()[_0x5604('0x13')]('.')[0x0]+'Z';}return _0x1b2412;});_0x4270fc[_0x5604('0x11')](express[_0x5604('0x14')](_0x4270fc['get'](_0x5604('0xd'))));_0x4270fc[_0x5604('0xc')]('views',config['root']+_0x5604('0x15'));_0x4270fc[_0x5604('0x16')](_0x5604('0x17'),require(_0x5604('0x18'))['renderFile']);_0x4270fc[_0x5604('0xc')](_0x5604('0x19'),_0x5604('0x17'));_0x4270fc[_0x5604('0x11')](bodyParser['urlencoded']({'limit':'50mb','extended':!![]}));_0x4270fc[_0x5604('0x11')](bodyParser[_0x5604('0x1a')]({'limit':'50mb'}));_0x4270fc[_0x5604('0x11')](cors());_0x4270fc[_0x5604('0x11')](methodOverride());_0x4270fc['use'](cookieParser());_0x4270fc[_0x5604('0x11')](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index bf34112..17eda6b 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 _0xc5ce=['../environment','networkInterfaces','orderBy','keys','length','filter','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','map','join','md5','update','hex','getUuid','platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','ipAddress','createHash','digest','substring','lodash','crypto','bimedia-machine-uuid','execSync'];(function(_0x7243ce,_0x2819da){var _0x1c23ed=function(_0x1e93b2){while(--_0x1e93b2){_0x7243ce['push'](_0x7243ce['shift']());}};_0x1c23ed(++_0x2819da);}(_0xc5ce,0x114));var _0xec5c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc5ce[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xec5c('0x0'));var os=require('os');var crypto=require(_0xec5c('0x1'));var machine=require(_0xec5c('0x2'));var exec=require('child_process')[_0xec5c('0x3')];var config=require(_0xec5c('0x4'));function getInterfaces(){var _0xe892e1=[];var _0x1aba62=os[_0xec5c('0x5')]();var _0x326aaf=_[_0xec5c('0x6')](_[_0xec5c('0x7')](_0x1aba62));for(var _0x219f54=0x0;_0x219f54<_0x326aaf[_0xec5c('0x8')];_0x219f54++){var _0x31f792=_0x1aba62[_0x326aaf[_0x219f54]][_0xec5c('0x9')](function(_0x50f3dc){return _0x50f3dc['family']===_0xec5c('0xa')&&_0x50f3dc[_0xec5c('0xb')]===![];});_0xe892e1=_0xe892e1[_0xec5c('0xc')](_0x31f792);}return _0xe892e1;}function getFirstInterface(){var _0x25ebc2=_[_0xec5c('0xd')](getInterfaces());return{'macAddress':_0x25ebc2&&_0x25ebc2[_0xec5c('0xe')]?_0x25ebc2[_0xec5c('0xe')]:_0xec5c('0xf'),'ipAddress':_0x25ebc2&&_0x25ebc2[_0xec5c('0x10')]?_0x25ebc2[_0xec5c('0x10')]:'127.0.0.1'};}exports[_0xec5c('0x11')]=getFirstInterface;function getCPUhash(){var _0x45a379=_[_0xec5c('0x6')](os['cpus']()[_0xec5c('0x12')](function(_0x2d1b41){return _0x2d1b41['model'];}))[_0xec5c('0x13')](':');return crypto['createHash'](_0xec5c('0x14'))[_0xec5c('0x15')](_0x45a379)['digest'](_0xec5c('0x16'));}exports[_0xec5c('0x17')]=function(){var _0x100c2b=os[_0xec5c('0x18')]();var _0x5476bc=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x5476bc[_0xec5c('0x19')](config[_0xec5c('0x1a')])){return config['licenseToken'];}else if(_0x100c2b===_0xec5c('0x1b')){return exec(_0xec5c('0x1c'),{'encoding':_0xec5c('0x1d')})[_0xec5c('0x1e')]('\x0d\x0a','');}else{var _0x36b8bd=getFirstInterface();var _0x478cb1=getCPUhash();var _0x1751c1=_0x478cb1+'|'+os['hostname']()+'|'+_0x36b8bd['macAddress']+'|'+_0x36b8bd[_0xec5c('0x1f')];var _0x5013dc=crypto[_0xec5c('0x20')]('md5')['update'](_0x1751c1)[_0xec5c('0x21')](_0xec5c('0x16'));return _0x5013dc[_0xec5c('0x22')](0x0,0x8)+'-'+_0x5013dc[_0xec5c('0x22')](0x8,0xc)+'-'+_0x5013dc['substring'](0xc,0x10)+'-'+_0x5013dc[_0xec5c('0x22')](0x10,0x14)+'-'+_0x5013dc[_0xec5c('0x22')](0x14);}}; \ No newline at end of file +var _0xb7aa=['filter','family','internal','concat','head','mac','00:00:00:00:00:00','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','update','digest','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','macAddress','hex','substring','lodash','bimedia-machine-uuid','child_process','execSync','../environment','orderBy','length'];(function(_0x52bfa5,_0x42cf21){var _0x26f80b=function(_0x73c5b0){while(--_0x73c5b0){_0x52bfa5['push'](_0x52bfa5['shift']());}};_0x26f80b(++_0x42cf21);}(_0xb7aa,0x79));var _0xab7a=function(_0x151779,_0x3c5c93){_0x151779=_0x151779-0x0;var _0x401807=_0xb7aa[_0x151779];return _0x401807;};'use strict';var _=require(_0xab7a('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0xab7a('0x1'));var exec=require(_0xab7a('0x2'))[_0xab7a('0x3')];var config=require(_0xab7a('0x4'));function getInterfaces(){var _0x3809b2=[];var _0x441e6f=os['networkInterfaces']();var _0x2b4de7=_[_0xab7a('0x5')](_['keys'](_0x441e6f));for(var _0x456928=0x0;_0x456928<_0x2b4de7[_0xab7a('0x6')];_0x456928++){var _0x31ca2a=_0x441e6f[_0x2b4de7[_0x456928]][_0xab7a('0x7')](function(_0x23ec0f){return _0x23ec0f[_0xab7a('0x8')]==='IPv4'&&_0x23ec0f[_0xab7a('0x9')]===![];});_0x3809b2=_0x3809b2[_0xab7a('0xa')](_0x31ca2a);}return _0x3809b2;}function getFirstInterface(){var _0x3fd1e8=_[_0xab7a('0xb')](getInterfaces());return{'macAddress':_0x3fd1e8&&_0x3fd1e8[_0xab7a('0xc')]?_0x3fd1e8['mac']:_0xab7a('0xd'),'ipAddress':_0x3fd1e8&&_0x3fd1e8['address']?_0x3fd1e8['address']:_0xab7a('0xe')};}exports[_0xab7a('0xf')]=getFirstInterface;function getCPUhash(){var _0x447ebb=_[_0xab7a('0x5')](os[_0xab7a('0x10')]()[_0xab7a('0x11')](function(_0x424d27){return _0x424d27[_0xab7a('0x12')];}))[_0xab7a('0x13')](':');return crypto[_0xab7a('0x14')](_0xab7a('0x15'))[_0xab7a('0x16')](_0x447ebb)[_0xab7a('0x17')]('hex');}exports['getUuid']=function(){var _0x2ed97a=os['platform']();var _0x30da72=/[0-9a-f-]{36}/;if(config[_0xab7a('0x18')]&&_0x30da72[_0xab7a('0x19')](config[_0xab7a('0x18')])){return config[_0xab7a('0x18')];}else if(_0x2ed97a===_0xab7a('0x1a')){return exec(_0xab7a('0x1b'),{'encoding':_0xab7a('0x1c')})['replace']('\x0d\x0a','');}else{var _0x52c098=getFirstInterface();var _0x17904b=getCPUhash();var _0x503f61=_0x17904b+'|'+os['hostname']()+'|'+_0x52c098[_0xab7a('0x1d')]+'|'+_0x52c098['ipAddress'];var _0x2cdf2b=crypto['createHash'](_0xab7a('0x15'))[_0xab7a('0x16')](_0x503f61)[_0xab7a('0x17')](_0xab7a('0x1e'));return _0x2cdf2b[_0xab7a('0x1f')](0x0,0x8)+'-'+_0x2cdf2b[_0xab7a('0x1f')](0x8,0xc)+'-'+_0x2cdf2b[_0xab7a('0x1f')](0xc,0x10)+'-'+_0x2cdf2b[_0xab7a('0x1f')](0x10,0x14)+'-'+_0x2cdf2b[_0xab7a('0x1f')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 7ca49c2..592c6eb 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 _0x69ac=['NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','moment','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','catch','get','data2','data1','then','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed'];(function(_0x3a391a,_0x14bcf6){var _0x295cdd=function(_0x499218){while(--_0x499218){_0x3a391a['push'](_0x3a391a['shift']());}};_0x295cdd(++_0x14bcf6);}(_0x69ac,0x14c));var _0xc69a=function(_0x60d931,_0x1f8e04){_0x60d931=_0x60d931-0x0;var _0x4ef07c=_0x69ac[_0x60d931];return _0x4ef07c;};'use strict';var util=require(_0xc69a('0x0'));var moment=require(_0xc69a('0x1'));var rp=require('request-promise');var BPromise=require(_0xc69a('0x2'));var pkginfo=require(_0xc69a('0x3'))(module,_0xc69a('0x4'));var db=require(_0xc69a('0x5'))['db'];var encryptor=require(_0xc69a('0x6'));var hardware=require(_0xc69a('0x7'));var logger=require('../logger')(_0xc69a('0x8'));var HOST=_0xc69a('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x3f542a){return new BPromise(function(_0x5bf860,_0x380083){var _0x16c564=util[_0xc69a('0xa')](_0xc69a('0xb'),HOST,_0x3f542a,module['exports'][_0xc69a('0x4')]);if(oldToken){_0x16c564=util['format'](_0xc69a('0xc'),HOST,_0x3f542a,module[_0xc69a('0xd')][_0xc69a('0x4')],oldToken);}var _0x4cb331={'uri':_0x16c564,'method':_0xc69a('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x4cb331)['then'](function(_0x279cd5){_0x5bf860(_0x279cd5);})[_0xc69a('0xf')](function(_0x44e84d){_0x380083(_0x44e84d);});});}function manageLicense(_0xfe934f,_0x36dedc){var _0x57d8f8=_0x36dedc[_0xc69a('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x57d8f8['data1']!==_0xfe934f&&!_0x57d8f8[_0xc69a('0x11')]){oldToken=_0x57d8f8[_0xc69a('0x12')];}httpRequest(_0xfe934f)[_0xc69a('0x13')](function(_0x1439bb){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1439bb[_0xc69a('0x14')]){isOldTokenSent=![];if(!_0x57d8f8[_0xc69a('0x8')]&&_0x57d8f8[_0xc69a('0x8')]!=_0x1439bb[_0xc69a('0x8')]||_0x57d8f8['license']&&_0x57d8f8[_0xc69a('0x11')]){logger['info'](_0xc69a('0x15'));}if(_0x57d8f8[_0xc69a('0x8')]&&!_0x57d8f8[_0xc69a('0x11')]&&_0x57d8f8['license']!=_0x1439bb[_0xc69a('0x8')]){logger[_0xc69a('0x16')](_0xc69a('0x17'));}if(_0x57d8f8[_0xc69a('0x8')]&&!_0x57d8f8['data2']&&_0x57d8f8[_0xc69a('0x8')]==_0x1439bb[_0xc69a('0x8')]){return _0x36dedc;}return _0x36dedc[_0xc69a('0x18')]({'data1':_0xfe934f,'data2':null,'license':_0x1439bb['license']});}else{if(_0x1439bb['license']||_0x57d8f8[_0xc69a('0x8')]){if(!_0x57d8f8['data2']){if(_0x57d8f8['data1']==_0xfe934f){GRAY_PERIOD_REASON=_0xc69a('0x19');logger[_0xc69a('0x16')](_0xc69a('0x1a'));}else{GRAY_PERIOD_REASON=_0xc69a('0x1b');logger[_0xc69a('0x16')](_0xc69a('0x1c'),_0x57d8f8[_0xc69a('0x12')],_0xfe934f);}logger['info']('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xc69a('0x1d')](),moment()[_0xc69a('0xa')](_0xc69a('0x1e')));return _0x36dedc[_0xc69a('0x18')]({'data2':encryptor[_0xc69a('0x1f')](moment()[_0xc69a('0xa')](_0xc69a('0x1e')))});}else{if(moment()[_0xc69a('0x20')](encryptor[_0xc69a('0x21')](_0x57d8f8[_0xc69a('0x11')]),'days')>DAYS){logger[_0xc69a('0x16')]('DEMO\x20START\x20AT\x20%s',moment()[_0xc69a('0xa')](_0xc69a('0x1e')));isOldTokenSent=![];return _0x36dedc[_0xc69a('0x18')]({'data1':_0xfe934f,'data2':null,'license':null});}}}else{if(_0x57d8f8[_0xc69a('0x12')]!=_0xfe934f){logger[_0xc69a('0x16')](_0xc69a('0x1c'),_0x57d8f8['data1'],_0xfe934f);return _0x36dedc['update']({'data1':_0xfe934f,'data2':null,'license':null});}}}return _0x36dedc;})['then'](function(_0x113b91){_0x36dedc=_0x113b91;})[_0xc69a('0xf')](function(_0x36e93f){logger['error'](_0x36e93f['message']);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xc69a('0x22')](),_0x36dedc);},TIME);});}function defaultLicense(){var _0x374176=hardware[_0xc69a('0x22')]();if(_0x374176){return db['License'][_0xc69a('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x374176}})[_0xc69a('0x24')](function(_0x25e564,_0x6c90aa){logger[_0xc69a('0x16')](_0xc69a('0x25'),_0x374176);manageLicense(_0x374176,_0x25e564);})[_0xc69a('0xf')](function(_0x5539bd){logger[_0xc69a('0x26')](_0x5539bd['message']);});}}exports[_0xc69a('0x27')]=defaultLicense; \ No newline at end of file +var _0x0bc6=['SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','request-promise','bluebird','pkginfo','version','./hardware','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','GET','catch','get','data1','then','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','format','YYYY-MM-DD\x20HH:mm','decryptString','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate'];(function(_0x47d9f5,_0x34d4db){var _0x3a19ac=function(_0x5cc6dd){while(--_0x5cc6dd){_0x47d9f5['push'](_0x47d9f5['shift']());}};_0x3a19ac(++_0x34d4db);}(_0x0bc6,0x15f));var _0x60bc=function(_0x345a34,_0x17591e){_0x345a34=_0x345a34-0x0;var _0xf1a016=_0x0bc6[_0x345a34];return _0xf1a016;};'use strict';var util=require(_0x60bc('0x0'));var moment=require(_0x60bc('0x1'));var rp=require(_0x60bc('0x2'));var BPromise=require(_0x60bc('0x3'));var pkginfo=require(_0x60bc('0x4'))(module,_0x60bc('0x5'));var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x60bc('0x6'));var logger=require('../logger')('license');var HOST=_0x60bc('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1d1397){return new BPromise(function(_0x2284d6,_0x561eef){var _0x49a299=util['format'](_0x60bc('0x8'),HOST,_0x1d1397,module[_0x60bc('0x9')][_0x60bc('0x5')]);if(oldToken){_0x49a299=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x1d1397,module['exports'][_0x60bc('0x5')],oldToken);}var _0xea9a66={'uri':_0x49a299,'method':_0x60bc('0xa'),'timeout':0xea60,'json':!![]};return rp(_0xea9a66)['then'](function(_0x1b36bf){_0x2284d6(_0x1b36bf);})[_0x60bc('0xb')](function(_0x93af6e){_0x561eef(_0x93af6e);});});}function manageLicense(_0x6d9907,_0x48d310){var _0x4b9bbb=_0x48d310[_0x60bc('0xc')]({'plain':!![]});if(!isOldTokenSent&&_0x4b9bbb[_0x60bc('0xd')]!==_0x6d9907&&!_0x4b9bbb['data2']){oldToken=_0x4b9bbb[_0x60bc('0xd')];}httpRequest(_0x6d9907)[_0x60bc('0xe')](function(_0x2d8692){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2d8692['active']){isOldTokenSent=![];if(!_0x4b9bbb[_0x60bc('0xf')]&&_0x4b9bbb['license']!=_0x2d8692[_0x60bc('0xf')]||_0x4b9bbb[_0x60bc('0xf')]&&_0x4b9bbb['data2']){logger[_0x60bc('0x10')](_0x60bc('0x11'));}if(_0x4b9bbb[_0x60bc('0xf')]&&!_0x4b9bbb[_0x60bc('0x12')]&&_0x4b9bbb[_0x60bc('0xf')]!=_0x2d8692[_0x60bc('0xf')]){logger[_0x60bc('0x10')](_0x60bc('0x13'));}if(_0x4b9bbb[_0x60bc('0xf')]&&!_0x4b9bbb[_0x60bc('0x12')]&&_0x4b9bbb[_0x60bc('0xf')]==_0x2d8692['license']){return _0x48d310;}return _0x48d310[_0x60bc('0x14')]({'data1':_0x6d9907,'data2':null,'license':_0x2d8692[_0x60bc('0xf')]});}else{if(_0x2d8692['license']||_0x4b9bbb['license']){if(!_0x4b9bbb[_0x60bc('0x12')]){if(_0x4b9bbb['data1']==_0x6d9907){GRAY_PERIOD_REASON='Disabled';logger[_0x60bc('0x10')](_0x60bc('0x15'));}else{GRAY_PERIOD_REASON=_0x60bc('0x16');logger[_0x60bc('0x10')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4b9bbb[_0x60bc('0xd')],_0x6d9907);}logger[_0x60bc('0x10')](_0x60bc('0x17'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x60bc('0x18')](_0x60bc('0x19')));return _0x48d310[_0x60bc('0x14')]({'data2':encryptor['encryptString'](moment()[_0x60bc('0x18')](_0x60bc('0x19')))});}else{if(moment()['diff'](encryptor[_0x60bc('0x1a')](_0x4b9bbb['data2']),'days')>DAYS){logger[_0x60bc('0x10')](_0x60bc('0x1b'),moment()[_0x60bc('0x18')](_0x60bc('0x19')));isOldTokenSent=![];return _0x48d310[_0x60bc('0x14')]({'data1':_0x6d9907,'data2':null,'license':null});}}}else{if(_0x4b9bbb[_0x60bc('0xd')]!=_0x6d9907){logger[_0x60bc('0x10')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4b9bbb[_0x60bc('0xd')],_0x6d9907);return _0x48d310['update']({'data1':_0x6d9907,'data2':null,'license':null});}}}return _0x48d310;})[_0x60bc('0xe')](function(_0x418b7e){_0x48d310=_0x418b7e;})[_0x60bc('0xb')](function(_0x481db7){logger[_0x60bc('0x1c')](_0x481db7[_0x60bc('0x1d')]);})[_0x60bc('0x1e')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x48d310);},TIME);});}function defaultLicense(){var _0x5a2114=hardware[_0x60bc('0x1f')]();if(_0x5a2114){return db[_0x60bc('0x20')][_0x60bc('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0x5a2114}})['spread'](function(_0x22663b,_0x2cdd40){logger[_0x60bc('0x10')](_0x60bc('0x22'),_0x5a2114);manageLicense(_0x5a2114,_0x22663b);})[_0x60bc('0xb')](function(_0x249b09){logger[_0x60bc('0x1c')](_0x249b09[_0x60bc('0x1d')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 09c7aa6..ea7ee7a 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 _0x081a=['admin','user','telephone','users','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','find','defaults','then','catch','uuid','data1','license','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','deadline','add','days','disabled','message','findAll','role','sequelize','col','count'];(function(_0x1d4c8e,_0x4e9cdf){var _0x532356=function(_0x5452d1){while(--_0x5452d1){_0x1d4c8e['push'](_0x1d4c8e['shift']());}};_0x532356(++_0x4e9cdf);}(_0x081a,0x14d));var _0xa081=function(_0x495ac2,_0x3a5324){_0x495ac2=_0x495ac2-0x0;var _0x191c51=_0x081a[_0x495ac2];return _0x191c51;};'use strict';var util=require(_0xa081('0x0'));var _=require(_0xa081('0x1'));var moment=require(_0xa081('0x2'));var BPromise=require(_0xa081('0x3'));var hardware=require(_0xa081('0x4'));var encryptor=require('../../components/encryptor');var db=require(_0xa081('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xa081('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xa081('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xa081('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x31c38a){return new BPromise(function(_0x290d3f,_0xb33050){return db['License'][_0xa081('0x9')](_[_0xa081('0xa')](_0x31c38a,{'raw':!![],'where':{'id':0x1}}))[_0xa081('0xb')](function(_0x295f33){return checkLicense(_0x295f33,null);})[_0xa081('0xb')](function(_0x51dbaf){_0x290d3f(_0x51dbaf);return;})[_0xa081('0xc')](function(_0x5b54bf){_0xb33050(_0x5b54bf);});});}function checkLicense(_0x239697,_0x2dad0a){if(!_0x239697){demoLicense[_0xa081('0xd')]=_0x239697[_0xa081('0xe')];return demoLicense;}try{var _0x45c89f=_0x2dad0a||_0x239697[_0xa081('0xf')];if(_['isEmpty'](_0x45c89f)){throw new Error(_0xa081('0x10'));}var _0x31bd32=_0x239697[_0xa081('0xe')];var _0x428324=_0x239697[_0xa081('0x11')];var _0xb139f4=_0x31bd32[_0xa081('0x12')]('-')[0x4];var _0x8aa6ee=_0x31bd32['split']('-')[0x0];var _0x404025=encryptor[_0xa081('0x13')](_0x45c89f,util[_0xa081('0x14')](_0xa081('0x15'),_0xb139f4,_0x31bd32,_0x8aa6ee));var _0x2b6abe=JSON[_0xa081('0x16')](_0x404025);_0x2b6abe[_0xa081('0x17')]=![];_0x2b6abe['uuid']=_0x31bd32;_0x2b6abe[_0xa081('0x18')]=hardware['getUuid']();if(_0x428324){var _0x1c0070=encryptor[_0xa081('0x13')](_0x428324);_0x2b6abe['gray']=_0x1c0070;_0x2b6abe[_0xa081('0x19')]=moment(_0x1c0070)[_0xa081('0x1a')](0x7,_0xa081('0x1b'))['format']();_0x2b6abe['grayReason']=_0x2b6abe['uuid']!=_0x2b6abe[_0xa081('0x18')]?'changed':_0xa081('0x1c');}return _0x2b6abe;}catch(_0x22292e){breakingLicense[_0xa081('0xd')]=_0x239697[_0xa081('0xe')];breakingLicense[_0xa081('0x1d')]=_0x22292e[_0xa081('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2b2dd5,_0x5afbea){getLicense()['then'](function(_0x3ddb9d){return db['User'][_0xa081('0x1e')]({'attributes':[_0xa081('0x1f'),[db[_0xa081('0x20')]['fn']('COUNT',db[_0xa081('0x20')][_0xa081('0x21')](_0xa081('0x1f'))),_0xa081('0x22')]],'group':_0xa081('0x1f'),'where':{'role':{'$or':[_0xa081('0x23'),_0xa081('0x24'),_0xa081('0x25')]}},'raw':!![]})[_0xa081('0xb')](function(_0x5dcf88){var _0x1d1785={'user':_0x3ddb9d[_0xa081('0x26')]||0x0,'telephone':_0x3ddb9d[_0xa081('0x27')]||0x0};_0x5dcf88[_0xa081('0x28')](function(_0x194e12){var _0x3a39b3=_0x194e12[_0xa081('0x1f')]==='admin'?_0xa081('0x24'):_0x194e12[_0xa081('0x1f')];_0x1d1785[_0x3a39b3]-=_0x194e12[_0xa081('0x22')];if(_0x1d1785[_0x3a39b3]<0x0)_0x1d1785[_0x3a39b3]=0x0;});_0x2b2dd5(_0x1d1785);return;});})[_0xa081('0xc')](function(_0x14c6dc){_0x5afbea(_0x14c6dc);});});}function checkUserLimits(_0x50c5b1){return new BPromise(function(_0xb59751,_0x909ae9){getLimits()[_0xa081('0xb')](function(_0x5daf02){var _0x402c3a=_[_0xa081('0x29')](_[_0xa081('0x2a')](_0x50c5b1,_0xa081('0x1f')),[_0xa081('0x23'),_0xa081('0x24'),_0xa081('0x25')]);var _0x359b25=(_0x402c3a['admin']||0x0)+(_0x402c3a['user']||0x0);var _0x300bb5=_0x402c3a[_0xa081('0x25')]||0x0;if(_0x359b25>_0x5daf02['user'])return _0x909ae9(_0xa081('0x2b'));if(_0x300bb5>_0x5daf02[_0xa081('0x25')])return _0x909ae9(_0xa081('0x2c'));return _0xb59751();})[_0xa081('0xc')](function(_0x571fba){_0x909ae9(_0x571fba);});});}module[_0xa081('0x2d')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xf538=['split','format','parse','demo','machineUuid','gray','deadline','add','days','grayReason','changed','disabled','data1','message','role','sequelize','col','count','user','users','forEach','admin','countBy','telephone','License\x20limit\x20reached\x20for\x20telephones','util','lodash','./hardware','../../components/encryptor','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','uuid','isEmpty','License\x20key\x20value\x20not\x20found','data2'];(function(_0x39ffd1,_0x299703){var _0x31267e=function(_0x11b420){while(--_0x11b420){_0x39ffd1['push'](_0x39ffd1['shift']());}};_0x31267e(++_0x299703);}(_0xf538,0x131));var _0x8f53=function(_0x1a7b0d,_0x3f3037){_0x1a7b0d=_0x1a7b0d-0x0;var _0x30df9c=_0xf538[_0x1a7b0d];return _0x30df9c;};'use strict';var util=require(_0x8f53('0x0'));var _=require(_0x8f53('0x1'));var moment=require('moment');var BPromise=require('bluebird');var hardware=require(_0x8f53('0x2'));var encryptor=require(_0x8f53('0x3'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x8f53('0x4'),'machineUuid':hardware[_0x8f53('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x8f53('0x6'),'machineUuid':hardware[_0x8f53('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x518660){return new BPromise(function(_0x3a2658,_0x3d69ab){return db[_0x8f53('0x7')][_0x8f53('0x8')](_[_0x8f53('0x9')](_0x518660,{'raw':!![],'where':{'id':0x1}}))[_0x8f53('0xa')](function(_0x7bbf16){return checkLicense(_0x7bbf16,null);})[_0x8f53('0xa')](function(_0x2d6476){_0x3a2658(_0x2d6476);return;})['catch'](function(_0x4dbdf0){_0x3d69ab(_0x4dbdf0);});});}function checkLicense(_0x3e546f,_0x7d8d20){if(!_0x3e546f){demoLicense[_0x8f53('0xb')]=_0x3e546f['data1'];return demoLicense;}try{var _0x81634d=_0x7d8d20||_0x3e546f['license'];if(_[_0x8f53('0xc')](_0x81634d)){throw new Error(_0x8f53('0xd'));}var _0x3447c6=_0x3e546f['data1'];var _0x9bd895=_0x3e546f[_0x8f53('0xe')];var _0x27d254=_0x3447c6['split']('-')[0x4];var _0x573d99=_0x3447c6[_0x8f53('0xf')]('-')[0x0];var _0x212805=encryptor['decryptString'](_0x81634d,util[_0x8f53('0x10')]('%s:%s:%s',_0x27d254,_0x3447c6,_0x573d99));var _0x48f064=JSON[_0x8f53('0x11')](_0x212805);_0x48f064[_0x8f53('0x12')]=![];_0x48f064[_0x8f53('0xb')]=_0x3447c6;_0x48f064[_0x8f53('0x13')]=hardware[_0x8f53('0x5')]();if(_0x9bd895){var _0x652ce8=encryptor['decryptString'](_0x9bd895);_0x48f064[_0x8f53('0x14')]=_0x652ce8;_0x48f064[_0x8f53('0x15')]=moment(_0x652ce8)[_0x8f53('0x16')](0x7,_0x8f53('0x17'))['format']();_0x48f064[_0x8f53('0x18')]=_0x48f064[_0x8f53('0xb')]!=_0x48f064[_0x8f53('0x13')]?_0x8f53('0x19'):_0x8f53('0x1a');}return _0x48f064;}catch(_0x212da2){breakingLicense[_0x8f53('0xb')]=_0x3e546f[_0x8f53('0x1b')];breakingLicense[_0x8f53('0x1c')]=_0x212da2[_0x8f53('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x385477,_0x1574d5){getLicense()[_0x8f53('0xa')](function(_0x2d5e4b){return db['User']['findAll']({'attributes':[_0x8f53('0x1d'),[db[_0x8f53('0x1e')]['fn']('COUNT',db[_0x8f53('0x1e')][_0x8f53('0x1f')]('role')),_0x8f53('0x20')]],'group':_0x8f53('0x1d'),'where':{'role':{'$or':['admin',_0x8f53('0x21'),'telephone']}},'raw':!![]})[_0x8f53('0xa')](function(_0x352a6c){var _0x28ab15={'user':_0x2d5e4b[_0x8f53('0x22')]||0x0,'telephone':_0x2d5e4b['telephones']||0x0};_0x352a6c[_0x8f53('0x23')](function(_0x7ea0ef){var _0x284396=_0x7ea0ef[_0x8f53('0x1d')]===_0x8f53('0x24')?_0x8f53('0x21'):_0x7ea0ef[_0x8f53('0x1d')];_0x28ab15[_0x284396]-=_0x7ea0ef[_0x8f53('0x20')];if(_0x28ab15[_0x284396]<0x0)_0x28ab15[_0x284396]=0x0;});_0x385477(_0x28ab15);return;});})['catch'](function(_0x26521d){_0x1574d5(_0x26521d);});});}function checkUserLimits(_0x502047){return new BPromise(function(_0x51e6a1,_0x434030){getLimits()['then'](function(_0x36cfbd){var _0x56e12d=_['pick'](_[_0x8f53('0x25')](_0x502047,'role'),['admin',_0x8f53('0x21'),_0x8f53('0x26')]);var _0x3f54e0=(_0x56e12d[_0x8f53('0x24')]||0x0)+(_0x56e12d[_0x8f53('0x21')]||0x0);var _0x450ed5=_0x56e12d[_0x8f53('0x26')]||0x0;if(_0x3f54e0>_0x36cfbd['user'])return _0x434030('License\x20limit\x20reached\x20for\x20users');if(_0x450ed5>_0x36cfbd[_0x8f53('0x26')])return _0x434030(_0x8f53('0x27'));return _0x51e6a1();})['catch'](function(_0x3aa724){_0x434030(_0x3aa724);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 2fac92a..65fe2c8 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 _0x955f=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x16fb65,_0x28fe72){var _0x34a5dd=function(_0x397830){while(--_0x397830){_0x16fb65['push'](_0x16fb65['shift']());}};_0x34a5dd(++_0x28fe72);}(_0x955f,0x1eb));var _0xf955=function(_0x3304c0,_0x236a31){_0x3304c0=_0x3304c0-0x0;var _0x5c639c=_0x955f[_0x3304c0];return _0x5c639c;};'use strict';module[_0xf955('0x0')]={'DOMAIN':_0xf955('0x1'),'SESSION_SECRET':_0xf955('0x2'),'GOOGLE_ID':_0xf955('0x3'),'GOOGLE_SECRET':_0xf955('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x7d25=['app-id','secret','http://localhost:9000','myappanuglar-secret'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7d25,0x8a));var _0x57d2=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x7d25[_0xe73080];return _0x12cbc4;};'use strict';module['exports']={'DOMAIN':_0x57d2('0x0'),'SESSION_SECRET':_0x57d2('0x1'),'GOOGLE_ID':_0x57d2('0x2'),'GOOGLE_SECRET':_0x57d2('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 6ef02da..9fc8b8f 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaae4=['winston','INFO','join','/var','xcally','format','%s-%s.log','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','message','exports','Logger','%s-%s','error','transports','File','info','Console','env','debugLevel','moment'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xaae4,0x12b));var _0x4aae=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xaae4[_0x397e5f];return _0x5302b8;};'use strict';var moment=require(_0x4aae('0x0'));var winston=require(_0x4aae('0x1'));var util=require('util');var path=require('path');var debugLevel=_0x4aae('0x2');function filename(_0x3a0fa4,_0x3fbde2){return path[_0x4aae('0x3')](_0x4aae('0x4'),'log',_0x4aae('0x5'),util[_0x4aae('0x6')](_0x4aae('0x7'),_0x3a0fa4,_0x3fbde2));}function formatter(_0x2c0b98,_0x169b90){_0x169b90['message']=_0x169b90['message'][_0x4aae('0x8')](/@@{/g,_0x4aae('0x9'))[_0x4aae('0x8')](/}@@/g,_0x4aae('0xa'))[_0x4aae('0x8')](/@{/g,'{{')[_0x4aae('0x8')](/}@/g,'}}');return util['format'](_0x4aae('0xb'),moment()[_0x4aae('0x6')](_0x4aae('0xc')),_0x169b90[_0x4aae('0xd')]['toUpperCase'](),_0x2c0b98,_0x169b90[_0x4aae('0xe')]);}module[_0x4aae('0xf')]=function(_0x33feaa){return new winston[(_0x4aae('0x10'))]({'transports':[new winston['transports']['File']({'name':util[_0x4aae('0x6')](_0x4aae('0x11'),_0x33feaa,_0x4aae('0x12')),'filename':filename(_0x33feaa,_0x4aae('0x12')),'level':_0x4aae('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x88595){return formatter(_0x33feaa,_0x88595);}}),new winston[(_0x4aae('0x13'))][(_0x4aae('0x14'))]({'name':util[_0x4aae('0x6')]('%s-%s',_0x33feaa,_0x4aae('0x15')),'filename':filename(_0x33feaa,'info'),'level':_0x4aae('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x464030){return formatter(_0x33feaa,_0x464030);}}),new winston[(_0x4aae('0x13'))][(_0x4aae('0x16'))]({'level':process[_0x4aae('0x17')][_0x4aae('0x18')]||debugLevel,'json':![],'formatter':function(_0x345f26){return formatter(_0x33feaa,_0x345f26);}})]});}; \ No newline at end of file +var _0xa1f4=['toUpperCase','exports','transports','File','error','info','Console','env','debugLevel','moment','winston','util','path','INFO','join','xcally','message','replace','{{{','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x438dd0,_0x2085b1){var _0x243bf9=function(_0x21b25b){while(--_0x21b25b){_0x438dd0['push'](_0x438dd0['shift']());}};_0x243bf9(++_0x2085b1);}(_0xa1f4,0x1be));var _0x4a1f=function(_0x1233d7,_0x32ab74){_0x1233d7=_0x1233d7-0x0;var _0x397e23=_0xa1f4[_0x1233d7];return _0x397e23;};'use strict';var moment=require(_0x4a1f('0x0'));var winston=require(_0x4a1f('0x1'));var util=require(_0x4a1f('0x2'));var path=require(_0x4a1f('0x3'));var debugLevel=_0x4a1f('0x4');function filename(_0x209693,_0x1c8387){return path[_0x4a1f('0x5')]('/var','log',_0x4a1f('0x6'),util['format']('%s-%s.log',_0x209693,_0x1c8387));}function formatter(_0x240dc5,_0x16c644){_0x16c644['message']=_0x16c644[_0x4a1f('0x7')][_0x4a1f('0x8')](/@@{/g,_0x4a1f('0x9'))[_0x4a1f('0x8')](/}@@/g,_0x4a1f('0xa'))['replace'](/@{/g,'{{')[_0x4a1f('0x8')](/}@/g,'}}');return util[_0x4a1f('0xb')](_0x4a1f('0xc'),moment()[_0x4a1f('0xb')](_0x4a1f('0xd')),_0x16c644['level'][_0x4a1f('0xe')](),_0x240dc5,_0x16c644['message']);}module[_0x4a1f('0xf')]=function(_0xac011){return new winston['Logger']({'transports':[new winston[(_0x4a1f('0x10'))][(_0x4a1f('0x11'))]({'name':util[_0x4a1f('0xb')]('%s-%s',_0xac011,_0x4a1f('0x12')),'filename':filename(_0xac011,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x26d6a4){return formatter(_0xac011,_0x26d6a4);}}),new winston[(_0x4a1f('0x10'))][(_0x4a1f('0x11'))]({'name':util[_0x4a1f('0xb')]('%s-%s',_0xac011,'info'),'filename':filename(_0xac011,_0x4a1f('0x13')),'level':_0x4a1f('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x143f8a){return formatter(_0xac011,_0x143f8a);}}),new winston[(_0x4a1f('0x10'))][(_0x4a1f('0x14'))]({'level':process[_0x4a1f('0x15')][_0x4a1f('0x16')]||debugLevel,'json':![],'formatter':function(_0x5e5c76){return formatter(_0xac011,_0x5e5c76);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index da88542..66c21cf 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 _0x6ad7=['../../services/xdr/index.js','express','join','ami','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','../../services/routing/index.js'];(function(_0x1ba5d4,_0x297b32){var _0xb8fe98=function(_0x3fb434){while(--_0x3fb434){_0x1ba5d4['push'](_0x1ba5d4['shift']());}};_0xb8fe98(++_0x297b32);}(_0x6ad7,0x196));var _0x76ad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ad7[_0x3dd15e];return _0x231fd0;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x76ad('0x0'),'script':path[_0x76ad('0x1')](__dirname,'../../services/express/index.js')},{'name':_0x76ad('0x2'),'script':path[_0x76ad('0x1')](__dirname,_0x76ad('0x3'))},{'name':'agi','script':path['join'](__dirname,_0x76ad('0x4'))},{'name':_0x76ad('0x5'),'script':path[_0x76ad('0x1')](__dirname,_0x76ad('0x6'))},{'name':'routing','script':path[_0x76ad('0x1')](__dirname,_0x76ad('0x7'))},{'name':'xdr','script':path['join'](__dirname,_0x76ad('0x8'))}]};module['exports']=config; \ No newline at end of file +var _0xa7dc=['../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing'];(function(_0x26f135,_0x66f33c){var _0x59a580=function(_0x3cd35f){while(--_0x3cd35f){_0x26f135['push'](_0x26f135['shift']());}};_0x59a580(++_0x66f33c);}(_0xa7dc,0x9e));var _0xca7d=function(_0x45e5d9,_0x26f417){_0x45e5d9=_0x45e5d9-0x0;var _0x3458c2=_0xa7dc[_0x45e5d9];return _0x3458c2;};'use strict';var path=require(_0xca7d('0x0'));var os=require('os');var config={'apps':[{'name':_0xca7d('0x1'),'script':path[_0xca7d('0x2')](__dirname,'../../services/express/index.js')},{'name':_0xca7d('0x3'),'script':path['join'](__dirname,_0xca7d('0x4'))},{'name':_0xca7d('0x5'),'script':path[_0xca7d('0x2')](__dirname,_0xca7d('0x6'))},{'name':_0xca7d('0x7'),'script':path['join'](__dirname,_0xca7d('0x8'))},{'name':_0xca7d('0x9'),'script':path['join'](__dirname,_0xca7d('0xa'))},{'name':_0xca7d('0xb'),'script':path[_0xca7d('0x2')](__dirname,_0xca7d('0xc'))}]};module[_0xca7d('0xd')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index e5a2bda..e8fdd43 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 _0xa063=['dump','bluebird','./config','connect','connected','start','then','stop','restart','list','disconnect','describe','delete'];(function(_0x388e2e,_0x85e560){var _0x21e4a8=function(_0x2f9772){while(--_0x2f9772){_0x388e2e['push'](_0x388e2e['shift']());}};_0x21e4a8(++_0x85e560);}(_0xa063,0x1ae));var _0x3a06=function(_0x5d90f1,_0x11424f){_0x5d90f1=_0x5d90f1-0x0;var _0x230c65=_0xa063[_0x5d90f1];return _0x230c65;};'use strict';var pm2=require('pm2');var BPromise=require(_0x3a06('0x0'));var config=require(_0x3a06('0x1'));function connect(){return new BPromise(function(_0x3a548b,_0x52544e){return pm2[_0x3a06('0x2')](function(_0x2393ba){if(_0x2393ba){return _0x52544e(_0x2393ba);}return _0x3a548b(_0x3a06('0x3'));});});};exports[_0x3a06('0x4')]=function(_0x5b8493){return connect()[_0x3a06('0x5')](function(){return new BPromise(function(_0x47b245,_0x2f33ee){return pm2[_0x3a06('0x4')](_0x5b8493,function(_0xf964b0,_0xa35441){if(_0xf964b0){return _0x2f33ee(_0xf964b0);}pm2['disconnect']();return _0x47b245(_0xa35441);});});});};exports[_0x3a06('0x6')]=function(_0x275a7c){return connect()['then'](function(){return new BPromise(function(_0x1cdec1,_0x3d8d16){return pm2['stop'](_0x275a7c,function(_0x1de5a1,_0x1aa11a){if(_0x1de5a1){return _0x3d8d16(_0x1de5a1);}pm2['disconnect']();return _0x1cdec1(_0x1aa11a);});});});};exports[_0x3a06('0x7')]=function(_0x4fd2f6){return connect()[_0x3a06('0x5')](function(){return new BPromise(function(_0x299ac8,_0x5150cd){return pm2['restart'](_0x4fd2f6,function(_0x415650,_0x4169c4){if(_0x415650){return _0x5150cd(_0x415650);}pm2['disconnect']();return _0x299ac8(_0x4169c4);});});});};exports['list']=function(){return connect()[_0x3a06('0x5')](function(){return new BPromise(function(_0x18df79,_0x4fef65){return pm2[_0x3a06('0x8')](function(_0x374db7,_0x2556a7){if(_0x374db7){return _0x4fef65(_0x374db7);}pm2[_0x3a06('0x9')]();return _0x18df79(_0x2556a7);});});});};exports[_0x3a06('0xa')]=function(_0x5b29a9){return connect()[_0x3a06('0x5')](function(){return new BPromise(function(_0x2ffec9,_0x2c647a){return pm2['describe'](_0x5b29a9,function(_0x1aa2d0,_0x416e75){if(_0x1aa2d0){return _0x2c647a(_0x1aa2d0);}pm2[_0x3a06('0x9')]();return _0x2ffec9(_0x416e75);});});});};exports['delete']=function(_0x428502){return connect()['then'](function(){return new BPromise(function(_0x1d1e07,_0x2f1d98){return pm2[_0x3a06('0xb')](_0x428502,function(_0x31e72e,_0x5d800a){if(_0x31e72e){return _0x2f1d98(_0x31e72e);}pm2[_0x3a06('0x9')]();return _0x1d1e07(_0x5d800a);});});});};exports[_0x3a06('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x4b33af,_0x10398d){return pm2['dump'](function(_0x10333f){if(_0x10333f){return _0x10398d(_0x10333f);}return _0x4b33af('saved');});});});}; \ No newline at end of file +var _0x8e1d=['describe','delete','dump','pm2','bluebird','connected','start','disconnect','stop','restart','then','list'];(function(_0x20706c,_0xcf9921){var _0x3b1f9f=function(_0x28afda){while(--_0x28afda){_0x20706c['push'](_0x20706c['shift']());}};_0x3b1f9f(++_0xcf9921);}(_0x8e1d,0x9f));var _0xd8e1=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8e1d[_0x1facfa];return _0x9ec701;};'use strict';var pm2=require(_0xd8e1('0x0'));var BPromise=require(_0xd8e1('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x37d3f4,_0x87f77b){return pm2['connect'](function(_0x6f612e){if(_0x6f612e){return _0x87f77b(_0x6f612e);}return _0x37d3f4(_0xd8e1('0x2'));});});};exports[_0xd8e1('0x3')]=function(_0x5b7bca){return connect()['then'](function(){return new BPromise(function(_0x4d1b81,_0x380688){return pm2[_0xd8e1('0x3')](_0x5b7bca,function(_0x4e655f,_0x7f023e){if(_0x4e655f){return _0x380688(_0x4e655f);}pm2[_0xd8e1('0x4')]();return _0x4d1b81(_0x7f023e);});});});};exports[_0xd8e1('0x5')]=function(_0x4811d0){return connect()['then'](function(){return new BPromise(function(_0x2a0c3f,_0x225df1){return pm2['stop'](_0x4811d0,function(_0x30821a,_0xfb20f4){if(_0x30821a){return _0x225df1(_0x30821a);}pm2[_0xd8e1('0x4')]();return _0x2a0c3f(_0xfb20f4);});});});};exports[_0xd8e1('0x6')]=function(_0x5782d2){return connect()['then'](function(){return new BPromise(function(_0x38dd30,_0x232331){return pm2['restart'](_0x5782d2,function(_0xa1d7d8,_0x3e9dce){if(_0xa1d7d8){return _0x232331(_0xa1d7d8);}pm2[_0xd8e1('0x4')]();return _0x38dd30(_0x3e9dce);});});});};exports['list']=function(){return connect()[_0xd8e1('0x7')](function(){return new BPromise(function(_0x33423a,_0x132477){return pm2[_0xd8e1('0x8')](function(_0x42a054,_0x3791fc){if(_0x42a054){return _0x132477(_0x42a054);}pm2[_0xd8e1('0x4')]();return _0x33423a(_0x3791fc);});});});};exports[_0xd8e1('0x9')]=function(_0x3e22f3){return connect()['then'](function(){return new BPromise(function(_0x2fe268,_0x571db4){return pm2[_0xd8e1('0x9')](_0x3e22f3,function(_0x57cf24,_0x4c9334){if(_0x57cf24){return _0x571db4(_0x57cf24);}pm2[_0xd8e1('0x4')]();return _0x2fe268(_0x4c9334);});});});};exports[_0xd8e1('0xa')]=function(_0x2f3589){return connect()[_0xd8e1('0x7')](function(){return new BPromise(function(_0x498319,_0x669695){return pm2[_0xd8e1('0xa')](_0x2f3589,function(_0x15855b,_0x375e46){if(_0x15855b){return _0x669695(_0x15855b);}pm2[_0xd8e1('0x4')]();return _0x498319(_0x375e46);});});});};exports[_0xd8e1('0xb')]=function(){return connect()[_0xd8e1('0x7')](function(){return new BPromise(function(_0x220350,_0x331108){return pm2[_0xd8e1('0xb')](function(_0x591a97){if(_0x591a97){return _0x331108(_0x591a97);}return _0x220350('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 7beffb7..97acdbf 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 _0x8cb9=['then','info','join','ChatInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','inspect','start','lodash','moment','util','../../config/environment','../../mysqldb','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','findAll','subtract'];(function(_0x3439e4,_0x36384c){var _0x4ad9fd=function(_0x3fc8fd){while(--_0x3fc8fd){_0x3439e4['push'](_0x3439e4['shift']());}};_0x4ad9fd(++_0x36384c);}(_0x8cb9,0x1ef));var _0x98cb=function(_0x121133,_0xc8a7c0){_0x121133=_0x121133-0x0;var _0x1a24bd=_0x8cb9[_0x121133];return _0x1a24bd;};'use strict';var _=require(_0x98cb('0x0'));var moment=require(_0x98cb('0x1'));var Redis=require('ioredis');var util=require(_0x98cb('0x2'));var config=require(_0x98cb('0x3'));var db=require(_0x98cb('0x4'))['db'];var logger=require('../logger')(_0x98cb('0x5'));config[_0x98cb('0x6')]=_[_0x98cb('0x7')](config[_0x98cb('0x6')],{'host':_0x98cb('0x8'),'port':0x18eb});var io=require(_0x98cb('0x9'))(new Redis(config[_0x98cb('0x6')]));function closeInteractions(){var _0x5f55cb=0x0;var _0x210aa1=[];return db[_0x98cb('0xa')][_0x98cb('0xb')]({'raw':!![],'attributes':['id',_0x98cb('0xc')],'where':{'id':0x1}})['then'](function(_0x26c640){_0x5f55cb=_0x26c640[_0x98cb('0xc')];if(_0x5f55cb){return db['ChatInteraction'][_0x98cb('0xd')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x98cb('0xe')](_0x26c640[_0x98cb('0xc')],'minutes')}}});}else{return[];}})[_0x98cb('0xf')](function(_0x19454e){if(_0x19454e&&_0x19454e['length']){_0x210aa1=_['map'](_0x19454e||[],'id');logger[_0x98cb('0x10')]('[CHAT]\x20Interactions\x20to\x20close:',_0x210aa1[_0x98cb('0x11')]());return db[_0x98cb('0x12')][_0x98cb('0x13')]({'closeReason':_0x98cb('0x14'),'disposition':_0x98cb('0x15'),'closed':!![],'closedAt':moment()[_0x98cb('0x16')](_0x98cb('0x17'))},{'where':{'id':_0x210aa1}});}})[_0x98cb('0xf')](function(){if(_0x210aa1&&_0x210aa1[_0x98cb('0x18')]){logger[_0x98cb('0x10')](_0x98cb('0x19'),_0x210aa1[_0x98cb('0x11')]());for(var _0x3e398c=0x0;_0x3e398c<_0x210aa1['length'];_0x3e398c++){io[_0x98cb('0x1a')]('chatInteraction:update',{'id':_0x210aa1[_0x3e398c],'closed':!![]});}}})[_0x98cb('0x1b')](function(_0x362954){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x362954?util[_0x98cb('0x1c')](_0x362954,{'showHidden':![],'depth':null}):'');});}exports[_0x98cb('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xb3d2=['minutes','info','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','util','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt'];(function(_0x2a5323,_0x570d16){var _0x1aac68=function(_0xe3db9d){while(--_0xe3db9d){_0x2a5323['push'](_0x2a5323['shift']());}};_0x1aac68(++_0x570d16);}(_0xb3d2,0x19c));var _0x2b3d=function(_0x3af3d0,_0x46fe7a){_0x3af3d0=_0x3af3d0-0x0;var _0x13e5b3=_0xb3d2[_0x3af3d0];return _0x13e5b3;};'use strict';var _=require(_0x2b3d('0x0'));var moment=require(_0x2b3d('0x1'));var Redis=require('ioredis');var util=require(_0x2b3d('0x2'));var config=require('../../config/environment');var db=require(_0x2b3d('0x3'))['db'];var logger=require(_0x2b3d('0x4'))(_0x2b3d('0x5'));config[_0x2b3d('0x6')]=_[_0x2b3d('0x7')](config[_0x2b3d('0x6')],{'host':_0x2b3d('0x8'),'port':0x18eb});var io=require(_0x2b3d('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x743497=0x0;var _0x4324eb=[];return db[_0x2b3d('0xa')][_0x2b3d('0xb')]({'raw':!![],'attributes':['id',_0x2b3d('0xc')],'where':{'id':0x1}})[_0x2b3d('0xd')](function(_0xb60358){_0x743497=_0xb60358[_0x2b3d('0xc')];if(_0x743497){return db[_0x2b3d('0xe')][_0x2b3d('0xf')]({'raw':!![],'attributes':['id',_0x2b3d('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0xb60358[_0x2b3d('0xc')],_0x2b3d('0x11'))}}});}else{return[];}})[_0x2b3d('0xd')](function(_0x4d32b4){if(_0x4d32b4&&_0x4d32b4['length']){_0x4324eb=_['map'](_0x4d32b4||[],'id');logger[_0x2b3d('0x12')]('[CHAT]\x20Interactions\x20to\x20close:',_0x4324eb[_0x2b3d('0x13')]());return db['ChatInteraction'][_0x2b3d('0x14')]({'closeReason':_0x2b3d('0x15'),'disposition':_0x2b3d('0x16'),'closed':!![],'closedAt':moment()[_0x2b3d('0x17')](_0x2b3d('0x18'))},{'where':{'id':_0x4324eb}});}})['then'](function(){if(_0x4324eb&&_0x4324eb[_0x2b3d('0x19')]){logger[_0x2b3d('0x12')](_0x2b3d('0x1a'),_0x4324eb[_0x2b3d('0x13')]());for(var _0x263e8c=0x0;_0x263e8c<_0x4324eb['length'];_0x263e8c++){io[_0x2b3d('0x1b')](_0x2b3d('0x1c'),{'id':_0x4324eb[_0x263e8c],'closed':!![]});}}})['catch'](function(_0x362959){logger[_0x2b3d('0x1d')](_0x2b3d('0x1e'),_0x362959?util[_0x2b3d('0x1f')](_0x362959,{'showHidden':![],'depth':null}):'');});}exports[_0x2b3d('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index c23f307..78bd31d 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 _0x5d11=['client','http','info','MailAccount','Smtp','service','host','port','secure','auth','user','pass','format','\x22%s\x22\x20<%s>','name','email','bcc','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','sendIfEmpty','request','SendMail','error','error\x20mail','stringify','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','runReport','then','CustomReportId','no\x20report\x20id','findAll','MailServerOut','keys','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','toRun','resolve','cron','active','isBetween','startAt','add','start','add\x20cron','stop\x20cron','endAt','update','run','util','path','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x5d11,0x1ae));var _0x15d1=function(_0x564821,_0x4d037e){_0x564821=_0x564821-0x0;var _0x2b604d=_0x5d11[_0x564821];return _0x2b604d;};'use strict';var fs=require('fs');var util=require(_0x15d1('0x0'));var path=require(_0x15d1('0x1'));var _=require(_0x15d1('0x2'));var moment=require('moment');var CronJobManager=require(_0x15d1('0x3'));var jayson=require(_0x15d1('0x4'));var BPromise=require(_0x15d1('0x5'));var logger=require(_0x15d1('0x6'))(_0x15d1('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x15d1('0x8'));var analyticDefaultReportController=require(_0x15d1('0x9'));var client=jayson[_0x15d1('0xa')][_0x15d1('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x16544d,_0x1711f0){return function(){logger[_0x15d1('0xc')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x16544d['email']);var _0x531c71=!![];var _0x284059={'tls':{'rejectUnauthorized':![]}};if(_0x16544d[_0x15d1('0xd')][_0x15d1('0xe')]['service']){_0x284059['service']=_0x16544d[_0x15d1('0xd')][_0x15d1('0xe')][_0x15d1('0xf')];}else{_0x284059['host']=_0x16544d['MailAccount']['Smtp'][_0x15d1('0x10')];_0x284059[_0x15d1('0x11')]=_0x16544d[_0x15d1('0xd')][_0x15d1('0xe')]['port'];_0x284059[_0x15d1('0x12')]=_0x16544d[_0x15d1('0xd')][_0x15d1('0xe')]['secure'];}if(_0x16544d[_0x15d1('0xd')][_0x15d1('0xe')]['authentication']){_0x284059[_0x15d1('0x13')]={'user':_0x16544d[_0x15d1('0xd')][_0x15d1('0xe')][_0x15d1('0x14')],'pass':_0x16544d[_0x15d1('0xd')][_0x15d1('0xe')][_0x15d1('0x15')]};}var _0xf14cc1={'account':_0x284059,'message':{'from':util[_0x15d1('0x16')](_0x15d1('0x17'),_0x16544d['MailAccount'][_0x15d1('0x18')],_0x16544d['MailAccount'][_0x15d1('0x19')]||_0x16544d['MailAccount'][_0x15d1('0xe')][_0x15d1('0x14')]),'to':_0x16544d[_0x15d1('0x19')],'cc':_0x16544d['cc'],'bcc':_0x16544d[_0x15d1('0x1a')],'subject':util[_0x15d1('0x16')]('Report\x20%s\x20last\x20%s\x20%s',_0x1711f0['name'],_0x16544d[_0x15d1('0x1b')],_0x16544d[_0x15d1('0x1c')])}};var _0x4052be=path[_0x15d1('0x1d')](__dirname,_0x15d1('0x1e'));var _0xaeb4b1=_0x1711f0[_0x15d1('0x1f')];var _0x185e2f=util[_0x15d1('0x16')](_0x15d1('0x20'),path[_0x15d1('0x21')](_0x1711f0['savename'],path[_0x15d1('0x22')](_0x1711f0[_0x15d1('0x1f')])),_0x15d1('0x23'));var _0xd67257=path['join'](_0x4052be,_0xaeb4b1);var _0x4c7e05=path[_0x15d1('0x1d')](_0x4052be,_0x185e2f);if(fs[_0x15d1('0x24')](_0xd67257)){_0x1711f0[_0x15d1('0x25')]=_0x15d1('0x26');_0xf14cc1[_0x15d1('0x27')][_0x15d1('0x28')]=[{'filename':_0xaeb4b1,'path':_0xd67257}];_0xf14cc1['message'][_0x15d1('0x29')]=util['format'](_0x15d1('0x2a'),JSON['stringify'](_0x1711f0,null,0x2));}else if(fs[_0x15d1('0x24')](_0x4c7e05)){_0x1711f0['status']=_0x15d1('0x26');_0xf14cc1[_0x15d1('0x27')][_0x15d1('0x28')]=[{'filename':_0x185e2f,'path':_0x4c7e05}];}else{_0xf14cc1[_0x15d1('0x27')][_0x15d1('0x29')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x16544d[_0x15d1('0x2b')]){_0x531c71=![];logger[_0x15d1('0xc')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x531c71){return client[_0x15d1('0x2c')](_0x15d1('0x2d'),_0xf14cc1)['then'](function(_0x314397){if(_0x314397[_0x15d1('0x2e')]){return logger[_0x15d1('0x2e')](_0x15d1('0x2f'),JSON[_0x15d1('0x30')](_0x314397));}return logger[_0x15d1('0xc')](_0x15d1('0x31'));})[_0x15d1('0x32')](function(_0x362107){return logger[_0x15d1('0x2e')](_0x15d1('0x2f'),JSON[_0x15d1('0x30')](_0x362107));});}};}function handleError(){return function(_0xec14a9){return logger['error'](JSON[_0x15d1('0x30')](_0xec14a9));};}function handleResult(_0x2ac9e6){return function(_0x323cce){logger['info'](_0x15d1('0x33'),JSON[_0x15d1('0x30')](_0x323cce));if(_0x2ac9e6[_0x15d1('0xd')]&&_0x2ac9e6[_0x15d1('0xd')]['Smtp']&&!_[_0x15d1('0x34')](_0x2ac9e6['email'])){setTimeout(handleSendEmail(_0x2ac9e6,_0x323cce),0x3c*0x3e8);}};}function handleJob(_0xefd793){return function(){try{if(_[_0x15d1('0x34')](_0xefd793[_0x15d1('0x1b')])){return logger[_0x15d1('0xc')](_0x15d1('0x35'));}if(_[_0x15d1('0x34')](_0xefd793[_0x15d1('0x1c')])){return logger[_0x15d1('0xc')](_0x15d1('0x36'));}var _0x448dca={'startDate':moment()['subtract'](_0xefd793[_0x15d1('0x1b')],_0xefd793[_0x15d1('0x1c')])[_0x15d1('0x16')](_0x15d1('0x37')),'endDate':moment()[_0x15d1('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x15d1('0x38'),'output':_0xefd793['output'],'name':_0xefd793['name']};if(!_[_0x15d1('0x34')](_0xefd793['DefaultReportId'])){logger[_0x15d1('0xc')]('exec\x20defaul\x20report\x20id:%s',_0xefd793[_0x15d1('0x39')]);return analyticDefaultReportController[_0x15d1('0x3a')]({'id':_0xefd793[_0x15d1('0x39')]},_0x448dca)[_0x15d1('0x3b')](handleResult(_0xefd793))['catch'](handleError());}if(!_['isNil'](_0xefd793['CustomReportId'])){logger[_0x15d1('0xc')]('exec\x20custom\x20report\x20id:%s',_0xefd793['CustomReportId']);return analyticCustomReportController[_0x15d1('0x3a')]({'id':_0xefd793[_0x15d1('0x3c')]},_0x448dca)[_0x15d1('0x3b')](handleResult(_0xefd793))[_0x15d1('0x32')](handleError());}}catch(_0x11f6e5){logger[_0x15d1('0x2e')](JSON[_0x15d1('0x30')](_0x11f6e5));}return logger[_0x15d1('0xc')](_0x15d1('0x3d'));};}function getJobs(_0xcff461){var _0x26c798={};if(_0xcff461){_0x26c798['id']=_0xcff461;}return db['Schedule'][_0x15d1('0x3e')]({'where':_0x26c798,'include':[{'model':db[_0x15d1('0xd')],'attributes':['id','name',_0x15d1('0x19')],'include':[{'model':db[_0x15d1('0x3f')],'as':_0x15d1('0xe')}]}]})['then'](function(_0x4665bc){var _0x1cfa9e=_[_0x15d1('0x40')](manager[_0x15d1('0x41')]);var _0x154237=_[_0x15d1('0x42')](_0x4665bc,function(_0x4f71f0){return _0x4f71f0['id'][_0x15d1('0x43')]();});var _0x5fad4c=_[_0x15d1('0x44')](_0x4665bc,function(_0x407ee0){return _0x407ee0['id'][_0x15d1('0x43')]();});var _0x394b85=_0xcff461?_0x154237:_[_0x15d1('0x45')](_0x154237,_0x1cfa9e);var _0x1218e5=_[_0x15d1('0x46')](_0x154237,_0x1cfa9e);var _0x412728=_[_0x15d1('0x45')](_0x1cfa9e,_0x154237);var _0x249107;var _0x3ebed4;for(_0x249107=0x0;_0x249107<_0x412728[_0x15d1('0x47')]&&!_0xcff461;_0x249107+=0x1){_0x3ebed4=_0x412728[_0x249107][_0x15d1('0x43')]();if(manager[_0x15d1('0x48')](_0x3ebed4)){manager[_0x15d1('0x49')](_0x3ebed4);manager[_0x15d1('0x4a')](_0x3ebed4);logger[_0x15d1('0xc')]('delete\x20cron',_0x3ebed4);}}logger['info'](_0x15d1('0x4b'),JSON[_0x15d1('0x30')](_0x394b85));for(_0x249107=0x0;_0x249107<_0x394b85[_0x15d1('0x47')];_0x249107+=0x1){_0x3ebed4=_0x394b85[_0x249107][_0x15d1('0x43')]();logger[_0x15d1('0xc')]('index',_0x3ebed4);if(_0xcff461){logger['info']('my\x20id',_0xcff461);logger['info'](JSON[_0x15d1('0x30')](_0x5fad4c[_0x3ebed4]));BPromise[_0x15d1('0x4c')]()['then'](handleJob(_0x5fad4c[_0x3ebed4]));logger['info']('run\x20job',_0x5fad4c[_0x3ebed4][_0x15d1('0x18')],_0x5fad4c[_0x3ebed4][_0x15d1('0x4d')]);}else if(_0x5fad4c[_0x3ebed4]['cron']&&_0x5fad4c[_0x3ebed4][_0x15d1('0x4e')]&&moment()[_0x15d1('0x4f')](_0x5fad4c[_0x3ebed4][_0x15d1('0x50')],_0x5fad4c[_0x3ebed4]['endAt'])){manager[_0x15d1('0x51')](_0x3ebed4,_0x5fad4c[_0x3ebed4][_0x15d1('0x4d')],handleJob(_0x5fad4c[_0x3ebed4]));manager[_0x15d1('0x52')](_0x3ebed4);logger['info'](_0x15d1('0x53'),_0x5fad4c[_0x3ebed4][_0x15d1('0x18')],_0x5fad4c[_0x3ebed4][_0x15d1('0x4d')]);}else if(manager[_0x15d1('0x48')](_0x3ebed4)){manager[_0x15d1('0x49')](_0x3ebed4);manager['deleteJob'](_0x3ebed4);logger[_0x15d1('0xc')](_0x15d1('0x54'),_0x5fad4c[_0x3ebed4][_0x15d1('0x18')],_0x5fad4c[_0x3ebed4]['cron']);}}for(_0x249107=0x0,_0x3ebed4;_0x249107<_0x1218e5[_0x15d1('0x47')]&&!_0xcff461;_0x249107+=0x1){_0x3ebed4=_0x1218e5[_0x249107][_0x15d1('0x43')]();if(manager[_0x15d1('0x48')](_0x3ebed4)){if(_0x5fad4c[_0x3ebed4]['cron']&&_0x5fad4c[_0x3ebed4][_0x15d1('0x4e')]&&moment()[_0x15d1('0x4f')](_0x5fad4c[_0x3ebed4][_0x15d1('0x50')],_0x5fad4c[_0x3ebed4][_0x15d1('0x55')])){manager[_0x15d1('0x56')](_0x3ebed4,_0x5fad4c[_0x3ebed4][_0x15d1('0x4d')],handleJob(_0x5fad4c[_0x3ebed4]));logger[_0x15d1('0xc')]('update\x20cron',_0x5fad4c[_0x3ebed4][_0x15d1('0x18')],_0x5fad4c[_0x3ebed4][_0x15d1('0x4d')]);}else{manager[_0x15d1('0x49')](_0x3ebed4);manager['deleteJob'](_0x3ebed4);logger[_0x15d1('0xc')](_0x15d1('0x54'),_0x5fad4c[_0x3ebed4][_0x15d1('0x18')],_0x5fad4c[_0x3ebed4][_0x15d1('0x4d')]);}}}})[_0x15d1('0x32')](function(_0x357c3d){logger[_0x15d1('0x2e')](JSON[_0x15d1('0x30')](_0x357c3d));});}exports[_0x15d1('0x57')]=function(_0x4df75b){return getJobs(_0x4df75b);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xe235=['subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','Schedule','findAll','MailServerOut','keys','jobs','map','toString','difference','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','add','start','add\x20cron','startAt','update','stop\x20cron','run','lodash','moment','cron-job-manager','jayson/promise','bluebird','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','../../files/reports','%s.%s','basename','savename','extname','zip','join','existsSync','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined'];(function(_0x2a4508,_0x2cfe34){var _0x240ac1=function(_0x1f8968){while(--_0x1f8968){_0x2a4508['push'](_0x2a4508['shift']());}};_0x240ac1(++_0x2cfe34);}(_0xe235,0x80));var _0x5e23=function(_0x4bca52,_0x5c37c8){_0x4bca52=_0x4bca52-0x0;var _0x2ed9b0=_0xe235[_0x4bca52];return _0x2ed9b0;};'use strict';var fs=require('fs');var util=require('util');var path=require('path');var _=require(_0x5e23('0x0'));var moment=require(_0x5e23('0x1'));var CronJobManager=require(_0x5e23('0x2'));var jayson=require(_0x5e23('0x3'));var BPromise=require(_0x5e23('0x4'));var logger=require('../logger')('schedule');var db=require(_0x5e23('0x5'))['db'];var analyticCustomReportController=require(_0x5e23('0x6'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0x5e23('0x7')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x763d9c,_0x41f18b){return function(){logger[_0x5e23('0x8')](_0x5e23('0x9'),_0x763d9c[_0x5e23('0xa')]);var _0x487da1=!![];var _0x2d7e97={'tls':{'rejectUnauthorized':![]}};if(_0x763d9c[_0x5e23('0xb')][_0x5e23('0xc')]['service']){_0x2d7e97[_0x5e23('0xd')]=_0x763d9c[_0x5e23('0xb')][_0x5e23('0xc')][_0x5e23('0xd')];}else{_0x2d7e97[_0x5e23('0xe')]=_0x763d9c['MailAccount'][_0x5e23('0xc')][_0x5e23('0xe')];_0x2d7e97[_0x5e23('0xf')]=_0x763d9c['MailAccount'][_0x5e23('0xc')][_0x5e23('0xf')];_0x2d7e97[_0x5e23('0x10')]=_0x763d9c[_0x5e23('0xb')][_0x5e23('0xc')]['secure'];}if(_0x763d9c[_0x5e23('0xb')]['Smtp'][_0x5e23('0x11')]){_0x2d7e97[_0x5e23('0x12')]={'user':_0x763d9c[_0x5e23('0xb')][_0x5e23('0xc')][_0x5e23('0x13')],'pass':_0x763d9c[_0x5e23('0xb')]['Smtp'][_0x5e23('0x14')]};}var _0x202db4={'account':_0x2d7e97,'message':{'from':util[_0x5e23('0x15')](_0x5e23('0x16'),_0x763d9c[_0x5e23('0xb')]['name'],_0x763d9c[_0x5e23('0xb')]['email']||_0x763d9c['MailAccount']['Smtp'][_0x5e23('0x13')]),'to':_0x763d9c[_0x5e23('0xa')],'cc':_0x763d9c['cc'],'bcc':_0x763d9c[_0x5e23('0x17')],'subject':util[_0x5e23('0x15')](_0x5e23('0x18'),_0x41f18b[_0x5e23('0x19')],_0x763d9c[_0x5e23('0x1a')],_0x763d9c['subtractUnit'])}};var _0x3cb15b=path['join'](__dirname,_0x5e23('0x1b'));var _0x38ffeb=_0x41f18b['savename'];var _0x3c64ac=util['format'](_0x5e23('0x1c'),path[_0x5e23('0x1d')](_0x41f18b[_0x5e23('0x1e')],path[_0x5e23('0x1f')](_0x41f18b[_0x5e23('0x1e')])),_0x5e23('0x20'));var _0x431907=path[_0x5e23('0x21')](_0x3cb15b,_0x38ffeb);var _0x33d66a=path[_0x5e23('0x21')](_0x3cb15b,_0x3c64ac);if(fs[_0x5e23('0x22')](_0x431907)){_0x41f18b['status']=_0x5e23('0x23');_0x202db4[_0x5e23('0x24')][_0x5e23('0x25')]=[{'filename':_0x38ffeb,'path':_0x431907}];_0x202db4['message'][_0x5e23('0x26')]=util[_0x5e23('0x15')](_0x5e23('0x27'),JSON[_0x5e23('0x28')](_0x41f18b,null,0x2));}else if(fs[_0x5e23('0x22')](_0x33d66a)){_0x41f18b[_0x5e23('0x29')]='Sent';_0x202db4[_0x5e23('0x24')][_0x5e23('0x25')]=[{'filename':_0x3c64ac,'path':_0x33d66a}];}else{_0x202db4['message'][_0x5e23('0x26')]=_0x5e23('0x2a');if(!_0x763d9c[_0x5e23('0x2b')]){_0x487da1=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x487da1){return client['request']('SendMail',_0x202db4)[_0x5e23('0x2c')](function(_0x49b066){if(_0x49b066[_0x5e23('0x2d')]){return logger['error'](_0x5e23('0x2e'),JSON[_0x5e23('0x28')](_0x49b066));}return logger[_0x5e23('0x8')](_0x5e23('0x2f'));})[_0x5e23('0x30')](function(_0x3fcf1a){return logger[_0x5e23('0x2d')](_0x5e23('0x2e'),JSON[_0x5e23('0x28')](_0x3fcf1a));});}};}function handleError(){return function(_0x547c78){return logger[_0x5e23('0x2d')](JSON[_0x5e23('0x28')](_0x547c78));};}function handleResult(_0x2d6fe7){return function(_0x24bd77){logger['info'](_0x5e23('0x31'),JSON[_0x5e23('0x28')](_0x24bd77));if(_0x2d6fe7[_0x5e23('0xb')]&&_0x2d6fe7[_0x5e23('0xb')][_0x5e23('0xc')]&&!_[_0x5e23('0x32')](_0x2d6fe7[_0x5e23('0xa')])){setTimeout(handleSendEmail(_0x2d6fe7,_0x24bd77),0x3c*0x3e8);}};}function handleJob(_0x1f7b5d){return function(){try{if(_[_0x5e23('0x32')](_0x1f7b5d['subtractNumber'])){return logger['info'](_0x5e23('0x33'));}if(_[_0x5e23('0x32')](_0x1f7b5d[_0x5e23('0x34')])){return logger['info'](_0x5e23('0x35'));}var _0x1a2518={'startDate':moment()[_0x5e23('0x36')](_0x1f7b5d['subtractNumber'],_0x1f7b5d[_0x5e23('0x34')])['format'](_0x5e23('0x37')),'endDate':moment()[_0x5e23('0x15')](_0x5e23('0x37')),'type':_0x5e23('0x38'),'output':_0x1f7b5d[_0x5e23('0x39')],'name':_0x1f7b5d[_0x5e23('0x19')]};if(!_[_0x5e23('0x32')](_0x1f7b5d['DefaultReportId'])){logger[_0x5e23('0x8')](_0x5e23('0x3a'),_0x1f7b5d[_0x5e23('0x3b')]);return analyticDefaultReportController[_0x5e23('0x3c')]({'id':_0x1f7b5d[_0x5e23('0x3b')]},_0x1a2518)['then'](handleResult(_0x1f7b5d))[_0x5e23('0x30')](handleError());}if(!_[_0x5e23('0x32')](_0x1f7b5d[_0x5e23('0x3d')])){logger[_0x5e23('0x8')]('exec\x20custom\x20report\x20id:%s',_0x1f7b5d[_0x5e23('0x3d')]);return analyticCustomReportController['runReport']({'id':_0x1f7b5d['CustomReportId']},_0x1a2518)[_0x5e23('0x2c')](handleResult(_0x1f7b5d))[_0x5e23('0x30')](handleError());}}catch(_0x1e610d){logger[_0x5e23('0x2d')](JSON['stringify'](_0x1e610d));}return logger[_0x5e23('0x8')]('no\x20report\x20id');};}function getJobs(_0x3beacd){var _0xa975f5={};if(_0x3beacd){_0xa975f5['id']=_0x3beacd;}return db[_0x5e23('0x3e')][_0x5e23('0x3f')]({'where':_0xa975f5,'include':[{'model':db[_0x5e23('0xb')],'attributes':['id',_0x5e23('0x19'),'email'],'include':[{'model':db[_0x5e23('0x40')],'as':_0x5e23('0xc')}]}]})[_0x5e23('0x2c')](function(_0x280e48){var _0x55364a=_[_0x5e23('0x41')](manager[_0x5e23('0x42')]);var _0x4568fc=_[_0x5e23('0x43')](_0x280e48,function(_0x4b6f52){return _0x4b6f52['id'][_0x5e23('0x44')]();});var _0x204782=_['keyBy'](_0x280e48,function(_0x2d5111){return _0x2d5111['id'][_0x5e23('0x44')]();});var _0x54a8f3=_0x3beacd?_0x4568fc:_[_0x5e23('0x45')](_0x4568fc,_0x55364a);var _0x6274d=_['intersection'](_0x4568fc,_0x55364a);var _0x44a35d=_['difference'](_0x55364a,_0x4568fc);var _0x39afc5;var _0x4fbce5;for(_0x39afc5=0x0;_0x39afc5<_0x44a35d[_0x5e23('0x46')]&&!_0x3beacd;_0x39afc5+=0x1){_0x4fbce5=_0x44a35d[_0x39afc5][_0x5e23('0x44')]();if(manager[_0x5e23('0x47')](_0x4fbce5)){manager[_0x5e23('0x48')](_0x4fbce5);manager[_0x5e23('0x49')](_0x4fbce5);logger[_0x5e23('0x8')](_0x5e23('0x4a'),_0x4fbce5);}}logger[_0x5e23('0x8')](_0x5e23('0x4b'),JSON[_0x5e23('0x28')](_0x54a8f3));for(_0x39afc5=0x0;_0x39afc5<_0x54a8f3[_0x5e23('0x46')];_0x39afc5+=0x1){_0x4fbce5=_0x54a8f3[_0x39afc5][_0x5e23('0x44')]();logger[_0x5e23('0x8')](_0x5e23('0x4c'),_0x4fbce5);if(_0x3beacd){logger[_0x5e23('0x8')](_0x5e23('0x4d'),_0x3beacd);logger[_0x5e23('0x8')](JSON[_0x5e23('0x28')](_0x204782[_0x4fbce5]));BPromise[_0x5e23('0x4e')]()['then'](handleJob(_0x204782[_0x4fbce5]));logger[_0x5e23('0x8')](_0x5e23('0x4f'),_0x204782[_0x4fbce5][_0x5e23('0x19')],_0x204782[_0x4fbce5]['cron']);}else if(_0x204782[_0x4fbce5][_0x5e23('0x50')]&&_0x204782[_0x4fbce5][_0x5e23('0x51')]&&moment()[_0x5e23('0x52')](_0x204782[_0x4fbce5]['startAt'],_0x204782[_0x4fbce5]['endAt'])){manager[_0x5e23('0x53')](_0x4fbce5,_0x204782[_0x4fbce5][_0x5e23('0x50')],handleJob(_0x204782[_0x4fbce5]));manager[_0x5e23('0x54')](_0x4fbce5);logger['info'](_0x5e23('0x55'),_0x204782[_0x4fbce5][_0x5e23('0x19')],_0x204782[_0x4fbce5][_0x5e23('0x50')]);}else if(manager[_0x5e23('0x47')](_0x4fbce5)){manager[_0x5e23('0x48')](_0x4fbce5);manager[_0x5e23('0x49')](_0x4fbce5);logger[_0x5e23('0x8')]('stop\x20cron',_0x204782[_0x4fbce5][_0x5e23('0x19')],_0x204782[_0x4fbce5]['cron']);}}for(_0x39afc5=0x0,_0x4fbce5;_0x39afc5<_0x6274d['length']&&!_0x3beacd;_0x39afc5+=0x1){_0x4fbce5=_0x6274d[_0x39afc5][_0x5e23('0x44')]();if(manager[_0x5e23('0x47')](_0x4fbce5)){if(_0x204782[_0x4fbce5]['cron']&&_0x204782[_0x4fbce5][_0x5e23('0x51')]&&moment()[_0x5e23('0x52')](_0x204782[_0x4fbce5][_0x5e23('0x56')],_0x204782[_0x4fbce5]['endAt'])){manager[_0x5e23('0x57')](_0x4fbce5,_0x204782[_0x4fbce5][_0x5e23('0x50')],handleJob(_0x204782[_0x4fbce5]));logger[_0x5e23('0x8')]('update\x20cron',_0x204782[_0x4fbce5][_0x5e23('0x19')],_0x204782[_0x4fbce5][_0x5e23('0x50')]);}else{manager['stop'](_0x4fbce5);manager['deleteJob'](_0x4fbce5);logger[_0x5e23('0x8')](_0x5e23('0x58'),_0x204782[_0x4fbce5][_0x5e23('0x19')],_0x204782[_0x4fbce5]['cron']);}}}})[_0x5e23('0x30')](function(_0x2ef7a9){logger[_0x5e23('0x2d')](JSON[_0x5e23('0x28')](_0x2ef7a9));});}exports[_0x5e23('0x59')]=function(_0x24ad1a){return getJobs(_0x24ad1a);};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 54935d6..e90dfb4 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 _0x5c00=['[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','sentiment','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','all','inspect','start','lodash','aws-sdk','request-promise','bluebird','../../config/logger','transcribe','getTranscriptionJob','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured'];(function(_0x434f2e,_0x68493e){var _0x76c0b9=function(_0x7db698){while(--_0x7db698){_0x434f2e['push'](_0x434f2e['shift']());}};_0x76c0b9(++_0x68493e);}(_0x5c00,0x17e));var _0x05c0=function(_0x3c307c,_0x1b06c4){_0x3c307c=_0x3c307c-0x0;var _0x32cf08=_0x5c00[_0x3c307c];return _0x32cf08;};var _=require(_0x05c0('0x0'));var AWS=require(_0x05c0('0x1'));var rp=require(_0x05c0('0x2'));var util=require('util');var BPromise=require(_0x05c0('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x05c0('0x4'))(_0x05c0('0x5'));function getTranscriptionJob(_0x37b644,_0x28d9c7,_0x565efc,_0x145973){return new Promise(function(_0x3521fe,_0x261624){var _0x27dc10=new AWS['TranscribeService']({'accessKeyId':_0x28d9c7,'secretAccessKey':_0x37b644,'region':_0x565efc});_0x27dc10[_0x05c0('0x6')]({'TranscriptionJobName':_0x145973},function(_0x34eb5f,_0x3ad5b7){if(_0x34eb5f){return _0x261624(_0x34eb5f);}else{return _0x3521fe(_0x3ad5b7);}});});}function sentiment(_0x5afd4d,_0x32a795,_0x32cdfa,_0x996d6b,_0x321c09){return new Promise(function(_0x273b2d,_0x1edbb){var _0x5226c5=new AWS['Comprehend']({'accessKeyId':_0x32a795,'secretAccessKey':_0x5afd4d,'region':_0x32cdfa});_0x5226c5[_0x05c0('0x7')]({'Text':_0x996d6b,'LanguageCode':_0x321c09['substring'](0x0,0x2)},function(_0x205cec,_0x11cf03){if(_0x205cec){return _0x1edbb(_0x205cec);}else{return _0x273b2d(_0x11cf03);}});});}function checkTranscribeJob(_0xa50678,_0x5a3e65,_0x4e39d4){var _0x5eec41;return new BPromise(function(_0x16a290,_0x49e07e){logger[_0x05c0('0x8')](util[_0x05c0('0x9')](_0x05c0('0xa'),_0xa50678['id'],_0xa50678[_0x05c0('0xb')]));return getTranscriptionJob(_0x4e39d4[_0x05c0('0xc')],_0x4e39d4[_0x05c0('0xd')],_0x5a3e65['transcribeRegion'],_0xa50678[_0x05c0('0xb')])[_0x05c0('0xe')](function(_0x4bb164){logger[_0x05c0('0x8')](util[_0x05c0('0x9')](_0x05c0('0xf'),_0xa50678['id'],_0xa50678[_0x05c0('0xb')],_0x4bb164[_0x05c0('0x10')][_0x05c0('0x11')]));if(!_0xa50678['fileText']){switch(_0x4bb164[_0x05c0('0x10')][_0x05c0('0x11')]){case _0x05c0('0x12'):var _0x54fef0={'transcribeStatus':_0x4bb164[_0x05c0('0x10')][_0x05c0('0x11')],'fileUri':_0x4bb164[_0x05c0('0x10')][_0x05c0('0x13')][_0x05c0('0x14')]};logger['info'](util[_0x05c0('0x9')](_0x05c0('0x15'),_0xa50678['id']));return rp({'uri':_0x4bb164['TranscriptionJob']['Transcript']['TranscriptFileUri'],'json':!![]})[_0x05c0('0xe')](function(_0x2055a3){logger[_0x05c0('0x8')](util[_0x05c0('0x9')](_0x05c0('0x16'),_0xa50678['id']));if(_0x2055a3&&_0x2055a3[_0x05c0('0x17')]&&_0x2055a3[_0x05c0('0x17')]['transcripts']&&_0x2055a3[_0x05c0('0x17')][_0x05c0('0x18')]['length']){_0x54fef0['fileText']='';for(var _0x4da6d6=0x0;_0x4da6d6<_0x2055a3['results']['transcripts'][_0x05c0('0x19')];_0x4da6d6++){_0x54fef0[_0x05c0('0x1a')]+=_0x2055a3['results'][_0x05c0('0x18')][_0x4da6d6][_0x05c0('0x1b')]+'';}}return _0xa50678[_0x05c0('0x1c')](_0x54fef0);})[_0x05c0('0xe')](function(){logger['info'](util[_0x05c0('0x9')](_0x05c0('0x1d'),_0xa50678['id']));if(!_0xa50678[_0x05c0('0x1e')]){throw new db[(_0x05c0('0x1f'))][(_0x05c0('0x20'))](_0x05c0('0x21'));}if(!_0x5a3e65['sentiment']||!_0x5a3e65['sentimentAccountId']||!_0x5a3e65[_0x05c0('0x22')]||!_0x5a3e65[_0x05c0('0x23')]||!_0x5a3e65[_0x05c0('0x24')]){throw new db[(_0x05c0('0x1f'))][(_0x05c0('0x20'))](_0x05c0('0x25'));}if(!_0x54fef0[_0x05c0('0x1a')]){throw new Error(_0x05c0('0x26'));}if(_0x5a3e65[_0x05c0('0x27')]===_0x4e39d4['id']){return _0x4e39d4;}else{return db[_0x05c0('0x28')][_0x05c0('0x29')]({'where':{'id':_settings[_0x05c0('0x27')]}});}})['then'](function(_0x5d2020){if(!_0x5d2020){throw new db[(_0x05c0('0x1f'))][(_0x05c0('0x20'))](_0x05c0('0x2a'));}if(!_0x5d2020['data1']||!_0x5d2020[_0x05c0('0xd')]){throw new db[(_0x05c0('0x1f'))]['ValidationError'](_0x05c0('0x2b'));}_0x5eec41=_0x5d2020;logger['info'](util[_0x05c0('0x9')](_0x05c0('0x2c'),_0xa50678['id']));return sentiment(_0x5eec41[_0x05c0('0xc')],_0x5eec41[_0x05c0('0xd')],_0x5a3e65[_0x05c0('0x22')],_0x54fef0[_0x05c0('0x1a')],_0x5a3e65[_0x05c0('0x23')]);})[_0x05c0('0xe')](function(_0x3d8d76){logger[_0x05c0('0x8')](util[_0x05c0('0x9')](_0x05c0('0x2d'),_0xa50678['id']));return _0xa50678[_0x05c0('0x1c')]({'sentiment':_0x3d8d76[_0x05c0('0x2e')],'sPositive':_0x3d8d76[_0x05c0('0x2f')][_0x05c0('0x30')],'sNegative':_0x3d8d76[_0x05c0('0x2f')][_0x05c0('0x31')],'sMixed':_0x3d8d76[_0x05c0('0x2f')][_0x05c0('0x32')],'sNeutral':_0x3d8d76[_0x05c0('0x2f')][_0x05c0('0x33')]});})[_0x05c0('0xe')](function(){logger[_0x05c0('0x8')](util[_0x05c0('0x9')](_0x05c0('0x1d'),_0xa50678['id']));_0x16a290();});case _0x05c0('0x34'):return _0xa50678[_0x05c0('0x1c')]({'transcribeStatus':_0x05c0('0x34'),'failureReason':_0x4bb164[_0x05c0('0x10')][_0x05c0('0x35')]})[_0x05c0('0xe')](function(){logger[_0x05c0('0x8')](util['format'](_0x05c0('0x1d'),_0xa50678['id']));_0x16a290();});default:logger[_0x05c0('0x8')](util[_0x05c0('0x9')](_0x05c0('0x36'),_0xa50678['id']));break;}}else{return BPromise['resolve']()['then'](function(){if(!_0xa50678[_0x05c0('0x1e')]){throw new db[(_0x05c0('0x1f'))][(_0x05c0('0x20'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x5a3e65[_0x05c0('0x37')]||!_0x5a3e65[_0x05c0('0x27')]||!_0x5a3e65[_0x05c0('0x22')]||!_0x5a3e65[_0x05c0('0x23')]||!_0x5a3e65['bucket']){throw new db[(_0x05c0('0x1f'))][(_0x05c0('0x20'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0xa50678[_0x05c0('0x1a')]){throw new Error(_0x05c0('0x26'));}if(_0x5a3e65[_0x05c0('0x27')]===_0x4e39d4['id']){return _0x4e39d4;}else{return db[_0x05c0('0x28')][_0x05c0('0x29')]({'where':{'id':_settings[_0x05c0('0x27')]}});}})[_0x05c0('0xe')](function(_0x5a75b4){if(!_0x5a75b4){throw new db['Sequelize'][(_0x05c0('0x20'))](_0x05c0('0x2a'));}if(!_0x5a75b4[_0x05c0('0xc')]||!_0x5a75b4[_0x05c0('0xd')]){throw new db[(_0x05c0('0x1f'))]['ValidationError'](_0x05c0('0x2b'));}_0x5eec41=_0x5a75b4;logger[_0x05c0('0x8')](util[_0x05c0('0x9')](_0x05c0('0x2c'),_0xa50678['id']));return sentiment(_0x5eec41[_0x05c0('0xc')],_0x5eec41[_0x05c0('0xd')],_0x5a3e65[_0x05c0('0x22')],_0xa50678['fileText'],_0x5a3e65[_0x05c0('0x23')]);})[_0x05c0('0xe')](function(_0x15d119){logger[_0x05c0('0x8')](util[_0x05c0('0x9')](_0x05c0('0x2d'),_0xa50678['id']));return _0xa50678[_0x05c0('0x1c')]({'sentiment':_0x15d119[_0x05c0('0x2e')],'sPositive':_0x15d119[_0x05c0('0x2f')][_0x05c0('0x30')],'sNegative':_0x15d119[_0x05c0('0x2f')]['Negative'],'sMixed':_0x15d119['SentimentScore'][_0x05c0('0x32')],'sNeutral':_0x15d119[_0x05c0('0x2f')][_0x05c0('0x33')],'transcribeStatus':_0x05c0('0x12')});})[_0x05c0('0xe')](function(){logger[_0x05c0('0x8')](util['format'](_0x05c0('0x1d'),_0xa50678['id']));_0x16a290();});}})[_0x05c0('0x38')](function(_0x1d53c3){if(_0x1d53c3){if(!_0x1d53c3[_0x05c0('0x39')]||_0x1d53c3['name']!==_0x05c0('0x3a')){logger[_0x05c0('0x3b')](util[_0x05c0('0x9')](_0x05c0('0x3c'),_0xa50678['id']),util['inspect'](_0x1d53c3,{'showHidden':![],'depth':null}));}}_0x16a290();});});}function checkTranscribe(){var _0x2aae53;var _0x39e6ad;var _0x2e5660;return db[_0x05c0('0x3d')]['findAll']({'where':{'transcribeStatus':_0x05c0('0x3e')}})[_0x05c0('0xe')](function(_0x58241a){if(!_0x58241a||!_0x58241a[_0x05c0('0x19')]){throw new db['Sequelize']['ValidationError'](_0x05c0('0x3f'));}_0x2aae53=_0x58241a;return db['Setting'][_0x05c0('0x29')]({'where':{'id':0x1}});})[_0x05c0('0xe')](function(_0x2fedc0){if(!_0x2fedc0){throw new db[(_0x05c0('0x1f'))][(_0x05c0('0x20'))](_0x05c0('0x40'));}_0x39e6ad=_0x2fedc0;if(!_0x39e6ad['transcribe']||!_0x39e6ad[_0x05c0('0x41')]||!_0x39e6ad['transcribeRegion']||!_0x39e6ad[_0x05c0('0x23')]||!_0x39e6ad[_0x05c0('0x24')]){throw new db[(_0x05c0('0x1f'))][(_0x05c0('0x20'))](_0x05c0('0x42'));}return db[_0x05c0('0x28')][_0x05c0('0x29')]({'where':{'id':_0x39e6ad['transcribeAccountId']}});})['then'](function(_0x523153){if(!_0x523153){throw new db[(_0x05c0('0x1f'))][(_0x05c0('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x523153['data1']||!_0x523153[_0x05c0('0xd')]){throw new db[(_0x05c0('0x1f'))][(_0x05c0('0x20'))](_0x05c0('0x2b'));}_0x2e5660=_0x523153;var _0x1a3dcd=[];_0x2aae53[_0x05c0('0x43')](function(_0x3b1ce8){_0x1a3dcd['push'](checkTranscribeJob(_0x3b1ce8,_0x39e6ad,_0x2e5660));});return BPromise[_0x05c0('0x44')](_0x1a3dcd);})[_0x05c0('0x38')](function(_0x189a9a){if(_0x189a9a){if(!_0x189a9a[_0x05c0('0x39')]||_0x189a9a['name']!==_0x05c0('0x3a')){logger['error'](util[_0x05c0('0x45')](_0x189a9a,{'showHidden':![],'depth':null}));}}});}exports[_0x05c0('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x983c=['Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','language','CloudProvider','Cloud\x20Provider\x20not\x20available','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','all','start','lodash','aws-sdk','request-promise','util','bluebird','../../config/logger','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','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','sentiment','sentimentAccountId','sentimentRegion','bucket','Transcript\x20not\x20available','findOne'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x983c,0xf3));var _0xc983=function(_0xc7a0cb,_0x389964){_0xc7a0cb=_0xc7a0cb-0x0;var _0x10ce8e=_0x983c[_0xc7a0cb];return _0x10ce8e;};var _=require(_0xc983('0x0'));var AWS=require(_0xc983('0x1'));var rp=require(_0xc983('0x2'));var util=require(_0xc983('0x3'));var BPromise=require(_0xc983('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0xc983('0x5'))(_0xc983('0x6'));function getTranscriptionJob(_0x14b999,_0x2e8c5d,_0xdaae44,_0x290ca8){return new Promise(function(_0x3897b9,_0x541e6f){var _0x346933=new AWS[(_0xc983('0x7'))]({'accessKeyId':_0x2e8c5d,'secretAccessKey':_0x14b999,'region':_0xdaae44});_0x346933[_0xc983('0x8')]({'TranscriptionJobName':_0x290ca8},function(_0x11cd44,_0x52025a){if(_0x11cd44){return _0x541e6f(_0x11cd44);}else{return _0x3897b9(_0x52025a);}});});}function sentiment(_0x548063,_0x4fbf6f,_0x5ad672,_0x41255b,_0x4311dc){return new Promise(function(_0x1ed0e4,_0x4405c2){var _0x15d894=new AWS[(_0xc983('0x9'))]({'accessKeyId':_0x4fbf6f,'secretAccessKey':_0x548063,'region':_0x5ad672});_0x15d894[_0xc983('0xa')]({'Text':_0x41255b,'LanguageCode':_0x4311dc[_0xc983('0xb')](0x0,0x2)},function(_0x25a806,_0x5a8b47){if(_0x25a806){return _0x4405c2(_0x25a806);}else{return _0x1ed0e4(_0x5a8b47);}});});}function checkTranscribeJob(_0x160b3b,_0x2ae6f0,_0x28b2f1){var _0x1b4dd2;return new BPromise(function(_0xf61926,_0x346727){logger['info'](util[_0xc983('0xc')](_0xc983('0xd'),_0x160b3b['id'],_0x160b3b[_0xc983('0xe')]));return getTranscriptionJob(_0x28b2f1[_0xc983('0xf')],_0x28b2f1[_0xc983('0x10')],_0x2ae6f0[_0xc983('0x11')],_0x160b3b['transcribeName'])[_0xc983('0x12')](function(_0x1a1e7d){logger[_0xc983('0x13')](util[_0xc983('0xc')](_0xc983('0x14'),_0x160b3b['id'],_0x160b3b[_0xc983('0xe')],_0x1a1e7d[_0xc983('0x15')][_0xc983('0x16')]));if(!_0x160b3b[_0xc983('0x17')]){switch(_0x1a1e7d[_0xc983('0x15')]['TranscriptionJobStatus']){case'COMPLETED':var _0x43231d={'transcribeStatus':_0x1a1e7d[_0xc983('0x15')][_0xc983('0x16')],'fileUri':_0x1a1e7d[_0xc983('0x15')][_0xc983('0x18')][_0xc983('0x19')]};logger[_0xc983('0x13')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x160b3b['id']));return rp({'uri':_0x1a1e7d[_0xc983('0x15')][_0xc983('0x18')][_0xc983('0x19')],'json':!![]})[_0xc983('0x12')](function(_0xfcf7b6){logger[_0xc983('0x13')](util[_0xc983('0xc')](_0xc983('0x1a'),_0x160b3b['id']));if(_0xfcf7b6&&_0xfcf7b6[_0xc983('0x1b')]&&_0xfcf7b6[_0xc983('0x1b')][_0xc983('0x1c')]&&_0xfcf7b6[_0xc983('0x1b')]['transcripts']['length']){_0x43231d[_0xc983('0x17')]='';for(var _0x446c80=0x0;_0x446c80<_0xfcf7b6['results'][_0xc983('0x1c')]['length'];_0x446c80++){_0x43231d[_0xc983('0x17')]+=_0xfcf7b6[_0xc983('0x1b')][_0xc983('0x1c')][_0x446c80][_0xc983('0x1d')]+'';}}return _0x160b3b[_0xc983('0x1e')](_0x43231d);})['then'](function(){logger[_0xc983('0x13')](util[_0xc983('0xc')](_0xc983('0x1f'),_0x160b3b['id']));if(!_0x160b3b[_0xc983('0x20')]){throw new db[(_0xc983('0x21'))][(_0xc983('0x22'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2ae6f0[_0xc983('0x23')]||!_0x2ae6f0[_0xc983('0x24')]||!_0x2ae6f0[_0xc983('0x25')]||!_0x2ae6f0['language']||!_0x2ae6f0[_0xc983('0x26')]){throw new db[(_0xc983('0x21'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x43231d['fileText']){throw new Error(_0xc983('0x27'));}if(_0x2ae6f0['sentimentAccountId']===_0x28b2f1['id']){return _0x28b2f1;}else{return db['CloudProvider'][_0xc983('0x28')]({'where':{'id':_settings[_0xc983('0x24')]}});}})['then'](function(_0x383f00){if(!_0x383f00){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x383f00[_0xc983('0xf')]||!_0x383f00[_0xc983('0x10')]){throw new db['Sequelize'][(_0xc983('0x22'))](_0xc983('0x29'));}_0x1b4dd2=_0x383f00;logger[_0xc983('0x13')](util[_0xc983('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x160b3b['id']));return sentiment(_0x1b4dd2['data1'],_0x1b4dd2[_0xc983('0x10')],_0x2ae6f0[_0xc983('0x25')],_0x43231d[_0xc983('0x17')],_0x2ae6f0['language']);})['then'](function(_0x3d45df){logger[_0xc983('0x13')](util[_0xc983('0xc')](_0xc983('0x2a'),_0x160b3b['id']));return _0x160b3b[_0xc983('0x1e')]({'sentiment':_0x3d45df[_0xc983('0x2b')],'sPositive':_0x3d45df[_0xc983('0x2c')][_0xc983('0x2d')],'sNegative':_0x3d45df[_0xc983('0x2c')][_0xc983('0x2e')],'sMixed':_0x3d45df[_0xc983('0x2c')][_0xc983('0x2f')],'sNeutral':_0x3d45df['SentimentScore']['Neutral']});})[_0xc983('0x12')](function(){logger['info'](util[_0xc983('0xc')](_0xc983('0x1f'),_0x160b3b['id']));_0xf61926();});case'FAILED':return _0x160b3b['update']({'transcribeStatus':_0xc983('0x30'),'failureReason':_0x1a1e7d[_0xc983('0x15')][_0xc983('0x31')]})[_0xc983('0x12')](function(){logger['info'](util[_0xc983('0xc')](_0xc983('0x1f'),_0x160b3b['id']));_0xf61926();});default:logger[_0xc983('0x13')](util['format'](_0xc983('0x32'),_0x160b3b['id']));break;}}else{return BPromise[_0xc983('0x33')]()['then'](function(){if(!_0x160b3b[_0xc983('0x20')]){throw new db[(_0xc983('0x21'))][(_0xc983('0x22'))](_0xc983('0x34'));}if(!_0x2ae6f0[_0xc983('0x23')]||!_0x2ae6f0[_0xc983('0x24')]||!_0x2ae6f0[_0xc983('0x25')]||!_0x2ae6f0[_0xc983('0x35')]||!_0x2ae6f0['bucket']){throw new db[(_0xc983('0x21'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x160b3b[_0xc983('0x17')]){throw new Error(_0xc983('0x27'));}if(_0x2ae6f0['sentimentAccountId']===_0x28b2f1['id']){return _0x28b2f1;}else{return db[_0xc983('0x36')][_0xc983('0x28')]({'where':{'id':_settings[_0xc983('0x24')]}});}})['then'](function(_0x2ea6cc){if(!_0x2ea6cc){throw new db[(_0xc983('0x21'))][(_0xc983('0x22'))](_0xc983('0x37'));}if(!_0x2ea6cc[_0xc983('0xf')]||!_0x2ea6cc[_0xc983('0x10')]){throw new db[(_0xc983('0x21'))]['ValidationError'](_0xc983('0x29'));}_0x1b4dd2=_0x2ea6cc;logger[_0xc983('0x13')](util[_0xc983('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x160b3b['id']));return sentiment(_0x1b4dd2[_0xc983('0xf')],_0x1b4dd2[_0xc983('0x10')],_0x2ae6f0[_0xc983('0x25')],_0x160b3b['fileText'],_0x2ae6f0[_0xc983('0x35')]);})['then'](function(_0x1de54c){logger[_0xc983('0x13')](util[_0xc983('0xc')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x160b3b['id']));return _0x160b3b[_0xc983('0x1e')]({'sentiment':_0x1de54c[_0xc983('0x2b')],'sPositive':_0x1de54c[_0xc983('0x2c')][_0xc983('0x2d')],'sNegative':_0x1de54c[_0xc983('0x2c')][_0xc983('0x2e')],'sMixed':_0x1de54c[_0xc983('0x2c')]['Mixed'],'sNeutral':_0x1de54c[_0xc983('0x2c')]['Neutral'],'transcribeStatus':'COMPLETED'});})[_0xc983('0x12')](function(){logger['info'](util[_0xc983('0xc')](_0xc983('0x1f'),_0x160b3b['id']));_0xf61926();});}})[_0xc983('0x38')](function(_0x29235f){if(_0x29235f){if(!_0x29235f[_0xc983('0x39')]||_0x29235f[_0xc983('0x39')]!==_0xc983('0x3a')){logger[_0xc983('0x3b')](util[_0xc983('0xc')](_0xc983('0x3c'),_0x160b3b['id']),util[_0xc983('0x3d')](_0x29235f,{'showHidden':![],'depth':null}));}}_0xf61926();});});}function checkTranscribe(){var _0x3caa03;var _0x4ce197;var _0x40656b;return db[_0xc983('0x3e')][_0xc983('0x3f')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xc983('0x12')](function(_0x297a4d){if(!_0x297a4d||!_0x297a4d['length']){throw new db['Sequelize'][(_0xc983('0x22'))](_0xc983('0x40'));}_0x3caa03=_0x297a4d;return db[_0xc983('0x41')][_0xc983('0x28')]({'where':{'id':0x1}});})[_0xc983('0x12')](function(_0x41d0bf){if(!_0x41d0bf){throw new db[(_0xc983('0x21'))][(_0xc983('0x22'))](_0xc983('0x42'));}_0x4ce197=_0x41d0bf;if(!_0x4ce197['transcribe']||!_0x4ce197[_0xc983('0x43')]||!_0x4ce197[_0xc983('0x11')]||!_0x4ce197[_0xc983('0x35')]||!_0x4ce197[_0xc983('0x26')]){throw new db[(_0xc983('0x21'))][(_0xc983('0x22'))]('Transcribe\x20not\x20configured');}return db[_0xc983('0x36')][_0xc983('0x28')]({'where':{'id':_0x4ce197[_0xc983('0x43')]}});})[_0xc983('0x12')](function(_0x2f3283){if(!_0x2f3283){throw new db[(_0xc983('0x21'))][(_0xc983('0x22'))](_0xc983('0x37'));}if(!_0x2f3283[_0xc983('0xf')]||!_0x2f3283[_0xc983('0x10')]){throw new db[(_0xc983('0x21'))][(_0xc983('0x22'))](_0xc983('0x29'));}_0x40656b=_0x2f3283;var _0x162921=[];_0x3caa03[_0xc983('0x44')](function(_0x40e8f3){_0x162921['push'](checkTranscribeJob(_0x40e8f3,_0x4ce197,_0x40656b));});return BPromise[_0xc983('0x45')](_0x162921);})[_0xc983('0x38')](function(_0x18a7c6){if(_0x18a7c6){if(!_0x18a7c6['name']||_0x18a7c6[_0xc983('0x39')]!==_0xc983('0x3a')){logger[_0xc983('0x3b')](util[_0xc983('0x3d')](_0x18a7c6,{'showHidden':![],'depth':null}));}}});}exports[_0xc983('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index e272418..bbf05af 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 _0x9172=['[WHATSAPP]\x20Error\x20closing\x20interactions','util','../../config/environment','../logger','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error'];(function(_0x41ef26,_0x8f23e1){var _0x43321a=function(_0x7dc365){while(--_0x7dc365){_0x41ef26['push'](_0x41ef26['shift']());}};_0x43321a(++_0x8f23e1);}(_0x9172,0x1a5));var _0x2917=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x9172[_0x1beef3];return _0x5af964;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require('ioredis');var util=require(_0x2917('0x0'));var config=require(_0x2917('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x2917('0x2'))('schedule');config[_0x2917('0x3')]=_[_0x2917('0x4')](config[_0x2917('0x3')],{'host':_0x2917('0x5'),'port':0x18eb});var io=require(_0x2917('0x6'))(new Redis(config[_0x2917('0x3')]));function closeInteractions(){var _0x250faa=[];return db[_0x2917('0x7')][_0x2917('0x8')]({'raw':!![],'attributes':['id',_0x2917('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x2917('0xa')](0x18,_0x2917('0xb'))}}})['then'](function(_0x19bfc3){if(_0x19bfc3&&_0x19bfc3['length']){_0x250faa=_[_0x2917('0xc')](_0x19bfc3||[],'id');logger[_0x2917('0xd')](_0x2917('0xe'),_0x250faa[_0x2917('0xf')]());return db[_0x2917('0x7')][_0x2917('0x10')]({'closeReason':'system','disposition':_0x2917('0x11'),'closed':!![],'closedAt':moment()[_0x2917('0x12')](_0x2917('0x13'))},{'where':{'id':_0x250faa}});}})[_0x2917('0x14')](function(){if(_0x250faa&&_0x250faa[_0x2917('0x15')]){logger['info'](_0x2917('0x16'),_0x250faa[_0x2917('0xf')]());for(var _0x56a91f=0x0;_0x56a91f<_0x250faa[_0x2917('0x15')];_0x56a91f++){io[_0x2917('0x17')](_0x2917('0x18'),{'id':_0x250faa[_0x56a91f],'closed':!![]});}}})[_0x2917('0x19')](function(_0x52167f){logger[_0x2917('0x1a')](_0x2917('0x1b'),_0x52167f?util['inspect'](_0x52167f,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x2399=['findAll','subtract','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','inspect','start','lodash','ioredis','util','../../config/environment','../logger','schedule','defaults','localhost','socket.io-emitter','redis','WhatsappInteraction'];(function(_0x10a764,_0x224b06){var _0x1d2dde=function(_0x354bd6){while(--_0x354bd6){_0x10a764['push'](_0x10a764['shift']());}};_0x1d2dde(++_0x224b06);}(_0x2399,0x1f3));var _0x9239=function(_0x51302c,_0x376113){_0x51302c=_0x51302c-0x0;var _0x20f6c1=_0x2399[_0x51302c];return _0x20f6c1;};'use strict';var _=require(_0x9239('0x0'));var moment=require('moment');var Redis=require(_0x9239('0x1'));var util=require(_0x9239('0x2'));var config=require(_0x9239('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x9239('0x4'))(_0x9239('0x5'));config['redis']=_[_0x9239('0x6')](config['redis'],{'host':_0x9239('0x7'),'port':0x18eb});var io=require(_0x9239('0x8'))(new Redis(config[_0x9239('0x9')]));function closeInteractions(){var _0x4ed90e=[];return db[_0x9239('0xa')][_0x9239('0xb')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x9239('0xc')](0x18,'hours')}}})[_0x9239('0xd')](function(_0x2bd54c){if(_0x2bd54c&&_0x2bd54c[_0x9239('0xe')]){_0x4ed90e=_[_0x9239('0xf')](_0x2bd54c||[],'id');logger[_0x9239('0x10')](_0x9239('0x11'),_0x4ed90e[_0x9239('0x12')]());return db['WhatsappInteraction'][_0x9239('0x13')]({'closeReason':_0x9239('0x14'),'disposition':_0x9239('0x15'),'closed':!![],'closedAt':moment()[_0x9239('0x16')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x4ed90e}});}})[_0x9239('0xd')](function(){if(_0x4ed90e&&_0x4ed90e[_0x9239('0xe')]){logger[_0x9239('0x10')](_0x9239('0x17'),_0x4ed90e[_0x9239('0x12')]());for(var _0x451429=0x0;_0x451429<_0x4ed90e['length'];_0x451429++){io[_0x9239('0x18')](_0x9239('0x19'),{'id':_0x4ed90e[_0x451429],'closed':!![]});}}})[_0x9239('0x1a')](function(_0x119fe7){logger[_0x9239('0x1b')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x119fe7?util[_0x9239('0x1c')](_0x119fe7,{'showHidden':![],'depth':null}):'');});}exports[_0x9239('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index f4eb153..745281a 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc14f=['util','Biondo','innocenzo.biondo','push','now','Innocenzo','@xcally.com','CmContact','destroy','then','bulkCreate','log','contacts1','CmHopper','finished\x20populating','hopper1','catch'];(function(_0x3742ea,_0x5a8996){var _0x3f80b7=function(_0x2ba719){while(--_0x2ba719){_0x3742ea['push'](_0x3742ea['shift']());}};_0x3f80b7(++_0x5a8996);}(_0xc14f,0x143));var _0xfc14=function(_0x55c73b,_0x24e44b){_0x55c73b=_0x55c73b-0x0;var _0x21ac68=_0xc14f[_0x55c73b];return _0x21ac68;};'use strict';var util=require(_0xfc14('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xfc14('0x1')+i,'phone':0xf879fb460+i,'email':_0xfc14('0x2')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xfc14('0x3')]({'id':i,'active':![],'scheduledat':Date[_0xfc14('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xfc14('0x4')](),'updatedAt':Date[_0xfc14('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xfc14('0x3')]({'id':i,'firstName':_0xfc14('0x5')+i,'lastName':_0xfc14('0x1')+i,'phone':0xf879fb460+i,'email':_0xfc14('0x2')+i+_0xfc14('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xfc14('0x3')]({'id':i,'active':![],'scheduledat':Date[_0xfc14('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xfc14('0x4')](),'updatedAt':Date[_0xfc14('0x4')]()});}db[_0xfc14('0x7')][_0xfc14('0x8')]({'where':{}})[_0xfc14('0x9')](function(){return db[_0xfc14('0x7')][_0xfc14('0xa')](contacts);})['then'](function(){console[_0xfc14('0xb')]('finished\x20populating',_0xfc14('0xc'));return db['CmHopper']['destroy']({'where':{}});})[_0xfc14('0x9')](function(){return db[_0xfc14('0xd')]['bulkCreate'](hopper);})[_0xfc14('0x9')](function(){console['log'](_0xfc14('0xe'),_0xfc14('0xf'));return db['CmContact'][_0xfc14('0xa')](contacts2);})[_0xfc14('0x9')](function(){console[_0xfc14('0xb')](_0xfc14('0xe'),'contacts2');return db[_0xfc14('0xd')]['bulkCreate'](hopper2);})['then'](function(){console[_0xfc14('0xb')]('finished\x20populating','hopper2');})[_0xfc14('0x10')](function(_0x57f5b1){console[_0xfc14('0xb')](_0x57f5b1);}); \ No newline at end of file +var _0x8136=['log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','catch','util','../mysqldb','Innocenzo','innocenzo.biondo','@xcally.com','now','push','Biondo','CmContact','destroy','then','bulkCreate'];(function(_0x421cf8,_0x23152c){var _0x145c48=function(_0x565862){while(--_0x565862){_0x421cf8['push'](_0x421cf8['shift']());}};_0x145c48(++_0x23152c);}(_0x8136,0x111));var _0x6813=function(_0x11b9fc,_0xfe93b3){_0x11b9fc=_0x11b9fc-0x0;var _0x1457a6=_0x8136[_0x11b9fc];return _0x1457a6;};'use strict';var util=require(_0x6813('0x0'));var db=require(_0x6813('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x6813('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x6813('0x3')+i+_0x6813('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6813('0x5')](),'updatedAt':Date[_0x6813('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x6813('0x6')]({'id':i,'firstName':_0x6813('0x2')+i,'lastName':_0x6813('0x7')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x6813('0x6')]({'id':i,'active':![],'scheduledat':Date[_0x6813('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6813('0x5')](),'updatedAt':Date['now']()});}db[_0x6813('0x8')][_0x6813('0x9')]({'where':{}})[_0x6813('0xa')](function(){return db[_0x6813('0x8')][_0x6813('0xb')](contacts);})[_0x6813('0xa')](function(){console[_0x6813('0xc')](_0x6813('0xd'),_0x6813('0xe'));return db[_0x6813('0xf')][_0x6813('0x9')]({'where':{}});})['then'](function(){return db[_0x6813('0xf')][_0x6813('0xb')](hopper);})['then'](function(){console[_0x6813('0xc')](_0x6813('0xd'),_0x6813('0x10'));return db[_0x6813('0x8')][_0x6813('0xb')](contacts2);})[_0x6813('0xa')](function(){console['log']('finished\x20populating',_0x6813('0x11'));return db[_0x6813('0xf')][_0x6813('0xb')](hopper2);})[_0x6813('0xa')](function(){console[_0x6813('0xc')](_0x6813('0xd'),'hopper2');})[_0x6813('0x12')](function(_0x296fbd){console[_0x6813('0xc')](_0x296fbd);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 2521390..8e733fc 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32bb=['catch','../mysqldb','push','%s%s','agent','format','%s%s@xcally.com','password','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','then','log'];(function(_0x34a105,_0xa56304){var _0x4a3edd=function(_0x4c4784){while(--_0x4c4784){_0x34a105['push'](_0x34a105['shift']());}};_0x4a3edd(++_0xa56304);}(_0x32bb,0x10b));var _0xb32b=function(_0x57cc22,_0x2d351f){_0x57cc22=_0x57cc22-0x0;var _0x6f7bdc=_0x32bb[_0x57cc22];return _0x6f7bdc;};'use strict';var util=require('util');var db=require(_0xb32b('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xb32b('0x1')]({'name':util['format'](_0xb32b('0x2'),_0xb32b('0x3'),i),'fullname':util[_0xb32b('0x4')](_0xb32b('0x2'),_0xb32b('0x3'),i),'email':util['format'](_0xb32b('0x5'),_0xb32b('0x3'),i),'role':_0xb32b('0x3'),'password':_0xb32b('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0xb32b('0x7'),'ws','wss'],'disallow':[_0xb32b('0x8')],'allow':[_0xb32b('0x9')],'defaultuser':util[_0xb32b('0x4')](_0xb32b('0x2'),'agent',i),'encryption':_0xb32b('0xa'),'avpf':'yes','force_avp':_0xb32b('0xa'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xb32b('0xb'),'dtlsprivatekey':_0xb32b('0xc'),'dtlssetup':_0xb32b('0xd'),'callerid':util[_0xb32b('0x4')]('\x22%s\x22\x20<%s>',util[_0xb32b('0x4')](_0xb32b('0x2'),_0xb32b('0x3'),i),0xfa0+i)});}db[_0xb32b('0xe')][_0xb32b('0xf')](users)[_0xb32b('0x10')](function(){console[_0xb32b('0x11')]('add\x20user');})[_0xb32b('0x12')](function(_0x44db65){console['log'](_0x44db65);}); \ No newline at end of file +var _0x44c3=['%s%s@xcally.com','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','User','bulkCreate','then','log','../mysqldb','push','format','agent','%s%s'];(function(_0x2525ea,_0x2246ac){var _0x5381bd=function(_0xc54fc1){while(--_0xc54fc1){_0x2525ea['push'](_0x2525ea['shift']());}};_0x5381bd(++_0x2246ac);}(_0x44c3,0x14f));var _0x344c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x44c3[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var db=require(_0x344c('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x344c('0x1')]({'name':util[_0x344c('0x2')]('%s%s',_0x344c('0x3'),i),'fullname':util[_0x344c('0x2')](_0x344c('0x4'),_0x344c('0x3'),i),'email':util['format'](_0x344c('0x5'),_0x344c('0x3'),i),'role':_0x344c('0x3'),'password':'password','internal':0xfa0+i,'type':_0x344c('0x6'),'transport':[_0x344c('0x7'),'ws',_0x344c('0x8')],'disallow':['all'],'allow':[_0x344c('0x9')],'defaultuser':util[_0x344c('0x2')](_0x344c('0x4'),_0x344c('0x3'),i),'encryption':_0x344c('0xa'),'avpf':_0x344c('0xa'),'force_avp':_0x344c('0xa'),'icesupport':_0x344c('0xa'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x344c('0xb'),'dtlsprivatekey':_0x344c('0xc'),'dtlssetup':'actpass','callerid':util[_0x344c('0x2')]('\x22%s\x22\x20<%s>',util['format']('%s%s',_0x344c('0x3'),i),0xfa0+i)});}db[_0x344c('0xd')][_0x344c('0xe')](users)[_0x344c('0xf')](function(){console[_0x344c('0x10')]('add\x20user');})['catch'](function(_0x5350cb){console[_0x344c('0x10')](_0x5350cb);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index dbcb05a..4ef039c 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef9e=['map','User','where','telephone','Campaign','ivr','format','length','user:%s','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','user','ChatQueue','WhatsappQueue','Trunk','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','address','remoteAddress','request','remotePort','connectedAt','log','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','../mysqldb','./environment','name','Agents','role','agent','type','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','Trunks','UserProfileResource','resourceId','then'];(function(_0x12ea6a,_0x70f86){var _0x4b88e2=function(_0x176205){while(--_0x176205){_0x12ea6a['push'](_0x12ea6a['shift']());}};_0x4b88e2(++_0x70f86);}(_0xef9e,0x1ef));var _0xeef9=function(_0x5a89db,_0x22dba9){_0x5a89db=_0x5a89db-0x0;var _0x12eb7e=_0xef9e[_0x5a89db];return _0x12eb7e;};'use strict';var _=require(_0xeef9('0x0'));var util=require('util');var BPromise=require(_0xeef9('0x1'));var db=require(_0xeef9('0x2'))['db'];var config=require(_0xeef9('0x3'));var queryQueues={'attributes':['id',_0xeef9('0x4')],'include':[{'as':_0xeef9('0x5'),'model':db['User'],'attributes':['id','name',_0xeef9('0x6')],'raw':!![],'where':{'role':_0xeef9('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xeef9('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xeef9('0x4')],'where':{'role':_0xeef9('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xeef9('0x8')],'where':{'type':'ivr'}};function getAssociatedResources(_0xb8c314,_0x4537d1,_0x1c1e31){return db[_0xeef9('0x9')][_0xeef9('0xa')]({'where':{'name':_0xb8c314,'userProfileId':_0x4537d1},'raw':!![]})['then'](function(_0x354153){if(_0x354153){if(_0x354153[_0xeef9('0xb')]){switch(_0xb8c314){case _0xeef9('0xc'):case _0xeef9('0xd'):case _0xeef9('0xe'):case _0xeef9('0xf'):case _0xeef9('0x10'):case _0xeef9('0x11'):case _0xeef9('0x12'):return db[_0x1c1e31]['findAll'](queryQueues);case _0xeef9('0x13'):return db[_0x1c1e31][_0xeef9('0x14')](queryTelephones);case _0xeef9('0x15'):return db[_0x1c1e31][_0xeef9('0x14')](queryTrunks);case'IvrCampaigns':return db[_0x1c1e31][_0xeef9('0x14')](queryCampaigns);}}else{return db[_0xeef9('0x16')][_0xeef9('0x14')]({'attributes':[_0xeef9('0x17')],'where':{'sectionId':_0x354153['id']},'raw':!![]})[_0xeef9('0x18')](function(_0x191c11){if(_0x191c11){var _0x5492f5={'where':{'id':_[_0xeef9('0x19')](_0x191c11,_0xeef9('0x17'))},'raw':!![]};switch(_0x1c1e31){case _0xeef9('0x1a'):_0x5492f5[_0xeef9('0x1b')]['role']=_0xeef9('0x1c');break;case _0xeef9('0x1d'):_0x5492f5['where']['type']=_0xeef9('0x1e');break;}return db[_0x1c1e31][_0xeef9('0x14')](_0x5492f5);}else{return[];}});}}else{return[];}})[_0xeef9('0x18')](function(_0x5e2249){return _0x5e2249;});}function joinOrLeaveQueues(_0x385f37,_0x4b1221,_0x2225c9,_0x216c73){_0x385f37[_0x4b1221](util[_0xeef9('0x1f')]('%s:queue:%s',_0x2225c9,_0x216c73['name']));if(_0x216c73['Agents']){for(var _0x5893bc=0x0;_0x5893bc<_0x216c73['Agents'][_0xeef9('0x20')];_0x5893bc+=0x1){_0x385f37[_0x4b1221](util[_0xeef9('0x1f')](_0xeef9('0x21'),_0x216c73[_0xeef9('0x5')][_0x5893bc]['name']));}}}function joinOrLeave(_0x2351a1,_0x488fc5,_0x5c325f){var _0x31190f;if(_0x2351a1[_0xeef9('0x22')][_0xeef9('0x23')]['id']){db[_0xeef9('0x1a')]['find']({'attributes':['id','name','role',_0xeef9('0x24')],'where':{'id':_0x2351a1[_0xeef9('0x22')][_0xeef9('0x23')]['id']},'include':[{'model':db[_0xeef9('0x25')],'as':_0xeef9('0x26'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xeef9('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xeef9('0x28')],'as':_0xeef9('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xeef9('0x2a')],'as':_0xeef9('0x2b'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xeef9('0x2c'),'attributes':['id'],'raw':!![]},{'model':db[_0xeef9('0x2d')],'as':_0xeef9('0x2e'),'attributes':['id'],'raw':!![]}]})[_0xeef9('0x18')](function(_0x4b4e61){if(_0x4b4e61){_0x31190f=_0x4b4e61;_0x2351a1[_0x488fc5](util[_0xeef9('0x1f')]('user:%s',_0x4b4e61[_0xeef9('0x4')]));var _0x49e8fe=[];switch(_0x4b4e61[_0xeef9('0x6')]){case _0xeef9('0x2f'):_0x2351a1[_0x488fc5](_0xeef9('0x30'));_0x2351a1[_0x488fc5](_0xeef9('0x31'));if(queryQueues[_0xeef9('0x32')](_0xeef9('0x33'))){delete queryQueues[_0xeef9('0x33')];}_0x49e8fe['push'](db[_0xeef9('0x34')][_0xeef9('0x14')](queryQueues));_0x49e8fe[_0xeef9('0x35')](db['ChatQueue'][_0xeef9('0x14')](queryQueues));_0x49e8fe[_0xeef9('0x35')](db[_0xeef9('0x36')]['findAll'](queryQueues));_0x49e8fe['push'](db[_0xeef9('0x37')][_0xeef9('0x14')](queryQueues));_0x49e8fe[_0xeef9('0x35')](db[_0xeef9('0x38')][_0xeef9('0x14')](queryQueues));_0x49e8fe['push'](db[_0xeef9('0x39')]['findAll'](queryQueues));_0x49e8fe['push'](db['WhatsappQueue']['findAll'](queryQueues));_0x49e8fe['push'](db[_0xeef9('0x1a')][_0xeef9('0x14')](queryTelephones));_0x49e8fe['push'](db['Trunk'][_0xeef9('0x14')](queryTrunks));_0x49e8fe['push'](db[_0xeef9('0x1d')][_0xeef9('0x14')](queryCampaigns));_0x49e8fe['push'](db[_0xeef9('0x1a')][_0xeef9('0x14')](queryAgents));break;case _0xeef9('0x3a'):_0x2351a1[_0x488fc5](_0xeef9('0x30'));_0x2351a1[_0x488fc5](_0xeef9('0x31'));_0x49e8fe[_0xeef9('0x35')](getAssociatedResources(_0xeef9('0xc'),_0x4b4e61['userProfileId'],_0xeef9('0x34')));_0x49e8fe[_0xeef9('0x35')](getAssociatedResources(_0xeef9('0xd'),_0x4b4e61[_0xeef9('0x24')],_0xeef9('0x3b')));_0x49e8fe['push'](getAssociatedResources(_0xeef9('0xe'),_0x4b4e61[_0xeef9('0x24')],_0xeef9('0x36')));_0x49e8fe[_0xeef9('0x35')](getAssociatedResources(_0xeef9('0xf'),_0x4b4e61[_0xeef9('0x24')],_0xeef9('0x37')));_0x49e8fe[_0xeef9('0x35')](getAssociatedResources(_0xeef9('0x10'),_0x4b4e61['userProfileId'],_0xeef9('0x38')));_0x49e8fe[_0xeef9('0x35')](getAssociatedResources(_0xeef9('0x11'),_0x4b4e61[_0xeef9('0x24')],_0xeef9('0x39')));_0x49e8fe[_0xeef9('0x35')](getAssociatedResources(_0xeef9('0x12'),_0x4b4e61[_0xeef9('0x24')],_0xeef9('0x3c')));_0x49e8fe['push'](getAssociatedResources(_0xeef9('0x13'),_0x4b4e61['userProfileId'],'User'));_0x49e8fe[_0xeef9('0x35')](getAssociatedResources(_0xeef9('0x15'),_0x4b4e61[_0xeef9('0x24')],_0xeef9('0x3d')));_0x49e8fe['push'](getAssociatedResources('IvrCampaigns',_0x4b4e61[_0xeef9('0x24')],_0xeef9('0x1d')));_0x49e8fe[_0xeef9('0x35')](db[_0xeef9('0x1a')]['findAll'](queryAgents));break;case _0xeef9('0x7'):_0x2351a1[_0x488fc5](_0xeef9('0x30'));_0x2351a1[_0x488fc5]('voice:outbound');_0x49e8fe[_0xeef9('0x35')](_0x4b4e61['getVoiceQueues']({'attributes':['id',_0xeef9('0x4')]}));_0x49e8fe['push'](_0x4b4e61['getChatQueues']({'attributes':['id',_0xeef9('0x4')]}));_0x49e8fe[_0xeef9('0x35')](_0x4b4e61[_0xeef9('0x3e')]({'attributes':['id',_0xeef9('0x4')]}));_0x49e8fe[_0xeef9('0x35')](_0x4b4e61[_0xeef9('0x3f')]({'attributes':['id',_0xeef9('0x4')]}));_0x49e8fe['push'](_0x4b4e61[_0xeef9('0x40')]({'attributes':['id',_0xeef9('0x4')]}));_0x49e8fe['push'](_0x4b4e61[_0xeef9('0x41')]({'attributes':['id',_0xeef9('0x4')]}));_0x49e8fe['push'](_0x4b4e61['getWhatsappQueues']({'attributes':['id',_0xeef9('0x4')]}));break;}return BPromise[_0xeef9('0x42')](_0x49e8fe);}})[_0xeef9('0x18')](function(_0x201ee5){if(_0x201ee5&&_0x201ee5[_0xeef9('0x20')]){for(var _0x465b05=0x0;_0x465b05<_0x201ee5[_0xeef9('0x20')];_0x465b05+=0x1){for(var _0x4a430d=0x0;_0x4a430d<_0x201ee5[_0x465b05][_0xeef9('0x20')];_0x4a430d+=0x1){switch(_0x465b05){case 0x0:joinOrLeaveQueues(_0x2351a1,_0x488fc5,_0xeef9('0x43'),_0x201ee5[_0x465b05][_0x4a430d]);break;case 0x1:joinOrLeaveQueues(_0x2351a1,_0x488fc5,_0xeef9('0x44'),_0x201ee5[_0x465b05][_0x4a430d]);break;case 0x2:joinOrLeaveQueues(_0x2351a1,_0x488fc5,_0xeef9('0x45'),_0x201ee5[_0x465b05][_0x4a430d]);break;case 0x3:joinOrLeaveQueues(_0x2351a1,_0x488fc5,_0xeef9('0x46'),_0x201ee5[_0x465b05][_0x4a430d]);break;case 0x4:joinOrLeaveQueues(_0x2351a1,_0x488fc5,_0xeef9('0x47'),_0x201ee5[_0x465b05][_0x4a430d]);break;case 0x5:joinOrLeaveQueues(_0x2351a1,_0x488fc5,_0xeef9('0x48'),_0x201ee5[_0x465b05][_0x4a430d]);break;case 0x6:joinOrLeaveQueues(_0x2351a1,_0x488fc5,_0xeef9('0x49'),_0x201ee5[_0x465b05][_0x4a430d]);break;case 0x7:if(_0x31190f[_0xeef9('0x6')]!==_0xeef9('0x7'))_0x2351a1[_0x488fc5](util['format'](_0xeef9('0x4a'),_0x201ee5[_0x465b05][_0x4a430d][_0xeef9('0x4')]));break;case 0x8:if(_0x31190f['role']!==_0xeef9('0x7'))_0x2351a1[_0x488fc5](util[_0xeef9('0x1f')](_0xeef9('0x4b'),_0x201ee5[_0x465b05][_0x4a430d][_0xeef9('0x4')]));break;case 0x9:if(_0x31190f[_0xeef9('0x6')]!==_0xeef9('0x7'))_0x2351a1[_0x488fc5](util[_0xeef9('0x1f')]('campaign:%s:%s',_0x201ee5[_0x465b05][_0x4a430d][_0xeef9('0x8')],_0x201ee5[_0x465b05][_0x4a430d]['name']));break;case 0xa:_0x2351a1[_0x488fc5](util[_0xeef9('0x1f')](_0xeef9('0x21'),_0x201ee5[_0x465b05][_0x4a430d][_0xeef9('0x4')]));break;}}}}})[_0xeef9('0x18')](function(){if(_0x488fc5===_0xeef9('0x4c')){var _0x4ec5cc=_['map'](_0x31190f['ChatInteractions'],'id');return _0x31190f[_0xeef9('0x4d')](_0x4ec5cc)[_0xeef9('0x18')](function(){for(var _0xd07316=0x0;_0xd07316<_0x4ec5cc[_0xeef9('0x20')];_0xd07316+=0x1){_0x5c325f[_0xeef9('0x4e')](_0xeef9('0x4f'),{'ChatInteractionId':Number(_0x4ec5cc[_0xd07316]),'UserId':Number(_0x31190f['id'])});}});}})['then'](function(){if(_0x488fc5===_0xeef9('0x4c')){var _0xf2b35=_[_0xeef9('0x19')](_0x31190f[_0xeef9('0x27')],'id');return _0x31190f[_0xeef9('0x50')](_0xf2b35)[_0xeef9('0x18')](function(){for(var _0x1564d6=0x0;_0x1564d6<_0xf2b35[_0xeef9('0x20')];_0x1564d6+=0x1){_0x5c325f[_0xeef9('0x4e')](_0xeef9('0x51'),{'MailInteractionId':Number(_0xf2b35[_0x1564d6]),'UserId':Number(_0x31190f['id'])});}});}})[_0xeef9('0x18')](function(){if(_0x488fc5===_0xeef9('0x4c')){var _0x17cfce=_['map'](_0x31190f[_0xeef9('0x29')],'id');return _0x31190f[_0xeef9('0x52')](_0x17cfce)[_0xeef9('0x18')](function(){for(var _0x25890a=0x0;_0x25890a<_0x17cfce[_0xeef9('0x20')];_0x25890a+=0x1){_0x5c325f[_0xeef9('0x4e')](_0xeef9('0x53'),{'FaxInteractionId':Number(_0x17cfce[_0x25890a]),'UserId':Number(_0x31190f['id'])});}});}})[_0xeef9('0x18')](function(){if(_0x488fc5===_0xeef9('0x4c')){var _0x3340c1=_[_0xeef9('0x19')](_0x31190f[_0xeef9('0x2b')],'id');return _0x31190f[_0xeef9('0x54')](_0x3340c1)[_0xeef9('0x18')](function(){for(var _0x179998=0x0;_0x179998<_0x3340c1[_0xeef9('0x20')];_0x179998+=0x1){_0x5c325f['emit'](_0xeef9('0x55'),{'SmsInteractionId':Number(_0x3340c1[_0x179998]),'UserId':Number(_0x31190f['id'])});}});}})[_0xeef9('0x18')](function(){if(_0x488fc5==='leave'){var _0x2c4bf8=_['map'](_0x31190f[_0xeef9('0x2c')],'id');return _0x31190f[_0xeef9('0x56')](_0x2c4bf8)[_0xeef9('0x18')](function(){for(var _0x512295=0x0;_0x512295<_0x2c4bf8[_0xeef9('0x20')];_0x512295+=0x1){_0x5c325f[_0xeef9('0x4e')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x2c4bf8[_0x512295]),'UserId':Number(_0x31190f['id'])});}});}})['then'](function(){if(_0x488fc5==='leave'){var _0x12f3c9=_[_0xeef9('0x19')](_0x31190f[_0xeef9('0x2e')],'id');return _0x31190f[_0xeef9('0x57')](_0x12f3c9)[_0xeef9('0x18')](function(){for(var _0x436a25=0x0;_0x436a25<_0x12f3c9[_0xeef9('0x20')];_0x436a25+=0x1){_0x5c325f['emit'](_0xeef9('0x58'),{'WhatsappInteractionId':Number(_0x12f3c9[_0x436a25]),'UserId':Number(_0x31190f['id'])});}});}})[_0xeef9('0x59')](function(_0x43e377){_0x2351a1['log'](_0x43e377);});}}function onDisconnect(_0x25b823,_0x5161de){joinOrLeave(_0x25b823,'leave',_0x5161de);}function onConnect(_0x441bc0){joinOrLeave(_0x441bc0,_0xeef9('0x5a'));}exports[_0xeef9('0x5b')]=function(_0x1ff42d){_0x1ff42d['on'](_0xeef9('0x5c'),function(_0x481ee0){_0x481ee0[_0xeef9('0x5d')](0x0);_0x481ee0[_0xeef9('0x5e')]=_0x481ee0['request'][_0xeef9('0x5c')][_0xeef9('0x5f')]+':'+_0x481ee0[_0xeef9('0x60')][_0xeef9('0x5c')][_0xeef9('0x61')];_0x481ee0[_0xeef9('0x62')]=new Date();_0x481ee0[_0xeef9('0x63')]=function(_0x4c981d){console[_0xeef9('0x63')]('SocketIO\x20'+_0x481ee0[_0xeef9('0x64')][_0xeef9('0x4')]+'['+_0x481ee0[_0xeef9('0x5e')]+']',_0x4c981d);};_0x481ee0['on'](_0xeef9('0x65'),function(){onDisconnect(_0x481ee0,_0x1ff42d);_0x481ee0[_0xeef9('0x63')](_0xeef9('0x66'));});onConnect(_0x481ee0);_0x481ee0[_0xeef9('0x63')](_0xeef9('0x67'));});}; \ No newline at end of file +var _0xd93e=['role','Campaign','format','%s:queue:%s','length','user:%s','find','userProfileId','handshake','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','WhatsappQueue','Trunk','MailQueue','OpenchannelQueue','voice:inbound','getVoiceQueues','getChatQueues','getSmsQueues','getOpenchannelQueues','voice','chat','fax','sms','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','./environment','name','Agents','User','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map'];(function(_0x59ae4f,_0x13d7cf){var _0x31e795=function(_0x25e22c){while(--_0x25e22c){_0x59ae4f['push'](_0x59ae4f['shift']());}};_0x31e795(++_0x13d7cf);}(_0xd93e,0x1d7));var _0xed93=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xd93e[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0xed93('0x0'));var util=require(_0xed93('0x1'));var BPromise=require(_0xed93('0x2'));var db=require('../mysqldb')['db'];var config=require(_0xed93('0x3'));var queryQueues={'attributes':['id',_0xed93('0x4')],'include':[{'as':_0xed93('0x5'),'model':db[_0xed93('0x6')],'attributes':['id',_0xed93('0x4'),'role'],'raw':!![],'where':{'role':_0xed93('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xed93('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xed93('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xed93('0x4')],'where':{'role':_0xed93('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xed93('0x4'),_0xed93('0x9')],'where':{'type':_0xed93('0xa')}};function getAssociatedResources(_0x4278ea,_0x410631,_0x24a9fa){return db[_0xed93('0xb')][_0xed93('0xc')]({'where':{'name':_0x4278ea,'userProfileId':_0x410631},'raw':!![]})[_0xed93('0xd')](function(_0x4f2f22){if(_0x4f2f22){if(_0x4f2f22[_0xed93('0xe')]){switch(_0x4278ea){case _0xed93('0xf'):case _0xed93('0x10'):case _0xed93('0x11'):case _0xed93('0x12'):case _0xed93('0x13'):case _0xed93('0x14'):case _0xed93('0x15'):return db[_0x24a9fa][_0xed93('0x16')](queryQueues);case _0xed93('0x17'):return db[_0x24a9fa][_0xed93('0x16')](queryTelephones);case _0xed93('0x18'):return db[_0x24a9fa][_0xed93('0x16')](queryTrunks);case _0xed93('0x19'):return db[_0x24a9fa]['findAll'](queryCampaigns);}}else{return db[_0xed93('0x1a')]['findAll']({'attributes':[_0xed93('0x1b')],'where':{'sectionId':_0x4f2f22['id']},'raw':!![]})[_0xed93('0xd')](function(_0x4321ca){if(_0x4321ca){var _0x23e4f6={'where':{'id':_[_0xed93('0x1c')](_0x4321ca,_0xed93('0x1b'))},'raw':!![]};switch(_0x24a9fa){case _0xed93('0x6'):_0x23e4f6['where'][_0xed93('0x1d')]='telephone';break;case _0xed93('0x1e'):_0x23e4f6['where'][_0xed93('0x9')]=_0xed93('0xa');break;}return db[_0x24a9fa]['findAll'](_0x23e4f6);}else{return[];}});}}else{return[];}})[_0xed93('0xd')](function(_0x273377){return _0x273377;});}function joinOrLeaveQueues(_0x3e2896,_0x122944,_0x1a1583,_0x45c9c4){_0x3e2896[_0x122944](util[_0xed93('0x1f')](_0xed93('0x20'),_0x1a1583,_0x45c9c4[_0xed93('0x4')]));if(_0x45c9c4['Agents']){for(var _0x7f69c=0x0;_0x7f69c<_0x45c9c4[_0xed93('0x5')][_0xed93('0x21')];_0x7f69c+=0x1){_0x3e2896[_0x122944](util[_0xed93('0x1f')](_0xed93('0x22'),_0x45c9c4[_0xed93('0x5')][_0x7f69c][_0xed93('0x4')]));}}}function joinOrLeave(_0x5b092f,_0x2140e5,_0x4eea65){var _0x162996;if(_0x5b092f['handshake']['query']['id']){db[_0xed93('0x6')][_0xed93('0x23')]({'attributes':['id',_0xed93('0x4'),_0xed93('0x1d'),_0xed93('0x24')],'where':{'id':_0x5b092f[_0xed93('0x25')][_0xed93('0x26')]['id']},'include':[{'model':db[_0xed93('0x27')],'as':_0xed93('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xed93('0x29')],'as':_0xed93('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0xed93('0x2b')],'as':_0xed93('0x2c'),'attributes':['id'],'raw':!![]},{'model':db[_0xed93('0x2d')],'as':_0xed93('0x2e'),'attributes':['id'],'raw':!![]},{'model':db[_0xed93('0x2f')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xed93('0x30')],'as':_0xed93('0x31'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x84ddcc){if(_0x84ddcc){_0x162996=_0x84ddcc;_0x5b092f[_0x2140e5](util['format'](_0xed93('0x22'),_0x84ddcc['name']));var _0x254b43=[];switch(_0x84ddcc[_0xed93('0x1d')]){case'admin':_0x5b092f[_0x2140e5]('voice:inbound');_0x5b092f[_0x2140e5](_0xed93('0x32'));if(queryQueues[_0xed93('0x33')](_0xed93('0x34'))){delete queryQueues[_0xed93('0x34')];}_0x254b43[_0xed93('0x35')](db[_0xed93('0x36')][_0xed93('0x16')](queryQueues));_0x254b43['push'](db[_0xed93('0x37')][_0xed93('0x16')](queryQueues));_0x254b43['push'](db[_0xed93('0x38')]['findAll'](queryQueues));_0x254b43[_0xed93('0x35')](db[_0xed93('0x39')][_0xed93('0x16')](queryQueues));_0x254b43[_0xed93('0x35')](db['MailQueue']['findAll'](queryQueues));_0x254b43[_0xed93('0x35')](db['OpenchannelQueue']['findAll'](queryQueues));_0x254b43[_0xed93('0x35')](db[_0xed93('0x3a')][_0xed93('0x16')](queryQueues));_0x254b43['push'](db[_0xed93('0x6')][_0xed93('0x16')](queryTelephones));_0x254b43['push'](db[_0xed93('0x3b')][_0xed93('0x16')](queryTrunks));_0x254b43['push'](db[_0xed93('0x1e')][_0xed93('0x16')](queryCampaigns));_0x254b43[_0xed93('0x35')](db['User'][_0xed93('0x16')](queryAgents));break;case'user':_0x5b092f[_0x2140e5]('voice:inbound');_0x5b092f[_0x2140e5](_0xed93('0x32'));_0x254b43[_0xed93('0x35')](getAssociatedResources('VoiceQueues',_0x84ddcc[_0xed93('0x24')],_0xed93('0x36')));_0x254b43[_0xed93('0x35')](getAssociatedResources(_0xed93('0x10'),_0x84ddcc[_0xed93('0x24')],_0xed93('0x37')));_0x254b43[_0xed93('0x35')](getAssociatedResources(_0xed93('0x11'),_0x84ddcc['userProfileId'],_0xed93('0x38')));_0x254b43['push'](getAssociatedResources('SmsQueues',_0x84ddcc[_0xed93('0x24')],_0xed93('0x39')));_0x254b43[_0xed93('0x35')](getAssociatedResources('MailQueues',_0x84ddcc[_0xed93('0x24')],_0xed93('0x3c')));_0x254b43[_0xed93('0x35')](getAssociatedResources('OpenchannelQueues',_0x84ddcc[_0xed93('0x24')],_0xed93('0x3d')));_0x254b43[_0xed93('0x35')](getAssociatedResources('WhatsappQueues',_0x84ddcc['userProfileId'],_0xed93('0x3a')));_0x254b43[_0xed93('0x35')](getAssociatedResources(_0xed93('0x17'),_0x84ddcc['userProfileId'],_0xed93('0x6')));_0x254b43[_0xed93('0x35')](getAssociatedResources(_0xed93('0x18'),_0x84ddcc[_0xed93('0x24')],_0xed93('0x3b')));_0x254b43['push'](getAssociatedResources(_0xed93('0x19'),_0x84ddcc[_0xed93('0x24')],_0xed93('0x1e')));_0x254b43[_0xed93('0x35')](db['User'][_0xed93('0x16')](queryAgents));break;case _0xed93('0x7'):_0x5b092f[_0x2140e5](_0xed93('0x3e'));_0x5b092f[_0x2140e5](_0xed93('0x32'));_0x254b43[_0xed93('0x35')](_0x84ddcc[_0xed93('0x3f')]({'attributes':['id',_0xed93('0x4')]}));_0x254b43['push'](_0x84ddcc[_0xed93('0x40')]({'attributes':['id',_0xed93('0x4')]}));_0x254b43[_0xed93('0x35')](_0x84ddcc['getFaxQueues']({'attributes':['id',_0xed93('0x4')]}));_0x254b43[_0xed93('0x35')](_0x84ddcc[_0xed93('0x41')]({'attributes':['id','name']}));_0x254b43['push'](_0x84ddcc['getMailQueues']({'attributes':['id',_0xed93('0x4')]}));_0x254b43['push'](_0x84ddcc[_0xed93('0x42')]({'attributes':['id','name']}));_0x254b43['push'](_0x84ddcc['getWhatsappQueues']({'attributes':['id',_0xed93('0x4')]}));break;}return BPromise['all'](_0x254b43);}})[_0xed93('0xd')](function(_0x7af295){if(_0x7af295&&_0x7af295[_0xed93('0x21')]){for(var _0x1157a3=0x0;_0x1157a3<_0x7af295[_0xed93('0x21')];_0x1157a3+=0x1){for(var _0x30e2e3=0x0;_0x30e2e3<_0x7af295[_0x1157a3][_0xed93('0x21')];_0x30e2e3+=0x1){switch(_0x1157a3){case 0x0:joinOrLeaveQueues(_0x5b092f,_0x2140e5,_0xed93('0x43'),_0x7af295[_0x1157a3][_0x30e2e3]);break;case 0x1:joinOrLeaveQueues(_0x5b092f,_0x2140e5,_0xed93('0x44'),_0x7af295[_0x1157a3][_0x30e2e3]);break;case 0x2:joinOrLeaveQueues(_0x5b092f,_0x2140e5,_0xed93('0x45'),_0x7af295[_0x1157a3][_0x30e2e3]);break;case 0x3:joinOrLeaveQueues(_0x5b092f,_0x2140e5,_0xed93('0x46'),_0x7af295[_0x1157a3][_0x30e2e3]);break;case 0x4:joinOrLeaveQueues(_0x5b092f,_0x2140e5,'mail',_0x7af295[_0x1157a3][_0x30e2e3]);break;case 0x5:joinOrLeaveQueues(_0x5b092f,_0x2140e5,'openchannel',_0x7af295[_0x1157a3][_0x30e2e3]);break;case 0x6:joinOrLeaveQueues(_0x5b092f,_0x2140e5,'whatsapp',_0x7af295[_0x1157a3][_0x30e2e3]);break;case 0x7:if(_0x162996[_0xed93('0x1d')]!==_0xed93('0x7'))_0x5b092f[_0x2140e5](util[_0xed93('0x1f')](_0xed93('0x47'),_0x7af295[_0x1157a3][_0x30e2e3][_0xed93('0x4')]));break;case 0x8:if(_0x162996[_0xed93('0x1d')]!==_0xed93('0x7'))_0x5b092f[_0x2140e5](util[_0xed93('0x1f')](_0xed93('0x48'),_0x7af295[_0x1157a3][_0x30e2e3][_0xed93('0x4')]));break;case 0x9:if(_0x162996[_0xed93('0x1d')]!=='agent')_0x5b092f[_0x2140e5](util['format'](_0xed93('0x49'),_0x7af295[_0x1157a3][_0x30e2e3][_0xed93('0x9')],_0x7af295[_0x1157a3][_0x30e2e3][_0xed93('0x4')]));break;case 0xa:_0x5b092f[_0x2140e5](util[_0xed93('0x1f')](_0xed93('0x22'),_0x7af295[_0x1157a3][_0x30e2e3][_0xed93('0x4')]));break;}}}}})[_0xed93('0xd')](function(){if(_0x2140e5===_0xed93('0x4a')){var _0x1be9a8=_[_0xed93('0x1c')](_0x162996['ChatInteractions'],'id');return _0x162996[_0xed93('0x4b')](_0x1be9a8)[_0xed93('0xd')](function(){for(var _0x10da64=0x0;_0x10da64<_0x1be9a8[_0xed93('0x21')];_0x10da64+=0x1){_0x4eea65[_0xed93('0x4c')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x1be9a8[_0x10da64]),'UserId':Number(_0x162996['id'])});}});}})['then'](function(){if(_0x2140e5===_0xed93('0x4a')){var _0x15722d=_[_0xed93('0x1c')](_0x162996[_0xed93('0x2a')],'id');return _0x162996['removeMailInteractions'](_0x15722d)[_0xed93('0xd')](function(){for(var _0x2fa782=0x0;_0x2fa782<_0x15722d[_0xed93('0x21')];_0x2fa782+=0x1){_0x4eea65['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x15722d[_0x2fa782]),'UserId':Number(_0x162996['id'])});}});}})[_0xed93('0xd')](function(){if(_0x2140e5===_0xed93('0x4a')){var _0x1787f5=_[_0xed93('0x1c')](_0x162996[_0xed93('0x2c')],'id');return _0x162996[_0xed93('0x4d')](_0x1787f5)['then'](function(){for(var _0x5ab58c=0x0;_0x5ab58c<_0x1787f5[_0xed93('0x21')];_0x5ab58c+=0x1){_0x4eea65[_0xed93('0x4c')](_0xed93('0x4e'),{'FaxInteractionId':Number(_0x1787f5[_0x5ab58c]),'UserId':Number(_0x162996['id'])});}});}})['then'](function(){if(_0x2140e5==='leave'){var _0x4331ea=_[_0xed93('0x1c')](_0x162996[_0xed93('0x2e')],'id');return _0x162996[_0xed93('0x4f')](_0x4331ea)[_0xed93('0xd')](function(){for(var _0x2f36be=0x0;_0x2f36be<_0x4331ea['length'];_0x2f36be+=0x1){_0x4eea65[_0xed93('0x4c')](_0xed93('0x50'),{'SmsInteractionId':Number(_0x4331ea[_0x2f36be]),'UserId':Number(_0x162996['id'])});}});}})[_0xed93('0xd')](function(){if(_0x2140e5===_0xed93('0x4a')){var _0x38262e=_[_0xed93('0x1c')](_0x162996['OpenchannelInteractions'],'id');return _0x162996[_0xed93('0x51')](_0x38262e)[_0xed93('0xd')](function(){for(var _0x37acb6=0x0;_0x37acb6<_0x38262e[_0xed93('0x21')];_0x37acb6+=0x1){_0x4eea65[_0xed93('0x4c')](_0xed93('0x52'),{'OpenchannelInteractionId':Number(_0x38262e[_0x37acb6]),'UserId':Number(_0x162996['id'])});}});}})['then'](function(){if(_0x2140e5===_0xed93('0x4a')){var _0xc3b912=_[_0xed93('0x1c')](_0x162996[_0xed93('0x31')],'id');return _0x162996[_0xed93('0x53')](_0xc3b912)[_0xed93('0xd')](function(){for(var _0x45f064=0x0;_0x45f064<_0xc3b912[_0xed93('0x21')];_0x45f064+=0x1){_0x4eea65['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0xc3b912[_0x45f064]),'UserId':Number(_0x162996['id'])});}});}})[_0xed93('0x54')](function(_0x52b25c){_0x5b092f['log'](_0x52b25c);});}}function onDisconnect(_0x12ffc4,_0x163693){joinOrLeave(_0x12ffc4,_0xed93('0x4a'),_0x163693);}function onConnect(_0x2fd07e){joinOrLeave(_0x2fd07e,_0xed93('0x55'));}exports[_0xed93('0x56')]=function(_0xd4eda0){_0xd4eda0['on'](_0xed93('0x57'),function(_0x1e61a0){_0x1e61a0[_0xed93('0x58')](0x0);_0x1e61a0[_0xed93('0x59')]=_0x1e61a0[_0xed93('0x5a')][_0xed93('0x57')][_0xed93('0x5b')]+':'+_0x1e61a0['request'][_0xed93('0x57')][_0xed93('0x5c')];_0x1e61a0[_0xed93('0x5d')]=new Date();_0x1e61a0[_0xed93('0x5e')]=function(_0x197859){console[_0xed93('0x5e')](_0xed93('0x5f')+_0x1e61a0[_0xed93('0x60')]['name']+'['+_0x1e61a0[_0xed93('0x59')]+']',_0x197859);};_0x1e61a0['on'](_0xed93('0x61'),function(){onDisconnect(_0x1e61a0,_0xd4eda0);_0x1e61a0[_0xed93('0x5e')](_0xed93('0x62'));});onConnect(_0x1e61a0);_0x1e61a0[_0xed93('0x5e')](_0xed93('0x63'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index f2baf37..c3cad35 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 _0xfdd0=['internal','interface','SIP/%s','agent','outgoingmessage','QueryTypes','changed','substatus','closed','format','length','hasOwnProperty','model','toLowerCase','condition','util','../../mysqldb','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','afterUpdate','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','Openchannel','OpenchannelInteraction','then','info','Trigger,\x20%s','EventManager','error','code','catch','get','channel','motionChannel','event','direction','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','query','Sequelize','SELECT','contact','UserId','User','find','name','fullname','email'];(function(_0x187027,_0x56a6a2){var _0x1d2049=function(_0x53af57){while(--_0x53af57){_0x187027['push'](_0x187027['shift']());}};_0x1d2049(++_0x56a6a2);}(_0xfdd0,0xd8));var _0x0fdd=function(_0x483ca3,_0x4359c6){_0x483ca3=_0x483ca3-0x0;var _0x3264af=_0xfdd0[_0x483ca3];return _0x3264af;};'use strict';var util=require(_0x0fdd('0x0'));var db=require(_0x0fdd('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0x0fdd('0x2'))(_0x0fdd('0x3'));var _=require('lodash');var client=jayson[_0x0fdd('0x4')][_0x0fdd('0x5')]({'port':0x232a});var triggers=[{'channel':_0x0fdd('0x6'),'model':_0x0fdd('0x7'),'event':_0x0fdd('0x8'),'condition':_0x0fdd('0x9'),'callback':afterCreate},{'channel':_0x0fdd('0x6'),'model':_0x0fdd('0x7'),'event':'afterUpdate','condition':_0x0fdd('0xa'),'callback':afterUpdate},{'channel':_0x0fdd('0x6'),'model':_0x0fdd('0xb'),'event':'afterCreate','condition':_0x0fdd('0xc'),'callback':afterCreateMessage},{'channel':_0x0fdd('0xd'),'model':_0x0fdd('0xe'),'event':_0x0fdd('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x0fdd('0xd'),'model':'SmsInteraction','event':_0x0fdd('0xf'),'condition':_0x0fdd('0xa'),'callback':afterUpdate},{'channel':_0x0fdd('0xd'),'model':_0x0fdd('0x10'),'event':_0x0fdd('0x8'),'condition':_0x0fdd('0xc'),'callback':afterCreateMessage},{'channel':_0x0fdd('0x11'),'model':'WhatsappInteraction','event':_0x0fdd('0x8'),'condition':_0x0fdd('0x9'),'callback':afterCreate},{'channel':_0x0fdd('0x11'),'model':_0x0fdd('0x12'),'event':'afterUpdate','condition':_0x0fdd('0xa'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x0fdd('0x13'),'event':'afterCreate','condition':_0x0fdd('0xc'),'callback':afterCreateMessage},{'channel':_0x0fdd('0x14'),'model':_0x0fdd('0x15'),'event':_0x0fdd('0x8'),'condition':_0x0fdd('0x9'),'callback':afterCreate},{'channel':'Fax','model':'FaxInteraction','event':'afterUpdate','condition':_0x0fdd('0xa'),'callback':afterUpdate},{'channel':'Fax','model':_0x0fdd('0x16'),'event':_0x0fdd('0x8'),'condition':_0x0fdd('0xc'),'callback':afterCreateMessage},{'channel':_0x0fdd('0x17'),'model':_0x0fdd('0x18'),'event':_0x0fdd('0x8'),'condition':_0x0fdd('0x9'),'callback':afterCreate},{'channel':_0x0fdd('0x17'),'model':_0x0fdd('0x18'),'event':_0x0fdd('0xf'),'condition':_0x0fdd('0xa'),'callback':afterUpdate},{'channel':_0x0fdd('0x17'),'model':'MailMessage','event':_0x0fdd('0x8'),'condition':_0x0fdd('0xc'),'callback':afterCreateMessage},{'channel':_0x0fdd('0x19'),'model':'OpenchannelInteraction','event':'afterCreate','condition':_0x0fdd('0x9'),'callback':afterCreate},{'channel':_0x0fdd('0x19'),'model':_0x0fdd('0x1a'),'event':_0x0fdd('0xf'),'condition':_0x0fdd('0xa'),'callback':afterUpdate},{'channel':_0x0fdd('0x19'),'model':'OpenchannelMessage','event':_0x0fdd('0x8'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x1bc6f0){return client['request']('EventManager',_0x1bc6f0)[_0x0fdd('0x1b')](function(_0x1cd974){logger[_0x0fdd('0x1c')](_0x0fdd('0x1d'),_0x0fdd('0x1e'),_0x1cd974);if(_0x1cd974[_0x0fdd('0x1f')]){if(_0x1cd974['error'][_0x0fdd('0x20')]===0x1f4){logger['error'](_0x0fdd('0x1d'),_0x0fdd('0x1e'),_0x1cd974[_0x0fdd('0x1f')]);}}})[_0x0fdd('0x21')](function(_0x3edda7){logger['error']('Trigger,\x20%s',_0x0fdd('0x1e'),_0x3edda7);});}function afterCreateMessage(_0x5d6fa9,_0x261a4f){return function(_0x2d1910,_0x8e3ad){_0x2d1910=_0x2d1910[_0x0fdd('0x22')]({'plain':!![]});_0x2d1910[_0x0fdd('0x23')]=_0x5d6fa9;_0x2d1910[_0x0fdd('0x24')]=_0x5d6fa9;_0x2d1910[_0x0fdd('0x25')]=_0x2d1910[_0x0fdd('0x26')];var _0x11562d=_0x0fdd('0x27')+_0x2d1910[_0x0fdd('0x28')];return db[_0x0fdd('0x29')][_0x0fdd('0x2a')](_0x11562d,{'type':db[_0x0fdd('0x2b')]['QueryTypes'][_0x0fdd('0x2c')],'raw':!![]})['then'](function(_0x588985){return _0x588985;})[_0x0fdd('0x1b')](function(_0x338092){if(_0x338092){_0x2d1910[_0x0fdd('0x2d')]=_0x338092[0x0];}if(_0x2d1910[_0x0fdd('0x2e')]){return db[_0x0fdd('0x2f')][_0x0fdd('0x30')]({'where':{'id':_0x2d1910[_0x0fdd('0x2e')]},'attributes':['id',_0x0fdd('0x31'),_0x0fdd('0x32'),_0x0fdd('0x33'),_0x0fdd('0x34')],'raw':!![]})['then'](function(_0x149c12){_0x2d1910[_0x0fdd('0x35')]=util['format'](_0x0fdd('0x36'),_0x149c12[_0x0fdd('0x31')]);_0x2d1910[_0x0fdd('0x23')]=_0x5d6fa9;_0x2d1910[_0x0fdd('0x37')]=_0x149c12;return request({'event':'incomingmessage','message':_0x2d1910});})[_0x0fdd('0x21')](function(_0x56880d){console[_0x0fdd('0x1f')](_0x56880d);});}else{return request({'event':_0x0fdd('0x38'),'message':_0x2d1910});}});};}function afterCreate(_0x63880f,_0x18fe00){return function(_0x1c0a8,_0x4d6395){_0x1c0a8=_0x1c0a8[_0x0fdd('0x22')]({'plain':!![]});_0x1c0a8[_0x0fdd('0x23')]=_0x63880f;_0x1c0a8[_0x0fdd('0x24')]=_0x63880f;_0x1c0a8['event']='opened';var _0x56cfe4=_0x0fdd('0x27')+_0x1c0a8['ContactId'];return db[_0x0fdd('0x29')][_0x0fdd('0x2a')](_0x56cfe4,{'type':db[_0x0fdd('0x2b')][_0x0fdd('0x39')][_0x0fdd('0x2c')],'raw':!![]})['then'](function(_0x1eeb59){return _0x1eeb59;})['then'](function(_0x2ddeca){if(_0x2ddeca){_0x1c0a8[_0x0fdd('0x2d')]=_0x2ddeca[0x0];}return request({'event':_0x18fe00,'message':_0x1c0a8});});};}function afterUpdate(_0x1cee76){return function(_0x12dee1){var _0x59d16c=_0x12dee1['changed']('closed')&&_0x12dee1['closed'];var _0x3a6e54=_0x12dee1[_0x0fdd('0x3a')](_0x0fdd('0x3b'));if(_0x59d16c||_0x3a6e54){var _0x10cdc8=_0x59d16c?_0x0fdd('0xa'):'substatus';var _0x2cc204=_0x12dee1[_0x0fdd('0x22')]({'plain':!![]});_0x2cc204['channel']=_0x1cee76;_0x2cc204[_0x0fdd('0x24')]=_0x1cee76;_0x2cc204[_0x0fdd('0x25')]=_0x59d16c?_0x0fdd('0x3c'):_0x0fdd('0x3b');var _0x396676='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2cc204[_0x0fdd('0x28')];return db['sequelize']['query'](_0x396676,{'type':db[_0x0fdd('0x2b')][_0x0fdd('0x39')][_0x0fdd('0x2c')],'raw':!![]})[_0x0fdd('0x1b')](function(_0x4bedd7){if(_0x4bedd7){_0x2cc204[_0x0fdd('0x2d')]=_0x4bedd7[0x0];}if(_0x2cc204['UserId']){return db['User']['find']({'where':{'id':_0x2cc204[_0x0fdd('0x2e')]},'attributes':['id',_0x0fdd('0x31'),'fullname',_0x0fdd('0x33'),_0x0fdd('0x34')],'raw':!![]})[_0x0fdd('0x1b')](function(_0x2a12a8){_0x2cc204[_0x0fdd('0x35')]=util[_0x0fdd('0x3d')](_0x0fdd('0x36'),_0x2a12a8[_0x0fdd('0x31')]);_0x2cc204[_0x0fdd('0x37')]=_0x2a12a8;return request({'event':_0x10cdc8,'message':_0x2cc204});})[_0x0fdd('0x21')](function(_0x3e7a6e){console['error'](_0x3e7a6e);});}else{return request({'event':_0x10cdc8,'message':_0x2cc204});}});}};}exports['default']=function(){for(var _0x66d834=0x0;_0x66d834=_0x1c1a00[_0x1b1d('0x15')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x2e89df(_0x34ec3b);})['catch'](function(_0x281e77){_0x50235d(_0x281e77);});});}; \ No newline at end of file +var _0xda07=['includes','clearBlockUser','updateAttributes','getLicense','role','count','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','bluebird','mail','chat','fax','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xda07,0x173));var _0x7da0=function(_0x21cfd9,_0x379091){_0x21cfd9=_0x21cfd9-0x0;var _0x4eba0d=_0xda07[_0x21cfd9];return _0x4eba0d;};'use strict';var _=require('lodash');var BPromise=require(_0x7da0('0x0'));var db=require('../mysqldb')['db'];var util=require('./license/util');var channels=['voice',_0x7da0('0x1'),_0x7da0('0x2'),_0x7da0('0x3'),'sms',_0x7da0('0x4'),_0x7da0('0x5')];exports[_0x7da0('0x6')]=function(){return channels;};exports[_0x7da0('0x7')]=function(_0x20186c){_0x20186c=_0x20186c[_0x7da0('0x8')]();return _[_0x7da0('0x9')](channels,_0x20186c);};exports[_0x7da0('0xa')]=function(_0xda117a,_0x36b84f,_0x318d00,_0x26c3b7){var _0xe46720={'loginAttempts':_0x36b84f,'blocked':_0x318d00};if(!_['isUndefined'](_0x26c3b7)){_0xe46720['blockedAt']=_0x26c3b7;}return _0xda117a[_0x7da0('0xb')](_0xe46720);};exports[_0x7da0('0xc')]=function(_0x5496ad){return new BPromise(function(_0x1c06ab,_0x1cf8e1){var _0x304c59=0x0;if(_0x5496ad[_0x7da0('0xd')]!=='agent'){_0x1c06ab(_0x5496ad);}db['User'][_0x7da0('0xe')]({'where':{'role':_0x7da0('0xf'),'online':!![],'id':{'$ne':_0x5496ad['id']}}})[_0x7da0('0x10')](function(_0x45544f){_0x304c59=_0x45544f;return util[_0x7da0('0xc')]();})['then'](function(_0x467196){if(_0x467196&&_0x467196[_0x7da0('0x11')]&&_0x304c59>=_0x467196[_0x7da0('0x11')]){throw Error(_0x7da0('0x12'));}_0x1c06ab(_0x5496ad);})[_0x7da0('0x13')](function(_0x55204a){_0x1cf8e1(_0x55204a);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 8dcb71f..f3ba269 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f90=['status','send','exports','404'];(function(_0x7489e9,_0x506556){var _0x716c05=function(_0x12d74b){while(--_0x12d74b){_0x7489e9['push'](_0x7489e9['shift']());}};_0x716c05(++_0x506556);}(_0x5f90,0xc6));var _0x05f9=function(_0x2681ce,_0x4b1e48){_0x2681ce=_0x2681ce-0x0;var _0x23b739=_0x5f90[_0x2681ce];return _0x23b739;};'use strict';module[_0x05f9('0x0')][0x194]=function pageNotFound(_0x11d81f,_0x369df5){var _0x57ab18=_0x05f9('0x1');var _0x94409b=0x194;var _0x4bd1a0={'status':_0x94409b};_0x369df5['status'](_0x4bd1a0[_0x05f9('0x2')]);_0x369df5['render'](_0x57ab18,{},function(_0x3e4303,_0x19a22d){if(_0x3e4303){return _0x369df5[_0x05f9('0x2')](_0x4bd1a0[_0x05f9('0x2')])['json'](_0x4bd1a0);}_0x369df5[_0x05f9('0x3')](_0x19a22d);});}; \ No newline at end of file +var _0x5dda=['render','json','send','404','status'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5dda,0x8f));var _0xa5dd=function(_0x201526,_0x4f8f03){_0x201526=_0x201526-0x0;var _0x1f9a19=_0x5dda[_0x201526];return _0x1f9a19;};'use strict';module['exports'][0x194]=function pageNotFound(_0x246103,_0x3dbae7){var _0x29cd32=_0xa5dd('0x0');var _0xcea4f6=0x194;var _0x3878e2={'status':_0xcea4f6};_0x3dbae7['status'](_0x3878e2[_0xa5dd('0x1')]);_0x3dbae7[_0xa5dd('0x2')](_0x29cd32,{},function(_0x5abc90,_0x423c19){if(_0x5abc90){return _0x3dbae7[_0xa5dd('0x1')](_0x3878e2[_0xa5dd('0x1')])[_0xa5dd('0x3')](_0x3878e2);}_0x3dbae7[_0xa5dd('0x4')](_0x423c19);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 6168578..09a88a1 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['hasMany','UserId','VoiceQueuesRt','VoiceExtension','CmHopperFinal','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','UserProfile','belongsToMany','chat_group_has_users','Contacts','cm_user_has_contacts','CmList','Lists','ChatInteraction','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','UserVoicePrefix','MailQueue','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueue','WhatsappQueues','cm_user_has_lists','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Teams','TeamVoiceQueue','VoiceRecording','Messages','mailboxuser','AgentReports','uniqueid','Contact','ContactId','MailAccount','MailAccountId','MailServerOut','Dispositions','Answers','Interactions','List','ListId','Template','TemplateId','Owner','mail_interaction_has_tags','Tags','ThroughTags','user_has_mail_interactions','MailInteractionId','Attachments','Account','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','restrict','TagId','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','Users','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','Interaction','SmsQueueId','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','ChatApplication','Agent','Queue','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Website','CompanyId','Hoppers','cm_contact_has_tags','OwnerId','CampaignId','All','AutomationAllId','Any','OneAny','Actions','AutomationId','ParentId','Intervals','ChatApplications','FaxApplications','DefaultReportId','CustomReportId','Mohs','AllConditions','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','Trigger','TriggerId','Fields','AnalyticMetric','MetricId','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','VariableId','Configurations','DeskConfiguration','int_desk_configuration_has_tags','ZohoAccount','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','ServicenowConfiguration','Dynamics365Configuration','FreshsalesField','FromId','SessionId','SmsQueueReport','ProjectId','user_has_teams','team_has_mail_queues','team_has_sms_queues','team_has_whatsapp_queues','TeamVoicePrefix','SquareProjectId','campaigns_has_cm_lists','BlackLists','MailTransferReport','FromMailAccountId','FromAccount','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','FromAgent','ToChatQueueId','ToQueue','FromFaxAccountId','ToFaxQueueId','OpenchannelTransferReport','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','voice_queues_has_cm_lists','Extensions','userProfileId','UserProfileSections','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappApplication','user_has_whatsapp_accounts','WhatsappInteractionId','whatsapp_interaction_has_tags','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','sequelize','jstz','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','database','username','password','options','User','import','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','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/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Tag','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','cascade'];(function(_0x29beb2,_0x37dc64){var _0x1d66d7=function(_0x2e2a7b){while(--_0x2e2a7b){_0x29beb2['push'](_0x29beb2['shift']());}};_0x1d66d7(++_0x37dc64);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2c7d1f,_0x5e01cf){_0x2c7d1f=_0x2c7d1f-0x0;var _0x3bd069=_0x9bde[_0x2c7d1f];return _0x3bd069;};'use strict';var config=require('../config/environment');var Sequelize=require(_0xe9bd('0x0'));var _=require('lodash');var jstz=require(_0xe9bd('0x1'));var timezone=jstz['determine']();config[_0xe9bd('0x0')]=_[_0xe9bd('0x2')](config[_0xe9bd('0x0')],{'database':_0xe9bd('0x3'),'username':_0xe9bd('0x4'),'password':_0xe9bd('0x5'),'options':{'host':_0xe9bd('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xe9bd('0x7')},'logging':![],'timezone':timezone[_0xe9bd('0x8')](),'define':{'charset':_0xe9bd('0x9'),'collate':_0xe9bd('0xa')}}});config[_0xe9bd('0xb')]=_[_0xe9bd('0x2')](config[_0xe9bd('0xb')],{'database':_0xe9bd('0x3'),'username':_0xe9bd('0x4'),'password':_0xe9bd('0x5'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xe9bd('0x7')},'logging':![],'timezone':timezone[_0xe9bd('0x8')](),'define':{'charset':_0xe9bd('0x9'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe9bd('0x0')][_0xe9bd('0xc')],config[_0xe9bd('0x0')][_0xe9bd('0xd')],config['sequelize'][_0xe9bd('0xe')],config['sequelize'][_0xe9bd('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe9bd('0xb')][_0xe9bd('0xc')],config['sequelizeHistory']['username'],config[_0xe9bd('0xb')][_0xe9bd('0xe')],config[_0xe9bd('0xb')][_0xe9bd('0xf')])};db[_0xe9bd('0x10')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')]('../api/user/user.model');db[_0xe9bd('0x12')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0xe9bd('0x13')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x14'));db['VoiceExtension']=db[_0xe9bd('0x0')]['import'](_0xe9bd('0x15'));db['VoiceMusicOnHold']=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x16'));db[_0xe9bd('0x17')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x18'));db['VoiceRecording']=db[_0xe9bd('0x0')][_0xe9bd('0x11')]('../api/voiceRecording/voiceRecording.model');db[_0xe9bd('0x19')]=db['sequelize'][_0xe9bd('0x11')](_0xe9bd('0x1a'));db[_0xe9bd('0x1b')]=db[_0xe9bd('0x0')]['import'](_0xe9bd('0x1c'));db[_0xe9bd('0x1d')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x1e'));db[_0xe9bd('0x1f')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x20'));db['VoiceDialReport']=db[_0xe9bd('0x0')][_0xe9bd('0x11')]('../api/voiceDialReport/voiceDialReport.model');db[_0xe9bd('0x21')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x22'));db[_0xe9bd('0x23')]=db[_0xe9bd('0x0')]['import']('../api/voiceQueueReport/voiceQueueReport.model');db[_0xe9bd('0x24')]=db['sequelize'][_0xe9bd('0x11')](_0xe9bd('0x25'));db[_0xe9bd('0x26')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')]('../api/trunk/trunk.model');db['VoiceTransferReport']=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x27'));db[_0xe9bd('0x28')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x29'));db[_0xe9bd('0x2a')]=db[_0xe9bd('0x0')]['import'](_0xe9bd('0x2b'));db[_0xe9bd('0x2c')]=db[_0xe9bd('0x0')]['import']('../api/userChatQueue/userChatQueue.model');db[_0xe9bd('0x2d')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x2e'));db[_0xe9bd('0x2f')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x30'));db[_0xe9bd('0x31')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x32'));db[_0xe9bd('0x33')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x34'));db[_0xe9bd('0x35')]=db[_0xe9bd('0x0')]['import'](_0xe9bd('0x36'));db[_0xe9bd('0x37')]=db['sequelize'][_0xe9bd('0x11')](_0xe9bd('0x38'));db['MailServerOut']=db['sequelize'][_0xe9bd('0x11')](_0xe9bd('0x39'));db['MailAccount']=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x3a'));db['MailQueue']=db[_0xe9bd('0x0')]['import'](_0xe9bd('0x3b'));db[_0xe9bd('0x3c')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')]('../api/mailSubstatus/mailSubstatus.model');db[_0xe9bd('0x3d')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x3e'));db[_0xe9bd('0x3f')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x40'));db[_0xe9bd('0x41')]=db[_0xe9bd('0x0')]['import']('../api/mailApplication/mailApplication.model');db[_0xe9bd('0x42')]=db['sequelize'][_0xe9bd('0x11')](_0xe9bd('0x43'));db[_0xe9bd('0x44')]=db['sequelize'][_0xe9bd('0x11')](_0xe9bd('0x45'));db[_0xe9bd('0x46')]=db['sequelize'][_0xe9bd('0x11')](_0xe9bd('0x47'));db[_0xe9bd('0x48')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x49'));db[_0xe9bd('0x4a')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x4b'));db[_0xe9bd('0x4c')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x4d'));db[_0xe9bd('0x4e')]=db['sequelize']['import'](_0xe9bd('0x4f'));db[_0xe9bd('0x50')]=db[_0xe9bd('0x0')]['import']('../api/faxQueue/faxQueue.model');db[_0xe9bd('0x51')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x52'));db[_0xe9bd('0x53')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')]('../api/smsAccount/smsAccount.model');db[_0xe9bd('0x54')]=db['sequelize'][_0xe9bd('0x11')](_0xe9bd('0x55'));db[_0xe9bd('0x56')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')]('../api/smsInteraction/smsInteraction.model');db[_0xe9bd('0x57')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')]('../api/smsMessage/smsMessage.model');db[_0xe9bd('0x58')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')]('../api/smsQueue/smsQueue.model');db[_0xe9bd('0x59')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x5a'));db[_0xe9bd('0x5b')]=db['sequelize'][_0xe9bd('0x11')]('../api/openchannelApplication/openchannelApplication.model');db[_0xe9bd('0x5c')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x5d'));db[_0xe9bd('0x5e')]=db['sequelize'][_0xe9bd('0x11')]('../api/openchannelMessage/openchannelMessage.model');db[_0xe9bd('0x5f')]=db[_0xe9bd('0x0')]['import']('../api/openchannelQueue/openchannelQueue.model');db[_0xe9bd('0x60')]=db['sequelize'][_0xe9bd('0x11')]('../api/chatWebsite/chatWebsite.model');db[_0xe9bd('0x61')]=db[_0xe9bd('0x0')]['import'](_0xe9bd('0x62'));db['ChatApplication']=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x63'));db['ChatInteraction']=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x64'));db[_0xe9bd('0x65')]=db['sequelize']['import'](_0xe9bd('0x66'));db['ChatOfflineMessage']=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x67'));db[_0xe9bd('0x68')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x69'));db[_0xe9bd('0x6a')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x6b'));db[_0xe9bd('0x6c')]=db['sequelize']['import']('../api/chatProactiveAction/chatProactiveAction.model');db[_0xe9bd('0x6d')]=db['sequelize'][_0xe9bd('0x11')](_0xe9bd('0x6e'));db[_0xe9bd('0x6f')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x70'));db[_0xe9bd('0x71')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')]('../api/cmHopper/cmHopper.model');db[_0xe9bd('0x72')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x73'));db['CmHopperFinal']=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x74'));db['CmHopperHistory']=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x75'));db[_0xe9bd('0x76')]=db['sequelize']['import'](_0xe9bd('0x77'));db[_0xe9bd('0x78')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')]('../api/cmCustomField/cmCustomField.model');db['Action']=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x79'));db[_0xe9bd('0x7a')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')]('../api/automation/automation.model');db[_0xe9bd('0x7b')]=db['sequelize'][_0xe9bd('0x11')](_0xe9bd('0x7c'));db[_0xe9bd('0x7d')]=db[_0xe9bd('0x0')]['import'](_0xe9bd('0x7e'));db[_0xe9bd('0x7f')]=db[_0xe9bd('0x0')]['import'](_0xe9bd('0x80'));db[_0xe9bd('0x81')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x82'));db[_0xe9bd('0x83')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x84'));db[_0xe9bd('0x85')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')]('../api/cdr/cdr.model');db[_0xe9bd('0x86')]=db[_0xe9bd('0x0')]['import'](_0xe9bd('0x87'));db[_0xe9bd('0x88')]=db['sequelize']['import'](_0xe9bd('0x89'));db[_0xe9bd('0x8a')]=db['sequelize']['import']('../api/sound/sound.model');db[_0xe9bd('0x8b')]=db['sequelize']['import']('../api/tag/tag.model');db['Template']=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x8c'));db['Trigger']=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x8d'));db[_0xe9bd('0x8e')]=db['sequelize'][_0xe9bd('0x11')](_0xe9bd('0x8f'));db[_0xe9bd('0x90')]=db['sequelize']['import'](_0xe9bd('0x91'));db[_0xe9bd('0x92')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x93'));db[_0xe9bd('0x94')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0xe9bd('0x95')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x96'));db[_0xe9bd('0x97')]=db['sequelize'][_0xe9bd('0x11')]('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db[_0xe9bd('0x0')][_0xe9bd('0x11')]('../api/analyticMetric/analyticMetric.model');db[_0xe9bd('0x98')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x99'));db['AnalyticTreeReport']=db[_0xe9bd('0x0')][_0xe9bd('0x11')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xe9bd('0x9a')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x9b'));db[_0xe9bd('0x9c')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xe9bd('0x9d')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x9e'));db[_0xe9bd('0x9f')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0xa0'));db[_0xe9bd('0xa1')]=db['sequelize'][_0xe9bd('0x11')](_0xe9bd('0xa2'));db[_0xe9bd('0xa3')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0xa4'));db[_0xe9bd('0xa5')]=db['sequelize'][_0xe9bd('0x11')](_0xe9bd('0xa6'));db['DeskConfiguration']=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0xa7'));db[_0xe9bd('0xa8')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0xa9'));db['ZohoAccount']=db['sequelize'][_0xe9bd('0x11')](_0xe9bd('0xaa'));db[_0xe9bd('0xab')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0xac'));db[_0xe9bd('0xad')]=db['sequelize'][_0xe9bd('0x11')](_0xe9bd('0xae'));db[_0xe9bd('0xaf')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0xb0'));db[_0xe9bd('0xb1')]=db['sequelize']['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xe9bd('0xb2')]=db['sequelize']['import']('../api/intZendeskField/intZendeskField.model');db[_0xe9bd('0xb3')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0xb4'));db[_0xe9bd('0xb5')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0xb6'));db[_0xe9bd('0xb7')]=db['sequelize'][_0xe9bd('0x11')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0xe9bd('0xb8')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0xb9'));db[_0xe9bd('0xba')]=db['sequelize']['import']('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0xe9bd('0xbb')]=db[_0xe9bd('0x0')]['import'](_0xe9bd('0xbc'));db[_0xe9bd('0xbd')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0xbe'));db['ServicenowConfiguration']=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0xbf'));db[_0xe9bd('0xc0')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0xc1'));db[_0xe9bd('0xc2')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')]('../api/intDynamics365Account/intDynamics365Account.model');db['Dynamics365Configuration']=db['sequelize']['import'](_0xe9bd('0xc3'));db[_0xe9bd('0xc4')]=db[_0xe9bd('0x0')]['import'](_0xe9bd('0xc5'));db[_0xe9bd('0xc6')]=db['sequelize']['import'](_0xe9bd('0xc7'));db[_0xe9bd('0xc8')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0xc9'));db['FreshsalesField']=db['sequelize']['import'](_0xe9bd('0xca'));db[_0xe9bd('0x90')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x91'));db[_0xe9bd('0xcb')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0xcc'));db[_0xe9bd('0xcd')]=db['sequelize'][_0xe9bd('0x11')]('../api/chatQueueReport/chatQueueReport.model');db[_0xe9bd('0xce')]=db['sequelize']['import'](_0xe9bd('0xcf'));db['JscriptyAnswerReport']=db[_0xe9bd('0x0')]['import'](_0xe9bd('0xd0'));db[_0xe9bd('0xd1')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0xd2'));db[_0xe9bd('0xd3')]=db['sequelize'][_0xe9bd('0x11')](_0xe9bd('0xd4'));db['SmsQueueReport']=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0xd5'));db['SquareReport']=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0xd6'));db[_0xe9bd('0xd7')]=db[_0xe9bd('0x0')]['import'](_0xe9bd('0xd8'));db[_0xe9bd('0xd9')]=db['sequelize'][_0xe9bd('0x11')](_0xe9bd('0xda'));db[_0xe9bd('0xdb')]=db[_0xe9bd('0x0')]['import'](_0xe9bd('0xdc'));db[_0xe9bd('0xdd')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0xde'));db[_0xe9bd('0xdf')]=db[_0xe9bd('0x0')]['import'](_0xe9bd('0xe0'));db['SquareRecording']=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0xe1'));db['SquareMessage']=db[_0xe9bd('0x0')]['import'](_0xe9bd('0xe2'));db[_0xe9bd('0xe3')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0xe4'));db[_0xe9bd('0xe5')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0xe6'));db[_0xe9bd('0xe7')]=db[_0xe9bd('0x0')]['import'](_0xe9bd('0xe8'));db[_0xe9bd('0xe9')]=db[_0xe9bd('0x0')]['import'](_0xe9bd('0xea'));db[_0xe9bd('0xeb')]=db['sequelize']['import']('../api/attachment/attachment.model');db['Plugin']=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0xec'));db['MailTransferReport']=db[_0xe9bd('0x0')][_0xe9bd('0x11')]('../api/mailTransferReport/mailTransferReport.model');db[_0xe9bd('0xed')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0xee'));db[_0xe9bd('0xef')]=db['sequelize'][_0xe9bd('0x11')](_0xe9bd('0xf0'));db['OpenchannelTransferReport']=db['sequelize']['import']('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0xe9bd('0xf1')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0xf2'));db['CmList']=db['sequelize'][_0xe9bd('0x11')](_0xe9bd('0xf3'));db[_0xe9bd('0xf4')]=db['sequelize'][_0xe9bd('0x11')](_0xe9bd('0xf5'));db['UserProfile']=db['sequelize'][_0xe9bd('0x11')](_0xe9bd('0xf6'));db[_0xe9bd('0xf7')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0xf8'));db[_0xe9bd('0xf9')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')]('../api/userProfileResource/userProfileResource.model');db[_0xe9bd('0xfa')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0xfb'));db[_0xe9bd('0xfc')]=db[_0xe9bd('0x0')]['import'](_0xe9bd('0xfd'));db['WhatsappApplication']=db[_0xe9bd('0x0')]['import'](_0xe9bd('0xfe'));db[_0xe9bd('0xff')]=db['sequelize'][_0xe9bd('0x11')](_0xe9bd('0x100'));db['WhatsappMessage']=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x101'));db[_0xe9bd('0x102')]=db['sequelize'][_0xe9bd('0x11')](_0xe9bd('0x103'));db['WhatsappTransferReport']=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x104'));db['WhatsappQueue']=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x105'));db[_0xe9bd('0x106')]=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x107'));db['TeamVoiceQueue']=db[_0xe9bd('0x0')][_0xe9bd('0x11')](_0xe9bd('0x108'));db['TeamVoicePrefix']=db[_0xe9bd('0x0')]['import']('../api/teamVoicePrefix/teamVoicePrefix.model');db['UserVoicePrefix']=db[_0xe9bd('0x0')]['import']('../api/userVoicePrefix/userVoicePrefix.model');db[_0xe9bd('0x10')][_0xe9bd('0x109')](db['VoiceMail'],{'as':_0xe9bd('0x1b'),'onDelete':_0xe9bd('0x10a'),'foreignKey':'UserId'});db['User'][_0xe9bd('0x10b')](db['VoiceRecording'],{'as':'Recordings','foreignKey':_0xe9bd('0x10c')});db[_0xe9bd('0x10')][_0xe9bd('0x10b')](db[_0xe9bd('0x28')],{'as':_0xe9bd('0x10d'),'foreignKey':_0xe9bd('0x10c')});db[_0xe9bd('0x10')]['hasMany'](db[_0xe9bd('0x10e')],{'as':'Extensions','onDelete':'cascade','hooks':!![]});db[_0xe9bd('0x10')][_0xe9bd('0x10b')](db[_0xe9bd('0x10f')],{'as':_0xe9bd('0x110'),'foreignKey':_0xe9bd('0x10c')});db['User'][_0xe9bd('0x10b')](db[_0xe9bd('0x111')],{'as':_0xe9bd('0x112'),'foreignKey':_0xe9bd('0x10c')});db[_0xe9bd('0x10')][_0xe9bd('0x10b')](db['ReportAgentPreview'],{'as':_0xe9bd('0x76'),'foreignKey':_0xe9bd('0x10c')});db[_0xe9bd('0x10')][_0xe9bd('0x10b')](db[_0xe9bd('0x5c')],{'as':_0xe9bd('0x113'),'foreignKey':'UserId'});db[_0xe9bd('0x10')][_0xe9bd('0x10b')](db['ChatInteraction'],{'as':_0xe9bd('0x114'),'foreignKey':_0xe9bd('0x10c')});db[_0xe9bd('0x10')][_0xe9bd('0x10b')](db['SmsInteraction'],{'as':_0xe9bd('0x115'),'foreignKey':_0xe9bd('0x10c')});db[_0xe9bd('0x10')][_0xe9bd('0x10b')](db[_0xe9bd('0x4c')],{'as':_0xe9bd('0x116'),'foreignKey':_0xe9bd('0x10c')});db[_0xe9bd('0x10')][_0xe9bd('0x10b')](db['MailInteraction'],{'as':_0xe9bd('0x117'),'foreignKey':_0xe9bd('0x10c')});db[_0xe9bd('0x10')][_0xe9bd('0x10b')](db[_0xe9bd('0xff')],{'as':_0xe9bd('0x118'),'foreignKey':_0xe9bd('0x10c')});db['User'][_0xe9bd('0x10b')](db['UserNotification'],{'as':_0xe9bd('0x119'),'foreignKey':_0xe9bd('0x11a')});db[_0xe9bd('0x10')][_0xe9bd('0x11b')](db[_0xe9bd('0x11c')],{'as':_0xe9bd('0x11c'),'foreignKey':'userProfileId'});db[_0xe9bd('0x10')][_0xe9bd('0x11d')](db[_0xe9bd('0x6a')],{'as':'Groups','through':_0xe9bd('0x11e')});db[_0xe9bd('0x10')][_0xe9bd('0x11d')](db[_0xe9bd('0x6f')],{'as':_0xe9bd('0x11f'),'through':_0xe9bd('0x120')});db[_0xe9bd('0x10')][_0xe9bd('0x11d')](db[_0xe9bd('0x121')],{'as':_0xe9bd('0x122'),'through':'cm_user_has_lists'});db[_0xe9bd('0x10')][_0xe9bd('0x11d')](db[_0xe9bd('0xe3')],{'through':'user_has_teams'});db[_0xe9bd('0x10')][_0xe9bd('0x11d')](db[_0xe9bd('0x3d')],{'as':'MailInteractions','through':'user_has_mail_interactions'});db[_0xe9bd('0x10')][_0xe9bd('0x11d')](db[_0xe9bd('0x123')],{'as':_0xe9bd('0x114'),'through':_0xe9bd('0x124')});db[_0xe9bd('0x10')][_0xe9bd('0x11d')](db['FaxInteraction'],{'as':_0xe9bd('0x116'),'through':_0xe9bd('0x125')});db['User'][_0xe9bd('0x11d')](db[_0xe9bd('0x56')],{'as':_0xe9bd('0x115'),'through':_0xe9bd('0x126')});db[_0xe9bd('0x10')][_0xe9bd('0x11d')](db[_0xe9bd('0x5c')],{'as':_0xe9bd('0x113'),'through':_0xe9bd('0x127')});db[_0xe9bd('0x10')][_0xe9bd('0x11d')](db[_0xe9bd('0xff')],{'as':_0xe9bd('0x118'),'through':_0xe9bd('0x128')});db[_0xe9bd('0x10')]['belongsToMany'](db[_0xe9bd('0x17')],{'as':_0xe9bd('0x129'),'through':_0xe9bd('0x2a'),'required':![]});db[_0xe9bd('0x10')][_0xe9bd('0x11d')](db['VoicePrefix'],{'as':_0xe9bd('0x12a'),'through':_0xe9bd('0x12b'),'required':![]});db[_0xe9bd('0x10')][_0xe9bd('0x11d')](db[_0xe9bd('0x12c')],{'as':_0xe9bd('0x12d'),'through':_0xe9bd('0x2d'),'required':![]});db[_0xe9bd('0x10')][_0xe9bd('0x11d')](db[_0xe9bd('0x68')],{'as':_0xe9bd('0x12e'),'through':_0xe9bd('0x2c'),'required':![],'hooks':!![]});db[_0xe9bd('0x10')]['belongsToMany'](db[_0xe9bd('0x50')],{'as':_0xe9bd('0x12f'),'through':_0xe9bd('0x2f'),'required':![]});db[_0xe9bd('0x10')][_0xe9bd('0x11d')](db[_0xe9bd('0x58')],{'as':_0xe9bd('0x130'),'through':_0xe9bd('0x31'),'required':![]});db[_0xe9bd('0x10')][_0xe9bd('0x11d')](db[_0xe9bd('0x5f')],{'as':_0xe9bd('0x131'),'through':'UserOpenchannelQueue','required':![]});db[_0xe9bd('0x10')][_0xe9bd('0x11d')](db[_0xe9bd('0x132')],{'as':_0xe9bd('0x133'),'through':_0xe9bd('0x35'),'required':![]});db['User'][_0xe9bd('0x11d')](db[_0xe9bd('0x121')],{'through':_0xe9bd('0x134')});db['User'][_0xe9bd('0x11d')](db[_0xe9bd('0x60')],{'as':'ChatWebsites','through':'user_has_chat_websites'});db['User'][_0xe9bd('0x11d')](db[_0xe9bd('0x48')],{'as':'FaxAccounts','through':_0xe9bd('0x135')});db[_0xe9bd('0x10')][_0xe9bd('0x11d')](db['MailAccount'],{'as':_0xe9bd('0x136'),'through':_0xe9bd('0x137')});db[_0xe9bd('0x10')][_0xe9bd('0x11d')](db['OpenchannelAccount'],{'as':_0xe9bd('0x138'),'through':_0xe9bd('0x139')});db['User'][_0xe9bd('0x11d')](db[_0xe9bd('0x53')],{'as':_0xe9bd('0x13a'),'through':_0xe9bd('0x13b')});db['User']['belongsToMany'](db['WhatsappAccount'],{'as':_0xe9bd('0x13c'),'through':'user_has_whatsapp_accounts'});db[_0xe9bd('0x10')][_0xe9bd('0x11d')](db[_0xe9bd('0xdf')],{'as':_0xe9bd('0x13d'),'through':_0xe9bd('0x13e')});db[_0xe9bd('0x12')]['hasMany'](db[_0xe9bd('0x10e')],{'as':_0xe9bd('0x13f'),'onDelete':_0xe9bd('0x10a'),'foreignKey':_0xe9bd('0x140')});db[_0xe9bd('0x13')][_0xe9bd('0x10b')](db[_0xe9bd('0x10e')],{'onDelete':'cascade'});db[_0xe9bd('0x10e')][_0xe9bd('0x10b')](db[_0xe9bd('0x10e')],{'as':_0xe9bd('0x141'),'onDelete':'cascade'});db[_0xe9bd('0x142')][_0xe9bd('0x11d')](db[_0xe9bd('0x8a')],{'as':_0xe9bd('0x143'),'through':_0xe9bd('0x144')});db[_0xe9bd('0x17')][_0xe9bd('0x10b')](db[_0xe9bd('0x28')],{'as':_0xe9bd('0x145'),'foreignKey':_0xe9bd('0x146')});db[_0xe9bd('0x17')][_0xe9bd('0x10b')](db[_0xe9bd('0x71')],{'as':'Hoppers','foreignKey':_0xe9bd('0x146')});db[_0xe9bd('0x17')]['hasMany'](db[_0xe9bd('0x10f')],{'as':_0xe9bd('0x110'),'foreignKey':_0xe9bd('0x146')});db['VoiceQueue'][_0xe9bd('0x10b')](db[_0xe9bd('0x111')],{'as':_0xe9bd('0x147'),'foreignKey':_0xe9bd('0x146')});db['VoiceQueue'][_0xe9bd('0x10b')](db[_0xe9bd('0x76')],{'as':_0xe9bd('0x76'),'foreignKey':_0xe9bd('0x146')});db[_0xe9bd('0x17')][_0xe9bd('0x10b')](db['CmHopperBlack'],{'as':_0xe9bd('0x148'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xe9bd('0x10b')](db['JscriptySessionReport'],{'as':_0xe9bd('0x149'),'foreignKey':'VoiceQueueId'});db[_0xe9bd('0x17')][_0xe9bd('0x11b')](db['Trunk'],{'as':_0xe9bd('0x26'),'foreignKey':_0xe9bd('0x14a')});db[_0xe9bd('0x17')][_0xe9bd('0x11b')](db[_0xe9bd('0x26')],{'as':_0xe9bd('0x14b'),'foreignKey':_0xe9bd('0x14c')});db['VoiceQueue'][_0xe9bd('0x11b')](db[_0xe9bd('0x81')],{'as':_0xe9bd('0x81'),'foreignKey':_0xe9bd('0x14d')});db[_0xe9bd('0x17')][_0xe9bd('0x11b')](db['Pause'],{'as':_0xe9bd('0x14e'),'foreignKey':_0xe9bd('0x14f')});db[_0xe9bd('0x17')][_0xe9bd('0x11d')](db[_0xe9bd('0x121')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db['VoiceQueue'][_0xe9bd('0x11d')](db['User'],{'as':_0xe9bd('0x150'),'through':_0xe9bd('0x2a')});db['VoiceQueue'][_0xe9bd('0x11d')](db[_0xe9bd('0xe3')],{'as':_0xe9bd('0x151'),'through':_0xe9bd('0x152')});db[_0xe9bd('0x17')][_0xe9bd('0x11d')](db[_0xe9bd('0x121')],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db[_0xe9bd('0x153')]['belongsTo'](db['User'],{'as':_0xe9bd('0x10'),'foreignKey':_0xe9bd('0x10c')});db[_0xe9bd('0x19')][_0xe9bd('0x11b')](db[_0xe9bd('0x10')],{'as':_0xe9bd('0x10'),'foreignKey':_0xe9bd('0x10c')});db[_0xe9bd('0x1b')][_0xe9bd('0x10b')](db[_0xe9bd('0x1d')],{'as':_0xe9bd('0x154'),'onDelete':'cascade','foreignKey':_0xe9bd('0x155'),'sourceKey':'mailbox'});db[_0xe9bd('0x1d')][_0xe9bd('0x11b')](db[_0xe9bd('0x1b')],{'foreignKey':_0xe9bd('0x155'),'targetKey':'mailbox'});db[_0xe9bd('0x1f')][_0xe9bd('0x10b')](db[_0xe9bd('0x23')],{'as':'QueueCalls','foreignKey':'uniqueid','constraints':![]});db[_0xe9bd('0x1f')][_0xe9bd('0x10b')](db[_0xe9bd('0x21')],{'as':_0xe9bd('0x156'),'foreignKey':_0xe9bd('0x157'),'constraints':![]});db[_0xe9bd('0x1f')]['belongsTo'](db[_0xe9bd('0x10')],{'as':_0xe9bd('0x10'),'foreignKey':_0xe9bd('0x10c')});db[_0xe9bd('0x1f')]['belongsTo'](db[_0xe9bd('0x6f')],{'as':_0xe9bd('0x158'),'foreignKey':_0xe9bd('0x159')});db['MailServerIn'][_0xe9bd('0x11b')](db[_0xe9bd('0x15a')],{'as':_0xe9bd('0x15a'),'foreignKey':_0xe9bd('0x15b')});db[_0xe9bd('0x15c')][_0xe9bd('0x11b')](db[_0xe9bd('0x15a')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0xe9bd('0x15a')][_0xe9bd('0x109')](db[_0xe9bd('0x37')],{'as':'Imap','onDelete':'cascade'});db[_0xe9bd('0x15a')][_0xe9bd('0x109')](db[_0xe9bd('0x15c')],{'as':'Smtp','onDelete':_0xe9bd('0x10a')});db['MailAccount'][_0xe9bd('0x10b')](db[_0xe9bd('0x7d')],{'as':_0xe9bd('0x15d'),'foreignKey':_0xe9bd('0x15b'),'onDelete':_0xe9bd('0x10a')});db[_0xe9bd('0x15a')][_0xe9bd('0x10b')](db[_0xe9bd('0x7b')],{'as':_0xe9bd('0x15e'),'foreignKey':'MailAccountId'});db['MailAccount'][_0xe9bd('0x10b')](db[_0xe9bd('0x3f')],{'as':_0xe9bd('0x154'),'foreignKey':_0xe9bd('0x15b')});db[_0xe9bd('0x15a')][_0xe9bd('0x10b')](db[_0xe9bd('0x3d')],{'as':_0xe9bd('0x15f')});db['MailAccount'][_0xe9bd('0x10b')](db[_0xe9bd('0x41')],{'as':'Applications'});db[_0xe9bd('0x15a')]['belongsTo'](db[_0xe9bd('0x121')],{'as':_0xe9bd('0x160'),'foreignKey':_0xe9bd('0x161')});db['MailAccount'][_0xe9bd('0x11b')](db[_0xe9bd('0x162')],{'as':'Template','foreignKey':_0xe9bd('0x163')});db[_0xe9bd('0x15a')][_0xe9bd('0x11b')](db[_0xe9bd('0x83')],{'as':_0xe9bd('0x14e'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xe9bd('0x15a')][_0xe9bd('0x11d')](db[_0xe9bd('0x10')],{'as':_0xe9bd('0x150'),'through':_0xe9bd('0x137')});db[_0xe9bd('0x12c')]['belongsToMany'](db[_0xe9bd('0x10')],{'as':'Agents','through':_0xe9bd('0x2d')});db['MailQueue'][_0xe9bd('0x11d')](db[_0xe9bd('0xe3')],{'through':'team_has_mail_queues','as':_0xe9bd('0x151')});db[_0xe9bd('0x3d')]['hasMany'](db[_0xe9bd('0x3f')],{'as':'Messages','onDelete':'cascade','foreignKey':'MailInteractionId'});db[_0xe9bd('0x3d')][_0xe9bd('0x11b')](db['MailAccount'],{'as':'Account','foreignKey':_0xe9bd('0x15b')});db['MailInteraction'][_0xe9bd('0x11b')](db[_0xe9bd('0x6f')],{'as':'Contact','foreignKey':_0xe9bd('0x159')});db[_0xe9bd('0x3d')][_0xe9bd('0x11b')](db[_0xe9bd('0x10')],{'as':_0xe9bd('0x164'),'foreignKey':_0xe9bd('0x10c')});db[_0xe9bd('0x3d')][_0xe9bd('0x11d')](db[_0xe9bd('0x8b')],{'through':_0xe9bd('0x165'),'as':_0xe9bd('0x166')});db[_0xe9bd('0x3d')][_0xe9bd('0x11d')](db['Tag'],{'through':_0xe9bd('0x165'),'as':_0xe9bd('0x167')});db[_0xe9bd('0x3d')][_0xe9bd('0x11d')](db[_0xe9bd('0x10')],{'as':'Users','through':_0xe9bd('0x168'),'foreignKey':_0xe9bd('0x169')});db[_0xe9bd('0x3f')][_0xe9bd('0x10b')](db[_0xe9bd('0xeb')],{'as':_0xe9bd('0x16a'),'onDelete':_0xe9bd('0x10a')});db['MailMessage'][_0xe9bd('0x11b')](db[_0xe9bd('0x10')],{'as':'User'});db[_0xe9bd('0x3f')][_0xe9bd('0x11b')](db[_0xe9bd('0x6f')],{'onDelete':_0xe9bd('0x10a'),'as':_0xe9bd('0x158')});db[_0xe9bd('0x3f')][_0xe9bd('0x11b')](db[_0xe9bd('0x3d')],{'as':'Interaction','foreignKey':_0xe9bd('0x169')});db[_0xe9bd('0x3f')][_0xe9bd('0x11b')](db['MailAccount'],{'as':_0xe9bd('0x16b'),'foreignKey':_0xe9bd('0x15b')});db['MailMessage']['belongsTo'](db[_0xe9bd('0x60')],{'as':'ChatWebsite','foreignKey':_0xe9bd('0x16c')});db[_0xe9bd('0x3f')][_0xe9bd('0x11b')](db[_0xe9bd('0x16d')],{'as':_0xe9bd('0x16d'),'foreignKey':_0xe9bd('0x16e')});db[_0xe9bd('0x41')][_0xe9bd('0x11b')](db['User'],{'onDelete':_0xe9bd('0x16f')});db[_0xe9bd('0x41')][_0xe9bd('0x11b')](db[_0xe9bd('0x12c')],{'onDelete':_0xe9bd('0x16f')});db[_0xe9bd('0x41')]['belongsTo'](db[_0xe9bd('0x15a')],{'onDelete':_0xe9bd('0x16f')});db[_0xe9bd('0x41')][_0xe9bd('0x11b')](db[_0xe9bd('0x81')],{'onDelete':_0xe9bd('0x16f'),'foreignKey':_0xe9bd('0x14d')});db[_0xe9bd('0x41')]['belongsTo'](db['Tag'],{'onDelete':_0xe9bd('0x16f'),'foreignKey':_0xe9bd('0x170')});db[_0xe9bd('0x42')][_0xe9bd('0x11b')](db[_0xe9bd('0x15a')],{});db[_0xe9bd('0x42')][_0xe9bd('0x11b')](db[_0xe9bd('0x121')],{'as':_0xe9bd('0x160'),'foreignKey':_0xe9bd('0x161')});db['MailQueueReport'][_0xe9bd('0x11b')](db[_0xe9bd('0x6f')],{'as':_0xe9bd('0x158'),'foreignKey':_0xe9bd('0x159')});db[_0xe9bd('0x42')][_0xe9bd('0x11b')](db[_0xe9bd('0x3d')],{});db['MailQueueReport'][_0xe9bd('0x11b')](db[_0xe9bd('0x3f')],{});db[_0xe9bd('0x42')][_0xe9bd('0x11b')](db[_0xe9bd('0x10')],{});db['MailQueueReport'][_0xe9bd('0x11b')](db[_0xe9bd('0x12c')],{});db[_0xe9bd('0x44')][_0xe9bd('0x10b')](db[_0xe9bd('0x46')],{'as':'Items','onDelete':_0xe9bd('0x10a')});db['FaxAccount'][_0xe9bd('0x10b')](db[_0xe9bd('0x7d')],{'as':_0xe9bd('0x15d'),'foreignKey':'FaxAccountId','onDelete':'cascade'});db[_0xe9bd('0x48')][_0xe9bd('0x10b')](db[_0xe9bd('0x7b')],{'as':'Answers','foreignKey':_0xe9bd('0x171')});db[_0xe9bd('0x48')][_0xe9bd('0x10b')](db[_0xe9bd('0x4c')],{'as':_0xe9bd('0x15f')});db[_0xe9bd('0x48')][_0xe9bd('0x10b')](db[_0xe9bd('0x4a')],{'as':_0xe9bd('0x141')});db[_0xe9bd('0x48')][_0xe9bd('0x10b')](db[_0xe9bd('0x10e')],{'as':_0xe9bd('0x172'),'onDelete':_0xe9bd('0x10a')});db['FaxAccount'][_0xe9bd('0x10b')](db[_0xe9bd('0x4e')],{'as':'Messages'});db[_0xe9bd('0x48')][_0xe9bd('0x11b')](db[_0xe9bd('0x26')],{'as':_0xe9bd('0x26')});db['FaxAccount'][_0xe9bd('0x11b')](db[_0xe9bd('0x121')],{'as':_0xe9bd('0x160'),'foreignKey':_0xe9bd('0x161')});db[_0xe9bd('0x48')]['belongsTo'](db[_0xe9bd('0x83')],{'as':'mandatoryDispositionPause','foreignKey':_0xe9bd('0x14f')});db[_0xe9bd('0x48')][_0xe9bd('0x11d')](db[_0xe9bd('0x10')],{'as':_0xe9bd('0x150'),'through':'user_has_fax_accounts'});db[_0xe9bd('0x4a')][_0xe9bd('0x11b')](db[_0xe9bd('0x10')],{'onDelete':_0xe9bd('0x16f')});db[_0xe9bd('0x4a')][_0xe9bd('0x11b')](db[_0xe9bd('0x50')],{'onDelete':'restrict'});db[_0xe9bd('0x4a')][_0xe9bd('0x11b')](db[_0xe9bd('0x48')],{'onDelete':_0xe9bd('0x16f')});db[_0xe9bd('0x4a')]['belongsTo'](db[_0xe9bd('0x8b')],{'onDelete':_0xe9bd('0x16f'),'foreignKey':_0xe9bd('0x170')});db[_0xe9bd('0x4c')][_0xe9bd('0x10b')](db[_0xe9bd('0x4e')],{'as':_0xe9bd('0x154'),'onDelete':_0xe9bd('0x10a'),'foreignKey':_0xe9bd('0x173')});db[_0xe9bd('0x4c')][_0xe9bd('0x11b')](db[_0xe9bd('0x48')],{'as':_0xe9bd('0x16b'),'foreignKey':_0xe9bd('0x171')});db[_0xe9bd('0x4c')][_0xe9bd('0x11b')](db[_0xe9bd('0x6f')],{'as':_0xe9bd('0x158'),'foreignKey':_0xe9bd('0x159')});db[_0xe9bd('0x4c')]['belongsTo'](db[_0xe9bd('0x10')],{'as':_0xe9bd('0x164'),'foreignKey':_0xe9bd('0x10c')});db[_0xe9bd('0x4c')]['belongsToMany'](db[_0xe9bd('0x8b')],{'through':'fax_interaction_has_tags','as':'Tags'});db['FaxInteraction']['belongsToMany'](db[_0xe9bd('0x8b')],{'through':_0xe9bd('0x174'),'as':_0xe9bd('0x167')});db['FaxInteraction'][_0xe9bd('0x11d')](db['User'],{'as':_0xe9bd('0x175'),'through':_0xe9bd('0x125'),'foreignKey':'FaxInteractionId'});db[_0xe9bd('0x4e')]['belongsTo'](db['User'],{'onDelete':_0xe9bd('0x10a'),'as':_0xe9bd('0x10')});db[_0xe9bd('0x4e')]['belongsTo'](db[_0xe9bd('0x4c')],{'as':'Interaction','foreignKey':_0xe9bd('0x173')});db['FaxMessage'][_0xe9bd('0x11b')](db[_0xe9bd('0x6f')],{'onDelete':_0xe9bd('0x10a'),'as':'Contact'});db[_0xe9bd('0x4e')]['belongsTo'](db[_0xe9bd('0xeb')],{'as':_0xe9bd('0xeb'),'foreignKey':_0xe9bd('0x176')});db[_0xe9bd('0x4e')][_0xe9bd('0x11b')](db[_0xe9bd('0x48')],{'as':_0xe9bd('0x16b'),'foreignKey':_0xe9bd('0x171')});db[_0xe9bd('0x50')][_0xe9bd('0x11d')](db[_0xe9bd('0x10')],{'as':_0xe9bd('0x150'),'through':_0xe9bd('0x2f')});db[_0xe9bd('0x50')][_0xe9bd('0x11d')](db[_0xe9bd('0xe3')],{'through':_0xe9bd('0x177'),'as':_0xe9bd('0x151')});db[_0xe9bd('0x51')][_0xe9bd('0x11b')](db[_0xe9bd('0x48')],{});db['FaxQueueReport'][_0xe9bd('0x11b')](db[_0xe9bd('0x121')],{'as':'List','foreignKey':_0xe9bd('0x161')});db[_0xe9bd('0x51')][_0xe9bd('0x11b')](db[_0xe9bd('0x6f')],{'as':_0xe9bd('0x158'),'foreignKey':'ContactId'});db[_0xe9bd('0x51')][_0xe9bd('0x11b')](db[_0xe9bd('0x4c')],{});db[_0xe9bd('0x51')][_0xe9bd('0x11b')](db[_0xe9bd('0x4e')],{});db[_0xe9bd('0x51')][_0xe9bd('0x11b')](db[_0xe9bd('0x10')],{});db[_0xe9bd('0x51')]['belongsTo'](db[_0xe9bd('0x50')],{});db[_0xe9bd('0x53')][_0xe9bd('0x10b')](db[_0xe9bd('0x7d')],{'as':_0xe9bd('0x15d'),'foreignKey':_0xe9bd('0x178'),'onDelete':_0xe9bd('0x10a')});db[_0xe9bd('0x53')]['hasMany'](db[_0xe9bd('0x7b')],{'as':_0xe9bd('0x15e'),'foreignKey':_0xe9bd('0x178')});db[_0xe9bd('0x53')]['hasMany'](db[_0xe9bd('0x57')],{'as':_0xe9bd('0x154'),'foreignKey':_0xe9bd('0x178')});db[_0xe9bd('0x53')][_0xe9bd('0x10b')](db[_0xe9bd('0x56')],{'as':_0xe9bd('0x15f')});db[_0xe9bd('0x53')]['hasMany'](db[_0xe9bd('0x54')],{'as':'Applications'});db['SmsAccount']['belongsTo'](db[_0xe9bd('0x121')],{'as':'List','foreignKey':_0xe9bd('0x161')});db['SmsAccount']['belongsTo'](db[_0xe9bd('0x83')],{'as':'mandatoryDispositionPause','foreignKey':_0xe9bd('0x14f')});db[_0xe9bd('0x53')][_0xe9bd('0x11d')](db[_0xe9bd('0x10')],{'as':_0xe9bd('0x150'),'through':_0xe9bd('0x13b')});db['SmsApplication'][_0xe9bd('0x11b')](db[_0xe9bd('0x10')],{'onDelete':_0xe9bd('0x16f')});db['SmsApplication'][_0xe9bd('0x11b')](db[_0xe9bd('0x58')],{'onDelete':'restrict'});db[_0xe9bd('0x54')][_0xe9bd('0x11b')](db[_0xe9bd('0x53')],{'onDelete':_0xe9bd('0x16f')});db[_0xe9bd('0x54')]['belongsTo'](db['Interval'],{'onDelete':_0xe9bd('0x16f'),'foreignKey':'IntervalId'});db['SmsApplication']['belongsTo'](db[_0xe9bd('0x8b')],{'onDelete':_0xe9bd('0x16f'),'foreignKey':_0xe9bd('0x170')});db[_0xe9bd('0x56')][_0xe9bd('0x10b')](db[_0xe9bd('0x57')],{'as':_0xe9bd('0x154'),'onDelete':'cascade','foreignKey':_0xe9bd('0x179')});db[_0xe9bd('0x56')][_0xe9bd('0x11b')](db['SmsAccount'],{'as':_0xe9bd('0x16b'),'foreignKey':_0xe9bd('0x178')});db[_0xe9bd('0x56')]['belongsTo'](db[_0xe9bd('0x6f')],{'as':_0xe9bd('0x158'),'foreignKey':_0xe9bd('0x159')});db['SmsInteraction'][_0xe9bd('0x11b')](db[_0xe9bd('0x10')],{'as':_0xe9bd('0x164'),'foreignKey':_0xe9bd('0x10c')});db['SmsInteraction'][_0xe9bd('0x11d')](db[_0xe9bd('0x8b')],{'through':_0xe9bd('0x17a'),'as':_0xe9bd('0x166')});db['SmsInteraction'][_0xe9bd('0x11d')](db[_0xe9bd('0x8b')],{'through':_0xe9bd('0x17a'),'as':_0xe9bd('0x167')});db[_0xe9bd('0x56')]['belongsToMany'](db[_0xe9bd('0x10')],{'as':_0xe9bd('0x175'),'through':_0xe9bd('0x126'),'foreignKey':_0xe9bd('0x179')});db['SmsMessage'][_0xe9bd('0x11b')](db[_0xe9bd('0x10')],{'as':_0xe9bd('0x10')});db[_0xe9bd('0x57')]['belongsTo'](db[_0xe9bd('0x6f')],{'onDelete':_0xe9bd('0x10a'),'as':_0xe9bd('0x158')});db[_0xe9bd('0x57')]['belongsTo'](db[_0xe9bd('0x56')],{'onDelete':_0xe9bd('0x10a'),'as':_0xe9bd('0x17b'),'foreignKey':_0xe9bd('0x179')});db[_0xe9bd('0x57')][_0xe9bd('0x11b')](db[_0xe9bd('0x53')],{'as':_0xe9bd('0x16b'),'foreignKey':'SmsAccountId'});db[_0xe9bd('0x58')][_0xe9bd('0x11d')](db[_0xe9bd('0x10')],{'as':_0xe9bd('0x150'),'through':'UserSmsQueue','foreignKey':_0xe9bd('0x17c')});db[_0xe9bd('0x58')][_0xe9bd('0x11d')](db[_0xe9bd('0xe3')],{'through':'team_has_sms_queues','as':'Teams'});db[_0xe9bd('0x59')]['hasMany'](db['Disposition'],{'as':_0xe9bd('0x15d'),'foreignKey':'OpenchannelAccountId','onDelete':_0xe9bd('0x10a')});db[_0xe9bd('0x59')][_0xe9bd('0x10b')](db[_0xe9bd('0x7b')],{'as':_0xe9bd('0x15e'),'foreignKey':_0xe9bd('0x17d')});db[_0xe9bd('0x59')][_0xe9bd('0x10b')](db[_0xe9bd('0x5c')],{'as':_0xe9bd('0x15f'),'foreignKey':_0xe9bd('0x17d')});db[_0xe9bd('0x59')][_0xe9bd('0x10b')](db[_0xe9bd('0x5e')],{'as':_0xe9bd('0x154'),'foreignKey':_0xe9bd('0x17d')});db['OpenchannelAccount'][_0xe9bd('0x10b')](db[_0xe9bd('0x5b')],{'as':_0xe9bd('0x141'),'foreignKey':_0xe9bd('0x17d')});db[_0xe9bd('0x59')]['belongsTo'](db[_0xe9bd('0x121')],{'as':'List','foreignKey':'ListId'});db[_0xe9bd('0x59')][_0xe9bd('0x11b')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xe9bd('0x59')]['belongsToMany'](db['User'],{'as':_0xe9bd('0x150'),'through':'user_has_openchannel_accounts'});db[_0xe9bd('0x5b')][_0xe9bd('0x11b')](db[_0xe9bd('0x10')],{'onDelete':_0xe9bd('0x16f')});db['OpenchannelApplication'][_0xe9bd('0x11b')](db[_0xe9bd('0x5f')],{'onDelete':_0xe9bd('0x16f'),'foreignKey':_0xe9bd('0x17e')});db[_0xe9bd('0x5b')][_0xe9bd('0x11b')](db[_0xe9bd('0x59')],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication']['belongsTo'](db[_0xe9bd('0x81')],{'onDelete':_0xe9bd('0x16f'),'foreignKey':_0xe9bd('0x14d')});db[_0xe9bd('0x5b')][_0xe9bd('0x11b')](db[_0xe9bd('0x8b')],{'onDelete':_0xe9bd('0x16f'),'foreignKey':_0xe9bd('0x170')});db['OpenchannelInteraction'][_0xe9bd('0x10b')](db[_0xe9bd('0x5e')],{'as':_0xe9bd('0x154'),'onDelete':_0xe9bd('0x10a'),'foreignKey':_0xe9bd('0x17f')});db[_0xe9bd('0x5c')]['belongsTo'](db[_0xe9bd('0x59')],{'as':_0xe9bd('0x16b'),'foreignKey':_0xe9bd('0x17d')});db[_0xe9bd('0x5c')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xe9bd('0x159')});db['OpenchannelInteraction'][_0xe9bd('0x11b')](db[_0xe9bd('0x10')],{'as':_0xe9bd('0x164'),'foreignKey':_0xe9bd('0x10c')});db[_0xe9bd('0x5c')][_0xe9bd('0x11d')](db[_0xe9bd('0x8b')],{'through':_0xe9bd('0x180'),'as':'Tags'});db[_0xe9bd('0x5c')][_0xe9bd('0x11d')](db[_0xe9bd('0x8b')],{'through':_0xe9bd('0x180'),'as':_0xe9bd('0x167')});db[_0xe9bd('0x5c')][_0xe9bd('0x11d')](db['User'],{'as':_0xe9bd('0x175'),'through':_0xe9bd('0x127'),'foreignKey':_0xe9bd('0x17f')});db[_0xe9bd('0x5e')][_0xe9bd('0x11b')](db['User'],{'onDelete':_0xe9bd('0x10a'),'as':_0xe9bd('0x10')});db[_0xe9bd('0x5e')]['belongsTo'](db['CmContact'],{'onDelete':_0xe9bd('0x10a'),'as':_0xe9bd('0x158')});db[_0xe9bd('0x5e')][_0xe9bd('0x11b')](db[_0xe9bd('0x5c')],{'onDelete':'cascade','as':_0xe9bd('0x17b'),'foreignKey':_0xe9bd('0x17f')});db[_0xe9bd('0x5e')][_0xe9bd('0x11b')](db[_0xe9bd('0xeb')],{'as':_0xe9bd('0xeb'),'foreignKey':_0xe9bd('0x176')});db[_0xe9bd('0x5e')][_0xe9bd('0x11b')](db['OpenchannelAccount'],{'as':_0xe9bd('0x16b'),'foreignKey':_0xe9bd('0x17d')});db['OpenchannelQueue'][_0xe9bd('0x11d')](db[_0xe9bd('0x10')],{'as':_0xe9bd('0x150'),'through':_0xe9bd('0x33'),'foreignKey':'OpenchannelQueueId'});db[_0xe9bd('0x5f')]['belongsToMany'](db[_0xe9bd('0xe3')],{'through':_0xe9bd('0x181'),'as':'Teams'});db[_0xe9bd('0x60')][_0xe9bd('0x10b')](db[_0xe9bd('0x7d')],{'as':'Dispositions','foreignKey':_0xe9bd('0x16c'),'onDelete':_0xe9bd('0x10a')});db[_0xe9bd('0x60')][_0xe9bd('0x10b')](db['CannedAnswer'],{'as':_0xe9bd('0x15e'),'foreignKey':_0xe9bd('0x16c')});db[_0xe9bd('0x60')][_0xe9bd('0x10b')](db[_0xe9bd('0x6c')],{'as':_0xe9bd('0x182')});db[_0xe9bd('0x60')][_0xe9bd('0x10b')](db['ChatInteraction'],{'as':_0xe9bd('0x15f')});db[_0xe9bd('0x60')][_0xe9bd('0x10b')](db[_0xe9bd('0x183')],{'as':'Applications'});db[_0xe9bd('0x60')][_0xe9bd('0x10b')](db[_0xe9bd('0x65')],{'as':_0xe9bd('0x154')});db['ChatWebsite'][_0xe9bd('0x11b')](db[_0xe9bd('0x121')],{'as':_0xe9bd('0x160'),'foreignKey':_0xe9bd('0x161')});db[_0xe9bd('0x60')]['belongsTo'](db[_0xe9bd('0x81')],{'as':_0xe9bd('0x81'),'foreignKey':_0xe9bd('0x14d')});db[_0xe9bd('0x60')][_0xe9bd('0x11b')](db[_0xe9bd('0x15a')],{'as':'MailAccount','foreignKey':_0xe9bd('0x15b')});db[_0xe9bd('0x60')][_0xe9bd('0x11b')](db[_0xe9bd('0x83')],{'as':_0xe9bd('0x14e'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xe9bd('0x60')]['belongsToMany'](db[_0xe9bd('0x10')],{'as':'Agents','through':'user_has_chat_websites'});db['OpenchannelQueueReport'][_0xe9bd('0x11b')](db[_0xe9bd('0x59')],{});db[_0xe9bd('0x61')][_0xe9bd('0x11b')](db[_0xe9bd('0x121')],{'as':_0xe9bd('0x160'),'foreignKey':_0xe9bd('0x161')});db[_0xe9bd('0x61')][_0xe9bd('0x11b')](db[_0xe9bd('0x6f')],{'as':'Contact','foreignKey':_0xe9bd('0x159')});db[_0xe9bd('0x61')]['belongsTo'](db[_0xe9bd('0x5c')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0xe9bd('0x5e')],{});db[_0xe9bd('0x61')][_0xe9bd('0x11b')](db['User'],{});db['OpenchannelQueueReport'][_0xe9bd('0x11b')](db[_0xe9bd('0x5f')],{});db[_0xe9bd('0x183')]['belongsTo'](db[_0xe9bd('0x10')],{'as':_0xe9bd('0x184'),'foreignKey':_0xe9bd('0x10c'),'onDelete':'restrict'});db[_0xe9bd('0x183')][_0xe9bd('0x11b')](db[_0xe9bd('0x68')],{'as':_0xe9bd('0x185'),'foreignKey':'ChatQueueId','onDelete':_0xe9bd('0x16f')});db[_0xe9bd('0x183')][_0xe9bd('0x11b')](db[_0xe9bd('0x60')],{'as':'Website','foreignKey':_0xe9bd('0x16c'),'onDelete':_0xe9bd('0x16f')});db[_0xe9bd('0x183')]['belongsTo'](db[_0xe9bd('0x8b')],{'onDelete':_0xe9bd('0x16f'),'foreignKey':_0xe9bd('0x170')});db['ChatInteraction']['hasMany'](db['ChatMessage'],{'as':'Messages','onDelete':_0xe9bd('0x10a'),'foreignKey':_0xe9bd('0x186')});db[_0xe9bd('0x123')][_0xe9bd('0x11b')](db['ChatWebsite'],{'as':'Account','foreignKey':_0xe9bd('0x16c')});db[_0xe9bd('0x123')]['belongsTo'](db[_0xe9bd('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db['ChatInteraction']['belongsTo'](db[_0xe9bd('0x10')],{'as':_0xe9bd('0x164'),'foreignKey':_0xe9bd('0x10c')});db[_0xe9bd('0x123')][_0xe9bd('0x11d')](db[_0xe9bd('0x8b')],{'through':'chat_interaction_has_tags','as':'Tags'});db[_0xe9bd('0x123')][_0xe9bd('0x11d')](db[_0xe9bd('0x8b')],{'through':_0xe9bd('0x187'),'as':'ThroughTags'});db['ChatInteraction']['belongsToMany'](db[_0xe9bd('0x10')],{'as':'Users','through':_0xe9bd('0x124'),'foreignKey':_0xe9bd('0x186')});db['ChatMessage']['belongsTo'](db[_0xe9bd('0x10')],{'onDelete':'cascade','as':_0xe9bd('0x10')});db[_0xe9bd('0x65')][_0xe9bd('0x11b')](db[_0xe9bd('0x6f')],{'onDelete':_0xe9bd('0x10a'),'as':'Contact','foreignKey':_0xe9bd('0x159')});db[_0xe9bd('0x65')][_0xe9bd('0x11b')](db[_0xe9bd('0x123')],{'onDelete':_0xe9bd('0x10a'),'as':_0xe9bd('0x17b'),'foreignKey':'ChatInteractionId'});db[_0xe9bd('0x65')]['belongsTo'](db[_0xe9bd('0xeb')],{'as':_0xe9bd('0xeb'),'foreignKey':_0xe9bd('0x176')});db[_0xe9bd('0x65')]['belongsTo'](db[_0xe9bd('0x60')],{'as':_0xe9bd('0x16b'),'foreignKey':_0xe9bd('0x16c')});db[_0xe9bd('0x16d')]['hasMany'](db[_0xe9bd('0xeb')],{'as':_0xe9bd('0x16a'),'foreignKey':_0xe9bd('0x16e'),'onDelete':'cascade','hooks':!![]});db[_0xe9bd('0x16d')][_0xe9bd('0x11b')](db[_0xe9bd('0x6f')],{'onDelete':'cascade','as':_0xe9bd('0x158'),'foreignKey':_0xe9bd('0x159')});db[_0xe9bd('0x16d')][_0xe9bd('0x11b')](db[_0xe9bd('0x60')],{'as':_0xe9bd('0x16b'),'foreignKey':_0xe9bd('0x16c')});db['ChatQueue']['belongsToMany'](db[_0xe9bd('0x10')],{'as':_0xe9bd('0x150'),'through':_0xe9bd('0x2c'),'hooks':!![]});db['ChatQueue']['belongsToMany'](db[_0xe9bd('0xe3')],{'through':_0xe9bd('0x188'),'as':_0xe9bd('0x151')});db['ChatGroup'][_0xe9bd('0x10b')](db[_0xe9bd('0xce')],{'as':_0xe9bd('0x154'),'foreignKey':_0xe9bd('0x189'),'onDelete':_0xe9bd('0x10a')});db[_0xe9bd('0x6a')][_0xe9bd('0x11d')](db[_0xe9bd('0x10')],{'as':_0xe9bd('0x145'),'through':'chat_group_has_users'});db['ChatProactiveAction'][_0xe9bd('0x11b')](db[_0xe9bd('0x60')],{'as':_0xe9bd('0x18a'),'foreignKey':_0xe9bd('0x16c')});db['CmCompany'][_0xe9bd('0x10b')](db[_0xe9bd('0x6f')],{'as':_0xe9bd('0x11f'),'foreignKey':_0xe9bd('0x18b')});db[_0xe9bd('0x6f')]['hasMany'](db[_0xe9bd('0x71')],{'as':_0xe9bd('0x18c'),'foreignKey':_0xe9bd('0x159')});db[_0xe9bd('0x6f')]['hasMany'](db['CmHopperFinal'],{'as':_0xe9bd('0x110'),'foreignKey':'ContactId'});db[_0xe9bd('0x6f')][_0xe9bd('0x10b')](db[_0xe9bd('0x111')],{'as':_0xe9bd('0x147'),'foreignKey':_0xe9bd('0x159')});db['CmContact']['hasMany'](db[_0xe9bd('0x76')],{'as':'ReportAgentPreview','foreignKey':_0xe9bd('0x159')});db[_0xe9bd('0x6f')]['hasMany'](db['JscriptySessionReport'],{'as':_0xe9bd('0x149'),'foreignKey':_0xe9bd('0x159')});db[_0xe9bd('0x6f')][_0xe9bd('0x10b')](db['OpenchannelInteraction'],{'as':_0xe9bd('0x113'),'foreignKey':_0xe9bd('0x159'),'onDelete':_0xe9bd('0x16f')});db[_0xe9bd('0x6f')][_0xe9bd('0x10b')](db[_0xe9bd('0x123')],{'as':_0xe9bd('0x114'),'foreignKey':'ContactId','onDelete':_0xe9bd('0x16f')});db['CmContact'][_0xe9bd('0x10b')](db[_0xe9bd('0x56')],{'as':'SmsInteractions','foreignKey':_0xe9bd('0x159'),'onDelete':_0xe9bd('0x16f')});db[_0xe9bd('0x6f')][_0xe9bd('0x10b')](db[_0xe9bd('0x4c')],{'as':_0xe9bd('0x116'),'foreignKey':'ContactId','onDelete':_0xe9bd('0x16f')});db[_0xe9bd('0x6f')]['hasMany'](db['MailInteraction'],{'as':_0xe9bd('0x117'),'foreignKey':'ContactId','onDelete':_0xe9bd('0x16f')});db[_0xe9bd('0x6f')][_0xe9bd('0x11b')](db[_0xe9bd('0x6d')],{'as':'Company','foreignKey':_0xe9bd('0x18b')});db[_0xe9bd('0x6f')][_0xe9bd('0x11b')](db[_0xe9bd('0x121')],{'as':_0xe9bd('0x160'),'foreignKey':_0xe9bd('0x161'),'onDelete':_0xe9bd('0x10a')});db[_0xe9bd('0x6f')][_0xe9bd('0x11d')](db[_0xe9bd('0x10')],{'as':_0xe9bd('0x175'),'through':_0xe9bd('0x120')});db[_0xe9bd('0x6f')][_0xe9bd('0x11d')](db['Tag'],{'as':_0xe9bd('0x166'),'through':_0xe9bd('0x18d')});db[_0xe9bd('0x6f')][_0xe9bd('0x11d')](db[_0xe9bd('0x8b')],{'through':_0xe9bd('0x18d'),'as':'ThroughTags'});db[_0xe9bd('0x71')][_0xe9bd('0x11b')](db['CmContact'],{'as':_0xe9bd('0x158'),'foreignKey':_0xe9bd('0x159'),'onDelete':_0xe9bd('0x10a')});db[_0xe9bd('0x71')][_0xe9bd('0x11b')](db[_0xe9bd('0x121')],{'as':_0xe9bd('0x160'),'foreignKey':_0xe9bd('0x161'),'onDelete':_0xe9bd('0x10a')});db[_0xe9bd('0x71')]['belongsTo'](db[_0xe9bd('0x10')],{'as':_0xe9bd('0x184'),'foreignKey':_0xe9bd('0x10c')});db[_0xe9bd('0x71')][_0xe9bd('0x11b')](db[_0xe9bd('0x17')],{'as':'Queue','foreignKey':_0xe9bd('0x146'),'onDelete':_0xe9bd('0x10a')});db[_0xe9bd('0x71')][_0xe9bd('0x11b')](db[_0xe9bd('0xe7')],{'as':_0xe9bd('0xe7'),'foreignKey':'CampaignId','onDelete':_0xe9bd('0x10a')});db[_0xe9bd('0x71')][_0xe9bd('0x11b')](db[_0xe9bd('0x10')],{'as':_0xe9bd('0x164'),'foreignKey':_0xe9bd('0x18e')});db[_0xe9bd('0x72')]['belongsTo'](db[_0xe9bd('0x6f')],{'as':_0xe9bd('0x158'),'foreignKey':'ContactId','onDelete':_0xe9bd('0x10a')});db[_0xe9bd('0x72')][_0xe9bd('0x11b')](db[_0xe9bd('0x121')],{'as':_0xe9bd('0x160'),'foreignKey':_0xe9bd('0x161'),'onDelete':_0xe9bd('0x10a')});db[_0xe9bd('0x72')][_0xe9bd('0x11b')](db['VoiceQueue'],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0xe9bd('0x10a')});db[_0xe9bd('0x72')][_0xe9bd('0x11b')](db['Campaign'],{'as':_0xe9bd('0xe7'),'foreignKey':_0xe9bd('0x18f'),'onDelete':_0xe9bd('0x10a')});db[_0xe9bd('0x7a')]['hasMany'](db[_0xe9bd('0x7f')],{'as':{'plural':_0xe9bd('0x190'),'singular':'OneAll'},'foreignKey':_0xe9bd('0x191'),'onDelete':_0xe9bd('0x10a'),'hooks':!![]});db[_0xe9bd('0x7a')]['hasMany'](db[_0xe9bd('0x7f')],{'as':{'plural':_0xe9bd('0x192'),'singular':_0xe9bd('0x193')},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db[_0xe9bd('0x7a')][_0xe9bd('0x10b')](db['Action'],{'as':_0xe9bd('0x194'),'foreignKey':_0xe9bd('0x195'),'onDelete':_0xe9bd('0x10a'),'hooks':!![]});db[_0xe9bd('0x7d')][_0xe9bd('0x10b')](db[_0xe9bd('0x7d')],{'as':_0xe9bd('0x15d'),'foreignKey':_0xe9bd('0x196'),'onDelete':_0xe9bd('0x10a')});db[_0xe9bd('0x81')][_0xe9bd('0x10b')](db[_0xe9bd('0x81')],{'as':_0xe9bd('0x197'),'foreignKey':'IntervalId','onDelete':_0xe9bd('0x10a'),'hooks':!![],'required':![]});db[_0xe9bd('0x81')][_0xe9bd('0x10b')](db[_0xe9bd('0x10e')],{'as':'Extensions','foreignKey':_0xe9bd('0x14d'),'onDelete':'restrict'});db[_0xe9bd('0x81')][_0xe9bd('0x10b')](db[_0xe9bd('0x41')],{'as':'MailApplications','foreignKey':_0xe9bd('0x14d')});db[_0xe9bd('0x81')]['hasMany'](db['ChatApplication'],{'as':_0xe9bd('0x198'),'foreignKey':_0xe9bd('0x14d')});db[_0xe9bd('0x81')][_0xe9bd('0x10b')](db[_0xe9bd('0x4a')],{'as':_0xe9bd('0x199'),'foreignKey':'IntervalId'});db[_0xe9bd('0x81')]['hasMany'](db[_0xe9bd('0x54')],{'as':'SmsApplications','foreignKey':'IntervalId'});db[_0xe9bd('0x88')][_0xe9bd('0x11b')](db[_0xe9bd('0x15a')],{});db['Schedule'][_0xe9bd('0x11b')](db[_0xe9bd('0x95')],{'foreignKey':_0xe9bd('0x19a')});db[_0xe9bd('0x88')][_0xe9bd('0x11b')](db[_0xe9bd('0x94')],{'foreignKey':_0xe9bd('0x19b')});db[_0xe9bd('0x8a')][_0xe9bd('0x11d')](db[_0xe9bd('0x142')],{'as':_0xe9bd('0x19c'),'through':_0xe9bd('0x144'),'onDelete':_0xe9bd('0x16f')});db[_0xe9bd('0x8b')]['belongsToMany'](db['CmContact'],{'through':_0xe9bd('0x18d')});db['Tag']['belongsToMany'](db[_0xe9bd('0x123')],{'through':_0xe9bd('0x187')});db[_0xe9bd('0x8b')][_0xe9bd('0x11d')](db[_0xe9bd('0x3d')],{'through':_0xe9bd('0x165')});db[_0xe9bd('0x8b')][_0xe9bd('0x11d')](db[_0xe9bd('0x56')],{'through':'sms_interaction_has_tags'});db['Tag']['belongsToMany'](db[_0xe9bd('0x4c')],{'through':_0xe9bd('0x174')});db[_0xe9bd('0x8b')]['belongsToMany'](db[_0xe9bd('0x5c')],{'through':_0xe9bd('0x180')});db['Tag'][_0xe9bd('0x11d')](db[_0xe9bd('0xff')],{'through':'whatsapp_interaction_has_tags'});db['Trigger'][_0xe9bd('0x10b')](db[_0xe9bd('0x7f')],{'as':{'plural':_0xe9bd('0x19d'),'singular':_0xe9bd('0x19e')},'foreignKey':'TriggerAllId','onDelete':_0xe9bd('0x10a'),'hooks':!![]});db['Trigger']['hasMany'](db[_0xe9bd('0x7f')],{'as':{'plural':_0xe9bd('0x19f'),'singular':_0xe9bd('0x1a0')},'foreignKey':_0xe9bd('0x1a1'),'onDelete':_0xe9bd('0x10a'),'hooks':!![]});db[_0xe9bd('0x1a2')][_0xe9bd('0x10b')](db['Action'],{'as':'Actions','foreignKey':_0xe9bd('0x1a3'),'onDelete':'cascade','hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0xe9bd('0x98')],{'as':_0xe9bd('0x1a4'),'onDelete':_0xe9bd('0x10a'),'foreignKey':_0xe9bd('0x19b'),'hooks':!![]});db[_0xe9bd('0x95')]['hasMany'](db[_0xe9bd('0x98')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xe9bd('0x19a')});db[_0xe9bd('0x1a5')][_0xe9bd('0x10b')](db[_0xe9bd('0x98')],{'as':_0xe9bd('0x1a4'),'onDelete':_0xe9bd('0x10a'),'foreignKey':_0xe9bd('0x1a6')});db[_0xe9bd('0x98')][_0xe9bd('0x11b')](db[_0xe9bd('0x1a5')],{'foreignKey':_0xe9bd('0x1a6')});db['SalesforceAccount'][_0xe9bd('0x10b')](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0xe9bd('0x10a'),'foreignKey':_0xe9bd('0x1a7')});db[_0xe9bd('0x9c')][_0xe9bd('0x10b')](db[_0xe9bd('0x9d')],{'as':_0xe9bd('0x1a8'),'onDelete':_0xe9bd('0x10a'),'foreignKey':_0xe9bd('0x1a9')});db['SalesforceConfiguration'][_0xe9bd('0x10b')](db[_0xe9bd('0x9d')],{'as':_0xe9bd('0x1aa'),'onDelete':_0xe9bd('0x10a'),'foreignKey':_0xe9bd('0x1ab')});db[_0xe9bd('0x9c')]['hasMany'](db[_0xe9bd('0x9d')],{'as':_0xe9bd('0x1a4'),'onDelete':'cascade','foreignKey':_0xe9bd('0x1ac')});db[_0xe9bd('0x9c')]['belongsTo'](db[_0xe9bd('0x9a')],{'as':'Account','foreignKey':'AccountId'});db[_0xe9bd('0x9d')][_0xe9bd('0x10b')](db[_0xe9bd('0x9d')],{'as':_0xe9bd('0x1ad'),'foreignKey':_0xe9bd('0x1a9')});db[_0xe9bd('0x9d')]['hasMany'](db['SalesforceField'],{'as':_0xe9bd('0x1ae'),'foreignKey':_0xe9bd('0x1ab')});db[_0xe9bd('0x9d')][_0xe9bd('0x10b')](db[_0xe9bd('0x9d')],{'as':_0xe9bd('0x1af'),'foreignKey':'FieldId'});db['SalesforceField']['belongsTo'](db[_0xe9bd('0x8e')],{'as':_0xe9bd('0x8e'),'foreignKey':_0xe9bd('0x1b0')});db[_0xe9bd('0x9f')][_0xe9bd('0x10b')](db['SugarcrmConfiguration'],{'as':_0xe9bd('0x1b1'),'onDelete':_0xe9bd('0x10a'),'foreignKey':_0xe9bd('0x1a7')});db[_0xe9bd('0xa1')][_0xe9bd('0x10b')](db['SugarcrmField'],{'as':_0xe9bd('0x1a8'),'onDelete':_0xe9bd('0x10a'),'foreignKey':_0xe9bd('0x1a9')});db[_0xe9bd('0xa1')][_0xe9bd('0x10b')](db['SugarcrmField'],{'as':_0xe9bd('0x1aa'),'onDelete':_0xe9bd('0x10a'),'foreignKey':_0xe9bd('0x1ab')});db[_0xe9bd('0xa1')][_0xe9bd('0x10b')](db[_0xe9bd('0xa3')],{'as':_0xe9bd('0x1a4'),'onDelete':_0xe9bd('0x10a'),'foreignKey':_0xe9bd('0x1ac')});db[_0xe9bd('0xa1')][_0xe9bd('0x11b')](db['SugarcrmAccount'],{'as':'Account','foreignKey':_0xe9bd('0x1a7')});db['SugarcrmField'][_0xe9bd('0x10b')](db[_0xe9bd('0xa3')],{'as':'Subject','foreignKey':_0xe9bd('0x1a9')});db[_0xe9bd('0xa3')][_0xe9bd('0x10b')](db['SugarcrmField'],{'as':'Description','foreignKey':_0xe9bd('0x1ab')});db[_0xe9bd('0xa3')]['hasMany'](db[_0xe9bd('0xa3')],{'as':'Field','foreignKey':_0xe9bd('0x1ac')});db[_0xe9bd('0xa3')][_0xe9bd('0x11b')](db[_0xe9bd('0x8e')],{'as':_0xe9bd('0x8e'),'foreignKey':_0xe9bd('0x1b0')});db[_0xe9bd('0xa5')][_0xe9bd('0x10b')](db[_0xe9bd('0x1b2')],{'as':'Configurations','onDelete':_0xe9bd('0x10a'),'foreignKey':_0xe9bd('0x1a7')});db[_0xe9bd('0x1b2')][_0xe9bd('0x10b')](db[_0xe9bd('0xa8')],{'as':_0xe9bd('0x1a8'),'onDelete':_0xe9bd('0x10a'),'foreignKey':_0xe9bd('0x1a9')});db[_0xe9bd('0x1b2')]['hasMany'](db['DeskField'],{'as':_0xe9bd('0x1aa'),'onDelete':_0xe9bd('0x10a'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db[_0xe9bd('0xa8')],{'as':_0xe9bd('0x1a4'),'onDelete':_0xe9bd('0x10a'),'foreignKey':_0xe9bd('0x1ac')});db[_0xe9bd('0x1b2')][_0xe9bd('0x11b')](db[_0xe9bd('0xa5')],{'as':_0xe9bd('0x16b'),'foreignKey':_0xe9bd('0x1a7')});db[_0xe9bd('0x1b2')][_0xe9bd('0x11d')](db[_0xe9bd('0x8b')],{'through':_0xe9bd('0x1b3')});db[_0xe9bd('0xa8')][_0xe9bd('0x10b')](db['DeskField'],{'as':'Subject','foreignKey':_0xe9bd('0x1a9')});db[_0xe9bd('0xa8')]['hasMany'](db[_0xe9bd('0xa8')],{'as':_0xe9bd('0x1ae'),'foreignKey':_0xe9bd('0x1ab')});db[_0xe9bd('0xa8')][_0xe9bd('0x10b')](db['DeskField'],{'as':_0xe9bd('0x1af'),'foreignKey':'FieldId'});db[_0xe9bd('0xa8')][_0xe9bd('0x11b')](db[_0xe9bd('0x8e')],{'as':_0xe9bd('0x8e'),'foreignKey':'VariableId'});db[_0xe9bd('0x1b4')][_0xe9bd('0x10b')](db[_0xe9bd('0xab')],{'as':_0xe9bd('0x1b1'),'onDelete':'cascade','foreignKey':_0xe9bd('0x1a7')});db['ZohoConfiguration'][_0xe9bd('0x10b')](db[_0xe9bd('0xad')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xe9bd('0x1a9')});db[_0xe9bd('0xab')][_0xe9bd('0x10b')](db[_0xe9bd('0xad')],{'as':_0xe9bd('0x1aa'),'onDelete':_0xe9bd('0x10a'),'foreignKey':'DescriptionId'});db[_0xe9bd('0xab')]['hasMany'](db[_0xe9bd('0xad')],{'as':_0xe9bd('0x1a4'),'onDelete':_0xe9bd('0x10a'),'foreignKey':_0xe9bd('0x1ac')});db[_0xe9bd('0xab')][_0xe9bd('0x11b')](db[_0xe9bd('0x1b4')],{'as':_0xe9bd('0x16b'),'foreignKey':_0xe9bd('0x1a7')});db[_0xe9bd('0xad')]['hasMany'](db['ZohoField'],{'as':_0xe9bd('0x1ad'),'foreignKey':'SubjectId'});db['ZohoField'][_0xe9bd('0x10b')](db[_0xe9bd('0xad')],{'as':'Description','foreignKey':_0xe9bd('0x1ab')});db[_0xe9bd('0xad')][_0xe9bd('0x10b')](db['ZohoField'],{'as':_0xe9bd('0x1af'),'foreignKey':'FieldId'});db[_0xe9bd('0xad')]['belongsTo'](db[_0xe9bd('0x8e')],{'as':_0xe9bd('0x8e'),'foreignKey':'VariableId'});db[_0xe9bd('0xaf')][_0xe9bd('0x10b')](db['ZendeskConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xe9bd('0x1a7')});db['ZendeskConfiguration'][_0xe9bd('0x10b')](db[_0xe9bd('0xb2')],{'as':_0xe9bd('0x1a8'),'foreignKey':'SubjectId'});db[_0xe9bd('0xb1')]['hasMany'](db[_0xe9bd('0xb2')],{'as':'Descriptions','foreignKey':_0xe9bd('0x1ab')});db[_0xe9bd('0xb1')][_0xe9bd('0x10b')](db[_0xe9bd('0xb2')],{'as':'Fields','foreignKey':'FieldId'});db[_0xe9bd('0xb1')]['belongsTo'](db[_0xe9bd('0xaf')],{'as':_0xe9bd('0x16b'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0xe9bd('0x11d')](db[_0xe9bd('0x8b')],{'through':_0xe9bd('0x1b5')});db[_0xe9bd('0xb2')][_0xe9bd('0x10b')](db['ZendeskField'],{'as':'Subject','foreignKey':_0xe9bd('0x1a9')});db[_0xe9bd('0xb2')]['hasMany'](db[_0xe9bd('0xb2')],{'as':'Description','foreignKey':_0xe9bd('0x1ab')});db[_0xe9bd('0xb2')][_0xe9bd('0x10b')](db[_0xe9bd('0xb2')],{'as':_0xe9bd('0x1af'),'foreignKey':_0xe9bd('0x1ac')});db[_0xe9bd('0xb2')]['belongsTo'](db[_0xe9bd('0x8e')],{'as':_0xe9bd('0x8e'),'foreignKey':_0xe9bd('0x1b0')});db[_0xe9bd('0xb3')][_0xe9bd('0x10b')](db[_0xe9bd('0xb5')],{'as':_0xe9bd('0x1b1'),'onDelete':'cascade','foreignKey':'AccountId'});db['FreshdeskConfiguration']['hasMany'](db[_0xe9bd('0xb7')],{'as':_0xe9bd('0x1a8'),'onDelete':_0xe9bd('0x10a'),'foreignKey':_0xe9bd('0x1a9')});db[_0xe9bd('0xb5')]['hasMany'](db[_0xe9bd('0xb7')],{'as':_0xe9bd('0x1aa'),'onDelete':'cascade','foreignKey':_0xe9bd('0x1ab')});db['FreshdeskConfiguration']['hasMany'](db[_0xe9bd('0xb7')],{'as':_0xe9bd('0x1a4'),'onDelete':_0xe9bd('0x10a'),'foreignKey':_0xe9bd('0x1ac')});db[_0xe9bd('0xb5')][_0xe9bd('0x11b')](db['FreshdeskAccount'],{'as':_0xe9bd('0x16b'),'foreignKey':_0xe9bd('0x1a7')});db[_0xe9bd('0xb5')]['belongsToMany'](db[_0xe9bd('0x8b')],{'through':_0xe9bd('0x1b6')});db[_0xe9bd('0xb7')][_0xe9bd('0x10b')](db[_0xe9bd('0xb7')],{'as':_0xe9bd('0x1ad'),'foreignKey':'SubjectId'});db[_0xe9bd('0xb7')][_0xe9bd('0x10b')](db[_0xe9bd('0xb7')],{'as':_0xe9bd('0x1ae'),'foreignKey':_0xe9bd('0x1ab')});db[_0xe9bd('0xb7')][_0xe9bd('0x10b')](db[_0xe9bd('0xb7')],{'as':_0xe9bd('0x1af'),'foreignKey':_0xe9bd('0x1ac')});db[_0xe9bd('0xb7')][_0xe9bd('0x11b')](db['Variable'],{'as':_0xe9bd('0x8e'),'foreignKey':'VariableId'});db['VtigerAccount'][_0xe9bd('0x10b')](db[_0xe9bd('0xba')],{'as':_0xe9bd('0x1b1'),'onDelete':_0xe9bd('0x10a'),'foreignKey':_0xe9bd('0x1a7')});db[_0xe9bd('0xba')][_0xe9bd('0x10b')](db[_0xe9bd('0xbb')],{'as':'Subjects','foreignKey':_0xe9bd('0x1a9')});db['VtigerConfiguration'][_0xe9bd('0x10b')](db[_0xe9bd('0xbb')],{'as':_0xe9bd('0x1aa'),'foreignKey':_0xe9bd('0x1ab')});db[_0xe9bd('0xba')][_0xe9bd('0x10b')](db[_0xe9bd('0xbb')],{'as':_0xe9bd('0x1a4'),'foreignKey':_0xe9bd('0x1ac')});db[_0xe9bd('0xba')][_0xe9bd('0x11b')](db[_0xe9bd('0xb8')],{'as':_0xe9bd('0x16b'),'foreignKey':_0xe9bd('0x1a7')});db[_0xe9bd('0xbb')][_0xe9bd('0x10b')](db[_0xe9bd('0xbb')],{'as':'Subject','foreignKey':_0xe9bd('0x1a9')});db[_0xe9bd('0xbb')][_0xe9bd('0x10b')](db[_0xe9bd('0xbb')],{'as':_0xe9bd('0x1ae'),'foreignKey':'DescriptionId'});db[_0xe9bd('0xbb')][_0xe9bd('0x10b')](db['VtigerField'],{'as':_0xe9bd('0x1af'),'foreignKey':_0xe9bd('0x1ac')});db[_0xe9bd('0xbb')][_0xe9bd('0x11b')](db[_0xe9bd('0x8e')],{'as':_0xe9bd('0x8e'),'foreignKey':_0xe9bd('0x1b0')});db[_0xe9bd('0xbd')][_0xe9bd('0x10b')](db[_0xe9bd('0x1b7')],{'as':_0xe9bd('0x1b1'),'onDelete':_0xe9bd('0x10a'),'foreignKey':_0xe9bd('0x1a7')});db['ServicenowConfiguration'][_0xe9bd('0x10b')](db[_0xe9bd('0xc0')],{'as':'Subjects','foreignKey':_0xe9bd('0x1a9')});db[_0xe9bd('0x1b7')][_0xe9bd('0x10b')](db['ServicenowField'],{'as':_0xe9bd('0x1aa'),'foreignKey':'DescriptionId'});db[_0xe9bd('0x1b7')][_0xe9bd('0x10b')](db['ServicenowField'],{'as':_0xe9bd('0x1a4'),'foreignKey':_0xe9bd('0x1ac')});db[_0xe9bd('0x1b7')][_0xe9bd('0x11b')](db[_0xe9bd('0xbd')],{'as':_0xe9bd('0x16b'),'foreignKey':_0xe9bd('0x1a7')});db['ServicenowField'][_0xe9bd('0x10b')](db['ServicenowField'],{'as':_0xe9bd('0x1ad'),'foreignKey':_0xe9bd('0x1a9')});db['ServicenowField']['hasMany'](db[_0xe9bd('0xc0')],{'as':_0xe9bd('0x1ae'),'foreignKey':'DescriptionId'});db[_0xe9bd('0xc0')]['hasMany'](db[_0xe9bd('0xc0')],{'as':_0xe9bd('0x1af'),'foreignKey':_0xe9bd('0x1ac')});db[_0xe9bd('0xc0')]['belongsTo'](db['Variable'],{'as':_0xe9bd('0x8e'),'foreignKey':'VariableId'});db['Dynamics365Account'][_0xe9bd('0x10b')](db[_0xe9bd('0x1b8')],{'as':_0xe9bd('0x1b1'),'onDelete':_0xe9bd('0x10a'),'foreignKey':_0xe9bd('0x1a7')});db[_0xe9bd('0x1b8')][_0xe9bd('0x10b')](db['Dynamics365Field'],{'as':_0xe9bd('0x1a8'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xe9bd('0x1b8')][_0xe9bd('0x10b')](db['Dynamics365Field'],{'as':_0xe9bd('0x1aa'),'onDelete':'cascade','foreignKey':_0xe9bd('0x1ab')});db[_0xe9bd('0x1b8')][_0xe9bd('0x10b')](db[_0xe9bd('0xc4')],{'as':_0xe9bd('0x1a4'),'onDelete':_0xe9bd('0x10a'),'foreignKey':_0xe9bd('0x1ac')});db[_0xe9bd('0x1b8')]['belongsTo'](db['Dynamics365Account'],{'as':_0xe9bd('0x16b'),'foreignKey':_0xe9bd('0x1a7')});db[_0xe9bd('0xc4')]['hasMany'](db[_0xe9bd('0xc4')],{'as':_0xe9bd('0x1ad'),'foreignKey':_0xe9bd('0x1a9')});db['Dynamics365Field'][_0xe9bd('0x10b')](db[_0xe9bd('0xc4')],{'as':_0xe9bd('0x1ae'),'foreignKey':'DescriptionId'});db['Dynamics365Field']['hasMany'](db[_0xe9bd('0xc4')],{'as':_0xe9bd('0x1af'),'foreignKey':_0xe9bd('0x1ac')});db[_0xe9bd('0xc4')][_0xe9bd('0x11b')](db['Variable'],{'as':'Variable','foreignKey':_0xe9bd('0x1b0')});db[_0xe9bd('0xc6')][_0xe9bd('0x10b')](db[_0xe9bd('0xc8')],{'as':_0xe9bd('0x1b1'),'onDelete':'cascade','foreignKey':_0xe9bd('0x1a7')});db['FreshsalesConfiguration']['hasMany'](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0xe9bd('0x1a9')});db[_0xe9bd('0xc8')][_0xe9bd('0x10b')](db[_0xe9bd('0x1b9')],{'as':'Descriptions','foreignKey':_0xe9bd('0x1ab')});db[_0xe9bd('0xc8')][_0xe9bd('0x10b')](db[_0xe9bd('0x1b9')],{'as':_0xe9bd('0x1a4'),'foreignKey':_0xe9bd('0x1ac')});db['FreshsalesConfiguration'][_0xe9bd('0x11b')](db[_0xe9bd('0xc6')],{'as':_0xe9bd('0x16b'),'foreignKey':_0xe9bd('0x1a7')});db[_0xe9bd('0x1b9')]['hasMany'](db[_0xe9bd('0x1b9')],{'as':_0xe9bd('0x1ad'),'foreignKey':_0xe9bd('0x1a9')});db['FreshsalesField'][_0xe9bd('0x10b')](db[_0xe9bd('0x1b9')],{'as':'Description','foreignKey':_0xe9bd('0x1ab')});db['FreshsalesField'][_0xe9bd('0x10b')](db['FreshsalesField'],{'as':_0xe9bd('0x1af'),'foreignKey':_0xe9bd('0x1ac')});db[_0xe9bd('0x1b9')]['belongsTo'](db[_0xe9bd('0x8e')],{'as':_0xe9bd('0x8e'),'foreignKey':_0xe9bd('0x1b0')});db[_0xe9bd('0xcd')][_0xe9bd('0x11b')](db[_0xe9bd('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0xe9bd('0x121')],{'as':_0xe9bd('0x160'),'foreignKey':_0xe9bd('0x161')});db[_0xe9bd('0xcd')][_0xe9bd('0x11b')](db[_0xe9bd('0x6f')],{'as':_0xe9bd('0x158'),'foreignKey':_0xe9bd('0x159')});db[_0xe9bd('0xcd')][_0xe9bd('0x11b')](db[_0xe9bd('0x123')],{});db['ChatQueueReport'][_0xe9bd('0x11b')](db[_0xe9bd('0x65')],{});db['ChatQueueReport'][_0xe9bd('0x11b')](db[_0xe9bd('0x10')],{});db[_0xe9bd('0xcd')]['belongsTo'](db['ChatQueue'],{});db[_0xe9bd('0xce')]['belongsTo'](db[_0xe9bd('0x10')],{'onDelete':_0xe9bd('0x10a'),'foreignKey':_0xe9bd('0x1ba')});db[_0xe9bd('0xce')][_0xe9bd('0x11b')](db[_0xe9bd('0x10')],{'onDelete':_0xe9bd('0x10a'),'foreignKey':'ToId'});db[_0xe9bd('0xd3')][_0xe9bd('0x10b')](db[_0xe9bd('0xd1')],{'foreignKey':_0xe9bd('0x1bb'),'onDelete':_0xe9bd('0x10a')});db['JscriptySessionReport']['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0xe9bd('0x1bb'),'onDelete':_0xe9bd('0x10a')});db[_0xe9bd('0x1bc')][_0xe9bd('0x11b')](db[_0xe9bd('0x53')],{});db[_0xe9bd('0x1bc')][_0xe9bd('0x11b')](db['CmList'],{'as':_0xe9bd('0x160'),'foreignKey':_0xe9bd('0x161')});db[_0xe9bd('0x1bc')][_0xe9bd('0x11b')](db['CmContact'],{'as':_0xe9bd('0x158'),'foreignKey':_0xe9bd('0x159')});db[_0xe9bd('0x1bc')][_0xe9bd('0x11b')](db[_0xe9bd('0x56')],{});db[_0xe9bd('0x1bc')][_0xe9bd('0x11b')](db['SmsMessage'],{});db[_0xe9bd('0x1bc')][_0xe9bd('0x11b')](db[_0xe9bd('0x10')],{});db['SmsQueueReport']['belongsTo'](db[_0xe9bd('0x58')],{});db['JscriptyProject'][_0xe9bd('0x10b')](db[_0xe9bd('0xd3')],{'foreignKey':_0xe9bd('0x1bd')});db[_0xe9bd('0xd9')]['hasMany'](db[_0xe9bd('0xd1')],{'foreignKey':_0xe9bd('0x1bd')});db['JscriptyProject'][_0xe9bd('0x10b')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db['SquareProject']['belongsToMany'](db[_0xe9bd('0x10')],{'as':_0xe9bd('0x175'),'through':_0xe9bd('0x13e')});db['Team'][_0xe9bd('0x11d')](db['User'],{'as':_0xe9bd('0x150'),'through':_0xe9bd('0x1be')});db[_0xe9bd('0xe3')][_0xe9bd('0x11d')](db[_0xe9bd('0x17')],{'through':'TeamVoiceQueue','as':_0xe9bd('0x129')});db[_0xe9bd('0xe3')][_0xe9bd('0x11d')](db[_0xe9bd('0x12c')],{'through':_0xe9bd('0x1bf'),'as':_0xe9bd('0x12d')});db[_0xe9bd('0xe3')][_0xe9bd('0x11d')](db[_0xe9bd('0x68')],{'through':_0xe9bd('0x188'),'as':_0xe9bd('0x12e')});db[_0xe9bd('0xe3')][_0xe9bd('0x11d')](db[_0xe9bd('0x50')],{'through':_0xe9bd('0x177'),'as':_0xe9bd('0x12f')});db[_0xe9bd('0xe3')][_0xe9bd('0x11d')](db['SmsQueue'],{'through':_0xe9bd('0x1c0'),'as':_0xe9bd('0x130')});db[_0xe9bd('0xe3')][_0xe9bd('0x11d')](db[_0xe9bd('0x5f')],{'through':_0xe9bd('0x181'),'as':_0xe9bd('0x131')});db[_0xe9bd('0xe3')][_0xe9bd('0x11d')](db[_0xe9bd('0x132')],{'through':_0xe9bd('0x1c1'),'as':_0xe9bd('0x133')});db[_0xe9bd('0xe3')][_0xe9bd('0x11d')](db[_0xe9bd('0xf4')],{'through':_0xe9bd('0x1c2'),'as':'VoicePrefixes'});db['Campaign'][_0xe9bd('0x10b')](db[_0xe9bd('0x71')],{'as':_0xe9bd('0x18c'),'foreignKey':'CampaignId'});db[_0xe9bd('0xe7')][_0xe9bd('0x10b')](db[_0xe9bd('0x10f')],{'as':_0xe9bd('0x110'),'foreignKey':'CampaignId'});db['Campaign'][_0xe9bd('0x10b')](db['CmHopperHistory'],{'as':_0xe9bd('0x147'),'foreignKey':'CampaignId'});db[_0xe9bd('0xe7')][_0xe9bd('0x10b')](db[_0xe9bd('0x72')],{'as':_0xe9bd('0x148'),'foreignKey':_0xe9bd('0x18f')});db[_0xe9bd('0xe7')][_0xe9bd('0x11b')](db[_0xe9bd('0x26')],{'as':'Trunk','foreignKey':_0xe9bd('0x14a')});db['Campaign'][_0xe9bd('0x11b')](db['Trunk'],{'as':_0xe9bd('0x14b'),'foreignKey':_0xe9bd('0x14c')});db[_0xe9bd('0xe7')][_0xe9bd('0x11b')](db[_0xe9bd('0x81')],{'as':_0xe9bd('0x81'),'foreignKey':_0xe9bd('0x14d')});db['Campaign']['belongsTo'](db['SquareProject'],{'as':_0xe9bd('0xdf'),'foreignKey':_0xe9bd('0x1c3')});db[_0xe9bd('0xe7')]['belongsToMany'](db['CmList'],{'as':_0xe9bd('0x122'),'through':_0xe9bd('0x1c4')});db[_0xe9bd('0xe7')]['belongsToMany'](db['CmList'],{'as':_0xe9bd('0x1c5'),'through':'campaigns_has_cm_blacklists'});db[_0xe9bd('0xeb')]['belongsTo'](db[_0xe9bd('0x16d')],{'as':'ChatOfflineMessage','foreignKey':_0xe9bd('0x16e')});db[_0xe9bd('0x1c6')]['belongsTo'](db[_0xe9bd('0x3f')],{});db[_0xe9bd('0x1c6')][_0xe9bd('0x11b')](db[_0xe9bd('0x3d')],{});db[_0xe9bd('0x1c6')][_0xe9bd('0x11b')](db[_0xe9bd('0x15a')],{'foreignKey':_0xe9bd('0x1c7'),'as':_0xe9bd('0x1c8')});db['MailTransferReport']['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xe9bd('0x1c6')][_0xe9bd('0x11b')](db[_0xe9bd('0x10')],{'foreignKey':_0xe9bd('0x1c9'),'as':_0xe9bd('0x1ca')});db[_0xe9bd('0x1c6')][_0xe9bd('0x11b')](db[_0xe9bd('0x12c')],{'foreignKey':_0xe9bd('0x1cb'),'as':'ToQueue'});db[_0xe9bd('0x1c6')][_0xe9bd('0x11b')](db[_0xe9bd('0x15a')],{'foreignKey':_0xe9bd('0x1cc'),'as':_0xe9bd('0x1cd')});db[_0xe9bd('0xed')]['belongsTo'](db['ChatMessage'],{});db['ChatTransferReport']['belongsTo'](db[_0xe9bd('0x123')],{});db['ChatTransferReport']['belongsTo'](db[_0xe9bd('0x60')],{'foreignKey':_0xe9bd('0x1ce'),'as':_0xe9bd('0x1c8')});db['ChatTransferReport'][_0xe9bd('0x11b')](db['User'],{'foreignKey':_0xe9bd('0x1cf'),'as':_0xe9bd('0x1d0')});db['ChatTransferReport'][_0xe9bd('0x11b')](db['User'],{'foreignKey':_0xe9bd('0x1c9'),'as':_0xe9bd('0x1ca')});db['ChatTransferReport']['belongsTo'](db[_0xe9bd('0x68')],{'foreignKey':_0xe9bd('0x1d1'),'as':_0xe9bd('0x1d2')});db[_0xe9bd('0xed')][_0xe9bd('0x11b')](db['ChatWebsite'],{'foreignKey':'ToChatWebsiteId','as':_0xe9bd('0x1cd')});db[_0xe9bd('0xef')][_0xe9bd('0x11b')](db[_0xe9bd('0x4e')],{});db['FaxTransferReport'][_0xe9bd('0x11b')](db[_0xe9bd('0x4c')],{});db['FaxTransferReport']['belongsTo'](db[_0xe9bd('0x48')],{'foreignKey':_0xe9bd('0x1d3'),'as':_0xe9bd('0x1c8')});db[_0xe9bd('0xef')]['belongsTo'](db[_0xe9bd('0x10')],{'foreignKey':_0xe9bd('0x1cf'),'as':_0xe9bd('0x1d0')});db[_0xe9bd('0xef')]['belongsTo'](db[_0xe9bd('0x10')],{'foreignKey':_0xe9bd('0x1c9'),'as':'ToAgent'});db[_0xe9bd('0xef')][_0xe9bd('0x11b')](db['FaxQueue'],{'foreignKey':_0xe9bd('0x1d4'),'as':_0xe9bd('0x1d2')});db[_0xe9bd('0xef')][_0xe9bd('0x11b')](db[_0xe9bd('0x48')],{'foreignKey':'ToFaxAccountId','as':_0xe9bd('0x1cd')});db[_0xe9bd('0x1d5')][_0xe9bd('0x11b')](db[_0xe9bd('0x5e')],{});db[_0xe9bd('0x1d5')][_0xe9bd('0x11b')](db[_0xe9bd('0x5c')],{});db['OpenchannelTransferReport'][_0xe9bd('0x11b')](db[_0xe9bd('0x59')],{'foreignKey':'FromOpenchannelAccountId','as':_0xe9bd('0x1c8')});db[_0xe9bd('0x1d5')][_0xe9bd('0x11b')](db[_0xe9bd('0x10')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xe9bd('0x1d5')]['belongsTo'](db[_0xe9bd('0x10')],{'foreignKey':'ToUserId','as':_0xe9bd('0x1ca')});db[_0xe9bd('0x1d5')]['belongsTo'](db['OpenchannelQueue'],{'foreignKey':'ToOpenchannelQueueId','as':_0xe9bd('0x1d2')});db[_0xe9bd('0x1d5')][_0xe9bd('0x11b')](db[_0xe9bd('0x59')],{'foreignKey':_0xe9bd('0x1d6'),'as':_0xe9bd('0x1cd')});db[_0xe9bd('0xf1')][_0xe9bd('0x11b')](db[_0xe9bd('0x57')],{});db[_0xe9bd('0xf1')]['belongsTo'](db['SmsInteraction'],{});db[_0xe9bd('0xf1')][_0xe9bd('0x11b')](db[_0xe9bd('0x53')],{'foreignKey':_0xe9bd('0x1d7'),'as':_0xe9bd('0x1c8')});db[_0xe9bd('0xf1')][_0xe9bd('0x11b')](db[_0xe9bd('0x10')],{'foreignKey':'FromUserId','as':_0xe9bd('0x1d0')});db[_0xe9bd('0xf1')][_0xe9bd('0x11b')](db['User'],{'foreignKey':_0xe9bd('0x1c9'),'as':_0xe9bd('0x1ca')});db[_0xe9bd('0xf1')]['belongsTo'](db[_0xe9bd('0x58')],{'foreignKey':_0xe9bd('0x1d8'),'as':'ToQueue'});db[_0xe9bd('0xf1')][_0xe9bd('0x11b')](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':_0xe9bd('0x1cd')});db[_0xe9bd('0x121')][_0xe9bd('0x10b')](db[_0xe9bd('0x7d')],{'as':_0xe9bd('0x15d'),'foreignKey':'ListId','onDelete':_0xe9bd('0x10a')});db[_0xe9bd('0x121')][_0xe9bd('0x10b')](db[_0xe9bd('0x78')],{'as':_0xe9bd('0x1d9'),'foreignKey':_0xe9bd('0x161')});db['CmList'][_0xe9bd('0x10b')](db[_0xe9bd('0x6f')],{'as':_0xe9bd('0x11f'),'onDelete':_0xe9bd('0x10a'),'foreignKey':_0xe9bd('0x161')});db[_0xe9bd('0x121')][_0xe9bd('0x10b')](db['CmHopperFinal'],{'as':_0xe9bd('0x110'),'foreignKey':_0xe9bd('0x161')});db['CmList'][_0xe9bd('0x10b')](db[_0xe9bd('0x111')],{'as':'HopperHistory','foreignKey':_0xe9bd('0x161')});db[_0xe9bd('0x121')][_0xe9bd('0x10b')](db[_0xe9bd('0x76')],{'as':_0xe9bd('0x76'),'foreignKey':_0xe9bd('0x161')});db[_0xe9bd('0x121')][_0xe9bd('0x11d')](db[_0xe9bd('0x17')],{'as':_0xe9bd('0x1da'),'through':_0xe9bd('0x1db')});db[_0xe9bd('0x121')][_0xe9bd('0x11d')](db[_0xe9bd('0x10')],{'as':_0xe9bd('0x150'),'through':_0xe9bd('0x134')});db[_0xe9bd('0xf4')][_0xe9bd('0x10b')](db[_0xe9bd('0x10e')],{'as':_0xe9bd('0x1dc'),'onDelete':_0xe9bd('0x10a')});db[_0xe9bd('0xf4')][_0xe9bd('0x11d')](db[_0xe9bd('0x10')],{'as':_0xe9bd('0x150'),'through':_0xe9bd('0x12b')});db[_0xe9bd('0xf4')]['belongsToMany'](db[_0xe9bd('0xe3')],{'through':_0xe9bd('0x1c2'),'as':_0xe9bd('0x151')});db[_0xe9bd('0x11c')][_0xe9bd('0x10b')](db['User'],{'as':_0xe9bd('0x175'),'foreignKey':_0xe9bd('0x1dd')});db['UserProfile'][_0xe9bd('0x10b')](db[_0xe9bd('0xf7')],{'as':_0xe9bd('0x1de'),'foreignKey':'userProfileId','onDelete':_0xe9bd('0x10a')});db[_0xe9bd('0xf7')][_0xe9bd('0x10b')](db[_0xe9bd('0xf9')],{'as':'Resources','foreignKey':_0xe9bd('0x1df'),'onDelete':_0xe9bd('0x10a')});db[_0xe9bd('0xfc')][_0xe9bd('0x10b')](db['Disposition'],{'as':_0xe9bd('0x15d'),'foreignKey':'WhatsappAccountId','onDelete':_0xe9bd('0x10a')});db[_0xe9bd('0xfc')][_0xe9bd('0x10b')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xe9bd('0x1e0')});db[_0xe9bd('0xfc')][_0xe9bd('0x10b')](db[_0xe9bd('0x1e1')],{'as':_0xe9bd('0x154'),'foreignKey':_0xe9bd('0x1e0')});db[_0xe9bd('0xfc')]['hasMany'](db[_0xe9bd('0xff')],{'as':_0xe9bd('0x15f')});db['WhatsappAccount']['hasMany'](db[_0xe9bd('0x1e2')],{'as':'Applications'});db[_0xe9bd('0xfc')][_0xe9bd('0x11b')](db[_0xe9bd('0x121')],{'as':_0xe9bd('0x160'),'foreignKey':_0xe9bd('0x161')});db[_0xe9bd('0xfc')]['belongsTo'](db[_0xe9bd('0x83')],{'as':_0xe9bd('0x14e'),'foreignKey':'mandatoryDispositionPauseId'});db['WhatsappAccount'][_0xe9bd('0x11d')](db[_0xe9bd('0x10')],{'as':_0xe9bd('0x150'),'through':_0xe9bd('0x1e3')});db[_0xe9bd('0x1e2')][_0xe9bd('0x11b')](db[_0xe9bd('0x10')],{'onDelete':_0xe9bd('0x16f')});db[_0xe9bd('0x1e2')][_0xe9bd('0x11b')](db[_0xe9bd('0x132')],{'onDelete':'restrict'});db['WhatsappApplication'][_0xe9bd('0x11b')](db[_0xe9bd('0xfc')],{'onDelete':'restrict'});db[_0xe9bd('0x1e2')][_0xe9bd('0x11b')](db[_0xe9bd('0x81')],{'onDelete':_0xe9bd('0x16f'),'foreignKey':_0xe9bd('0x14d')});db[_0xe9bd('0x1e2')]['belongsTo'](db[_0xe9bd('0x8b')],{'onDelete':_0xe9bd('0x16f'),'foreignKey':'TagId'});db[_0xe9bd('0xff')][_0xe9bd('0x10b')](db[_0xe9bd('0x1e1')],{'as':_0xe9bd('0x154'),'onDelete':_0xe9bd('0x10a'),'foreignKey':_0xe9bd('0x1e4')});db[_0xe9bd('0xff')][_0xe9bd('0x11b')](db['WhatsappAccount'],{'as':_0xe9bd('0x16b'),'foreignKey':_0xe9bd('0x1e0')});db[_0xe9bd('0xff')][_0xe9bd('0x11b')](db[_0xe9bd('0x6f')],{'as':_0xe9bd('0x158'),'foreignKey':_0xe9bd('0x159')});db['WhatsappInteraction'][_0xe9bd('0x11b')](db['User'],{'as':_0xe9bd('0x164'),'foreignKey':_0xe9bd('0x10c')});db[_0xe9bd('0xff')][_0xe9bd('0x11d')](db[_0xe9bd('0x8b')],{'through':_0xe9bd('0x1e5'),'as':'Tags'});db[_0xe9bd('0xff')]['belongsToMany'](db[_0xe9bd('0x8b')],{'through':_0xe9bd('0x1e5'),'as':'ThroughTags'});db['WhatsappInteraction'][_0xe9bd('0x11d')](db['User'],{'as':_0xe9bd('0x175'),'through':'user_has_whatsapp_interactions','foreignKey':_0xe9bd('0x1e4')});db['WhatsappMessage'][_0xe9bd('0x11b')](db['User'],{'as':_0xe9bd('0x10')});db[_0xe9bd('0x1e1')][_0xe9bd('0x11b')](db[_0xe9bd('0x6f')],{'onDelete':_0xe9bd('0x10a'),'as':'Contact'});db[_0xe9bd('0x1e1')][_0xe9bd('0x11b')](db[_0xe9bd('0xff')],{'onDelete':_0xe9bd('0x10a'),'as':'Interaction','foreignKey':_0xe9bd('0x1e4')});db[_0xe9bd('0x1e1')]['belongsTo'](db[_0xe9bd('0xfc')],{'as':_0xe9bd('0x16b'),'foreignKey':_0xe9bd('0x1e0')});db['WhatsappQueueReport']['belongsTo'](db[_0xe9bd('0xfc')],{});db[_0xe9bd('0x102')][_0xe9bd('0x11b')](db[_0xe9bd('0x121')],{'as':_0xe9bd('0x160'),'foreignKey':_0xe9bd('0x161')});db[_0xe9bd('0x102')][_0xe9bd('0x11b')](db['CmContact'],{'as':_0xe9bd('0x158'),'foreignKey':'ContactId'});db[_0xe9bd('0x102')][_0xe9bd('0x11b')](db[_0xe9bd('0xff')],{});db['WhatsappQueueReport'][_0xe9bd('0x11b')](db[_0xe9bd('0x132')],{});db[_0xe9bd('0x102')][_0xe9bd('0x11b')](db['WhatsappMessage'],{});db['WhatsappQueueReport'][_0xe9bd('0x11b')](db[_0xe9bd('0x10')],{});db[_0xe9bd('0x1e6')][_0xe9bd('0x11b')](db[_0xe9bd('0x1e1')],{});db[_0xe9bd('0x1e6')][_0xe9bd('0x11b')](db[_0xe9bd('0xff')],{});db[_0xe9bd('0x1e6')]['belongsTo'](db[_0xe9bd('0xfc')],{'foreignKey':_0xe9bd('0x1e7'),'as':_0xe9bd('0x1c8')});db[_0xe9bd('0x1e6')][_0xe9bd('0x11b')](db[_0xe9bd('0xfc')],{'foreignKey':_0xe9bd('0x1e8'),'as':_0xe9bd('0x1cd')});db[_0xe9bd('0x1e6')][_0xe9bd('0x11b')](db['WhatsappQueue'],{'foreignKey':_0xe9bd('0x1e9'),'as':'ToQueue'});db[_0xe9bd('0x1e6')][_0xe9bd('0x11b')](db['User'],{'foreignKey':_0xe9bd('0x1cf'),'as':_0xe9bd('0x1d0')});db[_0xe9bd('0x1e6')]['belongsTo'](db['User'],{'foreignKey':_0xe9bd('0x1c9'),'as':_0xe9bd('0x1ca')});db[_0xe9bd('0x132')]['belongsToMany'](db['User'],{'as':_0xe9bd('0x150'),'through':_0xe9bd('0x35'),'foreignKey':_0xe9bd('0x1ea')});db['WhatsappQueue']['belongsToMany'](db[_0xe9bd('0xe3')],{'through':'team_has_whatsapp_queues','as':'Teams'});module[_0xe9bd('0x1eb')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xac4a=['ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','../api/userVoicePrefix/userVoicePrefix.model','hasOne','cascade','UserId','hasMany','Recordings','UserVoiceQueueRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','SmsInteractions','FaxInteraction','FaxInteractions','MailInteractions','WhatsappInteraction','belongsTo','UserProfile','belongsToMany','chat_group_has_users','Contacts','Lists','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoicePrefixes','UserVoicePrefix','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','moh_has_sounds','VoiceQueueId','CmHopper','Hoppers','HopperHistories','CmHopperBlack','JscriptySessions','TrunkId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','VoiceCallReport','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','Imap','Smtp','Disposition','Dispositions','Interactions','List','ListId','Template','mandatoryDispositionPause','Agents','user_has_mail_accounts','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','ChatWebsiteId','restrict','IntervalId','TagId','Items','FaxAccountId','Answers','Exntensions','FaxMessage','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteraction','OpenchannelApplication','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','ProactiveActions','Agent','Website','chat_interaction_has_tags','ChatInteractionId','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CompanyId','Company','cm_user_has_contacts','cm_contact_has_tags','Queue','CampaignId','All','OneAll','AutomationAllId','Any','OneAny','Action','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','Schedule','DefaultReportId','CustomReportId','whatsapp_interaction_has_tags','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','AnalyticMetric','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','VariableId','DeskField','int_desk_configuration_has_tags','ZohoField','int_freshdesk_configuration_has_tags','ServicenowConfiguration','ServicenowField','Dynamics365Field','FromId','ToId','ProjectId','VoiceQueues','team_has_openchannel_queues','team_has_whatsapp_queues','TeamVoicePrefix','HopperBlacks','TrunkBackup','TrunkBackupId','campaigns_has_cm_lists','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','userProfileId','Resources','sectionId','WhatsappAccountId','WhatsappMessage','user_has_whatsapp_accounts','WhatsappInteractionId','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','jstz','determine','motion2','xcall','xC@LL1234','mysql','name','utf8_general_ci','sequelizeHistory','utf8mb4','utf8','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Automation','CannedAnswer','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount'];(function(_0x445510,_0x171042){var _0x5043a3=function(_0x3f88b0){while(--_0x3f88b0){_0x445510['push'](_0x445510['shift']());}};_0x5043a3(++_0x171042);}(_0xac4a,0x13f));var _0xaac4=function(_0x2ed4a2,_0x4261a4){_0x2ed4a2=_0x2ed4a2-0x0;var _0x76db13=_0xac4a[_0x2ed4a2];return _0x76db13;};'use strict';var config=require(_0xaac4('0x0'));var Sequelize=require(_0xaac4('0x1'));var _=require(_0xaac4('0x2'));var jstz=require(_0xaac4('0x3'));var timezone=jstz[_0xaac4('0x4')]();config[_0xaac4('0x1')]=_['defaultsDeep'](config['sequelize'],{'database':_0xaac4('0x5'),'username':_0xaac4('0x6'),'password':_0xaac4('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xaac4('0x8'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xaac4('0x9')](),'define':{'charset':'utf8','collate':_0xaac4('0xa')}}});config[_0xaac4('0xb')]=_['defaultsDeep'](config['sequelizeHistory'],{'database':_0xaac4('0x5'),'username':'xcall','password':_0xaac4('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xaac4('0xc')},'logging':![],'timezone':timezone[_0xaac4('0x9')](),'define':{'charset':_0xaac4('0xd'),'collate':_0xaac4('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xaac4('0x1')]['database'],config['sequelize'][_0xaac4('0xe')],config[_0xaac4('0x1')][_0xaac4('0xf')],config['sequelize'][_0xaac4('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xaac4('0xb')]['database'],config[_0xaac4('0xb')][_0xaac4('0xe')],config[_0xaac4('0xb')][_0xaac4('0xf')],config[_0xaac4('0xb')][_0xaac4('0x10')])};db[_0xaac4('0x11')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x13'));db[_0xaac4('0x14')]=db[_0xaac4('0x1')][_0xaac4('0x12')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0xaac4('0x15')]=db['sequelize'][_0xaac4('0x12')]('../api/voiceContext/voiceContext.model');db[_0xaac4('0x16')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x17'));db[_0xaac4('0x18')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x19'));db[_0xaac4('0x1a')]=db['sequelize'][_0xaac4('0x12')]('../api/voiceQueue/voiceQueue.model');db[_0xaac4('0x1b')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x1c'));db[_0xaac4('0x1d')]=db[_0xaac4('0x1')]['import'](_0xaac4('0x1e'));db[_0xaac4('0x1f')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x20'));db[_0xaac4('0x21')]=db[_0xaac4('0x1')]['import'](_0xaac4('0x22'));db['VoiceCallReport']=db['sequelize']['import']('../api/voiceCallReport/voiceCallReport.model');db[_0xaac4('0x23')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x24'));db[_0xaac4('0x25')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x26'));db[_0xaac4('0x27')]=db[_0xaac4('0x1')]['import'](_0xaac4('0x28'));db[_0xaac4('0x29')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x2a'));db[_0xaac4('0x2b')]=db['sequelize'][_0xaac4('0x12')]('../api/trunk/trunk.model');db[_0xaac4('0x2c')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x2d'));db['UserVoiceQueueRt']=db['sequelize']['import'](_0xaac4('0x2e'));db[_0xaac4('0x2f')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x30'));db[_0xaac4('0x31')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x32'));db[_0xaac4('0x33')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x34'));db[_0xaac4('0x35')]=db[_0xaac4('0x1')]['import']('../api/userFaxQueue/userFaxQueue.model');db[_0xaac4('0x36')]=db[_0xaac4('0x1')][_0xaac4('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0xaac4('0x37')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x38'));db[_0xaac4('0x39')]=db[_0xaac4('0x1')][_0xaac4('0x12')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xaac4('0x3a')]=db[_0xaac4('0x1')][_0xaac4('0x12')]('../api/mailServerIn/mailServerIn.model');db[_0xaac4('0x3b')]=db['sequelize']['import'](_0xaac4('0x3c'));db[_0xaac4('0x3d')]=db[_0xaac4('0x1')]['import']('../api/mailAccount/mailAccount.model');db[_0xaac4('0x3e')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x3f'));db[_0xaac4('0x40')]=db[_0xaac4('0x1')]['import']('../api/mailSubstatus/mailSubstatus.model');db[_0xaac4('0x41')]=db[_0xaac4('0x1')]['import'](_0xaac4('0x42'));db[_0xaac4('0x43')]=db[_0xaac4('0x1')]['import'](_0xaac4('0x44'));db[_0xaac4('0x45')]=db[_0xaac4('0x1')]['import'](_0xaac4('0x46'));db[_0xaac4('0x47')]=db[_0xaac4('0x1')][_0xaac4('0x12')]('../api/mailQueueReport/mailQueueReport.model');db[_0xaac4('0x48')]=db['sequelize']['import'](_0xaac4('0x49'));db[_0xaac4('0x4a')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x4b'));db[_0xaac4('0x4c')]=db[_0xaac4('0x1')][_0xaac4('0x12')]('../api/faxAccount/faxAccount.model');db[_0xaac4('0x4d')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x4e'));db['FaxInteraction']=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x4f'));db['FaxMessage']=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x50'));db[_0xaac4('0x51')]=db['sequelize'][_0xaac4('0x12')](_0xaac4('0x52'));db[_0xaac4('0x53')]=db['sequelize'][_0xaac4('0x12')](_0xaac4('0x54'));db[_0xaac4('0x55')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x56'));db[_0xaac4('0x57')]=db[_0xaac4('0x1')][_0xaac4('0x12')]('../api/smsApplication/smsApplication.model');db[_0xaac4('0x58')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x59'));db[_0xaac4('0x5a')]=db['sequelize']['import'](_0xaac4('0x5b'));db[_0xaac4('0x5c')]=db[_0xaac4('0x1')][_0xaac4('0x12')]('../api/smsQueue/smsQueue.model');db[_0xaac4('0x5d')]=db['sequelize'][_0xaac4('0x12')](_0xaac4('0x5e'));db['OpenchannelApplication']=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x5f'));db['OpenchannelInteraction']=db['sequelize'][_0xaac4('0x12')](_0xaac4('0x60'));db[_0xaac4('0x61')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x62'));db['OpenchannelQueue']=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x63'));db[_0xaac4('0x64')]=db['sequelize'][_0xaac4('0x12')]('../api/chatWebsite/chatWebsite.model');db[_0xaac4('0x65')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x66'));db[_0xaac4('0x67')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x68'));db[_0xaac4('0x69')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x6a'));db[_0xaac4('0x6b')]=db[_0xaac4('0x1')]['import'](_0xaac4('0x6c'));db[_0xaac4('0x6d')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x6e'));db[_0xaac4('0x6f')]=db[_0xaac4('0x1')][_0xaac4('0x12')]('../api/chatQueue/chatQueue.model');db[_0xaac4('0x70')]=db['sequelize'][_0xaac4('0x12')]('../api/chatGroup/chatGroup.model');db[_0xaac4('0x71')]=db['sequelize']['import'](_0xaac4('0x72'));db[_0xaac4('0x73')]=db['sequelize'][_0xaac4('0x12')](_0xaac4('0x74'));db[_0xaac4('0x75')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x76'));db['CmHopper']=db[_0xaac4('0x1')]['import'](_0xaac4('0x77'));db['CmHopperBlack']=db['sequelize']['import'](_0xaac4('0x78'));db[_0xaac4('0x79')]=db[_0xaac4('0x1')][_0xaac4('0x12')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0xaac4('0x7a')]=db[_0xaac4('0x1')][_0xaac4('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0xaac4('0x7b')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x7c'));db[_0xaac4('0x7d')]=db[_0xaac4('0x1')][_0xaac4('0x12')]('../api/cmCustomField/cmCustomField.model');db['Action']=db[_0xaac4('0x1')]['import']('../api/action/action.model');db[_0xaac4('0x7e')]=db['sequelize'][_0xaac4('0x12')]('../api/automation/automation.model');db[_0xaac4('0x7f')]=db[_0xaac4('0x1')]['import']('../api/cannedAnswer/cannedAnswer.model');db['Disposition']=db['sequelize'][_0xaac4('0x12')](_0xaac4('0x80'));db[_0xaac4('0x81')]=db[_0xaac4('0x1')]['import'](_0xaac4('0x82'));db[_0xaac4('0x83')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x84'));db[_0xaac4('0x85')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x86'));db[_0xaac4('0x87')]=db[_0xaac4('0x1')]['import']('../api/cdr/cdr.model');db[_0xaac4('0x88')]=db['sequelize']['import'](_0xaac4('0x89'));db['Schedule']=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x8a'));db[_0xaac4('0x8b')]=db['sequelize'][_0xaac4('0x12')](_0xaac4('0x8c'));db[_0xaac4('0x8d')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x8e'));db['Template']=db[_0xaac4('0x1')][_0xaac4('0x12')]('../api/template/template.model');db[_0xaac4('0x8f')]=db[_0xaac4('0x1')]['import']('../api/trigger/trigger.model');db[_0xaac4('0x90')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x91'));db[_0xaac4('0x92')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x93'));db['IntegrationReport']=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x94'));db[_0xaac4('0x95')]=db[_0xaac4('0x1')][_0xaac4('0x12')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0xaac4('0x96')]=db[_0xaac4('0x1')]['import']('../api/analyticDefaultReport/analyticDefaultReport.model');db['AnalyticExtractedReport']=db[_0xaac4('0x1')]['import']('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db['sequelize']['import'](_0xaac4('0x97'));db[_0xaac4('0x98')]=db[_0xaac4('0x1')][_0xaac4('0x12')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0xaac4('0x99')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x9a'));db[_0xaac4('0x9b')]=db[_0xaac4('0x1')][_0xaac4('0x12')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xaac4('0x9c')]=db['sequelize']['import'](_0xaac4('0x9d'));db[_0xaac4('0x9e')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x9f'));db[_0xaac4('0xa0')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xa1'));db[_0xaac4('0xa2')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xa3'));db[_0xaac4('0xa4')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xa5'));db[_0xaac4('0xa6')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xa7'));db[_0xaac4('0xa8')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xa9'));db['DeskField']=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xaa'));db[_0xaac4('0xab')]=db[_0xaac4('0x1')]['import'](_0xaac4('0xac'));db[_0xaac4('0xad')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xae'));db['ZohoField']=db[_0xaac4('0x1')]['import'](_0xaac4('0xaf'));db[_0xaac4('0xb0')]=db['sequelize'][_0xaac4('0x12')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xaac4('0xb1')]=db[_0xaac4('0x1')]['import'](_0xaac4('0xb2'));db[_0xaac4('0xb3')]=db['sequelize'][_0xaac4('0x12')](_0xaac4('0xb4'));db[_0xaac4('0xb5')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xb6'));db[_0xaac4('0xb7')]=db[_0xaac4('0x1')][_0xaac4('0x12')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0xaac4('0xb8')]=db[_0xaac4('0x1')][_0xaac4('0x12')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0xaac4('0xb9')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xba'));db[_0xaac4('0xbb')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xbc'));db[_0xaac4('0xbd')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xbe'));db[_0xaac4('0xbf')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xc0'));db['ServicenowConfiguration']=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xc1'));db['ServicenowField']=db[_0xaac4('0x1')][_0xaac4('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0xaac4('0xc2')]=db['sequelize'][_0xaac4('0x12')](_0xaac4('0xc3'));db[_0xaac4('0xc4')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xc5'));db['Dynamics365Field']=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xc6'));db[_0xaac4('0xc7')]=db['sequelize'][_0xaac4('0x12')](_0xaac4('0xc8'));db[_0xaac4('0xc9')]=db['sequelize'][_0xaac4('0x12')](_0xaac4('0xca'));db[_0xaac4('0xcb')]=db[_0xaac4('0x1')][_0xaac4('0x12')]('../api/intFreshsalesField/intFreshsalesField.model');db['Integration']=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x93'));db[_0xaac4('0xcc')]=db['sequelize'][_0xaac4('0x12')](_0xaac4('0xcd'));db[_0xaac4('0xce')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xcf'));db[_0xaac4('0xd0')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xd1'));db[_0xaac4('0xd2')]=db[_0xaac4('0x1')][_0xaac4('0x12')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0xaac4('0xd3')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xd4'));db[_0xaac4('0xd5')]=db[_0xaac4('0x1')][_0xaac4('0x12')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xaac4('0xd6')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xd7'));db[_0xaac4('0xd8')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xd9'));db['SquareDetailsReport']=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xda'));db[_0xaac4('0xdb')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xdc'));db[_0xaac4('0xdd')]=db[_0xaac4('0x1')][_0xaac4('0x12')]('../api/setting/setting.model');db['SquareOdbc']=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xde'));db[_0xaac4('0xdf')]=db[_0xaac4('0x1')]['import'](_0xaac4('0xe0'));db[_0xaac4('0xe1')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xe2'));db[_0xaac4('0xe3')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xe4'));db[_0xaac4('0xe5')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xe6'));db[_0xaac4('0xe7')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xe8'));db[_0xaac4('0xe9')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xea'));db[_0xaac4('0xeb')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xec'));db[_0xaac4('0xed')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xee'));db[_0xaac4('0xef')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xf0'));db[_0xaac4('0xf1')]=db['sequelize'][_0xaac4('0x12')](_0xaac4('0xf2'));db[_0xaac4('0xf3')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xf4'));db[_0xaac4('0xf5')]=db[_0xaac4('0x1')]['import'](_0xaac4('0xf6'));db[_0xaac4('0xf7')]=db['sequelize'][_0xaac4('0x12')](_0xaac4('0xf8'));db[_0xaac4('0xf9')]=db[_0xaac4('0x1')]['import'](_0xaac4('0xfa'));db[_0xaac4('0xfb')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xfc'));db[_0xaac4('0xfd')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xfe'));db['UserProfile']=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0xff'));db[_0xaac4('0x100')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x101'));db[_0xaac4('0x102')]=db[_0xaac4('0x1')]['import'](_0xaac4('0x103'));db[_0xaac4('0x104')]=db['sequelize']['import'](_0xaac4('0x105'));db[_0xaac4('0x106')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x107'));db[_0xaac4('0x108')]=db['sequelize'][_0xaac4('0x12')](_0xaac4('0x109'));db['WhatsappInteraction']=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x10a'));db['WhatsappMessage']=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x10b'));db[_0xaac4('0x10c')]=db['sequelize']['import'](_0xaac4('0x10d'));db[_0xaac4('0x10e')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x10f'));db[_0xaac4('0x110')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x111'));db['CloudProvider']=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x112'));db[_0xaac4('0x113')]=db[_0xaac4('0x1')][_0xaac4('0x12')](_0xaac4('0x114'));db['TeamVoicePrefix']=db[_0xaac4('0x1')][_0xaac4('0x12')]('../api/teamVoicePrefix/teamVoicePrefix.model');db['UserVoicePrefix']=db['sequelize'][_0xaac4('0x12')](_0xaac4('0x115'));db[_0xaac4('0x11')][_0xaac4('0x116')](db[_0xaac4('0x1f')],{'as':_0xaac4('0x1f'),'onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x118')});db[_0xaac4('0x11')][_0xaac4('0x119')](db[_0xaac4('0x1b')],{'as':_0xaac4('0x11a'),'foreignKey':_0xaac4('0x118')});db[_0xaac4('0x11')]['hasMany'](db[_0xaac4('0x11b')],{'as':'VoiceQueuesRt','foreignKey':_0xaac4('0x118')});db[_0xaac4('0x11')][_0xaac4('0x119')](db['VoiceExtension'],{'as':_0xaac4('0x11c'),'onDelete':_0xaac4('0x117'),'hooks':!![]});db[_0xaac4('0x11')][_0xaac4('0x119')](db['CmHopperFinal'],{'as':_0xaac4('0x11d'),'foreignKey':_0xaac4('0x118')});db[_0xaac4('0x11')][_0xaac4('0x119')](db[_0xaac4('0x7a')],{'as':_0xaac4('0x11e'),'foreignKey':'UserId'});db[_0xaac4('0x11')][_0xaac4('0x119')](db['ReportAgentPreview'],{'as':_0xaac4('0x7b'),'foreignKey':_0xaac4('0x118')});db['User']['hasMany'](db['OpenchannelInteraction'],{'as':_0xaac4('0x11f'),'foreignKey':_0xaac4('0x118')});db[_0xaac4('0x11')]['hasMany'](db[_0xaac4('0x69')],{'as':'ChatInteractions','foreignKey':_0xaac4('0x118')});db[_0xaac4('0x11')][_0xaac4('0x119')](db[_0xaac4('0x58')],{'as':_0xaac4('0x120'),'foreignKey':'UserId'});db[_0xaac4('0x11')]['hasMany'](db[_0xaac4('0x121')],{'as':_0xaac4('0x122'),'foreignKey':_0xaac4('0x118')});db[_0xaac4('0x11')][_0xaac4('0x119')](db[_0xaac4('0x41')],{'as':_0xaac4('0x123'),'foreignKey':'UserId'});db[_0xaac4('0x11')][_0xaac4('0x119')](db[_0xaac4('0x124')],{'as':'WhatsappInteractions','foreignKey':'UserId'});db[_0xaac4('0x11')][_0xaac4('0x119')](db[_0xaac4('0x104')],{'as':'UserNotifications','foreignKey':'SenderId'});db['User'][_0xaac4('0x125')](db[_0xaac4('0x126')],{'as':'UserProfile','foreignKey':'userProfileId'});db[_0xaac4('0x11')][_0xaac4('0x127')](db['ChatGroup'],{'as':'Groups','through':_0xaac4('0x128')});db[_0xaac4('0x11')]['belongsToMany'](db[_0xaac4('0x75')],{'as':_0xaac4('0x129'),'through':'cm_user_has_contacts'});db[_0xaac4('0x11')][_0xaac4('0x127')](db[_0xaac4('0xfb')],{'as':_0xaac4('0x12a'),'through':_0xaac4('0x12b')});db[_0xaac4('0x11')]['belongsToMany'](db['Team'],{'through':'user_has_teams'});db[_0xaac4('0x11')]['belongsToMany'](db[_0xaac4('0x41')],{'as':'MailInteractions','through':_0xaac4('0x12c')});db['User'][_0xaac4('0x127')](db[_0xaac4('0x69')],{'as':'ChatInteractions','through':_0xaac4('0x12d')});db['User'][_0xaac4('0x127')](db['FaxInteraction'],{'as':_0xaac4('0x122'),'through':_0xaac4('0x12e')});db['User'][_0xaac4('0x127')](db[_0xaac4('0x58')],{'as':_0xaac4('0x120'),'through':_0xaac4('0x12f')});db['User']['belongsToMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','through':_0xaac4('0x130')});db[_0xaac4('0x11')][_0xaac4('0x127')](db[_0xaac4('0x124')],{'as':_0xaac4('0x131'),'through':_0xaac4('0x132')});db[_0xaac4('0x11')]['belongsToMany'](db[_0xaac4('0x1a')],{'as':'VoiceQueues','through':_0xaac4('0x2f'),'required':![]});db[_0xaac4('0x11')][_0xaac4('0x127')](db[_0xaac4('0xfd')],{'as':_0xaac4('0x133'),'through':_0xaac4('0x134'),'required':![]});db[_0xaac4('0x11')][_0xaac4('0x127')](db[_0xaac4('0x3e')],{'as':_0xaac4('0x135'),'through':'UserMailQueue','required':![]});db[_0xaac4('0x11')][_0xaac4('0x127')](db[_0xaac4('0x6f')],{'as':_0xaac4('0x136'),'through':_0xaac4('0x31'),'required':![],'hooks':!![]});db[_0xaac4('0x11')][_0xaac4('0x127')](db['FaxQueue'],{'as':_0xaac4('0x137'),'through':_0xaac4('0x35'),'required':![]});db[_0xaac4('0x11')][_0xaac4('0x127')](db[_0xaac4('0x5c')],{'as':_0xaac4('0x138'),'through':_0xaac4('0x36'),'required':![]});db['User'][_0xaac4('0x127')](db[_0xaac4('0x139')],{'as':_0xaac4('0x13a'),'through':_0xaac4('0x37'),'required':![]});db[_0xaac4('0x11')]['belongsToMany'](db['WhatsappQueue'],{'as':_0xaac4('0x13b'),'through':_0xaac4('0x39'),'required':![]});db[_0xaac4('0x11')][_0xaac4('0x127')](db[_0xaac4('0xfb')],{'through':_0xaac4('0x12b')});db[_0xaac4('0x11')][_0xaac4('0x127')](db[_0xaac4('0x64')],{'as':_0xaac4('0x13c'),'through':_0xaac4('0x13d')});db['User'][_0xaac4('0x127')](db['FaxAccount'],{'as':'FaxAccounts','through':_0xaac4('0x13e')});db['User'][_0xaac4('0x127')](db[_0xaac4('0x3d')],{'as':'MailAccounts','through':'user_has_mail_accounts'});db[_0xaac4('0x11')][_0xaac4('0x127')](db[_0xaac4('0x5d')],{'as':_0xaac4('0x13f'),'through':_0xaac4('0x140')});db[_0xaac4('0x11')][_0xaac4('0x127')](db['SmsAccount'],{'as':_0xaac4('0x141'),'through':_0xaac4('0x142')});db[_0xaac4('0x11')][_0xaac4('0x127')](db[_0xaac4('0x106')],{'as':_0xaac4('0x143'),'through':'user_has_whatsapp_accounts'});db[_0xaac4('0x11')][_0xaac4('0x127')](db[_0xaac4('0xdf')],{'as':_0xaac4('0x144'),'through':_0xaac4('0x145')});db[_0xaac4('0x14')]['hasMany'](db[_0xaac4('0x16')],{'as':_0xaac4('0x146'),'onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x147')});db['VoiceContext'][_0xaac4('0x119')](db[_0xaac4('0x16')],{'onDelete':_0xaac4('0x117')});db[_0xaac4('0x16')][_0xaac4('0x119')](db[_0xaac4('0x16')],{'as':_0xaac4('0x148'),'onDelete':_0xaac4('0x117')});db[_0xaac4('0x18')][_0xaac4('0x127')](db['Sound'],{'as':'Sounds','through':_0xaac4('0x149')});db[_0xaac4('0x1a')][_0xaac4('0x119')](db[_0xaac4('0x11b')],{'as':'Members','foreignKey':_0xaac4('0x14a')});db['VoiceQueue']['hasMany'](db[_0xaac4('0x14b')],{'as':_0xaac4('0x14c'),'foreignKey':_0xaac4('0x14a')});db[_0xaac4('0x1a')]['hasMany'](db[_0xaac4('0x79')],{'as':_0xaac4('0x11d'),'foreignKey':'VoiceQueueId'});db[_0xaac4('0x1a')][_0xaac4('0x119')](db[_0xaac4('0x7a')],{'as':_0xaac4('0x14d'),'foreignKey':_0xaac4('0x14a')});db['VoiceQueue']['hasMany'](db['ReportAgentPreview'],{'as':_0xaac4('0x7b'),'foreignKey':_0xaac4('0x14a')});db[_0xaac4('0x1a')][_0xaac4('0x119')](db[_0xaac4('0x14e')],{'as':'HopperBlacks','foreignKey':_0xaac4('0x14a')});db[_0xaac4('0x1a')][_0xaac4('0x119')](db[_0xaac4('0xd5')],{'as':_0xaac4('0x14f'),'foreignKey':'VoiceQueueId'});db[_0xaac4('0x1a')][_0xaac4('0x125')](db['Trunk'],{'as':'Trunk','foreignKey':_0xaac4('0x150')});db[_0xaac4('0x1a')][_0xaac4('0x125')](db['Trunk'],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db['VoiceQueue'][_0xaac4('0x125')](db[_0xaac4('0x83')],{'as':_0xaac4('0x83'),'foreignKey':'IntervalId'});db[_0xaac4('0x1a')][_0xaac4('0x125')](db[_0xaac4('0x85')],{'as':'mandatoryDispositionPause','foreignKey':_0xaac4('0x151')});db['VoiceQueue'][_0xaac4('0x127')](db[_0xaac4('0xfb')],{'as':_0xaac4('0x12a'),'through':_0xaac4('0x152')});db[_0xaac4('0x1a')][_0xaac4('0x127')](db[_0xaac4('0x11')],{'as':'Agents','through':_0xaac4('0x2f')});db[_0xaac4('0x1a')][_0xaac4('0x127')](db[_0xaac4('0xe5')],{'as':_0xaac4('0x153'),'through':_0xaac4('0x113')});db['VoiceQueue'][_0xaac4('0x127')](db[_0xaac4('0xfb')],{'as':_0xaac4('0x154'),'through':_0xaac4('0x155')});db[_0xaac4('0x1b')]['belongsTo'](db[_0xaac4('0x11')],{'as':'User','foreignKey':_0xaac4('0x118')});db[_0xaac4('0x1d')][_0xaac4('0x125')](db[_0xaac4('0x11')],{'as':_0xaac4('0x11'),'foreignKey':_0xaac4('0x118')});db[_0xaac4('0x1f')][_0xaac4('0x119')](db[_0xaac4('0x21')],{'as':_0xaac4('0x156'),'onDelete':_0xaac4('0x117'),'foreignKey':'mailboxuser','sourceKey':_0xaac4('0x157')});db[_0xaac4('0x21')][_0xaac4('0x125')](db['VoiceMail'],{'foreignKey':'mailboxuser','targetKey':_0xaac4('0x157')});db[_0xaac4('0x158')][_0xaac4('0x119')](db['VoiceQueueReport'],{'as':_0xaac4('0x159'),'foreignKey':_0xaac4('0x15a'),'constraints':![]});db[_0xaac4('0x158')][_0xaac4('0x119')](db[_0xaac4('0x25')],{'as':_0xaac4('0x15b'),'foreignKey':_0xaac4('0x15a'),'constraints':![]});db[_0xaac4('0x158')][_0xaac4('0x125')](db[_0xaac4('0x11')],{'as':_0xaac4('0x11'),'foreignKey':_0xaac4('0x118')});db[_0xaac4('0x158')][_0xaac4('0x125')](db[_0xaac4('0x75')],{'as':_0xaac4('0x15c'),'foreignKey':_0xaac4('0x15d')});db[_0xaac4('0x3a')][_0xaac4('0x125')](db['MailAccount'],{'as':_0xaac4('0x3d'),'foreignKey':_0xaac4('0x15e')});db['MailServerOut'][_0xaac4('0x125')](db['MailAccount'],{'as':_0xaac4('0x3d'),'foreignKey':'MailAccountId'});db['MailAccount'][_0xaac4('0x116')](db[_0xaac4('0x3a')],{'as':_0xaac4('0x15f'),'onDelete':_0xaac4('0x117')});db[_0xaac4('0x3d')][_0xaac4('0x116')](db[_0xaac4('0x3b')],{'as':_0xaac4('0x160'),'onDelete':'cascade'});db['MailAccount']['hasMany'](db[_0xaac4('0x161')],{'as':_0xaac4('0x162'),'foreignKey':'MailAccountId','onDelete':_0xaac4('0x117')});db['MailAccount']['hasMany'](db[_0xaac4('0x7f')],{'as':'Answers','foreignKey':_0xaac4('0x15e')});db[_0xaac4('0x3d')][_0xaac4('0x119')](db[_0xaac4('0x43')],{'as':_0xaac4('0x156'),'foreignKey':_0xaac4('0x15e')});db[_0xaac4('0x3d')]['hasMany'](db[_0xaac4('0x41')],{'as':_0xaac4('0x163')});db[_0xaac4('0x3d')][_0xaac4('0x119')](db['MailApplication'],{'as':_0xaac4('0x148')});db[_0xaac4('0x3d')][_0xaac4('0x125')](db[_0xaac4('0xfb')],{'as':_0xaac4('0x164'),'foreignKey':_0xaac4('0x165')});db[_0xaac4('0x3d')][_0xaac4('0x125')](db['Template'],{'as':_0xaac4('0x166'),'foreignKey':'TemplateId'});db[_0xaac4('0x3d')][_0xaac4('0x125')](db[_0xaac4('0x85')],{'as':_0xaac4('0x167'),'foreignKey':_0xaac4('0x151')});db[_0xaac4('0x3d')][_0xaac4('0x127')](db['User'],{'as':_0xaac4('0x168'),'through':_0xaac4('0x169')});db[_0xaac4('0x3e')]['belongsToMany'](db[_0xaac4('0x11')],{'as':'Agents','through':_0xaac4('0x33')});db[_0xaac4('0x3e')][_0xaac4('0x127')](db[_0xaac4('0xe5')],{'through':_0xaac4('0x16a'),'as':_0xaac4('0x153')});db[_0xaac4('0x41')][_0xaac4('0x119')](db[_0xaac4('0x43')],{'as':_0xaac4('0x156'),'onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x16b')});db[_0xaac4('0x41')][_0xaac4('0x125')](db[_0xaac4('0x3d')],{'as':_0xaac4('0x16c'),'foreignKey':'MailAccountId'});db[_0xaac4('0x41')][_0xaac4('0x125')](db['CmContact'],{'as':_0xaac4('0x15c'),'foreignKey':_0xaac4('0x15d')});db[_0xaac4('0x41')]['belongsTo'](db[_0xaac4('0x11')],{'as':_0xaac4('0x16d'),'foreignKey':'UserId'});db[_0xaac4('0x41')][_0xaac4('0x127')](db[_0xaac4('0x8d')],{'through':_0xaac4('0x16e'),'as':_0xaac4('0x16f')});db[_0xaac4('0x41')][_0xaac4('0x127')](db[_0xaac4('0x8d')],{'through':_0xaac4('0x16e'),'as':_0xaac4('0x170')});db['MailInteraction'][_0xaac4('0x127')](db[_0xaac4('0x11')],{'as':_0xaac4('0x171'),'through':_0xaac4('0x12c'),'foreignKey':_0xaac4('0x16b')});db['MailMessage'][_0xaac4('0x119')](db[_0xaac4('0xed')],{'as':_0xaac4('0x172'),'onDelete':_0xaac4('0x117')});db[_0xaac4('0x43')][_0xaac4('0x125')](db[_0xaac4('0x11')],{'as':_0xaac4('0x11')});db[_0xaac4('0x43')]['belongsTo'](db[_0xaac4('0x75')],{'onDelete':_0xaac4('0x117'),'as':'Contact'});db[_0xaac4('0x43')]['belongsTo'](db[_0xaac4('0x41')],{'as':_0xaac4('0x173'),'foreignKey':_0xaac4('0x16b')});db[_0xaac4('0x43')][_0xaac4('0x125')](db[_0xaac4('0x3d')],{'as':_0xaac4('0x16c'),'foreignKey':_0xaac4('0x15e')});db['MailMessage'][_0xaac4('0x125')](db[_0xaac4('0x64')],{'as':_0xaac4('0x64'),'foreignKey':_0xaac4('0x174')});db[_0xaac4('0x43')][_0xaac4('0x125')](db['ChatOfflineMessage'],{'as':_0xaac4('0x6d'),'foreignKey':'ChatOfflineMessageId'});db[_0xaac4('0x45')]['belongsTo'](db[_0xaac4('0x11')],{'onDelete':_0xaac4('0x175')});db[_0xaac4('0x45')][_0xaac4('0x125')](db[_0xaac4('0x3e')],{'onDelete':_0xaac4('0x175')});db[_0xaac4('0x45')][_0xaac4('0x125')](db[_0xaac4('0x3d')],{'onDelete':'restrict'});db['MailApplication']['belongsTo'](db[_0xaac4('0x83')],{'onDelete':_0xaac4('0x175'),'foreignKey':_0xaac4('0x176')});db[_0xaac4('0x45')][_0xaac4('0x125')](db[_0xaac4('0x8d')],{'onDelete':_0xaac4('0x175'),'foreignKey':_0xaac4('0x177')});db[_0xaac4('0x47')][_0xaac4('0x125')](db['MailAccount'],{});db[_0xaac4('0x47')][_0xaac4('0x125')](db[_0xaac4('0xfb')],{'as':'List','foreignKey':_0xaac4('0x165')});db[_0xaac4('0x47')]['belongsTo'](db[_0xaac4('0x75')],{'as':'Contact','foreignKey':_0xaac4('0x15d')});db[_0xaac4('0x47')][_0xaac4('0x125')](db['MailInteraction'],{});db[_0xaac4('0x47')][_0xaac4('0x125')](db[_0xaac4('0x43')],{});db[_0xaac4('0x47')][_0xaac4('0x125')](db[_0xaac4('0x11')],{});db[_0xaac4('0x47')]['belongsTo'](db[_0xaac4('0x3e')],{});db[_0xaac4('0x48')]['hasMany'](db[_0xaac4('0x4a')],{'as':_0xaac4('0x178'),'onDelete':_0xaac4('0x117')});db[_0xaac4('0x4c')][_0xaac4('0x119')](db[_0xaac4('0x161')],{'as':_0xaac4('0x162'),'foreignKey':_0xaac4('0x179'),'onDelete':_0xaac4('0x117')});db['FaxAccount']['hasMany'](db[_0xaac4('0x7f')],{'as':_0xaac4('0x17a'),'foreignKey':_0xaac4('0x179')});db[_0xaac4('0x4c')][_0xaac4('0x119')](db[_0xaac4('0x121')],{'as':'Interactions'});db[_0xaac4('0x4c')][_0xaac4('0x119')](db[_0xaac4('0x4d')],{'as':_0xaac4('0x148')});db['FaxAccount'][_0xaac4('0x119')](db[_0xaac4('0x16')],{'as':_0xaac4('0x17b'),'onDelete':_0xaac4('0x117')});db[_0xaac4('0x4c')]['hasMany'](db[_0xaac4('0x17c')],{'as':_0xaac4('0x156')});db['FaxAccount']['belongsTo'](db[_0xaac4('0x2b')],{'as':_0xaac4('0x2b')});db[_0xaac4('0x4c')][_0xaac4('0x125')](db['CmList'],{'as':'List','foreignKey':_0xaac4('0x165')});db[_0xaac4('0x4c')][_0xaac4('0x125')](db[_0xaac4('0x85')],{'as':_0xaac4('0x167'),'foreignKey':_0xaac4('0x151')});db['FaxAccount'][_0xaac4('0x127')](db[_0xaac4('0x11')],{'as':_0xaac4('0x168'),'through':_0xaac4('0x13e')});db['FaxApplication'][_0xaac4('0x125')](db[_0xaac4('0x11')],{'onDelete':_0xaac4('0x175')});db[_0xaac4('0x4d')][_0xaac4('0x125')](db[_0xaac4('0x51')],{'onDelete':_0xaac4('0x175')});db[_0xaac4('0x4d')]['belongsTo'](db['FaxAccount'],{'onDelete':_0xaac4('0x175')});db[_0xaac4('0x4d')]['belongsTo'](db['Tag'],{'onDelete':_0xaac4('0x175'),'foreignKey':_0xaac4('0x177')});db[_0xaac4('0x121')][_0xaac4('0x119')](db['FaxMessage'],{'as':_0xaac4('0x156'),'onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x17d')});db['FaxInteraction'][_0xaac4('0x125')](db[_0xaac4('0x4c')],{'as':_0xaac4('0x16c'),'foreignKey':_0xaac4('0x179')});db[_0xaac4('0x121')][_0xaac4('0x125')](db[_0xaac4('0x75')],{'as':'Contact','foreignKey':_0xaac4('0x15d')});db[_0xaac4('0x121')][_0xaac4('0x125')](db['User'],{'as':_0xaac4('0x16d'),'foreignKey':_0xaac4('0x118')});db['FaxInteraction'][_0xaac4('0x127')](db[_0xaac4('0x8d')],{'through':'fax_interaction_has_tags','as':_0xaac4('0x16f')});db[_0xaac4('0x121')][_0xaac4('0x127')](db[_0xaac4('0x8d')],{'through':_0xaac4('0x17e'),'as':'ThroughTags'});db[_0xaac4('0x121')][_0xaac4('0x127')](db[_0xaac4('0x11')],{'as':_0xaac4('0x171'),'through':'user_has_fax_interactions','foreignKey':_0xaac4('0x17d')});db[_0xaac4('0x17c')][_0xaac4('0x125')](db[_0xaac4('0x11')],{'onDelete':_0xaac4('0x117'),'as':_0xaac4('0x11')});db[_0xaac4('0x17c')]['belongsTo'](db['FaxInteraction'],{'as':'Interaction','foreignKey':_0xaac4('0x17d')});db[_0xaac4('0x17c')][_0xaac4('0x125')](db['CmContact'],{'onDelete':_0xaac4('0x117'),'as':_0xaac4('0x15c')});db[_0xaac4('0x17c')]['belongsTo'](db[_0xaac4('0xed')],{'as':_0xaac4('0xed'),'foreignKey':_0xaac4('0x17f')});db['FaxMessage'][_0xaac4('0x125')](db[_0xaac4('0x4c')],{'as':_0xaac4('0x16c'),'foreignKey':'FaxAccountId'});db['FaxQueue'][_0xaac4('0x127')](db[_0xaac4('0x11')],{'as':'Agents','through':_0xaac4('0x35')});db[_0xaac4('0x51')][_0xaac4('0x127')](db[_0xaac4('0xe5')],{'through':_0xaac4('0x180'),'as':'Teams'});db[_0xaac4('0x53')]['belongsTo'](db[_0xaac4('0x4c')],{});db['FaxQueueReport']['belongsTo'](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0xaac4('0x53')][_0xaac4('0x125')](db[_0xaac4('0x75')],{'as':_0xaac4('0x15c'),'foreignKey':_0xaac4('0x15d')});db[_0xaac4('0x53')][_0xaac4('0x125')](db[_0xaac4('0x121')],{});db[_0xaac4('0x53')]['belongsTo'](db[_0xaac4('0x17c')],{});db['FaxQueueReport'][_0xaac4('0x125')](db[_0xaac4('0x11')],{});db['FaxQueueReport'][_0xaac4('0x125')](db[_0xaac4('0x51')],{});db[_0xaac4('0x55')][_0xaac4('0x119')](db['Disposition'],{'as':_0xaac4('0x162'),'foreignKey':_0xaac4('0x181'),'onDelete':_0xaac4('0x117')});db[_0xaac4('0x55')][_0xaac4('0x119')](db['CannedAnswer'],{'as':_0xaac4('0x17a'),'foreignKey':'SmsAccountId'});db[_0xaac4('0x55')][_0xaac4('0x119')](db[_0xaac4('0x5a')],{'as':_0xaac4('0x156'),'foreignKey':_0xaac4('0x181')});db[_0xaac4('0x55')]['hasMany'](db['SmsInteraction'],{'as':_0xaac4('0x163')});db[_0xaac4('0x55')][_0xaac4('0x119')](db[_0xaac4('0x57')],{'as':_0xaac4('0x148')});db['SmsAccount']['belongsTo'](db[_0xaac4('0xfb')],{'as':_0xaac4('0x164'),'foreignKey':_0xaac4('0x165')});db[_0xaac4('0x55')]['belongsTo'](db[_0xaac4('0x85')],{'as':_0xaac4('0x167'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xaac4('0x55')][_0xaac4('0x127')](db[_0xaac4('0x11')],{'as':_0xaac4('0x168'),'through':'user_has_sms_accounts'});db['SmsApplication'][_0xaac4('0x125')](db[_0xaac4('0x11')],{'onDelete':_0xaac4('0x175')});db['SmsApplication'][_0xaac4('0x125')](db[_0xaac4('0x5c')],{'onDelete':_0xaac4('0x175')});db['SmsApplication'][_0xaac4('0x125')](db[_0xaac4('0x55')],{'onDelete':_0xaac4('0x175')});db[_0xaac4('0x57')][_0xaac4('0x125')](db[_0xaac4('0x83')],{'onDelete':'restrict','foreignKey':_0xaac4('0x176')});db['SmsApplication'][_0xaac4('0x125')](db[_0xaac4('0x8d')],{'onDelete':_0xaac4('0x175'),'foreignKey':_0xaac4('0x177')});db['SmsInteraction'][_0xaac4('0x119')](db['SmsMessage'],{'as':'Messages','onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x182')});db['SmsInteraction']['belongsTo'](db[_0xaac4('0x55')],{'as':_0xaac4('0x16c'),'foreignKey':_0xaac4('0x181')});db[_0xaac4('0x58')]['belongsTo'](db['CmContact'],{'as':_0xaac4('0x15c'),'foreignKey':'ContactId'});db[_0xaac4('0x58')][_0xaac4('0x125')](db[_0xaac4('0x11')],{'as':_0xaac4('0x16d'),'foreignKey':'UserId'});db['SmsInteraction'][_0xaac4('0x127')](db[_0xaac4('0x8d')],{'through':_0xaac4('0x183'),'as':_0xaac4('0x16f')});db[_0xaac4('0x58')][_0xaac4('0x127')](db[_0xaac4('0x8d')],{'through':_0xaac4('0x183'),'as':_0xaac4('0x170')});db[_0xaac4('0x58')]['belongsToMany'](db[_0xaac4('0x11')],{'as':_0xaac4('0x171'),'through':_0xaac4('0x12f'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0xaac4('0x125')](db['User'],{'as':'User'});db[_0xaac4('0x5a')][_0xaac4('0x125')](db[_0xaac4('0x75')],{'onDelete':_0xaac4('0x117'),'as':'Contact'});db[_0xaac4('0x5a')][_0xaac4('0x125')](db[_0xaac4('0x58')],{'onDelete':_0xaac4('0x117'),'as':_0xaac4('0x173'),'foreignKey':'SmsInteractionId'});db[_0xaac4('0x5a')][_0xaac4('0x125')](db[_0xaac4('0x55')],{'as':_0xaac4('0x16c'),'foreignKey':_0xaac4('0x181')});db[_0xaac4('0x5c')]['belongsToMany'](db[_0xaac4('0x11')],{'as':_0xaac4('0x168'),'through':_0xaac4('0x36'),'foreignKey':_0xaac4('0x184')});db[_0xaac4('0x5c')][_0xaac4('0x127')](db[_0xaac4('0xe5')],{'through':_0xaac4('0x185'),'as':_0xaac4('0x153')});db[_0xaac4('0x5d')][_0xaac4('0x119')](db[_0xaac4('0x161')],{'as':_0xaac4('0x162'),'foreignKey':_0xaac4('0x186'),'onDelete':_0xaac4('0x117')});db[_0xaac4('0x5d')]['hasMany'](db[_0xaac4('0x7f')],{'as':_0xaac4('0x17a'),'foreignKey':_0xaac4('0x186')});db['OpenchannelAccount']['hasMany'](db[_0xaac4('0x187')],{'as':_0xaac4('0x163'),'foreignKey':_0xaac4('0x186')});db['OpenchannelAccount']['hasMany'](db[_0xaac4('0x61')],{'as':_0xaac4('0x156'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xaac4('0x119')](db[_0xaac4('0x188')],{'as':_0xaac4('0x148'),'foreignKey':_0xaac4('0x186')});db[_0xaac4('0x5d')][_0xaac4('0x125')](db['CmList'],{'as':_0xaac4('0x164'),'foreignKey':'ListId'});db[_0xaac4('0x5d')]['belongsTo'](db[_0xaac4('0x85')],{'as':_0xaac4('0x167'),'foreignKey':_0xaac4('0x151')});db['OpenchannelAccount'][_0xaac4('0x127')](db[_0xaac4('0x11')],{'as':_0xaac4('0x168'),'through':_0xaac4('0x140')});db['OpenchannelApplication']['belongsTo'](db[_0xaac4('0x11')],{'onDelete':_0xaac4('0x175')});db[_0xaac4('0x188')][_0xaac4('0x125')](db[_0xaac4('0x139')],{'onDelete':_0xaac4('0x175'),'foreignKey':_0xaac4('0x189')});db['OpenchannelApplication'][_0xaac4('0x125')](db[_0xaac4('0x5d')],{'onDelete':_0xaac4('0x175'),'foreignKey':_0xaac4('0x186')});db[_0xaac4('0x188')][_0xaac4('0x125')](db[_0xaac4('0x83')],{'onDelete':_0xaac4('0x175'),'foreignKey':_0xaac4('0x176')});db['OpenchannelApplication'][_0xaac4('0x125')](db[_0xaac4('0x8d')],{'onDelete':_0xaac4('0x175'),'foreignKey':_0xaac4('0x177')});db[_0xaac4('0x187')][_0xaac4('0x119')](db[_0xaac4('0x61')],{'as':_0xaac4('0x156'),'onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db[_0xaac4('0x187')][_0xaac4('0x125')](db[_0xaac4('0x5d')],{'as':'Account','foreignKey':_0xaac4('0x186')});db[_0xaac4('0x187')][_0xaac4('0x125')](db['CmContact'],{'as':_0xaac4('0x15c'),'foreignKey':_0xaac4('0x15d')});db[_0xaac4('0x187')][_0xaac4('0x125')](db[_0xaac4('0x11')],{'as':_0xaac4('0x16d'),'foreignKey':_0xaac4('0x118')});db[_0xaac4('0x187')][_0xaac4('0x127')](db[_0xaac4('0x8d')],{'through':_0xaac4('0x18a'),'as':_0xaac4('0x16f')});db[_0xaac4('0x187')][_0xaac4('0x127')](db[_0xaac4('0x8d')],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db[_0xaac4('0x187')][_0xaac4('0x127')](db[_0xaac4('0x11')],{'as':'Users','through':_0xaac4('0x130'),'foreignKey':_0xaac4('0x18b')});db[_0xaac4('0x61')]['belongsTo'](db[_0xaac4('0x11')],{'onDelete':_0xaac4('0x117'),'as':_0xaac4('0x11')});db[_0xaac4('0x61')][_0xaac4('0x125')](db[_0xaac4('0x75')],{'onDelete':_0xaac4('0x117'),'as':'Contact'});db[_0xaac4('0x61')][_0xaac4('0x125')](db[_0xaac4('0x187')],{'onDelete':'cascade','as':_0xaac4('0x173'),'foreignKey':_0xaac4('0x18b')});db['OpenchannelMessage'][_0xaac4('0x125')](db[_0xaac4('0xed')],{'as':_0xaac4('0xed'),'foreignKey':_0xaac4('0x17f')});db['OpenchannelMessage']['belongsTo'](db[_0xaac4('0x5d')],{'as':_0xaac4('0x16c'),'foreignKey':'OpenchannelAccountId'});db[_0xaac4('0x139')][_0xaac4('0x127')](db[_0xaac4('0x11')],{'as':_0xaac4('0x168'),'through':_0xaac4('0x37'),'foreignKey':_0xaac4('0x189')});db[_0xaac4('0x139')]['belongsToMany'](db[_0xaac4('0xe5')],{'through':'team_has_openchannel_queues','as':'Teams'});db['ChatWebsite'][_0xaac4('0x119')](db[_0xaac4('0x161')],{'as':'Dispositions','foreignKey':_0xaac4('0x174'),'onDelete':_0xaac4('0x117')});db[_0xaac4('0x64')]['hasMany'](db[_0xaac4('0x7f')],{'as':_0xaac4('0x17a'),'foreignKey':_0xaac4('0x174')});db['ChatWebsite']['hasMany'](db['ChatProactiveAction'],{'as':_0xaac4('0x18c')});db[_0xaac4('0x64')][_0xaac4('0x119')](db[_0xaac4('0x69')],{'as':_0xaac4('0x163')});db['ChatWebsite'][_0xaac4('0x119')](db[_0xaac4('0x67')],{'as':'Applications'});db['ChatWebsite'][_0xaac4('0x119')](db[_0xaac4('0x6b')],{'as':'Messages'});db[_0xaac4('0x64')][_0xaac4('0x125')](db['CmList'],{'as':_0xaac4('0x164'),'foreignKey':_0xaac4('0x165')});db[_0xaac4('0x64')][_0xaac4('0x125')](db[_0xaac4('0x83')],{'as':'Interval','foreignKey':'IntervalId'});db[_0xaac4('0x64')][_0xaac4('0x125')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0xaac4('0x15e')});db[_0xaac4('0x64')]['belongsTo'](db['Pause'],{'as':_0xaac4('0x167'),'foreignKey':_0xaac4('0x151')});db[_0xaac4('0x64')][_0xaac4('0x127')](db[_0xaac4('0x11')],{'as':_0xaac4('0x168'),'through':_0xaac4('0x13d')});db[_0xaac4('0x65')]['belongsTo'](db[_0xaac4('0x5d')],{});db[_0xaac4('0x65')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xaac4('0x165')});db['OpenchannelQueueReport'][_0xaac4('0x125')](db[_0xaac4('0x75')],{'as':_0xaac4('0x15c'),'foreignKey':_0xaac4('0x15d')});db[_0xaac4('0x65')][_0xaac4('0x125')](db[_0xaac4('0x187')],{});db[_0xaac4('0x65')][_0xaac4('0x125')](db[_0xaac4('0x61')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0xaac4('0x11')],{});db[_0xaac4('0x65')][_0xaac4('0x125')](db['OpenchannelQueue'],{});db[_0xaac4('0x67')]['belongsTo'](db[_0xaac4('0x11')],{'as':_0xaac4('0x18d'),'foreignKey':'UserId','onDelete':'restrict'});db[_0xaac4('0x67')][_0xaac4('0x125')](db[_0xaac4('0x6f')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0xaac4('0x175')});db['ChatApplication'][_0xaac4('0x125')](db['ChatWebsite'],{'as':_0xaac4('0x18e'),'foreignKey':_0xaac4('0x174'),'onDelete':_0xaac4('0x175')});db['ChatApplication']['belongsTo'](db[_0xaac4('0x8d')],{'onDelete':_0xaac4('0x175'),'foreignKey':'TagId'});db[_0xaac4('0x69')][_0xaac4('0x119')](db[_0xaac4('0x6b')],{'as':_0xaac4('0x156'),'onDelete':_0xaac4('0x117'),'foreignKey':'ChatInteractionId'});db[_0xaac4('0x69')][_0xaac4('0x125')](db[_0xaac4('0x64')],{'as':_0xaac4('0x16c'),'foreignKey':_0xaac4('0x174')});db[_0xaac4('0x69')]['belongsTo'](db[_0xaac4('0x75')],{'as':_0xaac4('0x15c'),'foreignKey':_0xaac4('0x15d')});db[_0xaac4('0x69')][_0xaac4('0x125')](db[_0xaac4('0x11')],{'as':_0xaac4('0x16d'),'foreignKey':_0xaac4('0x118')});db[_0xaac4('0x69')][_0xaac4('0x127')](db['Tag'],{'through':_0xaac4('0x18f'),'as':_0xaac4('0x16f')});db[_0xaac4('0x69')][_0xaac4('0x127')](db['Tag'],{'through':_0xaac4('0x18f'),'as':_0xaac4('0x170')});db[_0xaac4('0x69')][_0xaac4('0x127')](db[_0xaac4('0x11')],{'as':'Users','through':'user_has_chat_interactions','foreignKey':_0xaac4('0x190')});db['ChatMessage'][_0xaac4('0x125')](db[_0xaac4('0x11')],{'onDelete':'cascade','as':_0xaac4('0x11')});db[_0xaac4('0x6b')][_0xaac4('0x125')](db[_0xaac4('0x75')],{'onDelete':_0xaac4('0x117'),'as':'Contact','foreignKey':_0xaac4('0x15d')});db['ChatMessage'][_0xaac4('0x125')](db[_0xaac4('0x69')],{'onDelete':_0xaac4('0x117'),'as':_0xaac4('0x173'),'foreignKey':_0xaac4('0x190')});db[_0xaac4('0x6b')][_0xaac4('0x125')](db['Attachment'],{'as':_0xaac4('0xed'),'foreignKey':'AttachmentId'});db[_0xaac4('0x6b')]['belongsTo'](db[_0xaac4('0x64')],{'as':'Account','foreignKey':_0xaac4('0x174')});db['ChatOfflineMessage'][_0xaac4('0x119')](db[_0xaac4('0xed')],{'as':_0xaac4('0x172'),'foreignKey':_0xaac4('0x191'),'onDelete':_0xaac4('0x117'),'hooks':!![]});db[_0xaac4('0x6d')]['belongsTo'](db['CmContact'],{'onDelete':_0xaac4('0x117'),'as':_0xaac4('0x15c'),'foreignKey':_0xaac4('0x15d')});db['ChatOfflineMessage'][_0xaac4('0x125')](db[_0xaac4('0x64')],{'as':_0xaac4('0x16c'),'foreignKey':_0xaac4('0x174')});db[_0xaac4('0x6f')]['belongsToMany'](db[_0xaac4('0x11')],{'as':'Agents','through':_0xaac4('0x31'),'hooks':!![]});db[_0xaac4('0x6f')][_0xaac4('0x127')](db[_0xaac4('0xe5')],{'through':_0xaac4('0x192'),'as':'Teams'});db['ChatGroup'][_0xaac4('0x119')](db[_0xaac4('0xd0')],{'as':_0xaac4('0x156'),'foreignKey':_0xaac4('0x193'),'onDelete':_0xaac4('0x117')});db[_0xaac4('0x70')][_0xaac4('0x127')](db[_0xaac4('0x11')],{'as':'Members','through':_0xaac4('0x128')});db['ChatProactiveAction'][_0xaac4('0x125')](db[_0xaac4('0x64')],{'as':_0xaac4('0x18e'),'foreignKey':'ChatWebsiteId'});db[_0xaac4('0x73')]['hasMany'](db[_0xaac4('0x75')],{'as':_0xaac4('0x129'),'foreignKey':_0xaac4('0x194')});db[_0xaac4('0x75')]['hasMany'](db[_0xaac4('0x14b')],{'as':_0xaac4('0x14c'),'foreignKey':_0xaac4('0x15d')});db[_0xaac4('0x75')][_0xaac4('0x119')](db['CmHopperFinal'],{'as':_0xaac4('0x11d'),'foreignKey':'ContactId'});db[_0xaac4('0x75')][_0xaac4('0x119')](db[_0xaac4('0x7a')],{'as':_0xaac4('0x14d'),'foreignKey':_0xaac4('0x15d')});db[_0xaac4('0x75')]['hasMany'](db[_0xaac4('0x7b')],{'as':_0xaac4('0x7b'),'foreignKey':_0xaac4('0x15d')});db[_0xaac4('0x75')][_0xaac4('0x119')](db[_0xaac4('0xd5')],{'as':_0xaac4('0x14f'),'foreignKey':_0xaac4('0x15d')});db['CmContact']['hasMany'](db[_0xaac4('0x187')],{'as':_0xaac4('0x11f'),'foreignKey':'ContactId','onDelete':_0xaac4('0x175')});db[_0xaac4('0x75')][_0xaac4('0x119')](db[_0xaac4('0x69')],{'as':'ChatInteractions','foreignKey':_0xaac4('0x15d'),'onDelete':_0xaac4('0x175')});db[_0xaac4('0x75')]['hasMany'](db[_0xaac4('0x58')],{'as':_0xaac4('0x120'),'foreignKey':_0xaac4('0x15d'),'onDelete':_0xaac4('0x175')});db['CmContact'][_0xaac4('0x119')](db[_0xaac4('0x121')],{'as':_0xaac4('0x122'),'foreignKey':_0xaac4('0x15d'),'onDelete':'restrict'});db[_0xaac4('0x75')][_0xaac4('0x119')](db['MailInteraction'],{'as':_0xaac4('0x123'),'foreignKey':_0xaac4('0x15d'),'onDelete':_0xaac4('0x175')});db[_0xaac4('0x75')][_0xaac4('0x125')](db[_0xaac4('0x73')],{'as':_0xaac4('0x195'),'foreignKey':_0xaac4('0x194')});db[_0xaac4('0x75')][_0xaac4('0x125')](db[_0xaac4('0xfb')],{'as':_0xaac4('0x164'),'foreignKey':'ListId','onDelete':_0xaac4('0x117')});db[_0xaac4('0x75')][_0xaac4('0x127')](db[_0xaac4('0x11')],{'as':'Users','through':_0xaac4('0x196')});db['CmContact'][_0xaac4('0x127')](db[_0xaac4('0x8d')],{'as':_0xaac4('0x16f'),'through':_0xaac4('0x197')});db['CmContact'][_0xaac4('0x127')](db[_0xaac4('0x8d')],{'through':_0xaac4('0x197'),'as':_0xaac4('0x170')});db[_0xaac4('0x14b')]['belongsTo'](db['CmContact'],{'as':_0xaac4('0x15c'),'foreignKey':_0xaac4('0x15d'),'onDelete':_0xaac4('0x117')});db[_0xaac4('0x14b')][_0xaac4('0x125')](db['CmList'],{'as':_0xaac4('0x164'),'foreignKey':_0xaac4('0x165'),'onDelete':_0xaac4('0x117')});db[_0xaac4('0x14b')][_0xaac4('0x125')](db['User'],{'as':_0xaac4('0x18d'),'foreignKey':_0xaac4('0x118')});db[_0xaac4('0x14b')][_0xaac4('0x125')](db[_0xaac4('0x1a')],{'as':_0xaac4('0x198'),'foreignKey':'VoiceQueueId','onDelete':_0xaac4('0x117')});db['CmHopper'][_0xaac4('0x125')](db[_0xaac4('0xe9')],{'as':_0xaac4('0xe9'),'foreignKey':_0xaac4('0x199'),'onDelete':_0xaac4('0x117')});db[_0xaac4('0x14b')]['belongsTo'](db[_0xaac4('0x11')],{'as':_0xaac4('0x16d'),'foreignKey':'OwnerId'});db[_0xaac4('0x14e')][_0xaac4('0x125')](db[_0xaac4('0x75')],{'as':'Contact','foreignKey':_0xaac4('0x15d'),'onDelete':'cascade'});db['CmHopperBlack'][_0xaac4('0x125')](db[_0xaac4('0xfb')],{'as':'List','foreignKey':_0xaac4('0x165'),'onDelete':_0xaac4('0x117')});db[_0xaac4('0x14e')]['belongsTo'](db[_0xaac4('0x1a')],{'as':_0xaac4('0x198'),'foreignKey':_0xaac4('0x14a'),'onDelete':_0xaac4('0x117')});db['CmHopperBlack'][_0xaac4('0x125')](db['Campaign'],{'as':_0xaac4('0xe9'),'foreignKey':'CampaignId','onDelete':_0xaac4('0x117')});db['Automation'][_0xaac4('0x119')](db[_0xaac4('0x81')],{'as':{'plural':_0xaac4('0x19a'),'singular':_0xaac4('0x19b')},'foreignKey':_0xaac4('0x19c'),'onDelete':_0xaac4('0x117'),'hooks':!![]});db[_0xaac4('0x7e')][_0xaac4('0x119')](db[_0xaac4('0x81')],{'as':{'plural':_0xaac4('0x19d'),'singular':_0xaac4('0x19e')},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db[_0xaac4('0x7e')]['hasMany'](db[_0xaac4('0x19f')],{'as':'Actions','foreignKey':_0xaac4('0x1a0'),'onDelete':_0xaac4('0x117'),'hooks':!![]});db[_0xaac4('0x161')][_0xaac4('0x119')](db['Disposition'],{'as':_0xaac4('0x162'),'foreignKey':_0xaac4('0x1a1'),'onDelete':_0xaac4('0x117')});db['Interval'][_0xaac4('0x119')](db[_0xaac4('0x83')],{'as':_0xaac4('0x1a2'),'foreignKey':_0xaac4('0x176'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xaac4('0x83')][_0xaac4('0x119')](db['VoiceExtension'],{'as':_0xaac4('0x11c'),'foreignKey':'IntervalId','onDelete':_0xaac4('0x175')});db[_0xaac4('0x83')][_0xaac4('0x119')](db[_0xaac4('0x45')],{'as':_0xaac4('0x1a3'),'foreignKey':_0xaac4('0x176')});db[_0xaac4('0x83')]['hasMany'](db['ChatApplication'],{'as':_0xaac4('0x1a4'),'foreignKey':_0xaac4('0x176')});db[_0xaac4('0x83')][_0xaac4('0x119')](db[_0xaac4('0x4d')],{'as':_0xaac4('0x1a5'),'foreignKey':'IntervalId'});db['Interval'][_0xaac4('0x119')](db[_0xaac4('0x57')],{'as':'SmsApplications','foreignKey':_0xaac4('0x176')});db[_0xaac4('0x1a6')]['belongsTo'](db[_0xaac4('0x3d')],{});db[_0xaac4('0x1a6')][_0xaac4('0x125')](db[_0xaac4('0x96')],{'foreignKey':_0xaac4('0x1a7')});db[_0xaac4('0x1a6')]['belongsTo'](db[_0xaac4('0x95')],{'foreignKey':_0xaac4('0x1a8')});db[_0xaac4('0x8b')][_0xaac4('0x127')](db[_0xaac4('0x18')],{'as':'Mohs','through':_0xaac4('0x149'),'onDelete':'restrict'});db['Tag'][_0xaac4('0x127')](db[_0xaac4('0x75')],{'through':_0xaac4('0x197')});db[_0xaac4('0x8d')][_0xaac4('0x127')](db[_0xaac4('0x69')],{'through':'chat_interaction_has_tags'});db['Tag'][_0xaac4('0x127')](db[_0xaac4('0x41')],{'through':_0xaac4('0x16e')});db['Tag'][_0xaac4('0x127')](db[_0xaac4('0x58')],{'through':_0xaac4('0x183')});db[_0xaac4('0x8d')][_0xaac4('0x127')](db[_0xaac4('0x121')],{'through':'fax_interaction_has_tags'});db[_0xaac4('0x8d')]['belongsToMany'](db['OpenchannelInteraction'],{'through':_0xaac4('0x18a')});db[_0xaac4('0x8d')][_0xaac4('0x127')](db['WhatsappInteraction'],{'through':_0xaac4('0x1a9')});db['Trigger']['hasMany'](db[_0xaac4('0x81')],{'as':{'plural':'AllConditions','singular':'AllCondition'},'foreignKey':'TriggerAllId','onDelete':'cascade','hooks':!![]});db[_0xaac4('0x8f')][_0xaac4('0x119')](db[_0xaac4('0x81')],{'as':{'plural':_0xaac4('0x1aa'),'singular':_0xaac4('0x1ab')},'foreignKey':_0xaac4('0x1ac'),'onDelete':_0xaac4('0x117'),'hooks':!![]});db['Trigger'][_0xaac4('0x119')](db['Action'],{'as':_0xaac4('0x1ad'),'foreignKey':_0xaac4('0x1ae'),'onDelete':_0xaac4('0x117'),'hooks':!![]});db['AnalyticCustomReport'][_0xaac4('0x119')](db['AnalyticFieldReport'],{'as':_0xaac4('0x1af'),'onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x1a8'),'hooks':!![]});db[_0xaac4('0x96')][_0xaac4('0x119')](db[_0xaac4('0x98')],{'as':_0xaac4('0x1af'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0xaac4('0x1b0')][_0xaac4('0x119')](db[_0xaac4('0x98')],{'as':_0xaac4('0x1af'),'onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x1b1')});db[_0xaac4('0x98')]['belongsTo'](db['AnalyticMetric'],{'foreignKey':_0xaac4('0x1b1')});db[_0xaac4('0x9b')][_0xaac4('0x119')](db[_0xaac4('0x9c')],{'as':_0xaac4('0x1b2'),'onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x1b3')});db['SalesforceConfiguration'][_0xaac4('0x119')](db['SalesforceField'],{'as':_0xaac4('0x1b4'),'onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x1b5')});db[_0xaac4('0x9c')][_0xaac4('0x119')](db[_0xaac4('0x9e')],{'as':_0xaac4('0x1b6'),'onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x1b7')});db[_0xaac4('0x9c')][_0xaac4('0x119')](db[_0xaac4('0x9e')],{'as':_0xaac4('0x1af'),'onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x1b8')});db[_0xaac4('0x9c')][_0xaac4('0x125')](db[_0xaac4('0x9b')],{'as':_0xaac4('0x16c'),'foreignKey':_0xaac4('0x1b3')});db[_0xaac4('0x9e')][_0xaac4('0x119')](db['SalesforceField'],{'as':_0xaac4('0x1b9'),'foreignKey':_0xaac4('0x1b5')});db['SalesforceField'][_0xaac4('0x119')](db['SalesforceField'],{'as':_0xaac4('0x1ba'),'foreignKey':_0xaac4('0x1b7')});db[_0xaac4('0x9e')]['hasMany'](db[_0xaac4('0x9e')],{'as':_0xaac4('0x1bb'),'foreignKey':_0xaac4('0x1b8')});db[_0xaac4('0x9e')]['belongsTo'](db[_0xaac4('0x90')],{'as':_0xaac4('0x90'),'foreignKey':_0xaac4('0x1bc')});db['SugarcrmAccount']['hasMany'](db[_0xaac4('0xa2')],{'as':_0xaac4('0x1b2'),'onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x1b3')});db[_0xaac4('0xa2')][_0xaac4('0x119')](db['SugarcrmField'],{'as':_0xaac4('0x1b4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xaac4('0xa2')][_0xaac4('0x119')](db[_0xaac4('0xa4')],{'as':_0xaac4('0x1b6'),'onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x1b7')});db[_0xaac4('0xa2')][_0xaac4('0x119')](db[_0xaac4('0xa4')],{'as':'Fields','onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x1b8')});db['SugarcrmConfiguration'][_0xaac4('0x125')](db[_0xaac4('0xa0')],{'as':_0xaac4('0x16c'),'foreignKey':'AccountId'});db['SugarcrmField']['hasMany'](db[_0xaac4('0xa4')],{'as':_0xaac4('0x1b9'),'foreignKey':_0xaac4('0x1b5')});db[_0xaac4('0xa4')][_0xaac4('0x119')](db[_0xaac4('0xa4')],{'as':_0xaac4('0x1ba'),'foreignKey':_0xaac4('0x1b7')});db[_0xaac4('0xa4')]['hasMany'](db['SugarcrmField'],{'as':_0xaac4('0x1bb'),'foreignKey':'FieldId'});db[_0xaac4('0xa4')][_0xaac4('0x125')](db[_0xaac4('0x90')],{'as':_0xaac4('0x90'),'foreignKey':'VariableId'});db[_0xaac4('0xa6')][_0xaac4('0x119')](db[_0xaac4('0xa8')],{'as':_0xaac4('0x1b2'),'onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x1b3')});db['DeskConfiguration'][_0xaac4('0x119')](db[_0xaac4('0x1bd')],{'as':_0xaac4('0x1b4'),'onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x1b5')});db[_0xaac4('0xa8')]['hasMany'](db['DeskField'],{'as':_0xaac4('0x1b6'),'onDelete':'cascade','foreignKey':_0xaac4('0x1b7')});db['DeskConfiguration']['hasMany'](db[_0xaac4('0x1bd')],{'as':_0xaac4('0x1af'),'onDelete':'cascade','foreignKey':_0xaac4('0x1b8')});db[_0xaac4('0xa8')][_0xaac4('0x125')](db['DeskAccount'],{'as':'Account','foreignKey':_0xaac4('0x1b3')});db[_0xaac4('0xa8')][_0xaac4('0x127')](db[_0xaac4('0x8d')],{'through':_0xaac4('0x1be')});db[_0xaac4('0x1bd')]['hasMany'](db[_0xaac4('0x1bd')],{'as':_0xaac4('0x1b9'),'foreignKey':'SubjectId'});db[_0xaac4('0x1bd')][_0xaac4('0x119')](db[_0xaac4('0x1bd')],{'as':_0xaac4('0x1ba'),'foreignKey':'DescriptionId'});db[_0xaac4('0x1bd')][_0xaac4('0x119')](db['DeskField'],{'as':'Field','foreignKey':'FieldId'});db['DeskField']['belongsTo'](db['Variable'],{'as':_0xaac4('0x90'),'foreignKey':_0xaac4('0x1bc')});db[_0xaac4('0xab')][_0xaac4('0x119')](db['ZohoConfiguration'],{'as':_0xaac4('0x1b2'),'onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x1b3')});db[_0xaac4('0xad')][_0xaac4('0x119')](db['ZohoField'],{'as':_0xaac4('0x1b4'),'onDelete':_0xaac4('0x117'),'foreignKey':'SubjectId'});db['ZohoConfiguration'][_0xaac4('0x119')](db[_0xaac4('0x1bf')],{'as':_0xaac4('0x1b6'),'onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x1b7')});db['ZohoConfiguration']['hasMany'](db[_0xaac4('0x1bf')],{'as':'Fields','onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x1b8')});db[_0xaac4('0xad')][_0xaac4('0x125')](db['ZohoAccount'],{'as':_0xaac4('0x16c'),'foreignKey':_0xaac4('0x1b3')});db[_0xaac4('0x1bf')][_0xaac4('0x119')](db['ZohoField'],{'as':_0xaac4('0x1b9'),'foreignKey':_0xaac4('0x1b5')});db[_0xaac4('0x1bf')][_0xaac4('0x119')](db[_0xaac4('0x1bf')],{'as':'Description','foreignKey':_0xaac4('0x1b7')});db[_0xaac4('0x1bf')][_0xaac4('0x119')](db[_0xaac4('0x1bf')],{'as':_0xaac4('0x1bb'),'foreignKey':_0xaac4('0x1b8')});db[_0xaac4('0x1bf')][_0xaac4('0x125')](db[_0xaac4('0x90')],{'as':_0xaac4('0x90'),'foreignKey':_0xaac4('0x1bc')});db[_0xaac4('0xb0')]['hasMany'](db[_0xaac4('0xb1')],{'as':_0xaac4('0x1b2'),'onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x1b3')});db[_0xaac4('0xb1')]['hasMany'](db[_0xaac4('0xb3')],{'as':_0xaac4('0x1b4'),'foreignKey':_0xaac4('0x1b5')});db['ZendeskConfiguration']['hasMany'](db[_0xaac4('0xb3')],{'as':_0xaac4('0x1b6'),'foreignKey':'DescriptionId'});db[_0xaac4('0xb1')][_0xaac4('0x119')](db['ZendeskField'],{'as':'Fields','foreignKey':_0xaac4('0x1b8')});db[_0xaac4('0xb1')][_0xaac4('0x125')](db[_0xaac4('0xb0')],{'as':_0xaac4('0x16c'),'foreignKey':_0xaac4('0x1b3')});db[_0xaac4('0xb1')]['belongsToMany'](db[_0xaac4('0x8d')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0xaac4('0x119')](db['ZendeskField'],{'as':_0xaac4('0x1b9'),'foreignKey':'SubjectId'});db[_0xaac4('0xb3')][_0xaac4('0x119')](db[_0xaac4('0xb3')],{'as':_0xaac4('0x1ba'),'foreignKey':_0xaac4('0x1b7')});db[_0xaac4('0xb3')]['hasMany'](db[_0xaac4('0xb3')],{'as':_0xaac4('0x1bb'),'foreignKey':_0xaac4('0x1b8')});db[_0xaac4('0xb3')][_0xaac4('0x125')](db[_0xaac4('0x90')],{'as':_0xaac4('0x90'),'foreignKey':_0xaac4('0x1bc')});db[_0xaac4('0xb5')][_0xaac4('0x119')](db['FreshdeskConfiguration'],{'as':_0xaac4('0x1b2'),'onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x1b3')});db[_0xaac4('0xb7')][_0xaac4('0x119')](db[_0xaac4('0xb8')],{'as':_0xaac4('0x1b4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xaac4('0xb7')]['hasMany'](db[_0xaac4('0xb8')],{'as':_0xaac4('0x1b6'),'onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x1b7')});db[_0xaac4('0xb7')]['hasMany'](db[_0xaac4('0xb8')],{'as':_0xaac4('0x1af'),'onDelete':'cascade','foreignKey':_0xaac4('0x1b8')});db['FreshdeskConfiguration'][_0xaac4('0x125')](db[_0xaac4('0xb5')],{'as':_0xaac4('0x16c'),'foreignKey':_0xaac4('0x1b3')});db['FreshdeskConfiguration'][_0xaac4('0x127')](db[_0xaac4('0x8d')],{'through':_0xaac4('0x1c0')});db[_0xaac4('0xb8')][_0xaac4('0x119')](db[_0xaac4('0xb8')],{'as':'Subject','foreignKey':_0xaac4('0x1b5')});db[_0xaac4('0xb8')][_0xaac4('0x119')](db['FreshdeskField'],{'as':_0xaac4('0x1ba'),'foreignKey':'DescriptionId'});db[_0xaac4('0xb8')][_0xaac4('0x119')](db['FreshdeskField'],{'as':_0xaac4('0x1bb'),'foreignKey':_0xaac4('0x1b8')});db[_0xaac4('0xb8')][_0xaac4('0x125')](db[_0xaac4('0x90')],{'as':_0xaac4('0x90'),'foreignKey':_0xaac4('0x1bc')});db[_0xaac4('0xb9')][_0xaac4('0x119')](db[_0xaac4('0xbb')],{'as':_0xaac4('0x1b2'),'onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x1b3')});db['VtigerConfiguration']['hasMany'](db[_0xaac4('0xbd')],{'as':_0xaac4('0x1b4'),'foreignKey':_0xaac4('0x1b5')});db[_0xaac4('0xbb')][_0xaac4('0x119')](db[_0xaac4('0xbd')],{'as':_0xaac4('0x1b6'),'foreignKey':_0xaac4('0x1b7')});db[_0xaac4('0xbb')][_0xaac4('0x119')](db[_0xaac4('0xbd')],{'as':_0xaac4('0x1af'),'foreignKey':_0xaac4('0x1b8')});db[_0xaac4('0xbb')]['belongsTo'](db[_0xaac4('0xb9')],{'as':_0xaac4('0x16c'),'foreignKey':_0xaac4('0x1b3')});db[_0xaac4('0xbd')][_0xaac4('0x119')](db[_0xaac4('0xbd')],{'as':_0xaac4('0x1b9'),'foreignKey':'SubjectId'});db[_0xaac4('0xbd')][_0xaac4('0x119')](db['VtigerField'],{'as':_0xaac4('0x1ba'),'foreignKey':_0xaac4('0x1b7')});db['VtigerField']['hasMany'](db[_0xaac4('0xbd')],{'as':_0xaac4('0x1bb'),'foreignKey':_0xaac4('0x1b8')});db[_0xaac4('0xbd')][_0xaac4('0x125')](db[_0xaac4('0x90')],{'as':_0xaac4('0x90'),'foreignKey':_0xaac4('0x1bc')});db[_0xaac4('0xbf')][_0xaac4('0x119')](db[_0xaac4('0x1c1')],{'as':_0xaac4('0x1b2'),'onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x1b3')});db[_0xaac4('0x1c1')]['hasMany'](db[_0xaac4('0x1c2')],{'as':_0xaac4('0x1b4'),'foreignKey':_0xaac4('0x1b5')});db[_0xaac4('0x1c1')][_0xaac4('0x119')](db['ServicenowField'],{'as':_0xaac4('0x1b6'),'foreignKey':_0xaac4('0x1b7')});db[_0xaac4('0x1c1')][_0xaac4('0x119')](db[_0xaac4('0x1c2')],{'as':_0xaac4('0x1af'),'foreignKey':_0xaac4('0x1b8')});db[_0xaac4('0x1c1')]['belongsTo'](db[_0xaac4('0xbf')],{'as':_0xaac4('0x16c'),'foreignKey':'AccountId'});db['ServicenowField'][_0xaac4('0x119')](db[_0xaac4('0x1c2')],{'as':_0xaac4('0x1b9'),'foreignKey':_0xaac4('0x1b5')});db[_0xaac4('0x1c2')][_0xaac4('0x119')](db[_0xaac4('0x1c2')],{'as':_0xaac4('0x1ba'),'foreignKey':'DescriptionId'});db['ServicenowField'][_0xaac4('0x119')](db[_0xaac4('0x1c2')],{'as':_0xaac4('0x1bb'),'foreignKey':_0xaac4('0x1b8')});db[_0xaac4('0x1c2')][_0xaac4('0x125')](db[_0xaac4('0x90')],{'as':'Variable','foreignKey':_0xaac4('0x1bc')});db[_0xaac4('0xc2')][_0xaac4('0x119')](db[_0xaac4('0xc4')],{'as':_0xaac4('0x1b2'),'onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x1b3')});db['Dynamics365Configuration']['hasMany'](db['Dynamics365Field'],{'as':'Subjects','onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x1b5')});db[_0xaac4('0xc4')]['hasMany'](db[_0xaac4('0x1c3')],{'as':'Descriptions','onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x1b7')});db[_0xaac4('0xc4')][_0xaac4('0x119')](db[_0xaac4('0x1c3')],{'as':_0xaac4('0x1af'),'onDelete':'cascade','foreignKey':'FieldId'});db['Dynamics365Configuration'][_0xaac4('0x125')](db[_0xaac4('0xc2')],{'as':_0xaac4('0x16c'),'foreignKey':_0xaac4('0x1b3')});db[_0xaac4('0x1c3')][_0xaac4('0x119')](db[_0xaac4('0x1c3')],{'as':'Subject','foreignKey':_0xaac4('0x1b5')});db[_0xaac4('0x1c3')]['hasMany'](db[_0xaac4('0x1c3')],{'as':_0xaac4('0x1ba'),'foreignKey':'DescriptionId'});db[_0xaac4('0x1c3')][_0xaac4('0x119')](db[_0xaac4('0x1c3')],{'as':_0xaac4('0x1bb'),'foreignKey':'FieldId'});db[_0xaac4('0x1c3')][_0xaac4('0x125')](db[_0xaac4('0x90')],{'as':_0xaac4('0x90'),'foreignKey':'VariableId'});db['FreshsalesAccount'][_0xaac4('0x119')](db[_0xaac4('0xc9')],{'as':_0xaac4('0x1b2'),'onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x1b3')});db[_0xaac4('0xc9')][_0xaac4('0x119')](db[_0xaac4('0xcb')],{'as':_0xaac4('0x1b4'),'foreignKey':'SubjectId'});db[_0xaac4('0xc9')][_0xaac4('0x119')](db['FreshsalesField'],{'as':_0xaac4('0x1b6'),'foreignKey':_0xaac4('0x1b7')});db[_0xaac4('0xc9')]['hasMany'](db['FreshsalesField'],{'as':_0xaac4('0x1af'),'foreignKey':_0xaac4('0x1b8')});db[_0xaac4('0xc9')][_0xaac4('0x125')](db[_0xaac4('0xc7')],{'as':'Account','foreignKey':_0xaac4('0x1b3')});db['FreshsalesField'][_0xaac4('0x119')](db[_0xaac4('0xcb')],{'as':'Subject','foreignKey':_0xaac4('0x1b5')});db[_0xaac4('0xcb')][_0xaac4('0x119')](db[_0xaac4('0xcb')],{'as':_0xaac4('0x1ba'),'foreignKey':_0xaac4('0x1b7')});db[_0xaac4('0xcb')]['hasMany'](db[_0xaac4('0xcb')],{'as':_0xaac4('0x1bb'),'foreignKey':_0xaac4('0x1b8')});db[_0xaac4('0xcb')]['belongsTo'](db[_0xaac4('0x90')],{'as':_0xaac4('0x90'),'foreignKey':_0xaac4('0x1bc')});db[_0xaac4('0xce')][_0xaac4('0x125')](db[_0xaac4('0x64')],{});db['ChatQueueReport'][_0xaac4('0x125')](db[_0xaac4('0xfb')],{'as':_0xaac4('0x164'),'foreignKey':_0xaac4('0x165')});db[_0xaac4('0xce')][_0xaac4('0x125')](db[_0xaac4('0x75')],{'as':'Contact','foreignKey':_0xaac4('0x15d')});db[_0xaac4('0xce')][_0xaac4('0x125')](db[_0xaac4('0x69')],{});db[_0xaac4('0xce')][_0xaac4('0x125')](db['ChatMessage'],{});db[_0xaac4('0xce')][_0xaac4('0x125')](db['User'],{});db[_0xaac4('0xce')][_0xaac4('0x125')](db['ChatQueue'],{});db[_0xaac4('0xd0')][_0xaac4('0x125')](db[_0xaac4('0x11')],{'onDelete':'cascade','foreignKey':_0xaac4('0x1c4')});db[_0xaac4('0xd0')][_0xaac4('0x125')](db[_0xaac4('0x11')],{'onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x1c5')});db[_0xaac4('0xd5')][_0xaac4('0x119')](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':_0xaac4('0x117')});db[_0xaac4('0xd5')][_0xaac4('0x119')](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':_0xaac4('0x117')});db[_0xaac4('0xd6')][_0xaac4('0x125')](db[_0xaac4('0x55')],{});db[_0xaac4('0xd6')][_0xaac4('0x125')](db[_0xaac4('0xfb')],{'as':_0xaac4('0x164'),'foreignKey':'ListId'});db[_0xaac4('0xd6')]['belongsTo'](db[_0xaac4('0x75')],{'as':'Contact','foreignKey':_0xaac4('0x15d')});db['SmsQueueReport'][_0xaac4('0x125')](db['SmsInteraction'],{});db[_0xaac4('0xd6')][_0xaac4('0x125')](db[_0xaac4('0x5a')],{});db[_0xaac4('0xd6')][_0xaac4('0x125')](db[_0xaac4('0x11')],{});db[_0xaac4('0xd6')]['belongsTo'](db[_0xaac4('0x5c')],{});db['JscriptyProject'][_0xaac4('0x119')](db['JscriptySessionReport'],{'foreignKey':_0xaac4('0x1c6')});db[_0xaac4('0xdb')][_0xaac4('0x119')](db[_0xaac4('0xd3')],{'foreignKey':'ProjectId'});db[_0xaac4('0xdb')][_0xaac4('0x119')](db[_0xaac4('0xd2')],{'foreignKey':'ProjectId'});db['SquareProject'][_0xaac4('0x127')](db[_0xaac4('0x11')],{'as':_0xaac4('0x171'),'through':_0xaac4('0x145')});db[_0xaac4('0xe5')][_0xaac4('0x127')](db[_0xaac4('0x11')],{'as':_0xaac4('0x168'),'through':'user_has_teams'});db[_0xaac4('0xe5')][_0xaac4('0x127')](db[_0xaac4('0x1a')],{'through':_0xaac4('0x113'),'as':_0xaac4('0x1c7')});db[_0xaac4('0xe5')][_0xaac4('0x127')](db[_0xaac4('0x3e')],{'through':_0xaac4('0x16a'),'as':_0xaac4('0x135')});db[_0xaac4('0xe5')][_0xaac4('0x127')](db['ChatQueue'],{'through':_0xaac4('0x192'),'as':_0xaac4('0x136')});db['Team'][_0xaac4('0x127')](db[_0xaac4('0x51')],{'through':_0xaac4('0x180'),'as':_0xaac4('0x137')});db[_0xaac4('0xe5')][_0xaac4('0x127')](db['SmsQueue'],{'through':_0xaac4('0x185'),'as':_0xaac4('0x138')});db[_0xaac4('0xe5')]['belongsToMany'](db[_0xaac4('0x139')],{'through':_0xaac4('0x1c8'),'as':_0xaac4('0x13a')});db[_0xaac4('0xe5')][_0xaac4('0x127')](db['WhatsappQueue'],{'through':_0xaac4('0x1c9'),'as':_0xaac4('0x13b')});db[_0xaac4('0xe5')][_0xaac4('0x127')](db[_0xaac4('0xfd')],{'through':_0xaac4('0x1ca'),'as':_0xaac4('0x133')});db['Campaign'][_0xaac4('0x119')](db[_0xaac4('0x14b')],{'as':_0xaac4('0x14c'),'foreignKey':_0xaac4('0x199')});db[_0xaac4('0xe9')][_0xaac4('0x119')](db[_0xaac4('0x79')],{'as':_0xaac4('0x11d'),'foreignKey':_0xaac4('0x199')});db[_0xaac4('0xe9')][_0xaac4('0x119')](db['CmHopperHistory'],{'as':_0xaac4('0x14d'),'foreignKey':_0xaac4('0x199')});db[_0xaac4('0xe9')][_0xaac4('0x119')](db[_0xaac4('0x14e')],{'as':_0xaac4('0x1cb'),'foreignKey':_0xaac4('0x199')});db[_0xaac4('0xe9')]['belongsTo'](db['Trunk'],{'as':_0xaac4('0x2b'),'foreignKey':_0xaac4('0x150')});db[_0xaac4('0xe9')][_0xaac4('0x125')](db['Trunk'],{'as':_0xaac4('0x1cc'),'foreignKey':_0xaac4('0x1cd')});db[_0xaac4('0xe9')]['belongsTo'](db[_0xaac4('0x83')],{'as':'Interval','foreignKey':_0xaac4('0x176')});db[_0xaac4('0xe9')][_0xaac4('0x125')](db[_0xaac4('0xdf')],{'as':'SquareProject','foreignKey':'SquareProjectId'});db[_0xaac4('0xe9')]['belongsToMany'](db[_0xaac4('0xfb')],{'as':'Lists','through':_0xaac4('0x1ce')});db['Campaign'][_0xaac4('0x127')](db[_0xaac4('0xfb')],{'as':_0xaac4('0x154'),'through':'campaigns_has_cm_blacklists'});db[_0xaac4('0xed')][_0xaac4('0x125')](db[_0xaac4('0x6d')],{'as':_0xaac4('0x6d'),'foreignKey':_0xaac4('0x191')});db[_0xaac4('0xf1')]['belongsTo'](db['MailMessage'],{});db[_0xaac4('0xf1')][_0xaac4('0x125')](db[_0xaac4('0x41')],{});db[_0xaac4('0xf1')][_0xaac4('0x125')](db[_0xaac4('0x3d')],{'foreignKey':_0xaac4('0x1cf'),'as':_0xaac4('0x1d0')});db[_0xaac4('0xf1')]['belongsTo'](db[_0xaac4('0x11')],{'foreignKey':_0xaac4('0x1d1'),'as':'FromAgent'});db[_0xaac4('0xf1')][_0xaac4('0x125')](db[_0xaac4('0x11')],{'foreignKey':_0xaac4('0x1d2'),'as':_0xaac4('0x1d3')});db['MailTransferReport'][_0xaac4('0x125')](db[_0xaac4('0x3e')],{'foreignKey':_0xaac4('0x1d4'),'as':_0xaac4('0x1d5')});db[_0xaac4('0xf1')][_0xaac4('0x125')](db[_0xaac4('0x3d')],{'foreignKey':_0xaac4('0x1d6'),'as':_0xaac4('0x1d7')});db['ChatTransferReport'][_0xaac4('0x125')](db['ChatMessage'],{});db[_0xaac4('0xf3')][_0xaac4('0x125')](db['ChatInteraction'],{});db[_0xaac4('0xf3')][_0xaac4('0x125')](db['ChatWebsite'],{'foreignKey':_0xaac4('0x1d8'),'as':_0xaac4('0x1d0')});db[_0xaac4('0xf3')][_0xaac4('0x125')](db[_0xaac4('0x11')],{'foreignKey':'FromUserId','as':_0xaac4('0x1d9')});db[_0xaac4('0xf3')]['belongsTo'](db[_0xaac4('0x11')],{'foreignKey':_0xaac4('0x1d2'),'as':_0xaac4('0x1d3')});db[_0xaac4('0xf3')]['belongsTo'](db[_0xaac4('0x6f')],{'foreignKey':_0xaac4('0x1da'),'as':'ToQueue'});db[_0xaac4('0xf3')][_0xaac4('0x125')](db['ChatWebsite'],{'foreignKey':_0xaac4('0x1db'),'as':_0xaac4('0x1d7')});db[_0xaac4('0xf5')][_0xaac4('0x125')](db[_0xaac4('0x17c')],{});db[_0xaac4('0xf5')][_0xaac4('0x125')](db[_0xaac4('0x121')],{});db[_0xaac4('0xf5')][_0xaac4('0x125')](db[_0xaac4('0x4c')],{'foreignKey':_0xaac4('0x1dc'),'as':_0xaac4('0x1d0')});db[_0xaac4('0xf5')][_0xaac4('0x125')](db['User'],{'foreignKey':_0xaac4('0x1d1'),'as':_0xaac4('0x1d9')});db['FaxTransferReport'][_0xaac4('0x125')](db[_0xaac4('0x11')],{'foreignKey':_0xaac4('0x1d2'),'as':_0xaac4('0x1d3')});db['FaxTransferReport'][_0xaac4('0x125')](db['FaxQueue'],{'foreignKey':_0xaac4('0x1dd'),'as':_0xaac4('0x1d5')});db[_0xaac4('0xf5')][_0xaac4('0x125')](db['FaxAccount'],{'foreignKey':_0xaac4('0x1de'),'as':_0xaac4('0x1d7')});db[_0xaac4('0xf7')][_0xaac4('0x125')](db['OpenchannelMessage'],{});db['OpenchannelTransferReport']['belongsTo'](db[_0xaac4('0x187')],{});db['OpenchannelTransferReport'][_0xaac4('0x125')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0xaac4('0x1d0')});db['OpenchannelTransferReport'][_0xaac4('0x125')](db['User'],{'foreignKey':_0xaac4('0x1d1'),'as':_0xaac4('0x1d9')});db['OpenchannelTransferReport']['belongsTo'](db[_0xaac4('0x11')],{'foreignKey':_0xaac4('0x1d2'),'as':_0xaac4('0x1d3')});db[_0xaac4('0xf7')]['belongsTo'](db[_0xaac4('0x139')],{'foreignKey':_0xaac4('0x1df'),'as':_0xaac4('0x1d5')});db['OpenchannelTransferReport'][_0xaac4('0x125')](db[_0xaac4('0x5d')],{'foreignKey':_0xaac4('0x1e0'),'as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0xaac4('0x5a')],{});db[_0xaac4('0xf9')][_0xaac4('0x125')](db[_0xaac4('0x58')],{});db[_0xaac4('0xf9')][_0xaac4('0x125')](db['SmsAccount'],{'foreignKey':_0xaac4('0x1e1'),'as':'FromAccount'});db[_0xaac4('0xf9')][_0xaac4('0x125')](db[_0xaac4('0x11')],{'foreignKey':_0xaac4('0x1d1'),'as':_0xaac4('0x1d9')});db[_0xaac4('0xf9')][_0xaac4('0x125')](db[_0xaac4('0x11')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xaac4('0xf9')][_0xaac4('0x125')](db[_0xaac4('0x5c')],{'foreignKey':_0xaac4('0x1e2'),'as':_0xaac4('0x1d5')});db[_0xaac4('0xf9')][_0xaac4('0x125')](db[_0xaac4('0x55')],{'foreignKey':_0xaac4('0x1e3'),'as':'ToAccount'});db[_0xaac4('0xfb')]['hasMany'](db['Disposition'],{'as':_0xaac4('0x162'),'foreignKey':'ListId','onDelete':_0xaac4('0x117')});db['CmList'][_0xaac4('0x119')](db[_0xaac4('0x7d')],{'as':_0xaac4('0x1e4'),'foreignKey':_0xaac4('0x165')});db['CmList'][_0xaac4('0x119')](db[_0xaac4('0x75')],{'as':_0xaac4('0x129'),'onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x165')});db['CmList']['hasMany'](db[_0xaac4('0x79')],{'as':'HopperFinals','foreignKey':_0xaac4('0x165')});db[_0xaac4('0xfb')][_0xaac4('0x119')](db[_0xaac4('0x7a')],{'as':_0xaac4('0x11e'),'foreignKey':_0xaac4('0x165')});db[_0xaac4('0xfb')]['hasMany'](db[_0xaac4('0x7b')],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0xaac4('0xfb')][_0xaac4('0x127')](db[_0xaac4('0x1a')],{'as':_0xaac4('0x1e5'),'through':_0xaac4('0x152')});db[_0xaac4('0xfb')]['belongsToMany'](db[_0xaac4('0x11')],{'as':'Agents','through':'cm_user_has_lists'});db['VoicePrefix'][_0xaac4('0x119')](db[_0xaac4('0x16')],{'as':'Extensions','onDelete':_0xaac4('0x117')});db['VoicePrefix'][_0xaac4('0x127')](db[_0xaac4('0x11')],{'as':_0xaac4('0x168'),'through':_0xaac4('0x134')});db[_0xaac4('0xfd')][_0xaac4('0x127')](db[_0xaac4('0xe5')],{'through':_0xaac4('0x1ca'),'as':_0xaac4('0x153')});db[_0xaac4('0x126')][_0xaac4('0x119')](db['User'],{'as':'Users','foreignKey':_0xaac4('0x1e6')});db[_0xaac4('0x126')][_0xaac4('0x119')](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':_0xaac4('0x1e6'),'onDelete':'cascade'});db['UserProfileSection'][_0xaac4('0x119')](db['UserProfileResource'],{'as':_0xaac4('0x1e7'),'foreignKey':_0xaac4('0x1e8'),'onDelete':_0xaac4('0x117')});db[_0xaac4('0x106')][_0xaac4('0x119')](db[_0xaac4('0x161')],{'as':_0xaac4('0x162'),'foreignKey':'WhatsappAccountId','onDelete':_0xaac4('0x117')});db[_0xaac4('0x106')]['hasMany'](db[_0xaac4('0x7f')],{'as':_0xaac4('0x17a'),'foreignKey':_0xaac4('0x1e9')});db[_0xaac4('0x106')][_0xaac4('0x119')](db[_0xaac4('0x1ea')],{'as':'Messages','foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0xaac4('0x119')](db[_0xaac4('0x124')],{'as':'Interactions'});db[_0xaac4('0x106')]['hasMany'](db[_0xaac4('0x108')],{'as':_0xaac4('0x148')});db['WhatsappAccount'][_0xaac4('0x125')](db[_0xaac4('0xfb')],{'as':_0xaac4('0x164'),'foreignKey':_0xaac4('0x165')});db[_0xaac4('0x106')][_0xaac4('0x125')](db[_0xaac4('0x85')],{'as':_0xaac4('0x167'),'foreignKey':_0xaac4('0x151')});db[_0xaac4('0x106')]['belongsToMany'](db['User'],{'as':_0xaac4('0x168'),'through':_0xaac4('0x1eb')});db[_0xaac4('0x108')][_0xaac4('0x125')](db['User'],{'onDelete':_0xaac4('0x175')});db[_0xaac4('0x108')][_0xaac4('0x125')](db[_0xaac4('0x110')],{'onDelete':'restrict'});db[_0xaac4('0x108')][_0xaac4('0x125')](db[_0xaac4('0x106')],{'onDelete':_0xaac4('0x175')});db['WhatsappApplication']['belongsTo'](db[_0xaac4('0x83')],{'onDelete':_0xaac4('0x175'),'foreignKey':'IntervalId'});db[_0xaac4('0x108')]['belongsTo'](db[_0xaac4('0x8d')],{'onDelete':_0xaac4('0x175'),'foreignKey':_0xaac4('0x177')});db[_0xaac4('0x124')][_0xaac4('0x119')](db[_0xaac4('0x1ea')],{'as':_0xaac4('0x156'),'onDelete':_0xaac4('0x117'),'foreignKey':_0xaac4('0x1ec')});db[_0xaac4('0x124')][_0xaac4('0x125')](db[_0xaac4('0x106')],{'as':_0xaac4('0x16c'),'foreignKey':'WhatsappAccountId'});db['WhatsappInteraction'][_0xaac4('0x125')](db[_0xaac4('0x75')],{'as':'Contact','foreignKey':_0xaac4('0x15d')});db['WhatsappInteraction'][_0xaac4('0x125')](db[_0xaac4('0x11')],{'as':_0xaac4('0x16d'),'foreignKey':_0xaac4('0x118')});db[_0xaac4('0x124')][_0xaac4('0x127')](db[_0xaac4('0x8d')],{'through':_0xaac4('0x1a9'),'as':_0xaac4('0x16f')});db['WhatsappInteraction'][_0xaac4('0x127')](db[_0xaac4('0x8d')],{'through':'whatsapp_interaction_has_tags','as':_0xaac4('0x170')});db['WhatsappInteraction'][_0xaac4('0x127')](db[_0xaac4('0x11')],{'as':_0xaac4('0x171'),'through':_0xaac4('0x132'),'foreignKey':_0xaac4('0x1ec')});db[_0xaac4('0x1ea')]['belongsTo'](db[_0xaac4('0x11')],{'as':_0xaac4('0x11')});db[_0xaac4('0x1ea')]['belongsTo'](db[_0xaac4('0x75')],{'onDelete':_0xaac4('0x117'),'as':_0xaac4('0x15c')});db[_0xaac4('0x1ea')][_0xaac4('0x125')](db[_0xaac4('0x124')],{'onDelete':'cascade','as':_0xaac4('0x173'),'foreignKey':_0xaac4('0x1ec')});db[_0xaac4('0x1ea')][_0xaac4('0x125')](db[_0xaac4('0x106')],{'as':_0xaac4('0x16c'),'foreignKey':_0xaac4('0x1e9')});db[_0xaac4('0x10c')][_0xaac4('0x125')](db[_0xaac4('0x106')],{});db[_0xaac4('0x10c')][_0xaac4('0x125')](db['CmList'],{'as':_0xaac4('0x164'),'foreignKey':_0xaac4('0x165')});db[_0xaac4('0x10c')][_0xaac4('0x125')](db[_0xaac4('0x75')],{'as':_0xaac4('0x15c'),'foreignKey':_0xaac4('0x15d')});db[_0xaac4('0x10c')][_0xaac4('0x125')](db[_0xaac4('0x124')],{});db[_0xaac4('0x10c')][_0xaac4('0x125')](db[_0xaac4('0x110')],{});db[_0xaac4('0x10c')][_0xaac4('0x125')](db[_0xaac4('0x1ea')],{});db[_0xaac4('0x10c')][_0xaac4('0x125')](db[_0xaac4('0x11')],{});db[_0xaac4('0x10e')]['belongsTo'](db[_0xaac4('0x1ea')],{});db[_0xaac4('0x10e')][_0xaac4('0x125')](db['WhatsappInteraction'],{});db[_0xaac4('0x10e')][_0xaac4('0x125')](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':_0xaac4('0x1d0')});db['WhatsappTransferReport'][_0xaac4('0x125')](db[_0xaac4('0x106')],{'foreignKey':'ToWhatsappAccountId','as':_0xaac4('0x1d7')});db['WhatsappTransferReport'][_0xaac4('0x125')](db[_0xaac4('0x110')],{'foreignKey':_0xaac4('0x1ed'),'as':_0xaac4('0x1d5')});db[_0xaac4('0x10e')]['belongsTo'](db[_0xaac4('0x11')],{'foreignKey':_0xaac4('0x1d1'),'as':_0xaac4('0x1d9')});db[_0xaac4('0x10e')][_0xaac4('0x125')](db[_0xaac4('0x11')],{'foreignKey':_0xaac4('0x1d2'),'as':_0xaac4('0x1d3')});db[_0xaac4('0x110')][_0xaac4('0x127')](db[_0xaac4('0x11')],{'as':'Agents','through':'UserWhatsappQueue','foreignKey':_0xaac4('0x1ee')});db[_0xaac4('0x110')][_0xaac4('0x127')](db[_0xaac4('0xe5')],{'through':_0xaac4('0x1c9'),'as':_0xaac4('0x153')});module[_0xaac4('0x1ef')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 2f480c3..b2162b1 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8266=['./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/fields','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','/api/migrations','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','./api/rpc','/api/version','./api/system','/api/pm2','./api/webbar','/apidoc','static','root','/www','join','/demo','/snippet','snippet','3.0.0','/plugins','route','sendFile','resolve','get','appPath','/index.html','username','newPassword','apiKey','firstName','lastName','street','phone','mobile','email','clientId','clientSecret','securityToken','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','pass','accountSid','localstationid','dsn','secret','oldPassword','isArray','replace','@@{','}@@','includes','lodash','util','./config/environment','api','auth','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','method','x-forwarded-for','headers','connection','remoteAddress','statusCode','responseTime','user','name','role','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','agent_name','url','./api/user','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/dials/reports','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','/api/chat/queues','/api/chat/groups'];(function(_0xd83966,_0x5b12f2){var _0x1a0794=function(_0x3c9823){while(--_0x3c9823){_0xd83966['push'](_0xd83966['shift']());}};_0x1a0794(++_0x5b12f2);}(_0x8266,0xd4));var _0x6826=function(_0x26373a,_0x1741d7){_0x26373a=_0x26373a-0x0;var _0x39ee24=_0x8266[_0x26373a];return _0x39ee24;};'use strict';var _=require(_0x6826('0x0'));var path=require('path');var express=require('express');var ewinston=require('express-winston');var util=require(_0x6826('0x1'));var errors=require('./errors');var config=require(_0x6826('0x2'));var logger=require('./config/logger')(_0x6826('0x3'));var authLogger=require('./config/logger')(_0x6826('0x4'));exports['default']=function(_0x215ff7){_0x215ff7[_0x6826('0x5')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x314592,_0x44104a){var _0x4785ef=_0x6826('0x6');if(!_[_0x6826('0x7')](_0x314592[_0x6826('0x8')])){_0x4785ef+=_0x6826('0x9');var _0x23dfdc=_0x314592[_0x6826('0x8')];maskSensitiveData(_0x23dfdc);}return util['format'](_0x4785ef,_0x314592[_0x6826('0xa')],_0x314592['headers'][_0x6826('0xb')]?_0x314592[_0x6826('0xc')]['x-forwarded-for']:_0x314592[_0x6826('0xd')][_0x6826('0xe')]||_0x314592['ip'],_0x314592['url'],_0x44104a[_0x6826('0xf')],_0x44104a[_0x6826('0x10')],_0x314592[_0x6826('0x11')]?_0x314592[_0x6826('0x11')]['id']:null,_0x314592['user']?_0x314592['user'][_0x6826('0x12')]:null,_0x314592[_0x6826('0x11')]?_0x314592[_0x6826('0x11')][_0x6826('0x13')]:null,_0x23dfdc?util['inspect'](_0x23dfdc,![],null):'');}}));_0x215ff7[_0x6826('0x5')](ewinston[_0x6826('0x14')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x4bc41e,_0x9b7c46){var _0x1488f4=_0x6826('0x15');if(_0x4bc41e[_0x6826('0x8')]&&_0x4bc41e['body'][_0x6826('0x16')]&&_0x4bc41e[_0x6826('0x8')][_0x6826('0x17')]){_0x1488f4=_0x6826('0x18');}return util['format'](_0x1488f4,_0x4bc41e[_0x6826('0xa')],_0x4bc41e[_0x6826('0xc')][_0x6826('0xb')]?_0x4bc41e[_0x6826('0xc')]['x-forwarded-for']:_0x4bc41e[_0x6826('0xd')]['remoteAddress']||_0x4bc41e['ip'],_0x4bc41e['url'],_0x9b7c46[_0x6826('0xf')],_0x9b7c46[_0x6826('0x10')],_0x4bc41e['user']?_0x4bc41e['user']['id']:null,_0x4bc41e['user']?_0x4bc41e[_0x6826('0x11')][_0x6826('0x12')]:null,_0x4bc41e[_0x6826('0x11')]?_0x4bc41e[_0x6826('0x11')][_0x6826('0x13')]:null,_0x4bc41e[_0x6826('0x8')]&&_0x4bc41e[_0x6826('0x8')]['device']?_0x4bc41e['body'][_0x6826('0x16')]:'other',_0x4bc41e[_0x6826('0x8')]&&_0x4bc41e[_0x6826('0x8')][_0x6826('0x17')]?_0x4bc41e[_0x6826('0x8')]['agent_id']:'',_0x4bc41e['body']&&_0x4bc41e[_0x6826('0x8')][_0x6826('0x19')]?_0x4bc41e[_0x6826('0x8')][_0x6826('0x19')]:'');},'ignoreRoute':function(_0x45fb1c){var _0x5096ef=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5096ef['test'](_0x45fb1c[_0x6826('0x1a')]);}}));_0x215ff7[_0x6826('0x5')]('/api/users',require(_0x6826('0x1b')));_0x215ff7[_0x6826('0x5')]('/api/voice/chanspy',require(_0x6826('0x1c')));_0x215ff7[_0x6826('0x5')]('/api/voice/contexts',require(_0x6826('0x1d')));_0x215ff7['use'](_0x6826('0x1e'),require(_0x6826('0x1f')));_0x215ff7[_0x6826('0x5')](_0x6826('0x20'),require('./api/voiceMusicOnHold'));_0x215ff7[_0x6826('0x5')]('/api/voice/queues',require('./api/voiceQueue'));_0x215ff7['use'](_0x6826('0x21'),require(_0x6826('0x22')));_0x215ff7[_0x6826('0x5')](_0x6826('0x23'),require(_0x6826('0x24')));_0x215ff7[_0x6826('0x5')](_0x6826('0x25'),require('./api/voiceMail'));_0x215ff7[_0x6826('0x5')]('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x215ff7['use']('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x215ff7[_0x6826('0x5')](_0x6826('0x26'),require('./api/voiceDialReport'));_0x215ff7['use'](_0x6826('0x27'),require('./api/voiceAgentReport'));_0x215ff7[_0x6826('0x5')](_0x6826('0x28'),require(_0x6826('0x29')));_0x215ff7[_0x6826('0x5')](_0x6826('0x2a'),require(_0x6826('0x2b')));_0x215ff7[_0x6826('0x5')](_0x6826('0x2c'),require(_0x6826('0x2d')));_0x215ff7[_0x6826('0x5')]('/api/voice/transfers/reports',require(_0x6826('0x2e')));_0x215ff7['use'](_0x6826('0x2f'),require(_0x6826('0x30')));_0x215ff7[_0x6826('0x5')](_0x6826('0x31'),require(_0x6826('0x32')));_0x215ff7[_0x6826('0x5')]('/api/mail/queues',require(_0x6826('0x33')));_0x215ff7[_0x6826('0x5')]('/api/mail/substatuses',require('./api/mailSubstatus'));_0x215ff7[_0x6826('0x5')]('/api/mail/interactions',require(_0x6826('0x34')));_0x215ff7[_0x6826('0x5')](_0x6826('0x35'),require(_0x6826('0x36')));_0x215ff7[_0x6826('0x5')]('/api/mail/applications',require(_0x6826('0x37')));_0x215ff7['use'](_0x6826('0x38'),require('./api/mailQueueReport'));_0x215ff7[_0x6826('0x5')](_0x6826('0x39'),require('./api/dashboard'));_0x215ff7['use'](_0x6826('0x3a'),require(_0x6826('0x3b')));_0x215ff7[_0x6826('0x5')]('/api/fax/accounts',require(_0x6826('0x3c')));_0x215ff7[_0x6826('0x5')](_0x6826('0x3d'),require(_0x6826('0x3e')));_0x215ff7[_0x6826('0x5')]('/api/fax/interactions',require(_0x6826('0x3f')));_0x215ff7['use']('/api/fax/messages',require(_0x6826('0x40')));_0x215ff7['use'](_0x6826('0x41'),require('./api/faxQueue'));_0x215ff7['use']('/api/fax/reports/queue',require(_0x6826('0x42')));_0x215ff7[_0x6826('0x5')](_0x6826('0x43'),require(_0x6826('0x44')));_0x215ff7[_0x6826('0x5')]('/api/sms/applications',require(_0x6826('0x45')));_0x215ff7['use']('/api/sms/interactions',require(_0x6826('0x46')));_0x215ff7[_0x6826('0x5')](_0x6826('0x47'),require('./api/smsMessage'));_0x215ff7[_0x6826('0x5')]('/api/sms/queues',require(_0x6826('0x48')));_0x215ff7[_0x6826('0x5')](_0x6826('0x49'),require(_0x6826('0x4a')));_0x215ff7[_0x6826('0x5')](_0x6826('0x4b'),require(_0x6826('0x4c')));_0x215ff7[_0x6826('0x5')](_0x6826('0x4d'),require(_0x6826('0x4e')));_0x215ff7['use'](_0x6826('0x4f'),require(_0x6826('0x50')));_0x215ff7['use'](_0x6826('0x51'),require(_0x6826('0x52')));_0x215ff7['use'](_0x6826('0x53'),require(_0x6826('0x54')));_0x215ff7[_0x6826('0x5')](_0x6826('0x55'),require(_0x6826('0x56')));_0x215ff7['use'](_0x6826('0x57'),require(_0x6826('0x58')));_0x215ff7[_0x6826('0x5')]('/api/chat/interactions',require(_0x6826('0x59')));_0x215ff7[_0x6826('0x5')](_0x6826('0x5a'),require('./api/chatMessage'));_0x215ff7[_0x6826('0x5')](_0x6826('0x5b'),require('./api/chatOfflineMessage'));_0x215ff7[_0x6826('0x5')](_0x6826('0x5c'),require('./api/chatQueue'));_0x215ff7[_0x6826('0x5')](_0x6826('0x5d'),require(_0x6826('0x5e')));_0x215ff7[_0x6826('0x5')](_0x6826('0x5f'),require(_0x6826('0x60')));_0x215ff7['use']('/api/cm/companies',require(_0x6826('0x61')));_0x215ff7[_0x6826('0x5')](_0x6826('0x62'),require('./api/cmContact'));_0x215ff7[_0x6826('0x5')](_0x6826('0x63'),require('./api/cmHopper'));_0x215ff7['use'](_0x6826('0x64'),require(_0x6826('0x65')));_0x215ff7[_0x6826('0x5')](_0x6826('0x66'),require(_0x6826('0x67')));_0x215ff7['use']('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0x215ff7[_0x6826('0x5')]('/api/cm/custom_fields',require(_0x6826('0x68')));_0x215ff7['use'](_0x6826('0x69'),require(_0x6826('0x6a')));_0x215ff7[_0x6826('0x5')](_0x6826('0x6b'),require('./api/automation'));_0x215ff7['use']('/api/canned_answers',require(_0x6826('0x6c')));_0x215ff7[_0x6826('0x5')](_0x6826('0x6d'),require('./api/disposition'));_0x215ff7[_0x6826('0x5')](_0x6826('0x6e'),require(_0x6826('0x6f')));_0x215ff7[_0x6826('0x5')](_0x6826('0x70'),require(_0x6826('0x71')));_0x215ff7[_0x6826('0x5')](_0x6826('0x72'),require(_0x6826('0x73')));_0x215ff7[_0x6826('0x5')]('/api/cdr',require(_0x6826('0x74')));_0x215ff7['use'](_0x6826('0x75'),require('./api/voiceQueuesLog'));_0x215ff7['use'](_0x6826('0x76'),require(_0x6826('0x77')));_0x215ff7[_0x6826('0x5')]('/api/sounds',require(_0x6826('0x78')));_0x215ff7[_0x6826('0x5')](_0x6826('0x79'),require(_0x6826('0x7a')));_0x215ff7[_0x6826('0x5')](_0x6826('0x7b'),require(_0x6826('0x7c')));_0x215ff7['use'](_0x6826('0x7d'),require(_0x6826('0x7e')));_0x215ff7[_0x6826('0x5')]('/api/variables',require(_0x6826('0x7f')));_0x215ff7['use'](_0x6826('0x80'),require(_0x6826('0x81')));_0x215ff7[_0x6826('0x5')](_0x6826('0x82'),require(_0x6826('0x83')));_0x215ff7[_0x6826('0x5')](_0x6826('0x84'),require(_0x6826('0x85')));_0x215ff7[_0x6826('0x5')]('/api/analytics/default_reports',require(_0x6826('0x86')));_0x215ff7[_0x6826('0x5')](_0x6826('0x87'),require(_0x6826('0x88')));_0x215ff7['use'](_0x6826('0x89'),require(_0x6826('0x8a')));_0x215ff7[_0x6826('0x5')]('/api/analytics/field_reports',require(_0x6826('0x8b')));_0x215ff7[_0x6826('0x5')](_0x6826('0x8c'),require(_0x6826('0x8d')));_0x215ff7['use']('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0x215ff7['use']('/api/integrations/salesforce/configurations',require(_0x6826('0x8e')));_0x215ff7[_0x6826('0x5')]('/api/integrations/salesforce/fields',require(_0x6826('0x8f')));_0x215ff7[_0x6826('0x5')](_0x6826('0x90'),require(_0x6826('0x91')));_0x215ff7[_0x6826('0x5')](_0x6826('0x92'),require(_0x6826('0x93')));_0x215ff7['use'](_0x6826('0x94'),require(_0x6826('0x95')));_0x215ff7[_0x6826('0x5')]('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x215ff7[_0x6826('0x5')]('/api/integrations/desk/configurations',require(_0x6826('0x96')));_0x215ff7[_0x6826('0x5')](_0x6826('0x97'),require(_0x6826('0x98')));_0x215ff7[_0x6826('0x5')]('/api/integrations/zoho/accounts',require('./api/intZohoAccount'));_0x215ff7[_0x6826('0x5')](_0x6826('0x99'),require(_0x6826('0x9a')));_0x215ff7[_0x6826('0x5')](_0x6826('0x9b'),require('./api/intZohoField'));_0x215ff7[_0x6826('0x5')](_0x6826('0x9c'),require(_0x6826('0x9d')));_0x215ff7[_0x6826('0x5')](_0x6826('0x9e'),require(_0x6826('0x9f')));_0x215ff7[_0x6826('0x5')]('/api/integrations/zendesk/fields',require(_0x6826('0xa0')));_0x215ff7[_0x6826('0x5')]('/api/integrations/freshdesk/accounts',require(_0x6826('0xa1')));_0x215ff7['use'](_0x6826('0xa2'),require('./api/intFreshdeskConfiguration'));_0x215ff7[_0x6826('0x5')](_0x6826('0xa3'),require(_0x6826('0xa4')));_0x215ff7[_0x6826('0x5')]('/api/integrations/vtiger/accounts',require(_0x6826('0xa5')));_0x215ff7['use'](_0x6826('0xa6'),require(_0x6826('0xa7')));_0x215ff7[_0x6826('0x5')]('/api/integrations/vtiger/fields',require(_0x6826('0xa8')));_0x215ff7[_0x6826('0x5')]('/api/integrations/servicenow/accounts',require(_0x6826('0xa9')));_0x215ff7[_0x6826('0x5')]('/api/integrations/servicenow/configurations',require(_0x6826('0xaa')));_0x215ff7[_0x6826('0x5')](_0x6826('0xab'),require(_0x6826('0xac')));_0x215ff7[_0x6826('0x5')](_0x6826('0xad'),require('./api/intDynamics365Account'));_0x215ff7['use'](_0x6826('0xae'),require(_0x6826('0xaf')));_0x215ff7['use'](_0x6826('0xb0'),require(_0x6826('0xb1')));_0x215ff7[_0x6826('0x5')](_0x6826('0xb2'),require(_0x6826('0xb3')));_0x215ff7[_0x6826('0x5')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x215ff7[_0x6826('0x5')](_0x6826('0xb4'),require('./api/intFreshsalesField'));_0x215ff7[_0x6826('0x5')]('/api/networks',require(_0x6826('0xb5')));_0x215ff7['use']('/api/chat/reports/queue',require(_0x6826('0xb6')));_0x215ff7[_0x6826('0x5')](_0x6826('0xb7'),require(_0x6826('0xb8')));_0x215ff7[_0x6826('0x5')](_0x6826('0xb9'),require('./api/jscriptyAnswerReport'));_0x215ff7['use'](_0x6826('0xba'),require(_0x6826('0xbb')));_0x215ff7['use'](_0x6826('0xbc'),require('./api/jscriptySessionReport'));_0x215ff7[_0x6826('0x5')](_0x6826('0xbd'),require(_0x6826('0xbe')));_0x215ff7[_0x6826('0x5')]('/api/square/reports',require('./api/squareReport'));_0x215ff7[_0x6826('0x5')](_0x6826('0xbf'),require('./api/squareReportDetail'));_0x215ff7[_0x6826('0x5')](_0x6826('0xc0'),require(_0x6826('0xc1')));_0x215ff7[_0x6826('0x5')](_0x6826('0xc2'),require(_0x6826('0xc3')));_0x215ff7[_0x6826('0x5')](_0x6826('0xc4'),require(_0x6826('0xc5')));_0x215ff7[_0x6826('0x5')](_0x6826('0xc6'),require(_0x6826('0xc7')));_0x215ff7[_0x6826('0x5')]('/api/square/recordings',require(_0x6826('0xc8')));_0x215ff7[_0x6826('0x5')](_0x6826('0xc9'),require(_0x6826('0xca')));_0x215ff7['use'](_0x6826('0xcb'),require(_0x6826('0xcc')));_0x215ff7[_0x6826('0x5')](_0x6826('0xcd'),require('./api/license'));_0x215ff7[_0x6826('0x5')]('/api/campaigns',require('./api/campaign'));_0x215ff7[_0x6826('0x5')](_0x6826('0xce'),require('./api/migration'));_0x215ff7[_0x6826('0x5')]('/api/attachments',require(_0x6826('0xcf')));_0x215ff7[_0x6826('0x5')](_0x6826('0xd0'),require(_0x6826('0xd1')));_0x215ff7[_0x6826('0x5')](_0x6826('0xd2'),require(_0x6826('0xd3')));_0x215ff7[_0x6826('0x5')](_0x6826('0xd4'),require(_0x6826('0xd5')));_0x215ff7['use'](_0x6826('0xd6'),require('./api/faxTransferReport'));_0x215ff7[_0x6826('0x5')](_0x6826('0xd7'),require('./api/openchannelTransferReport'));_0x215ff7[_0x6826('0x5')](_0x6826('0xd8'),require('./api/smsTransferReport'));_0x215ff7['use'](_0x6826('0xd9'),require(_0x6826('0xda')));_0x215ff7[_0x6826('0x5')](_0x6826('0xdb'),require(_0x6826('0xdc')));_0x215ff7[_0x6826('0x5')](_0x6826('0xdd'),require(_0x6826('0xde')));_0x215ff7[_0x6826('0x5')]('/api/userProfile/sections',require(_0x6826('0xdf')));_0x215ff7[_0x6826('0x5')](_0x6826('0xe0'),require('./api/userProfileResource'));_0x215ff7[_0x6826('0x5')](_0x6826('0xe1'),require('./api/userNotification'));_0x215ff7[_0x6826('0x5')]('/api/whatsapp/accounts',require(_0x6826('0xe2')));_0x215ff7[_0x6826('0x5')](_0x6826('0xe3'),require(_0x6826('0xe4')));_0x215ff7[_0x6826('0x5')]('/api/whatsapp/interactions',require(_0x6826('0xe5')));_0x215ff7[_0x6826('0x5')](_0x6826('0xe6'),require('./api/whatsappMessage'));_0x215ff7[_0x6826('0x5')](_0x6826('0xe7'),require('./api/whatsappQueueReport'));_0x215ff7[_0x6826('0x5')](_0x6826('0xe8'),require(_0x6826('0xe9')));_0x215ff7[_0x6826('0x5')](_0x6826('0xea'),require(_0x6826('0xeb')));_0x215ff7['use']('/api/cloudProviders',require(_0x6826('0xec')));_0x215ff7[_0x6826('0x5')](_0x6826('0xed'),require('./api/realtime'));_0x215ff7['use'](_0x6826('0xee'),require(_0x6826('0xef')));_0x215ff7[_0x6826('0x5')](_0x6826('0xf0'),require(_0x6826('0xf1')));_0x215ff7['use'](_0x6826('0xf2'),require(_0x6826('0xf3')));_0x215ff7[_0x6826('0x5')]('/api/rpc',require(_0x6826('0xf4')));_0x215ff7[_0x6826('0x5')](_0x6826('0xf5'),require('./api/version'));_0x215ff7[_0x6826('0x5')]('/api/system',require(_0x6826('0xf6')));_0x215ff7[_0x6826('0x5')](_0x6826('0xf7'),require('./api/pm2'));_0x215ff7[_0x6826('0x5')]('/api/webbar',require(_0x6826('0xf8')));_0x215ff7[_0x6826('0x5')](_0x6826('0xf9'),express[_0x6826('0xfa')](path['join'](config[_0x6826('0xfb')],_0x6826('0xf9'))));_0x215ff7[_0x6826('0x5')](_0x6826('0xfc'),express[_0x6826('0xfa')](path[_0x6826('0xfd')](config[_0x6826('0xfb')],'/www')));_0x215ff7[_0x6826('0x5')]('/demo',express[_0x6826('0xfa')](path[_0x6826('0xfd')](config[_0x6826('0xfb')],_0x6826('0xfe'))));_0x215ff7[_0x6826('0x5')](_0x6826('0xff'),express[_0x6826('0xfa')](path[_0x6826('0xfd')](config[_0x6826('0xfb')],_0x6826('0x100'),_0x6826('0x101'))));_0x215ff7[_0x6826('0x5')](_0x6826('0x102'),express['static'](path['join'](config[_0x6826('0xfb')],'/server/files/plugins')));_0x215ff7[_0x6826('0x103')]('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x215ff7[_0x6826('0x103')]('/*')['get'](function(_0x4fadf8,_0x5d2df2){_0x5d2df2[_0x6826('0x104')](path[_0x6826('0x105')](_0x215ff7[_0x6826('0x106')](_0x6826('0x107'))+_0x6826('0x108')));});};var sensitiveFields=[_0x6826('0x109'),'password',_0x6826('0x10a'),_0x6826('0x10b'),_0x6826('0x10c'),_0x6826('0x10d'),_0x6826('0x10e'),_0x6826('0x10f'),_0x6826('0x110'),'fax',_0x6826('0x111'),_0x6826('0x112'),_0x6826('0x113'),_0x6826('0x114'),'code',_0x6826('0x115'),_0x6826('0x116'),_0x6826('0x117'),_0x6826('0x118'),_0x6826('0x119'),_0x6826('0x11a'),_0x6826('0x11b'),_0x6826('0x11c'),_0x6826('0x11d'),_0x6826('0x11e'),_0x6826('0x11f'),_0x6826('0x120'),_0x6826('0x121'),_0x6826('0x122'),_0x6826('0x123'),_0x6826('0x124'),_0x6826('0x125'),_0x6826('0x126'),'key','user',_0x6826('0x127'),_0x6826('0x128'),_0x6826('0x129'),_0x6826('0x12a'),_0x6826('0x12b'),'registry',_0x6826('0x12c')];function maskSensitiveData(_0x47e8b7){var _0x633df2=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x47e8b7))return;for(var _0x2c25ef in _0x47e8b7){if(_[_0x6826('0x12d')](_0x47e8b7[_0x2c25ef])){for(var _0x3ccdbd=0x0;_0x3ccdbd<_0x47e8b7[_0x2c25ef]['length'];_0x3ccdbd++){maskSensitiveData(_0x47e8b7[_0x2c25ef][_0x3ccdbd]);}}else if(_['isPlainObject'](_0x47e8b7[_0x2c25ef])){maskSensitiveData(_0x47e8b7[_0x2c25ef]);}else if(_['isString'](_0x47e8b7[_0x2c25ef])){_0x47e8b7[_0x2c25ef]=_0x47e8b7[_0x2c25ef][_0x6826('0x12e')](/{{{/g,_0x6826('0x12f'))[_0x6826('0x12e')](/}}}/g,_0x6826('0x130'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x6826('0x131')](sensitiveFields,_0x2c25ef)){_0x47e8b7[_0x2c25ef]=_0x47e8b7[_0x2c25ef][_0x6826('0x12e')](_0x633df2,'*');}}}} \ No newline at end of file +var _0x9ca3=['/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/auth/local','./api/authLocal','/api/jira','/api/rpc','./api/rpc','/api/version','/api/system','./api/system','./api/pm2','./api/webbar','/apidoc','static','/www','root','join','snippet','3.0.0','/plugins','route','get','sendFile','resolve','appPath','/index.html','username','password','newPassword','apiKey','firstName','lastName','phone','fax','email','clientId','clientSecret','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','secretaccesskey','key','pass','accountSid','localstationid','secret','registry','isPlainObject','length','isString','replace','lodash','path','express','express-winston','util','./errors','./config/environment','./config/logger','api','auth','use','logger','body','\x20body=%s','format','headers','x-forwarded-for','remoteAddress','url','statusCode','user','name','inspect','%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)','connection','role','device','other','agent_name','test','/api/users','./api/user','/api/voice/contexts','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxApplication','/api/fax/interactions','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','./api/smsInteraction','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields'];(function(_0x553ca1,_0x365c31){var _0x3057af=function(_0x5d0a97){while(--_0x5d0a97){_0x553ca1['push'](_0x553ca1['shift']());}};_0x3057af(++_0x365c31);}(_0x9ca3,0x1c4));var _0x39ca=function(_0x2ec1af,_0x4d9baa){_0x2ec1af=_0x2ec1af-0x0;var _0x45cbb6=_0x9ca3[_0x2ec1af];return _0x45cbb6;};'use strict';var _=require(_0x39ca('0x0'));var path=require(_0x39ca('0x1'));var express=require(_0x39ca('0x2'));var ewinston=require(_0x39ca('0x3'));var util=require(_0x39ca('0x4'));var errors=require(_0x39ca('0x5'));var config=require(_0x39ca('0x6'));var logger=require(_0x39ca('0x7'))(_0x39ca('0x8'));var authLogger=require(_0x39ca('0x7'))(_0x39ca('0x9'));exports['default']=function(_0x161a0c){_0x161a0c[_0x39ca('0xa')](ewinston[_0x39ca('0xb')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0xeba250,_0x55f15b){var _0x3eb698='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_['isEmpty'](_0xeba250[_0x39ca('0xc')])){_0x3eb698+=_0x39ca('0xd');var _0x2396ae=_0xeba250['body'];maskSensitiveData(_0x2396ae);}return util[_0x39ca('0xe')](_0x3eb698,_0xeba250['method'],_0xeba250[_0x39ca('0xf')][_0x39ca('0x10')]?_0xeba250[_0x39ca('0xf')][_0x39ca('0x10')]:_0xeba250['connection'][_0x39ca('0x11')]||_0xeba250['ip'],_0xeba250[_0x39ca('0x12')],_0x55f15b[_0x39ca('0x13')],_0x55f15b['responseTime'],_0xeba250[_0x39ca('0x14')]?_0xeba250[_0x39ca('0x14')]['id']:null,_0xeba250[_0x39ca('0x14')]?_0xeba250['user'][_0x39ca('0x15')]:null,_0xeba250[_0x39ca('0x14')]?_0xeba250[_0x39ca('0x14')]['role']:null,_0x2396ae?util[_0x39ca('0x16')](_0x2396ae,![],null):'');}}));_0x161a0c[_0x39ca('0xa')](ewinston[_0x39ca('0xb')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x2c515b,_0x3ee843){var _0x3e0f1c=_0x39ca('0x17');if(_0x2c515b['body']&&_0x2c515b[_0x39ca('0xc')]['device']&&_0x2c515b['body'][_0x39ca('0x18')]){_0x3e0f1c=_0x39ca('0x19');}return util[_0x39ca('0xe')](_0x3e0f1c,_0x2c515b['method'],_0x2c515b['headers'][_0x39ca('0x10')]?_0x2c515b[_0x39ca('0xf')][_0x39ca('0x10')]:_0x2c515b[_0x39ca('0x1a')][_0x39ca('0x11')]||_0x2c515b['ip'],_0x2c515b[_0x39ca('0x12')],_0x3ee843[_0x39ca('0x13')],_0x3ee843['responseTime'],_0x2c515b[_0x39ca('0x14')]?_0x2c515b[_0x39ca('0x14')]['id']:null,_0x2c515b[_0x39ca('0x14')]?_0x2c515b[_0x39ca('0x14')][_0x39ca('0x15')]:null,_0x2c515b[_0x39ca('0x14')]?_0x2c515b['user'][_0x39ca('0x1b')]:null,_0x2c515b['body']&&_0x2c515b[_0x39ca('0xc')][_0x39ca('0x1c')]?_0x2c515b[_0x39ca('0xc')][_0x39ca('0x1c')]:_0x39ca('0x1d'),_0x2c515b[_0x39ca('0xc')]&&_0x2c515b[_0x39ca('0xc')][_0x39ca('0x18')]?_0x2c515b[_0x39ca('0xc')][_0x39ca('0x18')]:'',_0x2c515b[_0x39ca('0xc')]&&_0x2c515b[_0x39ca('0xc')][_0x39ca('0x1e')]?_0x2c515b[_0x39ca('0xc')]['agent_name']:'');},'ignoreRoute':function(_0x98a88b){var _0x141a59=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x141a59[_0x39ca('0x1f')](_0x98a88b['url']);}}));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x20'),require(_0x39ca('0x21')));_0x161a0c[_0x39ca('0xa')]('/api/voice/chanspy',require('./api/voiceChanSpy'));_0x161a0c['use'](_0x39ca('0x22'),require('./api/voiceContext'));_0x161a0c[_0x39ca('0xa')]('/api/voice/extensions',require(_0x39ca('0x23')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x24'),require(_0x39ca('0x25')));_0x161a0c[_0x39ca('0xa')]('/api/voice/queues',require('./api/voiceQueue'));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x26'),require(_0x39ca('0x27')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x28'),require(_0x39ca('0x29')));_0x161a0c[_0x39ca('0xa')]('/api/voice/mails',require(_0x39ca('0x2a')));_0x161a0c[_0x39ca('0xa')]('/api/voice/mails/messages',require(_0x39ca('0x2b')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x2c'),require(_0x39ca('0x2d')));_0x161a0c['use'](_0x39ca('0x2e'),require('./api/voiceDialReport'));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x2f'),require('./api/voiceAgentReport'));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x30'),require(_0x39ca('0x31')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x32'),require(_0x39ca('0x33')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x34'),require(_0x39ca('0x35')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x36'),require(_0x39ca('0x37')));_0x161a0c[_0x39ca('0xa')]('/api/mail/out_servers',require(_0x39ca('0x38')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x39'),require('./api/mailAccount'));_0x161a0c[_0x39ca('0xa')]('/api/mail/queues',require(_0x39ca('0x3a')));_0x161a0c[_0x39ca('0xa')]('/api/mail/substatuses',require(_0x39ca('0x3b')));_0x161a0c['use'](_0x39ca('0x3c'),require(_0x39ca('0x3d')));_0x161a0c['use'](_0x39ca('0x3e'),require('./api/mailMessage'));_0x161a0c['use'](_0x39ca('0x3f'),require(_0x39ca('0x40')));_0x161a0c['use']('/api/mail/reports/queue',require(_0x39ca('0x41')));_0x161a0c['use'](_0x39ca('0x42'),require(_0x39ca('0x43')));_0x161a0c['use'](_0x39ca('0x44'),require(_0x39ca('0x45')));_0x161a0c[_0x39ca('0xa')]('/api/fax/accounts',require('./api/faxAccount'));_0x161a0c[_0x39ca('0xa')]('/api/fax/applications',require(_0x39ca('0x46')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x47'),require('./api/faxInteraction'));_0x161a0c[_0x39ca('0xa')]('/api/fax/messages',require('./api/faxMessage'));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x48'),require(_0x39ca('0x49')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x4a'),require(_0x39ca('0x4b')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x4c'),require(_0x39ca('0x4d')));_0x161a0c[_0x39ca('0xa')]('/api/sms/applications',require(_0x39ca('0x4e')));_0x161a0c[_0x39ca('0xa')]('/api/sms/interactions',require(_0x39ca('0x4f')));_0x161a0c['use']('/api/sms/messages',require(_0x39ca('0x50')));_0x161a0c[_0x39ca('0xa')]('/api/sms/queues',require(_0x39ca('0x51')));_0x161a0c['use'](_0x39ca('0x52'),require(_0x39ca('0x53')));_0x161a0c[_0x39ca('0xa')]('/api/openchannel/applications',require('./api/openchannelApplication'));_0x161a0c['use'](_0x39ca('0x54'),require(_0x39ca('0x55')));_0x161a0c['use'](_0x39ca('0x56'),require(_0x39ca('0x57')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x58'),require(_0x39ca('0x59')));_0x161a0c['use'](_0x39ca('0x5a'),require(_0x39ca('0x5b')));_0x161a0c['use'](_0x39ca('0x5c'),require(_0x39ca('0x5d')));_0x161a0c[_0x39ca('0xa')]('/api/chat/applications',require('./api/chatApplication'));_0x161a0c['use']('/api/chat/interactions',require(_0x39ca('0x5e')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x5f'),require(_0x39ca('0x60')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x61'),require(_0x39ca('0x62')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x63'),require(_0x39ca('0x64')));_0x161a0c[_0x39ca('0xa')]('/api/chat/groups',require(_0x39ca('0x65')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x66'),require(_0x39ca('0x67')));_0x161a0c[_0x39ca('0xa')]('/api/cm/companies',require(_0x39ca('0x68')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x69'),require('./api/cmContact'));_0x161a0c[_0x39ca('0xa')]('/api/cm/hopper',require(_0x39ca('0x6a')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x6b'),require(_0x39ca('0x6c')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x6d'),require('./api/cmHopperFinal'));_0x161a0c['use'](_0x39ca('0x6e'),require('./api/cmHopperHistory'));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x6f'),require(_0x39ca('0x70')));_0x161a0c['use'](_0x39ca('0x71'),require(_0x39ca('0x72')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x73'),require(_0x39ca('0x74')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x75'),require(_0x39ca('0x76')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x77'),require(_0x39ca('0x78')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x79'),require(_0x39ca('0x7a')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x7b'),require(_0x39ca('0x7c')));_0x161a0c['use']('/api/pauses',require(_0x39ca('0x7d')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x7e'),require('./api/cdr'));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x7f'),require('./api/voiceQueuesLog'));_0x161a0c[_0x39ca('0xa')]('/api/schedules',require(_0x39ca('0x80')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x81'),require(_0x39ca('0x82')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x83'),require(_0x39ca('0x84')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x85'),require(_0x39ca('0x86')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x87'),require(_0x39ca('0x88')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x89'),require(_0x39ca('0x8a')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x8b'),require(_0x39ca('0x8c')));_0x161a0c[_0x39ca('0xa')]('/api/integrations/reports',require('./api/integrationReport'));_0x161a0c['use'](_0x39ca('0x8d'),require(_0x39ca('0x8e')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x8f'),require(_0x39ca('0x90')));_0x161a0c['use'](_0x39ca('0x91'),require(_0x39ca('0x92')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x93'),require(_0x39ca('0x94')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x95'),require('./api/analyticFieldReport'));_0x161a0c[_0x39ca('0xa')]('/api/analytics/tree_reports',require(_0x39ca('0x96')));_0x161a0c['use'](_0x39ca('0x97'),require(_0x39ca('0x98')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x99'),require('./api/intSalesforceConfiguration'));_0x161a0c['use'](_0x39ca('0x9a'),require('./api/intSalesforceField'));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x9b'),require('./api/intSugarcrmAccount'));_0x161a0c['use']('/api/integrations/sugarcrm/configurations',require(_0x39ca('0x9c')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x9d'),require('./api/intSugarcrmField'));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x9e'),require(_0x39ca('0x9f')));_0x161a0c[_0x39ca('0xa')]('/api/integrations/desk/configurations',require(_0x39ca('0xa0')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xa1'),require(_0x39ca('0xa2')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xa3'),require(_0x39ca('0xa4')));_0x161a0c['use'](_0x39ca('0xa5'),require(_0x39ca('0xa6')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xa7'),require(_0x39ca('0xa8')));_0x161a0c['use'](_0x39ca('0xa9'),require('./api/intZendeskAccount'));_0x161a0c['use'](_0x39ca('0xaa'),require('./api/intZendeskConfiguration'));_0x161a0c['use'](_0x39ca('0xab'),require(_0x39ca('0xac')));_0x161a0c['use']('/api/integrations/freshdesk/accounts',require(_0x39ca('0xad')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xae'),require(_0x39ca('0xaf')));_0x161a0c[_0x39ca('0xa')]('/api/integrations/freshdesk/fields',require('./api/intFreshdeskField'));_0x161a0c['use'](_0x39ca('0xb0'),require(_0x39ca('0xb1')));_0x161a0c['use'](_0x39ca('0xb2'),require('./api/intVtigerConfiguration'));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xb3'),require(_0x39ca('0xb4')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xb5'),require('./api/intServicenowAccount'));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xb6'),require('./api/intServicenowConfiguration'));_0x161a0c['use'](_0x39ca('0xb7'),require('./api/intServicenowField'));_0x161a0c['use'](_0x39ca('0xb8'),require(_0x39ca('0xb9')));_0x161a0c[_0x39ca('0xa')]('/api/integrations/dynamics365/configurations',require(_0x39ca('0xba')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xbb'),require(_0x39ca('0xbc')));_0x161a0c[_0x39ca('0xa')]('/api/integrations/freshsales/accounts',require(_0x39ca('0xbd')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xbe'),require(_0x39ca('0xbf')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xc0'),require(_0x39ca('0xc1')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xc2'),require(_0x39ca('0xc3')));_0x161a0c['use'](_0x39ca('0xc4'),require(_0x39ca('0xc5')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xc6'),require(_0x39ca('0xc7')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xc8'),require(_0x39ca('0xc9')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xca'),require('./api/jscriptyQuestionReport'));_0x161a0c['use']('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xcb'),require(_0x39ca('0xcc')));_0x161a0c['use']('/api/square/reports',require(_0x39ca('0xcd')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xce'),require(_0x39ca('0xcf')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xd0'),require('./api/jscriptyProject'));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xd1'),require(_0x39ca('0xd2')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xd3'),require('./api/squareOdbc'));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xd4'),require('./api/squareProject'));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xd5'),require('./api/squareRecording'));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xd6'),require(_0x39ca('0xd7')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xd8'),require('./api/team'));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xd9'),require(_0x39ca('0xda')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xdb'),require(_0x39ca('0xdc')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xdd'),require('./api/migration'));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xde'),require('./api/attachment'));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xdf'),require(_0x39ca('0xe0')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xe1'),require('./api/mailTransferReport'));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xe2'),require(_0x39ca('0xe3')));_0x161a0c[_0x39ca('0xa')]('/api/fax/reports/transfer',require(_0x39ca('0xe4')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xe5'),require(_0x39ca('0xe6')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xe7'),require('./api/smsTransferReport'));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xe8'),require(_0x39ca('0xe9')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xea'),require(_0x39ca('0xeb')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xec'),require('./api/userProfile'));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xed'),require(_0x39ca('0xee')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xef'),require(_0x39ca('0xf0')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xf1'),require('./api/userNotification'));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xf2'),require(_0x39ca('0xf3')));_0x161a0c['use']('/api/whatsapp/applications',require(_0x39ca('0xf4')));_0x161a0c[_0x39ca('0xa')]('/api/whatsapp/interactions',require(_0x39ca('0xf5')));_0x161a0c['use'](_0x39ca('0xf6'),require('./api/whatsappMessage'));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xf7'),require(_0x39ca('0xf8')));_0x161a0c['use'](_0x39ca('0xf9'),require(_0x39ca('0xfa')));_0x161a0c['use']('/api/whatsapp/queues',require(_0x39ca('0xfb')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0xfc'),require(_0x39ca('0xfd')));_0x161a0c['use'](_0x39ca('0xfe'),require(_0x39ca('0xff')));_0x161a0c['use'](_0x39ca('0x100'),require(_0x39ca('0x101')));_0x161a0c[_0x39ca('0xa')]('/api/auth/google',require('./api/authGoogle'));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x102'),require('./api/jira'));_0x161a0c['use'](_0x39ca('0x103'),require(_0x39ca('0x104')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x105'),require('./api/version'));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x106'),require(_0x39ca('0x107')));_0x161a0c[_0x39ca('0xa')]('/api/pm2',require(_0x39ca('0x108')));_0x161a0c[_0x39ca('0xa')]('/api/webbar',require(_0x39ca('0x109')));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x10a'),express[_0x39ca('0x10b')](path['join'](config['root'],_0x39ca('0x10a'))));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x10c'),express['static'](path['join'](config[_0x39ca('0x10d')],'/www')));_0x161a0c[_0x39ca('0xa')]('/demo',express['static'](path['join'](config[_0x39ca('0x10d')],'/demo')));_0x161a0c[_0x39ca('0xa')]('/snippet',express['static'](path[_0x39ca('0x10e')](config[_0x39ca('0x10d')],_0x39ca('0x10f'),_0x39ca('0x110'))));_0x161a0c[_0x39ca('0xa')](_0x39ca('0x111'),express[_0x39ca('0x10b')](path[_0x39ca('0x10e')](config['root'],'/server/files/plugins')));_0x161a0c[_0x39ca('0x112')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x39ca('0x113')](errors[0x194]);_0x161a0c[_0x39ca('0x112')]('/*')[_0x39ca('0x113')](function(_0x3d7e11,_0xc14813){_0xc14813[_0x39ca('0x114')](path[_0x39ca('0x115')](_0x161a0c['get'](_0x39ca('0x116'))+_0x39ca('0x117')));});};var sensitiveFields=[_0x39ca('0x118'),_0x39ca('0x119'),_0x39ca('0x11a'),_0x39ca('0x11b'),_0x39ca('0x11c'),_0x39ca('0x11d'),'street',_0x39ca('0x11e'),'mobile',_0x39ca('0x11f'),_0x39ca('0x120'),_0x39ca('0x121'),_0x39ca('0x122'),'securityToken',_0x39ca('0x123'),_0x39ca('0x124'),_0x39ca('0x125'),_0x39ca('0x126'),_0x39ca('0x127'),_0x39ca('0x128'),_0x39ca('0x129'),_0x39ca('0x12a'),_0x39ca('0x12b'),_0x39ca('0x12c'),'membername',_0x39ca('0x12d'),_0x39ca('0x12e'),_0x39ca('0x12f'),_0x39ca('0x130'),_0x39ca('0x131'),_0x39ca('0x132'),'accesskeyid',_0x39ca('0x133'),_0x39ca('0x134'),_0x39ca('0x14'),_0x39ca('0x135'),_0x39ca('0x136'),_0x39ca('0x137'),'dsn',_0x39ca('0x138'),_0x39ca('0x139'),'oldPassword'];function maskSensitiveData(_0x316212){var _0x16d95d=/(?!^)[\s\S](?!$)/g;if(!_[_0x39ca('0x13a')](_0x316212))return;for(var _0x150f1e in _0x316212){if(_['isArray'](_0x316212[_0x150f1e])){for(var _0x4f5ed0=0x0;_0x4f5ed0<_0x316212[_0x150f1e][_0x39ca('0x13b')];_0x4f5ed0++){maskSensitiveData(_0x316212[_0x150f1e][_0x4f5ed0]);}}else if(_['isPlainObject'](_0x316212[_0x150f1e])){maskSensitiveData(_0x316212[_0x150f1e]);}else if(_[_0x39ca('0x13c')](_0x316212[_0x150f1e])){_0x316212[_0x150f1e]=_0x316212[_0x150f1e][_0x39ca('0x13d')](/{{{/g,'@@{')[_0x39ca('0x13d')](/}}}/g,'}@@')[_0x39ca('0x13d')](/{{/g,'@{')[_0x39ca('0x13d')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x150f1e)){_0x316212[_0x150f1e]=_0x316212[_0x150f1e][_0x39ca('0x13d')](_0x16d95d,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index db441c9..9035921 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8fbd=['../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.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','default','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.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/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc'];(function(_0x30c40b,_0xe7e81){var _0x1939a2=function(_0x535d45){while(--_0x535d45){_0x30c40b['push'](_0x30c40b['shift']());}};_0x1939a2(++_0xe7e81);}(_0x8fbd,0x187));var _0xd8fb=function(_0x1328dd,_0xdfdd17){_0x1328dd=_0x1328dd-0x0;var _0x438721=_0x8fbd[_0x1328dd];return _0x438721;};'use strict';var jayson=require(_0xd8fb('0x0'));var BPromise=require(_0xd8fb('0x1'));var _=require(_0xd8fb('0x2'));var config=require(_0xd8fb('0x3'));exports[_0xd8fb('0x4')]=function(){return new BPromise(function(_0x33c78c,_0x23e28d){var _0x5eb0af={};_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require('../api/user/user.rpc'));_0x5eb0af=_['merge'](_0x5eb0af,require(_0xd8fb('0x6')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x7')));_0x5eb0af=_['merge'](_0x5eb0af,require('../api/voiceRecording/voiceRecording.rpc'));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x5eb0af=_['merge'](_0x5eb0af,require(_0xd8fb('0x8')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x5eb0af=_['merge'](_0x5eb0af,require(_0xd8fb('0x9')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0xa')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0xb')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0xc')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0xd')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0xe')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0xf')));_0x5eb0af=_['merge'](_0x5eb0af,require(_0xd8fb('0x10')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x11')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x12')));_0x5eb0af=_['merge'](_0x5eb0af,require(_0xd8fb('0x13')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require('../api/faxAccount/faxAccount.rpc'));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x14')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require('../api/faxInteraction/faxInteraction.rpc'));_0x5eb0af=_['merge'](_0x5eb0af,require(_0xd8fb('0x15')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x16')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x17')));_0x5eb0af=_['merge'](_0x5eb0af,require(_0xd8fb('0x18')));_0x5eb0af=_['merge'](_0x5eb0af,require('../api/smsInteraction/smsInteraction.rpc'));_0x5eb0af=_['merge'](_0x5eb0af,require(_0xd8fb('0x19')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require('../api/smsQueue/smsQueue.rpc'));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x1a')));_0x5eb0af=_['merge'](_0x5eb0af,require(_0xd8fb('0x1b')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x1c')));_0x5eb0af=_['merge'](_0x5eb0af,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x1d')));_0x5eb0af=_['merge'](_0x5eb0af,require(_0xd8fb('0x1e')));_0x5eb0af=_['merge'](_0x5eb0af,require('../api/chatMessage/chatMessage.rpc'));_0x5eb0af=_['merge'](_0x5eb0af,require(_0xd8fb('0x1f')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x20')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x21')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x22')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x23')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x24')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require('../api/interval/interval.rpc'));_0x5eb0af=_['merge'](_0x5eb0af,require(_0xd8fb('0x25')));_0x5eb0af=_['merge'](_0x5eb0af,require(_0xd8fb('0x26')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x27')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x28')));_0x5eb0af=_['merge'](_0x5eb0af,require(_0xd8fb('0x29')));_0x5eb0af=_['merge'](_0x5eb0af,require(_0xd8fb('0x2a')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x2b')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x2c')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x2d')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x2e')));_0x5eb0af=_['merge'](_0x5eb0af,require(_0xd8fb('0x2f')));_0x5eb0af=_['merge'](_0x5eb0af,require(_0xd8fb('0x30')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x31')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x32')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x33')));_0x5eb0af=_['merge'](_0x5eb0af,require(_0xd8fb('0x34')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x35')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x36')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require('../api/setting/setting.rpc'));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x37')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x38')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require('../api/squareRecording/squareRecording.rpc'));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x39')));_0x5eb0af=_['merge'](_0x5eb0af,require(_0xd8fb('0x3a')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x3b')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x3c')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x3d')));_0x5eb0af=_['merge'](_0x5eb0af,require(_0xd8fb('0x3e')));_0x5eb0af=_[_0xd8fb('0x5')](_0x5eb0af,require(_0xd8fb('0x3f')));_0x5eb0af=_['merge'](_0x5eb0af,require(_0xd8fb('0x40')));_0x5eb0af=_['merge'](_0x5eb0af,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x35f822=jayson[_0xd8fb('0x41')](_0x5eb0af)[_0xd8fb('0x42')]();var _0x548f2d=config[_0xd8fb('0x43')][_0xd8fb('0x44')]||config[_0xd8fb('0x44')]+0x1;var _0x292557=config['rpc']['ip']||_0xd8fb('0x45');_0x35f822['on'](_0xd8fb('0x46'),function(_0x466e40){return _0x23e28d(_0x466e40);});_0x35f822[_0xd8fb('0x4')](_0x548f2d,_0x292557,function(){console[_0xd8fb('0x47')](_0xd8fb('0x48'),_0x292557,_0x548f2d);require(_0xd8fb('0x49'))[_0xd8fb('0x4a')]();return _0x33c78c('RPC\x20listening\x20on\x20'+_0x292557+':'+_0x548f2d);});});}; \ No newline at end of file +var _0x61b1=['../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/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','port','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.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/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc'];(function(_0x21d4dc,_0x36a2bb){var _0x2ce587=function(_0x6e4ac8){while(--_0x6e4ac8){_0x21d4dc['push'](_0x21d4dc['shift']());}};_0x2ce587(++_0x36a2bb);}(_0x61b1,0x7a));var _0x161b=function(_0x266e2c,_0x57b6ab){_0x266e2c=_0x266e2c-0x0;var _0xb19c8b=_0x61b1[_0x266e2c];return _0xb19c8b;};'use strict';var jayson=require(_0x161b('0x0'));var BPromise=require(_0x161b('0x1'));var _=require(_0x161b('0x2'));var config=require(_0x161b('0x3'));exports[_0x161b('0x4')]=function(){return new BPromise(function(_0x362159,_0x319471){var _0x1f9f92={};_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x6')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x7')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x8')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x9')));_0x1f9f92=_['merge'](_0x1f9f92,require(_0x161b('0xa')));_0x1f9f92=_['merge'](_0x1f9f92,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x1f9f92=_['merge'](_0x1f9f92,require(_0x161b('0xb')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0xc')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0xd')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0xe')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0xf')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x10')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x11')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x12')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x13')));_0x1f9f92=_['merge'](_0x1f9f92,require(_0x161b('0x14')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x15')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x16')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x17')));_0x1f9f92=_['merge'](_0x1f9f92,require(_0x161b('0x18')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x19')));_0x1f9f92=_['merge'](_0x1f9f92,require(_0x161b('0x1a')));_0x1f9f92=_['merge'](_0x1f9f92,require(_0x161b('0x1b')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x1c')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x1d')));_0x1f9f92=_['merge'](_0x1f9f92,require(_0x161b('0x1e')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x1f')));_0x1f9f92=_['merge'](_0x1f9f92,require(_0x161b('0x20')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x21')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x22')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x23')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x24')));_0x1f9f92=_['merge'](_0x1f9f92,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x1f9f92=_['merge'](_0x1f9f92,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x1f9f92=_['merge'](_0x1f9f92,require(_0x161b('0x25')));_0x1f9f92=_['merge'](_0x1f9f92,require(_0x161b('0x26')));_0x1f9f92=_['merge'](_0x1f9f92,require(_0x161b('0x27')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require('../api/cmContact/cmContact.rpc'));_0x1f9f92=_['merge'](_0x1f9f92,require(_0x161b('0x28')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x29')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x2a')));_0x1f9f92=_['merge'](_0x1f9f92,require(_0x161b('0x2b')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x2c')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x2d')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x2e')));_0x1f9f92=_['merge'](_0x1f9f92,require(_0x161b('0x2f')));_0x1f9f92=_['merge'](_0x1f9f92,require(_0x161b('0x30')));_0x1f9f92=_['merge'](_0x1f9f92,require(_0x161b('0x31')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x32')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x33')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x34')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x1f9f92=_['merge'](_0x1f9f92,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x35')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x1f9f92=_['merge'](_0x1f9f92,require(_0x161b('0x36')));_0x1f9f92=_['merge'](_0x1f9f92,require(_0x161b('0x37')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x38')));_0x1f9f92=_['merge'](_0x1f9f92,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x39')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x3a')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require('../api/squareOdbc/squareOdbc.rpc'));_0x1f9f92=_['merge'](_0x1f9f92,require('../api/squareProject/squareProject.rpc'));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require('../api/squareRecording/squareRecording.rpc'));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x3b')));_0x1f9f92=_['merge'](_0x1f9f92,require(_0x161b('0x3c')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require('../api/attachment/attachment.rpc'));_0x1f9f92=_['merge'](_0x1f9f92,require(_0x161b('0x3d')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x3e')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x3f')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x40')));_0x1f9f92=_[_0x161b('0x5')](_0x1f9f92,require(_0x161b('0x41')));var _0x5a74c7=jayson['server'](_0x1f9f92)[_0x161b('0x42')]();var _0x3e79c4=config['rpc'][_0x161b('0x43')]||config[_0x161b('0x43')]+0x1;var _0x4929ed=config[_0x161b('0x44')]['ip']||_0x161b('0x45');_0x5a74c7['on'](_0x161b('0x46'),function(_0x1c4aba){return _0x319471(_0x1c4aba);});_0x5a74c7['listen'](_0x3e79c4,_0x4929ed,function(){console[_0x161b('0x47')](_0x161b('0x48'),_0x4929ed,_0x3e79c4);require(_0x161b('0x49'))[_0x161b('0x4a')]();return _0x362159(_0x161b('0x4b')+_0x4929ed+':'+_0x3e79c4);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 448f568..ed1d461 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 _0xe091=['noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','SET\x20PRIORITY\x20%s','setVariable','isBoolean','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','setContext','setExtension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','events','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','520\x20End\x20of\x20proper','no\x20code','replace','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','function','write','inherits','sendRequest','command','prototype','answer','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s'];(function(_0x24ea3e,_0x58ba09){var _0xe20238=function(_0x4b190b){while(--_0x4b190b){_0x24ea3e['push'](_0x24ea3e['shift']());}};_0xe20238(++_0x58ba09);}(_0xe091,0x1ad));var _0x1e09=function(_0x28cb92,_0x5117bd){_0x28cb92=_0x28cb92-0x0;var _0x3f1f75=_0xe091[_0x28cb92];return _0x3f1f75;};'use strict';var util=require(_0x1e09('0x0'));var _=require(_0x1e09('0x1'));var EventEmitter=require(_0x1e09('0x2'))['EventEmitter'];var AGIReply=require(_0x1e09('0x3'));var AGIError=require(_0x1e09('0x4'));function AGIChannel(_0x242280){var _0x4e0879=this,_0x1a43af=new AGIReply(),_0x110900=![],_0x1d9cc4={};EventEmitter[_0x1e09('0x5')](_0x4e0879);_0x242280[_0x1e09('0x6')](_0x1e09('0x7'));_0x242280[_0x1e09('0x8')](0x8*0x3c*0x3c*0x3e8);_0x1a43af[_0x1e09('0x6')]('utf8');_0x1a43af['on'](_0x1e09('0x9'),function(_0x97eefb){for(var _0x18375b in _0x97eefb){_0x4e0879[_0x18375b]=_0x97eefb[_0x18375b];}_0x4e0879[_0x1e09('0xa')](_0x1e09('0xb'));});_0x1a43af['on'](_0x1e09('0xc'),function(_0x4cb92c){if(_0x4cb92c[_0x1e09('0xd')]()==_0x1e09('0xe')){_0x4e0879['emit'](_0x1e09('0xe'));return;}if(_0x4cb92c[_0x1e09('0xf')](0x0,0xb)==_0x1e09('0x10')){_0x110900=!![];}if(_0x110900){_0x1d9cc4['rx']+=_0x4cb92c+'\x0a';if(_0x4cb92c['search'](_0x1e09('0x11'))!=-0x1){_0x110900=![];}}else{_0x1d9cc4['rx']=_0x4cb92c;}if(_0x110900){return;}if(typeof _0x1d9cc4['cb']=='function'){var _0x35f768=_0x1d9cc4['rx'][_0x1e09('0xf')](0x0,0x3),_0x25c61b=null,_0x41ffa5=null;_0x35f768=parseInt(_0x35f768);if(isNaN(_0x35f768)){_0x1d9cc4['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x1e09('0x12')});return;}if(_0x35f768!=0xc8){_0x1d9cc4['cb'](null,{'code':_0x35f768,'result':-0x1,'extra':'KO'});return;}_0x25c61b=_0x1d9cc4['rx'][_0x1e09('0xf')](0x4)[_0x1e09('0x13')]('result=','');if(_0x25c61b[_0x1e09('0x14')]('\x20')!=-0x1){_0x25c61b=_0x25c61b[_0x1e09('0x15')](0x0,_0x25c61b['indexOf']('\x20'));}if(_['startsWith'](_0x25c61b,'-1')){_0x25c61b=parseInt(_0x25c61b);}_0x41ffa5=_0x1d9cc4['rx'][_0x1e09('0x16')]('\x20');if(_0x41ffa5[_0x1e09('0x17')]==0x3){_0x41ffa5=_0x41ffa5[0x2]['substring'](0x1,_0x41ffa5[0x2][_0x1e09('0x17')]-0x1);}else if(_0x41ffa5['length']>0x3){var _0x42455e=/\((.+)\)/;var _0x3fda78=_0x1d9cc4['rx'][_0x1e09('0x18')](_0x42455e);if(_0x3fda78){_0x41ffa5=_0x3fda78[0x1];}else{_0x41ffa5=null;}}else{_0x41ffa5=null;}_0x1d9cc4['cb'](null,{'code':_0x35f768,'result':_0x25c61b,'extra':_0x41ffa5});}});_0x242280['on'](_0x1e09('0x19'),function(_0x3408a3){_0x4e0879[_0x1e09('0xa')](_0x1e09('0x19'),new AGIError(_0x1e09('0x1a'),_0x3408a3[_0x1e09('0x1b')]));});_0x242280['on']('close',function(){_0x4e0879[_0x1e09('0xa')](_0x1e09('0x1c'),new AGIError(_0x1e09('0x1d')));});_0x242280['on'](_0x1e09('0x1e'),function(){_0x4e0879[_0x1e09('0xa')]('timeout',new AGIError(_0x1e09('0x1f')));_0x242280[_0x1e09('0x20')]();});_0x242280[_0x1e09('0x21')](_0x1a43af);this['command']=function(_0x239ea1,_0x17f81d){var _0x239ea1=_0x239ea1||'',_0x17f81d=typeof _0x17f81d==_0x1e09('0x22')?_0x17f81d:new Function();_0x1d9cc4={'tx':_0x239ea1,'rx':'','cb':_0x17f81d};_0x242280[_0x1e09('0x23')](_0x239ea1+'\x0a');},this[_0x1e09('0x1c')]=function(){_0x242280[_0x1e09('0x20')]();};}util[_0x1e09('0x24')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x1e09('0x25')]=function(_0x449554){return this[_0x1e09('0x26')]['sync'](this,_0x449554);};AGIChannel[_0x1e09('0x27')][_0x1e09('0x28')]=function(){return this['sendRequest'](_0x1e09('0x29'));};AGIChannel['prototype'][_0x1e09('0x2a')]=function(_0x39b7b9,_0x183c66,_0x255616){_0x39b7b9=_0x39b7b9===undefined?_0x1e09('0x2b'):_0x39b7b9;_0x183c66=_0x183c66===undefined?'5':_0x183c66;_0x255616=_0x255616===undefined?'1':_0x255616;return this[_0x1e09('0x25')](util['format'](_0x1e09('0x2c'),_0x39b7b9,_0x183c66*0x3e8,_0x255616));};AGIChannel[_0x1e09('0x27')][_0x1e09('0x2d')]=function(_0x25475a){_0x25475a=_0x25475a||_0x1e09('0x2e');return this[_0x1e09('0x25')](util[_0x1e09('0x2f')](_0x1e09('0x30'),_0x25475a));};AGIChannel[_0x1e09('0x27')][_0x1e09('0x31')]=function(_0x6e0b41,_0x13e3db){if(_[_0x1e09('0x32')](_0x13e3db)){return this[_0x1e09('0x25')](util['format'](_0x1e09('0x33'),_0x6e0b41,_0x13e3db[_0x1e09('0x34')](',')));}return this['sendRequest'](util[_0x1e09('0x2f')]('EXEC\x20%s\x20%s',_0x6e0b41,_0x13e3db));};AGIChannel[_0x1e09('0x27')]['setContext']=function(_0x37cd5d){return this[_0x1e09('0x25')](util[_0x1e09('0x2f')](_0x1e09('0x35'),_0x37cd5d));};AGIChannel['prototype']['setExtension']=function(_0x565f3d){return this[_0x1e09('0x25')](util[_0x1e09('0x2f')]('SET\x20EXTENSION\x20%s',_0x565f3d));};AGIChannel[_0x1e09('0x27')]['setPriority']=function(_0x47bf8){return this[_0x1e09('0x25')](util[_0x1e09('0x2f')](_0x1e09('0x36'),_0x47bf8));};AGIChannel[_0x1e09('0x27')][_0x1e09('0xe')]=function(){return this[_0x1e09('0x25')]('HANGUP');};AGIChannel['prototype'][_0x1e09('0x37')]=function(_0x1c61ab,_0x52d6f9){var _0x9b278c=_[_0x1e09('0x38')](_0x52d6f9)||_['isNumber'](_0x52d6f9)?_0x52d6f9['toString']():_0x52d6f9;return this[_0x1e09('0x25')](util['format'](_0x1e09('0x39'),_0x1c61ab,_0x9b278c?_0x9b278c[_0x1e09('0x3a')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x1e09('0x27')][_0x1e09('0x3b')]=function(_0xfcbd71,_0x3db96e){return this[_0x1e09('0x25')](util[_0x1e09('0x2f')](_0x1e09('0x3c'),_0xfcbd71,_0x3db96e));};AGIChannel['prototype']['sayDigits']=function(_0x4bb7fd,_0x26bce1){return this[_0x1e09('0x25')](util[_0x1e09('0x2f')](_0x1e09('0x3d'),_0x4bb7fd,_0x26bce1));};AGIChannel[_0x1e09('0x27')][_0x1e09('0x3e')]=function(_0x1d8892,_0x1c4a9c){return this['sendRequest'](util['format'](_0x1e09('0x3f'),_0x1d8892,_0x1c4a9c));};AGIChannel[_0x1e09('0x27')]['continueAt']=function(_0x344357,_0x312cc2,_0x466ec6){_0x312cc2=_0x312cc2||this[_0x1e09('0x40')];_0x466ec6=_0x466ec6||0x1;this[_0x1e09('0x41')](_0x344357);this[_0x1e09('0x42')](_0x312cc2);this[_0x1e09('0x43')](_0x466ec6);return this[_0x1e09('0x2d')](util[_0x1e09('0x2f')](_0x1e09('0x44'),_0x344357,_0x312cc2,_0x466ec6));};AGIChannel['prototype'][_0x1e09('0x45')]=function(_0x2c33a5){return this[_0x1e09('0x25')](util[_0x1e09('0x2f')](_0x1e09('0x46'),_0x2c33a5));};AGIChannel[_0x1e09('0x27')]['recordFile']=function(_0x38264c,_0x4d8782,_0x3c09b7,_0x3c042c,_0xe257ca,_0xcbecf){_0x4d8782=_0x4d8782||'wav';_0x3c09b7=_0x3c09b7||'';_0x3c042c=_0x3c042c===undefined?-0x1:_0x3c042c==='-1'?-0x1:_0x3c042c*0x3e8;_0xe257ca=_0xe257ca===undefined?'':'s='+_0xe257ca;_0xcbecf=_0xcbecf?'BEEP':'';return this[_0x1e09('0x25')](util[_0x1e09('0x2f')](_0x1e09('0x47'),_0x38264c,_0x4d8782,_0x3c09b7,_0x3c042c,_0xcbecf,_0xe257ca));};AGIChannel['prototype']['streamFile']=function(_0x19dc95,_0x321f9a){_0x321f9a=_0x321f9a||'';return this[_0x1e09('0x25')](util['format'](_0x1e09('0x48'),_0x19dc95,_0x321f9a));};AGIChannel[_0x1e09('0x27')][_0x1e09('0x49')]=function(_0x3dbc99){return this[_0x1e09('0x31')](_0x1e09('0x4a'),_0x3dbc99);};AGIChannel['prototype'][_0x1e09('0x4b')]=function(_0x1823ba){return this[_0x1e09('0x31')](_0x1e09('0x4c'),_0x1823ba);};AGIChannel[_0x1e09('0x27')][_0x1e09('0x19')]=function(_0x4c3d2d,_0x2b7e5c){this[_0x1e09('0x2d')](util[_0x1e09('0x2f')](_0x1e09('0x4d'),_0x4c3d2d['id'],_0x4c3d2d['label'],_0x2b7e5c));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x1e09('0x4e')]=AGIChannel; \ No newline at end of file +var _0xda33=['setTimeout','setEncoding','utf8','emit','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','prototype','sendRequest','answer','ANSWER','getData','format','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','agi','AGI','wait','error','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','events','EventEmitter','./reply','./error','call'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xda33,0x1d4));var _0x3da3=function(_0x44d3c6,_0x44960d){_0x44d3c6=_0x44d3c6-0x0;var _0x4d49e8=_0xda33[_0x44d3c6];return _0x4d49e8;};'use strict';var util=require('util');var _=require(_0x3da3('0x0'));var EventEmitter=require(_0x3da3('0x1'))[_0x3da3('0x2')];var AGIReply=require(_0x3da3('0x3'));var AGIError=require(_0x3da3('0x4'));function AGIChannel(_0x46151b){var _0xe587c2=this,_0x3d1de6=new AGIReply(),_0x24f74b=![],_0x5969a0={};EventEmitter[_0x3da3('0x5')](_0xe587c2);_0x46151b['setEncoding']('utf8');_0x46151b[_0x3da3('0x6')](0x8*0x3c*0x3c*0x3e8);_0x3d1de6[_0x3da3('0x7')](_0x3da3('0x8'));_0x3d1de6['on']('headers',function(_0x4ef3b7){for(var _0x104cee in _0x4ef3b7){_0xe587c2[_0x104cee]=_0x4ef3b7[_0x104cee];}_0xe587c2[_0x3da3('0x9')]('ready');});_0x3d1de6['on'](_0x3da3('0xa'),function(_0x482305){if(_0x482305[_0x3da3('0xb')]()==_0x3da3('0xc')){_0xe587c2[_0x3da3('0x9')](_0x3da3('0xc'));return;}if(_0x482305[_0x3da3('0xd')](0x0,0xb)==_0x3da3('0xe')){_0x24f74b=!![];}if(_0x24f74b){_0x5969a0['rx']+=_0x482305+'\x0a';if(_0x482305[_0x3da3('0xf')](_0x3da3('0x10'))!=-0x1){_0x24f74b=![];}}else{_0x5969a0['rx']=_0x482305;}if(_0x24f74b){return;}if(typeof _0x5969a0['cb']==_0x3da3('0x11')){var _0x4429f7=_0x5969a0['rx']['substring'](0x0,0x3),_0x288bb7=null,_0x2a54f4=null;_0x4429f7=parseInt(_0x4429f7);if(isNaN(_0x4429f7)){_0x5969a0['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x3da3('0x12')});return;}if(_0x4429f7!=0xc8){_0x5969a0['cb'](null,{'code':_0x4429f7,'result':-0x1,'extra':'KO'});return;}_0x288bb7=_0x5969a0['rx']['substring'](0x4)[_0x3da3('0x13')](_0x3da3('0x14'),'');if(_0x288bb7[_0x3da3('0x15')]('\x20')!=-0x1){_0x288bb7=_0x288bb7[_0x3da3('0x16')](0x0,_0x288bb7['indexOf']('\x20'));}if(_[_0x3da3('0x17')](_0x288bb7,'-1')){_0x288bb7=parseInt(_0x288bb7);}_0x2a54f4=_0x5969a0['rx'][_0x3da3('0x18')]('\x20');if(_0x2a54f4[_0x3da3('0x19')]==0x3){_0x2a54f4=_0x2a54f4[0x2]['substring'](0x1,_0x2a54f4[0x2][_0x3da3('0x19')]-0x1);}else if(_0x2a54f4[_0x3da3('0x19')]>0x3){var _0x6ae074=/\((.+)\)/;var _0x2eb716=_0x5969a0['rx'][_0x3da3('0x1a')](_0x6ae074);if(_0x2eb716){_0x2a54f4=_0x2eb716[0x1];}else{_0x2a54f4=null;}}else{_0x2a54f4=null;}_0x5969a0['cb'](null,{'code':_0x4429f7,'result':_0x288bb7,'extra':_0x2a54f4});}});_0x46151b['on']('error',function(_0xbeb4b4){_0xe587c2[_0x3da3('0x9')]('error',new AGIError(_0x3da3('0x1b'),_0xbeb4b4[_0x3da3('0x1c')]));});_0x46151b['on']('close',function(){_0xe587c2[_0x3da3('0x9')](_0x3da3('0x1d'),new AGIError(_0x3da3('0x1e')));});_0x46151b['on'](_0x3da3('0x1f'),function(){_0xe587c2[_0x3da3('0x9')]('timeout',new AGIError(_0x3da3('0x20')));_0x46151b[_0x3da3('0x21')]();});_0x46151b[_0x3da3('0x22')](_0x3d1de6);this[_0x3da3('0x23')]=function(_0x537557,_0x3f763a){var _0x537557=_0x537557||'',_0x3f763a=typeof _0x3f763a==_0x3da3('0x11')?_0x3f763a:new Function();_0x5969a0={'tx':_0x537557,'rx':'','cb':_0x3f763a};_0x46151b[_0x3da3('0x24')](_0x537557+'\x0a');},this[_0x3da3('0x1d')]=function(){_0x46151b['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x3da3('0x25')][_0x3da3('0x26')]=function(_0x1b51f2){return this[_0x3da3('0x23')]['sync'](this,_0x1b51f2);};AGIChannel[_0x3da3('0x25')][_0x3da3('0x27')]=function(){return this[_0x3da3('0x26')](_0x3da3('0x28'));};AGIChannel['prototype'][_0x3da3('0x29')]=function(_0x30b5f2,_0x165129,_0x3174dc){_0x30b5f2=_0x30b5f2===undefined?'beep':_0x30b5f2;_0x165129=_0x165129===undefined?'5':_0x165129;_0x3174dc=_0x3174dc===undefined?'1':_0x3174dc;return this['sendRequest'](util[_0x3da3('0x2a')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x30b5f2,_0x165129*0x3e8,_0x3174dc));};AGIChannel[_0x3da3('0x25')]['noop']=function(_0x359057){_0x359057=_0x359057||_0x3da3('0x2b');return this[_0x3da3('0x26')](util[_0x3da3('0x2a')](_0x3da3('0x2c'),_0x359057));};AGIChannel[_0x3da3('0x25')][_0x3da3('0x2d')]=function(_0x5a7dd7,_0x1eba02){if(_[_0x3da3('0x2e')](_0x1eba02)){return this[_0x3da3('0x26')](util['format'](_0x3da3('0x2f'),_0x5a7dd7,_0x1eba02['join'](',')));}return this[_0x3da3('0x26')](util['format'](_0x3da3('0x2f'),_0x5a7dd7,_0x1eba02));};AGIChannel[_0x3da3('0x25')][_0x3da3('0x30')]=function(_0x1ec1c3){return this['sendRequest'](util[_0x3da3('0x2a')](_0x3da3('0x31'),_0x1ec1c3));};AGIChannel[_0x3da3('0x25')][_0x3da3('0x32')]=function(_0x3f8d0d){return this['sendRequest'](util[_0x3da3('0x2a')]('SET\x20EXTENSION\x20%s',_0x3f8d0d));};AGIChannel[_0x3da3('0x25')][_0x3da3('0x33')]=function(_0x213e6d){return this[_0x3da3('0x26')](util[_0x3da3('0x2a')](_0x3da3('0x34'),_0x213e6d));};AGIChannel[_0x3da3('0x25')]['hangup']=function(){return this['sendRequest']('HANGUP');};AGIChannel[_0x3da3('0x25')][_0x3da3('0x35')]=function(_0x7d4fff,_0x34eba5){var _0x5000ea=_[_0x3da3('0x36')](_0x34eba5)||_[_0x3da3('0x37')](_0x34eba5)?_0x34eba5[_0x3da3('0x38')]():_0x34eba5;return this[_0x3da3('0x26')](util[_0x3da3('0x2a')](_0x3da3('0x39'),_0x7d4fff,_0x5000ea?_0x5000ea[_0x3da3('0x38')]()[_0x3da3('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x3da3('0x25')][_0x3da3('0x3a')]=function(_0x223cd5,_0x21e925){return this[_0x3da3('0x26')](util[_0x3da3('0x2a')](_0x3da3('0x3b'),_0x223cd5,_0x21e925));};AGIChannel[_0x3da3('0x25')][_0x3da3('0x3c')]=function(_0x590eef,_0x1b6c80){return this[_0x3da3('0x26')](util['format'](_0x3da3('0x3d'),_0x590eef,_0x1b6c80));};AGIChannel['prototype'][_0x3da3('0x3e')]=function(_0x59c005,_0x34ef86){return this['sendRequest'](util['format'](_0x3da3('0x3f'),_0x59c005,_0x34ef86));};AGIChannel[_0x3da3('0x25')][_0x3da3('0x40')]=function(_0x4be8a1,_0x4c0938,_0x4cb230){_0x4c0938=_0x4c0938||this['extension'];_0x4cb230=_0x4cb230||0x1;this[_0x3da3('0x30')](_0x4be8a1);this[_0x3da3('0x32')](_0x4c0938);this[_0x3da3('0x33')](_0x4cb230);return this[_0x3da3('0x41')](util[_0x3da3('0x2a')](_0x3da3('0x42'),_0x4be8a1,_0x4c0938,_0x4cb230));};AGIChannel[_0x3da3('0x25')][_0x3da3('0x43')]=function(_0x1de057){return this[_0x3da3('0x26')](util['format'](_0x3da3('0x44'),_0x1de057));};AGIChannel[_0x3da3('0x25')][_0x3da3('0x45')]=function(_0x27f923,_0x215c72,_0x3d94a7,_0x405c10,_0x4fdcf1,_0x30be9e){_0x215c72=_0x215c72||_0x3da3('0x46');_0x3d94a7=_0x3d94a7||'';_0x405c10=_0x405c10===undefined?-0x1:_0x405c10==='-1'?-0x1:_0x405c10*0x3e8;_0x4fdcf1=_0x4fdcf1===undefined?'':'s='+_0x4fdcf1;_0x30be9e=_0x30be9e?_0x3da3('0x47'):'';return this['sendRequest'](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x27f923,_0x215c72,_0x3d94a7,_0x405c10,_0x30be9e,_0x4fdcf1));};AGIChannel[_0x3da3('0x25')]['streamFile']=function(_0x45b8d1,_0x3d747f){_0x3d747f=_0x3d747f||'';return this['sendRequest'](util['format']('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x45b8d1,_0x3d747f));};AGIChannel[_0x3da3('0x25')][_0x3da3('0x48')]=function(_0x5ebf2f){return this['exec'](_0x3da3('0x49'),_0x5ebf2f);};AGIChannel[_0x3da3('0x25')][_0x3da3('0x4a')]=function(_0x5af9e8){return this[_0x3da3('0x2d')]('WAIT',_0x5af9e8);};AGIChannel['prototype'][_0x3da3('0x4b')]=function(_0x363818,_0x3e5946){this[_0x3da3('0x41')](util[_0x3da3('0x2a')](_0x3da3('0x4c'),_0x363818['id'],_0x363818[_0x3da3('0x4d')],_0x3e5946));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x3da3('0x4e')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 6a2eb1e..16f5beb 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 _0xecdc=['format','apply','message','name','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\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','E_AGI_UNDEFINED','push'];(function(_0x1d4cac,_0x2145a5){var _0x26ecdb=function(_0x3b32b3){while(--_0x3b32b3){_0x1d4cac['push'](_0x1d4cac['shift']());}};_0x26ecdb(++_0x2145a5);}(_0xecdc,0x154));var _0xcecd=function(_0x5907b1,_0x1cfcd9){_0x5907b1=_0x5907b1-0x0;var _0x5afaab=_0xecdc[_0x5907b1];return _0x5afaab;};'use strict';var util=require(_0xcecd('0x0'));var error={'E_AGI_UNDEFINED':_0xcecd('0x1'),'E_AGI_ARGUMENT_PORT':_0xcecd('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0xcecd('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xcecd('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xcecd('0x5'),'E_AGI_SOCKET_ERROR':_0xcecd('0x6'),'E_AGI_SOCKET_CLOSE':_0xcecd('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xcecd('0x8'),'E_AGI_COMMAND_EMPTY':_0xcecd('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x30f21a){var _0x30f21a=_0x30f21a||null,_0x43946d=_0x43946d||[],_0x190ea3=0x1,_0x2a8f0f='';if(!error[_0x30f21a]){_0x30f21a=_0xcecd('0xa');}_0x43946d[_0xcecd('0xb')](error[_0x30f21a]);while(arguments[_0x190ea3]){_0x43946d[_0xcecd('0xb')](arguments[_0x190ea3]);_0x190ea3++;}_0x2a8f0f=util[_0xcecd('0xc')][_0xcecd('0xd')](util,_0x43946d);this[_0xcecd('0xe')]=_0x2a8f0f;this[_0xcecd('0xf')]=_0x30f21a;}module['exports']=AGIError; \ No newline at end of file +var _0xd1e8=['Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd1e8,0x140));var _0x8d1e=function(_0x46b18b,_0x35d245){_0x46b18b=_0x46b18b-0x0;var _0x5ab32c=_0xd1e8[_0x46b18b];return _0x5ab32c;};'use strict';var util=require(_0x8d1e('0x0'));var error={'E_AGI_UNDEFINED':_0x8d1e('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x8d1e('0x2'),'E_AGI_SERVER_CLOSE':_0x8d1e('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x8d1e('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x8d1e('0x5'),'E_AGI_SOCKET_CLOSE':_0x8d1e('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x8d1e('0x7'),'E_AGI_COMMAND_EMPTY':_0x8d1e('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x8d1e('0x9')};function AGIError(_0x1e115e){var _0x1e115e=_0x1e115e||null,_0x19ee6d=_0x19ee6d||[],_0x1ff69e=0x1,_0x4836a0='';if(!error[_0x1e115e]){_0x1e115e=_0x8d1e('0xa');}_0x19ee6d[_0x8d1e('0xb')](error[_0x1e115e]);while(arguments[_0x1ff69e]){_0x19ee6d['push'](arguments[_0x1ff69e]);_0x1ff69e++;}_0x4836a0=util[_0x8d1e('0xc')][_0x8d1e('0xd')](util,_0x19ee6d);this[_0x8d1e('0xe')]=_0x4836a0;this[_0x8d1e('0xf')]=_0x1e115e;}module[_0x8d1e('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 5bc9ac5..c54ed98 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 _0xc462=['invalid','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','agi','getdigits','getsecretdigits','vertices','edges','addVertex','prototype','addEdge','push','size','relations','numberOfEdges','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','default','menu'];(function(_0x273fc4,_0x46a3c9){var _0x238871=function(_0x22ae4d){while(--_0x22ae4d){_0x273fc4['push'](_0x273fc4['shift']());}};_0x238871(++_0x46a3c9);}(_0xc462,0x1d6));var _0x2c46=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xc462[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0x2c46('0x0'));var logger=require('../../../config/logger')(_0x2c46('0x1'));var verticesWithRetry=['menu',_0x2c46('0x2'),_0x2c46('0x3')];var Graph=function(){this[_0x2c46('0x4')]={};this[_0x2c46('0x5')]={};this['numberOfEdges']=0x0;};Graph['prototype'][_0x2c46('0x6')]=function(_0x4fee3d){this[_0x2c46('0x4')][_0x4fee3d['id']]=_0x4fee3d;this[_0x2c46('0x5')][_0x4fee3d['id']]=[];};Graph[_0x2c46('0x7')][_0x2c46('0x8')]=function(_0x55d31e,_0x58347e,_0x1862d9){this[_0x2c46('0x5')][_0x55d31e][_0x2c46('0x9')]({'target':_0x58347e,'condition':_0x1862d9});this['numberOfEdges']+=0x1;};Graph[_0x2c46('0x7')][_0x2c46('0xa')]=function(){return _[_0x2c46('0xa')](this['vertices']);};Graph[_0x2c46('0x7')][_0x2c46('0xb')]=function(){return this[_0x2c46('0xc')];};Graph['prototype']['getVertex']=function(_0x59af3c){return this[_0x2c46('0x4')][_0x59af3c];};Graph[_0x2c46('0x7')][_0x2c46('0xd')]=function(_0x5d34d8,_0x450c38){if(!this[_0x2c46('0x4')][_0x5d34d8]){return logger[_0x2c46('0xe')](_0x2c46('0xf'));}var _0x500976=_0x450c38(this[_0x2c46('0x4')][_0x5d34d8]);if(!_0x500976){return logger[_0x2c46('0xe')](_0x2c46('0x10'));}if(this['edges'][_0x5d34d8][_0x2c46('0x11')]===0x0){return logger['info'](_0x2c46('0x12'));}for(var _0x1aca32=0x0,_0x1fa01e=[],_0x53285e=![];_0x1aca32\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','vertex','isUndefined','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','syncho','util','moment','../../config/environment','agi','../../config/license/util','defaults','127.0.0.1','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','[%s]\x20%s','message','[ERROR]\x20%s','arg_1','calleridname','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','mxGraphModel','root','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','then','catch','createSquareReport','agi_','substring','inspect','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','production','start','debug','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','agicommand'];(function(_0x51554b,_0xf524bb){var _0x8a9eaf=function(_0x213696){while(--_0x213696){_0x51554b['push'](_0x51554b['shift']());}};_0x8a9eaf(++_0xf524bb);}(_0xa308,0x129));var _0x8a30=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa308[_0x38a7ac];return _0x53061a;};'use strict';var parser=require(_0x8a30('0x0'));var _=require('lodash');var syncho=require(_0x8a30('0x1'));var util=require(_0x8a30('0x2'));var moment=require(_0x8a30('0x3'));var config=require(_0x8a30('0x4'));var logger=require('../../config/logger')(_0x8a30('0x5'));var utilLicense=require(_0x8a30('0x6'));var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x8a30('0x5')]=_[_0x8a30('0x7')](config[_0x8a30('0x5')],{'ip':_0x8a30('0x8'),'port':0x11dd});function connectionHandler(_0x355d92){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x355d92);agiHandler(_0x355d92);}catch(_0x3e02f9){logger[_0x8a30('0x9')](_0x3e02f9[_0x8a30('0xa')]);}});});}function listeningHandler(){console[_0x8a30('0xb')](_0x8a30('0xc'),config['agi'][_0x8a30('0xd')]);logger[_0x8a30('0xe')](util[_0x8a30('0xf')](_0x8a30('0x10'),config['agi']['ip'],config[_0x8a30('0x5')][_0x8a30('0xd')]));}function errorHandler(_0x3c1081){if(_0x3c1081&&_0x3c1081[_0x8a30('0x11')]&&_0x3c1081['message']){logger['error'](util[_0x8a30('0xf')](_0x8a30('0x12'),_0x3c1081[_0x8a30('0x11')],_0x3c1081[_0x8a30('0x13')]));}else{logger['error'](util[_0x8a30('0xf')](_0x8a30('0x14'),_0x3c1081[_0x8a30('0xa')]));}}function closeHandler(){logger['info'](util[_0x8a30('0xf')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x8a30('0x15')],this[_0x8a30('0x16')],this['callerid'],this[_0x8a30('0x17')],this[_0x8a30('0x18')]));try{createSquareReport(this);}catch(_0x9ec6c2){logger[_0x8a30('0x9')](_0x9ec6c2[_0x8a30('0xa')]);}}function timeoutHandler(){logger['info'](util['format'](_0x8a30('0x19'),this[_0x8a30('0x15')],this[_0x8a30('0x16')],this[_0x8a30('0x1a')],this['dnid'],this['uniqueid']));}function hangupHandler(){logger[_0x8a30('0xe')](util[_0x8a30('0xf')](_0x8a30('0x1b'),this[_0x8a30('0x15')],this[_0x8a30('0x16')],this[_0x8a30('0x1a')],this[_0x8a30('0x17')],this[_0x8a30('0x18')]));this[_0x8a30('0x1c')]=!![];}function getRoot(_0x5710c2){return parser['toJson'](_0x5710c2,{'object':!![]})[_0x8a30('0x1d')][_0x8a30('0x1e')];}function addVertex(_0x393a84,_0x5a7b0c,_0x408a47){_0x5a7b0c['agicommand']=_0x408a47;if(_0x5a7b0c[_0x8a30('0x1f')](_0x8a30('0x20'))){_0x5a7b0c['maxRetry']=parseInt(_0x5a7b0c[_0x8a30('0x20')],0xa);}_0x393a84[_0x8a30('0x21')](_[_0x8a30('0x22')](_0x5a7b0c,_0x8a30('0x23')));}function initGraph(_0x4f8262,_0xfd0c5b){var _0x58b8ac=new Graph();for(var _0x2561ef in _0x4f8262){if(_0x4f8262[_0x8a30('0x1f')](_0x2561ef)){if(_[_0x8a30('0x24')](_0x4f8262[_0x2561ef])){for(var _0x4d1a3d=0x0;_0x4d1a3d<_0x4f8262[_0x2561ef][_0x8a30('0x25')];_0x4d1a3d+=0x1){addVertex(_0x58b8ac,_0x4f8262[_0x2561ef][_0x4d1a3d],_0x2561ef);}}else{addVertex(_0x58b8ac,_0x4f8262[_0x2561ef],_0x2561ef);}}}for(var _0xa957dd=0x0;_0xa957dd<_0xfd0c5b[_0x8a30('0x25')];_0xa957dd+=0x1){if(_0xfd0c5b[_0xa957dd][_0x8a30('0x26')]&&_0xfd0c5b[_0xa957dd][_0x8a30('0x27')]){_0x58b8ac[_0x8a30('0x28')](_0xfd0c5b[_0xa957dd]['source'],_0xfd0c5b[_0xa957dd][_0x8a30('0x27')],_0xfd0c5b[_0xa957dd]['value']);}}return _0x58b8ac;}function getSquareProject(_0x1fc7e9,_0x459c1b){rpc['getSquareProject'](_0x1fc7e9)[_0x8a30('0x29')](function(_0x433556){_0x459c1b(null,_0x433556);})[_0x8a30('0x2a')](function(_0x24f384){_0x459c1b(null,_0x24f384);});}function createSquareReport(_0x1c3c25,_0x2718da){rpc[_0x8a30('0x2b')](_0x1c3c25)['then'](function(_0x247bfe){if(_0x2718da){_0x2718da(null,_0x247bfe);}})[_0x8a30('0x2a')](function(_0x56a6ad){if(_0x2718da){_0x2718da(null,_0x56a6ad);}});}function setChannelVariables(_0x2eb07b){for(var _0x405d3a in _0x2eb07b){if(_0x2eb07b['hasOwnProperty'](_0x405d3a)){if(_0x405d3a['indexOf'](_0x8a30('0x2c'))===0x0){_0x2eb07b[_0x405d3a[_0x8a30('0x2d')](0x4)]=_0x2eb07b[_0x405d3a];delete _0x2eb07b[_0x405d3a];}}}}function getLogFromObject(_0x5dd6ae){return util[_0x8a30('0x2e')](_0x5dd6ae,{'showHidden':![],'depth':null});}function agiHandler(_0xc0a9da){var _0x74b115,_0x59a16d,_0x2abb6d,_0xbad485,_0x448598;logger['debug'](_0x8a30('0x2f'),JSON[_0x8a30('0x30')](_0xc0a9da,null,0x2));logger['info'](util['format'](_0x8a30('0x31'),_0xc0a9da[_0x8a30('0x15')],_0xc0a9da[_0x8a30('0x16')],_0xc0a9da[_0x8a30('0x1a')],_0xc0a9da['dnid'],_0xc0a9da['uniqueid']));_0xc0a9da['on'](_0x8a30('0x9'),errorHandler);_0xc0a9da['on'](_0x8a30('0x32'),closeHandler);_0xc0a9da['on'](_0x8a30('0x33'),timeoutHandler);_0xc0a9da[_0x8a30('0x1c')]=![];_0xc0a9da['on'](_0x8a30('0x34'),hangupHandler);var _0x5ee5f3=getSquareProject['sync'](null,_0xc0a9da[_0x8a30('0x15')]);if(_0x5ee5f3){if(_0x5ee5f3[_0x8a30('0x35')]){_0x74b115=getRoot(_0x5ee5f3[_0x8a30('0x35')]);if(_0x74b115&&_0x74b115[_0x8a30('0x36')]){logger[_0x8a30('0x37')](_0x8a30('0x1e'),JSON[_0x8a30('0x30')](_0x74b115,null,0x2));_0xc0a9da[_0x8a30('0x38')]=moment()['format'](_0x8a30('0x39'));_0x59a16d=initGraph(_['omit'](_0x74b115,_0x8a30('0x23')),_0x74b115[_0x8a30('0x23')]);_0x2abb6d=new Vertices(_0xc0a9da,rpc,mailRpc);logger[_0x8a30('0xe')](util[_0x8a30('0xf')](_0x8a30('0x3a'),_0xc0a9da['arg_1'],_0xc0a9da['calleridname'],_0xc0a9da['callerid'],_0xc0a9da[_0x8a30('0x17')],_0xc0a9da[_0x8a30('0x18')]));_0x59a16d[_0x8a30('0x3b')](_0x74b115[_0x8a30('0x36')]['id'],function(_0xa6d2e3){try{_0xa6d2e3=_0x2abb6d[_0x8a30('0x3c')](_0xa6d2e3);logger[_0x8a30('0x37')]('vertex',JSON['stringify'](_0xa6d2e3,null,0x2));if(_0xa6d2e3['agicommand']===_0x8a30('0x3d')){logger[_0x8a30('0xe')](_0x8a30('0x3e'));_0xc0a9da[_0x8a30('0x3f')]=_0xa6d2e3[_0x8a30('0x3f')]||_0xc0a9da['context'];_0xc0a9da[_0x8a30('0x40')]=_0xa6d2e3[_0x8a30('0x40')];_0xc0a9da[_0x8a30('0x41')]=_0xa6d2e3[_0x8a30('0x41')]?_0xa6d2e3[_0x8a30('0x41')]-0x1:0x1;return null;}else if(_0xa6d2e3&&_0x2abb6d[_0xa6d2e3['agicommand']]){_0x448598=_0x2abb6d[_0xa6d2e3[_0x8a30('0x42')]](_0xa6d2e3);logger[_0x8a30('0xe')](_0x8a30('0x43'),JSON['stringify'](_0x448598,null,0x2));if(_0x448598&&_0x448598[_0x8a30('0x44')]===AGI_CODE_SUCCESS&&_0x448598[_0x8a30('0x45')]!==AGI_RESULT_ERROR&&!_0xc0a9da['evtHangup']){logger['debug'](_0x8a30('0x43'),getLogFromObject(_0x448598));return _['isUndefined'](_0x448598['result'])?null:_0x448598[_0x8a30('0x45')][_0x8a30('0x46')]();}else{logger[_0x8a30('0x9')](_0x8a30('0x43'),getLogFromObject(_0x448598));return null;}}else{logger[_0x8a30('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0x1c3c26){logger[_0x8a30('0x9')](_0x1c3c26[_0x8a30('0xa')]);return null;}});if(_0x74b115[_0x8a30('0x47')]){logger[_0x8a30('0xe')](util[_0x8a30('0xf')](_0x8a30('0x48'),_0xc0a9da[_0x8a30('0x15')],_0xc0a9da[_0x8a30('0x16')],_0xc0a9da[_0x8a30('0x1a')],_0xc0a9da[_0x8a30('0x17')],_0xc0a9da[_0x8a30('0x18')]));_0x59a16d[_0x8a30('0x3b')](_0x74b115[_0x8a30('0x47')]['id'],function(_0x2a57e1){try{_0x2a57e1=_0x2abb6d[_0x8a30('0x3c')](_0x2a57e1);logger[_0x8a30('0x37')](_0x8a30('0x49'),JSON[_0x8a30('0x30')](_0x2a57e1,null,0x2));if(_0x2a57e1&&_0x2abb6d[_0x2a57e1[_0x8a30('0x42')]]){_0x448598=_0x2abb6d[_0x2a57e1[_0x8a30('0x42')]](_0x2a57e1);if(_0x448598){logger['debug']('response',getLogFromObject(_0x448598));return _[_0x8a30('0x4a')](_0x448598['result'])?null:_0x448598[_0x8a30('0x45')][_0x8a30('0x46')]();}else{logger[_0x8a30('0x9')](_0x8a30('0x43'),getLogFromObject(_0x448598));return null;}}else{logger[_0x8a30('0x9')](_0x8a30('0x4b'));return null;}}catch(_0x5ed5b9){logger[_0x8a30('0x9')](_0x5ed5b9['stack']);return null;}});}logger[_0x8a30('0xe')](util[_0x8a30('0xf')](_0x8a30('0x4c'),_0xc0a9da[_0x8a30('0x15')],_0xc0a9da[_0x8a30('0x16')],_0xc0a9da[_0x8a30('0x1a')],_0xc0a9da[_0x8a30('0x17')],_0xc0a9da[_0x8a30('0x18')]));logger['info'](util['format'](_0x8a30('0x4d'),_0xc0a9da[_0x8a30('0x3f')],_0xc0a9da[_0x8a30('0x40')],parseInt(_0xc0a9da[_0x8a30('0x41')],0xa)+0x1));_0xc0a9da[_0x8a30('0x4e')](_0xc0a9da['context'],_0xc0a9da['extension'],parseInt(_0xc0a9da[_0x8a30('0x41')],0xa)+0x1);_0xc0a9da['close']();}}else{logger[_0x8a30('0x9')](util[_0x8a30('0xf')](_0x8a30('0x4f'),_0xc0a9da[_0x8a30('0x15')]));_0xc0a9da[_0x8a30('0x4e')](_0xc0a9da[_0x8a30('0x3f')],_0xc0a9da['extension'],parseInt(_0xc0a9da[_0x8a30('0x41')],0xa)+0x1);_0xc0a9da[_0x8a30('0x32')]();}}else{logger[_0x8a30('0x9')](util[_0x8a30('0xf')](_0x8a30('0x50'),_0xc0a9da[_0x8a30('0x15')]));_0xc0a9da[_0x8a30('0x4e')](_0xc0a9da[_0x8a30('0x3f')],_0xc0a9da[_0x8a30('0x40')],parseInt(_0xc0a9da[_0x8a30('0x41')],0xa)+0x1);_0xc0a9da[_0x8a30('0x32')]();}}function main(){var _0x524b5b;return utilLicense[_0x8a30('0x51')]()[_0x8a30('0x29')](function(_0x5701cc){if(_0x5701cc){if(_0x5701cc[_0x8a30('0x52')]){if(_0x5701cc[_0x8a30('0x53')]&&_0x5701cc['callysquare']>0x0){logger['info'](util[_0x8a30('0xf')](_0x8a30('0x54'),_0x5701cc[_0x8a30('0x53')]));_0x524b5b=_0x5701cc['callysquare'];}else{logger[_0x8a30('0xe')](_0x8a30('0x55'));}}else{logger[_0x8a30('0xe')](_0x8a30('0x56'));_0x524b5b=-0x1;}}})[_0x8a30('0x2a')](function(_0x1852d8){logger[_0x8a30('0x9')](_0x8a30('0x57'),_0x1852d8[_0x8a30('0xa')]);})[_0x8a30('0x47')](function(){var _0x4dfb37=require(_0x8a30('0x58'))(config[_0x8a30('0x5')][_0x8a30('0xd')],config['agi']['ip'],_0x524b5b);_0x4dfb37['on'](_0x8a30('0x9'),errorHandler);_0x4dfb37['on'](_0x8a30('0x59'),listeningHandler);_0x4dfb37['on'](_0x8a30('0x5a'),connectionHandler);_0x4dfb37['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0xb27d=['[LICENSE]','./server','xml2json','syncho','util','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','defaults','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','[%s]\x20%s','[ERROR]\x20%s','arg_1','calleridname','dnid','callerid','uniqueid','toJson','agicommand','retry','maxRetry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','target','source','getSquareProject','createSquareReport','then','catch','indexOf','agi_','substring','inspect','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','evtHangup','hangup','sync','production','start','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','isUndefined','result','toString','agicommand\x20not\x20found','finally','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0xb27d,0x15a));var _0xdb27=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xb27d[_0x122096];return _0x3d1966;};'use strict';var parser=require(_0xdb27('0x0'));var _=require('lodash');var syncho=require(_0xdb27('0x1'));var util=require(_0xdb27('0x2'));var moment=require('moment');var config=require('../../config/environment');var logger=require(_0xdb27('0x3'))(_0xdb27('0x4'));var utilLicense=require(_0xdb27('0x5'));var rpc=require(_0xdb27('0x6'));var mailRpc=require(_0xdb27('0x7'));var Graph=require(_0xdb27('0x8'));var Vertices=require(_0xdb27('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0xdb27('0xa')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x1dbc24){process[_0xdb27('0xb')](function(){syncho(function(){try{setChannelVariables(_0x1dbc24);agiHandler(_0x1dbc24);}catch(_0xa77f91){logger[_0xdb27('0xc')](_0xa77f91[_0xdb27('0xd')]);}});});}function listeningHandler(){console[_0xdb27('0xe')](_0xdb27('0xf'),config[_0xdb27('0x4')][_0xdb27('0x10')]);logger[_0xdb27('0x11')](util[_0xdb27('0x12')](_0xdb27('0x13'),config[_0xdb27('0x4')]['ip'],config[_0xdb27('0x4')][_0xdb27('0x10')]));}function errorHandler(_0x1bbad8){if(_0x1bbad8&&_0x1bbad8[_0xdb27('0x14')]&&_0x1bbad8['message']){logger[_0xdb27('0xc')](util[_0xdb27('0x12')](_0xdb27('0x15'),_0x1bbad8['name'],_0x1bbad8['message']));}else{logger['error'](util[_0xdb27('0x12')](_0xdb27('0x16'),_0x1bbad8['stack']));}}function closeHandler(){logger[_0xdb27('0x11')](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xdb27('0x17')],this[_0xdb27('0x18')],this['callerid'],this[_0xdb27('0x19')],this['uniqueid']));try{createSquareReport(this);}catch(_0x230f69){logger[_0xdb27('0xc')](_0x230f69[_0xdb27('0xd')]);}}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[_0xdb27('0x17')],this['calleridname'],this[_0xdb27('0x1a')],this[_0xdb27('0x19')],this[_0xdb27('0x1b')]));}function hangupHandler(){logger[_0xdb27('0x11')](util['format']('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xdb27('0x17')],this[_0xdb27('0x18')],this[_0xdb27('0x1a')],this[_0xdb27('0x19')],this[_0xdb27('0x1b')]));this['evtHangup']=!![];}function getRoot(_0x15e195){return parser[_0xdb27('0x1c')](_0x15e195,{'object':!![]})['mxGraphModel']['root'];}function addVertex(_0x848ed6,_0x47faf6,_0x272f3b){_0x47faf6[_0xdb27('0x1d')]=_0x272f3b;if(_0x47faf6['hasOwnProperty'](_0xdb27('0x1e'))){_0x47faf6[_0xdb27('0x1f')]=parseInt(_0x47faf6[_0xdb27('0x1e')],0xa);}_0x848ed6[_0xdb27('0x20')](_[_0xdb27('0x21')](_0x47faf6,_0xdb27('0x22')));}function initGraph(_0x239368,_0x3f2a06){var _0x2aac45=new Graph();for(var _0x2562c5 in _0x239368){if(_0x239368[_0xdb27('0x23')](_0x2562c5)){if(_[_0xdb27('0x24')](_0x239368[_0x2562c5])){for(var _0x252ae5=0x0;_0x252ae5<_0x239368[_0x2562c5]['length'];_0x252ae5+=0x1){addVertex(_0x2aac45,_0x239368[_0x2562c5][_0x252ae5],_0x2562c5);}}else{addVertex(_0x2aac45,_0x239368[_0x2562c5],_0x2562c5);}}}for(var _0x123f7c=0x0;_0x123f7c<_0x3f2a06[_0xdb27('0x25')];_0x123f7c+=0x1){if(_0x3f2a06[_0x123f7c]['source']&&_0x3f2a06[_0x123f7c][_0xdb27('0x26')]){_0x2aac45['addEdge'](_0x3f2a06[_0x123f7c][_0xdb27('0x27')],_0x3f2a06[_0x123f7c][_0xdb27('0x26')],_0x3f2a06[_0x123f7c]['value']);}}return _0x2aac45;}function getSquareProject(_0x3009ab,_0x2f9a80){rpc[_0xdb27('0x28')](_0x3009ab)['then'](function(_0x14fd9f){_0x2f9a80(null,_0x14fd9f);})['catch'](function(_0x5db5ab){_0x2f9a80(null,_0x5db5ab);});}function createSquareReport(_0x217ab6,_0x2713b8){rpc[_0xdb27('0x29')](_0x217ab6)[_0xdb27('0x2a')](function(_0x3cb0b2){if(_0x2713b8){_0x2713b8(null,_0x3cb0b2);}})[_0xdb27('0x2b')](function(_0x7f2680){if(_0x2713b8){_0x2713b8(null,_0x7f2680);}});}function setChannelVariables(_0x1a8e62){for(var _0x5d7175 in _0x1a8e62){if(_0x1a8e62[_0xdb27('0x23')](_0x5d7175)){if(_0x5d7175[_0xdb27('0x2c')](_0xdb27('0x2d'))===0x0){_0x1a8e62[_0x5d7175[_0xdb27('0x2e')](0x4)]=_0x1a8e62[_0x5d7175];delete _0x1a8e62[_0x5d7175];}}}}function getLogFromObject(_0x817251){return util[_0xdb27('0x2f')](_0x817251,{'showHidden':![],'depth':null});}function agiHandler(_0x3b478e){var _0x204b01,_0x56ba83,_0x44de7e,_0xeab986,_0x335314;logger[_0xdb27('0x30')]('variables',JSON[_0xdb27('0x31')](_0x3b478e,null,0x2));logger[_0xdb27('0x11')](util[_0xdb27('0x12')](_0xdb27('0x32'),_0x3b478e['arg_1'],_0x3b478e['calleridname'],_0x3b478e['callerid'],_0x3b478e[_0xdb27('0x19')],_0x3b478e[_0xdb27('0x1b')]));_0x3b478e['on'](_0xdb27('0xc'),errorHandler);_0x3b478e['on'](_0xdb27('0x33'),closeHandler);_0x3b478e['on']('timeout',timeoutHandler);_0x3b478e[_0xdb27('0x34')]=![];_0x3b478e['on'](_0xdb27('0x35'),hangupHandler);var _0x23b6d0=getSquareProject[_0xdb27('0x36')](null,_0x3b478e[_0xdb27('0x17')]);if(_0x23b6d0){if(_0x23b6d0[_0xdb27('0x37')]){_0x204b01=getRoot(_0x23b6d0['production']);if(_0x204b01&&_0x204b01[_0xdb27('0x38')]){logger[_0xdb27('0x30')](_0xdb27('0x39'),JSON[_0xdb27('0x31')](_0x204b01,null,0x2));_0x3b478e[_0xdb27('0x3a')]=moment()[_0xdb27('0x12')](_0xdb27('0x3b'));_0x56ba83=initGraph(_[_0xdb27('0x21')](_0x204b01,_0xdb27('0x22')),_0x204b01[_0xdb27('0x22')]);_0x44de7e=new Vertices(_0x3b478e,rpc,mailRpc);logger['info'](util[_0xdb27('0x12')](_0xdb27('0x3c'),_0x3b478e[_0xdb27('0x17')],_0x3b478e[_0xdb27('0x18')],_0x3b478e['callerid'],_0x3b478e[_0xdb27('0x19')],_0x3b478e[_0xdb27('0x1b')]));_0x56ba83[_0xdb27('0x3d')](_0x204b01['start']['id'],function(_0x5b2bbd){try{_0x5b2bbd=_0x44de7e[_0xdb27('0x3e')](_0x5b2bbd);logger[_0xdb27('0x30')]('vertex',JSON[_0xdb27('0x31')](_0x5b2bbd,null,0x2));if(_0x5b2bbd['agicommand']===_0xdb27('0x3f')){logger['info'](_0xdb27('0x40'));_0x3b478e[_0xdb27('0x41')]=_0x5b2bbd[_0xdb27('0x41')]||_0x3b478e[_0xdb27('0x41')];_0x3b478e[_0xdb27('0x42')]=_0x5b2bbd['extension'];_0x3b478e[_0xdb27('0x43')]=_0x5b2bbd['priority']?_0x5b2bbd[_0xdb27('0x43')]-0x1:0x1;return null;}else if(_0x5b2bbd&&_0x44de7e[_0x5b2bbd[_0xdb27('0x1d')]]){_0x335314=_0x44de7e[_0x5b2bbd[_0xdb27('0x1d')]](_0x5b2bbd);logger['info'](_0xdb27('0x44'),JSON[_0xdb27('0x31')](_0x335314,null,0x2));if(_0x335314&&_0x335314[_0xdb27('0x45')]===AGI_CODE_SUCCESS&&_0x335314['result']!==AGI_RESULT_ERROR&&!_0x3b478e[_0xdb27('0x34')]){logger[_0xdb27('0x30')](_0xdb27('0x44'),getLogFromObject(_0x335314));return _[_0xdb27('0x46')](_0x335314[_0xdb27('0x47')])?null:_0x335314[_0xdb27('0x47')][_0xdb27('0x48')]();}else{logger[_0xdb27('0xc')](_0xdb27('0x44'),getLogFromObject(_0x335314));return null;}}else{logger['error'](_0xdb27('0x49'));return null;}}catch(_0x31b747){logger[_0xdb27('0xc')](_0x31b747[_0xdb27('0xd')]);return null;}});if(_0x204b01[_0xdb27('0x4a')]){logger['info'](util[_0xdb27('0x12')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3b478e[_0xdb27('0x17')],_0x3b478e[_0xdb27('0x18')],_0x3b478e[_0xdb27('0x1a')],_0x3b478e[_0xdb27('0x19')],_0x3b478e[_0xdb27('0x1b')]));_0x56ba83[_0xdb27('0x3d')](_0x204b01[_0xdb27('0x4a')]['id'],function(_0x13676d){try{_0x13676d=_0x44de7e['clear'](_0x13676d);logger[_0xdb27('0x30')]('vertex',JSON[_0xdb27('0x31')](_0x13676d,null,0x2));if(_0x13676d&&_0x44de7e[_0x13676d[_0xdb27('0x1d')]]){_0x335314=_0x44de7e[_0x13676d[_0xdb27('0x1d')]](_0x13676d);if(_0x335314){logger[_0xdb27('0x30')]('response',getLogFromObject(_0x335314));return _[_0xdb27('0x46')](_0x335314['result'])?null:_0x335314[_0xdb27('0x47')][_0xdb27('0x48')]();}else{logger[_0xdb27('0xc')](_0xdb27('0x44'),getLogFromObject(_0x335314));return null;}}else{logger[_0xdb27('0xc')](_0xdb27('0x49'));return null;}}catch(_0xdaeff0){logger[_0xdb27('0xc')](_0xdaeff0[_0xdb27('0xd')]);return null;}});}logger[_0xdb27('0x11')](util[_0xdb27('0x12')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3b478e[_0xdb27('0x17')],_0x3b478e[_0xdb27('0x18')],_0x3b478e[_0xdb27('0x1a')],_0x3b478e[_0xdb27('0x19')],_0x3b478e[_0xdb27('0x1b')]));logger[_0xdb27('0x11')](util['format'](_0xdb27('0x4b'),_0x3b478e[_0xdb27('0x41')],_0x3b478e[_0xdb27('0x42')],parseInt(_0x3b478e['priority'],0xa)+0x1));_0x3b478e[_0xdb27('0x4c')](_0x3b478e['context'],_0x3b478e[_0xdb27('0x42')],parseInt(_0x3b478e['priority'],0xa)+0x1);_0x3b478e[_0xdb27('0x33')]();}}else{logger[_0xdb27('0xc')](util[_0xdb27('0x12')]('Project\x20%s\x20not\x20published',_0x3b478e[_0xdb27('0x17')]));_0x3b478e[_0xdb27('0x4c')](_0x3b478e['context'],_0x3b478e[_0xdb27('0x42')],parseInt(_0x3b478e['priority'],0xa)+0x1);_0x3b478e[_0xdb27('0x33')]();}}else{logger[_0xdb27('0xc')](util[_0xdb27('0x12')](_0xdb27('0x4d'),_0x3b478e[_0xdb27('0x17')]));_0x3b478e[_0xdb27('0x4c')](_0x3b478e[_0xdb27('0x41')],_0x3b478e['extension'],parseInt(_0x3b478e[_0xdb27('0x43')],0xa)+0x1);_0x3b478e[_0xdb27('0x33')]();}}function main(){var _0x8035c3;return utilLicense[_0xdb27('0x4e')]()['then'](function(_0xbdf1c9){if(_0xbdf1c9){if(_0xbdf1c9[_0xdb27('0x4f')]){if(_0xbdf1c9[_0xdb27('0x50')]&&_0xbdf1c9[_0xdb27('0x50')]>0x0){logger[_0xdb27('0x11')](util[_0xdb27('0x12')](_0xdb27('0x51'),_0xbdf1c9[_0xdb27('0x50')]));_0x8035c3=_0xbdf1c9[_0xdb27('0x50')];}else{logger[_0xdb27('0x11')](_0xdb27('0x52'));}}else{logger['info'](_0xdb27('0x53'));_0x8035c3=-0x1;}}})[_0xdb27('0x2b')](function(_0x1db2a3){logger['error'](_0xdb27('0x54'),_0x1db2a3[_0xdb27('0xd')]);})['finally'](function(){var _0x41d399=require(_0xdb27('0x55'))(config[_0xdb27('0x4')][_0xdb27('0x10')],config[_0xdb27('0x4')]['ip'],_0x8035c3);_0x41d399['on'](_0xdb27('0xc'),errorHandler);_0x41d399['on']('listening',listeningHandler);_0x41d399['on']('connection',connectionHandler);_0x41d399['on'](_0xdb27('0x33'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 0a08ea2..481aa71 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 _0x161f=['sendMailMessage','SendMail','jayson/promise','client','request','then','error','message','result','catch'];(function(_0x28c261,_0x4cc3b4){var _0x1983a9=function(_0x552c21){while(--_0x552c21){_0x28c261['push'](_0x28c261['shift']());}};_0x1983a9(++_0x4cc3b4);}(_0x161f,0x1c4));var _0xf161=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x161f[_0x3bf83f];return _0x22c4a9;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xf161('0x0'));var client=jayson[_0xf161('0x1')]['http']({'port':0x232b});function request(_0x422a6d,_0x3a3467){return new BPromise(function(_0x25be68,_0x51601e){return client[_0xf161('0x2')](_0x422a6d,_0x3a3467)[_0xf161('0x3')](function(_0x2b362e){if(_0x2b362e[_0xf161('0x4')]){return _0x51601e(_0x2b362e[_0xf161('0x4')][_0xf161('0x5')]);}else{return _0x25be68(_0x2b362e[_0xf161('0x6')]);}})[_0xf161('0x7')](function(_0x4d70d5){return _0x51601e(_0x4d70d5);});});}exports[_0xf161('0x8')]=function(_0x351f6a,_0x5d40f3){return request(_0xf161('0x9'),{'account':_0x351f6a,'message':_0x5d40f3});}; \ No newline at end of file +var _0x6cf5=['sendMailMessage','bluebird','jayson/promise','client','http','request','error','message','catch'];(function(_0x5cd0e5,_0x534ce5){var _0x11be79=function(_0x4e11e2){while(--_0x4e11e2){_0x5cd0e5['push'](_0x5cd0e5['shift']());}};_0x11be79(++_0x534ce5);}(_0x6cf5,0x1de));var _0x56cf=function(_0x45e065,_0x1238eb){_0x45e065=_0x45e065-0x0;var _0x24b8fc=_0x6cf5[_0x45e065];return _0x24b8fc;};'use strict';var BPromise=require(_0x56cf('0x0'));var jayson=require(_0x56cf('0x1'));var client=jayson[_0x56cf('0x2')][_0x56cf('0x3')]({'port':0x232b});function request(_0x14eb84,_0x1bf4af){return new BPromise(function(_0x4eafd7,_0x1180df){return client[_0x56cf('0x4')](_0x14eb84,_0x1bf4af)['then'](function(_0xc5b7ca){if(_0xc5b7ca[_0x56cf('0x5')]){return _0x1180df(_0xc5b7ca[_0x56cf('0x5')][_0x56cf('0x6')]);}else{return _0x4eafd7(_0xc5b7ca['result']);}})[_0x56cf('0x7')](function(_0x32c980){return _0x1180df(_0x32c980);});});}exports[_0x56cf('0x8')]=function(_0x3da2a0,_0x1e5af1){return request('SendMail',{'account':_0x3da2a0,'message':_0x1e5af1});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 608f942..0b70298 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 _0x0195=['length','emit','line','util','stream','Transform','call','_localBuffer','_transform','\x0d\x0a\x0d\x0a','toString','_inBody','indexOf','substring','split','slice','trim'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x0195,0x168));var _0x5019=function(_0x2acb7a,_0x469f18){_0x2acb7a=_0x2acb7a-0x0;var _0x1967f6=_0x0195[_0x2acb7a];return _0x1967f6;};'use strict';var util=require(_0x5019('0x0'));var Transform=require(_0x5019('0x1'))[_0x5019('0x2')];function AGIReply(_0x300f7a){Transform[_0x5019('0x3')](this,_0x300f7a);this[_0x5019('0x4')]='';this['_inBody']=![];}util['inherits'](AGIReply,Transform);AGIReply['prototype'][_0x5019('0x5')]=function(_0x52619d,_0x351aa7,_0x318924){var _0x4c0466='\x0a',_0x59fbc3=['\x0a\x0a',_0x5019('0x6')],_0x1e774a=-0x1,_0x394d82=-0x1,_0x545ac6='',_0x57bc33=0x0,_0x1659c1='',_0x21f89b='';this[_0x5019('0x4')]+=_0x52619d[_0x5019('0x7')]();_0x1659c1=this[_0x5019('0x4')];if(!this[_0x5019('0x8')]){_0x57bc33=0x0;while(_0x59fbc3[_0x57bc33]){while((_0x394d82=_0x1659c1[_0x5019('0x9')](_0x59fbc3[_0x57bc33]))!=-0x1){_0x545ac6=_0x59fbc3[_0x57bc33];_0x21f89b=_0x1659c1[_0x5019('0xa')](0x0,_0x394d82);_0x1659c1=_0x1659c1[_0x5019('0xa')](_0x394d82+_0x545ac6['length']);var _0x4aeecd=_0x21f89b[_0x5019('0xb')](_0x4c0466),_0x1efef6=0x0,_0x4d6ef4={},_0x37d26f='',_0x5678a8='',_0x172c9f=-0x1;while(_0x4aeecd[_0x1efef6]){_0x172c9f=_0x4aeecd[_0x1efef6][_0x5019('0x9')](':');if(_0x172c9f!=-0x1){_0x37d26f=_0x4aeecd[_0x1efef6][_0x5019('0xc')](0x0,_0x172c9f)[_0x5019('0xd')]();_0x5678a8=_0x4aeecd[_0x1efef6][_0x5019('0xc')](_0x172c9f+0x1)[_0x5019('0xd')]();if(_0x37d26f[_0x5019('0xe')]>0x0){_0x4d6ef4[_0x37d26f]=_0x5678a8;}}else{}_0x1efef6++;}this[_0x5019('0xf')]('headers',_0x4d6ef4);this[_0x5019('0x8')]=!![];}_0x57bc33++;}this[_0x5019('0x4')]=_0x1659c1;}else{while((_0x1e774a=_0x1659c1[_0x5019('0x9')](_0x4c0466))!=-0x1){_0x21f89b=_0x1659c1[_0x5019('0xa')](0x0,_0x1e774a);this[_0x5019('0xf')](_0x5019('0x10'),_0x21f89b);_0x1659c1=_0x1659c1[_0x5019('0xa')](_0x1e774a+_0x4c0466[_0x5019('0xe')]);}this['_localBuffer']=_0x1659c1;}_0x318924();};module['exports']=AGIReply; \ No newline at end of file +var _0x33e1=['stream','Transform','call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','indexOf','substring','length','slice','trim','emit','_localBuffer','exports','util'];(function(_0x1b8e60,_0x21b885){var _0x363363=function(_0x5987c7){while(--_0x5987c7){_0x1b8e60['push'](_0x1b8e60['shift']());}};_0x363363(++_0x21b885);}(_0x33e1,0x142));var _0x133e=function(_0x42fee5,_0x1219b3){_0x42fee5=_0x42fee5-0x0;var _0x1f770a=_0x33e1[_0x42fee5];return _0x1f770a;};'use strict';var util=require(_0x133e('0x0'));var Transform=require(_0x133e('0x1'))[_0x133e('0x2')];function AGIReply(_0x4054ba){Transform[_0x133e('0x3')](this,_0x4054ba);this['_localBuffer']='';this[_0x133e('0x4')]=![];}util[_0x133e('0x5')](AGIReply,Transform);AGIReply[_0x133e('0x6')][_0x133e('0x7')]=function(_0x715eae,_0x50637c,_0x47ba68){var _0x4c0286='\x0a',_0x47417b=['\x0a\x0a',_0x133e('0x8')],_0x135836=-0x1,_0x15435d=-0x1,_0x2e8179='',_0x1c96ff=0x0,_0x321ed4='',_0x2c6fc4='';this['_localBuffer']+=_0x715eae['toString']();_0x321ed4=this['_localBuffer'];if(!this['_inBody']){_0x1c96ff=0x0;while(_0x47417b[_0x1c96ff]){while((_0x15435d=_0x321ed4[_0x133e('0x9')](_0x47417b[_0x1c96ff]))!=-0x1){_0x2e8179=_0x47417b[_0x1c96ff];_0x2c6fc4=_0x321ed4[_0x133e('0xa')](0x0,_0x15435d);_0x321ed4=_0x321ed4[_0x133e('0xa')](_0x15435d+_0x2e8179[_0x133e('0xb')]);var _0x201dd1=_0x2c6fc4['split'](_0x4c0286),_0x2c3333=0x0,_0x301a8b={},_0x2192f0='',_0x256005='',_0x12714d=-0x1;while(_0x201dd1[_0x2c3333]){_0x12714d=_0x201dd1[_0x2c3333][_0x133e('0x9')](':');if(_0x12714d!=-0x1){_0x2192f0=_0x201dd1[_0x2c3333][_0x133e('0xc')](0x0,_0x12714d)[_0x133e('0xd')]();_0x256005=_0x201dd1[_0x2c3333][_0x133e('0xc')](_0x12714d+0x1)[_0x133e('0xd')]();if(_0x2192f0[_0x133e('0xb')]>0x0){_0x301a8b[_0x2192f0]=_0x256005;}}else{}_0x2c3333++;}this['emit']('headers',_0x301a8b);this[_0x133e('0x4')]=!![];}_0x1c96ff++;}this['_localBuffer']=_0x321ed4;}else{while((_0x135836=_0x321ed4[_0x133e('0x9')](_0x4c0286))!=-0x1){_0x2c6fc4=_0x321ed4['substring'](0x0,_0x135836);this[_0x133e('0xe')]('line',_0x2c6fc4);_0x321ed4=_0x321ed4['substring'](_0x135836+_0x4c0286['length']);}this[_0x133e('0xf')]=_0x321ed4;}_0x47ba68();};module[_0x133e('0x10')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index deb3041..43c919f 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 _0x26a7=['client','http','request','error','catch','ShowSquareProject','production','getMailAccountById','Smtp','getSquareProjectById','name','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','agentUnpause','UnpauseUser','bluebird','moment','lodash','util','jayson/promise'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x26a7,0x6d));var _0x726a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x26a7[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x726a('0x0'));var moment=require(_0x726a('0x1'));var _=require(_0x726a('0x2'));var util=require(_0x726a('0x3'));var jayson=require(_0x726a('0x4'));var client=jayson[_0x726a('0x5')][_0x726a('0x6')]({'port':0x2329});function request(_0x452af0,_0x137e6c){return new BPromise(function(_0x382c09,_0x2b43f3){return client[_0x726a('0x7')](_0x452af0,_0x137e6c)['then'](function(_0x8b1396){if(_0x8b1396[_0x726a('0x8')]){return _0x2b43f3(_0x8b1396[_0x726a('0x8')]['message']);}else{return _0x382c09(_0x8b1396['result']);}})[_0x726a('0x9')](function(_0x5c16b3){return _0x2b43f3(_0x5c16b3);});});}exports['getSquareProject']=function(_0x479c2a){return request(_0x726a('0xa'),{'options':{'raw':![],'where':{'name':_0x479c2a},'attributes':[_0x726a('0xb')]}});};exports[_0x726a('0xc')]=function(_0x363668){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x363668},'include':[{'model':'MailServerOut','as':_0x726a('0xd')}],'attributes':['id','name','email']}});};exports[_0x726a('0xe')]=function(_0x38ac4e){return request('ShowSquareProject',{'options':{'where':{'id':_0x38ac4e},'attributes':[_0x726a('0xf')]}});};exports[_0x726a('0x10')]=function(_0x4e653c){return request(_0x726a('0x11'),{'options':{'where':{'id':_0x4e653c},'attributes':[_0x726a('0xf')]}});};exports[_0x726a('0x12')]=function(_0x203068){return request('ShowVariable',{'options':{'where':{'id':_0x203068},'attributes':[_0x726a('0xf')]}});};exports[_0x726a('0x13')]=function(_0x3c2c27){return request(_0x726a('0x14'),{'options':{'where':{'id':_0x3c2c27},'attributes':[_0x726a('0x15')]}});};exports[_0x726a('0x16')]=function(_0x14e587){return request(_0x726a('0x17'),{'options':{'where':{'id':_0x14e587},'attributes':['name']}});};exports[_0x726a('0x18')]=function(_0x3ce413){return request(_0x726a('0x19'),{'options':{'where':{'id':_0x3ce413},'attributes':[_0x726a('0xf')]}});};exports['getSoundById']=function(_0x4de4fd){return request(_0x726a('0x1a'),{'options':{'where':{'id':_0x4de4fd},'attributes':[_0x726a('0x1b')]}});};exports[_0x726a('0x1c')]=function(_0x2146f4){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x2146f4},'include':[{'model':_0x726a('0x1d'),'as':_0x726a('0x1e')}]}});};exports[_0x726a('0x1f')]=function(_0x383165){return request(_0x726a('0x20'),{'options':{'where':{'id':_0x383165},'attributes':['id','name']}});};exports[_0x726a('0x21')]=function(_0x30f306){return request(_0x726a('0x22'),{'body':_0x30f306});};exports['createSquareDetailsReport']=function(_0x508a3b){return request(_0x726a('0x23'),{'body':_0x508a3b});};exports[_0x726a('0x24')]=function(_0x5855ed){return request(_0x726a('0x25'),{'body':_[_0x726a('0x26')](_0x5855ed,{'project_name':_0x5855ed['arg_1'],'prev_project_name':_0x5855ed[_0x726a('0x27')]||'','is_subproject':_0x5855ed[_0x726a('0x27')]?!![]:![],'leaveAt':moment()[_0x726a('0x28')](_0x726a('0x29'))})});};exports[_0x726a('0x2a')]=function(_0x1857f8){return request('CreateSquareRecording',{'body':_0x1857f8});};exports[_0x726a('0x2b')]=function(_0x304e67){return request(_0x726a('0x2c'),{'body':_0x304e67});};exports[_0x726a('0x2d')]=function(_0xc53a13){return request(_0x726a('0x2e'),{'options':{'raw':![],'where':{'phone':_0xc53a13[_0x726a('0x2f')],'ListId':_0xc53a13[_0x726a('0x30')]}}})[_0x726a('0x31')](function(_0x531609){if(_0x531609){return _0x531609;}return request(_0x726a('0x32'),{'body':_0xc53a13});});};exports[_0x726a('0x33')]=function(_0x538002){return request(_0x726a('0x34'),{'options':{'where':{'id':_0x538002},'attributes':[_0x726a('0xf')]}});};exports[_0x726a('0x35')]=function(_0xe21d2,_0x53963e){return request('LoginUser',{'body':{'interface':_0x53963e},'options':{'where':_0xe21d2}});};exports[_0x726a('0x36')]=function(_0x28b536,_0x5f5341,_0x4f8718){return request('PauseUser',{'body':{'type':_0x5f5341,'uniqueid':_0x4f8718},'options':{'where':_0x28b536}});};exports[_0x726a('0x37')]=function(_0x284d8a){return request(_0x726a('0x38'),{'body':{},'options':{'where':_0x284d8a}});};exports['agentLogout']=function(_0x140891){return request('LogoutUser',{'body':{},'options':{'where':_0x140891}});}; \ No newline at end of file +var _0x6140=['dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','createCmContact','ListId','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','agentUnpause','agentLogout','bluebird','moment','lodash','util','jayson/promise','client','http','request','then','error','message','result','catch','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowSquareOdbc'];(function(_0x4b289f,_0x319a3f){var _0x54f9e6=function(_0x41a892){while(--_0x41a892){_0x4b289f['push'](_0x4b289f['shift']());}};_0x54f9e6(++_0x319a3f);}(_0x6140,0x100));var _0x0614=function(_0x1d2ca4,_0x469af6){_0x1d2ca4=_0x1d2ca4-0x0;var _0x35398a=_0x6140[_0x1d2ca4];return _0x35398a;};'use strict';var BPromise=require(_0x0614('0x0'));var moment=require(_0x0614('0x1'));var _=require(_0x0614('0x2'));var util=require(_0x0614('0x3'));var jayson=require(_0x0614('0x4'));var client=jayson[_0x0614('0x5')][_0x0614('0x6')]({'port':0x2329});function request(_0x3ca9e9,_0x4f5311){return new BPromise(function(_0x2531d7,_0x888e12){return client[_0x0614('0x7')](_0x3ca9e9,_0x4f5311)[_0x0614('0x8')](function(_0x1fc3e4){if(_0x1fc3e4[_0x0614('0x9')]){return _0x888e12(_0x1fc3e4[_0x0614('0x9')][_0x0614('0xa')]);}else{return _0x2531d7(_0x1fc3e4[_0x0614('0xb')]);}})[_0x0614('0xc')](function(_0xe002f1){return _0x888e12(_0xe002f1);});});}exports['getSquareProject']=function(_0xe8b976){return request(_0x0614('0xd'),{'options':{'raw':![],'where':{'name':_0xe8b976},'attributes':['production']}});};exports[_0x0614('0xe')]=function(_0x2263b1){return request(_0x0614('0xf'),{'options':{'raw':![],'where':{'id':_0x2263b1},'include':[{'model':_0x0614('0x10'),'as':_0x0614('0x11')}],'attributes':['id',_0x0614('0x12'),_0x0614('0x13')]}});};exports[_0x0614('0x14')]=function(_0x34f883){return request(_0x0614('0xd'),{'options':{'where':{'id':_0x34f883},'attributes':[_0x0614('0x12')]}});};exports['getVoiceQueueById']=function(_0xc32491){return request(_0x0614('0x15'),{'options':{'where':{'id':_0xc32491},'attributes':['name']}});};exports[_0x0614('0x16')]=function(_0x4f200e){return request('ShowVariable',{'options':{'where':{'id':_0x4f200e},'attributes':[_0x0614('0x12')]}});};exports['getSquareOdbcById']=function(_0x157f62){return request(_0x0614('0x17'),{'options':{'where':{'id':_0x157f62},'attributes':[_0x0614('0x18')]}});};exports[_0x0614('0x19')]=function(_0x4f0baa){return request(_0x0614('0x1a'),{'options':{'where':{'id':_0x4f0baa},'attributes':[_0x0614('0x12')]}});};exports[_0x0614('0x1b')]=function(_0x217fb6){return request(_0x0614('0x1c'),{'options':{'where':{'id':_0x217fb6},'attributes':[_0x0614('0x12')]}});};exports[_0x0614('0x1d')]=function(_0x2f3312){return request('ShowSound',{'options':{'where':{'id':_0x2f3312},'attributes':[_0x0614('0x1e')]}});};exports['getIntervalById']=function(_0x40ee7d){return request(_0x0614('0x1f'),{'options':{'raw':![],'where':{'id':_0x40ee7d},'include':[{'model':_0x0614('0x20'),'as':_0x0614('0x21')}]}});};exports[_0x0614('0x22')]=function(_0x28e0bd){return request('ShowSmsAccount',{'options':{'where':{'id':_0x28e0bd},'attributes':['id','name']}});};exports[_0x0614('0x23')]=function(_0x1b636f){return request(_0x0614('0x24'),{'body':_0x1b636f});};exports[_0x0614('0x25')]=function(_0x38267e){return request(_0x0614('0x26'),{'body':_0x38267e});};exports[_0x0614('0x27')]=function(_0x4bb390){return request('CreateSquareReport',{'body':_[_0x0614('0x28')](_0x4bb390,{'project_name':_0x4bb390[_0x0614('0x29')],'prev_project_name':_0x4bb390[_0x0614('0x2a')]||'','is_subproject':_0x4bb390[_0x0614('0x2a')]?!![]:![],'leaveAt':moment()['format'](_0x0614('0x2b'))})});};exports[_0x0614('0x2c')]=function(_0x2b491c){return request(_0x0614('0x2d'),{'body':_0x2b491c});};exports['createSquareMessage']=function(_0x4bbafc){return request(_0x0614('0x2e'),{'body':_0x4bbafc});};exports[_0x0614('0x2f')]=function(_0x50e8b3){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x50e8b3['phone'],'ListId':_0x50e8b3[_0x0614('0x30')]}}})[_0x0614('0x8')](function(_0x1651a1){if(_0x1651a1){return _0x1651a1;}return request(_0x0614('0x31'),{'body':_0x50e8b3});});};exports['getPauseById']=function(_0x2cbf6e){return request(_0x0614('0x32'),{'options':{'where':{'id':_0x2cbf6e},'attributes':[_0x0614('0x12')]}});};exports[_0x0614('0x33')]=function(_0x426266,_0x1351d0){return request(_0x0614('0x34'),{'body':{'interface':_0x1351d0},'options':{'where':_0x426266}});};exports[_0x0614('0x35')]=function(_0x29bbcd,_0xe7ecab,_0x128950){return request('PauseUser',{'body':{'type':_0xe7ecab,'uniqueid':_0x128950},'options':{'where':_0x29bbcd}});};exports[_0x0614('0x36')]=function(_0x3f53d8){return request('UnpauseUser',{'body':{},'options':{'where':_0x3f53d8}});};exports[_0x0614('0x37')]=function(_0x10b212){return request('LogoutUser',{'body':{},'options':{'where':_0x10b212}});}; \ 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 24c5d75..5aebf38 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 _0x1574=['exports','./polly','./lex'];(function(_0xb9e60,_0x3ef372){var _0x5458f7=function(_0x35a798){while(--_0x35a798){_0xb9e60['push'](_0xb9e60['shift']());}};_0x5458f7(++_0x3ef372);}(_0x1574,0x148));var _0x4157=function(_0x1034c3,_0x2357d6){_0x1034c3=_0x1034c3-0x0;var _0x4a99f9=_0x1574[_0x1034c3];return _0x4a99f9;};var polly=require(_0x4157('0x0'));var lex=require(_0x4157('0x1'));module[_0x4157('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xc051=['./lex','./polly'];(function(_0x2abd9b,_0x13f489){var _0x2e55a8=function(_0x108b7f){while(--_0x108b7f){_0x2abd9b['push'](_0x2abd9b['shift']());}};_0x2e55a8(++_0x13f489);}(_0xc051,0xb5));var _0x1c05=function(_0x17e75b,_0x1cdd89){_0x17e75b=_0x17e75b-0x0;var _0x1af7d5=_0xc051[_0x17e75b];return _0x1af7d5;};var polly=require(_0x1c05('0x0'));var lex=require(_0x1c05('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 5d9137c..a2cde5a 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x1c27bb,_0x4a4906,_0x3f643d,_0x306b6e,_0x2221f1,_0x10d2c4){return lex(_0x1c27bb,_0x4a4906,_0x3f643d,_0x306b6e,_0x2221f1,_0x10d2c4);}; \ No newline at end of file +var _0xa75b=['./lib/api'];(function(_0x119469,_0x3ed60e){var _0x43c2d7=function(_0x46db06){while(--_0x46db06){_0x119469['push'](_0x119469['shift']());}};_0x43c2d7(++_0x3ed60e);}(_0xa75b,0x170));var _0xba75=function(_0x55ed4e,_0x4811bd){_0x55ed4e=_0x55ed4e-0x0;var _0xbb73bb=_0xa75b[_0x55ed4e];return _0xbb73bb;};'use strict';var lex=require(_0xba75('0x0'));module['exports']=function(_0x546e14,_0x10c0dd,_0x39dc19,_0x17b666,_0x3cde96,_0x1760c0){return lex(_0x546e14,_0x10c0dd,_0x39dc19,_0x17b666,_0x3cde96,_0x1760c0);}; \ 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 f5c4313..b907e19 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(_0x2e7eb3,_0x454e52){var _0x48fb81=function(_0xfa4565){while(--_0xfa4565){_0x2e7eb3['push'](_0x2e7eb3['shift']());}};_0x48fb81(++_0x454e52);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x436ae5,_0x2270a7){var _0x105b24=function(_0x1c27bb){while(--_0x1c27bb){_0x436ae5['push'](_0x436ae5['shift']());}};_0x105b24(++_0x2270a7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 f637649..114e148 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 _0xb967=['exports','./lib/api'];(function(_0x4e4a3f,_0x42009f){var _0x3b2b12=function(_0x4e1aa5){while(--_0x4e1aa5){_0x4e4a3f['push'](_0x4e4a3f['shift']());}};_0x3b2b12(++_0x42009f);}(_0xb967,0x155));var _0x7b96=function(_0x5de24c,_0x1550d6){_0x5de24c=_0x5de24c-0x0;var _0x3b808a=_0xb967[_0x5de24c];return _0x3b808a;};'use strict';var polly=require(_0x7b96('0x0'));module[_0x7b96('0x1')]=function(_0x54bb60,_0x476ea6,_0x2176a7,_0xdd022e,_0xbebe67,_0x47b3b5,_0x10e762){return polly(_0x54bb60,_0x476ea6,_0x2176a7,_0xdd022e,_0xbebe67,_0x47b3b5,_0x10e762);}; \ No newline at end of file +var _0x8a04=['exports','./lib/api'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x8a04,0x1a1));var _0x48a0=function(_0x1f9edb,_0x120d6d){_0x1f9edb=_0x1f9edb-0x0;var _0x4074d9=_0x8a04[_0x1f9edb];return _0x4074d9;};'use strict';var polly=require(_0x48a0('0x0'));module[_0x48a0('0x1')]=function(_0x1f4cc4,_0x37ec0f,_0x117fc9,_0x3cf03d,_0x56c675,_0x1c1d54,_0x2642bf){return polly(_0x1f4cc4,_0x37ec0f,_0x117fc9,_0x3cf03d,_0x56c675,_0x1c1d54,_0x2642bf);}; \ 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 017a5e5..7932e0c 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 _0x852a=['synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','mp3','bluebird','aws-sdk'];(function(_0x2730da,_0x1098bd){var _0xfe9991=function(_0x2ea521){while(--_0x2ea521){_0x2730da['push'](_0x2730da['shift']());}};_0xfe9991(++_0x1098bd);}(_0x852a,0x1de));var _0xa852=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x852a[_0x54d4a8];return _0x3b321b;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xa852('0x0'));var rs=require('randomstring');var AWS=require(_0xa852('0x1'));function pollyResult(_0x11a988,_0xb9de62,_0x1242c5){return new BPromise(function(_0x7b5f7d,_0x17f7f2){_0x11a988[_0xa852('0x2')](_0xb9de62,function(_0x5ad9e4,_0x3014ac){if(_0x5ad9e4){_0x17f7f2(_0x5ad9e4);}else if(_0x3014ac){if(_0x3014ac[_0xa852('0x3')]instanceof Buffer){fs[_0xa852('0x4')](_0x1242c5,_0x3014ac[_0xa852('0x3')],function(_0x2914e1){if(_0x2914e1){_0x17f7f2(_0x2914e1);}else{_0x7b5f7d();}});}else{_0x17f7f2(new Error(_0xa852('0x5')));}}else{_0x17f7f2(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xa852('0x6')]=function(_0x22a103,_0x25b2d8,_0x490cce,_0x5b1759,_0x281f81,_0x328046,_0x28c38e){var _0x1ca5a9=new AWS['Polly']({'accessKeyId':_0x22a103,'secretAccessKey':_0x25b2d8,'region':_0x490cce});var _0x47c97a={'Text':_0x281f81,'TextType':_0x328046||'text','OutputFormat':_0xa852('0x7'),'VoiceId':_0x5b1759};return pollyResult(_0x1ca5a9,_0x47c97a,_0x28c38e);}; \ No newline at end of file +var _0xc033=['AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','randomstring','aws-sdk','synthesizeSpeech','writeFile'];(function(_0x3191af,_0x28de45){var _0x205b02=function(_0x18a8ca){while(--_0x18a8ca){_0x3191af['push'](_0x3191af['shift']());}};_0x205b02(++_0x28de45);}(_0xc033,0x150));var _0x3c03=function(_0x5a08c1,_0x55ddac){_0x5a08c1=_0x5a08c1-0x0;var _0x4db2e1=_0xc033[_0x5a08c1];return _0x4db2e1;};'use strict';var fs=require('fs');var path=require(_0x3c03('0x0'));var BPromise=require('bluebird');var rs=require(_0x3c03('0x1'));var AWS=require(_0x3c03('0x2'));function pollyResult(_0x4482e3,_0x575b70,_0x4e5ebb){return new BPromise(function(_0xc1e68c,_0x5ac8de){_0x4482e3[_0x3c03('0x3')](_0x575b70,function(_0x9c61aa,_0x3baf8e){if(_0x9c61aa){_0x5ac8de(_0x9c61aa);}else if(_0x3baf8e){if(_0x3baf8e['AudioStream']instanceof Buffer){fs[_0x3c03('0x4')](_0x4e5ebb,_0x3baf8e[_0x3c03('0x5')],function(_0x4b5153){if(_0x4b5153){_0x5ac8de(_0x4b5153);}else{_0xc1e68c();}});}else{_0x5ac8de(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x5ac8de(new Error(_0x3c03('0x6')));}});});}module[_0x3c03('0x7')]=function(_0x459878,_0x2f74bb,_0x149777,_0x47e336,_0xa34d5f,_0x398376,_0x5efcad){var _0x3c51d4=new AWS[(_0x3c03('0x8'))]({'accessKeyId':_0x459878,'secretAccessKey':_0x2f74bb,'region':_0x149777});var _0x4ec7d4={'Text':_0xa34d5f,'TextType':_0x398376||_0x3c03('0x9'),'OutputFormat':_0x3c03('0xa'),'VoiceId':_0x47e336};return pollyResult(_0x3c51d4,_0x4ec7d4,_0x5efcad);}; \ 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 3d7d114..1e07319 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 _0x7480=['./lib/api','exports'];(function(_0x55d76f,_0x3ec4e8){var _0x27f726=function(_0x5ccf34){while(--_0x5ccf34){_0x55d76f['push'](_0x55d76f['shift']());}};_0x27f726(++_0x3ec4e8);}(_0x7480,0x1a4));var _0x0748=function(_0x1ea0ba,_0x2a1be4){_0x1ea0ba=_0x1ea0ba-0x0;var _0x104d97=_0x7480[_0x1ea0ba];return _0x104d97;};'use strict';var asr=require(_0x0748('0x0'));module[_0x0748('0x1')]=function(_0x97f5fd,_0x37340e,_0x2dd5d0,_0x14d740){return asr(_0x97f5fd,_0x37340e,_0x2dd5d0);}; \ No newline at end of file +var _0xaea9=['./lib/api','exports'];(function(_0x2e5894,_0x20484b){var _0x4fc97f=function(_0x535ec6){while(--_0x535ec6){_0x2e5894['push'](_0x2e5894['shift']());}};_0x4fc97f(++_0x20484b);}(_0xaea9,0x1a6));var _0x9aea=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xaea9[_0x6131cd];return _0x47e916;};'use strict';var asr=require(_0x9aea('0x0'));module[_0x9aea('0x1')]=function(_0xe57b6,_0x59d478,_0x59dcde,_0x271529){return asr(_0xe57b6,_0x59d478,_0x59dcde);}; \ 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 72336b6..c85e737 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 _0x4876=['LINEAR16','8000','https://speech.googleapis.com','string','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','length','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key='];(function(_0x409bec,_0x7f05f1){var _0x255690=function(_0x24c4d7){while(--_0x24c4d7){_0x409bec['push'](_0x409bec['shift']());}};_0x255690(++_0x7f05f1);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0x6487('0x0');module['exports']=function(_0x502614,_0x236189,_0x498e31){return new BPromise(function(_0x43e7e8,_0x2bace9){var _0x192d3c;if(typeof _0x502614!==_0x6487('0x1')||_0x502614['length']===0x0){return _0x2bace9(_0x6487('0x2'));}if(typeof _0x236189!==_0x6487('0x1')||_0x236189['length']===0x0){return _0x2bace9(_0x6487('0x3'));}if(typeof _0x498e31!==_0x6487('0x4')&&(typeof _0x498e31!==_0x6487('0x1')||_0x498e31[_0x6487('0x5')]===0x0)){return _0x2bace9(_0x6487('0x6'));}try{_0x192d3c=fs[_0x6487('0x7')](_0x502614)[_0x6487('0x8')](_0x6487('0x9'));}catch(_0x5f8f96){return _0x2bace9(_0x5f8f96);}return _0x43e7e8({'method':'POST','uri':host+_0x6487('0xa')+_0x236189,'body':{'config':{'encoding':_0x6487('0xb'),'sampleRateHertz':_0x6487('0xc'),'languageCode':_0x498e31},'audio':{'content':_0x192d3c}},'json':!![]});});}; \ No newline at end of file +var _0x3df4=['readFileSync','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','string','lang\x20should\x20be\x20a\x20string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3df4,0x102));var _0x43df=function(_0x3b1c8e,_0x4cfa51){_0x3b1c8e=_0x3b1c8e-0x0;var _0x584900=_0x3df4[_0x3b1c8e];return _0x584900;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0x43df('0x0');module[_0x43df('0x1')]=function(_0x40bf18,_0x206707,_0x38a050){return new BPromise(function(_0x2985bf,_0x4297f4){var _0x5affd4;if(typeof _0x40bf18!=='string'||_0x40bf18[_0x43df('0x2')]===0x0){return _0x4297f4(_0x43df('0x3'));}if(typeof _0x206707!==_0x43df('0x4')||_0x206707[_0x43df('0x2')]===0x0){return _0x4297f4('key\x20should\x20be\x20a\x20string');}if(typeof _0x38a050!=='undefined'&&(typeof _0x38a050!==_0x43df('0x4')||_0x38a050[_0x43df('0x2')]===0x0)){return _0x4297f4(_0x43df('0x5'));}try{_0x5affd4=fs[_0x43df('0x6')](_0x40bf18)['toString'](_0x43df('0x7'));}catch(_0x4c5eaf){return _0x4297f4(_0x4c5eaf);}return _0x2985bf({'method':_0x43df('0x8'),'uri':host+_0x43df('0x9')+_0x206707,'body':{'config':{'encoding':_0x43df('0xa'),'sampleRateHertz':_0x43df('0xb'),'languageCode':_0x38a050},'audio':{'content':_0x5affd4}},'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 2e120ba..7ffc2a0 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 _0x7005=['./asr','exports'];(function(_0x404f13,_0x4fa35f){var _0x1f9dbb=function(_0x492b33){while(--_0x492b33){_0x404f13['push'](_0x404f13['shift']());}};_0x1f9dbb(++_0x4fa35f);}(_0x7005,0x1c6));var _0x5700=function(_0x40db5e,_0x558b02){_0x40db5e=_0x40db5e-0x0;var _0x39f285=_0x7005[_0x40db5e];return _0x39f285;};var asr=require(_0x5700('0x0'));module[_0x5700('0x1')]={'asr':asr}; \ No newline at end of file +var _0x19c3=['exports','./asr'];(function(_0x301b16,_0x54c74d){var _0x9e7eeb=function(_0x533698){while(--_0x533698){_0x301b16['push'](_0x301b16['shift']());}};_0x9e7eeb(++_0x54c74d);}(_0x19c3,0xd9));var _0x319c=function(_0x3c9125,_0x24781c){_0x3c9125=_0x3c9125-0x0;var _0x153a60=_0x19c3[_0x3c9125];return _0x153a60;};var asr=require(_0x319c('0x0'));module[_0x319c('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 aacb313..625c191 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 _0x99e5=['allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','dirName','apiai-promise','bluebird','dialogflow','https','path','querystring','request-promise','randomstring','sox','google-tts-api','parse','./google','./sestek','agi','https://api.ispeech.org/api/rest','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','statusMessage','\x20failed,\x20status\x20code\x20=\x20','finish','info','finish\x20download\x20file','close','download\x20error','pipe','end','protocol','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','unlink','chmodSync','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','text:synthesize','POST','then','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','data','length','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','source','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','status','metadata','endConversation','isFallbackIntent','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x99e5,0xa8));var _0x599e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x99e5[_0x2d8fc2];return _0x3a9e53;};'use strict';var apiai=require(_0x599e('0x0'));var BPromise=require(_0x599e('0x1'));var dialogflow=require(_0x599e('0x2'));var fs=require('fs');var http=require('http');var https=require(_0x599e('0x3'));var md5=require('md5');var path=require(_0x599e('0x4'));var querystring=require(_0x599e('0x5'));var rp=require(_0x599e('0x6'));var rs=require(_0x599e('0x7'));var sox=require(_0x599e('0x8'));var tts=require(_0x599e('0x9'));var urlParse=require('url')[_0x599e('0xa')];var util=require('util');var aws=require('./aws');var google=require(_0x599e('0xb'));var sestek=require(_0x599e('0xc'));var tilde=require('./tilde');var logger=require('../../../config/logger')(_0x599e('0xd'));var ISPEECH_API=_0x599e('0xe');function downloadFile(_0x39898f,_0x347fed){return new BPromise(function(_0x34c912,_0x465f8e){var _0x50e8c0=urlParse(_0x39898f);var _0xc8e4c2=_0x50e8c0['protocol']===_0x599e('0xf')?https:http;var _0x305730={'host':_0x50e8c0[_0x599e('0x10')],'path':_0x50e8c0[_0x599e('0x4')],'headers':{'user-agent':_0x599e('0x11')}};_0xc8e4c2[_0x599e('0x12')](_0x305730,function(_0x1631fa){if(_0x1631fa[_0x599e('0x13')]!==0xc8){logger[_0x599e('0x14')](_0x599e('0x15')+_0x39898f+'\x20failed,\x20status\x20code\x20=\x20'+_0x1631fa[_0x599e('0x13')]+'\x20('+_0x1631fa[_0x599e('0x16')]+')');_0x465f8e(new Error(_0x599e('0x15')+_0x39898f+_0x599e('0x17')+_0x1631fa[_0x599e('0x13')]+'\x20('+_0x1631fa[_0x599e('0x16')]+')'));return;}var _0x288c96=fs['createWriteStream'](_0x347fed);_0x288c96['on'](_0x599e('0x18'),function(){logger[_0x599e('0x19')](_0x599e('0x1a'));_0x288c96[_0x599e('0x1b')](_0x34c912);});_0x288c96['on'](_0x599e('0x14'),function(_0x157ae3){fs['unlink'](_0x347fed);logger[_0x599e('0x14')](_0x599e('0x1c'),_0x157ae3);_0x465f8e(_0x157ae3);});_0x1631fa[_0x599e('0x1d')](_0x288c96);})['on'](_0x599e('0x14'),function(_0x419c23){logger[_0x599e('0x14')](_0x419c23);_0x465f8e(_0x419c23);})[_0x599e('0x1e')]();});}function uploadFile(_0x5a8278){return new BPromise(function(_0x250572,_0x10fa39){var _0x8245dd=urlParse(_0x5a8278);var _0x34e4d5=_0x8245dd[_0x599e('0x1f')]===_0x599e('0xf')?https:http;var _0xf01770={'host':_0x8245dd['host'],'path':_0x8245dd[_0x599e('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x34e4d5[_0x599e('0x12')](_0xf01770,function(_0x2ab34d){if(_0x2ab34d[_0x599e('0x13')]!==0xc8){_0x10fa39(new Error(_0x599e('0x15')+_0x5a8278+_0x599e('0x17')+_0x2ab34d['statusCode']+'\x20('+_0x2ab34d['statusMessage']+')'));return;}var _0x247b9c='';_0x2ab34d['on']('data',function(_0x324e71){_0x247b9c+=_0x324e71;});_0x2ab34d['on'](_0x599e('0x1e'),function(){_0x250572(_0x247b9c);});})['on'](_0x599e('0x14'),function(_0x45f0d8){_0x10fa39(_0x45f0d8);})[_0x599e('0x1e')]();});}function convertFile(_0x9f10ed,_0x5b72ca){return new BPromise(function(_0xc1bff2,_0x3fd752){var _0x4b8164=sox[_0x599e('0x20')](_0x9f10ed,_0x5b72ca,{'sampleRate':0x1f40,'format':_0x599e('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4b8164['on'](_0x599e('0x14'),function(_0x2c7801){logger[_0x599e('0x14')](_0x599e('0x22'),_0x2c7801);_0x3fd752(_0x2c7801);});_0x4b8164['on'](_0x599e('0x1e'),function(){logger[_0x599e('0x19')](_0x599e('0x23'));_0xc1bff2();});_0x4b8164[_0x599e('0x24')]();});}function base64Decode(_0x4b66d9,_0x35747b){var _0x1f554f=path[_0x599e('0x25')](__dirname,_0x599e('0x26'),rs[_0x599e('0x27')](0x4)+_0x599e('0x28'));fs[_0x599e('0x29')](_0x1f554f,_0x4b66d9,_0x599e('0x2a'));return convertFile(_0x1f554f,_0x35747b)['then'](function(){try{fs[_0x599e('0x2b')](_0x1f554f);fs[_0x599e('0x2c')](_0x35747b,_0x599e('0x2d'));}catch(_0x327e5c){logger[_0x599e('0x14')](_0x327e5c);}return _0x35747b[_0x599e('0x2e')]('.')[0x0];});}function base64Encode(_0x22fed6){var _0x247a0f=fs[_0x599e('0x2f')](_0x22fed6);return new Buffer(_0x247a0f)['toString'](_0x599e('0x2a'));}exports[_0x599e('0x30')]=function(_0x59c60d,_0x541f37,_0x2c5922,_0x350a4e,_0xf780cc,_0x5246a4){var _0x10927e,_0x5a22b5;var _0x1b782a=_0x599e('0x31');var _0x555ef2='?key='+_0x59c60d;var _0x5f3659={};if(_0x541f37===_0x599e('0x32')){_0x5f3659[_0x599e('0x33')]={'ssml':_0x2c5922};}else{_0x5f3659['input']={'text':_0x2c5922};};_0x5f3659[_0x599e('0x34')]={'languageCode':_0x350a4e,'ssmlGender':_0xf780cc};_0x5f3659[_0x599e('0x35')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x1aca08={'url':_0x1b782a+_0x599e('0x36')+_0x555ef2,'method':_0x599e('0x37'),'json':!![],'body':_0x5f3659};return rp(_0x1aca08)[_0x599e('0x38')](function(_0x225429){return new BPromise(function(_0x407684,_0x1e0516){_0x10927e=path[_0x599e('0x25')](__dirname,_0x599e('0x26'),rs[_0x599e('0x27')](0x4)+_0x599e('0x39'));var _0x17f098=Buffer[_0x599e('0x3a')](_0x225429[_0x599e('0x3b')],_0x599e('0x2a'));return fs[_0x599e('0x3c')](_0x10927e,_0x17f098,function(_0x25473b){_0x1e0516(_0x25473b);},function(_0x57be43){fs[_0x599e('0x2c')](_0x10927e,_0x599e('0x2d'));_0x407684(_0x57be43);});});})[_0x599e('0x38')](function(_0x31f12b){_0x5a22b5=path[_0x599e('0x25')](__dirname,_0x599e('0x26'),rs[_0x599e('0x27')](0x4)+_0x599e('0x28'));return convertFile(_0x10927e,_0x5a22b5);})[_0x599e('0x38')](function(){try{fs[_0x599e('0x2b')](_0x10927e);fs[_0x599e('0x2c')](_0x5a22b5,_0x599e('0x2d'));}catch(_0x434749){logger[_0x599e('0x14')](_0x434749);}logger[_0x599e('0x19')](_0x599e('0x3d'),_0x5a22b5[_0x599e('0x2e')]('.')[0x0]);return _0x5a22b5[_0x599e('0x2e')]('.')[0x0];});};exports['googleTTS']=function(_0x27952c,_0x2e8984){var _0x1be387=_0x599e('0x3e');var _0x19c984,_0x297e4a;var _0x276bff;var _0x1f85e6={'encoding':_0x599e('0x3f'),'method':_0x599e('0x37'),'timeout':0x2710,'url':_0x1be387,'headers':{'Content-Type':_0x599e('0x40')},'body':_0x599e('0x41')+encodeURIComponent(JSON[_0x599e('0x42')]([[[_0x599e('0x43'),JSON['stringify']([_0x27952c,_0x2e8984||'en',![],_0x599e('0x44')]),null,_0x599e('0x45')]]]))};return rp(_0x1f85e6)[_0x599e('0x38')](function(_0x4a739b){try{_0x276bff=eval(_0x4a739b[_0x599e('0x46')](0x5))[0x0][0x2];}catch(_0x34e307){throw new Error(_0x599e('0x47')+_0x4a739b[_0x599e('0x48')]);}if(!_0x276bff){if(_0x27952c[_0x599e('0x49')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error('lang\x20\x22'+_0x2e8984+'\x22\x20might\x20not\x20exist');}}try{_0x276bff=eval(_0x276bff)[0x0];}catch(_0x47705c){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x13b68d=_0x276bff;_0x19c984=path[_0x599e('0x25')](__dirname,_0x599e('0x26'),rs[_0x599e('0x27')](0x4)+_0x599e('0x39'));fs[_0x599e('0x29')](_0x19c984,_0x276bff,{'encoding':_0x599e('0x2a')});_0x297e4a=path['resolve'](__dirname,_0x599e('0x26'),rs[_0x599e('0x27')](0x4)+'.wav');return convertFile(_0x19c984,_0x297e4a);})['then'](function(){try{fs['unlink'](_0x19c984);fs[_0x599e('0x2c')](_0x297e4a,_0x599e('0x2d'));}catch(_0x4f854b){logger[_0x599e('0x14')](_0x4f854b);}logger['info']('goggleTTS\x20path',_0x297e4a['split']('.')[0x0]);return _0x297e4a['split']('.')[0x0];});};exports[_0x599e('0x4a')]=function(_0x9f59,_0x198abd,_0x5c230e){return google[_0x599e('0x4b')](_0x9f59,_0x198abd,_0x5c230e)['then'](function(_0x166df1){logger[_0x599e('0x19')](_0x166df1['uri']);return rp(_0x166df1);})[_0x599e('0x38')](function(_0x46fa38){var _0x2dec21='';var _0x599b2a=0x0;try{fs['unlink'](_0x9f59);}catch(_0x5c9edd){logger[_0x599e('0x14')](_0x5c9edd);}if(_0x46fa38&&_0x46fa38[_0x599e('0x4c')]){_0x2dec21=_0x46fa38[_0x599e('0x4c')][_0x599e('0x4d')](function(_0x1057d6){return _0x1057d6&&_0x1057d6[_0x599e('0x4e')][0x0]&&_0x1057d6[_0x599e('0x4e')][0x0][_0x599e('0x4f')]?_0x1057d6['alternatives'][0x0][_0x599e('0x4f')]:'';})[_0x599e('0x50')]('\x0a');_0x599b2a=_0x46fa38[_0x599e('0x4c')]['map'](function(_0x87a224){return _0x87a224&&_0x87a224[_0x599e('0x4e')][0x0]&&_0x87a224[_0x599e('0x4e')][0x0][_0x599e('0x51')]?_0x87a224[_0x599e('0x4e')][0x0][_0x599e('0x51')]:0x0;})[_0x599e('0x50')]('\x0a');}logger['info'](_0x599e('0x52'),_0x2dec21);logger['info'](_0x599e('0x53'),_0x599b2a);return{'transcript':_0x2dec21,'confidence':_0x599b2a};})[_0x599e('0x54')](function(_0x4a7270){logger[_0x599e('0x14')]('[%s]\x20%s:%s',_0x4a7270[_0x599e('0x13')],_0x4a7270[_0x599e('0x55')],_0x4a7270[_0x599e('0x56')]);});};exports[_0x599e('0x57')]=function(_0x2aaa78,_0x545ed9,_0x2ab6e2,_0x2ac559){var _0x256b9=apiai(_0x545ed9,{'language':_0x2ac559||'en'});return _0x256b9[_0x599e('0x58')](_0x2ab6e2,{'sessionId':md5(_0x2aaa78)})['then'](function(_0x455fe9){logger['info'](JSON['stringify'](_0x455fe9));return{'source':_0x455fe9['result'][_0x599e('0x59')],'resolvedQuery':_0x455fe9[_0x599e('0x5a')][_0x599e('0x5b')],'action':_0x455fe9[_0x599e('0x5a')][_0x599e('0x5c')],'actionIncomplete':_0x455fe9['result'][_0x599e('0x5d')],'speech':_0x455fe9['result'][_0x599e('0x5e')][_0x599e('0x5f')],'score':_0x455fe9[_0x599e('0x5a')]['score'],'statusCode':_0x455fe9[_0x599e('0x60')]['code'],'endConversation':_0x455fe9[_0x599e('0x5a')][_0x599e('0x61')][_0x599e('0x62')]||![],'isFallbackIntent':_0x455fe9['result'][_0x599e('0x61')][_0x599e('0x63')]};});};exports['googleDialogflowV2']=function(_0x1d82d1,_0x475603,_0x8ecf80,_0x4ea2aa,_0xc3e899,_0x65852c){var _0x250fb6=_0x4ea2aa[_0x599e('0x64')](/\\n/g,'\x0a');var _0x435b4a={'credentials':{'private_key':_0x250fb6,'client_email':_0x8ecf80}};var _0x28996a=new dialogflow[(_0x599e('0x65'))](_0x435b4a);var _0x5173c9=_0x28996a[_0x599e('0x66')](_0x475603,md5(_0x1d82d1));var _0x39de07={'session':_0x5173c9,'queryInput':{'text':{'text':_0xc3e899,'languageCode':_0x65852c}}};return _0x28996a[_0x599e('0x67')](_0x39de07)[_0x599e('0x38')](function(_0x199629){if(_0x199629&&_0x199629[_0x599e('0x49')]){logger[_0x599e('0x19')](_0x599e('0x68'),JSON['stringify'](_0x199629));var _0x53e2e9=_0x199629[0x0];if(_0x53e2e9){var _0x10fb95={'action':_0x53e2e9[_0x599e('0x69')]['action'],'allRequiredParamsPresent':_0x53e2e9[_0x599e('0x69')][_0x599e('0x6a')],'endConversation':_0x53e2e9[_0x599e('0x69')][_0x599e('0x6b')]&&_0x53e2e9[_0x599e('0x69')][_0x599e('0x6b')]['fields']?_0x53e2e9['queryResult'][_0x599e('0x6b')][_0x599e('0x6c')][_0x599e('0x6d')][_0x599e('0x6e')]:![],'fulfillmentText':_0x53e2e9[_0x599e('0x69')][_0x599e('0x6f')],'intentName':_0x53e2e9[_0x599e('0x69')][_0x599e('0x70')][_0x599e('0x55')],'intentDisplayName':_0x53e2e9[_0x599e('0x69')]['intent']['displayName'],'isFallbackIntent':_0x53e2e9[_0x599e('0x69')]['intent'][_0x599e('0x71')],'languageCode':_0x53e2e9['queryResult'][_0x599e('0x72')],'queryText':_0x53e2e9[_0x599e('0x69')][_0x599e('0x73')],'responseId':_0x53e2e9[_0x599e('0x74')],'score':_0x53e2e9[_0x599e('0x69')][_0x599e('0x75')],'speech':_0x53e2e9[_0x599e('0x69')]['fulfillmentText'],'providerResponse':JSON[_0x599e('0x42')](_0x199629)};return _0x10fb95;}}});};exports['tildeASR']=function(_0x1034d6,_0x2fc388,_0x4df552,_0x34b2f0){return tilde['asr'](_0x1034d6,_0x2fc388,_0x4df552,_0x34b2f0)[_0x599e('0x38')](function(_0x6e2211){try{fs[_0x599e('0x2b')](_0x1034d6);}catch(_0x1776cb){logger[_0x599e('0x14')](_0x1776cb);}logger[_0x599e('0x19')]('Tilde\x20ASR\x20transcription',_0x6e2211[_0x599e('0x4f')]);logger[_0x599e('0x19')](_0x599e('0x76'),_0x6e2211[_0x599e('0x51')]);return _0x6e2211;});};exports[_0x599e('0x77')]=function(_0x42334c,_0x15792d,_0x1bf39f,_0x417b13,_0x595a89,_0x1ab4ce){var _0x1b022e=path[_0x599e('0x25')](__dirname,'tmp',rs[_0x599e('0x27')](0x4)+_0x599e('0x39'));var _0x58c595;return aws[_0x599e('0x78')](_0x42334c,_0x15792d,_0x1bf39f,_0x417b13,_0x595a89,_0x1ab4ce,_0x1b022e)[_0x599e('0x38')](function(){_0x58c595=path[_0x599e('0x25')](__dirname,_0x599e('0x26'),rs[_0x599e('0x27')](0x4)+_0x599e('0x28'));return convertFile(_0x1b022e,_0x58c595);})[_0x599e('0x38')](function(){try{fs[_0x599e('0x2b')](_0x1b022e);fs[_0x599e('0x2c')](_0x58c595,_0x599e('0x2d'));}catch(_0x5ca898){logger['error'](_0x5ca898);}return _0x58c595['split']('.')[0x0];});};exports[_0x599e('0x79')]=function(_0x3f12ac,_0xd4d610,_0x41bf7f,_0x17459b,_0x16afa6,_0x16875d){return aws['lex'](_0x3f12ac,_0xd4d610,_0x41bf7f,_0x17459b,_0x16afa6,_0x16875d)[_0x599e('0x38')](function(_0x2bf3b5){logger[_0x599e('0x19')](JSON['stringify'](_0x2bf3b5));return _0x2bf3b5;});};exports[_0x599e('0x7a')]=function(_0x4cc37e,_0x370a44,_0x575344,_0x5b7d6a){var _0x461131=util[_0x599e('0x7b')](_0x599e('0x7c'),ISPEECH_API,_0x4cc37e,encodeURIComponent(_0x370a44),_0x575344,_0x5b7d6a);var _0x209932=path['resolve'](__dirname,_0x599e('0x26'),rs[_0x599e('0x27')](0x4)+_0x599e('0x39'));var _0x3b7b74;return downloadFile(_0x461131,_0x209932)['then'](function(){_0x3b7b74=path['resolve'](__dirname,'tmp',rs[_0x599e('0x27')](0x4)+'.wav');return convertFile(_0x209932,_0x3b7b74);})[_0x599e('0x38')](function(){try{fs[_0x599e('0x2b')](_0x209932);fs[_0x599e('0x2c')](_0x3b7b74,_0x599e('0x2d'));}catch(_0x311b42){logger['error'](_0x311b42);}return _0x3b7b74['split']('.')[0x0];});};exports[_0x599e('0x7d')]=function(_0x47d76f,_0x25ea22,_0x2b9906,_0x1d422e){var _0x28e911=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x25ea22,_0x2b9906,base64Encode(_0x47d76f),_0x1d422e?util[_0x599e('0x7b')](_0x599e('0x7e'),encodeURIComponent(_0x1d422e)):_0x599e('0x7f'));return uploadFile(_0x28e911)[_0x599e('0x38')](function(_0x410e51){return querystring['parse'](_0x410e51);});};exports[_0x599e('0x80')]=function(_0x2cac5a,_0x29763c){return sestek[_0x599e('0x81')](_0x2cac5a,_0x29763c)['then'](function(_0x4b8427){logger[_0x599e('0x19')](JSON[_0x599e('0x42')](_0x4b8427));var _0x39ec3d={'speech':_0x4b8427[_0x599e('0x82')],'action':_0x4b8427[_0x599e('0x83')]?_0x4b8427[_0x599e('0x83')][_0x599e('0x84')]:undefined,'actiondata':_0x4b8427[_0x599e('0x83')]?_0x4b8427['channelData'][_0x599e('0x85')]:undefined};if(_0x4b8427[_0x599e('0x83')]&&_0x4b8427[_0x599e('0x83')][_0x599e('0x86')]){return base64Decode(_0x4b8427[_0x599e('0x83')][_0x599e('0x86')][_0x599e('0x87')],path[_0x599e('0x25')](__dirname,_0x599e('0x26'),rs['generate'](0x4)+'.wav'))['then'](function(_0x1183bc){_0x39ec3d['audiofile']=_0x1183bc;return _0x39ec3d;});}return _0x39ec3d;});};exports[_0x599e('0x88')]=function(){return __dirname;}; \ No newline at end of file +var _0x24fb=['slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','textRequest','result','source','resolvedQuery','action','fulfillment','speech','score','status','code','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','sessionPath','length','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','languageCode','queryText','responseId','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','ispeechTTS','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','parse','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','dialogflow','http','path','request-promise','randomstring','sox','url','./google','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish\x20download\x20file','error','unlink','pipe','end','https:','data','transcode','wav','error\x20convert','info','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','base64','then','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','MP3','text:synthesize','.mp3','from','audioContent','writeFile','777','chmodSync','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','stringify','jQ1olc','null','generic'];(function(_0xeee863,_0x3ab87e){var _0x35b4c3=function(_0x39c03e){while(--_0x39c03e){_0xeee863['push'](_0xeee863['shift']());}};_0x35b4c3(++_0x3ab87e);}(_0x24fb,0xc9));var _0xb24f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x24fb[_0x14add3];return _0x4a174f;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require(_0xb24f('0x0'));var fs=require('fs');var http=require(_0xb24f('0x1'));var https=require('https');var md5=require('md5');var path=require(_0xb24f('0x2'));var querystring=require('querystring');var rp=require(_0xb24f('0x3'));var rs=require(_0xb24f('0x4'));var sox=require(_0xb24f('0x5'));var tts=require('google-tts-api');var urlParse=require(_0xb24f('0x6'))['parse'];var util=require('util');var aws=require('./aws');var google=require(_0xb24f('0x7'));var sestek=require('./sestek');var tilde=require(_0xb24f('0x8'));var logger=require(_0xb24f('0x9'))('agi');var ISPEECH_API=_0xb24f('0xa');function downloadFile(_0x2c3b87,_0x324fab){return new BPromise(function(_0x3d5d87,_0x355391){var _0x4b9416=urlParse(_0x2c3b87);var _0x42975f=_0x4b9416[_0xb24f('0xb')]==='https:'?https:http;var _0x292ef8={'host':_0x4b9416[_0xb24f('0xc')],'path':_0x4b9416['path'],'headers':{'user-agent':_0xb24f('0xd')}};_0x42975f[_0xb24f('0xe')](_0x292ef8,function(_0x597fab){if(_0x597fab['statusCode']!==0xc8){logger['error'](_0xb24f('0xf')+_0x2c3b87+_0xb24f('0x10')+_0x597fab[_0xb24f('0x11')]+'\x20('+_0x597fab[_0xb24f('0x12')]+')');_0x355391(new Error('request\x20to\x20'+_0x2c3b87+_0xb24f('0x10')+_0x597fab[_0xb24f('0x11')]+'\x20('+_0x597fab[_0xb24f('0x12')]+')'));return;}var _0x20da4e=fs[_0xb24f('0x13')](_0x324fab);_0x20da4e['on']('finish',function(){logger['info'](_0xb24f('0x14'));_0x20da4e['close'](_0x3d5d87);});_0x20da4e['on'](_0xb24f('0x15'),function(_0x245341){fs[_0xb24f('0x16')](_0x324fab);logger[_0xb24f('0x15')]('download\x20error',_0x245341);_0x355391(_0x245341);});_0x597fab[_0xb24f('0x17')](_0x20da4e);})['on'](_0xb24f('0x15'),function(_0xcbf621){logger[_0xb24f('0x15')](_0xcbf621);_0x355391(_0xcbf621);})[_0xb24f('0x18')]();});}function uploadFile(_0x2fdb53){return new BPromise(function(_0x4a5420,_0x50fc09){var _0x2a5b16=urlParse(_0x2fdb53);var _0x23d68c=_0x2a5b16[_0xb24f('0xb')]===_0xb24f('0x19')?https:http;var _0x44bf0f={'host':_0x2a5b16[_0xb24f('0xc')],'path':_0x2a5b16['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x23d68c['get'](_0x44bf0f,function(_0x2124b2){if(_0x2124b2[_0xb24f('0x11')]!==0xc8){_0x50fc09(new Error(_0xb24f('0xf')+_0x2fdb53+'\x20failed,\x20status\x20code\x20=\x20'+_0x2124b2['statusCode']+'\x20('+_0x2124b2['statusMessage']+')'));return;}var _0x536678='';_0x2124b2['on'](_0xb24f('0x1a'),function(_0x525692){_0x536678+=_0x525692;});_0x2124b2['on'](_0xb24f('0x18'),function(){_0x4a5420(_0x536678);});})['on'](_0xb24f('0x15'),function(_0x3664b6){_0x50fc09(_0x3664b6);})['end']();});}function convertFile(_0x3745c7,_0x2dd6e0){return new BPromise(function(_0x5c2022,_0xc2aa8c){var _0x48c512=sox[_0xb24f('0x1b')](_0x3745c7,_0x2dd6e0,{'sampleRate':0x1f40,'format':_0xb24f('0x1c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x48c512['on']('error',function(_0x28dbf0){logger[_0xb24f('0x15')](_0xb24f('0x1d'),_0x28dbf0);_0xc2aa8c(_0x28dbf0);});_0x48c512['on'](_0xb24f('0x18'),function(){logger[_0xb24f('0x1e')](_0xb24f('0x1f'));_0x5c2022();});_0x48c512['start']();});}function base64Decode(_0x5ee688,_0x25df7d){var _0x4651ba=path[_0xb24f('0x20')](__dirname,_0xb24f('0x21'),rs[_0xb24f('0x22')](0x4)+_0xb24f('0x23'));fs[_0xb24f('0x24')](_0x4651ba,_0x5ee688,_0xb24f('0x25'));return convertFile(_0x4651ba,_0x25df7d)[_0xb24f('0x26')](function(){try{fs[_0xb24f('0x16')](_0x4651ba);fs['chmodSync'](_0x25df7d,'777');}catch(_0x33e481){logger[_0xb24f('0x15')](_0x33e481);}return _0x25df7d[_0xb24f('0x27')]('.')[0x0];});}function base64Encode(_0x468a56){var _0x33d05d=fs[_0xb24f('0x28')](_0x468a56);return new Buffer(_0x33d05d)[_0xb24f('0x29')](_0xb24f('0x25'));}exports[_0xb24f('0x2a')]=function(_0xb56fa3,_0x297787,_0xfca23a,_0xec2d1d,_0x165e87,_0x37b7f3){var _0x15a17f,_0x5166ff;var _0x2db77b=_0xb24f('0x2b');var _0x3919cb='?key='+_0xb56fa3;var _0x4359ed={};if(_0x297787===_0xb24f('0x2c')){_0x4359ed[_0xb24f('0x2d')]={'ssml':_0xfca23a};}else{_0x4359ed[_0xb24f('0x2d')]={'text':_0xfca23a};};_0x4359ed[_0xb24f('0x2e')]={'languageCode':_0xec2d1d,'ssmlGender':_0x165e87};_0x4359ed[_0xb24f('0x2f')]={'audioEncoding':_0xb24f('0x30'),'sampleRateHertz':0x1f40};var _0x2d22de={'url':_0x2db77b+_0xb24f('0x31')+_0x3919cb,'method':'POST','json':!![],'body':_0x4359ed};return rp(_0x2d22de)[_0xb24f('0x26')](function(_0x4b9122){return new BPromise(function(_0x154936,_0x320c98){_0x15a17f=path[_0xb24f('0x20')](__dirname,_0xb24f('0x21'),rs['generate'](0x4)+_0xb24f('0x32'));var _0x3c24e1=Buffer[_0xb24f('0x33')](_0x4b9122[_0xb24f('0x34')],_0xb24f('0x25'));return fs[_0xb24f('0x35')](_0x15a17f,_0x3c24e1,function(_0x540751){_0x320c98(_0x540751);},function(_0x35137c){fs['chmodSync'](_0x15a17f,_0xb24f('0x36'));_0x154936(_0x35137c);});});})[_0xb24f('0x26')](function(_0x56b017){_0x5166ff=path['resolve'](__dirname,'tmp',rs[_0xb24f('0x22')](0x4)+_0xb24f('0x23'));return convertFile(_0x15a17f,_0x5166ff);})['then'](function(){try{fs[_0xb24f('0x16')](_0x15a17f);fs[_0xb24f('0x37')](_0x5166ff,_0xb24f('0x36'));}catch(_0x1e5493){logger[_0xb24f('0x15')](_0x1e5493);}logger[_0xb24f('0x1e')]('googleCloudTTS\x20path',_0x5166ff[_0xb24f('0x27')]('.')[0x0]);return _0x5166ff[_0xb24f('0x27')]('.')[0x0];});};exports[_0xb24f('0x38')]=function(_0x2aad4a,_0x58ac09){var _0x17ef4d=_0xb24f('0x39');var _0x45d376,_0x501921;var _0x3412bc;var _0x4644af={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x17ef4d,'headers':{'Content-Type':_0xb24f('0x3a')},'body':'f.req='+encodeURIComponent(JSON[_0xb24f('0x3b')]([[[_0xb24f('0x3c'),JSON['stringify']([_0x2aad4a,_0x58ac09||'en',![],_0xb24f('0x3d')]),null,_0xb24f('0x3e')]]]))};return rp(_0x4644af)['then'](function(_0x48db7c){try{_0x3412bc=eval(_0x48db7c[_0xb24f('0x3f')](0x5))[0x0][0x2];}catch(_0x466af2){throw new Error(_0xb24f('0x40')+_0x48db7c[_0xb24f('0x1a')]);}if(!_0x3412bc){if(_0x2aad4a['length']>0xc8){throw new Error(_0xb24f('0x41'));}else{throw new Error(_0xb24f('0x42')+_0x58ac09+_0xb24f('0x43'));}}try{_0x3412bc=eval(_0x3412bc)[0x0];}catch(_0x3c6e66){throw new Error(_0xb24f('0x40')+res['data']);}const _0x3a7e5f=_0x3412bc;_0x45d376=path[_0xb24f('0x20')](__dirname,_0xb24f('0x21'),rs[_0xb24f('0x22')](0x4)+_0xb24f('0x32'));fs['writeFileSync'](_0x45d376,_0x3412bc,{'encoding':_0xb24f('0x25')});_0x501921=path[_0xb24f('0x20')](__dirname,_0xb24f('0x21'),rs[_0xb24f('0x22')](0x4)+_0xb24f('0x23'));return convertFile(_0x45d376,_0x501921);})['then'](function(){try{fs[_0xb24f('0x16')](_0x45d376);fs['chmodSync'](_0x501921,_0xb24f('0x36'));}catch(_0x214dc9){logger[_0xb24f('0x15')](_0x214dc9);}logger[_0xb24f('0x1e')](_0xb24f('0x44'),_0x501921[_0xb24f('0x27')]('.')[0x0]);return _0x501921['split']('.')[0x0];});};exports[_0xb24f('0x45')]=function(_0x22b15d,_0x5a3bef,_0x147321){return google[_0xb24f('0x46')](_0x22b15d,_0x5a3bef,_0x147321)[_0xb24f('0x26')](function(_0x3d2c98){logger[_0xb24f('0x1e')](_0x3d2c98[_0xb24f('0x47')]);return rp(_0x3d2c98);})['then'](function(_0x295cf4){var _0x83b5dc='';var _0x3dfb90=0x0;try{fs[_0xb24f('0x16')](_0x22b15d);}catch(_0x2ff076){logger[_0xb24f('0x15')](_0x2ff076);}if(_0x295cf4&&_0x295cf4[_0xb24f('0x48')]){_0x83b5dc=_0x295cf4[_0xb24f('0x48')]['map'](function(_0x4c124d){return _0x4c124d&&_0x4c124d[_0xb24f('0x49')][0x0]&&_0x4c124d[_0xb24f('0x49')][0x0][_0xb24f('0x4a')]?_0x4c124d[_0xb24f('0x49')][0x0][_0xb24f('0x4a')]:'';})[_0xb24f('0x4b')]('\x0a');_0x3dfb90=_0x295cf4[_0xb24f('0x48')][_0xb24f('0x4c')](function(_0x476373){return _0x476373&&_0x476373['alternatives'][0x0]&&_0x476373['alternatives'][0x0][_0xb24f('0x4d')]?_0x476373[_0xb24f('0x49')][0x0][_0xb24f('0x4d')]:0x0;})[_0xb24f('0x4b')]('\x0a');}logger[_0xb24f('0x1e')](_0xb24f('0x4e'),_0x83b5dc);logger[_0xb24f('0x1e')](_0xb24f('0x4f'),_0x3dfb90);return{'transcript':_0x83b5dc,'confidence':_0x3dfb90};})[_0xb24f('0x50')](function(_0x11aa82){logger['error'](_0xb24f('0x51'),_0x11aa82[_0xb24f('0x11')],_0x11aa82[_0xb24f('0x52')],_0x11aa82[_0xb24f('0x53')]);});};exports['googleDialogflow']=function(_0x2fe2d2,_0x472899,_0x56d0a6,_0x32cab4){var _0x4b79ca=apiai(_0x472899,{'language':_0x32cab4||'en'});return _0x4b79ca[_0xb24f('0x54')](_0x56d0a6,{'sessionId':md5(_0x2fe2d2)})[_0xb24f('0x26')](function(_0x1abfb2){logger[_0xb24f('0x1e')](JSON[_0xb24f('0x3b')](_0x1abfb2));return{'source':_0x1abfb2[_0xb24f('0x55')][_0xb24f('0x56')],'resolvedQuery':_0x1abfb2['result'][_0xb24f('0x57')],'action':_0x1abfb2[_0xb24f('0x55')][_0xb24f('0x58')],'actionIncomplete':_0x1abfb2[_0xb24f('0x55')]['actionIncomplete'],'speech':_0x1abfb2['result'][_0xb24f('0x59')][_0xb24f('0x5a')],'score':_0x1abfb2[_0xb24f('0x55')][_0xb24f('0x5b')],'statusCode':_0x1abfb2[_0xb24f('0x5c')][_0xb24f('0x5d')],'endConversation':_0x1abfb2[_0xb24f('0x55')]['metadata'][_0xb24f('0x5e')]||![],'isFallbackIntent':_0x1abfb2['result'][_0xb24f('0x5f')][_0xb24f('0x60')]};});};exports[_0xb24f('0x61')]=function(_0x277140,_0x15d8f4,_0x1ebb2f,_0x122c71,_0x1b052a,_0x50dbb5){var _0x47882e=_0x122c71[_0xb24f('0x62')](/\\n/g,'\x0a');var _0x40d6ee={'credentials':{'private_key':_0x47882e,'client_email':_0x1ebb2f}};var _0x3da5bf=new dialogflow['SessionsClient'](_0x40d6ee);var _0x3357ff=_0x3da5bf[_0xb24f('0x63')](_0x15d8f4,md5(_0x277140));var _0x1c9a95={'session':_0x3357ff,'queryInput':{'text':{'text':_0x1b052a,'languageCode':_0x50dbb5}}};return _0x3da5bf['detectIntent'](_0x1c9a95)[_0xb24f('0x26')](function(_0x48006c){if(_0x48006c&&_0x48006c[_0xb24f('0x64')]){logger[_0xb24f('0x1e')](_0xb24f('0x65'),JSON['stringify'](_0x48006c));var _0x2d4de4=_0x48006c[0x0];if(_0x2d4de4){var _0x2af14f={'action':_0x2d4de4[_0xb24f('0x66')][_0xb24f('0x58')],'allRequiredParamsPresent':_0x2d4de4[_0xb24f('0x66')]['allRequiredParamsPresent'],'endConversation':_0x2d4de4[_0xb24f('0x66')][_0xb24f('0x67')]&&_0x2d4de4['queryResult'][_0xb24f('0x67')]['fields']?_0x2d4de4[_0xb24f('0x66')][_0xb24f('0x67')][_0xb24f('0x68')][_0xb24f('0x69')][_0xb24f('0x6a')]:![],'fulfillmentText':_0x2d4de4[_0xb24f('0x66')][_0xb24f('0x6b')],'intentName':_0x2d4de4[_0xb24f('0x66')][_0xb24f('0x6c')][_0xb24f('0x52')],'intentDisplayName':_0x2d4de4[_0xb24f('0x66')][_0xb24f('0x6c')][_0xb24f('0x6d')],'isFallbackIntent':_0x2d4de4[_0xb24f('0x66')][_0xb24f('0x6c')]['isFallback'],'languageCode':_0x2d4de4['queryResult'][_0xb24f('0x6e')],'queryText':_0x2d4de4[_0xb24f('0x66')][_0xb24f('0x6f')],'responseId':_0x2d4de4[_0xb24f('0x70')],'score':_0x2d4de4[_0xb24f('0x66')]['intentDetectionConfidence'],'speech':_0x2d4de4['queryResult'][_0xb24f('0x6b')],'providerResponse':JSON['stringify'](_0x48006c)};return _0x2af14f;}}});};exports['tildeASR']=function(_0x58fe16,_0x22f99a,_0x25c25f,_0x4c08a2){return tilde[_0xb24f('0x46')](_0x58fe16,_0x22f99a,_0x25c25f,_0x4c08a2)['then'](function(_0x39d9a9){try{fs[_0xb24f('0x16')](_0x58fe16);}catch(_0x2e4b17){logger[_0xb24f('0x15')](_0x2e4b17);}logger['info'](_0xb24f('0x71'),_0x39d9a9[_0xb24f('0x4a')]);logger[_0xb24f('0x1e')]('Tilde\x20ASR\x20confidence',_0x39d9a9[_0xb24f('0x4d')]);return _0x39d9a9;});};exports[_0xb24f('0x72')]=function(_0xa25318,_0x52a7b2,_0x41ae47,_0x798768,_0x4f2b72,_0x34ae13){var _0x50b5cd=path[_0xb24f('0x20')](__dirname,_0xb24f('0x21'),rs['generate'](0x4)+'.mp3');var _0x35c4d6;return aws[_0xb24f('0x73')](_0xa25318,_0x52a7b2,_0x41ae47,_0x798768,_0x4f2b72,_0x34ae13,_0x50b5cd)[_0xb24f('0x26')](function(){_0x35c4d6=path[_0xb24f('0x20')](__dirname,_0xb24f('0x21'),rs[_0xb24f('0x22')](0x4)+_0xb24f('0x23'));return convertFile(_0x50b5cd,_0x35c4d6);})[_0xb24f('0x26')](function(){try{fs['unlink'](_0x50b5cd);fs['chmodSync'](_0x35c4d6,_0xb24f('0x36'));}catch(_0x3e3a44){logger[_0xb24f('0x15')](_0x3e3a44);}return _0x35c4d6['split']('.')[0x0];});};exports[_0xb24f('0x74')]=function(_0x1e4a43,_0x434aa0,_0x584867,_0x5321e1,_0x1d9fae,_0x3f477d){return aws[_0xb24f('0x75')](_0x1e4a43,_0x434aa0,_0x584867,_0x5321e1,_0x1d9fae,_0x3f477d)[_0xb24f('0x26')](function(_0x220e11){logger[_0xb24f('0x1e')](JSON[_0xb24f('0x3b')](_0x220e11));return _0x220e11;});};exports[_0xb24f('0x76')]=function(_0x3275d7,_0x5ac0a8,_0x5f248b,_0x5b3f24){var _0x250039=util[_0xb24f('0x77')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x3275d7,encodeURIComponent(_0x5ac0a8),_0x5f248b,_0x5b3f24);var _0xb2ad4d=path[_0xb24f('0x20')](__dirname,_0xb24f('0x21'),rs[_0xb24f('0x22')](0x4)+_0xb24f('0x32'));var _0x42725b;return downloadFile(_0x250039,_0xb2ad4d)[_0xb24f('0x26')](function(){_0x42725b=path[_0xb24f('0x20')](__dirname,_0xb24f('0x21'),rs['generate'](0x4)+_0xb24f('0x23'));return convertFile(_0xb2ad4d,_0x42725b);})[_0xb24f('0x26')](function(){try{fs[_0xb24f('0x16')](_0xb2ad4d);fs[_0xb24f('0x37')](_0x42725b,_0xb24f('0x36'));}catch(_0x33020e){logger[_0xb24f('0x15')](_0x33020e);}return _0x42725b[_0xb24f('0x27')]('.')[0x0];});};exports[_0xb24f('0x78')]=function(_0x451276,_0x18be40,_0x4f5dc5,_0x173871){var _0x2b3b2a=util[_0xb24f('0x77')](_0xb24f('0x79'),ISPEECH_API,_0x18be40,_0x4f5dc5,base64Encode(_0x451276),_0x173871?util[_0xb24f('0x77')]('model=%s',encodeURIComponent(_0x173871)):'freeform=3');return uploadFile(_0x2b3b2a)['then'](function(_0x1efb84){return querystring[_0xb24f('0x7a')](_0x1efb84);});};exports[_0xb24f('0x7b')]=function(_0x34d54a,_0x45dbdd){return sestek[_0xb24f('0x7c')](_0x34d54a,_0x45dbdd)['then'](function(_0x668965){logger[_0xb24f('0x1e')](JSON[_0xb24f('0x3b')](_0x668965));var _0x2efffa={'speech':_0x668965['text'],'action':_0x668965[_0xb24f('0x7d')]?_0x668965[_0xb24f('0x7d')][_0xb24f('0x7e')]:undefined,'actiondata':_0x668965[_0xb24f('0x7d')]?_0x668965['channelData'][_0xb24f('0x7f')]:undefined};if(_0x668965[_0xb24f('0x7d')]&&_0x668965['channelData'][_0xb24f('0x80')]){return base64Decode(_0x668965[_0xb24f('0x7d')]['AudioFromTts'][_0xb24f('0x81')],path[_0xb24f('0x20')](__dirname,_0xb24f('0x21'),rs[_0xb24f('0x22')](0x4)+_0xb24f('0x23')))[_0xb24f('0x26')](function(_0xa8434c){_0x2efffa[_0xb24f('0x82')]=_0xa8434c;return _0x2efffa;});}return _0x2efffa;});};exports[_0xb24f('0x83')]=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 614fa69..0581619 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 _0xe790=['./nda'];(function(_0x16fcee,_0x397b22){var _0x5f35f7=function(_0x5891ad){while(--_0x5891ad){_0x16fcee['push'](_0x16fcee['shift']());}};_0x5f35f7(++_0x397b22);}(_0xe790,0xb3));var _0x0e79=function(_0x2a09aa,_0x1c69b3){_0x2a09aa=_0x2a09aa-0x0;var _0xc5894d=_0xe790[_0x2a09aa];return _0xc5894d;};var nda=require(_0x0e79('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0xae50=['./nda'];(function(_0x545443,_0x542adc){var _0x2dabde=function(_0x57ef12){while(--_0x57ef12){_0x545443['push'](_0x545443['shift']());}};_0x2dabde(++_0x542adc);}(_0xae50,0xff));var _0x0ae5=function(_0x45096e,_0x17e82d){_0x45096e=_0x45096e-0x0;var _0xba1fa3=_0xae50[_0x45096e];return _0xba1fa3;};var nda=require(_0x0ae5('0x0'));module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 3d6ee6d..592fce0 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 _0x25a3=['url','../../../../../config/logger','exports','POST','ndauth_url','/token','password','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','dnid','extension','Bearer\x20','access_token','project','body','channelData','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','stringify','request-promise'];(function(_0x5cb372,_0xf26e46){var _0x4fd45b=function(_0x45975d){while(--_0x45975d){_0x5cb372['push'](_0x5cb372['shift']());}};_0x4fd45b(++_0xf26e46);}(_0x25a3,0x121));var _0x325a=function(_0x26583d,_0x273848){_0x26583d=_0x26583d-0x0;var _0x1b1d6d=_0x25a3[_0x26583d];return _0x1b1d6d;};'use strict';var rp=require(_0x325a('0x0'));var url=require(_0x325a('0x1'));var logger=require(_0x325a('0x2'))('agi');module[_0x325a('0x3')]=function(_0x50e9ba,_0x46df7b){var _0x3b887a={'method':_0x325a('0x4'),'uri':url['resolve'](_0x46df7b[_0x325a('0x5')],_0x325a('0x6')),'form':{'grant_type':_0x325a('0x7'),'username':_0x46df7b['username'],'password':_0x46df7b['password']},'json':!![]};return rp(_0x3b887a)[_0x325a('0x8')](function(_0x209f5e){var _0x43bd79={'method':_0x325a('0x4'),'uri':url['resolve'](_0x46df7b['ndassistant_url'],_0x325a('0x9')),'body':{'type':_0x46df7b[_0x325a('0xa')]||_0x325a('0xb'),'channelId':_0x325a('0xc'),'conversation':{'id':_0x50e9ba[_0x325a('0xd')]},'from':{'id':_0x50e9ba[_0x325a('0xe')],'name':_0x50e9ba['calleridname']},'recipient':{'id':_0x50e9ba[_0x325a('0xf')],'name':_0x50e9ba[_0x325a('0x10')]},'text':_0x46df7b['text'],'channelData':{}},'headers':{'Authorization':_0x325a('0x11')+_0x209f5e[_0x325a('0x12')]},'json':!![]};if(_0x46df7b[_0x325a('0x13')]){_0x43bd79[_0x325a('0x14')]['channelData']['ProjectName']=_0x46df7b[_0x325a('0x13')];}if(_0x46df7b['ndagenerate_audio']=='1'){_0x43bd79[_0x325a('0x14')][_0x325a('0x15')][_0x325a('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x325a('0x17')};}if(_0x46df7b[_0x325a('0x18')]){_0x43bd79[_0x325a('0x14')][_0x325a('0x15')][_0x325a('0x19')]=_0x46df7b[_0x325a('0x18')];if(_0x46df7b[_0x325a('0x1a')]){_0x43bd79[_0x325a('0x14')][_0x325a('0x15')][_0x325a('0x1b')]=_0x46df7b[_0x325a('0x1a')];}}logger['info'](JSON[_0x325a('0x1c')](_0x43bd79));return rp(_0x43bd79);});}; \ No newline at end of file +var _0xce3a=['Nda','uniqueid','callerid','calleridname','Bearer\x20','body','ProjectName','ndagenerate_audio','channelData','audio/wav','custom_action','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','username','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message'];(function(_0x9083bb,_0x721e59){var _0x4659d7=function(_0x5d5dca){while(--_0x5d5dca){_0x9083bb['push'](_0x9083bb['shift']());}};_0x4659d7(++_0x721e59);}(_0xce3a,0x194));var _0xace3=function(_0x3bd09c,_0x4834cf){_0x3bd09c=_0x3bd09c-0x0;var _0x8a9ae2=_0xce3a[_0x3bd09c];return _0x8a9ae2;};'use strict';var rp=require(_0xace3('0x0'));var url=require(_0xace3('0x1'));var logger=require(_0xace3('0x2'))(_0xace3('0x3'));module[_0xace3('0x4')]=function(_0x37ef15,_0x1f1865){var _0x215d89={'method':_0xace3('0x5'),'uri':url[_0xace3('0x6')](_0x1f1865[_0xace3('0x7')],_0xace3('0x8')),'form':{'grant_type':'password','username':_0x1f1865[_0xace3('0x9')],'password':_0x1f1865[_0xace3('0xa')]},'json':!![]};return rp(_0x215d89)[_0xace3('0xb')](function(_0x22f00a){var _0x4e27ad={'method':_0xace3('0x5'),'uri':url['resolve'](_0x1f1865[_0xace3('0xc')],_0xace3('0xd')),'body':{'type':_0x1f1865[_0xace3('0xe')]||_0xace3('0xf'),'channelId':_0xace3('0x10'),'conversation':{'id':_0x37ef15[_0xace3('0x11')]},'from':{'id':_0x37ef15[_0xace3('0x12')],'name':_0x37ef15[_0xace3('0x13')]},'recipient':{'id':_0x37ef15['dnid'],'name':_0x37ef15['extension']},'text':_0x1f1865['text'],'channelData':{}},'headers':{'Authorization':_0xace3('0x14')+_0x22f00a['access_token']},'json':!![]};if(_0x1f1865['project']){_0x4e27ad[_0xace3('0x15')]['channelData'][_0xace3('0x16')]=_0x1f1865['project'];}if(_0x1f1865[_0xace3('0x17')]=='1'){_0x4e27ad[_0xace3('0x15')][_0xace3('0x18')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xace3('0x19')};}if(_0x1f1865[_0xace3('0x1a')]){_0x4e27ad[_0xace3('0x15')][_0xace3('0x18')]['CustomAction']=_0x1f1865[_0xace3('0x1a')];if(_0x1f1865[_0xace3('0x1b')]){_0x4e27ad[_0xace3('0x15')][_0xace3('0x18')]['CustomActionData']=_0x1f1865[_0xace3('0x1b')];}}logger[_0xace3('0x1c')](JSON[_0xace3('0x1d')](_0x4e27ad));return rp(_0x4e27ad);});}; \ 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 2481d0c..f0cde41 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 _0xbbbf=['./lib/api','exports'];(function(_0x4cb31e,_0x1fbfb7){var _0x59a055=function(_0x584e3c){while(--_0x584e3c){_0x4cb31e['push'](_0x4cb31e['shift']());}};_0x59a055(++_0x1fbfb7);}(_0xbbbf,0x186));var _0xfbbb=function(_0x1a386f,_0x14fb35){_0x1a386f=_0x1a386f-0x0;var _0x354a14=_0xbbbf[_0x1a386f];return _0x354a14;};'use strict';var asr=require(_0xfbbb('0x0'));module[_0xfbbb('0x1')]=function(_0x2e73ac,_0x2188c6,_0x3f0d67,_0x1f7853){return asr(_0x2e73ac,_0x2188c6,_0x3f0d67,_0x1f7853);}; \ No newline at end of file +var _0x0e5a=['./lib/api','exports'];(function(_0x2be71c,_0x259a7a){var _0x1f93f5=function(_0x28c286){while(--_0x28c286){_0x2be71c['push'](_0x2be71c['shift']());}};_0x1f93f5(++_0x259a7a);}(_0x0e5a,0x70));var _0xa0e5=function(_0x198592,_0x3b62e8){_0x198592=_0x198592-0x0;var _0x4230d5=_0x0e5a[_0x198592];return _0x4230d5;};'use strict';var asr=require(_0xa0e5('0x0'));module[_0xa0e5('0x1')]=function(_0x497505,_0x5151ea,_0x2e43c9,_0x1bbdc1){return asr(_0x497505,_0x5151ea,_0x2e43c9,_0x1bbdc1);}; \ 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 9de7f33..a307ef3 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 _0x1b2b=['Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isObject','open','message','close','bluebird','lodash','../../../../../../config/logger','agi','exports','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','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.'];(function(_0x4828b1,_0x5c8cf3){var _0x1fec1b=function(_0x3f2e5a){while(--_0x3f2e5a){_0x4828b1['push'](_0x4828b1['shift']());}};_0x1fec1b(++_0x5c8cf3);}(_0x1b2b,0x1cb));var _0xb1b2=function(_0x2eebfa,_0x2b23fd){_0x2eebfa=_0x2eebfa-0x0;var _0xdb8044=_0x1b2b[_0x2eebfa];return _0xdb8044;};'use strict';var BPromise=require(_0xb1b2('0x0'));var _=require(_0xb1b2('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require('crypto');var logger=require(_0xb1b2('0x2'))(_0xb1b2('0x3'));module[_0xb1b2('0x4')]=function(_0x484b58,_0x4dd5b5,_0x2f6424,_0x2ff234){return new BPromise(function(_0xcb09ef,_0x5ba1fd){logger[_0xb1b2('0x5')](_0xb1b2('0x6'),_0x2ff234||_0xb1b2('0x7'));var _0x1cf56d=new WebSocket(_0x2ff234||_0xb1b2('0x7'),{'perMessageDeflate':![]});var _0x4d862b='';var _0x565ce0='0';var _0x13fb8c='1';var _0x9b6b9a=_0xb1b2('0x8');function _0x10e6ff(_0x52ac74){var _0x1ed96c=crypto['createHash'](_0xb1b2('0x9'));_0x1ed96c[_0xb1b2('0xa')](_0x52ac74);return _0x1ed96c[_0xb1b2('0xb')](_0xb1b2('0xc'));}function _0x346754(){try{logger['info'](_0xb1b2('0xd'));var _0x3d5b74=moment()[_0xb1b2('0xe')]();var _0x4048c3=_0x10e6ff(_0x3d5b74+_0x4dd5b5+_0x2f6424);_0x1cf56d[_0xb1b2('0xf')](JSON[_0xb1b2('0x10')]({'appID':_0x4dd5b5,'timestamp':_0x3d5b74,'appKey':_0x4048c3}));var _0x232b3a=fs[_0xb1b2('0x11')](_0x484b58);_0x232b3a['on'](_0xb1b2('0x12'),function(_0xd761d2){_0x1cf56d[_0xb1b2('0xf')](_0xd761d2);});_0x232b3a['on']('close',function(){_0x1cf56d[_0xb1b2('0xf')]('EOS');});}catch(_0x197f07){logger[_0xb1b2('0x13')](_0xb1b2('0x14'),JSON[_0xb1b2('0x10')](_0x197f07));_0x1cf56d[_0xb1b2('0x15')]();}}function _0x13c886(_0x1964e1){try{if(_0x1964e1){var _0x46e1a8=JSON[_0xb1b2('0x16')](_0x1964e1);switch(_0x46e1a8[_0xb1b2('0x17')]){case 0x0:if(_0x46e1a8[_0xb1b2('0x18')]){if(_0x46e1a8[_0xb1b2('0x18')][_0xb1b2('0x19')]){logger['info'](_0xb1b2('0x1a'),JSON['stringify'](_0x46e1a8[_0xb1b2('0x18')]['hypotheses']));_0x4d862b=_0x46e1a8[_0xb1b2('0x18')][_0xb1b2('0x1b')][0x0][_0xb1b2('0x1c')];_0x565ce0=_0x46e1a8[_0xb1b2('0x18')][_0xb1b2('0x1b')][0x0][_0xb1b2('0x1d')];_0x13fb8c='0';_0x9b6b9a=_0xb1b2('0x1e');_0x1cf56d[_0xb1b2('0x15')]();}}break;case 0x1:logger[_0xb1b2('0x5')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x13fb8c='1';_0x9b6b9a='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger['info'](_0xb1b2('0x1f'));_0x13fb8c='2';_0x9b6b9a=_0xb1b2('0x1f');break;case 0x9:logger['info'](_0xb1b2('0x20'));_0x13fb8c='9';_0x9b6b9a='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xb1b2('0x5')]('Authentication\x20failed.');_0x13fb8c='10';_0x9b6b9a=_0xb1b2('0x21');break;case 0xb:logger[_0xb1b2('0x5')](_0xb1b2('0x22'));_0x13fb8c='11';_0x9b6b9a='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x4d3fa8){logger[_0xb1b2('0x13')](_0xb1b2('0x23'),JSON[_0xb1b2('0x10')](_0x4d3fa8));_0x1cf56d[_0xb1b2('0x15')]();}}function _0x681418(){logger['info'](_0xb1b2('0x24'));_0xcb09ef({'transcript':_0x4d862b,'confidence':_0x565ce0,'status':_0x13fb8c,'status_message':_0x9b6b9a});}function _0x3649d1(_0x10a70b){logger[_0xb1b2('0x13')]('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x10a70b)){logger[_0xb1b2('0x13')](_[_0xb1b2('0x25')](_0x10a70b)?JSON['stringify'](_0x10a70b):_0x10a70b);}}_0x1cf56d['on'](_0xb1b2('0x26'),_0x346754);_0x1cf56d['on'](_0xb1b2('0x27'),_0x13c886);_0x1cf56d['on'](_0xb1b2('0x28'),_0x681418);_0x1cf56d['on'](_0xb1b2('0x13'),_0x3649d1);});}; \ No newline at end of file +var _0x8202=['isObject','open','message','bluebird','lodash','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket'];(function(_0xc1a2a1,_0x5a42c2){var _0x11cc0a=function(_0x35873b){while(--_0x35873b){_0xc1a2a1['push'](_0xc1a2a1['shift']());}};_0x11cc0a(++_0x5a42c2);}(_0x8202,0xcb));var _0x2820=function(_0x4dc2bb,_0x5b1532){_0x4dc2bb=_0x4dc2bb-0x0;var _0x3efa44=_0x8202[_0x4dc2bb];return _0x3efa44;};'use strict';var BPromise=require(_0x2820('0x0'));var _=require(_0x2820('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x2820('0x2'));var logger=require(_0x2820('0x3'))(_0x2820('0x4'));module[_0x2820('0x5')]=function(_0xf618c9,_0x37be8c,_0x482819,_0x51f806){return new BPromise(function(_0xce5a43,_0x16e4f5){logger[_0x2820('0x6')](_0x2820('0x7'),_0x51f806||_0x2820('0x8'));var _0x4b1295=new WebSocket(_0x51f806||_0x2820('0x8'),{'perMessageDeflate':![]});var _0x514f42='';var _0x37a03b='0';var _0x15d962='1';var _0x2d5267='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0xfcdda4(_0x5e54ad){var _0x4f83ba=crypto['createHash'](_0x2820('0x9'));_0x4f83ba[_0x2820('0xa')](_0x5e54ad);return _0x4f83ba['digest'](_0x2820('0xb'));}function _0x4008c9(){try{logger[_0x2820('0x6')](_0x2820('0xc'));var _0x2ca148=moment()[_0x2820('0xd')]();var _0xa84bae=_0xfcdda4(_0x2ca148+_0x37be8c+_0x482819);_0x4b1295[_0x2820('0xe')](JSON[_0x2820('0xf')]({'appID':_0x37be8c,'timestamp':_0x2ca148,'appKey':_0xa84bae}));var _0x327416=fs['createReadStream'](_0xf618c9);_0x327416['on']('data',function(_0x2acdc2){_0x4b1295[_0x2820('0xe')](_0x2acdc2);});_0x327416['on'](_0x2820('0x10'),function(){_0x4b1295[_0x2820('0xe')](_0x2820('0x11'));});}catch(_0x12362f){logger[_0x2820('0x12')](_0x2820('0x13'),JSON[_0x2820('0xf')](_0x12362f));_0x4b1295[_0x2820('0x14')]();}}function _0x1d58d6(_0x256f7e){try{if(_0x256f7e){var _0x61745c=JSON['parse'](_0x256f7e);switch(_0x61745c[_0x2820('0x15')]){case 0x0:if(_0x61745c[_0x2820('0x16')]){if(_0x61745c[_0x2820('0x16')][_0x2820('0x17')]){logger[_0x2820('0x6')](_0x2820('0x18'),JSON[_0x2820('0xf')](_0x61745c[_0x2820('0x16')]['hypotheses']));_0x514f42=_0x61745c[_0x2820('0x16')][_0x2820('0x19')][0x0][_0x2820('0x1a')];_0x37a03b=_0x61745c[_0x2820('0x16')][_0x2820('0x19')][0x0][_0x2820('0x1b')];_0x15d962='0';_0x2d5267=_0x2820('0x1c');_0x4b1295[_0x2820('0x14')]();}}break;case 0x1:logger[_0x2820('0x6')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x15d962='1';_0x2d5267=_0x2820('0x1d');break;case 0x2:logger[_0x2820('0x6')](_0x2820('0x1e'));_0x15d962='2';_0x2d5267='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x2820('0x6')](_0x2820('0x1f'));_0x15d962='9';_0x2d5267=_0x2820('0x1f');break;case 0xa:logger['info'](_0x2820('0x20'));_0x15d962='10';_0x2d5267=_0x2820('0x20');break;case 0xb:logger[_0x2820('0x6')](_0x2820('0x21'));_0x15d962='11';_0x2d5267=_0x2820('0x21');}}}catch(_0x380cf2){logger[_0x2820('0x12')](_0x2820('0x22'),JSON[_0x2820('0xf')](_0x380cf2));_0x4b1295['terminate']();}}function _0x4e65b0(){logger['info'](_0x2820('0x23'));_0xce5a43({'transcript':_0x514f42,'confidence':_0x37a03b,'status':_0x15d962,'status_message':_0x2d5267});}function _0x1a881d(_0x2baf9a){logger[_0x2820('0x12')](_0x2820('0x24'));if(!_['isNil'](_0x2baf9a)){logger['error'](_[_0x2820('0x25')](_0x2baf9a)?JSON[_0x2820('0xf')](_0x2baf9a):_0x2baf9a);}}_0x4b1295['on'](_0x2820('0x26'),_0x4008c9);_0x4b1295['on'](_0x2820('0x27'),_0x1d58d6);_0x4b1295['on'](_0x2820('0x10'),_0x4e65b0);_0x4b1295['on'](_0x2820('0x12'),_0x1a881d);});}; \ 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 a12278a..5bc4349 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 _0xa279=['./asr','exports'];(function(_0x251b09,_0xd6b567){var _0x4c0a6f=function(_0x127242){while(--_0x127242){_0x251b09['push'](_0x251b09['shift']());}};_0x4c0a6f(++_0xd6b567);}(_0xa279,0x98));var _0x9a27=function(_0x235179,_0x34a333){_0x235179=_0x235179-0x0;var _0xb41542=_0xa279[_0x235179];return _0xb41542;};var asr=require(_0x9a27('0x0'));module[_0x9a27('0x1')]={'asr':asr}; \ No newline at end of file +var _0x5bbe=['./asr','exports'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x5bbe,0x10c));var _0xe5bb=function(_0x1a5fa5,_0x55def1){_0x1a5fa5=_0x1a5fa5-0x0;var _0x36439c=_0x5bbe[_0x1a5fa5];return _0x36439c;};var asr=require(_0xe5bb('0x0'));module[_0xe5bb('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index f46c730..afc0266 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 _0x4144=['destroy','code','close','E_AGI_SERVER_CLOSE','inherits','net','events','EventEmitter','./error','127.0.0.1','emit','error','createServer','listen','listening','connection','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED'];(function(_0x4a4240,_0xd288bf){var _0x223b5e=function(_0x34685d){while(--_0x34685d){_0x4a4240['push'](_0x4a4240['shift']());}};_0x223b5e(++_0xd288bf);}(_0x4144,0x191));var _0x4414=function(_0x3da04d,_0x173106){_0x3da04d=_0x3da04d-0x0;var _0x5b14c6=_0x4144[_0x3da04d];return _0x5b14c6;};'use strict';var util=require('util');var net=require(_0x4414('0x0'));var EventEmitter=require(_0x4414('0x1'))[_0x4414('0x2')];var AGIError=require(_0x4414('0x3'));var AGIChannel=require('./channel');var AGIServer=function(_0x381342,_0x4133a4,_0x31ad81){var _0x219149=this,_0x381342=_0x381342||0x11dd,_0x4133a4=_0x4133a4||_0x4414('0x4'),_0x1423ae=null,_0x465d46=0x0;EventEmitter['call'](_0x219149);function _0x145646(){if(!_0x381342){_0x219149[_0x4414('0x5')](_0x4414('0x6'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x1423ae=net[_0x4414('0x7')]();_0x1423ae[_0x4414('0x8')](_0x381342,_0x4133a4);_0x1423ae['on'](_0x4414('0x9'),function(){_0x219149['emit'](_0x4414('0x9'));});_0x1423ae['on'](_0x4414('0xa'),function(_0x4a5fe3){_0x1423ae['getConnections'](function(_0x42a433,_0x1e61b6){if(_0x42a433){_0x219149[_0x4414('0x5')](_0x4414('0x6'),new AGIError(_0x4414('0xb'),_0x42a433));}else if(_0x31ad81&&_0x31ad81<0x0){_0x219149[_0x4414('0x5')](_0x4414('0x6'),new AGIError(_0x4414('0xc')));_0x4a5fe3['destroy']();}else if(_0x31ad81&&_0x31ad81>0x0&&_0x31ad81<_0x1e61b6){_0x465d46+=0x1;_0x219149['emit'](_0x4414('0x6'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x465d46));_0x4a5fe3[_0x4414('0xd')]();}else{var _0x2e7fc6=new AGIChannel(_0x4a5fe3);_0x2e7fc6['on']('ready',function(){_0x219149[_0x4414('0x5')](_0x4414('0xa'),_0x2e7fc6);});}});});_0x1423ae['on']('error',function(_0x2fd3fe){_0x219149[_0x4414('0x5')](_0x4414('0x6'),new AGIError(_0x4414('0xb'),_0x2fd3fe[_0x4414('0xe')]));});_0x1423ae['on'](_0x4414('0xf'),function(){_0x219149[_0x4414('0x5')]('close',new AGIError(_0x4414('0x10')));});}process['nextTick'](function(){_0x145646();});};util[_0x4414('0x11')](AGIServer,EventEmitter);module['exports']=function(_0x1c54a4,_0x424e31,_0x57b11c){return new AGIServer(_0x1c54a4,_0x424e31,_0x57b11c);}; \ No newline at end of file +var _0xeefa=['EventEmitter','./error','call','error','listening','connection','getConnections','emit','E_AGI_SERVER_MAXCONNECTION','destroy','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','exports','util','net','events'];(function(_0x48ce9e,_0x5da421){var _0x2b0d98=function(_0x15db10){while(--_0x15db10){_0x48ce9e['push'](_0x48ce9e['shift']());}};_0x2b0d98(++_0x5da421);}(_0xeefa,0x151));var _0xaeef=function(_0x36d933,_0x570bba){_0x36d933=_0x36d933-0x0;var _0x4e166f=_0xeefa[_0x36d933];return _0x4e166f;};'use strict';var util=require(_0xaeef('0x0'));var net=require(_0xaeef('0x1'));var EventEmitter=require(_0xaeef('0x2'))[_0xaeef('0x3')];var AGIError=require(_0xaeef('0x4'));var AGIChannel=require('./channel');var AGIServer=function(_0x5c302a,_0x15e6c8,_0x150ec9){var _0x4180a2=this,_0x5c302a=_0x5c302a||0x11dd,_0x15e6c8=_0x15e6c8||'127.0.0.1',_0x5b31cc=null,_0x3c8be1=0x0;EventEmitter[_0xaeef('0x5')](_0x4180a2);function _0x5d5e06(){if(!_0x5c302a){_0x4180a2['emit'](_0xaeef('0x6'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x5b31cc=net['createServer']();_0x5b31cc['listen'](_0x5c302a,_0x15e6c8);_0x5b31cc['on'](_0xaeef('0x7'),function(){_0x4180a2['emit']('listening');});_0x5b31cc['on'](_0xaeef('0x8'),function(_0x117d6e){_0x5b31cc[_0xaeef('0x9')](function(_0x26472b,_0x1ed5ed){if(_0x26472b){_0x4180a2['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0x26472b));}else if(_0x150ec9&&_0x150ec9<0x0){_0x4180a2[_0xaeef('0xa')](_0xaeef('0x6'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x117d6e['destroy']();}else if(_0x150ec9&&_0x150ec9>0x0&&_0x150ec9<_0x1ed5ed){_0x3c8be1+=0x1;_0x4180a2['emit']('error',new AGIError(_0xaeef('0xb'),_0x3c8be1));_0x117d6e[_0xaeef('0xc')]();}else{var _0x206249=new AGIChannel(_0x117d6e);_0x206249['on']('ready',function(){_0x4180a2[_0xaeef('0xa')](_0xaeef('0x8'),_0x206249);});}});});_0x5b31cc['on'](_0xaeef('0x6'),function(_0x232bc4){_0x4180a2[_0xaeef('0xa')](_0xaeef('0x6'),new AGIError(_0xaeef('0xd'),_0x232bc4['code']));});_0x5b31cc['on'](_0xaeef('0xe'),function(){_0x4180a2['emit']('close',new AGIError(_0xaeef('0xf')));});}process['nextTick'](function(){_0x5d5e06();});};util['inherits'](AGIServer,EventEmitter);module[_0xaeef('0x10')]=function(_0x48e933,_0x9fa5ed,_0x5460ff){return new AGIServer(_0x48e933,_0x9fa5ed,_0x5460ff);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index df99625..f3b7b9f 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 _0x7aab=['project_id','no\x20subproject\x20selected','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','vswitch','join','exports','path','util','lodash','shelljs','moment','mustache','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','channel','mailRpc','getVariable','rpc','getVariableById','name','catch','prototype','getVoiceQueue','getVoiceQueueById','then','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','getIntervalById','Intervals','interval','format','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','getPauseById','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','text','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','body','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isArray','length','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','retry','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','no\x20grammar\x20configured','grammar','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','RECOG_INSTANCE()','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2_project_id','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','private_key','Trying\x20DialogflowV2:\x20%s','dialogflowV2','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','maxRetry','file_id','no\x20file\x20audio\x20selected','getSound','getData','response','mindigit','maxdigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','beep','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeechASR','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','agentPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','record','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','saydigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','no\x20mail\x20account\x20configured','account_id','Smtp','\x22%s\x22\x20<%s>','email','bcc','subject','service','host','port','secure','authentication','auth','user','pass','template_id','sendMail\x20message','sendMailMessage','Mail\x20message\x20added\x20to\x20outgoing\x20process','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','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'];(function(_0x114749,_0x9b572a){var _0x499080=function(_0x564790){while(--_0x564790){_0x114749['push'](_0x114749['shift']());}};_0x499080(++_0x9b572a);}(_0x7aab,0x1e5));var _0xb7aa=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7aab[_0x432682];return _0x463d05;};'use strict';var fs=require('fs');var path=require(_0xb7aa('0x0'));var util=require(_0xb7aa('0x1'));var _=require(_0xb7aa('0x2'));var sh=require(_0xb7aa('0x3'));var odbc=require('odbc')();var rs=require('randomstring');var moment=require(_0xb7aa('0x4'));var Mustache=require(_0xb7aa('0x5'));var rp=require('request-promise');var logger=require('../../config/logger')(_0xb7aa('0x6'));var config=require(_0xb7aa('0x7'));var scripts=require(_0xb7aa('0x8'));var FILES_PATH=_0xb7aa('0x9');var recursiveMapAttributes=[_0xb7aa('0xa'),_0xb7aa('0xb')];var verticesWithRetry=[_0xb7aa('0xc'),'getdigits',_0xb7aa('0xd')];var AGIVertices=function(_0x3cb21e,_0x3a96db,_0x33b732){this[_0xb7aa('0xe')]=_0x3cb21e;this['rpc']=_0x3a96db;this[_0xb7aa('0xf')]=_0x33b732;};AGIVertices['prototype'][_0xb7aa('0x10')]=function(_0x29f875,_0x5e7678){this[_0xb7aa('0x11')][_0xb7aa('0x12')](_0x29f875)['then'](function(_0x4537b8){_0x5e7678(null,_0x4537b8?_0x4537b8[_0xb7aa('0x13')]:![]);})[_0xb7aa('0x14')](function(_0x497cce){_0x5e7678(_0x497cce);});};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x16')]=function(_0x18efa1,_0x202c7c){this['rpc'][_0xb7aa('0x17')](_0x18efa1)[_0xb7aa('0x18')](function(_0x411298){_0x202c7c(null,_0x411298?_0x411298[_0xb7aa('0x13')]:![]);})['catch'](function(_0x1def84){_0x202c7c(_0x1def84);});};AGIVertices[_0xb7aa('0x15')]['getSquareProject']=function(_0x2b0c09,_0x3bdc7e){this['rpc']['getSquareProjectById'](_0x2b0c09)['then'](function(_0x5deaa1){_0x3bdc7e(null,_0x5deaa1?_0x5deaa1[_0xb7aa('0x13')]:![]);})['catch'](function(_0x4724a6){_0x3bdc7e(_0x4724a6);});};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x19')]=function(_0x12027b,_0x4e6623){this['rpc'][_0xb7aa('0x1a')](_0x12027b)[_0xb7aa('0x18')](function(_0x2b2f70){_0x4e6623(null,_0x2b2f70?_0x2b2f70[_0xb7aa('0x1b')]:![]);})[_0xb7aa('0x14')](function(_0x329709){_0x4e6623(_0x329709);});};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x1c')]=function(_0xf391bc,_0x24d239){this['rpc'][_0xb7aa('0x1d')](_0xf391bc)[_0xb7aa('0x18')](function(_0x5c914c){_0x24d239(null,_0x5c914c?_0x5c914c[_0xb7aa('0x13')]:![]);})[_0xb7aa('0x14')](function(_0x396702){_0x24d239(_0x396702);});};AGIVertices[_0xb7aa('0x15')]['getTrunk']=function(_0x4a93b2,_0x472150){this[_0xb7aa('0x11')][_0xb7aa('0x1e')](_0x4a93b2)['then'](function(_0x427960){_0x472150(null,_0x427960?_0x427960[_0xb7aa('0x13')]:![]);})[_0xb7aa('0x14')](function(_0x2bddd8){_0x472150(_0x2bddd8);});};AGIVertices[_0xb7aa('0x15')]['getSound']=function(_0x521a1c,_0x5620c5){var _0x1a5914=this;this[_0xb7aa('0x11')][_0xb7aa('0x1f')](_0x521a1c)[_0xb7aa('0x18')](function(_0x11bfa9){_0x5620c5(null,_0x11bfa9?_0x1a5914[_0xb7aa('0x20')](_0x11bfa9[_0xb7aa('0x21')]):![]);})[_0xb7aa('0x14')](function(_0x13886e){_0x5620c5(_0x13886e);});};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x22')]=function(_0x4ad03b,_0x3ebdfe){this[_0xb7aa('0x11')][_0xb7aa('0x23')](_0x4ad03b)[_0xb7aa('0x18')](function(_0x470615){_0x3ebdfe(null,_0x470615?_0x470615:![]);})[_0xb7aa('0x14')](function(_0x1a8526){_0x3ebdfe(_0x1a8526);});};AGIVertices[_0xb7aa('0x15')]['sendMailMessage']=function(_0x161b78,_0x17739e,_0x1adcf7){this[_0xb7aa('0xf')]['sendMailMessage'](_0x161b78,_0x17739e)[_0xb7aa('0x18')](function(){_0x1adcf7(null);})[_0xb7aa('0x14')](function(_0x7818f4){_0x1adcf7(_0x7818f4);});};AGIVertices[_0xb7aa('0x15')]['getIntervals']=function(_0x3d246b,_0x18fb31){this[_0xb7aa('0x11')][_0xb7aa('0x24')](_0x3d246b)[_0xb7aa('0x18')](function(_0x15d185){if(_0x15d185){if(_0x15d185['IntervalId']){_0x18fb31(null,[_0x15d185['interval']]);}else{_0x18fb31(null,_['map'](_0x15d185[_0xb7aa('0x25')],_0xb7aa('0x26')));}}else{_0x18fb31(null,![]);}})['catch'](function(_0x556237){_0x18fb31(_0x556237);});};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x20')]=function(_0x122705){return util[_0xb7aa('0x27')]('%s/sounds/converted/%s',FILES_PATH,_0x122705);};AGIVertices['prototype'][_0xb7aa('0x28')]=function(_0x55d376,_0x3bb585,_0x56a685){odbc[_0xb7aa('0x29')](_0x55d376,function(_0x178667){if(_0x178667){logger['error'](_0xb7aa('0x2a'),_0x178667);_0x56a685(_0x178667);}else{logger[_0xb7aa('0x2b')](_0xb7aa('0x2c'));odbc[_0xb7aa('0x2d')](_0x3bb585,function(_0xed8658,_0x538be5){if(_0xed8658){logger['info']('Error\x20executing\x20query\x20%s',_0x3bb585);_0x56a685(_0xed8658);}else{logger[_0xb7aa('0x2b')]('Query\x20executed\x20correctly\x20%s',_0x3bb585);odbc['close'](function(_0x11093d){if(_0x11093d){logger[_0xb7aa('0x2e')](_0xb7aa('0x2f'),_0x11093d);}_0x56a685(null,_0x538be5);});}});}});};AGIVertices[_0xb7aa('0x15')]['getSmsAccount']=function(_0x23048f,_0xbefc77){this[_0xb7aa('0x11')]['getSmsAccountById'](_0x23048f)['then'](function(_0x393869){_0xbefc77(null,_0x393869?_0x393869:![]);})['catch'](function(_0x41e706){_0xbefc77(_0x41e706);});};AGIVertices['prototype'][_0xb7aa('0x30')]=function(_0x6916ec,_0x3d217f){this[_0xb7aa('0x11')]['createSmsMessage'](_0x6916ec)['then'](function(_0x3629e7){_0x3d217f(null,_0x3629e7);})[_0xb7aa('0x14')](function(_0x26e408){_0x3d217f(_0x26e408);});};AGIVertices[_0xb7aa('0x15')]['createSquareDetailsReport']=function(_0x41c443,_0x268537,_0xb34580){this[_0xb7aa('0x11')][_0xb7aa('0x31')]({'uniqueid':this['channel'][_0xb7aa('0x32')],'node':_0x41c443[_0xb7aa('0x33')],'application':_0x41c443[_0xb7aa('0x34')],'data':_0x268537||null,'project_name':this[_0xb7aa('0xe')][_0xb7aa('0x35')],'callerid':this[_0xb7aa('0xe')][_0xb7aa('0x36')]})[_0xb7aa('0x18')](function(_0x54aca6){if(_0xb34580){_0xb34580(null,_0x54aca6);}})[_0xb7aa('0x14')](function(_0x4a5282){if(_0xb34580){_0xb34580(_0x4a5282);}});};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x37')]=function(_0x569bf1,_0x5a3cfa,_0x22d513,_0x2488c2){this[_0xb7aa('0x11')][_0xb7aa('0x37')]({'uniqueid':this[_0xb7aa('0xe')][_0xb7aa('0x32')],'callerid':this[_0xb7aa('0xe')]['callerid'],'calleridname':this[_0xb7aa('0xe')][_0xb7aa('0x38')],'context':this[_0xb7aa('0xe')][_0xb7aa('0x39')],'extension':this[_0xb7aa('0xe')][_0xb7aa('0x3a')],'priority':this[_0xb7aa('0xe')][_0xb7aa('0x3b')],'accountcode':this[_0xb7aa('0xe')][_0xb7aa('0x3c')],'dnid':this[_0xb7aa('0xe')][_0xb7aa('0x3d')],'projectName':this[_0xb7aa('0xe')][_0xb7aa('0x35')],'saveName':_0x5a3cfa,'filename':_0x569bf1[_0xb7aa('0x3e')]||_0x5a3cfa,'savePath':_0x22d513})[_0xb7aa('0x18')](function(_0x12a505){_0x2488c2(null,_0x12a505);})['catch'](function(_0x4570ba){_0x2488c2(_0x4570ba);});};AGIVertices['prototype']['createSquareMessage']=function(_0x26617f,_0xc540f8,_0x3ff2da,_0x153e50,_0x137862){this['rpc'][_0xb7aa('0x3f')]({'uniqueid':this[_0xb7aa('0xe')][_0xb7aa('0x32')],'body':_0x26617f,'direction':_0xc540f8,'providerName':_0x3ff2da,'providerResponse':_0x153e50})['then'](function(_0x1df19b){if(_0x137862){_0x137862(null,_0x1df19b);}})[_0xb7aa('0x14')](function(_0x15f507){if(_0x137862){_0x137862(_0x15f507);}});};AGIVertices['prototype']['createCmContact']=function(_0x3eda7a,_0x30424c){this[_0xb7aa('0x11')][_0xb7aa('0x40')]({'firstName':_[_0xb7aa('0x41')](_0x3eda7a[_0xb7aa('0x13')])||_[_0xb7aa('0x42')](_0x3eda7a['name'])?_0xb7aa('0x43')+Math[_0xb7aa('0x44')]():_0x3eda7a[_0xb7aa('0x13')],'lastName':_[_0xb7aa('0x41')](_0x3eda7a[_0xb7aa('0x45')])||_[_0xb7aa('0x42')](_0x3eda7a[_0xb7aa('0x45')])?null:_0x3eda7a[_0xb7aa('0x45')],'phone':_0x3eda7a['phone'],'ListId':_0x3eda7a[_0xb7aa('0x46')],'scheduledat':_0x3eda7a[_0xb7aa('0x47')],'callbackUniqueid':this[_0xb7aa('0xe')]['uniqueid'],'tags':_0xb7aa('0x48'),'description':_0xb7aa('0x49')+_0x3eda7a[_0xb7aa('0x47')][_0xb7aa('0x4a')](),'priority':_0x3eda7a['callback_priority']})['then'](function(_0xdeacbb){_0x30424c(null,_0xdeacbb);})[_0xb7aa('0x14')](function(_0x5ecc01){_0x30424c(_0x5ecc01);});};AGIVertices[_0xb7aa('0x15')]['getPause']=function(_0x4de35b,_0x352c01){this[_0xb7aa('0x11')][_0xb7aa('0x4b')](_0x4de35b)['then'](function(_0x1544de){_0x352c01(null,_0x1544de?_0x1544de[_0xb7aa('0x13')]:![]);})[_0xb7aa('0x14')](function(_0x55f71f){_0x352c01(_0x55f71f);});};AGIVertices[_0xb7aa('0x15')]['agentPause']=function(_0x552df4,_0x48046a,_0x4fdf83){var _0x2cbc76={'role':_0xb7aa('0x4c')};_0x2cbc76[_0x552df4]=this['channel'][_0xb7aa('0x36')];this['rpc']['agentPause'](_0x2cbc76,_0x48046a,this[_0xb7aa('0xe')][_0xb7aa('0x32')])[_0xb7aa('0x18')](function(_0x56d399){_0x4fdf83(null,_[_0xb7aa('0x42')](_0x56d399)?![]:!![]);})[_0xb7aa('0x14')](function(_0x226f28){logger[_0xb7aa('0x2e')](_0x226f28);_0x4fdf83(null,![]);});};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x4d')]=function(_0x4737ef,_0x4a7da3){var _0x24182b={'role':_0xb7aa('0x4c')};_0x24182b[_0x4737ef]=this[_0xb7aa('0xe')]['callerid'];this[_0xb7aa('0x11')][_0xb7aa('0x4d')](_0x24182b)[_0xb7aa('0x18')](function(_0x53f0d6){_0x4a7da3(null,_[_0xb7aa('0x42')](_0x53f0d6)?![]:!![]);})[_0xb7aa('0x14')](function(_0x1c158b){logger[_0xb7aa('0x2e')](_0x1c158b);_0x4a7da3(null,![]);});};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x4e')]=function(_0x15e825,_0x1819e8){var _0x2546dc={'role':_0xb7aa('0x4c')};_0x2546dc[_0x15e825]=this[_0xb7aa('0xe')][_0xb7aa('0x36')];this['rpc'][_0xb7aa('0x4e')](_0x2546dc)['then'](function(_0x235073){_0x1819e8(null,_[_0xb7aa('0x42')](_0x235073)?![]:!![]);})[_0xb7aa('0x14')](function(_0x13506d){logger[_0xb7aa('0x2e')](_0x13506d);_0x1819e8(null,![]);});};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x4f')]=function(_0x557779,_0x9619b6){var _0xe2c7bf={'role':'agent'};_0xe2c7bf[_0x557779]=this[_0xb7aa('0xe')][_0xb7aa('0x36')];var _0x4db088=_0x557779!=_0xb7aa('0x50')?util[_0xb7aa('0x27')](_0xb7aa('0x51'),_0xb7aa('0x52'),this[_0xb7aa('0xe')][_0xb7aa('0x36')]):undefined;this[_0xb7aa('0x11')][_0xb7aa('0x4f')](_0xe2c7bf,_0x4db088)[_0xb7aa('0x18')](function(_0x101d58){_0x9619b6(null,_['isNil'](_0x101d58)?![]:!![]);})[_0xb7aa('0x14')](function(_0x247671){logger[_0xb7aa('0x2e')](_0x247671);_0x9619b6(null,![]);});};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x53')]=function(_0x3c3782,_0x36508d){sh[_0xb7aa('0x54')](_[_0xb7aa('0x55')](_0x3c3782),function(_0x3b9dc3,_0x53a65a){var _0x50baf1=_0x53a65a[_0xb7aa('0x56')](/(\r\n|\n|\r)/gm,'');_0x36508d(null,_0x50baf1);});};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x57')]=function(_0x130444,_0x1ca649){scripts['googleCloudTTS'](_0x130444[_0xb7aa('0x58')],_0x130444[_0xb7aa('0x59')]||'text',_0x130444['text'],_0x130444[_0xb7aa('0x5a')]||_0xb7aa('0x5b'),_0x130444[_0xb7aa('0x5c')]||_0xb7aa('0x5d'),_0x130444[_0xb7aa('0x5e')]||_0xb7aa('0x5f'))['then'](function(_0x40aa0){_0x1ca649(null,_0x40aa0);})[_0xb7aa('0x14')](function(_0x5ed465){_0x1ca649(_0x5ed465);});};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x60')]=function(_0x2fd10b,_0xf14e43){scripts[_0xb7aa('0x60')](_0x2fd10b[_0xb7aa('0x61')],_0x2fd10b['google_tts_language']||'en',0x1)[_0xb7aa('0x18')](function(_0x1903f5){_0xf14e43(null,_0x1903f5);})['catch'](function(_0x19735f){_0xf14e43(_0x19735f);});};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x62')]=function(_0x6c79f2,_0x58bd8c){var _0x426b67={'uri':_0x6c79f2[_0xb7aa('0x63')],'method':_0x6c79f2[_0xb7aa('0x64')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x6c79f2[_0xb7aa('0x65')])===_0xb7aa('0x66')&&parseInt(_0x6c79f2['timeout'])>=0x1?parseInt(_0x6c79f2[_0xb7aa('0x65')])*0x3e8:0x5*0x3e8};if(_[_0xb7aa('0x67')]([_0xb7aa('0x68'),_0xb7aa('0x69')],_0x426b67[_0xb7aa('0x64')][_0xb7aa('0x6a')]())){try{_0x426b67['body']=_0x6c79f2[_0xb7aa('0xb')]?JSON['parse'](_0x6c79f2[_0xb7aa('0xb')]):{};}catch(_0x1e1f31){logger[_0xb7aa('0x2e')](_0xb7aa('0x6b'),_0x1e1f31);}}try{_0x426b67[_0xb7aa('0x6c')]=_0x6c79f2[_0xb7aa('0xa')]?JSON[_0xb7aa('0x6d')](_0x6c79f2[_0xb7aa('0xa')]):{};}catch(_0xe4cc18){logger['error'](_0xb7aa('0x6e'),_0xe4cc18);}if(_0x6c79f2[_0xb7aa('0x6f')]){try{var _0x565e3b=require(_0x6c79f2[_0xb7aa('0x6f')])[_0xb7aa('0x70')](this,_0x426b67);_0x426b67[_0xb7aa('0x71')]=Mustache[_0xb7aa('0x72')](_0x6c79f2[_0xb7aa('0x63')],_0x565e3b,{},['$$','$$']);if(_0x426b67[_0xb7aa('0x6c')]){_0x426b67[_0xb7aa('0x6c')]=JSON[_0xb7aa('0x6d')](Mustache[_0xb7aa('0x72')](JSON['stringify'](_0x426b67[_0xb7aa('0x6c')]),_0x565e3b,{},['$$','$$']));}if(_0x426b67[_0xb7aa('0x73')]){_0x426b67[_0xb7aa('0x73')]=JSON[_0xb7aa('0x6d')](Mustache[_0xb7aa('0x72')](JSON[_0xb7aa('0x74')](_0x426b67[_0xb7aa('0x73')]),_0x565e3b,{},['$$','$$']));}}catch(_0x3d7426){logger[_0xb7aa('0x2e')](_0xb7aa('0x75'),_0x3d7426);}}rp(_0x426b67)[_0xb7aa('0x18')](function(_0x219756){var _0x4cb9e9={'statusCode':_0x219756[_0xb7aa('0x76')]||0xc8,'statusMessage':_0x219756[_0xb7aa('0x77')]||'OK','headers':_0x219756['headers']||{},'body':_0x219756[_0xb7aa('0x73')]||{}};_0x58bd8c(null,_0x4cb9e9);})[_0xb7aa('0x14')](function(_0x268b7d){var _0x4cc3b1={'statusCode':_0x268b7d[_0xb7aa('0x76')]||0x1f4,'statusMessage':_0x268b7d[_0xb7aa('0x78')]||_0xb7aa('0x79'),'headers':_0x268b7d['options'][_0xb7aa('0x6c')]||{},'body':_0x268b7d[_0xb7aa('0x7a')][_0xb7aa('0x73')]||{}};_0x58bd8c(null,_0x4cc3b1);});};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x7b')]=function(_0x4ce86b,_0x44f0c4){scripts['googleDialogflow'](this[_0xb7aa('0xe')][_0xb7aa('0x32')],_0x4ce86b[_0xb7aa('0x7c')],_0x4ce86b[_0xb7aa('0x61')],_0x4ce86b[_0xb7aa('0x7d')]||'en')[_0xb7aa('0x18')](function(_0x9544c8){_0x44f0c4(null,_0x9544c8);})['catch'](function(_0x456cb1){_0x44f0c4(_0x456cb1);});};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x7e')]=function(_0xea48d3,_0x426e49){scripts[_0xb7aa('0x7e')](this[_0xb7aa('0xe')][_0xb7aa('0x32')],_0xea48d3['dialogflowV2_project_id'],_0xea48d3['client_email'],_0xea48d3['private_key'],_0xea48d3[_0xb7aa('0x61')],_0xea48d3[_0xb7aa('0x7f')]||'en')[_0xb7aa('0x18')](function(_0x70ca7f){_0x426e49(null,_0x70ca7f);})['catch'](function(_0x1504a5){_0x426e49(_0x1504a5);});};AGIVertices[_0xb7aa('0x15')]['sestekNDA']=function(_0x5a44a7,_0x2550a3){scripts[_0xb7aa('0x80')](this[_0xb7aa('0xe')],_0x5a44a7)['then'](function(_0x1dcf84){_0x2550a3(null,_0x1dcf84);})[_0xb7aa('0x14')](function(_0x1f602a){_0x2550a3(_0x1f602a);});};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x81')]=function(_0x37029e,_0x3d68f6){scripts[_0xb7aa('0x81')](_0x37029e[_0xb7aa('0x7c')],_0x37029e[_0xb7aa('0x61')],_0x37029e[_0xb7aa('0x82')]||_0xb7aa('0x5b'),_0x37029e['speed'])[_0xb7aa('0x18')](function(_0x50ff2d){_0x3d68f6(null,_0x50ff2d);})[_0xb7aa('0x14')](function(_0x52f225){_0x3d68f6(_0x52f225);});};AGIVertices['prototype']['ispeechASR']=function(_0x1aa40f,_0x2f9a42,_0x201a92){scripts['ispeechASR'](_0x2f9a42,_0x1aa40f[_0xb7aa('0x7c')],_0x1aa40f[_0xb7aa('0x83')]||_0xb7aa('0x5b'),this['isConfigured'](_0x1aa40f[_0xb7aa('0x84')])?_0x1aa40f[_0xb7aa('0x84')]:undefined)[_0xb7aa('0x18')](function(_0x139a07){_0x201a92(null,_0x139a07);})[_0xb7aa('0x14')](function(_0x417597){_0x201a92(_0x417597);});};AGIVertices['prototype'][_0xb7aa('0x85')]=function(_0x1d9c77,_0x4cb5d3){scripts[_0xb7aa('0x85')](_0x1d9c77[_0xb7aa('0x86')],_0x1d9c77[_0xb7aa('0x87')],_0x1d9c77[_0xb7aa('0x88')],_0x1d9c77[_0xb7aa('0x89')]||_0xb7aa('0x8a'),_0x1d9c77[_0xb7aa('0x61')],_0x1d9c77['aws_text_type']||_0xb7aa('0x61'))[_0xb7aa('0x18')](function(_0x40711c){_0x4cb5d3(null,_0x40711c);})[_0xb7aa('0x14')](function(_0x1ea911){_0x4cb5d3(_0x1ea911);});};AGIVertices['prototype']['awsLex']=function(_0x3c05c4,_0x1c4fbb){scripts[_0xb7aa('0x8b')](this['channel'][_0xb7aa('0x32')],_0x3c05c4['aws_access_key_id'],_0x3c05c4[_0xb7aa('0x87')],_0x3c05c4['aws_lex_region'],_0x3c05c4[_0xb7aa('0x61')],_0x3c05c4[_0xb7aa('0x8c')])[_0xb7aa('0x18')](function(_0x11b6e3){_0x1c4fbb(null,_0x11b6e3);})[_0xb7aa('0x14')](function(_0x2d7850){_0x1c4fbb(_0x2d7850);});};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x8d')]=function(_0x479180,_0x259734,_0x2a7f37){scripts[_0xb7aa('0x8d')](_0x259734,_0x479180[_0xb7aa('0x7c')],_0x479180[_0xb7aa('0x8e')]||_0xb7aa('0x5b'))[_0xb7aa('0x18')](function(_0x8337ae){_0x2a7f37(null,_0x8337ae);})[_0xb7aa('0x14')](function(_0x2f9c50){_0x2a7f37(_0x2f9c50);});};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x8f')]=function(_0x16b7ca,_0x406778,_0x5b3550){scripts[_0xb7aa('0x8f')](_0x406778,_0x16b7ca[_0xb7aa('0x90')],_0x16b7ca[_0xb7aa('0x91')],_0x16b7ca[_0xb7aa('0x71')])[_0xb7aa('0x18')](function(_0x3b532f){_0x5b3550(null,_0x3b532f);})[_0xb7aa('0x14')](function(_0x205716){_0x5b3550(_0x205716);});};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x92')]=function(_0xf61c59){var _0x346101=_['includes'](verticesWithRetry,_0xf61c59['agicommand'])?_0xf61c59:_['clone'](_0xf61c59);for(var _0x5872e4 in _0x346101){if(_0x346101[_0xb7aa('0x93')](_0x5872e4)){if(_0x346101[_0x5872e4]&&_[_0xb7aa('0x94')](_0x346101[_0x5872e4])){if(_['includes'](recursiveMapAttributes,_0x5872e4)){_0x346101[_0x5872e4]=this[_0xb7aa('0x95')](_0x346101[_0x5872e4]);}else{_0x346101[_0x5872e4]=this['replaceAllVariables'](_0x346101[_0x5872e4]);}}}}return _0x346101;};AGIVertices['prototype'][_0xb7aa('0x96')]=function(_0xcdfeb5){for(var _0x963691 in _0xcdfeb5){if(_0xcdfeb5[_0xb7aa('0x93')](_0x963691)){if(_['isPlainObject'](_0xcdfeb5[_0x963691])){this['recursiveNodeIndex'](_0xcdfeb5[_0x963691]);}else if(_[_0xb7aa('0x97')](_0xcdfeb5[_0x963691])){for(var _0xc8a1e1=0x0;_0xc8a1e1<_0xcdfeb5[_0x963691][_0xb7aa('0x98')];_0xc8a1e1++){this[_0xb7aa('0x96')](_0xcdfeb5[_0x963691][_0xc8a1e1]);}}else if(_[_0xb7aa('0x94')](_0xcdfeb5[_0x963691])){_0xcdfeb5[_0x963691]=this[_0xb7aa('0x99')](_0xcdfeb5[_0x963691]);}}}};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x9a')]=function(_0x1d0723,_0x2dea83){for(var _0x55bdbf in _0x1d0723){if(_0x1d0723[_0xb7aa('0x93')](_0x55bdbf)){if(_['isPlainObject'](_0x1d0723[_0x55bdbf])){if(!_['isEmpty'](_0x1d0723[_0x55bdbf])){this[_0xb7aa('0x9a')](_0x1d0723[_0x55bdbf],util['format'](_0xb7aa('0x9b'),_0x2dea83,_0x55bdbf));}}else if(_['isArray'](_0x1d0723[_0x55bdbf])){for(var _0x162c28=0x0;_0x162c28<_0x1d0723[_0x55bdbf][_0xb7aa('0x98')];_0x162c28++){this[_0xb7aa('0x9a')](_0x1d0723[_0x55bdbf][_0x162c28],util['format']('%s.%s',_0x2dea83,_0x55bdbf+'['+_0x162c28+']'));}}else{if(!_[_0xb7aa('0x42')](_0x1d0723[_0x55bdbf])){this[_0xb7aa('0xe')][_0xb7aa('0x9c')](util[_0xb7aa('0x27')](_0xb7aa('0x9b'),_0x2dea83,_0x55bdbf),_0x1d0723[_0x55bdbf]);}}}}};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x95')]=function(_0x30b36c){try{var _0x23afdb=JSON[_0xb7aa('0x6d')](_0x30b36c);this[_0xb7aa('0x96')](_0x23afdb);return JSON[_0xb7aa('0x74')](_0x23afdb);}catch(_0x171483){return this[_0xb7aa('0x99')](_0x30b36c);}};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x99')]=function(_0x2788cc){var _0x5bdc7c=_0x2788cc[_0xb7aa('0x9d')]('{');for(var _0x3fcc2a=0x1;_0x3fcc2a<_0x5bdc7c[_0xb7aa('0x98')];_0x3fcc2a+=0x1){var _0x57dc7b=_0x5bdc7c[_0x3fcc2a]['split']('}');if(_0x57dc7b[_0xb7aa('0x98')]>0x1){_0x2788cc=_0x2788cc[_0xb7aa('0x9e')]('{'+_0x57dc7b[0x0]+'}',this[_0xb7aa('0xe')]['getVariable'](_0x57dc7b[0x0])[_0xb7aa('0x9f')]||_0x57dc7b[0x0]);}}if(_0x5bdc7c[_0xb7aa('0x98')]===0x1){return _0x2788cc['toString']();}return this['replaceAllVariables'](_0x2788cc);};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0xa0')]=function(_0x18c678,_0x113e53){var _0x959f81=this['channel'][_0xb7aa('0x10')](_0x18c678);if(_0x959f81[_0xb7aa('0xa1')]===-0x1){return _0x959f81;}logger[_0xb7aa('0x2b')](util['format'](_0xb7aa('0xa2'),_0x113e53,_0x959f81['extra']));return this[_0xb7aa('0xe')][_0xb7aa('0x9c')](_0x113e53,_0x959f81[_0xb7aa('0x9f')]);};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0xa3')]=function(_0x67ee9b){return _0x67ee9b&&_0x67ee9b!=='0'&&_0x67ee9b!=='-1'&&_0x67ee9b!=='';};AGIVertices['prototype']['maxRetry']=function(_0x17c154){this[_0xb7aa('0x31')][_0xb7aa('0x70')](this,_0x17c154,'-');_0x17c154[_0xb7aa('0xa4')]=_0x17c154['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xb7aa('0x15')]['mrcpsynth']=function(_0x3cf2f1){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x3cf2f1[_0xb7aa('0x33')]));if(!this[_0xb7aa('0xa3')](_0x3cf2f1[_0xb7aa('0x61')])){return this[_0xb7aa('0xe')][_0xb7aa('0xa5')](_0xb7aa('0xa6'));}var _0x5736a7='\x22'+_0x3cf2f1[_0xb7aa('0x61')]+'\x22';if(this[_0xb7aa('0xa3')](_0x3cf2f1[_0xb7aa('0x7a')])){_0x5736a7+=','+_0x3cf2f1[_0xb7aa('0x7a')];}var _0x20eab1=this[_0xb7aa('0xe')][_0xb7aa('0x54')](_0xb7aa('0xa7'),_0x5736a7);if(_0x20eab1[_0xb7aa('0xa1')]===-0x1){return _0x20eab1;}return this[_0xb7aa('0xe')][_0xb7aa('0xa5')](util['format'](_0xb7aa('0xa8'),_0x5736a7));};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0xa9')]=function(_0x4c7fe1){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x4c7fe1[_0xb7aa('0x33')]));if(!this[_0xb7aa('0xa3')](_0x4c7fe1['grammar'])){return this[_0xb7aa('0xe')][_0xb7aa('0xa5')](_0xb7aa('0xaa'));}var _0x4f5991=_0x4c7fe1[_0xb7aa('0xab')];if(this[_0xb7aa('0xa3')](_0x4c7fe1['options'])){_0x4f5991+=','+_0x4c7fe1[_0xb7aa('0x7a')];}var _0x577b3b=this['channel'][_0xb7aa('0x54')]('MRCPRecog',_0x4f5991);if(_0x577b3b[_0xb7aa('0xa1')]===-0x1){return _0x577b3b;}var _0x199ce3=this[_0xb7aa('0xa0')]('RECOG_CONFIDENCE()',_0xb7aa('0xac'));if(_0x199ce3['result']===-0x1){return _0x199ce3;}var _0x9daf09=this[_0xb7aa('0xa0')](_0xb7aa('0xad'),_0xb7aa('0xae'));if(_0x9daf09['result']===-0x1){return _0x9daf09;}var _0x56aa9c=this[_0xb7aa('0xa0')]('RECOG_INSTANCE()',_0xb7aa('0xaf'));if(_0x56aa9c[_0xb7aa('0xa1')]===-0x1){return _0x56aa9c;}return this['channel'][_0xb7aa('0xa5')](util[_0xb7aa('0x27')](_0xb7aa('0xb0'),_0x4f5991));};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x6')]=function(_0x42ea0d){logger[_0xb7aa('0x2b')](util['format'](_0xb7aa('0xb1'),_0x42ea0d[_0xb7aa('0x33')]));return this['channel'][_0xb7aa('0x6')]([_0x42ea0d[_0xb7aa('0xb2')],_0x42ea0d[_0xb7aa('0xb3')]]);};AGIVertices['prototype'][_0xb7aa('0xb4')]=function(_0x6cf97e){logger['info'](util[_0xb7aa('0x27')](_0xb7aa('0xb5'),_0x6cf97e['label']));if(this[_0xb7aa('0xa3')](_0x6cf97e['timeout'])){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0xb6'),_0x6cf97e[_0xb7aa('0x65')]));var _0x1b9184=this[_0xb7aa('0xe')][_0xb7aa('0xb7')](_0x6cf97e[_0xb7aa('0x65')]);if(_0x1b9184[_0xb7aa('0xa1')]===-0x1){return _0x1b9184;}}return this[_0xb7aa('0xe')]['answer']();};AGIVertices['prototype'][_0xb7aa('0x48')]=function(_0x4c4f92){logger[_0xb7aa('0x2b')](util['format'](_0xb7aa('0xb8'),_0x4c4f92[_0xb7aa('0x33')]));if(!this[_0xb7aa('0xa3')](_0x4c4f92[_0xb7aa('0x46')])){return this['channel'][_0xb7aa('0x2e')](_0x4c4f92,_0xb7aa('0xb9'));}_0x4c4f92['scheduledAt']=moment();if(this[_0xb7aa('0xa3')](_0x4c4f92[_0xb7aa('0xba')])){_0x4c4f92[_0xb7aa('0x47')]=moment()['add'](_0x4c4f92[_0xb7aa('0xba')],_0xb7aa('0xbb'));}if(!this[_0xb7aa('0xa3')](_0x4c4f92[_0xb7aa('0xbc')])){_0x4c4f92[_0xb7aa('0xbc')]=0x2;}this[_0xb7aa('0x40')][_0xb7aa('0x70')](this,_0x4c4f92);return this[_0xb7aa('0xe')][_0xb7aa('0xa5')](util[_0xb7aa('0x27')](_0xb7aa('0xbd'),_0x4c4f92['phone'],_0x4c4f92[_0xb7aa('0x46')],_0x4c4f92[_0xb7aa('0x47')]));};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0xbe')]=function(_0xbd897){logger['info'](util[_0xb7aa('0x27')](_0xb7aa('0xbf'),_0xbd897['label']));var _0x155100=this[_0xb7aa('0xe')][_0xb7aa('0x54')](_0xbd897['application'],_0xbd897[_0xb7aa('0x7a')]);if(_0x155100[_0xb7aa('0xa1')]===-0x1){return _0x155100;}return this[_0xb7aa('0xe')][_0xb7aa('0xa5')](util[_0xb7aa('0x27')](_0xb7aa('0xc0'),_0xbd897[_0xb7aa('0xc1')],_0xbd897['options']));};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0xc2')]=function(_0x2ba463){logger[_0xb7aa('0x2b')](util['format']('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x2ba463['label']));if(!this[_0xb7aa('0xa3')](_0x2ba463[_0xb7aa('0x61')])){return this['channel'][_0xb7aa('0xa5')](_0xb7aa('0xa6'));}var _0x45730f='\x22'+_0x2ba463[_0xb7aa('0x61')]+'\x22';if(this[_0xb7aa('0xa3')](_0x2ba463[_0xb7aa('0x7a')])){_0x45730f+=','+_0x2ba463['options'];}var _0x7e1683=this[_0xb7aa('0xe')][_0xb7aa('0x54')](_0xb7aa('0xa7'),_0x45730f);if(_0x7e1683['result']===-0x1){return _0x7e1683;}return this['channel'][_0xb7aa('0xa5')](util[_0xb7aa('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0x45730f));};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0xc3')]=function(_0xd14eef){logger['info'](util[_0xb7aa('0x27')](_0xb7aa('0xc4'),_0xd14eef[_0xb7aa('0x33')]));if(!this[_0xb7aa('0xa3')](_0xd14eef[_0xb7aa('0x61')])){return this[_0xb7aa('0xe')][_0xb7aa('0xa5')](_0xb7aa('0xa6'));}var _0x78559d='\x22'+_0xd14eef[_0xb7aa('0x61')]+'\x22';if(this[_0xb7aa('0xa3')](_0xd14eef['options'])){_0x78559d+=','+_0xd14eef[_0xb7aa('0x7a')];}var _0x3dc22a=this[_0xb7aa('0xe')][_0xb7aa('0x54')]('MRCPSynth',_0x78559d);if(_0x3dc22a[_0xb7aa('0xa1')]===-0x1){return _0x3dc22a;}return this[_0xb7aa('0xe')][_0xb7aa('0xa5')](util[_0xb7aa('0x27')](_0xb7aa('0xa8'),_0x78559d));};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0xc5')]=function(_0x16003b){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x16003b[_0xb7aa('0x33')]));if(!this[_0xb7aa('0xa3')](_0x16003b[_0xb7aa('0xab')])){return this[_0xb7aa('0xe')]['noop'](_0xb7aa('0xaa'));}var _0x22c585=_0x16003b[_0xb7aa('0xab')];if(this['isConfigured'](_0x16003b['options'])){_0x22c585+=','+_0x16003b[_0xb7aa('0x7a')];}var _0xb7be91=this['channel'][_0xb7aa('0x54')](_0xb7aa('0xc6'),_0x22c585);if(_0xb7be91['result']===-0x1){return _0xb7be91;}var _0x1211ad=this[_0xb7aa('0xa0')](_0xb7aa('0xc7'),_0xb7aa('0xc8'));if(_0x1211ad['result']===-0x1){return _0x1211ad;}var _0x4ebde8=this[_0xb7aa('0xa0')](_0xb7aa('0xad'),_0xb7aa('0xc9'));if(_0x4ebde8['result']===-0x1){return _0x4ebde8;}var _0x14f5fd=this[_0xb7aa('0xa0')]('RECOG_INSTANCE()',_0xb7aa('0xca'));if(_0x14f5fd[_0xb7aa('0xa1')]===-0x1){return _0x14f5fd;}return this[_0xb7aa('0xe')][_0xb7aa('0xa5')](util[_0xb7aa('0x27')]('Executed\x20command\x20MRCPRecog\x20%s',_0x22c585));};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0xcb')]=function(_0x597e1c){logger[_0xb7aa('0x2b')](util['format'](_0xb7aa('0xcc'),_0x597e1c[_0xb7aa('0x33')]));if(!this[_0xb7aa('0xa3')](_0x597e1c['grammar'])){return this[_0xb7aa('0xe')][_0xb7aa('0xa5')](_0xb7aa('0xaa'));}var _0x3e55b=_0x597e1c[_0xb7aa('0xab')];if(this[_0xb7aa('0xa3')](_0x597e1c[_0xb7aa('0x7a')])){_0x3e55b+=','+_0x597e1c[_0xb7aa('0x7a')];}var _0x4270df=this[_0xb7aa('0xe')][_0xb7aa('0x54')](_0xb7aa('0xc6'),_0x3e55b);if(_0x4270df[_0xb7aa('0xa1')]===-0x1){return _0x4270df;}var _0x2b121f=this[_0xb7aa('0xa0')](_0xb7aa('0xc7'),_0xb7aa('0xcd'));if(_0x2b121f[_0xb7aa('0xa1')]===-0x1){return _0x2b121f;}var _0x23ee93=this[_0xb7aa('0xa0')](_0xb7aa('0xad'),_0xb7aa('0xce'));if(_0x23ee93['result']===-0x1){return _0x23ee93;}var _0x18cbbb=this[_0xb7aa('0xa0')](_0xb7aa('0xcf'),_0xb7aa('0xd0'));if(_0x18cbbb[_0xb7aa('0xa1')]===-0x1){return _0x18cbbb;}return this[_0xb7aa('0xe')]['noop'](util[_0xb7aa('0x27')](_0xb7aa('0xb0'),_0x3e55b));};AGIVertices[_0xb7aa('0x15')]['database']=function(_0x361128){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0xd1'),_0x361128[_0xb7aa('0x33')]));if(!this[_0xb7aa('0xa3')](_0x361128[_0xb7aa('0xd2')])){return this['channel'][_0xb7aa('0x2e')](_0x361128,_0xb7aa('0xd3'));}var _0x255826=this[_0xb7aa('0x19')][_0xb7aa('0x70')](this,_0x361128['odbc_id']);if(!_0x255826){return this[_0xb7aa('0xe')][_0xb7aa('0x2e')](_0x361128,_0xb7aa('0xd4'));}if(!this['isConfigured'](_0x361128[_0xb7aa('0x2d')])){return this[_0xb7aa('0xe')][_0xb7aa('0x2e')](_0x361128,'no\x20query\x20configured');}var _0x5c060c=_0x361128['query'][_0xb7aa('0x56')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xb7aa('0xa5')](util[_0xb7aa('0x27')]('query:\x20%s',_0x5c060c));var _0x1df7f3=this[_0xb7aa('0x28')][_0xb7aa('0x70')](this,_0x255826,_0x5c060c);this['createSquareDetailsReport']['sync'](this,_0x361128,_0x5c060c);if(!this[_0xb7aa('0xa3')](_0x361128[_0xb7aa('0xd5')])){return this['channel'][_0xb7aa('0xa5')](_0xb7aa('0xd6'));}var _0x2b9bf1=this['getVariable'][_0xb7aa('0x70')](this,_0x361128[_0xb7aa('0xd5')]);if(!_0x2b9bf1){return this[_0xb7aa('0xe')][_0xb7aa('0x2e')](_0x361128,_0xb7aa('0xd7'));}var _0x4785c4=this;_0x1df7f3[_0xb7aa('0xd8')](function(_0x4bb819,_0x5c54a5){Object['keys'](_0x4bb819)['forEach'](function(_0x497e41){_0x4785c4['channel']['setVariable'](util[_0xb7aa('0x27')](_0xb7aa('0xd9'),_0x2b9bf1,_0x5c54a5,_0x497e41),_0x4bb819[_0x497e41]);});});this['channel'][_0xb7aa('0x9c')](util[_0xb7aa('0x27')](_0xb7aa('0xda'),_0x2b9bf1),_0x1df7f3[_0xb7aa('0x98')]);return this[_0xb7aa('0xe')][_0xb7aa('0xa5')](util['format'](_0xb7aa('0xdb'),_0x2b9bf1));};AGIVertices['prototype'][_0xb7aa('0xdc')]=function(_0x276680){logger[_0xb7aa('0xdd')](util[_0xb7aa('0x27')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x276680[_0xb7aa('0x33')]));if(!this[_0xb7aa('0xa3')](_0x276680[_0xb7aa('0xde')])){return this[_0xb7aa('0xe')]['error'](_0x276680,'no\x20user\x20selected');}var _0x2f91d5=this[_0xb7aa('0x1c')][_0xb7aa('0x70')](this,_0x276680[_0xb7aa('0xde')]);if(!_0x2f91d5){return this[_0xb7aa('0xe')]['error'](_0x276680,_0xb7aa('0xdf'));}var _0x47b7b5=this[_0xb7aa('0xe')][_0xb7aa('0x54')](_0xb7aa('0xe0'),[util[_0xb7aa('0x27')]('SIP/%s',_0x2f91d5),_0x276680[_0xb7aa('0x65')],_0x276680[_0xb7aa('0xe1')],_0x276680['url']]);if(_0x47b7b5[_0xb7aa('0xa1')]===-0x1){return _0x47b7b5;}return this['channel'][_0xb7aa('0xa5')](util[_0xb7aa('0x27')](_0xb7aa('0xe2'),_0xb7aa('0xe0')));};AGIVertices['prototype'][_0xb7aa('0xe3')]=function(_0x217c3a){logger[_0xb7aa('0x2b')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x217c3a[_0xb7aa('0x33')]));if(!this[_0xb7aa('0xa3')](_0x217c3a[_0xb7aa('0x7c')])){return this[_0xb7aa('0xe')][_0xb7aa('0xa5')](_0xb7aa('0xe4'));}if(!this[_0xb7aa('0xa3')](_0x217c3a[_0xb7aa('0x61')])){return this[_0xb7aa('0xe')][_0xb7aa('0xa5')](_0xb7aa('0xa6'));}this[_0xb7aa('0xe')][_0xb7aa('0xe5')]=!![];this[_0xb7aa('0x31')](_0x217c3a);this[_0xb7aa('0x3f')](_0x217c3a[_0xb7aa('0x61')],'in','','');this[_0xb7aa('0xe')]['noop'](util[_0xb7aa('0x27')](_0xb7aa('0xe6'),_0x217c3a[_0xb7aa('0x61')]));var _0xdb49d9=this[_0xb7aa('0x7b')][_0xb7aa('0x70')](this,_0x217c3a);if(_0xdb49d9){for(var _0x13c975 in _0xdb49d9){if(_0xdb49d9[_0xb7aa('0x93')](_0x13c975)){this[_0xb7aa('0xe')][_0xb7aa('0x9c')](util['format'](_0xb7aa('0xe7'),_0x13c975[_0xb7aa('0x6a')]()),_0xdb49d9[_0x13c975]);}}this[_0xb7aa('0x3f')](_0xdb49d9[_0xb7aa('0xe8')],_0xb7aa('0xe9'),_0xb7aa('0xe3'),'');return this[_0xb7aa('0xe')]['noop'](util['format'](_0xb7aa('0xea'),_0xdb49d9['speech']));}return this[_0xb7aa('0xe')][_0xb7aa('0x2e')](_0x217c3a,_0xb7aa('0xeb'));};AGIVertices[_0xb7aa('0x15')]['dialogflowV2']=function(_0x4181cb){logger['info'](util['format']('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x4181cb[_0xb7aa('0x33')]));if(!this[_0xb7aa('0xa3')](_0x4181cb[_0xb7aa('0xec')])){return this['channel']['noop'](_0xb7aa('0xed'));}if(!this['isConfigured'](_0x4181cb[_0xb7aa('0xee')])){return this[_0xb7aa('0xe')]['noop'](_0xb7aa('0xef'));}if(!this[_0xb7aa('0xa3')](_0x4181cb[_0xb7aa('0xf0')])){return this[_0xb7aa('0xe')]['noop']('no\x20private_key\x20configured');}if(!this[_0xb7aa('0xa3')](_0x4181cb[_0xb7aa('0x7f')])){return this[_0xb7aa('0xe')][_0xb7aa('0xa5')]('no\x20anguage\x20configured');}if(!this[_0xb7aa('0xa3')](_0x4181cb[_0xb7aa('0x61')])){return this['channel'][_0xb7aa('0xa5')](_0xb7aa('0xa6'));}this[_0xb7aa('0xe')]['bot']=!![];this[_0xb7aa('0x31')](_0x4181cb);this[_0xb7aa('0x3f')](_0x4181cb[_0xb7aa('0x61')],'in','','');this[_0xb7aa('0xe')][_0xb7aa('0xa5')](util[_0xb7aa('0x27')](_0xb7aa('0xf1'),_0x4181cb['text']));var _0x545fe5=this[_0xb7aa('0x7e')]['sync'](this,_0x4181cb);if(_0x545fe5){for(var _0x25339a in _0x545fe5){if(_0x545fe5[_0xb7aa('0x93')](_0x25339a)){if(_0x25339a!=='providerResponse'){this[_0xb7aa('0xe')]['setVariable'](util[_0xb7aa('0x27')]('DIALOGFLOW_%s',_0x25339a[_0xb7aa('0x6a')]()),_0x545fe5[_0x25339a]);}}}this[_0xb7aa('0x3f')](_0x545fe5[_0xb7aa('0xe8')],_0xb7aa('0xe9'),_0xb7aa('0xf2'),_0x545fe5[_0xb7aa('0xf3')]);return this[_0xb7aa('0xe')][_0xb7aa('0xa5')](util[_0xb7aa('0x27')](_0xb7aa('0xf4'),_0x545fe5['speech']));}return this[_0xb7aa('0xe')][_0xb7aa('0x2e')](_0x4181cb,_0xb7aa('0xf5'));};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0xf6')]=function(_0x31bc76){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0xf7'),_0x31bc76[_0xb7aa('0x33')]));if(!this['isConfigured'](_0x31bc76['ndauth_url'])){return this[_0xb7aa('0xe')][_0xb7aa('0xa5')](_0xb7aa('0xf8'));}if(!this['isConfigured'](_0x31bc76[_0xb7aa('0xf9')])){return this['channel'][_0xb7aa('0xa5')](_0xb7aa('0xfa'));}if(!this[_0xb7aa('0xa3')](_0x31bc76[_0xb7aa('0xfb')])){return this[_0xb7aa('0xe')]['noop'](_0xb7aa('0xfc'));}if(!this[_0xb7aa('0xa3')](_0x31bc76['ndassistant_url'])){return this[_0xb7aa('0xe')]['noop']('no\x20text\x20configured');}this['channel'][_0xb7aa('0xe5')]=!![];this[_0xb7aa('0x31')](_0x31bc76);this['createSquareMessage'](_0x31bc76['text'],'in','','');this[_0xb7aa('0xe')]['noop'](util[_0xb7aa('0x27')]('Trying\x20SestekNDA:\x20%s',_0x31bc76[_0xb7aa('0x61')]));var _0x422908=this['sestekNDA'][_0xb7aa('0x70')](this,_0x31bc76);if(_0x422908){for(var _0x35273e in _0x422908){if(_0x422908['hasOwnProperty'](_0x35273e)){this[_0xb7aa('0xe')][_0xb7aa('0x9c')](util['format']('SESTEK_NDA_%s',_0x35273e[_0xb7aa('0x6a')]()),_0x422908[_0x35273e]);}}this[_0xb7aa('0x3f')](_0x422908[_0xb7aa('0xe8')],_0xb7aa('0xe9'),'sesteknda','');if(_0x422908[_0xb7aa('0xfd')]){this[_0xb7aa('0xe')][_0xb7aa('0xa5')](util[_0xb7aa('0x27')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x422908[_0xb7aa('0xfd')]));var _0x3b2df6=this[_0xb7aa('0xe')]['streamFile'](_0x422908[_0xb7aa('0xfd')]);try{fs[_0xb7aa('0xfe')](_0x422908[_0xb7aa('0xfd')]+_0xb7aa('0xff'));}catch(_0x45343e){logger[_0xb7aa('0x2e')](_0x45343e);}return _0x3b2df6;}else{return this['channel'][_0xb7aa('0xa5')](util[_0xb7aa('0x27')](_0xb7aa('0x100'),_0x422908[_0xb7aa('0xe8')]));}}return this['channel']['error'](_0x31bc76,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x101')]=function(_0x1b716f){logger['info'](util[_0xb7aa('0x27')](_0xb7aa('0x102'),_0x1b716f['label']));return this[_0xb7aa('0xe')][_0xb7aa('0xa5')](_0xb7aa('0x101'));};AGIVertices['prototype'][_0xb7aa('0x103')]=function(_0x21b14f){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x104'),_0x21b14f[_0xb7aa('0x33')]));var _0x38a04f='';if(_0x21b14f['trunk_id']){if(!this[_0xb7aa('0xa3')](_0x21b14f[_0xb7aa('0x105')])){return this['channel']['error'](_0x21b14f,_0xb7aa('0x106'));}else{var _0x4cc019=parseInt(_0x21b14f[_0xb7aa('0x105')],0xa);if(isNaN(_0x4cc019)){_0x38a04f=_0x21b14f[_0xb7aa('0x105')];}else{_0x38a04f=this[_0xb7aa('0x107')]['sync'](this,_0x21b14f[_0xb7aa('0x105')]);if(!_0x38a04f){return this[_0xb7aa('0xe')][_0xb7aa('0x2e')](_0x21b14f,'no\x20trunk\x20found');}}}}else if(_0x21b14f['trunk_name']){_0x38a04f=_0x21b14f['trunk_name'];}else{return this[_0xb7aa('0xe')][_0xb7aa('0x2e')](_0x21b14f,_0xb7aa('0x106'));}var _0x3dbdc0=this['channel']['exec'](_0xb7aa('0xe0'),[util[_0xb7aa('0x27')](_0xb7aa('0x108'),_0x38a04f,_0x21b14f['phone']),_0x21b14f[_0xb7aa('0x65')],_0x21b14f[_0xb7aa('0xe1')],_0x21b14f['url']]);if(_0x3dbdc0[_0xb7aa('0xa1')]===-0x1){return _0x3dbdc0;}return this[_0xb7aa('0xe')]['noop'](util[_0xb7aa('0x27')](_0xb7aa('0xe2'),_0xb7aa('0xe0')));};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x109')]=function(_0x193b7b){logger['info'](util[_0xb7aa('0x27')](_0xb7aa('0x10a'),_0x193b7b[_0xb7aa('0x33')]));return this[_0xb7aa('0xe')]['noop'](_0xb7aa('0x109'));};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x10b')]=function(_0xd45a2d){logger[_0xb7aa('0x2b')](util['format'](_0xb7aa('0x10c'),_0xd45a2d[_0xb7aa('0x33')]));if(_0xd45a2d[_0xb7aa('0xa4')]===0x0){return this[_0xb7aa('0x10d')](_0xd45a2d);}_0xd45a2d[_0xb7aa('0xa4')]-=0x1;if(!this['isConfigured'](_0xd45a2d[_0xb7aa('0x10e')])){return this[_0xb7aa('0xe')]['error'](_0xd45a2d,_0xb7aa('0x10f'));}var _0x413d89=this[_0xb7aa('0x110')]['sync'](this,_0xd45a2d[_0xb7aa('0x10e')]);if(!_0x413d89){return this[_0xb7aa('0xe')][_0xb7aa('0x2e')](_0xd45a2d,'no\x20file\x20audio\x20found');}if(!this[_0xb7aa('0xa3')](_0xd45a2d['variable_id'])){return this[_0xb7aa('0xe')][_0xb7aa('0x2e')](_0xb7aa('0xd6'));}var _0x27d3b3=this['channel'][_0xb7aa('0x111')](_0x413d89,_0xd45a2d[_0xb7aa('0x112')],_0xd45a2d['maxdigit']);var _0x5dcc08=_0x27d3b3['result']?_0x27d3b3[_0xb7aa('0xa1')]['toString']():'';logger[_0xb7aa('0x2b')]('test',JSON[_0xb7aa('0x74')](_0x27d3b3));if(_0x27d3b3[_0xb7aa('0xa1')]===-0x1){this[_0xb7aa('0x31')]['sync'](this,_0xd45a2d,_0x5dcc08);return _0x27d3b3;}else if(_0x27d3b3[_0xb7aa('0x9f')]===_0xb7aa('0x65')){_0x27d3b3['result']=_0x5dcc08['length']>=parseInt(_0xd45a2d[_0xb7aa('0x113')])?'x':'i';}else{_0x27d3b3[_0xb7aa('0xa1')]=_0x5dcc08['length']>=parseInt(_0xd45a2d[_0xb7aa('0x113')])&&_0x5dcc08[_0xb7aa('0x98')]<=parseInt(_0xd45a2d[_0xb7aa('0x114')])?'x':'i';}var _0x256244=this[_0xb7aa('0x10')][_0xb7aa('0x70')](this,_0xd45a2d[_0xb7aa('0xd5')]);if(!_0x256244){return this[_0xb7aa('0xe')]['error'](_0xd45a2d,_0xb7aa('0xd7'));}this[_0xb7aa('0xe')][_0xb7aa('0x9c')](_0x256244,_0x5dcc08);if(this[_0xb7aa('0xa3')](_0xd45a2d[_0xb7aa('0x115')])){var _0x54228b=parseInt(_0xd45a2d[_0xb7aa('0x115')],0xa);var _0xdaae18=rs[_0xb7aa('0x116')]({'charset':'*','length':_0x54228b});var _0x5a80a4=_0x5dcc08['length'];if(_0x5a80a4>0x0){if(_0x5a80a4>_0x54228b){this[_0xb7aa('0x31')]['sync'](this,_0xd45a2d,_0xd45a2d['hiddendigitspos']===_0xb7aa('0x117')?_0xdaae18+_0x5dcc08[_0xb7aa('0x118')](_0x54228b):_0x5dcc08[_0xb7aa('0x118')](0x0,_0x5a80a4-_0x54228b)+_0xdaae18);}else{this[_0xb7aa('0x31')][_0xb7aa('0x70')](this,_0xd45a2d,rs[_0xb7aa('0x116')]({'charset':'*','length':_0x5a80a4}));}}else{this[_0xb7aa('0x31')][_0xb7aa('0x70')](this,_0xd45a2d,'');}}else{this[_0xb7aa('0x31')][_0xb7aa('0x70')](this,_0xd45a2d,_0x5dcc08);}return _0x27d3b3;};AGIVertices[_0xb7aa('0x15')]['getsecretdigits']=function(_0x130216){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x119'),_0x130216[_0xb7aa('0x33')]));return this[_0xb7aa('0x10b')](_0x130216);};AGIVertices['prototype'][_0xb7aa('0x11a')]=function(_0x39401d){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x11b'),_0x39401d[_0xb7aa('0x33')]));this[_0xb7aa('0x31')][_0xb7aa('0x70')](this,_0x39401d,_0x39401d[_0xb7aa('0x11c')]);return this[_0xb7aa('0xe')]['noop'](util[_0xb7aa('0x27')](_0xb7aa('0x11d'),_0x39401d[_0xb7aa('0x11c')]));};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x11e')]=function(_0x3bed72){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x11f'),_0x3bed72[_0xb7aa('0x33')]));if(!this['isConfigured'](_0x3bed72[_0xb7aa('0x86')])||!this[_0xb7aa('0xa3')](_0x3bed72[_0xb7aa('0x87')])){return this[_0xb7aa('0xe')][_0xb7aa('0xa5')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x3bed72[_0xb7aa('0x61')])){return this['channel'][_0xb7aa('0xa5')](_0xb7aa('0xa6'));}this[_0xb7aa('0xe')]['noop'](util[_0xb7aa('0x27')]('Trying\x20aws\x20Polly\x20%s',_0x3bed72['text']));var _0x443ea9=this[_0xb7aa('0x85')][_0xb7aa('0x70')](this,_0x3bed72);if(_0x443ea9){this[_0xb7aa('0xe')]['noop'](util[_0xb7aa('0x27')](_0xb7aa('0x120'),_0x443ea9));var _0xeef580=this[_0xb7aa('0xe')][_0xb7aa('0x121')](_0x443ea9);try{fs[_0xb7aa('0xfe')](_0x443ea9+_0xb7aa('0xff'));}catch(_0x598fad){logger[_0xb7aa('0x2e')](_0x598fad);}return _0xeef580;}return this['channel'][_0xb7aa('0x2e')](_0x3bed72,_0xb7aa('0x122'));};AGIVertices['prototype'][_0xb7aa('0x123')]=function(_0xab1e8c){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x124'),_0xab1e8c[_0xb7aa('0x33')]));if(!this[_0xb7aa('0xa3')](_0xab1e8c[_0xb7aa('0x86')])||!this['isConfigured'](_0xab1e8c[_0xb7aa('0x87')])){return this[_0xb7aa('0xe')][_0xb7aa('0xa5')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xb7aa('0xa3')](_0xab1e8c[_0xb7aa('0x8c')])){return this['channel']['noop'](_0xb7aa('0x125'));}if(!this[_0xb7aa('0xa3')](_0xab1e8c[_0xb7aa('0x61')])){return this['channel'][_0xb7aa('0xa5')](_0xb7aa('0xa6'));}this[_0xb7aa('0xe')][_0xb7aa('0xe5')]=!![];this['createSquareDetailsReport'](_0xab1e8c);this[_0xb7aa('0x3f')](_0xab1e8c[_0xb7aa('0x61')],'in','','');this[_0xb7aa('0xe')]['noop'](util['format'](_0xb7aa('0x126'),_0xab1e8c[_0xb7aa('0x61')]));var _0x50d1a7=this[_0xb7aa('0x8b')][_0xb7aa('0x70')](this,_0xab1e8c);if(_0x50d1a7){for(var _0x3be662 in _0x50d1a7){if(_0x50d1a7['hasOwnProperty'](_0x3be662)&&_[_0xb7aa('0x94')](_0x50d1a7[_0x3be662])){this[_0xb7aa('0xe')][_0xb7aa('0x9c')](util['format'](_0xb7aa('0x127'),_0x3be662['toUpperCase']()),_0x50d1a7[_0x3be662]);}}if(_['isNil'](_0x50d1a7[_0xb7aa('0x78')])){return this['channel'][_0xb7aa('0xa5')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x50d1a7[_0xb7aa('0x78')],_0xb7aa('0xe9'),_0xb7aa('0x128'),'');return this[_0xb7aa('0xe')]['noop'](util[_0xb7aa('0x27')](_0xb7aa('0x129'),_0x50d1a7['message']));}}return this[_0xb7aa('0xe')]['error'](_0xab1e8c,_0xb7aa('0x12a'));};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x12b')]=function(_0x2888ca){logger[_0xb7aa('0x2b')](util['format']('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x2888ca[_0xb7aa('0x33')],_0x2888ca[_0xb7aa('0x65')]));if(!this[_0xb7aa('0xa3')](_0x2888ca[_0xb7aa('0x7c')])){return this['channel'][_0xb7aa('0xa5')](_0xb7aa('0xe4'));}var _0x1168bb=_0xb7aa('0x12c');var _0x52776f=util[_0xb7aa('0x27')](_0xb7aa('0x12d'),FILES_PATH,rs['generate'](0x4));var _0x54d21c=util[_0xb7aa('0x27')](_0xb7aa('0x9b'),_0x52776f,_0x1168bb);var _0x3b050a=!![];if(_0x2888ca['beep']===_0xb7aa('0x12e')){_0x3b050a=![];}var _0xbf5c4b=this[_0xb7aa('0xe')][_0xb7aa('0x12f')](_0x52776f,_0x1168bb,_0x2888ca[_0xb7aa('0x130')],_0x2888ca[_0xb7aa('0x65')],undefined,_0x3b050a);if(_0xbf5c4b[_0xb7aa('0xa1')]!==-0x1){this[_0xb7aa('0xe')][_0xb7aa('0xa5')](util[_0xb7aa('0x27')](_0xb7aa('0x131'),_0x54d21c));var _0x4a4d54=this['googleASR'][_0xb7aa('0x70')](this,_0x2888ca,_0x54d21c);if(_0x4a4d54){for(var _0x59d63c in _0x4a4d54){if(_0x4a4d54['hasOwnProperty'](_0x59d63c)){this['channel'][_0xb7aa('0x9c')](util[_0xb7aa('0x27')](_0xb7aa('0x132'),_0x59d63c[_0xb7aa('0x6a')]()),_0x4a4d54[_0x59d63c]);}}return this[_0xb7aa('0xe')]['noop'](util[_0xb7aa('0x27')](_0xb7aa('0x133'),JSON[_0xb7aa('0x74')](_0x4a4d54)));}}return _0xbf5c4b;};AGIVertices['prototype'][_0xb7aa('0x134')]=function(_0x5a8aca){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x135'),_0x5a8aca['label']));if(!this[_0xb7aa('0xa3')](_0x5a8aca[_0xb7aa('0x90')])){return this['channel'][_0xb7aa('0xa5')](_0xb7aa('0x136'));}if(!this[_0xb7aa('0xa3')](_0x5a8aca[_0xb7aa('0x91')])){return this['channel'][_0xb7aa('0xa5')]('no\x20appsecret\x20configured');}var _0x2b33a6=_0xb7aa('0x12c');var _0x24e1ec=util['format'](_0xb7aa('0x12d'),FILES_PATH,rs['generate'](0x4));var _0x31bbf4=util[_0xb7aa('0x27')](_0xb7aa('0x9b'),_0x24e1ec,_0x2b33a6);var _0x4433c9=!![];if(_0x5a8aca[_0xb7aa('0x137')]===_0xb7aa('0x12e')){_0x4433c9=![];}var _0x49e699=this[_0xb7aa('0xe')]['recordFile'](_0x24e1ec,_0x2b33a6,_0x5a8aca[_0xb7aa('0x130')],_0x5a8aca[_0xb7aa('0x65')],undefined,_0x4433c9);if(_0x49e699['result']!==-0x1){this['channel'][_0xb7aa('0xa5')](util['format'](_0xb7aa('0x138'),_0x31bbf4));var _0x2ea3c7=this[_0xb7aa('0x8f')]['sync'](this,_0x5a8aca,_0x31bbf4);if(_0x2ea3c7){for(var _0x2804a3 in _0x2ea3c7){if(_0x2ea3c7[_0xb7aa('0x93')](_0x2804a3)){this[_0xb7aa('0xe')]['setVariable'](util[_0xb7aa('0x27')](_0xb7aa('0x139'),_0x2804a3[_0xb7aa('0x6a')]()),_0x2ea3c7[_0x2804a3]);}}return this[_0xb7aa('0xe')][_0xb7aa('0xa5')](util['format'](_0xb7aa('0x13a'),JSON[_0xb7aa('0x74')](_0x2ea3c7)));}}return _0x49e699;};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x13b')]=function(_0x5608f9){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x13c'),_0x5608f9['label']));return this[_0xb7aa('0xe')][_0xb7aa('0x13d')](_0x5608f9['context'],_0x5608f9[_0xb7aa('0x3a')],_0x5608f9[_0xb7aa('0x3b')]);};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x13e')]=function(_0x4694b4){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x13f'),_0x4694b4['label']));if(!this[_0xb7aa('0xa3')](_0x4694b4['condition'])){return this[_0xb7aa('0xe')][_0xb7aa('0x2e')](_0x4694b4,'no\x20condition\x20configured');}try{var _0xb98a0b=eval(_0x4694b4[_0xb7aa('0x140')])?_0xb7aa('0x141'):'false';this[_0xb7aa('0xe')][_0xb7aa('0xa5')](util[_0xb7aa('0x27')](_0xb7aa('0x142'),_0x4694b4[_0xb7aa('0x140')],_0xb98a0b));return{'code':0xc8,'result':_0xb98a0b};}catch(_0x5438f9){return{'code':0xc8,'result':_0xb7aa('0x143')};}};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x144')]=function(_0x40754f){logger['info'](util[_0xb7aa('0x27')](_0xb7aa('0x145'),_0x40754f[_0xb7aa('0x33')]));if(!this['isConfigured'](_0x40754f[_0xb7aa('0x146')])){return this[_0xb7aa('0xe')][_0xb7aa('0x2e')](_0x40754f,'no\x20interval\x20configured');}var _0x2f9d83=this[_0xb7aa('0x147')][_0xb7aa('0x70')](this,_0x40754f['interval_id']);if(!_0x2f9d83){return this[_0xb7aa('0xe')][_0xb7aa('0x2e')](_0x40754f,_0xb7aa('0x148'));}for(var _0x3b4e25=0x0;_0x3b4e25<_0x2f9d83[_0xb7aa('0x98')];_0x3b4e25+=0x1){var _0x835569=this[_0xb7aa('0xe')][_0xb7aa('0x10')](util[_0xb7aa('0x27')](_0xb7aa('0x149'),_0x2f9d83[_0x3b4e25]));if(_0x835569[_0xb7aa('0xa1')]===-0x1){return _0x835569;}logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x14a'),_0x2f9d83[_0x3b4e25],_0x835569[_0xb7aa('0x9f')]));if(_0x835569[_0xb7aa('0x9f')]===_0xb7aa('0x141')){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x14a'),_0x2f9d83[_0x3b4e25],_0xb7aa('0x141')));this[_0xb7aa('0xe')][_0xb7aa('0xa5')](util[_0xb7aa('0x27')](_0xb7aa('0x14a'),_0x2f9d83[_0x3b4e25],_0xb7aa('0x141')));return{'code':0xc8,'result':'true'};}else{logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')]('IFTIME\x20%s\x20%s',_0x2f9d83[_0x3b4e25],_0xb7aa('0x143')));this[_0xb7aa('0xe')][_0xb7aa('0xa5')](util['format'](_0xb7aa('0x14a'),_0x2f9d83[_0x3b4e25],_0xb7aa('0x143')));}}return{'code':0xc8,'result':_0xb7aa('0x143')};};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x14b')]=function(_0x32e17d){logger['info'](util[_0xb7aa('0x27')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x32e17d[_0xb7aa('0x33')]));return this[_0xb7aa('0xe')][_0xb7aa('0x14b')]();};AGIVertices['prototype']['ispeechasr']=function(_0x34210f){logger['info'](util[_0xb7aa('0x27')](_0xb7aa('0x14c'),_0x34210f['label']));if(!this[_0xb7aa('0xa3')](_0x34210f['key'])){return this[_0xb7aa('0xe')]['noop']('no\x20key\x20configured');}var _0x9f02b8='wav';var _0x37483c=util[_0xb7aa('0x27')]('%s/recordings/%s',FILES_PATH,rs[_0xb7aa('0x116')](0x4));var _0x4b0a50=util[_0xb7aa('0x27')](_0xb7aa('0x9b'),_0x37483c,_0x9f02b8);var _0x1eef97=!![];if(_0x34210f['beep']===_0xb7aa('0x12e')){_0x1eef97=![];}var _0x369ef0=this[_0xb7aa('0xe')]['recordFile'](_0x37483c,_0x9f02b8,_0x34210f[_0xb7aa('0x130')],_0x34210f[_0xb7aa('0x65')],undefined,_0x1eef97);if(_0x369ef0[_0xb7aa('0xa1')]!==-0x1){this[_0xb7aa('0xe')]['noop'](util[_0xb7aa('0x27')]('ispeech\x20%s\x20file\x20created',_0x4b0a50));var _0x1750c8=this[_0xb7aa('0x14d')][_0xb7aa('0x70')](this,_0x34210f,_0x4b0a50);if(_0x1750c8){for(var _0x53d267 in _0x1750c8){if(_0x1750c8[_0xb7aa('0x93')](_0x53d267)){this[_0xb7aa('0xe')][_0xb7aa('0x9c')](util[_0xb7aa('0x27')](_0xb7aa('0x14e'),_0x53d267[_0xb7aa('0x6a')]()),_0x1750c8[_0x53d267]);}}return this['channel'][_0xb7aa('0xa5')](util['format'](_0xb7aa('0x14f'),JSON[_0xb7aa('0x74')](_0x1750c8)));}}return _0x369ef0;};AGIVertices['prototype'][_0xb7aa('0x150')]=function(_0x56a05b){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x151'),_0x56a05b[_0xb7aa('0x33')]));if(!this['isConfigured'](_0x56a05b[_0xb7aa('0x7c')])){return this[_0xb7aa('0xe')][_0xb7aa('0xa5')](_0xb7aa('0xe4'));}if(!this[_0xb7aa('0xa3')](_0x56a05b[_0xb7aa('0x61')])){return this[_0xb7aa('0xe')]['noop'](_0xb7aa('0xa6'));}this[_0xb7aa('0xe')][_0xb7aa('0xa5')](util['format'](_0xb7aa('0x152'),_0x56a05b[_0xb7aa('0x61')]));var _0x4866d9=this[_0xb7aa('0x81')][_0xb7aa('0x70')](this,_0x56a05b);if(_0x4866d9){this[_0xb7aa('0xe')][_0xb7aa('0xa5')](util[_0xb7aa('0x27')](_0xb7aa('0x153'),_0x4866d9));var _0x426df7=this[_0xb7aa('0xe')]['streamFile'](_0x4866d9,_0x56a05b[_0xb7aa('0x130')]);try{fs[_0xb7aa('0xfe')](_0x4866d9+_0xb7aa('0xff'));}catch(_0x1d848a){logger['error'](_0x1d848a);}return _0x426df7;}return this[_0xb7aa('0xe')]['error'](_0x56a05b,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x154')]=function(_0x54850e){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x155'),_0x54850e['label']));if(!this[_0xb7aa('0xa3')](_0x54850e[_0xb7aa('0x156')])){return this['channel'][_0xb7aa('0x2e')](_0x54850e,_0xb7aa('0x157'));}logger['info'](util[_0xb7aa('0x27')](_0xb7aa('0x158'),this[_0xb7aa('0xe')]['callerid'],_0x54850e[_0xb7aa('0x156')]));var _0x680080=this[_0xb7aa('0x4f')][_0xb7aa('0x70')](this,_0x54850e[_0xb7aa('0x156')]);if(_0x680080){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x159'),this[_0xb7aa('0xe')][_0xb7aa('0x36')],_0x54850e[_0xb7aa('0x156')]));this[_0xb7aa('0xe')][_0xb7aa('0xa5')](util[_0xb7aa('0x27')](_0xb7aa('0x159'),this[_0xb7aa('0xe')]['callerid'],_0x54850e[_0xb7aa('0x156')]));return{'code':0xc8,'result':'success'};}else{logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x15a'),this['channel']['callerid'],_0x54850e[_0xb7aa('0x156')]));this[_0xb7aa('0xe')][_0xb7aa('0xa5')](util[_0xb7aa('0x27')](_0xb7aa('0x15a'),this[_0xb7aa('0xe')]['callerid'],_0x54850e[_0xb7aa('0x156')]));return{'code':0xc8,'result':_0xb7aa('0x15b')};}};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x15c')]=function(_0x10a196){logger['info'](util['format'](_0xb7aa('0x15d'),_0x10a196[_0xb7aa('0x33')]));if(!this[_0xb7aa('0xa3')](_0x10a196['findBy'])){return this[_0xb7aa('0xe')][_0xb7aa('0x2e')](_0x10a196,_0xb7aa('0x157'));}logger['info'](util[_0xb7aa('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xb7aa('0xe')]['callerid'],_0x10a196[_0xb7aa('0x156')]));var _0x4be409=this['agentLogout'][_0xb7aa('0x70')](this,_0x10a196[_0xb7aa('0x156')]);if(_0x4be409){logger[_0xb7aa('0x2b')](util['format'](_0xb7aa('0x159'),this[_0xb7aa('0xe')][_0xb7aa('0x36')],_0x10a196[_0xb7aa('0x156')]));this[_0xb7aa('0xe')]['noop'](util[_0xb7aa('0x27')](_0xb7aa('0x159'),this[_0xb7aa('0xe')][_0xb7aa('0x36')],_0x10a196[_0xb7aa('0x156')]));return{'code':0xc8,'result':_0xb7aa('0x15e')};}else{logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x15a'),this[_0xb7aa('0xe')][_0xb7aa('0x36')],_0x10a196[_0xb7aa('0x156')]));this[_0xb7aa('0xe')][_0xb7aa('0xa5')](util['format'](_0xb7aa('0x15a'),this['channel'][_0xb7aa('0x36')],_0x10a196[_0xb7aa('0x156')]));return{'code':0xc8,'result':_0xb7aa('0x15b')};}};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x15f')]=function(_0x5a014e){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x160'),_0x5a014e[_0xb7aa('0x33')]));if(!this[_0xb7aa('0xa3')](_0x5a014e[_0xb7aa('0x161')])){return this[_0xb7aa('0xe')][_0xb7aa('0x2e')](_0x5a014e,_0xb7aa('0x162'));}this[_0xb7aa('0xe')][_0xb7aa('0xa5')](util[_0xb7aa('0x27')](_0xb7aa('0x163'),_0x5a014e['operation']));var _0x1f3319=eval(_0x5a014e['operation']);if(!this[_0xb7aa('0xa3')](_0x5a014e[_0xb7aa('0xd5')])){return this[_0xb7aa('0xe')][_0xb7aa('0xa5')](_0xb7aa('0xd6'));}var _0x10c1ef=this['getVariable'][_0xb7aa('0x70')](this,_0x5a014e['variable_id']);if(!_0x10c1ef){return this[_0xb7aa('0xe')][_0xb7aa('0x2e')](_0x5a014e,_0xb7aa('0xd7'));}if(_[_0xb7aa('0x97')](_0x1f3319)){var _0x4697f7=this;_0x1f3319[_0xb7aa('0xd8')](function(_0x2be83c,_0x22eb32){_0x4697f7[_0xb7aa('0xe')][_0xb7aa('0x9c')](util[_0xb7aa('0x27')](_0xb7aa('0x164'),_0x10c1ef,_0x22eb32),_0x2be83c);});return this[_0xb7aa('0xe')]['noop'](util[_0xb7aa('0x27')](_0xb7aa('0x165'),_0x10c1ef));}else{return this[_0xb7aa('0xe')][_0xb7aa('0x9c')](_0x10c1ef,_0x1f3319);}};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0xc')]=function(_0x2c9a82){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x166'),_0x2c9a82[_0xb7aa('0x33')]));if(_0x2c9a82[_0xb7aa('0xa4')]===0x0){return this[_0xb7aa('0x10d')](_0x2c9a82);}_0x2c9a82[_0xb7aa('0xa4')]-=0x1;if(!this[_0xb7aa('0xa3')](_0x2c9a82[_0xb7aa('0x10e')])){return this[_0xb7aa('0xe')]['error'](_0x2c9a82,_0xb7aa('0x10f'));}var _0x13cd53=this['getSound'][_0xb7aa('0x70')](this,_0x2c9a82[_0xb7aa('0x10e')]);if(!_0x13cd53){return this[_0xb7aa('0xe')]['error'](_0x2c9a82,_0xb7aa('0x167'));}var _0x239c07=this['channel'][_0xb7aa('0x111')](_0x13cd53,_0x2c9a82[_0xb7aa('0x112')],_0x2c9a82[_0xb7aa('0x168')]);var _0x4b1928=_0x239c07[_0xb7aa('0xa1')];if(_0x239c07['result']===-0x1){this[_0xb7aa('0x31')][_0xb7aa('0x70')](this,_0x2c9a82,'-1');return _0x239c07;}else if(_0x239c07[_0xb7aa('0x9f')]===_0xb7aa('0x65')){_0x239c07[_0xb7aa('0xa1')]=_0x239c07['result'][_0xb7aa('0x98')]>0x0?_0x239c07[_0xb7aa('0xa1')]:'t';}else if(_['isEmpty'](_0x239c07[_0xb7aa('0xa1')])){_0x239c07[_0xb7aa('0xa1')]='#';_0x4b1928='#';}if(!this['isConfigured'](_0x2c9a82[_0xb7aa('0xd5')])){this['channel']['noop'](_0xb7aa('0xd6'));}else{var _0xfad912=this[_0xb7aa('0x10')][_0xb7aa('0x70')](this,_0x2c9a82[_0xb7aa('0xd5')]);if(!_0xfad912){return this['channel'][_0xb7aa('0x2e')](_0x2c9a82,_0xb7aa('0xd7'));}this[_0xb7aa('0xe')][_0xb7aa('0x9c')](_0xfad912,_0x4b1928);}this[_0xb7aa('0x31')][_0xb7aa('0x70')](this,_0x2c9a82,_0x4b1928);return _0x239c07;};AGIVertices['prototype'][_0xb7aa('0xa5')]=function(_0x42b3ac){logger['info'](util[_0xb7aa('0x27')](_0xb7aa('0x169'),_0x42b3ac[_0xb7aa('0x33')]));return this['channel']['noop'](_0x42b3ac[_0xb7aa('0x16a')]||_0x42b3ac[_0xb7aa('0x33')]);};AGIVertices['prototype'][_0xb7aa('0x16b')]=function(_0x3a111b){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x16c'),_0x3a111b[_0xb7aa('0x33')]));if(!this['isConfigured'](_0x3a111b[_0xb7aa('0x156')])){return this[_0xb7aa('0xe')][_0xb7aa('0x2e')](_0x3a111b,_0xb7aa('0x157'));}logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x158'),this[_0xb7aa('0xe')][_0xb7aa('0x36')],_0x3a111b[_0xb7aa('0x156')]));var _0x3ea5c1=this[_0xb7aa('0x16d')][_0xb7aa('0x70')](this,_0x3a111b[_0xb7aa('0x16e')]);var _0x1c04b7=this[_0xb7aa('0x16f')][_0xb7aa('0x70')](this,_0x3a111b['findBy'],_0x3ea5c1);if(_0x1c04b7){logger['info'](util[_0xb7aa('0x27')](_0xb7aa('0x159'),this[_0xb7aa('0xe')]['callerid'],_0x3a111b[_0xb7aa('0x156')]));this[_0xb7aa('0xe')][_0xb7aa('0xa5')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xb7aa('0xe')][_0xb7aa('0x36')],_0x3a111b['findBy']));return{'code':0xc8,'result':_0xb7aa('0x15e')};}else{logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x15a'),this[_0xb7aa('0xe')][_0xb7aa('0x36')],_0x3a111b['findBy']));this[_0xb7aa('0xe')][_0xb7aa('0xa5')](util[_0xb7aa('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xb7aa('0xe')][_0xb7aa('0x36')],_0x3a111b[_0xb7aa('0x156')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x170')]=function(_0x36f5bc){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x171'),_0x36f5bc[_0xb7aa('0x33')]));if(!this[_0xb7aa('0xa3')](_0x36f5bc[_0xb7aa('0x10e')])){return this['channel'][_0xb7aa('0x2e')](_0x36f5bc,'no\x20file\x20audio\x20selected');}var _0xcc2480=this[_0xb7aa('0x110')]['sync'](this,_0x36f5bc[_0xb7aa('0x10e')]);if(!_0xcc2480){return this[_0xb7aa('0xe')]['error'](_0x36f5bc,_0xb7aa('0x167'));}var _0x1e1fab=this[_0xb7aa('0xe')][_0xb7aa('0x54')](_0xb7aa('0x172'),[_0xcc2480,_0x36f5bc[_0xb7aa('0xe1')]]);if(_0x1e1fab[_0xb7aa('0xa1')]===-0x1){return _0x1e1fab;}return this[_0xb7aa('0xe')][_0xb7aa('0xa5')](util[_0xb7aa('0x27')](_0xb7aa('0xc0'),_0xb7aa('0x172'),_0xcc2480));};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x173')]=function(_0x256bfc){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x174'),_0x256bfc[_0xb7aa('0x33')]));if(!this[_0xb7aa('0xa3')](_0x256bfc['queue_id'])){return this[_0xb7aa('0xe')][_0xb7aa('0x2e')](_0x256bfc,'no\x20queue\x20selected');}var _0x1728a7='';var _0x20988e=parseInt(_0x256bfc['queue_id'],0xa);if(isNaN(_0x20988e)){_0x1728a7=_0x256bfc[_0xb7aa('0x175')];}else{_0x1728a7=this[_0xb7aa('0x16')][_0xb7aa('0x70')](this,_0x256bfc['queue_id']);if(!_0x1728a7){return this[_0xb7aa('0xe')][_0xb7aa('0x2e')](_0x256bfc,_0xb7aa('0x176'));}}var _0x58c879='';if(this[_0xb7aa('0xa3')](_0x256bfc[_0xb7aa('0x10e')])){var _0x3d4314=this[_0xb7aa('0x110')][_0xb7aa('0x70')](this,_0x256bfc[_0xb7aa('0x10e')]);if(_0x3d4314){_0x58c879=_0x3d4314;}}this[_0xb7aa('0x31')][_0xb7aa('0x70')](this,_0x256bfc,_0x1728a7);if(_0x256bfc[_0xb7aa('0xe1')][_0xb7aa('0x177')]('x')<0x0){_0x256bfc['opts']+='x';}if(_0x256bfc[_0xb7aa('0xe1')][_0xb7aa('0x177')]('X')<0x0){_0x256bfc['opts']+='X';}this['channel'][_0xb7aa('0x9c')](_0xb7aa('0x178'),_0x1728a7?_0x1728a7[_0xb7aa('0x179')]():'');var _0x290695=this[_0xb7aa('0xe')][_0xb7aa('0x54')](_0xb7aa('0x17a'),[_0x1728a7,_0x256bfc[_0xb7aa('0xe1')],_0x256bfc[_0xb7aa('0x63')],_0x58c879,_0x256bfc['timeout'],_0x256bfc[_0xb7aa('0x6')],_0x256bfc[_0xb7aa('0x17b')],_0x256bfc[_0xb7aa('0x17c')],'',_0x256bfc['position']]);if(_0x290695[_0xb7aa('0xa1')]===-0x1){return _0x290695;}return this['channel']['noop'](util[_0xb7aa('0x27')](_0xb7aa('0xc0'),_0xb7aa('0x17a'),_0x1728a7));};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x17d')]=function(_0x1560ef){logger[_0xb7aa('0x2b')](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x1560ef[_0xb7aa('0x33')]));var _0x3cdfe7=_0x1560ef[_0xb7aa('0x17e')]||_0xb7aa('0x12c');var _0x11a801=util[_0xb7aa('0x27')](_0xb7aa('0x17f'),this['channel'][_0xb7aa('0x32')],rs[_0xb7aa('0x116')](0x5));var _0x4cf46a=util[_0xb7aa('0x27')](_0xb7aa('0x180'),FILES_PATH,_0x11a801,_0x3cdfe7);var _0x42458f=util[_0xb7aa('0x27')](_0xb7aa('0x12d'),FILES_PATH,_0x11a801);this[_0xb7aa('0x37')][_0xb7aa('0x70')](this,_0x1560ef,_0x11a801,_0x4cf46a);this['channel']['setVariable']('RECORDING_SAVENAME',_0x11a801);logger[_0xb7aa('0x2b')](_0xb7aa('0x181'),_0x42458f,_0x3cdfe7,_0x1560ef[_0xb7aa('0x182')],_0x1560ef[_0xb7aa('0x65')]);return this['channel'][_0xb7aa('0x12f')](_0x42458f,_0x3cdfe7,_0x1560ef['escape_digits'],_0x1560ef[_0xb7aa('0x65')],undefined,!![]);};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x183')]=function(_0x468c51){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x184'),_0x468c51['label']));if(!this[_0xb7aa('0xa3')](_0x468c51[_0xb7aa('0x63')])){return this[_0xb7aa('0xe')][_0xb7aa('0xa5')](_0xb7aa('0x185'));}var _0x297fa4=this[_0xb7aa('0x62')][_0xb7aa('0x70')](this,_0x468c51);logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')]('Response:',util[_0xb7aa('0x186')](_0x297fa4,{'showHidden':![],'depth':null})));if(!this[_0xb7aa('0xa3')](_0x468c51[_0xb7aa('0xd5')])){return this[_0xb7aa('0xe')][_0xb7aa('0xa5')](_0xb7aa('0x187'));}var _0x33986c=this['getVariable'][_0xb7aa('0x70')](this,_0x468c51[_0xb7aa('0xd5')]);if(!_0x33986c){return this[_0xb7aa('0xe')]['error'](_0x468c51,_0xb7aa('0xd7'));}this['channel'][_0xb7aa('0x9c')](util['format']('%s_STATUS_CODE',_0x33986c),_0x297fa4[_0xb7aa('0x76')]?_0x297fa4['statusCode']:_0xb7aa('0x188'));this[_0xb7aa('0xe')][_0xb7aa('0x9c')](util['format'](_0xb7aa('0x189'),_0x33986c),_0x297fa4['statusMessage']?_0x297fa4['statusMessage']:'OK');if(_0x297fa4[_0xb7aa('0x73')]){try{this[_0xb7aa('0x9a')](_0x297fa4['body'],_0x33986c);}catch(_0x768cbc){logger['error'](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x33986c));}}return this[_0xb7aa('0xe')]['noop'](util['format'](_0xb7aa('0xdb'),_0x33986c));};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x18a')]=function(_0x5025a2){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x5025a2[_0xb7aa('0x33')]));return this[_0xb7aa('0xe')]['sayDigits'](_0x5025a2[_0xb7aa('0x18b')]['replace'](/\s+/g,''),_0x5025a2[_0xb7aa('0x182')]);};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x18c')]=function(_0x2bda97){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x18d'),_0x2bda97[_0xb7aa('0x33')]));return this['channel'][_0xb7aa('0x18e')](_0x2bda97['number'][_0xb7aa('0x56')](/\s+/g,''),_0x2bda97['escape_digits']);};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x18f')]=function(_0x387b9a){logger[_0xb7aa('0x2b')](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x387b9a[_0xb7aa('0x33')]));return this[_0xb7aa('0xe')]['sayPhonetic'](_0x387b9a[_0xb7aa('0x61')],_0x387b9a[_0xb7aa('0x182')]);};AGIVertices[_0xb7aa('0x15')]['sendMail']=function(_0x39841e){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x39841e[_0xb7aa('0x33')]));if(!this[_0xb7aa('0xa3')](_0x39841e['account_id'])){return this[_0xb7aa('0xe')][_0xb7aa('0xa5')](_0xb7aa('0x190'));}var _0x195811=this[_0xb7aa('0x22')][_0xb7aa('0x70')](this,_0x39841e[_0xb7aa('0x191')]);if(!_0x195811||!_0x195811[_0xb7aa('0x192')]){return this[_0xb7aa('0xe')][_0xb7aa('0x2e')](_0x39841e,'no\x20mail\x20account\x20found');}var _0x12861b={'from':util[_0xb7aa('0x27')](_0xb7aa('0x193'),_0x195811[_0xb7aa('0x13')],_0x195811[_0xb7aa('0x194')]||_0x195811[_0xb7aa('0x192')]['user']),'to':_0x39841e['to']||'','cc':_0x39841e['cc']||'','bcc':_0x39841e[_0xb7aa('0x195')]||'','subject':_0x39841e[_0xb7aa('0x196')],'html':_0x39841e[_0xb7aa('0x61')],'text':_0x39841e['text']};var _0x348830={'tls':{'rejectUnauthorized':![]}};if(_0x195811[_0xb7aa('0x192')]['service']){_0x348830[_0xb7aa('0x197')]=_0x195811['Smtp'][_0xb7aa('0x197')];}else{_0x348830[_0xb7aa('0x198')]=_0x195811[_0xb7aa('0x192')][_0xb7aa('0x198')];_0x348830[_0xb7aa('0x199')]=_0x195811[_0xb7aa('0x192')]['port'];_0x348830['secure']=_0x195811[_0xb7aa('0x192')][_0xb7aa('0x19a')];}if(_0x195811['Smtp'][_0xb7aa('0x19b')]){_0x348830[_0xb7aa('0x19c')]={'user':_0x195811['Smtp'][_0xb7aa('0x19d')],'pass':_0x195811[_0xb7aa('0x192')][_0xb7aa('0x19e')]};}if(this[_0xb7aa('0xa3')](_0x39841e[_0xb7aa('0x19f')])){}logger[_0xb7aa('0xdd')](_0xb7aa('0x1a0'),JSON[_0xb7aa('0x74')](_0x12861b));this[_0xb7aa('0x31')][_0xb7aa('0x70')](this,_0x39841e,_0x39841e[_0xb7aa('0x191')]);this[_0xb7aa('0xe')][_0xb7aa('0xa5')](util[_0xb7aa('0x27')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x195811[_0xb7aa('0x13')]));this[_0xb7aa('0x1a1')][_0xb7aa('0x70')](this,_0x348830,_0x12861b);return this[_0xb7aa('0xe')][_0xb7aa('0xa5')](_0xb7aa('0x1a2'));};AGIVertices[_0xb7aa('0x15')]['sendFax']=function(_0x57ff34){logger['info'](util[_0xb7aa('0x27')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x57ff34['label']));return this[_0xb7aa('0xe')]['noop'](_0xb7aa('0x1a3'));};AGIVertices['prototype'][_0xb7aa('0x1a4')]=function(_0x54d9ae){logger['info'](util[_0xb7aa('0x27')](_0xb7aa('0x1a5'),_0x54d9ae[_0xb7aa('0x33')]));if(!this[_0xb7aa('0xa3')](_0x54d9ae[_0xb7aa('0x1a6')])){return this[_0xb7aa('0xe')]['noop'](_0xb7aa('0x1a7'));}var _0x521ead=this[_0xb7aa('0x1a8')][_0xb7aa('0x70')](this,_0x54d9ae['sms_account_id']);if(!_0x521ead){return this[_0xb7aa('0xe')][_0xb7aa('0x2e')](_0x54d9ae,_0xb7aa('0x1a9'));}var _0x548680={'body':_0x54d9ae[_0xb7aa('0x1aa')],'phone':_0x54d9ae['to']||'','SmsAccountId':_0x521ead['id']};logger[_0xb7aa('0xdd')](_0xb7aa('0x1ab'),JSON['stringify'](_0x548680));this[_0xb7aa('0x31')][_0xb7aa('0x70')](this,_0x54d9ae,_0x54d9ae[_0xb7aa('0x1a6')]);this['channel'][_0xb7aa('0xa5')](util[_0xb7aa('0x27')](_0xb7aa('0x1ac'),_0x521ead[_0xb7aa('0x13')]));this[_0xb7aa('0x30')][_0xb7aa('0x70')](this,_0x548680);return this['channel'][_0xb7aa('0xa5')](_0xb7aa('0x1ad'));};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x1ae')]=function(_0x4f8fdc){logger[_0xb7aa('0x2b')](util['format'](_0xb7aa('0x1af'),_0x4f8fdc[_0xb7aa('0x33')]));if(!this[_0xb7aa('0xa3')](_0x4f8fdc['variable_id'])){return this[_0xb7aa('0xe')][_0xb7aa('0x2e')](_0x4f8fdc,_0xb7aa('0x1b0'));}var _0xdb1fd0=this[_0xb7aa('0x10')]['sync'](this,_0x4f8fdc[_0xb7aa('0xd5')]);if(!_0xdb1fd0){return this['channel'][_0xb7aa('0x2e')](_0x4f8fdc,_0xb7aa('0xd7'));}return this[_0xb7aa('0xe')][_0xb7aa('0x9c')](_0xdb1fd0,_0x4f8fdc[_0xb7aa('0x1b1')]);};AGIVertices[_0xb7aa('0x15')]['start']=function(_0x55f934){logger[_0xb7aa('0x2b')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x55f934[_0xb7aa('0x33')]));this[_0xb7aa('0xe')][_0xb7aa('0xa5')](_0xb7aa('0x1b2'));if(_0x55f934[_0xb7aa('0xb4')]===_0xb7aa('0x1b3')){this['channel']['noop'](_0xb7aa('0x1b4'));return this[_0xb7aa('0xe')][_0xb7aa('0xb4')]();}return this[_0xb7aa('0xe')][_0xb7aa('0xa5')]('Skipped\x20Answer');};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x1b5')]=function(_0x19469a){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x1b6'),_0x19469a['label']));if(!this['isConfigured'](_0x19469a[_0xb7aa('0x1b7')])){return this[_0xb7aa('0xe')][_0xb7aa('0x2e')](_0x19469a,_0xb7aa('0x1b8'));}var _0x2dc1bd=this['getSquareProject'][_0xb7aa('0x70')](this,_0x19469a['project_id']);if(!this[_0xb7aa('0xa3')](_0x2dc1bd)){return this[_0xb7aa('0xe')][_0xb7aa('0x2e')](_0x19469a,util[_0xb7aa('0x27')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x19469a[_0xb7aa('0x1b7')]));}if(_0x2dc1bd===this[_0xb7aa('0xe')][_0xb7aa('0x35')]){return this[_0xb7aa('0xe')]['error'](_0x19469a,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xb7aa('0x31')][_0xb7aa('0x70')](this,_0x19469a,_0x2dc1bd);var _0x5ac3a8=this[_0xb7aa('0xe')][_0xb7aa('0x54')](_0xb7aa('0x1b9'),util['format'](_0xb7aa('0x1ba'),config[_0xb7aa('0x6')][_0xb7aa('0x198')]||_0xb7aa('0x1bb'),_0x2dc1bd,this[_0xb7aa('0xe')]['arg_1']));if(_0x5ac3a8[_0xb7aa('0xa1')]===-0x1){return _0x5ac3a8;}return this[_0xb7aa('0xe')][_0xb7aa('0xa5')](util[_0xb7aa('0x27')]('Executed\x20command\x20%s\x20%s','AGI',_0x2dc1bd));};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x1bc')]=function(_0x22ea0e){logger['info'](util[_0xb7aa('0x27')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x22ea0e[_0xb7aa('0x33')]));var _0x29ee51=this['shellCommand']['sync'](this,_0x22ea0e[_0xb7aa('0xb2')]);this[_0xb7aa('0x31')][_0xb7aa('0x70')](this,_0x22ea0e,_0x22ea0e[_0xb7aa('0xb2')]);if(this['isConfigured'](_0x22ea0e['variable_id'])){var _0x7e9add=this[_0xb7aa('0x10')]['sync'](this,_0x22ea0e[_0xb7aa('0xd5')]);if(_0x7e9add){this['channel'][_0xb7aa('0x9c')](_0x7e9add,_0x29ee51);return this[_0xb7aa('0xe')]['noop'](util[_0xb7aa('0x27')](_0xb7aa('0x1bd'),_0x22ea0e[_0xb7aa('0xb2')],_0x7e9add));}}return this['channel']['noop'](util['format']('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x22ea0e['command']));};AGIVertices[_0xb7aa('0x15')]['google_cloud_tts']=function(_0x4d2cd1){logger['info'](util[_0xb7aa('0x27')](_0xb7aa('0x1be'),_0x4d2cd1[_0xb7aa('0x33')]));_0x4d2cd1[_0xb7aa('0x61')]=_0x4d2cd1[_0xb7aa('0x61')][_0xb7aa('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x4d2cd1[_0xb7aa('0x58')])){return this[_0xb7aa('0xe')][_0xb7aa('0xa5')](_0xb7aa('0x1bf'));}if(!this[_0xb7aa('0xa3')](_0x4d2cd1['text'])){return this['channel'][_0xb7aa('0xa5')](_0xb7aa('0xa6'));}this[_0xb7aa('0xe')][_0xb7aa('0xa5')](util[_0xb7aa('0x27')](_0xb7aa('0x1c0'),_0x4d2cd1['text']));var _0x492255=this[_0xb7aa('0x57')][_0xb7aa('0x70')](this,_0x4d2cd1);if(_0x492255){this[_0xb7aa('0xe')][_0xb7aa('0xa5')](util[_0xb7aa('0x27')](_0xb7aa('0x1c1'),_0x492255));var _0x72edd=this['channel'][_0xb7aa('0x121')](_0x492255);try{fs[_0xb7aa('0xfe')](_0x492255+_0xb7aa('0xff'));}catch(_0x4147d3){logger[_0xb7aa('0x2e')](_0x4147d3);}return _0x72edd;}return this['channel']['error'](_0x4d2cd1,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0xb7aa('0x1c2')]=function(_0x15bf43){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x1c3'),_0x15bf43[_0xb7aa('0x33')]));_0x15bf43[_0xb7aa('0x61')]=_0x15bf43[_0xb7aa('0x61')][_0xb7aa('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xb7aa('0xa3')](_0x15bf43[_0xb7aa('0x61')])){return this[_0xb7aa('0xe')][_0xb7aa('0xa5')](_0xb7aa('0xa6'));}this[_0xb7aa('0xe')]['noop'](util['format'](_0xb7aa('0x1c4'),_0x15bf43[_0xb7aa('0x61')]));var _0xf9a887=this[_0xb7aa('0x60')][_0xb7aa('0x70')](this,_0x15bf43);if(_0xf9a887){this[_0xb7aa('0xe')]['noop'](util[_0xb7aa('0x27')](_0xb7aa('0x1c5'),_0xf9a887));var _0x500c8b=this[_0xb7aa('0xe')][_0xb7aa('0x121')](_0xf9a887);try{fs['unlink'](_0xf9a887+_0xb7aa('0xff'));}catch(_0x2bb9fe){logger[_0xb7aa('0x2e')](_0x2bb9fe);}return _0x500c8b;}return this[_0xb7aa('0xe')][_0xb7aa('0x2e')](_0x15bf43,_0xb7aa('0x1c6'));};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x1c7')]=function(_0x1704c0){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x1c8'),_0x1704c0[_0xb7aa('0x33')]));if(!this[_0xb7aa('0xa3')](_0x1704c0[_0xb7aa('0x156')])){return this[_0xb7aa('0xe')][_0xb7aa('0x2e')](_0x1704c0,_0xb7aa('0x157'));}logger['info'](util[_0xb7aa('0x27')](_0xb7aa('0x158'),this[_0xb7aa('0xe')]['callerid'],_0x1704c0[_0xb7aa('0x156')]));var _0x1c433a=this[_0xb7aa('0x4d')][_0xb7aa('0x70')](this,_0x1704c0[_0xb7aa('0x156')]);if(_0x1c433a){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x159'),this[_0xb7aa('0xe')][_0xb7aa('0x36')],_0x1704c0['findBy']));this['channel'][_0xb7aa('0xa5')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xb7aa('0x36')],_0x1704c0['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x15a'),this[_0xb7aa('0xe')]['callerid'],_0x1704c0[_0xb7aa('0x156')]));this[_0xb7aa('0xe')][_0xb7aa('0xa5')](util[_0xb7aa('0x27')](_0xb7aa('0x15a'),this[_0xb7aa('0xe')]['callerid'],_0x1704c0[_0xb7aa('0x156')]));return{'code':0xc8,'result':_0xb7aa('0x15b')};}};AGIVertices[_0xb7aa('0x15')]['voicemail']=function(_0x3d114e){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')](_0xb7aa('0x1c9'),_0x3d114e['label']));var _0xbe0df=this[_0xb7aa('0xe')][_0xb7aa('0x54')]('VOICEMAIL',[_0x3d114e[_0xb7aa('0x1ca')],_0x3d114e[_0xb7aa('0x7a')]]);if(_0xbe0df[_0xb7aa('0xa1')]===-0x1){return _0xbe0df;}return this['channel'][_0xb7aa('0xa5')](util['format']('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x3d114e[_0xb7aa('0x1ca')]));};AGIVertices[_0xb7aa('0x15')][_0xb7aa('0x1cb')]=function(_0x4439f8){logger[_0xb7aa('0x2b')](util[_0xb7aa('0x27')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x4439f8[_0xb7aa('0x33')]));if(!this[_0xb7aa('0xa3')](_0x4439f8[_0xb7aa('0xd5')])){return this[_0xb7aa('0xe')]['error'](_0x4439f8,_0xb7aa('0x1b0'));}var _0x44bd34=this[_0xb7aa('0x10')]['sync'](this,_0x4439f8['variable_id']);if(!_0x44bd34){return this[_0xb7aa('0xe')][_0xb7aa('0x2e')](_0x4439f8,_0xb7aa('0xd7'));}var _0xd360a3=this[_0xb7aa('0xe')][_0xb7aa('0x10')](_0x44bd34);return{'code':0xc8,'result':_0xd360a3[_0xb7aa('0x9f')]?_0xd360a3[_0xb7aa('0x9f')]:'-'};};String[_0xb7aa('0x15')][_0xb7aa('0x9e')]=function(_0x3eb387,_0x574357){return this[_0xb7aa('0x9d')](_0x3eb387)[_0xb7aa('0x1cc')](_0x574357);};module[_0xb7aa('0x1cd')]=AGIVertices; \ No newline at end of file +var _0x23c8=['SestekNDA\x20is\x20unreachable','end','ext_dial','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','opts','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response','maxdigit','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','%s/recordings/%s','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ISPEECH_ASR_%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','isArray','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','file_id','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','%s_STATUS_CODE','200','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','secure','auth','pass','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','unlink','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','agentUnpause','voicemail','VOICEMAIL','mailbox','vswitch','join','exports','path','util','lodash','shelljs','randomstring','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','rpc','mailRpc','getVariable','getVariableById','then','name','prototype','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','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','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','channel','arg_1','createSquareRecording','callerid','calleridname','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','render','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','googleDialogflow','key','dialogflow_language','googleDialogflowV2','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_polly_voice','awsLex','aws_secret_access_key','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','length','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','options','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','minutes','sync','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','%s[%s][%s]','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','dialogflow','Trying\x20Dialogflow:\x20%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20private_key\x20configured','bot','Trying\x20DialogflowV2:\x20%s','DIALOGFLOW_%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','audiofile','.wav','SestekNDA\x20Result\x20%s'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x23c8,0xca));var _0x823c=function(_0x52b132,_0x370be2){_0x52b132=_0x52b132-0x0;var _0x262a3b=_0x23c8[_0x52b132];return _0x262a3b;};'use strict';var fs=require('fs');var path=require(_0x823c('0x0'));var util=require(_0x823c('0x1'));var _=require(_0x823c('0x2'));var sh=require(_0x823c('0x3'));var odbc=require('odbc')();var rs=require(_0x823c('0x4'));var moment=require('moment');var Mustache=require('mustache');var rp=require(_0x823c('0x5'));var logger=require(_0x823c('0x6'))(_0x823c('0x7'));var config=require(_0x823c('0x8'));var scripts=require(_0x823c('0x9'));var FILES_PATH=_0x823c('0xa');var recursiveMapAttributes=[_0x823c('0xb'),_0x823c('0xc')];var verticesWithRetry=['menu',_0x823c('0xd'),_0x823c('0xe')];var AGIVertices=function(_0x20491e,_0x228081,_0xcf2d91){this['channel']=_0x20491e;this[_0x823c('0xf')]=_0x228081;this[_0x823c('0x10')]=_0xcf2d91;};AGIVertices['prototype'][_0x823c('0x11')]=function(_0x47c41c,_0x4db204){this[_0x823c('0xf')][_0x823c('0x12')](_0x47c41c)[_0x823c('0x13')](function(_0x4875b7){_0x4db204(null,_0x4875b7?_0x4875b7[_0x823c('0x14')]:![]);})['catch'](function(_0xc674a8){_0x4db204(_0xc674a8);});};AGIVertices[_0x823c('0x15')]['getVoiceQueue']=function(_0x5e8d14,_0x496d8e){this[_0x823c('0xf')]['getVoiceQueueById'](_0x5e8d14)[_0x823c('0x13')](function(_0x424750){_0x496d8e(null,_0x424750?_0x424750[_0x823c('0x14')]:![]);})[_0x823c('0x16')](function(_0x4f0346){_0x496d8e(_0x4f0346);});};AGIVertices[_0x823c('0x15')][_0x823c('0x17')]=function(_0x235baf,_0x3c609f){this[_0x823c('0xf')][_0x823c('0x18')](_0x235baf)[_0x823c('0x13')](function(_0x4c4882){_0x3c609f(null,_0x4c4882?_0x4c4882[_0x823c('0x14')]:![]);})[_0x823c('0x16')](function(_0x4c176d){_0x3c609f(_0x4c176d);});};AGIVertices['prototype'][_0x823c('0x19')]=function(_0x42a149,_0x5f026a){this[_0x823c('0xf')][_0x823c('0x1a')](_0x42a149)[_0x823c('0x13')](function(_0xbe93ce){_0x5f026a(null,_0xbe93ce?_0xbe93ce['dsn']:![]);})[_0x823c('0x16')](function(_0x32a56c){_0x5f026a(_0x32a56c);});};AGIVertices['prototype'][_0x823c('0x1b')]=function(_0x28d680,_0x5ade7d){this[_0x823c('0xf')][_0x823c('0x1c')](_0x28d680)[_0x823c('0x13')](function(_0x307f5d){_0x5ade7d(null,_0x307f5d?_0x307f5d[_0x823c('0x14')]:![]);})[_0x823c('0x16')](function(_0x2bc784){_0x5ade7d(_0x2bc784);});};AGIVertices[_0x823c('0x15')][_0x823c('0x1d')]=function(_0xc86f3,_0x1ab21a){this[_0x823c('0xf')][_0x823c('0x1e')](_0xc86f3)['then'](function(_0x40c8fe){_0x1ab21a(null,_0x40c8fe?_0x40c8fe[_0x823c('0x14')]:![]);})['catch'](function(_0x4e1baf){_0x1ab21a(_0x4e1baf);});};AGIVertices[_0x823c('0x15')][_0x823c('0x1f')]=function(_0x5b8242,_0x449203){var _0x4b1ad3=this;this[_0x823c('0xf')][_0x823c('0x20')](_0x5b8242)['then'](function(_0x493d6f){_0x449203(null,_0x493d6f?_0x4b1ad3[_0x823c('0x21')](_0x493d6f[_0x823c('0x22')]):![]);})[_0x823c('0x16')](function(_0x556562){_0x449203(_0x556562);});};AGIVertices[_0x823c('0x15')]['getMailAccount']=function(_0x16bad3,_0x3947d5){this[_0x823c('0xf')]['getMailAccountById'](_0x16bad3)[_0x823c('0x13')](function(_0x565045){_0x3947d5(null,_0x565045?_0x565045:![]);})[_0x823c('0x16')](function(_0x3353b9){_0x3947d5(_0x3353b9);});};AGIVertices[_0x823c('0x15')][_0x823c('0x23')]=function(_0x37346d,_0x984e75,_0x529aec){this[_0x823c('0x10')][_0x823c('0x23')](_0x37346d,_0x984e75)[_0x823c('0x13')](function(){_0x529aec(null);})['catch'](function(_0x55fc9e){_0x529aec(_0x55fc9e);});};AGIVertices['prototype'][_0x823c('0x24')]=function(_0x56b4e1,_0x2c7eef){this['rpc'][_0x823c('0x25')](_0x56b4e1)[_0x823c('0x13')](function(_0x329b56){if(_0x329b56){if(_0x329b56[_0x823c('0x26')]){_0x2c7eef(null,[_0x329b56[_0x823c('0x27')]]);}else{_0x2c7eef(null,_['map'](_0x329b56[_0x823c('0x28')],_0x823c('0x27')));}}else{_0x2c7eef(null,![]);}})['catch'](function(_0x9e9cbf){_0x2c7eef(_0x9e9cbf);});};AGIVertices['prototype'][_0x823c('0x21')]=function(_0x55247c){return util[_0x823c('0x29')](_0x823c('0x2a'),FILES_PATH,_0x55247c);};AGIVertices[_0x823c('0x15')][_0x823c('0x2b')]=function(_0x1c19b5,_0x815021,_0xd6de24){odbc[_0x823c('0x2c')](_0x1c19b5,function(_0x32eeac){if(_0x32eeac){logger[_0x823c('0x2d')](_0x823c('0x2e'),_0x32eeac);_0xd6de24(_0x32eeac);}else{logger[_0x823c('0x2f')](_0x823c('0x30'));odbc[_0x823c('0x31')](_0x815021,function(_0xefe82a,_0x188330){if(_0xefe82a){logger['info'](_0x823c('0x32'),_0x815021);_0xd6de24(_0xefe82a);}else{logger[_0x823c('0x2f')](_0x823c('0x33'),_0x815021);odbc[_0x823c('0x34')](function(_0x45f7b2){if(_0x45f7b2){logger[_0x823c('0x2d')](_0x823c('0x35'),_0x45f7b2);}_0xd6de24(null,_0x188330);});}});}});};AGIVertices['prototype'][_0x823c('0x36')]=function(_0x2a4eed,_0x364e58){this[_0x823c('0xf')]['getSmsAccountById'](_0x2a4eed)[_0x823c('0x13')](function(_0x3e0342){_0x364e58(null,_0x3e0342?_0x3e0342:![]);})['catch'](function(_0x5eb32c){_0x364e58(_0x5eb32c);});};AGIVertices[_0x823c('0x15')]['createSmsMessage']=function(_0x354cde,_0x380bec){this[_0x823c('0xf')][_0x823c('0x37')](_0x354cde)[_0x823c('0x13')](function(_0x229f72){_0x380bec(null,_0x229f72);})[_0x823c('0x16')](function(_0x193071){_0x380bec(_0x193071);});};AGIVertices[_0x823c('0x15')][_0x823c('0x38')]=function(_0x57776a,_0x23e631,_0x5ec7a0){this[_0x823c('0xf')]['createSquareDetailsReport']({'uniqueid':this['channel'][_0x823c('0x39')],'node':_0x57776a[_0x823c('0x3a')],'application':_0x57776a['agicommand'],'data':_0x23e631||null,'project_name':this[_0x823c('0x3b')][_0x823c('0x3c')],'callerid':this[_0x823c('0x3b')]['callerid']})[_0x823c('0x13')](function(_0x4279f6){if(_0x5ec7a0){_0x5ec7a0(null,_0x4279f6);}})[_0x823c('0x16')](function(_0x53f15c){if(_0x5ec7a0){_0x5ec7a0(_0x53f15c);}});};AGIVertices[_0x823c('0x15')][_0x823c('0x3d')]=function(_0x42bb90,_0x5a8cf3,_0x4afe08,_0x1f5c32){this['rpc']['createSquareRecording']({'uniqueid':this[_0x823c('0x3b')][_0x823c('0x39')],'callerid':this[_0x823c('0x3b')][_0x823c('0x3e')],'calleridname':this[_0x823c('0x3b')][_0x823c('0x3f')],'context':this['channel']['context'],'extension':this[_0x823c('0x3b')][_0x823c('0x40')],'priority':this[_0x823c('0x3b')][_0x823c('0x41')],'accountcode':this[_0x823c('0x3b')][_0x823c('0x42')],'dnid':this[_0x823c('0x3b')][_0x823c('0x43')],'projectName':this[_0x823c('0x3b')][_0x823c('0x3c')],'saveName':_0x5a8cf3,'filename':_0x42bb90[_0x823c('0x44')]||_0x5a8cf3,'savePath':_0x4afe08})[_0x823c('0x13')](function(_0x552928){_0x1f5c32(null,_0x552928);})[_0x823c('0x16')](function(_0x2c70bf){_0x1f5c32(_0x2c70bf);});};AGIVertices[_0x823c('0x15')][_0x823c('0x45')]=function(_0x4a431c,_0x195efa,_0x3254ca,_0x274c86,_0x534166){this[_0x823c('0xf')][_0x823c('0x45')]({'uniqueid':this[_0x823c('0x3b')][_0x823c('0x39')],'body':_0x4a431c,'direction':_0x195efa,'providerName':_0x3254ca,'providerResponse':_0x274c86})['then'](function(_0xdd6aa2){if(_0x534166){_0x534166(null,_0xdd6aa2);}})['catch'](function(_0x3ccb6c){if(_0x534166){_0x534166(_0x3ccb6c);}});};AGIVertices[_0x823c('0x15')][_0x823c('0x46')]=function(_0x4c7aaa,_0x4e1cf1){this[_0x823c('0xf')][_0x823c('0x46')]({'firstName':_[_0x823c('0x47')](_0x4c7aaa[_0x823c('0x14')])||_[_0x823c('0x48')](_0x4c7aaa[_0x823c('0x14')])?_0x823c('0x49')+Math[_0x823c('0x4a')]():_0x4c7aaa[_0x823c('0x14')],'lastName':_[_0x823c('0x47')](_0x4c7aaa[_0x823c('0x4b')])||_[_0x823c('0x48')](_0x4c7aaa[_0x823c('0x4b')])?null:_0x4c7aaa['lastName'],'phone':_0x4c7aaa[_0x823c('0x4c')],'ListId':_0x4c7aaa[_0x823c('0x4d')],'scheduledat':_0x4c7aaa['scheduledAt'],'callbackUniqueid':this[_0x823c('0x3b')][_0x823c('0x39')],'tags':'callback','description':_0x823c('0x4e')+_0x4c7aaa[_0x823c('0x4f')][_0x823c('0x50')](),'priority':_0x4c7aaa[_0x823c('0x51')]})[_0x823c('0x13')](function(_0x20aba5){_0x4e1cf1(null,_0x20aba5);})[_0x823c('0x16')](function(_0x31ce60){_0x4e1cf1(_0x31ce60);});};AGIVertices[_0x823c('0x15')][_0x823c('0x52')]=function(_0x2c2997,_0x5a9616){this[_0x823c('0xf')][_0x823c('0x53')](_0x2c2997)[_0x823c('0x13')](function(_0x115886){_0x5a9616(null,_0x115886?_0x115886[_0x823c('0x14')]:![]);})[_0x823c('0x16')](function(_0x1ec1dc){_0x5a9616(_0x1ec1dc);});};AGIVertices[_0x823c('0x15')][_0x823c('0x54')]=function(_0x1ef788,_0x27aab4,_0x4a76ed){var _0x19f277={'role':_0x823c('0x55')};_0x19f277[_0x1ef788]=this[_0x823c('0x3b')][_0x823c('0x3e')];this[_0x823c('0xf')]['agentPause'](_0x19f277,_0x27aab4,this[_0x823c('0x3b')][_0x823c('0x39')])[_0x823c('0x13')](function(_0x2d108b){_0x4a76ed(null,_['isNil'](_0x2d108b)?![]:!![]);})[_0x823c('0x16')](function(_0x3c6e48){logger['error'](_0x3c6e48);_0x4a76ed(null,![]);});};AGIVertices[_0x823c('0x15')]['agentUnpause']=function(_0x34b177,_0x4300a3){var _0x4b65b3={'role':_0x823c('0x55')};_0x4b65b3[_0x34b177]=this[_0x823c('0x3b')][_0x823c('0x3e')];this[_0x823c('0xf')]['agentUnpause'](_0x4b65b3)[_0x823c('0x13')](function(_0x1a0932){_0x4300a3(null,_[_0x823c('0x48')](_0x1a0932)?![]:!![]);})[_0x823c('0x16')](function(_0xe5b984){logger[_0x823c('0x2d')](_0xe5b984);_0x4300a3(null,![]);});};AGIVertices['prototype']['agentLogout']=function(_0x308986,_0xfac906){var _0x289076={'role':_0x823c('0x55')};_0x289076[_0x308986]=this['channel']['callerid'];this[_0x823c('0xf')][_0x823c('0x56')](_0x289076)['then'](function(_0x18c260){_0xfac906(null,_[_0x823c('0x48')](_0x18c260)?![]:!![]);})[_0x823c('0x16')](function(_0x471444){logger[_0x823c('0x2d')](_0x471444);_0xfac906(null,![]);});};AGIVertices[_0x823c('0x15')][_0x823c('0x57')]=function(_0x34cb8e,_0x316ecd){var _0x922d5d={'role':_0x823c('0x55')};_0x922d5d[_0x34cb8e]=this[_0x823c('0x3b')][_0x823c('0x3e')];var _0x530431=_0x34cb8e!='internal'?util[_0x823c('0x29')](_0x823c('0x58'),_0x823c('0x59'),this[_0x823c('0x3b')][_0x823c('0x3e')]):undefined;this['rpc'][_0x823c('0x57')](_0x922d5d,_0x530431)[_0x823c('0x13')](function(_0xd666a4){_0x316ecd(null,_[_0x823c('0x48')](_0xd666a4)?![]:!![]);})[_0x823c('0x16')](function(_0x568546){logger[_0x823c('0x2d')](_0x568546);_0x316ecd(null,![]);});};AGIVertices[_0x823c('0x15')][_0x823c('0x5a')]=function(_0x59fcba,_0x51adb4){sh['exec'](_[_0x823c('0x5b')](_0x59fcba),function(_0x287f07,_0x58fe11){var _0xc035a7=_0x58fe11[_0x823c('0x5c')](/(\r\n|\n|\r)/gm,'');_0x51adb4(null,_0xc035a7);});};AGIVertices['prototype'][_0x823c('0x5d')]=function(_0x3200cb,_0x46e107){scripts[_0x823c('0x5d')](_0x3200cb['apiKey'],_0x3200cb[_0x823c('0x5e')]||_0x823c('0x5f'),_0x3200cb['text'],_0x3200cb[_0x823c('0x60')]||_0x823c('0x61'),_0x3200cb[_0x823c('0x62')]||'MALE',_0x3200cb[_0x823c('0x63')]||_0x823c('0x64'))[_0x823c('0x13')](function(_0x49bec2){_0x46e107(null,_0x49bec2);})[_0x823c('0x16')](function(_0x353ca4){_0x46e107(_0x353ca4);});};AGIVertices[_0x823c('0x15')][_0x823c('0x65')]=function(_0x56bb40,_0x28eb99){scripts[_0x823c('0x65')](_0x56bb40[_0x823c('0x5f')],_0x56bb40[_0x823c('0x66')]||'en',0x1)['then'](function(_0x14d25b){_0x28eb99(null,_0x14d25b);})['catch'](function(_0x38aefd){_0x28eb99(_0x38aefd);});};AGIVertices['prototype'][_0x823c('0x67')]=function(_0x543afc,_0x2d91bf){var _0x1f9958={'uri':_0x543afc[_0x823c('0x68')],'method':_0x543afc[_0x823c('0x69')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x543afc[_0x823c('0x6a')])===_0x823c('0x6b')&&parseInt(_0x543afc[_0x823c('0x6a')])>=0x1?parseInt(_0x543afc[_0x823c('0x6a')])*0x3e8:0x5*0x3e8};if(_[_0x823c('0x6c')]([_0x823c('0x6d'),_0x823c('0x6e')],_0x1f9958[_0x823c('0x69')][_0x823c('0x6f')]())){try{_0x1f9958[_0x823c('0x70')]=_0x543afc[_0x823c('0xc')]?JSON['parse'](_0x543afc[_0x823c('0xc')]):{};}catch(_0x11d5c2){logger[_0x823c('0x2d')](_0x823c('0x71'),_0x11d5c2);}}try{_0x1f9958[_0x823c('0x72')]=_0x543afc['rawHeaders']?JSON[_0x823c('0x73')](_0x543afc['rawHeaders']):{};}catch(_0x3af700){logger['error'](_0x823c('0x74'),_0x3af700);}if(_0x543afc['computedVariables']){try{var _0x4643e1=require(_0x543afc[_0x823c('0x75')])['sync'](this,_0x1f9958);_0x1f9958['uri']=Mustache[_0x823c('0x76')](_0x543afc[_0x823c('0x68')],_0x4643e1,{},['$$','$$']);if(_0x1f9958[_0x823c('0x72')]){_0x1f9958['headers']=JSON['parse'](Mustache[_0x823c('0x76')](JSON['stringify'](_0x1f9958[_0x823c('0x72')]),_0x4643e1,{},['$$','$$']));}if(_0x1f9958['body']){_0x1f9958[_0x823c('0x70')]=JSON[_0x823c('0x73')](Mustache['render'](JSON[_0x823c('0x77')](_0x1f9958[_0x823c('0x70')]),_0x4643e1,{},['$$','$$']));}}catch(_0x210e97){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x210e97);}}rp(_0x1f9958)[_0x823c('0x13')](function(_0x1ec7c8){var _0x92d91e={'statusCode':_0x1ec7c8[_0x823c('0x78')]||0xc8,'statusMessage':_0x1ec7c8[_0x823c('0x79')]||'OK','headers':_0x1ec7c8[_0x823c('0x72')]||{},'body':_0x1ec7c8[_0x823c('0x70')]||{}};_0x2d91bf(null,_0x92d91e);})[_0x823c('0x16')](function(_0x20b91d){var _0x15b770={'statusCode':_0x20b91d[_0x823c('0x78')]||0x1f4,'statusMessage':_0x20b91d[_0x823c('0x7a')]||_0x823c('0x7b'),'headers':_0x20b91d['options'][_0x823c('0x72')]||{},'body':_0x20b91d['options'][_0x823c('0x70')]||{}};_0x2d91bf(null,_0x15b770);});};AGIVertices['prototype'][_0x823c('0x7c')]=function(_0x1bf6c4,_0x15cf12){scripts['googleDialogflow'](this[_0x823c('0x3b')][_0x823c('0x39')],_0x1bf6c4[_0x823c('0x7d')],_0x1bf6c4['text'],_0x1bf6c4[_0x823c('0x7e')]||'en')[_0x823c('0x13')](function(_0x58fa91){_0x15cf12(null,_0x58fa91);})[_0x823c('0x16')](function(_0x1c309d){_0x15cf12(_0x1c309d);});};AGIVertices[_0x823c('0x15')][_0x823c('0x7f')]=function(_0x4e7663,_0x349c86){scripts[_0x823c('0x7f')](this['channel']['uniqueid'],_0x4e7663['dialogflowV2_project_id'],_0x4e7663['client_email'],_0x4e7663[_0x823c('0x80')],_0x4e7663[_0x823c('0x5f')],_0x4e7663[_0x823c('0x81')]||'en')[_0x823c('0x13')](function(_0x1481f3){_0x349c86(null,_0x1481f3);})['catch'](function(_0x36c576){_0x349c86(_0x36c576);});};AGIVertices['prototype'][_0x823c('0x82')]=function(_0x159317,_0x2f6121){scripts['sestekNDA'](this[_0x823c('0x3b')],_0x159317)[_0x823c('0x13')](function(_0x41fdf4){_0x2f6121(null,_0x41fdf4);})[_0x823c('0x16')](function(_0x498a33){_0x2f6121(_0x498a33);});};AGIVertices['prototype'][_0x823c('0x83')]=function(_0x1730ec,_0x59fce7){scripts[_0x823c('0x83')](_0x1730ec[_0x823c('0x7d')],_0x1730ec[_0x823c('0x5f')],_0x1730ec[_0x823c('0x84')]||_0x823c('0x61'),_0x1730ec[_0x823c('0x85')])[_0x823c('0x13')](function(_0x1f9ccd){_0x59fce7(null,_0x1f9ccd);})[_0x823c('0x16')](function(_0x31aa8a){_0x59fce7(_0x31aa8a);});};AGIVertices[_0x823c('0x15')][_0x823c('0x86')]=function(_0xc79d37,_0x30508c,_0xbd6a9f){scripts[_0x823c('0x86')](_0x30508c,_0xc79d37[_0x823c('0x7d')],_0xc79d37[_0x823c('0x87')]||_0x823c('0x61'),this['isConfigured'](_0xc79d37[_0x823c('0x88')])?_0xc79d37[_0x823c('0x88')]:undefined)[_0x823c('0x13')](function(_0x35358e){_0xbd6a9f(null,_0x35358e);})[_0x823c('0x16')](function(_0x15552c){_0xbd6a9f(_0x15552c);});};AGIVertices[_0x823c('0x15')][_0x823c('0x89')]=function(_0x148fee,_0x1a2b7b){scripts[_0x823c('0x89')](_0x148fee[_0x823c('0x8a')],_0x148fee['aws_secret_access_key'],_0x148fee['aws_polly_region'],_0x148fee[_0x823c('0x8b')]||'Amy',_0x148fee['text'],_0x148fee['aws_text_type']||_0x823c('0x5f'))['then'](function(_0x2e41d7){_0x1a2b7b(null,_0x2e41d7);})[_0x823c('0x16')](function(_0x2b7bec){_0x1a2b7b(_0x2b7bec);});};AGIVertices[_0x823c('0x15')][_0x823c('0x8c')]=function(_0xe6ea73,_0x3cf934){scripts[_0x823c('0x8c')](this['channel'][_0x823c('0x39')],_0xe6ea73[_0x823c('0x8a')],_0xe6ea73[_0x823c('0x8d')],_0xe6ea73[_0x823c('0x8e')],_0xe6ea73[_0x823c('0x5f')],_0xe6ea73['aws_bot_name'])[_0x823c('0x13')](function(_0x5b99d3){_0x3cf934(null,_0x5b99d3);})['catch'](function(_0x26dc44){_0x3cf934(_0x26dc44);});};AGIVertices[_0x823c('0x15')][_0x823c('0x8f')]=function(_0xf791d,_0x3d2da1,_0x282939){scripts[_0x823c('0x8f')](_0x3d2da1,_0xf791d[_0x823c('0x7d')],_0xf791d[_0x823c('0x90')]||'en-US')[_0x823c('0x13')](function(_0x8acdd0){_0x282939(null,_0x8acdd0);})[_0x823c('0x16')](function(_0x5a31d8){_0x282939(_0x5a31d8);});};AGIVertices['prototype'][_0x823c('0x91')]=function(_0x5a2eb5,_0x272b01,_0x4609c0){scripts['tildeASR'](_0x272b01,_0x5a2eb5[_0x823c('0x92')],_0x5a2eb5[_0x823c('0x93')],_0x5a2eb5[_0x823c('0x94')])[_0x823c('0x13')](function(_0x20276d){_0x4609c0(null,_0x20276d);})[_0x823c('0x16')](function(_0x223308){_0x4609c0(_0x223308);});};AGIVertices[_0x823c('0x15')][_0x823c('0x95')]=function(_0x11bb92){var _0x4f780e=_[_0x823c('0x6c')](verticesWithRetry,_0x11bb92['agicommand'])?_0x11bb92:_[_0x823c('0x96')](_0x11bb92);for(var _0x31fd7b in _0x4f780e){if(_0x4f780e[_0x823c('0x97')](_0x31fd7b)){if(_0x4f780e[_0x31fd7b]&&_[_0x823c('0x98')](_0x4f780e[_0x31fd7b])){if(_[_0x823c('0x6c')](recursiveMapAttributes,_0x31fd7b)){_0x4f780e[_0x31fd7b]=this[_0x823c('0x99')](_0x4f780e[_0x31fd7b]);}else{_0x4f780e[_0x31fd7b]=this['replaceAllVariables'](_0x4f780e[_0x31fd7b]);}}}}return _0x4f780e;};AGIVertices[_0x823c('0x15')][_0x823c('0x9a')]=function(_0xd26e66){for(var _0x3bfd39 in _0xd26e66){if(_0xd26e66[_0x823c('0x97')](_0x3bfd39)){if(_[_0x823c('0x9b')](_0xd26e66[_0x3bfd39])){this[_0x823c('0x9a')](_0xd26e66[_0x3bfd39]);}else if(_['isArray'](_0xd26e66[_0x3bfd39])){for(var _0x12bfd4=0x0;_0x12bfd4<_0xd26e66[_0x3bfd39][_0x823c('0x9c')];_0x12bfd4++){this['recursiveNodeIndex'](_0xd26e66[_0x3bfd39][_0x12bfd4]);}}else if(_['isString'](_0xd26e66[_0x3bfd39])){_0xd26e66[_0x3bfd39]=this[_0x823c('0x9d')](_0xd26e66[_0x3bfd39]);}}}};AGIVertices[_0x823c('0x15')][_0x823c('0x9e')]=function(_0x2e6c34,_0x1f8588){for(var _0x10b082 in _0x2e6c34){if(_0x2e6c34['hasOwnProperty'](_0x10b082)){if(_['isPlainObject'](_0x2e6c34[_0x10b082])){if(!_['isEmpty'](_0x2e6c34[_0x10b082])){this[_0x823c('0x9e')](_0x2e6c34[_0x10b082],util[_0x823c('0x29')](_0x823c('0x9f'),_0x1f8588,_0x10b082));}}else if(_['isArray'](_0x2e6c34[_0x10b082])){for(var _0x41b3d3=0x0;_0x41b3d3<_0x2e6c34[_0x10b082]['length'];_0x41b3d3++){this['saveRestApiResult'](_0x2e6c34[_0x10b082][_0x41b3d3],util[_0x823c('0x29')](_0x823c('0x9f'),_0x1f8588,_0x10b082+'['+_0x41b3d3+']'));}}else{if(!_[_0x823c('0x48')](_0x2e6c34[_0x10b082])){this[_0x823c('0x3b')][_0x823c('0xa0')](util[_0x823c('0x29')](_0x823c('0x9f'),_0x1f8588,_0x10b082),_0x2e6c34[_0x10b082]);}}}}};AGIVertices[_0x823c('0x15')][_0x823c('0x99')]=function(_0x1339ae){try{var _0x9d768e=JSON['parse'](_0x1339ae);this[_0x823c('0x9a')](_0x9d768e);return JSON['stringify'](_0x9d768e);}catch(_0x4fe778){return this[_0x823c('0x9d')](_0x1339ae);}};AGIVertices[_0x823c('0x15')][_0x823c('0x9d')]=function(_0x1071af){var _0x5d5c87=_0x1071af[_0x823c('0xa1')]('{');for(var _0x383c0c=0x1;_0x383c0c<_0x5d5c87[_0x823c('0x9c')];_0x383c0c+=0x1){var _0x4c48c4=_0x5d5c87[_0x383c0c][_0x823c('0xa1')]('}');if(_0x4c48c4['length']>0x1){_0x1071af=_0x1071af[_0x823c('0xa2')]('{'+_0x4c48c4[0x0]+'}',this[_0x823c('0x3b')][_0x823c('0x11')](_0x4c48c4[0x0])[_0x823c('0xa3')]||_0x4c48c4[0x0]);}}if(_0x5d5c87[_0x823c('0x9c')]===0x1){return _0x1071af[_0x823c('0x50')]();}return this[_0x823c('0x9d')](_0x1071af);};AGIVertices['prototype'][_0x823c('0xa4')]=function(_0x4ec727,_0x30d162){var _0x5179a1=this[_0x823c('0x3b')][_0x823c('0x11')](_0x4ec727);if(_0x5179a1[_0x823c('0xa5')]===-0x1){return _0x5179a1;}logger['info'](util[_0x823c('0x29')](_0x823c('0xa6'),_0x30d162,_0x5179a1[_0x823c('0xa3')]));return this['channel'][_0x823c('0xa0')](_0x30d162,_0x5179a1[_0x823c('0xa3')]);};AGIVertices['prototype'][_0x823c('0xa7')]=function(_0x136079){return _0x136079&&_0x136079!=='0'&&_0x136079!=='-1'&&_0x136079!=='';};AGIVertices['prototype'][_0x823c('0xa8')]=function(_0x107da4){this[_0x823c('0x38')]['sync'](this,_0x107da4,'-');_0x107da4[_0x823c('0xa9')]=_0x107da4[_0x823c('0xa8')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x823c('0x15')][_0x823c('0xaa')]=function(_0x33532a){logger[_0x823c('0x2f')](util[_0x823c('0x29')](_0x823c('0xab'),_0x33532a[_0x823c('0x3a')]));if(!this[_0x823c('0xa7')](_0x33532a[_0x823c('0x5f')])){return this['channel'][_0x823c('0xac')](_0x823c('0xad'));}var _0x1a1049='\x22'+_0x33532a[_0x823c('0x5f')]+'\x22';if(this[_0x823c('0xa7')](_0x33532a[_0x823c('0xae')])){_0x1a1049+=','+_0x33532a['options'];}var _0x20c916=this[_0x823c('0x3b')][_0x823c('0xaf')](_0x823c('0xb0'),_0x1a1049);if(_0x20c916[_0x823c('0xa5')]===-0x1){return _0x20c916;}return this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0xb1'),_0x1a1049));};AGIVertices['prototype'][_0x823c('0xb2')]=function(_0xa2b13a){logger['info'](util[_0x823c('0x29')](_0x823c('0xb3'),_0xa2b13a[_0x823c('0x3a')]));if(!this[_0x823c('0xa7')](_0xa2b13a['grammar'])){return this[_0x823c('0x3b')][_0x823c('0xac')](_0x823c('0xb4'));}var _0x1dd6bc=_0xa2b13a[_0x823c('0xb5')];if(this[_0x823c('0xa7')](_0xa2b13a[_0x823c('0xae')])){_0x1dd6bc+=','+_0xa2b13a[_0x823c('0xae')];}var _0x12acc8=this[_0x823c('0x3b')][_0x823c('0xaf')](_0x823c('0xb6'),_0x1dd6bc);if(_0x12acc8[_0x823c('0xa5')]===-0x1){return _0x12acc8;}var _0x41071c=this[_0x823c('0xa4')](_0x823c('0xb7'),_0x823c('0xb8'));if(_0x41071c['result']===-0x1){return _0x41071c;}var _0x4db69b=this[_0x823c('0xa4')](_0x823c('0xb9'),_0x823c('0xba'));if(_0x4db69b[_0x823c('0xa5')]===-0x1){return _0x4db69b;}var _0x229b2a=this[_0x823c('0xa4')]('RECOG_INSTANCE()',_0x823c('0xbb'));if(_0x229b2a[_0x823c('0xa5')]===-0x1){return _0x229b2a;}return this[_0x823c('0x3b')][_0x823c('0xac')](util['format'](_0x823c('0xbc'),_0x1dd6bc));};AGIVertices['prototype'][_0x823c('0x7')]=function(_0x560d09){logger[_0x823c('0x2f')](util[_0x823c('0x29')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x560d09['label']));return this[_0x823c('0x3b')][_0x823c('0x7')]([_0x560d09['command'],_0x560d09[_0x823c('0xbd')]]);};AGIVertices[_0x823c('0x15')][_0x823c('0xbe')]=function(_0x343450){logger['info'](util[_0x823c('0x29')](_0x823c('0xbf'),_0x343450[_0x823c('0x3a')]));if(this[_0x823c('0xa7')](_0x343450['timeout'])){logger[_0x823c('0x2f')](util[_0x823c('0x29')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x343450['timeout']));var _0x2ffcd4=this[_0x823c('0x3b')][_0x823c('0xc0')](_0x343450['timeout']);if(_0x2ffcd4[_0x823c('0xa5')]===-0x1){return _0x2ffcd4;}}return this[_0x823c('0x3b')][_0x823c('0xbe')]();};AGIVertices['prototype']['callback']=function(_0x30de54){logger[_0x823c('0x2f')](util['format'](_0x823c('0xc1'),_0x30de54[_0x823c('0x3a')]));if(!this['isConfigured'](_0x30de54[_0x823c('0x4d')])){return this[_0x823c('0x3b')][_0x823c('0x2d')](_0x30de54,_0x823c('0xc2'));}_0x30de54[_0x823c('0x4f')]=moment();if(this[_0x823c('0xa7')](_0x30de54['delay'])){_0x30de54[_0x823c('0x4f')]=moment()[_0x823c('0xc3')](_0x30de54[_0x823c('0xc4')],_0x823c('0xc5'));}if(!this[_0x823c('0xa7')](_0x30de54[_0x823c('0x51')])){_0x30de54['callback_priority']=0x2;}this[_0x823c('0x46')][_0x823c('0xc6')](this,_0x30de54);return this[_0x823c('0x3b')]['noop'](util[_0x823c('0x29')](_0x823c('0xc7'),_0x30de54['phone'],_0x30de54[_0x823c('0x4d')],_0x30de54[_0x823c('0x4f')]));};AGIVertices[_0x823c('0x15')][_0x823c('0xc8')]=function(_0x5a0e55){logger[_0x823c('0x2f')](util['format'](_0x823c('0xc9'),_0x5a0e55[_0x823c('0x3a')]));var _0x3cc219=this[_0x823c('0x3b')][_0x823c('0xaf')](_0x5a0e55['application'],_0x5a0e55[_0x823c('0xae')]);if(_0x3cc219['result']===-0x1){return _0x3cc219;}return this['channel'][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0xca'),_0x5a0e55[_0x823c('0xcb')],_0x5a0e55['options']));};AGIVertices[_0x823c('0x15')][_0x823c('0xcc')]=function(_0x340484){logger[_0x823c('0x2f')](util[_0x823c('0x29')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x340484['label']));if(!this[_0x823c('0xa7')](_0x340484[_0x823c('0x5f')])){return this['channel']['noop'](_0x823c('0xad'));}var _0x38f18b='\x22'+_0x340484[_0x823c('0x5f')]+'\x22';if(this[_0x823c('0xa7')](_0x340484['options'])){_0x38f18b+=','+_0x340484[_0x823c('0xae')];}var _0x649a13=this[_0x823c('0x3b')][_0x823c('0xaf')]('MRCPSynth',_0x38f18b);if(_0x649a13[_0x823c('0xa5')]===-0x1){return _0x649a13;}return this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0xb1'),_0x38f18b));};AGIVertices['prototype'][_0x823c('0xcd')]=function(_0x6a983){logger['info'](util[_0x823c('0x29')](_0x823c('0xce'),_0x6a983[_0x823c('0x3a')]));if(!this[_0x823c('0xa7')](_0x6a983[_0x823c('0x5f')])){return this[_0x823c('0x3b')]['noop'](_0x823c('0xad'));}var _0x256d77='\x22'+_0x6a983['text']+'\x22';if(this[_0x823c('0xa7')](_0x6a983[_0x823c('0xae')])){_0x256d77+=','+_0x6a983[_0x823c('0xae')];}var _0x1de8f5=this[_0x823c('0x3b')][_0x823c('0xaf')](_0x823c('0xb0'),_0x256d77);if(_0x1de8f5['result']===-0x1){return _0x1de8f5;}return this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0xb1'),_0x256d77));};AGIVertices[_0x823c('0x15')][_0x823c('0xcf')]=function(_0x9920b5){logger['info'](util['format'](_0x823c('0xd0'),_0x9920b5['label']));if(!this[_0x823c('0xa7')](_0x9920b5[_0x823c('0xb5')])){return this['channel'][_0x823c('0xac')]('no\x20grammar\x20configured');}var _0x35fa1b=_0x9920b5[_0x823c('0xb5')];if(this['isConfigured'](_0x9920b5['options'])){_0x35fa1b+=','+_0x9920b5[_0x823c('0xae')];}var _0x3fd209=this['channel'][_0x823c('0xaf')]('MRCPRecog',_0x35fa1b);if(_0x3fd209[_0x823c('0xa5')]===-0x1){return _0x3fd209;}var _0x443ec4=this[_0x823c('0xa4')](_0x823c('0xb7'),_0x823c('0xd1'));if(_0x443ec4[_0x823c('0xa5')]===-0x1){return _0x443ec4;}var _0xb32784=this[_0x823c('0xa4')]('RECOG_INPUT()',_0x823c('0xd2'));if(_0xb32784['result']===-0x1){return _0xb32784;}var _0x8c2084=this[_0x823c('0xa4')](_0x823c('0xd3'),_0x823c('0xd4'));if(_0x8c2084[_0x823c('0xa5')]===-0x1){return _0x8c2084;}return this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0xbc'),_0x35fa1b));};AGIVertices[_0x823c('0x15')][_0x823c('0xd5')]=function(_0x114b7c){logger['info'](util[_0x823c('0x29')](_0x823c('0xd6'),_0x114b7c[_0x823c('0x3a')]));if(!this['isConfigured'](_0x114b7c['grammar'])){return this[_0x823c('0x3b')][_0x823c('0xac')]('no\x20grammar\x20configured');}var _0x15e712=_0x114b7c[_0x823c('0xb5')];if(this[_0x823c('0xa7')](_0x114b7c[_0x823c('0xae')])){_0x15e712+=','+_0x114b7c[_0x823c('0xae')];}var _0x117dc6=this[_0x823c('0x3b')][_0x823c('0xaf')](_0x823c('0xb6'),_0x15e712);if(_0x117dc6[_0x823c('0xa5')]===-0x1){return _0x117dc6;}var _0x5809c8=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x823c('0xd7'));if(_0x5809c8[_0x823c('0xa5')]===-0x1){return _0x5809c8;}var _0x3ad996=this[_0x823c('0xa4')](_0x823c('0xb9'),_0x823c('0xd8'));if(_0x3ad996[_0x823c('0xa5')]===-0x1){return _0x3ad996;}var _0x2351fd=this[_0x823c('0xa4')](_0x823c('0xd3'),_0x823c('0xd9'));if(_0x2351fd[_0x823c('0xa5')]===-0x1){return _0x2351fd;}return this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x15e712));};AGIVertices['prototype'][_0x823c('0xda')]=function(_0x121441){logger['info'](util[_0x823c('0x29')](_0x823c('0xdb'),_0x121441[_0x823c('0x3a')]));if(!this['isConfigured'](_0x121441['odbc_id'])){return this['channel'][_0x823c('0x2d')](_0x121441,_0x823c('0xdc'));}var _0xff3665=this[_0x823c('0x19')]['sync'](this,_0x121441['odbc_id']);if(!_0xff3665){return this[_0x823c('0x3b')][_0x823c('0x2d')](_0x121441,_0x823c('0xdd'));}if(!this['isConfigured'](_0x121441[_0x823c('0x31')])){return this[_0x823c('0x3b')][_0x823c('0x2d')](_0x121441,_0x823c('0xde'));}var _0x36bb48=_0x121441[_0x823c('0x31')][_0x823c('0x5c')](/(\r\n|\n|\r)/gm,'\x20');this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')]('query:\x20%s',_0x36bb48));var _0x27963d=this[_0x823c('0x2b')][_0x823c('0xc6')](this,_0xff3665,_0x36bb48);this[_0x823c('0x38')][_0x823c('0xc6')](this,_0x121441,_0x36bb48);if(!this[_0x823c('0xa7')](_0x121441[_0x823c('0xdf')])){return this[_0x823c('0x3b')]['noop'](_0x823c('0xe0'));}var _0xe652df=this[_0x823c('0x11')]['sync'](this,_0x121441[_0x823c('0xdf')]);if(!_0xe652df){return this['channel'][_0x823c('0x2d')](_0x121441,'no\x20variable\x20found');}var _0x130a06=this;_0x27963d[_0x823c('0xe1')](function(_0x4b6a46,_0x263902){Object['keys'](_0x4b6a46)[_0x823c('0xe1')](function(_0x45f563){_0x130a06[_0x823c('0x3b')][_0x823c('0xa0')](util['format'](_0x823c('0xe2'),_0xe652df,_0x263902,_0x45f563),_0x4b6a46[_0x45f563]);});});this[_0x823c('0x3b')][_0x823c('0xa0')](util[_0x823c('0x29')]('%s_ROWS_COUNT',_0xe652df),_0x27963d['length']);return this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0xe3'),_0xe652df));};AGIVertices[_0x823c('0x15')][_0x823c('0xe4')]=function(_0x17020b){logger['debug'](util[_0x823c('0x29')](_0x823c('0xe5'),_0x17020b['label']));if(!this[_0x823c('0xa7')](_0x17020b[_0x823c('0xe6')])){return this[_0x823c('0x3b')][_0x823c('0x2d')](_0x17020b,'no\x20user\x20selected');}var _0x409ae2=this[_0x823c('0x1b')]['sync'](this,_0x17020b[_0x823c('0xe6')]);if(!_0x409ae2){return this[_0x823c('0x3b')][_0x823c('0x2d')](_0x17020b,_0x823c('0xe7'));}var _0x124942=this[_0x823c('0x3b')][_0x823c('0xaf')](_0x823c('0xe8'),[util[_0x823c('0x29')](_0x823c('0xe9'),_0x409ae2),_0x17020b[_0x823c('0x6a')],_0x17020b['opts'],_0x17020b[_0x823c('0x68')]]);if(_0x124942['result']===-0x1){return _0x124942;}return this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')]('Executed\x20command\x20%s',_0x823c('0xe8')));};AGIVertices[_0x823c('0x15')][_0x823c('0xea')]=function(_0x5a38a4){logger[_0x823c('0x2f')](util[_0x823c('0x29')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x5a38a4[_0x823c('0x3a')]));if(!this[_0x823c('0xa7')](_0x5a38a4[_0x823c('0x7d')])){return this[_0x823c('0x3b')][_0x823c('0xac')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x5a38a4[_0x823c('0x5f')])){return this[_0x823c('0x3b')][_0x823c('0xac')]('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0x823c('0x38')](_0x5a38a4);this[_0x823c('0x45')](_0x5a38a4[_0x823c('0x5f')],'in','','');this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0xeb'),_0x5a38a4[_0x823c('0x5f')]));var _0x221466=this[_0x823c('0x7c')]['sync'](this,_0x5a38a4);if(_0x221466){for(var _0x5322d2 in _0x221466){if(_0x221466[_0x823c('0x97')](_0x5322d2)){this[_0x823c('0x3b')][_0x823c('0xa0')](util['format']('DIALOGFLOW_%s',_0x5322d2[_0x823c('0x6f')]()),_0x221466[_0x5322d2]);}}this['createSquareMessage'](_0x221466[_0x823c('0xec')],_0x823c('0xed'),_0x823c('0xea'),'');return this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0xee'),_0x221466['speech']));}return this[_0x823c('0x3b')][_0x823c('0x2d')](_0x5a38a4,_0x823c('0xef'));};AGIVertices['prototype'][_0x823c('0xf0')]=function(_0x3e0e30){logger[_0x823c('0x2f')](util[_0x823c('0x29')](_0x823c('0xf1'),_0x3e0e30[_0x823c('0x3a')]));if(!this[_0x823c('0xa7')](_0x3e0e30[_0x823c('0xf2')])){return this[_0x823c('0x3b')][_0x823c('0xac')]('no\x20project_id\x20configured');}if(!this[_0x823c('0xa7')](_0x3e0e30['client_email'])){return this[_0x823c('0x3b')]['noop']('no\x20client_email\x20configured');}if(!this[_0x823c('0xa7')](_0x3e0e30[_0x823c('0x80')])){return this[_0x823c('0x3b')][_0x823c('0xac')](_0x823c('0xf3'));}if(!this[_0x823c('0xa7')](_0x3e0e30['dialogflowV2_language'])){return this['channel'][_0x823c('0xac')]('no\x20anguage\x20configured');}if(!this[_0x823c('0xa7')](_0x3e0e30[_0x823c('0x5f')])){return this[_0x823c('0x3b')][_0x823c('0xac')](_0x823c('0xad'));}this[_0x823c('0x3b')][_0x823c('0xf4')]=!![];this[_0x823c('0x38')](_0x3e0e30);this['createSquareMessage'](_0x3e0e30['text'],'in','','');this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0xf5'),_0x3e0e30[_0x823c('0x5f')]));var _0x78a104=this['googleDialogflowV2'][_0x823c('0xc6')](this,_0x3e0e30);if(_0x78a104){for(var _0x16c5c7 in _0x78a104){if(_0x78a104[_0x823c('0x97')](_0x16c5c7)){if(_0x16c5c7!=='providerResponse'){this[_0x823c('0x3b')][_0x823c('0xa0')](util[_0x823c('0x29')](_0x823c('0xf6'),_0x16c5c7['toUpperCase']()),_0x78a104[_0x16c5c7]);}}}this['createSquareMessage'](_0x78a104[_0x823c('0xec')],_0x823c('0xed'),_0x823c('0xf0'),_0x78a104[_0x823c('0xf7')]);return this['channel'][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0xf8'),_0x78a104[_0x823c('0xec')]));}return this['channel']['error'](_0x3e0e30,_0x823c('0xf9'));};AGIVertices['prototype'][_0x823c('0xfa')]=function(_0x79693){logger[_0x823c('0x2f')](util['format'](_0x823c('0xfb'),_0x79693[_0x823c('0x3a')]));if(!this[_0x823c('0xa7')](_0x79693[_0x823c('0xfc')])){return this[_0x823c('0x3b')][_0x823c('0xac')](_0x823c('0xfd'));}if(!this[_0x823c('0xa7')](_0x79693[_0x823c('0xfe')])){return this['channel']['noop']('no\x20username\x20configured');}if(!this[_0x823c('0xa7')](_0x79693[_0x823c('0xff')])){return this['channel'][_0x823c('0xac')](_0x823c('0x100'));}if(!this[_0x823c('0xa7')](_0x79693[_0x823c('0x101')])){return this[_0x823c('0x3b')]['noop'](_0x823c('0xad'));}this[_0x823c('0x3b')]['bot']=!![];this[_0x823c('0x38')](_0x79693);this[_0x823c('0x45')](_0x79693[_0x823c('0x5f')],'in','','');this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0x102'),_0x79693[_0x823c('0x5f')]));var _0x22800c=this[_0x823c('0x82')][_0x823c('0xc6')](this,_0x79693);if(_0x22800c){for(var _0x202c19 in _0x22800c){if(_0x22800c[_0x823c('0x97')](_0x202c19)){this[_0x823c('0x3b')]['setVariable'](util[_0x823c('0x29')](_0x823c('0x103'),_0x202c19[_0x823c('0x6f')]()),_0x22800c[_0x202c19]);}}this['createSquareMessage'](_0x22800c[_0x823c('0xec')],_0x823c('0xed'),_0x823c('0xfa'),'');if(_0x22800c['audiofile']){this['channel']['noop'](util[_0x823c('0x29')](_0x823c('0x104'),_0x22800c['audiofile']));var _0x320cbe=this[_0x823c('0x3b')][_0x823c('0x105')](_0x22800c['audiofile']);try{fs['unlink'](_0x22800c[_0x823c('0x106')]+_0x823c('0x107'));}catch(_0x15129f){logger[_0x823c('0x2d')](_0x15129f);}return _0x320cbe;}else{return this[_0x823c('0x3b')]['noop'](util['format'](_0x823c('0x108'),_0x22800c[_0x823c('0xec')]));}}return this[_0x823c('0x3b')][_0x823c('0x2d')](_0x79693,_0x823c('0x109'));};AGIVertices[_0x823c('0x15')][_0x823c('0x10a')]=function(_0x3464de){logger['info'](util[_0x823c('0x29')]('Enter\x20in\x20END\x20(%s)\x20block',_0x3464de['label']));return this[_0x823c('0x3b')][_0x823c('0xac')](_0x823c('0x10a'));};AGIVertices[_0x823c('0x15')][_0x823c('0x10b')]=function(_0xc07cbb){logger[_0x823c('0x2f')](util[_0x823c('0x29')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0xc07cbb['label']));var _0x5147d9='';if(_0xc07cbb['trunk_id']){if(!this['isConfigured'](_0xc07cbb[_0x823c('0x10c')])){return this[_0x823c('0x3b')]['error'](_0xc07cbb,_0x823c('0x10d'));}else{var _0x2a815b=parseInt(_0xc07cbb[_0x823c('0x10c')],0xa);if(isNaN(_0x2a815b)){_0x5147d9=_0xc07cbb['trunk_id'];}else{_0x5147d9=this['getTrunk'][_0x823c('0xc6')](this,_0xc07cbb[_0x823c('0x10c')]);if(!_0x5147d9){return this[_0x823c('0x3b')][_0x823c('0x2d')](_0xc07cbb,'no\x20trunk\x20found');}}}}else if(_0xc07cbb[_0x823c('0x10e')]){_0x5147d9=_0xc07cbb[_0x823c('0x10e')];}else{return this[_0x823c('0x3b')][_0x823c('0x2d')](_0xc07cbb,_0x823c('0x10d'));}var _0x5a2dfb=this['channel'][_0x823c('0xaf')](_0x823c('0xe8'),[util[_0x823c('0x29')](_0x823c('0x10f'),_0x5147d9,_0xc07cbb[_0x823c('0x4c')]),_0xc07cbb[_0x823c('0x6a')],_0xc07cbb[_0x823c('0x110')],_0xc07cbb['url']]);if(_0x5a2dfb['result']===-0x1){return _0x5a2dfb;}return this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0x111'),_0x823c('0xe8')));};AGIVertices['prototype'][_0x823c('0x112')]=function(_0x334584){logger[_0x823c('0x2f')](util[_0x823c('0x29')](_0x823c('0x113'),_0x334584[_0x823c('0x3a')]));return this[_0x823c('0x3b')]['noop'](_0x823c('0x112'));};AGIVertices['prototype'][_0x823c('0xd')]=function(_0xd3116d){logger['info'](util[_0x823c('0x29')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0xd3116d[_0x823c('0x3a')]));if(_0xd3116d['retry']===0x0){return this['maxRetry'](_0xd3116d);}_0xd3116d[_0x823c('0xa9')]-=0x1;if(!this[_0x823c('0xa7')](_0xd3116d['file_id'])){return this[_0x823c('0x3b')][_0x823c('0x2d')](_0xd3116d,_0x823c('0x114'));}var _0x7be208=this[_0x823c('0x1f')][_0x823c('0xc6')](this,_0xd3116d['file_id']);if(!_0x7be208){return this['channel'][_0x823c('0x2d')](_0xd3116d,_0x823c('0x115'));}if(!this[_0x823c('0xa7')](_0xd3116d['variable_id'])){return this[_0x823c('0x3b')][_0x823c('0x2d')](_0x823c('0xe0'));}var _0x3c7d0a=this[_0x823c('0x3b')]['getData'](_0x7be208,_0xd3116d[_0x823c('0x116')],_0xd3116d[_0x823c('0x117')]);var _0x34378b=_0x3c7d0a['result']?_0x3c7d0a[_0x823c('0xa5')][_0x823c('0x50')]():'';logger['info']('test',JSON[_0x823c('0x77')](_0x3c7d0a));if(_0x3c7d0a[_0x823c('0xa5')]===-0x1){this[_0x823c('0x38')][_0x823c('0xc6')](this,_0xd3116d,_0x34378b);return _0x3c7d0a;}else if(_0x3c7d0a[_0x823c('0xa3')]==='timeout'){_0x3c7d0a[_0x823c('0xa5')]=_0x34378b[_0x823c('0x9c')]>=parseInt(_0xd3116d[_0x823c('0x118')])?'x':'i';}else{_0x3c7d0a[_0x823c('0xa5')]=_0x34378b[_0x823c('0x9c')]>=parseInt(_0xd3116d[_0x823c('0x118')])&&_0x34378b['length']<=parseInt(_0xd3116d['maxdigit'])?'x':'i';}var _0x383cba=this['getVariable'][_0x823c('0xc6')](this,_0xd3116d[_0x823c('0xdf')]);if(!_0x383cba){return this[_0x823c('0x3b')][_0x823c('0x2d')](_0xd3116d,_0x823c('0x119'));}this[_0x823c('0x3b')][_0x823c('0xa0')](_0x383cba,_0x34378b);if(this['isConfigured'](_0xd3116d[_0x823c('0x11a')])){var _0x8ce059=parseInt(_0xd3116d['hiddendigitsnum'],0xa);var _0x245eb9=rs[_0x823c('0x11b')]({'charset':'*','length':_0x8ce059});var _0x266806=_0x34378b[_0x823c('0x9c')];if(_0x266806>0x0){if(_0x266806>_0x8ce059){this[_0x823c('0x38')]['sync'](this,_0xd3116d,_0xd3116d[_0x823c('0x11c')]==='first'?_0x245eb9+_0x34378b[_0x823c('0x11d')](_0x8ce059):_0x34378b['substr'](0x0,_0x266806-_0x8ce059)+_0x245eb9);}else{this[_0x823c('0x38')]['sync'](this,_0xd3116d,rs[_0x823c('0x11b')]({'charset':'*','length':_0x266806}));}}else{this[_0x823c('0x38')]['sync'](this,_0xd3116d,'');}}else{this['createSquareDetailsReport']['sync'](this,_0xd3116d,_0x34378b);}return _0x3c7d0a;};AGIVertices[_0x823c('0x15')][_0x823c('0xe')]=function(_0x3c520a){logger['info'](util[_0x823c('0x29')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x3c520a[_0x823c('0x3a')]));return this['getdigits'](_0x3c520a);};AGIVertices['prototype'][_0x823c('0x11e')]=function(_0x7f4327){logger[_0x823c('0x2f')](util['format'](_0x823c('0x11f'),_0x7f4327[_0x823c('0x3a')]));this['createSquareDetailsReport'][_0x823c('0xc6')](this,_0x7f4327,_0x7f4327[_0x823c('0x120')]);return this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')]('GOAL\x20%s',_0x7f4327[_0x823c('0x120')]));};AGIVertices['prototype'][_0x823c('0x121')]=function(_0x14924f){logger['info'](util[_0x823c('0x29')](_0x823c('0x122'),_0x14924f['label']));if(!this[_0x823c('0xa7')](_0x14924f[_0x823c('0x8a')])||!this[_0x823c('0xa7')](_0x14924f['aws_secret_access_key'])){return this[_0x823c('0x3b')][_0x823c('0xac')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x823c('0xa7')](_0x14924f[_0x823c('0x5f')])){return this['channel'][_0x823c('0xac')](_0x823c('0xad'));}this[_0x823c('0x3b')]['noop'](util[_0x823c('0x29')](_0x823c('0x123'),_0x14924f[_0x823c('0x5f')]));var _0x343606=this[_0x823c('0x89')][_0x823c('0xc6')](this,_0x14924f);if(_0x343606){this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0x124'),_0x343606));var _0x4d0939=this['channel']['streamFile'](_0x343606);try{fs['unlink'](_0x343606+'.wav');}catch(_0x367870){logger[_0x823c('0x2d')](_0x367870);}return _0x4d0939;}return this[_0x823c('0x3b')][_0x823c('0x2d')](_0x14924f,_0x823c('0x125'));};AGIVertices[_0x823c('0x15')][_0x823c('0x126')]=function(_0x32898c){logger[_0x823c('0x2f')](util['format'](_0x823c('0x127'),_0x32898c[_0x823c('0x3a')]));if(!this[_0x823c('0xa7')](_0x32898c[_0x823c('0x8a')])||!this['isConfigured'](_0x32898c['aws_secret_access_key'])){return this[_0x823c('0x3b')]['noop'](_0x823c('0x128'));}if(!this[_0x823c('0xa7')](_0x32898c['aws_bot_name'])){return this[_0x823c('0x3b')][_0x823c('0xac')](_0x823c('0x129'));}if(!this[_0x823c('0xa7')](_0x32898c[_0x823c('0x5f')])){return this[_0x823c('0x3b')][_0x823c('0xac')](_0x823c('0xad'));}this[_0x823c('0x3b')][_0x823c('0xf4')]=!![];this[_0x823c('0x38')](_0x32898c);this[_0x823c('0x45')](_0x32898c['text'],'in','','');this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0x12a'),_0x32898c['text']));var _0x53dc02=this['awsLex'][_0x823c('0xc6')](this,_0x32898c);if(_0x53dc02){for(var _0x88ba4 in _0x53dc02){if(_0x53dc02[_0x823c('0x97')](_0x88ba4)&&_[_0x823c('0x98')](_0x53dc02[_0x88ba4])){this[_0x823c('0x3b')][_0x823c('0xa0')](util[_0x823c('0x29')]('AWS_LEX_%s',_0x88ba4[_0x823c('0x6f')]()),_0x53dc02[_0x88ba4]);}}if(_['isNil'](_0x53dc02[_0x823c('0x7a')])){return this[_0x823c('0x3b')][_0x823c('0xac')](_0x823c('0x12b'));}else{this[_0x823c('0x45')](_0x53dc02[_0x823c('0x7a')],_0x823c('0xed'),'amazonlex','');return this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0x12c'),_0x53dc02[_0x823c('0x7a')]));}}return this[_0x823c('0x3b')]['error'](_0x32898c,_0x823c('0x12d'));};AGIVertices[_0x823c('0x15')][_0x823c('0x12e')]=function(_0x161a27){logger[_0x823c('0x2f')](util[_0x823c('0x29')](_0x823c('0x12f'),_0x161a27[_0x823c('0x3a')],_0x161a27[_0x823c('0x6a')]));if(!this['isConfigured'](_0x161a27['key'])){return this[_0x823c('0x3b')][_0x823c('0xac')](_0x823c('0x130'));}var _0x25c8a3=_0x823c('0x131');var _0x364553=util[_0x823c('0x29')]('%s/recordings/%s',FILES_PATH,rs[_0x823c('0x11b')](0x4));var _0x65f2d4=util['format'](_0x823c('0x9f'),_0x364553,_0x25c8a3);var _0x33a08a=!![];if(_0x161a27[_0x823c('0x132')]===_0x823c('0x133')){_0x33a08a=![];}var _0x1d29e7=this[_0x823c('0x3b')][_0x823c('0x134')](_0x364553,_0x25c8a3,_0x161a27[_0x823c('0x135')],_0x161a27[_0x823c('0x6a')],undefined,_0x33a08a);if(_0x1d29e7[_0x823c('0xa5')]!==-0x1){this['channel'][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0x136'),_0x65f2d4));var _0x14a511=this[_0x823c('0x8f')][_0x823c('0xc6')](this,_0x161a27,_0x65f2d4);if(_0x14a511){for(var _0x32c217 in _0x14a511){if(_0x14a511[_0x823c('0x97')](_0x32c217)){this[_0x823c('0x3b')][_0x823c('0xa0')](util['format'](_0x823c('0x137'),_0x32c217[_0x823c('0x6f')]()),_0x14a511[_0x32c217]);}}return this[_0x823c('0x3b')][_0x823c('0xac')](util['format']('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x14a511)));}}return _0x1d29e7;};AGIVertices[_0x823c('0x15')][_0x823c('0x138')]=function(_0x1c532c){logger['info'](util['format'](_0x823c('0x139'),_0x1c532c[_0x823c('0x3a')]));if(!this[_0x823c('0xa7')](_0x1c532c[_0x823c('0x92')])){return this[_0x823c('0x3b')][_0x823c('0xac')](_0x823c('0x13a'));}if(!this[_0x823c('0xa7')](_0x1c532c[_0x823c('0x93')])){return this[_0x823c('0x3b')][_0x823c('0xac')]('no\x20appsecret\x20configured');}var _0x4eaa60=_0x823c('0x131');var _0x13eb6e=util[_0x823c('0x29')](_0x823c('0x13b'),FILES_PATH,rs[_0x823c('0x11b')](0x4));var _0x38db87=util[_0x823c('0x29')](_0x823c('0x9f'),_0x13eb6e,_0x4eaa60);var _0x16f3d0=!![];if(_0x1c532c[_0x823c('0x132')]===_0x823c('0x133')){_0x16f3d0=![];}var _0x53e177=this['channel'][_0x823c('0x134')](_0x13eb6e,_0x4eaa60,_0x1c532c[_0x823c('0x135')],_0x1c532c[_0x823c('0x6a')],undefined,_0x16f3d0);if(_0x53e177[_0x823c('0xa5')]!==-0x1){this[_0x823c('0x3b')]['noop'](util[_0x823c('0x29')]('tilde\x20%s\x20file\x20created',_0x38db87));var _0x19ad59=this[_0x823c('0x91')][_0x823c('0xc6')](this,_0x1c532c,_0x38db87);if(_0x19ad59){for(var _0x41ffcf in _0x19ad59){if(_0x19ad59[_0x823c('0x97')](_0x41ffcf)){this['channel'][_0x823c('0xa0')](util[_0x823c('0x29')](_0x823c('0x13c'),_0x41ffcf[_0x823c('0x6f')]()),_0x19ad59[_0x41ffcf]);}}return this[_0x823c('0x3b')]['noop'](util['format'](_0x823c('0x13d'),JSON['stringify'](_0x19ad59)));}}return _0x53e177;};AGIVertices[_0x823c('0x15')]['gotoc']=function(_0x52aa9a){logger[_0x823c('0x2f')](util['format'](_0x823c('0x13e'),_0x52aa9a['label']));return this['channel'][_0x823c('0x13f')](_0x52aa9a[_0x823c('0x140')],_0x52aa9a[_0x823c('0x40')],_0x52aa9a['priority']);};AGIVertices[_0x823c('0x15')]['gotoif']=function(_0x39170b){logger['info'](util[_0x823c('0x29')](_0x823c('0x141'),_0x39170b[_0x823c('0x3a')]));if(!this[_0x823c('0xa7')](_0x39170b[_0x823c('0x142')])){return this[_0x823c('0x3b')]['error'](_0x39170b,_0x823c('0x143'));}try{var _0x31d8dd=eval(_0x39170b[_0x823c('0x142')])?_0x823c('0x144'):_0x823c('0x145');this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')]('EVAL\x20CONDITION\x20%s\x20%s',_0x39170b[_0x823c('0x142')],_0x31d8dd));return{'code':0xc8,'result':_0x31d8dd};}catch(_0x5899ef){return{'code':0xc8,'result':_0x823c('0x145')};}};AGIVertices[_0x823c('0x15')][_0x823c('0x146')]=function(_0x1b3917){logger[_0x823c('0x2f')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x1b3917[_0x823c('0x3a')]));if(!this['isConfigured'](_0x1b3917[_0x823c('0x147')])){return this[_0x823c('0x3b')][_0x823c('0x2d')](_0x1b3917,_0x823c('0x148'));}var _0x4ac5b9=this[_0x823c('0x24')][_0x823c('0xc6')](this,_0x1b3917[_0x823c('0x147')]);if(!_0x4ac5b9){return this[_0x823c('0x3b')]['error'](_0x1b3917,_0x823c('0x149'));}for(var _0x5a1105=0x0;_0x5a1105<_0x4ac5b9[_0x823c('0x9c')];_0x5a1105+=0x1){var _0x69f7d7=this['channel'][_0x823c('0x11')](util['format'](_0x823c('0x14a'),_0x4ac5b9[_0x5a1105]));if(_0x69f7d7[_0x823c('0xa5')]===-0x1){return _0x69f7d7;}logger[_0x823c('0x2f')](util['format'](_0x823c('0x14b'),_0x4ac5b9[_0x5a1105],_0x69f7d7[_0x823c('0xa3')]));if(_0x69f7d7[_0x823c('0xa3')]==='true'){logger[_0x823c('0x2f')](util[_0x823c('0x29')]('IFTIME\x20%s\x20%s',_0x4ac5b9[_0x5a1105],_0x823c('0x144')));this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0x14b'),_0x4ac5b9[_0x5a1105],_0x823c('0x144')));return{'code':0xc8,'result':'true'};}else{logger[_0x823c('0x2f')](util[_0x823c('0x29')](_0x823c('0x14b'),_0x4ac5b9[_0x5a1105],_0x823c('0x145')));this['channel']['noop'](util['format']('IFTIME\x20%s\x20%s',_0x4ac5b9[_0x5a1105],'false'));}}return{'code':0xc8,'result':_0x823c('0x145')};};AGIVertices[_0x823c('0x15')][_0x823c('0x14c')]=function(_0x5c2bf1){logger[_0x823c('0x2f')](util['format'](_0x823c('0x14d'),_0x5c2bf1[_0x823c('0x3a')]));return this[_0x823c('0x3b')]['hangup']();};AGIVertices[_0x823c('0x15')]['ispeechasr']=function(_0x47dd37){logger[_0x823c('0x2f')](util[_0x823c('0x29')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x47dd37[_0x823c('0x3a')]));if(!this[_0x823c('0xa7')](_0x47dd37[_0x823c('0x7d')])){return this[_0x823c('0x3b')]['noop']('no\x20key\x20configured');}var _0x52dc57='wav';var _0x387a21=util[_0x823c('0x29')](_0x823c('0x13b'),FILES_PATH,rs['generate'](0x4));var _0x4c82ce=util[_0x823c('0x29')](_0x823c('0x9f'),_0x387a21,_0x52dc57);var _0x36e728=!![];if(_0x47dd37[_0x823c('0x132')]==='NOBEEP'){_0x36e728=![];}var _0x434fba=this['channel']['recordFile'](_0x387a21,_0x52dc57,_0x47dd37[_0x823c('0x135')],_0x47dd37[_0x823c('0x6a')],undefined,_0x36e728);if(_0x434fba['result']!==-0x1){this['channel']['noop'](util[_0x823c('0x29')]('ispeech\x20%s\x20file\x20created',_0x4c82ce));var _0x5471b5=this['ispeechASR'][_0x823c('0xc6')](this,_0x47dd37,_0x4c82ce);if(_0x5471b5){for(var _0x105aa6 in _0x5471b5){if(_0x5471b5[_0x823c('0x97')](_0x105aa6)){this[_0x823c('0x3b')][_0x823c('0xa0')](util[_0x823c('0x29')](_0x823c('0x14e'),_0x105aa6[_0x823c('0x6f')]()),_0x5471b5[_0x105aa6]);}}return this['channel'][_0x823c('0xac')](util['format']('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x5471b5)));}}return _0x434fba;};AGIVertices['prototype']['ispeechtts']=function(_0x62c4ce){logger[_0x823c('0x2f')](util['format'](_0x823c('0x14f'),_0x62c4ce['label']));if(!this['isConfigured'](_0x62c4ce[_0x823c('0x7d')])){return this[_0x823c('0x3b')]['noop'](_0x823c('0x130'));}if(!this[_0x823c('0xa7')](_0x62c4ce[_0x823c('0x5f')])){return this[_0x823c('0x3b')][_0x823c('0xac')](_0x823c('0xad'));}this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0x150'),_0x62c4ce[_0x823c('0x5f')]));var _0x30b6b0=this['ispeechTTS'][_0x823c('0xc6')](this,_0x62c4ce);if(_0x30b6b0){this['channel'][_0x823c('0xac')](util[_0x823c('0x29')]('ispeech\x20%s\x20file\x20created',_0x30b6b0));var _0x3642e2=this[_0x823c('0x3b')][_0x823c('0x105')](_0x30b6b0,_0x62c4ce[_0x823c('0x135')]);try{fs['unlink'](_0x30b6b0+_0x823c('0x107'));}catch(_0x5abde0){logger[_0x823c('0x2d')](_0x5abde0);}return _0x3642e2;}return this[_0x823c('0x3b')][_0x823c('0x2d')](_0x62c4ce,_0x823c('0x151'));};AGIVertices[_0x823c('0x15')][_0x823c('0x152')]=function(_0x3729c9){logger[_0x823c('0x2f')](util[_0x823c('0x29')](_0x823c('0x153'),_0x3729c9['label']));if(!this[_0x823c('0xa7')](_0x3729c9[_0x823c('0x154')])){return this[_0x823c('0x3b')][_0x823c('0x2d')](_0x3729c9,_0x823c('0x155'));}logger['info'](util['format'](_0x823c('0x156'),this[_0x823c('0x3b')][_0x823c('0x3e')],_0x3729c9[_0x823c('0x154')]));var _0x27c9fb=this[_0x823c('0x57')]['sync'](this,_0x3729c9['findBy']);if(_0x27c9fb){logger[_0x823c('0x2f')](util['format'](_0x823c('0x157'),this[_0x823c('0x3b')][_0x823c('0x3e')],_0x3729c9[_0x823c('0x154')]));this['channel'][_0x823c('0xac')](util[_0x823c('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x823c('0x3e')],_0x3729c9[_0x823c('0x154')]));return{'code':0xc8,'result':_0x823c('0x158')};}else{logger[_0x823c('0x2f')](util[_0x823c('0x29')](_0x823c('0x159'),this[_0x823c('0x3b')][_0x823c('0x3e')],_0x3729c9[_0x823c('0x154')]));this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0x159'),this[_0x823c('0x3b')][_0x823c('0x3e')],_0x3729c9[_0x823c('0x154')]));return{'code':0xc8,'result':_0x823c('0x15a')};}};AGIVertices[_0x823c('0x15')][_0x823c('0x15b')]=function(_0x145630){logger['info'](util[_0x823c('0x29')](_0x823c('0x15c'),_0x145630[_0x823c('0x3a')]));if(!this[_0x823c('0xa7')](_0x145630[_0x823c('0x154')])){return this[_0x823c('0x3b')][_0x823c('0x2d')](_0x145630,_0x823c('0x155'));}logger['info'](util['format'](_0x823c('0x156'),this['channel'][_0x823c('0x3e')],_0x145630[_0x823c('0x154')]));var _0x46f67d=this[_0x823c('0x56')][_0x823c('0xc6')](this,_0x145630[_0x823c('0x154')]);if(_0x46f67d){logger[_0x823c('0x2f')](util['format'](_0x823c('0x157'),this[_0x823c('0x3b')][_0x823c('0x3e')],_0x145630['findBy']));this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0x157'),this[_0x823c('0x3b')]['callerid'],_0x145630[_0x823c('0x154')]));return{'code':0xc8,'result':_0x823c('0x158')};}else{logger[_0x823c('0x2f')](util['format'](_0x823c('0x159'),this['channel']['callerid'],_0x145630[_0x823c('0x154')]));this[_0x823c('0x3b')]['noop'](util[_0x823c('0x29')](_0x823c('0x159'),this[_0x823c('0x3b')][_0x823c('0x3e')],_0x145630[_0x823c('0x154')]));return{'code':0xc8,'result':_0x823c('0x15a')};}};AGIVertices[_0x823c('0x15')][_0x823c('0x15d')]=function(_0x2cb67){logger[_0x823c('0x2f')](util[_0x823c('0x29')](_0x823c('0x15e'),_0x2cb67[_0x823c('0x3a')]));if(!this[_0x823c('0xa7')](_0x2cb67[_0x823c('0x15f')])){return this[_0x823c('0x3b')][_0x823c('0x2d')](_0x2cb67,_0x823c('0x160'));}this[_0x823c('0x3b')]['noop'](util['format'](_0x823c('0x161'),_0x2cb67[_0x823c('0x15f')]));var _0x3c41a8=eval(_0x2cb67[_0x823c('0x15f')]);if(!this['isConfigured'](_0x2cb67['variable_id'])){return this[_0x823c('0x3b')]['noop'](_0x823c('0xe0'));}var _0xa4f30e=this['getVariable']['sync'](this,_0x2cb67['variable_id']);if(!_0xa4f30e){return this[_0x823c('0x3b')]['error'](_0x2cb67,_0x823c('0x119'));}if(_[_0x823c('0x162')](_0x3c41a8)){var _0x84b212=this;_0x3c41a8['forEach'](function(_0x3d0a07,_0x1747dc){_0x84b212[_0x823c('0x3b')][_0x823c('0xa0')](util['format'](_0x823c('0x163'),_0xa4f30e,_0x1747dc),_0x3d0a07);});return this['channel'][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0x164'),_0xa4f30e));}else{return this['channel'][_0x823c('0xa0')](_0xa4f30e,_0x3c41a8);}};AGIVertices[_0x823c('0x15')]['menu']=function(_0x3ac033){logger['info'](util[_0x823c('0x29')](_0x823c('0x165'),_0x3ac033[_0x823c('0x3a')]));if(_0x3ac033[_0x823c('0xa9')]===0x0){return this[_0x823c('0xa8')](_0x3ac033);}_0x3ac033[_0x823c('0xa9')]-=0x1;if(!this[_0x823c('0xa7')](_0x3ac033[_0x823c('0x166')])){return this[_0x823c('0x3b')]['error'](_0x3ac033,_0x823c('0x114'));}var _0x57e4fb=this[_0x823c('0x1f')][_0x823c('0xc6')](this,_0x3ac033['file_id']);if(!_0x57e4fb){return this[_0x823c('0x3b')][_0x823c('0x2d')](_0x3ac033,_0x823c('0x115'));}var _0x2a4647=this[_0x823c('0x3b')][_0x823c('0x167')](_0x57e4fb,_0x3ac033['response'],_0x3ac033[_0x823c('0x168')]);var _0x1185ab=_0x2a4647['result'];if(_0x2a4647['result']===-0x1){this[_0x823c('0x38')][_0x823c('0xc6')](this,_0x3ac033,'-1');return _0x2a4647;}else if(_0x2a4647[_0x823c('0xa3')]===_0x823c('0x6a')){_0x2a4647[_0x823c('0xa5')]=_0x2a4647[_0x823c('0xa5')][_0x823c('0x9c')]>0x0?_0x2a4647[_0x823c('0xa5')]:'t';}else if(_[_0x823c('0x47')](_0x2a4647[_0x823c('0xa5')])){_0x2a4647[_0x823c('0xa5')]='#';_0x1185ab='#';}if(!this[_0x823c('0xa7')](_0x3ac033[_0x823c('0xdf')])){this[_0x823c('0x3b')][_0x823c('0xac')](_0x823c('0xe0'));}else{var _0x455bfc=this[_0x823c('0x11')][_0x823c('0xc6')](this,_0x3ac033[_0x823c('0xdf')]);if(!_0x455bfc){return this[_0x823c('0x3b')][_0x823c('0x2d')](_0x3ac033,_0x823c('0x119'));}this['channel'][_0x823c('0xa0')](_0x455bfc,_0x1185ab);}this[_0x823c('0x38')][_0x823c('0xc6')](this,_0x3ac033,_0x1185ab);return _0x2a4647;};AGIVertices[_0x823c('0x15')][_0x823c('0xac')]=function(_0x58caa1){logger['info'](util[_0x823c('0x29')](_0x823c('0x169'),_0x58caa1[_0x823c('0x3a')]));return this[_0x823c('0x3b')][_0x823c('0xac')](_0x58caa1[_0x823c('0x16a')]||_0x58caa1['label']);};AGIVertices[_0x823c('0x15')][_0x823c('0x16b')]=function(_0x151824){logger[_0x823c('0x2f')](util[_0x823c('0x29')](_0x823c('0x16c'),_0x151824[_0x823c('0x3a')]));if(!this['isConfigured'](_0x151824[_0x823c('0x154')])){return this[_0x823c('0x3b')]['error'](_0x151824,_0x823c('0x155'));}logger[_0x823c('0x2f')](util[_0x823c('0x29')](_0x823c('0x156'),this[_0x823c('0x3b')][_0x823c('0x3e')],_0x151824[_0x823c('0x154')]));var _0x9225a7=this[_0x823c('0x52')]['sync'](this,_0x151824[_0x823c('0x16d')]);var _0x59090a=this[_0x823c('0x54')]['sync'](this,_0x151824[_0x823c('0x154')],_0x9225a7);if(_0x59090a){logger['info'](util['format'](_0x823c('0x157'),this[_0x823c('0x3b')][_0x823c('0x3e')],_0x151824['findBy']));this[_0x823c('0x3b')][_0x823c('0xac')](util['format'](_0x823c('0x157'),this[_0x823c('0x3b')][_0x823c('0x3e')],_0x151824[_0x823c('0x154')]));return{'code':0xc8,'result':_0x823c('0x158')};}else{logger[_0x823c('0x2f')](util['format'](_0x823c('0x159'),this[_0x823c('0x3b')]['callerid'],_0x151824[_0x823c('0x154')]));this['channel'][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0x157'),this[_0x823c('0x3b')][_0x823c('0x3e')],_0x151824[_0x823c('0x154')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x823c('0x15')][_0x823c('0x16e')]=function(_0x3d2ad6){logger[_0x823c('0x2f')](util[_0x823c('0x29')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x3d2ad6[_0x823c('0x3a')]));if(!this[_0x823c('0xa7')](_0x3d2ad6[_0x823c('0x166')])){return this[_0x823c('0x3b')][_0x823c('0x2d')](_0x3d2ad6,_0x823c('0x114'));}var _0x4f5159=this['getSound'][_0x823c('0xc6')](this,_0x3d2ad6['file_id']);if(!_0x4f5159){return this[_0x823c('0x3b')][_0x823c('0x2d')](_0x3d2ad6,_0x823c('0x115'));}var _0xfa3be6=this['channel'][_0x823c('0xaf')]('PLAYBACK',[_0x4f5159,_0x3d2ad6[_0x823c('0x110')]]);if(_0xfa3be6[_0x823c('0xa5')]===-0x1){return _0xfa3be6;}return this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0xca'),_0x823c('0x16f'),_0x4f5159));};AGIVertices[_0x823c('0x15')]['queue']=function(_0x7658a7){logger[_0x823c('0x2f')](util[_0x823c('0x29')](_0x823c('0x170'),_0x7658a7[_0x823c('0x3a')]));if(!this[_0x823c('0xa7')](_0x7658a7[_0x823c('0x171')])){return this[_0x823c('0x3b')][_0x823c('0x2d')](_0x7658a7,_0x823c('0x172'));}var _0xae9c41='';var _0x3a8367=parseInt(_0x7658a7[_0x823c('0x171')],0xa);if(isNaN(_0x3a8367)){_0xae9c41=_0x7658a7[_0x823c('0x171')];}else{_0xae9c41=this[_0x823c('0x173')]['sync'](this,_0x7658a7[_0x823c('0x171')]);if(!_0xae9c41){return this[_0x823c('0x3b')][_0x823c('0x2d')](_0x7658a7,_0x823c('0x174'));}}var _0x2496fc='';if(this['isConfigured'](_0x7658a7[_0x823c('0x166')])){var _0xea3805=this[_0x823c('0x1f')][_0x823c('0xc6')](this,_0x7658a7[_0x823c('0x166')]);if(_0xea3805){_0x2496fc=_0xea3805;}}this[_0x823c('0x38')][_0x823c('0xc6')](this,_0x7658a7,_0xae9c41);if(_0x7658a7[_0x823c('0x110')]['indexOf']('x')<0x0){_0x7658a7[_0x823c('0x110')]+='x';}if(_0x7658a7[_0x823c('0x110')][_0x823c('0x175')]('X')<0x0){_0x7658a7[_0x823c('0x110')]+='X';}this[_0x823c('0x3b')][_0x823c('0xa0')](_0x823c('0x176'),_0xae9c41?_0xae9c41[_0x823c('0x177')]():'');var _0x323fda=this[_0x823c('0x3b')][_0x823c('0xaf')](_0x823c('0x178'),[_0xae9c41,_0x7658a7[_0x823c('0x110')],_0x7658a7[_0x823c('0x68')],_0x2496fc,_0x7658a7['timeout'],_0x7658a7[_0x823c('0x7')],_0x7658a7[_0x823c('0x179')],_0x7658a7[_0x823c('0x17a')],'',_0x7658a7[_0x823c('0x17b')]]);if(_0x323fda[_0x823c('0xa5')]===-0x1){return _0x323fda;}return this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0xca'),'QUEUE',_0xae9c41));};AGIVertices[_0x823c('0x15')]['record']=function(_0x1dc699){logger['info'](util[_0x823c('0x29')](_0x823c('0x17c'),_0x1dc699[_0x823c('0x3a')]));var _0x573065=_0x1dc699[_0x823c('0x17d')]||_0x823c('0x131');var _0x2a0d7b=util[_0x823c('0x29')](_0x823c('0x17e'),this[_0x823c('0x3b')]['uniqueid'],rs[_0x823c('0x11b')](0x5));var _0x408469=util[_0x823c('0x29')](_0x823c('0x17f'),FILES_PATH,_0x2a0d7b,_0x573065);var _0x39c595=util[_0x823c('0x29')](_0x823c('0x13b'),FILES_PATH,_0x2a0d7b);this[_0x823c('0x3d')]['sync'](this,_0x1dc699,_0x2a0d7b,_0x408469);this['channel'][_0x823c('0xa0')]('RECORDING_SAVENAME',_0x2a0d7b);logger[_0x823c('0x2f')](_0x823c('0x180'),_0x39c595,_0x573065,_0x1dc699[_0x823c('0x181')],_0x1dc699[_0x823c('0x6a')]);return this[_0x823c('0x3b')][_0x823c('0x134')](_0x39c595,_0x573065,_0x1dc699[_0x823c('0x181')],_0x1dc699['timeout'],undefined,!![]);};AGIVertices[_0x823c('0x15')][_0x823c('0x182')]=function(_0x497968){logger[_0x823c('0x2f')](util[_0x823c('0x29')](_0x823c('0x183'),_0x497968[_0x823c('0x3a')]));if(!this[_0x823c('0xa7')](_0x497968[_0x823c('0x68')])){return this['channel'][_0x823c('0xac')](_0x823c('0x184'));}var _0x1b3f31=this[_0x823c('0x67')]['sync'](this,_0x497968);logger[_0x823c('0x2f')](util[_0x823c('0x29')](_0x823c('0x185'),util[_0x823c('0x186')](_0x1b3f31,{'showHidden':![],'depth':null})));if(!this[_0x823c('0xa7')](_0x497968[_0x823c('0xdf')])){return this['channel'][_0x823c('0xac')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x3d4016=this[_0x823c('0x11')][_0x823c('0xc6')](this,_0x497968[_0x823c('0xdf')]);if(!_0x3d4016){return this[_0x823c('0x3b')][_0x823c('0x2d')](_0x497968,_0x823c('0x119'));}this[_0x823c('0x3b')][_0x823c('0xa0')](util[_0x823c('0x29')](_0x823c('0x187'),_0x3d4016),_0x1b3f31[_0x823c('0x78')]?_0x1b3f31[_0x823c('0x78')]:_0x823c('0x188'));this['channel'][_0x823c('0xa0')](util[_0x823c('0x29')]('%s_STATUS_MESSAGE',_0x3d4016),_0x1b3f31[_0x823c('0x79')]?_0x1b3f31['statusMessage']:'OK');if(_0x1b3f31[_0x823c('0x70')]){try{this[_0x823c('0x9e')](_0x1b3f31[_0x823c('0x70')],_0x3d4016);}catch(_0x8e8991){logger[_0x823c('0x2d')](util[_0x823c('0x29')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x3d4016));}}return this[_0x823c('0x3b')]['noop'](util[_0x823c('0x29')](_0x823c('0xe3'),_0x3d4016));};AGIVertices[_0x823c('0x15')][_0x823c('0x189')]=function(_0x37018b){logger[_0x823c('0x2f')](util['format'](_0x823c('0x18a'),_0x37018b[_0x823c('0x3a')]));return this[_0x823c('0x3b')][_0x823c('0x18b')](_0x37018b[_0x823c('0x18c')][_0x823c('0x5c')](/\s+/g,''),_0x37018b[_0x823c('0x181')]);};AGIVertices[_0x823c('0x15')]['saynumber']=function(_0x4c3048){logger['info'](util[_0x823c('0x29')](_0x823c('0x18d'),_0x4c3048[_0x823c('0x3a')]));return this['channel'][_0x823c('0x18e')](_0x4c3048[_0x823c('0x6b')][_0x823c('0x5c')](/\s+/g,''),_0x4c3048['escape_digits']);};AGIVertices['prototype'][_0x823c('0x18f')]=function(_0x1dc360){logger[_0x823c('0x2f')](util[_0x823c('0x29')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x1dc360[_0x823c('0x3a')]));return this['channel'][_0x823c('0x190')](_0x1dc360[_0x823c('0x5f')],_0x1dc360[_0x823c('0x181')]);};AGIVertices[_0x823c('0x15')][_0x823c('0x191')]=function(_0x5e856f){logger[_0x823c('0x2f')](util[_0x823c('0x29')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x5e856f[_0x823c('0x3a')]));if(!this[_0x823c('0xa7')](_0x5e856f[_0x823c('0x192')])){return this[_0x823c('0x3b')][_0x823c('0xac')](_0x823c('0x193'));}var _0x215be0=this['getMailAccount'][_0x823c('0xc6')](this,_0x5e856f['account_id']);if(!_0x215be0||!_0x215be0[_0x823c('0x194')]){return this[_0x823c('0x3b')][_0x823c('0x2d')](_0x5e856f,'no\x20mail\x20account\x20found');}var _0x12bf65={'from':util[_0x823c('0x29')](_0x823c('0x195'),_0x215be0[_0x823c('0x14')],_0x215be0[_0x823c('0x196')]||_0x215be0[_0x823c('0x194')][_0x823c('0x197')]),'to':_0x5e856f['to']||'','cc':_0x5e856f['cc']||'','bcc':_0x5e856f[_0x823c('0x198')]||'','subject':_0x5e856f[_0x823c('0x199')],'html':_0x5e856f[_0x823c('0x5f')],'text':_0x5e856f[_0x823c('0x5f')]};var _0x10b361={'tls':{'rejectUnauthorized':![]}};if(_0x215be0[_0x823c('0x194')][_0x823c('0x19a')]){_0x10b361[_0x823c('0x19a')]=_0x215be0[_0x823c('0x194')][_0x823c('0x19a')];}else{_0x10b361[_0x823c('0x19b')]=_0x215be0[_0x823c('0x194')][_0x823c('0x19b')];_0x10b361['port']=_0x215be0[_0x823c('0x194')]['port'];_0x10b361['secure']=_0x215be0[_0x823c('0x194')][_0x823c('0x19c')];}if(_0x215be0[_0x823c('0x194')]['authentication']){_0x10b361[_0x823c('0x19d')]={'user':_0x215be0['Smtp'][_0x823c('0x197')],'pass':_0x215be0[_0x823c('0x194')][_0x823c('0x19e')]};}if(this[_0x823c('0xa7')](_0x5e856f[_0x823c('0x19f')])){}logger[_0x823c('0x1a0')](_0x823c('0x1a1'),JSON[_0x823c('0x77')](_0x12bf65));this['createSquareDetailsReport'][_0x823c('0xc6')](this,_0x5e856f,_0x5e856f['account_id']);this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0x1a2'),_0x215be0['name']));this['sendMailMessage'][_0x823c('0xc6')](this,_0x10b361,_0x12bf65);return this['channel']['noop'](_0x823c('0x1a3'));};AGIVertices[_0x823c('0x15')][_0x823c('0x1a4')]=function(_0x19f830){logger[_0x823c('0x2f')](util[_0x823c('0x29')](_0x823c('0x1a5'),_0x19f830['label']));return this[_0x823c('0x3b')][_0x823c('0xac')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x823c('0x15')]['sendSMS']=function(_0x46741f){logger['info'](util[_0x823c('0x29')](_0x823c('0x1a6'),_0x46741f['label']));if(!this[_0x823c('0xa7')](_0x46741f['sms_account_id'])){return this[_0x823c('0x3b')][_0x823c('0xac')](_0x823c('0x1a7'));}var _0x59de93=this[_0x823c('0x36')][_0x823c('0xc6')](this,_0x46741f[_0x823c('0x1a8')]);if(!_0x59de93){return this['channel'][_0x823c('0x2d')](_0x46741f,_0x823c('0x1a9'));}var _0x5be770={'body':_0x46741f[_0x823c('0x1aa')],'phone':_0x46741f['to']||'','SmsAccountId':_0x59de93['id']};logger['debug'](_0x823c('0x1ab'),JSON[_0x823c('0x77')](_0x5be770));this[_0x823c('0x38')][_0x823c('0xc6')](this,_0x46741f,_0x46741f[_0x823c('0x1a8')]);this['channel']['noop'](util['format'](_0x823c('0x1ac'),_0x59de93[_0x823c('0x14')]));this[_0x823c('0x37')][_0x823c('0xc6')](this,_0x5be770);return this[_0x823c('0x3b')][_0x823c('0xac')](_0x823c('0x1ad'));};AGIVertices[_0x823c('0x15')]['set']=function(_0x41a884){logger[_0x823c('0x2f')](util[_0x823c('0x29')](_0x823c('0x1ae'),_0x41a884['label']));if(!this[_0x823c('0xa7')](_0x41a884[_0x823c('0xdf')])){return this[_0x823c('0x3b')][_0x823c('0x2d')](_0x41a884,_0x823c('0x1af'));}var _0xc13a9a=this[_0x823c('0x11')][_0x823c('0xc6')](this,_0x41a884['variable_id']);if(!_0xc13a9a){return this['channel'][_0x823c('0x2d')](_0x41a884,_0x823c('0x119'));}return this[_0x823c('0x3b')][_0x823c('0xa0')](_0xc13a9a,_0x41a884['variable_value']);};AGIVertices[_0x823c('0x15')]['start']=function(_0x2af496){logger[_0x823c('0x2f')](util['format'](_0x823c('0x1b0'),_0x2af496[_0x823c('0x3a')]));this['channel'][_0x823c('0xac')](_0x823c('0x1b1'));if(_0x2af496['answer']==='yes'){this['channel'][_0x823c('0xac')](_0x823c('0x1b2'));return this[_0x823c('0x3b')][_0x823c('0xbe')]();}return this[_0x823c('0x3b')][_0x823c('0xac')](_0x823c('0x1b3'));};AGIVertices['prototype'][_0x823c('0x1b4')]=function(_0x3631a8){logger[_0x823c('0x2f')](util[_0x823c('0x29')](_0x823c('0x1b5'),_0x3631a8['label']));if(!this[_0x823c('0xa7')](_0x3631a8[_0x823c('0x1b6')])){return this['channel'][_0x823c('0x2d')](_0x3631a8,_0x823c('0x1b7'));}var _0x2e9942=this[_0x823c('0x17')][_0x823c('0xc6')](this,_0x3631a8[_0x823c('0x1b6')]);if(!this[_0x823c('0xa7')](_0x2e9942)){return this['channel'][_0x823c('0x2d')](_0x3631a8,util['format'](_0x823c('0x1b8'),_0x3631a8[_0x823c('0x1b6')]));}if(_0x2e9942===this[_0x823c('0x3b')][_0x823c('0x3c')]){return this[_0x823c('0x3b')][_0x823c('0x2d')](_0x3631a8,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x823c('0x38')][_0x823c('0xc6')](this,_0x3631a8,_0x2e9942);var _0x397122=this[_0x823c('0x3b')][_0x823c('0xaf')](_0x823c('0x1b9'),util['format'](_0x823c('0x1ba'),config[_0x823c('0x7')][_0x823c('0x19b')]||_0x823c('0x1bb'),_0x2e9942,this[_0x823c('0x3b')]['arg_1']));if(_0x397122[_0x823c('0xa5')]===-0x1){return _0x397122;}return this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')]('Executed\x20command\x20%s\x20%s',_0x823c('0x1b9'),_0x2e9942));};AGIVertices[_0x823c('0x15')][_0x823c('0x1bc')]=function(_0xc58657){logger[_0x823c('0x2f')](util[_0x823c('0x29')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0xc58657[_0x823c('0x3a')]));var _0x1617ba=this[_0x823c('0x5a')][_0x823c('0xc6')](this,_0xc58657['command']);this['createSquareDetailsReport'][_0x823c('0xc6')](this,_0xc58657,_0xc58657[_0x823c('0x1bd')]);if(this[_0x823c('0xa7')](_0xc58657['variable_id'])){var _0x482cbc=this[_0x823c('0x11')][_0x823c('0xc6')](this,_0xc58657['variable_id']);if(_0x482cbc){this[_0x823c('0x3b')]['setVariable'](_0x482cbc,_0x1617ba);return this['channel'][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0x1be'),_0xc58657[_0x823c('0x1bd')],_0x482cbc));}}return this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0x1bf'),_0xc58657[_0x823c('0x1bd')]));};AGIVertices[_0x823c('0x15')][_0x823c('0x1c0')]=function(_0x33a27e){logger[_0x823c('0x2f')](util[_0x823c('0x29')](_0x823c('0x1c1'),_0x33a27e[_0x823c('0x3a')]));_0x33a27e[_0x823c('0x5f')]=_0x33a27e[_0x823c('0x5f')][_0x823c('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x33a27e[_0x823c('0x1c2')])){return this['channel'][_0x823c('0xac')](_0x823c('0x1c3'));}if(!this[_0x823c('0xa7')](_0x33a27e[_0x823c('0x5f')])){return this[_0x823c('0x3b')]['noop'](_0x823c('0xad'));}this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0x1c4'),_0x33a27e['text']));var _0x50cb8f=this['googleCloudTTS']['sync'](this,_0x33a27e);if(_0x50cb8f){this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x50cb8f));var _0x118cd9=this[_0x823c('0x3b')][_0x823c('0x105')](_0x50cb8f);try{fs[_0x823c('0x1c5')](_0x50cb8f+_0x823c('0x107'));}catch(_0x5da682){logger[_0x823c('0x2d')](_0x5da682);}return _0x118cd9;}return this[_0x823c('0x3b')][_0x823c('0x2d')](_0x33a27e,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x823c('0x15')][_0x823c('0x1c6')]=function(_0x507f9f){logger[_0x823c('0x2f')](util[_0x823c('0x29')](_0x823c('0x1c7'),_0x507f9f[_0x823c('0x3a')]));_0x507f9f[_0x823c('0x5f')]=_0x507f9f[_0x823c('0x5f')][_0x823c('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x507f9f[_0x823c('0x5f')])){return this[_0x823c('0x3b')]['noop'](_0x823c('0xad'));}this[_0x823c('0x3b')]['noop'](util[_0x823c('0x29')](_0x823c('0x1c8'),_0x507f9f[_0x823c('0x5f')]));var _0x574012=this['googleTTS'][_0x823c('0xc6')](this,_0x507f9f);if(_0x574012){this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0x1c9'),_0x574012));var _0x1708da=this[_0x823c('0x3b')][_0x823c('0x105')](_0x574012);try{fs[_0x823c('0x1c5')](_0x574012+_0x823c('0x107'));}catch(_0x288c8e){logger[_0x823c('0x2d')](_0x288c8e);}return _0x1708da;}return this[_0x823c('0x3b')][_0x823c('0x2d')](_0x507f9f,_0x823c('0x1ca'));};AGIVertices[_0x823c('0x15')]['unpause']=function(_0x19dd67){logger[_0x823c('0x2f')](util[_0x823c('0x29')](_0x823c('0x1cb'),_0x19dd67[_0x823c('0x3a')]));if(!this['isConfigured'](_0x19dd67[_0x823c('0x154')])){return this['channel'][_0x823c('0x2d')](_0x19dd67,_0x823c('0x155'));}logger[_0x823c('0x2f')](util[_0x823c('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x823c('0x3e')],_0x19dd67[_0x823c('0x154')]));var _0x4df9b3=this[_0x823c('0x1cc')]['sync'](this,_0x19dd67['findBy']);if(_0x4df9b3){logger[_0x823c('0x2f')](util[_0x823c('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x823c('0x3b')]['callerid'],_0x19dd67[_0x823c('0x154')]));this['channel'][_0x823c('0xac')](util['format'](_0x823c('0x157'),this[_0x823c('0x3b')][_0x823c('0x3e')],_0x19dd67[_0x823c('0x154')]));return{'code':0xc8,'result':'success'};}else{logger[_0x823c('0x2f')](util[_0x823c('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x823c('0x3b')][_0x823c('0x3e')],_0x19dd67[_0x823c('0x154')]));this[_0x823c('0x3b')][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0x159'),this[_0x823c('0x3b')][_0x823c('0x3e')],_0x19dd67[_0x823c('0x154')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x823c('0x1cd')]=function(_0x37538e){logger[_0x823c('0x2f')](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x37538e[_0x823c('0x3a')]));var _0x1eae06=this[_0x823c('0x3b')]['exec'](_0x823c('0x1ce'),[_0x37538e[_0x823c('0x1cf')],_0x37538e[_0x823c('0xae')]]);if(_0x1eae06['result']===-0x1){return _0x1eae06;}return this['channel'][_0x823c('0xac')](util[_0x823c('0x29')](_0x823c('0xca'),_0x823c('0x1ce'),_0x37538e['mailbox']));};AGIVertices[_0x823c('0x15')][_0x823c('0x1d0')]=function(_0x58af12){logger[_0x823c('0x2f')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x58af12['label']));if(!this[_0x823c('0xa7')](_0x58af12[_0x823c('0xdf')])){return this[_0x823c('0x3b')][_0x823c('0x2d')](_0x58af12,_0x823c('0x1af'));}var _0x3e5d66=this[_0x823c('0x11')]['sync'](this,_0x58af12[_0x823c('0xdf')]);if(!_0x3e5d66){return this[_0x823c('0x3b')]['error'](_0x58af12,'no\x20variable\x20found');}var _0x4f8777=this[_0x823c('0x3b')]['getVariable'](_0x3e5d66);return{'code':0xc8,'result':_0x4f8777[_0x823c('0xa3')]?_0x4f8777[_0x823c('0xa3')]:'-'};};String[_0x823c('0x15')][_0x823c('0xa2')]=function(_0x3b8d25,_0x327c1b){return this[_0x823c('0xa1')](_0x3b8d25)[_0x823c('0x1d1')](_0x327c1b);};module[_0x823c('0x1d2')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 627d910..426af7b 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 _0xb2d3=['timer','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','message','stopAcw','info','[%s][UPDATE][ERRORS:%s]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','startAcw','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','getAgent','then','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','acwTimeout'];(function(_0x4cba56,_0x5b2c44){var _0x3cc9f3=function(_0x5bb80a){while(--_0x5bb80a){_0x4cba56['push'](_0x4cba56['shift']());}};_0x3cc9f3(++_0x5b2c44);}(_0xb2d3,0x176));var _0x3b2d=function(_0x438fe1,_0x3308d5){_0x438fe1=_0x438fe1-0x0;var _0x3c8e1b=_0xb2d3[_0x438fe1];return _0x3c8e1b;};'use strict';var util=require(_0x3b2d('0x0'));var _=require(_0x3b2d('0x1'));var moment=require(_0x3b2d('0x2'));var ami=require(_0x3b2d('0x3'));var logger=require(_0x3b2d('0x4'))(_0x3b2d('0x5'));var RpcUser=require(_0x3b2d('0x6'));var RpcVoiceAgentReport=require(_0x3b2d('0x7'));function Acw(_0x1a7f0b){this[_0x3b2d('0x8')]=_0x1a7f0b[_0x3b2d('0x8')];this[_0x3b2d('0x9')]=_0x1a7f0b['agents'];this[_0x3b2d('0xa')]=_0x1a7f0b[_0x3b2d('0xa')];this[_0x3b2d('0xb')]={};ami['on'](_0x3b2d('0xc'),this[_0x3b2d('0xd')][_0x3b2d('0xe')](this));ami['on'](_0x3b2d('0xf'),this[_0x3b2d('0x10')]['bind'](this));ami['on'](_0x3b2d('0x11'),this['syncHangup']['bind'](this));ami['on'](_0x3b2d('0x12'),this[_0x3b2d('0x13')]['bind'](this));ami['on'](_0x3b2d('0x14'),this[_0x3b2d('0x15')][_0x3b2d('0xe')](this));ami['on']('blindtransfer',this[_0x3b2d('0x16')][_0x3b2d('0xe')](this));ami['on'](_0x3b2d('0x17'),this[_0x3b2d('0x18')][_0x3b2d('0xe')](this));}function getDiff(_0x33491c){var _0x342436=moment()[_0x3b2d('0x19')](0x0);var _0x91e7e7=moment(_0x33491c)['milliseconds'](0x0);return _0x342436['diff'](_0x91e7e7,_0x3b2d('0x1a'));}Acw[_0x3b2d('0x1b')]['startAcw']=function(_0xe2d102){try{var _0x3b497d=this;var _0x1dc204=this['channels'][_0xe2d102][_0x3b2d('0x1c')];var _0xa7437c=this[_0x3b2d('0xb')][_0xe2d102][_0x3b2d('0x1d')];var _0x1dc25b=this[_0x3b2d('0x8')][_0xa7437c];var _0x418df8=![];var _0x34693e=_0x3b2d('0x1e');if(_0x1dc25b[_0x3b2d('0x1f')]){if(_0x1dc25b[_0x3b2d('0x20')][_0x3b2d('0x21')]){_0x418df8=!![];_0x34693e=_0x1dc25b[_0x3b2d('0x20')][_0x3b2d('0x21')];}}ami[_0x3b2d('0x22')]({'action':'QueuePause','interface':_0x1dc204,'paused':!![],'reason':_0x34693e})['then'](function(_0x57852b){if(_0x3b497d[_0x3b2d('0x9')][_0x1dc204]){return RpcUser[_0x3b2d('0x23')](_0x3b497d[_0x3b2d('0x9')][_0x1dc204]['id'])[_0x3b2d('0x24')](function(_0x521a24){if(_0x521a24&&!_0x521a24[_0x3b2d('0x25')]){logger['info'](_0x3b2d('0x26'),_0xe2d102,_0x1dc204,_0xa7437c);var _0x3ecfbd=_0x3b497d[_0x3b2d('0xb')][_0xe2d102]['attended']&&_0x3b497d[_0x3b2d('0xb')][_0xe2d102]['destlinkedid']?_0x3b497d[_0x3b2d('0xb')][_0xe2d102][_0x3b2d('0x27')]:_0xe2d102;return RpcUser['savePause'](_0x3b497d[_0x3b2d('0x9')][_0x1dc204],_0x34693e,_0x3ecfbd)['then'](function(_0x3f8f1d){if(!_0x418df8){_0x3b497d['timers'][_0x1dc204]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0xe2d102,_0x3b497d[_0x3b2d('0x8')][_0xa7437c][_0x3b2d('0x28')],_0x1dc204,_0xa7437c);_0x3b497d[_0x3b2d('0xa')][_0x1dc204][_0x3b2d('0x29')]=setTimeout(_0x3b497d['stopAcw'][_0x3b2d('0xe')](_0x3b497d,_0x1dc204),_0x3b497d[_0x3b2d('0x8')][_0xa7437c][_0x3b2d('0x28')]*0x3e8);_0x3b497d['timers'][_0x1dc204][_0x3b2d('0x2a')]=moment()[_0x3b2d('0x2b')](_0x3b2d('0x2c'));_0x3b497d[_0x3b2d('0xa')][_0x1dc204][_0x3b2d('0x2d')]=_0xe2d102;_0x3b497d['timers'][_0x1dc204][_0x3b2d('0x1d')]=_0xa7437c;_0x3b497d[_0x3b2d('0xa')][_0x1dc204]['updateAcw']=function(){var _0x17f55a=getDiff(_0x3b497d[_0x3b2d('0xa')][_0x1dc204]['lastPauseAt']);clearTimeout(_0x3b497d[_0x3b2d('0xa')][_0x1dc204][_0x3b2d('0x29')]);_0x3b497d[_0x3b2d('0xa')][_0x1dc204][_0x3b2d('0x29')]=![];RpcVoiceAgentReport[_0x3b2d('0x2e')]({'acwtime':_0x17f55a},_0x3b497d[_0x3b2d('0xa')][_0x1dc204][_0x3b2d('0x2d')],_0x1dc204)[_0x3b2d('0x24')](function(_0x3d5cc9){logger['info'](_0x3b2d('0x2f'),_0xe2d102,_0x17f55a,_0x3d5cc9);})[_0x3b2d('0x30')](function(_0x18e847){logger[_0x3b2d('0x31')]('[%s][UPDATE][ERRORS:%s]',_0xe2d102,_0x18e847);});delete _0x3b497d[_0x3b2d('0xa')][_0x1dc204];};}});}else{logger['info'](_0x3b2d('0x32'),_0xe2d102,_0x1dc204,_0xa7437c);}});}})[_0x3b2d('0x30')](function(_0x4a8103){logger['error'](_0x3b2d('0x33'),_0xe2d102,_0x3b497d['voiceQueues'][_0xa7437c][_0x3b2d('0x28')],_0x1dc204,_0xa7437c);})[_0x3b2d('0x34')](function(){delete _0x3b497d[_0x3b2d('0xb')][_0xe2d102];});}catch(_0x57e305){logger[_0x3b2d('0x31')]('[ACW][START]\x20%s',_0x57e305[_0x3b2d('0x35')]);}};Acw[_0x3b2d('0x1b')][_0x3b2d('0x36')]=function(_0x261b5b){try{var _0x532456=this;if(_0x532456[_0x3b2d('0xa')][_0x261b5b]){_0x532456[_0x3b2d('0xa')][_0x261b5b]['timer']=![];var _0x2e8e72=_0x532456[_0x3b2d('0xa')][_0x261b5b][_0x3b2d('0x2d')];var _0x1d0498=_0x532456[_0x3b2d('0xa')][_0x261b5b][_0x3b2d('0x1d')];var _0x24e380=_0x532456['voiceQueues'][_0x1d0498][_0x3b2d('0x28')];logger[_0x3b2d('0x37')]('[%s][TIMER][STOP][AGENT:%s]',_0x2e8e72,_0x261b5b);RpcUser['saveUnpause'](this['agents'][_0x261b5b]);RpcVoiceAgentReport[_0x3b2d('0x2e')]({'acwtime':_0x24e380,'agentacw':!![]},_0x2e8e72,_0x261b5b)[_0x3b2d('0x24')](function(_0x45f58d){logger[_0x3b2d('0x37')](_0x3b2d('0x2f'),_0x2e8e72,_0x24e380,_0x45f58d);})['catch'](function(_0x2b3425){logger[_0x3b2d('0x31')](_0x3b2d('0x38'),_0x2e8e72,_0x2b3425);});}else{logger[_0x3b2d('0x31')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x261b5b);if(_0x532456[_0x3b2d('0xa')]){logger['info']('[ACW][TIMERS]',JSON[_0x3b2d('0x39')](_0x532456[_0x3b2d('0xa')]));}}}catch(_0xd594d6){logger[_0x3b2d('0x31')](_0x3b2d('0x3a'),_0xd594d6[_0x3b2d('0x35')]);}};Acw[_0x3b2d('0x1b')][_0x3b2d('0xd')]=function(_0x15c4f7){try{if(this[_0x3b2d('0x8')][_0x15c4f7['queue']]&&(this[_0x3b2d('0x8')][_0x15c4f7['queue']][_0x3b2d('0x5')]||this[_0x3b2d('0x8')][_0x15c4f7[_0x3b2d('0x1d')]][_0x3b2d('0x1f')])){if(this['agents'][_0x15c4f7[_0x3b2d('0x1c')]]){this[_0x3b2d('0xb')][_0x15c4f7[_0x3b2d('0x2d')]]={'queue':_0x15c4f7[_0x3b2d('0x1d')],'interface':_0x15c4f7[_0x3b2d('0x1c')],'destlinkedid':_0x15c4f7[_0x3b2d('0x27')]};}}}catch(_0x587517){logger[_0x3b2d('0x31')](_0x3b2d('0x3b'),_0x587517[_0x3b2d('0x35')]);}};Acw[_0x3b2d('0x1b')]['syncAgentConnectPreview']=function(_0x53f218){try{if(this[_0x3b2d('0x8')][_0x53f218[_0x3b2d('0x1d')]]&&(this[_0x3b2d('0x8')][_0x53f218[_0x3b2d('0x1d')]][_0x3b2d('0x5')]||this[_0x3b2d('0x8')][_0x53f218[_0x3b2d('0x1d')]]['mandatoryDisposition'])){if(this[_0x3b2d('0x9')][_0x53f218[_0x3b2d('0x1c')]]){this['channels'][_0x53f218[_0x3b2d('0x2d')]]={'queue':_0x53f218[_0x3b2d('0x1d')],'interface':_0x53f218[_0x3b2d('0x1c')]};}}}catch(_0x6a4e3e){logger['error'](_0x3b2d('0x3c'),_0x6a4e3e[_0x3b2d('0x35')]);}};Acw[_0x3b2d('0x1b')]['syncHangupRequest']=function(_0x430e80){try{if(this[_0x3b2d('0xb')][_0x430e80[_0x3b2d('0x2d')]]&&_[_0x3b2d('0x3d')](this['channels'][_0x430e80['uniqueid']][_0x3b2d('0x3e')])){logger[_0x3b2d('0x37')](_0x3b2d('0x3f'),_0x430e80[_0x3b2d('0x2d')]);this['startAcw'](_0x430e80['uniqueid']);}else if(this[_0x3b2d('0xb')][_0x430e80[_0x3b2d('0x40')]]&&_['isUndefined'](this[_0x3b2d('0xb')][_0x430e80['linkedid']]['attended'])){logger['info'](_0x3b2d('0x41'),_0x430e80[_0x3b2d('0x40')]);this[_0x3b2d('0x42')](_0x430e80[_0x3b2d('0x40')]);}}catch(_0x215dfe){logger[_0x3b2d('0x31')](_0x3b2d('0x43'),_0x215dfe['message']);}};Acw[_0x3b2d('0x1b')][_0x3b2d('0x44')]=function(_0x575951){try{if(this['channels'][_0x575951[_0x3b2d('0x2d')]]&&this[_0x3b2d('0xb')][_0x575951[_0x3b2d('0x2d')]]['attended']){logger[_0x3b2d('0x37')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x575951[_0x3b2d('0x2d')]);this[_0x3b2d('0x42')](_0x575951['uniqueid']);}else if(this[_0x3b2d('0xb')][_0x575951[_0x3b2d('0x40')]]&&this[_0x3b2d('0xb')][_0x575951[_0x3b2d('0x40')]][_0x3b2d('0x3e')]){logger[_0x3b2d('0x37')](_0x3b2d('0x45'),_0x575951[_0x3b2d('0x40')]);this[_0x3b2d('0x42')](_0x575951[_0x3b2d('0x40')]);}}catch(_0x22d9ed){logger[_0x3b2d('0x31')]('[ACW][syncHangup]\x20%s',_0x22d9ed[_0x3b2d('0x35')]);}};Acw[_0x3b2d('0x1b')][_0x3b2d('0x15')]=function(_0x255d7f){try{if(!_[_0x3b2d('0x46')](this[_0x3b2d('0xb')][_0x255d7f[_0x3b2d('0x47')]])){this['startAcw'](_0x255d7f['transfereeuniqueid']);if(this[_0x3b2d('0xb')][_0x255d7f[_0x3b2d('0x48')]]){this[_0x3b2d('0xb')][_0x255d7f[_0x3b2d('0x48')]][_0x3b2d('0x3e')]=!![];this[_0x3b2d('0xb')][_0x255d7f[_0x3b2d('0x49')]]=this[_0x3b2d('0xb')][_0x255d7f['secondtransfereruniqueid']];delete this['channels'][_0x255d7f['secondtransfereruniqueid']];}}else if(!_[_0x3b2d('0x46')](this['channels'][_0x255d7f[_0x3b2d('0x49')]])){this[_0x3b2d('0x42')](_0x255d7f[_0x3b2d('0x49')]);if(this['channels'][_0x255d7f['origtransfereruniqueid']]){this['channels'][_0x255d7f[_0x3b2d('0x4a')]][_0x3b2d('0x3e')]=!![];this[_0x3b2d('0xb')][_0x255d7f['transfereeuniqueid']]=this[_0x3b2d('0xb')][_0x255d7f[_0x3b2d('0x4a')]];delete this[_0x3b2d('0xb')][_0x255d7f[_0x3b2d('0x4a')]];}}}catch(_0x36cb96){logger['error'](_0x3b2d('0x4b'),_0x36cb96['message']);}};Acw[_0x3b2d('0x1b')]['syncBlindTransfer']=function(_0x4f0558){try{if(this[_0x3b2d('0xb')][_0x4f0558[_0x3b2d('0x4c')]]){logger[_0x3b2d('0x37')](_0x3b2d('0x4d'),JSON[_0x3b2d('0x39')](_0x4f0558[_0x3b2d('0x4c')]));this[_0x3b2d('0x42')](_0x4f0558[_0x3b2d('0x4c')]);}else if(this[_0x3b2d('0xb')][_0x4f0558[_0x3b2d('0x4e')]]){logger[_0x3b2d('0x37')]('[%s][BLINDTRANSFER:LINKEDID]',JSON['stringify'](_0x4f0558[_0x3b2d('0x4e')]));this[_0x3b2d('0x42')](_0x4f0558[_0x3b2d('0x4e')]);}}catch(_0x14587d){logger['error'](_0x3b2d('0x4f'),_0x14587d['message']);}};Acw[_0x3b2d('0x1b')][_0x3b2d('0x13')]=function(_0xae77b8){try{if(this[_0x3b2d('0x8')][_0xae77b8[_0x3b2d('0x1d')]]&&this[_0x3b2d('0x8')][_0xae77b8[_0x3b2d('0x1d')]][_0x3b2d('0x50')]==='all'){if(this[_0x3b2d('0x9')][_0xae77b8['interface']]){logger[_0x3b2d('0x37')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0xae77b8[_0x3b2d('0x2d')],_0xae77b8[_0x3b2d('0x1c')],_0xae77b8[_0x3b2d('0x1d')]);return RpcUser['savePause'](this['agents'][_0xae77b8['interface']],_0x3b2d('0x51'),_0xae77b8[_0x3b2d('0x2d')]);}}}catch(_0x2953f6){logger[_0x3b2d('0x31')](_0x3b2d('0x52'),_0x2953f6[_0x3b2d('0x35')]);}};module['exports']=Acw; \ No newline at end of file +var _0x4c0e=['isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','catch','finally','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s'];(function(_0x5c454f,_0x222f97){var _0x51d136=function(_0x99a5f9){while(--_0x99a5f9){_0x5c454f['push'](_0x5c454f['shift']());}};_0x51d136(++_0x222f97);}(_0x4c0e,0x117));var _0xe4c0=function(_0x411b75,_0x4de4ca){_0x411b75=_0x411b75-0x0;var _0x5a9239=_0x4c0e[_0x411b75];return _0x5a9239;};'use strict';var util=require(_0xe4c0('0x0'));var _=require(_0xe4c0('0x1'));var moment=require(_0xe4c0('0x2'));var ami=require(_0xe4c0('0x3'));var logger=require('../../../config/logger')(_0xe4c0('0x4'));var RpcUser=require(_0xe4c0('0x5'));var RpcVoiceAgentReport=require(_0xe4c0('0x6'));function Acw(_0x3cb652){this[_0xe4c0('0x7')]=_0x3cb652[_0xe4c0('0x7')];this['agents']=_0x3cb652[_0xe4c0('0x8')];this[_0xe4c0('0x9')]=_0x3cb652['timers'];this[_0xe4c0('0xa')]={};ami['on'](_0xe4c0('0xb'),this[_0xe4c0('0xc')][_0xe4c0('0xd')](this));ami['on'](_0xe4c0('0xe'),this['syncHangupRequest'][_0xe4c0('0xd')](this));ami['on']('hangup',this[_0xe4c0('0xf')][_0xe4c0('0xd')](this));ami['on'](_0xe4c0('0x10'),this[_0xe4c0('0x11')][_0xe4c0('0xd')](this));ami['on'](_0xe4c0('0x12'),this[_0xe4c0('0x13')][_0xe4c0('0xd')](this));ami['on'](_0xe4c0('0x14'),this[_0xe4c0('0x15')]['bind'](this));ami['on'](_0xe4c0('0x16'),this[_0xe4c0('0x17')][_0xe4c0('0xd')](this));}function getDiff(_0x569693){var _0x1303b0=moment()[_0xe4c0('0x18')](0x0);var _0x55a4e6=moment(_0x569693)[_0xe4c0('0x18')](0x0);return _0x1303b0[_0xe4c0('0x19')](_0x55a4e6,_0xe4c0('0x1a'));}Acw[_0xe4c0('0x1b')]['startAcw']=function(_0x3c8199){try{var _0x4e5f7b=this;var _0x29e459=this[_0xe4c0('0xa')][_0x3c8199][_0xe4c0('0x1c')];var _0x10769a=this[_0xe4c0('0xa')][_0x3c8199][_0xe4c0('0x1d')];var _0x2f374b=this[_0xe4c0('0x7')][_0x10769a];var _0x45bc70=![];var _0x31d1f0=_0xe4c0('0x1e');if(_0x2f374b[_0xe4c0('0x1f')]){if(_0x2f374b[_0xe4c0('0x20')][_0xe4c0('0x21')]){_0x45bc70=!![];_0x31d1f0=_0x2f374b[_0xe4c0('0x20')]['name'];}}ami['Action']({'action':_0xe4c0('0x22'),'interface':_0x29e459,'paused':!![],'reason':_0x31d1f0})[_0xe4c0('0x23')](function(_0x1e2979){if(_0x4e5f7b[_0xe4c0('0x8')][_0x29e459]){return RpcUser[_0xe4c0('0x24')](_0x4e5f7b[_0xe4c0('0x8')][_0x29e459]['id'])[_0xe4c0('0x23')](function(_0x3f2906){if(_0x3f2906&&!_0x3f2906[_0xe4c0('0x25')]){logger['info'](_0xe4c0('0x26'),_0x3c8199,_0x29e459,_0x10769a);var _0x560214=_0x4e5f7b[_0xe4c0('0xa')][_0x3c8199]['attended']&&_0x4e5f7b[_0xe4c0('0xa')][_0x3c8199][_0xe4c0('0x27')]?_0x4e5f7b[_0xe4c0('0xa')][_0x3c8199][_0xe4c0('0x27')]:_0x3c8199;return RpcUser[_0xe4c0('0x28')](_0x4e5f7b[_0xe4c0('0x8')][_0x29e459],_0x31d1f0,_0x560214)[_0xe4c0('0x23')](function(_0x1371af){if(!_0x45bc70){_0x4e5f7b[_0xe4c0('0x9')][_0x29e459]={};logger[_0xe4c0('0x29')](_0xe4c0('0x2a'),_0x3c8199,_0x4e5f7b['voiceQueues'][_0x10769a][_0xe4c0('0x2b')],_0x29e459,_0x10769a);_0x4e5f7b[_0xe4c0('0x9')][_0x29e459][_0xe4c0('0x2c')]=setTimeout(_0x4e5f7b[_0xe4c0('0x2d')][_0xe4c0('0xd')](_0x4e5f7b,_0x29e459),_0x4e5f7b[_0xe4c0('0x7')][_0x10769a][_0xe4c0('0x2b')]*0x3e8);_0x4e5f7b[_0xe4c0('0x9')][_0x29e459][_0xe4c0('0x2e')]=moment()[_0xe4c0('0x2f')](_0xe4c0('0x30'));_0x4e5f7b[_0xe4c0('0x9')][_0x29e459][_0xe4c0('0x31')]=_0x3c8199;_0x4e5f7b[_0xe4c0('0x9')][_0x29e459][_0xe4c0('0x1d')]=_0x10769a;_0x4e5f7b[_0xe4c0('0x9')][_0x29e459][_0xe4c0('0x32')]=function(){var _0x2da6bd=getDiff(_0x4e5f7b[_0xe4c0('0x9')][_0x29e459][_0xe4c0('0x2e')]);clearTimeout(_0x4e5f7b[_0xe4c0('0x9')][_0x29e459][_0xe4c0('0x2c')]);_0x4e5f7b[_0xe4c0('0x9')][_0x29e459]['timer']=![];RpcVoiceAgentReport[_0xe4c0('0x33')]({'acwtime':_0x2da6bd},_0x4e5f7b[_0xe4c0('0x9')][_0x29e459]['uniqueid'],_0x29e459)[_0xe4c0('0x23')](function(_0x443513){logger['info'](_0xe4c0('0x34'),_0x3c8199,_0x2da6bd,_0x443513);})['catch'](function(_0x3402a2){logger[_0xe4c0('0x35')](_0xe4c0('0x36'),_0x3c8199,_0x3402a2);});delete _0x4e5f7b[_0xe4c0('0x9')][_0x29e459];};}});}else{logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x3c8199,_0x29e459,_0x10769a);}});}})[_0xe4c0('0x37')](function(_0x43632c){logger[_0xe4c0('0x35')](_0xe4c0('0x2a'),_0x3c8199,_0x4e5f7b[_0xe4c0('0x7')][_0x10769a]['acwTimeout'],_0x29e459,_0x10769a);})[_0xe4c0('0x38')](function(){delete _0x4e5f7b['channels'][_0x3c8199];});}catch(_0x458601){logger[_0xe4c0('0x35')]('[ACW][START]\x20%s',_0x458601[_0xe4c0('0x39')]);}};Acw[_0xe4c0('0x1b')][_0xe4c0('0x2d')]=function(_0x3262fc){try{var _0x3988b9=this;if(_0x3988b9[_0xe4c0('0x9')][_0x3262fc]){_0x3988b9[_0xe4c0('0x9')][_0x3262fc]['timer']=![];var _0x5676af=_0x3988b9[_0xe4c0('0x9')][_0x3262fc][_0xe4c0('0x31')];var _0xe73698=_0x3988b9[_0xe4c0('0x9')][_0x3262fc]['queue'];var _0x37efb7=_0x3988b9[_0xe4c0('0x7')][_0xe73698][_0xe4c0('0x2b')];logger['info'](_0xe4c0('0x3a'),_0x5676af,_0x3262fc);RpcUser[_0xe4c0('0x3b')](this[_0xe4c0('0x8')][_0x3262fc]);RpcVoiceAgentReport[_0xe4c0('0x33')]({'acwtime':_0x37efb7,'agentacw':!![]},_0x5676af,_0x3262fc)[_0xe4c0('0x23')](function(_0xca5b48){logger[_0xe4c0('0x29')](_0xe4c0('0x34'),_0x5676af,_0x37efb7,_0xca5b48);})[_0xe4c0('0x37')](function(_0x543b03){logger[_0xe4c0('0x35')]('[%s][UPDATE][ERRORS:%s]',_0x5676af,_0x543b03);});}else{logger[_0xe4c0('0x35')](_0xe4c0('0x3c'),_0x3262fc);if(_0x3988b9[_0xe4c0('0x9')]){logger[_0xe4c0('0x29')](_0xe4c0('0x3d'),JSON[_0xe4c0('0x3e')](_0x3988b9[_0xe4c0('0x9')]));}}}catch(_0x47a100){logger['error'](_0xe4c0('0x3f'),_0x47a100[_0xe4c0('0x39')]);}};Acw['prototype'][_0xe4c0('0xc')]=function(_0x160391){try{if(this[_0xe4c0('0x7')][_0x160391['queue']]&&(this[_0xe4c0('0x7')][_0x160391['queue']]['acw']||this['voiceQueues'][_0x160391['queue']]['mandatoryDisposition'])){if(this[_0xe4c0('0x8')][_0x160391['interface']]){this[_0xe4c0('0xa')][_0x160391[_0xe4c0('0x31')]]={'queue':_0x160391['queue'],'interface':_0x160391['interface'],'destlinkedid':_0x160391[_0xe4c0('0x27')]};}}}catch(_0x581e7a){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x581e7a[_0xe4c0('0x39')]);}};Acw[_0xe4c0('0x1b')][_0xe4c0('0x17')]=function(_0x20d954){try{if(this[_0xe4c0('0x7')][_0x20d954['queue']]&&(this['voiceQueues'][_0x20d954[_0xe4c0('0x1d')]][_0xe4c0('0x4')]||this[_0xe4c0('0x7')][_0x20d954[_0xe4c0('0x1d')]][_0xe4c0('0x1f')])){if(this[_0xe4c0('0x8')][_0x20d954[_0xe4c0('0x1c')]]){this[_0xe4c0('0xa')][_0x20d954[_0xe4c0('0x31')]]={'queue':_0x20d954[_0xe4c0('0x1d')],'interface':_0x20d954[_0xe4c0('0x1c')]};}}}catch(_0x2bc1e3){logger[_0xe4c0('0x35')](_0xe4c0('0x40'),_0x2bc1e3[_0xe4c0('0x39')]);}};Acw[_0xe4c0('0x1b')]['syncHangupRequest']=function(_0x501c3f){try{if(this[_0xe4c0('0xa')][_0x501c3f[_0xe4c0('0x31')]]&&_[_0xe4c0('0x41')](this['channels'][_0x501c3f[_0xe4c0('0x31')]][_0xe4c0('0x42')])){logger[_0xe4c0('0x29')](_0xe4c0('0x43'),_0x501c3f[_0xe4c0('0x31')]);this[_0xe4c0('0x44')](_0x501c3f[_0xe4c0('0x31')]);}else if(this[_0xe4c0('0xa')][_0x501c3f[_0xe4c0('0x45')]]&&_[_0xe4c0('0x41')](this['channels'][_0x501c3f[_0xe4c0('0x45')]][_0xe4c0('0x42')])){logger['info']('[%s][HANGUP:LINKEDID]',_0x501c3f[_0xe4c0('0x45')]);this[_0xe4c0('0x44')](_0x501c3f[_0xe4c0('0x45')]);}}catch(_0x44c7a8){logger['error'](_0xe4c0('0x46'),_0x44c7a8[_0xe4c0('0x39')]);}};Acw[_0xe4c0('0x1b')]['syncHangup']=function(_0x3ad2ad){try{if(this[_0xe4c0('0xa')][_0x3ad2ad[_0xe4c0('0x31')]]&&this['channels'][_0x3ad2ad[_0xe4c0('0x31')]][_0xe4c0('0x42')]){logger[_0xe4c0('0x29')](_0xe4c0('0x47'),_0x3ad2ad[_0xe4c0('0x31')]);this[_0xe4c0('0x44')](_0x3ad2ad[_0xe4c0('0x31')]);}else if(this[_0xe4c0('0xa')][_0x3ad2ad[_0xe4c0('0x45')]]&&this[_0xe4c0('0xa')][_0x3ad2ad['linkedid']]['attended']){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x3ad2ad[_0xe4c0('0x45')]);this[_0xe4c0('0x44')](_0x3ad2ad[_0xe4c0('0x45')]);}}catch(_0x4927ed){logger['error'](_0xe4c0('0x48'),_0x4927ed[_0xe4c0('0x39')]);}};Acw[_0xe4c0('0x1b')][_0xe4c0('0x13')]=function(_0x3d5e70){try{if(!_[_0xe4c0('0x49')](this[_0xe4c0('0xa')][_0x3d5e70[_0xe4c0('0x4a')]])){this['startAcw'](_0x3d5e70['transfereeuniqueid']);if(this['channels'][_0x3d5e70[_0xe4c0('0x4b')]]){this['channels'][_0x3d5e70['secondtransfereruniqueid']][_0xe4c0('0x42')]=!![];this[_0xe4c0('0xa')][_0x3d5e70[_0xe4c0('0x4c')]]=this[_0xe4c0('0xa')][_0x3d5e70[_0xe4c0('0x4b')]];delete this[_0xe4c0('0xa')][_0x3d5e70[_0xe4c0('0x4b')]];}}else if(!_[_0xe4c0('0x49')](this[_0xe4c0('0xa')][_0x3d5e70[_0xe4c0('0x4c')]])){this[_0xe4c0('0x44')](_0x3d5e70['transfertargetuniqueid']);if(this[_0xe4c0('0xa')][_0x3d5e70[_0xe4c0('0x4d')]]){this[_0xe4c0('0xa')][_0x3d5e70['origtransfereruniqueid']][_0xe4c0('0x42')]=!![];this['channels'][_0x3d5e70[_0xe4c0('0x4a')]]=this[_0xe4c0('0xa')][_0x3d5e70['origtransfereruniqueid']];delete this[_0xe4c0('0xa')][_0x3d5e70['origtransfereruniqueid']];}}}catch(_0x125755){logger[_0xe4c0('0x35')]('[ACW][syncAttendedTransfer]\x20%s',_0x125755[_0xe4c0('0x39')]);}};Acw[_0xe4c0('0x1b')][_0xe4c0('0x15')]=function(_0x43002e){try{if(this['channels'][_0x43002e[_0xe4c0('0x4e')]]){logger[_0xe4c0('0x29')](_0xe4c0('0x4f'),JSON['stringify'](_0x43002e[_0xe4c0('0x4e')]));this[_0xe4c0('0x44')](_0x43002e[_0xe4c0('0x4e')]);}else if(this['channels'][_0x43002e[_0xe4c0('0x50')]]){logger[_0xe4c0('0x29')](_0xe4c0('0x51'),JSON[_0xe4c0('0x3e')](_0x43002e[_0xe4c0('0x50')]));this[_0xe4c0('0x44')](_0x43002e[_0xe4c0('0x50')]);}}catch(_0x4a2998){logger['error'](_0xe4c0('0x52'),_0x4a2998[_0xe4c0('0x39')]);}};Acw[_0xe4c0('0x1b')][_0xe4c0('0x11')]=function(_0x58ffb9){try{if(this[_0xe4c0('0x7')][_0x58ffb9[_0xe4c0('0x1d')]]&&this[_0xe4c0('0x7')][_0x58ffb9['queue']][_0xe4c0('0x53')]===_0xe4c0('0x54')){if(this[_0xe4c0('0x8')][_0x58ffb9[_0xe4c0('0x1c')]]){logger[_0xe4c0('0x29')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x58ffb9[_0xe4c0('0x31')],_0x58ffb9[_0xe4c0('0x1c')],_0x58ffb9['queue']);return RpcUser['savePause'](this[_0xe4c0('0x8')][_0x58ffb9[_0xe4c0('0x1c')]],_0xe4c0('0x55'),_0x58ffb9[_0xe4c0('0x31')]);}}}catch(_0x4c8a8b){logger[_0xe4c0('0x35')](_0xe4c0('0x56'),_0x4c8a8b[_0xe4c0('0x39')]);}};module[_0xe4c0('0x57')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 6f8f898..1d7bd0f 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 _0x0b29=['Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','actionQueueSummary','actionCoreShowChannels','log','once','close','asterisk-manager','util','lodash','../../config/logger','ami','../../config/environment','port','asterisk','username','password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','info'];(function(_0x2042a4,_0x16f91e){var _0x233995=function(_0x3a864f){while(--_0x3a864f){_0x2042a4['push'](_0x2042a4['shift']());}};_0x233995(++_0x16f91e);}(_0x0b29,0xcb));var _0x90b2=function(_0x51bdd4,_0x29b4be){_0x51bdd4=_0x51bdd4-0x0;var _0x1d3a75=_0x0b29[_0x51bdd4];return _0x1d3a75;};'use strict';var Manager=require(_0x90b2('0x0'));var BPromise=require('bluebird');var moment=require('moment');var util=require(_0x90b2('0x1'));var _=require(_0x90b2('0x2'));var logger=require(_0x90b2('0x3'))(_0x90b2('0x4'));var config=require(_0x90b2('0x5'));var ami=new Manager(config['asterisk'][_0x90b2('0x6')],config[_0x90b2('0x7')]['ip'],config[_0x90b2('0x7')][_0x90b2('0x8')],config[_0x90b2('0x7')][_0x90b2('0x9')],!![]);ami[_0x90b2('0xa')]();ami['Action']=BPromise[_0x90b2('0xb')](ami[_0x90b2('0xc')]);function error(_0x3a1fb8){logger[_0x90b2('0xd')](util[_0x90b2('0xe')](_0x90b2('0xf'),config[_0x90b2('0x7')][_0x90b2('0x8')],config[_0x90b2('0x7')]['ip'],config[_0x90b2('0x7')][_0x90b2('0x6')],util[_0x90b2('0x10')](_0x3a1fb8,![],null)));}function close(){logger[_0x90b2('0xd')](util['format'](_0x90b2('0x11'),config[_0x90b2('0x7')][_0x90b2('0x8')],config[_0x90b2('0x7')]['ip'],config[_0x90b2('0x7')]['port']));}ami[_0x90b2('0x12')]=function(){return function(){return ami[_0x90b2('0x13')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x90b2('0x13')]({'action':_0x90b2('0x14')});};};ami[_0x90b2('0x15')]=function(){return function(){return ami[_0x90b2('0x13')]({'action':_0x90b2('0x16')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x90b2('0x13')]({'action':_0x90b2('0x17')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x90b2('0x13')]({'action':'coreshowchannels'});};};function connect(_0x1a17b0){logger[_0x90b2('0x18')](util['format'](_0x90b2('0x19'),config['asterisk'][_0x90b2('0x8')],config['asterisk']['ip'],config[_0x90b2('0x7')][_0x90b2('0x6')]));ami['once']('error',error);ami['once']('close',close);}ami['on']('connect',connect);ami['on'](_0x90b2('0x1a'),function(_0x1163e8){logger['info'](util['format'](_0x90b2('0x1b'),config[_0x90b2('0x7')]['username'],config[_0x90b2('0x7')]['ip'],config[_0x90b2('0x7')][_0x90b2('0x6')],util[_0x90b2('0x10')](_0x1163e8,![],null)));});ami['on'](_0x90b2('0x1c'),function(_0x4852cf){logger['info'](util[_0x90b2('0xe')](_0x90b2('0x1d'),config[_0x90b2('0x7')]['username'],config[_0x90b2('0x7')]['ip'],config[_0x90b2('0x7')][_0x90b2('0x6')]));return BPromise[_0x90b2('0x1e')]()[_0x90b2('0x1f')](ami[_0x90b2('0x12')]())[_0x90b2('0x1f')](ami[_0x90b2('0x20')]())[_0x90b2('0x1f')](ami[_0x90b2('0x15')]())[_0x90b2('0x1f')](ami[_0x90b2('0x21')]())[_0x90b2('0x1f')](ami[_0x90b2('0x22')]())['catch'](function(_0x2be19b){console[_0x90b2('0x23')](_0x2be19b);});});ami[_0x90b2('0x24')]('error',error);ami[_0x90b2('0x24')](_0x90b2('0x25'),close);module['exports']=ami; \ No newline at end of file +var _0x337d=['log','asterisk-manager','bluebird','moment','lodash','../../config/environment','port','asterisk','username','keepConnected','Action','promisify','action','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','error','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','resolve','then'];(function(_0x3f45e7,_0xf44cbb){var _0x8ddff0=function(_0xd03649){while(--_0xd03649){_0x3f45e7['push'](_0x3f45e7['shift']());}};_0x8ddff0(++_0xf44cbb);}(_0x337d,0x199));var _0xd337=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x337d[_0x126558];return _0x1f6d14;};'use strict';var Manager=require(_0xd337('0x0'));var BPromise=require(_0xd337('0x1'));var moment=require(_0xd337('0x2'));var util=require('util');var _=require(_0xd337('0x3'));var logger=require('../../config/logger')('ami');var config=require(_0xd337('0x4'));var ami=new Manager(config['asterisk'][_0xd337('0x5')],config[_0xd337('0x6')]['ip'],config[_0xd337('0x6')][_0xd337('0x7')],config[_0xd337('0x6')]['password'],!![]);ami[_0xd337('0x8')]();ami[_0xd337('0x9')]=BPromise[_0xd337('0xa')](ami[_0xd337('0xb')]);function error(_0x36039d){logger['error'](util['format'](_0xd337('0xc'),config[_0xd337('0x6')][_0xd337('0x7')],config[_0xd337('0x6')]['ip'],config['asterisk'][_0xd337('0x5')],util['inspect'](_0x36039d,![],null)));}function close(){logger[_0xd337('0xd')](util[_0xd337('0xe')](_0xd337('0xf'),config[_0xd337('0x6')][_0xd337('0x7')],config['asterisk']['ip'],config['asterisk'][_0xd337('0x5')]));}ami[_0xd337('0x10')]=function(){return function(){return ami['Action']({'action':_0xd337('0x11')});};};ami[_0xd337('0x12')]=function(){return function(){return ami[_0xd337('0x9')]({'action':_0xd337('0x13')});};};ami[_0xd337('0x14')]=function(){return function(){return ami[_0xd337('0x9')]({'action':'sippeerstatus'});};};ami['actionQueueSummary']=function(){return function(){return ami[_0xd337('0x9')]({'action':'queuesummary'});};};ami[_0xd337('0x15')]=function(){return function(){return ami[_0xd337('0x9')]({'action':_0xd337('0x16')});};};function connect(_0x55f641){logger[_0xd337('0x17')](util[_0xd337('0xe')](_0xd337('0x18'),config['asterisk'][_0xd337('0x7')],config[_0xd337('0x6')]['ip'],config['asterisk'][_0xd337('0x5')]));ami['once'](_0xd337('0xd'),error);ami[_0xd337('0x19')](_0xd337('0x1a'),close);}ami['on'](_0xd337('0x1b'),connect);ami['on'](_0xd337('0x1c'),function(_0x4b2826){logger[_0xd337('0x17')](util['format'](_0xd337('0x1d'),config[_0xd337('0x6')][_0xd337('0x7')],config[_0xd337('0x6')]['ip'],config[_0xd337('0x6')][_0xd337('0x5')],util[_0xd337('0x1e')](_0x4b2826,![],null)));});ami['on']('fullybooted',function(_0x1a91a4){logger[_0xd337('0x17')](util[_0xd337('0xe')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk'][_0xd337('0x7')],config[_0xd337('0x6')]['ip'],config[_0xd337('0x6')][_0xd337('0x5')]));return BPromise[_0xd337('0x1f')]()[_0xd337('0x20')](ami[_0xd337('0x10')]())[_0xd337('0x20')](ami[_0xd337('0x12')]())[_0xd337('0x20')](ami[_0xd337('0x14')]())[_0xd337('0x20')](ami['actionQueueSummary']())[_0xd337('0x20')](ami[_0xd337('0x15')]())['catch'](function(_0x5f4f28){console[_0xd337('0x21')](_0x5f4f28);});});ami[_0xd337('0x19')](_0xd337('0xd'),error);ami[_0xd337('0x19')](_0xd337('0x1a'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 5421254..b80bdc9 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 _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x591a90,_0x5525b0){var _0x551587=function(_0xd6ad8e){while(--_0xd6ad8e){_0x591a90['push'](_0x591a90['shift']());}};_0x551587(++_0x5525b0);}(_0xac4a,0x13f));var _0xaac4=function(_0x23ee7f,_0x4308a9){_0x23ee7f=_0x23ee7f-0x0;var _0x5a5cc9=_0xac4a[_0x23ee7f];return _0x5a5cc9;};'use strict';var jayson=require(_0xaac4('0x0'));var BPromise=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var client=jayson[_0xaac4('0x4')][_0xaac4('0x5')]({'port':0x2329});client['Request']=function(_0x58626e,_0x2af0f6){return new BPromise(function(_0x2a5762,_0x32d34c){return client['request'](_0x58626e,_0x2af0f6)[_0xaac4('0x6')](function(_0x53d03a){logger[_0xaac4('0x7')]('rpc',_0xaac4('0x8'),_0x58626e,_0x2af0f6,_0x53d03a);if(_0x53d03a[_0xaac4('0x9')]){logger['error']('rpc',_0xaac4('0x8'),_0x58626e,_0x53d03a['error'][_0xaac4('0xa')],_0x2af0f6);return _0x32d34c(_0x53d03a['error']['message']);}else{return _0x2a5762(_0x53d03a[_0xaac4('0xb')]);}})[_0xaac4('0xc')](function(_0x38d1d0){logger[_0xaac4('0x9')](_0xaac4('0xd'),'memberReport',_0x58626e,_0x38d1d0,_0x2af0f6);return _0x32d34c(_0x38d1d0);});});};module['exports']=client; \ No newline at end of file +var _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x4884a7,_0x18e38a){var _0x56b60e=function(_0x2ba8a3){while(--_0x2ba8a3){_0x4884a7['push'](_0x4884a7['shift']());}};_0x56b60e(++_0x18e38a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xb7e7[_0x1ccdf7];return _0x52a0ae;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 6e26bb5..b4daa6d 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 _0x748e=['countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','format','dialCutDigit','substring','number','prototype','getQueue','exports','util','lodash','isNil','string','voiceQueue','uniqueid','name','Contact','lastName','phone','queue','active','type','dialQueueTimeout','scheduledat'];(function(_0x219ca1,_0x3ca23b){var _0x3360e9=function(_0x187b39){while(--_0x187b39){_0x219ca1['push'](_0x219ca1['shift']());}};_0x3360e9(++_0x3ca23b);}(_0x748e,0x1eb));var _0xe748=function(_0x36d5d5,_0x1c1590){_0x36d5d5=_0x36d5d5-0x0;var _0x4eaa56=_0x748e[_0x36d5d5];return _0x4eaa56;};'use strict';var util=require(_0xe748('0x0'));var _=require(_0xe748('0x1'));var moment=require('moment');function checkNameSurname(_0x26c681,_0x3ffd3a,_0x409df8){var _0xa7bdf1='';if(!_[_0xe748('0x2')](_0x3ffd3a)&&_0xe748('0x3')===typeof _0x3ffd3a){_0xa7bdf1+=_0x3ffd3a;}if(!_[_0xe748('0x2')](_0x409df8)&&_0xe748('0x3')===typeof _0x409df8){_0xa7bdf1+='\x20'+_0x409df8;}if(_0xa7bdf1!==''){return _0xa7bdf1;}return _0x26c681;}function Action(_0x37c1f7,_0x4f9d90,_0x141126){this[_0xe748('0x4')]=_0x37c1f7;this[_0xe748('0x5')]=_0x141126||undefined;this[_0xe748('0x6')]=checkNameSurname(_0x4f9d90[_0xe748('0x7')]['phone'],_0x4f9d90[_0xe748('0x7')]['firstName'],_0x4f9d90[_0xe748('0x7')][_0xe748('0x8')]);this['number']=_0x4f9d90['Contact'][_0xe748('0x9')];this[_0xe748('0xa')]=_0x37c1f7[_0xe748('0x6')];this[_0xe748('0xb')]=_0x4f9d90[_0xe748('0xb')]||![];this['type']=_0x37c1f7[_0xe748('0xc')];this[_0xe748('0xd')]=_0x37c1f7['dialQueueTimeout']||0x3;this[_0xe748('0xe')]=_0x4f9d90[_0xe748('0xe')];this[_0xe748('0xf')]=_0x4f9d90['countbusyretry'];this[_0xe748('0x10')]=_0x4f9d90[_0xe748('0x10')];this[_0xe748('0x11')]=_0x4f9d90[_0xe748('0x11')];this['countnosuchnumberretry']=_0x4f9d90[_0xe748('0x12')];this[_0xe748('0x13')]=_0x4f9d90['countdropretry'];this[_0xe748('0x14')]=_0x4f9d90[_0xe748('0x14')];this['countmachineretry']=_0x4f9d90[_0xe748('0x15')];this[_0xe748('0x16')]=_0x4f9d90[_0xe748('0x16')];this[_0xe748('0x17')]=_0x4f9d90[_0xe748('0x17')];this['ListId']=_0x4f9d90[_0xe748('0x18')];this[_0xe748('0x19')]=_0x4f9d90[_0xe748('0x19')];this[_0xe748('0x1a')]=_0x4f9d90[_0xe748('0x1a')];this[_0xe748('0x1b')]=_0x4f9d90['CampaignId'];this[_0xe748('0x1c')]=_0x4f9d90['id'];this[_0xe748('0x1d')]=_0x4f9d90[_0xe748('0x7')][_0xe748('0x1e')]||'';this['starttime']=moment()['format'](_0xe748('0x1f'));this[_0xe748('0x20')]=_0x4f9d90['callback'];this[_0xe748('0x21')]=_0x4f9d90['callbackuniqueid'];this[_0xe748('0x22')]=_0x4f9d90[_0xe748('0x22')];this['recallme']=_0x4f9d90[_0xe748('0x23')];this[_0xe748('0x24')]='';this[_0xe748('0x25')]='';}Action['prototype'][_0xe748('0x26')]=function(){return util[_0xe748('0x27')]('\x22%s\x22\x20<%s>',this[_0xe748('0x6')],this[_0xe748('0x4')][_0xe748('0x28')]>0x0?this['number'][_0xe748('0x29')](this['voiceQueue']['dialCutDigit']):this[_0xe748('0x2a')]);};Action[_0xe748('0x2b')][_0xe748('0x2c')]=function(){return this['queue'];};module[_0xe748('0x2d')]=Action; \ No newline at end of file +var _0x9599=['firstName','lastName','phone','queue','name','active','type','dialQueueTimeout','scheduledat','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','voiceQueue','dialCutDigit','number','substring','exports','util','lodash','moment','isNil','uniqueid','Contact'];(function(_0x3a5061,_0x17cb02){var _0x310beb=function(_0x68fdb1){while(--_0x68fdb1){_0x3a5061['push'](_0x3a5061['shift']());}};_0x310beb(++_0x17cb02);}(_0x9599,0xfc));var _0x9959=function(_0x30ebbd,_0x3f51d8){_0x30ebbd=_0x30ebbd-0x0;var _0xc3b968=_0x9599[_0x30ebbd];return _0xc3b968;};'use strict';var util=require(_0x9959('0x0'));var _=require(_0x9959('0x1'));var moment=require(_0x9959('0x2'));function checkNameSurname(_0x10a1a4,_0x3f89cc,_0x2cb072){var _0x5bac4c='';if(!_['isNil'](_0x3f89cc)&&'string'===typeof _0x3f89cc){_0x5bac4c+=_0x3f89cc;}if(!_[_0x9959('0x3')](_0x2cb072)&&'string'===typeof _0x2cb072){_0x5bac4c+='\x20'+_0x2cb072;}if(_0x5bac4c!==''){return _0x5bac4c;}return _0x10a1a4;}function Action(_0x4466c2,_0x38ae10,_0x5af652){this['voiceQueue']=_0x4466c2;this[_0x9959('0x4')]=_0x5af652||undefined;this['name']=checkNameSurname(_0x38ae10[_0x9959('0x5')]['phone'],_0x38ae10[_0x9959('0x5')][_0x9959('0x6')],_0x38ae10['Contact'][_0x9959('0x7')]);this['number']=_0x38ae10[_0x9959('0x5')][_0x9959('0x8')];this[_0x9959('0x9')]=_0x4466c2[_0x9959('0xa')];this[_0x9959('0xb')]=_0x38ae10[_0x9959('0xb')]||![];this[_0x9959('0xc')]=_0x4466c2[_0x9959('0xc')];this[_0x9959('0xd')]=_0x4466c2[_0x9959('0xd')]||0x3;this[_0x9959('0xe')]=_0x38ae10[_0x9959('0xe')];this['countbusyretry']=_0x38ae10['countbusyretry'];this['countcongestionretry']=_0x38ae10[_0x9959('0xf')];this[_0x9959('0x10')]=_0x38ae10[_0x9959('0x10')];this['countnosuchnumberretry']=_0x38ae10[_0x9959('0x11')];this[_0x9959('0x12')]=_0x38ae10[_0x9959('0x12')];this[_0x9959('0x13')]=_0x38ae10[_0x9959('0x13')];this['countmachineretry']=_0x38ae10[_0x9959('0x14')];this[_0x9959('0x15')]=_0x38ae10[_0x9959('0x15')];this[_0x9959('0x16')]=_0x38ae10[_0x9959('0x16')];this[_0x9959('0x17')]=_0x38ae10[_0x9959('0x17')];this[_0x9959('0x18')]=_0x38ae10['UserId'];this[_0x9959('0x19')]=_0x38ae10[_0x9959('0x19')];this[_0x9959('0x1a')]=_0x38ae10[_0x9959('0x1a')];this['idHopper']=_0x38ae10['id'];this[_0x9959('0x1b')]=_0x38ae10[_0x9959('0x5')][_0x9959('0x6')]||'';this['starttime']=moment()[_0x9959('0x1c')](_0x9959('0x1d'));this['callback']=_0x38ae10[_0x9959('0x1e')];this[_0x9959('0x1f')]=_0x38ae10['callbackuniqueid'];this[_0x9959('0x20')]=_0x38ae10[_0x9959('0x20')];this['recallme']=_0x38ae10[_0x9959('0x21')];this[_0x9959('0x22')]='';this[_0x9959('0x23')]='';}Action[_0x9959('0x24')][_0x9959('0x25')]=function(){return util[_0x9959('0x1c')]('\x22%s\x22\x20<%s>',this[_0x9959('0xa')],this[_0x9959('0x26')][_0x9959('0x27')]>0x0?this[_0x9959('0x28')][_0x9959('0x29')](this['voiceQueue']['dialCutDigit']):this[_0x9959('0x28')]);};Action[_0x9959('0x24')]['getQueue']=function(){return this[_0x9959('0x9')];};module[_0x9959('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 0b2e17d..82fa0a9 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 _0x29e4=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','queue','membername','reason','callback'];(function(_0x5ade57,_0x3fe0a7){var _0x3a4fb5=function(_0x2fc4b2){while(--_0x2fc4b2){_0x5ade57['push'](_0x5ade57['shift']());}};_0x3a4fb5(++_0x3fe0a7);}(_0x29e4,0x124));var _0x429e=function(_0x20626c,_0x11ee96){_0x20626c=_0x20626c-0x0;var _0x58a0db=_0x29e4[_0x20626c];return _0x58a0db;};'use strict';var util=require(_0x429e('0x0'));var _=require(_0x429e('0x1'));var moment=require(_0x429e('0x2'));function getSeconds(_0x2af970,_0x1a3e74){var _0x38f77b=moment(_0x2af970)['milliseconds'](0x0);var _0x1589fd=moment(_0x1a3e74)[_0x429e('0x3')](0x0);return _0x38f77b[_0x429e('0x4')](_0x1589fd,_0x429e('0x5'));}function AgentComplete(_0x429880,_0x108b47){this[_0x429e('0x6')]=0x4;this[_0x429e('0x7')]=_0x429e('0x8');this[_0x429e('0x9')]=_0x429880[_0x429e('0x9')];this['type']=_0x429880[_0x429e('0xa')];this['campaigntype']=_0x429880['type']===_0x429e('0xb')?'queue':_0x429880[_0x429e('0xa')];this['countbusyretry']=_0x429880[_0x429e('0xc')];this[_0x429e('0xd')]=_0x429880[_0x429e('0xd')];this[_0x429e('0xe')]=_0x429880['countnoanswerretry'];this[_0x429e('0xf')]=_0x429880['countbusyretry']+_0x429880[_0x429e('0xd')]+_0x429880[_0x429e('0xe')]+_0x429880['countnosuchnumberretry']+_0x429880[_0x429e('0x10')]+_0x429880[_0x429e('0x11')]+_0x429880['countmachineretry']+_0x429880[_0x429e('0x12')];this[_0x429e('0x13')]=_0x429880['countnosuchnumberretry'];this[_0x429e('0x10')]=_0x429880['countdropretry'];this['countabandonedretry']=_0x429880[_0x429e('0x11')];this[_0x429e('0x14')]=_0x429880[_0x429e('0x14')];this[_0x429e('0x12')]=_0x429880[_0x429e('0x12')];this[_0x429e('0x15')]=_0x108b47['uniqueid'];this[_0x429e('0x16')]=_0x429880[_0x429e('0x17')];this[_0x429e('0x18')]=_0x429880[_0x429e('0x19')];this[_0x429e('0x1a')]=_0x429880[_0x429e('0x1a')];this[_0x429e('0x1b')]=_0x429880[_0x429e('0x1b')];this['answertime']=_0x429880[_0x429e('0x1c')];this[_0x429e('0x1d')]=moment()['format'](_0x429e('0x1e'));this[_0x429e('0x1f')]=getSeconds(_0x429880[_0x429e('0x1b')],_0x429880[_0x429e('0x1a')]);this['holdtime']=getSeconds(_0x429880[_0x429e('0x1c')],_0x429880['responsetime']);this[_0x429e('0x20')]=getSeconds(this[_0x429e('0x1d')],_0x429880[_0x429e('0x1c')]);this[_0x429e('0x21')]=_0x108b47[_0x429e('0x21')];this[_0x429e('0x22')]=_0x108b47[_0x429e('0x22')];this[_0x429e('0x23')]=_0x108b47[_0x429e('0x23')];this[_0x429e('0x24')]=_0x429880[_0x429e('0x24')];this['callbackuniqueid']=_0x429880[_0x429e('0x25')];this[_0x429e('0x26')]=_0x429880[_0x429e('0x26')];this[_0x429e('0x27')]=_0x429880[_0x429e('0x27')];this['ContactId']=_0x429880[_0x429e('0x28')];this[_0x429e('0x29')]=_0x429880[_0x429e('0x29')];this[_0x429e('0x2a')]=_0x429880['UserId'];this['VoiceQueueId']=_0x429880[_0x429e('0x2b')];this['CampaignId']=_0x429880['CampaignId'];this['originatecalleridnum']=_0x429880[_0x429e('0x2c')]||'';this[_0x429e('0x2d')]=_0x429880[_0x429e('0x2d')]||'';}module[_0x429e('0x2e')]=AgentComplete; \ No newline at end of file +var _0xea98=['reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','lodash','moment','milliseconds','diff','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','number','starttime','responsetime','answertime','YYYY-MM-DD\x20HH:mm:ss','ringtime','endtime','membername'];(function(_0xcd496b,_0x2f1c5a){var _0x3f6160=function(_0x2e26b2){while(--_0x2e26b2){_0xcd496b['push'](_0xcd496b['shift']());}};_0x3f6160(++_0x2f1c5a);}(_0xea98,0x1c6));var _0x8ea9=function(_0x3e8cc8,_0x1d95f5){_0x3e8cc8=_0x3e8cc8-0x0;var _0x1554c7=_0xea98[_0x3e8cc8];return _0x1554c7;};'use strict';var util=require('util');var _=require(_0x8ea9('0x0'));var moment=require(_0x8ea9('0x1'));function getSeconds(_0x321e86,_0x2a3d03){var _0x47cc4d=moment(_0x321e86)[_0x8ea9('0x2')](0x0);var _0x434c09=moment(_0x2a3d03)[_0x8ea9('0x2')](0x0);return _0x47cc4d[_0x8ea9('0x3')](_0x434c09,'seconds');}function AgentComplete(_0x998317,_0x330d2f){this[_0x8ea9('0x4')]=0x4;this[_0x8ea9('0x5')]='Answer';this[_0x8ea9('0x6')]=_0x998317[_0x8ea9('0x6')];this[_0x8ea9('0x7')]=_0x998317[_0x8ea9('0x7')];this[_0x8ea9('0x8')]=_0x998317[_0x8ea9('0x7')]===_0x8ea9('0x9')?_0x8ea9('0xa'):_0x998317[_0x8ea9('0x7')];this['countbusyretry']=_0x998317[_0x8ea9('0xb')];this[_0x8ea9('0xc')]=_0x998317[_0x8ea9('0xc')];this[_0x8ea9('0xd')]=_0x998317[_0x8ea9('0xd')];this['countglobal']=_0x998317[_0x8ea9('0xb')]+_0x998317[_0x8ea9('0xc')]+_0x998317[_0x8ea9('0xd')]+_0x998317[_0x8ea9('0xe')]+_0x998317[_0x8ea9('0xf')]+_0x998317[_0x8ea9('0x10')]+_0x998317[_0x8ea9('0x11')]+_0x998317[_0x8ea9('0x12')];this[_0x8ea9('0xe')]=_0x998317[_0x8ea9('0xe')];this['countdropretry']=_0x998317[_0x8ea9('0xf')];this[_0x8ea9('0x10')]=_0x998317['countabandonedretry'];this['countmachineretry']=_0x998317[_0x8ea9('0x11')];this[_0x8ea9('0x12')]=_0x998317[_0x8ea9('0x12')];this['uniqueid']=_0x330d2f['uniqueid'];this['calleridname']=_0x998317['name'];this['calleridnum']=_0x998317[_0x8ea9('0x13')];this[_0x8ea9('0x14')]=_0x998317[_0x8ea9('0x14')];this[_0x8ea9('0x15')]=_0x998317[_0x8ea9('0x15')];this[_0x8ea9('0x16')]=_0x998317['answertime'];this['endtime']=moment()['format'](_0x8ea9('0x17'));this[_0x8ea9('0x18')]=getSeconds(_0x998317[_0x8ea9('0x15')],_0x998317[_0x8ea9('0x14')]);this['holdtime']=getSeconds(_0x998317[_0x8ea9('0x16')],_0x998317[_0x8ea9('0x15')]);this['talktime']=getSeconds(this[_0x8ea9('0x19')],_0x998317[_0x8ea9('0x16')]);this[_0x8ea9('0xa')]=_0x330d2f[_0x8ea9('0xa')];this[_0x8ea9('0x1a')]=_0x330d2f[_0x8ea9('0x1a')];this[_0x8ea9('0x1b')]=_0x330d2f[_0x8ea9('0x1b')];this[_0x8ea9('0x1c')]=_0x998317[_0x8ea9('0x1c')];this[_0x8ea9('0x1d')]=_0x998317[_0x8ea9('0x1d')];this[_0x8ea9('0x1e')]=_0x998317[_0x8ea9('0x1e')];this['recallme']=_0x998317[_0x8ea9('0x1f')];this['ContactId']=_0x998317[_0x8ea9('0x20')];this['ListId']=_0x998317[_0x8ea9('0x21')];this[_0x8ea9('0x22')]=_0x998317['UserId'];this[_0x8ea9('0x23')]=_0x998317[_0x8ea9('0x23')];this[_0x8ea9('0x24')]=_0x998317[_0x8ea9('0x24')];this['originatecalleridnum']=_0x998317['originatecalleridnum']||'';this['originatecalleridname']=_0x998317['originatecalleridname']||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 3946972..de0bbfc 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 _0x4ab0=['queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound'];(function(_0x52dbcb,_0x344f7e){var _0x10bfe4=function(_0x4685c5){while(--_0x4685c5){_0x52dbcb['push'](_0x52dbcb['shift']());}};_0x10bfe4(++_0x344f7e);}(_0x4ab0,0xd5));var _0x04ab=function(_0x65e977,_0x312209){_0x65e977=_0x65e977-0x0;var _0x29572e=_0x4ab0[_0x65e977];return _0x29572e;};'use strict';var util=require('util');var _=require(_0x04ab('0x0'));var moment=require(_0x04ab('0x1'));function getSeconds(_0x203005,_0x3d8417){var _0x3a7b9f=moment(_0x203005)['milliseconds'](0x0);var _0x4c3a53=moment(_0x3d8417)[_0x04ab('0x2')](0x0);return _0x3a7b9f[_0x04ab('0x3')](_0x4c3a53,'seconds');}function Final(_0xfe58ca){this[_0x04ab('0x4')]=_0xfe58ca['uniqueid'];this[_0x04ab('0x5')]=_0xfe58ca[_0x04ab('0x5')];this[_0x04ab('0x6')]=_0xfe58ca['type'];this[_0x04ab('0x7')]=_0xfe58ca[_0x04ab('0x6')]===_0x04ab('0x8')?_0x04ab('0x9'):_0xfe58ca['type'];this[_0x04ab('0xa')]=_0xfe58ca[_0x04ab('0xa')];this[_0x04ab('0xb')]=_0xfe58ca[_0x04ab('0xb')];this['countnoanswerretry']=_0xfe58ca[_0x04ab('0xc')];this[_0x04ab('0xd')]=_0xfe58ca[_0x04ab('0xa')]+_0xfe58ca[_0x04ab('0xb')]+_0xfe58ca[_0x04ab('0xc')]+_0xfe58ca[_0x04ab('0xe')]+_0xfe58ca['countdropretry']+_0xfe58ca[_0x04ab('0xf')]+_0xfe58ca['countmachineretry']+_0xfe58ca[_0x04ab('0x10')];this[_0x04ab('0xe')]=_0xfe58ca[_0x04ab('0xe')];this[_0x04ab('0x11')]=_0xfe58ca['countdropretry'];this['countabandonedretry']=_0xfe58ca['countabandonedretry'];this[_0x04ab('0x12')]=_0xfe58ca[_0x04ab('0x12')];this[_0x04ab('0x10')]=_0xfe58ca[_0x04ab('0x10')];this[_0x04ab('0x9')]=_0xfe58ca[_0x04ab('0x9')];this[_0x04ab('0x13')]=_0xfe58ca[_0x04ab('0x13')];this[_0x04ab('0x14')]=_0xfe58ca[_0x04ab('0x14')];this['starttime']=_0xfe58ca[_0x04ab('0x15')];this[_0x04ab('0x16')]=_0xfe58ca[_0x04ab('0x16')];this[_0x04ab('0x17')]=_0xfe58ca[_0x04ab('0x16')];this[_0x04ab('0x18')]=_0xfe58ca[_0x04ab('0x18')]||0x0;this[_0x04ab('0x19')]=_0xfe58ca[_0x04ab('0x19')]||0x0;this['talktime']=_0xfe58ca[_0x04ab('0x1a')]||0x0;this['callback']=_0xfe58ca[_0x04ab('0x1b')];this[_0x04ab('0x1c')]=_0xfe58ca[_0x04ab('0x1c')];this['callbackat']=_0xfe58ca[_0x04ab('0x1d')];this[_0x04ab('0x1e')]=_0xfe58ca[_0x04ab('0x1e')];this['ContactId']=_0xfe58ca['ContactId'];this[_0x04ab('0x1f')]=_0xfe58ca[_0x04ab('0x1f')];this['UserId']=_0xfe58ca['UserId'];this[_0x04ab('0x20')]=_0xfe58ca[_0x04ab('0x20')];this[_0x04ab('0x21')]=_0xfe58ca[_0x04ab('0x21')];this[_0x04ab('0x22')]=_0xfe58ca[_0x04ab('0x22')]||'';this[_0x04ab('0x23')]=_0xfe58ca[_0x04ab('0x23')]||'';}module[_0x04ab('0x24')]=Final; \ No newline at end of file +var _0xbacd=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xbacd,0x1c5));var _0xdbac=function(_0x1678ca,_0x64c6fe){_0x1678ca=_0x1678ca-0x0;var _0x41a367=_0xbacd[_0x1678ca];return _0x41a367;};'use strict';var util=require(_0xdbac('0x0'));var _=require(_0xdbac('0x1'));var moment=require('moment');function getSeconds(_0x2acc37,_0x7068d9){var _0x43f7e4=moment(_0x2acc37)['milliseconds'](0x0);var _0x34099f=moment(_0x7068d9)[_0xdbac('0x2')](0x0);return _0x43f7e4[_0xdbac('0x3')](_0x34099f,_0xdbac('0x4'));}function Final(_0x1b67fc){this[_0xdbac('0x5')]=_0x1b67fc[_0xdbac('0x5')];this[_0xdbac('0x6')]=_0x1b67fc[_0xdbac('0x6')];this[_0xdbac('0x7')]=_0x1b67fc[_0xdbac('0x7')];this[_0xdbac('0x8')]=_0x1b67fc[_0xdbac('0x7')]===_0xdbac('0x9')?_0xdbac('0xa'):_0x1b67fc['type'];this[_0xdbac('0xb')]=_0x1b67fc[_0xdbac('0xb')];this['countcongestionretry']=_0x1b67fc[_0xdbac('0xc')];this['countnoanswerretry']=_0x1b67fc[_0xdbac('0xd')];this[_0xdbac('0xe')]=_0x1b67fc[_0xdbac('0xb')]+_0x1b67fc[_0xdbac('0xc')]+_0x1b67fc[_0xdbac('0xd')]+_0x1b67fc[_0xdbac('0xf')]+_0x1b67fc[_0xdbac('0x10')]+_0x1b67fc[_0xdbac('0x11')]+_0x1b67fc[_0xdbac('0x12')]+_0x1b67fc['countagentrejectretry'];this[_0xdbac('0xf')]=_0x1b67fc[_0xdbac('0xf')];this[_0xdbac('0x10')]=_0x1b67fc[_0xdbac('0x10')];this[_0xdbac('0x11')]=_0x1b67fc[_0xdbac('0x11')];this[_0xdbac('0x12')]=_0x1b67fc[_0xdbac('0x12')];this['countagentrejectretry']=_0x1b67fc[_0xdbac('0x13')];this[_0xdbac('0xa')]=_0x1b67fc[_0xdbac('0xa')];this['calleridname']=_0x1b67fc[_0xdbac('0x14')];this[_0xdbac('0x15')]=_0x1b67fc[_0xdbac('0x15')];this[_0xdbac('0x16')]=_0x1b67fc[_0xdbac('0x16')];this[_0xdbac('0x17')]=_0x1b67fc[_0xdbac('0x17')];this[_0xdbac('0x18')]=_0x1b67fc[_0xdbac('0x17')];this[_0xdbac('0x19')]=_0x1b67fc[_0xdbac('0x19')]||0x0;this[_0xdbac('0x1a')]=_0x1b67fc['holdtime']||0x0;this[_0xdbac('0x1b')]=_0x1b67fc[_0xdbac('0x1b')]||0x0;this['callback']=_0x1b67fc[_0xdbac('0x1c')];this['callbackuniqueid']=_0x1b67fc[_0xdbac('0x1d')];this['callbackat']=_0x1b67fc[_0xdbac('0x1e')];this[_0xdbac('0x1f')]=_0x1b67fc[_0xdbac('0x1f')];this[_0xdbac('0x20')]=_0x1b67fc[_0xdbac('0x20')];this[_0xdbac('0x21')]=_0x1b67fc[_0xdbac('0x21')];this['UserId']=_0x1b67fc[_0xdbac('0x22')];this[_0xdbac('0x23')]=_0x1b67fc[_0xdbac('0x23')];this[_0xdbac('0x24')]=_0x1b67fc[_0xdbac('0x24')];this[_0xdbac('0x25')]=_0x1b67fc[_0xdbac('0x25')]||'';this[_0xdbac('0x26')]=_0x1b67fc[_0xdbac('0x26')]||'';}module[_0xdbac('0x27')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 48f941e..8e9b6c5 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 _0x20a7=['countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','moment','milliseconds','seconds','state','statedesc','scheduledat','type','campaigntype','queue','countbusyretry'];(function(_0x4da179,_0xfa7ac5){var _0x5b6d0d=function(_0x44df92){while(--_0x44df92){_0x4da179['push'](_0x4da179['shift']());}};_0x5b6d0d(++_0xfa7ac5);}(_0x20a7,0x15d));var _0x720a=function(_0x44537f,_0x4f9508){_0x44537f=_0x44537f-0x0;var _0x5af85f=_0x20a7[_0x44537f];return _0x5af85f;};'use strict';var util=require(_0x720a('0x0'));var _=require('lodash');var moment=require(_0x720a('0x1'));function getSeconds(_0x34de4d,_0x3b509a){var _0x4c2d7b=moment(_0x34de4d)[_0x720a('0x2')](0x0);var _0x1b5650=moment(_0x3b509a)[_0x720a('0x2')](0x0);return _0x4c2d7b['diff'](_0x1b5650,_0x720a('0x3'));}function Hangup(_0x11e942,_0xfd7fdb){this[_0x720a('0x4')]=0x4;this[_0x720a('0x5')]='Answer';this[_0x720a('0x6')]=_0x11e942[_0x720a('0x6')];this['type']=_0x11e942[_0x720a('0x7')];this[_0x720a('0x8')]=_0x11e942[_0x720a('0x7')]==='outbound'?_0x720a('0x9'):_0x11e942[_0x720a('0x7')];this[_0x720a('0xa')]=_0x11e942[_0x720a('0xa')];this[_0x720a('0xb')]=_0x11e942[_0x720a('0xb')];this[_0x720a('0xc')]=_0x11e942[_0x720a('0xc')];this[_0x720a('0xd')]=_0x11e942[_0x720a('0xa')]+_0x11e942['countcongestionretry']+_0x11e942[_0x720a('0xc')]+_0x11e942[_0x720a('0xe')]+_0x11e942[_0x720a('0xf')]+_0x11e942[_0x720a('0x10')]+_0x11e942[_0x720a('0x11')]+_0x11e942[_0x720a('0x12')];this['countnosuchnumberretry']=_0x11e942[_0x720a('0xe')];this[_0x720a('0xf')]=_0x11e942[_0x720a('0xf')];this[_0x720a('0x10')]=_0x11e942['countabandonedretry'];this['countmachineretry']=_0x11e942[_0x720a('0x11')];this[_0x720a('0x12')]=_0x11e942[_0x720a('0x12')];this[_0x720a('0x13')]=_0xfd7fdb[_0x720a('0x13')];this[_0x720a('0x14')]=_0x11e942[_0x720a('0x15')];this[_0x720a('0x16')]=_0x11e942['number'];this[_0x720a('0x17')]=_0x11e942[_0x720a('0x17')];this['responsetime']=_0x11e942[_0x720a('0x18')];this[_0x720a('0x19')]=moment()[_0x720a('0x1a')](_0x720a('0x1b'));this[_0x720a('0x1c')]=getSeconds(_0x11e942['responsetime'],_0x11e942[_0x720a('0x17')]);this[_0x720a('0x1d')]=0x0;this[_0x720a('0x1e')]=getSeconds(this[_0x720a('0x19')],_0x11e942[_0x720a('0x18')]);this[_0x720a('0x9')]=_0x11e942['queue'];this[_0x720a('0x1f')]=_0x720a('0x20');this[_0x720a('0x21')]=_0xfd7fdb[_0x720a('0x22')];this['callback']=_0x11e942[_0x720a('0x23')];this[_0x720a('0x24')]=_0x11e942[_0x720a('0x24')];this[_0x720a('0x25')]=_0x11e942[_0x720a('0x25')];this[_0x720a('0x26')]=_0x11e942[_0x720a('0x26')];this[_0x720a('0x27')]=_0x11e942[_0x720a('0x27')];this[_0x720a('0x28')]=_0x11e942['ListId'];this[_0x720a('0x29')]=_0x11e942[_0x720a('0x29')];this[_0x720a('0x2a')]=_0x11e942[_0x720a('0x2a')];this[_0x720a('0x2b')]=_0x11e942[_0x720a('0x2b')];}module[_0x720a('0x2c')]=Hangup; \ No newline at end of file +var _0x7424=['callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','exports','util','lodash','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','membername','IVR','cause-txt','callback','callbackuniqueid'];(function(_0x5e9f1d,_0x57de63){var _0xa64898=function(_0x38a442){while(--_0x38a442){_0x5e9f1d['push'](_0x5e9f1d['shift']());}};_0xa64898(++_0x57de63);}(_0x7424,0x91));var _0x4742=function(_0x2fef7f,_0x5ef3ed){_0x2fef7f=_0x2fef7f-0x0;var _0x1de61a=_0x7424[_0x2fef7f];return _0x1de61a;};'use strict';var util=require(_0x4742('0x0'));var _=require(_0x4742('0x1'));var moment=require('moment');function getSeconds(_0x4b4344,_0x5a2671){var _0x5aa743=moment(_0x4b4344)[_0x4742('0x2')](0x0);var _0x14de68=moment(_0x5a2671)[_0x4742('0x2')](0x0);return _0x5aa743[_0x4742('0x3')](_0x14de68,_0x4742('0x4'));}function Hangup(_0x3f2af3,_0x10be0e){this[_0x4742('0x5')]=0x4;this[_0x4742('0x6')]=_0x4742('0x7');this['scheduledat']=_0x3f2af3[_0x4742('0x8')];this[_0x4742('0x9')]=_0x3f2af3['type'];this[_0x4742('0xa')]=_0x3f2af3[_0x4742('0x9')]===_0x4742('0xb')?_0x4742('0xc'):_0x3f2af3['type'];this[_0x4742('0xd')]=_0x3f2af3[_0x4742('0xd')];this[_0x4742('0xe')]=_0x3f2af3[_0x4742('0xe')];this[_0x4742('0xf')]=_0x3f2af3[_0x4742('0xf')];this[_0x4742('0x10')]=_0x3f2af3[_0x4742('0xd')]+_0x3f2af3[_0x4742('0xe')]+_0x3f2af3['countnoanswerretry']+_0x3f2af3[_0x4742('0x11')]+_0x3f2af3[_0x4742('0x12')]+_0x3f2af3['countabandonedretry']+_0x3f2af3[_0x4742('0x13')]+_0x3f2af3['countagentrejectretry'];this['countnosuchnumberretry']=_0x3f2af3['countnosuchnumberretry'];this[_0x4742('0x12')]=_0x3f2af3[_0x4742('0x12')];this[_0x4742('0x14')]=_0x3f2af3[_0x4742('0x14')];this[_0x4742('0x13')]=_0x3f2af3[_0x4742('0x13')];this[_0x4742('0x15')]=_0x3f2af3[_0x4742('0x15')];this[_0x4742('0x16')]=_0x10be0e['uniqueid'];this[_0x4742('0x17')]=_0x3f2af3[_0x4742('0x18')];this[_0x4742('0x19')]=_0x3f2af3[_0x4742('0x1a')];this[_0x4742('0x1b')]=_0x3f2af3[_0x4742('0x1b')];this[_0x4742('0x1c')]=_0x3f2af3[_0x4742('0x1c')];this[_0x4742('0x1d')]=moment()[_0x4742('0x1e')](_0x4742('0x1f'));this[_0x4742('0x20')]=getSeconds(_0x3f2af3['responsetime'],_0x3f2af3[_0x4742('0x1b')]);this['holdtime']=0x0;this[_0x4742('0x21')]=getSeconds(this[_0x4742('0x1d')],_0x3f2af3[_0x4742('0x1c')]);this['queue']=_0x3f2af3['queue'];this[_0x4742('0x22')]=_0x4742('0x23');this['reason']=_0x10be0e[_0x4742('0x24')];this[_0x4742('0x25')]=_0x3f2af3['callback'];this['callbackuniqueid']=_0x3f2af3[_0x4742('0x26')];this[_0x4742('0x27')]=_0x3f2af3[_0x4742('0x27')];this[_0x4742('0x28')]=_0x3f2af3[_0x4742('0x28')];this[_0x4742('0x29')]=_0x3f2af3[_0x4742('0x29')];this[_0x4742('0x2a')]=_0x3f2af3[_0x4742('0x2a')];this['UserId']=_0x3f2af3['UserId'];this[_0x4742('0x2b')]=_0x3f2af3['VoiceQueueId'];this[_0x4742('0x2c')]=_0x3f2af3[_0x4742('0x2c')];}module[_0x4742('0x2d')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 7d13ab5..18a8616 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 _0xe8e5=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','name','calleridnum','number','starttime','responsetime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','uniqueid','type','campaigntype'];(function(_0x2030c8,_0x16dc62){var _0x5c36a6=function(_0x4440f5){while(--_0x4440f5){_0x2030c8['push'](_0x2030c8['shift']());}};_0x5c36a6(++_0x16dc62);}(_0xe8e5,0x1c0));var _0x5e8e=function(_0x289050,_0x4315ad){_0x289050=_0x289050-0x0;var _0x256ed2=_0xe8e5[_0x289050];return _0x256ed2;};'use strict';var util=require('util');var _=require(_0x5e8e('0x0'));var moment=require(_0x5e8e('0x1'));function getSeconds(_0x406d0b,_0x549d96){var _0x432558=moment(_0x406d0b)[_0x5e8e('0x2')](0x0);var _0x186f31=moment(_0x549d96)[_0x5e8e('0x2')](0x0);return _0x432558[_0x5e8e('0x3')](_0x186f31,'seconds');}function History(_0x546d30){this[_0x5e8e('0x4')]=_0x546d30[_0x5e8e('0x4')];this['scheduledat']=_0x546d30['scheduledat']||undefined;this['type']=_0x546d30[_0x5e8e('0x5')];this[_0x5e8e('0x6')]=_0x546d30[_0x5e8e('0x5')]==='outbound'?'queue':_0x546d30[_0x5e8e('0x5')];this['countbusyretry']=_0x546d30[_0x5e8e('0x7')];this['countcongestionretry']=_0x546d30[_0x5e8e('0x8')];this[_0x5e8e('0x9')]=_0x546d30['countnoanswerretry'];this[_0x5e8e('0xa')]=_0x546d30[_0x5e8e('0x7')]+_0x546d30[_0x5e8e('0x8')]+_0x546d30['countnoanswerretry']+_0x546d30[_0x5e8e('0xb')]+_0x546d30[_0x5e8e('0xc')]+_0x546d30[_0x5e8e('0xd')]+_0x546d30[_0x5e8e('0xe')]+_0x546d30[_0x5e8e('0xf')];this[_0x5e8e('0xb')]=_0x546d30['countnosuchnumberretry'];this[_0x5e8e('0xc')]=_0x546d30[_0x5e8e('0xc')];this[_0x5e8e('0xd')]=_0x546d30[_0x5e8e('0xd')];this[_0x5e8e('0xe')]=_0x546d30['countmachineretry'];this[_0x5e8e('0xf')]=_0x546d30['countagentrejectretry'];this[_0x5e8e('0x10')]=_0x546d30['queue'];this['calleridname']=_0x546d30[_0x5e8e('0x11')];this[_0x5e8e('0x12')]=_0x546d30[_0x5e8e('0x13')];this[_0x5e8e('0x14')]=_0x546d30[_0x5e8e('0x14')];this[_0x5e8e('0x15')]=_0x546d30[_0x5e8e('0x15')];this['endtime']=_0x546d30[_0x5e8e('0x15')];this[_0x5e8e('0x16')]=getSeconds(_0x546d30['responsetime'],_0x546d30['starttime']);this[_0x5e8e('0x17')]=0x0;this['talktime']=0x0;this['callback']=_0x546d30[_0x5e8e('0x18')];this['callbackuniqueid']=_0x546d30[_0x5e8e('0x19')];this[_0x5e8e('0x1a')]=_0x546d30[_0x5e8e('0x1a')];this['recallme']=_0x546d30[_0x5e8e('0x1b')];this[_0x5e8e('0x1c')]=_0x546d30['ContactId'];this['ListId']=_0x546d30['ListId'];this[_0x5e8e('0x1d')]=_0x546d30['UserId'];this[_0x5e8e('0x1e')]=_0x546d30[_0x5e8e('0x1e')];this['CampaignId']=_0x546d30[_0x5e8e('0x1f')];this['originatecalleridnum']=_0x546d30[_0x5e8e('0x20')]||'';this[_0x5e8e('0x21')]=_0x546d30[_0x5e8e('0x21')]||'';}module[_0x5e8e('0x22')]=History; \ No newline at end of file +var _0x40f4=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','name','number','starttime','responsetime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','milliseconds','diff','uniqueid','scheduledat','type','campaigntype'];(function(_0x35a4f1,_0x10fee9){var _0x2b8724=function(_0xf3c066){while(--_0xf3c066){_0x35a4f1['push'](_0x35a4f1['shift']());}};_0x2b8724(++_0x10fee9);}(_0x40f4,0x119));var _0x440f=function(_0x2112ed,_0x1c14cb){_0x2112ed=_0x2112ed-0x0;var _0x3336d2=_0x40f4[_0x2112ed];return _0x3336d2;};'use strict';var util=require(_0x440f('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x139a16,_0xb89fa){var _0xd50c77=moment(_0x139a16)[_0x440f('0x1')](0x0);var _0x5172f3=moment(_0xb89fa)[_0x440f('0x1')](0x0);return _0xd50c77[_0x440f('0x2')](_0x5172f3,'seconds');}function History(_0x8d8c07){this[_0x440f('0x3')]=_0x8d8c07['uniqueid'];this[_0x440f('0x4')]=_0x8d8c07['scheduledat']||undefined;this[_0x440f('0x5')]=_0x8d8c07[_0x440f('0x5')];this[_0x440f('0x6')]=_0x8d8c07[_0x440f('0x5')]===_0x440f('0x7')?_0x440f('0x8'):_0x8d8c07[_0x440f('0x5')];this[_0x440f('0x9')]=_0x8d8c07[_0x440f('0x9')];this['countcongestionretry']=_0x8d8c07[_0x440f('0xa')];this[_0x440f('0xb')]=_0x8d8c07[_0x440f('0xb')];this[_0x440f('0xc')]=_0x8d8c07[_0x440f('0x9')]+_0x8d8c07[_0x440f('0xa')]+_0x8d8c07[_0x440f('0xb')]+_0x8d8c07[_0x440f('0xd')]+_0x8d8c07[_0x440f('0xe')]+_0x8d8c07[_0x440f('0xf')]+_0x8d8c07['countmachineretry']+_0x8d8c07[_0x440f('0x10')];this['countnosuchnumberretry']=_0x8d8c07['countnosuchnumberretry'];this[_0x440f('0xe')]=_0x8d8c07[_0x440f('0xe')];this['countabandonedretry']=_0x8d8c07[_0x440f('0xf')];this['countmachineretry']=_0x8d8c07[_0x440f('0x11')];this['countagentrejectretry']=_0x8d8c07[_0x440f('0x10')];this[_0x440f('0x8')]=_0x8d8c07[_0x440f('0x8')];this[_0x440f('0x12')]=_0x8d8c07[_0x440f('0x13')];this['calleridnum']=_0x8d8c07[_0x440f('0x14')];this[_0x440f('0x15')]=_0x8d8c07[_0x440f('0x15')];this[_0x440f('0x16')]=_0x8d8c07['responsetime'];this['endtime']=_0x8d8c07[_0x440f('0x16')];this[_0x440f('0x17')]=getSeconds(_0x8d8c07[_0x440f('0x16')],_0x8d8c07['starttime']);this[_0x440f('0x18')]=0x0;this['talktime']=0x0;this[_0x440f('0x19')]=_0x8d8c07['callback'];this[_0x440f('0x1a')]=_0x8d8c07['callbackuniqueid'];this[_0x440f('0x1b')]=_0x8d8c07[_0x440f('0x1b')];this[_0x440f('0x1c')]=_0x8d8c07[_0x440f('0x1c')];this['ContactId']=_0x8d8c07[_0x440f('0x1d')];this[_0x440f('0x1e')]=_0x8d8c07[_0x440f('0x1e')];this[_0x440f('0x1f')]=_0x8d8c07['UserId'];this[_0x440f('0x20')]=_0x8d8c07['VoiceQueueId'];this[_0x440f('0x21')]=_0x8d8c07[_0x440f('0x21')];this[_0x440f('0x22')]=_0x8d8c07[_0x440f('0x22')]||'';this[_0x440f('0x23')]=_0x8d8c07[_0x440f('0x23')]||'';}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 96baa3d..3bcf990 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 _0x477a=['syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','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','seconds','type','outbound','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','voice:queue:%s','voice_queue:save','ivr','format','campaign:ivr:%s','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','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\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22\x22\x20<>','error','inspect','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','statedesc','endtime','uniqueId','clearZombieChannels','[actions]','enqueue','isNil','Action','status','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','resolve','then','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ListId','UserId','CampaignId','[emptyContact]','isSuccess','isTrunkReachable','reachable','SIP/%s','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','membername','AMD','emit','custom:amd','buildObj','amd','[syncHangupInAMD]','countmachineretry','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','state','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','countglobal','[syncAgentComplete][createHistory][0]','countdropretry','add','VoiceQueueId','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','dialQueueProject','outboundUnknownCallsDay','cause-txt','reason','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','answertime','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','Drop','dropreason','TIMEOUT','dialDropMaxRetry','queueCallerAbandonCreateState','dialDropRetryFrequency','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','starttime','[syncAgentComplete][createHistory][11]','channel','strategy','actionid','paused','stateinterface','locked','queueBooked','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','push','command','iftime\x20%s,%s','content','indexOf','true','all','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Timezone:\x20','checkDialMethod','progressive','handlePower','power','Queue','method\x20not\x20recognized','launchHandleIvr','dialActive','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncQueueSummary]','syncCampaigns','undefined','[syncCampaigns]','\x5cw{0,','pow','replace','match','actionOriginate','object','originate','Contact','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','getCaller','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','toUpper','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdName','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','dialPrefix','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberMaxRetry','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','startMethodPredictive','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','predictiveIntervalHitRate','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','dialRecallMeTimeout','Agent','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','handleIvr','limitCalls','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialOrderByScheduledAt','ACTIVE','Contact.phone','[getContactDialer2]','dialLimitQueue','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','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','bluebird','uuid','md5','ioredis','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','../rpc/voiceQueueRt','./action','./history','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','agentconnect','syncAgentConnect','queuecallerabandon','originateresponse','syncOriginateResponse','bind','agentcomplete','syncAgentComplete','custom:queuesummary','hangup'];(function(_0x227a0f,_0x376760){var _0x3544a7=function(_0x367555){while(--_0x367555){_0x227a0f['push'](_0x227a0f['shift']());}};_0x3544a7(++_0x376760);}(_0x477a,0x1e2));var _0xa477=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x477a[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xa477('0x0'));var _=require('lodash');var BPromise=require(_0xa477('0x1'));var uuid=require(_0xa477('0x2'));var moment=require('moment');var rr=require('rr');var md5=require(_0xa477('0x3'));var Redis=require(_0xa477('0x4'));var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require(_0xa477('0x5'))(_0xa477('0x6'));var loggerBooked=require('../../../config/logger')(_0xa477('0x7'));var loggerPredictive=require(_0xa477('0x5'))(_0xa477('0x8'));var loggerPredictiveCalls=require(_0xa477('0x5'))(_0xa477('0x9'));var loggerSyncQueueSummary=require(_0xa477('0x5'))(_0xa477('0xa'));var ami=require(_0xa477('0xb'));config[_0xa477('0xc')]=_['defaults'](config[_0xa477('0xc')],{'host':_0xa477('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xa477('0xe'));var Action=require(_0xa477('0xf'));var History=require(_0xa477('0x10'));var Final=require('./final');var AgentComplete=require(_0xa477('0x11'));var QueueCallerAbandon=require(_0xa477('0x12'));var Hangup=require(_0xa477('0x13'));var ipAgi=process['env'][_0xa477('0x14')]||_0xa477('0x15');var strategy={'rrmemory':_0xa477('0x16'),'roundrobin':_0xa477('0x17')};var Sequence=function(){};Sequence[_0xa477('0x18')]['enqueue']=function(_0x377c83){this[_0xa477('0x19')]=this[_0xa477('0x19')]?this[_0xa477('0x19')][_0xa477('0x1a')](_0x377c83):_0x377c83();};function Dialer(_0x1659cb,_0x2ae61a){this[_0xa477('0x1b')]=new Sequence();this[_0xa477('0x1c')]=_0x2ae61a;this[_0xa477('0x1d')]=_0x1659cb[_0xa477('0x1d')];this[_0xa477('0x1e')]=_0x1659cb[_0xa477('0x1e')];this['agents']=_0x1659cb[_0xa477('0x1f')];this[_0xa477('0x20')]=_0x1659cb[_0xa477('0x20')];this[_0xa477('0x21')]=config[_0xa477('0x21')]||0x2;this[_0xa477('0x22')]={};this[_0xa477('0x23')]={};this[_0xa477('0x24')]={};this['uniqueId']={};this[_0xa477('0x25')]={};this[_0xa477('0x26')]={};this[_0xa477('0x27')]={};this['ivrOriginated']={};this['queueBooked']={};this['queueBookedRR']={};ami['on'](_0xa477('0x28'),this[_0xa477('0x29')]['bind'](this));ami['on'](_0xa477('0x2a'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0xa477('0x2b'),this[_0xa477('0x2c')][_0xa477('0x2d')](this));ami['on'](_0xa477('0x2e'),this[_0xa477('0x2f')][_0xa477('0x2d')](this));ami['on'](_0xa477('0x30'),this['syncQueueSummary'][_0xa477('0x2d')](this));ami['on'](_0xa477('0x31'),this[_0xa477('0x32')][_0xa477('0x2d')](this));ami['on'](_0xa477('0x33'),this[_0xa477('0x34')][_0xa477('0x2d')](this));ami['on']('varset',this[_0xa477('0x35')][_0xa477('0x2d')](this));ami['on'](_0xa477('0x36'),this[_0xa477('0x37')][_0xa477('0x2d')](this));ami['on'](_0xa477('0x38'),this[_0xa477('0x39')]['bind'](this));this[_0xa477('0x3a')]();this['loopClearZombieChannels']();}function isNotNull(_0x599371){return _0x599371!==null&&!_[_0xa477('0x3b')](_0x599371);}function checkIsLoggedIn(_0x1fa6a5,_0x4c27e7){return function(){if(_0x4c27e7<=0x0){_0x1fa6a5[_0xa477('0x3c')]=_0xa477('0x3d');throw _0x1fa6a5[_0xa477('0x3e')]+_0xa477('0x3f');}};}function isActive(_0x2d7d62){return _0x2d7d62;}function checkIsActive(_0x11c5dc,_0x37ec1c){return function(){if(!isActive(_0x37ec1c)){_0x11c5dc[_0xa477('0x3c')]=_0xa477('0x40');throw _0x11c5dc[_0xa477('0x3e')]+_0xa477('0x41');}};}function checkInterval(_0x10e540){return function(){if(!isNotNull(_0x10e540[_0xa477('0x42')])){_0x10e540['message']=_0xa477('0x43');throw _0x10e540[_0xa477('0x3e')]+_0xa477('0x44');}if(!isNotNull(_0x10e540[_0xa477('0x42')][_0xa477('0x45')])){_0x10e540[_0xa477('0x3c')]=_0xa477('0x43');throw _0x10e540[_0xa477('0x3e')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xa477('0x46')](_0x10e540[_0xa477('0x42')][_0xa477('0x45')]))){_0x10e540[_0xa477('0x3c')]=_0xa477('0x43');throw _0x10e540[_0xa477('0x3e')]+_0xa477('0x44');}};}function msgResponse(_0x370207,_0x2f2a9e,_0x288288){return{'action':_0x370207,'response':_0x2f2a9e,'message':_0x288288,'stack':_0x288288};}function myreject(_0x425745){return function(_0x38bf70){return _0x425745(msgResponse(_0xa477('0x47'),_0xa477('0x48'),JSON[_0xa477('0x49')](_0x38bf70)));};}function getSeconds(_0x1ccab0,_0x3a22ae){var _0x3d70b2=moment(_0x1ccab0)[_0xa477('0x4a')](0x0);var _0x589904=moment(_0x3a22ae)[_0xa477('0x4a')](0x0);return _0x3d70b2[_0xa477('0x4b')](_0x589904,_0xa477('0x4c'));}function emit(_0x13a832,_0x17ac4f,_0x1d2ae6){io['to'](_0x13a832)['emit'](_0x17ac4f,_0x1d2ae6);}function emitVoiceQueueSummary(_0x568739){if(_0x568739[_0xa477('0x4d')]===_0xa477('0x4e')){var _0x43aa67={'id':_0x568739['id'],'name':_0x568739[_0xa477('0x3e')],'strategy':_0x568739['strategy'],'answered':_0x568739['answered'],'available':_0x568739[_0xa477('0x4f')],'loggedIn':_0x568739[_0xa477('0x50')],'pTalking':_0x568739[_0xa477('0x51')],'sumBillable':_0x568739[_0xa477('0x52')],'sumDuration':_0x568739[_0xa477('0x53')],'sumHoldTime':_0x568739[_0xa477('0x54')]||0x0,'talking':_0x568739[_0xa477('0x55')],'total':_0x568739[_0xa477('0x56')],'type':_0x568739[_0xa477('0x4d')],'unmanaged':_0x568739['unmanaged'],'abandoned':_0x568739[_0xa477('0x57')],'waiting':_0x568739[_0xa477('0x58')],'loggedInDb':_0x568739[_0xa477('0x59')],'dialActive':_0x568739['dialActive'],'dialMethod':_0x568739[_0xa477('0x5a')],'dialOriginateCallerIdName':_0x568739['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x568739[_0xa477('0x5b')],'dialOriginateTimeout':_0x568739[_0xa477('0x5c')],'dialPrefix':_0x568739['dialPrefix'],'outboundAnswerAgiCallsDay':_0x568739[_0xa477('0x5d')],'outboundAnswerCallsDay':_0x568739[_0xa477('0x5e')],'outboundBlacklistCallsDay':_0x568739['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x568739[_0xa477('0x5f')],'outboundCongestionCallsDay':_0x568739[_0xa477('0x60')],'outboundDropCallsDayACS':_0x568739[_0xa477('0x61')],'outboundDropCallsDayCallersExit':_0x568739[_0xa477('0x62')],'outboundDropCallsDayTimeout':_0x568739[_0xa477('0x63')],'outboundNoAnswerCallsDay':_0x568739[_0xa477('0x64')],'outboundNoSuchCallsDay':_0x568739[_0xa477('0x65')],'outboundOriginateFailureCallsDay':_0x568739[_0xa477('0x66')],'outboundReCallsDay':_0x568739[_0xa477('0x67')],'outboundRejectCallsDay':_0x568739[_0xa477('0x68')],'outboundUnknownCallsDay':_0x568739['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x568739[_0xa477('0x69')],'predictiveIntervalAvgHoldtime':_0x568739[_0xa477('0x6a')],'predictiveIntervalAvgTalktime':_0x568739[_0xa477('0x6b')],'predictiveIntervalDroppedCallsCallersExit':_0x568739[_0xa477('0x6c')],'predictiveIntervalDroppedCallsTimeout':_0x568739[_0xa477('0x6d')],'predictiveIntervalErlangCalls':_0x568739['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x568739[_0xa477('0x6e')],'predictiveIntervalHitRate':_0x568739['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x568739[_0xa477('0x6f')],'predictiveIntervalPauses':_0x568739[_0xa477('0x70')],'predictiveIntervalAvailable':_0x568739[_0xa477('0x71')],'predictiveIntervalTotalCalls':_0x568739['predictiveIntervalTotalCalls'],'message':_0x568739[_0xa477('0x3c')],'originated':_0x568739[_0xa477('0x72')],'erlangCalls':_0x568739[_0xa477('0x73')],'erlangCallToSecond':_0x568739[_0xa477('0x74')],'erlangAbandonmentRate':_0x568739[_0xa477('0x75')],'erlangBusyFactor':_0x568739[_0xa477('0x76')],'startPredictive':_0x568739[_0xa477('0x26')],'startProgressive':_0x568739[_0xa477('0x27')]};if(_0x568739[_0xa477('0x77')]){_0x43aa67[_0xa477('0x77')]={'id':_0x568739[_0xa477('0x77')]['id'],'name':_0x568739['Trunk'][_0xa477('0x3e')],'active':_0x568739[_0xa477('0x77')][_0xa477('0x78')],'callerid':_0x568739['Trunk'][_0xa477('0x79')]};}if(_0x568739[_0xa477('0x42')]){_0x43aa67['Interval']={'id':_0x568739[_0xa477('0x42')]['id'],'name':_0x568739[_0xa477('0x42')][_0xa477('0x3e')]};}var _0x543a19=md5(JSON[_0xa477('0x49')](_0x43aa67));if(_0x568739['md5']!==_0x543a19){_0x568739[_0xa477('0x3')]=_0x543a19;emit(util['format'](_0xa477('0x7a'),_0x43aa67[_0xa477('0x3e')]),_0xa477('0x7b'),_0x43aa67);}}}function emitCampaignSummary(_0x10918b){if(_0x10918b['type']===_0xa477('0x7c')){emit(util[_0xa477('0x7d')](_0xa477('0x7e'),_0x10918b['name']),'campaign:save',_0x10918b);}}function checkGetDataPredictive(_0x22196e){if(isNotNull(_0x22196e)&&!_[_0xa477('0x46')](_0x22196e)){loggerPredictive[_0xa477('0x7f')](_0xa477('0x80'));loggerPredictive[_0xa477('0x7f')](_0xa477('0x81'),_0x22196e[_0xa477('0x82')]);loggerPredictive[_0xa477('0x7f')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x22196e['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xa477('0x7f')](_0xa477('0x83'),_0x22196e[_0xa477('0x6d')]);loggerPredictive[_0xa477('0x7f')](_0xa477('0x84'),_0x22196e[_0xa477('0x6c')]);loggerPredictive['info'](_0xa477('0x85'),_0x22196e[_0xa477('0x6a')]);loggerPredictive[_0xa477('0x7f')](_0xa477('0x86'),_0x22196e[_0xa477('0x6b')]);loggerPredictive[_0xa477('0x7f')](_0xa477('0x87'));if(_0x22196e['predictiveIntervalTotalCalls']>0x0){if(!_['isUndefined'](_0x22196e[_0xa477('0x6b')])&&_0x22196e[_0xa477('0x6b')]>0x0){return!![];}loggerPredictive[_0xa477('0x7f')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0xa477('0x3b')](_0x22196e[_0xa477('0x6a')])&&_0x22196e[_0xa477('0x6a')]>0x0){return!![];}loggerPredictive['info'](_0xa477('0x88'));}else{loggerPredictive[_0xa477('0x7f')](_0xa477('0x89'));}}else{loggerPredictive[_0xa477('0x7f')](_0xa477('0x8a'));}return![];}function mergeDataErlangB(_0x175d25){return function(_0x381075){loggerPredictive[_0xa477('0x7f')]('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0xa477('0x8b'),_0x381075[_0xa477('0x73')]);loggerPredictive[_0xa477('0x7f')](_0xa477('0x8c'),_0x381075['erlangCallToSecond']);loggerPredictive['info'](_0xa477('0x8d'),_0x381075[_0xa477('0x75')]);loggerPredictive[_0xa477('0x7f')](_0xa477('0x8e'),_0x381075['erlangBusyFactor']);loggerPredictive[_0xa477('0x7f')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x381075['erlangAbandonmentRate']);loggerPredictive[_0xa477('0x7f')](_0xa477('0x87'));_[_0xa477('0x8f')](_0x175d25,_0x381075);};}function getDiff(_0x5be180){var _0x60634f=moment()['milliseconds'](0x0);var _0x143953=moment(_0x5be180)['milliseconds'](0x0);return _0x60634f[_0xa477('0x4b')](_0x143953,_0xa477('0x4c'));}function ifInterval(_0x3f9824,_0x4bd42d){if(_[_0xa477('0x3b')](_0x4bd42d)){return![];}return getDiff(_0x4bd42d)<_0x3f9824*0x3c;}function freeVariablesPredictive(_0x43b5ae){if(isNotNull(_0x43b5ae)){if(!_[_0xa477('0x3b')](_0x43b5ae[_0xa477('0x27')])){_0x43b5ae[_0xa477('0x27')]=undefined;loggerPredictive[_0xa477('0x7f')](_0x43b5ae[_0xa477('0x3e')],_0xa477('0x90'));}if(!_['isUndefined'](_0x43b5ae[_0xa477('0x26')])){_0x43b5ae[_0xa477('0x26')]=undefined;loggerPredictive[_0xa477('0x7f')](_0x43b5ae[_0xa477('0x3e')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0xa477('0x3b')](_0x43b5ae['handlePredictive'])){clearInterval(_0x43b5ae['handlePredictive']);_0x43b5ae[_0xa477('0x91')]=undefined;loggerPredictive[_0xa477('0x7f')](_0x43b5ae['name'],_0xa477('0x92'));}}}function erlangb(_0x68226f,_0x413c40){if(_0x413c40===0x0){return 0x0;}var _0x57e9d6=0x1;for(var _0x4a2fd4=0x1;_0x4a2fd4<=_0x413c40;_0x4a2fd4+=0x1){_0x57e9d6=0x1+_0x57e9d6*_0x4a2fd4/_0x68226f;}return 0x1/_0x57e9d6;}function isVoiceQueueOutbound(_0x578d64){return _0x578d64===_0xa477('0x4e');}function isNotPreview(_0x302842){return _0x302842!==_0xa477('0x1c');}function isCampaignIvr(_0x2b5be2){return _0x2b5be2===_0xa477('0x7c');}function getCallerId(_0x4dfb43,_0x58167b,_0x19da98){if(!_[_0xa477('0x3b')](_0x19da98)&&typeof _0x19da98===_0xa477('0x93')&&!_['isEmpty'](_0x19da98)){if(!_[_0xa477('0x3b')](_0x58167b)&&typeof _0x58167b==='string'&&!_['isEmpty'](_0x58167b)){return util[_0xa477('0x7d')]('\x22%s\x22\x20<%s>',_0x58167b,_0x19da98);}return util['format']('\x22%s\x22\x20<%s>',_0x19da98,_0x19da98);}if(!_[_0xa477('0x3b')](_0x4dfb43)&&typeof _0x4dfb43===_0xa477('0x93')&&!_[_0xa477('0x46')](_0x4dfb43)){return _0x4dfb43;}return _0xa477('0x94');}function loggerCatchQueueSummary(_0x5bcb39,_0x4283c1){return function(_0x4c8d23){freeVariablesPredictive(_0x4283c1);emitVoiceQueueSummary(_0x4283c1);emitCampaignSummary(_0x4283c1);loggerSyncQueueSummary[_0xa477('0x95')](_0x5bcb39,util[_0xa477('0x96')](_0x4c8d23,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1254fd,_0x4eb045){return function(_0x2b9139){loggerPredictive[_0xa477('0x95')](_0x4eb045[_0xa477('0x3e')],_0x1254fd);loggerPredictive['error'](_0x2b9139['stack']);freeVariablesPredictive(_0x4eb045);};}function loggerCatch(_0x4cd58a){return function(_0x5e62f1){logger[_0xa477('0x95')](_0x4cd58a,util[_0xa477('0x96')](_0x5e62f1,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x27d527){return _0x27d527&&!_[_0xa477('0x3b')](_0x27d527)&&_0x27d527[_0xa477('0x97')]>0x0;}function decremetOriginate(_0x19e411){if(!_['isUndefined'](_0x19e411)&&_0x19e411!==null){if(typeof _0x19e411[_0xa477('0x72')]!=='undefined'){if(_0x19e411[_0xa477('0x72')]>0x0){_0x19e411[_0xa477('0x72')]-=0x1;}else{logger[_0xa477('0x95')](_0xa477('0x98'));}}}else{logger[_0xa477('0x95')](_0xa477('0x99'));}}function checkContactLowerLimitOriginate(_0x1876ea,_0x2a0569,_0x31712){if(_0x2a0569>_0x31712){for(var _0x5e0955=0x0;_0x5e0955<_0x2a0569-_0x31712;_0x5e0955+=0x1){decremetOriginate(_0x1876ea);}}}function loggerGetContactDialer(_0x16fcec,_0x47be0a,_0x2b8d43){return function(_0x5136b0){checkContactLowerLimitOriginate(_0x47be0a,_0x2b8d43,0x0);logger[_0xa477('0x95')](_0x16fcec,util['inspect'](_0x5136b0,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2bbace){return function(_0x1f5323){if(isNotNull(_0x1f5323)&&isNotNull(_0x1f5323[0x0])){if(_0x1f5323[0x0][_0xa477('0x9a')]>0x0){_0x2bbace[_0xa477('0x3c')]='RESCHEDULED_CONTACTS';logger[_0xa477('0x7f')]('[getContactDialer2][ReScheduled]'+_0x2bbace[_0xa477('0x3e')],_0x1f5323[0x0][_0xa477('0x9a')],'contacts');}else{_0x2bbace[_0xa477('0x3c')]=_0xa477('0x9b');logger[_0xa477('0x7f')](_0xa477('0x9c')+_0x2bbace['name']);}}};}function notSendMessagesQueue(_0x450c9d){if(_0x450c9d[_0xa477('0x9d')]){freeVariablesPredictive(_0x450c9d);if(_0x450c9d[_0xa477('0x72')]===0x0&&_0x450c9d[_0xa477('0x55')]===0x0&&_0x450c9d[_0xa477('0x58')]===0x0&&(_0x450c9d[_0xa477('0x51')]||0x0)===0x0){_0x450c9d[_0xa477('0x9d')]=![];_0x450c9d['available']=0x0;_0x450c9d[_0xa477('0x3c')]=_0xa477('0x40');loggerSyncQueueSummary[_0xa477('0x95')](_0xa477('0x9e'),_0x450c9d['name'],_0xa477('0x9f'));}else{_0x450c9d[_0xa477('0x3c')]=_0xa477('0xa0');loggerSyncQueueSummary[_0xa477('0x95')](_0xa477('0x9e'),_0x450c9d[_0xa477('0x3e')],'is\x20disactive');}emitVoiceQueueSummary(_0x450c9d);}}function notSendMessagesCampaign(_0x4823d1){if(_0x4823d1[_0xa477('0x9d')]){if(_0x4823d1['originated']===0x0){_0x4823d1['sendMessageOneNotActive']=![];_0x4823d1[_0xa477('0x3c')]=_0xa477('0x40');loggerSyncQueueSummary[_0xa477('0x95')](_0xa477('0xa1'),_0x4823d1[_0xa477('0x3e')],_0xa477('0x9f'));}else{_0x4823d1[_0xa477('0x3c')]='IS_DISACTIVED';loggerSyncQueueSummary[_0xa477('0x95')](_0xa477('0xa1'),_0x4823d1[_0xa477('0x3e')],_0xa477('0xa2'));}emitCampaignSummary(_0x4823d1);}}function createObjHistory(_0x5249c1,_0x1582fa,_0x32a6e7,_0x24da8f,_0x3809c9){_0x5249c1['message']=_0x32a6e7;var _0x50009b=new Action(_0x5249c1,_0x1582fa);var _0x2976b8=new History(_0x50009b);_0x2976b8['state']=_0x24da8f;_0x2976b8[_0xa477('0xa3')]=_0x3809c9;_0x2976b8[_0xa477('0xa4')]=_0x50009b['starttime'];return _0x2976b8;}Dialer[_0xa477('0x18')]['loopClearZombieChannels']=function(){var _0x152ab9=this;setInterval(function(){_0x152ab9['clearZombieChannels'](_0x152ab9[_0xa477('0xa5')],'[uniqueid]');_0x152ab9[_0xa477('0xa6')](_0x152ab9[_0xa477('0x23')],_0xa477('0xa7'));},0x32c8);};Dialer[_0xa477('0x18')]['clearZombieChannels']=function(_0x5b8a60,_0x5a7b5b){var _0x5e8bd2=this;for(var _0x16761d in _0x5b8a60){if(typeof _0x5b8a60[_0x16761d]!=='undefined'){this['sequence'][_0xa477('0xa8')](function(){if(!_[_0xa477('0xa9')](_0x5b8a60[_0x16761d])){return ami[_0xa477('0xaa')]({'action':_0xa477('0xab'),'channel':_0x5b8a60[_0x16761d]['channel']})[_0xa477('0xac')](function(_0x68bc94){if(_0x68bc94['message']===_0xa477('0xad')){setTimeout(function(){if(_0x5b8a60[_0x16761d]&&_0x5b8a60[_0x16761d][_0xa477('0x4d')]!==_0xa477('0x7c')){_0x5e8bd2[_0xa477('0xae')](_0x5e8bd2[_0xa477('0x1d')][_0x5b8a60[_0x16761d][_0xa477('0xaf')]]);logger[_0xa477('0x95')](_0xa477('0xb0'),_0x5a7b5b,_0x16761d,_0x5b8a60[_0x16761d][_0xa477('0xaf')]);delete _0x5b8a60[_0x16761d];}if(_0x5b8a60[_0x16761d]&&_0x5b8a60[_0x16761d][_0xa477('0x4d')]===_0xa477('0x7c')){_0x5e8bd2['updateOriginated'](_0x5e8bd2[_0xa477('0x1e')][_0x5b8a60[_0x16761d][_0xa477('0xaf')]]);logger[_0xa477('0x95')]('[Dialer][checkChannel][ivr]',_0x5a7b5b,_0x16761d,_0x5b8a60[_0x16761d][_0xa477('0xaf')]);delete _0x5b8a60[_0x16761d];}},0x2328);}});}});}}};Dialer[_0xa477('0x18')]['countReScheduled']=function(_0x5abfa8){return BPromise[_0xa477('0xb1')]()[_0xa477('0xb2')](cmHopper[_0xa477('0xb3')](_0x5abfa8))['catch'](loggerCatch(_0xa477('0xb4')));};Dialer[_0xa477('0x18')][_0xa477('0xb5')]=function(_0x1925de){return BPromise[_0xa477('0xb1')]()[_0xa477('0xb2')](cmHopperBlack[_0xa477('0xb5')](_0x1925de))[_0xa477('0xac')](loggerCatch(_0xa477('0xb6')));};Dialer['prototype'][_0xa477('0xb7')]=function(_0x7dda9){return BPromise[_0xa477('0xb1')]()[_0xa477('0xb2')](cmHopperBlack['checkIsBlackListIvr'](_0x7dda9))[_0xa477('0xac')](loggerCatch(_0xa477('0xb8')));};Dialer['prototype'][_0xa477('0xb9')]=function(_0x45a402){return BPromise[_0xa477('0xb1')]()[_0xa477('0xb2')](cmHopperHistory[_0xa477('0xba')](_0x45a402))['catch'](loggerCatch(_0xa477('0xbb')));};Dialer[_0xa477('0x18')][_0xa477('0xbc')]=function(_0x5ac988){return BPromise[_0xa477('0xb1')]()[_0xa477('0xb2')](cmHopper['rescheduleContact'](_0x5ac988))[_0xa477('0xac')](loggerCatch(_0xa477('0xbd')));};Dialer[_0xa477('0x18')][_0xa477('0xbe')]=function(_0x2f483d,_0x3ef920,_0x1969fc){return BPromise[_0xa477('0xb1')]()['then'](cmHopper[_0xa477('0xbe')](_0x2f483d,_0x3ef920,_0x1969fc))[_0xa477('0xac')](loggerCatch(_0xa477('0xbf')));};Dialer[_0xa477('0x18')][_0xa477('0xc0')]=function(_0x2f6bef,_0x31ac04,_0x45249d,_0x26cf20,_0x56461d){return BPromise['resolve']()[_0xa477('0xb2')](cmHopper[_0xa477('0xc0')](_0x2f6bef,_0x31ac04,_0x45249d,_0x26cf20))[_0xa477('0xac')](function(_0x3ae1dc){_0x56461d['temp']-=_0x45249d;_0x56461d[_0xa477('0xc1')]=_0x56461d[_0xa477('0xc1')]>0x0?_0x56461d[_0xa477('0xc1')]:0x0;loggerCatch(_0xa477('0xc2'))(_0x3ae1dc);});};Dialer[_0xa477('0x18')][_0xa477('0xc3')]=function(_0x50780d,_0x4313b2,_0x2d247e,_0x17b320){return BPromise[_0xa477('0xb1')]()[_0xa477('0xb2')](cmHopper[_0xa477('0xc3')](_0x50780d,_0x4313b2,_0x2d247e))[_0xa477('0xac')](function(_0x5e8aea){_0x17b320[_0xa477('0xc1')]-=_0x4313b2;_0x17b320[_0xa477('0xc1')]=_0x17b320[_0xa477('0xc1')]>0x0?_0x17b320[_0xa477('0xc1')]:0x0;loggerCatch(_0xa477('0xc4'))(_0x5e8aea);});};Dialer[_0xa477('0x18')][_0xa477('0xc5')]=function(_0xabcf9f){return BPromise[_0xa477('0xb1')]()[_0xa477('0xb2')](voiceQueueRt[_0xa477('0xc5')](_0xabcf9f))[_0xa477('0xac')](loggerCatch(_0xa477('0xc6')));};Dialer[_0xa477('0x18')][_0xa477('0xc7')]=function(_0xcfb402){return BPromise[_0xa477('0xb1')]()['then'](cmHopper[_0xa477('0xc7')](_0xcfb402))[_0xa477('0xac')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer['prototype']['createHistory']=function(_0x22dd50){return BPromise[_0xa477('0xb1')]()[_0xa477('0xb2')](cmHopperHistory[_0xa477('0xc8')](_0x22dd50))[_0xa477('0xac')](loggerCatch(_0xa477('0xc9')));};Dialer[_0xa477('0x18')][_0xa477('0xae')]=function(_0x57c14b){if(!_[_0xa477('0x3b')](_0x57c14b)&&_0x57c14b!==null){if(typeof _0x57c14b[_0xa477('0x72')]!=='undefined'){if(_0x57c14b['originated']>0x0){_0x57c14b[_0xa477('0x72')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xa477('0x95')](_0xa477('0xca'));}};Dialer[_0xa477('0x18')][_0xa477('0xcb')]=function(_0x2f24f2,_0x39bf38){var _0x21e7a9=this;return function(_0x35af51){_0x21e7a9['updateOriginated'](_0x39bf38);logger[_0xa477('0x95')](_0x2f24f2,util['inspect'](_0x35af51,{'showHidden':![],'depth':null}));};};Dialer[_0xa477('0x18')][_0xa477('0xcc')]=function(_0x2ad463,_0x7c7ec3,_0x4cad63){var _0x46165b={'state':0x19,'statedesc':_0xa477('0xcd')};this[_0xa477('0xae')](_0x7c7ec3);this[_0xa477('0xce')](_[_0xa477('0x8f')](_0x46165b,_[_0xa477('0xcf')](_0x4cad63,['ContactId',_0xa477('0xd0'),_0xa477('0xd1'),'VoiceQueueId',_0xa477('0xd2')])),'[emptyContact][createHistory]',_0xa477('0xd3'));logger[_0xa477('0x95')](_0x2ad463);};Dialer[_0xa477('0x18')][_0xa477('0xd4')]=function(_0x49e7b9){return _0x49e7b9==='Success';};Dialer['prototype'][_0xa477('0xd5')]=function(_0x42eb66){return!_[_0xa477('0x3b')](_0x42eb66)&&_0x42eb66&&!_[_0xa477('0x3b')](_0x42eb66[_0xa477('0x3e')])&&!_[_0xa477('0x3b')](_0x42eb66[_0xa477('0x78')])&&_0x42eb66[_0xa477('0x78')]&&(this[_0xa477('0x20')][util[_0xa477('0x7d')]('SIP/%s',_0x42eb66[_0xa477('0x3e')])][_0xa477('0xab')]===_0xa477('0xd6')||this[_0xa477('0x20')][util[_0xa477('0x7d')](_0xa477('0xd7'),_0x42eb66[_0xa477('0x3e')])]['status']===_0xa477('0xd8'));};Dialer[_0xa477('0x18')]['saveInDb']=function(_0x15270a,_0x12c4b5,_0x5779e5){this[_0xa477('0xc8')](_0x15270a)[_0xa477('0xac')](loggerCatch(_0x12c4b5));this['moveContactManagedDialer'](_0x15270a)[_0xa477('0xac')](loggerCatch(_0x5779e5));};Dialer[_0xa477('0x18')][_0xa477('0x35')]=function(_0x29c21e){var _0x2ff4fa=this[_0xa477('0xa5')][_0x29c21e[_0xa477('0xd9')]];var _0x7ad1c;if(!_[_0xa477('0xa9')](_0x29c21e)&&!_[_0xa477('0xa9')](_0x29c21e[_0xa477('0xda')])&&!_[_0xa477('0xa9')](_0x29c21e['variable'][_0xa477('0xdb')])&&_0x29c21e[_0xa477('0xdc')]===_0xa477('0xdd')&&_0x2ff4fa){if(_0x2ff4fa['type']!=='ivr'&&this[_0xa477('0x1d')][_0x2ff4fa[_0xa477('0xaf')]][_0xa477('0xde')]&&_0x29c21e[_0xa477('0xdf')]===_0xa477('0xe0')){delete this[_0xa477('0xa5')][_0x29c21e['uniqueid']];this['updateOriginated'](this[_0xa477('0x1d')][_0x2ff4fa[_0xa477('0xaf')]]);this[_0xa477('0x1d')][_0x2ff4fa[_0xa477('0xaf')]][_0xa477('0x5e')]+=0x1;this[_0xa477('0x1d')][_0x2ff4fa[_0xa477('0xaf')]][_0xa477('0x5d')]+=0x1;_0x7ad1c=new Hangup(_0x2ff4fa,_0x29c21e);_0x7ad1c['state']=0x12;_0x7ad1c[_0xa477('0xa3')]='HangupInAMD';_0x7ad1c[_0xa477('0xe1')]=_0xa477('0xe2');ami[_0xa477('0xe3')](_0xa477('0xe4'),ut[_0xa477('0xe5')](_0x7ad1c,_0xa477('0xe6')));this['saveInDb'](_0x7ad1c,'[syncHangupInAMD][createHistory]',_0xa477('0xe7'));}if(_0x2ff4fa[_0xa477('0x4d')]!==_0xa477('0x7c')&&this[_0xa477('0x1d')][_0x2ff4fa['queue']]['dialAMDActive']&&_0x29c21e[_0xa477('0xdf')]==='MACHINE'){var _0x5728f4=this;return new BPromise(function(_0x615a53,_0x442639){delete _0x5728f4[_0xa477('0xa5')][_0x29c21e['uniqueid']];_0x5728f4[_0xa477('0xae')](_0x5728f4['voiceQueues'][_0x2ff4fa[_0xa477('0xaf')]]);_0x5728f4[_0xa477('0x1d')][_0x2ff4fa[_0xa477('0xaf')]][_0xa477('0x5e')]+=0x1;_0x5728f4[_0xa477('0x1d')][_0x2ff4fa[_0xa477('0xaf')]][_0xa477('0x5d')]+=0x1;var _0x98652d=_0x5728f4[_0xa477('0x1d')][_0x2ff4fa['queue']];var _0x5efd75=new Hangup(_0x2ff4fa,_0x29c21e);_0x5efd75['state']=0x13;_0x5efd75[_0xa477('0xa3')]='Machine';_0x5efd75[_0xa477('0xe1')]=_0xa477('0xe2');_0x5efd75[_0xa477('0xe8')]+=0x1;_0x5efd75['countglobal']+=0x1;_0x5efd75[_0xa477('0xe6')]=!![];ami[_0xa477('0xe3')](_0xa477('0xe4'),ut[_0xa477('0xe5')](_0x5efd75,'amd'));_0x5728f4[_0xa477('0xc8')](_0x5efd75)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x5efd75[_0xa477('0xe9')]+_0x5efd75[_0xa477('0xea')]+_0x5efd75[_0xa477('0xeb')]+_0x5efd75[_0xa477('0xec')]+_0x5efd75['countdropretry']+_0x5efd75[_0xa477('0xed')]+_0x5efd75[_0xa477('0xe8')]+_0x5efd75[_0xa477('0xee')]>=_0x98652d[_0xa477('0xef')]){_0x5728f4[_0xa477('0xf0')](_0x5efd75,_0x615a53,_0x442639,_0xa477('0xf1'));}else{if(_0x5efd75[_0xa477('0xe8')]>=_0x98652d[_0xa477('0xf2')]){_0x5728f4[_0xa477('0xf3')](_0x5efd75,_0x615a53,_0x442639,_0xa477('0xf4'));}else{_0x5728f4['rescheduleContact']({'active':![],'countmachineretry':_0x5efd75[_0xa477('0xe8')],'scheduledat':moment()['add'](_0x98652d[_0xa477('0xf5')],_0xa477('0xf6'))[_0xa477('0x7d')](_0xa477('0xf7')),'ContactId':_0x5efd75[_0xa477('0xf8')],'ListId':_0x5efd75[_0xa477('0xd0')],'VoiceQueueId':_0x5efd75['VoiceQueueId']||undefined,'CampaignId':_0x5efd75[_0xa477('0xd2')]||undefined})[_0xa477('0xac')](loggerCatch('[rescheduleContact][Machine]'));_0x615a53({'reschedule':0x1});}}});}if(_0x2ff4fa['type']===_0xa477('0x7c')&&this['campaigns'][_0x2ff4fa['queue']]['dialAMDActive']&&_0x29c21e[_0xa477('0xdf')]===_0xa477('0xe0')){delete this[_0xa477('0xa5')][_0x29c21e[_0xa477('0xd9')]];this[_0xa477('0xae')](this[_0xa477('0x1e')][_0x2ff4fa['queue']]);_0x7ad1c=new Hangup(_0x2ff4fa,_0x29c21e);_0x7ad1c[_0xa477('0xf9')]=0x12;_0x7ad1c[_0xa477('0xa3')]=_0xa477('0xfa');_0x7ad1c[_0xa477('0xe1')]=_0xa477('0xe2');ami[_0xa477('0xe3')](_0xa477('0xe4'),ut['buildObj'](_0x7ad1c,'amd'));this[_0xa477('0xce')](_0x7ad1c,_0xa477('0xfb'),_0xa477('0xfc'));}if(_0x2ff4fa[_0xa477('0x4d')]===_0xa477('0x7c')&&this[_0xa477('0x1e')][_0x2ff4fa[_0xa477('0xaf')]][_0xa477('0xde')]&&_0x29c21e['value']===_0xa477('0xfd')){var _0x5728f4=this;return new BPromise(function(_0x58c3b2,_0x41705d){delete _0x5728f4[_0xa477('0xa5')][_0x29c21e[_0xa477('0xd9')]];_0x5728f4[_0xa477('0xae')](_0x5728f4[_0xa477('0x1e')][_0x2ff4fa[_0xa477('0xaf')]]);_0x5728f4[_0xa477('0x1e')][_0x2ff4fa[_0xa477('0xaf')]][_0xa477('0x5e')]+=0x1;_0x5728f4[_0xa477('0x1e')][_0x2ff4fa['queue']][_0xa477('0x5d')]+=0x1;var _0x3108c8=_0x5728f4[_0xa477('0x1e')][_0x2ff4fa[_0xa477('0xaf')]];var _0x234777=new Hangup(_0x2ff4fa,_0x29c21e);_0x234777[_0xa477('0xf9')]=0x13;_0x234777[_0xa477('0xa3')]='Machine';_0x234777[_0xa477('0xe1')]=_0xa477('0xe2');_0x234777[_0xa477('0xe8')]+=0x1;_0x234777[_0xa477('0xfe')]+=0x1;_0x234777[_0xa477('0xe6')]=!![];ami[_0xa477('0xe3')](_0xa477('0xe4'),ut[_0xa477('0xe5')](_0x234777,_0xa477('0xe6')));_0x5728f4[_0xa477('0xc8')](_0x234777)[_0xa477('0xac')](loggerCatch(_0xa477('0xff')));if(_0x234777['countbusyretry']+_0x234777['countcongestionretry']+_0x234777[_0xa477('0xeb')]+_0x234777['countnosuchnumberretry']+_0x234777[_0xa477('0x100')]+_0x234777['countabandonedretry']+_0x234777[_0xa477('0xe8')]+_0x234777[_0xa477('0xee')]>=_0x3108c8[_0xa477('0xef')]){_0x5728f4[_0xa477('0xf0')](_0x234777,_0x58c3b2,_0x41705d,'reason19\x20machine....');}else{if(_0x234777[_0xa477('0xe8')]>=_0x3108c8[_0xa477('0xf2')]){_0x5728f4[_0xa477('0xf3')](_0x234777,_0x58c3b2,_0x41705d,'reason\x2019\x20machine....');}else{_0x5728f4['rescheduleContact']({'active':![],'countmachineretry':_0x234777[_0xa477('0xe8')],'scheduledat':moment()[_0xa477('0x101')](_0x3108c8[_0xa477('0xf5')],_0xa477('0xf6'))[_0xa477('0x7d')](_0xa477('0xf7')),'ContactId':_0x234777['ContactId'],'ListId':_0x234777[_0xa477('0xd0')],'VoiceQueueId':_0x234777[_0xa477('0x102')]||undefined,'CampaignId':_0x234777['CampaignId']||undefined})[_0xa477('0xac')](loggerCatch(_0xa477('0x103')));_0x58c3b2({'reschedule':0x1});}}});}}};Dialer[_0xa477('0x18')][_0xa477('0x32')]=function(_0x320a42){var _0x1d1e73=this[_0xa477('0xa5')][_0x320a42[_0xa477('0xd9')]];var _0x184674=this;var _0x3ab421;if(_0x1d1e73&&_0x1d1e73[_0xa477('0x4d')]===_0xa477('0x7c')){delete this[_0xa477('0xa5')][_0x320a42[_0xa477('0xd9')]];this['updateOriginated'](this[_0xa477('0x1e')][_0x1d1e73['queue']]);this[_0xa477('0x1e')][_0x1d1e73['queue']][_0xa477('0x104')]+=0x1;_0x3ab421=new Hangup(_0x1d1e73,_0x320a42);this[_0xa477('0xc8')](_0x3ab421)[_0xa477('0xac')](loggerCatch(_0xa477('0x105')));this[_0xa477('0xc7')](_0x3ab421)['catch'](loggerCatch(_0xa477('0x106')));}if(_0x1d1e73&&_0x1d1e73[_0xa477('0x4d')]!==_0xa477('0x7c')&&isNotNull(this[_0xa477('0x1d')][_0x1d1e73['queue']]['dialQueueProject'])){delete this[_0xa477('0xa5')][_0x320a42['uniqueid']];this[_0xa477('0xae')](this['voiceQueues'][_0x1d1e73[_0xa477('0xaf')]]);this['voiceQueues'][_0x1d1e73[_0xa477('0xaf')]]['outboundAnswerCallsDay']+=0x1;this[_0xa477('0x1d')][_0x1d1e73[_0xa477('0xaf')]][_0xa477('0x5d')]+=0x1;_0x3ab421=new Hangup(_0x1d1e73,_0x320a42);_0x3ab421[_0xa477('0xf9')]=0x10;_0x3ab421[_0xa477('0xa3')]=_0xa477('0x107');_0x3ab421['membername']='AGI';this[_0xa477('0xc8')](_0x3ab421)[_0xa477('0xac')](loggerCatch(_0xa477('0x105')));this['moveContactManagedDialer'](_0x3ab421)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x1d1e73&&_0x1d1e73['type']!==_0xa477('0x7c')&&!isNotNull(this[_0xa477('0x1d')][_0x1d1e73[_0xa477('0xaf')]][_0xa477('0x108')])){delete this['uniqueId'][_0x320a42[_0xa477('0xd9')]];this[_0xa477('0xae')](this[_0xa477('0x1d')][_0x1d1e73[_0xa477('0xaf')]]);this[_0xa477('0x1d')][_0x1d1e73['queue']][_0xa477('0x109')]+=0x1;_0x3ab421=new Hangup(_0x1d1e73,_0x320a42);_0x3ab421[_0xa477('0xf9')]=0xc;_0x3ab421['statedesc']=_0x320a42[_0xa477('0x10a')];_0x3ab421[_0xa477('0xe1')]='Unknow';this['createHistory'](_0x3ab421)[_0xa477('0xac')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xa477('0xc7')](_0x3ab421)[_0xa477('0xac')](loggerCatch(_0xa477('0x106')));}};Dialer[_0xa477('0x18')][_0xa477('0x2f')]=function(_0xeb5443){var _0x35d978=this[_0xa477('0xa5')][_0xeb5443[_0xa477('0xd9')]];var _0x26545b=this;if(this[_0xa477('0x1d')][_0xeb5443[_0xa477('0xaf')]]){if(_0x35d978&&_0x35d978[_0xa477('0x4d')]!==_0xa477('0x7c')){delete this[_0xa477('0xa5')][_0xeb5443[_0xa477('0xd9')]];this['voiceQueues'][_0xeb5443[_0xa477('0xaf')]][_0xa477('0x5e')]+=0x1;var _0x27b967=new AgentComplete(_0x35d978,_0xeb5443);if(_0xeb5443[_0xa477('0x10b')]==='agent'){_0x27b967[_0xa477('0x10c')]=this[_0xa477('0x1d')][_0xeb5443[_0xa477('0xaf')]][_0xa477('0x10d')]&&this['voiceQueues'][_0xeb5443['queue']]['dialAgiAfterHangupAgent']?moment()[_0xa477('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0xa477('0xc8')](_0x27b967)['catch'](loggerCatch(_0xa477('0x10e')));this[_0xa477('0xc7')](_0x27b967)[_0xa477('0xac')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xa477('0x18')][_0xa477('0x29')]=function(_0x36217){if(this[_0xa477('0x1d')][_0x36217[_0xa477('0xaf')]]){if(this[_0xa477('0xa5')][_0x36217[_0xa477('0xd9')]]&&this[_0xa477('0xa5')][_0x36217[_0xa477('0xd9')]][_0xa477('0x4d')]!==_0xa477('0x7c')){this[_0xa477('0xae')](this[_0xa477('0x1d')][_0x36217[_0xa477('0xaf')]]);this['uniqueId'][_0x36217[_0xa477('0xd9')]][_0xa477('0x10f')]=moment()['format'](_0xa477('0xf7'));}}};Dialer[_0xa477('0x18')]['queueCallerAbandonCreateState']=function(_0x2b32a8){this[_0xa477('0xc8')](_0x2b32a8)['catch'](loggerCatch(_0xa477('0x10e')));this[_0xa477('0xc7')](_0x2b32a8)[_0xa477('0xac')](loggerCatch(_0xa477('0x110')));};Dialer[_0xa477('0x18')][_0xa477('0x111')]=function(_0x4072c8){var _0x42346b=this['uniqueId'][_0x4072c8['uniqueid']];var _0x30ab90=this;if(this[_0xa477('0x1d')][_0x4072c8['queue']]){if(_0x42346b&&_0x42346b[_0xa477('0x4d')]!==_0xa477('0x7c')){delete this[_0xa477('0xa5')][_0x4072c8[_0xa477('0xd9')]];this[_0xa477('0xae')](this[_0xa477('0x1d')][_0x4072c8[_0xa477('0xaf')]]);_0x42346b[_0xa477('0x112')]=moment()[_0xa477('0x7d')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3d5d76=new QueueCallerAbandon(_0x42346b,_0x4072c8);if(getSeconds(_0x42346b['droptime'],_0x42346b[_0xa477('0x113')])>=_0x42346b['dialQueueTimeout']){this[_0xa477('0x1d')][_0x4072c8[_0xa477('0xaf')]][_0xa477('0x6d')]+=0x1;this[_0xa477('0x1d')][_0x4072c8[_0xa477('0xaf')]][_0xa477('0x63')]+=0x1;this[_0xa477('0x1d')][_0x4072c8['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x3d5d76['state']=0xa;_0x3d5d76[_0xa477('0xa3')]=_0xa477('0x114');_0x3d5d76[_0xa477('0x115')]=_0xa477('0x116');_0x3d5d76['agiafterat']=this[_0xa477('0x1d')][_0x4072c8[_0xa477('0xaf')]][_0xa477('0x10d')]?moment()[_0xa477('0x7d')](_0xa477('0xf7')):undefined;_0x3d5d76[_0xa477('0x100')]+=0x1;_0x3d5d76['countglobal']+=0x1;if(_0x3d5d76[_0xa477('0x100')]>=this['voiceQueues'][_0x4072c8[_0xa477('0xaf')]][_0xa477('0x117')]){this[_0xa477('0x118')](_0x3d5d76);}else{this[_0xa477('0xbc')]({'active':![],'countdropretry':_0x3d5d76['countdropretry'],'scheduledat':moment()[_0xa477('0x101')](this[_0xa477('0x1d')][_0x4072c8[_0xa477('0xaf')]][_0xa477('0x119')],_0xa477('0xf6'))[_0xa477('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x42346b[_0xa477('0xf8')],'ListId':_0x42346b['ListId'],'VoiceQueueId':_0x42346b[_0xa477('0x102')]||undefined,'CampaignId':_0x42346b[_0xa477('0xd2')]||undefined})[_0xa477('0xac')](loggerCatch('[rescheduleContact][Drop]'));var _0x1e2e53=new History(_0x3d5d76);_0x1e2e53[_0xa477('0xf9')]=0xa;_0x1e2e53[_0xa477('0xa3')]=_0xa477('0x114');_0x1e2e53['starttime']=moment()['format'](_0xa477('0xf7'));_0x1e2e53[_0xa477('0xa4')]=_0x1e2e53['starttime'];_0x1e2e53['calleridname']=_0x3d5d76[_0xa477('0x11a')];_0x1e2e53[_0xa477('0x11b')]=_0x3d5d76['calleridnum'];this['createHistory'](_0x1e2e53)[_0xa477('0xac')](loggerCatch(_0xa477('0x11c')));}}else{this[_0xa477('0x1d')][_0x4072c8[_0xa477('0xaf')]][_0xa477('0x6c')]+=0x1;this[_0xa477('0x1d')][_0x4072c8[_0xa477('0xaf')]][_0xa477('0x62')]+=0x1;_0x3d5d76[_0xa477('0xf9')]=0xb;_0x3d5d76[_0xa477('0xa3')]=_0xa477('0x11d');_0x3d5d76[_0xa477('0x115')]=_0xa477('0x11e');_0x3d5d76[_0xa477('0xed')]+=0x1;_0x3d5d76[_0xa477('0xfe')]+=0x1;if(_0x3d5d76[_0xa477('0xed')]>=this[_0xa477('0x1d')][_0x4072c8[_0xa477('0xaf')]]['dialAbandonedMaxRetry']){this[_0xa477('0x118')](_0x3d5d76);}else{this[_0xa477('0xbc')]({'active':![],'countabandonedretry':_0x3d5d76[_0xa477('0xed')],'scheduledat':moment()['add'](this['voiceQueues'][_0x4072c8[_0xa477('0xaf')]][_0xa477('0x11f')],_0xa477('0xf6'))[_0xa477('0x7d')](_0xa477('0xf7')),'ContactId':_0x42346b[_0xa477('0xf8')],'ListId':_0x42346b['ListId'],'VoiceQueueId':_0x42346b[_0xa477('0x102')]||undefined,'CampaignId':_0x42346b[_0xa477('0xd2')]||undefined})[_0xa477('0xac')](loggerCatch(_0xa477('0x120')));var _0x1e2e53=new History(_0x3d5d76);_0x1e2e53[_0xa477('0xf9')]=0xb;_0x1e2e53[_0xa477('0xa3')]='Abandoned';_0x1e2e53[_0xa477('0x121')]=moment()[_0xa477('0x7d')](_0xa477('0xf7'));_0x1e2e53[_0xa477('0xa4')]=_0x1e2e53[_0xa477('0x121')];_0x1e2e53[_0xa477('0x11a')]=_0x3d5d76['calleridname'];_0x1e2e53['calleridnum']=_0x3d5d76['calleridnum'];this[_0xa477('0xc8')](_0x1e2e53)[_0xa477('0xac')](loggerCatch(_0xa477('0x122')));}}}}};Dialer['prototype']['syncNewExten']=function(_0x3f7e42){if(this['actions'][_0x3f7e42[_0xa477('0xd9')]]){this[_0xa477('0x23')][_0x3f7e42[_0xa477('0xd9')]][_0xa477('0x123')]=_0x3f7e42[_0xa477('0x123')];}if(this[_0xa477('0xa5')][_0x3f7e42[_0xa477('0xd9')]]){this[_0xa477('0xa5')][_0x3f7e42['uniqueid']]['channel']=_0x3f7e42[_0xa477('0x123')];}};Dialer[_0xa477('0x18')][_0xa477('0x37')]=function(_0x323ceb){if(strategy[this[_0xa477('0x1d')][this[_0xa477('0x23')][_0x323ceb['actionid']][_0xa477('0xaf')]][_0xa477('0x124')]]===_0xa477('0x17')){if(this['actions'][_0x323ceb[_0xa477('0x125')]]&&_[_0xa477('0xa9')](this[_0xa477('0x23')][_0x323ceb[_0xa477('0x125')]]['locked'])&&_0x323ceb[_0xa477('0xab')]==='1'&&_0x323ceb[_0xa477('0x126')]==='0'){if(this['agents'][_0x323ceb[_0xa477('0x127')]]){if(!this[_0xa477('0x1f')][_0x323ceb[_0xa477('0x127')]][_0xa477('0x128')]){this[_0xa477('0x1f')][_0x323ceb['stateinterface']][_0xa477('0x128')]=!![];this[_0xa477('0x23')][_0x323ceb[_0xa477('0x125')]][_0xa477('0x128')]=!![];this['actions'][_0x323ceb[_0xa477('0x125')]][_0xa477('0x127')]=_0x323ceb[_0xa477('0x127')];}}}}else if((strategy[this['voiceQueues'][this['actions'][_0x323ceb['actionid']]['queue']][_0xa477('0x124')]]||'rrmemory')===_0xa477('0x16')){if(this[_0xa477('0x23')][_0x323ceb[_0xa477('0x125')]]){if(this[_0xa477('0x1f')][_0x323ceb[_0xa477('0x127')]]){this['actions'][_0x323ceb[_0xa477('0x125')]][_0xa477('0x127')]=_0x323ceb[_0xa477('0x127')];if(_[_0xa477('0xa9')](this[_0xa477('0x129')][this[_0xa477('0x23')][_0x323ceb[_0xa477('0x125')]][_0xa477('0xaf')]])){this[_0xa477('0x129')][this[_0xa477('0x23')][_0x323ceb[_0xa477('0x125')]][_0xa477('0xaf')]]=[];}this[_0xa477('0x129')][this[_0xa477('0x23')][_0x323ceb[_0xa477('0x125')]]['queue']]['push'](_[_0xa477('0x8f')](_[_0xa477('0xcf')](this[_0xa477('0x23')][_0x323ceb['actionid']],[_0xa477('0x12a'),'stateinterface']),{'status':_0x323ceb['status'],'paused':_0x323ceb[_0xa477('0x126')]}));}}}};function unlockQueueStatus(_0x522e3c,_0x3ab039){setTimeout(function(){if(_[_0xa477('0x3b')](_0x522e3c[_0xa477('0x12b')])){loggerBooked[_0xa477('0x95')](_0xa477('0x12c'),_0x3ab039);}_0x522e3c[_0xa477('0x12b')]=!![];loggerBooked[_0xa477('0x7f')](_0xa477('0x12d'),_0x3ab039,JSON[_0xa477('0x49')](_[_0xa477('0xcf')](_0x522e3c,[_0xa477('0x3e'),_0xa477('0x12b')])));},0x1f3);}Dialer['prototype']['syncQueueStatusComplete']=function(_0x4f6386){var _0x25edd3=this;var _0x26d1bc=_0x25edd3['voiceQueues'][_0x25edd3[_0xa477('0x23')][_0x4f6386[_0xa477('0x125')]][_0xa477('0xaf')]];if(strategy[this[_0xa477('0x1d')][this[_0xa477('0x23')][_0x4f6386[_0xa477('0x125')]][_0xa477('0xaf')]][_0xa477('0x124')]]===_0xa477('0x17')){if(this['actions'][_0x4f6386[_0xa477('0x125')]]&&this[_0xa477('0x23')][_0x4f6386[_0xa477('0x125')]]['stateinterface']){this[_0xa477('0x1c')]['run'](this[_0xa477('0x23')][_0x4f6386['actionid']][_0xa477('0x12a')],this[_0xa477('0x23')][_0x4f6386['actionid']]['stateinterface'])['catch'](function(_0x219af4){logger[_0xa477('0x95')](_0xa477('0x12e'),util[_0xa477('0x96')](_0x219af4,{'showHidden':![],'depth':null}));})['finally'](function(){_0x25edd3[_0xa477('0xae')](_0x25edd3[_0xa477('0x1d')][_0x25edd3[_0xa477('0x23')][_0x4f6386[_0xa477('0x125')]][_0xa477('0xaf')]]);_0x25edd3[_0xa477('0x1f')][_0x25edd3['actions'][_0x4f6386[_0xa477('0x125')]]['stateinterface']]['locked']=![];delete _0x25edd3[_0xa477('0x23')][_0x4f6386['actionid']];unlockQueueStatus(_0x26d1bc);});}else{this[_0xa477('0xae')](this[_0xa477('0x1d')][this[_0xa477('0x23')][_0x4f6386[_0xa477('0x125')]]['queue']]);this[_0xa477('0xbc')]({'active':![],'ContactId':this[_0xa477('0x23')][_0x4f6386['actionid']][_0xa477('0xf8')],'ListId':this[_0xa477('0x23')][_0x4f6386[_0xa477('0x125')]][_0xa477('0xd0')],'VoiceQueueId':this[_0xa477('0x23')][_0x4f6386[_0xa477('0x125')]][_0xa477('0x102')]||undefined,'CampaignId':this['actions'][_0x4f6386[_0xa477('0x125')]][_0xa477('0xd2')]||undefined})[_0xa477('0xac')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xa477('0x23')][_0x4f6386[_0xa477('0x125')]];unlockQueueStatus(_0x26d1bc);}}else if((strategy[this['voiceQueues'][this[_0xa477('0x23')][_0x4f6386['actionid']][_0xa477('0xaf')]]['strategy']]||_0xa477('0x16'))===_0xa477('0x16')){var _0x47130e;if(this[_0xa477('0x23')][_0x4f6386[_0xa477('0x125')]]&&!_[_0xa477('0x46')](this[_0xa477('0x129')][this[_0xa477('0x23')][_0x4f6386['actionid']][_0xa477('0xaf')]])){if(this[_0xa477('0x12f')][_0x25edd3[_0xa477('0x23')][_0x4f6386[_0xa477('0x125')]]['queue']]){this[_0xa477('0x12f')][_0x25edd3[_0xa477('0x23')][_0x4f6386[_0xa477('0x125')]][_0xa477('0xaf')]]=this[_0xa477('0x12f')][this['actions'][_0x4f6386[_0xa477('0x125')]][_0xa477('0xaf')]]?this[_0xa477('0x12f')][this[_0xa477('0x23')][_0x4f6386['actionid']][_0xa477('0xaf')]]:this[_0xa477('0x129')][this[_0xa477('0x23')][_0x4f6386[_0xa477('0x125')]][_0xa477('0xaf')]]?this[_0xa477('0x129')][this[_0xa477('0x23')][_0x4f6386['actionid']][_0xa477('0xaf')]][_0xa477('0x130')]||0x0:0x0;}this[_0xa477('0x129')][this[_0xa477('0x23')][_0x4f6386[_0xa477('0x125')]][_0xa477('0xaf')]]['_rr']=this[_0xa477('0x12f')][this[_0xa477('0x23')][_0x4f6386[_0xa477('0x125')]]['queue']];for(var _0x297082=0x0;_0x297082=0x0;})['catch'](myreject(_0x42be0d)));}}else{_0x5cfead[_0xa477('0x148')](ami[_0xa477('0xaa')]({'action':_0xa477('0x149'),'command':util[_0xa477('0x7d')](_0xa477('0x14a'),_0x28ec72,!_['isUndefined'](config[_0xa477('0x144')][_0x1f7074])?_0x1f7074:'')})[_0xa477('0xb2')](function(_0x3444ff){return _0x3444ff['content'][_0xa477('0x14c')]('true')>=0x0;})[_0xa477('0xac')](myreject(_0x42be0d)));}BPromise[_0xa477('0x14e')](_0x5cfead)[_0xa477('0xb2')](function(_0x4940a8){var _0x4778fa=_[_0xa477('0x14f')](_0x4940a8);if(_0x4778fa){return _0x3964c3(_0x4778fa);}else{_0x24fd9d[_0xa477('0x3c')]=_0x27fca1?'GLOBAL_INTERVAL_IS_OVERTIME':_0xa477('0x150');return _0x42be0d(msgResponse(_0xa477('0x151'),_0xa477('0x140'),'Global:\x20'+_0x27fca1+'\x20'+_0x2628a7+'\x20Interval\x20is\x20overtime:\x20'+util[_0xa477('0x96')](_0x28ec72,{'showHidden':![],'depth':null})+_0xa477('0x152')+_0x1f7074));}})[_0xa477('0xac')](function(_0x13f18b){return _0x42be0d(msgResponse('ifTime','Failure',JSON[_0xa477('0x49')](_0x13f18b)));});});};Dialer[_0xa477('0x18')][_0xa477('0x153')]=function(_0x3a5068){var _0x11b35f=this;return function(){switch(_0x3a5068[_0xa477('0x5a')]){case _0xa477('0x154'):freeVariablesPredictive(_0x3a5068);_0x11b35f[_0xa477('0x155')](_0x3a5068,0x1);break;case _0xa477('0x156'):freeVariablesPredictive(_0x3a5068);_0x11b35f[_0xa477('0x155')](_0x3a5068,_0x3a5068['dialPowerLevel']);break;case'predictive':_0x11b35f[_0xa477('0x8')](_0x3a5068);break;case _0xa477('0x7'):freeVariablesPredictive(_0x3a5068);_0x11b35f['handlePower'](_0x3a5068,0x1);break;default:freeVariablesPredictive(_0x3a5068);logger['error'](_0xa477('0x157'),_0x3a5068[_0xa477('0x3e')],_0xa477('0x158'));}};};Dialer[_0xa477('0x18')][_0xa477('0x159')]=function(_0x2ff091){var _0x893917=this;return function(){_0x893917['handleIvr'](_0x2ff091);};};Dialer[_0xa477('0x18')][_0xa477('0xa')]=function(_0x3a5c7c){var _0x1bea47=this;if(isNotPreview(_0x3a5c7c['dialMethod'])){if(isVoiceQueueOutbound(_0x3a5c7c['type'])&&isActive(_0x3a5c7c[_0xa477('0x15a')])){_0x3a5c7c['sendMessageOneNotActive']=!![];BPromise['resolve']()[_0xa477('0xb2')](checkIsLoggedIn(_0x3a5c7c,_0x3a5c7c[_0xa477('0x50')]))['then'](checkIsActive(_0x3a5c7c,_0x3a5c7c[_0xa477('0x15a')]))['then'](checkInterval(_0x3a5c7c))[_0xa477('0xb2')](_0x1bea47[_0xa477('0x15b')](_0x3a5c7c))[_0xa477('0xb2')](_0x1bea47[_0xa477('0x13d')](_0x3a5c7c[_0xa477('0x15c')],_0x3a5c7c[_0xa477('0x15d')],_0x3a5c7c[_0xa477('0x3e')],_0x3a5c7c))[_0xa477('0xb2')](_0x1bea47[_0xa477('0x13f')](_0x3a5c7c['Interval'],_0x3a5c7c[_0xa477('0x15d')],_0x3a5c7c[_0xa477('0x3e')],_0x3a5c7c))[_0xa477('0xb2')](_0x1bea47[_0xa477('0x153')](_0x3a5c7c))[_0xa477('0xac')](loggerCatchQueueSummary(_0xa477('0x15e'),_0x3a5c7c));}else{notSendMessagesQueue(_0x3a5c7c);}}else{freeVariablesPredictive(_0x3a5c7c);}};Dialer[_0xa477('0x18')][_0xa477('0x15f')]=function(){var _0x257a96=this;var _0x4a65b7;for(var _0x68a102 in this[_0xa477('0x1e')]){if(typeof this['campaigns'][_0x68a102]!==_0xa477('0x160')){_0x4a65b7=this[_0xa477('0x1e')][_0x68a102];if(isCampaignIvr(_0x4a65b7[_0xa477('0x4d')])&&isActive(_0x4a65b7['active'])){_0x4a65b7['sendMessageOneNotActive']=!![];BPromise[_0xa477('0xb1')]()['then'](checkIsActive(_0x4a65b7,_0x4a65b7[_0xa477('0x78')]))[_0xa477('0xb2')](checkInterval(_0x4a65b7))[_0xa477('0xb2')](_0x257a96[_0xa477('0x15b')](_0x4a65b7))[_0xa477('0xb2')](_0x257a96['checkIfTime'](_0x4a65b7[_0xa477('0x15c')],_0x4a65b7[_0xa477('0x15d')],_0x4a65b7[_0xa477('0x3e')],_0x4a65b7))[_0xa477('0xb2')](_0x257a96[_0xa477('0x13f')](_0x4a65b7['Interval'],_0x4a65b7[_0xa477('0x15d')],_0x4a65b7['name'],_0x4a65b7))[_0xa477('0xb2')](_0x257a96[_0xa477('0x159')](_0x4a65b7))[_0xa477('0xac')](loggerCatchQueueSummary(_0xa477('0x161'),_0x4a65b7));}else{notSendMessagesCampaign(_0x4a65b7);}}}};function getCallerIdRandom(_0x2096f7,_0x1b1028){var _0x179778;var _0x18b6f3;var _0x13e9cb;if(_0x1b1028<=0x0){_0x1b1028=0x1;}_0x179778=new RegExp(_0xa477('0x162')+_0x1b1028+'}$');_0x18b6f3=Math[_0xa477('0x163')](0xa,_0x1b1028-0x1);_0x13e9cb=Math[_0xa477('0x163')](0xa,_0x1b1028)-0x1;return util[_0xa477('0x7d')]('%s',_[_0xa477('0x164')](_0x2096f7,_0x179778,_['random'](_0x18b6f3,_0x13e9cb)));}function extractCalleridName(_0x36a3a3){var _0x288778=_0x36a3a3[_0xa477('0x165')](/"(.*?)"/);return _0x288778?_0x288778[0x1]:_0x36a3a3;}function extractCalleridNumber(_0x30d7f7){var _0x3bffe4=_0x30d7f7['match'](/<(.*?)>/);return _0x3bffe4?_0x3bffe4[0x1]:_0x30d7f7;}Dialer[_0xa477('0x18')][_0xa477('0x166')]=function(_0x2e8649,_0x3e2e95){var _0x108c08=this;var _0x5914b8=uuid['v4']();this[_0xa477('0x23')][_0x5914b8]=new Action(_0x2e8649,_0x3e2e95,_0x5914b8);return new BPromise(function(_0x4924a5,_0x2a043c){if(_[_0xa477('0x3b')](_0x2e8649)&&typeof _0x2e8649!==_0xa477('0x167')){return _0x2a043c(msgResponse(_0xa477('0x168'),_0xa477('0x140'),'voiceQueue\x20is\x20undefine'));}if(_[_0xa477('0x3b')](_0x3e2e95[_0xa477('0x169')][_0xa477('0x16a')])||_0x3e2e95[_0xa477('0x169')][_0xa477('0x16a')]===null){return _0x2a043c(msgResponse(_0xa477('0x168'),_0xa477('0x140'),_0xa477('0x16b')));}var _0x5d33d7={'XMD-CALLERID':_0x108c08[_0xa477('0x23')][_0x5914b8]['getCaller'](),'XMD-AGI':_0x2e8649[_0xa477('0x108')]?util['format'](_0xa477('0x16c'),ipAgi,_0x2e8649['dialQueueProject']):_0xa477('0x16d'),'XMD-AGIAFTER':_0x2e8649['dialQueueProject2']?util['format'](_0xa477('0x16c'),ipAgi,_0x2e8649[_0xa477('0x10d')]):_0xa477('0x16d'),'XMD-QUEUE':_0x2e8649[_0xa477('0x4d')]===_0xa477('0x4e')?util[_0xa477('0x7d')](_0xa477('0x16e'),_0x2e8649[_0xa477('0x3e')],_0x2e8649[_0xa477('0x16f')]||'',_0x2e8649['dialAgiAfterHangupAgent']?'c':'',_0x2e8649[_0xa477('0x170')]||0x3):'NONE','XMD-CONTACTID':_0x3e2e95['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x108c08['actions'][_0x5914b8][_0xa477('0x171')](),'XMD-AMD':_0x2e8649[_0xa477('0xde')]?'ACTIVE':_0xa477('0x16d'),'XMD-DESTINATION':_0xa477('0xdd')};if(_0x2e8649[_0xa477('0xde')]){_0x5d33d7['XMD-AMDINITIALSILENCE']=_0x2e8649['dialAMDInitialSilence']||0x9c4;_0x5d33d7['XMD-AMDGREETING']=_0x2e8649['dialAMDGreeting']||0x5dc;_0x5d33d7['XMD-AMDAFTERGREETINGSILENCE']=_0x2e8649[_0xa477('0x172')]||0x320;_0x5d33d7['XMD-AMDTOTALANALYSISTIME']=_0x2e8649[_0xa477('0x173')]||0x1388;_0x5d33d7[_0xa477('0x174')]=_0x2e8649[_0xa477('0x175')]||0x64;_0x5d33d7[_0xa477('0x176')]=_0x2e8649[_0xa477('0x177')]||0x32;_0x5d33d7['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x2e8649[_0xa477('0x178')]||0x3;_0x5d33d7[_0xa477('0x179')]=_0x2e8649[_0xa477('0x17a')]||0x100;_0x5d33d7[_0xa477('0x17b')]=_0x2e8649[_0xa477('0x17c')]||0x1388;}if(_0x2e8649[_0xa477('0x4d')]===_0xa477('0x4e')){_0x5d33d7[_0xa477('0x17d')]=_0x3e2e95[_0xa477('0x102')];}else{_0x5d33d7[_0xa477('0x17e')]=_0x3e2e95[_0xa477('0xd2')];}for(var _0xc4a536 in _0x3e2e95[_0xa477('0x169')]){if(typeof _0x3e2e95[_0xa477('0x169')][_0xc4a536]!==_0xa477('0x160')){if(isNotNull(_0x3e2e95['Contact'][_0xc4a536])&&_0xc4a536!=='id'&&_0xc4a536!==_0xa477('0x17f')&&_0xc4a536!==_0xa477('0x180')&&_0xc4a536!==_0xa477('0x181')){_0x5d33d7[util['format']('%s%s','XMD-',_[_0xa477('0x182')](_0xc4a536))]=_0x3e2e95[_0xa477('0x169')][_0xc4a536];}}}var _0x5b3e7d=_0x108c08[_0xa477('0xd5')](_0x2e8649[_0xa477('0x77')])?getCallerId(_0x2e8649[_0xa477('0x77')]['callerid'],_0x2e8649['dialOriginateCallerIdName'],_0x2e8649[_0xa477('0x183')]>0x0?getCallerIdRandom(_0x2e8649[_0xa477('0x5b')],_0x2e8649['dialRandomLastDigitCallerIdNumber']):_0x2e8649[_0xa477('0x5b')]):getCallerId(_['isNil'](_0x2e8649[_0xa477('0x13b')])?_0x2e8649[_0xa477('0x77')][_0xa477('0x79')]:_0x2e8649[_0xa477('0x13b')][_0xa477('0x79')],_0x2e8649[_0xa477('0x184')],_0x2e8649[_0xa477('0x183')]>0x0?getCallerIdRandom(_0x2e8649[_0xa477('0x5b')],_0x2e8649['dialRandomLastDigitCallerIdNumber']):_0x2e8649[_0xa477('0x5b')]);if(_0x5b3e7d){_0x5d33d7['XMD-ORIGINATECALLERIDNAME']=_0x108c08['actions'][_0x5914b8][_0xa477('0x185')]=extractCalleridName(_0x5b3e7d);_0x5d33d7[_0xa477('0x186')]=_0x108c08[_0xa477('0x23')][_0x5914b8][_0xa477('0x187')]=extractCalleridNumber(_0x5b3e7d);}return ami[_0xa477('0xaa')]({'actionid':_0x5914b8,'action':'originate','channel':_0x108c08['isTrunkReachable'](_0x2e8649[_0xa477('0x77')])?util['format'](_0xa477('0x188'),_0x2e8649['Trunk'][_0xa477('0x3e')],isNotNull(_0x2e8649['dialPrefix'])?_0x2e8649['dialPrefix'][_0xa477('0x189')]()||'':'',_0x2e8649[_0xa477('0x18a')]>0x0?_0x3e2e95['Contact'][_0xa477('0x16a')]['substring'](_0x2e8649[_0xa477('0x18a')]):_0x3e2e95[_0xa477('0x169')][_0xa477('0x16a')]):util[_0xa477('0x7d')](_0xa477('0x188'),_[_0xa477('0xa9')](_0x2e8649['TrunkBackup'])?_0x2e8649[_0xa477('0x77')][_0xa477('0x3e')]:_0x2e8649['TrunkBackup'][_0xa477('0x3e')],isNotNull(_0x2e8649[_0xa477('0x18b')])?_0x2e8649[_0xa477('0x18b')][_0xa477('0x189')]()||'':'',_0x2e8649[_0xa477('0x18a')]>0x0?_0x3e2e95[_0xa477('0x169')][_0xa477('0x16a')][_0xa477('0x18c')](_0x2e8649[_0xa477('0x18a')]):_0x3e2e95[_0xa477('0x169')][_0xa477('0x16a')]),'callerid':_0x5b3e7d,'Exten':'xcally-motion-dialer','Context':_0xa477('0x18d'),'Priority':'1','variable':_0x5d33d7,'timeout':(_0x2e8649[_0xa477('0x5c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5914b8})[_0xa477('0xb2')](function(_0x5933a2){return _0x4924a5(_0x5933a2);})['catch'](function(_0x3d674c){_0x2e8649[_0xa477('0x66')]+=0x1;var _0x4af3a9=new History(_0x108c08['actions'][_0x5914b8]);logger[_0xa477('0x95')](util['format'](_0xa477('0x18e'),JSON['stringify'](_0x3d674c)));_0x4af3a9[_0xa477('0xf9')]=0xe;_0x4af3a9[_0xa477('0xa3')]=_0xa477('0x18f');_0x4af3a9[_0xa477('0x121')]=moment()[_0xa477('0x7d')](_0xa477('0xf7'));_0x4af3a9['endtime']=_0x4af3a9[_0xa477('0x121')];_0x108c08[_0xa477('0xc8')](_0x4af3a9)[_0xa477('0xac')](loggerCatch('[originate][error]'));_0x108c08[_0xa477('0xc7')](_0x4af3a9)['catch'](loggerCatch(_0xa477('0x190')))[_0xa477('0x1a')](function(){delete _0x108c08[_0xa477('0x23')][_0x5914b8];return _0x2a043c(msgResponse(_0xa477('0x168'),_0xa477('0x48'),_0xa477('0x191')));});});});};Dialer[_0xa477('0x18')][_0xa477('0x2c')]=function(_0x1e052e){var _0x36971c=this['actions'][_0x1e052e['actionid']];if(_0x36971c){delete this['actions'][_0x1e052e['actionid']];_0x36971c['responsetime']=moment()[_0xa477('0x7d')]('YYYY-MM-DD\x20HH:mm:ss');var _0x157123=_0x36971c['type']===_0xa477('0x7c')?this[_0xa477('0x1e')][_0x36971c[_0xa477('0xaf')]]:this[_0xa477('0x1d')][_0x36971c[_0xa477('0x192')]()];if(!this['isSuccess'](_0x1e052e[_0xa477('0x193')])){this['updateOriginated'](_0x157123);return this['callProgressDetecting'](_0x36971c,_0x157123,_0x1e052e)['catch'](loggerCatch(_0xa477('0x194')));}this[_0xa477('0xa5')][_0x1e052e[_0xa477('0xd9')]]=_0x36971c;}};Dialer[_0xa477('0x18')][_0xa477('0x195')]=function(_0x5d90b1,_0x1c39d5,_0xfa49ac){var _0x3b82e4=new History(_0x1c39d5);if(_0x3b82e4[_0xa477('0xe9')]+_0x3b82e4[_0xa477('0xea')]+_0x3b82e4[_0xa477('0xeb')]+_0x3b82e4[_0xa477('0xec')]+_0x3b82e4[_0xa477('0x100')]+_0x3b82e4[_0xa477('0xed')]+_0x3b82e4[_0xa477('0xe8')]+_0x3b82e4[_0xa477('0xee')]>=_0xfa49ac[_0xa477('0xef')]-0x1){return!![];}switch(_0x5d90b1){case 0x3:if(_0x3b82e4[_0xa477('0xeb')]>=_0xfa49ac[_0xa477('0x196')]-0x1){return!![];}this[_0xa477('0xbc')]({'active':![],'countnoanswerretry':_0x3b82e4[_0xa477('0xeb')]+=0x1,'scheduledat':moment()[_0xa477('0x101')](_0xfa49ac[_0xa477('0x197')],_0xa477('0xf6'))[_0xa477('0x7d')](_0xa477('0xf7')),'ContactId':_0x3b82e4['ContactId'],'ListId':_0x3b82e4[_0xa477('0xd0')],'VoiceQueueId':_0x3b82e4[_0xa477('0x102')]||undefined,'CampaignId':_0x3b82e4['CampaignId']||undefined})[_0xa477('0xac')](loggerCatch(_0xa477('0x198')));break;case 0x5:if(_0x3b82e4[_0xa477('0xe9')]>=_0xfa49ac[_0xa477('0x199')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x3b82e4[_0xa477('0xe9')]+=0x1,'scheduledat':moment()[_0xa477('0x101')](_0xfa49ac[_0xa477('0x19a')],_0xa477('0xf6'))[_0xa477('0x7d')](_0xa477('0xf7')),'ContactId':_0x3b82e4[_0xa477('0xf8')],'ListId':_0x3b82e4[_0xa477('0xd0')],'VoiceQueueId':_0x3b82e4[_0xa477('0x102')]||undefined,'CampaignId':_0x3b82e4[_0xa477('0xd2')]||undefined})[_0xa477('0xac')](loggerCatch(_0xa477('0x19b')));break;case 0x8:if(_0x3b82e4[_0xa477('0xea')]>=_0xfa49ac[_0xa477('0x19c')]-0x1){return!![];}this[_0xa477('0xbc')]({'active':![],'countcongestionretry':_0x3b82e4[_0xa477('0xea')]+=0x1,'scheduledat':moment()[_0xa477('0x101')](_0xfa49ac[_0xa477('0x19d')],_0xa477('0xf6'))[_0xa477('0x7d')](_0xa477('0xf7')),'ContactId':_0x3b82e4[_0xa477('0xf8')],'ListId':_0x3b82e4[_0xa477('0xd0')],'VoiceQueueId':_0x3b82e4[_0xa477('0x102')]||undefined,'CampaignId':_0x3b82e4[_0xa477('0xd2')]||undefined})[_0xa477('0xac')](loggerCatch(_0xa477('0x19e')));break;case 0x0:if(_0x3b82e4['countnosuchnumberretry']>=_0xfa49ac['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x3b82e4['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0xa477('0x101')](_0xfa49ac[_0xa477('0x19f')],_0xa477('0xf6'))[_0xa477('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3b82e4[_0xa477('0xf8')],'ListId':_0x3b82e4[_0xa477('0xd0')],'VoiceQueueId':_0x3b82e4[_0xa477('0x102')]||undefined,'CampaignId':_0x3b82e4[_0xa477('0xd2')]||undefined})[_0xa477('0xac')](loggerCatch(_0xa477('0x1a0')));}break;case 0xa:if(_0x3b82e4['countdropretry']>=_0xfa49ac[_0xa477('0x117')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x3b82e4[_0xa477('0x100')]+=0x1,'scheduledat':moment()[_0xa477('0x101')](_0xfa49ac[_0xa477('0x119')],_0xa477('0xf6'))[_0xa477('0x7d')](_0xa477('0xf7')),'ContactId':_0x3b82e4['ContactId'],'ListId':_0x3b82e4['ListId'],'VoiceQueueId':_0x3b82e4['VoiceQueueId']||undefined,'CampaignId':_0x3b82e4[_0xa477('0xd2')]||undefined})[_0xa477('0xac')](loggerCatch(_0xa477('0x1a1')));break;case 0xb:if(_0x3b82e4[_0xa477('0xed')]>=_0xfa49ac[_0xa477('0x1a2')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x3b82e4[_0xa477('0xed')]+=0x1,'scheduledat':moment()[_0xa477('0x101')](_0xfa49ac[_0xa477('0x11f')],'minutes')[_0xa477('0x7d')](_0xa477('0xf7')),'ContactId':_0x3b82e4[_0xa477('0xf8')],'ListId':_0x3b82e4[_0xa477('0xd0')],'VoiceQueueId':_0x3b82e4['VoiceQueueId']||undefined,'CampaignId':_0x3b82e4[_0xa477('0xd2')]||undefined})[_0xa477('0xac')](loggerCatch(_0xa477('0x120')));break;case 0x13:if(_0x3b82e4[_0xa477('0xe8')]>=_0xfa49ac[_0xa477('0xf2')]-0x1){return!![];}this[_0xa477('0xbc')]({'active':![],'countmachineretry':_0x3b82e4[_0xa477('0xe8')]+=0x1,'scheduledat':moment()['add'](_0xfa49ac['dialMachineRetryFrequency'],_0xa477('0xf6'))[_0xa477('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3b82e4['ContactId'],'ListId':_0x3b82e4['ListId'],'VoiceQueueId':_0x3b82e4['VoiceQueueId']||undefined,'CampaignId':_0x3b82e4[_0xa477('0xd2')]||undefined})[_0xa477('0xac')](loggerCatch(_0xa477('0x103')));break;case 0x14:if(_0x3b82e4[_0xa477('0xee')]>=_0xfa49ac[_0xa477('0x1a3')]-0x1){return!![];}this[_0xa477('0xbc')]({'active':![],'countagentrejectretry':_0x3b82e4[_0xa477('0xee')]+=0x1,'scheduledat':moment()[_0xa477('0x101')](_0xfa49ac[_0xa477('0x1a4')],'minutes')[_0xa477('0x7d')](_0xa477('0xf7')),'ContactId':_0x3b82e4[_0xa477('0xf8')],'ListId':_0x3b82e4['ListId'],'VoiceQueueId':_0x3b82e4[_0xa477('0x102')]||undefined,'CampaignId':_0x3b82e4['CampaignId']||undefined})[_0xa477('0xac')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xa477('0x18')]['callProgressDetecting']=function(_0x2134fb,_0x151687,_0x6720e0){var _0x23bdfd=this;var _0x119f8d=new History(_0x2134fb);return new BPromise(function(_0x15cfe4,_0x1b1936){if(_[_0xa477('0x3b')](_0x151687)&&typeof _0x151687!==_0xa477('0x167')){return _0x1b1936(msgResponse(_0xa477('0x1a5'),'Failure',_0xa477('0x1a6')));}if(_[_0xa477('0x3b')](_0x6720e0)&&typeof _0x6720e0!==_0xa477('0x167')){return _0x1b1936(msgResponse(_0xa477('0x1a5'),_0xa477('0x140'),_0xa477('0x1a7')));}switch(_0x6720e0[_0xa477('0x10b')]){case'0':_0x151687[_0xa477('0x65')]+=0x1;_0x119f8d[_0xa477('0xf9')]=0x0;_0x119f8d[_0xa477('0xa3')]=_0xa477('0x1a8');_0x119f8d[_0xa477('0xec')]+=0x1;_0x119f8d[_0xa477('0xfe')]+=0x1;ami[_0xa477('0xe3')](_0xa477('0x1a9'),ut['buildObj'](_0x2134fb,_0xa477('0x1aa')));_0x23bdfd['createHistory'](_0x119f8d)[_0xa477('0xac')](loggerCatch(_0xa477('0xff')));if(_0x23bdfd[_0xa477('0x195')](0x0,_0x2134fb,_0x151687)){if(_0x119f8d[_0xa477('0xec')]>=_0x151687[_0xa477('0x1ab')]){_0x23bdfd[_0xa477('0xf3')](_0x119f8d,_0x15cfe4,_0x1b1936,'reason\x200\x20no\x20such\x20number....');}else{_0x23bdfd[_0xa477('0xf0')](_0x119f8d,_0x15cfe4,_0x1b1936,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x151687['outboundNoAnswerCallsDay']+=0x1;_0x119f8d[_0xa477('0xf9')]=0x3;_0x119f8d[_0xa477('0xa3')]=_0xa477('0x1ac');_0x119f8d[_0xa477('0xeb')]+=0x1;_0x119f8d[_0xa477('0xfe')]+=0x1;ami[_0xa477('0xe3')]('custom:agentnoanswer',ut[_0xa477('0xe5')](_0x2134fb,_0xa477('0x1ad')));_0x23bdfd[_0xa477('0xc8')](_0x119f8d)[_0xa477('0xac')](loggerCatch(_0xa477('0x1ae')));if(_0x23bdfd['checkRetriveMax'](0x3,_0x2134fb,_0x151687)){if(_0x119f8d['countnoanswerretry']>=_0x151687[_0xa477('0x196')]){_0x23bdfd[_0xa477('0xf3')](_0x119f8d,_0x15cfe4,_0x1b1936,_0xa477('0x1af'));}else{_0x23bdfd[_0xa477('0xf0')](_0x119f8d,_0x15cfe4,_0x1b1936,_0xa477('0x1af'));}}break;case'5':_0x151687[_0xa477('0x5f')]+=0x1;_0x119f8d[_0xa477('0xf9')]=0x5;_0x119f8d['statedesc']=_0xa477('0x1b0');_0x119f8d[_0xa477('0xe9')]+=0x1;_0x119f8d[_0xa477('0xfe')]+=0x1;ami[_0xa477('0xe3')]('custom:agentbusy',ut['buildObj'](_0x2134fb,'busy'));_0x23bdfd[_0xa477('0xc8')](_0x119f8d)['catch'](loggerCatch(_0xa477('0x1b1')));if(_0x23bdfd['checkRetriveMax'](0x5,_0x2134fb,_0x151687)){if(_0x119f8d[_0xa477('0xe9')]>=_0x151687[_0xa477('0x199')]){_0x23bdfd[_0xa477('0xf3')](_0x119f8d,_0x15cfe4,_0x1b1936,'reason\x205\x20busy');}else{_0x23bdfd[_0xa477('0xf0')](_0x119f8d,_0x15cfe4,_0x1b1936,_0xa477('0x1b2'));}}break;case'8':_0x151687['outboundCongestionCallsDay']+=0x1;_0x119f8d[_0xa477('0xf9')]=0x8;_0x119f8d[_0xa477('0xa3')]=_0xa477('0x1b3');_0x119f8d[_0xa477('0xea')]+=0x1;_0x119f8d[_0xa477('0xfe')]+=0x1;ami[_0xa477('0xe3')]('custom:agentcongestion',ut[_0xa477('0xe5')](_0x2134fb,_0xa477('0x1b4')));_0x23bdfd[_0xa477('0xc8')](_0x119f8d)['catch'](loggerCatch(_0xa477('0x1b5')));if(_0x23bdfd[_0xa477('0x195')](0x8,_0x2134fb,_0x151687)){if(_0x119f8d['countcongestionretry']>=_0x151687['dialCongestionMaxRetry']){_0x23bdfd['createStateFinal'](_0x119f8d,_0x15cfe4,_0x1b1936,'reason\x208\x20congestion');}else{_0x23bdfd[_0xa477('0xf0')](_0x119f8d,_0x15cfe4,_0x1b1936,_0xa477('0x1b6'));}}break;case'11':_0x151687[_0xa477('0x1b7')]+=0x1;_0x119f8d[_0xa477('0xf9')]=0xb;_0x119f8d[_0xa477('0xa3')]=_0xa477('0x11d');_0x119f8d[_0xa477('0xed')]+=0x1;_0x119f8d[_0xa477('0xfe')]+=0x1;_0x23bdfd[_0xa477('0xc8')](_0x119f8d)[_0xa477('0xac')](loggerCatch(_0xa477('0x122')));if(_0x23bdfd[_0xa477('0x195')](0xb,_0x2134fb,_0x151687)){if(_0x119f8d[_0xa477('0xed')]>=_0x151687[_0xa477('0x1a2')]){_0x23bdfd[_0xa477('0xf3')](_0x119f8d,_0x15cfe4,_0x1b1936,_0xa477('0x1b8'));}else{_0x23bdfd[_0xa477('0xf0')](_0x119f8d,_0x15cfe4,_0x1b1936,_0xa477('0x1b8'));}}break;case'20':_0x151687[_0xa477('0x68')]+=0x1;_0x119f8d[_0xa477('0xf9')]=0x14;_0x119f8d[_0xa477('0xa3')]=_0xa477('0x1b9');_0x119f8d[_0xa477('0xee')]+=0x1;_0x119f8d['countglobal']+=0x1;ami['emit'](_0xa477('0x1ba'),ut[_0xa477('0xe5')](_0x2134fb,'agentreject'));_0x23bdfd[_0xa477('0xc8')](_0x119f8d)['catch'](loggerCatch(_0xa477('0x1bb')));if(_0x23bdfd[_0xa477('0x195')](0x14,_0x2134fb,_0x151687)){if(_0x119f8d['countagentrejectretry']>=_0x151687[_0xa477('0x1a3')]){_0x23bdfd['createStateFinal'](_0x119f8d,_0x15cfe4,_0x1b1936,_0xa477('0x1bc'));}else{_0x23bdfd[_0xa477('0xf0')](_0x119f8d,_0x15cfe4,_0x1b1936,_0xa477('0x1bc'));}}break;default:_0x151687[_0xa477('0x109')]+=0x1;_0x119f8d[_0xa477('0xf9')]=0xc;_0x119f8d[_0xa477('0xa3')]=_0x6720e0['reason'];_0x23bdfd[_0xa477('0xc8')](_0x119f8d)[_0xa477('0xac')](loggerCatch(_0xa477('0x1bd')));if(_0x23bdfd[_0xa477('0x195')](_0x6720e0[_0xa477('0x10b')],_0x2134fb,_0x151687)){if(_0x119f8d['countbusyretry']+_0x119f8d['countcongestionretry']+_0x119f8d[_0xa477('0xeb')]+_0x119f8d[_0xa477('0xec')]+_0x119f8d[_0xa477('0x100')]+_0x119f8d['countabandonedretry']+_0x119f8d[_0xa477('0xe8')]+_0x119f8d[_0xa477('0xee')]>=_0x151687['dialGlobalMaxRetry']){_0x23bdfd[_0xa477('0xf0')](_0x119f8d,_0x15cfe4,_0x1b1936,_0x6720e0[_0xa477('0x10b')]);}else{_0x23bdfd[_0xa477('0xf3')](_0x119f8d,_0x15cfe4,_0x1b1936,_0x6720e0['reason']);}}}});};Dialer[_0xa477('0x18')][_0xa477('0xf0')]=function(_0x36dbb5,_0x530586,_0x2ab3c2,_0x43fa32){var _0x3167dc=new Final(_0x36dbb5);_0x3167dc[_0xa477('0xf9')]=0xf;_0x3167dc[_0xa477('0xa3')]=_0xa477('0x1be');this[_0xa477('0xf3')](_0x3167dc,_0x530586,_0x2ab3c2,_0x43fa32);};Dialer[_0xa477('0x18')]['createStateFinal']=function(_0x5f4595,_0x29570a,_0x40b178,_0x7fad45){this[_0xa477('0xc7')](_0x5f4595)[_0xa477('0xb2')](function(){return _0x29570a(msgResponse('[callProgressDetecting]','Success',_0x7fad45));})[_0xa477('0xac')](function(){return _0x40b178(msgResponse('[moveContactManagedDialer][0]',_0xa477('0x140'),_0xa477('0x1bf')));});};Dialer[_0xa477('0x18')][_0xa477('0x8')]=function(_0x41a71c){var _0xbba430=_0x41a71c[_0xa477('0x1c0')]/0x64;var _0x179ead=_0x41a71c[_0xa477('0x63')]/(_0x41a71c['outboundDropCallsDayTimeout']+_0x41a71c[_0xa477('0x5e')]);var _0xf06a38=Math[_0xa477('0x1c1')](_0x41a71c[_0xa477('0x71')]*(_0x41a71c[_0xa477('0x1c2')]/0x64));var _0x18b09b=Math['round'](_0x41a71c[_0xa477('0x71')]*(_0x41a71c[_0xa477('0x1c3')]/0x64));var _0x1f0222=_0x41a71c[_0xa477('0x4f')]+_0x41a71c['talking'];var _0x441e71=Math[_0xa477('0x1c4')](_0x41a71c[_0xa477('0x73')]*_0x41a71c[_0xa477('0x75')]*_0x41a71c['predictiveIntervalHitRate']*_0x41a71c['predictiveIntervalMultiplicativeFactor']);if(_[_0xa477('0x3b')](_0x41a71c[_0xa477('0x27')])){if(!_['isUndefined'](_0x41a71c['startPredictive'])){_0x41a71c[_0xa477('0x26')]=undefined;loggerPredictive[_0xa477('0x95')](_0xa477('0x1c5'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xa477('0x3b')](_0x41a71c[_0xa477('0x91')])){loggerPredictive[_0xa477('0x95')](_0xa477('0x1c5'),_0xa477('0x1c6'));clearInterval(_0x41a71c[_0xa477('0x91')]);_0x41a71c[_0xa477('0x91')]=undefined;}_0x41a71c[_0xa477('0x27')]=moment()[_0xa477('0x7d')](_0xa477('0xf7'));loggerPredictive['info'](_0x41a71c[_0xa477('0x3e')],_0xa477('0x1c7'),_0x41a71c['startProgressive']);this[_0xa477('0x155')](_0x41a71c,0x1);}else if(ifInterval(_0x41a71c[_0xa477('0x1c8')],_0x41a71c[_0xa477('0x27')])){this[_0xa477('0x155')](_0x41a71c,0x1);loggerPredictiveCalls[_0xa477('0x7f')]('[startMethodPredictive][StartProgressive][Loop]',_0x41a71c['startProgressive'],_0x41a71c[_0xa477('0x3e')]);_0x41a71c[_0xa477('0x73')]=0x0;_0x41a71c[_0xa477('0x6e')]=0x0;}else if(_0xbba430<_0x179ead&&_0x41a71c[_0xa477('0x1c9')]===_0xa477('0x1ca')){freeVariablesPredictive(_0x41a71c);loggerPredictive[_0xa477('0x7f')](_0xa477('0x1cb'),_0xa477('0x1cc'),_0x179ead,_0xa477('0x27'),_0x41a71c['name']);}else if(_0x441e71<_0x41a71c[_0xa477('0x6e')]&&_0x41a71c[_0xa477('0x1c9')]===_0xa477('0x1ca')){freeVariablesPredictive(_0x41a71c);loggerPredictive['info'](_0xa477('0x1cd'),'Max\x20Drop\x20',_0x441e71,_0xa477('0x1ce'),_0x41a71c[_0xa477('0x6e')],_0xa477('0x27'),_0x41a71c[_0xa477('0x3e')]);}else if(!ifInterval(_0x41a71c[_0xa477('0x1c8')],_0x41a71c[_0xa477('0x27')])&&_[_0xa477('0x3b')](_0x41a71c['startPredictive'])&&!_[_0xa477('0x3b')](_0x41a71c['startProgressive'])){_0x41a71c[_0xa477('0x26')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x41a71c[_0xa477('0x3e')],_0xa477('0x1cf'),_0x41a71c[_0xa477('0x26')]);this['averageHandleTime'](_0x41a71c[_0xa477('0x1c8')])[_0xa477('0xb2')](this[_0xa477('0x1d0')](_0x41a71c))[_0xa477('0xb2')](mergeDataErlangB(_0x41a71c))[_0xa477('0xb2')](this['startMethodPredictive'](_0x41a71c))[_0xa477('0xac')](loggerCatchPredictive(_0xa477('0x1d1'),_0x41a71c));}else if(!ifInterval(_0x41a71c[_0xa477('0x1c8')],_0x41a71c[_0xa477('0x26')])){_0x41a71c[_0xa477('0x6e')]=0x0;_0x41a71c['startPredictive']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xa477('0x7f')](_0x41a71c[_0xa477('0x3e')],'recalculate\x20predictive\x20at',_0x41a71c[_0xa477('0x26')]);clearInterval(_0x41a71c['handlePredictive']);_0x41a71c['handlePredictive']=undefined;this['averageHandleTime'](_0x41a71c[_0xa477('0x1c8')])[_0xa477('0xb2')](this[_0xa477('0x1d0')](_0x41a71c))[_0xa477('0xb2')](mergeDataErlangB(_0x41a71c))['then'](this[_0xa477('0x1d2')](_0x41a71c))['catch'](loggerCatchPredictive(_0xa477('0x1d3'),_0x41a71c));}else if(_0x41a71c[_0xa477('0x71')]&&_0x1f0222<_0x41a71c[_0xa477('0x71')]-_0x18b09b){freeVariablesPredictive(_0x41a71c);loggerPredictive[_0xa477('0x7f')](_0x41a71c['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x1f0222,_0xa477('0x1d4'),_0x41a71c[_0xa477('0x71')],'-',_0x18b09b,'=',_0x41a71c['predictiveIntervalAvailable']-_0x18b09b,')');}else if(_0x41a71c[_0xa477('0x71')]&&_0x1f0222>_0x41a71c[_0xa477('0x71')]+_0xf06a38){freeVariablesPredictive(_0x41a71c);loggerPredictive['info'](_0x41a71c[_0xa477('0x3e')],_0xa477('0x1d5'),_0x1f0222,')\x20are\x20more\x20than\x20threshold\x20(',_0x41a71c[_0xa477('0x71')],'+',_0xf06a38,'=',_0x41a71c['predictiveIntervalAvailable']+_0xf06a38,')');}};Dialer['prototype'][_0xa477('0x1d0')]=function(_0x1cfbd3){var _0x352ffc=this;return function(_0x142074){return new BPromise(function(_0x1915ad,_0x2ae897){_['merge'](_0x1cfbd3,_0x142074[0x0]);if(checkGetDataPredictive(_0x142074[0x0])){var _0x2e7352=_0x1cfbd3[_0xa477('0x71')]=_0x1cfbd3[_0xa477('0x55')]+_0x1cfbd3[_0xa477('0x4f')];var _0x37b8b8=_0x1cfbd3[_0xa477('0x1c8')]*0x3c;var _0x41a93d=_0x142074[0x0]['predictiveIntervalAvgTalktime']+_0x142074[0x0]['predictiveIntervalAvgHoldtime'];var _0x39b299=(_0x142074[0x0][_0xa477('0x69')]+_0x142074[0x0][_0xa477('0x6d')]+_0x142074[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x142074[0x0]['predictiveIntervalTotalCalls'];_0x1cfbd3[_0xa477('0x1d6')]=_0x39b299>0x0?_0x39b299:0x1;switch(_0x1cfbd3['dialPredictiveOptimization']){case _0xa477('0x1ca'):var _0x878e30=_0x1cfbd3[_0xa477('0x1c0')]/0x64;return _0x352ffc[_0xa477('0x1d7')](_0x2e7352,_0x37b8b8,_0x41a93d,_0x39b299,_0x878e30)[_0xa477('0xb2')](function(_0x4fa572){return _0x1915ad(_0x4fa572);});case _0xa477('0x1d8'):var _0x42b772=_0x1cfbd3[_0xa477('0x1c0')]/0x64;return _0x352ffc[_0xa477('0x1d9')](_0x2e7352,_0x37b8b8,_0x41a93d,_0x39b299,_0x42b772)[_0xa477('0xb2')](function(_0x341ae6){return _0x1915ad(_0x341ae6);});default:return _0x2ae897(msgResponse('[getDataPredictive]',_0xa477('0x140'),_0xa477('0x1da')));}}else{return _0x2ae897(msgResponse(_0xa477('0x1db'),_0xa477('0x140'),_0xa477('0x1dc')));}});};};Dialer[_0xa477('0x18')]['getDataPredictiveOld']=function(_0x2b1cf7){var _0x3de707=this;return function(_0x3dd365){return new BPromise(function(_0x443a55,_0x3fef47){_[_0xa477('0x8f')](_0x2b1cf7,_0x3dd365[0x0]);if(checkGetDataPredictive(_0x3dd365[0x0])){loggerPredictive['info'](JSON[_0xa477('0x49')](_0x3dd365[0x0]));if(_0x2b1cf7[_0xa477('0x1c9')]==='dropRate'){return _0x3de707[_0xa477('0xc5')](_0x2b1cf7['id'])[_0xa477('0xb2')](function(_0x564de2){var _0x2ba250=_0x2b1cf7[_0xa477('0x50')]-_0x564de2[0x0]['outboundQueuePauses'];var _0x58f191=_0x2b1cf7[_0xa477('0x1c8')]*0x3c;var _0x44a0df=_0x3dd365[0x0]['predictiveIntervalAvgTalktime']+_0x3dd365[0x0][_0xa477('0x6a')];var _0x26531e=(_0x3dd365[0x0][_0xa477('0x69')]+_0x3dd365[0x0][_0xa477('0x6d')]+_0x3dd365[0x0][_0xa477('0x6c')])/_0x3dd365[0x0][_0xa477('0x82')];var _0x142963=_0x2b1cf7[_0xa477('0x1c0')]/0x64;_0x2b1cf7[_0xa477('0x70')]=_0x564de2[0x0]['outboundQueuePauses']||0x0;_0x2b1cf7[_0xa477('0x1d6')]=_0x26531e>0x0?_0x26531e:0x1;return _0x3de707['abandonmentRate'](_0x2ba250,_0x58f191,_0x44a0df,_0x26531e,_0x142963);})['then'](function(_0x2a056d){return _0x443a55(_0x2a056d);})[_0xa477('0xac')](function(_0x22fd75){return _0x3fef47(msgResponse('[CatchErlangB]','Failure',JSON[_0xa477('0x49')](_0x22fd75)));});}if(_0x2b1cf7[_0xa477('0x1c9')]===_0xa477('0x1d8')){return _0x3de707[_0xa477('0xc5')](_0x2b1cf7['id'])[_0xa477('0xb2')](function(_0x349616){var _0x3358c4=_0x2b1cf7['loggedIn']-_0x349616[0x0][_0xa477('0x1dd')];var _0x441753=_0x2b1cf7['dialPredictiveInterval']*0x3c;var _0x1546af=_0x3dd365[0x0][_0xa477('0x6b')]+_0x3dd365[0x0][_0xa477('0x6a')];var _0x5ef66f=(_0x3dd365[0x0][_0xa477('0x69')]+_0x3dd365[0x0][_0xa477('0x6d')]+_0x3dd365[0x0][_0xa477('0x6c')])/_0x3dd365[0x0]['predictiveIntervalTotalCalls'];var _0x344201=_0x2b1cf7[_0xa477('0x1c0')]/0x64;_0x2b1cf7[_0xa477('0x70')]=_0x349616[0x0][_0xa477('0x1dd')]||0x0;_0x2b1cf7['predictiveIntervalHitRate']=_0x5ef66f>0x0?_0x5ef66f:0x1;return _0x3de707[_0xa477('0x1d9')](_0x3358c4,_0x441753,_0x1546af,_0x5ef66f,_0x344201);})[_0xa477('0xb2')](function(_0x139455){return _0x443a55(_0x139455);})['catch'](function(_0x57c593){return _0x3fef47(msgResponse(_0xa477('0x1de'),_0xa477('0x140'),JSON[_0xa477('0x49')](_0x57c593)));});}}else{return _0x3fef47(msgResponse(_0xa477('0x1db'),_0xa477('0x140'),_0xa477('0x1dc')));}});};};Dialer[_0xa477('0x18')][_0xa477('0x1d2')]=function(_0x165a81){var _0x557db8=this;return function(){var _0x3b8527=0x0;var _0x3d2e2e=Math[_0xa477('0x1c4')](_0x165a81[_0xa477('0x74')]*0x3e8);if(_0x3d2e2e>0x0){_0x3d2e2e=_0x3d2e2e<0x64?0x64:_0x3d2e2e;loggerPredictive[_0xa477('0x7f')](_0x165a81['name'],_0xa477('0x1df'),_0x3d2e2e,_0xa477('0x4a'));_0x165a81[_0xa477('0x91')]=setInterval(function(){_0x557db8[_0xa477('0x91')](_0x165a81);loggerPredictiveCalls[_0xa477('0x7f')](_0xa477('0x1e0'),_0x3b8527+=0x1);},_0x3d2e2e);}else{loggerPredictive['info'](_0x165a81[_0xa477('0x3e')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xa477('0x18')][_0xa477('0x1e1')]=function(_0x58f9b2,_0x1ebf87){var _0x21abe1=this;return function(_0x5c0f0e){if(_[_0xa477('0x46')](_0x5c0f0e)){if(_[_0xa477('0xa9')](_0x1ebf87[_0xa477('0xd1')])||!_0x1ebf87[_0xa477('0x1e2')]){if(_0x58f9b2[_0xa477('0x5a')]==='booked'){_0x58f9b2[_0xa477('0x12b')]=_[_0xa477('0x3b')](_0x58f9b2['queueStatusComplete'])?!![]:_0x58f9b2[_0xa477('0x12b')];var _0x3ccd6a=uuid['v4']();_0x21abe1['actions'][_0x3ccd6a]=new Action(_0x58f9b2,_0x1ebf87,_0x3ccd6a);loggerBooked['info'](_0xa477('0x1e3'),_0x3ccd6a,_0xa477('0x1e4'),JSON[_0xa477('0x49')](_0x58f9b2[_0xa477('0x12b')]),_0xa477('0x1e5'),_0x58f9b2['name']);if(_0x58f9b2[_0xa477('0x12b')]){_0x58f9b2[_0xa477('0x12b')]=![];_0x21abe1[_0xa477('0x129')][_0x21abe1[_0xa477('0x23')][_0x3ccd6a][_0xa477('0xaf')]]=[];ami[_0xa477('0xaa')]({'actionid':_0x3ccd6a,'action':_0xa477('0x1e6'),'queue':_0x58f9b2[_0xa477('0x3e')]})[_0xa477('0xac')](function(){_0x21abe1[_0xa477('0xae')](_0x58f9b2);_0x21abe1[_0xa477('0xbc')]({'active':![],'ContactId':_0x21abe1['actions'][_0x3ccd6a][_0xa477('0xf8')],'ListId':_0x21abe1[_0xa477('0x23')][_0x3ccd6a][_0xa477('0xd0')],'VoiceQueueId':_0x21abe1[_0xa477('0x23')][_0x3ccd6a][_0xa477('0x102')]||undefined,'CampaignId':_0x21abe1[_0xa477('0x23')][_0x3ccd6a][_0xa477('0xd2')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x21abe1[_0xa477('0x23')][_0x3ccd6a];});}else{loggerBooked[_0xa477('0x7f')](_0xa477('0x1e7'),JSON['stringify'](_0x58f9b2['queueStatusComplete']),_0xa477('0x1e5'),_0x58f9b2[_0xa477('0x3e')]);_0x21abe1['updateOriginated'](_0x58f9b2);_0x21abe1[_0xa477('0xbc')]({'active':![],'ContactId':_0x21abe1[_0xa477('0x23')][_0x3ccd6a][_0xa477('0xf8')],'ListId':_0x21abe1[_0xa477('0x23')][_0x3ccd6a][_0xa477('0xd0')],'VoiceQueueId':_0x21abe1['actions'][_0x3ccd6a]['VoiceQueueId']||undefined,'CampaignId':_0x21abe1['actions'][_0x3ccd6a]['CampaignId']||undefined})[_0xa477('0xac')](loggerCatch(_0xa477('0x1e8')));delete _0x21abe1[_0xa477('0x23')][_0x3ccd6a];}}else{return _0x21abe1[_0xa477('0x166')](_0x58f9b2,_0x1ebf87);}}else{if(getDiff(_0x1ebf87['scheduledat'])<_0x58f9b2[_0xa477('0x1e9')]*0x3c){if(_0x1ebf87[_0xa477('0x1ea')]&&!_0x1ebf87['Agent']['voicePause']){_0x21abe1[_0xa477('0x1c')]['run'](_0x1ebf87['id'])[_0xa477('0x1a')](function(){_0x21abe1[_0xa477('0xae')](_0x58f9b2);});}else{_0x21abe1[_0xa477('0xbe')]({'active':![]},_0x1ebf87['id'],0x1)['finally'](function(){_0x21abe1[_0xa477('0xae')](_0x58f9b2);});}}else{_0x58f9b2[_0xa477('0x67')]+=0x1;_0x21abe1[_0xa477('0xae')](_0x58f9b2);if(_0x58f9b2[_0xa477('0x1eb')]){_0x21abe1[_0xa477('0xbc')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1ebf87[_0xa477('0xf8')],'ListId':_0x1ebf87[_0xa477('0xd0')],'VoiceQueueId':_0x1ebf87[_0xa477('0x102')]||undefined,'CampaignId':_0x1ebf87['CampaignId']||undefined})[_0xa477('0xac')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x21abe1[_0xa477('0xc8')](createObjHistory(_0x58f9b2,_0x1ebf87,_0xa477('0x1ec'),0x17,_0xa477('0x1ed')))['catch'](loggerCatch(_0xa477('0x1ee')));}else{_0x21abe1[_0xa477('0xce')](createObjHistory(_0x58f9b2,_0x1ebf87,_0xa477('0x1ef'),0x16,_0xa477('0x1f0')),_0xa477('0x1f1'),_0xa477('0x1f2'));}}}}else{_0x58f9b2[_0xa477('0x1f3')]+=0x1;_0x21abe1[_0xa477('0xce')](createObjHistory(_0x58f9b2,_0x1ebf87,_0xa477('0x1f4'),0xd,'Blacklist'),_0xa477('0x1f5'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0xa477('0x18')][_0xa477('0x1f6')]=function(_0x51f621){var _0x58e692=this;var _0x46c760=_0x51f621[_0xa477('0x1f7')]-_0x51f621[_0xa477('0x72')]-_0x51f621[_0xa477('0xc1')];emitCampaignSummary(_0x51f621);if(_0x46c760>0x0){if(_0x46c760>this[_0xa477('0x21')]){_0x46c760=this[_0xa477('0x21')];}_0x51f621[_0xa477('0xc1')]+=_0x46c760;this[_0xa477('0xc3')](_0x51f621['id'],_0x46c760,_0x51f621['dialOrderByScheduledAt'],_0x51f621)['then'](function(_0x5193f0){_0x51f621[_0xa477('0xc1')]-=_0x46c760;_0x51f621[_0xa477('0xc1')]=_0x51f621[_0xa477('0xc1')]>0x0?_0x51f621[_0xa477('0xc1')]:0x0;if(!checkContactEmpty(_0x5193f0)){_0x51f621[_0xa477('0x3c')]=_0xa477('0x9b');logger[_0xa477('0x7f')](_0xa477('0x1f8')+_0x51f621[_0xa477('0x3e')]);}else{_0x51f621[_0xa477('0x72')]+=_0x5193f0[_0xa477('0x97')];_0x51f621[_0xa477('0x3c')]=_0xa477('0x1f9');for(var _0x4b4d53=0x0;_0x4b4d53<_0x5193f0[_0xa477('0x97')];_0x4b4d53+=0x1){_0x51f621['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x5193f0[_0x4b4d53])||_[_0xa477('0xa9')](_0x5193f0[_0x4b4d53][_0xa477('0x169')])||_[_0xa477('0xa9')](_0x5193f0[_0x4b4d53][_0xa477('0x169')][_0xa477('0x16a')])){_0x58e692[_0xa477('0xcc')](_0xa477('0x1fa'),_0x51f621,_0x5193f0[_0x4b4d53]);}else{_0x58e692[_0xa477('0xb7')](_[_0xa477('0xcf')](_0x5193f0[_0x4b4d53],['CampaignId','Contact.phone']))[_0xa477('0xb2')](_0x58e692[_0xa477('0x1e1')](_0x51f621,_0x5193f0[_0x4b4d53]))[_0xa477('0xac')](_0x58e692[_0xa477('0xcb')](_0xa477('0x1fb'),_0x51f621));}}}})['catch'](loggerGetContactDialer(_0xa477('0x1fc'),_0x51f621,_0x46c760));}};Dialer[_0xa477('0x18')][_0xa477('0x155')]=function(_0x3d0536,_0x31d6f0){var _0x5aa990=this;var _0x22e4c6=[];var _0x5b9454=_0x31d6f0>=0x1?_0x31d6f0:0x1;if(_0x3d0536[_0xa477('0x5a')]===_0xa477('0x7')){_0x5b9454=0x1;}var _0x5e8a7c=Math[_0xa477('0x1c4')](_0x3d0536[_0xa477('0x4f')]*_0x5b9454)-_0x3d0536[_0xa477('0x72')]-_0x3d0536['temp'];emitVoiceQueueSummary(_0x3d0536);if(_0x3d0536['dialLimitQueue']>0x0){var _0x19e5a6=_0x3d0536['dialLimitQueue']-_0x3d0536['originated']-_0x3d0536['talking']-_0x3d0536[_0xa477('0xc1')]-_0x3d0536['pTalking'];if(_0x5e8a7c>_0x19e5a6){_0x5e8a7c=_0x19e5a6;}}if(_0x5e8a7c>0x0){if(_0x3d0536[_0xa477('0x5a')]===_0xa477('0x7')){_0x5e8a7c=0x1;}if(_0x5e8a7c>this['maxNumberOriginate']){_0x5e8a7c=this['maxNumberOriginate'];}_0x3d0536[_0xa477('0xc1')]+=_0x5e8a7c;for(var _0x451140 in this['agents']){if(typeof this[_0xa477('0x1f')][_0x451140]!=='undefined'){if(this[_0xa477('0x1f')][_0x451140][_0xa477('0xf9')]==='not_inuse'&&this[_0xa477('0x1f')][_0x451140]['status']===_0xa477('0xd6')){_0x22e4c6[_0xa477('0x148')](this[_0xa477('0x1f')][_0x451140]['id']);}}}this[_0xa477('0xc0')](_0x3d0536['id'],_0x22e4c6,_0x5e8a7c,_0x3d0536[_0xa477('0x1fd')],_0x3d0536)['then'](function(_0x289a12){_0x3d0536[_0xa477('0xc1')]-=_0x5e8a7c;_0x3d0536['temp']=_0x3d0536[_0xa477('0xc1')]>0x0?_0x3d0536['temp']:0x0;if(!checkContactEmpty(_0x289a12)){_0x5aa990['countReScheduled'](_0x3d0536)['then'](sendMessageReschedule(_0x3d0536))['catch'](loggerCatch(_0xa477('0xb4')));}else{_0x3d0536['originated']+=_0x289a12[_0xa477('0x97')];_0x3d0536[_0xa477('0x3c')]=_0x3d0536[_0xa477('0x5a')]===_0xa477('0x7')?_0xa477('0x1fe'):_0xa477('0x1f9');for(var _0xea5d85=0x0;_0xea5d85<_0x289a12['length'];_0xea5d85+=0x1){if(_[_0xa477('0xa9')](_0x289a12[_0xea5d85])||_['isNil'](_0x289a12[_0xea5d85][_0xa477('0x169')])||_[_0xa477('0xa9')](_0x289a12[_0xea5d85][_0xa477('0x169')][_0xa477('0x16a')])){_0x5aa990[_0xa477('0xcc')](_0xa477('0x1fa'),_0x3d0536,_0x289a12[_0xea5d85]);}else{_0x5aa990['checkIsBlackList'](_[_0xa477('0xcf')](_0x289a12[_0xea5d85],[_0xa477('0x102'),_0xa477('0x1ff')]))[_0xa477('0xb2')](_0x5aa990['checkContactBlack'](_0x3d0536,_0x289a12[_0xea5d85]))[_0xa477('0xac')](_0x5aa990[_0xa477('0xcb')](_0xa477('0x1fa'),_0x3d0536));}}}})[_0xa477('0xac')](loggerGetContactDialer(_0xa477('0x200'),_0x3d0536,_0x5e8a7c));}};Dialer[_0xa477('0x18')][_0xa477('0x91')]=function(_0x4ad77e){if(_0x4ad77e[_0xa477('0x201')]>0x0){var _0x53aac1=_0x4ad77e[_0xa477('0x201')]-_0x4ad77e['originated']-_0x4ad77e['talking'];if(_0x53aac1>0x0){this[_0xa477('0x202')](_0x4ad77e);}else{loggerPredictiveCalls['info'](_0xa477('0x203'));}}else{this[_0xa477('0x202')](_0x4ad77e);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x28fe51){var _0x2ab951=this;var _0x417a5b=[];_0x28fe51[_0xa477('0x72')]+=0x1;for(var _0x3dc38c in this['agents']){if(typeof this[_0xa477('0x1f')][_0x3dc38c]!=='undefined'){if(this['agents'][_0x3dc38c][_0xa477('0xf9')]===_0xa477('0x204')&&this[_0xa477('0x1f')][_0x3dc38c][_0xa477('0xab')]==='reachable'){_0x417a5b[_0xa477('0x148')](this[_0xa477('0x1f')][_0x3dc38c]['id']);}}}this['getContactDialer'](_0x28fe51['id'],_0x417a5b,0x1,_0x28fe51['dialOrderByScheduledAt'],_0x28fe51)[_0xa477('0xb2')](function(_0xb392b){if(!checkContactEmpty(_0xb392b)){checkContactLowerLimitOriginate(_0x28fe51,0x1,0x0);_0x2ab951[_0xa477('0xb3')](_0x28fe51)['then'](sendMessageReschedule(_0x28fe51))[_0xa477('0xac')](loggerCatch(_0xa477('0xb4')));}else{_0x28fe51[_0xa477('0x3c')]=_0xa477('0x1f9');if(_['isNil'](_0xb392b[0x0])||_[_0xa477('0xa9')](_0xb392b[0x0]['Contact'])||_['isNil'](_0xb392b[0x0][_0xa477('0x169')][_0xa477('0x16a')])){_0x2ab951[_0xa477('0xcc')](_0xa477('0x1fa'),_0x28fe51,_0xb392b[0x0]);}else{_0x2ab951[_0xa477('0xb5')](_[_0xa477('0xcf')](_0xb392b[0x0],[_0xa477('0x102'),_0xa477('0x1ff')]))[_0xa477('0xb2')](_0x2ab951[_0xa477('0x1e1')](_0x28fe51,_0xb392b[0x0]))[_0xa477('0xac')](_0x2ab951[_0xa477('0xcb')](_0xa477('0x205'),_0x28fe51));}}})[_0xa477('0xac')](loggerGetContactDialer(_0xa477('0x206'),_0x28fe51,0x1));emitVoiceQueueSummary(_0x28fe51);};Dialer['prototype']['abandonmentRate']=function(_0x4781ef,_0x5a651e,_0x596b09,_0x372f84,_0x44195f,_0xeff84e){loggerPredictive['info'](_0xa477('0x207'));loggerPredictive[_0xa477('0x7f')](_0xa477('0x208'),_0x4781ef);loggerPredictive[_0xa477('0x7f')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5a651e);loggerPredictive[_0xa477('0x7f')](_0xa477('0x209'),_0x596b09);loggerPredictive['info'](_0xa477('0x20a'),_0x372f84);loggerPredictive['info'](_0xa477('0x20b'),_0x44195f);loggerPredictive[_0xa477('0x7f')](_0xa477('0x87'));return new BPromise(function(_0x1bc8c7,_0x1500dd){if(_0x4781ef<=0x0||isNaN(_0x4781ef)){return _0x1500dd(msgResponse(_0xa477('0x20c'),_0xa477('0x48'),_0xa477('0x20d')+_0x4781ef));}if(_0x596b09<=0x0||isNaN(_0x596b09)){return _0x1500dd(msgResponse(_0xa477('0x20c'),'Error',_0xa477('0x20e')+_0x596b09));}if(_0x372f84<=0x0||isNaN(_0x372f84)){return _0x1500dd(msgResponse('[abandonmentRate]',_0xa477('0x48'),_0xa477('0x20f')+_0x372f84));}if(_0x5a651e<=0x0||isNaN(_0x5a651e)){return _0x1500dd(msgResponse(_0xa477('0x20c'),_0xa477('0x48'),'interval\x20=\x20'+_0x5a651e));}if(_0x44195f<=0x0||isNaN(_0x44195f)){return _0x1500dd(msgResponse(_0xa477('0x20c'),_0xa477('0x48'),'Amax\x20=\x20'+_0x44195f));}_0xeff84e=_0xeff84e||0x0;var _0x14567c=0x1/_0x596b09;var _0x26aefd=0x0;var _0x462a80=0x0;var _0x4c800d=0x0;var _0x1ab96d=0x0;for(var _0x214e55=0x0;_0x4c800d<_0x44195f;_0x214e55+=0x1){_0x462a80=_0x214e55/_0x5a651e;_0x26aefd=(_0x372f84*_0x462a80+_0xeff84e)/_0x14567c;_0x4c800d=erlangb(_0x26aefd,_0x4781ef);_0x1ab96d=_0x26aefd/_0x4781ef*(0x1-erlangb(_0x26aefd,_0x4781ef));}return _0x1bc8c7({'erlangCalls':_0x214e55,'erlangCallToSecond':_0x5a651e/_0x214e55,'erlangAbandonmentRate':_0x4c800d,'erlangBusyFactor':_0x1ab96d});});};Dialer[_0xa477('0x18')]['busyFactor']=function(_0x5ef886,_0x39c84e,_0x121c71,_0x43cebc,_0x27e1d,_0x1afe16){loggerPredictive[_0xa477('0x7f')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xa477('0x7f')](_0xa477('0x208'),_0x5ef886);loggerPredictive[_0xa477('0x7f')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x39c84e);loggerPredictive[_0xa477('0x7f')](_0xa477('0x209'),_0x121c71);loggerPredictive[_0xa477('0x7f')](_0xa477('0x20a'),_0x43cebc);loggerPredictive['info'](_0xa477('0x210'),_0x27e1d);loggerPredictive[_0xa477('0x7f')](_0xa477('0x87'));return new BPromise(function(_0x285986,_0x33bdae){if(_0x5ef886<=0x0||isNaN(_0x5ef886)){return _0x33bdae(msgResponse(_0xa477('0x211'),'Error',_0xa477('0x20d')+_0x5ef886));}if(_0x121c71<=0x0||isNaN(_0x121c71)){return _0x33bdae(msgResponse(_0xa477('0x211'),_0xa477('0x48'),'Ts\x20=\x20'+_0x121c71));}if(_0x43cebc<=0x0||isNaN(_0x43cebc)){return _0x33bdae(msgResponse('[busyFactor]',_0xa477('0x48'),_0xa477('0x20f')+_0x43cebc));}if(_0x39c84e<=0x0||isNaN(_0x39c84e)){return _0x33bdae(msgResponse(_0xa477('0x211'),_0xa477('0x48'),'interval\x20=\x20'+_0x39c84e));}if(_0x27e1d<=0x0||isNaN(_0x27e1d)){return _0x33bdae(msgResponse(_0xa477('0x211'),'Error',_0xa477('0x212')+_0x27e1d));}_0x1afe16=_0x1afe16||0x0;var _0x169a77=0x1/_0x121c71;var _0x2d36d6=0x0;var _0x41a53c=0x0;var _0x84d90c=0x0;var _0x58933d=0x0;for(var _0xcf388=0x0;_0x58933d<_0x27e1d;_0xcf388+=0x1){_0x41a53c=_0xcf388/_0x39c84e;_0x2d36d6=(_0x43cebc*_0x41a53c+_0x1afe16)/_0x169a77;_0x84d90c=erlangb(_0x2d36d6,_0x5ef886);_0x58933d=_0x2d36d6/_0x5ef886*(0x1-erlangb(_0x2d36d6,_0x5ef886));}return _0x285986({'erlangCalls':_0xcf388,'erlangCallToSecond':_0x39c84e/_0xcf388,'erlangAbandonmentRate':_0x84d90c,'erlangBusyFactor':_0x58933d});});};module[_0xa477('0x213')]=Dialer; \ No newline at end of file +var _0x2621=['waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','Interval','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','info','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','isUndefined','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','diff','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','isEmpty','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','starttime','clearZombieChannels','[uniqueid]','[actions]','enqueue','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','ContactId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','Success','SIP/%s','reachable','saveInDb','uniqueId','uniqueid','variable','exten','xcally-motion-dialer','value','state','HangupInAMD','emit','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','membername','AMD','countmachineretry','countglobal','custom:amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnosuchnumberretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','[rescheduleContact][Machine]','dialAMDActive','HANGUP','[syncHangupInAMDIvr]','countbusyretry','countnoanswerretry','countdropretry','countabandonedretry','dialGlobalMaxRetry','add','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','Unknow','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','syncAgentConnect','answertime','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','TIMEOUT','dialDropMaxRetry','queueCallerAbandonCreateState','dialDropRetryFrequency','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','dropreason','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','strategy','paused','agents','stateinterface','locked','rrmemory','queueBooked','pick','idHopper','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','syncCampaigns','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','content','indexOf','true','push','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','power','dialPowerLevel','predictive','Queue','method\x20not\x20recognized','handleIvr','loggedIn','checkIsTrunkReachable','checkIfTime','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','pow','replace','match','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','%s%s','toUpper','callerid','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','substring','trim','dialCutDigit','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','startMethodPredictive','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','getDataPredictive','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','checkContactBlack','UserId','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','Blacklist','[Originate][historyBlacklist]','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','tryOriginatePredictive','[handlePredictive][limitChannel]','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','busyFactor','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','roundrobin','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','trunks','maxNumberOriginate','actions','contactsId','optionPredictive','startPredictive','startProgressive','queueBookedRR','queuecallerabandon','originateresponse','syncOriginateResponse','syncAgentComplete','syncQueueSummary','hangup','syncHangup','bind','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','[ifTime][Action]','Error','stringify','milliseconds','seconds','type','outbound','answered','available','pTalking','sumDuration','sumHoldTime','talking','abandoned'];(function(_0x2f6409,_0x5a614a){var _0x485530=function(_0x40398a){while(--_0x40398a){_0x2f6409['push'](_0x2f6409['shift']());}};_0x485530(++_0x5a614a);}(_0x2621,0x1d2));var _0x1262=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2621[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x1262('0x0'));var _=require(_0x1262('0x1'));var BPromise=require(_0x1262('0x2'));var uuid=require(_0x1262('0x3'));var moment=require(_0x1262('0x4'));var rr=require('rr');var md5=require(_0x1262('0x5'));var Redis=require(_0x1262('0x6'));var ut=require(_0x1262('0x7'));var config=require(_0x1262('0x8'));var logger=require(_0x1262('0x9'))(_0x1262('0xa'));var loggerBooked=require(_0x1262('0x9'))(_0x1262('0xb'));var loggerPredictive=require(_0x1262('0x9'))('predictive');var loggerPredictiveCalls=require(_0x1262('0x9'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x1262('0x9'))('syncQueueSummary');var ami=require(_0x1262('0xc'));config[_0x1262('0xd')]=_[_0x1262('0xe')](config['redis'],{'host':_0x1262('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1262('0xd')]));var cmHopper=require(_0x1262('0x10'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x1262('0x11'));var Action=require(_0x1262('0x12'));var History=require(_0x1262('0x13'));var Final=require(_0x1262('0x14'));var AgentComplete=require(_0x1262('0x15'));var QueueCallerAbandon=require(_0x1262('0x16'));var Hangup=require('./hangup');var ipAgi=process[_0x1262('0x17')][_0x1262('0x18')]||_0x1262('0x19');var strategy={'rrmemory':'rrmemory','roundrobin':_0x1262('0x1a')};var Sequence=function(){};Sequence[_0x1262('0x1b')]['enqueue']=function(_0x58df0c){this[_0x1262('0x1c')]=this[_0x1262('0x1c')]?this['tail'][_0x1262('0x1d')](_0x58df0c):_0x58df0c();};function Dialer(_0x520454,_0x3be359){this[_0x1262('0x1e')]=new Sequence();this[_0x1262('0x1f')]=_0x3be359;this[_0x1262('0x20')]=_0x520454[_0x1262('0x20')];this[_0x1262('0x21')]=_0x520454[_0x1262('0x21')];this['agents']=_0x520454['agents'];this['trunks']=_0x520454[_0x1262('0x22')];this[_0x1262('0x23')]=config['maxNumberOriginate']||0x2;this['channels']={};this[_0x1262('0x24')]={};this[_0x1262('0x25')]={};this['uniqueId']={};this[_0x1262('0x26')]={};this[_0x1262('0x27')]={};this[_0x1262('0x28')]={};this['ivrOriginated']={};this['queueBooked']={};this[_0x1262('0x29')]={};ami['on']('agentconnect',this['syncAgentConnect']['bind'](this));ami['on'](_0x1262('0x2a'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x1262('0x2b'),this[_0x1262('0x2c')]['bind'](this));ami['on']('agentcomplete',this[_0x1262('0x2d')]['bind'](this));ami['on']('custom:queuesummary',this[_0x1262('0x2e')]['bind'](this));ami['on'](_0x1262('0x2f'),this[_0x1262('0x30')][_0x1262('0x31')](this));ami['on'](_0x1262('0x32'),this[_0x1262('0x33')][_0x1262('0x31')](this));ami['on'](_0x1262('0x34'),this[_0x1262('0x35')][_0x1262('0x31')](this));ami['on'](_0x1262('0x36'),this[_0x1262('0x37')][_0x1262('0x31')](this));ami['on'](_0x1262('0x38'),this[_0x1262('0x39')][_0x1262('0x31')](this));this['loopCampaigns']();this[_0x1262('0x3a')]();}function isNotNull(_0x179b32){return _0x179b32!==null&&!_['isUndefined'](_0x179b32);}function checkIsLoggedIn(_0x28d936,_0x53c596){return function(){if(_0x53c596<=0x0){_0x28d936[_0x1262('0x3b')]=_0x1262('0x3c');throw _0x28d936[_0x1262('0x3d')]+_0x1262('0x3e');}};}function isActive(_0x341488){return _0x341488;}function checkIsActive(_0x3a5059,_0xaefea8){return function(){if(!isActive(_0xaefea8)){_0x3a5059[_0x1262('0x3b')]=_0x1262('0x3f');throw _0x3a5059['name']+_0x1262('0x40');}};}function checkInterval(_0x447b30){return function(){if(!isNotNull(_0x447b30['Interval'])){_0x447b30[_0x1262('0x3b')]=_0x1262('0x41');throw _0x447b30[_0x1262('0x3d')]+_0x1262('0x42');}if(!isNotNull(_0x447b30['Interval'][_0x1262('0x43')])){_0x447b30[_0x1262('0x3b')]=_0x1262('0x41');throw _0x447b30['name']+_0x1262('0x42');}if(!isNotNull(_['isEmpty'](_0x447b30['Interval']['Intervals']))){_0x447b30[_0x1262('0x3b')]=_0x1262('0x41');throw _0x447b30[_0x1262('0x3d')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x57bb3b,_0xb4275e,_0x4540a2){return{'action':_0x57bb3b,'response':_0xb4275e,'message':_0x4540a2,'stack':_0x4540a2};}function myreject(_0x29b931){return function(_0x1df965){return _0x29b931(msgResponse(_0x1262('0x44'),_0x1262('0x45'),JSON[_0x1262('0x46')](_0x1df965)));};}function getSeconds(_0x35b70c,_0x5f2d39){var _0x562aad=moment(_0x35b70c)[_0x1262('0x47')](0x0);var _0x3bd7a2=moment(_0x5f2d39)[_0x1262('0x47')](0x0);return _0x562aad['diff'](_0x3bd7a2,_0x1262('0x48'));}function emit(_0x5bf401,_0x2c480d,_0x507604){io['to'](_0x5bf401)['emit'](_0x2c480d,_0x507604);}function emitVoiceQueueSummary(_0x51c5b4){if(_0x51c5b4[_0x1262('0x49')]===_0x1262('0x4a')){var _0x4f1093={'id':_0x51c5b4['id'],'name':_0x51c5b4[_0x1262('0x3d')],'strategy':_0x51c5b4['strategy'],'answered':_0x51c5b4[_0x1262('0x4b')],'available':_0x51c5b4[_0x1262('0x4c')],'loggedIn':_0x51c5b4['loggedIn'],'pTalking':_0x51c5b4[_0x1262('0x4d')],'sumBillable':_0x51c5b4['sumBillable'],'sumDuration':_0x51c5b4[_0x1262('0x4e')],'sumHoldTime':_0x51c5b4[_0x1262('0x4f')]||0x0,'talking':_0x51c5b4[_0x1262('0x50')],'total':_0x51c5b4['total'],'type':_0x51c5b4['type'],'unmanaged':_0x51c5b4['unmanaged'],'abandoned':_0x51c5b4[_0x1262('0x51')],'waiting':_0x51c5b4[_0x1262('0x52')],'loggedInDb':_0x51c5b4[_0x1262('0x53')],'dialActive':_0x51c5b4[_0x1262('0x54')],'dialMethod':_0x51c5b4[_0x1262('0x55')],'dialOriginateCallerIdName':_0x51c5b4[_0x1262('0x56')],'dialOriginateCallerIdNumber':_0x51c5b4[_0x1262('0x57')],'dialOriginateTimeout':_0x51c5b4[_0x1262('0x58')],'dialPrefix':_0x51c5b4[_0x1262('0x59')],'outboundAnswerAgiCallsDay':_0x51c5b4[_0x1262('0x5a')],'outboundAnswerCallsDay':_0x51c5b4[_0x1262('0x5b')],'outboundBlacklistCallsDay':_0x51c5b4[_0x1262('0x5c')],'outboundBusyCallsDay':_0x51c5b4[_0x1262('0x5d')],'outboundCongestionCallsDay':_0x51c5b4['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x51c5b4['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x51c5b4['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x51c5b4['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x51c5b4['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x51c5b4['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x51c5b4[_0x1262('0x5e')],'outboundReCallsDay':_0x51c5b4[_0x1262('0x5f')],'outboundRejectCallsDay':_0x51c5b4['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x51c5b4['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x51c5b4[_0x1262('0x60')],'predictiveIntervalAvgHoldtime':_0x51c5b4[_0x1262('0x61')],'predictiveIntervalAvgTalktime':_0x51c5b4[_0x1262('0x62')],'predictiveIntervalDroppedCallsCallersExit':_0x51c5b4['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x51c5b4[_0x1262('0x63')],'predictiveIntervalErlangCalls':_0x51c5b4[_0x1262('0x64')],'predictiveIntervalErlangCallsDroppedCalls':_0x51c5b4[_0x1262('0x65')],'predictiveIntervalHitRate':_0x51c5b4[_0x1262('0x66')],'predictiveIntervalMultiplicativeFactor':_0x51c5b4[_0x1262('0x67')],'predictiveIntervalPauses':_0x51c5b4[_0x1262('0x68')],'predictiveIntervalAvailable':_0x51c5b4[_0x1262('0x69')],'predictiveIntervalTotalCalls':_0x51c5b4['predictiveIntervalTotalCalls'],'message':_0x51c5b4[_0x1262('0x3b')],'originated':_0x51c5b4[_0x1262('0x6a')],'erlangCalls':_0x51c5b4[_0x1262('0x6b')],'erlangCallToSecond':_0x51c5b4[_0x1262('0x6c')],'erlangAbandonmentRate':_0x51c5b4[_0x1262('0x6d')],'erlangBusyFactor':_0x51c5b4[_0x1262('0x6e')],'startPredictive':_0x51c5b4[_0x1262('0x27')],'startProgressive':_0x51c5b4[_0x1262('0x28')]};if(_0x51c5b4[_0x1262('0x6f')]){_0x4f1093['Trunk']={'id':_0x51c5b4[_0x1262('0x6f')]['id'],'name':_0x51c5b4[_0x1262('0x6f')][_0x1262('0x3d')],'active':_0x51c5b4[_0x1262('0x6f')][_0x1262('0x70')],'callerid':_0x51c5b4[_0x1262('0x6f')]['callerid']};}if(_0x51c5b4['Interval']){_0x4f1093['Interval']={'id':_0x51c5b4[_0x1262('0x71')]['id'],'name':_0x51c5b4[_0x1262('0x71')][_0x1262('0x3d')]};}var _0x61deec=md5(JSON[_0x1262('0x46')](_0x4f1093));if(_0x51c5b4[_0x1262('0x5')]!==_0x61deec){_0x51c5b4[_0x1262('0x5')]=_0x61deec;emit(util[_0x1262('0x72')](_0x1262('0x73'),_0x4f1093['name']),_0x1262('0x74'),_0x4f1093);}}}function emitCampaignSummary(_0x330bbf){if(_0x330bbf['type']===_0x1262('0x75')){emit(util[_0x1262('0x72')](_0x1262('0x76'),_0x330bbf[_0x1262('0x3d')]),_0x1262('0x77'),_0x330bbf);}}function checkGetDataPredictive(_0x27365b){if(isNotNull(_0x27365b)&&!_['isEmpty'](_0x27365b)){loggerPredictive['info'](_0x1262('0x78'));loggerPredictive['info'](_0x1262('0x79'),_0x27365b[_0x1262('0x7a')]);loggerPredictive['info'](_0x1262('0x7b'),_0x27365b[_0x1262('0x60')]);loggerPredictive[_0x1262('0x7c')](_0x1262('0x7d'),_0x27365b[_0x1262('0x63')]);loggerPredictive[_0x1262('0x7c')](_0x1262('0x7e'),_0x27365b[_0x1262('0x7f')]);loggerPredictive[_0x1262('0x7c')](_0x1262('0x80'),_0x27365b[_0x1262('0x61')]);loggerPredictive[_0x1262('0x7c')](_0x1262('0x81'),_0x27365b[_0x1262('0x62')]);loggerPredictive[_0x1262('0x7c')]('---------------------------');if(_0x27365b[_0x1262('0x7a')]>0x0){if(!_['isUndefined'](_0x27365b['predictiveIntervalAvgTalktime'])&&_0x27365b[_0x1262('0x62')]>0x0){return!![];}loggerPredictive[_0x1262('0x7c')](_0x1262('0x82'));if(!_[_0x1262('0x83')](_0x27365b['predictiveIntervalAvgHoldtime'])&&_0x27365b['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x1262('0x7c')](_0x1262('0x84'));}else{loggerPredictive[_0x1262('0x7c')](_0x1262('0x85'));}}else{loggerPredictive[_0x1262('0x7c')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0xd4545d){return function(_0x368165){loggerPredictive[_0x1262('0x7c')](_0x1262('0x86'));loggerPredictive[_0x1262('0x7c')](_0x1262('0x87'),_0x368165[_0x1262('0x6b')]);loggerPredictive[_0x1262('0x7c')](_0x1262('0x88'),_0x368165[_0x1262('0x6c')]);loggerPredictive['info'](_0x1262('0x89'),_0x368165[_0x1262('0x6d')]);loggerPredictive[_0x1262('0x7c')](_0x1262('0x8a'),_0x368165['erlangBusyFactor']);loggerPredictive[_0x1262('0x7c')](_0x1262('0x89'),_0x368165[_0x1262('0x6d')]);loggerPredictive[_0x1262('0x7c')]('---------------------------');_[_0x1262('0x8b')](_0xd4545d,_0x368165);};}function getDiff(_0x47e331){var _0x9cc3c8=moment()[_0x1262('0x47')](0x0);var _0x133961=moment(_0x47e331)['milliseconds'](0x0);return _0x9cc3c8[_0x1262('0x8c')](_0x133961,_0x1262('0x48'));}function ifInterval(_0x4a37ee,_0xf6716){if(_['isUndefined'](_0xf6716)){return![];}return getDiff(_0xf6716)<_0x4a37ee*0x3c;}function freeVariablesPredictive(_0x14a5c7){if(isNotNull(_0x14a5c7)){if(!_['isUndefined'](_0x14a5c7[_0x1262('0x28')])){_0x14a5c7[_0x1262('0x28')]=undefined;loggerPredictive[_0x1262('0x7c')](_0x14a5c7[_0x1262('0x3d')],_0x1262('0x8d'));}if(!_[_0x1262('0x83')](_0x14a5c7[_0x1262('0x27')])){_0x14a5c7[_0x1262('0x27')]=undefined;loggerPredictive[_0x1262('0x7c')](_0x14a5c7['name'],_0x1262('0x8e'));}if(!_[_0x1262('0x83')](_0x14a5c7[_0x1262('0x8f')])){clearInterval(_0x14a5c7[_0x1262('0x8f')]);_0x14a5c7['handlePredictive']=undefined;loggerPredictive[_0x1262('0x7c')](_0x14a5c7[_0x1262('0x3d')],_0x1262('0x90'));}}}function erlangb(_0x46e4fb,_0x28de0e){if(_0x28de0e===0x0){return 0x0;}var _0x3cc843=0x1;for(var _0x5a1565=0x1;_0x5a1565<=_0x28de0e;_0x5a1565+=0x1){_0x3cc843=0x1+_0x3cc843*_0x5a1565/_0x46e4fb;}return 0x1/_0x3cc843;}function isVoiceQueueOutbound(_0x41ba5d){return _0x41ba5d==='outbound';}function isNotPreview(_0x4792a5){return _0x4792a5!==_0x1262('0x1f');}function isCampaignIvr(_0x401b6c){return _0x401b6c===_0x1262('0x75');}function getCallerId(_0xb48c82,_0x1119e0,_0x2d1b1b){if(!_[_0x1262('0x83')](_0x2d1b1b)&&typeof _0x2d1b1b===_0x1262('0x91')&&!_[_0x1262('0x92')](_0x2d1b1b)){if(!_[_0x1262('0x83')](_0x1119e0)&&typeof _0x1119e0==='string'&&!_[_0x1262('0x92')](_0x1119e0)){return util[_0x1262('0x72')](_0x1262('0x93'),_0x1119e0,_0x2d1b1b);}return util['format'](_0x1262('0x93'),_0x2d1b1b,_0x2d1b1b);}if(!_[_0x1262('0x83')](_0xb48c82)&&typeof _0xb48c82===_0x1262('0x91')&&!_['isEmpty'](_0xb48c82)){return _0xb48c82;}return _0x1262('0x94');}function loggerCatchQueueSummary(_0x119823,_0x17ea32){return function(_0x5de6dd){freeVariablesPredictive(_0x17ea32);emitVoiceQueueSummary(_0x17ea32);emitCampaignSummary(_0x17ea32);loggerSyncQueueSummary[_0x1262('0x95')](_0x119823,util[_0x1262('0x96')](_0x5de6dd,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x565b2a,_0x34e0d8){return function(_0x2eb8ad){loggerPredictive[_0x1262('0x95')](_0x34e0d8[_0x1262('0x3d')],_0x565b2a);loggerPredictive['error'](_0x2eb8ad['stack']);freeVariablesPredictive(_0x34e0d8);};}function loggerCatch(_0x43116a){return function(_0x87e875){logger[_0x1262('0x95')](_0x43116a,util[_0x1262('0x96')](_0x87e875,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0xa4a3ee){return _0xa4a3ee&&!_['isUndefined'](_0xa4a3ee)&&_0xa4a3ee[_0x1262('0x97')]>0x0;}function decremetOriginate(_0xc8cbc5){if(!_['isUndefined'](_0xc8cbc5)&&_0xc8cbc5!==null){if(typeof _0xc8cbc5[_0x1262('0x6a')]!==_0x1262('0x98')){if(_0xc8cbc5[_0x1262('0x6a')]>0x0){_0xc8cbc5[_0x1262('0x6a')]-=0x1;}else{logger['error'](_0x1262('0x99'));}}}else{logger[_0x1262('0x95')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x302fa4,_0x50224b,_0xba3e70){if(_0x50224b>_0xba3e70){for(var _0xfa3e64=0x0;_0xfa3e64<_0x50224b-_0xba3e70;_0xfa3e64+=0x1){decremetOriginate(_0x302fa4);}}}function loggerGetContactDialer(_0x21ac64,_0x38b065,_0x115739){return function(_0x3b4488){checkContactLowerLimitOriginate(_0x38b065,_0x115739,0x0);logger[_0x1262('0x95')](_0x21ac64,util[_0x1262('0x96')](_0x3b4488,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2eec65){return function(_0x274b77){if(isNotNull(_0x274b77)&&isNotNull(_0x274b77[0x0])){if(_0x274b77[0x0]['contactsRescheduled']>0x0){_0x2eec65[_0x1262('0x3b')]=_0x1262('0x9a');logger[_0x1262('0x7c')](_0x1262('0x9b')+_0x2eec65['name'],_0x274b77[0x0][_0x1262('0x9c')],_0x1262('0x9d'));}else{_0x2eec65[_0x1262('0x3b')]=_0x1262('0x9e');logger[_0x1262('0x7c')](_0x1262('0x9f')+_0x2eec65[_0x1262('0x3d')]);}}};}function notSendMessagesQueue(_0x15b6f1){if(_0x15b6f1[_0x1262('0xa0')]){freeVariablesPredictive(_0x15b6f1);if(_0x15b6f1[_0x1262('0x6a')]===0x0&&_0x15b6f1['talking']===0x0&&_0x15b6f1[_0x1262('0x52')]===0x0&&(_0x15b6f1[_0x1262('0x4d')]||0x0)===0x0){_0x15b6f1[_0x1262('0xa0')]=![];_0x15b6f1[_0x1262('0x4c')]=0x0;_0x15b6f1[_0x1262('0x3b')]=_0x1262('0x3f');loggerSyncQueueSummary[_0x1262('0x95')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x15b6f1[_0x1262('0x3d')],_0x1262('0xa1'));}else{_0x15b6f1[_0x1262('0x3b')]=_0x1262('0xa2');loggerSyncQueueSummary[_0x1262('0x95')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x15b6f1[_0x1262('0x3d')],_0x1262('0xa3'));}emitVoiceQueueSummary(_0x15b6f1);}}function notSendMessagesCampaign(_0x1b35ce){if(_0x1b35ce[_0x1262('0xa0')]){if(_0x1b35ce[_0x1262('0x6a')]===0x0){_0x1b35ce[_0x1262('0xa0')]=![];_0x1b35ce['message']=_0x1262('0x3f');loggerSyncQueueSummary['error'](_0x1262('0xa4'),_0x1b35ce[_0x1262('0x3d')],_0x1262('0xa1'));}else{_0x1b35ce['message']='IS_DISACTIVED';loggerSyncQueueSummary[_0x1262('0x95')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x1b35ce[_0x1262('0x3d')],_0x1262('0xa3'));}emitCampaignSummary(_0x1b35ce);}}function createObjHistory(_0x5b70dd,_0x8f7319,_0x55e1d5,_0x14909f,_0x435a5d){_0x5b70dd[_0x1262('0x3b')]=_0x55e1d5;var _0x2236ed=new Action(_0x5b70dd,_0x8f7319);var _0x1f1a9f=new History(_0x2236ed);_0x1f1a9f['state']=_0x14909f;_0x1f1a9f[_0x1262('0xa5')]=_0x435a5d;_0x1f1a9f['endtime']=_0x2236ed[_0x1262('0xa6')];return _0x1f1a9f;}Dialer[_0x1262('0x1b')]['loopClearZombieChannels']=function(){var _0x4bab84=this;setInterval(function(){_0x4bab84[_0x1262('0xa7')](_0x4bab84['uniqueId'],_0x1262('0xa8'));_0x4bab84['clearZombieChannels'](_0x4bab84[_0x1262('0x24')],_0x1262('0xa9'));},0x32c8);};Dialer[_0x1262('0x1b')][_0x1262('0xa7')]=function(_0x488ca2,_0x165f12){var _0x569ead=this;for(var _0xaa638b in _0x488ca2){if(typeof _0x488ca2[_0xaa638b]!==_0x1262('0x98')){this[_0x1262('0x1e')][_0x1262('0xaa')](function(){if(!_[_0x1262('0xab')](_0x488ca2[_0xaa638b])){return ami[_0x1262('0xac')]({'action':_0x1262('0xad'),'channel':_0x488ca2[_0xaa638b][_0x1262('0xae')]})[_0x1262('0xaf')](function(_0x3b6837){if(_0x3b6837[_0x1262('0x3b')]===_0x1262('0xb0')){setTimeout(function(){if(_0x488ca2[_0xaa638b]&&_0x488ca2[_0xaa638b][_0x1262('0x49')]!==_0x1262('0x75')){_0x569ead[_0x1262('0xb1')](_0x569ead[_0x1262('0x20')][_0x488ca2[_0xaa638b][_0x1262('0xb2')]]);logger[_0x1262('0x95')](_0x1262('0xb3'),_0x165f12,_0xaa638b,_0x488ca2[_0xaa638b]['queue']);delete _0x488ca2[_0xaa638b];}if(_0x488ca2[_0xaa638b]&&_0x488ca2[_0xaa638b][_0x1262('0x49')]===_0x1262('0x75')){_0x569ead[_0x1262('0xb1')](_0x569ead['campaigns'][_0x488ca2[_0xaa638b][_0x1262('0xb2')]]);logger['error'](_0x1262('0xb4'),_0x165f12,_0xaa638b,_0x488ca2[_0xaa638b]['queue']);delete _0x488ca2[_0xaa638b];}},0x2328);}});}});}}};Dialer['prototype'][_0x1262('0xb5')]=function(_0x2e43da){return BPromise[_0x1262('0xb6')]()[_0x1262('0xb7')](cmHopper[_0x1262('0xb5')](_0x2e43da))['catch'](loggerCatch(_0x1262('0xb8')));};Dialer[_0x1262('0x1b')][_0x1262('0xb9')]=function(_0x26cefa){return BPromise[_0x1262('0xb6')]()[_0x1262('0xb7')](cmHopperBlack[_0x1262('0xb9')](_0x26cefa))[_0x1262('0xaf')](loggerCatch(_0x1262('0xba')));};Dialer[_0x1262('0x1b')][_0x1262('0xbb')]=function(_0x5aef12){return BPromise[_0x1262('0xb6')]()[_0x1262('0xb7')](cmHopperBlack[_0x1262('0xbb')](_0x5aef12))[_0x1262('0xaf')](loggerCatch(_0x1262('0xbc')));};Dialer[_0x1262('0x1b')][_0x1262('0xbd')]=function(_0x550e51){return BPromise[_0x1262('0xb6')]()['then'](cmHopperHistory['avgHandleTime'](_0x550e51))['catch'](loggerCatch(_0x1262('0xbe')));};Dialer[_0x1262('0x1b')][_0x1262('0xbf')]=function(_0x192526){return BPromise[_0x1262('0xb6')]()[_0x1262('0xb7')](cmHopper[_0x1262('0xbf')](_0x192526))[_0x1262('0xaf')](loggerCatch(_0x1262('0xc0')));};Dialer[_0x1262('0x1b')][_0x1262('0xc1')]=function(_0x290ffa,_0x3f3d52,_0x34e3cf){return BPromise['resolve']()[_0x1262('0xb7')](cmHopper['unlockContact'](_0x290ffa,_0x3f3d52,_0x34e3cf))[_0x1262('0xaf')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x1262('0x1b')]['getContactDialer']=function(_0x5a9174,_0x138796,_0x55f390,_0x5b050e,_0x510839){return BPromise[_0x1262('0xb6')]()['then'](cmHopper[_0x1262('0xc2')](_0x5a9174,_0x138796,_0x55f390,_0x5b050e))[_0x1262('0xaf')](function(_0x4076ac){_0x510839[_0x1262('0xc3')]-=_0x55f390;_0x510839[_0x1262('0xc3')]=_0x510839[_0x1262('0xc3')]>0x0?_0x510839[_0x1262('0xc3')]:0x0;loggerCatch(_0x1262('0xc4'))(_0x4076ac);});};Dialer[_0x1262('0x1b')][_0x1262('0xc5')]=function(_0x544c19,_0x3c1ced,_0x9a9712,_0x100b32){return BPromise[_0x1262('0xb6')]()[_0x1262('0xb7')](cmHopper[_0x1262('0xc5')](_0x544c19,_0x3c1ced,_0x9a9712))[_0x1262('0xaf')](function(_0x157440){_0x100b32[_0x1262('0xc3')]-=_0x3c1ced;_0x100b32[_0x1262('0xc3')]=_0x100b32[_0x1262('0xc3')]>0x0?_0x100b32[_0x1262('0xc3')]:0x0;loggerCatch(_0x1262('0xc6'))(_0x157440);});};Dialer[_0x1262('0x1b')][_0x1262('0xc7')]=function(_0x5db653){return BPromise[_0x1262('0xb6')]()[_0x1262('0xb7')](voiceQueueRt['getVoiceQueueRtPauses'](_0x5db653))['catch'](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x1262('0x1b')][_0x1262('0xc8')]=function(_0x30e7eb){return BPromise[_0x1262('0xb6')]()[_0x1262('0xb7')](cmHopper[_0x1262('0xc8')](_0x30e7eb))[_0x1262('0xaf')](loggerCatch(_0x1262('0xc9')));};Dialer['prototype'][_0x1262('0xca')]=function(_0x711cc8){return BPromise['resolve']()['then'](cmHopperHistory[_0x1262('0xca')](_0x711cc8))['catch'](loggerCatch('[createHistory]\x20'));};Dialer['prototype'][_0x1262('0xb1')]=function(_0x3a1405){if(!_[_0x1262('0x83')](_0x3a1405)&&_0x3a1405!==null){if(typeof _0x3a1405[_0x1262('0x6a')]!==_0x1262('0x98')){if(_0x3a1405[_0x1262('0x6a')]>0x0){_0x3a1405['originated']-=0x1;}else{logger[_0x1262('0x95')](_0x1262('0xcb'));}}}else{logger[_0x1262('0x95')](_0x1262('0xcc'));}};Dialer[_0x1262('0x1b')][_0x1262('0xcd')]=function(_0x15978e,_0xefad3a){var _0x467567=this;return function(_0x2adf5f){_0x467567[_0x1262('0xb1')](_0xefad3a);logger[_0x1262('0x95')](_0x15978e,util[_0x1262('0x96')](_0x2adf5f,{'showHidden':![],'depth':null}));};};Dialer[_0x1262('0x1b')][_0x1262('0xce')]=function(_0x4d00d7,_0xcd7d6f,_0x3cb31e){var _0x5d070a={'state':0x19,'statedesc':_0x1262('0xcf')};this[_0x1262('0xb1')](_0xcd7d6f);this['saveInDb'](_[_0x1262('0x8b')](_0x5d070a,_['pick'](_0x3cb31e,[_0x1262('0xd0'),'ListId','UserId',_0x1262('0xd1'),_0x1262('0xd2')])),_0x1262('0xd3'),'[emptyContact]');logger['error'](_0x4d00d7);};Dialer[_0x1262('0x1b')]['isSuccess']=function(_0x3115e4){return _0x3115e4===_0x1262('0xd4');};Dialer[_0x1262('0x1b')]['isTrunkReachable']=function(_0x4039fd){return!_['isUndefined'](_0x4039fd)&&_0x4039fd&&!_[_0x1262('0x83')](_0x4039fd['name'])&&!_[_0x1262('0x83')](_0x4039fd[_0x1262('0x70')])&&_0x4039fd[_0x1262('0x70')]&&(this[_0x1262('0x22')][util['format'](_0x1262('0xd5'),_0x4039fd[_0x1262('0x3d')])][_0x1262('0xad')]===_0x1262('0xd6')||this['trunks'][util['format']('SIP/%s',_0x4039fd[_0x1262('0x3d')])][_0x1262('0xad')]==='unmonitored');};Dialer[_0x1262('0x1b')][_0x1262('0xd7')]=function(_0x250733,_0x3fa5eb,_0x3bcd57){this['createHistory'](_0x250733)[_0x1262('0xaf')](loggerCatch(_0x3fa5eb));this[_0x1262('0xc8')](_0x250733)[_0x1262('0xaf')](loggerCatch(_0x3bcd57));};Dialer[_0x1262('0x1b')][_0x1262('0x35')]=function(_0x5383d5){var _0x58f888=this[_0x1262('0xd8')][_0x5383d5[_0x1262('0xd9')]];var _0x544169;if(!_['isNil'](_0x5383d5)&&!_['isNil'](_0x5383d5[_0x1262('0xda')])&&!_[_0x1262('0xab')](_0x5383d5[_0x1262('0xda')]['amdstatus'])&&_0x5383d5[_0x1262('0xdb')]===_0x1262('0xdc')&&_0x58f888){if(_0x58f888[_0x1262('0x49')]!=='ivr'&&this[_0x1262('0x20')][_0x58f888[_0x1262('0xb2')]]['dialAMDActive']&&_0x5383d5[_0x1262('0xdd')]==='HANGUP'){delete this['uniqueId'][_0x5383d5[_0x1262('0xd9')]];this[_0x1262('0xb1')](this['voiceQueues'][_0x58f888['queue']]);this[_0x1262('0x20')][_0x58f888[_0x1262('0xb2')]][_0x1262('0x5b')]+=0x1;this[_0x1262('0x20')][_0x58f888[_0x1262('0xb2')]][_0x1262('0x5a')]+=0x1;_0x544169=new Hangup(_0x58f888,_0x5383d5);_0x544169[_0x1262('0xde')]=0x12;_0x544169[_0x1262('0xa5')]=_0x1262('0xdf');_0x544169['membername']='AMD';ami[_0x1262('0xe0')]('custom:amd',ut[_0x1262('0xe1')](_0x544169,_0x1262('0xe2')));this[_0x1262('0xd7')](_0x544169,_0x1262('0xe3'),_0x1262('0xe4'));}if(_0x58f888[_0x1262('0x49')]!==_0x1262('0x75')&&this['voiceQueues'][_0x58f888['queue']]['dialAMDActive']&&_0x5383d5[_0x1262('0xdd')]===_0x1262('0xe5')){var _0x1e067a=this;return new BPromise(function(_0x2e026b,_0x504c8f){delete _0x1e067a[_0x1262('0xd8')][_0x5383d5[_0x1262('0xd9')]];_0x1e067a[_0x1262('0xb1')](_0x1e067a[_0x1262('0x20')][_0x58f888[_0x1262('0xb2')]]);_0x1e067a[_0x1262('0x20')][_0x58f888[_0x1262('0xb2')]][_0x1262('0x5b')]+=0x1;_0x1e067a[_0x1262('0x20')][_0x58f888['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0xc64cea=_0x1e067a[_0x1262('0x20')][_0x58f888[_0x1262('0xb2')]];var _0x495700=new Hangup(_0x58f888,_0x5383d5);_0x495700[_0x1262('0xde')]=0x13;_0x495700[_0x1262('0xa5')]=_0x1262('0xe6');_0x495700[_0x1262('0xe7')]=_0x1262('0xe8');_0x495700[_0x1262('0xe9')]+=0x1;_0x495700[_0x1262('0xea')]+=0x1;_0x495700[_0x1262('0xe2')]=!![];ami[_0x1262('0xe0')](_0x1262('0xeb'),ut[_0x1262('0xe1')](_0x495700,'amd'));_0x1e067a['createHistory'](_0x495700)['catch'](loggerCatch(_0x1262('0xec')));if(_0x495700['countbusyretry']+_0x495700[_0x1262('0xed')]+_0x495700['countnoanswerretry']+_0x495700[_0x1262('0xee')]+_0x495700['countdropretry']+_0x495700['countabandonedretry']+_0x495700['countmachineretry']+_0x495700[_0x1262('0xef')]>=_0xc64cea['dialGlobalMaxRetry']){_0x1e067a[_0x1262('0xf0')](_0x495700,_0x2e026b,_0x504c8f,_0x1262('0xf1'));}else{if(_0x495700[_0x1262('0xe9')]>=_0xc64cea[_0x1262('0xf2')]){_0x1e067a[_0x1262('0xf3')](_0x495700,_0x2e026b,_0x504c8f,_0x1262('0xf4'));}else{_0x1e067a[_0x1262('0xbf')]({'active':![],'countmachineretry':_0x495700['countmachineretry'],'scheduledat':moment()['add'](_0xc64cea[_0x1262('0xf5')],_0x1262('0xf6'))[_0x1262('0x72')](_0x1262('0xf7')),'ContactId':_0x495700['ContactId'],'ListId':_0x495700[_0x1262('0xf8')],'VoiceQueueId':_0x495700[_0x1262('0xd1')]||undefined,'CampaignId':_0x495700[_0x1262('0xd2')]||undefined})[_0x1262('0xaf')](loggerCatch(_0x1262('0xf9')));_0x2e026b({'reschedule':0x1});}}});}if(_0x58f888['type']===_0x1262('0x75')&&this[_0x1262('0x21')][_0x58f888[_0x1262('0xb2')]][_0x1262('0xfa')]&&_0x5383d5[_0x1262('0xdd')]===_0x1262('0xfb')){delete this['uniqueId'][_0x5383d5[_0x1262('0xd9')]];this[_0x1262('0xb1')](this[_0x1262('0x21')][_0x58f888[_0x1262('0xb2')]]);_0x544169=new Hangup(_0x58f888,_0x5383d5);_0x544169[_0x1262('0xde')]=0x12;_0x544169['statedesc']=_0x1262('0xdf');_0x544169[_0x1262('0xe7')]='AMD';ami[_0x1262('0xe0')](_0x1262('0xeb'),ut[_0x1262('0xe1')](_0x544169,_0x1262('0xe2')));this[_0x1262('0xd7')](_0x544169,'[syncHangupInAMDIvr][createHistory]',_0x1262('0xfc'));}if(_0x58f888[_0x1262('0x49')]==='ivr'&&this[_0x1262('0x21')][_0x58f888[_0x1262('0xb2')]][_0x1262('0xfa')]&&_0x5383d5[_0x1262('0xdd')]===_0x1262('0xe5')){var _0x1e067a=this;return new BPromise(function(_0x46e7a1,_0x2918d6){delete _0x1e067a[_0x1262('0xd8')][_0x5383d5['uniqueid']];_0x1e067a[_0x1262('0xb1')](_0x1e067a[_0x1262('0x21')][_0x58f888['queue']]);_0x1e067a[_0x1262('0x21')][_0x58f888[_0x1262('0xb2')]]['outboundAnswerCallsDay']+=0x1;_0x1e067a[_0x1262('0x21')][_0x58f888[_0x1262('0xb2')]][_0x1262('0x5a')]+=0x1;var _0x1a2420=_0x1e067a['campaigns'][_0x58f888[_0x1262('0xb2')]];var _0x1be668=new Hangup(_0x58f888,_0x5383d5);_0x1be668[_0x1262('0xde')]=0x13;_0x1be668['statedesc']=_0x1262('0xe6');_0x1be668[_0x1262('0xe7')]=_0x1262('0xe8');_0x1be668[_0x1262('0xe9')]+=0x1;_0x1be668[_0x1262('0xea')]+=0x1;_0x1be668[_0x1262('0xe2')]=!![];ami[_0x1262('0xe0')](_0x1262('0xeb'),ut['buildObj'](_0x1be668,_0x1262('0xe2')));_0x1e067a[_0x1262('0xca')](_0x1be668)[_0x1262('0xaf')](loggerCatch(_0x1262('0xec')));if(_0x1be668[_0x1262('0xfd')]+_0x1be668[_0x1262('0xed')]+_0x1be668[_0x1262('0xfe')]+_0x1be668[_0x1262('0xee')]+_0x1be668[_0x1262('0xff')]+_0x1be668[_0x1262('0x100')]+_0x1be668[_0x1262('0xe9')]+_0x1be668[_0x1262('0xef')]>=_0x1a2420[_0x1262('0x101')]){_0x1e067a[_0x1262('0xf0')](_0x1be668,_0x46e7a1,_0x2918d6,_0x1262('0xf1'));}else{if(_0x1be668[_0x1262('0xe9')]>=_0x1a2420['dialMachineMaxRetry']){_0x1e067a[_0x1262('0xf3')](_0x1be668,_0x46e7a1,_0x2918d6,_0x1262('0xf4'));}else{_0x1e067a[_0x1262('0xbf')]({'active':![],'countmachineretry':_0x1be668[_0x1262('0xe9')],'scheduledat':moment()[_0x1262('0x102')](_0x1a2420[_0x1262('0xf5')],_0x1262('0xf6'))[_0x1262('0x72')](_0x1262('0xf7')),'ContactId':_0x1be668['ContactId'],'ListId':_0x1be668[_0x1262('0xf8')],'VoiceQueueId':_0x1be668[_0x1262('0xd1')]||undefined,'CampaignId':_0x1be668[_0x1262('0xd2')]||undefined})[_0x1262('0xaf')](loggerCatch(_0x1262('0xf9')));_0x46e7a1({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x1262('0x30')]=function(_0x94a9a0){var _0x6de847=this[_0x1262('0xd8')][_0x94a9a0[_0x1262('0xd9')]];var _0x5bb4f7=this;var _0x30ebb9;if(_0x6de847&&_0x6de847[_0x1262('0x49')]===_0x1262('0x75')){delete this[_0x1262('0xd8')][_0x94a9a0['uniqueid']];this[_0x1262('0xb1')](this[_0x1262('0x21')][_0x6de847['queue']]);this[_0x1262('0x21')][_0x6de847['queue']][_0x1262('0x103')]+=0x1;_0x30ebb9=new Hangup(_0x6de847,_0x94a9a0);this[_0x1262('0xca')](_0x30ebb9)[_0x1262('0xaf')](loggerCatch(_0x1262('0x104')));this['moveContactManagedDialer'](_0x30ebb9)['catch'](loggerCatch(_0x1262('0x105')));}if(_0x6de847&&_0x6de847['type']!==_0x1262('0x75')&&isNotNull(this[_0x1262('0x20')][_0x6de847[_0x1262('0xb2')]][_0x1262('0x106')])){delete this['uniqueId'][_0x94a9a0['uniqueid']];this[_0x1262('0xb1')](this['voiceQueues'][_0x6de847[_0x1262('0xb2')]]);this[_0x1262('0x20')][_0x6de847[_0x1262('0xb2')]][_0x1262('0x5b')]+=0x1;this[_0x1262('0x20')][_0x6de847[_0x1262('0xb2')]]['outboundAnswerAgiCallsDay']+=0x1;_0x30ebb9=new Hangup(_0x6de847,_0x94a9a0);_0x30ebb9[_0x1262('0xde')]=0x10;_0x30ebb9[_0x1262('0xa5')]=_0x1262('0x107');_0x30ebb9[_0x1262('0xe7')]=_0x1262('0x108');this[_0x1262('0xca')](_0x30ebb9)[_0x1262('0xaf')](loggerCatch(_0x1262('0x104')));this[_0x1262('0xc8')](_0x30ebb9)[_0x1262('0xaf')](loggerCatch('[syncHangupIvr]'));}if(_0x6de847&&_0x6de847[_0x1262('0x49')]!==_0x1262('0x75')&&!isNotNull(this[_0x1262('0x20')][_0x6de847[_0x1262('0xb2')]][_0x1262('0x106')])){delete this[_0x1262('0xd8')][_0x94a9a0[_0x1262('0xd9')]];this[_0x1262('0xb1')](this['voiceQueues'][_0x6de847[_0x1262('0xb2')]]);this[_0x1262('0x20')][_0x6de847['queue']][_0x1262('0x109')]+=0x1;_0x30ebb9=new Hangup(_0x6de847,_0x94a9a0);_0x30ebb9[_0x1262('0xde')]=0xc;_0x30ebb9[_0x1262('0xa5')]=_0x94a9a0[_0x1262('0x10a')];_0x30ebb9[_0x1262('0xe7')]=_0x1262('0x10b');this['createHistory'](_0x30ebb9)[_0x1262('0xaf')](loggerCatch(_0x1262('0x104')));this[_0x1262('0xc8')](_0x30ebb9)['catch'](loggerCatch(_0x1262('0x105')));}};Dialer['prototype'][_0x1262('0x2d')]=function(_0x5e3602){var _0xe71fb0=this[_0x1262('0xd8')][_0x5e3602['uniqueid']];var _0x586122=this;if(this[_0x1262('0x20')][_0x5e3602[_0x1262('0xb2')]]){if(_0xe71fb0&&_0xe71fb0[_0x1262('0x49')]!==_0x1262('0x75')){delete this['uniqueId'][_0x5e3602[_0x1262('0xd9')]];this[_0x1262('0x20')][_0x5e3602['queue']][_0x1262('0x5b')]+=0x1;var _0x5365c9=new AgentComplete(_0xe71fb0,_0x5e3602);if(_0x5e3602['reason']===_0x1262('0x10c')){_0x5365c9[_0x1262('0x10d')]=this[_0x1262('0x20')][_0x5e3602[_0x1262('0xb2')]][_0x1262('0x10e')]&&this['voiceQueues'][_0x5e3602[_0x1262('0xb2')]][_0x1262('0x10f')]?moment()[_0x1262('0x72')](_0x1262('0xf7')):undefined;}this[_0x1262('0xca')](_0x5365c9)[_0x1262('0xaf')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x1262('0xc8')](_0x5365c9)[_0x1262('0xaf')](loggerCatch(_0x1262('0x110')));}}};Dialer[_0x1262('0x1b')][_0x1262('0x111')]=function(_0x4787d2){if(this[_0x1262('0x20')][_0x4787d2[_0x1262('0xb2')]]){if(this[_0x1262('0xd8')][_0x4787d2[_0x1262('0xd9')]]&&this['uniqueId'][_0x4787d2[_0x1262('0xd9')]]['type']!=='ivr'){this[_0x1262('0xb1')](this['voiceQueues'][_0x4787d2['queue']]);this[_0x1262('0xd8')][_0x4787d2['uniqueid']][_0x1262('0x112')]=moment()[_0x1262('0x72')](_0x1262('0xf7'));}}};Dialer[_0x1262('0x1b')]['queueCallerAbandonCreateState']=function(_0x77ba97){this[_0x1262('0xca')](_0x77ba97)[_0x1262('0xaf')](loggerCatch(_0x1262('0x113')));this[_0x1262('0xc8')](_0x77ba97)['catch'](loggerCatch(_0x1262('0x114')));};Dialer[_0x1262('0x1b')][_0x1262('0x115')]=function(_0xccd835){var _0x14443c=this[_0x1262('0xd8')][_0xccd835['uniqueid']];var _0x42c61c=this;if(this[_0x1262('0x20')][_0xccd835[_0x1262('0xb2')]]){if(_0x14443c&&_0x14443c[_0x1262('0x49')]!==_0x1262('0x75')){delete this['uniqueId'][_0xccd835['uniqueid']];this[_0x1262('0xb1')](this[_0x1262('0x20')][_0xccd835[_0x1262('0xb2')]]);_0x14443c[_0x1262('0x116')]=moment()[_0x1262('0x72')](_0x1262('0xf7'));var _0x598b22=new QueueCallerAbandon(_0x14443c,_0xccd835);if(getSeconds(_0x14443c['droptime'],_0x14443c[_0x1262('0x117')])>=_0x14443c[_0x1262('0x118')]){this[_0x1262('0x20')][_0xccd835[_0x1262('0xb2')]][_0x1262('0x63')]+=0x1;this[_0x1262('0x20')][_0xccd835[_0x1262('0xb2')]][_0x1262('0x119')]+=0x1;this[_0x1262('0x20')][_0xccd835[_0x1262('0xb2')]][_0x1262('0x65')]+=0x1;_0x598b22[_0x1262('0xde')]=0xa;_0x598b22['statedesc']=_0x1262('0x11a');_0x598b22['dropreason']=_0x1262('0x11b');_0x598b22[_0x1262('0x10d')]=this['voiceQueues'][_0xccd835[_0x1262('0xb2')]][_0x1262('0x10e')]?moment()['format'](_0x1262('0xf7')):undefined;_0x598b22['countdropretry']+=0x1;_0x598b22[_0x1262('0xea')]+=0x1;if(_0x598b22['countdropretry']>=this[_0x1262('0x20')][_0xccd835[_0x1262('0xb2')]][_0x1262('0x11c')]){this[_0x1262('0x11d')](_0x598b22);}else{this[_0x1262('0xbf')]({'active':![],'countdropretry':_0x598b22[_0x1262('0xff')],'scheduledat':moment()['add'](this['voiceQueues'][_0xccd835[_0x1262('0xb2')]][_0x1262('0x11e')],_0x1262('0xf6'))[_0x1262('0x72')](_0x1262('0xf7')),'ContactId':_0x14443c[_0x1262('0xd0')],'ListId':_0x14443c[_0x1262('0xf8')],'VoiceQueueId':_0x14443c[_0x1262('0xd1')]||undefined,'CampaignId':_0x14443c[_0x1262('0xd2')]||undefined})[_0x1262('0xaf')](loggerCatch('[rescheduleContact][Drop]'));var _0x5a852b=new History(_0x598b22);_0x5a852b[_0x1262('0xde')]=0xa;_0x5a852b[_0x1262('0xa5')]='Drop';_0x5a852b[_0x1262('0xa6')]=moment()[_0x1262('0x72')]('YYYY-MM-DD\x20HH:mm:ss');_0x5a852b[_0x1262('0x11f')]=_0x5a852b[_0x1262('0xa6')];_0x5a852b[_0x1262('0x120')]=_0x598b22['calleridname'];_0x5a852b[_0x1262('0x121')]=_0x598b22[_0x1262('0x121')];this['createHistory'](_0x5a852b)[_0x1262('0xaf')](loggerCatch(_0x1262('0x122')));}}else{this[_0x1262('0x20')][_0xccd835[_0x1262('0xb2')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x1262('0x20')][_0xccd835[_0x1262('0xb2')]][_0x1262('0x123')]+=0x1;_0x598b22['state']=0xb;_0x598b22[_0x1262('0xa5')]=_0x1262('0x124');_0x598b22[_0x1262('0x125')]=_0x1262('0x126');_0x598b22[_0x1262('0x100')]+=0x1;_0x598b22[_0x1262('0xea')]+=0x1;if(_0x598b22[_0x1262('0x100')]>=this['voiceQueues'][_0xccd835['queue']][_0x1262('0x127')]){this[_0x1262('0x11d')](_0x598b22);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x598b22[_0x1262('0x100')],'scheduledat':moment()['add'](this[_0x1262('0x20')][_0xccd835['queue']][_0x1262('0x128')],_0x1262('0xf6'))[_0x1262('0x72')](_0x1262('0xf7')),'ContactId':_0x14443c[_0x1262('0xd0')],'ListId':_0x14443c[_0x1262('0xf8')],'VoiceQueueId':_0x14443c[_0x1262('0xd1')]||undefined,'CampaignId':_0x14443c['CampaignId']||undefined})['catch'](loggerCatch(_0x1262('0x129')));var _0x5a852b=new History(_0x598b22);_0x5a852b[_0x1262('0xde')]=0xb;_0x5a852b[_0x1262('0xa5')]='Abandoned';_0x5a852b[_0x1262('0xa6')]=moment()[_0x1262('0x72')](_0x1262('0xf7'));_0x5a852b[_0x1262('0x11f')]=_0x5a852b[_0x1262('0xa6')];_0x5a852b['calleridname']=_0x598b22[_0x1262('0x120')];_0x5a852b[_0x1262('0x121')]=_0x598b22[_0x1262('0x121')];this[_0x1262('0xca')](_0x5a852b)['catch'](loggerCatch(_0x1262('0x12a')));}}}}};Dialer[_0x1262('0x1b')][_0x1262('0x33')]=function(_0x416886){if(this['actions'][_0x416886['uniqueid']]){this[_0x1262('0x24')][_0x416886['uniqueid']][_0x1262('0xae')]=_0x416886['channel'];}if(this[_0x1262('0xd8')][_0x416886[_0x1262('0xd9')]]){this[_0x1262('0xd8')][_0x416886['uniqueid']][_0x1262('0xae')]=_0x416886[_0x1262('0xae')];}};Dialer[_0x1262('0x1b')][_0x1262('0x37')]=function(_0x2580a6){if(strategy[this[_0x1262('0x20')][this[_0x1262('0x24')][_0x2580a6[_0x1262('0x12b')]][_0x1262('0xb2')]][_0x1262('0x12c')]]==='roundrobin'){if(this[_0x1262('0x24')][_0x2580a6[_0x1262('0x12b')]]&&_[_0x1262('0xab')](this[_0x1262('0x24')][_0x2580a6[_0x1262('0x12b')]]['locked'])&&_0x2580a6[_0x1262('0xad')]==='1'&&_0x2580a6[_0x1262('0x12d')]==='0'){if(this[_0x1262('0x12e')][_0x2580a6[_0x1262('0x12f')]]){if(!this[_0x1262('0x12e')][_0x2580a6['stateinterface']]['locked']){this['agents'][_0x2580a6[_0x1262('0x12f')]][_0x1262('0x130')]=!![];this[_0x1262('0x24')][_0x2580a6[_0x1262('0x12b')]][_0x1262('0x130')]=!![];this[_0x1262('0x24')][_0x2580a6[_0x1262('0x12b')]]['stateinterface']=_0x2580a6['stateinterface'];}}}}else if((strategy[this[_0x1262('0x20')][this[_0x1262('0x24')][_0x2580a6[_0x1262('0x12b')]][_0x1262('0xb2')]][_0x1262('0x12c')]]||_0x1262('0x131'))===_0x1262('0x131')){if(this[_0x1262('0x24')][_0x2580a6[_0x1262('0x12b')]]){if(this[_0x1262('0x12e')][_0x2580a6[_0x1262('0x12f')]]){this[_0x1262('0x24')][_0x2580a6['actionid']][_0x1262('0x12f')]=_0x2580a6['stateinterface'];if(_[_0x1262('0xab')](this[_0x1262('0x132')][this[_0x1262('0x24')][_0x2580a6['actionid']][_0x1262('0xb2')]])){this['queueBooked'][this[_0x1262('0x24')][_0x2580a6[_0x1262('0x12b')]]['queue']]=[];}this[_0x1262('0x132')][this['actions'][_0x2580a6[_0x1262('0x12b')]][_0x1262('0xb2')]]['push'](_['merge'](_[_0x1262('0x133')](this[_0x1262('0x24')][_0x2580a6[_0x1262('0x12b')]],[_0x1262('0x134'),_0x1262('0x12f')]),{'status':_0x2580a6[_0x1262('0xad')],'paused':_0x2580a6[_0x1262('0x12d')]}));}}}};function unlockQueueStatus(_0x447efc,_0x4b7241){setTimeout(function(){if(_[_0x1262('0x83')](_0x447efc['queueStatusComplete'])){loggerBooked[_0x1262('0x95')](_0x1262('0x135'),_0x4b7241);}_0x447efc[_0x1262('0x136')]=!![];loggerBooked[_0x1262('0x7c')](_0x1262('0x137'),_0x4b7241,JSON[_0x1262('0x46')](_[_0x1262('0x133')](_0x447efc,[_0x1262('0x3d'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x1262('0x1b')]['syncQueueStatusComplete']=function(_0x1e4ae5){var _0x9aea96=this;var _0x18502e=_0x9aea96[_0x1262('0x20')][_0x9aea96[_0x1262('0x24')][_0x1e4ae5['actionid']]['queue']];if(strategy[this['voiceQueues'][this['actions'][_0x1e4ae5[_0x1262('0x12b')]][_0x1262('0xb2')]][_0x1262('0x12c')]]===_0x1262('0x1a')){if(this[_0x1262('0x24')][_0x1e4ae5[_0x1262('0x12b')]]&&this[_0x1262('0x24')][_0x1e4ae5[_0x1262('0x12b')]][_0x1262('0x12f')]){this['preview'][_0x1262('0x138')](this[_0x1262('0x24')][_0x1e4ae5[_0x1262('0x12b')]]['idHopper'],this[_0x1262('0x24')][_0x1e4ae5[_0x1262('0x12b')]][_0x1262('0x12f')])[_0x1262('0xaf')](function(_0x569597){logger[_0x1262('0x95')](_0x1262('0x139'),util[_0x1262('0x96')](_0x569597,{'showHidden':![],'depth':null}));})[_0x1262('0x1d')](function(){_0x9aea96[_0x1262('0xb1')](_0x9aea96[_0x1262('0x20')][_0x9aea96[_0x1262('0x24')][_0x1e4ae5['actionid']][_0x1262('0xb2')]]);_0x9aea96['agents'][_0x9aea96[_0x1262('0x24')][_0x1e4ae5[_0x1262('0x12b')]][_0x1262('0x12f')]][_0x1262('0x130')]=![];delete _0x9aea96[_0x1262('0x24')][_0x1e4ae5['actionid']];unlockQueueStatus(_0x18502e);});}else{this[_0x1262('0xb1')](this['voiceQueues'][this['actions'][_0x1e4ae5[_0x1262('0x12b')]][_0x1262('0xb2')]]);this[_0x1262('0xbf')]({'active':![],'ContactId':this['actions'][_0x1e4ae5['actionid']][_0x1262('0xd0')],'ListId':this['actions'][_0x1e4ae5[_0x1262('0x12b')]]['ListId'],'VoiceQueueId':this['actions'][_0x1e4ae5['actionid']][_0x1262('0xd1')]||undefined,'CampaignId':this[_0x1262('0x24')][_0x1e4ae5['actionid']][_0x1262('0xd2')]||undefined})['catch'](loggerCatch(_0x1262('0x13a')));delete this[_0x1262('0x24')][_0x1e4ae5[_0x1262('0x12b')]];unlockQueueStatus(_0x18502e);}}else if((strategy[this[_0x1262('0x20')][this[_0x1262('0x24')][_0x1e4ae5[_0x1262('0x12b')]][_0x1262('0xb2')]][_0x1262('0x12c')]]||_0x1262('0x131'))==='rrmemory'){var _0xb9057a;if(this[_0x1262('0x24')][_0x1e4ae5['actionid']]&&!_[_0x1262('0x92')](this[_0x1262('0x132')][this['actions'][_0x1e4ae5[_0x1262('0x12b')]]['queue']])){if(this['queueBookedRR'][_0x9aea96[_0x1262('0x24')][_0x1e4ae5[_0x1262('0x12b')]][_0x1262('0xb2')]]){this[_0x1262('0x29')][_0x9aea96['actions'][_0x1e4ae5['actionid']][_0x1262('0xb2')]]=this[_0x1262('0x29')][this[_0x1262('0x24')][_0x1e4ae5[_0x1262('0x12b')]][_0x1262('0xb2')]]?this[_0x1262('0x29')][this[_0x1262('0x24')][_0x1e4ae5[_0x1262('0x12b')]][_0x1262('0xb2')]]:this[_0x1262('0x132')][this[_0x1262('0x24')][_0x1e4ae5['actionid']][_0x1262('0xb2')]]?this['queueBooked'][this[_0x1262('0x24')][_0x1e4ae5['actionid']][_0x1262('0xb2')]][_0x1262('0x13b')]||0x0:0x0;}this[_0x1262('0x132')][this[_0x1262('0x24')][_0x1e4ae5[_0x1262('0x12b')]][_0x1262('0xb2')]][_0x1262('0x13b')]=this[_0x1262('0x29')][this['actions'][_0x1e4ae5['actionid']][_0x1262('0xb2')]];for(var _0x4a8edc=0x0;_0x4a8edc=0x0;})[_0x1262('0xaf')](myreject(_0xefcfbb)));}}else{_0xcfe24a[_0x1262('0x158')](ami[_0x1262('0xac')]({'action':_0x1262('0x152'),'command':util[_0x1262('0x72')](_0x1262('0x153'),_0x3edabc,!_['isUndefined'](config[_0x1262('0x14e')][_0x11a3b8])?_0x11a3b8:'')})[_0x1262('0xb7')](function(_0x3ef6fd){return _0x3ef6fd['content']['indexOf'](_0x1262('0x157'))>=0x0;})[_0x1262('0xaf')](myreject(_0xefcfbb)));}BPromise['all'](_0xcfe24a)[_0x1262('0xb7')](function(_0xbf41d9){var _0x3ee2bd=_[_0x1262('0x159')](_0xbf41d9);if(_0x3ee2bd){return _0xac1cf6(_0x3ee2bd);}else{_0x47f203[_0x1262('0x3b')]=_0x20b185?_0x1262('0x15a'):'INTERVAL_IS_OVERTIME';return _0xefcfbb(msgResponse(_0x1262('0x15b'),_0x1262('0x14c'),_0x1262('0x15c')+_0x20b185+'\x20'+_0x40e9f8+_0x1262('0x15d')+util['inspect'](_0x3edabc,{'showHidden':![],'depth':null})+_0x1262('0x15e')+_0x11a3b8));}})[_0x1262('0xaf')](function(_0x8df32){return _0xefcfbb(msgResponse(_0x1262('0x14b'),_0x1262('0x14c'),JSON[_0x1262('0x46')](_0x8df32)));});});};Dialer[_0x1262('0x1b')][_0x1262('0x15f')]=function(_0x5895cd){var _0x4d1e52=this;return function(){switch(_0x5895cd[_0x1262('0x55')]){case'progressive':freeVariablesPredictive(_0x5895cd);_0x4d1e52[_0x1262('0x160')](_0x5895cd,0x1);break;case _0x1262('0x161'):freeVariablesPredictive(_0x5895cd);_0x4d1e52[_0x1262('0x160')](_0x5895cd,_0x5895cd[_0x1262('0x162')]);break;case _0x1262('0x163'):_0x4d1e52['predictive'](_0x5895cd);break;case'booked':freeVariablesPredictive(_0x5895cd);_0x4d1e52['handlePower'](_0x5895cd,0x1);break;default:freeVariablesPredictive(_0x5895cd);logger['error'](_0x1262('0x164'),_0x5895cd[_0x1262('0x3d')],_0x1262('0x165'));}};};Dialer[_0x1262('0x1b')]['launchHandleIvr']=function(_0x159b8c){var _0x250d56=this;return function(){_0x250d56[_0x1262('0x166')](_0x159b8c);};};Dialer[_0x1262('0x1b')][_0x1262('0x2e')]=function(_0x56ef70){var _0x557c98=this;if(isNotPreview(_0x56ef70[_0x1262('0x55')])){if(isVoiceQueueOutbound(_0x56ef70['type'])&&isActive(_0x56ef70[_0x1262('0x54')])){_0x56ef70[_0x1262('0xa0')]=!![];BPromise[_0x1262('0xb6')]()[_0x1262('0xb7')](checkIsLoggedIn(_0x56ef70,_0x56ef70[_0x1262('0x167')]))['then'](checkIsActive(_0x56ef70,_0x56ef70['dialActive']))[_0x1262('0xb7')](checkInterval(_0x56ef70))[_0x1262('0xb7')](_0x557c98[_0x1262('0x168')](_0x56ef70))[_0x1262('0xb7')](_0x557c98[_0x1262('0x169')](_0x56ef70[_0x1262('0x16a')],_0x56ef70[_0x1262('0x16b')],_0x56ef70[_0x1262('0x3d')],_0x56ef70))['then'](_0x557c98[_0x1262('0x14a')](_0x56ef70[_0x1262('0x71')],_0x56ef70[_0x1262('0x16b')],_0x56ef70[_0x1262('0x3d')],_0x56ef70))[_0x1262('0xb7')](_0x557c98['checkDialMethod'](_0x56ef70))[_0x1262('0xaf')](loggerCatchQueueSummary('[syncQueueSummary]',_0x56ef70));}else{notSendMessagesQueue(_0x56ef70);}}else{freeVariablesPredictive(_0x56ef70);}};Dialer['prototype'][_0x1262('0x145')]=function(){var _0x533b43=this;var _0xe1778c;for(var _0x5d6c0d in this['campaigns']){if(typeof this[_0x1262('0x21')][_0x5d6c0d]!==_0x1262('0x98')){_0xe1778c=this[_0x1262('0x21')][_0x5d6c0d];if(isCampaignIvr(_0xe1778c[_0x1262('0x49')])&&isActive(_0xe1778c[_0x1262('0x70')])){_0xe1778c['sendMessageOneNotActive']=!![];BPromise[_0x1262('0xb6')]()[_0x1262('0xb7')](checkIsActive(_0xe1778c,_0xe1778c[_0x1262('0x70')]))['then'](checkInterval(_0xe1778c))['then'](_0x533b43['checkIsTrunkReachable'](_0xe1778c))[_0x1262('0xb7')](_0x533b43[_0x1262('0x169')](_0xe1778c['dialGlobalInterval'],_0xe1778c[_0x1262('0x16b')],_0xe1778c['name'],_0xe1778c))[_0x1262('0xb7')](_0x533b43['checkIfTimeIntervals'](_0xe1778c[_0x1262('0x71')],_0xe1778c[_0x1262('0x16b')],_0xe1778c[_0x1262('0x3d')],_0xe1778c))[_0x1262('0xb7')](_0x533b43[_0x1262('0x16c')](_0xe1778c))[_0x1262('0xaf')](loggerCatchQueueSummary(_0x1262('0x16d'),_0xe1778c));}else{notSendMessagesCampaign(_0xe1778c);}}}};function getCallerIdRandom(_0x222892,_0x1d2527){var _0xa8e5fd;var _0x124d38;var _0x5b1591;if(_0x1d2527<=0x0){_0x1d2527=0x1;}_0xa8e5fd=new RegExp('\x5cw{0,'+_0x1d2527+'}$');_0x124d38=Math[_0x1262('0x16e')](0xa,_0x1d2527-0x1);_0x5b1591=Math[_0x1262('0x16e')](0xa,_0x1d2527)-0x1;return util[_0x1262('0x72')]('%s',_[_0x1262('0x16f')](_0x222892,_0xa8e5fd,_['random'](_0x124d38,_0x5b1591)));}function extractCalleridName(_0x16dc22){var _0x16bd77=_0x16dc22[_0x1262('0x170')](/"(.*?)"/);return _0x16bd77?_0x16bd77[0x1]:_0x16dc22;}function extractCalleridNumber(_0x4169fe){var _0x2334cd=_0x4169fe[_0x1262('0x170')](/<(.*?)>/);return _0x2334cd?_0x2334cd[0x1]:_0x4169fe;}Dialer[_0x1262('0x1b')][_0x1262('0x171')]=function(_0x235e10,_0x1058c9){var _0x4af476=this;var _0x47cde3=uuid['v4']();this['actions'][_0x47cde3]=new Action(_0x235e10,_0x1058c9,_0x47cde3);return new BPromise(function(_0x376362,_0x3128c6){if(_['isUndefined'](_0x235e10)&&typeof _0x235e10!==_0x1262('0x172')){return _0x3128c6(msgResponse('originate',_0x1262('0x14c'),_0x1262('0x173')));}if(_[_0x1262('0x83')](_0x1058c9[_0x1262('0x174')][_0x1262('0x175')])||_0x1058c9[_0x1262('0x174')]['phone']===null){return _0x3128c6(msgResponse(_0x1262('0x176'),_0x1262('0x14c'),'contact\x20is\x20undefine'));}var _0x459972={'XMD-CALLERID':_0x4af476[_0x1262('0x24')][_0x47cde3][_0x1262('0x177')](),'XMD-AGI':_0x235e10['dialQueueProject']?util[_0x1262('0x72')](_0x1262('0x178'),ipAgi,_0x235e10[_0x1262('0x106')]):_0x1262('0x179'),'XMD-AGIAFTER':_0x235e10[_0x1262('0x10e')]?util[_0x1262('0x72')](_0x1262('0x178'),ipAgi,_0x235e10[_0x1262('0x10e')]):_0x1262('0x179'),'XMD-QUEUE':_0x235e10[_0x1262('0x49')]===_0x1262('0x4a')?util[_0x1262('0x72')](_0x1262('0x17a'),_0x235e10[_0x1262('0x3d')],_0x235e10[_0x1262('0x17b')]||'',_0x235e10['dialAgiAfterHangupAgent']?'c':'',_0x235e10['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x1058c9[_0x1262('0xd0')],'XMD-CDRTYPE':_0x1262('0xa'),'CALLERID(all)':_0x4af476[_0x1262('0x24')][_0x47cde3][_0x1262('0x177')](),'XMD-AMD':_0x235e10[_0x1262('0xfa')]?_0x1262('0x17c'):'NONE','XMD-DESTINATION':'xcally-motion-dialer'};if(_0x235e10[_0x1262('0xfa')]){_0x459972['XMD-AMDINITIALSILENCE']=_0x235e10[_0x1262('0x17d')]||0x9c4;_0x459972[_0x1262('0x17e')]=_0x235e10[_0x1262('0x17f')]||0x5dc;_0x459972[_0x1262('0x180')]=_0x235e10[_0x1262('0x181')]||0x320;_0x459972[_0x1262('0x182')]=_0x235e10['dialAMDTotalAnalysisTime']||0x1388;_0x459972['XMD-AMDMINWORDLENGTH']=_0x235e10[_0x1262('0x183')]||0x64;_0x459972[_0x1262('0x184')]=_0x235e10[_0x1262('0x185')]||0x32;_0x459972[_0x1262('0x186')]=_0x235e10[_0x1262('0x187')]||0x3;_0x459972['XMD-AMDSILENCETHRESHOLD']=_0x235e10[_0x1262('0x188')]||0x100;_0x459972[_0x1262('0x189')]=_0x235e10[_0x1262('0x18a')]||0x1388;}if(_0x235e10[_0x1262('0x49')]===_0x1262('0x4a')){_0x459972[_0x1262('0x18b')]=_0x1058c9[_0x1262('0xd1')];}else{_0x459972[_0x1262('0x18c')]=_0x1058c9[_0x1262('0xd2')];}for(var _0x39b95e in _0x1058c9[_0x1262('0x174')]){if(typeof _0x1058c9[_0x1262('0x174')][_0x39b95e]!=='undefined'){if(isNotNull(_0x1058c9[_0x1262('0x174')][_0x39b95e])&&_0x39b95e!=='id'&&_0x39b95e!==_0x1262('0x18d')&&_0x39b95e!==_0x1262('0x18e')&&_0x39b95e!=='updatedAt'){_0x459972[util[_0x1262('0x72')](_0x1262('0x18f'),'XMD-',_[_0x1262('0x190')](_0x39b95e))]=_0x1058c9[_0x1262('0x174')][_0x39b95e];}}}var _0x2d689c=_0x4af476['isTrunkReachable'](_0x235e10[_0x1262('0x6f')])?getCallerId(_0x235e10[_0x1262('0x6f')][_0x1262('0x191')],_0x235e10[_0x1262('0x56')],_0x235e10[_0x1262('0x192')]>0x0?getCallerIdRandom(_0x235e10['dialOriginateCallerIdNumber'],_0x235e10[_0x1262('0x192')]):_0x235e10[_0x1262('0x57')]):getCallerId(_[_0x1262('0xab')](_0x235e10[_0x1262('0x147')])?_0x235e10[_0x1262('0x6f')]['callerid']:_0x235e10[_0x1262('0x147')]['callerid'],_0x235e10['dialOriginateCallerIdName'],_0x235e10[_0x1262('0x192')]>0x0?getCallerIdRandom(_0x235e10[_0x1262('0x57')],_0x235e10[_0x1262('0x192')]):_0x235e10[_0x1262('0x57')]);if(_0x2d689c){_0x459972[_0x1262('0x193')]=_0x4af476[_0x1262('0x24')][_0x47cde3][_0x1262('0x194')]=extractCalleridName(_0x2d689c);_0x459972[_0x1262('0x195')]=_0x4af476[_0x1262('0x24')][_0x47cde3]['originatecalleridnum']=extractCalleridNumber(_0x2d689c);}return ami[_0x1262('0xac')]({'actionid':_0x47cde3,'action':_0x1262('0x176'),'channel':_0x4af476[_0x1262('0x146')](_0x235e10['Trunk'])?util[_0x1262('0x72')](_0x1262('0x196'),_0x235e10[_0x1262('0x6f')][_0x1262('0x3d')],isNotNull(_0x235e10[_0x1262('0x59')])?_0x235e10[_0x1262('0x59')]['trim']()||'':'',_0x235e10['dialCutDigit']>0x0?_0x1058c9[_0x1262('0x174')][_0x1262('0x175')][_0x1262('0x197')](_0x235e10['dialCutDigit']):_0x1058c9[_0x1262('0x174')][_0x1262('0x175')]):util[_0x1262('0x72')](_0x1262('0x196'),_[_0x1262('0xab')](_0x235e10[_0x1262('0x147')])?_0x235e10[_0x1262('0x6f')]['name']:_0x235e10[_0x1262('0x147')]['name'],isNotNull(_0x235e10[_0x1262('0x59')])?_0x235e10['dialPrefix'][_0x1262('0x198')]()||'':'',_0x235e10[_0x1262('0x199')]>0x0?_0x1058c9[_0x1262('0x174')][_0x1262('0x175')][_0x1262('0x197')](_0x235e10[_0x1262('0x199')]):_0x1058c9['Contact'][_0x1262('0x175')]),'callerid':_0x2d689c,'Exten':_0x1262('0xdc'),'Context':_0x1262('0x19a'),'Priority':'1','variable':_0x459972,'timeout':(_0x235e10['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x47cde3})[_0x1262('0xb7')](function(_0x35e6cd){return _0x376362(_0x35e6cd);})[_0x1262('0xaf')](function(_0x97ce5a){_0x235e10[_0x1262('0x5e')]+=0x1;var _0xaeeb2=new History(_0x4af476[_0x1262('0x24')][_0x47cde3]);logger[_0x1262('0x95')](util['format'](_0x1262('0x19b'),JSON['stringify'](_0x97ce5a)));_0xaeeb2['state']=0xe;_0xaeeb2[_0x1262('0xa5')]=_0x1262('0x19c');_0xaeeb2[_0x1262('0xa6')]=moment()[_0x1262('0x72')](_0x1262('0xf7'));_0xaeeb2[_0x1262('0x11f')]=_0xaeeb2[_0x1262('0xa6')];_0x4af476[_0x1262('0xca')](_0xaeeb2)[_0x1262('0xaf')](loggerCatch(_0x1262('0x19d')));_0x4af476[_0x1262('0xc8')](_0xaeeb2)[_0x1262('0xaf')](loggerCatch(_0x1262('0x19d')))[_0x1262('0x1d')](function(){delete _0x4af476['actions'][_0x47cde3];return _0x3128c6(msgResponse('originate',_0x1262('0x45'),_0x1262('0x19e')));});});});};Dialer[_0x1262('0x1b')]['syncOriginateResponse']=function(_0xbeed0e){var _0xb868ad=this[_0x1262('0x24')][_0xbeed0e['actionid']];if(_0xb868ad){delete this[_0x1262('0x24')][_0xbeed0e[_0x1262('0x12b')]];_0xb868ad['responsetime']=moment()[_0x1262('0x72')](_0x1262('0xf7'));var _0xbbc53d=_0xb868ad[_0x1262('0x49')]===_0x1262('0x75')?this[_0x1262('0x21')][_0xb868ad[_0x1262('0xb2')]]:this['voiceQueues'][_0xb868ad[_0x1262('0x19f')]()];if(!this['isSuccess'](_0xbeed0e[_0x1262('0x1a0')])){this[_0x1262('0xb1')](_0xbbc53d);return this[_0x1262('0x1a1')](_0xb868ad,_0xbbc53d,_0xbeed0e)[_0x1262('0xaf')](loggerCatch('[callProgressDetecting]\x20'));}this[_0x1262('0xd8')][_0xbeed0e['uniqueid']]=_0xb868ad;}};Dialer[_0x1262('0x1b')][_0x1262('0x1a2')]=function(_0x389ad4,_0x3ad7ec,_0x183dba){var _0xd64ffd=new History(_0x3ad7ec);if(_0xd64ffd[_0x1262('0xfd')]+_0xd64ffd['countcongestionretry']+_0xd64ffd[_0x1262('0xfe')]+_0xd64ffd['countnosuchnumberretry']+_0xd64ffd[_0x1262('0xff')]+_0xd64ffd[_0x1262('0x100')]+_0xd64ffd[_0x1262('0xe9')]+_0xd64ffd[_0x1262('0xef')]>=_0x183dba[_0x1262('0x101')]-0x1){return!![];}switch(_0x389ad4){case 0x3:if(_0xd64ffd[_0x1262('0xfe')]>=_0x183dba[_0x1262('0x1a3')]-0x1){return!![];}this[_0x1262('0xbf')]({'active':![],'countnoanswerretry':_0xd64ffd[_0x1262('0xfe')]+=0x1,'scheduledat':moment()[_0x1262('0x102')](_0x183dba['dialNoAnswerRetryFrequency'],_0x1262('0xf6'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xd64ffd[_0x1262('0xd0')],'ListId':_0xd64ffd[_0x1262('0xf8')],'VoiceQueueId':_0xd64ffd[_0x1262('0xd1')]||undefined,'CampaignId':_0xd64ffd['CampaignId']||undefined})[_0x1262('0xaf')](loggerCatch(_0x1262('0x1a4')));break;case 0x5:if(_0xd64ffd[_0x1262('0xfd')]>=_0x183dba[_0x1262('0x1a5')]-0x1){return!![];}this[_0x1262('0xbf')]({'active':![],'countbusyretry':_0xd64ffd['countbusyretry']+=0x1,'scheduledat':moment()[_0x1262('0x102')](_0x183dba[_0x1262('0x1a6')],'minutes')[_0x1262('0x72')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xd64ffd[_0x1262('0xd0')],'ListId':_0xd64ffd['ListId'],'VoiceQueueId':_0xd64ffd[_0x1262('0xd1')]||undefined,'CampaignId':_0xd64ffd[_0x1262('0xd2')]||undefined})[_0x1262('0xaf')](loggerCatch(_0x1262('0x1a7')));break;case 0x8:if(_0xd64ffd[_0x1262('0xed')]>=_0x183dba[_0x1262('0x1a8')]-0x1){return!![];}this[_0x1262('0xbf')]({'active':![],'countcongestionretry':_0xd64ffd[_0x1262('0xed')]+=0x1,'scheduledat':moment()[_0x1262('0x102')](_0x183dba['dialCongestionRetryFrequency'],_0x1262('0xf6'))[_0x1262('0x72')](_0x1262('0xf7')),'ContactId':_0xd64ffd['ContactId'],'ListId':_0xd64ffd['ListId'],'VoiceQueueId':_0xd64ffd['VoiceQueueId']||undefined,'CampaignId':_0xd64ffd[_0x1262('0xd2')]||undefined})[_0x1262('0xaf')](loggerCatch(_0x1262('0x1a9')));break;case 0x0:if(_0xd64ffd[_0x1262('0xee')]>=_0x183dba[_0x1262('0x1aa')]-0x1){return!![];}else{this[_0x1262('0xbf')]({'active':![],'countnosuchnumberretry':_0xd64ffd['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x1262('0x102')](_0x183dba[_0x1262('0x1ab')],_0x1262('0xf6'))[_0x1262('0x72')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xd64ffd[_0x1262('0xd0')],'ListId':_0xd64ffd[_0x1262('0xf8')],'VoiceQueueId':_0xd64ffd[_0x1262('0xd1')]||undefined,'CampaignId':_0xd64ffd['CampaignId']||undefined})[_0x1262('0xaf')](loggerCatch(_0x1262('0x1ac')));}break;case 0xa:if(_0xd64ffd['countdropretry']>=_0x183dba[_0x1262('0x11c')]-0x1){return!![];}this[_0x1262('0xbf')]({'active':![],'countdropretry':_0xd64ffd[_0x1262('0xff')]+=0x1,'scheduledat':moment()[_0x1262('0x102')](_0x183dba[_0x1262('0x11e')],_0x1262('0xf6'))[_0x1262('0x72')](_0x1262('0xf7')),'ContactId':_0xd64ffd[_0x1262('0xd0')],'ListId':_0xd64ffd[_0x1262('0xf8')],'VoiceQueueId':_0xd64ffd[_0x1262('0xd1')]||undefined,'CampaignId':_0xd64ffd[_0x1262('0xd2')]||undefined})[_0x1262('0xaf')](loggerCatch(_0x1262('0x1ad')));break;case 0xb:if(_0xd64ffd[_0x1262('0x100')]>=_0x183dba[_0x1262('0x127')]-0x1){return!![];}this[_0x1262('0xbf')]({'active':![],'countabandonedretry':_0xd64ffd['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x183dba[_0x1262('0x128')],_0x1262('0xf6'))['format'](_0x1262('0xf7')),'ContactId':_0xd64ffd[_0x1262('0xd0')],'ListId':_0xd64ffd['ListId'],'VoiceQueueId':_0xd64ffd['VoiceQueueId']||undefined,'CampaignId':_0xd64ffd[_0x1262('0xd2')]||undefined})[_0x1262('0xaf')](loggerCatch(_0x1262('0x129')));break;case 0x13:if(_0xd64ffd[_0x1262('0xe9')]>=_0x183dba['dialMachineMaxRetry']-0x1){return!![];}this[_0x1262('0xbf')]({'active':![],'countmachineretry':_0xd64ffd[_0x1262('0xe9')]+=0x1,'scheduledat':moment()[_0x1262('0x102')](_0x183dba[_0x1262('0xf5')],_0x1262('0xf6'))[_0x1262('0x72')](_0x1262('0xf7')),'ContactId':_0xd64ffd[_0x1262('0xd0')],'ListId':_0xd64ffd[_0x1262('0xf8')],'VoiceQueueId':_0xd64ffd['VoiceQueueId']||undefined,'CampaignId':_0xd64ffd[_0x1262('0xd2')]||undefined})['catch'](loggerCatch(_0x1262('0xf9')));break;case 0x14:if(_0xd64ffd[_0x1262('0xef')]>=_0x183dba[_0x1262('0x1ae')]-0x1){return!![];}this[_0x1262('0xbf')]({'active':![],'countagentrejectretry':_0xd64ffd[_0x1262('0xef')]+=0x1,'scheduledat':moment()[_0x1262('0x102')](_0x183dba[_0x1262('0x1af')],'minutes')[_0x1262('0x72')](_0x1262('0xf7')),'ContactId':_0xd64ffd[_0x1262('0xd0')],'ListId':_0xd64ffd[_0x1262('0xf8')],'VoiceQueueId':_0xd64ffd[_0x1262('0xd1')]||undefined,'CampaignId':_0xd64ffd['CampaignId']||undefined})[_0x1262('0xaf')](loggerCatch(_0x1262('0x1b0')));break;default:return!![];}};Dialer[_0x1262('0x1b')]['callProgressDetecting']=function(_0x3e98f0,_0x13fd83,_0x1be9f5){var _0x378011=this;var _0x563d0e=new History(_0x3e98f0);return new BPromise(function(_0x43a0f8,_0x1397c4){if(_[_0x1262('0x83')](_0x13fd83)&&typeof _0x13fd83!==_0x1262('0x172')){return _0x1397c4(msgResponse(_0x1262('0x1b1'),_0x1262('0x14c'),_0x1262('0x1b2')));}if(_[_0x1262('0x83')](_0x1be9f5)&&typeof _0x1be9f5!==_0x1262('0x172')){return _0x1397c4(msgResponse(_0x1262('0x1b1'),_0x1262('0x14c'),'evt\x20is\x20undefine'));}switch(_0x1be9f5[_0x1262('0x1b3')]){case'0':_0x13fd83[_0x1262('0x1b4')]+=0x1;_0x563d0e['state']=0x0;_0x563d0e[_0x1262('0xa5')]=_0x1262('0x1b5');_0x563d0e[_0x1262('0xee')]+=0x1;_0x563d0e['countglobal']+=0x1;ami[_0x1262('0xe0')](_0x1262('0x1b6'),ut[_0x1262('0xe1')](_0x3e98f0,_0x1262('0x1b7')));_0x378011[_0x1262('0xca')](_0x563d0e)[_0x1262('0xaf')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x378011['checkRetriveMax'](0x0,_0x3e98f0,_0x13fd83)){if(_0x563d0e[_0x1262('0xee')]>=_0x13fd83[_0x1262('0x1aa')]){_0x378011[_0x1262('0xf3')](_0x563d0e,_0x43a0f8,_0x1397c4,'reason\x200\x20no\x20such\x20number....');}else{_0x378011[_0x1262('0xf0')](_0x563d0e,_0x43a0f8,_0x1397c4,_0x1262('0x1b8'));}}break;case'3':_0x13fd83[_0x1262('0x1b9')]+=0x1;_0x563d0e[_0x1262('0xde')]=0x3;_0x563d0e[_0x1262('0xa5')]=_0x1262('0x1ba');_0x563d0e[_0x1262('0xfe')]+=0x1;_0x563d0e['countglobal']+=0x1;ami[_0x1262('0xe0')](_0x1262('0x1bb'),ut[_0x1262('0xe1')](_0x3e98f0,_0x1262('0x1bc')));_0x378011[_0x1262('0xca')](_0x563d0e)[_0x1262('0xaf')](loggerCatch(_0x1262('0x1bd')));if(_0x378011[_0x1262('0x1a2')](0x3,_0x3e98f0,_0x13fd83)){if(_0x563d0e[_0x1262('0xfe')]>=_0x13fd83[_0x1262('0x1a3')]){_0x378011[_0x1262('0xf3')](_0x563d0e,_0x43a0f8,_0x1397c4,_0x1262('0x1be'));}else{_0x378011[_0x1262('0xf0')](_0x563d0e,_0x43a0f8,_0x1397c4,_0x1262('0x1be'));}}break;case'5':_0x13fd83[_0x1262('0x5d')]+=0x1;_0x563d0e[_0x1262('0xde')]=0x5;_0x563d0e[_0x1262('0xa5')]=_0x1262('0x1bf');_0x563d0e[_0x1262('0xfd')]+=0x1;_0x563d0e[_0x1262('0xea')]+=0x1;ami['emit']('custom:agentbusy',ut[_0x1262('0xe1')](_0x3e98f0,_0x1262('0x1c0')));_0x378011[_0x1262('0xca')](_0x563d0e)[_0x1262('0xaf')](loggerCatch(_0x1262('0x1c1')));if(_0x378011[_0x1262('0x1a2')](0x5,_0x3e98f0,_0x13fd83)){if(_0x563d0e['countbusyretry']>=_0x13fd83[_0x1262('0x1a5')]){_0x378011[_0x1262('0xf3')](_0x563d0e,_0x43a0f8,_0x1397c4,_0x1262('0x1c2'));}else{_0x378011['stateGlobal'](_0x563d0e,_0x43a0f8,_0x1397c4,_0x1262('0x1c2'));}}break;case'8':_0x13fd83[_0x1262('0x1c3')]+=0x1;_0x563d0e[_0x1262('0xde')]=0x8;_0x563d0e[_0x1262('0xa5')]=_0x1262('0x1c4');_0x563d0e[_0x1262('0xed')]+=0x1;_0x563d0e[_0x1262('0xea')]+=0x1;ami[_0x1262('0xe0')](_0x1262('0x1c5'),ut[_0x1262('0xe1')](_0x3e98f0,_0x1262('0x1c6')));_0x378011['createHistory'](_0x563d0e)[_0x1262('0xaf')](loggerCatch(_0x1262('0x1c7')));if(_0x378011[_0x1262('0x1a2')](0x8,_0x3e98f0,_0x13fd83)){if(_0x563d0e[_0x1262('0xed')]>=_0x13fd83[_0x1262('0x1a8')]){_0x378011[_0x1262('0xf3')](_0x563d0e,_0x43a0f8,_0x1397c4,'reason\x208\x20congestion');}else{_0x378011[_0x1262('0xf0')](_0x563d0e,_0x43a0f8,_0x1397c4,_0x1262('0x1c8'));}}break;case'11':_0x13fd83['outboundAbandonedCallsDay']+=0x1;_0x563d0e['state']=0xb;_0x563d0e[_0x1262('0xa5')]='Abandoned';_0x563d0e[_0x1262('0x100')]+=0x1;_0x563d0e['countglobal']+=0x1;_0x378011['createHistory'](_0x563d0e)[_0x1262('0xaf')](loggerCatch(_0x1262('0x12a')));if(_0x378011[_0x1262('0x1a2')](0xb,_0x3e98f0,_0x13fd83)){if(_0x563d0e[_0x1262('0x100')]>=_0x13fd83[_0x1262('0x127')]){_0x378011[_0x1262('0xf3')](_0x563d0e,_0x43a0f8,_0x1397c4,_0x1262('0x1c9'));}else{_0x378011[_0x1262('0xf0')](_0x563d0e,_0x43a0f8,_0x1397c4,'reason\x2011\x20abandoned');}}break;case'20':_0x13fd83[_0x1262('0x1ca')]+=0x1;_0x563d0e[_0x1262('0xde')]=0x14;_0x563d0e[_0x1262('0xa5')]=_0x1262('0x1cb');_0x563d0e[_0x1262('0xef')]+=0x1;_0x563d0e[_0x1262('0xea')]+=0x1;ami['emit'](_0x1262('0x1cc'),ut['buildObj'](_0x3e98f0,_0x1262('0x1cd')));_0x378011[_0x1262('0xca')](_0x563d0e)[_0x1262('0xaf')](loggerCatch(_0x1262('0x1ce')));if(_0x378011[_0x1262('0x1a2')](0x14,_0x3e98f0,_0x13fd83)){if(_0x563d0e[_0x1262('0xef')]>=_0x13fd83['dialAgentRejectMaxRetry']){_0x378011[_0x1262('0xf3')](_0x563d0e,_0x43a0f8,_0x1397c4,_0x1262('0x1cf'));}else{_0x378011[_0x1262('0xf0')](_0x563d0e,_0x43a0f8,_0x1397c4,'reason\x2020\x20agentreject');}}break;default:_0x13fd83[_0x1262('0x109')]+=0x1;_0x563d0e[_0x1262('0xde')]=0xc;_0x563d0e[_0x1262('0xa5')]=_0x1be9f5[_0x1262('0x1b3')];_0x378011[_0x1262('0xca')](_0x563d0e)[_0x1262('0xaf')](loggerCatch(_0x1262('0x1d0')));if(_0x378011['checkRetriveMax'](_0x1be9f5[_0x1262('0x1b3')],_0x3e98f0,_0x13fd83)){if(_0x563d0e['countbusyretry']+_0x563d0e[_0x1262('0xed')]+_0x563d0e['countnoanswerretry']+_0x563d0e['countnosuchnumberretry']+_0x563d0e[_0x1262('0xff')]+_0x563d0e[_0x1262('0x100')]+_0x563d0e[_0x1262('0xe9')]+_0x563d0e[_0x1262('0xef')]>=_0x13fd83[_0x1262('0x101')]){_0x378011[_0x1262('0xf0')](_0x563d0e,_0x43a0f8,_0x1397c4,_0x1be9f5[_0x1262('0x1b3')]);}else{_0x378011[_0x1262('0xf3')](_0x563d0e,_0x43a0f8,_0x1397c4,_0x1be9f5[_0x1262('0x1b3')]);}}}});};Dialer['prototype'][_0x1262('0xf0')]=function(_0x219314,_0x27be37,_0x30ffee,_0x22044f){var _0x51b6d5=new Final(_0x219314);_0x51b6d5[_0x1262('0xde')]=0xf;_0x51b6d5['statedesc']=_0x1262('0x1d1');this[_0x1262('0xf3')](_0x51b6d5,_0x27be37,_0x30ffee,_0x22044f);};Dialer[_0x1262('0x1b')][_0x1262('0xf3')]=function(_0x4c2ade,_0x1e56d3,_0x30eb40,_0x2c2377){this[_0x1262('0xc8')](_0x4c2ade)[_0x1262('0xb7')](function(){return _0x1e56d3(msgResponse(_0x1262('0x1b1'),'Success',_0x2c2377));})[_0x1262('0xaf')](function(){return _0x30eb40(msgResponse('[moveContactManagedDialer][0]',_0x1262('0x14c'),_0x1262('0x1d2')));});};Dialer['prototype'][_0x1262('0x163')]=function(_0x4fc8ce){var _0x5ce8d4=_0x4fc8ce[_0x1262('0x1d3')]/0x64;var _0x41a957=_0x4fc8ce[_0x1262('0x119')]/(_0x4fc8ce['outboundDropCallsDayTimeout']+_0x4fc8ce[_0x1262('0x5b')]);var _0xba18c4=Math[_0x1262('0x1d4')](_0x4fc8ce[_0x1262('0x69')]*(_0x4fc8ce[_0x1262('0x1d5')]/0x64));var _0x50e5fc=Math[_0x1262('0x1d4')](_0x4fc8ce[_0x1262('0x69')]*(_0x4fc8ce['predictiveIntervalMinThreshold']/0x64));var _0x39d82a=_0x4fc8ce[_0x1262('0x4c')]+_0x4fc8ce[_0x1262('0x50')];var _0x5155ac=Math[_0x1262('0x1d6')](_0x4fc8ce[_0x1262('0x6b')]*_0x4fc8ce[_0x1262('0x6d')]*_0x4fc8ce[_0x1262('0x66')]*_0x4fc8ce['predictiveIntervalMultiplicativeFactor']);if(_[_0x1262('0x83')](_0x4fc8ce['startProgressive'])){if(!_[_0x1262('0x83')](_0x4fc8ce[_0x1262('0x27')])){_0x4fc8ce[_0x1262('0x27')]=undefined;loggerPredictive[_0x1262('0x95')](_0x1262('0x1d7'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x4fc8ce['handlePredictive'])){loggerPredictive[_0x1262('0x95')](_0x1262('0x1d7'),_0x1262('0x1d8'));clearInterval(_0x4fc8ce[_0x1262('0x8f')]);_0x4fc8ce[_0x1262('0x8f')]=undefined;}_0x4fc8ce[_0x1262('0x28')]=moment()[_0x1262('0x72')](_0x1262('0xf7'));loggerPredictive[_0x1262('0x7c')](_0x4fc8ce[_0x1262('0x3d')],_0x1262('0x1d9'),_0x4fc8ce[_0x1262('0x28')]);this[_0x1262('0x160')](_0x4fc8ce,0x1);}else if(ifInterval(_0x4fc8ce['dialPredictiveInterval'],_0x4fc8ce['startProgressive'])){this[_0x1262('0x160')](_0x4fc8ce,0x1);loggerPredictiveCalls[_0x1262('0x7c')](_0x1262('0x1da'),_0x4fc8ce['startProgressive'],_0x4fc8ce[_0x1262('0x3d')]);_0x4fc8ce[_0x1262('0x6b')]=0x0;_0x4fc8ce[_0x1262('0x65')]=0x0;}else if(_0x5ce8d4<_0x41a957&&_0x4fc8ce['dialPredictiveOptimization']===_0x1262('0x1db')){freeVariablesPredictive(_0x4fc8ce);loggerPredictive['info'](_0x1262('0x1dc'),'Dropped\x20calls\x20day',_0x41a957,_0x1262('0x28'),_0x4fc8ce['name']);}else if(_0x5155ac<_0x4fc8ce[_0x1262('0x65')]&&_0x4fc8ce[_0x1262('0x1dd')]===_0x1262('0x1db')){freeVariablesPredictive(_0x4fc8ce);loggerPredictive[_0x1262('0x7c')](_0x1262('0x1de'),_0x1262('0x1df'),_0x5155ac,_0x1262('0x1e0'),_0x4fc8ce[_0x1262('0x65')],_0x1262('0x28'),_0x4fc8ce[_0x1262('0x3d')]);}else if(!ifInterval(_0x4fc8ce[_0x1262('0x1e1')],_0x4fc8ce[_0x1262('0x28')])&&_['isUndefined'](_0x4fc8ce['startPredictive'])&&!_[_0x1262('0x83')](_0x4fc8ce[_0x1262('0x28')])){_0x4fc8ce[_0x1262('0x27')]=moment()[_0x1262('0x72')](_0x1262('0xf7'));loggerPredictive[_0x1262('0x7c')](_0x4fc8ce['name'],_0x1262('0x1e2'),_0x4fc8ce['startPredictive']);this[_0x1262('0xbd')](_0x4fc8ce[_0x1262('0x1e1')])['then'](this['getDataPredictive'](_0x4fc8ce))[_0x1262('0xb7')](mergeDataErlangB(_0x4fc8ce))[_0x1262('0xb7')](this[_0x1262('0x1e3')](_0x4fc8ce))[_0x1262('0xaf')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x4fc8ce));}else if(!ifInterval(_0x4fc8ce[_0x1262('0x1e1')],_0x4fc8ce[_0x1262('0x27')])){_0x4fc8ce[_0x1262('0x65')]=0x0;_0x4fc8ce[_0x1262('0x27')]=moment()[_0x1262('0x72')](_0x1262('0xf7'));loggerPredictive[_0x1262('0x7c')](_0x4fc8ce['name'],_0x1262('0x1e4'),_0x4fc8ce[_0x1262('0x27')]);clearInterval(_0x4fc8ce[_0x1262('0x8f')]);_0x4fc8ce[_0x1262('0x8f')]=undefined;this[_0x1262('0xbd')](_0x4fc8ce['dialPredictiveInterval'])[_0x1262('0xb7')](this['getDataPredictive'](_0x4fc8ce))['then'](mergeDataErlangB(_0x4fc8ce))[_0x1262('0xb7')](this[_0x1262('0x1e3')](_0x4fc8ce))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x4fc8ce));}else if(_0x4fc8ce[_0x1262('0x69')]&&_0x39d82a<_0x4fc8ce[_0x1262('0x69')]-_0x50e5fc){freeVariablesPredictive(_0x4fc8ce);loggerPredictive[_0x1262('0x7c')](_0x4fc8ce[_0x1262('0x3d')],_0x1262('0x1e5'),_0x39d82a,_0x1262('0x1e6'),_0x4fc8ce[_0x1262('0x69')],'-',_0x50e5fc,'=',_0x4fc8ce[_0x1262('0x69')]-_0x50e5fc,')');}else if(_0x4fc8ce[_0x1262('0x69')]&&_0x39d82a>_0x4fc8ce[_0x1262('0x69')]+_0xba18c4){freeVariablesPredictive(_0x4fc8ce);loggerPredictive[_0x1262('0x7c')](_0x4fc8ce[_0x1262('0x3d')],_0x1262('0x1e5'),_0x39d82a,_0x1262('0x1e7'),_0x4fc8ce[_0x1262('0x69')],'+',_0xba18c4,'=',_0x4fc8ce['predictiveIntervalAvailable']+_0xba18c4,')');}};Dialer['prototype'][_0x1262('0x1e8')]=function(_0x5c712e){var _0x1fab7f=this;return function(_0x46b042){return new BPromise(function(_0x14042c,_0x72cf1){_[_0x1262('0x8b')](_0x5c712e,_0x46b042[0x0]);if(checkGetDataPredictive(_0x46b042[0x0])){var _0x27ad30=_0x5c712e[_0x1262('0x69')]=_0x5c712e[_0x1262('0x50')]+_0x5c712e['available'];var _0x2e2a85=_0x5c712e['dialPredictiveInterval']*0x3c;var _0x15efa0=_0x46b042[0x0]['predictiveIntervalAvgTalktime']+_0x46b042[0x0][_0x1262('0x61')];var _0x1c4559=(_0x46b042[0x0][_0x1262('0x60')]+_0x46b042[0x0][_0x1262('0x63')]+_0x46b042[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x46b042[0x0][_0x1262('0x7a')];_0x5c712e[_0x1262('0x66')]=_0x1c4559>0x0?_0x1c4559:0x1;switch(_0x5c712e['dialPredictiveOptimization']){case _0x1262('0x1db'):var _0x2c076f=_0x5c712e[_0x1262('0x1d3')]/0x64;return _0x1fab7f[_0x1262('0x1e9')](_0x27ad30,_0x2e2a85,_0x15efa0,_0x1c4559,_0x2c076f)[_0x1262('0xb7')](function(_0x378837){return _0x14042c(_0x378837);});case _0x1262('0x1ea'):var _0x3dfe36=_0x5c712e['dialPredictiveOptimizationPercentage']/0x64;return _0x1fab7f['busyFactor'](_0x27ad30,_0x2e2a85,_0x15efa0,_0x1c4559,_0x3dfe36)[_0x1262('0xb7')](function(_0x5361f0){return _0x14042c(_0x5361f0);});default:return _0x72cf1(msgResponse(_0x1262('0x1eb'),_0x1262('0x14c'),_0x1262('0x1ec')));}}else{return _0x72cf1(msgResponse('[getDataPredictive]',_0x1262('0x14c'),_0x1262('0x1ed')));}});};};Dialer[_0x1262('0x1b')][_0x1262('0x1ee')]=function(_0x12e232){var _0x26d097=this;return function(_0x33ef21){return new BPromise(function(_0x2ffa06,_0xa7b4f8){_[_0x1262('0x8b')](_0x12e232,_0x33ef21[0x0]);if(checkGetDataPredictive(_0x33ef21[0x0])){loggerPredictive['info'](JSON[_0x1262('0x46')](_0x33ef21[0x0]));if(_0x12e232[_0x1262('0x1dd')]==='dropRate'){return _0x26d097[_0x1262('0xc7')](_0x12e232['id'])[_0x1262('0xb7')](function(_0x18d358){var _0x71533b=_0x12e232[_0x1262('0x167')]-_0x18d358[0x0]['outboundQueuePauses'];var _0x483185=_0x12e232[_0x1262('0x1e1')]*0x3c;var _0x597c44=_0x33ef21[0x0][_0x1262('0x62')]+_0x33ef21[0x0]['predictiveIntervalAvgHoldtime'];var _0x4f1602=(_0x33ef21[0x0][_0x1262('0x60')]+_0x33ef21[0x0][_0x1262('0x63')]+_0x33ef21[0x0][_0x1262('0x7f')])/_0x33ef21[0x0][_0x1262('0x7a')];var _0x39cca6=_0x12e232['dialPredictiveOptimizationPercentage']/0x64;_0x12e232[_0x1262('0x68')]=_0x18d358[0x0][_0x1262('0x1ef')]||0x0;_0x12e232[_0x1262('0x66')]=_0x4f1602>0x0?_0x4f1602:0x1;return _0x26d097[_0x1262('0x1e9')](_0x71533b,_0x483185,_0x597c44,_0x4f1602,_0x39cca6);})[_0x1262('0xb7')](function(_0x8799d3){return _0x2ffa06(_0x8799d3);})[_0x1262('0xaf')](function(_0x588bb2){return _0xa7b4f8(msgResponse(_0x1262('0x1f0'),_0x1262('0x14c'),JSON['stringify'](_0x588bb2)));});}if(_0x12e232[_0x1262('0x1dd')]===_0x1262('0x1ea')){return _0x26d097[_0x1262('0xc7')](_0x12e232['id'])[_0x1262('0xb7')](function(_0x5ba538){var _0x1d1083=_0x12e232['loggedIn']-_0x5ba538[0x0][_0x1262('0x1ef')];var _0x15c03a=_0x12e232[_0x1262('0x1e1')]*0x3c;var _0x5ebb21=_0x33ef21[0x0][_0x1262('0x62')]+_0x33ef21[0x0][_0x1262('0x61')];var _0x1564c7=(_0x33ef21[0x0][_0x1262('0x60')]+_0x33ef21[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x33ef21[0x0][_0x1262('0x7f')])/_0x33ef21[0x0]['predictiveIntervalTotalCalls'];var _0x1a6bef=_0x12e232[_0x1262('0x1d3')]/0x64;_0x12e232[_0x1262('0x68')]=_0x5ba538[0x0][_0x1262('0x1ef')]||0x0;_0x12e232[_0x1262('0x66')]=_0x1564c7>0x0?_0x1564c7:0x1;return _0x26d097['busyFactor'](_0x1d1083,_0x15c03a,_0x5ebb21,_0x1564c7,_0x1a6bef);})[_0x1262('0xb7')](function(_0x42baf6){return _0x2ffa06(_0x42baf6);})['catch'](function(_0x39dc30){return _0xa7b4f8(msgResponse(_0x1262('0x1f0'),_0x1262('0x14c'),JSON[_0x1262('0x46')](_0x39dc30)));});}}else{return _0xa7b4f8(msgResponse('[getDataPredictive]',_0x1262('0x14c'),_0x1262('0x1ed')));}});};};Dialer[_0x1262('0x1b')]['startMethodPredictive']=function(_0x407cf6){var _0x4c6be7=this;return function(){var _0x125f1e=0x0;var _0x185f5a=Math[_0x1262('0x1d6')](_0x407cf6[_0x1262('0x6c')]*0x3e8);if(_0x185f5a>0x0){_0x185f5a=_0x185f5a<0x64?0x64:_0x185f5a;loggerPredictive[_0x1262('0x7c')](_0x407cf6[_0x1262('0x3d')],_0x1262('0x1f1'),_0x185f5a,_0x1262('0x47'));_0x407cf6[_0x1262('0x8f')]=setInterval(function(){_0x4c6be7[_0x1262('0x8f')](_0x407cf6);loggerPredictiveCalls[_0x1262('0x7c')]('[handlePredictive]',_0x125f1e+=0x1);},_0x185f5a);}else{loggerPredictive[_0x1262('0x7c')](_0x407cf6['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x1262('0x1b')][_0x1262('0x1f2')]=function(_0x1eb7c2,_0x51fee2){var _0x588bad=this;return function(_0x38b7c8){if(_[_0x1262('0x92')](_0x38b7c8)){if(_[_0x1262('0xab')](_0x51fee2[_0x1262('0x1f3')])||!_0x51fee2['recallme']){if(_0x1eb7c2[_0x1262('0x55')]===_0x1262('0xb')){_0x1eb7c2[_0x1262('0x136')]=_[_0x1262('0x83')](_0x1eb7c2['queueStatusComplete'])?!![]:_0x1eb7c2['queueStatusComplete'];var _0x330356=uuid['v4']();_0x588bad[_0x1262('0x24')][_0x330356]=new Action(_0x1eb7c2,_0x51fee2,_0x330356);loggerBooked[_0x1262('0x7c')](_0x1262('0x1f4'),_0x330356,_0x1262('0x1f5'),JSON[_0x1262('0x46')](_0x1eb7c2[_0x1262('0x136')]),_0x1262('0x1f6'),_0x1eb7c2[_0x1262('0x3d')]);if(_0x1eb7c2[_0x1262('0x136')]){_0x1eb7c2['queueStatusComplete']=![];_0x588bad[_0x1262('0x132')][_0x588bad[_0x1262('0x24')][_0x330356][_0x1262('0xb2')]]=[];ami['Action']({'actionid':_0x330356,'action':_0x1262('0x1f7'),'queue':_0x1eb7c2[_0x1262('0x3d')]})[_0x1262('0xaf')](function(){_0x588bad[_0x1262('0xb1')](_0x1eb7c2);_0x588bad['rescheduleContact']({'active':![],'ContactId':_0x588bad[_0x1262('0x24')][_0x330356]['ContactId'],'ListId':_0x588bad[_0x1262('0x24')][_0x330356][_0x1262('0xf8')],'VoiceQueueId':_0x588bad[_0x1262('0x24')][_0x330356][_0x1262('0xd1')]||undefined,'CampaignId':_0x588bad[_0x1262('0x24')][_0x330356][_0x1262('0xd2')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x588bad['actions'][_0x330356];});}else{loggerBooked[_0x1262('0x7c')](_0x1262('0x1f8'),JSON[_0x1262('0x46')](_0x1eb7c2['queueStatusComplete']),_0x1262('0x1f6'),_0x1eb7c2[_0x1262('0x3d')]);_0x588bad['updateOriginated'](_0x1eb7c2);_0x588bad[_0x1262('0xbf')]({'active':![],'ContactId':_0x588bad[_0x1262('0x24')][_0x330356][_0x1262('0xd0')],'ListId':_0x588bad['actions'][_0x330356][_0x1262('0xf8')],'VoiceQueueId':_0x588bad[_0x1262('0x24')][_0x330356][_0x1262('0xd1')]||undefined,'CampaignId':_0x588bad[_0x1262('0x24')][_0x330356][_0x1262('0xd2')]||undefined})[_0x1262('0xaf')](loggerCatch(_0x1262('0x1f9')));delete _0x588bad[_0x1262('0x24')][_0x330356];}}else{return _0x588bad[_0x1262('0x171')](_0x1eb7c2,_0x51fee2);}}else{if(getDiff(_0x51fee2['scheduledat'])<_0x1eb7c2[_0x1262('0x1fa')]*0x3c){if(_0x51fee2[_0x1262('0x1fb')]&&!_0x51fee2[_0x1262('0x1fb')][_0x1262('0x1fc')]){_0x588bad['preview'][_0x1262('0x138')](_0x51fee2['id'])[_0x1262('0x1d')](function(){_0x588bad[_0x1262('0xb1')](_0x1eb7c2);});}else{_0x588bad['unlockContact']({'active':![]},_0x51fee2['id'],0x1)[_0x1262('0x1d')](function(){_0x588bad[_0x1262('0xb1')](_0x1eb7c2);});}}else{_0x1eb7c2[_0x1262('0x5f')]+=0x1;_0x588bad[_0x1262('0xb1')](_0x1eb7c2);if(_0x1eb7c2[_0x1262('0x1fd')]){_0x588bad['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x51fee2[_0x1262('0xd0')],'ListId':_0x51fee2[_0x1262('0xf8')],'VoiceQueueId':_0x51fee2['VoiceQueueId']||undefined,'CampaignId':_0x51fee2[_0x1262('0xd2')]||undefined})['catch'](loggerCatch(_0x1262('0x1fe')));_0x588bad[_0x1262('0xca')](createObjHistory(_0x1eb7c2,_0x51fee2,_0x1262('0x1ff'),0x17,_0x1262('0x200')))[_0x1262('0xaf')](loggerCatch(_0x1262('0x201')));}else{_0x588bad[_0x1262('0xd7')](createObjHistory(_0x1eb7c2,_0x51fee2,_0x1262('0x202'),0x16,_0x1262('0x203')),_0x1262('0x204'),'[Originate][HistoryRecallClose]');}}}}else{_0x1eb7c2[_0x1262('0x5c')]+=0x1;_0x588bad[_0x1262('0xd7')](createObjHistory(_0x1eb7c2,_0x51fee2,'BLACKLIST',0xd,_0x1262('0x205')),_0x1262('0x206'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0x1262('0x1b')][_0x1262('0x166')]=function(_0x55f766){var _0x915266=this;var _0x1adab0=_0x55f766[_0x1262('0x207')]-_0x55f766[_0x1262('0x6a')]-_0x55f766[_0x1262('0xc3')];emitCampaignSummary(_0x55f766);if(_0x1adab0>0x0){if(_0x1adab0>this[_0x1262('0x23')]){_0x1adab0=this[_0x1262('0x23')];}_0x55f766[_0x1262('0xc3')]+=_0x1adab0;this[_0x1262('0xc5')](_0x55f766['id'],_0x1adab0,_0x55f766[_0x1262('0x208')],_0x55f766)['then'](function(_0x4d0bac){_0x55f766[_0x1262('0xc3')]-=_0x1adab0;_0x55f766[_0x1262('0xc3')]=_0x55f766['temp']>0x0?_0x55f766[_0x1262('0xc3')]:0x0;if(!checkContactEmpty(_0x4d0bac)){_0x55f766[_0x1262('0x3b')]=_0x1262('0x9e');logger[_0x1262('0x7c')](_0x1262('0x209')+_0x55f766[_0x1262('0x3d')]);}else{_0x55f766[_0x1262('0x6a')]+=_0x4d0bac[_0x1262('0x97')];_0x55f766[_0x1262('0x3b')]=_0x1262('0x20a');for(var _0x5b304d=0x0;_0x5b304d<_0x4d0bac['length'];_0x5b304d+=0x1){_0x55f766['ivrTotalCallsDays']+=0x1;if(_[_0x1262('0xab')](_0x4d0bac[_0x5b304d])||_[_0x1262('0xab')](_0x4d0bac[_0x5b304d][_0x1262('0x174')])||_['isNil'](_0x4d0bac[_0x5b304d]['Contact'][_0x1262('0x175')])){_0x915266[_0x1262('0xce')](_0x1262('0x20b'),_0x55f766,_0x4d0bac[_0x5b304d]);}else{_0x915266[_0x1262('0xbb')](_['pick'](_0x4d0bac[_0x5b304d],[_0x1262('0xd2'),_0x1262('0x20c')]))['then'](_0x915266[_0x1262('0x1f2')](_0x55f766,_0x4d0bac[_0x5b304d]))[_0x1262('0xaf')](_0x915266[_0x1262('0xcd')](_0x1262('0x20d'),_0x55f766));}}}})[_0x1262('0xaf')](loggerGetContactDialer(_0x1262('0x20e'),_0x55f766,_0x1adab0));}};Dialer[_0x1262('0x1b')][_0x1262('0x160')]=function(_0x336be6,_0x6f87){var _0x35a26d=this;var _0x59ea86=[];var _0x3b4f44=_0x6f87>=0x1?_0x6f87:0x1;if(_0x336be6[_0x1262('0x55')]===_0x1262('0xb')){_0x3b4f44=0x1;}var _0x1cedc6=Math[_0x1262('0x1d6')](_0x336be6[_0x1262('0x4c')]*_0x3b4f44)-_0x336be6[_0x1262('0x6a')]-_0x336be6[_0x1262('0xc3')];emitVoiceQueueSummary(_0x336be6);if(_0x336be6[_0x1262('0x20f')]>0x0){var _0x2fe6ef=_0x336be6[_0x1262('0x20f')]-_0x336be6['originated']-_0x336be6[_0x1262('0x50')]-_0x336be6[_0x1262('0xc3')]-_0x336be6[_0x1262('0x4d')];if(_0x1cedc6>_0x2fe6ef){_0x1cedc6=_0x2fe6ef;}}if(_0x1cedc6>0x0){if(_0x336be6[_0x1262('0x55')]===_0x1262('0xb')){_0x1cedc6=0x1;}if(_0x1cedc6>this['maxNumberOriginate']){_0x1cedc6=this[_0x1262('0x23')];}_0x336be6['temp']+=_0x1cedc6;for(var _0x155735 in this[_0x1262('0x12e')]){if(typeof this[_0x1262('0x12e')][_0x155735]!=='undefined'){if(this[_0x1262('0x12e')][_0x155735][_0x1262('0xde')]===_0x1262('0x210')&&this['agents'][_0x155735]['status']==='reachable'){_0x59ea86[_0x1262('0x158')](this['agents'][_0x155735]['id']);}}}this['getContactDialer'](_0x336be6['id'],_0x59ea86,_0x1cedc6,_0x336be6[_0x1262('0x208')],_0x336be6)[_0x1262('0xb7')](function(_0x53d586){_0x336be6[_0x1262('0xc3')]-=_0x1cedc6;_0x336be6[_0x1262('0xc3')]=_0x336be6[_0x1262('0xc3')]>0x0?_0x336be6[_0x1262('0xc3')]:0x0;if(!checkContactEmpty(_0x53d586)){_0x35a26d[_0x1262('0xb5')](_0x336be6)['then'](sendMessageReschedule(_0x336be6))[_0x1262('0xaf')](loggerCatch('[countReScheduled]\x20'));}else{_0x336be6[_0x1262('0x6a')]+=_0x53d586[_0x1262('0x97')];_0x336be6[_0x1262('0x3b')]=_0x336be6['dialMethod']===_0x1262('0xb')?'ACTIVE':'RUNNING';for(var _0x425f94=0x0;_0x425f94<_0x53d586[_0x1262('0x97')];_0x425f94+=0x1){if(_[_0x1262('0xab')](_0x53d586[_0x425f94])||_['isNil'](_0x53d586[_0x425f94]['Contact'])||_[_0x1262('0xab')](_0x53d586[_0x425f94][_0x1262('0x174')][_0x1262('0x175')])){_0x35a26d['emptyContact']('[actionOriginate]\x20',_0x336be6,_0x53d586[_0x425f94]);}else{_0x35a26d[_0x1262('0xb9')](_['pick'](_0x53d586[_0x425f94],['VoiceQueueId',_0x1262('0x20c')]))[_0x1262('0xb7')](_0x35a26d[_0x1262('0x1f2')](_0x336be6,_0x53d586[_0x425f94]))[_0x1262('0xaf')](_0x35a26d[_0x1262('0xcd')](_0x1262('0x20b'),_0x336be6));}}}})[_0x1262('0xaf')](loggerGetContactDialer('[getContactDialer2]',_0x336be6,_0x1cedc6));}};Dialer[_0x1262('0x1b')][_0x1262('0x8f')]=function(_0x5d5b75){if(_0x5d5b75[_0x1262('0x20f')]>0x0){var _0x26d4a3=_0x5d5b75[_0x1262('0x20f')]-_0x5d5b75[_0x1262('0x6a')]-_0x5d5b75['talking'];if(_0x26d4a3>0x0){this[_0x1262('0x211')](_0x5d5b75);}else{loggerPredictiveCalls[_0x1262('0x7c')](_0x1262('0x212'));}}else{this[_0x1262('0x211')](_0x5d5b75);}};Dialer[_0x1262('0x1b')][_0x1262('0x211')]=function(_0x227f4c){var _0x101bda=this;var _0x78f456=[];_0x227f4c[_0x1262('0x6a')]+=0x1;for(var _0x37dd7b in this[_0x1262('0x12e')]){if(typeof this[_0x1262('0x12e')][_0x37dd7b]!==_0x1262('0x98')){if(this[_0x1262('0x12e')][_0x37dd7b][_0x1262('0xde')]===_0x1262('0x210')&&this[_0x1262('0x12e')][_0x37dd7b][_0x1262('0xad')]===_0x1262('0xd6')){_0x78f456[_0x1262('0x158')](this['agents'][_0x37dd7b]['id']);}}}this['getContactDialer'](_0x227f4c['id'],_0x78f456,0x1,_0x227f4c[_0x1262('0x208')],_0x227f4c)[_0x1262('0xb7')](function(_0x3d8d84){if(!checkContactEmpty(_0x3d8d84)){checkContactLowerLimitOriginate(_0x227f4c,0x1,0x0);_0x101bda['countReScheduled'](_0x227f4c)['then'](sendMessageReschedule(_0x227f4c))[_0x1262('0xaf')](loggerCatch(_0x1262('0xb8')));}else{_0x227f4c['message']=_0x1262('0x20a');if(_[_0x1262('0xab')](_0x3d8d84[0x0])||_[_0x1262('0xab')](_0x3d8d84[0x0][_0x1262('0x174')])||_['isNil'](_0x3d8d84[0x0][_0x1262('0x174')][_0x1262('0x175')])){_0x101bda[_0x1262('0xce')](_0x1262('0x20b'),_0x227f4c,_0x3d8d84[0x0]);}else{_0x101bda['checkIsBlackList'](_[_0x1262('0x133')](_0x3d8d84[0x0],[_0x1262('0xd1'),'Contact.phone']))[_0x1262('0xb7')](_0x101bda[_0x1262('0x1f2')](_0x227f4c,_0x3d8d84[0x0]))['catch'](_0x101bda['loggerHandler']('[actionOriginatePredictive]\x20',_0x227f4c));}}})[_0x1262('0xaf')](loggerGetContactDialer(_0x1262('0x213'),_0x227f4c,0x1));emitVoiceQueueSummary(_0x227f4c);};Dialer[_0x1262('0x1b')][_0x1262('0x1e9')]=function(_0x5acedf,_0x57015c,_0xfa2f37,_0x13140c,_0x35e58b,_0x50ed33){loggerPredictive['info'](_0x1262('0x214'));loggerPredictive['info'](_0x1262('0x215'),_0x5acedf);loggerPredictive[_0x1262('0x7c')](_0x1262('0x216'),_0x57015c);loggerPredictive[_0x1262('0x7c')](_0x1262('0x217'),_0xfa2f37);loggerPredictive[_0x1262('0x7c')](_0x1262('0x218'),_0x13140c);loggerPredictive[_0x1262('0x7c')](_0x1262('0x219'),_0x35e58b);loggerPredictive[_0x1262('0x7c')](_0x1262('0x21a'));return new BPromise(function(_0x3d36af,_0x2a0c6b){if(_0x5acedf<=0x0||isNaN(_0x5acedf)){return _0x2a0c6b(msgResponse(_0x1262('0x21b'),_0x1262('0x45'),_0x1262('0x21c')+_0x5acedf));}if(_0xfa2f37<=0x0||isNaN(_0xfa2f37)){return _0x2a0c6b(msgResponse(_0x1262('0x21b'),_0x1262('0x45'),_0x1262('0x21d')+_0xfa2f37));}if(_0x13140c<=0x0||isNaN(_0x13140c)){return _0x2a0c6b(msgResponse(_0x1262('0x21b'),_0x1262('0x45'),_0x1262('0x21e')+_0x13140c));}if(_0x57015c<=0x0||isNaN(_0x57015c)){return _0x2a0c6b(msgResponse(_0x1262('0x21b'),'Error',_0x1262('0x21f')+_0x57015c));}if(_0x35e58b<=0x0||isNaN(_0x35e58b)){return _0x2a0c6b(msgResponse(_0x1262('0x21b'),_0x1262('0x45'),'Amax\x20=\x20'+_0x35e58b));}_0x50ed33=_0x50ed33||0x0;var _0x2e68a8=0x1/_0xfa2f37;var _0x41d939=0x0;var _0x4d1350=0x0;var _0x3de247=0x0;var _0x13e881=0x0;for(var _0x465856=0x0;_0x3de247<_0x35e58b;_0x465856+=0x1){_0x4d1350=_0x465856/_0x57015c;_0x41d939=(_0x13140c*_0x4d1350+_0x50ed33)/_0x2e68a8;_0x3de247=erlangb(_0x41d939,_0x5acedf);_0x13e881=_0x41d939/_0x5acedf*(0x1-erlangb(_0x41d939,_0x5acedf));}return _0x3d36af({'erlangCalls':_0x465856,'erlangCallToSecond':_0x57015c/_0x465856,'erlangAbandonmentRate':_0x3de247,'erlangBusyFactor':_0x13e881});});};Dialer['prototype'][_0x1262('0x220')]=function(_0x145474,_0x3140a7,_0x300fb4,_0x52b557,_0x2e8b35,_0x514921){loggerPredictive[_0x1262('0x7c')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x1262('0x7c')](_0x1262('0x215'),_0x145474);loggerPredictive[_0x1262('0x7c')](_0x1262('0x216'),_0x3140a7);loggerPredictive[_0x1262('0x7c')](_0x1262('0x217'),_0x300fb4);loggerPredictive['info'](_0x1262('0x218'),_0x52b557);loggerPredictive['info']('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2e8b35);loggerPredictive['info'](_0x1262('0x21a'));return new BPromise(function(_0x3a95e6,_0x36c1ba){if(_0x145474<=0x0||isNaN(_0x145474)){return _0x36c1ba(msgResponse(_0x1262('0x221'),_0x1262('0x45'),_0x1262('0x21c')+_0x145474));}if(_0x300fb4<=0x0||isNaN(_0x300fb4)){return _0x36c1ba(msgResponse(_0x1262('0x221'),'Error',_0x1262('0x21d')+_0x300fb4));}if(_0x52b557<=0x0||isNaN(_0x52b557)){return _0x36c1ba(msgResponse(_0x1262('0x221'),_0x1262('0x45'),_0x1262('0x21e')+_0x52b557));}if(_0x3140a7<=0x0||isNaN(_0x3140a7)){return _0x36c1ba(msgResponse(_0x1262('0x221'),_0x1262('0x45'),_0x1262('0x21f')+_0x3140a7));}if(_0x2e8b35<=0x0||isNaN(_0x2e8b35)){return _0x36c1ba(msgResponse(_0x1262('0x221'),_0x1262('0x45'),_0x1262('0x222')+_0x2e8b35));}_0x514921=_0x514921||0x0;var _0x540159=0x1/_0x300fb4;var _0x44c153=0x0;var _0x566436=0x0;var _0x598b57=0x0;var _0x1b3db5=0x0;for(var _0x39f30c=0x0;_0x1b3db5<_0x2e8b35;_0x39f30c+=0x1){_0x566436=_0x39f30c/_0x3140a7;_0x44c153=(_0x52b557*_0x566436+_0x514921)/_0x540159;_0x598b57=erlangb(_0x44c153,_0x145474);_0x1b3db5=_0x44c153/_0x145474*(0x1-erlangb(_0x44c153,_0x145474));}return _0x3a95e6({'erlangCalls':_0x39f30c,'erlangCallToSecond':_0x3140a7/_0x39f30c,'erlangAbandonmentRate':_0x598b57,'erlangBusyFactor':_0x1b3db5});});};module[_0x1262('0x223')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 0ef92f9..38f5a73 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 _0xa563=['countabandonedretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','endtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countmachineretry'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0xa563,0x11c));var _0x3a56=function(_0x3a9891,_0x23d591){_0x3a9891=_0x3a9891-0x0;var _0x446aa7=_0xa563[_0x3a9891];return _0x446aa7;};'use strict';var util=require(_0x3a56('0x0'));var _=require(_0x3a56('0x1'));var moment=require(_0x3a56('0x2'));function getSeconds(_0x3d5ec5,_0x4a9275){var _0x173c9e=moment(_0x3d5ec5)['milliseconds'](0x0);var _0x525a3b=moment(_0x4a9275)[_0x3a56('0x3')](0x0);return _0x173c9e[_0x3a56('0x4')](_0x525a3b,_0x3a56('0x5'));}function QueueCallerAbandon(_0x241edc,_0x1bc83b){this[_0x3a56('0x6')]=_0x241edc[_0x3a56('0x6')];this[_0x3a56('0x7')]=_0x241edc[_0x3a56('0x7')];this[_0x3a56('0x8')]=_0x241edc[_0x3a56('0x7')]===_0x3a56('0x9')?'queue':_0x241edc['type'];this['countbusyretry']=_0x241edc['countbusyretry'];this[_0x3a56('0xa')]=_0x241edc[_0x3a56('0xa')];this[_0x3a56('0xb')]=_0x241edc[_0x3a56('0xb')];this[_0x3a56('0xc')]=_0x241edc[_0x3a56('0xd')]+_0x241edc[_0x3a56('0xa')]+_0x241edc[_0x3a56('0xb')]+_0x241edc[_0x3a56('0xe')]+_0x241edc[_0x3a56('0xf')]+_0x241edc['countabandonedretry']+_0x241edc[_0x3a56('0x10')]+_0x241edc['countagentrejectretry'];this[_0x3a56('0xe')]=_0x241edc[_0x3a56('0xe')];this['countdropretry']=_0x241edc[_0x3a56('0xf')];this[_0x3a56('0x11')]=_0x241edc['countabandonedretry'];this[_0x3a56('0x10')]=_0x241edc['countmachineretry'];this[_0x3a56('0x12')]=_0x241edc[_0x3a56('0x12')];this[_0x3a56('0x13')]=_0x1bc83b['uniqueid'];this[_0x3a56('0x14')]=_0x241edc['name'];this[_0x3a56('0x15')]=_0x241edc[_0x3a56('0x16')];this[_0x3a56('0x17')]=_0x241edc[_0x3a56('0x17')];this['responsetime']=_0x241edc[_0x3a56('0x18')];this['droptime']=_0x241edc[_0x3a56('0x19')];this[_0x3a56('0x1a')]=this['droptime'];this['ringtime']=getSeconds(_0x241edc[_0x3a56('0x18')],_0x241edc[_0x3a56('0x17')]);this['holdtime']=getSeconds(this['droptime'],_0x241edc['responsetime']);this[_0x3a56('0x1b')]=0x0;this[_0x3a56('0x1c')]=_0x1bc83b[_0x3a56('0x1c')];this[_0x3a56('0x1d')]=_0x1bc83b[_0x3a56('0x1e')];this[_0x3a56('0x1f')]=_0x1bc83b[_0x3a56('0x1f')];this[_0x3a56('0x20')]=_0x241edc['callback'];this[_0x3a56('0x21')]=_0x241edc[_0x3a56('0x21')];this['callbackat']=_0x241edc[_0x3a56('0x22')];this[_0x3a56('0x23')]=_0x241edc[_0x3a56('0x23')];this['ContactId']=_0x241edc[_0x3a56('0x24')];this['ListId']=_0x241edc['ListId'];this[_0x3a56('0x25')]=_0x241edc[_0x3a56('0x25')];this[_0x3a56('0x26')]=_0x241edc[_0x3a56('0x26')];this[_0x3a56('0x27')]=_0x241edc[_0x3a56('0x27')];this['originatecalleridnum']=_0x241edc[_0x3a56('0x28')]||'';this[_0x3a56('0x29')]=_0x241edc[_0x3a56('0x29')]||'';}module[_0x3a56('0x2a')]=QueueCallerAbandon; \ No newline at end of file +var _0x7501=['responsetime','droptime','endtime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','diff','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime'];(function(_0x329406,_0x34ff27){var _0x42176f=function(_0x313034){while(--_0x313034){_0x329406['push'](_0x329406['shift']());}};_0x42176f(++_0x34ff27);}(_0x7501,0x67));var _0x1750=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x7501[_0x167cc1];return _0x10bc4b;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x1750('0x0'));function getSeconds(_0x2a2c3c,_0xad1ea6){var _0x1bf724=moment(_0x2a2c3c)[_0x1750('0x1')](0x0);var _0x3d4029=moment(_0xad1ea6)['milliseconds'](0x0);return _0x1bf724[_0x1750('0x2')](_0x3d4029,'seconds');}function QueueCallerAbandon(_0x3009c4,_0x1c4e3e){this['scheduledat']=_0x3009c4[_0x1750('0x3')];this['type']=_0x3009c4['type'];this[_0x1750('0x4')]=_0x3009c4[_0x1750('0x5')]===_0x1750('0x6')?_0x1750('0x7'):_0x3009c4[_0x1750('0x5')];this[_0x1750('0x8')]=_0x3009c4[_0x1750('0x8')];this[_0x1750('0x9')]=_0x3009c4[_0x1750('0x9')];this[_0x1750('0xa')]=_0x3009c4[_0x1750('0xa')];this[_0x1750('0xb')]=_0x3009c4['countbusyretry']+_0x3009c4[_0x1750('0x9')]+_0x3009c4[_0x1750('0xa')]+_0x3009c4[_0x1750('0xc')]+_0x3009c4[_0x1750('0xd')]+_0x3009c4[_0x1750('0xe')]+_0x3009c4[_0x1750('0xf')]+_0x3009c4[_0x1750('0x10')];this[_0x1750('0xc')]=_0x3009c4[_0x1750('0xc')];this[_0x1750('0xd')]=_0x3009c4[_0x1750('0xd')];this[_0x1750('0xe')]=_0x3009c4[_0x1750('0xe')];this[_0x1750('0xf')]=_0x3009c4['countmachineretry'];this[_0x1750('0x10')]=_0x3009c4[_0x1750('0x10')];this[_0x1750('0x11')]=_0x1c4e3e[_0x1750('0x11')];this[_0x1750('0x12')]=_0x3009c4[_0x1750('0x13')];this[_0x1750('0x14')]=_0x3009c4[_0x1750('0x15')];this[_0x1750('0x16')]=_0x3009c4[_0x1750('0x16')];this['responsetime']=_0x3009c4[_0x1750('0x17')];this['droptime']=_0x3009c4[_0x1750('0x18')];this[_0x1750('0x19')]=this['droptime'];this['ringtime']=getSeconds(_0x3009c4[_0x1750('0x17')],_0x3009c4['starttime']);this[_0x1750('0x1a')]=getSeconds(this[_0x1750('0x18')],_0x3009c4[_0x1750('0x17')]);this[_0x1750('0x1b')]=0x0;this[_0x1750('0x7')]=_0x1c4e3e['queue'];this['membername']=_0x1c4e3e[_0x1750('0x1c')];this['reason']=_0x1c4e3e[_0x1750('0x1d')];this[_0x1750('0x1e')]=_0x3009c4[_0x1750('0x1e')];this[_0x1750('0x1f')]=_0x3009c4['callbackuniqueid'];this[_0x1750('0x20')]=_0x3009c4[_0x1750('0x20')];this[_0x1750('0x21')]=_0x3009c4['recallme'];this[_0x1750('0x22')]=_0x3009c4['ContactId'];this['ListId']=_0x3009c4[_0x1750('0x23')];this[_0x1750('0x24')]=_0x3009c4['UserId'];this['VoiceQueueId']=_0x3009c4[_0x1750('0x25')];this[_0x1750('0x26')]=_0x3009c4[_0x1750('0x26')];this['originatecalleridnum']=_0x3009c4[_0x1750('0x27')]||'';this[_0x1750('0x28')]=_0x3009c4[_0x1750('0x28')]||'';}module[_0x1750('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 7f2c249..f295409 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(_0x19656e,_0x50acaa){var _0x11a45d=function(_0x34f038){while(--_0x34f038){_0x19656e['push'](_0x19656e['shift']());}};_0x11a45d(++_0x50acaa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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(_0x385403,_0x27f102){var _0x8a8abf=function(_0xfdea30){while(--_0xfdea30){_0x385403['push'](_0x385403['shift']());}};_0x8a8abf(++_0x27f102);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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 2273ad4..1493be1 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 _0xb966=['[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxstatus','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','parse','execute','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','execOriginate','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','./util/gs','../../../config/logger','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','bind','newstate','syncNewState','syncNewExten','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','prototype','hasOwnProperty','exten','localstationid','uniqueid','channel','name','actions','info','\x20syncNewchannel\x20','syncVarSet','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','application/pdf','then','fax','.pdf','catch','\x20notify\x20','stringify','error','merge','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]'];(function(_0x5e4be6,_0x3eef15){var _0x162a4e=function(_0x49b74d){while(--_0x49b74d){_0x5e4be6['push'](_0x5e4be6['shift']());}};_0x162a4e(++_0x3eef15);}(_0xb966,0x18f));var _0x6b96=function(_0x3c3b24,_0x510e59){_0x3c3b24=_0x3c3b24-0x0;var _0x22d571=_0xb966[_0x3c3b24];return _0x22d571;};'use strict';var util=require(_0x6b96('0x0'));var _=require(_0x6b96('0x1'));var BPromise=require(_0x6b96('0x2'));var uuid=require(_0x6b96('0x3'));var moment=require(_0x6b96('0x4'));var path=require(_0x6b96('0x5'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x6b96('0x6'));var logger=require(_0x6b96('0x7'))('fax');var ami=require(_0x6b96('0x8'));var rpcDb=require('./rpcDb');var Channel=require(_0x6b96('0x9'));var ut=require(_0x6b96('0xa'));var Action=require(_0x6b96('0xb'));var faxAccount=require(_0x6b96('0xc'));var attachment=require(_0x6b96('0xd'));var faxMessage=require(_0x6b96('0xe'));function Fax(_0x3ff825){this[_0x6b96('0xf')]={};this[_0x6b96('0x10')]=_0x3ff825['faxAccounts'];this[_0x6b96('0x11')]=_0x3ff825[_0x6b96('0x11')];this['actions']={};ami['on'](_0x6b96('0x12'),this[_0x6b96('0x13')]['bind'](this));ami['on']('varset',this['syncVarSet'][_0x6b96('0x14')](this));ami['on'](_0x6b96('0x15'),this[_0x6b96('0x16')]['bind'](this));ami['on']('newexten',this[_0x6b96('0x17')][_0x6b96('0x14')](this));ami['on']('faxstatus',this[_0x6b96('0x18')][_0x6b96('0x14')](this));ami['on'](_0x6b96('0x19'),this[_0x6b96('0x1a')]['bind'](this));ami['on'](_0x6b96('0x1b'),this[_0x6b96('0x1c')][_0x6b96('0x14')](this));ami['on']('originateresponse',this[_0x6b96('0x1d')][_0x6b96('0x14')](this));}Fax[_0x6b96('0x1e')]['syncNewchannel']=function(_0x50341){if(_0x50341['context']==='from-voip-provider'){for(var _0x44af6f in this[_0x6b96('0x10')]){if(this[_0x6b96('0x10')][_0x6b96('0x1f')](_0x44af6f)){if(_0x50341[_0x6b96('0x20')]===this[_0x6b96('0x10')][_0x44af6f][_0x6b96('0x21')]){this[_0x6b96('0xf')][_0x50341['uniqueid']]={};this[_0x6b96('0xf')][_0x50341[_0x6b96('0x22')]][_0x6b96('0x23')]=_0x50341['channel'];this[_0x6b96('0xf')][_0x50341[_0x6b96('0x22')]]['id']=this[_0x6b96('0x10')][_0x44af6f]['id'];this['channels'][_0x50341['uniqueid']][_0x6b96('0x24')]=this[_0x6b96('0x10')][_0x44af6f]['name'];logger['info'](_0x50341[_0x6b96('0x22')],'\x20syncNewchannel\x20');}}}}if(this[_0x6b96('0x25')][_0x50341[_0x6b96('0x22')]]){this[_0x6b96('0xf')][_0x50341[_0x6b96('0x22')]]={};this[_0x6b96('0xf')][_0x50341[_0x6b96('0x22')]][_0x6b96('0x23')]=_0x50341[_0x6b96('0x23')];logger[_0x6b96('0x26')](_0x50341['uniqueid'],_0x6b96('0x27'));}};Fax['prototype'][_0x6b96('0x28')]=function(_0x2198d9){if(this[_0x6b96('0xf')][_0x2198d9[_0x6b96('0x22')]]){for(var _0x497b1a in _0x2198d9[_0x6b96('0x29')]){if(_0x2198d9['variable'][_0x6b96('0x1f')](_0x497b1a)){this[_0x6b96('0xf')][_0x2198d9[_0x6b96('0x22')]][_0x497b1a]=_0x2198d9[_0x6b96('0x2a')];}}}};Fax['prototype'][_0x6b96('0x16')]=function(_0x42d328){if(this[_0x6b96('0xf')][_0x42d328['uniqueid']]){this['channels'][_0x42d328[_0x6b96('0x22')]][_0x6b96('0x2b')]=_0x42d328[_0x6b96('0x2b')];this[_0x6b96('0xf')][_0x42d328[_0x6b96('0x22')]][_0x6b96('0x2c')]=_0x42d328[_0x6b96('0x2c')];}};Fax[_0x6b96('0x1e')][_0x6b96('0x17')]=function(_0x28ea0a){if(this[_0x6b96('0xf')][_0x28ea0a['uniqueid']]){for(var _0x3d4158 in _0x28ea0a[_0x6b96('0x29')]){if(_0x28ea0a[_0x6b96('0x29')][_0x6b96('0x1f')](_0x3d4158)){this[_0x6b96('0xf')][_0x28ea0a[_0x6b96('0x22')]][_0x3d4158]=_0x28ea0a[_0x6b96('0x2a')];}}}};Fax['prototype']['syncFaxStatus']=function(_0x41dbb0){if(this['channels'][_0x41dbb0['uniqueid']]){this[_0x6b96('0xf')][_0x41dbb0[_0x6b96('0x22')]][_0x6b96('0x2d')]=_0x41dbb0[_0x6b96('0x2d')];this['channels'][_0x41dbb0[_0x6b96('0x22')]][_0x6b96('0x2e')]=_0x41dbb0[_0x6b96('0x2e')];this['channels'][_0x41dbb0[_0x6b96('0x22')]][_0x6b96('0x21')]=_0x41dbb0[_0x6b96('0x21')];this[_0x6b96('0xf')][_0x41dbb0[_0x6b96('0x22')]][_0x6b96('0x2f')]=_0x41dbb0['filename'];logger[_0x6b96('0x26')](_0x41dbb0[_0x6b96('0x22')],_0x6b96('0x30'));}};Fax[_0x6b96('0x1e')][_0x6b96('0x1a')]=function(_0x127ee2){var _0x5bd4c2=this;if(this[_0x6b96('0xf')][_0x127ee2[_0x6b96('0x22')]]){var _0x2940d7=this['channels'][_0x127ee2[_0x6b96('0x22')]]['id'];this[_0x6b96('0xf')][_0x127ee2[_0x6b96('0x22')]][_0x6b96('0x31')]=_0x127ee2[_0x6b96('0x31')];this[_0x6b96('0xf')][_0x127ee2[_0x6b96('0x22')]][_0x6b96('0x32')]=_0x127ee2[_0x6b96('0x32')];this['channels'][_0x127ee2['uniqueid']][_0x6b96('0x21')]=_0x127ee2[_0x6b96('0x21')];this['channels'][_0x127ee2[_0x6b96('0x22')]][_0x6b96('0x33')]=_0x127ee2[_0x6b96('0x33')];this[_0x6b96('0xf')][_0x127ee2['uniqueid']]['transferrate']=_0x127ee2[_0x6b96('0x34')];this[_0x6b96('0xf')][_0x127ee2['uniqueid']][_0x6b96('0x2f')]=_0x127ee2['filename'];this[_0x6b96('0xf')][_0x127ee2['uniqueid']][_0x6b96('0x35')]=_0x127ee2['calleridnum'];if(this[_0x6b96('0xf')][_0x127ee2[_0x6b96('0x22')]][_0x6b96('0x32')]>0x0){tiff2pdf(_0x127ee2[_0x6b96('0x2f')],'/var/opt/motion2/server/files/attachments/',function(_0x5d2a14){logger['info'](_0x127ee2[_0x6b96('0x22')],_0x6b96('0x36'),_0x5d2a14[_0x6b96('0x37')]);attachment['create']({'name':path['parse'](_0x127ee2['filename'])['name'],'basename':path['parse'](_0x127ee2[_0x6b96('0x2f')])[_0x6b96('0x24')]+'.pdf','type':_0x6b96('0x38')})[_0x6b96('0x39')](function(_0x23a3f0){faxAccount['notify'](_0x2940d7,{'from':_0x127ee2[_0x6b96('0x35')],'mapKey':_0x6b96('0x3a'),'body':path['parse'](_0x127ee2[_0x6b96('0x2f')])[_0x6b96('0x24')]+_0x6b96('0x3b'),'AttachmentId':_0x23a3f0['id']})[_0x6b96('0x3c')](function(_0x460f5b){logger['error'](_0x127ee2[_0x6b96('0x22')],_0x6b96('0x3d'),JSON[_0x6b96('0x3e')](_0x460f5b));});})[_0x6b96('0x3c')](function(_0x41d136){logger[_0x6b96('0x3f')](_0x127ee2['uniqueid'],'\x20receiveFax\x20',JSON[_0x6b96('0x3e')](_0x41d136));});});}logger[_0x6b96('0x26')](_0x127ee2['uniqueid'],'\x20receiveFax\x20');}};Fax[_0x6b96('0x1e')][_0x6b96('0x1d')]=function(_0x43398d){if(this[_0x6b96('0x25')][_0x43398d[_0x6b96('0x22')]]){_[_0x6b96('0x40')](this[_0x6b96('0xf')][_0x43398d['uniqueid']],_['pick'](_0x43398d,['response',_0x6b96('0x41')]));}};function updateStatus(_0x3ea74d){if(_0x3ea74d['AttachmentId']){faxMessage[_0x6b96('0x42')](_0x3ea74d[_0x6b96('0x43')],{'failMessage':_0x6b96('0x44')})['then'](function(_0x44de1f){ut[_0x6b96('0x45')](_0x6b96('0x46'),_0x44de1f);})[_0x6b96('0x3c')](function(_0x1e3025){ut['logger'](_0x6b96('0x47'),_0x1e3025);});}else{ut['logger'](_0x6b96('0x48'));}}Fax['prototype']['updateStatus']=function(_0x72b118,_0x3140e2,_0x33db4c){var _0x70ce8a=this;var _0x5e3c77={};if(_0x3140e2){_0x5e3c77={'read':_0x3140e2};}else{_0x5e3c77={'failMessage':_0x33db4c};}if(this[_0x6b96('0x25')][_0x72b118][_0x6b96('0x43')]){faxMessage[_0x6b96('0x42')](this[_0x6b96('0x25')][_0x72b118][_0x6b96('0x43')],_0x5e3c77)['then'](function(_0x12cdfd){ut[_0x6b96('0x45')](_0x6b96('0x49'),_0x12cdfd);})[_0x6b96('0x3c')](function(_0x432e81){ut[_0x6b96('0x45')](_0x6b96('0x4a'),_0x432e81);})[_0x6b96('0x4b')](function(){delete _0x70ce8a['channels'][_0x72b118];delete _0x70ce8a[_0x6b96('0x25')][_0x72b118];});}else{ut[_0x6b96('0x45')](_0x6b96('0x4c'));delete this[_0x6b96('0xf')][_0x72b118];delete this[_0x6b96('0x25')][_0x72b118];}};Fax[_0x6b96('0x1e')][_0x6b96('0x1c')]=function(_0x382000){var _0x441f15=this;if(this[_0x6b96('0xf')][_0x382000[_0x6b96('0x22')]]){if(this[_0x6b96('0x25')][_0x382000[_0x6b96('0x22')]]){this[_0x6b96('0xf')][_0x382000[_0x6b96('0x22')]]['id']=this[_0x6b96('0x25')][_0x382000[_0x6b96('0x22')]]['id'];this[_0x6b96('0xf')][_0x382000['uniqueid']]['name']=this[_0x6b96('0x25')][_0x382000[_0x6b96('0x22')]][_0x6b96('0x24')];}logger['info'](_0x382000[_0x6b96('0x22')],this[_0x6b96('0x25')][_0x382000[_0x6b96('0x22')]]?_0x6b96('0x4d'):_0x6b96('0x4e'),JSON[_0x6b96('0x3e')](this[_0x6b96('0xf')][_0x382000['uniqueid']]));if(this['actions'][_0x382000['uniqueid']]){if(this[_0x6b96('0xf')][_0x382000[_0x6b96('0x22')]]['faxpages']>0x0&&this[_0x6b96('0xf')][_0x382000[_0x6b96('0x22')]][_0x6b96('0x4f')]===_0x6b96('0x50')){this[_0x6b96('0x51')](_0x382000['uniqueid'],!![]);}else{this[_0x6b96('0x51')](_0x382000[_0x6b96('0x22')],![],this[_0x6b96('0xf')][_0x382000[_0x6b96('0x22')]][_0x6b96('0x52')]?_0x6b96('0x53')+this[_0x6b96('0xf')][_0x382000['uniqueid']][_0x6b96('0x52')]:'SENDING\x20FAILED');}}}};Fax[_0x6b96('0x1e')][_0x6b96('0x54')]=function(_0x2217d6){var _0x4b0c7c=this;return new BPromise(function(_0x1429b8,_0x3d0a3a){_0x4b0c7c['execOriginate'](_0x2217d6,_0x4b0c7c[_0x6b96('0x10')][_0x2217d6[_0x6b96('0x55')]])['then'](function(_0x8b2312){ut[_0x6b96('0x45')](_0x6b96('0x56'),_0x8b2312);_0x1429b8(ut[_0x6b96('0x37')](_0x6b96('0x57')));})[_0x6b96('0x3c')](function(_0x1ef1dc){ut[_0x6b96('0x45')](_0x6b96('0x58'),_0x1ef1dc);updateStatus(_0x2217d6);_0x3d0a3a(ut[_0x6b96('0x37')](_0x6b96('0x59')));});});};Fax['prototype']['checkAfterSend']=function(_0x258d58){var _0x4b9886=this;return new BPromise(function(_0x5190d1,_0x3d9789){var _0x24e879=_0x4b9886[_0x6b96('0x5a')](_0x4b9886[_0x6b96('0x10')][_0x258d58[_0x6b96('0x55')]]['Trunk'],_0x258d58);if(_0x24e879[_0x6b96('0x5b')]){_0x5190d1(ut[_0x6b96('0x37')](_0x6b96('0x5c')));}else{_0x3d9789(ut[_0x6b96('0x37')](_0x24e879[_0x6b96('0x37')]));}});};function originate(_0x41974f,_0x12d7b4,_0x4b13b8){return new BPromise(function(_0x3bc335,_0x1bc865){if(_0x4b13b8){var _0xed9261=util[_0x6b96('0x5d')](_0x6b96('0x5e'),path[_0x6b96('0x5f')](_0x41974f[_0x6b96('0x5')])['name'],_0x41974f[_0x6b96('0x5')]);gs[_0x6b96('0x60')](_0xed9261)[_0x6b96('0x39')](function(){_0x41974f[_0x6b96('0x5')]=util['format'](_0x6b96('0x61'),path['parse'](_0x41974f['path'])[_0x6b96('0x62')],path['parse'](_0x41974f[_0x6b96('0x5')])['name']);_0x12d7b4[_0x6b96('0x63')]=_0x41974f[_0x6b96('0x5')];ut[_0x6b96('0x45')]('Convert\x20pdf\x20to\x20tif','');ami[_0x6b96('0x64')](ut[_0x6b96('0x65')](_0x41974f,_0x12d7b4))[_0x6b96('0x39')](function(_0x4df3ef){_0x3bc335(_0x4df3ef);})['catch'](function(_0x1301dd){_0x1bc865(_0x1301dd);});})[_0x6b96('0x3c')](function(_0x1fcef5){_0x1bc865(_0x1fcef5);});}else{ami[_0x6b96('0x64')](ut[_0x6b96('0x65')](_0x41974f,_0x12d7b4))[_0x6b96('0x39')](function(_0x4858e2){_0x3bc335(_0x4858e2);})['catch'](function(_0x38a164){_0x1bc865(_0x38a164);});}});}Fax[_0x6b96('0x1e')][_0x6b96('0x66')]=function(_0x5526ea,_0x4075c9){var _0x3f394b=this;return new BPromise(function(_0x598f81,_0x18b34b){var _0x5d3e70=uuid['v4']();var _0x4321d5=ut[_0x6b96('0x67')](_0x5526ea,_0x4075c9);_0x3f394b['actions'][_0x5d3e70]=new Action(_0x5d3e70,_0x4075c9,_0x5526ea);var _0x487dcc=_0x3f394b[_0x6b96('0x25')][_0x5d3e70];if(path[_0x6b96('0x5f')](_0x5526ea[_0x6b96('0x5')])[_0x6b96('0x68')]===_0x6b96('0x3b')){originate(_0x487dcc,_0x4321d5,!![])[_0x6b96('0x39')](function(_0x2086f2){_0x598f81(_0x2086f2);})['catch'](function(_0x5351be){_0x18b34b(_0x5351be);});}else{originate(_0x487dcc,_0x4321d5,![])['then'](function(_0x33fba6){_0x598f81(_0x33fba6);})[_0x6b96('0x3c')](function(_0xf9b421){_0x18b34b(_0xf9b421);});}});};Fax[_0x6b96('0x1e')][_0x6b96('0x69')]=function(_0x4a5b60){return!_[_0x6b96('0x6a')](_0x4a5b60)&&!_['isNil'](_0x4a5b60[_0x6b96('0x24')])&&!_[_0x6b96('0x6a')](_0x4a5b60['active'])&&_0x4a5b60[_0x6b96('0x6b')]&&!_['isNil'](this[_0x6b96('0x11')][util[_0x6b96('0x5d')](_0x6b96('0x6c'),_0x4a5b60['name'])])&&!_[_0x6b96('0x6a')](this[_0x6b96('0x11')][util[_0x6b96('0x5d')](_0x6b96('0x6c'),_0x4a5b60[_0x6b96('0x24')])]['status'])&&(this['trunks'][util[_0x6b96('0x5d')](_0x6b96('0x6c'),_0x4a5b60[_0x6b96('0x24')])]['status']===_0x6b96('0x6d')||this['trunks'][util[_0x6b96('0x5d')]('SIP/%s',_0x4a5b60[_0x6b96('0x24')])][_0x6b96('0x2e')]===_0x6b96('0x6e'));};Fax['prototype'][_0x6b96('0x5a')]=function(_0xd4f20d,_0x58aff8){if(!this[_0x6b96('0x69')](_0xd4f20d)){ut['logger'](_0x6b96('0x6f'),_['isNil'](_0xd4f20d)?'':_0xd4f20d[_0x6b96('0x24')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x6b96('0x70')};}if(_['isNil'](_0x58aff8['fax'])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x6b96('0x3e')](_0x58aff8));return{'isValid':![],'message':_0x6b96('0x71')};}if(_[_0x6b96('0x6a')](_0x58aff8[_0x6b96('0x5')])){ut[_0x6b96('0x45')](_0x6b96('0x72'),JSON['stringify'](_0x58aff8));return{'isValid':![],'message':_0x6b96('0x73')};}return{'isValid':!![],'message':_0x6b96('0x74')};};module[_0x6b96('0x75')]=Fax; \ No newline at end of file +var _0xebf5=['../ami','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','bind','varset','syncVarSet','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','fax','catch','error','stringify','\x20receiveFax\x20','merge','response','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','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','execute','format','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','unmonitored','checkTrunk','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','exports','util','lodash','bluebird','uuid','moment','path','../../../config/logger'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xebf5,0x1cd));var _0x5ebf=function(_0x541a6c,_0x2e4bf9){_0x541a6c=_0x541a6c-0x0;var _0x3d559d=_0xebf5[_0x541a6c];return _0x3d559d;};'use strict';var util=require(_0x5ebf('0x0'));var _=require(_0x5ebf('0x1'));var BPromise=require(_0x5ebf('0x2'));var uuid=require(_0x5ebf('0x3'));var moment=require(_0x5ebf('0x4'));var path=require(_0x5ebf('0x5'));var tiff2pdf=require('tiff2pdf');var gs=require('./util/gs');var logger=require(_0x5ebf('0x6'))('fax');var ami=require(_0x5ebf('0x7'));var rpcDb=require(_0x5ebf('0x8'));var Channel=require(_0x5ebf('0x9'));var ut=require('./util/util');var Action=require(_0x5ebf('0xa'));var faxAccount=require(_0x5ebf('0xb'));var attachment=require(_0x5ebf('0xc'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x1b9b05){this[_0x5ebf('0xd')]={};this[_0x5ebf('0xe')]=_0x1b9b05[_0x5ebf('0xe')];this[_0x5ebf('0xf')]=_0x1b9b05[_0x5ebf('0xf')];this[_0x5ebf('0x10')]={};ami['on'](_0x5ebf('0x11'),this['syncNewchannel'][_0x5ebf('0x12')](this));ami['on'](_0x5ebf('0x13'),this[_0x5ebf('0x14')][_0x5ebf('0x12')](this));ami['on']('newstate',this['syncNewState'][_0x5ebf('0x12')](this));ami['on'](_0x5ebf('0x15'),this[_0x5ebf('0x16')]['bind'](this));ami['on'](_0x5ebf('0x17'),this[_0x5ebf('0x18')][_0x5ebf('0x12')](this));ami['on'](_0x5ebf('0x19'),this[_0x5ebf('0x1a')][_0x5ebf('0x12')](this));ami['on'](_0x5ebf('0x1b'),this[_0x5ebf('0x1c')][_0x5ebf('0x12')](this));ami['on'](_0x5ebf('0x1d'),this[_0x5ebf('0x1e')][_0x5ebf('0x12')](this));}Fax[_0x5ebf('0x1f')]['syncNewchannel']=function(_0x5cb606){if(_0x5cb606[_0x5ebf('0x20')]===_0x5ebf('0x21')){for(var _0x1769bc in this[_0x5ebf('0xe')]){if(this[_0x5ebf('0xe')][_0x5ebf('0x22')](_0x1769bc)){if(_0x5cb606[_0x5ebf('0x23')]===this['faxAccounts'][_0x1769bc][_0x5ebf('0x24')]){this['channels'][_0x5cb606[_0x5ebf('0x25')]]={};this[_0x5ebf('0xd')][_0x5cb606[_0x5ebf('0x25')]][_0x5ebf('0x26')]=_0x5cb606[_0x5ebf('0x26')];this['channels'][_0x5cb606[_0x5ebf('0x25')]]['id']=this['faxAccounts'][_0x1769bc]['id'];this[_0x5ebf('0xd')][_0x5cb606[_0x5ebf('0x25')]]['name']=this['faxAccounts'][_0x1769bc][_0x5ebf('0x27')];logger[_0x5ebf('0x28')](_0x5cb606['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this[_0x5ebf('0x10')][_0x5cb606[_0x5ebf('0x25')]]){this['channels'][_0x5cb606[_0x5ebf('0x25')]]={};this[_0x5ebf('0xd')][_0x5cb606[_0x5ebf('0x25')]]['channel']=_0x5cb606[_0x5ebf('0x26')];logger[_0x5ebf('0x28')](_0x5cb606[_0x5ebf('0x25')],_0x5ebf('0x29'));}};Fax[_0x5ebf('0x1f')][_0x5ebf('0x14')]=function(_0x458c42){if(this['channels'][_0x458c42[_0x5ebf('0x25')]]){for(var _0x1e055f in _0x458c42[_0x5ebf('0x2a')]){if(_0x458c42[_0x5ebf('0x2a')][_0x5ebf('0x22')](_0x1e055f)){this[_0x5ebf('0xd')][_0x458c42[_0x5ebf('0x25')]][_0x1e055f]=_0x458c42[_0x5ebf('0x2b')];}}}};Fax['prototype']['syncNewState']=function(_0x506239){if(this['channels'][_0x506239[_0x5ebf('0x25')]]){this['channels'][_0x506239['uniqueid']][_0x5ebf('0x2c')]=_0x506239[_0x5ebf('0x2c')];this[_0x5ebf('0xd')][_0x506239[_0x5ebf('0x25')]][_0x5ebf('0x2d')]=_0x506239['channelstatedesc'];}};Fax['prototype'][_0x5ebf('0x16')]=function(_0x2b2bc8){if(this[_0x5ebf('0xd')][_0x2b2bc8[_0x5ebf('0x25')]]){for(var _0x38072a in _0x2b2bc8['variable']){if(_0x2b2bc8[_0x5ebf('0x2a')][_0x5ebf('0x22')](_0x38072a)){this[_0x5ebf('0xd')][_0x2b2bc8[_0x5ebf('0x25')]][_0x38072a]=_0x2b2bc8[_0x5ebf('0x2b')];}}}};Fax[_0x5ebf('0x1f')][_0x5ebf('0x18')]=function(_0x1d23fa){if(this[_0x5ebf('0xd')][_0x1d23fa[_0x5ebf('0x25')]]){this[_0x5ebf('0xd')][_0x1d23fa[_0x5ebf('0x25')]][_0x5ebf('0x2e')]=_0x1d23fa['operation'];this[_0x5ebf('0xd')][_0x1d23fa[_0x5ebf('0x25')]][_0x5ebf('0x2f')]=_0x1d23fa[_0x5ebf('0x2f')];this['channels'][_0x1d23fa[_0x5ebf('0x25')]][_0x5ebf('0x24')]=_0x1d23fa[_0x5ebf('0x24')];this[_0x5ebf('0xd')][_0x1d23fa['uniqueid']][_0x5ebf('0x30')]=_0x1d23fa['filename'];logger[_0x5ebf('0x28')](_0x1d23fa[_0x5ebf('0x25')],'\x20syncFaxStatus\x20');}};Fax[_0x5ebf('0x1f')]['syncReceiveFax']=function(_0x59a754){var _0x5582a=this;if(this[_0x5ebf('0xd')][_0x59a754[_0x5ebf('0x25')]]){var _0x4a00ac=this['channels'][_0x59a754[_0x5ebf('0x25')]]['id'];this[_0x5ebf('0xd')][_0x59a754['uniqueid']][_0x5ebf('0x31')]=_0x59a754[_0x5ebf('0x31')];this[_0x5ebf('0xd')][_0x59a754[_0x5ebf('0x25')]][_0x5ebf('0x32')]=_0x59a754[_0x5ebf('0x32')];this['channels'][_0x59a754[_0x5ebf('0x25')]][_0x5ebf('0x24')]=_0x59a754['localstationid'];this['channels'][_0x59a754[_0x5ebf('0x25')]]['resolution']=_0x59a754[_0x5ebf('0x33')];this[_0x5ebf('0xd')][_0x59a754[_0x5ebf('0x25')]][_0x5ebf('0x34')]=_0x59a754[_0x5ebf('0x34')];this[_0x5ebf('0xd')][_0x59a754[_0x5ebf('0x25')]][_0x5ebf('0x30')]=_0x59a754[_0x5ebf('0x30')];this[_0x5ebf('0xd')][_0x59a754[_0x5ebf('0x25')]][_0x5ebf('0x35')]=_0x59a754[_0x5ebf('0x35')];if(this[_0x5ebf('0xd')][_0x59a754[_0x5ebf('0x25')]][_0x5ebf('0x32')]>0x0){tiff2pdf(_0x59a754['filename'],'/var/opt/motion2/server/files/attachments/',function(_0x5b88de){logger[_0x5ebf('0x28')](_0x59a754['uniqueid'],_0x5ebf('0x36'),_0x5b88de[_0x5ebf('0x37')]);attachment[_0x5ebf('0x38')]({'name':path[_0x5ebf('0x39')](_0x59a754[_0x5ebf('0x30')])[_0x5ebf('0x27')],'basename':path[_0x5ebf('0x39')](_0x59a754[_0x5ebf('0x30')])[_0x5ebf('0x27')]+_0x5ebf('0x3a'),'type':_0x5ebf('0x3b')})[_0x5ebf('0x3c')](function(_0x3de3cf){faxAccount['notify'](_0x4a00ac,{'from':_0x59a754[_0x5ebf('0x35')],'mapKey':_0x5ebf('0x3d'),'body':path[_0x5ebf('0x39')](_0x59a754['filename'])[_0x5ebf('0x27')]+'.pdf','AttachmentId':_0x3de3cf['id']})[_0x5ebf('0x3e')](function(_0x512b00){logger[_0x5ebf('0x3f')](_0x59a754[_0x5ebf('0x25')],'\x20notify\x20',JSON['stringify'](_0x512b00));});})[_0x5ebf('0x3e')](function(_0x451188){logger['error'](_0x59a754[_0x5ebf('0x25')],'\x20receiveFax\x20',JSON[_0x5ebf('0x40')](_0x451188));});});}logger[_0x5ebf('0x28')](_0x59a754[_0x5ebf('0x25')],_0x5ebf('0x41'));}};Fax[_0x5ebf('0x1f')]['syncOriginateResponse']=function(_0x1260ad){if(this[_0x5ebf('0x10')][_0x1260ad['uniqueid']]){_[_0x5ebf('0x42')](this[_0x5ebf('0xd')][_0x1260ad[_0x5ebf('0x25')]],_['pick'](_0x1260ad,[_0x5ebf('0x43'),_0x5ebf('0x44')]));}};function updateStatus(_0x4ce415){if(_0x4ce415[_0x5ebf('0x45')]){faxMessage['update'](_0x4ce415[_0x5ebf('0x45')],{'failMessage':_0x5ebf('0x46')})[_0x5ebf('0x3c')](function(_0x49eeed){ut[_0x5ebf('0x47')](_0x5ebf('0x48'),_0x49eeed);})[_0x5ebf('0x3e')](function(_0x40e486){ut[_0x5ebf('0x47')](_0x5ebf('0x49'),_0x40e486);});}else{ut[_0x5ebf('0x47')](_0x5ebf('0x4a'));}}Fax['prototype'][_0x5ebf('0x4b')]=function(_0x11a9cb,_0x3727a6,_0x4332b2){var _0x59bc93=this;var _0x5a7780={};if(_0x3727a6){_0x5a7780={'read':_0x3727a6};}else{_0x5a7780={'failMessage':_0x4332b2};}if(this[_0x5ebf('0x10')][_0x11a9cb][_0x5ebf('0x45')]){faxMessage[_0x5ebf('0x4c')](this[_0x5ebf('0x10')][_0x11a9cb][_0x5ebf('0x45')],_0x5a7780)[_0x5ebf('0x3c')](function(_0x240c22){ut['logger'](_0x5ebf('0x4d'),_0x240c22);})[_0x5ebf('0x3e')](function(_0x1bcb20){ut[_0x5ebf('0x47')](_0x5ebf('0x4e'),_0x1bcb20);})[_0x5ebf('0x4f')](function(){delete _0x59bc93[_0x5ebf('0xd')][_0x11a9cb];delete _0x59bc93[_0x5ebf('0x10')][_0x11a9cb];});}else{ut[_0x5ebf('0x47')](_0x5ebf('0x50'));delete this[_0x5ebf('0xd')][_0x11a9cb];delete this[_0x5ebf('0x10')][_0x11a9cb];}};Fax[_0x5ebf('0x1f')][_0x5ebf('0x1c')]=function(_0x55d6fc){var _0x4dfad6=this;if(this[_0x5ebf('0xd')][_0x55d6fc[_0x5ebf('0x25')]]){if(this['actions'][_0x55d6fc['uniqueid']]){this['channels'][_0x55d6fc[_0x5ebf('0x25')]]['id']=this['actions'][_0x55d6fc['uniqueid']]['id'];this[_0x5ebf('0xd')][_0x55d6fc[_0x5ebf('0x25')]][_0x5ebf('0x27')]=this[_0x5ebf('0x10')][_0x55d6fc[_0x5ebf('0x25')]][_0x5ebf('0x27')];}logger['info'](_0x55d6fc['uniqueid'],this['actions'][_0x55d6fc[_0x5ebf('0x25')]]?_0x5ebf('0x51'):_0x5ebf('0x52'),JSON[_0x5ebf('0x40')](this['channels'][_0x55d6fc[_0x5ebf('0x25')]]));if(this[_0x5ebf('0x10')][_0x55d6fc[_0x5ebf('0x25')]]){if(this[_0x5ebf('0xd')][_0x55d6fc[_0x5ebf('0x25')]]['faxpages']>0x0&&this[_0x5ebf('0xd')][_0x55d6fc[_0x5ebf('0x25')]]['faxstatus']==='SUCCESS'){this[_0x5ebf('0x4b')](_0x55d6fc[_0x5ebf('0x25')],!![]);}else{this['updateStatus'](_0x55d6fc[_0x5ebf('0x25')],![],this[_0x5ebf('0xd')][_0x55d6fc['uniqueid']][_0x5ebf('0x53')]?_0x5ebf('0x54')+this[_0x5ebf('0xd')][_0x55d6fc['uniqueid']][_0x5ebf('0x53')]:_0x5ebf('0x55'));}}}};Fax['prototype']['send']=function(_0x24e24c){var _0x5e8e3a=this;return new BPromise(function(_0x9be9e8,_0x242e89){_0x5e8e3a[_0x5ebf('0x56')](_0x24e24c,_0x5e8e3a[_0x5ebf('0xe')][_0x24e24c[_0x5ebf('0x57')]])[_0x5ebf('0x3c')](function(_0x299b78){ut[_0x5ebf('0x47')]('[Fax][execOriginate][success]',_0x299b78);_0x9be9e8(ut[_0x5ebf('0x37')]('Fax\x20received'));})[_0x5ebf('0x3e')](function(_0x1868cc){ut[_0x5ebf('0x47')](_0x5ebf('0x58'),_0x1868cc);updateStatus(_0x24e24c);_0x242e89(ut[_0x5ebf('0x37')](_0x5ebf('0x59')));});});};Fax[_0x5ebf('0x1f')][_0x5ebf('0x5a')]=function(_0x558063){var _0x4f7cdc=this;return new BPromise(function(_0xec98c1,_0x8c5e5){var _0x44c1a5=_0x4f7cdc['checkTrunk'](_0x4f7cdc['faxAccounts'][_0x558063[_0x5ebf('0x57')]][_0x5ebf('0x5b')],_0x558063);if(_0x44c1a5[_0x5ebf('0x5c')]){_0xec98c1(ut[_0x5ebf('0x37')](_0x5ebf('0x5d')));}else{_0x8c5e5(ut[_0x5ebf('0x37')](_0x44c1a5[_0x5ebf('0x37')]));}});};function originate(_0x1b5b80,_0x2247e5,_0x1b7715){return new BPromise(function(_0x5292a1,_0x45ce75){if(_0x1b7715){var _0x5deead=util['format'](_0x5ebf('0x5e'),path['parse'](_0x1b5b80[_0x5ebf('0x5')])[_0x5ebf('0x27')],_0x1b5b80['path']);gs[_0x5ebf('0x5f')](_0x5deead)[_0x5ebf('0x3c')](function(){_0x1b5b80['path']=util[_0x5ebf('0x60')](_0x5ebf('0x61'),path[_0x5ebf('0x39')](_0x1b5b80[_0x5ebf('0x5')])[_0x5ebf('0x62')],path[_0x5ebf('0x39')](_0x1b5b80['path'])[_0x5ebf('0x27')]);_0x2247e5[_0x5ebf('0x63')]=_0x1b5b80[_0x5ebf('0x5')];ut[_0x5ebf('0x47')]('Convert\x20pdf\x20to\x20tif','');ami[_0x5ebf('0x64')](ut[_0x5ebf('0x65')](_0x1b5b80,_0x2247e5))['then'](function(_0x24bcdc){_0x5292a1(_0x24bcdc);})[_0x5ebf('0x3e')](function(_0x1e1910){_0x45ce75(_0x1e1910);});})[_0x5ebf('0x3e')](function(_0x27f6f2){_0x45ce75(_0x27f6f2);});}else{ami[_0x5ebf('0x64')](ut['variablesAction'](_0x1b5b80,_0x2247e5))['then'](function(_0x3df6ef){_0x5292a1(_0x3df6ef);})[_0x5ebf('0x3e')](function(_0x1dbc0d){_0x45ce75(_0x1dbc0d);});}});}Fax[_0x5ebf('0x1f')][_0x5ebf('0x56')]=function(_0x8711d9,_0x5204b8){var _0x155003=this;return new BPromise(function(_0x5adca6,_0x32e640){var _0x2bde5e=uuid['v4']();var _0x22a692=ut[_0x5ebf('0x66')](_0x8711d9,_0x5204b8);_0x155003['actions'][_0x2bde5e]=new Action(_0x2bde5e,_0x5204b8,_0x8711d9);var _0x50e026=_0x155003[_0x5ebf('0x10')][_0x2bde5e];if(path[_0x5ebf('0x39')](_0x8711d9['path'])[_0x5ebf('0x67')]===_0x5ebf('0x3a')){originate(_0x50e026,_0x22a692,!![])[_0x5ebf('0x3c')](function(_0x1bda58){_0x5adca6(_0x1bda58);})[_0x5ebf('0x3e')](function(_0x517fc3){_0x32e640(_0x517fc3);});}else{originate(_0x50e026,_0x22a692,![])[_0x5ebf('0x3c')](function(_0x31eef3){_0x5adca6(_0x31eef3);})[_0x5ebf('0x3e')](function(_0x3cd008){_0x32e640(_0x3cd008);});}});};Fax[_0x5ebf('0x1f')]['isTrunkReachable']=function(_0x33c02c){return!_[_0x5ebf('0x68')](_0x33c02c)&&!_[_0x5ebf('0x68')](_0x33c02c[_0x5ebf('0x27')])&&!_['isNil'](_0x33c02c[_0x5ebf('0x69')])&&_0x33c02c[_0x5ebf('0x69')]&&!_['isNil'](this['trunks'][util[_0x5ebf('0x60')](_0x5ebf('0x6a'),_0x33c02c[_0x5ebf('0x27')])])&&!_[_0x5ebf('0x68')](this['trunks'][util[_0x5ebf('0x60')](_0x5ebf('0x6a'),_0x33c02c[_0x5ebf('0x27')])]['status'])&&(this[_0x5ebf('0xf')][util[_0x5ebf('0x60')]('SIP/%s',_0x33c02c[_0x5ebf('0x27')])][_0x5ebf('0x2f')]==='reachable'||this[_0x5ebf('0xf')][util[_0x5ebf('0x60')](_0x5ebf('0x6a'),_0x33c02c[_0x5ebf('0x27')])][_0x5ebf('0x2f')]===_0x5ebf('0x6b'));};Fax[_0x5ebf('0x1f')][_0x5ebf('0x6c')]=function(_0x3fc906,_0x4ce1bb){if(!this[_0x5ebf('0x6d')](_0x3fc906)){ut['logger'](_0x5ebf('0x6e'),_[_0x5ebf('0x68')](_0x3fc906)?'':_0x3fc906[_0x5ebf('0x27')]+_0x5ebf('0x6f'));return{'isValid':![],'message':_0x5ebf('0x70')};}if(_[_0x5ebf('0x68')](_0x4ce1bb['fax'])){ut[_0x5ebf('0x47')](_0x5ebf('0x71'),JSON[_0x5ebf('0x40')](_0x4ce1bb));return{'isValid':![],'message':_0x5ebf('0x72')};}if(_['isNil'](_0x4ce1bb[_0x5ebf('0x5')])){ut[_0x5ebf('0x47')](_0x5ebf('0x73'),JSON[_0x5ebf('0x40')](_0x4ce1bb));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x5ebf('0x74')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 14515c1..f2e47d4 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 _0x0ea2=['util','bluebird','../../../config/logger','preview','lodash','error','inspect','notify','resolve','then','[Notify]\x20'];(function(_0x9df3d8,_0x4074e3){var _0x366da1=function(_0x5af940){while(--_0x5af940){_0x9df3d8['push'](_0x9df3d8['shift']());}};_0x366da1(++_0x4074e3);}(_0x0ea2,0x1e4));var _0x20ea=function(_0x27d006,_0x1f6758){_0x27d006=_0x27d006-0x0;var _0x320505=_0x0ea2[_0x27d006];return _0x320505;};'use strict';var util=require(_0x20ea('0x0'));var BPromise=require(_0x20ea('0x1'));var logger=require(_0x20ea('0x2'))(_0x20ea('0x3'));var _=require(_0x20ea('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0xb7cf4){return function(_0x25ccae){logger[_0x20ea('0x5')](_0xb7cf4,util[_0x20ea('0x6')](_0x25ccae,{'showHidden':![],'depth':null}));};}exports[_0x20ea('0x7')]=function(_0x5dd891,_0x4feaae){return BPromise[_0x20ea('0x8')]()[_0x20ea('0x9')](faxAccount[_0x20ea('0x7')](_0x5dd891,_0x4feaae))['catch'](loggerCatch(_0x20ea('0xa')));}; \ No newline at end of file +var _0x83be=['../rpc/faxAccount','error','inspect','notify','catch','[Notify]\x20','util','../../../config/logger','lodash'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x83be,0xc3));var _0xe83b=function(_0x4b21de,_0x2270bc){_0x4b21de=_0x4b21de-0x0;var _0x607a44=_0x83be[_0x4b21de];return _0x607a44;};'use strict';var util=require(_0xe83b('0x0'));var BPromise=require('bluebird');var logger=require(_0xe83b('0x1'))('preview');var _=require(_0xe83b('0x2'));var faxAccount=require(_0xe83b('0x3'));function loggerCatch(_0x5ba170){return function(_0x17663f){logger[_0xe83b('0x4')](_0x5ba170,util[_0xe83b('0x5')](_0x17663f,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x55f742,_0x5484c5){return BPromise['resolve']()['then'](faxAccount[_0xe83b('0x6')](_0x55f742,_0x5484c5))[_0xe83b('0x7')](loggerCatch(_0xe83b('0x8')));}; \ 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 7860903..35bc706 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 _0x3e34=['info','Exec\x20gs','\x20Error\x20:','util','../../../../config/logger','bluebird','child_process','exec','execute'];(function(_0x3c79c5,_0x30c6db){var _0x33ef2c=function(_0x20b6c1){while(--_0x20b6c1){_0x3c79c5['push'](_0x3c79c5['shift']());}};_0x33ef2c(++_0x30c6db);}(_0x3e34,0xe4));var _0x43e3=function(_0x99b7dd,_0x27130d){_0x99b7dd=_0x99b7dd-0x0;var _0xd14cb7=_0x3e34[_0x99b7dd];return _0xd14cb7;};'use strict';var util=require(_0x43e3('0x0'));var logger=require(_0x43e3('0x1'))('fax');var BPromise=require(_0x43e3('0x2'));var exec=require(_0x43e3('0x3'))[_0x43e3('0x4')];exports[_0x43e3('0x5')]=function(_0xb0a075){return new BPromise(function(_0x369735,_0x5ce70b){exec(_0xb0a075,function(_0x9bca45,_0x194576,_0x458624){logger[_0x43e3('0x6')](_0x43e3('0x7'),_0x194576);if(_0x9bca45){logger[_0x43e3('0x6')](_0x43e3('0x7'),_0x43e3('0x8'),util['inspect'](_0x9bca45,{'showHidden':![],'depth':null}),_0x194576,_0x458624);_0x5ce70b(_0x9bca45);}_0x369735(_0x194576);});});}; \ No newline at end of file +var _0xd5f8=['../../../../config/logger','fax','bluebird','child_process','exec','execute','info','Exec\x20gs','util'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xd5f8,0x1af));var _0x8d5f=function(_0x5dcb66,_0x406554){_0x5dcb66=_0x5dcb66-0x0;var _0x47a10d=_0xd5f8[_0x5dcb66];return _0x47a10d;};'use strict';var util=require(_0x8d5f('0x0'));var logger=require(_0x8d5f('0x1'))(_0x8d5f('0x2'));var BPromise=require(_0x8d5f('0x3'));var exec=require(_0x8d5f('0x4'))[_0x8d5f('0x5')];exports[_0x8d5f('0x6')]=function(_0x53294f){return new BPromise(function(_0x7982f0,_0x2705e8){exec(_0x53294f,function(_0x5c636b,_0x53d9f4,_0x52638f){logger[_0x8d5f('0x7')](_0x8d5f('0x8'),_0x53d9f4);if(_0x5c636b){logger[_0x8d5f('0x7')](_0x8d5f('0x8'),'\x20Error\x20:',util['inspect'](_0x5c636b,{'showHidden':![],'depth':null}),_0x53d9f4,_0x52638f);_0x2705e8(_0x5c636b);}_0x7982f0(_0x53d9f4);});});}; \ 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 64a9df2..44db32a 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 _0xa167=['lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','minrate','format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','uniqueid','channel','xcally-motion-fax','from-sip','headerinfo','util'];(function(_0x19dab9,_0xefbe5c){var _0x36a1bf=function(_0x523139){while(--_0x523139){_0x19dab9['push'](_0x19dab9['shift']());}};_0x36a1bf(++_0xefbe5c);}(_0xa167,0xce));var _0x7a16=function(_0x1f5028,_0x12f611){_0x1f5028=_0x1f5028-0x0;var _0xc4ec53=_0xa167[_0x1f5028];return _0xc4ec53;};'use strict';var util=require(_0x7a16('0x0'));var _=require(_0x7a16('0x1'));var moment=require(_0x7a16('0x2'));var logger=require(_0x7a16('0x3'))(_0x7a16('0x4'));exports[_0x7a16('0x5')]=function(_0x17a2ca){return{'message':_0x17a2ca};};exports[_0x7a16('0x6')]=function(_0x2eeb5f,_0x3f3d52){logger[_0x7a16('0x7')](_0x2eeb5f,util[_0x7a16('0x8')](_0x3f3d52,{'showHidden':![],'depth':null}));};exports[_0x7a16('0x9')]=function(_0x5639f9,_0x173fd5){var _0x15c517={'XMF-ECM':_0x173fd5[_0x7a16('0xa')],'XMF-HEADERINFO':_0x173fd5['headerinfo'],'XMF-MINRATE':_0x173fd5[_0x7a16('0xb')],'XMF-MAXRATE':_0x173fd5['maxrate'],'XMF-MODEM':util[_0x7a16('0xc')](_0x7a16('0xd'),_0x173fd5['modem']),'XMF-GATEWAY':_0x173fd5[_0x7a16('0xe')],'XMF-FAXDETECT':_0x173fd5[_0x7a16('0xf')],'XMF-T38TIMEOUT':_0x173fd5[_0x7a16('0x10')],'XMF-LOCALSTATIONID':_0x173fd5[_0x7a16('0x11')],'XMF-PATH':_0x5639f9['path']};return _0x15c517;};exports['variablesAction']=function(_0x556048,_0x3b4a2a){return{'actionid':_0x556048[_0x7a16('0x12')],'action':'originate','channel':_0x556048[_0x7a16('0x13')],'Exten':_0x7a16('0x14'),'Context':_0x7a16('0x15'),'Priority':'1','callerid':util[_0x7a16('0xc')]('\x22%s\x22\x20<%s>',_0x556048[_0x7a16('0x16')]?_0x556048[_0x7a16('0x16')]:'',_0x556048['localstationid']),'variable':_0x3b4a2a,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x556048[_0x7a16('0x12')]};}; \ No newline at end of file +var _0xe533=['util','lodash','../../../../config/logger','message','logger','info','inspect','addVariables','ecm','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','xcally-motion-fax','\x22%s\x22\x20<%s>','headerinfo'];(function(_0x935703,_0x573b3d){var _0x23c364=function(_0x2a2fa0){while(--_0x2a2fa0){_0x935703['push'](_0x935703['shift']());}};_0x23c364(++_0x573b3d);}(_0xe533,0x113));var _0x3e53=function(_0x391d5e,_0x127dba){_0x391d5e=_0x391d5e-0x0;var _0x446ab0=_0xe533[_0x391d5e];return _0x446ab0;};'use strict';var util=require(_0x3e53('0x0'));var _=require(_0x3e53('0x1'));var moment=require('moment');var logger=require(_0x3e53('0x2'))('fax');exports[_0x3e53('0x3')]=function(_0x23f660){return{'message':_0x23f660};};exports[_0x3e53('0x4')]=function(_0x14f1f1,_0x2be8af){logger[_0x3e53('0x5')](_0x14f1f1,util[_0x3e53('0x6')](_0x2be8af,{'showHidden':![],'depth':null}));};exports[_0x3e53('0x7')]=function(_0x4550ec,_0x4b5250){var _0x1fb151={'XMF-ECM':_0x4b5250[_0x3e53('0x8')],'XMF-HEADERINFO':_0x4b5250['headerinfo'],'XMF-MINRATE':_0x4b5250[_0x3e53('0x9')],'XMF-MAXRATE':_0x4b5250[_0x3e53('0xa')],'XMF-MODEM':util[_0x3e53('0xb')](_0x3e53('0xc'),_0x4b5250[_0x3e53('0xd')]),'XMF-GATEWAY':_0x4b5250[_0x3e53('0xe')],'XMF-FAXDETECT':_0x4b5250[_0x3e53('0xf')],'XMF-T38TIMEOUT':_0x4b5250[_0x3e53('0x10')],'XMF-LOCALSTATIONID':_0x4b5250[_0x3e53('0x11')],'XMF-PATH':_0x4550ec[_0x3e53('0x12')]};return _0x1fb151;};exports[_0x3e53('0x13')]=function(_0x2427f9,_0x1fac27){return{'actionid':_0x2427f9[_0x3e53('0x14')],'action':_0x3e53('0x15'),'channel':_0x2427f9['channel'],'Exten':_0x3e53('0x16'),'Context':'from-sip','Priority':'1','callerid':util[_0x3e53('0xb')](_0x3e53('0x17'),_0x2427f9['headerinfo']?_0x2427f9[_0x3e53('0x18')]:'',_0x2427f9[_0x3e53('0x11')]),'variable':_0x1fac27,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2427f9['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index b341776..bc0c673 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 _0x5797=['get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','log','sync','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/campaign','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/servicenow','./rpc/integrations/dynamics365'];(function(_0x1f21e5,_0x3fc2ca){var _0xf59971=function(_0x511109){while(--_0x511109){_0x1f21e5['push'](_0x1f21e5['shift']());}};_0xf59971(++_0x3fc2ca);}(_0x5797,0x131));var _0x7579=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x5797[_0x199572];return _0x13cfa3;};'use strict';var BPromise=require(_0x7579('0x0'));var util=require(_0x7579('0x1'));var moment=require(_0x7579('0x2'));var server=require(_0x7579('0x3'));var Realtime=require(_0x7579('0x4'));var Report=require(_0x7579('0x5'));var Acw=require(_0x7579('0x6'));var Trigger=require(_0x7579('0x7'));var Dialer=require(_0x7579('0x8'));var Preview=require(_0x7579('0x9'));var Fax=require(_0x7579('0xa'));var user=require(_0x7579('0xb'));var voiceQueue=require(_0x7579('0xc'));var voiceQueueReport=require(_0x7579('0xd'));var voiceCallReport=require(_0x7579('0xe'));var trunk=require(_0x7579('0xf'));var trigger=require('./rpc/trigger');var template=require(_0x7579('0x10'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x7579('0x11'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require('./rpc/faxAccount');var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x7579('0x12'));var sugarcrm=require(_0x7579('0x13'));var freshdesk=require(_0x7579('0x14'));var desk=require(_0x7579('0x15'));var zoho=require(_0x7579('0x16'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x7579('0x17'));var dynamics365=require(_0x7579('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 isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x7579('0x19')](_0x7579('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x7579('0x1b')]()[_0x7579('0x1c')](user[_0x7579('0x1d')]())['then'](realtime[_0x7579('0x1e')]())['then'](user[_0x7579('0x1f')]())[_0x7579('0x1c')](realtime[_0x7579('0x20')]())[_0x7579('0x1c')](trunk[_0x7579('0x21')]())[_0x7579('0x1c')](realtime['initTrunks']())[_0x7579('0x1c')](voiceQueue[_0x7579('0x22')]())[_0x7579('0x1c')](realtime[_0x7579('0x23')]())[_0x7579('0x1c')](trigger['getTriggers']())[_0x7579('0x1c')](realtime[_0x7579('0x24')]())['then'](template['getTemplates']())['then'](realtime[_0x7579('0x25')]())[_0x7579('0x1c')](zendesk[_0x7579('0x26')]())[_0x7579('0x1c')](realtime[_0x7579('0x27')]())[_0x7579('0x1c')](salesforce['getSalesforceAccounts']())[_0x7579('0x1c')](realtime['initSalesforceAccounts']())[_0x7579('0x1c')](sugarcrm[_0x7579('0x28')]())[_0x7579('0x1c')](realtime[_0x7579('0x29')]())[_0x7579('0x1c')](freshdesk[_0x7579('0x2a')]())[_0x7579('0x1c')](realtime[_0x7579('0x2b')]())[_0x7579('0x1c')](desk[_0x7579('0x2c')]())['then'](realtime[_0x7579('0x2d')]())[_0x7579('0x1c')](zoho['getZohoAccounts']())[_0x7579('0x1c')](realtime[_0x7579('0x2e')]())[_0x7579('0x1c')](vtiger['getVtigerAccounts']())[_0x7579('0x1c')](realtime[_0x7579('0x2f')]())[_0x7579('0x1c')](freshsales['getFreshsalesAccounts']())[_0x7579('0x1c')](realtime[_0x7579('0x30')]())[_0x7579('0x1c')](servicenow[_0x7579('0x31')]())[_0x7579('0x1c')](realtime[_0x7579('0x32')]())['then'](dynamics365[_0x7579('0x33')]())[_0x7579('0x1c')](realtime[_0x7579('0x34')]())[_0x7579('0x1c')](campaign['getCampaigns']())[_0x7579('0x1c')](realtime[_0x7579('0x35')]())[_0x7579('0x1c')](voiceExtension[_0x7579('0x36')]())[_0x7579('0x1c')](realtime[_0x7579('0x37')]())[_0x7579('0x1c')](faxAccount[_0x7579('0x38')]())[_0x7579('0x1c')](realtime[_0x7579('0x39')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x7579('0x1b')]()[_0x7579('0x1c')](voiceQueueReport['getVoiceQueueReports']())[_0x7579('0x1c')](realtime[_0x7579('0x3a')]())[_0x7579('0x1c')](cmHopperHistory[_0x7579('0x3b')]())[_0x7579('0x1c')](realtime[_0x7579('0x3c')]())['then'](cmHopperHistory[_0x7579('0x3d')]())[_0x7579('0x1c')](realtime[_0x7579('0x3e')]())['then'](voiceCallReport[_0x7579('0x3f')]())['then'](realtime['initVoiceCallReports']())[_0x7579('0x1c')](function(_0x46090f){})['catch'](function(_0x29530e){console[_0x7579('0x40')](_0x29530e);});}function main(){return server['listen'](realtime,preview,fax)[_0x7579('0x1c')](function(_0x20c263){return initRealtime();})[_0x7579('0x1c')](function(){return initParams();})[_0x7579('0x1c')](function(){report[_0x7579('0x41')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x34dbc1){console['log'](_0x34dbc1);});}main(); \ No newline at end of file +var _0x1b8e=['./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','catch','listen','sync','bluebird','util','moment','./server','./realtime','./report','./trigger'];(function(_0x354cfc,_0x29da17){var _0x431aa7=function(_0x38bdd3){while(--_0x38bdd3){_0x354cfc['push'](_0x354cfc['shift']());}};_0x431aa7(++_0x29da17);}(_0x1b8e,0xbc));var _0xe1b8=function(_0x3c4000,_0x308a53){_0x3c4000=_0x3c4000-0x0;var _0x2751e9=_0x1b8e[_0x3c4000];return _0x2751e9;};'use strict';var BPromise=require(_0xe1b8('0x0'));var util=require(_0xe1b8('0x1'));var moment=require(_0xe1b8('0x2'));var server=require(_0xe1b8('0x3'));var Realtime=require(_0xe1b8('0x4'));var Report=require(_0xe1b8('0x5'));var Acw=require('./acw');var Trigger=require(_0xe1b8('0x6'));var Dialer=require('./dialer');var Preview=require(_0xe1b8('0x7'));var Fax=require(_0xe1b8('0x8'));var user=require(_0xe1b8('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xe1b8('0xa'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xe1b8('0xb'));var trigger=require(_0xe1b8('0xc'));var template=require(_0xe1b8('0xd'));var cmHopperHistory=require(_0xe1b8('0xe'));var campaign=require(_0xe1b8('0xf'));var voiceExtension=require(_0xe1b8('0x10'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xe1b8('0x11'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xe1b8('0x12'));var freshdesk=require(_0xe1b8('0x13'));var desk=require(_0xe1b8('0x14'));var zoho=require(_0xe1b8('0x15'));var vtiger=require(_0xe1b8('0x16'));var freshsales=require(_0xe1b8('0x17'));var servicenow=require(_0xe1b8('0x18'));var dynamics365=require(_0xe1b8('0x19'));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 isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xe1b8('0x1a')](_0xe1b8('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xe1b8('0x1a')](_0xe1b8('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xe1b8('0x1c')]()[_0xe1b8('0x1d')](user[_0xe1b8('0x1e')]())[_0xe1b8('0x1d')](realtime['initAgents']())[_0xe1b8('0x1d')](user['getTelephones']())['then'](realtime[_0xe1b8('0x1f')]())['then'](trunk[_0xe1b8('0x20')]())[_0xe1b8('0x1d')](realtime['initTrunks']())[_0xe1b8('0x1d')](voiceQueue[_0xe1b8('0x21')]())['then'](realtime[_0xe1b8('0x22')]())['then'](trigger[_0xe1b8('0x23')]())['then'](realtime['initTriggers']())['then'](template[_0xe1b8('0x24')]())['then'](realtime[_0xe1b8('0x25')]())[_0xe1b8('0x1d')](zendesk[_0xe1b8('0x26')]())['then'](realtime[_0xe1b8('0x27')]())['then'](salesforce[_0xe1b8('0x28')]())[_0xe1b8('0x1d')](realtime['initSalesforceAccounts']())[_0xe1b8('0x1d')](sugarcrm[_0xe1b8('0x29')]())[_0xe1b8('0x1d')](realtime[_0xe1b8('0x2a')]())[_0xe1b8('0x1d')](freshdesk[_0xe1b8('0x2b')]())[_0xe1b8('0x1d')](realtime[_0xe1b8('0x2c')]())['then'](desk['getDeskAccounts']())[_0xe1b8('0x1d')](realtime[_0xe1b8('0x2d')]())[_0xe1b8('0x1d')](zoho[_0xe1b8('0x2e')]())[_0xe1b8('0x1d')](realtime['initZohoAccounts']())[_0xe1b8('0x1d')](vtiger['getVtigerAccounts']())[_0xe1b8('0x1d')](realtime[_0xe1b8('0x2f')]())[_0xe1b8('0x1d')](freshsales[_0xe1b8('0x30')]())[_0xe1b8('0x1d')](realtime[_0xe1b8('0x31')]())[_0xe1b8('0x1d')](servicenow[_0xe1b8('0x32')]())['then'](realtime['initServicenowAccounts']())['then'](dynamics365['getDynamics365Accounts']())[_0xe1b8('0x1d')](realtime[_0xe1b8('0x33')]())[_0xe1b8('0x1d')](campaign['getCampaigns']())['then'](realtime[_0xe1b8('0x34')]())[_0xe1b8('0x1d')](voiceExtension[_0xe1b8('0x35')]())['then'](realtime[_0xe1b8('0x36')]())[_0xe1b8('0x1d')](faxAccount[_0xe1b8('0x37')]())[_0xe1b8('0x1d')](realtime[_0xe1b8('0x38')]())[_0xe1b8('0x1d')](function(){return realtime;});}function initParams(){return BPromise[_0xe1b8('0x1c')]()['then'](voiceQueueReport[_0xe1b8('0x39')]())['then'](realtime[_0xe1b8('0x3a')]())[_0xe1b8('0x1d')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xe1b8('0x1d')](realtime[_0xe1b8('0x3b')]())[_0xe1b8('0x1d')](cmHopperHistory[_0xe1b8('0x3c')]())[_0xe1b8('0x1d')](realtime['initCampaignHopperHistory']())[_0xe1b8('0x1d')](voiceCallReport[_0xe1b8('0x3d')]())[_0xe1b8('0x1d')](realtime['initVoiceCallReports']())[_0xe1b8('0x1d')](function(_0x5cecf2){})[_0xe1b8('0x3e')](function(_0x3738dc){console['log'](_0x3738dc);});}function main(){return server[_0xe1b8('0x3f')](realtime,preview,fax)[_0xe1b8('0x1d')](function(_0x3aa6d9){return initRealtime();})[_0xe1b8('0x1d')](function(){return initParams();})[_0xe1b8('0x1d')](function(){report[_0xe1b8('0x40')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x139799){console['log'](_0x139799);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 6962c29..d59f4fb 100644 --- a/server/services/ami/model/agent.js +++ b/server/services/ami/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['name','voiceStatusQueue','onhold','stringify','md5','user:%s','user:save','emit','user:presence','lodash','util','moment','../../../config/environment','redis','defaults','socket.io-emitter','email','accountcode','fullname','state','unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','local','toLowerCase','not_inuse','idle','inuse','statePause','toNumber','format'];(function(_0x150fa7,_0x2fdf30){var _0x2b546d=function(_0x4d2710){while(--_0x4d2710){_0x150fa7['push'](_0x150fa7['shift']());}};_0x2b546d(++_0x2fdf30);}(_0x70e0,0x17b));var _0x070e=function(_0x570b84,_0x1aa178){_0x570b84=_0x570b84-0x0;var _0x1d5218=_0x70e0[_0x570b84];return _0x1d5218;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x070e('0x3'));config[_0x070e('0x4')]=_[_0x070e('0x5')](config[_0x070e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x070e('0x6'))(new Redis(config['redis']));function Agent(_0x46fe68){this['id']=_0x46fe68['id']||0x0;this['name']=_0x46fe68['name']||'';this['email']=_0x46fe68[_0x070e('0x7')]||'';this[_0x070e('0x8')]=_0x46fe68[_0x070e('0x8')]||'';this[_0x070e('0x9')]=_0x46fe68[_0x070e('0x9')]||'';this[_0x070e('0xa')]=_0x070e('0xb');this['stateTime']=0x0;this['status']=_0x070e('0xb');this[_0x070e('0xc')]='';this[_0x070e('0xd')]='';this[_0x070e('0xe')]='';this[_0x070e('0xf')]='';this[_0x070e('0x10')]=_0x46fe68[_0x070e('0x10')]||![];this[_0x070e('0x11')]=_0x070e('0xb');this[_0x070e('0x12')]=0x0;this[_0x070e('0x13')]='';this['voiceStatusQueue']='';this['onhold']=![];this[_0x070e('0x14')]=![];this['md5']='';}Agent['prototype']['updateStatusRealtime']=function(_0x11d2ce){var _0x14c3fd;if(_0x11d2ce&&_0x11d2ce['state']){_0x14c3fd=_0x11d2ce['state'][_0x070e('0x15')]();switch(_0x14c3fd){case _0x070e('0x16'):_0x14c3fd=_0x070e('0x17');break;case _0x070e('0x18'):_0x14c3fd='talking';break;}}if(_0x14c3fd&&this['voiceStatus']!==_0x14c3fd||_0x11d2ce[_0x070e('0x19')]){this[_0x070e('0x12')]=_[_0x070e('0x1a')](moment()[_0x070e('0x1b')]('x'));}if(_0x14c3fd){this[_0x070e('0x11')]=_0x14c3fd;}var _0x5037eb={'id':this['id'],'name':this[_0x070e('0x1c')],'email':this[_0x070e('0x7')],'accountcode':this[_0x070e('0x8')],'fullname':this[_0x070e('0x9')],'state':this[_0x070e('0xa')],'stateTime':this['stateTime'],'status':this['status'],'address':this['address'],'online':this[_0x070e('0x10')],'voiceStatus':this[_0x070e('0x11')],'voiceStatusTime':this[_0x070e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x070e('0x1d')],'interface':this['interface'],'onhold':this[_0x070e('0x1e')]};var _0x3f6985=md5(JSON[_0x070e('0x1f')](_0x5037eb));if(this[_0x070e('0x20')]!==_0x3f6985){this[_0x070e('0x20')]=_0x3f6985;io['to'](util[_0x070e('0x1b')](_0x070e('0x21'),_0x5037eb[_0x070e('0x1c')]))['emit'](_0x070e('0x22'),_0x5037eb);io[_0x070e('0x23')](_0x070e('0x24'),_0x5037eb);}};module['exports']=Agent; \ No newline at end of file +var _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(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xedd9,0xfc));var _0x9edd=function(_0x412bbd,_0x41a421){_0x412bbd=_0x412bbd-0x0;var _0x3423d7=_0xedd9[_0x412bbd];return _0x3423d7;};'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 be581d3..db3f124 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 _0x4d16=['dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0x4d16,0x1b6));var _0x64d1=function(_0x13b1d5,_0x36ff56){_0x13b1d5=_0x13b1d5-0x0;var _0xcef29f=_0x4d16[_0x13b1d5];return _0xcef29f;};'use strict';function Campaign(_0x3eb416){this['id']=_0x3eb416['id']||0x0;this['name']=_0x3eb416['name']||'';this[_0x64d1('0x0')]=_0x3eb416['type']||_0x64d1('0x1');this['originated']=0x0;this[_0x64d1('0x2')]=0x0;this[_0x64d1('0x3')]=0x0;this[_0x64d1('0x4')]=0x0;this[_0x64d1('0x5')]='';this[_0x64d1('0x6')]=!![];this[_0x64d1('0x7')]=_0x3eb416[_0x64d1('0x7')];this[_0x64d1('0x8')]=_0x3eb416['limitCalls'];this['dialTimezone']=_0x3eb416[_0x64d1('0x9')]||null;this[_0x64d1('0xa')]=_0x3eb416['dialGlobalInterval']?_0x3eb416[_0x64d1('0xa')]:null;this[_0x64d1('0xb')]=_0x3eb416['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x3eb416['dialOriginateCallerIdNumber'];this[_0x64d1('0xc')]=_0x3eb416[_0x64d1('0xc')]||0x1e;this[_0x64d1('0xd')]=_0x3eb416['dialCongestionMaxRetry'];this[_0x64d1('0xe')]=_0x3eb416[_0x64d1('0xe')];this[_0x64d1('0xf')]=_0x3eb416[_0x64d1('0xf')];this[_0x64d1('0x10')]=_0x3eb416[_0x64d1('0x10')];this[_0x64d1('0x11')]=_0x3eb416[_0x64d1('0x11')];this[_0x64d1('0x12')]=_0x3eb416['dialNoAnswerRetryFrequency'];this[_0x64d1('0x13')]=_0x3eb416['dialGlobalMaxRetry'];this[_0x64d1('0x14')]=_0x3eb416[_0x64d1('0x14')]||0x3;this[_0x64d1('0x15')]=_0x3eb416[_0x64d1('0x15')]||0x96;this['dialDropMaxRetry']=_0x3eb416[_0x64d1('0x16')]||0x3;this['dialDropRetryFrequency']=_0x3eb416[_0x64d1('0x17')]||0x96;this[_0x64d1('0x18')]=_0x3eb416[_0x64d1('0x18')]||0x3;this[_0x64d1('0x19')]=_0x3eb416['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x3eb416[_0x64d1('0x1a')]||0x3;this[_0x64d1('0x1b')]=_0x3eb416[_0x64d1('0x1b')]||0x96;this[_0x64d1('0x1c')]=_0x3eb416[_0x64d1('0x1c')]||0x3;this[_0x64d1('0x1d')]=_0x3eb416[_0x64d1('0x1d')]||0x96;this[_0x64d1('0x1e')]=_0x3eb416['dialOrderByScheduledAt']||_0x64d1('0x1f');this[_0x64d1('0x20')]=_0x3eb416['dialPrefix']||undefined;this[_0x64d1('0x21')]=_0x3eb416[_0x64d1('0x21')]||undefined;this[_0x64d1('0x22')]=_0x3eb416['dialCutDigit']||undefined;this[_0x64d1('0x23')]=_0x3eb416['TrunkBackup']?_0x3eb416['TrunkBackup']:undefined;this[_0x64d1('0x24')]=_0x3eb416['Trunk']?_0x3eb416[_0x64d1('0x24')]:undefined;this['Interval']=_0x3eb416[_0x64d1('0x25')]?_0x3eb416[_0x64d1('0x25')]:undefined;this[_0x64d1('0x26')]=_0x3eb416[_0x64d1('0x26')]?_0x3eb416['SquareProject']:undefined;this[_0x64d1('0x27')]=_0x3eb416['SquareProject']?_0x3eb416[_0x64d1('0x26')]['name']:undefined;this[_0x64d1('0x28')]=_0x3eb416[_0x64d1('0x28')]||![];this['dialAMDInitialSilence']=_0x3eb416[_0x64d1('0x29')];this[_0x64d1('0x2a')]=_0x3eb416[_0x64d1('0x2a')];this['dialAMDAfterGreetingSilence']=_0x3eb416[_0x64d1('0x2b')];this['dialAMDTotalAnalysisTime']=_0x3eb416[_0x64d1('0x2c')];this[_0x64d1('0x2d')]=_0x3eb416[_0x64d1('0x2d')];this[_0x64d1('0x2e')]=_0x3eb416[_0x64d1('0x2e')];this[_0x64d1('0x2f')]=_0x3eb416[_0x64d1('0x2f')];this[_0x64d1('0x30')]=_0x3eb416[_0x64d1('0x30')];this['dialAMDMaximumWordLength']=_0x3eb416[_0x64d1('0x31')];}module[_0x64d1('0x32')]=Campaign; \ No newline at end of file +var _0x1635=['dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency'];(function(_0x41c31b,_0xdda69e){var _0x356ace=function(_0x7f680d){while(--_0x7f680d){_0x41c31b['push'](_0x41c31b['shift']());}};_0x356ace(++_0xdda69e);}(_0x1635,0x119));var _0x5163=function(_0x3ac3f9,_0x2ca757){_0x3ac3f9=_0x3ac3f9-0x0;var _0x15db0a=_0x1635[_0x3ac3f9];return _0x15db0a;};'use strict';function Campaign(_0x4927ca){this['id']=_0x4927ca['id']||0x0;this[_0x5163('0x0')]=_0x4927ca['name']||'';this[_0x5163('0x1')]=_0x4927ca[_0x5163('0x1')]||_0x5163('0x2');this[_0x5163('0x3')]=0x0;this[_0x5163('0x4')]=0x0;this[_0x5163('0x5')]=0x0;this[_0x5163('0x6')]=0x0;this[_0x5163('0x7')]='';this['sendMessageOneNotActive']=!![];this[_0x5163('0x8')]=_0x4927ca[_0x5163('0x8')];this['limitCalls']=_0x4927ca[_0x5163('0x9')];this[_0x5163('0xa')]=_0x4927ca[_0x5163('0xa')]||null;this[_0x5163('0xb')]=_0x4927ca[_0x5163('0xb')]?_0x4927ca[_0x5163('0xb')]:null;this[_0x5163('0xc')]=_0x4927ca[_0x5163('0xc')];this[_0x5163('0xd')]=_0x4927ca['dialOriginateCallerIdNumber'];this[_0x5163('0xe')]=_0x4927ca[_0x5163('0xe')]||0x1e;this[_0x5163('0xf')]=_0x4927ca['dialCongestionMaxRetry'];this[_0x5163('0x10')]=_0x4927ca[_0x5163('0x10')];this[_0x5163('0x11')]=_0x4927ca['dialBusyMaxRetry'];this[_0x5163('0x12')]=_0x4927ca['dialBusyRetryFrequency'];this[_0x5163('0x13')]=_0x4927ca['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x4927ca[_0x5163('0x14')];this[_0x5163('0x15')]=_0x4927ca[_0x5163('0x15')];this[_0x5163('0x16')]=_0x4927ca[_0x5163('0x16')]||0x3;this[_0x5163('0x17')]=_0x4927ca[_0x5163('0x17')]||0x96;this[_0x5163('0x18')]=_0x4927ca[_0x5163('0x18')]||0x3;this[_0x5163('0x19')]=_0x4927ca[_0x5163('0x19')]||0x96;this[_0x5163('0x1a')]=_0x4927ca[_0x5163('0x1a')]||0x3;this['dialAbandonedRetryFrequency']=_0x4927ca['dialAbandonedRetryFrequency']||0x96;this[_0x5163('0x1b')]=_0x4927ca[_0x5163('0x1b')]||0x3;this[_0x5163('0x1c')]=_0x4927ca['dialMachineRetryFrequency']||0x96;this[_0x5163('0x1d')]=_0x4927ca[_0x5163('0x1d')]||0x3;this[_0x5163('0x1e')]=_0x4927ca['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x4927ca[_0x5163('0x1f')]||'DESC';this[_0x5163('0x20')]=_0x4927ca[_0x5163('0x20')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x4927ca[_0x5163('0x21')]||undefined;this[_0x5163('0x22')]=_0x4927ca['dialCutDigit']||undefined;this[_0x5163('0x23')]=_0x4927ca[_0x5163('0x23')]?_0x4927ca['TrunkBackup']:undefined;this[_0x5163('0x24')]=_0x4927ca[_0x5163('0x24')]?_0x4927ca[_0x5163('0x24')]:undefined;this[_0x5163('0x25')]=_0x4927ca[_0x5163('0x25')]?_0x4927ca[_0x5163('0x25')]:undefined;this['SquareProject']=_0x4927ca[_0x5163('0x26')]?_0x4927ca[_0x5163('0x26')]:undefined;this[_0x5163('0x27')]=_0x4927ca[_0x5163('0x26')]?_0x4927ca[_0x5163('0x26')][_0x5163('0x0')]:undefined;this[_0x5163('0x28')]=_0x4927ca['dialAMDActive']||![];this[_0x5163('0x29')]=_0x4927ca[_0x5163('0x29')];this[_0x5163('0x2a')]=_0x4927ca[_0x5163('0x2a')];this[_0x5163('0x2b')]=_0x4927ca[_0x5163('0x2b')];this[_0x5163('0x2c')]=_0x4927ca[_0x5163('0x2c')];this[_0x5163('0x2d')]=_0x4927ca[_0x5163('0x2d')];this[_0x5163('0x2e')]=_0x4927ca[_0x5163('0x2e')];this[_0x5163('0x2f')]=_0x4927ca[_0x5163('0x2f')];this[_0x5163('0x30')]=_0x4927ca['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x4927ca['dialAMDMaximumWordLength'];}module[_0x5163('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 3ca094e..d0a3bc8 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 _0xa880=['tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','answered','answertime','endtime','unmanaged','lastapplication','lastdata','duration'];(function(_0x475b7d,_0x3e1f95){var _0x2ad527=function(_0x191883){while(--_0x191883){_0x475b7d['push'](_0x475b7d['shift']());}};_0x2ad527(++_0x3e1f95);}(_0xa880,0x106));var _0x0a88=function(_0x2c2390,_0x37ef1c){_0x2c2390=_0x2c2390-0x0;var _0x478b7e=_0xa880[_0x2c2390];return _0x478b7e;};'use strict';function Channel(){this[_0x0a88('0x0')]=null;this[_0x0a88('0x1')]='';this[_0x0a88('0x2')]='';this[_0x0a88('0x3')]=0x0;this[_0x0a88('0x4')]='';this[_0x0a88('0x5')]=undefined;this[_0x0a88('0x6')]=undefined;this[_0x0a88('0x7')]=0x0;this[_0x0a88('0x8')]='';this[_0x0a88('0x9')]=0x0;this[_0x0a88('0xa')]=0x0;this['exten']=0x0;this[_0x0a88('0xb')]=![];this[_0x0a88('0xc')]=null;this[_0x0a88('0xd')]=null;this[_0x0a88('0xe')]=![];this['abandoned']=![];this[_0x0a88('0xf')]='';this[_0x0a88('0x10')]='';this[_0x0a88('0x11')]=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this['type']=null;this[_0x0a88('0x12')]=null;this[_0x0a88('0x13')]=null;this[_0x0a88('0x14')]=![];this[_0x0a88('0x15')]=null;this[_0x0a88('0x16')]=null;this[_0x0a88('0x17')]=[];this[_0x0a88('0x18')]=undefined;this[_0x0a88('0x19')]=undefined;this[_0x0a88('0x1a')]=undefined;this[_0x0a88('0x1b')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0xcb1a=['starttime','channel','destinationchannel','calleridnum','connectedlinename','context','uniqueid','exten','answered','answertime','endtime','unmanaged','abandoned','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transferconnectedlinenum','transferType'];(function(_0x420c7e,_0x2fb00d){var _0x1fdcb0=function(_0xe73be0){while(--_0xe73be0){_0x420c7e['push'](_0x420c7e['shift']());}};_0x1fdcb0(++_0x2fb00d);}(_0xcb1a,0xb6));var _0xacb1=function(_0x135645,_0x115a2d){_0x135645=_0x135645-0x0;var _0xb9531f=_0xcb1a[_0x135645];return _0xb9531f;};'use strict';function Channel(){this[_0xacb1('0x0')]=null;this[_0xacb1('0x1')]='';this[_0xacb1('0x2')]='';this[_0xacb1('0x3')]=0x0;this['calleridname']='';this['connectedlinenum']=undefined;this[_0xacb1('0x4')]=undefined;this['accountcode']=0x0;this[_0xacb1('0x5')]='';this[_0xacb1('0x6')]=0x0;this['linkedid']=0x0;this[_0xacb1('0x7')]=0x0;this[_0xacb1('0x8')]=![];this[_0xacb1('0x9')]=null;this[_0xacb1('0xa')]=null;this[_0xacb1('0xb')]=![];this[_0xacb1('0xc')]=![];this['lastapplication']='';this[_0xacb1('0xd')]='';this[_0xacb1('0xe')]=0x0;this[_0xacb1('0xf')]=0x0;this[_0xacb1('0x10')]=0x0;this[_0xacb1('0x11')]=null;this[_0xacb1('0x12')]=null;this[_0xacb1('0x13')]=null;this[_0xacb1('0x14')]=![];this[_0xacb1('0x15')]=null;this[_0xacb1('0x16')]=null;this[_0xacb1('0x17')]=[];this['transfercalleridnum']=undefined;this[_0xacb1('0x18')]=undefined;this[_0xacb1('0x19')]=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 bfc6661..23fe1d0 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 _0xfce7=['username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','serverUrl','Configurations','exports','name'];(function(_0x44e41a,_0xe50d0c){var _0x42e39a=function(_0x3de210){while(--_0x3de210){_0x44e41a['push'](_0x44e41a['shift']());}};_0x42e39a(++_0xe50d0c);}(_0xfce7,0x197));var _0x7fce=function(_0x364b32,_0x4dec35){_0x364b32=_0x364b32-0x0;var _0x3f3ea0=_0xfce7[_0x364b32];return _0x3f3ea0;};'use strict';function DeskAccount(_0x19295b){this['id']=_0x19295b['id']||0x0;this[_0x7fce('0x0')]=_0x19295b[_0x7fce('0x0')]||'';this['username']=_0x19295b[_0x7fce('0x1')]||'';this[_0x7fce('0x2')]=_0x19295b['remoteUri']||'';this[_0x7fce('0x3')]=_0x19295b[_0x7fce('0x3')]||'';this[_0x7fce('0x4')]=_0x19295b[_0x7fce('0x4')]||'';this['consumerKey']=_0x19295b[_0x7fce('0x5')]||'';this[_0x7fce('0x6')]=_0x19295b[_0x7fce('0x6')]||'';this[_0x7fce('0x7')]=_0x19295b[_0x7fce('0x7')]||'';this[_0x7fce('0x8')]=_0x19295b[_0x7fce('0x8')]||'';this['type']=_0x19295b['type']||'';this[_0x7fce('0x9')]=_0x19295b[_0x7fce('0x9')]||'';this['Configurations']=_0x19295b[_0x7fce('0xa')]||{};}module[_0x7fce('0xb')]=DeskAccount; \ No newline at end of file +var _0xa23f=['tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','token'];(function(_0x1247fe,_0x1daadb){var _0x215787=function(_0x16586d){while(--_0x16586d){_0x1247fe['push'](_0x1247fe['shift']());}};_0x215787(++_0x1daadb);}(_0xa23f,0x71));var _0xfa23=function(_0x45b3ee,_0x3bd572){_0x45b3ee=_0x45b3ee-0x0;var _0x96f68c=_0xa23f[_0x45b3ee];return _0x96f68c;};'use strict';function DeskAccount(_0x1e1c68){this['id']=_0x1e1c68['id']||0x0;this['name']=_0x1e1c68[_0xfa23('0x0')]||'';this[_0xfa23('0x1')]=_0x1e1c68[_0xfa23('0x1')]||'';this[_0xfa23('0x2')]=_0x1e1c68[_0xfa23('0x2')]||'';this[_0xfa23('0x3')]=_0x1e1c68[_0xfa23('0x3')]||'';this[_0xfa23('0x4')]=_0x1e1c68[_0xfa23('0x4')]||'';this[_0xfa23('0x5')]=_0x1e1c68[_0xfa23('0x5')]||'';this['consumerSecret']=_0x1e1c68['consumerSecret']||'';this[_0xfa23('0x6')]=_0x1e1c68[_0xfa23('0x6')]||'';this['tokenSecret']=_0x1e1c68[_0xfa23('0x7')]||'';this[_0xfa23('0x8')]=_0x1e1c68[_0xfa23('0x8')]||'';this['serverUrl']=_0x1e1c68[_0xfa23('0x9')]||'';this['Configurations']=_0x1e1c68[_0xfa23('0xa')]||{};}module[_0xfa23('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 8ce18b2..6b6e7b9 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 _0x2dae=['clientId','clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId'];(function(_0x1045ef,_0xfea295){var _0x3e99f2=function(_0x373c6b){while(--_0x373c6b){_0x1045ef['push'](_0x1045ef['shift']());}};_0x3e99f2(++_0xfea295);}(_0x2dae,0xc3));var _0xe2da=function(_0x3a3c17,_0x5b7b7e){_0x3a3c17=_0x3a3c17-0x0;var _0xd07f21=_0x2dae[_0x3a3c17];return _0xd07f21;};'use strict';function Dynamics365Account(_0x463a36){this['id']=_0x463a36['id']||0x0;this['name']=_0x463a36[_0xe2da('0x0')]||'';this[_0xe2da('0x1')]=_0x463a36[_0xe2da('0x1')]||'';this[_0xe2da('0x2')]=_0x463a36[_0xe2da('0x2')]||'';this['remoteUri']=_0x463a36[_0xe2da('0x3')]||'';this[_0xe2da('0x4')]=_0x463a36[_0xe2da('0x4')]||'';this[_0xe2da('0x5')]=_0x463a36['clientId']||'';this[_0xe2da('0x6')]=_0x463a36[_0xe2da('0x6')]||{};this[_0xe2da('0x7')]=_0x463a36[_0xe2da('0x7')]||'';this[_0xe2da('0x8')]=_0x463a36[_0xe2da('0x8')]||{};}module[_0xe2da('0x9')]=Dynamics365Account; \ No newline at end of file +var _0xd64b=['exports','name','username','password','remoteUri','clientSecret','serverUrl','Configurations'];(function(_0x2a788b,_0x1b4d13){var _0xe9d248=function(_0x4c418d){while(--_0x4c418d){_0x2a788b['push'](_0x2a788b['shift']());}};_0xe9d248(++_0x1b4d13);}(_0xd64b,0xc1));var _0xbd64=function(_0x4d1423,_0x3e24cd){_0x4d1423=_0x4d1423-0x0;var _0x4e4f8b=_0xd64b[_0x4d1423];return _0x4e4f8b;};'use strict';function Dynamics365Account(_0x272488){this['id']=_0x272488['id']||0x0;this['name']=_0x272488[_0xbd64('0x0')]||'';this['username']=_0x272488[_0xbd64('0x1')]||'';this[_0xbd64('0x2')]=_0x272488[_0xbd64('0x2')]||'';this[_0xbd64('0x3')]=_0x272488[_0xbd64('0x3')]||'';this['tenantId']=_0x272488['tenantId']||'';this['clientId']=_0x272488['clientId']||'';this[_0xbd64('0x4')]=_0x272488[_0xbd64('0x4')]||{};this[_0xbd64('0x5')]=_0x272488[_0xbd64('0x5')]||'';this[_0xbd64('0x6')]=_0x272488[_0xbd64('0x6')]||{};}module[_0xbd64('0x7')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 336ec90..8b17eea 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 _0xb8f7=['SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech'];(function(_0x246b37,_0x1b15e9){var _0x591e11=function(_0x1a5fb9){while(--_0x1a5fb9){_0x246b37['push'](_0x246b37['shift']());}};_0x591e11(++_0x1b15e9);}(_0xb8f7,0x1c7));var _0x7b8f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb8f7[_0x20a584];return _0x4b41a8;};'use strict';function FaxAccount(_0x4484b8){this['id']=_0x4484b8['id']||0x0;this[_0x7b8f('0x0')]=_0x4484b8[_0x7b8f('0x0')]||'';this[_0x7b8f('0x1')]=_0x4484b8[_0x7b8f('0x1')];this[_0x7b8f('0x2')]=_0x4484b8[_0x7b8f('0x2')];this[_0x7b8f('0x3')]=_0x4484b8[_0x7b8f('0x3')];this[_0x7b8f('0x4')]=_0x4484b8[_0x7b8f('0x4')];this[_0x7b8f('0x5')]=_0x4484b8[_0x7b8f('0x5')]||0x960;this[_0x7b8f('0x6')]=_0x4484b8['maxrate']||0x3840;this[_0x7b8f('0x7')]=_0x4484b8[_0x7b8f('0x7')]||_0x7b8f('0x8');this[_0x7b8f('0x9')]=_0x4484b8[_0x7b8f('0x9')]||'no';this[_0x7b8f('0xa')]=_0x4484b8['faxdetect']||'no';this[_0x7b8f('0xb')]=_0x4484b8[_0x7b8f('0xb')]||0x1388;this[_0x7b8f('0xc')]=_0x4484b8[_0x7b8f('0xc')]||_0x7b8f('0xd');this[_0x7b8f('0xe')]=_0x4484b8['Trunk']?_0x4484b8[_0x7b8f('0xe')]:undefined;this['ListId']=_0x4484b8[_0x7b8f('0xf')];this[_0x7b8f('0x10')]=_0x4484b8[_0x7b8f('0x10')];}module[_0x7b8f('0x11')]=FaxAccount; \ No newline at end of file +var _0x1d7f=['exports','name','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key'];(function(_0x5d18d0,_0x252347){var _0x160ff2=function(_0x4c2987){while(--_0x4c2987){_0x5d18d0['push'](_0x5d18d0['shift']());}};_0x160ff2(++_0x252347);}(_0x1d7f,0xc1));var _0xf1d7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1d7f[_0x14add3];return _0x4a174f;};'use strict';function FaxAccount(_0x5dad2d){this['id']=_0x5dad2d['id']||0x0;this[_0xf1d7('0x0')]=_0x5dad2d['name']||'';this['description']=_0x5dad2d['description'];this['ecm']=_0x5dad2d[_0xf1d7('0x1')];this['headerinfo']=_0x5dad2d[_0xf1d7('0x2')];this['localstationid']=_0x5dad2d[_0xf1d7('0x3')];this[_0xf1d7('0x4')]=_0x5dad2d[_0xf1d7('0x4')]||0x960;this[_0xf1d7('0x5')]=_0x5dad2d[_0xf1d7('0x5')]||0x3840;this[_0xf1d7('0x6')]=_0x5dad2d[_0xf1d7('0x6')]||_0xf1d7('0x7');this['gateway']=_0x5dad2d[_0xf1d7('0x8')]||'no';this[_0xf1d7('0x9')]=_0x5dad2d[_0xf1d7('0x9')]||'no';this[_0xf1d7('0xa')]=_0x5dad2d[_0xf1d7('0xa')]||0x1388;this[_0xf1d7('0xb')]=_0x5dad2d[_0xf1d7('0xb')]||'SIP';this[_0xf1d7('0xc')]=_0x5dad2d[_0xf1d7('0xc')]?_0x5dad2d['Trunk']:undefined;this[_0xf1d7('0xd')]=_0x5dad2d[_0xf1d7('0xd')];this[_0xf1d7('0xe')]=_0x5dad2d[_0xf1d7('0xe')];}module[_0xf1d7('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index a23e21d..9ee6c10 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 _0x95a4=['apiKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x1f2750,_0x50b658){var _0xd11a09=function(_0x2d1342){while(--_0x2d1342){_0x1f2750['push'](_0x1f2750['shift']());}};_0xd11a09(++_0x50b658);}(_0x95a4,0x7c));var _0x495a=function(_0x6cd1,_0x886adc){_0x6cd1=_0x6cd1-0x0;var _0x2a9138=_0x95a4[_0x6cd1];return _0x2a9138;};'use strict';function FreshdeskAccount(_0xd45ce5){this['id']=_0xd45ce5['id']||0x0;this[_0x495a('0x0')]=_0xd45ce5[_0x495a('0x0')]||'';this[_0x495a('0x1')]=_0xd45ce5[_0x495a('0x1')]||'';this[_0x495a('0x2')]=_0xd45ce5['token']||'';this['remoteUri']=_0xd45ce5[_0x495a('0x3')]||'';this[_0x495a('0x4')]=_0xd45ce5['serverUrl']||'';this[_0x495a('0x5')]=_0xd45ce5[_0x495a('0x5')]||{};}module[_0x495a('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x60dc=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x10cc3f,_0x37d990){var _0x2c68e4=function(_0x2021a1){while(--_0x2021a1){_0x10cc3f['push'](_0x10cc3f['shift']());}};_0x2c68e4(++_0x37d990);}(_0x60dc,0xc3));var _0xc60d=function(_0x5508f3,_0x4d7edf){_0x5508f3=_0x5508f3-0x0;var _0x1efae3=_0x60dc[_0x5508f3];return _0x1efae3;};'use strict';function FreshdeskAccount(_0x2e9134){this['id']=_0x2e9134['id']||0x0;this[_0xc60d('0x0')]=_0x2e9134[_0xc60d('0x0')]||'';this['username']=_0x2e9134[_0xc60d('0x1')]||'';this[_0xc60d('0x2')]=_0x2e9134[_0xc60d('0x3')]||'';this[_0xc60d('0x4')]=_0x2e9134[_0xc60d('0x4')]||'';this[_0xc60d('0x5')]=_0x2e9134[_0xc60d('0x5')]||'';this[_0xc60d('0x6')]=_0x2e9134[_0xc60d('0x6')]||{};}module[_0xc60d('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 dd0d404..a3b87a9 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 _0x4be6=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x38b9b5,_0x3bb3c9){var _0x42f6ce=function(_0x423cc8){while(--_0x423cc8){_0x38b9b5['push'](_0x38b9b5['shift']());}};_0x42f6ce(++_0x3bb3c9);}(_0x4be6,0xb5));var _0x64be=function(_0x385d89,_0x2fe099){_0x385d89=_0x385d89-0x0;var _0x1454e8=_0x4be6[_0x385d89];return _0x1454e8;};'use strict';function FreshsalesAccount(_0x3961b5){this['id']=_0x3961b5['id']||0x0;this[_0x64be('0x0')]=_0x3961b5[_0x64be('0x0')]||'';this[_0x64be('0x1')]=_0x3961b5[_0x64be('0x1')]||'';this[_0x64be('0x2')]=_0x3961b5[_0x64be('0x3')]||'';this[_0x64be('0x4')]=_0x3961b5[_0x64be('0x4')]||'';this[_0x64be('0x5')]=_0x3961b5[_0x64be('0x5')]||'';this['Configurations']=_0x3961b5[_0x64be('0x6')]||{};}module[_0x64be('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x52ad=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x12bcf7,_0x20878d){var _0x516440=function(_0x26eff1){while(--_0x26eff1){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x516440(++_0x20878d);}(_0x52ad,0x1d8));var _0xd52a=function(_0x158b2a,_0x2c6ef6){_0x158b2a=_0x158b2a-0x0;var _0x22f4f4=_0x52ad[_0x158b2a];return _0x22f4f4;};'use strict';function FreshsalesAccount(_0x390195){this['id']=_0x390195['id']||0x0;this[_0xd52a('0x0')]=_0x390195[_0xd52a('0x0')]||'';this[_0xd52a('0x1')]=_0x390195['username']||'';this[_0xd52a('0x2')]=_0x390195[_0xd52a('0x3')]||'';this[_0xd52a('0x4')]=_0x390195[_0xd52a('0x4')]||'';this[_0xd52a('0x5')]=_0x390195[_0xd52a('0x5')]||'';this[_0xd52a('0x6')]=_0x390195[_0xd52a('0x6')]||{};}module[_0xd52a('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index e9da989..95a31da 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 _0x7dbb=['queuecallerabandonAt','queuecallercomplete','queuecallerexit','originalposition','channel','connectedlinename','context','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerabandon'];(function(_0x17092e,_0x2b3fe4){var _0x50e33b=function(_0x541994){while(--_0x541994){_0x17092e['push'](_0x17092e['shift']());}};_0x50e33b(++_0x2b3fe4);}(_0x7dbb,0x1f3));var _0xb7db=function(_0xbe2d65,_0x19fdcc){_0xbe2d65=_0xbe2d65-0x0;var _0x581602=_0x7dbb[_0xbe2d65];return _0x581602;};'use strict';function QueueReport(){this['type']=_0xb7db('0x0');this[_0xb7db('0x1')]='';this[_0xb7db('0x2')]='';this[_0xb7db('0x3')]='';this[_0xb7db('0x4')]='';this[_0xb7db('0x5')]=null;this['queuecallerleaveAt']=null;this['position']=0x1;this['count']=0x1;this[_0xb7db('0x6')]=![];this[_0xb7db('0x7')]=null;this[_0xb7db('0x8')]=![];this['queuecallercompleteAt']=null;this[_0xb7db('0x9')]=![];this['queuecallerexitAt']=null;this[_0xb7db('0xa')]=0x1;this[_0xb7db('0xb')]='';this['connectedlinenum']='';this[_0xb7db('0xc')]='';this['accountcode']='';this[_0xb7db('0xd')]='';this['exten']='';this[_0xb7db('0xe')]='';this[_0xb7db('0xf')]=0x0;this[_0xb7db('0x10')]=![];this[_0xb7db('0x11')]='';this[_0xb7db('0x12')]=_0xb7db('0x13');this[_0xb7db('0x14')]=0x0;this[_0xb7db('0x15')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0xce7d=['queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type','calleridnum','calleridname','queuecallerjoinAt'];(function(_0x5b8606,_0x43b45d){var _0x2df0fc=function(_0x1a548f){while(--_0x1a548f){_0x5b8606['push'](_0x5b8606['shift']());}};_0x2df0fc(++_0x43b45d);}(_0xce7d,0x8c));var _0xdce7=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xce7d[_0x1cc8fe];return _0x230054;};'use strict';function QueueReport(){this[_0xdce7('0x0')]='inbound';this['uniqueid']='';this[_0xdce7('0x1')]='';this[_0xdce7('0x2')]='';this['queue']='';this[_0xdce7('0x3')]=null;this[_0xdce7('0x4')]=null;this[_0xdce7('0x5')]=0x1;this['count']=0x1;this[_0xdce7('0x6')]=![];this[_0xdce7('0x7')]=null;this[_0xdce7('0x8')]=![];this['queuecallercompleteAt']=null;this[_0xdce7('0x9')]=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this['channel']='';this[_0xdce7('0xa')]='';this[_0xdce7('0xb')]='';this[_0xdce7('0xc')]='';this[_0xdce7('0xd')]='';this[_0xdce7('0xe')]='';this[_0xdce7('0xf')]='';this[_0xdce7('0x10')]=0x0;this[_0xdce7('0x11')]=![];this[_0xdce7('0x12')]='';this[_0xdce7('0x13')]=_0xdce7('0x14');this[_0xdce7('0x15')]=0x0;this[_0xdce7('0x16')]={};}module[_0xdce7('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index f164525..fc531c4 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 _0x3423=['clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name','username','remoteUri','password'];(function(_0x51133a,_0xecce4f){var _0x1a7335=function(_0x37deed){while(--_0x37deed){_0x51133a['push'](_0x51133a['shift']());}};_0x1a7335(++_0xecce4f);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';function SalesforceAccount(_0x2c0b8e){this['id']=_0x2c0b8e['id']||0x0;this['name']=_0x2c0b8e[_0x3342('0x0')]||'';this[_0x3342('0x1')]=_0x2c0b8e[_0x3342('0x1')]||'';this[_0x3342('0x2')]=_0x2c0b8e[_0x3342('0x2')]||'';this[_0x3342('0x3')]=_0x2c0b8e[_0x3342('0x3')]||'';this[_0x3342('0x4')]=_0x2c0b8e[_0x3342('0x4')]||'';this[_0x3342('0x5')]=_0x2c0b8e[_0x3342('0x5')]||'';this[_0x3342('0x6')]=_0x2c0b8e[_0x3342('0x6')]||'';this[_0x3342('0x7')]=_0x2c0b8e[_0x3342('0x7')]||_0x3342('0x8');this[_0x3342('0x9')]=_0x2c0b8e[_0x3342('0x9')]||'';this[_0x3342('0xa')]=_0x2c0b8e['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0xf6f3=['securityToken','type','integrationTab','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x27e59e,_0x25a388){var _0x1225c7=function(_0x488388){while(--_0x488388){_0x27e59e['push'](_0x27e59e['shift']());}};_0x1225c7(++_0x25a388);}(_0xf6f3,0xd6));var _0x3f6f=function(_0x217cfd,_0x1e3094){_0x217cfd=_0x217cfd-0x0;var _0x1e887f=_0xf6f3[_0x217cfd];return _0x1e887f;};'use strict';function SalesforceAccount(_0x2ed664){this['id']=_0x2ed664['id']||0x0;this[_0x3f6f('0x0')]=_0x2ed664[_0x3f6f('0x0')]||'';this[_0x3f6f('0x1')]=_0x2ed664[_0x3f6f('0x1')]||'';this[_0x3f6f('0x2')]=_0x2ed664[_0x3f6f('0x2')]||'';this[_0x3f6f('0x3')]=_0x2ed664[_0x3f6f('0x3')]||'';this[_0x3f6f('0x4')]=_0x2ed664[_0x3f6f('0x4')]||'';this[_0x3f6f('0x5')]=_0x2ed664['clientSecret']||'';this[_0x3f6f('0x6')]=_0x2ed664[_0x3f6f('0x6')]||'';this['type']=_0x2ed664[_0x3f6f('0x7')]||_0x3f6f('0x8');this['serverUrl']=_0x2ed664['serverUrl']||'';this[_0x3f6f('0x9')]=_0x2ed664[_0x3f6f('0x9')]||{};}module[_0x3f6f('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 fda57da..7e8edf1 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 _0x2635=['password','remoteUri','serverUrl','Configurations','name','username'];(function(_0x55a3cc,_0x16dcc0){var _0x216019=function(_0x1c96f4){while(--_0x1c96f4){_0x55a3cc['push'](_0x55a3cc['shift']());}};_0x216019(++_0x16dcc0);}(_0x2635,0x118));var _0x5263=function(_0x4e895c,_0x30c0ba){_0x4e895c=_0x4e895c-0x0;var _0x16ddc2=_0x2635[_0x4e895c];return _0x16ddc2;};'use strict';function ServicenowAccount(_0x59ce05){this['id']=_0x59ce05['id']||0x0;this[_0x5263('0x0')]=_0x59ce05[_0x5263('0x0')]||'';this[_0x5263('0x1')]=_0x59ce05[_0x5263('0x1')]||'';this[_0x5263('0x2')]=_0x59ce05['password']||'';this[_0x5263('0x3')]=_0x59ce05[_0x5263('0x3')]||'';this[_0x5263('0x4')]=_0x59ce05[_0x5263('0x4')]||'';this['Configurations']=_0x59ce05[_0x5263('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x3db2=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x3db2,0x96));var _0x23db=function(_0x17e4f9,_0x4318be){_0x17e4f9=_0x17e4f9-0x0;var _0xf6cb46=_0x3db2[_0x17e4f9];return _0xf6cb46;};'use strict';function ServicenowAccount(_0x408193){this['id']=_0x408193['id']||0x0;this[_0x23db('0x0')]=_0x408193[_0x23db('0x0')]||'';this[_0x23db('0x1')]=_0x408193[_0x23db('0x1')]||'';this[_0x23db('0x2')]=_0x408193['password']||'';this[_0x23db('0x3')]=_0x408193[_0x23db('0x3')]||'';this[_0x23db('0x4')]=_0x408193['serverUrl']||'';this[_0x23db('0x5')]=_0x408193[_0x23db('0x5')]||{};}module[_0x23db('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 9e37706..082d344 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 _0xa7aa=['exports','name','username','password','serverUrl'];(function(_0x97877,_0x422052){var _0x5d9569=function(_0x60e479){while(--_0x60e479){_0x97877['push'](_0x97877['shift']());}};_0x5d9569(++_0x422052);}(_0xa7aa,0x8d));var _0xaa7a=function(_0x881430,_0x266b78){_0x881430=_0x881430-0x0;var _0x5247cc=_0xa7aa[_0x881430];return _0x5247cc;};'use strict';function SugarcrmAccount(_0x571dfa){this['id']=_0x571dfa['id']||0x0;this[_0xaa7a('0x0')]=_0x571dfa[_0xaa7a('0x0')]||'';this[_0xaa7a('0x1')]=_0x571dfa[_0xaa7a('0x1')]||'';this[_0xaa7a('0x2')]=_0x571dfa[_0xaa7a('0x2')]||'';this['remoteUri']=_0x571dfa['remoteUri']||'';this[_0xaa7a('0x3')]=_0x571dfa['serverUrl']||'';this['Configurations']=_0x571dfa['Configurations']||{};}module[_0xaa7a('0x4')]=SugarcrmAccount; \ No newline at end of file +var _0x229a=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x51df3b,_0x5e2069){var _0x232718=function(_0x309b96){while(--_0x309b96){_0x51df3b['push'](_0x51df3b['shift']());}};_0x232718(++_0x5e2069);}(_0x229a,0x1ea));var _0xa229=function(_0x23e1b3,_0x4a61bf){_0x23e1b3=_0x23e1b3-0x0;var _0x48df5b=_0x229a[_0x23e1b3];return _0x48df5b;};'use strict';function SugarcrmAccount(_0x5153d9){this['id']=_0x5153d9['id']||0x0;this[_0xa229('0x0')]=_0x5153d9[_0xa229('0x0')]||'';this[_0xa229('0x1')]=_0x5153d9[_0xa229('0x1')]||'';this[_0xa229('0x2')]=_0x5153d9[_0xa229('0x2')]||'';this[_0xa229('0x3')]=_0x5153d9['remoteUri']||'';this[_0xa229('0x4')]=_0x5153d9['serverUrl']||'';this[_0xa229('0x5')]=_0x5153d9[_0xa229('0x5')]||{};}module[_0xa229('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 eaf78b1..cc7e8d7 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 _0x3ce4=['status','address','exports','name','accountcode','state','unknown','stateTime'];(function(_0x1ffd19,_0x19bc3d){var _0x143582=function(_0x2d45b4){while(--_0x2d45b4){_0x1ffd19['push'](_0x1ffd19['shift']());}};_0x143582(++_0x19bc3d);}(_0x3ce4,0xcb));var _0x43ce=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x3ce4[_0x1e4360];return _0x31e6b4;};'use strict';function Telephone(_0x7ce965){this['id']=_0x7ce965['id']||0x0;this['name']=_0x7ce965[_0x43ce('0x0')]||'';this['accountcode']=_0x7ce965[_0x43ce('0x1')]||'';this[_0x43ce('0x2')]=_0x43ce('0x3');this[_0x43ce('0x4')]=0x0;this[_0x43ce('0x5')]='unknown';this[_0x43ce('0x6')]='';}module[_0x43ce('0x7')]=Telephone; \ No newline at end of file +var _0xecf3=['stateTime','status','address','exports','name','accountcode','unknown'];(function(_0x253796,_0x4d840c){var _0x33a6c6=function(_0x2f8c18){while(--_0x2f8c18){_0x253796['push'](_0x253796['shift']());}};_0x33a6c6(++_0x4d840c);}(_0xecf3,0x66));var _0x3ecf=function(_0x169c32,_0x5c79f1){_0x169c32=_0x169c32-0x0;var _0x3bb0f5=_0xecf3[_0x169c32];return _0x3bb0f5;};'use strict';function Telephone(_0x3d0574){this['id']=_0x3d0574['id']||0x0;this['name']=_0x3d0574[_0x3ecf('0x0')]||'';this[_0x3ecf('0x1')]=_0x3d0574[_0x3ecf('0x1')]||'';this['state']=_0x3ecf('0x2');this[_0x3ecf('0x3')]=0x0;this[_0x3ecf('0x4')]='unknown';this[_0x3ecf('0x5')]='';}module[_0x3ecf('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 84cc3f4..fd8270a 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(_0x325047,_0x1358c5){var _0x56d153=function(_0x4a0440){while(--_0x4a0440){_0x325047['push'](_0x325047['shift']());}};_0x56d153(++_0x1358c5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x15634e,_0x267756){var _0x4f2392=function(_0x296469){while(--_0x296469){_0x15634e['push'](_0x15634e['shift']());}};_0x4f2392(++_0x267756);}(_0xb10b,0x12a));var _0xbb10=function(_0x3ae8f4,_0x2920f4){_0x3ae8f4=_0x3ae8f4-0x0;var _0x367312=_0xb10b[_0x3ae8f4];return _0x367312;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index b8011b3..f4b2835 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 _0x9ffd=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x11ec49,_0x375880){var _0x5e00a0=function(_0x396b22){while(--_0x396b22){_0x11ec49['push'](_0x11ec49['shift']());}};_0x5e00a0(++_0x375880);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x25d0b7,_0x47f517){_0x25d0b7=_0x25d0b7-0x0;var _0x3bb36b=_0x9ffd[_0x25d0b7];return _0x3bb36b;};'use strict';function Trigger(_0x4c26a1){this['id']=_0x4c26a1['id']||0x0;this[_0xd9ff('0x0')]=_0x4c26a1[_0xd9ff('0x0')]||'';this['channel']=_0x4c26a1[_0xd9ff('0x1')]||_0xd9ff('0x2');this[_0xd9ff('0x3')]=_0x4c26a1[_0xd9ff('0x3')]||![];this['AllConditions']=_0x4c26a1[_0xd9ff('0x4')]||[];this[_0xd9ff('0x5')]=_0x4c26a1['AnyConditions']||[];this[_0xd9ff('0x6')]=_0x4c26a1[_0xd9ff('0x6')]||[];}module[_0xd9ff('0x7')]=Trigger; \ No newline at end of file +var _0x757a=['name','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x304600,_0x4ecdfe){var _0x337878=function(_0xe2b418){while(--_0xe2b418){_0x304600['push'](_0x304600['shift']());}};_0x337878(++_0x4ecdfe);}(_0x757a,0xde));var _0xa757=function(_0x45703f,_0x1a6eee){_0x45703f=_0x45703f-0x0;var _0x4e9733=_0x757a[_0x45703f];return _0x4e9733;};'use strict';function Trigger(_0x1acf7d){this['id']=_0x1acf7d['id']||0x0;this[_0xa757('0x0')]=_0x1acf7d[_0xa757('0x0')]||'';this['channel']=_0x1acf7d['channel']||'voice';this[_0xa757('0x1')]=_0x1acf7d[_0xa757('0x1')]||![];this[_0xa757('0x2')]=_0x1acf7d[_0xa757('0x2')]||[];this[_0xa757('0x3')]=_0x1acf7d[_0xa757('0x3')]||[];this['Actions']=_0x1acf7d[_0xa757('0x4')]||[];}module[_0xa757('0x5')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 7cddf5f..6bfa1ef 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 _0xf70d=['stateRegistry','registrationtime','defaultuser','exports','active','unknown','stateTime','status','registry','indexOf','port','domainport'];(function(_0x307ce2,_0x41a7b3){var _0x24006e=function(_0x18622e){while(--_0x18622e){_0x307ce2['push'](_0x307ce2['shift']());}};_0x24006e(++_0x41a7b3);}(_0xf70d,0xa0));var _0xdf70=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf70d[_0x3dd15e];return _0x231fd0;};'use strict';function Trunk(_0x294cc0){this['id']=_0x294cc0['id']||0x0;this['active']=_0x294cc0[_0xdf70('0x0')]||![];this['name']=_0x294cc0['name']||'';this['state']=_0xdf70('0x1');this[_0xdf70('0x2')]=0x0;this[_0xdf70('0x3')]=_0xdf70('0x1');this[_0xdf70('0x4')]=_0x294cc0[_0xdf70('0x4')]&&_0x294cc0[_0xdf70('0x4')][_0xdf70('0x5')](':')?_0x294cc0[_0xdf70('0x4')]['split'](':')[0x0]:'';this['host']='';this[_0xdf70('0x6')]='';this['domain']='';this[_0xdf70('0x7')]='';this['refresh']='';this[_0xdf70('0x8')]=_0xdf70('0x1');this[_0xdf70('0x9')]='';this['address']='';this['defaultuser']=_0x294cc0[_0xdf70('0xa')]||'';}module[_0xdf70('0xb')]=Trunk; \ No newline at end of file +var _0x47e1=['host','port','domain','domainport','refresh','stateRegistry','registrationtime','defaultuser','exports','active','name','state','unknown','status','registry','indexOf'];(function(_0x10ce4f,_0x49b8e8){var _0x23ebf5=function(_0x2d05cf){while(--_0x2d05cf){_0x10ce4f['push'](_0x10ce4f['shift']());}};_0x23ebf5(++_0x49b8e8);}(_0x47e1,0x1d9));var _0x147e=function(_0x66f53d,_0x317e4f){_0x66f53d=_0x66f53d-0x0;var _0x54d0fe=_0x47e1[_0x66f53d];return _0x54d0fe;};'use strict';function Trunk(_0x4506f2){this['id']=_0x4506f2['id']||0x0;this[_0x147e('0x0')]=_0x4506f2[_0x147e('0x0')]||![];this[_0x147e('0x1')]=_0x4506f2[_0x147e('0x1')]||'';this[_0x147e('0x2')]=_0x147e('0x3');this['stateTime']=0x0;this[_0x147e('0x4')]=_0x147e('0x3');this[_0x147e('0x5')]=_0x4506f2[_0x147e('0x5')]&&_0x4506f2[_0x147e('0x5')][_0x147e('0x6')](':')?_0x4506f2[_0x147e('0x5')]['split'](':')[0x0]:'';this[_0x147e('0x7')]='';this[_0x147e('0x8')]='';this[_0x147e('0x9')]='';this[_0x147e('0xa')]='';this[_0x147e('0xb')]='';this[_0x147e('0xc')]='unknown';this[_0x147e('0xd')]='';this['address']='';this['defaultuser']=_0x4506f2[_0x147e('0xe')]||'';}module[_0x147e('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index b531df3..1946326 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 _0x9c7a=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x4ae2a1,_0x453065){var _0x49b5b7=function(_0xdc81b5){while(--_0xdc81b5){_0x4ae2a1['push'](_0x4ae2a1['shift']());}};_0x49b5b7(++_0x453065);}(_0x9c7a,0x16f));var _0xa9c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c7a[_0x3dd15e];return _0x231fd0;};'use strict';function voiceExtension(_0x445a8e){this['id']=_0x445a8e['id']||0x0;this[_0xa9c7('0x0')]=_0x445a8e['exten']||'';this['recordingFormat']=_0x445a8e[_0xa9c7('0x1')]||_0xa9c7('0x2');this[_0xa9c7('0x3')]=_0x445a8e[_0xa9c7('0x3')]||![];}module[_0xa9c7('0x4')]=voiceExtension; \ No newline at end of file +var _0x4db1=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x18d0d5,_0x8c1499){var _0x17d1f4=function(_0x3d6d4e){while(--_0x3d6d4e){_0x18d0d5['push'](_0x18d0d5['shift']());}};_0x17d1f4(++_0x8c1499);}(_0x4db1,0xe3));var _0x14db=function(_0x320b8e,_0x1da3fe){_0x320b8e=_0x320b8e-0x0;var _0x55a10a=_0x4db1[_0x320b8e];return _0x55a10a;};'use strict';function voiceExtension(_0x986d68){this['id']=_0x986d68['id']||0x0;this['exten']=_0x986d68[_0x14db('0x0')]||'';this[_0x14db('0x1')]=_0x986d68['recordingFormat']||_0x14db('0x2');this[_0x14db('0x3')]=_0x986d68['mandatoryDisposition']||![];}module[_0x14db('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 d2fbd53..7716dd6 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 _0x86f0=['predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','invalid','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','name','monitor_format','type','waiting','total','sumHoldTime','sumBillable','unmanaged','abandoned','acw','acwTimeout','autopause','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor'];(function(_0x46342b,_0x4f071e){var _0xa65641=function(_0x134a0f){while(--_0x134a0f){_0x46342b['push'](_0x46342b['shift']());}};_0xa65641(++_0x4f071e);}(_0x86f0,0x1e4));var _0x086f=function(_0xc0e9f9,_0x4a10e2){_0xc0e9f9=_0xc0e9f9-0x0;var _0x21d33d=_0x86f0[_0xc0e9f9];return _0x21d33d;};'use strict';var statusDesc=[_0x086f('0x0'),_0x086f('0x1'),_0x086f('0x2'),'busy',_0x086f('0x3'),'unavailable',_0x086f('0x4'),_0x086f('0x5'),_0x086f('0x6')];var monitorFormat={'wav':_0x086f('0x7'),'wav49':_0x086f('0x8'),'gsm':_0x086f('0x9')};var strategy={'rrmemory':_0x086f('0xa'),'roundrobin':'roundrobin'};function VoiceQueue(_0xaf39cf){this['id']=_0xaf39cf['id']||0x0;this[_0x086f('0xb')]=_0xaf39cf['name']||'';this[_0x086f('0xc')]=_0xaf39cf[_0x086f('0xc')]||'';this[_0x086f('0xd')]=_0xaf39cf[_0x086f('0xd')]||'inbound';this[_0x086f('0xe')]=0x0;this['talking']=0x0;this[_0x086f('0xf')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0x086f('0x10')]=0x0;this[_0x086f('0x11')]=0x0;this[_0x086f('0x12')]=0x0;this[_0x086f('0x13')]=0x0;this['loggedIn']=0x0;this['available']=0x0;this[_0x086f('0x14')]=_0xaf39cf['acw']||![];this[_0x086f('0x15')]=_0xaf39cf[_0x086f('0x15')]||0xa;this[_0x086f('0x16')]=_0xaf39cf['autopause']||'no';this['sendMessageOneNotActive']=!![];this[_0x086f('0x17')]='';this[_0x086f('0x18')]=0x0;this['temp']=0x0;this[_0x086f('0x19')]=_0xaf39cf[_0x086f('0x19')]||null;this[_0x086f('0x1a')]=_0xaf39cf[_0x086f('0x1a')]?_0xaf39cf[_0x086f('0x1a')]:null;this[_0x086f('0x1b')]=_0xaf39cf[_0x086f('0x1b')];this[_0x086f('0x1c')]=_0xaf39cf['dialMethod']||'progressive';this[_0x086f('0x1d')]=_0xaf39cf[_0x086f('0x1d')]||0x0;this['dialLimitQueue']=_0xaf39cf[_0x086f('0x1e')]||0x0;this[_0x086f('0x1f')]=_0xaf39cf['dialPowerLevel']||0x1;this[_0x086f('0x20')]=_0xaf39cf[_0x086f('0x20')]||_0x086f('0x21');this[_0x086f('0x22')]=_0xaf39cf[_0x086f('0x22')]||0.03;this[_0x086f('0x23')]=_0xaf39cf[_0x086f('0x23')]||0x258;this[_0x086f('0x24')]=_0xaf39cf['dialOriginateCallerIdName']||_0x086f('0x25');this[_0x086f('0x26')]=_0xaf39cf['dialOriginateCallerIdNumber']||_0x086f('0x25');this[_0x086f('0x27')]=_0xaf39cf[_0x086f('0x27')]||0x1e;this['dialQueueOptions']=_0xaf39cf['dialQueueOptions']||_0x086f('0x28');this['dialQueueTimeout']=_0xaf39cf[_0x086f('0x29')]||0x3;this[_0x086f('0x2a')]=_0xaf39cf['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0xaf39cf[_0x086f('0x2b')]||0x3;this[_0x086f('0x2c')]=_0xaf39cf['dialCongestionRetryFrequency']||0x96;this[_0x086f('0x2d')]=_0xaf39cf[_0x086f('0x2d')]||0x3;this[_0x086f('0x2e')]=_0xaf39cf[_0x086f('0x2e')]||0x96;this[_0x086f('0x2f')]=_0xaf39cf[_0x086f('0x2f')]||0x3;this[_0x086f('0x30')]=_0xaf39cf[_0x086f('0x30')]||0x96;this[_0x086f('0x31')]=_0xaf39cf[_0x086f('0x31')]||0x3;this[_0x086f('0x32')]=_0xaf39cf[_0x086f('0x32')]||0x96;this['dialDropMaxRetry']=_0xaf39cf[_0x086f('0x33')]||0x3;this['dialDropRetryFrequency']=_0xaf39cf['dialDropRetryFrequency']||0x96;this[_0x086f('0x34')]=_0xaf39cf[_0x086f('0x34')]||0x3;this[_0x086f('0x35')]=_0xaf39cf[_0x086f('0x35')]||0x96;this[_0x086f('0x36')]=_0xaf39cf[_0x086f('0x36')]||0x3;this[_0x086f('0x37')]=_0xaf39cf['dialMachineRetryFrequency']||0x96;this[_0x086f('0x38')]=_0xaf39cf[_0x086f('0x38')]||0x3;this[_0x086f('0x39')]=_0xaf39cf[_0x086f('0x39')]||0x96;this[_0x086f('0x3a')]=_0xaf39cf[_0x086f('0x3a')]||0x4;this[_0x086f('0x3b')]=_0xaf39cf[_0x086f('0x3b')]?_0xaf39cf['Trunk']:undefined;this[_0x086f('0x3c')]=_0xaf39cf['TrunkBackup']?_0xaf39cf[_0x086f('0x3c')]:undefined;this[_0x086f('0x3d')]=_0xaf39cf[_0x086f('0x3d')]||undefined;this[_0x086f('0x3e')]=_0xaf39cf[_0x086f('0x3e')]?_0xaf39cf[_0x086f('0x3e')]:undefined;this[_0x086f('0x3f')]=_0xaf39cf['dialOrderByScheduledAt']||_0x086f('0x40');this[_0x086f('0x41')]=_0xaf39cf[_0x086f('0x41')]||undefined;this['dialCutDigit']=_0xaf39cf[_0x086f('0x42')]||undefined;this[_0x086f('0x43')]=strategy[_0xaf39cf['strategy']]||_0x086f('0xa');this['queueStatusComplete']=!![];this[_0x086f('0x44')]=_0xaf39cf[_0x086f('0x44')]||![];this[_0x086f('0x45')]=_0xaf39cf['dialAMDInitialSilence'];this['dialAMDGreeting']=_0xaf39cf['dialAMDGreeting'];this[_0x086f('0x46')]=_0xaf39cf[_0x086f('0x46')];this[_0x086f('0x47')]=_0xaf39cf[_0x086f('0x47')];this[_0x086f('0x48')]=_0xaf39cf[_0x086f('0x48')];this[_0x086f('0x49')]=_0xaf39cf['dialAMDBetweenWordsSilence'];this[_0x086f('0x4a')]=_0xaf39cf['dialAMDMaximumNumberOfWords'];this[_0x086f('0x4b')]=_0xaf39cf['dialAMDSilenceThreshold'];this[_0x086f('0x4c')]=_0xaf39cf[_0x086f('0x4c')];this[_0x086f('0x4d')]=0x0;this[_0x086f('0x4e')]=0x0;this['timeout']=_0xaf39cf[_0x086f('0x4f')];this['outboundAnswerCallsDay']=0x0;this[_0x086f('0x50')]=0x0;this[_0x086f('0x51')]=0x0;this[_0x086f('0x52')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x086f('0x53')]=0x0;this[_0x086f('0x54')]=0x0;this[_0x086f('0x55')]=0x0;this[_0x086f('0x56')]=0x0;this[_0x086f('0x57')]=0x0;this[_0x086f('0x58')]=0x0;this[_0x086f('0x59')]=0x0;this[_0x086f('0x5a')]=0x0;this[_0x086f('0x5b')]=0x0;this[_0x086f('0x5c')]=undefined;this[_0x086f('0x5d')]=undefined;this[_0x086f('0x5e')]=undefined;this[_0x086f('0x5f')]=1.05;this[_0x086f('0x60')]=0x0;this[_0x086f('0x61')]=0x0;this[_0x086f('0x62')]=0x0;this[_0x086f('0x63')]=0x0;this[_0x086f('0x64')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this[_0x086f('0x65')]=0x0;this[_0x086f('0x66')]=_0xaf39cf['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0xaf39cf[_0x086f('0x67')]||0xa;this[_0x086f('0x68')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x086f('0x69')]=0x0;this[_0x086f('0x6a')]=0x0;this[_0x086f('0x6b')]=0x0;this[_0x086f('0x6c')]=0x0;this[_0x086f('0x6d')]=_0xaf39cf['dialRecallMeTimeout']||0x1e;this[_0x086f('0x6e')]=_0xaf39cf['dialRecallInQueue']||![];this['dialQueueProject2']=_0xaf39cf['dialQueueProject2']||undefined;this['dialAgiAfterHangupClient']=_0xaf39cf[_0x086f('0x6f')]||![];this['dialAgiAfterHangupAgent']=_0xaf39cf[_0x086f('0x70')]||![];this['monitor_format']=monitorFormat[_0xaf39cf['monitor_format']]?monitorFormat[_0xaf39cf['monitor_format']]:undefined;this['mandatoryDisposition']=_0xaf39cf[_0x086f('0x71')]||![];this[_0x086f('0x72')]=_0xaf39cf[_0x086f('0x72')]?_0xaf39cf[_0x086f('0x72')]:undefined;}module[_0x086f('0x73')]=VoiceQueue; \ No newline at end of file +var _0xc2f2=['dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','strategy','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','inuse','busy','invalid','ringinuse','onhold','wav','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency'];(function(_0x336df0,_0x12cf1a){var _0x239ef5=function(_0x378c25){while(--_0x378c25){_0x336df0['push'](_0x336df0['shift']());}};_0x239ef5(++_0x12cf1a);}(_0xc2f2,0xb9));var _0x2c2f=function(_0x3c6dce,_0x5424dd){_0x3c6dce=_0x3c6dce-0x0;var _0x1450e9=_0xc2f2[_0x3c6dce];return _0x1450e9;};'use strict';var statusDesc=[_0x2c2f('0x0'),'not_inuse',_0x2c2f('0x1'),_0x2c2f('0x2'),_0x2c2f('0x3'),'unavailable','ringing',_0x2c2f('0x4'),_0x2c2f('0x5')];var monitorFormat={'wav':_0x2c2f('0x6'),'wav49':'wav49','gsm':_0x2c2f('0x7')};var strategy={'rrmemory':_0x2c2f('0x8'),'roundrobin':_0x2c2f('0x9')};function VoiceQueue(_0x513d08){this['id']=_0x513d08['id']||0x0;this['name']=_0x513d08[_0x2c2f('0xa')]||'';this[_0x2c2f('0xb')]=_0x513d08['monitor_format']||'';this[_0x2c2f('0xc')]=_0x513d08[_0x2c2f('0xc')]||_0x2c2f('0xd');this[_0x2c2f('0xe')]=0x0;this[_0x2c2f('0xf')]=0x0;this[_0x2c2f('0x10')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this[_0x2c2f('0x11')]=0x0;this[_0x2c2f('0x12')]=0x0;this[_0x2c2f('0x13')]=0x0;this[_0x2c2f('0x14')]=0x0;this[_0x2c2f('0x15')]=_0x513d08[_0x2c2f('0x15')]||![];this['acwTimeout']=_0x513d08[_0x2c2f('0x16')]||0xa;this[_0x2c2f('0x17')]=_0x513d08[_0x2c2f('0x17')]||'no';this[_0x2c2f('0x18')]=!![];this[_0x2c2f('0x19')]='';this[_0x2c2f('0x1a')]=0x0;this[_0x2c2f('0x1b')]=0x0;this[_0x2c2f('0x1c')]=_0x513d08[_0x2c2f('0x1c')]||null;this['dialGlobalInterval']=_0x513d08['dialGlobalInterval']?_0x513d08['dialGlobalInterval']:null;this[_0x2c2f('0x1d')]=_0x513d08[_0x2c2f('0x1d')];this[_0x2c2f('0x1e')]=_0x513d08[_0x2c2f('0x1e')]||'progressive';this[_0x2c2f('0x1f')]=_0x513d08[_0x2c2f('0x1f')]||0x0;this[_0x2c2f('0x20')]=_0x513d08[_0x2c2f('0x20')]||0x0;this[_0x2c2f('0x21')]=_0x513d08[_0x2c2f('0x21')]||0x1;this[_0x2c2f('0x22')]=_0x513d08[_0x2c2f('0x22')]||_0x2c2f('0x23');this[_0x2c2f('0x24')]=_0x513d08['dialPredictiveOptimizationPercentage']||0.03;this[_0x2c2f('0x25')]=_0x513d08[_0x2c2f('0x25')]||0x258;this[_0x2c2f('0x26')]=_0x513d08[_0x2c2f('0x26')]||_0x2c2f('0x27');this['dialOriginateCallerIdNumber']=_0x513d08[_0x2c2f('0x28')]||_0x2c2f('0x27');this['dialOriginateTimeout']=_0x513d08[_0x2c2f('0x29')]||0x1e;this[_0x2c2f('0x2a')]=_0x513d08[_0x2c2f('0x2a')]||_0x2c2f('0x2b');this[_0x2c2f('0x2c')]=_0x513d08[_0x2c2f('0x2c')]||0x3;this['dialQueueProject']=_0x513d08['dialQueueProject']||undefined;this[_0x2c2f('0x2d')]=_0x513d08['dialCongestionMaxRetry']||0x3;this[_0x2c2f('0x2e')]=_0x513d08['dialCongestionRetryFrequency']||0x96;this[_0x2c2f('0x2f')]=_0x513d08[_0x2c2f('0x2f')]||0x3;this['dialBusyRetryFrequency']=_0x513d08[_0x2c2f('0x30')]||0x96;this['dialNoAnswerMaxRetry']=_0x513d08[_0x2c2f('0x31')]||0x3;this[_0x2c2f('0x32')]=_0x513d08[_0x2c2f('0x32')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x513d08[_0x2c2f('0x33')]||0x3;this[_0x2c2f('0x34')]=_0x513d08[_0x2c2f('0x34')]||0x96;this[_0x2c2f('0x35')]=_0x513d08[_0x2c2f('0x35')]||0x3;this[_0x2c2f('0x36')]=_0x513d08[_0x2c2f('0x36')]||0x96;this[_0x2c2f('0x37')]=_0x513d08[_0x2c2f('0x37')]||0x3;this[_0x2c2f('0x38')]=_0x513d08['dialAbandonedRetryFrequency']||0x96;this[_0x2c2f('0x39')]=_0x513d08['dialMachineMaxRetry']||0x3;this[_0x2c2f('0x3a')]=_0x513d08[_0x2c2f('0x3a')]||0x96;this[_0x2c2f('0x3b')]=_0x513d08['dialAgentRejectMaxRetry']||0x3;this[_0x2c2f('0x3c')]=_0x513d08[_0x2c2f('0x3c')]||0x96;this[_0x2c2f('0x3d')]=_0x513d08['dialGlobalMaxRetry']||0x4;this[_0x2c2f('0x3e')]=_0x513d08[_0x2c2f('0x3e')]?_0x513d08['Trunk']:undefined;this[_0x2c2f('0x3f')]=_0x513d08[_0x2c2f('0x3f')]?_0x513d08[_0x2c2f('0x3f')]:undefined;this['dialPrefix']=_0x513d08[_0x2c2f('0x40')]||undefined;this[_0x2c2f('0x41')]=_0x513d08[_0x2c2f('0x41')]?_0x513d08[_0x2c2f('0x41')]:undefined;this[_0x2c2f('0x42')]=_0x513d08[_0x2c2f('0x42')]||_0x2c2f('0x43');this[_0x2c2f('0x44')]=_0x513d08['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x513d08['dialCutDigit']||undefined;this[_0x2c2f('0x45')]=strategy[_0x513d08[_0x2c2f('0x45')]]||'rrmemory';this['queueStatusComplete']=!![];this['dialAMDActive']=_0x513d08['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x513d08[_0x2c2f('0x46')];this[_0x2c2f('0x47')]=_0x513d08[_0x2c2f('0x47')];this[_0x2c2f('0x48')]=_0x513d08[_0x2c2f('0x48')];this['dialAMDTotalAnalysisTime']=_0x513d08[_0x2c2f('0x49')];this[_0x2c2f('0x4a')]=_0x513d08[_0x2c2f('0x4a')];this[_0x2c2f('0x4b')]=_0x513d08[_0x2c2f('0x4b')];this[_0x2c2f('0x4c')]=_0x513d08[_0x2c2f('0x4c')];this[_0x2c2f('0x4d')]=_0x513d08['dialAMDSilenceThreshold'];this[_0x2c2f('0x4e')]=_0x513d08[_0x2c2f('0x4e')];this[_0x2c2f('0x4f')]=0x0;this[_0x2c2f('0x50')]=0x0;this[_0x2c2f('0x51')]=_0x513d08[_0x2c2f('0x51')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x2c2f('0x52')]=0x0;this[_0x2c2f('0x53')]=0x0;this[_0x2c2f('0x54')]=0x0;this[_0x2c2f('0x55')]=0x0;this[_0x2c2f('0x56')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x2c2f('0x57')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x2c2f('0x58')]=0x0;this[_0x2c2f('0x59')]=0x0;this[_0x2c2f('0x5a')]=0x0;this[_0x2c2f('0x5b')]=0x0;this['startProgressive']=undefined;this[_0x2c2f('0x5c')]=undefined;this[_0x2c2f('0x5d')]=undefined;this[_0x2c2f('0x5e')]=1.05;this[_0x2c2f('0x5f')]=0x0;this[_0x2c2f('0x60')]=0x0;this[_0x2c2f('0x61')]=0x0;this[_0x2c2f('0x62')]=0x0;this[_0x2c2f('0x63')]=0x0;this[_0x2c2f('0x64')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x2c2f('0x65')]=0x0;this[_0x2c2f('0x66')]=_0x513d08[_0x2c2f('0x67')]||0x14;this['predictiveIntervalMinThreshold']=_0x513d08[_0x2c2f('0x67')]||0xa;this[_0x2c2f('0x68')]=0x0;this[_0x2c2f('0x69')]=0x0;this[_0x2c2f('0x6a')]=0x1;this[_0x2c2f('0x6b')]=0x0;this['erlangCallToSecond']=0x0;this[_0x2c2f('0x6c')]=0x0;this[_0x2c2f('0x6d')]=0x0;this['dialRecallMeTimeout']=_0x513d08['dialRecallMeTimeout']||0x1e;this[_0x2c2f('0x6e')]=_0x513d08[_0x2c2f('0x6e')]||![];this[_0x2c2f('0x6f')]=_0x513d08[_0x2c2f('0x6f')]||undefined;this[_0x2c2f('0x70')]=_0x513d08[_0x2c2f('0x70')]||![];this['dialAgiAfterHangupAgent']=_0x513d08[_0x2c2f('0x71')]||![];this[_0x2c2f('0xb')]=monitorFormat[_0x513d08[_0x2c2f('0xb')]]?monitorFormat[_0x513d08[_0x2c2f('0xb')]]:undefined;this[_0x2c2f('0x72')]=_0x513d08[_0x2c2f('0x72')]||![];this['mandatoryDispositionPause']=_0x513d08[_0x2c2f('0x73')]?_0x513d08[_0x2c2f('0x73')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index a8ebfe9..245f5f1 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 _0xbfc1=['accessKey','remoteUri','serverUrl','Configurations','name','username'];(function(_0x3584be,_0x34385a){var _0xef556b=function(_0x160783){while(--_0x160783){_0x3584be['push'](_0x3584be['shift']());}};_0xef556b(++_0x34385a);}(_0xbfc1,0xc4));var _0x1bfc=function(_0xe4231c,_0x399021){_0xe4231c=_0xe4231c-0x0;var _0x1ac8c8=_0xbfc1[_0xe4231c];return _0x1ac8c8;};'use strict';function VtigerAccount(_0x2f4694){this['id']=_0x2f4694['id']||0x0;this[_0x1bfc('0x0')]=_0x2f4694[_0x1bfc('0x0')]||'';this['username']=_0x2f4694[_0x1bfc('0x1')]||'';this[_0x1bfc('0x2')]=_0x2f4694['accessKey']||'';this[_0x1bfc('0x3')]=_0x2f4694['remoteUri']||'';this['serverUrl']=_0x2f4694[_0x1bfc('0x4')]||'';this[_0x1bfc('0x5')]=_0x2f4694[_0x1bfc('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x2708=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x3985d4,_0x516d1b){var _0x36905d=function(_0x5b3754){while(--_0x5b3754){_0x3985d4['push'](_0x3985d4['shift']());}};_0x36905d(++_0x516d1b);}(_0x2708,0x159));var _0x8270=function(_0x2aa42a,_0x1f093c){_0x2aa42a=_0x2aa42a-0x0;var _0x4e7015=_0x2708[_0x2aa42a];return _0x4e7015;};'use strict';function VtigerAccount(_0x3a7420){this['id']=_0x3a7420['id']||0x0;this[_0x8270('0x0')]=_0x3a7420[_0x8270('0x0')]||'';this[_0x8270('0x1')]=_0x3a7420[_0x8270('0x1')]||'';this[_0x8270('0x2')]=_0x3a7420['accessKey']||'';this['remoteUri']=_0x3a7420[_0x8270('0x3')]||'';this['serverUrl']=_0x3a7420[_0x8270('0x4')]||'';this[_0x8270('0x5')]=_0x3a7420[_0x8270('0x5')]||{};}module[_0x8270('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 d2bb1b0..e6cc11d 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 _0xd4f2=['name','username','password','token','remoteUri','authType','integrationTab','Configurations','exports'];(function(_0x5e87a2,_0x1f46f7){var _0x174e52=function(_0x82eb1e){while(--_0x82eb1e){_0x5e87a2['push'](_0x5e87a2['shift']());}};_0x174e52(++_0x1f46f7);}(_0xd4f2,0x129));var _0x2d4f=function(_0x4c615d,_0x4c6b17){_0x4c615d=_0x4c615d-0x0;var _0x15a659=_0xd4f2[_0x4c615d];return _0x15a659;};'use strict';function ZendeskAccount(_0x1b01e3){this['id']=_0x1b01e3['id']||0x0;this[_0x2d4f('0x0')]=_0x1b01e3[_0x2d4f('0x0')]||'';this[_0x2d4f('0x1')]=_0x1b01e3['username']||'';this[_0x2d4f('0x2')]=_0x1b01e3[_0x2d4f('0x2')]||'';this[_0x2d4f('0x3')]=_0x1b01e3[_0x2d4f('0x3')]||'';this[_0x2d4f('0x4')]=_0x1b01e3['remoteUri']||'';this[_0x2d4f('0x5')]=_0x1b01e3[_0x2d4f('0x5')]||'';this['type']=_0x1b01e3['type']||_0x2d4f('0x6');this['serverUrl']=_0x1b01e3['serverUrl']||'';this[_0x2d4f('0x7')]=_0x1b01e3[_0x2d4f('0x7')]||{};}module[_0x2d4f('0x8')]=ZendeskAccount; \ No newline at end of file +var _0x30f9=['username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x41c3bb,_0x28628e){var _0x380afa=function(_0x5b6378){while(--_0x5b6378){_0x41c3bb['push'](_0x41c3bb['shift']());}};_0x380afa(++_0x28628e);}(_0x30f9,0xba));var _0x930f=function(_0x33feca,_0x2bd9ae){_0x33feca=_0x33feca-0x0;var _0x3c558f=_0x30f9[_0x33feca];return _0x3c558f;};'use strict';function ZendeskAccount(_0x42b87c){this['id']=_0x42b87c['id']||0x0;this[_0x930f('0x0')]=_0x42b87c['name']||'';this[_0x930f('0x1')]=_0x42b87c['username']||'';this['password']=_0x42b87c[_0x930f('0x2')]||'';this[_0x930f('0x3')]=_0x42b87c['token']||'';this['remoteUri']=_0x42b87c[_0x930f('0x4')]||'';this[_0x930f('0x5')]=_0x42b87c[_0x930f('0x5')]||'';this[_0x930f('0x6')]=_0x42b87c[_0x930f('0x6')]||_0x930f('0x7');this[_0x930f('0x8')]=_0x42b87c['serverUrl']||'';this[_0x930f('0x9')]=_0x42b87c[_0x930f('0x9')]||{};}module[_0x930f('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 616e0de..d4d0e75 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 _0xb525=['code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x4da086,_0x508a4d){var _0x1b582e=function(_0x45be66){while(--_0x45be66){_0x4da086['push'](_0x4da086['shift']());}};_0x1b582e(++_0x508a4d);}(_0xb525,0x1c7));var _0x5b52=function(_0x6afa07,_0xc2859e){_0x6afa07=_0x6afa07-0x0;var _0x3a9c2d=_0xb525[_0x6afa07];return _0x3a9c2d;};'use strict';function ZohoAccount(_0x44c665){this['id']=_0x44c665['id']||0x0;this['name']=_0x44c665[_0x5b52('0x0')]||'';this[_0x5b52('0x1')]=_0x44c665[_0x5b52('0x1')]||'';this[_0x5b52('0x2')]=_0x44c665['host']||'';this[_0x5b52('0x3')]=_0x44c665[_0x5b52('0x3')]||'';this[_0x5b52('0x4')]=_0x44c665[_0x5b52('0x4')]||'';this[_0x5b52('0x5')]=_0x44c665[_0x5b52('0x5')]||'';this[_0x5b52('0x6')]=_0x44c665[_0x5b52('0x6')]||'';this[_0x5b52('0x7')]=_0x44c665[_0x5b52('0x7')]||'';this[_0x5b52('0x8')]=_0x44c665[_0x5b52('0x8')]||'';this[_0x5b52('0x9')]=_0x44c665[_0x5b52('0x9')]||{};}module[_0x5b52('0xa')]=ZohoAccount; \ No newline at end of file +var _0xd1bd=['description','host','zone','clientId','serverUrl','code','refreshToken','Configurations','name'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0xd1bd,0x15e));var _0xdd1b=function(_0x5e04cd,_0x253d2e){_0x5e04cd=_0x5e04cd-0x0;var _0x456788=_0xd1bd[_0x5e04cd];return _0x456788;};'use strict';function ZohoAccount(_0x108a86){this['id']=_0x108a86['id']||0x0;this['name']=_0x108a86[_0xdd1b('0x0')]||'';this[_0xdd1b('0x1')]=_0x108a86['description']||'';this[_0xdd1b('0x2')]=_0x108a86[_0xdd1b('0x2')]||'';this[_0xdd1b('0x3')]=_0x108a86[_0xdd1b('0x3')]||'';this[_0xdd1b('0x4')]=_0x108a86[_0xdd1b('0x4')]||'';this['clientSecret']=_0x108a86['clientSecret']||'';this[_0xdd1b('0x5')]=_0x108a86[_0xdd1b('0x5')]||'';this[_0xdd1b('0x6')]=_0x108a86[_0xdd1b('0x6')]||'';this[_0xdd1b('0x7')]=_0x108a86[_0xdd1b('0x7')]||'';this[_0xdd1b('0x8')]=_0x108a86['Configurations']||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index cd1d728..05b6461 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 _0x7b7f=['ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','calleridname','number','exports','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','membername','Agent','channelAgent','format','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackat','recallme','ContactId'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7b7f,0xb6));var _0xf7b7=function(_0x424501,_0x42096d){_0x424501=_0x424501-0x0;var _0xb719af=_0x7b7f[_0x424501];return _0xb719af;};'use strict';var util=require('util');var _=require(_0xf7b7('0x0'));var moment=require(_0xf7b7('0x1'));function checkNameSurname(_0x4e922f,_0x31fcbe,_0x5a4387){var _0x4a40f4='';if(!_[_0xf7b7('0x2')](_0x31fcbe)&&_0xf7b7('0x3')===typeof _0x31fcbe){_0x4a40f4+=_0x31fcbe;}if(!_[_0xf7b7('0x2')](_0x5a4387)&&'string'===typeof _0x5a4387){_0x4a40f4+='\x20'+_0x5a4387;}if(_0x4a40f4!==''){return _0x4a40f4;}return _0x4e922f;}function Action(_0x4e9a64,_0x33d8d1,_0x38e8cc,_0x14ca77,_0x2829ea){this[_0xf7b7('0x4')]=_0x38e8cc||undefined;this[_0xf7b7('0x5')]=_0x4e9a64['id'];this[_0xf7b7('0x6')]=_0x33d8d1[_0xf7b7('0x7')];this[_0xf7b7('0x8')]=_0x33d8d1[_0xf7b7('0x8')];this['campaigntype']='queue';this['dialAnswer']=![];this[_0xf7b7('0x9')]=_[_0xf7b7('0x2')](_0x4e9a64['Agent'])?undefined:_0x4e9a64[_0xf7b7('0xa')][_0xf7b7('0x7')];this[_0xf7b7('0xb')]=this[_0xf7b7('0x9')]?util[_0xf7b7('0xc')]('SIP/%s',this[_0xf7b7('0x9')]):_0x14ca77||undefined;this['calleridname']=checkNameSurname(_0x4e9a64[_0xf7b7('0xd')][_0xf7b7('0xe')],_0x4e9a64['Contact'][_0xf7b7('0xf')],_0x4e9a64[_0xf7b7('0xd')][_0xf7b7('0x10')]);this[_0xf7b7('0x11')]=_0x4e9a64[_0xf7b7('0x11')]||![];this[_0xf7b7('0x12')]=_0x4e9a64[_0xf7b7('0xd')][_0xf7b7('0xe')];this[_0xf7b7('0x13')]=_0x4e9a64[_0xf7b7('0x13')];this['countbusyretry']=_0x4e9a64[_0xf7b7('0x14')]||0x0;this[_0xf7b7('0x15')]=_0x4e9a64[_0xf7b7('0x15')]||0x0;this[_0xf7b7('0x16')]=_0x4e9a64[_0xf7b7('0x16')]||0x0;this[_0xf7b7('0x17')]=(_0x4e9a64['countbusyretry']||0x0)+(_0x4e9a64[_0xf7b7('0x15')]||0x0)+(_0x4e9a64[_0xf7b7('0x16')]||0x0)+(_0x4e9a64[_0xf7b7('0x18')]||0x0)+(_0x4e9a64[_0xf7b7('0x19')]||0x0)+(_0x4e9a64[_0xf7b7('0x1a')]||0x0)+(_0x4e9a64[_0xf7b7('0x1b')]||0x0)+(_0x4e9a64[_0xf7b7('0x1c')]||0x0);this['countnosuchnumberretry']=_0x4e9a64[_0xf7b7('0x18')]||0x0;this[_0xf7b7('0x19')]=_0x4e9a64['countdropretry']||0x0;this['countabandonedretry']=_0x4e9a64[_0xf7b7('0x1a')]||0x0;this[_0xf7b7('0x1b')]=_0x4e9a64[_0xf7b7('0x1b')]||0x0;this['countagentrejectretry']=_0x4e9a64[_0xf7b7('0x1c')]||0x0;this[_0xf7b7('0x1d')]=_0x4e9a64['callback'];this['callbackuniqueid']=_0x4e9a64['callbackuniqueid'];this[_0xf7b7('0x1e')]=_0x4e9a64['callbackat'];this[_0xf7b7('0x1f')]=_0x4e9a64[_0xf7b7('0x1f')];this[_0xf7b7('0x20')]=_0x4e9a64[_0xf7b7('0x20')];this['ListId']=_0x4e9a64[_0xf7b7('0x21')];this[_0xf7b7('0x22')]=_['isNil'](_0x4e9a64['Agent'])?_0x4e9a64[_0xf7b7('0x22')]:_0x4e9a64[_0xf7b7('0xa')]['id'];this[_0xf7b7('0x23')]=_0x4e9a64[_0xf7b7('0x23')];this[_0xf7b7('0x24')]='';this[_0xf7b7('0x25')]='';}Action[_0xf7b7('0x26')][_0xf7b7('0x27')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0xf7b7('0x28')],this[_0xf7b7('0x29')]);};module[_0xf7b7('0x2a')]=Action; \ No newline at end of file +var _0xe824=['util','moment','isNil','string','uniqueid','name','type','campaigntype','queue','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','phone','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number'];(function(_0x5a879d,_0x34de05){var _0x11f18b=function(_0x9d9c25){while(--_0x9d9c25){_0x5a879d['push'](_0x5a879d['shift']());}};_0x11f18b(++_0x34de05);}(_0xe824,0x1ae));var _0x4e82=function(_0x29638f,_0x5dfb8a){_0x29638f=_0x29638f-0x0;var _0x4c2121=_0xe824[_0x29638f];return _0x4c2121;};'use strict';var util=require(_0x4e82('0x0'));var _=require('lodash');var moment=require(_0x4e82('0x1'));function checkNameSurname(_0x494648,_0x5e3912,_0x5256e8){var _0x2156e9='';if(!_[_0x4e82('0x2')](_0x5e3912)&&_0x4e82('0x3')===typeof _0x5e3912){_0x2156e9+=_0x5e3912;}if(!_[_0x4e82('0x2')](_0x5256e8)&&_0x4e82('0x3')===typeof _0x5256e8){_0x2156e9+='\x20'+_0x5256e8;}if(_0x2156e9!==''){return _0x2156e9;}return _0x494648;}function Action(_0x1a136d,_0x3d4408,_0x2de13a,_0x42ed9e,_0x1cb7a1){this[_0x4e82('0x4')]=_0x2de13a||undefined;this['idContact']=_0x1a136d['id'];this['queue']=_0x3d4408[_0x4e82('0x5')];this[_0x4e82('0x6')]=_0x3d4408[_0x4e82('0x6')];this[_0x4e82('0x7')]=_0x4e82('0x8');this[_0x4e82('0x9')]=![];this[_0x4e82('0xa')]=_[_0x4e82('0x2')](_0x1a136d[_0x4e82('0xb')])?undefined:_0x1a136d['Agent']['name'];this[_0x4e82('0xc')]=this['membername']?util[_0x4e82('0xd')](_0x4e82('0xe'),this[_0x4e82('0xa')]):_0x42ed9e||undefined;this[_0x4e82('0xf')]=checkNameSurname(_0x1a136d['Contact'][_0x4e82('0x10')],_0x1a136d['Contact']['firstName'],_0x1a136d['Contact'][_0x4e82('0x11')]);this[_0x4e82('0x12')]=_0x1a136d[_0x4e82('0x12')]||![];this['calleridnum']=_0x1a136d['Contact'][_0x4e82('0x10')];this['scheduledat']=_0x1a136d[_0x4e82('0x13')];this[_0x4e82('0x14')]=_0x1a136d['countbusyretry']||0x0;this[_0x4e82('0x15')]=_0x1a136d[_0x4e82('0x15')]||0x0;this['countnoanswerretry']=_0x1a136d[_0x4e82('0x16')]||0x0;this[_0x4e82('0x17')]=(_0x1a136d['countbusyretry']||0x0)+(_0x1a136d[_0x4e82('0x15')]||0x0)+(_0x1a136d[_0x4e82('0x16')]||0x0)+(_0x1a136d[_0x4e82('0x18')]||0x0)+(_0x1a136d[_0x4e82('0x19')]||0x0)+(_0x1a136d[_0x4e82('0x1a')]||0x0)+(_0x1a136d['countmachineretry']||0x0)+(_0x1a136d['countagentrejectretry']||0x0);this[_0x4e82('0x18')]=_0x1a136d[_0x4e82('0x18')]||0x0;this[_0x4e82('0x19')]=_0x1a136d[_0x4e82('0x19')]||0x0;this[_0x4e82('0x1a')]=_0x1a136d[_0x4e82('0x1a')]||0x0;this['countmachineretry']=_0x1a136d[_0x4e82('0x1b')]||0x0;this[_0x4e82('0x1c')]=_0x1a136d[_0x4e82('0x1c')]||0x0;this[_0x4e82('0x1d')]=_0x1a136d[_0x4e82('0x1d')];this[_0x4e82('0x1e')]=_0x1a136d[_0x4e82('0x1e')];this[_0x4e82('0x1f')]=_0x1a136d[_0x4e82('0x1f')];this['recallme']=_0x1a136d[_0x4e82('0x20')];this['ContactId']=_0x1a136d[_0x4e82('0x21')];this[_0x4e82('0x22')]=_0x1a136d[_0x4e82('0x22')];this[_0x4e82('0x23')]=_[_0x4e82('0x2')](_0x1a136d[_0x4e82('0xb')])?_0x1a136d[_0x4e82('0x23')]:_0x1a136d['Agent']['id'];this['VoiceQueueId']=_0x1a136d[_0x4e82('0x24')];this[_0x4e82('0x25')]='';this[_0x4e82('0x26')]='';}Action[_0x4e82('0x27')][_0x4e82('0x28')]=function(){return util[_0x4e82('0xd')](_0x4e82('0x29'),this[_0x4e82('0xf')],this[_0x4e82('0x2a')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 18fe401..4ab96d9 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 _0x3c73=['agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','originated:\x20','destlinkedid','isUndefined','object','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','isNil','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','execCall','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','createHistory','SIP/%s','unmonitored','run','execRun','unlock','getContactPreview','recallme','isValid','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','isEmpty','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','getCallerId','callerid','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridName','extractCalleridNumber','merge','variablesAction','channelAgent','destconnectedlinenum','calleridnum','user:agentconnect','accountcode','[originated][increment]','[originateFailure][logOriginateFailure]','logLookAgent','clone','isFailure','response','unlockContact','idContact','custom:agentringnoanswer','callProgressDetectingAgent','[syncHangup][talking]','cause','statedesc','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destuniqueid','addVariable','variables','filterKey','variable','keys','value','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/logger','preview','./rpcDb','./util/util','redis','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','hangup','syncHangup','hanguprequest','syncHangupRequest','bind','dialend','syncDialEnd','syncNewExten','varset','syncVarSet','attendedtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','unmanaged','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','originated','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','name','active','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','voice_queue_channel:remove','sendMessageOneNotActive','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','message','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','dialActive','clearZombieChannel','[clearZombieChannels][talking]','Queue','actions','queue','dialAnswer','pick','UserId','Action','status','channel','catch','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','size','recallMe','agentReadyId','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','then','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','AGENTS_NOT_LOGGED','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','buildObj','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','countnosuchnumberretry','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','ANSWER','responsetime','answertime','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','rescheduleContact','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','activeContact','outboundCongestionCallsDay','countcongestionretry','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','countagentrejectretry','AgentReject'];(function(_0x4e0090,_0x803be0){var _0x180148=function(_0xcc8682){while(--_0xcc8682){_0x4e0090['push'](_0x4e0090['shift']());}};_0x180148(++_0x803be0);}(_0x3c73,0x1c2));var _0x33c7=function(_0x33da80,_0x405e57){_0x33da80=_0x33da80-0x0;var _0x4cacf1=_0x3c73[_0x33da80];return _0x4cacf1;};'use strict';var util=require(_0x33c7('0x0'));var _=require(_0x33c7('0x1'));var BPromise=require(_0x33c7('0x2'));var uuid=require(_0x33c7('0x3'));var moment=require(_0x33c7('0x4'));var md5=require(_0x33c7('0x5'));var Redis=require(_0x33c7('0x6'));var config=require('../../../config/environment');var logger=require(_0x33c7('0x7'))(_0x33c7('0x8'));var loggerAction=require(_0x33c7('0x7'))('actionPreview');var ami=require('../ami');var rpcDb=require(_0x33c7('0x9'));var Action=require('./action');var ut=require(_0x33c7('0xa'));config['redis']=_['defaults'](config[_0x33c7('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x33c7('0xc'))(new Redis(config[_0x33c7('0xb')]));var Sequence=function(){};Sequence[_0x33c7('0xd')][_0x33c7('0xe')]=function(_0x15b651){this[_0x33c7('0xf')]=this[_0x33c7('0xf')]?this['tail'][_0x33c7('0x10')](_0x15b651):_0x15b651();};function Preview(_0x5251be){this[_0x33c7('0x11')]=new Sequence();this[_0x33c7('0x12')]=_0x5251be[_0x33c7('0x13')];this[_0x33c7('0x14')]=_0x5251be['trunks'];this['actions']={};this['agents']=_0x5251be[_0x33c7('0x15')];this[_0x33c7('0x16')]=0x0;ami['on'](_0x33c7('0x17'),this[_0x33c7('0x18')]['bind'](this));ami['on'](_0x33c7('0x19'),this[_0x33c7('0x1a')]['bind'](this));ami['on'](_0x33c7('0x1b'),this[_0x33c7('0x1c')][_0x33c7('0x1d')](this));ami['on'](_0x33c7('0x1e'),this[_0x33c7('0x1f')][_0x33c7('0x1d')](this));ami['on']('newexten',this[_0x33c7('0x20')][_0x33c7('0x1d')](this));ami['on'](_0x33c7('0x21'),this[_0x33c7('0x22')][_0x33c7('0x1d')](this));ami['on'](_0x33c7('0x23'),this['syncAttendedTransfer'][_0x33c7('0x1d')](this));ami['on']('blindtransfer',this[_0x33c7('0x24')][_0x33c7('0x1d')](this));this[_0x33c7('0x25')](this[_0x33c7('0x12')]);}function emit(_0x1236f7,_0x3420d4,_0x9e99f8){io['to'](_0x1236f7)[_0x33c7('0x26')](_0x3420d4,_0x9e99f8);}function emitCampaignPreview(_0x439f14){if(_0x439f14[_0x33c7('0x27')]===_0x33c7('0x28')){var _0x37ff93={'id':_0x439f14['id'],'name':_0x439f14['name'],'strategy':_0x439f14['strategy'],'answered':_0x439f14[_0x33c7('0x29')],'available':_0x439f14[_0x33c7('0x2a')],'loggedIn':_0x439f14[_0x33c7('0x2b')],'pTalking':_0x439f14[_0x33c7('0x2c')],'sumBillable':_0x439f14[_0x33c7('0x2d')],'sumDuration':_0x439f14[_0x33c7('0x2e')],'sumHoldTime':_0x439f14['sumHoldTime']||0x0,'talking':_0x439f14[_0x33c7('0x2f')],'total':_0x439f14[_0x33c7('0x30')],'type':_0x439f14[_0x33c7('0x27')],'unmanaged':_0x439f14[_0x33c7('0x31')],'abandoned':_0x439f14['abandoned'],'waiting':_0x439f14[_0x33c7('0x32')],'loggedInDb':_0x439f14[_0x33c7('0x33')],'dialActive':_0x439f14['dialActive'],'dialMethod':_0x439f14[_0x33c7('0x34')],'dialOriginateCallerIdName':_0x439f14[_0x33c7('0x35')],'dialOriginateCallerIdNumber':_0x439f14[_0x33c7('0x36')],'dialOriginateTimeout':_0x439f14[_0x33c7('0x37')],'dialPrefix':_0x439f14['dialPrefix'],'outboundAnswerAgiCallsDay':_0x439f14['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x439f14[_0x33c7('0x38')],'outboundBlacklistCallsDay':_0x439f14['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x439f14[_0x33c7('0x39')],'outboundCongestionCallsDay':_0x439f14['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x439f14[_0x33c7('0x3a')],'outboundDropCallsDayCallersExit':_0x439f14[_0x33c7('0x3b')],'outboundDropCallsDayTimeout':_0x439f14[_0x33c7('0x3c')],'outboundNoAnswerCallsDay':_0x439f14[_0x33c7('0x3d')],'outboundNoSuchCallsDay':_0x439f14[_0x33c7('0x3e')],'outboundOriginateFailureCallsDay':_0x439f14[_0x33c7('0x3f')],'outboundReCallsDay':_0x439f14[_0x33c7('0x40')],'outboundRejectCallsDay':_0x439f14[_0x33c7('0x41')],'outboundUnknownCallsDay':_0x439f14[_0x33c7('0x42')],'outboundAbandonedCallsDay':_0x439f14[_0x33c7('0x43')],'predictiveIntervalAnsweredCalls':_0x439f14[_0x33c7('0x44')],'predictiveIntervalAvgHoldtime':_0x439f14[_0x33c7('0x45')],'predictiveIntervalAvgTalktime':_0x439f14[_0x33c7('0x46')],'predictiveIntervalDroppedCallsCallersExit':_0x439f14[_0x33c7('0x47')],'predictiveIntervalDroppedCallsTimeout':_0x439f14[_0x33c7('0x48')],'predictiveIntervalErlangCalls':_0x439f14[_0x33c7('0x49')],'predictiveIntervalErlangCallsDroppedCalls':_0x439f14['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x439f14[_0x33c7('0x4a')],'predictiveIntervalMultiplicativeFactor':_0x439f14[_0x33c7('0x4b')],'predictiveIntervalPauses':_0x439f14['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x439f14['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x439f14['predictiveIntervalTotalCalls'],'message':_0x439f14['message'],'originated':_0x439f14[_0x33c7('0x4c')],'erlangCalls':_0x439f14['erlangCalls'],'erlangCallToSecond':_0x439f14['erlangCallToSecond'],'erlangAbandonmentRate':_0x439f14[_0x33c7('0x4d')],'erlangBusyFactor':_0x439f14[_0x33c7('0x4e')],'startPredictive':_0x439f14['startPredictive'],'startProgressive':_0x439f14[_0x33c7('0x4f')]};if(_0x439f14[_0x33c7('0x50')]){_0x37ff93['Trunk']={'id':_0x439f14[_0x33c7('0x50')]['id'],'name':_0x439f14[_0x33c7('0x50')][_0x33c7('0x51')],'active':_0x439f14['Trunk'][_0x33c7('0x52')],'callerid':_0x439f14[_0x33c7('0x50')]['callerid']};}if(_0x439f14[_0x33c7('0x53')]){_0x37ff93[_0x33c7('0x53')]={'id':_0x439f14['Interval']['id'],'name':_0x439f14['Interval'][_0x33c7('0x51')]};}var _0x2a5956=md5(JSON[_0x33c7('0x54')](_0x37ff93));if(_0x439f14[_0x33c7('0x5')]!==_0x2a5956){_0x439f14['md5']=_0x2a5956;emit(util[_0x33c7('0x55')](_0x33c7('0x56'),_0x37ff93[_0x33c7('0x51')]),_0x33c7('0x57'),_0x37ff93);}}}function emitVoiceQueueChannelRemove(_0x4d29b4){logger[_0x33c7('0x58')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x33c7('0x54')](_0x4d29b4));emit(util[_0x33c7('0x55')]('voice:queue:%s',_0x4d29b4[_0x33c7('0x51')]),_0x33c7('0x59'),_0x4d29b4);io[_0x33c7('0x26')]('voice_queue_presence:remove',_0x4d29b4);}function notSendMessagesQueue(_0x1a57e9){if(_0x1a57e9[_0x33c7('0x5a')]){if(_0x1a57e9[_0x33c7('0x4c')]===0x0&&_0x1a57e9['pTalking']===0x0){_0x1a57e9[_0x33c7('0x5a')]=![];_0x1a57e9[_0x33c7('0x2a')]=0x0;_0x1a57e9['paused']=0x0;_0x1a57e9['message']='NOT_ACTIVE';ut[_0x33c7('0x5b')](_0x33c7('0x5c'),_0x1a57e9[_0x33c7('0x51')]+_0x33c7('0x5d'));}else{_0x1a57e9[_0x33c7('0x5e')]=_0x33c7('0x5f');ut[_0x33c7('0x5b')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x1a57e9['name']+_0x33c7('0x60'));}emitCampaignPreview(_0x1a57e9);}}Preview[_0x33c7('0xd')][_0x33c7('0x25')]=function(){var _0x265f96=this;setInterval(function(){_0x265f96[_0x33c7('0x61')]();},0x7cf);};Preview[_0x33c7('0xd')]['syncCampaigns']=function(){var _0x56c874=this[_0x33c7('0x12')];this[_0x33c7('0x16')]+=0x1;for(var _0x42f9a5 in _0x56c874){if(_0x56c874[_0x33c7('0x62')](_0x42f9a5)&&(_0x56c874[_0x42f9a5][_0x33c7('0x34')]===_0x33c7('0x8')||_0x56c874[_0x42f9a5]['dialMethod']===_0x33c7('0x63'))&&_0x56c874[_0x42f9a5][_0x33c7('0x27')]===_0x33c7('0x28')){if(this[_0x33c7('0x16')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x33c7('0x64')]();}}if(_0x56c874[_0x33c7('0x62')](_0x42f9a5)&&_0x56c874[_0x42f9a5][_0x33c7('0x34')]===_0x33c7('0x8')&&_0x56c874[_0x42f9a5][_0x33c7('0x27')]==='outbound'){if(_0x56c874[_0x42f9a5][_0x33c7('0x65')]){this['setMessage'](_0x56c874[_0x42f9a5]);this['recallMe'](_0x56c874[_0x42f9a5]);}else{notSendMessagesQueue(_0x56c874[_0x42f9a5]);}}}};Preview[_0x33c7('0xd')][_0x33c7('0x66')]=function(_0xdefd62){var _0x3d9d2d=this;this[_0x33c7('0x11')][_0x33c7('0xe')](function(){if(!_['isNil'](_0x3d9d2d['actions'][_0xdefd62])){loggerAction[_0x33c7('0x58')](_0x33c7('0x67'),_0xdefd62,_0x33c7('0x68'),_0x3d9d2d[_0x33c7('0x69')][_0xdefd62]['queue'],'originated:\x20',JSON['stringify'](_0x3d9d2d[_0x33c7('0x12')][_0x3d9d2d[_0x33c7('0x69')][_0xdefd62][_0x33c7('0x6a')]]['originated']),'pTalking:\x20',JSON['stringify'](_0x3d9d2d['campaignsPreview'][_0x3d9d2d[_0x33c7('0x69')][_0xdefd62]['queue']]['pTalking']),JSON[_0x33c7('0x54')](_0x3d9d2d[_0x33c7('0x69')][_0xdefd62][_0x33c7('0x6b')]),JSON[_0x33c7('0x54')](_[_0x33c7('0x6c')](_0x3d9d2d['actions'][_0xdefd62],['contactId',_0x33c7('0x6d'),'VoiceQueueId','ListId'])));return ami[_0x33c7('0x6e')]({'action':_0x33c7('0x6f'),'channel':_0x3d9d2d[_0x33c7('0x69')][_0xdefd62][_0x33c7('0x70')]})[_0x33c7('0x71')](function(_0x329de9){if(_0x329de9['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x3d9d2d[_0x33c7('0x69')][_0xdefd62]){ut['updateOriginated'](_0x3d9d2d[_0x33c7('0x12')][_0x3d9d2d[_0x33c7('0x69')][_0xdefd62][_0x33c7('0x6a')]],_0x33c7('0x72'));if(_0x3d9d2d[_0x33c7('0x69')][_0xdefd62][_0x33c7('0x6b')]===!![]){ut[_0x33c7('0x73')](_0x3d9d2d[_0x33c7('0x12')][_0x3d9d2d[_0x33c7('0x69')][_0xdefd62][_0x33c7('0x6a')]],_0x33c7('0x72'));ut[_0x33c7('0x74')]('[Dialer][checkChannel][pTalking][Preview]'+_0xdefd62,_0x3d9d2d['actions'][_0xdefd62][_0x33c7('0x6a')]);}ut[_0x33c7('0x74')](_0x33c7('0x75')+_0xdefd62,_0x3d9d2d[_0x33c7('0x69')][_0xdefd62]['queue']);delete _0x3d9d2d[_0x33c7('0x69')][_0xdefd62];}},0x2328);}});}});};Preview[_0x33c7('0xd')]['clearZombieChannels']=function(){var _0xda72ea=this;loggerAction[_0x33c7('0x58')]('[action]',_[_0x33c7('0x76')](this[_0x33c7('0x69')]));for(var _0x3126d6 in this[_0x33c7('0x69')]){if(_0xda72ea[_0x33c7('0x69')][_0x33c7('0x62')](_0x3126d6)){_0xda72ea[_0x33c7('0x66')](_0x3126d6);}}};Preview[_0x33c7('0xd')][_0x33c7('0x77')]=function(_0x27c9f0){var _0x5ee4f3=this;rpcDb['getContactRecallMe'](_0x27c9f0['id'],ut[_0x33c7('0x78')](this[_0x33c7('0x15')]))['then'](function(_0x409a96){if(!_['isNil'](_0x409a96)){for(var _0x1a4422=0x0;_0x1a4422<_0x409a96[_0x33c7('0x79')];_0x1a4422+=0x1){if(ut[_0x33c7('0x7a')](_0x409a96[_0x1a4422][_0x33c7('0x7b')])<_0x27c9f0[_0x33c7('0x7c')]*0x3c){if(_0x409a96[_0x1a4422][_0x33c7('0x7d')]&&!_0x409a96[_0x1a4422][_0x33c7('0x7d')][_0x33c7('0x7e')]){_0x5ee4f3['run'](_0x409a96[_0x1a4422]['id'])[_0x33c7('0x7f')](ut['logger2'](_0x33c7('0x80')))[_0x33c7('0x71')](ut['logger2'](_0x33c7('0x80')));}else{rpcDb[_0x33c7('0x81')](_0x409a96[_0x1a4422]['id']);}}else{var _0x24e8c1=new Action(_0x409a96[_0x1a4422],_0x27c9f0);_0x24e8c1[_0x33c7('0x82')]=moment()[_0x33c7('0x55')](_0x33c7('0x83'));_0x27c9f0[_0x33c7('0x40')]+=0x1;ut[_0x33c7('0x84')](_0x24e8c1,0x17,'RecallInQueue');if(_0x27c9f0[_0x33c7('0x85')]){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x409a96[_0x1a4422]));rpcDb[_0x33c7('0x86')](_0x24e8c1,_0x33c7('0x87'));}else{ut[_0x33c7('0x84')](_0x24e8c1,0x16,_0x33c7('0x88'));rpcDb[_0x33c7('0x86')](_0x24e8c1,_0x33c7('0x89'));rpcDb[_0x33c7('0x8a')](_0x24e8c1,'[HistoryRecallClose]');}}}}})['catch'](ut['logger2'](_0x33c7('0x8b')));};Preview[_0x33c7('0xd')]['setMessage']=function(_0x53b4ec){_0x53b4ec[_0x33c7('0x5a')]=!![];if(ut['IsNotLoggedIn'](_0x53b4ec['loggedIn'])){_0x53b4ec[_0x33c7('0x5e')]=_0x33c7('0x8c');}else if(!ut[_0x33c7('0x8d')](_0x53b4ec[_0x33c7('0x65')])){_0x53b4ec['message']=_0x33c7('0x8e');}else if(!this['isTrunkReachable'](_0x53b4ec[_0x33c7('0x50')])){if(!this[_0x33c7('0x8f')](_0x53b4ec[_0x33c7('0x90')])){_0x53b4ec[_0x33c7('0x5e')]=_0x33c7('0x91');}else{_0x53b4ec['message']=_0x33c7('0x92');}}else{_0x53b4ec[_0x33c7('0x5e')]=_0x33c7('0x92');}emitCampaignPreview(_0x53b4ec);};Preview[_0x33c7('0xd')][_0x33c7('0x93')]=function(_0x268743,_0x39872b,_0x5c0f1d){var _0x3f1658=this;var _0x11711c=this[_0x33c7('0x69')][_0x39872b];var _0x357bf4=this['campaignsPreview'][_0x11711c[_0x33c7('0x6a')]];var _0xd51f7e;if(_0x357bf4){switch(_0x5c0f1d){case'1':_0x357bf4[_0x33c7('0x3e')]+=0x1;_0x11711c['countnosuchnumberretry']+=0x1;_0x11711c[_0x33c7('0x94')]=ut[_0x33c7('0x95')](_0x11711c);ut[_0x33c7('0x84')](_0x11711c,0x0,_0x33c7('0x96'));ami[_0x33c7('0x26')]('custom:agentnosuchnumber',ut[_0x33c7('0x97')](_0x11711c,'nosuchnumber'));rpcDb['createCustomerHistory'](_0x11711c,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0x33c7('0x95')](_0x11711c)>=_0x357bf4[_0x33c7('0x98')]){_0xd51f7e=ut[_0x33c7('0x99')](_0x11711c,0xf,_0x33c7('0x9a'));rpcDb['createCustomerFinal'](_0xd51f7e,_0x33c7('0x9b'));}else{if(_0x11711c['countnosuchnumberretry']>=_0x357bf4[_0x33c7('0x9c')]){rpcDb[_0x33c7('0x8a')](_0x11711c,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut[_0x33c7('0x9d')](_0x11711c,_0x33c7('0x9e'),_0x357bf4[_0x33c7('0x9f')]),_0x11711c[_0x33c7('0xa0')],_0x11711c['activeContact']);}}delete this[_0x33c7('0x69')][_0x268743[_0x33c7('0xa1')]];break;case _0x33c7('0xa2'):var _0x578d6c=moment()[_0x33c7('0x55')](_0x33c7('0x83'));_0x11711c[_0x33c7('0xa3')]=_0x578d6c;_0x11711c[_0x33c7('0xa4')]=_0x578d6c;_0x11711c['dialAnswer']=!![];_0x357bf4[_0x33c7('0x2c')]+=0x1;logger[_0x33c7('0x58')]('[syncHangup][talking][increment]',_0x11711c[_0x33c7('0xa5')],_0x33c7('0xa6'),_0x357bf4[_0x33c7('0x51')],_0x33c7('0xa7'),_0x357bf4[_0x33c7('0x2c')]);ami[_0x33c7('0x26')](_0x33c7('0xa8'),ut[_0x33c7('0x97')](_0x11711c,_0x33c7('0xa9'),this[_0x33c7('0x12')][_0x11711c['queue']]));if(_0x357bf4[_0x33c7('0xaa')]){ami[_0x33c7('0x26')](_0x33c7('0xab'),ut[_0x33c7('0xac')](_0x11711c));}break;case'16':ami[_0x33c7('0x26')](_0x33c7('0xad'),ut['buildObj'](_0x11711c,_0x33c7('0xae'),this[_0x33c7('0x12')][_0x11711c[_0x33c7('0x6a')]]));emitVoiceQueueChannelRemove(ut[_0x33c7('0x97')](_0x11711c,_0x33c7('0xae')));_0x357bf4[_0x33c7('0x38')]+=0x1;_0x357bf4[_0x33c7('0x30')]+=0x1;_0x357bf4['answered']+=0x1;ut['decrementTalkink'](_0x357bf4,'[16]');_0x11711c[_0x33c7('0x94')]=ut['totalGlobal'](_0x11711c);ut[_0x33c7('0x84')](_0x11711c,0x4,_0x33c7('0xaf'));rpcDb[_0x33c7('0x86')](_0x11711c,_0x33c7('0xb0'));rpcDb[_0x33c7('0x8a')](_0x11711c,_0x33c7('0xb1'));rpcDb['crateCustomerReportQueue'](_0x11711c);_0x357bf4[_0x33c7('0x2e')]+=_0x11711c[_0x33c7('0xb2')];_0x357bf4['sumBillable']+=_0x11711c[_0x33c7('0xb2')];logger[_0x33c7('0x58')](_0x33c7('0xb3'),_0x11711c[_0x33c7('0xa5')],_0x33c7('0xa6'),_0x357bf4[_0x33c7('0x51')],_0x33c7('0xa7'),_0x357bf4[_0x33c7('0x2c')]);delete this[_0x33c7('0x69')][_0x268743[_0x33c7('0xa1')]];break;case'BUSY':_0x357bf4[_0x33c7('0x39')]+=0x1;_0x11711c['countbusyretry']+=0x1;_0x11711c['countglobal']=ut[_0x33c7('0x95')](_0x11711c);ut[_0x33c7('0x84')](_0x11711c,0x5,'Busy');ami[_0x33c7('0x26')](_0x33c7('0xb4'),ut[_0x33c7('0x97')](_0x11711c,_0x33c7('0xb5')));rpcDb[_0x33c7('0x86')](_0x11711c,_0x33c7('0xb6'));if(ut[_0x33c7('0x95')](_0x11711c)>=_0x357bf4['dialGlobalMaxRetry']){_0xd51f7e=ut[_0x33c7('0x99')](_0x11711c,0xf,_0x33c7('0x9a'));rpcDb[_0x33c7('0x8a')](_0xd51f7e,_0x33c7('0xb7'));}else{if(_0x11711c[_0x33c7('0xb8')]>=_0x357bf4[_0x33c7('0xb9')]){rpcDb[_0x33c7('0x8a')](_0x11711c,_0x33c7('0xb6'));}else{rpcDb[_0x33c7('0xba')](ut[_0x33c7('0x9d')](_0x11711c,_0x33c7('0xb8'),_0x357bf4[_0x33c7('0xbb')]),_0x11711c[_0x33c7('0xa0')],_0x11711c['activeContact']);}}break;case _0x33c7('0xbc'):_0x357bf4[_0x33c7('0x3d')]+=0x1;_0x11711c[_0x33c7('0xbd')]+=0x1;_0x11711c[_0x33c7('0x94')]=ut[_0x33c7('0x95')](_0x11711c);ut[_0x33c7('0x84')](_0x11711c,0x3,_0x33c7('0xbe'));ami['emit']('custom:agentnoanswer',ut[_0x33c7('0x97')](_0x11711c,_0x33c7('0xbf')));rpcDb[_0x33c7('0x86')](_0x11711c,_0x33c7('0xc0'));if(ut[_0x33c7('0x95')](_0x11711c)>=_0x357bf4[_0x33c7('0x98')]){_0xd51f7e=ut['cloneAction'](_0x11711c,0xf,_0x33c7('0x9a'));rpcDb[_0x33c7('0x8a')](_0xd51f7e,_0x33c7('0xc1'));}else{if(_0x11711c['countnoanswerretry']>=_0x357bf4[_0x33c7('0xc2')]){rpcDb['createCustomerFinal'](_0x11711c,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x33c7('0xba')](ut['scheduledAt'](_0x11711c,_0x33c7('0xbd'),_0x357bf4[_0x33c7('0xc3')]),_0x11711c['unlockAgent'],_0x11711c[_0x33c7('0xc4')]);}}break;case'CONGESTION':_0x357bf4[_0x33c7('0xc5')]+=0x1;_0x11711c[_0x33c7('0xc6')]+=0x1;_0x11711c[_0x33c7('0x94')]=ut['totalGlobal'](_0x11711c);ut[_0x33c7('0x84')](_0x11711c,0x8,'Congestion');ami['emit'](_0x33c7('0xc7'),ut[_0x33c7('0x97')](_0x11711c,_0x33c7('0xc8')));rpcDb[_0x33c7('0x86')](_0x11711c,_0x33c7('0xc9'));if(ut['totalGlobal'](_0x11711c)>=_0x357bf4[_0x33c7('0x98')]){_0xd51f7e=ut['cloneAction'](_0x11711c,0xf,_0x33c7('0x9a'));rpcDb['createCustomerFinal'](_0xd51f7e,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x11711c['countcongestionretry']>=_0x357bf4['dialCongestionMaxRetry']){rpcDb[_0x33c7('0x8a')](_0x11711c,_0x33c7('0xc9'));}else{rpcDb[_0x33c7('0xba')](ut[_0x33c7('0x9d')](_0x11711c,'countcongestionretry',_0x357bf4['dialBusyRetryFrequency']),_0x11711c[_0x33c7('0xa0')],_0x11711c[_0x33c7('0xc4')]);}}break;case'CANCEL':_0x357bf4['outboundRejectCallsDay']+=0x1;_0x11711c[_0x33c7('0xca')]+=0x1;_0x11711c[_0x33c7('0x94')]=ut[_0x33c7('0x95')](_0x11711c);ut[_0x33c7('0x84')](_0x11711c,0x14,_0x33c7('0xcb'));ami[_0x33c7('0x26')]('custom:agentreject',ut['buildObj'](_0x11711c,_0x33c7('0xcc')));rpcDb[_0x33c7('0x86')](_0x11711c,'[syncHangupRequest][logAgentReject]');if(ut[_0x33c7('0x95')](_0x11711c)>=_0x357bf4['dialGlobalMaxRetry']){_0xd51f7e=ut[_0x33c7('0x99')](_0x11711c,0x14,_0x33c7('0xcb'));rpcDb[_0x33c7('0x8a')](_0xd51f7e,_0x33c7('0xcd'));}else{if(_0x11711c[_0x33c7('0xca')]>=_0x357bf4[_0x33c7('0xce')]){rpcDb[_0x33c7('0x8a')](_0x11711c,_0x33c7('0xcd'));}else{rpcDb[_0x33c7('0xba')](ut[_0x33c7('0x9d')](_0x11711c,'countagentrejectretry',_0x357bf4[_0x33c7('0xcf')]),_0x11711c[_0x33c7('0xa0')],_0x11711c[_0x33c7('0xc4')]);}}break;case _0x33c7('0xd0'):_0x357bf4[_0x33c7('0x43')]+=0x1;_0x11711c[_0x33c7('0xd1')]+=0x1;_0x11711c[_0x33c7('0x94')]=ut['totalGlobal'](_0x11711c);ut[_0x33c7('0x84')](_0x11711c,0xb,_0x33c7('0xd2'));rpcDb[_0x33c7('0x86')](_0x11711c,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x33c7('0x95')](_0x11711c)>=_0x357bf4[_0x33c7('0x98')]){_0xd51f7e=ut[_0x33c7('0x99')](_0x11711c,0xf,_0x33c7('0x9a'));rpcDb[_0x33c7('0x8a')](_0xd51f7e,_0x33c7('0xd3'));}else{if(_0x11711c['countabandonedetry']>=_0x357bf4[_0x33c7('0xd4')]){rpcDb['createCustomerFinal'](_0x11711c,_0x33c7('0xd3'));}else{rpcDb[_0x33c7('0xba')](ut[_0x33c7('0x9d')](_0x11711c,'countabandonedretry',_0x357bf4[_0x33c7('0xd5')]),_0x11711c[_0x33c7('0xa0')],_0x11711c[_0x33c7('0xc4')]);}}break;case'18':_0x357bf4['outboundUnknownCallsDay']+=0x1;_0x11711c[_0x33c7('0xd6')]+=0x1;_0x11711c[_0x33c7('0x94')]=ut[_0x33c7('0x95')](_0x11711c);ut[_0x33c7('0x84')](_0x11711c,0x12,_0x268743[_0x33c7('0xd7')]||_0x268743[_0x33c7('0xd8')]);ami[_0x33c7('0x26')](_0x33c7('0xd9'),ut['buildObj'](_0x11711c,'amd'));rpcDb[_0x33c7('0x86')](_0x11711c,_0x33c7('0xda'));if(ut[_0x33c7('0x95')](_0x11711c)>=_0x357bf4['dialGlobalMaxRetry']){_0xd51f7e=ut['cloneAction'](_0x11711c,0xf,_0x33c7('0x9a'));rpcDb[_0x33c7('0x8a')](_0xd51f7e,_0x33c7('0xda'));}else{rpcDb[_0x33c7('0x8a')](_0x11711c,_0x33c7('0xda'));}delete this[_0x33c7('0x69')][_0x268743[_0x33c7('0xa1')]];break;case'19':_0x357bf4[_0x33c7('0x42')]+=0x1;_0x11711c[_0x33c7('0x94')]=ut[_0x33c7('0x95')](_0x11711c);ut[_0x33c7('0x84')](_0x11711c,0x13,_0x268743[_0x33c7('0xd7')]||_0x268743['dialstatus']);ami[_0x33c7('0x26')](_0x33c7('0xd9'),ut['buildObj'](_0x11711c,_0x33c7('0xdb')));rpcDb['createCustomerHistory'](_0x11711c,_0x33c7('0xdc'));if(ut[_0x33c7('0x95')](_0x11711c)>=_0x357bf4[_0x33c7('0x98')]){_0xd51f7e=ut[_0x33c7('0x99')](_0x11711c,0xf,_0x33c7('0x9a'));rpcDb[_0x33c7('0x8a')](_0xd51f7e,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0x33c7('0x8a')](_0x11711c,_0x33c7('0xdc'));}delete this[_0x33c7('0x69')][_0x268743[_0x33c7('0xa1')]];break;default:if(_0x11711c['dialAnswer']){ut['decrementTalkink'](_0x357bf4,_0x33c7('0xdd'));ut[_0x33c7('0x74')](_0x33c7('0xde')+_0x357bf4[_0x33c7('0x51')],_0x268743);}_0x357bf4[_0x33c7('0x42')]+=0x1;_0x11711c[_0x33c7('0x94')]=ut[_0x33c7('0x95')](_0x11711c);ut[_0x33c7('0x84')](_0x11711c,0xc,_0x268743[_0x33c7('0xd7')]||_0x268743[_0x33c7('0xd8')]);rpcDb[_0x33c7('0x86')](_0x11711c,'[callProgressDetectingCustomer][logUnknown]');if(ut['totalGlobal'](_0x11711c)>=_0x357bf4['dialGlobalMaxRetry']){_0xd51f7e=ut[_0x33c7('0x99')](_0x11711c,0xf,'Global');rpcDb[_0x33c7('0x8a')](_0xd51f7e,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x33c7('0x8a')](_0x11711c,_0x33c7('0xdf'));}delete this[_0x33c7('0x69')][_0x268743[_0x33c7('0xa1')]];}if(!(_0x11711c[_0x33c7('0x6b')]&&_0x5c0f1d==='16')){ut[_0x33c7('0xe0')](_0x357bf4,_0x33c7('0xe1'));logger['info']('[originated][decrement][callProgressDetectingCustomer]',_0x11711c['uniqueid'],_0x33c7('0xa6'),_0x357bf4[_0x33c7('0x51')],_0x33c7('0xe2'),_0x357bf4[_0x33c7('0x4c')]);}if(_0x5c0f1d!==_0x33c7('0xa2')){delete this[_0x33c7('0x69')][_0x268743[_0x33c7('0xa1')]];delete this[_0x33c7('0x69')][_0x268743[_0x33c7('0xe3')]];}}};Preview[_0x33c7('0xd')]['callProgressDetectingAgent']=function(_0x5cacec,_0x5832ac,_0x321036){if(_[_0x33c7('0xe4')](_0x5832ac)&&_0x33c7('0xe5')!==typeof _0x5832ac){return;}if(_[_0x33c7('0xe4')](_0x321036)&&_0x33c7('0xe5')!==typeof _0x321036){return;}switch(_0x321036['reason']){case'0':ut[_0x33c7('0xe6')](_0x5cacec,0x0,_0x33c7('0x96'));rpcDb['createAgentHistory'](_0x5cacec,_0x33c7('0xe7'));break;case'3':ut[_0x33c7('0xe6')](_0x5cacec,0x3,_0x33c7('0xbe'));rpcDb[_0x33c7('0xe8')](_0x5cacec,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x33c7('0xe6')](_0x5cacec,0x5,_0x33c7('0xe9'));rpcDb['createAgentHistory'](_0x5cacec,_0x33c7('0xea'));break;case'8':ut[_0x33c7('0xe6')](_0x5cacec,0x8,'Congestion');rpcDb['createAgentHistory'](_0x5cacec,_0x33c7('0xeb'));break;case'22':ut[_0x33c7('0xe6')](_0x5cacec,0x16,_0x33c7('0xec'));rpcDb['createAgentHistory'](_0x5cacec,_0x33c7('0xed'));break;default:ut[_0x33c7('0xe6')](_0x5cacec,0xc,_0x321036[_0x33c7('0xee')]);rpcDb[_0x33c7('0xe8')](_0x5cacec,_0x33c7('0xeb'));}ut[_0x33c7('0xe0')](_0x5832ac,_0x33c7('0xef'));logger[_0x33c7('0x58')](_0x33c7('0xf0'),_0x5cacec[_0x33c7('0xa5')],_0x33c7('0xa6'),_0x5832ac[_0x33c7('0x51')],'originated:\x20',_0x5832ac[_0x33c7('0x4c')]);delete this[_0x33c7('0x69')][_0x5cacec[_0x33c7('0xa5')]];};Preview[_0x33c7('0xd')][_0x33c7('0xf1')]=function(_0x504f78,_0x11dfa5,_0x714e0,_0x4a9f91,_0xd4c5b){var _0xdab6e0=this;return new BPromise(function(_0x42a215,_0xe9dc38){if(_[_0x33c7('0xf2')](_0x11dfa5)||_[_0x33c7('0xf2')](_0x11dfa5['Contact'])||_['isNil'](_0x11dfa5[_0x33c7('0xf3')][_0x33c7('0xf4')])||_[_0x33c7('0xf2')](_0x11dfa5[_0x33c7('0xf5')])){_0xe9dc38(ut[_0x33c7('0x5e')](_0x33c7('0xf6'),_0x4a9f91,_0xd4c5b));return;}var _0x58309f=uuid['v4']();var _0x2f4f21=_0xdab6e0[_0x33c7('0x12')][_0x11dfa5['Queue'][_0x33c7('0x51')]];var _0x704b16=_0x714e0?_0xdab6e0[_0x33c7('0x15')][_0x714e0]['id']:undefined;_0xdab6e0[_0x33c7('0x69')][_0x58309f]=new Action(_0x11dfa5,_0x2f4f21,_0x58309f,_0x714e0,_0x704b16);var _0x354d24=_0xdab6e0[_0x33c7('0x69')][_0x58309f];_0x354d24[_0x33c7('0xa0')]=_0x4a9f91;_0x354d24['activeContact']=_0xd4c5b;_0x354d24[_0x33c7('0xf7')]=_0x714e0;if(_['isEmpty'](_0x504f78)){_0xdab6e0[_0x33c7('0xf8')](_0x354d24,_0x2f4f21,_0x11dfa5,_0x714e0)['then'](function(_0x4259bd){logger[_0x33c7('0x58')]('[Preview][execCall][success]',_0x33c7('0xf9')+_0x354d24['queue']+_0x33c7('0xfa')+_0x354d24['idContact'],JSON[_0x33c7('0x54')](_0x4259bd));ami[_0x33c7('0x26')](_0x33c7('0xfb'),ut['buildObj'](_0x354d24,'called',_0xdab6e0[_0x33c7('0x12')][_0x354d24[_0x33c7('0x6a')]]));_0x42a215(ut['message'](_0x33c7('0xfc')));})['catch'](function(_0xd331be){ut['logger'](_0x33c7('0xfd'),_0xd331be);_0xe9dc38(ut[_0x33c7('0x5e')](_0x33c7('0xfe'),_0x4a9f91,_0xd4c5b));});}else{_0x2f4f21['outboundBlacklistCallsDay']+=0x1;ut['logBlacklist'](_0x354d24);rpcDb[_0x33c7('0xff')](_0x354d24,'[Blacklist][error]');delete _0xdab6e0[_0x33c7('0x69')][_0x58309f];_0xe9dc38(ut[_0x33c7('0x5e')]('Contact\x20in\x20black\x20List',_0x4a9f91,_0xd4c5b));}});};Preview[_0x33c7('0xd')]['isTrunkReachable']=function(_0x20b0f3){return!_[_0x33c7('0xf2')](_0x20b0f3)&&!_['isNil'](_0x20b0f3[_0x33c7('0x51')])&&!_[_0x33c7('0xf2')](_0x20b0f3[_0x33c7('0x52')])&&_0x20b0f3[_0x33c7('0x52')]&&!_[_0x33c7('0xf2')](this[_0x33c7('0x14')][util[_0x33c7('0x55')](_0x33c7('0x100'),_0x20b0f3[_0x33c7('0x51')])])&&!_['isNil'](this[_0x33c7('0x14')][util[_0x33c7('0x55')](_0x33c7('0x100'),_0x20b0f3[_0x33c7('0x51')])][_0x33c7('0x6f')])&&(this[_0x33c7('0x14')][util['format'](_0x33c7('0x100'),_0x20b0f3[_0x33c7('0x51')])][_0x33c7('0x6f')]==='reachable'||this['trunks'][util[_0x33c7('0x55')]('SIP/%s',_0x20b0f3[_0x33c7('0x51')])][_0x33c7('0x6f')]===_0x33c7('0x101'));};Preview[_0x33c7('0xd')][_0x33c7('0x102')]=function(_0x1a3d98,_0x2b3641){var _0x49c3f3=this;return new BPromise(function(_0x58be7e,_0x335a06){_0x49c3f3[_0x33c7('0x103')](_0x1a3d98,_0x2b3641)[_0x33c7('0x7f')](function(_0x3499e0){_0x58be7e(_['pick'](_0x3499e0,[_0x33c7('0x5e')]));})['catch'](function(_0x57e8bc){if(_0x57e8bc[_0x33c7('0x104')]){rpcDb['unlockContact'](_0x1a3d98);}if(_0x57e8bc[_0x33c7('0x52')]){rpcDb[_0x33c7('0x81')](_0x1a3d98);}_0x335a06(_['pick'](_0x57e8bc,[_0x33c7('0x5e')]));});});};Preview[_0x33c7('0xd')][_0x33c7('0x103')]=function(_0x53f273,_0x315e35){var _0x1a499e=this;return new BPromise(function(_0x522ea1,_0x19068c){var _0x2c06fc,_0xf23535;rpcDb[_0x33c7('0x105')](_0x53f273)['then'](function(_0x2d9a1e){if(!_['isNil'](_0x2d9a1e[0x0])){_0xf23535=_0x2d9a1e[0x0][_0x33c7('0x106')]?![]:!![];_0x2c06fc=_0x2d9a1e[0x0][_0x33c7('0x106')]?!![]:![];_0x2c06fc=_0x315e35?!![]:_0x2c06fc;}var _0xc8f002=_0x1a499e['validateContact'](_0x2d9a1e);if(_0xc8f002[_0x33c7('0x107')]){rpcDb['checkIsBlackList'](_[_0x33c7('0x6c')](_0x2d9a1e[0x0],[_0x33c7('0xf5'),'Contact.phone']))[_0x33c7('0x7f')](function(_0x5a5328){_0x1a499e[_0x33c7('0xf1')](_0x5a5328,_0x2d9a1e[0x0],_0x315e35,_0xf23535,_0x2c06fc)[_0x33c7('0x7f')](function(_0x4d7f0e){_0x522ea1(_0x4d7f0e);})[_0x33c7('0x71')](function(_0x50397a){_0x19068c(_0x50397a);});})[_0x33c7('0x71')](function(_0x22c6ba){ut['logger'](_0x33c7('0x108'),_0x22c6ba);_0x19068c(ut[_0x33c7('0x5e')](_0x33c7('0x109'),_0xf23535,_0x2c06fc));});}else{_0x19068c(ut[_0x33c7('0x5e')](_0xc8f002[_0x33c7('0x5e')],_0xf23535,_0x2c06fc));}})['catch'](function(_0x41d2e4){ut['logger'](_0x33c7('0x10a'),_0x41d2e4);_0x19068c(ut[_0x33c7('0x5e')](_0x33c7('0x109'),![],!![]));});});};Preview[_0x33c7('0xd')][_0x33c7('0x10b')]=function(_0x2e603f){if(_[_0x33c7('0xf2')](_0x2e603f)||_[_0x33c7('0x10c')](_0x2e603f)||!_['isNil'](_0x2e603f[0x0]['Agent'])&&_['isNil'](_0x2e603f[0x0]['Agent'][_0x33c7('0x51')])){ut['logger'](_0x33c7('0x10d'),_0x2e603f);return{'isValid':![],'message':_0x33c7('0x10e')};}var _0xceab49=this[_0x33c7('0x12')][_0x2e603f[0x0]['Queue']['name']];_0xceab49[_0x33c7('0x5e')]=_0x33c7('0x92');if(_[_0x33c7('0xf2')](_0xceab49)){ut[_0x33c7('0x5b')](_0x33c7('0x10f'),_0xceab49);return{'isValid':![],'message':_0x33c7('0x110')};}if(!this[_0x33c7('0x8f')](_0xceab49[_0x33c7('0x50')])){ut[_0x33c7('0x5b')](_0x33c7('0x111'),_0x33c7('0x112')+_0xceab49[_0x33c7('0x51')]+_0x33c7('0x113'));if(!this[_0x33c7('0x8f')](_0xceab49[_0x33c7('0x90')])){ut[_0x33c7('0x5b')](_0x33c7('0x111'),_0xceab49['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x33c7('0x114')};}}if(!ut[_0x33c7('0x8d')](_0xceab49[_0x33c7('0x65')])){ut[_0x33c7('0x5b')]('[Preview][validateContact][Campaign\x20Active]',_0xceab49[_0x33c7('0x51')]+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0xceab49['name']+_0x33c7('0x115')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x33c7('0xd')][_0x33c7('0xf8')]=function(_0x18d967,_0x3a6f40,_0x4b7852,_0x32a38d){var _0x8b5595=this;return new BPromise(function(_0x529f16,_0x2d8f43){var _0x122a80=_0x18d967[_0x33c7('0xa5')];var _0x276c81=_0x8b5595[_0x33c7('0x8f')](_0x3a6f40[_0x33c7('0x50')])?util[_0x33c7('0x55')](_0x33c7('0x116'),_0x3a6f40['Trunk'][_0x33c7('0x51')],_['isNil'](_0x3a6f40[_0x33c7('0x117')])?'':_0x3a6f40[_0x33c7('0x117')]['trim']()||'',_0x3a6f40[_0x33c7('0x118')]>0x0?_0x4b7852[_0x33c7('0xf3')]['phone']['substring'](_0x3a6f40[_0x33c7('0x118')]):_0x4b7852[_0x33c7('0xf3')]['phone']):util['format'](_0x33c7('0x116'),_[_0x33c7('0xf2')](_0x3a6f40['TrunkBackup'])?_0x3a6f40['Trunk'][_0x33c7('0x51')]:_0x3a6f40[_0x33c7('0x90')][_0x33c7('0x51')],_[_0x33c7('0xf2')](_0x3a6f40[_0x33c7('0x117')])?'':_0x3a6f40['dialPrefix']['trim']()||'',_0x3a6f40[_0x33c7('0x118')]>0x0?_0x4b7852[_0x33c7('0xf3')][_0x33c7('0xf4')][_0x33c7('0x119')](_0x3a6f40['dialCutDigit']):_0x4b7852[_0x33c7('0xf3')]['phone']);var _0x4f8533=_0x8b5595[_0x33c7('0x8f')](_0x3a6f40['Trunk'])?ut[_0x33c7('0x11a')](_0x3a6f40[_0x33c7('0x50')][_0x33c7('0x11b')],_0x3a6f40[_0x33c7('0x35')],_0x3a6f40['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x33c7('0x11c')](_0x3a6f40['dialOriginateCallerIdNumber'],_0x3a6f40[_0x33c7('0x11d')]):_0x3a6f40[_0x33c7('0x36')]):ut[_0x33c7('0x11a')](_[_0x33c7('0xf2')](_0x3a6f40[_0x33c7('0x90')])?_0x3a6f40['Trunk']['callerid']:_0x3a6f40[_0x33c7('0x90')][_0x33c7('0x11b')],_0x3a6f40[_0x33c7('0x35')],_0x3a6f40[_0x33c7('0x11d')]>0x0?ut[_0x33c7('0x11c')](_0x3a6f40['dialOriginateCallerIdNumber'],_0x3a6f40[_0x33c7('0x11d')]):_0x3a6f40[_0x33c7('0x36')]);if(_0x4f8533){_0x18d967[_0x33c7('0x11e')]=ut[_0x33c7('0x11f')](_0x4f8533);_0x18d967['originatecalleridnum']=ut[_0x33c7('0x120')](_0x4f8533);}var _0x55a557=ut['addVariables'](_0x3a6f40,_0x4b7852,_0x276c81,_0x4f8533,_0x122a80,_0x18d967);_[_0x33c7('0x121')](_0x18d967,ut['toLowerVariables'](_0x55a557));_0x18d967[_0x33c7('0x82')]=moment()[_0x33c7('0x55')](_0x33c7('0x83'));ami[_0x33c7('0x6e')](ut[_0x33c7('0x122')](_0x18d967,_0x3a6f40,_0x55a557,_0x18d967[_0x33c7('0xc4')],_0x32a38d))['then'](function(_0x16be27){var _0x3ab0fc=_0x18d967[_0x33c7('0x123')];if(!_[_0x33c7('0xf2')](_0x3ab0fc)){if(!_['isNil'](_0x8b5595[_0x33c7('0x15')][_0x3ab0fc])){_0x8b5595[_0x33c7('0x15')][_0x3ab0fc][_0x33c7('0x124')]=_0x18d967[_0x33c7('0x125')];emit(util[_0x33c7('0x55')]('user:%s',_0x8b5595[_0x33c7('0x15')][_0x3ab0fc][_0x33c7('0x51')]),_0x33c7('0x126'),{'destaccountcode':_0x8b5595[_0x33c7('0x15')][_0x3ab0fc][_0x33c7('0x127')],'destconnectedlinenum':_0x18d967[_0x33c7('0x125')]});}}_0x3a6f40[_0x33c7('0x4c')]+=0x1;logger[_0x33c7('0x58')](_0x33c7('0x128'),_0x122a80,_0x33c7('0xa6'),_0x3a6f40[_0x33c7('0x51')],_0x33c7('0xe2'),_0x3a6f40['originated']);_0x529f16(_0x16be27);})[_0x33c7('0x71')](function(_0x24ef79){ut[_0x33c7('0xe6')](_0x18d967,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x18d967,_0x33c7('0x129'));_0x2d8f43(_0x24ef79);});});};Preview['prototype'][_0x33c7('0x20')]=function(_0xed9e5e){if(this['actions'][_0xed9e5e[_0x33c7('0xa1')]]){this[_0x33c7('0x69')][_0xed9e5e[_0x33c7('0xa1')]][_0x33c7('0x70')]=_0xed9e5e[_0x33c7('0x70')];}};Preview[_0x33c7('0xd')]['syncOriginateResponse']=function(_0x308900){var _0x3b2229=this;var _0x3bd606=this[_0x33c7('0x69')][_0x308900['actionid']];if(_0x3bd606){if(_0x3bd606[_0x33c7('0xf7')]&&this['agents'][_0x3bd606[_0x33c7('0xf7')]]){ut[_0x33c7('0x12a')](_0x3bd606,this[_0x33c7('0x15')][_0x3bd606[_0x33c7('0xf7')]][_0x33c7('0x51')],this['agents'][_0x3bd606['lookAgent']]['id']);}var _0x56d4d2=_[_0x33c7('0x12b')](_0x3bd606);_0x56d4d2[_0x33c7('0xa3')]=moment()[_0x33c7('0x55')](_0x33c7('0x83'));var _0x42a8a0=_0x3b2229[_0x33c7('0x12')][_0x3bd606[_0x33c7('0x6a')]];if(ut[_0x33c7('0x12c')](_0x308900[_0x33c7('0x12d')])){if(_0x3bd606[_0x33c7('0xa0')]){rpcDb[_0x33c7('0x12e')](_0x3bd606[_0x33c7('0x12f')]);}if(_0x3bd606[_0x33c7('0xc4')]){rpcDb['disableContact'](_0x3bd606[_0x33c7('0x12f')]);}ami[_0x33c7('0x26')](_0x33c7('0x130'),ut[_0x33c7('0x97')](_0x3bd606,'rejected',this[_0x33c7('0x12')][_0x3bd606['queue']]));this[_0x33c7('0x131')](_0x56d4d2,_0x42a8a0,_0x308900);}else{_0x3bd606[_0x33c7('0x82')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x56d4d2,0x4,_0x33c7('0xaf'));rpcDb['createAgentHistory'](_0x56d4d2,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x33c7('0xd')][_0x33c7('0x1a')]=function(_0x27bf15){var _0x5d8fbb=this;var _0x4f007c=this[_0x33c7('0x69')][_0x27bf15[_0x33c7('0xa1')]];var _0x2d3030;if(_0x4f007c){_0x2d3030=this[_0x33c7('0x12')][_0x4f007c[_0x33c7('0x6a')]];logger[_0x33c7('0x58')](_0x33c7('0x132'),_0x27bf15[_0x33c7('0xa1')],_0x33c7('0xa6'),_0x2d3030['name'],'pTalking:\x20',_0x2d3030[_0x33c7('0x2c')]);}if(this[_0x33c7('0x69')][_0x27bf15[_0x33c7('0xa1')]]&&_0x27bf15[_0x33c7('0xa1')]!==_0x27bf15[_0x33c7('0xa5')]){if(_0x27bf15[_0x33c7('0x133')]==='16'&&this['actions'][_0x27bf15[_0x33c7('0xa1')]][_0x33c7('0x6b')]){this[_0x33c7('0x93')](_0x27bf15,_0x27bf15[_0x33c7('0xa1')],_0x27bf15[_0x33c7('0x133')]);}else if(this[_0x33c7('0x69')][_0x27bf15[_0x33c7('0xa1')]][_0x33c7('0x6b')]){logger['info']('[syncHangup][talking][cause]',_0x27bf15[_0x33c7('0xa1')],_0x27bf15[_0x33c7('0x133')],_0x33c7('0xa6'),_0x2d3030[_0x33c7('0x51')],_0x33c7('0xa7'),_0x2d3030[_0x33c7('0x2c')]);this[_0x33c7('0x93')](_0x27bf15,_0x27bf15['linkedid'],_0x27bf15[_0x33c7('0x133')]);}}else if(_0x4f007c&&_[_0x33c7('0xf2')](_0x4f007c[_0x33c7('0x134')])&&_0x2d3030['dialQueueProject']&&_0x27bf15[_0x33c7('0xa1')]===_0x27bf15['uniqueid']&&_['isNil'](_0x27bf15[_0x33c7('0xee')])&&_0x27bf15[_0x33c7('0x133')]==='16'&&_0x27bf15[_0x33c7('0x135')]==='6'&&_[_0x33c7('0xe4')](_0x4f007c[_0x33c7('0x136')])){if(_0x4f007c[_0x33c7('0xa0')]){rpcDb[_0x33c7('0x12e')](_0x4f007c[_0x33c7('0x12f')]);}if(_0x4f007c[_0x33c7('0xc4')]){rpcDb[_0x33c7('0x81')](_0x4f007c['idContact']);}_0x27bf15[_0x33c7('0xee')]='22';this['callProgressDetectingAgent'](_0x4f007c,_0x2d3030,_0x27bf15);}else if(_0x4f007c&&_0x4f007c[_0x33c7('0x136')]){if(_0x27bf15[_0x33c7('0x133')]==='16'&&this[_0x33c7('0x69')][_0x27bf15[_0x33c7('0xa1')]][_0x33c7('0x6b')]){logger[_0x33c7('0x58')](_0x33c7('0x137'),_0x27bf15[_0x33c7('0xa1')],_0x27bf15[_0x33c7('0x133')],_0x33c7('0xa6'),_0x2d3030[_0x33c7('0x51')],_0x33c7('0xa7'),_0x2d3030[_0x33c7('0x2c')]);this[_0x33c7('0x93')](_0x27bf15,_0x27bf15['linkedid'],_0x27bf15[_0x33c7('0x133')]);}else if(this['actions'][_0x27bf15[_0x33c7('0xa1')]][_0x33c7('0x6b')]){logger[_0x33c7('0x58')](_0x33c7('0x138'),_0x27bf15[_0x33c7('0xa1')],_0x27bf15['cause'],'\x20Queue',_0x2d3030[_0x33c7('0x51')],'pTalking:\x20',_0x2d3030['pTalking']);this[_0x33c7('0x93')](_0x27bf15,_0x27bf15[_0x33c7('0xa1')],_0x27bf15[_0x33c7('0x133')]);}}};Preview['prototype'][_0x33c7('0x1f')]=function(_0x256cce){if(this['actions'][_0x256cce[_0x33c7('0xe3')]]&&_0x256cce[_0x33c7('0xe3')]!==_0x256cce[_0x33c7('0x139')]){this['callProgressDetectingCustomer'](_0x256cce,_0x256cce[_0x33c7('0xe3')],_0x256cce[_0x33c7('0xd8')]);}};Preview[_0x33c7('0xd')]['syncHangupRequest']=function(_0x2e3add){if(this[_0x33c7('0x69')][_0x2e3add[_0x33c7('0xa1')]]&&_0x2e3add[_0x33c7('0xa1')]!==_0x2e3add['uniqueid']&&!this[_0x33c7('0x69')][_0x2e3add[_0x33c7('0xa1')]]['dialAnswer']){if(_0x2e3add['cause']==='1'){this[_0x33c7('0x93')](_0x2e3add,_0x2e3add['linkedid'],_0x2e3add[_0x33c7('0x133')]);}}};Preview['prototype'][_0x33c7('0x13a')]=function(_0x4de75f,_0x1b1db8,_0x3ebcea){if(this['actions'][_0x4de75f]){if(_[_0x33c7('0xf2')](this['actions'][_0x4de75f][_0x33c7('0x13b')])){this[_0x33c7('0x69')][_0x4de75f][_0x33c7('0x13b')]={};}this[_0x33c7('0x69')][_0x4de75f]['variables'][_0x1b1db8]=_0x3ebcea;}};Preview[_0x33c7('0xd')][_0x33c7('0x22')]=function(_0x546b53){try{if(!_['isNil'](_0x546b53)){if(ut[_0x33c7('0x13c')](_['keys'](_0x546b53[_0x33c7('0x13d')])[0x0])){this[_0x33c7('0x13a')](_0x546b53[_0x33c7('0xa5')],_[_0x33c7('0x13e')](_0x546b53['variable'])[0x0],_0x546b53[_0x33c7('0x13f')]);}}}catch(_0x39e01d){logger[_0x33c7('0x140')](_0x33c7('0x141'),util[_0x33c7('0x142')](_0x39e01d,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x33c7('0x143')]=function(_0x4c301c){if(_0x4c301c){if(this['actions'][_0x4c301c['transfertargetlinkedid']]){this['actions'][_0x4c301c[_0x33c7('0x144')]][_0x33c7('0x136')]=!![];}}};Preview[_0x33c7('0xd')][_0x33c7('0x24')]=function(_0x3d3e37){if(_0x3d3e37){if(this[_0x33c7('0x69')][_0x3d3e37[_0x33c7('0x145')]]){this[_0x33c7('0x69')][_0x3d3e37[_0x33c7('0x145')]][_0x33c7('0x136')]=!![];}}};module[_0x33c7('0x146')]=Preview; \ No newline at end of file +var _0x8095=['outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','dialAbandonedRetryFrequency','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','Congestion','[callProgressDetectingAgent][logCongestion]','[originated][decrement][callProgressDetectingAgent]','originated:\x20','checkInBlack','Contact','lookAgent','isEmpty','execCall','called','Calling','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','pick','unlock','unlockContact','getContactPreview','recallme','validateContact','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','phone','substring','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','toLowerVariables','channelAgent','destconnectedlinenum','calleridnum','user:%s','user:agentconnect','accountcode','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','actionid','logLookAgent','clone','isFailure','response','idContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','variables','variable','keys','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./action','./util/util','redis','localhost','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','dialend','syncDialEnd','newexten','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','available','loggedIn','pTalking','sumDuration','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','message','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','stringify','md5','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','dialActive','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','Action','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','[action]','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','then','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','[getContactRecallMe]','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','\x20Queue','BUSY','countbusyretry','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED'];(function(_0x55a20b,_0x13bd4f){var _0x738606=function(_0x34b9b8){while(--_0x34b9b8){_0x55a20b['push'](_0x55a20b['shift']());}};_0x738606(++_0x13bd4f);}(_0x8095,0x77));var _0x5809=function(_0x27efe8,_0x55a922){_0x27efe8=_0x27efe8-0x0;var _0x268827=_0x8095[_0x27efe8];return _0x268827;};'use strict';var util=require(_0x5809('0x0'));var _=require(_0x5809('0x1'));var BPromise=require(_0x5809('0x2'));var uuid=require(_0x5809('0x3'));var moment=require(_0x5809('0x4'));var md5=require('md5');var Redis=require(_0x5809('0x5'));var config=require(_0x5809('0x6'));var logger=require(_0x5809('0x7'))(_0x5809('0x8'));var loggerAction=require(_0x5809('0x7'))(_0x5809('0x9'));var ami=require('../ami');var rpcDb=require(_0x5809('0xa'));var Action=require(_0x5809('0xb'));var ut=require(_0x5809('0xc'));config[_0x5809('0xd')]=_['defaults'](config[_0x5809('0xd')],{'host':_0x5809('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5809('0xd')]));var Sequence=function(){};Sequence[_0x5809('0xf')][_0x5809('0x10')]=function(_0x3c6b54){this[_0x5809('0x11')]=this[_0x5809('0x11')]?this[_0x5809('0x11')][_0x5809('0x12')](_0x3c6b54):_0x3c6b54();};function Preview(_0x1f4647){this[_0x5809('0x13')]=new Sequence();this[_0x5809('0x14')]=_0x1f4647[_0x5809('0x15')];this[_0x5809('0x16')]=_0x1f4647[_0x5809('0x16')];this[_0x5809('0x17')]={};this[_0x5809('0x18')]=_0x1f4647['agents'];this[_0x5809('0x19')]=0x0;ami['on'](_0x5809('0x1a'),this[_0x5809('0x1b')][_0x5809('0x1c')](this));ami['on'](_0x5809('0x1d'),this['syncHangup'][_0x5809('0x1c')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0x5809('0x1c')](this));ami['on'](_0x5809('0x1e'),this[_0x5809('0x1f')][_0x5809('0x1c')](this));ami['on'](_0x5809('0x20'),this['syncNewExten'][_0x5809('0x1c')](this));ami['on']('varset',this[_0x5809('0x21')][_0x5809('0x1c')](this));ami['on'](_0x5809('0x22'),this[_0x5809('0x23')][_0x5809('0x1c')](this));ami['on'](_0x5809('0x24'),this[_0x5809('0x25')][_0x5809('0x1c')](this));this[_0x5809('0x26')](this[_0x5809('0x14')]);}function emit(_0x5f575e,_0x55daea,_0x15af55){io['to'](_0x5f575e)[_0x5809('0x27')](_0x55daea,_0x15af55);}function emitCampaignPreview(_0x8ce33){if(_0x8ce33[_0x5809('0x28')]===_0x5809('0x29')){var _0x3921a1={'id':_0x8ce33['id'],'name':_0x8ce33[_0x5809('0x2a')],'strategy':_0x8ce33[_0x5809('0x2b')],'answered':_0x8ce33[_0x5809('0x2c')],'available':_0x8ce33[_0x5809('0x2d')],'loggedIn':_0x8ce33[_0x5809('0x2e')],'pTalking':_0x8ce33[_0x5809('0x2f')],'sumBillable':_0x8ce33['sumBillable'],'sumDuration':_0x8ce33[_0x5809('0x30')],'sumHoldTime':_0x8ce33['sumHoldTime']||0x0,'talking':_0x8ce33[_0x5809('0x31')],'total':_0x8ce33[_0x5809('0x32')],'type':_0x8ce33['type'],'unmanaged':_0x8ce33[_0x5809('0x33')],'abandoned':_0x8ce33[_0x5809('0x34')],'waiting':_0x8ce33[_0x5809('0x35')],'loggedInDb':_0x8ce33[_0x5809('0x36')],'dialActive':_0x8ce33['dialActive'],'dialMethod':_0x8ce33[_0x5809('0x37')],'dialOriginateCallerIdName':_0x8ce33[_0x5809('0x38')],'dialOriginateCallerIdNumber':_0x8ce33['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x8ce33[_0x5809('0x39')],'dialPrefix':_0x8ce33[_0x5809('0x3a')],'outboundAnswerAgiCallsDay':_0x8ce33[_0x5809('0x3b')],'outboundAnswerCallsDay':_0x8ce33[_0x5809('0x3c')],'outboundBlacklistCallsDay':_0x8ce33[_0x5809('0x3d')],'outboundBusyCallsDay':_0x8ce33[_0x5809('0x3e')],'outboundCongestionCallsDay':_0x8ce33[_0x5809('0x3f')],'outboundDropCallsDayACS':_0x8ce33[_0x5809('0x40')],'outboundDropCallsDayCallersExit':_0x8ce33[_0x5809('0x41')],'outboundDropCallsDayTimeout':_0x8ce33[_0x5809('0x42')],'outboundNoAnswerCallsDay':_0x8ce33[_0x5809('0x43')],'outboundNoSuchCallsDay':_0x8ce33[_0x5809('0x44')],'outboundOriginateFailureCallsDay':_0x8ce33[_0x5809('0x45')],'outboundReCallsDay':_0x8ce33[_0x5809('0x46')],'outboundRejectCallsDay':_0x8ce33[_0x5809('0x47')],'outboundUnknownCallsDay':_0x8ce33[_0x5809('0x48')],'outboundAbandonedCallsDay':_0x8ce33['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x8ce33[_0x5809('0x49')],'predictiveIntervalAvgHoldtime':_0x8ce33[_0x5809('0x4a')],'predictiveIntervalAvgTalktime':_0x8ce33[_0x5809('0x4b')],'predictiveIntervalDroppedCallsCallersExit':_0x8ce33[_0x5809('0x4c')],'predictiveIntervalDroppedCallsTimeout':_0x8ce33[_0x5809('0x4d')],'predictiveIntervalErlangCalls':_0x8ce33['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x8ce33[_0x5809('0x4e')],'predictiveIntervalHitRate':_0x8ce33['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x8ce33[_0x5809('0x4f')],'predictiveIntervalPauses':_0x8ce33[_0x5809('0x50')],'predictiveIntervalAvailable':_0x8ce33['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x8ce33['predictiveIntervalTotalCalls'],'message':_0x8ce33[_0x5809('0x51')],'originated':_0x8ce33[_0x5809('0x52')],'erlangCalls':_0x8ce33[_0x5809('0x53')],'erlangCallToSecond':_0x8ce33['erlangCallToSecond'],'erlangAbandonmentRate':_0x8ce33[_0x5809('0x54')],'erlangBusyFactor':_0x8ce33[_0x5809('0x55')],'startPredictive':_0x8ce33[_0x5809('0x56')],'startProgressive':_0x8ce33[_0x5809('0x57')]};if(_0x8ce33[_0x5809('0x58')]){_0x3921a1['Trunk']={'id':_0x8ce33[_0x5809('0x58')]['id'],'name':_0x8ce33['Trunk'][_0x5809('0x2a')],'active':_0x8ce33[_0x5809('0x58')]['active'],'callerid':_0x8ce33[_0x5809('0x58')][_0x5809('0x59')]};}if(_0x8ce33[_0x5809('0x5a')]){_0x3921a1[_0x5809('0x5a')]={'id':_0x8ce33['Interval']['id'],'name':_0x8ce33[_0x5809('0x5a')][_0x5809('0x2a')]};}var _0x3ff712=md5(JSON[_0x5809('0x5b')](_0x3921a1));if(_0x8ce33[_0x5809('0x5c')]!==_0x3ff712){_0x8ce33[_0x5809('0x5c')]=_0x3ff712;emit(util[_0x5809('0x5d')](_0x5809('0x5e'),_0x3921a1[_0x5809('0x2a')]),_0x5809('0x5f'),_0x3921a1);}}}function emitVoiceQueueChannelRemove(_0x23b6a){logger[_0x5809('0x60')](_0x5809('0x61'),JSON[_0x5809('0x5b')](_0x23b6a));emit(util[_0x5809('0x5d')](_0x5809('0x5e'),_0x23b6a[_0x5809('0x2a')]),_0x5809('0x62'),_0x23b6a);io[_0x5809('0x27')]('voice_queue_presence:remove',_0x23b6a);}function notSendMessagesQueue(_0x3c6653){if(_0x3c6653[_0x5809('0x63')]){if(_0x3c6653['originated']===0x0&&_0x3c6653[_0x5809('0x2f')]===0x0){_0x3c6653[_0x5809('0x63')]=![];_0x3c6653[_0x5809('0x2d')]=0x0;_0x3c6653[_0x5809('0x64')]=0x0;_0x3c6653['message']=_0x5809('0x65');ut[_0x5809('0x66')](_0x5809('0x67'),_0x3c6653['name']+_0x5809('0x68'));}else{_0x3c6653['message']=_0x5809('0x69');ut['logger'](_0x5809('0x67'),_0x3c6653[_0x5809('0x2a')]+'\x20is\x20disactive');}emitCampaignPreview(_0x3c6653);}}Preview[_0x5809('0xf')][_0x5809('0x26')]=function(){var _0x2f3d50=this;setInterval(function(){_0x2f3d50[_0x5809('0x6a')]();},0x7cf);};Preview[_0x5809('0xf')][_0x5809('0x6a')]=function(){var _0x4f710c=this[_0x5809('0x14')];this['clockClearZombieChannels']+=0x1;for(var _0x7da3 in _0x4f710c){if(_0x4f710c[_0x5809('0x6b')](_0x7da3)&&(_0x4f710c[_0x7da3][_0x5809('0x37')]===_0x5809('0x8')||_0x4f710c[_0x7da3][_0x5809('0x37')]===_0x5809('0x6c'))&&_0x4f710c[_0x7da3][_0x5809('0x28')]===_0x5809('0x29')){if(this[_0x5809('0x19')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x5809('0x6d')]();}}if(_0x4f710c[_0x5809('0x6b')](_0x7da3)&&_0x4f710c[_0x7da3]['dialMethod']===_0x5809('0x8')&&_0x4f710c[_0x7da3][_0x5809('0x28')]===_0x5809('0x29')){if(_0x4f710c[_0x7da3][_0x5809('0x6e')]){this[_0x5809('0x6f')](_0x4f710c[_0x7da3]);this[_0x5809('0x70')](_0x4f710c[_0x7da3]);}else{notSendMessagesQueue(_0x4f710c[_0x7da3]);}}}};Preview[_0x5809('0xf')][_0x5809('0x71')]=function(_0x3dfa50){var _0x4dd24c=this;this[_0x5809('0x13')][_0x5809('0x10')](function(){if(!_[_0x5809('0x72')](_0x4dd24c['actions'][_0x3dfa50])){loggerAction['info'](_0x5809('0x73'),_0x3dfa50,_0x5809('0x74'),_0x4dd24c['actions'][_0x3dfa50][_0x5809('0x75')],'originated:\x20',JSON['stringify'](_0x4dd24c[_0x5809('0x14')][_0x4dd24c[_0x5809('0x17')][_0x3dfa50][_0x5809('0x75')]][_0x5809('0x52')]),_0x5809('0x76'),JSON[_0x5809('0x5b')](_0x4dd24c[_0x5809('0x14')][_0x4dd24c['actions'][_0x3dfa50][_0x5809('0x75')]][_0x5809('0x2f')]),JSON['stringify'](_0x4dd24c['actions'][_0x3dfa50][_0x5809('0x77')]),JSON[_0x5809('0x5b')](_['pick'](_0x4dd24c['actions'][_0x3dfa50],[_0x5809('0x78'),_0x5809('0x79'),_0x5809('0x7a'),'ListId'])));return ami[_0x5809('0x7b')]({'action':'status','channel':_0x4dd24c[_0x5809('0x17')][_0x3dfa50][_0x5809('0x7c')]})[_0x5809('0x7d')](function(_0x31d408){if(_0x31d408[_0x5809('0x51')]===_0x5809('0x7e')){setTimeout(function(){if(_0x4dd24c[_0x5809('0x17')][_0x3dfa50]){ut[_0x5809('0x7f')](_0x4dd24c[_0x5809('0x14')][_0x4dd24c[_0x5809('0x17')][_0x3dfa50][_0x5809('0x75')]],_0x5809('0x80'));if(_0x4dd24c['actions'][_0x3dfa50]['dialAnswer']===!![]){ut[_0x5809('0x81')](_0x4dd24c[_0x5809('0x14')][_0x4dd24c[_0x5809('0x17')][_0x3dfa50]['queue']],_0x5809('0x80'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x3dfa50,_0x4dd24c[_0x5809('0x17')][_0x3dfa50]['queue']);}ut[_0x5809('0x82')](_0x5809('0x83')+_0x3dfa50,_0x4dd24c['actions'][_0x3dfa50][_0x5809('0x75')]);delete _0x4dd24c[_0x5809('0x17')][_0x3dfa50];}},0x2328);}});}});};Preview[_0x5809('0xf')][_0x5809('0x6d')]=function(){var _0x3e74dd=this;loggerAction['info'](_0x5809('0x84'),_['size'](this[_0x5809('0x17')]));for(var _0x1dbac3 in this['actions']){if(_0x3e74dd[_0x5809('0x17')]['hasOwnProperty'](_0x1dbac3)){_0x3e74dd[_0x5809('0x71')](_0x1dbac3);}}};Preview['prototype']['recallMe']=function(_0x416565){var _0x57f946=this;rpcDb['getContactRecallMe'](_0x416565['id'],ut['agentReadyId'](this[_0x5809('0x18')]))['then'](function(_0x52098c){if(!_[_0x5809('0x72')](_0x52098c)){for(var _0x293d53=0x0;_0x293d53<_0x52098c['length'];_0x293d53+=0x1){if(ut[_0x5809('0x85')](_0x52098c[_0x293d53][_0x5809('0x86')])<_0x416565[_0x5809('0x87')]*0x3c){if(_0x52098c[_0x293d53][_0x5809('0x88')]&&!_0x52098c[_0x293d53][_0x5809('0x88')][_0x5809('0x89')]){_0x57f946[_0x5809('0x8a')](_0x52098c[_0x293d53]['id'])[_0x5809('0x8b')](ut['logger2'](_0x5809('0x8c')))[_0x5809('0x7d')](ut['logger2'](_0x5809('0x8c')));}else{rpcDb[_0x5809('0x8d')](_0x52098c[_0x293d53]['id']);}}else{var _0x44bb07=new Action(_0x52098c[_0x293d53],_0x416565);_0x44bb07[_0x5809('0x8e')]=moment()[_0x5809('0x5d')](_0x5809('0x8f'));_0x416565[_0x5809('0x46')]+=0x1;ut[_0x5809('0x90')](_0x44bb07,0x17,_0x5809('0x91'));if(_0x416565[_0x5809('0x92')]){rpcDb[_0x5809('0x93')](ut['createBody'](_0x52098c[_0x293d53]));rpcDb[_0x5809('0x94')](_0x44bb07,_0x5809('0x95'));}else{ut[_0x5809('0x90')](_0x44bb07,0x16,'RecallFailedTimeout');rpcDb[_0x5809('0x94')](_0x44bb07,_0x5809('0x96'));rpcDb['createCustomerFinal'](_0x44bb07,'[HistoryRecallClose]');}}}}})[_0x5809('0x7d')](ut['logger2'](_0x5809('0x97')));};Preview[_0x5809('0xf')][_0x5809('0x6f')]=function(_0x19d220){_0x19d220[_0x5809('0x63')]=!![];if(ut['IsNotLoggedIn'](_0x19d220[_0x5809('0x2e')])){_0x19d220[_0x5809('0x51')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x5809('0x98')](_0x19d220[_0x5809('0x6e')])){_0x19d220[_0x5809('0x51')]='NOT_ACTIVE';}else if(!this['isTrunkReachable'](_0x19d220['Trunk'])){if(!this[_0x5809('0x99')](_0x19d220[_0x5809('0x9a')])){_0x19d220[_0x5809('0x51')]=_0x5809('0x9b');}else{_0x19d220[_0x5809('0x51')]=_0x5809('0x9c');}}else{_0x19d220[_0x5809('0x51')]=_0x5809('0x9c');}emitCampaignPreview(_0x19d220);};Preview[_0x5809('0xf')]['callProgressDetectingCustomer']=function(_0x3989d9,_0x1e186f,_0x3928bc){var _0xcc7a96=this;var _0x155ef1=this[_0x5809('0x17')][_0x1e186f];var _0x45f570=this['campaignsPreview'][_0x155ef1[_0x5809('0x75')]];var _0x5df736;if(_0x45f570){switch(_0x3928bc){case'1':_0x45f570['outboundNoSuchCallsDay']+=0x1;_0x155ef1[_0x5809('0x9d')]+=0x1;_0x155ef1[_0x5809('0x9e')]=ut[_0x5809('0x9f')](_0x155ef1);ut[_0x5809('0x90')](_0x155ef1,0x0,_0x5809('0xa0'));ami[_0x5809('0x27')](_0x5809('0xa1'),ut['buildObj'](_0x155ef1,_0x5809('0xa2')));rpcDb[_0x5809('0x94')](_0x155ef1,_0x5809('0xa3'));if(ut['totalGlobal'](_0x155ef1)>=_0x45f570[_0x5809('0xa4')]){_0x5df736=ut['cloneAction'](_0x155ef1,0xf,_0x5809('0xa5'));rpcDb[_0x5809('0xa6')](_0x5df736,_0x5809('0xa7'));}else{if(_0x155ef1['countnosuchnumberretry']>=_0x45f570['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x155ef1,_0x5809('0xa7'));}else{rpcDb[_0x5809('0xa8')](ut[_0x5809('0xa9')](_0x155ef1,_0x5809('0x9d'),_0x45f570[_0x5809('0xaa')]),_0x155ef1[_0x5809('0xab')],_0x155ef1[_0x5809('0xac')]);}}delete this[_0x5809('0x17')][_0x3989d9[_0x5809('0xad')]];break;case _0x5809('0xae'):var _0x26fdf8=moment()[_0x5809('0x5d')](_0x5809('0x8f'));_0x155ef1[_0x5809('0xaf')]=_0x26fdf8;_0x155ef1[_0x5809('0xb0')]=_0x26fdf8;_0x155ef1['dialAnswer']=!![];_0x45f570[_0x5809('0x2f')]+=0x1;logger['info'](_0x5809('0xb1'),_0x155ef1[_0x5809('0xb2')],'\x20Queue',_0x45f570[_0x5809('0x2a')],_0x5809('0x76'),_0x45f570[_0x5809('0x2f')]);ami['emit'](_0x5809('0xb3'),ut[_0x5809('0xb4')](_0x155ef1,_0x5809('0xb5'),this['campaignsPreview'][_0x155ef1[_0x5809('0x75')]]));if(_0x45f570[_0x5809('0xb6')]){ami['emit'](_0x5809('0xb7'),ut[_0x5809('0xb8')](_0x155ef1));}break;case'16':ami[_0x5809('0x27')](_0x5809('0xb9'),ut[_0x5809('0xb4')](_0x155ef1,_0x5809('0xba'),this[_0x5809('0x14')][_0x155ef1[_0x5809('0x75')]]));emitVoiceQueueChannelRemove(ut[_0x5809('0xb4')](_0x155ef1,_0x5809('0xba')));_0x45f570[_0x5809('0x3c')]+=0x1;_0x45f570['total']+=0x1;_0x45f570['answered']+=0x1;ut[_0x5809('0x81')](_0x45f570,_0x5809('0xbb'));_0x155ef1[_0x5809('0x9e')]=ut[_0x5809('0x9f')](_0x155ef1);ut[_0x5809('0x90')](_0x155ef1,0x4,_0x5809('0xbc'));rpcDb['createCustomerHistory'](_0x155ef1,_0x5809('0xbd'));rpcDb[_0x5809('0xa6')](_0x155ef1,_0x5809('0xbe'));rpcDb[_0x5809('0xbf')](_0x155ef1);_0x45f570[_0x5809('0x30')]+=_0x155ef1['talktime'];_0x45f570['sumBillable']+=_0x155ef1[_0x5809('0xc0')];logger['info'](_0x5809('0xc1'),_0x155ef1[_0x5809('0xb2')],_0x5809('0xc2'),_0x45f570[_0x5809('0x2a')],_0x5809('0x76'),_0x45f570[_0x5809('0x2f')]);delete this['actions'][_0x3989d9[_0x5809('0xad')]];break;case _0x5809('0xc3'):_0x45f570[_0x5809('0x3e')]+=0x1;_0x155ef1[_0x5809('0xc4')]+=0x1;_0x155ef1[_0x5809('0x9e')]=ut['totalGlobal'](_0x155ef1);ut[_0x5809('0x90')](_0x155ef1,0x5,_0x5809('0xc5'));ami[_0x5809('0x27')](_0x5809('0xc6'),ut[_0x5809('0xb4')](_0x155ef1,'busy'));rpcDb[_0x5809('0x94')](_0x155ef1,_0x5809('0xc7'));if(ut[_0x5809('0x9f')](_0x155ef1)>=_0x45f570['dialGlobalMaxRetry']){_0x5df736=ut[_0x5809('0xc8')](_0x155ef1,0xf,_0x5809('0xa5'));rpcDb[_0x5809('0xa6')](_0x5df736,_0x5809('0xc9'));}else{if(_0x155ef1['countbusyretry']>=_0x45f570[_0x5809('0xca')]){rpcDb['createCustomerFinal'](_0x155ef1,_0x5809('0xc7'));}else{rpcDb[_0x5809('0xa8')](ut[_0x5809('0xa9')](_0x155ef1,'countbusyretry',_0x45f570[_0x5809('0xcb')]),_0x155ef1[_0x5809('0xab')],_0x155ef1[_0x5809('0xac')]);}}break;case'NOANSWER':_0x45f570[_0x5809('0x43')]+=0x1;_0x155ef1[_0x5809('0xcc')]+=0x1;_0x155ef1[_0x5809('0x9e')]=ut['totalGlobal'](_0x155ef1);ut[_0x5809('0x90')](_0x155ef1,0x3,_0x5809('0xcd'));ami[_0x5809('0x27')](_0x5809('0xce'),ut[_0x5809('0xb4')](_0x155ef1,'noanswer'));rpcDb[_0x5809('0x94')](_0x155ef1,_0x5809('0xcf'));if(ut[_0x5809('0x9f')](_0x155ef1)>=_0x45f570[_0x5809('0xa4')]){_0x5df736=ut[_0x5809('0xc8')](_0x155ef1,0xf,_0x5809('0xa5'));rpcDb[_0x5809('0xa6')](_0x5df736,_0x5809('0xd0'));}else{if(_0x155ef1[_0x5809('0xcc')]>=_0x45f570[_0x5809('0xd1')]){rpcDb[_0x5809('0xa6')](_0x155ef1,_0x5809('0xcf'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x155ef1,_0x5809('0xcc'),_0x45f570['dialNoAnswerRetryFrequency']),_0x155ef1[_0x5809('0xab')],_0x155ef1['activeContact']);}}break;case _0x5809('0xd2'):_0x45f570[_0x5809('0x3f')]+=0x1;_0x155ef1[_0x5809('0xd3')]+=0x1;_0x155ef1['countglobal']=ut['totalGlobal'](_0x155ef1);ut[_0x5809('0x90')](_0x155ef1,0x8,'Congestion');ami['emit'](_0x5809('0xd4'),ut[_0x5809('0xb4')](_0x155ef1,_0x5809('0xd5')));rpcDb[_0x5809('0x94')](_0x155ef1,_0x5809('0xd6'));if(ut[_0x5809('0x9f')](_0x155ef1)>=_0x45f570[_0x5809('0xa4')]){_0x5df736=ut[_0x5809('0xc8')](_0x155ef1,0xf,_0x5809('0xa5'));rpcDb[_0x5809('0xa6')](_0x5df736,_0x5809('0xd7'));}else{if(_0x155ef1[_0x5809('0xd3')]>=_0x45f570[_0x5809('0xd8')]){rpcDb[_0x5809('0xa6')](_0x155ef1,_0x5809('0xd6'));}else{rpcDb[_0x5809('0xa8')](ut[_0x5809('0xa9')](_0x155ef1,_0x5809('0xd3'),_0x45f570['dialBusyRetryFrequency']),_0x155ef1[_0x5809('0xab')],_0x155ef1[_0x5809('0xac')]);}}break;case'CANCEL':_0x45f570[_0x5809('0x47')]+=0x1;_0x155ef1[_0x5809('0xd9')]+=0x1;_0x155ef1[_0x5809('0x9e')]=ut[_0x5809('0x9f')](_0x155ef1);ut['logCustomer'](_0x155ef1,0x14,_0x5809('0xda'));ami[_0x5809('0x27')](_0x5809('0xdb'),ut['buildObj'](_0x155ef1,'agentreject'));rpcDb['createCustomerHistory'](_0x155ef1,_0x5809('0xdc'));if(ut[_0x5809('0x9f')](_0x155ef1)>=_0x45f570[_0x5809('0xa4')]){_0x5df736=ut[_0x5809('0xc8')](_0x155ef1,0x14,'AgentReject');rpcDb[_0x5809('0xa6')](_0x5df736,_0x5809('0xdd'));}else{if(_0x155ef1[_0x5809('0xd9')]>=_0x45f570[_0x5809('0xde')]){rpcDb[_0x5809('0xa6')](_0x155ef1,_0x5809('0xdd'));}else{rpcDb['rescheduleContact'](ut[_0x5809('0xa9')](_0x155ef1,_0x5809('0xd9'),_0x45f570[_0x5809('0xdf')]),_0x155ef1[_0x5809('0xab')],_0x155ef1['activeContact']);}}break;case _0x5809('0xe0'):_0x45f570[_0x5809('0xe1')]+=0x1;_0x155ef1['countabandonedretry']+=0x1;_0x155ef1['countglobal']=ut[_0x5809('0x9f')](_0x155ef1);ut[_0x5809('0x90')](_0x155ef1,0xb,_0x5809('0xe2'));rpcDb[_0x5809('0x94')](_0x155ef1,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x5809('0x9f')](_0x155ef1)>=_0x45f570[_0x5809('0xa4')]){_0x5df736=ut[_0x5809('0xc8')](_0x155ef1,0xf,'Global');rpcDb[_0x5809('0xa6')](_0x5df736,_0x5809('0xe3'));}else{if(_0x155ef1[_0x5809('0xe4')]>=_0x45f570[_0x5809('0xe5')]){rpcDb[_0x5809('0xa6')](_0x155ef1,_0x5809('0xe3'));}else{rpcDb[_0x5809('0xa8')](ut[_0x5809('0xa9')](_0x155ef1,_0x5809('0xe6'),_0x45f570[_0x5809('0xe7')]),_0x155ef1[_0x5809('0xab')],_0x155ef1[_0x5809('0xac')]);}}break;case'18':_0x45f570[_0x5809('0x48')]+=0x1;_0x155ef1['countmachineretry']+=0x1;_0x155ef1['countglobal']=ut[_0x5809('0x9f')](_0x155ef1);ut[_0x5809('0x90')](_0x155ef1,0x12,_0x3989d9['cause-txt']||_0x3989d9['dialstatus']);ami[_0x5809('0x27')](_0x5809('0xe8'),ut[_0x5809('0xb4')](_0x155ef1,'amd'));rpcDb['createCustomerHistory'](_0x155ef1,_0x5809('0xe9'));if(ut[_0x5809('0x9f')](_0x155ef1)>=_0x45f570[_0x5809('0xa4')]){_0x5df736=ut[_0x5809('0xc8')](_0x155ef1,0xf,_0x5809('0xa5'));rpcDb[_0x5809('0xa6')](_0x5df736,_0x5809('0xe9'));}else{rpcDb[_0x5809('0xa6')](_0x155ef1,_0x5809('0xe9'));}delete this[_0x5809('0x17')][_0x3989d9[_0x5809('0xad')]];break;case'19':_0x45f570['outboundUnknownCallsDay']+=0x1;_0x155ef1['countglobal']=ut[_0x5809('0x9f')](_0x155ef1);ut['logCustomer'](_0x155ef1,0x13,_0x3989d9['cause-txt']||_0x3989d9[_0x5809('0xea')]);ami['emit'](_0x5809('0xe8'),ut[_0x5809('0xb4')](_0x155ef1,_0x5809('0xeb')));rpcDb['createCustomerHistory'](_0x155ef1,_0x5809('0xec'));if(ut['totalGlobal'](_0x155ef1)>=_0x45f570[_0x5809('0xa4')]){_0x5df736=ut[_0x5809('0xc8')](_0x155ef1,0xf,_0x5809('0xa5'));rpcDb[_0x5809('0xa6')](_0x5df736,_0x5809('0xec'));}else{rpcDb[_0x5809('0xa6')](_0x155ef1,_0x5809('0xec'));}delete this[_0x5809('0x17')][_0x3989d9[_0x5809('0xad')]];break;default:if(_0x155ef1[_0x5809('0x77')]){ut[_0x5809('0x81')](_0x45f570,_0x5809('0xed'));ut[_0x5809('0x82')](_0x5809('0xee')+_0x45f570[_0x5809('0x2a')],_0x3989d9);}_0x45f570['outboundUnknownCallsDay']+=0x1;_0x155ef1['countglobal']=ut[_0x5809('0x9f')](_0x155ef1);ut[_0x5809('0x90')](_0x155ef1,0xc,_0x3989d9[_0x5809('0xef')]||_0x3989d9[_0x5809('0xea')]);rpcDb[_0x5809('0x94')](_0x155ef1,_0x5809('0xf0'));if(ut[_0x5809('0x9f')](_0x155ef1)>=_0x45f570[_0x5809('0xa4')]){_0x5df736=ut['cloneAction'](_0x155ef1,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df736,_0x5809('0xf1'));}else{rpcDb[_0x5809('0xa6')](_0x155ef1,_0x5809('0xf1'));}delete this[_0x5809('0x17')][_0x3989d9[_0x5809('0xad')]];}if(!(_0x155ef1[_0x5809('0x77')]&&_0x3928bc==='16')){ut[_0x5809('0x7f')](_0x45f570,_0x5809('0xf2'));logger[_0x5809('0x60')](_0x5809('0xf3'),_0x155ef1[_0x5809('0xb2')],_0x5809('0xc2'),_0x45f570[_0x5809('0x2a')],'originated:\x20',_0x45f570[_0x5809('0x52')]);}if(_0x3928bc!==_0x5809('0xae')){delete this[_0x5809('0x17')][_0x3989d9[_0x5809('0xad')]];delete this['actions'][_0x3989d9[_0x5809('0xf4')]];}}};Preview['prototype'][_0x5809('0xf5')]=function(_0x30df0a,_0x337045,_0x13e526){if(_[_0x5809('0xf6')](_0x337045)&&_0x5809('0xf7')!==typeof _0x337045){return;}if(_[_0x5809('0xf6')](_0x13e526)&&'object'!==typeof _0x13e526){return;}switch(_0x13e526[_0x5809('0xf8')]){case'0':ut[_0x5809('0xf9')](_0x30df0a,0x0,'NoSuchNumber');rpcDb[_0x5809('0xfa')](_0x30df0a,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x5809('0xf9')](_0x30df0a,0x3,_0x5809('0xcd'));rpcDb['createAgentHistory'](_0x30df0a,_0x5809('0xfb'));break;case'5':ut[_0x5809('0xf9')](_0x30df0a,0x5,_0x5809('0xc5'));rpcDb[_0x5809('0xfa')](_0x30df0a,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x5809('0xf9')](_0x30df0a,0x8,_0x5809('0xfc'));rpcDb[_0x5809('0xfa')](_0x30df0a,_0x5809('0xfd'));break;case'22':ut['logAgent'](_0x30df0a,0x16,'AnswerAGI');rpcDb[_0x5809('0xfa')](_0x30df0a,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x5809('0xf9')](_0x30df0a,0xc,_0x13e526[_0x5809('0xf8')]);rpcDb[_0x5809('0xfa')](_0x30df0a,'[callProgressDetectingAgent][logCongestion]');}ut[_0x5809('0x7f')](_0x337045,'[callProgressDetectingAgent]');logger[_0x5809('0x60')](_0x5809('0xfe'),_0x30df0a['uniqueid'],_0x5809('0xc2'),_0x337045[_0x5809('0x2a')],_0x5809('0xff'),_0x337045[_0x5809('0x52')]);delete this[_0x5809('0x17')][_0x30df0a['uniqueid']];};Preview[_0x5809('0xf')][_0x5809('0x100')]=function(_0x156cb8,_0x309804,_0x14a453,_0x4f957c,_0x1d9021){var _0x165965=this;return new BPromise(function(_0x397800,_0x42fe66){if(_[_0x5809('0x72')](_0x309804)||_[_0x5809('0x72')](_0x309804[_0x5809('0x101')])||_['isNil'](_0x309804[_0x5809('0x101')]['phone'])||_['isNil'](_0x309804[_0x5809('0x7a')])){_0x42fe66(ut[_0x5809('0x51')]('Contact\x20is\x20undefined',_0x4f957c,_0x1d9021));return;}var _0x4e1aad=uuid['v4']();var _0x50ef83=_0x165965['campaignsPreview'][_0x309804['Queue'][_0x5809('0x2a')]];var _0x36daf9=_0x14a453?_0x165965[_0x5809('0x18')][_0x14a453]['id']:undefined;_0x165965[_0x5809('0x17')][_0x4e1aad]=new Action(_0x309804,_0x50ef83,_0x4e1aad,_0x14a453,_0x36daf9);var _0x5dcec5=_0x165965[_0x5809('0x17')][_0x4e1aad];_0x5dcec5[_0x5809('0xab')]=_0x4f957c;_0x5dcec5[_0x5809('0xac')]=_0x1d9021;_0x5dcec5[_0x5809('0x102')]=_0x14a453;if(_[_0x5809('0x103')](_0x156cb8)){_0x165965[_0x5809('0x104')](_0x5dcec5,_0x50ef83,_0x309804,_0x14a453)[_0x5809('0x8b')](function(_0xa68187){logger[_0x5809('0x60')]('[Preview][execCall][success]','Queue:\x20'+_0x5dcec5[_0x5809('0x75')]+'\x20IdHopper:\x20'+_0x5dcec5['idContact'],JSON['stringify'](_0xa68187));ami[_0x5809('0x27')]('custom:agentcalled',ut[_0x5809('0xb4')](_0x5dcec5,_0x5809('0x105'),_0x165965[_0x5809('0x14')][_0x5dcec5[_0x5809('0x75')]]));_0x397800(ut['message'](_0x5809('0x106')));})[_0x5809('0x7d')](function(_0x12968d){ut[_0x5809('0x66')]('[Preview][execCall][failure]',_0x12968d);_0x42fe66(ut[_0x5809('0x51')]('Call\x20failed',_0x4f957c,_0x1d9021));});}else{_0x50ef83[_0x5809('0x3d')]+=0x1;ut[_0x5809('0x107')](_0x5dcec5);rpcDb[_0x5809('0x108')](_0x5dcec5,_0x5809('0x109'));delete _0x165965[_0x5809('0x17')][_0x4e1aad];_0x42fe66(ut[_0x5809('0x51')](_0x5809('0x10a'),_0x4f957c,_0x1d9021));}});};Preview[_0x5809('0xf')][_0x5809('0x99')]=function(_0x213281){return!_[_0x5809('0x72')](_0x213281)&&!_['isNil'](_0x213281['name'])&&!_[_0x5809('0x72')](_0x213281['active'])&&_0x213281[_0x5809('0x10b')]&&!_[_0x5809('0x72')](this[_0x5809('0x16')][util[_0x5809('0x5d')](_0x5809('0x10c'),_0x213281[_0x5809('0x2a')])])&&!_['isNil'](this['trunks'][util[_0x5809('0x5d')](_0x5809('0x10c'),_0x213281['name'])][_0x5809('0x10d')])&&(this['trunks'][util['format'](_0x5809('0x10c'),_0x213281['name'])][_0x5809('0x10d')]===_0x5809('0x10e')||this['trunks'][util[_0x5809('0x5d')](_0x5809('0x10c'),_0x213281[_0x5809('0x2a')])][_0x5809('0x10d')]===_0x5809('0x10f'));};Preview[_0x5809('0xf')]['run']=function(_0x4d680a,_0x541adb){var _0x516e42=this;return new BPromise(function(_0x28d44f,_0x31654a){_0x516e42[_0x5809('0x110')](_0x4d680a,_0x541adb)[_0x5809('0x8b')](function(_0x3c25b9){_0x28d44f(_[_0x5809('0x111')](_0x3c25b9,[_0x5809('0x51')]));})[_0x5809('0x7d')](function(_0x1c3570){if(_0x1c3570[_0x5809('0x112')]){rpcDb[_0x5809('0x113')](_0x4d680a);}if(_0x1c3570[_0x5809('0x10b')]){rpcDb[_0x5809('0x8d')](_0x4d680a);}_0x31654a(_[_0x5809('0x111')](_0x1c3570,[_0x5809('0x51')]));});});};Preview[_0x5809('0xf')][_0x5809('0x110')]=function(_0x38b8ab,_0x49846d){var _0x41922c=this;return new BPromise(function(_0x77699e,_0x44f5a0){var _0x498e0f,_0x39cdeb;rpcDb[_0x5809('0x114')](_0x38b8ab)[_0x5809('0x8b')](function(_0x5deaba){if(!_[_0x5809('0x72')](_0x5deaba[0x0])){_0x39cdeb=_0x5deaba[0x0][_0x5809('0x115')]?![]:!![];_0x498e0f=_0x5deaba[0x0][_0x5809('0x115')]?!![]:![];_0x498e0f=_0x49846d?!![]:_0x498e0f;}var _0x4ce236=_0x41922c[_0x5809('0x116')](_0x5deaba);if(_0x4ce236['isValid']){rpcDb[_0x5809('0x117')](_['pick'](_0x5deaba[0x0],['VoiceQueueId',_0x5809('0x118')]))['then'](function(_0x55bca0){_0x41922c[_0x5809('0x100')](_0x55bca0,_0x5deaba[0x0],_0x49846d,_0x39cdeb,_0x498e0f)[_0x5809('0x8b')](function(_0x2358bd){_0x77699e(_0x2358bd);})['catch'](function(_0x4e0e46){_0x44f5a0(_0x4e0e46);});})[_0x5809('0x7d')](function(_0x3a120a){ut['logger'](_0x5809('0x119'),_0x3a120a);_0x44f5a0(ut[_0x5809('0x51')]('Call\x20unsuccessful',_0x39cdeb,_0x498e0f));});}else{_0x44f5a0(ut[_0x5809('0x51')](_0x4ce236[_0x5809('0x51')],_0x39cdeb,_0x498e0f));}})[_0x5809('0x7d')](function(_0x7948b3){ut[_0x5809('0x66')](_0x5809('0x11a'),_0x7948b3);_0x44f5a0(ut[_0x5809('0x51')](_0x5809('0x11b'),![],!![]));});});};Preview['prototype']['validateContact']=function(_0x4bdf28){if(_[_0x5809('0x72')](_0x4bdf28)||_['isEmpty'](_0x4bdf28)||!_['isNil'](_0x4bdf28[0x0]['Agent'])&&_[_0x5809('0x72')](_0x4bdf28[0x0][_0x5809('0x88')]['name'])){ut[_0x5809('0x66')]('[Preview][validateContact][Empty\x20Contact]',_0x4bdf28);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x273a05=this[_0x5809('0x14')][_0x4bdf28[0x0][_0x5809('0x74')][_0x5809('0x2a')]];_0x273a05[_0x5809('0x51')]=_0x5809('0x9c');if(_[_0x5809('0x72')](_0x273a05)){ut[_0x5809('0x66')]('[Preview][validateContact][Empty\x20Campaign]',_0x273a05);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x5809('0x99')](_0x273a05['Trunk'])){ut[_0x5809('0x66')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x5809('0x11c')+_0x273a05['name']+_0x5809('0x11d'));if(!this[_0x5809('0x99')](_0x273a05[_0x5809('0x9a')])){ut[_0x5809('0x66')](_0x5809('0x11e'),_0x273a05[_0x5809('0x2a')]+_0x5809('0x11f'));return{'isValid':![],'message':_0x5809('0x120')};}}if(!ut['isActive'](_0x273a05[_0x5809('0x6e')])){ut[_0x5809('0x66')](_0x5809('0x121'),_0x273a05[_0x5809('0x2a')]+_0x5809('0x122'));return{'isValid':![],'message':_0x5809('0x11c')+_0x273a05[_0x5809('0x2a')]+_0x5809('0x122')};}return{'isValid':!![],'message':_0x5809('0x123')};};Preview[_0x5809('0xf')][_0x5809('0x104')]=function(_0x27ef73,_0x17b08a,_0x902a,_0xf6e548){var _0x4a027d=this;return new BPromise(function(_0x982ba0,_0x7ddb24){var _0xe0664d=_0x27ef73[_0x5809('0xb2')];var _0x11866a=_0x4a027d[_0x5809('0x99')](_0x17b08a[_0x5809('0x58')])?util['format'](_0x5809('0x124'),_0x17b08a['Trunk'][_0x5809('0x2a')],_['isNil'](_0x17b08a[_0x5809('0x3a')])?'':_0x17b08a[_0x5809('0x3a')][_0x5809('0x125')]()||'',_0x17b08a[_0x5809('0x126')]>0x0?_0x902a[_0x5809('0x101')][_0x5809('0x127')]['substring'](_0x17b08a[_0x5809('0x126')]):_0x902a[_0x5809('0x101')][_0x5809('0x127')]):util[_0x5809('0x5d')](_0x5809('0x124'),_[_0x5809('0x72')](_0x17b08a[_0x5809('0x9a')])?_0x17b08a[_0x5809('0x58')][_0x5809('0x2a')]:_0x17b08a[_0x5809('0x9a')][_0x5809('0x2a')],_[_0x5809('0x72')](_0x17b08a[_0x5809('0x3a')])?'':_0x17b08a[_0x5809('0x3a')]['trim']()||'',_0x17b08a['dialCutDigit']>0x0?_0x902a[_0x5809('0x101')]['phone'][_0x5809('0x128')](_0x17b08a[_0x5809('0x126')]):_0x902a[_0x5809('0x101')]['phone']);var _0x1e4b89=_0x4a027d[_0x5809('0x99')](_0x17b08a[_0x5809('0x58')])?ut['getCallerId'](_0x17b08a['Trunk'][_0x5809('0x59')],_0x17b08a[_0x5809('0x38')],_0x17b08a[_0x5809('0x129')]>0x0?ut['getCallerIdRandom'](_0x17b08a['dialOriginateCallerIdNumber'],_0x17b08a[_0x5809('0x129')]):_0x17b08a[_0x5809('0x12a')]):ut['getCallerId'](_['isNil'](_0x17b08a['TrunkBackup'])?_0x17b08a[_0x5809('0x58')][_0x5809('0x59')]:_0x17b08a[_0x5809('0x9a')]['callerid'],_0x17b08a[_0x5809('0x38')],_0x17b08a['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x17b08a[_0x5809('0x12a')],_0x17b08a['dialRandomLastDigitCallerIdNumber']):_0x17b08a['dialOriginateCallerIdNumber']);if(_0x1e4b89){_0x27ef73[_0x5809('0x12b')]=ut[_0x5809('0x12c')](_0x1e4b89);_0x27ef73[_0x5809('0x12d')]=ut[_0x5809('0x12e')](_0x1e4b89);}var _0x421e34=ut['addVariables'](_0x17b08a,_0x902a,_0x11866a,_0x1e4b89,_0xe0664d,_0x27ef73);_['merge'](_0x27ef73,ut[_0x5809('0x12f')](_0x421e34));_0x27ef73['starttime']=moment()[_0x5809('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x5809('0x7b')](ut['variablesAction'](_0x27ef73,_0x17b08a,_0x421e34,_0x27ef73[_0x5809('0xac')],_0xf6e548))[_0x5809('0x8b')](function(_0x3db286){var _0xdc9737=_0x27ef73[_0x5809('0x130')];if(!_['isNil'](_0xdc9737)){if(!_[_0x5809('0x72')](_0x4a027d['agents'][_0xdc9737])){_0x4a027d['agents'][_0xdc9737][_0x5809('0x131')]=_0x27ef73[_0x5809('0x132')];emit(util['format'](_0x5809('0x133'),_0x4a027d[_0x5809('0x18')][_0xdc9737]['name']),_0x5809('0x134'),{'destaccountcode':_0x4a027d[_0x5809('0x18')][_0xdc9737][_0x5809('0x135')],'destconnectedlinenum':_0x27ef73[_0x5809('0x132')]});}}_0x17b08a[_0x5809('0x52')]+=0x1;logger[_0x5809('0x60')](_0x5809('0x136'),_0xe0664d,_0x5809('0xc2'),_0x17b08a['name'],_0x5809('0xff'),_0x17b08a['originated']);_0x982ba0(_0x3db286);})[_0x5809('0x7d')](function(_0x35f36b){ut[_0x5809('0xf9')](_0x27ef73,0xe,_0x5809('0x137'));rpcDb[_0x5809('0xfa')](_0x27ef73,_0x5809('0x138'));_0x7ddb24(_0x35f36b);});});};Preview[_0x5809('0xf')][_0x5809('0x139')]=function(_0xfef3c0){if(this[_0x5809('0x17')][_0xfef3c0[_0x5809('0xad')]]){this[_0x5809('0x17')][_0xfef3c0['linkedid']][_0x5809('0x7c')]=_0xfef3c0[_0x5809('0x7c')];}};Preview[_0x5809('0xf')]['syncOriginateResponse']=function(_0x27993e){var _0x268bfe=this;var _0x274a65=this['actions'][_0x27993e[_0x5809('0x13a')]];if(_0x274a65){if(_0x274a65[_0x5809('0x102')]&&this[_0x5809('0x18')][_0x274a65[_0x5809('0x102')]]){ut[_0x5809('0x13b')](_0x274a65,this[_0x5809('0x18')][_0x274a65['lookAgent']]['name'],this[_0x5809('0x18')][_0x274a65[_0x5809('0x102')]]['id']);}var _0x2c577d=_[_0x5809('0x13c')](_0x274a65);_0x2c577d[_0x5809('0xaf')]=moment()[_0x5809('0x5d')](_0x5809('0x8f'));var _0x27dea0=_0x268bfe['campaignsPreview'][_0x274a65[_0x5809('0x75')]];if(ut[_0x5809('0x13d')](_0x27993e[_0x5809('0x13e')])){if(_0x274a65[_0x5809('0xab')]){rpcDb[_0x5809('0x113')](_0x274a65[_0x5809('0x13f')]);}if(_0x274a65[_0x5809('0xac')]){rpcDb[_0x5809('0x8d')](_0x274a65['idContact']);}ami[_0x5809('0x27')](_0x5809('0x140'),ut['buildObj'](_0x274a65,_0x5809('0x141'),this['campaignsPreview'][_0x274a65[_0x5809('0x75')]]));this['callProgressDetectingAgent'](_0x2c577d,_0x27dea0,_0x27993e);}else{_0x274a65['starttime']=moment()[_0x5809('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x5809('0xf9')](_0x2c577d,0x4,_0x5809('0xbc'));rpcDb[_0x5809('0xfa')](_0x2c577d,_0x5809('0x142'));}}};Preview['prototype']['syncHangup']=function(_0x2ba58b){var _0x4903c6=this;var _0x3b6c80=this[_0x5809('0x17')][_0x2ba58b[_0x5809('0xad')]];var _0x528e23;if(_0x3b6c80){_0x528e23=this[_0x5809('0x14')][_0x3b6c80['queue']];logger[_0x5809('0x60')](_0x5809('0x143'),_0x2ba58b[_0x5809('0xad')],_0x5809('0xc2'),_0x528e23[_0x5809('0x2a')],_0x5809('0x76'),_0x528e23[_0x5809('0x2f')]);}if(this['actions'][_0x2ba58b[_0x5809('0xad')]]&&_0x2ba58b['linkedid']!==_0x2ba58b[_0x5809('0xb2')]){if(_0x2ba58b[_0x5809('0x144')]==='16'&&this[_0x5809('0x17')][_0x2ba58b[_0x5809('0xad')]][_0x5809('0x77')]){this[_0x5809('0x145')](_0x2ba58b,_0x2ba58b['linkedid'],_0x2ba58b[_0x5809('0x144')]);}else if(this[_0x5809('0x17')][_0x2ba58b[_0x5809('0xad')]][_0x5809('0x77')]){logger['info'](_0x5809('0x146'),_0x2ba58b[_0x5809('0xad')],_0x2ba58b[_0x5809('0x144')],_0x5809('0xc2'),_0x528e23[_0x5809('0x2a')],'pTalking:\x20',_0x528e23['pTalking']);this[_0x5809('0x145')](_0x2ba58b,_0x2ba58b['linkedid'],_0x2ba58b[_0x5809('0x144')]);}}else if(_0x3b6c80&&_[_0x5809('0x72')](_0x3b6c80[_0x5809('0x147')])&&_0x528e23[_0x5809('0x148')]&&_0x2ba58b[_0x5809('0xad')]===_0x2ba58b['uniqueid']&&_[_0x5809('0x72')](_0x2ba58b[_0x5809('0xf8')])&&_0x2ba58b[_0x5809('0x144')]==='16'&&_0x2ba58b[_0x5809('0x149')]==='6'&&_[_0x5809('0xf6')](_0x3b6c80[_0x5809('0x14a')])){if(_0x3b6c80[_0x5809('0xab')]){rpcDb[_0x5809('0x113')](_0x3b6c80[_0x5809('0x13f')]);}if(_0x3b6c80[_0x5809('0xac')]){rpcDb[_0x5809('0x8d')](_0x3b6c80[_0x5809('0x13f')]);}_0x2ba58b[_0x5809('0xf8')]='22';this[_0x5809('0xf5')](_0x3b6c80,_0x528e23,_0x2ba58b);}else if(_0x3b6c80&&_0x3b6c80[_0x5809('0x14a')]){if(_0x2ba58b[_0x5809('0x144')]==='16'&&this[_0x5809('0x17')][_0x2ba58b[_0x5809('0xad')]][_0x5809('0x77')]){logger[_0x5809('0x60')](_0x5809('0x14b'),_0x2ba58b[_0x5809('0xad')],_0x2ba58b[_0x5809('0x144')],_0x5809('0xc2'),_0x528e23[_0x5809('0x2a')],_0x5809('0x76'),_0x528e23[_0x5809('0x2f')]);this[_0x5809('0x145')](_0x2ba58b,_0x2ba58b[_0x5809('0xad')],_0x2ba58b['cause']);}else if(this['actions'][_0x2ba58b['linkedid']]['dialAnswer']){logger[_0x5809('0x60')](_0x5809('0x146'),_0x2ba58b[_0x5809('0xad')],_0x2ba58b[_0x5809('0x144')],'\x20Queue',_0x528e23[_0x5809('0x2a')],_0x5809('0x76'),_0x528e23['pTalking']);this[_0x5809('0x145')](_0x2ba58b,_0x2ba58b['linkedid'],_0x2ba58b[_0x5809('0x144')]);}}};Preview[_0x5809('0xf')][_0x5809('0x1f')]=function(_0x903876){if(this[_0x5809('0x17')][_0x903876[_0x5809('0xf4')]]&&_0x903876['destlinkedid']!==_0x903876['destuniqueid']){this[_0x5809('0x145')](_0x903876,_0x903876[_0x5809('0xf4')],_0x903876[_0x5809('0xea')]);}};Preview['prototype'][_0x5809('0x14c')]=function(_0x52c89c){if(this[_0x5809('0x17')][_0x52c89c[_0x5809('0xad')]]&&_0x52c89c[_0x5809('0xad')]!==_0x52c89c['uniqueid']&&!this[_0x5809('0x17')][_0x52c89c[_0x5809('0xad')]]['dialAnswer']){if(_0x52c89c[_0x5809('0x144')]==='1'){this['callProgressDetectingCustomer'](_0x52c89c,_0x52c89c[_0x5809('0xad')],_0x52c89c['cause']);}}};Preview[_0x5809('0xf')][_0x5809('0x14d')]=function(_0x8a9829,_0x19f3ad,_0x12106a){if(this['actions'][_0x8a9829]){if(_['isNil'](this[_0x5809('0x17')][_0x8a9829][_0x5809('0x14e')])){this[_0x5809('0x17')][_0x8a9829][_0x5809('0x14e')]={};}this['actions'][_0x8a9829][_0x5809('0x14e')][_0x19f3ad]=_0x12106a;}};Preview[_0x5809('0xf')][_0x5809('0x21')]=function(_0x110d00){try{if(!_[_0x5809('0x72')](_0x110d00)){if(ut['filterKey'](_['keys'](_0x110d00[_0x5809('0x14f')])[0x0])){this[_0x5809('0x14d')](_0x110d00[_0x5809('0xb2')],_[_0x5809('0x150')](_0x110d00[_0x5809('0x14f')])[0x0],_0x110d00[_0x5809('0x151')]);}}}catch(_0x6a1ec){logger[_0x5809('0x152')](_0x5809('0x153'),util[_0x5809('0x154')](_0x6a1ec,{'showHidden':![],'depth':null}));}};Preview[_0x5809('0xf')][_0x5809('0x23')]=function(_0x76ec81){if(_0x76ec81){if(this['actions'][_0x76ec81[_0x5809('0x155')]]){this['actions'][_0x76ec81[_0x5809('0x155')]][_0x5809('0x14a')]=!![];}}};Preview[_0x5809('0xf')][_0x5809('0x25')]=function(_0x270ae5){if(_0x270ae5){if(this[_0x5809('0x17')][_0x270ae5[_0x5809('0x156')]]){this[_0x5809('0x17')][_0x270ae5['transfererlinkedid']][_0x5809('0x14a')]=!![];}}};module[_0x5809('0x157')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index a823654..5eac2e1 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 _0x2969=['rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','queue','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context','exten','xcally-motion-preview','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe'];(function(_0x21b215,_0x280be7){var _0x470a6a=function(_0x2db1e7){while(--_0x2db1e7){_0x21b215['push'](_0x21b215['shift']());}};_0x470a6a(++_0x280be7);}(_0x2969,0x16e));var _0x9296=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2969[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x9296('0x0'));var BPromise=require('bluebird');var logger=require(_0x9296('0x1'))(_0x9296('0x2'));var _=require(_0x9296('0x3'));var cmHopper=require(_0x9296('0x4'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x9296('0x5'));var voiceQueueRt=require(_0x9296('0x6'));var agentReportPreview=require(_0x9296('0x7'));var voiceQueueReport=require(_0x9296('0x8'));function loggerCatch(_0x228b64){return function(_0x39c11e){logger[_0x9296('0x9')](_0x228b64,util[_0x9296('0xa')](_0x39c11e,{'showHidden':![],'depth':null}));};}function create(_0x51b3df){return BPromise[_0x9296('0xb')]()[_0x9296('0xc')](cmHopperHistory[_0x9296('0xd')](_0x51b3df))[_0x9296('0xe')](loggerCatch(_0x9296('0xf')));}function createAgent(_0x538add){return BPromise[_0x9296('0xb')]()[_0x9296('0xc')](agentReportPreview[_0x9296('0xd')](_0x538add))['catch'](loggerCatch(_0x9296('0xf')));}function moveContact(_0x47e31d){return BPromise[_0x9296('0xb')]()['then'](cmHopper[_0x9296('0x10')](_0x47e31d,!![]))[_0x9296('0xe')](loggerCatch(_0x9296('0x11')));}exports['checkIsBlackList']=function(_0x25bb12){return BPromise['resolve']()[_0x9296('0xc')](cmHopperBlack[_0x9296('0x12')](_0x25bb12))[_0x9296('0xe')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x9296('0x13')]=function(_0x5cf5b3){return BPromise[_0x9296('0xb')]()[_0x9296('0xc')](cmHopper['getContactPreview'](_0x5cf5b3))['catch'](loggerCatch('[getContactPreview]\x20'));};exports[_0x9296('0xd')]=function(_0x593bba,_0x5e83d4){create(_0x593bba)[_0x9296('0xe')](loggerCatch(_0x5e83d4));moveContact(_0x593bba)[_0x9296('0xe')](loggerCatch(_0x5e83d4));};exports[_0x9296('0x14')]=function(_0x2817d7,_0x38585c){createAgent(_0x2817d7)[_0x9296('0xe')](loggerCatch(_0x38585c));};exports[_0x9296('0x15')]=function(_0x26f50c,_0x1f8237){create(_0x26f50c)['catch'](loggerCatch(_0x1f8237));};exports[_0x9296('0x16')]=function(_0x164e5a,_0x43f251){moveContact(_0x164e5a)[_0x9296('0xe')](loggerCatch(_0x43f251));};exports['rescheduleContact']=function(_0x11a38f,_0x34d699,_0x5d3090){if(_0x34d699){_0x11a38f['UserId']=null;}if(_0x5d3090){_0x11a38f[_0x9296('0x17')]=![];}return BPromise[_0x9296('0xb')]()['then'](cmHopper[_0x9296('0x18')](_0x11a38f))['catch'](loggerCatch(_0x9296('0x19')));};exports[_0x9296('0x1a')]=function(_0x13f9b2){return BPromise[_0x9296('0xb')]()[_0x9296('0xc')](cmHopper[_0x9296('0x1a')](_0x13f9b2))[_0x9296('0xe')](loggerCatch(_0x9296('0x1b')));};exports[_0x9296('0x1c')]=function(_0x36d811){return BPromise[_0x9296('0xb')]()[_0x9296('0xc')](cmHopper[_0x9296('0x1c')]({'UserId':null},_0x36d811,0x1))[_0x9296('0xe')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x23302e){return BPromise['resolve']()[_0x9296('0xc')](cmHopper[_0x9296('0x1c')]({'active':![]},_0x23302e,0x1))['catch'](loggerCatch(_0x9296('0x1d')));};exports[_0x9296('0x1e')]=function(_0x2e0ef5){var _0x34c6c6={};_0x34c6c6['type']=_0x2e0ef5[_0x9296('0x1f')];_0x34c6c6[_0x9296('0x20')]=_0x2e0ef5[_0x9296('0x20')];_0x34c6c6[_0x9296('0x21')]=_0x2e0ef5[_0x9296('0x21')];_0x34c6c6['calleridname']=_0x2e0ef5['calleridname'];_0x34c6c6[_0x9296('0x22')]=_0x2e0ef5[_0x9296('0x22')];_0x34c6c6['queuecallerjoinAt']=_0x2e0ef5[_0x9296('0x23')];_0x34c6c6[_0x9296('0x24')]=_0x2e0ef5[_0x9296('0x23')];_0x34c6c6[_0x9296('0x25')]=0x1;_0x34c6c6['queuecallercompleteAt']=_0x2e0ef5[_0x9296('0x26')];_0x34c6c6[_0x9296('0x27')]=_0x2e0ef5[_0x9296('0x28')];_0x34c6c6[_0x9296('0x29')]='from-sip';_0x34c6c6[_0x9296('0x2a')]=_0x9296('0x2b');_0x34c6c6['holdtime']=0x0;_0x34c6c6[_0x9296('0x2c')]=0x1;_0x34c6c6['lastAssignedTo']=_0x2e0ef5[_0x9296('0x28')];_0x34c6c6[_0x9296('0x2d')]=_0x9296('0x2e');return BPromise['resolve']()[_0x9296('0xc')](voiceQueueReport[_0x9296('0x2f')](_0x34c6c6))['catch'](loggerCatch(_0x9296('0x30')));};exports[_0x9296('0x31')]=function(_0x51c5d7,_0x126510){return BPromise[_0x9296('0xb')]()['then'](cmHopper[_0x9296('0x31')](_0x51c5d7,_0x126510))[_0x9296('0xe')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x9296('0x32')]=function(_0x16119a){return BPromise[_0x9296('0xb')]()['then'](cmHopper[_0x9296('0x18')](_0x16119a,!![],!![]))[_0x9296('0xe')](loggerCatch(_0x9296('0x33')));}; \ No newline at end of file +var _0xe6be=['[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','xcally-motion-preview','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact'];(function(_0x414a33,_0x5bf179){var _0x1922bd=function(_0xa5ca9c){while(--_0xa5ca9c){_0x414a33['push'](_0x414a33['shift']());}};_0x1922bd(++_0x5bf179);}(_0xe6be,0xbc));var _0xee6b=function(_0x206b5f,_0x524877){_0x206b5f=_0x206b5f-0x0;var _0x42fcf1=_0xe6be[_0x206b5f];return _0x42fcf1;};'use strict';var util=require(_0xee6b('0x0'));var BPromise=require(_0xee6b('0x1'));var logger=require(_0xee6b('0x2'))(_0xee6b('0x3'));var _=require(_0xee6b('0x4'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xee6b('0x5'));var cmHopperHistory=require(_0xee6b('0x6'));var cmHopperBlack=require(_0xee6b('0x7'));var voiceQueueRt=require(_0xee6b('0x8'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xee6b('0x9'));function loggerCatch(_0x31db44){return function(_0x464f59){logger['error'](_0x31db44,util['inspect'](_0x464f59,{'showHidden':![],'depth':null}));};}function create(_0x15aa2f){return BPromise[_0xee6b('0xa')]()[_0xee6b('0xb')](cmHopperHistory[_0xee6b('0xc')](_0x15aa2f))[_0xee6b('0xd')](loggerCatch(_0xee6b('0xe')));}function createAgent(_0xd0aa68){return BPromise[_0xee6b('0xa')]()['then'](agentReportPreview[_0xee6b('0xc')](_0xd0aa68))[_0xee6b('0xd')](loggerCatch('[createHistory]\x20'));}function moveContact(_0xb4c313){return BPromise[_0xee6b('0xa')]()['then'](cmHopper[_0xee6b('0xf')](_0xb4c313,!![]))[_0xee6b('0xd')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xee6b('0x10')]=function(_0x4edd70){return BPromise[_0xee6b('0xa')]()[_0xee6b('0xb')](cmHopperBlack[_0xee6b('0x10')](_0x4edd70))[_0xee6b('0xd')](loggerCatch(_0xee6b('0x11')));};exports[_0xee6b('0x12')]=function(_0x266fe9){return BPromise[_0xee6b('0xa')]()[_0xee6b('0xb')](cmHopper[_0xee6b('0x12')](_0x266fe9))[_0xee6b('0xd')](loggerCatch(_0xee6b('0x13')));};exports['createHistory']=function(_0x463ee9,_0xe83cbe){create(_0x463ee9)['catch'](loggerCatch(_0xe83cbe));moveContact(_0x463ee9)[_0xee6b('0xd')](loggerCatch(_0xe83cbe));};exports['createAgentHistory']=function(_0x14c947,_0x479eb2){createAgent(_0x14c947)[_0xee6b('0xd')](loggerCatch(_0x479eb2));};exports['createCustomerHistory']=function(_0x3c29c0,_0x51a256){create(_0x3c29c0)[_0xee6b('0xd')](loggerCatch(_0x51a256));};exports[_0xee6b('0x14')]=function(_0x5bade9,_0x318c24){moveContact(_0x5bade9)[_0xee6b('0xd')](loggerCatch(_0x318c24));};exports[_0xee6b('0x15')]=function(_0x3101b7,_0x22e4d3,_0x5ad8f5){if(_0x22e4d3){_0x3101b7[_0xee6b('0x16')]=null;}if(_0x5ad8f5){_0x3101b7[_0xee6b('0x17')]=![];}return BPromise[_0xee6b('0xa')]()[_0xee6b('0xb')](cmHopper[_0xee6b('0x15')](_0x3101b7))[_0xee6b('0xd')](loggerCatch(_0xee6b('0x18')));};exports[_0xee6b('0x19')]=function(_0x38e071){return BPromise[_0xee6b('0xa')]()[_0xee6b('0xb')](cmHopper[_0xee6b('0x19')](_0x38e071))[_0xee6b('0xd')](loggerCatch(_0xee6b('0x1a')));};exports[_0xee6b('0x1b')]=function(_0x364ecd){return BPromise[_0xee6b('0xa')]()[_0xee6b('0xb')](cmHopper[_0xee6b('0x1b')]({'UserId':null},_0x364ecd,0x1))['catch'](loggerCatch(_0xee6b('0x1c')));};exports[_0xee6b('0x1d')]=function(_0x185298){return BPromise['resolve']()[_0xee6b('0xb')](cmHopper[_0xee6b('0x1b')]({'active':![]},_0x185298,0x1))[_0xee6b('0xd')](loggerCatch(_0xee6b('0x1e')));};exports[_0xee6b('0x1f')]=function(_0x20c3f2){var _0x1889a4={};_0x1889a4[_0xee6b('0x20')]=_0x20c3f2[_0xee6b('0x20')];_0x1889a4[_0xee6b('0x21')]=_0x20c3f2[_0xee6b('0x21')];_0x1889a4[_0xee6b('0x22')]=_0x20c3f2[_0xee6b('0x22')];_0x1889a4[_0xee6b('0x23')]=_0x20c3f2[_0xee6b('0x23')];_0x1889a4[_0xee6b('0x24')]=_0x20c3f2[_0xee6b('0x24')];_0x1889a4[_0xee6b('0x25')]=_0x20c3f2[_0xee6b('0x26')];_0x1889a4[_0xee6b('0x27')]=_0x20c3f2['answertime'];_0x1889a4['queuecallercomplete']=0x1;_0x1889a4[_0xee6b('0x28')]=_0x20c3f2[_0xee6b('0x29')];_0x1889a4[_0xee6b('0x2a')]=_0x20c3f2[_0xee6b('0x2b')];_0x1889a4[_0xee6b('0x2c')]=_0xee6b('0x2d');_0x1889a4['exten']=_0xee6b('0x2e');_0x1889a4['holdtime']=0x0;_0x1889a4['assigned']=0x1;_0x1889a4[_0xee6b('0x2f')]=_0x20c3f2['membername'];_0x1889a4[_0xee6b('0x30')]='COMPLETED';return BPromise[_0xee6b('0xa')]()[_0xee6b('0xb')](voiceQueueReport[_0xee6b('0x31')](_0x1889a4))[_0xee6b('0xd')](loggerCatch(_0xee6b('0x32')));};exports['getContactRecallMe']=function(_0x3230a4,_0x4ec125){return BPromise['resolve']()[_0xee6b('0xb')](cmHopper[_0xee6b('0x33')](_0x3230a4,_0x4ec125))[_0xee6b('0xd')](loggerCatch(_0xee6b('0x34')));};exports[_0xee6b('0x35')]=function(_0x435f80){return BPromise[_0xee6b('0xa')]()[_0xee6b('0xb')](cmHopper[_0xee6b('0x15')](_0x435f80,!![],!![]))['catch'](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index d24441f..33d2b55 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 _0x6203=['answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','xcally-motion-preview','from-sip','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','buildObj','lastevent','interface','motionChannel','voice','mandatoryDisposition','buildAcw','queue','not_inuse','status','reachable','push','getDiff','diff','createBody','CampaignId','filterKey','idContact','type','campaigntype','countglobal','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqosloss','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','milliseconds','seconds','loggerCatch','inspect','loggerError','error','info','getCallerId','isEmpty','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','state','statedesc','starttime','responsetime','logAgent','YYYY-MM-DD\x20HH:mm:ss','logLookAgent','membername','endtime','ringtime','talktime'];(function(_0xcad01d,_0xef9abc){var _0x76a4a6=function(_0x15b2a4){while(--_0x15b2a4){_0xcad01d['push'](_0xcad01d['shift']());}};_0x76a4a6(++_0xef9abc);}(_0x6203,0x163));var _0x3620=function(_0x17b753,_0x1fbd96){_0x17b753=_0x17b753-0x0;var _0x2b0107=_0x6203[_0x17b753];return _0x2b0107;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x3620('0x0'));var logger=require(_0x3620('0x1'))(_0x3620('0x2'));var ipAgi=process[_0x3620('0x3')][_0x3620('0x4')]||'127.0.0.1';function getSeconds(_0x5bb558,_0x2fab39){var _0x368ba8=moment(_0x5bb558)[_0x3620('0x5')](0x0);var _0x56483e=moment(_0x2fab39)[_0x3620('0x5')](0x0);return _0x368ba8['diff'](_0x56483e,_0x3620('0x6'));}exports[_0x3620('0x7')]=function(_0x3dabaf){return function(_0x1207f0){logger['error'](_0x3dabaf,util['inspect'](_0x1207f0,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x17d26c,_0x4ecbb6){logger['info'](_0x17d26c,util[_0x3620('0x8')](_0x4ecbb6,{'showHidden':![],'depth':null}));};exports[_0x3620('0x9')]=function(_0x42d6c9,_0x2cfd42){logger[_0x3620('0xa')](_0x42d6c9,util[_0x3620('0x8')](_0x2cfd42,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x2bcc30){return function(_0x17fe05){logger[_0x3620('0xb')](_0x2bcc30,util[_0x3620('0x8')](_0x17fe05,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x1061a1,_0x11c845,_0x27c5d1){return{'message':_0x1061a1,'unlock':_0x11c845,'active':_0x27c5d1};};exports[_0x3620('0xc')]=function(_0x588779,_0x15314a,_0x97bae8){if(!_['isUndefined'](_0x97bae8)&&'string'===typeof _0x97bae8&&!_[_0x3620('0xd')](_0x97bae8)){if(!_[_0x3620('0xe')](_0x15314a)&&_0x3620('0xf')===typeof _0x15314a&&!_[_0x3620('0xd')](_0x15314a)){return util[_0x3620('0x10')](_0x3620('0x11'),_0x15314a,_0x97bae8);}return util[_0x3620('0x10')](_0x3620('0x11'),_0x97bae8,_0x97bae8);}if(!_[_0x3620('0xe')](_0x588779)&&_0x3620('0xf')===typeof _0x588779&&!_[_0x3620('0xd')](_0x588779)){return _0x588779;}return _0x3620('0x12');};exports[_0x3620('0x13')]=function(_0xe91649){if(_[_0x3620('0x14')](_0xe91649)){return![];}return _0xe91649;};exports[_0x3620('0x15')]=function(_0x4d65dc,_0xf753f2,_0x4bcd0d,_0x253370,_0x911362,_0x15f1ca){var _0x4a1d74={'XMD-QUEUE':_0xf753f2[_0x3620('0x16')]?_0xf753f2[_0x3620('0x16')][_0x3620('0x17')]:'','XMD-CALLERID':_0x253370,'XMD-CALLERID-PREVIEW':_0x15f1ca?util['format']('\x22%s\x22\x20<%s>',_0x15f1ca[_0x3620('0x18')],_0x15f1ca[_0x3620('0x19')]):_0x253370,'XMD-DIALID':_0x911362,'XMD-CONTACTID':_0xf753f2[_0x3620('0x1a')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x253370,'XMD-VOICEQUEUEID':_0xf753f2[_0x3620('0x1b')],'XMD-DIALCHANNEL':_0x4bcd0d,'XMD-DIALTIMEOUT':_0x4d65dc[_0x3620('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x3620('0x10')](_0x3620('0x1d'),_0x4d65dc['dialQueueProject2']?'g':'',_[_0x3620('0xd')](_0x4d65dc[_0x3620('0x1e')])?'':_0x3620('0x1f')),'XMD-DIALURL':_0x4d65dc[_0x3620('0x20')]||'','XMD-AGI':_0x4d65dc[_0x3620('0x21')]?util['format'](_0x3620('0x22'),ipAgi,_0x4d65dc[_0x3620('0x21')]):_0x3620('0x23'),'XMD-AGIAFTER':_0x4d65dc['dialQueueProject2']?util[_0x3620('0x10')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4d65dc['dialQueueProject2']):_0x3620('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x15f1ca?_0x15f1ca[_0x3620('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x15f1ca?_0x15f1ca[_0x3620('0x25')]:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0x3620('0xd')](_0x4d65dc[_0x3620('0x1e')])){_0x4a1d74[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x4d65dc[_0x3620('0x1e')];_0x4a1d74[util[_0x3620('0x10')]('%s',_0x3620('0x26'))]=_0x911362;}if(_0xf753f2&&_0xf753f2[_0x3620('0x27')]){for(var _0x247d36 in _0xf753f2['Contact']){if(_0xf753f2['Contact'][_0x3620('0x28')](_0x247d36)){if(!_[_0x3620('0x14')](_0xf753f2['Contact'][_0x247d36])&&_0x247d36!=='id'&&_0x247d36!==_0x3620('0x29')&&_0x247d36!=='createdAt'&&_0x247d36!==_0x3620('0x2a')){_0x4a1d74[util[_0x3620('0x10')](_0x3620('0x2b'),_0x3620('0x2c'),_[_0x3620('0x2d')](_0x247d36))]=_0xf753f2[_0x3620('0x27')][_0x247d36];}}}}return _0x4a1d74;};exports[_0x3620('0x2e')]=function(_0xa96599){var _0x53e7c7={};for(var _0x1d05ba in _0xa96599){if(_0xa96599['hasOwnProperty'](_0x1d05ba)){_0x53e7c7[util[_0x3620('0x10')]('%s',_['toLower'](_0x1d05ba))]=_0xa96599[_0x1d05ba];}}return{'variables':_0x53e7c7};};exports[_0x3620('0x2f')]=function(_0x1214a4,_0x391eb9){if(!_[_0x3620('0x14')](_0x1214a4)){if(_0x1214a4[_0x3620('0x28')](_0x3620('0x30'))){if(_0x1214a4[_0x3620('0x30')]>0x0){_0x1214a4[_0x3620('0x30')]-=0x1;}else{logger[_0x3620('0xa')](_0x3620('0x31'),_0x391eb9);}}}else{logger['error'](_0x3620('0x32'),_0x391eb9);}};exports['logBlacklist']=function(_0x265d8a){var _0x39aeae=moment()[_0x3620('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x265d8a[_0x3620('0x33')]=0xd;_0x265d8a[_0x3620('0x34')]='Blacklist';_0x265d8a[_0x3620('0x35')]=_0x39aeae;_0x265d8a[_0x3620('0x36')]=_0x39aeae;_0x265d8a['endtime']=_0x39aeae;};exports[_0x3620('0x37')]=function(_0x28b82a,_0x371945,_0x2b65d8){var _0x26bd5e=moment()[_0x3620('0x10')](_0x3620('0x38'));_0x28b82a['state']=_0x371945;_0x28b82a[_0x3620('0x34')]=_0x2b65d8;_0x28b82a['responsetime']=_0x26bd5e;_0x28b82a['ringtime']=getSeconds(_0x28b82a[_0x3620('0x36')],_0x28b82a['starttime']);};exports[_0x3620('0x39')]=function(_0x588707,_0x35060c,_0x11f9ec){_0x588707[_0x3620('0x3a')]=_0x35060c;_0x588707['UserId']=_0x11f9ec;};exports['logCustomer']=function(_0xbe8144,_0x28cce5,_0x8289dc){var _0x186489=moment()[_0x3620('0x10')](_0x3620('0x38'));_0xbe8144['state']=_0x28cce5;_0xbe8144[_0x3620('0x34')]=_0x8289dc;_0xbe8144[_0x3620('0x36')]=_0xbe8144['responsetime']?_0xbe8144[_0x3620('0x36')]:_0x186489;_0xbe8144[_0x3620('0x3b')]=_0xbe8144[_0x3620('0x3b')]?_0xbe8144[_0x3620('0x3b')]:_0x186489;_0xbe8144[_0x3620('0x3c')]=getSeconds(_0xbe8144['responsetime']||0x0,_0xbe8144['starttime']||0x0);_0xbe8144[_0x3620('0x3d')]=_0xbe8144[_0x3620('0x3e')]?getSeconds(_0xbe8144['endtime'],_0xbe8144[_0x3620('0x3e')]):0x0;};exports[_0x3620('0x3f')]=function(_0x40e42b){return _0x40e42b===_0x3620('0x40');};exports['variablesAction']=function(_0x50c966,_0x35b8e1,_0x5414c2,_0x49c746,_0x41c3d4){var _0x393340=_0x49c746?_0x3620('0x41'):_0x50c966[_0x3620('0x18')];_0x393340=_0x41c3d4?_0x3620('0x42'):_0x393340;return{'actionid':_0x50c966[_0x3620('0x43')],'action':_0x3620('0x44'),'channel':_0x50c966[_0x3620('0x45')],'callerid':util[_0x3620('0x10')]('\x22%s\x22\x20<%s>',_0x393340,_0x50c966[_0x3620('0x19')]),'Exten':_0x3620('0x46'),'Context':_0x3620('0x47'),'Priority':'1','variable':_0x5414c2,'timeout':(_0x35b8e1['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x50c966['uniqueid']};};exports[_0x3620('0x48')]=function(_0x394b9d){return _0x394b9d[_0x3620('0x49')]+_0x394b9d['countcongestionretry']+_0x394b9d[_0x3620('0x4a')]+_0x394b9d[_0x3620('0x4b')]+_0x394b9d[_0x3620('0x4c')];};exports[_0x3620('0x4d')]=function(_0x5d4af1){var _0x2427d6=_[_0x3620('0x4e')](_0x5d4af1);_0x2427d6[_0x3620('0x33')]=0xf;_0x2427d6[_0x3620('0x34')]='Global';return _0x2427d6;};exports[_0x3620('0x4f')]=function(_0x59ab2d,_0x47db6b,_0x5d2623){var _0x1524e1={};_0x1524e1[_0x47db6b]=_0x59ab2d[_0x47db6b];_0x1524e1[_0x3620('0x50')]=![];_0x1524e1[_0x3620('0x51')]=moment()[_0x3620('0x52')](_0x5d2623,_0x3620('0x53'))['format'](_0x3620('0x38'));_0x1524e1[_0x3620('0x1a')]=_0x59ab2d[_0x3620('0x1a')];_0x1524e1['ListId']=_0x59ab2d[_0x3620('0x54')];_0x1524e1[_0x3620('0x1b')]=_0x59ab2d[_0x3620('0x1b')]||undefined;return _0x1524e1;};exports[_0x3620('0x55')]=function(_0x1208f9,_0x46c2f1){if(!_[_0x3620('0x14')](_0x1208f9)){if(_0x1208f9[_0x3620('0x56')]>0x0){_0x1208f9['pTalking']-=0x1;}else{logger[_0x3620('0xa')](_0x46c2f1,_0x3620('0x57'));}}else{logger['error'](_0x46c2f1,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x3620('0x58')]=function(_0x52d0d5){if(_0x52d0d5<=0x0){return!![];}return![];};exports[_0x3620('0x59')]=function(_0x2bb279,_0x23e6b1,_0x15356b){_0x2bb279[_0x3620('0x5a')]=_0x23e6b1;_0x2bb279['name']=_0x2bb279['queue'];_0x2bb279[_0x3620('0x5b')]=_0x2bb279[_0x3620('0x45')];_0x2bb279[_0x3620('0x5c')]=_0x3620('0x5d');if(_0x15356b){_0x2bb279[_0x3620('0x5e')]=_0x15356b[_0x3620('0x5e')];}return _0x2bb279;};exports[_0x3620('0x5f')]=function(_0x95b77e){var _0x20290d={};_0x20290d[_0x3620('0x60')]=_0x95b77e[_0x3620('0x60')];_0x20290d['interface']=_0x95b77e[_0x3620('0x45')];_0x20290d[_0x3620('0x43')]=_0x95b77e[_0x3620('0x43')];return _0x20290d;};exports['agentReadyId']=function(_0x1541bc){var _0x190bc2=[];for(var _0x763b in _0x1541bc){if(_0x1541bc[_0x3620('0x28')](_0x763b)){if(!_[_0x3620('0x14')](_0x1541bc[_0x763b])&&_0x1541bc[_0x763b]['state']===_0x3620('0x61')&&_0x1541bc[_0x763b][_0x3620('0x62')]===_0x3620('0x63')){_0x190bc2[_0x3620('0x64')](_0x1541bc[_0x763b]['id']);}}}return _0x190bc2;};exports[_0x3620('0x65')]=function(_0x50137f){var _0xe0fb7=moment()[_0x3620('0x5')](0x0);var _0x3356d9=moment(_0x50137f)[_0x3620('0x5')](0x0);return _0xe0fb7[_0x3620('0x66')](_0x3356d9,'seconds');};exports[_0x3620('0x67')]=function(_0xb54bb0){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xb54bb0[_0x3620('0x1a')],'ListId':_0xb54bb0[_0x3620('0x54')],'VoiceQueueId':_0xb54bb0['VoiceQueueId']||undefined,'CampaignId':_0xb54bb0[_0x3620('0x68')]||undefined};};exports[_0x3620('0x69')]=function(_0x2393f5){if(_0x2393f5===_0x3620('0x43')||_0x2393f5===_0x3620('0x6a')||_0x2393f5===_0x3620('0x60')||_0x2393f5===_0x3620('0x6b')||_0x2393f5===_0x3620('0x6c')||_0x2393f5==='dialAnswer'||_0x2393f5===_0x3620('0x3a')||_0x2393f5==='channelAgent'||_0x2393f5===_0x3620('0x18')||_0x2393f5===_0x3620('0x50')||_0x2393f5==='calleridnum'||_0x2393f5===_0x3620('0x51')||_0x2393f5===_0x3620('0x49')||_0x2393f5==='countcongestionretry'||_0x2393f5===_0x3620('0x4a')||_0x2393f5===_0x3620('0x6d')||_0x2393f5==='callback'||_0x2393f5===_0x3620('0x6e')||_0x2393f5==='callbackat'||_0x2393f5===_0x3620('0x6f')||_0x2393f5===_0x3620('0x1a')||_0x2393f5===_0x3620('0x54')||_0x2393f5==='UserId'||_0x2393f5===_0x3620('0x1b')||_0x2393f5===_0x3620('0x70')||_0x2393f5===_0x3620('0x71')||_0x2393f5===_0x3620('0x72')||_0x2393f5===_0x3620('0x73')||_0x2393f5==='xmd-listid'||_0x2393f5===_0x3620('0x74')||_0x2393f5===_0x3620('0x75')||_0x2393f5==='xmd-dialoptions'||_0x2393f5===_0x3620('0x76')||_0x2393f5===_0x3620('0x77')||_0x2393f5===_0x3620('0x78')||_0x2393f5===_0x3620('0x79')||_0x2393f5==='xmd-callerid'||_0x2393f5===_0x3620('0x7a')||_0x2393f5==='xmd-agi'||_0x2393f5===_0x3620('0x7b')||_0x2393f5===_0x3620('0x7c')||_0x2393f5==='rtpaudioqosjitter'||_0x2393f5===_0x3620('0x7d')||_0x2393f5==='rtpaudioqosloss'||_0x2393f5===_0x3620('0x7e')||_0x2393f5===_0x3620('0x7f')||_0x2393f5===_0x3620('0x80')||_0x2393f5===_0x3620('0x7b')||_0x2393f5===_0x3620('0x7c')||_0x2393f5===_0x3620('0x81')||_0x2393f5===_0x3620('0x7d')||_0x2393f5===_0x3620('0x82')||_0x2393f5===_0x3620('0x7e')||_0x2393f5===_0x3620('0x7f')||_0x2393f5==='rtpaudioqosrttbridged'||_0x2393f5===_0x3620('0x83')||_0x2393f5==='bridgepvtcallid'||_0x2393f5===_0x3620('0x33')||_0x2393f5===_0x3620('0x34')){return![];}return!![];};exports[_0x3620('0x84')]=function(_0x270106,_0x5efbe9){var _0x5aaacf,_0x2a0cac,_0xeb2f35;if(_0x5efbe9<=0x0){_0x5efbe9=0x1;}_0x5aaacf=new RegExp(_0x3620('0x85')+_0x5efbe9+'}$');_0x2a0cac=Math[_0x3620('0x86')](0xa,_0x5efbe9-0x1);_0xeb2f35=Math[_0x3620('0x86')](0xa,_0x5efbe9)-0x1;return util[_0x3620('0x10')]('%s',_[_0x3620('0x87')](_0x270106,_0x5aaacf,_[_0x3620('0x88')](_0x2a0cac,_0xeb2f35)));};exports[_0x3620('0x89')]=function(_0x282f0d){var _0x6f361=_0x282f0d[_0x3620('0x8a')](/"(.*?)"/);return _0x6f361?_0x6f361[0x1]:_0x282f0d;};exports['extractCalleridNumber']=function(_0x55d8ff){var _0x544beb=_0x55d8ff[_0x3620('0x8a')](/<(.*?)>/);return _0x544beb?_0x544beb[0x1]:_0x55d8ff;}; \ No newline at end of file +var _0x4a7b=['xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','127.0.0.1','milliseconds','seconds','loggerCatch','inspect','logger','info','error','message','isEmpty','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','monitor_format','dialQueueProject','\x22agi://%s/square,%s\x22','dialQueueProject2','NONE','originatecalleridnum','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','toUpper','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','responsetime','logAgent','ringtime','starttime','logLookAgent','membername','UserId','logCustomer','endtime','talktime','answertime','isFailure','Failure','variablesAction','BOOKED','uniqueid','xcally-motion-preview','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','clone','Global','active','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','channelAgent','voice','mandatoryDisposition','buildAcw','not_inuse','status','push','getDiff','diff','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl'];(function(_0x5e0e16,_0x5e75e9){var _0xb5a92a=function(_0x4d4ac4){while(--_0x4d4ac4){_0x5e0e16['push'](_0x5e0e16['shift']());}};_0xb5a92a(++_0x5e75e9);}(_0x4a7b,0xa0));var _0xb4a7=function(_0x564955,_0x420b9b){_0x564955=_0x564955-0x0;var _0x69c625=_0x4a7b[_0x564955];return _0x69c625;};'use strict';var util=require(_0xb4a7('0x0'));var _=require(_0xb4a7('0x1'));var moment=require(_0xb4a7('0x2'));var logger=require(_0xb4a7('0x3'))(_0xb4a7('0x4'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0xb4a7('0x5');function getSeconds(_0x35a68f,_0x2294ef){var _0x348b47=moment(_0x35a68f)[_0xb4a7('0x6')](0x0);var _0x123053=moment(_0x2294ef)[_0xb4a7('0x6')](0x0);return _0x348b47['diff'](_0x123053,_0xb4a7('0x7'));}exports[_0xb4a7('0x8')]=function(_0x3676b7){return function(_0x55ec6a){logger['error'](_0x3676b7,util[_0xb4a7('0x9')](_0x55ec6a,{'showHidden':![],'depth':null}));};};exports[_0xb4a7('0xa')]=function(_0x5a6efa,_0xf7028){logger[_0xb4a7('0xb')](_0x5a6efa,util[_0xb4a7('0x9')](_0xf7028,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x18b5e5,_0x29f9a1){logger[_0xb4a7('0xc')](_0x18b5e5,util['inspect'](_0x29f9a1,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x19bee1){return function(_0x133f00){logger[_0xb4a7('0xb')](_0x19bee1,util[_0xb4a7('0x9')](_0x133f00,{'showHidden':![],'depth':null}));};};exports[_0xb4a7('0xd')]=function(_0xfd0af,_0x4c8410,_0x417ad0){return{'message':_0xfd0af,'unlock':_0x4c8410,'active':_0x417ad0};};exports['getCallerId']=function(_0x46b841,_0x1234fb,_0x4b72e0){if(!_['isUndefined'](_0x4b72e0)&&'string'===typeof _0x4b72e0&&!_[_0xb4a7('0xe')](_0x4b72e0)){if(!_[_0xb4a7('0xf')](_0x1234fb)&&_0xb4a7('0x10')===typeof _0x1234fb&&!_['isEmpty'](_0x1234fb)){return util[_0xb4a7('0x11')](_0xb4a7('0x12'),_0x1234fb,_0x4b72e0);}return util[_0xb4a7('0x11')](_0xb4a7('0x12'),_0x4b72e0,_0x4b72e0);}if(!_[_0xb4a7('0xf')](_0x46b841)&&_0xb4a7('0x10')===typeof _0x46b841&&!_[_0xb4a7('0xe')](_0x46b841)){return _0x46b841;}return _0xb4a7('0x13');};exports[_0xb4a7('0x14')]=function(_0x492e9e){if(_[_0xb4a7('0x15')](_0x492e9e)){return![];}return _0x492e9e;};exports[_0xb4a7('0x16')]=function(_0x5f27d9,_0xe719ba,_0x293d0c,_0xb17074,_0x32e707,_0x3a5d9c){var _0x45ec33={'XMD-QUEUE':_0xe719ba['Queue']?_0xe719ba[_0xb4a7('0x17')][_0xb4a7('0x18')]:'','XMD-CALLERID':_0xb17074,'XMD-CALLERID-PREVIEW':_0x3a5d9c?util[_0xb4a7('0x11')](_0xb4a7('0x12'),_0x3a5d9c[_0xb4a7('0x19')],_0x3a5d9c[_0xb4a7('0x1a')]):_0xb17074,'XMD-DIALID':_0x32e707,'XMD-CONTACTID':_0xe719ba[_0xb4a7('0x1b')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0xb17074,'XMD-VOICEQUEUEID':_0xe719ba[_0xb4a7('0x1c')],'XMD-DIALCHANNEL':_0x293d0c,'XMD-DIALTIMEOUT':_0x5f27d9[_0xb4a7('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0xb4a7('0x11')]('\x22rtTxX%s%s\x22',_0x5f27d9['dialQueueProject2']?'g':'',_[_0xb4a7('0xe')](_0x5f27d9[_0xb4a7('0x1e')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x5f27d9['dialPreviewUrl']||'','XMD-AGI':_0x5f27d9[_0xb4a7('0x1f')]?util[_0xb4a7('0x11')](_0xb4a7('0x20'),ipAgi,_0x5f27d9[_0xb4a7('0x1f')]):'NONE','XMD-AGIAFTER':_0x5f27d9[_0xb4a7('0x21')]?util[_0xb4a7('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5f27d9[_0xb4a7('0x21')]):_0xb4a7('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x3a5d9c?_0x3a5d9c[_0xb4a7('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x3a5d9c?_0x3a5d9c['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0xb4a7('0xe')](_0x5f27d9[_0xb4a7('0x1e')])){_0x45ec33[util[_0xb4a7('0x11')]('%s',_0xb4a7('0x24'))]=_0x5f27d9[_0xb4a7('0x1e')];_0x45ec33[util[_0xb4a7('0x11')]('%s',_0xb4a7('0x25'))]=_0x32e707;}if(_0xe719ba&&_0xe719ba['Contact']){for(var _0x4c700f in _0xe719ba[_0xb4a7('0x26')]){if(_0xe719ba['Contact'][_0xb4a7('0x27')](_0x4c700f)){if(!_[_0xb4a7('0x15')](_0xe719ba[_0xb4a7('0x26')][_0x4c700f])&&_0x4c700f!=='id'&&_0x4c700f!=='tags'&&_0x4c700f!==_0xb4a7('0x28')&&_0x4c700f!==_0xb4a7('0x29')){_0x45ec33[util['format']('%s%s','XMD-',_[_0xb4a7('0x2a')](_0x4c700f))]=_0xe719ba['Contact'][_0x4c700f];}}}}return _0x45ec33;};exports[_0xb4a7('0x2b')]=function(_0x349ccb){var _0xf3995f={};for(var _0x122c79 in _0x349ccb){if(_0x349ccb[_0xb4a7('0x27')](_0x122c79)){_0xf3995f[util['format']('%s',_['toLower'](_0x122c79))]=_0x349ccb[_0x122c79];}}return{'variables':_0xf3995f};};exports[_0xb4a7('0x2c')]=function(_0x5ec2cb,_0x344e9d){if(!_['isNil'](_0x5ec2cb)){if(_0x5ec2cb[_0xb4a7('0x27')](_0xb4a7('0x2d'))){if(_0x5ec2cb[_0xb4a7('0x2d')]>0x0){_0x5ec2cb['originated']-=0x1;}else{logger[_0xb4a7('0xc')](_0xb4a7('0x2e'),_0x344e9d);}}}else{logger[_0xb4a7('0xc')](_0xb4a7('0x2f'),_0x344e9d);}};exports[_0xb4a7('0x30')]=function(_0xc622af){var _0x2d884d=moment()[_0xb4a7('0x11')](_0xb4a7('0x31'));_0xc622af[_0xb4a7('0x32')]=0xd;_0xc622af[_0xb4a7('0x33')]=_0xb4a7('0x34');_0xc622af['starttime']=_0x2d884d;_0xc622af[_0xb4a7('0x35')]=_0x2d884d;_0xc622af['endtime']=_0x2d884d;};exports[_0xb4a7('0x36')]=function(_0x4fc001,_0xba3045,_0x165195){var _0x3e9e10=moment()['format'](_0xb4a7('0x31'));_0x4fc001[_0xb4a7('0x32')]=_0xba3045;_0x4fc001[_0xb4a7('0x33')]=_0x165195;_0x4fc001[_0xb4a7('0x35')]=_0x3e9e10;_0x4fc001[_0xb4a7('0x37')]=getSeconds(_0x4fc001[_0xb4a7('0x35')],_0x4fc001[_0xb4a7('0x38')]);};exports[_0xb4a7('0x39')]=function(_0xd4caa,_0x2acd3d,_0x5b4633){_0xd4caa[_0xb4a7('0x3a')]=_0x2acd3d;_0xd4caa[_0xb4a7('0x3b')]=_0x5b4633;};exports[_0xb4a7('0x3c')]=function(_0xe506f8,_0xf81a91,_0x5ce436){var _0xc4ab2a=moment()['format'](_0xb4a7('0x31'));_0xe506f8[_0xb4a7('0x32')]=_0xf81a91;_0xe506f8[_0xb4a7('0x33')]=_0x5ce436;_0xe506f8[_0xb4a7('0x35')]=_0xe506f8['responsetime']?_0xe506f8[_0xb4a7('0x35')]:_0xc4ab2a;_0xe506f8['endtime']=_0xe506f8[_0xb4a7('0x3d')]?_0xe506f8[_0xb4a7('0x3d')]:_0xc4ab2a;_0xe506f8['ringtime']=getSeconds(_0xe506f8[_0xb4a7('0x35')]||0x0,_0xe506f8[_0xb4a7('0x38')]||0x0);_0xe506f8[_0xb4a7('0x3e')]=_0xe506f8[_0xb4a7('0x3f')]?getSeconds(_0xe506f8[_0xb4a7('0x3d')],_0xe506f8[_0xb4a7('0x3f')]):0x0;};exports[_0xb4a7('0x40')]=function(_0x494080){return _0x494080===_0xb4a7('0x41');};exports[_0xb4a7('0x42')]=function(_0x5b6a9d,_0x3aee2e,_0xfe82ea,_0x1b9a7d,_0x647c1a){var _0x7fcb21=_0x1b9a7d?'RECALL':_0x5b6a9d[_0xb4a7('0x19')];_0x7fcb21=_0x647c1a?_0xb4a7('0x43'):_0x7fcb21;return{'actionid':_0x5b6a9d[_0xb4a7('0x44')],'action':'originate','channel':_0x5b6a9d['channelAgent'],'callerid':util[_0xb4a7('0x11')](_0xb4a7('0x12'),_0x7fcb21,_0x5b6a9d['calleridnum']),'Exten':_0xb4a7('0x45'),'Context':'from-sip','Priority':'1','variable':_0xfe82ea,'timeout':(_0x3aee2e[_0xb4a7('0x46')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5b6a9d[_0xb4a7('0x44')]};};exports[_0xb4a7('0x47')]=function(_0x481ad5){return _0x481ad5[_0xb4a7('0x48')]+_0x481ad5[_0xb4a7('0x49')]+_0x481ad5[_0xb4a7('0x4a')]+_0x481ad5['countagentrejectretry']+_0x481ad5['countnosuchnumberretry'];};exports['cloneAction']=function(_0x37b913){var _0x1616d4=_[_0xb4a7('0x4b')](_0x37b913);_0x1616d4[_0xb4a7('0x32')]=0xf;_0x1616d4['statedesc']=_0xb4a7('0x4c');return _0x1616d4;};exports['scheduledAt']=function(_0x175288,_0x8017b8,_0x1c6349){var _0x3901e6={};_0x3901e6[_0x8017b8]=_0x175288[_0x8017b8];_0x3901e6[_0xb4a7('0x4d')]=![];_0x3901e6['scheduledat']=moment()[_0xb4a7('0x4e')](_0x1c6349,'minutes')['format'](_0xb4a7('0x31'));_0x3901e6['ContactId']=_0x175288[_0xb4a7('0x1b')];_0x3901e6[_0xb4a7('0x4f')]=_0x175288[_0xb4a7('0x4f')];_0x3901e6[_0xb4a7('0x1c')]=_0x175288[_0xb4a7('0x1c')]||undefined;return _0x3901e6;};exports[_0xb4a7('0x50')]=function(_0x37c7c9,_0x17e69b){if(!_[_0xb4a7('0x15')](_0x37c7c9)){if(_0x37c7c9[_0xb4a7('0x51')]>0x0){_0x37c7c9[_0xb4a7('0x51')]-=0x1;}else{logger[_0xb4a7('0xc')](_0x17e69b,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xb4a7('0xc')](_0x17e69b,_0xb4a7('0x52'));}};exports[_0xb4a7('0x53')]=function(_0x339f7f){if(_0x339f7f<=0x0){return!![];}return![];};exports[_0xb4a7('0x54')]=function(_0x4b67ed,_0x2a70fd,_0x1306dd){_0x4b67ed[_0xb4a7('0x55')]=_0x2a70fd;_0x4b67ed[_0xb4a7('0x18')]=_0x4b67ed[_0xb4a7('0x56')];_0x4b67ed[_0xb4a7('0x57')]=_0x4b67ed[_0xb4a7('0x58')];_0x4b67ed['motionChannel']=_0xb4a7('0x59');if(_0x1306dd){_0x4b67ed[_0xb4a7('0x5a')]=_0x1306dd[_0xb4a7('0x5a')];}return _0x4b67ed;};exports[_0xb4a7('0x5b')]=function(_0x51327f){var _0x3a3285={};_0x3a3285[_0xb4a7('0x56')]=_0x51327f[_0xb4a7('0x56')];_0x3a3285[_0xb4a7('0x57')]=_0x51327f[_0xb4a7('0x58')];_0x3a3285[_0xb4a7('0x44')]=_0x51327f[_0xb4a7('0x44')];return _0x3a3285;};exports['agentReadyId']=function(_0xcdb9c1){var _0x4b2387=[];for(var _0x53e9db in _0xcdb9c1){if(_0xcdb9c1[_0xb4a7('0x27')](_0x53e9db)){if(!_[_0xb4a7('0x15')](_0xcdb9c1[_0x53e9db])&&_0xcdb9c1[_0x53e9db][_0xb4a7('0x32')]===_0xb4a7('0x5c')&&_0xcdb9c1[_0x53e9db][_0xb4a7('0x5d')]==='reachable'){_0x4b2387[_0xb4a7('0x5e')](_0xcdb9c1[_0x53e9db]['id']);}}}return _0x4b2387;};exports[_0xb4a7('0x5f')]=function(_0x463744){var _0x3f9ebd=moment()[_0xb4a7('0x6')](0x0);var _0x18ce18=moment(_0x463744)['milliseconds'](0x0);return _0x3f9ebd[_0xb4a7('0x60')](_0x18ce18,_0xb4a7('0x7'));};exports['createBody']=function(_0x4a37b3){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4a37b3[_0xb4a7('0x1b')],'ListId':_0x4a37b3['ListId'],'VoiceQueueId':_0x4a37b3[_0xb4a7('0x1c')]||undefined,'CampaignId':_0x4a37b3[_0xb4a7('0x61')]||undefined};};exports[_0xb4a7('0x62')]=function(_0x17410a){if(_0x17410a===_0xb4a7('0x44')||_0x17410a===_0xb4a7('0x63')||_0x17410a===_0xb4a7('0x56')||_0x17410a===_0xb4a7('0x64')||_0x17410a===_0xb4a7('0x65')||_0x17410a===_0xb4a7('0x66')||_0x17410a==='membername'||_0x17410a===_0xb4a7('0x58')||_0x17410a==='calleridname'||_0x17410a==='active'||_0x17410a===_0xb4a7('0x1a')||_0x17410a==='scheduledat'||_0x17410a==='countbusyretry'||_0x17410a===_0xb4a7('0x49')||_0x17410a===_0xb4a7('0x4a')||_0x17410a===_0xb4a7('0x67')||_0x17410a===_0xb4a7('0x68')||_0x17410a===_0xb4a7('0x69')||_0x17410a===_0xb4a7('0x6a')||_0x17410a==='recallme'||_0x17410a===_0xb4a7('0x1b')||_0x17410a===_0xb4a7('0x4f')||_0x17410a===_0xb4a7('0x3b')||_0x17410a===_0xb4a7('0x1c')||_0x17410a===_0xb4a7('0x6b')||_0x17410a===_0xb4a7('0x6c')||_0x17410a==='xmd-queue'||_0x17410a===_0xb4a7('0x6d')||_0x17410a===_0xb4a7('0x6e')||_0x17410a===_0xb4a7('0x6f')||_0x17410a===_0xb4a7('0x70')||_0x17410a===_0xb4a7('0x71')||_0x17410a===_0xb4a7('0x72')||_0x17410a==='xmd-dialchannel'||_0x17410a===_0xb4a7('0x73')||_0x17410a==='xmd-cdrtype'||_0x17410a===_0xb4a7('0x74')||_0x17410a==='xmd-agiafter'||_0x17410a===_0xb4a7('0x75')||_0x17410a===_0xb4a7('0x76')||_0x17410a==='rtpaudioqosbridged'||_0x17410a==='rtpaudioqosjitter'||_0x17410a===_0xb4a7('0x77')||_0x17410a==='rtpaudioqosloss'||_0x17410a===_0xb4a7('0x78')||_0x17410a===_0xb4a7('0x79')||_0x17410a===_0xb4a7('0x7a')||_0x17410a===_0xb4a7('0x76')||_0x17410a===_0xb4a7('0x7b')||_0x17410a===_0xb4a7('0x7c')||_0x17410a===_0xb4a7('0x77')||_0x17410a===_0xb4a7('0x7d')||_0x17410a===_0xb4a7('0x78')||_0x17410a===_0xb4a7('0x79')||_0x17410a===_0xb4a7('0x7a')||_0x17410a===_0xb4a7('0x7e')||_0x17410a===_0xb4a7('0x7f')||_0x17410a===_0xb4a7('0x32')||_0x17410a===_0xb4a7('0x33')){return![];}return!![];};exports[_0xb4a7('0x80')]=function(_0x166c29,_0x227b0c){var _0x35fb20,_0x4c9a18,_0x117195;if(_0x227b0c<=0x0){_0x227b0c=0x1;}_0x35fb20=new RegExp(_0xb4a7('0x81')+_0x227b0c+'}$');_0x4c9a18=Math[_0xb4a7('0x82')](0xa,_0x227b0c-0x1);_0x117195=Math[_0xb4a7('0x82')](0xa,_0x227b0c)-0x1;return util[_0xb4a7('0x11')]('%s',_[_0xb4a7('0x83')](_0x166c29,_0x35fb20,_[_0xb4a7('0x84')](_0x4c9a18,_0x117195)));};exports[_0xb4a7('0x85')]=function(_0x421370){var _0x3f5d12=_0x421370[_0xb4a7('0x86')](/"(.*?)"/);return _0x3f5d12?_0x3f5d12[0x1]:_0x421370;};exports[_0xb4a7('0x87')]=function(_0x403329){var _0x21d6ff=_0x403329['match'](/<(.*?)>/);return _0x21d6ff?_0x21d6ff[0x1]:_0x403329;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 124f19a..8fe6ed0 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 _0x0c49=['queueremove','queuepause','reload','voicequeuechannel','voicechannel','queueadd','string','boolean'];(function(_0x33c663,_0x4416ed){var _0x4c6299=function(_0x4c1937){while(--_0x4c1937){_0x33c663['push'](_0x33c663['shift']());}};_0x4c6299(++_0x4416ed);}(_0x0c49,0x19d));var _0x90c4=function(_0x3c01e0,_0x14a827){_0x3c01e0=_0x3c01e0-0x0;var _0x4fec9c=_0x0c49[_0x3c01e0];return _0x4fec9c;};'use strict';exports[_0x90c4('0x0')]={'queue':{'type':_0x90c4('0x1'),'required':!![]},'interface':{'type':_0x90c4('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x90c4('0x2'),'required':![]}};exports[_0x90c4('0x3')]={'queue':{'type':_0x90c4('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x90c4('0x4')]={'interface':{'type':_0x90c4('0x1'),'required':!![]},'paused':{'type':_0x90c4('0x2')},'reason':{'type':'string','required':![]}};exports[_0x90c4('0x5')]={'module':{'type':'string','required':![]}};exports[_0x90c4('0x6')]={'uniqueid':{'type':_0x90c4('0x1'),'required':!![]}};exports[_0x90c4('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x90c4('0x1')},'format':{'type':_0x90c4('0x1')},'mixmonitorid':{'type':_0x90c4('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x90c4('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x90c4('0x1'),'required':!![]},'exten':{'type':_0x90c4('0x1'),'required':!![]},'context':{'type':_0x90c4('0x1')}}; \ No newline at end of file +var _0x20be=['number','boolean','queueremove','queuepause','reload','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string'];(function(_0x3a2a7d,_0x27e79f){var _0xb418e2=function(_0x440119){while(--_0x440119){_0x3a2a7d['push'](_0x3a2a7d['shift']());}};_0xb418e2(++_0x27e79f);}(_0x20be,0x11e));var _0xe20b=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x20be[_0x42cae2];return _0x5f256f;};'use strict';exports[_0xe20b('0x0')]={'queue':{'type':_0xe20b('0x1'),'required':!![]},'interface':{'type':_0xe20b('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0xe20b('0x2'),'required':![]},'paused':{'type':_0xe20b('0x3'),'required':![]}};exports[_0xe20b('0x4')]={'queue':{'type':_0xe20b('0x1'),'required':!![]},'interface':{'type':_0xe20b('0x1'),'required':!![]}};exports[_0xe20b('0x5')]={'interface':{'type':_0xe20b('0x1'),'required':!![]},'paused':{'type':_0xe20b('0x3')},'reason':{'type':_0xe20b('0x1'),'required':![]}};exports[_0xe20b('0x6')]={'module':{'type':_0xe20b('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xe20b('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0xe20b('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':_0xe20b('0x1')}};exports[_0xe20b('0x7')]={'uniqueid':{'type':_0xe20b('0x1'),'required':!![]}};exports[_0xe20b('0x8')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xe20b('0x1'),'required':!![]},'context':{'type':_0xe20b('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index cb47472..7426c8c 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 _0xb867=['answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','interface','isUndefined','initTelephones','initTrunks','voiceQueues','initTriggers','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','disposition','ANSWERED','duration','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','exports','util','lodash','moment','../model/telephone','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','total'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb867,0x123));var _0x7b86=function(_0x2f22a4,_0x2b1e01){_0x2f22a4=_0x2f22a4-0x0;var _0x35c1fb=_0xb867[_0x2f22a4];return _0x35c1fb;};'use strict';var BPromise=require('bluebird');var util=require(_0x7b86('0x0'));var _=require(_0x7b86('0x1'));var moment=require(_0x7b86('0x2'));var Agent=require('../model/agent');var Telephone=require(_0x7b86('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x7b86('0x4'));var Trigger=require('../model/trigger');var Template=require(_0x7b86('0x5'));var Campaign=require(_0x7b86('0x6'));var VoiceExtension=require(_0x7b86('0x7'));var ZendeskAccount=require(_0x7b86('0x8'));var SalesforceAccount=require(_0x7b86('0x9'));var FreshdeskAccount=require(_0x7b86('0xa'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x7b86('0xb'));var DeskAccount=require(_0x7b86('0xc'));var VtigerAccount=require(_0x7b86('0xd'));var ServicenowAccount=require(_0x7b86('0xe'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x7b86('0xf'));var FaxAccount=require(_0x7b86('0x10'));var Realtime=function(){this[_0x7b86('0x11')]={};this[_0x7b86('0x12')]={};this[_0x7b86('0x13')]={};this['voiceQueues']={};this[_0x7b86('0x14')]={};this[_0x7b86('0x15')]={};this[_0x7b86('0x16')]={};this[_0x7b86('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x7b86('0x18')]={};this[_0x7b86('0x19')]={};this[_0x7b86('0x1a')]={};this[_0x7b86('0x1b')]={};this[_0x7b86('0x1c')]={};this[_0x7b86('0x1d')]={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0x7b86('0x1e')]={};this[_0x7b86('0x1f')]={};this[_0x7b86('0x20')]={};this[_0x7b86('0x21')]={};this[_0x7b86('0x22')]={};this[_0x7b86('0x23')]={};this['dynamics365Accounts']={};this[_0x7b86('0x24')]={};this[_0x7b86('0x25')]={};};function freeIsNotKey(_0x5b5553,_0x529cf4,_0x127570){var _0x29e393=_[_0x7b86('0x26')](_0x5b5553,function(_0xa158f1,_0x453d9f){return _0xa158f1[_0x127570];});for(var _0x1114bb in _0x529cf4){if(_0x529cf4[_0x7b86('0x27')](_0x1114bb)){if(!_0x29e393[_0x1114bb]){delete _0x529cf4[_0x1114bb];}}}}function freeIsNotKeySip(_0x5606dc,_0x1e4db5){var _0x42e615=_[_0x7b86('0x26')](_0x5606dc,function(_0x42a94b,_0x311ac7){return util[_0x7b86('0x28')](_0x7b86('0x29'),_0x42a94b[_0x7b86('0x2a')]);});for(var _0x4d533d in _0x1e4db5){if(_0x1e4db5[_0x7b86('0x27')](_0x4d533d)){if(!_0x42e615[_0x4d533d]){delete _0x1e4db5[_0x4d533d];}}}}function freeIsNotKeyAgent(_0x21c34e,_0x4b5d30){var _0x397def=_[_0x7b86('0x26')](_0x21c34e,function(_0xc211a,_0x33535b){var _0x4cdf8a=_[_0x7b86('0x2b')](_0xc211a['interface'])?util['format']('SIP/%s',_0xc211a[_0x7b86('0x2a')]):_0xc211a['interface'];return _0x4cdf8a;});for(var _0x2e4251 in _0x4b5d30){if(_0x4b5d30['hasOwnProperty'](_0x2e4251)){if(!_0x397def[_0x2e4251]){delete _0x4b5d30[_0x2e4251];}}}}function clearVoiceCallReports(_0x1dae13){_0x1dae13[_0x7b86('0x2c')]=0x0;_0x1dae13[_0x7b86('0x2d')]=0x0;_0x1dae13[_0x7b86('0x2e')]=0x0;_0x1dae13[_0x7b86('0x2f')]=0x0;_0x1dae13[_0x7b86('0x30')]=0x0;}function clearCampaigns(_0x1a72f7){if(!_[_0x7b86('0x31')](_0x1a72f7)){for(var _0x29da8a in _0x1a72f7){if(_0x1a72f7[_0x7b86('0x27')](_0x29da8a)){_0x1a72f7[_0x29da8a]['ivrTotalCallsDays']=0x0;_0x1a72f7[_0x29da8a][_0x7b86('0x32')]=0x0;}}}}function clearVoiceQueues(_0x598067){if(!_[_0x7b86('0x31')](_0x598067)){for(var _0x438eab in _0x598067){if(_0x598067[_0x7b86('0x27')](_0x438eab)){_0x598067[_0x438eab][_0x7b86('0x2c')]=0x0;_0x598067[_0x438eab][_0x7b86('0x2d')]=0x0;_0x598067[_0x438eab][_0x7b86('0x33')]=0x0;_0x598067[_0x438eab][_0x7b86('0x34')]=0x0;_0x598067[_0x438eab][_0x7b86('0x2e')]=0x0;_0x598067[_0x438eab]['sumDuration']=0x0;_0x598067[_0x438eab]['sumBillable']=0x0;_0x598067[_0x438eab][_0x7b86('0x35')]=0x0;_0x598067[_0x438eab][_0x7b86('0x36')]=0x0;_0x598067[_0x438eab][_0x7b86('0x37')]=0x0;_0x598067[_0x438eab][_0x7b86('0x38')]=0x0;_0x598067[_0x438eab][_0x7b86('0x39')]=0x0;_0x598067[_0x438eab][_0x7b86('0x3a')]=0x0;_0x598067[_0x438eab][_0x7b86('0x3b')]=0x0;_0x598067[_0x438eab][_0x7b86('0x3c')]=0x0;_0x598067[_0x438eab][_0x7b86('0x3d')]=0x0;_0x598067[_0x438eab][_0x7b86('0x3e')]=0x0;_0x598067[_0x438eab][_0x7b86('0x3f')]=0x0;_0x598067[_0x438eab][_0x7b86('0x40')]=0x0;_0x598067[_0x438eab][_0x7b86('0x35')]=0x0;_0x598067[_0x438eab]['outboundAnswerCallsDay']=0x0;_0x598067[_0x438eab][_0x7b86('0x41')]=!![];}}}}Realtime['prototype'][_0x7b86('0x42')]=function(_0x253eb9,_0xbc17b5){for(var _0xe71ff7 in _0xbc17b5){if(_0x253eb9[_0x7b86('0x27')](_0xe71ff7)){_0x253eb9[_0xe71ff7]=_0xbc17b5[_0xe71ff7];}}};Realtime[_0x7b86('0x43')][_0x7b86('0x44')]=function(){var _0x305bd7=this;return function(_0x524462){if(_0x524462){freeIsNotKeyAgent(_0x524462,_0x305bd7[_0x7b86('0x11')]);for(var _0x1c8f36=0x0,_0x4ad2d8={},_0x2f5352={};_0x1c8f36<_0x524462[_0x7b86('0x45')];_0x1c8f36+=0x1){_0x4ad2d8=_0x524462[_0x1c8f36];var _0x3e2212=_[_0x7b86('0x2b')](_0x4ad2d8[_0x7b86('0x46')])?util['format'](_0x7b86('0x29'),_0x4ad2d8['name']):_0x4ad2d8['interface'];if(_[_0x7b86('0x47')](_0x305bd7[_0x7b86('0x11')][_0x3e2212])){_0x305bd7['agents'][_0x3e2212]=new Agent(_0x4ad2d8);}else{_0x305bd7[_0x7b86('0x42')](_0x305bd7[_0x7b86('0x11')][_0x3e2212],_0x4ad2d8);}}}return _0x305bd7[_0x7b86('0x11')];};};Realtime['prototype'][_0x7b86('0x48')]=function(){var _0x1888ab=this;return function(_0x27b534){if(_0x27b534){freeIsNotKeySip(_0x27b534,_0x1888ab[_0x7b86('0x12')]);for(var _0x354566=0x0,_0x4800c2={},_0xb15648={};_0x354566<_0x27b534[_0x7b86('0x45')];_0x354566+=0x1){_0x4800c2=_0x27b534[_0x354566];if(_[_0x7b86('0x47')](_0x1888ab[_0x7b86('0x12')][util['format'](_0x7b86('0x29'),_0x4800c2[_0x7b86('0x2a')])])){_0x1888ab[_0x7b86('0x12')][util['format'](_0x7b86('0x29'),_0x4800c2[_0x7b86('0x2a')])]=new Telephone(_0x4800c2);}else{_0x1888ab['mergeFromDatabase'](_0x1888ab[_0x7b86('0x12')][util[_0x7b86('0x28')](_0x7b86('0x29'),_0x4800c2['name'])],_0x4800c2);}}}return _0x1888ab[_0x7b86('0x12')];};};Realtime[_0x7b86('0x43')][_0x7b86('0x49')]=function(){var _0x789692=this;return function(_0x284647){if(_0x284647){freeIsNotKeySip(_0x284647,_0x789692['trunks']);for(var _0x664f1e=0x0,_0x417dd0={},_0x37aefe={};_0x664f1e<_0x284647[_0x7b86('0x45')];_0x664f1e+=0x1){_0x417dd0=_0x284647[_0x664f1e];if(_[_0x7b86('0x47')](_0x789692[_0x7b86('0x13')][util[_0x7b86('0x28')](_0x7b86('0x29'),_0x417dd0[_0x7b86('0x2a')])])){_0x789692[_0x7b86('0x13')][util['format']('SIP/%s',_0x417dd0[_0x7b86('0x2a')])]=new Trunk(_0x417dd0);}else{_0x789692['mergeFromDatabase'](_0x789692[_0x7b86('0x13')][util[_0x7b86('0x28')](_0x7b86('0x29'),_0x417dd0[_0x7b86('0x2a')])],_0x417dd0);}}}return _0x789692[_0x7b86('0x13')];};};Realtime[_0x7b86('0x43')]['initVoiceQueues']=function(){var _0x3dd988=this;return function(_0x5d306c){if(_0x5d306c){freeIsNotKey(_0x5d306c,_0x3dd988['voiceQueues'],_0x7b86('0x2a'));for(var _0x4fdb2c=0x0,_0x538b78={},_0x23a9af={};_0x4fdb2c<_0x5d306c[_0x7b86('0x45')];_0x4fdb2c+=0x1){_0x538b78=_0x5d306c[_0x4fdb2c];if(_[_0x7b86('0x47')](_0x3dd988[_0x7b86('0x4a')][_0x538b78[_0x7b86('0x2a')]])){_0x3dd988[_0x7b86('0x4a')][_0x538b78['name']]=new VoiceQueue(_0x538b78);}else{_0x3dd988[_0x7b86('0x42')](_0x3dd988[_0x7b86('0x4a')][_0x538b78[_0x7b86('0x2a')]],_0x538b78);}}}return _0x3dd988[_0x7b86('0x4a')];};};Realtime['prototype'][_0x7b86('0x4b')]=function(){var _0x53e125=this;return function(_0x499704){if(_0x499704){freeIsNotKey(_0x499704,_0x53e125[_0x7b86('0x14')],'id');for(var _0x2e316b=0x0,_0x530233={},_0x5e8710={};_0x2e316b<_0x499704[_0x7b86('0x45')];_0x2e316b+=0x1){_0x530233=_0x499704[_0x2e316b];if(_['isUndefined'](_0x53e125[_0x7b86('0x14')][_0x530233['id']])){_0x53e125['triggers'][_0x530233['id']]=new Trigger(_0x530233);}else{_0x53e125[_0x7b86('0x42')](_0x53e125['triggers'][_0x530233['id']],_0x530233);}}}return _0x53e125[_0x7b86('0x14')];};};Realtime['prototype']['initTemplates']=function(){var _0xa2fb01=this;return function(_0x52f4b5){if(_0x52f4b5){freeIsNotKey(_0x52f4b5,_0xa2fb01[_0x7b86('0x16')],'id');for(var _0x43b8cc=0x0,_0x13abbd={},_0x597325={};_0x43b8cc<_0x52f4b5[_0x7b86('0x45')];_0x43b8cc+=0x1){_0x13abbd=_0x52f4b5[_0x43b8cc];if(_[_0x7b86('0x47')](_0xa2fb01[_0x7b86('0x16')][_0x13abbd['id']])){_0xa2fb01[_0x7b86('0x16')][_0x13abbd['id']]=new Template(_0x13abbd);}else{_0xa2fb01[_0x7b86('0x42')](_0xa2fb01[_0x7b86('0x16')][_0x13abbd['id']],_0x13abbd);}}}return _0xa2fb01['templates'];};};Realtime[_0x7b86('0x43')][_0x7b86('0x4c')]=function(){var _0x1ab05f=this;return function(_0x21a19f){if(_0x21a19f){freeIsNotKey(_0x21a19f,_0x1ab05f[_0x7b86('0x4d')],'id');for(var _0x4e752c=0x0,_0x4524a3={},_0x4b0b64={};_0x4e752c<_0x21a19f[_0x7b86('0x45')];_0x4e752c+=0x1){_0x4524a3=_0x21a19f[_0x4e752c];if(_[_0x7b86('0x47')](_0x1ab05f[_0x7b86('0x4d')][_0x4524a3['id']])){_0x1ab05f[_0x7b86('0x4d')][_0x4524a3['id']]=new ZendeskAccount(_0x4524a3);}else{_0x1ab05f[_0x7b86('0x42')](_0x1ab05f[_0x7b86('0x4d')][_0x4524a3['id']],_0x4524a3);}}}return _0x1ab05f['zendeskAccounts'];};};Realtime[_0x7b86('0x43')][_0x7b86('0x4e')]=function(){var _0x3b07c4=this;return function(_0x4e4027){if(_0x4e4027){freeIsNotKey(_0x4e4027,_0x3b07c4['salesforceAccounts'],'id');for(var _0x1fef6d=0x0,_0x515e30={},_0x1a9602={};_0x1fef6d<_0x4e4027[_0x7b86('0x45')];_0x1fef6d+=0x1){_0x515e30=_0x4e4027[_0x1fef6d];if(_['isUndefined'](_0x3b07c4[_0x7b86('0x4f')][_0x515e30['id']])){_0x3b07c4[_0x7b86('0x4f')][_0x515e30['id']]=new SalesforceAccount(_0x515e30);}else{_0x3b07c4[_0x7b86('0x42')](_0x3b07c4['salesforceAccounts'][_0x515e30['id']],_0x515e30);}}}return _0x3b07c4['salesforceAccounts'];};};Realtime['prototype'][_0x7b86('0x50')]=function(){var _0x2d9ff5=this;return function(_0x512342){if(_0x512342){freeIsNotKey(_0x512342,_0x2d9ff5[_0x7b86('0x1f')],'id');for(var _0x16f09c=0x0,_0x2935f3={},_0x3d4a57={};_0x16f09c<_0x512342[_0x7b86('0x45')];_0x16f09c+=0x1){_0x2935f3=_0x512342[_0x16f09c];if(_[_0x7b86('0x47')](_0x2d9ff5[_0x7b86('0x1f')][_0x2935f3['id']])){_0x2d9ff5[_0x7b86('0x1f')][_0x2935f3['id']]=new FreshdeskAccount(_0x2935f3);}else{_0x2d9ff5[_0x7b86('0x42')](_0x2d9ff5[_0x7b86('0x1f')][_0x2935f3['id']],_0x2935f3);}}}return _0x2d9ff5[_0x7b86('0x1f')];};};Realtime[_0x7b86('0x43')][_0x7b86('0x51')]=function(){var _0x3cbdc3=this;return function(_0x49936b){if(_0x49936b){freeIsNotKey(_0x49936b,_0x3cbdc3[_0x7b86('0x20')],'id');for(var _0x27d5ea=0x0,_0x5e93f1={},_0x3f995c={};_0x27d5ea<_0x49936b[_0x7b86('0x45')];_0x27d5ea+=0x1){_0x5e93f1=_0x49936b[_0x27d5ea];if(_[_0x7b86('0x47')](_0x3cbdc3[_0x7b86('0x20')][_0x5e93f1['id']])){_0x3cbdc3[_0x7b86('0x20')][_0x5e93f1['id']]=new ZohoAccount(_0x5e93f1);}else{_0x3cbdc3[_0x7b86('0x42')](_0x3cbdc3[_0x7b86('0x20')][_0x5e93f1['id']],_0x5e93f1);}}}return _0x3cbdc3[_0x7b86('0x20')];};};Realtime[_0x7b86('0x43')][_0x7b86('0x52')]=function(){var _0x408ed1=this;return function(_0x1ccd54){if(_0x1ccd54){freeIsNotKey(_0x1ccd54,_0x408ed1[_0x7b86('0x21')],'id');for(var _0x127076=0x0,_0x3bee4c={},_0x3f2aaf={};_0x127076<_0x1ccd54['length'];_0x127076+=0x1){_0x3bee4c=_0x1ccd54[_0x127076];if(_[_0x7b86('0x47')](_0x408ed1[_0x7b86('0x21')][_0x3bee4c['id']])){_0x408ed1[_0x7b86('0x21')][_0x3bee4c['id']]=new DeskAccount(_0x3bee4c);}else{_0x408ed1[_0x7b86('0x42')](_0x408ed1[_0x7b86('0x21')][_0x3bee4c['id']],_0x3bee4c);}}}return _0x408ed1[_0x7b86('0x21')];};};Realtime[_0x7b86('0x43')][_0x7b86('0x53')]=function(){var _0xd83ef3=this;return function(_0x335700){if(_0x335700){freeIsNotKey(_0x335700,_0xd83ef3[_0x7b86('0x1e')],'id');for(var _0x3db971=0x0,_0x584cc3={},_0x7097d6={};_0x3db971<_0x335700[_0x7b86('0x45')];_0x3db971+=0x1){_0x584cc3=_0x335700[_0x3db971];if(_[_0x7b86('0x47')](_0xd83ef3[_0x7b86('0x1e')][_0x584cc3['id']])){_0xd83ef3[_0x7b86('0x1e')][_0x584cc3['id']]=new SugarcrmAccount(_0x584cc3);}else{_0xd83ef3[_0x7b86('0x42')](_0xd83ef3[_0x7b86('0x1e')][_0x584cc3['id']],_0x584cc3);}}}return _0xd83ef3[_0x7b86('0x1e')];};};Realtime[_0x7b86('0x43')][_0x7b86('0x54')]=function(){var _0x188abe=this;return function(_0x2ae1ea){if(_0x2ae1ea){freeIsNotKey(_0x2ae1ea,_0x188abe['vtigerAccounts'],'id');for(var _0x3a96f8=0x0,_0x56eb28={},_0x5ef9a2={};_0x3a96f8<_0x2ae1ea[_0x7b86('0x45')];_0x3a96f8+=0x1){_0x56eb28=_0x2ae1ea[_0x3a96f8];if(_['isUndefined'](_0x188abe['vtigerAccounts'][_0x56eb28['id']])){_0x188abe['vtigerAccounts'][_0x56eb28['id']]=new VtigerAccount(_0x56eb28);}else{_0x188abe[_0x7b86('0x42')](_0x188abe[_0x7b86('0x22')][_0x56eb28['id']],_0x56eb28);}}}return _0x188abe[_0x7b86('0x22')];};};Realtime[_0x7b86('0x43')][_0x7b86('0x55')]=function(){var _0x3d0efb=this;return function(_0x5b5008){if(_0x5b5008){freeIsNotKey(_0x5b5008,_0x3d0efb[_0x7b86('0x23')],'id');for(var _0x347d99=0x0,_0x4425c4={},_0x44403f={};_0x347d99<_0x5b5008['length'];_0x347d99+=0x1){_0x4425c4=_0x5b5008[_0x347d99];if(_['isUndefined'](_0x3d0efb['servicenowAccounts'][_0x4425c4['id']])){_0x3d0efb[_0x7b86('0x23')][_0x4425c4['id']]=new ServicenowAccount(_0x4425c4);}else{_0x3d0efb['mergeFromDatabase'](_0x3d0efb[_0x7b86('0x23')][_0x4425c4['id']],_0x4425c4);}}}return _0x3d0efb[_0x7b86('0x23')];};};Realtime[_0x7b86('0x43')][_0x7b86('0x56')]=function(){var _0x20e769=this;return function(_0x37f87d){if(_0x37f87d){freeIsNotKey(_0x37f87d,_0x20e769['dynamics365Accounts'],'id');for(var _0x532202=0x0,_0xb23c4e={},_0x537393={};_0x532202<_0x37f87d[_0x7b86('0x45')];_0x532202+=0x1){_0xb23c4e=_0x37f87d[_0x532202];if(_['isUndefined'](_0x20e769['dynamics365Accounts'][_0xb23c4e['id']])){_0x20e769[_0x7b86('0x57')][_0xb23c4e['id']]=new Dynamics365Account(_0xb23c4e);}else{_0x20e769[_0x7b86('0x42')](_0x20e769[_0x7b86('0x57')][_0xb23c4e['id']],_0xb23c4e);}}}return _0x20e769['dynamics365Accounts'];};};Realtime[_0x7b86('0x43')][_0x7b86('0x58')]=function(){var _0x39dfc2=this;return function(_0x273818){if(_0x273818){freeIsNotKey(_0x273818,_0x39dfc2[_0x7b86('0x24')],'id');for(var _0x1b7ca8=0x0,_0x478823={},_0x5b0a8d={};_0x1b7ca8<_0x273818[_0x7b86('0x45')];_0x1b7ca8+=0x1){_0x478823=_0x273818[_0x1b7ca8];if(_[_0x7b86('0x47')](_0x39dfc2[_0x7b86('0x24')][_0x478823['id']])){_0x39dfc2[_0x7b86('0x24')][_0x478823['id']]=new FreshsalesAccount(_0x478823);}else{_0x39dfc2[_0x7b86('0x42')](_0x39dfc2['freshsalesAccounts'][_0x478823['id']],_0x478823);}}}return _0x39dfc2[_0x7b86('0x24')];};};Realtime[_0x7b86('0x43')][_0x7b86('0x59')]=function(){var _0x8d9d2c=this;return function(_0xdafdf6){for(var _0x4cee3f=0x0;_0x4cee3f<_0xdafdf6[_0x7b86('0x45')];_0x4cee3f+=0x1){_[_0x7b86('0x5a')](_0x8d9d2c[_0x7b86('0x4a')][_0xdafdf6[_0x4cee3f][_0x7b86('0x2a')]],_0xdafdf6[_0x4cee3f]);}return _0x8d9d2c[_0x7b86('0x4a')];};};Realtime[_0x7b86('0x43')][_0x7b86('0x5b')]=function(){var _0x23d200=this;return function(_0x5b1864){clearVoiceQueues(_0x23d200[_0x7b86('0x4a')]);if(_0x5b1864){_0x5b1864=_[_0x7b86('0x5c')](_0x5b1864,'uniqueid');for(var _0x11f538 in _0x5b1864){if(_0x5b1864[_0x7b86('0x27')](_0x11f538)){var _0x2afd20={};for(var _0xc49422=0x0;_0xc49422<_0x5b1864[_0x11f538][_0x7b86('0x45')];_0xc49422+=0x1){var _0x16639d=_0x5b1864[_0x11f538][_0xc49422]['queue'];if(_0x23d200[_0x7b86('0x4a')][_0x16639d]){if(_0x5b1864[_0x11f538][_0xc49422][_0x7b86('0x5d')]){_0x23d200[_0x7b86('0x4a')][_0x16639d][_0x7b86('0x33')]+=0x1;}if(_0x5b1864[_0x11f538][_0xc49422]['queuecallerabandon']){_0x23d200[_0x7b86('0x4a')][_0x16639d][_0x7b86('0x34')]+=0x1;}_0x23d200['voiceQueues'][_0x16639d][_0x7b86('0x2e')]+=moment(_0x5b1864[_0x11f538][_0xc49422][_0x7b86('0x5e')])[_0x7b86('0x5f')](moment(_0x5b1864[_0x11f538][_0xc49422]['queuecallerjoinAt']),_0x7b86('0x60'))||0x0;if(_0xc49422===_0x5b1864[_0x11f538][_0x7b86('0x45')]-0x1){_0x23d200[_0x7b86('0x4a')][_0x16639d][_0x7b86('0x2f')]+=moment(_0x5b1864[_0x11f538][_0xc49422][_0x7b86('0x61')]||_0x5b1864[_0x11f538][_0xc49422][_0x7b86('0x62')]||_0x5b1864[_0x11f538][_0xc49422][_0x7b86('0x63')])['diff'](moment(_0x5b1864[_0x11f538][_0xc49422][_0x7b86('0x64')]),_0x7b86('0x60'))||0x0;_0x23d200[_0x7b86('0x4a')][_0x16639d][_0x7b86('0x2c')]+=0x1;if(_0x5b1864[_0x11f538][_0xc49422][_0x7b86('0x65')]){_0x23d200[_0x7b86('0x4a')][_0x16639d][_0x7b86('0x2d')]+=0x1;_0x23d200['voiceQueues'][_0x16639d]['sumBillable']+=moment(_0x5b1864[_0x11f538][_0xc49422]['queuecallercompleteAt'])[_0x7b86('0x5f')](moment(_0x5b1864[_0x11f538][_0xc49422][_0x7b86('0x5e')]),'seconds')||0x0;}}else{_0x23d200[_0x7b86('0x4a')][_0x16639d][_0x7b86('0x2f')]+=_0x23d200['voiceQueues'][_0x16639d]['sumHoldTime']||0x0;}}}}}}return _0x23d200[_0x7b86('0x4a')];};};Realtime['prototype']['initVoiceCallReports']=function(){var _0x1f02b3=this;return function(_0x4bc487){clearVoiceCallReports(_0x1f02b3[_0x7b86('0x17')]);if(_0x4bc487){for(var _0x321710=0x0;_0x321710<_0x4bc487[_0x7b86('0x45')];_0x321710+=0x1){_0x1f02b3[_0x7b86('0x17')]['total']+=0x1;_0x1f02b3['outbound']['sumDuration']+=_0x4bc487[_0x321710]['duration'];if(_0x4bc487[_0x321710][_0x7b86('0x66')]===_0x7b86('0x67')){_0x1f02b3['outbound'][_0x7b86('0x2d')]+=0x1;_0x1f02b3[_0x7b86('0x17')][_0x7b86('0x2e')]+=_0x4bc487[_0x321710][_0x7b86('0x68')]-_0x4bc487[_0x321710]['billableseconds']||0x0;_0x1f02b3[_0x7b86('0x17')][_0x7b86('0x30')]+=_0x4bc487[_0x321710][_0x7b86('0x69')];}}}return _0x1f02b3['outbound'];};};Realtime[_0x7b86('0x43')][_0x7b86('0x6a')]=function(){var _0x1a9ed7=this;return function(_0x5a83e8){if(_0x5a83e8){freeIsNotKey(_0x5a83e8,_0x1a9ed7['campaigns'],_0x7b86('0x2a'));for(var _0x48f47e=0x0,_0x32b692={};_0x48f47e<_0x5a83e8[_0x7b86('0x45')];_0x48f47e+=0x1){_0x32b692=_0x5a83e8[_0x48f47e];if(_[_0x7b86('0x47')](_0x1a9ed7[_0x7b86('0x15')][_0x32b692[_0x7b86('0x2a')]])){_0x1a9ed7[_0x7b86('0x15')][_0x32b692[_0x7b86('0x2a')]]=new Campaign(_0x32b692);}else{_0x1a9ed7[_0x7b86('0x42')](_0x1a9ed7[_0x7b86('0x15')][_0x32b692[_0x7b86('0x2a')]],_0x32b692);_0x1a9ed7[_0x7b86('0x15')][_0x32b692['name']][_0x7b86('0x6b')]=_0x32b692['SquareProject']?_0x32b692[_0x7b86('0x6c')][_0x7b86('0x2a')]:undefined;}}}return _0x1a9ed7[_0x7b86('0x15')];};};Realtime['prototype'][_0x7b86('0x6d')]=function(){var _0x2c6a0e=this;return function(_0x52789d){if(_0x52789d){freeIsNotKey(_0x52789d,_0x2c6a0e[_0x7b86('0x18')],'id');for(var _0xdebc68=0x0,_0x3c9830={};_0xdebc68<_0x52789d['length'];_0xdebc68+=0x1){_0x3c9830=_0x52789d[_0xdebc68];if(_[_0x7b86('0x47')](_0x2c6a0e[_0x7b86('0x18')][_0x3c9830['id']])){_0x2c6a0e['voiceExtensions'][_0x3c9830['id']]=new VoiceExtension(_0x3c9830);}else{_0x2c6a0e[_0x7b86('0x42')](_0x2c6a0e[_0x7b86('0x18')][_0x3c9830['id']],_0x3c9830);}}}return _0x2c6a0e['voiceExtensions'];};};Realtime[_0x7b86('0x43')][_0x7b86('0x6e')]=function(){var _0x23bff3=this;return function(_0x51cbd3){clearCampaigns(_0x23bff3[_0x7b86('0x15')]);for(var _0x5b535b=0x0;_0x5b535b<_0x51cbd3[_0x7b86('0x45')];_0x5b535b+=0x1){_[_0x7b86('0x5a')](_0x23bff3[_0x7b86('0x15')][_0x51cbd3[_0x5b535b][_0x7b86('0x2a')]],_0x51cbd3[_0x5b535b]);}return _0x23bff3[_0x7b86('0x15')];};};Realtime[_0x7b86('0x43')]['initFaxAccounts']=function(){var _0x272839=this;return function(_0x3963fe){if(_0x3963fe){freeIsNotKey(_0x3963fe,_0x272839['faxAccounts'],'id');for(var _0x56f044=0x0,_0xb5e9b2={},_0x40b43c={};_0x56f044<_0x3963fe[_0x7b86('0x45')];_0x56f044+=0x1){_0xb5e9b2=_0x3963fe[_0x56f044];if(_[_0x7b86('0x47')](_0x272839[_0x7b86('0x25')][_0xb5e9b2['id']])){_0x272839[_0x7b86('0x25')][_0xb5e9b2['id']]=new FaxAccount(_0xb5e9b2);}else{_0x272839[_0x7b86('0x42')](_0x272839['faxAccounts'][_0xb5e9b2['id']],_0xb5e9b2);}}}return _0x272839[_0x7b86('0x25')];};};module[_0x7b86('0x6f')]=Realtime; \ No newline at end of file +var _0x4b2b=['mergeFromDatabase','initTrunks','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','sumDuration','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','duration','disposition','billableseconds','initCampaigns','dialQueueProject','SquareProject','initCampaignHopperHistory','initFaxAccounts','faxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trigger','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','timers','settings','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','answered','sumHoldTime','sumBillable','isEmpty','ivrTotalCallsDays','abandoned','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','length','isUndefined'];(function(_0x12d22f,_0x50e689){var _0x3694a8=function(_0x406b3d){while(--_0x406b3d){_0x12d22f['push'](_0x12d22f['shift']());}};_0x3694a8(++_0x50e689);}(_0x4b2b,0x15f));var _0xb4b2=function(_0x56d3eb,_0x36d84d){_0x56d3eb=_0x56d3eb-0x0;var _0x5c167b=_0x4b2b[_0x56d3eb];return _0x5c167b;};'use strict';var BPromise=require(_0xb4b2('0x0'));var util=require(_0xb4b2('0x1'));var _=require(_0xb4b2('0x2'));var moment=require(_0xb4b2('0x3'));var Agent=require(_0xb4b2('0x4'));var Telephone=require(_0xb4b2('0x5'));var Trunk=require('../model/trunk');var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0xb4b2('0x6'));var Template=require('../model/template');var Campaign=require(_0xb4b2('0x7'));var VoiceExtension=require(_0xb4b2('0x8'));var ZendeskAccount=require(_0xb4b2('0x9'));var SalesforceAccount=require(_0xb4b2('0xa'));var FreshdeskAccount=require(_0xb4b2('0xb'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0xb4b2('0xc'));var DeskAccount=require(_0xb4b2('0xd'));var VtigerAccount=require(_0xb4b2('0xe'));var ServicenowAccount=require(_0xb4b2('0xf'));var Dynamics365Account=require(_0xb4b2('0x10'));var FreshsalesAccount=require(_0xb4b2('0x11'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xb4b2('0x12')]={};this[_0xb4b2('0x13')]={};this[_0xb4b2('0x14')]={};this[_0xb4b2('0x15')]={};this[_0xb4b2('0x16')]={};this[_0xb4b2('0x17')]={};this[_0xb4b2('0x18')]={};this[_0xb4b2('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xb4b2('0x1a')]={};this[_0xb4b2('0x1b')]={};this[_0xb4b2('0x1c')]={};this['outboundChannels']={};this[_0xb4b2('0x1d')]={};this[_0xb4b2('0x1e')]={};this['zendeskAccounts']={};this[_0xb4b2('0x1f')]={};this[_0xb4b2('0x20')]={};this[_0xb4b2('0x21')]={};this[_0xb4b2('0x22')]={};this[_0xb4b2('0x23')]={};this[_0xb4b2('0x24')]={};this[_0xb4b2('0x25')]={};this[_0xb4b2('0x26')]={};this['freshsalesAccounts']={};this['faxAccounts']={};};function freeIsNotKey(_0x4ea037,_0x4b8297,_0x4886e5){var _0x2bc29f=_[_0xb4b2('0x27')](_0x4ea037,function(_0x434ee8,_0x586e4d){return _0x434ee8[_0x4886e5];});for(var _0x209974 in _0x4b8297){if(_0x4b8297[_0xb4b2('0x28')](_0x209974)){if(!_0x2bc29f[_0x209974]){delete _0x4b8297[_0x209974];}}}}function freeIsNotKeySip(_0x4b2bce,_0x2a7380){var _0x286d35=_[_0xb4b2('0x27')](_0x4b2bce,function(_0x2dec59,_0x5afbe3){return util[_0xb4b2('0x29')](_0xb4b2('0x2a'),_0x2dec59[_0xb4b2('0x2b')]);});for(var _0x300ca0 in _0x2a7380){if(_0x2a7380[_0xb4b2('0x28')](_0x300ca0)){if(!_0x286d35[_0x300ca0]){delete _0x2a7380[_0x300ca0];}}}}function freeIsNotKeyAgent(_0x366595,_0xfc9919){var _0x2479ad=_[_0xb4b2('0x27')](_0x366595,function(_0xc6674a,_0x247b06){var _0x91071d=_[_0xb4b2('0x2c')](_0xc6674a['interface'])?util['format'](_0xb4b2('0x2a'),_0xc6674a['name']):_0xc6674a[_0xb4b2('0x2d')];return _0x91071d;});for(var _0x344d9c in _0xfc9919){if(_0xfc9919[_0xb4b2('0x28')](_0x344d9c)){if(!_0x2479ad[_0x344d9c]){delete _0xfc9919[_0x344d9c];}}}}function clearVoiceCallReports(_0x49c68c){_0x49c68c['total']=0x0;_0x49c68c[_0xb4b2('0x2e')]=0x0;_0x49c68c[_0xb4b2('0x2f')]=0x0;_0x49c68c['sumDuration']=0x0;_0x49c68c[_0xb4b2('0x30')]=0x0;}function clearCampaigns(_0x1763b6){if(!_[_0xb4b2('0x31')](_0x1763b6)){for(var _0x13db2f in _0x1763b6){if(_0x1763b6[_0xb4b2('0x28')](_0x13db2f)){_0x1763b6[_0x13db2f][_0xb4b2('0x32')]=0x0;_0x1763b6[_0x13db2f]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x314e54){if(!_[_0xb4b2('0x31')](_0x314e54)){for(var _0x45307e in _0x314e54){if(_0x314e54[_0xb4b2('0x28')](_0x45307e)){_0x314e54[_0x45307e]['total']=0x0;_0x314e54[_0x45307e]['answered']=0x0;_0x314e54[_0x45307e]['unmanaged']=0x0;_0x314e54[_0x45307e][_0xb4b2('0x33')]=0x0;_0x314e54[_0x45307e][_0xb4b2('0x2f')]=0x0;_0x314e54[_0x45307e]['sumDuration']=0x0;_0x314e54[_0x45307e][_0xb4b2('0x30')]=0x0;_0x314e54[_0x45307e]['outboundAnswerAgiCallsDay']=0x0;_0x314e54[_0x45307e]['outboundNoAnswerCallsDay']=0x0;_0x314e54[_0x45307e][_0xb4b2('0x34')]=0x0;_0x314e54[_0x45307e][_0xb4b2('0x35')]=0x0;_0x314e54[_0x45307e][_0xb4b2('0x36')]=0x0;_0x314e54[_0x45307e]['outboundUnknownCallsDay']=0x0;_0x314e54[_0x45307e][_0xb4b2('0x37')]=0x0;_0x314e54[_0x45307e][_0xb4b2('0x38')]=0x0;_0x314e54[_0x45307e]['outboundBlacklistCallsDay']=0x0;_0x314e54[_0x45307e][_0xb4b2('0x39')]=0x0;_0x314e54[_0x45307e]['outboundRejectCallsDay']=0x0;_0x314e54[_0x45307e]['outboundReCallsDay']=0x0;_0x314e54[_0x45307e][_0xb4b2('0x3a')]=0x0;_0x314e54[_0x45307e][_0xb4b2('0x3b')]=0x0;_0x314e54[_0x45307e][_0xb4b2('0x3c')]=!![];}}}}Realtime[_0xb4b2('0x3d')]['mergeFromDatabase']=function(_0x474de2,_0x2c5069){for(var _0x2ede17 in _0x2c5069){if(_0x474de2[_0xb4b2('0x28')](_0x2ede17)){_0x474de2[_0x2ede17]=_0x2c5069[_0x2ede17];}}};Realtime[_0xb4b2('0x3d')][_0xb4b2('0x3e')]=function(){var _0xd93ce0=this;return function(_0x28f070){if(_0x28f070){freeIsNotKeyAgent(_0x28f070,_0xd93ce0[_0xb4b2('0x12')]);for(var _0x4b5625=0x0,_0x510fae={},_0x5385b2={};_0x4b5625<_0x28f070[_0xb4b2('0x3f')];_0x4b5625+=0x1){_0x510fae=_0x28f070[_0x4b5625];var _0x48ab43=_['isNil'](_0x510fae[_0xb4b2('0x2d')])?util[_0xb4b2('0x29')]('SIP/%s',_0x510fae[_0xb4b2('0x2b')]):_0x510fae[_0xb4b2('0x2d')];if(_[_0xb4b2('0x40')](_0xd93ce0[_0xb4b2('0x12')][_0x48ab43])){_0xd93ce0[_0xb4b2('0x12')][_0x48ab43]=new Agent(_0x510fae);}else{_0xd93ce0[_0xb4b2('0x41')](_0xd93ce0['agents'][_0x48ab43],_0x510fae);}}}return _0xd93ce0[_0xb4b2('0x12')];};};Realtime['prototype']['initTelephones']=function(){var _0x61a6b2=this;return function(_0xf9733a){if(_0xf9733a){freeIsNotKeySip(_0xf9733a,_0x61a6b2[_0xb4b2('0x13')]);for(var _0x51a99f=0x0,_0x1cc062={},_0x2aaee1={};_0x51a99f<_0xf9733a['length'];_0x51a99f+=0x1){_0x1cc062=_0xf9733a[_0x51a99f];if(_[_0xb4b2('0x40')](_0x61a6b2[_0xb4b2('0x13')][util[_0xb4b2('0x29')](_0xb4b2('0x2a'),_0x1cc062[_0xb4b2('0x2b')])])){_0x61a6b2[_0xb4b2('0x13')][util['format']('SIP/%s',_0x1cc062[_0xb4b2('0x2b')])]=new Telephone(_0x1cc062);}else{_0x61a6b2[_0xb4b2('0x41')](_0x61a6b2[_0xb4b2('0x13')][util[_0xb4b2('0x29')](_0xb4b2('0x2a'),_0x1cc062[_0xb4b2('0x2b')])],_0x1cc062);}}}return _0x61a6b2[_0xb4b2('0x13')];};};Realtime[_0xb4b2('0x3d')][_0xb4b2('0x42')]=function(){var _0x37eeb6=this;return function(_0xd60a1d){if(_0xd60a1d){freeIsNotKeySip(_0xd60a1d,_0x37eeb6[_0xb4b2('0x14')]);for(var _0x19b180=0x0,_0x1f34b2={},_0x47ee45={};_0x19b180<_0xd60a1d[_0xb4b2('0x3f')];_0x19b180+=0x1){_0x1f34b2=_0xd60a1d[_0x19b180];if(_[_0xb4b2('0x40')](_0x37eeb6[_0xb4b2('0x14')][util['format'](_0xb4b2('0x2a'),_0x1f34b2['name'])])){_0x37eeb6[_0xb4b2('0x14')][util[_0xb4b2('0x29')](_0xb4b2('0x2a'),_0x1f34b2['name'])]=new Trunk(_0x1f34b2);}else{_0x37eeb6[_0xb4b2('0x41')](_0x37eeb6[_0xb4b2('0x14')][util[_0xb4b2('0x29')]('SIP/%s',_0x1f34b2[_0xb4b2('0x2b')])],_0x1f34b2);}}}return _0x37eeb6['trunks'];};};Realtime[_0xb4b2('0x3d')][_0xb4b2('0x43')]=function(){var _0x31e04f=this;return function(_0x7e5fc9){if(_0x7e5fc9){freeIsNotKey(_0x7e5fc9,_0x31e04f[_0xb4b2('0x15')],_0xb4b2('0x2b'));for(var _0x121a1e=0x0,_0x162144={},_0x4f9d58={};_0x121a1e<_0x7e5fc9[_0xb4b2('0x3f')];_0x121a1e+=0x1){_0x162144=_0x7e5fc9[_0x121a1e];if(_[_0xb4b2('0x40')](_0x31e04f[_0xb4b2('0x15')][_0x162144[_0xb4b2('0x2b')]])){_0x31e04f[_0xb4b2('0x15')][_0x162144[_0xb4b2('0x2b')]]=new VoiceQueue(_0x162144);}else{_0x31e04f[_0xb4b2('0x41')](_0x31e04f['voiceQueues'][_0x162144[_0xb4b2('0x2b')]],_0x162144);}}}return _0x31e04f[_0xb4b2('0x15')];};};Realtime['prototype'][_0xb4b2('0x44')]=function(){var _0x58c9b8=this;return function(_0x334832){if(_0x334832){freeIsNotKey(_0x334832,_0x58c9b8[_0xb4b2('0x16')],'id');for(var _0x4c474b=0x0,_0x263649={},_0x2e777a={};_0x4c474b<_0x334832[_0xb4b2('0x3f')];_0x4c474b+=0x1){_0x263649=_0x334832[_0x4c474b];if(_[_0xb4b2('0x40')](_0x58c9b8['triggers'][_0x263649['id']])){_0x58c9b8[_0xb4b2('0x16')][_0x263649['id']]=new Trigger(_0x263649);}else{_0x58c9b8[_0xb4b2('0x41')](_0x58c9b8[_0xb4b2('0x16')][_0x263649['id']],_0x263649);}}}return _0x58c9b8[_0xb4b2('0x16')];};};Realtime[_0xb4b2('0x3d')][_0xb4b2('0x45')]=function(){var _0x339869=this;return function(_0x53c371){if(_0x53c371){freeIsNotKey(_0x53c371,_0x339869[_0xb4b2('0x18')],'id');for(var _0x56a501=0x0,_0xd4422f={},_0x1bd8c2={};_0x56a501<_0x53c371[_0xb4b2('0x3f')];_0x56a501+=0x1){_0xd4422f=_0x53c371[_0x56a501];if(_[_0xb4b2('0x40')](_0x339869[_0xb4b2('0x18')][_0xd4422f['id']])){_0x339869[_0xb4b2('0x18')][_0xd4422f['id']]=new Template(_0xd4422f);}else{_0x339869[_0xb4b2('0x41')](_0x339869['templates'][_0xd4422f['id']],_0xd4422f);}}}return _0x339869[_0xb4b2('0x18')];};};Realtime[_0xb4b2('0x3d')][_0xb4b2('0x46')]=function(){var _0x1207b8=this;return function(_0x3d054b){if(_0x3d054b){freeIsNotKey(_0x3d054b,_0x1207b8['zendeskAccounts'],'id');for(var _0x140614=0x0,_0x256513={},_0xdcf60c={};_0x140614<_0x3d054b[_0xb4b2('0x3f')];_0x140614+=0x1){_0x256513=_0x3d054b[_0x140614];if(_[_0xb4b2('0x40')](_0x1207b8[_0xb4b2('0x47')][_0x256513['id']])){_0x1207b8[_0xb4b2('0x47')][_0x256513['id']]=new ZendeskAccount(_0x256513);}else{_0x1207b8[_0xb4b2('0x41')](_0x1207b8['zendeskAccounts'][_0x256513['id']],_0x256513);}}}return _0x1207b8[_0xb4b2('0x47')];};};Realtime['prototype'][_0xb4b2('0x48')]=function(){var _0x428faa=this;return function(_0x40be15){if(_0x40be15){freeIsNotKey(_0x40be15,_0x428faa[_0xb4b2('0x1f')],'id');for(var _0x1be483=0x0,_0x3c1277={},_0x5d840d={};_0x1be483<_0x40be15[_0xb4b2('0x3f')];_0x1be483+=0x1){_0x3c1277=_0x40be15[_0x1be483];if(_[_0xb4b2('0x40')](_0x428faa[_0xb4b2('0x1f')][_0x3c1277['id']])){_0x428faa[_0xb4b2('0x1f')][_0x3c1277['id']]=new SalesforceAccount(_0x3c1277);}else{_0x428faa[_0xb4b2('0x41')](_0x428faa[_0xb4b2('0x1f')][_0x3c1277['id']],_0x3c1277);}}}return _0x428faa['salesforceAccounts'];};};Realtime[_0xb4b2('0x3d')][_0xb4b2('0x49')]=function(){var _0x523900=this;return function(_0x505cd4){if(_0x505cd4){freeIsNotKey(_0x505cd4,_0x523900[_0xb4b2('0x21')],'id');for(var _0x10e072=0x0,_0x5fb9bd={},_0xf13a31={};_0x10e072<_0x505cd4[_0xb4b2('0x3f')];_0x10e072+=0x1){_0x5fb9bd=_0x505cd4[_0x10e072];if(_[_0xb4b2('0x40')](_0x523900['freshdeskAccounts'][_0x5fb9bd['id']])){_0x523900[_0xb4b2('0x21')][_0x5fb9bd['id']]=new FreshdeskAccount(_0x5fb9bd);}else{_0x523900[_0xb4b2('0x41')](_0x523900[_0xb4b2('0x21')][_0x5fb9bd['id']],_0x5fb9bd);}}}return _0x523900[_0xb4b2('0x21')];};};Realtime['prototype']['initZohoAccounts']=function(){var _0x4848a9=this;return function(_0x352ddb){if(_0x352ddb){freeIsNotKey(_0x352ddb,_0x4848a9[_0xb4b2('0x22')],'id');for(var _0x4f0daa=0x0,_0x15050d={},_0x43ebab={};_0x4f0daa<_0x352ddb[_0xb4b2('0x3f')];_0x4f0daa+=0x1){_0x15050d=_0x352ddb[_0x4f0daa];if(_[_0xb4b2('0x40')](_0x4848a9['zohoAccounts'][_0x15050d['id']])){_0x4848a9[_0xb4b2('0x22')][_0x15050d['id']]=new ZohoAccount(_0x15050d);}else{_0x4848a9[_0xb4b2('0x41')](_0x4848a9[_0xb4b2('0x22')][_0x15050d['id']],_0x15050d);}}}return _0x4848a9[_0xb4b2('0x22')];};};Realtime[_0xb4b2('0x3d')][_0xb4b2('0x4a')]=function(){var _0x42b5ef=this;return function(_0x481be3){if(_0x481be3){freeIsNotKey(_0x481be3,_0x42b5ef[_0xb4b2('0x23')],'id');for(var _0x52b636=0x0,_0x16dafa={},_0x1d25c8={};_0x52b636<_0x481be3['length'];_0x52b636+=0x1){_0x16dafa=_0x481be3[_0x52b636];if(_[_0xb4b2('0x40')](_0x42b5ef[_0xb4b2('0x23')][_0x16dafa['id']])){_0x42b5ef[_0xb4b2('0x23')][_0x16dafa['id']]=new DeskAccount(_0x16dafa);}else{_0x42b5ef[_0xb4b2('0x41')](_0x42b5ef['deskAccounts'][_0x16dafa['id']],_0x16dafa);}}}return _0x42b5ef['deskAccounts'];};};Realtime['prototype'][_0xb4b2('0x4b')]=function(){var _0x34513f=this;return function(_0x39490a){if(_0x39490a){freeIsNotKey(_0x39490a,_0x34513f[_0xb4b2('0x20')],'id');for(var _0x4608eb=0x0,_0x2c9520={},_0x560f74={};_0x4608eb<_0x39490a[_0xb4b2('0x3f')];_0x4608eb+=0x1){_0x2c9520=_0x39490a[_0x4608eb];if(_[_0xb4b2('0x40')](_0x34513f[_0xb4b2('0x20')][_0x2c9520['id']])){_0x34513f[_0xb4b2('0x20')][_0x2c9520['id']]=new SugarcrmAccount(_0x2c9520);}else{_0x34513f['mergeFromDatabase'](_0x34513f[_0xb4b2('0x20')][_0x2c9520['id']],_0x2c9520);}}}return _0x34513f['sugarcrmAccounts'];};};Realtime[_0xb4b2('0x3d')]['initVtigerAccounts']=function(){var _0x121da4=this;return function(_0x27036c){if(_0x27036c){freeIsNotKey(_0x27036c,_0x121da4[_0xb4b2('0x24')],'id');for(var _0x3c575c=0x0,_0x4b2fb8={},_0x4e6fb6={};_0x3c575c<_0x27036c[_0xb4b2('0x3f')];_0x3c575c+=0x1){_0x4b2fb8=_0x27036c[_0x3c575c];if(_['isUndefined'](_0x121da4[_0xb4b2('0x24')][_0x4b2fb8['id']])){_0x121da4[_0xb4b2('0x24')][_0x4b2fb8['id']]=new VtigerAccount(_0x4b2fb8);}else{_0x121da4[_0xb4b2('0x41')](_0x121da4[_0xb4b2('0x24')][_0x4b2fb8['id']],_0x4b2fb8);}}}return _0x121da4[_0xb4b2('0x24')];};};Realtime['prototype'][_0xb4b2('0x4c')]=function(){var _0x5c2405=this;return function(_0x36c19a){if(_0x36c19a){freeIsNotKey(_0x36c19a,_0x5c2405['servicenowAccounts'],'id');for(var _0xaec5ab=0x0,_0x284d8b={},_0x139196={};_0xaec5ab<_0x36c19a[_0xb4b2('0x3f')];_0xaec5ab+=0x1){_0x284d8b=_0x36c19a[_0xaec5ab];if(_[_0xb4b2('0x40')](_0x5c2405['servicenowAccounts'][_0x284d8b['id']])){_0x5c2405[_0xb4b2('0x25')][_0x284d8b['id']]=new ServicenowAccount(_0x284d8b);}else{_0x5c2405[_0xb4b2('0x41')](_0x5c2405[_0xb4b2('0x25')][_0x284d8b['id']],_0x284d8b);}}}return _0x5c2405['servicenowAccounts'];};};Realtime['prototype'][_0xb4b2('0x4d')]=function(){var _0x1c68e2=this;return function(_0xe541aa){if(_0xe541aa){freeIsNotKey(_0xe541aa,_0x1c68e2['dynamics365Accounts'],'id');for(var _0x174207=0x0,_0xce0e52={},_0x141e36={};_0x174207<_0xe541aa[_0xb4b2('0x3f')];_0x174207+=0x1){_0xce0e52=_0xe541aa[_0x174207];if(_[_0xb4b2('0x40')](_0x1c68e2[_0xb4b2('0x26')][_0xce0e52['id']])){_0x1c68e2[_0xb4b2('0x26')][_0xce0e52['id']]=new Dynamics365Account(_0xce0e52);}else{_0x1c68e2[_0xb4b2('0x41')](_0x1c68e2[_0xb4b2('0x26')][_0xce0e52['id']],_0xce0e52);}}}return _0x1c68e2['dynamics365Accounts'];};};Realtime['prototype'][_0xb4b2('0x4e')]=function(){var _0x3793b4=this;return function(_0x3831c7){if(_0x3831c7){freeIsNotKey(_0x3831c7,_0x3793b4[_0xb4b2('0x4f')],'id');for(var _0x288439=0x0,_0x53a918={},_0x49acc9={};_0x288439<_0x3831c7[_0xb4b2('0x3f')];_0x288439+=0x1){_0x53a918=_0x3831c7[_0x288439];if(_[_0xb4b2('0x40')](_0x3793b4['freshsalesAccounts'][_0x53a918['id']])){_0x3793b4[_0xb4b2('0x4f')][_0x53a918['id']]=new FreshsalesAccount(_0x53a918);}else{_0x3793b4[_0xb4b2('0x41')](_0x3793b4[_0xb4b2('0x4f')][_0x53a918['id']],_0x53a918);}}}return _0x3793b4['freshsalesAccounts'];};};Realtime[_0xb4b2('0x3d')]['initVoiceQueueHopperHistory']=function(){var _0x2bc527=this;return function(_0x33dafe){for(var _0x21b4d5=0x0;_0x21b4d5<_0x33dafe[_0xb4b2('0x3f')];_0x21b4d5+=0x1){_['merge'](_0x2bc527[_0xb4b2('0x15')][_0x33dafe[_0x21b4d5][_0xb4b2('0x2b')]],_0x33dafe[_0x21b4d5]);}return _0x2bc527['voiceQueues'];};};Realtime[_0xb4b2('0x3d')][_0xb4b2('0x50')]=function(){var _0x476e2b=this;return function(_0x380112){clearVoiceQueues(_0x476e2b[_0xb4b2('0x15')]);if(_0x380112){_0x380112=_[_0xb4b2('0x51')](_0x380112,_0xb4b2('0x52'));for(var _0x23ebf1 in _0x380112){if(_0x380112[_0xb4b2('0x28')](_0x23ebf1)){var _0x124946={};for(var _0x1307de=0x0;_0x1307de<_0x380112[_0x23ebf1][_0xb4b2('0x3f')];_0x1307de+=0x1){var _0xe924e8=_0x380112[_0x23ebf1][_0x1307de][_0xb4b2('0x53')];if(_0x476e2b[_0xb4b2('0x15')][_0xe924e8]){if(_0x380112[_0x23ebf1][_0x1307de][_0xb4b2('0x54')]){_0x476e2b[_0xb4b2('0x15')][_0xe924e8]['unmanaged']+=0x1;}if(_0x380112[_0x23ebf1][_0x1307de][_0xb4b2('0x55')]){_0x476e2b[_0xb4b2('0x15')][_0xe924e8][_0xb4b2('0x33')]+=0x1;}_0x476e2b['voiceQueues'][_0xe924e8][_0xb4b2('0x2f')]+=moment(_0x380112[_0x23ebf1][_0x1307de][_0xb4b2('0x56')])['diff'](moment(_0x380112[_0x23ebf1][_0x1307de][_0xb4b2('0x57')]),_0xb4b2('0x58'))||0x0;if(_0x1307de===_0x380112[_0x23ebf1]['length']-0x1){_0x476e2b[_0xb4b2('0x15')][_0xe924e8][_0xb4b2('0x59')]+=moment(_0x380112[_0x23ebf1][_0x1307de][_0xb4b2('0x5a')]||_0x380112[_0x23ebf1][_0x1307de][_0xb4b2('0x5b')]||_0x380112[_0x23ebf1][_0x1307de]['queuecallerexitAt'])[_0xb4b2('0x5c')](moment(_0x380112[_0x23ebf1][_0x1307de]['queuecallerjoinAt']),_0xb4b2('0x58'))||0x0;_0x476e2b[_0xb4b2('0x15')][_0xe924e8]['total']+=0x1;if(_0x380112[_0x23ebf1][_0x1307de][_0xb4b2('0x5d')]){_0x476e2b[_0xb4b2('0x15')][_0xe924e8][_0xb4b2('0x2e')]+=0x1;_0x476e2b[_0xb4b2('0x15')][_0xe924e8][_0xb4b2('0x30')]+=moment(_0x380112[_0x23ebf1][_0x1307de][_0xb4b2('0x5a')])[_0xb4b2('0x5c')](moment(_0x380112[_0x23ebf1][_0x1307de][_0xb4b2('0x56')]),_0xb4b2('0x58'))||0x0;}}else{_0x476e2b[_0xb4b2('0x15')][_0xe924e8]['sumDuration']+=_0x476e2b[_0xb4b2('0x15')][_0xe924e8]['sumHoldTime']||0x0;}}}}}}return _0x476e2b[_0xb4b2('0x15')];};};Realtime[_0xb4b2('0x3d')]['initVoiceCallReports']=function(){var _0x56b0db=this;return function(_0x1451f7){clearVoiceCallReports(_0x56b0db[_0xb4b2('0x19')]);if(_0x1451f7){for(var _0x59d9eb=0x0;_0x59d9eb<_0x1451f7[_0xb4b2('0x3f')];_0x59d9eb+=0x1){_0x56b0db[_0xb4b2('0x19')]['total']+=0x1;_0x56b0db[_0xb4b2('0x19')][_0xb4b2('0x59')]+=_0x1451f7[_0x59d9eb][_0xb4b2('0x5e')];if(_0x1451f7[_0x59d9eb][_0xb4b2('0x5f')]==='ANSWERED'){_0x56b0db[_0xb4b2('0x19')][_0xb4b2('0x2e')]+=0x1;_0x56b0db[_0xb4b2('0x19')][_0xb4b2('0x2f')]+=_0x1451f7[_0x59d9eb][_0xb4b2('0x5e')]-_0x1451f7[_0x59d9eb][_0xb4b2('0x60')]||0x0;_0x56b0db[_0xb4b2('0x19')]['sumBillable']+=_0x1451f7[_0x59d9eb]['billableseconds'];}}}return _0x56b0db[_0xb4b2('0x19')];};};Realtime[_0xb4b2('0x3d')][_0xb4b2('0x61')]=function(){var _0x4db5a0=this;return function(_0x470298){if(_0x470298){freeIsNotKey(_0x470298,_0x4db5a0[_0xb4b2('0x17')],_0xb4b2('0x2b'));for(var _0x2808f7=0x0,_0x480a22={};_0x2808f7<_0x470298['length'];_0x2808f7+=0x1){_0x480a22=_0x470298[_0x2808f7];if(_[_0xb4b2('0x40')](_0x4db5a0['campaigns'][_0x480a22[_0xb4b2('0x2b')]])){_0x4db5a0[_0xb4b2('0x17')][_0x480a22[_0xb4b2('0x2b')]]=new Campaign(_0x480a22);}else{_0x4db5a0['mergeFromDatabase'](_0x4db5a0['campaigns'][_0x480a22['name']],_0x480a22);_0x4db5a0[_0xb4b2('0x17')][_0x480a22[_0xb4b2('0x2b')]][_0xb4b2('0x62')]=_0x480a22['SquareProject']?_0x480a22[_0xb4b2('0x63')][_0xb4b2('0x2b')]:undefined;}}}return _0x4db5a0['campaigns'];};};Realtime[_0xb4b2('0x3d')]['initVoiceExtensions']=function(){var _0x4bbbcb=this;return function(_0xb50246){if(_0xb50246){freeIsNotKey(_0xb50246,_0x4bbbcb[_0xb4b2('0x1a')],'id');for(var _0x30cd7f=0x0,_0x343422={};_0x30cd7f<_0xb50246[_0xb4b2('0x3f')];_0x30cd7f+=0x1){_0x343422=_0xb50246[_0x30cd7f];if(_['isUndefined'](_0x4bbbcb['voiceExtensions'][_0x343422['id']])){_0x4bbbcb[_0xb4b2('0x1a')][_0x343422['id']]=new VoiceExtension(_0x343422);}else{_0x4bbbcb[_0xb4b2('0x41')](_0x4bbbcb['voiceExtensions'][_0x343422['id']],_0x343422);}}}return _0x4bbbcb[_0xb4b2('0x1a')];};};Realtime[_0xb4b2('0x3d')][_0xb4b2('0x64')]=function(){var _0x3c1726=this;return function(_0xda030){clearCampaigns(_0x3c1726['campaigns']);for(var _0x19b027=0x0;_0x19b027<_0xda030[_0xb4b2('0x3f')];_0x19b027+=0x1){_['merge'](_0x3c1726[_0xb4b2('0x17')][_0xda030[_0x19b027][_0xb4b2('0x2b')]],_0xda030[_0x19b027]);}return _0x3c1726[_0xb4b2('0x17')];};};Realtime[_0xb4b2('0x3d')][_0xb4b2('0x65')]=function(){var _0x125f6a=this;return function(_0x4200ed){if(_0x4200ed){freeIsNotKey(_0x4200ed,_0x125f6a[_0xb4b2('0x66')],'id');for(var _0xad0348=0x0,_0x21045f={},_0x13c411={};_0xad0348<_0x4200ed[_0xb4b2('0x3f')];_0xad0348+=0x1){_0x21045f=_0x4200ed[_0xad0348];if(_['isUndefined'](_0x125f6a[_0xb4b2('0x66')][_0x21045f['id']])){_0x125f6a['faxAccounts'][_0x21045f['id']]=new FaxAccount(_0x21045f);}else{_0x125f6a[_0xb4b2('0x41')](_0x125f6a[_0xb4b2('0x66')][_0x21045f['id']],_0x21045f);}}}return _0x125f6a['faxAccounts'];};};module[_0xb4b2('0x67')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 7a3bac0..1aa8f69 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 _0x6149=['../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','accountcode','name','isNil','find','interface','SIP/%s','length','findAgent','assigned','lastAssignedTo','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','match','destination','exten','type','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','destinationchannel','channel','calleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitors','monitorFilename','filename','createdAt','connectedlinenum','membername','originatecalleridnum','isArray','forEach','create','startsWith','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','attendedTransfer','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording'];(function(_0x5c6210,_0x1310b7){var _0xe4c7a1=function(_0x1fa4c9){while(--_0x1fa4c9){_0x5c6210['push'](_0x5c6210['shift']());}};_0xe4c7a1(++_0x1310b7);}(_0x6149,0xaa));var _0x9614=function(_0x4be41a,_0x508e34){_0x4be41a=_0x4be41a-0x0;var _0x31e5c6=_0x6149[_0x4be41a];return _0x31e5c6;};'use strict';var _=require(_0x9614('0x0'));var moment=require(_0x9614('0x1'));var util=require(_0x9614('0x2'));var config=require(_0x9614('0x3'));var ami=require(_0x9614('0x4'));var RpcVoiceAgentReport=require(_0x9614('0x5'));var RpcVoiceCallReport=require(_0x9614('0x6'));var RpcVoiceDialReport=require(_0x9614('0x7'));var RpcMemberReport=require(_0x9614('0x8'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x9614('0x9'));var RpcVoiceTransferReport=require(_0x9614('0xa'));var VoiceQueueReport=require(_0x9614('0xb'));var VoiceCallReport=require(_0x9614('0xc'));var VoiceAgentReport=require(_0x9614('0xd'));var VoiceDialReport=require(_0x9614('0xe'));var UserReport=require(_0x9614('0xf'));function Report(_0x487720){this['realtime']=_0x487720;this[_0x9614('0x10')]=_0x487720[_0x9614('0x10')];this['telephones']=_0x487720[_0x9614('0x11')];}Report[_0x9614('0x12')][_0x9614('0x13')]=function(_0x4475f8){var _0x28d28a=new VoiceQueueReport(this[_0x9614('0x14')]);var _0x5869e9=new VoiceAgentReport(this['realtime']);var _0x1f9d27=new VoiceDialReport(this[_0x9614('0x14')]);var _0x4a0989=new VoiceCallReport(this[_0x9614('0x14')]);var _0x50d871=new UserReport(this[_0x9614('0x14')]);if(config[_0x9614('0x15')]&&config[_0x9614('0x15')][_0x9614('0x16')]){ami['on'](_0x9614('0x17'),this[_0x9614('0x18')]['bind'](this));ami['on'](_0x9614('0x19'),this[_0x9614('0x1a')][_0x9614('0x1b')](this));ami['on'](_0x9614('0x1c'),this[_0x9614('0x1d')]['bind'](this));ami['on']('custom:voiceDialReport',this[_0x9614('0x1e')][_0x9614('0x1b')](this));ami['on'](_0x9614('0x1f'),this[_0x9614('0x20')][_0x9614('0x1b')](this));ami['on'](_0x9614('0x21'),this['attendedTransfer']['bind'](this));}};Report[_0x9614('0x12')]['findAgent']=function(_0x554bf1){var _0x57b956;_0x57b956=_['find'](this[_0x9614('0x10')],function(_0x35d765){return _0x35d765[_0x9614('0x22')]==_0x554bf1||_0x35d765[_0x9614('0x23')]==_0x554bf1;});if(_[_0x9614('0x24')](_0x57b956)){var _0x1f7a0f=_[_0x9614('0x25')](this['telephones'],function(_0x95e90){return _0x95e90[_0x9614('0x22')]==_0x554bf1||_0x95e90['name']==_0x554bf1;});if(_0x1f7a0f){_0x57b956=_['find'](this[_0x9614('0x10')],function(_0x3a6c19){return _0x3a6c19[_0x9614('0x26')]==util['format'](_0x9614('0x27'),_0x1f7a0f[_0x9614('0x23')]);});}}return _0x57b956;};Report['prototype'][_0x9614('0x18')]=function(_0x5e807a){for(var _0x5464ce=0x0;_0x5464ce<_0x5e807a[_0x9614('0x28')];_0x5464ce+=0x1){var _0x4b1d2e=this[_0x9614('0x29')](_0x5e807a[_0x5464ce]['connectedlinenum']);if(_0x4b1d2e){_0x5e807a[_0x5464ce][_0x9614('0x22')]=_0x4b1d2e[_0x9614('0x22')];_0x5e807a[_0x5464ce][_0x9614('0x2a')]=!![];_0x5e807a[_0x5464ce][_0x9614('0x2b')]=_0x4b1d2e[_0x9614('0x23')];_0x5e807a[_0x5464ce]['interface']=_[_0x9614('0x24')](_0x4b1d2e[_0x9614('0x26')])?util[_0x9614('0x2c')](_0x9614('0x27'),_0x4b1d2e[_0x9614('0x23')]):_0x4b1d2e['interface'];if(_0x5e807a[_0x5464ce][_0x9614('0x2d')]){_0x5e807a[_0x5464ce][_0x9614('0x2e')]=moment()[_0x9614('0x2c')](_0x9614('0x2f'));}if(_0x5e807a[_0x5464ce]['queuecallerexit']){_0x5e807a[_0x5464ce][_0x9614('0x30')]=moment()[_0x9614('0x2c')](_0x9614('0x2f'));}RpcMemberReport[_0x9614('0x18')](_0x5e807a[_0x5464ce]);}RpcVoiceQueueReport['create'](_0x5e807a[_0x5464ce]);}};function extractCalleridNumber(_0x2b7886){var _0x591b2d=_0x2b7886[_0x9614('0x31')](/<(.*?)>/);return _0x591b2d?_0x591b2d[0x1]:_0x2b7886;}Report[_0x9614('0x12')][_0x9614('0x1a')]=function(_0x4bafc2){_0x4bafc2['destination']=_0x4bafc2[_0x9614('0x32')]||_0x4bafc2[_0x9614('0x33')];if(_0x4bafc2[_0x9614('0x34')]=='dialer'){_0x4bafc2['lastapplication']=_0x9614('0x35');_0x4bafc2['lastdata']=_0x4bafc2[_0x9614('0x35')];if(_0x4bafc2[_0x9614('0x36')]==_0x9614('0x37')){_0x4bafc2[_0x9614('0x22')]='';_0x4bafc2[_0x9614('0x32')]=extractCalleridNumber(_0x4bafc2[_0x9614('0x38')]);}else if(_0x4bafc2['context']==_0x9614('0x39')){if(_0x4bafc2[_0x9614('0x32')]==_0x9614('0x3a')){_0x4bafc2[_0x9614('0x32')]=extractCalleridNumber(_0x4bafc2[_0x9614('0x3b')]);_0x4bafc2['calleridnum']=_0x4bafc2['originatecalleridnum'];_0x4bafc2[_0x9614('0x3c')]=[_0x4bafc2['channel'],_0x4bafc2[_0x9614('0x3d')]=_0x4bafc2[_0x9614('0x3c')]][0x0];_0x4bafc2[_0x9614('0x38')]=_0x4bafc2[_0x9614('0x3b')];}else{_0x4bafc2[_0x9614('0x32')]=_0x4bafc2['calleridnum'];_0x4bafc2[_0x9614('0x3e')]=_0x4bafc2['originatecalleridnum'];if(_0x4bafc2[_0x9614('0x3f')]==_0x9614('0x40')){_0x4bafc2[_0x9614('0x22')]=_0x4bafc2['connectedlinenum'];}else{_0x4bafc2[_0x9614('0x22')]='';}}}}else{_0x4bafc2[_0x9614('0x38')]=util[_0x9614('0x2c')](_0x9614('0x41'),_0x4bafc2[_0x9614('0x42')],_0x4bafc2[_0x9614('0x3e')]);}if(RpcVoiceTransferReport[_0x9614('0x43')][_0x4bafc2[_0x9614('0x44')]]){var _0x5db2db=RpcVoiceTransferReport[_0x9614('0x43')][_0x4bafc2[_0x9614('0x44')]];_0x5db2db[_0x9614('0x45')]=_0x4bafc2[_0x9614('0x46')];RpcVoiceTransferReport[_0x9614('0x20')](_0x5db2db);delete RpcVoiceTransferReport[_0x9614('0x43')][_0x4bafc2[_0x9614('0x44')]];}RpcVoiceCallReport['create'](_0x4bafc2);if(_0x4bafc2[_0x9614('0x47')]){for(var _0x519f64=0x0;_0x519f64<_0x4bafc2[_0x9614('0x48')]['length'];_0x519f64+=0x1){_0x4bafc2[_0x9614('0x49')]=_0x4bafc2[_0x9614('0x48')][_0x519f64][_0x9614('0x4a')];_0x4bafc2[_0x9614('0x4b')]=_0x4bafc2['monitors'][_0x519f64][_0x9614('0x4b')];if(_0x4bafc2[_0x9614('0x33')]==_0x9614('0x3a')){_0x4bafc2[_0x9614('0x3e')]=_0x4bafc2['connectedlinenum'];_0x4bafc2[_0x9614('0x42')]=_0x4bafc2['connectedlinename'];_0x4bafc2[_0x9614('0x4c')]=_0x4bafc2[_0x9614('0x22')];_0x4bafc2['connectedlinename']=_0x4bafc2[_0x9614('0x4d')];_0x4bafc2[_0x9614('0x33')]=_0x4bafc2[_0x9614('0x4e')];}else if(_0x4bafc2['exten']=='xcally-motion-dialer'){_0x4bafc2[_0x9614('0x3e')]=_0x4bafc2[_0x9614('0x32')];_0x4bafc2[_0x9614('0x33')]=_0x4bafc2['originatecalleridnum'];}RpcVoiceRecording['create'](_0x4bafc2);}}};Report[_0x9614('0x12')][_0x9614('0x1d')]=function(_0x59cc7d){if(_[_0x9614('0x4f')](_0x59cc7d)){_0x59cc7d[_0x9614('0x50')](function(_0x3dc5a5){RpcVoiceAgentReport[_0x9614('0x51')](_0x3dc5a5);});}else{RpcVoiceAgentReport['create'](_0x59cc7d);}};Report['prototype'][_0x9614('0x1e')]=function(_0x9e5b12){RpcVoiceDialReport[_0x9614('0x51')](_0x9e5b12);var _0x437c41;var _0x1b6cd3;var _0x54a243=_0x9e5b12[_0x9614('0x3d')];if(_[_0x9614('0x52')](_0x54a243,'Local')){_0x1b6cd3=_0x54a243['substring'](_0x54a243[_0x9614('0x53')]('/')+0x1,_0x54a243[_0x9614('0x53')]('@'));_0x437c41=_[_0x9614('0x25')](this[_0x9614('0x10')],function(_0x41d9fb){return _0x41d9fb[_0x9614('0x54')]==_0x1b6cd3||_0x41d9fb[_0x9614('0x55')]==_0x1b6cd3||_0x41d9fb['accountcode']==_0x1b6cd3;});}else{_0x1b6cd3=_0x54a243['substring'](_0x54a243[_0x9614('0x53')]('/')+0x1,_0x54a243[_0x9614('0x56')]('-'));_0x437c41=this['findAgent'](_0x1b6cd3);}if(_0x437c41){_0x9e5b12[_0x9614('0x26')]=_['isNil'](_0x437c41[_0x9614('0x26')])?util[_0x9614('0x2c')](_0x9614('0x27'),_0x437c41[_0x9614('0x23')]):_0x437c41['interface'];_0x9e5b12[_0x9614('0x4d')]=_0x437c41[_0x9614('0x23')];_0x9e5b12[_0x9614('0x22')]=_0x437c41[_0x9614('0x22')];RpcMemberReport['voiceDialReport'](_0x9e5b12);}};Report[_0x9614('0x12')][_0x9614('0x20')]=function(_0x5bd5d9){RpcVoiceTransferReport['transfers'][_0x5bd5d9[_0x9614('0x57')]]=_0x5bd5d9;};Report[_0x9614('0x12')][_0x9614('0x58')]=function(_0x28795e){RpcVoiceTransferReport[_0x9614('0x58')](_0x28795e);};module[_0x9614('0x59')]=Report; \ No newline at end of file +var _0x2f7e=['name','find','accountcode','format','SIP/%s','connectedlinenum','assigned','lastAssignedTo','interface','isNil','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','destination','exten','lastapplication','lastdata','from-voip-provider','callerid','context','from-sip','originatecalleridnum','channel','destinationchannel','calleridpreview','calleridnum','disposition','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','monitors','monitorFilename','filename','createdAt','xcally-motion-preview','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','attendedtransfer','attendedTransfer','findAgent'];(function(_0x580ee5,_0x20d165){var _0xb2fb20=function(_0x2f8ae7){while(--_0x2f8ae7){_0x580ee5['push'](_0x580ee5['shift']());}};_0xb2fb20(++_0x20d165);}(_0x2f7e,0x89));var _0xe2f7=function(_0x4cd134,_0x3dc281){_0x4cd134=_0x4cd134-0x0;var _0x3e6fd1=_0x2f7e[_0x4cd134];return _0x3e6fd1;};'use strict';var _=require(_0xe2f7('0x0'));var moment=require(_0xe2f7('0x1'));var util=require(_0xe2f7('0x2'));var config=require(_0xe2f7('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xe2f7('0x4'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xe2f7('0x5'));var RpcVoiceRecording=require(_0xe2f7('0x6'));var RpcVoiceTransferReport=require(_0xe2f7('0x7'));var VoiceQueueReport=require(_0xe2f7('0x8'));var VoiceCallReport=require(_0xe2f7('0x9'));var VoiceAgentReport=require(_0xe2f7('0xa'));var VoiceDialReport=require(_0xe2f7('0xb'));var UserReport=require(_0xe2f7('0xc'));function Report(_0x30f559){this[_0xe2f7('0xd')]=_0x30f559;this[_0xe2f7('0xe')]=_0x30f559[_0xe2f7('0xe')];this[_0xe2f7('0xf')]=_0x30f559[_0xe2f7('0xf')];}Report[_0xe2f7('0x10')][_0xe2f7('0x11')]=function(_0x2b3fa2){var _0x2c915e=new VoiceQueueReport(this[_0xe2f7('0xd')]);var _0x13f85e=new VoiceAgentReport(this[_0xe2f7('0xd')]);var _0x2eef41=new VoiceDialReport(this[_0xe2f7('0xd')]);var _0xb5c37a=new VoiceCallReport(this[_0xe2f7('0xd')]);var _0x1819b1=new UserReport(this[_0xe2f7('0xd')]);if(config[_0xe2f7('0x12')]&&config['xdr'][_0xe2f7('0x13')]){ami['on']('custom:voiceQueueReport',this[_0xe2f7('0x14')][_0xe2f7('0x15')](this));ami['on'](_0xe2f7('0x16'),this[_0xe2f7('0x17')]['bind'](this));ami['on'](_0xe2f7('0x18'),this[_0xe2f7('0x19')][_0xe2f7('0x15')](this));ami['on'](_0xe2f7('0x1a'),this[_0xe2f7('0x1b')][_0xe2f7('0x15')](this));ami['on']('blindtransfer',this['blindTransfer']['bind'](this));ami['on'](_0xe2f7('0x1c'),this[_0xe2f7('0x1d')][_0xe2f7('0x15')](this));}};Report[_0xe2f7('0x10')][_0xe2f7('0x1e')]=function(_0x3c7420){var _0x4c1d0a;_0x4c1d0a=_['find'](this['agents'],function(_0x28ce43){return _0x28ce43['accountcode']==_0x3c7420||_0x28ce43[_0xe2f7('0x1f')]==_0x3c7420;});if(_['isNil'](_0x4c1d0a)){var _0x268630=_[_0xe2f7('0x20')](this[_0xe2f7('0xf')],function(_0x73eae8){return _0x73eae8[_0xe2f7('0x21')]==_0x3c7420||_0x73eae8['name']==_0x3c7420;});if(_0x268630){_0x4c1d0a=_['find'](this['agents'],function(_0x45b189){return _0x45b189['interface']==util[_0xe2f7('0x22')](_0xe2f7('0x23'),_0x268630[_0xe2f7('0x1f')]);});}}return _0x4c1d0a;};Report[_0xe2f7('0x10')][_0xe2f7('0x14')]=function(_0x18b8b2){for(var _0x2928ca=0x0;_0x2928ca<_0x18b8b2['length'];_0x2928ca+=0x1){var _0x423949=this[_0xe2f7('0x1e')](_0x18b8b2[_0x2928ca][_0xe2f7('0x24')]);if(_0x423949){_0x18b8b2[_0x2928ca][_0xe2f7('0x21')]=_0x423949[_0xe2f7('0x21')];_0x18b8b2[_0x2928ca][_0xe2f7('0x25')]=!![];_0x18b8b2[_0x2928ca][_0xe2f7('0x26')]=_0x423949['name'];_0x18b8b2[_0x2928ca][_0xe2f7('0x27')]=_[_0xe2f7('0x28')](_0x423949[_0xe2f7('0x27')])?util['format'](_0xe2f7('0x23'),_0x423949['name']):_0x423949[_0xe2f7('0x27')];if(_0x18b8b2[_0x2928ca][_0xe2f7('0x29')]){_0x18b8b2[_0x2928ca]['queuecallercompleteAt']=moment()[_0xe2f7('0x22')](_0xe2f7('0x2a'));}if(_0x18b8b2[_0x2928ca][_0xe2f7('0x2b')]){_0x18b8b2[_0x2928ca]['queuecallerexitAt']=moment()[_0xe2f7('0x22')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xe2f7('0x14')](_0x18b8b2[_0x2928ca]);}RpcVoiceQueueReport[_0xe2f7('0x2c')](_0x18b8b2[_0x2928ca]);}};function extractCalleridNumber(_0x17ac37){var _0x38871c=_0x17ac37['match'](/<(.*?)>/);return _0x38871c?_0x38871c[0x1]:_0x17ac37;}Report['prototype']['voiceCallReport']=function(_0x372a46){_0x372a46[_0xe2f7('0x2d')]=_0x372a46[_0xe2f7('0x2d')]||_0x372a46[_0xe2f7('0x2e')];if(_0x372a46['type']=='dialer'){_0x372a46[_0xe2f7('0x2f')]='queue';_0x372a46[_0xe2f7('0x30')]=_0x372a46['queue'];if(_0x372a46['context']==_0xe2f7('0x31')){_0x372a46[_0xe2f7('0x21')]='';_0x372a46['destination']=extractCalleridNumber(_0x372a46[_0xe2f7('0x32')]);}else if(_0x372a46[_0xe2f7('0x33')]==_0xe2f7('0x34')){if(_0x372a46[_0xe2f7('0x2d')]=='xcally-motion-preview'){_0x372a46['destination']=extractCalleridNumber(_0x372a46['calleridpreview']);_0x372a46['calleridnum']=_0x372a46[_0xe2f7('0x35')];_0x372a46['destinationchannel']=[_0x372a46[_0xe2f7('0x36')],_0x372a46[_0xe2f7('0x36')]=_0x372a46[_0xe2f7('0x37')]][0x0];_0x372a46[_0xe2f7('0x32')]=_0x372a46[_0xe2f7('0x38')];}else{_0x372a46[_0xe2f7('0x2d')]=_0x372a46['calleridnum'];_0x372a46[_0xe2f7('0x39')]=_0x372a46['originatecalleridnum'];if(_0x372a46[_0xe2f7('0x3a')]=='ANSWERED'){_0x372a46[_0xe2f7('0x21')]=_0x372a46[_0xe2f7('0x24')];}else{_0x372a46['accountcode']='';}}}}else{_0x372a46['callerid']=util['format'](_0xe2f7('0x3b'),_0x372a46[_0xe2f7('0x3c')],_0x372a46[_0xe2f7('0x39')]);}if(RpcVoiceTransferReport[_0xe2f7('0x3d')][_0x372a46[_0xe2f7('0x3e')]]){var _0x58db72=RpcVoiceTransferReport[_0xe2f7('0x3d')][_0x372a46['linkedid']];_0x58db72[_0xe2f7('0x3f')]=_0x372a46[_0xe2f7('0x40')];RpcVoiceTransferReport[_0xe2f7('0x41')](_0x58db72);delete RpcVoiceTransferReport[_0xe2f7('0x3d')][_0x372a46[_0xe2f7('0x3e')]];}RpcVoiceCallReport['create'](_0x372a46);if(_0x372a46['monitor']){for(var _0x583374=0x0;_0x583374<_0x372a46[_0xe2f7('0x42')]['length'];_0x583374+=0x1){_0x372a46[_0xe2f7('0x43')]=_0x372a46[_0xe2f7('0x42')][_0x583374][_0xe2f7('0x44')];_0x372a46[_0xe2f7('0x45')]=_0x372a46[_0xe2f7('0x42')][_0x583374][_0xe2f7('0x45')];if(_0x372a46[_0xe2f7('0x2e')]==_0xe2f7('0x46')){_0x372a46[_0xe2f7('0x39')]=_0x372a46[_0xe2f7('0x24')];_0x372a46['calleridname']=_0x372a46[_0xe2f7('0x47')];_0x372a46['connectedlinenum']=_0x372a46[_0xe2f7('0x21')];_0x372a46[_0xe2f7('0x47')]=_0x372a46[_0xe2f7('0x48')];_0x372a46[_0xe2f7('0x2e')]=_0x372a46['originatecalleridnum'];}else if(_0x372a46[_0xe2f7('0x2e')]==_0xe2f7('0x49')){_0x372a46[_0xe2f7('0x39')]=_0x372a46[_0xe2f7('0x2d')];_0x372a46[_0xe2f7('0x2e')]=_0x372a46[_0xe2f7('0x35')];}RpcVoiceRecording[_0xe2f7('0x2c')](_0x372a46);}}};Report[_0xe2f7('0x10')][_0xe2f7('0x19')]=function(_0x2ca97d){if(_[_0xe2f7('0x4a')](_0x2ca97d)){_0x2ca97d[_0xe2f7('0x4b')](function(_0x5a5e13){RpcVoiceAgentReport[_0xe2f7('0x2c')](_0x5a5e13);});}else{RpcVoiceAgentReport[_0xe2f7('0x2c')](_0x2ca97d);}};Report[_0xe2f7('0x10')][_0xe2f7('0x1b')]=function(_0x2016e8){RpcVoiceDialReport['create'](_0x2016e8);var _0x14cb18;var _0x40b777;var _0x2a39fd=_0x2016e8['channel'];if(_[_0xe2f7('0x4c')](_0x2a39fd,_0xe2f7('0x4d'))){_0x40b777=_0x2a39fd[_0xe2f7('0x4e')](_0x2a39fd[_0xe2f7('0x4f')]('/')+0x1,_0x2a39fd['indexOf']('@'));_0x14cb18=_[_0xe2f7('0x20')](this['agents'],function(_0x40858a){return _0x40858a[_0xe2f7('0x50')]==_0x40b777||_0x40858a['phone']==_0x40b777||_0x40858a[_0xe2f7('0x21')]==_0x40b777;});}else{_0x40b777=_0x2a39fd[_0xe2f7('0x4e')](_0x2a39fd[_0xe2f7('0x4f')]('/')+0x1,_0x2a39fd[_0xe2f7('0x51')]('-'));_0x14cb18=this[_0xe2f7('0x1e')](_0x40b777);}if(_0x14cb18){_0x2016e8[_0xe2f7('0x27')]=_[_0xe2f7('0x28')](_0x14cb18[_0xe2f7('0x27')])?util[_0xe2f7('0x22')](_0xe2f7('0x23'),_0x14cb18[_0xe2f7('0x1f')]):_0x14cb18['interface'];_0x2016e8[_0xe2f7('0x48')]=_0x14cb18[_0xe2f7('0x1f')];_0x2016e8[_0xe2f7('0x21')]=_0x14cb18[_0xe2f7('0x21')];RpcMemberReport['voiceDialReport'](_0x2016e8);}};Report[_0xe2f7('0x10')][_0xe2f7('0x41')]=function(_0x5173a3){RpcVoiceTransferReport[_0xe2f7('0x3d')][_0x5173a3[_0xe2f7('0x52')]]=_0x5173a3;};Report[_0xe2f7('0x10')][_0xe2f7('0x1d')]=function(_0x2b7fe1){RpcVoiceTransferReport[_0xe2f7('0x1d')](_0x2b7fe1);};module[_0xe2f7('0x53')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 232a789..38deed8 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d4d=['trunk:save','[userReport][registry]','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','device','toLowerCase','inuse','local','stateTime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','trunk:%s','Local','substring','indexOf','mobile','phone','accountcode','updateStatusRealtime','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','address','[userReport][peerstatus]','peer','peerstatus','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','exports','moment','util','ioredis','bluebird','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','registry','syncDeviceState','syncPeerStatus','resolve','error','[userReport][sipshowregistry]','inspect','then','actionDeviceStateList','catch','[userReport][devicestatelist]','actionSipPeerStatus','syncRealtimeShow','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','debug','find','state','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','name'];(function(_0x176e75,_0x467896){var _0x339d31=function(_0x5a5b60){while(--_0x5a5b60){_0x176e75['push'](_0x176e75['shift']());}};_0x339d31(++_0x467896);}(_0x2d4d,0x14a));var _0xd2d4=function(_0x4fc583,_0x56e9b4){_0x4fc583=_0x4fc583-0x0;var _0x12082e=_0x2d4d[_0x4fc583];return _0x12082e;};'use strict';var _=require('lodash');var moment=require(_0xd2d4('0x0'));var util=require(_0xd2d4('0x1'));var Redis=require(_0xd2d4('0x2'));var BPromise=require(_0xd2d4('0x3'));var config=require(_0xd2d4('0x4'));var logger=require('../../../config/logger')(_0xd2d4('0x5'));var ami=require(_0xd2d4('0x6'));config[_0xd2d4('0x7')]=_[_0xd2d4('0x8')](config[_0xd2d4('0x7')],{'host':_0xd2d4('0x9'),'port':0x18eb});var io=require(_0xd2d4('0xa'))(new Redis(config['redis']));function UserReport(_0x1a760d){this['trunks']=_0x1a760d[_0xd2d4('0xb')];this[_0xd2d4('0xc')]=_0x1a760d[_0xd2d4('0xc')];this[_0xd2d4('0xd')]=_0x1a760d['telephones'];ami['on']('registryentry',this[_0xd2d4('0xe')][_0xd2d4('0xf')](this));ami['on'](_0xd2d4('0x10'),this[_0xd2d4('0xe')][_0xd2d4('0xf')](this));ami['on']('devicestatechange',this[_0xd2d4('0x11')][_0xd2d4('0xf')](this));ami['on']('peerstatus',this[_0xd2d4('0x12')]['bind'](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0xd2d4('0x13')]()['then'](ami['actionSipShowRegistry']())['catch'](function(_0x2a8f76){logger[_0xd2d4('0x14')](_0xd2d4('0x15'),util[_0xd2d4('0x16')](_0x2a8f76,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xd2d4('0x13')]()[_0xd2d4('0x17')](ami[_0xd2d4('0x18')]())[_0xd2d4('0x19')](function(_0x1bd2fa){logger[_0xd2d4('0x14')](_0xd2d4('0x1a'),util[_0xd2d4('0x16')](_0x1bd2fa,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xd2d4('0x13')]()[_0xd2d4('0x17')](ami[_0xd2d4('0x1b')]())[_0xd2d4('0x19')](function(_0x2b7ce1){logger[_0xd2d4('0x14')]('[userReport][sippeerstatus]',util['inspect'](_0x2b7ce1,{'showHidden':![],'depth':null}));});}UserReport['prototype'][_0xd2d4('0x1c')]=function(){setInterval(function(){BPromise[_0xd2d4('0x13')]()[_0xd2d4('0x17')](showSipRegistrations())[_0xd2d4('0x17')](listDeviceStates())[_0xd2d4('0x17')](showPeersStatus());},0x32c8);};UserReport[_0xd2d4('0x1d')][_0xd2d4('0x1e')]=function(_0x205358){return _0x205358!==null&&!_[_0xd2d4('0x1f')](_0x205358);};UserReport['prototype'][_0xd2d4('0x20')]=function(_0x18fdd8,_0x33de5f,_0x104f11){io['to'](_0x18fdd8)[_0xd2d4('0x20')](_0x33de5f,_0x104f11);};UserReport['prototype'][_0xd2d4('0xe')]=function(_0x3c7a51){try{if(this['isNotNull'](_0x3c7a51)){logger[_0xd2d4('0x21')](_0xd2d4('0x22'),_0x3c7a51[_0xd2d4('0x23')],_0x3c7a51['state']);logger[_0xd2d4('0x24')]('[userReport][registry]',util['inspect'](_0x3c7a51,{'showHidden':![],'depth':null}));var _0x3d2904=_[_0xd2d4('0x25')](this['trunks'],{'defaultuser':_0x3c7a51['username']});if(_0x3d2904){_0x3c7a51['stateRegistry']=_0x3c7a51[_0xd2d4('0x26')];_['merge'](_0x3d2904,_[_0xd2d4('0x27')](_0x3c7a51,[_0xd2d4('0x28'),_0xd2d4('0x29'),_0xd2d4('0x23'),'state']));logger[_0xd2d4('0x24')](_0xd2d4('0x2a'),util[_0xd2d4('0x16')](_0x3d2904,{'showHidden':![],'depth':null}));this[_0xd2d4('0x20')](util[_0xd2d4('0x2b')]('trunk:%s',_0x3d2904[_0xd2d4('0x2c')]),_0xd2d4('0x2d'),_0x3d2904);}}}catch(_0x1e48ce){logger[_0xd2d4('0x14')](_0xd2d4('0x2e'),util[_0xd2d4('0x16')](_0x1e48ce,{'showHidden':![],'depth':null}));}};UserReport[_0xd2d4('0x1d')][_0xd2d4('0x11')]=function(_0x3ad56e){try{if(this[_0xd2d4('0x1e')](_0x3ad56e)){logger[_0xd2d4('0x21')](_0xd2d4('0x2f'),_0x3ad56e['device'],_0x3ad56e['state']);logger[_0xd2d4('0x24')](_0xd2d4('0x30'),util[_0xd2d4('0x16')](_0x3ad56e,{'showHidden':![],'depth':null}));if(this['agents'][_0x3ad56e[_0xd2d4('0x31')]]){if(!this['agents'][_0x3ad56e[_0xd2d4('0x31')]]['local']||_0x3ad56e[_0xd2d4('0x26')][_0xd2d4('0x32')]()==_0xd2d4('0x33')){this['agents'][_0x3ad56e[_0xd2d4('0x31')]][_0xd2d4('0x34')]=![];if(this[_0xd2d4('0xc')][_0x3ad56e['device']]['state']!==_0x3ad56e['state'][_0xd2d4('0x32')]()){this['agents'][_0x3ad56e[_0xd2d4('0x31')]][_0xd2d4('0x35')]=_[_0xd2d4('0x36')](moment()[_0xd2d4('0x2b')]('x'));}this[_0xd2d4('0xc')][_0x3ad56e[_0xd2d4('0x31')]][_0xd2d4('0x26')]=_0x3ad56e[_0xd2d4('0x26')][_0xd2d4('0x32')]();this[_0xd2d4('0xc')][_0x3ad56e[_0xd2d4('0x31')]]['updateStatusRealtime'](_0x3ad56e);}}else if(this[_0xd2d4('0xd')][_0x3ad56e['device']]){if(this[_0xd2d4('0xd')][_0x3ad56e[_0xd2d4('0x31')]][_0xd2d4('0x26')]!==_0x3ad56e[_0xd2d4('0x26')]['toLowerCase']()){this['telephones'][_0x3ad56e['device']][_0xd2d4('0x35')]=_[_0xd2d4('0x36')](moment()[_0xd2d4('0x2b')]('x'));}this[_0xd2d4('0xd')][_0x3ad56e[_0xd2d4('0x31')]][_0xd2d4('0x26')]=_0x3ad56e['state'][_0xd2d4('0x32')]();logger['debug'](_0xd2d4('0x37'),util['inspect'](this[_0xd2d4('0xd')][_0x3ad56e[_0xd2d4('0x31')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xd2d4('0x2b')](_0xd2d4('0x38'),this[_0xd2d4('0xd')][_0x3ad56e['device']][_0xd2d4('0x2c')]),_0xd2d4('0x39'),this[_0xd2d4('0xd')][_0x3ad56e[_0xd2d4('0x31')]]);}else if(this['trunks'][_0x3ad56e[_0xd2d4('0x31')]]){if(this[_0xd2d4('0xb')][_0x3ad56e['device']]['state']!==_0x3ad56e['state'][_0xd2d4('0x32')]()){this[_0xd2d4('0xb')][_0x3ad56e[_0xd2d4('0x31')]][_0xd2d4('0x35')]=_[_0xd2d4('0x36')](moment()[_0xd2d4('0x2b')]('x'));}this[_0xd2d4('0xb')][_0x3ad56e['device']][_0xd2d4('0x26')]=_0x3ad56e['state'][_0xd2d4('0x32')]();logger[_0xd2d4('0x24')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0xd2d4('0x16')](this[_0xd2d4('0xb')][_0x3ad56e['device']],{'showHidden':![],'depth':null}));this[_0xd2d4('0x20')](util['format'](_0xd2d4('0x3a'),this[_0xd2d4('0xb')][_0x3ad56e['device']][_0xd2d4('0x2c')]),_0xd2d4('0x2d'),this[_0xd2d4('0xb')][_0x3ad56e[_0xd2d4('0x31')]]);}else if(_['startsWith'](_0x3ad56e['device'],_0xd2d4('0x3b'))){var _0x1b732b=_0x3ad56e['device'];var _0x43656e=_0x1b732b[_0xd2d4('0x3c')](_0x1b732b[_0xd2d4('0x3d')]('/')+0x1,_0x1b732b[_0xd2d4('0x3d')]('@'));var _0x5f2d9d=_[_0xd2d4('0x25')](this[_0xd2d4('0xc')],function(_0x587257){return _0x587257[_0xd2d4('0x3e')]==_0x43656e||_0x587257[_0xd2d4('0x3f')]==_0x43656e||_0x587257[_0xd2d4('0x40')]==_0x43656e;});if(_0x5f2d9d){if(_0x5f2d9d[_0xd2d4('0x26')]!==_0x3ad56e[_0xd2d4('0x26')]['toLowerCase']()){_0x5f2d9d[_0xd2d4('0x35')]=_['toNumber'](moment()[_0xd2d4('0x2b')]('x'));}_0x5f2d9d[_0xd2d4('0x26')]=_0x3ad56e[_0xd2d4('0x26')][_0xd2d4('0x32')]();_0x5f2d9d['local']=!![];_0x5f2d9d[_0xd2d4('0x41')](_0x3ad56e);}}}}catch(_0x1f52c){logger[_0xd2d4('0x14')](_0xd2d4('0x30'),util[_0xd2d4('0x16')](_0x1f52c,{'showHidden':![],'depth':null}));}};UserReport[_0xd2d4('0x1d')]['syncPeerStatus']=function(_0x51a24e){try{if(this[_0xd2d4('0x1e')](_0x51a24e)&&this[_0xd2d4('0x1e')](_0x51a24e['peerstatus'])){logger[_0xd2d4('0x21')](_0xd2d4('0x42'),_0x51a24e['peer'],_0x51a24e[_0xd2d4('0x43')],_0x51a24e['peerstatus']);logger['debug'](_0xd2d4('0x44'),util['inspect'](_0x51a24e,{'showHidden':![],'depth':null}));if(this[_0xd2d4('0xc')][_0x51a24e[_0xd2d4('0x45')]]){if(!this['agents'][_0x51a24e['peer']][_0xd2d4('0x34')]||_0x51a24e[_0xd2d4('0x46')][_0xd2d4('0x32')]()==_0xd2d4('0x47')){this[_0xd2d4('0xc')][_0x51a24e[_0xd2d4('0x45')]][_0xd2d4('0x34')]=![];this[_0xd2d4('0xc')][_0x51a24e['peer']]['status']=_0x51a24e[_0xd2d4('0x46')][_0xd2d4('0x32')]();this[_0xd2d4('0xc')][_0x51a24e[_0xd2d4('0x45')]][_0xd2d4('0x43')]=_0x51a24e[_0xd2d4('0x43')];this[_0xd2d4('0xc')][_0x51a24e[_0xd2d4('0x45')]]['updateStatusRealtime'](_0x51a24e);}}else if(this['telephones'][_0x51a24e[_0xd2d4('0x45')]]){this[_0xd2d4('0xd')][_0x51a24e[_0xd2d4('0x45')]][_0xd2d4('0x48')]=_0x51a24e[_0xd2d4('0x46')][_0xd2d4('0x32')]();this['telephones'][_0x51a24e['peer']][_0xd2d4('0x43')]=_0x51a24e[_0xd2d4('0x43')];logger[_0xd2d4('0x24')](_0xd2d4('0x49'),util[_0xd2d4('0x16')](this[_0xd2d4('0xd')][_0x51a24e[_0xd2d4('0x45')]],{'showHidden':![],'depth':null}));this[_0xd2d4('0x20')](util['format'](_0xd2d4('0x38'),this[_0xd2d4('0xd')][_0x51a24e[_0xd2d4('0x45')]]['name']),'telephone:save',this[_0xd2d4('0xd')][_0x51a24e[_0xd2d4('0x45')]]);}else if(this[_0xd2d4('0xb')][_0x51a24e['peer']]){this[_0xd2d4('0xb')][_0x51a24e[_0xd2d4('0x45')]]['status']=_0x51a24e[_0xd2d4('0x46')]['toLowerCase']();this[_0xd2d4('0xb')][_0x51a24e['peer']][_0xd2d4('0x43')]=_0x51a24e[_0xd2d4('0x43')];logger[_0xd2d4('0x24')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0xd2d4('0x16')](this[_0xd2d4('0xb')][_0x51a24e[_0xd2d4('0x45')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xd2d4('0x2b')](_0xd2d4('0x3a'),this[_0xd2d4('0xb')][_0x51a24e[_0xd2d4('0x45')]][_0xd2d4('0x2c')]),'trunk:save',this[_0xd2d4('0xb')][_0x51a24e['peer']]);}}}catch(_0x5ad9e3){logger['error'](_0xd2d4('0x44'),util[_0xd2d4('0x16')](_0x5ad9e3,{'showHidden':![],'depth':null}));}};module[_0xd2d4('0x4a')]=UserReport; \ No newline at end of file +var _0xfa3a=['exports','moment','util','ami','../ami','redis','defaults','trunks','agents','telephones','registryentry','syncRegistry','registry','bind','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','inspect','prototype','isNotNull','isUndefined','emit','[userReport][registry]\x20registry:%s\x20state:%s','username','debug','[userReport][registry]','find','stateRegistry','state','merge','omit','event','actionid','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','toLowerCase','inuse','local','device','stateTime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','indexOf','mobile','phone','accountcode','updateStatusRealtime','peer','status','address','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','[userReport][peerstatus]'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xfa3a,0x1ab));var _0xafa3=function(_0xc6b011,_0x5d1f19){_0xc6b011=_0xc6b011-0x0;var _0x420171=_0xfa3a[_0xc6b011];return _0x420171;};'use strict';var _=require('lodash');var moment=require(_0xafa3('0x0'));var util=require(_0xafa3('0x1'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xafa3('0x2'));var ami=require(_0xafa3('0x3'));config[_0xafa3('0x4')]=_[_0xafa3('0x5')](config[_0xafa3('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xafa3('0x4')]));function UserReport(_0x4dcad9){this['trunks']=_0x4dcad9[_0xafa3('0x6')];this['agents']=_0x4dcad9[_0xafa3('0x7')];this['telephones']=_0x4dcad9[_0xafa3('0x8')];ami['on'](_0xafa3('0x9'),this[_0xafa3('0xa')]['bind'](this));ami['on'](_0xafa3('0xb'),this[_0xafa3('0xa')][_0xafa3('0xc')](this));ami['on'](_0xafa3('0xd'),this[_0xafa3('0xe')][_0xafa3('0xc')](this));ami['on'](_0xafa3('0xf'),this[_0xafa3('0x10')]['bind'](this));return this[_0xafa3('0x11')]();}function showSipRegistrations(){Promise[_0xafa3('0x12')]()[_0xafa3('0x13')](ami[_0xafa3('0x14')]())[_0xafa3('0x15')](function(_0x5e34c3){logger[_0xafa3('0x16')](_0xafa3('0x17'),util['inspect'](_0x5e34c3,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xafa3('0x12')]()[_0xafa3('0x13')](ami['actionDeviceStateList']())[_0xafa3('0x15')](function(_0x56f507){logger[_0xafa3('0x16')](_0xafa3('0x18'),util['inspect'](_0x56f507,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xafa3('0x12')]()[_0xafa3('0x13')](ami[_0xafa3('0x19')]())[_0xafa3('0x15')](function(_0x2bfdfc){logger[_0xafa3('0x16')](_0xafa3('0x1a'),util[_0xafa3('0x1b')](_0x2bfdfc,{'showHidden':![],'depth':null}));});}UserReport[_0xafa3('0x1c')][_0xafa3('0x11')]=function(){setInterval(function(){BPromise[_0xafa3('0x12')]()[_0xafa3('0x13')](showSipRegistrations())[_0xafa3('0x13')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0xafa3('0x1c')][_0xafa3('0x1d')]=function(_0xeae096){return _0xeae096!==null&&!_[_0xafa3('0x1e')](_0xeae096);};UserReport[_0xafa3('0x1c')][_0xafa3('0x1f')]=function(_0x327a1b,_0x515e02,_0x5e6a63){io['to'](_0x327a1b)[_0xafa3('0x1f')](_0x515e02,_0x5e6a63);};UserReport[_0xafa3('0x1c')][_0xafa3('0xa')]=function(_0x45ec90){try{if(this['isNotNull'](_0x45ec90)){logger['info'](_0xafa3('0x20'),_0x45ec90[_0xafa3('0x21')],_0x45ec90['state']);logger[_0xafa3('0x22')](_0xafa3('0x23'),util['inspect'](_0x45ec90,{'showHidden':![],'depth':null}));var _0x508d16=_[_0xafa3('0x24')](this[_0xafa3('0x6')],{'defaultuser':_0x45ec90[_0xafa3('0x21')]});if(_0x508d16){_0x45ec90[_0xafa3('0x25')]=_0x45ec90[_0xafa3('0x26')];_[_0xafa3('0x27')](_0x508d16,_[_0xafa3('0x28')](_0x45ec90,[_0xafa3('0x29'),_0xafa3('0x2a'),_0xafa3('0x21'),'state']));logger[_0xafa3('0x22')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util['inspect'](_0x508d16,{'showHidden':![],'depth':null}));this[_0xafa3('0x1f')](util[_0xafa3('0x2b')](_0xafa3('0x2c'),_0x508d16[_0xafa3('0x2d')]),_0xafa3('0x2e'),_0x508d16);}}}catch(_0x5cfbdd){logger[_0xafa3('0x16')](_0xafa3('0x23'),util[_0xafa3('0x1b')](_0x5cfbdd,{'showHidden':![],'depth':null}));}};UserReport[_0xafa3('0x1c')][_0xafa3('0xe')]=function(_0x36d05b){try{if(this[_0xafa3('0x1d')](_0x36d05b)){logger['info'](_0xafa3('0x2f'),_0x36d05b['device'],_0x36d05b['state']);logger[_0xafa3('0x22')](_0xafa3('0x30'),util[_0xafa3('0x1b')](_0x36d05b,{'showHidden':![],'depth':null}));if(this[_0xafa3('0x7')][_0x36d05b['device']]){if(!this[_0xafa3('0x7')][_0x36d05b['device']]['local']||_0x36d05b[_0xafa3('0x26')][_0xafa3('0x31')]()==_0xafa3('0x32')){this['agents'][_0x36d05b['device']][_0xafa3('0x33')]=![];if(this[_0xafa3('0x7')][_0x36d05b[_0xafa3('0x34')]][_0xafa3('0x26')]!==_0x36d05b[_0xafa3('0x26')][_0xafa3('0x31')]()){this[_0xafa3('0x7')][_0x36d05b['device']][_0xafa3('0x35')]=_[_0xafa3('0x36')](moment()[_0xafa3('0x2b')]('x'));}this[_0xafa3('0x7')][_0x36d05b[_0xafa3('0x34')]][_0xafa3('0x26')]=_0x36d05b[_0xafa3('0x26')][_0xafa3('0x31')]();this[_0xafa3('0x7')][_0x36d05b['device']]['updateStatusRealtime'](_0x36d05b);}}else if(this['telephones'][_0x36d05b[_0xafa3('0x34')]]){if(this[_0xafa3('0x8')][_0x36d05b['device']][_0xafa3('0x26')]!==_0x36d05b[_0xafa3('0x26')][_0xafa3('0x31')]()){this[_0xafa3('0x8')][_0x36d05b[_0xafa3('0x34')]][_0xafa3('0x35')]=_['toNumber'](moment()[_0xafa3('0x2b')]('x'));}this[_0xafa3('0x8')][_0x36d05b[_0xafa3('0x34')]][_0xafa3('0x26')]=_0x36d05b['state'][_0xafa3('0x31')]();logger[_0xafa3('0x22')](_0xafa3('0x37'),util[_0xafa3('0x1b')](this[_0xafa3('0x8')][_0x36d05b[_0xafa3('0x34')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xafa3('0x2b')](_0xafa3('0x38'),this[_0xafa3('0x8')][_0x36d05b[_0xafa3('0x34')]]['name']),_0xafa3('0x39'),this[_0xafa3('0x8')][_0x36d05b['device']]);}else if(this[_0xafa3('0x6')][_0x36d05b[_0xafa3('0x34')]]){if(this['trunks'][_0x36d05b[_0xafa3('0x34')]][_0xafa3('0x26')]!==_0x36d05b[_0xafa3('0x26')][_0xafa3('0x31')]()){this['trunks'][_0x36d05b['device']][_0xafa3('0x35')]=_[_0xafa3('0x36')](moment()[_0xafa3('0x2b')]('x'));}this[_0xafa3('0x6')][_0x36d05b[_0xafa3('0x34')]][_0xafa3('0x26')]=_0x36d05b[_0xafa3('0x26')]['toLowerCase']();logger[_0xafa3('0x22')](_0xafa3('0x3a'),util[_0xafa3('0x1b')](this['trunks'][_0x36d05b[_0xafa3('0x34')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xafa3('0x2c'),this[_0xafa3('0x6')][_0x36d05b[_0xafa3('0x34')]][_0xafa3('0x2d')]),_0xafa3('0x2e'),this[_0xafa3('0x6')][_0x36d05b[_0xafa3('0x34')]]);}else if(_[_0xafa3('0x3b')](_0x36d05b[_0xafa3('0x34')],'Local')){var _0xd16432=_0x36d05b['device'];var _0x96bc75=_0xd16432['substring'](_0xd16432[_0xafa3('0x3c')]('/')+0x1,_0xd16432['indexOf']('@'));var _0x32ca09=_['find'](this[_0xafa3('0x7')],function(_0x3e7831){return _0x3e7831[_0xafa3('0x3d')]==_0x96bc75||_0x3e7831[_0xafa3('0x3e')]==_0x96bc75||_0x3e7831[_0xafa3('0x3f')]==_0x96bc75;});if(_0x32ca09){if(_0x32ca09[_0xafa3('0x26')]!==_0x36d05b[_0xafa3('0x26')]['toLowerCase']()){_0x32ca09['stateTime']=_[_0xafa3('0x36')](moment()[_0xafa3('0x2b')]('x'));}_0x32ca09[_0xafa3('0x26')]=_0x36d05b[_0xafa3('0x26')][_0xafa3('0x31')]();_0x32ca09['local']=!![];_0x32ca09[_0xafa3('0x40')](_0x36d05b);}}}}catch(_0x52db9f){logger[_0xafa3('0x16')](_0xafa3('0x30'),util[_0xafa3('0x1b')](_0x52db9f,{'showHidden':![],'depth':null}));}};UserReport[_0xafa3('0x1c')]['syncPeerStatus']=function(_0x405f44){try{if(this['isNotNull'](_0x405f44)&&this[_0xafa3('0x1d')](_0x405f44['peerstatus'])){logger['info']('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x405f44[_0xafa3('0x41')],_0x405f44['address'],_0x405f44[_0xafa3('0xf')]);logger[_0xafa3('0x22')]('[userReport][peerstatus]',util['inspect'](_0x405f44,{'showHidden':![],'depth':null}));if(this[_0xafa3('0x7')][_0x405f44[_0xafa3('0x41')]]){if(!this['agents'][_0x405f44[_0xafa3('0x41')]]['local']||_0x405f44[_0xafa3('0xf')][_0xafa3('0x31')]()=='registered'){this[_0xafa3('0x7')][_0x405f44['peer']]['local']=![];this['agents'][_0x405f44['peer']][_0xafa3('0x42')]=_0x405f44[_0xafa3('0xf')]['toLowerCase']();this[_0xafa3('0x7')][_0x405f44[_0xafa3('0x41')]][_0xafa3('0x43')]=_0x405f44[_0xafa3('0x43')];this['agents'][_0x405f44[_0xafa3('0x41')]]['updateStatusRealtime'](_0x405f44);}}else if(this['telephones'][_0x405f44['peer']]){this[_0xafa3('0x8')][_0x405f44[_0xafa3('0x41')]]['status']=_0x405f44['peerstatus'][_0xafa3('0x31')]();this['telephones'][_0x405f44[_0xafa3('0x41')]][_0xafa3('0x43')]=_0x405f44['address'];logger[_0xafa3('0x22')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0xafa3('0x1b')](this[_0xafa3('0x8')][_0x405f44[_0xafa3('0x41')]],{'showHidden':![],'depth':null}));this[_0xafa3('0x1f')](util[_0xafa3('0x2b')](_0xafa3('0x38'),this[_0xafa3('0x8')][_0x405f44[_0xafa3('0x41')]][_0xafa3('0x2d')]),'telephone:save',this[_0xafa3('0x8')][_0x405f44[_0xafa3('0x41')]]);}else if(this[_0xafa3('0x6')][_0x405f44['peer']]){this['trunks'][_0x405f44[_0xafa3('0x41')]][_0xafa3('0x42')]=_0x405f44['peerstatus'][_0xafa3('0x31')]();this[_0xafa3('0x6')][_0x405f44['peer']][_0xafa3('0x43')]=_0x405f44[_0xafa3('0x43')];logger['debug'](_0xafa3('0x44'),util[_0xafa3('0x1b')](this[_0xafa3('0x6')][_0x405f44['peer']],{'showHidden':![],'depth':null}));this['emit'](util[_0xafa3('0x2b')](_0xafa3('0x2c'),this['trunks'][_0x405f44[_0xafa3('0x41')]]['name']),_0xafa3('0x2e'),this['trunks'][_0x405f44[_0xafa3('0x41')]]);}}}catch(_0x48a69b){logger[_0xafa3('0x16')](_0xafa3('0x45'),util['inspect'](_0x48a69b,{'showHidden':![],'depth':null}));}};module[_0xafa3('0x46')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 8f178bc..892cc13 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0835=['destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','variables','merge','omit','event','privilege','inspect','custom:agentcalled','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','routealias','interface','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','agentringnoanswer','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','reason','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','talktime','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','syncVarSet','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','onhold','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','../../../config/environment','../../../config/logger','../ami','redis','defaults','channels','voiceChannels','voiceQueues','agents','agentcalled','syncAgentCalled','bind','syncAgentConnect','queuecallerabandon','agentcomplete','syncAgentComplete','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','prototype','emit','isUndefined','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x0835,0x77));var _0x5083=function(_0x51481a,_0x163405){_0x51481a=_0x51481a-0x0;var _0x4a563c=_0x0835[_0x51481a];return _0x4a563c;};'use strict';var _=require(_0x5083('0x0'));var moment=require(_0x5083('0x1'));var util=require(_0x5083('0x2'));var Redis=require('ioredis');var config=require(_0x5083('0x3'));var logger=require(_0x5083('0x4'))('ami');var ami=require(_0x5083('0x5'));config[_0x5083('0x6')]=_[_0x5083('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5083('0x6')]));function VoiceAgentReport(_0x51cd5f){this[_0x5083('0x8')]={};this[_0x5083('0x9')]=_0x51cd5f[_0x5083('0x8')];this[_0x5083('0xa')]=_0x51cd5f[_0x5083('0xa')];this[_0x5083('0xb')]=_0x51cd5f[_0x5083('0xb')];this['variables']={};ami['on'](_0x5083('0xc'),this[_0x5083('0xd')][_0x5083('0xe')](this));ami['on']('agentconnect',this[_0x5083('0xf')][_0x5083('0xe')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x5083('0xe')](this));ami['on'](_0x5083('0x10'),this['syncQueueCallerAbandon'][_0x5083('0xe')](this));ami['on'](_0x5083('0x11'),this[_0x5083('0x12')][_0x5083('0xe')](this));ami['on']('varset',this['syncVarSet'][_0x5083('0xe')](this));ami['on'](_0x5083('0x13'),this[_0x5083('0x14')]['bind'](this));ami['on']('musiconholdstart',this[_0x5083('0x15')][_0x5083('0xe')](this));ami['on'](_0x5083('0x16'),this[_0x5083('0x17')][_0x5083('0xe')](this));ami['on'](_0x5083('0x18'),this[_0x5083('0x19')][_0x5083('0xe')](this));ami['on']('blindtransfer',this[_0x5083('0x1a')][_0x5083('0xe')](this));}VoiceAgentReport[_0x5083('0x1b')]['emit']=function(_0x4c762d,_0x4be93c,_0x55b136){io['to'](_0x4c762d)[_0x5083('0x1c')](_0x4be93c,_0x55b136);};VoiceAgentReport['prototype']['isNotNull']=function(_0x53251b){return _0x53251b!==null&&!_[_0x5083('0x1d')](_0x53251b);};VoiceAgentReport[_0x5083('0x1b')][_0x5083('0xd')]=function(_0x2c8e71){try{if(this[_0x5083('0x1e')](_0x2c8e71)){logger[_0x5083('0x1f')](_0x5083('0x20'),_0x2c8e71[_0x5083('0x21')],_0x2c8e71[_0x5083('0x22')],_0x2c8e71[_0x5083('0x23')]);logger[_0x5083('0x24')](_0x5083('0x25'),_0x2c8e71[_0x5083('0x21')],util['inspect'](_0x2c8e71,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x5083('0x8')][_0x2c8e71['uniqueid']])){this[_0x5083('0x8')][_0x2c8e71['uniqueid']]={};}if(_[_0x5083('0x1d')](this[_0x5083('0x8')][_0x2c8e71[_0x5083('0x21')]][_0x2c8e71[_0x5083('0x23')]])){this[_0x5083('0x8')][_0x2c8e71[_0x5083('0x21')]][_0x2c8e71['destuniqueid']]={'agentcalledAt':moment()[_0x5083('0x26')](_0x5083('0x27')),'lastevent':_0x5083('0x28'),'mandatoryDisposition':this['voiceQueues'][_0x2c8e71[_0x5083('0x29')]]?this[_0x5083('0xa')][_0x2c8e71[_0x5083('0x29')]][_0x5083('0x2a')]||![]:![],'type':this['voiceQueues'][_0x2c8e71[_0x5083('0x29')]]?this[_0x5083('0xa')][_0x2c8e71['queue']][_0x5083('0x2b')]||_0x5083('0x2c'):'inbound','variables':this[_0x5083('0x2d')][_0x2c8e71[_0x5083('0x21')]],'motionChannel':'voice'};}_[_0x5083('0x2e')](this[_0x5083('0x8')][_0x2c8e71[_0x5083('0x21')]][_0x2c8e71['destuniqueid']],_[_0x5083('0x2f')](_0x2c8e71,[_0x5083('0x30'),_0x5083('0x31')]));logger[_0x5083('0x24')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x2c8e71[_0x5083('0x21')],util[_0x5083('0x32')](this[_0x5083('0x8')][_0x2c8e71[_0x5083('0x21')]][_0x2c8e71[_0x5083('0x23')]],{'showHidden':![],'depth':null}));ami[_0x5083('0x1c')](_0x5083('0x33'),this['channels'][_0x2c8e71[_0x5083('0x21')]][_0x2c8e71[_0x5083('0x23')]]);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x2c8e71[_0x5083('0x21')],util['inspect'](this[_0x5083('0x8')][_0x2c8e71[_0x5083('0x21')]][_0x2c8e71[_0x5083('0x23')]],{'showHidden':![],'depth':null}));this[_0x5083('0x1c')](util[_0x5083('0x26')](_0x5083('0x34'),_0x2c8e71['membername']),_0x5083('0x35'),this[_0x5083('0x8')][_0x2c8e71[_0x5083('0x21')]][_0x2c8e71[_0x5083('0x23')]]);}}catch(_0x29052d){logger[_0x5083('0x36')](_0x5083('0x37'),_0x2c8e71['uniqueid'],util[_0x5083('0x32')](_0x29052d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x5083('0xf')]=function(_0x21dceb){try{if(this[_0x5083('0x1e')](_0x21dceb)){if(this[_0x5083('0x8')][_0x21dceb[_0x5083('0x21')]]){logger[_0x5083('0x24')](_0x5083('0x38'),_0x21dceb['uniqueid'],util[_0x5083('0x32')](_0x21dceb,{'showHidden':![],'depth':null}));for(var _0x4764c8 in this['channels'][_0x21dceb['uniqueid']]){if(this[_0x5083('0x8')][_0x21dceb[_0x5083('0x21')]][_0x5083('0x39')](_0x4764c8)){if(_0x21dceb[_0x5083('0x23')]===_0x4764c8){logger['info'](_0x5083('0x3a'),_0x21dceb[_0x5083('0x21')],_0x21dceb[_0x5083('0x22')],_0x21dceb['destuniqueid']);this[_0x5083('0x8')][_0x21dceb[_0x5083('0x21')]][_0x4764c8][_0x5083('0x3b')]=moment()[_0x5083('0x26')](_0x5083('0x27'));this[_0x5083('0x8')][_0x21dceb['uniqueid']][_0x4764c8]['connectedlinename']=_0x21dceb['connectedlinename'];this[_0x5083('0x8')][_0x21dceb[_0x5083('0x21')]][_0x4764c8][_0x5083('0x3c')]=_0x21dceb[_0x5083('0x3c')];this['channels'][_0x21dceb[_0x5083('0x21')]][_0x4764c8][_0x5083('0x3d')]=_0x21dceb[_0x5083('0x3d')];this[_0x5083('0x8')][_0x21dceb[_0x5083('0x21')]][_0x4764c8]['destchannelstatedesc']=_0x21dceb[_0x5083('0x3e')];this['channels'][_0x21dceb[_0x5083('0x21')]][_0x4764c8][_0x5083('0x3f')]=_0x21dceb[_0x5083('0x3f')];this['channels'][_0x21dceb[_0x5083('0x21')]][_0x4764c8][_0x5083('0x40')]=_0x5083('0x41');if(this['voiceChannels'][this[_0x5083('0x8')][_0x21dceb[_0x5083('0x21')]][_0x4764c8][_0x5083('0x21')]]){var _0x5b0081=this[_0x5083('0x9')][this[_0x5083('0x8')][_0x21dceb['uniqueid']][_0x4764c8][_0x5083('0x21')]][_0x5083('0x42')];this[_0x5083('0x8')][_0x21dceb[_0x5083('0x21')]][_0x4764c8][_0x5083('0x42')]=_0x5b0081;_0x21dceb[_0x5083('0x42')]=_0x5b0081;}_[_0x5083('0x2e')](this[_0x5083('0xb')][_0x21dceb[_0x5083('0x43')]],_['pick'](_0x21dceb,[_0x5083('0x29'),_0x5083('0x44'),'routealias']));logger[_0x5083('0x24')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x21dceb[_0x5083('0x21')],util[_0x5083('0x32')](this[_0x5083('0x8')][_0x21dceb[_0x5083('0x21')]][_0x21dceb[_0x5083('0x23')]],{'showHidden':![],'depth':null}));ami['emit'](_0x5083('0x45'),this[_0x5083('0x8')][_0x21dceb[_0x5083('0x21')]][_0x21dceb['destuniqueid']]);logger[_0x5083('0x24')](_0x5083('0x46'),_0x21dceb['uniqueid'],util[_0x5083('0x32')](this['channels'][_0x21dceb[_0x5083('0x21')]][_0x21dceb['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x5083('0x1c')](util[_0x5083('0x26')]('user:%s',_0x21dceb[_0x5083('0x22')]),_0x5083('0x47'),this[_0x5083('0x8')][_0x21dceb[_0x5083('0x21')]][_0x21dceb[_0x5083('0x23')]]);}else if(!this[_0x5083('0x8')][_0x21dceb['uniqueid']][_0x4764c8][_0x5083('0x48')]&&!this[_0x5083('0x8')][_0x21dceb['uniqueid']][_0x4764c8][_0x5083('0x11')]){logger[_0x5083('0x1f')](_0x5083('0x49'),_0x21dceb[_0x5083('0x21')],this[_0x5083('0x8')][_0x21dceb[_0x5083('0x21')]][_0x4764c8][_0x5083('0x22')],_0x4764c8);this[_0x5083('0x8')][_0x21dceb['uniqueid']][_0x4764c8][_0x5083('0x48')]=!![];this[_0x5083('0x8')][_0x21dceb[_0x5083('0x21')]][_0x4764c8][_0x5083('0x4a')]=moment()[_0x5083('0x26')](_0x5083('0x27'));this[_0x5083('0x8')][_0x21dceb[_0x5083('0x21')]][_0x4764c8][_0x5083('0x4b')]=_0x21dceb['destuniqueid'];this[_0x5083('0x8')][_0x21dceb['uniqueid']][_0x4764c8][_0x5083('0x4c')]=_0x21dceb[_0x5083('0x22')];this[_0x5083('0x8')][_0x21dceb[_0x5083('0x21')]][_0x4764c8]['lastevent']='answered_elsewhere';this['channels'][_0x21dceb[_0x5083('0x21')]][_0x4764c8][_0x5083('0x4d')]=_0x5083('0x4e');logger['debug'](_0x5083('0x4f'),_0x21dceb[_0x5083('0x21')],util[_0x5083('0x32')](this[_0x5083('0x8')][_0x21dceb[_0x5083('0x21')]][_0x4764c8],{'showHidden':![],'depth':null}));ami[_0x5083('0x1c')](_0x5083('0x50'),this[_0x5083('0x8')][_0x21dceb[_0x5083('0x21')]][_0x4764c8]);}}}}}}catch(_0x41d93f){logger[_0x5083('0x36')](_0x5083('0x51'),_0x21dceb[_0x5083('0x21')],util[_0x5083('0x32')](_0x41d93f,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x5083('0x52')]=function(_0x5d9fe7){try{if(this[_0x5083('0x1e')](_0x5d9fe7)){logger[_0x5083('0x24')](_0x5083('0x53'),_0x5d9fe7[_0x5083('0x21')],util['inspect'](_0x5d9fe7,{'showHidden':![],'depth':null}));if(this[_0x5083('0x8')][_0x5d9fe7['uniqueid']]&&this[_0x5083('0x8')][_0x5d9fe7[_0x5083('0x21')]][_0x5d9fe7[_0x5083('0x23')]]){logger[_0x5083('0x1f')](_0x5083('0x54'),_0x5d9fe7[_0x5083('0x21')],_0x5d9fe7[_0x5083('0x22')],_0x5d9fe7[_0x5083('0x23')]);this['channels'][_0x5d9fe7[_0x5083('0x21')]][_0x5d9fe7[_0x5083('0x23')]]['agentringnoanswer']=!![];this['channels'][_0x5d9fe7[_0x5083('0x21')]][_0x5d9fe7[_0x5083('0x23')]][_0x5083('0x4a')]=moment()[_0x5083('0x26')](_0x5083('0x27'));this['channels'][_0x5d9fe7[_0x5083('0x21')]][_0x5d9fe7['destuniqueid']][_0x5083('0x40')]=_0x5083('0x55');this[_0x5083('0x8')][_0x5d9fe7[_0x5083('0x21')]][_0x5d9fe7[_0x5083('0x23')]]['reason']=_0x5083('0x55');logger[_0x5083('0x24')](_0x5083('0x56'),_0x5d9fe7[_0x5083('0x21')],util[_0x5083('0x32')](this[_0x5083('0x8')][_0x5d9fe7['uniqueid']][_0x5d9fe7[_0x5083('0x23')]],{'showHidden':![],'depth':null}));ami[_0x5083('0x1c')](_0x5083('0x57'),this[_0x5083('0x8')][_0x5d9fe7[_0x5083('0x21')]][_0x5d9fe7[_0x5083('0x23')]]);}}}catch(_0x39585a){logger[_0x5083('0x36')](_0x5083('0x58'),_0x5d9fe7[_0x5083('0x21')],util[_0x5083('0x32')](_0x39585a,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncQueueCallerAbandon']=function(_0x332822){try{if(this[_0x5083('0x1e')](_0x332822)){logger[_0x5083('0x24')](_0x5083('0x59'),_0x332822[_0x5083('0x21')],util[_0x5083('0x32')](_0x332822,{'showHidden':![],'depth':null}));if(this['channels'][_0x332822[_0x5083('0x21')]]){for(var _0xa31335 in this['channels'][_0x332822[_0x5083('0x21')]]){if(this[_0x5083('0x8')][_0x332822['uniqueid']][_0x5083('0x39')](_0xa31335)&&!this[_0x5083('0x8')][_0x332822[_0x5083('0x21')]][_0xa31335]['agentringnoanswer']&&!this[_0x5083('0x8')][_0x332822[_0x5083('0x21')]][_0xa31335][_0x5083('0x11')]){logger[_0x5083('0x1f')](_0x5083('0x5a'),_0x332822['uniqueid'],this[_0x5083('0x8')][_0x332822['uniqueid']][_0xa31335][_0x5083('0x22')],_0xa31335);this['channels'][_0x332822[_0x5083('0x21')]][_0xa31335][_0x5083('0x48')]=!![];this['channels'][_0x332822['uniqueid']][_0xa31335][_0x5083('0x4a')]=moment()[_0x5083('0x26')](_0x5083('0x27'));this[_0x5083('0x8')][_0x332822[_0x5083('0x21')]][_0xa31335]['lastevent']=_0x5083('0x5b');this[_0x5083('0x8')][_0x332822[_0x5083('0x21')]][_0xa31335]['reason']='abandoned';logger[_0x5083('0x24')](_0x5083('0x5c'),_0x332822[_0x5083('0x21')],util[_0x5083('0x32')](this[_0x5083('0x8')][_0x332822[_0x5083('0x21')]][_0xa31335],{'showHidden':![],'depth':null}));ami['emit']('custom:agentqueuecallerabandon',this[_0x5083('0x8')][_0x332822[_0x5083('0x21')]][_0xa31335]);}}}}}catch(_0x157d26){logger[_0x5083('0x36')](_0x5083('0x5d'),_0x332822['uniqueid'],util[_0x5083('0x32')](_0x157d26,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x5083('0x1b')]['syncAgentComplete']=function(_0x4bcddd){try{if(this[_0x5083('0x1e')](_0x4bcddd)){logger['debug'](_0x5083('0x5e'),_0x4bcddd[_0x5083('0x21')],util['inspect'](_0x4bcddd,{'showHidden':![],'depth':null}));if(this['channels'][_0x4bcddd[_0x5083('0x21')]]){for(var _0x22d951 in this[_0x5083('0x8')][_0x4bcddd['uniqueid']]){if(this[_0x5083('0x8')][_0x4bcddd[_0x5083('0x21')]][_0x5083('0x39')](_0x22d951)){if(this[_0x5083('0x8')][_0x4bcddd[_0x5083('0x21')]][_0x22d951]['agentconnectAt']&&!this[_0x5083('0x8')][_0x4bcddd['uniqueid']][_0x22d951][_0x5083('0x11')]){logger[_0x5083('0x1f')](_0x5083('0x5f'),_0x4bcddd[_0x5083('0x21')],this['channels'][_0x4bcddd[_0x5083('0x21')]][_0x22d951][_0x5083('0x22')],_0x22d951);this[_0x5083('0x8')][_0x4bcddd[_0x5083('0x21')]][_0x22d951]['agentcomplete']=!![];this[_0x5083('0x8')][_0x4bcddd[_0x5083('0x21')]][_0x22d951][_0x5083('0x60')]=moment()[_0x5083('0x26')](_0x5083('0x27'));this[_0x5083('0x8')][_0x4bcddd[_0x5083('0x21')]][_0x22d951][_0x5083('0x40')]=_0x5083('0x61');this['channels'][_0x4bcddd['uniqueid']][_0x22d951][_0x5083('0x4d')]=_0x4bcddd[_0x5083('0x4d')]=='transfer'?'agent':_0x4bcddd[_0x5083('0x4d')];this[_0x5083('0x8')][_0x4bcddd[_0x5083('0x21')]][_0x22d951][_0x5083('0x62')]=_0x4bcddd[_0x5083('0x62')];if(this['voiceQueues'][_0x4bcddd[_0x5083('0x29')]]&&this[_0x5083('0xa')][_0x4bcddd[_0x5083('0x29')]]['acw']){this[_0x5083('0x8')][_0x4bcddd[_0x5083('0x21')]][_0x22d951][_0x5083('0x63')]=this['voiceQueues'][_0x4bcddd[_0x5083('0x29')]][_0x5083('0x64')];this['channels'][_0x4bcddd['uniqueid']][_0x22d951][_0x5083('0x65')]=!![];}this[_0x5083('0xb')][_0x4bcddd[_0x5083('0x43')]]=_[_0x5083('0x2f')](this[_0x5083('0xb')][_0x4bcddd[_0x5083('0x43')]],[_0x5083('0x29'),_0x5083('0x44')]);logger[_0x5083('0x24')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x4bcddd['uniqueid'],util[_0x5083('0x32')](this[_0x5083('0x8')][_0x4bcddd[_0x5083('0x21')]][_0x22d951],{'showHidden':![],'depth':null}));ami[_0x5083('0x1c')]('custom:agentcomplete',this[_0x5083('0x8')][_0x4bcddd[_0x5083('0x21')]][_0x22d951]);logger[_0x5083('0x24')](_0x5083('0x66'),_0x4bcddd[_0x5083('0x21')],util[_0x5083('0x32')](this[_0x5083('0x8')][_0x4bcddd[_0x5083('0x21')]][_0x22d951],{'showHidden':![],'depth':null}));this[_0x5083('0x1c')](util[_0x5083('0x26')](_0x5083('0x34'),_0x4bcddd[_0x5083('0x22')]),_0x5083('0x67'),this[_0x5083('0x8')][_0x4bcddd['uniqueid']][_0x22d951]);}}}}}}catch(_0x4cabe1){logger[_0x5083('0x36')](_0x5083('0x68'),_0x4bcddd['uniqueid'],util[_0x5083('0x32')](_0x4cabe1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x5083('0x1b')][_0x5083('0x69')]=function(_0x8991d7){try{if(this[_0x5083('0x1e')](_0x8991d7)){logger['debug'](_0x5083('0x6a'),_0x8991d7['uniqueid'],util[_0x5083('0x32')](_0x8991d7,{'showHidden':![],'depth':null}));this[_0x5083('0x6b')](_0x8991d7[_0x5083('0x21')],_[_0x5083('0x6c')](_0x8991d7[_0x5083('0x6d')])[0x0],_0x8991d7[_0x5083('0x6e')]);if(this[_0x5083('0x8')][_0x8991d7[_0x5083('0x21')]]){for(var _0x3326f0 in this[_0x5083('0x8')][_0x8991d7[_0x5083('0x21')]]){if(this[_0x5083('0x8')][_0x8991d7[_0x5083('0x21')]][_0x5083('0x39')](_0x3326f0)){logger[_0x5083('0x1f')](_0x5083('0x6f'),_0x8991d7[_0x5083('0x21')],_0x3326f0,_[_0x5083('0x6c')](_0x8991d7[_0x5083('0x6d')])[0x0],_0x8991d7['value']);if(_['isUndefined'](this['channels'][_0x8991d7['uniqueid']][_0x3326f0][_0x5083('0x2d')])){this[_0x5083('0x8')][_0x8991d7[_0x5083('0x21')]][_0x3326f0][_0x5083('0x2d')]={};}this[_0x5083('0x8')][_0x8991d7[_0x5083('0x21')]][_0x3326f0][_0x5083('0x2d')]=this[_0x5083('0x2d')][_0x8991d7[_0x5083('0x21')]];}}}}}catch(_0x57ee11){logger[_0x5083('0x36')](_0x5083('0x70'),_0x8991d7[_0x5083('0x21')],util[_0x5083('0x32')](_0x57ee11,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x5083('0x1b')][_0x5083('0x6b')]=function(_0x7cff1c,_0x236ea1,_0x4edbe1){var _0x5bd52f=[_0x5083('0x71'),_0x5083('0x72'),_0x5083('0x73'),_0x5083('0x74'),_0x5083('0x75'),_0x5083('0x76'),_0x5083('0x77'),'rtpaudioqosrttbridged','sipcallid','sipuri',_0x5083('0x78'),'bridgepvtcallid',_0x5083('0x79'),_0x5083('0x7a'),_0x5083('0x7b'),_0x5083('0x7c'),'membername',_0x5083('0x7d'),_0x5083('0x7e')];if(!_[_0x5083('0x7f')](_0x236ea1)&&!_[_0x5083('0x80')](_0x5bd52f,_0x236ea1)){if(_[_0x5083('0x1d')](this['variables'][_0x7cff1c])){this[_0x5083('0x2d')][_0x7cff1c]={};}this[_0x5083('0x2d')][_0x7cff1c][_0x236ea1]=_0x4edbe1;}};VoiceAgentReport[_0x5083('0x1b')]['syncHangup']=function(_0x4acf7e){try{if(this[_0x5083('0x1e')](_0x4acf7e)){logger[_0x5083('0x24')](_0x5083('0x81'),_0x4acf7e[_0x5083('0x21')],util['inspect'](_0x4acf7e,{'showHidden':![],'depth':null}));if(this[_0x5083('0x8')][_0x4acf7e[_0x5083('0x21')]]){for(var _0x1522aa in this['channels'][_0x4acf7e['uniqueid']]){if(this[_0x5083('0x8')][_0x4acf7e[_0x5083('0x21')]][_0x5083('0x39')](_0x1522aa)){if(this['channels'][_0x4acf7e[_0x5083('0x21')]][_0x1522aa][_0x5083('0x4d')]==_0x5083('0x82')&&this[_0x5083('0x8')][_0x4acf7e[_0x5083('0x21')]][_0x1522aa]['agentcomplete']){logger[_0x5083('0x1f')](_0x5083('0x83'),_0x4acf7e[_0x5083('0x21')],_0x1522aa);this[_0x5083('0x8')][_0x4acf7e['uniqueid']][_0x1522aa]['agentcompleteAt']=moment()[_0x5083('0x26')](_0x5083('0x27'));}}}logger[_0x5083('0x24')](_0x5083('0x84'),_0x4acf7e[_0x5083('0x21')],util[_0x5083('0x32')](_[_0x5083('0x85')](this[_0x5083('0x8')][_0x4acf7e[_0x5083('0x21')]]),{'showHidden':![],'depth':null}));ami[_0x5083('0x1c')](_0x5083('0x86'),_[_0x5083('0x85')](this['channels'][_0x4acf7e[_0x5083('0x21')]]));delete this[_0x5083('0x8')][_0x4acf7e[_0x5083('0x21')]];}if(this[_0x5083('0x2d')][_0x4acf7e[_0x5083('0x21')]]){delete this['variables'][_0x4acf7e[_0x5083('0x21')]];}}}catch(_0x1ab2c8){logger[_0x5083('0x36')](_0x5083('0x87'),_0x4acf7e['uniqueid'],util[_0x5083('0x32')](_0x1ab2c8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x5083('0x1b')]['syncAttendedTransfer']=function(_0x48df16){try{if(this['isNotNull'](_0x48df16)){logger['debug']('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x48df16['uniqueid'],util['inspect'](_0x48df16,{'showHidden':![],'depth':null}));if(this['channels'][_0x48df16[_0x5083('0x88')]]){for(var _0x44bcb6 in this['channels'][_0x48df16['transfereeuniqueid']]){if(this[_0x5083('0x8')][_0x48df16[_0x5083('0x88')]][_0x5083('0x39')](_0x44bcb6)){if(_0x48df16[_0x5083('0x89')]===_0x44bcb6){logger['info'](_0x5083('0x8a'),_0x48df16[_0x5083('0x21')],this[_0x5083('0x8')][_0x48df16[_0x5083('0x88')]][_0x44bcb6][_0x5083('0x22')],_0x44bcb6);var _0x4f0d58=moment();this[_0x5083('0x8')][_0x48df16[_0x5083('0x88')]][_0x44bcb6][_0x5083('0x11')]=!![];this[_0x5083('0x8')][_0x48df16[_0x5083('0x88')]][_0x44bcb6][_0x5083('0x60')]=moment()[_0x5083('0x26')](_0x5083('0x27'));this['channels'][_0x48df16[_0x5083('0x88')]][_0x44bcb6][_0x5083('0x40')]='complete';this[_0x5083('0x8')][_0x48df16[_0x5083('0x88')]][_0x44bcb6]['reason']=_0x5083('0x82');this[_0x5083('0x8')][_0x48df16['transfereeuniqueid']][_0x44bcb6][_0x5083('0x62')]=_0x4f0d58['diff'](this[_0x5083('0x8')][_0x48df16[_0x5083('0x88')]][_0x44bcb6][_0x5083('0x3b')],_0x5083('0x8b'));}}}}if(this[_0x5083('0x8')][_0x48df16[_0x5083('0x8c')]]){var _0x4d9599=this[_0x5083('0x8')][_0x48df16[_0x5083('0x8c')]];this[_0x5083('0x8')][_0x48df16[_0x5083('0x8c')]]=this[_0x5083('0x8')][_0x48df16[_0x5083('0x88')]];this['channels'][_0x48df16['transfereeuniqueid']]=_0x4d9599;}}}catch(_0x59ce1e){logger[_0x5083('0x36')](_0x5083('0x8d'),_0x48df16[_0x5083('0x21')],util[_0x5083('0x32')](_0x59ce1e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x5083('0x1b')][_0x5083('0x1a')]=function(_0x21cde9){try{if(this['isNotNull'](_0x21cde9)){logger[_0x5083('0x24')](_0x5083('0x8e'),_0x21cde9[_0x5083('0x21')],util[_0x5083('0x32')](_0x21cde9,{'showHidden':![],'depth':null}));if(this[_0x5083('0x8')][_0x21cde9['transfereeuniqueid']]){for(var _0x517879 in this[_0x5083('0x8')][_0x21cde9[_0x5083('0x88')]]){if(this['channels'][_0x21cde9['transfereeuniqueid']]['hasOwnProperty'](_0x517879)){if(_0x21cde9['transfereruniqueid']===_0x517879){logger['info'](_0x5083('0x8f'),_0x21cde9[_0x5083('0x21')],this[_0x5083('0x8')][_0x21cde9['transfereeuniqueid']][_0x517879][_0x5083('0x22')],_0x517879);var _0xc62e53=moment();this[_0x5083('0x8')][_0x21cde9[_0x5083('0x88')]][_0x517879]['agentcomplete']=!![];this[_0x5083('0x8')][_0x21cde9['transfereeuniqueid']][_0x517879][_0x5083('0x60')]=_0xc62e53;this['channels'][_0x21cde9[_0x5083('0x88')]][_0x517879][_0x5083('0x40')]=_0x5083('0x61');this[_0x5083('0x8')][_0x21cde9['transfereeuniqueid']][_0x517879][_0x5083('0x4d')]=_0x5083('0x82');this[_0x5083('0x8')][_0x21cde9['transfereeuniqueid']][_0x517879][_0x5083('0x62')]=_0xc62e53[_0x5083('0x90')](this[_0x5083('0x8')][_0x21cde9[_0x5083('0x88')]][_0x517879][_0x5083('0x3b')],_0x5083('0x8b'));}}}}}}catch(_0x56ef6e){logger['error'](_0x5083('0x91'),_0x21cde9['uniqueid'],util['inspect'](_0x56ef6e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x5083('0x1b')][_0x5083('0x15')]=function(_0x1b662e){var _0x525745='';try{if(this[_0x5083('0x1e')](_0x1b662e)){logger[_0x5083('0x24')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x1b662e[_0x5083('0x21')],util['inspect'](_0x1b662e,{'showHidden':![],'depth':null}));if(_0x1b662e[_0x5083('0x92')]){_0x525745=_0x1b662e[_0x5083('0x92')][_0x5083('0x93')](0x0,_0x1b662e[_0x5083('0x92')][_0x5083('0x94')]('-'));if(this[_0x5083('0xb')][_0x525745]){logger[_0x5083('0x1f')](_0x5083('0x95'),_0x1b662e[_0x5083('0x21')],_0x525745);this['agents'][_0x525745]['onhold']=!![];}}}}catch(_0x5e8975){logger[_0x5083('0x36')](_0x5083('0x96'),_0x1b662e['uniqueid'],util[_0x5083('0x32')](_0x5e8975,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x5083('0x1b')]['syncMusicOnHoldStop']=function(_0x25f116){var _0x103f67='';try{if(this[_0x5083('0x1e')](_0x25f116)){logger[_0x5083('0x24')](_0x5083('0x97'),_0x25f116['uniqueid'],util['inspect'](_0x25f116,{'showHidden':![],'depth':null}));if(_0x25f116['channel']){_0x103f67=_0x25f116[_0x5083('0x92')][_0x5083('0x93')](0x0,_0x25f116[_0x5083('0x92')][_0x5083('0x94')]('-'));if(this[_0x5083('0xb')][_0x103f67]){logger[_0x5083('0x1f')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x25f116['uniqueid'],_0x103f67);this['agents'][_0x103f67][_0x5083('0x98')]=![];}}}}catch(_0x48960a){logger[_0x5083('0x36')](_0x5083('0x99'),_0x25f116[_0x5083('0x21')],util['inspect'](_0x48960a,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0x307e=['rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','transfer','diff','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','substring','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/environment','ami','../ami','defaults','localhost','socket.io-emitter','redis','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','format','YYYY-MM-DD\x20HH:mm:ss','queue','inbound','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:called','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','routealias','interface','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','agentcomplete','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','error','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','agent','talktime','acw','acwtime','acwTimeout','agentacw','omit','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','addVariable','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss'];(function(_0x507cc5,_0xe4cebd){var _0x4d1919=function(_0x57b252){while(--_0x57b252){_0x507cc5['push'](_0x507cc5['shift']());}};_0x4d1919(++_0xe4cebd);}(_0x307e,0xc9));var _0xe307=function(_0x4eeb97,_0x10241b){_0x4eeb97=_0x4eeb97-0x0;var _0x11ec96=_0x307e[_0x4eeb97];return _0x11ec96;};'use strict';var _=require(_0xe307('0x0'));var moment=require(_0xe307('0x1'));var util=require(_0xe307('0x2'));var Redis=require(_0xe307('0x3'));var config=require(_0xe307('0x4'));var logger=require('../../../config/logger')(_0xe307('0x5'));var ami=require(_0xe307('0x6'));config['redis']=_[_0xe307('0x7')](config['redis'],{'host':_0xe307('0x8'),'port':0x18eb});var io=require(_0xe307('0x9'))(new Redis(config[_0xe307('0xa')]));function VoiceAgentReport(_0x59e5b7){this[_0xe307('0xb')]={};this[_0xe307('0xc')]=_0x59e5b7[_0xe307('0xb')];this[_0xe307('0xd')]=_0x59e5b7[_0xe307('0xd')];this[_0xe307('0xe')]=_0x59e5b7[_0xe307('0xe')];this[_0xe307('0xf')]={};ami['on'](_0xe307('0x10'),this[_0xe307('0x11')][_0xe307('0x12')](this));ami['on'](_0xe307('0x13'),this[_0xe307('0x14')][_0xe307('0x12')](this));ami['on'](_0xe307('0x15'),this[_0xe307('0x16')][_0xe307('0x12')](this));ami['on'](_0xe307('0x17'),this[_0xe307('0x18')][_0xe307('0x12')](this));ami['on']('agentcomplete',this[_0xe307('0x19')][_0xe307('0x12')](this));ami['on']('varset',this[_0xe307('0x1a')][_0xe307('0x12')](this));ami['on'](_0xe307('0x1b'),this[_0xe307('0x1c')][_0xe307('0x12')](this));ami['on'](_0xe307('0x1d'),this[_0xe307('0x1e')]['bind'](this));ami['on'](_0xe307('0x1f'),this[_0xe307('0x20')][_0xe307('0x12')](this));ami['on'](_0xe307('0x21'),this[_0xe307('0x22')]['bind'](this));ami['on']('blindtransfer',this[_0xe307('0x23')]['bind'](this));}VoiceAgentReport[_0xe307('0x24')][_0xe307('0x25')]=function(_0xe8354d,_0x24683b,_0x40e290){io['to'](_0xe8354d)[_0xe307('0x25')](_0x24683b,_0x40e290);};VoiceAgentReport[_0xe307('0x24')][_0xe307('0x26')]=function(_0x1f3cf3){return _0x1f3cf3!==null&&!_[_0xe307('0x27')](_0x1f3cf3);};VoiceAgentReport[_0xe307('0x24')][_0xe307('0x11')]=function(_0x394bde){try{if(this[_0xe307('0x26')](_0x394bde)){logger[_0xe307('0x28')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x394bde[_0xe307('0x29')],_0x394bde[_0xe307('0x2a')],_0x394bde[_0xe307('0x2b')]);logger[_0xe307('0x2c')](_0xe307('0x2d'),_0x394bde[_0xe307('0x29')],util[_0xe307('0x2e')](_0x394bde,{'showHidden':![],'depth':null}));if(_[_0xe307('0x27')](this[_0xe307('0xb')][_0x394bde[_0xe307('0x29')]])){this['channels'][_0x394bde['uniqueid']]={};}if(_[_0xe307('0x27')](this[_0xe307('0xb')][_0x394bde[_0xe307('0x29')]][_0x394bde[_0xe307('0x2b')]])){this[_0xe307('0xb')][_0x394bde[_0xe307('0x29')]][_0x394bde[_0xe307('0x2b')]]={'agentcalledAt':moment()[_0xe307('0x2f')](_0xe307('0x30')),'lastevent':'called','mandatoryDisposition':this[_0xe307('0xd')][_0x394bde[_0xe307('0x31')]]?this['voiceQueues'][_0x394bde[_0xe307('0x31')]]['mandatoryDisposition']||![]:![],'type':this['voiceQueues'][_0x394bde[_0xe307('0x31')]]?this[_0xe307('0xd')][_0x394bde[_0xe307('0x31')]]['type']||_0xe307('0x32'):'inbound','variables':this[_0xe307('0xf')][_0x394bde['uniqueid']],'motionChannel':'voice'};}_['merge'](this['channels'][_0x394bde[_0xe307('0x29')]][_0x394bde[_0xe307('0x2b')]],_['omit'](_0x394bde,[_0xe307('0x33'),_0xe307('0x34')]));logger[_0xe307('0x2c')](_0xe307('0x35'),_0x394bde['uniqueid'],util[_0xe307('0x2e')](this['channels'][_0x394bde['uniqueid']][_0x394bde[_0xe307('0x2b')]],{'showHidden':![],'depth':null}));ami[_0xe307('0x25')](_0xe307('0x36'),this[_0xe307('0xb')][_0x394bde['uniqueid']][_0x394bde[_0xe307('0x2b')]]);logger['debug'](_0xe307('0x37'),_0x394bde[_0xe307('0x29')],util['inspect'](this[_0xe307('0xb')][_0x394bde[_0xe307('0x29')]][_0x394bde[_0xe307('0x2b')]],{'showHidden':![],'depth':null}));this[_0xe307('0x25')](util['format']('user:%s',_0x394bde[_0xe307('0x2a')]),_0xe307('0x38'),this['channels'][_0x394bde[_0xe307('0x29')]][_0x394bde[_0xe307('0x2b')]]);}}catch(_0x448569){logger['error'](_0xe307('0x39'),_0x394bde[_0xe307('0x29')],util['inspect'](_0x448569,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentConnect']=function(_0x300ce0){try{if(this['isNotNull'](_0x300ce0)){if(this[_0xe307('0xb')][_0x300ce0[_0xe307('0x29')]]){logger[_0xe307('0x2c')](_0xe307('0x3a'),_0x300ce0['uniqueid'],util[_0xe307('0x2e')](_0x300ce0,{'showHidden':![],'depth':null}));for(var _0xd3a160 in this['channels'][_0x300ce0['uniqueid']]){if(this[_0xe307('0xb')][_0x300ce0['uniqueid']]['hasOwnProperty'](_0xd3a160)){if(_0x300ce0[_0xe307('0x2b')]===_0xd3a160){logger[_0xe307('0x28')](_0xe307('0x3b'),_0x300ce0[_0xe307('0x29')],_0x300ce0[_0xe307('0x2a')],_0x300ce0['destuniqueid']);this['channels'][_0x300ce0[_0xe307('0x29')]][_0xd3a160][_0xe307('0x3c')]=moment()[_0xe307('0x2f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xe307('0xb')][_0x300ce0[_0xe307('0x29')]][_0xd3a160]['connectedlinename']=_0x300ce0[_0xe307('0x3d')];this['channels'][_0x300ce0[_0xe307('0x29')]][_0xd3a160]['connectedlinenum']=_0x300ce0['connectedlinenum'];this[_0xe307('0xb')][_0x300ce0['uniqueid']][_0xd3a160][_0xe307('0x3e')]=_0x300ce0[_0xe307('0x3e')];this[_0xe307('0xb')][_0x300ce0[_0xe307('0x29')]][_0xd3a160][_0xe307('0x3f')]=_0x300ce0[_0xe307('0x3f')];this[_0xe307('0xb')][_0x300ce0[_0xe307('0x29')]][_0xd3a160]['holdtime']=_0x300ce0[_0xe307('0x40')];this[_0xe307('0xb')][_0x300ce0[_0xe307('0x29')]][_0xd3a160][_0xe307('0x41')]=_0xe307('0x42');if(this[_0xe307('0xc')][this[_0xe307('0xb')][_0x300ce0[_0xe307('0x29')]][_0xd3a160][_0xe307('0x29')]]){var _0x523e6e=this[_0xe307('0xc')][this[_0xe307('0xb')][_0x300ce0[_0xe307('0x29')]][_0xd3a160][_0xe307('0x29')]][_0xe307('0x43')];this[_0xe307('0xb')][_0x300ce0[_0xe307('0x29')]][_0xd3a160]['routealias']=_0x523e6e;_0x300ce0[_0xe307('0x43')]=_0x523e6e;}_['merge'](this[_0xe307('0xe')][_0x300ce0[_0xe307('0x44')]],_['pick'](_0x300ce0,['queue',_0xe307('0x45'),_0xe307('0x43')]));logger[_0xe307('0x2c')](_0xe307('0x46'),_0x300ce0['uniqueid'],util[_0xe307('0x2e')](this[_0xe307('0xb')][_0x300ce0[_0xe307('0x29')]][_0x300ce0[_0xe307('0x2b')]],{'showHidden':![],'depth':null}));ami[_0xe307('0x25')](_0xe307('0x47'),this['channels'][_0x300ce0[_0xe307('0x29')]][_0x300ce0[_0xe307('0x2b')]]);logger[_0xe307('0x2c')](_0xe307('0x48'),_0x300ce0[_0xe307('0x29')],util[_0xe307('0x2e')](this[_0xe307('0xb')][_0x300ce0[_0xe307('0x29')]][_0x300ce0[_0xe307('0x2b')]],{'showHidden':![],'depth':null}));this[_0xe307('0x25')](util['format'](_0xe307('0x49'),_0x300ce0['membername']),_0xe307('0x4a'),this[_0xe307('0xb')][_0x300ce0[_0xe307('0x29')]][_0x300ce0[_0xe307('0x2b')]]);}else if(!this[_0xe307('0xb')][_0x300ce0[_0xe307('0x29')]][_0xd3a160]['agentringnoanswer']&&!this[_0xe307('0xb')][_0x300ce0['uniqueid']][_0xd3a160][_0xe307('0x4b')]){logger[_0xe307('0x28')](_0xe307('0x4c'),_0x300ce0['uniqueid'],this['channels'][_0x300ce0[_0xe307('0x29')]][_0xd3a160][_0xe307('0x2a')],_0xd3a160);this[_0xe307('0xb')][_0x300ce0[_0xe307('0x29')]][_0xd3a160]['agentringnoanswer']=!![];this[_0xe307('0xb')][_0x300ce0['uniqueid']][_0xd3a160][_0xe307('0x4d')]=moment()[_0xe307('0x2f')](_0xe307('0x30'));this['channels'][_0x300ce0[_0xe307('0x29')]][_0xd3a160][_0xe307('0x4e')]=_0x300ce0[_0xe307('0x2b')];this[_0xe307('0xb')][_0x300ce0['uniqueid']][_0xd3a160][_0xe307('0x4f')]=_0x300ce0[_0xe307('0x2a')];this[_0xe307('0xb')][_0x300ce0[_0xe307('0x29')]][_0xd3a160]['lastevent']=_0xe307('0x50');this[_0xe307('0xb')][_0x300ce0[_0xe307('0x29')]][_0xd3a160][_0xe307('0x51')]='answered_elsewhere';logger[_0xe307('0x2c')](_0xe307('0x52'),_0x300ce0[_0xe307('0x29')],util[_0xe307('0x2e')](this[_0xe307('0xb')][_0x300ce0['uniqueid']][_0xd3a160],{'showHidden':![],'depth':null}));ami[_0xe307('0x25')]('custom:agentansweredelsewhere',this[_0xe307('0xb')][_0x300ce0[_0xe307('0x29')]][_0xd3a160]);}}}}}}catch(_0x56159f){logger[_0xe307('0x53')](_0xe307('0x54'),_0x300ce0[_0xe307('0x29')],util[_0xe307('0x2e')](_0x56159f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe307('0x24')][_0xe307('0x16')]=function(_0x276c6f){try{if(this[_0xe307('0x26')](_0x276c6f)){logger[_0xe307('0x2c')](_0xe307('0x55'),_0x276c6f[_0xe307('0x29')],util['inspect'](_0x276c6f,{'showHidden':![],'depth':null}));if(this[_0xe307('0xb')][_0x276c6f['uniqueid']]&&this[_0xe307('0xb')][_0x276c6f['uniqueid']][_0x276c6f['destuniqueid']]){logger[_0xe307('0x28')](_0xe307('0x56'),_0x276c6f[_0xe307('0x29')],_0x276c6f['membername'],_0x276c6f[_0xe307('0x2b')]);this[_0xe307('0xb')][_0x276c6f[_0xe307('0x29')]][_0x276c6f[_0xe307('0x2b')]]['agentringnoanswer']=!![];this['channels'][_0x276c6f[_0xe307('0x29')]][_0x276c6f[_0xe307('0x2b')]][_0xe307('0x4d')]=moment()[_0xe307('0x2f')](_0xe307('0x30'));this[_0xe307('0xb')][_0x276c6f[_0xe307('0x29')]][_0x276c6f[_0xe307('0x2b')]][_0xe307('0x41')]=_0xe307('0x57');this[_0xe307('0xb')][_0x276c6f[_0xe307('0x29')]][_0x276c6f['destuniqueid']][_0xe307('0x51')]=_0xe307('0x57');logger['debug'](_0xe307('0x58'),_0x276c6f[_0xe307('0x29')],util[_0xe307('0x2e')](this['channels'][_0x276c6f[_0xe307('0x29')]][_0x276c6f[_0xe307('0x2b')]],{'showHidden':![],'depth':null}));ami[_0xe307('0x25')]('custom:agentringnoanswer',this['channels'][_0x276c6f[_0xe307('0x29')]][_0x276c6f[_0xe307('0x2b')]]);}}}catch(_0xe18843){logger[_0xe307('0x53')](_0xe307('0x59'),_0x276c6f['uniqueid'],util[_0xe307('0x2e')](_0xe18843,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe307('0x24')][_0xe307('0x18')]=function(_0x1d9baf){try{if(this[_0xe307('0x26')](_0x1d9baf)){logger[_0xe307('0x2c')](_0xe307('0x5a'),_0x1d9baf[_0xe307('0x29')],util['inspect'](_0x1d9baf,{'showHidden':![],'depth':null}));if(this[_0xe307('0xb')][_0x1d9baf[_0xe307('0x29')]]){for(var _0x59d32f in this[_0xe307('0xb')][_0x1d9baf[_0xe307('0x29')]]){if(this['channels'][_0x1d9baf['uniqueid']][_0xe307('0x5b')](_0x59d32f)&&!this[_0xe307('0xb')][_0x1d9baf[_0xe307('0x29')]][_0x59d32f][_0xe307('0x15')]&&!this[_0xe307('0xb')][_0x1d9baf[_0xe307('0x29')]][_0x59d32f]['agentcomplete']){logger['info'](_0xe307('0x5c'),_0x1d9baf[_0xe307('0x29')],this['channels'][_0x1d9baf[_0xe307('0x29')]][_0x59d32f][_0xe307('0x2a')],_0x59d32f);this['channels'][_0x1d9baf[_0xe307('0x29')]][_0x59d32f][_0xe307('0x15')]=!![];this[_0xe307('0xb')][_0x1d9baf[_0xe307('0x29')]][_0x59d32f][_0xe307('0x4d')]=moment()[_0xe307('0x2f')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x1d9baf[_0xe307('0x29')]][_0x59d32f][_0xe307('0x41')]=_0xe307('0x5d');this[_0xe307('0xb')][_0x1d9baf['uniqueid']][_0x59d32f][_0xe307('0x51')]=_0xe307('0x5d');logger[_0xe307('0x2c')](_0xe307('0x5e'),_0x1d9baf[_0xe307('0x29')],util[_0xe307('0x2e')](this[_0xe307('0xb')][_0x1d9baf['uniqueid']][_0x59d32f],{'showHidden':![],'depth':null}));ami['emit']('custom:agentqueuecallerabandon',this[_0xe307('0xb')][_0x1d9baf[_0xe307('0x29')]][_0x59d32f]);}}}}}catch(_0x7a5148){logger[_0xe307('0x53')](_0xe307('0x5f'),_0x1d9baf[_0xe307('0x29')],util[_0xe307('0x2e')](_0x7a5148,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe307('0x24')][_0xe307('0x19')]=function(_0x505d90){try{if(this[_0xe307('0x26')](_0x505d90)){logger[_0xe307('0x2c')](_0xe307('0x60'),_0x505d90[_0xe307('0x29')],util[_0xe307('0x2e')](_0x505d90,{'showHidden':![],'depth':null}));if(this['channels'][_0x505d90[_0xe307('0x29')]]){for(var _0x30c84a in this[_0xe307('0xb')][_0x505d90['uniqueid']]){if(this[_0xe307('0xb')][_0x505d90[_0xe307('0x29')]]['hasOwnProperty'](_0x30c84a)){if(this[_0xe307('0xb')][_0x505d90[_0xe307('0x29')]][_0x30c84a][_0xe307('0x3c')]&&!this['channels'][_0x505d90[_0xe307('0x29')]][_0x30c84a][_0xe307('0x4b')]){logger['info'](_0xe307('0x61'),_0x505d90['uniqueid'],this[_0xe307('0xb')][_0x505d90[_0xe307('0x29')]][_0x30c84a][_0xe307('0x2a')],_0x30c84a);this[_0xe307('0xb')][_0x505d90[_0xe307('0x29')]][_0x30c84a][_0xe307('0x4b')]=!![];this[_0xe307('0xb')][_0x505d90[_0xe307('0x29')]][_0x30c84a][_0xe307('0x62')]=moment()[_0xe307('0x2f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xe307('0xb')][_0x505d90['uniqueid']][_0x30c84a][_0xe307('0x41')]='complete';this[_0xe307('0xb')][_0x505d90['uniqueid']][_0x30c84a][_0xe307('0x51')]=_0x505d90[_0xe307('0x51')]=='transfer'?_0xe307('0x63'):_0x505d90[_0xe307('0x51')];this[_0xe307('0xb')][_0x505d90[_0xe307('0x29')]][_0x30c84a]['talktime']=_0x505d90[_0xe307('0x64')];if(this[_0xe307('0xd')][_0x505d90[_0xe307('0x31')]]&&this[_0xe307('0xd')][_0x505d90[_0xe307('0x31')]][_0xe307('0x65')]){this[_0xe307('0xb')][_0x505d90[_0xe307('0x29')]][_0x30c84a][_0xe307('0x66')]=this[_0xe307('0xd')][_0x505d90[_0xe307('0x31')]][_0xe307('0x67')];this[_0xe307('0xb')][_0x505d90['uniqueid']][_0x30c84a][_0xe307('0x68')]=!![];}this['agents'][_0x505d90[_0xe307('0x44')]]=_[_0xe307('0x69')](this[_0xe307('0xe')][_0x505d90[_0xe307('0x44')]],['queue','destconnectedlinenum']);logger[_0xe307('0x2c')](_0xe307('0x6a'),_0x505d90['uniqueid'],util[_0xe307('0x2e')](this[_0xe307('0xb')][_0x505d90[_0xe307('0x29')]][_0x30c84a],{'showHidden':![],'depth':null}));ami[_0xe307('0x25')]('custom:agentcomplete',this[_0xe307('0xb')][_0x505d90[_0xe307('0x29')]][_0x30c84a]);logger['debug'](_0xe307('0x6b'),_0x505d90[_0xe307('0x29')],util[_0xe307('0x2e')](this[_0xe307('0xb')][_0x505d90[_0xe307('0x29')]][_0x30c84a],{'showHidden':![],'depth':null}));this['emit'](util[_0xe307('0x2f')](_0xe307('0x49'),_0x505d90[_0xe307('0x2a')]),_0xe307('0x6c'),this[_0xe307('0xb')][_0x505d90[_0xe307('0x29')]][_0x30c84a]);}}}}}}catch(_0x34af49){logger[_0xe307('0x53')](_0xe307('0x6d'),_0x505d90[_0xe307('0x29')],util[_0xe307('0x2e')](_0x34af49,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe307('0x24')][_0xe307('0x1a')]=function(_0x3bec27){try{if(this['isNotNull'](_0x3bec27)){logger[_0xe307('0x2c')]('[%s][voiceAgentReport][varset]\x20event:',_0x3bec27[_0xe307('0x29')],util[_0xe307('0x2e')](_0x3bec27,{'showHidden':![],'depth':null}));this[_0xe307('0x6e')](_0x3bec27['uniqueid'],_['keys'](_0x3bec27[_0xe307('0x6f')])[0x0],_0x3bec27[_0xe307('0x70')]);if(this[_0xe307('0xb')][_0x3bec27[_0xe307('0x29')]]){for(var _0x3e9a12 in this[_0xe307('0xb')][_0x3bec27['uniqueid']]){if(this[_0xe307('0xb')][_0x3bec27[_0xe307('0x29')]]['hasOwnProperty'](_0x3e9a12)){logger[_0xe307('0x28')](_0xe307('0x71'),_0x3bec27[_0xe307('0x29')],_0x3e9a12,_['keys'](_0x3bec27['variable'])[0x0],_0x3bec27[_0xe307('0x70')]);if(_['isUndefined'](this['channels'][_0x3bec27[_0xe307('0x29')]][_0x3e9a12][_0xe307('0xf')])){this['channels'][_0x3bec27[_0xe307('0x29')]][_0x3e9a12]['variables']={};}this['channels'][_0x3bec27[_0xe307('0x29')]][_0x3e9a12][_0xe307('0xf')]=this[_0xe307('0xf')][_0x3bec27[_0xe307('0x29')]];}}}}}catch(_0xefdec0){logger[_0xe307('0x53')](_0xe307('0x72'),_0x3bec27[_0xe307('0x29')],util[_0xe307('0x2e')](_0xefdec0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe307('0x24')]['addVariable']=function(_0x1be794,_0x1b047f,_0x16e611){var _0x52c34c=[_0xe307('0x73'),_0xe307('0x74'),'rtpaudioqosjitter',_0xe307('0x75'),_0xe307('0x76'),_0xe307('0x77'),_0xe307('0x78'),_0xe307('0x79'),_0xe307('0x7a'),_0xe307('0x7b'),_0xe307('0x7c'),_0xe307('0x7d'),'membercalls','memberdynamic','memberinterface',_0xe307('0x7e'),_0xe307('0x2a'),_0xe307('0x7f'),_0xe307('0x80')];if(!_[_0xe307('0x81')](_0x1b047f)&&!_[_0xe307('0x82')](_0x52c34c,_0x1b047f)){if(_[_0xe307('0x27')](this['variables'][_0x1be794])){this[_0xe307('0xf')][_0x1be794]={};}this['variables'][_0x1be794][_0x1b047f]=_0x16e611;}};VoiceAgentReport['prototype'][_0xe307('0x1c')]=function(_0x136368){try{if(this['isNotNull'](_0x136368)){logger[_0xe307('0x2c')](_0xe307('0x83'),_0x136368[_0xe307('0x29')],util['inspect'](_0x136368,{'showHidden':![],'depth':null}));if(this[_0xe307('0xb')][_0x136368[_0xe307('0x29')]]){for(var _0x5e8301 in this[_0xe307('0xb')][_0x136368[_0xe307('0x29')]]){if(this[_0xe307('0xb')][_0x136368[_0xe307('0x29')]][_0xe307('0x5b')](_0x5e8301)){if(this['channels'][_0x136368[_0xe307('0x29')]][_0x5e8301][_0xe307('0x51')]=='transfer'&&this[_0xe307('0xb')][_0x136368[_0xe307('0x29')]][_0x5e8301][_0xe307('0x4b')]){logger[_0xe307('0x28')](_0xe307('0x84'),_0x136368[_0xe307('0x29')],_0x5e8301);this['channels'][_0x136368[_0xe307('0x29')]][_0x5e8301][_0xe307('0x62')]=moment()[_0xe307('0x2f')](_0xe307('0x30'));}}}logger[_0xe307('0x2c')](_0xe307('0x85'),_0x136368[_0xe307('0x29')],util[_0xe307('0x2e')](_[_0xe307('0x86')](this[_0xe307('0xb')][_0x136368['uniqueid']]),{'showHidden':![],'depth':null}));ami['emit'](_0xe307('0x87'),_['values'](this['channels'][_0x136368[_0xe307('0x29')]]));delete this[_0xe307('0xb')][_0x136368['uniqueid']];}if(this['variables'][_0x136368[_0xe307('0x29')]]){delete this['variables'][_0x136368[_0xe307('0x29')]];}}}catch(_0x4e6395){logger[_0xe307('0x53')](_0xe307('0x88'),_0x136368['uniqueid'],util[_0xe307('0x2e')](_0x4e6395,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe307('0x24')][_0xe307('0x22')]=function(_0x15d0d8){try{if(this[_0xe307('0x26')](_0x15d0d8)){logger['debug']('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x15d0d8[_0xe307('0x29')],util['inspect'](_0x15d0d8,{'showHidden':![],'depth':null}));if(this[_0xe307('0xb')][_0x15d0d8[_0xe307('0x89')]]){for(var _0x1a674b in this[_0xe307('0xb')][_0x15d0d8['transfereeuniqueid']]){if(this[_0xe307('0xb')][_0x15d0d8[_0xe307('0x89')]][_0xe307('0x5b')](_0x1a674b)){if(_0x15d0d8[_0xe307('0x8a')]===_0x1a674b){logger[_0xe307('0x28')](_0xe307('0x8b'),_0x15d0d8[_0xe307('0x29')],this['channels'][_0x15d0d8[_0xe307('0x89')]][_0x1a674b]['membername'],_0x1a674b);var _0x2bd1e9=moment();this[_0xe307('0xb')][_0x15d0d8[_0xe307('0x89')]][_0x1a674b][_0xe307('0x4b')]=!![];this[_0xe307('0xb')][_0x15d0d8['transfereeuniqueid']][_0x1a674b][_0xe307('0x62')]=moment()['format'](_0xe307('0x30'));this[_0xe307('0xb')][_0x15d0d8[_0xe307('0x89')]][_0x1a674b]['lastevent']=_0xe307('0x8c');this[_0xe307('0xb')][_0x15d0d8['transfereeuniqueid']][_0x1a674b][_0xe307('0x51')]='transfer';this['channels'][_0x15d0d8[_0xe307('0x89')]][_0x1a674b][_0xe307('0x64')]=_0x2bd1e9['diff'](this[_0xe307('0xb')][_0x15d0d8[_0xe307('0x89')]][_0x1a674b]['agentconnectAt'],_0xe307('0x8d'));}}}}if(this[_0xe307('0xb')][_0x15d0d8[_0xe307('0x8e')]]){var _0x2a91fa=this[_0xe307('0xb')][_0x15d0d8[_0xe307('0x8e')]];this[_0xe307('0xb')][_0x15d0d8[_0xe307('0x8e')]]=this[_0xe307('0xb')][_0x15d0d8[_0xe307('0x89')]];this[_0xe307('0xb')][_0x15d0d8[_0xe307('0x89')]]=_0x2a91fa;}}}catch(_0x43321f){logger['error'](_0xe307('0x8f'),_0x15d0d8['uniqueid'],util[_0xe307('0x2e')](_0x43321f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe307('0x24')][_0xe307('0x23')]=function(_0x5eaec6){try{if(this[_0xe307('0x26')](_0x5eaec6)){logger[_0xe307('0x2c')](_0xe307('0x90'),_0x5eaec6['uniqueid'],util[_0xe307('0x2e')](_0x5eaec6,{'showHidden':![],'depth':null}));if(this[_0xe307('0xb')][_0x5eaec6['transfereeuniqueid']]){for(var _0x4d7c5a in this[_0xe307('0xb')][_0x5eaec6[_0xe307('0x89')]]){if(this[_0xe307('0xb')][_0x5eaec6['transfereeuniqueid']][_0xe307('0x5b')](_0x4d7c5a)){if(_0x5eaec6[_0xe307('0x91')]===_0x4d7c5a){logger[_0xe307('0x28')](_0xe307('0x92'),_0x5eaec6[_0xe307('0x29')],this[_0xe307('0xb')][_0x5eaec6[_0xe307('0x89')]][_0x4d7c5a][_0xe307('0x2a')],_0x4d7c5a);var _0x5039f1=moment();this[_0xe307('0xb')][_0x5eaec6[_0xe307('0x89')]][_0x4d7c5a][_0xe307('0x4b')]=!![];this[_0xe307('0xb')][_0x5eaec6['transfereeuniqueid']][_0x4d7c5a][_0xe307('0x62')]=_0x5039f1;this[_0xe307('0xb')][_0x5eaec6[_0xe307('0x89')]][_0x4d7c5a][_0xe307('0x41')]='complete';this[_0xe307('0xb')][_0x5eaec6['transfereeuniqueid']][_0x4d7c5a]['reason']=_0xe307('0x93');this[_0xe307('0xb')][_0x5eaec6['transfereeuniqueid']][_0x4d7c5a]['talktime']=_0x5039f1[_0xe307('0x94')](this[_0xe307('0xb')][_0x5eaec6[_0xe307('0x89')]][_0x4d7c5a][_0xe307('0x3c')],_0xe307('0x8d'));}}}}}}catch(_0x4cbc1b){logger['error'](_0xe307('0x95'),_0x5eaec6[_0xe307('0x29')],util[_0xe307('0x2e')](_0x4cbc1b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe307('0x24')][_0xe307('0x1e')]=function(_0x5d4e9c){var _0x3e6de4='';try{if(this[_0xe307('0x26')](_0x5d4e9c)){logger[_0xe307('0x2c')](_0xe307('0x96'),_0x5d4e9c['uniqueid'],util[_0xe307('0x2e')](_0x5d4e9c,{'showHidden':![],'depth':null}));if(_0x5d4e9c[_0xe307('0x97')]){_0x3e6de4=_0x5d4e9c[_0xe307('0x97')]['substring'](0x0,_0x5d4e9c['channel'][_0xe307('0x98')]('-'));if(this['agents'][_0x3e6de4]){logger['info'](_0xe307('0x99'),_0x5d4e9c[_0xe307('0x29')],_0x3e6de4);this['agents'][_0x3e6de4][_0xe307('0x9a')]=!![];}}}}catch(_0x473772){logger[_0xe307('0x53')](_0xe307('0x9b'),_0x5d4e9c[_0xe307('0x29')],util['inspect'](_0x473772,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe307('0x24')][_0xe307('0x20')]=function(_0x579345){var _0x322f9c='';try{if(this['isNotNull'](_0x579345)){logger[_0xe307('0x2c')](_0xe307('0x9c'),_0x579345[_0xe307('0x29')],util[_0xe307('0x2e')](_0x579345,{'showHidden':![],'depth':null}));if(_0x579345[_0xe307('0x97')]){_0x322f9c=_0x579345[_0xe307('0x97')][_0xe307('0x9d')](0x0,_0x579345[_0xe307('0x97')][_0xe307('0x98')]('-'));if(this[_0xe307('0xe')][_0x322f9c]){logger[_0xe307('0x28')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x579345[_0xe307('0x29')],_0x322f9c);this['agents'][_0x322f9c][_0xe307('0x9a')]=![];}}}}catch(_0xf7115c){logger[_0xe307('0x53')](_0xe307('0x9e'),_0x579345['uniqueid'],util[_0xe307('0x2e')](_0xf7115c,{'showHidden':![],'depth':null}));}};module[_0xe307('0x9f')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 37e1f53..2ea9b59 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2021=['../../../config/environment','../../../config/logger','../rpc/setting','unknown','inuse','busy','invalid','unavailable','onhold','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','syncNewState','syncVarSet','hangup','syncHangup','newcallerid','syncAttendedTransfer','syncBlindTransfer','syncMusicOnHoldStart','musiconholdstop','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','inspect','prototype','isNotNull','emit','syncNewCallerId','info','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','isUndefined','merge','pick','keys','context','channel','split','xcally-motion-preview','destconnectedlinenum','connectedlinenum','user:%s','name','accountcode','[%s][voiceCallReport][newcallerid]','debug','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','exten','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','format','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','includes','lastapplication','lastdata','startsWith','cdr(','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answertime','holdtime','diff','connectedlinename','destinationchannel','toNumber','membername','UserId','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','xmcs-queue','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','from-sip','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','then','transferType','isEmpty','getSettings','stopRecordingOnTransfer','resolve','Action','StopMixMonitor','catch','webbar:stopmonitors','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','some','origtransfererlinkedid','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','isNil','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','ioredis'];(function(_0x5b955c,_0x1b03c0){var _0x28028a=function(_0xd7775d){while(--_0xd7775d){_0x5b955c['push'](_0x5b955c['shift']());}};_0x28028a(++_0x1b03c0);}(_0x2021,0x197));var _0x1202=function(_0x232f66,_0x4f8c2c){_0x232f66=_0x232f66-0x0;var _0x21d57d=_0x2021[_0x232f66];return _0x21d57d;};'use strict';var BPromise=require('bluebird');var _=require(_0x1202('0x0'));var moment=require(_0x1202('0x1'));var util=require(_0x1202('0x2'));var path=require(_0x1202('0x3'));var Redis=require(_0x1202('0x4'));var config=require(_0x1202('0x5'));var logger=require(_0x1202('0x6'))('ami');var ami=require('../ami');var Channel=require('../model/channel');var RpcSetting=require(_0x1202('0x7'));var statusDesc=[_0x1202('0x8'),'not_inuse',_0x1202('0x9'),_0x1202('0xa'),_0x1202('0xb'),_0x1202('0xc'),'ringing','ringinuse',_0x1202('0xd')];var applications=[_0x1202('0xe'),_0x1202('0xf'),_0x1202('0x10'),_0x1202('0x11'),_0x1202('0x12'),_0x1202('0x13')];var dispositions=[_0x1202('0x14'),_0x1202('0x15'),_0x1202('0x15'),_0x1202('0x14'),_0x1202('0x14'),'NO\x20ANSWER','ANSWERED',_0x1202('0x16'),_0x1202('0x15'),'FAILED','FAILED'];var actions={};config[_0x1202('0x17')]=_['defaults'](config[_0x1202('0x17')],{'host':_0x1202('0x18'),'port':0x18eb});var io=require(_0x1202('0x19'))(new Redis(config[_0x1202('0x17')]));function VoiceCallReport(_0x22163c){this['channels']=_0x22163c[_0x1202('0x1a')];this[_0x1202('0x1b')]=_0x22163c[_0x1202('0x1b')];this[_0x1202('0x1c')]={};ami['on'](_0x1202('0x1d'),this[_0x1202('0x1e')][_0x1202('0x1f')](this));ami['on'](_0x1202('0x20'),this['syncNewExten'][_0x1202('0x1f')](this));ami['on'](_0x1202('0x21'),this[_0x1202('0x22')]['bind'](this));ami['on']('newstate',this[_0x1202('0x23')]['bind'](this));ami['on']('varset',this[_0x1202('0x24')]['bind'](this));ami['on'](_0x1202('0x25'),this[_0x1202('0x26')][_0x1202('0x1f')](this));ami['on'](_0x1202('0x27'),this['syncNewCallerId']['bind'](this));ami['on']('attendedtransfer',this[_0x1202('0x28')][_0x1202('0x1f')](this));ami['on']('blindtransfer',this[_0x1202('0x29')][_0x1202('0x1f')](this));ami['on']('musiconholdstart',this[_0x1202('0x2a')][_0x1202('0x1f')](this));ami['on'](_0x1202('0x2b'),this['syncMusicOnHoldStop'][_0x1202('0x1f')](this));try{logger['info'](_0x1202('0x2c'));ami[_0x1202('0x2d')]();}catch(_0x166c1e){logger[_0x1202('0x2e')]('[voiceCallReport][coreshowchannels]',util[_0x1202('0x2f')](_0x166c1e,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x1202('0x30')][_0x1202('0x31')]=function(_0x205b3e){return _0x205b3e!==null&&!_['isUndefined'](_0x205b3e);};VoiceCallReport[_0x1202('0x30')][_0x1202('0x32')]=function(_0x59e27a,_0x1204d8,_0x522a33){io['to'](_0x59e27a)[_0x1202('0x32')](_0x1204d8,_0x522a33);};VoiceCallReport[_0x1202('0x30')][_0x1202('0x33')]=function(_0x5ef60a){try{if(this[_0x1202('0x31')](_0x5ef60a)){logger[_0x1202('0x34')](_0x1202('0x35'),_0x5ef60a[_0x1202('0x36')],_0x5ef60a[_0x1202('0x37')],_0x5ef60a[_0x1202('0x38')]);logger['debug'](_0x1202('0x39'),_0x5ef60a[_0x1202('0x36')],util[_0x1202('0x2f')](_0x5ef60a,{'showHidden':![],'depth':null}));if(_0x5ef60a[_0x1202('0x36')]===_0x5ef60a[_0x1202('0x3a')]){if(!_[_0x1202('0x3b')](this[_0x1202('0x1a')][_0x5ef60a[_0x1202('0x36')]])){_[_0x1202('0x3c')](this[_0x1202('0x1a')][_0x5ef60a['uniqueid']],_[_0x1202('0x3d')](_0x5ef60a,_[_0x1202('0x3e')](this['channels'][_0x5ef60a[_0x1202('0x36')]])));}}if(_0x5ef60a[_0x1202('0x3f')]==='from-sip'){if(this[_0x1202('0x1b')][_0x5ef60a[_0x1202('0x40')][_0x1202('0x41')]('-')[0x0]]){if(_0x5ef60a['exten']==_0x1202('0x42')){this[_0x1202('0x1b')][_0x5ef60a[_0x1202('0x40')][_0x1202('0x41')]('-')[0x0]][_0x1202('0x43')]=_0x5ef60a[_0x1202('0x44')];this[_0x1202('0x32')](util['format'](_0x1202('0x45'),this['agents'][_0x5ef60a[_0x1202('0x40')]['split']('-')[0x0]][_0x1202('0x46')]),'user:agentconnect',{'destaccountcode':this[_0x1202('0x1b')][_0x5ef60a[_0x1202('0x40')][_0x1202('0x41')]('-')[0x0]][_0x1202('0x47')],'destconnectedlinenum':_0x5ef60a[_0x1202('0x44')]});}}}}}catch(_0x370f5b){logger[_0x1202('0x2e')](_0x1202('0x48'),_0x5ef60a[_0x1202('0x36')],util[_0x1202('0x2f')](_0x370f5b,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x1202('0x22')]=function(_0x471bbf){try{if(this[_0x1202('0x31')](_0x471bbf)){logger[_0x1202('0x49')]('[%s][voiceCallReport][newchannel]\x20event:',_0x471bbf[_0x1202('0x36')],util[_0x1202('0x2f')](_0x471bbf,{'showHidden':![],'depth':null}));if(_0x471bbf[_0x1202('0x36')]===_0x471bbf['linkedid']&&_0x471bbf[_0x1202('0x40')]!=_0x1202('0x4a')){if(_[_0x1202('0x3b')](this[_0x1202('0x1a')][_0x471bbf[_0x1202('0x36')]])){logger[_0x1202('0x34')](_0x1202('0x4b'),_0x471bbf[_0x1202('0x36')],_0x471bbf[_0x1202('0x3f')],_0x471bbf['exten']);this[_0x1202('0x1a')][_0x471bbf[_0x1202('0x36')]]=new Channel();this[_0x1202('0x1a')][_0x471bbf['uniqueid']][_0x1202('0x4c')]=moment()['format'](_0x1202('0x4d'));this[_0x1202('0x1a')][_0x471bbf[_0x1202('0x36')]][_0x1202('0x4e')]=dispositions[_['toNumber'](_0x471bbf[_0x1202('0x4f')])];_[_0x1202('0x3c')](this[_0x1202('0x1a')][_0x471bbf['uniqueid']],_[_0x1202('0x3d')](_0x471bbf,_[_0x1202('0x3e')](this[_0x1202('0x1a')][_0x471bbf[_0x1202('0x36')]])));if(_0x471bbf[_0x1202('0x3f')]==='from-sip'){if(this[_0x1202('0x1b')][_0x471bbf[_0x1202('0x40')][_0x1202('0x41')]('-')[0x0]]){if(_['isUndefined'](this[_0x1202('0x1b')][_0x471bbf[_0x1202('0x40')][_0x1202('0x41')]('-')[0x0]]['destconnectedlinenum'])){this[_0x1202('0x1b')][_0x471bbf[_0x1202('0x40')]['split']('-')[0x0]]['destconnectedlinenum']=_0x471bbf[_0x1202('0x50')];logger['debug'](_0x1202('0x51'),_0x471bbf['uniqueid'],util[_0x1202('0x2f')]({'destaccountcode':this[_0x1202('0x1b')][_0x471bbf[_0x1202('0x40')][_0x1202('0x41')]('-')[0x0]][_0x1202('0x47')],'destconnectedlinenum':_0x471bbf[_0x1202('0x50')]},{'showHidden':![],'depth':null}));this[_0x1202('0x32')](util[_0x1202('0x52')](_0x1202('0x45'),this[_0x1202('0x1b')][_0x471bbf[_0x1202('0x40')]['split']('-')[0x0]]['name']),_0x1202('0x53'),{'destaccountcode':this[_0x1202('0x1b')][_0x471bbf[_0x1202('0x40')][_0x1202('0x41')]('-')[0x0]][_0x1202('0x47')],'destconnectedlinenum':_0x471bbf[_0x1202('0x50')]});}}}}}}}catch(_0x1d00fc){logger[_0x1202('0x2e')](_0x1202('0x54'),_0x471bbf['uniqueid'],util[_0x1202('0x2f')](_0x1d00fc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1202('0x30')][_0x1202('0x1e')]=function(_0x47a830){try{if(this[_0x1202('0x31')](_0x47a830)){logger[_0x1202('0x49')](_0x1202('0x55'),_0x47a830[_0x1202('0x36')],util[_0x1202('0x2f')](_0x47a830,{'showHidden':![],'depth':null}));if(_0x47a830[_0x1202('0x36')]===_0x47a830[_0x1202('0x3a')]&&_0x47a830[_0x1202('0x50')]!='h'&&_0x47a830[_0x1202('0x40')]!=_0x1202('0x4a')){_0x47a830[_0x1202('0x56')]=_0x47a830[_0x1202('0x56')][_0x1202('0x57')]();_0x47a830[_0x1202('0x58')]=_0x47a830[_0x1202('0x59')]&&_0x47a830['appdata']['startsWith'](_0x1202('0x5a'))?_0x47a830[_0x1202('0x59')]:(_0x47a830[_0x1202('0x59')]||_0x47a830['applicationdata'])['toLowerCase']();logger[_0x1202('0x34')](_0x1202('0x5b'),_0x47a830['uniqueid'],_0x47a830[_0x1202('0x56')],_0x47a830[_0x1202('0x58')]);if(_['isUndefined'](this[_0x1202('0x1a')][_0x47a830[_0x1202('0x36')]])){this[_0x1202('0x1a')][_0x47a830[_0x1202('0x36')]]=new Channel();this['channels'][_0x47a830['uniqueid']][_0x1202('0x4c')]=_0x47a830[_0x1202('0x5c')]?moment()[_0x1202('0x5d')](moment[_0x1202('0x5c')](_0x47a830[_0x1202('0x5c')])[_0x1202('0x5e')](),_0x1202('0x5e'))['format'](_0x1202('0x4d')):moment()[_0x1202('0x52')](_0x1202('0x4d'));this[_0x1202('0x1a')][_0x47a830[_0x1202('0x36')]][_0x1202('0x4e')]=_0x1202('0x14');}_[_0x1202('0x3c')](this[_0x1202('0x1a')][_0x47a830[_0x1202('0x36')]],_[_0x1202('0x3d')](_0x47a830,_[_0x1202('0x3e')](this[_0x1202('0x1a')][_0x47a830['uniqueid']])));if(_[_0x1202('0x5f')](applications,_0x47a830['application'])){this[_0x1202('0x1a')][_0x47a830[_0x1202('0x36')]][_0x1202('0x60')]=_0x47a830['application'];this['channels'][_0x47a830[_0x1202('0x36')]][_0x1202('0x61')]=_0x47a830[_0x1202('0x58')];if(_0x47a830['application']===_0x1202('0xe')&&_[_0x1202('0x62')](_0x47a830['applicationdata'][_0x1202('0x57')](),_0x1202('0x63'))){var _0x3280bf=_0x47a830[_0x1202('0x58')][_0x1202('0x41')]('=');var _0x1f6a0d=_0x3280bf[0x0][_0x1202('0x57')]()[_0x1202('0x64')](/cdr\((.*)\)/);if(_0x1f6a0d){this[_0x1202('0x1a')][_0x47a830['uniqueid']][_0x1f6a0d[0x1]]=_0x3280bf[0x1];}}else if(_0x47a830[_0x1202('0x56')]===_0x1202('0xf')){this[_0x1202('0x1a')][_0x47a830[_0x1202('0x36')]][_0x1202('0xf')]=_0x47a830[_0x1202('0x58')][_0x1202('0x41')](',')[0x0];}}}}}catch(_0x52d4f6){logger['error'](_0x1202('0x65'),_0x47a830['uniqueid'],util[_0x1202('0x2f')](_0x52d4f6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1202('0x30')][_0x1202('0x23')]=function(_0x19a1cd){try{if(this[_0x1202('0x31')](_0x19a1cd)){logger['info'](_0x1202('0x66'),_0x19a1cd[_0x1202('0x36')],_0x19a1cd[_0x1202('0x3a')],_0x19a1cd['calleridname'],_0x19a1cd['calleridnum']);logger[_0x1202('0x49')](_0x1202('0x67'),_0x19a1cd[_0x1202('0x36')],util[_0x1202('0x2f')](_0x19a1cd,{'showHidden':![],'depth':null}));if(_0x19a1cd[_0x1202('0x36')]!==_0x19a1cd[_0x1202('0x3a')]){if(this[_0x1202('0x1a')][_0x19a1cd[_0x1202('0x3a')]]){if(_0x19a1cd[_0x1202('0x4f')]==='6'){if(!this['channels'][_0x19a1cd['linkedid']]['answered']){var _0x1cb290=moment();this[_0x1202('0x1a')][_0x19a1cd[_0x1202('0x3a')]]['answered']=!![];this[_0x1202('0x1a')][_0x19a1cd[_0x1202('0x3a')]][_0x1202('0x68')]=_0x1cb290[_0x1202('0x52')](_0x1202('0x4d'));if(this[_0x1202('0x1a')][_0x19a1cd[_0x1202('0x3a')]][_0x1202('0x4c')]){this[_0x1202('0x1a')][_0x19a1cd[_0x1202('0x3a')]][_0x1202('0x69')]=_0x1cb290[_0x1202('0x6a')](this[_0x1202('0x1a')][_0x19a1cd[_0x1202('0x3a')]][_0x1202('0x4c')],_0x1202('0x5e'));}}this[_0x1202('0x1a')][_0x19a1cd[_0x1202('0x3a')]][_0x1202('0x3a')]=_0x19a1cd['uniqueid'];if(_0x19a1cd[_0x1202('0x38')]!=='xcally-motion-preview'){this['channels'][_0x19a1cd[_0x1202('0x3a')]][_0x1202('0x44')]=_0x19a1cd['calleridnum'];}this['channels'][_0x19a1cd[_0x1202('0x3a')]][_0x1202('0x6b')]=_0x19a1cd[_0x1202('0x37')];this['channels'][_0x19a1cd[_0x1202('0x3a')]][_0x1202('0x6c')]=_0x19a1cd[_0x1202('0x40')];this[_0x1202('0x1a')][_0x19a1cd['linkedid']][_0x1202('0x4e')]=dispositions[_[_0x1202('0x6d')](_0x19a1cd[_0x1202('0x4f')])];if(this[_0x1202('0x1b')][_0x19a1cd[_0x1202('0x40')][_0x1202('0x41')]('-')[0x0]]){this[_0x1202('0x1a')][_0x19a1cd[_0x1202('0x3a')]]['UserId']=this['agents'][_0x19a1cd['channel']['split']('-')[0x0]]['id'];this[_0x1202('0x1a')][_0x19a1cd[_0x1202('0x3a')]][_0x1202('0x6e')]=this[_0x1202('0x1b')][_0x19a1cd[_0x1202('0x40')][_0x1202('0x41')]('-')[0x0]][_0x1202('0x46')];}}}}else{if(this['channels'][_0x19a1cd[_0x1202('0x36')]]){if(_0x19a1cd[_0x1202('0x4f')]==='6'){if(this['agents'][_0x19a1cd[_0x1202('0x40')][_0x1202('0x41')]('-')[0x0]]){this['channels'][_0x19a1cd[_0x1202('0x36')]][_0x1202('0x6f')]=this[_0x1202('0x1b')][_0x19a1cd[_0x1202('0x40')][_0x1202('0x41')]('-')[0x0]]['id'];this[_0x1202('0x1a')][_0x19a1cd[_0x1202('0x36')]][_0x1202('0x6e')]=this[_0x1202('0x1b')][_0x19a1cd['channel'][_0x1202('0x41')]('-')[0x0]][_0x1202('0x46')];}}}}if(_0x19a1cd[_0x1202('0x4f')]==='6'&&_0x19a1cd[_0x1202('0x3f')]==='from-sip'){if(this['agents'][_0x19a1cd[_0x1202('0x40')][_0x1202('0x41')]('-')[0x0]]){this[_0x1202('0x1b')][_0x19a1cd['channel'][_0x1202('0x41')]('-')[0x0]][_0x1202('0x43')]=_0x19a1cd[_0x1202('0x50')];var _0x59e7b5;if(this['channels'][_0x19a1cd[_0x1202('0x36')]])_0x59e7b5=this['channels'][_0x19a1cd[_0x1202('0x36')]][_0x1202('0x70')];else if(this[_0x1202('0x1a')][_0x19a1cd[_0x1202('0x3a')]])_0x59e7b5=this[_0x1202('0x1a')][_0x19a1cd[_0x1202('0x3a')]][_0x1202('0x70')];logger[_0x1202('0x49')](_0x1202('0x71'),_0x19a1cd[_0x1202('0x36')],util[_0x1202('0x2f')]({'destaccountcode':this[_0x1202('0x1b')][_0x19a1cd[_0x1202('0x40')]['split']('-')[0x0]][_0x1202('0x47')],'destconnectedlinenum':_0x19a1cd['exten'],'routealias':_0x59e7b5},{'showHidden':![],'depth':null}));this[_0x1202('0x32')](util[_0x1202('0x52')](_0x1202('0x45'),this[_0x1202('0x1b')][_0x19a1cd['channel'][_0x1202('0x41')]('-')[0x0]]['name']),_0x1202('0x53'),{'destaccountcode':this[_0x1202('0x1b')][_0x19a1cd['channel']['split']('-')[0x0]][_0x1202('0x47')],'destconnectedlinenum':_0x19a1cd[_0x1202('0x50')],'routealias':_0x59e7b5});}}}}catch(_0x5d6083){logger[_0x1202('0x2e')](_0x1202('0x72'),_0x19a1cd[_0x1202('0x36')],util[_0x1202('0x2f')](_0x5d6083,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1202('0x30')][_0x1202('0x73')]=function(_0xa2356a,_0x4588c2){try{if(this[_0x1202('0x1a')][_0xa2356a]){logger['info']('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0xa2356a,_0x4588c2);this[_0x1202('0x1a')][_0xa2356a][_0x1202('0x74')]=!![];if(_[_0x1202('0x75')](_0x4588c2,_0x1202('0x76'))){_0x4588c2=_0x4588c2[_0x1202('0x77')](_0x1202('0x76'),_0x1202('0x78'));}this[_0x1202('0x1a')][_0xa2356a][_0x1202('0x79')]=_0x4588c2;var _0x147c57=_[_0x1202('0x7a')](this[_0x1202('0x1a')][_0xa2356a][_0x1202('0x7b')],{'filename':_0x4588c2});if(_['isNil'](_0x147c57)){this[_0x1202('0x1a')][_0xa2356a]['monitors'][_0x1202('0x7c')]({'filename':_0x4588c2,'createdAt':moment()[_0x1202('0x52')](_0x1202('0x4d')),'mixmonitorid':'','status':_0x1202('0x7d')});}}}catch(_0x1d6cb4){logger[_0x1202('0x2e')](_0x1202('0x7e'),_0xa2356a,util['inspect'](_0x1d6cb4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1202('0x30')][_0x1202('0x24')]=function(_0x48e368){try{if(this[_0x1202('0x31')](_0x48e368)){logger[_0x1202('0x49')](_0x1202('0x7f'),_0x48e368[_0x1202('0x36')],util[_0x1202('0x2f')](_0x48e368,{'showHidden':![],'depth':null}));if(this[_0x1202('0x1a')][_0x48e368[_0x1202('0x36')]]&&_0x48e368['channel']!=_0x1202('0x4a')){if(this['isNotNull'](_0x48e368[_0x1202('0x80')])){if(this[_0x1202('0x31')](_0x48e368[_0x1202('0x80')][_0x1202('0x81')])){logger[_0x1202('0x34')](_0x1202('0x82'),_0x48e368['uniqueid'],_0x48e368[_0x1202('0x83')]);this[_0x1202('0x73')](_0x48e368[_0x1202('0x36')],_0x48e368[_0x1202('0x83')]);}else if(this[_0x1202('0x31')](_0x48e368['variable'][_0x1202('0x84')])){logger[_0x1202('0x34')](_0x1202('0x85'),_0x48e368[_0x1202('0x36')],_0x48e368[_0x1202('0x83')]);this[_0x1202('0x1a')][_0x48e368[_0x1202('0x36')]][_0x1202('0x38')]=_0x48e368[_0x1202('0x83')];}else if(this['isNotNull'](_0x48e368['variable'][_0x1202('0x86')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x48e368[_0x1202('0x36')],_0x48e368[_0x1202('0x83')]);this[_0x1202('0x1a')][_0x48e368[_0x1202('0x36')]][_0x1202('0x87')]=_0x48e368[_0x1202('0x83')];}else if(this[_0x1202('0x31')](_0x48e368[_0x1202('0x80')][_0x1202('0x88')])){logger['info'](_0x1202('0x89'),_0x48e368[_0x1202('0x36')],_0x48e368[_0x1202('0x83')]);this[_0x1202('0x1a')][_0x48e368[_0x1202('0x36')]][_0x1202('0x8a')]=_0x48e368[_0x1202('0x83')];}else if(this[_0x1202('0x31')](_0x48e368['variable'][_0x1202('0x8b')])){logger['info'](_0x1202('0x8c'),_0x48e368[_0x1202('0x36')],_0x48e368[_0x1202('0x83')][_0x1202('0x41')](',')[0x0]);this[_0x1202('0x1a')][_0x48e368['uniqueid']]['queue']=_0x48e368[_0x1202('0x83')][_0x1202('0x41')](',')[0x0];}else if(this['isNotNull'](_0x48e368[_0x1202('0x80')][_0x1202('0x8d')])){logger[_0x1202('0x34')](_0x1202('0x8e'),_0x48e368[_0x1202('0x36')],_0x48e368[_0x1202('0x83')]);this['channels'][_0x48e368[_0x1202('0x36')]][_0x1202('0x8f')]=_0x48e368[_0x1202('0x83')];}else if(this[_0x1202('0x31')](_0x48e368[_0x1202('0x80')][_0x1202('0x90')])){logger[_0x1202('0x34')](_0x1202('0x91'),_0x48e368[_0x1202('0x36')],_0x48e368[_0x1202('0x83')]);this['channels'][_0x48e368['uniqueid']][_0x1202('0x92')]=_0x48e368[_0x1202('0x83')];}else if(this[_0x1202('0x31')](_0x48e368['variable'][_0x1202('0x93')])){logger[_0x1202('0x34')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x48e368[_0x1202('0x36')],_0x48e368['value']);this['channels'][_0x48e368[_0x1202('0x36')]]['calleridpreview']=_0x48e368[_0x1202('0x83')];}else if(this[_0x1202('0x31')](_0x48e368[_0x1202('0x80')][_0x1202('0x94')])){logger[_0x1202('0x34')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x48e368[_0x1202('0x36')],_0x48e368[_0x1202('0x83')]);this[_0x1202('0x1a')][_0x48e368[_0x1202('0x36')]]['queue']=_0x48e368[_0x1202('0x83')];}else if(this[_0x1202('0x31')](_0x48e368[_0x1202('0x80')][_0x1202('0x95')])){logger['info'](_0x1202('0x96'),_0x48e368['uniqueid'],_0x48e368['value']);this[_0x1202('0x1a')][_0x48e368['uniqueid']][_0x1202('0x97')]=_0x48e368[_0x1202('0x83')];}}}else if(this[_0x1202('0x31')](_0x48e368[_0x1202('0x80')][_0x1202('0x81')])){if(_0x48e368[_0x1202('0x83')]){var _0x1fc0c8=path['parse'](_0x48e368[_0x1202('0x83')])[_0x1202('0x46')];logger[_0x1202('0x34')](_0x1202('0x82'),_0x1fc0c8,_0x48e368[_0x1202('0x83')]);this[_0x1202('0x73')](_0x1fc0c8,_0x48e368['value']);}}else if(this[_0x1202('0x1a')][_0x48e368[_0x1202('0x3a')]]){if(this[_0x1202('0x31')](_0x48e368['variable'])){if(this[_0x1202('0x31')](_0x48e368[_0x1202('0x80')][_0x1202('0x95')])){logger[_0x1202('0x34')](_0x1202('0x96'),_0x48e368[_0x1202('0x3a')],_0x48e368[_0x1202('0x83')]);this['channels'][_0x48e368[_0x1202('0x3a')]]['sipcalllinkedid']=_0x48e368[_0x1202('0x83')];}}}}}catch(_0x5acee4){logger[_0x1202('0x2e')]('[%s][voiceCallReport][varset]',_0x48e368[_0x1202('0x36')],util[_0x1202('0x2f')](_0x5acee4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1202('0x30')][_0x1202('0x26')]=function(_0x17b2d2){try{if(this['isNotNull'](_0x17b2d2)){logger[_0x1202('0x49')](_0x1202('0x98'),_0x17b2d2['uniqueid'],util[_0x1202('0x2f')](_0x17b2d2,{'showHidden':![],'depth':null}));if(this[_0x1202('0x1a')][_0x17b2d2['uniqueid']]){logger[_0x1202('0x34')](_0x1202('0x99'),_0x17b2d2[_0x1202('0x36')],_0x17b2d2[_0x1202('0x9a')]);var _0x28ab60=moment();this[_0x1202('0x1a')][_0x17b2d2[_0x1202('0x36')]][_0x1202('0x9b')]=_0x28ab60['format'](_0x1202('0x4d'));this[_0x1202('0x1a')][_0x17b2d2[_0x1202('0x36')]]['duration']=_0x28ab60[_0x1202('0x6a')](this[_0x1202('0x1a')][_0x17b2d2['uniqueid']][_0x1202('0x4c')],_0x1202('0x5e'));if(this[_0x1202('0x1a')][_0x17b2d2[_0x1202('0x36')]]['answered']){this[_0x1202('0x1a')][_0x17b2d2[_0x1202('0x36')]][_0x1202('0x9c')]=_0x28ab60[_0x1202('0x6a')](this['channels'][_0x17b2d2[_0x1202('0x36')]]['answertime'],_0x1202('0x5e'));this[_0x1202('0x1a')][_0x17b2d2[_0x1202('0x36')]][_0x1202('0x69')]=this['channels'][_0x17b2d2[_0x1202('0x36')]][_0x1202('0x5c')]-this[_0x1202('0x1a')][_0x17b2d2['uniqueid']][_0x1202('0x9c')];}if(_0x17b2d2[_0x1202('0x3f')]===_0x1202('0x9d')){if(this[_0x1202('0x1b')][_0x17b2d2[_0x1202('0x40')][_0x1202('0x41')]('-')[0x0]]){this[_0x1202('0x1b')][_0x17b2d2[_0x1202('0x40')][_0x1202('0x41')]('-')[0x0]]=_[_0x1202('0x9e')](this[_0x1202('0x1b')][_0x17b2d2[_0x1202('0x40')][_0x1202('0x41')]('-')[0x0]],[_0x1202('0x43')]);logger[_0x1202('0x49')](_0x1202('0x9f'),_0x17b2d2['uniqueid'],util[_0x1202('0x2f')]({'id':this[_0x1202('0x1b')][_0x17b2d2[_0x1202('0x40')][_0x1202('0x41')]('-')[0x0]]['id'],'destaccountcode':this[_0x1202('0x1b')][_0x17b2d2['channel'][_0x1202('0x41')]('-')[0x0]][_0x1202('0x47')]},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x1202('0x45'),this['agents'][_0x17b2d2['channel'][_0x1202('0x41')]('-')[0x0]]['name']),_0x1202('0xa0'),{'id':this[_0x1202('0x1b')][_0x17b2d2['channel'][_0x1202('0x41')]('-')[0x0]]['id'],'destaccountcode':this[_0x1202('0x1b')][_0x17b2d2['channel'][_0x1202('0x41')]('-')[0x0]][_0x1202('0x47')]});}}var _0x20b144=this;Promise['resolve']()[_0x1202('0xa1')](function(){var _0x1fc20a=_0x20b144[_0x1202('0x1a')][_0x17b2d2[_0x1202('0x36')]];if(typeof _0x1fc20a[_0x1202('0xa2')]==='undefined')return;if(_[_0x1202('0xa3')](_0x1fc20a[_0x1202('0x7b')]))return;return RpcSetting[_0x1202('0xa4')]()[_0x1202('0xa1')](function(_0x4c8389){if(!_0x4c8389[_0x1202('0xa5')])return;return Promise[_0x1202('0xa6')]()[_0x1202('0xa1')](function(){return ami[_0x1202('0xa7')]({'action':_0x1202('0xa8'),'channel':_0x1fc20a[_0x1202('0x40')]})[_0x1202('0xa9')](function(){});})[_0x1202('0xa1')](function(){return ami[_0x1202('0xa7')]({'action':'StopMixMonitor','channel':_0x1fc20a[_0x1202('0x6c')]})[_0x1202('0xa9')](function(){})['finally'](function(){var _0x1c1655=_0x20b144[_0x1202('0x1b')][_0x1fc20a[_0x1202('0x6c')][_0x1202('0x41')]('-')[0x0]];if(!_0x1c1655)return;io['emit'](_0x1202('0xaa'),{'agentId':_0x1c1655['id'],'uniqueid':_0x1fc20a[_0x1202('0x36')]});});});});})[_0x1202('0xa1')](function(){if(_0x17b2d2['event']===_0x1202('0xab')){_0x20b144['blindTransfers'][_0x17b2d2[_0x1202('0x36')]]=_0x20b144['channels'][_0x17b2d2[_0x1202('0x36')]];}else{if(_0x20b144[_0x1202('0x1a')][_0x17b2d2[_0x1202('0x36')]]['type']===_0x1202('0xac')&&_0x20b144[_0x1202('0x1c')][_0x17b2d2[_0x1202('0x36')]]){_0x20b144[_0x1202('0x1a')][_0x17b2d2[_0x1202('0x36')]][_0x1202('0x36')]=[_0x20b144[_0x1202('0x1a')][_0x17b2d2['uniqueid']][_0x1202('0x3a')],_0x20b144[_0x1202('0x1a')][_0x17b2d2[_0x1202('0x36')]][_0x1202('0x3a')]=_0x20b144[_0x1202('0x1a')][_0x17b2d2[_0x1202('0x36')]][_0x1202('0x36')]][0x0];delete _0x20b144['blindTransfers'][_0x17b2d2[_0x1202('0x36')]];}}logger[_0x1202('0x49')](_0x1202('0xad'),_0x17b2d2[_0x1202('0x36')],util[_0x1202('0x2f')](_0x20b144[_0x1202('0x1a')][_0x17b2d2[_0x1202('0x36')]],{'showHidden':![],'depth':null}));ami[_0x1202('0x32')]('custom:voiceCallReport',_0x20b144['channels'][_0x17b2d2[_0x1202('0x36')]]);delete _0x20b144[_0x1202('0x1a')][_0x17b2d2[_0x1202('0x36')]];});}}}catch(_0x1819db){logger['error']('[%s][voiceCallReport][hangup]',_0x17b2d2[_0x1202('0x36')],util['inspect'](_0x1819db,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1202('0x30')][_0x1202('0x28')]=function(_0x1d5bc5){try{if(this['isNotNull'](_0x1d5bc5)){logger[_0x1202('0x34')]('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x1d5bc5['uniqueid'],_0x1d5bc5[_0x1202('0xae')],_0x1d5bc5[_0x1202('0xaf')]);logger[_0x1202('0x49')](_0x1202('0xb0'),_0x1d5bc5[_0x1202('0x36')],util[_0x1202('0x2f')](_0x1d5bc5,{'showHidden':![],'depth':null}));if(this[_0x1202('0x1a')][_0x1d5bc5[_0x1202('0xb1')]]){this[_0x1202('0x1a')][_0x1d5bc5[_0x1202('0xb1')]][_0x1202('0xb2')]=_0x1d5bc5[_0x1202('0xae')];this[_0x1202('0x1a')][_0x1d5bc5[_0x1202('0xb1')]][_0x1202('0xb3')]=_0x1d5bc5[_0x1202('0xaf')];if(this[_0x1202('0x1a')][_0x1d5bc5[_0x1202('0xb4')]]){var _0x2381af=this[_0x1202('0x1a')][_0x1d5bc5[_0x1202('0xb4')]];this[_0x1202('0x1a')][_0x1d5bc5[_0x1202('0xb4')]]=this[_0x1202('0x1a')][_0x1d5bc5[_0x1202('0xb1')]];this['channels'][_0x1d5bc5['transfereeuniqueid']]=_0x2381af;}}else if(this['channels'][_0x1d5bc5[_0x1202('0xb5')]]){this[_0x1202('0x1a')][_0x1d5bc5[_0x1202('0xb5')]]['transfercalleridnum']=_0x1d5bc5[_0x1202('0xae')];this[_0x1202('0x1a')][_0x1d5bc5[_0x1202('0xb5')]][_0x1202('0xb3')]=_0x1d5bc5[_0x1202('0xaf')];if(this[_0x1202('0x1a')][_0x1d5bc5[_0x1202('0xb6')]]){var _0x2381af=this[_0x1202('0x1a')][_0x1d5bc5[_0x1202('0xb6')]];this[_0x1202('0x1a')][_0x1d5bc5[_0x1202('0xb6')]]=this['channels'][_0x1d5bc5['transfertargetuniqueid']];this[_0x1202('0x1a')][_0x1d5bc5[_0x1202('0xb5')]]=_0x2381af;}}if((this[_0x1202('0x1a')][_0x1d5bc5[_0x1202('0xb6')]]||this[_0x1202('0x1a')][_0x1d5bc5['origtransfererlinkedid']])&&this[_0x1202('0x1a')][_0x1d5bc5[_0x1202('0xb4')]]){var _0x2b189c=_[_0x1202('0xb7')]([this[_0x1202('0x1a')][_0x1d5bc5[_0x1202('0xb6')]],this[_0x1202('0x1a')][_0x1d5bc5[_0x1202('0xb8')]],this[_0x1202('0x1a')][_0x1d5bc5[_0x1202('0xb4')]]],function(_0x121519){return _0x121519&&_0x121519['type']===_0x1202('0xac')&&_0x121519[_0x1202('0xb9')];});if(_0x2b189c){if(this['channels'][_0x1d5bc5[_0x1202('0xb6')]])this[_0x1202('0x1a')][_0x1d5bc5[_0x1202('0xb6')]]['transferType']=_0x1202('0xba');if(this[_0x1202('0x1a')][_0x1d5bc5[_0x1202('0xb8')]])this['channels'][_0x1d5bc5[_0x1202('0xb8')]][_0x1202('0xa2')]='ATTENDED';this[_0x1202('0x1a')][_0x1d5bc5['secondtransfereruniqueid']][_0x1202('0xa2')]=_0x1202('0xba');}}}}catch(_0x593121){logger[_0x1202('0x2e')](_0x1202('0xbb'),_0x1d5bc5[_0x1202('0x36')],util[_0x1202('0x2f')](_0x593121,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1202('0x30')]['syncBlindTransfer']=function(_0x57eefd){try{if(this['isNotNull'](_0x57eefd)){logger[_0x1202('0x34')](_0x1202('0xbc'),_0x57eefd[_0x1202('0x36')],_0x57eefd[_0x1202('0xbd')],_0x57eefd[_0x1202('0xbe')]);logger[_0x1202('0x49')](_0x1202('0xbf'),_0x57eefd[_0x1202('0x36')],util[_0x1202('0x2f')](_0x57eefd,{'showHidden':![],'depth':null}));if(this[_0x1202('0x1a')][_0x57eefd[_0x1202('0xb1')]]){this[_0x1202('0x1a')][_0x57eefd[_0x1202('0xb1')]]['transfercalleridnum']=_0x57eefd[_0x1202('0xbd')];this[_0x1202('0x1a')][_0x57eefd[_0x1202('0xb1')]][_0x1202('0xb3')]=_0x57eefd['extension'];this['channels'][_0x57eefd[_0x1202('0xb1')]][_0x1202('0xa2')]=_0x1202('0xc0');this[_0x1202('0x26')]({'event':_0x1202('0xab'),'uniqueid':_0x57eefd[_0x1202('0xb1')],'context':_0x57eefd[_0x1202('0x3f')],'channel':_0x57eefd[_0x1202('0xc1')]});}else{this[_0x1202('0x1a')][_0x57eefd[_0x1202('0xc2')]]['transferType']='BLIND';}}}catch(_0x1aae07){logger['error'](_0x1202('0xc3'),_0x57eefd[_0x1202('0x36')],util[_0x1202('0x2f')](_0x1aae07,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x1202('0x2a')]=function(_0x200f36){try{if(this[_0x1202('0x31')](_0x200f36)){logger[_0x1202('0x49')]('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x200f36[_0x1202('0x36')],util[_0x1202('0x2f')](_0x200f36,{'showHidden':![],'depth':null}));if(this[_0x1202('0x1a')][_0x200f36[_0x1202('0x36')]]){if(!_[_0x1202('0xc4')](this[_0x1202('0x1a')][_0x200f36['uniqueid']][_0x1202('0x68')])){this[_0x1202('0x1a')][_0x200f36[_0x1202('0x36')]][_0x1202('0xc5')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0x1202('0x34')](_0x1202('0xc6'),_0x200f36[_0x1202('0x36')],this[_0x1202('0x1a')][_0x200f36[_0x1202('0x36')]][_0x1202('0xc5')]);}}}}catch(_0x58b4e9){logger['error']('[%s][voiceCallReport][musiconholdstart]',_0x200f36['uniqueid'],util['inspect'](_0x58b4e9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1202('0x30')][_0x1202('0xc7')]=function(_0x421150){try{if(this[_0x1202('0x31')](_0x421150)){logger['debug'](_0x1202('0xc8'),_0x421150[_0x1202('0x36')],util[_0x1202('0x2f')](_0x421150,{'showHidden':![],'depth':null}));if(this[_0x1202('0x1a')][_0x421150[_0x1202('0x36')]]){if(!_[_0x1202('0xc4')](this[_0x1202('0x1a')][_0x421150[_0x1202('0x36')]]['mohstarttime'])){this[_0x1202('0x1a')][_0x421150['uniqueid']][_0x1202('0xc9')]+=moment()[_0x1202('0xca')](0x0)[_0x1202('0x6a')](this[_0x1202('0x1a')][_0x421150[_0x1202('0x36')]][_0x1202('0xc5')],_0x1202('0x5e'));logger[_0x1202('0x34')](_0x1202('0xcb'),_0x421150[_0x1202('0x36')],this['channels'][_0x421150[_0x1202('0x36')]]['mohtime']);delete this['channels'][_0x421150[_0x1202('0x36')]][_0x1202('0xc5')];}}}}catch(_0x490521){logger[_0x1202('0x2e')](_0x1202('0xcc'),_0x421150[_0x1202('0x36')],util[_0x1202('0x2f')](_0x490521,{'showHidden':![],'depth':null}));}};module[_0x1202('0xcd')]=VoiceCallReport; \ No newline at end of file +var _0x888a=['membername','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','monitor','.wav49','replace','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','type','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','[%s][voiceCallReport][hangup]\x20event:','endtime','diff','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','then','transferType','isEmpty','getSettings','stopRecordingOnTransfer','Action','catch','destinationchannel','finally','event','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','outbound','routeid','ATTENDED','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfererchannel','transfereruniqueid','BLIND','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','isNil','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','[%s][voiceCallReport][musiconholdstop]','bluebird','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','not_inuse','inuse','busy','invalid','unavailable','ringinuse','onhold','set','queue','agi','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newchannel','syncNewChannel','newstate','syncVarSet','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstop','syncMusicOnHoldStop','info','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','linkedid','merge','pick','keys','context','from-sip','split','exten','xcally-motion-preview','channel','connectedlinenum','format','user:%s','name','user:agentconnect','[%s][voiceCallReport][newcallerid]','debug','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','[%s][voiceCallReport][newchannel]','applicationdata','appdata','startsWith','CDR(routeAlias)','toLowerCase','application','duration','subtract','seconds','includes','lastapplication','lastdata','cdr(','match','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','channelstate','answered','answertime','holdtime','UserId'];(function(_0x31e08a,_0x2a4216){var _0x33be1a=function(_0x4501f8){while(--_0x4501f8){_0x31e08a['push'](_0x31e08a['shift']());}};_0x33be1a(++_0x2a4216);}(_0x888a,0x1e6));var _0xa888=function(_0x270815,_0x2b61a3){_0x270815=_0x270815-0x0;var _0x39be8b=_0x888a[_0x270815];return _0x39be8b;};'use strict';var BPromise=require(_0xa888('0x0'));var _=require(_0xa888('0x1'));var moment=require(_0xa888('0x2'));var util=require(_0xa888('0x3'));var path=require('path');var Redis=require(_0xa888('0x4'));var config=require(_0xa888('0x5'));var logger=require(_0xa888('0x6'))(_0xa888('0x7'));var ami=require(_0xa888('0x8'));var Channel=require(_0xa888('0x9'));var RpcSetting=require(_0xa888('0xa'));var statusDesc=['unknown',_0xa888('0xb'),_0xa888('0xc'),_0xa888('0xd'),_0xa888('0xe'),_0xa888('0xf'),'ringing',_0xa888('0x10'),_0xa888('0x11')];var applications=[_0xa888('0x12'),_0xa888('0x13'),_0xa888('0x14'),'dial',_0xa888('0x15'),_0xa888('0x16')];var dispositions=[_0xa888('0x17'),_0xa888('0x18'),_0xa888('0x18'),'NO\x20ANSWER','NO\x20ANSWER',_0xa888('0x17'),_0xa888('0x19'),_0xa888('0x1a'),_0xa888('0x18'),'FAILED',_0xa888('0x18')];var actions={};config[_0xa888('0x1b')]=_[_0xa888('0x1c')](config[_0xa888('0x1b')],{'host':_0xa888('0x1d'),'port':0x18eb});var io=require(_0xa888('0x1e'))(new Redis(config[_0xa888('0x1b')]));function VoiceCallReport(_0x4a6573){this[_0xa888('0x1f')]=_0x4a6573[_0xa888('0x1f')];this[_0xa888('0x20')]=_0x4a6573['agents'];this[_0xa888('0x21')]={};ami['on'](_0xa888('0x22'),this[_0xa888('0x23')][_0xa888('0x24')](this));ami['on']('newexten',this[_0xa888('0x23')][_0xa888('0x24')](this));ami['on'](_0xa888('0x25'),this[_0xa888('0x26')][_0xa888('0x24')](this));ami['on'](_0xa888('0x27'),this['syncNewState'][_0xa888('0x24')](this));ami['on']('varset',this[_0xa888('0x28')][_0xa888('0x24')](this));ami['on']('hangup',this[_0xa888('0x29')]['bind'](this));ami['on'](_0xa888('0x2a'),this[_0xa888('0x2b')][_0xa888('0x24')](this));ami['on'](_0xa888('0x2c'),this[_0xa888('0x2d')][_0xa888('0x24')](this));ami['on'](_0xa888('0x2e'),this[_0xa888('0x2f')][_0xa888('0x24')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0xa888('0x24')](this));ami['on'](_0xa888('0x30'),this[_0xa888('0x31')][_0xa888('0x24')](this));try{logger[_0xa888('0x32')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0xa888('0x33')]();}catch(_0x13cb40){logger[_0xa888('0x34')](_0xa888('0x35'),util[_0xa888('0x36')](_0x13cb40,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xa888('0x37')][_0xa888('0x38')]=function(_0x21afa8){return _0x21afa8!==null&&!_[_0xa888('0x39')](_0x21afa8);};VoiceCallReport[_0xa888('0x37')][_0xa888('0x3a')]=function(_0xa4a451,_0x1c40e7,_0x486639){io['to'](_0xa4a451)[_0xa888('0x3a')](_0x1c40e7,_0x486639);};VoiceCallReport[_0xa888('0x37')][_0xa888('0x2b')]=function(_0x39ca27){try{if(this[_0xa888('0x38')](_0x39ca27)){logger[_0xa888('0x32')]('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x39ca27['uniqueid'],_0x39ca27[_0xa888('0x3b')],_0x39ca27[_0xa888('0x3c')]);logger['debug'](_0xa888('0x3d'),_0x39ca27[_0xa888('0x3e')],util['inspect'](_0x39ca27,{'showHidden':![],'depth':null}));if(_0x39ca27[_0xa888('0x3e')]===_0x39ca27[_0xa888('0x3f')]){if(!_[_0xa888('0x39')](this[_0xa888('0x1f')][_0x39ca27[_0xa888('0x3e')]])){_[_0xa888('0x40')](this[_0xa888('0x1f')][_0x39ca27[_0xa888('0x3e')]],_[_0xa888('0x41')](_0x39ca27,_[_0xa888('0x42')](this[_0xa888('0x1f')][_0x39ca27['uniqueid']])));}}if(_0x39ca27[_0xa888('0x43')]===_0xa888('0x44')){if(this[_0xa888('0x20')][_0x39ca27['channel'][_0xa888('0x45')]('-')[0x0]]){if(_0x39ca27[_0xa888('0x46')]==_0xa888('0x47')){this[_0xa888('0x20')][_0x39ca27[_0xa888('0x48')][_0xa888('0x45')]('-')[0x0]]['destconnectedlinenum']=_0x39ca27[_0xa888('0x49')];this[_0xa888('0x3a')](util[_0xa888('0x4a')](_0xa888('0x4b'),this['agents'][_0x39ca27['channel'][_0xa888('0x45')]('-')[0x0]][_0xa888('0x4c')]),_0xa888('0x4d'),{'destaccountcode':this[_0xa888('0x20')][_0x39ca27[_0xa888('0x48')][_0xa888('0x45')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x39ca27[_0xa888('0x49')]});}}}}}catch(_0x20a4b2){logger[_0xa888('0x34')](_0xa888('0x4e'),_0x39ca27[_0xa888('0x3e')],util[_0xa888('0x36')](_0x20a4b2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa888('0x37')][_0xa888('0x26')]=function(_0x1fb572){try{if(this['isNotNull'](_0x1fb572)){logger[_0xa888('0x4f')](_0xa888('0x50'),_0x1fb572[_0xa888('0x3e')],util[_0xa888('0x36')](_0x1fb572,{'showHidden':![],'depth':null}));if(_0x1fb572[_0xa888('0x3e')]===_0x1fb572[_0xa888('0x3f')]&&_0x1fb572[_0xa888('0x48')]!=_0xa888('0x51')){if(_[_0xa888('0x39')](this[_0xa888('0x1f')][_0x1fb572['uniqueid']])){logger['info'](_0xa888('0x52'),_0x1fb572[_0xa888('0x3e')],_0x1fb572[_0xa888('0x43')],_0x1fb572[_0xa888('0x46')]);this[_0xa888('0x1f')][_0x1fb572[_0xa888('0x3e')]]=new Channel();this[_0xa888('0x1f')][_0x1fb572[_0xa888('0x3e')]][_0xa888('0x53')]=moment()[_0xa888('0x4a')](_0xa888('0x54'));this[_0xa888('0x1f')][_0x1fb572[_0xa888('0x3e')]][_0xa888('0x55')]=dispositions[_[_0xa888('0x56')](_0x1fb572['channelstate'])];_[_0xa888('0x40')](this[_0xa888('0x1f')][_0x1fb572[_0xa888('0x3e')]],_[_0xa888('0x41')](_0x1fb572,_[_0xa888('0x42')](this[_0xa888('0x1f')][_0x1fb572[_0xa888('0x3e')]])));if(_0x1fb572['context']===_0xa888('0x44')){if(this[_0xa888('0x20')][_0x1fb572[_0xa888('0x48')][_0xa888('0x45')]('-')[0x0]]){if(_[_0xa888('0x39')](this['agents'][_0x1fb572[_0xa888('0x48')][_0xa888('0x45')]('-')[0x0]][_0xa888('0x57')])){this[_0xa888('0x20')][_0x1fb572[_0xa888('0x48')][_0xa888('0x45')]('-')[0x0]]['destconnectedlinenum']=_0x1fb572[_0xa888('0x46')];logger[_0xa888('0x4f')](_0xa888('0x58'),_0x1fb572['uniqueid'],util['inspect']({'destaccountcode':this[_0xa888('0x20')][_0x1fb572[_0xa888('0x48')][_0xa888('0x45')]('-')[0x0]][_0xa888('0x59')],'destconnectedlinenum':_0x1fb572['exten']},{'showHidden':![],'depth':null}));this[_0xa888('0x3a')](util['format']('user:%s',this['agents'][_0x1fb572[_0xa888('0x48')][_0xa888('0x45')]('-')[0x0]]['name']),_0xa888('0x4d'),{'destaccountcode':this['agents'][_0x1fb572['channel'][_0xa888('0x45')]('-')[0x0]][_0xa888('0x59')],'destconnectedlinenum':_0x1fb572[_0xa888('0x46')]});}}}}}}}catch(_0x3ae562){logger[_0xa888('0x34')](_0xa888('0x5a'),_0x1fb572['uniqueid'],util['inspect'](_0x3ae562,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewExten']=function(_0x45ca28){try{if(this[_0xa888('0x38')](_0x45ca28)){logger[_0xa888('0x4f')]('[%s][voiceCallReport][newexten]\x20event:',_0x45ca28['uniqueid'],util['inspect'](_0x45ca28,{'showHidden':![],'depth':null}));if(_0x45ca28[_0xa888('0x3e')]===_0x45ca28[_0xa888('0x3f')]&&_0x45ca28[_0xa888('0x46')]!='h'&&_0x45ca28[_0xa888('0x48')]!=_0xa888('0x51')){_0x45ca28['application']=_0x45ca28['application']['toLowerCase']();_0x45ca28[_0xa888('0x5b')]=_0x45ca28[_0xa888('0x5c')]&&_0x45ca28['appdata'][_0xa888('0x5d')](_0xa888('0x5e'))?_0x45ca28[_0xa888('0x5c')]:(_0x45ca28[_0xa888('0x5c')]||_0x45ca28['applicationdata'])[_0xa888('0x5f')]();logger['info']('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x45ca28[_0xa888('0x3e')],_0x45ca28[_0xa888('0x60')],_0x45ca28[_0xa888('0x5b')]);if(_[_0xa888('0x39')](this['channels'][_0x45ca28[_0xa888('0x3e')]])){this['channels'][_0x45ca28[_0xa888('0x3e')]]=new Channel();this[_0xa888('0x1f')][_0x45ca28['uniqueid']][_0xa888('0x53')]=_0x45ca28[_0xa888('0x61')]?moment()[_0xa888('0x62')](moment['duration'](_0x45ca28[_0xa888('0x61')])[_0xa888('0x63')](),_0xa888('0x63'))['format'](_0xa888('0x54')):moment()[_0xa888('0x4a')](_0xa888('0x54'));this[_0xa888('0x1f')][_0x45ca28[_0xa888('0x3e')]][_0xa888('0x55')]='NO\x20ANSWER';}_[_0xa888('0x40')](this[_0xa888('0x1f')][_0x45ca28['uniqueid']],_[_0xa888('0x41')](_0x45ca28,_[_0xa888('0x42')](this[_0xa888('0x1f')][_0x45ca28[_0xa888('0x3e')]])));if(_[_0xa888('0x64')](applications,_0x45ca28[_0xa888('0x60')])){this['channels'][_0x45ca28[_0xa888('0x3e')]][_0xa888('0x65')]=_0x45ca28['application'];this[_0xa888('0x1f')][_0x45ca28[_0xa888('0x3e')]][_0xa888('0x66')]=_0x45ca28[_0xa888('0x5b')];if(_0x45ca28[_0xa888('0x60')]==='set'&&_['startsWith'](_0x45ca28[_0xa888('0x5b')]['toLowerCase'](),_0xa888('0x67'))){var _0x5adffb=_0x45ca28[_0xa888('0x5b')][_0xa888('0x45')]('=');var _0x4ffe64=_0x5adffb[0x0][_0xa888('0x5f')]()[_0xa888('0x68')](/cdr\((.*)\)/);if(_0x4ffe64){this['channels'][_0x45ca28[_0xa888('0x3e')]][_0x4ffe64[0x1]]=_0x5adffb[0x1];}}else if(_0x45ca28[_0xa888('0x60')]===_0xa888('0x13')){this[_0xa888('0x1f')][_0x45ca28[_0xa888('0x3e')]][_0xa888('0x13')]=_0x45ca28['applicationdata'][_0xa888('0x45')](',')[0x0];}}}}}catch(_0x123768){logger[_0xa888('0x34')](_0xa888('0x69'),_0x45ca28['uniqueid'],util[_0xa888('0x36')](_0x123768,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa888('0x37')][_0xa888('0x6a')]=function(_0x584448){try{if(this[_0xa888('0x38')](_0x584448)){logger[_0xa888('0x32')](_0xa888('0x6b'),_0x584448[_0xa888('0x3e')],_0x584448[_0xa888('0x3f')],_0x584448[_0xa888('0x3b')],_0x584448['calleridnum']);logger[_0xa888('0x4f')](_0xa888('0x6c'),_0x584448['uniqueid'],util[_0xa888('0x36')](_0x584448,{'showHidden':![],'depth':null}));if(_0x584448['uniqueid']!==_0x584448[_0xa888('0x3f')]){if(this[_0xa888('0x1f')][_0x584448[_0xa888('0x3f')]]){if(_0x584448[_0xa888('0x6d')]==='6'){if(!this['channels'][_0x584448[_0xa888('0x3f')]][_0xa888('0x6e')]){var _0xbdf26=moment();this[_0xa888('0x1f')][_0x584448[_0xa888('0x3f')]][_0xa888('0x6e')]=!![];this['channels'][_0x584448['linkedid']][_0xa888('0x6f')]=_0xbdf26['format'](_0xa888('0x54'));if(this[_0xa888('0x1f')][_0x584448[_0xa888('0x3f')]][_0xa888('0x53')]){this['channels'][_0x584448[_0xa888('0x3f')]][_0xa888('0x70')]=_0xbdf26['diff'](this['channels'][_0x584448[_0xa888('0x3f')]][_0xa888('0x53')],_0xa888('0x63'));}}this[_0xa888('0x1f')][_0x584448[_0xa888('0x3f')]][_0xa888('0x3f')]=_0x584448[_0xa888('0x3e')];if(_0x584448[_0xa888('0x3c')]!==_0xa888('0x47')){this['channels'][_0x584448['linkedid']][_0xa888('0x49')]=_0x584448[_0xa888('0x3c')];}this[_0xa888('0x1f')][_0x584448['linkedid']]['connectedlinename']=_0x584448[_0xa888('0x3b')];this[_0xa888('0x1f')][_0x584448['linkedid']]['destinationchannel']=_0x584448['channel'];this[_0xa888('0x1f')][_0x584448['linkedid']][_0xa888('0x55')]=dispositions[_[_0xa888('0x56')](_0x584448[_0xa888('0x6d')])];if(this[_0xa888('0x20')][_0x584448[_0xa888('0x48')][_0xa888('0x45')]('-')[0x0]]){this['channels'][_0x584448[_0xa888('0x3f')]][_0xa888('0x71')]=this[_0xa888('0x20')][_0x584448['channel']['split']('-')[0x0]]['id'];this[_0xa888('0x1f')][_0x584448[_0xa888('0x3f')]][_0xa888('0x72')]=this[_0xa888('0x20')][_0x584448[_0xa888('0x48')][_0xa888('0x45')]('-')[0x0]]['name'];}}}}else{if(this['channels'][_0x584448[_0xa888('0x3e')]]){if(_0x584448[_0xa888('0x6d')]==='6'){if(this[_0xa888('0x20')][_0x584448[_0xa888('0x48')][_0xa888('0x45')]('-')[0x0]]){this[_0xa888('0x1f')][_0x584448[_0xa888('0x3e')]][_0xa888('0x71')]=this[_0xa888('0x20')][_0x584448['channel'][_0xa888('0x45')]('-')[0x0]]['id'];this[_0xa888('0x1f')][_0x584448[_0xa888('0x3e')]]['membername']=this[_0xa888('0x20')][_0x584448[_0xa888('0x48')][_0xa888('0x45')]('-')[0x0]][_0xa888('0x4c')];}}}}if(_0x584448[_0xa888('0x6d')]==='6'&&_0x584448[_0xa888('0x43')]===_0xa888('0x44')){if(this['agents'][_0x584448['channel'][_0xa888('0x45')]('-')[0x0]]){this[_0xa888('0x20')][_0x584448[_0xa888('0x48')][_0xa888('0x45')]('-')[0x0]]['destconnectedlinenum']=_0x584448[_0xa888('0x46')];var _0x451fa7;if(this[_0xa888('0x1f')][_0x584448[_0xa888('0x3e')]])_0x451fa7=this[_0xa888('0x1f')][_0x584448[_0xa888('0x3e')]]['routealias'];else if(this[_0xa888('0x1f')][_0x584448[_0xa888('0x3f')]])_0x451fa7=this[_0xa888('0x1f')][_0x584448['linkedid']][_0xa888('0x73')];logger[_0xa888('0x4f')](_0xa888('0x74'),_0x584448[_0xa888('0x3e')],util[_0xa888('0x36')]({'destaccountcode':this[_0xa888('0x20')][_0x584448[_0xa888('0x48')][_0xa888('0x45')]('-')[0x0]][_0xa888('0x59')],'destconnectedlinenum':_0x584448[_0xa888('0x46')],'routealias':_0x451fa7},{'showHidden':![],'depth':null}));this[_0xa888('0x3a')](util[_0xa888('0x4a')]('user:%s',this[_0xa888('0x20')][_0x584448[_0xa888('0x48')][_0xa888('0x45')]('-')[0x0]][_0xa888('0x4c')]),_0xa888('0x4d'),{'destaccountcode':this[_0xa888('0x20')][_0x584448[_0xa888('0x48')][_0xa888('0x45')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x584448[_0xa888('0x46')],'routealias':_0x451fa7});}}}}catch(_0x114177){logger[_0xa888('0x34')](_0xa888('0x75'),_0x584448[_0xa888('0x3e')],util[_0xa888('0x36')](_0x114177,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa888('0x37')][_0xa888('0x76')]=function(_0x1a0c2c,_0x1fe0ec){try{if(this[_0xa888('0x1f')][_0x1a0c2c]){logger[_0xa888('0x32')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x1a0c2c,_0x1fe0ec);this[_0xa888('0x1f')][_0x1a0c2c][_0xa888('0x77')]=!![];if(_['endsWith'](_0x1fe0ec,_0xa888('0x78'))){_0x1fe0ec=_0x1fe0ec[_0xa888('0x79')](_0xa888('0x78'),'.WAV');}this[_0xa888('0x1f')][_0x1a0c2c]['monitorFilename']=_0x1fe0ec;var _0x5d396c=_['find'](this['channels'][_0x1a0c2c][_0xa888('0x7a')],{'filename':_0x1fe0ec});if(_['isNil'](_0x5d396c)){this[_0xa888('0x1f')][_0x1a0c2c][_0xa888('0x7a')][_0xa888('0x7b')]({'filename':_0x1fe0ec,'createdAt':moment()['format'](_0xa888('0x54')),'mixmonitorid':'','status':_0xa888('0x7c')});}}}catch(_0x127e66){logger['error'](_0xa888('0x7d'),_0x1a0c2c,util[_0xa888('0x36')](_0x127e66,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa888('0x37')][_0xa888('0x28')]=function(_0x365234){try{if(this[_0xa888('0x38')](_0x365234)){logger[_0xa888('0x4f')](_0xa888('0x7e'),_0x365234['uniqueid'],util[_0xa888('0x36')](_0x365234,{'showHidden':![],'depth':null}));if(this[_0xa888('0x1f')][_0x365234[_0xa888('0x3e')]]&&_0x365234[_0xa888('0x48')]!='OutgoingSpoolFailed'){if(this['isNotNull'](_0x365234[_0xa888('0x7f')])){if(this[_0xa888('0x38')](_0x365234['variable'][_0xa888('0x80')])){logger[_0xa888('0x32')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x365234[_0xa888('0x3e')],_0x365234['value']);this[_0xa888('0x76')](_0x365234[_0xa888('0x3e')],_0x365234[_0xa888('0x81')]);}else if(this[_0xa888('0x38')](_0x365234[_0xa888('0x7f')][_0xa888('0x82')])){logger[_0xa888('0x32')](_0xa888('0x83'),_0x365234[_0xa888('0x3e')],_0x365234[_0xa888('0x81')]);this[_0xa888('0x1f')][_0x365234['uniqueid']]['calleridnum']=_0x365234['value'];}else if(this[_0xa888('0x38')](_0x365234[_0xa888('0x7f')][_0xa888('0x84')])){logger['info'](_0xa888('0x85'),_0x365234['uniqueid'],_0x365234['value']);this['channels'][_0x365234[_0xa888('0x3e')]][_0xa888('0x86')]=_0x365234[_0xa888('0x81')];}else if(this[_0xa888('0x38')](_0x365234[_0xa888('0x7f')][_0xa888('0x87')])){logger[_0xa888('0x32')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x365234[_0xa888('0x3e')],_0x365234['value']);this[_0xa888('0x1f')][_0x365234[_0xa888('0x3e')]][_0xa888('0x88')]=_0x365234[_0xa888('0x81')];}else if(this['isNotNull'](_0x365234[_0xa888('0x7f')]['xmd-queue'])){logger[_0xa888('0x32')](_0xa888('0x89'),_0x365234[_0xa888('0x3e')],_0x365234[_0xa888('0x81')][_0xa888('0x45')](',')[0x0]);this[_0xa888('0x1f')][_0x365234['uniqueid']][_0xa888('0x13')]=_0x365234['value'][_0xa888('0x45')](',')[0x0];}else if(this['isNotNull'](_0x365234[_0xa888('0x7f')][_0xa888('0x8a')])){logger[_0xa888('0x32')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x365234['uniqueid'],_0x365234['value']);this[_0xa888('0x1f')][_0x365234[_0xa888('0x3e')]]['originatecalleridnum']=_0x365234[_0xa888('0x81')];}else if(this[_0xa888('0x38')](_0x365234[_0xa888('0x7f')]['xmd-destination'])){logger['info'](_0xa888('0x8b'),_0x365234[_0xa888('0x3e')],_0x365234[_0xa888('0x81')]);this[_0xa888('0x1f')][_0x365234[_0xa888('0x3e')]][_0xa888('0x8c')]=_0x365234['value'];}else if(this[_0xa888('0x38')](_0x365234[_0xa888('0x7f')]['xmd-callerid-preview'])){logger[_0xa888('0x32')](_0xa888('0x8d'),_0x365234[_0xa888('0x3e')],_0x365234['value']);this[_0xa888('0x1f')][_0x365234['uniqueid']][_0xa888('0x8e')]=_0x365234[_0xa888('0x81')];}else if(this[_0xa888('0x38')](_0x365234['variable'][_0xa888('0x8f')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x365234[_0xa888('0x3e')],_0x365234['value']);this['channels'][_0x365234[_0xa888('0x3e')]][_0xa888('0x13')]=_0x365234[_0xa888('0x81')];}else if(this[_0xa888('0x38')](_0x365234[_0xa888('0x7f')][_0xa888('0x90')])){logger[_0xa888('0x32')](_0xa888('0x91'),_0x365234[_0xa888('0x3e')],_0x365234['value']);this['channels'][_0x365234[_0xa888('0x3e')]][_0xa888('0x92')]=_0x365234[_0xa888('0x81')];}}}else if(this[_0xa888('0x38')](_0x365234[_0xa888('0x7f')][_0xa888('0x80')])){if(_0x365234[_0xa888('0x81')]){var _0x55b4f2=path[_0xa888('0x93')](_0x365234[_0xa888('0x81')])[_0xa888('0x4c')];logger['info'](_0xa888('0x94'),_0x55b4f2,_0x365234[_0xa888('0x81')]);this[_0xa888('0x76')](_0x55b4f2,_0x365234[_0xa888('0x81')]);}}else if(this[_0xa888('0x1f')][_0x365234[_0xa888('0x3f')]]){if(this[_0xa888('0x38')](_0x365234[_0xa888('0x7f')])){if(this[_0xa888('0x38')](_0x365234['variable'][_0xa888('0x90')])){logger[_0xa888('0x32')](_0xa888('0x91'),_0x365234[_0xa888('0x3f')],_0x365234[_0xa888('0x81')]);this[_0xa888('0x1f')][_0x365234[_0xa888('0x3f')]]['sipcalllinkedid']=_0x365234[_0xa888('0x81')];}}}}}catch(_0x58cadd){logger[_0xa888('0x34')]('[%s][voiceCallReport][varset]',_0x365234[_0xa888('0x3e')],util['inspect'](_0x58cadd,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa888('0x37')][_0xa888('0x29')]=function(_0x9f2f6d){try{if(this[_0xa888('0x38')](_0x9f2f6d)){logger[_0xa888('0x4f')](_0xa888('0x95'),_0x9f2f6d[_0xa888('0x3e')],util['inspect'](_0x9f2f6d,{'showHidden':![],'depth':null}));if(this[_0xa888('0x1f')][_0x9f2f6d['uniqueid']]){logger[_0xa888('0x32')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x9f2f6d[_0xa888('0x3e')],_0x9f2f6d['cause-txt']);var _0x3a6d0a=moment();this[_0xa888('0x1f')][_0x9f2f6d[_0xa888('0x3e')]][_0xa888('0x96')]=_0x3a6d0a[_0xa888('0x4a')](_0xa888('0x54'));this[_0xa888('0x1f')][_0x9f2f6d[_0xa888('0x3e')]][_0xa888('0x61')]=_0x3a6d0a[_0xa888('0x97')](this['channels'][_0x9f2f6d[_0xa888('0x3e')]][_0xa888('0x53')],_0xa888('0x63'));if(this[_0xa888('0x1f')][_0x9f2f6d['uniqueid']][_0xa888('0x6e')]){this[_0xa888('0x1f')][_0x9f2f6d[_0xa888('0x3e')]][_0xa888('0x98')]=_0x3a6d0a[_0xa888('0x97')](this[_0xa888('0x1f')][_0x9f2f6d[_0xa888('0x3e')]][_0xa888('0x6f')],_0xa888('0x63'));this['channels'][_0x9f2f6d[_0xa888('0x3e')]][_0xa888('0x70')]=this[_0xa888('0x1f')][_0x9f2f6d[_0xa888('0x3e')]][_0xa888('0x61')]-this[_0xa888('0x1f')][_0x9f2f6d[_0xa888('0x3e')]][_0xa888('0x98')];}if(_0x9f2f6d[_0xa888('0x43')]===_0xa888('0x44')){if(this[_0xa888('0x20')][_0x9f2f6d[_0xa888('0x48')][_0xa888('0x45')]('-')[0x0]]){this[_0xa888('0x20')][_0x9f2f6d[_0xa888('0x48')][_0xa888('0x45')]('-')[0x0]]=_[_0xa888('0x99')](this[_0xa888('0x20')][_0x9f2f6d[_0xa888('0x48')][_0xa888('0x45')]('-')[0x0]],[_0xa888('0x57')]);logger['debug'](_0xa888('0x9a'),_0x9f2f6d['uniqueid'],util[_0xa888('0x36')]({'id':this[_0xa888('0x20')][_0x9f2f6d[_0xa888('0x48')][_0xa888('0x45')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x9f2f6d['channel'][_0xa888('0x45')]('-')[0x0]][_0xa888('0x59')]},{'showHidden':![],'depth':null}));this[_0xa888('0x3a')](util[_0xa888('0x4a')]('user:%s',this[_0xa888('0x20')][_0x9f2f6d[_0xa888('0x48')][_0xa888('0x45')]('-')[0x0]]['name']),_0xa888('0x9b'),{'id':this[_0xa888('0x20')][_0x9f2f6d[_0xa888('0x48')][_0xa888('0x45')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x9f2f6d[_0xa888('0x48')][_0xa888('0x45')]('-')[0x0]][_0xa888('0x59')]});}}var _0x4cb067=this;Promise[_0xa888('0x9c')]()[_0xa888('0x9d')](function(){var _0x201937=_0x4cb067['channels'][_0x9f2f6d[_0xa888('0x3e')]];if(typeof _0x201937[_0xa888('0x9e')]==='undefined')return;if(_[_0xa888('0x9f')](_0x201937['monitors']))return;return RpcSetting[_0xa888('0xa0')]()[_0xa888('0x9d')](function(_0x1af74b){if(!_0x1af74b[_0xa888('0xa1')])return;return Promise['resolve']()['then'](function(){return ami[_0xa888('0xa2')]({'action':'StopMixMonitor','channel':_0x201937['channel']})[_0xa888('0xa3')](function(){});})['then'](function(){return ami['Action']({'action':'StopMixMonitor','channel':_0x201937[_0xa888('0xa4')]})[_0xa888('0xa3')](function(){})[_0xa888('0xa5')](function(){var _0x6a169a=_0x4cb067[_0xa888('0x20')][_0x201937[_0xa888('0xa4')]['split']('-')[0x0]];if(!_0x6a169a)return;io[_0xa888('0x3a')]('webbar:stopmonitors',{'agentId':_0x6a169a['id'],'uniqueid':_0x201937[_0xa888('0x3e')]});});});});})[_0xa888('0x9d')](function(){if(_0x9f2f6d[_0xa888('0xa6')]==='BlindTransfer'){_0x4cb067[_0xa888('0x21')][_0x9f2f6d['uniqueid']]=_0x4cb067[_0xa888('0x1f')][_0x9f2f6d[_0xa888('0x3e')]];}else{if(_0x4cb067['channels'][_0x9f2f6d[_0xa888('0x3e')]][_0xa888('0x88')]==='outbound'&&_0x4cb067[_0xa888('0x21')][_0x9f2f6d[_0xa888('0x3e')]]){_0x4cb067['channels'][_0x9f2f6d['uniqueid']][_0xa888('0x3e')]=[_0x4cb067[_0xa888('0x1f')][_0x9f2f6d['uniqueid']][_0xa888('0x3f')],_0x4cb067[_0xa888('0x1f')][_0x9f2f6d[_0xa888('0x3e')]]['linkedid']=_0x4cb067['channels'][_0x9f2f6d['uniqueid']][_0xa888('0x3e')]][0x0];delete _0x4cb067[_0xa888('0x21')][_0x9f2f6d['uniqueid']];}}logger[_0xa888('0x4f')](_0xa888('0xa7'),_0x9f2f6d[_0xa888('0x3e')],util['inspect'](_0x4cb067['channels'][_0x9f2f6d[_0xa888('0x3e')]],{'showHidden':![],'depth':null}));ami[_0xa888('0x3a')](_0xa888('0xa8'),_0x4cb067[_0xa888('0x1f')][_0x9f2f6d[_0xa888('0x3e')]]);delete _0x4cb067[_0xa888('0x1f')][_0x9f2f6d[_0xa888('0x3e')]];});}}}catch(_0x1c7697){logger[_0xa888('0x34')](_0xa888('0xa9'),_0x9f2f6d[_0xa888('0x3e')],util[_0xa888('0x36')](_0x1c7697,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncAttendedTransfer']=function(_0x4aa666){try{if(this['isNotNull'](_0x4aa666)){logger['info']('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x4aa666[_0xa888('0x3e')],_0x4aa666[_0xa888('0xaa')],_0x4aa666[_0xa888('0xab')]);logger[_0xa888('0x4f')](_0xa888('0xac'),_0x4aa666[_0xa888('0x3e')],util['inspect'](_0x4aa666,{'showHidden':![],'depth':null}));if(this[_0xa888('0x1f')][_0x4aa666[_0xa888('0xad')]]){this[_0xa888('0x1f')][_0x4aa666[_0xa888('0xad')]][_0xa888('0xae')]=_0x4aa666[_0xa888('0xaa')];this[_0xa888('0x1f')][_0x4aa666[_0xa888('0xad')]][_0xa888('0xaf')]=_0x4aa666['transfertargetcalleridnum'];if(this[_0xa888('0x1f')][_0x4aa666[_0xa888('0xb0')]]){var _0x157396=this[_0xa888('0x1f')][_0x4aa666[_0xa888('0xb0')]];this[_0xa888('0x1f')][_0x4aa666[_0xa888('0xb0')]]=this[_0xa888('0x1f')][_0x4aa666[_0xa888('0xad')]];this['channels'][_0x4aa666[_0xa888('0xad')]]=_0x157396;}}else if(this[_0xa888('0x1f')][_0x4aa666[_0xa888('0xb1')]]){this[_0xa888('0x1f')][_0x4aa666[_0xa888('0xb1')]][_0xa888('0xae')]=_0x4aa666[_0xa888('0xaa')];this[_0xa888('0x1f')][_0x4aa666['transfertargetuniqueid']][_0xa888('0xaf')]=_0x4aa666['transfertargetcalleridnum'];if(this[_0xa888('0x1f')][_0x4aa666[_0xa888('0xb2')]]){var _0x157396=this['channels'][_0x4aa666[_0xa888('0xb2')]];this[_0xa888('0x1f')][_0x4aa666[_0xa888('0xb2')]]=this[_0xa888('0x1f')][_0x4aa666[_0xa888('0xb1')]];this[_0xa888('0x1f')][_0x4aa666[_0xa888('0xb1')]]=_0x157396;}}if((this[_0xa888('0x1f')][_0x4aa666[_0xa888('0xb2')]]||this['channels'][_0x4aa666[_0xa888('0xb3')]])&&this[_0xa888('0x1f')][_0x4aa666[_0xa888('0xb0')]]){var _0x33cc31=_['some']([this[_0xa888('0x1f')][_0x4aa666[_0xa888('0xb2')]],this[_0xa888('0x1f')][_0x4aa666[_0xa888('0xb3')]],this[_0xa888('0x1f')][_0x4aa666[_0xa888('0xb0')]]],function(_0x45ccae){return _0x45ccae&&_0x45ccae[_0xa888('0x88')]===_0xa888('0xb4')&&_0x45ccae[_0xa888('0xb5')];});if(_0x33cc31){if(this[_0xa888('0x1f')][_0x4aa666[_0xa888('0xb2')]])this[_0xa888('0x1f')][_0x4aa666[_0xa888('0xb2')]][_0xa888('0x9e')]=_0xa888('0xb6');if(this[_0xa888('0x1f')][_0x4aa666[_0xa888('0xb3')]])this['channels'][_0x4aa666[_0xa888('0xb3')]]['transferType']=_0xa888('0xb6');this['channels'][_0x4aa666[_0xa888('0xb0')]][_0xa888('0x9e')]=_0xa888('0xb6');}}}}catch(_0x272fcd){logger['error']('[%s][voiceCallReport][attendedtransfer]',_0x4aa666[_0xa888('0x3e')],util[_0xa888('0x36')](_0x272fcd,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa888('0x37')][_0xa888('0x2f')]=function(_0x1d252f){try{if(this[_0xa888('0x38')](_0x1d252f)){logger[_0xa888('0x32')]('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x1d252f[_0xa888('0x3e')],_0x1d252f[_0xa888('0xb7')],_0x1d252f[_0xa888('0xb8')]);logger[_0xa888('0x4f')](_0xa888('0xb9'),_0x1d252f[_0xa888('0x3e')],util[_0xa888('0x36')](_0x1d252f,{'showHidden':![],'depth':null}));if(this[_0xa888('0x1f')][_0x1d252f[_0xa888('0xad')]]){this[_0xa888('0x1f')][_0x1d252f[_0xa888('0xad')]]['transfercalleridnum']=_0x1d252f[_0xa888('0xb7')];this[_0xa888('0x1f')][_0x1d252f[_0xa888('0xad')]]['transferconnectedlinenum']=_0x1d252f[_0xa888('0xb8')];this['channels'][_0x1d252f[_0xa888('0xad')]][_0xa888('0x9e')]='BLIND';this['syncHangup']({'event':'BlindTransfer','uniqueid':_0x1d252f['transfereeuniqueid'],'context':_0x1d252f[_0xa888('0x43')],'channel':_0x1d252f[_0xa888('0xba')]});}else{this[_0xa888('0x1f')][_0x1d252f[_0xa888('0xbb')]][_0xa888('0x9e')]=_0xa888('0xbc');}}}catch(_0x3cb19a){logger[_0xa888('0x34')](_0xa888('0xbd'),_0x1d252f[_0xa888('0x3e')],util[_0xa888('0x36')](_0x3cb19a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa888('0x37')][_0xa888('0xbe')]=function(_0xac3e07){try{if(this[_0xa888('0x38')](_0xac3e07)){logger['debug'](_0xa888('0xbf'),_0xac3e07[_0xa888('0x3e')],util['inspect'](_0xac3e07,{'showHidden':![],'depth':null}));if(this[_0xa888('0x1f')][_0xac3e07[_0xa888('0x3e')]]){if(!_[_0xa888('0xc0')](this['channels'][_0xac3e07[_0xa888('0x3e')]][_0xa888('0x6f')])){this[_0xa888('0x1f')][_0xac3e07[_0xa888('0x3e')]][_0xa888('0xc1')]=moment()[_0xa888('0x4a')](_0xa888('0x54'));logger['info'](_0xa888('0xc2'),_0xac3e07[_0xa888('0x3e')],this['channels'][_0xac3e07[_0xa888('0x3e')]]['mohstarttime']);}}}}catch(_0x2a9f36){logger[_0xa888('0x34')]('[%s][voiceCallReport][musiconholdstart]',_0xac3e07[_0xa888('0x3e')],util[_0xa888('0x36')](_0x2a9f36,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa888('0x31')]=function(_0x44e786){try{if(this[_0xa888('0x38')](_0x44e786)){logger[_0xa888('0x4f')](_0xa888('0xc3'),_0x44e786[_0xa888('0x3e')],util[_0xa888('0x36')](_0x44e786,{'showHidden':![],'depth':null}));if(this[_0xa888('0x1f')][_0x44e786[_0xa888('0x3e')]]){if(!_[_0xa888('0xc0')](this[_0xa888('0x1f')][_0x44e786[_0xa888('0x3e')]][_0xa888('0xc1')])){this[_0xa888('0x1f')][_0x44e786[_0xa888('0x3e')]]['mohtime']+=moment()[_0xa888('0xc4')](0x0)[_0xa888('0x97')](this[_0xa888('0x1f')][_0x44e786[_0xa888('0x3e')]][_0xa888('0xc1')],_0xa888('0x63'));logger[_0xa888('0x32')](_0xa888('0xc5'),_0x44e786['uniqueid'],this[_0xa888('0x1f')][_0x44e786['uniqueid']][_0xa888('0xc6')]);delete this[_0xa888('0x1f')][_0x44e786[_0xa888('0x3e')]][_0xa888('0xc1')];}}}}catch(_0x59215e){logger[_0xa888('0x34')](_0xa888('0xc7'),_0x44e786[_0xa888('0x3e')],util['inspect'](_0x59215e,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index d072058..704a0b4 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f57=['isNotNull','isUndefined','emit','uniqueid','inspect','channels','merge','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','value','variable','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','outboundrouteid','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','memberdynamic','memberinterface','memberlastcall','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','duration','endtime','diff','complete','total','answered','holdtime','seconds','billableseconds','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','application','set','applicationdata','appdata','toLowerCase','startsWith','cdr(','split','match','[%s][voiceDialReport][newexten]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','outboundChannels','outbound','applications','variables','dialbegin','syncDialBegin','bind','dialend','varset','syncVarSet','syncNewExten','hangup','syncHangup','prototype'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x3f57,0x1cc));var _0x73f5=function(_0x3b3b22,_0x21b082){_0x3b3b22=_0x3b3b22-0x0;var _0x945829=_0x3f57[_0x3b3b22];return _0x945829;};'use strict';var _=require(_0x73f5('0x0'));var moment=require(_0x73f5('0x1'));var util=require(_0x73f5('0x2'));var Redis=require(_0x73f5('0x3'));var config=require(_0x73f5('0x4'));var logger=require(_0x73f5('0x5'))(_0x73f5('0x6'));var ami=require(_0x73f5('0x7'));config[_0x73f5('0x8')]=_['defaults'](config[_0x73f5('0x8')],{'host':_0x73f5('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x73f5('0x8')]));function VoiceDialReport(_0x5efc04){this['channels']=_0x5efc04[_0x73f5('0xa')];this[_0x73f5('0xb')]=_0x5efc04[_0x73f5('0xb')];this[_0x73f5('0xc')]={};this[_0x73f5('0xd')]={};ami['on'](_0x73f5('0xe'),this[_0x73f5('0xf')][_0x73f5('0x10')](this));ami['on'](_0x73f5('0x11'),this['syncDialEnd']['bind'](this));ami['on'](_0x73f5('0x12'),this[_0x73f5('0x13')]['bind'](this));ami['on']('newexten',this[_0x73f5('0x14')][_0x73f5('0x10')](this));ami['on'](_0x73f5('0x15'),this[_0x73f5('0x16')][_0x73f5('0x10')](this));}VoiceDialReport[_0x73f5('0x17')][_0x73f5('0x18')]=function(_0x8ae3a8){return _0x8ae3a8!==null&&!_[_0x73f5('0x19')](_0x8ae3a8);};VoiceDialReport[_0x73f5('0x17')][_0x73f5('0x1a')]=function(_0x3a28c1,_0x163be7,_0x5ccdc6){io['to'](_0x3a28c1)[_0x73f5('0x1a')](_0x163be7,_0x5ccdc6);};VoiceDialReport[_0x73f5('0x17')][_0x73f5('0xf')]=function(_0x5ce539){try{if(this[_0x73f5('0x18')](_0x5ce539)){logger['debug']('[%s][voiceDialReport][dialbegin]\x20event:',_0x5ce539[_0x73f5('0x1b')],util[_0x73f5('0x1c')](_0x5ce539,{'showHidden':![],'depth':null}));if(this[_0x73f5('0x1d')][_0x5ce539[_0x73f5('0x1b')]]){_[_0x73f5('0x1e')](this['channels'][_0x5ce539['uniqueid']],{'starttime':moment()['format'](_0x73f5('0x1f')),'lastevent':_0x73f5('0x20'),'interface':_0x5ce539[_0x73f5('0x21')][_0x73f5('0x22')](0x0,_0x5ce539[_0x73f5('0x21')][_0x73f5('0x23')]('-')),'membername':_0x5ce539['channel']['substring'](_0x5ce539[_0x73f5('0x21')][_0x73f5('0x23')]('/')+0x1,_0x5ce539['channel'][_0x73f5('0x23')]('-'))},_['omit'](_0x5ce539,['event',_0x73f5('0x24')]));logger[_0x73f5('0x25')](_0x73f5('0x26'),_0x5ce539['uniqueid'],this['channels'][_0x5ce539[_0x73f5('0x1b')]][_0x73f5('0x27')],this[_0x73f5('0x1d')][_0x5ce539[_0x73f5('0x1b')]][_0x73f5('0x28')]);logger[_0x73f5('0x29')](_0x73f5('0x2a'),_0x5ce539['uniqueid'],util['inspect'](this[_0x73f5('0x1d')][_0x5ce539['uniqueid']],{'showHidden':![],'depth':null}));if(this[_0x73f5('0xc')][_0x5ce539[_0x73f5('0x1b')]])_[_0x73f5('0x1e')](this[_0x73f5('0x1d')][_0x5ce539[_0x73f5('0x1b')]],this[_0x73f5('0xc')][_0x5ce539[_0x73f5('0x1b')]]);this[_0x73f5('0x1a')](_0x73f5('0x2b'),_0x73f5('0x2c'),this[_0x73f5('0x1d')][_0x5ce539['uniqueid']]);logger['debug'](_0x73f5('0x2d'),_0x5ce539[_0x73f5('0x1b')],util['inspect'](this['channels'][_0x5ce539[_0x73f5('0x1b')]],{'showHidden':![],'depth':null}));ami['emit'](_0x73f5('0x2e'),this[_0x73f5('0x1d')][_0x5ce539['uniqueid']]);}}}catch(_0x156cb2){logger[_0x73f5('0x2f')](_0x73f5('0x30'),_0x5ce539[_0x73f5('0x1b')],util[_0x73f5('0x1c')](_0x156cb2,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x73f5('0x17')][_0x73f5('0x31')]=function(_0x1ad718){try{if(this['isNotNull'](_0x1ad718)){logger[_0x73f5('0x29')](_0x73f5('0x32'),_0x1ad718[_0x73f5('0x1b')],util[_0x73f5('0x1c')](_0x1ad718,{'showHidden':![],'depth':null}));if(this[_0x73f5('0x1d')][_0x1ad718[_0x73f5('0x1b')]]){this[_0x73f5('0x1d')][_0x1ad718['uniqueid']][_0x73f5('0x33')]=_0x1ad718[_0x73f5('0x33')];if(_0x1ad718[_0x73f5('0x33')]===_0x73f5('0x34')){this[_0x73f5('0x1d')][_0x1ad718[_0x73f5('0x1b')]][_0x73f5('0x35')]=_0x1ad718['connectedlinenum'];this[_0x73f5('0x1d')][_0x1ad718['uniqueid']][_0x73f5('0x36')]=_0x1ad718[_0x73f5('0x36')];this[_0x73f5('0x1d')][_0x1ad718[_0x73f5('0x1b')]][_0x73f5('0x37')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x73f5('0x1d')][_0x1ad718[_0x73f5('0x1b')]][_0x73f5('0x38')]=_0x73f5('0x39');logger[_0x73f5('0x25')](_0x73f5('0x3a'),_0x1ad718[_0x73f5('0x1b')],_0x1ad718[_0x73f5('0x21')]['substring'](_0x1ad718[_0x73f5('0x21')][_0x73f5('0x23')]('/')+0x1,_0x1ad718[_0x73f5('0x21')]['lastIndexOf']('-')));logger[_0x73f5('0x29')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x1ad718[_0x73f5('0x1b')],util[_0x73f5('0x1c')](this[_0x73f5('0x1d')][_0x1ad718[_0x73f5('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x73f5('0x1a')](_0x73f5('0x3b'),this['channels'][_0x1ad718[_0x73f5('0x1b')]]);}logger[_0x73f5('0x29')](_0x73f5('0x3c'),_0x1ad718[_0x73f5('0x1b')],util[_0x73f5('0x1c')](this[_0x73f5('0x1d')][_0x1ad718[_0x73f5('0x1b')]],{'showHidden':![],'depth':null}));this[_0x73f5('0x1a')](_0x73f5('0x2b'),'voice_outbound_channel:save',this[_0x73f5('0x1d')][_0x1ad718[_0x73f5('0x1b')]]);}}}catch(_0x3fd280){logger[_0x73f5('0x2f')](_0x73f5('0x3d'),_0x1ad718[_0x73f5('0x1b')],util[_0x73f5('0x1c')](_0x3fd280,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x73f5('0x13')]=function(_0x3147e2){try{if(this['isNotNull'](_0x3147e2)){logger[_0x73f5('0x29')](_0x73f5('0x3e'),_0x3147e2[_0x73f5('0x1b')],util[_0x73f5('0x1c')](_0x3147e2,{'showHidden':![],'depth':null}));this[_0x73f5('0x3f')](_0x3147e2[_0x73f5('0x1b')],_[_0x73f5('0x40')](_0x3147e2['variable'])[0x0],_0x3147e2[_0x73f5('0x41')]);if(this[_0x73f5('0x18')](_0x3147e2[_0x73f5('0x42')])&&this[_0x73f5('0x18')](_0x3147e2[_0x73f5('0x42')]['outboundrouteid'])){if(_[_0x73f5('0x19')](this[_0x73f5('0x1d')][_0x3147e2[_0x73f5('0x1b')]])){this['channels'][_0x3147e2[_0x73f5('0x1b')]]={'routeId':_0x3147e2['value'],'variables':this[_0x73f5('0xd')][_0x3147e2[_0x73f5('0x1b')]],'motionChannel':'voice'};logger['info'](_0x73f5('0x43'),_0x3147e2['uniqueid'],_0x3147e2[_0x73f5('0x42')][_0x73f5('0x44')],_[_0x73f5('0x40')](_0x3147e2[_0x73f5('0x42')])[0x0],_0x3147e2[_0x73f5('0x41')]);logger[_0x73f5('0x29')](_0x73f5('0x45'),_0x3147e2[_0x73f5('0x1b')],util[_0x73f5('0x1c')](this[_0x73f5('0x1d')][_0x3147e2[_0x73f5('0x1b')]],{'showHidden':![],'depth':null}));this[_0x73f5('0x1a')]('voice:outbound','voice_outbound_channel:save',this[_0x73f5('0x1d')][_0x3147e2[_0x73f5('0x1b')]]);}}}}catch(_0x359633){logger['error'](_0x73f5('0x46'),_0x3147e2[_0x73f5('0x1b')],util[_0x73f5('0x1c')](_0x359633,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x73f5('0x17')][_0x73f5('0x3f')]=function(_0x3345dc,_0x521cac,_0x1d258d){var _0x3559b3=['rtpaudioqos','rtpaudioqosbridged',_0x73f5('0x47'),_0x73f5('0x48'),'rtpaudioqosloss',_0x73f5('0x49'),_0x73f5('0x4a'),_0x73f5('0x4b'),_0x73f5('0x4c'),'sipuri',_0x73f5('0x4d'),'bridgepvtcallid','membercalls',_0x73f5('0x4e'),_0x73f5('0x4f'),_0x73f5('0x50'),_0x73f5('0x27'),'memberpenalty','memberrealtime'];if(!_[_0x73f5('0x51')](_0x521cac)&&!_[_0x73f5('0x52')](_0x3559b3,_0x521cac)){if(_[_0x73f5('0x19')](this[_0x73f5('0xd')][_0x3345dc])){this['variables'][_0x3345dc]={};}this[_0x73f5('0xd')][_0x3345dc][_0x521cac]=_0x1d258d;}};VoiceDialReport[_0x73f5('0x17')]['syncHangup']=function(_0xa37e9d){try{if(this[_0x73f5('0x18')](_0xa37e9d)){logger[_0x73f5('0x29')](_0x73f5('0x53'),_0xa37e9d[_0x73f5('0x1b')],util['inspect'](_0xa37e9d,{'showHidden':![],'depth':null}));if(this[_0x73f5('0x1d')][_0xa37e9d[_0x73f5('0x1b')]]){logger[_0x73f5('0x25')](_0x73f5('0x54'),_0xa37e9d['uniqueid'],_0xa37e9d[_0x73f5('0x55')]);this['channels'][_0xa37e9d[_0x73f5('0x1b')]]['endtime']=moment()['format'](_0x73f5('0x1f'));this[_0x73f5('0x1d')][_0xa37e9d[_0x73f5('0x1b')]][_0x73f5('0x56')]=moment(this['channels'][_0xa37e9d[_0x73f5('0x1b')]][_0x73f5('0x57')])[_0x73f5('0x58')](this['channels'][_0xa37e9d['uniqueid']]['starttime'],'seconds');this['channels'][_0xa37e9d['uniqueid']][_0x73f5('0x38')]=_0x73f5('0x59');this[_0x73f5('0xb')][_0x73f5('0x5a')]+=0x1;if(this[_0x73f5('0x1d')][_0xa37e9d[_0x73f5('0x1b')]][_0x73f5('0x37')]){this[_0x73f5('0xb')][_0x73f5('0x5b')]+=0x1;this['channels'][_0xa37e9d[_0x73f5('0x1b')]][_0x73f5('0x5c')]=moment(this[_0x73f5('0x1d')][_0xa37e9d[_0x73f5('0x1b')]]['answertime'])[_0x73f5('0x58')](this[_0x73f5('0x1d')][_0xa37e9d[_0x73f5('0x1b')]]['starttime'],_0x73f5('0x5d'));this[_0x73f5('0x1d')][_0xa37e9d['uniqueid']][_0x73f5('0x5e')]=moment(this[_0x73f5('0x1d')][_0xa37e9d[_0x73f5('0x1b')]]['endtime'])[_0x73f5('0x58')](this[_0x73f5('0x1d')][_0xa37e9d[_0x73f5('0x1b')]][_0x73f5('0x37')],'seconds');this[_0x73f5('0xb')]['sumHoldTime']+=this[_0x73f5('0x1d')][_0xa37e9d['uniqueid']][_0x73f5('0x5c')]||0x0;this[_0x73f5('0xb')][_0x73f5('0x5f')]+=this[_0x73f5('0x1d')][_0xa37e9d[_0x73f5('0x1b')]][_0x73f5('0x5e')];}this['outbound'][_0x73f5('0x60')]+=this[_0x73f5('0x1d')][_0xa37e9d['uniqueid']][_0x73f5('0x56')];logger[_0x73f5('0x29')](_0x73f5('0x61'),_0xa37e9d[_0x73f5('0x1b')],util[_0x73f5('0x1c')](this[_0x73f5('0x1d')][_0xa37e9d[_0x73f5('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x73f5('0x1a')](_0x73f5('0x62'),this['channels'][_0xa37e9d[_0x73f5('0x1b')]]);logger[_0x73f5('0x29')](_0x73f5('0x63'),_0xa37e9d[_0x73f5('0x1b')],util[_0x73f5('0x1c')](this[_0x73f5('0x1d')][_0xa37e9d['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x73f5('0x1a')](_0x73f5('0x64'),this[_0x73f5('0x1d')][_0xa37e9d['uniqueid']]);logger['debug'](_0x73f5('0x65'),_0xa37e9d[_0x73f5('0x1b')],util['inspect'](this[_0x73f5('0x1d')][_0xa37e9d[_0x73f5('0x1b')]],{'showHidden':![],'depth':null}));this[_0x73f5('0x1a')](_0x73f5('0x2b'),_0x73f5('0x66'),this[_0x73f5('0xb')]);logger['info'](_0x73f5('0x67'),JSON['stringify'](this['channels'][_0xa37e9d[_0x73f5('0x1b')]]));logger[_0x73f5('0x29')](_0x73f5('0x68'),_0xa37e9d['uniqueid'],util[_0x73f5('0x1c')](this[_0x73f5('0x1d')][_0xa37e9d[_0x73f5('0x1b')]],{'showHidden':![],'depth':null}));this[_0x73f5('0x1a')]('voice:outbound',_0x73f5('0x69'),this[_0x73f5('0x1d')][_0xa37e9d[_0x73f5('0x1b')]]);delete this[_0x73f5('0x1d')][_0xa37e9d['uniqueid']];}else if(this[_0x73f5('0x1d')][_0xa37e9d[_0x73f5('0x6a')]]){this['channels'][_0xa37e9d['linkedid']]['uniqueid']=this[_0x73f5('0x1d')][_0xa37e9d[_0x73f5('0x6a')]][_0x73f5('0x6b')];}if(this[_0x73f5('0xd')][_0xa37e9d[_0x73f5('0x1b')]]){delete this[_0x73f5('0xd')][_0xa37e9d[_0x73f5('0x1b')]];}}}catch(_0x5061d8){logger[_0x73f5('0x2f')](_0x73f5('0x6c'),_0xa37e9d[_0x73f5('0x1b')],util[_0x73f5('0x1c')](_0x5061d8,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x73f5('0x14')]=function(_0x5be37d){try{if(this['isNotNull'](_0x5be37d)){logger[_0x73f5('0x29')](_0x73f5('0x6d'),_0x5be37d[_0x73f5('0x1b')],util['inspect'](_0x5be37d,{'showHidden':![],'depth':null}));if(_0x5be37d[_0x73f5('0x6e')]['toLowerCase']()===_0x73f5('0x6f')){_0x5be37d[_0x73f5('0x70')]=(_0x5be37d[_0x73f5('0x71')]||_0x5be37d[_0x73f5('0x70')])[_0x73f5('0x72')]();if(_[_0x73f5('0x73')](_0x5be37d[_0x73f5('0x70')],_0x73f5('0x74'))){if(_[_0x73f5('0x19')](this['applications'][_0x5be37d['uniqueid']]))this['applications'][_0x5be37d[_0x73f5('0x1b')]]={};logger[_0x73f5('0x25')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x5be37d[_0x73f5('0x1b')],_0x5be37d[_0x73f5('0x6e')],_0x5be37d[_0x73f5('0x70')]);var _0x1a0182=_0x5be37d[_0x73f5('0x70')][_0x73f5('0x75')]('=');var _0x5798bc=_0x1a0182[0x0][_0x73f5('0x76')](/cdr\((.*)\)/);if(_0x5798bc)this[_0x73f5('0xc')][_0x5be37d[_0x73f5('0x1b')]][_0x5798bc[0x1]]=_0x1a0182[0x1];}}}}catch(_0x163ae9){logger[_0x73f5('0x2f')](_0x73f5('0x77'),_0x5be37d[_0x73f5('0x1b')],util[_0x73f5('0x1c')](_0x163ae9,{'showHidden':![],'depth':null}));}};module[_0x73f5('0x78')]=VoiceDialReport; \ No newline at end of file +var _0x5352=['lodash','moment','ami','redis','defaults','socket.io-emitter','outboundChannels','outbound','applications','variables','dialbegin','syncDialBegin','bind','dialend','varset','syncVarSet','newexten','syncNewExten','hangup','prototype','isNotNull','emit','debug','inspect','uniqueid','merge','channels','format','channel','lastIndexOf','substring','omit','event','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','custom:dialbegin','error','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','voice:outbound','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','value','variable','outboundrouteid','isUndefined','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','includes','syncHangup','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds','complete','total','answered','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','appdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceDialReport][newexten]'];(function(_0x212721,_0x1c0edc){var _0x369f08=function(_0x1c6077){while(--_0x1c6077){_0x212721['push'](_0x212721['shift']());}};_0x369f08(++_0x1c0edc);}(_0x5352,0x78));var _0x2535=function(_0x2de6f1,_0x14d8fa){_0x2de6f1=_0x2de6f1-0x0;var _0x13863c=_0x5352[_0x2de6f1];return _0x13863c;};'use strict';var _=require(_0x2535('0x0'));var moment=require(_0x2535('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x2535('0x2'));var ami=require('../ami');config[_0x2535('0x3')]=_[_0x2535('0x4')](config[_0x2535('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x2535('0x5'))(new Redis(config[_0x2535('0x3')]));function VoiceDialReport(_0x4ead26){this['channels']=_0x4ead26[_0x2535('0x6')];this[_0x2535('0x7')]=_0x4ead26[_0x2535('0x7')];this[_0x2535('0x8')]={};this[_0x2535('0x9')]={};ami['on'](_0x2535('0xa'),this[_0x2535('0xb')][_0x2535('0xc')](this));ami['on'](_0x2535('0xd'),this['syncDialEnd'][_0x2535('0xc')](this));ami['on'](_0x2535('0xe'),this[_0x2535('0xf')][_0x2535('0xc')](this));ami['on'](_0x2535('0x10'),this[_0x2535('0x11')][_0x2535('0xc')](this));ami['on'](_0x2535('0x12'),this['syncHangup'][_0x2535('0xc')](this));}VoiceDialReport[_0x2535('0x13')][_0x2535('0x14')]=function(_0x152523){return _0x152523!==null&&!_['isUndefined'](_0x152523);};VoiceDialReport['prototype'][_0x2535('0x15')]=function(_0x46000e,_0x1b4eef,_0x2105fe){io['to'](_0x46000e)[_0x2535('0x15')](_0x1b4eef,_0x2105fe);};VoiceDialReport['prototype'][_0x2535('0xb')]=function(_0x1a4864){try{if(this[_0x2535('0x14')](_0x1a4864)){logger[_0x2535('0x16')]('[%s][voiceDialReport][dialbegin]\x20event:',_0x1a4864['uniqueid'],util[_0x2535('0x17')](_0x1a4864,{'showHidden':![],'depth':null}));if(this['channels'][_0x1a4864[_0x2535('0x18')]]){_[_0x2535('0x19')](this[_0x2535('0x1a')][_0x1a4864[_0x2535('0x18')]],{'starttime':moment()[_0x2535('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','interface':_0x1a4864[_0x2535('0x1c')]['substring'](0x0,_0x1a4864['channel'][_0x2535('0x1d')]('-')),'membername':_0x1a4864[_0x2535('0x1c')][_0x2535('0x1e')](_0x1a4864[_0x2535('0x1c')][_0x2535('0x1d')]('/')+0x1,_0x1a4864['channel']['lastIndexOf']('-'))},_[_0x2535('0x1f')](_0x1a4864,[_0x2535('0x20'),'privilege']));logger[_0x2535('0x21')](_0x2535('0x22'),_0x1a4864[_0x2535('0x18')],this[_0x2535('0x1a')][_0x1a4864[_0x2535('0x18')]]['membername'],this[_0x2535('0x1a')][_0x1a4864[_0x2535('0x18')]]['interface']);logger[_0x2535('0x16')](_0x2535('0x23'),_0x1a4864[_0x2535('0x18')],util[_0x2535('0x17')](this[_0x2535('0x1a')][_0x1a4864[_0x2535('0x18')]],{'showHidden':![],'depth':null}));if(this['applications'][_0x1a4864['uniqueid']])_[_0x2535('0x19')](this[_0x2535('0x1a')][_0x1a4864[_0x2535('0x18')]],this[_0x2535('0x8')][_0x1a4864[_0x2535('0x18')]]);this['emit']('voice:outbound',_0x2535('0x24'),this[_0x2535('0x1a')][_0x1a4864[_0x2535('0x18')]]);logger[_0x2535('0x16')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x1a4864['uniqueid'],util[_0x2535('0x17')](this[_0x2535('0x1a')][_0x1a4864[_0x2535('0x18')]],{'showHidden':![],'depth':null}));ami[_0x2535('0x15')](_0x2535('0x25'),this['channels'][_0x1a4864[_0x2535('0x18')]]);}}}catch(_0x2aeb06){logger[_0x2535('0x26')]('[%s][voiceDialReport][dialbegin]',_0x1a4864[_0x2535('0x18')],util[_0x2535('0x17')](_0x2aeb06,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x2535('0x13')][_0x2535('0x27')]=function(_0x43c2bc){try{if(this[_0x2535('0x14')](_0x43c2bc)){logger[_0x2535('0x16')](_0x2535('0x28'),_0x43c2bc[_0x2535('0x18')],util[_0x2535('0x17')](_0x43c2bc,{'showHidden':![],'depth':null}));if(this[_0x2535('0x1a')][_0x43c2bc[_0x2535('0x18')]]){this[_0x2535('0x1a')][_0x43c2bc[_0x2535('0x18')]][_0x2535('0x29')]=_0x43c2bc[_0x2535('0x29')];if(_0x43c2bc['dialstatus']===_0x2535('0x2a')){this[_0x2535('0x1a')][_0x43c2bc['uniqueid']][_0x2535('0x2b')]=_0x43c2bc[_0x2535('0x2b')];this['channels'][_0x43c2bc[_0x2535('0x18')]][_0x2535('0x2c')]=_0x43c2bc[_0x2535('0x2c')];this['channels'][_0x43c2bc[_0x2535('0x18')]][_0x2535('0x2d')]=moment()[_0x2535('0x1b')](_0x2535('0x2e'));this[_0x2535('0x1a')][_0x43c2bc[_0x2535('0x18')]][_0x2535('0x2f')]=_0x2535('0x30');logger[_0x2535('0x21')](_0x2535('0x31'),_0x43c2bc[_0x2535('0x18')],_0x43c2bc[_0x2535('0x1c')]['substring'](_0x43c2bc['channel'][_0x2535('0x1d')]('/')+0x1,_0x43c2bc['channel'][_0x2535('0x1d')]('-')));logger[_0x2535('0x16')](_0x2535('0x32'),_0x43c2bc[_0x2535('0x18')],util[_0x2535('0x17')](this['channels'][_0x43c2bc['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x2535('0x15')]('custom:dialconnect',this[_0x2535('0x1a')][_0x43c2bc[_0x2535('0x18')]]);}logger[_0x2535('0x16')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x43c2bc[_0x2535('0x18')],util[_0x2535('0x17')](this[_0x2535('0x1a')][_0x43c2bc[_0x2535('0x18')]],{'showHidden':![],'depth':null}));this[_0x2535('0x15')](_0x2535('0x33'),_0x2535('0x24'),this['channels'][_0x43c2bc[_0x2535('0x18')]]);}}}catch(_0x1f87d6){logger[_0x2535('0x26')](_0x2535('0x34'),_0x43c2bc[_0x2535('0x18')],util[_0x2535('0x17')](_0x1f87d6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x2535('0x13')][_0x2535('0xf')]=function(_0x4eda3a){try{if(this['isNotNull'](_0x4eda3a)){logger['debug'](_0x2535('0x35'),_0x4eda3a[_0x2535('0x18')],util[_0x2535('0x17')](_0x4eda3a,{'showHidden':![],'depth':null}));this[_0x2535('0x36')](_0x4eda3a[_0x2535('0x18')],_[_0x2535('0x37')](_0x4eda3a['variable'])[0x0],_0x4eda3a[_0x2535('0x38')]);if(this[_0x2535('0x14')](_0x4eda3a[_0x2535('0x39')])&&this[_0x2535('0x14')](_0x4eda3a[_0x2535('0x39')][_0x2535('0x3a')])){if(_[_0x2535('0x3b')](this['channels'][_0x4eda3a['uniqueid']])){this[_0x2535('0x1a')][_0x4eda3a['uniqueid']]={'routeId':_0x4eda3a[_0x2535('0x38')],'variables':this[_0x2535('0x9')][_0x4eda3a[_0x2535('0x18')]],'motionChannel':_0x2535('0x3c')};logger[_0x2535('0x21')](_0x2535('0x3d'),_0x4eda3a['uniqueid'],_0x4eda3a[_0x2535('0x39')][_0x2535('0x3a')],_[_0x2535('0x37')](_0x4eda3a[_0x2535('0x39')])[0x0],_0x4eda3a[_0x2535('0x38')]);logger[_0x2535('0x16')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x4eda3a[_0x2535('0x18')],util[_0x2535('0x17')](this[_0x2535('0x1a')][_0x4eda3a[_0x2535('0x18')]],{'showHidden':![],'depth':null}));this[_0x2535('0x15')](_0x2535('0x33'),'voice_outbound_channel:save',this[_0x2535('0x1a')][_0x4eda3a['uniqueid']]);}}}}catch(_0x38f3e7){logger[_0x2535('0x26')](_0x2535('0x3e'),_0x4eda3a[_0x2535('0x18')],util[_0x2535('0x17')](_0x38f3e7,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x2535('0x13')][_0x2535('0x36')]=function(_0x5b4121,_0x5b4af9,_0x4a6431){var _0x168ace=[_0x2535('0x3f'),_0x2535('0x40'),_0x2535('0x41'),_0x2535('0x42'),_0x2535('0x43'),'rtpaudioqoslossbridged',_0x2535('0x44'),_0x2535('0x45'),_0x2535('0x46'),_0x2535('0x47'),_0x2535('0x48'),_0x2535('0x49'),'membercalls','memberdynamic',_0x2535('0x4a'),_0x2535('0x4b'),_0x2535('0x4c'),_0x2535('0x4d'),_0x2535('0x4e')];if(!_['isNil'](_0x5b4af9)&&!_[_0x2535('0x4f')](_0x168ace,_0x5b4af9)){if(_['isUndefined'](this['variables'][_0x5b4121])){this[_0x2535('0x9')][_0x5b4121]={};}this[_0x2535('0x9')][_0x5b4121][_0x5b4af9]=_0x4a6431;}};VoiceDialReport[_0x2535('0x13')][_0x2535('0x50')]=function(_0x416240){try{if(this[_0x2535('0x14')](_0x416240)){logger['debug'](_0x2535('0x51'),_0x416240[_0x2535('0x18')],util[_0x2535('0x17')](_0x416240,{'showHidden':![],'depth':null}));if(this['channels'][_0x416240[_0x2535('0x18')]]){logger[_0x2535('0x21')](_0x2535('0x52'),_0x416240['uniqueid'],_0x416240[_0x2535('0x53')]);this['channels'][_0x416240[_0x2535('0x18')]][_0x2535('0x54')]=moment()[_0x2535('0x1b')](_0x2535('0x2e'));this['channels'][_0x416240[_0x2535('0x18')]][_0x2535('0x55')]=moment(this['channels'][_0x416240[_0x2535('0x18')]][_0x2535('0x54')])[_0x2535('0x56')](this[_0x2535('0x1a')][_0x416240['uniqueid']][_0x2535('0x57')],_0x2535('0x58'));this[_0x2535('0x1a')][_0x416240[_0x2535('0x18')]][_0x2535('0x2f')]=_0x2535('0x59');this['outbound'][_0x2535('0x5a')]+=0x1;if(this['channels'][_0x416240[_0x2535('0x18')]][_0x2535('0x2d')]){this[_0x2535('0x7')][_0x2535('0x5b')]+=0x1;this['channels'][_0x416240[_0x2535('0x18')]][_0x2535('0x5c')]=moment(this[_0x2535('0x1a')][_0x416240['uniqueid']][_0x2535('0x2d')])['diff'](this['channels'][_0x416240[_0x2535('0x18')]][_0x2535('0x57')],_0x2535('0x58'));this[_0x2535('0x1a')][_0x416240[_0x2535('0x18')]][_0x2535('0x5d')]=moment(this['channels'][_0x416240[_0x2535('0x18')]]['endtime'])['diff'](this[_0x2535('0x1a')][_0x416240[_0x2535('0x18')]]['answertime'],_0x2535('0x58'));this['outbound'][_0x2535('0x5e')]+=this[_0x2535('0x1a')][_0x416240[_0x2535('0x18')]][_0x2535('0x5c')]||0x0;this[_0x2535('0x7')][_0x2535('0x5f')]+=this[_0x2535('0x1a')][_0x416240[_0x2535('0x18')]][_0x2535('0x5d')];}this[_0x2535('0x7')][_0x2535('0x60')]+=this[_0x2535('0x1a')][_0x416240[_0x2535('0x18')]][_0x2535('0x55')];logger[_0x2535('0x16')](_0x2535('0x61'),_0x416240[_0x2535('0x18')],util[_0x2535('0x17')](this[_0x2535('0x1a')][_0x416240[_0x2535('0x18')]],{'showHidden':![],'depth':null}));ami[_0x2535('0x15')](_0x2535('0x62'),this[_0x2535('0x1a')][_0x416240[_0x2535('0x18')]]);logger[_0x2535('0x16')](_0x2535('0x63'),_0x416240[_0x2535('0x18')],util[_0x2535('0x17')](this[_0x2535('0x1a')][_0x416240[_0x2535('0x18')]],{'showHidden':![],'depth':null}));ami[_0x2535('0x15')]('custom:dialend',this[_0x2535('0x1a')][_0x416240[_0x2535('0x18')]]);logger['debug'](_0x2535('0x64'),_0x416240['uniqueid'],util[_0x2535('0x17')](this[_0x2535('0x1a')][_0x416240[_0x2535('0x18')]],{'showHidden':![],'depth':null}));this[_0x2535('0x15')]('voice:outbound',_0x2535('0x65'),this['outbound']);logger[_0x2535('0x21')](_0x2535('0x66'),JSON[_0x2535('0x67')](this[_0x2535('0x1a')][_0x416240[_0x2535('0x18')]]));logger[_0x2535('0x16')](_0x2535('0x68'),_0x416240[_0x2535('0x18')],util[_0x2535('0x17')](this[_0x2535('0x1a')][_0x416240[_0x2535('0x18')]],{'showHidden':![],'depth':null}));this[_0x2535('0x15')](_0x2535('0x33'),_0x2535('0x69'),this['channels'][_0x416240[_0x2535('0x18')]]);delete this[_0x2535('0x1a')][_0x416240['uniqueid']];}else if(this[_0x2535('0x1a')][_0x416240[_0x2535('0x6a')]]){this[_0x2535('0x1a')][_0x416240[_0x2535('0x6a')]][_0x2535('0x18')]=this[_0x2535('0x1a')][_0x416240[_0x2535('0x6a')]]['destuniqueid'];}if(this[_0x2535('0x9')][_0x416240[_0x2535('0x18')]]){delete this[_0x2535('0x9')][_0x416240[_0x2535('0x18')]];}}}catch(_0x4a41ef){logger[_0x2535('0x26')](_0x2535('0x6b'),_0x416240[_0x2535('0x18')],util[_0x2535('0x17')](_0x4a41ef,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x2535('0x13')][_0x2535('0x11')]=function(_0x22836e){try{if(this[_0x2535('0x14')](_0x22836e)){logger[_0x2535('0x16')](_0x2535('0x6c'),_0x22836e[_0x2535('0x18')],util[_0x2535('0x17')](_0x22836e,{'showHidden':![],'depth':null}));if(_0x22836e[_0x2535('0x6d')][_0x2535('0x6e')]()===_0x2535('0x6f')){_0x22836e[_0x2535('0x70')]=(_0x22836e[_0x2535('0x71')]||_0x22836e[_0x2535('0x70')])[_0x2535('0x6e')]();if(_[_0x2535('0x72')](_0x22836e[_0x2535('0x70')],_0x2535('0x73'))){if(_[_0x2535('0x3b')](this[_0x2535('0x8')][_0x22836e[_0x2535('0x18')]]))this[_0x2535('0x8')][_0x22836e[_0x2535('0x18')]]={};logger[_0x2535('0x21')](_0x2535('0x74'),_0x22836e[_0x2535('0x18')],_0x22836e[_0x2535('0x6d')],_0x22836e[_0x2535('0x70')]);var _0x3bda25=_0x22836e[_0x2535('0x70')][_0x2535('0x75')]('=');var _0x4a9c12=_0x3bda25[0x0][_0x2535('0x76')](/cdr\((.*)\)/);if(_0x4a9c12)this[_0x2535('0x8')][_0x22836e[_0x2535('0x18')]][_0x4a9c12[0x1]]=_0x3bda25[0x1];}}}}catch(_0x32896c){logger[_0x2535('0x26')](_0x2535('0x77'),_0x22836e[_0x2535('0x18')],util['inspect'](_0x32896c,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 6d7134a..0bd9b68 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4bd=['holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerabandon]','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[%s][voiceQueueReport][agentconnect]','queuecallercomplete','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','membername','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','toLowerCase','local/','linkedid','queuecallerexit','add','seconds','FORWARDTRANSFER','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','addVariable','variable','value','CONTINUE','TIMEOUT','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','[%s][voiceQueueReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceQueueReport][hangup]','length','abandoned','sumHoldTime','diff','milliseconds','answered','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','transferexten','secondtransfererexten','ATTENDEDTRANSFER','ATTENDED','secondtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfereruniqueid','transfertype','[%s][voiceQueueReport][blindtransfer]','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','[%s][voiceQueueReport][newexten]\x20event:','application','applicationdata','appdata','startsWith','CDR(routeAlias)','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','[%s][voiceQueueReport][newexten]','exports','lodash','moment','util','md5','ioredis','../../../config/logger','ami','../ami','../model/queueReport','redis','localhost','prototype','tail','finally','sequence','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','agentconnect','syncAgentConnect','varset','hangup','syncHangup','fullybooted','syncFullyBooted','newexten','syncNewExten','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','hasOwnProperty','originated','isEmpty','talking','pTalking','waiting','queueStatusComplete','unlockRR','clearZombieChannels','switch','enqueue','isNil','status','channel','message','[%s][voiceQueueReport][checkChannel]','queueReports','error','inspect','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','format','name','voice_queue_channel:save','voice_queue_presence:save','uniqueid','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','emitVoiceQueueSummary','type','inbound','strategy','available','loggedIn','sumBillable','sumDuration','total','unmanaged','Trunk','active','callerid','Interval','stringify','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','isUndefined','loopQueueShow','queues','[voiceQueueReport][queues]','Action','queuesummary','catch','[voiceQueueReport][queuesummary]','queue','[voiceQueueReport][queuesummary]\x20event:','info','[voiceQueueReport][queuesummary]\x20name:%s','countBy','callers','toNumber','loggedin','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','routealias','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','keys','last','queuecallercompleteAt'];(function(_0x3080a2,_0x2dd76c){var _0x246cdd=function(_0x31c62a){while(--_0x31c62a){_0x3080a2['push'](_0x3080a2['shift']());}};_0x246cdd(++_0x2dd76c);}(_0xd4bd,0x15f));var _0xdd4b=function(_0x14911e,_0x578e33){_0x14911e=_0x14911e-0x0;var _0x46ed87=_0xd4bd[_0x14911e];return _0x46ed87;};'use strict';var _=require(_0xdd4b('0x0'));var moment=require(_0xdd4b('0x1'));var util=require(_0xdd4b('0x2'));var md5=require(_0xdd4b('0x3'));var Redis=require(_0xdd4b('0x4'));var config=require('../../../config/environment');var logger=require(_0xdd4b('0x5'))(_0xdd4b('0x6'));var ami=require(_0xdd4b('0x7'));var QueueReport=require(_0xdd4b('0x8'));config[_0xdd4b('0x9')]=_['defaults'](config['redis'],{'host':_0xdd4b('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdd4b('0x9')]));var Sequence=function(){};Sequence[_0xdd4b('0xb')]['enqueue']=function(_0x521de8){this[_0xdd4b('0xc')]=this[_0xdd4b('0xc')]?this['tail'][_0xdd4b('0xd')](_0x521de8):_0x521de8();};function VoiceQueueReport(_0x14be78){this[_0xdd4b('0xe')]=new Sequence();this['queueReports']={};this[_0xdd4b('0xf')]=_0x14be78[_0xdd4b('0xf')];this[_0xdd4b('0x10')]=_0x14be78[_0xdd4b('0x11')];this[_0xdd4b('0x12')]=_0x14be78[_0xdd4b('0x12')];this[_0xdd4b('0x13')]=!![];this[_0xdd4b('0x14')]=_0x14be78['campaigns'];this[_0xdd4b('0x15')]={};ami['on']('queuesummary',this[_0xdd4b('0x16')][_0xdd4b('0x17')](this));ami['on'](_0xdd4b('0x18'),this[_0xdd4b('0x19')][_0xdd4b('0x17')](this));ami['on'](_0xdd4b('0x1a'),this['syncQueueCallerJoin']['bind'](this));ami['on'](_0xdd4b('0x1b'),this[_0xdd4b('0x1c')][_0xdd4b('0x17')](this));ami['on'](_0xdd4b('0x1d'),this[_0xdd4b('0x1e')][_0xdd4b('0x17')](this));ami['on'](_0xdd4b('0x1f'),this['syncAgentComplete'][_0xdd4b('0x17')](this));ami['on'](_0xdd4b('0x20'),this[_0xdd4b('0x21')]['bind'](this));ami['on'](_0xdd4b('0x22'),this['syncVarSet']['bind'](this));ami['on'](_0xdd4b('0x23'),this[_0xdd4b('0x24')]['bind'](this));ami['on'](_0xdd4b('0x25'),this[_0xdd4b('0x26')][_0xdd4b('0x17')](this));ami['on'](_0xdd4b('0x27'),this[_0xdd4b('0x28')][_0xdd4b('0x17')](this));ami['on'](_0xdd4b('0x29'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0xdd4b('0x2a'),this[_0xdd4b('0x2b')][_0xdd4b('0x17')](this));ami['on']('attendedtransfer',this[_0xdd4b('0x2c')][_0xdd4b('0x17')](this));ami['on'](_0xdd4b('0x2d'),this[_0xdd4b('0x2e')][_0xdd4b('0x17')](this));this[_0xdd4b('0x2f')]();this['loopQueueShow']();}function clearChannels(_0x5a8cd3){if(!_['isEmpty'](_0x5a8cd3)){for(var _0xd6bfcb in _0x5a8cd3){if(_0x5a8cd3[_0xdd4b('0x30')](_0xd6bfcb)){delete _0x5a8cd3[_0xd6bfcb];}}}}function clearCampaigns(_0x559007){if(!_['isEmpty'](_0x559007)){for(var _0x2d4f73 in _0x559007){if(_0x559007[_0xdd4b('0x30')](_0x2d4f73)){_0x559007[_0x2d4f73][_0xdd4b('0x31')]=0x0;}}}}function clearVoiceQueues(_0x338f9d){if(!_[_0xdd4b('0x32')](_0x338f9d)){for(var _0x4c1396 in _0x338f9d){if(_0x338f9d[_0xdd4b('0x30')](_0x4c1396)){_0x338f9d[_0x4c1396][_0xdd4b('0x31')]=0x0;_0x338f9d[_0x4c1396][_0xdd4b('0x33')]=0x0;_0x338f9d[_0x4c1396][_0xdd4b('0x34')]=0x0;_0x338f9d[_0x4c1396][_0xdd4b('0x35')]=0x0;_0x338f9d[_0x4c1396][_0xdd4b('0x36')]=!![];}}}}function clearAgentBooked(_0x4de481){if(!_[_0xdd4b('0x32')](_0x4de481)){for(var _0x3c841a in _0x4de481){if(_0x4de481[_0xdd4b('0x30')](_0x3c841a)){_0x4de481[_0x3c841a][_0xdd4b('0x37')]=!![];}}}}VoiceQueueReport[_0xdd4b('0xb')][_0xdd4b('0x38')]=function(){var _0x448f34=this;for(var _0x28f178 in this[_0xdd4b('0x10')]){if(this[_0xdd4b('0x10')][_0xdd4b('0x30')](_0x28f178)&&!this[_0xdd4b('0x10')][_0x28f178][_0xdd4b('0x39')]){this[_0xdd4b('0xe')][_0xdd4b('0x3a')](function(){if(!_[_0xdd4b('0x3b')](_0x448f34['channels'][_0x28f178])){return ami['Action']({'action':_0xdd4b('0x3c'),'channel':_0x448f34[_0xdd4b('0x10')][_0x28f178][_0xdd4b('0x3d')]})['catch'](function(_0x2b9426){if(_0x2b9426[_0xdd4b('0x3e')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x448f34['channels'][_0x28f178]){delete _0x448f34[_0xdd4b('0x10')][_0x28f178];logger['error'](_0xdd4b('0x3f'),_0x28f178,util['inspect'](_0x2b9426,{'showHidden':![],'depth':null}));}if(_0x448f34['queueReports'][_0x28f178]){delete _0x448f34[_0xdd4b('0x40')][_0x28f178];logger[_0xdd4b('0x41')]('[%s][voiceQueueReport][checkQueueReport]',_0x28f178,util[_0xdd4b('0x42')](_0x2b9426,{'showHidden':![],'depth':null}));}if(_0x448f34[_0xdd4b('0x15')][_0x28f178]){delete _0x448f34[_0xdd4b('0x15')][_0x28f178];logger[_0xdd4b('0x41')](_0xdd4b('0x43'),_0x28f178,util[_0xdd4b('0x42')](_0x2b9426,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xdd4b('0xb')][_0xdd4b('0x26')]=function(){logger[_0xdd4b('0x41')](_0xdd4b('0x44'));clearChannels(this[_0xdd4b('0x10')]);this[_0xdd4b('0x45')](this[_0xdd4b('0x40')]);clearAgentBooked(this[_0xdd4b('0xf')]);clearVoiceQueues(this[_0xdd4b('0x12')]);clearCampaigns(this['campaigns']);};VoiceQueueReport[_0xdd4b('0xb')][_0xdd4b('0x45')]=function(_0xa7af4e){var _0x10b9ae=this;if(!_[_0xdd4b('0x32')](_0xa7af4e)){for(var _0x190f7b in _0xa7af4e){if(_0xa7af4e[_0xdd4b('0x30')](_0x190f7b)){_0x10b9ae[_0xdd4b('0x46')](_0xa7af4e[_0x190f7b],_0xdd4b('0x47'));delete _0xa7af4e[_0x190f7b];}}}};VoiceQueueReport[_0xdd4b('0xb')][_0xdd4b('0x48')]=function(_0x5df497,_0x1bda92,_0x1d6545){io['to'](_0x5df497)[_0xdd4b('0x48')](_0x1bda92,_0x1d6545);};VoiceQueueReport['prototype'][_0xdd4b('0x49')]=function(_0x18d630,_0x159894){logger[_0xdd4b('0x4a')](_0xdd4b('0x4b')+_0x159894+_0xdd4b('0x4c'),_0x18d630['uniqueid'],util[_0xdd4b('0x42')](_0x18d630,{'showHidden':![],'depth':null}));this[_0xdd4b('0x48')](util[_0xdd4b('0x4d')]('voice:queue:%s',_0x18d630[_0xdd4b('0x4e')]),_0xdd4b('0x4f'),_0x18d630);io[_0xdd4b('0x48')](_0xdd4b('0x50'),_0x18d630);};VoiceQueueReport[_0xdd4b('0xb')]['emitVoiceQueueChannelRemove']=function(_0x293878,_0x44bf64){logger['debug'](_0xdd4b('0x4b')+_0x44bf64+']\x20sending\x20voice_queue_channel:remove\x20event:',_0x293878[_0xdd4b('0x51')],util['inspect'](_0x293878,{'showHidden':![],'depth':null}));this['emit'](util[_0xdd4b('0x4d')](_0xdd4b('0x52'),_0x293878[_0xdd4b('0x4e')]),_0xdd4b('0x53'),_0x293878);io['emit'](_0xdd4b('0x54'),_0x293878);};VoiceQueueReport[_0xdd4b('0xb')][_0xdd4b('0x55')]=function(_0x252299,_0x19408c){if(_0x252299[_0xdd4b('0x56')]===_0xdd4b('0x57')){var _0x572fe0={'id':_0x252299['id'],'name':_0x252299['name'],'strategy':_0x252299[_0xdd4b('0x58')],'answered':_0x252299['answered'],'available':_0x252299[_0xdd4b('0x59')],'loggedIn':_0x252299[_0xdd4b('0x5a')],'pTalking':_0x252299[_0xdd4b('0x34')],'sumBillable':_0x252299[_0xdd4b('0x5b')],'sumDuration':_0x252299[_0xdd4b('0x5c')],'sumHoldTime':_0x252299['sumHoldTime']||0x0,'talking':_0x252299[_0xdd4b('0x33')],'total':_0x252299[_0xdd4b('0x5d')],'type':_0x252299[_0xdd4b('0x56')],'unmanaged':_0x252299[_0xdd4b('0x5e')],'abandoned':_0x252299['abandoned'],'waiting':_0x252299[_0xdd4b('0x35')]};if(_0x252299[_0xdd4b('0x5f')]){_0x572fe0[_0xdd4b('0x5f')]={'id':_0x252299['Trunk']['id'],'name':_0x252299[_0xdd4b('0x5f')][_0xdd4b('0x4e')],'active':_0x252299['Trunk'][_0xdd4b('0x60')],'callerid':_0x252299['Trunk'][_0xdd4b('0x61')]};}if(_0x252299[_0xdd4b('0x62')]){_0x572fe0[_0xdd4b('0x62')]={'id':_0x252299[_0xdd4b('0x62')]['id'],'name':_0x252299[_0xdd4b('0x62')][_0xdd4b('0x4e')]};}var _0x432970=md5(JSON[_0xdd4b('0x63')](_0x572fe0));if(_0x252299[_0xdd4b('0x3')]!==_0x432970){_0x252299['md5']=_0x432970;logger[_0xdd4b('0x4a')](_0xdd4b('0x64')+_0x19408c+_0xdd4b('0x65'),util['inspect'](_0x572fe0,{'showHidden':![],'depth':null}));this[_0xdd4b('0x48')](util[_0xdd4b('0x4d')]('voice:queue:%s',_0x572fe0[_0xdd4b('0x4e')]),_0xdd4b('0x66'),_0x572fe0);}}};VoiceQueueReport[_0xdd4b('0xb')][_0xdd4b('0x67')]=function(_0x195b61){return _0x195b61!==null&&!_[_0xdd4b('0x68')](_0x195b61);};VoiceQueueReport[_0xdd4b('0xb')][_0xdd4b('0x69')]=function(){var _0xda3cc4=this;setInterval(function(){_0xda3cc4[_0xdd4b('0x38')]();ami['Action']({'action':_0xdd4b('0x6a')})['catch'](function(_0x1b0321){logger[_0xdd4b('0x41')](_0xdd4b('0x6b'),util['inspect'](_0x1b0321,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport['prototype']['loopQueueSummary']=function(){var _0x3cfc6d=this;setInterval(function(){if(_0x3cfc6d[_0xdd4b('0x13')]){return ami[_0xdd4b('0x6c')]({'action':_0xdd4b('0x6d')})['then'](function(_0x2f6c7a){_0x3cfc6d[_0xdd4b('0x13')]=![];})[_0xdd4b('0x6e')](function(_0x2a82fc){logger['error'](_0xdd4b('0x6f'),util[_0xdd4b('0x42')](_0x2a82fc,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xdd4b('0xb')][_0xdd4b('0x16')]=function(_0x43f45f){try{if(this[_0xdd4b('0x67')](_0x43f45f)&&this[_0xdd4b('0x67')](_0x43f45f[_0xdd4b('0x70')])){logger[_0xdd4b('0x4a')](_0xdd4b('0x71'),util[_0xdd4b('0x42')](_0x43f45f,{'showHidden':![],'depth':null}));if(this[_0xdd4b('0x12')][_0x43f45f['queue']]){logger[_0xdd4b('0x72')](_0xdd4b('0x73'),_0x43f45f[_0xdd4b('0x70')]);var _0x1405fe=_[_0xdd4b('0x74')](this[_0xdd4b('0x10')],'queue')[_0x43f45f['queue']]||0x0;var _0xe7e246=_0x1405fe-_0x43f45f[_0xdd4b('0x75')];if(this[_0xdd4b('0x12')][_0x43f45f['queue']][_0xdd4b('0x35')]!==_[_0xdd4b('0x76')](_0x43f45f['callers'])||this[_0xdd4b('0x12')][_0x43f45f[_0xdd4b('0x70')]]['loggedIn']!==_['toNumber'](_0x43f45f[_0xdd4b('0x77')])||this[_0xdd4b('0x12')][_0x43f45f[_0xdd4b('0x70')]][_0xdd4b('0x59')]!==_[_0xdd4b('0x76')](_0x43f45f['available'])||this['voiceQueues'][_0x43f45f[_0xdd4b('0x70')]][_0xdd4b('0x33')]!==_0xe7e246){this[_0xdd4b('0x12')][_0x43f45f[_0xdd4b('0x70')]][_0xdd4b('0x35')]=_[_0xdd4b('0x76')](_0x43f45f[_0xdd4b('0x75')]);this[_0xdd4b('0x12')][_0x43f45f[_0xdd4b('0x70')]][_0xdd4b('0x5a')]=_[_0xdd4b('0x76')](_0x43f45f['loggedin']);this[_0xdd4b('0x12')][_0x43f45f[_0xdd4b('0x70')]][_0xdd4b('0x59')]=_[_0xdd4b('0x76')](_0x43f45f[_0xdd4b('0x59')]);this[_0xdd4b('0x12')][_0x43f45f[_0xdd4b('0x70')]][_0xdd4b('0x33')]=_0xe7e246>0x0?_0xe7e246:0x0;this['voiceQueues'][_0x43f45f[_0xdd4b('0x70')]]['talking']=this[_0xdd4b('0x12')][_0x43f45f[_0xdd4b('0x70')]][_0xdd4b('0x33')]>_['toNumber'](_0x43f45f[_0xdd4b('0x77')])?_[_0xdd4b('0x76')](_0x43f45f[_0xdd4b('0x77')]):this[_0xdd4b('0x12')][_0x43f45f[_0xdd4b('0x70')]]['talking'];this['emitVoiceQueueSummary'](this[_0xdd4b('0x12')][_0x43f45f[_0xdd4b('0x70')]],_0xdd4b('0x6d'));}logger[_0xdd4b('0x4a')](_0xdd4b('0x78'),util['inspect'](this['voiceQueues'][_0x43f45f[_0xdd4b('0x70')]],{'showHidden':![],'depth':null}));ami[_0xdd4b('0x48')]('custom:queuesummary',this[_0xdd4b('0x12')][_0x43f45f[_0xdd4b('0x70')]]);}}}catch(_0x1dcc1e){logger[_0xdd4b('0x41')](_0xdd4b('0x6f'),util[_0xdd4b('0x42')](_0x1dcc1e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xdd4b('0xb')][_0xdd4b('0x19')]=function(_0x8c800f){logger[_0xdd4b('0x4a')](_0xdd4b('0x79'),util[_0xdd4b('0x42')](_0x8c800f,{'showHidden':![],'depth':null}));this[_0xdd4b('0x13')]=!![];};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x23d149){try{if(this[_0xdd4b('0x67')](_0x23d149)){logger[_0xdd4b('0x4a')](_0xdd4b('0x7a'),_0x23d149[_0xdd4b('0x51')],util['inspect'](_0x23d149,{'showHidden':![],'depth':null}));if(_[_0xdd4b('0x68')](this['queueReports'][_0x23d149[_0xdd4b('0x51')]]))this[_0xdd4b('0x40')][_0x23d149[_0xdd4b('0x51')]]=[];if(_[_0xdd4b('0x68')](this[_0xdd4b('0x10')][_0x23d149['uniqueid']]))this[_0xdd4b('0x10')][_0x23d149['uniqueid']]={};var _0x1e684f=new QueueReport();_0x1e684f['name']=_0x23d149[_0xdd4b('0x70')];_0x1e684f[_0xdd4b('0x56')]=this[_0xdd4b('0x12')][_0x1e684f['name']]&&this[_0xdd4b('0x12')][_0x1e684f[_0xdd4b('0x4e')]][_0xdd4b('0x56')]?this[_0xdd4b('0x12')][_0x1e684f[_0xdd4b('0x4e')]][_0xdd4b('0x56')]||_0xdd4b('0x57'):_0xdd4b('0x57');_0x1e684f['queue']=_0x23d149[_0xdd4b('0x70')];_0x1e684f[_0xdd4b('0x7b')]=moment()[_0xdd4b('0x4d')](_0xdd4b('0x7c'));_0x1e684f[_0xdd4b('0x7d')]=_0x23d149[_0xdd4b('0x7d')];_0x1e684f['count']=_0x23d149['count'];_0x1e684f['uniqueid']=_0x23d149[_0xdd4b('0x51')];_0x1e684f[_0xdd4b('0x7e')]=this[_0xdd4b('0x10')][_0x23d149[_0xdd4b('0x51')]]['routealias'];logger[_0xdd4b('0x72')](_0xdd4b('0x7f'),_0x1e684f['name'],_0x1e684f[_0xdd4b('0x56')]);_['merge'](_0x1e684f,_['pick'](_0x23d149,_[_0xdd4b('0x80')](_0x1e684f)));this[_0xdd4b('0x40')][_0x23d149[_0xdd4b('0x51')]]['push'](_0x1e684f);this[_0xdd4b('0x10')][_0x23d149[_0xdd4b('0x51')]]=_0x1e684f;this['emitVoiceQueueChannelSave'](_0x1e684f,_0xdd4b('0x1a'));}}catch(_0x18b88){logger[_0xdd4b('0x41')](_0xdd4b('0x7a'),_0x23d149[_0xdd4b('0x51')],util[_0xdd4b('0x42')](_0x18b88,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xdd4b('0xb')]['syncQueueCallerAbandon']=function(_0x500a4d){try{if(this[_0xdd4b('0x67')](_0x500a4d)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x500a4d[_0xdd4b('0x51')],util[_0xdd4b('0x42')](_0x500a4d,{'showHidden':![],'depth':null}));if(this[_0xdd4b('0x40')][_0x500a4d[_0xdd4b('0x51')]]){var _0x1bfafb=_[_0xdd4b('0x81')](this[_0xdd4b('0x40')][_0x500a4d[_0xdd4b('0x51')]]);_0x1bfafb['queuecallercomplete']=![];_0x1bfafb[_0xdd4b('0x82')]=null;_0x1bfafb[_0xdd4b('0x83')]=_0x500a4d[_0xdd4b('0x83')];_0x1bfafb['originalposition']=_0x500a4d[_0xdd4b('0x84')];_0x1bfafb[_0xdd4b('0x1b')]=!![];_0x1bfafb[_0xdd4b('0x85')]=moment()[_0xdd4b('0x4d')](_0xdd4b('0x7c'));_0x1bfafb[_0xdd4b('0x86')]='ABANDONED';_0x1bfafb[_0xdd4b('0x87')]=null;logger['info'](_0xdd4b('0x88'),_0x1bfafb['name'],_0x1bfafb[_0xdd4b('0x56')]);this[_0xdd4b('0x10')][_0x500a4d[_0xdd4b('0x51')]]=_0x1bfafb;this[_0xdd4b('0x46')](_0x1bfafb,_0xdd4b('0x1b'));}}}catch(_0x3e855e){logger[_0xdd4b('0x41')](_0xdd4b('0x89'),_0x500a4d[_0xdd4b('0x51')],util[_0xdd4b('0x42')](_0x3e855e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xdd4b('0xb')][_0xdd4b('0x1e')]=function(_0x11ce28){try{if(this[_0xdd4b('0x67')](_0x11ce28)){logger[_0xdd4b('0x4a')](_0xdd4b('0x8a'),_0x11ce28['uniqueid'],util[_0xdd4b('0x42')](_0x11ce28,{'showHidden':![],'depth':null}));if(this[_0xdd4b('0x40')][_0x11ce28[_0xdd4b('0x51')]]){var _0x547950=_['last'](this[_0xdd4b('0x40')][_0x11ce28['uniqueid']]);_0x547950[_0xdd4b('0x8b')]=moment()[_0xdd4b('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x547950['connectedlinenum']=_0x11ce28[_0xdd4b('0x8c')];_0x547950[_0xdd4b('0x8d')]=_0x11ce28[_0xdd4b('0x8d')];logger[_0xdd4b('0x72')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x547950[_0xdd4b('0x4e')],_0x547950[_0xdd4b('0x56')],_0x11ce28[_0xdd4b('0x8c')],_0x11ce28[_0xdd4b('0x8d')]);this[_0xdd4b('0x10')][_0x11ce28[_0xdd4b('0x51')]]=_0x547950;this[_0xdd4b('0x49')](_0x547950,'queuecallerleave');}}}catch(_0x504fa5){logger['error'](_0xdd4b('0x8a'),_0x11ce28[_0xdd4b('0x51')],util[_0xdd4b('0x42')](_0x504fa5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xdd4b('0xb')][_0xdd4b('0x21')]=function(_0x4d1dac){try{if(this['isNotNull'](_0x4d1dac)){logger['debug'](_0xdd4b('0x8e'),_0x4d1dac[_0xdd4b('0x51')],util['inspect'](_0x4d1dac,{'showHidden':![],'depth':null}));if(this[_0xdd4b('0x40')][_0x4d1dac[_0xdd4b('0x51')]]){var _0x193cc2=_[_0xdd4b('0x81')](this[_0xdd4b('0x40')][_0x4d1dac[_0xdd4b('0x51')]]);_0x193cc2[_0xdd4b('0x8f')]=!![];_0x193cc2['queuecallerexitreason']='COMPLETEDBYAGENT';logger[_0xdd4b('0x72')](_0xdd4b('0x90'),_0x193cc2[_0xdd4b('0x4e')],_0x193cc2[_0xdd4b('0x56')]);}}}catch(_0x2531e8){logger[_0xdd4b('0x41')](_0xdd4b('0x8e'),_0x4d1dac[_0xdd4b('0x51')],util[_0xdd4b('0x42')](_0x2531e8,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x2197df){try{if(this['isNotNull'](_0x2197df)){logger[_0xdd4b('0x4a')](_0xdd4b('0x91'),_0x2197df[_0xdd4b('0x51')],util[_0xdd4b('0x42')](_0x2197df,{'showHidden':![],'depth':null}));if(this[_0xdd4b('0x40')][_0x2197df['uniqueid']]){var _0x4324a2=_[_0xdd4b('0x81')](this[_0xdd4b('0x40')][_0x2197df[_0xdd4b('0x51')]]);_0x4324a2[_0xdd4b('0x1b')]=![];_0x4324a2[_0xdd4b('0x85')]=null;_0x4324a2[_0xdd4b('0x92')]=!![];_0x4324a2[_0xdd4b('0x87')]=_0x2197df[_0xdd4b('0x93')];_0x4324a2[_0xdd4b('0x83')]=_0x2197df[_0xdd4b('0x83')];_0x4324a2[_0xdd4b('0x8f')]=!![];_0x4324a2['queuecallerexit']=![];_0x4324a2[_0xdd4b('0x94')]=null;if(!_0x4324a2[_0xdd4b('0x95')]){if(_0x2197df[_0xdd4b('0x96')]==_0xdd4b('0x95')){_0x4324a2[_0xdd4b('0x86')]=_0xdd4b('0x97');logger[_0xdd4b('0x72')](_0xdd4b('0x98'),_0x4324a2[_0xdd4b('0x4e')],_0x4324a2['type']);}else{if(_['startsWith'](_0x2197df['channel'][_0xdd4b('0x99')](),_0xdd4b('0x9a'))){if(this[_0xdd4b('0x40')][_0x2197df[_0xdd4b('0x9b')]]){var _0x2750e3=_[_0xdd4b('0x81')](this[_0xdd4b('0x40')][_0x2197df['linkedid']]);_0x2750e3[_0xdd4b('0x8f')]=![];_0x2750e3[_0xdd4b('0x9c')]=!![];_0x2750e3[_0xdd4b('0x94')]=moment(_0x4324a2[_0xdd4b('0x7b')])[_0xdd4b('0x9d')](_0x2197df[_0xdd4b('0x83')],_0xdd4b('0x9e'))[_0xdd4b('0x4d')](_0xdd4b('0x7c'));_0x2750e3[_0xdd4b('0x86')]=_0xdd4b('0x9f');_0x2750e3['transfer']=!![];_0x2750e3['transfertype']='FORWARD';_0x2750e3['transferexten']=_0x2197df[_0xdd4b('0xa0')];_0x2750e3[_0xdd4b('0xa1')]=_0x2197df['uniqueid'];logger['info'](_0xdd4b('0xa2'),_0x2750e3[_0xdd4b('0x4e')],_0x2750e3[_0xdd4b('0x56')]);var _0x42e8de=this['queueReports'][_0x2197df[_0xdd4b('0x9b')]];this['queueReports'][_0x2197df[_0xdd4b('0x9b')]]=this['queueReports'][_0x2197df[_0xdd4b('0x51')]];this[_0xdd4b('0x40')][_0x2197df[_0xdd4b('0x51')]]=_0x42e8de;}}else{_0x4324a2[_0xdd4b('0x86')]=_0xdd4b('0xa3')+_0x2197df[_0xdd4b('0x96')][_0xdd4b('0xa4')]();logger[_0xdd4b('0x72')](_0xdd4b('0xa5'),_0x4324a2[_0xdd4b('0x4e')],_0x4324a2[_0xdd4b('0x56')],_0x4324a2[_0xdd4b('0x86')]);}}}this[_0xdd4b('0x10')][_0x2197df['uniqueid']]=_0x4324a2;this[_0xdd4b('0x46')](_0x4324a2,_0xdd4b('0x1f'));}}}catch(_0x22ddd2){logger[_0xdd4b('0x41')](_0xdd4b('0x91'),_0x2197df[_0xdd4b('0x51')],util['inspect'](_0x22ddd2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xdd4b('0xb')]['syncVarSet']=function(_0x744cb3){try{if(this[_0xdd4b('0x67')](_0x744cb3)){logger[_0xdd4b('0x4a')]('[%s][voiceQueueReport][varset]',_0x744cb3[_0xdd4b('0x51')],util[_0xdd4b('0x42')](_0x744cb3,{'showHidden':![],'depth':null}));this[_0xdd4b('0xa6')](_0x744cb3[_0xdd4b('0x51')],_[_0xdd4b('0x80')](_0x744cb3['variable'])[0x0],_0x744cb3['value']);if(this[_0xdd4b('0x40')][_0x744cb3[_0xdd4b('0x51')]]){var _0x2fd2c0=_[_0xdd4b('0x81')](this[_0xdd4b('0x40')][_0x744cb3[_0xdd4b('0x51')]]);if(_0x2fd2c0){if(this[_0xdd4b('0x67')](_0x744cb3[_0xdd4b('0xa7')])&&this['isNotNull'](_0x744cb3[_0xdd4b('0xa7')]['queuestatus'])){switch(_0x744cb3[_0xdd4b('0xa8')]){case _0xdd4b('0xa9'):_0x2fd2c0[_0xdd4b('0x9c')]=![];_0x2fd2c0['queuecallerexitAt']=null;break;case _0xdd4b('0xaa'):_0x2fd2c0[_0xdd4b('0xab')]=_0xdd4b('0xac');_0x2fd2c0[_0xdd4b('0x9c')]=!![];_0x2fd2c0[_0xdd4b('0x94')]=moment()[_0xdd4b('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x2fd2c0[_0xdd4b('0x8b')]=moment()[_0xdd4b('0x4d')](_0xdd4b('0x7c'));logger[_0xdd4b('0x4a')](_0xdd4b('0xad'),_0x744cb3[_0xdd4b('0x51')],util[_0xdd4b('0x42')](_0x2fd2c0,{'showHidden':![],'depth':null}));ami[_0xdd4b('0x48')](_0xdd4b('0xae'),_0x2fd2c0);break;default:_0x2fd2c0['queuecallerexit']=!![];_0x2fd2c0[_0xdd4b('0x94')]=moment()[_0xdd4b('0x4d')](_0xdd4b('0x7c'));_0x2fd2c0[_0xdd4b('0x8b')]=moment()[_0xdd4b('0x4d')](_0xdd4b('0x7c'));}_0x2fd2c0[_0xdd4b('0x1b')]=![];_0x2fd2c0[_0xdd4b('0x85')]=null;_0x2fd2c0['queuecallerexitreason']=_0x744cb3[_0xdd4b('0xa8')];this[_0xdd4b('0x10')][_0x744cb3[_0xdd4b('0x51')]]=_0x2fd2c0;this[_0xdd4b('0x46')](_0x2fd2c0,_0xdd4b('0x22'));}else if(this[_0xdd4b('0x67')](_0x744cb3[_0xdd4b('0xa7')])&&this[_0xdd4b('0x67')](_0x744cb3[_0xdd4b('0xa7')]['queueposition'])){if(!_0x2fd2c0['queuecallerabandon']){_0x2fd2c0[_0xdd4b('0x9c')]=!![];_0x2fd2c0[_0xdd4b('0x94')]=moment()[_0xdd4b('0x4d')](_0xdd4b('0x7c'));_0x2fd2c0[_0xdd4b('0x86')]=_0xdd4b('0xaf');_0x2fd2c0[_0xdd4b('0x8b')]=moment()[_0xdd4b('0x4d')](_0xdd4b('0x7c'));this[_0xdd4b('0x10')][_0x744cb3['uniqueid']]=_0x2fd2c0;}}logger[_0xdd4b('0x72')](_0xdd4b('0xb0'),_0x744cb3[_0xdd4b('0x51')],_0x2fd2c0[_0xdd4b('0x4e')],_0x2fd2c0[_0xdd4b('0x56')],_['keys'](_0x744cb3[_0xdd4b('0xa7')])[0x0],_0x744cb3[_0xdd4b('0xa8')]);_0x2fd2c0[_0xdd4b('0x15')]=this['variables'][_0x744cb3[_0xdd4b('0x51')]];}}}}catch(_0xe92dd){logger['error'](_0xdd4b('0xb1'),_0x744cb3[_0xdd4b('0x51')],util[_0xdd4b('0x42')](_0xe92dd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xdd4b('0xb')][_0xdd4b('0xa6')]=function(_0x436bb2,_0x55ae3a,_0xf98931){var _0x2a44d3=[_0xdd4b('0xb2'),_0xdd4b('0xb3'),_0xdd4b('0xb4'),'rtpaudioqosjitterbridged',_0xdd4b('0xb5'),_0xdd4b('0xb6'),_0xdd4b('0xb7'),'rtpaudioqosrttbridged',_0xdd4b('0xb8'),_0xdd4b('0xb9'),'bridgepeer',_0xdd4b('0xba'),_0xdd4b('0xbb'),_0xdd4b('0xbc'),_0xdd4b('0xbd'),_0xdd4b('0xbe'),_0xdd4b('0x93'),_0xdd4b('0xbf'),_0xdd4b('0xc0')];if(!_[_0xdd4b('0x3b')](_0x55ae3a)&&!_[_0xdd4b('0xc1')](_0x2a44d3,_0x55ae3a)){if(_[_0xdd4b('0x68')](this['variables'][_0x436bb2])){this[_0xdd4b('0x15')][_0x436bb2]={};}this[_0xdd4b('0x15')][_0x436bb2][_0x55ae3a]=_0xf98931;}};VoiceQueueReport[_0xdd4b('0xb')][_0xdd4b('0x24')]=function(_0x26d6f8){try{if(this['isNotNull'](_0x26d6f8)){logger['debug'](_0xdd4b('0xc2'),_0x26d6f8[_0xdd4b('0x51')],util['inspect'](_0x26d6f8,{'showHidden':![],'depth':null}));if(this[_0xdd4b('0x40')][_0x26d6f8[_0xdd4b('0x51')]]){for(var _0x3ddf02=0x0,_0x201e40={};_0x3ddf020x0?_0x3a1b9e:0x0;this['voiceQueues'][_0xde1fb6[_0x6415('0x69')]][_0x6415('0x58')]=this[_0x6415('0x14')][_0xde1fb6[_0x6415('0x69')]][_0x6415('0x58')]>_[_0x6415('0x6f')](_0xde1fb6[_0x6415('0x70')])?_[_0x6415('0x6f')](_0xde1fb6[_0x6415('0x70')]):this[_0x6415('0x14')][_0xde1fb6[_0x6415('0x69')]][_0x6415('0x58')];this[_0x6415('0x50')](this[_0x6415('0x14')][_0xde1fb6[_0x6415('0x69')]],_0x6415('0x17'));}logger[_0x6415('0x44')](_0x6415('0x71'),util[_0x6415('0x3c')](this[_0x6415('0x14')][_0xde1fb6[_0x6415('0x69')]],{'showHidden':![],'depth':null}));ami[_0x6415('0x43')](_0x6415('0x72'),this['voiceQueues'][_0xde1fb6[_0x6415('0x69')]]);}}}catch(_0x5c0dd5){logger['error'](_0x6415('0x68'),util['inspect'](_0x5c0dd5,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6415('0x1b')]=function(_0x2b059e){logger[_0x6415('0x44')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x6415('0x3c')](_0x2b059e,{'showHidden':![],'depth':null}));this[_0x6415('0x15')]=!![];};VoiceQueueReport[_0x6415('0xc')]['syncQueueCallerJoin']=function(_0x4ba6ee){try{if(this['isNotNull'](_0x4ba6ee)){logger['debug'](_0x6415('0x73'),_0x4ba6ee[_0x6415('0x47')],util[_0x6415('0x3c')](_0x4ba6ee,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['queueReports'][_0x4ba6ee[_0x6415('0x47')]]))this[_0x6415('0x3d')][_0x4ba6ee[_0x6415('0x47')]]=[];if(_[_0x6415('0x63')](this[_0x6415('0x12')][_0x4ba6ee[_0x6415('0x47')]]))this['channels'][_0x4ba6ee[_0x6415('0x47')]]={};var _0x2b1688=new QueueReport();_0x2b1688['name']=_0x4ba6ee['queue'];_0x2b1688[_0x6415('0x59')]=this[_0x6415('0x14')][_0x2b1688[_0x6415('0x4a')]]&&this['voiceQueues'][_0x2b1688[_0x6415('0x4a')]][_0x6415('0x59')]?this[_0x6415('0x14')][_0x2b1688[_0x6415('0x4a')]]['type']||'inbound':_0x6415('0x51');_0x2b1688['queue']=_0x4ba6ee[_0x6415('0x69')];_0x2b1688[_0x6415('0x74')]=moment()[_0x6415('0x48')](_0x6415('0x75'));_0x2b1688['position']=_0x4ba6ee['position'];_0x2b1688[_0x6415('0x76')]=_0x4ba6ee[_0x6415('0x76')];_0x2b1688[_0x6415('0x47')]=_0x4ba6ee['uniqueid'];_0x2b1688[_0x6415('0x77')]=this[_0x6415('0x12')][_0x4ba6ee['uniqueid']][_0x6415('0x77')];logger[_0x6415('0x6b')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x2b1688[_0x6415('0x4a')],_0x2b1688[_0x6415('0x59')]);_[_0x6415('0x78')](_0x2b1688,_['pick'](_0x4ba6ee,_[_0x6415('0x79')](_0x2b1688)));this[_0x6415('0x3d')][_0x4ba6ee['uniqueid']][_0x6415('0x7a')](_0x2b1688);this[_0x6415('0x12')][_0x4ba6ee[_0x6415('0x47')]]=_0x2b1688;this['emitVoiceQueueChannelSave'](_0x2b1688,_0x6415('0x7b'));}}catch(_0x3e04ac){logger[_0x6415('0x3a')](_0x6415('0x73'),_0x4ba6ee[_0x6415('0x47')],util[_0x6415('0x3c')](_0x3e04ac,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6415('0xc')][_0x6415('0x1d')]=function(_0x347a7f){try{if(this['isNotNull'](_0x347a7f)){logger[_0x6415('0x44')](_0x6415('0x7c'),_0x347a7f[_0x6415('0x47')],util[_0x6415('0x3c')](_0x347a7f,{'showHidden':![],'depth':null}));if(this[_0x6415('0x3d')][_0x347a7f[_0x6415('0x47')]]){var _0x44a348=_[_0x6415('0x7d')](this[_0x6415('0x3d')][_0x347a7f['uniqueid']]);_0x44a348[_0x6415('0x7e')]=![];_0x44a348[_0x6415('0x7f')]=null;_0x44a348[_0x6415('0x80')]=_0x347a7f[_0x6415('0x80')];_0x44a348[_0x6415('0x81')]=_0x347a7f[_0x6415('0x81')];_0x44a348[_0x6415('0x82')]=!![];_0x44a348[_0x6415('0x83')]=moment()[_0x6415('0x48')](_0x6415('0x75'));_0x44a348[_0x6415('0x84')]='ABANDONED';_0x44a348['lastAssignedTo']=null;logger[_0x6415('0x6b')](_0x6415('0x85'),_0x44a348[_0x6415('0x4a')],_0x44a348[_0x6415('0x59')]);this[_0x6415('0x12')][_0x347a7f[_0x6415('0x47')]]=_0x44a348;this[_0x6415('0x4d')](_0x44a348,'queuecallerabandon');}}}catch(_0x2ca7d4){logger['error']('[%s][voiceQueueReport][queuecallerabandon]',_0x347a7f[_0x6415('0x47')],util[_0x6415('0x3c')](_0x2ca7d4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6415('0xc')][_0x6415('0x86')]=function(_0x531b33){try{if(this['isNotNull'](_0x531b33)){logger['debug'](_0x6415('0x87'),_0x531b33[_0x6415('0x47')],util[_0x6415('0x3c')](_0x531b33,{'showHidden':![],'depth':null}));if(this[_0x6415('0x3d')][_0x531b33['uniqueid']]){var _0x1219e8=_[_0x6415('0x7d')](this['queueReports'][_0x531b33['uniqueid']]);_0x1219e8['queuecallerleaveAt']=moment()[_0x6415('0x48')](_0x6415('0x75'));_0x1219e8[_0x6415('0x88')]=_0x531b33[_0x6415('0x88')];_0x1219e8['connectedlinename']=_0x531b33[_0x6415('0x89')];logger[_0x6415('0x6b')](_0x6415('0x8a'),_0x1219e8['name'],_0x1219e8[_0x6415('0x59')],_0x531b33[_0x6415('0x88')],_0x531b33[_0x6415('0x89')]);this['channels'][_0x531b33[_0x6415('0x47')]]=_0x1219e8;this[_0x6415('0x8b')](_0x1219e8,_0x6415('0x8c'));}}}catch(_0x2f663e){logger['error'](_0x6415('0x87'),_0x531b33[_0x6415('0x47')],util[_0x6415('0x3c')](_0x2f663e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6415('0xc')][_0x6415('0x21')]=function(_0xaba746){try{if(this[_0x6415('0x62')](_0xaba746)){logger['debug'](_0x6415('0x8d'),_0xaba746[_0x6415('0x47')],util['inspect'](_0xaba746,{'showHidden':![],'depth':null}));if(this[_0x6415('0x3d')][_0xaba746[_0x6415('0x47')]]){var _0x8de8f2=_[_0x6415('0x7d')](this[_0x6415('0x3d')][_0xaba746[_0x6415('0x47')]]);_0x8de8f2[_0x6415('0x7e')]=!![];_0x8de8f2[_0x6415('0x84')]='COMPLETEDBYAGENT';logger[_0x6415('0x6b')](_0x6415('0x8e'),_0x8de8f2[_0x6415('0x4a')],_0x8de8f2['type']);}}}catch(_0x168388){logger[_0x6415('0x3a')](_0x6415('0x8d'),_0xaba746[_0x6415('0x47')],util[_0x6415('0x3c')](_0x168388,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6415('0xc')][_0x6415('0x1f')]=function(_0x1c0fb4){try{if(this['isNotNull'](_0x1c0fb4)){logger[_0x6415('0x44')](_0x6415('0x8f'),_0x1c0fb4[_0x6415('0x47')],util['inspect'](_0x1c0fb4,{'showHidden':![],'depth':null}));if(this[_0x6415('0x3d')][_0x1c0fb4['uniqueid']]){var _0x3c14eb=_[_0x6415('0x7d')](this[_0x6415('0x3d')][_0x1c0fb4[_0x6415('0x47')]]);_0x3c14eb[_0x6415('0x82')]=![];_0x3c14eb['queuecallerabandonAt']=null;_0x3c14eb[_0x6415('0x90')]=!![];_0x3c14eb['lastAssignedTo']=_0x1c0fb4[_0x6415('0x91')];_0x3c14eb[_0x6415('0x80')]=_0x1c0fb4['holdtime'];_0x3c14eb[_0x6415('0x7e')]=!![];_0x3c14eb[_0x6415('0x92')]=![];_0x3c14eb[_0x6415('0x93')]=null;if(!_0x3c14eb[_0x6415('0x94')]){if(_0x1c0fb4['reason']==_0x6415('0x94')){_0x3c14eb[_0x6415('0x84')]=_0x6415('0x95');logger[_0x6415('0x6b')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x3c14eb[_0x6415('0x4a')],_0x3c14eb['type']);}else{if(_[_0x6415('0x96')](_0x1c0fb4[_0x6415('0x37')]['toLowerCase'](),_0x6415('0x97'))){if(this[_0x6415('0x3d')][_0x1c0fb4[_0x6415('0x98')]]){var _0x44dc53=_[_0x6415('0x7d')](this[_0x6415('0x3d')][_0x1c0fb4['linkedid']]);_0x44dc53['queuecallercomplete']=![];_0x44dc53['queuecallerexit']=!![];_0x44dc53['queuecallerexitAt']=moment(_0x3c14eb[_0x6415('0x74')])[_0x6415('0x99')](_0x1c0fb4[_0x6415('0x80')],_0x6415('0x9a'))[_0x6415('0x48')](_0x6415('0x75'));_0x44dc53[_0x6415('0x84')]='FORWARDTRANSFER';_0x44dc53[_0x6415('0x94')]=!![];_0x44dc53[_0x6415('0x9b')]=_0x6415('0x9c');_0x44dc53[_0x6415('0x9d')]=_0x1c0fb4[_0x6415('0x9e')];_0x44dc53['transferuniqueid']=_0x1c0fb4[_0x6415('0x47')];logger['info'](_0x6415('0x9f'),_0x44dc53[_0x6415('0x4a')],_0x44dc53[_0x6415('0x59')]);var _0x401028=this['queueReports'][_0x1c0fb4[_0x6415('0x98')]];this[_0x6415('0x3d')][_0x1c0fb4['linkedid']]=this['queueReports'][_0x1c0fb4[_0x6415('0x47')]];this[_0x6415('0x3d')][_0x1c0fb4[_0x6415('0x47')]]=_0x401028;}}else{_0x3c14eb['queuecallerexitreason']=_0x6415('0xa0')+_0x1c0fb4['reason'][_0x6415('0xa1')]();logger[_0x6415('0x6b')](_0x6415('0xa2'),_0x3c14eb['name'],_0x3c14eb[_0x6415('0x59')],_0x3c14eb[_0x6415('0x84')]);}}}this[_0x6415('0x12')][_0x1c0fb4[_0x6415('0x47')]]=_0x3c14eb;this[_0x6415('0x4d')](_0x3c14eb,'agentcomplete');}}}catch(_0x2dfeea){logger[_0x6415('0x3a')](_0x6415('0x8f'),_0x1c0fb4['uniqueid'],util[_0x6415('0x3c')](_0x2dfeea,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6415('0xc')][_0x6415('0x23')]=function(_0x7b944a){try{if(this[_0x6415('0x62')](_0x7b944a)){logger[_0x6415('0x44')](_0x6415('0xa3'),_0x7b944a[_0x6415('0x47')],util[_0x6415('0x3c')](_0x7b944a,{'showHidden':![],'depth':null}));this['addVariable'](_0x7b944a[_0x6415('0x47')],_['keys'](_0x7b944a[_0x6415('0xa4')])[0x0],_0x7b944a[_0x6415('0xa5')]);if(this[_0x6415('0x3d')][_0x7b944a[_0x6415('0x47')]]){var _0x27d0eb=_[_0x6415('0x7d')](this[_0x6415('0x3d')][_0x7b944a[_0x6415('0x47')]]);if(_0x27d0eb){if(this['isNotNull'](_0x7b944a['variable'])&&this[_0x6415('0x62')](_0x7b944a[_0x6415('0xa4')][_0x6415('0xa6')])){switch(_0x7b944a[_0x6415('0xa5')]){case _0x6415('0xa7'):_0x27d0eb[_0x6415('0x92')]=![];_0x27d0eb[_0x6415('0x93')]=null;break;case _0x6415('0xa8'):_0x27d0eb[_0x6415('0xa9')]=_0x6415('0xaa');_0x27d0eb[_0x6415('0x92')]=!![];_0x27d0eb['queuecallerexitAt']=moment()[_0x6415('0x48')](_0x6415('0x75'));_0x27d0eb['queuecallerleaveAt']=moment()[_0x6415('0x48')](_0x6415('0x75'));logger[_0x6415('0x44')](_0x6415('0xab'),_0x7b944a[_0x6415('0x47')],util[_0x6415('0x3c')](_0x27d0eb,{'showHidden':![],'depth':null}));ami[_0x6415('0x43')](_0x6415('0xac'),_0x27d0eb);break;default:_0x27d0eb['queuecallerexit']=!![];_0x27d0eb[_0x6415('0x93')]=moment()['format'](_0x6415('0x75'));_0x27d0eb['queuecallerleaveAt']=moment()[_0x6415('0x48')](_0x6415('0x75'));}_0x27d0eb[_0x6415('0x82')]=![];_0x27d0eb[_0x6415('0x83')]=null;_0x27d0eb[_0x6415('0x84')]=_0x7b944a[_0x6415('0xa5')];this[_0x6415('0x12')][_0x7b944a['uniqueid']]=_0x27d0eb;this[_0x6415('0x4d')](_0x27d0eb,_0x6415('0x22'));}else if(this['isNotNull'](_0x7b944a[_0x6415('0xa4')])&&this[_0x6415('0x62')](_0x7b944a['variable'][_0x6415('0xad')])){if(!_0x27d0eb['queuecallerabandon']){_0x27d0eb[_0x6415('0x92')]=!![];_0x27d0eb['queuecallerexitAt']=moment()[_0x6415('0x48')](_0x6415('0x75'));_0x27d0eb['queuecallerexitreason']=_0x6415('0xae');_0x27d0eb[_0x6415('0xaf')]=moment()[_0x6415('0x48')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6415('0x12')][_0x7b944a[_0x6415('0x47')]]=_0x27d0eb;}}logger[_0x6415('0x6b')](_0x6415('0xb0'),_0x7b944a[_0x6415('0x47')],_0x27d0eb[_0x6415('0x4a')],_0x27d0eb[_0x6415('0x59')],_[_0x6415('0x79')](_0x7b944a[_0x6415('0xa4')])[0x0],_0x7b944a[_0x6415('0xa5')]);_0x27d0eb[_0x6415('0x3e')]=this[_0x6415('0x3e')][_0x7b944a[_0x6415('0x47')]];}}}}catch(_0x4bc3fe){logger[_0x6415('0x3a')](_0x6415('0xa3'),_0x7b944a['uniqueid'],util[_0x6415('0x3c')](_0x4bc3fe,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6415('0xc')]['addVariable']=function(_0x436233,_0x108754,_0x142bff){var _0x592206=[_0x6415('0xb1'),'rtpaudioqosbridged',_0x6415('0xb2'),_0x6415('0xb3'),_0x6415('0xb4'),_0x6415('0xb5'),_0x6415('0xb6'),_0x6415('0xb7'),_0x6415('0xb8'),_0x6415('0xb9'),_0x6415('0xba'),'bridgepvtcallid','membercalls',_0x6415('0xbb'),'memberinterface',_0x6415('0xbc'),_0x6415('0x91'),_0x6415('0xbd'),_0x6415('0xbe')];if(!_[_0x6415('0xbf')](_0x108754)&&!_[_0x6415('0xc0')](_0x592206,_0x108754)){if(_[_0x6415('0x63')](this['variables'][_0x436233])){this['variables'][_0x436233]={};}this['variables'][_0x436233][_0x108754]=_0x142bff;}};VoiceQueueReport[_0x6415('0xc')][_0x6415('0xc1')]=function(_0x6927a9){try{if(this[_0x6415('0x62')](_0x6927a9)){logger[_0x6415('0x44')](_0x6415('0xc2'),_0x6927a9[_0x6415('0x47')],util[_0x6415('0x3c')](_0x6927a9,{'showHidden':![],'depth':null}));if(this[_0x6415('0x3d')][_0x6927a9[_0x6415('0x47')]]){for(var _0x867110=0x0,_0x2cf232={};_0x867110=0x0?moment(_0x4b549[_0x445e('0x19')])['diff'](_0x4b549[_0x445e('0x18')],'seconds'):null,'data1':'outbound','data2':_0x4b549[_0x445e('0x13')],'data3':_0x4b549[_0x445e('0xf')],'data4':_0x4b549[_0x445e('0x1a')]||null,'role':'agent','internal':_0x4b549[_0x445e('0x13')]?_[_0x445e('0x12')](_0x4b549['accountcode']):undefined,'uniqueid':_0x4b549[_0x445e('0x14')]},'log':_0x445e('0x15')});}; \ No newline at end of file +var _0xbe40=['queuecallerexitAt','Request','voice','lastAssignedTo','isNil','interface','TALKING','queuecallerleaveAt','diff','inbound','calleridnum','queue','agent','accountcode','uniqueid','CreateMemberReport','voiceDialReport','membername','starttime','endtime','seconds','outbound','exten','dialstring','toNumber','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt'];(function(_0x46defd,_0x2aa0d9){var _0x4aac1f=function(_0x288ad7){while(--_0x288ad7){_0x46defd['push'](_0x46defd['shift']());}};_0x4aac1f(++_0x2aa0d9);}(_0xbe40,0x16e));var _0x0be4=function(_0x58163b,_0x4b2dce){_0x58163b=_0x58163b-0x0;var _0x1366c7=_0xbe40[_0x58163b];return _0x1366c7;};'use strict';var moment=require(_0x0be4('0x0'));var _=require(_0x0be4('0x1'));var util=require(_0x0be4('0x2'));var client=require(_0x0be4('0x3'));exports[_0x0be4('0x4')]=function(_0x407aee){var _0x10a86e=_0x407aee[_0x0be4('0x5')]||_0x407aee[_0x0be4('0x6')];return client[_0x0be4('0x7')]('CreateMemberReport',{'body':{'channel':_0x0be4('0x8'),'membername':_0x407aee[_0x0be4('0x9')],'interface':_[_0x0be4('0xa')](_0x407aee[_0x0be4('0xb')])?util['format']('SIP/%s',_0x407aee[_0x0be4('0x9')]):_0x407aee[_0x0be4('0xb')],'type':_0x0be4('0xc'),'enterAt':_0x407aee[_0x0be4('0xd')],'exitAt':_0x10a86e,'duration':moment(_0x10a86e)[_0x0be4('0xe')](_0x407aee[_0x0be4('0xd')],'seconds'),'data1':_0x0be4('0xf'),'data2':_0x407aee[_0x0be4('0x10')],'data3':_0x407aee['exten'],'data4':null,'data5':_0x407aee[_0x0be4('0x11')],'role':_0x0be4('0x12'),'internal':_0x407aee[_0x0be4('0x13')]?_['toNumber'](_0x407aee[_0x0be4('0x13')]):undefined,'uniqueid':_0x407aee[_0x0be4('0x14')]},'log':_0x0be4('0x15')});};exports[_0x0be4('0x16')]=function(_0x1c7787){return client[_0x0be4('0x7')](_0x0be4('0x15'),{'body':{'channel':_0x0be4('0x8'),'membername':_0x1c7787[_0x0be4('0x17')],'interface':_0x1c7787[_0x0be4('0xb')],'type':_0x0be4('0xc'),'enterAt':_0x1c7787[_0x0be4('0x18')],'exitAt':_0x1c7787[_0x0be4('0x19')],'duration':moment(_0x1c7787[_0x0be4('0x19')])[_0x0be4('0xe')](_0x1c7787[_0x0be4('0x18')],_0x0be4('0x1a'))>=0x0?moment(_0x1c7787['endtime'])['diff'](_0x1c7787[_0x0be4('0x18')],_0x0be4('0x1a')):null,'data1':_0x0be4('0x1b'),'data2':_0x1c7787['accountcode'],'data3':_0x1c7787[_0x0be4('0x1c')],'data4':_0x1c7787[_0x0be4('0x1d')]||null,'role':_0x0be4('0x12'),'internal':_0x1c7787[_0x0be4('0x13')]?_[_0x0be4('0x1e')](_0x1c7787[_0x0be4('0x13')]):undefined,'uniqueid':_0x1c7787['uniqueid']},'log':_0x0be4('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 39ef71b..32aede9 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 _0x3d9c=['../client','Request','ShowSetting','stopRecordingOnTransfer'];(function(_0x46a48b,_0x3c6467){var _0x524d61=function(_0x418fd3){while(--_0x418fd3){_0x46a48b['push'](_0x46a48b['shift']());}};_0x524d61(++_0x3c6467);}(_0x3d9c,0x134));var _0xc3d9=function(_0x158f0d,_0xd98944){_0x158f0d=_0x158f0d-0x0;var _0xc9722c=_0x3d9c[_0x158f0d];return _0xc9722c;};'use strict';var client=require(_0xc3d9('0x0'));exports['getSettings']=function(){return client[_0xc3d9('0x1')](_0xc3d9('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc3d9('0x3')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x0df9=['../client','Request','ShowSetting','GetSettings'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x0df9,0x170));var _0x90df=function(_0x1984a6,_0x5b398c){_0x1984a6=_0x1984a6-0x0;var _0x1685de=_0x0df9[_0x1984a6];return _0x1685de;};'use strict';var client=require(_0x90df('0x0'));exports['getSettings']=function(){return client[_0x90df('0x1')](_0x90df('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer']},'log':_0x90df('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 7fb28a2..7d44b53 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 _0x2d13=['Request','GetTemplate','html','../client','getTemplates'];(function(_0x3d5304,_0x1e01e5){var _0x58f9ea=function(_0x3e3bc4){while(--_0x3e3bc4){_0x3d5304['push'](_0x3d5304['shift']());}};_0x58f9ea(++_0x1e01e5);}(_0x2d13,0xcb));var _0x32d1=function(_0x251fa4,_0x3d5860){_0x251fa4=_0x251fa4-0x0;var _0x453047=_0x2d13[_0x251fa4];return _0x453047;};'use strict';var client=require(_0x32d1('0x0'));exports[_0x32d1('0x1')]=function(_0x201ef0){return function(_0x2386fa){return client[_0x32d1('0x2')](_0x32d1('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0x32d1('0x4')]},'log':_0x32d1('0x3')});};}; \ No newline at end of file +var _0x4be8=['name','html','GetTemplate','../client','getTemplates'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4be8,0x12a));var _0x84be=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x4be8[_0x273c39];return _0x46d6b5;};'use strict';var client=require(_0x84be('0x0'));exports[_0x84be('0x1')]=function(_0x3fcb96){return function(_0x27eb42){return client['Request']('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x84be('0x2'),_0x84be('0x3')]},'log':_0x84be('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 284a340..09a046b 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 _0x0743=['data2','data3','data4','data5','data6','data7','../client','GetTrigger','channel','status','Condition','AllConditions','field','operator','value','Actions','action','data1'];(function(_0x4b5bab,_0x1d73d4){var _0x5abd6b=function(_0x1256d6){while(--_0x1256d6){_0x4b5bab['push'](_0x4b5bab['shift']());}};_0x5abd6b(++_0x1d73d4);}(_0x0743,0x96));var _0x3074=function(_0x4df79b,_0x1a06a2){_0x4df79b=_0x4df79b-0x0;var _0x298b56=_0x0743[_0x4df79b];return _0x298b56;};'use strict';var client=require(_0x3074('0x0'));exports['getTriggers']=function(_0x226f1d){return function(_0xf2b201){return client['Request'](_0x3074('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x3074('0x2'),_0x3074('0x3')],'include':[{'model':_0x3074('0x4'),'as':_0x3074('0x5'),'attributes':['id',_0x3074('0x6'),_0x3074('0x7'),_0x3074('0x8')]},{'model':_0x3074('0x4'),'as':'AnyConditions','attributes':['id',_0x3074('0x6'),_0x3074('0x7'),_0x3074('0x8')]},{'model':'Action','as':_0x3074('0x9'),'attributes':['id',_0x3074('0xa'),_0x3074('0xb'),_0x3074('0xc'),_0x3074('0xd'),_0x3074('0xe'),_0x3074('0xf'),_0x3074('0x10'),_0x3074('0x11')]}]},'log':_0x3074('0x1')});};}; \ No newline at end of file +var _0xeda8=['Actions','action','data1','data2','data3','data5','data6','data7','../client','getTriggers','Request','GetTrigger','channel','status','Condition','AllConditions','field','operator','value'];(function(_0xe291cb,_0x21f625){var _0x426a9b=function(_0x3acd66){while(--_0x3acd66){_0xe291cb['push'](_0xe291cb['shift']());}};_0x426a9b(++_0x21f625);}(_0xeda8,0x7a));var _0x8eda=function(_0x22ab6a,_0x1e1a0e){_0x22ab6a=_0x22ab6a-0x0;var _0x49e1f2=_0xeda8[_0x22ab6a];return _0x49e1f2;};'use strict';var client=require(_0x8eda('0x0'));exports[_0x8eda('0x1')]=function(_0x52f3a5){return function(_0x32c835){return client[_0x8eda('0x2')](_0x8eda('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x8eda('0x4'),_0x8eda('0x5')],'include':[{'model':_0x8eda('0x6'),'as':_0x8eda('0x7'),'attributes':['id',_0x8eda('0x8'),_0x8eda('0x9'),_0x8eda('0xa')]},{'model':_0x8eda('0x6'),'as':'AnyConditions','attributes':['id',_0x8eda('0x8'),'operator',_0x8eda('0xa')]},{'model':'Action','as':_0x8eda('0xb'),'attributes':['id',_0x8eda('0xc'),_0x8eda('0xd'),_0x8eda('0xe'),_0x8eda('0xf'),'data4',_0x8eda('0x10'),_0x8eda('0x11'),_0x8eda('0x12')]}]},'log':_0x8eda('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index cbef975..d138ae5 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 _0x7233=['defaultuser','../client','getTrunks','Request','GetTrunk','name','registry'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7233,0x8d));var _0x3723=function(_0x96602e,_0x3d75d4){_0x96602e=_0x96602e-0x0;var _0x5c004d=_0x7233[_0x96602e];return _0x5c004d;};'use strict';var client=require(_0x3723('0x0'));exports[_0x3723('0x1')]=function(_0x2685c0){return function(_0x22d923){return client[_0x3723('0x2')](_0x3723('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x3723('0x4'),_0x3723('0x5'),_0x3723('0x6')]},'log':_0x3723('0x3')});};}; \ No newline at end of file +var _0x863f=['name','defaultuser','getTrunks','GetTrunk'];(function(_0x24290d,_0x1ba88c){var _0x227b23=function(_0x268773){while(--_0x268773){_0x24290d['push'](_0x24290d['shift']());}};_0x227b23(++_0x1ba88c);}(_0x863f,0xda));var _0xf863=function(_0x27d27d,_0x48a6b0){_0x27d27d=_0x27d27d-0x0;var _0x5cc4fa=_0x863f[_0x27d27d];return _0x5cc4fa;};'use strict';var client=require('../client');exports[_0xf863('0x0')]=function(_0x8673b4){return function(_0x393dfd){return client['Request'](_0xf863('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xf863('0x2'),'registry',_0xf863('0x3')]},'log':_0xf863('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 8e7ea21..6f0559c 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(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe706,0xa3));var _0x6e70=function(_0x57add2,_0x4f2b7d){_0x57add2=_0x57add2-0x0;var _0x4e3670=_0xe706[_0x57add2];return _0x4e3670;};'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 _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x347f7e,_0x481e92){var _0x2e76e1=function(_0x132999){while(--_0x132999){_0x347f7e['push'](_0x347f7e['shift']());}};_0x2e76e1(++_0x481e92);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 098e065..c113d67 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 _0xa7e9=['update','UpdateVoiceAgentReport','../client','Request','CreateVoiceAgentReport'];(function(_0x386b69,_0x5d9360){var _0x476415=function(_0x49fd60){while(--_0x49fd60){_0x386b69['push'](_0x386b69['shift']());}};_0x476415(++_0x5d9360);}(_0xa7e9,0x66));var _0x9a7e=function(_0x6f0b65,_0x16f8f8){_0x6f0b65=_0x6f0b65-0x0;var _0xc4e6af=_0xa7e9[_0x6f0b65];return _0xc4e6af;};'use strict';var client=require(_0x9a7e('0x0'));exports['create']=function(_0x4294a3){return client[_0x9a7e('0x1')]('CreateVoiceAgentReport',{'body':_0x4294a3,'log':_0x9a7e('0x2')});};exports[_0x9a7e('0x3')]=function(_0x66df90,_0x49774c,_0x59f576){return client[_0x9a7e('0x1')](_0x9a7e('0x4'),{'body':_0x66df90,'options':{'where':{'uniqueid':_0x49774c,'interface':_0x59f576,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x5a0b=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','Request'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x5a0b,0xeb));var _0xb5a0=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x5a0b[_0x5c3c0b];return _0x52ecd2;};'use strict';var client=require('../client');exports['create']=function(_0x5ce1d4){return client[_0xb5a0('0x0')]('CreateVoiceAgentReport',{'body':_0x5ce1d4,'log':_0xb5a0('0x1')});};exports[_0xb5a0('0x2')]=function(_0x1f0ccb,_0x1b2583,_0xc3adce){return client[_0xb5a0('0x0')]('UpdateVoiceAgentReport',{'body':_0x1f0ccb,'options':{'where':{'uniqueid':_0x1b2583,'interface':_0xc3adce,'agentcomplete':!![]}},'log':_0xb5a0('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 2f8f9e5..e5c666b 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 _0xcc46=['moment','util','../client','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration'];(function(_0x573c08,_0x446206){var _0x6d94d7=function(_0xa67101){while(--_0xa67101){_0x573c08['push'](_0x573c08['shift']());}};_0x6d94d7(++_0x446206);}(_0xcc46,0x17c));var _0x6cc4=function(_0x25db8a,_0x2cd860){_0x25db8a=_0x25db8a-0x0;var _0x2acc8e=_0xcc46[_0x25db8a];return _0x2acc8e;};'use strict';var moment=require(_0x6cc4('0x0'));var util=require(_0x6cc4('0x1'));var _=require('lodash');var client=require(_0x6cc4('0x2'));exports['create']=function(_0x58abae){return client[_0x6cc4('0x3')](_0x6cc4('0x4'),{'body':_[_0x6cc4('0x5')](_0x58abae,{'source':_0x58abae[_0x6cc4('0x6')],'destinationcontext':_0x58abae[_0x6cc4('0x7')],'callerid':_0x58abae[_0x6cc4('0x8')],'amaflags':_0x6cc4('0x9')}),'log':_0x6cc4('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0x6cc4('0xa'),{'options':{'where':{'type':[_0x6cc4('0xb')],'createdAt':{'$between':[moment()[_0x6cc4('0xc')](_0x6cc4('0xd'))[_0x6cc4('0xe')](_0x6cc4('0xf')),moment()[_0x6cc4('0x10')]('day')[_0x6cc4('0xe')](_0x6cc4('0xf'))]}},'attributes':[_0x6cc4('0x11'),_0x6cc4('0x12'),_0x6cc4('0x13'),'billableseconds']},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x510c=['format','type','disposition','billableseconds','GetVoiceCallReports','moment','lodash','../client','create','Request','CreateVoiceCallReport','merge','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1cd61f,_0x22e7af){var _0x27cee9=function(_0x5e122b){while(--_0x5e122b){_0x1cd61f['push'](_0x1cd61f['shift']());}};_0x27cee9(++_0x22e7af);}(_0x510c,0x8a));var _0xc510=function(_0x2ab5c1,_0xe3f32d){_0x2ab5c1=_0x2ab5c1-0x0;var _0x1a3a22=_0x510c[_0x2ab5c1];return _0x1a3a22;};'use strict';var moment=require(_0xc510('0x0'));var util=require('util');var _=require(_0xc510('0x1'));var client=require(_0xc510('0x2'));exports[_0xc510('0x3')]=function(_0x447b48){return client[_0xc510('0x4')](_0xc510('0x5'),{'body':_[_0xc510('0x6')](_0x447b48,{'source':_0x447b48['calleridnum'],'destinationcontext':_0x447b48['context'],'callerid':_0x447b48['callerid'],'amaflags':_0xc510('0x7')}),'log':_0xc510('0x5')});};exports[_0xc510('0x8')]=function(){return function(){return client[_0xc510('0x4')](_0xc510('0x9'),{'options':{'where':{'type':[_0xc510('0xa')],'createdAt':{'$between':[moment()[_0xc510('0xb')](_0xc510('0xc'))['format'](_0xc510('0xd')),moment()['endOf'](_0xc510('0xc'))[_0xc510('0xe')](_0xc510('0xd'))]}},'attributes':[_0xc510('0xf'),_0xc510('0x10'),'duration',_0xc510('0x11')]},'log':_0xc510('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index b7413d8..408c487 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 _0x4d69=['create','Request','CreateVoiceDialReport','../client'];(function(_0x3e21f4,_0x43d310){var _0x40fc49=function(_0x54a8f6){while(--_0x54a8f6){_0x3e21f4['push'](_0x3e21f4['shift']());}};_0x40fc49(++_0x43d310);}(_0x4d69,0x12f));var _0x94d6=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x4d69[_0x4fbfd9];return _0x31dc94;};'use strict';var client=require(_0x94d6('0x0'));exports[_0x94d6('0x1')]=function(_0x4e2074){return client[_0x94d6('0x2')](_0x94d6('0x3'),{'body':_0x4e2074,'log':_0x94d6('0x3')});}; \ No newline at end of file +var _0xb390=['CreateVoiceDialReport','../client','create','Request'];(function(_0x278b22,_0x512b9f){var _0x327949=function(_0x5a9e7b){while(--_0x5a9e7b){_0x278b22['push'](_0x278b22['shift']());}};_0x327949(++_0x512b9f);}(_0xb390,0xa1));var _0x0b39=function(_0x1ad450,_0x248b23){_0x1ad450=_0x1ad450-0x0;var _0x55e642=_0xb390[_0x1ad450];return _0x55e642;};'use strict';var client=require(_0x0b39('0x0'));exports[_0x0b39('0x1')]=function(_0x35959f){return client[_0x0b39('0x2')]('CreateVoiceDialReport',{'body':_0x35959f,'log':_0x0b39('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index d7b5509..755bbd4 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 _0x6953=['recordingFormat','../client','getVoiceExtensions'];(function(_0xd7742f,_0x2b0033){var _0x3c7011=function(_0x24288b){while(--_0x24288b){_0xd7742f['push'](_0xd7742f['shift']());}};_0x3c7011(++_0x2b0033);}(_0x6953,0x91));var _0x3695=function(_0x3288a2,_0x4ac4be){_0x3288a2=_0x3288a2-0x0;var _0x319f4a=_0x6953[_0x3288a2];return _0x319f4a;};'use strict';var client=require(_0x3695('0x0'));exports[_0x3695('0x1')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten',_0x3695('0x2')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0xaaa2=['Request','GetVoiceExtension','exten','recordingFormat','../client','getVoiceExtensions'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xaaa2,0xac));var _0x2aaa=function(_0x36b11f,_0x46bbe6){_0x36b11f=_0x36b11f-0x0;var _0x16b831=_0xaaa2[_0x36b11f];return _0x16b831;};'use strict';var client=require(_0x2aaa('0x0'));exports[_0x2aaa('0x1')]=function(){return function(){return client[_0x2aaa('0x2')](_0x2aaa('0x3'),{'options':{'raw':!![],'attributes':['id',_0x2aaa('0x4'),_0x2aaa('0x5')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index d0a7afc..8b1baf5 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 _0x4b05=['dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','name','acw','acwTimeout','dialActive','dialMethod','dialLimitChannel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout'];(function(_0x199c54,_0x132dc6){var _0x18f3e8=function(_0xea1c6c){while(--_0xea1c6c){_0x199c54['push'](_0x199c54['shift']());}};_0x18f3e8(++_0x132dc6);}(_0x4b05,0xff));var _0x54b0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4b05[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x54b0('0x0'));exports[_0x54b0('0x1')]=function(){return function(){return client[_0x54b0('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x54b0('0x3'),_0x54b0('0x4'),_0x54b0('0x5'),'autopause','monitor_format','type',_0x54b0('0x6'),_0x54b0('0x7'),_0x54b0('0x8'),'dialLimitQueue','dialPowerLevel',_0x54b0('0x9'),_0x54b0('0xa'),_0x54b0('0xb'),'dialOriginateCallerIdName',_0x54b0('0xc'),_0x54b0('0xd'),_0x54b0('0xe'),_0x54b0('0xf'),_0x54b0('0x10'),_0x54b0('0x11'),'dialCongestionRetryFrequency',_0x54b0('0x12'),_0x54b0('0x13'),'dialNoAnswerMaxRetry',_0x54b0('0x14'),_0x54b0('0x15'),_0x54b0('0x16'),_0x54b0('0x17'),_0x54b0('0x18'),'dialCheckDuplicateType','dialAMDActive',_0x54b0('0x19'),_0x54b0('0x1a'),_0x54b0('0x1b'),'dialAMDTotalAnalysisTime',_0x54b0('0x1c'),_0x54b0('0x1d'),_0x54b0('0x1e'),_0x54b0('0x1f'),_0x54b0('0x20'),_0x54b0('0x21'),_0x54b0('0x22'),_0x54b0('0x23'),_0x54b0('0x24'),_0x54b0('0x25'),_0x54b0('0x26'),_0x54b0('0x27'),'monitor_format',_0x54b0('0x28'),'dialRandomLastDigitCallerIdNumber',_0x54b0('0x29'),'dialNoSuchNumberMaxRetry',_0x54b0('0x2a'),'dialDropMaxRetry','dialDropRetryFrequency',_0x54b0('0x2b'),_0x54b0('0x2c'),'dialMachineMaxRetry',_0x54b0('0x2d'),'dialAgentRejectMaxRetry',_0x54b0('0x2e'),_0x54b0('0x2f'),'dialPredictiveIntervalMaxThreshold',_0x54b0('0x30')],'include':[{'model':_0x54b0('0x31'),'as':'Trunk','attributes':['id',_0x54b0('0x3'),_0x54b0('0x32'),_0x54b0('0x33')]},{'model':_0x54b0('0x34'),'as':_0x54b0('0x35'),'attributes':['id',_0x54b0('0x3')]},{'model':_0x54b0('0x31'),'as':_0x54b0('0x36'),'attributes':['id',_0x54b0('0x3'),'callerid',_0x54b0('0x33')]},{'model':_0x54b0('0x37'),'as':_0x54b0('0x37'),'attributes':['id','name'],'include':[{'model':_0x54b0('0x37'),'as':_0x54b0('0x38'),'attributes':['id',_0x54b0('0x3'),_0x54b0('0x39')]}]}]},'log':_0x54b0('0x1')});};}; \ No newline at end of file +var _0x94ce=['dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','../client','acw','autopause','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0x94ce,0x1cb));var _0xe94c=function(_0x38302e,_0x312a11){_0x38302e=_0x38302e-0x0;var _0x17a195=_0x94ce[_0x38302e];return _0x17a195;};'use strict';var client=require(_0xe94c('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name',_0xe94c('0x1'),'acwTimeout',_0xe94c('0x2'),_0xe94c('0x3'),_0xe94c('0x4'),_0xe94c('0x5'),'dialMethod',_0xe94c('0x6'),_0xe94c('0x7'),_0xe94c('0x8'),'dialPredictiveOptimization',_0xe94c('0x9'),_0xe94c('0xa'),_0xe94c('0xb'),_0xe94c('0xc'),_0xe94c('0xd'),_0xe94c('0xe'),_0xe94c('0xf'),_0xe94c('0x10'),_0xe94c('0x11'),_0xe94c('0x12'),_0xe94c('0x13'),_0xe94c('0x14'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0xe94c('0x15'),_0xe94c('0x16'),_0xe94c('0x17'),_0xe94c('0x18'),_0xe94c('0x19'),_0xe94c('0x1a'),_0xe94c('0x1b'),_0xe94c('0x1c'),_0xe94c('0x1d'),'dialAMDMinWordLength',_0xe94c('0x1e'),_0xe94c('0x1f'),_0xe94c('0x20'),_0xe94c('0x21'),'timeout',_0xe94c('0x22'),'dialRecallInQueue','dialOrderByScheduledAt',_0xe94c('0x23'),_0xe94c('0x24'),'dialQueueProject2','monitor_format',_0xe94c('0x25'),_0xe94c('0x26'),'dialCutDigit',_0xe94c('0x27'),_0xe94c('0x28'),'dialDropMaxRetry',_0xe94c('0x29'),'dialAbandonedMaxRetry',_0xe94c('0x2a'),_0xe94c('0x2b'),_0xe94c('0x2c'),_0xe94c('0x2d'),'dialAgentRejectRetryFrequency','mandatoryDisposition',_0xe94c('0x2e'),_0xe94c('0x2f')],'include':[{'model':_0xe94c('0x30'),'as':_0xe94c('0x30'),'attributes':['id',_0xe94c('0x31'),_0xe94c('0x32'),_0xe94c('0x33')]},{'model':_0xe94c('0x34'),'as':_0xe94c('0x35'),'attributes':['id',_0xe94c('0x31')]},{'model':_0xe94c('0x30'),'as':_0xe94c('0x36'),'attributes':['id','name',_0xe94c('0x32'),_0xe94c('0x33')]},{'model':'Interval','as':'Interval','attributes':['id',_0xe94c('0x31')],'include':[{'model':_0xe94c('0x37'),'as':_0xe94c('0x38'),'attributes':['id',_0xe94c('0x31'),_0xe94c('0x39')]}]}]},'log':_0xe94c('0x3a')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index b7b9b68..3abc2a8 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(_0x264348,_0x50f1f0){var _0x28c5c0=function(_0x1b54f9){while(--_0x1b54f9){_0x264348['push'](_0x264348['shift']());}};_0x28c5c0(++_0x50f1f0);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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(_0x4f9acc,_0x517a7e){var _0x2310a4=function(_0x3c5f5c){while(--_0x3c5f5c){_0x4f9acc['push'](_0x4f9acc['shift']());}};_0x2310a4(++_0x517a7e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 7e73d01..894cc77 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 _0x3a59=['getVoiceQueueRtPauses','GetVoiceQueueRtPauses','../client'];(function(_0x3a4ca2,_0x3cd319){var _0x292877=function(_0x50e467){while(--_0x50e467){_0x3a4ca2['push'](_0x3a4ca2['shift']());}};_0x292877(++_0x3cd319);}(_0x3a59,0x1c4));var _0x93a5=function(_0x119cd8,_0x556b73){_0x119cd8=_0x119cd8-0x0;var _0x7072a3=_0x3a59[_0x119cd8];return _0x7072a3;};'use strict';var client=require(_0x93a5('0x0'));exports[_0x93a5('0x1')]=function(_0x39ba40){return function(){return client['Request'](_0x93a5('0x2'),{'options':{'where':{'VoiceQueueId':_0x39ba40,'paused':!![]},'raw':!![]},'log':_0x93a5('0x1')});};}; \ No newline at end of file +var _0x29f6=['Request','../client','getVoiceQueueRtPauses'];(function(_0x58fc2f,_0x111399){var _0x3a1312=function(_0x3d2ff2){while(--_0x3d2ff2){_0x58fc2f['push'](_0x58fc2f['shift']());}};_0x3a1312(++_0x111399);}(_0x29f6,0xf1));var _0x629f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29f6[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x629f('0x0'));exports[_0x629f('0x1')]=function(_0x14ceef){return function(){return client[_0x629f('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x14ceef,'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 30e16c5..217f7b6 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(_0x2705b5,_0x196247){var _0x3d0b76=function(_0x57768c){while(--_0x57768c){_0x2705b5['push'](_0x2705b5['shift']());}};_0x3d0b76(++_0x196247);}(_0x7a54,0x106));var _0x47a5=function(_0x118251,_0x496f5c){_0x118251=_0x118251-0x0;var _0x5d2e45=_0x7a54[_0x118251];return _0x5d2e45;};'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(_0x9f33cf,_0x18490e){var _0x332a53=function(_0x2666ab){while(--_0x2666ab){_0x9f33cf['push'](_0x9f33cf['shift']());}};_0x332a53(++_0x18490e);}(_0x7a54,0x106));var _0x47a5=function(_0x2e9f19,_0x4984b9){_0x2e9f19=_0x2e9f19-0x0;var _0x20a1a9=_0x7a54[_0x2e9f19];return _0x20a1a9;};'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 993e58e..fad7549 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 _0xd718=['Request','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','attended','../client','transfers'];(function(_0x372f84,_0x29af42){var _0x38bca1=function(_0xca148e){while(--_0xca148e){_0x372f84['push'](_0x372f84['shift']());}};_0x38bca1(++_0x29af42);}(_0xd718,0x18e));var _0x8d71=function(_0xb875ee,_0x583042){_0xb875ee=_0xb875ee-0x0;var _0x4c7f3a=_0xd718[_0xb875ee];return _0x4c7f3a;};'use strict';var client=require(_0x8d71('0x0'));exports[_0x8d71('0x1')]={};exports['blindTransfer']=function(_0x3fefa5){return client[_0x8d71('0x2')](_0x8d71('0x3'),{'body':{'result':_0x3fefa5[_0x8d71('0x4')],'transfererchannel':_0x3fefa5['transfererchannel'],'transferercalleridnum':_0x3fefa5[_0x8d71('0x5')],'transferercalleridname':_0x3fefa5[_0x8d71('0x6')],'transfererconnectedlinenum':_0x3fefa5[_0x8d71('0x7')],'transfererconnectedlinename':_0x3fefa5[_0x8d71('0x8')],'transfereraccountcode':_0x3fefa5['transfereraccountcode'],'transferercontext':_0x3fefa5[_0x8d71('0x9')],'transfererexten':_0x3fefa5[_0x8d71('0xa')],'transfererlinkedid':_0x3fefa5[_0x8d71('0xb')],'transfereechannel':_0x3fefa5['transfereechannel'],'transfereecalleridnum':_0x3fefa5[_0x8d71('0xc')],'transfereecalleridname':_0x3fefa5[_0x8d71('0xd')],'transfereeconnectedlinenum':_0x3fefa5[_0x8d71('0xe')],'transfereeconnectedlinename':_0x3fefa5[_0x8d71('0xf')],'transfereeaccountcode':_0x3fefa5[_0x8d71('0x10')],'transfereecontext':_0x3fefa5[_0x8d71('0x11')],'transfereeexten':_0x3fefa5['transfereeexten'],'transfereelinkedid':_0x3fefa5[_0x8d71('0x12')],'isexternal':_0x3fefa5[_0x8d71('0x13')],'context':_0x3fefa5[_0x8d71('0x14')],'extension':_0x3fefa5['extension'],'type':'blind'},'log':_0x8d71('0x3')});};exports[_0x8d71('0x15')]=function(_0x50d099){return client[_0x8d71('0x2')](_0x8d71('0x3'),{'body':{'result':_0x50d099[_0x8d71('0x4')],'transfererchannel':_0x50d099[_0x8d71('0x16')],'transferercalleridnum':_0x50d099[_0x8d71('0x17')],'transferercalleridname':_0x50d099[_0x8d71('0x18')],'transfererconnectedlinenum':_0x50d099['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x50d099[_0x8d71('0x19')],'transfereraccountcode':_0x50d099[_0x8d71('0x1a')],'transferercontext':_0x50d099[_0x8d71('0x1b')],'transfererexten':_0x50d099['secondtransfererexten'],'transfererlinkedid':_0x50d099[_0x8d71('0x1c')],'transfereechannel':_0x50d099[_0x8d71('0x1d')],'transfereecalleridnum':_0x50d099[_0x8d71('0x1e')],'transfereecalleridname':_0x50d099[_0x8d71('0x1f')],'transfereeconnectedlinenum':_0x50d099[_0x8d71('0x20')],'transfereeconnectedlinename':_0x50d099[_0x8d71('0x21')],'transfereeaccountcode':_0x50d099[_0x8d71('0x22')],'transfereecontext':_0x50d099[_0x8d71('0x23')],'transfereeexten':_0x50d099[_0x8d71('0x24')],'transfereelinkedid':_0x50d099['transfertargetlinkedid'],'isexternal':_0x50d099[_0x8d71('0x13')],'context':_0x50d099[_0x8d71('0x25')],'extension':_0x50d099[_0x8d71('0x26')],'type':_0x8d71('0x27')},'log':_0x8d71('0x3')});}; \ No newline at end of file +var _0x5414=['isexternal','context','extension','attendedTransfer','Request','result','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridname','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','attended','../client','transfers','blindTransfer','CreateVoiceTransferReport','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transferercontext','transfererexten','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereelinkedid'];(function(_0x4fa311,_0x370186){var _0x489dcf=function(_0x51fea8){while(--_0x51fea8){_0x4fa311['push'](_0x4fa311['shift']());}};_0x489dcf(++_0x370186);}(_0x5414,0xf9));var _0x4541=function(_0x271d7e,_0x497dc2){_0x271d7e=_0x271d7e-0x0;var _0x26d833=_0x5414[_0x271d7e];return _0x26d833;};'use strict';var client=require(_0x4541('0x0'));exports[_0x4541('0x1')]={};exports[_0x4541('0x2')]=function(_0x46873e){return client['Request'](_0x4541('0x3'),{'body':{'result':_0x46873e['result'],'transfererchannel':_0x46873e['transfererchannel'],'transferercalleridnum':_0x46873e[_0x4541('0x4')],'transferercalleridname':_0x46873e[_0x4541('0x5')],'transfererconnectedlinenum':_0x46873e[_0x4541('0x6')],'transfererconnectedlinename':_0x46873e['transfererconnectedlinename'],'transfereraccountcode':_0x46873e['transfereraccountcode'],'transferercontext':_0x46873e[_0x4541('0x7')],'transfererexten':_0x46873e[_0x4541('0x8')],'transfererlinkedid':_0x46873e['transfererlinkedid'],'transfereechannel':_0x46873e[_0x4541('0x9')],'transfereecalleridnum':_0x46873e['transfereecalleridnum'],'transfereecalleridname':_0x46873e[_0x4541('0xa')],'transfereeconnectedlinenum':_0x46873e[_0x4541('0xb')],'transfereeconnectedlinename':_0x46873e[_0x4541('0xc')],'transfereeaccountcode':_0x46873e['transfereeaccountcode'],'transfereecontext':_0x46873e[_0x4541('0xd')],'transfereeexten':_0x46873e['transfereeexten'],'transfereelinkedid':_0x46873e[_0x4541('0xe')],'isexternal':_0x46873e[_0x4541('0xf')],'context':_0x46873e[_0x4541('0x10')],'extension':_0x46873e[_0x4541('0x11')],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports[_0x4541('0x12')]=function(_0x450137){return client[_0x4541('0x13')](_0x4541('0x3'),{'body':{'result':_0x450137[_0x4541('0x14')],'transfererchannel':_0x450137['origtransfererchannel'],'transferercalleridnum':_0x450137['origtransferercalleridnum'],'transferercalleridname':_0x450137[_0x4541('0x15')],'transfererconnectedlinenum':_0x450137[_0x4541('0x16')],'transfererconnectedlinename':_0x450137[_0x4541('0x17')],'transfereraccountcode':_0x450137[_0x4541('0x18')],'transferercontext':_0x450137[_0x4541('0x19')],'transfererexten':_0x450137[_0x4541('0x1a')],'transfererlinkedid':_0x450137['origtransfererlinkedid'],'transfereechannel':_0x450137[_0x4541('0x1b')],'transfereecalleridnum':_0x450137['transfertargetcalleridnum'],'transfereecalleridname':_0x450137[_0x4541('0x1c')],'transfereeconnectedlinenum':_0x450137['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x450137['transfertargetconnectedlinename'],'transfereeaccountcode':_0x450137[_0x4541('0x1d')],'transfereecontext':_0x450137[_0x4541('0x1e')],'transfereeexten':_0x450137['transfertargetexten'],'transfereelinkedid':_0x450137[_0x4541('0x1f')],'isexternal':_0x450137['isexternal'],'context':_0x450137['origtransferercontext'],'extension':_0x450137['origtransfererexten'],'type':_0x4541('0x20')},'log':_0x4541('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 6305488..8bc12ed 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 _0xf970=['erlangBusyFactor','startProgressive','Trunk','active','callerid','Interval','length','omit','values','channels','voicechannel','uniqueid','channel','%s.%s','filename','format','wav','MixMonitor','ai(mixmonitorid)','find','monitors','toLowerCase','push','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','destinationchannel','status','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','%s/%s','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','Reload','Action','then','message','catch','username','command','Command','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate'];(function(_0x26216b,_0xddd0f5){var _0x38c0d3=function(_0x3c8993){while(--_0x3c8993){_0x26216b['push'](_0x26216b['shift']());}};_0x38c0d3(++_0xddd0f5);}(_0xf970,0x1d9));var _0x0f97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf970[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0f97('0x0'));var util=require('util');var jayson=require(_0x0f97('0x1'));var schema=require(_0x0f97('0x2'));var BPromise=require(_0x0f97('0x3'));var moment=require(_0x0f97('0x4'));var config=require(_0x0f97('0x5'));var properties=require(_0x0f97('0x6'));var ami=require(_0x0f97('0x7'));exports['listen']=function(_0xc822e8,_0x1698c4,_0x290200){return new BPromise(function(_0xac501,_0x2e3515){var _0x3244a6={'QueuePause':function(_0x12fbb3){return new Promise(function(_0x374083,_0x2891f7){var _0x5598eb=util['format'](_0x0f97('0x8'),'SIP',_0x12fbb3[_0x0f97('0x9')]);if(_0xc822e8[_0x0f97('0xa')]&&_0xc822e8[_0x0f97('0xa')][_0x5598eb]&&_0xc822e8['timers'][_0x5598eb][_0x0f97('0xb')]){_0xc822e8['timers'][_0x5598eb][_0x0f97('0xc')]();}if(_0xc822e8[_0x0f97('0xd')][_0x5598eb]){_0xc822e8[_0x0f97('0xd')][_0x5598eb][_0x0f97('0xe')]({'statePause':_0x12fbb3[_0x0f97('0xf')]?!![]:![]});}_0x374083({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x56d310){var _0x2b586a=this;return new Promise(function(_0x4544b4,_0xa35fd){if(ami[_0x0f97('0x10')]()==![]){return _0xa35fd(_0x2b586a[_0x0f97('0x11')](0x1f4,[config[_0x0f97('0x12')]['ip'],config['asterisk']['username'],_0x0f97('0x13')][_0x0f97('0x14')]('\x20')));}_0x56d310=_[_0x0f97('0x15')](_0x56d310,_[_0x0f97('0x16')](properties['module']));_0x56d310['action']=_0x0f97('0x17');return ami[_0x0f97('0x18')](_0x56d310)[_0x0f97('0x19')](function(_0x185ba3){_0x4544b4({'code':0xc8,'message':_0x185ba3[_0x0f97('0x1a')]});})[_0x0f97('0x1b')](function(_0x5059ad){_0xa35fd(_0x2b586a['error'](0x1f5,_0x5059ad[_0x0f97('0x1a')]));});});},'Command':function(_0x132d2f){var _0x3b547f=this;return new Promise(function(_0x425d97,_0x398216){if(ami[_0x0f97('0x10')]()==![]){return _0x398216(_0x3b547f['error'](0x1f4,[config[_0x0f97('0x12')]['ip'],config[_0x0f97('0x12')][_0x0f97('0x1c')],_0x0f97('0x13')][_0x0f97('0x14')]('\x20')));}_0x132d2f=_[_0x0f97('0x15')](_0x132d2f,_0x0f97('0x1d'));_0x132d2f['action']=_0x0f97('0x1e');return ami[_0x0f97('0x18')](_0x132d2f)[_0x0f97('0x19')](function(_0x5c2af0){_0x425d97({'code':0xc8,'message':_0x5c2af0[_0x0f97('0x1f')]});})[_0x0f97('0x1b')](function(_0x4ec6d0){_0x398216(_0x3b547f[_0x0f97('0x11')](0x1f5,_0x4ec6d0[_0x0f97('0x1a')]));});});},'VoiceQueues':function(_0x4ef5bc){return new Promise(function(_0x489e1e,_0x51aa82){var _0x406e24=[];for(var _0x22eb53 in _0xc822e8['voiceQueues']){if(_0xc822e8[_0x0f97('0x20')][_0x0f97('0x21')](_0x22eb53)){var _0x30a715=_0xc822e8[_0x0f97('0x20')][_0x22eb53];var _0x10f71c={'id':_0x30a715['id'],'name':_0x30a715[_0x0f97('0x9')],'strategy':_0x30a715[_0x0f97('0x22')],'answered':_0x30a715[_0x0f97('0x23')],'available':_0x30a715[_0x0f97('0x24')],'loggedIn':_0x30a715[_0x0f97('0x25')],'pTalking':_0x30a715[_0x0f97('0x26')],'sumBillable':_0x30a715['sumBillable'],'sumDuration':_0x30a715[_0x0f97('0x27')],'sumHoldTime':_0x30a715[_0x0f97('0x28')]||0x0,'talking':_0x30a715[_0x0f97('0x29')],'total':_0x30a715[_0x0f97('0x2a')],'type':_0x30a715[_0x0f97('0x2b')],'unmanaged':_0x30a715[_0x0f97('0x2c')],'abandoned':_0x30a715[_0x0f97('0x2d')],'waiting':_0x30a715[_0x0f97('0x2e')],'loggedInDb':_0x30a715['loggedInDb']};if(_0x30a715['type']===_0x0f97('0x2f')){_0x10f71c[_0x0f97('0x30')]=_0x30a715[_0x0f97('0x30')];_0x10f71c[_0x0f97('0x31')]=_0x30a715[_0x0f97('0x31')];_0x10f71c[_0x0f97('0x32')]=_0x30a715[_0x0f97('0x32')];_0x10f71c[_0x0f97('0x33')]=_0x30a715[_0x0f97('0x33')];_0x10f71c[_0x0f97('0x34')]=_0x30a715[_0x0f97('0x34')];_0x10f71c['dialPrefix']=_0x30a715[_0x0f97('0x35')];_0x10f71c[_0x0f97('0x36')]=_0x30a715[_0x0f97('0x36')];_0x10f71c[_0x0f97('0x37')]=_0x30a715[_0x0f97('0x37')];_0x10f71c['outboundAnswerCallsDay']=_0x30a715[_0x0f97('0x38')];_0x10f71c['outboundBlacklistCallsDay']=_0x30a715[_0x0f97('0x39')];_0x10f71c['outboundBusyCallsDay']=_0x30a715[_0x0f97('0x3a')];_0x10f71c[_0x0f97('0x3b')]=_0x30a715[_0x0f97('0x3b')];_0x10f71c[_0x0f97('0x3c')]=_0x30a715[_0x0f97('0x3c')];_0x10f71c['outboundDropCallsDayCallersExit']=_0x30a715['outboundDropCallsDayCallersExit'];_0x10f71c[_0x0f97('0x3d')]=_0x30a715[_0x0f97('0x3d')];_0x10f71c['outboundNoAnswerCallsDay']=_0x30a715[_0x0f97('0x3e')];_0x10f71c[_0x0f97('0x3f')]=_0x30a715[_0x0f97('0x3f')];_0x10f71c[_0x0f97('0x40')]=_0x30a715['outboundOriginateFailureCallsDay'];_0x10f71c[_0x0f97('0x41')]=_0x30a715[_0x0f97('0x41')];_0x10f71c[_0x0f97('0x42')]=_0x30a715[_0x0f97('0x42')];_0x10f71c[_0x0f97('0x43')]=_0x30a715['outboundUnknownCallsDay'];_0x10f71c[_0x0f97('0x44')]=_0x30a715[_0x0f97('0x44')];_0x10f71c[_0x0f97('0x45')]=_0x30a715[_0x0f97('0x45')];_0x10f71c[_0x0f97('0x46')]=_0x30a715[_0x0f97('0x46')];_0x10f71c['predictiveIntervalDroppedCallsCallersExit']=_0x30a715['predictiveIntervalDroppedCallsCallersExit'];_0x10f71c[_0x0f97('0x47')]=_0x30a715[_0x0f97('0x47')];_0x10f71c[_0x0f97('0x48')]=_0x30a715['predictiveIntervalErlangCalls'];_0x10f71c[_0x0f97('0x49')]=_0x30a715[_0x0f97('0x49')];_0x10f71c[_0x0f97('0x4a')]=_0x30a715['predictiveIntervalHitRate'];_0x10f71c[_0x0f97('0x4b')]=_0x30a715[_0x0f97('0x4b')];_0x10f71c[_0x0f97('0x4c')]=_0x30a715[_0x0f97('0x4c')];_0x10f71c[_0x0f97('0x4d')]=_0x30a715[_0x0f97('0x4d')];_0x10f71c[_0x0f97('0x4e')]=_0x30a715[_0x0f97('0x4e')];_0x10f71c[_0x0f97('0x1a')]=_0x30a715[_0x0f97('0x1a')];_0x10f71c[_0x0f97('0x4f')]=_0x30a715['originated'];_0x10f71c[_0x0f97('0x50')]=_0x30a715[_0x0f97('0x50')];_0x10f71c['erlangCallToSecond']=_0x30a715[_0x0f97('0x51')];_0x10f71c['erlangAbandonmentRate']=_0x30a715[_0x0f97('0x52')];_0x10f71c[_0x0f97('0x53')]=_0x30a715[_0x0f97('0x53')];_0x10f71c['startPredictive']=_0x30a715['startPredictive'];_0x10f71c[_0x0f97('0x54')]=_0x30a715[_0x0f97('0x54')];}if(_0x30a715[_0x0f97('0x55')]){_0x10f71c[_0x0f97('0x55')]={'id':_0x30a715[_0x0f97('0x55')]['id'],'name':_0x30a715['Trunk']['name'],'active':_0x30a715[_0x0f97('0x55')][_0x0f97('0x56')],'callerid':_0x30a715[_0x0f97('0x55')][_0x0f97('0x57')]};}if(_0x30a715[_0x0f97('0x58')]){_0x10f71c[_0x0f97('0x58')]={'id':_0x30a715[_0x0f97('0x58')]['id'],'name':_0x30a715[_0x0f97('0x58')][_0x0f97('0x9')]};}_0x406e24['push'](_0x10f71c);}}_0x489e1e({'count':_0x406e24[_0x0f97('0x59')],'rows':_0x406e24});});},'UpdateVoiceQueue':function(_0x5eef4a){return new Promise(function(_0x16ef4d,_0x16be67){var _0xd246c1=_['find'](_0xc822e8['voiceQueues'],{'id':parseInt(_0x5eef4a['id'])});var _0x3bbdbc=_[_0x0f97('0x5a')](_0x5eef4a,['id']);if(_0xd246c1){for(var _0x40ea51 in _0x3bbdbc){if(typeof _0x3bbdbc[_0x40ea51]!=='undefined'&&typeof _0xd246c1[_0x40ea51]!=='undefined'){_0xd246c1[_0x40ea51]=_0x3bbdbc[_0x40ea51];}}_0x16ef4d(_0xd246c1);}else{_0x16be67();}});},'VoiceChannels':function(_0x546aac){return new Promise(function(_0xa32a1d,_0x3cdbee){var _0x1871b6=_[_0x0f97('0x5b')](_0xc822e8[_0x0f97('0x5c')]);_0xa32a1d({'count':_0x1871b6[_0x0f97('0x59')],'rows':_0x1871b6});});},'VoiceChannelMixMonitor':function(_0xe87bfc){var _0x248189=this;return new Promise(function(_0x1c342d,_0x21c8b4){if(ami[_0x0f97('0x10')]()==![]){return _0x21c8b4(_0x248189['error'](0x1f4,[config[_0x0f97('0x12')]['ip'],config['asterisk']['username'],_0x0f97('0x13')]['join']('\x20')));}var _0x1a2f25=schema(properties[_0x0f97('0x5d')])[_0x0f97('0x2')](_0xe87bfc);if(_0x1a2f25[_0x0f97('0x59')]>0x0){return _0x21c8b4(_0x248189[_0x0f97('0x11')](0x1f4,_['map'](_0x1a2f25,'message')[_0x0f97('0x14')](',\x20')));}var _0xf5fedc=_['find'](_0xc822e8[_0x0f97('0x5c')],{'uniqueid':_0xe87bfc[_0x0f97('0x5e')]});if(_0xf5fedc&&_0xf5fedc[_0x0f97('0x5f')]){var _0x31e96a=util['format'](_0x0f97('0x60'),_0xe87bfc[_0x0f97('0x61')]||_0xe87bfc[_0x0f97('0x5e')],_0xe87bfc[_0x0f97('0x62')]||_0x0f97('0x63'));return ami[_0x0f97('0x18')]({'action':_0x0f97('0x64'),'channel':_0xf5fedc[_0x0f97('0x5f')],'file':_0x31e96a,'options':_0x0f97('0x65')})[_0x0f97('0x19')](function(_0x29d47b){var _0x736610=_[_0x0f97('0x66')](_0xf5fedc[_0x0f97('0x67')],{'filename':'/var/spool/asterisk/monitor/'+_0x31e96a[_0x0f97('0x68')]()});if(_['isNil'](_0x736610)){_0xf5fedc[_0x0f97('0x67')][_0x0f97('0x69')]({'filename':_0x0f97('0x6a')+_0x31e96a['toLowerCase'](),'createdAt':moment()[_0x0f97('0x62')](_0x0f97('0x6b')),'mixmonitorid':_0x29d47b[_0x0f97('0x6c')],'status':'rec'});}else{_0x736610['mixmonitorid']=_0x29d47b['mixmonitorid'];_0x736610['status']=_0x0f97('0x6d');}_0x1c342d({'code':0xc8,'message':[_0xe87bfc[_0x0f97('0x5e')],_0x0f97('0x6e'),_0x29d47b['mixmonitorid']][_0x0f97('0x14')]('\x20'),'mixmonitorid':_0x29d47b['mixmonitorid']});})[_0x0f97('0x1b')](function(_0xc1f29e){_0x21c8b4(_0x248189[_0x0f97('0x11')](0x1f5,[_0xe87bfc[_0x0f97('0x5e')],_0xc1f29e[_0x0f97('0x1a')][_0x0f97('0x68')]()][_0x0f97('0x14')]('\x20')));});}else{return _0x21c8b4(_0x248189[_0x0f97('0x11')](0x1f5,_0x0f97('0x6f')));}});},'VoiceChannelStopMixMonitor':function(_0x59a646){var _0x2e2103=this;return new Promise(function(_0xbd80c1,_0x406210){if(ami[_0x0f97('0x10')]()==![]){return _0x406210(_0x2e2103[_0x0f97('0x11')](0x1f4,[config[_0x0f97('0x12')]['ip'],config[_0x0f97('0x12')][_0x0f97('0x1c')],'ami\x20disconnected'][_0x0f97('0x14')]('\x20')));}var _0xddbd8d=schema(properties['voicechannel'])[_0x0f97('0x2')](_0x59a646);if(_0xddbd8d[_0x0f97('0x59')]>0x0){return _0x406210(_0x2e2103[_0x0f97('0x11')](0x1f4,_[_0x0f97('0x70')](_0xddbd8d,'message')[_0x0f97('0x14')](',\x20')));}var _0x34a1df=_[_0x0f97('0x66')](_0xc822e8[_0x0f97('0x5c')],{'uniqueid':_0x59a646[_0x0f97('0x5e')]});if(_0x34a1df){return BPromise[_0x0f97('0x71')]()[_0x0f97('0x19')](function(){if(_0x34a1df[_0x0f97('0x5f')]){return ami[_0x0f97('0x18')]({'action':_0x0f97('0x72'),'channel':_0x34a1df[_0x0f97('0x5f')],'mixmonitorid':_0x59a646[_0x0f97('0x6c')]})[_0x0f97('0x1b')](function(_0x2fa000){});}})['then'](function(){if(_0x34a1df[_0x0f97('0x73')]){return ami[_0x0f97('0x18')]({'action':_0x0f97('0x72'),'channel':_0x34a1df['destinationchannel'],'mixmonitorid':_0x59a646['mixmonitorid']})[_0x0f97('0x1b')](function(_0x4d9097){});}})[_0x0f97('0x19')](function(_0x5e0d82){var _0x23bcd8=_['find'](_0x34a1df[_0x0f97('0x67')],{'mixmonitorid':_0x59a646['mixmonitorid']});if(_0x23bcd8){_0x23bcd8[_0x0f97('0x74')]=_0x0f97('0x75');}})[_0x0f97('0x19')](function(){var _0x45c47f=util[_0x0f97('0x62')](_0x0f97('0x60'),_0x59a646['filename']||_0x59a646['uniqueid'],_0x59a646[_0x0f97('0x62')]||'wav');var _0x1310e9=_[_0x0f97('0x66')](_0x34a1df[_0x0f97('0x67')],{'filename':'/var/spool/asterisk/monitor/'+_0x45c47f['toLowerCase']()});if(_0x1310e9){_0x1310e9[_0x0f97('0x74')]=_0x0f97('0x75');}})['then'](function(){_0xbd80c1({'code':0xc8,'message':[_0x59a646[_0x0f97('0x5e')],_0x0f97('0x76')][_0x0f97('0x14')]('\x20')});})[_0x0f97('0x1b')](function(_0x2d0c2d){_0x406210(_0x2e2103[_0x0f97('0x11')](0x1f5,[_0x59a646[_0x0f97('0x5e')],_0x2d0c2d[_0x0f97('0x1a')][_0x0f97('0x68')]()]['join']('\x20')));});}else{return _0x406210(_0x2e2103['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x2b8c8f){return new Promise(function(_0x47e12f,_0x478212){var _0x3c103d=_[_0x0f97('0x5b')](_0xc822e8[_0x0f97('0x77')]);_0x47e12f({'count':_0x3c103d[_0x0f97('0x59')],'rows':_0x3c103d});});},'VoiceQueuesChannel':function(_0x48d38a){var _0x21ce2a=this;return new Promise(function(_0x4a278c,_0x447c50){var _0x4d1d8a=schema(properties['voicequeuechannel'])[_0x0f97('0x2')](_0x48d38a);if(_0x4d1d8a[_0x0f97('0x59')]>0x0){return _0x447c50(_0x21ce2a[_0x0f97('0x11')](0x1f4,_['map'](_0x4d1d8a,_0x0f97('0x1a'))[_0x0f97('0x14')](',\x20')));}var _0x6c9898=_[_0x0f97('0x66')](_0xc822e8['queueChannels'],{'uniqueid':_0x48d38a[_0x0f97('0x5e')]});if(_0x6c9898){_0x4a278c(_0x6c9898);}else{return _0x447c50(_0x21ce2a['error'](0x1f5,_0x0f97('0x6f')));}});},'VoiceQueuesChannelHangup':function(_0x27cff8){var _0x597dd5=this;return new Promise(function(_0x567bda,_0x40cc45){if(ami[_0x0f97('0x10')]()==![]){return _0x40cc45(_0x597dd5[_0x0f97('0x11')](0x1f4,[config[_0x0f97('0x12')]['ip'],config['asterisk']['username'],_0x0f97('0x13')][_0x0f97('0x14')]('\x20')));}var _0x2af25f=schema(properties[_0x0f97('0x78')])[_0x0f97('0x2')](_0x27cff8);if(_0x2af25f[_0x0f97('0x59')]>0x0){return _0x40cc45(_0x597dd5['error'](0x1f4,_[_0x0f97('0x70')](_0x2af25f,_0x0f97('0x1a'))[_0x0f97('0x14')](',\x20')));}var _0x3cf338=_[_0x0f97('0x66')](_0xc822e8[_0x0f97('0x77')],{'uniqueid':_0x27cff8['uniqueid']});if(_0x3cf338&&_0x3cf338[_0x0f97('0x5f')]){return ami[_0x0f97('0x18')]({'action':_0x0f97('0x79'),'channel':_0x3cf338[_0x0f97('0x5f')]})[_0x0f97('0x19')](function(_0x6616d){_0x567bda({'code':0xc8,'message':[_0x27cff8[_0x0f97('0x5e')],_0x6616d[_0x0f97('0x1a')]['toLowerCase']()][_0x0f97('0x14')]('\x20')});})[_0x0f97('0x1b')](function(_0x52c361){_0x40cc45(_0x597dd5['error'](0x1f5,[_0x27cff8[_0x0f97('0x5e')],_0x52c361['message'][_0x0f97('0x68')]()][_0x0f97('0x14')]('\x20')));});}else{return _0x40cc45(_0x597dd5[_0x0f97('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x923c5e){var _0x330820=this;return new Promise(function(_0x16071d,_0x186a97){if(ami[_0x0f97('0x10')]()==![]){return _0x186a97(_0x330820[_0x0f97('0x11')](0x1f4,[config[_0x0f97('0x12')]['ip'],config[_0x0f97('0x12')][_0x0f97('0x1c')],'ami\x20disconnected'][_0x0f97('0x14')]('\x20')));}var _0x195ea7=schema(properties[_0x0f97('0x7a')])[_0x0f97('0x2')](_0x923c5e);if(_0x195ea7[_0x0f97('0x59')]>0x0){return _0x186a97(_0x330820['error'](0x1f4,_[_0x0f97('0x70')](_0x195ea7,_0x0f97('0x1a'))['join'](',\x20')));}var _0x7c33fd=_['find'](_0xc822e8[_0x0f97('0x77')],{'uniqueid':_0x923c5e['uniqueid']});if(_0x7c33fd&&_0x7c33fd[_0x0f97('0x5f')]){return ami[_0x0f97('0x18')]({'action':'Redirect','channel':_0x7c33fd[_0x0f97('0x5f')],'exten':_0x923c5e['exten'],'context':_0x923c5e['context']||_0x7c33fd['context'],'priority':0x1})[_0x0f97('0x19')](function(_0x41dda5){_0x16071d({'code':0xc8,'message':[_0x923c5e[_0x0f97('0x5e')],_0x41dda5[_0x0f97('0x1a')][_0x0f97('0x68')]()][_0x0f97('0x14')]('\x20')});})[_0x0f97('0x1b')](function(_0x1acab1){_0x186a97(_0x330820[_0x0f97('0x11')](0x1f5,[_0x923c5e[_0x0f97('0x5e')],_0x1acab1['message'][_0x0f97('0x68')]()][_0x0f97('0x14')]('\x20')));});}else{return _0x186a97(_0x330820[_0x0f97('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x357f07){return new Promise(function(_0x1d65f7,_0x5a930d){var _0x5e9139=_[_0x0f97('0x5b')](_0xc822e8[_0x0f97('0xd')]);_0x1d65f7({'count':_0x5e9139[_0x0f97('0x59')],'rows':_0x5e9139});});},'Telephones':function(_0x2d5a7a){return new Promise(function(_0x26dd22,_0x15d7c5){var _0x30bb6b=_[_0x0f97('0x5b')](_0xc822e8[_0x0f97('0x7b')]);_0x26dd22({'count':_0x30bb6b[_0x0f97('0x59')],'rows':_0x30bb6b});});},'Trunks':function(_0x10fb5c){return new Promise(function(_0x66eedd,_0x22321b){var _0x105deb=_[_0x0f97('0x5b')](_0xc822e8[_0x0f97('0x7c')]);_0x66eedd({'count':_0x105deb[_0x0f97('0x59')],'rows':_0x105deb});});},'OutboundChannels':function(_0x5337f1){return new Promise(function(_0x4f1196,_0x3e0bc4){var _0x5d4bae=_[_0x0f97('0x5b')](_0xc822e8[_0x0f97('0x7d')]);_0x4f1196({'count':_0x5d4bae[_0x0f97('0x59')],'rows':_0x5d4bae});});},'Outbound':function(_0xc2f752){return new Promise(function(_0x15bed7,_0x5b84a3){_0x15bed7(_0xc822e8[_0x0f97('0x2f')]);});},'Campaigns':function(_0x2f8298){return new Promise(function(_0x409689,_0x2043e3){var _0x523f80=_[_0x0f97('0x5b')](_0xc822e8[_0x0f97('0x7e')]);_0x409689({'count':_0x523f80['length'],'rows':_0x523f80});});},'VoiceQueuesPreview':function(_0x352bcc){var _0x336d92=this;return new Promise(function(_0x5c208c,_0x47a1d1){_0x1698c4[_0x0f97('0x7f')](_0x352bcc['id'])['then'](function(_0x398752){_0x5c208c({'code':0xc8,'message':_0x398752['message']});})[_0x0f97('0x1b')](function(_0x26df33){_0x47a1d1(_0x336d92['error'](0x1f4,_0x26df33[_0x0f97('0x1a')]));});});},'EventManager':function(_0x515b80){var _0xe91b0e=this;return new Promise(function(_0x601fd7,_0x2e5135){if(!_0x515b80[_0x0f97('0x80')]){return _0x2e5135(_0xe91b0e[_0x0f97('0x11')](0x1f4,_0x0f97('0x81')));}ami[_0x0f97('0x82')](_0x0f97('0x83')+_0x515b80['event'],_0x515b80[_0x0f97('0x1a')]);_0x601fd7({'code':0xc8,'message':_0x515b80});});},'FaxAccounts':function(_0x347ef8){return new Promise(function(_0x566296,_0x2ad161){var _0x12b578=_[_0x0f97('0x5b')](_0xc822e8[_0x0f97('0x84')]);_0x566296({'count':_0x12b578[_0x0f97('0x59')],'rows':_0x12b578});});},'SendFax':function(_0x3170c4){var _0x234437=this;return new Promise(function(_0x1b49c2,_0x58a30d){_0x290200[_0x0f97('0x85')](_0x3170c4)[_0x0f97('0x19')](function(_0x3876bb){_0x1b49c2({'code':0xc8,'message':_0x3876bb[_0x0f97('0x1a')]});})['catch'](function(_0x57cc3a){_0x58a30d(_0x234437[_0x0f97('0x11')](0x1f4,_0x57cc3a[_0x0f97('0x1a')]));});});},'CheckAfterSend':function(_0x34d326){var _0x9c46e2=this;return new Promise(function(_0x3fa275,_0x4b6c9c){_0x290200[_0x0f97('0x86')](_0x34d326)[_0x0f97('0x19')](function(_0x4f1d24){_0x3fa275({'code':0xc8,'message':_0x4f1d24['message']});})[_0x0f97('0x1b')](function(_0x1c3338){_0x4b6c9c(_0x9c46e2[_0x0f97('0x11')](0x1f4,_0x1c3338[_0x0f97('0x1a')]));});});}};var _0x255d17=jayson[_0x0f97('0x87')](_0x3244a6)[_0x0f97('0x88')]();_0x255d17['on'](_0x0f97('0x11'),function(_0xa0ec4d){return _0x2e3515(_0xa0ec4d);});_0x255d17['listen'](0x232a,_0x0f97('0x89'),function(){console['log'](_0x0f97('0x8a'),0x232a);return _0xac501('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x2b29=['dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','callerid','Interval','push','length','find','undefined','values','voicechannel','%s.%s','filename','uniqueid','wav','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','channels','resolve','StopMixMonitor','channel','destinationchannel','stop','StopMixMonitor\x20Success','voicequeuechannel','queueChannels','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','checkAfterSend','http','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','validate','bluebird','../../../config/environment','../properties','../ami','listen','format','%s/%s','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','action','Action','message','catch','username','command','Command','then','voiceQueues','strategy','answered','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','outbound','dialActive'];(function(_0x96f74c,_0xfc30a4){var _0x379222=function(_0x1bbde9){while(--_0x1bbde9){_0x96f74c['push'](_0x96f74c['shift']());}};_0x379222(++_0xfc30a4);}(_0x2b29,0x163));var _0x92b2=function(_0x4a6735,_0x6828cf){_0x4a6735=_0x4a6735-0x0;var _0x42e79e=_0x2b29[_0x4a6735];return _0x42e79e;};'use strict';var _=require('lodash');var util=require(_0x92b2('0x0'));var jayson=require(_0x92b2('0x1'));var schema=require(_0x92b2('0x2'));var BPromise=require(_0x92b2('0x3'));var moment=require('moment');var config=require(_0x92b2('0x4'));var properties=require(_0x92b2('0x5'));var ami=require(_0x92b2('0x6'));exports[_0x92b2('0x7')]=function(_0x16c1b0,_0x3166e8,_0x47c522){return new BPromise(function(_0xb1d856,_0x536e21){var _0x29f183={'QueuePause':function(_0x43a292){return new Promise(function(_0x5c1d94,_0x3e2204){var _0x14c8e3=util[_0x92b2('0x8')](_0x92b2('0x9'),'SIP',_0x43a292[_0x92b2('0xa')]);if(_0x16c1b0[_0x92b2('0xb')]&&_0x16c1b0[_0x92b2('0xb')][_0x14c8e3]&&_0x16c1b0[_0x92b2('0xb')][_0x14c8e3][_0x92b2('0xc')]){_0x16c1b0[_0x92b2('0xb')][_0x14c8e3][_0x92b2('0xd')]();}if(_0x16c1b0['agents'][_0x14c8e3]){_0x16c1b0[_0x92b2('0xe')][_0x14c8e3][_0x92b2('0xf')]({'statePause':_0x43a292[_0x92b2('0x10')]?!![]:![]});}_0x5c1d94({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x1b7dd6){var _0x3e5309=this;return new Promise(function(_0x3c5db1,_0x4d597b){if(ami[_0x92b2('0x11')]()==![]){return _0x4d597b(_0x3e5309[_0x92b2('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x92b2('0x13')]['username'],_0x92b2('0x14')][_0x92b2('0x15')]('\x20')));}_0x1b7dd6=_[_0x92b2('0x16')](_0x1b7dd6,_['keys'](properties['module']));_0x1b7dd6[_0x92b2('0x17')]='Reload';return ami[_0x92b2('0x18')](_0x1b7dd6)['then'](function(_0x42872b){_0x3c5db1({'code':0xc8,'message':_0x42872b[_0x92b2('0x19')]});})[_0x92b2('0x1a')](function(_0xceaa2f){_0x4d597b(_0x3e5309[_0x92b2('0x12')](0x1f5,_0xceaa2f[_0x92b2('0x19')]));});});},'Command':function(_0x1cb43e){var _0x692704=this;return new Promise(function(_0x21bc07,_0xa08831){if(ami[_0x92b2('0x11')]()==![]){return _0xa08831(_0x692704[_0x92b2('0x12')](0x1f4,[config[_0x92b2('0x13')]['ip'],config[_0x92b2('0x13')][_0x92b2('0x1b')],'ami\x20disconnected'][_0x92b2('0x15')]('\x20')));}_0x1cb43e=_['pick'](_0x1cb43e,_0x92b2('0x1c'));_0x1cb43e[_0x92b2('0x17')]=_0x92b2('0x1d');return ami[_0x92b2('0x18')](_0x1cb43e)[_0x92b2('0x1e')](function(_0x574c3e){_0x21bc07({'code':0xc8,'message':_0x574c3e['content']});})[_0x92b2('0x1a')](function(_0x31567c){_0xa08831(_0x692704[_0x92b2('0x12')](0x1f5,_0x31567c[_0x92b2('0x19')]));});});},'VoiceQueues':function(_0x5a6c76){return new Promise(function(_0x30a205,_0x15faf5){var _0x49b81e=[];for(var _0xbbbfa7 in _0x16c1b0['voiceQueues']){if(_0x16c1b0[_0x92b2('0x1f')]['hasOwnProperty'](_0xbbbfa7)){var _0x183f81=_0x16c1b0['voiceQueues'][_0xbbbfa7];var _0x5e9688={'id':_0x183f81['id'],'name':_0x183f81[_0x92b2('0xa')],'strategy':_0x183f81[_0x92b2('0x20')],'answered':_0x183f81[_0x92b2('0x21')],'available':_0x183f81['available'],'loggedIn':_0x183f81[_0x92b2('0x22')],'pTalking':_0x183f81['pTalking'],'sumBillable':_0x183f81[_0x92b2('0x23')],'sumDuration':_0x183f81[_0x92b2('0x24')],'sumHoldTime':_0x183f81[_0x92b2('0x25')]||0x0,'talking':_0x183f81[_0x92b2('0x26')],'total':_0x183f81[_0x92b2('0x27')],'type':_0x183f81[_0x92b2('0x28')],'unmanaged':_0x183f81[_0x92b2('0x29')],'abandoned':_0x183f81['abandoned'],'waiting':_0x183f81['waiting'],'loggedInDb':_0x183f81['loggedInDb']};if(_0x183f81[_0x92b2('0x28')]===_0x92b2('0x2a')){_0x5e9688[_0x92b2('0x2b')]=_0x183f81['dialActive'];_0x5e9688['dialMethod']=_0x183f81[_0x92b2('0x2c')];_0x5e9688[_0x92b2('0x2d')]=_0x183f81[_0x92b2('0x2d')];_0x5e9688[_0x92b2('0x2e')]=_0x183f81[_0x92b2('0x2e')];_0x5e9688['dialOriginateTimeout']=_0x183f81['dialOriginateTimeout'];_0x5e9688['dialPrefix']=_0x183f81[_0x92b2('0x2f')];_0x5e9688[_0x92b2('0x30')]=_0x183f81['temp'];_0x5e9688[_0x92b2('0x31')]=_0x183f81[_0x92b2('0x31')];_0x5e9688[_0x92b2('0x32')]=_0x183f81[_0x92b2('0x32')];_0x5e9688[_0x92b2('0x33')]=_0x183f81[_0x92b2('0x33')];_0x5e9688[_0x92b2('0x34')]=_0x183f81[_0x92b2('0x34')];_0x5e9688['outboundCongestionCallsDay']=_0x183f81[_0x92b2('0x35')];_0x5e9688[_0x92b2('0x36')]=_0x183f81[_0x92b2('0x36')];_0x5e9688['outboundDropCallsDayCallersExit']=_0x183f81[_0x92b2('0x37')];_0x5e9688['outboundDropCallsDayTimeout']=_0x183f81[_0x92b2('0x38')];_0x5e9688[_0x92b2('0x39')]=_0x183f81['outboundNoAnswerCallsDay'];_0x5e9688['outboundNoSuchCallsDay']=_0x183f81[_0x92b2('0x3a')];_0x5e9688[_0x92b2('0x3b')]=_0x183f81['outboundOriginateFailureCallsDay'];_0x5e9688['outboundReCallsDay']=_0x183f81[_0x92b2('0x3c')];_0x5e9688[_0x92b2('0x3d')]=_0x183f81['outboundRejectCallsDay'];_0x5e9688[_0x92b2('0x3e')]=_0x183f81[_0x92b2('0x3e')];_0x5e9688[_0x92b2('0x3f')]=_0x183f81['predictiveIntervalAnsweredCalls'];_0x5e9688[_0x92b2('0x40')]=_0x183f81['predictiveIntervalAvgHoldtime'];_0x5e9688[_0x92b2('0x41')]=_0x183f81[_0x92b2('0x41')];_0x5e9688[_0x92b2('0x42')]=_0x183f81[_0x92b2('0x42')];_0x5e9688[_0x92b2('0x43')]=_0x183f81[_0x92b2('0x43')];_0x5e9688['predictiveIntervalErlangCalls']=_0x183f81[_0x92b2('0x44')];_0x5e9688[_0x92b2('0x45')]=_0x183f81['predictiveIntervalErlangCallsDroppedCalls'];_0x5e9688[_0x92b2('0x46')]=_0x183f81[_0x92b2('0x46')];_0x5e9688[_0x92b2('0x47')]=_0x183f81[_0x92b2('0x47')];_0x5e9688[_0x92b2('0x48')]=_0x183f81[_0x92b2('0x48')];_0x5e9688[_0x92b2('0x49')]=_0x183f81['predictiveIntervalAvailable'];_0x5e9688[_0x92b2('0x4a')]=_0x183f81['predictiveIntervalTotalCalls'];_0x5e9688[_0x92b2('0x19')]=_0x183f81['message'];_0x5e9688[_0x92b2('0x4b')]=_0x183f81[_0x92b2('0x4b')];_0x5e9688[_0x92b2('0x4c')]=_0x183f81['erlangCalls'];_0x5e9688[_0x92b2('0x4d')]=_0x183f81[_0x92b2('0x4d')];_0x5e9688[_0x92b2('0x4e')]=_0x183f81['erlangAbandonmentRate'];_0x5e9688[_0x92b2('0x4f')]=_0x183f81[_0x92b2('0x4f')];_0x5e9688[_0x92b2('0x50')]=_0x183f81[_0x92b2('0x50')];_0x5e9688['startProgressive']=_0x183f81['startProgressive'];}if(_0x183f81['Trunk']){_0x5e9688[_0x92b2('0x51')]={'id':_0x183f81[_0x92b2('0x51')]['id'],'name':_0x183f81[_0x92b2('0x51')]['name'],'active':_0x183f81[_0x92b2('0x51')]['active'],'callerid':_0x183f81[_0x92b2('0x51')][_0x92b2('0x52')]};}if(_0x183f81[_0x92b2('0x53')]){_0x5e9688[_0x92b2('0x53')]={'id':_0x183f81[_0x92b2('0x53')]['id'],'name':_0x183f81[_0x92b2('0x53')][_0x92b2('0xa')]};}_0x49b81e[_0x92b2('0x54')](_0x5e9688);}}_0x30a205({'count':_0x49b81e[_0x92b2('0x55')],'rows':_0x49b81e});});},'UpdateVoiceQueue':function(_0x2f18d6){return new Promise(function(_0x3c245d,_0x440cdc){var _0x558855=_[_0x92b2('0x56')](_0x16c1b0['voiceQueues'],{'id':parseInt(_0x2f18d6['id'])});var _0x191e15=_['omit'](_0x2f18d6,['id']);if(_0x558855){for(var _0x18b4ba in _0x191e15){if(typeof _0x191e15[_0x18b4ba]!==_0x92b2('0x57')&&typeof _0x558855[_0x18b4ba]!==_0x92b2('0x57')){_0x558855[_0x18b4ba]=_0x191e15[_0x18b4ba];}}_0x3c245d(_0x558855);}else{_0x440cdc();}});},'VoiceChannels':function(_0x4f7f0f){return new Promise(function(_0x397448,_0x4a670c){var _0xd89d2=_[_0x92b2('0x58')](_0x16c1b0['channels']);_0x397448({'count':_0xd89d2[_0x92b2('0x55')],'rows':_0xd89d2});});},'VoiceChannelMixMonitor':function(_0x24923e){var _0x4753cf=this;return new Promise(function(_0x442af6,_0x2f749f){if(ami[_0x92b2('0x11')]()==![]){return _0x2f749f(_0x4753cf[_0x92b2('0x12')](0x1f4,[config[_0x92b2('0x13')]['ip'],config[_0x92b2('0x13')][_0x92b2('0x1b')],_0x92b2('0x14')][_0x92b2('0x15')]('\x20')));}var _0x3b85e2=schema(properties[_0x92b2('0x59')])['validate'](_0x24923e);if(_0x3b85e2[_0x92b2('0x55')]>0x0){return _0x2f749f(_0x4753cf[_0x92b2('0x12')](0x1f4,_['map'](_0x3b85e2,'message')['join'](',\x20')));}var _0x1ab4da=_[_0x92b2('0x56')](_0x16c1b0['channels'],{'uniqueid':_0x24923e['uniqueid']});if(_0x1ab4da&&_0x1ab4da['channel']){var _0x427e92=util[_0x92b2('0x8')](_0x92b2('0x5a'),_0x24923e[_0x92b2('0x5b')]||_0x24923e[_0x92b2('0x5c')],_0x24923e[_0x92b2('0x8')]||_0x92b2('0x5d'));return ami[_0x92b2('0x18')]({'action':'MixMonitor','channel':_0x1ab4da['channel'],'file':_0x427e92,'options':'ai(mixmonitorid)'})[_0x92b2('0x1e')](function(_0x4d3f8f){var _0x68db6d=_['find'](_0x1ab4da[_0x92b2('0x5e')],{'filename':_0x92b2('0x5f')+_0x427e92[_0x92b2('0x60')]()});if(_[_0x92b2('0x61')](_0x68db6d)){_0x1ab4da['monitors'][_0x92b2('0x54')]({'filename':_0x92b2('0x5f')+_0x427e92[_0x92b2('0x60')](),'createdAt':moment()[_0x92b2('0x8')](_0x92b2('0x62')),'mixmonitorid':_0x4d3f8f[_0x92b2('0x63')],'status':_0x92b2('0x64')});}else{_0x68db6d[_0x92b2('0x63')]=_0x4d3f8f[_0x92b2('0x63')];_0x68db6d[_0x92b2('0x65')]=_0x92b2('0x64');}_0x442af6({'code':0xc8,'message':[_0x24923e[_0x92b2('0x5c')],_0x92b2('0x66'),_0x4d3f8f[_0x92b2('0x63')]][_0x92b2('0x15')]('\x20'),'mixmonitorid':_0x4d3f8f['mixmonitorid']});})['catch'](function(_0x3f6ec3){_0x2f749f(_0x4753cf[_0x92b2('0x12')](0x1f5,[_0x24923e[_0x92b2('0x5c')],_0x3f6ec3['message'][_0x92b2('0x60')]()][_0x92b2('0x15')]('\x20')));});}else{return _0x2f749f(_0x4753cf[_0x92b2('0x12')](0x1f5,_0x92b2('0x67')));}});},'VoiceChannelStopMixMonitor':function(_0x33a015){var _0x46b4de=this;return new Promise(function(_0x883121,_0x4de976){if(ami[_0x92b2('0x11')]()==![]){return _0x4de976(_0x46b4de[_0x92b2('0x12')](0x1f4,[config[_0x92b2('0x13')]['ip'],config['asterisk'][_0x92b2('0x1b')],_0x92b2('0x14')]['join']('\x20')));}var _0x4a0355=schema(properties[_0x92b2('0x59')])[_0x92b2('0x2')](_0x33a015);if(_0x4a0355['length']>0x0){return _0x4de976(_0x46b4de[_0x92b2('0x12')](0x1f4,_[_0x92b2('0x68')](_0x4a0355,_0x92b2('0x19'))[_0x92b2('0x15')](',\x20')));}var _0x466c79=_[_0x92b2('0x56')](_0x16c1b0[_0x92b2('0x69')],{'uniqueid':_0x33a015[_0x92b2('0x5c')]});if(_0x466c79){return BPromise[_0x92b2('0x6a')]()[_0x92b2('0x1e')](function(){if(_0x466c79['channel']){return ami[_0x92b2('0x18')]({'action':_0x92b2('0x6b'),'channel':_0x466c79[_0x92b2('0x6c')],'mixmonitorid':_0x33a015[_0x92b2('0x63')]})[_0x92b2('0x1a')](function(_0x4c5973){});}})['then'](function(){if(_0x466c79[_0x92b2('0x6d')]){return ami[_0x92b2('0x18')]({'action':_0x92b2('0x6b'),'channel':_0x466c79[_0x92b2('0x6d')],'mixmonitorid':_0x33a015[_0x92b2('0x63')]})[_0x92b2('0x1a')](function(_0x2607ed){});}})['then'](function(_0xd7eff){var _0x105e9a=_['find'](_0x466c79[_0x92b2('0x5e')],{'mixmonitorid':_0x33a015['mixmonitorid']});if(_0x105e9a){_0x105e9a[_0x92b2('0x65')]=_0x92b2('0x6e');}})[_0x92b2('0x1e')](function(){var _0x4c4e32=util['format'](_0x92b2('0x5a'),_0x33a015['filename']||_0x33a015['uniqueid'],_0x33a015[_0x92b2('0x8')]||_0x92b2('0x5d'));var _0x800070=_[_0x92b2('0x56')](_0x466c79[_0x92b2('0x5e')],{'filename':_0x92b2('0x5f')+_0x4c4e32[_0x92b2('0x60')]()});if(_0x800070){_0x800070['status']=_0x92b2('0x6e');}})[_0x92b2('0x1e')](function(){_0x883121({'code':0xc8,'message':[_0x33a015['uniqueid'],_0x92b2('0x6f')][_0x92b2('0x15')]('\x20')});})[_0x92b2('0x1a')](function(_0x1bcc26){_0x4de976(_0x46b4de[_0x92b2('0x12')](0x1f5,[_0x33a015['uniqueid'],_0x1bcc26[_0x92b2('0x19')][_0x92b2('0x60')]()]['join']('\x20')));});}else{return _0x4de976(_0x46b4de[_0x92b2('0x12')](0x1f5,_0x92b2('0x67')));}});},'VoiceQueuesChannels':function(_0x2ebf05){return new Promise(function(_0x3f94ec,_0x142377){var _0x2bb502=_[_0x92b2('0x58')](_0x16c1b0['queueChannels']);_0x3f94ec({'count':_0x2bb502[_0x92b2('0x55')],'rows':_0x2bb502});});},'VoiceQueuesChannel':function(_0x3a2ea5){var _0xf14365=this;return new Promise(function(_0x3c3e33,_0x55b6ed){var _0x4f2c30=schema(properties[_0x92b2('0x70')])[_0x92b2('0x2')](_0x3a2ea5);if(_0x4f2c30[_0x92b2('0x55')]>0x0){return _0x55b6ed(_0xf14365['error'](0x1f4,_[_0x92b2('0x68')](_0x4f2c30,_0x92b2('0x19'))[_0x92b2('0x15')](',\x20')));}var _0x18edcd=_[_0x92b2('0x56')](_0x16c1b0[_0x92b2('0x71')],{'uniqueid':_0x3a2ea5[_0x92b2('0x5c')]});if(_0x18edcd){_0x3c3e33(_0x18edcd);}else{return _0x55b6ed(_0xf14365[_0x92b2('0x12')](0x1f5,_0x92b2('0x67')));}});},'VoiceQueuesChannelHangup':function(_0x1df280){var _0x774af7=this;return new Promise(function(_0x2f970b,_0x1710f0){if(ami[_0x92b2('0x11')]()==![]){return _0x1710f0(_0x774af7[_0x92b2('0x12')](0x1f4,[config[_0x92b2('0x13')]['ip'],config[_0x92b2('0x13')][_0x92b2('0x1b')],_0x92b2('0x14')][_0x92b2('0x15')]('\x20')));}var _0x116c26=schema(properties[_0x92b2('0x72')])['validate'](_0x1df280);if(_0x116c26['length']>0x0){return _0x1710f0(_0x774af7['error'](0x1f4,_['map'](_0x116c26,_0x92b2('0x19'))[_0x92b2('0x15')](',\x20')));}var _0xca863=_['find'](_0x16c1b0[_0x92b2('0x71')],{'uniqueid':_0x1df280[_0x92b2('0x5c')]});if(_0xca863&&_0xca863[_0x92b2('0x6c')]){return ami[_0x92b2('0x18')]({'action':'Hangup','channel':_0xca863[_0x92b2('0x6c')]})[_0x92b2('0x1e')](function(_0x187dbb){_0x2f970b({'code':0xc8,'message':[_0x1df280[_0x92b2('0x5c')],_0x187dbb[_0x92b2('0x19')][_0x92b2('0x60')]()][_0x92b2('0x15')]('\x20')});})[_0x92b2('0x1a')](function(_0x8fcd9a){_0x1710f0(_0x774af7[_0x92b2('0x12')](0x1f5,[_0x1df280['uniqueid'],_0x8fcd9a[_0x92b2('0x19')][_0x92b2('0x60')]()]['join']('\x20')));});}else{return _0x1710f0(_0x774af7[_0x92b2('0x12')](0x1f5,_0x92b2('0x67')));}});},'VoiceQueuesChannelRedirect':function(_0x39f2c8){var _0xc6be47=this;return new Promise(function(_0x9c143c,_0x3cda7a){if(ami[_0x92b2('0x11')]()==![]){return _0x3cda7a(_0xc6be47[_0x92b2('0x12')](0x1f4,[config[_0x92b2('0x13')]['ip'],config[_0x92b2('0x13')][_0x92b2('0x1b')],_0x92b2('0x14')][_0x92b2('0x15')]('\x20')));}var _0x361cad=schema(properties[_0x92b2('0x73')])[_0x92b2('0x2')](_0x39f2c8);if(_0x361cad[_0x92b2('0x55')]>0x0){return _0x3cda7a(_0xc6be47['error'](0x1f4,_[_0x92b2('0x68')](_0x361cad,_0x92b2('0x19'))[_0x92b2('0x15')](',\x20')));}var _0x125851=_['find'](_0x16c1b0['queueChannels'],{'uniqueid':_0x39f2c8[_0x92b2('0x5c')]});if(_0x125851&&_0x125851['channel']){return ami[_0x92b2('0x18')]({'action':_0x92b2('0x74'),'channel':_0x125851[_0x92b2('0x6c')],'exten':_0x39f2c8[_0x92b2('0x75')],'context':_0x39f2c8[_0x92b2('0x76')]||_0x125851[_0x92b2('0x76')],'priority':0x1})[_0x92b2('0x1e')](function(_0x3d68b0){_0x9c143c({'code':0xc8,'message':[_0x39f2c8['uniqueid'],_0x3d68b0[_0x92b2('0x19')][_0x92b2('0x60')]()]['join']('\x20')});})[_0x92b2('0x1a')](function(_0x5dddec){_0x3cda7a(_0xc6be47[_0x92b2('0x12')](0x1f5,[_0x39f2c8['uniqueid'],_0x5dddec[_0x92b2('0x19')][_0x92b2('0x60')]()][_0x92b2('0x15')]('\x20')));});}else{return _0x3cda7a(_0xc6be47[_0x92b2('0x12')](0x1f5,_0x92b2('0x67')));}});},'Agents':function(_0xa8f72a){return new Promise(function(_0x2e5c07,_0x230506){var _0x4f1691=_[_0x92b2('0x58')](_0x16c1b0['agents']);_0x2e5c07({'count':_0x4f1691[_0x92b2('0x55')],'rows':_0x4f1691});});},'Telephones':function(_0x14321d){return new Promise(function(_0x2dfbb1,_0x55591){var _0x2f8308=_[_0x92b2('0x58')](_0x16c1b0[_0x92b2('0x77')]);_0x2dfbb1({'count':_0x2f8308['length'],'rows':_0x2f8308});});},'Trunks':function(_0xed7f70){return new Promise(function(_0xb35ba8,_0x29e9dd){var _0x251a11=_['values'](_0x16c1b0[_0x92b2('0x78')]);_0xb35ba8({'count':_0x251a11['length'],'rows':_0x251a11});});},'OutboundChannels':function(_0x3893ec){return new Promise(function(_0x11315a,_0x39ca7c){var _0x1cdce0=_[_0x92b2('0x58')](_0x16c1b0[_0x92b2('0x79')]);_0x11315a({'count':_0x1cdce0[_0x92b2('0x55')],'rows':_0x1cdce0});});},'Outbound':function(_0x254a11){return new Promise(function(_0x323d76,_0x5e9e49){_0x323d76(_0x16c1b0[_0x92b2('0x2a')]);});},'Campaigns':function(_0x7a3c04){return new Promise(function(_0x484b82,_0x382713){var _0x4bcb71=_[_0x92b2('0x58')](_0x16c1b0[_0x92b2('0x7a')]);_0x484b82({'count':_0x4bcb71[_0x92b2('0x55')],'rows':_0x4bcb71});});},'VoiceQueuesPreview':function(_0x42a0be){var _0x462d02=this;return new Promise(function(_0x56a002,_0x3ff15e){_0x3166e8[_0x92b2('0x7b')](_0x42a0be['id'])[_0x92b2('0x1e')](function(_0x36c190){_0x56a002({'code':0xc8,'message':_0x36c190[_0x92b2('0x19')]});})['catch'](function(_0x1ea1ff){_0x3ff15e(_0x462d02[_0x92b2('0x12')](0x1f4,_0x1ea1ff[_0x92b2('0x19')]));});});},'EventManager':function(_0x42b87b){var _0x14ae16=this;return new Promise(function(_0x23e666,_0x382ce0){if(!_0x42b87b[_0x92b2('0x7c')]){return _0x382ce0(_0x14ae16[_0x92b2('0x12')](0x1f4,_0x92b2('0x7d')));}ami['emit'](_0x92b2('0x7e')+_0x42b87b['event'],_0x42b87b[_0x92b2('0x19')]);_0x23e666({'code':0xc8,'message':_0x42b87b});});},'FaxAccounts':function(_0x32af40){return new Promise(function(_0x5d3db9,_0x3b37c1){var _0x4d7645=_[_0x92b2('0x58')](_0x16c1b0[_0x92b2('0x7f')]);_0x5d3db9({'count':_0x4d7645[_0x92b2('0x55')],'rows':_0x4d7645});});},'SendFax':function(_0x531127){var _0x13162e=this;return new Promise(function(_0x351e4d,_0x33f215){_0x47c522[_0x92b2('0x80')](_0x531127)[_0x92b2('0x1e')](function(_0xc05160){_0x351e4d({'code':0xc8,'message':_0xc05160['message']});})[_0x92b2('0x1a')](function(_0x13edf5){_0x33f215(_0x13162e['error'](0x1f4,_0x13edf5['message']));});});},'CheckAfterSend':function(_0x212999){var _0x3ae16a=this;return new Promise(function(_0xe16e90,_0x40c656){_0x47c522[_0x92b2('0x81')](_0x212999)[_0x92b2('0x1e')](function(_0x5bfa72){_0xe16e90({'code':0xc8,'message':_0x5bfa72[_0x92b2('0x19')]});})[_0x92b2('0x1a')](function(_0x294415){_0x40c656(_0x3ae16a[_0x92b2('0x12')](0x1f4,_0x294415['message']));});});}};var _0x4e558a=jayson['server'](_0x29f183)[_0x92b2('0x82')]();_0x4e558a['on'](_0x92b2('0x12'),function(_0x37fefc){return _0x536e21(_0x37fefc);});_0x4e558a[_0x92b2('0x7')](0x232a,'127.0.0.1',function(){console['log'](_0x92b2('0x83'),0x232a);return _0xb1d856(_0x92b2('0x84')+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 b567ade..0fa5a14 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 _0x5c12=['bluebird','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','stringify','exec','data1','data2','data5','xmd-contactid','ListId','data3','map','destcalleridnum','firstName','fax','createdAt','scheduledAt','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','phone','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','routeId','calleridnum','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge'];(function(_0x48d46f,_0x561ec3){var _0x24ac3b=function(_0x4ed428){while(--_0x4ed428){_0x48d46f['push'](_0x48d46f['shift']());}};_0x24ac3b(++_0x561ec3);}(_0x5c12,0x188));var _0x25c1=function(_0x4907de,_0x5bbdc6){_0x4907de=_0x4907de-0x0;var _0x482054=_0x5c12[_0x4907de];return _0x482054;};'use strict';var _=require('lodash');var BPromise=require(_0x25c1('0x0'));var Redis=require(_0x25c1('0x1'));var util=require('util');var config=require(_0x25c1('0x2'));var logger=require(_0x25c1('0x3'))(_0x25c1('0x4'));var cmContactRpc=require(_0x25c1('0x5'));config[_0x25c1('0x6')]=_[_0x25c1('0x7')](config[_0x25c1('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x25c1('0x8'))(new Redis(config[_0x25c1('0x6')]));function emit(_0x382922,_0x4ab674,_0x5c69b1,_0x24981c,_0x3b69ba){logger[_0x25c1('0x9')](_0x25c1('0xa'),_0x382922,_0x4ab674['id'],_0x5c69b1,_0x24981c,JSON[_0x25c1('0xb')](_0x3b69ba));io['to'](_0x5c69b1)['emit'](_0x24981c,_0x3b69ba);}exports[_0x25c1('0xc')]=function(_0x41c89d,_0x11a223,_0x81f0f4,_0x2872b2){var _0x5e44e2,_0x196e2f;var _0x401734={};var _0x49fb8e=Number(_0x81f0f4[_0x25c1('0xd')]);var _0x209af5=_0x81f0f4[_0x25c1('0xe')]?Boolean(Number(_0x81f0f4[_0x25c1('0xe')])):![];var _0x5d3d11;var _0x569ef9=![];if(!_['isNil'](_0x81f0f4['data5'])){if(_0x81f0f4[_0x25c1('0xf')]=='1')_0x569ef9=!![];}if(!_0x569ef9){if(_0x2872b2[_0x25c1('0x10')]){_0x401734['id']=_0x2872b2[_0x25c1('0x10')];}}if(!_0x401734['id']){_0x401734[_0x25c1('0x11')]=_0x49fb8e;_0x5d3d11=_0x81f0f4[_0x25c1('0x12')]&&_0x81f0f4['data3']!=='0'?_0x81f0f4[_0x25c1('0x12')]['split'](','):['phone'];_0x401734['$or']=_[_0x25c1('0x13')](_0x5d3d11,function(_0x1a08b5){var _0x4dc64b={};_0x4dc64b[_0x1a08b5]=_0x2872b2['routeId']?_0x2872b2[_0x25c1('0x14')]:_0x2872b2['calleridnum'];return _0x4dc64b;});}var _0x7175d4=['id',_0x25c1('0x15'),'lastName','phone','mobile',_0x25c1('0x16'),_0x25c1('0x11'),_0x25c1('0x17'),_0x25c1('0x18'),'updatedAt'];var _0x119639=_[_0x25c1('0x19')](_0x7175d4,_0x5d3d11);BPromise[_0x25c1('0x1a')]()[_0x25c1('0x1b')](cmContactRpc['getContacts']({'attributes':_0x119639,'where':_0x401734}))['then'](function(_0x2a8a84){_0x196e2f=_0x2a8a84;if(!_[_0x25c1('0x1c')](_0x196e2f)){if(_0x196e2f[_0x25c1('0x1d')]===0x1){_0x5e44e2=_0x196e2f[0x0];logger[_0x25c1('0x9')](_0x25c1('0x1e'),_0x2872b2[_0x25c1('0x1f')],_0x11a223['id'],_0x5e44e2['id']);}else{logger[_0x25c1('0x9')](_0x25c1('0x20'),_0x2872b2[_0x25c1('0x1f')],_0x11a223['id'],_[_0x25c1('0x13')](_0x196e2f,'id')[_0x25c1('0x21')](','));}return;}else{logger[_0x25c1('0x9')](_0x25c1('0x22'),_0x2872b2['uniqueid'],_0x11a223['id']);var _0x2dadae={'ListId':_0x49fb8e};var _0x20dbb9=_0x81f0f4[_0x25c1('0x23')]&&_0x81f0f4[_0x25c1('0x23')]!=='0'?_0x81f0f4[_0x25c1('0x23')]:_0x25c1('0x24');if(_0x209af5){logger['info'](_0x25c1('0x25'),_0x2872b2[_0x25c1('0x1f')],_0x11a223['id']);_0x2dadae[_0x20dbb9]=_[_0x25c1('0x26')](_0x2872b2[_0x25c1('0x27')])?_0x2872b2[_0x25c1('0x28')]:_0x2872b2[_0x25c1('0x14')];if(_['isNil'](_0x2872b2[_0x25c1('0x27')])){_0x2dadae['firstName']=_0x2872b2[_0x25c1('0x29')]&&_0x2872b2[_0x25c1('0x29')]!==_0x25c1('0x2a')?_0x2872b2[_0x25c1('0x29')]:_0x25c1('0x2b');}else{_0x2dadae[_0x25c1('0x15')]=_0x2872b2[_0x25c1('0x2c')]&&_0x2872b2[_0x25c1('0x2c')]!==_0x25c1('0x2a')?_0x2872b2['destcalleridname']:_0x25c1('0x2b');}return BPromise['resolve']()['then'](cmContactRpc[_0x25c1('0x2d')](_0x2dadae))[_0x25c1('0x1b')](function(_0x4ef790){_0x5e44e2=_0x4ef790;_0x196e2f[_0x25c1('0x2e')](_0x4ef790);if(_0x5e44e2){logger['info'](_0x25c1('0x2f'),_0x2872b2['uniqueid'],_0x11a223['id'],_0x5e44e2['id']);}return;});}else{logger[_0x25c1('0x9')](_0x25c1('0x30'),_0x2872b2[_0x25c1('0x1f')],_0x11a223['id']);_0x2dadae[_0x20dbb9]=_[_0x25c1('0x26')](_0x2872b2[_0x25c1('0x27')])?_0x2872b2[_0x25c1('0x28')]:_0x2872b2[_0x25c1('0x14')];if(_[_0x25c1('0x26')](_0x2872b2['routeId'])){_0x2dadae[_0x25c1('0x15')]=_0x2872b2['calleridname']&&_0x2872b2[_0x25c1('0x29')]!==''?_0x2872b2[_0x25c1('0x29')]:_0x25c1('0x2b');}else{_0x2dadae[_0x25c1('0x15')]=_0x2872b2[_0x25c1('0x2c')]&&_0x2872b2[_0x25c1('0x2c')]!==_0x25c1('0x2a')?_0x2872b2[_0x25c1('0x2c')]:_0x25c1('0x2b');}_0x5e44e2=_0x2dadae;_0x196e2f[_0x25c1('0x2e')](_0x2dadae);return;}}})[_0x25c1('0x1b')](function(){if(_0x41c89d){emit(_0x2872b2[_0x25c1('0x1f')],_0x11a223,util[_0x25c1('0x31')](_0x25c1('0x32'),_0x41c89d[_0x25c1('0x33')]),util[_0x25c1('0x31')](_0x25c1('0x34'),_0x81f0f4[_0x25c1('0x35')][_0x25c1('0x36')]()),{'evt':_[_0x25c1('0x37')](_0x2872b2,{'autoCreate':_0x209af5}),'contact':_0x5e44e2===undefined?{}:_0x5e44e2,'contacts':_0x196e2f[_0x25c1('0x1d')]===0x0?undefined:_0x196e2f});}});}; \ No newline at end of file +var _0xac9d=['updatedAt','resolve','then','getContacts','isEmpty','length','info','[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','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','routeId','format','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','localhost','socket.io-emitter','redis','[CM][%s][%s]','stringify','emit','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','destcalleridnum','calleridnum','firstName','lastName','mobile','createdAt','scheduledAt'];(function(_0x1e1970,_0x42a940){var _0x2d232c=function(_0x2006f6){while(--_0x2006f6){_0x1e1970['push'](_0x1e1970['shift']());}};_0x2d232c(++_0x42a940);}(_0xac9d,0x14d));var _0xdac9=function(_0x4257b6,_0x2348c7){_0x4257b6=_0x4257b6-0x0;var _0x4ad68c=_0xac9d[_0x4257b6];return _0x4ad68c;};'use strict';var _=require(_0xdac9('0x0'));var BPromise=require(_0xdac9('0x1'));var Redis=require(_0xdac9('0x2'));var util=require(_0xdac9('0x3'));var config=require(_0xdac9('0x4'));var logger=require(_0xdac9('0x5'))(_0xdac9('0x6'));var cmContactRpc=require(_0xdac9('0x7'));config['redis']=_[_0xdac9('0x8')](config['redis'],{'host':_0xdac9('0x9'),'port':0x18eb});var io=require(_0xdac9('0xa'))(new Redis(config[_0xdac9('0xb')]));function emit(_0x776b6c,_0x1c78c5,_0x39f560,_0x5531af,_0x2b1d6f){logger['info'](_0xdac9('0xc'),_0x776b6c,_0x1c78c5['id'],_0x39f560,_0x5531af,JSON[_0xdac9('0xd')](_0x2b1d6f));io['to'](_0x39f560)[_0xdac9('0xe')](_0x5531af,_0x2b1d6f);}exports[_0xdac9('0xf')]=function(_0x23ec14,_0x2859bf,_0x255627,_0x1b604a){var _0xbb5615,_0x5514c5;var _0x37b316={};var _0x43e0a5=Number(_0x255627['data1']);var _0x3d8e97=_0x255627[_0xdac9('0x10')]?Boolean(Number(_0x255627[_0xdac9('0x10')])):![];var _0x4b2436;var _0x16063f=![];if(!_[_0xdac9('0x11')](_0x255627[_0xdac9('0x12')])){if(_0x255627['data5']=='1')_0x16063f=!![];}if(!_0x16063f){if(_0x1b604a['xmd-contactid']){_0x37b316['id']=_0x1b604a[_0xdac9('0x13')];}}if(!_0x37b316['id']){_0x37b316[_0xdac9('0x14')]=_0x43e0a5;_0x4b2436=_0x255627['data3']&&_0x255627[_0xdac9('0x15')]!=='0'?_0x255627[_0xdac9('0x15')][_0xdac9('0x16')](','):[_0xdac9('0x17')];_0x37b316[_0xdac9('0x18')]=_[_0xdac9('0x19')](_0x4b2436,function(_0x34a85a){var _0xec1016={};_0xec1016[_0x34a85a]=_0x1b604a['routeId']?_0x1b604a[_0xdac9('0x1a')]:_0x1b604a[_0xdac9('0x1b')];return _0xec1016;});}var _0x571e07=['id',_0xdac9('0x1c'),_0xdac9('0x1d'),_0xdac9('0x17'),_0xdac9('0x1e'),'fax','ListId',_0xdac9('0x1f'),_0xdac9('0x20'),_0xdac9('0x21')];var _0x395ec7=_['union'](_0x571e07,_0x4b2436);BPromise[_0xdac9('0x22')]()[_0xdac9('0x23')](cmContactRpc[_0xdac9('0x24')]({'attributes':_0x395ec7,'where':_0x37b316}))[_0xdac9('0x23')](function(_0xe7bd10){_0x5514c5=_0xe7bd10;if(!_[_0xdac9('0x25')](_0x5514c5)){if(_0x5514c5[_0xdac9('0x26')]===0x1){_0xbb5615=_0x5514c5[0x0];logger[_0xdac9('0x27')](_0xdac9('0x28'),_0x1b604a[_0xdac9('0x29')],_0x2859bf['id'],_0xbb5615['id']);}else{logger['info'](_0xdac9('0x2a'),_0x1b604a[_0xdac9('0x29')],_0x2859bf['id'],_[_0xdac9('0x19')](_0x5514c5,'id')[_0xdac9('0x2b')](','));}return;}else{logger['info'](_0xdac9('0x2c'),_0x1b604a['uniqueid'],_0x2859bf['id']);var _0x3ce475={'ListId':_0x43e0a5};var _0x2fce71=_0x255627['data4']&&_0x255627[_0xdac9('0x2d')]!=='0'?_0x255627['data4']:_0xdac9('0x17');if(_0x3d8e97){logger[_0xdac9('0x27')](_0xdac9('0x2e'),_0x1b604a[_0xdac9('0x29')],_0x2859bf['id']);_0x3ce475[_0x2fce71]=_['isNil'](_0x1b604a['routeId'])?_0x1b604a[_0xdac9('0x1b')]:_0x1b604a[_0xdac9('0x1a')];if(_['isNil'](_0x1b604a['routeId'])){_0x3ce475[_0xdac9('0x1c')]=_0x1b604a[_0xdac9('0x2f')]&&_0x1b604a[_0xdac9('0x2f')]!==_0xdac9('0x30')?_0x1b604a[_0xdac9('0x2f')]:_0xdac9('0x31');}else{_0x3ce475[_0xdac9('0x1c')]=_0x1b604a[_0xdac9('0x32')]&&_0x1b604a[_0xdac9('0x32')]!==_0xdac9('0x30')?_0x1b604a[_0xdac9('0x32')]:_0xdac9('0x31');}return BPromise[_0xdac9('0x22')]()[_0xdac9('0x23')](cmContactRpc[_0xdac9('0x33')](_0x3ce475))[_0xdac9('0x23')](function(_0x372f02){_0xbb5615=_0x372f02;_0x5514c5[_0xdac9('0x34')](_0x372f02);if(_0xbb5615){logger[_0xdac9('0x27')](_0xdac9('0x35'),_0x1b604a[_0xdac9('0x29')],_0x2859bf['id'],_0xbb5615['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0x1b604a[_0xdac9('0x29')],_0x2859bf['id']);_0x3ce475[_0x2fce71]=_[_0xdac9('0x11')](_0x1b604a[_0xdac9('0x36')])?_0x1b604a[_0xdac9('0x1b')]:_0x1b604a[_0xdac9('0x1a')];if(_['isNil'](_0x1b604a[_0xdac9('0x36')])){_0x3ce475['firstName']=_0x1b604a[_0xdac9('0x2f')]&&_0x1b604a[_0xdac9('0x2f')]!==''?_0x1b604a[_0xdac9('0x2f')]:'Unknown';}else{_0x3ce475['firstName']=_0x1b604a[_0xdac9('0x32')]&&_0x1b604a[_0xdac9('0x32')]!==_0xdac9('0x30')?_0x1b604a[_0xdac9('0x32')]:_0xdac9('0x31');}_0xbb5615=_0x3ce475;_0x5514c5[_0xdac9('0x34')](_0x3ce475);return;}}})['then'](function(){if(_0x23ec14){emit(_0x1b604a[_0xdac9('0x29')],_0x2859bf,util[_0xdac9('0x37')]('user:%s',_0x23ec14[_0xdac9('0x38')]),util[_0xdac9('0x37')](_0xdac9('0x39'),_0x255627[_0xdac9('0x3a')][_0xdac9('0x3b')]()),{'evt':_[_0xdac9('0x3c')](_0x1b604a,{'autoCreate':_0x3d8e97}),'contact':_0xbb5615===undefined?{}:_0xbb5615,'contacts':_0x5514c5[_0xdac9('0x26')]===0x0?undefined:_0x5514c5});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 27df955..cfddef0 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 _0xaa2d=['browser','data1','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data4','location','data5','800','windowHeight','data6','winApplication','winArguments','data3','emit','format','user:%s','name','jscripty','trigger:%s','merge','exec','routeId','urlforward','script','parse','query','search','replace','channel','AllConditions','every','checkConditions','AnyConditions','some','account','ChatWebsiteId','operator','value','upperFirst','AccountId','event','queue','membername','lastevent','exports','lodash','./urlforward','./integration','./cmContact','../../../config/environment','../../../config/logger','trigger','defaults','localhost','socket.io-emitter','redis','popup','url','winapp','triggers','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:amd','custom:timeout','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','prototype','info','stringify','clone','motionChannel','undefined','voice','interface','checkTriggers','hasOwnProperty','status','checkTrigger','variables','Actions','length','agents','action','toLowerCase','contactmanager'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa2d,0x11c));var _0xdaa2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa2d[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0xdaa2('0x0'));var url=require('url');var Mustache=require('mustache');var Redis=require('ioredis');var urlforward=require(_0xdaa2('0x1'));var integration=require(_0xdaa2('0x2'));var cmContact=require(_0xdaa2('0x3'));var script=require('./script');var config=require(_0xdaa2('0x4'));var logger=require(_0xdaa2('0x5'))(_0xdaa2('0x6'));var ami=require('../ami');config['redis']=_[_0xdaa2('0x7')](config['redis'],{'host':_0xdaa2('0x8'),'port':0x18eb});var io=require(_0xdaa2('0x9'))(new Redis(config[_0xdaa2('0xa')]));var operators={'equals':function(_0x4b10b2,_0x14d570){return _0x4b10b2==_0x14d570;},'not_equals':function(_0x4437cc,_0x464c8c){return _0x4437cc!=_0x464c8c;}};var barAndWebActions=[_0xdaa2('0xb'),_0xdaa2('0xc'),_0xdaa2('0xd')];function Trigger(_0x4d9fca){this['triggers']=_0x4d9fca[_0xdaa2('0xe')];this['agents']=_0x4d9fca['agents'];this['voiceQueues']=_0x4d9fca[_0xdaa2('0xf')];this[_0xdaa2('0x10')]=_0x4d9fca['templates'];this[_0xdaa2('0x11')]=_0x4d9fca[_0xdaa2('0x11')];this[_0xdaa2('0x12')]=_0x4d9fca[_0xdaa2('0x12')];this[_0xdaa2('0x13')]=_0x4d9fca[_0xdaa2('0x13')];this[_0xdaa2('0x14')]=_0x4d9fca[_0xdaa2('0x14')];this[_0xdaa2('0x15')]=_0x4d9fca[_0xdaa2('0x15')];this[_0xdaa2('0x16')]=_0x4d9fca[_0xdaa2('0x16')];this[_0xdaa2('0x17')]=_0x4d9fca[_0xdaa2('0x17')];this[_0xdaa2('0x18')]=_0x4d9fca[_0xdaa2('0x18')];this['servicenowAccounts']=_0x4d9fca[_0xdaa2('0x19')];this['dynamics365Accounts']=_0x4d9fca[_0xdaa2('0x1a')];this['freshsalesAccounts']=_0x4d9fca[_0xdaa2('0x1b')];this[_0xdaa2('0x1c')]={'zendesk':this[_0xdaa2('0x12')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0xdaa2('0x13')],'sugarcrm':this[_0xdaa2('0x15')],'zoho':this[_0xdaa2('0x16')],'desk':this[_0xdaa2('0x17')],'vtiger':this[_0xdaa2('0x18')],'dynamics365':this[_0xdaa2('0x1a')],'freshsales':this[_0xdaa2('0x1b')],'servicenow':this[_0xdaa2('0x19')]};ami['on']('custom:agentcalled',this[_0xdaa2('0x1d')][_0xdaa2('0x1e')](this));ami['on'](_0xdaa2('0x1f'),this[_0xdaa2('0x1d')]['bind'](this));ami['on'](_0xdaa2('0x20'),this['syncCustomEvent'][_0xdaa2('0x1e')](this));ami['on'](_0xdaa2('0x21'),this[_0xdaa2('0x1d')][_0xdaa2('0x1e')](this));ami['on'](_0xdaa2('0x22'),this[_0xdaa2('0x1d')][_0xdaa2('0x1e')](this));ami['on'](_0xdaa2('0x23'),this['syncCustomEvent'][_0xdaa2('0x1e')](this));ami['on'](_0xdaa2('0x24'),this['syncCustomEvent'][_0xdaa2('0x1e')](this));ami['on'](_0xdaa2('0x25'),this[_0xdaa2('0x1d')][_0xdaa2('0x1e')](this));ami['on']('custom:agentreject',this[_0xdaa2('0x1d')][_0xdaa2('0x1e')](this));ami['on'](_0xdaa2('0x26'),this['syncCustomEvent']['bind'](this));ami['on']('custom:queuecallerabandon',this['syncCustomEvent'][_0xdaa2('0x1e')](this));ami['on'](_0xdaa2('0x27'),this[_0xdaa2('0x1d')][_0xdaa2('0x1e')](this));ami['on']('custom:dialbegin',this[_0xdaa2('0x28')]['bind'](this));ami['on']('custom:dialconnect',this[_0xdaa2('0x28')][_0xdaa2('0x1e')](this));ami['on'](_0xdaa2('0x29'),this[_0xdaa2('0x28')]['bind'](this));ami['on'](_0xdaa2('0x2a'),this[_0xdaa2('0x1d')]['bind'](this));ami['on'](_0xdaa2('0x2b'),this[_0xdaa2('0x1d')]['bind'](this));ami['on'](_0xdaa2('0x2c'),this[_0xdaa2('0x1d')][_0xdaa2('0x1e')](this));ami['on'](_0xdaa2('0x2d'),this['syncCustomEvent'][_0xdaa2('0x1e')](this));ami['on'](_0xdaa2('0x2e'),this['syncCustomEvent'][_0xdaa2('0x1e')](this));ami['on'](_0xdaa2('0x2f'),this['syncCustomEvent']['bind'](this));ami['on']('custom:rejectmessage',this[_0xdaa2('0x1d')][_0xdaa2('0x1e')](this));}Trigger[_0xdaa2('0x30')]['emit']=function(_0x5a653b,_0x23d3c8,_0x54aad4){logger[_0xdaa2('0x31')](_0x5a653b,_0x23d3c8,JSON[_0xdaa2('0x32')](_0x54aad4));io['to'](_0x5a653b)['emit'](_0x23d3c8,_0x54aad4);};Trigger[_0xdaa2('0x30')][_0xdaa2('0x1d')]=function(_0x7cc9ca){var _0xf7580e=_[_0xdaa2('0x33')](_0x7cc9ca);if(typeof _0xf7580e[_0xdaa2('0x34')]===_0xdaa2('0x35')){_0xf7580e[_0xdaa2('0x34')]=_0xdaa2('0x36');}this['checkTriggers'](_0xf7580e);};Trigger[_0xdaa2('0x30')][_0xdaa2('0x28')]=function(_0x4cbdfc){if(this['agents'][_0x4cbdfc[_0xdaa2('0x37')]]){this[_0xdaa2('0x1d')](_0x4cbdfc);}};Trigger[_0xdaa2('0x30')][_0xdaa2('0x38')]=function(_0x1e0011){var _0x248899;for(var _0x38dfa0 in this['triggers']){if(this[_0xdaa2('0xe')][_0xdaa2('0x39')](_0x38dfa0)){if(this[_0xdaa2('0xe')][_0x38dfa0][_0xdaa2('0x3a')]){_0x248899=this[_0xdaa2('0x3b')](this[_0xdaa2('0xe')][_0x38dfa0],_0x1e0011);if(_0x248899){_['merge'](_0x1e0011,_0x1e0011[_0xdaa2('0x3c')]);for(var _0x3cc32a=0x0,_0x4afa1b,_0x120333,_0x205c1c;_0x3cc32a0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file +var _0x9957=['Motion','CTI','concat','Tags','/api/v2/users/%d','Descriptions','%s/customers/%d/cases','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','Desk\x20account\x20type\x20not\x20recognized','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','integrationTab','newTab','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','The\x20Ticket\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','desk','defaults','redis','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','remoteUri','then','total_entries','find','_embedded','entries','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','[HTTP]','stringify','GET','password','authType','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','variable','variableName','customVariable','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x4e47b4,_0x2c59aa){var _0xc20578=function(_0x282f87){while(--_0x282f87){_0x4e47b4['push'](_0x4e47b4['shift']());}};_0xc20578(++_0x2c59aa);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var md5=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));config['redis']=_[_0x7995('0x8')](config[_0x7995('0x9')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x9')]));function emit(_0x326741,_0x4996ca,_0x465276){io['to'](_0x326741)[_0x7995('0xc')](_0x4996ca,_0x465276);}var headers={'Content-Type':'application/json','Accept':_0x7995('0xd')};function getUser(_0x3116fb,_0x18c8a3){if(intUtil[_0x7995('0xe')](_0x18c8a3)===!![]){logger[_0x7995('0xf')](_0x7995('0x10'),_0x18c8a3);return request({'uri':util[_0x7995('0x11')]('%s/users',_0x3116fb[_0x7995('0x12')])})[_0x7995('0x13')](function(_0x581f22){if(_0x581f22[_0x7995('0x14')]){return _[_0x7995('0x15')](_0x581f22[_0x7995('0x16')][_0x7995('0x17')],{'email':_0x18c8a3});}})[_0x7995('0x13')](function(_0x23999f){if(_0x23999f){logger[_0x7995('0xf')]('Agent\x20found!');return _0x23999f;}else{logger['info'](_0x7995('0x18'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb[_0x7995('0x12')])});}});}else{logger[_0x7995('0xf')](_0x7995('0x1a'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb['remoteUri'])});}}function request(_0x2eeacc){logger['debug'](_0x7995('0x1b'),JSON[_0x7995('0x1c')](_0x2eeacc));return rp(_[_0x7995('0x8')](_0x2eeacc,{'method':_0x7995('0x1d'),'headers':headers,'json':!![]}));}function getAuth(_0x1e1415){var _0x37a7d4;if(_0x1e1415['authType']==='basic'){_0x37a7d4=util[_0x7995('0x11')]('%s:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x1e')]);}else if(_0x1e1415[_0x7995('0x1f')]==='token'){_0x37a7d4=util[_0x7995('0x11')]('%s/token:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x20')]);}return util[_0x7995('0x11')](_0x7995('0x21'),new Buffer(_0x37a7d4)[_0x7995('0x22')](_0x7995('0x23')));}function getEndUser(_0x1c278a,_0x5d40ae,_0x32a09a){logger[_0x7995('0xf')](_0x7995('0x24'),_0x32a09a);return request({'uri':util[_0x7995('0x11')](_0x7995('0x25'),_0x1c278a[_0x7995('0x12')]),'qs':{'phone':_0x32a09a}})[_0x7995('0x13')](function(_0x472195){if(_0x472195['total_entries']){logger[_0x7995('0xf')](_0x7995('0x26'));return _0x472195[_0x7995('0x16')][_0x7995('0x17')][0x0];}else{logger[_0x7995('0xf')](_0x7995('0x27'));return request({'uri':util['format'](_0x7995('0x28'),_0x1c278a['remoteUri']),'method':_0x7995('0x29'),'body':{'first_name':_0x5d40ae,'title':_0x5d40ae,'phone_numbers':[{'type':_0x7995('0x2a'),'value':_0x32a09a}]}});}});}function getTags(_0xf16cc2,_0x132a42){var _0x11c1eb=[];if(_0xf16cc2&&_0xf16cc2['length']>0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ 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 160d0b4..ee52483 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 _0x5092=['incidents','assign','getString','Descriptions','/contacts(','Fields','phonecall','phonecalls','callDirection','queue','odata-entityid','lastIndexOf','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','serverUrl','stripTrailingSlash','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','dynamics365','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','access_token','catch','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','then','value','isNil','validateEmail','userEmail','email','length','isdisabled','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','internalemailaddress','toLowerCase','outbound','destcalleridnum','contacts','/systemusers(','Bearer\x20','headers','calleridnum','replace','telephone1','enduserId','contactid','info',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','customField','idField','substring','indexOf','content','ticketType','incident'];(function(_0x21d9e9,_0x2faa8d){var _0x35ddaa=function(_0x52c252){while(--_0x52c252){_0x21d9e9['push'](_0x21d9e9['shift']());}};_0x35ddaa(++_0x2faa8d);}(_0x5092,0x147));var _0x2509=function(_0xf9b435,_0x7b10e9){_0xf9b435=_0xf9b435-0x0;var _0x4583cb=_0x5092[_0xf9b435];return _0x4583cb;};'use strict';var _=require(_0x2509('0x0'));var BPromise=require(_0x2509('0x1'));var rp=require(_0x2509('0x2'));var util=require(_0x2509('0x3'));var intUtil=require('./util');var md5=require(_0x2509('0x4'));var Redis=require(_0x2509('0x5'));var logger=require('../../../../config/logger')(_0x2509('0x6'));var config=require('../../../../config/environment');config[_0x2509('0x7')]=_['defaults'](config[_0x2509('0x7')],{'host':_0x2509('0x8'),'port':0x18eb});var io=require(_0x2509('0x9'))(new Redis(config['redis']));function getAuthToken(_0x109519,_0x317faa,_0x14e9bc){var _0x533a4e={'method':_0x2509('0xa'),'uri':_0x317faa,'form':{'client_id':_0x109519[_0x2509('0xb')],'resource':_0x109519[_0x2509('0xc')],'username':_0x109519['username'],'password':_0x109519['password'],'grant_type':'password','client_secret':_0x109519['clientSecret']},'json':!![]};return rp(_0x533a4e)['then'](function(_0x32c754){return _0x32c754[_0x2509('0xd')];})[_0x2509('0xe')](function(_0xcb6943){logger['error']('['+[_0x14e9bc['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0xcb6943[_0x2509('0xf')];});}function getUser(_0x52ac73,_0x37fc98,_0x186486,_0x20b733,_0x1bac22,_0x555d99){return new BPromise(function(_0x3950a2,_0x406c6c){return getAuthToken(_0x37fc98,_0x20b733,_0x555d99)['then'](function(_0x5e8c12){var _0x5f13af={'method':_0x2509('0x10'),'uri':_0x1bac22+_0x2509('0x11'),'headers':{'Authorization':'Bearer\x20'+_0x5e8c12,'OData-Version':_0x2509('0x12')},'json':!![]};return rp(_0x5f13af);})[_0x2509('0x13')](function(_0x5f3801){var _0x2ed018=_0x5f3801[_0x2509('0x14')];var _0x1a2ecd=![];var _0x2464c9=null;if(!_[_0x2509('0x15')](_0x186486)){if(intUtil[_0x2509('0x16')](_0x186486['email'])){_0x52ac73[_0x2509('0x17')]=_0x186486[_0x2509('0x18')];for(_0x2464c9=0x0;_0x2464c9<_0x2ed018[_0x2509('0x19')];_0x2464c9++){if(_0x2ed018[_0x2464c9]['internalemailaddress']===_0x186486[_0x2509('0x18')]&&!_0x2ed018[_0x2464c9][_0x2509('0x1a')]){_0x1a2ecd=!![];logger['info']('['+[_0x555d99[_0x2509('0x1b')]()]+_0x2509('0x1c')+_0x2ed018[_0x2464c9][_0x2509('0x1d')]+'!');_0x52ac73[_0x2509('0x1e')]=_0x2ed018[_0x2464c9][_0x2509('0x1d')];}}}}if(!_0x1a2ecd){logger['info']('['+[_0x555d99[_0x2509('0x1b')]()]+_0x2509('0x1f'));_0x52ac73[_0x2509('0x17')]=_0x37fc98[_0x2509('0x20')];for(_0x2464c9=0x0;_0x2464c9<_0x2ed018[_0x2509('0x19')];_0x2464c9++){if(_0x2ed018[_0x2464c9][_0x2509('0x21')]===_0x37fc98['username']){_0x52ac73[_0x2509('0x1e')]=_0x2ed018[_0x2464c9][_0x2509('0x1d')];}}}_0x3950a2(_0x52ac73);})[_0x2509('0xe')](function(_0x561db6){_0x406c6c(_0x561db6[_0x2509('0xf')]);});});}function createEndUser(_0x27f6e0,_0x4d1982,_0x16b091,_0x31d7cd,_0x2722da,_0x3618f4){return new BPromise(function(_0x254ff1,_0x3ca243){return getAuthToken(_0x4d1982,_0x16b091,_0x3618f4)[_0x2509('0x13')](function(_0x88da33){var _0x431d5f=_0x3618f4[_0x2509('0x22')]()===_0x2509('0x23')?_0x2722da[_0x2509('0x24')]:_0x2722da['calleridnum'];var _0x2a784b={'method':_0x2509('0xa'),'uri':_0x31d7cd+_0x2509('0x25'),'body':{'telephone1':_0x431d5f,'fullname':_0x431d5f,'firstname':_0x431d5f,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x2509('0x26')+_0x27f6e0[_0x2509('0x1e')]+')'},'headers':{'Authorization':_0x2509('0x27')+_0x88da33,'OData-Version':_0x2509('0x12')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x2a784b);})[_0x2509('0x13')](function(_0x45d925){var _0xcb05a0=_0x45d925[_0x2509('0x28')]['odata-entityid'];var _0x3f7608=_0xcb05a0['substring'](_0xcb05a0['lastIndexOf']('(')+0x1,_0xcb05a0['lastIndexOf'](')'));_0x27f6e0['enduserId']=_0x3f7608;_0x254ff1(_0x27f6e0);})['catch'](function(_0x4729b7){_0x3ca243(_0x4729b7[_0x2509('0xf')]);});});}function getEndUser(_0x2b2514,_0x58a7e3,_0x3fe48a,_0x496131,_0x3c3afa,_0x3f01c7){return new BPromise(function(_0x3ea989,_0xd8e4a){var _0x180982=_0x3f01c7[_0x2509('0x22')]()===_0x2509('0x23')?_0x3c3afa[_0x2509('0x24')]:_0x3c3afa[_0x2509('0x29')];return getAuthToken(_0x58a7e3,_0x3fe48a,_0x3f01c7)[_0x2509('0x13')](function(_0x4e9a78){var _0x2ffcf4={'method':'GET','uri':_0x496131+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x180982[_0x2509('0x2a')]('+','%2b')+'\x27','headers':{'Authorization':'Bearer\x20'+_0x4e9a78,'If-None-Match':null,'OData-Version':_0x2509('0x12')},'json':!![]};return rp(_0x2ffcf4);})[_0x2509('0x13')](function(_0x21bb24){var _0x31025a=null;if(_0x21bb24){var _0x325805=_0x21bb24[_0x2509('0x14')];var _0x2fa146=![];for(_0x31025a=0x0;_0x31025a<_0x325805[_0x2509('0x19')];_0x31025a++){if(_0x325805[_0x31025a][_0x2509('0x2b')]===_0x180982){_0x2fa146=!![];_0x2b2514[_0x2509('0x2c')]=_0x325805[_0x31025a][_0x2509('0x2d')];}}if(_0x2fa146){_0x3ea989(_0x2b2514);}else{return createEndUser(_0x2b2514,_0x58a7e3,_0x3fe48a,_0x496131,_0x3c3afa,_0x3f01c7)[_0x2509('0x13')](function(_0x51f146){logger[_0x2509('0x2e')]('['+[_0x3f01c7[_0x2509('0x1b')]()]+_0x2509('0x2f'),_0x51f146['enduserId']);_0x3ea989(_0x51f146);});}}else{return createEndUser(_0x2b2514,_0x58a7e3,_0x3fe48a,_0x496131,_0x3c3afa,_0x3f01c7)[_0x2509('0x13')](function(_0x354e53){logger['info']('['+[_0x3f01c7['toUpperCase']()]+']\x20Enduser\x20Created!',_0x354e53[_0x2509('0x2c')]);_0x3ea989(_0x354e53);});}});});}function getCustomFields(_0x3b76e7,_0x1023ba,_0x23fbd2){var _0x2f3d15={};if(_0x3b76e7[_0x2509('0x19')]>0x0){_[_0x2509('0x30')](_0x3b76e7,function(_0x407431){if(_[_0x2509('0x31')]([_0x2509('0x32'),_0x2509('0x33')],_0x407431[_0x2509('0x34')])&&_0x407431[_0x2509('0x35')]&&!_0x407431[_0x2509('0x36')]){var _0x2e6cc7=_0x407431[_0x2509('0x37')][_0x2509('0x22')]();var _0xa0f2c4=_0x2e6cc7[_0x2509('0x38')](0x0,_0x2e6cc7[_0x2509('0x39')]('_'));var _0x3b0caf=_0x2e6cc7['substring'](_0x2e6cc7[_0x2509('0x39')]('_')+0x1);if(_0xa0f2c4===_0x23fbd2){_0x2f3d15[_0x3b0caf]=_0x407431[_0x2509('0x3a')];}}});}return _0x2f3d15;}function getTicket(_0x459d30,_0x5bb066,_0x242b46,_0x278f5c,_0x37fb64,_0x30b8a2,_0x32286f){return new BPromise(function(_0x2bb966,_0x304c77){var _0xa68e17;return getAuthToken(_0x5bb066,_0x242b46,_0x32286f)[_0x2509('0x13')](function(_0xd948d4){if(_0x30b8a2[_0x2509('0x3b')]===_0x2509('0x3c')){_0xa68e17={'method':_0x2509('0xa'),'uri':_0x278f5c+_0x2509('0x3d'),'body':Object[_0x2509('0x3e')]({},{'title':intUtil['getString'](_0x30b8a2['Subjects'],_0x37fb64,'\x20'),'description':intUtil[_0x2509('0x3f')](_0x30b8a2[_0x2509('0x40')],_0x37fb64,'\x0a'),'customerid_contact@odata.bind':_0x2509('0x41')+_0x459d30[_0x2509('0x2c')]+')','ownerid@odata.bind':_0x2509('0x26')+_0x459d30[_0x2509('0x1e')]+')','caseorigincode':'1'},getCustomFields(_0x30b8a2[_0x2509('0x42')],_0x37fb64,_0x30b8a2[_0x2509('0x3b')])),'headers':{'Authorization':_0x2509('0x27')+_0xd948d4,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x30b8a2['ticketType']===_0x2509('0x43')){_0xa68e17={'method':_0x2509('0xa'),'uri':_0x278f5c+_0x2509('0x44'),'body':Object[_0x2509('0x3e')]({},{'subject':intUtil['getString'](_0x30b8a2['Subjects'],_0x37fb64,'\x20'),'phonenumber':String(_0x37fb64[_0x2509('0x29')]),'description':intUtil['getString'](_0x30b8a2[_0x2509('0x40')],_0x37fb64,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2509('0x41')+_0x459d30['enduserId']+')','ownerid@odata.bind':_0x2509('0x26')+_0x459d30[_0x2509('0x1e')]+')','directioncode':_0x459d30[_0x2509('0x45')]===_0x2509('0x46')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x459d30[_0x2509('0x1e')]+')','participationtypemask':_0x459d30[_0x2509('0x45')]===_0x2509('0x46')?0x2:0x1},{'partyid_contact@odata.bind':_0x2509('0x41')+_0x459d30[_0x2509('0x2c')]+')','participationtypemask':_0x459d30['callDirection']===_0x2509('0x46')?0x1:0x2}]},getCustomFields(_0x30b8a2[_0x2509('0x42')],_0x37fb64,_0x30b8a2['ticketType'])),'headers':{'Authorization':_0x2509('0x27')+_0xd948d4,'OData-Version':_0x2509('0x12')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xa68e17);})[_0x2509('0x13')](function(_0x505927){var _0x2d9d96=_0x505927[_0x2509('0x28')][_0x2509('0x47')];var _0x30228e=_0x2d9d96[_0x2509('0x38')](_0x2d9d96[_0x2509('0x48')]('(')+0x1,_0x2d9d96['lastIndexOf'](')'));_0x459d30[_0x2509('0x49')]=_0x30228e;_0x2bb966(_0x459d30);})[_0x2509('0xe')](function(_0x4bcf1a){_0x304c77(_0x4bcf1a[_0x2509('0xf')]);});});}function emit(_0xa9b699,_0x52e7fc,_0x458e34,_0x5639b4){var _0x13ffef={'uri':util[_0x2509('0x4a')](_0x2509('0x4b'),_0xa9b699,_0x458e34,_0x5639b4)};io['to'](util['format'](_0x2509('0x4c'),_0x52e7fc))[_0x2509('0x4d')](_0x2509('0x4e'),_0x13ffef);}exports['cs']=function(_0x1e146c,_0x20ecf2,_0x112f16,_0x1a3193,_0x2be05e,_0x472c36,_0x56ae36,_0x256d5a){var _0x51e675={};_0x472c36['remoteUri']=intUtil['stripTrailingSlash'](_0x472c36[_0x2509('0xc')]);_0x472c36[_0x2509('0x4f')]=intUtil[_0x2509('0x50')](_0x472c36['serverUrl']);_0x51e675[_0x2509('0x45')]=_0x256d5a===_0x2509('0x46')||_0x256d5a==='unmanaged'?_0x2509('0x46'):_0x2509('0x23');var _0x1d8fd0=util[_0x2509('0x4a')]('%s/api/data/v9.0/',_0x472c36[_0x2509('0xc')]);var _0x493798=util[_0x2509('0x4a')]('https://login.microsoftonline.com/%s/oauth2/token',_0x472c36['tenantId']);var _0x9e70d3=util[_0x2509('0x4a')](_0x2509('0x51'),_0x472c36[_0x2509('0x4f')],_0x20ecf2[_0x2509('0x52')],md5(_0x20ecf2[_0x2509('0x52')]));if(_0x2be05e&&_0x2be05e[_0x2509('0x53')]){logger['info'](_0x2509('0x54'),'Recording\x20is\x20enabled!');_0x20ecf2[_0x2509('0x55')]=_0x9e70d3;}else if(_0x56ae36&&_0x56ae36['recordingFormat']&&_0x56ae36['recordingFormat']!==_0x2509('0x56')){logger[_0x2509('0x2e')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x20ecf2[_0x2509('0x55')]=_0x9e70d3;}else{_0x20ecf2[_0x2509('0x55')]='';}return getUser(_0x51e675,_0x472c36,_0x1a3193,_0x493798,_0x1d8fd0,_0x256d5a)[_0x2509('0x13')](function(_0x3b430a){logger[_0x2509('0x2e')]('['+_0x256d5a[_0x2509('0x1b')]()+_0x2509('0x57'),_0x3b430a['userId']);logger['info']('['+_0x256d5a[_0x2509('0x1b')]()+']\x20The\x20User\x20email\x20is:',_0x3b430a[_0x2509('0x17')]);return getEndUser(_0x3b430a,_0x472c36,_0x493798,_0x1d8fd0,_0x20ecf2,_0x256d5a);})[_0x2509('0x13')](function(_0x268d6e){logger['info']('['+_0x256d5a[_0x2509('0x1b')]()+_0x2509('0x58'),_0x268d6e[_0x2509('0x2c')]);logger[_0x2509('0x2e')]('['+_0x256d5a[_0x2509('0x1b')]()+_0x2509('0x59'),_0x20ecf2[_0x2509('0x29')]);return getTicket(_0x268d6e,_0x472c36,_0x493798,_0x1d8fd0,_0x20ecf2,_0x112f16,_0x256d5a);})['then'](function(_0x558579){logger[_0x2509('0x2e')](util[_0x2509('0x4a')]('['+_0x256d5a['toUpperCase']()+_0x2509('0x5a'),_0x112f16[_0x2509('0x3b')],_0x558579[_0x2509('0x49')]));logger[_0x2509('0x2e')](util[_0x2509('0x4a')]('['+_0x256d5a[_0x2509('0x1b')]()+_0x2509('0x5b'),_0x256d5a));if(_0x256d5a!==_0x2509('0x5c')){logger['info']('['+_0x256d5a[_0x2509('0x1b')]()+']',_0x2509('0x5d'));emit(_0x472c36['remoteUri'],_0x1a3193[_0x2509('0x5e')],_0x112f16[_0x2509('0x3b')],_0x558579[_0x2509('0x49')]);}})[_0x2509('0xe')](function(_0x42bc37){logger['error']('['+_0x256d5a[_0x2509('0x1b')]()+_0x2509('0x5f'),util[_0x2509('0x60')](_0x42bc37,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xf037=['ioredis','../../../../config/logger','dynamics365','redis','localhost','socket.io-emitter','POST','clientId','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','headers','odata-entityid','substring','lastIndexOf','enduserId','%2b','telephone1','contactid','includes','string','picklist','customField','idField','indexOf','content','incident','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','ticketType','phonecall','callDirection','queue','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','remoteUri','stripTrailingSlash','serverUrl','unmanaged','format','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','ticketId','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','md5'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xf037,0xba));var _0x7f03=function(_0xb02766,_0xa37d90){_0xb02766=_0xb02766-0x0;var _0x560e6c=_0xf037[_0xb02766];return _0x560e6c;};'use strict';var _=require(_0x7f03('0x0'));var BPromise=require(_0x7f03('0x1'));var rp=require(_0x7f03('0x2'));var util=require(_0x7f03('0x3'));var intUtil=require(_0x7f03('0x4'));var md5=require(_0x7f03('0x5'));var Redis=require(_0x7f03('0x6'));var logger=require(_0x7f03('0x7'))(_0x7f03('0x8'));var config=require('../../../../config/environment');config[_0x7f03('0x9')]=_['defaults'](config['redis'],{'host':_0x7f03('0xa'),'port':0x18eb});var io=require(_0x7f03('0xb'))(new Redis(config[_0x7f03('0x9')]));function getAuthToken(_0x5f2efc,_0x3b6661,_0x1bd410){var _0x1a5787={'method':_0x7f03('0xc'),'uri':_0x3b6661,'form':{'client_id':_0x5f2efc[_0x7f03('0xd')],'resource':_0x5f2efc['remoteUri'],'username':_0x5f2efc['username'],'password':_0x5f2efc[_0x7f03('0xe')],'grant_type':'password','client_secret':_0x5f2efc[_0x7f03('0xf')]},'json':!![]};return rp(_0x1a5787)[_0x7f03('0x10')](function(_0x8beb1d){return _0x8beb1d[_0x7f03('0x11')];})[_0x7f03('0x12')](function(_0x287f9f){logger[_0x7f03('0x13')]('['+[_0x1bd410[_0x7f03('0x14')]()]+_0x7f03('0x15'));return _0x287f9f[_0x7f03('0x16')];});}function getUser(_0x3b626c,_0x276094,_0xb8257a,_0x38f9e9,_0x153dac,_0xc70c7b){return new BPromise(function(_0x36a877,_0xaf4648){return getAuthToken(_0x276094,_0x38f9e9,_0xc70c7b)['then'](function(_0x12ccec){var _0x78d8c3={'method':_0x7f03('0x17'),'uri':_0x153dac+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x7f03('0x18')+_0x12ccec,'OData-Version':_0x7f03('0x19')},'json':!![]};return rp(_0x78d8c3);})[_0x7f03('0x10')](function(_0x1a86f2){var _0x1da0f3=_0x1a86f2[_0x7f03('0x1a')];var _0x4f87af=![];var _0x535317=null;if(!_[_0x7f03('0x1b')](_0xb8257a)){if(intUtil[_0x7f03('0x1c')](_0xb8257a[_0x7f03('0x1d')])){_0x3b626c[_0x7f03('0x1e')]=_0xb8257a[_0x7f03('0x1d')];for(_0x535317=0x0;_0x535317<_0x1da0f3[_0x7f03('0x1f')];_0x535317++){if(_0x1da0f3[_0x535317][_0x7f03('0x20')]===_0xb8257a[_0x7f03('0x1d')]&&!_0x1da0f3[_0x535317]['isdisabled']){_0x4f87af=!![];logger[_0x7f03('0x21')]('['+[_0xc70c7b['toUpperCase']()]+_0x7f03('0x22')+_0x1da0f3[_0x535317][_0x7f03('0x23')]+'!');_0x3b626c[_0x7f03('0x24')]=_0x1da0f3[_0x535317]['systemuserid'];}}}}if(!_0x4f87af){logger[_0x7f03('0x21')]('['+[_0xc70c7b[_0x7f03('0x14')]()]+_0x7f03('0x25'));_0x3b626c[_0x7f03('0x1e')]=_0x276094[_0x7f03('0x26')];for(_0x535317=0x0;_0x535317<_0x1da0f3['length'];_0x535317++){if(_0x1da0f3[_0x535317][_0x7f03('0x20')]===_0x276094[_0x7f03('0x26')]){_0x3b626c[_0x7f03('0x24')]=_0x1da0f3[_0x535317][_0x7f03('0x23')];}}}_0x36a877(_0x3b626c);})['catch'](function(_0x11a395){_0xaf4648(_0x11a395[_0x7f03('0x16')]);});});}function createEndUser(_0x270c95,_0x4463db,_0x42e21c,_0x346d22,_0x254155,_0x128eb0){return new BPromise(function(_0x4d5112,_0x436495){return getAuthToken(_0x4463db,_0x42e21c,_0x128eb0)[_0x7f03('0x10')](function(_0x564528){var _0xd53092=_0x128eb0[_0x7f03('0x27')]()===_0x7f03('0x28')?_0x254155[_0x7f03('0x29')]:_0x254155[_0x7f03('0x2a')];var _0x4b83e6={'method':_0x7f03('0xc'),'uri':_0x346d22+_0x7f03('0x2b'),'body':{'telephone1':_0xd53092,'fullname':_0xd53092,'firstname':_0xd53092,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x270c95[_0x7f03('0x24')]+')'},'headers':{'Authorization':_0x7f03('0x18')+_0x564528,'OData-Version':_0x7f03('0x19')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x4b83e6);})[_0x7f03('0x10')](function(_0x8a45d){var _0x4baa99=_0x8a45d[_0x7f03('0x2c')][_0x7f03('0x2d')];var _0xdb8f4a=_0x4baa99[_0x7f03('0x2e')](_0x4baa99[_0x7f03('0x2f')]('(')+0x1,_0x4baa99['lastIndexOf'](')'));_0x270c95[_0x7f03('0x30')]=_0xdb8f4a;_0x4d5112(_0x270c95);})['catch'](function(_0x2147fe){_0x436495(_0x2147fe[_0x7f03('0x16')]);});});}function getEndUser(_0x5c40fa,_0x5f0415,_0xf8f2f6,_0xf3ea46,_0x3855c5,_0x259f9e){return new BPromise(function(_0x5ce6c5,_0x2cd56f){var _0x33c408=_0x259f9e[_0x7f03('0x27')]()===_0x7f03('0x28')?_0x3855c5[_0x7f03('0x29')]:_0x3855c5[_0x7f03('0x2a')];return getAuthToken(_0x5f0415,_0xf8f2f6,_0x259f9e)[_0x7f03('0x10')](function(_0x122095){var _0x5e9c7e={'method':_0x7f03('0x17'),'uri':_0xf3ea46+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x33c408['replace']('+',_0x7f03('0x31'))+'\x27','headers':{'Authorization':_0x7f03('0x18')+_0x122095,'If-None-Match':null,'OData-Version':_0x7f03('0x19')},'json':!![]};return rp(_0x5e9c7e);})[_0x7f03('0x10')](function(_0x42c769){var _0x78c0a9=null;if(_0x42c769){var _0x7d7950=_0x42c769[_0x7f03('0x1a')];var _0x2b7233=![];for(_0x78c0a9=0x0;_0x78c0a9<_0x7d7950[_0x7f03('0x1f')];_0x78c0a9++){if(_0x7d7950[_0x78c0a9][_0x7f03('0x32')]===_0x33c408){_0x2b7233=!![];_0x5c40fa[_0x7f03('0x30')]=_0x7d7950[_0x78c0a9][_0x7f03('0x33')];}}if(_0x2b7233){_0x5ce6c5(_0x5c40fa);}else{return createEndUser(_0x5c40fa,_0x5f0415,_0xf8f2f6,_0xf3ea46,_0x3855c5,_0x259f9e)[_0x7f03('0x10')](function(_0x5ee852){logger[_0x7f03('0x21')]('['+[_0x259f9e[_0x7f03('0x14')]()]+']\x20Enduser\x20created!',_0x5ee852[_0x7f03('0x30')]);_0x5ce6c5(_0x5ee852);});}}else{return createEndUser(_0x5c40fa,_0x5f0415,_0xf8f2f6,_0xf3ea46,_0x3855c5,_0x259f9e)[_0x7f03('0x10')](function(_0x36fc7f){logger[_0x7f03('0x21')]('['+[_0x259f9e[_0x7f03('0x14')]()]+']\x20Enduser\x20Created!',_0x36fc7f[_0x7f03('0x30')]);_0x5ce6c5(_0x36fc7f);});}});});}function getCustomFields(_0x5ccf8b,_0x4fe5b9,_0x26f178){var _0x476f67={};if(_0x5ccf8b['length']>0x0){_['forEach'](_0x5ccf8b,function(_0x51b30b){if(_[_0x7f03('0x34')]([_0x7f03('0x35'),_0x7f03('0x36')],_0x51b30b['type'])&&_0x51b30b['nameField']&&!_0x51b30b[_0x7f03('0x37')]){var _0x45743d=_0x51b30b[_0x7f03('0x38')][_0x7f03('0x27')]();var _0x4ac343=_0x45743d[_0x7f03('0x2e')](0x0,_0x45743d['indexOf']('_'));var _0x57d595=_0x45743d[_0x7f03('0x2e')](_0x45743d[_0x7f03('0x39')]('_')+0x1);if(_0x4ac343===_0x26f178){_0x476f67[_0x57d595]=_0x51b30b[_0x7f03('0x3a')];}}});}return _0x476f67;}function getTicket(_0x11ae3b,_0x3e0dc3,_0x38883f,_0x3ff71d,_0x9b4a09,_0x5c3aea,_0x2e8a5f){return new BPromise(function(_0x49f1fd,_0x23a877){var _0x25ff7a;return getAuthToken(_0x3e0dc3,_0x38883f,_0x2e8a5f)[_0x7f03('0x10')](function(_0x2f3800){if(_0x5c3aea['ticketType']===_0x7f03('0x3b')){_0x25ff7a={'method':'POST','uri':_0x3ff71d+'incidents','body':Object[_0x7f03('0x3c')]({},{'title':intUtil[_0x7f03('0x3d')](_0x5c3aea[_0x7f03('0x3e')],_0x9b4a09,'\x20'),'description':intUtil[_0x7f03('0x3d')](_0x5c3aea[_0x7f03('0x3f')],_0x9b4a09,'\x0a'),'customerid_contact@odata.bind':_0x7f03('0x40')+_0x11ae3b[_0x7f03('0x30')]+')','ownerid@odata.bind':_0x7f03('0x41')+_0x11ae3b['userId']+')','caseorigincode':'1'},getCustomFields(_0x5c3aea[_0x7f03('0x42')],_0x9b4a09,_0x5c3aea[_0x7f03('0x43')])),'headers':{'Authorization':_0x7f03('0x18')+_0x2f3800,'OData-Version':_0x7f03('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5c3aea[_0x7f03('0x43')]===_0x7f03('0x44')){_0x25ff7a={'method':_0x7f03('0xc'),'uri':_0x3ff71d+'phonecalls','body':Object[_0x7f03('0x3c')]({},{'subject':intUtil['getString'](_0x5c3aea[_0x7f03('0x3e')],_0x9b4a09,'\x20'),'phonenumber':String(_0x9b4a09['calleridnum']),'description':intUtil[_0x7f03('0x3d')](_0x5c3aea[_0x7f03('0x3f')],_0x9b4a09,'\x0a'),'regardingobjectid_contact@odata.bind':_0x7f03('0x40')+_0x11ae3b['enduserId']+')','ownerid@odata.bind':_0x7f03('0x41')+_0x11ae3b[_0x7f03('0x24')]+')','directioncode':_0x11ae3b[_0x7f03('0x45')]===_0x7f03('0x46')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x11ae3b[_0x7f03('0x24')]+')','participationtypemask':_0x11ae3b[_0x7f03('0x45')]===_0x7f03('0x46')?0x2:0x1},{'partyid_contact@odata.bind':_0x7f03('0x40')+_0x11ae3b[_0x7f03('0x30')]+')','participationtypemask':_0x11ae3b['callDirection']==='queue'?0x1:0x2}]},getCustomFields(_0x5c3aea[_0x7f03('0x42')],_0x9b4a09,_0x5c3aea[_0x7f03('0x43')])),'headers':{'Authorization':'Bearer\x20'+_0x2f3800,'OData-Version':_0x7f03('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x25ff7a);})[_0x7f03('0x10')](function(_0x1f570d){var _0x493893=_0x1f570d['headers'][_0x7f03('0x2d')];var _0x29de22=_0x493893[_0x7f03('0x2e')](_0x493893['lastIndexOf']('(')+0x1,_0x493893[_0x7f03('0x2f')](')'));_0x11ae3b['ticketId']=_0x29de22;_0x49f1fd(_0x11ae3b);})['catch'](function(_0x58c79c){_0x23a877(_0x58c79c[_0x7f03('0x16')]);});});}function emit(_0x105a90,_0xcb26d9,_0x5a43ad,_0x337c92){var _0x3126cb={'uri':util['format'](_0x7f03('0x47'),_0x105a90,_0x5a43ad,_0x337c92)};io['to'](util['format'](_0x7f03('0x48'),_0xcb26d9))[_0x7f03('0x49')]('trigger:browser:url',_0x3126cb);}exports['cs']=function(_0x284a24,_0x52e8e5,_0x3c662f,_0x488672,_0x36a609,_0x45a486,_0x34dcc4,_0x1ac3e2){var _0x4f8405={};_0x45a486[_0x7f03('0x4a')]=intUtil[_0x7f03('0x4b')](_0x45a486[_0x7f03('0x4a')]);_0x45a486[_0x7f03('0x4c')]=intUtil[_0x7f03('0x4b')](_0x45a486[_0x7f03('0x4c')]);_0x4f8405[_0x7f03('0x45')]=_0x1ac3e2===_0x7f03('0x46')||_0x1ac3e2===_0x7f03('0x4d')?'queue':_0x7f03('0x28');var _0x312415=util[_0x7f03('0x4e')](_0x7f03('0x4f'),_0x45a486[_0x7f03('0x4a')]);var _0x206e39=util[_0x7f03('0x4e')](_0x7f03('0x50'),_0x45a486['tenantId']);var _0x2f377a=util['format'](_0x7f03('0x51'),_0x45a486['serverUrl'],_0x52e8e5['uniqueid'],md5(_0x52e8e5[_0x7f03('0x52')]));if(_0x36a609&&_0x36a609[_0x7f03('0x53')]){logger[_0x7f03('0x21')](_0x7f03('0x54'),'Recording\x20is\x20enabled!');_0x52e8e5[_0x7f03('0x55')]=_0x2f377a;}else if(_0x34dcc4&&_0x34dcc4['recordingFormat']&&_0x34dcc4[_0x7f03('0x56')]!==_0x7f03('0x57')){logger[_0x7f03('0x21')](_0x7f03('0x58'),'Recording\x20is\x20enabled!');_0x52e8e5[_0x7f03('0x55')]=_0x2f377a;}else{_0x52e8e5[_0x7f03('0x55')]='';}return getUser(_0x4f8405,_0x45a486,_0x488672,_0x206e39,_0x312415,_0x1ac3e2)[_0x7f03('0x10')](function(_0x42113a){logger[_0x7f03('0x21')]('['+_0x1ac3e2['toUpperCase']()+_0x7f03('0x59'),_0x42113a[_0x7f03('0x24')]);logger[_0x7f03('0x21')]('['+_0x1ac3e2[_0x7f03('0x14')]()+']\x20The\x20User\x20email\x20is:',_0x42113a['userEmail']);return getEndUser(_0x42113a,_0x45a486,_0x206e39,_0x312415,_0x52e8e5,_0x1ac3e2);})[_0x7f03('0x10')](function(_0x56149e){logger['info']('['+_0x1ac3e2[_0x7f03('0x14')]()+_0x7f03('0x5a'),_0x56149e[_0x7f03('0x30')]);logger[_0x7f03('0x21')]('['+_0x1ac3e2[_0x7f03('0x14')]()+_0x7f03('0x5b'),_0x52e8e5[_0x7f03('0x2a')]);return getTicket(_0x56149e,_0x45a486,_0x206e39,_0x312415,_0x52e8e5,_0x3c662f,_0x1ac3e2);})[_0x7f03('0x10')](function(_0x5264bb){logger[_0x7f03('0x21')](util[_0x7f03('0x4e')]('['+_0x1ac3e2[_0x7f03('0x14')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x3c662f['ticketType'],_0x5264bb[_0x7f03('0x5c')]));logger[_0x7f03('0x21')](util[_0x7f03('0x4e')]('['+_0x1ac3e2[_0x7f03('0x14')]()+']\x20Call\x20direction:\x20%s',_0x1ac3e2));if(_0x1ac3e2!==_0x7f03('0x4d')){logger[_0x7f03('0x21')]('['+_0x1ac3e2['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x45a486[_0x7f03('0x4a')],_0x488672[_0x7f03('0x5d')],_0x3c662f[_0x7f03('0x43')],_0x5264bb[_0x7f03('0x5c')]);}})[_0x7f03('0x12')](function(_0x1ceecb){logger[_0x7f03('0x13')]('['+_0x1ac3e2[_0x7f03('0x14')]()+_0x7f03('0x5e'),util[_0x7f03('0x5f')](_0x1ceecb,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index 2ceaccb..dcd9a49 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 _0xa50d=['defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','name','Fields','mapValues','keyBy','value','format','%s/api/v2/tickets','remoteUri','POST','then','validateEmail','%s/api/v2/agents','length','Agent\x20found!','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Basic\x20%s','base64','debug','stringify','GET','map','forEach','includes','picklist','type','customField','nameField','content','string','idField','push','toString','variableName','customVariable','Variable','toLowerCase','custom_fields','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','trigger:browser:url','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','user:%s','catch','unmanaged','lastevent','toUpperCase','lodash','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis'];(function(_0x13ba28,_0xed0597){var _0x25283d=function(_0x264576){while(--_0x264576){_0x13ba28['push'](_0x13ba28['shift']());}};_0x25283d(++_0xed0597);}(_0xa50d,0xb2));var _0xda50=function(_0x4615bb,_0x8251a6){_0x4615bb=_0x4615bb-0x0;var _0x4eb594=_0xa50d[_0x4615bb];return _0x4eb594;};'use strict';var _=require(_0xda50('0x0'));var rp=require('request-promise');var md5=require(_0xda50('0x1'));var util=require('util');var Redis=require(_0xda50('0x2'));var intUtil=require(_0xda50('0x3'));var config=require(_0xda50('0x4'));var logger=require(_0xda50('0x5'))(_0xda50('0x6'));config[_0xda50('0x7')]=_[_0xda50('0x8')](config[_0xda50('0x7')],{'host':_0xda50('0x9'),'port':0x18eb});var io=require(_0xda50('0xa'))(new Redis(config['redis']));var headers={'Content-Type':_0xda50('0xb'),'Accept':'application/json'};function emit(_0x589d56,_0x1aff77,_0xc5d824){io['to'](_0x589d56)[_0xda50('0xc')](_0x1aff77,_0xc5d824);}function getTicket(_0x2ea517,_0x213c85,_0x38fe63,_0x1775c1,_0x564102){logger[_0xda50('0xd')](_0xda50('0xe'));var _0x490882=_[_0xda50('0xf')]({'responder_id':_0x213c85['id'],'requester_id':_0x38fe63['id'],'name':util['format'](_0xda50('0x10'),_0x564102[_0xda50('0x11')]),'phone':_0x564102[_0xda50('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xda50('0x13')](_0x1775c1[_0xda50('0x14')],_0x564102,'\x20'),'description':intUtil['getString'](_0x1775c1[_0xda50('0x15')],_0x564102,'
'),'tags':getTags(_0x1775c1['Tags'],_0xda50('0x16'))},getCustomFields(_0x1775c1[_0xda50('0x17')],_0x564102));_0x490882['custom_fields']=_[_0xda50('0x18')](_[_0xda50('0x19')](_0x490882['custom_fields'],'id'),_0xda50('0x1a'));return request({'uri':util[_0xda50('0x1b')](_0xda50('0x1c'),_0x2ea517[_0xda50('0x1d')]),'method':_0xda50('0x1e'),'body':_0x490882})[_0xda50('0x1f')](function(_0x432f1e){logger[_0xda50('0xd')]('Ticket\x20created!');return _0x432f1e;});}function getUser(_0x3fd64e,_0x312c54){if(intUtil[_0xda50('0x20')](_0x312c54)){return request({'uri':util[_0xda50('0x1b')](_0xda50('0x21'),_0x3fd64e[_0xda50('0x1d')]),'qs':{'email':_0x312c54}})['then'](function(_0xf6c6c5){if(_0xf6c6c5[_0xda50('0x22')]){logger[_0xda50('0xd')](_0xda50('0x23'));return _['find'](_0xf6c6c5,function(_0x4e8d7c){return _0x4e8d7c[_0xda50('0x24')][_0xda50('0x25')]===_0x312c54;});}else{logger[_0xda50('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xda50('0x1b')](_0xda50('0x26'),_0x3fd64e[_0xda50('0x1d')])})[_0xda50('0x1f')](function(_0x479183){logger[_0xda50('0xd')](_0xda50('0x27'));return _0x479183;});}});}else{logger[_0xda50('0xd')](_0xda50('0x28'));return request({'uri':util['format'](_0xda50('0x26'),_0x3fd64e[_0xda50('0x1d')])})[_0xda50('0x1f')](function(_0x55b5bc){logger[_0xda50('0xd')]('Admin\x20account\x20selected.');return _0x55b5bc;});}}function getEndUser(_0x2dba4a,_0x1707c6,_0x30d4a2){logger['info'](_0xda50('0x29'),_0x30d4a2);return request({'uri':util[_0xda50('0x1b')](_0xda50('0x2a'),_0x2dba4a[_0xda50('0x1d')]),'qs':{'phone':_0x30d4a2}})[_0xda50('0x1f')](function(_0x3ac63d){if(_0x3ac63d[_0xda50('0x22')]){logger[_0xda50('0xd')](_0xda50('0x2b'));return _['find'](_0x3ac63d,{'phone':_0x30d4a2});}else{logger[_0xda50('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xda50('0x1b')](_0xda50('0x2a'),_0x2dba4a[_0xda50('0x1d')]),'method':'POST','body':{'name':_0x1707c6,'phone':_0x30d4a2}})[_0xda50('0x1f')](function(_0x1a5ed3){logger[_0xda50('0xd')]('Enduser\x20created.');return _0x1a5ed3;});}});}function getAuth(_0x19b054){return util[_0xda50('0x1b')](_0xda50('0x2c'),new Buffer(_0x19b054['apiKey']+':X')['toString'](_0xda50('0x2d')));}function request(_0xd6b8b3){logger[_0xda50('0x2e')]('[HTTP]',JSON[_0xda50('0x2f')](_0xd6b8b3));return rp(_[_0xda50('0x8')](_0xd6b8b3,{'method':_0xda50('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x2ed483,_0xf2f068){var _0x10a3f5=[];if(_0x2ed483&&_0x2ed483[_0xda50('0x22')]>0x0){_0x10a3f5=_[_0xda50('0x31')](_0x2ed483,_0xf2f068);}return _0x10a3f5;}function getCustomFields(_0x427bba,_0x2c645e){var _0x21a3be=[];var _0x3ebbda={'custom_fields':[]};if(_0x427bba[_0xda50('0x22')]>0x0){_[_0xda50('0x32')](_0x427bba,function(_0x39610f){if(_[_0xda50('0x33')](['string',_0xda50('0x34')],_0x39610f[_0xda50('0x35')])&&_0x39610f['nameField']&&!_0x39610f[_0xda50('0x36')]){_0x3ebbda[_0x39610f[_0xda50('0x37')]['toLowerCase']()]=_0x39610f[_0xda50('0x38')]['toString']();}else if(_[_0xda50('0x33')]([_0xda50('0x39'),_0xda50('0x34')],_0x39610f[_0xda50('0x35')])&&_0x39610f[_0xda50('0x3a')]&&_0x39610f['customField']){_0x3ebbda['custom_fields'][_0xda50('0x3b')]({'id':_0x39610f[_0xda50('0x3a')],'value':_0x39610f[_0xda50('0x38')][_0xda50('0x3c')]()});}else if(_0x39610f['type']==='variable'&&_0x39610f[_0xda50('0x3d')]&&_0x39610f[_0xda50('0x3a')]&&_0x39610f[_0xda50('0x36')]){_0x2c645e[_0x39610f[_0xda50('0x3d')]]&&_0x3ebbda['custom_fields'][_0xda50('0x3b')]({'id':_0x39610f[_0xda50('0x3a')],'value':_0x2c645e[_0x39610f[_0xda50('0x3d')]][_0xda50('0x3c')]()});}else if(_0x39610f['type']===_0xda50('0x3e')&&_0x39610f['Variable']&&_0x39610f[_0xda50('0x3f')]['name']&&_0x39610f[_0xda50('0x3a')]&&_0x39610f[_0xda50('0x36')]){_0x2c645e[_0x39610f[_0xda50('0x3f')][_0xda50('0x16')][_0xda50('0x40')]()]&&_0x3ebbda[_0xda50('0x41')]['push']({'id':_0x39610f[_0xda50('0x3a')],'value':_0x2c645e[_0x39610f[_0xda50('0x3f')][_0xda50('0x16')][_0xda50('0x40')]()][_0xda50('0x3c')]()});}});}return _0x3ebbda;}exports[_0xda50('0x42')]=function(_0xee26c2,_0x45b5cc,_0x247bf1,_0x15abb7,_0x13d398,_0x261f2c){var _0x830718,_0x3f8938;_0x261f2c['remoteUri']=intUtil[_0xda50('0x43')](_0x261f2c[_0xda50('0x1d')]);_0x261f2c['serverUrl']=intUtil[_0xda50('0x43')](_0x261f2c[_0xda50('0x44')]);if(_0x13d398&&_0x13d398[_0xda50('0x45')]){logger[_0xda50('0xd')](_0xda50('0x46'),_0xda50('0x47'));_0x45b5cc[_0xda50('0x48')]=util[_0xda50('0x1b')](_0xda50('0x49'),_0x261f2c[_0xda50('0x44')],_0x45b5cc[_0xda50('0x4a')],md5(_0x45b5cc[_0xda50('0x4a')]));}else{_0x45b5cc[_0xda50('0x48')]='';}headers[_0xda50('0x4b')]=getAuth(_0x261f2c);return getUser(_0x261f2c,_0x15abb7['email'])['then'](function(_0x5bb62e){_0x830718=_0x5bb62e;logger['info'](_0xda50('0x4c'),_0x830718['id']);return getEndUser(_0x261f2c,_0x45b5cc[_0xda50('0x11')],_0x45b5cc['calleridnum']);})['then'](function(_0x380b2a){_0x3f8938=_0x380b2a;logger[_0xda50('0xd')](_0xda50('0x4d'),_0x3f8938['id']);return getTicket(_0x261f2c,_0x830718,_0x3f8938,_0x247bf1,_0x45b5cc);})['then'](function(_0x259290){if(_0x259290&&_0x259290['id']){logger[_0xda50('0xd')](_0xda50('0x4e'));logger[_0xda50('0xd')](_0xda50('0x4f'),_0x259290['id']);logger[_0xda50('0xd')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xda50('0x1b')]('user:%s',_0x15abb7['name']),_0xda50('0x50'),{'uri':util[_0xda50('0x1b')]('%s/helpdesk/tickets/%d',_0x261f2c[_0xda50('0x1d')],_0x259290['id'])});}})['catch'](function(_0x1472e0){logger[_0xda50('0x51')](_0xda50('0x46'),JSON[_0xda50('0x2f')](_0x1472e0));});};exports[_0xda50('0x52')]=function(_0x27f0c0,_0x41869c,_0x433af9,_0x11090a,_0x371095,_0x1aedc2,_0x5c7be3){var _0x442d9d,_0x3e6703;_0x1aedc2[_0xda50('0x1d')]=intUtil[_0xda50('0x43')](_0x1aedc2[_0xda50('0x1d')]);_0x1aedc2['serverUrl']=intUtil['stripTrailingSlash'](_0x1aedc2[_0xda50('0x44')]);if(_0x5c7be3&&_0x5c7be3[_0xda50('0x53')]&&_0x5c7be3[_0xda50('0x53')]!==_0xda50('0x54')){logger[_0xda50('0xd')](_0xda50('0x55'),_0xda50('0x47'));_0x41869c['recordingURL']=util['format'](_0xda50('0x49'),_0x1aedc2['serverUrl'],_0x41869c[_0xda50('0x4a')],md5(_0x41869c[_0xda50('0x4a')]));}headers[_0xda50('0x4b')]=getAuth(_0x1aedc2);return getUser(_0x1aedc2,_0x11090a['email'])[_0xda50('0x1f')](function(_0x258b38){_0x442d9d=_0x258b38;logger[_0xda50('0xd')]('The\x20User\x20ID\x20is:',_0x442d9d['id']);return getEndUser(_0x1aedc2,_0x41869c[_0xda50('0x56')],_0x41869c[_0xda50('0x57')]);})[_0xda50('0x1f')](function(_0x5b7625){_0x3e6703=_0x5b7625;logger[_0xda50('0xd')](_0xda50('0x4d'),_0x3e6703['id']);return getTicket(_0x1aedc2,_0x442d9d,_0x3e6703,_0x433af9,_0x41869c);})[_0xda50('0x1f')](function(_0x5e1753){if(_0x5e1753&&_0x5e1753['id']){logger[_0xda50('0xd')](_0xda50('0x4e'));logger['info'](_0xda50('0x4f'),_0x5e1753['id']);logger[_0xda50('0xd')](_0xda50('0x55'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xda50('0x58'),_0x11090a['name']),'trigger:browser:url',{'uri':util[_0xda50('0x1b')]('%s/helpdesk/tickets/%d',_0x1aedc2[_0xda50('0x1d')],_0x5e1753['id'])});}})[_0xda50('0x59')](function(_0x4b12d4){logger[_0xda50('0x51')](_0xda50('0x55'),JSON[_0xda50('0x2f')](_0x4b12d4));});};exports[_0xda50('0x5a')]=function(_0x11377f,_0x5aad7c,_0x55f3fa,_0x5bfce5,_0x1f09fd,_0x1bed12){var _0x37149b,_0x4c7240;_0x1bed12[_0xda50('0x1d')]=intUtil[_0xda50('0x43')](_0x1bed12[_0xda50('0x1d')]);_0x1bed12[_0xda50('0x44')]=intUtil[_0xda50('0x43')](_0x1bed12['serverUrl']);if(_0x1f09fd&&_0x1f09fd[_0xda50('0x45')]){logger[_0xda50('0xd')]('['+_0x5aad7c[_0xda50('0x5b')][_0xda50('0x5c')]()+']',_0xda50('0x47'));_0x5aad7c[_0xda50('0x48')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1bed12[_0xda50('0x44')],_0x5aad7c['uniqueid'],md5(_0x5aad7c[_0xda50('0x4a')]));}else{_0x5aad7c[_0xda50('0x48')]='';}headers[_0xda50('0x4b')]=getAuth(_0x1bed12);return getUser(_0x1bed12,'')[_0xda50('0x1f')](function(_0x2f431e){_0x37149b=_0x2f431e;logger[_0xda50('0xd')](_0xda50('0x4c'),_0x37149b['id']);return getEndUser(_0x1bed12,_0x5aad7c[_0xda50('0x11')],_0x5aad7c[_0xda50('0x12')]);})['then'](function(_0x969dfe){_0x4c7240=_0x969dfe;logger[_0xda50('0xd')]('The\x20Enduser\x20ID\x20is:',_0x4c7240['id']);return getTicket(_0x1bed12,_0x37149b,_0x4c7240,_0x55f3fa,_0x5aad7c);})['then'](function(_0x2dd55f){if(_0x2dd55f){logger[_0xda50('0xd')](_0xda50('0x4e'));logger[_0xda50('0xd')](_0xda50('0x4f'),_0x2dd55f['id']);}})['catch'](function(_0x40bb08){logger[_0xda50('0x51')]('['+_0x5aad7c[_0xda50('0x5b')][_0xda50('0x5c')]()+']',JSON['stringify'](_0x40bb08));});}; \ No newline at end of file +var _0x778f=['picklist','type','nameField','customField','content','idField','push','variable','variableName','customVariable','Variable','toLowerCase','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/helpdesk/tickets/%d','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','freshdesk','redis','defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','Tags','name','custom_fields','mapValues','keyBy','%s/api/v2/tickets','POST','then','Ticket\x20created!','%s/api/v2/agents','remoteUri','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!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','debug','[HTTP]','stringify','GET','map','forEach','includes','string'];(function(_0x5d2898,_0x29a57f){var _0x1fdb40=function(_0x2d018f){while(--_0x2d018f){_0x5d2898['push'](_0x5d2898['shift']());}};_0x1fdb40(++_0x29a57f);}(_0x778f,0x1a1));var _0xf778=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x778f[_0x45b034];return _0x509cb0;};'use strict';var _=require(_0xf778('0x0'));var rp=require(_0xf778('0x1'));var md5=require(_0xf778('0x2'));var util=require(_0xf778('0x3'));var Redis=require(_0xf778('0x4'));var intUtil=require(_0xf778('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xf778('0x6'));config[_0xf778('0x7')]=_[_0xf778('0x8')](config[_0xf778('0x7')],{'host':_0xf778('0x9'),'port':0x18eb});var io=require(_0xf778('0xa'))(new Redis(config[_0xf778('0x7')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x56f1a8,_0x1612a1,_0x1a5b60){io['to'](_0x56f1a8)[_0xf778('0xb')](_0x1612a1,_0x1a5b60);}function getTicket(_0x203cc4,_0x5df332,_0x2723a5,_0x4761b5,_0x3bf0c4){logger[_0xf778('0xc')](_0xf778('0xd'));var _0x3469ed=_['merge']({'responder_id':_0x5df332['id'],'requester_id':_0x2723a5['id'],'name':util[_0xf778('0xe')](_0xf778('0xf'),_0x3bf0c4['calleridname']),'phone':_0x3bf0c4[_0xf778('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xf778('0x11')](_0x4761b5[_0xf778('0x12')],_0x3bf0c4,'\x20'),'description':intUtil[_0xf778('0x11')](_0x4761b5['Descriptions'],_0x3bf0c4,'
'),'tags':getTags(_0x4761b5[_0xf778('0x13')],_0xf778('0x14'))},getCustomFields(_0x4761b5['Fields'],_0x3bf0c4));_0x3469ed[_0xf778('0x15')]=_[_0xf778('0x16')](_[_0xf778('0x17')](_0x3469ed[_0xf778('0x15')],'id'),'value');return request({'uri':util['format'](_0xf778('0x18'),_0x203cc4['remoteUri']),'method':_0xf778('0x19'),'body':_0x3469ed})[_0xf778('0x1a')](function(_0x24a034){logger[_0xf778('0xc')](_0xf778('0x1b'));return _0x24a034;});}function getUser(_0x5f118c,_0x1232a8){if(intUtil['validateEmail'](_0x1232a8)){return request({'uri':util[_0xf778('0xe')](_0xf778('0x1c'),_0x5f118c[_0xf778('0x1d')]),'qs':{'email':_0x1232a8}})[_0xf778('0x1a')](function(_0xce00c8){if(_0xce00c8['length']){logger[_0xf778('0xc')]('Agent\x20found!');return _[_0xf778('0x1e')](_0xce00c8,function(_0x4fe7d7){return _0x4fe7d7[_0xf778('0x1f')][_0xf778('0x20')]===_0x1232a8;});}else{logger[_0xf778('0xc')](_0xf778('0x21'));return request({'uri':util[_0xf778('0xe')](_0xf778('0x22'),_0x5f118c[_0xf778('0x1d')])})[_0xf778('0x1a')](function(_0x328b11){logger[_0xf778('0xc')](_0xf778('0x23'));return _0x328b11;});}});}else{logger[_0xf778('0xc')](_0xf778('0x24'));return request({'uri':util[_0xf778('0xe')](_0xf778('0x22'),_0x5f118c[_0xf778('0x1d')])})[_0xf778('0x1a')](function(_0x67afdb){logger['info'](_0xf778('0x23'));return _0x67afdb;});}}function getEndUser(_0x3b5ca5,_0x83db79,_0x3ae5fc){logger[_0xf778('0xc')](_0xf778('0x25'),_0x3ae5fc);return request({'uri':util[_0xf778('0xe')](_0xf778('0x26'),_0x3b5ca5[_0xf778('0x1d')]),'qs':{'phone':_0x3ae5fc}})['then'](function(_0x5b80dc){if(_0x5b80dc[_0xf778('0x27')]){logger['info'](_0xf778('0x28'));return _[_0xf778('0x1e')](_0x5b80dc,{'phone':_0x3ae5fc});}else{logger[_0xf778('0xc')](_0xf778('0x29'));return request({'uri':util[_0xf778('0xe')](_0xf778('0x26'),_0x3b5ca5['remoteUri']),'method':_0xf778('0x19'),'body':{'name':_0x83db79,'phone':_0x3ae5fc}})[_0xf778('0x1a')](function(_0x5bfaea){logger['info'](_0xf778('0x2a'));return _0x5bfaea;});}});}function getAuth(_0x207ad0){return util[_0xf778('0xe')]('Basic\x20%s',new Buffer(_0x207ad0[_0xf778('0x2b')]+':X')[_0xf778('0x2c')]('base64'));}function request(_0x19c104){logger[_0xf778('0x2d')](_0xf778('0x2e'),JSON[_0xf778('0x2f')](_0x19c104));return rp(_['defaults'](_0x19c104,{'method':_0xf778('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x56be9c,_0x5f2535){var _0x571164=[];if(_0x56be9c&&_0x56be9c[_0xf778('0x27')]>0x0){_0x571164=_[_0xf778('0x31')](_0x56be9c,_0x5f2535);}return _0x571164;}function getCustomFields(_0x2740a9,_0x3d21ad){var _0x264c8e=[];var _0x5c0796={'custom_fields':[]};if(_0x2740a9[_0xf778('0x27')]>0x0){_[_0xf778('0x32')](_0x2740a9,function(_0x5c8e57){if(_[_0xf778('0x33')]([_0xf778('0x34'),_0xf778('0x35')],_0x5c8e57[_0xf778('0x36')])&&_0x5c8e57[_0xf778('0x37')]&&!_0x5c8e57[_0xf778('0x38')]){_0x5c0796[_0x5c8e57[_0xf778('0x37')]['toLowerCase']()]=_0x5c8e57[_0xf778('0x39')]['toString']();}else if(_[_0xf778('0x33')]([_0xf778('0x34'),_0xf778('0x35')],_0x5c8e57[_0xf778('0x36')])&&_0x5c8e57[_0xf778('0x3a')]&&_0x5c8e57[_0xf778('0x38')]){_0x5c0796[_0xf778('0x15')][_0xf778('0x3b')]({'id':_0x5c8e57[_0xf778('0x3a')],'value':_0x5c8e57[_0xf778('0x39')]['toString']()});}else if(_0x5c8e57[_0xf778('0x36')]===_0xf778('0x3c')&&_0x5c8e57['variableName']&&_0x5c8e57['idField']&&_0x5c8e57[_0xf778('0x38')]){_0x3d21ad[_0x5c8e57[_0xf778('0x3d')]]&&_0x5c0796[_0xf778('0x15')]['push']({'id':_0x5c8e57['idField'],'value':_0x3d21ad[_0x5c8e57[_0xf778('0x3d')]][_0xf778('0x2c')]()});}else if(_0x5c8e57[_0xf778('0x36')]===_0xf778('0x3e')&&_0x5c8e57[_0xf778('0x3f')]&&_0x5c8e57[_0xf778('0x3f')][_0xf778('0x14')]&&_0x5c8e57['idField']&&_0x5c8e57[_0xf778('0x38')]){_0x3d21ad[_0x5c8e57[_0xf778('0x3f')][_0xf778('0x14')][_0xf778('0x40')]()]&&_0x5c0796['custom_fields'][_0xf778('0x3b')]({'id':_0x5c8e57[_0xf778('0x3a')],'value':_0x3d21ad[_0x5c8e57['Variable']['name']['toLowerCase']()][_0xf778('0x2c')]()});}});}return _0x5c0796;}exports[_0xf778('0x41')]=function(_0x1651f4,_0x267278,_0xc12b0a,_0x446b44,_0x2eb119,_0x1b51dd){var _0x293692,_0x4fe4a5;_0x1b51dd['remoteUri']=intUtil['stripTrailingSlash'](_0x1b51dd[_0xf778('0x1d')]);_0x1b51dd[_0xf778('0x42')]=intUtil[_0xf778('0x43')](_0x1b51dd['serverUrl']);if(_0x2eb119&&_0x2eb119[_0xf778('0x44')]){logger[_0xf778('0xc')](_0xf778('0x45'),_0xf778('0x46'));_0x267278[_0xf778('0x47')]=util[_0xf778('0xe')](_0xf778('0x48'),_0x1b51dd[_0xf778('0x42')],_0x267278[_0xf778('0x49')],md5(_0x267278[_0xf778('0x49')]));}else{_0x267278[_0xf778('0x47')]='';}headers['Authorization']=getAuth(_0x1b51dd);return getUser(_0x1b51dd,_0x446b44[_0xf778('0x20')])[_0xf778('0x1a')](function(_0x7253a9){_0x293692=_0x7253a9;logger[_0xf778('0xc')](_0xf778('0x4a'),_0x293692['id']);return getEndUser(_0x1b51dd,_0x267278[_0xf778('0x4b')],_0x267278[_0xf778('0x10')]);})['then'](function(_0x235c79){_0x4fe4a5=_0x235c79;logger['info']('The\x20Enduser\x20ID\x20is:',_0x4fe4a5['id']);return getTicket(_0x1b51dd,_0x293692,_0x4fe4a5,_0xc12b0a,_0x267278);})[_0xf778('0x1a')](function(_0x32526a){if(_0x32526a&&_0x32526a['id']){logger[_0xf778('0xc')](_0xf778('0x1b'));logger[_0xf778('0xc')]('The\x20Ticket\x20ID\x20is:',_0x32526a['id']);logger[_0xf778('0xc')](_0xf778('0x45'),_0xf778('0x4c'));emit(util[_0xf778('0xe')](_0xf778('0x4d'),_0x446b44[_0xf778('0x14')]),_0xf778('0x4e'),{'uri':util[_0xf778('0xe')]('%s/helpdesk/tickets/%d',_0x1b51dd[_0xf778('0x1d')],_0x32526a['id'])});}})[_0xf778('0x4f')](function(_0x522133){logger[_0xf778('0x50')](_0xf778('0x45'),JSON[_0xf778('0x2f')](_0x522133));});};exports[_0xf778('0x51')]=function(_0x57752d,_0xa87eea,_0x865cf6,_0xe1c578,_0x2ffa21,_0x372d38,_0x4d9684){var _0x227218,_0x132769;_0x372d38[_0xf778('0x1d')]=intUtil[_0xf778('0x43')](_0x372d38[_0xf778('0x1d')]);_0x372d38[_0xf778('0x42')]=intUtil[_0xf778('0x43')](_0x372d38[_0xf778('0x42')]);if(_0x4d9684&&_0x4d9684[_0xf778('0x52')]&&_0x4d9684[_0xf778('0x52')]!==_0xf778('0x53')){logger[_0xf778('0xc')](_0xf778('0x54'),_0xf778('0x46'));_0xa87eea['recordingURL']=util[_0xf778('0xe')](_0xf778('0x48'),_0x372d38[_0xf778('0x42')],_0xa87eea[_0xf778('0x49')],md5(_0xa87eea['uniqueid']));}headers[_0xf778('0x55')]=getAuth(_0x372d38);return getUser(_0x372d38,_0xe1c578['email'])[_0xf778('0x1a')](function(_0x553e50){_0x227218=_0x553e50;logger[_0xf778('0xc')](_0xf778('0x4a'),_0x227218['id']);return getEndUser(_0x372d38,_0xa87eea[_0xf778('0x56')],_0xa87eea[_0xf778('0x57')]);})[_0xf778('0x1a')](function(_0x16cff0){_0x132769=_0x16cff0;logger[_0xf778('0xc')](_0xf778('0x58'),_0x132769['id']);return getTicket(_0x372d38,_0x227218,_0x132769,_0x865cf6,_0xa87eea);})[_0xf778('0x1a')](function(_0x30fcbf){if(_0x30fcbf&&_0x30fcbf['id']){logger[_0xf778('0xc')](_0xf778('0x1b'));logger[_0xf778('0xc')](_0xf778('0x59'),_0x30fcbf['id']);logger['info'](_0xf778('0x54'),_0xf778('0x4c'));emit(util[_0xf778('0xe')](_0xf778('0x4d'),_0xe1c578['name']),_0xf778('0x4e'),{'uri':util[_0xf778('0xe')](_0xf778('0x5a'),_0x372d38['remoteUri'],_0x30fcbf['id'])});}})[_0xf778('0x4f')](function(_0x396945){logger[_0xf778('0x50')](_0xf778('0x54'),JSON[_0xf778('0x2f')](_0x396945));});};exports[_0xf778('0x5b')]=function(_0x1eb2e1,_0x21fe2,_0x19cbbc,_0x456bde,_0xbb2981,_0x5a19e5){var _0x33d6cf,_0x2579f5;_0x5a19e5[_0xf778('0x1d')]=intUtil[_0xf778('0x43')](_0x5a19e5['remoteUri']);_0x5a19e5[_0xf778('0x42')]=intUtil[_0xf778('0x43')](_0x5a19e5[_0xf778('0x42')]);if(_0xbb2981&&_0xbb2981[_0xf778('0x44')]){logger[_0xf778('0xc')]('['+_0x21fe2[_0xf778('0x5c')][_0xf778('0x5d')]()+']','Recording\x20is\x20enabled!');_0x21fe2[_0xf778('0x47')]=util[_0xf778('0xe')](_0xf778('0x48'),_0x5a19e5[_0xf778('0x42')],_0x21fe2[_0xf778('0x49')],md5(_0x21fe2['uniqueid']));}else{_0x21fe2[_0xf778('0x47')]='';}headers[_0xf778('0x55')]=getAuth(_0x5a19e5);return getUser(_0x5a19e5,'')['then'](function(_0x4f9f3f){_0x33d6cf=_0x4f9f3f;logger[_0xf778('0xc')](_0xf778('0x4a'),_0x33d6cf['id']);return getEndUser(_0x5a19e5,_0x21fe2[_0xf778('0x4b')],_0x21fe2[_0xf778('0x10')]);})[_0xf778('0x1a')](function(_0x3595c5){_0x2579f5=_0x3595c5;logger[_0xf778('0xc')](_0xf778('0x58'),_0x2579f5['id']);return getTicket(_0x5a19e5,_0x33d6cf,_0x2579f5,_0x19cbbc,_0x21fe2);})['then'](function(_0x5ac1fa){if(_0x5ac1fa){logger[_0xf778('0xc')](_0xf778('0x1b'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x5ac1fa['id']);}})[_0xf778('0x4f')](function(_0x1bafc7){logger['error']('['+_0x21fe2[_0xf778('0x5c')][_0xf778('0x5d')]()+']',JSON['stringify'](_0x1bafc7));});}; \ 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 091a2ec..df377d2 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 _0x9a47=['adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','email','Admin\x20selected','userEmail','/api/lookup?q=','&entities=contact','then','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','userId','YYYY-MM-DDTHH:mm:ss','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','task','Task\x20created:','ticketId','/contacts/','user:%s','emit','apiKey','stripTrailingSlash','serverUrl','remoteUri','toLowerCase','outbound','destcalleridnum','calleridnum','queue','unmanaged','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','users','length','adminEmail'];(function(_0x5e8893,_0x2b6da9){var _0xc19acd=function(_0x18cdda){while(--_0x18cdda){_0x5e8893['push'](_0x5e8893['shift']());}};_0xc19acd(++_0x2b6da9);}(_0x9a47,0x132));var _0x79a4=function(_0x122d6c,_0x2a74e2){_0x122d6c=_0x122d6c-0x0;var _0x2c14d4=_0x9a47[_0x122d6c];return _0x2c14d4;};'use strict';var _=require(_0x79a4('0x0'));var rp=require(_0x79a4('0x1'));var md5=require(_0x79a4('0x2'));var util=require(_0x79a4('0x3'));var moment=require(_0x79a4('0x4'));var Promise=require(_0x79a4('0x5'));var Redis=require(_0x79a4('0x6'));var intUtil=require(_0x79a4('0x7'));var config=require(_0x79a4('0x8'));var logger=require(_0x79a4('0x9'))(_0x79a4('0xa'));config[_0x79a4('0xb')]=_['defaults'](config['redis'],{'host':_0x79a4('0xc'),'port':0x18eb});var io=require(_0x79a4('0xd'))(new Redis(config[_0x79a4('0xb')]));function getAdminId(_0x32629d,_0x34053b,_0xe95eba,_0x458259){return new Promise(function(_0x3af7ac,_0x5a7384){var _0x15f9c8=![];var _0xd16ed1={'method':_0x79a4('0xe'),'uri':_0x458259+_0x79a4('0xf'),'json':!![]};_0xd16ed1[_0x79a4('0x10')]=_0xe95eba;logger[_0x79a4('0x11')](_0x79a4('0x12'));return rp(_0xd16ed1)['then'](function(_0x51f01b){if(_0x51f01b){var _0x1670e8=_0x51f01b[_0x79a4('0x13')];var _0x4ff2bf=null;for(_0x4ff2bf=0x0;_0x4ff2bf<_0x1670e8[_0x79a4('0x14')];_0x4ff2bf++){if(_0x1670e8[_0x4ff2bf]['email']===_0x32629d[_0x79a4('0x15')]){_0x32629d[_0x79a4('0x16')]=_0x1670e8[_0x4ff2bf]['id'];_0x15f9c8=!![];}}if(_0x15f9c8){logger[_0x79a4('0x11')](_0x79a4('0x17'),_0x32629d[_0x79a4('0x16')]);_0x3af7ac(_0x32629d);}else{_0x5a7384({'statusCode':0x194,'message':_0x79a4('0x18')});}}else{_0x5a7384({'statusCode':0x194,'message':_0x79a4('0x18')});}})[_0x79a4('0x19')](function(_0x37bcbd){logger[_0x79a4('0x1a')]('['+[_0x34053b[_0x79a4('0x1b')]()]+']',_0x37bcbd[_0x79a4('0x1c')]);_0x5a7384(_0x37bcbd);});});}function getUser(_0x19b01a,_0x51cd14,_0x55944b){return function(_0x563d6a){return new Promise(function(_0x219042,_0xbfb728){var _0x40182e={'method':_0x79a4('0xe'),'uri':_0x55944b+_0x79a4('0xf'),'json':!![]};_0x40182e['headers']=_0x51cd14;logger[_0x79a4('0x11')](_0x79a4('0x1d'));return rp(_0x40182e)['then'](function(_0x21928c){if(_0x21928c){var _0x3a7ef3=_0x21928c[_0x79a4('0x13')];var _0x2ebee8=![];var _0x2037f5=null;if(_0x563d6a['agentEmail']!==null){logger[_0x79a4('0x11')](_0x79a4('0x1e'),_0x563d6a['agentEmail']);_0x563d6a['userEmail']=_0x563d6a[_0x79a4('0x1f')];for(_0x2037f5=0x0;_0x2037f5<_0x3a7ef3[_0x79a4('0x14')];_0x2037f5++){if(_0x3a7ef3[_0x2037f5][_0x79a4('0x20')]===_0x563d6a[_0x79a4('0x1f')]){_0x2ebee8=!![];_0x563d6a['userId']=_0x3a7ef3[_0x2037f5]['id'];logger[_0x79a4('0x11')]('User\x20found:',_0x563d6a['userId']);}}}if(!_0x2ebee8){logger['info'](_0x79a4('0x21'));_0x563d6a[_0x79a4('0x22')]=_0x563d6a['adminEmail'];_0x563d6a['userId']=_0x563d6a[_0x79a4('0x16')];_0x2ebee8=!![];}if(_0x2ebee8){_0x219042(_0x563d6a);}else{_0xbfb728({'statusCode':0x194,'message':_0x79a4('0x18')});}}else{_0xbfb728({'statusCode':0x194,'message':_0x79a4('0x18')});}})[_0x79a4('0x19')](function(_0x5c2309){logger[_0x79a4('0x1a')]('['+[_0x19b01a[_0x79a4('0x1b')]()]+']',_0x5c2309[_0x79a4('0x1c')]);_0xbfb728(_0x5c2309);});});};}function searchContact(_0x26136f,_0x4d981a,_0x42debf,_0x5995ca){return new Promise(function(_0x16b536,_0x3034cb){var _0x55f647={'method':_0x79a4('0xe'),'headers':_0x4d981a,'uri':_0x26136f+_0x79a4('0x23')+_0x5995ca+'&f='+_0x42debf+_0x79a4('0x24'),'json':!![]};rp(_0x55f647)[_0x79a4('0x25')](function(_0x6eb328){var _0x332f9d=_[_0x79a4('0x26')](_0x6eb328['contacts'][_0x79a4('0x27')],[_0x42debf,_0x5995ca]);_0x16b536(_0x332f9d);})['catch'](function(_0x3f43a1){_0x3034cb(_0x3f43a1);});});}function getEndUser(_0x1b3dc9,_0x1bc3b0,_0xda4e8b){return function(_0xd99b94){return new Promise(function(_0x44b1de,_0x226da5){logger[_0x79a4('0x11')](util[_0x79a4('0x28')](_0x79a4('0x29'),_0xd99b94['contactNumber']));searchContact(_0xda4e8b,_0x1bc3b0,'mobile_number',_0xd99b94[_0x79a4('0x2a')])['then'](function(_0xac9160){if(_0xac9160){_0xd99b94[_0x79a4('0x2b')]=_0xac9160['id'];logger[_0x79a4('0x11')](_0x79a4('0x2c'),_0xd99b94[_0x79a4('0x2b')]);return _0x44b1de(_0xd99b94);}searchContact(_0xda4e8b,_0x1bc3b0,_0x79a4('0x2d'),_0xd99b94[_0x79a4('0x2a')])['then'](function(_0x4ca221){if(_0x4ca221){_0xd99b94[_0x79a4('0x2b')]=_0x4ca221['id'];logger['info'](_0x79a4('0x2e'),_0xd99b94['endUserId']);return _0x44b1de(_0xd99b94);}createEndUser(_0xd99b94,_0x1b3dc9,_0x1bc3b0,_0xda4e8b)[_0x79a4('0x25')](function(_0x38d08e){logger[_0x79a4('0x11')](_0x79a4('0x2f'),_0x38d08e[_0x79a4('0x2b')]);return _0x44b1de(_0x38d08e);});});})[_0x79a4('0x19')](function(_0x2def82){_0x226da5(_0x2def82);});});};}function createEndUser(_0x58d6ed,_0x1c0eb8,_0x546e9b,_0x45526c){return new Promise(function(_0x26613d,_0x10f268){var _0x3442ba=moment();var _0x33302c={'method':_0x79a4('0x30'),'uri':_0x45526c+_0x79a4('0x31'),'body':{'contact':{'last_name':_0x58d6ed[_0x79a4('0x2a')],'work_number':_0x58d6ed[_0x79a4('0x2a')],'mobile_number':_0x58d6ed[_0x79a4('0x2a')],'owner_id':_0x58d6ed[_0x79a4('0x32')],'created_at':_0x3442ba['format'](_0x79a4('0x33'))}},'json':!![]};_0x33302c[_0x79a4('0x10')]=_0x546e9b;logger[_0x79a4('0x11')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x33302c)['then'](function(_0x3f39e){_0x58d6ed[_0x79a4('0x2b')]=_0x3f39e['contact']['id'];_0x26613d(_0x58d6ed);})[_0x79a4('0x19')](function(_0x49208d){logger[_0x79a4('0x1a')]('['+[_0x1c0eb8[_0x79a4('0x1b')]()]+']',_0x49208d['message']);_0x10f268(_0x49208d[_0x79a4('0x1c')]);});});}function getTicket(_0x4a84bf,_0x25a439,_0x1379fc,_0x35f6bf,_0x58bf36){return function(_0x33e8df){logger[_0x79a4('0x11')](_0x79a4('0x34'));return new Promise(function(_0x1694fc,_0x12476c){var _0x33bfff=moment();var _0x201f44={'method':'POST','uri':_0x1379fc+_0x79a4('0x35'),'body':{'title':intUtil[_0x79a4('0x36')](_0x35f6bf[_0x79a4('0x37')],_0x58bf36,'\x20'),'description':intUtil['getString'](_0x35f6bf[_0x79a4('0x38')],_0x58bf36,'\x0a'),'owner_id':_0x33e8df[_0x79a4('0x32')],'creater_id':_0x33e8df[_0x79a4('0x16')],'targetable_id':_0x33e8df[_0x79a4('0x2b')],'targetable_type':'Contact','created_at':_0x33bfff[_0x79a4('0x28')](_0x79a4('0x33')),'due_date':_0x33bfff['add'](0x1e,'m')[_0x79a4('0x28')](_0x79a4('0x33'))},'json':!![]};_0x201f44['headers']=_0x25a439;return rp(_0x201f44)[_0x79a4('0x25')](function(_0x137a1e){_0x33e8df['ticketId']=_0x137a1e[_0x79a4('0x39')]['id'];logger[_0x79a4('0x11')](_0x79a4('0x3a'),_0x33e8df[_0x79a4('0x3b')]);_0x1694fc(_0x33e8df);})['catch'](function(_0x5f281a){logger['error']('['+[_0x4a84bf[_0x79a4('0x1b')]()]+']',_0x5f281a[_0x79a4('0x1c')]);_0x12476c(_0x5f281a[_0x79a4('0x1c')]);});});};}function emit(_0x5cbb46,_0x41515b,_0x3979d7){var _0x305059={'uri':_0x5cbb46+_0x79a4('0x3c')+_0x3979d7};io['to'](util[_0x79a4('0x28')](_0x79a4('0x3d'),_0x41515b))[_0x79a4('0x3e')]('trigger:browser:url',_0x305059);}exports['cs']=function(_0xdbd40c,_0x21e8f5,_0x632b70,_0x5d1f2d,_0x294018,_0x10a104,_0x32d97c,_0x285d7e){var _0x43cf8e={};var _0x495e55={'Authorization':'Token\x20token='+_0x10a104[_0x79a4('0x3f')]};_0x10a104['remoteUri']=intUtil[_0x79a4('0x40')](_0x10a104['remoteUri']);_0x10a104[_0x79a4('0x41')]=intUtil[_0x79a4('0x40')](_0x10a104[_0x79a4('0x41')]);var _0x704640=_0x10a104[_0x79a4('0x42')];_0x43cf8e[_0x79a4('0x15')]=_0x10a104['username'];_0x43cf8e['contactNumber']=_0x285d7e[_0x79a4('0x43')]()===_0x79a4('0x44')?_0x21e8f5[_0x79a4('0x45')]:_0x21e8f5[_0x79a4('0x46')];_0x43cf8e['callDirection']=_0x285d7e===_0x79a4('0x47')||_0x285d7e===_0x79a4('0x48')?_0x79a4('0x47'):'outbound';if(_0x5d1f2d){_0x43cf8e[_0x79a4('0x1f')]=_0x5d1f2d['email'];}var _0x5af15c=util[_0x79a4('0x28')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x10a104['serverUrl'],_0x21e8f5[_0x79a4('0x49')],md5(_0x21e8f5['uniqueid']));if(_0x294018&&_0x294018[_0x79a4('0x4a')]){logger[_0x79a4('0x11')]('[QUEUE]',_0x79a4('0x4b'));_0x21e8f5[_0x79a4('0x4c')]=_0x5af15c;}else if(_0x32d97c&&_0x32d97c['recordingFormat']&&_0x32d97c['recordingFormat']!=='none'){logger[_0x79a4('0x11')](_0x79a4('0x4d'),'Recording\x20is\x20enabled!');_0x21e8f5[_0x79a4('0x4c')]=_0x5af15c;}else{_0x21e8f5[_0x79a4('0x4c')]='';}return getAdminId(_0x43cf8e,_0x285d7e,_0x495e55,_0x704640)[_0x79a4('0x25')](getUser(_0x285d7e,_0x495e55,_0x704640))[_0x79a4('0x25')](getEndUser(_0x285d7e,_0x495e55,_0x704640))[_0x79a4('0x25')](getTicket(_0x285d7e,_0x495e55,_0x704640,_0x632b70,_0x21e8f5))[_0x79a4('0x25')](function(_0x23d986){logger[_0x79a4('0x11')](util[_0x79a4('0x28')](_0x79a4('0x4e'),_0x23d986[_0x79a4('0x3b')]));if(_0x285d7e!=='unmanaged'){logger[_0x79a4('0x11')]('['+[_0x285d7e[_0x79a4('0x1b')]()]+']',_0x79a4('0x4f'));emit(_0x704640,_0x5d1f2d[_0x79a4('0x50')],_0x23d986[_0x79a4('0x2b')]);}})[_0x79a4('0x19')](function(_0x5c56cd){logger[_0x79a4('0x1a')]('['+[_0x285d7e['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x79a4('0x51')](_0x5c56cd,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x29cd=['socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','adminEmail','/api/lookup?q=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20work_number:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Subjects','Descriptions','Contact','add','Task\x20created:','message','/contacts/','emit','apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','ticketId','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis'];(function(_0x3fe988,_0x149b45){var _0x62ef22=function(_0x1367f1){while(--_0x1367f1){_0x3fe988['push'](_0x3fe988['shift']());}};_0x62ef22(++_0x149b45);}(_0x29cd,0x180));var _0xd29c=function(_0x2091b8,_0x58d832){_0x2091b8=_0x2091b8-0x0;var _0x1e1f89=_0x29cd[_0x2091b8];return _0x1e1f89;};'use strict';var _=require(_0xd29c('0x0'));var rp=require(_0xd29c('0x1'));var md5=require(_0xd29c('0x2'));var util=require(_0xd29c('0x3'));var moment=require('moment');var Promise=require(_0xd29c('0x4'));var Redis=require(_0xd29c('0x5'));var intUtil=require(_0xd29c('0x6'));var config=require(_0xd29c('0x7'));var logger=require(_0xd29c('0x8'))(_0xd29c('0x9'));config[_0xd29c('0xa')]=_['defaults'](config[_0xd29c('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xd29c('0xb'))(new Redis(config[_0xd29c('0xa')]));function getAdminId(_0x32f740,_0x211213,_0x4d642a,_0x30e07a){return new Promise(function(_0x1c7096,_0x57fc27){var _0x2a8321=![];var _0x3c7b52={'method':_0xd29c('0xc'),'uri':_0x30e07a+_0xd29c('0xd'),'json':!![]};_0x3c7b52[_0xd29c('0xe')]=_0x4d642a;logger[_0xd29c('0xf')](_0xd29c('0x10'));return rp(_0x3c7b52)[_0xd29c('0x11')](function(_0x546234){if(_0x546234){var _0x1aa93c=_0x546234[_0xd29c('0x12')];var _0x5b6ed1=null;for(_0x5b6ed1=0x0;_0x5b6ed1<_0x1aa93c[_0xd29c('0x13')];_0x5b6ed1++){if(_0x1aa93c[_0x5b6ed1][_0xd29c('0x14')]===_0x32f740['adminEmail']){_0x32f740[_0xd29c('0x15')]=_0x1aa93c[_0x5b6ed1]['id'];_0x2a8321=!![];}}if(_0x2a8321){logger[_0xd29c('0xf')]('Admin\x20found:',_0x32f740[_0xd29c('0x15')]);_0x1c7096(_0x32f740);}else{_0x57fc27({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x57fc27({'statusCode':0x194,'message':_0xd29c('0x16')});}})[_0xd29c('0x17')](function(_0x210e8d){logger[_0xd29c('0x18')]('['+[_0x211213[_0xd29c('0x19')]()]+']',_0x210e8d['message']);_0x57fc27(_0x210e8d);});});}function getUser(_0x12cc5c,_0x293b67,_0x30ab14){return function(_0x45b972){return new Promise(function(_0x1a9721,_0x44f7f5){var _0x2f50e3={'method':_0xd29c('0xc'),'uri':_0x30ab14+_0xd29c('0xd'),'json':!![]};_0x2f50e3['headers']=_0x293b67;logger[_0xd29c('0xf')]('Getting\x20user\x20list');return rp(_0x2f50e3)[_0xd29c('0x11')](function(_0x463f9b){if(_0x463f9b){var _0x3a5950=_0x463f9b[_0xd29c('0x12')];var _0x482aba=![];var _0x38f9eb=null;if(_0x45b972[_0xd29c('0x1a')]!==null){logger[_0xd29c('0xf')](_0xd29c('0x1b'),_0x45b972[_0xd29c('0x1a')]);_0x45b972[_0xd29c('0x1c')]=_0x45b972[_0xd29c('0x1a')];for(_0x38f9eb=0x0;_0x38f9eb<_0x3a5950[_0xd29c('0x13')];_0x38f9eb++){if(_0x3a5950[_0x38f9eb][_0xd29c('0x14')]===_0x45b972['agentEmail']){_0x482aba=!![];_0x45b972[_0xd29c('0x1d')]=_0x3a5950[_0x38f9eb]['id'];logger[_0xd29c('0xf')](_0xd29c('0x1e'),_0x45b972['userId']);}}}if(!_0x482aba){logger[_0xd29c('0xf')](_0xd29c('0x1f'));_0x45b972[_0xd29c('0x1c')]=_0x45b972[_0xd29c('0x20')];_0x45b972[_0xd29c('0x1d')]=_0x45b972['adminId'];_0x482aba=!![];}if(_0x482aba){_0x1a9721(_0x45b972);}else{_0x44f7f5({'statusCode':0x194,'message':_0xd29c('0x16')});}}else{_0x44f7f5({'statusCode':0x194,'message':_0xd29c('0x16')});}})[_0xd29c('0x17')](function(_0x198b21){logger[_0xd29c('0x18')]('['+[_0x12cc5c['toUpperCase']()]+']',_0x198b21['message']);_0x44f7f5(_0x198b21);});});};}function searchContact(_0x20f940,_0x3db789,_0x483736,_0x32f938){return new Promise(function(_0xefa865,_0x2c95c5){var _0x466e13={'method':'GET','headers':_0x3db789,'uri':_0x20f940+_0xd29c('0x21')+_0x32f938+'&f='+_0x483736+_0xd29c('0x22'),'json':!![]};rp(_0x466e13)[_0xd29c('0x11')](function(_0x3a51a6){var _0x74f08=_[_0xd29c('0x23')](_0x3a51a6[_0xd29c('0x24')][_0xd29c('0x24')],[_0x483736,_0x32f938]);_0xefa865(_0x74f08);})['catch'](function(_0x17cb48){_0x2c95c5(_0x17cb48);});});}function getEndUser(_0x32f047,_0x5233aa,_0x247e5c){return function(_0x4d8bd4){return new Promise(function(_0x1aac75,_0x1de9cb){logger[_0xd29c('0xf')](util[_0xd29c('0x25')](_0xd29c('0x26'),_0x4d8bd4[_0xd29c('0x27')]));searchContact(_0x247e5c,_0x5233aa,'mobile_number',_0x4d8bd4[_0xd29c('0x27')])['then'](function(_0x6bfdba){if(_0x6bfdba){_0x4d8bd4[_0xd29c('0x28')]=_0x6bfdba['id'];logger[_0xd29c('0xf')]('Contact\x20found\x20mobile_number:',_0x4d8bd4[_0xd29c('0x28')]);return _0x1aac75(_0x4d8bd4);}searchContact(_0x247e5c,_0x5233aa,'work_number',_0x4d8bd4[_0xd29c('0x27')])['then'](function(_0x203e42){if(_0x203e42){_0x4d8bd4[_0xd29c('0x28')]=_0x203e42['id'];logger['info'](_0xd29c('0x29'),_0x4d8bd4['endUserId']);return _0x1aac75(_0x4d8bd4);}createEndUser(_0x4d8bd4,_0x32f047,_0x5233aa,_0x247e5c)[_0xd29c('0x11')](function(_0xd27b3a){logger[_0xd29c('0xf')]('Contact\x20created:',_0xd27b3a[_0xd29c('0x28')]);return _0x1aac75(_0xd27b3a);});});})['catch'](function(_0x5ca9a9){_0x1de9cb(_0x5ca9a9);});});};}function createEndUser(_0x2037d7,_0xca47ba,_0x133d39,_0x424761){return new Promise(function(_0x394084,_0x5c1422){var _0x1be8ef=moment();var _0x3aad58={'method':_0xd29c('0x2a'),'uri':_0x424761+_0xd29c('0x2b'),'body':{'contact':{'last_name':_0x2037d7[_0xd29c('0x27')],'work_number':_0x2037d7['contactNumber'],'mobile_number':_0x2037d7[_0xd29c('0x27')],'owner_id':_0x2037d7['userId'],'created_at':_0x1be8ef[_0xd29c('0x25')](_0xd29c('0x2c'))}},'json':!![]};_0x3aad58['headers']=_0x133d39;logger[_0xd29c('0xf')](_0xd29c('0x2d'));return rp(_0x3aad58)[_0xd29c('0x11')](function(_0x335e46){_0x2037d7[_0xd29c('0x28')]=_0x335e46[_0xd29c('0x2e')]['id'];_0x394084(_0x2037d7);})[_0xd29c('0x17')](function(_0x48077a){logger['error']('['+[_0xca47ba['toUpperCase']()]+']',_0x48077a['message']);_0x5c1422(_0x48077a['message']);});});}function getTicket(_0x2328be,_0x215b4b,_0x354a8e,_0x3fc83d,_0x48bb0b){return function(_0x3fb135){logger['info'](_0xd29c('0x2f'));return new Promise(function(_0x5e4d08,_0x33ddc1){var _0x4aacb9=moment();var _0x7e29d2={'method':_0xd29c('0x2a'),'uri':_0x354a8e+'/api/tasks','body':{'title':intUtil[_0xd29c('0x30')](_0x3fc83d[_0xd29c('0x31')],_0x48bb0b,'\x20'),'description':intUtil['getString'](_0x3fc83d[_0xd29c('0x32')],_0x48bb0b,'\x0a'),'owner_id':_0x3fb135[_0xd29c('0x1d')],'creater_id':_0x3fb135['adminId'],'targetable_id':_0x3fb135['endUserId'],'targetable_type':_0xd29c('0x33'),'created_at':_0x4aacb9['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x4aacb9[_0xd29c('0x34')](0x1e,'m')[_0xd29c('0x25')](_0xd29c('0x2c'))},'json':!![]};_0x7e29d2[_0xd29c('0xe')]=_0x215b4b;return rp(_0x7e29d2)['then'](function(_0x4099e3){_0x3fb135['ticketId']=_0x4099e3['task']['id'];logger['info'](_0xd29c('0x35'),_0x3fb135['ticketId']);_0x5e4d08(_0x3fb135);})['catch'](function(_0xb59831){logger[_0xd29c('0x18')]('['+[_0x2328be[_0xd29c('0x19')]()]+']',_0xb59831[_0xd29c('0x36')]);_0x33ddc1(_0xb59831['message']);});});};}function emit(_0x3e13a4,_0x5dbcb5,_0x68a490){var _0x3c2b25={'uri':_0x3e13a4+_0xd29c('0x37')+_0x68a490};io['to'](util[_0xd29c('0x25')]('user:%s',_0x5dbcb5))[_0xd29c('0x38')]('trigger:browser:url',_0x3c2b25);}exports['cs']=function(_0x33c3d9,_0x5ce079,_0x3fe084,_0x48454a,_0x4739e2,_0x73d9ed,_0x23a685,_0x4c3ac6){var _0x4a8bd9={};var _0x282400={'Authorization':'Token\x20token='+_0x73d9ed[_0xd29c('0x39')]};_0x73d9ed[_0xd29c('0x3a')]=intUtil[_0xd29c('0x3b')](_0x73d9ed[_0xd29c('0x3a')]);_0x73d9ed[_0xd29c('0x3c')]=intUtil[_0xd29c('0x3b')](_0x73d9ed[_0xd29c('0x3c')]);var _0x5f301f=_0x73d9ed[_0xd29c('0x3a')];_0x4a8bd9[_0xd29c('0x20')]=_0x73d9ed['username'];_0x4a8bd9['contactNumber']=_0x4c3ac6[_0xd29c('0x3d')]()===_0xd29c('0x3e')?_0x5ce079[_0xd29c('0x3f')]:_0x5ce079[_0xd29c('0x40')];_0x4a8bd9[_0xd29c('0x41')]=_0x4c3ac6===_0xd29c('0x42')||_0x4c3ac6==='unmanaged'?'queue':'outbound';if(_0x48454a){_0x4a8bd9['agentEmail']=_0x48454a['email'];}var _0x3f3c4f=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x73d9ed['serverUrl'],_0x5ce079[_0xd29c('0x43')],md5(_0x5ce079[_0xd29c('0x43')]));if(_0x4739e2&&_0x4739e2[_0xd29c('0x44')]){logger[_0xd29c('0xf')](_0xd29c('0x45'),_0xd29c('0x46'));_0x5ce079['recordingURL']=_0x3f3c4f;}else if(_0x23a685&&_0x23a685[_0xd29c('0x47')]&&_0x23a685[_0xd29c('0x47')]!=='none'){logger[_0xd29c('0xf')]('[OUTBOUND]',_0xd29c('0x46'));_0x5ce079[_0xd29c('0x48')]=_0x3f3c4f;}else{_0x5ce079[_0xd29c('0x48')]='';}return getAdminId(_0x4a8bd9,_0x4c3ac6,_0x282400,_0x5f301f)['then'](getUser(_0x4c3ac6,_0x282400,_0x5f301f))[_0xd29c('0x11')](getEndUser(_0x4c3ac6,_0x282400,_0x5f301f))[_0xd29c('0x11')](getTicket(_0x4c3ac6,_0x282400,_0x5f301f,_0x3fe084,_0x5ce079))[_0xd29c('0x11')](function(_0x4e71c5){logger[_0xd29c('0xf')](util[_0xd29c('0x25')](_0xd29c('0x49'),_0x4e71c5[_0xd29c('0x4a')]));if(_0x4c3ac6!==_0xd29c('0x4b')){logger['info']('['+[_0x4c3ac6[_0xd29c('0x19')]()]+']',_0xd29c('0x4c'));emit(_0x5f301f,_0x48454a[_0xd29c('0x4d')],_0x4e71c5[_0xd29c('0x28')]);}})[_0xd29c('0x17')](function(_0x36c05e){logger[_0xd29c('0x18')]('['+[_0x4c3ac6[_0xd29c('0x19')]()]+_0xd29c('0x4e'),util['inspect'](_0x36c05e,{'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 c6f18fe..9de7cd7 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 _0xaa61=['error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','data2','lodash','./zendesk','./salesforce','./freshdesk','./zoho','./desk','./vtiger','./servicenow','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','dynamics365','freshsales','exec','includes','data1','toLowerCase','find','Configurations','data3','queue','routeId','outbound','log','unmanaged','unknown\x20integration'];(function(_0x160103,_0xe39030){var _0x41441b=function(_0x9b1e8){while(--_0x9b1e8){_0x160103['push'](_0x160103['shift']());}};_0x41441b(++_0xe39030);}(_0xaa61,0xfb));var _0x1aa6=function(_0x4bbfeb,_0x2bd851){_0x4bbfeb=_0x4bbfeb-0x0;var _0x2df4a3=_0xaa61[_0x4bbfeb];return _0x2df4a3;};'use strict';var _=require(_0x1aa6('0x0'));var util=require('util');var zendesk=require(_0x1aa6('0x1'));var salesforce=require(_0x1aa6('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x1aa6('0x3'));var zoho=require(_0x1aa6('0x4'));var desk=require(_0x1aa6('0x5'));var vtiger=require(_0x1aa6('0x6'));var servicenow=require(_0x1aa6('0x7'));var dynamics365=require('./dynamics365');var freshsales=require('./freshsales');var integrations=[_0x1aa6('0x8'),_0x1aa6('0x9'),_0x1aa6('0xa'),_0x1aa6('0xb'),_0x1aa6('0xc'),_0x1aa6('0xd'),'vtiger',_0x1aa6('0xe'),_0x1aa6('0xf'),'servicenow'];exports[_0x1aa6('0x10')]=function(_0x5bb69c,_0x5eac92,_0x13d835,_0x211a5f,_0x571c72,_0x5131ed){if(_0x13d835){if(_[_0x1aa6('0x11')](integrations,_0x5bb69c[_0x1aa6('0x12')]['toLowerCase']())){try{var _0x466aa8=null;var _0x1bbb1b='';var _0x3cf4b4=_0x13d835[_0x5bb69c[_0x1aa6('0x12')][_0x1aa6('0x13')]()];if(_0x3cf4b4){var _0x2a6a74=_0x3cf4b4[_0x5bb69c['data2']];if(_0x2a6a74){var _0x24f1c3=_[_0x1aa6('0x14')](_0x2a6a74[_0x1aa6('0x15')],{'id':parseInt(_0x5bb69c[_0x1aa6('0x16')],0xa)});if(_0x24f1c3){if(_0x211a5f){if(_0x571c72&&_0x5eac92[_0x1aa6('0x17')]){_0x1bbb1b=_0x1aa6('0x17');}else if(_0x5eac92[_0x1aa6('0x18')]){_0x1bbb1b=_0x1aa6('0x19');}else{console[_0x1aa6('0x1a')]('EVENT\x20UNKNOWN',_0x5eac92);}}else{_0x1bbb1b=_0x1aa6('0x1b');}switch(_0x5bb69c[_0x1aa6('0x12')][_0x1aa6('0x13')]()){case _0x1aa6('0x8'):zendesk[_0x1bbb1b](_0x5bb69c,_0x5eac92,_0x24f1c3,_0x211a5f,_0x571c72,_0x2a6a74,_0x5131ed);break;case _0x1aa6('0x9'):salesforce[_0x1bbb1b](_0x5bb69c,_0x5eac92,_0x24f1c3,_0x211a5f,_0x571c72,_0x2a6a74,_0x5131ed);break;case _0x1aa6('0xa'):sugarcrm[_0x1bbb1b](_0x5bb69c,_0x5eac92,_0x24f1c3,_0x211a5f,_0x571c72,_0x2a6a74,_0x5131ed);break;case _0x1aa6('0xb'):freshdesk[_0x1bbb1b](_0x5bb69c,_0x5eac92,_0x24f1c3,_0x211a5f,_0x571c72,_0x2a6a74,_0x5131ed);break;case _0x1aa6('0xc'):zoho[_0x1bbb1b](_0x5bb69c,_0x5eac92,_0x24f1c3,_0x211a5f,_0x571c72,_0x2a6a74,_0x5131ed);break;case _0x1aa6('0xd'):desk[_0x1bbb1b](_0x5bb69c,_0x5eac92,_0x24f1c3,_0x211a5f,_0x571c72,_0x2a6a74,_0x5131ed);break;case'vtiger':vtiger[_0x1bbb1b](_0x5bb69c,_0x5eac92,_0x24f1c3,_0x211a5f,_0x571c72,_0x2a6a74,_0x5131ed);break;case _0x1aa6('0xf'):freshsales['cs'](_0x5bb69c,_0x5eac92,_0x24f1c3,_0x211a5f,_0x571c72,_0x2a6a74,_0x5131ed,_0x1bbb1b);break;case'servicenow':servicenow['cs'](_0x5bb69c,_0x5eac92,_0x24f1c3,_0x211a5f,_0x571c72,_0x2a6a74,_0x5131ed,_0x1bbb1b);break;case _0x1aa6('0xe'):dynamics365['cs'](_0x5bb69c,_0x5eac92,_0x24f1c3,_0x211a5f,_0x571c72,_0x2a6a74,_0x5131ed,_0x1bbb1b);break;default:console[_0x1aa6('0x1a')](_0x1aa6('0x1c'));}}else{_0x466aa8=require('../../../../config/logger')(_0x5bb69c['data1']['toLowerCase']());_0x466aa8[_0x1aa6('0x1d')](_0x1aa6('0x1e'),util[_0x1aa6('0x1f')](_0x1aa6('0x20'),_0x5bb69c['data1']['toLowerCase'](),_0x5bb69c[_0x1aa6('0x16')]));}}else{_0x466aa8=require('../../../../config/logger')(_0x5bb69c[_0x1aa6('0x12')][_0x1aa6('0x13')]());_0x466aa8[_0x1aa6('0x1d')]('[EXEC]',util[_0x1aa6('0x1f')](_0x1aa6('0x21'),_0x5bb69c[_0x1aa6('0x12')]['toLowerCase'](),_0x5bb69c[_0x1aa6('0x22')]));}}else{}}catch(_0x7ae41d){console[_0x1aa6('0x1d')](_0x7ae41d);}}}}; \ No newline at end of file +var _0x08d3=['data3','queue','routeId','log','EVENT\x20UNKNOWN','unmanaged','servicenow','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','data2','lodash','./salesforce','./freshdesk','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','exec','includes','data1','toLowerCase','find','Configurations'];(function(_0x41c4db,_0x27517f){var _0x51c773=function(_0x2d4d57){while(--_0x2d4d57){_0x41c4db['push'](_0x41c4db['shift']());}};_0x51c773(++_0x27517f);}(_0x08d3,0x105));var _0x308d=function(_0x52564b,_0x24c4eb){_0x52564b=_0x52564b-0x0;var _0x31042d=_0x08d3[_0x52564b];return _0x31042d;};'use strict';var _=require(_0x308d('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0x308d('0x1'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x308d('0x2'));var zoho=require('./zoho');var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0x308d('0x3'));var dynamics365=require(_0x308d('0x4'));var freshsales=require(_0x308d('0x5'));var integrations=[_0x308d('0x6'),_0x308d('0x7'),_0x308d('0x8'),_0x308d('0x9'),_0x308d('0xa'),_0x308d('0xb'),_0x308d('0xc'),'dynamics365','freshsales','servicenow'];exports[_0x308d('0xd')]=function(_0x5c7b90,_0x2c63d2,_0x257b50,_0xd93e67,_0x57060b,_0x34eb3c){if(_0x257b50){if(_[_0x308d('0xe')](integrations,_0x5c7b90[_0x308d('0xf')][_0x308d('0x10')]())){try{var _0x1213ad=null;var _0x1a6288='';var _0x594700=_0x257b50[_0x5c7b90[_0x308d('0xf')][_0x308d('0x10')]()];if(_0x594700){var _0x8d928f=_0x594700[_0x5c7b90['data2']];if(_0x8d928f){var _0x364215=_[_0x308d('0x11')](_0x8d928f[_0x308d('0x12')],{'id':parseInt(_0x5c7b90[_0x308d('0x13')],0xa)});if(_0x364215){if(_0xd93e67){if(_0x57060b&&_0x2c63d2['queue']){_0x1a6288=_0x308d('0x14');}else if(_0x2c63d2[_0x308d('0x15')]){_0x1a6288='outbound';}else{console[_0x308d('0x16')](_0x308d('0x17'),_0x2c63d2);}}else{_0x1a6288=_0x308d('0x18');}switch(_0x5c7b90[_0x308d('0xf')]['toLowerCase']()){case _0x308d('0x6'):zendesk[_0x1a6288](_0x5c7b90,_0x2c63d2,_0x364215,_0xd93e67,_0x57060b,_0x8d928f,_0x34eb3c);break;case'salesforce':salesforce[_0x1a6288](_0x5c7b90,_0x2c63d2,_0x364215,_0xd93e67,_0x57060b,_0x8d928f,_0x34eb3c);break;case _0x308d('0x8'):sugarcrm[_0x1a6288](_0x5c7b90,_0x2c63d2,_0x364215,_0xd93e67,_0x57060b,_0x8d928f,_0x34eb3c);break;case _0x308d('0x9'):freshdesk[_0x1a6288](_0x5c7b90,_0x2c63d2,_0x364215,_0xd93e67,_0x57060b,_0x8d928f,_0x34eb3c);break;case _0x308d('0xa'):zoho[_0x1a6288](_0x5c7b90,_0x2c63d2,_0x364215,_0xd93e67,_0x57060b,_0x8d928f,_0x34eb3c);break;case _0x308d('0xb'):desk[_0x1a6288](_0x5c7b90,_0x2c63d2,_0x364215,_0xd93e67,_0x57060b,_0x8d928f,_0x34eb3c);break;case'vtiger':vtiger[_0x1a6288](_0x5c7b90,_0x2c63d2,_0x364215,_0xd93e67,_0x57060b,_0x8d928f,_0x34eb3c);break;case'freshsales':freshsales['cs'](_0x5c7b90,_0x2c63d2,_0x364215,_0xd93e67,_0x57060b,_0x8d928f,_0x34eb3c,_0x1a6288);break;case _0x308d('0x19'):servicenow['cs'](_0x5c7b90,_0x2c63d2,_0x364215,_0xd93e67,_0x57060b,_0x8d928f,_0x34eb3c,_0x1a6288);break;case _0x308d('0x1a'):dynamics365['cs'](_0x5c7b90,_0x2c63d2,_0x364215,_0xd93e67,_0x57060b,_0x8d928f,_0x34eb3c,_0x1a6288);break;default:console[_0x308d('0x16')](_0x308d('0x1b'));}}else{_0x1213ad=require(_0x308d('0x1c'))(_0x5c7b90[_0x308d('0xf')][_0x308d('0x10')]());_0x1213ad[_0x308d('0x1d')](_0x308d('0x1e'),util[_0x308d('0x1f')](_0x308d('0x20'),_0x5c7b90[_0x308d('0xf')][_0x308d('0x10')](),_0x5c7b90[_0x308d('0x13')]));}}else{_0x1213ad=require(_0x308d('0x1c'))(_0x5c7b90[_0x308d('0xf')][_0x308d('0x10')]());_0x1213ad[_0x308d('0x1d')](_0x308d('0x1e'),util['format'](_0x308d('0x21'),_0x5c7b90[_0x308d('0xf')][_0x308d('0x10')](),_0x5c7b90[_0x308d('0x22')]));}}else{}}catch(_0x5a59ec){console[_0x308d('0x1d')](_0x5a59ec);}}}}; \ 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 6bfd92f..b9bef5b 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 _0xaeda=['[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','newTab','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','calleridname','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','catch','moment','md5','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','getString','Subjects','Descriptions','Task','ActivityDate','utc','IsRecurrence','endUserType','lead','WhoId','WhatId','ticketType','Case','contact','ContactId','account','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','find','execute','then','length','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','additionalSearchContact','merge','$or','Contact','cloneDeep','additionalSearchLead','Lead','additionalSearchAccount','Account','first','Phone','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','forEach','includes','picklist','idField','toString','variableName','customVariable','Variable','name','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','Fields'];(function(_0x467c00,_0x5bd387){var _0xb94c66=function(_0x2275c8){while(--_0x2275c8){_0x467c00['push'](_0x467c00['shift']());}};_0xb94c66(++_0x5bd387);}(_0xaeda,0x8c));var _0xaaed=function(_0x1d980d,_0x1d6bbb){_0x1d980d=_0x1d980d-0x0;var _0x3d57d8=_0xaeda[_0x1d980d];return _0x3d57d8;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0xaaed('0x0'));var BPromise=require('bluebird');var md5=require(_0xaaed('0x1'));var jsforce=require(_0xaaed('0x2'));var util=require(_0xaaed('0x3'));var Redis=require(_0xaaed('0x4'));var intUtil=require('./util');var config=require(_0xaaed('0x5'));var logger=require(_0xaaed('0x6'))(_0xaaed('0x7'));config[_0xaaed('0x8')]=_[_0xaaed('0x9')](config['redis'],{'host':_0xaaed('0xa'),'port':0x18eb});var io=require(_0xaaed('0xb'))(new Redis(config[_0xaaed('0x8')]));function emit(_0x5c962b,_0x324e96,_0x26c1b6){io['to'](_0x5c962b)[_0xaaed('0xc')](_0x324e96,_0x26c1b6);}function getTicket(_0x23dd48,_0x4153d7,_0x132edb,_0xeb5bd1,_0x5269a4,_0x4ff8b0,_0x106c3f,_0x595f75){var _0x2b9fcc=Object['assign']({},{'OwnerId':_0x4153d7['id'],'Subject':intUtil[_0xaaed('0xd')](_0xeb5bd1[_0xaaed('0xe')],_0x5269a4,'\x20'),'Description':intUtil[_0xaaed('0xd')](_0xeb5bd1[_0xaaed('0xf')],_0x5269a4,'\x0a')},getCustomFields(_0x4ff8b0,_0x5269a4));if(_0x132edb){if(_0xeb5bd1['ticketType']===_0xaaed('0x10')){_0x2b9fcc[_0xaaed('0x11')]=moment[_0xaaed('0x12')]();_0x2b9fcc['IsReminderSet']=![];_0x2b9fcc[_0xaaed('0x13')]=![];if(_0x132edb[_0xaaed('0x14')]==='contact'||_0x132edb[_0xaaed('0x14')]===_0xaaed('0x15')){_0x2b9fcc[_0xaaed('0x16')]=_0x132edb['id'];}else if(_0x132edb[_0xaaed('0x14')]==='account'){_0x2b9fcc[_0xaaed('0x17')]=_0x132edb['id'];}}else if(_0xeb5bd1[_0xaaed('0x18')]===_0xaaed('0x19')){if(_0x132edb[_0xaaed('0x14')]===_0xaaed('0x1a')){_0x2b9fcc[_0xaaed('0x1b')]=_0x132edb['id'];}else if(_0x132edb['endUserType']===_0xaaed('0x1c')){_0x2b9fcc['AccountId']=_0x132edb['id'];}else if(_0x132edb[_0xaaed('0x14')]==='lead'&&_0xeb5bd1[_0xaaed('0x1d')]){_0x2b9fcc[_0xeb5bd1[_0xaaed('0x1d')]]=_0x132edb['id'];}else{logger[_0xaaed('0x1e')](_0xaaed('0x1f'));}}}return _0x106c3f[_0xaaed('0x20')](_0xeb5bd1[_0xaaed('0x18')])[_0xaaed('0x21')](_0x2b9fcc);}function getUser(_0x4cef4d,_0x463e6d,_0x3d09da){if(!_[_0xaaed('0x22')](_0x463e6d)&&intUtil[_0xaaed('0x23')](_0x463e6d)){var _0x27b18c={'Email':_0x463e6d};var _0x360711={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3d09da[_0xaaed('0x20')]('User')[_0xaaed('0x24')](_0x27b18c,_0x360711)[_0xaaed('0x25')]()[_0xaaed('0x26')](function(_0x41934d){if(_0x41934d[_0xaaed('0x27')]){var _0x3e0b32=_['find'](_0x41934d,function(_0x4762c2){return _0x4762c2['Email']===_0x463e6d;});if(_0x3e0b32){logger['info'](_0xaaed('0x28'),_0x463e6d);return BPromise[_0xaaed('0x29')]({'id':_0x3e0b32['Id'],'name':_0x3e0b32[_0xaaed('0x2a')]});}}else{logger[_0xaaed('0x1e')](_0xaaed('0x2b'),_0x463e6d);return _0x3d09da[_0xaaed('0x2c')]()['then'](function(_0x39a948){return BPromise[_0xaaed('0x29')]({'id':_0x39a948['user_id'],'name':_0x39a948['display_name']});});}});}else{logger[_0xaaed('0x1e')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x463e6d);return _0x3d09da[_0xaaed('0x2c')]()['then'](function(_0x370a9c){return BPromise[_0xaaed('0x29')]({'id':_0x370a9c[_0xaaed('0x2d')],'name':_0x370a9c[_0xaaed('0x2e')]});});}}function getEndUser(_0x58a43d,_0x547f4a,_0x2eedc7,_0x31b34c,_0x38b6c3){var _0x41023a={'$or':{'Phone':_0x31b34c}};var _0x433969={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xaaed('0x29')]()[_0xaaed('0x26')](function(){logger[_0xaaed('0x1e')](_0xaaed('0x2f'),_0x31b34c,_0x547f4a[_0xaaed('0x30')]);switch(_0x547f4a['moduleSearch']){case'contact_lead':var _0x3e6a56=_['cloneDeep'](_0x41023a);if(_0x547f4a['additionalSearchContact']){var _0x1285d0={};_0x1285d0[_0x547f4a[_0xaaed('0x31')]]=_0x31b34c;_[_0xaaed('0x32')](_0x3e6a56[_0xaaed('0x33')],_0x1285d0);}return _0x38b6c3['sobject'](_0xaaed('0x34'))[_0xaaed('0x24')](_0x3e6a56,_0x433969)['execute']()[_0xaaed('0x26')](function(_0x4c496f){if(_0x4c496f&&_0x4c496f[_0xaaed('0x27')]){return _0x4c496f;}else{var _0x2f86e9=_[_0xaaed('0x35')](_0x41023a);if(_0x547f4a['additionalSearchLead']){var _0x15a086={};_0x15a086[_0x547f4a[_0xaaed('0x36')]]=_0x31b34c;_['merge'](_0x2f86e9[_0xaaed('0x33')],_0x15a086);}return _0x38b6c3[_0xaaed('0x20')](_0xaaed('0x37'))[_0xaaed('0x24')](_0x2f86e9,_0x433969);}});case'account_contact_lead':var _0x2ae833=_['cloneDeep'](_0x41023a);if(_0x547f4a[_0xaaed('0x38')]){var _0x1285d0={};_0x1285d0[_0x547f4a[_0xaaed('0x38')]]=_0x31b34c;_['merge'](_0x2ae833['$or'],_0x1285d0);}return _0x38b6c3[_0xaaed('0x20')](_0xaaed('0x39'))[_0xaaed('0x24')](_0x2ae833,_0x433969)[_0xaaed('0x25')]()[_0xaaed('0x26')](function(_0x13d485){if(_0x13d485&&_0x13d485[_0xaaed('0x27')]){return _0x13d485;}else{var _0x55db3b=_[_0xaaed('0x35')](_0x41023a);if(_0x547f4a[_0xaaed('0x31')]){var _0x45cf63={};_0x45cf63[_0x547f4a[_0xaaed('0x31')]]=_0x31b34c;_[_0xaaed('0x32')](_0x55db3b[_0xaaed('0x33')],_0x45cf63);}return _0x38b6c3[_0xaaed('0x20')]('Contact')[_0xaaed('0x24')](_0x55db3b,_0x433969)[_0xaaed('0x26')](function(_0x297ecc){if(_0x297ecc&&_0x297ecc[_0xaaed('0x27')]){return _0x297ecc;}else{var _0x24bde5=_[_0xaaed('0x35')](_0x41023a);if(_0x547f4a[_0xaaed('0x36')]){var _0x22ff8a={};_0x22ff8a[_0x547f4a[_0xaaed('0x36')]]=_0x31b34c;_['merge'](_0x24bde5[_0xaaed('0x33')],_0x22ff8a);}return _0x38b6c3[_0xaaed('0x20')]('Lead')[_0xaaed('0x24')](_0x24bde5,_0x433969);}});}});case _0xaaed('0x1a'):var _0x3e6a56=_[_0xaaed('0x35')](_0x41023a);if(_0x547f4a[_0xaaed('0x31')]){var _0x1285d0={};_0x1285d0[_0x547f4a[_0xaaed('0x31')]]=_0x31b34c;_[_0xaaed('0x32')](_0x3e6a56[_0xaaed('0x33')],_0x1285d0);}return _0x38b6c3[_0xaaed('0x20')]('Contact')[_0xaaed('0x24')](_0x3e6a56,_0x433969)['execute']();case _0xaaed('0x15'):var _0x5a545c=_[_0xaaed('0x35')](_0x41023a);if(_0x547f4a[_0xaaed('0x36')]){var _0x1285d0={};_0x1285d0[_0x547f4a[_0xaaed('0x36')]]=_0x31b34c;_[_0xaaed('0x32')](_0x5a545c[_0xaaed('0x33')],_0x1285d0);}return _0x38b6c3[_0xaaed('0x20')](_0xaaed('0x37'))[_0xaaed('0x24')](_0x5a545c,_0x433969);case _0xaaed('0x1c'):var _0x2ae833=_[_0xaaed('0x35')](_0x41023a);if(_0x547f4a[_0xaaed('0x38')]){var _0x1285d0={};_0x1285d0[_0x547f4a[_0xaaed('0x38')]]=_0x31b34c;_[_0xaaed('0x32')](_0x2ae833[_0xaaed('0x33')],_0x1285d0);}return _0x38b6c3['sobject']('Account')['find'](_0x2ae833,_0x433969);default:return null;}})[_0xaaed('0x26')](function(_0x18e9ef){if(_0x18e9ef&&_0x18e9ef[_0xaaed('0x27')]){var _0x518e22=_[_0xaaed('0x3a')](_0x18e9ef);if(_0x518e22){return BPromise[_0xaaed('0x29')]({'id':_0x518e22['Id'],'name':_0x518e22[_0xaaed('0x2a')],'phone':_0x518e22[_0xaaed('0x3b')],'endUserType':_0x518e22['attributes'][_0xaaed('0x3c')][_0xaaed('0x3d')]()});}}})[_0xaaed('0x26')](function(_0xf2caa){if(_0xf2caa){logger[_0xaaed('0x1e')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0xf2caa[_0xaaed('0x14')],_0x31b34c);return BPromise[_0xaaed('0x29')](_0xf2caa);}else{logger[_0xaaed('0x1e')](_0xaaed('0x3e'),_0x31b34c);var _0x17d305={'Phone':_0x31b34c};if(_0x547f4a[_0xaaed('0x3f')]){if(_0x547f4a[_0xaaed('0x3f')]===_0xaaed('0x1a')){logger[_0xaaed('0x1e')](_0xaaed('0x40'),_0x31b34c,_0x547f4a[_0xaaed('0x3f')]);_0x17d305[_0xaaed('0x41')]=_0x2eedc7!==''?_0x2eedc7:util['format']('Caller\x20-\x20%s',_0x31b34c);}else if(_0x547f4a[_0xaaed('0x3f')]===_0xaaed('0x15')){logger[_0xaaed('0x1e')](_0xaaed('0x40'),_0x31b34c,_0x547f4a[_0xaaed('0x3f')]);_0x17d305[_0xaaed('0x41')]=_0x2eedc7!==_0xaaed('0x42')?_0x2eedc7:util[_0xaaed('0x43')](_0xaaed('0x44'),_0x31b34c);_0x17d305[_0xaaed('0x45')]='No\x20Company';}else if(_0x547f4a[_0xaaed('0x3f')]==='account'){logger[_0xaaed('0x1e')](_0xaaed('0x40'),_0x31b34c,_0x547f4a['moduleCreate']);_0x17d305[_0xaaed('0x2a')]=_0x2eedc7!==_0xaaed('0x42')?_0x2eedc7:util[_0xaaed('0x43')](_0xaaed('0x44'),_0x31b34c);}else{return null;}}return _0x38b6c3['sobject'](_['upperFirst'](_0x547f4a[_0xaaed('0x3f')]))[_0xaaed('0x21')](_0x17d305)['then'](function(_0x459623){return BPromise[_0xaaed('0x29')]({'id':_0x459623['id'],'endUserType':_0x547f4a[_0xaaed('0x3f')]});});}});}function getCustomFields(_0x4bb862,_0x50571a){var _0x53de76={};if(_0x4bb862[_0xaaed('0x27')]>0x0){_[_0xaaed('0x46')](_0x4bb862,function(_0x4099be){if(_[_0xaaed('0x47')](['string',_0xaaed('0x48')],_0x4099be[_0xaaed('0x3c')])&&_0x4099be[_0xaaed('0x49')]){_0x53de76[_0x4099be['idField']]=_0x4099be['content'][_0xaaed('0x4a')]();}else if(_0x4099be[_0xaaed('0x3c')]==='variable'&&_0x4099be[_0xaaed('0x4b')]&&_0x4099be[_0xaaed('0x49')]){_0x50571a[_0x4099be[_0xaaed('0x4b')]]&&(_0x53de76[_0x4099be[_0xaaed('0x49')]]=_0x50571a[_0x4099be[_0xaaed('0x4b')]][_0xaaed('0x4a')]());}else if(_0x4099be['type']===_0xaaed('0x4c')&&_0x4099be[_0xaaed('0x4d')]&&_0x4099be['Variable']['name']&&_0x4099be[_0xaaed('0x49')]){_0x50571a[_0x4099be[_0xaaed('0x4d')]['name']['toLowerCase']()]&&(_0x53de76[_0x4099be['idField']]=_0x50571a[_0x4099be[_0xaaed('0x4d')][_0xaaed('0x4e')][_0xaaed('0x3d')]()][_0xaaed('0x4a')]());}});}return _0x53de76;}function getConnection(_0x3bcd78){var _0x213310=_0x3bcd78['password'][_0xaaed('0x4f')](_0x3bcd78[_0xaaed('0x50')]);var _0x13a17a=new jsforce[(_0xaaed('0x51'))]({'oauth2':{'loginUrl':_0x3bcd78[_0xaaed('0x52')]||_0xaaed('0x53'),'clientId':_0x3bcd78[_0xaaed('0x54')],'clientSecret':_0x3bcd78[_0xaaed('0x55')]}});return _0x13a17a[_0xaaed('0x56')](_0x3bcd78[_0xaaed('0x57')],_0x213310)[_0xaaed('0x26')](function(){logger[_0xaaed('0x1e')]('Connection\x20established.');return _0x13a17a;});}exports[_0xaaed('0x58')]=function(_0x17d136,_0x121e3a,_0x3e9dcc,_0x4d1d9e,_0xb1cc0f,_0x42d3b0){var _0x4496e7,_0xd58eb7,_0x5d95a6,_0x2c3956;_0x42d3b0['serverUrl']=intUtil[_0xaaed('0x59')](_0x42d3b0[_0xaaed('0x5a')]);_0x42d3b0[_0xaaed('0x52')]=intUtil[_0xaaed('0x59')](_0x42d3b0['remoteUri']);if(_0xb1cc0f&&_0xb1cc0f[_0xaaed('0x5b')]){logger[_0xaaed('0x1e')](_0xaaed('0x5c'),_0xaaed('0x5d'));_0x121e3a[_0xaaed('0x5e')]=util[_0xaaed('0x43')](_0xaaed('0x5f'),_0x42d3b0[_0xaaed('0x5a')],_0x121e3a[_0xaaed('0x60')],md5(_0x121e3a[_0xaaed('0x60')]));}else{_0x121e3a['recordingURL']='';}return getConnection(_0x42d3b0)[_0xaaed('0x26')](function(_0x38b47e){_0x2c3956=_0x38b47e;return getUser(_0x42d3b0,_0x4d1d9e[_0xaaed('0x61')],_0x2c3956);})[_0xaaed('0x26')](function(_0x28866e){_0x4496e7=_0x28866e;return getEndUser(_0x42d3b0,_0x3e9dcc,_0x121e3a['calleridname'],_0x121e3a['calleridnum'],_0x2c3956);})[_0xaaed('0x26')](function(_0x54e75b){_0xd58eb7=_0x54e75b;return getTicket(_0x42d3b0,_0x4496e7,_0xd58eb7,_0x3e9dcc,_0x121e3a,_0x3e9dcc['Fields'],_0x2c3956,_0xaaed('0x58'));})['then'](function(_0x112c87){_0x5d95a6=_0x112c87;logger['info'](_0xaaed('0x62'),_0x5d95a6['id']);logger[_0xaaed('0x1e')](_0xaaed('0x63'),_0x5d95a6['id'],_0x4d1d9e[_0xaaed('0x4e')],_0x42d3b0[_0xaaed('0x3c')]);switch(_0x42d3b0['type']){case'integrationTab':emit(util[_0xaaed('0x43')](_0xaaed('0x64'),_0x4d1d9e[_0xaaed('0x4e')]),_0xaaed('0x65'),{'recordId':_0x5d95a6['id']});break;case'newTab':emit(util[_0xaaed('0x43')](_0xaaed('0x64'),_0x4d1d9e[_0xaaed('0x4e')]),_0xaaed('0x66'),{'uri':util[_0xaaed('0x43')]('%s/%s/e',_0x2c3956[_0xaaed('0x67')],_0x5d95a6['id'])});break;default:logger[_0xaaed('0x68')](_0xaaed('0x69'));}})['catch'](function(_0x2bab04){logger[_0xaaed('0x68')](_0xaaed('0x5c'),_0x2bab04);});};exports[_0xaaed('0x6a')]=function(_0x491474,_0x478ba1,_0x2092d7,_0x22bedf,_0x204267,_0x54a129,_0x293a32){var _0x78e209,_0x452f5c,_0x496b8f,_0x39239f;_0x54a129[_0xaaed('0x5a')]=intUtil[_0xaaed('0x59')](_0x54a129[_0xaaed('0x5a')]);_0x54a129['remoteUri']=intUtil['stripTrailingSlash'](_0x54a129[_0xaaed('0x52')]);if(_0x293a32&&_0x293a32[_0xaaed('0x6b')]&&_0x293a32[_0xaaed('0x6b')]!==_0xaaed('0x6c')){logger[_0xaaed('0x1e')](_0xaaed('0x6d'),_0xaaed('0x5d'));_0x478ba1['recordingURL']=util[_0xaaed('0x43')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x54a129['serverUrl'],_0x478ba1[_0xaaed('0x60')],md5(_0x478ba1[_0xaaed('0x60')]));}return getConnection(_0x54a129)[_0xaaed('0x26')](function(_0x45c9ae){_0x39239f=_0x45c9ae;return getUser(_0x54a129,_0x22bedf[_0xaaed('0x61')],_0x39239f);})[_0xaaed('0x26')](function(_0x801d6b){_0x78e209=_0x801d6b;return getEndUser(_0x54a129,_0x2092d7,_0x478ba1[_0xaaed('0x6e')],_0x478ba1['destcalleridnum'],_0x39239f);})['then'](function(_0x2be3fb){_0x452f5c=_0x2be3fb;return getTicket(_0x54a129,_0x78e209,_0x452f5c,_0x2092d7,_0x478ba1,_0x2092d7[_0xaaed('0x6f')],_0x39239f,'outbound');})[_0xaaed('0x26')](function(_0x36927f){_0x496b8f=_0x36927f;logger[_0xaaed('0x1e')](_0xaaed('0x70'),_0x496b8f['id']);logger[_0xaaed('0x1e')](_0xaaed('0x71'),_0x496b8f['id'],_0x22bedf[_0xaaed('0x4e')],_0x54a129['type']);switch(_0x54a129[_0xaaed('0x3c')]){case _0xaaed('0x72'):emit(util[_0xaaed('0x43')](_0xaaed('0x64'),_0x22bedf[_0xaaed('0x4e')]),_0xaaed('0x65'),{'recordId':_0x496b8f['id']});break;case _0xaaed('0x73'):emit(util['format'](_0xaaed('0x64'),_0x22bedf[_0xaaed('0x4e')]),_0xaaed('0x66'),{'uri':util[_0xaaed('0x43')](_0xaaed('0x74'),_0x39239f[_0xaaed('0x67')],_0x496b8f['id'])});break;default:logger[_0xaaed('0x68')](_0xaaed('0x6d'),_0xaaed('0x75'));}})['catch'](function(_0x1068b3){logger[_0xaaed('0x68')](_0xaaed('0x6d'),_0x1068b3);});};exports[_0xaaed('0x76')]=function(_0x2ead19,_0x362acc,_0x17bacd,_0x495580,_0x5ad3fb,_0x4efb64){var _0x175c60,_0x148b35,_0x3093da,_0x2680d7;_0x4efb64['serverUrl']=intUtil['stripTrailingSlash'](_0x4efb64['serverUrl']);_0x4efb64[_0xaaed('0x52')]=intUtil['stripTrailingSlash'](_0x4efb64[_0xaaed('0x52')]);if(_0x5ad3fb&&_0x5ad3fb[_0xaaed('0x5b')]){logger[_0xaaed('0x1e')]('['+_0x362acc[_0xaaed('0x77')][_0xaaed('0x78')]()+']','Recording\x20is\x20enabled!');_0x362acc['recordingURL']=util[_0xaaed('0x43')](_0xaaed('0x5f'),_0x4efb64[_0xaaed('0x5a')],_0x362acc[_0xaaed('0x60')],md5(_0x362acc[_0xaaed('0x60')]));}else{_0x362acc[_0xaaed('0x5e')]='';}return getConnection(_0x4efb64)['then'](function(_0x818338){_0x2680d7=_0x818338;if(!_[_0xaaed('0x22')](_0x495580)){return getUser(_0x4efb64,_0x495580[_0xaaed('0x4e')],_0x2680d7);}else{return getUser(_0x4efb64,null,_0x2680d7);}})[_0xaaed('0x26')](function(_0x389485){_0x175c60=_0x389485;return getEndUser(_0x4efb64,_0x17bacd,_0x362acc[_0xaaed('0x79')],_0x362acc[_0xaaed('0x7a')],_0x2680d7);})['then'](function(_0x3dc133){_0x148b35=_0x3dc133;return getTicket(_0x4efb64,_0x175c60,_0x148b35,_0x17bacd,_0x362acc,_0x17bacd[_0xaaed('0x6f')],_0x2680d7);})[_0xaaed('0x26')](function(_0x547b6d){_0x3093da=_0x547b6d;logger['info']('['+_0x362acc['lastevent']['toUpperCase']()+_0xaaed('0x7b'),_0x3093da['id']);logger[_0xaaed('0x1e')]('['+_0x362acc[_0xaaed('0x77')]['toUpperCase']()+_0xaaed('0x7c'),_0x4efb64[_0xaaed('0x3c')]);})[_0xaaed('0x7d')](function(_0x15f335){logger[_0xaaed('0x68')]('['+_0x362acc['lastevent']['toUpperCase']()+']',_0x15f335);});}; \ No newline at end of file +var _0xef93=['IsReminderSet','IsRecurrence','endUserType','account','Case','contact','ContactId','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','execute','then','length','find','Email','Agent\x20%s\x20found.','resolve','Name','identity','user_id','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','Contact','additionalSearchLead','$or','account_contact_lead','additionalSearchAccount','Account','Lead','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.','LastName','Caller\x20-\x20%s','','format','Company','upperFirst','includes','string','picklist','idField','toString','variable','variableName','customVariable','Variable','name','password','concat','https://login.salesforce.com','clientId','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','[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','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','remoteUri','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','catch','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','emit','getString','Subjects','Descriptions','ticketType','Task','utc'];(function(_0x26bbd1,_0xb274f3){var _0x26b1eb=function(_0x4cf794){while(--_0x4cf794){_0x26bbd1['push'](_0x26bbd1['shift']());}};_0x26b1eb(++_0xb274f3);}(_0xef93,0x1e6));var _0x3ef9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xef93[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3ef9('0x0'));var rp=require(_0x3ef9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x3ef9('0x2'));var jsforce=require('jsforce');var util=require(_0x3ef9('0x3'));var Redis=require(_0x3ef9('0x4'));var intUtil=require(_0x3ef9('0x5'));var config=require('../../../../config/environment');var logger=require(_0x3ef9('0x6'))('salesforce');config['redis']=_[_0x3ef9('0x7')](config[_0x3ef9('0x8')],{'host':_0x3ef9('0x9'),'port':0x18eb});var io=require(_0x3ef9('0xa'))(new Redis(config[_0x3ef9('0x8')]));function emit(_0x501684,_0x1ab8f6,_0x52299c){io['to'](_0x501684)[_0x3ef9('0xb')](_0x1ab8f6,_0x52299c);}function getTicket(_0x426d52,_0x539b70,_0x1dcf01,_0x35ca15,_0x3efd91,_0x3f8ba3,_0x94a44c,_0x577d17){var _0x3d191c=Object['assign']({},{'OwnerId':_0x539b70['id'],'Subject':intUtil[_0x3ef9('0xc')](_0x35ca15[_0x3ef9('0xd')],_0x3efd91,'\x20'),'Description':intUtil[_0x3ef9('0xc')](_0x35ca15[_0x3ef9('0xe')],_0x3efd91,'\x0a')},getCustomFields(_0x3f8ba3,_0x3efd91));if(_0x1dcf01){if(_0x35ca15[_0x3ef9('0xf')]===_0x3ef9('0x10')){_0x3d191c['ActivityDate']=moment[_0x3ef9('0x11')]();_0x3d191c[_0x3ef9('0x12')]=![];_0x3d191c[_0x3ef9('0x13')]=![];if(_0x1dcf01[_0x3ef9('0x14')]==='contact'||_0x1dcf01['endUserType']==='lead'){_0x3d191c['WhoId']=_0x1dcf01['id'];}else if(_0x1dcf01[_0x3ef9('0x14')]===_0x3ef9('0x15')){_0x3d191c['WhatId']=_0x1dcf01['id'];}}else if(_0x35ca15['ticketType']===_0x3ef9('0x16')){if(_0x1dcf01[_0x3ef9('0x14')]===_0x3ef9('0x17')){_0x3d191c[_0x3ef9('0x18')]=_0x1dcf01['id'];}else if(_0x1dcf01['endUserType']==='account'){_0x3d191c[_0x3ef9('0x19')]=_0x1dcf01['id'];}else if(_0x1dcf01[_0x3ef9('0x14')]===_0x3ef9('0x1a')&&_0x35ca15[_0x3ef9('0x1b')]){_0x3d191c[_0x35ca15['leadId']]=_0x1dcf01['id'];}else{logger[_0x3ef9('0x1c')](_0x3ef9('0x1d'));}}}return _0x94a44c[_0x3ef9('0x1e')](_0x35ca15[_0x3ef9('0xf')])[_0x3ef9('0x1f')](_0x3d191c);}function getUser(_0x47bfbe,_0x3056f4,_0x482504){if(!_[_0x3ef9('0x20')](_0x3056f4)&&intUtil['validateEmail'](_0x3056f4)){var _0xf7835d={'Email':_0x3056f4};var _0x3edab2={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x482504[_0x3ef9('0x1e')]('User')['find'](_0xf7835d,_0x3edab2)[_0x3ef9('0x21')]()[_0x3ef9('0x22')](function(_0x36fba2){if(_0x36fba2[_0x3ef9('0x23')]){var _0x21d063=_[_0x3ef9('0x24')](_0x36fba2,function(_0x3d280c){return _0x3d280c[_0x3ef9('0x25')]===_0x3056f4;});if(_0x21d063){logger[_0x3ef9('0x1c')](_0x3ef9('0x26'),_0x3056f4);return BPromise[_0x3ef9('0x27')]({'id':_0x21d063['Id'],'name':_0x21d063[_0x3ef9('0x28')]});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x3056f4);return _0x482504[_0x3ef9('0x29')]()[_0x3ef9('0x22')](function(_0x1e91b4){return BPromise[_0x3ef9('0x27')]({'id':_0x1e91b4[_0x3ef9('0x2a')],'name':_0x1e91b4['display_name']});});}});}else{logger[_0x3ef9('0x1c')](_0x3ef9('0x2b'),_0x3056f4);return _0x482504[_0x3ef9('0x29')]()[_0x3ef9('0x22')](function(_0x2006dc){return BPromise[_0x3ef9('0x27')]({'id':_0x2006dc[_0x3ef9('0x2a')],'name':_0x2006dc[_0x3ef9('0x2c')]});});}}function getEndUser(_0x434f60,_0xbb4fa4,_0x13d57c,_0x615b95,_0xb80f00){var _0x2eb862={'$or':{'Phone':_0x615b95}};var _0x190353={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x3ef9('0x27')]()[_0x3ef9('0x22')](function(){logger[_0x3ef9('0x1c')](_0x3ef9('0x2d'),_0x615b95,_0xbb4fa4[_0x3ef9('0x2e')]);switch(_0xbb4fa4[_0x3ef9('0x2e')]){case'contact_lead':var _0x26228c=_[_0x3ef9('0x2f')](_0x2eb862);if(_0xbb4fa4[_0x3ef9('0x30')]){var _0x508785={};_0x508785[_0xbb4fa4[_0x3ef9('0x30')]]=_0x615b95;_[_0x3ef9('0x31')](_0x26228c['$or'],_0x508785);}return _0xb80f00[_0x3ef9('0x1e')](_0x3ef9('0x32'))[_0x3ef9('0x24')](_0x26228c,_0x190353)['execute']()[_0x3ef9('0x22')](function(_0x59e885){if(_0x59e885&&_0x59e885[_0x3ef9('0x23')]){return _0x59e885;}else{var _0x29847c=_[_0x3ef9('0x2f')](_0x2eb862);if(_0xbb4fa4[_0x3ef9('0x33')]){var _0x2be83d={};_0x2be83d[_0xbb4fa4[_0x3ef9('0x33')]]=_0x615b95;_[_0x3ef9('0x31')](_0x29847c[_0x3ef9('0x34')],_0x2be83d);}return _0xb80f00[_0x3ef9('0x1e')]('Lead')[_0x3ef9('0x24')](_0x29847c,_0x190353);}});case _0x3ef9('0x35'):var _0x2afa87=_[_0x3ef9('0x2f')](_0x2eb862);if(_0xbb4fa4[_0x3ef9('0x36')]){var _0x508785={};_0x508785[_0xbb4fa4[_0x3ef9('0x36')]]=_0x615b95;_['merge'](_0x2afa87[_0x3ef9('0x34')],_0x508785);}return _0xb80f00[_0x3ef9('0x1e')](_0x3ef9('0x37'))[_0x3ef9('0x24')](_0x2afa87,_0x190353)['execute']()[_0x3ef9('0x22')](function(_0x28d097){if(_0x28d097&&_0x28d097['length']){return _0x28d097;}else{var _0x24492f=_['cloneDeep'](_0x2eb862);if(_0xbb4fa4[_0x3ef9('0x30')]){var _0x2c352f={};_0x2c352f[_0xbb4fa4[_0x3ef9('0x30')]]=_0x615b95;_[_0x3ef9('0x31')](_0x24492f[_0x3ef9('0x34')],_0x2c352f);}return _0xb80f00[_0x3ef9('0x1e')]('Contact')[_0x3ef9('0x24')](_0x24492f,_0x190353)[_0x3ef9('0x22')](function(_0x48bf55){if(_0x48bf55&&_0x48bf55[_0x3ef9('0x23')]){return _0x48bf55;}else{var _0x5e1beb=_[_0x3ef9('0x2f')](_0x2eb862);if(_0xbb4fa4[_0x3ef9('0x33')]){var _0xcfef52={};_0xcfef52[_0xbb4fa4['additionalSearchLead']]=_0x615b95;_['merge'](_0x5e1beb[_0x3ef9('0x34')],_0xcfef52);}return _0xb80f00[_0x3ef9('0x1e')](_0x3ef9('0x38'))[_0x3ef9('0x24')](_0x5e1beb,_0x190353);}});}});case _0x3ef9('0x17'):var _0x26228c=_[_0x3ef9('0x2f')](_0x2eb862);if(_0xbb4fa4[_0x3ef9('0x30')]){var _0x508785={};_0x508785[_0xbb4fa4[_0x3ef9('0x30')]]=_0x615b95;_[_0x3ef9('0x31')](_0x26228c[_0x3ef9('0x34')],_0x508785);}return _0xb80f00['sobject'](_0x3ef9('0x32'))[_0x3ef9('0x24')](_0x26228c,_0x190353)[_0x3ef9('0x21')]();case _0x3ef9('0x1a'):var _0x42b46e=_[_0x3ef9('0x2f')](_0x2eb862);if(_0xbb4fa4[_0x3ef9('0x33')]){var _0x508785={};_0x508785[_0xbb4fa4[_0x3ef9('0x33')]]=_0x615b95;_['merge'](_0x42b46e[_0x3ef9('0x34')],_0x508785);}return _0xb80f00[_0x3ef9('0x1e')](_0x3ef9('0x38'))[_0x3ef9('0x24')](_0x42b46e,_0x190353);case _0x3ef9('0x15'):var _0x2afa87=_[_0x3ef9('0x2f')](_0x2eb862);if(_0xbb4fa4[_0x3ef9('0x36')]){var _0x508785={};_0x508785[_0xbb4fa4[_0x3ef9('0x36')]]=_0x615b95;_[_0x3ef9('0x31')](_0x2afa87[_0x3ef9('0x34')],_0x508785);}return _0xb80f00[_0x3ef9('0x1e')](_0x3ef9('0x37'))['find'](_0x2afa87,_0x190353);default:return null;}})[_0x3ef9('0x22')](function(_0x32ea9a){if(_0x32ea9a&&_0x32ea9a['length']){var _0x2ca552=_['first'](_0x32ea9a);if(_0x2ca552){return BPromise[_0x3ef9('0x27')]({'id':_0x2ca552['Id'],'name':_0x2ca552[_0x3ef9('0x28')],'phone':_0x2ca552[_0x3ef9('0x39')],'endUserType':_0x2ca552[_0x3ef9('0x3a')][_0x3ef9('0x3b')][_0x3ef9('0x3c')]()});}}})[_0x3ef9('0x22')](function(_0x3617de){if(_0x3617de){logger['info'](_0x3ef9('0x3d'),_0x3617de['endUserType'],_0x615b95);return BPromise[_0x3ef9('0x27')](_0x3617de);}else{logger['info'](_0x3ef9('0x3e'),_0x615b95);var _0x1b6730={'Phone':_0x615b95};if(_0xbb4fa4['moduleCreate']){if(_0xbb4fa4[_0x3ef9('0x3f')]===_0x3ef9('0x17')){logger[_0x3ef9('0x1c')](_0x3ef9('0x40'),_0x615b95,_0xbb4fa4[_0x3ef9('0x3f')]);_0x1b6730[_0x3ef9('0x41')]=_0x13d57c!==''?_0x13d57c:util['format'](_0x3ef9('0x42'),_0x615b95);}else if(_0xbb4fa4[_0x3ef9('0x3f')]===_0x3ef9('0x1a')){logger[_0x3ef9('0x1c')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x615b95,_0xbb4fa4[_0x3ef9('0x3f')]);_0x1b6730[_0x3ef9('0x41')]=_0x13d57c!==_0x3ef9('0x43')?_0x13d57c:util[_0x3ef9('0x44')](_0x3ef9('0x42'),_0x615b95);_0x1b6730[_0x3ef9('0x45')]='No\x20Company';}else if(_0xbb4fa4['moduleCreate']==='account'){logger[_0x3ef9('0x1c')](_0x3ef9('0x40'),_0x615b95,_0xbb4fa4[_0x3ef9('0x3f')]);_0x1b6730[_0x3ef9('0x28')]=_0x13d57c!==_0x3ef9('0x43')?_0x13d57c:util[_0x3ef9('0x44')](_0x3ef9('0x42'),_0x615b95);}else{return null;}}return _0xb80f00['sobject'](_[_0x3ef9('0x46')](_0xbb4fa4[_0x3ef9('0x3f')]))[_0x3ef9('0x1f')](_0x1b6730)[_0x3ef9('0x22')](function(_0x596512){return BPromise['resolve']({'id':_0x596512['id'],'endUserType':_0xbb4fa4[_0x3ef9('0x3f')]});});}});}function getCustomFields(_0x1af429,_0x2917c1){var _0x573e8e={};if(_0x1af429[_0x3ef9('0x23')]>0x0){_['forEach'](_0x1af429,function(_0x4c862e){if(_[_0x3ef9('0x47')]([_0x3ef9('0x48'),_0x3ef9('0x49')],_0x4c862e[_0x3ef9('0x3b')])&&_0x4c862e['idField']){_0x573e8e[_0x4c862e[_0x3ef9('0x4a')]]=_0x4c862e['content'][_0x3ef9('0x4b')]();}else if(_0x4c862e[_0x3ef9('0x3b')]===_0x3ef9('0x4c')&&_0x4c862e[_0x3ef9('0x4d')]&&_0x4c862e[_0x3ef9('0x4a')]){_0x2917c1[_0x4c862e[_0x3ef9('0x4d')]]&&(_0x573e8e[_0x4c862e[_0x3ef9('0x4a')]]=_0x2917c1[_0x4c862e['variableName']][_0x3ef9('0x4b')]());}else if(_0x4c862e[_0x3ef9('0x3b')]===_0x3ef9('0x4e')&&_0x4c862e[_0x3ef9('0x4f')]&&_0x4c862e['Variable'][_0x3ef9('0x50')]&&_0x4c862e[_0x3ef9('0x4a')]){_0x2917c1[_0x4c862e[_0x3ef9('0x4f')][_0x3ef9('0x50')][_0x3ef9('0x3c')]()]&&(_0x573e8e[_0x4c862e[_0x3ef9('0x4a')]]=_0x2917c1[_0x4c862e[_0x3ef9('0x4f')][_0x3ef9('0x50')]['toLowerCase']()][_0x3ef9('0x4b')]());}});}return _0x573e8e;}function getConnection(_0x528937){var _0x237ced=_0x528937[_0x3ef9('0x51')][_0x3ef9('0x52')](_0x528937['securityToken']);var _0x266644=new jsforce['Connection']({'oauth2':{'loginUrl':_0x528937['remoteUri']||_0x3ef9('0x53'),'clientId':_0x528937[_0x3ef9('0x54')],'clientSecret':_0x528937['clientSecret']}});return _0x266644[_0x3ef9('0x55')](_0x528937[_0x3ef9('0x56')],_0x237ced)[_0x3ef9('0x22')](function(){logger[_0x3ef9('0x1c')](_0x3ef9('0x57'));return _0x266644;});}exports[_0x3ef9('0x58')]=function(_0x5b7156,_0x591366,_0x14af90,_0x2d7cb2,_0x1887f1,_0x24f4a7){var _0x4e5d36,_0x34ea03,_0x5cce3a,_0x3f062e;_0x24f4a7['serverUrl']=intUtil[_0x3ef9('0x59')](_0x24f4a7[_0x3ef9('0x5a')]);_0x24f4a7['remoteUri']=intUtil[_0x3ef9('0x59')](_0x24f4a7['remoteUri']);if(_0x1887f1&&_0x1887f1[_0x3ef9('0x5b')]){logger[_0x3ef9('0x1c')](_0x3ef9('0x5c'),_0x3ef9('0x5d'));_0x591366[_0x3ef9('0x5e')]=util['format'](_0x3ef9('0x5f'),_0x24f4a7['serverUrl'],_0x591366[_0x3ef9('0x60')],md5(_0x591366['uniqueid']));}else{_0x591366['recordingURL']='';}return getConnection(_0x24f4a7)[_0x3ef9('0x22')](function(_0x5bf1af){_0x3f062e=_0x5bf1af;return getUser(_0x24f4a7,_0x2d7cb2[_0x3ef9('0x61')],_0x3f062e);})[_0x3ef9('0x22')](function(_0x2fa03d){_0x4e5d36=_0x2fa03d;return getEndUser(_0x24f4a7,_0x14af90,_0x591366[_0x3ef9('0x62')],_0x591366[_0x3ef9('0x63')],_0x3f062e);})[_0x3ef9('0x22')](function(_0xf0d9ac){_0x34ea03=_0xf0d9ac;return getTicket(_0x24f4a7,_0x4e5d36,_0x34ea03,_0x14af90,_0x591366,_0x14af90['Fields'],_0x3f062e,'queue');})[_0x3ef9('0x22')](function(_0x1a360a){_0x5cce3a=_0x1a360a;logger[_0x3ef9('0x1c')](_0x3ef9('0x64'),_0x5cce3a['id']);logger[_0x3ef9('0x1c')](_0x3ef9('0x65'),_0x5cce3a['id'],_0x2d7cb2['name'],_0x24f4a7[_0x3ef9('0x3b')]);switch(_0x24f4a7[_0x3ef9('0x3b')]){case _0x3ef9('0x66'):emit(util[_0x3ef9('0x44')](_0x3ef9('0x67'),_0x2d7cb2[_0x3ef9('0x50')]),_0x3ef9('0x68'),{'recordId':_0x5cce3a['id']});break;case _0x3ef9('0x69'):emit(util['format']('user:%s',_0x2d7cb2[_0x3ef9('0x50')]),'trigger:browser:url',{'uri':util['format']('%s/%s/e',_0x3f062e[_0x3ef9('0x6a')],_0x5cce3a['id'])});break;default:logger[_0x3ef9('0x6b')](_0x3ef9('0x6c'));}})['catch'](function(_0x264ed3){logger[_0x3ef9('0x6b')](_0x3ef9('0x5c'),_0x264ed3);});};exports[_0x3ef9('0x6d')]=function(_0x5b1acc,_0x41c99a,_0x5d4c5d,_0x4f9353,_0x165f36,_0x219eae,_0x11bf8c){var _0x1e1b5a,_0x459e40,_0x14439c,_0x1f5307;_0x219eae['serverUrl']=intUtil[_0x3ef9('0x59')](_0x219eae['serverUrl']);_0x219eae['remoteUri']=intUtil[_0x3ef9('0x59')](_0x219eae[_0x3ef9('0x6e')]);if(_0x11bf8c&&_0x11bf8c['recordingFormat']&&_0x11bf8c[_0x3ef9('0x6f')]!==_0x3ef9('0x70')){logger['info'](_0x3ef9('0x71'),_0x3ef9('0x5d'));_0x41c99a[_0x3ef9('0x5e')]=util[_0x3ef9('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x219eae['serverUrl'],_0x41c99a[_0x3ef9('0x60')],md5(_0x41c99a[_0x3ef9('0x60')]));}return getConnection(_0x219eae)[_0x3ef9('0x22')](function(_0x1e7159){_0x1f5307=_0x1e7159;return getUser(_0x219eae,_0x4f9353[_0x3ef9('0x61')],_0x1f5307);})[_0x3ef9('0x22')](function(_0x26293e){_0x1e1b5a=_0x26293e;return getEndUser(_0x219eae,_0x5d4c5d,_0x41c99a[_0x3ef9('0x72')],_0x41c99a[_0x3ef9('0x73')],_0x1f5307);})['then'](function(_0x2161c1){_0x459e40=_0x2161c1;return getTicket(_0x219eae,_0x1e1b5a,_0x459e40,_0x5d4c5d,_0x41c99a,_0x5d4c5d[_0x3ef9('0x74')],_0x1f5307,'outbound');})[_0x3ef9('0x22')](function(_0x3a4a3d){_0x14439c=_0x3a4a3d;logger[_0x3ef9('0x1c')](_0x3ef9('0x75'),_0x14439c['id']);logger[_0x3ef9('0x1c')](_0x3ef9('0x76'),_0x14439c['id'],_0x4f9353[_0x3ef9('0x50')],_0x219eae[_0x3ef9('0x3b')]);switch(_0x219eae[_0x3ef9('0x3b')]){case _0x3ef9('0x66'):emit(util[_0x3ef9('0x44')](_0x3ef9('0x67'),_0x4f9353['name']),_0x3ef9('0x68'),{'recordId':_0x14439c['id']});break;case _0x3ef9('0x69'):emit(util[_0x3ef9('0x44')](_0x3ef9('0x67'),_0x4f9353[_0x3ef9('0x50')]),_0x3ef9('0x77'),{'uri':util[_0x3ef9('0x44')](_0x3ef9('0x78'),_0x1f5307[_0x3ef9('0x6a')],_0x14439c['id'])});break;default:logger['error'](_0x3ef9('0x71'),_0x3ef9('0x79'));}})[_0x3ef9('0x7a')](function(_0x23f882){logger['error'](_0x3ef9('0x71'),_0x23f882);});};exports['unmanaged']=function(_0x514635,_0x2e74b9,_0x3fb9f0,_0x48540d,_0x9c93b9,_0x2f71c6){var _0x11dcb1,_0x339e4c,_0x1efcc3,_0x507878;_0x2f71c6[_0x3ef9('0x5a')]=intUtil[_0x3ef9('0x59')](_0x2f71c6[_0x3ef9('0x5a')]);_0x2f71c6[_0x3ef9('0x6e')]=intUtil['stripTrailingSlash'](_0x2f71c6[_0x3ef9('0x6e')]);if(_0x9c93b9&&_0x9c93b9[_0x3ef9('0x5b')]){logger['info']('['+_0x2e74b9[_0x3ef9('0x7b')][_0x3ef9('0x7c')]()+']',_0x3ef9('0x5d'));_0x2e74b9[_0x3ef9('0x5e')]=util[_0x3ef9('0x44')](_0x3ef9('0x5f'),_0x2f71c6['serverUrl'],_0x2e74b9[_0x3ef9('0x60')],md5(_0x2e74b9[_0x3ef9('0x60')]));}else{_0x2e74b9[_0x3ef9('0x5e')]='';}return getConnection(_0x2f71c6)[_0x3ef9('0x22')](function(_0x1647b1){_0x507878=_0x1647b1;if(!_[_0x3ef9('0x20')](_0x48540d)){return getUser(_0x2f71c6,_0x48540d[_0x3ef9('0x50')],_0x507878);}else{return getUser(_0x2f71c6,null,_0x507878);}})['then'](function(_0x5c8b20){_0x11dcb1=_0x5c8b20;return getEndUser(_0x2f71c6,_0x3fb9f0,_0x2e74b9[_0x3ef9('0x62')],_0x2e74b9[_0x3ef9('0x63')],_0x507878);})['then'](function(_0x182800){_0x339e4c=_0x182800;return getTicket(_0x2f71c6,_0x11dcb1,_0x339e4c,_0x3fb9f0,_0x2e74b9,_0x3fb9f0[_0x3ef9('0x74')],_0x507878);})['then'](function(_0x6bbd12){_0x1efcc3=_0x6bbd12;logger[_0x3ef9('0x1c')]('['+_0x2e74b9[_0x3ef9('0x7b')][_0x3ef9('0x7c')]()+_0x3ef9('0x7d'),_0x1efcc3['id']);logger[_0x3ef9('0x1c')]('['+_0x2e74b9['lastevent']['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x2f71c6[_0x3ef9('0x3b')]);})[_0x3ef9('0x7a')](function(_0x1d7fa3){logger[_0x3ef9('0x6b')]('['+_0x2e74b9[_0x3ef9('0x7b')][_0x3ef9('0x7c')]()+']',_0x1d7fa3);});}; \ 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 1c7b754..e5012da 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 _0xedf3=['nameField','toLowerCase','toString','customField','idField','content','variable','variableName','customVariable','Variable','name','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','incident','Incident','Incident\x20-\x20','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','email','outbound','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','request-promise','util','ioredis','./util','../../../../config/logger','redis','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','error','message','info','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','adminEmail','],\x20getUser\x20crm','catch','userId','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type'];(function(_0x43e918,_0x363513){var _0x1694fd=function(_0x5805e8){while(--_0x5805e8){_0x43e918['push'](_0x43e918['shift']());}};_0x1694fd(++_0x363513);}(_0xedf3,0x17f));var _0x3edf=function(_0x29ae80,_0x3579f1){_0x29ae80=_0x29ae80-0x0;var _0x5d6d71=_0xedf3[_0x29ae80];return _0x5d6d71;};'use strict';var _=require(_0x3edf('0x0'));var Promise=require('bluebird');var rp=require(_0x3edf('0x1'));var util=require(_0x3edf('0x2'));var md5=require('md5');var Redis=require(_0x3edf('0x3'));var intUtil=require(_0x3edf('0x4'));var config=require('../../../../config/environment');var logger=require(_0x3edf('0x5'))('servicenow');config[_0x3edf('0x6')]=_[_0x3edf('0x7')](config[_0x3edf('0x6')],{'host':_0x3edf('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3edf('0x6')]));function getAdminUser(_0x479966,_0x4f870d,_0x24cf40,_0x3b7990,_0x1f9ff4,_0x1e5714){return new Promise(function(_0x47cbf0,_0x17bab4){var _0x920c73={'method':_0x3edf('0x9'),'uri':_0x3b7990+_0x3edf('0xa')+'&'+_0x1f9ff4+'&'+_0x1e5714,'auth':_0x4f870d,'json':!![]};return rp(_0x920c73)[_0x3edf('0xb')](function(_0xb6b74b){if(_0xb6b74b[_0x3edf('0xc')][_0x3edf('0xd')]>0x0){_0x24cf40[_0x3edf('0xe')]=_0xb6b74b[_0x3edf('0xc')][0x0][_0x3edf('0xf')];}logger['info']('['+[_0x479966[_0x3edf('0x10')]()]+_0x3edf('0x11'),_0x24cf40);_0x47cbf0(_0x24cf40);})['catch'](function(_0x331018){logger[_0x3edf('0x12')]('['+[_0x479966[_0x3edf('0x10')]()]+']',_0x331018[_0x3edf('0x13')]);_0x17bab4(_0x331018[_0x3edf('0x13')]);});});}function getUser(_0x5bd1cc,_0x3a4707,_0x565aed,_0x4401bd,_0x2cb63f){return function(_0x25a976){logger[_0x3edf('0x14')]('['+[_0x5bd1cc[_0x3edf('0x10')]()]+'],\x20getUser\x20input\x20crm',_0x25a976);return new Promise(function(_0x47a572,_0x1445ab){if(intUtil['validateEmail'](_0x25a976[_0x3edf('0x15')])){var _0x1239f1={'method':_0x3edf('0x9'),'uri':_0x565aed+_0x3edf('0x16')+_0x25a976['userEmail']+'&'+_0x4401bd+'&'+_0x2cb63f,'auth':_0x3a4707,'json':!![]};logger[_0x3edf('0x14')]('['+[_0x5bd1cc['toUpperCase']()]+_0x3edf('0x17'),_0x1239f1);return rp(_0x1239f1)['then'](function(_0x36527a){logger['info']('['+[_0x5bd1cc['toUpperCase']()]+_0x3edf('0x18'),_0x36527a);if(_0x36527a[_0x3edf('0xc')][_0x3edf('0xd')]>0x0&&String(_0x36527a[_0x3edf('0xc')][0x0]['active'])==='true'){_0x25a976['userId']=_0x36527a['result'][0x0]['sys_id'];}else{_0x25a976['userId']=_0x25a976[_0x3edf('0xe')];_0x25a976['userEmail']=_0x25a976[_0x3edf('0x19')];}logger[_0x3edf('0x14')]('['+[_0x5bd1cc['toUpperCase']()]+_0x3edf('0x1a'),_0x25a976);_0x47a572(_0x25a976);})[_0x3edf('0x1b')](function(_0x16d847){logger['error']('['+[_0x5bd1cc[_0x3edf('0x10')]()]+']',_0x16d847[_0x3edf('0x13')]);_0x1445ab(_0x16d847[_0x3edf('0x13')]);});}else{logger[_0x3edf('0x14')]('['+[_0x5bd1cc['toUpperCase']()]+']\x20using\x20admin\x20profile');_0x25a976[_0x3edf('0x1c')]=_0x25a976[_0x3edf('0xe')];_0x25a976[_0x3edf('0x15')]=_0x25a976['adminEmail'];_0x47a572(_0x25a976);}});};}function createEndUser(_0x1b3a62,_0x27d8d5,_0x2feb54,_0x3f05ba,_0x22e800){logger[_0x3edf('0x14')]('['+[_0x1b3a62[_0x3edf('0x10')]()]+_0x3edf('0x1d'),_0x2feb54);return new Promise(function(_0x471215,_0x58e9b2){var _0x2c67b5={'method':_0x3edf('0x1e'),'uri':_0x3f05ba+_0x3edf('0x1f')+_0x22e800,'body':{'user_name':_0x2feb54[_0x3edf('0x20')],'roles':_0x3edf('0x21'),'first_name':_0x2feb54[_0x3edf('0x20')],'active':_0x3edf('0x22'),'date_format':_0x3edf('0x23'),'phone':_0x2feb54[_0x3edf('0x20')]},'auth':_0x27d8d5,'json':!![]};return rp(_0x2c67b5)['then'](function(_0x43aae3){logger[_0x3edf('0x14')]('['+[_0x1b3a62['toUpperCase']()]+_0x3edf('0x24'),_0x43aae3[_0x3edf('0xc')]);_0x2feb54[_0x3edf('0x25')]=_0x43aae3['result'][_0x3edf('0xf')];_0x471215(_0x2feb54);})[_0x3edf('0x1b')](function(_0x37961b){logger['error']('['+[_0x1b3a62[_0x3edf('0x10')]()]+']',_0x37961b['message']);_0x58e9b2(_0x37961b[_0x3edf('0x13')]);});});}function getEndUser(_0x1d7054,_0x414b95,_0x454c93,_0x125670,_0x1b8254){return function(_0x16b7db){logger[_0x3edf('0x14')]('['+[_0x1d7054[_0x3edf('0x10')]()]+_0x3edf('0x26'),_0x16b7db);return new Promise(function(_0x272abd,_0x67e578){var _0x3c9368={'method':_0x3edf('0x9'),'uri':_0x454c93+'sys_user?sysparm_query=phone%3D'+_0x16b7db[_0x3edf('0x20')]+'&'+_0x125670+'&'+_0x1b8254,'auth':_0x414b95,'json':!![]};return rp(_0x3c9368)[_0x3edf('0xb')](function(_0x212994){if(_0x212994[_0x3edf('0xc')]['length']>0x0){_0x16b7db[_0x3edf('0x25')]=_0x212994[_0x3edf('0xc')][0x0][_0x3edf('0xf')];logger[_0x3edf('0x14')]('['+[_0x1d7054[_0x3edf('0x10')]()]+'],\x20getEndUser\x20crm',_0x16b7db);_0x272abd(_0x16b7db);}else{return createEndUser(_0x1d7054,_0x414b95,_0x16b7db,_0x454c93,_0x125670)[_0x3edf('0xb')](function(_0xdc8870){logger[_0x3edf('0x14')]('['+[_0x1d7054[_0x3edf('0x10')]()]+_0x3edf('0x27'),_0xdc8870);_0x272abd(_0xdc8870);});}})['catch'](function(_0x28e868){logger[_0x3edf('0x12')]('['+[_0x1d7054[_0x3edf('0x10')]()]+']',_0x28e868[_0x3edf('0x13')]);_0x67e578(_0x28e868[_0x3edf('0x13')]);});});};}function getCustomFields(_0x52cf13,_0x1ab8ca){var _0x1099b6={};if(_0x52cf13[_0x3edf('0xd')]>0x0){_[_0x3edf('0x28')](_0x52cf13,function(_0x2e8a01){if(_[_0x3edf('0x29')]([_0x3edf('0x2a'),_0x3edf('0x2b')],_0x2e8a01[_0x3edf('0x2c')])&&_0x2e8a01[_0x3edf('0x2d')]&&!_0x2e8a01['customField']){_0x1099b6[_0x2e8a01[_0x3edf('0x2d')][_0x3edf('0x2e')]()]=_0x2e8a01['content'][_0x3edf('0x2f')]();}else if(_[_0x3edf('0x29')]([_0x3edf('0x2a'),_0x3edf('0x2b')],_0x2e8a01['type'])&&_0x2e8a01['idField']&&_0x2e8a01[_0x3edf('0x30')]){_0x1099b6[_0x2e8a01[_0x3edf('0x31')][_0x3edf('0x2e')]()]=_0x2e8a01[_0x3edf('0x32')][_0x3edf('0x2f')]();}else if(_0x2e8a01[_0x3edf('0x2c')]===_0x3edf('0x33')&&_0x2e8a01[_0x3edf('0x34')]&&_0x2e8a01[_0x3edf('0x31')]&&_0x2e8a01['customField']){_0x1099b6[_0x2e8a01[_0x3edf('0x31')][_0x3edf('0x2e')]()]=_0x1ab8ca[_0x2e8a01['variableName']][_0x3edf('0x2f')]();}else if(_0x2e8a01['type']===_0x3edf('0x35')&&_0x2e8a01[_0x3edf('0x36')]&&_0x2e8a01[_0x3edf('0x36')]['name']&&_0x2e8a01['idField']&&_0x2e8a01[_0x3edf('0x30')]){_0x1099b6[_0x2e8a01['idField'][_0x3edf('0x2e')]()]=_0x1ab8ca[_0x2e8a01[_0x3edf('0x36')][_0x3edf('0x37')]['toLowerCase']()][_0x3edf('0x2f')]();}});}return _0x1099b6;}function getTicket(_0x3fb092,_0x4984d0,_0x1bba9b,_0x578a60,_0x8c81dc,_0x3e6d64){return function(_0x41a53c){logger[_0x3edf('0x14')]('['+[_0x3fb092[_0x3edf('0x10')]()]+']\x20getTicket\x20input\x20crm',_0x41a53c);return new Promise(function(_0x4a5dab,_0x7dc71f){var _0x2182a4=_0x3fb092[_0x3edf('0x2e')]()==='outbound'?_0x41a53c['userId']:_0x41a53c[_0x3edf('0x25')];var _0x79b1c0={'method':_0x3edf('0x1e'),'uri':_0x1bba9b+'incident'+'?'+_0x3e6d64,'body':Object[_0x3edf('0x38')]({},{'active':'true','caller_id':_0x2182a4,'assigned_to':_0x41a53c[_0x3edf('0x1c')],'short_description':intUtil[_0x3edf('0x39')](_0x578a60[_0x3edf('0x3a')],_0x8c81dc,'\x20'),'description':intUtil[_0x3edf('0x39')](_0x578a60[_0x3edf('0x3b')],_0x8c81dc,'\x0a')},getCustomFields(_0x578a60[_0x3edf('0x3c')],_0x8c81dc)),'auth':_0x4984d0,'json':!![]};return rp(_0x79b1c0)[_0x3edf('0xb')](function(_0x877f01){logger[_0x3edf('0x14')]('['+[_0x3fb092['toUpperCase']()]+_0x3edf('0x3d'),_0x877f01['result']);_0x41a53c[_0x3edf('0x3e')]=_0x877f01[_0x3edf('0xc')]['sys_id'];_0x41a53c[_0x3edf('0x3f')]=_0x877f01[_0x3edf('0xc')][_0x3edf('0x40')];logger[_0x3edf('0x14')]('['+[_0x3fb092['toUpperCase']()]+_0x3edf('0x41'),_0x41a53c);_0x4a5dab(_0x41a53c);})[_0x3edf('0x1b')](function(_0x2ddd5c){logger[_0x3edf('0x12')]('['+[_0x3fb092[_0x3edf('0x10')]()]+']',_0x2ddd5c[_0x3edf('0x13')]);_0x7dc71f(_0x2ddd5c[_0x3edf('0x13')]);});});};}function createRemoteTag(_0x29a1f3,_0xf07c6c,_0x2350f1,_0x18cdcb){return new Promise(function(_0x3cd497,_0x1b500c){var _0x31ea72={'method':'POST','uri':_0x2350f1+_0x3edf('0x42')+'?'+_0x18cdcb,'body':{'short_description':_0x29a1f3,'global':!![],'active':!![],'name':_0x29a1f3},'auth':_0xf07c6c,'json':!![]};return rp(_0x31ea72)[_0x3edf('0xb')](function(_0x3ef64e){var _0x2ae0aa=_0x3ef64e[_0x3edf('0xc')]['sys_id'];_0x3cd497(_0x2ae0aa);});});}function getRemoteTag(_0x538139,_0x14fe1f,_0x220689,_0x201e0b,_0x3d856b){return new Promise(function(_0x4c49ad,_0x5af1b9){var _0x10bb2d={'method':_0x3edf('0x9'),'uri':_0x220689+_0x3edf('0x42')+_0x3edf('0x43')+_0x538139+'&'+_0x201e0b,'auth':_0x14fe1f,'json':!![]};return rp(_0x10bb2d)[_0x3edf('0xb')](function(_0x456f6f){if(_0x456f6f['result'][_0x3edf('0xd')]>0x0){var _0x56e0b0=_0x456f6f['result'][0x0][_0x3edf('0xf')];_0x4c49ad(_0x56e0b0);}else{return createRemoteTag(_0x538139,_0x14fe1f,_0x220689,_0x201e0b)['then'](function(_0x3e5186){_0x4c49ad(_0x3e5186);});}});});}function assignTagToIncident(_0x89178f,_0x4abcf1,_0x407e89,_0x4534d4,_0x5d22d3){return new Promise(function(_0x52948e,_0x112643){var _0x143190={'method':'POST','uri':_0x407e89+'label_entry'+'?'+_0x5d22d3,'body':{'label':_0x89178f,'table':_0x3edf('0x44'),'id_type':_0x3edf('0x45'),'table_key':_0x4534d4[_0x3edf('0x3e')],'title':_0x3edf('0x46')+_0x4534d4[_0x3edf('0x3f')],'id_display':_0x4534d4[_0x3edf('0x3f')]},'auth':_0x4abcf1,'json':!![]};return rp(_0x143190)[_0x3edf('0xb')](function(_0x5787ec){_0x52948e();})[_0x3edf('0x1b')](function(){_0x52948e();});});}function manageTags(_0x3be174,_0x4fefa3,_0x5d3038,_0xc3d72b,_0x55b024,_0x147738,_0x518b45){return new Promise(function(_0x708edc,_0x29361a){var _0x1792f4=[];_0x4fefa3['forEach'](function(_0x4b26e9){_0x1792f4['push'](getRemoteTag(_0x4b26e9,_0x5d3038,_0xc3d72b,_0x147738,_0x518b45));});return Promise[_0x3edf('0x47')](_0x1792f4)[_0x3edf('0xb')](function(_0x2ceb7e){if(_0x2ceb7e[_0x3edf('0xd')]){logger['info']('['+[_0x3be174[_0x3edf('0x10')]()]+_0x3edf('0x48'),_0x2ceb7e);var _0x17ef3e=[];_0x2ceb7e[_0x3edf('0x28')](function(_0x3ab4e6){_0x17ef3e[_0x3edf('0x49')](assignTagToIncident(_0x3ab4e6,_0x5d3038,_0xc3d72b,_0x55b024,_0x147738));});return Promise[_0x3edf('0x47')](_0x17ef3e)[_0x3edf('0xb')](function(){_0x708edc();})[_0x3edf('0x1b')](function(){_0x708edc();});}else{_0x708edc();}});});}function getTags(_0x3ec73e,_0x1d3e0a,_0x1aa28b,_0x105fe1,_0xe12d2,_0x1c72c0){return function(_0x47d95c){return new Promise(function(_0x83cd45,_0x23a37e){var _0x516649=[];var _0x5f237b=_0x105fe1[_0x3edf('0x4a')];if(_0x5f237b&&_0x5f237b['length']>0x0){_0x516649=_[_0x3edf('0x4b')](_0x5f237b,_0x3edf('0x37'));}if(_0x516649[_0x3edf('0xd')]>0x0){return manageTags(_0x3ec73e,_0x516649,_0x1d3e0a,_0x1aa28b,_0x47d95c,_0xe12d2,_0x1c72c0)[_0x3edf('0xb')](function(){_0x83cd45(_0x47d95c);});}else{_0x83cd45(_0x47d95c);}});};}function emit(_0x1cc685,_0x312e2e,_0x68311b){var _0x40e7a6=_0x3edf('0x4c')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x3edf('0x4d')+'%255EORDERBYDESCnumber';var _0x1de9d9={'uri':_0x1cc685+_0x3edf('0x4e')+_0x68311b+_0x40e7a6};io['to'](util['format'](_0x3edf('0x4f'),_0x312e2e))[_0x3edf('0x50')](_0x3edf('0x51'),_0x1de9d9);}exports['cs']=function(_0xa3ba90,_0x5302f1,_0x34a832,_0x40b6c1,_0x449934,_0x273d07,_0x25c6f,_0x4c0e2f){var _0x3ee062={};var _0x1e8697={'user':_0x273d07[_0x3edf('0x52')],'pass':_0x273d07[_0x3edf('0x53')]};var _0x268424=_0x3edf('0x54');var _0x26ed4f=_0x3edf('0x55');_0x273d07[_0x3edf('0x56')]=intUtil[_0x3edf('0x57')](_0x273d07[_0x3edf('0x56')]);_0x273d07[_0x3edf('0x58')]=intUtil[_0x3edf('0x57')](_0x273d07[_0x3edf('0x58')]);var _0x3c6600=util[_0x3edf('0x59')]('%s/api/now/table/',_0x273d07['remoteUri']);_0x3ee062['userEmail']=!_['isNil'](_0x40b6c1)?_0x40b6c1[_0x3edf('0x5a')]:null;_0x3ee062[_0x3edf('0x19')]=_0x273d07['email'];_0x3ee062[_0x3edf('0x20')]=_0x4c0e2f[_0x3edf('0x2e')]()===_0x3edf('0x5b')?_0x5302f1['destcalleridnum']:_0x5302f1[_0x3edf('0x5c')];_0x3ee062[_0x3edf('0x5d')]=_0x4c0e2f===_0x3edf('0x5e')||_0x4c0e2f===_0x3edf('0x5f')?_0x3edf('0x5e'):_0x3edf('0x5b');var _0x1d348a=util[_0x3edf('0x59')](_0x3edf('0x60'),_0x273d07['serverUrl'],_0x5302f1[_0x3edf('0x61')],md5(_0x5302f1['uniqueid']));if(_0x449934&&_0x449934[_0x3edf('0x62')]){logger['info']('[QUEUE]',_0x3edf('0x63'));_0x5302f1[_0x3edf('0x64')]=_0x1d348a;}else if(_0x25c6f&&_0x25c6f['recordingFormat']&&_0x25c6f['recordingFormat']!=='none'){logger[_0x3edf('0x14')](_0x3edf('0x65'),_0x3edf('0x63'));_0x5302f1['recordingURL']=_0x1d348a;}else{_0x5302f1['recordingURL']='';}return getAdminUser(_0x4c0e2f,_0x1e8697,_0x3ee062,_0x3c6600,_0x26ed4f,_0x268424)[_0x3edf('0xb')](getUser(_0x4c0e2f,_0x1e8697,_0x3c6600,_0x26ed4f,_0x268424))[_0x3edf('0xb')](getEndUser(_0x4c0e2f,_0x1e8697,_0x3c6600,_0x26ed4f,_0x268424))[_0x3edf('0xb')](getTicket(_0x4c0e2f,_0x1e8697,_0x3c6600,_0x34a832,_0x5302f1,_0x26ed4f))[_0x3edf('0xb')](function(_0x536977){logger[_0x3edf('0x14')](util['format'](_0x3edf('0x66'),_0x536977[_0x3edf('0x3e')]));logger[_0x3edf('0x14')](util['format'](_0x3edf('0x67'),_0x4c0e2f));if(_0x4c0e2f!==_0x3edf('0x5f')){logger['info']('['+[_0x4c0e2f['toUpperCase']()]+']',_0x3edf('0x68'));emit(_0x273d07[_0x3edf('0x56')],_0x40b6c1[_0x3edf('0x37')],_0x536977[_0x3edf('0x3e')]);}})[_0x3edf('0x1b')](function(_0x232492){logger['error']('['+[_0x4c0e2f['toUpperCase']()]+_0x3edf('0x69'),util[_0x3edf('0x6a')](_0x232492,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xbd6e=['md5','ioredis','./util','../../../../config/environment','servicenow','redis','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','POST','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','includes','string','picklist','customField','nameField','content','toString','type','idField','variable','variableName','toLowerCase','Variable','name','outbound','incident','assign','getString','Descriptions','Fields','ticketNumber','number','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','ticketId','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util'];(function(_0x9307ea,_0x38968a){var _0x295554=function(_0x342dcf){while(--_0x342dcf){_0x9307ea['push'](_0x9307ea['shift']());}};_0x295554(++_0x38968a);}(_0xbd6e,0xd2));var _0xebd6=function(_0x41ac39,_0x285ed6){_0x41ac39=_0x41ac39-0x0;var _0x3ba9fb=_0xbd6e[_0x41ac39];return _0x3ba9fb;};'use strict';var _=require(_0xebd6('0x0'));var Promise=require(_0xebd6('0x1'));var rp=require(_0xebd6('0x2'));var util=require(_0xebd6('0x3'));var md5=require(_0xebd6('0x4'));var Redis=require(_0xebd6('0x5'));var intUtil=require(_0xebd6('0x6'));var config=require(_0xebd6('0x7'));var logger=require('../../../../config/logger')(_0xebd6('0x8'));config[_0xebd6('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xebd6('0xa'))(new Redis(config[_0xebd6('0x9')]));function getAdminUser(_0x5ca148,_0x144730,_0x546202,_0xfb92f4,_0x11c139,_0x4245cf){return new Promise(function(_0x1359f2,_0x1f9754){var _0x4b27ae={'method':_0xebd6('0xb'),'uri':_0xfb92f4+_0xebd6('0xc')+'&'+_0x11c139+'&'+_0x4245cf,'auth':_0x144730,'json':!![]};return rp(_0x4b27ae)[_0xebd6('0xd')](function(_0x57ed95){if(_0x57ed95[_0xebd6('0xe')]['length']>0x0){_0x546202[_0xebd6('0xf')]=_0x57ed95['result'][0x0][_0xebd6('0x10')];}logger[_0xebd6('0x11')]('['+[_0x5ca148[_0xebd6('0x12')]()]+_0xebd6('0x13'),_0x546202);_0x1359f2(_0x546202);})[_0xebd6('0x14')](function(_0x374e7f){logger[_0xebd6('0x15')]('['+[_0x5ca148[_0xebd6('0x12')]()]+']',_0x374e7f[_0xebd6('0x16')]);_0x1f9754(_0x374e7f[_0xebd6('0x16')]);});});}function getUser(_0x1369a9,_0x1d1420,_0x59e5c4,_0x7480d2,_0x467446){return function(_0x401930){logger[_0xebd6('0x11')]('['+[_0x1369a9['toUpperCase']()]+_0xebd6('0x17'),_0x401930);return new Promise(function(_0x217b60,_0x20efe5){if(intUtil[_0xebd6('0x18')](_0x401930[_0xebd6('0x19')])){var _0xb4d8bb={'method':'GET','uri':_0x59e5c4+_0xebd6('0x1a')+_0x401930['userEmail']+'&'+_0x7480d2+'&'+_0x467446,'auth':_0x1d1420,'json':!![]};logger[_0xebd6('0x11')]('['+[_0x1369a9['toUpperCase']()]+_0xebd6('0x1b'),_0xb4d8bb);return rp(_0xb4d8bb)['then'](function(_0x257eb9){logger[_0xebd6('0x11')]('['+[_0x1369a9['toUpperCase']()]+_0xebd6('0x1c'),_0x257eb9);if(_0x257eb9[_0xebd6('0xe')][_0xebd6('0x1d')]>0x0&&String(_0x257eb9[_0xebd6('0xe')][0x0][_0xebd6('0x1e')])===_0xebd6('0x1f')){_0x401930[_0xebd6('0x20')]=_0x257eb9[_0xebd6('0xe')][0x0][_0xebd6('0x10')];}else{_0x401930[_0xebd6('0x20')]=_0x401930[_0xebd6('0xf')];_0x401930[_0xebd6('0x19')]=_0x401930[_0xebd6('0x21')];}logger[_0xebd6('0x11')]('['+[_0x1369a9['toUpperCase']()]+_0xebd6('0x22'),_0x401930);_0x217b60(_0x401930);})['catch'](function(_0x1c92bf){logger[_0xebd6('0x15')]('['+[_0x1369a9['toUpperCase']()]+']',_0x1c92bf[_0xebd6('0x16')]);_0x20efe5(_0x1c92bf[_0xebd6('0x16')]);});}else{logger[_0xebd6('0x11')]('['+[_0x1369a9[_0xebd6('0x12')]()]+_0xebd6('0x23'));_0x401930['userId']=_0x401930[_0xebd6('0xf')];_0x401930['userEmail']=_0x401930[_0xebd6('0x21')];_0x217b60(_0x401930);}});};}function createEndUser(_0x3568f2,_0x5834e5,_0x12c464,_0x3c0f67,_0x1e41e6){logger[_0xebd6('0x11')]('['+[_0x3568f2[_0xebd6('0x12')]()]+'],\x20createEndUser\x20input\x20crm',_0x12c464);return new Promise(function(_0x18ddf9,_0x419158){var _0x7b2e4e={'method':_0xebd6('0x24'),'uri':_0x3c0f67+_0xebd6('0x25')+_0x1e41e6,'body':{'user_name':_0x12c464[_0xebd6('0x26')],'roles':'user','first_name':_0x12c464[_0xebd6('0x26')],'active':_0xebd6('0x1f'),'date_format':_0xebd6('0x27'),'phone':_0x12c464[_0xebd6('0x26')]},'auth':_0x5834e5,'json':!![]};return rp(_0x7b2e4e)[_0xebd6('0xd')](function(_0x182dc4){logger[_0xebd6('0x11')]('['+[_0x3568f2[_0xebd6('0x12')]()]+_0xebd6('0x28'),_0x182dc4[_0xebd6('0xe')]);_0x12c464[_0xebd6('0x29')]=_0x182dc4[_0xebd6('0xe')][_0xebd6('0x10')];_0x18ddf9(_0x12c464);})[_0xebd6('0x14')](function(_0xa33379){logger['error']('['+[_0x3568f2['toUpperCase']()]+']',_0xa33379[_0xebd6('0x16')]);_0x419158(_0xa33379[_0xebd6('0x16')]);});});}function getEndUser(_0xeb95ca,_0x24bc04,_0x179ea0,_0x26108a,_0x364080){return function(_0x5bd903){logger['info']('['+[_0xeb95ca[_0xebd6('0x12')]()]+_0xebd6('0x2a'),_0x5bd903);return new Promise(function(_0x40f299,_0x145bb4){var _0x1ffe72={'method':_0xebd6('0xb'),'uri':_0x179ea0+_0xebd6('0x2b')+_0x5bd903[_0xebd6('0x26')]+'&'+_0x26108a+'&'+_0x364080,'auth':_0x24bc04,'json':!![]};return rp(_0x1ffe72)['then'](function(_0xeb42af){if(_0xeb42af['result']['length']>0x0){_0x5bd903[_0xebd6('0x29')]=_0xeb42af[_0xebd6('0xe')][0x0]['sys_id'];logger[_0xebd6('0x11')]('['+[_0xeb95ca[_0xebd6('0x12')]()]+'],\x20getEndUser\x20crm',_0x5bd903);_0x40f299(_0x5bd903);}else{return createEndUser(_0xeb95ca,_0x24bc04,_0x5bd903,_0x179ea0,_0x26108a)[_0xebd6('0xd')](function(_0x5aea91){logger[_0xebd6('0x11')]('['+[_0xeb95ca[_0xebd6('0x12')]()]+_0xebd6('0x2c'),_0x5aea91);_0x40f299(_0x5aea91);});}})[_0xebd6('0x14')](function(_0x5e14df){logger['error']('['+[_0xeb95ca['toUpperCase']()]+']',_0x5e14df['message']);_0x145bb4(_0x5e14df[_0xebd6('0x16')]);});});};}function getCustomFields(_0x19314e,_0x2f40e9){var _0x562943={};if(_0x19314e[_0xebd6('0x1d')]>0x0){_['forEach'](_0x19314e,function(_0x141b72){if(_[_0xebd6('0x2d')]([_0xebd6('0x2e'),_0xebd6('0x2f')],_0x141b72['type'])&&_0x141b72['nameField']&&!_0x141b72[_0xebd6('0x30')]){_0x562943[_0x141b72[_0xebd6('0x31')]['toLowerCase']()]=_0x141b72[_0xebd6('0x32')][_0xebd6('0x33')]();}else if(_[_0xebd6('0x2d')]([_0xebd6('0x2e'),'picklist'],_0x141b72[_0xebd6('0x34')])&&_0x141b72[_0xebd6('0x35')]&&_0x141b72['customField']){_0x562943[_0x141b72[_0xebd6('0x35')]['toLowerCase']()]=_0x141b72[_0xebd6('0x32')]['toString']();}else if(_0x141b72[_0xebd6('0x34')]===_0xebd6('0x36')&&_0x141b72[_0xebd6('0x37')]&&_0x141b72[_0xebd6('0x35')]&&_0x141b72['customField']){_0x562943[_0x141b72['idField'][_0xebd6('0x38')]()]=_0x2f40e9[_0x141b72[_0xebd6('0x37')]][_0xebd6('0x33')]();}else if(_0x141b72[_0xebd6('0x34')]==='customVariable'&&_0x141b72[_0xebd6('0x39')]&&_0x141b72[_0xebd6('0x39')]['name']&&_0x141b72[_0xebd6('0x35')]&&_0x141b72[_0xebd6('0x30')]){_0x562943[_0x141b72[_0xebd6('0x35')]['toLowerCase']()]=_0x2f40e9[_0x141b72[_0xebd6('0x39')][_0xebd6('0x3a')][_0xebd6('0x38')]()][_0xebd6('0x33')]();}});}return _0x562943;}function getTicket(_0x5da2f0,_0x2c56a0,_0x1e9f3e,_0xbec2ad,_0x5d2192,_0x525203){return function(_0x26b63e){logger['info']('['+[_0x5da2f0[_0xebd6('0x12')]()]+']\x20getTicket\x20input\x20crm',_0x26b63e);return new Promise(function(_0x2500cb,_0x519a3f){var _0x502908=_0x5da2f0['toLowerCase']()===_0xebd6('0x3b')?_0x26b63e[_0xebd6('0x20')]:_0x26b63e[_0xebd6('0x29')];var _0x1ec73d={'method':_0xebd6('0x24'),'uri':_0x1e9f3e+_0xebd6('0x3c')+'?'+_0x525203,'body':Object[_0xebd6('0x3d')]({},{'active':'true','caller_id':_0x502908,'assigned_to':_0x26b63e[_0xebd6('0x20')],'short_description':intUtil['getString'](_0xbec2ad['Subjects'],_0x5d2192,'\x20'),'description':intUtil[_0xebd6('0x3e')](_0xbec2ad[_0xebd6('0x3f')],_0x5d2192,'\x0a')},getCustomFields(_0xbec2ad[_0xebd6('0x40')],_0x5d2192)),'auth':_0x2c56a0,'json':!![]};return rp(_0x1ec73d)['then'](function(_0x21604a){logger[_0xebd6('0x11')]('['+[_0x5da2f0[_0xebd6('0x12')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x21604a[_0xebd6('0xe')]);_0x26b63e['ticketId']=_0x21604a[_0xebd6('0xe')][_0xebd6('0x10')];_0x26b63e[_0xebd6('0x41')]=_0x21604a['result'][_0xebd6('0x42')];logger['info']('['+[_0x5da2f0[_0xebd6('0x12')]()]+']\x20getTicket\x20crm',_0x26b63e);_0x2500cb(_0x26b63e);})['catch'](function(_0x560677){logger[_0xebd6('0x15')]('['+[_0x5da2f0[_0xebd6('0x12')]()]+']',_0x560677[_0xebd6('0x16')]);_0x519a3f(_0x560677[_0xebd6('0x16')]);});});};}function createRemoteTag(_0x247ab4,_0x4d54b1,_0x2252c6,_0x4c0177){return new Promise(function(_0x485f76,_0x15bba1){var _0x2946fd={'method':_0xebd6('0x24'),'uri':_0x2252c6+_0xebd6('0x43')+'?'+_0x4c0177,'body':{'short_description':_0x247ab4,'global':!![],'active':!![],'name':_0x247ab4},'auth':_0x4d54b1,'json':!![]};return rp(_0x2946fd)['then'](function(_0x52f6ae){var _0x1a9b2c=_0x52f6ae[_0xebd6('0xe')][_0xebd6('0x10')];_0x485f76(_0x1a9b2c);});});}function getRemoteTag(_0x225136,_0x279192,_0x3c6127,_0x5d1105,_0x504cb0){return new Promise(function(_0x110e13,_0xc31b4d){var _0x2000bd={'method':_0xebd6('0xb'),'uri':_0x3c6127+_0xebd6('0x43')+_0xebd6('0x44')+_0x225136+'&'+_0x5d1105,'auth':_0x279192,'json':!![]};return rp(_0x2000bd)[_0xebd6('0xd')](function(_0x59b484){if(_0x59b484[_0xebd6('0xe')][_0xebd6('0x1d')]>0x0){var _0x3c05db=_0x59b484[_0xebd6('0xe')][0x0][_0xebd6('0x10')];_0x110e13(_0x3c05db);}else{return createRemoteTag(_0x225136,_0x279192,_0x3c6127,_0x5d1105)[_0xebd6('0xd')](function(_0x193288){_0x110e13(_0x193288);});}});});}function assignTagToIncident(_0x5bf96b,_0x2412dd,_0x5bbd47,_0x33efce,_0xac96d){return new Promise(function(_0x4b735a,_0x1dbd6e){var _0x4cc72b={'method':_0xebd6('0x24'),'uri':_0x5bbd47+_0xebd6('0x45')+'?'+_0xac96d,'body':{'label':_0x5bf96b,'table':'incident','id_type':_0xebd6('0x46'),'table_key':_0x33efce['ticketId'],'title':_0xebd6('0x47')+_0x33efce[_0xebd6('0x41')],'id_display':_0x33efce['ticketNumber']},'auth':_0x2412dd,'json':!![]};return rp(_0x4cc72b)[_0xebd6('0xd')](function(_0x584190){_0x4b735a();})[_0xebd6('0x14')](function(){_0x4b735a();});});}function manageTags(_0x3c524c,_0xb8e766,_0x22db13,_0x5f00ee,_0x4b3825,_0x7deaca,_0x364097){return new Promise(function(_0x40e232,_0x550ce7){var _0x34b1db=[];_0xb8e766[_0xebd6('0x48')](function(_0x52f0be){_0x34b1db[_0xebd6('0x49')](getRemoteTag(_0x52f0be,_0x22db13,_0x5f00ee,_0x7deaca,_0x364097));});return Promise[_0xebd6('0x4a')](_0x34b1db)[_0xebd6('0xd')](function(_0x277861){if(_0x277861[_0xebd6('0x1d')]){logger[_0xebd6('0x11')]('['+[_0x3c524c['toUpperCase']()]+_0xebd6('0x4b'),_0x277861);var _0x4fa5ec=[];_0x277861['forEach'](function(_0x14dd40){_0x4fa5ec[_0xebd6('0x49')](assignTagToIncident(_0x14dd40,_0x22db13,_0x5f00ee,_0x4b3825,_0x7deaca));});return Promise[_0xebd6('0x4a')](_0x4fa5ec)[_0xebd6('0xd')](function(){_0x40e232();})[_0xebd6('0x14')](function(){_0x40e232();});}else{_0x40e232();}});});}function getTags(_0x3e9e7c,_0x2e1bec,_0x4743e7,_0x145a79,_0x36120f,_0x1d9799){return function(_0x57f638){return new Promise(function(_0x39ac22,_0x47ee29){var _0x102b1c=[];var _0x508086=_0x145a79['Tags'];if(_0x508086&&_0x508086['length']>0x0){_0x102b1c=_['map'](_0x508086,'name');}if(_0x102b1c[_0xebd6('0x1d')]>0x0){return manageTags(_0x3e9e7c,_0x102b1c,_0x2e1bec,_0x4743e7,_0x57f638,_0x36120f,_0x1d9799)['then'](function(){_0x39ac22(_0x57f638);});}else{_0x39ac22(_0x57f638);}});};}function emit(_0x3d4f58,_0x39f899,_0x44b303){var _0x25eee4=_0xebd6('0x4c')+_0xebd6('0x4d')+_0xebd6('0x4e')+'%255EORDERBYDESCnumber';var _0x508e76={'uri':_0x3d4f58+_0xebd6('0x4f')+_0x44b303+_0x25eee4};io['to'](util[_0xebd6('0x50')]('user:%s',_0x39f899))[_0xebd6('0x51')]('trigger:browser:url',_0x508e76);}exports['cs']=function(_0x4216fe,_0x3f441e,_0x3aa401,_0x5af5fa,_0x18f4a4,_0x1b9ca3,_0x4f1f50,_0x3e5c57){var _0x2af860={};var _0x3ea0c0={'user':_0x1b9ca3[_0xebd6('0x52')],'pass':_0x1b9ca3[_0xebd6('0x53')]};var _0x416036='sysparm_limit=1';var _0x1b924e=_0xebd6('0x54');_0x1b9ca3[_0xebd6('0x55')]=intUtil[_0xebd6('0x56')](_0x1b9ca3[_0xebd6('0x55')]);_0x1b9ca3['serverUrl']=intUtil[_0xebd6('0x56')](_0x1b9ca3[_0xebd6('0x57')]);var _0xe02f03=util[_0xebd6('0x50')](_0xebd6('0x58'),_0x1b9ca3['remoteUri']);_0x2af860[_0xebd6('0x19')]=!_[_0xebd6('0x59')](_0x5af5fa)?_0x5af5fa[_0xebd6('0x5a')]:null;_0x2af860[_0xebd6('0x21')]=_0x1b9ca3[_0xebd6('0x5a')];_0x2af860[_0xebd6('0x26')]=_0x3e5c57['toLowerCase']()==='outbound'?_0x3f441e[_0xebd6('0x5b')]:_0x3f441e[_0xebd6('0x5c')];_0x2af860[_0xebd6('0x5d')]=_0x3e5c57===_0xebd6('0x5e')||_0x3e5c57===_0xebd6('0x5f')?'queue':'outbound';var _0x2cce5a=util['format'](_0xebd6('0x60'),_0x1b9ca3[_0xebd6('0x57')],_0x3f441e[_0xebd6('0x61')],md5(_0x3f441e[_0xebd6('0x61')]));if(_0x18f4a4&&_0x18f4a4[_0xebd6('0x62')]){logger[_0xebd6('0x11')](_0xebd6('0x63'),_0xebd6('0x64'));_0x3f441e[_0xebd6('0x65')]=_0x2cce5a;}else if(_0x4f1f50&&_0x4f1f50['recordingFormat']&&_0x4f1f50['recordingFormat']!==_0xebd6('0x66')){logger[_0xebd6('0x11')](_0xebd6('0x67'),_0xebd6('0x64'));_0x3f441e['recordingURL']=_0x2cce5a;}else{_0x3f441e['recordingURL']='';}return getAdminUser(_0x3e5c57,_0x3ea0c0,_0x2af860,_0xe02f03,_0x1b924e,_0x416036)['then'](getUser(_0x3e5c57,_0x3ea0c0,_0xe02f03,_0x1b924e,_0x416036))[_0xebd6('0xd')](getEndUser(_0x3e5c57,_0x3ea0c0,_0xe02f03,_0x1b924e,_0x416036))[_0xebd6('0xd')](getTicket(_0x3e5c57,_0x3ea0c0,_0xe02f03,_0x3aa401,_0x3f441e,_0x1b924e))[_0xebd6('0xd')](function(_0x36c2de){logger['info'](util[_0xebd6('0x50')]('The\x20ticket\x20ID\x20is:\x20%s',_0x36c2de[_0xebd6('0x68')]));logger[_0xebd6('0x11')](util[_0xebd6('0x50')](_0xebd6('0x69'),_0x3e5c57));if(_0x3e5c57!=='unmanaged'){logger[_0xebd6('0x11')]('['+[_0x3e5c57[_0xebd6('0x12')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x1b9ca3[_0xebd6('0x55')],_0x5af5fa[_0xebd6('0x3a')],_0x36c2de['ticketId']);}})[_0xebd6('0x14')](function(_0x323e3f){logger[_0xebd6('0x15')]('['+[_0x3e5c57[_0xebd6('0x12')]()]+_0xebd6('0x6a'),util['inspect'](_0x323e3f,{'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 02d39ac..0f99a68 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 _0x003a=['The\x20Ticket\x20ID\x20is:','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','outbound','uri','%s/service/v4_1/rest.php','recordingFormat','[OUTBOUND]','destcalleridnum','Outbound','users','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','unmanaged','toUpperCase','error','lastevent','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','redis','localhost','socket.io-emitter','POST','emit','info','name','getString','Subjects','assigned_user_id','created_by','description','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','parent_name','direction','forEach','idField','variableName','set_entry','JSON','stringify','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','get_entry_list','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','length','find','name_value_list','user_name','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Enduser\x20created.','first_name','debug','[HTTP]','merge','map','string','customField','nameField','toLowerCase','content','type','custom_fields','push','variable','customVariable','Variable','login','password','PLAIN','sessionID','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!'];(function(_0x29d9f9,_0x41a53c){var _0x158fb9=function(_0xa538){while(--_0xa538){_0x29d9f9['push'](_0x29d9f9['shift']());}};_0x158fb9(++_0x41a53c);}(_0x003a,0x94));var _0xa003=function(_0x3c16d6,_0x1acda2){_0x3c16d6=_0x3c16d6-0x0;var _0x292295=_0x003a[_0x3c16d6];return _0x292295;};'use strict';var _=require(_0xa003('0x0'));var rp=require(_0xa003('0x1'));var BPromise=require(_0xa003('0x2'));var md5=require('md5');var util=require(_0xa003('0x3'));var Redis=require(_0xa003('0x4'));var intUtil=require(_0xa003('0x5'));var config=require(_0xa003('0x6'));var logger=require(_0xa003('0x7'))(_0xa003('0x8'));config['redis']=_[_0xa003('0x9')](config[_0xa003('0xa')],{'host':_0xa003('0xb'),'port':0x18eb});var io=require(_0xa003('0xc'))(new Redis(config[_0xa003('0xa')]));var def={'method':_0xa003('0xd'),'json':!![]};function emit(_0x2dc489,_0x5182db,_0x5e3d09){io['to'](_0x2dc489)[_0xa003('0xe')](_0x5182db,_0x5e3d09);}function getTicket(_0x8b3d72,_0x36176d,_0x3ec726,_0x570373,_0x5721e4,_0xf5babc,_0x59669e,_0x2f9fed){logger[_0xa003('0xf')]('Creating\x20new\x20ticket...');var _0x269023=new Date();var _0x490f47=[{'name':_0xa003('0x10'),'value':intUtil[_0xa003('0x11')](_0x570373[_0xa003('0x12')],_0x5721e4,'\x20')},{'name':_0xa003('0x13'),'value':_0x36176d['id']},{'name':_0xa003('0x14'),'value':_0x36176d['id']},{'name':_0xa003('0x15'),'value':intUtil[_0xa003('0x11')](_0x570373['Descriptions'],_0x5721e4,'\x0a')},{'name':_0xa003('0x16'),'value':_0x269023[_0xa003('0x17')]()[_0xa003('0x18')](0x0,0x13)[_0xa003('0x19')]('T','\x20')},{'name':_0xa003('0x1a'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xa003('0x1b'),'value':_0x3ec726['id']},{'name':_0xa003('0x1c'),'value':'Contacts'},{'name':_0xa003('0x1d'),'value':_0x3ec726[_0xa003('0x10')]},{'name':_0xa003('0x1e'),'value':_0x2f9fed}];if(_0xf5babc['length']){_[_0xa003('0x1f')](_0xf5babc,function(_0x577640){if(_0x5721e4[_0x577640['variableName']]){_0x490f47['push']({'name':_0x577640[_0xa003('0x20')],'value':_0x5721e4[_0x577640[_0xa003('0x21')]]});}});}return request({'form':{'method':_0xa003('0x22'),'input_type':_0xa003('0x23'),'response_type':_0xa003('0x23'),'rest_data':JSON[_0xa003('0x24')]({'session':_0x59669e['id'],'module_name':'Calls','name_value_list':_0x490f47})}});}function getAuth(_0x5dd3a3){return util['format'](_0xa003('0x25'),new Buffer(_0x5dd3a3[_0xa003('0x26')]+':X')[_0xa003('0x27')](_0xa003('0x28')));}function getServerInfo(_0x59b360){return request({'form':{'method':_0xa003('0x29'),'input_type':_0xa003('0x23'),'response_type':_0xa003('0x23'),'rest_data':JSON[_0xa003('0x24')]({'session':_0x59b360['id']})}});}function getUser(_0x44f152,_0x518e3c,_0x317bac){if(!_[_0xa003('0x2a')](_0x518e3c)){logger['info']('Getting\x20agent\x20with\x20name',_0x518e3c);return request({'form':{'method':_0xa003('0x2b'),'input_type':_0xa003('0x23'),'response_type':_0xa003('0x23'),'rest_data':JSON[_0xa003('0x24')]({'session':_0x317bac['id'],'module_name':'Employees','query':util[_0xa003('0x2c')](_0xa003('0x2d'),_0x518e3c),'order_by':'','offset':'0','select_fields':['id',_0xa003('0x10'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xa003('0x2e')](function(_0x11d1d9){if(_0x11d1d9[_0xa003('0x2f')][_0xa003('0x30')]){var _0x5e1c94=_[_0xa003('0x31')](_0x11d1d9[_0xa003('0x2f')],function(_0x4e7005){return _0x4e7005[_0xa003('0x32')][_0xa003('0x33')][_0xa003('0x34')]===_0x518e3c;});if(_0x5e1c94){logger[_0xa003('0xf')](_0xa003('0x35'));return BPromise[_0xa003('0x36')]({'id':_0x5e1c94[_0xa003('0x32')]['id'][_0xa003('0x34')],'name':_0x5e1c94[_0xa003('0x32')][_0xa003('0x10')][_0xa003('0x34')]});}}logger[_0xa003('0xf')](_0xa003('0x37'));return BPromise['resolve']({'id':_0x317bac[_0xa003('0x32')][_0xa003('0x38')][_0xa003('0x34')],'name':_0x317bac[_0xa003('0x32')]['user_name'][_0xa003('0x34')]});});}else{logger[_0xa003('0xf')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xa003('0x36')]({'id':_0x317bac[_0xa003('0x32')]['user_id'][_0xa003('0x34')],'name':_0x317bac[_0xa003('0x32')][_0xa003('0x33')][_0xa003('0x34')]});}}function getEndUser(_0x508d36,_0x1d7a58,_0x424d54,_0x4e5a71){logger['info'](_0xa003('0x39'),_0x424d54);return request({'form':{'method':_0xa003('0x2b'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xa003('0x24')]({'session':_0x4e5a71['id'],'module_name':_0xa003('0x3a'),'query':util[_0xa003('0x2c')](_0xa003('0x3b'),_0x424d54),'order_by':'','offset':'0','select_fields':['id',_0xa003('0x10'),_0xa003('0x3c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xa003('0x2e')](function(_0x1aa798){if(_0x1aa798[_0xa003('0x2f')][_0xa003('0x30')]){var _0x2a61d3=_['find'](_0x1aa798[_0xa003('0x2f')],function(_0x46a708){return _0x46a708[_0xa003('0x32')][_0xa003('0x3c')][_0xa003('0x34')]===_0x424d54;});if(_0x2a61d3){logger['info'](_0xa003('0x3d'));return BPromise[_0xa003('0x36')]({'id':_0x2a61d3['name_value_list']['id'][_0xa003('0x34')],'name':_0x2a61d3[_0xa003('0x32')]['name'][_0xa003('0x34')],'phone':_0x2a61d3['name_value_list'][_0xa003('0x3c')][_0xa003('0x34')]});}}else{logger[_0xa003('0xf')](_0xa003('0x3e'));return request({'form':{'method':_0xa003('0x22'),'input_type':_0xa003('0x23'),'response_type':_0xa003('0x23'),'rest_data':JSON[_0xa003('0x24')]({'session':_0x4e5a71['id'],'module_name':'Contacts','name_value_list':[{'name':'first_name','value':_0x1d7a58!==_0xa003('0x3f')?_0x1d7a58:util[_0xa003('0x2c')]('Caller\x20-\x20%s',_0x424d54)},{'name':_0xa003('0x3c'),'value':_0x424d54}]})}})[_0xa003('0x2e')](function(_0x1c633b){logger[_0xa003('0xf')](_0xa003('0x40'));return BPromise[_0xa003('0x36')]({'id':_0x1c633b['id'],'name':_0x1c633b[_0xa003('0x2f')][_0xa003('0x41')][_0xa003('0x34')],'phone':_0x1c633b[_0xa003('0x2f')][_0xa003('0x3c')][_0xa003('0x34')]});});}});}function request(_0x5b6d25){logger[_0xa003('0x42')](_0xa003('0x43'),JSON[_0xa003('0x24')](_0x5b6d25));return rp(_[_0xa003('0x44')](def,_0x5b6d25));}function getTags(_0x5ddb5b,_0x53ec5a){var _0x1caecb=[];if(_0x5ddb5b&&_0x5ddb5b['length']>0x0){_0x1caecb=_[_0xa003('0x45')](_0x5ddb5b,_0x53ec5a);}return _0x1caecb;}function getCustomFields(_0x56fee1,_0x6be5b8){var _0x31b0bb=[];var _0x429a6d={'custom_fields':[]};if(_0x56fee1[_0xa003('0x30')]>0x0){_['forEach'](_0x56fee1,function(_0x30ba51){if(_0x30ba51['type']===_0xa003('0x46')&&_0x30ba51['nameField']&&!_0x30ba51[_0xa003('0x47')]){_0x429a6d[_0x30ba51[_0xa003('0x48')][_0xa003('0x49')]()]=_0x30ba51[_0xa003('0x4a')]['toString']();}else if(_0x30ba51[_0xa003('0x4b')]==='string'&&_0x30ba51[_0xa003('0x20')]&&_0x30ba51[_0xa003('0x47')]){_0x429a6d[_0xa003('0x4c')][_0xa003('0x4d')]({'id':_0x30ba51[_0xa003('0x20')],'value':_0x30ba51[_0xa003('0x4a')][_0xa003('0x27')]()});}else if(_0x30ba51[_0xa003('0x4b')]===_0xa003('0x4e')&&_0x30ba51[_0xa003('0x21')]&&_0x30ba51['idField']&&_0x30ba51['customField']){_0x6be5b8[_0x30ba51['variableName']]&&_0x429a6d[_0xa003('0x4c')][_0xa003('0x4d')]({'id':_0x30ba51[_0xa003('0x20')],'value':_0x6be5b8[_0x30ba51[_0xa003('0x21')]][_0xa003('0x27')]()});}else if(_0x30ba51[_0xa003('0x4b')]===_0xa003('0x4f')&&_0x30ba51[_0xa003('0x50')]&&_0x30ba51[_0xa003('0x50')][_0xa003('0x10')]&&_0x30ba51[_0xa003('0x20')]&&_0x30ba51['customField']){_0x6be5b8[_0x30ba51[_0xa003('0x50')][_0xa003('0x10')]['toLowerCase']()]&&_0x429a6d[_0xa003('0x4c')][_0xa003('0x4d')]({'id':_0x30ba51[_0xa003('0x20')],'value':_0x6be5b8[_0x30ba51[_0xa003('0x50')][_0xa003('0x10')]['toLowerCase']()][_0xa003('0x27')]()});}});}return _0x429a6d;}function getConnection(_0x334597){return request({'method':_0xa003('0xd'),'form':{'method':_0xa003('0x51'),'input_type':_0xa003('0x23'),'response_type':'JSON','rest_data':JSON[_0xa003('0x24')]({'user_auth':{'user_name':_0x334597['username'],'password':_0x334597[_0xa003('0x52')],'encryption':_0xa003('0x53')},'application':'xCALLY\x20Motion\x20integration'})}})[_0xa003('0x2e')](function(_0x449343){var _0x20729a=_0x449343;if(_0x20729a['id']){def[_0xa003('0x54')]=_0x20729a['id'];return BPromise['resolve'](_0x20729a);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x334597['id']));}});}function setRelationship(_0x300c5f,_0x5619b6,_0x36cbdf,_0x18173d){return request({'form':{'method':_0xa003('0x55'),'input_type':_0xa003('0x23'),'response_type':_0xa003('0x23'),'rest_data':JSON[_0xa003('0x24')]({'session':_0x300c5f['id'],'module_name':_0xa003('0x56'),'module_id':_0x36cbdf['id'],'link_field_name':_0x18173d,'related_ids':[_0x5619b6['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xa003('0x57')]=function(_0x67a15,_0x4e9f29,_0x327f55,_0x56ff73,_0x800baa,_0x42220e){var _0x1bdb98,_0x46eaee,_0x5d37f6,_0x6f78a3;_0x42220e[_0xa003('0x58')]=intUtil[_0xa003('0x59')](_0x42220e[_0xa003('0x58')]);_0x42220e[_0xa003('0x5a')]=intUtil[_0xa003('0x59')](_0x42220e[_0xa003('0x5a')]);def['uri']=util[_0xa003('0x2c')]('%s/service/v4_1/rest.php',_0x42220e['remoteUri']);if(_0x800baa&&_0x800baa[_0xa003('0x5b')]){logger['info'](_0xa003('0x5c'),_0xa003('0x5d'));_0x4e9f29['recordingURL']=util[_0xa003('0x2c')](_0xa003('0x5e'),_0x42220e[_0xa003('0x5a')],_0x4e9f29[_0xa003('0x5f')],md5(_0x4e9f29[_0xa003('0x5f')]));}else{_0x4e9f29[_0xa003('0x60')]='';}return getConnection(_0x42220e)['then'](function(_0x10ee2d){_0x6f78a3=_0x10ee2d;return getUser(_0x42220e,_0x56ff73[_0xa003('0x10')],_0x6f78a3);})[_0xa003('0x2e')](function(_0x114d21){_0x1bdb98=_0x114d21;logger[_0xa003('0xf')](_0xa003('0x61'),_0x1bdb98['id']);return getEndUser(_0x42220e,_0x4e9f29[_0xa003('0x62')],_0x4e9f29[_0xa003('0x63')],_0x6f78a3);})['then'](function(_0x4fed98){_0x46eaee=_0x4fed98;logger[_0xa003('0xf')](_0xa003('0x64'),_0x46eaee['id']);return getTicket(_0x42220e,_0x1bdb98,_0x46eaee,_0x327f55,_0x4e9f29,_0x327f55[_0xa003('0x65')],_0x6f78a3,_0xa003('0x66'));})[_0xa003('0x2e')](function(_0x4dc53d){_0x5d37f6=_0x4dc53d;logger[_0xa003('0xf')](_0xa003('0x67'));logger[_0xa003('0xf')](_0xa003('0x68'),_0x5d37f6['id']);return setRelationship(_0x6f78a3,_0x1bdb98,_0x5d37f6,'users');})['then'](function(){return setRelationship(_0x6f78a3,_0x46eaee,_0x5d37f6,_0xa003('0x69'));})[_0xa003('0x2e')](function(){return getServerInfo(_0x6f78a3);})[_0xa003('0x2e')](function(_0x3f4eb8){var _0x556908=parseInt(_0x3f4eb8['version'][_0xa003('0x6a')](0x0));var _0x6d6d95=util[_0xa003('0x2c')](_0xa003('0x6b'),_0x42220e['remoteUri'],_0x5d37f6['id']);if(_0x556908>0x6){_0x6d6d95=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x42220e[_0xa003('0x58')],_0x5d37f6['id']);}logger[_0xa003('0xf')](_0xa003('0x5c'),_0xa003('0x6c'));emit(util[_0xa003('0x2c')](_0xa003('0x6d'),_0x56ff73['name']),_0xa003('0x6e'),{'uri':_0x6d6d95});})[_0xa003('0x6f')](function(_0x3c93fb){logger['error'](_0xa003('0x5c'),JSON[_0xa003('0x24')](_0x3c93fb));});};exports[_0xa003('0x70')]=function(_0x43d083,_0x40bec4,_0xdc542d,_0x40f0f4,_0x4aba23,_0x2082a0,_0x459646){var _0x3b790a,_0x23a697,_0x3f24f2,_0x9eea08;_0x2082a0['remoteUri']=intUtil[_0xa003('0x59')](_0x2082a0[_0xa003('0x58')]);_0x2082a0[_0xa003('0x5a')]=intUtil[_0xa003('0x59')](_0x2082a0[_0xa003('0x5a')]);def[_0xa003('0x71')]=util[_0xa003('0x2c')](_0xa003('0x72'),_0x2082a0[_0xa003('0x58')]);if(_0x459646&&_0x459646[_0xa003('0x73')]&&_0x459646['recordingFormat']!=='none'){logger['info'](_0xa003('0x74'),_0xa003('0x5d'));_0x40bec4[_0xa003('0x60')]=util['format'](_0xa003('0x5e'),_0x2082a0[_0xa003('0x5a')],_0x40bec4[_0xa003('0x5f')],md5(_0x40bec4['uniqueid']));}return getConnection(_0x2082a0)[_0xa003('0x2e')](function(_0x5e5703){_0x9eea08=_0x5e5703;return getUser(_0x2082a0,_0x40f0f4[_0xa003('0x10')],_0x9eea08);})[_0xa003('0x2e')](function(_0xe3066c){_0x3b790a=_0xe3066c;logger[_0xa003('0xf')](_0xa003('0x61'),_0x3b790a['id']);return getEndUser(_0x2082a0,_0x40bec4['destcalleridname'],_0x40bec4[_0xa003('0x75')],_0x9eea08);})[_0xa003('0x2e')](function(_0x3bb1f1){_0x23a697=_0x3bb1f1;logger['info'](_0xa003('0x64'),_0x23a697['id']);return getTicket(_0x2082a0,_0x3b790a,_0x23a697,_0xdc542d,_0x40bec4,_0xdc542d[_0xa003('0x65')],_0x9eea08,_0xa003('0x76'));})[_0xa003('0x2e')](function(_0x28a520){_0x3f24f2=_0x28a520;logger[_0xa003('0xf')](_0xa003('0x67'));logger[_0xa003('0xf')]('The\x20Ticket\x20ID\x20is:',_0x3f24f2['id']);return setRelationship(_0x9eea08,_0x3b790a,_0x3f24f2,_0xa003('0x77'));})[_0xa003('0x2e')](function(){return setRelationship(_0x9eea08,_0x23a697,_0x3f24f2,_0xa003('0x69'));})[_0xa003('0x2e')](function(){return getServerInfo(_0x9eea08);})[_0xa003('0x2e')](function(_0x535235){var _0x3865fc=parseInt(_0x535235[_0xa003('0x78')]['charAt'](0x0));var _0x4200b7=util[_0xa003('0x2c')](_0xa003('0x6b'),_0x2082a0[_0xa003('0x58')],_0x3f24f2['id']);if(_0x3865fc>0x6){_0x4200b7=util[_0xa003('0x2c')](_0xa003('0x79'),_0x2082a0[_0xa003('0x58')],_0x3f24f2['id']);}logger[_0xa003('0xf')](_0xa003('0x74'),_0xa003('0x6c'));emit(util[_0xa003('0x2c')](_0xa003('0x6d'),_0x40f0f4[_0xa003('0x10')]),_0xa003('0x6e'),{'uri':_0x4200b7});})[_0xa003('0x6f')](function(_0x294ecb){logger['error'](_0xa003('0x74'),JSON[_0xa003('0x24')](_0x294ecb));});};exports[_0xa003('0x7a')]=function(_0x16e8f6,_0x313869,_0x5f4e0d,_0x596104,_0x50eff5,_0x3a14af){var _0x5c6676,_0x374ba2,_0x406ce1,_0x5ee94e;_0x3a14af[_0xa003('0x58')]=intUtil['stripTrailingSlash'](_0x3a14af[_0xa003('0x58')]);_0x3a14af[_0xa003('0x5a')]=intUtil[_0xa003('0x59')](_0x3a14af['serverUrl']);def[_0xa003('0x71')]=util['format']('%s/service/v4_1/rest.php',_0x3a14af[_0xa003('0x58')]);if(_0x50eff5&&_0x50eff5[_0xa003('0x5b')]){logger[_0xa003('0xf')]('['+_0x313869['lastevent'][_0xa003('0x7b')]()+']',_0xa003('0x5d'));_0x313869[_0xa003('0x60')]=util[_0xa003('0x2c')](_0xa003('0x5e'),_0x3a14af[_0xa003('0x5a')],_0x313869[_0xa003('0x5f')],md5(_0x313869[_0xa003('0x5f')]));}else{_0x313869[_0xa003('0x60')]='';}return getConnection(_0x3a14af)[_0xa003('0x2e')](function(_0x1f7a11){_0x5ee94e=_0x1f7a11;if(!_['isNil'](_0x596104)){return getUser(_0x3a14af,_0x596104['name'],_0x5ee94e);}else{return getUser(_0x3a14af,null,_0x5ee94e);}})[_0xa003('0x2e')](function(_0x2f89fb){_0x5c6676=_0x2f89fb;logger[_0xa003('0xf')](_0xa003('0x61'),_0x5c6676['id']);return getEndUser(_0x3a14af,_0x313869[_0xa003('0x62')],_0x313869[_0xa003('0x63')],_0x5ee94e);})['then'](function(_0x46e45a){_0x374ba2=_0x46e45a;logger['info'](_0xa003('0x64'),_0x374ba2['id']);return getTicket(_0x3a14af,_0x5c6676,_0x374ba2,_0x5f4e0d,_0x313869,_0x5f4e0d[_0xa003('0x65')],_0x5ee94e,_0xa003('0x66'));})[_0xa003('0x2e')](function(_0x3d84f2){_0x406ce1=_0x3d84f2;logger[_0xa003('0xf')]('Ticket\x20created!');logger[_0xa003('0xf')](_0xa003('0x68'),_0x406ce1['id']);return setRelationship(_0x5ee94e,_0x5c6676,_0x406ce1,_0xa003('0x77'));})[_0xa003('0x2e')](function(){return setRelationship(_0x5ee94e,_0x374ba2,_0x406ce1,'contacts');})[_0xa003('0x2e')](function(){return getServerInfo(_0x5ee94e);})['catch'](function(_0x13ef54){logger[_0xa003('0x7c')]('['+_0x313869[_0xa003('0x7d')][_0xa003('0x7b')]()+']',JSON[_0xa003('0x24')](_0x13ef54));});}; \ No newline at end of file +var _0x9d4f=['Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','uri','%s/service/v4_1/rest.php','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Outbound','catch','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','assigned_user_id','created_by','description','getString','toISOString','slice','replace','duration_hours','duration_minutes','parent_type','Contacts','parent_name','name','length','forEach','variableName','push','idField','JSON','stringify','Basic\x20%s','apiKey','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','then','find','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','format','Caller\x20-\x20%s','[HTTP]','merge','map','customField','toLowerCase','toString','string','custom_fields','content','variable','customVariable','Variable','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','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'];(function(_0x5aadc2,_0x3ff7c1){var _0x1c2d03=function(_0x55ffab){while(--_0x55ffab){_0x5aadc2['push'](_0x5aadc2['shift']());}};_0x1c2d03(++_0x3ff7c1);}(_0x9d4f,0x107));var _0xf9d4=function(_0x5a0815,_0x4fff7a){_0x5a0815=_0x5a0815-0x0;var _0x2ca78a=_0x9d4f[_0x5a0815];return _0x2ca78a;};'use strict';var _=require(_0xf9d4('0x0'));var rp=require(_0xf9d4('0x1'));var BPromise=require(_0xf9d4('0x2'));var md5=require(_0xf9d4('0x3'));var util=require(_0xf9d4('0x4'));var Redis=require(_0xf9d4('0x5'));var intUtil=require('./util');var config=require(_0xf9d4('0x6'));var logger=require(_0xf9d4('0x7'))('sugarcrm');config['redis']=_['defaults'](config[_0xf9d4('0x8')],{'host':_0xf9d4('0x9'),'port':0x18eb});var io=require(_0xf9d4('0xa'))(new Redis(config[_0xf9d4('0x8')]));var def={'method':_0xf9d4('0xb'),'json':!![]};function emit(_0x2917d9,_0x262167,_0x205a37){io['to'](_0x2917d9)['emit'](_0x262167,_0x205a37);}function getTicket(_0x2c75f5,_0x45a34e,_0x29ab0a,_0x377c79,_0x2a9cfe,_0x5953a9,_0x4a78b1,_0x202b3c){logger[_0xf9d4('0xc')](_0xf9d4('0xd'));var _0x1d41cc=new Date();var _0x3abf32=[{'name':'name','value':intUtil['getString'](_0x377c79['Subjects'],_0x2a9cfe,'\x20')},{'name':_0xf9d4('0xe'),'value':_0x45a34e['id']},{'name':_0xf9d4('0xf'),'value':_0x45a34e['id']},{'name':_0xf9d4('0x10'),'value':intUtil[_0xf9d4('0x11')](_0x377c79['Descriptions'],_0x2a9cfe,'\x0a')},{'name':'date_start','value':_0x1d41cc[_0xf9d4('0x12')]()[_0xf9d4('0x13')](0x0,0x13)[_0xf9d4('0x14')]('T','\x20')},{'name':_0xf9d4('0x15'),'value':'0'},{'name':_0xf9d4('0x16'),'value':'15'},{'name':'parent_id','value':_0x29ab0a['id']},{'name':_0xf9d4('0x17'),'value':_0xf9d4('0x18')},{'name':_0xf9d4('0x19'),'value':_0x29ab0a[_0xf9d4('0x1a')]},{'name':'direction','value':_0x202b3c}];if(_0x5953a9[_0xf9d4('0x1b')]){_[_0xf9d4('0x1c')](_0x5953a9,function(_0x59f2bc){if(_0x2a9cfe[_0x59f2bc[_0xf9d4('0x1d')]]){_0x3abf32[_0xf9d4('0x1e')]({'name':_0x59f2bc[_0xf9d4('0x1f')],'value':_0x2a9cfe[_0x59f2bc['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':_0xf9d4('0x20'),'response_type':'JSON','rest_data':JSON[_0xf9d4('0x21')]({'session':_0x4a78b1['id'],'module_name':'Calls','name_value_list':_0x3abf32})}});}function getAuth(_0x3e9a49){return util['format'](_0xf9d4('0x22'),new Buffer(_0x3e9a49[_0xf9d4('0x23')]+':X')['toString'](_0xf9d4('0x24')));}function getServerInfo(_0x2a9fd9){return request({'form':{'method':_0xf9d4('0x25'),'input_type':_0xf9d4('0x20'),'response_type':_0xf9d4('0x20'),'rest_data':JSON[_0xf9d4('0x21')]({'session':_0x2a9fd9['id']})}});}function getUser(_0x4db862,_0x37ac34,_0x313a56){if(!_[_0xf9d4('0x26')](_0x37ac34)){logger[_0xf9d4('0xc')](_0xf9d4('0x27'),_0x37ac34);return request({'form':{'method':_0xf9d4('0x28'),'input_type':'JSON','response_type':_0xf9d4('0x20'),'rest_data':JSON[_0xf9d4('0x21')]({'session':_0x313a56['id'],'module_name':_0xf9d4('0x29'),'query':util['format'](_0xf9d4('0x2a'),_0x37ac34),'order_by':'','offset':'0','select_fields':['id',_0xf9d4('0x1a'),_0xf9d4('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x51f9df){if(_0x51f9df[_0xf9d4('0x2c')][_0xf9d4('0x1b')]){var _0x38afac=_['find'](_0x51f9df[_0xf9d4('0x2c')],function(_0xf95867){return _0xf95867[_0xf9d4('0x2d')][_0xf9d4('0x2b')][_0xf9d4('0x2e')]===_0x37ac34;});if(_0x38afac){logger[_0xf9d4('0xc')](_0xf9d4('0x2f'));return BPromise[_0xf9d4('0x30')]({'id':_0x38afac[_0xf9d4('0x2d')]['id']['value'],'name':_0x38afac[_0xf9d4('0x2d')][_0xf9d4('0x1a')][_0xf9d4('0x2e')]});}}logger[_0xf9d4('0xc')](_0xf9d4('0x31'));return BPromise[_0xf9d4('0x30')]({'id':_0x313a56[_0xf9d4('0x2d')][_0xf9d4('0x32')][_0xf9d4('0x2e')],'name':_0x313a56[_0xf9d4('0x2d')][_0xf9d4('0x2b')]['value']});});}else{logger['info'](_0xf9d4('0x33'));return BPromise[_0xf9d4('0x30')]({'id':_0x313a56[_0xf9d4('0x2d')][_0xf9d4('0x32')][_0xf9d4('0x2e')],'name':_0x313a56[_0xf9d4('0x2d')][_0xf9d4('0x2b')]['value']});}}function getEndUser(_0x1570b5,_0x795d8e,_0x255941,_0x4e71c4){logger[_0xf9d4('0xc')](_0xf9d4('0x34'),_0x255941);return request({'form':{'method':_0xf9d4('0x28'),'input_type':_0xf9d4('0x20'),'response_type':_0xf9d4('0x20'),'rest_data':JSON[_0xf9d4('0x21')]({'session':_0x4e71c4['id'],'module_name':'Contacts','query':util['format'](_0xf9d4('0x35'),_0x255941),'order_by':'','offset':'0','select_fields':['id','name','phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf9d4('0x36')](function(_0x33fd17){if(_0x33fd17['entry_list'][_0xf9d4('0x1b')]){var _0x255aff=_[_0xf9d4('0x37')](_0x33fd17[_0xf9d4('0x2c')],function(_0x4d911c){return _0x4d911c[_0xf9d4('0x2d')][_0xf9d4('0x38')]['value']===_0x255941;});if(_0x255aff){logger[_0xf9d4('0xc')](_0xf9d4('0x39'));return BPromise['resolve']({'id':_0x255aff[_0xf9d4('0x2d')]['id']['value'],'name':_0x255aff[_0xf9d4('0x2d')][_0xf9d4('0x1a')][_0xf9d4('0x2e')],'phone':_0x255aff['name_value_list'][_0xf9d4('0x38')]['value']});}}else{logger[_0xf9d4('0xc')](_0xf9d4('0x3a'));return request({'form':{'method':_0xf9d4('0x3b'),'input_type':_0xf9d4('0x20'),'response_type':_0xf9d4('0x20'),'rest_data':JSON['stringify']({'session':_0x4e71c4['id'],'module_name':_0xf9d4('0x18'),'name_value_list':[{'name':_0xf9d4('0x3c'),'value':_0x795d8e!==_0xf9d4('0x3d')?_0x795d8e:util[_0xf9d4('0x3e')](_0xf9d4('0x3f'),_0x255941)},{'name':_0xf9d4('0x38'),'value':_0x255941}]})}})[_0xf9d4('0x36')](function(_0x28aa45){logger[_0xf9d4('0xc')]('Enduser\x20created.');return BPromise[_0xf9d4('0x30')]({'id':_0x28aa45['id'],'name':_0x28aa45['entry_list'][_0xf9d4('0x3c')][_0xf9d4('0x2e')],'phone':_0x28aa45[_0xf9d4('0x2c')][_0xf9d4('0x38')][_0xf9d4('0x2e')]});});}});}function request(_0x4df31c){logger['debug'](_0xf9d4('0x40'),JSON[_0xf9d4('0x21')](_0x4df31c));return rp(_[_0xf9d4('0x41')](def,_0x4df31c));}function getTags(_0x28a30f,_0x5e947d){var _0x1eca19=[];if(_0x28a30f&&_0x28a30f['length']>0x0){_0x1eca19=_[_0xf9d4('0x42')](_0x28a30f,_0x5e947d);}return _0x1eca19;}function getCustomFields(_0x69b21a,_0x1c7981){var _0xff4de6=[];var _0x5719a9={'custom_fields':[]};if(_0x69b21a['length']>0x0){_[_0xf9d4('0x1c')](_0x69b21a,function(_0x32f192){if(_0x32f192['type']==='string'&&_0x32f192['nameField']&&!_0x32f192[_0xf9d4('0x43')]){_0x5719a9[_0x32f192['nameField'][_0xf9d4('0x44')]()]=_0x32f192['content'][_0xf9d4('0x45')]();}else if(_0x32f192['type']===_0xf9d4('0x46')&&_0x32f192[_0xf9d4('0x1f')]&&_0x32f192[_0xf9d4('0x43')]){_0x5719a9[_0xf9d4('0x47')][_0xf9d4('0x1e')]({'id':_0x32f192[_0xf9d4('0x1f')],'value':_0x32f192[_0xf9d4('0x48')][_0xf9d4('0x45')]()});}else if(_0x32f192['type']===_0xf9d4('0x49')&&_0x32f192[_0xf9d4('0x1d')]&&_0x32f192['idField']&&_0x32f192['customField']){_0x1c7981[_0x32f192[_0xf9d4('0x1d')]]&&_0x5719a9['custom_fields'][_0xf9d4('0x1e')]({'id':_0x32f192[_0xf9d4('0x1f')],'value':_0x1c7981[_0x32f192[_0xf9d4('0x1d')]]['toString']()});}else if(_0x32f192['type']===_0xf9d4('0x4a')&&_0x32f192[_0xf9d4('0x4b')]&&_0x32f192['Variable'][_0xf9d4('0x1a')]&&_0x32f192['idField']&&_0x32f192[_0xf9d4('0x43')]){_0x1c7981[_0x32f192['Variable'][_0xf9d4('0x1a')][_0xf9d4('0x44')]()]&&_0x5719a9[_0xf9d4('0x47')][_0xf9d4('0x1e')]({'id':_0x32f192[_0xf9d4('0x1f')],'value':_0x1c7981[_0x32f192['Variable']['name'][_0xf9d4('0x44')]()][_0xf9d4('0x45')]()});}});}return _0x5719a9;}function getConnection(_0x1c751c){return request({'method':_0xf9d4('0xb'),'form':{'method':'login','input_type':_0xf9d4('0x20'),'response_type':_0xf9d4('0x20'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x1c751c['username'],'password':_0x1c751c[_0xf9d4('0x4c')],'encryption':_0xf9d4('0x4d')},'application':_0xf9d4('0x4e')})}})[_0xf9d4('0x36')](function(_0x2713a7){var _0x4dd28a=_0x2713a7;if(_0x4dd28a['id']){def[_0xf9d4('0x4f')]=_0x4dd28a['id'];return BPromise['resolve'](_0x4dd28a);}else{throw new Error(util[_0xf9d4('0x3e')](_0xf9d4('0x50'),_0x1c751c['id']));}});}function setRelationship(_0xa00e99,_0x55fa51,_0x3a130a,_0x3145e5){return request({'form':{'method':_0xf9d4('0x51'),'input_type':_0xf9d4('0x20'),'response_type':_0xf9d4('0x20'),'rest_data':JSON[_0xf9d4('0x21')]({'session':_0xa00e99['id'],'module_name':_0xf9d4('0x52'),'module_id':_0x3a130a['id'],'link_field_name':_0x3145e5,'related_ids':[_0x55fa51['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xf9d4('0x53')]=function(_0x21a5b1,_0x54ca14,_0x3b3583,_0x584999,_0x3d9346,_0x83429b){var _0x10173f,_0x5b0d04,_0x170eeb,_0x591a09;_0x83429b[_0xf9d4('0x54')]=intUtil[_0xf9d4('0x55')](_0x83429b[_0xf9d4('0x54')]);_0x83429b[_0xf9d4('0x56')]=intUtil[_0xf9d4('0x55')](_0x83429b[_0xf9d4('0x56')]);def['uri']=util['format']('%s/service/v4_1/rest.php',_0x83429b['remoteUri']);if(_0x3d9346&&_0x3d9346[_0xf9d4('0x57')]){logger['info'](_0xf9d4('0x58'),_0xf9d4('0x59'));_0x54ca14[_0xf9d4('0x5a')]=util[_0xf9d4('0x3e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x83429b[_0xf9d4('0x56')],_0x54ca14[_0xf9d4('0x5b')],md5(_0x54ca14['uniqueid']));}else{_0x54ca14[_0xf9d4('0x5a')]='';}return getConnection(_0x83429b)[_0xf9d4('0x36')](function(_0x20f549){_0x591a09=_0x20f549;return getUser(_0x83429b,_0x584999['name'],_0x591a09);})[_0xf9d4('0x36')](function(_0x3b5bdd){_0x10173f=_0x3b5bdd;logger['info'](_0xf9d4('0x5c'),_0x10173f['id']);return getEndUser(_0x83429b,_0x54ca14[_0xf9d4('0x5d')],_0x54ca14[_0xf9d4('0x5e')],_0x591a09);})[_0xf9d4('0x36')](function(_0x23f9c6){_0x5b0d04=_0x23f9c6;logger[_0xf9d4('0xc')](_0xf9d4('0x5f'),_0x5b0d04['id']);return getTicket(_0x83429b,_0x10173f,_0x5b0d04,_0x3b3583,_0x54ca14,_0x3b3583[_0xf9d4('0x60')],_0x591a09,_0xf9d4('0x61'));})['then'](function(_0x129ee3){_0x170eeb=_0x129ee3;logger[_0xf9d4('0xc')](_0xf9d4('0x62'));logger[_0xf9d4('0xc')](_0xf9d4('0x63'),_0x170eeb['id']);return setRelationship(_0x591a09,_0x10173f,_0x170eeb,_0xf9d4('0x64'));})['then'](function(){return setRelationship(_0x591a09,_0x5b0d04,_0x170eeb,_0xf9d4('0x65'));})[_0xf9d4('0x36')](function(){return getServerInfo(_0x591a09);})[_0xf9d4('0x36')](function(_0x41808f){var _0x54d7d8=parseInt(_0x41808f[_0xf9d4('0x66')][_0xf9d4('0x67')](0x0));var _0x26c9ef=util[_0xf9d4('0x3e')](_0xf9d4('0x68'),_0x83429b[_0xf9d4('0x54')],_0x170eeb['id']);if(_0x54d7d8>0x6){_0x26c9ef=util[_0xf9d4('0x3e')](_0xf9d4('0x69'),_0x83429b[_0xf9d4('0x54')],_0x170eeb['id']);}logger['info']('[QUEUE]',_0xf9d4('0x6a'));emit(util['format'](_0xf9d4('0x6b'),_0x584999[_0xf9d4('0x1a')]),_0xf9d4('0x6c'),{'uri':_0x26c9ef});})['catch'](function(_0x1f09c3){logger[_0xf9d4('0x6d')](_0xf9d4('0x58'),JSON[_0xf9d4('0x21')](_0x1f09c3));});};exports[_0xf9d4('0x6e')]=function(_0x50bb5b,_0x4fc012,_0x52efe3,_0x305b14,_0x587197,_0xca2f24,_0x354152){var _0x4e0f5b,_0x387679,_0x19f93a,_0x477d0b;_0xca2f24['remoteUri']=intUtil[_0xf9d4('0x55')](_0xca2f24['remoteUri']);_0xca2f24[_0xf9d4('0x56')]=intUtil[_0xf9d4('0x55')](_0xca2f24[_0xf9d4('0x56')]);def[_0xf9d4('0x6f')]=util['format'](_0xf9d4('0x70'),_0xca2f24[_0xf9d4('0x54')]);if(_0x354152&&_0x354152['recordingFormat']&&_0x354152['recordingFormat']!==_0xf9d4('0x71')){logger['info'](_0xf9d4('0x72'),_0xf9d4('0x59'));_0x4fc012[_0xf9d4('0x5a')]=util[_0xf9d4('0x3e')](_0xf9d4('0x73'),_0xca2f24[_0xf9d4('0x56')],_0x4fc012[_0xf9d4('0x5b')],md5(_0x4fc012[_0xf9d4('0x5b')]));}return getConnection(_0xca2f24)[_0xf9d4('0x36')](function(_0x458a4b){_0x477d0b=_0x458a4b;return getUser(_0xca2f24,_0x305b14[_0xf9d4('0x1a')],_0x477d0b);})[_0xf9d4('0x36')](function(_0x16a6c3){_0x4e0f5b=_0x16a6c3;logger[_0xf9d4('0xc')](_0xf9d4('0x5c'),_0x4e0f5b['id']);return getEndUser(_0xca2f24,_0x4fc012[_0xf9d4('0x74')],_0x4fc012[_0xf9d4('0x75')],_0x477d0b);})[_0xf9d4('0x36')](function(_0x2270ab){_0x387679=_0x2270ab;logger[_0xf9d4('0xc')](_0xf9d4('0x5f'),_0x387679['id']);return getTicket(_0xca2f24,_0x4e0f5b,_0x387679,_0x52efe3,_0x4fc012,_0x52efe3[_0xf9d4('0x60')],_0x477d0b,_0xf9d4('0x76'));})[_0xf9d4('0x36')](function(_0x1aa807){_0x19f93a=_0x1aa807;logger['info'](_0xf9d4('0x62'));logger[_0xf9d4('0xc')](_0xf9d4('0x63'),_0x19f93a['id']);return setRelationship(_0x477d0b,_0x4e0f5b,_0x19f93a,_0xf9d4('0x64'));})[_0xf9d4('0x36')](function(){return setRelationship(_0x477d0b,_0x387679,_0x19f93a,_0xf9d4('0x65'));})[_0xf9d4('0x36')](function(){return getServerInfo(_0x477d0b);})[_0xf9d4('0x36')](function(_0x252356){var _0x5c005e=parseInt(_0x252356['version']['charAt'](0x0));var _0x4300e9=util['format'](_0xf9d4('0x68'),_0xca2f24['remoteUri'],_0x19f93a['id']);if(_0x5c005e>0x6){_0x4300e9=util['format'](_0xf9d4('0x69'),_0xca2f24[_0xf9d4('0x54')],_0x19f93a['id']);}logger[_0xf9d4('0xc')](_0xf9d4('0x72'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf9d4('0x3e')](_0xf9d4('0x6b'),_0x305b14[_0xf9d4('0x1a')]),'trigger:browser:url',{'uri':_0x4300e9});})[_0xf9d4('0x77')](function(_0x354fc0){logger['error'](_0xf9d4('0x72'),JSON[_0xf9d4('0x21')](_0x354fc0));});};exports[_0xf9d4('0x78')]=function(_0x17111f,_0x3432c1,_0x295aab,_0x178160,_0x2dcc92,_0x55dcf6){var _0x8dccbb,_0xea1e46,_0x2bd6f5,_0xe68235;_0x55dcf6['remoteUri']=intUtil[_0xf9d4('0x55')](_0x55dcf6[_0xf9d4('0x54')]);_0x55dcf6[_0xf9d4('0x56')]=intUtil[_0xf9d4('0x55')](_0x55dcf6['serverUrl']);def[_0xf9d4('0x6f')]=util[_0xf9d4('0x3e')](_0xf9d4('0x70'),_0x55dcf6[_0xf9d4('0x54')]);if(_0x2dcc92&&_0x2dcc92[_0xf9d4('0x57')]){logger['info']('['+_0x3432c1[_0xf9d4('0x79')]['toUpperCase']()+']',_0xf9d4('0x59'));_0x3432c1[_0xf9d4('0x5a')]=util[_0xf9d4('0x3e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x55dcf6['serverUrl'],_0x3432c1[_0xf9d4('0x5b')],md5(_0x3432c1['uniqueid']));}else{_0x3432c1[_0xf9d4('0x5a')]='';}return getConnection(_0x55dcf6)['then'](function(_0x3881d1){_0xe68235=_0x3881d1;if(!_['isNil'](_0x178160)){return getUser(_0x55dcf6,_0x178160[_0xf9d4('0x1a')],_0xe68235);}else{return getUser(_0x55dcf6,null,_0xe68235);}})[_0xf9d4('0x36')](function(_0x293e10){_0x8dccbb=_0x293e10;logger[_0xf9d4('0xc')](_0xf9d4('0x5c'),_0x8dccbb['id']);return getEndUser(_0x55dcf6,_0x3432c1[_0xf9d4('0x5d')],_0x3432c1[_0xf9d4('0x5e')],_0xe68235);})[_0xf9d4('0x36')](function(_0x2abd55){_0xea1e46=_0x2abd55;logger[_0xf9d4('0xc')]('The\x20Enduser\x20ID\x20is:',_0xea1e46['id']);return getTicket(_0x55dcf6,_0x8dccbb,_0xea1e46,_0x295aab,_0x3432c1,_0x295aab[_0xf9d4('0x60')],_0xe68235,'Inbound');})['then'](function(_0xcd3656){_0x2bd6f5=_0xcd3656;logger[_0xf9d4('0xc')](_0xf9d4('0x62'));logger[_0xf9d4('0xc')](_0xf9d4('0x63'),_0x2bd6f5['id']);return setRelationship(_0xe68235,_0x8dccbb,_0x2bd6f5,_0xf9d4('0x64'));})[_0xf9d4('0x36')](function(){return setRelationship(_0xe68235,_0xea1e46,_0x2bd6f5,_0xf9d4('0x65'));})[_0xf9d4('0x36')](function(){return getServerInfo(_0xe68235);})['catch'](function(_0x55f196){logger[_0xf9d4('0x6d')]('['+_0x3432c1[_0xf9d4('0x79')][_0xf9d4('0x7a')]()+']',JSON[_0xf9d4('0x21')](_0x55f196));});}; \ 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 901ec34..464a3d0 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 _0x367e=['stripTrailingSlash','lastIndexOf','validateEmail','test','util','getString','sortBy','string','push','content','type','variable','variableName','toString','customVariable','Variable','name','keyValue','keyType','key','format','%s:\x20%s','keyContent','toLowerCase','join'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x367e,0xe5));var _0xe367=function(_0x576422,_0x1ff4d2){_0x576422=_0x576422-0x0;var _0x33f6f5=_0x367e[_0x576422];return _0x33f6f5;};'use strict';var _=require('lodash');var util=require(_0xe367('0x0'));exports[_0xe367('0x1')]=function(_0x5f5973,_0x1e0356,_0x3b1819){var _0x34c621=[];if(_0x5f5973['length']>0x0){var _0x252b00=_[_0xe367('0x2')](_0x5f5973,['id']);for(var _0x293021=0x0;_0x293021<_0x252b00['length'];_0x293021++){var _0x8b6226=_0x252b00[_0x293021];if(_0x8b6226['type']===_0xe367('0x3')){_0x34c621[_0xe367('0x4')](_0x8b6226[_0xe367('0x5')]);}else if(_0x8b6226[_0xe367('0x6')]===_0xe367('0x7')&&_0x8b6226[_0xe367('0x8')]){_0x1e0356[_0x8b6226[_0xe367('0x8')]]&&_0x34c621[_0xe367('0x4')](_0x1e0356[_0x8b6226['variableName']][_0xe367('0x9')]());}else if(_0x8b6226[_0xe367('0x6')]===_0xe367('0xa')&&_0x8b6226[_0xe367('0xb')]&&_0x8b6226[_0xe367('0xb')][_0xe367('0xc')]){_0x1e0356[_0x8b6226['Variable'][_0xe367('0xc')]['toLowerCase']()]&&_0x34c621[_0xe367('0x4')](_0x1e0356[_0x8b6226['Variable'][_0xe367('0xc')]['toLowerCase']()]['toString']());}else if(_0x8b6226['type']===_0xe367('0xd')){if(_0x8b6226[_0xe367('0xe')]===_0xe367('0x3')&&_0x8b6226[_0xe367('0xf')]){_0x34c621['push'](util[_0xe367('0x10')](_0xe367('0x11'),_0x8b6226['key'],_0x8b6226[_0xe367('0x12')]));}else if(_0x8b6226[_0xe367('0xe')]==='variable'&&_0x8b6226['variableName']&&_0x8b6226[_0xe367('0xf')]){_0x1e0356[_0x8b6226[_0xe367('0x8')]]&&_0x34c621[_0xe367('0x4')](util[_0xe367('0x10')](_0xe367('0x11'),_0x8b6226[_0xe367('0xf')],_0x1e0356[_0x8b6226[_0xe367('0x8')]]));}else if(_0x8b6226[_0xe367('0xe')]===_0xe367('0xa')&&_0x8b6226[_0xe367('0xb')]&&_0x8b6226[_0xe367('0xb')][_0xe367('0xc')]&&_0x8b6226[_0xe367('0xf')]){_0x1e0356[_0x8b6226['Variable'][_0xe367('0xc')][_0xe367('0x13')]()]&&_0x34c621['push'](util[_0xe367('0x10')](_0xe367('0x11'),_0x8b6226[_0xe367('0xf')],_0x1e0356[_0x8b6226[_0xe367('0xb')]['name'][_0xe367('0x13')]()]));}}}}return _0x34c621[_0xe367('0x14')](_0x3b1819);};exports[_0xe367('0x15')]=function(_0x209977){var _0x306982=_0x209977['slice'](-0x1);if(_0x306982==='/'){_0x209977=_0x209977['substring'](0x0,_0x209977[_0xe367('0x16')](_0x306982));}return _0x209977;};exports[_0xe367('0x17')]=function(_0x2a4d0a){if(!_['isNil'](_0x2a4d0a)&&_0x2a4d0a!==''){var _0x51dcbf=/^(([^<>()\[\]\\.,;:\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 _0x51dcbf[_0xe367('0x18')](String(_0x2a4d0a)[_0xe367('0x13')]());}else{return![];}}; \ No newline at end of file +var _0x75c0=['keyValue','keyType','key','format','%s:\x20%s','keyContent','variable','customVariable','join','stripTrailingSlash','slice','validateEmail','util','getString','length','sortBy','type','string','variableName','toString','Variable','name','push','toLowerCase'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x75c0,0xb4));var _0x075c=function(_0x4bfab7,_0x1f92fc){_0x4bfab7=_0x4bfab7-0x0;var _0x232fd7=_0x75c0[_0x4bfab7];return _0x232fd7;};'use strict';var _=require('lodash');var util=require(_0x075c('0x0'));exports[_0x075c('0x1')]=function(_0xa3cbf1,_0x20788b,_0x5b6120){var _0x3144fe=[];if(_0xa3cbf1[_0x075c('0x2')]>0x0){var _0x417be0=_[_0x075c('0x3')](_0xa3cbf1,['id']);for(var _0x26bee4=0x0;_0x26bee4<_0x417be0[_0x075c('0x2')];_0x26bee4++){var _0x95a0ab=_0x417be0[_0x26bee4];if(_0x95a0ab[_0x075c('0x4')]===_0x075c('0x5')){_0x3144fe['push'](_0x95a0ab['content']);}else if(_0x95a0ab[_0x075c('0x4')]==='variable'&&_0x95a0ab[_0x075c('0x6')]){_0x20788b[_0x95a0ab[_0x075c('0x6')]]&&_0x3144fe['push'](_0x20788b[_0x95a0ab['variableName']][_0x075c('0x7')]());}else if(_0x95a0ab[_0x075c('0x4')]==='customVariable'&&_0x95a0ab[_0x075c('0x8')]&&_0x95a0ab[_0x075c('0x8')][_0x075c('0x9')]){_0x20788b[_0x95a0ab[_0x075c('0x8')][_0x075c('0x9')]['toLowerCase']()]&&_0x3144fe[_0x075c('0xa')](_0x20788b[_0x95a0ab['Variable'][_0x075c('0x9')][_0x075c('0xb')]()][_0x075c('0x7')]());}else if(_0x95a0ab[_0x075c('0x4')]===_0x075c('0xc')){if(_0x95a0ab[_0x075c('0xd')]==='string'&&_0x95a0ab[_0x075c('0xe')]){_0x3144fe[_0x075c('0xa')](util[_0x075c('0xf')](_0x075c('0x10'),_0x95a0ab[_0x075c('0xe')],_0x95a0ab[_0x075c('0x11')]));}else if(_0x95a0ab[_0x075c('0xd')]===_0x075c('0x12')&&_0x95a0ab[_0x075c('0x6')]&&_0x95a0ab[_0x075c('0xe')]){_0x20788b[_0x95a0ab[_0x075c('0x6')]]&&_0x3144fe[_0x075c('0xa')](util[_0x075c('0xf')](_0x075c('0x10'),_0x95a0ab[_0x075c('0xe')],_0x20788b[_0x95a0ab[_0x075c('0x6')]]));}else if(_0x95a0ab[_0x075c('0xd')]===_0x075c('0x13')&&_0x95a0ab['Variable']&&_0x95a0ab[_0x075c('0x8')][_0x075c('0x9')]&&_0x95a0ab[_0x075c('0xe')]){_0x20788b[_0x95a0ab[_0x075c('0x8')][_0x075c('0x9')][_0x075c('0xb')]()]&&_0x3144fe['push'](util[_0x075c('0xf')](_0x075c('0x10'),_0x95a0ab[_0x075c('0xe')],_0x20788b[_0x95a0ab[_0x075c('0x8')][_0x075c('0x9')]['toLowerCase']()]));}}}}return _0x3144fe[_0x075c('0x14')](_0x5b6120);};exports[_0x075c('0x15')]=function(_0x2e62bd){var _0x29a7fa=_0x2e62bd[_0x075c('0x16')](-0x1);if(_0x29a7fa==='/'){_0x2e62bd=_0x2e62bd['substring'](0x0,_0x2e62bd['lastIndexOf'](_0x29a7fa));}return _0x2e62bd;};exports[_0x075c('0x17')]=function(_0x59893c){if(!_['isNil'](_0x59893c)&&_0x59893c!==''){var _0x1f96e7=/^(([^<>()\[\]\\.,;:\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 _0x1f96e7['test'](String(_0x59893c)[_0x075c('0xb')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 1b185a3..64d147f 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x40afc0,_0x2dc403){var _0x4ebbc7=function(_0x52707b){while(--_0x52707b){_0x40afc0['push'](_0x40afc0['shift']());}};_0x4ebbc7(++_0x2dc403);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 96debe9..3b068bf 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 _0x6e2b=['uniqueid','Authorization','email','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','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','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','user:%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridnum','lodash','request-promise','ioredis','./util','zendesk','redis','defaults','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','name','getString','Subjects','Fields','then','info','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','agent','%s/users/me.json','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','toString','base64','debug','[HTTP]','stringify','map','forEach','includes','string','picklist','nameField','toLowerCase','idField','customField','custom_fields','content','type','variable','variableName','customVariable','Variable','push','queue','stripTrailingSlash','serverUrl','recordingURL'];(function(_0x27243d,_0x26ad22){var _0x33cbbd=function(_0x2ae9fd){while(--_0x2ae9fd){_0x27243d['push'](_0x27243d['shift']());}};_0x33cbbd(++_0x26ad22);}(_0x6e2b,0x101));var _0xb6e2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6e2b[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb6e2('0x0'));var rp=require(_0xb6e2('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xb6e2('0x2'));var intUtil=require(_0xb6e2('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xb6e2('0x4'));config[_0xb6e2('0x5')]=_[_0xb6e2('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xb6e2('0x7'))(new Redis(config[_0xb6e2('0x5')]));function emit(_0x4e0918,_0x2fee23,_0x2b7cda){io['to'](_0x4e0918)[_0xb6e2('0x8')](_0x2fee23,_0x2b7cda);}var headers={'Content-Type':_0xb6e2('0x9'),'Accept':_0xb6e2('0x9')};function getTicket(_0x20d790,_0x46e653,_0x454906,_0x5c81d9,_0x198748){logger['info'](_0xb6e2('0xa'));return request({'uri':util[_0xb6e2('0xb')](_0xb6e2('0xc'),_0x20d790[_0xb6e2('0xd')]),'method':_0xb6e2('0xe'),'body':{'ticket':_[_0xb6e2('0xf')]({'requester_id':_0x454906['id'],'submitter_id':_0x46e653?_0x46e653['id']:undefined,'assignee_id':_0x46e653?_0x46e653['id']:undefined,'tags':getTags(_0x5c81d9['Tags'],_0xb6e2('0x10')),'subject':intUtil[_0xb6e2('0x11')](_0x5c81d9[_0xb6e2('0x12')],_0x198748,'\x20'),'description':intUtil[_0xb6e2('0x11')](_0x5c81d9['Descriptions'],_0x198748,'\x0a'),'comment':{'public':![],'body':intUtil[_0xb6e2('0x11')](_0x5c81d9['Descriptions'],_0x198748,'\x0a')}},getCustomFields(_0x5c81d9[_0xb6e2('0x13')],_0x198748))}})[_0xb6e2('0x14')](function(_0x28e654){logger[_0xb6e2('0x15')](_0xb6e2('0x16'));return _0x28e654['ticket'];});}function getUser(_0xf81585,_0x556c22){if(intUtil[_0xb6e2('0x17')](_0x556c22)){logger['info'](_0xb6e2('0x18'),_0x556c22);return request({'uri':util['format'](_0xb6e2('0x19'),_0xf81585[_0xb6e2('0xd')]),'qs':{'query':util[_0xb6e2('0xb')](_0xb6e2('0x1a'),_0x556c22)}})[_0xb6e2('0x14')](function(_0x50f744){if(_0x50f744['count']){logger[_0xb6e2('0x15')](_0xb6e2('0x1b'));return _[_0xb6e2('0x1c')](_0x50f744[_0xb6e2('0x1d')],{'email':_0x556c22,'role':_0xb6e2('0x1e')});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xb6e2('0xb')](_0xb6e2('0x1f'),_0xf81585[_0xb6e2('0xd')])})[_0xb6e2('0x14')](function(_0x4ebb01){logger[_0xb6e2('0x15')]('Admin\x20account\x20selected.');return _0x4ebb01[_0xb6e2('0x20')];});}});}else{logger[_0xb6e2('0x15')](_0xb6e2('0x21'));return request({'uri':util[_0xb6e2('0xb')]('%s/users/me.json',_0xf81585[_0xb6e2('0xd')])})[_0xb6e2('0x14')](function(_0x52c1ff){logger['info'](_0xb6e2('0x22'));return _0x52c1ff[_0xb6e2('0x20')];});}}function getEndUser(_0x17bf83,_0x4c8caa,_0x111fae){logger[_0xb6e2('0x15')](_0xb6e2('0x23'),_0x111fae);return request({'uri':util[_0xb6e2('0xb')](_0xb6e2('0x19'),_0x17bf83[_0xb6e2('0xd')]),'qs':{'query':util[_0xb6e2('0xb')](_0xb6e2('0x24'),_0x111fae)}})[_0xb6e2('0x14')](function(_0x1db9c7){var _0x1ab8e8;if(_0x1db9c7[_0xb6e2('0x1d')][_0xb6e2('0x25')]){_0x1db9c7[_0xb6e2('0x1d')]=_[_0xb6e2('0x26')](_0x1db9c7['results'],{'suspended':![],'role':_0xb6e2('0x27')});if(_0x1db9c7['results'][_0xb6e2('0x25')]){_0x1ab8e8=_[_0xb6e2('0x28')](_0x1db9c7[_0xb6e2('0x1d')]);}}if(_0x1ab8e8){logger[_0xb6e2('0x15')](_0xb6e2('0x29'));return _0x1ab8e8;}else{logger[_0xb6e2('0x15')](_0xb6e2('0x2a'));return request({'uri':util[_0xb6e2('0xb')](_0xb6e2('0x2b'),_0x17bf83[_0xb6e2('0xd')]),'method':'POST','body':{'user':{'role':_0xb6e2('0x27'),'name':util[_0xb6e2('0xb')](_0xb6e2('0x2c'),_0x4c8caa||_0x111fae),'phone':_0x111fae}}})['then'](function(_0x1e5ed7){logger[_0xb6e2('0x15')](_0xb6e2('0x2d'));return _0x1e5ed7['user'];});}});}function getAuth(_0x1a3b67){var _0x2d250b;if(_0x1a3b67[_0xb6e2('0x2e')]===_0xb6e2('0x2f')){_0x2d250b=util[_0xb6e2('0xb')]('%s:%s',_0x1a3b67[_0xb6e2('0x30')],_0x1a3b67['password']);}else if(_0x1a3b67[_0xb6e2('0x2e')]==='token'){_0x2d250b=util[_0xb6e2('0xb')]('%s/token:%s',_0x1a3b67['username'],_0x1a3b67[_0xb6e2('0x31')]);}return util[_0xb6e2('0xb')]('Basic\x20%s',new Buffer(_0x2d250b)[_0xb6e2('0x32')](_0xb6e2('0x33')));}function request(_0x1cbb3b){logger[_0xb6e2('0x34')](_0xb6e2('0x35'),JSON[_0xb6e2('0x36')](_0x1cbb3b));return rp(_['defaults'](_0x1cbb3b,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x19948c,_0x2fa31d){var _0xa91cea=[];if(_0x19948c&&_0x19948c[_0xb6e2('0x25')]>0x0){_0xa91cea=_[_0xb6e2('0x37')](_0x19948c,_0x2fa31d);}return _0xa91cea;}function getCustomFields(_0x4b7266,_0x1afc7d){var _0x22084e=[];var _0x27711e={'custom_fields':[]};if(_0x4b7266['length']>0x0){_[_0xb6e2('0x38')](_0x4b7266,function(_0x249910){if(_[_0xb6e2('0x39')]([_0xb6e2('0x3a'),_0xb6e2('0x3b')],_0x249910['type'])&&_0x249910['nameField']&&!_0x249910['customField']){_0x27711e[_0x249910[_0xb6e2('0x3c')][_0xb6e2('0x3d')]()]=_0x249910['content'][_0xb6e2('0x32')]();}else if(_['includes'](['string',_0xb6e2('0x3b')],_0x249910['type'])&&_0x249910[_0xb6e2('0x3e')]&&_0x249910[_0xb6e2('0x3f')]){_0x27711e[_0xb6e2('0x40')]['push']({'id':_0x249910[_0xb6e2('0x3e')],'value':_0x249910[_0xb6e2('0x41')][_0xb6e2('0x32')]()});}else if(_0x249910[_0xb6e2('0x42')]===_0xb6e2('0x43')&&_0x249910[_0xb6e2('0x44')]&&_0x249910[_0xb6e2('0x3e')]&&_0x249910[_0xb6e2('0x3f')]){_0x1afc7d[_0x249910['variableName']]&&_0x27711e[_0xb6e2('0x40')]['push']({'id':_0x249910[_0xb6e2('0x3e')],'value':_0x1afc7d[_0x249910[_0xb6e2('0x44')]][_0xb6e2('0x32')]()});}else if(_0x249910[_0xb6e2('0x42')]===_0xb6e2('0x45')&&_0x249910[_0xb6e2('0x46')]&&_0x249910[_0xb6e2('0x46')][_0xb6e2('0x10')]&&_0x249910[_0xb6e2('0x3e')]&&_0x249910['customField']){_0x1afc7d[_0x249910[_0xb6e2('0x46')][_0xb6e2('0x10')][_0xb6e2('0x3d')]()]&&_0x27711e[_0xb6e2('0x40')][_0xb6e2('0x47')]({'id':_0x249910[_0xb6e2('0x3e')],'value':_0x1afc7d[_0x249910[_0xb6e2('0x46')][_0xb6e2('0x10')][_0xb6e2('0x3d')]()][_0xb6e2('0x32')]()});}});}return _0x27711e;}exports[_0xb6e2('0x48')]=function(_0x3a342d,_0x4f13eb,_0x23c09b,_0x304f17,_0x1b9cd3,_0x4e7f21){var _0x5c637b,_0x4b1061;_0x4e7f21['remoteUri']=intUtil[_0xb6e2('0x49')](_0x4e7f21[_0xb6e2('0xd')]);_0x4e7f21[_0xb6e2('0x4a')]=intUtil[_0xb6e2('0x49')](_0x4e7f21[_0xb6e2('0x4a')]);if(_0x1b9cd3&&_0x1b9cd3['monitor_format']){logger[_0xb6e2('0x15')]('[QUEUE]','Recording\x20is\x20enabled!');_0x4f13eb[_0xb6e2('0x4b')]=util[_0xb6e2('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4e7f21[_0xb6e2('0x4a')],_0x4f13eb[_0xb6e2('0x4c')],md5(_0x4f13eb[_0xb6e2('0x4c')]));}else{_0x4f13eb['recordingURL']='';}headers[_0xb6e2('0x4d')]=getAuth(_0x4e7f21);return getUser(_0x4e7f21,_0x304f17[_0xb6e2('0x4e')])['then'](function(_0x252f5f){_0x5c637b=_0x252f5f;logger[_0xb6e2('0x15')]('The\x20User\x20ID\x20is:',_0x5c637b['id']);return getEndUser(_0x4e7f21,_0x4f13eb[_0xb6e2('0x4f')],_0x4f13eb['calleridnum']);})['then'](function(_0x11df70){_0x4b1061=_0x11df70;logger[_0xb6e2('0x15')](_0xb6e2('0x50'),_0x4b1061['id']);return getTicket(_0x4e7f21,_0x5c637b,_0x4b1061,_0x23c09b,_0x4f13eb);})[_0xb6e2('0x14')](function(_0x23e69f){if(_0x23e69f){logger[_0xb6e2('0x15')](_0xb6e2('0x51'),_0x23e69f['id']);switch(_0x4e7f21[_0xb6e2('0x42')]){case _0xb6e2('0x52'):logger[_0xb6e2('0x15')](_0xb6e2('0x53'),_0xb6e2('0x54'));return request({'uri':util[_0xb6e2('0xb')](_0xb6e2('0x55'),_0x4e7f21[_0xb6e2('0xd')],_0x5c637b['id'],_0x23e69f['id']),'method':'POST'});case _0xb6e2('0x56'):logger[_0xb6e2('0x15')](_0xb6e2('0x53'),_0xb6e2('0x57'));emit(util[_0xb6e2('0xb')]('user:%s',_0x304f17[_0xb6e2('0x10')]),_0xb6e2('0x58'),{'uri':util[_0xb6e2('0xb')](_0xb6e2('0x59'),_0x4e7f21[_0xb6e2('0xd')][_0xb6e2('0x5a')](_0xb6e2('0x5b'),''),_0x23e69f['id'])});break;default:logger['error'](_0xb6e2('0x53'),_0xb6e2('0x5c'));}}})[_0xb6e2('0x5d')](function(_0x131de2){logger[_0xb6e2('0x5e')](_0xb6e2('0x5f'),util[_0xb6e2('0x60')](_0x131de2,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x44dbdd,_0x271df7,_0x2ce42a,_0x1d1bb8,_0xd45d4b,_0x530a8b,_0x48dacd){var _0x1cc365,_0x254434;_0x530a8b[_0xb6e2('0xd')]=intUtil['stripTrailingSlash'](_0x530a8b[_0xb6e2('0xd')]);_0x530a8b[_0xb6e2('0x4a')]=intUtil[_0xb6e2('0x49')](_0x530a8b[_0xb6e2('0x4a')]);if(_0x48dacd&&_0x48dacd[_0xb6e2('0x61')]&&_0x48dacd['recordingFormat']!==_0xb6e2('0x62')){logger['info'](_0xb6e2('0x63'),_0xb6e2('0x64'));_0x271df7['recordingURL']=util[_0xb6e2('0xb')](_0xb6e2('0x65'),_0x530a8b[_0xb6e2('0x4a')],_0x271df7['uniqueid'],md5(_0x271df7[_0xb6e2('0x4c')]));}headers[_0xb6e2('0x4d')]=getAuth(_0x530a8b);return getUser(_0x530a8b,_0x1d1bb8[_0xb6e2('0x4e')])[_0xb6e2('0x14')](function(_0x505637){_0x1cc365=_0x505637;logger[_0xb6e2('0x15')](_0xb6e2('0x66'),_0x1cc365['id']);return getEndUser(_0x530a8b,_0x271df7[_0xb6e2('0x67')],_0x271df7[_0xb6e2('0x68')]);})[_0xb6e2('0x14')](function(_0x5f0532){_0x254434=_0x5f0532;logger[_0xb6e2('0x15')](_0xb6e2('0x50'),_0x254434['id']);return getTicket(_0x530a8b,_0x1cc365,_0x254434,_0x2ce42a,_0x271df7);})[_0xb6e2('0x14')](function(_0x52a3a1){if(_0x52a3a1){logger[_0xb6e2('0x15')]('The\x20Ticket\x20ID\x20is:',_0x52a3a1['id']);switch(_0x530a8b['type']){case _0xb6e2('0x52'):logger[_0xb6e2('0x15')](_0xb6e2('0x63'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x530a8b[_0xb6e2('0xd')],_0x1cc365['id'],_0x52a3a1['id']),'method':_0xb6e2('0xe')});case _0xb6e2('0x56'):logger[_0xb6e2('0x15')](_0xb6e2('0x63'),_0xb6e2('0x57'));emit(util['format'](_0xb6e2('0x69'),_0x1d1bb8[_0xb6e2('0x10')]),'trigger:browser:url',{'uri':util[_0xb6e2('0xb')](_0xb6e2('0x59'),_0x530a8b[_0xb6e2('0xd')][_0xb6e2('0x5a')]('/api/v2',''),_0x52a3a1['id'])});break;default:logger[_0xb6e2('0x5e')](_0xb6e2('0x63'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xb6e2('0x5d')](function(_0x436db8){logger[_0xb6e2('0x5e')](_0xb6e2('0x6a'),util[_0xb6e2('0x60')](_0x436db8,{'showHidden':!![],'depth':null}));});};exports[_0xb6e2('0x6b')]=function(_0x523f8a,_0x3d031a,_0x3d898c,_0x208b1e,_0x3d35b7,_0x468bb6){var _0x2d3445,_0x2f1863;_0x468bb6[_0xb6e2('0xd')]=intUtil['stripTrailingSlash'](_0x468bb6[_0xb6e2('0xd')]);_0x468bb6[_0xb6e2('0x4a')]=intUtil['stripTrailingSlash'](_0x468bb6[_0xb6e2('0x4a')]);if(_0x3d35b7&&_0x3d35b7['monitor_format']){logger[_0xb6e2('0x15')]('['+_0x3d031a[_0xb6e2('0x6c')][_0xb6e2('0x6d')]()+']',_0xb6e2('0x64'));_0x3d031a[_0xb6e2('0x4b')]=util[_0xb6e2('0xb')](_0xb6e2('0x65'),_0x468bb6['serverUrl'],_0x3d031a[_0xb6e2('0x4c')],md5(_0x3d031a[_0xb6e2('0x4c')]));}else{_0x3d031a['recordingURL']='';}headers[_0xb6e2('0x4d')]=getAuth(_0x468bb6);return getUser(_0x468bb6)[_0xb6e2('0x14')](function(_0x18378d){_0x2d3445=_0x18378d;logger['info'](_0xb6e2('0x66'),_0x2d3445['id']);return getEndUser(_0x468bb6,_0x3d031a[_0xb6e2('0x4f')],_0x3d031a[_0xb6e2('0x6e')]);})[_0xb6e2('0x14')](function(_0x2282cb){_0x2f1863=_0x2282cb;logger['info'](_0xb6e2('0x50'),_0x2f1863['id']);return getTicket(_0x468bb6,_0x2d3445,_0x2f1863,_0x3d898c,_0x3d031a);})[_0xb6e2('0x14')](function(_0x885287){if(_0x885287){logger[_0xb6e2('0x15')](_0xb6e2('0x51'),_0x885287['id']);}})['catch'](function(_0x400926){logger[_0xb6e2('0x5e')]('['+_0x3d031a['lastevent'][_0xb6e2('0x6d')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xb6e2('0x60')](_0x400926,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb2a5=['length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','%s/token:%s','token','Basic\x20%s','base64','[HTTP]','defaults','GET','map','forEach','includes','string','customField','nameField','toLowerCase','toString','picklist','type','idField','custom_fields','push','content','variableName','name','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','destcalleridnum','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','../../../../config/environment','zendesk','redis','localhost','emit','application/json','info','Creating\x20new\x20ticket...','remoteUri','POST','merge','Tags','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','Agent\x20found!','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s'];(function(_0x1e98ce,_0x585b6f){var _0x15b0c4=function(_0x39a039){while(--_0x39a039){_0x1e98ce['push'](_0x1e98ce['shift']());}};_0x15b0c4(++_0x585b6f);}(_0xb2a5,0x129));var _0x5b2a=function(_0x1f9dea,_0x55e16c){_0x1f9dea=_0x1f9dea-0x0;var _0x5c44f4=_0xb2a5[_0x1f9dea];return _0x5c44f4;};'use strict';var _=require(_0x5b2a('0x0'));var rp=require(_0x5b2a('0x1'));var md5=require(_0x5b2a('0x2'));var util=require(_0x5b2a('0x3'));var Redis=require(_0x5b2a('0x4'));var intUtil=require('./util');var config=require(_0x5b2a('0x5'));var logger=require('../../../../config/logger')(_0x5b2a('0x6'));config[_0x5b2a('0x7')]=_['defaults'](config['redis'],{'host':_0x5b2a('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5b2a('0x7')]));function emit(_0x17d680,_0x564971,_0x41cda6){io['to'](_0x17d680)[_0x5b2a('0x9')](_0x564971,_0x41cda6);}var headers={'Content-Type':_0x5b2a('0xa'),'Accept':'application/json'};function getTicket(_0x3a6ba3,_0x19e417,_0x37c062,_0x122afd,_0x106d4d){logger[_0x5b2a('0xb')](_0x5b2a('0xc'));return request({'uri':util['format']('%s/tickets.json',_0x3a6ba3[_0x5b2a('0xd')]),'method':_0x5b2a('0xe'),'body':{'ticket':_[_0x5b2a('0xf')]({'requester_id':_0x37c062['id'],'submitter_id':_0x19e417?_0x19e417['id']:undefined,'assignee_id':_0x19e417?_0x19e417['id']:undefined,'tags':getTags(_0x122afd[_0x5b2a('0x10')],'name'),'subject':intUtil[_0x5b2a('0x11')](_0x122afd[_0x5b2a('0x12')],_0x106d4d,'\x20'),'description':intUtil['getString'](_0x122afd[_0x5b2a('0x13')],_0x106d4d,'\x0a'),'comment':{'public':![],'body':intUtil[_0x5b2a('0x11')](_0x122afd['Descriptions'],_0x106d4d,'\x0a')}},getCustomFields(_0x122afd[_0x5b2a('0x14')],_0x106d4d))}})[_0x5b2a('0x15')](function(_0x9f5163){logger[_0x5b2a('0xb')](_0x5b2a('0x16'));return _0x9f5163['ticket'];});}function getUser(_0x145618,_0x22ef9b){if(intUtil[_0x5b2a('0x17')](_0x22ef9b)){logger['info'](_0x5b2a('0x18'),_0x22ef9b);return request({'uri':util[_0x5b2a('0x19')](_0x5b2a('0x1a'),_0x145618[_0x5b2a('0xd')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x22ef9b)}})['then'](function(_0x3466fb){if(_0x3466fb['count']){logger['info'](_0x5b2a('0x1b'));return _['find'](_0x3466fb[_0x5b2a('0x1c')],{'email':_0x22ef9b,'role':_0x5b2a('0x1d')});}else{logger[_0x5b2a('0xb')](_0x5b2a('0x1e'));return request({'uri':util['format'](_0x5b2a('0x1f'),_0x145618[_0x5b2a('0xd')])})[_0x5b2a('0x15')](function(_0x37658c){logger[_0x5b2a('0xb')](_0x5b2a('0x20'));return _0x37658c[_0x5b2a('0x21')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x5b2a('0x19')](_0x5b2a('0x1f'),_0x145618[_0x5b2a('0xd')])})[_0x5b2a('0x15')](function(_0x13c98f){logger[_0x5b2a('0xb')](_0x5b2a('0x20'));return _0x13c98f['user'];});}}function getEndUser(_0x9ee269,_0x2ba81c,_0x54795f){logger[_0x5b2a('0xb')](_0x5b2a('0x22'),_0x54795f);return request({'uri':util[_0x5b2a('0x19')](_0x5b2a('0x1a'),_0x9ee269[_0x5b2a('0xd')]),'qs':{'query':util[_0x5b2a('0x19')](_0x5b2a('0x23'),_0x54795f)}})[_0x5b2a('0x15')](function(_0x3a9489){var _0x55dc87;if(_0x3a9489[_0x5b2a('0x1c')][_0x5b2a('0x24')]){_0x3a9489[_0x5b2a('0x1c')]=_[_0x5b2a('0x25')](_0x3a9489['results'],{'suspended':![],'role':'end-user'});if(_0x3a9489[_0x5b2a('0x1c')][_0x5b2a('0x24')]){_0x55dc87=_[_0x5b2a('0x26')](_0x3a9489['results']);}}if(_0x55dc87){logger['info'](_0x5b2a('0x27'));return _0x55dc87;}else{logger['info'](_0x5b2a('0x28'));return request({'uri':util[_0x5b2a('0x19')]('%s/users.json',_0x9ee269['remoteUri']),'method':_0x5b2a('0xe'),'body':{'user':{'role':_0x5b2a('0x29'),'name':util['format'](_0x5b2a('0x2a'),_0x2ba81c||_0x54795f),'phone':_0x54795f}}})['then'](function(_0x9dbc84){logger[_0x5b2a('0xb')](_0x5b2a('0x2b'));return _0x9dbc84[_0x5b2a('0x21')];});}});}function getAuth(_0x110973){var _0x206edf;if(_0x110973[_0x5b2a('0x2c')]===_0x5b2a('0x2d')){_0x206edf=util[_0x5b2a('0x19')](_0x5b2a('0x2e'),_0x110973[_0x5b2a('0x2f')],_0x110973[_0x5b2a('0x2d')]);}else if(_0x110973['authType']==='token'){_0x206edf=util[_0x5b2a('0x19')](_0x5b2a('0x30'),_0x110973[_0x5b2a('0x2f')],_0x110973[_0x5b2a('0x31')]);}return util[_0x5b2a('0x19')](_0x5b2a('0x32'),new Buffer(_0x206edf)['toString'](_0x5b2a('0x33')));}function request(_0x35e6f5){logger['debug'](_0x5b2a('0x34'),JSON['stringify'](_0x35e6f5));return rp(_[_0x5b2a('0x35')](_0x35e6f5,{'method':_0x5b2a('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x11f053,_0x568e9a){var _0x37c3c0=[];if(_0x11f053&&_0x11f053['length']>0x0){_0x37c3c0=_[_0x5b2a('0x37')](_0x11f053,_0x568e9a);}return _0x37c3c0;}function getCustomFields(_0x16764e,_0xf4422){var _0x281094=[];var _0x20acde={'custom_fields':[]};if(_0x16764e[_0x5b2a('0x24')]>0x0){_[_0x5b2a('0x38')](_0x16764e,function(_0x38e358){if(_[_0x5b2a('0x39')]([_0x5b2a('0x3a'),'picklist'],_0x38e358['type'])&&_0x38e358['nameField']&&!_0x38e358[_0x5b2a('0x3b')]){_0x20acde[_0x38e358[_0x5b2a('0x3c')][_0x5b2a('0x3d')]()]=_0x38e358['content'][_0x5b2a('0x3e')]();}else if(_[_0x5b2a('0x39')]([_0x5b2a('0x3a'),_0x5b2a('0x3f')],_0x38e358[_0x5b2a('0x40')])&&_0x38e358[_0x5b2a('0x41')]&&_0x38e358['customField']){_0x20acde[_0x5b2a('0x42')][_0x5b2a('0x43')]({'id':_0x38e358[_0x5b2a('0x41')],'value':_0x38e358[_0x5b2a('0x44')]['toString']()});}else if(_0x38e358[_0x5b2a('0x40')]==='variable'&&_0x38e358['variableName']&&_0x38e358[_0x5b2a('0x41')]&&_0x38e358['customField']){_0xf4422[_0x38e358[_0x5b2a('0x45')]]&&_0x20acde['custom_fields'][_0x5b2a('0x43')]({'id':_0x38e358[_0x5b2a('0x41')],'value':_0xf4422[_0x38e358[_0x5b2a('0x45')]][_0x5b2a('0x3e')]()});}else if(_0x38e358[_0x5b2a('0x40')]==='customVariable'&&_0x38e358['Variable']&&_0x38e358['Variable'][_0x5b2a('0x46')]&&_0x38e358[_0x5b2a('0x41')]&&_0x38e358[_0x5b2a('0x3b')]){_0xf4422[_0x38e358[_0x5b2a('0x47')][_0x5b2a('0x46')]['toLowerCase']()]&&_0x20acde[_0x5b2a('0x42')][_0x5b2a('0x43')]({'id':_0x38e358[_0x5b2a('0x41')],'value':_0xf4422[_0x38e358['Variable']['name'][_0x5b2a('0x3d')]()][_0x5b2a('0x3e')]()});}});}return _0x20acde;}exports[_0x5b2a('0x48')]=function(_0x21c817,_0x54839c,_0x31566b,_0x5a2db0,_0x5a3635,_0x232e36){var _0x15c473,_0x27ea3b;_0x232e36[_0x5b2a('0xd')]=intUtil[_0x5b2a('0x49')](_0x232e36['remoteUri']);_0x232e36['serverUrl']=intUtil[_0x5b2a('0x49')](_0x232e36[_0x5b2a('0x4a')]);if(_0x5a3635&&_0x5a3635['monitor_format']){logger[_0x5b2a('0xb')](_0x5b2a('0x4b'),_0x5b2a('0x4c'));_0x54839c[_0x5b2a('0x4d')]=util[_0x5b2a('0x19')](_0x5b2a('0x4e'),_0x232e36[_0x5b2a('0x4a')],_0x54839c[_0x5b2a('0x4f')],md5(_0x54839c[_0x5b2a('0x4f')]));}else{_0x54839c['recordingURL']='';}headers[_0x5b2a('0x50')]=getAuth(_0x232e36);return getUser(_0x232e36,_0x5a2db0[_0x5b2a('0x51')])[_0x5b2a('0x15')](function(_0x728681){_0x15c473=_0x728681;logger[_0x5b2a('0xb')](_0x5b2a('0x52'),_0x15c473['id']);return getEndUser(_0x232e36,_0x54839c[_0x5b2a('0x53')],_0x54839c[_0x5b2a('0x54')]);})['then'](function(_0x45a751){_0x27ea3b=_0x45a751;logger['info'](_0x5b2a('0x55'),_0x27ea3b['id']);return getTicket(_0x232e36,_0x15c473,_0x27ea3b,_0x31566b,_0x54839c);})['then'](function(_0x1942ae){if(_0x1942ae){logger['info'](_0x5b2a('0x56'),_0x1942ae['id']);switch(_0x232e36['type']){case _0x5b2a('0x57'):logger[_0x5b2a('0xb')](_0x5b2a('0x4b'),_0x5b2a('0x58'));return request({'uri':util['format'](_0x5b2a('0x59'),_0x232e36['remoteUri'],_0x15c473['id'],_0x1942ae['id']),'method':_0x5b2a('0xe')});case _0x5b2a('0x5a'):logger['info'](_0x5b2a('0x4b'),_0x5b2a('0x5b'));emit(util[_0x5b2a('0x19')](_0x5b2a('0x5c'),_0x5a2db0[_0x5b2a('0x46')]),_0x5b2a('0x5d'),{'uri':util[_0x5b2a('0x19')](_0x5b2a('0x5e'),_0x232e36[_0x5b2a('0xd')][_0x5b2a('0x5f')](_0x5b2a('0x60'),''),_0x1942ae['id'])});break;default:logger[_0x5b2a('0x61')]('[QUEUE]',_0x5b2a('0x62'));}}})['catch'](function(_0xacaf41){logger[_0x5b2a('0x61')](_0x5b2a('0x63'),util[_0x5b2a('0x64')](_0xacaf41,{'showHidden':!![],'depth':null}));});};exports[_0x5b2a('0x65')]=function(_0xf9ef5a,_0xd1c21a,_0xc12673,_0x1b3039,_0x1db73d,_0x5e4a42,_0x44de1a){var _0x174abf,_0x37bb47;_0x5e4a42[_0x5b2a('0xd')]=intUtil[_0x5b2a('0x49')](_0x5e4a42[_0x5b2a('0xd')]);_0x5e4a42[_0x5b2a('0x4a')]=intUtil[_0x5b2a('0x49')](_0x5e4a42[_0x5b2a('0x4a')]);if(_0x44de1a&&_0x44de1a['recordingFormat']&&_0x44de1a[_0x5b2a('0x66')]!=='none'){logger[_0x5b2a('0xb')](_0x5b2a('0x67'),_0x5b2a('0x4c'));_0xd1c21a[_0x5b2a('0x4d')]=util[_0x5b2a('0x19')](_0x5b2a('0x4e'),_0x5e4a42[_0x5b2a('0x4a')],_0xd1c21a[_0x5b2a('0x4f')],md5(_0xd1c21a[_0x5b2a('0x4f')]));}headers['Authorization']=getAuth(_0x5e4a42);return getUser(_0x5e4a42,_0x1b3039[_0x5b2a('0x51')])[_0x5b2a('0x15')](function(_0x2af78c){_0x174abf=_0x2af78c;logger[_0x5b2a('0xb')](_0x5b2a('0x52'),_0x174abf['id']);return getEndUser(_0x5e4a42,_0xd1c21a['destcalleridname'],_0xd1c21a[_0x5b2a('0x68')]);})[_0x5b2a('0x15')](function(_0x11b0d1){_0x37bb47=_0x11b0d1;logger[_0x5b2a('0xb')](_0x5b2a('0x55'),_0x37bb47['id']);return getTicket(_0x5e4a42,_0x174abf,_0x37bb47,_0xc12673,_0xd1c21a);})[_0x5b2a('0x15')](function(_0x5add4c){if(_0x5add4c){logger[_0x5b2a('0xb')](_0x5b2a('0x56'),_0x5add4c['id']);switch(_0x5e4a42[_0x5b2a('0x40')]){case _0x5b2a('0x57'):logger[_0x5b2a('0xb')](_0x5b2a('0x67'),_0x5b2a('0x58'));return request({'uri':util[_0x5b2a('0x19')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x5e4a42[_0x5b2a('0xd')],_0x174abf['id'],_0x5add4c['id']),'method':_0x5b2a('0xe')});case'newTab':logger[_0x5b2a('0xb')](_0x5b2a('0x67'),_0x5b2a('0x5b'));emit(util[_0x5b2a('0x19')](_0x5b2a('0x5c'),_0x1b3039[_0x5b2a('0x46')]),'trigger:browser:url',{'uri':util['format'](_0x5b2a('0x5e'),_0x5e4a42[_0x5b2a('0xd')][_0x5b2a('0x5f')](_0x5b2a('0x60'),''),_0x5add4c['id'])});break;default:logger[_0x5b2a('0x61')](_0x5b2a('0x67'),_0x5b2a('0x62'));}}})[_0x5b2a('0x69')](function(_0x462e47){logger['error'](_0x5b2a('0x6a'),util['inspect'](_0x462e47,{'showHidden':!![],'depth':null}));});};exports[_0x5b2a('0x6b')]=function(_0x410f64,_0x3c8f2a,_0x219f51,_0x590248,_0x1ecef2,_0x1870eb){var _0x2e9f32,_0x1ac64f;_0x1870eb[_0x5b2a('0xd')]=intUtil[_0x5b2a('0x49')](_0x1870eb['remoteUri']);_0x1870eb['serverUrl']=intUtil[_0x5b2a('0x49')](_0x1870eb[_0x5b2a('0x4a')]);if(_0x1ecef2&&_0x1ecef2[_0x5b2a('0x6c')]){logger[_0x5b2a('0xb')]('['+_0x3c8f2a[_0x5b2a('0x6d')]['toUpperCase']()+']',_0x5b2a('0x4c'));_0x3c8f2a['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1870eb[_0x5b2a('0x4a')],_0x3c8f2a[_0x5b2a('0x4f')],md5(_0x3c8f2a[_0x5b2a('0x4f')]));}else{_0x3c8f2a[_0x5b2a('0x4d')]='';}headers[_0x5b2a('0x50')]=getAuth(_0x1870eb);return getUser(_0x1870eb)[_0x5b2a('0x15')](function(_0x1332c4){_0x2e9f32=_0x1332c4;logger[_0x5b2a('0xb')]('The\x20User\x20ID\x20is:',_0x2e9f32['id']);return getEndUser(_0x1870eb,_0x3c8f2a[_0x5b2a('0x53')],_0x3c8f2a[_0x5b2a('0x54')]);})[_0x5b2a('0x15')](function(_0x37a596){_0x1ac64f=_0x37a596;logger['info'](_0x5b2a('0x55'),_0x1ac64f['id']);return getTicket(_0x1870eb,_0x2e9f32,_0x1ac64f,_0x219f51,_0x3c8f2a);})[_0x5b2a('0x15')](function(_0x5c29e2){if(_0x5c29e2){logger[_0x5b2a('0xb')](_0x5b2a('0x56'),_0x5c29e2['id']);}})[_0x5b2a('0x69')](function(_0x434b5f){logger['error']('['+_0x3c8f2a[_0x5b2a('0x6d')]['toUpperCase']()+']'+_0x5b2a('0x6e'),util['inspect'](_0x434b5f,{'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 7eb95c2..cd49681 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 _0xc224=['Call_Result','Called','complete','connect','Answered','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','merge','/crm/v2/Calls','code','err','host','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','email','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridname','Outbound','unmanaged','monitor_format','calleridname','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','[HTTP]','stringify','length','forEach','string','picklist','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','isBefore','zone','https://accounts.zoho.in','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','refresh_token','then','add','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','findIndex','Agent\x20found!','info','Using\x20the\x20admin\x20account!','profile','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','POST','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','data','SUCCESS','details','log','CREATE\x20ERROR','moduleSearch','contact_lead','https://www.zohoapis.','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Creating\x20new\x20call...','Owner','getString','Descriptions','Contacts','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','called'];(function(_0x5ad947,_0x3e2f3f){var _0x2aafc9=function(_0x212ec1){while(--_0x212ec1){_0x5ad947['push'](_0x5ad947['shift']());}};_0x2aafc9(++_0x3e2f3f);}(_0xc224,0x15c));var _0x4c22=function(_0x181278,_0x454cf5){_0x181278=_0x181278-0x0;var _0x1ce643=_0xc224[_0x181278];return _0x1ce643;};'use strict';var _=require(_0x4c22('0x0'));var rp=require(_0x4c22('0x1'));var md5=require(_0x4c22('0x2'));var util=require(_0x4c22('0x3'));var intUtil=require(_0x4c22('0x4'));var moment=require(_0x4c22('0x5'));var Redis=require(_0x4c22('0x6'));var BPromise=require(_0x4c22('0x7'));var config=require('../../../../config/environment');var logger=require(_0x4c22('0x8'))('zoho');config[_0x4c22('0x9')]=_[_0x4c22('0xa')](config[_0x4c22('0x9')],{'host':_0x4c22('0xb'),'port':0x18eb});var io=require(_0x4c22('0xc'))(new Redis(config[_0x4c22('0x9')]));function emit(_0x30389a,_0x584797,_0x34d820){io['to'](_0x30389a)['emit'](_0x584797,_0x34d820);}function request(_0x3a31d6){logger['debug'](_0x4c22('0xd'),JSON[_0x4c22('0xe')](_0x3a31d6));return rp(_0x3a31d6);}function getCustomFields(_0x2c8174,_0x1e57bc){var _0x511153={};if(_0x2c8174[_0x4c22('0xf')]>0x0){_[_0x4c22('0x10')](_0x2c8174,function(_0x58cb5a){if(_['includes']([_0x4c22('0x11'),_0x4c22('0x12')],_0x58cb5a[_0x4c22('0x13')])&&_0x58cb5a[_0x4c22('0x14')]){_0x511153[_0x58cb5a[_0x4c22('0x14')]]=_0x58cb5a[_0x4c22('0x15')][_0x4c22('0x16')]();}else if(_0x58cb5a[_0x4c22('0x13')]==='variable'&&_0x58cb5a[_0x4c22('0x17')]&&_0x58cb5a[_0x4c22('0x14')]&&_0x1e57bc[_0x58cb5a['variableName']]){_0x511153[_0x58cb5a[_0x4c22('0x14')]]=_0x1e57bc[_0x58cb5a['variableName']][_0x4c22('0x16')]();}else if(_0x58cb5a[_0x4c22('0x13')]===_0x4c22('0x18')&&_0x58cb5a[_0x4c22('0x19')]&&_0x58cb5a[_0x4c22('0x19')][_0x4c22('0x1a')]&&_0x58cb5a[_0x4c22('0x14')]&&_0x1e57bc[_0x58cb5a[_0x4c22('0x19')][_0x4c22('0x1a')][_0x4c22('0x1b')]()]){_0x511153[_0x58cb5a[_0x4c22('0x14')]]=_0x1e57bc[_0x58cb5a[_0x4c22('0x19')][_0x4c22('0x1a')][_0x4c22('0x1b')]()][_0x4c22('0x16')]();}});}return _0x511153;}function getName(_0x443fa4){if(_0x443fa4[_0x4c22('0x1c')]('\x20')>0x0){var _0x34a5ac=_0x443fa4['split'](/ (.+)/);if(_0x34a5ac[0x1]){return _0x34a5ac;}}return[_0x443fa4,_0x443fa4];}var accountsTokens={};function getAccessToken(_0x302307){return new Promise(function(_0x4271f2,_0x3b60be){if(!_[_0x4c22('0x1d')](accountsTokens[_0x302307['id']])&&!_['isNil'](accountsTokens[_0x302307['id']][_0x4c22('0x1e')])){if(moment()[_0x4c22('0x1f')](accountsTokens[_0x302307['id']]['expires_in'])){_0x4271f2(accountsTokens[_0x302307['id']][_0x4c22('0x1e')]);}}var _0x1bfb4c;switch(_0x302307[_0x4c22('0x20')]){case'US':_0x1bfb4c='https://accounts.zoho.com';break;case'AU':_0x1bfb4c='https://accounts.zoho.com.au';break;case'EU':_0x1bfb4c='https://accounts.zoho.eu';break;case'IN':_0x1bfb4c=_0x4c22('0x21');break;case'CN':_0x1bfb4c='https://accounts.zoho.com.cn';break;default:_0x1bfb4c=_0x4c22('0x22');break;}var _0x53e5f3={'method':'POST','uri':_0x1bfb4c+_0x4c22('0x23'),'qs':{'refresh_token':_0x302307[_0x4c22('0x24')],'client_id':_0x302307[_0x4c22('0x25')],'client_secret':_0x302307['clientSecret'],'grant_type':_0x4c22('0x26')},'json':!![]};return rp(_0x53e5f3)[_0x4c22('0x27')](function(_0x323d59){accountsTokens[_0x302307['id']]={'access_token':_0x323d59[_0x4c22('0x1e')],'expires_in':moment()[_0x4c22('0x28')](_0x323d59[_0x4c22('0x29')],_0x4c22('0x2a'))};_0x4271f2(_0x323d59['access_token']);})[_0x4c22('0x2b')](function(_0x53d778){logger[_0x4c22('0x2c')](_0x4c22('0x2d'),_0x53d778[_0x4c22('0x2e')]);_0x3b60be(_0x53d778);});});}function getUser(_0x47a9fe,_0x590be1,_0x5da1cb,_0x2de2e1){logger['info'](_0x4c22('0x2f'));return request({'method':_0x4c22('0x30'),'uri':util[_0x4c22('0x31')](_0x4c22('0x32'),_0x590be1),'qs':{'type':_0x4c22('0x33')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x47a9fe},'json':!![]})[_0x4c22('0x27')](function(_0x39b77e){if(_0x39b77e[_0x4c22('0x34')]){var _0x23e183=-0x1;if(_[_0x4c22('0x35')](_0x39b77e[_0x4c22('0x34')])){if(!_[_0x4c22('0x1d')](_0x2de2e1)){_0x23e183=_[_0x4c22('0x36')](_0x39b77e[_0x4c22('0x34')],function(_0x1ebbe3){return _0x1ebbe3['email']===_0x2de2e1;});}if(_0x23e183>=0x0){logger['info'](_0x4c22('0x37'));}else{logger[_0x4c22('0x38')](_0x4c22('0x39'));_0x23e183=_[_0x4c22('0x36')](_0x39b77e['users'],function(_0x4110fb){return _0x4110fb[_0x4c22('0x3a')]['name']==='Administrator';});}return _0x39b77e[_0x4c22('0x34')][_0x23e183];}else{if(_0x39b77e['user']['profile']['name']==='Administrator'){logger['info'](_0x4c22('0x39'));user=_0x39b77e[_0x4c22('0x3b')];return user;}else{logger[_0x4c22('0x2c')]('The\x20failing\x20result\x20is',JSON[_0x4c22('0xe')](_0x39b77e));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x39b77e));}}}else{logger[_0x4c22('0x2c')](_0x4c22('0x3c'),JSON[_0x4c22('0xe')](_0x39b77e));throw new Error(_0x4c22('0x3d')+JSON[_0x4c22('0xe')](_0x39b77e));}})['catch'](function(_0x25c07b){console[_0x4c22('0x2c')](_0x25c07b);});}function getZohoUser(_0x11f55a,_0x945a9){return new BPromise(function(_0x7e5cdb,_0x25fb0c){request(_0x11f55a)['then'](function(_0x31aaef){var _0x78fe41=null;if(_0x31aaef){_0x78fe41=_0x31aaef['data'][0x0];_0x78fe41[_0x4c22('0x3e')]=_0x945a9;}_0x7e5cdb(_0x78fe41);})[_0x4c22('0x2b')](function(_0x443e3a){_0x25fb0c(_0x443e3a);});});}function createEndUser(_0x21cebb,_0x42dda6,_0x52ebc8,_0x5ee665,_0x313a98,_0x13a576){var _0x52ebc8=getName(_0x52ebc8);return request({'method':_0x4c22('0x3f'),'uri':'https://www.zohoapis.'+_0x42dda6+'/crm/v2/'+_[_0x4c22('0x40')](_0x13a576[_0x4c22('0x41')])+'s','body':{'data':[{'Last_Name':_0x52ebc8[0x1],'First_Name':_0x52ebc8[0x0],'Phone':_0x5ee665,'Owner':{'name':!_['isNil'](_0x313a98['role'][_0x4c22('0x1a')])?_0x313a98[_0x4c22('0x42')][_0x4c22('0x1a')]:!_[_0x4c22('0x1d')](_0x313a98[_0x4c22('0x43')])?_0x313a98[_0x4c22('0x43')]+'\x20'+_0x313a98[_0x4c22('0x44')]:_0x313a98[_0x4c22('0x44')],'id':_0x313a98['id']}}]},'headers':{'Authorization':_0x4c22('0x45')+_0x21cebb},'json':!![]})['then'](function(_0x209b26){if(_0x209b26&&_0x209b26[_0x4c22('0x46')][0x0]['code']===_0x4c22('0x47')){var _0x1aa209=_0x209b26[_0x4c22('0x46')][0x0][_0x4c22('0x48')];_0x1aa209['enduserType']=_[_0x4c22('0x40')](_0x13a576['moduleCreate'])+'s';return _0x1aa209;}logger[_0x4c22('0x2c')](_0x4c22('0x3c'),JSON['stringify'](data));throw new Error('Error:\x20'+JSON[_0x4c22('0xe')](data));})[_0x4c22('0x2b')](function(_0x46bce3){console[_0x4c22('0x49')](_0x4c22('0x4a'),_0x46bce3);});}function getEndUser(_0x25ecd3,_0xb93277,_0x519c82,_0x1e7baf,_0xddadd3,_0x1d3833,_0x3d08d9){var _0x441305={'method':_0x4c22('0x30'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x25ecd3},'json':!![]};switch(_0x3d08d9[_0x4c22('0x4b')]){case _0x4c22('0x4c'):_0x441305['uri']=_0x4c22('0x4d')+_0xb93277+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0xddadd3+'))';return getZohoUser(_0x441305,'Contacts')['then'](function(_0x3f917b){if(_0x3f917b)return _0x3f917b;_0x441305[_0x4c22('0x4e')]=_0x4c22('0x4d')+_0xb93277+_0x4c22('0x4f')+_0xddadd3+'))';return getZohoUser(_0x441305,_0x4c22('0x50'))[_0x4c22('0x27')](function(_0x474c16){if(_0x474c16)return _0x474c16;if(_0x3d08d9[_0x4c22('0x41')]!=_0x4c22('0x51')){return createEndUser(_0x25ecd3,_0xb93277,_0x1e7baf,_0xddadd3,_0x1d3833,_0x3d08d9);}else{return{};}});});break;case _0x4c22('0x52'):_0x441305[_0x4c22('0x4e')]='https://www.zohoapis.'+_0xb93277+_0x4c22('0x53')+_0xddadd3+'))';return getZohoUser(_0x441305,'Contacts')[_0x4c22('0x27')](function(_0x29a72a){if(_0x29a72a)return _0x29a72a;if(_0x3d08d9[_0x4c22('0x41')]!=_0x4c22('0x51')){return createEndUser(_0x25ecd3,_0xb93277,_0x1e7baf,_0xddadd3,_0x1d3833,_0x3d08d9);}else{return{};}});break;case _0x4c22('0x54'):_0x441305[_0x4c22('0x4e')]=_0x4c22('0x4d')+_0xb93277+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0xddadd3+'))';return getZohoUser(_0x441305,'Leads')[_0x4c22('0x27')](function(_0x55bfc9){if(_0x55bfc9)return _0x55bfc9;if(_0x3d08d9[_0x4c22('0x41')]!=_0x4c22('0x51')){return createEndUser(_0x25ecd3,_0xb93277,_0x1e7baf,_0xddadd3,_0x1d3833,_0x3d08d9);}else{return{};}});break;}}function getCall(_0x10b152,_0x336591,_0x186bda,_0x92190c,_0xf25ed2,_0x4f47ff,_0x4db362,_0x3adcb5){logger[_0x4c22('0x38')](_0x4c22('0x55'));var _0x8e1c61={};_0x8e1c61[_0x4c22('0x56')]={'name':!_['isNil'](_0x92190c[_0x4c22('0x42')][_0x4c22('0x1a')])&&!_[_0x4c22('0x1d')](_0x92190c[_0x4c22('0x3a')]['name'])&&_0x92190c['profile'][_0x4c22('0x1a')]==='administrator'?_0x92190c['role'][_0x4c22('0x1a')]:!_[_0x4c22('0x1d')](_0x92190c[_0x4c22('0x43')])?_0x92190c[_0x4c22('0x43')]+'\x20'+_0x92190c['last_name']:_0x92190c[_0x4c22('0x44')],'id':_0x92190c['id']};_0x8e1c61['Subject']=intUtil[_0x4c22('0x57')](_0x4f47ff['Subjects'],_0x4db362,'\x20');_0x8e1c61['Description']=intUtil[_0x4c22('0x57')](_0x4f47ff[_0x4c22('0x58')],_0x4db362,'\x0a');if(_0xf25ed2[_0x4c22('0x3e')]===_0x4c22('0x59')){_0x8e1c61[_0x4c22('0x5a')]={'name':!_['isNil'](_0xf25ed2[_0x4c22('0x5b')])?_0xf25ed2['Full_Name']:!_[_0x4c22('0x1d')](_0xf25ed2['First_Name'])?_0xf25ed2[_0x4c22('0x5c')]+'\x20'+_0xf25ed2[_0x4c22('0x5d')]:_0xf25ed2[_0x4c22('0x5d')],'id':_0xf25ed2['id']};}if(_0xf25ed2[_0x4c22('0x3e')]===_0x4c22('0x50')){_0x8e1c61[_0x4c22('0x5e')]={'name':!_['isNil'](_0xf25ed2[_0x4c22('0x5b')])?_0xf25ed2[_0x4c22('0x5b')]:!_[_0x4c22('0x1d')](_0xf25ed2['First_Name'])?_0xf25ed2[_0x4c22('0x5c')]+'\x20'+_0xf25ed2['Last_Name']:_0xf25ed2[_0x4c22('0x5d')],'id':_0xf25ed2['id']};_0x8e1c61[_0x4c22('0x5f')]=_[_0x4c22('0x40')](_0xf25ed2[_0x4c22('0x3e')]);}if(_0x4db362[_0x4c22('0x60')]){_0x8e1c61[_0x4c22('0x61')]=moment['utc'](parseInt(_0x4db362[_0x4c22('0x60')])*0x3e8)[_0x4c22('0x31')]('mm:ss');}else if(_0x4db362['answertime']&&_0x4db362[_0x4c22('0x62')]){_0x8e1c61[_0x4c22('0x61')]=moment['utc'](moment(_0x4db362[_0x4c22('0x62')],_0x4c22('0x63'))[_0x4c22('0x64')](moment(_0x4db362[_0x4c22('0x65')],_0x4c22('0x63'))))[_0x4c22('0x31')](_0x4c22('0x66'));}switch(_0x4db362[_0x4c22('0x67')]){case _0x4c22('0x68'):_0x8e1c61[_0x4c22('0x69')]=_0x4c22('0x6a');break;case _0x4c22('0x6b'):case _0x4c22('0x6c'):_0x8e1c61['Call_Result']=_0x4c22('0x6d');break;case'rejected':_0x8e1c61['Call_Result']=_0x4c22('0x6e');break;case _0x4c22('0x6f'):_0x8e1c61[_0x4c22('0x69')]=_0x4c22('0x70');break;case _0x4c22('0x71'):_0x8e1c61[_0x4c22('0x69')]=_0x4c22('0x72');default:}_0x8e1c61[_0x4c22('0x73')]=(_0x3adcb5===_0x4c22('0x74')?moment(_0x4db362[_0x4c22('0x65')])[_0x4c22('0x31')](_0x4c22('0x63')):moment(_0x4db362[_0x4c22('0x75')])[_0x4c22('0x31')](_0x4c22('0x63')))||moment()[_0x4c22('0x31')](_0x4c22('0x63'));_0x8e1c61[_0x4c22('0x76')]=_0x3adcb5||'Inbound';_0x8e1c61=_[_0x4c22('0x77')](_0x8e1c61,getCustomFields(_0x4f47ff['Fields'],_0x4db362));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x336591+_0x4c22('0x78'),'headers':{'Authorization':_0x4c22('0x45')+_0x10b152},'body':{'data':[_0x8e1c61]},'json':!![]})[_0x4c22('0x27')](function(_0x3e6b8c){if(_0x3e6b8c&&_0x3e6b8c[_0x4c22('0x46')][0x0][_0x4c22('0x79')]==='SUCCESS'){logger[_0x4c22('0x38')]('Call\x20created!');return{'id':_0x3e6b8c['data'][0x0][_0x4c22('0x48')]['id']};}})[_0x4c22('0x2b')](function(_0x5d2cd0){logger[_0x4c22('0x38')](_0x4c22('0x7a'),_0x5d2cd0['stack']);console['log']('err',_0x5d2cd0);});}exports['queue']=function(_0x3efe57,_0x45fba6,_0x528b90,_0x3ff7c4,_0x3ac680,_0x3a52aa){var _0x398f9a,_0x43e8a1,_0x20cf72;_0x3a52aa[_0x4c22('0x7b')]=intUtil['stripTrailingSlash'](_0x3a52aa['host']);_0x3a52aa[_0x4c22('0x7c')]=intUtil['stripTrailingSlash'](_0x3a52aa['serverUrl']);if(_0x3ac680&&_0x3ac680['monitor_format']){logger[_0x4c22('0x38')](_0x4c22('0x7d'),_0x4c22('0x7e'));_0x45fba6[_0x4c22('0x7f')]=_0x3a52aa[_0x4c22('0x7c')]+_0x4c22('0x80')+_0x45fba6[_0x4c22('0x81')]+_0x4c22('0x82')+md5(_0x45fba6[_0x4c22('0x81')]);}else{_0x45fba6[_0x4c22('0x7f')]='';}var _0x362036=_0x3a52aa['host']===_0x4c22('0x83')?'eu':_0x4c22('0x84');return getAccessToken(_0x3a52aa)[_0x4c22('0x27')](function(_0x170e33){_0x20cf72=_0x170e33;return getUser(_0x20cf72,_0x362036,_0x3a52aa,_0x3ff7c4[_0x4c22('0x85')]);})[_0x4c22('0x27')](function(_0x254f23){_0x398f9a=_0x254f23;logger[_0x4c22('0x38')]('The\x20User\x20ID\x20is:',_0x398f9a['id']);return getEndUser(_0x20cf72,_0x362036,_0x3a52aa,_0x45fba6['calleridname'],_0x45fba6[_0x4c22('0x86')],_0x398f9a,_0x528b90);})[_0x4c22('0x27')](function(_0x404355){_0x43e8a1=_0x404355;return getCall(_0x20cf72,_0x362036,_0x3a52aa,_0x398f9a,_0x43e8a1,_0x528b90,_0x45fba6,_0x4c22('0x87'));})[_0x4c22('0x27')](function(_0x2c18ca){if(_0x2c18ca){logger[_0x4c22('0x38')](_0x4c22('0x88'),_0x2c18ca['id']);logger[_0x4c22('0x38')](_0x4c22('0x7d'),_0x4c22('0x89'));emit(util['format'](_0x4c22('0x8a'),_0x3ff7c4[_0x4c22('0x1a')]),_0x4c22('0x8b'),{'uri':_0x4c22('0x8c')+_0x3a52aa[_0x4c22('0x7b')]+_0x4c22('0x8d')+_0x2c18ca['id']});}})[_0x4c22('0x2b')](function(_0x3b29b4){logger[_0x4c22('0x2c')]('[QUEUE]',JSON[_0x4c22('0xe')](_0x3b29b4));});};exports['outbound']=function(_0x751d2f,_0x414f30,_0x12b5b8,_0x4aea5e,_0x4d2516,_0x37ae3c,_0x441fa5){var _0x31f64f,_0x572ffe,_0x235724;_0x37ae3c[_0x4c22('0x7b')]=intUtil[_0x4c22('0x8e')](_0x37ae3c[_0x4c22('0x7b')]);_0x37ae3c[_0x4c22('0x7c')]=intUtil[_0x4c22('0x8e')](_0x37ae3c['serverUrl']);if(_0x441fa5&&_0x441fa5['recordingFormat']&&_0x441fa5[_0x4c22('0x8f')]!==_0x4c22('0x90')){logger['info'](_0x4c22('0x91'),'Recording\x20is\x20enabled!');_0x414f30[_0x4c22('0x7f')]=_0x37ae3c[_0x4c22('0x7c')]+_0x4c22('0x80')+_0x414f30[_0x4c22('0x81')]+_0x4c22('0x82')+md5(_0x414f30[_0x4c22('0x81')]);}var _0x91e3b0=_0x37ae3c[_0x4c22('0x7b')]==='zoho.eu'?'eu':_0x4c22('0x84');return getAccessToken(_0x37ae3c)['then'](function(_0x4bc2b3){_0x235724=_0x4bc2b3;return getUser(_0x235724,_0x91e3b0,_0x37ae3c,_0x4aea5e[_0x4c22('0x85')]);})[_0x4c22('0x27')](function(_0x105d3a){_0x31f64f=_0x105d3a;logger['info']('The\x20User\x20ID\x20is:',_0x31f64f['id']);return getEndUser(_0x235724,_0x91e3b0,_0x37ae3c,_0x414f30[_0x4c22('0x92')],_0x414f30['destcalleridnum'],_0x31f64f,_0x12b5b8);})[_0x4c22('0x27')](function(_0x592ca9){_0x572ffe=_0x592ca9;return getCall(_0x235724,_0x91e3b0,_0x37ae3c,_0x31f64f,_0x572ffe,_0x12b5b8,_0x414f30,_0x4c22('0x93'));})[_0x4c22('0x27')](function(_0x485960){if(_0x485960){logger[_0x4c22('0x38')](_0x4c22('0x88'),_0x485960['id']);logger[_0x4c22('0x38')](_0x4c22('0x91'),_0x4c22('0x89'));emit(util['format'](_0x4c22('0x8a'),_0x4aea5e['name']),_0x4c22('0x8b'),{'uri':_0x4c22('0x8c')+_0x37ae3c[_0x4c22('0x7b')]+_0x4c22('0x8d')+_0x485960['id']});}})[_0x4c22('0x2b')](function(_0x1b4434){logger[_0x4c22('0x2c')](_0x4c22('0x91'),JSON[_0x4c22('0xe')](_0x1b4434));});};exports[_0x4c22('0x94')]=function(_0x11cadc,_0x34fbc9,_0x37afda,_0x311eaf,_0x42b32a,_0x403cff){var _0x185ec1,_0x22cf0a,_0x5579bc;_0x403cff['host']=intUtil[_0x4c22('0x8e')](_0x403cff['host']);_0x403cff[_0x4c22('0x7c')]=intUtil[_0x4c22('0x8e')](_0x403cff[_0x4c22('0x7c')]);if(_0x42b32a&&_0x42b32a[_0x4c22('0x95')]){logger[_0x4c22('0x38')]('['+_0x34fbc9[_0x4c22('0x67')]['toUpperCase']()+']',_0x4c22('0x7e'));_0x34fbc9[_0x4c22('0x7f')]=_0x403cff[_0x4c22('0x7c')]+_0x4c22('0x80')+_0x34fbc9[_0x4c22('0x81')]+_0x4c22('0x82')+md5(_0x34fbc9['uniqueid']);}else{_0x34fbc9[_0x4c22('0x7f')]='';}var _0x36dc88=_0x403cff[_0x4c22('0x7b')]===_0x4c22('0x83')?'eu':'com';return getAccessToken(_0x403cff)[_0x4c22('0x27')](function(_0x46b52b){_0x5579bc=_0x46b52b;return getUser(_0x5579bc,_0x36dc88,_0x403cff);})['then'](function(_0x102f3b){_0x185ec1=_0x102f3b;logger[_0x4c22('0x38')]('The\x20User\x20ID\x20is:',_0x185ec1['id']);return getEndUser(_0x5579bc,_0x36dc88,_0x403cff,_0x34fbc9[_0x4c22('0x96')],_0x34fbc9[_0x4c22('0x86')],_0x185ec1,_0x37afda);})[_0x4c22('0x27')](function(_0x7045d){_0x22cf0a=_0x7045d;return getCall(_0x5579bc,_0x36dc88,_0x403cff,_0x185ec1,_0x22cf0a,_0x37afda,_0x34fbc9,'Inbound');})[_0x4c22('0x27')](function(_0x1eb61c){if(_0x1eb61c){logger[_0x4c22('0x38')](_0x4c22('0x88'),_0x1eb61c['id']);}})[_0x4c22('0x2b')](function(_0x489808){logger[_0x4c22('0x2c')]('['+_0x34fbc9[_0x4c22('0x67')]['toUpperCase']()+']',JSON[_0x4c22('0xe')](_0x489808));});}; \ No newline at end of file +var _0x10dc=['monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','[QUEUE]','recordingFormat','none','[OUTBOUND]','destcalleridname','Outbound','user:%s','unmanaged','toUpperCase','calleridnum','lodash','request-promise','md5','util','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','[HTTP]','forEach','includes','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','clientSecret','then','add','expires_in','seconds','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','data','SUCCESS','details','log','CREATE\x20ERROR','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Creating\x20new\x20call...','administrator','Subject','getString','Subjects','Description','Descriptions','Contacts','Who_Id','Full_Name','First_Name','Last_Name','$se_module','Call_Duration','talktime','format','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','connect','Answered','abandoned','Abandoned','timeout','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','code','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl'];(function(_0x3da6e8,_0x238db2){var _0x14e961=function(_0x1d258b){while(--_0x1d258b){_0x3da6e8['push'](_0x3da6e8['shift']());}};_0x14e961(++_0x238db2);}(_0x10dc,0x13f));var _0xc10d=function(_0x48cbfa,_0x80864){_0x48cbfa=_0x48cbfa-0x0;var _0x1cea43=_0x10dc[_0x48cbfa];return _0x1cea43;};'use strict';var _=require(_0xc10d('0x0'));var rp=require(_0xc10d('0x1'));var md5=require(_0xc10d('0x2'));var util=require(_0xc10d('0x3'));var intUtil=require('./util');var moment=require('moment');var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0xc10d('0x4'));var logger=require(_0xc10d('0x5'))(_0xc10d('0x6'));config[_0xc10d('0x7')]=_['defaults'](config[_0xc10d('0x7')],{'host':_0xc10d('0x8'),'port':0x18eb});var io=require(_0xc10d('0x9'))(new Redis(config[_0xc10d('0x7')]));function emit(_0x58c0de,_0x162808,_0x486d17){io['to'](_0x58c0de)[_0xc10d('0xa')](_0x162808,_0x486d17);}function request(_0x55c00d){logger['debug'](_0xc10d('0xb'),JSON['stringify'](_0x55c00d));return rp(_0x55c00d);}function getCustomFields(_0xe4caae,_0x4652d2){var _0xa887e={};if(_0xe4caae['length']>0x0){_[_0xc10d('0xc')](_0xe4caae,function(_0x22d6d7){if(_[_0xc10d('0xd')](['string',_0xc10d('0xe')],_0x22d6d7[_0xc10d('0xf')])&&_0x22d6d7[_0xc10d('0x10')]){_0xa887e[_0x22d6d7['idField']]=_0x22d6d7[_0xc10d('0x11')][_0xc10d('0x12')]();}else if(_0x22d6d7[_0xc10d('0xf')]===_0xc10d('0x13')&&_0x22d6d7['variableName']&&_0x22d6d7['idField']&&_0x4652d2[_0x22d6d7[_0xc10d('0x14')]]){_0xa887e[_0x22d6d7[_0xc10d('0x10')]]=_0x4652d2[_0x22d6d7[_0xc10d('0x14')]][_0xc10d('0x12')]();}else if(_0x22d6d7[_0xc10d('0xf')]===_0xc10d('0x15')&&_0x22d6d7[_0xc10d('0x16')]&&_0x22d6d7[_0xc10d('0x16')][_0xc10d('0x17')]&&_0x22d6d7[_0xc10d('0x10')]&&_0x4652d2[_0x22d6d7['Variable'][_0xc10d('0x17')][_0xc10d('0x18')]()]){_0xa887e[_0x22d6d7[_0xc10d('0x10')]]=_0x4652d2[_0x22d6d7[_0xc10d('0x16')]['name'][_0xc10d('0x18')]()]['toString']();}});}return _0xa887e;}function getName(_0xe3020f){if(_0xe3020f[_0xc10d('0x19')]('\x20')>0x0){var _0x53c135=_0xe3020f[_0xc10d('0x1a')](/ (.+)/);if(_0x53c135[0x1]){return _0x53c135;}}return[_0xe3020f,_0xe3020f];}var accountsTokens={};function getAccessToken(_0x9072bb){return new Promise(function(_0x157c8b,_0x26828c){if(!_[_0xc10d('0x1b')](accountsTokens[_0x9072bb['id']])&&!_[_0xc10d('0x1b')](accountsTokens[_0x9072bb['id']][_0xc10d('0x1c')])){if(moment()[_0xc10d('0x1d')](accountsTokens[_0x9072bb['id']]['expires_in'])){_0x157c8b(accountsTokens[_0x9072bb['id']][_0xc10d('0x1c')]);}}var _0x3ccdd5;switch(_0x9072bb[_0xc10d('0x1e')]){case'US':_0x3ccdd5=_0xc10d('0x1f');break;case'AU':_0x3ccdd5=_0xc10d('0x20');break;case'EU':_0x3ccdd5='https://accounts.zoho.eu';break;case'IN':_0x3ccdd5='https://accounts.zoho.in';break;case'CN':_0x3ccdd5=_0xc10d('0x21');break;default:_0x3ccdd5=_0xc10d('0x22');break;}var _0x2d39cc={'method':_0xc10d('0x23'),'uri':_0x3ccdd5+_0xc10d('0x24'),'qs':{'refresh_token':_0x9072bb['refreshToken'],'client_id':_0x9072bb['clientId'],'client_secret':_0x9072bb[_0xc10d('0x25')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x2d39cc)[_0xc10d('0x26')](function(_0x48d054){accountsTokens[_0x9072bb['id']]={'access_token':_0x48d054[_0xc10d('0x1c')],'expires_in':moment()[_0xc10d('0x27')](_0x48d054[_0xc10d('0x28')],_0xc10d('0x29'))};_0x157c8b(_0x48d054['access_token']);})['catch'](function(_0x55c0ee){logger[_0xc10d('0x2a')](_0xc10d('0x2b'),_0x55c0ee[_0xc10d('0x2c')]);_0x26828c(_0x55c0ee);});});}function getUser(_0x3f9e6c,_0x276e59,_0x3d1cd8,_0x593279){logger['info'](_0xc10d('0x2d'));return request({'method':_0xc10d('0x2e'),'uri':util['format'](_0xc10d('0x2f'),_0x276e59),'qs':{'type':_0xc10d('0x30')},'headers':{'Authorization':_0xc10d('0x31')+_0x3f9e6c},'json':!![]})[_0xc10d('0x26')](function(_0x22895e){if(_0x22895e[_0xc10d('0x32')]){var _0x3eda66=-0x1;if(_[_0xc10d('0x33')](_0x22895e[_0xc10d('0x32')])){if(!_[_0xc10d('0x1b')](_0x593279)){_0x3eda66=_['findIndex'](_0x22895e[_0xc10d('0x32')],function(_0x445f57){return _0x445f57['email']===_0x593279;});}if(_0x3eda66>=0x0){logger[_0xc10d('0x34')](_0xc10d('0x35'));}else{logger[_0xc10d('0x34')](_0xc10d('0x36'));_0x3eda66=_['findIndex'](_0x22895e[_0xc10d('0x32')],function(_0x3d3d67){return _0x3d3d67[_0xc10d('0x37')]['name']===_0xc10d('0x38');});}return _0x22895e[_0xc10d('0x32')][_0x3eda66];}else{if(_0x22895e['user'][_0xc10d('0x37')][_0xc10d('0x17')]===_0xc10d('0x38')){logger[_0xc10d('0x34')]('Using\x20the\x20admin\x20account!');user=_0x22895e[_0xc10d('0x39')];return user;}else{logger[_0xc10d('0x2a')](_0xc10d('0x3a'),JSON[_0xc10d('0x3b')](_0x22895e));throw new Error(_0xc10d('0x3c')+JSON[_0xc10d('0x3b')](_0x22895e));}}}else{logger[_0xc10d('0x2a')](_0xc10d('0x3a'),JSON[_0xc10d('0x3b')](_0x22895e));throw new Error(_0xc10d('0x3c')+JSON[_0xc10d('0x3b')](_0x22895e));}})[_0xc10d('0x3d')](function(_0x58e3e6){console[_0xc10d('0x2a')](_0x58e3e6);});}function getZohoUser(_0x2b0c60,_0x20fe80){return new BPromise(function(_0x1ef855,_0x4553a6){request(_0x2b0c60)[_0xc10d('0x26')](function(_0x3457a5){var _0xa341d3=null;if(_0x3457a5){_0xa341d3=_0x3457a5['data'][0x0];_0xa341d3[_0xc10d('0x3e')]=_0x20fe80;}_0x1ef855(_0xa341d3);})[_0xc10d('0x3d')](function(_0x70774f){_0x4553a6(_0x70774f);});});}function createEndUser(_0xc2ed5,_0x501f59,_0x38c117,_0x22ecdc,_0x19de5a,_0x19b427){var _0x38c117=getName(_0x38c117);return request({'method':'POST','uri':_0xc10d('0x3f')+_0x501f59+'/crm/v2/'+_[_0xc10d('0x40')](_0x19b427[_0xc10d('0x41')])+'s','body':{'data':[{'Last_Name':_0x38c117[0x1],'First_Name':_0x38c117[0x0],'Phone':_0x22ecdc,'Owner':{'name':!_[_0xc10d('0x1b')](_0x19de5a['role'][_0xc10d('0x17')])?_0x19de5a[_0xc10d('0x42')][_0xc10d('0x17')]:!_['isNil'](_0x19de5a[_0xc10d('0x43')])?_0x19de5a[_0xc10d('0x43')]+'\x20'+_0x19de5a[_0xc10d('0x44')]:_0x19de5a[_0xc10d('0x44')],'id':_0x19de5a['id']}}]},'headers':{'Authorization':_0xc10d('0x31')+_0xc2ed5},'json':!![]})[_0xc10d('0x26')](function(_0x240646){if(_0x240646&&_0x240646[_0xc10d('0x45')][0x0]['code']===_0xc10d('0x46')){var _0x32142e=_0x240646[_0xc10d('0x45')][0x0][_0xc10d('0x47')];_0x32142e[_0xc10d('0x3e')]=_[_0xc10d('0x40')](_0x19b427['moduleCreate'])+'s';return _0x32142e;}logger['error'](_0xc10d('0x3a'),JSON[_0xc10d('0x3b')](data));throw new Error('Error:\x20'+JSON[_0xc10d('0x3b')](data));})[_0xc10d('0x3d')](function(_0x1dee61){console[_0xc10d('0x48')](_0xc10d('0x49'),_0x1dee61);});}function getEndUser(_0x9c98ca,_0x7af82e,_0x1ef612,_0x4950e2,_0x24789b,_0x4deb9a,_0x343ef4){var _0x307a61={'method':_0xc10d('0x2e'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x9c98ca},'json':!![]};switch(_0x343ef4[_0xc10d('0x4a')]){case'contact_lead':_0x307a61[_0xc10d('0x4b')]='https://www.zohoapis.'+_0x7af82e+_0xc10d('0x4c')+_0x24789b+'))';return getZohoUser(_0x307a61,'Contacts')[_0xc10d('0x26')](function(_0x331d96){if(_0x331d96)return _0x331d96;_0x307a61[_0xc10d('0x4b')]=_0xc10d('0x3f')+_0x7af82e+_0xc10d('0x4d')+_0x24789b+'))';return getZohoUser(_0x307a61,_0xc10d('0x4e'))['then'](function(_0x29aa5c){if(_0x29aa5c)return _0x29aa5c;if(_0x343ef4[_0xc10d('0x41')]!=_0xc10d('0x4f')){return createEndUser(_0x9c98ca,_0x7af82e,_0x4950e2,_0x24789b,_0x4deb9a,_0x343ef4);}else{return{};}});});break;case _0xc10d('0x50'):_0x307a61[_0xc10d('0x4b')]='https://www.zohoapis.'+_0x7af82e+_0xc10d('0x4c')+_0x24789b+'))';return getZohoUser(_0x307a61,'Contacts')[_0xc10d('0x26')](function(_0x4e552a){if(_0x4e552a)return _0x4e552a;if(_0x343ef4[_0xc10d('0x41')]!=_0xc10d('0x4f')){return createEndUser(_0x9c98ca,_0x7af82e,_0x4950e2,_0x24789b,_0x4deb9a,_0x343ef4);}else{return{};}});break;case'lead':_0x307a61[_0xc10d('0x4b')]='https://www.zohoapis.'+_0x7af82e+_0xc10d('0x4d')+_0x24789b+'))';return getZohoUser(_0x307a61,_0xc10d('0x4e'))[_0xc10d('0x26')](function(_0x3ece92){if(_0x3ece92)return _0x3ece92;if(_0x343ef4[_0xc10d('0x41')]!=_0xc10d('0x4f')){return createEndUser(_0x9c98ca,_0x7af82e,_0x4950e2,_0x24789b,_0x4deb9a,_0x343ef4);}else{return{};}});break;}}function getCall(_0x36b774,_0x5282f4,_0x588eb2,_0x441303,_0x6a40e0,_0x53d3f0,_0x38beb6,_0x4ee1b3){logger['info'](_0xc10d('0x51'));var _0xe929e8={};_0xe929e8['Owner']={'name':!_[_0xc10d('0x1b')](_0x441303[_0xc10d('0x42')][_0xc10d('0x17')])&&!_[_0xc10d('0x1b')](_0x441303[_0xc10d('0x37')][_0xc10d('0x17')])&&_0x441303[_0xc10d('0x37')]['name']===_0xc10d('0x52')?_0x441303[_0xc10d('0x42')][_0xc10d('0x17')]:!_[_0xc10d('0x1b')](_0x441303[_0xc10d('0x43')])?_0x441303['first_name']+'\x20'+_0x441303[_0xc10d('0x44')]:_0x441303[_0xc10d('0x44')],'id':_0x441303['id']};_0xe929e8[_0xc10d('0x53')]=intUtil[_0xc10d('0x54')](_0x53d3f0[_0xc10d('0x55')],_0x38beb6,'\x20');_0xe929e8[_0xc10d('0x56')]=intUtil[_0xc10d('0x54')](_0x53d3f0[_0xc10d('0x57')],_0x38beb6,'\x0a');if(_0x6a40e0[_0xc10d('0x3e')]===_0xc10d('0x58')){_0xe929e8[_0xc10d('0x59')]={'name':!_[_0xc10d('0x1b')](_0x6a40e0['Full_Name'])?_0x6a40e0[_0xc10d('0x5a')]:!_[_0xc10d('0x1b')](_0x6a40e0[_0xc10d('0x5b')])?_0x6a40e0['First_Name']+'\x20'+_0x6a40e0[_0xc10d('0x5c')]:_0x6a40e0['Last_Name'],'id':_0x6a40e0['id']};}if(_0x6a40e0[_0xc10d('0x3e')]===_0xc10d('0x4e')){_0xe929e8['What_Id']={'name':!_['isNil'](_0x6a40e0[_0xc10d('0x5a')])?_0x6a40e0['Full_Name']:!_[_0xc10d('0x1b')](_0x6a40e0[_0xc10d('0x5b')])?_0x6a40e0[_0xc10d('0x5b')]+'\x20'+_0x6a40e0['Last_Name']:_0x6a40e0['Last_Name'],'id':_0x6a40e0['id']};_0xe929e8[_0xc10d('0x5d')]=_[_0xc10d('0x40')](_0x6a40e0[_0xc10d('0x3e')]);}if(_0x38beb6['talktime']){_0xe929e8[_0xc10d('0x5e')]=moment['utc'](parseInt(_0x38beb6[_0xc10d('0x5f')])*0x3e8)[_0xc10d('0x60')](_0xc10d('0x61'));}else if(_0x38beb6['answertime']&&_0x38beb6[_0xc10d('0x62')]){_0xe929e8[_0xc10d('0x5e')]=moment['utc'](moment(_0x38beb6['endtime'],_0xc10d('0x63'))[_0xc10d('0x64')](moment(_0x38beb6[_0xc10d('0x65')],'YYYY-MM-DDTHH:mm:ss')))['format'](_0xc10d('0x61'));}switch(_0x38beb6[_0xc10d('0x66')]){case _0xc10d('0x67'):_0xe929e8[_0xc10d('0x68')]='Called';break;case'complete':case _0xc10d('0x69'):_0xe929e8[_0xc10d('0x68')]=_0xc10d('0x6a');break;case'rejected':_0xe929e8[_0xc10d('0x68')]='Rejected';break;case _0xc10d('0x6b'):_0xe929e8[_0xc10d('0x68')]=_0xc10d('0x6c');break;case _0xc10d('0x6d'):_0xe929e8[_0xc10d('0x68')]='Timeout';default:}_0xe929e8['Call_Start_Time']=(_0x4ee1b3==='outbound'?moment(_0x38beb6[_0xc10d('0x65')])[_0xc10d('0x60')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x38beb6['agentcalledAt'])[_0xc10d('0x60')]('YYYY-MM-DDTHH:mm:ss'))||moment()['format'](_0xc10d('0x63'));_0xe929e8[_0xc10d('0x6e')]=_0x4ee1b3||_0xc10d('0x6f');_0xe929e8=_[_0xc10d('0x70')](_0xe929e8,getCustomFields(_0x53d3f0[_0xc10d('0x71')],_0x38beb6));return request({'method':_0xc10d('0x23'),'uri':_0xc10d('0x3f')+_0x5282f4+_0xc10d('0x72'),'headers':{'Authorization':_0xc10d('0x31')+_0x36b774},'body':{'data':[_0xe929e8]},'json':!![]})['then'](function(_0x29828a){if(_0x29828a&&_0x29828a[_0xc10d('0x45')][0x0][_0xc10d('0x73')]===_0xc10d('0x46')){logger['info'](_0xc10d('0x74'));return{'id':_0x29828a[_0xc10d('0x45')][0x0][_0xc10d('0x47')]['id']};}})[_0xc10d('0x3d')](function(_0x5cf21f){logger[_0xc10d('0x34')](_0xc10d('0x75'),_0x5cf21f['stack']);console[_0xc10d('0x48')](_0xc10d('0x75'),_0x5cf21f);});}exports[_0xc10d('0x76')]=function(_0x233223,_0x2558e4,_0x846f2c,_0x4a67e0,_0x537776,_0x397cd7){var _0x4d0e4b,_0x2c2235,_0x384b01;_0x397cd7[_0xc10d('0x77')]=intUtil[_0xc10d('0x78')](_0x397cd7['host']);_0x397cd7[_0xc10d('0x79')]=intUtil[_0xc10d('0x78')](_0x397cd7[_0xc10d('0x79')]);if(_0x537776&&_0x537776[_0xc10d('0x7a')]){logger[_0xc10d('0x34')]('[QUEUE]',_0xc10d('0x7b'));_0x2558e4[_0xc10d('0x7c')]=_0x397cd7[_0xc10d('0x79')]+_0xc10d('0x7d')+_0x2558e4[_0xc10d('0x7e')]+_0xc10d('0x7f')+md5(_0x2558e4['uniqueid']);}else{_0x2558e4[_0xc10d('0x7c')]='';}var _0x2d815d=_0x397cd7[_0xc10d('0x77')]===_0xc10d('0x80')?'eu':_0xc10d('0x81');return getAccessToken(_0x397cd7)['then'](function(_0x37baec){_0x384b01=_0x37baec;return getUser(_0x384b01,_0x2d815d,_0x397cd7,_0x4a67e0[_0xc10d('0x82')]);})[_0xc10d('0x26')](function(_0x1b4a46){_0x4d0e4b=_0x1b4a46;logger[_0xc10d('0x34')](_0xc10d('0x83'),_0x4d0e4b['id']);return getEndUser(_0x384b01,_0x2d815d,_0x397cd7,_0x2558e4[_0xc10d('0x84')],_0x2558e4['calleridnum'],_0x4d0e4b,_0x846f2c);})[_0xc10d('0x26')](function(_0x2cae93){_0x2c2235=_0x2cae93;return getCall(_0x384b01,_0x2d815d,_0x397cd7,_0x4d0e4b,_0x2c2235,_0x846f2c,_0x2558e4,_0xc10d('0x6f'));})[_0xc10d('0x26')](function(_0x2f4a46){if(_0x2f4a46){logger[_0xc10d('0x34')](_0xc10d('0x85'),_0x2f4a46['id']);logger[_0xc10d('0x34')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x4a67e0[_0xc10d('0x17')]),_0xc10d('0x86'),{'uri':_0xc10d('0x87')+_0x397cd7[_0xc10d('0x77')]+_0xc10d('0x88')+_0x2f4a46['id']});}})[_0xc10d('0x3d')](function(_0xe5989d){logger[_0xc10d('0x2a')](_0xc10d('0x89'),JSON[_0xc10d('0x3b')](_0xe5989d));});};exports['outbound']=function(_0x42ec3e,_0x5ec1a0,_0x3d833e,_0xe8c9e1,_0x11e258,_0x2afc79,_0xba915d){var _0x42b635,_0xfa9009,_0x726208;_0x2afc79[_0xc10d('0x77')]=intUtil[_0xc10d('0x78')](_0x2afc79[_0xc10d('0x77')]);_0x2afc79[_0xc10d('0x79')]=intUtil[_0xc10d('0x78')](_0x2afc79[_0xc10d('0x79')]);if(_0xba915d&&_0xba915d['recordingFormat']&&_0xba915d[_0xc10d('0x8a')]!==_0xc10d('0x8b')){logger[_0xc10d('0x34')](_0xc10d('0x8c'),_0xc10d('0x7b'));_0x5ec1a0['recordingURL']=_0x2afc79[_0xc10d('0x79')]+_0xc10d('0x7d')+_0x5ec1a0[_0xc10d('0x7e')]+'/downloads?type=uniqueid&token='+md5(_0x5ec1a0[_0xc10d('0x7e')]);}var _0x365a6b=_0x2afc79[_0xc10d('0x77')]==='zoho.eu'?'eu':_0xc10d('0x81');return getAccessToken(_0x2afc79)[_0xc10d('0x26')](function(_0x4de0c1){_0x726208=_0x4de0c1;return getUser(_0x726208,_0x365a6b,_0x2afc79,_0xe8c9e1[_0xc10d('0x82')]);})['then'](function(_0x3c4dac){_0x42b635=_0x3c4dac;logger[_0xc10d('0x34')](_0xc10d('0x83'),_0x42b635['id']);return getEndUser(_0x726208,_0x365a6b,_0x2afc79,_0x5ec1a0[_0xc10d('0x8d')],_0x5ec1a0['destcalleridnum'],_0x42b635,_0x3d833e);})[_0xc10d('0x26')](function(_0x254528){_0xfa9009=_0x254528;return getCall(_0x726208,_0x365a6b,_0x2afc79,_0x42b635,_0xfa9009,_0x3d833e,_0x5ec1a0,_0xc10d('0x8e'));})[_0xc10d('0x26')](function(_0x4e29d2){if(_0x4e29d2){logger[_0xc10d('0x34')](_0xc10d('0x85'),_0x4e29d2['id']);logger['info'](_0xc10d('0x8c'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc10d('0x60')](_0xc10d('0x8f'),_0xe8c9e1[_0xc10d('0x17')]),_0xc10d('0x86'),{'uri':_0xc10d('0x87')+_0x2afc79['host']+_0xc10d('0x88')+_0x4e29d2['id']});}})[_0xc10d('0x3d')](function(_0x2bbce4){logger['error']('[OUTBOUND]',JSON[_0xc10d('0x3b')](_0x2bbce4));});};exports[_0xc10d('0x90')]=function(_0x1be277,_0x41de73,_0x3d13af,_0x45422c,_0x2b9031,_0x34d54b){var _0x165137,_0x1e87d8,_0x3fa726;_0x34d54b[_0xc10d('0x77')]=intUtil['stripTrailingSlash'](_0x34d54b['host']);_0x34d54b[_0xc10d('0x79')]=intUtil[_0xc10d('0x78')](_0x34d54b[_0xc10d('0x79')]);if(_0x2b9031&&_0x2b9031[_0xc10d('0x7a')]){logger[_0xc10d('0x34')]('['+_0x41de73[_0xc10d('0x66')][_0xc10d('0x91')]()+']','Recording\x20is\x20enabled!');_0x41de73[_0xc10d('0x7c')]=_0x34d54b[_0xc10d('0x79')]+_0xc10d('0x7d')+_0x41de73[_0xc10d('0x7e')]+_0xc10d('0x7f')+md5(_0x41de73[_0xc10d('0x7e')]);}else{_0x41de73[_0xc10d('0x7c')]='';}var _0x5057c3=_0x34d54b[_0xc10d('0x77')]===_0xc10d('0x80')?'eu':_0xc10d('0x81');return getAccessToken(_0x34d54b)[_0xc10d('0x26')](function(_0x3dfc67){_0x3fa726=_0x3dfc67;return getUser(_0x3fa726,_0x5057c3,_0x34d54b);})[_0xc10d('0x26')](function(_0xa4e2be){_0x165137=_0xa4e2be;logger[_0xc10d('0x34')](_0xc10d('0x83'),_0x165137['id']);return getEndUser(_0x3fa726,_0x5057c3,_0x34d54b,_0x41de73['calleridname'],_0x41de73[_0xc10d('0x92')],_0x165137,_0x3d13af);})['then'](function(_0x397e68){_0x1e87d8=_0x397e68;return getCall(_0x3fa726,_0x5057c3,_0x34d54b,_0x165137,_0x1e87d8,_0x3d13af,_0x41de73,_0xc10d('0x6f'));})[_0xc10d('0x26')](function(_0x1ed250){if(_0x1ed250){logger[_0xc10d('0x34')](_0xc10d('0x85'),_0x1ed250['id']);}})['catch'](function(_0x286d6c){logger[_0xc10d('0x2a')]('['+_0x41de73[_0xc10d('0x66')][_0xc10d('0x91')]()+']',JSON['stringify'](_0x286d6c));});}; \ 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 b7c5f42..2d6fffa 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 _0x91d6=['mustache','trigger','exec','data3','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s'];(function(_0x5ac1e5,_0x4b5012){var _0x1bccc6=function(_0x102562){while(--_0x102562){_0x5ac1e5['push'](_0x5ac1e5['shift']());}};_0x1bccc6(++_0x4b5012);}(_0x91d6,0x100));var _0x691d=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x91d6[_0x3e5086];return _0xfeb102;};'use strict';var util=require('util');var sh=require('shelljs');var Mustache=require(_0x691d('0x0'));var logger=require('../../../../config/logger')(_0x691d('0x1'));exports[_0x691d('0x2')]=function(_0x50d7e4,_0x33440f){var _0x15a9be=_0x50d7e4['data2']?_0x50d7e4['data2']:'Script';var _0xae1c98=_0x50d7e4['data3']?Mustache['render'](_0x50d7e4[_0x691d('0x3')],_0x33440f):_0x33440f;sh['exec'](_0xae1c98,function(_0x529585,_0x2b2b43,_0x1a74c){if(_0x529585!==0x0){logger[_0x691d('0x4')](util['format'](_0x691d('0x5'),_0x15a9be,_0xae1c98,_0x529585,_0x1a74c));}else{logger['info'](util[_0x691d('0x6')](_0x691d('0x7'),_0x15a9be,_0xae1c98,_0x2b2b43));}});}; \ No newline at end of file +var _0x1e61=['render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','mustache','../../../../config/logger','exec','data2','Script','data3'];(function(_0x409100,_0x58514e){var _0x1895e3=function(_0x3c4909){while(--_0x3c4909){_0x409100['push'](_0x409100['shift']());}};_0x1895e3(++_0x58514e);}(_0x1e61,0x117));var _0x11e6=function(_0x49bc4a,_0x667398){_0x49bc4a=_0x49bc4a-0x0;var _0x718711=_0x1e61[_0x49bc4a];return _0x718711;};'use strict';var util=require(_0x11e6('0x0'));var sh=require('shelljs');var Mustache=require(_0x11e6('0x1'));var logger=require(_0x11e6('0x2'))('trigger');exports[_0x11e6('0x3')]=function(_0x2c5529,_0xf3fafd){var _0x4103e5=_0x2c5529[_0x11e6('0x4')]?_0x2c5529[_0x11e6('0x4')]:_0x11e6('0x5');var _0xbe67b2=_0x2c5529[_0x11e6('0x6')]?Mustache[_0x11e6('0x7')](_0x2c5529[_0x11e6('0x6')],_0xf3fafd):_0xf3fafd;sh[_0x11e6('0x3')](_0xbe67b2,function(_0xcc96db,_0x241386,_0x17fbc5){if(_0xcc96db!==0x0){logger[_0x11e6('0x8')](util[_0x11e6('0x9')](_0x11e6('0xa'),_0x4103e5,_0xbe67b2,_0xcc96db,_0x17fbc5));}else{logger[_0x11e6('0xb')](util[_0x11e6('0x9')](_0x11e6('0xc'),_0x4103e5,_0xbe67b2,_0x241386));}});}; \ 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 dd5b607..00119a6 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 _0xca08=['data1','toUpperCase','GET','DELETE','POST','data7','body','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','info','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','util','../../../../config/logger','exec','render','data5','data6','parse','error','stack'];(function(_0x120284,_0x2c8e9a){var _0x3b7187=function(_0x4a6da4){while(--_0x4a6da4){_0x120284['push'](_0x120284['shift']());}};_0x3b7187(++_0x2c8e9a);}(_0xca08,0x13b));var _0x8ca0=function(_0x144e6d,_0xd5c709){_0x144e6d=_0x144e6d-0x0;var _0x4ab0fe=_0xca08[_0x144e6d];return _0x4ab0fe;};'use strict';var rp=require('request-promise');var util=require(_0x8ca0('0x0'));var _=require('lodash');var Mustache=require('mustache');var logger=require(_0x8ca0('0x1'))('trigger');exports[_0x8ca0('0x2')]=function(_0x2a5568,_0x186c80){var _0x1558a0,_0x260786;var _0x4268ba={'method':_0x2a5568['data1']['toUpperCase'](),'uri':Mustache[_0x8ca0('0x3')](_0x2a5568['data2'],_0x186c80),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2a5568[_0x8ca0('0x4')])==='number'&&parseInt(_0x2a5568[_0x8ca0('0x4')])>=0x1&&parseInt(_0x2a5568[_0x8ca0('0x4')])<=0xa?parseInt(_0x2a5568[_0x8ca0('0x4')])*0x3e8:0x5*0x3e8};try{_0x4268ba['headers']=_0x2a5568[_0x8ca0('0x5')]?JSON[_0x8ca0('0x6')](Mustache[_0x8ca0('0x3')](_0x2a5568[_0x8ca0('0x5')],_0x186c80)):{};}catch(_0x3048e9){logger[_0x8ca0('0x7')](_0x3048e9[_0x8ca0('0x8')]);}switch(_0x2a5568[_0x8ca0('0x9')][_0x8ca0('0xa')]()){case _0x8ca0('0xb'):case _0x8ca0('0xc'):_0x1558a0=null;_0x4268ba['qs']=_0x186c80;break;case _0x8ca0('0xd'):case'PUT':if(_0x2a5568[_0x8ca0('0xe')]){try{_0x1558a0=JSON[_0x8ca0('0x6')](Mustache[_0x8ca0('0x3')](_0x2a5568['data7'],_0x186c80));_0x4268ba[_0x8ca0('0xf')]=_0x1558a0;}catch(_0x4339f1){logger[_0x8ca0('0x7')](_0x4339f1[_0x8ca0('0x8')]);logger[_0x8ca0('0x7')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x1558a0=_0x186c80;_0x4268ba[_0x8ca0('0xf')]=_0x1558a0;}break;}logger['info'](util[_0x8ca0('0x10')](_0x8ca0('0x11'),_0x2a5568[_0x8ca0('0x9')],_0x2a5568[_0x8ca0('0x12')],JSON[_0x8ca0('0x13')](_0x4268ba)));rp(_0x4268ba)[_0x8ca0('0x14')](function(_0x31d3ed){_0x1558a0=!_['isNil'](_0x1558a0)?',\x20request\x20body:\x20'+_0x1558a0:'';_0x260786=typeof _0x31d3ed[_0x8ca0('0xf')]==='object'?JSON['stringify'](_0x31d3ed[_0x8ca0('0xf')]):_0x31d3ed[_0x8ca0('0xf')];logger[_0x8ca0('0x15')](util[_0x8ca0('0x10')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x2a5568['data1'],_0x2a5568['data2'],_0x31d3ed[_0x8ca0('0x16')],_0x260786));})[_0x8ca0('0x17')](function(_0x4a4a4b){logger[_0x8ca0('0x7')](util[_0x8ca0('0x10')](_0x8ca0('0x18'),_0x2a5568[_0x8ca0('0x9')],_0x2a5568[_0x8ca0('0x12')],_0x4a4a4b[_0x8ca0('0x16')],_0x4a4a4b[_0x8ca0('0x19')],_0x4a4a4b[_0x8ca0('0x1a')]));});}; \ No newline at end of file +var _0x1439=['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','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','data5','number','headers','parse','data6','error','stack','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then'];(function(_0x4d878f,_0x4eb7e3){var _0x22f8cc=function(_0x525e1b){while(--_0x525e1b){_0x4d878f['push'](_0x4d878f['shift']());}};_0x22f8cc(++_0x4eb7e3);}(_0x1439,0x1ad));var _0x9143=function(_0x3a0417,_0x2d20a2){_0x3a0417=_0x3a0417-0x0;var _0x4d392b=_0x1439[_0x3a0417];return _0x4d392b;};'use strict';var rp=require(_0x9143('0x0'));var util=require('util');var _=require(_0x9143('0x1'));var Mustache=require(_0x9143('0x2'));var logger=require(_0x9143('0x3'))(_0x9143('0x4'));exports[_0x9143('0x5')]=function(_0x2219f1,_0x26e972){var _0x320bdf,_0xdcb623;var _0x521048={'method':_0x2219f1[_0x9143('0x6')][_0x9143('0x7')](),'uri':Mustache[_0x9143('0x8')](_0x2219f1[_0x9143('0x9')],_0x26e972),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2219f1[_0x9143('0xa')])===_0x9143('0xb')&&parseInt(_0x2219f1['data5'])>=0x1&&parseInt(_0x2219f1[_0x9143('0xa')])<=0xa?parseInt(_0x2219f1[_0x9143('0xa')])*0x3e8:0x5*0x3e8};try{_0x521048[_0x9143('0xc')]=_0x2219f1['data6']?JSON[_0x9143('0xd')](Mustache[_0x9143('0x8')](_0x2219f1[_0x9143('0xe')],_0x26e972)):{};}catch(_0x1aad75){logger[_0x9143('0xf')](_0x1aad75[_0x9143('0x10')]);}switch(_0x2219f1[_0x9143('0x6')][_0x9143('0x7')]()){case'GET':case'DELETE':_0x320bdf=null;_0x521048['qs']=_0x26e972;break;case _0x9143('0x11'):case _0x9143('0x12'):if(_0x2219f1[_0x9143('0x13')]){try{_0x320bdf=JSON[_0x9143('0xd')](Mustache[_0x9143('0x8')](_0x2219f1['data7'],_0x26e972));_0x521048[_0x9143('0x14')]=_0x320bdf;}catch(_0xf53777){logger['error'](_0xf53777[_0x9143('0x10')]);logger[_0x9143('0xf')](_0x9143('0x15'));}}else{_0x320bdf=_0x26e972;_0x521048[_0x9143('0x14')]=_0x320bdf;}break;}logger[_0x9143('0x16')](util[_0x9143('0x17')](_0x9143('0x18'),_0x2219f1['data1'],_0x2219f1[_0x9143('0x9')],JSON['stringify'](_0x521048)));rp(_0x521048)[_0x9143('0x19')](function(_0x1f0541){_0x320bdf=!_[_0x9143('0x1a')](_0x320bdf)?_0x9143('0x1b')+_0x320bdf:'';_0xdcb623=typeof _0x1f0541[_0x9143('0x14')]===_0x9143('0x1c')?JSON['stringify'](_0x1f0541[_0x9143('0x14')]):_0x1f0541[_0x9143('0x14')];logger[_0x9143('0x16')](util[_0x9143('0x17')](_0x9143('0x1d'),_0x2219f1[_0x9143('0x6')],_0x2219f1[_0x9143('0x9')],_0x1f0541[_0x9143('0x1e')],_0xdcb623));})[_0x9143('0x1f')](function(_0x3d960e){logger['error'](util[_0x9143('0x17')](_0x9143('0x20'),_0x2219f1['data1'],_0x2219f1[_0x9143('0x9')],_0x3d960e[_0x9143('0x1e')],_0x3d960e[_0x9143('0x21')],_0x3d960e[_0x9143('0x22')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 1dd4998..d0a1564 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 _0xfe33=['exports','jayson/promise','../../config/logger','client','Request','request','then','debug','rpc','routing','error','message'];(function(_0x589189,_0x10923e){var _0x3fe42f=function(_0x1a34ab){while(--_0x1a34ab){_0x589189['push'](_0x589189['shift']());}};_0x3fe42f(++_0x10923e);}(_0xfe33,0xc1));var _0x3fe3=function(_0x3f77de,_0x5a5e5e){_0x3f77de=_0x3f77de-0x0;var _0x5b9158=_0xfe33[_0x3f77de];return _0x5b9158;};'use strict';var jayson=require(_0x3fe3('0x0'));var BPromise=require('bluebird');var logger=require(_0x3fe3('0x1'))('routing');var client=jayson[_0x3fe3('0x2')]['http']({'port':0x2329});client[_0x3fe3('0x3')]=function(_0x4a76b4,_0x3ac921){return new BPromise(function(_0x3c967f,_0x3a1b9b){return client[_0x3fe3('0x4')](_0x4a76b4,_0x3ac921)[_0x3fe3('0x5')](function(_0x10bada){logger[_0x3fe3('0x6')](_0x3fe3('0x7'),_0x3fe3('0x8'),_0x4a76b4,_0x3ac921,_0x10bada);if(_0x10bada[_0x3fe3('0x9')]){logger['error'](_0x3fe3('0x7'),_0x3fe3('0x8'),_0x4a76b4,_0x10bada[_0x3fe3('0x9')][_0x3fe3('0xa')],_0x3ac921);return _0x3a1b9b(_0x10bada[_0x3fe3('0x9')]['message']);}else{return _0x3c967f(_0x10bada['result']);}})['catch'](function(_0x52be9e){logger[_0x3fe3('0x9')](_0x3fe3('0x7'),_0x3fe3('0x8'),_0x4a76b4,_0x52be9e,_0x3ac921);return _0x3a1b9b(_0x52be9e);});});};module[_0x3fe3('0xb')]=client; \ No newline at end of file +var _0x562e=['client','http','Request','then','debug','rpc','error','message','result','exports','bluebird','routing'];(function(_0x5c14f6,_0x2979d8){var _0x4949b3=function(_0xcc4206){while(--_0xcc4206){_0x5c14f6['push'](_0x5c14f6['shift']());}};_0x4949b3(++_0x2979d8);}(_0x562e,0x166));var _0xe562=function(_0x103c0d,_0x4c52e5){_0x103c0d=_0x103c0d-0x0;var _0x4ca3f3=_0x562e[_0x103c0d];return _0x4ca3f3;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe562('0x0'));var logger=require('../../config/logger')(_0xe562('0x1'));var client=jayson[_0xe562('0x2')][_0xe562('0x3')]({'port':0x2329});client[_0xe562('0x4')]=function(_0x20a21a,_0x8c65e5){return new BPromise(function(_0x30f48f,_0x589eac){return client['request'](_0x20a21a,_0x8c65e5)[_0xe562('0x5')](function(_0x281f71){logger[_0xe562('0x6')](_0xe562('0x7'),_0xe562('0x1'),_0x20a21a,_0x8c65e5,_0x281f71);if(_0x281f71['error']){logger['error'](_0xe562('0x7'),_0xe562('0x1'),_0x20a21a,_0x281f71[_0xe562('0x8')][_0xe562('0x9')],_0x8c65e5);return _0x589eac(_0x281f71[_0xe562('0x8')][_0xe562('0x9')]);}else{return _0x30f48f(_0x281f71[_0xe562('0xa')]);}})['catch'](function(_0x443780){logger[_0xe562('0x8')]('rpc',_0xe562('0x1'),_0x20a21a,_0x443780,_0x8c65e5);return _0x589eac(_0x443780);});});};module[_0xe562('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index d0c38fb..d5b3f1a 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 _0xf819=['log','bluebird','./server','./lib/email','./rpc/mailAccount','./rpc/setting','resolve','then','refresh','listen','getSettings','loginMailFrequency','catch'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf819,0x9d));var _0x9f81=function(_0x5d2523,_0x14bc7e){_0x5d2523=_0x5d2523-0x0;var _0x4b0e39=_0xf819[_0x5d2523];return _0x4b0e39;};'use strict';var BPromise=require(_0x9f81('0x0'));var server=require(_0x9f81('0x1'));var Realtime=require('./realtime');var EmailChannel=require(_0x9f81('0x2'));var mailAccount=require(_0x9f81('0x3'));var setting=require(_0x9f81('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x9f81('0x5')]()[_0x9f81('0x6')](mailAccount['getMailAccounts']())[_0x9f81('0x6')](realtime['initMailAccounts']())[_0x9f81('0x6')](function(){email[_0x9f81('0x7')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x9f81('0x8')](realtime,email)[_0x9f81('0x6')](function(){return initRealtime();})[_0x9f81('0x6')](function(){return setting[_0x9f81('0x9')]();})['then'](function(_0x45b320){return setInterval(initRealtime,_0x45b320[_0x9f81('0xa')]*0x3e8);})[_0x9f81('0xb')](function(_0x5a5171){console[_0x9f81('0xc')](_0x5a5171);});}main(); \ No newline at end of file +var _0x9a4d=['./server','./realtime','./lib/email','then','getMailAccounts','initMailAccounts','mailAccounts','listen','getSettings','loginMailFrequency','catch','log','bluebird'];(function(_0x59f0c2,_0xfda805){var _0x121aa1=function(_0x89eaad){while(--_0x89eaad){_0x59f0c2['push'](_0x59f0c2['shift']());}};_0x121aa1(++_0xfda805);}(_0x9a4d,0xa8));var _0xd9a4=function(_0x3fd203,_0x2f78ab){_0x3fd203=_0x3fd203-0x0;var _0x5e6d58=_0x9a4d[_0x3fd203];return _0x5e6d58;};'use strict';var BPromise=require(_0xd9a4('0x0'));var server=require(_0xd9a4('0x1'));var Realtime=require(_0xd9a4('0x2'));var EmailChannel=require(_0xd9a4('0x3'));var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise['resolve']()[_0xd9a4('0x4')](mailAccount[_0xd9a4('0x5')]())[_0xd9a4('0x4')](realtime[_0xd9a4('0x6')]())[_0xd9a4('0x4')](function(){email['refresh'](realtime[_0xd9a4('0x7')]);return realtime;});}function main(){return server[_0xd9a4('0x8')](realtime,email)[_0xd9a4('0x4')](function(){return initRealtime();})[_0xd9a4('0x4')](function(){return setting[_0xd9a4('0x9')]();})[_0xd9a4('0x4')](function(_0x535532){return setInterval(initRealtime,_0x535532[_0xd9a4('0xa')]*0x3e8);})[_0xd9a4('0xb')](function(_0x45d15b){console[_0xd9a4('0xc')](_0x45d15b);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 1aa8a9c..24eb099 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 _0x0445=['mailAccount:update','hasOwnProperty','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','status','disabled','messageStatus','handleImapBox','connected','firstName','lastName','from','notify','info','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','verifySmtp','Smtp','verify','then','verified','lodash','moment','bluebird','md5','email','redis','defaults','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','name','active','Imap','total','isNil','stringify','emit'];(function(_0x4612df,_0x37a8f7){var _0x2804c6=function(_0x2b1979){while(--_0x2b1979){_0x4612df['push'](_0x4612df['shift']());}};_0x2804c6(++_0x37a8f7);}(_0x0445,0x1a2));var _0x5044=function(_0x285a14,_0x394a27){_0x285a14=_0x285a14-0x0;var _0x3430cc=_0x0445[_0x285a14];return _0x3430cc;};'use strict';var _=require(_0x5044('0x0'));var moment=require(_0x5044('0x1'));var BPromise=require(_0x5044('0x2'));var md5=require(_0x5044('0x3'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x5044('0x4'));config[_0x5044('0x5')]=_[_0x5044('0x6')](config[_0x5044('0x5')],{'host':_0x5044('0x7'),'port':0x18eb});var io=require(_0x5044('0x8'))(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require(_0x5044('0x9'));var mailAccount=require(_0x5044('0xa'));var md5Accounts={};function EmailChannel(_0x1aeee3){logger['info'](_0x5044('0xb'));this['mailAccounts']=_0x1aeee3[_0x5044('0xc')];this[_0x5044('0xd')]={};this[_0x5044('0xe')]=new EmailSmtp();}EmailChannel[_0x5044('0xf')]['emit']=function(_0x1f9f38){var _0x41b129=this[_0x5044('0xc')][_0x1f9f38];var _0x435cdb={'id':_0x41b129['id'],'name':_0x41b129[_0x5044('0x10')],'key':_0x41b129['key'],'active':_0x41b129[_0x5044('0x11')],'Imap':{'status':_0x41b129[_0x5044('0x12')]['status'],'messageStatus':_0x41b129[_0x5044('0x12')]['messageStatus'],'total':_0x41b129['Imap'][_0x5044('0x13')]}};if(_[_0x5044('0x14')](md5Accounts[_0x1f9f38])){md5Accounts[_0x1f9f38]={};}var _0x9d2d82=md5(JSON[_0x5044('0x15')](_0x435cdb));if(md5Accounts[_0x1f9f38]['md5']!==_0x9d2d82){md5Accounts[_0x1f9f38][_0x5044('0x3')]=_0x9d2d82;io[_0x5044('0x16')](_0x5044('0x17'),_0x435cdb);}};EmailChannel[_0x5044('0xf')]['refresh']=function(_0x238b5e){for(var _0x47c5e7 in _0x238b5e){if(_0x238b5e['hasOwnProperty'](_0x47c5e7)){if(_0x238b5e[_0x47c5e7][_0x5044('0x12')]&&_0x238b5e[_0x47c5e7][_0x5044('0x11')]){var _0x4a9b61=_0x238b5e[_0x47c5e7][_0x5044('0x12')];if(!this[_0x5044('0xd')][_0x5044('0x18')](_0x4a9b61['id'])){this[_0x5044('0xd')][_0x4a9b61['id']]=new EmailImap(_0x4a9b61,_0x238b5e[_0x47c5e7][_0x5044('0x4')]);this[_0x5044('0xd')][_0x4a9b61['id']]['on']('box',this['handleImapBox'][_0x5044('0x19')](this,_0x47c5e7));this[_0x5044('0xd')][_0x4a9b61['id']]['on'](_0x5044('0x4'),this[_0x5044('0x1a')][_0x5044('0x19')](this,_0x47c5e7));this['imapAccounts'][_0x4a9b61['id']]['on'](_0x5044('0x1b'),this[_0x5044('0x1c')][_0x5044('0x19')](this,_0x47c5e7));this['imapAccounts'][_0x4a9b61['id']]['on'](_0x5044('0x1d'),this[_0x5044('0x1e')][_0x5044('0x19')](this,_0x47c5e7));}}else{if(_[_0x5044('0x14')](this[_0x5044('0xc')][_0x47c5e7][_0x5044('0x12')])){this[_0x5044('0xc')][_0x47c5e7][_0x5044('0x12')]={};}this[_0x5044('0xc')][_0x47c5e7][_0x5044('0x12')][_0x5044('0x1f')]=_0x5044('0x20');this['mailAccounts'][_0x47c5e7][_0x5044('0x12')][_0x5044('0x21')]='';this[_0x5044('0x16')](_0x47c5e7);}}}};EmailChannel[_0x5044('0xf')][_0x5044('0x22')]=function(_0x33d3fb,_0x2ac17e){if(this[_0x5044('0xc')][_0x33d3fb]){this['mailAccounts'][_0x33d3fb][_0x5044('0x12')][_0x5044('0x1f')]=_0x5044('0x23');this[_0x5044('0xc')][_0x33d3fb]['Imap']['messageStatus']=_0x2ac17e[_0x5044('0x10')];if(_0x2ac17e['messages']){this[_0x5044('0xc')][_0x33d3fb][_0x5044('0x12')][_0x5044('0x13')]=_0x2ac17e['messages']['total'];}return this[_0x5044('0x16')](_0x33d3fb);}};EmailChannel[_0x5044('0xf')]['handleImapEmail']=function(_0x93b05e,_0x522861){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x522861[_0x5044('0x24')],_0x522861[_0x5044('0x25')],_0x522861[_0x5044('0x26')],_0x93b05e);if(this[_0x5044('0xc')][_0x93b05e]){return mailAccount[_0x5044('0x27')](_0x93b05e,_0x522861)['then'](function(_0x9981b1){if(_0x9981b1){logger[_0x5044('0x28')]('Mail\x20accepted\x20from\x20routing');}})[_0x5044('0x29')](function(_0x1f4ad9){logger[_0x5044('0x1d')](_0x5044('0x2a'),JSON[_0x5044('0x15')](_0x1f4ad9));});}};EmailChannel[_0x5044('0xf')]['handleImapEnd']=function(_0x577be3){if(this['mailAccounts'][_0x577be3]&&this[_0x5044('0xc')][_0x577be3][_0x5044('0x12')]){if(this[_0x5044('0xd')][this['mailAccounts'][_0x577be3][_0x5044('0x12')]['id']]){delete this[_0x5044('0xd')][this[_0x5044('0xc')][_0x577be3][_0x5044('0x12')]['id']];}this[_0x5044('0xc')][_0x577be3][_0x5044('0x12')][_0x5044('0x2b')]=moment();this['emit'](_0x577be3);}};EmailChannel['prototype'][_0x5044('0x1e')]=function(_0x4614b4,_0x519761){if(this['mailAccounts'][_0x4614b4]){this[_0x5044('0xc')][_0x4614b4][_0x5044('0x12')]['status']='error';this['mailAccounts'][_0x4614b4]['Imap']['messageStatus']=_0x519761;return this[_0x5044('0x16')](_0x4614b4);}};EmailChannel[_0x5044('0xf')]['sendMail']=function(_0x5485cf,_0x4b99e4){return this['smtp']['send'](_0x5485cf,_0x4b99e4);};EmailChannel['prototype'][_0x5044('0x2c')]=function(_0x1dfc9d){var _0x4507db=this;if(this[_0x5044('0xc')][_0x1dfc9d['id']]){if(_[_0x5044('0x14')](this[_0x5044('0xc')][_0x1dfc9d['id']][_0x5044('0x2d')])){this[_0x5044('0xc')][_0x1dfc9d['id']]['Smtp']={};}this[_0x5044('0xc')][_0x1dfc9d['id']][_0x5044('0x2d')][_0x5044('0x2b')]=moment();return new BPromise(function(_0x8fd347,_0x1f1a3a){return _0x4507db['smtp'][_0x5044('0x2e')](_0x1dfc9d)[_0x5044('0x2f')](function(_0x46444a){_0x4507db[_0x5044('0xc')][_0x1dfc9d['id']][_0x5044('0x2d')]['status']=_0x5044('0x30');_0x4507db[_0x5044('0xc')][_0x1dfc9d['id']]['Smtp'][_0x5044('0x21')]='';_0x4507db['emit'](_0x1dfc9d['id']);_0x8fd347(_0x46444a);})[_0x5044('0x29')](function(_0x4b9e4b){_0x4507db['mailAccounts'][_0x1dfc9d['id']]['Smtp'][_0x5044('0x1f')]='error';_0x4507db[_0x5044('0xc')][_0x1dfc9d['id']][_0x5044('0x2d')]['messageStatus']=_0x4b9e4b;_0x4507db[_0x5044('0x16')](_0x1dfc9d['id']);_0x1f1a3a(_0x4b9e4b);});});}return this['smtp'][_0x5044('0x2e')](_0x1dfc9d);};module['exports']=EmailChannel; \ No newline at end of file +var _0xa10f=['handleImapEmail','end','handleImapEnd','disabled','connected','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','error','sendMail','send','verifySmtp','Smtp','verify','then','verified','exports','lodash','bluebird','md5','ioredis','../../../config/logger','redis','defaults','localhost','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','key','active','status','messageStatus','Imap','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','email','box','handleImapBox','bind'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa10f,0x124));var _0xfa10=function(_0x3e75e5,_0x4a22d6){_0x3e75e5=_0x3e75e5-0x0;var _0x978946=_0xa10f[_0x3e75e5];return _0x978946;};'use strict';var _=require(_0xfa10('0x0'));var moment=require('moment');var BPromise=require(_0xfa10('0x1'));var md5=require(_0xfa10('0x2'));var Redis=require(_0xfa10('0x3'));var config=require('../../../config/environment');var logger=require(_0xfa10('0x4'))('email');config[_0xfa10('0x5')]=_[_0xfa10('0x6')](config[_0xfa10('0x5')],{'host':_0xfa10('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfa10('0x5')]));var EmailImap=require(_0xfa10('0x8'));var EmailSmtp=require('./smtp');var mailAccount=require(_0xfa10('0x9'));var md5Accounts={};function EmailChannel(_0x3fec44){logger[_0xfa10('0xa')](_0xfa10('0xb'));this[_0xfa10('0xc')]=_0x3fec44[_0xfa10('0xc')];this[_0xfa10('0xd')]={};this[_0xfa10('0xe')]=new EmailSmtp();}EmailChannel[_0xfa10('0xf')][_0xfa10('0x10')]=function(_0x5f1306){var _0x350d38=this['mailAccounts'][_0x5f1306];var _0x232444={'id':_0x350d38['id'],'name':_0x350d38['name'],'key':_0x350d38[_0xfa10('0x11')],'active':_0x350d38[_0xfa10('0x12')],'Imap':{'status':_0x350d38['Imap'][_0xfa10('0x13')],'messageStatus':_0x350d38['Imap'][_0xfa10('0x14')],'total':_0x350d38[_0xfa10('0x15')][_0xfa10('0x16')]}};if(_[_0xfa10('0x17')](md5Accounts[_0x5f1306])){md5Accounts[_0x5f1306]={};}var _0x5f5a40=md5(JSON[_0xfa10('0x18')](_0x232444));if(md5Accounts[_0x5f1306]['md5']!==_0x5f5a40){md5Accounts[_0x5f1306][_0xfa10('0x2')]=_0x5f5a40;io[_0xfa10('0x10')](_0xfa10('0x19'),_0x232444);}};EmailChannel[_0xfa10('0xf')][_0xfa10('0x1a')]=function(_0xfe3765){for(var _0x42aecd in _0xfe3765){if(_0xfe3765[_0xfa10('0x1b')](_0x42aecd)){if(_0xfe3765[_0x42aecd][_0xfa10('0x15')]&&_0xfe3765[_0x42aecd]['active']){var _0x586527=_0xfe3765[_0x42aecd][_0xfa10('0x15')];if(!this['imapAccounts']['hasOwnProperty'](_0x586527['id'])){this[_0xfa10('0xd')][_0x586527['id']]=new EmailImap(_0x586527,_0xfe3765[_0x42aecd][_0xfa10('0x1c')]);this[_0xfa10('0xd')][_0x586527['id']]['on'](_0xfa10('0x1d'),this[_0xfa10('0x1e')][_0xfa10('0x1f')](this,_0x42aecd));this[_0xfa10('0xd')][_0x586527['id']]['on'](_0xfa10('0x1c'),this[_0xfa10('0x20')][_0xfa10('0x1f')](this,_0x42aecd));this[_0xfa10('0xd')][_0x586527['id']]['on'](_0xfa10('0x21'),this[_0xfa10('0x22')]['bind'](this,_0x42aecd));this['imapAccounts'][_0x586527['id']]['on']('error',this['handleImapError'][_0xfa10('0x1f')](this,_0x42aecd));}}else{if(_[_0xfa10('0x17')](this[_0xfa10('0xc')][_0x42aecd]['Imap'])){this[_0xfa10('0xc')][_0x42aecd][_0xfa10('0x15')]={};}this['mailAccounts'][_0x42aecd][_0xfa10('0x15')]['status']=_0xfa10('0x23');this[_0xfa10('0xc')][_0x42aecd]['Imap']['messageStatus']='';this['emit'](_0x42aecd);}}}};EmailChannel['prototype'][_0xfa10('0x1e')]=function(_0x5b74ac,_0x28d315){if(this[_0xfa10('0xc')][_0x5b74ac]){this['mailAccounts'][_0x5b74ac][_0xfa10('0x15')]['status']=_0xfa10('0x24');this[_0xfa10('0xc')][_0x5b74ac]['Imap']['messageStatus']=_0x28d315[_0xfa10('0x25')];if(_0x28d315['messages']){this[_0xfa10('0xc')][_0x5b74ac][_0xfa10('0x15')][_0xfa10('0x16')]=_0x28d315[_0xfa10('0x26')][_0xfa10('0x16')];}return this[_0xfa10('0x10')](_0x5b74ac);}};EmailChannel['prototype'][_0xfa10('0x20')]=function(_0x4ff010,_0xbb552d){logger[_0xfa10('0xa')](_0xfa10('0x27'),_0xbb552d[_0xfa10('0x28')],_0xbb552d['lastName'],_0xbb552d[_0xfa10('0x29')],_0x4ff010);if(this[_0xfa10('0xc')][_0x4ff010]){return mailAccount['notify'](_0x4ff010,_0xbb552d)['then'](function(_0x1df748){if(_0x1df748){logger['info']('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0xcdbcbe){logger['error'](_0xfa10('0x2a'),JSON['stringify'](_0xcdbcbe));});}};EmailChannel[_0xfa10('0xf')]['handleImapEnd']=function(_0x42b2e9){if(this[_0xfa10('0xc')][_0x42b2e9]&&this[_0xfa10('0xc')][_0x42b2e9]['Imap']){if(this['imapAccounts'][this[_0xfa10('0xc')][_0x42b2e9][_0xfa10('0x15')]['id']]){delete this[_0xfa10('0xd')][this[_0xfa10('0xc')][_0x42b2e9][_0xfa10('0x15')]['id']];}this[_0xfa10('0xc')][_0x42b2e9]['Imap'][_0xfa10('0x2b')]=moment();this[_0xfa10('0x10')](_0x42b2e9);}};EmailChannel[_0xfa10('0xf')][_0xfa10('0x2c')]=function(_0x3de70b,_0x17d0c4){if(this['mailAccounts'][_0x3de70b]){this[_0xfa10('0xc')][_0x3de70b][_0xfa10('0x15')][_0xfa10('0x13')]=_0xfa10('0x2d');this[_0xfa10('0xc')][_0x3de70b][_0xfa10('0x15')][_0xfa10('0x14')]=_0x17d0c4;return this[_0xfa10('0x10')](_0x3de70b);}};EmailChannel['prototype'][_0xfa10('0x2e')]=function(_0x91e996,_0x3a5a0f){return this[_0xfa10('0xe')][_0xfa10('0x2f')](_0x91e996,_0x3a5a0f);};EmailChannel[_0xfa10('0xf')][_0xfa10('0x30')]=function(_0x1c33c9){var _0x81effc=this;if(this[_0xfa10('0xc')][_0x1c33c9['id']]){if(_[_0xfa10('0x17')](this[_0xfa10('0xc')][_0x1c33c9['id']]['Smtp'])){this[_0xfa10('0xc')][_0x1c33c9['id']]['Smtp']={};}this[_0xfa10('0xc')][_0x1c33c9['id']][_0xfa10('0x31')][_0xfa10('0x2b')]=moment();return new BPromise(function(_0x337fc3,_0x251e0c){return _0x81effc['smtp'][_0xfa10('0x32')](_0x1c33c9)[_0xfa10('0x33')](function(_0xe5c396){_0x81effc[_0xfa10('0xc')][_0x1c33c9['id']][_0xfa10('0x31')][_0xfa10('0x13')]=_0xfa10('0x34');_0x81effc[_0xfa10('0xc')][_0x1c33c9['id']][_0xfa10('0x31')][_0xfa10('0x14')]='';_0x81effc[_0xfa10('0x10')](_0x1c33c9['id']);_0x337fc3(_0xe5c396);})['catch'](function(_0x4b6144){_0x81effc[_0xfa10('0xc')][_0x1c33c9['id']][_0xfa10('0x31')][_0xfa10('0x13')]=_0xfa10('0x2d');_0x81effc['mailAccounts'][_0x1c33c9['id']][_0xfa10('0x31')]['messageStatus']=_0x4b6144;_0x81effc[_0xfa10('0x10')](_0x1c33c9['id']);_0x251e0c(_0x4b6144);});});}return this[_0xfa10('0xe')][_0xfa10('0x32')](_0x1c33c9);};module[_0xfa10('0x35')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index e6aaed9..d3ee647 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 _0xddcc=['email','emit','stringify','textCode','upperFirst','exports','path','util','lodash','randomstring','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','mailbox','account','getAccount','imap','ready','handleReady','bind','once','end','handleEnd','error','handleError','inherits','prototype','connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','autotls','required','getHost','service','anonymous@xcally.com','openBox','handleOpenBox','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser'];(function(_0x1c964a,_0x3c827d){var _0x11fce5=function(_0x3bba5b){while(--_0x3bba5b){_0x1c964a['push'](_0x1c964a['shift']());}};_0x11fce5(++_0x3c827d);}(_0xddcc,0x8a));var _0xcddc=function(_0x2e685b,_0x5cb0bd){_0x2e685b=_0x2e685b-0x0;var _0x58c883=_0xddcc[_0x2e685b];return _0x58c883;};'use strict';var fs=require('fs');var path=require(_0xcddc('0x0'));var util=require(_0xcddc('0x1'));var Imap=require('imap');var _=require(_0xcddc('0x2'));var rs=require(_0xcddc('0x3'));var simpleParser=require(_0xcddc('0x4'))[_0xcddc('0x5')];var Iconv=require(_0xcddc('0x6'))[_0xcddc('0x7')];var EventEmitter=require(_0xcddc('0x8'))[_0xcddc('0x9')];var utils=require(_0xcddc('0xa'));var logger=require(_0xcddc('0xb'))('email');function EmailImap(_0x17fd40,_0x48f78){this[_0xcddc('0xc')]='INBOX';this[_0xcddc('0xd')]=this[_0xcddc('0xe')](_0x17fd40,_0x48f78);this['imap']=new Imap(this['account']);this[_0xcddc('0xf')]['once'](_0xcddc('0x10'),this[_0xcddc('0x11')][_0xcddc('0x12')](this));this[_0xcddc('0xf')][_0xcddc('0x13')](_0xcddc('0x14'),this[_0xcddc('0x15')][_0xcddc('0x12')](this));this['imap']['on'](_0xcddc('0x16'),this[_0xcddc('0x17')][_0xcddc('0x12')](this));this['imap']['connect']();}util[_0xcddc('0x18')](EmailImap,EventEmitter);EmailImap[_0xcddc('0x19')]['getAccount']=function(_0x3e0327,_0x1c4613){var _0x5283e5={'connTimeout':_0x3e0327[_0xcddc('0x1a')]?_0x3e0327[_0xcddc('0x1a')]*0x3e8:0x2710,'authTimeout':_0x3e0327[_0xcddc('0x1b')]?_0x3e0327[_0xcddc('0x1b')]*0x3e8:0x1388};if(_[_0xcddc('0x1c')](_0x3e0327['service'])){if(_0x3e0327[_0xcddc('0x1d')]){_0x5283e5['user']=_0x3e0327[_0xcddc('0x1e')];_0x5283e5[_0xcddc('0x1f')]=_0x3e0327[_0xcddc('0x1f')];}_0x5283e5[_0xcddc('0x20')]=_0x3e0327[_0xcddc('0x20')];_0x5283e5[_0xcddc('0x21')]=_0x3e0327[_0xcddc('0x21')]||0x3e1;if(_0x3e0327[_0xcddc('0x22')]){_0x5283e5['tls']=!![];}else{_0x5283e5['tls']=![];_0x5283e5[_0xcddc('0x23')]=_0xcddc('0x24');}}else{_0x5283e5[_0xcddc('0x1e')]=_0x3e0327[_0xcddc('0x1e')];_0x5283e5['password']=_0x3e0327['password'];_0x5283e5['host']=utils[_0xcddc('0x25')](_0x3e0327[_0xcddc('0x26')]);_0x5283e5[_0xcddc('0x21')]=0x3e1;_0x5283e5[_0xcddc('0x22')]=!![];}_0x5283e5['email']=_0x1c4613||_0x3e0327[_0xcddc('0x1e')]||_0xcddc('0x27');return _0x5283e5;};EmailImap[_0xcddc('0x19')]['handleReady']=function(){this[_0xcddc('0xf')][_0xcddc('0x28')](this[_0xcddc('0xc')],![],this[_0xcddc('0x29')][_0xcddc('0x12')](this));};EmailImap[_0xcddc('0x19')][_0xcddc('0x29')]=function(_0x419bc1,_0x42af8c){if(_0x419bc1){this['handleError'](_0x419bc1,!![]);}else{this['emit'](_0xcddc('0x2a'),_0x42af8c);this[_0xcddc('0x2b')]();}};EmailImap[_0xcddc('0x19')][_0xcddc('0x2c')]=function(_0x5e0542){if(_0x5e0542){this[_0xcddc('0x17')](_0x5e0542,!![]);}else{this[_0xcddc('0xf')][_0xcddc('0x14')]();}};EmailImap['prototype'][_0xcddc('0x2b')]=function(){this[_0xcddc('0xf')][_0xcddc('0x2d')]([_0xcddc('0x2e')],this[_0xcddc('0x2f')][_0xcddc('0x12')](this));};EmailImap[_0xcddc('0x19')][_0xcddc('0x2f')]=function(_0x2d3e28,_0xde789a){if(_0x2d3e28){this[_0xcddc('0x17')](_0x2d3e28,!![]);}else{if(_0xde789a[_0xcddc('0x30')]){try{var _0x16282d=this['imap'][_0xcddc('0x31')](_0xde789a,{'bodies':'','markSeen':!![]});_0x16282d['on'](_0xcddc('0x32'),this[_0xcddc('0x33')][_0xcddc('0x12')](this));_0x16282d[_0xcddc('0x13')](_0xcddc('0x16'),this[_0xcddc('0x34')][_0xcddc('0x12')](this));_0x16282d[_0xcddc('0x13')](_0xcddc('0x14'),this[_0xcddc('0x35')][_0xcddc('0x12')](this));}catch(_0x2a7cef){logger[_0xcddc('0x16')](_0x2a7cef);}}else{this[_0xcddc('0xf')][_0xcddc('0x36')](!![],this['handleCloseBox'][_0xcddc('0x12')](this));}}};EmailImap[_0xcddc('0x19')][_0xcddc('0x33')]=function(_0x2814d4,_0x4d8ff4){_0x2814d4['on']('body',this['handleMessageBody']['bind'](this));_0x2814d4[_0xcddc('0x13')]('attributes',this[_0xcddc('0x37')][_0xcddc('0x12')](this));_0x2814d4[_0xcddc('0x13')]('end',this[_0xcddc('0x38')][_0xcddc('0x12')](this));};EmailImap['prototype'][_0xcddc('0x39')]=function(_0x25fdb2,_0x37af2d){simpleParser(_0x25fdb2,{'Iconv':Iconv},this[_0xcddc('0x3a')]['bind'](this));};EmailImap[_0xcddc('0x19')][_0xcddc('0x37')]=function(_0x1e23d7){};EmailImap['prototype'][_0xcddc('0x38')]=function(){};EmailImap['prototype'][_0xcddc('0x3a')]=function(_0x2f2f07,_0x452599){if(_0x2f2f07){logger[_0xcddc('0x16')](_0x2f2f07);}else{var _0x59e21c=this;utils[_0xcddc('0x3b')](this[_0xcddc('0xd')],_0x452599,function(_0x4e5a95){_0x59e21c['emit'](_0xcddc('0x3c'),_0x4e5a95);});}};EmailImap[_0xcddc('0x19')][_0xcddc('0x35')]=function(){this[_0xcddc('0xf')][_0xcddc('0x36')](!![],this['handleCloseBox'][_0xcddc('0x12')](this));};EmailImap[_0xcddc('0x19')][_0xcddc('0x34')]=function(_0x3b41cd){this['handleError'](_0x3b41cd);this[_0xcddc('0xf')]['closeBox'](!![],this[_0xcddc('0x2c')][_0xcddc('0x12')](this));};EmailImap[_0xcddc('0x19')]['handleEnd']=function(){this[_0xcddc('0x3d')](_0xcddc('0x14'));};EmailImap['prototype'][_0xcddc('0x17')]=function(_0x15d182,_0x4c302b){logger[_0xcddc('0x16')](_0xcddc('0x17'),this['account'][_0xcddc('0x3c')],JSON[_0xcddc('0x3e')](_0x15d182));var _0x23fea9='';if(_0x15d182){if(_0x15d182['textCode']){_0x23fea9=_0x15d182[_0xcddc('0x3f')];}else{for(var _0x2433bc in _0x15d182){if(_0x15d182['hasOwnProperty'](_0x2433bc)){_0x23fea9+=_[_0xcddc('0x40')](_0x2433bc)+':\x20'+_0x15d182[_0x2433bc]+'\x0a';}}}}if(_0x4c302b){this[_0xcddc('0xf')][_0xcddc('0x14')]();}else{this[_0xcddc('0x3d')](_0xcddc('0x16'),_0x23fea9);this['emit'](_0xcddc('0x14'));}};module[_0xcddc('0x41')]=EmailImap; \ No newline at end of file +var _0x6246=['randomstring','mailparser','simpleParser','iconv','Iconv','./utils','INBOX','account','once','ready','bind','handleEnd','handleError','getAccount','connTimeout','authTimeout','isNil','service','user','password','host','port','tls','autotls','required','getHost','email','anonymous@xcally.com','prototype','handleReady','openBox','mailbox','handleOpenBox','emit','box','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','message','handleFetchMessage','error','handleFetchError','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','closeBox','stringify','textCode','upperFirst','exports','path','util','imap'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0x6246,0x19a));var _0x6624=function(_0x5d84d6,_0x563ff3){_0x5d84d6=_0x5d84d6-0x0;var _0x9ab14c=_0x6246[_0x5d84d6];return _0x9ab14c;};'use strict';var fs=require('fs');var path=require(_0x6624('0x0'));var util=require(_0x6624('0x1'));var Imap=require(_0x6624('0x2'));var _=require('lodash');var rs=require(_0x6624('0x3'));var simpleParser=require(_0x6624('0x4'))[_0x6624('0x5')];var Iconv=require(_0x6624('0x6'))[_0x6624('0x7')];var EventEmitter=require('events')['EventEmitter'];var utils=require(_0x6624('0x8'));var logger=require('../../../config/logger')('email');function EmailImap(_0x1bb561,_0x239e89){this['mailbox']=_0x6624('0x9');this['account']=this['getAccount'](_0x1bb561,_0x239e89);this['imap']=new Imap(this[_0x6624('0xa')]);this['imap'][_0x6624('0xb')](_0x6624('0xc'),this['handleReady'][_0x6624('0xd')](this));this[_0x6624('0x2')][_0x6624('0xb')]('end',this[_0x6624('0xe')][_0x6624('0xd')](this));this[_0x6624('0x2')]['on']('error',this[_0x6624('0xf')]['bind'](this));this[_0x6624('0x2')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0x6624('0x10')]=function(_0x3083ee,_0x89cf7b){var _0x1386cc={'connTimeout':_0x3083ee[_0x6624('0x11')]?_0x3083ee['connTimeout']*0x3e8:0x2710,'authTimeout':_0x3083ee[_0x6624('0x12')]?_0x3083ee[_0x6624('0x12')]*0x3e8:0x1388};if(_[_0x6624('0x13')](_0x3083ee[_0x6624('0x14')])){if(_0x3083ee['authentication']){_0x1386cc[_0x6624('0x15')]=_0x3083ee['user'];_0x1386cc[_0x6624('0x16')]=_0x3083ee[_0x6624('0x16')];}_0x1386cc[_0x6624('0x17')]=_0x3083ee[_0x6624('0x17')];_0x1386cc[_0x6624('0x18')]=_0x3083ee[_0x6624('0x18')]||0x3e1;if(_0x3083ee[_0x6624('0x19')]){_0x1386cc[_0x6624('0x19')]=!![];}else{_0x1386cc['tls']=![];_0x1386cc[_0x6624('0x1a')]=_0x6624('0x1b');}}else{_0x1386cc[_0x6624('0x15')]=_0x3083ee['user'];_0x1386cc[_0x6624('0x16')]=_0x3083ee[_0x6624('0x16')];_0x1386cc['host']=utils[_0x6624('0x1c')](_0x3083ee[_0x6624('0x14')]);_0x1386cc[_0x6624('0x18')]=0x3e1;_0x1386cc['tls']=!![];}_0x1386cc[_0x6624('0x1d')]=_0x89cf7b||_0x3083ee[_0x6624('0x15')]||_0x6624('0x1e');return _0x1386cc;};EmailImap[_0x6624('0x1f')][_0x6624('0x20')]=function(){this[_0x6624('0x2')][_0x6624('0x21')](this[_0x6624('0x22')],![],this[_0x6624('0x23')][_0x6624('0xd')](this));};EmailImap[_0x6624('0x1f')][_0x6624('0x23')]=function(_0x286a0e,_0x4ef969){if(_0x286a0e){this[_0x6624('0xf')](_0x286a0e,!![]);}else{this[_0x6624('0x24')](_0x6624('0x25'),_0x4ef969);this[_0x6624('0x26')]();}};EmailImap[_0x6624('0x1f')][_0x6624('0x27')]=function(_0x3a03af){if(_0x3a03af){this['handleError'](_0x3a03af,!![]);}else{this[_0x6624('0x2')][_0x6624('0x28')]();}};EmailImap[_0x6624('0x1f')]['readUnseen']=function(){this[_0x6624('0x2')][_0x6624('0x29')]([_0x6624('0x2a')],this[_0x6624('0x2b')][_0x6624('0xd')](this));};EmailImap[_0x6624('0x1f')][_0x6624('0x2b')]=function(_0x196c04,_0x2acbe9){if(_0x196c04){this['handleError'](_0x196c04,!![]);}else{if(_0x2acbe9['length']){try{var _0x33d8b2=this['imap']['fetch'](_0x2acbe9,{'bodies':'','markSeen':!![]});_0x33d8b2['on'](_0x6624('0x2c'),this[_0x6624('0x2d')][_0x6624('0xd')](this));_0x33d8b2['once'](_0x6624('0x2e'),this[_0x6624('0x2f')][_0x6624('0xd')](this));_0x33d8b2[_0x6624('0xb')]('end',this['handleFetchEnd'][_0x6624('0xd')](this));}catch(_0x13131c){logger[_0x6624('0x2e')](_0x13131c);}}else{this[_0x6624('0x2')]['closeBox'](!![],this[_0x6624('0x27')][_0x6624('0xd')](this));}}};EmailImap['prototype'][_0x6624('0x2d')]=function(_0x2ae1fc,_0x5c6a96){_0x2ae1fc['on']('body',this['handleMessageBody'][_0x6624('0xd')](this));_0x2ae1fc[_0x6624('0xb')](_0x6624('0x30'),this[_0x6624('0x31')][_0x6624('0xd')](this));_0x2ae1fc[_0x6624('0xb')](_0x6624('0x28'),this[_0x6624('0x32')][_0x6624('0xd')](this));};EmailImap['prototype']['handleMessageBody']=function(_0x2429be,_0x241eea){simpleParser(_0x2429be,{'Iconv':Iconv},this[_0x6624('0x33')][_0x6624('0xd')](this));};EmailImap[_0x6624('0x1f')][_0x6624('0x31')]=function(_0x59111f){};EmailImap[_0x6624('0x1f')][_0x6624('0x32')]=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x481ab8,_0x22a687){if(_0x481ab8){logger[_0x6624('0x2e')](_0x481ab8);}else{var _0x485d7b=this;utils[_0x6624('0x34')](this[_0x6624('0xa')],_0x22a687,function(_0x1cdc99){_0x485d7b[_0x6624('0x24')](_0x6624('0x1d'),_0x1cdc99);});}};EmailImap[_0x6624('0x1f')][_0x6624('0x35')]=function(){this[_0x6624('0x2')][_0x6624('0x36')](!![],this['handleCloseBox'][_0x6624('0xd')](this));};EmailImap['prototype'][_0x6624('0x2f')]=function(_0xe1d9e6){this['handleError'](_0xe1d9e6);this[_0x6624('0x2')]['closeBox'](!![],this[_0x6624('0x27')][_0x6624('0xd')](this));};EmailImap[_0x6624('0x1f')]['handleEnd']=function(){this['emit']('end');};EmailImap[_0x6624('0x1f')][_0x6624('0xf')]=function(_0x1c58a0,_0x1ce6d5){logger[_0x6624('0x2e')](_0x6624('0xf'),this[_0x6624('0xa')][_0x6624('0x1d')],JSON[_0x6624('0x37')](_0x1c58a0));var _0x251ff4='';if(_0x1c58a0){if(_0x1c58a0[_0x6624('0x38')]){_0x251ff4=_0x1c58a0['textCode'];}else{for(var _0x25ebef in _0x1c58a0){if(_0x1c58a0['hasOwnProperty'](_0x25ebef)){_0x251ff4+=_[_0x6624('0x39')](_0x25ebef)+':\x20'+_0x1c58a0[_0x25ebef]+'\x0a';}}}}if(_0x1ce6d5){this[_0x6624('0x2')]['end']();}else{this[_0x6624('0x24')](_0x6624('0x2e'),_0x251ff4);this['emit'](_0x6624('0x28'));}};module[_0x6624('0x3a')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 300d823..c1ebbff 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 _0x4159=['exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','toString'];(function(_0x33fa02,_0x15241e){var _0x2cc3e0=function(_0x5f0e58){while(--_0x5f0e58){_0x33fa02['push'](_0x33fa02['shift']());}};_0x2cc3e0(++_0x15241e);}(_0x4159,0x119));var _0x9415=function(_0x3f8f48,_0x27bc03){_0x3f8f48=_0x3f8f48-0x0;var _0x3e8d13=_0x4159[_0x3f8f48];return _0x3e8d13;};'use strict';var nodemailer=require(_0x9415('0x0'));var BPromise=require(_0x9415('0x1'));var inlineBase64=require(_0x9415('0x2'));function EmailSmtp(){}EmailSmtp[_0x9415('0x3')][_0x9415('0x4')]=function(_0x407e39,_0x5802e0){return new BPromise(function(_0x4dd43e,_0x147209){var _0x50ee5c=nodemailer[_0x9415('0x5')](_0x407e39);_0x50ee5c[_0x9415('0x6')](_0x9415('0x7'),inlineBase64());_0x50ee5c['sendMail'](_0x5802e0,function(_0xb8dc5,_0x1e30ff){if(_0xb8dc5){_0x147209(_0xb8dc5['toString']());}else{_0x4dd43e(_0x1e30ff);}});});};EmailSmtp[_0x9415('0x3')]['verify']=function(_0x189dc3){return new BPromise(function(_0x54634f,_0x17043d){var _0x3c5f85=nodemailer[_0x9415('0x5')](_0x189dc3);_0x3c5f85['verify'](function(_0x1756bd,_0x3044bd){if(_0x1756bd){_0x17043d(_0x1756bd[_0x9415('0x8')]());}else{if(_0x3044bd){_0x54634f(_0x3044bd);}else{_0x17043d('Not\x20verifired');}}});});};module[_0x9415('0x9')]=EmailSmtp; \ No newline at end of file +var _0x1735=['nodemailer-plugin-inline-base64','use','sendMail','verify','createTransport','toString','Not\x20verifired','nodemailer','bluebird'];(function(_0x2b152a,_0x3dd988){var _0x2ad4c7=function(_0x2fa97c){while(--_0x2fa97c){_0x2b152a['push'](_0x2b152a['shift']());}};_0x2ad4c7(++_0x3dd988);}(_0x1735,0x85));var _0x5173=function(_0x56773c,_0x53551d){_0x56773c=_0x56773c-0x0;var _0x5eb887=_0x1735[_0x56773c];return _0x5eb887;};'use strict';var nodemailer=require(_0x5173('0x0'));var BPromise=require(_0x5173('0x1'));var inlineBase64=require(_0x5173('0x2'));function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0x36316e,_0x3de7c4){return new BPromise(function(_0x5513f0,_0x432406){var _0x28b0c8=nodemailer['createTransport'](_0x36316e);_0x28b0c8[_0x5173('0x3')]('compile',inlineBase64());_0x28b0c8[_0x5173('0x4')](_0x3de7c4,function(_0x295b8b,_0x51dbdb){if(_0x295b8b){_0x432406(_0x295b8b['toString']());}else{_0x5513f0(_0x51dbdb);}});});};EmailSmtp['prototype'][_0x5173('0x5')]=function(_0x36e8d6){return new BPromise(function(_0x3338e3,_0x448b37){var _0x21c2a5=nodemailer[_0x5173('0x6')](_0x36e8d6);_0x21c2a5['verify'](function(_0x36f091,_0x239598){if(_0x36f091){_0x448b37(_0x36f091[_0x5173('0x7')]());}else{if(_0x239598){_0x3338e3(_0x239598);}else{_0x448b37(_0x5173('0x8'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 391e0c9..0309f59 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 _0x7524=['test','includes','Empty\x20message

','Attachments','Title','Data','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook365','127.0.0.1','moment','randomstring','util','node-tnef','../../../config/environment','head','value','address','generate','@xcally.com','name','substring','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','anonymous','html'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7524,0xce));var _0x4752=function(_0x59664c,_0x108c41){_0x59664c=_0x59664c-0x0;var _0x870450=_0x7524[_0x59664c];return _0x870450;};'use strict';var _=require('lodash');var moment=require(_0x4752('0x0'));var random=require(_0x4752('0x1'));var fs=require('fs');var path=require('path');var util=require(_0x4752('0x2'));var tnef=require(_0x4752('0x3'));var logger=require('../../../config/logger')('email');var config=require(_0x4752('0x4'));function getAddress(_0x4d5e05){var _0x3884b9=_[_0x4752('0x5')](_0x4d5e05[_0x4752('0x6')]);return _0x3884b9&&_0x3884b9[_0x4752('0x7')]?_0x3884b9[_0x4752('0x7')]:'anonymous'+random[_0x4752('0x8')](0x6)+_0x4752('0x9');}function getFirstName(_0x59477c){var _0x5db15c=_[_0x4752('0x5')](_0x59477c[_0x4752('0x6')]);if(_0x5db15c&&_0x5db15c[_0x4752('0xa')]){if(_0x5db15c[_0x4752('0xa')]==_0x5db15c['address']){return _0x5db15c[_0x4752('0xa')][_0x4752('0xb')](0x0,_0x5db15c[_0x4752('0xa')][_0x4752('0xc')]('@'));}var _0xcf0104=_0x5db15c['name'][_0x4752('0xd')](/\s+/);return _0xcf0104[_0x4752('0xe')]>0x1?_0xcf0104[_0x4752('0xf')](0x0,-0x1)[_0x4752('0x10')]('\x20'):_0x5db15c[_0x4752('0xa')];}return _0x4752('0x11');}function getLastName(_0xcee47){var _0x505d48=_[_0x4752('0x5')](_0xcee47['value']);if(_0x505d48&&_0x505d48[_0x4752('0xa')]){var _0x32d837=_0x505d48[_0x4752('0xa')][_0x4752('0xd')](/\s+/);return _0x32d837[_0x4752('0xe')]>0x1?_0x32d837[_0x4752('0x12')]():'';}return'';}function getMails(_0x410f88,_0x552daf){var _0x446a37='';for(var _0x1dad7c=0x0;_0x1dad7c<_0x552daf['value'][_0x4752('0xe')];_0x1dad7c+=0x1){if(_0x552daf['value'][_0x1dad7c][_0x4752('0x7')]!==_0x410f88){if(!_[_0x4752('0x13')](_0x446a37)){_0x446a37+=',';}_0x446a37+=_0x552daf['value'][_0x1dad7c][_0x4752('0xa')]||_0x552daf['value'][_0x1dad7c]['address']||'';_0x446a37+='\x20<';_0x446a37+=_0x552daf[_0x4752('0x6')][_0x1dad7c][_0x4752('0x7')]?_0x552daf[_0x4752('0x6')][_0x1dad7c][_0x4752('0x7')]:_0x4752('0x14')+random[_0x4752('0x8')](0x6)+'@xcally.com';_0x446a37+='>';}}return _0x446a37;}function parseEmail(_0x22215f,_0x2d2f9e,_0x477050){if(_0x2d2f9e[_0x4752('0x15')]){var _0x3facf5=/)<[^<]*)*<\/script>/gi;while(_0x3facf5[_0x4752('0x16')](_0x2d2f9e['html'])){_0x2d2f9e[_0x4752('0x15')]=_0x2d2f9e[_0x4752('0x15')]['replace'](_0x3facf5,'');}if(_0x2d2f9e[_0x4752('0x15')][_0x4752('0x17')](_0x4752('0x18'))){var _0x27a93a=[];_0x2d2f9e[_0x4752('0x19')][_0x4752('0x1a')](_0x1135bf=>{_0x27a93a[_0x4752('0x1b')](_0x1135bf[_0x4752('0x1c')]);});var _0x2c259a=/]+>/g;var _0x4a03f4=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x113cd5=_0x2d2f9e['html']['replace'](_0x4a03f4,'_SRC');var _0x1dcdcd=_0x113cd5[_0x4752('0x1d')](_0x2c259a,_0x4752('0x1e'));for(let _0x1cb8e7=0x0;_0x1cb8e7<_0x27a93a[_0x4752('0xe')];_0x1cb8e7++){var _0x3bf3bf=_0x1dcdcd[_0x4752('0x1d')](_0x4752('0x1e'),'\x20[Attachment:\x20'+_0x27a93a[_0x1cb8e7]+'\x20]');_0x1dcdcd=_0x3bf3bf;}_0x2d2f9e[_0x4752('0x15')]=_0x1dcdcd;}_0x477050[_0x4752('0x1f')]=_0x2d2f9e[_0x4752('0x15')];}else{_0x477050[_0x4752('0x1f')]=_0x2d2f9e[_0x4752('0x20')];}if(_0x477050[_0x4752('0x1f')]){_0x477050[_0x4752('0x1f')]=_0x477050[_0x4752('0x1f')][_0x4752('0x1d')](/0x0){var _0x2614bc=[_0x4752('0x32'),_0x4752('0x33'),'Precedence:\x20auto_reply'];for(var _0xdde9a3=0x0;_0xdde9a3<_0x2d2f9e[_0x4752('0x31')][_0x4752('0xe')];_0xdde9a3++){var _0x476262=_[_0x4752('0xc')](_0x2614bc,_0x2d2f9e['headerLines'][_0xdde9a3]['line']);if(_0x476262>=0x0){_0x477050[_0x4752('0x34')]=!![];}}}return _0x477050;}exports[_0x4752('0x35')]=function(_0x828534,_0x222f82,_0x35cc01){var _0x1049f7={'from':getAddress(_0x222f82[_0x4752('0x36')]),'firstName':getFirstName(_0x222f82[_0x4752('0x36')]),'lastName':getLastName(_0x222f82[_0x4752('0x36')]),'mapKey':_0x4752('0x24'),'message':{'from':getMails(_0x828534[_0x4752('0x24')],_0x222f82[_0x4752('0x36')]),'to':_0x828534['email'],'cc':'','subject':_0x222f82[_0x4752('0x37')]||'','messageId':_0x222f82['messageId'],'inReplyTo':_0x222f82[_0x4752('0x38')],'sentAt':moment(_0x222f82[_0x4752('0x39')])['format'](_0x4752('0x3a')),'attach':![],'attachments':[]}};if(!_0x222f82[_0x4752('0x15')]&&!_0x222f82[_0x4752('0x20')]){var _0x38a74c=_[_0x4752('0x3b')](_0x222f82[_0x4752('0x19')],{'contentType':'application/ms-tnef'});if(_0x38a74c[_0x4752('0xe')]){logger[_0x4752('0x3c')](util[_0x4752('0x2b')](_0x4752('0x3d'),_0x222f82[_0x4752('0x3e')]));tnef[_0x4752('0x3f')](_['first'](_0x38a74c)[_0x4752('0x30')],function(_0x3b8ea4,_0xa03eff){if(_0xa03eff){_0x222f82[_0x4752('0x15')]=_0xa03eff[_0x4752('0x40')]||_0x4752('0x41');if(_0xa03eff['Attachments']){for(var _0x335912=0x0;_0x335912<_0xa03eff['Attachments']['length'];_0x335912++){var _0x965429=_0xa03eff[_0x4752('0x42')][_0x335912];_0x1049f7[_0x4752('0x22')]['attachments'][_0x4752('0x1b')]({'filename':_0x965429[_0x4752('0x43')],'content':Buffer['from'](_0x965429[_0x4752('0x44')])});}}}_0x35cc01(parseEmail(_0x828534,_0x222f82,_0x1049f7));});}else{_0x222f82[_0x4752('0x15')]=_0x4752('0x41');_0x35cc01(parseEmail(_0x828534,_0x222f82,_0x1049f7));}}else{_0x35cc01(parseEmail(_0x828534,_0x222f82,_0x1049f7));}};exports['getHost']=function(_0x2ba24b){switch(_0x2ba24b){case _0x4752('0x45'):return _0x4752('0x46');case _0x4752('0x47'):return _0x4752('0x48');case _0x4752('0x49'):return'imap-mail.outlook.com';case _0x4752('0x4a'):return'outlook.office365.com';}return _0x4752('0x4b');}; \ No newline at end of file +var _0xdfdd=['attachment-','format','%s-%s','now','root','server/files/attachments/','writeFileSync','headerLines','Auto-Submitted:\x20auto-replied','line','isAutoreply','from','subject','inReplyTo','date','filter','application/ms-tnef','messageId','parseBuffer','content','BodyHTML','Attachments','Title','

Empty\x20message

','getHost','gmail','yahoo','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','node-tnef','email','head','value','address','generate','@xcally.com','name','substring','indexOf','length','join','Anonymous','split','pop','isEmpty','anonymous','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0xf7ca6f['slice'](0x0,-0x1)[_0xddfd('0xf')]('\x20'):_0xc03e9['name'];}return _0xddfd('0x10');}function getLastName(_0x4d3674){var _0x3cdb1f=_['head'](_0x4d3674[_0xddfd('0x7')]);if(_0x3cdb1f&&_0x3cdb1f[_0xddfd('0xb')]){var _0x383ac8=_0x3cdb1f[_0xddfd('0xb')][_0xddfd('0x11')](/\s+/);return _0x383ac8['length']>0x1?_0x383ac8[_0xddfd('0x12')]():'';}return'';}function getMails(_0x44771b,_0x47530a){var _0xf0dfb1='';for(var _0xa85d01=0x0;_0xa85d01<_0x47530a[_0xddfd('0x7')][_0xddfd('0xe')];_0xa85d01+=0x1){if(_0x47530a['value'][_0xa85d01]['address']!==_0x44771b){if(!_[_0xddfd('0x13')](_0xf0dfb1)){_0xf0dfb1+=',';}_0xf0dfb1+=_0x47530a[_0xddfd('0x7')][_0xa85d01][_0xddfd('0xb')]||_0x47530a[_0xddfd('0x7')][_0xa85d01][_0xddfd('0x8')]||'';_0xf0dfb1+='\x20<';_0xf0dfb1+=_0x47530a['value'][_0xa85d01][_0xddfd('0x8')]?_0x47530a[_0xddfd('0x7')][_0xa85d01][_0xddfd('0x8')]:_0xddfd('0x14')+random[_0xddfd('0x9')](0x6)+_0xddfd('0xa');_0xf0dfb1+='>';}}return _0xf0dfb1;}function parseEmail(_0x47d8fe,_0x57b589,_0x571e93){if(_0x57b589[_0xddfd('0x15')]){var _0x1c3629=/)<[^<]*)*<\/script>/gi;while(_0x1c3629[_0xddfd('0x16')](_0x57b589[_0xddfd('0x15')])){_0x57b589['html']=_0x57b589[_0xddfd('0x15')][_0xddfd('0x17')](_0x1c3629,'');}if(_0x57b589[_0xddfd('0x15')][_0xddfd('0x18')](_0xddfd('0x19'))){var _0x579cb1=[];_0x57b589[_0xddfd('0x1a')][_0xddfd('0x1b')](_0x3be2ae=>{_0x579cb1[_0xddfd('0x1c')](_0x3be2ae['filename']);});var _0x51375f=/]+>/g;var _0x4b8a02=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0xd933d2=_0x57b589['html'][_0xddfd('0x17')](_0x4b8a02,_0xddfd('0x1d'));var _0x41c651=_0xd933d2[_0xddfd('0x17')](_0x51375f,_0xddfd('0x1e'));for(let _0x5bc566=0x0;_0x5bc566<_0x579cb1[_0xddfd('0xe')];_0x5bc566++){var _0x320e9c=_0x41c651[_0xddfd('0x17')](_0xddfd('0x1e'),_0xddfd('0x1f')+_0x579cb1[_0x5bc566]+_0xddfd('0x20'));_0x41c651=_0x320e9c;}_0x57b589[_0xddfd('0x15')]=_0x41c651;}_0x571e93[_0xddfd('0x21')]=_0x57b589[_0xddfd('0x15')];}else{_0x571e93['body']=_0x57b589[_0xddfd('0x22')];}if(_0x571e93[_0xddfd('0x21')]){_0x571e93['body']=_0x571e93[_0xddfd('0x21')][_0xddfd('0x17')](/0x0){var _0x4b19c1=[_0xddfd('0x34'),'X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply'];for(var _0x321c97=0x0;_0x321c97<_0x57b589[_0xddfd('0x33')][_0xddfd('0xe')];_0x321c97++){var _0x1c19d1=_[_0xddfd('0xd')](_0x4b19c1,_0x57b589[_0xddfd('0x33')][_0x321c97][_0xddfd('0x35')]);if(_0x1c19d1>=0x0){_0x571e93[_0xddfd('0x36')]=!![];}}}return _0x571e93;}exports['parser']=function(_0x3e9ea5,_0x701822,_0x72f3a0){var _0xde7fa7={'from':getAddress(_0x701822[_0xddfd('0x37')]),'firstName':getFirstName(_0x701822[_0xddfd('0x37')]),'lastName':getLastName(_0x701822[_0xddfd('0x37')]),'mapKey':_0xddfd('0x5'),'message':{'from':getMails(_0x3e9ea5[_0xddfd('0x5')],_0x701822[_0xddfd('0x37')]),'to':_0x3e9ea5[_0xddfd('0x5')],'cc':'','subject':_0x701822[_0xddfd('0x38')]||'','messageId':_0x701822['messageId'],'inReplyTo':_0x701822[_0xddfd('0x39')],'sentAt':moment(_0x701822[_0xddfd('0x3a')])[_0xddfd('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x701822[_0xddfd('0x15')]&&!_0x701822[_0xddfd('0x22')]){var _0x270acf=_[_0xddfd('0x3b')](_0x701822[_0xddfd('0x1a')],{'contentType':_0xddfd('0x3c')});if(_0x270acf['length']){logger['info'](util[_0xddfd('0x2d')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x701822[_0xddfd('0x3d')]));tnef[_0xddfd('0x3e')](_['first'](_0x270acf)[_0xddfd('0x3f')],function(_0x255d72,_0x52100b){if(_0x52100b){_0x701822['html']=_0x52100b[_0xddfd('0x40')]||'

Empty\x20message

';if(_0x52100b[_0xddfd('0x41')]){for(var _0x4d7a5b=0x0;_0x4d7a5b<_0x52100b[_0xddfd('0x41')][_0xddfd('0xe')];_0x4d7a5b++){var _0x265362=_0x52100b[_0xddfd('0x41')][_0x4d7a5b];_0xde7fa7[_0xddfd('0x25')]['attachments']['push']({'filename':_0x265362[_0xddfd('0x42')],'content':Buffer[_0xddfd('0x37')](_0x265362['Data'])});}}}_0x72f3a0(parseEmail(_0x3e9ea5,_0x701822,_0xde7fa7));});}else{_0x701822[_0xddfd('0x15')]=_0xddfd('0x43');_0x72f3a0(parseEmail(_0x3e9ea5,_0x701822,_0xde7fa7));}}else{_0x72f3a0(parseEmail(_0x3e9ea5,_0x701822,_0xde7fa7));}};exports[_0xddfd('0x44')]=function(_0x4dcdf3){switch(_0x4dcdf3){case _0xddfd('0x45'):return'imap.gmail.com';case _0xddfd('0x46'):return'imap.mail.yahoo.com';case _0xddfd('0x47'):return _0xddfd('0x48');case _0xddfd('0x49'):return _0xddfd('0x4a');}return _0xddfd('0x4b');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index c68b7d2..068763f 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 _0x2ef1=['Smtp','exports','name','Service','active','Imap'];(function(_0x59b439,_0x14ae7b){var _0x521ea3=function(_0x5af627){while(--_0x5af627){_0x59b439['push'](_0x59b439['shift']());}};_0x521ea3(++_0x14ae7b);}(_0x2ef1,0x13a));var _0x12ef=function(_0x4c7928,_0x2a46df){_0x4c7928=_0x4c7928-0x0;var _0x233a40=_0x2ef1[_0x4c7928];return _0x233a40;};'use strict';var _=require('lodash');function MailAccount(_0x2ec1bf){this['id']=_0x2ec1bf['id']||0x0;this['name']=_0x2ec1bf[_0x12ef('0x0')]||_0x12ef('0x1');this['key']=_0x2ec1bf['key']||'SERV';this['active']=_0x2ec1bf[_0x12ef('0x2')]||![];this[_0x12ef('0x3')]=_0x2ec1bf[_0x12ef('0x3')]||[];this[_0x12ef('0x4')]=_0x2ec1bf['Smtp']||[];}module[_0x12ef('0x5')]=MailAccount; \ No newline at end of file +var _0x5d3c=['Smtp','exports','key','SERV','active','Imap'];(function(_0x218756,_0x419c39){var _0x1b90ec=function(_0x237c8e){while(--_0x237c8e){_0x218756['push'](_0x218756['shift']());}};_0x1b90ec(++_0x419c39);}(_0x5d3c,0x140));var _0xc5d3=function(_0x23c446,_0x115dc6){_0x23c446=_0x23c446-0x0;var _0x29d77d=_0x5d3c[_0x23c446];return _0x29d77d;};'use strict';var _=require('lodash');function MailAccount(_0x2c82bf){this['id']=_0x2c82bf['id']||0x0;this['name']=_0x2c82bf['name']||'Service';this[_0xc5d3('0x0')]=_0x2c82bf['key']||_0xc5d3('0x1');this[_0xc5d3('0x2')]=_0x2c82bf['active']||![];this[_0xc5d3('0x3')]=_0x2c82bf[_0xc5d3('0x3')]||[];this[_0xc5d3('0x4')]=_0x2c82bf[_0xc5d3('0x4')]||[];}module[_0xc5d3('0x5')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index e455886..13ef459 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 _0x3a0e=['isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','hasOwnProperty','mergeFromDatabase','prototype','initMailAccounts'];(function(_0x39b8a5,_0xc78910){var _0x3f17e7=function(_0xa01a22){while(--_0xa01a22){_0x39b8a5['push'](_0x39b8a5['shift']());}};_0x3f17e7(++_0xc78910);}(_0x3a0e,0x1bb));var _0xe3a0=function(_0x35d619,_0x555131){_0x35d619=_0x35d619-0x0;var _0x42b20a=_0x3a0e[_0x35d619];return _0x42b20a;};'use strict';var _=require(_0xe3a0('0x0'));var MailAccount=require(_0xe3a0('0x1'));var Realtime=function(){this[_0xe3a0('0x2')]={};};function freeIsNotKey(_0x43b40f,_0x9c22f3,_0x427a4b){var _0x587deb=_['mapKeys'](_0x43b40f,function(_0x2d09d2,_0x2deff9){return _0x2d09d2[_0x427a4b];});for(var _0x49abf1 in _0x9c22f3){if(_0x9c22f3[_0xe3a0('0x3')](_0x49abf1)){if(!_0x587deb[_0x49abf1]){delete _0x9c22f3[_0x49abf1];}}}}Realtime['prototype'][_0xe3a0('0x4')]=function(_0x1d0897,_0x595dbd){for(var _0x21149e in _0x595dbd){if(_0x1d0897['hasOwnProperty'](_0x21149e)){_0x1d0897[_0x21149e]=_0x595dbd[_0x21149e];}}};Realtime[_0xe3a0('0x5')][_0xe3a0('0x6')]=function(){var _0x2fb2f5=this;return function(_0x5c2443){if(_0x5c2443){freeIsNotKey(_0x5c2443,_0x2fb2f5[_0xe3a0('0x2')],'id');for(var _0x15df19=0x0,_0x3e97e9={},_0x75dc97={};_0x15df19<_0x5c2443['length'];_0x15df19+=0x1){_0x3e97e9=_0x5c2443[_0x15df19];if(_[_0xe3a0('0x7')](_0x2fb2f5[_0xe3a0('0x2')][_0x3e97e9['id']])){_0x2fb2f5[_0xe3a0('0x2')][_0x3e97e9['id']]=new MailAccount(_0x3e97e9);}else{_[_0xe3a0('0x8')](_0x2fb2f5[_0xe3a0('0x2')][_0x3e97e9['id']],_0x3e97e9);}}}return _0x2fb2f5[_0xe3a0('0x2')];};};module[_0xe3a0('0x9')]=Realtime; \ No newline at end of file +var _0x9f51=['../model/mailAccount','mapKeys','hasOwnProperty','mergeFromDatabase','prototype','initMailAccounts','mailAccounts','length','isUndefined','merge','exports'];(function(_0x500aff,_0x103680){var _0x13bc6d=function(_0x20f9f6){while(--_0x20f9f6){_0x500aff['push'](_0x500aff['shift']());}};_0x13bc6d(++_0x103680);}(_0x9f51,0x1e4));var _0x19f5=function(_0x488818,_0x17c6de){_0x488818=_0x488818-0x0;var _0x30783c=_0x9f51[_0x488818];return _0x30783c;};'use strict';var _=require('lodash');var MailAccount=require(_0x19f5('0x0'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x2f3bef,_0x4f03ab,_0x4449c4){var _0x4fe304=_[_0x19f5('0x1')](_0x2f3bef,function(_0x46bcec,_0x21026c){return _0x46bcec[_0x4449c4];});for(var _0x324930 in _0x4f03ab){if(_0x4f03ab[_0x19f5('0x2')](_0x324930)){if(!_0x4fe304[_0x324930]){delete _0x4f03ab[_0x324930];}}}}Realtime['prototype'][_0x19f5('0x3')]=function(_0x26b8e6,_0x5bce19){for(var _0x12679e in _0x5bce19){if(_0x26b8e6[_0x19f5('0x2')](_0x12679e)){_0x26b8e6[_0x12679e]=_0x5bce19[_0x12679e];}}};Realtime[_0x19f5('0x4')][_0x19f5('0x5')]=function(){var _0x426374=this;return function(_0x21e90a){if(_0x21e90a){freeIsNotKey(_0x21e90a,_0x426374[_0x19f5('0x6')],'id');for(var _0x57e1b7=0x0,_0xd944df={},_0x49e1e8={};_0x57e1b7<_0x21e90a[_0x19f5('0x7')];_0x57e1b7+=0x1){_0xd944df=_0x21e90a[_0x57e1b7];if(_[_0x19f5('0x8')](_0x426374[_0x19f5('0x6')][_0xd944df['id']])){_0x426374[_0x19f5('0x6')][_0xd944df['id']]=new MailAccount(_0xd944df);}else{_[_0x19f5('0x9')](_0x426374[_0x19f5('0x6')][_0xd944df['id']],_0xd944df);}}}return _0x426374['mailAccounts'];};};module[_0x19f5('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 75a8d2b..402eefd 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 _0x6050=['getMailAccounts','Request','GetMailAccount','name','service','active','key','ListId','MailServerOut','NotifyMailAccount','../client'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x6050,0x196));var _0x0605=function(_0x1497ba,_0x420368){_0x1497ba=_0x1497ba-0x0;var _0x4a9043=_0x6050[_0x1497ba];return _0x4a9043;};'use strict';var client=require(_0x0605('0x0'));exports[_0x0605('0x1')]=function(){return function(){return client[_0x0605('0x2')](_0x0605('0x3'),{'options':{'attributes':['id',_0x0605('0x4'),_0x0605('0x5'),'email',_0x0605('0x6'),_0x0605('0x7'),_0x0605('0x8'),'TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':'Imap'},{'model':_0x0605('0x9'),'as':'Smtp'}]},'log':'getMailAccount'});};};exports['notify']=function(_0x1629bf,_0x11b8b5){return client[_0x0605('0x2')](_0x0605('0xa'),{'account':{'id':_0x1629bf},'body':_0x11b8b5,'log':_0x0605('0xa')});}; \ No newline at end of file +var _0xae59=['NotifyMailAccount','../client','Request','GetMailAccount','service','active','ListId','TemplateId','MailServerIn','Imap','MailServerOut','Smtp','getMailAccount','notify'];(function(_0x3f3430,_0x447f10){var _0x585a02=function(_0x608568){while(--_0x608568){_0x3f3430['push'](_0x3f3430['shift']());}};_0x585a02(++_0x447f10);}(_0xae59,0x8d));var _0x9ae5=function(_0xf6a62,_0x557fc6){_0xf6a62=_0xf6a62-0x0;var _0x4361b1=_0xae59[_0xf6a62];return _0x4361b1;};'use strict';var client=require(_0x9ae5('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x9ae5('0x1')](_0x9ae5('0x2'),{'options':{'attributes':['id','name',_0x9ae5('0x3'),'email',_0x9ae5('0x4'),'key',_0x9ae5('0x5'),_0x9ae5('0x6')],'raw':![],'include':[{'model':_0x9ae5('0x7'),'as':_0x9ae5('0x8')},{'model':_0x9ae5('0x9'),'as':_0x9ae5('0xa')}]},'log':_0x9ae5('0xb')});};};exports[_0x9ae5('0xc')]=function(_0x1e0e69,_0x53f27d){return client['Request']('NotifyMailAccount',{'account':{'id':_0x1e0e69},'body':_0x53f27d,'log':_0x9ae5('0xd')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 90b8906..de71b1a 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 _0x1dd4=['loginMailFrequency','../client','getSettings','Request'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1dd4,0x9d));var _0x41dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dd4[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x41dd('0x0'));exports[_0x41dd('0x1')]=function(){return client[_0x41dd('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x41dd('0x3')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x74d1=['Request','ShowSetting','loginMailFrequency','GetSettings','../client'];(function(_0x18b7eb,_0x19e89d){var _0x525d5e=function(_0x4b9e34){while(--_0x4b9e34){_0x18b7eb['push'](_0x18b7eb['shift']());}};_0x525d5e(++_0x19e89d);}(_0x74d1,0xdb));var _0x174d=function(_0x5acfc4,_0x4d77e4){_0x5acfc4=_0x5acfc4-0x0;var _0x55e3ad=_0x74d1[_0x5acfc4];return _0x55e3ad;};'use strict';var client=require(_0x174d('0x0'));exports['getSettings']=function(){return client[_0x174d('0x1')](_0x174d('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x174d('0x3')]},'log':_0x174d('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index b305b2e..a16e51b 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 382bf40..7787fe8 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 _0xe7ae=['socket.io-redis','../../config/triggers','default','../../config/express','../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','sticky-session','ioredis','../../config/environment','createServer','port','socket.io','websocket','polling','redis','defaults','localhost','adapter'];(function(_0x1aaca3,_0x46ae44){var _0x458d7e=function(_0x595950){while(--_0x595950){_0x1aaca3['push'](_0x1aaca3['shift']());}};_0x458d7e(++_0x46ae44);}(_0xe7ae,0x190));var _0xee7a=function(_0x3e333a,_0x55ef1e){_0x3e333a=_0x3e333a-0x0;var _0x16c2f8=_0xe7ae[_0x3e333a];return _0x16c2f8;};'use strict';var _=require(_0xee7a('0x0'));var http=require(_0xee7a('0x1'));var express=require('express');var sticky=require(_0xee7a('0x2'));var Redis=require(_0xee7a('0x3'));var config=require(_0xee7a('0x4'));var app=express();var server=http[_0xee7a('0x5')](app);server['timeout']=0xdbba0;if(sticky['listen'](server,config[_0xee7a('0x6')])){var socketio=require(_0xee7a('0x7'))(server,{'transports':[_0xee7a('0x8'),_0xee7a('0x9')]});config[_0xee7a('0xa')]=_[_0xee7a('0xb')](config[_0xee7a('0xa')],{'host':_0xee7a('0xc'),'port':0x18eb});socketio[_0xee7a('0xd')](require(_0xee7a('0xe'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require(_0xee7a('0xf'))[_0xee7a('0x10')]();require('../../config/socketio')[_0xee7a('0x10')](socketio);require(_0xee7a('0x11'))['default'](app);require(_0xee7a('0x12'))[_0xee7a('0x10')](app);}else{server[_0xee7a('0x13')]('listening',function(){console[_0xee7a('0x14')](_0xee7a('0x15'),config[_0xee7a('0x6')]);});}exports=module[_0xee7a('0x16')]=app; \ No newline at end of file +var _0x8df2=['express','sticky-session','ioredis','../../config/environment','timeout','listen','port','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','default','../../routes','log','exports','lodash','http'];(function(_0x5a9399,_0x3cbbe7){var _0x44bccf=function(_0x426450){while(--_0x426450){_0x5a9399['push'](_0x5a9399['shift']());}};_0x44bccf(++_0x3cbbe7);}(_0x8df2,0x8a));var _0x28df=function(_0x667edd,_0x5b7c50){_0x667edd=_0x667edd-0x0;var _0x4c9012=_0x8df2[_0x667edd];return _0x4c9012;};'use strict';var _=require(_0x28df('0x0'));var http=require(_0x28df('0x1'));var express=require(_0x28df('0x2'));var sticky=require(_0x28df('0x3'));var Redis=require(_0x28df('0x4'));var config=require(_0x28df('0x5'));var app=express();var server=http['createServer'](app);server[_0x28df('0x6')]=0xdbba0;if(sticky[_0x28df('0x7')](server,config[_0x28df('0x8')])){var socketio=require('socket.io')(server,{'transports':[_0x28df('0x9'),_0x28df('0xa')]});config[_0x28df('0xb')]=_[_0x28df('0xc')](config[_0x28df('0xb')],{'host':_0x28df('0xd'),'port':0x18eb});socketio[_0x28df('0xe')](require(_0x28df('0xf'))({'pubClient':new Redis(config[_0x28df('0xb')]),'subClient':new Redis(config[_0x28df('0xb')])}));require('../../config/triggers')['default']();require('../../config/socketio')['default'](socketio);require('../../config/express')[_0x28df('0x10')](app);require(_0x28df('0x11'))[_0x28df('0x10')](app);}else{server['once']('listening',function(){console[_0x28df('0x12')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x28df('0x8')]);});}exports=module[_0x28df('0x13')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 0f8e6a0..89b9ce2 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 _0x1910=['../../config/logger','routing','client','http','Request','request','then','debug','error','message','result','catch','rpc','exports','jayson/promise','bluebird'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x1910,0x18e));var _0x0191=function(_0x57867e,_0x13ae1e){_0x57867e=_0x57867e-0x0;var _0x5d147f=_0x1910[_0x57867e];return _0x5d147f;};'use strict';var jayson=require(_0x0191('0x0'));var BPromise=require(_0x0191('0x1'));var logger=require(_0x0191('0x2'))(_0x0191('0x3'));var client=jayson[_0x0191('0x4')][_0x0191('0x5')]({'port':0x2329});client[_0x0191('0x6')]=function(_0x7eac7d,_0x4490ed){return new BPromise(function(_0x5f590e,_0x8dd978){return client[_0x0191('0x7')](_0x7eac7d,_0x4490ed)[_0x0191('0x8')](function(_0x52ca2c){logger[_0x0191('0x9')]('rpc',_0x0191('0x3'),_0x7eac7d,_0x4490ed,_0x52ca2c);if(_0x52ca2c[_0x0191('0xa')]){logger[_0x0191('0xa')]('rpc','routing',_0x7eac7d,_0x52ca2c[_0x0191('0xa')][_0x0191('0xb')],_0x4490ed);return _0x8dd978(_0x52ca2c[_0x0191('0xa')][_0x0191('0xb')]);}else{return _0x5f590e(_0x52ca2c[_0x0191('0xc')]);}})[_0x0191('0xd')](function(_0x3658a9){logger[_0x0191('0xa')](_0x0191('0xe'),_0x0191('0x3'),_0x7eac7d,_0x3658a9,_0x4490ed);return _0x8dd978(_0x3658a9);});});};module[_0x0191('0xf')]=client; \ No newline at end of file +var _0xcdcc=['http','Request','request','then','debug','rpc','error','message','result','jayson/promise','bluebird','../../config/logger','routing','client'];(function(_0x31658b,_0x39c760){var _0x489e93=function(_0x1e6c0f){while(--_0x1e6c0f){_0x31658b['push'](_0x31658b['shift']());}};_0x489e93(++_0x39c760);}(_0xcdcc,0xa3));var _0xccdc=function(_0xea87ac,_0x5d272f){_0xea87ac=_0xea87ac-0x0;var _0x41d609=_0xcdcc[_0xea87ac];return _0x41d609;};'use strict';var jayson=require(_0xccdc('0x0'));var BPromise=require(_0xccdc('0x1'));var logger=require(_0xccdc('0x2'))(_0xccdc('0x3'));var client=jayson[_0xccdc('0x4')][_0xccdc('0x5')]({'port':0x2329});client[_0xccdc('0x6')]=function(_0xae08c8,_0x1bed40){return new BPromise(function(_0x3444af,_0x120a6b){return client[_0xccdc('0x7')](_0xae08c8,_0x1bed40)[_0xccdc('0x8')](function(_0x2a75f6){logger[_0xccdc('0x9')](_0xccdc('0xa'),_0xccdc('0x3'),_0xae08c8,_0x1bed40,_0x2a75f6);if(_0x2a75f6[_0xccdc('0xb')]){logger[_0xccdc('0xb')](_0xccdc('0xa'),_0xccdc('0x3'),_0xae08c8,_0x2a75f6[_0xccdc('0xb')][_0xccdc('0xc')],_0x1bed40);return _0x120a6b(_0x2a75f6[_0xccdc('0xb')][_0xccdc('0xc')]);}else{return _0x3444af(_0x2a75f6[_0xccdc('0xd')]);}})['catch'](function(_0x28eb70){logger['error'](_0xccdc('0xa'),_0xccdc('0x3'),_0xae08c8,_0x28eb70,_0x1bed40);return _0x120a6b(_0x28eb70);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index f0de448..7d671bf 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 _0xf48f=['initAgents','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','getAgents'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf48f,0x108));var _0xff48=function(_0x20ad5a,_0x182e50){_0x20ad5a=_0x20ad5a-0x0;var _0x55fd73=_0xf48f[_0x20ad5a];return _0x55fd73;};'use strict';var BPromise=require('bluebird');var server=require(_0xff48('0x0'));var Realtime=require(_0xff48('0x1'));var user=require(_0xff48('0x2'));var interval=require(_0xff48('0x3'));var openchannelQueue=require(_0xff48('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xff48('0x5'));var mailQueue=require(_0xff48('0x6'));var faxQueue=require(_0xff48('0x7'));var whatsappQueue=require(_0xff48('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xff48('0x9')](user[_0xff48('0xa')]())[_0xff48('0x9')](realtime[_0xff48('0xb')]())[_0xff48('0x9')](interval['getIntervals']())[_0xff48('0x9')](realtime[_0xff48('0xc')]())[_0xff48('0x9')](openchannelQueue['getOpenchannelQueues']())[_0xff48('0x9')](realtime[_0xff48('0xd')]())[_0xff48('0x9')](chatQueue[_0xff48('0xe')]())[_0xff48('0x9')](realtime[_0xff48('0xf')]())['then'](smsQueue[_0xff48('0x10')]())[_0xff48('0x9')](realtime[_0xff48('0x11')]())[_0xff48('0x9')](mailQueue[_0xff48('0x12')]())[_0xff48('0x9')](realtime[_0xff48('0x13')]())[_0xff48('0x9')](faxQueue['getFaxQueues']())[_0xff48('0x9')](realtime['initFaxQueues']())[_0xff48('0x9')](whatsappQueue[_0xff48('0x14')]())[_0xff48('0x9')](realtime[_0xff48('0x15')]())[_0xff48('0x9')](function(){return realtime;});}function main(){return server[_0xff48('0x16')](realtime)[_0xff48('0x9')](function(_0x26b971){return initRealtime();})[_0xff48('0x9')](function(_0x39b2bd){return setInterval(initRealtime,0x1388);})[_0xff48('0x17')](function(_0x3d2c9c){console[_0xff48('0x18')](_0x3d2c9c);});}main(); \ No newline at end of file +var _0x0d04=['log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then','getAgents','initAgents','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','getFaxQueues','initFaxQueues','initWhatsappQueues'];(function(_0x4b6dba,_0x30ed47){var _0x1340e8=function(_0x309986){while(--_0x309986){_0x4b6dba['push'](_0x4b6dba['shift']());}};_0x1340e8(++_0x30ed47);}(_0x0d04,0x14b));var _0x40d0=function(_0x1c9263,_0x162625){_0x1c9263=_0x1c9263-0x0;var _0x4b7bec=_0x0d04[_0x1c9263];return _0x4b7bec;};'use strict';var BPromise=require(_0x40d0('0x0'));var server=require(_0x40d0('0x1'));var Realtime=require(_0x40d0('0x2'));var user=require(_0x40d0('0x3'));var interval=require(_0x40d0('0x4'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x40d0('0x5'));var smsQueue=require(_0x40d0('0x6'));var mailQueue=require(_0x40d0('0x7'));var faxQueue=require(_0x40d0('0x8'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x40d0('0x9')]()[_0x40d0('0xa')](user[_0x40d0('0xb')]())['then'](realtime[_0x40d0('0xc')]())[_0x40d0('0xa')](interval['getIntervals']())[_0x40d0('0xa')](realtime[_0x40d0('0xd')]())[_0x40d0('0xa')](openchannelQueue[_0x40d0('0xe')]())['then'](realtime[_0x40d0('0xf')]())[_0x40d0('0xa')](chatQueue['getChatQueues']())[_0x40d0('0xa')](realtime[_0x40d0('0x10')]())[_0x40d0('0xa')](smsQueue[_0x40d0('0x11')]())['then'](realtime['initSmsQueues']())[_0x40d0('0xa')](mailQueue['getMailQueues']())[_0x40d0('0xa')](realtime['initMailQueues']())[_0x40d0('0xa')](faxQueue[_0x40d0('0x12')]())[_0x40d0('0xa')](realtime[_0x40d0('0x13')]())[_0x40d0('0xa')](whatsappQueue['getWhatsappQueues']())[_0x40d0('0xa')](realtime[_0x40d0('0x14')]())[_0x40d0('0xa')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x40d0('0xa')](function(_0x2e4f33){return initRealtime();})['then'](function(_0x1fd423){return setInterval(initRealtime,0x1388);})['catch'](function(_0x134632){console[_0x40d0('0x15')](_0x134632);});}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 4c5d75f..4847e85 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x5fc3,0xa8));var _0x35fc=function(_0x21bfab,_0x2fee48){_0x21bfab=_0x21bfab-0x0;var _0x4db318=_0x5fc3[_0x21bfab];return _0x4db318;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file +var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x3699d0,_0x279541){var _0x1fad54=function(_0x3534cc){while(--_0x3534cc){_0x3699d0['push'](_0x3699d0['shift']());}};_0x1fad54(++_0x279541);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xc4aa[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index d729d7e..e1ab859 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 _0xa363=['bluebird','jayson/promise','client','http','request','then','error','message','result','catch','sendMailMessage','SendMail'];(function(_0x50b2ec,_0x1e10f3){var _0x519a11=function(_0x345519){while(--_0x345519){_0x50b2ec['push'](_0x50b2ec['shift']());}};_0x519a11(++_0x1e10f3);}(_0xa363,0x180));var _0x3a36=function(_0x298291,_0x140ada){_0x298291=_0x298291-0x0;var _0x563d83=_0xa363[_0x298291];return _0x563d83;};'use strict';var BPromise=require(_0x3a36('0x0'));var jayson=require(_0x3a36('0x1'));var client=jayson[_0x3a36('0x2')][_0x3a36('0x3')]({'port':0x232b});function request(_0x565486,_0x101b62){return new BPromise(function(_0x19e787,_0x1dda47){return client[_0x3a36('0x4')](_0x565486,_0x101b62)[_0x3a36('0x5')](function(_0x85ef21){if(_0x85ef21[_0x3a36('0x6')]){return _0x1dda47(_0x85ef21[_0x3a36('0x6')][_0x3a36('0x7')]);}else{return _0x19e787(_0x85ef21[_0x3a36('0x8')]);}})[_0x3a36('0x9')](function(_0x2c14fb){return _0x1dda47(_0x2c14fb);});});}exports[_0x3a36('0xa')]=function(_0x51e760,_0xeee82c){return request(_0x3a36('0xb'),{'account':_0x51e760,'message':_0xeee82c});}; \ No newline at end of file +var _0x8f8b=['error','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request'];(function(_0x1ad8d6,_0x54630e){var _0x5e1b06=function(_0x4c71e4){while(--_0x4c71e4){_0x1ad8d6['push'](_0x1ad8d6['shift']());}};_0x5e1b06(++_0x54630e);}(_0x8f8b,0x1c7));var _0xb8f8=function(_0x51f81d,_0xdb9909){_0x51f81d=_0x51f81d-0x0;var _0x3abeeb=_0x8f8b[_0x51f81d];return _0x3abeeb;};'use strict';var BPromise=require(_0xb8f8('0x0'));var jayson=require(_0xb8f8('0x1'));var client=jayson[_0xb8f8('0x2')][_0xb8f8('0x3')]({'port':0x232b});function request(_0x4bb1cb,_0x15a212){return new BPromise(function(_0x38f014,_0x31e4f3){return client[_0xb8f8('0x4')](_0x4bb1cb,_0x15a212)['then'](function(_0x2c4e2d){if(_0x2c4e2d[_0xb8f8('0x5')]){return _0x31e4f3(_0x2c4e2d['error']['message']);}else{return _0x38f014(_0x2c4e2d[_0xb8f8('0x6')]);}})[_0xb8f8('0x7')](function(_0x355dde){return _0x31e4f3(_0x355dde);});});}exports[_0xb8f8('0x8')]=function(_0x238d94,_0x359cfb){return request(_0xb8f8('0x9'),{'account':_0x238d94,'message':_0x359cfb});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 47569f0..688ae08 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 _0x9106=['voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCurrentCapacity','mailStatus','mailStatusTime','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCurrentCapacity','busyQueue','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity','working','idle','chat','openchannel','sms','whatsapp','length','getChannelStatus','Status','StatusTime','toNumber','chatCapacity','mailCapacity','smsStatusTime','openchannelCapacity','busy','user:save','exports','lodash','moment','md5','ioredis','redis','defaults','name','online'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9106,0x6e));var _0x6910=function(_0x401554,_0x34b410){_0x401554=_0x401554-0x0;var _0x5b70e9=_0x9106[_0x401554];return _0x5b70e9;};'use strict';var _=require(_0x6910('0x0'));var moment=require(_0x6910('0x1'));var md5=require(_0x6910('0x2'));var Redis=require(_0x6910('0x3'));var config=require('../../../config/environment');config[_0x6910('0x4')]=_[_0x6910('0x5')](config[_0x6910('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x4c057e){this['id']=_0x4c057e['id']||0x0;this[_0x6910('0x6')]=_0x4c057e['name']||'';this[_0x6910('0x7')]=_0x4c057e['online']||!![];this[_0x6910('0x8')]=_0x4c057e[_0x6910('0x8')]||![];this[_0x6910('0x9')]=_0x4c057e['chatPause']||![];this['mailPause']=_0x4c057e[_0x6910('0xa')]||![];this[_0x6910('0xb')]=_0x4c057e[_0x6910('0xb')]||![];this[_0x6910('0xc')]=_0x4c057e['smsPause']||![];this[_0x6910('0xd')]=_0x4c057e[_0x6910('0xd')]||![];this[_0x6910('0xe')]=_0x6910('0xf');this[_0x6910('0x10')]=0x0;this['chatCapacity']=_0x4c057e['chatCapacity']||0x0;this[_0x6910('0x11')]=0x0;this[_0x6910('0x12')]=_0x6910('0xf');this[_0x6910('0x13')]=0x0;this['mailCapacity']=_0x4c057e['mailCapacity']||0x0;this[_0x6910('0x14')]=0x0;this[_0x6910('0x15')]=_0x6910('0xf');this[_0x6910('0x16')]=0x0;this[_0x6910('0x17')]=_0x4c057e[_0x6910('0x17')]||0x0;this[_0x6910('0x18')]=0x0;this[_0x6910('0x19')]=_0x6910('0xf');this['smsStatusTime']=0x0;this['smsCapacity']=_0x4c057e[_0x6910('0x1a')]||0x0;this[_0x6910('0x1b')]=0x0;this[_0x6910('0x1c')]='unknown';this[_0x6910('0x1d')]=0x0;this[_0x6910('0x1e')]=_0x4c057e['whatsappCapacity']||0x0;this[_0x6910('0x1f')]=0x0;this[_0x6910('0x20')]=_0x6910('0xf');this[_0x6910('0x21')]=0x0;this['openchannelCapacity']=_0x4c057e['openchannelCapacity']||0x0;this[_0x6910('0x22')]=0x0;this['busy']=![];this[_0x6910('0x23')]=undefined;this[_0x6910('0x2')]='';this[_0x6910('0x24')]();}Agent[_0x6910('0x25')]['getChannelStatus']=function(_0x156612){if(this[_0x156612+_0x6910('0x26')]>0x0){if(this[_0x156612+_0x6910('0x27')]>0x0&&this[_0x156612+_0x6910('0x26')]>=this[_0x156612+_0x6910('0x27')]){return _0x6910('0x28');}else{return _0x6910('0x29');}}else{return _0x6910('0x2a');}};Agent[_0x6910('0x25')]['updateRealtime']=function(){var _0x3c46eb=['mail',_0x6910('0x2b'),_0x6910('0x2c'),'fax',_0x6910('0x2d'),_0x6910('0x2e')];for(var _0x1dab5f=0x0;_0x1dab5f<_0x3c46eb[_0x6910('0x2f')];_0x1dab5f+=0x1){var _0x2a2513=this[_0x6910('0x30')](_0x3c46eb[_0x1dab5f]);if(this[_0x3c46eb[_0x1dab5f]+_0x6910('0x31')]!==_0x2a2513){this[_0x3c46eb[_0x1dab5f]+_0x6910('0x32')]=_[_0x6910('0x33')](moment()['format']('x'));}this[_0x3c46eb[_0x1dab5f]+_0x6910('0x31')]=_0x2a2513;}var _0x47223b={'id':this['id'],'name':this[_0x6910('0x6')],'online':this[_0x6910('0x7')],'voicePause':this[_0x6910('0x8')],'chatPause':this[_0x6910('0x9')],'mailPause':this[_0x6910('0xa')],'smsPause':this['smsPause'],'faxPause':this[_0x6910('0xb')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x6910('0xe')],'chatStatusTime':this[_0x6910('0x10')],'chatCapacity':this[_0x6910('0x34')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x6910('0x12')],'mailStatusTime':this[_0x6910('0x13')],'mailCapacity':this[_0x6910('0x35')],'mailCurrentCapacity':this[_0x6910('0x14')],'faxStatus':this[_0x6910('0x15')],'faxStatusTime':this[_0x6910('0x16')],'faxCapacity':this[_0x6910('0x17')],'faxCurrentCapacity':this[_0x6910('0x18')],'smsStatus':this[_0x6910('0x19')],'smsStatusTime':this[_0x6910('0x36')],'smsCapacity':this[_0x6910('0x1a')],'smsCurrentCapacity':this[_0x6910('0x1b')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x6910('0x1d')],'whatsappCapacity':this[_0x6910('0x1e')],'whatsappCurrentCapacity':this[_0x6910('0x1f')],'openchannelStatus':this[_0x6910('0x20')],'openchannelStatusTime':this[_0x6910('0x21')],'openchannelCapacity':this[_0x6910('0x37')],'openchannelCurrentCapacity':this[_0x6910('0x22')],'busy':this[_0x6910('0x38')],'busyQueue':this[_0x6910('0x23')]};var _0x163a45=md5(JSON['stringify'](_0x47223b));if(this[_0x6910('0x2')]!==_0x163a45){this['md5']=_0x163a45;io['emit'](_0x6910('0x39'),_0x47223b);}};module[_0x6910('0x3a')]=Agent; \ No newline at end of file +var _0x28a6=['smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','updateRealtime','prototype','CurrentCapacity','Capacity','working','mail','chat','fax','getChannelStatus','Status','toNumber','format','faxPause','chatStatusTime','mailCurrentCapacity','faxCurrentCapacity','whatsappStatus','whatsappCurrentCapacity','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','defaults','redis','localhost','name','online','voicePause','chatPause','mailPause','smsPause','openchannelPause','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','unknown','faxStatusTime','faxCapacity'];(function(_0x47c9b5,_0x30cf3d){var _0x6580e1=function(_0x52a368){while(--_0x52a368){_0x47c9b5['push'](_0x47c9b5['shift']());}};_0x6580e1(++_0x30cf3d);}(_0x28a6,0x8f));var _0x628a=function(_0x2b1551,_0x1776fe){_0x2b1551=_0x2b1551-0x0;var _0x2fc2a1=_0x28a6[_0x2b1551];return _0x2fc2a1;};'use strict';var _=require(_0x628a('0x0'));var moment=require(_0x628a('0x1'));var md5=require(_0x628a('0x2'));var Redis=require(_0x628a('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x628a('0x4')](config[_0x628a('0x5')],{'host':_0x628a('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x14d67b){this['id']=_0x14d67b['id']||0x0;this[_0x628a('0x7')]=_0x14d67b[_0x628a('0x7')]||'';this[_0x628a('0x8')]=_0x14d67b[_0x628a('0x8')]||!![];this[_0x628a('0x9')]=_0x14d67b['voicePause']||![];this[_0x628a('0xa')]=_0x14d67b[_0x628a('0xa')]||![];this[_0x628a('0xb')]=_0x14d67b['mailPause']||![];this['faxPause']=_0x14d67b['faxPause']||![];this[_0x628a('0xc')]=_0x14d67b[_0x628a('0xc')]||![];this['openchannelPause']=_0x14d67b[_0x628a('0xd')]||![];this['chatStatus']='unknown';this['chatStatusTime']=0x0;this['chatCapacity']=_0x14d67b[_0x628a('0xe')]||0x0;this[_0x628a('0xf')]=0x0;this[_0x628a('0x10')]='unknown';this[_0x628a('0x11')]=0x0;this[_0x628a('0x12')]=_0x14d67b[_0x628a('0x12')]||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']=_0x628a('0x13');this[_0x628a('0x14')]=0x0;this[_0x628a('0x15')]=_0x14d67b[_0x628a('0x15')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x628a('0x16')]=_0x628a('0x13');this[_0x628a('0x17')]=0x0;this['smsCapacity']=_0x14d67b[_0x628a('0x18')]||0x0;this[_0x628a('0x19')]=0x0;this['whatsappStatus']=_0x628a('0x13');this[_0x628a('0x1a')]=0x0;this[_0x628a('0x1b')]=_0x14d67b[_0x628a('0x1b')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x628a('0x1c')]='unknown';this[_0x628a('0x1d')]=0x0;this[_0x628a('0x1e')]=_0x14d67b['openchannelCapacity']||0x0;this[_0x628a('0x1f')]=0x0;this[_0x628a('0x20')]=![];this['busyQueue']=undefined;this[_0x628a('0x2')]='';this[_0x628a('0x21')]();}Agent[_0x628a('0x22')]['getChannelStatus']=function(_0x5a4963){if(this[_0x5a4963+_0x628a('0x23')]>0x0){if(this[_0x5a4963+_0x628a('0x24')]>0x0&&this[_0x5a4963+_0x628a('0x23')]>=this[_0x5a4963+_0x628a('0x24')]){return'maxcapacity';}else{return _0x628a('0x25');}}else{return'idle';}};Agent[_0x628a('0x22')][_0x628a('0x21')]=function(){var _0x1ff184=[_0x628a('0x26'),_0x628a('0x27'),'openchannel',_0x628a('0x28'),'sms','whatsapp'];for(var _0x276634=0x0;_0x276634<_0x1ff184['length'];_0x276634+=0x1){var _0x5ca1e0=this[_0x628a('0x29')](_0x1ff184[_0x276634]);if(this[_0x1ff184[_0x276634]+_0x628a('0x2a')]!==_0x5ca1e0){this[_0x1ff184[_0x276634]+'StatusTime']=_[_0x628a('0x2b')](moment()[_0x628a('0x2c')]('x'));}this[_0x1ff184[_0x276634]+_0x628a('0x2a')]=_0x5ca1e0;}var _0xc02d1a={'id':this['id'],'name':this['name'],'online':this[_0x628a('0x8')],'voicePause':this[_0x628a('0x9')],'chatPause':this[_0x628a('0xa')],'mailPause':this[_0x628a('0xb')],'smsPause':this[_0x628a('0xc')],'faxPause':this[_0x628a('0x2d')],'openchannelPause':this[_0x628a('0xd')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x628a('0x2e')],'chatCapacity':this[_0x628a('0xe')],'chatCurrentCapacity':this[_0x628a('0xf')],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x628a('0x12')],'mailCurrentCapacity':this[_0x628a('0x2f')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x628a('0x14')],'faxCapacity':this[_0x628a('0x15')],'faxCurrentCapacity':this[_0x628a('0x30')],'smsStatus':this[_0x628a('0x16')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x628a('0x19')],'whatsappStatus':this[_0x628a('0x31')],'whatsappStatusTime':this[_0x628a('0x1a')],'whatsappCapacity':this[_0x628a('0x1b')],'whatsappCurrentCapacity':this[_0x628a('0x32')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x628a('0x1d')],'openchannelCapacity':this[_0x628a('0x1e')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x628a('0x20')],'busyQueue':this['busyQueue']};var _0x170039=md5(JSON[_0x628a('0x33')](_0xc02d1a));if(this[_0x628a('0x2')]!==_0x170039){this['md5']=_0x170039;io[_0x628a('0x34')](_0x628a('0x35'),_0xc02d1a);}};module[_0x628a('0x36')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index d6fc0d9..a793e92 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 _0x4597=['_rr','mapAgentsId','map','loggedIn','length','online','chatPause','available','paused','waiting','stringify','format','chat:queue:%s','emit','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRouting','updateRealtime','prototype'];(function(_0x1aa13e,_0x12a40b){var _0x1144bd=function(_0x5f5cae){while(--_0x5f5cae){_0x1aa13e['push'](_0x1aa13e['shift']());}};_0x1144bd(++_0x12a40b);}(_0x4597,0xc9));var _0x7459=function(_0x5082f5,_0x166c02){_0x5082f5=_0x5082f5-0x0;var _0x556d9b=_0x4597[_0x5082f5];return _0x556d9b;};'use strict';var _=require('lodash');var md5=require(_0x7459('0x0'));var util=require(_0x7459('0x1'));var Redis=require(_0x7459('0x2'));var config=require(_0x7459('0x3'));config[_0x7459('0x4')]=_[_0x7459('0x5')](config[_0x7459('0x4')],{'host':_0x7459('0x6'),'port':0x18eb});var io=require(_0x7459('0x7'))(new Redis(config['redis']));function ChatQueue(_0x78df71){this['id']=_0x78df71['id']||0x0;this[_0x7459('0x8')]=_0x78df71[_0x7459('0x8')]||'';this['timeout']=_0x78df71[_0x7459('0x9')]||0xa;this['strategy']=_0x78df71[_0x7459('0xa')]||_0x7459('0xb');this['Agents']=_0x78df71[_0x7459('0xc')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x7459('0x0')]='';this[_0x7459('0xd')]();this[_0x7459('0xe')]();}ChatQueue[_0x7459('0xf')][_0x7459('0xd')]=function(){var _0x388f57=this['mapAgentsId'][_0x7459('0x10')];this[_0x7459('0x11')]=_[_0x7459('0x12')](this[_0x7459('0xc')],'id');this[_0x7459('0x11')][_0x7459('0x10')]=_0x388f57;};ChatQueue[_0x7459('0xf')][_0x7459('0xe')]=function(){this[_0x7459('0x13')]=0x0;this['paused']=0x0;for(var _0x53befb=0x0;_0x53befb=0x0?this[_0x7459('0x17')]:0x0;var _0x307b63={'id':this['id'],'available':this[_0x7459('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x7459('0x8')],'paused':this['paused'],'waiting':this[_0x7459('0x19')]};var _0x3d9da5=md5(JSON[_0x7459('0x1a')](_0x307b63));if(this[_0x7459('0x0')]!==_0x3d9da5){this['md5']=_0x3d9da5;io['to'](util[_0x7459('0x1b')](_0x7459('0x1c'),_0x307b63[_0x7459('0x8')]))[_0x7459('0x1d')]('chat_queue:save',_0x307b63);}};module[_0x7459('0x1e')]=ChatQueue; \ No newline at end of file +var _0x0413=['md5','ioredis','redis','defaults','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','paused','online','available','loggedIn','stringify','chat:queue:%s','name','emit','exports','lodash'];(function(_0x383b24,_0x3638f7){var _0x31a2c8=function(_0x1da0fa){while(--_0x1da0fa){_0x383b24['push'](_0x383b24['shift']());}};_0x31a2c8(++_0x3638f7);}(_0x0413,0x1f3));var _0x3041=function(_0xd2bbaf,_0x246a1b){_0xd2bbaf=_0xd2bbaf-0x0;var _0x17e278=_0x0413[_0xd2bbaf];return _0x17e278;};'use strict';var _=require(_0x3041('0x0'));var md5=require(_0x3041('0x1'));var util=require('util');var Redis=require(_0x3041('0x2'));var config=require('../../../config/environment');config[_0x3041('0x3')]=_[_0x3041('0x4')](config['redis'],{'host':_0x3041('0x5'),'port':0x18eb});var io=require(_0x3041('0x6'))(new Redis(config[_0x3041('0x3')]));function ChatQueue(_0x39997e){this['id']=_0x39997e['id']||0x0;this['name']=_0x39997e['name']||'';this[_0x3041('0x7')]=_0x39997e['timeout']||0xa;this[_0x3041('0x8')]=_0x39997e[_0x3041('0x8')]||_0x3041('0x9');this[_0x3041('0xa')]=_0x39997e['Agents'];this[_0x3041('0xb')]={};this[_0x3041('0xc')]=0x0;this[_0x3041('0x1')]='';this[_0x3041('0xd')]();this[_0x3041('0xe')]();}ChatQueue[_0x3041('0xf')][_0x3041('0xd')]=function(){var _0x47980e=this[_0x3041('0xb')]['_rr'];this[_0x3041('0xb')]=_['map'](this[_0x3041('0xa')],'id');this[_0x3041('0xb')]['_rr']=_0x47980e;};ChatQueue['prototype'][_0x3041('0xe')]=function(){this['loggedIn']=0x0;this[_0x3041('0x10')]=0x0;for(var _0x3cbd3a=0x0;_0x3cbd3a=0x0?this[_0x3041('0x12')]:0x0;var _0x5ca04b={'id':this['id'],'available':this['available'],'loggedIn':this[_0x3041('0x13')],'name':this['name'],'paused':this[_0x3041('0x10')],'waiting':this[_0x3041('0xc')]};var _0x456cd0=md5(JSON[_0x3041('0x14')](_0x5ca04b));if(this[_0x3041('0x1')]!==_0x456cd0){this[_0x3041('0x1')]=_0x456cd0;io['to'](util['format'](_0x3041('0x15'),_0x5ca04b[_0x3041('0x16')]))[_0x3041('0x17')]('chat_queue:save',_0x5ca04b);}};module[_0x3041('0x18')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 1e277cc..08da8c3 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 _0x486a=['loggedIn','faxPause','available','stringify','format','fax:queue:%s','fax_queue:save','lodash','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','paused','online'];(function(_0x419534,_0x1d8d69){var _0x6a6434=function(_0x445013){while(--_0x445013){_0x419534['push'](_0x419534['shift']());}};_0x6a6434(++_0x1d8d69);}(_0x486a,0x1c1));var _0xa486=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0x486a[_0x1db251];return _0x56685a;};'use strict';var _=require(_0xa486('0x0'));var md5=require(_0xa486('0x1'));var util=require('util');var Redis=require(_0xa486('0x2'));var config=require('../../../config/environment');config[_0xa486('0x3')]=_[_0xa486('0x4')](config[_0xa486('0x3')],{'host':_0xa486('0x5'),'port':0x18eb});var io=require(_0xa486('0x6'))(new Redis(config[_0xa486('0x3')]));function FaxQueue(_0x47e04e){this['id']=_0x47e04e['id']||0x0;this['name']=_0x47e04e[_0xa486('0x7')]||'';this[_0xa486('0x8')]=_0x47e04e[_0xa486('0x8')]||0xa;this[_0xa486('0x9')]=_0x47e04e['strategy']||'beepall';this[_0xa486('0xa')]=_0x47e04e[_0xa486('0xa')];this[_0xa486('0xb')]={};this[_0xa486('0xc')]=0x0;this[_0xa486('0x1')]='';this[_0xa486('0xd')]();this[_0xa486('0xe')]();}FaxQueue[_0xa486('0xf')][_0xa486('0xd')]=function(){var _0x162dd9=this[_0xa486('0xb')]['_rr'];this[_0xa486('0xb')]=_['map'](this['Agents'],'id');this[_0xa486('0xb')][_0xa486('0x10')]=_0x162dd9;};FaxQueue[_0xa486('0xf')][_0xa486('0xe')]=function(){this['loggedIn']=0x0;this[_0xa486('0x11')]=0x0;for(var _0x388744=0x0;_0x388744=0x0?this[_0xa486('0x15')]:0x0;var _0x1c6b8c={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xa486('0xc')]};var _0x35ca73=md5(JSON[_0xa486('0x16')](_0x1c6b8c));if(this[_0xa486('0x1')]!==_0x35ca73){this[_0xa486('0x1')]=_0x35ca73;io['to'](util[_0xa486('0x17')](_0xa486('0x18'),_0x1c6b8c[_0xa486('0x7')]))['emit'](_0xa486('0x19'),_0x1c6b8c);}};module['exports']=FaxQueue; \ No newline at end of file +var _0x8258=['length','online','available','loggedIn','waiting','stringify','format','fax:queue:%s','emit','fax_queue:save','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','updateRealtime','prototype','updateRouting','paused'];(function(_0x28515d,_0x38223b){var _0x346235=function(_0x914b80){while(--_0x914b80){_0x28515d['push'](_0x28515d['shift']());}};_0x346235(++_0x38223b);}(_0x8258,0xa6));var _0x8825=function(_0xbfb6e7,_0x5d4aed){_0xbfb6e7=_0xbfb6e7-0x0;var _0x106a74=_0x8258[_0xbfb6e7];return _0x106a74;};'use strict';var _=require('lodash');var md5=require(_0x8825('0x0'));var util=require(_0x8825('0x1'));var Redis=require(_0x8825('0x2'));var config=require('../../../config/environment');config[_0x8825('0x3')]=_[_0x8825('0x4')](config[_0x8825('0x3')],{'host':_0x8825('0x5'),'port':0x18eb});var io=require(_0x8825('0x6'))(new Redis(config[_0x8825('0x3')]));function FaxQueue(_0x5640d1){this['id']=_0x5640d1['id']||0x0;this[_0x8825('0x7')]=_0x5640d1['name']||'';this['timeout']=_0x5640d1[_0x8825('0x8')]||0xa;this[_0x8825('0x9')]=_0x5640d1['strategy']||_0x8825('0xa');this['Agents']=_0x5640d1['Agents'];this[_0x8825('0xb')]={};this['waiting']=0x0;this[_0x8825('0x0')]='';this['updateRouting']();this[_0x8825('0xc')]();}FaxQueue[_0x8825('0xd')][_0x8825('0xe')]=function(){var _0x52dcea=this[_0x8825('0xb')]['_rr'];this[_0x8825('0xb')]=_['map'](this['Agents'],'id');this[_0x8825('0xb')]['_rr']=_0x52dcea;};FaxQueue['prototype'][_0x8825('0xc')]=function(){this['loggedIn']=0x0;this[_0x8825('0xf')]=0x0;for(var _0x152eaa=0x0;_0x152eaa=0x0?this['available']:0x0;var _0x2fa679={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x8825('0x7')],'paused':this[_0x8825('0xf')],'waiting':this[_0x8825('0x14')]};var _0x48d4ba=md5(JSON[_0x8825('0x15')](_0x2fa679));if(this[_0x8825('0x0')]!==_0x48d4ba){this[_0x8825('0x0')]=_0x48d4ba;io['to'](util[_0x8825('0x16')](_0x8825('0x17'),_0x2fa679[_0x8825('0x7')]))[_0x8825('0x18')](_0x8825('0x19'),_0x2fa679);}};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 1eb4edb..a741252 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 _0xab54=['name','exports'];(function(_0x27926c,_0x37d579){var _0x584578=function(_0x32e167){while(--_0x32e167){_0x27926c['push'](_0x27926c['shift']());}};_0x584578(++_0x37d579);}(_0xab54,0x164));var _0x4ab5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xab54[_0x14add3];return _0x4a174f;};'use strict';function Interval(_0x3c8554){this['id']=_0x3c8554['id']||0x0;this['name']=_0x3c8554[_0x4ab5('0x0')]||'';this['Intervals']=_0x3c8554['Intervals']||{};}module[_0x4ab5('0x1')]=Interval; \ No newline at end of file +var _0x4e4d=['exports','name','Intervals'];(function(_0x173c92,_0x1215b7){var _0x5b1687=function(_0x7ffc17){while(--_0x7ffc17){_0x173c92['push'](_0x173c92['shift']());}};_0x5b1687(++_0x1215b7);}(_0x4e4d,0xdf));var _0xd4e4=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0x4e4d[_0x11a220];return _0x20d8fe;};'use strict';function Interval(_0x1c232f){this['id']=_0x1c232f['id']||0x0;this['name']=_0x1c232f[_0xd4e4('0x0')]||'';this[_0xd4e4('0x1')]=_0x1c232f['Intervals']||{};}module[_0xd4e4('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 06cd53b..4a27b19 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 _0xaf00=['localhost','name','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','_rr','map','prototype','loggedIn','length','online','mailPause','paused','available','stringify','format','mail:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults'];(function(_0x39a4d7,_0x457d38){var _0x7477fd=function(_0x143855){while(--_0x143855){_0x39a4d7['push'](_0x39a4d7['shift']());}};_0x7477fd(++_0x457d38);}(_0xaf00,0x17f));var _0x0af0=function(_0x5275b8,_0x51e5dd){_0x5275b8=_0x5275b8-0x0;var _0x568a9b=_0xaf00[_0x5275b8];return _0x568a9b;};'use strict';var _=require(_0x0af0('0x0'));var md5=require(_0x0af0('0x1'));var util=require(_0x0af0('0x2'));var Redis=require(_0x0af0('0x3'));var config=require(_0x0af0('0x4'));config[_0x0af0('0x5')]=_[_0x0af0('0x6')](config[_0x0af0('0x5')],{'host':_0x0af0('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0x5c30dc){this['id']=_0x5c30dc['id']||0x0;this['name']=_0x5c30dc[_0x0af0('0x8')]||'';this['timeout']=_0x5c30dc['timeout']||0xa;this[_0x0af0('0x9')]=_0x5c30dc[_0x0af0('0x9')]||_0x0af0('0xa');this[_0x0af0('0xb')]=_0x5c30dc['Agents'];this['mapAgentsId']={};this[_0x0af0('0xc')]=0x0;this[_0x0af0('0x1')]='';this[_0x0af0('0xd')]();this[_0x0af0('0xe')]();}MailQueue['prototype']['updateRouting']=function(){var _0x325f2a=this[_0x0af0('0xf')][_0x0af0('0x10')];this[_0x0af0('0xf')]=_[_0x0af0('0x11')](this[_0x0af0('0xb')],'id');this[_0x0af0('0xf')]['_rr']=_0x325f2a;};MailQueue[_0x0af0('0x12')][_0x0af0('0xe')]=function(){this[_0x0af0('0x13')]=0x0;this['paused']=0x0;for(var _0x41a672=0x0;_0x41a672=0x0?this[_0x0af0('0x18')]:0x0;var _0x4ddc41={'id':this['id'],'available':this[_0x0af0('0x18')],'loggedIn':this[_0x0af0('0x13')],'name':this[_0x0af0('0x8')],'paused':this[_0x0af0('0x17')],'waiting':this[_0x0af0('0xc')]};var _0x410535=md5(JSON[_0x0af0('0x19')](_0x4ddc41));if(this[_0x0af0('0x1')]!==_0x410535){this['md5']=_0x410535;io['to'](util[_0x0af0('0x1a')](_0x0af0('0x1b'),_0x4ddc41[_0x0af0('0x8')]))[_0x0af0('0x1c')]('mail_queue:save',_0x4ddc41);}};module[_0x0af0('0x1d')]=MailQueue; \ No newline at end of file +var _0x0e61=['beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','updateRealtime','paused','length','online','loggedIn','mailPause','available','stringify','exports','lodash','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x316f1c,_0x2254c0){var _0x341a49=function(_0x4e1c51){while(--_0x4e1c51){_0x316f1c['push'](_0x316f1c['shift']());}};_0x341a49(++_0x2254c0);}(_0x0e61,0x1ca));var _0x10e6=function(_0x147497,_0x43e433){_0x147497=_0x147497-0x0;var _0x35f45=_0x0e61[_0x147497];return _0x35f45;};'use strict';var _=require(_0x10e6('0x0'));var md5=require(_0x10e6('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x10e6('0x2'));config[_0x10e6('0x3')]=_[_0x10e6('0x4')](config[_0x10e6('0x3')],{'host':_0x10e6('0x5'),'port':0x18eb});var io=require(_0x10e6('0x6'))(new Redis(config['redis']));function MailQueue(_0xa3b56f){this['id']=_0xa3b56f['id']||0x0;this[_0x10e6('0x7')]=_0xa3b56f[_0x10e6('0x7')]||'';this['timeout']=_0xa3b56f[_0x10e6('0x8')]||0xa;this[_0x10e6('0x9')]=_0xa3b56f[_0x10e6('0x9')]||_0x10e6('0xa');this[_0x10e6('0xb')]=_0xa3b56f['Agents'];this[_0x10e6('0xc')]={};this[_0x10e6('0xd')]=0x0;this[_0x10e6('0x1')]='';this[_0x10e6('0xe')]();this['updateRealtime']();}MailQueue[_0x10e6('0xf')]['updateRouting']=function(){var _0x4328dd=this['mapAgentsId'][_0x10e6('0x10')];this[_0x10e6('0xc')]=_['map'](this[_0x10e6('0xb')],'id');this['mapAgentsId'][_0x10e6('0x10')]=_0x4328dd;};MailQueue['prototype'][_0x10e6('0x11')]=function(){this['loggedIn']=0x0;this[_0x10e6('0x12')]=0x0;for(var _0x1f42db=0x0;_0x1f42db=0x0?this[_0x10e6('0x17')]:0x0;var _0x539d8d={'id':this['id'],'available':this[_0x10e6('0x17')],'loggedIn':this[_0x10e6('0x15')],'name':this[_0x10e6('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x4f3e61=md5(JSON[_0x10e6('0x18')](_0x539d8d));if(this[_0x10e6('0x1')]!==_0x4f3e61){this[_0x10e6('0x1')]=_0x4f3e61;io['to'](util['format']('mail:queue:%s',_0x539d8d[_0x10e6('0x7')]))['emit']('mail_queue:save',_0x539d8d);}};module[_0x10e6('0x19')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index e1e7a64..a6a1be7 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x7a54,0x106));var _0x47a5=function(_0xd11f5e,_0x1c37d0){_0xd11f5e=_0xd11f5e-0x0;var _0x1f743d=_0x7a54[_0xd11f5e];return _0x1f743d;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x5beeeb,_0x1e93f8){var _0x595f77=function(_0x281a87){while(--_0x281a87){_0x5beeeb['push'](_0x5beeeb['shift']());}};_0x595f77(++_0x1e93f8);}(_0x5fc3,0xa8));var _0x35fc=function(_0xb4cc12,_0x41436e){_0xb4cc12=_0xb4cc12-0x0;var _0x8593b5=_0x5fc3[_0xb4cc12];return _0x8593b5;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index bb525a7..588d602 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 _0xa75b=['stringify','format','sms:queue:%s','sms_queue:save','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','md5','updateRouting','updateRealtime','prototype','_rr','map','Agents','paused','length','online','loggedIn','smsPause','available'];(function(_0x398ed7,_0x281abf){var _0x21a953=function(_0x17d170){while(--_0x17d170){_0x398ed7['push'](_0x398ed7['shift']());}};_0x21a953(++_0x281abf);}(_0xa75b,0x170));var _0xba75=function(_0x55cd4b,_0x30be25){_0x55cd4b=_0x55cd4b-0x0;var _0x474099=_0xa75b[_0x55cd4b];return _0x474099;};'use strict';var _=require(_0xba75('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xba75('0x1'));var config=require(_0xba75('0x2'));config[_0xba75('0x3')]=_[_0xba75('0x4')](config[_0xba75('0x3')],{'host':_0xba75('0x5'),'port':0x18eb});var io=require(_0xba75('0x6'))(new Redis(config[_0xba75('0x3')]));function SmsQueue(_0x32a1e9){this['id']=_0x32a1e9['id']||0x0;this[_0xba75('0x7')]=_0x32a1e9[_0xba75('0x7')]||'';this[_0xba75('0x8')]=_0x32a1e9[_0xba75('0x8')]||0xa;this['strategy']=_0x32a1e9['strategy']||_0xba75('0x9');this['Agents']=_0x32a1e9['Agents'];this[_0xba75('0xa')]={};this['waiting']=0x0;this[_0xba75('0xb')]='';this[_0xba75('0xc')]();this[_0xba75('0xd')]();}SmsQueue[_0xba75('0xe')][_0xba75('0xc')]=function(){var _0xc50bda=this[_0xba75('0xa')][_0xba75('0xf')];this[_0xba75('0xa')]=_[_0xba75('0x10')](this[_0xba75('0x11')],'id');this[_0xba75('0xa')]['_rr']=_0xc50bda;};SmsQueue['prototype'][_0xba75('0xd')]=function(){this['loggedIn']=0x0;this[_0xba75('0x12')]=0x0;for(var _0x2df615=0x0;_0x2df615=0x0?this[_0xba75('0x17')]:0x0;var _0xd8850f={'id':this['id'],'available':this[_0xba75('0x17')],'loggedIn':this[_0xba75('0x15')],'name':this[_0xba75('0x7')],'paused':this[_0xba75('0x12')],'waiting':this['waiting']};var _0x23c2ec=md5(JSON[_0xba75('0x18')](_0xd8850f));if(this['md5']!==_0x23c2ec){this['md5']=_0x23c2ec;io['to'](util[_0xba75('0x19')](_0xba75('0x1a'),_0xd8850f['name']))['emit'](_0xba75('0x1b'),_0xd8850f);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x6f7f=['../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','prototype','updateRouting','mapAgentsId','_rr','updateRealtime','length','online','loggedIn','smsPause','paused','available','stringify','format','sms:queue:%s','sms_queue:save','md5','util','ioredis'];(function(_0x16b334,_0x58bd7f){var _0x54aff2=function(_0x366b0e){while(--_0x366b0e){_0x16b334['push'](_0x16b334['shift']());}};_0x54aff2(++_0x58bd7f);}(_0x6f7f,0x177));var _0xf6f7=function(_0x301d11,_0x1c57e6){_0x301d11=_0x301d11-0x0;var _0x35100d=_0x6f7f[_0x301d11];return _0x35100d;};'use strict';var _=require('lodash');var md5=require(_0xf6f7('0x0'));var util=require(_0xf6f7('0x1'));var Redis=require(_0xf6f7('0x2'));var config=require(_0xf6f7('0x3'));config[_0xf6f7('0x4')]=_['defaults'](config[_0xf6f7('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xf6f7('0x5'))(new Redis(config[_0xf6f7('0x4')]));function SmsQueue(_0x437847){this['id']=_0x437847['id']||0x0;this['name']=_0x437847[_0xf6f7('0x6')]||'';this['timeout']=_0x437847[_0xf6f7('0x7')]||0xa;this[_0xf6f7('0x8')]=_0x437847[_0xf6f7('0x8')]||_0xf6f7('0x9');this[_0xf6f7('0xa')]=_0x437847[_0xf6f7('0xa')];this['mapAgentsId']={};this[_0xf6f7('0xb')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0xf6f7('0xc')][_0xf6f7('0xd')]=function(){var _0x32e3dd=this[_0xf6f7('0xe')][_0xf6f7('0xf')];this[_0xf6f7('0xe')]=_['map'](this['Agents'],'id');this[_0xf6f7('0xe')][_0xf6f7('0xf')]=_0x32e3dd;};SmsQueue[_0xf6f7('0xc')][_0xf6f7('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0xc4fe52=0x0;_0xc4fe52=0x0?this[_0xf6f7('0x16')]:0x0;var _0xc23839={'id':this['id'],'available':this[_0xf6f7('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xf6f7('0x6')],'paused':this[_0xf6f7('0x15')],'waiting':this['waiting']};var _0x1a7ba2=md5(JSON[_0xf6f7('0x17')](_0xc23839));if(this[_0xf6f7('0x0')]!==_0x1a7ba2){this[_0xf6f7('0x0')]=_0x1a7ba2;io['to'](util[_0xf6f7('0x18')](_0xf6f7('0x19'),_0xc23839[_0xf6f7('0x6')]))['emit'](_0xf6f7('0x1a'),_0xc23839);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 4aca1d8..fed8791 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 _0xaece=['_rr','map','prototype','updateRealtime','loggedIn','length','paused','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting'];(function(_0x1a4f51,_0x2035fc){var _0x19cef5=function(_0x3b532b){while(--_0x3b532b){_0x1a4f51['push'](_0x1a4f51['shift']());}};_0x19cef5(++_0x2035fc);}(_0xaece,0xc2));var _0xeaec=function(_0x575c96,_0xe653de){_0x575c96=_0x575c96-0x0;var _0x460214=_0xaece[_0x575c96];return _0x460214;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xeaec('0x0'));var Redis=require(_0xeaec('0x1'));var config=require(_0xeaec('0x2'));config[_0xeaec('0x3')]=_[_0xeaec('0x4')](config[_0xeaec('0x3')],{'host':_0xeaec('0x5'),'port':0x18eb});var io=require(_0xeaec('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x4d12a2){this['id']=_0x4d12a2['id']||0x0;this[_0xeaec('0x7')]=_0x4d12a2['name']||'';this[_0xeaec('0x8')]=_0x4d12a2[_0xeaec('0x8')]||0xa;this[_0xeaec('0x9')]=_0x4d12a2[_0xeaec('0x9')]||_0xeaec('0xa');this[_0xeaec('0xb')]=_0x4d12a2[_0xeaec('0xb')];this[_0xeaec('0xc')]={};this[_0xeaec('0xd')]=0x0;this[_0xeaec('0xe')]='';this[_0xeaec('0xf')]();this['updateRealtime']();}WhatsappQueue['prototype'][_0xeaec('0xf')]=function(){var _0x30f6ff=this['mapAgentsId'][_0xeaec('0x10')];this['mapAgentsId']=_[_0xeaec('0x11')](this[_0xeaec('0xb')],'id');this[_0xeaec('0xc')][_0xeaec('0x10')]=_0x30f6ff;};WhatsappQueue[_0xeaec('0x12')][_0xeaec('0x13')]=function(){this[_0xeaec('0x14')]=0x0;this['paused']=0x0;for(var _0x36d3aa=0x0;_0x36d3aa=0x0?this[_0xeaec('0x17')]:0x0;var _0x261653={'id':this['id'],'available':this['available'],'loggedIn':this[_0xeaec('0x14')],'name':this[_0xeaec('0x7')],'paused':this[_0xeaec('0x16')],'waiting':this['waiting']};var _0x5e7244=md5(JSON[_0xeaec('0x18')](_0x261653));if(this[_0xeaec('0xe')]!==_0x5e7244){this[_0xeaec('0xe')]=_0x5e7244;io['to'](util[_0xeaec('0x19')](_0xeaec('0x1a'),_0x261653[_0xeaec('0x7')]))[_0xeaec('0x1b')](_0xeaec('0x1c'),_0x261653);}};module[_0xeaec('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0x7ea4=['../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','length','online','available','paused','waiting','stringify','format','whatsapp:queue:%s','exports','lodash','md5','util','ioredis'];(function(_0x1d94b7,_0x5988e5){var _0x40a258=function(_0x3da766){while(--_0x3da766){_0x1d94b7['push'](_0x1d94b7['shift']());}};_0x40a258(++_0x5988e5);}(_0x7ea4,0x1cc));var _0x47ea=function(_0x418549,_0x11b13d){_0x418549=_0x418549-0x0;var _0x288826=_0x7ea4[_0x418549];return _0x288826;};'use strict';var _=require(_0x47ea('0x0'));var md5=require(_0x47ea('0x1'));var util=require(_0x47ea('0x2'));var Redis=require(_0x47ea('0x3'));var config=require(_0x47ea('0x4'));config[_0x47ea('0x5')]=_[_0x47ea('0x6')](config[_0x47ea('0x5')],{'host':_0x47ea('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x47ea('0x5')]));function WhatsappQueue(_0x1cdb9d){this['id']=_0x1cdb9d['id']||0x0;this[_0x47ea('0x8')]=_0x1cdb9d[_0x47ea('0x8')]||'';this[_0x47ea('0x9')]=_0x1cdb9d[_0x47ea('0x9')]||0xa;this['strategy']=_0x1cdb9d[_0x47ea('0xa')]||_0x47ea('0xb');this[_0x47ea('0xc')]=_0x1cdb9d['Agents'];this[_0x47ea('0xd')]={};this['waiting']=0x0;this[_0x47ea('0x1')]='';this[_0x47ea('0xe')]();this['updateRealtime']();}WhatsappQueue[_0x47ea('0xf')][_0x47ea('0xe')]=function(){var _0x462e24=this[_0x47ea('0xd')][_0x47ea('0x10')];this[_0x47ea('0xd')]=_[_0x47ea('0x11')](this[_0x47ea('0xc')],'id');this[_0x47ea('0xd')]['_rr']=_0x462e24;};WhatsappQueue[_0x47ea('0xf')][_0x47ea('0x12')]=function(){this[_0x47ea('0x13')]=0x0;this['paused']=0x0;for(var _0x169602=0x0;_0x169602=0x0?this['available']:0x0;var _0x5c24ca={'id':this['id'],'available':this[_0x47ea('0x16')],'loggedIn':this[_0x47ea('0x13')],'name':this[_0x47ea('0x8')],'paused':this[_0x47ea('0x17')],'waiting':this[_0x47ea('0x18')]};var _0x4eecec=md5(JSON[_0x47ea('0x19')](_0x5c24ca));if(this[_0x47ea('0x1')]!==_0x4eecec){this[_0x47ea('0x1')]=_0x4eecec;io['to'](util[_0x47ea('0x1a')](_0x47ea('0x1b'),_0x5c24ca['name']))['emit']('whatsapp_queue:save',_0x5c24ca);}};module[_0x47ea('0x1c')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 9449506..0e3b7d7 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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(_0x3875d2,_0x5a51b8){var _0x376127=function(_0x522ca9){while(--_0x522ca9){_0x3875d2['push'](_0x3875d2['shift']());}};_0x376127(++_0x5a51b8);}(_0xb10b,0x12a));var _0xbb10=function(_0x530151,_0x27ab6d){_0x530151=_0x530151-0x0;var _0x129774=_0xb10b[_0x530151];return _0x129774;};'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 8cc174c..f1bf4ec 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 _0xe4b4=['AddTagsToChatInteraction','addTagsToChatInteraction','update','Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x2e83bc,_0xe5b79f){var _0x56ca94=function(_0x4cbd38){while(--_0x4cbd38){_0x2e83bc['push'](_0x2e83bc['shift']());}};_0x56ca94(++_0xe5b79f);}(_0xe4b4,0x159));var _0x4e4b=function(_0x323590,_0x3211db){_0x323590=_0x323590-0x0;var _0x246383=_0xe4b4[_0x323590];return _0x246383;};'use strict';var client=require('../client');exports[_0x4e4b('0x0')]=function(_0x26218c,_0xac9525){return client[_0x4e4b('0x1')](_0x4e4b('0x2'),{'body':_0xac9525,'options':{'where':{'id':_0x26218c}},'log':_0x4e4b('0x3')});};exports[_0x4e4b('0x4')]=function(_0x444d54,_0x4bc656){return client[_0x4e4b('0x1')](_0x4e4b('0x5'),{'body':_0x4bc656,'options':{'where':{'id':_0x444d54}},'log':_0x4e4b('0x6')});}; \ No newline at end of file +var _0x8132=['addTags','Request','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','UpdateChatInteraction','updateChatInteraction'];(function(_0x216e72,_0x5cd161){var _0x2ff28d=function(_0x29a533){while(--_0x29a533){_0x216e72['push'](_0x216e72['shift']());}};_0x2ff28d(++_0x5cd161);}(_0x8132,0x94));var _0x2813=function(_0x4d69f5,_0x4eb69e){_0x4d69f5=_0x4d69f5-0x0;var _0x5ad920=_0x8132[_0x4d69f5];return _0x5ad920;};'use strict';var client=require(_0x2813('0x0'));exports[_0x2813('0x1')]=function(_0x57e134,_0xa87491){return client['Request'](_0x2813('0x2'),{'body':_0xa87491,'options':{'where':{'id':_0x57e134}},'log':_0x2813('0x3')});};exports[_0x2813('0x4')]=function(_0x46a854,_0xadfb76){return client[_0x2813('0x5')](_0x2813('0x6'),{'body':_0xadfb76,'options':{'where':{'id':_0x46a854}},'log':_0x2813('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index c5a81ee..27b15d3 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 _0xcba6=['createChatMessage','../client','create'];(function(_0x20410e,_0x11ea83){var _0x18e1cc=function(_0x58a0f0){while(--_0x58a0f0){_0x20410e['push'](_0x20410e['shift']());}};_0x18e1cc(++_0x11ea83);}(_0xcba6,0x6a));var _0x6cba=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xcba6[_0x502c7d];return _0x30b7ed;};'use strict';var client=require(_0x6cba('0x0'));exports[_0x6cba('0x1')]=function(_0x458bac){return client['Request']('CreateChatMessage',{'body':_0x458bac,'log':_0x6cba('0x2')});}; \ No newline at end of file +var _0xdab2=['Request','CreateChatMessage','createChatMessage','../client','create'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xdab2,0x166));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x2dab('0x0'));exports[_0x2dab('0x1')]=function(_0x849553){return client[_0x2dab('0x2')](_0x2dab('0x3'),{'body':_0x849553,'log':_0x2dab('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index b444067..d63f153 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 _0xc43c=['Request','GetChatQueue','name','timeout','User','Agents','online','chatPause','../client','getChatQueues'];(function(_0xb98825,_0x554182){var _0x451d90=function(_0x1e2b76){while(--_0x1e2b76){_0xb98825['push'](_0xb98825['shift']());}};_0x451d90(++_0x554182);}(_0xc43c,0x152));var _0xcc43=function(_0x21cc3c,_0x446763){_0x21cc3c=_0x21cc3c-0x0;var _0xf4447e=_0xc43c[_0x21cc3c];return _0xf4447e;};'use strict';var client=require(_0xcc43('0x0'));exports[_0xcc43('0x1')]=function(){return function(){return client[_0xcc43('0x2')](_0xcc43('0x3'),{'options':{'raw':![],'attributes':['id',_0xcc43('0x4'),_0xcc43('0x5'),'strategy'],'include':[{'model':_0xcc43('0x6'),'as':_0xcc43('0x7'),'attributes':['id','name',_0xcc43('0x8'),_0xcc43('0x9')]}]},'log':_0xcc43('0x1')});};}; \ No newline at end of file +var _0xd8af=['GetChatQueue','name','strategy','Agents','online','../client','getChatQueues','Request'];(function(_0x52de28,_0xe58d3){var _0x498e9c=function(_0x4eb768){while(--_0x4eb768){_0x52de28['push'](_0x52de28['shift']());}};_0x498e9c(++_0xe58d3);}(_0xd8af,0x18d));var _0xfd8a=function(_0x166afb,_0x2c7a42){_0x166afb=_0x166afb-0x0;var _0x511c34=_0xd8af[_0x166afb];return _0x511c34;};'use strict';var client=require(_0xfd8a('0x0'));exports[_0xfd8a('0x1')]=function(){return function(){return client[_0xfd8a('0x2')](_0xfd8a('0x3'),{'options':{'raw':![],'attributes':['id',_0xfd8a('0x4'),'timeout',_0xfd8a('0x5')],'include':[{'model':'User','as':_0xfd8a('0x6'),'attributes':['id',_0xfd8a('0x4'),_0xfd8a('0x7'),'chatPause']}]},'log':_0xfd8a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 8d3c4ae..f01abb0 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 _0x1ae3=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create'];(function(_0x467fe4,_0x4fbf5b){var _0x4ebd19=function(_0x2f9d){while(--_0x2f9d){_0x467fe4['push'](_0x467fe4['shift']());}};_0x4ebd19(++_0x4fbf5b);}(_0x1ae3,0x139));var _0x31ae=function(_0x35da2f,_0x3fbecf){_0x35da2f=_0x35da2f-0x0;var _0x4ed933=_0x1ae3[_0x35da2f];return _0x4ed933;};'use strict';var client=require(_0x31ae('0x0'));exports[_0x31ae('0x1')]=function(_0x50dfb3){return client[_0x31ae('0x2')](_0x31ae('0x3'),{'body':_0x50dfb3,'log':_0x31ae('0x3')});};exports[_0x31ae('0x4')]=function(_0x4f03c3,_0x16eaa4){return client[_0x31ae('0x2')](_0x31ae('0x5'),{'body':_0x16eaa4,'options':{'where':{'uniqueid':_0x4f03c3},'order':[['id',_0x31ae('0x6')]],'limit':0x1},'log':_0x31ae('0x5')});}; \ No newline at end of file +var _0x008c=['../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC'];(function(_0xc66c50,_0x4dfbc1){var _0x48bc6f=function(_0x781d40){while(--_0x781d40){_0xc66c50['push'](_0xc66c50['shift']());}};_0x48bc6f(++_0x4dfbc1);}(_0x008c,0x188));var _0xc008=function(_0x59831f,_0x5154ca){_0x59831f=_0x59831f-0x0;var _0x11f70c=_0x008c[_0x59831f];return _0x11f70c;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateChatQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 58782ed..6a9ad11 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(_0x4c73ac,_0x46b73c){var _0x9839ee=function(_0x2076fb){while(--_0x2076fb){_0x4c73ac['push'](_0x4c73ac['shift']());}};_0x9839ee(++_0x46b73c);}(_0x7a54,0x106));var _0x47a5=function(_0x2c3616,_0x4acfa2){_0x2c3616=_0x2c3616-0x0;var _0x5aa765=_0x7a54[_0x2c3616];return _0x5aa765;};'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(_0x5df780,_0x3460c8){var _0x535f5b=function(_0x505237){while(--_0x505237){_0x5df780['push'](_0x5df780['shift']());}};_0x535f5b(++_0x3460c8);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 17ec208..930df39 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 _0xf31e=['Request','CreateFaxMessage','createFaxMessage','create'];(function(_0x365a40,_0x5c073e){var _0x1dd6d5=function(_0x2a1932){while(--_0x2a1932){_0x365a40['push'](_0x365a40['shift']());}};_0x1dd6d5(++_0x5c073e);}(_0xf31e,0xf7));var _0xef31=function(_0x21c69a,_0x5d6b96){_0x21c69a=_0x21c69a-0x0;var _0x11cc9b=_0xf31e[_0x21c69a];return _0x11cc9b;};'use strict';var client=require('../client');exports[_0xef31('0x0')]=function(_0x4101b2){return client[_0xef31('0x1')](_0xef31('0x2'),{'body':_0x4101b2,'log':_0xef31('0x3')});}; \ No newline at end of file +var _0x06b8=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0xf9dc6d,_0x1e8581){var _0x459b67=function(_0x5a77ff){while(--_0x5a77ff){_0xf9dc6d['push'](_0xf9dc6d['shift']());}};_0x459b67(++_0x1e8581);}(_0x06b8,0x7e));var _0x806b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x06b8[_0x501510];return _0x1e6ee5;};'use strict';var client=require(_0x806b('0x0'));exports[_0x806b('0x1')]=function(_0x5a1e5a){return client[_0x806b('0x2')](_0x806b('0x3'),{'body':_0x5a1e5a,'log':_0x806b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 12f3b3d..993d81d 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 _0x7772=['faxPause','../client','Request','GetFaxQueue','name','timeout','User','Agents','online'];(function(_0x5a0a42,_0xe9c0f9){var _0x4de030=function(_0x4196bf){while(--_0x4196bf){_0x5a0a42['push'](_0x5a0a42['shift']());}};_0x4de030(++_0xe9c0f9);}(_0x7772,0x76));var _0x2777=function(_0x4d556f,_0x45718c){_0x4d556f=_0x4d556f-0x0;var _0x46d98a=_0x7772[_0x4d556f];return _0x46d98a;};'use strict';var client=require(_0x2777('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x2777('0x1')](_0x2777('0x2'),{'options':{'raw':![],'attributes':['id',_0x2777('0x3'),_0x2777('0x4'),'strategy'],'include':[{'model':_0x2777('0x5'),'as':_0x2777('0x6'),'attributes':['id',_0x2777('0x3'),_0x2777('0x7'),_0x2777('0x8')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0xf67b=['GetFaxQueue','name','strategy','User','Agents','getFaxQueues','Request'];(function(_0x1bce91,_0x2b6500){var _0x3c20c2=function(_0x1eeb06){while(--_0x1eeb06){_0x1bce91['push'](_0x1bce91['shift']());}};_0x3c20c2(++_0x2b6500);}(_0xf67b,0x171));var _0xbf67=function(_0x18daeb,_0x1b8ff3){_0x18daeb=_0x18daeb-0x0;var _0x425a30=_0xf67b[_0x18daeb];return _0x425a30;};'use strict';var client=require('../client');exports[_0xbf67('0x0')]=function(){return function(){return client[_0xbf67('0x1')](_0xbf67('0x2'),{'options':{'raw':![],'attributes':['id',_0xbf67('0x3'),'timeout',_0xbf67('0x4')],'include':[{'model':_0xbf67('0x5'),'as':_0xbf67('0x6'),'attributes':['id',_0xbf67('0x3'),'online','faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 7c6b66b..05233de 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 _0x1d9d=['DESC','../client','create','Request','CreateFaxQueueReport','UpdateFaxQueueReport'];(function(_0x577789,_0x24b8e8){var _0x403787=function(_0x4eca9a){while(--_0x4eca9a){_0x577789['push'](_0x577789['shift']());}};_0x403787(++_0x24b8e8);}(_0x1d9d,0x1f3));var _0xd1d9=function(_0xa57db6,_0x55a817){_0xa57db6=_0xa57db6-0x0;var _0x341637=_0x1d9d[_0xa57db6];return _0x341637;};'use strict';var client=require(_0xd1d9('0x0'));exports[_0xd1d9('0x1')]=function(_0x3926e9){return client[_0xd1d9('0x2')](_0xd1d9('0x3'),{'body':_0x3926e9,'log':_0xd1d9('0x3')});};exports['update']=function(_0x436b35,_0x58dd9e){return client[_0xd1d9('0x2')](_0xd1d9('0x4'),{'body':_0x58dd9e,'options':{'where':{'uniqueid':_0x436b35},'order':[['id',_0xd1d9('0x5')]],'limit':0x1},'log':_0xd1d9('0x4')});}; \ No newline at end of file +var _0x1ce9=['UpdateFaxQueueReport','../client','Request','CreateFaxQueueReport','update'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x1ce9,0x1a0));var _0x91ce=function(_0x1ce1e2,_0x583cf0){_0x1ce1e2=_0x1ce1e2-0x0;var _0x2e5444=_0x1ce9[_0x1ce1e2];return _0x2e5444;};'use strict';var client=require(_0x91ce('0x0'));exports['create']=function(_0x184031){return client[_0x91ce('0x1')](_0x91ce('0x2'),{'body':_0x184031,'log':'CreateFaxQueueReport'});};exports[_0x91ce('0x3')]=function(_0x2269b5,_0xe75b33){return client[_0x91ce('0x1')](_0x91ce('0x4'),{'body':_0xe75b33,'options':{'where':{'uniqueid':_0x2269b5},'order':[['id','DESC']],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 164a0e6..6f59514 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 _0x41a3=['../client','getIntervals','Request','GetInterval','name','Interval','interval'];(function(_0x434ac8,_0x5c2f4f){var _0x468238=function(_0x285736){while(--_0x285736){_0x434ac8['push'](_0x434ac8['shift']());}};_0x468238(++_0x5c2f4f);}(_0x41a3,0x181));var _0x341a=function(_0x362919,_0x27c276){_0x362919=_0x362919-0x0;var _0x52692a=_0x41a3[_0x362919];return _0x52692a;};'use strict';var client=require(_0x341a('0x0'));exports[_0x341a('0x1')]=function(){return function(){return client[_0x341a('0x2')](_0x341a('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x341a('0x4')],'include':[{'model':_0x341a('0x5'),'as':'Intervals','attributes':['id','name',_0x341a('0x6')]}]},'log':_0x341a('0x1')});};}; \ No newline at end of file +var _0xf477=['Intervals','interval','getIntervals','Request','GetInterval','name','Interval'];(function(_0x33290a,_0xe06536){var _0x404ba2=function(_0x3da562){while(--_0x3da562){_0x33290a['push'](_0x33290a['shift']());}};_0x404ba2(++_0xe06536);}(_0xf477,0xbf));var _0x7f47=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf477[_0x2641f9];return _0x585741;};'use strict';var client=require('../client');exports[_0x7f47('0x0')]=function(){return function(){return client[_0x7f47('0x1')](_0x7f47('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x7f47('0x3')],'include':[{'model':_0x7f47('0x4'),'as':_0x7f47('0x5'),'attributes':['id',_0x7f47('0x3'),_0x7f47('0x6')]}]},'log':_0x7f47('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 16d16b4..ee5be51 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 _0xd824=['Request','UpdateMailInteraction','updateMailInteraction','addTags','addTagsToChatInteraction','../client','update'];(function(_0x95411e,_0x38b4c3){var _0x2c8718=function(_0x35c672){while(--_0x35c672){_0x95411e['push'](_0x95411e['shift']());}};_0x2c8718(++_0x38b4c3);}(_0xd824,0xc2));var _0x4d82=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xd824[_0x57b54c];return _0x59cc19;};'use strict';var client=require(_0x4d82('0x0'));exports[_0x4d82('0x1')]=function(_0x572eea,_0x53fe9a){return client[_0x4d82('0x2')](_0x4d82('0x3'),{'body':_0x53fe9a,'options':{'where':{'id':_0x572eea}},'log':_0x4d82('0x4')});};exports[_0x4d82('0x5')]=function(_0x287fbf,_0x1c8ad9){return client['Request']('AddTagsToMailInteraction',{'body':_0x1c8ad9,'options':{'where':{'id':_0x287fbf}},'log':_0x4d82('0x6')});}; \ No newline at end of file +var _0x77d4=['update','UpdateMailInteraction','updateMailInteraction','Request','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x2262c3,_0x3730d0){var _0x1597a0=function(_0x1a8de3){while(--_0x1a8de3){_0x2262c3['push'](_0x2262c3['shift']());}};_0x1597a0(++_0x3730d0);}(_0x77d4,0x108));var _0x477d=function(_0xcae6c9,_0x47c380){_0xcae6c9=_0xcae6c9-0x0;var _0x4d98d7=_0x77d4[_0xcae6c9];return _0x4d98d7;};'use strict';var client=require('../client');exports[_0x477d('0x0')]=function(_0x49b615,_0x18c0fe){return client['Request'](_0x477d('0x1'),{'body':_0x18c0fe,'options':{'where':{'id':_0x49b615}},'log':_0x477d('0x2')});};exports['addTags']=function(_0x53e1b8,_0x16213f){return client[_0x477d('0x3')](_0x477d('0x4'),{'body':_0x16213f,'options':{'where':{'id':_0x53e1b8}},'log':_0x477d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index ee250af..cc93b69 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 _0xf488=['create','Request','CreateMailMessage'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0xf488,0xff));var _0x8f48=function(_0x872f6f,_0x5efe7b){_0x872f6f=_0x872f6f-0x0;var _0x59a5f4=_0xf488[_0x872f6f];return _0x59a5f4;};'use strict';var client=require('../client');exports[_0x8f48('0x0')]=function(_0x3efe0e){return client[_0x8f48('0x1')](_0x8f48('0x2'),{'body':_0x3efe0e,'log':'createMailMessage'});}; \ No newline at end of file +var _0x200a=['create','Request','createMailMessage','../client'];(function(_0x21aefe,_0x27eccb){var _0x45a8f1=function(_0x1df0d7){while(--_0x1df0d7){_0x21aefe['push'](_0x21aefe['shift']());}};_0x45a8f1(++_0x27eccb);}(_0x200a,0x8f));var _0xa200=function(_0xc5a279,_0x155360){_0xc5a279=_0xc5a279-0x0;var _0xc755d3=_0x200a[_0xc5a279];return _0xc755d3;};'use strict';var client=require(_0xa200('0x0'));exports[_0xa200('0x1')]=function(_0xff0d8b){return client[_0xa200('0x2')]('CreateMailMessage',{'body':_0xff0d8b,'log':_0xa200('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index fc065ff..e5e5b3f 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 _0x9df9=['Request','GetMailQueue','timeout','strategy','User','Agents','name','online','../client','getMailQueues'];(function(_0x409406,_0x5b927f){var _0x23a60c=function(_0x3cdc72){while(--_0x3cdc72){_0x409406['push'](_0x409406['shift']());}};_0x23a60c(++_0x5b927f);}(_0x9df9,0x152));var _0x99df=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x9df9[_0x82129b];return _0x2ae5dc;};'use strict';var client=require(_0x99df('0x0'));exports[_0x99df('0x1')]=function(){return function(){return client[_0x99df('0x2')](_0x99df('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x99df('0x4'),_0x99df('0x5')],'include':[{'model':_0x99df('0x6'),'as':_0x99df('0x7'),'attributes':['id',_0x99df('0x8'),_0x99df('0x9'),'mailPause']}]},'log':_0x99df('0x1')});};}; \ No newline at end of file +var _0x9f51=['timeout','strategy','Agents','name','online','getMailQueues','Request','GetMailQueue'];(function(_0x3c089d,_0x207244){var _0x5cf799=function(_0x3499d1){while(--_0x3499d1){_0x3c089d['push'](_0x3c089d['shift']());}};_0x5cf799(++_0x207244);}(_0x9f51,0xe5));var _0x19f5=function(_0x308f09,_0x9c9367){_0x308f09=_0x308f09-0x0;var _0x2b58fd=_0x9f51[_0x308f09];return _0x2b58fd;};'use strict';var client=require('../client');exports[_0x19f5('0x0')]=function(){return function(){return client[_0x19f5('0x1')](_0x19f5('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x19f5('0x3'),_0x19f5('0x4')],'include':[{'model':'User','as':_0x19f5('0x5'),'attributes':['id',_0x19f5('0x6'),_0x19f5('0x7'),'mailPause']}]},'log':_0x19f5('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index d4ce3e7..d666696 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 _0x6094=['../client','create','CreateMailQueueReport','Request','UpdateMailQueueReport','DESC'];(function(_0x2b867e,_0x18ed97){var _0x3b2dcb=function(_0x21100e){while(--_0x21100e){_0x2b867e['push'](_0x2b867e['shift']());}};_0x3b2dcb(++_0x18ed97);}(_0x6094,0x9c));var _0x4609=function(_0xc1bfcb,_0x5bf25a){_0xc1bfcb=_0xc1bfcb-0x0;var _0x2431ed=_0x6094[_0xc1bfcb];return _0x2431ed;};'use strict';var client=require(_0x4609('0x0'));exports[_0x4609('0x1')]=function(_0x38cad9){return client['Request'](_0x4609('0x2'),{'body':_0x38cad9,'log':_0x4609('0x2')});};exports['update']=function(_0xbdd821,_0x439de5){return client[_0x4609('0x3')](_0x4609('0x4'),{'body':_0x439de5,'options':{'where':{'uniqueid':_0xbdd821},'order':[['id',_0x4609('0x5')]],'limit':0x1},'log':_0x4609('0x4')});}; \ No newline at end of file +var _0xc536=['Request','CreateMailQueueReport','UpdateMailQueueReport','../client','create'];(function(_0x15319e,_0x18a686){var _0x4a1703=function(_0x415ff){while(--_0x415ff){_0x15319e['push'](_0x15319e['shift']());}};_0x4a1703(++_0x18a686);}(_0xc536,0xee));var _0x6c53=function(_0x212d05,_0x5787f3){_0x212d05=_0x212d05-0x0;var _0x5a423e=_0xc536[_0x212d05];return _0x5a423e;};'use strict';var client=require(_0x6c53('0x0'));exports[_0x6c53('0x1')]=function(_0x2d3a52){return client[_0x6c53('0x2')](_0x6c53('0x3'),{'body':_0x2d3a52,'log':_0x6c53('0x3')});};exports['update']=function(_0x515b77,_0xf654e5){return client[_0x6c53('0x2')]('UpdateMailQueueReport',{'body':_0xf654e5,'options':{'where':{'uniqueid':_0x515b77},'order':[['id','DESC']],'limit':0x1},'log':_0x6c53('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 70d8a28..d2e2d9f 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 _0x0c35=['updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction'];(function(_0x43bf44,_0x1f11ea){var _0x46eb5a=function(_0x1d2ae4){while(--_0x1d2ae4){_0x43bf44['push'](_0x43bf44['shift']());}};_0x46eb5a(++_0x1f11ea);}(_0x0c35,0xd4));var _0x50c3=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x0c35[_0x17d9e3];return _0x14192d;};'use strict';var client=require(_0x50c3('0x0'));exports[_0x50c3('0x1')]=function(_0x3cd42d,_0x235b9b){return client[_0x50c3('0x2')](_0x50c3('0x3'),{'body':_0x235b9b,'options':{'where':{'id':_0x3cd42d}},'log':_0x50c3('0x4')});};exports[_0x50c3('0x5')]=function(_0x2778ae,_0x48880d){return client[_0x50c3('0x2')](_0x50c3('0x6'),{'body':_0x48880d,'options':{'where':{'id':_0x2778ae}},'log':_0x50c3('0x7')});}; \ No newline at end of file +var _0xd6cb=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','../client','update','Request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd6cb,0x14d));var _0xbd6c=function(_0xabda9f,_0x295b6c){_0xabda9f=_0xabda9f-0x0;var _0x38b1b2=_0xd6cb[_0xabda9f];return _0x38b1b2;};'use strict';var client=require(_0xbd6c('0x0'));exports[_0xbd6c('0x1')]=function(_0x57fa9b,_0x2e6b80){return client[_0xbd6c('0x2')](_0xbd6c('0x3'),{'body':_0x2e6b80,'options':{'where':{'id':_0x57fa9b}},'log':_0xbd6c('0x4')});};exports[_0xbd6c('0x5')]=function(_0x595f75,_0x7267fb){return client[_0xbd6c('0x2')](_0xbd6c('0x6'),{'body':_0x7267fb,'options':{'where':{'id':_0x595f75}},'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 25a060a..6baa53a 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 _0x1f96=['../client','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x5cc30e,_0x2646b6){var _0x208c6d=function(_0x1abc53){while(--_0x1abc53){_0x5cc30e['push'](_0x5cc30e['shift']());}};_0x208c6d(++_0x2646b6);}(_0x1f96,0x1bc));var _0x61f9=function(_0x189710,_0x412400){_0x189710=_0x189710-0x0;var _0x53329e=_0x1f96[_0x189710];return _0x53329e;};'use strict';var client=require(_0x61f9('0x0'));exports['create']=function(_0x4d57bd){return client[_0x61f9('0x1')](_0x61f9('0x2'),{'body':_0x4d57bd,'log':_0x61f9('0x3')});}; \ No newline at end of file +var _0x502e=['Request','CreateOpenchannelMessage','createOpenchannelMessage','create'];(function(_0xbdbf6d,_0x94bf8b){var _0xd077b8=function(_0x3e9ce4){while(--_0x3e9ce4){_0xbdbf6d['push'](_0xbdbf6d['shift']());}};_0xd077b8(++_0x94bf8b);}(_0x502e,0xbb));var _0xe502=function(_0x2eb531,_0x1c2aba){_0x2eb531=_0x2eb531-0x0;var _0x28b255=_0x502e[_0x2eb531];return _0x28b255;};'use strict';var client=require('../client');exports[_0xe502('0x0')]=function(_0x5b3da2){return client[_0xe502('0x1')](_0xe502('0x2'),{'body':_0x5b3da2,'log':_0xe502('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index f7e36ae..f79a0d6 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 _0x2b95=['online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','strategy','Agents','name'];(function(_0x20bf34,_0x36326b){var _0x127cf8=function(_0x2cdacb){while(--_0x2cdacb){_0x20bf34['push'](_0x20bf34['shift']());}};_0x127cf8(++_0x36326b);}(_0x2b95,0x18e));var _0x52b9=function(_0x845505,_0x19e5f3){_0x845505=_0x845505-0x0;var _0x2513b9=_0x2b95[_0x845505];return _0x2513b9;};'use strict';var client=require(_0x52b9('0x0'));exports[_0x52b9('0x1')]=function(){return function(){return client[_0x52b9('0x2')](_0x52b9('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x52b9('0x4')],'include':[{'model':'User','as':_0x52b9('0x5'),'attributes':['id',_0x52b9('0x6'),_0x52b9('0x7'),_0x52b9('0x8')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0xf6a6=['GetOpenchannelQueue','name','timeout','strategy','User','Agents','getOpenchannelQueues','Request'];(function(_0x156d87,_0x36564a){var _0x5e771e=function(_0x32fce8){while(--_0x32fce8){_0x156d87['push'](_0x156d87['shift']());}};_0x5e771e(++_0x36564a);}(_0xf6a6,0x147));var _0x6f6a=function(_0x494561,_0x3109af){_0x494561=_0x494561-0x0;var _0x19f9f3=_0xf6a6[_0x494561];return _0x19f9f3;};'use strict';var client=require('../client');exports['getOpenchannelQueues']=function(){return function(){return client[_0x6f6a('0x0')](_0x6f6a('0x1'),{'options':{'raw':![],'attributes':['id',_0x6f6a('0x2'),_0x6f6a('0x3'),_0x6f6a('0x4')],'include':[{'model':_0x6f6a('0x5'),'as':_0x6f6a('0x6'),'attributes':['id',_0x6f6a('0x2'),'online','openchannelPause']}]},'log':_0x6f6a('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 8f2ea96..b8faf2f 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 _0x1371=['CreateOpenchannelQueueReport','update','Request','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0xa567a8,_0x10e039){var _0x59eeaa=function(_0x2898af){while(--_0x2898af){_0xa567a8['push'](_0xa567a8['shift']());}};_0x59eeaa(++_0x10e039);}(_0x1371,0x91));var _0x1137=function(_0x3309b9,_0x159d86){_0x3309b9=_0x3309b9-0x0;var _0x569cac=_0x1371[_0x3309b9];return _0x569cac;};'use strict';var client=require(_0x1137('0x0'));exports[_0x1137('0x1')]=function(_0x1aa0da){return client['Request'](_0x1137('0x2'),{'body':_0x1aa0da,'log':_0x1137('0x2')});};exports[_0x1137('0x3')]=function(_0x3b3e7a,_0x8d13c8){return client[_0x1137('0x4')](_0x1137('0x5'),{'body':_0x8d13c8,'options':{'where':{'uniqueid':_0x3b3e7a},'order':[['id',_0x1137('0x6')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x49ac=['../client','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x14231d,_0x390cff){var _0x271148=function(_0xb0e878){while(--_0xb0e878){_0x14231d['push'](_0x14231d['shift']());}};_0x271148(++_0x390cff);}(_0x49ac,0x19e));var _0xc49a=function(_0x43b487,_0x21893a){_0x43b487=_0x43b487-0x0;var _0x2f707a=_0x49ac[_0x43b487];return _0x2f707a;};'use strict';var client=require(_0xc49a('0x0'));exports[_0xc49a('0x1')]=function(_0xae53f3){return client[_0xc49a('0x2')](_0xc49a('0x3'),{'body':_0xae53f3,'log':_0xc49a('0x3')});};exports[_0xc49a('0x4')]=function(_0x741aea,_0x3d6da8){return client[_0xc49a('0x2')](_0xc49a('0x5'),{'body':_0x3d6da8,'options':{'where':{'uniqueid':_0x741aea},'order':[['id','DESC']],'limit':0x1},'log':_0xc49a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 0603be7..2f8a37f 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 _0x795a=['update','Request','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x454b32,_0x39224a){var _0x442492=function(_0x26a53e){while(--_0x26a53e){_0x454b32['push'](_0x454b32['shift']());}};_0x442492(++_0x39224a);}(_0x795a,0xa2));var _0xa795=function(_0x20d816,_0x22395c){_0x20d816=_0x20d816-0x0;var _0x3de609=_0x795a[_0x20d816];return _0x3de609;};'use strict';var client=require('../client');exports[_0xa795('0x0')]=function(_0x17afed,_0x4b93be){return client[_0xa795('0x1')]('UpdateSmsInteraction',{'body':_0x4b93be,'options':{'where':{'id':_0x17afed}},'log':_0xa795('0x2')});};exports[_0xa795('0x3')]=function(_0x4ce3a0,_0x4f7e4e){return client[_0xa795('0x1')](_0xa795('0x4'),{'body':_0x4f7e4e,'options':{'where':{'id':_0x4ce3a0}},'log':_0xa795('0x5')});}; \ No newline at end of file +var _0x61df=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','Request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x61df,0xbd));var _0xf61d=function(_0x420720,_0x4c4b64){_0x420720=_0x420720-0x0;var _0x48a429=_0x61df[_0x420720];return _0x48a429;};'use strict';var client=require('../client');exports['update']=function(_0x559316,_0x5cda8a){return client[_0xf61d('0x0')]('UpdateSmsInteraction',{'body':_0x5cda8a,'options':{'where':{'id':_0x559316}},'log':_0xf61d('0x1')});};exports[_0xf61d('0x2')]=function(_0x485a55,_0x3170e7){return client[_0xf61d('0x0')](_0xf61d('0x3'),{'body':_0x3170e7,'options':{'where':{'id':_0x485a55}},'log':_0xf61d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 301ae85..3852d72 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 _0x8b3d=['create','CreateSmsMessage','createSmsMessage','../client'];(function(_0x575045,_0x1c2016){var _0x2d73d5=function(_0x58ac00){while(--_0x58ac00){_0x575045['push'](_0x575045['shift']());}};_0x2d73d5(++_0x1c2016);}(_0x8b3d,0x1af));var _0xd8b3=function(_0x19f664,_0x65d7ef){_0x19f664=_0x19f664-0x0;var _0x10dc30=_0x8b3d[_0x19f664];return _0x10dc30;};'use strict';var client=require(_0xd8b3('0x0'));exports[_0xd8b3('0x1')]=function(_0x2e89c9){return client['Request'](_0xd8b3('0x2'),{'body':_0x2e89c9,'log':_0xd8b3('0x3')});}; \ No newline at end of file +var _0xad89=['Request','createSmsMessage','create'];(function(_0x22dba5,_0x382151){var _0x32d7ec=function(_0x502c28){while(--_0x502c28){_0x22dba5['push'](_0x22dba5['shift']());}};_0x32d7ec(++_0x382151);}(_0xad89,0xd4));var _0x9ad8=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xad89[_0x34bc30];return _0x5706de;};'use strict';var client=require('../client');exports[_0x9ad8('0x0')]=function(_0x2445be){return client[_0x9ad8('0x1')]('CreateSmsMessage',{'body':_0x2445be,'log':_0x9ad8('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 884197d..c6f432f 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 _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x3234c6,_0x383bac){var _0x49a449=function(_0x21d085){while(--_0x21d085){_0x3234c6['push'](_0x3234c6['shift']());}};_0x49a449(++_0x383bac);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4')],'include':[{'model':_0x49c4('0x5'),'as':'Agents','attributes':['id','name',_0x49c4('0x6'),'smsPause']}]},'log':_0x49c4('0x7')});};}; \ No newline at end of file +var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x2e0443,_0x7e5974){var _0x52d450=function(_0x3a9985){while(--_0x3a9985){_0x2e0443['push'](_0x2e0443['shift']());}};_0x52d450(++_0x7e5974);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 6782824..5baea09 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(_0xba2d3b,_0x1f1746){var _0x2f4275=function(_0x590ab6){while(--_0x590ab6){_0xba2d3b['push'](_0xba2d3b['shift']());}};_0x2f4275(++_0x1f1746);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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(_0x4734cd,_0x4af70d){var _0x5a6e3c=function(_0x29b10b){while(--_0x29b10b){_0x4734cd['push'](_0x4734cd['shift']());}};_0x5a6e3c(++_0x4af70d);}(_0x70e0,0x17b));var _0x070e=function(_0x1d319a,_0x12a4d0){_0x1d319a=_0x1d319a-0x0;var _0x59d2aa=_0x70e0[_0x1d319a];return _0x59d2aa;};'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 8776fa3..5fe8824 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(_0x60b203,_0x4557d2){var _0x1f44cf=function(_0x5cb240){while(--_0x5cb240){_0x60b203['push'](_0x60b203['shift']());}};_0x1f44cf(++_0x4557d2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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(_0x2738af,_0x3c662a){var _0x35b01d=function(_0x39a525){while(--_0x39a525){_0x2738af['push'](_0x2738af['shift']());}};_0x35b01d(++_0x3c662a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 181f536..466fe4d 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 _0xee2c=['../client','Request','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0xee2c,0x1c7));var _0xcee2=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xee2c[_0x2aec52];return _0x3b8835;};'use strict';var client=require(_0xcee2('0x0'));exports['update']=function(_0x3c0f20,_0x39bb89){return client[_0xcee2('0x1')](_0xcee2('0x2'),{'body':_0x39bb89,'options':{'where':{'id':_0x3c0f20}},'log':'updateWhatsappInteraction'});};exports['addTags']=function(_0xc9b213,_0xb70cd1){return client['Request'](_0xcee2('0x3'),{'body':_0xb70cd1,'options':{'where':{'id':_0xc9b213}},'log':_0xcee2('0x4')});}; \ No newline at end of file +var _0x3fc6=['addTags','AddTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction'];(function(_0x2f32c4,_0x2597ba){var _0x95b5dc=function(_0x4ee89e){while(--_0x4ee89e){_0x2f32c4['push'](_0x2f32c4['shift']());}};_0x95b5dc(++_0x2597ba);}(_0x3fc6,0x115));var _0x63fc=function(_0x19f7c0,_0x4945f2){_0x19f7c0=_0x19f7c0-0x0;var _0x3a8f27=_0x3fc6[_0x19f7c0];return _0x3a8f27;};'use strict';var client=require(_0x63fc('0x0'));exports['update']=function(_0x238ea5,_0xf5c4fb){return client[_0x63fc('0x1')](_0x63fc('0x2'),{'body':_0xf5c4fb,'options':{'where':{'id':_0x238ea5}},'log':'updateWhatsappInteraction'});};exports[_0x63fc('0x3')]=function(_0x26d57e,_0x237af7){return client['Request'](_0x63fc('0x4'),{'body':_0x237af7,'options':{'where':{'id':_0x26d57e}},'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 50d6c19..8ecac52 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 _0x3617=['create','Request','CreateWhatsappMessage','../client'];(function(_0x22edf5,_0x298942){var _0x562468=function(_0x1807e3){while(--_0x1807e3){_0x22edf5['push'](_0x22edf5['shift']());}};_0x562468(++_0x298942);}(_0x3617,0x15b));var _0x7361=function(_0x47b94b,_0x43be0d){_0x47b94b=_0x47b94b-0x0;var _0x191855=_0x3617[_0x47b94b];return _0x191855;};'use strict';var client=require(_0x7361('0x0'));exports[_0x7361('0x1')]=function(_0x15ff7f){return client[_0x7361('0x2')](_0x7361('0x3'),{'body':_0x15ff7f,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x2d7a=['createWhatsappMessage','../client','create','Request','CreateWhatsappMessage'];(function(_0x54af02,_0x40773b){var _0x72a2dc=function(_0xe40cac){while(--_0xe40cac){_0x54af02['push'](_0x54af02['shift']());}};_0x72a2dc(++_0x40773b);}(_0x2d7a,0x1e6));var _0xa2d7=function(_0x1abc8d,_0x1e9760){_0x1abc8d=_0x1abc8d-0x0;var _0xa3c72f=_0x2d7a[_0x1abc8d];return _0xa3c72f;};'use strict';var client=require(_0xa2d7('0x0'));exports[_0xa2d7('0x1')]=function(_0x134354){return client[_0xa2d7('0x2')](_0xa2d7('0x3'),{'body':_0x134354,'log':_0xa2d7('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 6545f3f..2fd6230 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 _0x17dd=['name','timeout','User','Agents','online','whatsappPause','../client','getWhatsappQueues','GetWhatsappQueue'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x17dd,0x84));var _0xd17d=function(_0x10be3d,_0x3babee){_0x10be3d=_0x10be3d-0x0;var _0x3f623b=_0x17dd[_0x10be3d];return _0x3f623b;};'use strict';var client=require(_0xd17d('0x0'));exports[_0xd17d('0x1')]=function(){return function(){return client['Request'](_0xd17d('0x2'),{'options':{'raw':![],'attributes':['id',_0xd17d('0x3'),_0xd17d('0x4'),'strategy'],'include':[{'model':_0xd17d('0x5'),'as':_0xd17d('0x6'),'attributes':['id',_0xd17d('0x3'),_0xd17d('0x7'),_0xd17d('0x8')]}]},'log':_0xd17d('0x1')});};}; \ No newline at end of file +var _0xa405=['User','Agents','name','../client','getWhatsappQueues','Request','GetWhatsappQueue','strategy'];(function(_0x1e9992,_0x24a7db){var _0x4204e2=function(_0x43b540){while(--_0x43b540){_0x1e9992['push'](_0x1e9992['shift']());}};_0x4204e2(++_0x24a7db);}(_0xa405,0x17b));var _0x5a40=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xa405[_0x42cae2];return _0x5f256f;};'use strict';var client=require(_0x5a40('0x0'));exports[_0x5a40('0x1')]=function(){return function(){return client[_0x5a40('0x2')](_0x5a40('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x5a40('0x4')],'include':[{'model':_0x5a40('0x5'),'as':_0x5a40('0x6'),'attributes':['id',_0x5a40('0x7'),'online','whatsappPause']}]},'log':_0x5a40('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 11a1035..7d6a13d 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 _0xf729=['create','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client'];(function(_0x49c957,_0x3509d8){var _0x5b1d38=function(_0x219976){while(--_0x219976){_0x49c957['push'](_0x49c957['shift']());}};_0x5b1d38(++_0x3509d8);}(_0xf729,0x130));var _0x9f72=function(_0x2cfbb0,_0x26a6dc){_0x2cfbb0=_0x2cfbb0-0x0;var _0x32484d=_0xf729[_0x2cfbb0];return _0x32484d;};'use strict';var client=require(_0x9f72('0x0'));exports[_0x9f72('0x1')]=function(_0x301f5f){return client['Request'](_0x9f72('0x2'),{'body':_0x301f5f,'log':_0x9f72('0x2')});};exports[_0x9f72('0x3')]=function(_0x3233f7,_0x25b047){return client['Request'](_0x9f72('0x4'),{'body':_0x25b047,'options':{'where':{'uniqueid':_0x3233f7},'order':[['id','DESC']],'limit':0x1},'log':_0x9f72('0x4')});}; \ No newline at end of file +var _0x139a=['../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0x4094d3,_0x5762d3){var _0x412e29=function(_0x48216e){while(--_0x48216e){_0x4094d3['push'](_0x4094d3['shift']());}};_0x412e29(++_0x5762d3);}(_0x139a,0xd2));var _0xa139=function(_0x115845,_0x5aa5f3){_0x115845=_0x115845-0x0;var _0x54d872=_0x139a[_0x115845];return _0x54d872;};'use strict';var client=require(_0xa139('0x0'));exports[_0xa139('0x1')]=function(_0x5566bd){return client[_0xa139('0x2')](_0xa139('0x3'),{'body':_0x5566bd,'log':_0xa139('0x3')});};exports[_0xa139('0x4')]=function(_0xb54380,_0x1d5693){return client['Request'](_0xa139('0x5'),{'body':_0x1d5693,'options':{'where':{'uniqueid':_0xb54380},'order':[['id',_0xa139('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ 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 6d7eab3..b548d1a 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 _0x023d=['consequence','error','message','find','agents','createQueue','atimeout','channel','format','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','complete','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','name','toLowerCase'];(function(_0x3ab510,_0x703ef8){var _0x559e8c=function(_0x245dd8){while(--_0x245dd8){_0x3ab510['push'](_0x3ab510['shift']());}};_0x559e8c(++_0x703ef8);}(_0x023d,0xe7));var _0xd023=function(_0x30e92b,_0x5d65be){_0x30e92b=_0x30e92b-0x0;var _0x4b8961=_0x023d[_0x30e92b];return _0x4b8961;};'use strict';var schema=require(_0xd023('0x0'));var _=require('lodash');var util=require(_0xd023('0x1'));var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')(_0xd023('0x2'));var strategy=require(_0xd023('0x3'));var queue=schema({'name':{'type':'string','required':!![],'message':_0xd023('0x4')},'timeout':{'type':'number','message':_0xd023('0x5')}});function writeLog(_0x2b6630,_0x132f25,_0x4453e0){return logger[_0xd023('0x6')](util['format']('[%s][AGENT][NAME:%s][STATUS:%s]',_0x2b6630,_0x132f25[_0xd023('0x7')],_0x4453e0));}function handleFindAgent(_0x197a4a){return function(_0x3d2431){return _0x3d2431[_0xd023('0x7')]['toLowerCase']()===_0x197a4a[_0xd023('0x8')]();};}exports[_0xd023('0x9')]=function(_0x2f41f5,_0x2941cc,_0x21e3fa,_0x3a483d){return function(_0x2b47dc){try{var _0x57704c={'name':_0x2941cc[0x0],'timeout':_0x2941cc[0x1]};var _0x3184a5=queue['validate'](_0x57704c,{'typecast':!![]});if(_0x3184a5['length']){logger[_0xd023('0xa')]('[%s][AGENT]\x20%s',_0x2f41f5,_['map'](_0x3184a5,_0xd023('0xb'))['join'](',\x20'));_0x2b47dc['stop']();}else{var _0x1b20a4=_[_0xd023('0xc')](_0x21e3fa[_0xd023('0xd')],handleFindAgent(_0x57704c[_0xd023('0x7')]));if(_0x1b20a4){var _0x47e57e=(_0x57704c['timeout']||0xa)*0x3e8;var _0x55ab4f,_0x50d6ff;var _0x316e7e=seqqueue[_0xd023('0xe')](_0x47e57e);_0x316e7e['id']=_0x2f41f5;_0x316e7e[_0xd023('0xf')]=_0x47e57e;_0x316e7e[_0xd023('0x10')]=_0x3a483d[_0xd023('0x10')];writeLog(_0x2f41f5,_0x1b20a4,util[_0xd023('0x11')](_0xd023('0x12'),_0x47e57e));_0x21e3fa[_0xd023('0x13')][_0x2f41f5]['on'](_0xd023('0x14'),function(){logger[_0xd023('0x6')](_0xd023('0x15'),_0x2f41f5);clearTimeout(_0x50d6ff);_0x50d6ff=undefined;_0x316e7e[_0xd023('0x16')]();if(_0x21e3fa['rules'][_0x2f41f5]){delete _0x21e3fa['rules'][_0x2f41f5];}_0x2b47dc[_0xd023('0x17')]();});_0x21e3fa['rules'][_0x2f41f5]['on'](_0xd023('0x18'),function(){if(_0x21e3fa['rules'][_0x2f41f5]){delete _0x21e3fa['rules'][_0x2f41f5];}});_0x50d6ff=setTimeout(function(){logger[_0xd023('0x6')]('[%s][AGENT]\x20ROUTING\x20END',_0x2f41f5);clearTimeout(_0x50d6ff);_0x316e7e[_0xd023('0x16')]();_0x2b47dc[_0xd023('0x19')]();},_0x47e57e);strategy['agent'](_0x316e7e,_0x1b20a4,_0x21e3fa,_0x3a483d);}else{logger[_0xd023('0xa')](_0xd023('0x1a'),_0x2f41f5,_0x57704c[_0xd023('0x7')]);_0x2b47dc[_0xd023('0x17')]();}}}catch(_0x5c277d){console[_0xd023('0x1b')](_0x5c277d);logger[_0xd023('0xa')](_0xd023('0x1c'),_0x2f41f5,_0x5c277d[_0xd023('0x1d')]);_0x2b47dc[_0xd023('0x17')]();}};}; \ No newline at end of file +var _0x10c2=['createQueue','atimeout','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','rules','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length','error','map','message','stop','find','agents','timeout'];(function(_0x59d917,_0x2408ac){var _0x309497=function(_0x3c76b1){while(--_0x3c76b1){_0x59d917['push'](_0x59d917['shift']());}};_0x309497(++_0x2408ac);}(_0x10c2,0x164));var _0x210c=function(_0x186207,_0x465c27){_0x186207=_0x186207-0x0;var _0x26f88c=_0x10c2[_0x186207];return _0x26f88c;};'use strict';var schema=require('validate');var _=require(_0x210c('0x0'));var util=require(_0x210c('0x1'));var seqqueue=require(_0x210c('0x2'));var logger=require('../../../../config/logger')(_0x210c('0x3'));var strategy=require(_0x210c('0x4'));var queue=schema({'name':{'type':_0x210c('0x5'),'required':!![],'message':_0x210c('0x6')},'timeout':{'type':_0x210c('0x7'),'message':_0x210c('0x8')}});function writeLog(_0x2230a6,_0x1f2ebe,_0x2c4e75){return logger[_0x210c('0x9')](util[_0x210c('0xa')](_0x210c('0xb'),_0x2230a6,_0x1f2ebe[_0x210c('0xc')],_0x2c4e75));}function handleFindAgent(_0x2cf0ca){return function(_0x2038e2){return _0x2038e2[_0x210c('0xc')][_0x210c('0xd')]()===_0x2cf0ca[_0x210c('0xd')]();};}exports[_0x210c('0xe')]=function(_0xbe359f,_0x185b3d,_0x1712c1,_0x31aadc){return function(_0x2741e1){try{var _0x2051fc={'name':_0x185b3d[0x0],'timeout':_0x185b3d[0x1]};var _0x44d294=queue[_0x210c('0xf')](_0x2051fc,{'typecast':!![]});if(_0x44d294[_0x210c('0x10')]){logger[_0x210c('0x11')]('[%s][AGENT]\x20%s',_0xbe359f,_[_0x210c('0x12')](_0x44d294,_0x210c('0x13'))['join'](',\x20'));_0x2741e1[_0x210c('0x14')]();}else{var _0x294e6d=_[_0x210c('0x15')](_0x1712c1[_0x210c('0x16')],handleFindAgent(_0x2051fc['name']));if(_0x294e6d){var _0x339f47=(_0x2051fc[_0x210c('0x17')]||0xa)*0x3e8;var _0x5c6597,_0xa726ea;var _0x3b53d0=seqqueue[_0x210c('0x18')](_0x339f47);_0x3b53d0['id']=_0xbe359f;_0x3b53d0[_0x210c('0x19')]=_0x339f47;_0x3b53d0[_0x210c('0x1a')]=_0x31aadc[_0x210c('0x1a')];writeLog(_0xbe359f,_0x294e6d,util[_0x210c('0xa')](_0x210c('0x1b'),_0x339f47));_0x1712c1['rules'][_0xbe359f]['on'](_0x210c('0x1c'),function(){logger[_0x210c('0x9')](_0x210c('0x1d'),_0xbe359f);clearTimeout(_0xa726ea);_0xa726ea=undefined;_0x3b53d0['close']();if(_0x1712c1[_0x210c('0x1e')][_0xbe359f]){delete _0x1712c1['rules'][_0xbe359f];}_0x2741e1[_0x210c('0x14')]();});_0x1712c1[_0x210c('0x1e')][_0xbe359f]['on']('complete',function(){if(_0x1712c1['rules'][_0xbe359f]){delete _0x1712c1[_0x210c('0x1e')][_0xbe359f];}});_0xa726ea=setTimeout(function(){logger[_0x210c('0x9')](_0x210c('0x1f'),_0xbe359f);clearTimeout(_0xa726ea);_0x3b53d0[_0x210c('0x20')]();_0x2741e1[_0x210c('0x21')]();},_0x339f47);strategy[_0x210c('0x22')](_0x3b53d0,_0x294e6d,_0x1712c1,_0x31aadc);}else{logger[_0x210c('0x11')](_0x210c('0x23'),_0xbe359f,_0x2051fc[_0x210c('0xc')]);_0x2741e1[_0x210c('0x14')]();}}}catch(_0x49d7aa){console['log'](_0x49d7aa);logger['error'](_0x210c('0x24'),_0xbe359f,_0x49d7aa[_0x210c('0x25')]);_0x2741e1[_0x210c('0x14')]();}};}; \ 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 764665b..c3d17b2 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 _0x8c53=['consequence','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','error','next','amazonlex','providerName','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x5b7755,_0x44681c){var _0x1a9c39=function(_0x56ceec){while(--_0x56ceec){_0x5b7755['push'](_0x5b7755['shift']());}};_0x1a9c39(++_0x44681c);}(_0x8c53,0x8a));var _0x38c5=function(_0x395176,_0x3764c4){_0x395176=_0x395176-0x0;var _0x3ac857=_0x8c53[_0x395176];return _0x3ac857;};'use strict';var _=require(_0x38c5('0x0'));var moment=require(_0x38c5('0x1'));var AWS=require(_0x38c5('0x2'));var utils=require(_0x38c5('0x3'));var logger=require(_0x38c5('0x4'))(_0x38c5('0x5'));var rpc={'chatMessage':require(_0x38c5('0x6')),'openchannelMessage':require(_0x38c5('0x7')),'mailMessage':require(_0x38c5('0x8')),'smsMessage':require(_0x38c5('0x9')),'faxMessage':require(_0x38c5('0xa')),'whatsappMessage':require(_0x38c5('0xb'))};exports[_0x38c5('0xc')]=function(_0x64a8f6,_0x51c523){return function(_0x5bd4f0){try{if(!_['isNil'](this[_0x38c5('0xd')]['UserId'])){logger[_0x38c5('0xe')](_0x38c5('0xf'),_0x64a8f6,_0x38c5('0x10'));return _0x5bd4f0['next']();}var _0x46e31e={'ContactId':this[_0x38c5('0x11')]['id'],'sentAt':moment()['format'](_0x38c5('0x12')),'direction':_0x38c5('0x13')};if(this[_0x38c5('0x14')]===_0x38c5('0x15')||this[_0x38c5('0x14')]===_0x38c5('0x16')){_0x46e31e[_0x38c5('0x17')]=this['interaction'][_0x38c5('0x17')];}var _0x24fbbe=this['channel'];if(_0x24fbbe==='chat'){_0x46e31e['ChatWebsiteId']=this[_0x38c5('0x18')]['id'];}else{_0x46e31e[_[_0x38c5('0x19')](_0x24fbbe)+_0x38c5('0x1a')]=this[_0x38c5('0x18')]['id'];}_0x46e31e[_[_0x38c5('0x19')](_0x24fbbe)+'InteractionId']=this[_0x38c5('0xd')]['id'];if(this[_0x38c5('0xd')][_0x38c5('0x1b')]){var _0x7128b3=_0x51c523[0x4];if(!_[_0x38c5('0x1c')](_0x7128b3)){_0x46e31e[_0x38c5('0x1d')]=utils[_0x38c5('0x1e')](_0x7128b3,this);return rpc[_0x24fbbe+_0x38c5('0x1f')][_0x38c5('0x20')](_0x46e31e)[_0x38c5('0x21')](function(_0x5c2d5f){logger[_0x38c5('0xe')](_0x38c5('0xf'),_0x64a8f6,_0x46e31e[_0x38c5('0x1d')]);})[_0x38c5('0x22')](function(_0x2c854e){logger['error'](_0x38c5('0xf'),_0x64a8f6,JSON[_0x38c5('0x23')](_0x2c854e));})['finally'](function(){logger[_0x38c5('0xe')](_0x38c5('0x24'),_0x64a8f6);_0x5bd4f0[_0x38c5('0x25')]();});}else{logger[_0x38c5('0xe')](_0x38c5('0x26'),_0x64a8f6);_0x5bd4f0[_0x38c5('0x25')]();}}else{var _0x8e2879=this;var _0xd9a08d=new AWS[(_0x38c5('0x27'))]({'accessKeyId':_0x51c523[0x0],'secretAccessKey':_0x51c523[0x1],'region':_0x51c523[0x2]});var _0x5ce057={'botAlias':_0x38c5('0x28'),'botName':_0x51c523[0x3],'inputText':this[_0x38c5('0x29')]['body'],'userId':this[_0x38c5('0x14')]+':'+this[_0x38c5('0xd')]['id'][_0x38c5('0x2a')]()};_0xd9a08d[_0x38c5('0x2b')](_0x5ce057,function(_0x4bb148,_0x5cd8e2){if(_0x4bb148){logger[_0x38c5('0x2c')](_0x38c5('0xf'),_0x64a8f6,_0x4bb148[_0x38c5('0x29')]);_0x5bd4f0[_0x38c5('0x2d')]();}else if(_0x5cd8e2&&_0x5cd8e2['message']){_0x8e2879[_0x38c5('0x1d')][_0x38c5('0x2e')]=_0x5cd8e2;_0x46e31e[_0x38c5('0x1d')]=_0x5cd8e2['message'];_0x46e31e[_0x38c5('0x2f')]=_0x38c5('0x2e');_0x46e31e['providerResponse']=JSON[_0x38c5('0x23')](_0x5cd8e2);return rpc[_0x24fbbe+_0x38c5('0x1f')][_0x38c5('0x20')](_0x46e31e)[_0x38c5('0x21')](function(_0x54861c){logger['info'](_0x38c5('0xf'),_0x64a8f6,_0x46e31e[_0x38c5('0x1d')]);if(_0x5cd8e2[_0x38c5('0x30')]==_0x38c5('0x31')){_0x5bd4f0[_0x38c5('0x2d')]();}else{_0x5bd4f0['stop']();}})['catch'](function(_0x34018d){logger[_0x38c5('0x2c')](_0x38c5('0xf'),_0x64a8f6,JSON[_0x38c5('0x23')](_0x34018d));_0x5bd4f0['next']();});}else{_0x5bd4f0[_0x38c5('0x2d')]();}});}}catch(_0x49f974){logger[_0x38c5('0x2c')]('[%s][AMAZONLEX]\x20%s',_0x64a8f6,JSON['stringify'](_0x49f974));_0x5bd4f0[_0x38c5('0x25')]();}};}; \ No newline at end of file +var _0x674c=['providerName','amazonlex','then','dialogState','Failed','catch','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','UserId','info','next','format','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','interaction','created','body','Message','create','[%s][AMAZONLEX]\x20%s','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','toString','postText','message'];(function(_0xc4fee0,_0x5537e8){var _0x36d25a=function(_0x1b6fb4){while(--_0x1b6fb4){_0xc4fee0['push'](_0xc4fee0['shift']());}};_0x36d25a(++_0x5537e8);}(_0x674c,0x19b));var _0xc674=function(_0x537737,_0x292025){_0x537737=_0x537737-0x0;var _0x78ee55=_0x674c[_0x537737];return _0x78ee55;};'use strict';var _=require(_0xc674('0x0'));var moment=require(_0xc674('0x1'));var AWS=require('aws-sdk');var utils=require(_0xc674('0x2'));var logger=require(_0xc674('0x3'))(_0xc674('0x4'));var rpc={'chatMessage':require(_0xc674('0x5')),'openchannelMessage':require(_0xc674('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xc674('0x7')),'whatsappMessage':require(_0xc674('0x8'))};exports['consequence']=function(_0x270ca7,_0x153b58){return function(_0x1bcd43){try{if(!_[_0xc674('0x9')](this['interaction'][_0xc674('0xa')])){logger[_0xc674('0xb')]('[%s][AMAZONLEX]\x20%s',_0x270ca7,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x1bcd43[_0xc674('0xc')]();}var _0x6091b9={'ContactId':this['contact']['id'],'sentAt':moment()[_0xc674('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xc674('0xe')};if(this[_0xc674('0xf')]===_0xc674('0x10')||this[_0xc674('0xf')]===_0xc674('0x11')){_0x6091b9[_0xc674('0x12')]=this['interaction'][_0xc674('0x12')];}var _0x5882d1=this[_0xc674('0xf')];if(_0x5882d1===_0xc674('0x13')){_0x6091b9[_0xc674('0x14')]=this[_0xc674('0x15')]['id'];}else{_0x6091b9[_[_0xc674('0x16')](_0x5882d1)+_0xc674('0x17')]=this['account']['id'];}_0x6091b9[_[_0xc674('0x16')](_0x5882d1)+'InteractionId']=this[_0xc674('0x18')]['id'];if(this['interaction'][_0xc674('0x19')]){var _0x37a9a4=_0x153b58[0x4];if(!_['isEmpty'](_0x37a9a4)){_0x6091b9[_0xc674('0x1a')]=utils['getMustacheRender'](_0x37a9a4,this);return rpc[_0x5882d1+_0xc674('0x1b')][_0xc674('0x1c')](_0x6091b9)['then'](function(_0x4c726a){logger['info'](_0xc674('0x1d'),_0x270ca7,_0x6091b9[_0xc674('0x1a')]);})['catch'](function(_0x4b6b06){logger[_0xc674('0x1e')](_0xc674('0x1d'),_0x270ca7,JSON[_0xc674('0x1f')](_0x4b6b06));})['finally'](function(){logger[_0xc674('0xb')](_0xc674('0x20'),_0x270ca7);_0x1bcd43[_0xc674('0x21')]();});}else{logger[_0xc674('0xb')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x270ca7);_0x1bcd43['stop']();}}else{var _0x540741=this;var _0x1f3746=new AWS[(_0xc674('0x22'))]({'accessKeyId':_0x153b58[0x0],'secretAccessKey':_0x153b58[0x1],'region':_0x153b58[0x2]});var _0x2f246f={'botAlias':_0xc674('0x23'),'botName':_0x153b58[0x3],'inputText':this['message'][_0xc674('0x1a')],'userId':this['channel']+':'+this['interaction']['id'][_0xc674('0x24')]()};_0x1f3746[_0xc674('0x25')](_0x2f246f,function(_0x2c7350,_0x335e18){if(_0x2c7350){logger[_0xc674('0x1e')](_0xc674('0x1d'),_0x270ca7,_0x2c7350[_0xc674('0x26')]);_0x1bcd43['next']();}else if(_0x335e18&&_0x335e18[_0xc674('0x26')]){_0x540741[_0xc674('0x1a')]['amazonlex']=_0x335e18;_0x6091b9[_0xc674('0x1a')]=_0x335e18[_0xc674('0x26')];_0x6091b9[_0xc674('0x27')]=_0xc674('0x28');_0x6091b9['providerResponse']=JSON[_0xc674('0x1f')](_0x335e18);return rpc[_0x5882d1+'Message'][_0xc674('0x1c')](_0x6091b9)[_0xc674('0x29')](function(_0x7f69b0){logger[_0xc674('0xb')](_0xc674('0x1d'),_0x270ca7,_0x6091b9[_0xc674('0x1a')]);if(_0x335e18[_0xc674('0x2a')]==_0xc674('0x2b')){_0x1bcd43['next']();}else{_0x1bcd43[_0xc674('0x21')]();}})[_0xc674('0x2c')](function(_0x5dd7c1){logger[_0xc674('0x1e')](_0xc674('0x1d'),_0x270ca7,JSON['stringify'](_0x5dd7c1));_0x1bcd43['next']();});}else{_0x1bcd43[_0xc674('0xc')]();}});}}catch(_0x3ca421){logger[_0xc674('0x1e')](_0xc674('0x1d'),_0x270ca7,JSON[_0xc674('0x1f')](_0x3ca421));_0x1bcd43['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 78eecea..8cf44c0 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 _0x2deb=['consequence','channel','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','info','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','service','host','Smtp','port','secure','authentication','auth','user','pass','inReplyTo','html','','','headers','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','catch','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','update','error','resolve','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc'];(function(_0xd07d08,_0x37a422){var _0x4213e6=function(_0x30a19b){while(--_0x30a19b){_0xd07d08['push'](_0xd07d08['shift']());}};_0x4213e6(++_0x37a422);}(_0x2deb,0x90));var _0xb2de=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2deb[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb2de('0x0'));var moment=require('moment');var utils=require('./utils');var logger=require(_0xb2de('0x1'))(_0xb2de('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xb2de('0x3')),'smsMessage':require(_0xb2de('0x4')),'faxMessage':require(_0xb2de('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xb2de('0x6')),'mailInteraction':require(_0xb2de('0x7')),'smsInteraction':require(_0xb2de('0x8')),'faxInteraction':require(_0xb2de('0x9')),'whatsappInteraction':require(_0xb2de('0xa'))};var mailRpc=require(_0xb2de('0xb'));exports[_0xb2de('0xc')]=function(_0x403c05,_0x19cf41,_0x469862,_0x44a4c7){return function(_0x417804){try{var _0x1c612c=this[_0xb2de('0xd')];if(_0x1c612c===_0xb2de('0xe')&&_0x44a4c7[_0xb2de('0xf')][_0xb2de('0x10')]){logger['info'](_0xb2de('0x11'),_0x403c05,_0xb2de('0x12'));return _0x417804[_0xb2de('0x13')]();}if(_0x19cf41[0x0]==='1'&&(_[_0xb2de('0x14')](this[_0xb2de('0x15')]['created'])||!this['interaction']['created'])){logger[_0xb2de('0x16')](_0xb2de('0x11'),_0x403c05,_0xb2de('0x17'));return _0x417804[_0xb2de('0x13')]();}if(_0x19cf41[0x0]==='2'&&this['interaction'][_0xb2de('0x18')]){logger[_0xb2de('0x16')](_0xb2de('0x19'),_0x403c05,'One\x20Time\x20already\x20sent');return _0x417804[_0xb2de('0x13')]();}var _0x10e9cf={'ContactId':this[_0xb2de('0x1a')]['id'],'sentAt':moment()[_0xb2de('0x1b')](_0xb2de('0x1c')),'direction':_0xb2de('0x1d')};if(this[_0xb2de('0xd')]==='mail'){_0x10e9cf[_0xb2de('0xf')]=utils[_0xb2de('0x1e')](_0x19cf41[0x2],this);}else{_0x10e9cf[_0xb2de('0xf')]=utils[_0xb2de('0x1e')](_0x19cf41[0x1],this);}if(this[_0xb2de('0x1f')]){_0x10e9cf['to']=this['message'][_0xb2de('0x20')]||'';if(this[_0xb2de('0xd')]===_0xb2de('0xe')&&_0x19cf41[0x1]==='1'){_0x10e9cf['cc']=this[_0xb2de('0x1f')]['cc']||'';}_0x10e9cf[_0xb2de('0x20')]=this['message']['to']||'';_0x10e9cf[_0xb2de('0x21')]=this[_0xb2de('0x1f')][_0xb2de('0x21')]||'';_0x10e9cf['read']=!![];if(this[_0xb2de('0x1f')][_0xb2de('0x22')]){_0x10e9cf[_0xb2de('0x22')]='';_0x10e9cf[_0xb2de('0x22')]+=_[_0xb2de('0x23')](this[_0xb2de('0x1f')][_0xb2de('0x22')],_0xb2de('0x24'))?'':_0xb2de('0x25');_0x10e9cf[_0xb2de('0x22')]+=this[_0xb2de('0x1f')][_0xb2de('0x22')];}}if(this[_0xb2de('0xd')]===_0xb2de('0x26')){_0x10e9cf[_0xb2de('0x27')]=this[_0xb2de('0x28')]['id'];}else{_0x10e9cf[_[_0xb2de('0x29')](this['channel'])+_0xb2de('0x2a')]=this[_0xb2de('0x28')]['id'];}_0x10e9cf[_[_0xb2de('0x29')](this[_0xb2de('0xd')])+_0xb2de('0x2b')]=this['interaction']['id'];var _0x33ce44=this['interaction'];if(rpc[this[_0xb2de('0xd')]+_0xb2de('0x2c')]){if(this[_0xb2de('0xd')]===_0xb2de('0xe')){var _0xf8d235={'tls':{'rejectUnauthorized':![]}};if(this['account']['Smtp'][_0xb2de('0x2d')]){_0xf8d235[_0xb2de('0x2d')]=this[_0xb2de('0x28')]['Smtp'][_0xb2de('0x2d')];}else{_0xf8d235[_0xb2de('0x2e')]=this[_0xb2de('0x28')][_0xb2de('0x2f')][_0xb2de('0x2e')];_0xf8d235[_0xb2de('0x30')]=this[_0xb2de('0x28')][_0xb2de('0x2f')][_0xb2de('0x30')];_0xf8d235[_0xb2de('0x31')]=this[_0xb2de('0x28')][_0xb2de('0x2f')]['secure'];}if(this[_0xb2de('0x28')][_0xb2de('0x2f')][_0xb2de('0x32')]){_0xf8d235[_0xb2de('0x33')]={'user':this[_0xb2de('0x28')][_0xb2de('0x2f')][_0xb2de('0x34')],'pass':this[_0xb2de('0x28')][_0xb2de('0x2f')][_0xb2de('0x35')]};}_0x10e9cf[_0xb2de('0x36')]=this[_0xb2de('0x1f')]['messageId'];_0x10e9cf[_0xb2de('0x37')]=_0xb2de('0x38')+_['replace'](_0x10e9cf[_0xb2de('0xf')],_0xb2de('0x39'),_0xb2de('0x3a'))+_0xb2de('0x3b');_0x10e9cf[_0xb2de('0x3c')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0xb2de('0x3d'),'Precedence':_0xb2de('0x3e')};return mailRpc[_0xb2de('0x3f')](_0xf8d235,_0x10e9cf)[_0xb2de('0x40')](function(_0x5dcf8e){logger[_0xb2de('0x16')](_0xb2de('0x41'),_0x403c05);_0x10e9cf['messageId']=_0x5dcf8e[_0xb2de('0x1f')][_0xb2de('0x42')];return rpc[_0x1c612c+_0xb2de('0x2c')][_0xb2de('0x43')](_0x10e9cf);})[_0xb2de('0x40')](function(_0x2bdd28){logger['info']('[%s][AUTOREPLY]\x20%s',_0x403c05,JSON['stringify'](_0x2bdd28));})[_0xb2de('0x44')](function(_0x128ac3){logger['error'](_0xb2de('0x45'),_0x403c05,JSON[_0xb2de('0x46')](_0x128ac3));})[_0xb2de('0x47')](function(){Promise['resolve']()[_0xb2de('0x40')](function(){if(_0x19cf41[0x0]!=='2'||_0x33ce44[_0xb2de('0x18')])return;return rpc[_0x1c612c+'Interaction'][_0xb2de('0x48')](_0x33ce44['id'],{'autoreplyExecuted':!![]})['then'](function(_0x589eea){logger[_0xb2de('0x16')](_0xb2de('0x19'),_0x403c05,JSON[_0xb2de('0x46')](_0x589eea));})[_0xb2de('0x44')](function(_0x46e91f){logger[_0xb2de('0x49')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x403c05,JSON[_0xb2de('0x46')](_0x46e91f));});})[_0xb2de('0x40')](function(){_0x417804[_0xb2de('0x13')]();});});}else{return rpc[this[_0xb2de('0xd')]+'Message'][_0xb2de('0x43')](_0x10e9cf)['then'](function(_0x31bf0f){logger[_0xb2de('0x16')](_0xb2de('0x11'),_0x403c05,_0x10e9cf[_0xb2de('0xf')]);})[_0xb2de('0x44')](function(_0x4e6767){logger[_0xb2de('0x49')](_0xb2de('0x11'),_0x403c05,JSON[_0xb2de('0x46')](_0x4e6767));})[_0xb2de('0x47')](function(){Promise[_0xb2de('0x4a')]()[_0xb2de('0x40')](function(){if(_0x19cf41[0x0]!=='2'||_0x33ce44[_0xb2de('0x18')])return;return rpc[_0x1c612c+_0xb2de('0x4b')][_0xb2de('0x48')](_0x33ce44['id'],{'autoreplyExecuted':!![]})[_0xb2de('0x40')](function(_0x25a981){logger[_0xb2de('0x16')](_0xb2de('0x19'),_0x403c05,JSON['stringify'](_0x25a981));})[_0xb2de('0x44')](function(_0x28d45b){logger[_0xb2de('0x49')](_0xb2de('0x4c'),_0x403c05,JSON[_0xb2de('0x46')](_0x28d45b));});})[_0xb2de('0x40')](function(){_0x417804['next']();});});}}}catch(_0x51a0c5){logger[_0xb2de('0x49')]('[%s][AUTOREPLY]\x20%s',_0x403c05,JSON['stringify'](_0x51a0c5));_0x417804[_0xb2de('0x4d')]();}};}; \ No newline at end of file +var _0x515b=['YYYY-MM-DD\x20HH:mm:ss','out','channel','mail','getMustacheRender','message','from','phone','read','startsWith','subject','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','service','Smtp','host','port','secure','user','pass','inReplyTo','messageId','html','','';_0x7edd84[_0xb515('0x34')]={'Auto-Submitted':_0xb515('0x35'),'X-Auto-Response-Suppress':_0xb515('0x36'),'Precedence':'auto_reply'};return mailRpc[_0xb515('0x37')](_0x17ee42,_0x7edd84)['then'](function(_0x31dca0){logger[_0xb515('0xd')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x205d19);_0x7edd84[_0xb515('0x30')]=_0x31dca0[_0xb515('0x1b')][_0xb515('0x30')];return rpc[_0x4fc0ac+_0xb515('0x38')]['create'](_0x7edd84);})['then'](function(_0x55cf75){logger[_0xb515('0xd')](_0xb515('0xe'),_0x205d19,JSON[_0xb515('0x39')](_0x55cf75));})[_0xb515('0x3a')](function(_0x5cd631){logger['error'](_0xb515('0x3b'),_0x205d19,JSON['stringify'](_0x5cd631));})['finally'](function(){Promise['resolve']()[_0xb515('0x3c')](function(){if(_0x277d9f[0x0]!=='2'||_0x3200f3[_0xb515('0x3d')])return;return rpc[_0x4fc0ac+_0xb515('0x3e')][_0xb515('0x3f')](_0x3200f3['id'],{'autoreplyExecuted':!![]})[_0xb515('0x3c')](function(_0xd911cf){logger[_0xb515('0xd')](_0xb515('0x13'),_0x205d19,JSON['stringify'](_0xd911cf));})[_0xb515('0x3a')](function(_0x18ed8b){logger[_0xb515('0x40')](_0xb515('0x41'),_0x205d19,JSON[_0xb515('0x39')](_0x18ed8b));});})['then'](function(){_0x3bc636['next']();});});}else{return rpc[this['channel']+_0xb515('0x38')][_0xb515('0x42')](_0x7edd84)[_0xb515('0x3c')](function(_0x1e3f89){logger[_0xb515('0xd')](_0xb515('0xe'),_0x205d19,_0x7edd84[_0xb515('0xb')]);})['catch'](function(_0x20f893){logger[_0xb515('0x40')](_0xb515('0xe'),_0x205d19,JSON[_0xb515('0x39')](_0x20f893));})[_0xb515('0x43')](function(){Promise['resolve']()[_0xb515('0x3c')](function(){if(_0x277d9f[0x0]!=='2'||_0x3200f3['autoreplyExecuted'])return;return rpc[_0x4fc0ac+'Interaction'][_0xb515('0x3f')](_0x3200f3['id'],{'autoreplyExecuted':!![]})[_0xb515('0x3c')](function(_0xe1b9a7){logger['info'](_0xb515('0x13'),_0x205d19,JSON[_0xb515('0x39')](_0xe1b9a7));})[_0xb515('0x3a')](function(_0x580e8a){logger[_0xb515('0x40')](_0xb515('0x41'),_0x205d19,JSON[_0xb515('0x39')](_0x580e8a));});})[_0xb515('0x3c')](function(){_0x3bc636[_0xb515('0x10')]();});});}}}catch(_0x7d2a16){logger['error'](_0xb515('0xe'),_0x205d19,JSON['stringify'](_0x7d2a16));_0x3bc636['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 52ad3ab..3bb0621 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 _0x66b9=['stringify','finally','stop','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/faxInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','error','[%s][CLOSE]\x20%s'];(function(_0x1b8352,_0x1c8a85){var _0x89b748=function(_0x14c969){while(--_0x14c969){_0x1b8352['push'](_0x1b8352['shift']());}};_0x89b748(++_0x1c8a85);}(_0x66b9,0x1e6));var _0x966b=function(_0xecafa5,_0x2e7489){_0xecafa5=_0xecafa5-0x0;var _0x868869=_0x66b9[_0xecafa5];return _0x868869;};'use strict';var moment=require('moment');var logger=require(_0x966b('0x0'))(_0x966b('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x966b('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x966b('0x3')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x966b('0x4')]=function(_0x4cfc68,_0x14b516,_0x3bb7cf,_0x3c3a5f){return function(_0x3ca0ae){try{logger['info'](_0x966b('0x5'),_0x4cfc68,_0x14b516[0x0]);var _0x264299={'closed':0x1,'closedAt':moment()[_0x966b('0x6')](_0x966b('0x7')),'closeReason':_0x966b('0x8'),'disposition':_0x14b516[0x0]};if(rpc[_0x3c3a5f[_0x966b('0x9')]+_0x966b('0xa')]){rpc[_0x3c3a5f['channel']+_0x966b('0xa')][_0x966b('0xb')](_0x3c3a5f['interaction']['id'],_0x264299)[_0x966b('0xc')](function(_0x360454){logger[_0x966b('0xd')](_0x966b('0xe'),_0x4cfc68,_0x3c3a5f[_0x966b('0xf')]['id']);})['catch'](function(_0xecef29){logger[_0x966b('0x10')](_0x966b('0x11'),_0x4cfc68,JSON[_0x966b('0x12')](_0xecef29));})[_0x966b('0x13')](function(){_0x3ca0ae['stop']();});}}catch(_0x2761f0){logger[_0x966b('0x10')](_0x966b('0x11'),_0x4cfc68,JSON[_0x966b('0x12')](_0x2761f0));_0x3ca0ae[_0x966b('0x14')]();}};}; \ No newline at end of file +var _0x78bb=['info','[%s][CLOSE]\x20reason\x20%s','format','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify','finally','stop','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction'];(function(_0x4e3e19,_0x1e2781){var _0x457966=function(_0x556497){while(--_0x556497){_0x4e3e19['push'](_0x4e3e19['shift']());}};_0x457966(++_0x1e2781);}(_0x78bb,0x151));var _0xb78b=function(_0x323591,_0x518650){_0x323591=_0x323591-0x0;var _0x423982=_0x78bb[_0x323591];return _0x423982;};'use strict';var moment=require('moment');var logger=require(_0xb78b('0x0'))(_0xb78b('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xb78b('0x2')),'smsInteraction':require(_0xb78b('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xb78b('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports['consequence']=function(_0x29b3b7,_0x43c807,_0x3629b4,_0x384fa7){return function(_0x32eb93){try{logger[_0xb78b('0x5')](_0xb78b('0x6'),_0x29b3b7,_0x43c807[0x0]);var _0x24c4d5={'closed':0x1,'closedAt':moment()[_0xb78b('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':'system','disposition':_0x43c807[0x0]};if(rpc[_0x384fa7['channel']+'Interaction']){rpc[_0x384fa7[_0xb78b('0x8')]+_0xb78b('0x9')][_0xb78b('0xa')](_0x384fa7[_0xb78b('0xb')]['id'],_0x24c4d5)[_0xb78b('0xc')](function(_0x2543ed){logger[_0xb78b('0x5')](_0xb78b('0xd'),_0x29b3b7,_0x384fa7[_0xb78b('0xb')]['id']);})[_0xb78b('0xe')](function(_0x2da87c){logger['error'](_0xb78b('0xf'),_0x29b3b7,JSON[_0xb78b('0x10')](_0x2da87c));})[_0xb78b('0x11')](function(){_0x32eb93[_0xb78b('0x12')]();});}}catch(_0x8b84f5){logger['error']('[%s][CLOSE]\x20%s',_0x29b3b7,JSON[_0xb78b('0x10')](_0x8b84f5));_0x32eb93[_0xb78b('0x12')]();}};}; \ 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 68bc6d8..2c48b52 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 _0x287e=['finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','dialogflow','result','providerName','providerResponse','create','metadata','catch','error','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','body','getMustacheRender','Message','then','stringify'];(function(_0x32f7b0,_0x3a6c05){var _0x248e9c=function(_0x21da81){while(--_0x21da81){_0x32f7b0['push'](_0x32f7b0['shift']());}};_0x248e9c(++_0x3a6c05);}(_0x287e,0x1e3));var _0xe287=function(_0x29149a,_0x3e583e){_0x29149a=_0x29149a-0x0;var _0x3647d8=_0x287e[_0x29149a];return _0x3647d8;};'use strict';var _=require(_0xe287('0x0'));var moment=require(_0xe287('0x1'));var apiai=require(_0xe287('0x2'));var md5=require(_0xe287('0x3'));var utils=require(_0xe287('0x4'));var logger=require(_0xe287('0x5'))(_0xe287('0x6'));var rpc={'chatMessage':require(_0xe287('0x7')),'openchannelMessage':require(_0xe287('0x8')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xe287('0x9')),'faxMessage':require(_0xe287('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x38bd18,_0x482170){return function(_0x4f3cf1){try{if(!_['isNil'](this[_0xe287('0xb')][_0xe287('0xc')])){logger[_0xe287('0xd')](_0xe287('0xe'),_0x38bd18,_0xe287('0xf'));return _0x4f3cf1[_0xe287('0x10')]();}var _0x3a492a={'ContactId':this[_0xe287('0x11')]['id'],'sentAt':moment()[_0xe287('0x12')](_0xe287('0x13')),'direction':_0xe287('0x14')};if(this[_0xe287('0x15')]==='sms'||this[_0xe287('0x15')]==='whatsapp'){_0x3a492a[_0xe287('0x16')]=this['interaction'][_0xe287('0x16')];}var _0x4bfdfc=this[_0xe287('0x15')];if(_0x4bfdfc===_0xe287('0x17')){_0x3a492a[_0xe287('0x18')]=this[_0xe287('0x19')]['id'];}else{_0x3a492a[_[_0xe287('0x1a')](_0x4bfdfc)+'AccountId']=this[_0xe287('0x19')]['id'];}_0x3a492a[_['upperFirst'](_0x4bfdfc)+_0xe287('0x1b')]=this[_0xe287('0xb')]['id'];if(this['interaction'][_0xe287('0x1c')]){var _0x5053e0=_0x482170[0x2];if(!_['isEmpty'](_0x5053e0)){_0x3a492a[_0xe287('0x1d')]=utils[_0xe287('0x1e')](_0x5053e0,this);return rpc[_0x4bfdfc+_0xe287('0x1f')]['create'](_0x3a492a)[_0xe287('0x20')](function(_0x54c679){logger['info'](_0xe287('0xe'),_0x38bd18,_0x3a492a[_0xe287('0x1d')]);})['catch'](function(_0x17f64b){logger['error'](_0xe287('0xe'),_0x38bd18,JSON[_0xe287('0x21')](_0x17f64b));})[_0xe287('0x22')](function(){logger['info'](_0xe287('0x23'),_0x38bd18);_0x4f3cf1[_0xe287('0x24')]();});}else{logger[_0xe287('0xd')](_0xe287('0x25'),_0x38bd18);_0x4f3cf1[_0xe287('0x24')]();}}else{var _0x24b94f=this;var _0x3e971a=apiai(_0x482170[0x0],{'language':_0x482170[0x1]||'en'});return _0x3e971a[_0xe287('0x26')](this['message'][_0xe287('0x1d')],{'sessionId':md5(this[_0xe287('0xb')]['id'])})['then'](function(_0x76665f){_0x24b94f['body'][_0xe287('0x27')]=_0x76665f;_0x3a492a[_0xe287('0x1d')]=_0x76665f[_0xe287('0x28')]['fulfillment']['speech'];_0x3a492a[_0xe287('0x29')]=_0xe287('0x27');_0x3a492a[_0xe287('0x2a')]=JSON[_0xe287('0x21')](_0x76665f);return rpc[_0x4bfdfc+_0xe287('0x1f')][_0xe287('0x2b')](_0x3a492a)[_0xe287('0x20')](function(_0x17fda2){logger['info'](_0xe287('0xe'),_0x38bd18,_0x3a492a['body']);if(_0x76665f[_0xe287('0x28')][_0xe287('0x2c')]['endConversation']){_0x4f3cf1[_0xe287('0x10')]();}else{_0x4f3cf1[_0xe287('0x24')]();}})[_0xe287('0x2d')](function(_0x1b95c5){logger['error'](_0xe287('0xe'),_0x38bd18,JSON[_0xe287('0x21')](_0x1b95c5));_0x4f3cf1[_0xe287('0x10')]();});})['catch'](function(_0x811e53){logger[_0xe287('0x2e')](_0xe287('0xe'),_0x38bd18,_0x811e53['message']);_0x4f3cf1[_0xe287('0x10')]();});}}catch(_0x3f095d){logger[_0xe287('0x2e')](_0xe287('0xe'),_0x38bd18,JSON[_0xe287('0x21')](_0x3f095d));_0x4f3cf1[_0xe287('0x24')]();}};}; \ No newline at end of file +var _0xcbd3=['catch','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','upperFirst','InteractionId','created','body','getMustacheRender','Message','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','create','then','endConversation','next'];(function(_0x31fd34,_0x38eb8f){var _0x574aa4=function(_0x1a7938){while(--_0x1a7938){_0x31fd34['push'](_0x31fd34['shift']());}};_0x574aa4(++_0x38eb8f);}(_0xcbd3,0x1eb));var _0x3cbd=function(_0x5d5c4e,_0x3ccc18){_0x5d5c4e=_0x5d5c4e-0x0;var _0x254320=_0xcbd3[_0x5d5c4e];return _0x254320;};'use strict';var _=require(_0x3cbd('0x0'));var moment=require(_0x3cbd('0x1'));var apiai=require(_0x3cbd('0x2'));var md5=require(_0x3cbd('0x3'));var utils=require(_0x3cbd('0x4'));var logger=require(_0x3cbd('0x5'))(_0x3cbd('0x6'));var rpc={'chatMessage':require(_0x3cbd('0x7')),'openchannelMessage':require(_0x3cbd('0x8')),'mailMessage':require(_0x3cbd('0x9')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x3cbd('0xa')),'whatsappMessage':require(_0x3cbd('0xb'))};exports['consequence']=function(_0x372e19,_0x4e006f){return function(_0x25420f){try{if(!_['isNil'](this[_0x3cbd('0xc')][_0x3cbd('0xd')])){logger[_0x3cbd('0xe')](_0x3cbd('0xf'),_0x372e19,_0x3cbd('0x10'));return _0x25420f['next']();}var _0x37934c={'ContactId':this['contact']['id'],'sentAt':moment()[_0x3cbd('0x11')](_0x3cbd('0x12')),'direction':_0x3cbd('0x13')};if(this['channel']===_0x3cbd('0x14')||this[_0x3cbd('0x15')]===_0x3cbd('0x16')){_0x37934c[_0x3cbd('0x17')]=this['interaction']['phone'];}var _0xc90a9a=this[_0x3cbd('0x15')];if(_0xc90a9a==='chat'){_0x37934c['ChatWebsiteId']=this['account']['id'];}else{_0x37934c[_[_0x3cbd('0x18')](_0xc90a9a)+'AccountId']=this['account']['id'];}_0x37934c[_[_0x3cbd('0x18')](_0xc90a9a)+_0x3cbd('0x19')]=this[_0x3cbd('0xc')]['id'];if(this[_0x3cbd('0xc')][_0x3cbd('0x1a')]){var _0x1114b9=_0x4e006f[0x2];if(!_['isEmpty'](_0x1114b9)){_0x37934c[_0x3cbd('0x1b')]=utils[_0x3cbd('0x1c')](_0x1114b9,this);return rpc[_0xc90a9a+_0x3cbd('0x1d')]['create'](_0x37934c)['then'](function(_0x1727dd){logger['info'](_0x3cbd('0xf'),_0x372e19,_0x37934c[_0x3cbd('0x1b')]);})['catch'](function(_0x5e40e5){logger[_0x3cbd('0x1e')](_0x3cbd('0xf'),_0x372e19,JSON[_0x3cbd('0x1f')](_0x5e40e5));})[_0x3cbd('0x20')](function(){logger[_0x3cbd('0xe')](_0x3cbd('0x21'),_0x372e19);_0x25420f[_0x3cbd('0x22')]();});}else{logger[_0x3cbd('0xe')](_0x3cbd('0x23'),_0x372e19);_0x25420f['stop']();}}else{var _0x543b51=this;var _0x375f0d=apiai(_0x4e006f[0x0],{'language':_0x4e006f[0x1]||'en'});return _0x375f0d[_0x3cbd('0x24')](this[_0x3cbd('0x25')][_0x3cbd('0x1b')],{'sessionId':md5(this[_0x3cbd('0xc')]['id'])})['then'](function(_0x420c46){_0x543b51[_0x3cbd('0x1b')][_0x3cbd('0x26')]=_0x420c46;_0x37934c[_0x3cbd('0x1b')]=_0x420c46[_0x3cbd('0x27')][_0x3cbd('0x28')][_0x3cbd('0x29')];_0x37934c[_0x3cbd('0x2a')]=_0x3cbd('0x26');_0x37934c[_0x3cbd('0x2b')]=JSON[_0x3cbd('0x1f')](_0x420c46);return rpc[_0xc90a9a+_0x3cbd('0x1d')][_0x3cbd('0x2c')](_0x37934c)[_0x3cbd('0x2d')](function(_0x494734){logger[_0x3cbd('0xe')](_0x3cbd('0xf'),_0x372e19,_0x37934c[_0x3cbd('0x1b')]);if(_0x420c46[_0x3cbd('0x27')]['metadata'][_0x3cbd('0x2e')]){_0x25420f[_0x3cbd('0x2f')]();}else{_0x25420f[_0x3cbd('0x22')]();}})['catch'](function(_0x25a1da){logger['error'](_0x3cbd('0xf'),_0x372e19,JSON[_0x3cbd('0x1f')](_0x25a1da));_0x25420f[_0x3cbd('0x2f')]();});})[_0x3cbd('0x30')](function(_0x48029b){logger[_0x3cbd('0x1e')](_0x3cbd('0xf'),_0x372e19,_0x48029b[_0x3cbd('0x25')]);_0x25420f[_0x3cbd('0x2f')]();});}}catch(_0x32d2c9){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x372e19,JSON[_0x3cbd('0x1f')](_0x32d2c9));_0x25420f['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 9cbbe7f..320cb8d 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 _0x1521=['message','detectIntent','length','dialogflowV2','queryResult','fields','diagnosticInfo','boolValue','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','end_conversation','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','providerResponse','fulfillmentText','push','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','consequence','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','getMustacheRender','create','stringify','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient'];(function(_0x2856a1,_0x53bc83){var _0x5e036a=function(_0x377878){while(--_0x377878){_0x2856a1['push'](_0x2856a1['shift']());}};_0x5e036a(++_0x53bc83);}(_0x1521,0x11c));var _0x1152=function(_0x4f4d19,_0x574245){_0x4f4d19=_0x4f4d19-0x0;var _0x27a258=_0x1521[_0x4f4d19];return _0x27a258;};'use strict';var _=require('lodash');var dialogflow=require(_0x1152('0x0'));var md5=require(_0x1152('0x1'));var moment=require(_0x1152('0x2'));var Promise=require(_0x1152('0x3'));var logger=require(_0x1152('0x4'))(_0x1152('0x5'));var utils=require(_0x1152('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x1152('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x1152('0x8')),'faxMessage':require(_0x1152('0x9')),'whatsappMessage':require(_0x1152('0xa'))};function createMessage(_0x49d8b9,_0x1d7275,_0x3d0404,_0x155343){return new Promise(function(_0x594ae0,_0x469d83){var _0x45f68d=_[_0x1152('0xb')](_0x3d0404);_0x45f68d[_0x1152('0xc')]=_0x155343;return rpc[_0x1d7275+_0x1152('0xd')]['create'](_0x45f68d)[_0x1152('0xe')](function(){logger[_0x1152('0xf')](_0x1152('0x10'),_0x49d8b9,_0x45f68d[_0x1152('0xc')]);_0x594ae0();})[_0x1152('0x11')](function(_0x35a924){logger[_0x1152('0x12')](_0x1152('0x10'),_0x49d8b9,JSON['stringify'](_0x35a924));_0x469d83(_0x35a924);});});}exports[_0x1152('0x13')]=function(_0x357087,_0x49f998){return function(_0x563c09){try{if(!_['isNil'](this[_0x1152('0x14')]['UserId'])){logger[_0x1152('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x357087,_0x1152('0x15'));return _0x563c09[_0x1152('0x16')]();}var _0x535afe={'ContactId':this[_0x1152('0x17')]['id'],'sentAt':moment()[_0x1152('0x18')](_0x1152('0x19')),'direction':_0x1152('0x1a')};if(this[_0x1152('0x1b')]==='sms'||this[_0x1152('0x1b')]==='whatsapp'){_0x535afe['phone']=this[_0x1152('0x14')]['phone'];}var _0x48e164=this[_0x1152('0x1b')];if(_0x48e164===_0x1152('0x1c')){_0x535afe[_0x1152('0x1d')]=this[_0x1152('0x1e')]['id'];}else{_0x535afe[_[_0x1152('0x1f')](_0x48e164)+'AccountId']=this[_0x1152('0x1e')]['id'];}_0x535afe[_[_0x1152('0x1f')](_0x48e164)+_0x1152('0x20')]=this[_0x1152('0x14')]['id'];if(this[_0x1152('0x14')][_0x1152('0x21')]){var _0x2475f6=_0x49f998[0x4];if(!_['isEmpty'](_0x2475f6)){_0x535afe[_0x1152('0xc')]=utils[_0x1152('0x22')](_0x2475f6,this);return rpc[_0x48e164+'Message'][_0x1152('0x23')](_0x535afe)[_0x1152('0xe')](function(_0x3193c7){logger[_0x1152('0xf')](_0x1152('0x10'),_0x357087,_0x535afe['body']);})['catch'](function(_0x10ca7e){logger[_0x1152('0x12')](_0x1152('0x10'),_0x357087,JSON[_0x1152('0x24')](_0x10ca7e));})[_0x1152('0x25')](function(){logger[_0x1152('0xf')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x357087);_0x563c09[_0x1152('0x26')]();});}else{logger[_0x1152('0xf')](_0x1152('0x27'),_0x357087);_0x563c09[_0x1152('0x26')]();}}else{var _0x139536=this;var _0x284768=_0x49f998[0x2]['replace'](/\\n/g,'\x0a');var _0x59cd99={'credentials':{'private_key':_0x284768,'client_email':_0x49f998[0x1]}};var _0x3abcd2=new dialogflow[(_0x1152('0x28'))](_0x59cd99);var _0x5e78cf=_0x3abcd2['sessionPath'](_0x49f998[0x0],md5(_0x139536[_0x1152('0x14')]['id']));var _0x3b1596={'session':_0x5e78cf,'queryInput':{'text':{'text':_0x139536[_0x1152('0x29')][_0x1152('0xc')],'languageCode':_0x49f998[0x3]||'en'}}};return _0x3abcd2[_0x1152('0x2a')](_0x3b1596)[_0x1152('0xe')](function(_0x4591dc){if(_0x4591dc&&_0x4591dc[_0x1152('0x2b')]){_0x139536[_0x1152('0xc')][_0x1152('0x2c')]=_0x4591dc;var _0x26cf07=_0x4591dc[0x0];var _0x4c3e41=_0x26cf07['queryResult']['diagnosticInfo']&&_0x26cf07[_0x1152('0x2d')]['diagnosticInfo'][_0x1152('0x2e')]?_0x26cf07[_0x1152('0x2d')][_0x1152('0x2f')][_0x1152('0x2e')]['end_conversation'][_0x1152('0x30')]:![];_0x139536[_0x1152('0xc')]['DIALOGFLOWV2_ACTION']=_0x26cf07[_0x1152('0x2d')][_0x1152('0x31')];_0x139536[_0x1152('0xc')][_0x1152('0x32')]=_0x26cf07[_0x1152('0x2d')][_0x1152('0x33')];_0x139536['body']['DIALOGFLOWV2_ENDCONVERSATION']=_0x26cf07[_0x1152('0x2d')][_0x1152('0x2f')]&&_0x26cf07[_0x1152('0x2d')][_0x1152('0x2f')][_0x1152('0x2e')]?_0x26cf07[_0x1152('0x2d')][_0x1152('0x2f')][_0x1152('0x2e')][_0x1152('0x34')]['boolValue']:![];_0x139536[_0x1152('0xc')][_0x1152('0x35')]=_0x26cf07[_0x1152('0x2d')][_0x1152('0x36')]['name'];_0x139536[_0x1152('0xc')][_0x1152('0x37')]=_0x26cf07[_0x1152('0x2d')]['intent'][_0x1152('0x38')];_0x139536[_0x1152('0xc')][_0x1152('0x39')]=_0x26cf07['queryResult']['intent']['isFallback'];_0x139536[_0x1152('0xc')][_0x1152('0x3a')]=_0x26cf07[_0x1152('0x2d')][_0x1152('0x3b')];_0x139536[_0x1152('0xc')][_0x1152('0x3c')]=_0x26cf07['queryResult']['queryText'];_0x139536[_0x1152('0xc')][_0x1152('0x3d')]=_0x26cf07[_0x1152('0x2d')]['intentDetectionConfidence'];_0x535afe['providerName']=_0x1152('0x2c');_0x535afe[_0x1152('0x3e')]=JSON[_0x1152('0x24')](_0x4591dc);var _0xeef808=[];for(var _0x2bd01c=0x0;_0x2bd01c<_0x4591dc['length'];_0x2bd01c++){var _0x1ee4c8=_0x4591dc[_0x2bd01c];if(_0x1ee4c8&&_0x1ee4c8[_0x1152('0x2d')]&&_0x1ee4c8['queryResult'][_0x1152('0x3f')]){_0xeef808[_0x1152('0x40')](createMessage(_0x357087,_0x48e164,_0x535afe,_0x1ee4c8[_0x1152('0x2d')][_0x1152('0x3f')]));}}return Promise['all'](_0xeef808)[_0x1152('0xe')](function(){if(_0x4c3e41){_0x563c09[_0x1152('0x16')]();}else{_0x563c09[_0x1152('0x26')]();}})[_0x1152('0x11')](function(_0x5ed042){logger[_0x1152('0x12')](_0x1152('0x10'),_0x357087,JSON[_0x1152('0x24')](_0x5ed042));_0x563c09['next']();});}})[_0x1152('0x11')](function(_0x9d00){logger[_0x1152('0x12')](_0x1152('0x10'),_0x357087,_0x9d00[_0x1152('0x29')]);_0x563c09[_0x1152('0x16')]();});}}catch(_0x4bda15){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x357087,JSON[_0x1152('0x24')](_0x4bda15));_0x563c09[_0x1152('0x26')]();}};}; \ No newline at end of file +var _0xa859=['create','then','[%s][DIALOGFLOWV2]\x20%s','catch','error','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','out','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','stringify','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','languageCode','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','fulfillmentText','all','message','lodash','dialogflow','md5','moment','bluebird','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','clone','body','Message'];(function(_0x1200f8,_0xe90878){var _0xfb0e3d=function(_0x2b0e5b){while(--_0x2b0e5b){_0x1200f8['push'](_0x1200f8['shift']());}};_0xfb0e3d(++_0xe90878);}(_0xa859,0x77));var _0x9a85=function(_0x1eff1a,_0x5d05a9){_0x1eff1a=_0x1eff1a-0x0;var _0x478b4b=_0xa859[_0x1eff1a];return _0x478b4b;};'use strict';var _=require(_0x9a85('0x0'));var dialogflow=require(_0x9a85('0x1'));var md5=require(_0x9a85('0x2'));var moment=require(_0x9a85('0x3'));var Promise=require(_0x9a85('0x4'));var logger=require('../../../../config/logger')(_0x9a85('0x5'));var utils=require('./utils');var rpc={'chatMessage':require(_0x9a85('0x6')),'openchannelMessage':require(_0x9a85('0x7')),'mailMessage':require(_0x9a85('0x8')),'smsMessage':require(_0x9a85('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x4b5238,_0x18f40b,_0x5dac3e,_0x23d1d6){return new Promise(function(_0x1433de,_0x57dc49){var _0x425d47=_[_0x9a85('0xa')](_0x5dac3e);_0x425d47[_0x9a85('0xb')]=_0x23d1d6;return rpc[_0x18f40b+_0x9a85('0xc')][_0x9a85('0xd')](_0x425d47)[_0x9a85('0xe')](function(){logger['info'](_0x9a85('0xf'),_0x4b5238,_0x425d47[_0x9a85('0xb')]);_0x1433de();})[_0x9a85('0x10')](function(_0x513c39){logger[_0x9a85('0x11')](_0x9a85('0xf'),_0x4b5238,JSON['stringify'](_0x513c39));_0x57dc49(_0x513c39);});});}exports['consequence']=function(_0x262b0b,_0x2beee2){return function(_0x4d867d){try{if(!_[_0x9a85('0x12')](this[_0x9a85('0x13')][_0x9a85('0x14')])){logger[_0x9a85('0x15')](_0x9a85('0xf'),_0x262b0b,_0x9a85('0x16'));return _0x4d867d[_0x9a85('0x17')]();}var _0x56f554={'ContactId':this[_0x9a85('0x18')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x9a85('0x19')};if(this[_0x9a85('0x1a')]===_0x9a85('0x1b')||this['channel']==='whatsapp'){_0x56f554[_0x9a85('0x1c')]=this[_0x9a85('0x13')][_0x9a85('0x1c')];}var _0x293dbe=this['channel'];if(_0x293dbe===_0x9a85('0x1d')){_0x56f554[_0x9a85('0x1e')]=this[_0x9a85('0x1f')]['id'];}else{_0x56f554[_[_0x9a85('0x20')](_0x293dbe)+_0x9a85('0x21')]=this[_0x9a85('0x1f')]['id'];}_0x56f554[_['upperFirst'](_0x293dbe)+_0x9a85('0x22')]=this['interaction']['id'];if(this[_0x9a85('0x13')][_0x9a85('0x23')]){var _0x28d8ec=_0x2beee2[0x4];if(!_[_0x9a85('0x24')](_0x28d8ec)){_0x56f554[_0x9a85('0xb')]=utils[_0x9a85('0x25')](_0x28d8ec,this);return rpc[_0x293dbe+_0x9a85('0xc')][_0x9a85('0xd')](_0x56f554)[_0x9a85('0xe')](function(_0x4b3a89){logger[_0x9a85('0x15')](_0x9a85('0xf'),_0x262b0b,_0x56f554[_0x9a85('0xb')]);})[_0x9a85('0x10')](function(_0x5883e4){logger[_0x9a85('0x11')](_0x9a85('0xf'),_0x262b0b,JSON[_0x9a85('0x26')](_0x5883e4));})['finally'](function(){logger[_0x9a85('0x15')](_0x9a85('0x27'),_0x262b0b);_0x4d867d[_0x9a85('0x28')]();});}else{logger['info'](_0x9a85('0x29'),_0x262b0b);_0x4d867d['stop']();}}else{var _0x7e501f=this;var _0x42eb0e=_0x2beee2[0x2][_0x9a85('0x2a')](/\\n/g,'\x0a');var _0x5a7d37={'credentials':{'private_key':_0x42eb0e,'client_email':_0x2beee2[0x1]}};var _0xb2a9f0=new dialogflow['SessionsClient'](_0x5a7d37);var _0x3dd876=_0xb2a9f0['sessionPath'](_0x2beee2[0x0],md5(_0x7e501f[_0x9a85('0x13')]['id']));var _0x27a538={'session':_0x3dd876,'queryInput':{'text':{'text':_0x7e501f['message']['body'],'languageCode':_0x2beee2[0x3]||'en'}}};return _0xb2a9f0[_0x9a85('0x2b')](_0x27a538)['then'](function(_0x572c35){if(_0x572c35&&_0x572c35[_0x9a85('0x2c')]){_0x7e501f[_0x9a85('0xb')][_0x9a85('0x2d')]=_0x572c35;var _0x54f2d2=_0x572c35[0x0];var _0x1939f7=_0x54f2d2[_0x9a85('0x2e')][_0x9a85('0x2f')]&&_0x54f2d2[_0x9a85('0x2e')]['diagnosticInfo'][_0x9a85('0x30')]?_0x54f2d2[_0x9a85('0x2e')][_0x9a85('0x2f')]['fields'][_0x9a85('0x31')][_0x9a85('0x32')]:![];_0x7e501f[_0x9a85('0xb')][_0x9a85('0x33')]=_0x54f2d2[_0x9a85('0x2e')]['action'];_0x7e501f[_0x9a85('0xb')][_0x9a85('0x34')]=_0x54f2d2[_0x9a85('0x2e')][_0x9a85('0x35')];_0x7e501f[_0x9a85('0xb')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x54f2d2[_0x9a85('0x2e')][_0x9a85('0x2f')]&&_0x54f2d2['queryResult'][_0x9a85('0x2f')]['fields']?_0x54f2d2['queryResult'][_0x9a85('0x2f')][_0x9a85('0x30')][_0x9a85('0x31')][_0x9a85('0x32')]:![];_0x7e501f[_0x9a85('0xb')][_0x9a85('0x36')]=_0x54f2d2[_0x9a85('0x2e')][_0x9a85('0x37')]['name'];_0x7e501f[_0x9a85('0xb')][_0x9a85('0x38')]=_0x54f2d2[_0x9a85('0x2e')][_0x9a85('0x37')]['displayName'];_0x7e501f[_0x9a85('0xb')][_0x9a85('0x39')]=_0x54f2d2[_0x9a85('0x2e')][_0x9a85('0x37')]['isFallback'];_0x7e501f[_0x9a85('0xb')][_0x9a85('0x3a')]=_0x54f2d2[_0x9a85('0x2e')][_0x9a85('0x3b')];_0x7e501f[_0x9a85('0xb')]['DIALOGFLOWV2_QUERYTEXT']=_0x54f2d2[_0x9a85('0x2e')][_0x9a85('0x3c')];_0x7e501f['body'][_0x9a85('0x3d')]=_0x54f2d2[_0x9a85('0x2e')][_0x9a85('0x3e')];_0x56f554['providerName']=_0x9a85('0x2d');_0x56f554['providerResponse']=JSON['stringify'](_0x572c35);var _0x28d19e=[];for(var _0x3c9b19=0x0;_0x3c9b19<_0x572c35[_0x9a85('0x2c')];_0x3c9b19++){var _0x41d7b8=_0x572c35[_0x3c9b19];if(_0x41d7b8&&_0x41d7b8['queryResult']&&_0x41d7b8[_0x9a85('0x2e')]['fulfillmentText']){_0x28d19e['push'](createMessage(_0x262b0b,_0x293dbe,_0x56f554,_0x41d7b8[_0x9a85('0x2e')][_0x9a85('0x3f')]));}}return Promise[_0x9a85('0x40')](_0x28d19e)[_0x9a85('0xe')](function(){if(_0x1939f7){_0x4d867d[_0x9a85('0x17')]();}else{_0x4d867d[_0x9a85('0x28')]();}})[_0x9a85('0x10')](function(_0x454ef9){logger[_0x9a85('0x11')](_0x9a85('0xf'),_0x262b0b,JSON[_0x9a85('0x26')](_0x454ef9));_0x4d867d[_0x9a85('0x17')]();});}})[_0x9a85('0x10')](function(_0x3d85cd){logger['error'](_0x9a85('0xf'),_0x262b0b,_0x3d85cd[_0x9a85('0x41')]);_0x4d867d[_0x9a85('0x17')]();});}}catch(_0x4908c2){logger['error'](_0x9a85('0xf'),_0x262b0b,JSON[_0x9a85('0x26')](_0x4908c2));_0x4d867d[_0x9a85('0x28')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index a6c1140..40b0a8d 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 _0x26da=['condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','join','stop','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','stringify','validate','lodash','html-to-text','../../../../config/logger','routing','string'];(function(_0x44dba1,_0x270ad5){var _0x2fbd3f=function(_0x5e0865){while(--_0x5e0865){_0x44dba1['push'](_0x44dba1['shift']());}};_0x2fbd3f(++_0x270ad5);}(_0x26da,0x7c));var _0xa26d=function(_0x35c6b5,_0xa0e9da){_0x35c6b5=_0x35c6b5-0x0;var _0x415194=_0x26da[_0x35c6b5];return _0x415194;};'use strict';var schema=require(_0xa26d('0x0'));var _=require(_0xa26d('0x1'));var htmlToText=require(_0xa26d('0x2'));var utils=require('./utils');var logger=require(_0xa26d('0x3'))(_0xa26d('0x4'));var gotoif=schema({'condition':{'type':_0xa26d('0x5'),'required':!![],'message':_0xa26d('0x6')},'priorityTrue':{'type':'number','message':_0xa26d('0x7')},'priorityFalse':{'type':_0xa26d('0x8'),'message':_0xa26d('0x9')}});exports['consequence']=function(_0x56b71e,_0x4ec848){return function(_0x1a96dc){try{var _0x311158={'condition':htmlToText[_0xa26d('0xa')](utils[_0xa26d('0xb')](_0x4ec848[0x0],this),{'wordwrap':![]})[_0xa26d('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4ec848[0x1],'priorityFalse':_0x4ec848[0x2]};var _0x41cd8f=gotoif[_0xa26d('0x0')](_0x311158,{'typecast':!![]});if(_0x41cd8f[_0xa26d('0xd')]){logger[_0xa26d('0xe')](_0xa26d('0xf'),_0x56b71e,_[_0xa26d('0x10')](_0x41cd8f,'message')[_0xa26d('0x11')](',\x20'));_0x1a96dc[_0xa26d('0x12')]();}else{try{var _0x4877a2=eval('('+_0x311158[_0xa26d('0x13')]+')');var _0x166b92=_0x4877a2?_0x311158[_0xa26d('0x14')]:_0x311158['priorityFalse'];logger[_0xa26d('0x15')](_0xa26d('0x16'),_0x56b71e,_0x311158[_0xa26d('0x13')],_0x4877a2,_0x166b92||_0xa26d('0x17'));if(_0x166b92){var _0x4e33c4=_[_0xa26d('0x18')](_0x1a96dc['rules'](),{'p':_0x166b92});if(_0x4e33c4>=0x0){logger[_0xa26d('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x56b71e,_0x166b92||_0xa26d('0x17'),_0x4e33c4);_0x1a96dc['next'](_0x4e33c4);}else{logger[_0xa26d('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x56b71e,_0x166b92||_0xa26d('0x17'));_0x1a96dc[_0xa26d('0x12')]();}}else{_0x1a96dc[_0xa26d('0x17')]();}}catch(_0x15934f){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x56b71e,_0x15934f['message']);_0x1a96dc['stop']();}}}catch(_0x4639ea){logger['error']('[%s][GOTOIF]\x20%s',_0x56b71e,JSON[_0xa26d('0x19')](_0x4639ea));_0x1a96dc[_0xa26d('0x12')]();}};}; \ No newline at end of file +var _0xc932=['rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','lodash','html-to-text','./utils','routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','validate','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex'];(function(_0x46db2,_0x298356){var _0x643fed=function(_0x493dde){while(--_0x493dde){_0x46db2['push'](_0x46db2['shift']());}};_0x643fed(++_0x298356);}(_0xc932,0x147));var _0x2c93=function(_0x421263,_0x18187d){_0x421263=_0x421263-0x0;var _0x34e4b5=_0xc932[_0x421263];return _0x34e4b5;};'use strict';var schema=require('validate');var _=require(_0x2c93('0x0'));var htmlToText=require(_0x2c93('0x1'));var utils=require(_0x2c93('0x2'));var logger=require('../../../../config/logger')(_0x2c93('0x3'));var gotoif=schema({'condition':{'type':_0x2c93('0x4'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x2c93('0x5'),'message':_0x2c93('0x6')},'priorityFalse':{'type':_0x2c93('0x5'),'message':_0x2c93('0x7')}});exports[_0x2c93('0x8')]=function(_0x12b6ce,_0x8d7aa6){return function(_0x1c5178){try{var _0x287412={'condition':htmlToText[_0x2c93('0x9')](utils[_0x2c93('0xa')](_0x8d7aa6[0x0],this),{'wordwrap':![]})[_0x2c93('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x8d7aa6[0x1],'priorityFalse':_0x8d7aa6[0x2]};var _0x3a7d1e=gotoif[_0x2c93('0xc')](_0x287412,{'typecast':!![]});if(_0x3a7d1e['length']){logger[_0x2c93('0xd')](_0x2c93('0xe'),_0x12b6ce,_[_0x2c93('0xf')](_0x3a7d1e,_0x2c93('0x10'))[_0x2c93('0x11')](',\x20'));_0x1c5178[_0x2c93('0x12')]();}else{try{var _0x2f8059=eval('('+_0x287412[_0x2c93('0x13')]+')');var _0x1c6ab4=_0x2f8059?_0x287412['priorityTrue']:_0x287412[_0x2c93('0x14')];logger['info'](_0x2c93('0x15'),_0x12b6ce,_0x287412[_0x2c93('0x13')],_0x2f8059,_0x1c6ab4||_0x2c93('0x16'));if(_0x1c6ab4){var _0x107269=_[_0x2c93('0x17')](_0x1c5178[_0x2c93('0x18')](),{'p':_0x1c6ab4});if(_0x107269>=0x0){logger[_0x2c93('0x19')](_0x2c93('0x1a'),_0x12b6ce,_0x1c6ab4||_0x2c93('0x16'),_0x107269);_0x1c5178[_0x2c93('0x16')](_0x107269);}else{logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x12b6ce,_0x1c6ab4||_0x2c93('0x16'));_0x1c5178['stop']();}}else{_0x1c5178[_0x2c93('0x16')]();}}catch(_0x1d06d2){logger[_0x2c93('0xd')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x12b6ce,_0x1d06d2[_0x2c93('0x10')]);_0x1c5178[_0x2c93('0x12')]();}}}catch(_0x448d3e){logger['error'](_0x2c93('0xe'),_0x12b6ce,JSON['stringify'](_0x448d3e));_0x1c5178['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 9b3493f..515dba0 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 _0x4c32=['consequence','length','error','map','message','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','stop','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'];(function(_0x134b4d,_0x41c314){var _0x1edee4=function(_0x489f27){while(--_0x489f27){_0x134b4d['push'](_0x134b4d['shift']());}};_0x1edee4(++_0x41c314);}(_0x4c32,0x104));var _0x24c3=function(_0x8ba19a,_0x1d2b2b){_0x8ba19a=_0x8ba19a-0x0;var _0x2bd8b4=_0x4c32[_0x8ba19a];return _0x2bd8b4;};'use strict';var schema=require(_0x24c3('0x0'));var _=require(_0x24c3('0x1'));var logger=require(_0x24c3('0x2'))(_0x24c3('0x3'));var gotop=schema({'priority':{'type':_0x24c3('0x4'),'required':!![],'message':_0x24c3('0x5')}});exports[_0x24c3('0x6')]=function(_0x449f3d,_0x40e9fb){return function(_0xafdfc0){try{var _0x29c528={'priority':_0x40e9fb[0x0]};var _0x2715d1=gotop['validate'](_0x29c528,{'typecast':!![]});if(_0x2715d1[_0x24c3('0x7')]){logger[_0x24c3('0x8')]('[%s][GOTOP]\x20%s',_0x449f3d,_[_0x24c3('0x9')](_0x2715d1,_0x24c3('0xa'))['join'](',\x20'));_0xafdfc0['stop']();}else{logger[_0x24c3('0xb')](_0x24c3('0xc'),_0x449f3d,_0x29c528['priority']);if(_0x29c528[_0x24c3('0xd')]){var _0x254f9e=_['findIndex'](_0xafdfc0[_0x24c3('0xe')](),{'p':_0x29c528[_0x24c3('0xd')]});if(_0x254f9e>=0x0){logger[_0x24c3('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x449f3d,_0x29c528[_0x24c3('0xd')]||_0x24c3('0xf'),_0x254f9e);_0xafdfc0['next'](_0x254f9e);}else{logger['info'](_0x24c3('0x10'),_0x449f3d,_0x29c528[_0x24c3('0xd')]||_0x24c3('0xf'));_0xafdfc0['stop']();}}else{_0xafdfc0[_0x24c3('0xf')]();}}}catch(_0x5e72b9){logger[_0x24c3('0x8')](_0x24c3('0x11'),_0x449f3d,JSON['stringify'](_0x5e72b9));_0xafdfc0[_0x24c3('0x12')]();}};}; \ No newline at end of file +var _0xe493=['error','map','message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','info','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','stringify','validate','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0xe493,0xd7));var _0x3e49=function(_0x55e4e7,_0x59036d){_0x55e4e7=_0x55e4e7-0x0;var _0x5608cc=_0xe493[_0x55e4e7];return _0x5608cc;};'use strict';var schema=require(_0x3e49('0x0'));var _=require(_0x3e49('0x1'));var logger=require('../../../../config/logger')(_0x3e49('0x2'));var gotop=schema({'priority':{'type':_0x3e49('0x3'),'required':!![],'message':_0x3e49('0x4')}});exports['consequence']=function(_0x300573,_0x4b02ca){return function(_0x42d787){try{var _0x46a361={'priority':_0x4b02ca[0x0]};var _0xd8c53a=gotop[_0x3e49('0x0')](_0x46a361,{'typecast':!![]});if(_0xd8c53a['length']){logger[_0x3e49('0x5')]('[%s][GOTOP]\x20%s',_0x300573,_[_0x3e49('0x6')](_0xd8c53a,_0x3e49('0x7'))[_0x3e49('0x8')](',\x20'));_0x42d787[_0x3e49('0x9')]();}else{logger['info'](_0x3e49('0xa'),_0x300573,_0x46a361['priority']);if(_0x46a361[_0x3e49('0xb')]){var _0x305212=_[_0x3e49('0xc')](_0x42d787[_0x3e49('0xd')](),{'p':_0x46a361['priority']});if(_0x305212>=0x0){logger['info'](_0x3e49('0xe'),_0x300573,_0x46a361[_0x3e49('0xb')]||_0x3e49('0xf'),_0x305212);_0x42d787[_0x3e49('0xf')](_0x305212);}else{logger[_0x3e49('0x10')](_0x3e49('0x11'),_0x300573,_0x46a361[_0x3e49('0xb')]||'next');_0x42d787[_0x3e49('0x9')]();}}else{_0x42d787[_0x3e49('0xf')]();}}}catch(_0x489255){logger['error'](_0x3e49('0x12'),_0x300573,JSON[_0x3e49('0x13')](_0x489255));_0x42d787[_0x3e49('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 5913d26..dc21afc 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 _0x3e40=['next','catch','error','stop','stringify','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','ChatWebsiteId','account','upperFirst','InteractionId','Message','create','then','info','[%s][MESSAGE]\x20%s','body'];(function(_0x4595c9,_0x40d935){var _0x576e3c=function(_0x139220){while(--_0x139220){_0x4595c9['push'](_0x4595c9['shift']());}};_0x576e3c(++_0x40d935);}(_0x3e40,0xef));var _0x03e4=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x3e40[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0x03e4('0x0'));var utils=require('./utils');var logger=require(_0x03e4('0x1'))(_0x03e4('0x2'));var rpc={'chatMessage':require(_0x03e4('0x3')),'openchannelMessage':require(_0x03e4('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x03e4('0x5')),'faxMessage':require(_0x03e4('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x03e4('0x7')]=function(_0x1422cb,_0xc3aef1){return function(_0x55a049){try{var _0x453eca={'body':utils[_0x03e4('0x8')](_0xc3aef1[0x0],this),'ContactId':this[_0x03e4('0x9')]['id']};if(this[_0x03e4('0xa')]==='chat'){_0x453eca[_0x03e4('0xb')]=this[_0x03e4('0xc')]['id'];}else{_0x453eca[_[_0x03e4('0xd')](this[_0x03e4('0xa')])+'AccountId']=this['account']['id'];}_0x453eca[_[_0x03e4('0xd')](this[_0x03e4('0xa')])+_0x03e4('0xe')]=this['interaction']['id'];if(rpc[this[_0x03e4('0xa')]+_0x03e4('0xf')]){return rpc[this[_0x03e4('0xa')]+_0x03e4('0xf')][_0x03e4('0x10')](_0x453eca)[_0x03e4('0x11')](function(_0x5d3cc6){logger[_0x03e4('0x12')](_0x03e4('0x13'),_0x1422cb,_0x453eca[_0x03e4('0x14')]);_0x55a049[_0x03e4('0x15')]();})[_0x03e4('0x16')](function(_0x4f1ead){logger[_0x03e4('0x17')](_0x03e4('0x13'),_0x1422cb,JSON['stringify'](_0x4f1ead));_0x55a049[_0x03e4('0x18')]();});}}catch(_0x4d5c70){logger[_0x03e4('0x17')](_0x03e4('0x13'),_0x1422cb,JSON[_0x03e4('0x19')](_0x4d5c70));_0x55a049[_0x03e4('0x18')]();}};}; \ No newline at end of file +var _0xa45c=['./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','contact','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','Message','create','info','[%s][MESSAGE]\x20%s','next','error','stringify','stop','lodash'];(function(_0x1028e0,_0x12bf12){var _0x5c89aa=function(_0x58017a){while(--_0x58017a){_0x1028e0['push'](_0x1028e0['shift']());}};_0x5c89aa(++_0x12bf12);}(_0xa45c,0x6d));var _0xca45=function(_0x477557,_0x53bedd){_0x477557=_0x477557-0x0;var _0x13da85=_0xa45c[_0x477557];return _0x13da85;};'use strict';var _=require(_0xca45('0x0'));var utils=require(_0xca45('0x1'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xca45('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xca45('0x3')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xca45('0x4')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x33a162,_0x3803d6){return function(_0x18d789){try{var _0x15628b={'body':utils['getMustacheRender'](_0x3803d6[0x0],this),'ContactId':this[_0xca45('0x5')]['id']};if(this[_0xca45('0x6')]===_0xca45('0x7')){_0x15628b[_0xca45('0x8')]=this[_0xca45('0x9')]['id'];}else{_0x15628b[_['upperFirst'](this[_0xca45('0x6')])+_0xca45('0xa')]=this[_0xca45('0x9')]['id'];}_0x15628b[_[_0xca45('0xb')](this[_0xca45('0x6')])+_0xca45('0xc')]=this[_0xca45('0xd')]['id'];if(rpc[this['channel']+_0xca45('0xe')]){return rpc[this[_0xca45('0x6')]+_0xca45('0xe')][_0xca45('0xf')](_0x15628b)['then'](function(_0x3044b1){logger[_0xca45('0x10')](_0xca45('0x11'),_0x33a162,_0x15628b['body']);_0x18d789[_0xca45('0x12')]();})['catch'](function(_0x22ce19){logger[_0xca45('0x13')](_0xca45('0x11'),_0x33a162,JSON[_0xca45('0x14')](_0x22ce19));_0x18d789[_0xca45('0x15')]();});}}catch(_0x323b19){logger[_0xca45('0x13')]('[%s][MESSAGE]\x20%s',_0x33a162,JSON[_0xca45('0x14')](_0x323b19));_0x18d789['stop']();}};}; \ 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 9c4afa9..f45478e 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 _0x3e57=['consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stop','./utils','../../../../config/logger','routing'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x3e57,0x7f));var _0x73e5=function(_0x15e6fe,_0x1a5c39){_0x15e6fe=_0x15e6fe-0x0;var _0x34894d=_0x3e57[_0x15e6fe];return _0x34894d;};'use strict';var utils=require(_0x73e5('0x0'));var logger=require(_0x73e5('0x1'))(_0x73e5('0x2'));exports[_0x73e5('0x3')]=function(_0x249f84,_0x3e3e3c){return function(_0x17bd08){try{logger[_0x73e5('0x4')](_0x73e5('0x5'),_0x249f84,utils[_0x73e5('0x6')](_0x3e3e3c[0x0],this));_0x17bd08[_0x73e5('0x7')]();}catch(_0x25d55){logger[_0x73e5('0x8')](_0x73e5('0x5'),_0x249f84,JSON['stringify'](_0x25d55));_0x17bd08[_0x73e5('0x9')]();}};}; \ No newline at end of file +var _0x47a4=['getMustacheRender','next','error','stringify','stop','../../../../config/logger','consequence','info','[%s][NOOP]\x20%s'];(function(_0xa28b1a,_0x384f4b){var _0x4c9b78=function(_0x3cf640){while(--_0x3cf640){_0xa28b1a['push'](_0xa28b1a['shift']());}};_0x4c9b78(++_0x384f4b);}(_0x47a4,0xe6));var _0x447a=function(_0x2158fc,_0x17f390){_0x2158fc=_0x2158fc-0x0;var _0x22eb80=_0x47a4[_0x2158fc];return _0x22eb80;};'use strict';var utils=require('./utils');var logger=require(_0x447a('0x0'))('routing');exports[_0x447a('0x1')]=function(_0x2d4985,_0x332a37){return function(_0x2bc5fc){try{logger[_0x447a('0x2')](_0x447a('0x3'),_0x2d4985,utils[_0x447a('0x4')](_0x332a37[0x0],this));_0x2bc5fc[_0x447a('0x5')]();}catch(_0x82ba48){logger[_0x447a('0x6')](_0x447a('0x3'),_0x2d4985,JSON[_0x447a('0x7')](_0x82ba48));_0x2bc5fc[_0x447a('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 8b20850..6193cff 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 _0x5afb=['../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','channel','upperFirst','InteractionId','interaction','MessageId','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','update','catch','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','close','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','seq-queue','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove'];(function(_0x40c9da,_0x5e5716){var _0x53d2c0=function(_0x5bd036){while(--_0x5bd036){_0x40c9da['push'](_0x40c9da['shift']());}};_0x53d2c0(++_0x5e5716);}(_0x5afb,0x1c9));var _0xb5af=function(_0x4539ca,_0x3a07cd){_0x4539ca=_0x4539ca-0x0;var _0x552d4a=_0x5afb[_0x4539ca];return _0x552d4a;};'use strict';var schema=require(_0xb5af('0x0'));var _=require(_0xb5af('0x1'));var util=require('util');var seqqueue=require(_0xb5af('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0xb5af('0x3'));var logger=require(_0xb5af('0x4'))(_0xb5af('0x5'));var strategy=require(_0xb5af('0x6'));config[_0xb5af('0x7')]=_['defaults'](config['redis'],{'host':_0xb5af('0x8'),'port':0x18eb});var io=require(_0xb5af('0x9'))(new Redis(config[_0xb5af('0x7')]));var attributes=['id',_0xb5af('0xa'),_0xb5af('0xb'),_0xb5af('0xc'),_0xb5af('0xd'),_0xb5af('0xe')];function emit(_0x23c788,_0x58405f,_0x19f6a6){io['to'](_0x23c788)[_0xb5af('0xf')](_0x58405f,_0x19f6a6);}function emitChannelQueueInteraction(_0x2a8d85,_0x103552,_0x570130,_0xce8a0c,_0x2fe7ea,_0x49eaf6,_0x5c99bb,_0x4541ba){var _0xcd074d=_['clone'](_0x570130);_0xcd074d[_0xb5af('0xa')]=_0x4541ba;_0xcd074d['queue']=_0x103552;_0xcd074d[_0xb5af('0xb')]=_0xce8a0c;_0xcd074d['id']=_0x2fe7ea;if(_0x49eaf6){_0x5c99bb[util[_0xb5af('0x10')](_0xb5af('0x11'),_0x2a8d85)][_0x2fe7ea]=_[_0xb5af('0x12')](_0xcd074d,attributes);}else{delete _0x5c99bb[util['format']('%sQueuesWaitingInteractions',_0x2a8d85)][_0x2fe7ea];}emit(util[_0xb5af('0x10')](_0xb5af('0x13'),_0x2a8d85,_0x103552),util[_0xb5af('0x10')](_0xb5af('0x14'),_0x2a8d85,_0x49eaf6?_0xb5af('0x15'):_0xb5af('0x16')),_['pick'](_0xcd074d,attributes));}var rpc={'openchannelQueueReport':require(_0xb5af('0x17')),'mailQueueReport':require(_0xb5af('0x18')),'chatQueueReport':require(_0xb5af('0x19')),'smsQueueReport':require(_0xb5af('0x1a')),'faxQueueReport':require(_0xb5af('0x1b')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xb5af('0x1c'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xb5af('0x1d'),'message':_0xb5af('0x1e')}});function startRouting(_0x4d6124,_0xbba3de,_0x387a83,_0x35de5d){if(_0x4d6124&&_0xbba3de&&_0x387a83){_0xbba3de[_0xb5af('0x1f')]+=0x1;var _0x4f5319={'uniqueid':_0x4d6124,'from':_0x387a83[_0xb5af('0x20')]?_0x387a83[_0xb5af('0x20')][_0xb5af('0xd')]:'','joinAt':moment()[_0xb5af('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x387a83[_0xb5af('0x21')]?_0x387a83[_0xb5af('0x21')]['id']:null,'ListId':_0x387a83[_0xb5af('0x22')]?_0x387a83[_0xb5af('0x22')]['id']:null};_0x4f5319[_['upperFirst'](_0x387a83[_0xb5af('0x23')])+'QueueId']=_0xbba3de['id']||null;_0x4f5319[_[_0xb5af('0x24')](_0x387a83[_0xb5af('0x23')])+_0xb5af('0x25')]=_0x387a83['interaction']?_0x387a83[_0xb5af('0x26')]['id']:null;_0x4f5319[_[_0xb5af('0x24')](_0x387a83['channel'])+_0xb5af('0x27')]=_0x387a83['message']?_0x387a83[_0xb5af('0x28')]['id']:null;_0x4f5319[_[_0xb5af('0x24')](_0x387a83['channel'])+(_0x387a83[_0xb5af('0x23')]!==_0xb5af('0x29')?_0xb5af('0x2a'):'WebsiteId')]=_0x387a83[_0xb5af('0xb')]?_0x387a83[_0xb5af('0xb')]['id']:null;logger[_0xb5af('0x2b')](util[_0xb5af('0x10')](_0xb5af('0x2c'),_0x4d6124,_0xbba3de[_0xb5af('0x2d')]));emitChannelQueueInteraction(_0x387a83['channel'],_0xbba3de[_0xb5af('0x2d')],_0x4f5319,_0x387a83['account'][_0xb5af('0x2d')],_0x387a83[_0xb5af('0x28')]['id'],!![],_0x35de5d,_0xbba3de['id']);if(rpc[_0x387a83[_0xb5af('0x23')]+'QueueReport']){return rpc[_0x387a83[_0xb5af('0x23')]+_0xb5af('0x2e')][_0xb5af('0x2f')](_0x4f5319)['catch'](function(_0x16c67c){logger[_0xb5af('0x30')](_0xb5af('0x31'));});}}}function stopRouting(_0x239956,_0x1035ea,_0x11413a,_0x2fbaba){if(_0x239956&&_0x1035ea){_0x1035ea[_0xb5af('0x1f')]-=0x1;var _0x2e9e72={'leaveAt':moment()[_0xb5af('0x10')](_0xb5af('0x32')),'acceptAt':moment()[_0xb5af('0x10')](_0xb5af('0x32')),'reason':_0xb5af('0x33')};logger['info'](util[_0xb5af('0x10')](_0xb5af('0x34'),_0x239956,_0x1035ea['name']));emitChannelQueueInteraction(_0x11413a['channel'],_0x1035ea['name'],_0x11413a[_0xb5af('0x20')],_0x11413a[_0xb5af('0xb')][_0xb5af('0x2d')],_0x11413a[_0xb5af('0x28')]['id'],![],_0x2fbaba,_0x1035ea['id']);if(rpc[_0x11413a[_0xb5af('0x23')]+_0xb5af('0x2e')]){return rpc[_0x11413a[_0xb5af('0x23')]+_0xb5af('0x2e')][_0xb5af('0x35')](_0x239956,_0x2e9e72)[_0xb5af('0x36')](function(_0xb79096){logger[_0xb5af('0x30')]('update\x20queue\x20report');});}}}function endRouting(_0x33fad2,_0x35fd4c,_0x5bca83,_0x1f7c37){if(_0x33fad2&&_0x35fd4c){_0x35fd4c[_0xb5af('0x1f')]-=0x1;var _0x2fafe0={'leaveAt':moment()[_0xb5af('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0xb5af('0x10')](_0xb5af('0x32')),'reason':_0xb5af('0x37')};logger[_0xb5af('0x2b')](util[_0xb5af('0x10')](_0xb5af('0x38'),_0x33fad2,_0x35fd4c[_0xb5af('0x2d')]));emitChannelQueueInteraction(_0x5bca83[_0xb5af('0x23')],_0x35fd4c[_0xb5af('0x2d')],_0x5bca83['body'],_0x5bca83[_0xb5af('0xb')][_0xb5af('0x2d')],_0x5bca83[_0xb5af('0x28')]['id'],![],_0x1f7c37);if(rpc[_0x5bca83[_0xb5af('0x23')]+_0xb5af('0x2e')]){return rpc[_0x5bca83[_0xb5af('0x23')]+_0xb5af('0x2e')]['update'](_0x33fad2,_0x2fafe0)[_0xb5af('0x36')](function(_0x234b08){logger[_0xb5af('0x30')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x3098fc){return function(_0x10d09f){return _0x10d09f[_0xb5af('0x2d')][_0xb5af('0x39')]()===_0x3098fc[_0xb5af('0x39')]();};}exports[_0xb5af('0x3a')]=function(_0xe4519b,_0x5d9a10,_0x212ba0,_0x18b3fc){return function(_0x4e1957){try{var _0x295515={'name':_0x5d9a10[0x0],'timeout':_0x5d9a10[0x1]};var _0x428740=queue['validate'](_0x295515,{'typecast':!![]});if(_0x428740[_0xb5af('0x3b')]){logger['error'](_0xb5af('0x3c'),_0xe4519b,_[_0xb5af('0x3d')](_0x428740,_0xb5af('0x28'))[_0xb5af('0x3e')](',\x20'));_0x4e1957[_0xb5af('0x3f')]();}else{var _0x144fc7=_[_0xb5af('0x40')](_0x212ba0[_0x18b3fc[_0xb5af('0x23')]+_0xb5af('0x41')],handleFindQueue(_0x295515[_0xb5af('0x2d')]));if(_0x144fc7){startRouting(_0xe4519b,_0x144fc7,_0x18b3fc,_0x212ba0);var _0x141b5c=(_0x144fc7[_0xb5af('0x37')]||0xa)*0x3e8;var _0x29fa8a=(_0x295515[_0xb5af('0x37')]||0x14)*0x3e8;var _0x61d2f4,_0x4e4c56;if(_0x141b5c>_0x29fa8a){_0x29fa8a=_0x141b5c;}var _0x1b01e5=seqqueue[_0xb5af('0x42')](_0x141b5c);_0x1b01e5['id']=_0xe4519b;_0x1b01e5[_0xb5af('0x43')]=_0x141b5c;_0x1b01e5[_0xb5af('0x44')]=_0x29fa8a;_0x1b01e5[_0xb5af('0x23')]=_0x18b3fc[_0xb5af('0x23')];_0x212ba0[_0xb5af('0x45')][_0xe4519b]['on'](_0xb5af('0x46'),function(){logger[_0xb5af('0x2b')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0xe4519b);stopRouting(_0xe4519b,_0x144fc7,_0x18b3fc,_0x212ba0);clearTimeout(_0x61d2f4);_0x61d2f4=undefined;_0x1b01e5[_0xb5af('0x47')](!![]);if(_0x212ba0[_0xb5af('0x45')][_0xe4519b]){delete _0x212ba0[_0xb5af('0x45')][_0xe4519b];}_0x4e1957['stop']();});_0x212ba0['rules'][_0xe4519b]['on']('complete',function(){if(_0x212ba0[_0xb5af('0x45')][_0xe4519b]){delete _0x212ba0[_0xb5af('0x45')][_0xe4519b];}});_0x61d2f4=setTimeout(function(){logger[_0xb5af('0x2b')](_0xb5af('0x48'),_0xe4519b);endRouting(_0xe4519b,_0x144fc7,_0x18b3fc,_0x212ba0);clearTimeout(_0x61d2f4);_0x1b01e5['close'](!![]);_0x4e1957[_0xb5af('0x49')]();},_0x29fa8a);switch(_0x144fc7[_0xb5af('0x4a')]){case _0xb5af('0x4b'):strategy[_0xb5af('0x4b')](_0x1b01e5,_0x144fc7,_0x212ba0,_0x18b3fc);break;default:strategy[_0xb5af('0x4c')](_0x1b01e5,_0x144fc7,_0x212ba0,_0x18b3fc);}}else{logger['error'](_0xb5af('0x4d'),_0xe4519b,_0x295515[_0xb5af('0x2d')]);_0x4e1957[_0xb5af('0x3f')]();}}}catch(_0x1f92a4){console[_0xb5af('0x4e')](_0x1f92a4);logger['error'](_0xb5af('0x3c'),_0xe4519b,_0x1f92a4[_0xb5af('0x4f')]);_0x4e1957[_0xb5af('0x3f')]();}};}; \ No newline at end of file +var _0x765b=['find','Queues','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','next','strategy','rrmemory','log','[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','redis','localhost','socket.io-emitter','queue_id','account','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','InteractionId','interaction','MessageId','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','join','stop'];(function(_0x1f8ddf,_0x44819e){var _0x4e0844=function(_0x2963c7){while(--_0x2963c7){_0x1f8ddf['push'](_0x1f8ddf['shift']());}};_0x4e0844(++_0x44819e);}(_0x765b,0xa3));var _0xb765=function(_0x1afabf,_0x56fdcc){_0x1afabf=_0x1afabf-0x0;var _0x497ff1=_0x765b[_0x1afabf];return _0x497ff1;};'use strict';var schema=require(_0xb765('0x0'));var _=require(_0xb765('0x1'));var util=require('util');var seqqueue=require(_0xb765('0x2'));var moment=require(_0xb765('0x3'));var Redis=require('ioredis');var config=require(_0xb765('0x4'));var logger=require(_0xb765('0x5'))(_0xb765('0x6'));var strategy=require('./strategy');config[_0xb765('0x7')]=_['defaults'](config[_0xb765('0x7')],{'host':_0xb765('0x8'),'port':0x18eb});var io=require(_0xb765('0x9'))(new Redis(config['redis']));var attributes=['id',_0xb765('0xa'),_0xb765('0xb'),'queue',_0xb765('0xc'),_0xb765('0xd')];function emit(_0x118348,_0x4c7c37,_0x493ced){io['to'](_0x118348)[_0xb765('0xe')](_0x4c7c37,_0x493ced);}function emitChannelQueueInteraction(_0x5e9b0b,_0x34c3e0,_0x5c2ddc,_0x1efa21,_0x40b3c6,_0x3347a0,_0x28fd5b,_0x1030cc){var _0x3fbbe2=_[_0xb765('0xf')](_0x5c2ddc);_0x3fbbe2[_0xb765('0xa')]=_0x1030cc;_0x3fbbe2['queue']=_0x34c3e0;_0x3fbbe2[_0xb765('0xb')]=_0x1efa21;_0x3fbbe2['id']=_0x40b3c6;if(_0x3347a0){_0x28fd5b[util[_0xb765('0x10')](_0xb765('0x11'),_0x5e9b0b)][_0x40b3c6]=_[_0xb765('0x12')](_0x3fbbe2,attributes);}else{delete _0x28fd5b[util['format']('%sQueuesWaitingInteractions',_0x5e9b0b)][_0x40b3c6];}emit(util[_0xb765('0x10')]('%s:queue:%s',_0x5e9b0b,_0x34c3e0),util['format']('%s_queue_waiting_interaction:%s',_0x5e9b0b,_0x3347a0?'save':'remove'),_['pick'](_0x3fbbe2,attributes));}var rpc={'openchannelQueueReport':require(_0xb765('0x13')),'mailQueueReport':require(_0xb765('0x14')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xb765('0x15')),'faxQueueReport':require(_0xb765('0x16')),'whatsappQueueReport':require(_0xb765('0x17'))};var queue=schema({'name':{'type':_0xb765('0x18'),'required':!![],'message':_0xb765('0x19')},'timeout':{'type':'number','message':_0xb765('0x1a')}});function startRouting(_0x25d729,_0x17c7cb,_0x18916c,_0x4d9b14){if(_0x25d729&&_0x17c7cb&&_0x18916c){_0x17c7cb[_0xb765('0x1b')]+=0x1;var _0x70c1f3={'uniqueid':_0x25d729,'from':_0x18916c[_0xb765('0x1c')]?_0x18916c[_0xb765('0x1c')]['from']:'','joinAt':moment()[_0xb765('0x10')](_0xb765('0x1d')),'ContactId':_0x18916c[_0xb765('0x1e')]?_0x18916c[_0xb765('0x1e')]['id']:null,'ListId':_0x18916c['list']?_0x18916c[_0xb765('0x1f')]['id']:null};_0x70c1f3[_[_0xb765('0x20')](_0x18916c[_0xb765('0x21')])+'QueueId']=_0x17c7cb['id']||null;_0x70c1f3[_[_0xb765('0x20')](_0x18916c[_0xb765('0x21')])+_0xb765('0x22')]=_0x18916c[_0xb765('0x23')]?_0x18916c[_0xb765('0x23')]['id']:null;_0x70c1f3[_[_0xb765('0x20')](_0x18916c[_0xb765('0x21')])+_0xb765('0x24')]=_0x18916c[_0xb765('0x25')]?_0x18916c['message']['id']:null;_0x70c1f3[_[_0xb765('0x20')](_0x18916c[_0xb765('0x21')])+(_0x18916c[_0xb765('0x21')]!==_0xb765('0x26')?_0xb765('0x27'):'WebsiteId')]=_0x18916c[_0xb765('0xb')]?_0x18916c[_0xb765('0xb')]['id']:null;logger[_0xb765('0x28')](util['format'](_0xb765('0x29'),_0x25d729,_0x17c7cb['name']));emitChannelQueueInteraction(_0x18916c[_0xb765('0x21')],_0x17c7cb[_0xb765('0x2a')],_0x70c1f3,_0x18916c[_0xb765('0xb')]['name'],_0x18916c[_0xb765('0x25')]['id'],!![],_0x4d9b14,_0x17c7cb['id']);if(rpc[_0x18916c[_0xb765('0x21')]+_0xb765('0x2b')]){return rpc[_0x18916c[_0xb765('0x21')]+_0xb765('0x2b')][_0xb765('0x2c')](_0x70c1f3)[_0xb765('0x2d')](function(_0x210792){logger['error'](_0xb765('0x2e'));});}}}function stopRouting(_0x3b036e,_0x3eb2b1,_0x282a43,_0x47663b){if(_0x3b036e&&_0x3eb2b1){_0x3eb2b1[_0xb765('0x1b')]-=0x1;var _0x23668a={'leaveAt':moment()[_0xb765('0x10')](_0xb765('0x1d')),'acceptAt':moment()['format'](_0xb765('0x1d')),'reason':_0xb765('0x2f')};logger[_0xb765('0x28')](util[_0xb765('0x10')](_0xb765('0x30'),_0x3b036e,_0x3eb2b1['name']));emitChannelQueueInteraction(_0x282a43[_0xb765('0x21')],_0x3eb2b1[_0xb765('0x2a')],_0x282a43['body'],_0x282a43[_0xb765('0xb')]['name'],_0x282a43[_0xb765('0x25')]['id'],![],_0x47663b,_0x3eb2b1['id']);if(rpc[_0x282a43[_0xb765('0x21')]+'QueueReport']){return rpc[_0x282a43[_0xb765('0x21')]+_0xb765('0x2b')][_0xb765('0x31')](_0x3b036e,_0x23668a)[_0xb765('0x2d')](function(_0x3ef917){logger[_0xb765('0x32')](_0xb765('0x33'));});}}}function endRouting(_0x3adcf1,_0x2d967a,_0x210e99,_0x57b78b){if(_0x3adcf1&&_0x2d967a){_0x2d967a[_0xb765('0x1b')]-=0x1;var _0x5394f3={'leaveAt':moment()[_0xb765('0x10')](_0xb765('0x1d')),'exitAt':moment()[_0xb765('0x10')](_0xb765('0x1d')),'reason':_0xb765('0x34')};logger[_0xb765('0x28')](util[_0xb765('0x10')](_0xb765('0x35'),_0x3adcf1,_0x2d967a[_0xb765('0x2a')]));emitChannelQueueInteraction(_0x210e99[_0xb765('0x21')],_0x2d967a[_0xb765('0x2a')],_0x210e99[_0xb765('0x1c')],_0x210e99[_0xb765('0xb')]['name'],_0x210e99[_0xb765('0x25')]['id'],![],_0x57b78b);if(rpc[_0x210e99['channel']+'QueueReport']){return rpc[_0x210e99[_0xb765('0x21')]+'QueueReport'][_0xb765('0x31')](_0x3adcf1,_0x5394f3)[_0xb765('0x2d')](function(_0xb822f){logger[_0xb765('0x32')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x52e312){return function(_0x13c8fb){return _0x13c8fb[_0xb765('0x2a')][_0xb765('0x36')]()===_0x52e312['toLowerCase']();};}exports[_0xb765('0x37')]=function(_0x49b762,_0x5c0247,_0x324990,_0x409842){return function(_0x26b726){try{var _0x532455={'name':_0x5c0247[0x0],'timeout':_0x5c0247[0x1]};var _0x522ae3=queue[_0xb765('0x0')](_0x532455,{'typecast':!![]});if(_0x522ae3[_0xb765('0x38')]){logger[_0xb765('0x32')]('[%s][QUEUE]\x20%s',_0x49b762,_['map'](_0x522ae3,_0xb765('0x25'))[_0xb765('0x39')](',\x20'));_0x26b726[_0xb765('0x3a')]();}else{var _0x452a9c=_[_0xb765('0x3b')](_0x324990[_0x409842[_0xb765('0x21')]+_0xb765('0x3c')],handleFindQueue(_0x532455[_0xb765('0x2a')]));if(_0x452a9c){startRouting(_0x49b762,_0x452a9c,_0x409842,_0x324990);var _0x316c90=(_0x452a9c[_0xb765('0x34')]||0xa)*0x3e8;var _0x2b0dfe=(_0x532455[_0xb765('0x34')]||0x14)*0x3e8;var _0x527e08,_0x4c92a8;if(_0x316c90>_0x2b0dfe){_0x2b0dfe=_0x316c90;}var _0x2453eb=seqqueue['createQueue'](_0x316c90);_0x2453eb['id']=_0x49b762;_0x2453eb[_0xb765('0x3d')]=_0x316c90;_0x2453eb[_0xb765('0x3e')]=_0x2b0dfe;_0x2453eb[_0xb765('0x21')]=_0x409842[_0xb765('0x21')];_0x324990[_0xb765('0x3f')][_0x49b762]['on'](_0xb765('0x40'),function(){logger['info'](_0xb765('0x41'),_0x49b762);stopRouting(_0x49b762,_0x452a9c,_0x409842,_0x324990);clearTimeout(_0x527e08);_0x527e08=undefined;_0x2453eb[_0xb765('0x42')](!![]);if(_0x324990[_0xb765('0x3f')][_0x49b762]){delete _0x324990[_0xb765('0x3f')][_0x49b762];}_0x26b726[_0xb765('0x3a')]();});_0x324990[_0xb765('0x3f')][_0x49b762]['on'](_0xb765('0x43'),function(){if(_0x324990[_0xb765('0x3f')][_0x49b762]){delete _0x324990[_0xb765('0x3f')][_0x49b762];}});_0x527e08=setTimeout(function(){logger[_0xb765('0x28')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x49b762);endRouting(_0x49b762,_0x452a9c,_0x409842,_0x324990);clearTimeout(_0x527e08);_0x2453eb[_0xb765('0x42')](!![]);_0x26b726[_0xb765('0x44')]();},_0x2b0dfe);switch(_0x452a9c[_0xb765('0x45')]){case _0xb765('0x46'):strategy[_0xb765('0x46')](_0x2453eb,_0x452a9c,_0x324990,_0x409842);break;default:strategy['beepall'](_0x2453eb,_0x452a9c,_0x324990,_0x409842);}}else{logger[_0xb765('0x32')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x49b762,_0x532455[_0xb765('0x2a')]);_0x26b726[_0xb765('0x3a')]();}}}catch(_0x46265d){console[_0xb765('0x47')](_0x46265d);logger[_0xb765('0x32')](_0xb765('0x48'),_0x49b762,_0x46265d[_0xb765('0x49')]);_0x26b726[_0xb765('0x3a')]();}};}; \ 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 08995ee..7e9054a 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 _0xffff=['agent','realtime','routing','push','handleTimeout','bind','handleDrained','handleRun','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','agents','busyQueue','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','writeLog','STOP','TIMEOUT','exports','./util','notificationId','squeue'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xffff,0x1dd));var _0xffff=function(_0x4a3dd2,_0xdd4a79){_0x4a3dd2=_0x4a3dd2-0x0;var _0x56b304=_0xffff[_0x4a3dd2];return _0x56b304;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0xffff('0x0'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x92dc06,_0x4c17a8,_0x37416b,_0x4375a9){this[_0xffff('0x1')]=uuid['v4']();this[_0xffff('0x2')]=_0x92dc06;this[_0xffff('0x3')]=_0x4c17a8;this[_0xffff('0x4')]=_0x37416b;this[_0xffff('0x5')]=_0x4375a9;this['squeue'][_0xffff('0x6')](this['handleRun']['bind'](this),this[_0xffff('0x7')]['bind'](this));this['squeue']['on']('timeout',this[_0xffff('0x7')][_0xffff('0x8')](this));this[_0xffff('0x2')]['on']('drained',this[_0xffff('0x9')]['bind'](this));};Agent['prototype'][_0xffff('0x6')]=function(){this['squeue'][_0xffff('0x6')](this[_0xffff('0xa')][_0xffff('0x8')](this),this[_0xffff('0x7')][_0xffff('0x8')](this));};Agent[_0xffff('0xb')][_0xffff('0x9')]=function(){this[_0xffff('0x7')](!![]);};Agent[_0xffff('0xb')]['handleRun']=function(_0x4df8c2){logger[_0xffff('0xc')](_0xffff('0xd'),this[_0xffff('0x2')]['id'],this['agent']['id']);if(_[_0xffff('0xe')](this[_0xffff('0x4')]['agents'][this['agent']['id']])){logger['info'](_0xffff('0xf'),this['squeue']['id'],this['agent']['id']);setTimeout(this['push'][_0xffff('0x8')](this),0x3e8);}else{if(this[_0xffff('0x5')][_0xffff('0x10')]||util['isAgentAvailable'](this[_0xffff('0x2')]['id'],this['realtime'][_0xffff('0x11')][this[_0xffff('0x3')]['id']],this[_0xffff('0x2')]['channel'],![])){this[_0xffff('0x4')][_0xffff('0x11')][this['agent']['id']]['busy']=!![];this[_0xffff('0x4')][_0xffff('0x11')][this['agent']['id']][_0xffff('0x12')]=undefined;util[_0xffff('0x13')](this[_0xffff('0x1')],this[_0xffff('0x2')]['id'],this[_0xffff('0x4')]['agents'][this['agent']['id']],null,this[_0xffff('0x5')]);util['writeLog'](this[_0xffff('0x2')]['id'],this[_0xffff('0x4')][_0xffff('0x11')][this[_0xffff('0x3')]['id']],_0xffff('0x14')+(this['routing'][_0xffff('0x10')]?_0xffff('0x15'):''));}else{logger[_0xffff('0xc')](_0xffff('0x16'),this['squeue']['id'],this[_0xffff('0x3')]['id']);setTimeout(this[_0xffff('0x6')][_0xffff('0x8')](this),0x3e8);}}};Agent[_0xffff('0xb')][_0xffff('0x7')]=function(_0x169eb4){if(_[_0xffff('0xe')](this[_0xffff('0x4')][_0xffff('0x11')][this[_0xffff('0x3')]['id']])){return logger[_0xffff('0xc')](_0xffff('0xf'),this[_0xffff('0x2')]['id'],this[_0xffff('0x3')]['id']);}else{logger[_0xffff('0xc')](_0xffff('0x17'),this[_0xffff('0x2')]['id'],this[_0xffff('0x3')]['id']);util[_0xffff('0x18')](this['notificationId'],this[_0xffff('0x2')]['id'],this['realtime'][_0xffff('0x11')][this[_0xffff('0x3')]['id']],null,this[_0xffff('0x5')]);this[_0xffff('0x4')][_0xffff('0x11')][this[_0xffff('0x3')]['id']][_0xffff('0x19')]=![];this['realtime'][_0xffff('0x11')][this['agent']['id']][_0xffff('0x12')]=undefined;util[_0xffff('0x1a')](this['squeue']['id'],this['realtime'][_0xffff('0x11')][this['agent']['id']],_0x169eb4?_0xffff('0x1b'):_0xffff('0x1c'));}if(!_0x169eb4){setTimeout(this[_0xffff('0x6')][_0xffff('0x8')](this),0x3e8);}};function agent(_0xd70896,_0x218468,_0x494743,_0x2644b9){return new Agent(_0xd70896,_0x218468,_0x494743,_0x2644b9);}module[_0xffff('0x1d')]=agent; \ No newline at end of file +var _0x3d65=[':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','bind','handleTimeout','handleDrained','prototype','handleRun','info','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busy','busyQueue','writeLog'];(function(_0x53e751,_0x1613e4){var _0x4448b5=function(_0x462e09){while(--_0x462e09){_0x53e751['push'](_0x53e751['shift']());}};_0x4448b5(++_0x1613e4);}(_0x3d65,0x114));var _0x53d6=function(_0x338c61,_0x1aa1e6){_0x338c61=_0x338c61-0x0;var _0x2136c6=_0x3d65[_0x338c61];return _0x2136c6;};'use strict';var _=require(_0x53d6('0x0'));var uuid=require(_0x53d6('0x1'));var util=require(_0x53d6('0x2'));var logger=require(_0x53d6('0x3'))(_0x53d6('0x4'));var Agent=function(_0x58751e,_0x3d1a5b,_0x25ebae,_0x2bca26){this[_0x53d6('0x5')]=uuid['v4']();this[_0x53d6('0x6')]=_0x58751e;this[_0x53d6('0x7')]=_0x3d1a5b;this[_0x53d6('0x8')]=_0x25ebae;this['routing']=_0x2bca26;this[_0x53d6('0x6')][_0x53d6('0x9')](this['handleRun'][_0x53d6('0xa')](this),this[_0x53d6('0xb')][_0x53d6('0xa')](this));this[_0x53d6('0x6')]['on']('timeout',this[_0x53d6('0xb')][_0x53d6('0xa')](this));this[_0x53d6('0x6')]['on']('drained',this[_0x53d6('0xc')][_0x53d6('0xa')](this));};Agent[_0x53d6('0xd')][_0x53d6('0x9')]=function(){this[_0x53d6('0x6')][_0x53d6('0x9')](this[_0x53d6('0xe')][_0x53d6('0xa')](this),this[_0x53d6('0xb')][_0x53d6('0xa')](this));};Agent['prototype'][_0x53d6('0xc')]=function(){this[_0x53d6('0xb')](!![]);};Agent['prototype'][_0x53d6('0xe')]=function(_0x4f51cc){logger[_0x53d6('0xf')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x53d6('0x6')]['id'],this[_0x53d6('0x7')]['id']);if(_[_0x53d6('0x10')](this[_0x53d6('0x8')][_0x53d6('0x11')][this[_0x53d6('0x7')]['id']])){logger[_0x53d6('0xf')](_0x53d6('0x12'),this[_0x53d6('0x6')]['id'],this[_0x53d6('0x7')]['id']);setTimeout(this['push'][_0x53d6('0xa')](this),0x3e8);}else{if(this['routing'][_0x53d6('0x13')]||util['isAgentAvailable'](this['squeue']['id'],this['realtime'][_0x53d6('0x11')][this[_0x53d6('0x7')]['id']],this[_0x53d6('0x6')][_0x53d6('0x14')],![])){this[_0x53d6('0x8')][_0x53d6('0x11')][this['agent']['id']][_0x53d6('0x15')]=!![];this[_0x53d6('0x8')][_0x53d6('0x11')][this[_0x53d6('0x7')]['id']][_0x53d6('0x16')]=undefined;util['showNotification'](this[_0x53d6('0x5')],this[_0x53d6('0x6')]['id'],this[_0x53d6('0x8')]['agents'][this['agent']['id']],null,this[_0x53d6('0x4')]);util[_0x53d6('0x17')](this[_0x53d6('0x6')]['id'],this[_0x53d6('0x8')][_0x53d6('0x11')][this['agent']['id']],'RINGING'+(this['routing'][_0x53d6('0x13')]?_0x53d6('0x18'):''));}else{logger[_0x53d6('0xf')](_0x53d6('0x19'),this[_0x53d6('0x6')]['id'],this[_0x53d6('0x7')]['id']);setTimeout(this[_0x53d6('0x9')]['bind'](this),0x3e8);}}};Agent['prototype'][_0x53d6('0xb')]=function(_0x962801){if(_['isNil'](this[_0x53d6('0x8')]['agents'][this[_0x53d6('0x7')]['id']])){return logger[_0x53d6('0xf')](_0x53d6('0x12'),this[_0x53d6('0x6')]['id'],this[_0x53d6('0x7')]['id']);}else{logger[_0x53d6('0xf')](_0x53d6('0x1a'),this[_0x53d6('0x6')]['id'],this[_0x53d6('0x7')]['id']);util[_0x53d6('0x1b')](this[_0x53d6('0x5')],this[_0x53d6('0x6')]['id'],this[_0x53d6('0x8')][_0x53d6('0x11')][this[_0x53d6('0x7')]['id']],null,this[_0x53d6('0x4')]);this[_0x53d6('0x8')][_0x53d6('0x11')][this['agent']['id']][_0x53d6('0x15')]=![];this[_0x53d6('0x8')][_0x53d6('0x11')][this['agent']['id']][_0x53d6('0x16')]=undefined;util[_0x53d6('0x17')](this['squeue']['id'],this[_0x53d6('0x8')][_0x53d6('0x11')][this[_0x53d6('0x7')]['id']],_0x962801?_0x53d6('0x1c'):'TIMEOUT');}if(!_0x962801){setTimeout(this['push'][_0x53d6('0xa')](this),0x3e8);}};function agent(_0x23d591,_0x3a47cc,_0x4f796f,_0x12ee71){return new Agent(_0x23d591,_0x3a47cc,_0x4f796f,_0x12ee71);}module[_0x53d6('0x1d')]=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 09814bd..ea42a30 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 _0xae1c=['drained','prototype','handleTimeout','handleDrained','isNil','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','RINGING','busy','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','writeLog','STOP','TIMEOUT','exports','routing','notificationId','squeue','queue','realtime','push','handleRun','bind','timeout'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xae1c,0xff));var _0xcae1=function(_0x3ad2be,_0x36fe53){_0x3ad2be=_0x3ad2be-0x0;var _0xefbd6a=_0xae1c[_0x3ad2be];return _0xefbd6a;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require('./util');var logger=require('../../../../../config/logger')(_0xcae1('0x0'));var Beepall=function(_0x19e218,_0x3e2e25,_0x32bfaa,_0x1d37db){this[_0xcae1('0x1')]=uuid['v4']();this[_0xcae1('0x2')]=_0x19e218;this[_0xcae1('0x3')]=_0x3e2e25;this[_0xcae1('0x4')]=_0x32bfaa;this[_0xcae1('0x0')]=_0x1d37db;this[_0xcae1('0x2')][_0xcae1('0x5')](this[_0xcae1('0x6')]['bind'](this),this['handleTimeout'][_0xcae1('0x7')](this));this[_0xcae1('0x2')]['on'](_0xcae1('0x8'),this['handleTimeout'][_0xcae1('0x7')](this));this[_0xcae1('0x2')]['on'](_0xcae1('0x9'),this['handleDrained'][_0xcae1('0x7')](this));};Beepall[_0xcae1('0xa')]['push']=function(){this['squeue'][_0xcae1('0x5')](this[_0xcae1('0x6')][_0xcae1('0x7')](this),this[_0xcae1('0xb')][_0xcae1('0x7')](this));};Beepall[_0xcae1('0xa')][_0xcae1('0xc')]=function(_0x17e2a8){this[_0xcae1('0xb')](!![]);};Beepall[_0xcae1('0xa')][_0xcae1('0x6')]=function(_0x203741){var _0x433294=!![];if(!_[_0xcae1('0xd')](this[_0xcae1('0x3')])&&!_['isNil'](this[_0xcae1('0x3')][_0xcae1('0xe')])&&this['queue']['Agents'][_0xcae1('0xf')]>0x0){for(var _0x143c21=0x0,_0x598852;_0x143c210x0){for(var _0x3f9a6b=0x0,_0x1b7870;_0x3f9a6b0x0&&_0x2bbbcb[_0x16bd22+_0x5029('0x1f')]>=_0x2bbbcb[_0x16bd22+_0x5029('0x1e')]){writeLog(_0x1eb228,_0x2bbbcb,_0x16bd22['toUpperCase']()+_0x5029('0x20'));return![];}}return!![];};exports[_0x5029('0x21')]=function(_0x5e45c4,_0x2b6d99,_0x31f0a0,_0x16ad8b,_0x4a24b9){return sendNotification(!![],_0x5e45c4,_0x2b6d99,_0x31f0a0,_0x16ad8b,_0x4a24b9);};exports[_0x5029('0x22')]=function(_0x251f99,_0xe5313e,_0x4b6f92,_0x2cedf6,_0x2bb398){return sendNotification(![],_0x251f99,_0xe5313e,_0x4b6f92,_0x2cedf6,_0x2bb398);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x7096=['notification:%s','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','showNotification','hideNotification','util','mustache','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','emit','format','user:%s','user:save','split','\x20interaction','name','account','notificationShake','body','queue','msg','getMustacheRender','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7096,0x10c));var _0x6709=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x7096[_0x4fc9e6];return _0x551d28;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var utils=require('../utils');var Mustache=require(_0x6709('0x1'));var Redis=require('ioredis');var config=require(_0x6709('0x2'));var logger=require(_0x6709('0x3'))(_0x6709('0x4'));config[_0x6709('0x5')]=_[_0x6709('0x6')](config[_0x6709('0x5')],{'host':_0x6709('0x7'),'port':0x18eb});var io=require(_0x6709('0x8'))(new Redis(config[_0x6709('0x5')]));function emit(_0x3e2223,_0x11ad23,_0x985814){io['to'](_0x3e2223)[_0x6709('0x9')](_0x11ad23,_0x985814);}function sendNotification(_0x513ab6,_0x5af380,_0x2c07b1,_0x2d8c0b,_0xbcb47,_0x1aa476){io['to'](util[_0x6709('0xa')](_0x6709('0xb'),_0x2d8c0b['name']))['emit'](_0x6709('0xc'),_0x2d8c0b);var _0x262261=_0x1aa476||{};var _0x275dd3=_0x2c07b1[_0x6709('0xd')]('.');var _0x31ac88={'uniqueid':_0x5af380,'channel':_0x275dd3[0x0],'id':_0x275dd3[0x1],'title':_0x275dd3[0x0]+_0x6709('0xe'),'interactionId':_0x275dd3[0x2],'queue':_0xbcb47?_0xbcb47[_0x6709('0xf')]:null,'sound':_0x262261[_0x6709('0x10')]['notificationSound'],'shake':_0x262261[_0x6709('0x10')][_0x6709('0x11')]};try{if(!_0x262261[_0x6709('0x12')]){_0x262261[_0x6709('0x12')]={};}if(_0xbcb47){_0x262261['body'][_0x6709('0x13')]=_0xbcb47;}else if(_0x262261['body'][_0x6709('0x13')]){delete _0x262261['body'][_0x6709('0x13')];}_0x31ac88[_0x6709('0x14')]=utils[_0x6709('0x15')](_0x262261[_0x6709('0x10')]['notificationTemplate'],_0x262261);}catch(_0x52e342){_0x31ac88['msg']=_0x6709('0x16');logger[_0x6709('0x17')](util['format'](_0x6709('0x18'),_0x5af380,_0x52e342[_0x6709('0x19')]));}io['to'](util[_0x6709('0xa')]('user:%s',_0x2d8c0b[_0x6709('0xf')]))[_0x6709('0x9')](util[_0x6709('0xa')](_0x6709('0x1a'),_0x513ab6?'save':_0x6709('0x1b')),_0x31ac88);}function writeLog(_0x1edac3,_0x373047,_0x3cf882){return logger[_0x6709('0x1c')](util[_0x6709('0xa')](_0x6709('0x1d'),_0x1edac3,_0x373047[_0x6709('0xf')],_0x3cf882));}exports[_0x6709('0x1e')]=function(_0x1c5153,_0x2f3415,_0xa36371,_0x5cf48b){if(_0x2f3415[_0x6709('0x1f')]){writeLog(_0x1c5153,_0x2f3415,_0x6709('0x20'));return![];}if(!_0x2f3415[_0x6709('0x21')]){writeLog(_0x1c5153,_0x2f3415,'OFFLINE');return![];}if(_0x2f3415[_0xa36371+_0x6709('0x22')]){writeLog(_0x1c5153,_0x2f3415,_0x6709('0x23'));return![];}if(_0x5cf48b&&_0x2f3415[_0x6709('0x24')](_0xa36371+_0x6709('0x25'))&&_0x2f3415['hasOwnProperty'](_0xa36371+_0x6709('0x26'))){if(_0x2f3415[_0xa36371+_0x6709('0x25')]>0x0&&_0x2f3415[_0xa36371+'CurrentCapacity']>=_0x2f3415[_0xa36371+_0x6709('0x25')]){writeLog(_0x1c5153,_0x2f3415,_0xa36371[_0x6709('0x27')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x6709('0x28')]=function(_0x2499a2,_0x50ada6,_0x271098,_0x5b5201,_0x46a325){return sendNotification(!![],_0x2499a2,_0x50ada6,_0x271098,_0x5b5201,_0x46a325);};exports[_0x6709('0x29')]=function(_0x5b6906,_0x137137,_0x4e6989,_0xe066d8,_0x388aee){return sendNotification(![],_0x5b6906,_0x137137,_0x4e6989,_0xe066d8,_0x388aee);};exports['writeLog']=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 f2167b7..aebbf7c 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 _0x427f=['info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','join'];(function(_0x5d29b4,_0x87c319){var _0x5cd3eb=function(_0x41e365){while(--_0x41e365){_0x5d29b4['push'](_0x5d29b4['shift']());}};_0x5cd3eb(++_0x87c319);}(_0x427f,0xc4));var _0xf427=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x427f[_0x3947c9];return _0x2e7871;};'use strict';var schema=require(_0xf427('0x0'));var sh=require(_0xf427('0x1'));var _=require(_0xf427('0x2'));var utils=require(_0xf427('0x3'));var logger=require(_0xf427('0x4'))(_0xf427('0x5'));var system=schema({'command':{'type':_0xf427('0x6'),'required':!![],'message':_0xf427('0x7')}});exports['consequence']=function(_0xa4d11,_0x2b3b52){return function(_0x15a333){try{var _0x4bc020={'command':_0x2b3b52[0x0]};var _0x55b7bd=system[_0xf427('0x0')](_0x4bc020,{'typecast':!![]});if(_0x55b7bd[_0xf427('0x8')]){logger[_0xf427('0x9')](_0xf427('0xa'),_0xa4d11,_['map'](_0x55b7bd,'message')[_0xf427('0xb')](',\x20'));logger[_0xf427('0xc')](_0xf427('0xd'),_0xa4d11);_0x15a333['next']();}else{var _0x24896a=this;var _0x58dcd7=utils[_0xf427('0xe')](_0x2b3b52[0x0],this);logger[_0xf427('0xc')](_0xf427('0xf'),_0xa4d11,_0x58dcd7);sh[_0xf427('0x10')](_[_0xf427('0x11')](_0x58dcd7),function(_0x4673b0,_0x151c32){logger[_0xf427('0xc')](_0xf427('0x12'),_0xa4d11,_0x4673b0);if(_0x4673b0==0x0){var _0x558096=_0x151c32[_0xf427('0x13')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x2b3b52[0x1])||_[_0xf427('0x14')](_0x2b3b52[0x1])){logger[_0xf427('0xc')](_0xf427('0x15'),_0xa4d11);_0x24896a[_0xf427('0x16')][_0x2b3b52[0x1]]=_0x558096;}else{logger[_0xf427('0xc')](_0xf427('0x17'),_0xa4d11,_0x2b3b52[0x1],_0x558096);_0x24896a[_0xf427('0x16')][_0x2b3b52[0x1]]=_0x558096;}}_0x15a333[_0xf427('0x18')]();});}}catch(_0x5ed5a8){logger['error'](_0xf427('0xa'),_0xa4d11,_['isObject'](_0x5ed5a8)?JSON[_0xf427('0x19')](_0x5ed5a8):_0x5ed5a8);logger[_0xf427('0xc')](_0xf427('0xd'),_0xa4d11);_0x15a333[_0xf427('0x18')]();}};}; \ No newline at end of file +var _0x9d5d=['command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][SYSTEM]\x20%s','map','message','next','getMustacheRender','info','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','stringify','validate','routing','string'];(function(_0x315aea,_0x318a80){var _0x4a4bdb=function(_0x7c049c){while(--_0x7c049c){_0x315aea['push'](_0x315aea['shift']());}};_0x4a4bdb(++_0x318a80);}(_0x9d5d,0x1dd));var _0xd9d5=function(_0x23d261,_0x5bb882){_0x23d261=_0x23d261-0x0;var _0x31674d=_0x9d5d[_0x23d261];return _0x31674d;};'use strict';var schema=require(_0xd9d5('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require('./utils');var logger=require('../../../../config/logger')(_0xd9d5('0x1'));var system=schema({'command':{'type':_0xd9d5('0x2'),'required':!![],'message':_0xd9d5('0x3')}});exports[_0xd9d5('0x4')]=function(_0x5c2994,_0x35d0a8){return function(_0x32a20f){try{var _0x419998={'command':_0x35d0a8[0x0]};var _0x49c462=system[_0xd9d5('0x0')](_0x419998,{'typecast':!![]});if(_0x49c462['length']){logger[_0xd9d5('0x5')](_0xd9d5('0x6'),_0x5c2994,_[_0xd9d5('0x7')](_0x49c462,_0xd9d5('0x8'))['join'](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x5c2994);_0x32a20f[_0xd9d5('0x9')]();}else{var _0x39a75f=this;var _0x205ea9=utils[_0xd9d5('0xa')](_0x35d0a8[0x0],this);logger[_0xd9d5('0xb')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x5c2994,_0x205ea9);sh['exec'](_[_0xd9d5('0xc')](_0x205ea9),function(_0x4c560c,_0x1c6372){logger[_0xd9d5('0xb')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x5c2994,_0x4c560c);if(_0x4c560c==0x0){var _0x32008a=_0x1c6372[_0xd9d5('0xd')](/(\r\n|\n|\r)/gm,'');if(_[_0xd9d5('0xe')](_0x35d0a8[0x1])||_[_0xd9d5('0xf')](_0x35d0a8[0x1])){logger[_0xd9d5('0xb')](_0xd9d5('0x10'),_0x5c2994);_0x39a75f['body'][_0x35d0a8[0x1]]=_0x32008a;}else{logger[_0xd9d5('0xb')](_0xd9d5('0x11'),_0x5c2994,_0x35d0a8[0x1],_0x32008a);_0x39a75f[_0xd9d5('0x12')][_0x35d0a8[0x1]]=_0x32008a;}}_0x32a20f[_0xd9d5('0x9')]();});}}catch(_0x54dd15){logger[_0xd9d5('0x5')](_0xd9d5('0x6'),_0x5c2994,_['isObject'](_0x54dd15)?JSON[_0xd9d5('0x13')](_0x54dd15):_0x54dd15);logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x5c2994);_0x32a20f[_0xd9d5('0x9')]();}};}; \ 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 d14a83e..4906302 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 _0xce41=['info','next','Interaction','channel','addTags','interaction','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','join'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xce41,0xb8));var _0x1ce4=function(_0x1a014b,_0x48acae){_0x1a014b=_0x1a014b-0x0;var _0x462258=_0xce41[_0x1a014b];return _0x462258;};'use strict';var schema=require(_0x1ce4('0x0'));var _=require(_0x1ce4('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x1ce4('0x2')),'smsInteraction':require(_0x1ce4('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x1ce4('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x1ce4('0x5'))(_0x1ce4('0x6'));var tag=schema({'tag':{'type':_0x1ce4('0x7'),'required':!![],'message':_0x1ce4('0x8')}});exports[_0x1ce4('0x9')]=function(_0x1f9dc2,_0x29724,_0x108369,_0x1b827a){return function(_0x24eb90){try{var _0x283cfa={'tag':_0x29724[0x0]};var _0x407a72=tag['validate'](_0x283cfa,{'typecast':!![]});if(_0x407a72[_0x1ce4('0xa')]){logger[_0x1ce4('0xb')](_0x1ce4('0xc'),_0x1f9dc2,_[_0x1ce4('0xd')](_0x407a72,_0x1ce4('0xe'))[_0x1ce4('0xf')](',\x20'));logger[_0x1ce4('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x1f9dc2);_0x24eb90[_0x1ce4('0x11')]();}else{var _0x274bbc={'ids':[_0x29724[0x0]]};if(rpc[_0x1b827a['channel']+_0x1ce4('0x12')]){rpc[_0x1b827a[_0x1ce4('0x13')]+_0x1ce4('0x12')][_0x1ce4('0x14')](_0x1b827a[_0x1ce4('0x15')]['id'],_0x274bbc)['then'](function(_0x524a32){logger[_0x1ce4('0x10')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x1f9dc2,_0x29724[0x1],_0x1b827a['channel'],_0x1b827a[_0x1ce4('0x15')]['id']);})[_0x1ce4('0x16')](function(_0x5ec25d){logger[_0x1ce4('0xb')](_0x1ce4('0xc'),_0x1f9dc2,JSON[_0x1ce4('0x17')](_0x5ec25d));logger[_0x1ce4('0x10')](_0x1ce4('0x18'),_0x1f9dc2);})['finally'](function(){_0x24eb90[_0x1ce4('0x11')]();});}}}catch(_0x4f71a6){logger['error'](_0x1ce4('0xc'),_0x1f9dc2,_['isObject'](_0x4f71a6)?JSON['stringify'](_0x4f71a6):_0x4f71a6);logger[_0x1ce4('0x10')](_0x1ce4('0x18'),_0x1f9dc2);_0x24eb90[_0x1ce4('0x11')]();}};}; \ No newline at end of file +var _0xa877=['TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','then','info','catch','stringify','isObject','validate','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','routing','number'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0xa877,0xf7));var _0x7a87=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa877[_0x40a045];return _0x1a687c;};'use strict';var schema=require(_0x7a87('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x7a87('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x7a87('0x2')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x7a87('0x3')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0x7a87('0x4'));var tag=schema({'tag':{'type':_0x7a87('0x5'),'required':!![],'message':_0x7a87('0x6')}});exports[_0x7a87('0x7')]=function(_0x49301b,_0x43e44a,_0x27be0e,_0x5b3c20){return function(_0x10dce5){try{var _0x27aaaa={'tag':_0x43e44a[0x0]};var _0x2c5c22=tag['validate'](_0x27aaaa,{'typecast':!![]});if(_0x2c5c22[_0x7a87('0x8')]){logger[_0x7a87('0x9')](_0x7a87('0xa'),_0x49301b,_[_0x7a87('0xb')](_0x2c5c22,_0x7a87('0xc'))['join'](',\x20'));logger['info'](_0x7a87('0xd'),_0x49301b);_0x10dce5[_0x7a87('0xe')]();}else{var _0x34e708={'ids':[_0x43e44a[0x0]]};if(rpc[_0x5b3c20[_0x7a87('0xf')]+_0x7a87('0x10')]){rpc[_0x5b3c20['channel']+_0x7a87('0x10')]['addTags'](_0x5b3c20[_0x7a87('0x11')]['id'],_0x34e708)[_0x7a87('0x12')](function(_0x207a71){logger[_0x7a87('0x13')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x49301b,_0x43e44a[0x1],_0x5b3c20['channel'],_0x5b3c20[_0x7a87('0x11')]['id']);})[_0x7a87('0x14')](function(_0x545736){logger['error'](_0x7a87('0xa'),_0x49301b,JSON[_0x7a87('0x15')](_0x545736));logger[_0x7a87('0x13')](_0x7a87('0xd'),_0x49301b);})['finally'](function(){_0x10dce5[_0x7a87('0xe')]();});}}}catch(_0x292fdd){logger[_0x7a87('0x9')](_0x7a87('0xa'),_0x49301b,_[_0x7a87('0x16')](_0x292fdd)?JSON['stringify'](_0x292fdd):_0x292fdd);logger[_0x7a87('0x13')](_0x7a87('0xd'),_0x49301b);_0x10dce5[_0x7a87('0xe')]();}};}; \ 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 279d782..12c72db 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 _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x2b4e81,_0x5a3ae2){var _0x5eb66a=function(_0x3ad7f5){while(--_0x3ad7f5){_0x2b4e81['push'](_0x2b4e81['shift']());}};_0x5eb66a(++_0x5a3ae2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0x9c44=['merge','body','account','list','exports','render'];(function(_0xe31a8a,_0x559474){var _0x2f7249=function(_0x25db94){while(--_0x25db94){_0xe31a8a['push'](_0xe31a8a['shift']());}};_0x2f7249(++_0x559474);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 9f6017a..673fa0c 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 _0x9f98=['../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','channel','message','interaction','applications','length','join','app','.js','autoreply','split','push','slice','dialogflow','appdata','dialogflowv2','tag','TagId','format','condition','intervals','./applications/','consequence','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','info','stringify','matchPath','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','emit','QueueReport','UserId','catch','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','chatQueues','name','paused','mailQueues','openchannelQueues','available','loggedIn','smsQueues','waiting','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','uuid','../../../config/environment','routing','../rpc/openchannelQueueReport'];(function(_0x55e684,_0x3cd151){var _0x3adbf3=function(_0x24dd14){while(--_0x24dd14){_0x55e684['push'](_0x55e684['shift']());}};_0x3adbf3(++_0x3cd151);}(_0x9f98,0xac));var _0x89f9=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x9f98[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x89f9('0x0'));var util=require(_0x89f9('0x1'));var path=require(_0x89f9('0x2'));var fs=require('fs');var jayson=require(_0x89f9('0x3'));var BPromise=require('bluebird');var uuid=require(_0x89f9('0x4'));var config=require(_0x89f9('0x5'));var logger=require('../../../config/logger')(_0x89f9('0x6'));var rpc={'openchannelQueueReport':require(_0x89f9('0x7')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x89f9('0x8')),'smsQueueReport':require(_0x89f9('0x9')),'faxQueueReport':require(_0x89f9('0xa')),'whatsappQueueReport':require(_0x89f9('0xb'))};var RuleEngine=require(_0x89f9('0xc'));function getId(_0x18dc85,_0x401975,_0x57cab8){return util['format'](_0x89f9('0xd'),_0x18dc85,_0x401975||0x0,_0x57cab8||0x0);}function getIntervals(_0xac5126,_0x4a675d){var _0x349e61=[];if(!_[_0x89f9('0xe')](_0x4a675d[_0x89f9('0xf')])&&!_[_0x89f9('0xe')](_0xac5126[_0x4a675d[_0x89f9('0xf')]])&&!_['isNil'](_0xac5126[_0x4a675d[_0x89f9('0xf')]][_0x89f9('0x10')])){_0x349e61=_[_0x89f9('0x11')](_0xac5126[_0x4a675d[_0x89f9('0xf')]][_0x89f9('0x10')],_0x89f9('0x12'));}else if(!_[_0x89f9('0xe')](_0x4a675d[_0x89f9('0x12')])){_0x349e61=[_0x4a675d[_0x89f9('0x12')]];}return _0x349e61;}exports[_0x89f9('0x13')]=function(_0x119a2d){_0x119a2d['rules']={};return new BPromise(function(_0x23c957,_0x2bc0b1){var _0x32152f={'Start':function(_0x1f729a){var _0x3a0fab=this;return new Promise(function(_0x175621,_0xa8ed99){if(_0x1f729a){try{var _0xcc0d7f=[];var _0x3280f3=getId(_0x1f729a[_0x89f9('0x14')],_0x1f729a[_0x89f9('0x15')]?_0x1f729a[_0x89f9('0x15')]['id']:0x0,_0x1f729a[_0x89f9('0x16')]?_0x1f729a[_0x89f9('0x16')]['id']:0x0);if(_0x1f729a[_0x89f9('0x17')]&&_['isArray'](_0x1f729a[_0x89f9('0x17')])&&_0x1f729a[_0x89f9('0x17')][_0x89f9('0x18')]){for(var _0x589270=0x0;_0x589270<_0x1f729a[_0x89f9('0x17')]['length'];_0x589270+=0x1){var _0x534d3e=_0x1f729a[_0x89f9('0x17')][_0x589270];if(fs['existsSync'](path[_0x89f9('0x19')](__dirname,_0x89f9('0x17'),_0x534d3e[_0x89f9('0x1a')]+_0x89f9('0x1b')))){var _0x4066db=[];switch(_0x534d3e[_0x89f9('0x1a')]['toLowerCase']()){case _0x89f9('0x1c'):var _0x4d8bd3=_0x534d3e['appdata'][_0x89f9('0x1d')](',');if(_0x1f729a[_0x89f9('0x14')]==='mail'){_0x4066db[_0x89f9('0x1e')](_0x4d8bd3[0x0]);_0x4066db[_0x89f9('0x1e')](_0x4d8bd3[0x1]);_0x4066db[_0x89f9('0x1e')](_0x4d8bd3[_0x89f9('0x1f')](0x2,_0x4d8bd3['length'])[_0x89f9('0x19')](','));}else{_0x4066db[_0x89f9('0x1e')](_0x4d8bd3[0x0]);_0x4066db[_0x89f9('0x1e')](_0x4d8bd3['slice'](0x1,_0x4d8bd3['length'])[_0x89f9('0x19')](','));}break;case _0x89f9('0x20'):var _0x5ba90b=_0x534d3e[_0x89f9('0x21')][_0x89f9('0x1d')](',');_0x4066db[_0x89f9('0x1e')](_0x5ba90b[0x0]);_0x4066db['push'](_0x5ba90b[0x1]);_0x4066db[_0x89f9('0x1e')](_0x5ba90b[_0x89f9('0x1f')](0x2,_0x5ba90b[_0x89f9('0x18')])[_0x89f9('0x19')](','));break;case _0x89f9('0x22'):var _0x271663=_0x534d3e[_0x89f9('0x21')][_0x89f9('0x1d')](',');_0x4066db['push'](_0x271663[0x0]);_0x4066db['push'](_0x271663[0x1]);_0x4066db[_0x89f9('0x1e')](_0x271663[0x2]);_0x4066db['push'](_0x271663[0x3]);_0x4066db['push'](_0x271663[_0x89f9('0x1f')](0x4,_0x271663[_0x89f9('0x18')])[_0x89f9('0x19')](','));break;case'amazonlex':var _0x636cb0=_0x534d3e['appdata'][_0x89f9('0x1d')](',');_0x4066db[_0x89f9('0x1e')](_0x636cb0[0x0]);_0x4066db[_0x89f9('0x1e')](_0x636cb0[0x1]);_0x4066db[_0x89f9('0x1e')](_0x636cb0[0x2]);_0x4066db[_0x89f9('0x1e')](_0x636cb0[0x3]);_0x4066db[_0x89f9('0x1e')](_0x636cb0['slice'](0x4,_0x636cb0[_0x89f9('0x18')])['join'](','));break;case _0x89f9('0x15'):_0x4066db[_0x89f9('0x1e')](_0x534d3e[_0x89f9('0x21')]);break;case _0x89f9('0x23'):_0x4066db['push'](_0x534d3e[_0x89f9('0x24')]);_0x4066db[_0x89f9('0x1e')](_0x534d3e[_0x89f9('0x21')]);break;default:_0x4066db=_[_0x89f9('0xe')](_0x534d3e[_0x89f9('0x21')])?[]:_0x534d3e[_0x89f9('0x21')][_0x89f9('0x1d')](',');}var _0x4e8042={'id':util[_0x89f9('0x25')]('%s:%s:%s',_0x3280f3,_0x534d3e['id'],_0x534d3e[_0x89f9('0x1a')]),'condition':require('./interval')[_0x89f9('0x26')](_0x3280f3,getIntervals(_0x119a2d[_0x89f9('0x27')],_0x534d3e),_0x119a2d),'consequence':require(_0x89f9('0x28')+_0x534d3e[_0x89f9('0x1a')])[_0x89f9('0x29')](_0x3280f3,_0x4066db,_0x119a2d,_0x1f729a),'p':_0x534d3e[_0x89f9('0x2a')]||0x0};logger['info'](_0x89f9('0x2b'),_0x4e8042['id'],_0x89f9('0x2c'),getIntervals(_0x119a2d[_0x89f9('0x27')],_0x534d3e)['join'](_0x89f9('0x2d')));_0xcc0d7f[_0x89f9('0x1e')](_0x4e8042);}else{logger[_0x89f9('0x2e')](_0x89f9('0x2f'),path[_0x89f9('0x19')](__dirname,_0x89f9('0x17'),_0x534d3e[_0x89f9('0x1a')]+_0x89f9('0x1b')));}}_0x119a2d['rules'][_0x3280f3]=new RuleEngine(_0xcc0d7f);_0x119a2d[_0x89f9('0x30')][_0x3280f3][_0x89f9('0x31')](_0x1f729a,function(_0x9bfece){logger[_0x89f9('0x32')]('Applications\x20executed',JSON[_0x89f9('0x33')](_0x9bfece[_0x89f9('0x34')]));if(_0x119a2d['rules'][_0x3280f3]){_0x119a2d[_0x89f9('0x30')][_0x3280f3]['emit']('complete');}});return _0x175621({'code':0xc8,'message':_0x1f729a});}else{logger[_0x89f9('0x32')](_0x89f9('0x35'));return _0x175621({'code':0xc8,'message':_0x1f729a});}}catch(_0x32d31e){logger[_0x89f9('0x2e')](_0x32d31e[_0x89f9('0x36')]);return _0xa8ed99(_0x3a0fab[_0x89f9('0x2e')](0x1f4,_0x32d31e));}}return _0xa8ed99(_0x89f9('0x37'));});},'AcceptMessage':function(_0x2d916c){var _0x503cda=this;return new Promise(function(_0x4a1757,_0x377cb5){if(_0x2d916c[_0x89f9('0x38')]&&_0x2d916c['agent']['id']){if(_0x119a2d[_0x89f9('0x39')][_0x2d916c['agent']['id']]){_0x119a2d[_0x89f9('0x39')][_0x2d916c[_0x89f9('0x38')]['id']][_0x89f9('0x3a')]=![];_0x119a2d[_0x89f9('0x39')][_0x2d916c[_0x89f9('0x38')]['id']][_0x89f9('0x3b')]=undefined;}}if(_0x2d916c['message']&&_0x2d916c[_0x89f9('0x15')]['id']){try{var _0x13be89=getId(_0x2d916c[_0x89f9('0x14')],_0x2d916c['message']?_0x2d916c['message']['id']:0x0,_0x2d916c['interaction']?_0x2d916c[_0x89f9('0x16')]['id']:0x0);if(_0x119a2d[_0x89f9('0x30')][_0x13be89]){_0x119a2d[_0x89f9('0x30')][_0x13be89][_0x89f9('0x3c')]('end');if(rpc[_0x2d916c['channel']+_0x89f9('0x3d')]){rpc[_0x2d916c[_0x89f9('0x14')]+_0x89f9('0x3d')]['update'](_0x13be89,{'UserId':_0x2d916c[_0x89f9('0x15')][_0x89f9('0x3e')]})[_0x89f9('0x3f')](function(_0x733844){logger[_0x89f9('0x2e')]('error\x20update\x20queue\x20report');});}}return _0x4a1757({'code':0xc8,'message':_0x2d916c});}catch(_0x18dc59){logger[_0x89f9('0x2e')](_0x18dc59[_0x89f9('0x36')]);return _0x377cb5(_0x503cda['error'](0x1f4,_0x18dc59));}}logger[_0x89f9('0x2e')]('message\x20is\x20empty');return _0x377cb5(_0x503cda[_0x89f9('0x2e')](0x1f4,_0x89f9('0x40')));});},'RejectMessage':function(_0x4098c2){var _0x5225a0=this;return new Promise(function(_0x15e41c,_0x553e0e){if(_0x4098c2[_0x89f9('0x38')]&&_0x4098c2[_0x89f9('0x38')]['id']){try{if(_0x119a2d['agents'][_0x4098c2[_0x89f9('0x38')]['id']]){_0x119a2d[_0x89f9('0x39')][_0x4098c2['agent']['id']][_0x89f9('0x3a')]=![];_0x119a2d['agents'][_0x4098c2[_0x89f9('0x38')]['id']][_0x89f9('0x3b')]=undefined;}return _0x15e41c({'code':0xc8,'message':_0x4098c2});}catch(_0x4c09cb){logger[_0x89f9('0x2e')](_0x4c09cb[_0x89f9('0x36')]);return _0x553e0e(_0x5225a0[_0x89f9('0x2e')](0x1f4,_0x4c09cb));}}logger[_0x89f9('0x2e')](_0x89f9('0x40'));return _0x553e0e(_0x5225a0[_0x89f9('0x2e')](0x1f4,_0x89f9('0x40')));});},'AbandonInteraction':function(_0x1fadae){var _0x199f16=this;return new Promise(function(_0x2b3e82,_0x53c9a1){if(_0x1fadae['channel']&&_0x1fadae['interaction']&&_0x1fadae['interaction']['id']){try{var _0x315793=getId(_0x1fadae[_0x89f9('0x14')],_0x1fadae[_0x89f9('0x15')]?_0x1fadae['message']['id']:0x0,_0x1fadae[_0x89f9('0x16')]?_0x1fadae[_0x89f9('0x16')]['id']:0x0);if(_0x119a2d[_0x89f9('0x30')][_0x315793]){_0x119a2d['rules'][_0x315793][_0x89f9('0x3c')]('end');}return _0x2b3e82({'code':0xc8,'message':_0x1fadae});}catch(_0x3b3768){logger['error'](_0x3b3768[_0x89f9('0x36')]);return _0x53c9a1(_0x199f16['error'](0x1f4,_0x3b3768));}}logger[_0x89f9('0x2e')](_0x89f9('0x40'));return _0x53c9a1(_0x199f16[_0x89f9('0x2e')](0x1f4,_0x89f9('0x40')));});},'AgentCapacity':function(_0x440e62){var _0x1ac7b9=this;return new Promise(function(_0x65814a,_0x3303e0){if(_0x119a2d[_0x89f9('0x39')][_0x89f9('0x41')](_0x440e62['id'])){for(var _0x83fe80 in _0x440e62['capacity']){if(_0x440e62[_0x89f9('0x42')][_0x89f9('0x41')](_0x83fe80)){if(_0x119a2d['agents'][_0x440e62['id']][_0x89f9('0x41')](_0x83fe80+_0x89f9('0x43'))){_0x119a2d[_0x89f9('0x39')][_0x440e62['id']][_0x83fe80+_0x89f9('0x43')]=parseInt(_0x440e62['capacity'][_0x83fe80],0xa);}}}_0x119a2d[_0x89f9('0x39')][_0x440e62['id']][_0x89f9('0x44')]();return _0x65814a({'code':0xc8,'message':_0x119a2d[_0x89f9('0x39')][_0x440e62['id']]});}else{return _0x3303e0(_0x1ac7b9['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x2db937){return new Promise(function(_0x5a839f,_0x4f46b0){var _0x5e26c9=_[_0x89f9('0x45')](_0x119a2d[_0x89f9('0x39')]);_0x5a839f({'count':_0x5e26c9[_0x89f9('0x18')],'rows':_0x5e26c9});});},'ChatQueues':function(_0xdfbd4){return new Promise(function(_0x2dbde9,_0x42494f){var _0x2d372f=[];for(var _0x104f66 in _0x119a2d['chatQueues']){if(_0x119a2d[_0x89f9('0x46')][_0x89f9('0x41')](_0x104f66)){var _0x3ec6ba=_0x119a2d['chatQueues'][_0x104f66];var _0x2ad1a7={'id':_0x3ec6ba['id'],'available':_0x3ec6ba['available'],'loggedIn':_0x3ec6ba['loggedIn'],'name':_0x3ec6ba[_0x89f9('0x47')],'paused':_0x3ec6ba[_0x89f9('0x48')],'waiting':_0x3ec6ba['waiting']};_0x2d372f['push'](_0x2ad1a7);}}_0x2dbde9({'count':_0x2d372f[_0x89f9('0x18')],'rows':_0x2d372f});});},'MailQueues':function(_0x40627e){return new Promise(function(_0x2354b1,_0x4898d0){var _0x326d41=[];for(var _0x29bb5d in _0x119a2d['mailQueues']){if(_0x119a2d[_0x89f9('0x49')]['hasOwnProperty'](_0x29bb5d)){var _0x246f28=_0x119a2d[_0x89f9('0x49')][_0x29bb5d];var _0x4f522c={'id':_0x246f28['id'],'available':_0x246f28['available'],'loggedIn':_0x246f28['loggedIn'],'name':_0x246f28['name'],'paused':_0x246f28[_0x89f9('0x48')],'waiting':_0x246f28['waiting']};_0x326d41['push'](_0x4f522c);}}_0x2354b1({'count':_0x326d41[_0x89f9('0x18')],'rows':_0x326d41});});},'OpenchannelQueues':function(_0x1a3015){return new Promise(function(_0x354c24,_0x356d61){var _0x1f0502=[];for(var _0x197a37 in _0x119a2d[_0x89f9('0x4a')]){if(_0x119a2d[_0x89f9('0x4a')][_0x89f9('0x41')](_0x197a37)){var _0x28c921=_0x119a2d['openchannelQueues'][_0x197a37];var _0x118519={'id':_0x28c921['id'],'available':_0x28c921[_0x89f9('0x4b')],'loggedIn':_0x28c921[_0x89f9('0x4c')],'name':_0x28c921[_0x89f9('0x47')],'paused':_0x28c921['paused'],'waiting':_0x28c921['waiting']};_0x1f0502[_0x89f9('0x1e')](_0x118519);}}_0x354c24({'count':_0x1f0502[_0x89f9('0x18')],'rows':_0x1f0502});});},'SmsQueues':function(_0x533ab2){return new Promise(function(_0x2588a9,_0x212a8c){var _0xa37159=[];for(var _0x5f2d8e in _0x119a2d[_0x89f9('0x4d')]){if(_0x119a2d[_0x89f9('0x4d')][_0x89f9('0x41')](_0x5f2d8e)){var _0x237302=_0x119a2d['smsQueues'][_0x5f2d8e];var _0x28eb37={'id':_0x237302['id'],'available':_0x237302[_0x89f9('0x4b')],'loggedIn':_0x237302[_0x89f9('0x4c')],'name':_0x237302[_0x89f9('0x47')],'paused':_0x237302[_0x89f9('0x48')],'waiting':_0x237302[_0x89f9('0x4e')]};_0xa37159[_0x89f9('0x1e')](_0x28eb37);}}_0x2588a9({'count':_0xa37159[_0x89f9('0x18')],'rows':_0xa37159});});},'FaxQueues':function(_0x3a3a8d){return new Promise(function(_0x4a8fdf,_0xb000e0){var _0x4c3595=[];for(var _0x3a715e in _0x119a2d[_0x89f9('0x4f')]){if(_0x119a2d['faxQueues'][_0x89f9('0x41')](_0x3a715e)){var _0xf5ab5d=_0x119a2d[_0x89f9('0x4f')][_0x3a715e];var _0x4fcc5b={'id':_0xf5ab5d['id'],'available':_0xf5ab5d[_0x89f9('0x4b')],'loggedIn':_0xf5ab5d[_0x89f9('0x4c')],'name':_0xf5ab5d[_0x89f9('0x47')],'paused':_0xf5ab5d[_0x89f9('0x48')],'waiting':_0xf5ab5d[_0x89f9('0x4e')]};_0x4c3595[_0x89f9('0x1e')](_0x4fcc5b);}}_0x4a8fdf({'count':_0x4c3595['length'],'rows':_0x4c3595});});},'WhatsappQueues':function(_0x21fbf1){return new Promise(function(_0x1cca30,_0x2c57d8){var _0xbf3db1=[];for(var _0x33d011 in _0x119a2d['whatsappQueues']){if(_0x119a2d[_0x89f9('0x50')]['hasOwnProperty'](_0x33d011)){var _0x52bb34=_0x119a2d[_0x89f9('0x50')][_0x33d011];var _0x2750b3={'id':_0x52bb34['id'],'available':_0x52bb34['available'],'loggedIn':_0x52bb34['loggedIn'],'name':_0x52bb34[_0x89f9('0x47')],'paused':_0x52bb34[_0x89f9('0x48')],'waiting':_0x52bb34['waiting']};_0xbf3db1['push'](_0x2750b3);}}_0x1cca30({'count':_0xbf3db1[_0x89f9('0x18')],'rows':_0xbf3db1});});},'ChatQueuesWaitingInteractions':function(_0x2ea7b5){return new Promise(function(_0x257720,_0x2b7083){var _0x180bc6=_['values'](_0x119a2d[_0x89f9('0x51')]);_0x257720({'count':_0x180bc6[_0x89f9('0x18')],'rows':_0x180bc6});});},'MailQueuesWaitingInteractions':function(_0x1ba199){return new Promise(function(_0x18a56a,_0x3bf627){var _0x3fcb04=_[_0x89f9('0x45')](_0x119a2d[_0x89f9('0x52')]);_0x18a56a({'count':_0x3fcb04['length'],'rows':_0x3fcb04});});},'OpenchannelQueuesWaitingInteractions':function(_0x250b59){return new Promise(function(_0x393087,_0x44f3a6){var _0x140375=_['values'](_0x119a2d['openchannelQueuesWaitingInteractions']);_0x393087({'count':_0x140375['length'],'rows':_0x140375});});},'SmsQueuesWaitingInteractions':function(_0x2a4515){return new Promise(function(_0x203a85,_0x12a3bf){var _0x2cff85=_[_0x89f9('0x45')](_0x119a2d['smsQueuesWaitingInteractions']);_0x203a85({'count':_0x2cff85[_0x89f9('0x18')],'rows':_0x2cff85});});},'FaxQueuesWaitingInteractions':function(_0x4030bf){return new Promise(function(_0x1df263,_0x3f386b){var _0x5b4d39=_[_0x89f9('0x45')](_0x119a2d[_0x89f9('0x53')]);_0x1df263({'count':_0x5b4d39[_0x89f9('0x18')],'rows':_0x5b4d39});});},'WhatsappQueuesWaitingInteractions':function(_0x2f23e3){return new Promise(function(_0x5a223d,_0x54d4b8){var _0xbeb9d9=_['values'](_0x119a2d[_0x89f9('0x54')]);_0x5a223d({'count':_0xbeb9d9[_0x89f9('0x18')],'rows':_0xbeb9d9});});}};var _0x90ad95=jayson['server'](_0x32152f)[_0x89f9('0x55')]();_0x90ad95['on'](_0x89f9('0x2e'),function(_0x226ecb){logger[_0x89f9('0x2e')](JSON[_0x89f9('0x33')](_0x226ecb));return _0x2bc0b1(_0x226ecb);});_0x90ad95[_0x89f9('0x13')](0x232c,_0x89f9('0x56'),function(){console[_0x89f9('0x57')](_0x89f9('0x58'),0x232c);return _0x23c957(_0x89f9('0x59')+0x232c);});});}; \ No newline at end of file +var _0xba73=['interaction','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','paused','waiting','mailQueues','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','listen','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','path','jayson/promise','bluebird','uuid','../../../config/logger','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','rules','channel','message','applications','isArray','length','existsSync','app','.js','toLowerCase','autoreply','split','mail','push','slice','join','dialogflow','appdata','dialogflowv2','amazonlex','tag','TagId','./interval','condition','./applications/','consequence','priority','info','intervals','\x20|\x20','error','execute','Applications\x20executed','stringify','matchPath','emit','No\x20applications\x20to\x20execute','agent','agents','busy','busyQueue'];(function(_0x5cc8,_0x1faa02){var _0x450661=function(_0x237b05){while(--_0x237b05){_0x5cc8['push'](_0x5cc8['shift']());}};_0x450661(++_0x1faa02);}(_0xba73,0x7d));var _0x3ba7=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xba73[_0x5f3f88];return _0xd08119;};'use strict';var _=require('lodash');var util=require('util');var path=require(_0x3ba7('0x0'));var fs=require('fs');var jayson=require(_0x3ba7('0x1'));var BPromise=require(_0x3ba7('0x2'));var uuid=require(_0x3ba7('0x3'));var config=require('../../../config/environment');var logger=require(_0x3ba7('0x4'))('routing');var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x3ba7('0x5')),'chatQueueReport':require(_0x3ba7('0x6')),'smsQueueReport':require(_0x3ba7('0x7')),'faxQueueReport':require(_0x3ba7('0x8')),'whatsappQueueReport':require(_0x3ba7('0x9'))};var RuleEngine=require(_0x3ba7('0xa'));function getId(_0x5205e7,_0xa923e,_0x1b6508){return util[_0x3ba7('0xb')](_0x3ba7('0xc'),_0x5205e7,_0xa923e||0x0,_0x1b6508||0x0);}function getIntervals(_0x39e7bd,_0xcd45d6){var _0x434bba=[];if(!_[_0x3ba7('0xd')](_0xcd45d6[_0x3ba7('0xe')])&&!_[_0x3ba7('0xd')](_0x39e7bd[_0xcd45d6['IntervalId']])&&!_[_0x3ba7('0xd')](_0x39e7bd[_0xcd45d6[_0x3ba7('0xe')]]['Intervals'])){_0x434bba=_[_0x3ba7('0xf')](_0x39e7bd[_0xcd45d6['IntervalId']][_0x3ba7('0x10')],_0x3ba7('0x11'));}else if(!_[_0x3ba7('0xd')](_0xcd45d6['interval'])){_0x434bba=[_0xcd45d6[_0x3ba7('0x11')]];}return _0x434bba;}exports['listen']=function(_0xc9ffe6){_0xc9ffe6[_0x3ba7('0x12')]={};return new BPromise(function(_0x34ce98,_0x191d44){var _0x4b4a48={'Start':function(_0x183963){var _0x5d98d5=this;return new Promise(function(_0xec8183,_0x5a8807){if(_0x183963){try{var _0x1f76bd=[];var _0x9304af=getId(_0x183963[_0x3ba7('0x13')],_0x183963[_0x3ba7('0x14')]?_0x183963[_0x3ba7('0x14')]['id']:0x0,_0x183963['interaction']?_0x183963['interaction']['id']:0x0);if(_0x183963[_0x3ba7('0x15')]&&_[_0x3ba7('0x16')](_0x183963['applications'])&&_0x183963[_0x3ba7('0x15')]['length']){for(var _0x38dedf=0x0;_0x38dedf<_0x183963[_0x3ba7('0x15')][_0x3ba7('0x17')];_0x38dedf+=0x1){var _0x56723f=_0x183963[_0x3ba7('0x15')][_0x38dedf];if(fs[_0x3ba7('0x18')](path['join'](__dirname,_0x3ba7('0x15'),_0x56723f[_0x3ba7('0x19')]+_0x3ba7('0x1a')))){var _0x534420=[];switch(_0x56723f[_0x3ba7('0x19')][_0x3ba7('0x1b')]()){case _0x3ba7('0x1c'):var _0x5745f3=_0x56723f['appdata'][_0x3ba7('0x1d')](',');if(_0x183963['channel']===_0x3ba7('0x1e')){_0x534420[_0x3ba7('0x1f')](_0x5745f3[0x0]);_0x534420[_0x3ba7('0x1f')](_0x5745f3[0x1]);_0x534420[_0x3ba7('0x1f')](_0x5745f3[_0x3ba7('0x20')](0x2,_0x5745f3['length'])[_0x3ba7('0x21')](','));}else{_0x534420[_0x3ba7('0x1f')](_0x5745f3[0x0]);_0x534420['push'](_0x5745f3[_0x3ba7('0x20')](0x1,_0x5745f3[_0x3ba7('0x17')])[_0x3ba7('0x21')](','));}break;case _0x3ba7('0x22'):var _0x4d89f4=_0x56723f[_0x3ba7('0x23')][_0x3ba7('0x1d')](',');_0x534420[_0x3ba7('0x1f')](_0x4d89f4[0x0]);_0x534420[_0x3ba7('0x1f')](_0x4d89f4[0x1]);_0x534420[_0x3ba7('0x1f')](_0x4d89f4[_0x3ba7('0x20')](0x2,_0x4d89f4['length'])[_0x3ba7('0x21')](','));break;case _0x3ba7('0x24'):var _0x37a899=_0x56723f['appdata']['split'](',');_0x534420[_0x3ba7('0x1f')](_0x37a899[0x0]);_0x534420['push'](_0x37a899[0x1]);_0x534420[_0x3ba7('0x1f')](_0x37a899[0x2]);_0x534420[_0x3ba7('0x1f')](_0x37a899[0x3]);_0x534420[_0x3ba7('0x1f')](_0x37a899[_0x3ba7('0x20')](0x4,_0x37a899['length'])[_0x3ba7('0x21')](','));break;case _0x3ba7('0x25'):var _0x3b08cf=_0x56723f[_0x3ba7('0x23')][_0x3ba7('0x1d')](',');_0x534420[_0x3ba7('0x1f')](_0x3b08cf[0x0]);_0x534420[_0x3ba7('0x1f')](_0x3b08cf[0x1]);_0x534420[_0x3ba7('0x1f')](_0x3b08cf[0x2]);_0x534420[_0x3ba7('0x1f')](_0x3b08cf[0x3]);_0x534420[_0x3ba7('0x1f')](_0x3b08cf['slice'](0x4,_0x3b08cf['length'])['join'](','));break;case _0x3ba7('0x14'):_0x534420[_0x3ba7('0x1f')](_0x56723f[_0x3ba7('0x23')]);break;case _0x3ba7('0x26'):_0x534420[_0x3ba7('0x1f')](_0x56723f[_0x3ba7('0x27')]);_0x534420[_0x3ba7('0x1f')](_0x56723f['appdata']);break;default:_0x534420=_[_0x3ba7('0xd')](_0x56723f[_0x3ba7('0x23')])?[]:_0x56723f['appdata'][_0x3ba7('0x1d')](',');}var _0x3ce451={'id':util['format']('%s:%s:%s',_0x9304af,_0x56723f['id'],_0x56723f[_0x3ba7('0x19')]),'condition':require(_0x3ba7('0x28'))[_0x3ba7('0x29')](_0x9304af,getIntervals(_0xc9ffe6['intervals'],_0x56723f),_0xc9ffe6),'consequence':require(_0x3ba7('0x2a')+_0x56723f['app'])[_0x3ba7('0x2b')](_0x9304af,_0x534420,_0xc9ffe6,_0x183963),'p':_0x56723f[_0x3ba7('0x2c')]||0x0};logger[_0x3ba7('0x2d')]('Push\x20new\x20rule',_0x3ce451['id'],'on\x20interval',getIntervals(_0xc9ffe6[_0x3ba7('0x2e')],_0x56723f)['join'](_0x3ba7('0x2f')));_0x1f76bd[_0x3ba7('0x1f')](_0x3ce451);}else{logger[_0x3ba7('0x30')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x3ba7('0x21')](__dirname,_0x3ba7('0x15'),_0x56723f['app']+_0x3ba7('0x1a')));}}_0xc9ffe6[_0x3ba7('0x12')][_0x9304af]=new RuleEngine(_0x1f76bd);_0xc9ffe6[_0x3ba7('0x12')][_0x9304af][_0x3ba7('0x31')](_0x183963,function(_0x2432e3){logger[_0x3ba7('0x2d')](_0x3ba7('0x32'),JSON[_0x3ba7('0x33')](_0x2432e3[_0x3ba7('0x34')]));if(_0xc9ffe6['rules'][_0x9304af]){_0xc9ffe6[_0x3ba7('0x12')][_0x9304af][_0x3ba7('0x35')]('complete');}});return _0xec8183({'code':0xc8,'message':_0x183963});}else{logger['info'](_0x3ba7('0x36'));return _0xec8183({'code':0xc8,'message':_0x183963});}}catch(_0x49ffa8){logger['error'](_0x49ffa8['stack']);return _0x5a8807(_0x5d98d5['error'](0x1f4,_0x49ffa8));}}return _0x5a8807('routing\x20is\x20empty');});},'AcceptMessage':function(_0x2c0b92){var _0x229c47=this;return new Promise(function(_0x35a7fd,_0x88331b){if(_0x2c0b92[_0x3ba7('0x37')]&&_0x2c0b92[_0x3ba7('0x37')]['id']){if(_0xc9ffe6[_0x3ba7('0x38')][_0x2c0b92[_0x3ba7('0x37')]['id']]){_0xc9ffe6['agents'][_0x2c0b92[_0x3ba7('0x37')]['id']][_0x3ba7('0x39')]=![];_0xc9ffe6[_0x3ba7('0x38')][_0x2c0b92[_0x3ba7('0x37')]['id']][_0x3ba7('0x3a')]=undefined;}}if(_0x2c0b92[_0x3ba7('0x14')]&&_0x2c0b92[_0x3ba7('0x14')]['id']){try{var _0x37fcda=getId(_0x2c0b92['channel'],_0x2c0b92[_0x3ba7('0x14')]?_0x2c0b92[_0x3ba7('0x14')]['id']:0x0,_0x2c0b92[_0x3ba7('0x3b')]?_0x2c0b92[_0x3ba7('0x3b')]['id']:0x0);if(_0xc9ffe6[_0x3ba7('0x12')][_0x37fcda]){_0xc9ffe6[_0x3ba7('0x12')][_0x37fcda][_0x3ba7('0x35')](_0x3ba7('0x3c'));if(rpc[_0x2c0b92[_0x3ba7('0x13')]+_0x3ba7('0x3d')]){rpc[_0x2c0b92[_0x3ba7('0x13')]+_0x3ba7('0x3d')]['update'](_0x37fcda,{'UserId':_0x2c0b92[_0x3ba7('0x14')][_0x3ba7('0x3e')]})[_0x3ba7('0x3f')](function(_0x756dea){logger[_0x3ba7('0x30')](_0x3ba7('0x40'));});}}return _0x35a7fd({'code':0xc8,'message':_0x2c0b92});}catch(_0x58bc4a){logger[_0x3ba7('0x30')](_0x58bc4a[_0x3ba7('0x41')]);return _0x88331b(_0x229c47[_0x3ba7('0x30')](0x1f4,_0x58bc4a));}}logger[_0x3ba7('0x30')](_0x3ba7('0x42'));return _0x88331b(_0x229c47[_0x3ba7('0x30')](0x1f4,_0x3ba7('0x42')));});},'RejectMessage':function(_0x9df3ef){var _0x541012=this;return new Promise(function(_0x440f2a,_0x32a8b){if(_0x9df3ef[_0x3ba7('0x37')]&&_0x9df3ef[_0x3ba7('0x37')]['id']){try{if(_0xc9ffe6[_0x3ba7('0x38')][_0x9df3ef[_0x3ba7('0x37')]['id']]){_0xc9ffe6[_0x3ba7('0x38')][_0x9df3ef[_0x3ba7('0x37')]['id']]['busy']=![];_0xc9ffe6[_0x3ba7('0x38')][_0x9df3ef['agent']['id']][_0x3ba7('0x3a')]=undefined;}return _0x440f2a({'code':0xc8,'message':_0x9df3ef});}catch(_0x54b7b1){logger['error'](_0x54b7b1[_0x3ba7('0x41')]);return _0x32a8b(_0x541012[_0x3ba7('0x30')](0x1f4,_0x54b7b1));}}logger['error'](_0x3ba7('0x42'));return _0x32a8b(_0x541012['error'](0x1f4,_0x3ba7('0x42')));});},'AbandonInteraction':function(_0x2e6cfc){var _0x5c70fb=this;return new Promise(function(_0x19ab29,_0x1f50d7){if(_0x2e6cfc[_0x3ba7('0x13')]&&_0x2e6cfc[_0x3ba7('0x3b')]&&_0x2e6cfc[_0x3ba7('0x3b')]['id']){try{var _0x3885dc=getId(_0x2e6cfc[_0x3ba7('0x13')],_0x2e6cfc['message']?_0x2e6cfc['message']['id']:0x0,_0x2e6cfc[_0x3ba7('0x3b')]?_0x2e6cfc[_0x3ba7('0x3b')]['id']:0x0);if(_0xc9ffe6[_0x3ba7('0x12')][_0x3885dc]){_0xc9ffe6['rules'][_0x3885dc]['emit'](_0x3ba7('0x3c'));}return _0x19ab29({'code':0xc8,'message':_0x2e6cfc});}catch(_0x4e61be){logger[_0x3ba7('0x30')](_0x4e61be['stack']);return _0x1f50d7(_0x5c70fb['error'](0x1f4,_0x4e61be));}}logger['error'](_0x3ba7('0x42'));return _0x1f50d7(_0x5c70fb['error'](0x1f4,_0x3ba7('0x42')));});},'AgentCapacity':function(_0x497719){var _0xf345d1=this;return new Promise(function(_0x32a332,_0x2c7470){if(_0xc9ffe6[_0x3ba7('0x38')][_0x3ba7('0x43')](_0x497719['id'])){for(var _0x230f43 in _0x497719[_0x3ba7('0x44')]){if(_0x497719['capacity'][_0x3ba7('0x43')](_0x230f43)){if(_0xc9ffe6[_0x3ba7('0x38')][_0x497719['id']][_0x3ba7('0x43')](_0x230f43+_0x3ba7('0x45'))){_0xc9ffe6[_0x3ba7('0x38')][_0x497719['id']][_0x230f43+_0x3ba7('0x45')]=parseInt(_0x497719[_0x3ba7('0x44')][_0x230f43],0xa);}}}_0xc9ffe6[_0x3ba7('0x38')][_0x497719['id']][_0x3ba7('0x46')]();return _0x32a332({'code':0xc8,'message':_0xc9ffe6[_0x3ba7('0x38')][_0x497719['id']]});}else{return _0x2c7470(_0xf345d1[_0x3ba7('0x30')](0x1f4,_0x3ba7('0x47')));}});},'Agents':function(_0x3dcb0e){return new Promise(function(_0x3e783a,_0x8a8bae){var _0x3ded22=_[_0x3ba7('0x48')](_0xc9ffe6['agents']);_0x3e783a({'count':_0x3ded22[_0x3ba7('0x17')],'rows':_0x3ded22});});},'ChatQueues':function(_0x4ee3ba){return new Promise(function(_0x5edd29,_0x565146){var _0x31b23e=[];for(var _0x2d0b24 in _0xc9ffe6[_0x3ba7('0x49')]){if(_0xc9ffe6['chatQueues'][_0x3ba7('0x43')](_0x2d0b24)){var _0x624241=_0xc9ffe6[_0x3ba7('0x49')][_0x2d0b24];var _0x1c95d1={'id':_0x624241['id'],'available':_0x624241[_0x3ba7('0x4a')],'loggedIn':_0x624241[_0x3ba7('0x4b')],'name':_0x624241['name'],'paused':_0x624241[_0x3ba7('0x4c')],'waiting':_0x624241[_0x3ba7('0x4d')]};_0x31b23e[_0x3ba7('0x1f')](_0x1c95d1);}}_0x5edd29({'count':_0x31b23e[_0x3ba7('0x17')],'rows':_0x31b23e});});},'MailQueues':function(_0x474bda){return new Promise(function(_0x4fb4f7,_0x581a4d){var _0x489730=[];for(var _0x2fe33c in _0xc9ffe6[_0x3ba7('0x4e')]){if(_0xc9ffe6[_0x3ba7('0x4e')][_0x3ba7('0x43')](_0x2fe33c)){var _0x22efd8=_0xc9ffe6[_0x3ba7('0x4e')][_0x2fe33c];var _0x455760={'id':_0x22efd8['id'],'available':_0x22efd8[_0x3ba7('0x4a')],'loggedIn':_0x22efd8[_0x3ba7('0x4b')],'name':_0x22efd8[_0x3ba7('0x4f')],'paused':_0x22efd8[_0x3ba7('0x4c')],'waiting':_0x22efd8[_0x3ba7('0x4d')]};_0x489730[_0x3ba7('0x1f')](_0x455760);}}_0x4fb4f7({'count':_0x489730[_0x3ba7('0x17')],'rows':_0x489730});});},'OpenchannelQueues':function(_0x4bfcca){return new Promise(function(_0x274007,_0x3f1576){var _0x474df7=[];for(var _0x2d990f in _0xc9ffe6[_0x3ba7('0x50')]){if(_0xc9ffe6[_0x3ba7('0x50')]['hasOwnProperty'](_0x2d990f)){var _0x2e7494=_0xc9ffe6[_0x3ba7('0x50')][_0x2d990f];var _0x43bd9e={'id':_0x2e7494['id'],'available':_0x2e7494['available'],'loggedIn':_0x2e7494[_0x3ba7('0x4b')],'name':_0x2e7494['name'],'paused':_0x2e7494[_0x3ba7('0x4c')],'waiting':_0x2e7494[_0x3ba7('0x4d')]};_0x474df7['push'](_0x43bd9e);}}_0x274007({'count':_0x474df7[_0x3ba7('0x17')],'rows':_0x474df7});});},'SmsQueues':function(_0xe640d1){return new Promise(function(_0x411aa6,_0x594ce3){var _0x3f931d=[];for(var _0x852a63 in _0xc9ffe6[_0x3ba7('0x51')]){if(_0xc9ffe6[_0x3ba7('0x51')][_0x3ba7('0x43')](_0x852a63)){var _0x553eec=_0xc9ffe6['smsQueues'][_0x852a63];var _0x19bad={'id':_0x553eec['id'],'available':_0x553eec[_0x3ba7('0x4a')],'loggedIn':_0x553eec[_0x3ba7('0x4b')],'name':_0x553eec[_0x3ba7('0x4f')],'paused':_0x553eec[_0x3ba7('0x4c')],'waiting':_0x553eec[_0x3ba7('0x4d')]};_0x3f931d[_0x3ba7('0x1f')](_0x19bad);}}_0x411aa6({'count':_0x3f931d['length'],'rows':_0x3f931d});});},'FaxQueues':function(_0x1744f8){return new Promise(function(_0x2c8b5f,_0x5bdbf1){var _0x199096=[];for(var _0x396163 in _0xc9ffe6[_0x3ba7('0x52')]){if(_0xc9ffe6[_0x3ba7('0x52')][_0x3ba7('0x43')](_0x396163)){var _0x1aafda=_0xc9ffe6[_0x3ba7('0x52')][_0x396163];var _0x191d52={'id':_0x1aafda['id'],'available':_0x1aafda[_0x3ba7('0x4a')],'loggedIn':_0x1aafda[_0x3ba7('0x4b')],'name':_0x1aafda[_0x3ba7('0x4f')],'paused':_0x1aafda[_0x3ba7('0x4c')],'waiting':_0x1aafda[_0x3ba7('0x4d')]};_0x199096[_0x3ba7('0x1f')](_0x191d52);}}_0x2c8b5f({'count':_0x199096[_0x3ba7('0x17')],'rows':_0x199096});});},'WhatsappQueues':function(_0x5819b9){return new Promise(function(_0x3cd0f7,_0x1b9269){var _0x1befd2=[];for(var _0x4c8b6f in _0xc9ffe6['whatsappQueues']){if(_0xc9ffe6[_0x3ba7('0x53')][_0x3ba7('0x43')](_0x4c8b6f)){var _0x3de907=_0xc9ffe6['whatsappQueues'][_0x4c8b6f];var _0x27a977={'id':_0x3de907['id'],'available':_0x3de907['available'],'loggedIn':_0x3de907[_0x3ba7('0x4b')],'name':_0x3de907['name'],'paused':_0x3de907['paused'],'waiting':_0x3de907[_0x3ba7('0x4d')]};_0x1befd2['push'](_0x27a977);}}_0x3cd0f7({'count':_0x1befd2[_0x3ba7('0x17')],'rows':_0x1befd2});});},'ChatQueuesWaitingInteractions':function(_0x26bc68){return new Promise(function(_0x53da4a,_0x5b7dc2){var _0x40998a=_[_0x3ba7('0x48')](_0xc9ffe6['chatQueuesWaitingInteractions']);_0x53da4a({'count':_0x40998a[_0x3ba7('0x17')],'rows':_0x40998a});});},'MailQueuesWaitingInteractions':function(_0x153dbc){return new Promise(function(_0x2898e5,_0x3c36f0){var _0x287dda=_[_0x3ba7('0x48')](_0xc9ffe6['mailQueuesWaitingInteractions']);_0x2898e5({'count':_0x287dda[_0x3ba7('0x17')],'rows':_0x287dda});});},'OpenchannelQueuesWaitingInteractions':function(_0x2a6946){return new Promise(function(_0x474fe3,_0x13f550){var _0x497b8b=_[_0x3ba7('0x48')](_0xc9ffe6[_0x3ba7('0x54')]);_0x474fe3({'count':_0x497b8b['length'],'rows':_0x497b8b});});},'SmsQueuesWaitingInteractions':function(_0x490c1f){return new Promise(function(_0x370cb6,_0x2ac55f){var _0x500e24=_['values'](_0xc9ffe6[_0x3ba7('0x55')]);_0x370cb6({'count':_0x500e24[_0x3ba7('0x17')],'rows':_0x500e24});});},'FaxQueuesWaitingInteractions':function(_0x5e9309){return new Promise(function(_0x36ac05,_0x1ee2fe){var _0x504669=_[_0x3ba7('0x48')](_0xc9ffe6[_0x3ba7('0x56')]);_0x36ac05({'count':_0x504669['length'],'rows':_0x504669});});},'WhatsappQueuesWaitingInteractions':function(_0x2093a8){return new Promise(function(_0x42ae8d,_0x14f9b7){var _0x1d88bb=_[_0x3ba7('0x48')](_0xc9ffe6[_0x3ba7('0x57')]);_0x42ae8d({'count':_0x1d88bb[_0x3ba7('0x17')],'rows':_0x1d88bb});});}};var _0x16c4af=jayson[_0x3ba7('0x58')](_0x4b4a48)['http']();_0x16c4af['on'](_0x3ba7('0x30'),function(_0x27f085){logger[_0x3ba7('0x30')](JSON[_0x3ba7('0x33')](_0x27f085));return _0x191d44(_0x27f085);});_0x16c4af[_0x3ba7('0x59')](0x232c,_0x3ba7('0x5a'),function(){console['log'](_0x3ba7('0x5b'),0x232c);return _0x34ce98('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index ec2113a..4a7433a 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 _0xd18d=['condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','true','all','[%s][INTERVAL]\x20%s\x20%s','join','when','stack','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','error','message','result','catch'];(function(_0x44a0ce,_0x51e098){var _0x2b4298=function(_0x3df0d6){while(--_0x3df0d6){_0x44a0ce['push'](_0x44a0ce['shift']());}};_0x2b4298(++_0x51e098);}(_0xd18d,0x16f));var _0xdd18=function(_0x3862cd,_0x299e88){_0x3862cd=_0x3862cd-0x0;var _0x2864a1=_0xd18d[_0x3862cd];return _0x2864a1;};'use strict';var util=require('util');var BPromise=require(_0xdd18('0x0'));var jayson=require(_0xdd18('0x1'));var _=require(_0xdd18('0x2'));var logger=require(_0xdd18('0x3'))(_0xdd18('0x4'));var client=jayson[_0xdd18('0x5')][_0xdd18('0x6')]({'port':0x232a});function request(_0x36e4ae,_0x1afe67){return new BPromise(function(_0x4f5321,_0x361b52){return client['request'](_0x36e4ae,_0x1afe67)['then'](function(_0x2304bb){if(_0x2304bb['error']){return _0x361b52(_0x2304bb[_0xdd18('0x7')][_0xdd18('0x8')]);}else{return _0x4f5321(_0x2304bb[_0xdd18('0x9')]);}})[_0xdd18('0xa')](function(_0x2acd31){return _0x361b52(_0x2acd31);});});}exports[_0xdd18('0xb')]=function(_0x2323c6,_0xd2b5d0,_0x3f1141){return function(_0x121032){if(_0x3f1141[_0xdd18('0xc')]&&!_0x3f1141[_0xdd18('0xc')][_0x2323c6]){logger[_0xdd18('0xd')](_0xdd18('0xe'),_0x2323c6);return _0x121032[_0xdd18('0xf')]();}var _0x40c3ea=[];for(var _0x4acb4f=0x0;_0x4acb4f<_0xd2b5d0[_0xdd18('0x10')];_0x4acb4f+=0x1){_0x40c3ea[_0xdd18('0x11')](request(_0xdd18('0x12'),{'command':util[_0xdd18('0x13')](_0xdd18('0x14'),_0xd2b5d0[_0x4acb4f])})['then'](function(_0x311325){return _0x311325&&_0x311325[_0xdd18('0x8')]&&_0x311325['message']['indexOf'](_0xdd18('0x15'))>=0x0?!![]:![];})[_0xdd18('0xa')](function(_0x47ea09){logger[_0xdd18('0x7')]('[%s][INTERVAL]\x20%s',_0x2323c6,_0xd2b5d0[_0x4acb4f]);}));}BPromise[_0xdd18('0x16')](_0x40c3ea)['then'](function(_0x3d15c5){var _0x5b5234=_['some'](_0x3d15c5);logger['info'](_0xdd18('0x17'),_0x2323c6,_0xd2b5d0[_0xdd18('0x18')]('\x20|\x20'),_0x5b5234);_0x121032[_0xdd18('0x19')](_0x5b5234);})[_0xdd18('0xa')](function(_0x144662){console['log'](_0x144662);logger[_0xdd18('0x7')](_0xdd18('0x17'),_0x2323c6,_0xd2b5d0[_0xdd18('0x18')]('\x20|\x20'),_0x144662[_0xdd18('0x1a')]);_0x121032[_0xdd18('0xf')]();});};}; \ No newline at end of file +var _0x7aa8=['catch','condition','rules','info','length','push','Command','then','indexOf','true','[%s][INTERVAL]\x20%s','all','\x20|\x20','when','log','join','stack','stop','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','error','message'];(function(_0x1a32a8,_0x485ce4){var _0x10c338=function(_0x59d8f8){while(--_0x59d8f8){_0x1a32a8['push'](_0x1a32a8['shift']());}};_0x10c338(++_0x485ce4);}(_0x7aa8,0xba));var _0x87aa=function(_0x2ade32,_0x2aacd5){_0x2ade32=_0x2ade32-0x0;var _0x32da01=_0x7aa8[_0x2ade32];return _0x32da01;};'use strict';var util=require(_0x87aa('0x0'));var BPromise=require(_0x87aa('0x1'));var jayson=require(_0x87aa('0x2'));var _=require(_0x87aa('0x3'));var logger=require(_0x87aa('0x4'))(_0x87aa('0x5'));var client=jayson[_0x87aa('0x6')][_0x87aa('0x7')]({'port':0x232a});function request(_0x3287ea,_0x143b8c){return new BPromise(function(_0x314df5,_0x5bbb69){return client['request'](_0x3287ea,_0x143b8c)['then'](function(_0x47f7da){if(_0x47f7da['error']){return _0x5bbb69(_0x47f7da[_0x87aa('0x8')][_0x87aa('0x9')]);}else{return _0x314df5(_0x47f7da['result']);}})[_0x87aa('0xa')](function(_0xeb0d44){return _0x5bbb69(_0xeb0d44);});});}exports[_0x87aa('0xb')]=function(_0x4a4062,_0x141520,_0x273a96){return function(_0x2d5799){if(_0x273a96['rules']&&!_0x273a96[_0x87aa('0xc')][_0x4a4062]){logger[_0x87aa('0xd')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x4a4062);return _0x2d5799['stop']();}var _0x5c1692=[];for(var _0x54d1d3=0x0;_0x54d1d3<_0x141520[_0x87aa('0xe')];_0x54d1d3+=0x1){_0x5c1692[_0x87aa('0xf')](request(_0x87aa('0x10'),{'command':util['format']('iftime\x20%s',_0x141520[_0x54d1d3])})[_0x87aa('0x11')](function(_0xbf64cb){return _0xbf64cb&&_0xbf64cb['message']&&_0xbf64cb[_0x87aa('0x9')][_0x87aa('0x12')](_0x87aa('0x13'))>=0x0?!![]:![];})['catch'](function(_0xab9bfb){logger[_0x87aa('0x8')](_0x87aa('0x14'),_0x4a4062,_0x141520[_0x54d1d3]);}));}BPromise[_0x87aa('0x15')](_0x5c1692)['then'](function(_0x175fd8){var _0x342460=_['some'](_0x175fd8);logger[_0x87aa('0xd')]('[%s][INTERVAL]\x20%s\x20%s',_0x4a4062,_0x141520['join'](_0x87aa('0x16')),_0x342460);_0x2d5799[_0x87aa('0x17')](_0x342460);})[_0x87aa('0xa')](function(_0x5bdf72){console[_0x87aa('0x18')](_0x5bdf72);logger[_0x87aa('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0x4a4062,_0x141520[_0x87aa('0x19')](_0x87aa('0x16')),_0x5bdf72[_0x87aa('0x1a')]);_0x2d5799[_0x87aa('0x1b')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 80d2ee6..efb98d7 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 _0x8f59=['transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','./utils','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','interface','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwtime','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','called','connectedlinename','format','membername','error','agentringnoanswer','[%s][agents][agentringnoanswer]','agentringnoanswerAt','reason','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]'];(function(_0x339202,_0x4422ce){var _0x1a1bf9=function(_0x1cbdb5){while(--_0x1cbdb5){_0x339202['push'](_0x339202['shift']());}};_0x1a1bf9(++_0x4422ce);}(_0x8f59,0x11d));var _0x98f5=function(_0x80d733,_0x266211){_0x80d733=_0x80d733-0x0;var _0x435868=_0x8f59[_0x80d733];return _0x435868;};'use strict';var _=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var utils=require(_0x98f5('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0xe809bb,_0x1d9fb3){utils[_0x98f5('0x3')](util['format'](_0x98f5('0x4'),_0xe809bb[_0x98f5('0x5')],_0xe809bb[_0x98f5('0x6')],_0xe809bb[_0x98f5('0x7')],_0xe809bb['membername'],_0xe809bb[_0x98f5('0x8')],_0xe809bb[_0x98f5('0x9')],_0xe809bb[_0x98f5('0xa')],_0xe809bb['lastevent']));if(_0xe809bb['queue']){utils[_0x98f5('0xb')](_0xe809bb[_0x98f5('0x7')])[_0x98f5('0xc')](function(_0x53493e){if(_0x53493e){_0xe809bb[_0x98f5('0xd')]=_0x53493e[_0x98f5('0xd')];_0xe809bb[_0x98f5('0xe')]=_0xe809bb[_0x98f5('0xf')]?_0x53493e['acw']:![];_0xe809bb[_0x98f5('0x10')]=_0xe809bb['agentacw']?_0x53493e['acwTimeout']:0x0;}utils[_0x98f5('0x11')](_0x98f5('0x12'),_0xe809bb);});}else{utils['request'](_0x98f5('0x12'),_0xe809bb);}if(_0x1d9fb3){delete transfers[_0xe809bb[_0x98f5('0x5')]];}else{delete agents[_0xe809bb[_0x98f5('0x13')]];}}exports[_0x98f5('0x14')]=function(_0x3286f7){try{utils[_0x98f5('0x15')](util['format'](_0x98f5('0x16'),_0x3286f7[_0x98f5('0x5')]),_0x3286f7);agents[_0x3286f7['destuniqueid']]=_0x3286f7;agents[_0x3286f7[_0x98f5('0x13')]][_0x98f5('0x17')]=utils[_0x98f5('0x18')]();agents[_0x3286f7['destuniqueid']][_0x98f5('0x19')]=_0x98f5('0x1a');agents[_0x3286f7[_0x98f5('0x13')]]['connectedlinenum']=null;agents[_0x3286f7[_0x98f5('0x13')]][_0x98f5('0x1b')]=null;utils['info'](util[_0x98f5('0x1c')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x3286f7[_0x98f5('0x5')],agents[_0x3286f7[_0x98f5('0x13')]][_0x98f5('0x1d')],_0x3286f7[_0x98f5('0x13')]));}catch(_0xd6f409){utils[_0x98f5('0x1e')](util['format'](_0x98f5('0x16'),_0x3286f7['uniqueid']),_0xd6f409);}};exports[_0x98f5('0x1f')]=function(_0x191f23){try{if(!_['isNil'](agents[_0x191f23[_0x98f5('0x13')]])){utils[_0x98f5('0x15')](util[_0x98f5('0x1c')](_0x98f5('0x20'),_0x191f23[_0x98f5('0x5')]),_0x191f23);utils[_0x98f5('0x3')](util[_0x98f5('0x1c')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x191f23[_0x98f5('0x5')],agents[_0x191f23['destuniqueid']][_0x98f5('0x1d')],_0x191f23['destuniqueid']));agents[_0x191f23[_0x98f5('0x13')]][_0x98f5('0x1f')]=!![];agents[_0x191f23[_0x98f5('0x13')]][_0x98f5('0x21')]=utils[_0x98f5('0x18')]();agents[_0x191f23[_0x98f5('0x13')]][_0x98f5('0x19')]='timeout';agents[_0x191f23[_0x98f5('0x13')]][_0x98f5('0x22')]='timeout';agents[_0x191f23[_0x98f5('0x13')]][_0x98f5('0x23')]=_0x191f23[_0x98f5('0x24')]?parseInt(_0x191f23[_0x98f5('0x24')])/0x3e8:0x0;agents[_0x191f23[_0x98f5('0x13')]][_0x98f5('0x25')]=0x0;unanswered[_0x98f5('0x26')](_0x191f23[_0x98f5('0x13')]);}}catch(_0x576c4b){utils['error'](util[_0x98f5('0x1c')](_0x98f5('0x20'),_0x191f23[_0x98f5('0x5')]),_0x576c4b);}};exports[_0x98f5('0x27')]=function(_0x15bf92){try{_[_0x98f5('0x28')](agents,function(_0x5e9d73,_0x29e1f5){if(_0x5e9d73[_0x98f5('0x5')]==_0x15bf92[_0x98f5('0x5')]&&!_[_0x98f5('0x29')](unanswered,_0x5e9d73[_0x98f5('0x13')])){utils[_0x98f5('0x15')](util['format'](_0x98f5('0x2a'),_0x15bf92[_0x98f5('0x5')]),_0x15bf92);utils[_0x98f5('0x3')](util[_0x98f5('0x1c')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x15bf92[_0x98f5('0x5')],_0x5e9d73[_0x98f5('0x1d')],_0x5e9d73[_0x98f5('0x13')]));_0x5e9d73[_0x98f5('0x1f')]=!![];_0x5e9d73[_0x98f5('0x21')]=utils[_0x98f5('0x18')]();_0x5e9d73[_0x98f5('0x19')]=_0x98f5('0x2b');_0x5e9d73[_0x98f5('0x22')]=_0x98f5('0x2b');_0x5e9d73[_0x98f5('0x23')]=_0x15bf92[_0x98f5('0x23')];_0x5e9d73[_0x98f5('0x25')]=0x0;writeDB(_0x5e9d73);}});}catch(_0xe4a944){utils[_0x98f5('0x1e')](util[_0x98f5('0x1c')](_0x98f5('0x2a'),_0x15bf92[_0x98f5('0x5')]),_0xe4a944);}};exports[_0x98f5('0x2c')]=function(_0x39d935){try{if(agents[_0x39d935['destuniqueid']]){utils[_0x98f5('0x15')](util['format']('[%s][agents][agentconnect]',_0x39d935[_0x98f5('0x5')]),_0x39d935);utils[_0x98f5('0x3')](util[_0x98f5('0x1c')](_0x98f5('0x2d'),_0x39d935['uniqueid'],agents[_0x39d935[_0x98f5('0x13')]][_0x98f5('0x1d')],_0x39d935[_0x98f5('0x13')]));agents[_0x39d935['destuniqueid']][_0x98f5('0x2e')]=utils[_0x98f5('0x18')]();agents[_0x39d935['destuniqueid']][_0x98f5('0xa')]=_0x39d935[_0x98f5('0xa')];agents[_0x39d935[_0x98f5('0x13')]]['connectedlinename']=_0x39d935[_0x98f5('0x1b')];agents[_0x39d935[_0x98f5('0x13')]][_0x98f5('0x23')]=_0x39d935[_0x98f5('0x24')];agents[_0x39d935[_0x98f5('0x13')]]['lastevent']='connect';_[_0x98f5('0x28')](agents,function(_0x14faf2,_0x33e6e2){if(_0x14faf2[_0x98f5('0x13')]!=_0x39d935[_0x98f5('0x13')]&&_0x14faf2[_0x98f5('0x5')]==_0x39d935['uniqueid']){_0x14faf2['talktime']=0x0;_0x14faf2[_0x98f5('0x23')]=_0x39d935[_0x98f5('0x24')];_0x14faf2[_0x98f5('0x1f')]=!![];_0x14faf2[_0x98f5('0x21')]=utils['now']();_0x14faf2['lastevent']=_0x98f5('0x2f');_0x14faf2[_0x98f5('0x22')]=_0x98f5('0x2f');_0x14faf2[_0x98f5('0x30')]=_0x39d935['destuniqueid'];_0x14faf2['answeredelsewheremembername']=_0x39d935[_0x98f5('0x1d')];writeDB(_0x14faf2);}});}}catch(_0x3a191f){utils[_0x98f5('0x1e')](util['format'](_0x98f5('0x31'),_0x39d935['uniqueid']),_0x3a191f);}};exports[_0x98f5('0xf')]=function(_0x4ff7b0){try{if(!_[_0x98f5('0x32')](agents[_0x4ff7b0[_0x98f5('0x13')]])){utils[_0x98f5('0x15')](util['format'](_0x98f5('0x33'),_0x4ff7b0[_0x98f5('0x5')]),_0x4ff7b0);utils['info'](util[_0x98f5('0x1c')](_0x98f5('0x34'),_0x4ff7b0['uniqueid'],agents[_0x4ff7b0[_0x98f5('0x13')]]['membername'],_0x4ff7b0[_0x98f5('0x13')]));agents[_0x4ff7b0[_0x98f5('0x13')]]['agentcomplete']=!![];agents[_0x4ff7b0['destuniqueid']]['agentcompleteAt']=utils['now']();agents[_0x4ff7b0[_0x98f5('0x13')]]['talktime']=utils[_0x98f5('0x35')](agents[_0x4ff7b0[_0x98f5('0x13')]][_0x98f5('0x36')],agents[_0x4ff7b0[_0x98f5('0x13')]][_0x98f5('0x2e')]);agents[_0x4ff7b0[_0x98f5('0x13')]]['reason']=_0x4ff7b0[_0x98f5('0x22')];agents[_0x4ff7b0[_0x98f5('0x13')]][_0x98f5('0x19')]=_0x98f5('0x37');writeDB(agents[_0x4ff7b0[_0x98f5('0x13')]]);}}catch(_0x459649){utils['error'](util[_0x98f5('0x1c')](_0x98f5('0x33'),_0x4ff7b0[_0x98f5('0x5')]),_0x459649);}};exports[_0x98f5('0x38')]=function(_0x4a0cda){try{if(!_[_0x98f5('0x32')](agents[_0x4a0cda[_0x98f5('0x39')]])){utils[_0x98f5('0x15')](util[_0x98f5('0x1c')](_0x98f5('0x3a'),_0x4a0cda['uniqueid']),_0x4a0cda);utils[_0x98f5('0x3')](util[_0x98f5('0x1c')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x4a0cda[_0x98f5('0x5')],agents[_0x4a0cda['transfereruniqueid']][_0x98f5('0x1d')],agents[_0x4a0cda['transfereruniqueid']][_0x98f5('0x5')]));agents[_0x4a0cda[_0x98f5('0x39')]][_0x98f5('0x3b')]=!![];agents[_0x4a0cda['transfereruniqueid']][_0x98f5('0x3c')]=_0x98f5('0x3d');agents[_0x4a0cda[_0x98f5('0x39')]][_0x98f5('0x3e')]=_0x4a0cda[_0x98f5('0x3f')];agents[_0x4a0cda[_0x98f5('0x39')]][_0x98f5('0x40')]=agents[_0x4a0cda[_0x98f5('0x39')]][_0x98f5('0x5')];}}catch(_0x2e48a1){utils[_0x98f5('0x1e')](util[_0x98f5('0x1c')](_0x98f5('0x3a'),_0x4a0cda[_0x98f5('0x5')]),_0x2e48a1);}};exports[_0x98f5('0x41')]=function(_0x1289a7){try{utils[_0x98f5('0x15')](util['format'](_0x98f5('0x42'),_0x1289a7[_0x98f5('0x43')]),_0x1289a7);if(_0x1289a7[_0x98f5('0x43')]==_0x1289a7[_0x98f5('0x44')]){if(!_[_0x98f5('0x32')](agents[_0x1289a7[_0x98f5('0x45')]])){utils['info'](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x1289a7[_0x98f5('0x43')],agents[_0x1289a7[_0x98f5('0x45')]][_0x98f5('0x1d')]));agents[_0x1289a7[_0x98f5('0x45')]]['transfer']=!![];agents[_0x1289a7[_0x98f5('0x45')]]['transfertype']=_0x98f5('0x46');agents[_0x1289a7['secondtransfereruniqueid']]['transferexten']=_0x1289a7[_0x98f5('0x47')];agents[_0x1289a7[_0x98f5('0x45')]][_0x98f5('0x40')]=_0x1289a7['origtransfereruniqueid'];}if(_0x1289a7['transfereeuniqueid']&&agents[_0x1289a7[_0x98f5('0x48')]]){agents[_0x1289a7[_0x98f5('0x48')]]['agententerreason']=0x1;transfers[_0x1289a7[_0x98f5('0x48')]]=_[_0x98f5('0x49')](agents[_0x1289a7['transfereeuniqueid']]);transfers[_0x1289a7[_0x98f5('0x48')]][_0x98f5('0x9')]=agents[_0x1289a7[_0x98f5('0x45')]]['calleridnum'];transfers[_0x1289a7[_0x98f5('0x48')]][_0x98f5('0x4a')]=agents[_0x1289a7[_0x98f5('0x45')]][_0x98f5('0x4a')];transfers[_0x1289a7[_0x98f5('0x48')]][_0x98f5('0x17')]=utils[_0x98f5('0x18')]();transfers[_0x1289a7['transfereeuniqueid']][_0x98f5('0x2e')]=utils[_0x98f5('0x18')]();transfers[_0x1289a7[_0x98f5('0x48')]]['holdtime']=0x0;transfers[_0x1289a7['transfereeuniqueid']][_0x98f5('0x4b')]=0x2;}}else if(_0x1289a7[_0x98f5('0x45')]==_0x1289a7['secondtransfererlinkedid']){if(!_['isNil'](agents[_0x1289a7['origtransfereruniqueid']])){utils['info'](util[_0x98f5('0x1c')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x1289a7[_0x98f5('0x43')],agents[_0x1289a7[_0x98f5('0x43')]][_0x98f5('0x1d')]));agents[_0x1289a7[_0x98f5('0x43')]][_0x98f5('0x3b')]=!![];agents[_0x1289a7[_0x98f5('0x43')]][_0x98f5('0x3c')]=_0x98f5('0x46');agents[_0x1289a7['origtransfereruniqueid']]['transferexten']=_0x1289a7[_0x98f5('0x4c')];agents[_0x1289a7['origtransfereruniqueid']][_0x98f5('0x40')]=_0x1289a7[_0x98f5('0x45')];}if(_0x1289a7[_0x98f5('0x4d')]&&agents[_0x1289a7['transfertargetuniqueid']]){agents[_0x1289a7[_0x98f5('0x4d')]]['agententerreason']=0x1;transfers[_0x1289a7['transfertargetuniqueid']]=_['clone'](agents[_0x1289a7[_0x98f5('0x4d')]]);transfers[_0x1289a7['transfertargetuniqueid']][_0x98f5('0x9')]=agents[_0x1289a7[_0x98f5('0x43')]][_0x98f5('0x9')];transfers[_0x1289a7['transfertargetuniqueid']]['calleridname']=agents[_0x1289a7['origtransfereruniqueid']][_0x98f5('0x4a')];transfers[_0x1289a7[_0x98f5('0x4d')]]['agentcalledAt']=utils['now']();transfers[_0x1289a7[_0x98f5('0x4d')]][_0x98f5('0x2e')]=utils[_0x98f5('0x18')]();transfers[_0x1289a7[_0x98f5('0x4d')]][_0x98f5('0x23')]=0x0;transfers[_0x1289a7[_0x98f5('0x4d')]][_0x98f5('0x4b')]=0x2;}}}catch(_0x1cc6e3){utils[_0x98f5('0x1e')](util['format'](_0x98f5('0x42'),_0x1289a7[_0x98f5('0x43')]),_0x1cc6e3);}};exports[_0x98f5('0x4e')]=function(_0xb64efb){try{utils['debug'](util[_0x98f5('0x1c')](_0x98f5('0x4f'),_0xb64efb[_0x98f5('0x5')]),_0xb64efb);if(agents[_0xb64efb['uniqueid']]&&agents[_0xb64efb[_0x98f5('0x5')]][_0x98f5('0x22')]==='timeout'){if(_0xb64efb[_0x98f5('0x50')]==='21'){agents[_0xb64efb[_0x98f5('0x5')]][_0x98f5('0x22')]='rejected';agents[_0xb64efb[_0x98f5('0x5')]][_0x98f5('0x19')]=_0x98f5('0x51');}utils[_0x98f5('0x3')](util[_0x98f5('0x1c')](_0x98f5('0x52'),_0xb64efb[_0x98f5('0x5')],agents[_0xb64efb[_0x98f5('0x5')]][_0x98f5('0x1d')],agents[_0xb64efb['uniqueid']][_0x98f5('0x22')],agents[_0xb64efb['uniqueid']][_0x98f5('0x19')]));writeDB(agents[_0xb64efb[_0x98f5('0x5')]]);var _0x3bb728=unanswered[_0x98f5('0x53')](_0xb64efb['uniqueid']);if(_0x3bb728>-0x1){unanswered[_0x98f5('0x54')](_0x3bb728,0x1);}}if(transfers[_0xb64efb[_0x98f5('0x5')]]){transfers[_0xb64efb['uniqueid']][_0x98f5('0xf')]=!![];transfers[_0xb64efb['uniqueid']][_0x98f5('0x36')]=utils[_0x98f5('0x18')]();transfers[_0xb64efb[_0x98f5('0x5')]][_0x98f5('0x25')]=utils['diffTime'](transfers[_0xb64efb['uniqueid']][_0x98f5('0x36')],transfers[_0xb64efb[_0x98f5('0x5')]]['agentconnectAt']);transfers[_0xb64efb[_0x98f5('0x5')]][_0x98f5('0x22')]=_0x98f5('0x55');transfers[_0xb64efb[_0x98f5('0x5')]][_0x98f5('0x19')]=_0x98f5('0x37');utils[_0x98f5('0x3')](util[_0x98f5('0x1c')](_0x98f5('0x52'),_0xb64efb[_0x98f5('0x5')],transfers[_0xb64efb[_0x98f5('0x5')]]['membername'],transfers[_0xb64efb['uniqueid']][_0x98f5('0x22')],transfers[_0xb64efb[_0x98f5('0x5')]][_0x98f5('0x19')]));writeDB(transfers[_0xb64efb['uniqueid']],!![]);}if(agents[_0xb64efb[_0x98f5('0x5')]]&&agents[_0xb64efb[_0x98f5('0x5')]]['agentconnectAt']){agents[_0xb64efb[_0x98f5('0x5')]][_0x98f5('0xf')]=!![];agents[_0xb64efb['uniqueid']]['agentcompleteAt']=utils['now']();agents[_0xb64efb['uniqueid']][_0x98f5('0x25')]=utils[_0x98f5('0x35')](agents[_0xb64efb['uniqueid']][_0x98f5('0x36')],agents[_0xb64efb[_0x98f5('0x5')]]['agentconnectAt']);agents[_0xb64efb[_0x98f5('0x5')]]['reason']=agents[_0xb64efb['uniqueid']][_0x98f5('0x3b')]?_0x98f5('0x3b'):_0x98f5('0x55');agents[_0xb64efb[_0x98f5('0x5')]]['lastevent']=_0x98f5('0x37');utils['info'](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0xb64efb[_0x98f5('0x5')],agents[_0xb64efb[_0x98f5('0x5')]][_0x98f5('0x1d')],agents[_0xb64efb[_0x98f5('0x5')]][_0x98f5('0x22')],agents[_0xb64efb[_0x98f5('0x5')]][_0x98f5('0x19')]));writeDB(agents[_0xb64efb[_0x98f5('0x5')]]);}}catch(_0x1a3a76){utils[_0x98f5('0x1e')](util['format'](_0x98f5('0x4f'),_0xb64efb[_0x98f5('0x5')]),_0x1a3a76);}}; \ No newline at end of file +var _0xf45e=['secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfererexten','transferuniqueid','transfereeuniqueid','clone','calleridname','agentcalledAt','ATTENDED','transfertargetuniqueid','agententerreason','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','./utils','info','format','[%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','getVoiceQueueByName','then','type','agentcomplete','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','debug','[%s][agents][agentringnoanswer]','agentringnoanswerAt','timeout','ringtime','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','talktime','agentconnect','[%s][agents][agentconnect]','agentconnectAt','now','connectedlinename','answered_elsewhere','reason','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0xf45e,0x115));var _0xef45=function(_0x2849c0,_0x1fd3bb){_0x2849c0=_0x2849c0-0x0;var _0x5be15c=_0xf45e[_0x2849c0];return _0x5be15c;};'use strict';var _=require(_0xef45('0x0'));var util=require('util');var utils=require(_0xef45('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5762da,_0x17b897){utils[_0xef45('0x2')](util[_0xef45('0x3')](_0xef45('0x4'),_0x5762da[_0xef45('0x5')],_0x5762da[_0xef45('0x6')],_0x5762da[_0xef45('0x7')],_0x5762da[_0xef45('0x8')],_0x5762da[_0xef45('0x9')],_0x5762da[_0xef45('0xa')],_0x5762da[_0xef45('0xb')],_0x5762da[_0xef45('0xc')]));if(_0x5762da[_0xef45('0x7')]){utils[_0xef45('0xd')](_0x5762da[_0xef45('0x7')])[_0xef45('0xe')](function(_0x134c86){if(_0x134c86){_0x5762da[_0xef45('0xf')]=_0x134c86[_0xef45('0xf')];_0x5762da['agentacw']=_0x5762da[_0xef45('0x10')]?_0x134c86[_0xef45('0x11')]:![];_0x5762da[_0xef45('0x12')]=_0x5762da[_0xef45('0x13')]?_0x134c86[_0xef45('0x14')]:0x0;}utils[_0xef45('0x15')]('CreateVoiceAgentReport',_0x5762da);});}else{utils[_0xef45('0x15')](_0xef45('0x16'),_0x5762da);}if(_0x17b897){delete transfers[_0x5762da[_0xef45('0x5')]];}else{delete agents[_0x5762da[_0xef45('0x17')]];}}exports[_0xef45('0x18')]=function(_0x4a6e5c){try{utils['debug'](util[_0xef45('0x3')]('[%s][agents][agentcalled]',_0x4a6e5c[_0xef45('0x5')]),_0x4a6e5c);agents[_0x4a6e5c[_0xef45('0x17')]]=_0x4a6e5c;agents[_0x4a6e5c[_0xef45('0x17')]]['agentcalledAt']=utils['now']();agents[_0x4a6e5c[_0xef45('0x17')]]['lastevent']=_0xef45('0x19');agents[_0x4a6e5c[_0xef45('0x17')]][_0xef45('0xb')]=null;agents[_0x4a6e5c[_0xef45('0x17')]]['connectedlinename']=null;utils['info'](util[_0xef45('0x3')](_0xef45('0x1a'),_0x4a6e5c[_0xef45('0x5')],agents[_0x4a6e5c[_0xef45('0x17')]]['membername'],_0x4a6e5c['destuniqueid']));}catch(_0x2c57fc){utils[_0xef45('0x1b')](util[_0xef45('0x3')](_0xef45('0x1c'),_0x4a6e5c[_0xef45('0x5')]),_0x2c57fc);}};exports[_0xef45('0x1d')]=function(_0x375cbd){try{if(!_['isNil'](agents[_0x375cbd[_0xef45('0x17')]])){utils[_0xef45('0x1e')](util[_0xef45('0x3')](_0xef45('0x1f'),_0x375cbd[_0xef45('0x5')]),_0x375cbd);utils['info'](util[_0xef45('0x3')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x375cbd['uniqueid'],agents[_0x375cbd[_0xef45('0x17')]][_0xef45('0x8')],_0x375cbd[_0xef45('0x17')]));agents[_0x375cbd[_0xef45('0x17')]][_0xef45('0x1d')]=!![];agents[_0x375cbd[_0xef45('0x17')]][_0xef45('0x20')]=utils['now']();agents[_0x375cbd[_0xef45('0x17')]]['lastevent']=_0xef45('0x21');agents[_0x375cbd[_0xef45('0x17')]]['reason']=_0xef45('0x21');agents[_0x375cbd[_0xef45('0x17')]]['holdtime']=_0x375cbd[_0xef45('0x22')]?parseInt(_0x375cbd['ringtime'])/0x3e8:0x0;agents[_0x375cbd['destuniqueid']]['talktime']=0x0;unanswered['push'](_0x375cbd[_0xef45('0x17')]);}}catch(_0x2f72ef){utils[_0xef45('0x1b')](util[_0xef45('0x3')]('[%s][agents][agentringnoanswer]',_0x375cbd[_0xef45('0x5')]),_0x2f72ef);}};exports['queuecallerabandon']=function(_0x2525da){try{_['forIn'](agents,function(_0x3e6922,_0x5bfd2d){if(_0x3e6922['uniqueid']==_0x2525da[_0xef45('0x5')]&&!_[_0xef45('0x23')](unanswered,_0x3e6922[_0xef45('0x17')])){utils[_0xef45('0x1e')](util[_0xef45('0x3')]('[%s][agents][queuecallerabandon]',_0x2525da['uniqueid']),_0x2525da);utils['info'](util[_0xef45('0x3')](_0xef45('0x24'),_0x2525da[_0xef45('0x5')],_0x3e6922[_0xef45('0x8')],_0x3e6922[_0xef45('0x17')]));_0x3e6922[_0xef45('0x1d')]=!![];_0x3e6922[_0xef45('0x20')]=utils['now']();_0x3e6922['lastevent']=_0xef45('0x25');_0x3e6922['reason']=_0xef45('0x25');_0x3e6922['holdtime']=_0x2525da[_0xef45('0x26')];_0x3e6922[_0xef45('0x27')]=0x0;writeDB(_0x3e6922);}});}catch(_0x2a7c53){utils[_0xef45('0x1b')](util[_0xef45('0x3')]('[%s][agents][queuecallerabandon]',_0x2525da[_0xef45('0x5')]),_0x2a7c53);}};exports[_0xef45('0x28')]=function(_0x9df07e){try{if(agents[_0x9df07e['destuniqueid']]){utils['debug'](util[_0xef45('0x3')](_0xef45('0x29'),_0x9df07e['uniqueid']),_0x9df07e);utils[_0xef45('0x2')](util['format']('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x9df07e[_0xef45('0x5')],agents[_0x9df07e[_0xef45('0x17')]][_0xef45('0x8')],_0x9df07e['destuniqueid']));agents[_0x9df07e[_0xef45('0x17')]][_0xef45('0x2a')]=utils[_0xef45('0x2b')]();agents[_0x9df07e[_0xef45('0x17')]]['connectedlinenum']=_0x9df07e['connectedlinenum'];agents[_0x9df07e[_0xef45('0x17')]][_0xef45('0x2c')]=_0x9df07e[_0xef45('0x2c')];agents[_0x9df07e[_0xef45('0x17')]][_0xef45('0x26')]=_0x9df07e[_0xef45('0x22')];agents[_0x9df07e[_0xef45('0x17')]][_0xef45('0xc')]='connect';_['forIn'](agents,function(_0x13f8b2,_0x35d014){if(_0x13f8b2[_0xef45('0x17')]!=_0x9df07e[_0xef45('0x17')]&&_0x13f8b2[_0xef45('0x5')]==_0x9df07e[_0xef45('0x5')]){_0x13f8b2[_0xef45('0x27')]=0x0;_0x13f8b2[_0xef45('0x26')]=_0x9df07e[_0xef45('0x22')];_0x13f8b2[_0xef45('0x1d')]=!![];_0x13f8b2[_0xef45('0x20')]=utils[_0xef45('0x2b')]();_0x13f8b2[_0xef45('0xc')]=_0xef45('0x2d');_0x13f8b2[_0xef45('0x2e')]=_0xef45('0x2d');_0x13f8b2['answeredelsewheredestinationuniqueid']=_0x9df07e[_0xef45('0x17')];_0x13f8b2[_0xef45('0x2f')]=_0x9df07e[_0xef45('0x8')];writeDB(_0x13f8b2);}});}}catch(_0x82c123){utils['error'](util[_0xef45('0x3')]('[%s][agents][agentconnect]',_0x9df07e[_0xef45('0x5')]),_0x82c123);}};exports['agentcomplete']=function(_0x5faf67){try{if(!_[_0xef45('0x30')](agents[_0x5faf67[_0xef45('0x17')]])){utils[_0xef45('0x1e')](util[_0xef45('0x3')](_0xef45('0x31'),_0x5faf67[_0xef45('0x5')]),_0x5faf67);utils['info'](util[_0xef45('0x3')](_0xef45('0x32'),_0x5faf67[_0xef45('0x5')],agents[_0x5faf67[_0xef45('0x17')]][_0xef45('0x8')],_0x5faf67[_0xef45('0x17')]));agents[_0x5faf67[_0xef45('0x17')]][_0xef45('0x10')]=!![];agents[_0x5faf67[_0xef45('0x17')]][_0xef45('0x33')]=utils[_0xef45('0x2b')]();agents[_0x5faf67[_0xef45('0x17')]][_0xef45('0x27')]=utils[_0xef45('0x34')](agents[_0x5faf67[_0xef45('0x17')]]['agentcompleteAt'],agents[_0x5faf67[_0xef45('0x17')]][_0xef45('0x2a')]);agents[_0x5faf67[_0xef45('0x17')]]['reason']=_0x5faf67['reason'];agents[_0x5faf67['destuniqueid']][_0xef45('0xc')]=_0xef45('0x35');writeDB(agents[_0x5faf67[_0xef45('0x17')]]);}}catch(_0x34e9d5){utils[_0xef45('0x1b')](util[_0xef45('0x3')]('[%s][agents][agentcomplete]',_0x5faf67[_0xef45('0x5')]),_0x34e9d5);}};exports[_0xef45('0x36')]=function(_0x2b2419){try{if(!_['isNil'](agents[_0x2b2419['transfereruniqueid']])){utils[_0xef45('0x1e')](util[_0xef45('0x3')]('[%s][agents][blindtransfer]',_0x2b2419[_0xef45('0x5')]),_0x2b2419);utils[_0xef45('0x2')](util[_0xef45('0x3')](_0xef45('0x37'),_0x2b2419[_0xef45('0x5')],agents[_0x2b2419[_0xef45('0x38')]][_0xef45('0x8')],agents[_0x2b2419[_0xef45('0x38')]][_0xef45('0x5')]));agents[_0x2b2419[_0xef45('0x38')]][_0xef45('0x39')]=!![];agents[_0x2b2419[_0xef45('0x38')]][_0xef45('0x3a')]=_0xef45('0x3b');agents[_0x2b2419['transfereruniqueid']][_0xef45('0x3c')]=_0x2b2419[_0xef45('0x3d')];agents[_0x2b2419[_0xef45('0x38')]]['transferuniqueid']=agents[_0x2b2419[_0xef45('0x38')]][_0xef45('0x5')];}}catch(_0x464bda){utils[_0xef45('0x1b')](util['format'](_0xef45('0x3e'),_0x2b2419[_0xef45('0x5')]),_0x464bda);}};exports[_0xef45('0x3f')]=function(_0x310105){try{utils[_0xef45('0x1e')](util[_0xef45('0x3')](_0xef45('0x40'),_0x310105[_0xef45('0x41')]),_0x310105);if(_0x310105[_0xef45('0x41')]==_0x310105[_0xef45('0x42')]){if(!_[_0xef45('0x30')](agents[_0x310105[_0xef45('0x43')]])){utils['info'](util[_0xef45('0x3')](_0xef45('0x44'),_0x310105[_0xef45('0x41')],agents[_0x310105[_0xef45('0x43')]][_0xef45('0x8')]));agents[_0x310105[_0xef45('0x43')]]['transfer']=!![];agents[_0x310105['secondtransfereruniqueid']][_0xef45('0x3a')]='ATTENDED';agents[_0x310105[_0xef45('0x43')]][_0xef45('0x3c')]=_0x310105[_0xef45('0x45')];agents[_0x310105['secondtransfereruniqueid']][_0xef45('0x46')]=_0x310105[_0xef45('0x41')];}if(_0x310105['transfereeuniqueid']&&agents[_0x310105[_0xef45('0x47')]]){agents[_0x310105['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x310105[_0xef45('0x47')]]=_[_0xef45('0x48')](agents[_0x310105[_0xef45('0x47')]]);transfers[_0x310105[_0xef45('0x47')]][_0xef45('0xa')]=agents[_0x310105['secondtransfereruniqueid']][_0xef45('0xa')];transfers[_0x310105[_0xef45('0x47')]]['calleridname']=agents[_0x310105[_0xef45('0x43')]][_0xef45('0x49')];transfers[_0x310105[_0xef45('0x47')]][_0xef45('0x4a')]=utils[_0xef45('0x2b')]();transfers[_0x310105[_0xef45('0x47')]][_0xef45('0x2a')]=utils[_0xef45('0x2b')]();transfers[_0x310105['transfereeuniqueid']][_0xef45('0x26')]=0x0;transfers[_0x310105['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x310105[_0xef45('0x43')]==_0x310105['secondtransfererlinkedid']){if(!_[_0xef45('0x30')](agents[_0x310105[_0xef45('0x41')]])){utils['info'](util[_0xef45('0x3')](_0xef45('0x44'),_0x310105[_0xef45('0x41')],agents[_0x310105[_0xef45('0x41')]][_0xef45('0x8')]));agents[_0x310105[_0xef45('0x41')]]['transfer']=!![];agents[_0x310105[_0xef45('0x41')]][_0xef45('0x3a')]=_0xef45('0x4b');agents[_0x310105[_0xef45('0x41')]][_0xef45('0x3c')]=_0x310105['secondtransfererexten'];agents[_0x310105[_0xef45('0x41')]]['transferuniqueid']=_0x310105[_0xef45('0x43')];}if(_0x310105[_0xef45('0x4c')]&&agents[_0x310105['transfertargetuniqueid']]){agents[_0x310105[_0xef45('0x4c')]][_0xef45('0x4d')]=0x1;transfers[_0x310105[_0xef45('0x4c')]]=_['clone'](agents[_0x310105['transfertargetuniqueid']]);transfers[_0x310105[_0xef45('0x4c')]][_0xef45('0xa')]=agents[_0x310105[_0xef45('0x41')]]['calleridnum'];transfers[_0x310105[_0xef45('0x4c')]][_0xef45('0x49')]=agents[_0x310105['origtransfereruniqueid']][_0xef45('0x49')];transfers[_0x310105['transfertargetuniqueid']][_0xef45('0x4a')]=utils[_0xef45('0x2b')]();transfers[_0x310105[_0xef45('0x4c')]][_0xef45('0x2a')]=utils[_0xef45('0x2b')]();transfers[_0x310105[_0xef45('0x4c')]][_0xef45('0x26')]=0x0;transfers[_0x310105[_0xef45('0x4c')]]['agententerreason']=0x2;}}}catch(_0x3e6b06){utils[_0xef45('0x1b')](util[_0xef45('0x3')](_0xef45('0x40'),_0x310105[_0xef45('0x41')]),_0x3e6b06);}};exports[_0xef45('0x4e')]=function(_0xef7b79){try{utils[_0xef45('0x1e')](util[_0xef45('0x3')](_0xef45('0x4f'),_0xef7b79[_0xef45('0x5')]),_0xef7b79);if(agents[_0xef7b79['uniqueid']]&&agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2e')]===_0xef45('0x21')){if(_0xef7b79[_0xef45('0x50')]==='21'){agents[_0xef7b79[_0xef45('0x5')]]['reason']=_0xef45('0x51');agents[_0xef7b79[_0xef45('0x5')]]['lastevent']='rejected';}utils[_0xef45('0x2')](util[_0xef45('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0xef7b79['uniqueid'],agents[_0xef7b79['uniqueid']][_0xef45('0x8')],agents[_0xef7b79[_0xef45('0x5')]]['reason'],agents[_0xef7b79['uniqueid']][_0xef45('0xc')]));writeDB(agents[_0xef7b79['uniqueid']]);var _0x36586a=unanswered[_0xef45('0x52')](_0xef7b79[_0xef45('0x5')]);if(_0x36586a>-0x1){unanswered[_0xef45('0x53')](_0x36586a,0x1);}}if(transfers[_0xef7b79[_0xef45('0x5')]]){transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0x10')]=!![];transfers[_0xef7b79['uniqueid']][_0xef45('0x33')]=utils[_0xef45('0x2b')]();transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0x27')]=utils[_0xef45('0x34')](transfers[_0xef7b79[_0xef45('0x5')]]['agentcompleteAt'],transfers[_0xef7b79['uniqueid']][_0xef45('0x2a')]);transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2e')]=_0xef45('0x54');transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0xc')]=_0xef45('0x35');utils[_0xef45('0x2')](util['format'](_0xef45('0x55'),_0xef7b79[_0xef45('0x5')],transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0x8')],transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2e')],transfers[_0xef7b79[_0xef45('0x5')]]['lastevent']));writeDB(transfers[_0xef7b79[_0xef45('0x5')]],!![]);}if(agents[_0xef7b79['uniqueid']]&&agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2a')]){agents[_0xef7b79['uniqueid']][_0xef45('0x10')]=!![];agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x33')]=utils['now']();agents[_0xef7b79[_0xef45('0x5')]]['talktime']=utils[_0xef45('0x34')](agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x33')],agents[_0xef7b79[_0xef45('0x5')]]['agentconnectAt']);agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2e')]=agents[_0xef7b79[_0xef45('0x5')]]['transfer']?_0xef45('0x39'):_0xef45('0x54');agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0xc')]=_0xef45('0x35');utils['info'](util[_0xef45('0x3')](_0xef45('0x55'),_0xef7b79[_0xef45('0x5')],agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x8')],agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2e')],agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0xc')]));writeDB(agents[_0xef7b79['uniqueid']]);}}catch(_0xd3a51e){utils[_0xef45('0x1b')](util[_0xef45('0x3')]('[%s][agents][hangup]',_0xef7b79[_0xef45('0x5')]),_0xd3a51e);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 31cd617..0d17130 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 _0x8979=['calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','OutgoingSpoolFailed','context','exten','channel','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','hangup','noop','execif','gotoif','lastdata','appdata','lodash','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','blinds','uniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','membername'];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0x8979,0x64));var _0x9897=function(_0x28036f,_0x32ee48){_0x28036f=_0x28036f-0x0;var _0x26750b=_0x8979[_0x28036f];return _0x26750b;};'use strict';var _=require(_0x9897('0x0'));var util=require('util');var utils=require(_0x9897('0x1'));var transfers=require(_0x9897('0x2'));var dispositions=[_0x9897('0x3'),_0x9897('0x4'),'FAILED',_0x9897('0x3'),_0x9897('0x3'),_0x9897('0x3'),_0x9897('0x5'),'BUSY','FAILED',_0x9897('0x4'),'FAILED'];var channels={};function writeDB(_0x5c5984){var _0x591cab;if(transfers[_0x9897('0x6')][_0x5c5984[_0x9897('0x7')]]){_0x591cab=_0x5c5984[_0x9897('0x7')];_0x5c5984['uniqueid']=transfers[_0x9897('0x6')][_0x5c5984[_0x9897('0x7')]]['transfereeuniqueid'];}utils[_0x9897('0x8')](util[_0x9897('0x9')](_0x9897('0xa'),_0x5c5984[_0x9897('0x7')],_0x5c5984['channel'],_0x5c5984['queue'],_0x5c5984[_0x9897('0xb')],_0x5c5984['interface'],_0x5c5984[_0x9897('0xc')],_0x5c5984[_0x9897('0xd')],_0x5c5984[_0x9897('0xe')]));if(_0x5c5984[_0x9897('0xf')]){utils[_0x9897('0x10')](_0x5c5984['accountcode'])[_0x9897('0x11')](function(_0x70a6b2){if(_0x70a6b2){_0x5c5984[_0x9897('0x12')]=_0x70a6b2['id'];}utils['request']('CreateVoiceCallReport',_0x5c5984);});}else{utils[_0x9897('0x13')](_0x9897('0x14'),_0x5c5984);}if(channels[_0x5c5984[_0x9897('0x7')]]){delete channels[_0x5c5984[_0x9897('0x7')]];}else if(_0x591cab&&channels[_0x591cab]){delete transfers[_0x9897('0x6')][_0x591cab];delete channels[_0x591cab];}}exports[_0x9897('0x15')]=function(_0x118a92){try{utils[_0x9897('0x16')](util['format'](_0x9897('0x17'),_0x118a92[_0x9897('0x7')]),_0x118a92);if(_0x118a92[_0x9897('0x7')]==_0x118a92['linkedid']&&_0x118a92['channel']!=_0x9897('0x18')){utils[_0x9897('0x8')](util[_0x9897('0x9')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x118a92['uniqueid'],_0x118a92[_0x9897('0x19')],_0x118a92[_0x9897('0x1a')]));channels[_0x118a92[_0x9897('0x7')]]={'uniqueid':_0x118a92[_0x9897('0x7')],'accountcode':_0x118a92['accountcode'],'source':_0x118a92[_0x9897('0xc')],'destination':_0x118a92['exten'],'destinationcontext':_0x118a92[_0x9897('0x19')],'channel':_0x118a92[_0x9897('0x1b')],'starttime':utils[_0x9897('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9897('0x3'),'amaflags':_0x9897('0x1d')};}}catch(_0x264a3f){utils[_0x9897('0x1e')](util['format']('[%s][calls][newchannel]',_0x118a92[_0x9897('0x7')]),_0x264a3f);}};exports[_0x9897('0x1f')]=function(_0x49d95b){try{utils['debug'](util[_0x9897('0x9')](_0x9897('0x20'),_0x49d95b[_0x9897('0x7')]),_0x49d95b);if(!_[_0x9897('0x21')](channels[_0x49d95b[_0x9897('0x7')]])&&_0x49d95b[_0x9897('0x22')]==0x6){utils[_0x9897('0x8')](util[_0x9897('0x9')](_0x9897('0x23'),_0x49d95b[_0x9897('0x7')],_0x49d95b[_0x9897('0x19')],_0x49d95b['channel']));if(_[_0x9897('0x21')](channels[_0x49d95b['uniqueid']][_0x9897('0x24')])){channels[_0x49d95b[_0x9897('0x7')]][_0x9897('0x24')]=utils[_0x9897('0x1c')]();}}else if(!_[_0x9897('0x21')](channels[_0x49d95b[_0x9897('0x25')]])&&_0x49d95b[_0x9897('0x22')]==0x6&&_0x49d95b[_0x9897('0x19')]!=_0x9897('0x26')){utils[_0x9897('0x8')](util['format'](_0x9897('0x27'),_0x49d95b[_0x9897('0x7')],_0x49d95b[_0x9897('0x25')],_0x49d95b[_0x9897('0x19')],_0x49d95b[_0x9897('0x1b')]));channels[_0x49d95b['linkedid']][_0x9897('0xf')]=_0x49d95b['accountcode'];channels[_0x49d95b[_0x9897('0x25')]][_0x9897('0x28')]=_0x49d95b[_0x9897('0x1b')];if(_[_0x9897('0x21')](channels[_0x49d95b['linkedid']][_0x9897('0x29')])){channels[_0x49d95b[_0x9897('0x25')]][_0x9897('0x29')]=utils[_0x9897('0x1c')]();}channels[_0x49d95b['linkedid']]['disposition']=dispositions[_['toNumber'](_0x49d95b[_0x9897('0x22')])]||_0x9897('0x5');}}catch(_0x2b5229){utils[_0x9897('0x1e')](util[_0x9897('0x9')]('[%s][calls][newstate]',_0x49d95b['uniqueid']),_0x2b5229);}};exports['hangup']=function(_0x56519d){try{if(!_['isNil'](channels[_0x56519d['uniqueid']])){utils[_0x9897('0x16')](util[_0x9897('0x9')](_0x9897('0x2a'),_0x56519d[_0x9897('0x7')]),_0x56519d);if(_[_0x9897('0x21')](channels[_0x56519d['uniqueid']][_0x9897('0x2b')])){channels[_0x56519d[_0x9897('0x7')]][_0x9897('0x2b')]=_0x56519d[_0x9897('0x2c')]+'\x20<'+_0x56519d[_0x9897('0xc')]+'>';}utils[_0x9897('0x8')](util['format'](_0x9897('0x2d'),_0x56519d['uniqueid'],channels[_0x56519d['uniqueid']][_0x9897('0x2b')],_0x56519d['cause-txt']));channels[_0x56519d[_0x9897('0x7')]][_0x9897('0x2e')]=utils[_0x9897('0x1c')]();channels[_0x56519d[_0x9897('0x7')]][_0x9897('0x2f')]=utils[_0x9897('0x30')](channels[_0x56519d[_0x9897('0x7')]]['endtime'],channels[_0x56519d[_0x9897('0x7')]][_0x9897('0x31')]);channels[_0x56519d[_0x9897('0x7')]][_0x9897('0x32')]=channels[_0x56519d[_0x9897('0x7')]]['answertime']?utils[_0x9897('0x30')](channels[_0x56519d['uniqueid']][_0x9897('0x2e')],channels[_0x56519d['uniqueid']][_0x9897('0x29')]):0x0;writeDB(channels[_0x56519d[_0x9897('0x7')]]);}}catch(_0x2a183d){utils[_0x9897('0x1e')](util[_0x9897('0x9')](_0x9897('0x2a'),_0x56519d[_0x9897('0x7')]),_0x2a183d);}};exports[_0x9897('0x33')]=function(_0x599afa){try{if(!_['isNil'](channels[_0x599afa[_0x9897('0x34')]])){utils['debug'](util[_0x9897('0x9')](_0x9897('0x35'),_0x599afa[_0x9897('0x36')]),_0x599afa);if(channels[_0x599afa[_0x9897('0x34')]]['channel']==_0x599afa[_0x9897('0x37')]){utils[_0x9897('0x8')](util['format'](_0x9897('0x38'),_0x599afa['origtransfereruniqueid'],_0x599afa[_0x9897('0x34')],_0x599afa[_0x9897('0x39')]));channels[_0x599afa[_0x9897('0x34')]][_0x9897('0x28')]=_0x599afa[_0x9897('0x39')];channels[_0x599afa[_0x9897('0x34')]][_0x9897('0x3a')]=_0x9897('0x3b');}else if(channels[_0x599afa[_0x9897('0x34')]][_0x9897('0x1b')]=_0x599afa['transfertargetchannel']){utils['info'](util['format'](_0x9897('0x38'),_0x599afa[_0x9897('0x36')],_0x599afa['localtwolinkedid'],_0x599afa[_0x9897('0x3c')]));channels[_0x599afa[_0x9897('0x34')]]['destinationchannel']=_0x599afa[_0x9897('0x3c')];channels[_0x599afa[_0x9897('0x34')]][_0x9897('0x3a')]=_0x9897('0x3b');}}}catch(_0x2f31af){utils[_0x9897('0x1e')](util[_0x9897('0x9')](_0x9897('0x35'),_0x599afa[_0x9897('0x36')]),_0x2f31af);}};exports[_0x9897('0x3d')]=function(_0x3e7742){try{if(!_[_0x9897('0x21')](channels[_0x3e7742['uniqueid']])){utils[_0x9897('0x16')](util[_0x9897('0x9')](_0x9897('0x3e'),_0x3e7742[_0x9897('0x7')]),_0x3e7742);channels[_0x3e7742[_0x9897('0x7')]][_0x9897('0x3f')]=utils[_0x9897('0x1c')]();utils[_0x9897('0x8')](util[_0x9897('0x9')](_0x9897('0x40'),_0x3e7742[_0x9897('0x7')],channels[_0x3e7742[_0x9897('0x7')]][_0x9897('0x3f')]));}}catch(_0x51a78b){utils['error'](util[_0x9897('0x9')](_0x9897('0x3e'),_0x3e7742[_0x9897('0x7')]),_0x51a78b);}};exports[_0x9897('0x41')]=function(_0x5664ff){try{if(!_[_0x9897('0x21')](channels[_0x5664ff[_0x9897('0x7')]])){utils[_0x9897('0x16')](util[_0x9897('0x9')](_0x9897('0x42'),_0x5664ff[_0x9897('0x7')]),_0x5664ff);if(!_[_0x9897('0x21')](channels[_0x5664ff['uniqueid']][_0x9897('0x3f')])){channels[_0x5664ff[_0x9897('0x7')]][_0x9897('0x43')]+=utils[_0x9897('0x30')](utils[_0x9897('0x1c')](),channels[_0x5664ff[_0x9897('0x7')]][_0x9897('0x3f')]);utils[_0x9897('0x8')](util['format'](_0x9897('0x44'),_0x5664ff['uniqueid'],channels[_0x5664ff[_0x9897('0x7')]][_0x9897('0x43')]));delete channels[_0x5664ff[_0x9897('0x7')]]['musiconholdstartAt'];}}}catch(_0x484dcc){utils[_0x9897('0x1e')](util['format']('[%s][calls][musiconholdstop]',_0x5664ff[_0x9897('0x7')]),_0x484dcc);}};exports[_0x9897('0x45')]=function(_0x247be3){try{if(!_[_0x9897('0x21')](channels[_0x247be3[_0x9897('0x7')]])){utils[_0x9897('0x16')](util['format']('[%s][calls][varset]',_0x247be3[_0x9897('0x7')]),_0x247be3);if(!_[_0x9897('0x21')](_0x247be3['variable'][_0x9897('0x46')])){utils['info'](util[_0x9897('0x9')](_0x9897('0x47'),_0x247be3[_0x9897('0x7')],_0x247be3[_0x9897('0x48')]));channels[_0x247be3[_0x9897('0x7')]]['source']=_0x247be3[_0x9897('0x48')];}if(!_[_0x9897('0x21')](_0x247be3[_0x9897('0x49')][_0x9897('0x4a')])){utils['info'](util[_0x9897('0x9')](_0x9897('0x4b'),_0x247be3[_0x9897('0x7')],_0x247be3['value']));channels[_0x247be3['uniqueid']]['destination']=_0x247be3[_0x9897('0x48')];channels[_0x247be3[_0x9897('0x7')]][_0x9897('0x2b')]='\x22'+_0x247be3[_0x9897('0x48')]+_0x9897('0x4c')+_0x247be3[_0x9897('0x48')]+'>';}if(!_[_0x9897('0x21')](_0x247be3['variable'][_0x9897('0x4d')])||!_[_0x9897('0x21')](_0x247be3[_0x9897('0x49')]['xmd-callerid'])){utils[_0x9897('0x8')](util[_0x9897('0x9')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x247be3[_0x9897('0x7')],!_[_0x9897('0x21')](_0x247be3['variable'][_0x9897('0x4d')])?_0x9897('0x4d'):_0x9897('0x4e'),_0x247be3[_0x9897('0x48')]));channels[_0x247be3[_0x9897('0x7')]][_0x9897('0x2b')]=_0x247be3[_0x9897('0x48')];}if(!_['isNil'](_0x247be3['variable']['xmd-queue'])||!_[_0x9897('0x21')](_0x247be3['variable']['xmcs-queue'])){utils[_0x9897('0x8')](util[_0x9897('0x9')](_0x9897('0x4f'),_0x247be3[_0x9897('0x7')],!_[_0x9897('0x21')](_0x247be3[_0x9897('0x49')]['xmd-queue'])?_0x9897('0x50'):_0x9897('0x51'),_0x247be3['value']));channels[_0x247be3[_0x9897('0x7')]][_0x9897('0x52')]='Queue';channels[_0x247be3[_0x9897('0x7')]]['lastdata']=_0x247be3[_0x9897('0x48')];channels[_0x247be3[_0x9897('0x7')]][_0x9897('0x53')]=!![];}if(!_[_0x9897('0x21')](_0x247be3[_0x9897('0x49')][_0x9897('0x54')])){utils[_0x9897('0x8')](util[_0x9897('0x9')](_0x9897('0x55'),_0x247be3[_0x9897('0x7')],_0x247be3[_0x9897('0x48')]));channels[_0x247be3['uniqueid']][_0x9897('0x56')]=_0x247be3['value'];}if(!_['isNil'](_0x247be3[_0x9897('0x49')][_0x9897('0x57')])){utils[_0x9897('0x8')](util[_0x9897('0x9')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x247be3['uniqueid'],_0x247be3[_0x9897('0x48')]));channels[_0x247be3['uniqueid']][_0x9897('0x58')]=_0x247be3[_0x9897('0x48')];}if(!_['isNil'](_0x247be3[_0x9897('0x49')][_0x9897('0x59')])){utils[_0x9897('0x8')](util[_0x9897('0x9')](_0x9897('0x5a'),_0x247be3[_0x9897('0x7')],_0x247be3[_0x9897('0x48')]));channels[_0x247be3[_0x9897('0x7')]][_0x9897('0x5b')]=_0x247be3[_0x9897('0x48')];}if(!_[_0x9897('0x21')](_0x247be3[_0x9897('0x49')][_0x9897('0x5c')])){utils[_0x9897('0x8')](util[_0x9897('0x9')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x247be3['uniqueid'],_0x247be3['value']));channels[_0x247be3[_0x9897('0x7')]][_0x9897('0x5c')]=_0x247be3[_0x9897('0x48')];}}}catch(_0x8ccff){utils[_0x9897('0x1e')](util[_0x9897('0x9')](_0x9897('0x5d'),_0x247be3[_0x9897('0x7')]),_0x8ccff);}};exports[_0x9897('0x5e')]=function(_0x333a3a){try{if(!_['isNil'](channels[_0x333a3a[_0x9897('0x7')]])){utils[_0x9897('0x16')](util[_0x9897('0x9')](_0x9897('0x5f'),_0x333a3a[_0x9897('0x7')]),_0x333a3a);utils[_0x9897('0x8')](util[_0x9897('0x9')](_0x9897('0x60'),_0x333a3a[_0x9897('0x7')],_0x333a3a[_0x9897('0x61')],_0x333a3a['appdata']));if(_0x333a3a[_0x9897('0x61')][_0x9897('0x62')]()==_0x9897('0x63')&&_[_0x9897('0x64')](_0x333a3a['appdata'][_0x9897('0x62')](),_0x9897('0x65'))){var _0x4a176e=_0x333a3a['appdata'][_0x9897('0x66')]('=');var _0x42e33e=_0x4a176e[0x0][_0x9897('0x67')](_0x4a176e[0x0][_0x9897('0x68')]('(')+0x1,_0x4a176e[0x0][_0x9897('0x68')](')'));var _0x431d05=_0x4a176e[0x1];channels[_0x333a3a['uniqueid']][_0x42e33e]=_0x431d05;}if(!_[_0x9897('0x69')]([_0x9897('0x6a'),_0x9897('0x6b'),_0x9897('0x6c'),_0x9897('0x63'),_0x9897('0x6d')],_0x333a3a[_0x9897('0x61')][_0x9897('0x62')]())){channels[_0x333a3a[_0x9897('0x7')]][_0x9897('0x52')]=_0x333a3a[_0x9897('0x61')];channels[_0x333a3a['uniqueid']][_0x9897('0x6e')]=_0x333a3a[_0x9897('0x6f')];}}}catch(_0xfcce89){utils[_0x9897('0x1e')](util[_0x9897('0x9')](_0x9897('0x5f'),_0x333a3a['uniqueid']),_0xfcce89);}}; \ No newline at end of file +var _0xa34e=['toLowerCase','set','startsWith','cdr','split','lastIndexOf','hangup','noop','gotoif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','uniqueid','blinds','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','lastevent','accountcode','getUserByInternal','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','starttime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','appdata'];(function(_0x223226,_0x5b7d1f){var _0x309c42=function(_0x3c7ca3){while(--_0x3c7ca3){_0x223226['push'](_0x223226['shift']());}};_0x309c42(++_0x5b7d1f);}(_0xa34e,0xe3));var _0xea34=function(_0x4bcbc2,_0x46cbff){_0x4bcbc2=_0x4bcbc2-0x0;var _0xe5b888=_0xa34e[_0x4bcbc2];return _0xe5b888;};'use strict';var _=require(_0xea34('0x0'));var util=require(_0xea34('0x1'));var utils=require(_0xea34('0x2'));var transfers=require(_0xea34('0x3'));var dispositions=[_0xea34('0x4'),_0xea34('0x5'),_0xea34('0x5'),_0xea34('0x4'),'NO\x20ANSWER','NO\x20ANSWER',_0xea34('0x6'),_0xea34('0x7'),_0xea34('0x5'),_0xea34('0x5'),_0xea34('0x5')];var channels={};function writeDB(_0xf2207d){var _0xa6180f;if(transfers['blinds'][_0xf2207d[_0xea34('0x8')]]){_0xa6180f=_0xf2207d[_0xea34('0x8')];_0xf2207d[_0xea34('0x8')]=transfers[_0xea34('0x9')][_0xf2207d[_0xea34('0x8')]]['transfereeuniqueid'];}utils[_0xea34('0xa')](util[_0xea34('0xb')](_0xea34('0xc'),_0xf2207d[_0xea34('0x8')],_0xf2207d[_0xea34('0xd')],_0xf2207d[_0xea34('0xe')],_0xf2207d[_0xea34('0xf')],_0xf2207d[_0xea34('0x10')],_0xf2207d[_0xea34('0x11')],_0xf2207d['connectedlinenum'],_0xf2207d[_0xea34('0x12')]));if(_0xf2207d[_0xea34('0x13')]){utils[_0xea34('0x14')](_0xf2207d['accountcode'])['then'](function(_0x184cc3){if(_0x184cc3){_0xf2207d['UserId']=_0x184cc3['id'];}utils[_0xea34('0x15')](_0xea34('0x16'),_0xf2207d);});}else{utils[_0xea34('0x15')]('CreateVoiceCallReport',_0xf2207d);}if(channels[_0xf2207d[_0xea34('0x8')]]){delete channels[_0xf2207d[_0xea34('0x8')]];}else if(_0xa6180f&&channels[_0xa6180f]){delete transfers['blinds'][_0xa6180f];delete channels[_0xa6180f];}}exports['newchannel']=function(_0x448c8c){try{utils[_0xea34('0x17')](util[_0xea34('0xb')](_0xea34('0x18'),_0x448c8c['uniqueid']),_0x448c8c);if(_0x448c8c['uniqueid']==_0x448c8c[_0xea34('0x19')]&&_0x448c8c[_0xea34('0xd')]!='OutgoingSpoolFailed'){utils[_0xea34('0xa')](util[_0xea34('0xb')](_0xea34('0x1a'),_0x448c8c[_0xea34('0x8')],_0x448c8c[_0xea34('0x1b')],_0x448c8c[_0xea34('0x1c')]));channels[_0x448c8c[_0xea34('0x8')]]={'uniqueid':_0x448c8c[_0xea34('0x8')],'accountcode':_0x448c8c[_0xea34('0x13')],'source':_0x448c8c[_0xea34('0x11')],'destination':_0x448c8c[_0xea34('0x1c')],'destinationcontext':_0x448c8c[_0xea34('0x1b')],'channel':_0x448c8c[_0xea34('0xd')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xea34('0x4'),'amaflags':_0xea34('0x1d')};}}catch(_0x5c0167){utils[_0xea34('0x1e')](util[_0xea34('0xb')](_0xea34('0x18'),_0x448c8c[_0xea34('0x8')]),_0x5c0167);}};exports[_0xea34('0x1f')]=function(_0x4be38e){try{utils['debug'](util[_0xea34('0xb')](_0xea34('0x20'),_0x4be38e[_0xea34('0x8')]),_0x4be38e);if(!_[_0xea34('0x21')](channels[_0x4be38e[_0xea34('0x8')]])&&_0x4be38e[_0xea34('0x22')]==0x6){utils['info'](util[_0xea34('0xb')](_0xea34('0x23'),_0x4be38e[_0xea34('0x8')],_0x4be38e[_0xea34('0x1b')],_0x4be38e[_0xea34('0xd')]));if(_['isNil'](channels[_0x4be38e['uniqueid']]['systemanswertime'])){channels[_0x4be38e[_0xea34('0x8')]][_0xea34('0x24')]=utils[_0xea34('0x25')]();}}else if(!_[_0xea34('0x21')](channels[_0x4be38e[_0xea34('0x19')]])&&_0x4be38e['channelstate']==0x6&&_0x4be38e['context']!=_0xea34('0x26')){utils['info'](util[_0xea34('0xb')](_0xea34('0x27'),_0x4be38e['uniqueid'],_0x4be38e[_0xea34('0x19')],_0x4be38e[_0xea34('0x1b')],_0x4be38e['channel']));channels[_0x4be38e[_0xea34('0x19')]]['accountcode']=_0x4be38e[_0xea34('0x13')];channels[_0x4be38e[_0xea34('0x19')]][_0xea34('0x28')]=_0x4be38e[_0xea34('0xd')];if(_[_0xea34('0x21')](channels[_0x4be38e[_0xea34('0x19')]][_0xea34('0x29')])){channels[_0x4be38e[_0xea34('0x19')]][_0xea34('0x29')]=utils[_0xea34('0x25')]();}channels[_0x4be38e[_0xea34('0x19')]]['disposition']=dispositions[_[_0xea34('0x2a')](_0x4be38e[_0xea34('0x22')])]||_0xea34('0x6');}}catch(_0xd2faf5){utils[_0xea34('0x1e')](util['format'](_0xea34('0x20'),_0x4be38e[_0xea34('0x8')]),_0xd2faf5);}};exports['hangup']=function(_0x14b93d){try{if(!_[_0xea34('0x21')](channels[_0x14b93d[_0xea34('0x8')]])){utils[_0xea34('0x17')](util[_0xea34('0xb')](_0xea34('0x2b'),_0x14b93d[_0xea34('0x8')]),_0x14b93d);if(_[_0xea34('0x21')](channels[_0x14b93d[_0xea34('0x8')]][_0xea34('0x2c')])){channels[_0x14b93d['uniqueid']]['callerid']=_0x14b93d['calleridname']+'\x20<'+_0x14b93d[_0xea34('0x11')]+'>';}utils[_0xea34('0xa')](util[_0xea34('0xb')](_0xea34('0x2d'),_0x14b93d[_0xea34('0x8')],channels[_0x14b93d['uniqueid']][_0xea34('0x2c')],_0x14b93d['cause-txt']));channels[_0x14b93d[_0xea34('0x8')]][_0xea34('0x2e')]=utils['now']();channels[_0x14b93d[_0xea34('0x8')]][_0xea34('0x2f')]=utils[_0xea34('0x30')](channels[_0x14b93d[_0xea34('0x8')]][_0xea34('0x2e')],channels[_0x14b93d[_0xea34('0x8')]][_0xea34('0x31')]);channels[_0x14b93d['uniqueid']]['billableseconds']=channels[_0x14b93d[_0xea34('0x8')]]['answertime']?utils[_0xea34('0x30')](channels[_0x14b93d['uniqueid']][_0xea34('0x2e')],channels[_0x14b93d[_0xea34('0x8')]][_0xea34('0x29')]):0x0;writeDB(channels[_0x14b93d[_0xea34('0x8')]]);}}catch(_0x44f492){utils[_0xea34('0x1e')](util[_0xea34('0xb')](_0xea34('0x2b'),_0x14b93d['uniqueid']),_0x44f492);}};exports[_0xea34('0x32')]=function(_0x2ddf67){try{if(!_['isNil'](channels[_0x2ddf67[_0xea34('0x33')]])){utils['debug'](util[_0xea34('0xb')](_0xea34('0x34'),_0x2ddf67[_0xea34('0x35')]),_0x2ddf67);if(channels[_0x2ddf67['localtwolinkedid']]['channel']==_0x2ddf67[_0xea34('0x36')]){utils[_0xea34('0xa')](util[_0xea34('0xb')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x2ddf67[_0xea34('0x35')],_0x2ddf67[_0xea34('0x33')],_0x2ddf67[_0xea34('0x37')]));channels[_0x2ddf67[_0xea34('0x33')]][_0xea34('0x28')]=_0x2ddf67[_0xea34('0x37')];channels[_0x2ddf67['localtwolinkedid']]['userfield']=_0xea34('0x38');}else if(channels[_0x2ddf67[_0xea34('0x33')]][_0xea34('0xd')]=_0x2ddf67[_0xea34('0x39')]){utils[_0xea34('0xa')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x2ddf67[_0xea34('0x35')],_0x2ddf67['localtwolinkedid'],_0x2ddf67[_0xea34('0x3a')]));channels[_0x2ddf67[_0xea34('0x33')]][_0xea34('0x28')]=_0x2ddf67[_0xea34('0x3a')];channels[_0x2ddf67[_0xea34('0x33')]][_0xea34('0x3b')]='_attended';}}}catch(_0x1bbe3b){utils[_0xea34('0x1e')](util['format'](_0xea34('0x34'),_0x2ddf67[_0xea34('0x35')]),_0x1bbe3b);}};exports[_0xea34('0x3c')]=function(_0x7a4e60){try{if(!_[_0xea34('0x21')](channels[_0x7a4e60[_0xea34('0x8')]])){utils[_0xea34('0x17')](util[_0xea34('0xb')](_0xea34('0x3d'),_0x7a4e60[_0xea34('0x8')]),_0x7a4e60);channels[_0x7a4e60[_0xea34('0x8')]]['musiconholdstartAt']=utils[_0xea34('0x25')]();utils[_0xea34('0xa')](util['format'](_0xea34('0x3e'),_0x7a4e60[_0xea34('0x8')],channels[_0x7a4e60['uniqueid']][_0xea34('0x3f')]));}}catch(_0x1b0e43){utils['error'](util['format'](_0xea34('0x3d'),_0x7a4e60[_0xea34('0x8')]),_0x1b0e43);}};exports[_0xea34('0x40')]=function(_0x2414bb){try{if(!_['isNil'](channels[_0x2414bb[_0xea34('0x8')]])){utils['debug'](util[_0xea34('0xb')](_0xea34('0x41'),_0x2414bb[_0xea34('0x8')]),_0x2414bb);if(!_[_0xea34('0x21')](channels[_0x2414bb[_0xea34('0x8')]][_0xea34('0x3f')])){channels[_0x2414bb[_0xea34('0x8')]][_0xea34('0x42')]+=utils[_0xea34('0x30')](utils[_0xea34('0x25')](),channels[_0x2414bb[_0xea34('0x8')]][_0xea34('0x3f')]);utils[_0xea34('0xa')](util['format'](_0xea34('0x43'),_0x2414bb[_0xea34('0x8')],channels[_0x2414bb[_0xea34('0x8')]]['mohtime']));delete channels[_0x2414bb[_0xea34('0x8')]]['musiconholdstartAt'];}}}catch(_0x2adca0){utils[_0xea34('0x1e')](util[_0xea34('0xb')](_0xea34('0x41'),_0x2414bb[_0xea34('0x8')]),_0x2adca0);}};exports[_0xea34('0x44')]=function(_0x344b18){try{if(!_[_0xea34('0x21')](channels[_0x344b18[_0xea34('0x8')]])){utils[_0xea34('0x17')](util[_0xea34('0xb')](_0xea34('0x45'),_0x344b18['uniqueid']),_0x344b18);if(!_['isNil'](_0x344b18[_0xea34('0x46')][_0xea34('0x47')])){utils['info'](util[_0xea34('0xb')](_0xea34('0x48'),_0x344b18['uniqueid'],_0x344b18[_0xea34('0x49')]));channels[_0x344b18[_0xea34('0x8')]][_0xea34('0x4a')]=_0x344b18[_0xea34('0x49')];}if(!_['isNil'](_0x344b18[_0xea34('0x46')][_0xea34('0x4b')])){utils[_0xea34('0xa')](util[_0xea34('0xb')](_0xea34('0x4c'),_0x344b18[_0xea34('0x8')],_0x344b18[_0xea34('0x49')]));channels[_0x344b18['uniqueid']][_0xea34('0x4d')]=_0x344b18[_0xea34('0x49')];channels[_0x344b18[_0xea34('0x8')]]['callerid']='\x22'+_0x344b18[_0xea34('0x49')]+_0xea34('0x4e')+_0x344b18['value']+'>';}if(!_[_0xea34('0x21')](_0x344b18['variable'][_0xea34('0x4f')])||!_['isNil'](_0x344b18['variable'][_0xea34('0x50')])){utils[_0xea34('0xa')](util[_0xea34('0xb')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x344b18['uniqueid'],!_[_0xea34('0x21')](_0x344b18['variable'][_0xea34('0x4f')])?'xmd-callerid-preview':_0xea34('0x50'),_0x344b18['value']));channels[_0x344b18['uniqueid']][_0xea34('0x2c')]=_0x344b18[_0xea34('0x49')];}if(!_[_0xea34('0x21')](_0x344b18[_0xea34('0x46')][_0xea34('0x51')])||!_['isNil'](_0x344b18['variable'][_0xea34('0x52')])){utils['info'](util[_0xea34('0xb')](_0xea34('0x53'),_0x344b18['uniqueid'],!_[_0xea34('0x21')](_0x344b18[_0xea34('0x46')][_0xea34('0x51')])?'xmd-queue':_0xea34('0x52'),_0x344b18[_0xea34('0x49')]));channels[_0x344b18[_0xea34('0x8')]][_0xea34('0x54')]=_0xea34('0x55');channels[_0x344b18['uniqueid']][_0xea34('0x56')]=_0x344b18[_0xea34('0x49')];channels[_0x344b18['uniqueid']][_0xea34('0xe')]=!![];}if(!_[_0xea34('0x21')](_0x344b18[_0xea34('0x46')]['xmd-contactid'])){utils[_0xea34('0xa')](util['format'](_0xea34('0x57'),_0x344b18[_0xea34('0x8')],_0x344b18['value']));channels[_0x344b18['uniqueid']][_0xea34('0x58')]=_0x344b18['value'];}if(!_[_0xea34('0x21')](_0x344b18[_0xea34('0x46')][_0xea34('0x59')])){utils['info'](util[_0xea34('0xb')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x344b18[_0xea34('0x8')],_0x344b18[_0xea34('0x49')]));channels[_0x344b18[_0xea34('0x8')]][_0xea34('0x5a')]=_0x344b18['value'];}if(!_[_0xea34('0x21')](_0x344b18[_0xea34('0x46')][_0xea34('0x5b')])){utils[_0xea34('0xa')](util[_0xea34('0xb')](_0xea34('0x5c'),_0x344b18[_0xea34('0x8')],_0x344b18['value']));channels[_0x344b18['uniqueid']][_0xea34('0x5d')]=_0x344b18[_0xea34('0x49')];}if(!_[_0xea34('0x21')](_0x344b18[_0xea34('0x46')][_0xea34('0x5e')])){utils[_0xea34('0xa')](util['format'](_0xea34('0x5f'),_0x344b18[_0xea34('0x8')],_0x344b18['value']));channels[_0x344b18[_0xea34('0x8')]]['sipcallid']=_0x344b18[_0xea34('0x49')];}}}catch(_0x182589){utils[_0xea34('0x1e')](util['format']('[%s][calls][varset]',_0x344b18[_0xea34('0x8')]),_0x182589);}};exports[_0xea34('0x60')]=function(_0x4a10cb){try{if(!_[_0xea34('0x21')](channels[_0x4a10cb[_0xea34('0x8')]])){utils[_0xea34('0x17')](util[_0xea34('0xb')](_0xea34('0x61'),_0x4a10cb[_0xea34('0x8')]),_0x4a10cb);utils[_0xea34('0xa')](util[_0xea34('0xb')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x4a10cb[_0xea34('0x8')],_0x4a10cb[_0xea34('0x62')],_0x4a10cb[_0xea34('0x63')]));if(_0x4a10cb[_0xea34('0x62')][_0xea34('0x64')]()==_0xea34('0x65')&&_[_0xea34('0x66')](_0x4a10cb[_0xea34('0x63')][_0xea34('0x64')](),_0xea34('0x67'))){var _0x1e4f58=_0x4a10cb[_0xea34('0x63')][_0xea34('0x68')]('=');var _0x378bb3=_0x1e4f58[0x0]['substring'](_0x1e4f58[0x0][_0xea34('0x69')]('(')+0x1,_0x1e4f58[0x0][_0xea34('0x69')](')'));var _0x1f7a98=_0x1e4f58[0x1];channels[_0x4a10cb[_0xea34('0x8')]][_0x378bb3]=_0x1f7a98;}if(!_['includes']([_0xea34('0x6a'),_0xea34('0x6b'),'execif',_0xea34('0x65'),_0xea34('0x6c')],_0x4a10cb['application'][_0xea34('0x64')]())){channels[_0x4a10cb[_0xea34('0x8')]][_0xea34('0x54')]=_0x4a10cb[_0xea34('0x62')];channels[_0x4a10cb[_0xea34('0x8')]][_0xea34('0x56')]=_0x4a10cb['appdata'];}}}catch(_0x1cfe90){utils[_0xea34('0x1e')](util['format'](_0xea34('0x61'),_0x4a10cb[_0xea34('0x8')]),_0x1cfe90);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index d40cc12..70d0426 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 _0xcad8=['fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected'];(function(_0x4758d9,_0x86142b){var _0x4681ee=function(_0x24b01c){while(--_0x24b01c){_0x4758d9['push'](_0x4758d9['shift']());}};_0x4681ee(++_0x86142b);}(_0xcad8,0x114));var _0x8cad=function(_0x4652f7,_0x4fa36f){_0x4652f7=_0x4652f7-0x0;var _0x12c928=_0xcad8[_0x4652f7];return _0x12c928;};'use strict';var utils=require(_0x8cad('0x0'));exports[_0x8cad('0x1')]=function(){utils[_0x8cad('0x2')](_0x8cad('0x3'));};exports['shutdown']=function(){utils[_0x8cad('0x2')]('[core]\x20shutdown');};exports[_0x8cad('0x4')]=function(){utils[_0x8cad('0x2')]('[core]\x20fullybooted');};exports[_0x8cad('0x5')]=function(_0x3841df){utils[_0x8cad('0x5')](_0x8cad('0x6'),_0x3841df);};exports[_0x8cad('0x7')]=function(){utils[_0x8cad('0x2')](_0x8cad('0x8'));};exports[_0x8cad('0x9')]=function(_0x120732){}; \ No newline at end of file +var _0x1c7b=['managerevent','connect','info','[core]\x20connected','shutdown','fullybooted','error','close','[core]\x20close'];(function(_0x4739d8,_0x380c22){var _0x1350fe=function(_0x330a0f){while(--_0x330a0f){_0x4739d8['push'](_0x4739d8['shift']());}};_0x1350fe(++_0x380c22);}(_0x1c7b,0x1ba));var _0xb1c7=function(_0x20f9bc,_0x22df6b){_0x20f9bc=_0x20f9bc-0x0;var _0x30756a=_0x1c7b[_0x20f9bc];return _0x30756a;};'use strict';var utils=require('./utils');exports[_0xb1c7('0x0')]=function(){utils[_0xb1c7('0x1')](_0xb1c7('0x2'));};exports[_0xb1c7('0x3')]=function(){utils[_0xb1c7('0x1')]('[core]\x20shutdown');};exports[_0xb1c7('0x4')]=function(){utils[_0xb1c7('0x1')]('[core]\x20fullybooted');};exports[_0xb1c7('0x5')]=function(_0x102f00){utils[_0xb1c7('0x5')]('[core]\x20error',_0x102f00);};exports[_0xb1c7('0x6')]=function(){utils[_0xb1c7('0x1')](_0xb1c7('0x7'));};exports[_0xb1c7('0x8')]=function(_0x31831f){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index bf55f75..51b7814 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 _0x3c38=['[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','endtime','holdtime','diffTime','billableseconds','lodash','util','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug'];(function(_0x5a609d,_0x5f1b10){var _0x2a1ba9=function(_0x46d785){while(--_0x46d785){_0x5a609d['push'](_0x5a609d['shift']());}};_0x2a1ba9(++_0x5f1b10);}(_0x3c38,0xc5));var _0x83c3=function(_0x1aed01,_0x2a75f8){_0x1aed01=_0x1aed01-0x0;var _0x233d71=_0x3c38[_0x1aed01];return _0x233d71;};'use strict';var _=require(_0x83c3('0x0'));var util=require(_0x83c3('0x1'));var utils=require(_0x83c3('0x2'));var dials={};function writeDB(_0xb69c75){utils['info'](util[_0x83c3('0x3')](_0x83c3('0x4'),_0xb69c75[_0x83c3('0x5')],_0xb69c75[_0x83c3('0x6')],_0xb69c75[_0x83c3('0x7')],_0xb69c75[_0x83c3('0x8')],_0xb69c75[_0x83c3('0x9')],_0xb69c75[_0x83c3('0xa')]));utils[_0x83c3('0xb')](_0x83c3('0xc'),_0xb69c75);delete dials[_0xb69c75[_0x83c3('0x5')]];}exports[_0x83c3('0xd')]=function(_0x2974ef){try{utils[_0x83c3('0xe')](util['format'](_0x83c3('0xf'),_0x2974ef[_0x83c3('0x5')]),_0x2974ef);utils[_0x83c3('0x10')](util[_0x83c3('0x3')](_0x83c3('0x11'),_0x2974ef[_0x83c3('0x5')],_0x2974ef[_0x83c3('0x12')],_0x2974ef[_0x83c3('0x13')]));if(_0x2974ef[_0x83c3('0x12')][_0x83c3('0x14')]()==_0x83c3('0x15')&&_[_0x83c3('0x16')](_0x2974ef['appdata'][_0x83c3('0x14')](),_0x83c3('0x17'))){var _0x2a2e1b=_0x2974ef[_0x83c3('0x13')][_0x83c3('0x18')]('=');dials[_0x2974ef['uniqueid']]={'routeId':_0x2a2e1b[0x1]};}}catch(_0x505c9e){utils[_0x83c3('0x19')](util[_0x83c3('0x3')](_0x83c3('0xf'),_0x2974ef['uniqueid']),_0x505c9e);}};exports[_0x83c3('0x1a')]=function(_0x56f649){try{utils[_0x83c3('0xe')](util[_0x83c3('0x3')](_0x83c3('0x1b'),_0x56f649[_0x83c3('0x5')]),_0x56f649);if(!_[_0x83c3('0x1c')](_0x56f649['variable'][_0x83c3('0x1d')])){utils[_0x83c3('0x10')](util[_0x83c3('0x3')](_0x83c3('0x1e'),_0x56f649['uniqueid'],_0x56f649[_0x83c3('0x1f')]));dials[_0x56f649[_0x83c3('0x5')]]={'routeId':_0x56f649[_0x83c3('0x1f')]};}}catch(_0x306c33){utils[_0x83c3('0x19')](util[_0x83c3('0x3')](_0x83c3('0x1b'),_0x56f649[_0x83c3('0x5')]),_0x306c33);}};exports['dialbegin']=function(_0x5299b6){try{if(!_[_0x83c3('0x1c')](dials[_0x5299b6['uniqueid']])){utils[_0x83c3('0xe')](util[_0x83c3('0x3')](_0x83c3('0x20'),_0x5299b6[_0x83c3('0x5')]),_0x5299b6);dials[_0x5299b6[_0x83c3('0x5')]]=_[_0x83c3('0x21')](dials[_0x5299b6['uniqueid']],_0x5299b6);dials[_0x5299b6[_0x83c3('0x5')]][_0x83c3('0x22')]=utils[_0x83c3('0x23')]();dials[_0x5299b6[_0x83c3('0x5')]][_0x83c3('0x24')]=_0x83c3('0x25');utils['info'](util['format'](_0x83c3('0x26'),_0x5299b6['uniqueid'],dials[_0x5299b6['uniqueid']]['starttime']));}}catch(_0x3e65c3){utils[_0x83c3('0x19')](util[_0x83c3('0x3')](_0x83c3('0x20'),_0x5299b6[_0x83c3('0x5')]),_0x3e65c3);}};exports['dialend']=function(_0x303af1){try{if(!_[_0x83c3('0x1c')](dials[_0x303af1[_0x83c3('0x5')]])){utils[_0x83c3('0xe')](util[_0x83c3('0x3')](_0x83c3('0x27'),_0x303af1[_0x83c3('0x5')]),_0x303af1);dials[_0x303af1[_0x83c3('0x5')]][_0x83c3('0xa')]=_0x303af1['dialstatus'];if(_0x303af1[_0x83c3('0xa')]=='ANSWER'){dials[_0x303af1[_0x83c3('0x5')]]=_['assign'](dials[_0x303af1[_0x83c3('0x5')]],_0x303af1);dials[_0x303af1['uniqueid']]['answertime']=utils[_0x83c3('0x23')]();dials[_0x303af1[_0x83c3('0x5')]][_0x83c3('0x24')]=_0x83c3('0x28');utils[_0x83c3('0x10')](util[_0x83c3('0x3')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x303af1[_0x83c3('0x5')],_0x303af1[_0x83c3('0xa')],dials[_0x303af1[_0x83c3('0x5')]][_0x83c3('0x29')]));}else{utils[_0x83c3('0x10')](util[_0x83c3('0x3')](_0x83c3('0x2a'),_0x303af1[_0x83c3('0x5')],_0x303af1[_0x83c3('0xa')]));}}}catch(_0x37dc47){utils[_0x83c3('0x19')](util[_0x83c3('0x3')]('[%s][dials][dialend]',_0x303af1['uniqueid']),_0x37dc47);}};exports['hangup']=function(_0xcc5ac8){try{if(!_[_0x83c3('0x1c')](dials[_0xcc5ac8[_0x83c3('0x5')]])){utils['debug'](util[_0x83c3('0x3')](_0x83c3('0x2b'),_0xcc5ac8[_0x83c3('0x5')]),_0xcc5ac8);utils[_0x83c3('0x10')](util['format'](_0x83c3('0x2c'),_0xcc5ac8[_0x83c3('0x5')],_0xcc5ac8[_0x83c3('0x8')],_0xcc5ac8[_0x83c3('0x2d')],_0xcc5ac8[_0x83c3('0x2e')]));dials[_0xcc5ac8['uniqueid']]=_[_0x83c3('0x21')](dials[_0xcc5ac8['uniqueid']],{'endtime':utils['now'](),'lastevent':_0x83c3('0x2f')});dials[_0xcc5ac8['uniqueid']][_0x83c3('0x30')]=utils['diffTime'](dials[_0xcc5ac8['uniqueid']][_0x83c3('0x31')],dials[_0xcc5ac8[_0x83c3('0x5')]][_0x83c3('0x22')]);dials[_0xcc5ac8[_0x83c3('0x5')]][_0x83c3('0x32')]=utils[_0x83c3('0x33')](dials[_0xcc5ac8[_0x83c3('0x5')]][_0x83c3('0x29')]||dials[_0xcc5ac8[_0x83c3('0x5')]][_0x83c3('0x31')],dials[_0xcc5ac8['uniqueid']][_0x83c3('0x22')]);dials[_0xcc5ac8[_0x83c3('0x5')]][_0x83c3('0x34')]=dials[_0xcc5ac8[_0x83c3('0x5')]][_0x83c3('0x29')]?utils[_0x83c3('0x33')](dials[_0xcc5ac8[_0x83c3('0x5')]][_0x83c3('0x31')],dials[_0xcc5ac8[_0x83c3('0x5')]][_0x83c3('0x29')]):0x0;writeDB(dials[_0xcc5ac8[_0x83c3('0x5')]]);}}catch(_0x1538dc){utils['error'](util[_0x83c3('0x3')](_0x83c3('0x2b'),_0xcc5ac8[_0x83c3('0x5')]),_0x1538dc);}}; \ No newline at end of file +var _0x9a06=['[%s][dials][varset]','dialbegin','starttime','now','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','ANSWER','answertime','lastevent','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','cause-txt','assign','complete','duration','diffTime','endtime','holdtime','billableseconds','util','info','format','channel','dialstring','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug','application','appdata','set','startsWith','cdr(routeid)','[%s][dials][newexten]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error'];(function(_0xb65e77,_0x238c3d){var _0x38134b=function(_0x39da21){while(--_0x39da21){_0xb65e77['push'](_0xb65e77['shift']());}};_0x38134b(++_0x238c3d);}(_0x9a06,0x1bf));var _0x69a0=function(_0x29b5d6,_0x12c81e){_0x29b5d6=_0x29b5d6-0x0;var _0x14811e=_0x9a06[_0x29b5d6];return _0x14811e;};'use strict';var _=require('lodash');var util=require(_0x69a0('0x0'));var utils=require('./utils');var dials={};function writeDB(_0x4388b5){utils[_0x69a0('0x1')](util[_0x69a0('0x2')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x4388b5['uniqueid'],_0x4388b5[_0x69a0('0x3')],_0x4388b5[_0x69a0('0x4')],_0x4388b5['calleridnum'],_0x4388b5['connectedlinenum'],_0x4388b5[_0x69a0('0x5')]));utils[_0x69a0('0x6')](_0x69a0('0x7'),_0x4388b5);delete dials[_0x4388b5[_0x69a0('0x8')]];}exports[_0x69a0('0x9')]=function(_0x4066a1){try{utils[_0x69a0('0xa')](util[_0x69a0('0x2')]('[%s][dials][newexten]',_0x4066a1[_0x69a0('0x8')]),_0x4066a1);utils['info'](util[_0x69a0('0x2')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x4066a1['uniqueid'],_0x4066a1[_0x69a0('0xb')],_0x4066a1[_0x69a0('0xc')]));if(_0x4066a1[_0x69a0('0xb')]['toLowerCase']()==_0x69a0('0xd')&&_[_0x69a0('0xe')](_0x4066a1['appdata']['toLowerCase'](),_0x69a0('0xf'))){var _0x25c746=_0x4066a1['appdata']['split']('=');dials[_0x4066a1['uniqueid']]={'routeId':_0x25c746[0x1]};}}catch(_0x209d19){utils['error'](util[_0x69a0('0x2')](_0x69a0('0x10'),_0x4066a1[_0x69a0('0x8')]),_0x209d19);}};exports['varset']=function(_0x60de98){try{utils[_0x69a0('0xa')](util['format']('[%s][dials][varset]',_0x60de98['uniqueid']),_0x60de98);if(!_[_0x69a0('0x11')](_0x60de98[_0x69a0('0x12')][_0x69a0('0x13')])){utils[_0x69a0('0x1')](util[_0x69a0('0x2')](_0x69a0('0x14'),_0x60de98[_0x69a0('0x8')],_0x60de98[_0x69a0('0x15')]));dials[_0x60de98['uniqueid']]={'routeId':_0x60de98[_0x69a0('0x15')]};}}catch(_0x4323ae){utils[_0x69a0('0x16')](util[_0x69a0('0x2')](_0x69a0('0x17'),_0x60de98[_0x69a0('0x8')]),_0x4323ae);}};exports[_0x69a0('0x18')]=function(_0x498754){try{if(!_[_0x69a0('0x11')](dials[_0x498754[_0x69a0('0x8')]])){utils[_0x69a0('0xa')](util[_0x69a0('0x2')]('[%s][dials][dialbegin]',_0x498754[_0x69a0('0x8')]),_0x498754);dials[_0x498754[_0x69a0('0x8')]]=_['assign'](dials[_0x498754['uniqueid']],_0x498754);dials[_0x498754[_0x69a0('0x8')]][_0x69a0('0x19')]=utils[_0x69a0('0x1a')]();dials[_0x498754[_0x69a0('0x8')]]['lastevent']='called';utils[_0x69a0('0x1')](util[_0x69a0('0x2')](_0x69a0('0x1b'),_0x498754[_0x69a0('0x8')],dials[_0x498754[_0x69a0('0x8')]][_0x69a0('0x19')]));}}catch(_0x130f58){utils[_0x69a0('0x16')](util[_0x69a0('0x2')](_0x69a0('0x1c'),_0x498754[_0x69a0('0x8')]),_0x130f58);}};exports[_0x69a0('0x1d')]=function(_0x2176be){try{if(!_[_0x69a0('0x11')](dials[_0x2176be[_0x69a0('0x8')]])){utils[_0x69a0('0xa')](util[_0x69a0('0x2')](_0x69a0('0x1e'),_0x2176be[_0x69a0('0x8')]),_0x2176be);dials[_0x2176be[_0x69a0('0x8')]][_0x69a0('0x5')]=_0x2176be[_0x69a0('0x5')];if(_0x2176be[_0x69a0('0x5')]==_0x69a0('0x1f')){dials[_0x2176be[_0x69a0('0x8')]]=_['assign'](dials[_0x2176be[_0x69a0('0x8')]],_0x2176be);dials[_0x2176be[_0x69a0('0x8')]][_0x69a0('0x20')]=utils['now']();dials[_0x2176be[_0x69a0('0x8')]][_0x69a0('0x21')]='connect';utils[_0x69a0('0x1')](util[_0x69a0('0x2')](_0x69a0('0x22'),_0x2176be[_0x69a0('0x8')],_0x2176be[_0x69a0('0x5')],dials[_0x2176be[_0x69a0('0x8')]][_0x69a0('0x20')]));}else{utils[_0x69a0('0x1')](util[_0x69a0('0x2')](_0x69a0('0x23'),_0x2176be[_0x69a0('0x8')],_0x2176be['dialstatus']));}}}catch(_0x4c49b9){utils[_0x69a0('0x16')](util['format'](_0x69a0('0x1e'),_0x2176be[_0x69a0('0x8')]),_0x4c49b9);}};exports['hangup']=function(_0x15ad8b){try{if(!_[_0x69a0('0x11')](dials[_0x15ad8b[_0x69a0('0x8')]])){utils[_0x69a0('0xa')](util['format'](_0x69a0('0x24'),_0x15ad8b[_0x69a0('0x8')]),_0x15ad8b);utils[_0x69a0('0x1')](util['format'](_0x69a0('0x25'),_0x15ad8b[_0x69a0('0x8')],_0x15ad8b[_0x69a0('0x26')],_0x15ad8b['calleridname'],_0x15ad8b[_0x69a0('0x27')]));dials[_0x15ad8b[_0x69a0('0x8')]]=_[_0x69a0('0x28')](dials[_0x15ad8b['uniqueid']],{'endtime':utils[_0x69a0('0x1a')](),'lastevent':_0x69a0('0x29')});dials[_0x15ad8b['uniqueid']][_0x69a0('0x2a')]=utils[_0x69a0('0x2b')](dials[_0x15ad8b[_0x69a0('0x8')]][_0x69a0('0x2c')],dials[_0x15ad8b['uniqueid']]['starttime']);dials[_0x15ad8b[_0x69a0('0x8')]][_0x69a0('0x2d')]=utils[_0x69a0('0x2b')](dials[_0x15ad8b[_0x69a0('0x8')]][_0x69a0('0x20')]||dials[_0x15ad8b[_0x69a0('0x8')]][_0x69a0('0x2c')],dials[_0x15ad8b[_0x69a0('0x8')]]['starttime']);dials[_0x15ad8b['uniqueid']][_0x69a0('0x2e')]=dials[_0x15ad8b['uniqueid']][_0x69a0('0x20')]?utils[_0x69a0('0x2b')](dials[_0x15ad8b['uniqueid']][_0x69a0('0x2c')],dials[_0x15ad8b[_0x69a0('0x8')]]['answertime']):0x0;writeDB(dials[_0x15ad8b['uniqueid']]);}}catch(_0x351f61){utils[_0x69a0('0x16')](util[_0x69a0('0x2')](_0x69a0('0x24'),_0x15ad8b[_0x69a0('0x8')]),_0x351f61);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 623fc6a..2c84e5e 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 _0x2353=['shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','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','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','port','asterisk','username','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','connect'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2353,0x138));var _0x3235=function(_0x3a6691,_0x2d42dd){_0x3a6691=_0x3a6691-0x0;var _0xea1fc3=_0x2353[_0x3a6691];return _0xea1fc3;};var AsteriskManager=require(_0x3235('0x0'));var config=require(_0x3235('0x1'));var utils=require(_0x3235('0x2'));var util=require('util');var ami=new AsteriskManager(config['asterisk'][_0x3235('0x3')],config[_0x3235('0x4')]['ip'],config['asterisk'][_0x3235('0x5')],config[_0x3235('0x4')]['password'],!![]);ami[_0x3235('0x6')]();if(config['xdr']&&config[_0x3235('0x7')][_0x3235('0x8')]){utils[_0x3235('0x9')](_0x3235('0xa'));}else{var agents=require(_0x3235('0xb'));var calls=require(_0x3235('0xc'));var queues=require(_0x3235('0xd'));var recordings=require(_0x3235('0xe'));var members=require(_0x3235('0xf'));var dials=require(_0x3235('0x10'));var transfers=require('./transfers.controller');var core=require('./core.controller');ami['on'](_0x3235('0x11'),core[_0x3235('0x11')]);ami['on'](_0x3235('0x12'),core[_0x3235('0x12')]);ami['on'](_0x3235('0x13'),core[_0x3235('0x13')]);ami['on'](_0x3235('0x14'),core[_0x3235('0x14')]);ami['on'](_0x3235('0x15'),core['close']);ami['on'](_0x3235('0x16'),core[_0x3235('0x16')]);ami['on'](_0x3235('0x17'),function(_0x1b7ae8){try{utils['debug'](util[_0x3235('0x18')](_0x3235('0x19'),_0x1b7ae8['device']),_0x1b7ae8);members[_0x3235('0x17')](_0x1b7ae8);}catch(_0x4d62c1){utils[_0x3235('0x14')](util[_0x3235('0x18')](_0x3235('0x19'),_0x1b7ae8['device']),_0x4d62c1);}});ami['on'](_0x3235('0x1a'),function(_0x519980){try{utils[_0x3235('0x1b')](util[_0x3235('0x18')](_0x3235('0x1c'),_0x519980[_0x3235('0x1d')]),_0x519980);agents[_0x3235('0x1a')](_0x519980);}catch(_0x480db5){utils[_0x3235('0x14')](util['format'](_0x3235('0x1c'),_0x519980[_0x3235('0x1d')]),_0x480db5);}});ami['on'](_0x3235('0x1e'),function(_0x5a792d){try{utils[_0x3235('0x1b')](util[_0x3235('0x18')]('[%s][index][agentringnoanswer]',_0x5a792d['uniqueid']),_0x5a792d);agents['agentringnoanswer'](_0x5a792d);}catch(_0x370526){utils['error'](util['format'](_0x3235('0x1f'),_0x5a792d[_0x3235('0x1d')]),_0x370526);}});ami['on']('agentconnect',function(_0x3f5012){try{utils[_0x3235('0x1b')](util[_0x3235('0x18')](_0x3235('0x20'),_0x3f5012['uniqueid']),_0x3f5012);agents[_0x3235('0x21')](_0x3f5012);queues[_0x3235('0x21')](_0x3f5012);}catch(_0x52d8bd){utils[_0x3235('0x14')](util[_0x3235('0x18')]('[%s][index][agentconnect]',_0x3f5012['uniqueid']),_0x52d8bd);}});ami['on']('agentcomplete',function(_0x483040){try{utils['debug'](util['format'](_0x3235('0x22'),_0x483040[_0x3235('0x1d')]),_0x483040);agents['agentcomplete'](_0x483040);queues[_0x3235('0x23')](_0x483040);members[_0x3235('0x23')](_0x483040);}catch(_0x4bcf13){utils[_0x3235('0x14')](util[_0x3235('0x18')](_0x3235('0x22'),_0x483040[_0x3235('0x1d')]),_0x4bcf13);}});ami['on'](_0x3235('0x24'),function(_0x265a7b){try{utils[_0x3235('0x1b')](util[_0x3235('0x18')](_0x3235('0x25'),_0x265a7b[_0x3235('0x1d')]),_0x265a7b);agents[_0x3235('0x24')](_0x265a7b);queues[_0x3235('0x24')](_0x265a7b);}catch(_0x54e24b){utils[_0x3235('0x14')](util[_0x3235('0x18')](_0x3235('0x25'),_0x265a7b['uniqueid']),_0x54e24b);}});ami['on']('queuecallerjoin',function(_0x59f97c){try{utils[_0x3235('0x1b')](util['format'](_0x3235('0x26'),_0x59f97c[_0x3235('0x1d')]),_0x59f97c);queues[_0x3235('0x27')](_0x59f97c);recordings['queuecallerjoin'](_0x59f97c);}catch(_0x2e04ee){utils['error'](util[_0x3235('0x18')]('[%s][index][queuecallerjoin]',_0x59f97c[_0x3235('0x1d')]),_0x2e04ee);}});ami['on']('queuecallerleave',function(_0x413462){try{utils['debug'](util[_0x3235('0x18')]('[%s][index][queuecallerleave]',_0x413462[_0x3235('0x1d')]),_0x413462);queues[_0x3235('0x28')](_0x413462);}catch(_0x1d55af){utils[_0x3235('0x14')](util[_0x3235('0x18')](_0x3235('0x29'),_0x413462['uniqueid']),_0x1d55af);}});ami['on']('musiconholdstart',function(_0x340189){try{utils[_0x3235('0x1b')](util[_0x3235('0x18')](_0x3235('0x2a'),_0x340189['uniqueid']),_0x340189);queues[_0x3235('0x2b')](_0x340189);calls[_0x3235('0x2b')](_0x340189);}catch(_0x4bacd6){utils[_0x3235('0x14')](util[_0x3235('0x18')](_0x3235('0x2a'),_0x340189[_0x3235('0x1d')]),_0x4bacd6);}});ami['on'](_0x3235('0x2c'),function(_0x27f1ed){try{utils[_0x3235('0x1b')](util[_0x3235('0x18')]('[%s][index][musiconholdstop]',_0x27f1ed[_0x3235('0x1d')]),_0x27f1ed);queues['musiconholdstop'](_0x27f1ed);calls[_0x3235('0x2c')](_0x27f1ed);}catch(_0x3228b7){utils[_0x3235('0x14')](util[_0x3235('0x18')](_0x3235('0x2d'),_0x27f1ed[_0x3235('0x1d')]),_0x3228b7);}});ami['on']('newstate',function(_0x3b5feb){try{utils[_0x3235('0x1b')](util[_0x3235('0x18')](_0x3235('0x2e'),_0x3b5feb[_0x3235('0x1d')]),_0x3b5feb);calls[_0x3235('0x2f')](_0x3b5feb);recordings[_0x3235('0x2f')](_0x3b5feb);}catch(_0xc55a8e){utils['error'](util[_0x3235('0x18')]('[%s][index][newstate]',_0x3b5feb[_0x3235('0x1d')]),_0xc55a8e);}});ami['on']('hangup',function(_0x42c564){try{utils['debug'](util[_0x3235('0x18')](_0x3235('0x30'),_0x42c564[_0x3235('0x1d')]),_0x42c564);calls[_0x3235('0x31')](_0x42c564);recordings['hangup'](_0x42c564);dials[_0x3235('0x31')](_0x42c564);agents[_0x3235('0x31')](_0x42c564);queues[_0x3235('0x31')](_0x42c564);}catch(_0x46e9b6){utils[_0x3235('0x14')](util[_0x3235('0x18')](_0x3235('0x30'),_0x42c564[_0x3235('0x1d')]),_0x46e9b6);}});ami['on'](_0x3235('0x32'),function(_0xcf2677){try{utils[_0x3235('0x1b')](util[_0x3235('0x18')](_0x3235('0x33'),_0xcf2677[_0x3235('0x1d')]),_0xcf2677);members[_0x3235('0x32')](_0xcf2677);}catch(_0x5cd7de){utils['error'](util['format'](_0x3235('0x33'),_0xcf2677[_0x3235('0x1d')]),_0x5cd7de);}});ami['on'](_0x3235('0x34'),function(_0x1f9df6){try{utils[_0x3235('0x1b')](util['format']('[%s][index][blindtransfer]',_0x1f9df6[_0x3235('0x1d')]),_0x1f9df6);queues['blindtransfer'](_0x1f9df6);agents['blindtransfer'](_0x1f9df6);transfers[_0x3235('0x34')](_0x1f9df6);}catch(_0x5d1b1b){utils[_0x3235('0x14')](util['format'](_0x3235('0x35'),_0x1f9df6[_0x3235('0x1d')]),_0x5d1b1b);}});ami['on'](_0x3235('0x36'),function(_0x57ff49){try{utils[_0x3235('0x1b')](util[_0x3235('0x18')](_0x3235('0x37'),_0x57ff49[_0x3235('0x38')]),_0x57ff49);queues[_0x3235('0x36')](_0x57ff49);transfers[_0x3235('0x36')](_0x57ff49);agents[_0x3235('0x36')](_0x57ff49);calls['attendedtransfer'](_0x57ff49);}catch(_0x2e617e){utils[_0x3235('0x14')](util['format']('[%s][index][attendedtransfer]',_0x57ff49[_0x3235('0x38')]),_0x2e617e);}});ami['on'](_0x3235('0x39'),function(_0x1b8674){try{utils['debug'](util['format']('[%s][index][varset]',_0x1b8674[_0x3235('0x1d')]),_0x1b8674);queues[_0x3235('0x39')](_0x1b8674);recordings[_0x3235('0x39')](_0x1b8674);calls[_0x3235('0x39')](_0x1b8674);dials[_0x3235('0x39')](_0x1b8674);}catch(_0x324958){utils[_0x3235('0x14')](util[_0x3235('0x18')](_0x3235('0x3a'),_0x1b8674[_0x3235('0x1d')]),_0x324958);}});ami['on'](_0x3235('0x3b'),function(_0xfd1442){try{utils[_0x3235('0x1b')](util[_0x3235('0x18')](_0x3235('0x3c'),_0xfd1442[_0x3235('0x1d')]),_0xfd1442);calls[_0x3235('0x3b')](_0xfd1442);recordings[_0x3235('0x3b')](_0xfd1442);dials[_0x3235('0x3b')](_0xfd1442);}catch(_0x32ec35){utils[_0x3235('0x14')](util[_0x3235('0x18')](_0x3235('0x3c'),_0xfd1442['uniqueid']),_0x32ec35);}});ami['on']('newchannel',function(_0x3e4a90){try{utils['debug'](util['format']('[%s][index][newchannel]',_0x3e4a90[_0x3235('0x1d')]),_0x3e4a90);calls[_0x3235('0x3d')](_0x3e4a90);recordings[_0x3235('0x3d')](_0x3e4a90);}catch(_0x161966){utils[_0x3235('0x14')](util[_0x3235('0x18')]('[%s][index][newchannel]',_0x3e4a90[_0x3235('0x1d')]),_0x161966);}});ami['on'](_0x3235('0x3e'),function(_0x487d8b){try{utils['debug'](util[_0x3235('0x18')](_0x3235('0x3f'),_0x487d8b['uniqueid']),_0x487d8b);dials['dialbegin'](_0x487d8b);}catch(_0x47738e){utils[_0x3235('0x14')](util['format']('[%s]dialbegin',_0x487d8b[_0x3235('0x1d')]),_0x47738e);}});ami['on'](_0x3235('0x40'),function(_0x4a09de){try{utils[_0x3235('0x1b')](util[_0x3235('0x18')](_0x3235('0x41'),_0x4a09de[_0x3235('0x1d')]),_0x4a09de);dials[_0x3235('0x40')](_0x4a09de);}catch(_0x2006fe){utils['error'](util[_0x3235('0x18')]('[%s][index][dialend]',_0x4a09de[_0x3235('0x1d')]),_0x2006fe);}});} \ No newline at end of file +var _0x042c=['[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','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','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','asterisk','port','username','password','keepConnected','xdr','disabled','info','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x042c,0x171));var _0xc042=function(_0x1c3d6e,_0x2e1f8a){_0x1c3d6e=_0x1c3d6e-0x0;var _0x1bbfdd=_0x042c[_0x1c3d6e];return _0x1bbfdd;};var AsteriskManager=require(_0xc042('0x0'));var config=require(_0xc042('0x1'));var utils=require('./utils');var util=require(_0xc042('0x2'));var ami=new AsteriskManager(config[_0xc042('0x3')][_0xc042('0x4')],config[_0xc042('0x3')]['ip'],config[_0xc042('0x3')][_0xc042('0x5')],config['asterisk'][_0xc042('0x6')],!![]);ami[_0xc042('0x7')]();if(config[_0xc042('0x8')]&&config[_0xc042('0x8')][_0xc042('0x9')]){utils[_0xc042('0xa')]('XDR\x20DISABLED');}else{var agents=require('./agents.controller');var calls=require(_0xc042('0xb'));var queues=require(_0xc042('0xc'));var recordings=require(_0xc042('0xd'));var members=require(_0xc042('0xe'));var dials=require('./dials.controller');var transfers=require(_0xc042('0xf'));var core=require(_0xc042('0x10'));ami['on'](_0xc042('0x11'),core[_0xc042('0x11')]);ami['on']('shutdown',core[_0xc042('0x12')]);ami['on'](_0xc042('0x13'),core['fullybooted']);ami['on'](_0xc042('0x14'),core[_0xc042('0x14')]);ami['on'](_0xc042('0x15'),core['close']);ami['on'](_0xc042('0x16'),core[_0xc042('0x16')]);ami['on'](_0xc042('0x17'),function(_0x42426a){try{utils[_0xc042('0x18')](util[_0xc042('0x19')]('[%s][index][devicestatechange]',_0x42426a['device']),_0x42426a);members[_0xc042('0x17')](_0x42426a);}catch(_0x4ae23a){utils[_0xc042('0x14')](util[_0xc042('0x19')]('[%s][index][devicestatechange]',_0x42426a[_0xc042('0x1a')]),_0x4ae23a);}});ami['on'](_0xc042('0x1b'),function(_0x61f7a3){try{utils[_0xc042('0x18')](util[_0xc042('0x19')](_0xc042('0x1c'),_0x61f7a3[_0xc042('0x1d')]),_0x61f7a3);agents[_0xc042('0x1b')](_0x61f7a3);}catch(_0x4c6257){utils[_0xc042('0x14')](util['format']('[%s][index][agentcalled]',_0x61f7a3[_0xc042('0x1d')]),_0x4c6257);}});ami['on'](_0xc042('0x1e'),function(_0x411f99){try{utils[_0xc042('0x18')](util[_0xc042('0x19')](_0xc042('0x1f'),_0x411f99[_0xc042('0x1d')]),_0x411f99);agents[_0xc042('0x1e')](_0x411f99);}catch(_0x54719e){utils['error'](util[_0xc042('0x19')]('[%s][index][agentringnoanswer]',_0x411f99[_0xc042('0x1d')]),_0x54719e);}});ami['on'](_0xc042('0x20'),function(_0x3f0537){try{utils[_0xc042('0x18')](util[_0xc042('0x19')](_0xc042('0x21'),_0x3f0537['uniqueid']),_0x3f0537);agents[_0xc042('0x20')](_0x3f0537);queues[_0xc042('0x20')](_0x3f0537);}catch(_0x36a823){utils[_0xc042('0x14')](util[_0xc042('0x19')](_0xc042('0x21'),_0x3f0537[_0xc042('0x1d')]),_0x36a823);}});ami['on'](_0xc042('0x22'),function(_0x3c79db){try{utils['debug'](util[_0xc042('0x19')](_0xc042('0x23'),_0x3c79db['uniqueid']),_0x3c79db);agents['agentcomplete'](_0x3c79db);queues['agentcomplete'](_0x3c79db);members['agentcomplete'](_0x3c79db);}catch(_0xc5d621){utils[_0xc042('0x14')](util['format'](_0xc042('0x23'),_0x3c79db[_0xc042('0x1d')]),_0xc5d621);}});ami['on'](_0xc042('0x24'),function(_0x343a8a){try{utils[_0xc042('0x18')](util['format']('[%s][index][queuecallerabandon]',_0x343a8a[_0xc042('0x1d')]),_0x343a8a);agents['queuecallerabandon'](_0x343a8a);queues[_0xc042('0x24')](_0x343a8a);}catch(_0x4f7244){utils[_0xc042('0x14')](util['format'](_0xc042('0x25'),_0x343a8a['uniqueid']),_0x4f7244);}});ami['on'](_0xc042('0x26'),function(_0x187206){try{utils[_0xc042('0x18')](util[_0xc042('0x19')](_0xc042('0x27'),_0x187206[_0xc042('0x1d')]),_0x187206);queues[_0xc042('0x26')](_0x187206);recordings['queuecallerjoin'](_0x187206);}catch(_0x37b6e4){utils[_0xc042('0x14')](util[_0xc042('0x19')](_0xc042('0x27'),_0x187206['uniqueid']),_0x37b6e4);}});ami['on'](_0xc042('0x28'),function(_0x524fe7){try{utils[_0xc042('0x18')](util[_0xc042('0x19')]('[%s][index][queuecallerleave]',_0x524fe7['uniqueid']),_0x524fe7);queues[_0xc042('0x28')](_0x524fe7);}catch(_0x150630){utils[_0xc042('0x14')](util['format']('[%s][index][queuecallerleave]',_0x524fe7['uniqueid']),_0x150630);}});ami['on'](_0xc042('0x29'),function(_0x540dc3){try{utils['debug'](util[_0xc042('0x19')](_0xc042('0x2a'),_0x540dc3[_0xc042('0x1d')]),_0x540dc3);queues[_0xc042('0x29')](_0x540dc3);calls[_0xc042('0x29')](_0x540dc3);}catch(_0xd8fa63){utils[_0xc042('0x14')](util[_0xc042('0x19')](_0xc042('0x2a'),_0x540dc3['uniqueid']),_0xd8fa63);}});ami['on'](_0xc042('0x2b'),function(_0x2bbae0){try{utils[_0xc042('0x18')](util[_0xc042('0x19')]('[%s][index][musiconholdstop]',_0x2bbae0[_0xc042('0x1d')]),_0x2bbae0);queues[_0xc042('0x2b')](_0x2bbae0);calls[_0xc042('0x2b')](_0x2bbae0);}catch(_0x267c1c){utils[_0xc042('0x14')](util[_0xc042('0x19')](_0xc042('0x2c'),_0x2bbae0[_0xc042('0x1d')]),_0x267c1c);}});ami['on'](_0xc042('0x2d'),function(_0x5e2efe){try{utils[_0xc042('0x18')](util[_0xc042('0x19')](_0xc042('0x2e'),_0x5e2efe[_0xc042('0x1d')]),_0x5e2efe);calls[_0xc042('0x2d')](_0x5e2efe);recordings[_0xc042('0x2d')](_0x5e2efe);}catch(_0x4d3297){utils[_0xc042('0x14')](util[_0xc042('0x19')]('[%s][index][newstate]',_0x5e2efe[_0xc042('0x1d')]),_0x4d3297);}});ami['on'](_0xc042('0x2f'),function(_0x399a0e){try{utils['debug'](util[_0xc042('0x19')](_0xc042('0x30'),_0x399a0e[_0xc042('0x1d')]),_0x399a0e);calls[_0xc042('0x2f')](_0x399a0e);recordings['hangup'](_0x399a0e);dials[_0xc042('0x2f')](_0x399a0e);agents[_0xc042('0x2f')](_0x399a0e);queues[_0xc042('0x2f')](_0x399a0e);}catch(_0x39f418){utils[_0xc042('0x14')](util[_0xc042('0x19')](_0xc042('0x30'),_0x399a0e[_0xc042('0x1d')]),_0x39f418);}});ami['on'](_0xc042('0x31'),function(_0x80662f){try{utils['debug'](util[_0xc042('0x19')](_0xc042('0x32'),_0x80662f[_0xc042('0x1d')]),_0x80662f);members[_0xc042('0x31')](_0x80662f);}catch(_0x1c337e){utils[_0xc042('0x14')](util[_0xc042('0x19')](_0xc042('0x32'),_0x80662f[_0xc042('0x1d')]),_0x1c337e);}});ami['on'](_0xc042('0x33'),function(_0x5ad302){try{utils[_0xc042('0x18')](util[_0xc042('0x19')](_0xc042('0x34'),_0x5ad302[_0xc042('0x1d')]),_0x5ad302);queues['blindtransfer'](_0x5ad302);agents[_0xc042('0x33')](_0x5ad302);transfers['blindtransfer'](_0x5ad302);}catch(_0x1103cc){utils['error'](util[_0xc042('0x19')](_0xc042('0x34'),_0x5ad302[_0xc042('0x1d')]),_0x1103cc);}});ami['on']('attendedtransfer',function(_0x80509f){try{utils[_0xc042('0x18')](util[_0xc042('0x19')](_0xc042('0x35'),_0x80509f[_0xc042('0x36')]),_0x80509f);queues[_0xc042('0x37')](_0x80509f);transfers[_0xc042('0x37')](_0x80509f);agents['attendedtransfer'](_0x80509f);calls['attendedtransfer'](_0x80509f);}catch(_0x3bd918){utils[_0xc042('0x14')](util[_0xc042('0x19')]('[%s][index][attendedtransfer]',_0x80509f['origtransfereruniqueid']),_0x3bd918);}});ami['on'](_0xc042('0x38'),function(_0xeb0e65){try{utils['debug'](util[_0xc042('0x19')](_0xc042('0x39'),_0xeb0e65[_0xc042('0x1d')]),_0xeb0e65);queues[_0xc042('0x38')](_0xeb0e65);recordings['varset'](_0xeb0e65);calls[_0xc042('0x38')](_0xeb0e65);dials['varset'](_0xeb0e65);}catch(_0x429103){utils[_0xc042('0x14')](util[_0xc042('0x19')](_0xc042('0x39'),_0xeb0e65[_0xc042('0x1d')]),_0x429103);}});ami['on']('newexten',function(_0x10751b){try{utils[_0xc042('0x18')](util[_0xc042('0x19')]('[%s][index][newexten]',_0x10751b[_0xc042('0x1d')]),_0x10751b);calls[_0xc042('0x3a')](_0x10751b);recordings[_0xc042('0x3a')](_0x10751b);dials[_0xc042('0x3a')](_0x10751b);}catch(_0x3b9d4b){utils[_0xc042('0x14')](util['format'](_0xc042('0x3b'),_0x10751b[_0xc042('0x1d')]),_0x3b9d4b);}});ami['on'](_0xc042('0x3c'),function(_0x5c9e56){try{utils[_0xc042('0x18')](util[_0xc042('0x19')](_0xc042('0x3d'),_0x5c9e56[_0xc042('0x1d')]),_0x5c9e56);calls[_0xc042('0x3c')](_0x5c9e56);recordings['newchannel'](_0x5c9e56);}catch(_0x5db3e3){utils[_0xc042('0x14')](util[_0xc042('0x19')](_0xc042('0x3d'),_0x5c9e56['uniqueid']),_0x5db3e3);}});ami['on'](_0xc042('0x3e'),function(_0x57b74d){try{utils[_0xc042('0x18')](util['format'](_0xc042('0x3f'),_0x57b74d[_0xc042('0x1d')]),_0x57b74d);dials[_0xc042('0x3e')](_0x57b74d);}catch(_0xf3e2c2){utils[_0xc042('0x14')](util[_0xc042('0x19')](_0xc042('0x40'),_0x57b74d[_0xc042('0x1d')]),_0xf3e2c2);}});ami['on'](_0xc042('0x41'),function(_0x40b269){try{utils[_0xc042('0x18')](util[_0xc042('0x19')](_0xc042('0x42'),_0x40b269[_0xc042('0x1d')]),_0x40b269);dials['dialend'](_0x40b269);}catch(_0x2b00d5){utils['error'](util[_0xc042('0x19')]('[%s][index][dialend]',_0x40b269[_0xc042('0x1d')]),_0x2b00d5);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 4679846..720b3f7 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 _0x7883=['then','name','internal','request','getUserByName','CreateMemberReport','catch','error','startsWith','devicestatechange','debug','device','info','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','diffTime','enterAt','[%s][members][devicestatechange]','[%s][members][agentcomplete]','assign','queue','cdr','split','data1','source','data3','destination','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','[%s][members][cdr]','lodash','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type'];(function(_0x227ac6,_0x15c03e){var _0x2660e0=function(_0x200e9e){while(--_0x200e9e){_0x227ac6['push'](_0x227ac6['shift']());}};_0x2660e0(++_0x15c03e);}(_0x7883,0x1b6));var _0x3788=function(_0x35d2c6,_0x4297fd){_0x35d2c6=_0x35d2c6-0x0;var _0x5bd656=_0x7883[_0x35d2c6];return _0x5bd656;};'use strict';var _=require(_0x3788('0x0'));var util=require('util');var utils=require(_0x3788('0x1'));var members={};var exclude=[_0x3788('0x2'),_0x3788('0x3')];function writeDB(_0x3f24e2){utils['info'](util[_0x3788('0x4')](_0x3788('0x5'),_0x3f24e2[_0x3788('0x6')],_0x3f24e2[_0x3788('0x7')],_0x3f24e2[_0x3788('0x8')],_0x3f24e2[_0x3788('0x9')],_0x3f24e2[_0x3788('0xa')],_0x3f24e2[_0x3788('0xb')]));if(_0x3f24e2[_0x3788('0x7')]){utils['getUserByInterface'](_0x3f24e2[_0x3788('0x7')])[_0x3788('0xc')](function(_0xa7ad0c){if(_0xa7ad0c){_0x3f24e2[_0x3788('0xa')]=_0xa7ad0c[_0x3788('0xd')];_0x3f24e2['internal']=_0xa7ad0c[_0x3788('0xe')];utils[_0x3788('0xf')]('CreateMemberReport',_0x3f24e2);}else{utils[_0x3788('0x10')](_0x3f24e2[_0x3788('0x7')]['split']('/')[0x1])[_0x3788('0xc')](function(_0x12fe2a){if(_0x12fe2a){_0x3f24e2[_0x3788('0xa')]=_0x12fe2a['name'];_0x3f24e2[_0x3788('0xe')]=_0x12fe2a[_0x3788('0xe')];utils[_0x3788('0xf')](_0x3788('0x11'),_0x3f24e2);}});}})[_0x3788('0x12')](function(_0x5adfe6){utils[_0x3788('0x13')](util[_0x3788('0x4')]('[%s][members][writeDB]',_0x3f24e2['uniqueid']),_0x5adfe6);});}delete members[_0x3f24e2[_0x3788('0x7')]];}function startsWith(_0x27101d,_0x24f326){return _['some'](_0x27101d,function(_0x4b124d){return _[_0x3788('0x14')](_0x24f326,_0x4b124d);});}exports[_0x3788('0x15')]=function(_0x370bc8){try{utils[_0x3788('0x16')](util['format']('[%s][members][devicestatechange]',members[_0x370bc8[_0x3788('0x17')]]?members[_0x370bc8['device']]['uniqueid']:_0x370bc8[_0x3788('0x17')]),_0x370bc8);utils[_0x3788('0x18')](util[_0x3788('0x4')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x370bc8[_0x3788('0x17')]]?members[_0x370bc8[_0x3788('0x17')]][_0x3788('0x6')]:_0x370bc8[_0x3788('0x17')],_0x370bc8[_0x3788('0x19')],_0x370bc8['device']));switch(_0x370bc8[_0x3788('0x19')]){case _0x3788('0x1a'):case _0x3788('0x1b'):if(!startsWith(exclude,_0x370bc8[_0x3788('0x17')])){members[_0x370bc8[_0x3788('0x17')]]={'channel':_0x3788('0x1c'),'interface':_0x370bc8[_0x3788('0x17')],'type':_0x3788('0x1d'),'enterAt':utils[_0x3788('0x1e')](),'role':_0x3788('0x1f')};}break;case _0x3788('0x20'):if(!_[_0x3788('0x21')](members[_0x370bc8[_0x3788('0x17')]])){members[_0x370bc8[_0x3788('0x17')]][_0x3788('0x22')]=utils[_0x3788('0x1e')]();members[_0x370bc8[_0x3788('0x17')]]['duration']=utils[_0x3788('0x23')](members[_0x370bc8[_0x3788('0x17')]][_0x3788('0x22')],members[_0x370bc8[_0x3788('0x17')]][_0x3788('0x24')]);if(members[_0x370bc8[_0x3788('0x17')]][_0x3788('0x6')]){writeDB(members[_0x370bc8['device']]);}}break;default:break;}}catch(_0x4bb6f6){utils[_0x3788('0x13')](util[_0x3788('0x4')](_0x3788('0x25'),members[_0x370bc8[_0x3788('0x17')]]?members[_0x370bc8[_0x3788('0x17')]][_0x3788('0x6')]:_0x370bc8[_0x3788('0x17')]),_0x4bb6f6);}};exports['agentcomplete']=function(_0x1db29e){try{if(!_[_0x3788('0x21')](members[_0x1db29e[_0x3788('0x7')]])){utils[_0x3788('0x16')](util['format'](_0x3788('0x26'),_0x1db29e[_0x3788('0x6')]),_0x1db29e);utils[_0x3788('0x18')](util[_0x3788('0x4')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x1db29e[_0x3788('0x6')],_0x1db29e['interface'],_0x1db29e['queue']));members[_0x1db29e[_0x3788('0x7')]]=_[_0x3788('0x27')](members[_0x1db29e[_0x3788('0x7')]],{'data4':_0x1db29e[_0x3788('0x28')],'uniqueid':_0x1db29e[_0x3788('0x6')]});}}catch(_0x9fa059){utils[_0x3788('0x13')](util[_0x3788('0x4')]('[%s][members][agentcomplete]',_0x1db29e[_0x3788('0x6')]),_0x9fa059);}};exports[_0x3788('0x29')]=function(_0x11eed0){try{utils['debug'](util[_0x3788('0x4')]('[%s][members][cdr]',_0x11eed0['uniqueid']),_0x11eed0);if(_0x11eed0[_0x3788('0x8')]){var _0x17f1bf=_0x11eed0[_0x3788('0x8')][_0x3788('0x2a')]('-')[0x0];if(!_[_0x3788('0x21')](members[_0x17f1bf])){members[_0x17f1bf]=_['assign'](members[_0x17f1bf],{'data1':members[_0x17f1bf][_0x3788('0x2b')]||_0x11eed0['type'],'data2':members[_0x17f1bf][_0x3788('0x9')]||_0x11eed0[_0x3788('0x2c')],'data3':members[_0x17f1bf][_0x3788('0x2d')]||_0x11eed0[_0x3788('0x2e')],'uniqueid':members[_0x17f1bf][_0x3788('0x6')]||_0x11eed0[_0x3788('0x6')]});utils[_0x3788('0x18')](util[_0x3788('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x11eed0[_0x3788('0x6')],members[_0x17f1bf][_0x3788('0x2b')],members[_0x17f1bf][_0x3788('0x9')],members[_0x17f1bf][_0x3788('0x2d')]));if(members[_0x17f1bf][_0x3788('0x22')]){writeDB(members[_0x17f1bf]);}}}if(_0x11eed0[_0x3788('0x2f')]){var _0x565d03=_0x11eed0[_0x3788('0x2f')][_0x3788('0x2a')]('-')[0x0];if(!_[_0x3788('0x21')](members[_0x565d03])){members[_0x565d03]=_[_0x3788('0x27')](members[_0x565d03],{'data1':members[_0x565d03]['data1']||_0x11eed0[_0x3788('0xb')],'data2':members[_0x565d03][_0x3788('0x9')]||_0x11eed0['source'],'data3':members[_0x565d03][_0x3788('0x2d')]||_0x11eed0[_0x3788('0x2e')],'uniqueid':members[_0x565d03][_0x3788('0x6')]||_0x11eed0['uniqueid']});utils[_0x3788('0x18')](util['format'](_0x3788('0x30'),_0x11eed0[_0x3788('0x6')],members[_0x565d03]['data1'],members[_0x565d03][_0x3788('0x9')],members[_0x565d03][_0x3788('0x2d')]));if(members[_0x565d03]['exitAt']){writeDB(members[_0x565d03]);}}}}catch(_0x2fc59a){utils[_0x3788('0x13')](util[_0x3788('0x4')](_0x3788('0x31'),_0x11eed0[_0x3788('0x6')]),_0x2fc59a);}}; \ No newline at end of file +var _0x30e7=['duration','diffTime','enterAt','agentcomplete','isNil','debug','[%s][members][agentcomplete]','info','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','error','data1','source','data3','destination','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','Local/_attended@transfer','Queue:','uniqueid','channel','data2','membername','type','interface','getUserByInterface','internal','request','getUserByName','split','then','name','CreateMemberReport','format','[%s][members][writeDB]','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','TALKING','now','agent','exitAt'];(function(_0x443494,_0x51fc7e){var _0x4a6794=function(_0x15197a){while(--_0x15197a){_0x443494['push'](_0x443494['shift']());}};_0x4a6794(++_0x51fc7e);}(_0x30e7,0x144));var _0x730e=function(_0x2d4bc6,_0x538331){_0x2d4bc6=_0x2d4bc6-0x0;var _0x125e54=_0x30e7[_0x2d4bc6];return _0x125e54;};'use strict';var _=require(_0x730e('0x0'));var util=require(_0x730e('0x1'));var utils=require('./utils');var members={};var exclude=[_0x730e('0x2'),_0x730e('0x3')];function writeDB(_0x5839ff){utils['info'](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x5839ff[_0x730e('0x4')],_0x5839ff['interface'],_0x5839ff[_0x730e('0x5')],_0x5839ff[_0x730e('0x6')],_0x5839ff[_0x730e('0x7')],_0x5839ff[_0x730e('0x8')]));if(_0x5839ff[_0x730e('0x9')]){utils[_0x730e('0xa')](_0x5839ff[_0x730e('0x9')])['then'](function(_0x2d2bf7){if(_0x2d2bf7){_0x5839ff[_0x730e('0x7')]=_0x2d2bf7['name'];_0x5839ff[_0x730e('0xb')]=_0x2d2bf7[_0x730e('0xb')];utils[_0x730e('0xc')]('CreateMemberReport',_0x5839ff);}else{utils[_0x730e('0xd')](_0x5839ff['interface'][_0x730e('0xe')]('/')[0x1])[_0x730e('0xf')](function(_0x5827b3){if(_0x5827b3){_0x5839ff['membername']=_0x5827b3[_0x730e('0x10')];_0x5839ff[_0x730e('0xb')]=_0x5827b3['internal'];utils[_0x730e('0xc')](_0x730e('0x11'),_0x5839ff);}});}})['catch'](function(_0x39ee0f){utils['error'](util[_0x730e('0x12')](_0x730e('0x13'),_0x5839ff[_0x730e('0x4')]),_0x39ee0f);});}delete members[_0x5839ff[_0x730e('0x9')]];}function startsWith(_0x32fecd,_0x1fad17){return _[_0x730e('0x14')](_0x32fecd,function(_0x4165f1){return _[_0x730e('0x15')](_0x1fad17,_0x4165f1);});}exports[_0x730e('0x16')]=function(_0x4172a2){try{utils['debug'](util[_0x730e('0x12')](_0x730e('0x17'),members[_0x4172a2[_0x730e('0x18')]]?members[_0x4172a2['device']][_0x730e('0x4')]:_0x4172a2[_0x730e('0x18')]),_0x4172a2);utils['info'](util[_0x730e('0x12')](_0x730e('0x19'),members[_0x4172a2[_0x730e('0x18')]]?members[_0x4172a2[_0x730e('0x18')]][_0x730e('0x4')]:_0x4172a2[_0x730e('0x18')],_0x4172a2['state'],_0x4172a2[_0x730e('0x18')]));switch(_0x4172a2[_0x730e('0x1a')]){case _0x730e('0x1b'):case'BUSY':if(!startsWith(exclude,_0x4172a2[_0x730e('0x18')])){members[_0x4172a2['device']]={'channel':_0x730e('0x1c'),'interface':_0x4172a2[_0x730e('0x18')],'type':_0x730e('0x1d'),'enterAt':utils[_0x730e('0x1e')](),'role':_0x730e('0x1f')};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x4172a2[_0x730e('0x18')]])){members[_0x4172a2['device']][_0x730e('0x20')]=utils[_0x730e('0x1e')]();members[_0x4172a2[_0x730e('0x18')]][_0x730e('0x21')]=utils[_0x730e('0x22')](members[_0x4172a2['device']][_0x730e('0x20')],members[_0x4172a2[_0x730e('0x18')]][_0x730e('0x23')]);if(members[_0x4172a2['device']][_0x730e('0x4')]){writeDB(members[_0x4172a2[_0x730e('0x18')]]);}}break;default:break;}}catch(_0x36b2b8){utils['error'](util[_0x730e('0x12')]('[%s][members][devicestatechange]',members[_0x4172a2[_0x730e('0x18')]]?members[_0x4172a2[_0x730e('0x18')]]['uniqueid']:_0x4172a2['device']),_0x36b2b8);}};exports[_0x730e('0x24')]=function(_0x9db1bc){try{if(!_[_0x730e('0x25')](members[_0x9db1bc['interface']])){utils[_0x730e('0x26')](util[_0x730e('0x12')](_0x730e('0x27'),_0x9db1bc[_0x730e('0x4')]),_0x9db1bc);utils[_0x730e('0x28')](util['format'](_0x730e('0x29'),_0x9db1bc['uniqueid'],_0x9db1bc[_0x730e('0x9')],_0x9db1bc[_0x730e('0x2a')]));members[_0x9db1bc[_0x730e('0x9')]]=_[_0x730e('0x2b')](members[_0x9db1bc['interface']],{'data4':_0x9db1bc[_0x730e('0x2a')],'uniqueid':_0x9db1bc['uniqueid']});}}catch(_0x386bdc){utils[_0x730e('0x2c')](util[_0x730e('0x12')](_0x730e('0x27'),_0x9db1bc[_0x730e('0x4')]),_0x386bdc);}};exports['cdr']=function(_0x460839){try{utils[_0x730e('0x26')](util[_0x730e('0x12')]('[%s][members][cdr]',_0x460839[_0x730e('0x4')]),_0x460839);if(_0x460839[_0x730e('0x5')]){var _0x1f59d6=_0x460839[_0x730e('0x5')]['split']('-')[0x0];if(!_['isNil'](members[_0x1f59d6])){members[_0x1f59d6]=_[_0x730e('0x2b')](members[_0x1f59d6],{'data1':members[_0x1f59d6][_0x730e('0x2d')]||_0x460839[_0x730e('0x8')],'data2':members[_0x1f59d6][_0x730e('0x6')]||_0x460839[_0x730e('0x2e')],'data3':members[_0x1f59d6][_0x730e('0x2f')]||_0x460839[_0x730e('0x30')],'uniqueid':members[_0x1f59d6][_0x730e('0x4')]||_0x460839[_0x730e('0x4')]});utils[_0x730e('0x28')](util[_0x730e('0x12')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x460839['uniqueid'],members[_0x1f59d6]['data1'],members[_0x1f59d6][_0x730e('0x6')],members[_0x1f59d6][_0x730e('0x2f')]));if(members[_0x1f59d6][_0x730e('0x20')]){writeDB(members[_0x1f59d6]);}}}if(_0x460839['destinationchannel']){var _0x31f7f9=_0x460839[_0x730e('0x31')][_0x730e('0xe')]('-')[0x0];if(!_['isNil'](members[_0x31f7f9])){members[_0x31f7f9]=_[_0x730e('0x2b')](members[_0x31f7f9],{'data1':members[_0x31f7f9][_0x730e('0x2d')]||_0x460839[_0x730e('0x8')],'data2':members[_0x31f7f9][_0x730e('0x6')]||_0x460839[_0x730e('0x2e')],'data3':members[_0x31f7f9][_0x730e('0x2f')]||_0x460839[_0x730e('0x30')],'uniqueid':members[_0x31f7f9][_0x730e('0x4')]||_0x460839[_0x730e('0x4')]});utils['info'](util[_0x730e('0x12')](_0x730e('0x32'),_0x460839['uniqueid'],members[_0x31f7f9]['data1'],members[_0x31f7f9][_0x730e('0x6')],members[_0x31f7f9][_0x730e('0x2f')]));if(members[_0x31f7f9][_0x730e('0x20')]){writeDB(members[_0x31f7f9]);}}}}catch(_0x23b0e5){utils['error'](util['format']('[%s][members][cdr]',_0x460839[_0x730e('0x4')]),_0x23b0e5);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index e2f131f..2c2b2cf 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 _0xee9d=['[%s][queues][agentcomplete]','queuecallercomplete','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','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]','lodash','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','membername','agentcomplete'];(function(_0x15cdcb,_0x4340e9){var _0x37b069=function(_0x304cfb){while(--_0x304cfb){_0x15cdcb['push'](_0x15cdcb['shift']());}};_0x37b069(++_0x4340e9);}(_0xee9d,0x90));var _0xdee9=function(_0x44549b,_0x4a1ac0){_0x44549b=_0x44549b-0x0;var _0x3060ff=_0xee9d[_0x44549b];return _0x3060ff;};'use strict';var _=require(_0xdee9('0x0'));var util=require('util');var utils=require(_0xdee9('0x1'));var queues={};function writeDB(_0x79ebb4){utils[_0xdee9('0x2')](util[_0xdee9('0x3')](_0xdee9('0x4'),_0x79ebb4['uniqueid'],_0x79ebb4['channel'],_0x79ebb4[_0xdee9('0x5')],_0x79ebb4[_0xdee9('0x6')],_0x79ebb4[_0xdee9('0x7')],_0x79ebb4['accountcode'],_0x79ebb4[_0xdee9('0x8')]));if(_0x79ebb4['queue']){utils[_0xdee9('0x9')](_0x79ebb4[_0xdee9('0x5')])[_0xdee9('0xa')](function(_0x495a05){if(_0x495a05){_0x79ebb4[_0xdee9('0xb')]=_0x495a05[_0xdee9('0xb')];}utils['request'](_0xdee9('0xc'),_0x79ebb4);});}else{utils[_0xdee9('0xd')](_0xdee9('0xc'),_0x79ebb4);}if(_0x79ebb4['transfereduniqueid']){delete queues[_0x79ebb4[_0xdee9('0xe')]];}else{delete queues[_0x79ebb4[_0xdee9('0xf')]];}}exports[_0xdee9('0x10')]=function(_0x439b17){try{utils[_0xdee9('0x11')](util['format']('[%s][queues][queuecallerjoin]',_0x439b17[_0xdee9('0xf')]),_0x439b17);utils[_0xdee9('0x2')](util[_0xdee9('0x3')](_0xdee9('0x12'),_0x439b17[_0xdee9('0xf')],_0x439b17['queue'],_0x439b17[_0xdee9('0x13')]));queues[_0x439b17[_0xdee9('0xf')]]=_['assign'](_0x439b17,{'originalposition':_0x439b17[_0xdee9('0x13')],'queuecallerjoinAt':utils[_0xdee9('0x14')](),'mohtime':0x0});}catch(_0x4a01b0){utils[_0xdee9('0x15')](util['format']('[%s][queues][queuecallerjoin]',_0x439b17[_0xdee9('0xf')]),_0x4a01b0);}};exports[_0xdee9('0x16')]=function(_0x3a2cea){try{if(!_[_0xdee9('0x17')](queues[_0x3a2cea[_0xdee9('0xf')]])){utils['debug'](util[_0xdee9('0x3')](_0xdee9('0x18'),_0x3a2cea[_0xdee9('0xf')]),_0x3a2cea);if(queues[_0x3a2cea[_0xdee9('0xf')]][_0xdee9('0x19')]){if(!queues[_0x3a2cea[_0xdee9('0xf')]][_0xdee9('0x1a')]&&!queues[_0x3a2cea['uniqueid']][_0xdee9('0x1b')]){queues[_0x3a2cea['uniqueid']]['queuecallercomplete']=!![];queues[_0x3a2cea[_0xdee9('0xf')]]['queuecallercompleteAt']=utils[_0xdee9('0x14')]();queues[_0x3a2cea['uniqueid']][_0xdee9('0x8')]='COMPLETEDBYAGENT';}utils['info'](util['format'](_0xdee9('0x1c'),_0x3a2cea[_0xdee9('0xf')],queues[_0x3a2cea['uniqueid']][_0xdee9('0x1d')],queues[_0x3a2cea[_0xdee9('0xf')]][_0xdee9('0x8')]));writeDB(queues[_0x3a2cea[_0xdee9('0xf')]]);}else if(queues[_0x3a2cea['uniqueid']][_0xdee9('0xe')]){utils[_0xdee9('0x2')](util['format']('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x3a2cea[_0xdee9('0xf')],queues[_0x3a2cea[_0xdee9('0xf')]][_0xdee9('0x1d')],queues[_0x3a2cea[_0xdee9('0xf')]][_0xdee9('0xe')]));queues[queues[_0x3a2cea[_0xdee9('0xf')]][_0xdee9('0xe')]]=queues[_0x3a2cea[_0xdee9('0xf')]];queues[queues[_0x3a2cea[_0xdee9('0xf')]][_0xdee9('0xe')]][_0xdee9('0x1e')]=0x2;delete queues[_0x3a2cea[_0xdee9('0xf')]];}}}catch(_0x58b014){utils[_0xdee9('0x15')](util[_0xdee9('0x3')](_0xdee9('0x18'),_0x3a2cea['uniqueid']),_0x58b014);}};exports[_0xdee9('0x1f')]=function(_0x56a1a7){try{utils[_0xdee9('0x11')](util[_0xdee9('0x3')](_0xdee9('0x20'),_0x56a1a7['uniqueid']),_0x56a1a7);if(!_[_0xdee9('0x17')](_0x56a1a7[_0xdee9('0x21')]['queuestatus'])&&_0x56a1a7[_0xdee9('0x22')][_0xdee9('0x23')]()!==_0xdee9('0x24')){if(!_[_0xdee9('0x17')](queues[_0x56a1a7[_0xdee9('0xf')]])){queues[_0x56a1a7['uniqueid']]['queuecallerabandon']=![];queues[_0x56a1a7[_0xdee9('0xf')]][_0xdee9('0x25')]=null;queues[_0x56a1a7[_0xdee9('0xf')]][_0xdee9('0x1b')]=!![];queues[_0x56a1a7[_0xdee9('0xf')]][_0xdee9('0x26')]=utils['now']();queues[_0x56a1a7['uniqueid']][_0xdee9('0x8')]=_0x56a1a7[_0xdee9('0x22')][_0xdee9('0x23')]();utils['info'](util['format'](_0xdee9('0x27'),_0x56a1a7[_0xdee9('0xf')],queues[_0x56a1a7['uniqueid']][_0xdee9('0x1d')],_0x56a1a7['value'],queues[_0x56a1a7['uniqueid']][_0xdee9('0x8')]));writeDB(queues[_0x56a1a7[_0xdee9('0xf')]]);}}else if(!_[_0xdee9('0x17')](_0x56a1a7['variable'][_0xdee9('0x28')])){if(!_[_0xdee9('0x17')](queues[_0x56a1a7[_0xdee9('0xf')]])&&!queues[_0x56a1a7[_0xdee9('0xf')]][_0xdee9('0x1a')]){queues[_0x56a1a7[_0xdee9('0xf')]]['queuecallerabandon']=![];queues[_0x56a1a7['uniqueid']][_0xdee9('0x25')]=null;queues[_0x56a1a7[_0xdee9('0xf')]]['queuecallerexit']=!![];queues[_0x56a1a7[_0xdee9('0xf')]][_0xdee9('0x26')]=utils['now']();queues[_0x56a1a7[_0xdee9('0xf')]][_0xdee9('0x8')]='EXITWITHKEY';utils[_0xdee9('0x2')](util[_0xdee9('0x3')](_0xdee9('0x29'),_0x56a1a7[_0xdee9('0xf')],queues[_0x56a1a7[_0xdee9('0xf')]][_0xdee9('0x1d')],_0x56a1a7[_0xdee9('0x22')],queues[_0x56a1a7[_0xdee9('0xf')]][_0xdee9('0x8')]));}}}catch(_0x20840f){utils['error'](util['format'](_0xdee9('0x20'),_0x56a1a7[_0xdee9('0xf')]),_0x20840f);}};exports[_0xdee9('0x1a')]=function(_0x187a6d){try{if(!_[_0xdee9('0x17')](queues[_0x187a6d[_0xdee9('0xf')]])){utils[_0xdee9('0x11')](util['format']('[%s][queues][queuecallerabandon]',_0x187a6d[_0xdee9('0xf')]),_0x187a6d);queues[_0x187a6d[_0xdee9('0xf')]][_0xdee9('0x1b')]=![];queues[_0x187a6d[_0xdee9('0xf')]][_0xdee9('0x26')]=null;queues[_0x187a6d[_0xdee9('0xf')]][_0xdee9('0x1a')]=!![];queues[_0x187a6d[_0xdee9('0xf')]][_0xdee9('0x25')]=utils[_0xdee9('0x14')]();queues[_0x187a6d['uniqueid']][_0xdee9('0x8')]='ABANDONED';utils[_0xdee9('0x2')](util[_0xdee9('0x3')](_0xdee9('0x2a'),_0x187a6d[_0xdee9('0xf')],queues[_0x187a6d[_0xdee9('0xf')]][_0xdee9('0x1d')],queues[_0x187a6d[_0xdee9('0xf')]]['queuecallerexitreason']));}}catch(_0x2f9b71){utils[_0xdee9('0x15')](util[_0xdee9('0x3')](_0xdee9('0x2b'),_0x187a6d[_0xdee9('0xf')]),_0x2f9b71);}};exports['queuecallerleave']=function(_0x52ff87){try{if(!_[_0xdee9('0x17')](queues[_0x52ff87[_0xdee9('0xf')]])){utils[_0xdee9('0x11')](util[_0xdee9('0x3')](_0xdee9('0x2c'),_0x52ff87[_0xdee9('0xf')]),_0x52ff87);utils[_0xdee9('0x2')](util[_0xdee9('0x3')](_0xdee9('0x2d'),_0x52ff87['uniqueid'],queues[_0x52ff87[_0xdee9('0xf')]][_0xdee9('0x1d')],_0x52ff87[_0xdee9('0x2e')],_0x52ff87[_0xdee9('0x2f')]));queues[_0x52ff87[_0xdee9('0xf')]]['queuecallerleave']=!![];queues[_0x52ff87[_0xdee9('0xf')]][_0xdee9('0x19')]=utils[_0xdee9('0x14')]();queues[_0x52ff87['uniqueid']][_0xdee9('0x30')]=utils[_0xdee9('0x31')](queues[_0x52ff87[_0xdee9('0xf')]][_0xdee9('0x19')],queues[_0x52ff87[_0xdee9('0xf')]][_0xdee9('0x32')]);queues[_0x52ff87['uniqueid']]['position']=_0x52ff87[_0xdee9('0x13')];queues[_0x52ff87[_0xdee9('0xf')]][_0xdee9('0x33')]=_0x52ff87[_0xdee9('0x33')];queues[_0x52ff87[_0xdee9('0xf')]][_0xdee9('0x2e')]=_0x52ff87[_0xdee9('0x2e')];queues[_0x52ff87[_0xdee9('0xf')]][_0xdee9('0x2f')]=_0x52ff87[_0xdee9('0x2f')];}}catch(_0x28fa87){utils[_0xdee9('0x15')](util[_0xdee9('0x3')](_0xdee9('0x2c'),_0x52ff87[_0xdee9('0xf')]),_0x28fa87);}};exports['agentconnect']=function(_0x28faaf){try{if(!_[_0xdee9('0x17')](queues[_0x28faaf[_0xdee9('0xf')]])){utils[_0xdee9('0x11')](util[_0xdee9('0x3')](_0xdee9('0x34'),_0x28faaf[_0xdee9('0xf')]),_0x28faaf);utils[_0xdee9('0x2')](util[_0xdee9('0x3')](_0xdee9('0x35'),_0x28faaf[_0xdee9('0xf')],queues[_0x28faaf[_0xdee9('0xf')]][_0xdee9('0x1d')],_0x28faaf['membername'],_0x28faaf[_0xdee9('0x36')]));queues[_0x28faaf[_0xdee9('0xf')]][_0xdee9('0x1a')]=![];queues[_0x28faaf[_0xdee9('0xf')]][_0xdee9('0x1a')]=![];queues[_0x28faaf[_0xdee9('0xf')]][_0xdee9('0x25')]=null;queues[_0x28faaf['uniqueid']][_0xdee9('0x1b')]=![];queues[_0x28faaf[_0xdee9('0xf')]][_0xdee9('0x8')]=null;queues[_0x28faaf[_0xdee9('0xf')]]['queuecallerexitAt']=null;queues[_0x28faaf[_0xdee9('0xf')]][_0xdee9('0x37')]=!![];queues[_0x28faaf['uniqueid']]['accountcode']=_0x28faaf['destaccountcode'];queues[_0x28faaf[_0xdee9('0xf')]][_0xdee9('0x6')]=_0x28faaf[_0xdee9('0x38')];}}catch(_0x4383e3){utils[_0xdee9('0x15')](util[_0xdee9('0x3')](_0xdee9('0x34'),_0x28faaf[_0xdee9('0xf')]),_0x4383e3);}};exports[_0xdee9('0x39')]=function(_0xa4db86){try{if(!_['isNil'](queues[_0xa4db86[_0xdee9('0xf')]])){if(queues[_0xa4db86[_0xdee9('0xf')]]['queuecallerleaveAt']){utils[_0xdee9('0x11')](util['format'](_0xdee9('0x3a'),_0xa4db86['uniqueid']),_0xa4db86);queues[_0xa4db86[_0xdee9('0xf')]][_0xdee9('0x1a')]=![];queues[_0xa4db86[_0xdee9('0xf')]]['queuecallerabandon']=![];queues[_0xa4db86[_0xdee9('0xf')]]['queuecallerabandonAt']=null;queues[_0xa4db86['uniqueid']][_0xdee9('0x1b')]=![];queues[_0xa4db86['uniqueid']][_0xdee9('0x26')]=null;queues[_0xa4db86[_0xdee9('0xf')]][_0xdee9('0x37')]=!![];queues[_0xa4db86['uniqueid']][_0xdee9('0x6')]=_0xa4db86[_0xdee9('0x38')];queues[_0xa4db86['uniqueid']][_0xdee9('0x3b')]=!![];queues[_0xa4db86[_0xdee9('0xf')]]['queuecallercompleteAt']=utils[_0xdee9('0x14')]();if(_0xa4db86['reason']==_0xdee9('0x3c')){if(!queues[_0xa4db86[_0xdee9('0xf')]][_0xdee9('0x3c')]){queues[_0xa4db86['uniqueid']]['queuecallerexitreason']=_0xdee9('0x3d');}}else{queues[_0xa4db86[_0xdee9('0xf')]][_0xdee9('0x8')]=_0xdee9('0x3e')+_0xa4db86[_0xdee9('0x3f')][_0xdee9('0x23')]();}utils['info'](util['format'](_0xdee9('0x40'),_0xa4db86[_0xdee9('0xf')],queues[_0xa4db86['uniqueid']][_0xdee9('0x1d')],_0xa4db86[_0xdee9('0x38')],queues[_0xa4db86[_0xdee9('0xf')]][_0xdee9('0x8')]));writeDB(queues[_0xa4db86[_0xdee9('0xf')]]);}}}catch(_0x36d218){utils['error'](util[_0xdee9('0x3')](_0xdee9('0x3a'),_0xa4db86[_0xdee9('0xf')]),_0x36d218);}};exports['blindtransfer']=function(_0x41cce4){try{if(!_[_0xdee9('0x17')](queues[_0x41cce4['transfereeuniqueid']])){utils[_0xdee9('0x11')](util[_0xdee9('0x3')](_0xdee9('0x41'),_0x41cce4[_0xdee9('0xf')]),_0x41cce4);queues[_0x41cce4['transfereeuniqueid']][_0xdee9('0x3c')]=!![];queues[_0x41cce4[_0xdee9('0x42')]][_0xdee9('0x43')]=_0xdee9('0x44');queues[_0x41cce4[_0xdee9('0x42')]]['transferexten']=_0x41cce4[_0xdee9('0x45')];queues[_0x41cce4[_0xdee9('0x42')]][_0xdee9('0x46')]=_0x41cce4[_0xdee9('0x42')];queues[_0x41cce4['transfereeuniqueid']][_0xdee9('0x8')]=_0xdee9('0x47');utils['info'](util[_0xdee9('0x3')](_0xdee9('0x48'),_0x41cce4[_0xdee9('0xf')],queues[_0x41cce4['transfereeuniqueid']][_0xdee9('0x1d')],_0x41cce4[_0xdee9('0x42')],_0x41cce4[_0xdee9('0x45')]));}}catch(_0xaed349){utils[_0xdee9('0x15')](util[_0xdee9('0x3')](_0xdee9('0x41'),_0x41cce4['uniqueid']),_0xaed349);}};exports[_0xdee9('0x49')]=function(_0x1cdcb3){try{utils[_0xdee9('0x11')](util['format'](_0xdee9('0x4a'),_0x1cdcb3[_0xdee9('0x4b')]),_0x1cdcb3);if(_0x1cdcb3['origtransfereruniqueid']==_0x1cdcb3[_0xdee9('0x4c')]){if(!_[_0xdee9('0x17')](queues[_0x1cdcb3[_0xdee9('0x4d')]])){utils[_0xdee9('0x2')](util[_0xdee9('0x3')](_0xdee9('0x4e'),_0x1cdcb3[_0xdee9('0x4b')],queues[_0x1cdcb3[_0xdee9('0x4d')]][_0xdee9('0x1d')],_0x1cdcb3[_0xdee9('0x4f')]));queues[_0x1cdcb3[_0xdee9('0x4d')]][_0xdee9('0x3c')]=!![];queues[_0x1cdcb3[_0xdee9('0x4d')]][_0xdee9('0x43')]=_0xdee9('0x50');queues[_0x1cdcb3[_0xdee9('0x4d')]][_0xdee9('0x51')]=_0x1cdcb3[_0xdee9('0x4f')];queues[_0x1cdcb3[_0xdee9('0x4d')]]['transferuniqueid']=_0x1cdcb3['origtransfereruniqueid'];queues[_0x1cdcb3[_0xdee9('0x4d')]][_0xdee9('0x8')]=_0xdee9('0x52');}if(!_[_0xdee9('0x17')](queues[_0x1cdcb3[_0xdee9('0x4c')]])){if(_0x1cdcb3[_0xdee9('0x53')]&&queues[_0x1cdcb3[_0xdee9('0x53')]]){queues[_0x1cdcb3[_0xdee9('0x53')]]['queuecallerenterreason']=0x1;queues[_0x1cdcb3[_0xdee9('0x42')]]=_[_0xdee9('0x54')](queues[_0x1cdcb3[_0xdee9('0x53')]]);queues[_0x1cdcb3['transfereeuniqueid']][_0xdee9('0xe')]=_0x1cdcb3[_0xdee9('0x55')];queues[_0x1cdcb3[_0xdee9('0x42')]][_0xdee9('0x1e')]=0x2;queues[_0x1cdcb3[_0xdee9('0x42')]][_0xdee9('0x7')]=queues[_0x1cdcb3[_0xdee9('0x4d')]][_0xdee9('0x7')];queues[_0x1cdcb3[_0xdee9('0x42')]][_0xdee9('0x56')]=queues[_0x1cdcb3[_0xdee9('0x4d')]][_0xdee9('0x56')];queues[_0x1cdcb3[_0xdee9('0x42')]][_0xdee9('0x32')]=utils['now']();queues[_0x1cdcb3['transfereeuniqueid']][_0xdee9('0x19')]=utils[_0xdee9('0x14')]();queues[_0x1cdcb3[_0xdee9('0x42')]]['holdtime']=0x0;queues[_0x1cdcb3[_0xdee9('0x42')]][_0xdee9('0x57')]=0x0;utils[_0xdee9('0x2')](util[_0xdee9('0x3')](_0xdee9('0x58'),_0x1cdcb3[_0xdee9('0x4b')],queues[_0x1cdcb3[_0xdee9('0x42')]]['name'],queues[_0x1cdcb3[_0xdee9('0x42')]][_0xdee9('0x7')],queues[_0x1cdcb3[_0xdee9('0x42')]][_0xdee9('0x56')]));}else{utils['info'](util[_0xdee9('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1cdcb3[_0xdee9('0x4b')],queues[_0x1cdcb3[_0xdee9('0x4c')]]['name'],_0x1cdcb3[_0xdee9('0x4d')]));queues[_0x1cdcb3[_0xdee9('0x4c')]][_0xdee9('0xe')]=_0x1cdcb3['secondtransfererlinkedid'];}}}else if(_0x1cdcb3[_0xdee9('0x59')]==_0x1cdcb3[_0xdee9('0x4d')]){if(!_['isNil'](queues[_0x1cdcb3[_0xdee9('0x4c')]])){utils[_0xdee9('0x2')](util[_0xdee9('0x3')](_0xdee9('0x5a'),_0x1cdcb3['origtransfereruniqueid'],queues[_0x1cdcb3[_0xdee9('0x4c')]]['name'],_0x1cdcb3[_0xdee9('0x59')],_0x1cdcb3[_0xdee9('0x5b')]));queues[_0x1cdcb3['origtransfererlinkedid']][_0xdee9('0x3c')]=!![];queues[_0x1cdcb3[_0xdee9('0x4c')]][_0xdee9('0x43')]='ATTENDED';queues[_0x1cdcb3[_0xdee9('0x4c')]][_0xdee9('0x51')]=_0x1cdcb3[_0xdee9('0x5b')];queues[_0x1cdcb3['origtransfererlinkedid']][_0xdee9('0x46')]=_0x1cdcb3[_0xdee9('0x59')];queues[_0x1cdcb3[_0xdee9('0x4c')]][_0xdee9('0x8')]=_0xdee9('0x52');}if(!_['isNil'](queues[_0x1cdcb3['secondtransfererlinkedid']])){if(_0x1cdcb3[_0xdee9('0x5c')]&&queues[_0x1cdcb3['transfertargetlinkedid']]){queues[_0x1cdcb3[_0xdee9('0x5c')]][_0xdee9('0x1e')]=0x1;queues[_0x1cdcb3[_0xdee9('0x55')]]=_['clone'](queues[_0x1cdcb3['transfertargetlinkedid']]);queues[_0x1cdcb3['transfertargetuniqueid']][_0xdee9('0xe')]=_0x1cdcb3[_0xdee9('0x55')];queues[_0x1cdcb3[_0xdee9('0x55')]][_0xdee9('0x1e')]=0x2;queues[_0x1cdcb3[_0xdee9('0x55')]][_0xdee9('0x7')]=queues[_0x1cdcb3['origtransfererlinkedid']]['calleridnum'];queues[_0x1cdcb3[_0xdee9('0x55')]]['calleridname']=queues[_0x1cdcb3[_0xdee9('0x4c')]]['calleridname'];queues[_0x1cdcb3['transfertargetuniqueid']][_0xdee9('0x32')]=utils[_0xdee9('0x14')]();queues[_0x1cdcb3[_0xdee9('0x55')]][_0xdee9('0x19')]=utils[_0xdee9('0x14')]();queues[_0x1cdcb3[_0xdee9('0x55')]]['holdtime']=0x0;queues[_0x1cdcb3[_0xdee9('0x55')]][_0xdee9('0x57')]=0x0;utils[_0xdee9('0x2')](util[_0xdee9('0x3')](_0xdee9('0x5d'),_0x1cdcb3[_0xdee9('0x4b')],queues[_0x1cdcb3['transfertargetuniqueid']][_0xdee9('0x1d')],queues[_0x1cdcb3[_0xdee9('0x55')]][_0xdee9('0xe')],queues[_0x1cdcb3[_0xdee9('0x55')]][_0xdee9('0x7')],queues[_0x1cdcb3[_0xdee9('0x55')]][_0xdee9('0x56')]));}else{utils[_0xdee9('0x2')](util['format'](_0xdee9('0x5e'),_0x1cdcb3[_0xdee9('0x4b')],queues[_0x1cdcb3[_0xdee9('0x4d')]]['name'],_0x1cdcb3[_0xdee9('0x4c')]));queues[_0x1cdcb3['secondtransfererlinkedid']][_0xdee9('0xe')]=_0x1cdcb3[_0xdee9('0x4c')];}}}}catch(_0x41cbe7){utils[_0xdee9('0x15')](util[_0xdee9('0x3')](_0xdee9('0x4a'),_0x1cdcb3['origtransfereruniqueid']),_0x41cbe7);}};exports[_0xdee9('0x5f')]=function(_0x4fcafc){try{if(!_[_0xdee9('0x17')](queues[_0x4fcafc['uniqueid']])){utils[_0xdee9('0x11')](util[_0xdee9('0x3')](_0xdee9('0x60'),_0x4fcafc[_0xdee9('0xf')]),_0x4fcafc);queues[_0x4fcafc[_0xdee9('0xf')]][_0xdee9('0x61')]=utils['now']();utils[_0xdee9('0x2')](util[_0xdee9('0x3')](_0xdee9('0x62'),_0x4fcafc[_0xdee9('0xf')],queues[_0x4fcafc['uniqueid']][_0xdee9('0x1d')],queues[_0x4fcafc[_0xdee9('0xf')]][_0xdee9('0x61')]));}}catch(_0x2cf6c7){utils[_0xdee9('0x15')](util[_0xdee9('0x3')]('[%s][queues][musiconholdstart]',_0x4fcafc[_0xdee9('0xf')]),_0x2cf6c7);}};exports[_0xdee9('0x63')]=function(_0x3d2dc1){try{if(!_[_0xdee9('0x17')](queues[_0x3d2dc1[_0xdee9('0xf')]])){if(!_[_0xdee9('0x17')](queues[_0x3d2dc1[_0xdee9('0xf')]][_0xdee9('0x61')])){utils['debug'](util['format'](_0xdee9('0x64'),_0x3d2dc1[_0xdee9('0xf')]),_0x3d2dc1);queues[_0x3d2dc1[_0xdee9('0xf')]][_0xdee9('0x57')]+=utils[_0xdee9('0x31')](utils[_0xdee9('0x14')](),queues[_0x3d2dc1[_0xdee9('0xf')]][_0xdee9('0x61')]);utils['info'](util[_0xdee9('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x3d2dc1[_0xdee9('0xf')],queues[_0x3d2dc1[_0xdee9('0xf')]][_0xdee9('0x1d')],queues[_0x3d2dc1['uniqueid']]['mohtime']));delete queues[_0x3d2dc1[_0xdee9('0xf')]]['musiconholdstartAt'];}}}catch(_0xf0ab8d){utils[_0xdee9('0x15')](util[_0xdee9('0x3')](_0xdee9('0x64'),_0x3d2dc1[_0xdee9('0xf')]),_0xf0ab8d);}}; \ No newline at end of file +var _0x1655=['[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','then','type','request','transfereduniqueid','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','info','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','isNil','variable','queuestatus','toUpperCase','CONTINUE','queuecallerabandonAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','membername','assigned','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x1655,0x146));var _0x5165=function(_0x3545db,_0x34fc3c){_0x3545db=_0x3545db-0x0;var _0xa9f556=_0x1655[_0x3545db];return _0xa9f556;};'use strict';var _=require(_0x5165('0x0'));var util=require(_0x5165('0x1'));var utils=require(_0x5165('0x2'));var queues={};function writeDB(_0x16f6c5){utils['info'](util[_0x5165('0x3')](_0x5165('0x4'),_0x16f6c5['uniqueid'],_0x16f6c5[_0x5165('0x5')],_0x16f6c5[_0x5165('0x6')],_0x16f6c5[_0x5165('0x7')],_0x16f6c5[_0x5165('0x8')],_0x16f6c5[_0x5165('0x9')],_0x16f6c5[_0x5165('0xa')]));if(_0x16f6c5['queue']){utils['getVoiceQueueByName'](_0x16f6c5['queue'])[_0x5165('0xb')](function(_0x1163b7){if(_0x1163b7){_0x16f6c5[_0x5165('0xc')]=_0x1163b7[_0x5165('0xc')];}utils[_0x5165('0xd')]('CreateVoiceQueueReport',_0x16f6c5);});}else{utils[_0x5165('0xd')]('CreateVoiceQueueReport',_0x16f6c5);}if(_0x16f6c5['transfereduniqueid']){delete queues[_0x16f6c5[_0x5165('0xe')]];}else{delete queues[_0x16f6c5[_0x5165('0xf')]];}}exports[_0x5165('0x10')]=function(_0x567d2f){try{utils[_0x5165('0x11')](util[_0x5165('0x3')](_0x5165('0x12'),_0x567d2f[_0x5165('0xf')]),_0x567d2f);utils['info'](util[_0x5165('0x3')](_0x5165('0x13'),_0x567d2f[_0x5165('0xf')],_0x567d2f[_0x5165('0x6')],_0x567d2f[_0x5165('0x14')]));queues[_0x567d2f[_0x5165('0xf')]]=_[_0x5165('0x15')](_0x567d2f,{'originalposition':_0x567d2f[_0x5165('0x14')],'queuecallerjoinAt':utils[_0x5165('0x16')](),'mohtime':0x0});}catch(_0x298b66){utils[_0x5165('0x17')](util['format'](_0x5165('0x12'),_0x567d2f[_0x5165('0xf')]),_0x298b66);}};exports[_0x5165('0x18')]=function(_0x58e577){try{if(!_['isNil'](queues[_0x58e577['uniqueid']])){utils['debug'](util[_0x5165('0x3')](_0x5165('0x19'),_0x58e577['uniqueid']),_0x58e577);if(queues[_0x58e577[_0x5165('0xf')]][_0x5165('0x1a')]){if(!queues[_0x58e577[_0x5165('0xf')]][_0x5165('0x1b')]&&!queues[_0x58e577['uniqueid']][_0x5165('0x1c')]){queues[_0x58e577[_0x5165('0xf')]][_0x5165('0x1d')]=!![];queues[_0x58e577[_0x5165('0xf')]]['queuecallercompleteAt']=utils[_0x5165('0x16')]();queues[_0x58e577[_0x5165('0xf')]]['queuecallerexitreason']=_0x5165('0x1e');}utils[_0x5165('0x1f')](util[_0x5165('0x3')](_0x5165('0x20'),_0x58e577[_0x5165('0xf')],queues[_0x58e577[_0x5165('0xf')]]['name'],queues[_0x58e577[_0x5165('0xf')]][_0x5165('0xa')]));writeDB(queues[_0x58e577['uniqueid']]);}else if(queues[_0x58e577[_0x5165('0xf')]]['transfereduniqueid']){utils[_0x5165('0x1f')](util[_0x5165('0x3')](_0x5165('0x21'),_0x58e577[_0x5165('0xf')],queues[_0x58e577[_0x5165('0xf')]][_0x5165('0x22')],queues[_0x58e577[_0x5165('0xf')]][_0x5165('0xe')]));queues[queues[_0x58e577[_0x5165('0xf')]][_0x5165('0xe')]]=queues[_0x58e577['uniqueid']];queues[queues[_0x58e577['uniqueid']][_0x5165('0xe')]][_0x5165('0x23')]=0x2;delete queues[_0x58e577[_0x5165('0xf')]];}}}catch(_0x935abc){utils['error'](util[_0x5165('0x3')](_0x5165('0x19'),_0x58e577['uniqueid']),_0x935abc);}};exports[_0x5165('0x24')]=function(_0x5b98e6){try{utils[_0x5165('0x11')](util[_0x5165('0x3')](_0x5165('0x25'),_0x5b98e6['uniqueid']),_0x5b98e6);if(!_[_0x5165('0x26')](_0x5b98e6[_0x5165('0x27')][_0x5165('0x28')])&&_0x5b98e6['value'][_0x5165('0x29')]()!==_0x5165('0x2a')){if(!_[_0x5165('0x26')](queues[_0x5b98e6[_0x5165('0xf')]])){queues[_0x5b98e6[_0x5165('0xf')]][_0x5165('0x1b')]=![];queues[_0x5b98e6[_0x5165('0xf')]][_0x5165('0x2b')]=null;queues[_0x5b98e6[_0x5165('0xf')]][_0x5165('0x1c')]=!![];queues[_0x5b98e6[_0x5165('0xf')]]['queuecallerexitAt']=utils[_0x5165('0x16')]();queues[_0x5b98e6[_0x5165('0xf')]][_0x5165('0xa')]=_0x5b98e6[_0x5165('0x2c')]['toUpperCase']();utils['info'](util[_0x5165('0x3')](_0x5165('0x2d'),_0x5b98e6[_0x5165('0xf')],queues[_0x5b98e6[_0x5165('0xf')]][_0x5165('0x22')],_0x5b98e6['value'],queues[_0x5b98e6['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x5b98e6[_0x5165('0xf')]]);}}else if(!_['isNil'](_0x5b98e6[_0x5165('0x27')][_0x5165('0x2e')])){if(!_[_0x5165('0x26')](queues[_0x5b98e6[_0x5165('0xf')]])&&!queues[_0x5b98e6[_0x5165('0xf')]][_0x5165('0x1b')]){queues[_0x5b98e6[_0x5165('0xf')]][_0x5165('0x1b')]=![];queues[_0x5b98e6[_0x5165('0xf')]][_0x5165('0x2b')]=null;queues[_0x5b98e6[_0x5165('0xf')]][_0x5165('0x1c')]=!![];queues[_0x5b98e6['uniqueid']][_0x5165('0x2f')]=utils['now']();queues[_0x5b98e6['uniqueid']]['queuecallerexitreason']='EXITWITHKEY';utils['info'](util[_0x5165('0x3')](_0x5165('0x30'),_0x5b98e6[_0x5165('0xf')],queues[_0x5b98e6[_0x5165('0xf')]][_0x5165('0x22')],_0x5b98e6['value'],queues[_0x5b98e6['uniqueid']][_0x5165('0xa')]));}}}catch(_0x1d7a38){utils[_0x5165('0x17')](util[_0x5165('0x3')](_0x5165('0x25'),_0x5b98e6[_0x5165('0xf')]),_0x1d7a38);}};exports[_0x5165('0x1b')]=function(_0x3f67cc){try{if(!_[_0x5165('0x26')](queues[_0x3f67cc[_0x5165('0xf')]])){utils[_0x5165('0x11')](util[_0x5165('0x3')]('[%s][queues][queuecallerabandon]',_0x3f67cc[_0x5165('0xf')]),_0x3f67cc);queues[_0x3f67cc[_0x5165('0xf')]][_0x5165('0x1c')]=![];queues[_0x3f67cc['uniqueid']]['queuecallerexitAt']=null;queues[_0x3f67cc[_0x5165('0xf')]][_0x5165('0x1b')]=!![];queues[_0x3f67cc[_0x5165('0xf')]]['queuecallerabandonAt']=utils[_0x5165('0x16')]();queues[_0x3f67cc[_0x5165('0xf')]]['queuecallerexitreason']='ABANDONED';utils['info'](util['format'](_0x5165('0x31'),_0x3f67cc[_0x5165('0xf')],queues[_0x3f67cc['uniqueid']][_0x5165('0x22')],queues[_0x3f67cc[_0x5165('0xf')]][_0x5165('0xa')]));}}catch(_0x12cce5){utils[_0x5165('0x17')](util['format'](_0x5165('0x32'),_0x3f67cc['uniqueid']),_0x12cce5);}};exports[_0x5165('0x33')]=function(_0x3eb445){try{if(!_[_0x5165('0x26')](queues[_0x3eb445[_0x5165('0xf')]])){utils[_0x5165('0x11')](util['format'](_0x5165('0x34'),_0x3eb445['uniqueid']),_0x3eb445);utils[_0x5165('0x1f')](util[_0x5165('0x3')](_0x5165('0x35'),_0x3eb445[_0x5165('0xf')],queues[_0x3eb445[_0x5165('0xf')]][_0x5165('0x22')],_0x3eb445[_0x5165('0x36')],_0x3eb445[_0x5165('0x37')]));queues[_0x3eb445[_0x5165('0xf')]][_0x5165('0x33')]=!![];queues[_0x3eb445['uniqueid']]['queuecallerleaveAt']=utils['now']();queues[_0x3eb445[_0x5165('0xf')]][_0x5165('0x38')]=utils[_0x5165('0x39')](queues[_0x3eb445['uniqueid']][_0x5165('0x1a')],queues[_0x3eb445[_0x5165('0xf')]][_0x5165('0x3a')]);queues[_0x3eb445['uniqueid']][_0x5165('0x14')]=_0x3eb445[_0x5165('0x14')];queues[_0x3eb445[_0x5165('0xf')]]['count']=_0x3eb445[_0x5165('0x3b')];queues[_0x3eb445[_0x5165('0xf')]][_0x5165('0x36')]=_0x3eb445[_0x5165('0x36')];queues[_0x3eb445[_0x5165('0xf')]][_0x5165('0x37')]=_0x3eb445['connectedlinename'];}}catch(_0x46acf5){utils['error'](util[_0x5165('0x3')](_0x5165('0x34'),_0x3eb445[_0x5165('0xf')]),_0x46acf5);}};exports[_0x5165('0x3c')]=function(_0x1c0115){try{if(!_['isNil'](queues[_0x1c0115[_0x5165('0xf')]])){utils['debug'](util[_0x5165('0x3')](_0x5165('0x3d'),_0x1c0115[_0x5165('0xf')]),_0x1c0115);utils[_0x5165('0x1f')](util[_0x5165('0x3')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x1c0115[_0x5165('0xf')],queues[_0x1c0115['uniqueid']][_0x5165('0x22')],_0x1c0115[_0x5165('0x3e')],_0x1c0115['destaccountcode']));queues[_0x1c0115[_0x5165('0xf')]][_0x5165('0x1b')]=![];queues[_0x1c0115[_0x5165('0xf')]][_0x5165('0x1b')]=![];queues[_0x1c0115['uniqueid']][_0x5165('0x2b')]=null;queues[_0x1c0115[_0x5165('0xf')]]['queuecallerexit']=![];queues[_0x1c0115[_0x5165('0xf')]]['queuecallerexitreason']=null;queues[_0x1c0115[_0x5165('0xf')]]['queuecallerexitAt']=null;queues[_0x1c0115[_0x5165('0xf')]][_0x5165('0x3f')]=!![];queues[_0x1c0115['uniqueid']]['accountcode']=_0x1c0115['destaccountcode'];queues[_0x1c0115[_0x5165('0xf')]][_0x5165('0x7')]=_0x1c0115[_0x5165('0x3e')];}}catch(_0x3e2b7a){utils['error'](util[_0x5165('0x3')](_0x5165('0x3d'),_0x1c0115['uniqueid']),_0x3e2b7a);}};exports[_0x5165('0x40')]=function(_0x43c02f){try{if(!_[_0x5165('0x26')](queues[_0x43c02f[_0x5165('0xf')]])){if(queues[_0x43c02f['uniqueid']]['queuecallerleaveAt']){utils[_0x5165('0x11')](util[_0x5165('0x3')](_0x5165('0x41'),_0x43c02f[_0x5165('0xf')]),_0x43c02f);queues[_0x43c02f[_0x5165('0xf')]]['queuecallerabandon']=![];queues[_0x43c02f[_0x5165('0xf')]][_0x5165('0x1b')]=![];queues[_0x43c02f[_0x5165('0xf')]]['queuecallerabandonAt']=null;queues[_0x43c02f['uniqueid']][_0x5165('0x1c')]=![];queues[_0x43c02f[_0x5165('0xf')]][_0x5165('0x2f')]=null;queues[_0x43c02f['uniqueid']][_0x5165('0x3f')]=!![];queues[_0x43c02f[_0x5165('0xf')]][_0x5165('0x7')]=_0x43c02f[_0x5165('0x3e')];queues[_0x43c02f[_0x5165('0xf')]][_0x5165('0x1d')]=!![];queues[_0x43c02f[_0x5165('0xf')]]['queuecallercompleteAt']=utils[_0x5165('0x16')]();if(_0x43c02f[_0x5165('0x42')]==_0x5165('0x43')){if(!queues[_0x43c02f[_0x5165('0xf')]][_0x5165('0x43')]){queues[_0x43c02f['uniqueid']]['queuecallerexitreason']=_0x5165('0x44');}}else{queues[_0x43c02f[_0x5165('0xf')]]['queuecallerexitreason']=_0x5165('0x45')+_0x43c02f[_0x5165('0x42')][_0x5165('0x29')]();}utils['info'](util[_0x5165('0x3')](_0x5165('0x46'),_0x43c02f[_0x5165('0xf')],queues[_0x43c02f[_0x5165('0xf')]][_0x5165('0x22')],_0x43c02f[_0x5165('0x3e')],queues[_0x43c02f[_0x5165('0xf')]][_0x5165('0xa')]));writeDB(queues[_0x43c02f[_0x5165('0xf')]]);}}}catch(_0x50b8f6){utils['error'](util[_0x5165('0x3')](_0x5165('0x41'),_0x43c02f['uniqueid']),_0x50b8f6);}};exports[_0x5165('0x47')]=function(_0x58ed26){try{if(!_['isNil'](queues[_0x58ed26['transfereeuniqueid']])){utils['debug'](util[_0x5165('0x3')]('[%s][queues][blindtransfer]',_0x58ed26[_0x5165('0xf')]),_0x58ed26);queues[_0x58ed26[_0x5165('0x48')]][_0x5165('0x43')]=!![];queues[_0x58ed26['transfereeuniqueid']][_0x5165('0x49')]=_0x5165('0x4a');queues[_0x58ed26[_0x5165('0x48')]][_0x5165('0x4b')]=_0x58ed26[_0x5165('0x4c')];queues[_0x58ed26[_0x5165('0x48')]][_0x5165('0x4d')]=_0x58ed26[_0x5165('0x48')];queues[_0x58ed26[_0x5165('0x48')]]['queuecallerexitreason']=_0x5165('0x4e');utils['info'](util[_0x5165('0x3')](_0x5165('0x4f'),_0x58ed26['uniqueid'],queues[_0x58ed26[_0x5165('0x48')]][_0x5165('0x22')],_0x58ed26['transfereeuniqueid'],_0x58ed26[_0x5165('0x4c')]));}}catch(_0x5ea473){utils[_0x5165('0x17')](util[_0x5165('0x3')](_0x5165('0x50'),_0x58ed26[_0x5165('0xf')]),_0x5ea473);}};exports['attendedtransfer']=function(_0xf86eb5){try{utils[_0x5165('0x11')](util[_0x5165('0x3')](_0x5165('0x51'),_0xf86eb5[_0x5165('0x52')]),_0xf86eb5);if(_0xf86eb5[_0x5165('0x52')]==_0xf86eb5[_0x5165('0x53')]){if(!_['isNil'](queues[_0xf86eb5[_0x5165('0x54')]])){utils[_0x5165('0x1f')](util['format'](_0x5165('0x55'),_0xf86eb5[_0x5165('0x52')],queues[_0xf86eb5[_0x5165('0x54')]]['name'],_0xf86eb5[_0x5165('0x56')]));queues[_0xf86eb5[_0x5165('0x54')]][_0x5165('0x43')]=!![];queues[_0xf86eb5['secondtransfererlinkedid']]['transfertype']=_0x5165('0x57');queues[_0xf86eb5[_0x5165('0x54')]][_0x5165('0x4b')]=_0xf86eb5[_0x5165('0x56')];queues[_0xf86eb5[_0x5165('0x54')]]['transferuniqueid']=_0xf86eb5[_0x5165('0x52')];queues[_0xf86eb5[_0x5165('0x54')]][_0x5165('0xa')]=_0x5165('0x58');}if(!_[_0x5165('0x26')](queues[_0xf86eb5[_0x5165('0x53')]])){if(_0xf86eb5[_0x5165('0x59')]&&queues[_0xf86eb5[_0x5165('0x59')]]){queues[_0xf86eb5[_0x5165('0x59')]][_0x5165('0x23')]=0x1;queues[_0xf86eb5['transfereeuniqueid']]=_[_0x5165('0x5a')](queues[_0xf86eb5['transfereelinkedid']]);queues[_0xf86eb5[_0x5165('0x48')]][_0x5165('0xe')]=_0xf86eb5['transfertargetuniqueid'];queues[_0xf86eb5[_0x5165('0x48')]][_0x5165('0x23')]=0x2;queues[_0xf86eb5['transfereeuniqueid']][_0x5165('0x8')]=queues[_0xf86eb5[_0x5165('0x54')]][_0x5165('0x8')];queues[_0xf86eb5[_0x5165('0x48')]][_0x5165('0x5b')]=queues[_0xf86eb5[_0x5165('0x54')]][_0x5165('0x5b')];queues[_0xf86eb5['transfereeuniqueid']][_0x5165('0x3a')]=utils[_0x5165('0x16')]();queues[_0xf86eb5[_0x5165('0x48')]][_0x5165('0x1a')]=utils['now']();queues[_0xf86eb5['transfereeuniqueid']][_0x5165('0x38')]=0x0;queues[_0xf86eb5[_0x5165('0x48')]][_0x5165('0x5c')]=0x0;utils[_0x5165('0x1f')](util[_0x5165('0x3')](_0x5165('0x5d'),_0xf86eb5['origtransfereruniqueid'],queues[_0xf86eb5[_0x5165('0x48')]][_0x5165('0x22')],queues[_0xf86eb5[_0x5165('0x48')]][_0x5165('0x8')],queues[_0xf86eb5[_0x5165('0x48')]][_0x5165('0x5b')]));}else{utils[_0x5165('0x1f')](util[_0x5165('0x3')](_0x5165('0x5e'),_0xf86eb5[_0x5165('0x52')],queues[_0xf86eb5[_0x5165('0x53')]]['name'],_0xf86eb5[_0x5165('0x54')]));queues[_0xf86eb5[_0x5165('0x53')]]['transfereduniqueid']=_0xf86eb5[_0x5165('0x54')];}}}else if(_0xf86eb5['secondtransfereruniqueid']==_0xf86eb5[_0x5165('0x54')]){if(!_[_0x5165('0x26')](queues[_0xf86eb5[_0x5165('0x53')]])){utils['info'](util[_0x5165('0x3')](_0x5165('0x5f'),_0xf86eb5[_0x5165('0x52')],queues[_0xf86eb5[_0x5165('0x53')]][_0x5165('0x22')],_0xf86eb5[_0x5165('0x60')],_0xf86eb5[_0x5165('0x61')]));queues[_0xf86eb5[_0x5165('0x53')]][_0x5165('0x43')]=!![];queues[_0xf86eb5[_0x5165('0x53')]][_0x5165('0x49')]=_0x5165('0x57');queues[_0xf86eb5[_0x5165('0x53')]][_0x5165('0x4b')]=_0xf86eb5[_0x5165('0x61')];queues[_0xf86eb5[_0x5165('0x53')]][_0x5165('0x4d')]=_0xf86eb5[_0x5165('0x60')];queues[_0xf86eb5[_0x5165('0x53')]]['queuecallerexitreason']=_0x5165('0x58');}if(!_[_0x5165('0x26')](queues[_0xf86eb5[_0x5165('0x54')]])){if(_0xf86eb5[_0x5165('0x62')]&&queues[_0xf86eb5[_0x5165('0x62')]]){queues[_0xf86eb5[_0x5165('0x62')]]['queuecallerenterreason']=0x1;queues[_0xf86eb5[_0x5165('0x63')]]=_['clone'](queues[_0xf86eb5[_0x5165('0x62')]]);queues[_0xf86eb5['transfertargetuniqueid']][_0x5165('0xe')]=_0xf86eb5[_0x5165('0x63')];queues[_0xf86eb5['transfertargetuniqueid']][_0x5165('0x23')]=0x2;queues[_0xf86eb5[_0x5165('0x63')]][_0x5165('0x8')]=queues[_0xf86eb5[_0x5165('0x53')]][_0x5165('0x8')];queues[_0xf86eb5[_0x5165('0x63')]][_0x5165('0x5b')]=queues[_0xf86eb5[_0x5165('0x53')]][_0x5165('0x5b')];queues[_0xf86eb5[_0x5165('0x63')]][_0x5165('0x3a')]=utils[_0x5165('0x16')]();queues[_0xf86eb5['transfertargetuniqueid']][_0x5165('0x1a')]=utils[_0x5165('0x16')]();queues[_0xf86eb5[_0x5165('0x63')]][_0x5165('0x38')]=0x0;queues[_0xf86eb5[_0x5165('0x63')]]['mohtime']=0x0;utils[_0x5165('0x1f')](util[_0x5165('0x3')](_0x5165('0x64'),_0xf86eb5[_0x5165('0x52')],queues[_0xf86eb5[_0x5165('0x63')]][_0x5165('0x22')],queues[_0xf86eb5[_0x5165('0x63')]][_0x5165('0xe')],queues[_0xf86eb5[_0x5165('0x63')]][_0x5165('0x8')],queues[_0xf86eb5[_0x5165('0x63')]][_0x5165('0x5b')]));}else{utils[_0x5165('0x1f')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0xf86eb5['origtransfereruniqueid'],queues[_0xf86eb5[_0x5165('0x54')]][_0x5165('0x22')],_0xf86eb5[_0x5165('0x53')]));queues[_0xf86eb5[_0x5165('0x54')]]['transfereduniqueid']=_0xf86eb5['origtransfererlinkedid'];}}}}catch(_0x412677){utils['error'](util[_0x5165('0x3')](_0x5165('0x51'),_0xf86eb5[_0x5165('0x52')]),_0x412677);}};exports[_0x5165('0x65')]=function(_0x5a1b9f){try{if(!_[_0x5165('0x26')](queues[_0x5a1b9f[_0x5165('0xf')]])){utils[_0x5165('0x11')](util['format']('[%s][queues][musiconholdstart]',_0x5a1b9f['uniqueid']),_0x5a1b9f);queues[_0x5a1b9f[_0x5165('0xf')]][_0x5165('0x66')]=utils[_0x5165('0x16')]();utils[_0x5165('0x1f')](util[_0x5165('0x3')](_0x5165('0x67'),_0x5a1b9f[_0x5165('0xf')],queues[_0x5a1b9f[_0x5165('0xf')]]['name'],queues[_0x5a1b9f[_0x5165('0xf')]][_0x5165('0x66')]));}}catch(_0x1eed8b){utils['error'](util['format'](_0x5165('0x68'),_0x5a1b9f['uniqueid']),_0x1eed8b);}};exports[_0x5165('0x69')]=function(_0x232860){try{if(!_['isNil'](queues[_0x232860[_0x5165('0xf')]])){if(!_[_0x5165('0x26')](queues[_0x232860[_0x5165('0xf')]][_0x5165('0x66')])){utils['debug'](util['format'](_0x5165('0x6a'),_0x232860[_0x5165('0xf')]),_0x232860);queues[_0x232860['uniqueid']][_0x5165('0x5c')]+=utils['diffTime'](utils[_0x5165('0x16')](),queues[_0x232860[_0x5165('0xf')]][_0x5165('0x66')]);utils[_0x5165('0x1f')](util[_0x5165('0x3')](_0x5165('0x6b'),_0x232860[_0x5165('0xf')],queues[_0x232860[_0x5165('0xf')]][_0x5165('0x22')],queues[_0x232860[_0x5165('0xf')]]['mohtime']));delete queues[_0x232860[_0x5165('0xf')]]['musiconholdstartAt'];}}}catch(_0x505f49){utils[_0x5165('0x17')](util[_0x5165('0x3')](_0x5165('0x6a'),_0x232860[_0x5165('0xf')]),_0x505f49);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index e410be6..9338fa1 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 _0x3de6=['toLowerCase','set','startsWith','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','membername','UserId','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','context','exten','error','newstate','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','isNil','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinename','outbound','connectedlinenum','forEach','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata'];(function(_0x51bda1,_0x44f80d){var _0x1ce08c=function(_0x5b788e){while(--_0x5b788e){_0x51bda1['push'](_0x51bda1['shift']());}};_0x1ce08c(++_0x44f80d);}(_0x3de6,0xb4));var _0x63de=function(_0x864273,_0x16479a){_0x864273=_0x864273-0x0;var _0x4c1cf3=_0x3de6[_0x864273];return _0x4c1cf3;};'use strict';var _=require(_0x63de('0x0'));var util=require('util');var utils=require(_0x63de('0x1'));var recordings={};function writeDB(_0x3e5759){utils[_0x63de('0x2')](util[_0x63de('0x3')](_0x63de('0x4'),_0x3e5759[_0x63de('0x5')]));if(_0x3e5759['accountcode']){utils['getUserByInternal'](_0x3e5759[_0x63de('0x6')])['then'](function(_0x2635c6){if(_0x2635c6){_0x3e5759[_0x63de('0x7')]=_0x2635c6['name'];_0x3e5759[_0x63de('0x8')]=_0x2635c6['id'];}utils['request'](_0x63de('0x9'),_0x3e5759);});}else{utils['request'](_0x63de('0x9'),_0x3e5759);}}exports[_0x63de('0xa')]=function(_0x4ab2f3){try{utils[_0x63de('0xb')](util[_0x63de('0x3')](_0x63de('0xc'),_0x4ab2f3[_0x63de('0x5')]),_0x4ab2f3);if(_0x4ab2f3[_0x63de('0x5')]==_0x4ab2f3[_0x63de('0xd')]){utils[_0x63de('0x2')](util[_0x63de('0x3')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x4ab2f3[_0x63de('0x5')],_0x4ab2f3[_0x63de('0xe')],_0x4ab2f3[_0x63de('0xf')]));recordings[_0x4ab2f3[_0x63de('0x5')]]={'uniqueid':_0x4ab2f3[_0x63de('0x5')],'accountcode':_0x4ab2f3[_0x63de('0x6')],'exten':_0x4ab2f3['exten'],'context':_0x4ab2f3[_0x63de('0xe')],'channel':_0x4ab2f3['channel'],'monitors':[]};}}catch(_0x541622){utils[_0x63de('0x10')](util[_0x63de('0x3')](_0x63de('0xc'),_0x4ab2f3['uniqueid']),_0x541622);}};exports[_0x63de('0x11')]=function(_0x423587){try{utils[_0x63de('0xb')](util[_0x63de('0x3')](_0x63de('0x12'),_0x423587[_0x63de('0x5')]),_0x423587);if(!_['isNil'](recordings[_0x423587[_0x63de('0x5')]])&&_0x423587[_0x63de('0x13')]==0x6){utils[_0x63de('0x2')](util[_0x63de('0x3')](_0x63de('0x14'),_0x423587[_0x63de('0x5')],_0x423587[_0x63de('0xe')],_0x423587['channel']));}else if(!_['isNil'](recordings[_0x423587[_0x63de('0xd')]])&&_0x423587[_0x63de('0x13')]==0x6&&_0x423587['context']!='transfer'){utils[_0x63de('0x2')](util[_0x63de('0x3')](_0x63de('0x15'),_0x423587[_0x63de('0x5')],_0x423587[_0x63de('0xd')],_0x423587['context'],_0x423587['channel']));recordings[_0x423587['linkedid']][_0x63de('0x6')]=_0x423587[_0x63de('0x6')];}}catch(_0x9b3ae){utils['error'](util[_0x63de('0x3')]('[%s][recordings][newstate]',_0x423587['uniqueid']),_0x9b3ae);}};exports[_0x63de('0x16')]=function(_0x4fc014){try{if(!_[_0x63de('0x17')](_0x4fc014[_0x63de('0x18')])&&!_[_0x63de('0x17')](_0x4fc014[_0x63de('0x18')]['mixmonitor_filename'])){utils[_0x63de('0xb')](util['format'](_0x63de('0x19'),_0x4fc014['uniqueid']),_0x4fc014);utils[_0x63de('0x2')](util['format'](_0x63de('0x1a'),_0x4fc014[_0x63de('0x5')],_0x4fc014[_0x63de('0x18')],_0x4fc014[_0x63de('0x1b')]));if(_['endsWith'](_0x4fc014[_0x63de('0x1b')],_0x63de('0x1c'))){_0x4fc014[_0x63de('0x1b')]=_0x4fc014['value'][_0x63de('0x1d')]('.wav49','.WAV');}if(recordings[_0x4fc014['linkedid']]){var _0x56c3c1=_[_0x63de('0x1e')](recordings[_0x4fc014[_0x63de('0xd')]][_0x63de('0x1f')],{'value':_0x4fc014[_0x63de('0x1b')]});if(_['isNil'](_0x56c3c1)){recordings[_0x4fc014[_0x63de('0xd')]][_0x63de('0x1f')][_0x63de('0x20')]({'value':_0x4fc014[_0x63de('0x1b')]});}}}}catch(_0x4de5bf){utils[_0x63de('0x10')](util['format'](_0x63de('0x19'),_0x4fc014[_0x63de('0x5')]),_0x4de5bf);}};exports[_0x63de('0x21')]=function(_0x7aa8cf){try{if(!_[_0x63de('0x17')](recordings[_0x7aa8cf[_0x63de('0x5')]])){utils[_0x63de('0xb')](util[_0x63de('0x3')](_0x63de('0x22'),_0x7aa8cf[_0x63de('0x5')]),_0x7aa8cf);utils[_0x63de('0x2')](util['format'](_0x63de('0x23'),_0x7aa8cf[_0x63de('0x5')],_0x7aa8cf['calleridnum'],_0x7aa8cf[_0x63de('0x24')],_0x7aa8cf[_0x63de('0x25')]));recordings[_0x7aa8cf[_0x63de('0x5')]][_0x63de('0x26')]=_0x7aa8cf[_0x63de('0x26')];recordings[_0x7aa8cf[_0x63de('0x5')]][_0x63de('0x24')]=_0x7aa8cf[_0x63de('0x24')];recordings[_0x7aa8cf['uniqueid']]['connectedlinenum']=_0x7aa8cf['connectedlinenum'];recordings[_0x7aa8cf[_0x63de('0x5')]]['connectedlinename']=_0x7aa8cf[_0x63de('0x27')];if(recordings[_0x7aa8cf['uniqueid']]['type']==_0x63de('0x28')&&recordings[_0x7aa8cf['uniqueid']]['accountcode']){recordings[_0x7aa8cf[_0x63de('0x5')]][_0x63de('0x29')]=recordings[_0x7aa8cf[_0x63de('0x5')]]['accountcode'];recordings[_0x7aa8cf[_0x63de('0x5')]][_0x63de('0x27')]='';}recordings[_0x7aa8cf['uniqueid']][_0x63de('0x1f')][_0x63de('0x2a')](function(_0x3cae83){var _0x5086c5=_['clone'](recordings[_0x7aa8cf['uniqueid']]);_0x5086c5[_0x63de('0x1b')]=_0x3cae83[_0x63de('0x1b')];writeDB(_0x5086c5);});delete recordings[_0x7aa8cf[_0x63de('0x5')]];}}catch(_0x35a64c){utils['error'](util[_0x63de('0x3')](_0x63de('0x22'),_0x7aa8cf[_0x63de('0x5')]),_0x35a64c);}};exports[_0x63de('0x2b')]=function(_0x30adf3){try{if(!_['isNil'](recordings[_0x30adf3[_0x63de('0x5')]])){utils['debug'](util[_0x63de('0x3')](_0x63de('0x2c'),_0x30adf3[_0x63de('0x5')]),_0x30adf3);utils['info'](util[_0x63de('0x3')](_0x63de('0x2d'),_0x30adf3[_0x63de('0x5')],_0x30adf3[_0x63de('0x2e')],_0x30adf3[_0x63de('0x2f')]));if(_0x30adf3[_0x63de('0x2e')][_0x63de('0x30')]()==_0x63de('0x31')&&_[_0x63de('0x32')](_0x30adf3[_0x63de('0x2f')][_0x63de('0x30')](),'cdr')){var _0x1483b8=_0x30adf3[_0x63de('0x2f')][_0x63de('0x33')]('=');var _0x485516=_0x1483b8[0x0]['substring'](_0x1483b8[0x0][_0x63de('0x34')]('(')+0x1,_0x1483b8[0x0][_0x63de('0x34')](')'));var _0x3b1439=_0x1483b8[0x1];recordings[_0x30adf3[_0x63de('0x5')]][_0x485516]=_0x3b1439;}}}catch(_0x3ce7a1){utils[_0x63de('0x10')](util['format'](_0x63de('0x2c'),_0x30adf3['uniqueid']),_0x3ce7a1);}};exports[_0x63de('0x35')]=function(_0x3b56f8){try{if(!_[_0x63de('0x17')](recordings[_0x3b56f8['uniqueid']])){utils[_0x63de('0xb')](util[_0x63de('0x3')](_0x63de('0x36'),_0x3b56f8[_0x63de('0x5')]),_0x3b56f8);utils[_0x63de('0x2')](util[_0x63de('0x3')](_0x63de('0x37'),_0x3b56f8[_0x63de('0x5')],_0x3b56f8[_0x63de('0x38')]));recordings[_0x3b56f8[_0x63de('0x5')]][_0x63de('0x38')]=_0x3b56f8[_0x63de('0x38')];}}catch(_0x57a49d){utils['error'](util[_0x63de('0x3')](_0x63de('0x36'),_0x3b56f8[_0x63de('0x5')]),_0x57a49d);}}; \ No newline at end of file +var _0x4ad4=['format','context','channel','error','newstate','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','membername','name','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]'];(function(_0x403115,_0x2d6d03){var _0x596ef3=function(_0x145d97){while(--_0x145d97){_0x403115['push'](_0x403115['shift']());}};_0x596ef3(++_0x2d6d03);}(_0x4ad4,0xa6));var _0x44ad=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x4ad4[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0x44ad('0x0'));var util=require(_0x44ad('0x1'));var utils=require(_0x44ad('0x2'));var recordings={};function writeDB(_0x363d35){utils[_0x44ad('0x3')](util['format'](_0x44ad('0x4'),_0x363d35[_0x44ad('0x5')]));if(_0x363d35[_0x44ad('0x6')]){utils[_0x44ad('0x7')](_0x363d35[_0x44ad('0x6')])['then'](function(_0x573d87){if(_0x573d87){_0x363d35[_0x44ad('0x8')]=_0x573d87[_0x44ad('0x9')];_0x363d35['UserId']=_0x573d87['id'];}utils['request']('CreateVoiceRecording',_0x363d35);});}else{utils[_0x44ad('0xa')](_0x44ad('0xb'),_0x363d35);}}exports['newchannel']=function(_0x26ff38){try{utils[_0x44ad('0xc')](util['format'](_0x44ad('0xd'),_0x26ff38[_0x44ad('0x5')]),_0x26ff38);if(_0x26ff38['uniqueid']==_0x26ff38['linkedid']){utils[_0x44ad('0x3')](util[_0x44ad('0xe')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x26ff38[_0x44ad('0x5')],_0x26ff38[_0x44ad('0xf')],_0x26ff38['exten']));recordings[_0x26ff38[_0x44ad('0x5')]]={'uniqueid':_0x26ff38['uniqueid'],'accountcode':_0x26ff38[_0x44ad('0x6')],'exten':_0x26ff38['exten'],'context':_0x26ff38['context'],'channel':_0x26ff38[_0x44ad('0x10')],'monitors':[]};}}catch(_0x3450b7){utils[_0x44ad('0x11')](util[_0x44ad('0xe')](_0x44ad('0xd'),_0x26ff38[_0x44ad('0x5')]),_0x3450b7);}};exports[_0x44ad('0x12')]=function(_0x3d36d4){try{utils[_0x44ad('0xc')](util[_0x44ad('0xe')]('[%s][recordings][newstate]',_0x3d36d4['uniqueid']),_0x3d36d4);if(!_[_0x44ad('0x13')](recordings[_0x3d36d4[_0x44ad('0x5')]])&&_0x3d36d4['channelstate']==0x6){utils[_0x44ad('0x3')](util[_0x44ad('0xe')](_0x44ad('0x14'),_0x3d36d4[_0x44ad('0x5')],_0x3d36d4[_0x44ad('0xf')],_0x3d36d4[_0x44ad('0x10')]));}else if(!_[_0x44ad('0x13')](recordings[_0x3d36d4[_0x44ad('0x15')]])&&_0x3d36d4[_0x44ad('0x16')]==0x6&&_0x3d36d4['context']!=_0x44ad('0x17')){utils[_0x44ad('0x3')](util[_0x44ad('0xe')](_0x44ad('0x18'),_0x3d36d4[_0x44ad('0x5')],_0x3d36d4[_0x44ad('0x15')],_0x3d36d4[_0x44ad('0xf')],_0x3d36d4['channel']));recordings[_0x3d36d4['linkedid']][_0x44ad('0x6')]=_0x3d36d4['accountcode'];}}catch(_0x5b53bd){utils[_0x44ad('0x11')](util['format']('[%s][recordings][newstate]',_0x3d36d4[_0x44ad('0x5')]),_0x5b53bd);}};exports[_0x44ad('0x19')]=function(_0x4e8794){try{if(!_[_0x44ad('0x13')](_0x4e8794[_0x44ad('0x1a')])&&!_[_0x44ad('0x13')](_0x4e8794['variable'][_0x44ad('0x1b')])){utils['debug'](util[_0x44ad('0xe')](_0x44ad('0x1c'),_0x4e8794[_0x44ad('0x5')]),_0x4e8794);utils['info'](util[_0x44ad('0xe')](_0x44ad('0x1d'),_0x4e8794[_0x44ad('0x5')],_0x4e8794[_0x44ad('0x1a')],_0x4e8794[_0x44ad('0x1e')]));if(_[_0x44ad('0x1f')](_0x4e8794[_0x44ad('0x1e')],_0x44ad('0x20'))){_0x4e8794[_0x44ad('0x1e')]=_0x4e8794[_0x44ad('0x1e')][_0x44ad('0x21')](_0x44ad('0x20'),_0x44ad('0x22'));}if(recordings[_0x4e8794['linkedid']]){var _0x53e7e8=_[_0x44ad('0x23')](recordings[_0x4e8794['linkedid']]['monitors'],{'value':_0x4e8794[_0x44ad('0x1e')]});if(_[_0x44ad('0x13')](_0x53e7e8)){recordings[_0x4e8794[_0x44ad('0x15')]][_0x44ad('0x24')]['push']({'value':_0x4e8794[_0x44ad('0x1e')]});}}}}catch(_0x374c11){utils[_0x44ad('0x11')](util[_0x44ad('0xe')](_0x44ad('0x1c'),_0x4e8794['uniqueid']),_0x374c11);}};exports[_0x44ad('0x25')]=function(_0x1040f4){try{if(!_[_0x44ad('0x13')](recordings[_0x1040f4['uniqueid']])){utils[_0x44ad('0xc')](util[_0x44ad('0xe')](_0x44ad('0x26'),_0x1040f4[_0x44ad('0x5')]),_0x1040f4);utils[_0x44ad('0x3')](util[_0x44ad('0xe')](_0x44ad('0x27'),_0x1040f4[_0x44ad('0x5')],_0x1040f4[_0x44ad('0x28')],_0x1040f4[_0x44ad('0x29')],_0x1040f4[_0x44ad('0x2a')]));recordings[_0x1040f4['uniqueid']][_0x44ad('0x28')]=_0x1040f4[_0x44ad('0x28')];recordings[_0x1040f4['uniqueid']][_0x44ad('0x29')]=_0x1040f4[_0x44ad('0x29')];recordings[_0x1040f4[_0x44ad('0x5')]]['connectedlinenum']=_0x1040f4[_0x44ad('0x2b')];recordings[_0x1040f4[_0x44ad('0x5')]]['connectedlinename']=_0x1040f4[_0x44ad('0x2c')];if(recordings[_0x1040f4[_0x44ad('0x5')]][_0x44ad('0x2d')]==_0x44ad('0x2e')&&recordings[_0x1040f4[_0x44ad('0x5')]][_0x44ad('0x6')]){recordings[_0x1040f4['uniqueid']][_0x44ad('0x2b')]=recordings[_0x1040f4[_0x44ad('0x5')]][_0x44ad('0x6')];recordings[_0x1040f4['uniqueid']]['connectedlinename']='';}recordings[_0x1040f4[_0x44ad('0x5')]][_0x44ad('0x24')]['forEach'](function(_0x2a64ae){var _0x302ca3=_['clone'](recordings[_0x1040f4[_0x44ad('0x5')]]);_0x302ca3[_0x44ad('0x1e')]=_0x2a64ae[_0x44ad('0x1e')];writeDB(_0x302ca3);});delete recordings[_0x1040f4['uniqueid']];}}catch(_0x556e26){utils[_0x44ad('0x11')](util['format'](_0x44ad('0x26'),_0x1040f4[_0x44ad('0x5')]),_0x556e26);}};exports[_0x44ad('0x2f')]=function(_0x48bfd3){try{if(!_[_0x44ad('0x13')](recordings[_0x48bfd3[_0x44ad('0x5')]])){utils[_0x44ad('0xc')](util[_0x44ad('0xe')](_0x44ad('0x30'),_0x48bfd3[_0x44ad('0x5')]),_0x48bfd3);utils['info'](util['format'](_0x44ad('0x31'),_0x48bfd3[_0x44ad('0x5')],_0x48bfd3[_0x44ad('0x32')],_0x48bfd3[_0x44ad('0x33')]));if(_0x48bfd3['application']['toLowerCase']()==_0x44ad('0x34')&&_[_0x44ad('0x35')](_0x48bfd3[_0x44ad('0x33')]['toLowerCase'](),'cdr')){var _0x465847=_0x48bfd3[_0x44ad('0x33')]['split']('=');var _0x8deadf=_0x465847[0x0][_0x44ad('0x36')](_0x465847[0x0][_0x44ad('0x37')]('(')+0x1,_0x465847[0x0]['lastIndexOf'](')'));var _0x57f57b=_0x465847[0x1];recordings[_0x48bfd3[_0x44ad('0x5')]][_0x8deadf]=_0x57f57b;}}}catch(_0x5ae526){utils[_0x44ad('0x11')](util[_0x44ad('0xe')](_0x44ad('0x30'),_0x48bfd3[_0x44ad('0x5')]),_0x5ae526);}};exports[_0x44ad('0x38')]=function(_0x1684c1){try{if(!_['isNil'](recordings[_0x1684c1[_0x44ad('0x5')]])){utils[_0x44ad('0xc')](util[_0x44ad('0xe')](_0x44ad('0x39'),_0x1684c1[_0x44ad('0x5')]),_0x1684c1);utils['info'](util[_0x44ad('0xe')](_0x44ad('0x3a'),_0x1684c1['uniqueid'],_0x1684c1['queue']));recordings[_0x1684c1['uniqueid']][_0x44ad('0x3b')]=_0x1684c1[_0x44ad('0x3b')];}}catch(_0x421cea){utils[_0x44ad('0x11')](util['format'](_0x44ad('0x39'),_0x1684c1[_0x44ad('0x5')]),_0x421cea);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index a89e5c3..a537e48 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 _0x482a=['transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','type','blind','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel'];(function(_0x5653a4,_0x38822f){var _0x512a7e=function(_0x247c80){while(--_0x247c80){_0x5653a4['push'](_0x5653a4['shift']());}};_0x512a7e(++_0x38822f);}(_0x482a,0x8c));var _0xa482=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x482a[_0x500419];return _0x241c1a;};'use strict';var _=require(_0xa482('0x0'));var util=require(_0xa482('0x1'));var utils=require(_0xa482('0x2'));function writeDB(_0x349c16){utils[_0xa482('0x3')](util[_0xa482('0x4')](_0xa482('0x5'),_0x349c16['type']===_0xa482('0x6')?_0x349c16[_0xa482('0x7')]:_0x349c16[_0xa482('0x8')],_0x349c16['type']));utils[_0xa482('0x9')](_0xa482('0xa'),_0x349c16);}exports[_0xa482('0xb')]={};exports[_0xa482('0xc')]=function(_0x3bfea1){try{utils[_0xa482('0xd')](util[_0xa482('0x4')](_0xa482('0xe'),_0x3bfea1[_0xa482('0x8')]),_0x3bfea1);utils[_0xa482('0x3')](util[_0xa482('0x4')](_0xa482('0xf'),_0x3bfea1['uniqueid'],_0x3bfea1[_0xa482('0x10')],_0x3bfea1[_0xa482('0x11')],_0x3bfea1[_0xa482('0x12')],_0x3bfea1['transfereecalleridname']));_0x3bfea1[_0xa482('0x13')]=_0xa482('0x14');exports[_0xa482('0xb')][_0x3bfea1[_0xa482('0x15')]]=_0x3bfea1;writeDB(_0x3bfea1);}catch(_0x3f4a15){utils[_0xa482('0x16')](util[_0xa482('0x4')](_0xa482('0xe'),_0x3bfea1[_0xa482('0x8')]),_0x3f4a15);}};exports[_0xa482('0x17')]=function(_0x5da868){try{utils[_0xa482('0xd')](util['format'](_0xa482('0x18'),_0x5da868[_0xa482('0x7')]),_0x5da868);utils['info'](util[_0xa482('0x4')](_0xa482('0x19'),_0x5da868[_0xa482('0x7')],_0x5da868[_0xa482('0x1a')],_0x5da868[_0xa482('0x1b')],_0x5da868[_0xa482('0x1c')],_0x5da868[_0xa482('0x1d')]));_0x5da868=_[_0xa482('0x1e')](_0x5da868,{'transfererchannel':_0x5da868[_0xa482('0x1f')],'transferercalleridnum':_0x5da868[_0xa482('0x1a')],'transferercalleridname':_0x5da868[_0xa482('0x1b')],'transfererconnectedlinenum':_0x5da868[_0xa482('0x20')],'transfererconnectedlinename':_0x5da868[_0xa482('0x21')],'transfereraccountcode':_0x5da868[_0xa482('0x22')],'transferercontext':_0x5da868['secondtransferercontext'],'transfererexten':_0x5da868[_0xa482('0x23')],'transfererlinkedid':_0x5da868[_0xa482('0x24')],'context':_0x5da868[_0xa482('0x25')],'extension':_0x5da868['origtransfererexten'],'type':_0xa482('0x6')});if(_[_0xa482('0x26')](_0x5da868[_0xa482('0x27')])){_0x5da868=_[_0xa482('0x1e')](_0x5da868,{'transfereechannel':_0x5da868['transfertargetchannel'],'transfereecalleridnum':_0x5da868[_0xa482('0x1c')],'transfereecalleridname':_0x5da868[_0xa482('0x1d')],'transfereeconnectedlinenum':_0x5da868[_0xa482('0x28')],'transfereeconnectedlinename':_0x5da868[_0xa482('0x29')],'transfereeaccountcode':_0x5da868[_0xa482('0x2a')],'transfereecontext':_0x5da868[_0xa482('0x2b')],'transfereeexten':_0x5da868[_0xa482('0x2c')],'transfereelinkedid':_0x5da868['transfertargetlinkedid']});}writeDB(_0x5da868);}catch(_0x336843){utils[_0xa482('0x16')](util[_0xa482('0x4')](_0xa482('0x18'),_0x5da868[_0xa482('0x7')]),_0x336843);}}; \ No newline at end of file +var _0x236e=['secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','error','lodash','util','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','CreateVoiceTransferReport','blinds','blindtransfer','format','uniqueid','transferercalleridnum','transfereecalleridname','blind','transfereruniqueid','[%s][transfers][blindtransfer]','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x236e,0x175));var _0xe236=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x236e[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0xe236('0x0'));var util=require(_0xe236('0x1'));var utils=require('./utils');function writeDB(_0x2163e9){utils[_0xe236('0x2')](util['format'](_0xe236('0x3'),_0x2163e9[_0xe236('0x4')]===_0xe236('0x5')?_0x2163e9[_0xe236('0x6')]:_0x2163e9['uniqueid'],_0x2163e9[_0xe236('0x4')]));utils['request'](_0xe236('0x7'),_0x2163e9);}exports[_0xe236('0x8')]={};exports[_0xe236('0x9')]=function(_0x4df84f){try{utils['debug'](util[_0xe236('0xa')]('[%s][transfers][blindtransfer]',_0x4df84f[_0xe236('0xb')]),_0x4df84f);utils[_0xe236('0x2')](util[_0xe236('0xa')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x4df84f[_0xe236('0xb')],_0x4df84f[_0xe236('0xc')],_0x4df84f['transferercalleridname'],_0x4df84f['transfereecalleridnum'],_0x4df84f[_0xe236('0xd')]));_0x4df84f['type']=_0xe236('0xe');exports[_0xe236('0x8')][_0x4df84f[_0xe236('0xf')]]=_0x4df84f;writeDB(_0x4df84f);}catch(_0x1bee51){utils['error'](util['format'](_0xe236('0x10'),_0x4df84f[_0xe236('0xb')]),_0x1bee51);}};exports['attendedtransfer']=function(_0xb3869){try{utils[_0xe236('0x11')](util[_0xe236('0xa')](_0xe236('0x12'),_0xb3869[_0xe236('0x6')]),_0xb3869);utils['info'](util[_0xe236('0xa')](_0xe236('0x13'),_0xb3869[_0xe236('0x6')],_0xb3869[_0xe236('0x14')],_0xb3869[_0xe236('0x15')],_0xb3869[_0xe236('0x16')],_0xb3869[_0xe236('0x17')]));_0xb3869=_[_0xe236('0x18')](_0xb3869,{'transfererchannel':_0xb3869[_0xe236('0x19')],'transferercalleridnum':_0xb3869[_0xe236('0x14')],'transferercalleridname':_0xb3869[_0xe236('0x15')],'transfererconnectedlinenum':_0xb3869[_0xe236('0x1a')],'transfererconnectedlinename':_0xb3869[_0xe236('0x1b')],'transfereraccountcode':_0xb3869[_0xe236('0x1c')],'transferercontext':_0xb3869[_0xe236('0x1d')],'transfererexten':_0xb3869[_0xe236('0x1e')],'transfererlinkedid':_0xb3869[_0xe236('0x1f')],'context':_0xb3869[_0xe236('0x20')],'extension':_0xb3869['origtransfererexten'],'type':_0xe236('0x5')});if(_['isNil'](_0xb3869[_0xe236('0x21')])){_0xb3869=_[_0xe236('0x18')](_0xb3869,{'transfereechannel':_0xb3869[_0xe236('0x22')],'transfereecalleridnum':_0xb3869[_0xe236('0x16')],'transfereecalleridname':_0xb3869[_0xe236('0x17')],'transfereeconnectedlinenum':_0xb3869['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0xb3869[_0xe236('0x23')],'transfereeaccountcode':_0xb3869[_0xe236('0x24')],'transfereecontext':_0xb3869[_0xe236('0x25')],'transfereeexten':_0xb3869[_0xe236('0x26')],'transfereelinkedid':_0xb3869['transfertargetlinkedid']});}writeDB(_0xb3869);}catch(_0x3debdf){utils[_0xe236('0x27')](util[_0xe236('0xa')](_0xe236('0x12'),_0xb3869[_0xe236('0x6')]),_0x3debdf);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 8f37e62..b2022c3 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 _0x8287=['debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','name','interface','result','length','found','notfound','getUserByInterface','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','GetVoiceQueue','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','xdr','info','inspect'];(function(_0x1ebd10,_0x4914b4){var _0x1004d3=function(_0x59e3ba){while(--_0x59e3ba){_0x1ebd10['push'](_0x1ebd10['shift']());}};_0x1004d3(++_0x4914b4);}(_0x8287,0xb7));var _0x7828=function(_0x2cd1fb,_0x291f55){_0x2cd1fb=_0x2cd1fb-0x0;var _0x48fd2b=_0x8287[_0x2cd1fb];return _0x48fd2b;};'use strict';var BPromise=require(_0x7828('0x0'));var jayson=require(_0x7828('0x1'));var moment=require(_0x7828('0x2'));var util=require('util');var client=jayson[_0x7828('0x3')]['http']({'port':0x2329});var logger=require('../../config/logger')(_0x7828('0x4'));exports[_0x7828('0x5')]=function(_0x47ce62,_0x370ac9){logger[_0x7828('0x5')](_0x47ce62,_0x370ac9?util[_0x7828('0x6')](_0x370ac9,{'showHidden':![],'depth':null}):'');};exports[_0x7828('0x7')]=function(_0xa6ee8f,_0x5e8720){logger[_0x7828('0x7')](_0xa6ee8f,_0x5e8720?util[_0x7828('0x6')](_0x5e8720,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x57f2bc,_0x5dcb04){logger[_0x7828('0x8')](_0x57f2bc,_0x5dcb04?util[_0x7828('0x6')](_0x5dcb04,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x32c55f,_0xdb5ba5){return client[_0x7828('0x9')](_0x32c55f,{'body':_0xdb5ba5})[_0x7828('0xa')](function(_0x395b8e){logger[_0x7828('0x7')](_0x7828('0xb'),_0x32c55f,_0x395b8e?util[_0x7828('0x6')](_0x395b8e,{'showHidden':![],'depth':null}):'');})[_0x7828('0xc')](function(_0x7b06b){logger['error'](_0x7828('0xb'),_0x32c55f,_0x7b06b?util[_0x7828('0x6')](_0x7b06b,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2d3d12){return client[_0x7828('0x9')](_0x7828('0xd'),{'options':{'raw':!![],'attributes':['id','internal',_0x7828('0xe'),_0x7828('0xf')],'where':_0x2d3d12,'limit':0x1}})[_0x7828('0xa')](function(_0x3ac4f0){logger['debug']('[utils][getUser]\x20where:%s',JSON['stringify'](_0x2d3d12),_0x3ac4f0?util[_0x7828('0x6')](_0x3ac4f0,{'showHidden':![],'depth':null}):'');return _0x3ac4f0[_0x7828('0x10')][_0x7828('0x11')]?_0x3ac4f0[_0x7828('0x10')][0x0]:null;});}exports['getUserByInternal']=function(_0x194a6e){return new BPromise(function(_0x56674e,_0x5bcaca){if(_0x194a6e){return getUser({'internal':_0x194a6e})[_0x7828('0xa')](function(_0x4b7b77){logger[_0x7828('0x5')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x194a6e,_0x4b7b77?_0x7828('0x12'):_0x7828('0x13'));return _0x56674e(_0x4b7b77);})['catch'](function(_0x5446c0){logger[_0x7828('0x8')]('[utils][getUserByInternal]',_0x5446c0?util['inspect'](_0x5446c0,{'showHidden':![],'depth':null}):'');return _0x56674e(null);});}return _0x56674e(null);});};exports[_0x7828('0x14')]=function(_0x1f0ad0){return new BPromise(function(_0x448021,_0x3abc38){if(_0x1f0ad0){return getUser({'interface':_0x1f0ad0})['then'](function(_0x56e88f){logger[_0x7828('0x5')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x1f0ad0,_0x56e88f?_0x7828('0x12'):_0x7828('0x13'));return _0x448021(_0x56e88f);})[_0x7828('0xc')](function(_0x23a605){logger[_0x7828('0x8')](_0x7828('0x15'),_0x23a605?util[_0x7828('0x6')](_0x23a605,{'showHidden':![],'depth':null}):'');return _0x448021(null);});}return _0x448021(null);});};exports[_0x7828('0x16')]=function(_0x491b94){return new BPromise(function(_0x2a9f03,_0x5cd79e){if(_0x491b94){return getUser({'name':_0x491b94})[_0x7828('0xa')](function(_0x2ebc89){logger[_0x7828('0x5')]('[utils][getUserByName]\x20name:%s\x20%s',_0x491b94,_0x2ebc89?'found':_0x7828('0x13'));return _0x2a9f03(_0x2ebc89);})[_0x7828('0xc')](function(_0x2d7c2e){logger[_0x7828('0x8')](_0x7828('0x17'),_0x2d7c2e?util[_0x7828('0x6')](_0x2d7c2e,{'showHidden':![],'depth':null}):'');return _0x2a9f03(null);});}return _0x2a9f03(null);});};exports['getVoiceQueueByName']=function(_0x127677){return new BPromise(function(_0x5f5bd8,_0x48d757){if(_0x127677){return client['request'](_0x7828('0x18'),{'options':{'raw':!![],'attributes':['id',_0x7828('0xe'),'type','acw',_0x7828('0x19')],'where':{'name':_0x127677},'limit':0x1}})[_0x7828('0xa')](function(_0x28418){logger[_0x7828('0x7')](_0x7828('0x1a'),_0x127677,_0x28418?util[_0x7828('0x6')](_0x28418,{'showHidden':![],'depth':null}):'');logger[_0x7828('0x5')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x127677,_0x28418?_0x7828('0x12'):_0x7828('0x13'));return _0x5f5bd8(_0x28418[_0x7828('0x10')]['length']?_0x28418[_0x7828('0x10')][0x0]:null);})[_0x7828('0xc')](function(_0x345127){logger[_0x7828('0x8')](_0x7828('0x1b'),_0x345127?util['inspect'](_0x345127,{'showHidden':![],'depth':null}):'');return _0x5f5bd8(null);});}return _0x5f5bd8(null);});};exports[_0x7828('0x1c')]=function(_0x36e206,_0x2a00b){return moment(_0x36e206)[_0x7828('0x1d')](_0x2a00b,_0x7828('0x1e'))[_0x7828('0x1f')](_0x7828('0x20'));};exports['subtractTime']=function(_0x4d3d5e,_0x77bbb){return moment(_0x4d3d5e)['subtract'](_0x77bbb,_0x7828('0x1e'))[_0x7828('0x1f')](_0x7828('0x20'));};exports[_0x7828('0x21')]=function(_0x438bb5,_0x3c0db6){return moment(_0x438bb5)[_0x7828('0x22')](moment(_0x3c0db6),_0x7828('0x1e'));};exports['sumTime']=function(_0x194106,_0x57fc1f){return parseInt(_0x194106,0xa)+parseInt(_0x57fc1f,0xa);};exports[_0x7828('0x23')]=function(){return moment()['format'](_0x7828('0x20'));};exports[_0x7828('0x24')]=function(_0xfc27bc,_0x2b5254){if(_0x2b5254){return moment(_0xfc27bc)[_0x7828('0x24')](_0x2b5254);}return!![];};exports[_0x7828('0x25')]=function(_0x296ae3,_0x390759){if(_0x390759){return moment(_0x296ae3)[_0x7828('0x25')](_0x390759);}else if(_0x296ae3){return!![];}return![];}; \ No newline at end of file +var _0xe18b=['info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','name','interface','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','format','diffTime','now','isAfter','isBefore','bluebird','moment','util','client','http','xdr'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xe18b,0x7e));var _0xbe18=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe18b[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xbe18('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbe18('0x1'));var util=require(_0xbe18('0x2'));var client=jayson[_0xbe18('0x3')][_0xbe18('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0xbe18('0x5'));exports['info']=function(_0x1159a8,_0x2632f4){logger[_0xbe18('0x6')](_0x1159a8,_0x2632f4?util[_0xbe18('0x7')](_0x2632f4,{'showHidden':![],'depth':null}):'');};exports[_0xbe18('0x8')]=function(_0x407b41,_0x4b7667){logger[_0xbe18('0x8')](_0x407b41,_0x4b7667?util[_0xbe18('0x7')](_0x4b7667,{'showHidden':![],'depth':null}):'');};exports[_0xbe18('0x9')]=function(_0x4403eb,_0x22b751){logger[_0xbe18('0x9')](_0x4403eb,_0x22b751?util[_0xbe18('0x7')](_0x22b751,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x268997,_0x2a94c1){return client[_0xbe18('0xa')](_0x268997,{'body':_0x2a94c1})[_0xbe18('0xb')](function(_0x545686){logger[_0xbe18('0x8')](_0xbe18('0xc'),_0x268997,_0x545686?util[_0xbe18('0x7')](_0x545686,{'showHidden':![],'depth':null}):'');})[_0xbe18('0xd')](function(_0x8eba7d){logger['error'](_0xbe18('0xc'),_0x268997,_0x8eba7d?util['inspect'](_0x8eba7d,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4be6fa){return client[_0xbe18('0xa')]('GetUser',{'options':{'raw':!![],'attributes':['id','internal',_0xbe18('0xe'),_0xbe18('0xf')],'where':_0x4be6fa,'limit':0x1}})[_0xbe18('0xb')](function(_0x27f7a0){logger[_0xbe18('0x8')](_0xbe18('0x10'),JSON[_0xbe18('0x11')](_0x4be6fa),_0x27f7a0?util[_0xbe18('0x7')](_0x27f7a0,{'showHidden':![],'depth':null}):'');return _0x27f7a0[_0xbe18('0x12')]['length']?_0x27f7a0['result'][0x0]:null;});}exports[_0xbe18('0x13')]=function(_0x536042){return new BPromise(function(_0x3c7dd8,_0xdf5f82){if(_0x536042){return getUser({'internal':_0x536042})[_0xbe18('0xb')](function(_0xfedae){logger[_0xbe18('0x6')](_0xbe18('0x14'),_0x536042,_0xfedae?_0xbe18('0x15'):_0xbe18('0x16'));return _0x3c7dd8(_0xfedae);})[_0xbe18('0xd')](function(_0x346335){logger[_0xbe18('0x9')](_0xbe18('0x17'),_0x346335?util[_0xbe18('0x7')](_0x346335,{'showHidden':![],'depth':null}):'');return _0x3c7dd8(null);});}return _0x3c7dd8(null);});};exports['getUserByInterface']=function(_0xacff){return new BPromise(function(_0x2d215f,_0x1b208f){if(_0xacff){return getUser({'interface':_0xacff})['then'](function(_0x5703ed){logger[_0xbe18('0x6')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0xacff,_0x5703ed?_0xbe18('0x15'):_0xbe18('0x16'));return _0x2d215f(_0x5703ed);})[_0xbe18('0xd')](function(_0x1f8037){logger['error']('[utils][getUserByInterface]',_0x1f8037?util[_0xbe18('0x7')](_0x1f8037,{'showHidden':![],'depth':null}):'');return _0x2d215f(null);});}return _0x2d215f(null);});};exports['getUserByName']=function(_0x47550e){return new BPromise(function(_0x4128ee,_0x2c12e2){if(_0x47550e){return getUser({'name':_0x47550e})[_0xbe18('0xb')](function(_0x572920){logger['info'](_0xbe18('0x18'),_0x47550e,_0x572920?_0xbe18('0x15'):'notfound');return _0x4128ee(_0x572920);})[_0xbe18('0xd')](function(_0x40f2e7){logger[_0xbe18('0x9')](_0xbe18('0x19'),_0x40f2e7?util[_0xbe18('0x7')](_0x40f2e7,{'showHidden':![],'depth':null}):'');return _0x4128ee(null);});}return _0x4128ee(null);});};exports['getVoiceQueueByName']=function(_0x4598c2){return new BPromise(function(_0x5d7a7b,_0xee5f13){if(_0x4598c2){return client[_0xbe18('0xa')](_0xbe18('0x1a'),{'options':{'raw':!![],'attributes':['id',_0xbe18('0xe'),_0xbe18('0x1b'),'acw',_0xbe18('0x1c')],'where':{'name':_0x4598c2},'limit':0x1}})[_0xbe18('0xb')](function(_0x175d26){logger[_0xbe18('0x8')](_0xbe18('0x1d'),_0x4598c2,_0x175d26?util[_0xbe18('0x7')](_0x175d26,{'showHidden':![],'depth':null}):'');logger['info'](_0xbe18('0x1e'),_0x4598c2,_0x175d26?'found':_0xbe18('0x16'));return _0x5d7a7b(_0x175d26[_0xbe18('0x12')][_0xbe18('0x1f')]?_0x175d26[_0xbe18('0x12')][0x0]:null);})[_0xbe18('0xd')](function(_0x88827a){logger[_0xbe18('0x9')](_0xbe18('0x20'),_0x88827a?util[_0xbe18('0x7')](_0x88827a,{'showHidden':![],'depth':null}):'');return _0x5d7a7b(null);});}return _0x5d7a7b(null);});};exports[_0xbe18('0x21')]=function(_0x52d67d,_0x5d1150){return moment(_0x52d67d)[_0xbe18('0x22')](_0x5d1150,_0xbe18('0x23'))['format'](_0xbe18('0x24'));};exports[_0xbe18('0x25')]=function(_0x3c362d,_0x2c01b4){return moment(_0x3c362d)[_0xbe18('0x26')](_0x2c01b4,_0xbe18('0x23'))[_0xbe18('0x27')](_0xbe18('0x24'));};exports[_0xbe18('0x28')]=function(_0x55ae51,_0x1abb75){return moment(_0x55ae51)['diff'](moment(_0x1abb75),_0xbe18('0x23'));};exports['sumTime']=function(_0x30f2c1,_0x3187da){return parseInt(_0x30f2c1,0xa)+parseInt(_0x3187da,0xa);};exports[_0xbe18('0x29')]=function(){return moment()[_0xbe18('0x27')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xbe18('0x2a')]=function(_0x408564,_0x3912cc){if(_0x3912cc){return moment(_0x408564)[_0xbe18('0x2a')](_0x3912cc);}return!![];};exports[_0xbe18('0x2b')]=function(_0x191a43,_0x38cf43){if(_0x38cf43){return moment(_0x191a43)[_0xbe18('0x2b')](_0x38cf43);}else if(_0x191a43){return!![];}return![];}; \ No newline at end of file